@twilio/conversations 3.0.0-rc.8 → 3.0.0
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/README.md +39 -29
- package/builds/browser.esm.js +10838 -0
- package/builds/browser.esm.js.map +1 -0
- package/builds/browser.js +2494 -476
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +805 -70
- package/builds/lib.esm.d.ts +3178 -0
- package/builds/lib.esm.js +10837 -0
- package/builds/lib.js +2494 -476
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +29167 -26611
- package/builds/twilio-conversations.js.map +1 -0
- package/builds/twilio-conversations.min.js +2 -1
- package/builds/twilio-conversations.min.js.map +1 -0
- package/dist/aggregated-delivery-receipt.js +10 -5
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/channel-metadata-client.js +187 -0
- package/dist/channel-metadata-client.js.map +1 -0
- package/dist/client.js +266 -192
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +51 -14
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +23 -12
- package/dist/configuration.js.map +1 -1
- package/dist/content-client.js +180 -0
- package/dist/content-client.js.map +1 -0
- package/dist/content-template.js +304 -0
- package/dist/content-template.js.map +1 -0
- package/dist/conversation.js +213 -134
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +70 -50
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +40 -27
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +38 -32
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +19 -14
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +9 -4
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +26 -41
- package/dist/index.js.map +1 -1
- package/dist/interfaces/notification-types.js +9 -4
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/interfaces/{attributes.js → rules.js} +26 -13
- package/dist/interfaces/rules.js.map +1 -0
- package/dist/logger.js +17 -28
- package/dist/logger.js.map +1 -1
- package/dist/media.js +40 -24
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +79 -12
- package/dist/message-builder.js.map +1 -1
- package/dist/message-recipients-client.js +231 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +258 -92
- package/dist/message.js.map +1 -1
- package/dist/node_modules/quick-lru/index.js +261 -0
- package/dist/node_modules/quick-lru/index.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js +15 -5
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +12 -7
- package/dist/packages/conversations/package.json.js.map +1 -1
- package/dist/participant.js +42 -38
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js +9 -4
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +9 -4
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +11 -6
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +17 -11
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +14 -9
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +40 -32
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +9 -4
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +44 -8
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +1 -1
- package/docs/classes/ChannelMetadata.html +3050 -0
- package/docs/classes/Client.html +98 -27
- package/docs/classes/ContentTemplate.html +3116 -0
- package/docs/classes/ContentTemplateVariable.html +3116 -0
- package/docs/classes/Conversation.html +46 -9
- package/docs/classes/EmailRecipientDescriptor.html +3098 -0
- package/docs/classes/Message.html +99 -5
- package/docs/classes/MessageBuilder.html +41 -0
- package/docs/classes/Participant.html +2 -2
- package/docs/classes/UnknownRecipientDescriptor.html +3067 -0
- package/docs/index.html +892 -28
- package/docs/interfaces/ClientOptions.html +32 -0
- package/docs/interfaces/CreateConversationOptions.html +17 -0
- package/docs/modules.html +891 -27
- package/package.json +21 -19
- package/CHANGELOG.md +0 -501
- package/dist/interfaces/attributes.js.map +0 -1
package/dist/client.js
CHANGED
|
@@ -126,30 +126,39 @@ This software includes platform.js under the following license.
|
|
|
126
126
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
127
127
|
|
|
128
128
|
*/
|
|
129
|
-
|
|
129
|
+
var global =
|
|
130
|
+
typeof global !== "undefined"
|
|
131
|
+
? global
|
|
132
|
+
: typeof self !== "undefined"
|
|
133
|
+
? self
|
|
134
|
+
: typeof window !== "undefined"
|
|
135
|
+
? window
|
|
136
|
+
: {};
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
138
|
+
import { __decorate, __metadata } from './node_modules/tslib/tslib.es6.js';
|
|
139
|
+
import { Logger } from './logger.js';
|
|
140
|
+
import { Configuration } from './configuration.js';
|
|
141
|
+
import { User } from './user.js';
|
|
142
|
+
import { Network } from './services/network.js';
|
|
143
|
+
import { NotificationTypes } from './interfaces/notification-types.js';
|
|
144
|
+
import { InitRegistration, TwilsockClient, TelemetryEventDescription, TelemetryPoint } from 'twilsock';
|
|
145
|
+
import { Notifications } from '@twilio/notifications';
|
|
146
|
+
import { SyncClient } from 'twilio-sync';
|
|
147
|
+
import { CancellablePromise, McsClient } from '@twilio/mcs-client';
|
|
148
|
+
import { Conversations } from './data/conversations.js';
|
|
149
|
+
import { Users } from './data/users.js';
|
|
150
|
+
import { TypingIndicator } from './services/typing-indicator.js';
|
|
151
|
+
import { PushNotification } from './push-notification.js';
|
|
152
|
+
import { deepClone, parseToNumber } from './util/index.js';
|
|
153
|
+
import { validateTypesAsync, nonEmptyString, objectSchema, literal, pureObject, nonEmptyArray, validateTypes, validateConstructorTypes } from '@twilio/declarative-type-validator';
|
|
154
|
+
import { version } from './packages/conversations/package.json.js';
|
|
155
|
+
import { CommandExecutor } from './command-executor.js';
|
|
156
|
+
import { ReplayEventEmitter } from '@twilio/replay-event-emitter';
|
|
157
|
+
import { Media } from './media.js';
|
|
158
|
+
import { deprecated, deprecationWarning } from '@twilio/deprecation-decorator';
|
|
159
|
+
import { ContentClient } from './content-client.js';
|
|
160
|
+
import { ChannelMetadataClient } from './channel-metadata-client.js';
|
|
161
|
+
import { MessageRecipientsClient } from './message-recipients-client.js';
|
|
153
162
|
|
|
154
163
|
var Client_1;
|
|
155
164
|
/**
|
|
@@ -160,9 +169,9 @@ class ClientServices {
|
|
|
160
169
|
/**
|
|
161
170
|
* A client is the starting point to the Twilio Conversations functionality.
|
|
162
171
|
*/
|
|
163
|
-
|
|
172
|
+
let Client = Client_1 = class Client extends ReplayEventEmitter {
|
|
164
173
|
/**
|
|
165
|
-
* Returned Conversations instance is not yet fully initialized. Calling any
|
|
174
|
+
* Returned Conversations Client instance is not yet fully initialized. Calling any
|
|
166
175
|
* operations will block until it is. Use connection events to monitor when
|
|
167
176
|
* client becomes fully available (connectionStateChanged with state
|
|
168
177
|
* 'connected') or not available (connectionStateChange with state 'denied',
|
|
@@ -178,20 +187,20 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
178
187
|
/**
|
|
179
188
|
* Current version of the Conversations client.
|
|
180
189
|
*/
|
|
181
|
-
this.version =
|
|
190
|
+
this.version = version;
|
|
182
191
|
/**
|
|
183
192
|
* Client connection state.
|
|
184
193
|
*/
|
|
185
194
|
this.connectionState = "unknown";
|
|
186
195
|
/**
|
|
187
|
-
*
|
|
196
|
+
* Parse a push notification payload.
|
|
188
197
|
*/
|
|
189
198
|
this.parsePushNotification = Client_1.parsePushNotification;
|
|
190
199
|
this._fpaToken = fpaToken !== null && fpaToken !== void 0 ? fpaToken : "";
|
|
191
200
|
this._options = options !== null && options !== void 0 ? options : {};
|
|
192
201
|
if (!this._options.disableDeepClone) {
|
|
193
202
|
let options = Object.assign(Object.assign({}, this._options), { transport: undefined, twilsockClient: undefined });
|
|
194
|
-
options =
|
|
203
|
+
options = deepClone(options);
|
|
195
204
|
options.transport = this._options.transport;
|
|
196
205
|
options.twilsockClient = this._options.twilsockClient;
|
|
197
206
|
this._options = options;
|
|
@@ -206,7 +215,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
206
215
|
}
|
|
207
216
|
if (!this._options.clientMetadata.hasOwnProperty("sdk")) {
|
|
208
217
|
this._options.clientMetadata.sdk = "JS";
|
|
209
|
-
this._options.clientMetadata.sdkv =
|
|
218
|
+
this._options.clientMetadata.sdkv = version;
|
|
210
219
|
}
|
|
211
220
|
// Enable session local storage for Sync
|
|
212
221
|
this._options.Sync = this._options.Sync || {};
|
|
@@ -220,7 +229,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
220
229
|
throw new Error("A valid Twilio token should be provided");
|
|
221
230
|
}
|
|
222
231
|
this._services = new ClientServices();
|
|
223
|
-
this._myself = new
|
|
232
|
+
this._myself = new User("", "", null, this._services);
|
|
224
233
|
const startTwilsock = !this._options.twilsockClient;
|
|
225
234
|
// Create default init registrations if none were provided.
|
|
226
235
|
// Otherwise, the outside party have to list all the init registrations they
|
|
@@ -228,55 +237,58 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
228
237
|
// Init registrations passed to the Conversations client will be passed down
|
|
229
238
|
// to the Sync client as well.
|
|
230
239
|
if (!this._options.initRegistrations) {
|
|
231
|
-
const initRegistration = new
|
|
240
|
+
const initRegistration = new InitRegistration(productId);
|
|
232
241
|
Client_1.populateInitRegistrations(initRegistration);
|
|
233
242
|
this._options.initRegistrations = [initRegistration];
|
|
234
243
|
}
|
|
235
244
|
this._services.twilsockClient = this._options.twilsockClient =
|
|
236
|
-
(_b = this._options.twilsockClient) !== null && _b !== void 0 ? _b : new
|
|
237
|
-
this._services.twilsockClient.on(
|
|
238
|
-
this._services.twilsockClient.on(
|
|
239
|
-
this._services.twilsockClient.on(
|
|
245
|
+
(_b = this._options.twilsockClient) !== null && _b !== void 0 ? _b : new TwilsockClient(fpaToken, productId, this._options);
|
|
246
|
+
this._services.twilsockClient.on(Client_1.tokenAboutToExpire, () => this.emit(Client_1.tokenAboutToExpire));
|
|
247
|
+
this._services.twilsockClient.on(Client_1.tokenExpired, () => this.emit(Client_1.tokenExpired));
|
|
248
|
+
this._services.twilsockClient.on(Client_1.connectionError, (error) => this.emit(Client_1.connectionError, error));
|
|
240
249
|
this._services.twilsockClient.on("stateChanged", (state) => {
|
|
241
250
|
Client_1._logger.debug(`Handling stateChanged for ConversationsClient: new state ${state}`);
|
|
242
251
|
if (state !== this.connectionState) {
|
|
243
252
|
this.connectionState = state;
|
|
244
|
-
this.emit(
|
|
253
|
+
this.emit(Client_1.connectionStateChanged, this.connectionState);
|
|
245
254
|
}
|
|
246
255
|
});
|
|
247
256
|
this._services.transport = this._options.transport = ((_c = this._options
|
|
248
257
|
.transport) !== null && _c !== void 0 ? _c : this._options.twilsockClient);
|
|
249
258
|
this._services.notificationClient = this._options.notificationsClient =
|
|
250
|
-
(_d = this._options.notificationsClient) !== null && _d !== void 0 ? _d : new
|
|
259
|
+
(_d = this._options.notificationsClient) !== null && _d !== void 0 ? _d : new Notifications(fpaToken, this._options);
|
|
251
260
|
this._services.syncClient = this._options.syncClient =
|
|
252
|
-
(_e = this._options.syncClient) !== null && _e !== void 0 ? _e : new
|
|
261
|
+
(_e = this._options.syncClient) !== null && _e !== void 0 ? _e : new SyncClient(fpaToken, this._options);
|
|
253
262
|
const configurationOptions = (options === null || options === void 0 ? void 0 : options.Chat) || (options === null || options === void 0 ? void 0 : options.IPMessaging) || options || {};
|
|
254
263
|
const region = configurationOptions.region || (options === null || options === void 0 ? void 0 : options.region);
|
|
255
264
|
const baseUrl = configurationOptions.apiUri ||
|
|
256
265
|
configurationOptions.typingUri ||
|
|
257
266
|
`https://aim.${region || "us1"}.twilio.com`;
|
|
258
|
-
this._services.commandExecutor = new
|
|
267
|
+
this._services.commandExecutor = new CommandExecutor(baseUrl, { transport: this._options.transport }, productId);
|
|
268
|
+
this._services.contentClient = new ContentClient(this._services);
|
|
259
269
|
const emitFailed = (error) => {
|
|
260
270
|
this._rejectEnsureReady(error);
|
|
261
|
-
this.emit(
|
|
271
|
+
this.emit(Client_1.stateChanged, "failed");
|
|
272
|
+
this.emit(Client_1.initFailed, { error });
|
|
262
273
|
};
|
|
263
274
|
const emitDisconnected = () => {
|
|
264
275
|
emitFailed({
|
|
265
276
|
terminal: true,
|
|
266
277
|
message: "Twilsock has disconnected.",
|
|
267
278
|
});
|
|
279
|
+
this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
268
280
|
};
|
|
269
|
-
this._services.twilsockClient.
|
|
270
|
-
this._services.twilsockClient.
|
|
271
|
-
this._services.twilsockClient.
|
|
281
|
+
this._services.twilsockClient.once("connectionError", emitFailed);
|
|
282
|
+
this._services.twilsockClient.once("disconnected", emitDisconnected);
|
|
283
|
+
this._services.twilsockClient.once("connected", async () => {
|
|
272
284
|
Client_1._logger.debug(`ConversationsClient started INITIALIZING`);
|
|
273
285
|
this._services.twilsockClient.off("connectionError", emitFailed);
|
|
274
286
|
this._services.twilsockClient.off("disconnected", emitDisconnected);
|
|
275
287
|
try {
|
|
276
288
|
const startupEvent = "conversations.client.startup";
|
|
277
|
-
this._services.twilsockClient.addPartialTelemetryEvent(new
|
|
289
|
+
this._services.twilsockClient.addPartialTelemetryEvent(new TelemetryEventDescription(startupEvent, "Conversations client startup", new Date()), startupEvent, TelemetryPoint.Start);
|
|
278
290
|
await this._initialize();
|
|
279
|
-
this._services.twilsockClient.addPartialTelemetryEvent(new
|
|
291
|
+
this._services.twilsockClient.addPartialTelemetryEvent(new TelemetryEventDescription("", "", new Date()), startupEvent, TelemetryPoint.End);
|
|
280
292
|
}
|
|
281
293
|
catch (err) {
|
|
282
294
|
// Fail ChatClient if initialization is incomplete
|
|
@@ -285,13 +297,13 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
285
297
|
message: err.message,
|
|
286
298
|
};
|
|
287
299
|
this._rejectEnsureReady(connectionError);
|
|
288
|
-
this.emit(
|
|
300
|
+
this.emit(Client_1.stateChanged, "failed");
|
|
301
|
+
this.emit(Client_1.initFailed, {
|
|
302
|
+
error: connectionError,
|
|
303
|
+
});
|
|
289
304
|
}
|
|
290
305
|
});
|
|
291
|
-
this.
|
|
292
|
-
this._resolveEnsureReady = resolve;
|
|
293
|
-
this._rejectEnsureReady = reject;
|
|
294
|
-
}).catch(() => void 0); // @todo How to process unhandled rejection here?
|
|
306
|
+
this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
|
|
295
307
|
if (startTwilsock) {
|
|
296
308
|
this._services.twilsockClient.connect();
|
|
297
309
|
}
|
|
@@ -316,6 +328,14 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
316
328
|
}
|
|
317
329
|
return this._configuration.reachabilityEnabled;
|
|
318
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* @deprecated
|
|
333
|
+
* Current token.
|
|
334
|
+
* @internal
|
|
335
|
+
*/
|
|
336
|
+
get token() {
|
|
337
|
+
return this._fpaToken;
|
|
338
|
+
}
|
|
319
339
|
/**
|
|
320
340
|
* @deprecated Call constructor directly.
|
|
321
341
|
*
|
|
@@ -375,7 +395,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
375
395
|
body = ((_a = apsPayload.alert) === null || _a === void 0 ? void 0 : _a.body) || null;
|
|
376
396
|
title = ((_b = apsPayload.alert) === null || _b === void 0 ? void 0 : _b.title) || null;
|
|
377
397
|
}
|
|
378
|
-
return new
|
|
398
|
+
return new PushNotification({
|
|
379
399
|
title,
|
|
380
400
|
body,
|
|
381
401
|
sound: apsPayload.sound || null,
|
|
@@ -392,7 +412,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
392
412
|
throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
|
|
393
413
|
}
|
|
394
414
|
const data = Client_1._parsePushNotificationChatData(notificationPayload.data);
|
|
395
|
-
return new
|
|
415
|
+
return new PushNotification({
|
|
396
416
|
title: dataPayload.twi_title || null,
|
|
397
417
|
body: dataPayload.twi_body || null,
|
|
398
418
|
sound: dataPayload.twi_sound || null,
|
|
@@ -416,7 +436,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
416
436
|
continue;
|
|
417
437
|
}
|
|
418
438
|
if (key === "message_index" || key === "media_count") {
|
|
419
|
-
const number =
|
|
439
|
+
const number = parseToNumber(value);
|
|
420
440
|
if (number !== null) {
|
|
421
441
|
result[Client_1._supportedPushDataFields[key]] = number;
|
|
422
442
|
}
|
|
@@ -442,8 +462,8 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
442
462
|
* @param reg The init registration to populate.
|
|
443
463
|
*/
|
|
444
464
|
static populateInitRegistrations(reg) {
|
|
445
|
-
reg.populateInitRegistrations([
|
|
446
|
-
|
|
465
|
+
reg.populateInitRegistrations([NotificationTypes.TYPING_INDICATOR]);
|
|
466
|
+
SyncClient.populateInitRegistrations(reg);
|
|
447
467
|
}
|
|
448
468
|
/**
|
|
449
469
|
* Gracefully shut down the client.
|
|
@@ -475,7 +495,13 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
475
495
|
async getConversationBySid(conversationSid) {
|
|
476
496
|
await this._ensureReady;
|
|
477
497
|
await this._conversationsEntity.myConversationsRead.promise;
|
|
478
|
-
|
|
498
|
+
let conversation = await this._conversationsEntity.getConversation(conversationSid);
|
|
499
|
+
if (!conversation) {
|
|
500
|
+
conversation = await this.peekConversationBySid(conversationSid);
|
|
501
|
+
if (conversation) {
|
|
502
|
+
deprecationWarning("The method getConversationBySid is deprecated to retrieve conversations you're not part of. Use peekConversationBySid instead.");
|
|
503
|
+
}
|
|
504
|
+
}
|
|
479
505
|
if (!conversation) {
|
|
480
506
|
throw new Error(`Conversation with SID ${conversationSid} was not found.`);
|
|
481
507
|
}
|
|
@@ -484,7 +510,6 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
484
510
|
/**
|
|
485
511
|
* Peek a conversation by its SID.
|
|
486
512
|
* @param conversationSid Conversation sid
|
|
487
|
-
* @internal
|
|
488
513
|
*/
|
|
489
514
|
async peekConversationBySid(conversationSid) {
|
|
490
515
|
await this._ensureReady;
|
|
@@ -597,7 +622,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
597
622
|
* @param mediaSids Set of media sids to query for the content URL.
|
|
598
623
|
*/
|
|
599
624
|
getTemporaryContentUrlsForMediaSids(mediaSids) {
|
|
600
|
-
return new
|
|
625
|
+
return new CancellablePromise(async (resolve, reject, onCancel) => {
|
|
601
626
|
if (!this._services.mcsClient || !mediaSids) {
|
|
602
627
|
reject(new Error("Media Content Service is unavailable"));
|
|
603
628
|
return;
|
|
@@ -627,16 +652,26 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
627
652
|
const sids = contentSet.map((m) => m.sid);
|
|
628
653
|
return this.getTemporaryContentUrlsForMediaSids(sids);
|
|
629
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Returns rich content templates belonging to the account. Rich content
|
|
657
|
+
* templates can be created via the Twilio console or the REST API.
|
|
658
|
+
*/
|
|
659
|
+
async getContentTemplates() {
|
|
660
|
+
await this._ensureReady;
|
|
661
|
+
return await this._services.contentClient.getContentTemplates();
|
|
662
|
+
}
|
|
630
663
|
/**
|
|
631
664
|
* Initialize the client.
|
|
632
665
|
*/
|
|
633
666
|
async _initialize() {
|
|
634
667
|
const configurationResponse = await this._services.commandExecutor.fetchResource("Client/v2/Configuration");
|
|
635
|
-
this._configuration = new
|
|
668
|
+
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
|
669
|
+
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
|
670
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
|
636
671
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
|
637
|
-
this._services.typingIndicator = new
|
|
638
|
-
this._services.network = new
|
|
639
|
-
this._services.users = new
|
|
672
|
+
this._services.typingIndicator = new TypingIndicator(this.getConversationBySid.bind(this), this._configuration, this._services);
|
|
673
|
+
this._services.network = new Network(this._configuration, this._services);
|
|
674
|
+
this._services.users = new Users(this._myself, this._configuration, this._services);
|
|
640
675
|
this._services.users.on("userSubscribed", (user) => {
|
|
641
676
|
this.emit("userSubscribed", user);
|
|
642
677
|
});
|
|
@@ -644,7 +679,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
644
679
|
this._services.users.on("userUnsubscribed", (user) => {
|
|
645
680
|
this.emit("userUnsubscribed", user);
|
|
646
681
|
});
|
|
647
|
-
this._conversationsEntity = new
|
|
682
|
+
this._conversationsEntity = new Conversations(this._configuration, this._services);
|
|
648
683
|
this._conversationsEntity.on("conversationAdded", (conversation) => {
|
|
649
684
|
this.emit("conversationAdded", conversation);
|
|
650
685
|
});
|
|
@@ -674,14 +709,16 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
674
709
|
.fetchConversations()
|
|
675
710
|
.then(() => this._conversationsEntity)
|
|
676
711
|
.catch((error) => {
|
|
712
|
+
console.error("Failed to fetch conversations _conversationsPromise -> client.ts", error);
|
|
677
713
|
throw error;
|
|
678
714
|
});
|
|
679
715
|
await this._services.users.myself._ensureFetched();
|
|
680
716
|
Client_1._supportedPushChannels.forEach((channelType) => this._subscribeToPushNotifications(channelType));
|
|
681
717
|
this._services.typingIndicator.initialize();
|
|
682
|
-
this._services.mcsClient = new
|
|
718
|
+
this._services.mcsClient = new McsClient(this._fpaToken, this._configuration.links.mediaService, this._configuration.links.mediaSetService, Object.assign(Object.assign({}, this._options), { transport: undefined }));
|
|
683
719
|
this._resolveEnsureReady();
|
|
684
|
-
this.emit(
|
|
720
|
+
this.emit(Client_1.stateChanged, "initialized");
|
|
721
|
+
this.emit(Client_1.initialized);
|
|
685
722
|
}
|
|
686
723
|
/**
|
|
687
724
|
* Subscribe to push notifications.
|
|
@@ -689,11 +726,11 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
689
726
|
*/
|
|
690
727
|
_subscribeToPushNotifications(channelType) {
|
|
691
728
|
[
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
729
|
+
NotificationTypes.NEW_MESSAGE,
|
|
730
|
+
NotificationTypes.ADDED_TO_CONVERSATION,
|
|
731
|
+
NotificationTypes.REMOVED_FROM_CONVERSATION,
|
|
732
|
+
NotificationTypes.TYPING_INDICATOR,
|
|
733
|
+
NotificationTypes.CONSUMPTION_UPDATE,
|
|
697
734
|
].forEach((messageType) => {
|
|
698
735
|
this._services.notificationClient.subscribe(channelType, messageType);
|
|
699
736
|
});
|
|
@@ -704,15 +741,31 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
704
741
|
*/
|
|
705
742
|
_unsubscribeFromPushNotifications(channelType) {
|
|
706
743
|
[
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
744
|
+
NotificationTypes.NEW_MESSAGE,
|
|
745
|
+
NotificationTypes.ADDED_TO_CONVERSATION,
|
|
746
|
+
NotificationTypes.REMOVED_FROM_CONVERSATION,
|
|
747
|
+
NotificationTypes.TYPING_INDICATOR,
|
|
748
|
+
NotificationTypes.CONSUMPTION_UPDATE,
|
|
712
749
|
].forEach((messageType) => {
|
|
713
750
|
this._services.notificationClient.unsubscribe(channelType, messageType);
|
|
714
751
|
});
|
|
715
752
|
}
|
|
753
|
+
/**
|
|
754
|
+
* Initialize the ensureReady promise.
|
|
755
|
+
*/
|
|
756
|
+
_initializeEnsureReady(throwErrorsAlways) {
|
|
757
|
+
this._ensureReady = new Promise((resolve, reject) => {
|
|
758
|
+
this._resolveEnsureReady = resolve;
|
|
759
|
+
this._rejectEnsureReady = reject;
|
|
760
|
+
}).catch((error) => {
|
|
761
|
+
if (throwErrorsAlways) {
|
|
762
|
+
throw error;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
return void 0;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
716
769
|
};
|
|
717
770
|
/**
|
|
718
771
|
* Fired when a conversation becomes visible to the client. The event is also
|
|
@@ -723,7 +776,7 @@ exports.Client = Client_1 = class Client extends replayEventEmitter.ReplayEventE
|
|
|
723
776
|
* 1. {@link Conversation} `conversation` - the conversation in question
|
|
724
777
|
* @event
|
|
725
778
|
*/
|
|
726
|
-
|
|
779
|
+
Client.conversationAdded = "conversationAdded";
|
|
727
780
|
/**
|
|
728
781
|
* Fired when the client joins a conversation.
|
|
729
782
|
*
|
|
@@ -731,7 +784,7 @@ exports.Client.conversationAdded = "conversationAdded";
|
|
|
731
784
|
* 1. {@link Conversation} `conversation` - the conversation in question
|
|
732
785
|
* @event
|
|
733
786
|
*/
|
|
734
|
-
|
|
787
|
+
Client.conversationJoined = "conversationJoined";
|
|
735
788
|
/**
|
|
736
789
|
* Fired when the client leaves a conversation.
|
|
737
790
|
*
|
|
@@ -739,7 +792,7 @@ exports.Client.conversationJoined = "conversationJoined";
|
|
|
739
792
|
* 1. {@link Conversation} `conversation` - the conversation in question
|
|
740
793
|
* @event
|
|
741
794
|
*/
|
|
742
|
-
|
|
795
|
+
Client.conversationLeft = "conversationLeft";
|
|
743
796
|
/**
|
|
744
797
|
* Fired when a conversation is no longer visible to the client.
|
|
745
798
|
*
|
|
@@ -747,7 +800,7 @@ exports.Client.conversationLeft = "conversationLeft";
|
|
|
747
800
|
* 1. {@link Conversation} `conversation` - the conversation in question
|
|
748
801
|
* @event
|
|
749
802
|
*/
|
|
750
|
-
|
|
803
|
+
Client.conversationRemoved = "conversationRemoved";
|
|
751
804
|
/**
|
|
752
805
|
* Fired when the attributes or the metadata of a conversation have been
|
|
753
806
|
* updated. During conversation's creation and initialization, this event
|
|
@@ -762,7 +815,7 @@ exports.Client.conversationRemoved = "conversationRemoved";
|
|
|
762
815
|
* for the update
|
|
763
816
|
* @event
|
|
764
817
|
*/
|
|
765
|
-
|
|
818
|
+
Client.conversationUpdated = "conversationUpdated";
|
|
766
819
|
/**
|
|
767
820
|
* Fired when a participant has joined a conversation.
|
|
768
821
|
*
|
|
@@ -770,7 +823,7 @@ exports.Client.conversationUpdated = "conversationUpdated";
|
|
|
770
823
|
* 1. {@link Participant} `participant` - the participant in question
|
|
771
824
|
* @event
|
|
772
825
|
*/
|
|
773
|
-
|
|
826
|
+
Client.participantJoined = "participantJoined";
|
|
774
827
|
/**
|
|
775
828
|
* Fired when a participant has left a conversation.
|
|
776
829
|
*
|
|
@@ -778,7 +831,7 @@ exports.Client.participantJoined = "participantJoined";
|
|
|
778
831
|
* 1. {@link Participant} `participant` - the participant in question
|
|
779
832
|
* @event
|
|
780
833
|
*/
|
|
781
|
-
|
|
834
|
+
Client.participantLeft = "participantLeft";
|
|
782
835
|
/**
|
|
783
836
|
* Fired when a participant's fields have been updated.
|
|
784
837
|
*
|
|
@@ -790,7 +843,7 @@ exports.Client.participantLeft = "participantLeft";
|
|
|
790
843
|
* for the update
|
|
791
844
|
* @event
|
|
792
845
|
*/
|
|
793
|
-
|
|
846
|
+
Client.participantUpdated = "participantUpdated";
|
|
794
847
|
/**
|
|
795
848
|
* Fired when a new message has been added to the conversation on the server.
|
|
796
849
|
*
|
|
@@ -798,7 +851,7 @@ exports.Client.participantUpdated = "participantUpdated";
|
|
|
798
851
|
* 1. {@link Message} `message` - the message in question
|
|
799
852
|
* @event
|
|
800
853
|
*/
|
|
801
|
-
|
|
854
|
+
Client.messageAdded = "messageAdded";
|
|
802
855
|
/**
|
|
803
856
|
* Fired when a message is removed from the message list of a conversation.
|
|
804
857
|
*
|
|
@@ -806,7 +859,7 @@ exports.Client.messageAdded = "messageAdded";
|
|
|
806
859
|
* 1. {@link Message} `message` - the message in question
|
|
807
860
|
* @event
|
|
808
861
|
*/
|
|
809
|
-
|
|
862
|
+
Client.messageRemoved = "messageRemoved";
|
|
810
863
|
/**
|
|
811
864
|
* Fired when the fields of an existing message are updated with new values.
|
|
812
865
|
*
|
|
@@ -818,17 +871,17 @@ exports.Client.messageRemoved = "messageRemoved";
|
|
|
818
871
|
* the update
|
|
819
872
|
* @event
|
|
820
873
|
*/
|
|
821
|
-
|
|
874
|
+
Client.messageUpdated = "messageUpdated";
|
|
822
875
|
/**
|
|
823
876
|
* Fired when the token is about to expire and needs to be updated.
|
|
824
877
|
* @event
|
|
825
878
|
*/
|
|
826
|
-
|
|
879
|
+
Client.tokenAboutToExpire = "tokenAboutToExpire";
|
|
827
880
|
/**
|
|
828
881
|
* Fired when the token has expired.
|
|
829
882
|
* @event
|
|
830
883
|
*/
|
|
831
|
-
|
|
884
|
+
Client.tokenExpired = "tokenExpired";
|
|
832
885
|
/**
|
|
833
886
|
* Fired when a participant has stopped typing.
|
|
834
887
|
*
|
|
@@ -836,7 +889,7 @@ exports.Client.tokenExpired = "tokenExpired";
|
|
|
836
889
|
* 1. {@link Participant} `participant` - the participant in question
|
|
837
890
|
* @event
|
|
838
891
|
*/
|
|
839
|
-
|
|
892
|
+
Client.typingEnded = "typingEnded";
|
|
840
893
|
/**
|
|
841
894
|
* Fired when a participant has started typing.
|
|
842
895
|
*
|
|
@@ -844,7 +897,7 @@ exports.Client.typingEnded = "typingEnded";
|
|
|
844
897
|
* 1. {@link Participant} `participant` - the participant in question
|
|
845
898
|
* @event
|
|
846
899
|
*/
|
|
847
|
-
|
|
900
|
+
Client.typingStarted = "typingStarted";
|
|
848
901
|
/**
|
|
849
902
|
* Fired when the client has received (and parsed) a push notification via one
|
|
850
903
|
* of the push channels (apn or fcm).
|
|
@@ -854,7 +907,7 @@ exports.Client.typingStarted = "typingStarted";
|
|
|
854
907
|
* question
|
|
855
908
|
* @event
|
|
856
909
|
*/
|
|
857
|
-
|
|
910
|
+
Client.pushNotification = "pushNotification";
|
|
858
911
|
/**
|
|
859
912
|
* Fired when the client has subscribed to a user.
|
|
860
913
|
*
|
|
@@ -862,7 +915,7 @@ exports.Client.pushNotification = "pushNotification";
|
|
|
862
915
|
* 1. {@link User} `user` - the user in question
|
|
863
916
|
* @event
|
|
864
917
|
*/
|
|
865
|
-
|
|
918
|
+
Client.userSubscribed = "userSubscribed";
|
|
866
919
|
/**
|
|
867
920
|
* Fired when the client has unsubscribed from a user.
|
|
868
921
|
*
|
|
@@ -870,7 +923,7 @@ exports.Client.userSubscribed = "userSubscribed";
|
|
|
870
923
|
* 1. {@link User} `user` - the user in question
|
|
871
924
|
* @event
|
|
872
925
|
*/
|
|
873
|
-
|
|
926
|
+
Client.userUnsubscribed = "userUnsubscribed";
|
|
874
927
|
/**
|
|
875
928
|
* Fired when the properties or the reachability status of a user have been
|
|
876
929
|
* updated.
|
|
@@ -883,18 +936,31 @@ exports.Client.userUnsubscribed = "userUnsubscribed";
|
|
|
883
936
|
* update
|
|
884
937
|
* @event
|
|
885
938
|
*/
|
|
886
|
-
|
|
939
|
+
Client.userUpdated = "userUpdated";
|
|
887
940
|
/**
|
|
941
|
+
* @deprecated Use initialized or initFailed events instead
|
|
888
942
|
* Fired when the state of the client has been changed.
|
|
889
943
|
*
|
|
890
944
|
* Parameters:
|
|
945
|
+
* 1. {@link State} `state` - the new client state
|
|
946
|
+
* @event
|
|
947
|
+
*/
|
|
948
|
+
Client.stateChanged = "stateChanged";
|
|
949
|
+
/**
|
|
950
|
+
* Fired when the client has completed initialization successfully.
|
|
951
|
+
* @event
|
|
952
|
+
*/
|
|
953
|
+
Client.initialized = "initialized";
|
|
954
|
+
/**
|
|
955
|
+
* Fired when the client initialization failed.
|
|
956
|
+
*
|
|
957
|
+
* Parameters:
|
|
891
958
|
* 1. object `data` - info object provided with the event. It has the
|
|
892
|
-
* following
|
|
893
|
-
* * {@link State} `state` - the new client state
|
|
959
|
+
* following property:
|
|
894
960
|
* * Error? `error` - the initialization error if present
|
|
895
961
|
* @event
|
|
896
962
|
*/
|
|
897
|
-
|
|
963
|
+
Client.initFailed = "initFailed";
|
|
898
964
|
/**
|
|
899
965
|
* Fired when the connection state of the client has been changed.
|
|
900
966
|
*
|
|
@@ -902,7 +968,7 @@ exports.Client.stateChanged = "stateChanged";
|
|
|
902
968
|
* 1. {@link ConnectionState} `state` - the new connection state
|
|
903
969
|
* @event
|
|
904
970
|
*/
|
|
905
|
-
|
|
971
|
+
Client.connectionStateChanged = "connectionStateChanged";
|
|
906
972
|
/**
|
|
907
973
|
* Fired when the connection is interrupted for an unexpected reason.
|
|
908
974
|
*
|
|
@@ -915,26 +981,26 @@ exports.Client.connectionStateChanged = "connectionStateChanged";
|
|
|
915
981
|
* * number? `errorCode` - Twilio public error code if available
|
|
916
982
|
* @event
|
|
917
983
|
*/
|
|
918
|
-
|
|
984
|
+
Client.connectionError = "connectionError";
|
|
919
985
|
/**
|
|
920
986
|
* Current version of the Conversations client.
|
|
921
987
|
*/
|
|
922
|
-
|
|
988
|
+
Client.version = version;
|
|
923
989
|
/**
|
|
924
990
|
* Logger instance.
|
|
925
991
|
*/
|
|
926
|
-
|
|
992
|
+
Client._logger = Logger.scope("Client");
|
|
927
993
|
/**
|
|
928
994
|
* Supported push notification channels.
|
|
929
995
|
*/
|
|
930
|
-
|
|
996
|
+
Client._supportedPushChannels = [
|
|
931
997
|
"fcm",
|
|
932
998
|
"apn",
|
|
933
999
|
];
|
|
934
1000
|
/**
|
|
935
1001
|
* Supported push data fields.
|
|
936
1002
|
*/
|
|
937
|
-
|
|
1003
|
+
Client._supportedPushDataFields = {
|
|
938
1004
|
conversation_sid: "conversationSid",
|
|
939
1005
|
conversation_title: "conversationTitle",
|
|
940
1006
|
message_sid: "messageSid",
|
|
@@ -942,99 +1008,107 @@ exports.Client._supportedPushDataFields = {
|
|
|
942
1008
|
media_count: "mediaCount",
|
|
943
1009
|
media: "media", // object
|
|
944
1010
|
};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1011
|
+
__decorate([
|
|
1012
|
+
deprecated("token"),
|
|
1013
|
+
__metadata("design:type", String),
|
|
1014
|
+
__metadata("design:paramtypes", [])
|
|
1015
|
+
], Client.prototype, "token", null);
|
|
1016
|
+
__decorate([
|
|
1017
|
+
validateTypesAsync(nonEmptyString),
|
|
1018
|
+
__metadata("design:type", Function),
|
|
1019
|
+
__metadata("design:paramtypes", [String]),
|
|
1020
|
+
__metadata("design:returntype", Promise)
|
|
1021
|
+
], Client.prototype, "updateToken", null);
|
|
1022
|
+
__decorate([
|
|
1023
|
+
validateTypesAsync(nonEmptyString),
|
|
1024
|
+
__metadata("design:type", Function),
|
|
1025
|
+
__metadata("design:paramtypes", [String]),
|
|
1026
|
+
__metadata("design:returntype", Promise)
|
|
1027
|
+
], Client.prototype, "getConversationBySid", null);
|
|
1028
|
+
__decorate([
|
|
1029
|
+
validateTypesAsync(nonEmptyString),
|
|
1030
|
+
__metadata("design:type", Function),
|
|
1031
|
+
__metadata("design:paramtypes", [String]),
|
|
1032
|
+
__metadata("design:returntype", Promise)
|
|
1033
|
+
], Client.prototype, "peekConversationBySid", null);
|
|
1034
|
+
__decorate([
|
|
1035
|
+
validateTypesAsync(nonEmptyString),
|
|
1036
|
+
__metadata("design:type", Function),
|
|
1037
|
+
__metadata("design:paramtypes", [String]),
|
|
1038
|
+
__metadata("design:returntype", Promise)
|
|
1039
|
+
], Client.prototype, "getConversationByUniqueName", null);
|
|
1040
|
+
__decorate([
|
|
1041
|
+
validateTypesAsync([
|
|
971
1042
|
"undefined",
|
|
972
|
-
|
|
1043
|
+
objectSchema("conversation options", {
|
|
973
1044
|
friendlyName: ["string", "undefined"],
|
|
974
1045
|
isPrivate: ["boolean", "undefined"],
|
|
975
1046
|
uniqueName: ["string", "undefined"],
|
|
976
1047
|
}),
|
|
977
1048
|
]),
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
],
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
],
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
],
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
],
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
],
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
],
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
],
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
],
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1049
|
+
__metadata("design:type", Function),
|
|
1050
|
+
__metadata("design:paramtypes", [Object]),
|
|
1051
|
+
__metadata("design:returntype", Promise)
|
|
1052
|
+
], Client.prototype, "createConversation", null);
|
|
1053
|
+
__decorate([
|
|
1054
|
+
validateTypesAsync(literal("fcm", "apn"), "string"),
|
|
1055
|
+
__metadata("design:type", Function),
|
|
1056
|
+
__metadata("design:paramtypes", [String, String]),
|
|
1057
|
+
__metadata("design:returntype", Promise)
|
|
1058
|
+
], Client.prototype, "setPushRegistrationId", null);
|
|
1059
|
+
__decorate([
|
|
1060
|
+
validateTypesAsync(literal("fcm", "apn")),
|
|
1061
|
+
__metadata("design:type", Function),
|
|
1062
|
+
__metadata("design:paramtypes", [String]),
|
|
1063
|
+
__metadata("design:returntype", Promise)
|
|
1064
|
+
], Client.prototype, "unsetPushRegistrationId", null);
|
|
1065
|
+
__decorate([
|
|
1066
|
+
validateTypesAsync(literal("fcm", "apn"), nonEmptyString),
|
|
1067
|
+
__metadata("design:type", Function),
|
|
1068
|
+
__metadata("design:paramtypes", [String, String]),
|
|
1069
|
+
__metadata("design:returntype", Promise)
|
|
1070
|
+
], Client.prototype, "removePushRegistrations", null);
|
|
1071
|
+
__decorate([
|
|
1072
|
+
validateTypesAsync(pureObject),
|
|
1073
|
+
__metadata("design:type", Function),
|
|
1074
|
+
__metadata("design:paramtypes", [Object]),
|
|
1075
|
+
__metadata("design:returntype", Promise)
|
|
1076
|
+
], Client.prototype, "handlePushNotification", null);
|
|
1077
|
+
__decorate([
|
|
1078
|
+
validateTypesAsync(nonEmptyString),
|
|
1079
|
+
__metadata("design:type", Function),
|
|
1080
|
+
__metadata("design:paramtypes", [String]),
|
|
1081
|
+
__metadata("design:returntype", Promise)
|
|
1082
|
+
], Client.prototype, "getUser", null);
|
|
1083
|
+
__decorate([
|
|
1084
|
+
validateTypesAsync(nonEmptyArray("strings", "string")),
|
|
1085
|
+
__metadata("design:type", Function),
|
|
1086
|
+
__metadata("design:paramtypes", [Array]),
|
|
1087
|
+
__metadata("design:returntype", CancellablePromise)
|
|
1088
|
+
], Client.prototype, "getTemporaryContentUrlsForMediaSids", null);
|
|
1089
|
+
__decorate([
|
|
1090
|
+
validateTypesAsync(nonEmptyArray("media", Media)),
|
|
1091
|
+
__metadata("design:type", Function),
|
|
1092
|
+
__metadata("design:paramtypes", [Array]),
|
|
1093
|
+
__metadata("design:returntype", CancellablePromise)
|
|
1094
|
+
], Client.prototype, "getTemporaryContentUrlsForMedia", null);
|
|
1095
|
+
__decorate([
|
|
1096
|
+
deprecated("Client.create()", "new Client()"),
|
|
1097
|
+
validateTypesAsync("string", ["undefined", pureObject]),
|
|
1098
|
+
__metadata("design:type", Function),
|
|
1099
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
1100
|
+
__metadata("design:returntype", Promise)
|
|
1101
|
+
], Client, "create", null);
|
|
1102
|
+
__decorate([
|
|
1103
|
+
validateTypes(pureObject),
|
|
1104
|
+
__metadata("design:type", Function),
|
|
1105
|
+
__metadata("design:paramtypes", [Object]),
|
|
1106
|
+
__metadata("design:returntype", PushNotification)
|
|
1107
|
+
], Client, "parsePushNotification", null);
|
|
1108
|
+
Client = Client_1 = __decorate([
|
|
1109
|
+
validateConstructorTypes(nonEmptyString, [pureObject, "undefined"]),
|
|
1110
|
+
__metadata("design:paramtypes", [String, Object])
|
|
1111
|
+
], Client);
|
|
1112
|
+
|
|
1113
|
+
export { Client };
|
|
1040
1114
|
//# sourceMappingURL=client.js.map
|