npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dstny/scp-sdk

v2.5.2

Published

## Install

Downloads

662

Readme

SCP SDK

Install

npm i @dstny/scp-sdk

or

yarn add @dstny/scp-sdk

or

pnpm i @dstny/scp-sdk

🚀 Initialize

import { Connect } from '@dstny/scp-sdk'

const configuration = {
  mode: 'live',
  oauthUrl: 'https://oauth.connect.fuzer.net',
}

await Connect.init(configuration)

Configuration

| Attribute | Type | Default | Notes | | ----------------------- | ------------------------ | ------- | ---------------------------------------------------- | | domain | | | | | loginMethod | 'oauth2' | 'smg' | oauth2 | | smgAuthUrl | | | | | smgRealm | | | | | smgClientId | | | | | oauthUrl | | | | | oauthClientId | | | | | oauthAuthorizationRoute | | | | | oauthScope | | | | | apiUrl | | | | | secureStorage | | | | | mode | 'live' | 'mock' | 'dev' | | logMode | 'silent' | 'info' | 'verbose' | | softphone | | | | | auth | | | | | onError | (error: unknown) => void | | Function is using for handling errors from SDK side. | | | | | It will receive string or Error object as parameter |

export interface Configuration {
  defaultLogModule?: string
  defaultLoggerMetadata?: LoggerMetadata
  loggerFactory?: LoggerFactory
  domain?: string
  loginMethod?: LoginMethodType
  smgAuthUrl?: string
  smgRealm?: string
  smgClientId?: string
  oauthUrl?: string
  oauthClientId?: string
  oauthAuthorizationRoute?: string
  oauthScope?: string
  apiUrl?: string
  secureStorage?: () => SecureStorageHandler
  mode?: 'live' | 'mock' | 'dev'
  logMode?: LogLevel
  softphone?: SoftphoneOptions
  messaging?: MessagingOptions
  auth?: AuthOptions
  onError?: (error: unknown) => void
  gateways?: GatewayOptions
  apiOptions?: ApiOptions
}

🔐 Auth

Usage


import { Connect } from '@dstny/scp-sdk';

...

// Listen to authentication changes

const unsubscribe = Connect.auth.onAuthStateChanged((user: User) => {
  if(user){
    // Logged in
  } else {
    // Logged out
  }
})


// This will return oauth url to open in browser

Connect.auth.initOauth(returnUrl: string).then((url: string) => {

// open Url in browser > user login > get Authorization Code in the return url

})

...

const result = await Connect.auth.signIn("<authorizationCode>", "<redirectUri>")

...

Current user

import { Connect } from  '@dstny/scp-sdk';
...

const currentUser = Connect.auth.currentUser
await currentUser.setMood('Feeling good')

Methods

| Methods Name | Args | Returns | Notes | | ------------ | ----------------------- | --------------- | ----- | | setStatus | status: SetStatusData | Promise<void> | | | setMood | mood: string | Promise<void> | |

Events

import { Connect } from  '@dstny/scp-sdk';
...

const currentUser = Connect.auth.currentUser
const unsubscribe = currentUser.on(CONTACT_EVENT.ON_CONTACT_UPDATE, (user) => {

})

// To remove subsciption on current user contact events events call unsubscribe function

unsubscribe()

| Event Name | Returns | Notes | | :----------------- | ------- | ----- | | ON_CONTACT_UPDATE | User | | | ON_PRESENCE_UPDATE | User | |

Attributes

| Name | type | Default | Notes | | --------------- | --------------------- | ------- | ----- | | mood | string | | | | photo | string | | | | availableStatus | IStatusDefinition[] | [] | | | contact | Contact | | |

📱 Softphone

import { Connect } from 'connect-sdk'

...

const softphone = Connect.softphone

...

const call = softphone.placeCall('+32494049494')

...

await call.hangup()

...

const unsub = softphone.onNewCall((call) => {
  await call.answer()
})

Softphone

Methods

| Methods Name | Args | Returns | Notes | | ------------ | ------------------------------------------ | --------------- | ---------------------------------------- | | placeCall | number: string, callerIdName = 'Unknown' | Promise<Call> | | | answerCall | uuid: string | Promise<void> | @deprecated Please use Call.answer | | endCall | uuid: string | Promise<void> | deprecated Please Use Call.hangup |

Events

| Event Name | Args | Returns | Notes | | :---------------- | ----------------------------- | ---------- | ----- | | onNewCall | cb: (call: Call) => void | () => void | | | onCallEstablished | cb: (call: Call) => void | () => void | | | onCallsUpdate | cb: (calls: Call[]) => void | () => void | | | onSipRegistered | cb: () => void | () => void | | | onSipUnRegistered | cb: () => void | () => void | |

Attributes

| Name | type | Default | Notes | | ------------------ | ------------------------ | ----------- | ----- | | calls | {[uuid: string]: Call} | [] | | | currentCall | Call | undefined | | | peopleInConference | Contact[] | [] | | | audioManager | AudioManager | | |

Call object

Methods

| Methods Name | Args | Returns | Notes | | ---------------- | ---------------- | --------------- | ----- | | answer | | Promise<void> | | | hangup | | Promise<void> | | | attendedTransfer | call: Call | Promise<void> | | | blindTransfer | number: string | Promise<void> | | | addToConference | | Promise<void> | | | hold | | Promise<void> | | | unHold | | Promise<void> | | | toggleMute | | | | | sendDTMF | dtmf:DTMF | Promise<void> | |

Events

.....

const unsubscribe = call.on(CALL_EVENT.ON_CALL_INFO_UPDATE,(call)=>{

})

// To remove subsciption on call events call unsubscribe function

unsubscribe()

| Event Name | Returns | Notes | | :--------------------- | ------------- | ----- | | ON_CALL_ANSWER | Call | | | ON_CALL_HANGUP | Call | | | ON_CALL_INFO_UPDATE | Call | | | ON_CALL_HOLD | Call | | | ON_CALL_UNHOLD | Call | | | ON_CALL_MUTED | Call | | | ON_CALL_UNMUTED | Call | | | ON_CALL_ESTABLISHED | Call | | | ON_CALL_QUALITY_UPDATE | CallQuality | |

Attributes

| Name | type | Default | Notes | | ------------------ | ------------ | ----------- | ----------- | | contact | Contact | undefined | | | isTransfert | booleab | false | | | isOutGoing | boolean | false | | | isRemote | boolean | false | | | callId | string | | | | channel | Channels | Channels | undefined | | callerName | string | | | | callerNum | string | | | | muted | boolean | false | | | transferable | boolean | | | | inConference | boolean | false | | | peopleInConference | Contact [] | [] | |

🗂 Directory

Usage

import { Connect } from 'connectme-sdk'

...

const directory = Connect.directory
const contactList = await directory.getContactList()

...

 await directory.onContactSelectedFromSearch(contactsResult[index].uid)

...

 const contacts = await directory.search(_query)

Methods

| Methods Name | Args | Returns | Notes | | ------------------------------ | ----------------------------------------------------- | -------------------------- | ----------- | --- | | search | query: string | Promise<Contact[]> | | | getSearchHistory | | Promise<Contact[]> | | | onContactSelectedFromSearch | uid: string | Promise<void> | | | getContact | uid: string | Promise<Contact | undefined> | | | getContactByNumber | phoneNumber: string | Promise<Contact | undefined> | | | getGroups | | Promise<Group[]> | | | getAllContact | | Promise<Contact[]> | | | getAvailableContactFirstLetter | | Promise<ContactAlphabet> | | | addToFavorite | contact: Contact | Promise<void> | | | getContactList | | Promise<Contact[]> | | | removeToFavorite | contact: Contact | Promise<void> | | | addToVip | contact: Contact | Promise<void> | | | removeFromVip | contact: Contact | Promise<void> | | | block | contact: Contact | Promise<void> | | | unBlock | contact: Contact | Promise<void> | | | deleteContact | uid: string | Promise<void> | | | reOrderGroups | groupId: string, fromIndex: number, toIndex: number | Promise<void> | | | addToFavorite | contact: Contact | Promise<void> | |

Events

import { Connect } from  'connectme-sdk';
...

const directory = Connect.directory
const unsubscribe = directory.on(DIRECTORY_EVENT.ON_DIRECTORY_UPDATE, (user) => {

})

// To remove subsciption on directory events call unsubscribe function

unsubscribe()

| Event Name | Returns | Notes | | :------------------ | ----------- | ----- | | ON_CONTACT_UPDATE | Contact | | | ON_DIRECTORY_UPDATE | Contact[] | | | ON_CONTACT_DELETE | User | | | ON_GROUPS_UPDATE | Group[] | |

Attributes

| Name | type | Default | Notes | | ------ | --------- | ------- | ----- | | groups | Group[] | [] | |

Contact object

Methods

| Methods Name | Args | Returns | Notes | | ------------ | -------------------------------- | ---------- | ----- | | subscribe | cb: (contact: Contact) => void | () => void | |

Events

.....

const unsubscribe = contact.on(CONTACT_EVENT.ON_CONTACT_UPDATE, (contact) => {

})

// To remove subsciption on contact events call unsubscribe function
unsubscribe()

| Event Name | Returns | Notes | | :----------------- | --------- | ----- | | ON_CONTACT_UPDATE | Contact | | | ON_PRESENCE_UPDATE | Contact | |

Attributes

See => Contact source code

📣 Gateway

Gateway Documentation

📣 Application Storage

Application Storage