@twilio/conversations 2.0.1-rc.2 → 2.0.1-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/{dist → builds}/browser.js +2 -2
- package/builds/browser.js.map +1 -0
- package/{dist → builds}/lib.d.ts +0 -0
- package/{dist → builds}/lib.js +2 -2
- package/builds/lib.js.map +1 -0
- package/{dist → builds}/twilio-conversations.js +5 -5
- package/builds/twilio-conversations.min.js +156 -0
- package/dist/aggregated-delivery-receipt.js +227 -0
- package/dist/aggregated-delivery-receipt.js.map +1 -0
- package/dist/client.js +872 -0
- package/dist/client.js.map +1 -0
- package/dist/command-executor.js +203 -0
- package/dist/command-executor.js.map +1 -0
- package/dist/configuration.js +196 -0
- package/dist/configuration.js.map +1 -0
- package/dist/conversation.js +973 -0
- package/dist/conversation.js.map +1 -0
- package/dist/data/conversations.js +443 -0
- package/dist/data/conversations.js.map +1 -0
- package/dist/data/messages.js +341 -0
- package/dist/data/messages.js.map +1 -0
- package/dist/data/participants.js +313 -0
- package/dist/data/participants.js.map +1 -0
- package/dist/data/users.js +228 -0
- package/dist/data/users.js.map +1 -0
- package/dist/detailed-delivery-receipt.js +154 -0
- package/dist/detailed-delivery-receipt.js.map +1 -0
- package/dist/index.js +167 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/notification-types.js +143 -0
- package/dist/interfaces/notification-types.js.map +1 -0
- package/dist/logger.js +190 -0
- package/dist/logger.js.map +1 -0
- package/dist/media.js +213 -0
- package/dist/media.js.map +1 -0
- package/dist/message-builder.js +209 -0
- package/dist/message-builder.js.map +1 -0
- package/dist/message.js +450 -0
- package/dist/message.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js +161 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/packages/conversations/package.json.js +136 -0
- package/dist/packages/conversations/package.json.js.map +1 -0
- package/dist/participant.js +346 -0
- package/dist/participant.js.map +1 -0
- package/dist/push-notification.js +152 -0
- package/dist/push-notification.js.map +1 -0
- package/dist/rest-paginator.js +175 -0
- package/dist/rest-paginator.js.map +1 -0
- package/dist/services/network.js +205 -0
- package/dist/services/network.js.map +1 -0
- package/dist/services/typing-indicator.js +235 -0
- package/dist/services/typing-indicator.js.map +1 -0
- package/dist/unsent-message.js +159 -0
- package/dist/unsent-message.js.map +1 -0
- package/dist/user.js +392 -0
- package/dist/user.js.map +1 -0
- package/dist/util/deferred.js +154 -0
- package/dist/util/deferred.js.map +1 -0
- package/dist/util/index.js +206 -0
- package/dist/util/index.js.map +1 -0
- package/{dist/docs → docs}/assets/css/main.css +0 -0
- package/{dist/docs → docs}/assets/images/icons.png +0 -0
- package/{dist/docs → docs}/assets/images/icons@2x.png +0 -0
- package/{dist/docs → docs}/assets/images/widgets.png +0 -0
- package/{dist/docs → docs}/assets/images/widgets@2x.png +0 -0
- package/{dist/docs → docs}/assets/js/main.js +0 -0
- package/{dist/docs → docs}/assets/js/search.js +0 -0
- package/{dist/docs → docs}/classes/AggregatedDeliveryReceipt.html +0 -0
- package/{dist/docs → docs}/classes/Client.html +0 -0
- package/{dist/docs → docs}/classes/Conversation.html +0 -0
- package/{dist/docs → docs}/classes/DetailedDeliveryReceipt.html +0 -0
- package/{dist/docs → docs}/classes/Media.html +0 -0
- package/{dist/docs → docs}/classes/Message.html +0 -0
- package/{dist/docs → docs}/classes/MessageBuilder.html +0 -0
- package/{dist/docs → docs}/classes/Participant.html +0 -0
- package/{dist/docs → docs}/classes/PushNotification.html +0 -0
- package/{dist/docs → docs}/classes/RestPaginator.html +0 -0
- package/{dist/docs → docs}/classes/UnsentMessage.html +0 -0
- package/{dist/docs → docs}/classes/User.html +0 -0
- package/{dist/docs → docs}/index.html +0 -0
- package/{dist/docs → docs}/interfaces/ClientOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/ConversationState.html +0 -0
- package/{dist/docs → docs}/interfaces/CreateConversationOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/LastMessage.html +0 -0
- package/{dist/docs → docs}/interfaces/Paginator.html +0 -0
- package/{dist/docs → docs}/interfaces/PushNotificationData.html +0 -0
- package/{dist/docs → docs}/interfaces/SendEmailOptions.html +0 -0
- package/{dist/docs → docs}/interfaces/SendMediaOptions.html +0 -0
- package/{dist/docs → docs}/modules.html +0 -0
- package/package.json +23 -22
- package/dist/browser.js.map +0 -1
- package/dist/lib.js.map +0 -1
- package/dist/post-install.js +0 -29
- package/dist/react-native.js +0 -4035
- package/dist/react-native.js.map +0 -1
- package/dist/twilio-conversations.min.js +0 -156
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import { Logger } from './logger';\nimport { Configuration } from './configuration';\n\nimport { User, UserUpdatedEventArgs, UserUpdateReason } from './user';\nimport { Network } from './services/network';\n\nimport { NotificationTypes } from './interfaces/notification-types';\n\nimport { TwilsockClient, InitRegistration, ConnectionState as TwilsockConnectionState, Transport } from 'twilsock';\nimport { ChannelType, Notifications as NotificationClient } from '@twilio/notifications';\nimport { SyncClient } from 'twilio-sync';\nimport { McsClient } from '@twilio/mcs-client';\n\nimport { Conversation, Conversations as ConversationsEntity } from './data/conversations';\n\nimport { Users } from './data/users';\nimport { TypingIndicator } from './services/typing-indicator';\nimport { Paginator } from './interfaces/paginator';\nimport { PushNotification } from './push-notification';\nimport { deepClone, parseToNumber } from './util';\nimport {\n Participant,\n ParticipantUpdatedEventArgs,\n ParticipantUpdateReason\n} from './participant';\nimport { Message, MessageUpdatedEventArgs, MessageUpdateReason } from './message';\nimport { TelemetryEventDescription, TelemetryPoint } from 'twilsock';\nimport {\n validateTypesAsync,\n validateTypes,\n literal,\n nonEmptyString,\n pureObject,\n objectSchema,\n validateConstructorTypes\n} from '@twilio/declarative-type-validator';\nimport { version } from '../package.json';\nimport {\n ConversationUpdatedEventArgs,\n ConversationUpdateReason\n} from './conversation';\nimport { CommandExecutor } from './command-executor';\nimport { ConfigurationResponse } from './interfaces/commands/configuration';\nimport { ReplayEventEmitter } from '@twilio/replay-event-emitter';\n\nconst log = Logger.scope('Client');\n\nconst SDK_VERSION = version;\n\nclass ClientServices {\n commandExecutor: CommandExecutor;\n twilsockClient: TwilsockClient;\n users: Users;\n notificationClient: NotificationClient;\n network: Network;\n typingIndicator: TypingIndicator;\n syncClient: SyncClient;\n mcsClient: McsClient;\n transport: Transport;\n}\n\ntype ClientEvents = {\n conversationAdded: (conversation: Conversation) => void;\n conversationJoined: (conversation: Conversation) => void;\n conversationLeft: (conversation: Conversation) => void;\n conversationRemoved: (conversation: Conversation) => void;\n conversationUpdated: (data: {\n conversation: Conversation;\n updateReasons: ConversationUpdateReason[];\n }) => void;\n participantJoined: (participant: Participant) => void;\n participantLeft: (participant: Participant) => void;\n participantUpdated: (data: {\n participant: Participant;\n updateReasons: ParticipantUpdateReason[];\n }) => void;\n messageAdded: (message: Message) => void;\n messageRemoved: (message: Message) => void;\n messageUpdated: (data: {\n message: Message;\n updateReasons: MessageUpdateReason[];\n }) => void;\n tokenAboutToExpire: (ttl: number) => void;\n tokenExpired: () => void;\n typingEnded: (participant: Participant) => void;\n typingStarted: (participant: Participant) => void;\n pushNotification: (pushNotification: PushNotification) => void;\n userSubscribed: (user: User) => void;\n userUnsubscribed: (user: User) => void;\n userUpdated: (data: {\n user: User;\n updateReasons: UserUpdateReason[];\n }) => void;\n stateChanged: (state: State) => void;\n connectionStateChanged: (state: TwilsockConnectionState) => void;\n connectionError: (data: {\n terminal: boolean;\n message: string;\n httpStatusCode?: number;\n errorCode?: number;\n }) => void;\n};\n\n/**\n * Connection state of the client. Possible values are as follows:\n * * `'connecting'` - client is offline and connection attempt is in process\n * * `'connected'` - client is online and ready\n * * `'disconnecting'` - client is going offline as disconnection is in process\n * * `'disconnected'` - client is offline and no connection attempt is in process\n * * `'denied'` - client connection is denied because of invalid JWT access token. User must refresh token in order to proceed\n */\ntype ConnectionState = TwilsockConnectionState;\n\n/**\n * State of the client. Possible values are as follows:\n * * `'failed'` - the client failed to initialize\n * * `'initialized'` - the client successfully initialized\n */\ntype State = 'failed' | 'initialized';\n\n/**\n * Notifications channel type. Possible values are as follows:\n * * `'fcm'`\n * * `'apn'`\n */\ntype NotificationsChannelType = ChannelType;\n\ntype LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | null;\n\n/**\n * Conversations client options.\n */\ninterface ClientOptions {\n /**\n * The level of logging to enable.\n */\n logLevel?: LogLevel;\n region?: string;\n productId?: string;\n twilsockClient?: TwilsockClient;\n transport?: Transport;\n notificationsClient?: NotificationClient;\n syncClient?: SyncClient;\n typingIndicatorTimeoutOverride?: number;\n consumptionReportIntervalOverride?: string;\n httpCacheIntervalOverride?: string;\n userInfosToSubscribeOverride?: number;\n retryWhenThrottledOverride?: boolean;\n backoffConfigOverride?: any;\n Chat?: any;\n IPMessaging?: any;\n Sync?: any;\n Notification?: any;\n Twilsock?: any;\n clientMetadata?: any;\n initRegistrations?: InitRegistration[];\n disableDeepClone?: boolean;\n}\n\n/**\n * Options for {@link Client.createConversation}.\n */\ninterface CreateConversationOptions {\n /**\n * Any custom attributes to attach to the conversation.\n */\n attributes?: any;\n\n /**\n * A non-unique display name of the conversation.\n */\n friendlyName?: string;\n\n /**\n * A unique identifier of the conversation.\n */\n uniqueName?: string;\n}\n\n/**\n * A client is the starting point to the Twilio Conversations functionality.\n */\n@validateConstructorTypes(nonEmptyString, [\n pureObject,\n 'undefined'\n])\nclass Client extends ReplayEventEmitter<ClientEvents> {\n /**\n * Client connection state.\n */\n public connectionState: ConnectionState = 'unknown';\n private conversationsPromise: Promise<any> | null = null;\n private _ensureReady: Promise<any> = null;\n private _resolveEnsureReady: (value?: any) => void = null;\n private _rejectEnsureReady: (err: Error) => void = null;\n private fpaToken: string;\n private configuration: Configuration;\n private conversations: any;\n private readonly options: ClientOptions;\n private services: ClientServices;\n private readonly _myself: User;\n\n /**\n * Current version of the Conversations client.\n */\n public static readonly version: string = SDK_VERSION;\n\n /**\n * Current version of the Conversations client.\n */\n public readonly version: string = SDK_VERSION;\n\n private static readonly supportedPushChannels: NotificationsChannelType[] = ['fcm', 'apn'];\n private static readonly supportedPushDataFields = {\n 'conversation_sid': 'conversationSid',\n 'message_sid': 'messageSid',\n 'message_index': 'messageIndex'\n };\n\n /**\n * Returned Conversations instance is not yet fully initialized. Calling any operations will block until it is.\n * Use connection events to monitor when client becomes fully available (connectionStateChanged with state\n * 'connected') or not available (connectionStateChange with state 'denied', event tokenExpired, event connectionError).\n *\n * @param fpaToken Access token\n * @param options Options to customize the Client\n * @returns A not yet fully-initialized client.\n */\n public constructor(fpaToken: string, options: ClientOptions = {}) {\n super();\n\n this.fpaToken = fpaToken;\n this.options = options;\n\n if (!this.options.disableDeepClone) {\n let options = {\n ...this.options,\n transport: undefined,\n twilsockClient: undefined\n };\n\n options = deepClone(options);\n options.transport = this.options.transport;\n options.twilsockClient = this.options.twilsockClient;\n\n this.options = options;\n }\n\n this.options.logLevel = this.options.logLevel ?? 'silent';\n log.setLevel(this.options.logLevel);\n\n const productId = this.options.productId = 'ip_messaging';\n\n // Filling ClientMetadata\n this.options.clientMetadata = this.options.clientMetadata || {};\n\n if (!this.options.clientMetadata.hasOwnProperty('type')) {\n this.options.clientMetadata.type = 'conversations';\n }\n\n if (!this.options.clientMetadata.hasOwnProperty('sdk')) {\n this.options.clientMetadata.sdk = 'JS';\n this.options.clientMetadata.sdkv = SDK_VERSION;\n }\n\n // Enable session local storage for Sync\n this.options.Sync = this.options.Sync || {};\n\n if (typeof this.options.Sync.enableSessionStorage === 'undefined') {\n this.options.Sync.enableSessionStorage = true;\n }\n\n if (this.options.region) {\n this.options.Sync.region = this.options.region;\n }\n\n if (!fpaToken) {\n throw new Error('A valid Twilio token should be provided');\n }\n\n this.services = new ClientServices();\n\n this._myself = new User(\n '',\n '',\n null,\n this.services\n );\n\n const startTwilsock = !this.options.twilsockClient;\n\n // Create default init registrations if none were provided.\n // Otherwise, the outside party have to list all the init registrations they\n // need.\n // Init registrations passed to the Conversations client will be passed down\n // to the Sync client as well.\n if (!this.options.initRegistrations) {\n const initRegistration = new InitRegistration(productId);\n Client.populateInitRegistrations(initRegistration);\n this.options.initRegistrations = [initRegistration];\n }\n\n this.services.twilsockClient = (this.options.twilsockClient = this.options.twilsockClient\n ?? new TwilsockClient(fpaToken, productId, this.options));\n\n this.services.twilsockClient.on('tokenAboutToExpire', ttl => this.emit('tokenAboutToExpire', ttl));\n this.services.twilsockClient.on('tokenExpired', () => this.emit('tokenExpired'));\n this.services.twilsockClient.on('connectionError', (error) => this.emit('connectionError', error));\n this.services.twilsockClient.on('stateChanged', (state: ConnectionState) => {\n log.debug(`Handling stateChanged for ConversationsClient: new state ${state}`);\n if (state !== this.connectionState) {\n this.connectionState = state;\n this.emit('connectionStateChanged', this.connectionState);\n }\n });\n\n this.services.transport = (this.options.transport = (this.options.transport ?? this.options.twilsockClient) as Transport);\n this.services.notificationClient = (this.options.notificationsClient = this.options.notificationsClient\n ?? new NotificationClient(fpaToken, this.options));\n this.services.syncClient = (this.options.syncClient = this.options.syncClient\n ?? new SyncClient(fpaToken, this.options));\n\n const configurationOptions = options.Chat || options.IPMessaging || options || {};\n const region = configurationOptions.region || options.region;\n const baseUrl = configurationOptions.apiUri\n || configurationOptions.typingUri\n || `https://aim.${region || 'us1'}.twilio.com`;\n\n this.services.commandExecutor = new CommandExecutor(\n baseUrl,\n { transport: this.options.transport },\n productId\n );\n\n const emitFailed = (err): void => {\n this._rejectEnsureReady(err);\n this.emit('stateChanged', 'failed');\n };\n\n this.services.twilsockClient.once('connectionError', emitFailed);\n this.services.twilsockClient.once('disconnected', emitFailed);\n\n // ConversationsClient will be able to initialize only after twilsock is connected\n this.services.twilsockClient.once('connected', async () => {\n log.debug(`ConversationsClient started INITIALIZING`);\n this.services.twilsockClient.off('connectionError', emitFailed);\n this.services.twilsockClient.off('disconnected', emitFailed);\n try {\n const startupEvent = 'conversations.client.startup';\n\n this.services.twilsockClient.addPartialTelemetryEvent(new TelemetryEventDescription(\n startupEvent,\n 'Conversations client startup',\n new Date()\n ), startupEvent, TelemetryPoint.Start);\n\n await this._initialize();\n\n this.services.twilsockClient.addPartialTelemetryEvent(\n new TelemetryEventDescription('', '', new Date()),\n startupEvent,\n TelemetryPoint.End);\n } catch (err) {\n // Fail ChatClient if initialization is incomplete\n this._rejectEnsureReady(err);\n this.emit('stateChanged', 'failed');\n }\n });\n\n this._ensureReady = new Promise((resolve, reject) => {\n this._resolveEnsureReady = resolve;\n this._rejectEnsureReady = reject;\n }).catch((err) => {}); // @todo How to process unhandled rejection here?\n\n if (startTwilsock) {\n this.services.twilsockClient.connect();\n }\n }\n\n public static populateInitRegistrations(reg: InitRegistration) {\n reg.populateInitRegistrations([NotificationTypes.TYPING_INDICATOR]);\n SyncClient.populateInitRegistrations(reg);\n }\n\n /**\n * Fired when a conversation becomes visible to the client. The event is also triggered when the client creates a new conversation.\n * Fired for all conversations client has joined.\n *\n * Parameters:\n * 1. {@link Conversation} `conversation` - the conversation in question\n * @event\n */\n static readonly conversationAdded = 'conversationAdded';\n\n /**\n * Fired when the client joins a conversation.\n *\n * Parameters:\n * 1. {@link Conversation} `conversation` - the conversation in question\n * @event\n */\n static readonly conversationJoined = 'conversationJoined';\n\n /**\n * Fired when the client leaves a conversation.\n *\n * Parameters:\n * 1. {@link Conversation} `conversation` - the conversation in question\n * @event\n */\n static readonly conversationLeft = 'conversationLeft';\n\n /**\n * Fired when a conversation is no longer visible to the client.\n *\n * Parameters:\n * 1. {@link Conversation} `conversation` - the conversation in question\n * @event\n */\n static readonly conversationRemoved = 'conversationRemoved';\n\n /**\n * Fired when the attributes or the metadata of a conversation have been updated.\n * During conversation's creation and initialization, this event might be fired multiple times\n * for same joined or created conversation as new data is arriving from different sources.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link Conversation} `conversation` - the conversation in question\n * * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons for the update\n * @event\n */\n static readonly conversationUpdated = 'conversationUpdated';\n\n /**\n * Fired when a participant has joined a conversation.\n *\n * Parameters:\n * 1. {@link Participant} `participant` - the participant in question\n * @event\n */\n static readonly participantJoined = 'participantJoined';\n\n /**\n * Fired when a participant has left a conversation.\n *\n * Parameters:\n * 1. {@link Participant} `participant` - the participant in question\n * @event\n */\n static readonly participantLeft = 'participantLeft';\n\n /**\n * Fired when a participant's fields have been updated.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link Participant} `participant` - the participant in question\n * * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons for the update\n * @event\n */\n static readonly participantUpdated = 'participantUpdated';\n\n /**\n * Fired when a new message has been added to the conversation on the server.\n *\n * Parameters:\n * 1. {@link Message} `message` - the message in question\n * @event\n */\n static readonly messageAdded = 'messageAdded';\n\n /**\n * Fired when a message is removed from the message list of a conversation.\n *\n * Parameters:\n * 1. {@link Message} `message` - the message in question\n * @event\n */\n static readonly messageRemoved = 'messageRemoved';\n\n /**\n * Fired when the fields of an existing message are updated with new values.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link Message} `message` - the message in question\n * * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for the update\n * @event\n */\n static readonly messageUpdated = 'messageUpdated';\n\n /**\n * Fired when the token is about to expire and needs to be updated.\n * * Parameters:\n * 1. number `message` - token's time to live\n * @event\n */\n static readonly tokenAboutToExpire = 'tokenAboutToExpire';\n\n /**\n * Fired when the token has expired.\n * @event\n */\n static readonly tokenExpired = 'tokenExpired';\n\n /**\n * Fired when a participant has stopped typing.\n *\n * Parameters:\n * 1. {@link Participant} `participant` - the participant in question\n * @event\n */\n static readonly typingEnded = 'typingEnded';\n\n /**\n * Fired when a participant has started typing.\n *\n * Parameters:\n * 1. {@link Participant} `participant` - the participant in question\n * @event\n */\n static readonly typingStarted = 'typingStarted';\n\n /**\n * Fired when the client has received (and parsed) a push notification via one of the push channels (apn or fcm).\n *\n * Parameters:\n * 1. {@link PushNotification} `pushNotification` - the push notification in question\n * @event\n */\n static readonly pushNotification = 'pushNotification';\n\n /**\n * Fired when the client has subscribed to a user.\n *\n * Parameters:\n * 1. {@link User} `user` - the user in question\n * @event\n */\n static readonly userSubscribed = 'userSubscribed';\n\n /**\n * Fired when the client has unsubscribed from a user.\n *\n * Parameters:\n * 1. {@link User} `user` - the user in question\n * @event\n */\n static readonly userUnsubscribed = 'userUnsubscribed';\n\n /**\n * Fired when the properties or the reachability status of a user have been updated.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link User} `user` - the user in question\n * * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the update\n * @event\n */\n static readonly userUpdated = 'userUpdated';\n\n /**\n * Fired when the state of the client has been changed.\n *\n * Parameters:\n * 1. {@link State} `state` - the new client state\n * @event\n */\n static readonly stateChanged = 'stateChanged';\n\n /**\n * Fired when the connection state of the client has been changed.\n *\n * Paremeters:\n * 1. {@link ConnectionState} `state` - the new connection state\n * @event\n */\n static readonly connectionStateChanged = 'connectionStateChanged';\n\n /**\n * Fired when the connection is interrupted for an unexpected reason.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * boolean `terminal` - Twilsock will stop connection attempts if true\n * * string `message` - the error message of the root cause\n * * number? `httpStatusCode` - http status code if available\n * * number? `errorCode` - Twilio public error code if available\n * @event\n */\n static readonly connectionError = 'connectionError';\n\n /**\n * @deprecated Call constructor directly.\n *\n * Factory method to create a Conversations client instance.\n *\n * The factory method will automatically trigger connection.\n * Do not use it if you need finer-grained control.\n *\n * Since this method returns an already-initialized client, some of the events\n * will be lost because they happen *before* the initialization. It is\n * recommended that `client.onWithReplay` is used as opposed to `client.on`\n * for subscribing to client events. The `client.onWithReplay` will re-emit\n * the most recent value for a given event if it emitted before the\n * subscription.\n *\n * @param token Access token.\n * @param options Options to customize the client.\n * @returns Returns a fully initialized client.\n */\n @validateTypesAsync('string', ['undefined', pureObject])\n static async create(token: string, options?: ClientOptions): Promise<Client> {\n // The logic is as follows:\n // - If twilsock is not passed in, then the ConversationsClient constructor will call twilsock.connect() by itself\n // and we do not need to do it here.\n // - If twilsock was passed in from the outside, but customer called ConversationsClient.create() then they are\n // using an obsolete workflow and the startup sequence will never complete.\n if (options?.twilsockClient) {\n throw new Error('Obsolete usage of ConversationsClient.create() ' +\n 'factory method: if you pass twilsock from the outside then you must ' +\n 'use ConversationsClient constructor and be prepared to work with ' +\n 'uninitialized client.');\n }\n\n const client = new Client(token, options);\n await client._ensureReady;\n\n return client;\n }\n\n /**\n * Information of the logged-in user. Before client initialization, returns an\n * uninitialized user. Will trigger a {@link Client.userUpdated} event after\n * initialization.\n */\n public get user(): User { return this._myself; }\n\n /**\n * Client reachability state. Throws if accessed before the client\n * initialization was completed.\n */\n public get reachabilityEnabled(): boolean {\n if (!this.configuration) {\n throw new Error(\n 'Reachability information could not yet be accessed as the client ' +\n \"has not yet been initialized. Subscribe to the 'stateChanged' event \" +\n 'to properly react to the client initialization.'\n );\n }\n\n return this.configuration.reachabilityEnabled;\n }\n\n public get token(): string { return this.fpaToken; }\n\n private _subscribeToPushNotifications(channelType: NotificationsChannelType) {\n [NotificationTypes.NEW_MESSAGE,\n NotificationTypes.ADDED_TO_CONVERSATION,\n NotificationTypes.REMOVED_FROM_CONVERSATION,\n NotificationTypes.TYPING_INDICATOR,\n NotificationTypes.CONSUMPTION_UPDATE]\n .forEach(messageType => {\n this.services.notificationClient.subscribe(channelType, messageType);\n });\n }\n\n private _unsubscribeFromPushNotifications(channelType: NotificationsChannelType) {\n [NotificationTypes.NEW_MESSAGE,\n NotificationTypes.ADDED_TO_CONVERSATION,\n NotificationTypes.REMOVED_FROM_CONVERSATION,\n NotificationTypes.TYPING_INDICATOR,\n NotificationTypes.CONSUMPTION_UPDATE]\n .forEach(messageType => {\n this.services.notificationClient.unsubscribe(channelType, messageType);\n });\n }\n\n private async _initialize() {\n const configurationResponse = await this.services.commandExecutor.fetchResource<void, ConfigurationResponse>(\n 'Client/v2/Configuration'\n );\n\n this.configuration = new Configuration(this.options, configurationResponse, log);\n\n this._myself._resolveInitialization(\n this.configuration,\n this.configuration.userIdentity,\n this.configuration.userInfo,\n true\n );\n\n this.services.typingIndicator = new TypingIndicator(this.getConversationBySid.bind(this), this.configuration, this.services);\n this.services.network = new Network(this.configuration, this.services);\n\n this.services.users = new Users(this._myself, this.configuration, this.services);\n this.services.users.on('userSubscribed', this.emit.bind(this, 'userSubscribed'));\n this.services.users.on('userUpdated', (args: UserUpdatedEventArgs) => this.emit('userUpdated', args));\n this.services.users.on('userUnsubscribed', this.emit.bind(this, 'userUnsubscribed'));\n\n this.conversations = new ConversationsEntity(this.configuration, this.services);\n\n this.conversations.on('conversationAdded', this.emit.bind(this, 'conversationAdded'));\n this.conversations.on('conversationRemoved', this.emit.bind(this, 'conversationRemoved'));\n this.conversations.on('conversationJoined', this.emit.bind(this, 'conversationJoined'));\n this.conversations.on('conversationLeft', this.emit.bind(this, 'conversationLeft'));\n this.conversations.on('conversationUpdated',\n (args: ConversationUpdatedEventArgs) => this.emit('conversationUpdated', args));\n\n this.conversations.on('participantJoined', this.emit.bind(this, 'participantJoined'));\n this.conversations.on('participantLeft', this.emit.bind(this, 'participantLeft'));\n this.conversations.on('participantUpdated',\n (args: ParticipantUpdatedEventArgs) => this.emit('participantUpdated', args));\n\n this.conversations.on('messageAdded', this.emit.bind(this, 'messageAdded'));\n this.conversations.on('messageUpdated',\n (args: MessageUpdatedEventArgs) => this.emit('messageUpdated', args));\n this.conversations.on('messageRemoved', this.emit.bind(this, 'messageRemoved'));\n\n this.conversations.on('typingStarted', this.emit.bind(this, 'typingStarted'));\n this.conversations.on('typingEnded', this.emit.bind(this, 'typingEnded'));\n\n this.conversationsPromise = this.conversations.fetchConversations()\n .then(() => this.conversations)\n .catch((error) => {\n throw error;\n });\n\n await this.services.users.myself._ensureFetched();\n\n Client.supportedPushChannels.forEach(channelType => this._subscribeToPushNotifications(channelType));\n this.services.typingIndicator.initialize();\n\n this.services.mcsClient = new McsClient(this.fpaToken, this.configuration.links.mediaService, this.configuration.links.mediaSetService, {\n ...this.options,\n transport: null,\n });\n\n this._resolveEnsureReady();\n this.emit('stateChanged', 'initialized');\n }\n\n /**\n * Gracefully shut down the client.\n */\n async shutdown(): Promise<void> {\n await this._ensureReady;\n await this.services.twilsockClient.disconnect();\n }\n\n /**\n * Update the token used by the client and re-register with the Conversations services.\n * @param token New access token.\n */\n @validateTypesAsync(nonEmptyString)\n async updateToken(token: string): Promise<Client> {\n await this._ensureReady;\n log.info('updateToken');\n\n if (this.fpaToken === token) {\n return this;\n }\n\n await this.services.twilsockClient.updateToken(token);\n await this.services.notificationClient.updateToken(token);\n await this.services.mcsClient.updateToken(token);\n this.fpaToken = token;\n\n return this;\n }\n\n /**\n * Get a known conversation by its SID.\n * @param conversationSid Conversation sid\n */\n @validateTypesAsync(nonEmptyString)\n async getConversationBySid(conversationSid: string): Promise<Conversation> {\n await this._ensureReady;\n await this.conversations.myConversationsRead.promise;\n let conversation = await this.conversations.getConversation(conversationSid);\n\n if (!conversation) {\n conversation = await this.conversations.peekConversation(conversationSid);\n }\n\n if (!conversation) {\n throw new Error(`Conversation with SID ${conversationSid} is not found.`);\n }\n\n return conversation;\n }\n\n /**\n * Get a known conversation by its unique identifier name.\n * @param uniqueName The unique identifier name of the conversation.\n */\n @validateTypesAsync(nonEmptyString)\n async getConversationByUniqueName(uniqueName: string): Promise<Conversation> {\n await this._ensureReady;\n await this.conversations.myConversationsRead.promise;\n const conversation = await this.conversations.getConversationByUniqueName(uniqueName);\n\n if (!conversation) {\n throw new Error(`Conversation with unique name ${uniqueName} is not found.`);\n }\n\n return conversation;\n }\n\n /**\n * Get the current list of all the subscribed conversations.\n */\n public async getSubscribedConversations(args?): Promise<Paginator<Conversation>> {\n await this._ensureReady;\n return this.conversationsPromise.then(conversations => conversations.getConversations(args));\n }\n\n /**\n * Create a conversation on the server and subscribe to its events.\n * The default is a conversation with an empty friendly name.\n * @param options Options for the conversation.\n */\n @validateTypesAsync([\n 'undefined',\n objectSchema('conversation options', {\n friendlyName: ['string', 'undefined'],\n isPrivate: ['boolean', 'undefined'],\n uniqueName: ['string', 'undefined']\n })\n ])\n public async createConversation(options?: CreateConversationOptions): Promise<Conversation> {\n await this._ensureReady;\n options = options || {};\n return this.conversationsPromise.then(conversationsEntity => conversationsEntity.addConversation(options));\n }\n\n /**\n * Register for push notifications.\n * @param channelType Channel type.\n * @param registrationId Push notification ID provided by the FCM/APNS service on the platform.\n */\n @validateTypesAsync(literal('fcm', 'apn'), 'string')\n public async setPushRegistrationId(channelType: NotificationsChannelType, registrationId: string): Promise<void> {\n await this._ensureReady;\n this._subscribeToPushNotifications(channelType);\n this.services.notificationClient.setPushRegistrationId(channelType, registrationId);\n await this.services.notificationClient.commitChanges(); // Committing before this point is useless because we have no push id\n }\n\n /**\n * Unregister from push notifications.\n * @param channelType Channel type.\n * @deprecated Use removePushRegistrations() instead.\n */\n @validateTypesAsync(literal('fcm', 'apn'))\n public async unsetPushRegistrationId(channelType: NotificationsChannelType): Promise<void> {\n await this._ensureReady;\n this._unsubscribeFromPushNotifications(channelType);\n await this.services.notificationClient.commitChanges();\n }\n\n /**\n * Clear existing registrations directly using provided device token.\n * This is useful to ensure stopped subscriptions without resubscribing.\n *\n * This function goes completely beside the state machine and removes all registrations.\n * Use with caution: if it races with current state machine operations, madness will ensue.\n *\n * @param channelType Channel type.\n * @param registrationId Push notification ID provided by the FCM/APNS service on the platform.\n */\n @validateTypesAsync(literal('fcm', 'apn'), nonEmptyString)\n public async removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void> {\n // do not await this._ensureReady() here - it could be called at any moment\n await this.services.notificationClient.removeRegistrations(channelType, registrationId);\n }\n\n private static parsePushNotificationChatData(data: Object): Object {\n const result: Record<string, unknown> = {};\n\n for (let key in Client.supportedPushDataFields) {\n if (typeof data[key] === 'undefined' || data[key] === null) {\n continue;\n }\n\n if (key !== 'message_index') {\n result[Client.supportedPushDataFields[key]] = data[key];\n continue;\n }\n\n if (parseToNumber(data[key]) !== null) {\n result[Client.supportedPushDataFields[key]] = Number(data[key]);\n }\n }\n\n return result;\n }\n\n /**\n * Static method for push notification payload parsing. Returns parsed push as a {@link PushNotification} object.\n * @param notificationPayload Push notification payload.\n */\n @validateTypes(pureObject)\n static parsePushNotification(notificationPayload): PushNotification {\n log.debug('parsePushNotification, notificationPayload=', notificationPayload);\n\n // APNS specifics\n if (typeof notificationPayload.aps !== 'undefined') {\n if (!notificationPayload.twi_message_type) {\n throw new Error('Provided push notification payload does not contain Programmable Chat push notification type');\n }\n\n let data = Client.parsePushNotificationChatData(notificationPayload);\n\n let apsPayload = notificationPayload.aps;\n let body: string = null;\n let title: string = null;\n if (typeof apsPayload.alert === 'string') {\n body = apsPayload.alert || null;\n } else {\n body = apsPayload.alert.body || null;\n title = apsPayload.alert.title || null;\n }\n\n return new PushNotification({\n title: title,\n body: body,\n sound: apsPayload.sound || null,\n badge: apsPayload.badge || null,\n action: apsPayload.category || null,\n type: notificationPayload.twi_message_type,\n data: data\n });\n }\n\n // FCM specifics\n if (typeof notificationPayload.data !== 'undefined') {\n let dataPayload = notificationPayload.data;\n if (!dataPayload.twi_message_type) {\n throw new Error('Provided push notification payload does not contain Programmable Chat push notification type');\n }\n\n let data = Client.parsePushNotificationChatData(notificationPayload.data);\n return new PushNotification({\n title: dataPayload.twi_title || null,\n body: dataPayload.twi_body || null,\n sound: dataPayload.twi_sound || null,\n badge: null,\n action: dataPayload.twi_action || null,\n type: dataPayload.twi_message_type,\n data: data\n });\n }\n\n throw new Error('Provided push notification payload is not Programmable Chat notification');\n }\n\n public parsePushNotification = Client.parsePushNotification;\n\n /**\n * Handle push notification payload parsing and emit the {@link Client.pushNotification} event on this {@link Client} instance.\n * @param notificationPayload Push notification payload\n */\n @validateTypesAsync(pureObject)\n async handlePushNotification(notificationPayload): Promise<void> {\n await this._ensureReady;\n log.debug('handlePushNotification, notificationPayload=', notificationPayload);\n this.emit('pushNotification', Client.parsePushNotification(notificationPayload));\n }\n\n /**\n * Gets a user with the given identity. If it's in the subscribed list, then return the user object from it;\n * if not, then subscribe and add user to the subscribed list.\n * @param identity Identity of the user.\n * @returns A fully initialized user.\n */\n @validateTypesAsync(nonEmptyString)\n public async getUser(identity: string): Promise<User> {\n await this._ensureReady;\n return this.services.users.getUser(identity);\n }\n\n /**\n * Get a list of subscribed user objects.\n */\n public async getSubscribedUsers(): Promise<Array<User>> {\n await this._ensureReady;\n return this.services.users.getSubscribedUsers();\n }\n}\n\nexport {\n Client,\n State,\n ConnectionState,\n NotificationsChannelType,\n LogLevel,\n ClientOptions,\n CreateConversationOptions\n};\n"],"names":["Logger","version","Client","ReplayEventEmitter","deepClone","User","InitRegistration","TwilsockClient","NotificationClient","SyncClient","CommandExecutor","TelemetryEventDescription","TelemetryPoint","NotificationTypes","Configuration","TypingIndicator","Network","Users","ConversationsEntity","McsClient","parseToNumber","PushNotification","__decorate","validateTypesAsync","nonEmptyString","objectSchema","literal","pureObject","validateTypes","validateConstructorTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEnC,MAAM,WAAW,GAAGC,gBAAO,CAAC;AAE5B,MAAM,cAAc;CAUnB;AAwHD;;;AAOMC,cAAM,cAAZ,MAAM,MAAO,SAAQC,qCAAgC;;;;;;;;;;IA0CnD,YAAmB,QAAgB,EAAE,UAAyB,EAAE;;QAC9D,KAAK,EAAE,CAAC;;;;QAvCH,oBAAe,GAAoB,SAAS,CAAC;QAC5C,yBAAoB,GAAwB,IAAI,CAAC;QACjD,iBAAY,GAAiB,IAAI,CAAC;Q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,CAAC,QAAQ,EAAE,WAAW,CAAC;SACpC,CAAC;KACH,CAAC;;;;wDAKD;AAQDH;IADCC,2CAAkB,CAACG,gCAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;;;;2DAMnD;AAQDJ;IADCC,2CAAkB,CAACG,gCAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;;;6DAKzC;AAaDJ;IADCC,2CAAkB,CAACG,gCAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAEF,uCAAc,CAAC;;;;6DAIzD;AAyFDF;IADCC,2CAAkB,CAACI,mCAAU,CAAC;;;;4DAK9B;AASDL;IADCC,2CAAkB,CAACC,uCAAc,CAAC;;;;6CAIlC;AAhXDF;IADCC,2CAAkB,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAEI,mCAAU,CAAC,CAAC;;;;kCAkBvD;AAkRDL;IADCM,sCAAa,CAACD,mCAAU,CAAC;;;8CACyBN,iCAAgB;iDAoDlE;AAlwBGnB,cAAM;IAJX2B,iDAAwB,CAACL,uCAAc,EAAE;QACxCG,mCAAU;QACV,WAAW;KACZ,CAAC;;GACIzB,cAAM,CAoyBX;;"}
|
@@ -0,0 +1,203 @@
|
|
1
|
+
/*
|
2
|
+
@license
|
3
|
+
The following license applies to all parts of this software except as
|
4
|
+
documented below.
|
5
|
+
|
6
|
+
Copyright (c) 2019, Twilio, inc.
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
10
|
+
modification, are permitted provided that the following conditions are
|
11
|
+
met:
|
12
|
+
|
13
|
+
1. Redistributions of source code must retain the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer.
|
15
|
+
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright
|
17
|
+
notice, this list of conditions and the following disclaimer in
|
18
|
+
the documentation and/or other materials provided with the
|
19
|
+
distribution.
|
20
|
+
|
21
|
+
3. Neither the name of Twilio nor the names of its contributors may
|
22
|
+
be used to endorse or promote products derived from this software
|
23
|
+
without specific prior written permission.
|
24
|
+
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
26
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
27
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
28
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
29
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
30
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
31
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
32
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
33
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
34
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
36
|
+
|
37
|
+
This software includes javascript-state-machine under the following license.
|
38
|
+
|
39
|
+
Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
|
40
|
+
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
43
|
+
in the Software without restriction, including without limitation the rights
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
46
|
+
furnished to do so, subject to the following conditions:
|
47
|
+
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
49
|
+
copies or substantial portions of the Software.
|
50
|
+
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
57
|
+
|
58
|
+
This software includes loglevel under the following license.
|
59
|
+
|
60
|
+
Copyright (c) 2013 Tim Perry
|
61
|
+
|
62
|
+
Permission is hereby granted, free of charge, to any person
|
63
|
+
obtaining a copy of this software and associated documentation
|
64
|
+
files (the "Software"), to deal in the Software without
|
65
|
+
restriction, including without limitation the rights to use,
|
66
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
67
|
+
copies of the Software, and to permit persons to whom the
|
68
|
+
Software is furnished to do so, subject to the following
|
69
|
+
conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be
|
72
|
+
included in all copies or substantial portions of the Software.
|
73
|
+
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
75
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
76
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
77
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
78
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
79
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
80
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
81
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
82
|
+
|
83
|
+
This software includes q under the following license.
|
84
|
+
|
85
|
+
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
|
86
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
87
|
+
of this software and associated documentation files (the "Software"), to
|
88
|
+
deal in the Software without restriction, including without limitation the
|
89
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
90
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
91
|
+
furnished to do so, subject to the following conditions:
|
92
|
+
|
93
|
+
The above copyright notice and this permission notice shall be included in
|
94
|
+
all copies or substantial portions of the Software.
|
95
|
+
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
97
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
98
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
99
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
100
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
101
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
102
|
+
IN THE SOFTWARE.
|
103
|
+
|
104
|
+
This software includes platform.js under the following license.
|
105
|
+
|
106
|
+
Copyright 2014 Benjamin Tan <https://d10.github.io/>
|
107
|
+
Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
|
108
|
+
|
109
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
110
|
+
a copy of this software and associated documentation files (the
|
111
|
+
"Software"), to deal in the Software without restriction, including
|
112
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
113
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
114
|
+
permit persons to whom the Software is furnished to do so, subject to
|
115
|
+
the following conditions:
|
116
|
+
|
117
|
+
The above copyright notice and this permission notice shall be
|
118
|
+
included in all copies or substantial portions of the Software.
|
119
|
+
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
121
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
122
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
123
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
124
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
125
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
126
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
127
|
+
|
128
|
+
*/
|
129
|
+
'use strict';
|
130
|
+
|
131
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
132
|
+
|
133
|
+
var uuid = require('uuid');
|
134
|
+
var operationRetrier = require('@twilio/operation-retrier');
|
135
|
+
|
136
|
+
const trimSlashes = (url) => url.replace(/(^\/+|\/+$)/g, '');
|
137
|
+
const isMutationConflictResponse = (response) => response.status.code === 202;
|
138
|
+
class CommandExecutor {
|
139
|
+
constructor(_serviceUrl, _services, _productId) {
|
140
|
+
this._serviceUrl = _serviceUrl;
|
141
|
+
this._services = _services;
|
142
|
+
this._productId = _productId;
|
143
|
+
}
|
144
|
+
_preProcessUrl(url) {
|
145
|
+
const trimmedUrl = trimSlashes(url);
|
146
|
+
if (/^https?:\/\//.test(url)) {
|
147
|
+
return trimmedUrl;
|
148
|
+
}
|
149
|
+
return `${trimSlashes(this._serviceUrl)}/${trimmedUrl}`;
|
150
|
+
}
|
151
|
+
async _makeRequest(method, url, requestBody, headers) {
|
152
|
+
const preProcessedUrl = this._preProcessUrl(url);
|
153
|
+
const finalHeaders = Object.assign({ 'Content-Type': 'application/json; charset=utf-8' }, (headers || {}));
|
154
|
+
let response;
|
155
|
+
switch (method) {
|
156
|
+
case 'get':
|
157
|
+
let getUrl = preProcessedUrl;
|
158
|
+
if (requestBody) {
|
159
|
+
getUrl +=
|
160
|
+
'?' +
|
161
|
+
Object.entries(requestBody)
|
162
|
+
.map((entry) => entry.map(encodeURIComponent).join('='))
|
163
|
+
.join('&');
|
164
|
+
}
|
165
|
+
response = await this._services.transport.get(getUrl, finalHeaders, this._productId);
|
166
|
+
break;
|
167
|
+
case 'post':
|
168
|
+
response = await this._services.transport.post(preProcessedUrl, finalHeaders, JSON.stringify(requestBody), this._productId);
|
169
|
+
break;
|
170
|
+
case 'delete':
|
171
|
+
response = await this._services.transport.delete(preProcessedUrl, finalHeaders, null, this._productId);
|
172
|
+
break;
|
173
|
+
}
|
174
|
+
if (response.status.code < 200 || response.status.code >= 300) {
|
175
|
+
throw new Error(`Request responded with a non-success code ${response.status.code}`);
|
176
|
+
}
|
177
|
+
return response;
|
178
|
+
}
|
179
|
+
async fetchResource(url, requestBody) {
|
180
|
+
const maxAttemptsCount = 6;
|
181
|
+
let result;
|
182
|
+
try {
|
183
|
+
result = await new operationRetrier.AsyncRetrier({ min: 50, max: 1600, maxAttemptsCount })
|
184
|
+
.run(() => this._makeRequest('get', url, requestBody));
|
185
|
+
}
|
186
|
+
catch (_a) {
|
187
|
+
throw new Error(`Fetch resource from "${url}" failed.`);
|
188
|
+
}
|
189
|
+
return result.body;
|
190
|
+
}
|
191
|
+
async mutateResource(method, url, requestBody) {
|
192
|
+
const result = await this._makeRequest(method, url, requestBody, {
|
193
|
+
'X-Twilio-Mutation-Id': uuid.v4()
|
194
|
+
});
|
195
|
+
if (isMutationConflictResponse(result)) {
|
196
|
+
return await this.fetchResource(result.body.resource_url);
|
197
|
+
}
|
198
|
+
return result.body;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
exports.CommandExecutor = CommandExecutor;
|
203
|
+
//# sourceMappingURL=command-executor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"command-executor.js","sources":["../src/command-executor.ts"],"sourcesContent":["import { TransportResult as Result, Transport } from 'twilsock';\nimport { MutationConflictResponse } from './interfaces/commands/mutation-conflict';\nimport { v4 as uuidv4 } from 'uuid';\nimport { AsyncRetrier } from '@twilio/operation-retrier';\n\nexport interface CommandExecutorServices {\n transport: Transport;\n}\n\nconst trimSlashes = (url: string): string =>\n url.replace(/(^\\/+|\\/+$)/g, '');\n\nconst isMutationConflictResponse = (response: Result<unknown>): response is Result<MutationConflictResponse> =>\n response.status.code === 202;\n\nclass CommandExecutor {\n constructor(\n private _serviceUrl: string,\n private _services: CommandExecutorServices,\n private _productId?: string\n ) {}\n\n private _preProcessUrl(url: string): string {\n const trimmedUrl = trimSlashes(url);\n\n if (/^https?:\\/\\//.test(url)) {\n return trimmedUrl;\n }\n\n return `${trimSlashes(this._serviceUrl)}/${trimmedUrl}`;\n }\n\n private async _makeRequest<REQ = void, RESP = void>(\n method: 'get' | 'post' | 'delete',\n url: string,\n requestBody?: REQ,\n headers?: Record<string, string>\n ): Promise<Result<RESP>> {\n const preProcessedUrl = this._preProcessUrl(url);\n const finalHeaders = {\n 'Content-Type': 'application/json; charset=utf-8',\n ...(headers || {})\n };\n let response: Result<RESP>;\n\n switch (method) {\n case 'get':\n let getUrl = preProcessedUrl;\n\n if (requestBody) {\n getUrl +=\n '?' +\n Object.entries(requestBody)\n .map((entry) => entry.map(encodeURIComponent).join('='))\n .join('&');\n }\n\n response = await this._services.transport.get(getUrl, finalHeaders, this._productId);\n break;\n case 'post':\n response = await this._services.transport.post(preProcessedUrl, finalHeaders, JSON.stringify(requestBody), this._productId);\n break;\n case 'delete':\n response = await this._services.transport.delete(preProcessedUrl, finalHeaders, null, this._productId);\n break;\n }\n\n if (response.status.code < 200 || response.status.code >= 300) {\n throw new Error(`Request responded with a non-success code ${response.status.code}`);\n }\n\n return response;\n }\n\n public async fetchResource<REQ = void, RESP = void>(\n url: string,\n requestBody?: REQ\n ): Promise<RESP> {\n const maxAttemptsCount = 6;\n let result: Result<RESP>;\n\n try {\n result = await new AsyncRetrier({ min: 50, max: 1600, maxAttemptsCount })\n .run(() => this._makeRequest<REQ, RESP>('get', url, requestBody));\n } catch {\n throw new Error(`Fetch resource from \"${url}\" failed.`);\n }\n\n return result.body;\n }\n\n public async mutateResource<REQ = void, RESP = void>(\n method: 'post' | 'delete',\n url: string,\n requestBody?: REQ\n ): Promise<RESP> {\n const result = await this._makeRequest<REQ, RESP>(method, url, requestBody, {\n 'X-Twilio-Mutation-Id': uuidv4()\n });\n\n if (isMutationConflictResponse(result)) {\n return await this.fetchResource<undefined, RESP>(result.body.resource_url);\n }\n\n return result.body;\n }\n}\n\nexport { CommandExecutor };"],"names":["AsyncRetrier","uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,WAAW,GAAG,CAAC,GAAW,KAC9B,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AAElC,MAAM,0BAA0B,GAAG,CAAC,QAAyB,KAC3D,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC;AAE/B,MAAM,eAAe;IACnB,YACU,WAAmB,EACnB,SAAkC,EAClC,UAAmB;QAFnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAyB;QAClC,eAAU,GAAV,UAAU,CAAS;KACzB;IAEI,cAAc,CAAC,GAAW;QAChC,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAEpC,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC5B,OAAO,UAAU,CAAC;SACnB;QAED,OAAO,GAAG,WAAW,CAAC,I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AI,GAAG,EAAE;YAC7D,MAAM,IAAI,KAAK,CAAC,6CAA6C,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;SACtF;QAED,OAAO,QAAQ,CAAC;KACjB;IAEM,MAAM,aAAa,CACxB,GAAW,EACX,WAAiB;QAEjB,MAAM,gBAAgB,GAAG,CAAC,CAAC;QAC3B,IAAI,MAAoB,CAAC;QAEzB,IAAI;YACF,MAAM,GAAG,MAAM,IAAIA,6BAAY,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;iBACtE,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAY,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;SACrE;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC;SACzD;QAED,OAAO,MAAM,CAAC,IAAI,CAAC;KACpB;IAEM,MAAM,cAAc,CACzB,MAAyB,EACzB,GAAW,EACX,WAAiB;QAEjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAY,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE;YAC1E,sBAAsB,EAAEC,OAAM,EAAE;SACjC,CAAC,CAAC;QAEH,IAAI,0BAA0B,CAAC,MAAM,CAAC,EAAE;YACtC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAkB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC5E;QAED,OAAO,MAAM,CAAC,IAAI,CAAC;KACpB;;;;;"}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/*
|
2
|
+
@license
|
3
|
+
The following license applies to all parts of this software except as
|
4
|
+
documented below.
|
5
|
+
|
6
|
+
Copyright (c) 2019, Twilio, inc.
|
7
|
+
All rights reserved.
|
8
|
+
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
10
|
+
modification, are permitted provided that the following conditions are
|
11
|
+
met:
|
12
|
+
|
13
|
+
1. Redistributions of source code must retain the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer.
|
15
|
+
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright
|
17
|
+
notice, this list of conditions and the following disclaimer in
|
18
|
+
the documentation and/or other materials provided with the
|
19
|
+
distribution.
|
20
|
+
|
21
|
+
3. Neither the name of Twilio nor the names of its contributors may
|
22
|
+
be used to endorse or promote products derived from this software
|
23
|
+
without specific prior written permission.
|
24
|
+
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
26
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
27
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
28
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
29
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
30
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
31
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
32
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
33
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
34
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
36
|
+
|
37
|
+
This software includes javascript-state-machine under the following license.
|
38
|
+
|
39
|
+
Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
|
40
|
+
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
43
|
+
in the Software without restriction, including without limitation the rights
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
46
|
+
furnished to do so, subject to the following conditions:
|
47
|
+
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
49
|
+
copies or substantial portions of the Software.
|
50
|
+
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
57
|
+
|
58
|
+
This software includes loglevel under the following license.
|
59
|
+
|
60
|
+
Copyright (c) 2013 Tim Perry
|
61
|
+
|
62
|
+
Permission is hereby granted, free of charge, to any person
|
63
|
+
obtaining a copy of this software and associated documentation
|
64
|
+
files (the "Software"), to deal in the Software without
|
65
|
+
restriction, including without limitation the rights to use,
|
66
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
67
|
+
copies of the Software, and to permit persons to whom the
|
68
|
+
Software is furnished to do so, subject to the following
|
69
|
+
conditions:
|
70
|
+
|
71
|
+
The above copyright notice and this permission notice shall be
|
72
|
+
included in all copies or substantial portions of the Software.
|
73
|
+
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
75
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
76
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
77
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
78
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
79
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
80
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
81
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
82
|
+
|
83
|
+
This software includes q under the following license.
|
84
|
+
|
85
|
+
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
|
86
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
87
|
+
of this software and associated documentation files (the "Software"), to
|
88
|
+
deal in the Software without restriction, including without limitation the
|
89
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
90
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
91
|
+
furnished to do so, subject to the following conditions:
|
92
|
+
|
93
|
+
The above copyright notice and this permission notice shall be included in
|
94
|
+
all copies or substantial portions of the Software.
|
95
|
+
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
97
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
98
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
99
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
100
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
101
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
102
|
+
IN THE SOFTWARE.
|
103
|
+
|
104
|
+
This software includes platform.js under the following license.
|
105
|
+
|
106
|
+
Copyright 2014 Benjamin Tan <https://d10.github.io/>
|
107
|
+
Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
|
108
|
+
|
109
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
110
|
+
a copy of this software and associated documentation files (the
|
111
|
+
"Software"), to deal in the Software without restriction, including
|
112
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
113
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
114
|
+
permit persons to whom the Software is furnished to do so, subject to
|
115
|
+
the following conditions:
|
116
|
+
|
117
|
+
The above copyright notice and this permission notice shall be
|
118
|
+
included in all copies or substantial portions of the Software.
|
119
|
+
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
121
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
122
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
123
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
124
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
125
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
126
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
127
|
+
|
128
|
+
*/
|
129
|
+
'use strict';
|
130
|
+
|
131
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
132
|
+
|
133
|
+
var iso8601Duration = require('iso8601-duration');
|
134
|
+
|
135
|
+
const TYPING_TIMEOUT = 5;
|
136
|
+
const HTTP_CACHE_LIFETIME = 'PT5S';
|
137
|
+
const CONSUMPTION_HORIZON_SENDING_INTERVAL = 'PT5S';
|
138
|
+
const USER_INFOS_TO_SUBSCRIBE = 100;
|
139
|
+
const MINIMUM_RETRY_DELAY = 1000;
|
140
|
+
const MAXIMUM_RETRY_DELAY = 4000;
|
141
|
+
const MAXIMUM_ATTEMPTS_COUNT = 3;
|
142
|
+
const RETRY_WHEN_THROTTLED = true;
|
143
|
+
class Configuration {
|
144
|
+
constructor(options = {}, configurationResponse, logger) {
|
145
|
+
var _a, _b, _c, _d, _e, _f;
|
146
|
+
this.typingIndicatorTimeoutDefault = TYPING_TIMEOUT * 1000;
|
147
|
+
const constructorOptions = options.Chat || options.IPMessaging || options || {};
|
148
|
+
this.productId = constructorOptions.productId;
|
149
|
+
this.links = {
|
150
|
+
myConversations: configurationResponse.links.my_conversations,
|
151
|
+
conversations: configurationResponse.links.conversations,
|
152
|
+
users: configurationResponse.links.users,
|
153
|
+
currentUser: configurationResponse.links.current_user,
|
154
|
+
typing: configurationResponse.links.typing,
|
155
|
+
mediaService: configurationResponse.links.media_service,
|
156
|
+
mediaSetService: configurationResponse.links.media_set_service,
|
157
|
+
messagesReceipts: configurationResponse.links.messages_receipts
|
158
|
+
};
|
159
|
+
this.limits = {
|
160
|
+
mediaAttachmentsCountLimit: configurationResponse.options.media_attachments_count_limit,
|
161
|
+
mediaAttachmentSizeLimitInMb: configurationResponse.options.media_attachment_size_limit_in_mb,
|
162
|
+
mediaAttachmentsTotalSizeLimitInMb: configurationResponse.options.media_attachments_total_size_limit_in_mb,
|
163
|
+
emailHistoriesAllowedMimeTypes: configurationResponse.options.email_histories_allowed_mime_types,
|
164
|
+
emailBodiesAllowedMimeTypes: configurationResponse.options.email_bodies_allowed_mime_types
|
165
|
+
};
|
166
|
+
this.typingIndicatorTimeoutOverride = constructorOptions.typingIndicatorTimeoutOverride;
|
167
|
+
this.backoffConfiguration = Object.assign({ min: MINIMUM_RETRY_DELAY, max: MAXIMUM_RETRY_DELAY, maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT }, constructorOptions.backoffConfigOverride);
|
168
|
+
this.retryWhenThrottled = constructorOptions.retryWhenThrottledOverride !== undefined
|
169
|
+
? constructorOptions.retryWhenThrottledOverride
|
170
|
+
: RETRY_WHEN_THROTTLED;
|
171
|
+
this.userInfosToSubscribe = (_b = (_a = constructorOptions.userInfosToSubscribeOverride) !== null && _a !== void 0 ? _a : configurationResponse.options.user_infos_to_subscribe) !== null && _b !== void 0 ? _b : USER_INFOS_TO_SUBSCRIBE;
|
172
|
+
this.reachabilityEnabled = configurationResponse.options.reachability_enabled;
|
173
|
+
this.userIdentity = configurationResponse.identity;
|
174
|
+
this.userInfo = configurationResponse.sync_objects.my_user_info;
|
175
|
+
this.myConversations = configurationResponse.sync_objects.my_conversations;
|
176
|
+
const httpCacheInterval = (_d = (_c = constructorOptions.httpCacheIntervalOverride) !== null && _c !== void 0 ? _c : configurationResponse.options.http_cache_interval) !== null && _d !== void 0 ? _d : HTTP_CACHE_LIFETIME;
|
177
|
+
try {
|
178
|
+
this.httpCacheInterval = iso8601Duration.toSeconds(iso8601Duration.parse(httpCacheInterval));
|
179
|
+
}
|
180
|
+
catch (_g) {
|
181
|
+
logger.error(`Failed to parse http cache interval ${httpCacheInterval}, using default value ${HTTP_CACHE_LIFETIME}`);
|
182
|
+
this.httpCacheInterval = iso8601Duration.toSeconds(iso8601Duration.parse(HTTP_CACHE_LIFETIME));
|
183
|
+
}
|
184
|
+
const consumptionReportInterval = (_f = (_e = constructorOptions.consumptionReportIntervalOverride) !== null && _e !== void 0 ? _e : configurationResponse.options.consumption_report_interval) !== null && _f !== void 0 ? _f : CONSUMPTION_HORIZON_SENDING_INTERVAL;
|
185
|
+
try {
|
186
|
+
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(consumptionReportInterval));
|
187
|
+
}
|
188
|
+
catch (_h) {
|
189
|
+
logger.error(`Failed to parse consumption report interval ${consumptionReportInterval}, using default value ${CONSUMPTION_HORIZON_SENDING_INTERVAL}`);
|
190
|
+
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
exports.Configuration = Configuration;
|
196
|
+
//# sourceMappingURL=configuration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"configuration.js","sources":["../src/configuration.ts"],"sourcesContent":["import { ConfigurationResponse } from './interfaces/commands/configuration';\nimport { parse as parseDuration, toSeconds } from 'iso8601-duration';\nimport { Logger } from './logger';\nimport { Limits } from './interfaces/limits';\n\nconst TYPING_TIMEOUT = 5;\nconst HTTP_CACHE_LIFETIME = 'PT5S';\nconst CONSUMPTION_HORIZON_SENDING_INTERVAL = 'PT5S';\nconst USER_INFOS_TO_SUBSCRIBE = 100;\n\nconst MINIMUM_RETRY_DELAY = 1000;\nconst MAXIMUM_RETRY_DELAY = 4000;\nconst MAXIMUM_ATTEMPTS_COUNT = 3;\nconst RETRY_WHEN_THROTTLED = true;\n\ninterface BackoffConfiguration {\n min: number;\n max: number;\n maxAttemptsCount: number;\n}\n\nclass Configuration {\n public readonly links: {\n myConversations: string;\n conversations: string;\n users: string;\n currentUser: string;\n typing: string;\n mediaService: string;\n mediaSetService: string;\n messagesReceipts: string;\n };\n\n public readonly limits: Limits;\n\n public readonly productId?: string;\n\n public readonly typingIndicatorTimeoutOverride?: number;\n public readonly typingIndicatorTimeoutDefault: number = TYPING_TIMEOUT * 1000;\n public readonly backoffConfiguration: BackoffConfiguration;\n public readonly retryWhenThrottled: boolean;\n\n public readonly consumptionReportInterval: number;\n public readonly userInfosToSubscribe: number;\n public readonly httpCacheInterval: number;\n public readonly reachabilityEnabled: boolean;\n\n public readonly userIdentity: string;\n public readonly userInfo: string;\n public readonly myConversations: string;\n\n constructor(\n options: Record<string, any> = {},\n configurationResponse: ConfigurationResponse,\n logger: Logger\n ) {\n const constructorOptions = options.Chat || options.IPMessaging || options || {};\n\n this.productId = constructorOptions.productId;\n\n this.links = {\n myConversations: configurationResponse.links.my_conversations,\n conversations: configurationResponse.links.conversations,\n users: configurationResponse.links.users,\n currentUser: configurationResponse.links.current_user,\n typing: configurationResponse.links.typing,\n mediaService: configurationResponse.links.media_service,\n mediaSetService: configurationResponse.links.media_set_service,\n messagesReceipts: configurationResponse.links.messages_receipts\n };\n\n this.limits = {\n mediaAttachmentsCountLimit: configurationResponse.options.media_attachments_count_limit,\n mediaAttachmentSizeLimitInMb: configurationResponse.options.media_attachment_size_limit_in_mb,\n mediaAttachmentsTotalSizeLimitInMb: configurationResponse.options.media_attachments_total_size_limit_in_mb,\n emailHistoriesAllowedMimeTypes: configurationResponse.options.email_histories_allowed_mime_types,\n emailBodiesAllowedMimeTypes: configurationResponse.options.email_bodies_allowed_mime_types\n };\n\n this.typingIndicatorTimeoutOverride = constructorOptions.typingIndicatorTimeoutOverride;\n this.backoffConfiguration = {\n min: MINIMUM_RETRY_DELAY,\n max: MAXIMUM_RETRY_DELAY,\n maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT,\n ...constructorOptions.backoffConfigOverride\n };\n this.retryWhenThrottled = constructorOptions.retryWhenThrottledOverride !== undefined\n ? constructorOptions.retryWhenThrottledOverride\n : RETRY_WHEN_THROTTLED;\n this.userInfosToSubscribe = constructorOptions.userInfosToSubscribeOverride\n ?? configurationResponse.options.user_infos_to_subscribe\n ?? USER_INFOS_TO_SUBSCRIBE;\n this.reachabilityEnabled = configurationResponse.options.reachability_enabled;\n this.userIdentity = configurationResponse.identity;\n this.userInfo = configurationResponse.sync_objects.my_user_info;\n this.myConversations = configurationResponse.sync_objects.my_conversations;\n\n const httpCacheInterval = constructorOptions.httpCacheIntervalOverride\n ?? configurationResponse.options.http_cache_interval\n ?? HTTP_CACHE_LIFETIME;\n\n try {\n this.httpCacheInterval = toSeconds(parseDuration(httpCacheInterval));\n } catch {\n logger.error(`Failed to parse http cache interval ${httpCacheInterval}, using default value ${HTTP_CACHE_LIFETIME}`);\n this.httpCacheInterval = toSeconds(parseDuration(HTTP_CACHE_LIFETIME));\n }\n\n const consumptionReportInterval = constructorOptions.consumptionReportIntervalOverride\n ?? configurationResponse.options.consumption_report_interval\n ?? CONSUMPTION_HORIZON_SENDING_INTERVAL;\n\n try {\n this.consumptionReportInterval = toSeconds(parseDuration(consumptionReportInterval));\n } catch {\n logger.error(\n `Failed to parse consumption report interval ${consumptionReportInterval}, using default value ${CONSUMPTION_HORIZON_SENDING_INTERVAL}`\n );\n this.consumptionReportInterval = toSeconds(parseDuration(CONSUMPTION_HORIZON_SENDING_INTERVAL));\n }\n }\n}\n\nexport { Configuration };\n"],"names":["toSeconds","parseDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,oCAAoC,GAAG,MAAM,CAAC;AACpD,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAQlC,MAAM,aAAa;IA8BjB,YACE,UAA+B,EAAE,EACjC,qBAA4C,EAC5C,MAAc;;QAhBA,kCAA6B,GAAW,cAAc,GAAG,IAAI,CAAC;QAkB5E,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,IAAI,EAAE,CAAC;QAEhF,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC;QAE9C,IAAI,CAAC,KAAK,GAAG;YACX,eAAe,EAAE,qBAAqB,CAAC,KAAK,CAAC,gBAAgB;YAC7D,aAAa,EAAE,qBAAqB,CAAC,KAAK,CAAC,aAAa;YACxD,KAAK,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK;YACxC,WAAW,EAAE,qBAAqB,CAAC,KAAK,CAAC,YAAY;YACrD,MAAM,EAAE,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