@twilio/conversations 2.1.0-rc.1 → 2.1.0-rc.5

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/NOTICE.txt +679 -0
  3. package/builds/browser.js +676 -587
  4. package/builds/browser.js.map +1 -1
  5. package/builds/lib.d.ts +287 -117
  6. package/builds/lib.js +676 -587
  7. package/builds/lib.js.map +1 -1
  8. package/builds/twilio-conversations.js +854 -909
  9. package/builds/twilio-conversations.min.js +2 -14
  10. package/dist/aggregated-delivery-receipt.js +6 -1
  11. package/dist/aggregated-delivery-receipt.js.map +1 -1
  12. package/dist/client.js +165 -142
  13. package/dist/client.js.map +1 -1
  14. package/dist/command-executor.js +16 -14
  15. package/dist/command-executor.js.map +1 -1
  16. package/dist/configuration.js +14 -10
  17. package/dist/configuration.js.map +1 -1
  18. package/dist/conversation.js +212 -153
  19. package/dist/conversation.js.map +1 -1
  20. package/dist/data/conversations.js +81 -77
  21. package/dist/data/conversations.js.map +1 -1
  22. package/dist/data/messages.js +42 -38
  23. package/dist/data/messages.js.map +1 -1
  24. package/dist/data/participants.js +93 -75
  25. package/dist/data/participants.js.map +1 -1
  26. package/dist/data/users.js +24 -22
  27. package/dist/data/users.js.map +1 -1
  28. package/dist/detailed-delivery-receipt.js +1 -1
  29. package/dist/detailed-delivery-receipt.js.map +1 -1
  30. package/dist/interfaces/attributes.js +4 -4
  31. package/dist/interfaces/attributes.js.map +1 -1
  32. package/dist/interfaces/notification-types.js +5 -5
  33. package/dist/interfaces/notification-types.js.map +1 -1
  34. package/dist/logger.js +36 -15
  35. package/dist/logger.js.map +1 -1
  36. package/dist/media.js +21 -9
  37. package/dist/media.js.map +1 -1
  38. package/dist/message-builder.js +10 -9
  39. package/dist/message-builder.js.map +1 -1
  40. package/dist/message.js +130 -81
  41. package/dist/message.js.map +1 -1
  42. package/dist/packages/conversations/package.json.js +1 -1
  43. package/dist/participant.js +85 -51
  44. package/dist/participant.js.map +1 -1
  45. package/dist/push-notification.js.map +1 -1
  46. package/dist/rest-paginator.js +16 -6
  47. package/dist/rest-paginator.js.map +1 -1
  48. package/dist/services/network.js +18 -14
  49. package/dist/services/network.js.map +1 -1
  50. package/dist/services/typing-indicator.js +20 -17
  51. package/dist/services/typing-indicator.js.map +1 -1
  52. package/dist/unsent-message.js.map +1 -1
  53. package/dist/user.js +85 -59
  54. package/dist/user.js.map +1 -1
  55. package/dist/util/deferred.js +3 -1
  56. package/dist/util/deferred.js.map +1 -1
  57. package/dist/util/index.js +6 -6
  58. package/dist/util/index.js.map +1 -1
  59. package/docs/classes/Client.html +24 -30
  60. package/docs/classes/Conversation.html +30 -30
  61. package/docs/classes/DetailedDeliveryReceipt.html +1 -1
  62. package/docs/classes/Message.html +7 -7
  63. package/docs/classes/MessageBuilder.html +2 -2
  64. package/docs/classes/Participant.html +7 -7
  65. package/docs/classes/User.html +7 -7
  66. package/docs/interfaces/CreateConversationOptions.html +1 -1
  67. package/package.json +23 -17
package/dist/message.js CHANGED
@@ -146,7 +146,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
146
146
 
147
147
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
148
148
 
149
- const log = logger.Logger.scope('Message');
149
+ const log = logger.Logger.scope("Message");
150
150
  /**
151
151
  * A message in a conversation.
152
152
  */
@@ -155,7 +155,7 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
155
155
  * @internal
156
156
  */
157
157
  constructor(index$1, data, conversation, links, configuration, services) {
158
- var _a, _b, _c, _d, _e;
158
+ var _a, _b, _c, _d;
159
159
  super();
160
160
  this.conversation = conversation;
161
161
  this.links = links;
@@ -164,42 +164,56 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
164
164
  this.state = {
165
165
  sid: data.sid,
166
166
  index: index$1,
167
- author: (_a = data.author) !== null && _a !== void 0 ? _a : null,
168
- subject: (_b = data.subject) !== null && _b !== void 0 ? _b : null,
169
- body: data.text,
167
+ author: data.author,
168
+ subject: data.subject,
169
+ body: (_a = data.text) !== null && _a !== void 0 ? _a : null,
170
170
  timestamp: data.timestamp ? new Date(data.timestamp) : null,
171
171
  dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,
172
- lastUpdatedBy: (_c = data.lastUpdatedBy) !== null && _c !== void 0 ? _c : null,
172
+ lastUpdatedBy: (_b = data.lastUpdatedBy) !== null && _b !== void 0 ? _b : null,
173
173
  attributes: index.parseAttributes(data.attributes, `Got malformed attributes for the message ${data.sid}`, log),
174
- type: (_d = data.type) !== null && _d !== void 0 ? _d : 'text',
175
- media: (data.type && data.type === 'media' && data.media)
176
- ? new media.Media(data.media, this.services) : null,
177
- medias: (data.type && data.type === 'media' && data.medias)
178
- ? data.medias.map((m) => new media.Media(m, this.services)) : null,
179
- participantSid: (_e = data.memberSid) !== null && _e !== void 0 ? _e : null,
180
- aggregatedDeliveryReceipt: data.delivery ? new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(data.delivery) : null
174
+ type: (_c = data.type) !== null && _c !== void 0 ? _c : "text",
175
+ media: data.type && data.type === "media" && data.media
176
+ ? new media.Media(data.media, this.services)
177
+ : null,
178
+ medias: data.type && data.type === "media" && data.medias
179
+ ? data.medias.map((m) => new media.Media(m, this.services))
180
+ : null,
181
+ participantSid: (_d = data.memberSid) !== null && _d !== void 0 ? _d : null,
182
+ aggregatedDeliveryReceipt: data.delivery
183
+ ? new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(data.delivery)
184
+ : null,
181
185
  };
182
186
  }
183
187
  /**
184
188
  * The server-assigned unique identifier for the message.
185
189
  */
186
- get sid() { return this.state.sid; }
190
+ get sid() {
191
+ return this.state.sid;
192
+ }
187
193
  /**
188
194
  * Name of the user that sent the message.
189
195
  */
190
- get author() { return this.state.author; }
196
+ get author() {
197
+ return this.state.author;
198
+ }
191
199
  /**
192
200
  * Message subject. Used only in email conversations.
193
201
  */
194
- get subject() { return this.state.subject; }
202
+ get subject() {
203
+ return this.state.subject;
204
+ }
195
205
  /**
196
206
  * Body of the message.
197
207
  */
198
- get body() { return this.state.body; }
208
+ get body() {
209
+ return this.state.body;
210
+ }
199
211
  /**
200
212
  * Date this message was last updated on.
201
213
  */
202
- get dateUpdated() { return this.state.dateUpdated; }
214
+ get dateUpdated() {
215
+ return this.state.dateUpdated;
216
+ }
203
217
  /**
204
218
  * Index of the message in the conversation's messages list.
205
219
  * By design of the Conversations system, the message indices may have arbitrary gaps between them,
@@ -211,36 +225,53 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
211
225
  * To calculate the number of unread messages it is better to use the read horizon API.
212
226
  * See {@link Conversation.getUnreadMessagesCount} for details.
213
227
  */
214
- get index() { return this.state.index; }
228
+ get index() {
229
+ return this.state.index;
230
+ }
215
231
  /**
216
232
  * Identity of the last user that updated the message.
217
233
  */
218
- get lastUpdatedBy() { return this.state.lastUpdatedBy; }
234
+ get lastUpdatedBy() {
235
+ return this.state.lastUpdatedBy;
236
+ }
219
237
  /**
220
238
  * Date this message was created on.
221
239
  */
222
- get dateCreated() { return this.state.timestamp; }
240
+ get dateCreated() {
241
+ return this.state.timestamp;
242
+ }
223
243
  /**
224
244
  * Custom attributes of the message.
225
245
  */
226
- get attributes() { return this.state.attributes; }
246
+ get attributes() {
247
+ return this.state.attributes;
248
+ }
227
249
  /**
228
250
  * Type of the message.
229
251
  */
230
- get type() { return this.state.type; }
252
+ get type() {
253
+ return this.state.type;
254
+ }
231
255
  /**
232
256
  * One of the attached media (if present).
233
257
  * @deprecated Use attachedMedia instead. Note that the latter is now an array.
234
258
  */
235
- get media() { return this.state.media; }
259
+ get media() {
260
+ return this.state.media;
261
+ }
236
262
  /**
237
263
  * Return all media attachments, except email body/history attachments, without temporary urls.
238
264
  */
239
- get attachedMedia() { return this.getMediaByCategory(['media']); }
265
+ get attachedMedia() {
266
+ return this.getMediaByCategory(["media"]);
267
+ }
240
268
  /**
241
269
  * The server-assigned unique identifier of the authoring participant.
242
270
  */
243
- get participantSid() { return this.state.participantSid; }
271
+ get participantSid() {
272
+ var _a;
273
+ return (_a = this.state.participantSid) !== null && _a !== void 0 ? _a : "";
274
+ }
244
275
  /**
245
276
  * Aggregated information about the message delivery statuses across all participants of a conversation..
246
277
  */
@@ -255,76 +286,83 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
255
286
  */
256
287
  getMediaByCategory(categories) {
257
288
  var _a;
258
- return (_a = this.state.medias) === null || _a === void 0 ? void 0 : _a.filter((m) => categories.includes(m.category));
289
+ return ((_a = this.state.medias) !== null && _a !== void 0 ? _a : []).filter((m) => categories.includes(m.category));
259
290
  }
260
291
  /**
261
292
  * Get a media descriptor for an email body attachment of a provided type.
262
293
  * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
263
294
  * @param type Type of email body to request, defaults to `text/plain`.
264
295
  */
265
- getEmailBody(type = 'text/plain') {
296
+ getEmailBody(type = "text/plain") {
266
297
  var _a, _b;
267
- return (_b = (_a = this.getMediaByCategory(['body'])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null;
298
+ return ((_b = (_a = this.getMediaByCategory(["body"])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null);
268
299
  }
269
300
  /**
270
301
  * Get a media descriptor for an email history attachment of a provided type.
271
302
  * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
272
303
  * @param type Type of email history to request, defaults to `text/plain`.
273
304
  */
274
- getEmailHistory(type = 'text/plain') {
305
+ getEmailHistory(type = "text/plain") {
275
306
  var _a, _b;
276
- return (_b = (_a = this.getMediaByCategory(['history'])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null;
307
+ return ((_b = (_a = this.getMediaByCategory(["history"])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null);
277
308
  }
278
309
  _update(data) {
279
- let updateReasons = [];
280
- if ((data.text || ((typeof data.text) === 'string')) && data.text !== this.state.body) {
310
+ const updateReasons = [];
311
+ if ((data.text || typeof data.text === "string") &&
312
+ data.text !== this.state.body) {
281
313
  this.state.body = data.text;
282
- updateReasons.push('body');
314
+ updateReasons.push("body");
283
315
  }
284
316
  if (data.subject && data.subject !== this.state.subject) {
285
317
  this.state.subject = data.subject;
286
- updateReasons.push('subject');
318
+ updateReasons.push("subject");
287
319
  }
288
320
  if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {
289
321
  this.state.lastUpdatedBy = data.lastUpdatedBy;
290
- updateReasons.push('lastUpdatedBy');
322
+ updateReasons.push("lastUpdatedBy");
291
323
  }
292
324
  if (data.author && data.author !== this.state.author) {
293
325
  this.state.author = data.author;
294
- updateReasons.push('author');
326
+ updateReasons.push("author");
295
327
  }
296
328
  if (data.dateUpdated &&
297
- new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
329
+ new Date(data.dateUpdated).getTime() !==
330
+ (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
298
331
  this.state.dateUpdated = new Date(data.dateUpdated);
299
- updateReasons.push('dateUpdated');
332
+ updateReasons.push("dateUpdated");
300
333
  }
301
334
  if (data.timestamp &&
302
- new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {
335
+ new Date(data.timestamp).getTime() !==
336
+ (this.state.timestamp && this.state.timestamp.getTime())) {
303
337
  this.state.timestamp = new Date(data.timestamp);
304
- updateReasons.push('dateCreated');
338
+ updateReasons.push("dateCreated");
305
339
  }
306
- let updatedAttributes = index.parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);
340
+ const updatedAttributes = index.parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);
307
341
  if (!isEqual__default['default'](this.state.attributes, updatedAttributes)) {
308
342
  this.state.attributes = updatedAttributes;
309
- updateReasons.push('attributes');
343
+ updateReasons.push("attributes");
310
344
  }
311
- let updatedAggregatedDelivery = data.delivery;
312
- let currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;
313
- let isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery && !!updatedAggregatedDelivery.total &&
314
- !!updatedAggregatedDelivery.delivered && !!updatedAggregatedDelivery.failed && !!updatedAggregatedDelivery.read &&
315
- !!updatedAggregatedDelivery.sent && !!updatedAggregatedDelivery.undelivered;
345
+ const updatedAggregatedDelivery = data.delivery;
346
+ const currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;
347
+ const isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery &&
348
+ !!updatedAggregatedDelivery.total &&
349
+ !!updatedAggregatedDelivery.delivered &&
350
+ !!updatedAggregatedDelivery.failed &&
351
+ !!updatedAggregatedDelivery.read &&
352
+ !!updatedAggregatedDelivery.sent &&
353
+ !!updatedAggregatedDelivery.undelivered;
316
354
  if (isUpdatedAggregateDeliveryValid) {
317
355
  if (!currentAggregatedDelivery) {
318
356
  this.state.aggregatedDeliveryReceipt = new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(updatedAggregatedDelivery);
319
- updateReasons.push('deliveryReceipt');
357
+ updateReasons.push("deliveryReceipt");
320
358
  }
321
359
  else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {
322
360
  currentAggregatedDelivery._update(updatedAggregatedDelivery);
323
- updateReasons.push('deliveryReceipt');
361
+ updateReasons.push("deliveryReceipt");
324
362
  }
325
363
  }
326
364
  if (updateReasons.length > 0) {
327
- this.emit('updated', { message: this, updateReasons: updateReasons });
365
+ this.emit("updated", { message: this, updateReasons: updateReasons });
328
366
  }
329
367
  }
330
368
  /**
@@ -333,14 +371,16 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
333
371
  async getParticipant() {
334
372
  let participant = null;
335
373
  if (this.state.participantSid) {
336
- participant = await this.conversation.getParticipantBySid(this.participantSid)
374
+ participant = await this.conversation
375
+ .getParticipantBySid(this.participantSid)
337
376
  .catch(() => {
338
377
  log.debug(`Participant with sid "${this.participantSid}" not found for message ${this.sid}`);
339
378
  return null;
340
379
  });
341
380
  }
342
381
  if (!participant && this.state.author) {
343
- participant = await this.conversation.getParticipantByIdentity(this.state.author)
382
+ participant = await this.conversation
383
+ .getParticipantByIdentity(this.state.author)
344
384
  .catch(() => {
345
385
  log.debug(`Participant with identity "${this.author}" not found for message ${this.sid}`);
346
386
  return null;
@@ -349,20 +389,20 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
349
389
  if (participant) {
350
390
  return participant;
351
391
  }
352
- let errorMesage = 'Participant with ';
392
+ let errorMesage = "Participant with ";
353
393
  if (this.state.participantSid) {
354
- errorMesage += 'SID \'' + this.state.participantSid + '\' ';
394
+ errorMesage += "SID '" + this.state.participantSid + "' ";
355
395
  }
356
396
  if (this.state.author) {
357
397
  if (this.state.participantSid) {
358
- errorMesage += 'or ';
398
+ errorMesage += "or ";
359
399
  }
360
- errorMesage += 'identity \'' + this.state.author + '\' ';
400
+ errorMesage += "identity '" + this.state.author + "' ";
361
401
  }
362
- if (errorMesage === 'Participant with ') {
363
- errorMesage = 'Participant ';
402
+ if (errorMesage === "Participant with ") {
403
+ errorMesage = "Participant ";
364
404
  }
365
- errorMesage += 'was not found';
405
+ errorMesage += "was not found";
366
406
  throw new Error(errorMesage);
367
407
  }
368
408
  /**
@@ -372,7 +412,10 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
372
412
  let paginator = await this._getDetailedDeliveryReceiptsPaginator();
373
413
  let detailedDeliveryReceipts = [];
374
414
  while (true) {
375
- detailedDeliveryReceipts = [...detailedDeliveryReceipts, ...paginator.items];
415
+ detailedDeliveryReceipts = [
416
+ ...detailedDeliveryReceipts,
417
+ ...paginator.items,
418
+ ];
376
419
  if (!paginator.hasNextPage) {
377
420
  break;
378
421
  }
@@ -384,7 +427,7 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
384
427
  * Remove the message.
385
428
  */
386
429
  async remove() {
387
- await this.services.commandExecutor.mutateResource('delete', this.links.self);
430
+ await this.services.commandExecutor.mutateResource("delete", this.links.self);
388
431
  return this;
389
432
  }
390
433
  /**
@@ -392,8 +435,8 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
392
435
  * @param body New body of the message.
393
436
  */
394
437
  async updateBody(body) {
395
- await this.services.commandExecutor.mutateResource('post', this.links.self, {
396
- body
438
+ await this.services.commandExecutor.mutateResource("post", this.links.self, {
439
+ body,
397
440
  });
398
441
  return this;
399
442
  }
@@ -402,8 +445,10 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
402
445
  * @param attributes New attributes.
403
446
  */
404
447
  async updateAttributes(attributes) {
405
- await this.services.commandExecutor.mutateResource('post', this.links.self, {
406
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
448
+ await this.services.commandExecutor.mutateResource("post", this.links.self, {
449
+ attributes: typeof attributes !== "undefined"
450
+ ? JSON.stringify(attributes)
451
+ : undefined,
407
452
  });
408
453
  return this;
409
454
  }
@@ -414,21 +459,23 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
414
459
  async attachTemporaryUrlsFor(contentSet) {
415
460
  // We ignore existing mcsMedia members of each of the media entries.
416
461
  // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.
417
- const sids = contentSet.map((m) => m.sid);
418
- if (this.services.mcsClient) {
419
- return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => { return new media.Media(item, this.services); });
462
+ const sids = contentSet === null || contentSet === void 0 ? void 0 : contentSet.map((m) => m.sid);
463
+ if (this.services.mcsClient && sids) {
464
+ return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => {
465
+ return new media.Media(item, this.services);
466
+ });
420
467
  }
421
468
  else {
422
- throw new Error('Media Content Service is unavailable');
469
+ throw new Error("Media Content Service is unavailable");
423
470
  }
424
471
  }
425
472
  async _getDetailedDeliveryReceiptsPaginator(options) {
426
473
  const messagesReceiptsUrl = this.configuration.links.messagesReceipts
427
- .replace('%s', this.conversation.sid)
428
- .replace('%s', this.sid);
474
+ .replace("%s", this.conversation.sid)
475
+ .replace("%s", this.sid);
429
476
  const url = new index.UriBuilder(messagesReceiptsUrl)
430
- .arg('PageToken', options === null || options === void 0 ? void 0 : options.pageToken)
431
- .arg('PageSize', options === null || options === void 0 ? void 0 : options.pageSize)
477
+ .arg("PageToken", options === null || options === void 0 ? void 0 : options.pageToken)
478
+ .arg("PageSize", options === null || options === void 0 ? void 0 : options.pageSize)
432
479
  .build();
433
480
  const response = await this.services.network.get(url);
434
481
  return new restPaginator.RestPaginator(response.body.delivery_receipts.map((x) => new detailedDeliveryReceipt.DetailedDeliveryReceipt(x)), (pageToken, pageSize) => this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }), response.body.meta.previous_token, response.body.meta.next_token);
@@ -442,21 +489,21 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
442
489
  * * {@link Message} message - the message in question
443
490
  * * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
444
491
  */
445
- Message.updated = 'updated';
492
+ Message.updated = "updated";
446
493
  tslib_es6.__decorate([
447
494
  declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString),
448
495
  tslib_es6.__metadata("design:type", Function),
449
- tslib_es6.__metadata("design:paramtypes", [String]),
496
+ tslib_es6.__metadata("design:paramtypes", [Object]),
450
497
  tslib_es6.__metadata("design:returntype", media.Media)
451
498
  ], Message.prototype, "getEmailBody", null);
452
499
  tslib_es6.__decorate([
453
500
  declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString),
454
501
  tslib_es6.__metadata("design:type", Function),
455
- tslib_es6.__metadata("design:paramtypes", [String]),
502
+ tslib_es6.__metadata("design:paramtypes", [Object]),
456
503
  tslib_es6.__metadata("design:returntype", media.Media)
457
504
  ], Message.prototype, "getEmailHistory", null);
458
505
  tslib_es6.__decorate([
459
- declarativeTypeValidator.validateTypesAsync('string'),
506
+ declarativeTypeValidator.validateTypesAsync("string"),
460
507
  tslib_es6.__metadata("design:type", Function),
461
508
  tslib_es6.__metadata("design:paramtypes", [String]),
462
509
  tslib_es6.__metadata("design:returntype", Promise)
@@ -468,9 +515,11 @@ tslib_es6.__decorate([
468
515
  tslib_es6.__metadata("design:returntype", Promise)
469
516
  ], Message.prototype, "updateAttributes", null);
470
517
  tslib_es6.__decorate([
471
- declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.custom(value => [
472
- value instanceof Array && value.length > 0 && value.reduce((a, c) => a && c instanceof media.Media, true),
473
- 'a non-empty array of Media'
518
+ declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.custom((value) => [
519
+ value instanceof Array &&
520
+ value.length > 0 &&
521
+ value.reduce((a, c) => a && c instanceof media.Media, true),
522
+ "a non-empty array of Media",
474
523
  ])),
475
524
  tslib_es6.__metadata("design:type", Function),
476
525
  tslib_es6.__metadata("design:paramtypes", [Array]),
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sources":["../src/message.ts"],"sourcesContent":["import { parseAttributes, UriBuilder } from './util';\nimport { Logger } from './logger';\nimport { Conversation } from './conversation';\nimport { McsClient, MediaCategory } from '@twilio/mcs-client';\nimport { Media } from './media';\nimport { Participant } from './participant';\nimport { AggregatedDeliveryReceipt } from './aggregated-delivery-receipt';\nimport { validateTypes, validateTypesAsync, literal, nonEmptyString, custom } from '@twilio/declarative-type-validator';\nimport { attributesValidator } from './interfaces/attributes';\nimport { Network } from './services/network';\nimport { RestPaginator } from './rest-paginator';\nimport { DetailedDeliveryReceipt } from './detailed-delivery-receipt';\nimport { Paginator } from './interfaces/paginator';\nimport { Configuration } from './configuration';\nimport { CommandExecutor } from './command-executor';\nimport { EditMessageRequest } from './interfaces/commands/edit-message';\nimport { MessageResponse } from './interfaces/commands/message-response';\nimport { ReplayEventEmitter } from '@twilio/replay-event-emitter';\nimport isEqual from 'lodash.isequal';\n\ntype MessageEvents = {\n updated: (data: {\n message: Message;\n updateReasons: MessageUpdateReason[]\n }) => void;\n};\n\nconst log = Logger.scope('Message');\n\ninterface MessageState {\n sid: string;\n index: number;\n author?: string;\n subject?: string;\n body: string;\n dateUpdated: Date;\n lastUpdatedBy: string;\n attributes: Object;\n timestamp: Date;\n type: MessageType;\n media?: Media;\n medias?: Media[];\n participantSid?: string;\n aggregatedDeliveryReceipt?: AggregatedDeliveryReceipt;\n}\n\ninterface MessageServices {\n mcsClient: McsClient;\n network: Network;\n commandExecutor: CommandExecutor;\n}\n\ninterface MessageLinks {\n self: string;\n conversation: string;\n messages_receipts: string;\n}\n\n/**\n * The reason for the `updated` event being emitted by a message.\n */\ntype MessageUpdateReason =\n | 'body'\n | 'lastUpdatedBy'\n | 'dateCreated'\n | 'dateUpdated'\n | 'attributes'\n | 'author'\n | 'deliveryReceipt'\n | 'subject';\n\n/**\n * Type of a message.\n */\ntype MessageType = 'text' | 'media';\n\ninterface MessageUpdatedEventArgs {\n message: Message;\n updateReasons: MessageUpdateReason[];\n}\n\n/**\n * A message in a conversation.\n */\nclass Message extends ReplayEventEmitter<MessageEvents> {\n /**\n * Conversation that the message is in.\n */\n public readonly conversation: Conversation;\n\n private readonly links: MessageLinks;\n private readonly configuration: Configuration;\n private readonly services: MessageServices;\n\n private state: MessageState;\n\n /**\n * @internal\n */\n constructor(\n index: number,\n data: any,\n conversation: Conversation,\n links: MessageLinks,\n configuration: Configuration,\n services: MessageServices,\n ) {\n super();\n\n this.conversation = conversation;\n\n this.links = links;\n this.configuration = configuration;\n this.services = services;\n\n this.state = {\n sid: data.sid,\n index: index,\n author: data.author ?? null,\n subject: data.subject ?? null,\n body: data.text,\n timestamp: data.timestamp ? new Date(data.timestamp) : null,\n dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,\n lastUpdatedBy: data.lastUpdatedBy ?? null,\n attributes: parseAttributes(data.attributes, `Got malformed attributes for the message ${data.sid}`, log),\n type: data.type ?? 'text',\n media: (data.type && data.type === 'media' && data.media)\n ? new Media(data.media, this.services) : null,\n medias: (data.type && data.type === 'media' && data.medias)\n ? data.medias.map((m) => new Media(m, this.services)) : null,\n participantSid: data.memberSid ?? null,\n aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null\n };\n }\n\n /**\n * Fired when the properties or the body of the message has been updated.\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 */\n static readonly updated = 'updated';\n\n /**\n * The server-assigned unique identifier for the message.\n */\n public get sid(): string { return this.state.sid; }\n\n /**\n * Name of the user that sent the message.\n */\n public get author(): string { return this.state.author; }\n\n /**\n * Message subject. Used only in email conversations.\n */\n public get subject(): string | null { return this.state.subject; }\n\n /**\n * Body of the message.\n */\n public get body(): string { return this.state.body; }\n\n /**\n * Date this message was last updated on.\n */\n public get dateUpdated(): Date { return this.state.dateUpdated; }\n\n /**\n * Index of the message in the conversation's messages list.\n * By design of the Conversations system, the message indices may have arbitrary gaps between them,\n * that does not necessarily mean they were deleted or otherwise modified - just that\n * messages may have some non-contiguous indices even if they are being sent immediately one after another.\n *\n * Trying to use indices for some calculations is going to be unreliable.\n *\n * To calculate the number of unread messages it is better to use the read horizon API.\n * See {@link Conversation.getUnreadMessagesCount} for details.\n */\n public get index(): number { return this.state.index; }\n\n /**\n * Identity of the last user that updated the message.\n */\n public get lastUpdatedBy(): string { return this.state.lastUpdatedBy; }\n\n /**\n * Date this message was created on.\n */\n public get dateCreated(): Date { return this.state.timestamp; }\n\n /**\n * Custom attributes of the message.\n */\n public get attributes(): Object { return this.state.attributes; }\n\n /**\n * Type of the message.\n */\n public get type(): MessageType { return this.state.type; }\n\n /**\n * One of the attached media (if present).\n * @deprecated Use attachedMedia instead. Note that the latter is now an array.\n */\n public get media(): Media | null { return this.state.media; }\n\n /**\n * Return all media attachments, except email body/history attachments, without temporary urls.\n */\n public get attachedMedia(): Array<Media> | null { return this.getMediaByCategory(['media']); }\n\n /**\n * The server-assigned unique identifier of the authoring participant.\n */\n public get participantSid(): string { return this.state.participantSid; }\n\n /**\n * Aggregated information about the message delivery statuses across all participants of a conversation..\n */\n public get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null {\n return this.state.aggregatedDeliveryReceipt;\n }\n\n /**\n * Return a (possibly empty) array of media matching a specific set of categories.\n * Allowed category is so far only 'media'.\n * @param categories Array of categories to match.\n * @returns Array of media descriptors matching given categories.\n */\n public getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null {\n return this.state.medias?.filter((m) => categories.includes(m.category));\n }\n\n /**\n * Get a media descriptor for an email body attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.\n * @param type Type of email body to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailBody(type: string = 'text/plain'): Media | null {\n return this.getMediaByCategory(['body'])?.filter((m) => m.contentType == type).shift() ?? null;\n }\n\n /**\n * Get a media descriptor for an email history attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.\n * @param type Type of email history to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailHistory(type: string = 'text/plain'): Media | null {\n return this.getMediaByCategory(['history'])?.filter((m) => m.contentType == type).shift() ?? null;\n }\n\n _update(data) {\n let updateReasons: MessageUpdateReason[] = [];\n\n if ((data.text || ((typeof data.text) === 'string')) && data.text !== this.state.body) {\n this.state.body = data.text;\n updateReasons.push('body');\n }\n\n if (data.subject && data.subject !== this.state.subject) {\n this.state.subject = data.subject;\n updateReasons.push('subject');\n }\n\n if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {\n this.state.lastUpdatedBy = data.lastUpdatedBy;\n updateReasons.push('lastUpdatedBy');\n }\n\n if (data.author && data.author !== this.state.author) {\n this.state.author = data.author;\n updateReasons.push('author');\n }\n\n if (data.dateUpdated &&\n new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {\n this.state.dateUpdated = new Date(data.dateUpdated);\n updateReasons.push('dateUpdated');\n }\n\n if (data.timestamp &&\n new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {\n this.state.timestamp = new Date(data.timestamp);\n updateReasons.push('dateCreated');\n }\n\n let updatedAttributes = parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);\n if (!isEqual(this.state.attributes, updatedAttributes)) {\n this.state.attributes = updatedAttributes;\n updateReasons.push('attributes');\n }\n\n let updatedAggregatedDelivery = data.delivery;\n let currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;\n let isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery && !!updatedAggregatedDelivery.total &&\n !!updatedAggregatedDelivery.delivered && !!updatedAggregatedDelivery.failed && !!updatedAggregatedDelivery.read &&\n !!updatedAggregatedDelivery.sent && !!updatedAggregatedDelivery.undelivered;\n if (isUpdatedAggregateDeliveryValid) {\n if (!currentAggregatedDelivery) {\n this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(updatedAggregatedDelivery);\n updateReasons.push('deliveryReceipt');\n } else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {\n currentAggregatedDelivery._update(updatedAggregatedDelivery);\n updateReasons.push('deliveryReceipt');\n }\n }\n\n if (updateReasons.length > 0) {\n this.emit('updated', { message: this, updateReasons: updateReasons });\n }\n }\n\n /**\n * Get the participant who is the author of the message.\n */\n public async getParticipant(): Promise<Participant> {\n let participant: Participant = null;\n if (this.state.participantSid) {\n participant = await this.conversation.getParticipantBySid(this.participantSid)\n .catch(() => {\n log.debug(`Participant with sid \"${this.participantSid}\" not found for message ${this.sid}`);\n return null;\n });\n }\n if (!participant && this.state.author) {\n participant = await this.conversation.getParticipantByIdentity(this.state.author)\n .catch(() => {\n log.debug(`Participant with identity \"${this.author}\" not found for message ${this.sid}`);\n return null;\n });\n }\n if (participant) {\n return participant;\n }\n let errorMesage = 'Participant with ';\n if (this.state.participantSid) {\n errorMesage += 'SID \\'' + this.state.participantSid + '\\' ';\n }\n if (this.state.author) {\n if (this.state.participantSid) {\n errorMesage += 'or ';\n }\n errorMesage += 'identity \\'' + this.state.author + '\\' ';\n }\n if (errorMesage === 'Participant with ') {\n errorMesage = 'Participant ';\n }\n errorMesage += 'was not found';\n throw new Error(errorMesage);\n }\n\n /**\n * Get the delivery receipts of the message.\n */\n public async getDetailedDeliveryReceipts(): Promise<DetailedDeliveryReceipt[]> {\n let paginator: Paginator<DetailedDeliveryReceipt> = await this._getDetailedDeliveryReceiptsPaginator();\n let detailedDeliveryReceipts: DetailedDeliveryReceipt[] = [];\n\n while (true) {\n detailedDeliveryReceipts = [...detailedDeliveryReceipts, ...paginator.items];\n\n if (!paginator.hasNextPage) {\n break;\n }\n\n paginator = await paginator.nextPage();\n }\n\n return detailedDeliveryReceipts;\n }\n\n /**\n * Remove the message.\n */\n public async remove(): Promise<Message> {\n await this.services.commandExecutor.mutateResource(\n 'delete',\n this.links.self\n );\n\n return this;\n }\n\n /**\n * Edit the message body.\n * @param body New body of the message.\n */\n @validateTypesAsync('string')\n public async updateBody(body: string): Promise<Message> {\n await this.services.commandExecutor.mutateResource<EditMessageRequest, MessageResponse>(\n 'post',\n this.links.self,\n {\n body\n }\n );\n\n return this;\n }\n\n /**\n * Edit the message attributes.\n * @param attributes New attributes.\n */\n @validateTypesAsync(attributesValidator)\n public async updateAttributes(attributes: any): Promise<Message> {\n await this.services.commandExecutor.mutateResource<EditMessageRequest, MessageResponse>(\n 'post',\n this.links.self,\n {\n attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined\n }\n );\n\n return this;\n }\n\n /**\n * Get content URLs for all media attachments in the given set using single operation.\n * @param contentSet Set of media attachments to query for content URL.\n */\n @validateTypesAsync(custom(value => [\n value instanceof Array && value.length > 0 && value.reduce((a, c) => a && c instanceof Media, true),\n 'a non-empty array of Media'\n ]))\n public async attachTemporaryUrlsFor(contentSet: Media[]): Promise<Media[]> {\n // We ignore existing mcsMedia members of each of the media entries.\n // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.\n const sids = contentSet.map((m) => m.sid);\n if (this.services.mcsClient) {\n return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => { return new Media(item, this.services); });\n } else {\n throw new Error('Media Content Service is unavailable');\n }\n }\n\n private async _getDetailedDeliveryReceiptsPaginator(options?: {\n pageToken?: string;\n pageSize?: number;\n }): Promise<Paginator<DetailedDeliveryReceipt>> {\n const messagesReceiptsUrl = this.configuration.links.messagesReceipts\n .replace('%s', this.conversation.sid)\n .replace('%s', this.sid);\n const url = new UriBuilder(messagesReceiptsUrl)\n .arg('PageToken', options?.pageToken)\n .arg('PageSize', options?.pageSize)\n .build();\n const response = await this.services.network.get(url);\n\n return new RestPaginator<DetailedDeliveryReceipt>(\n response.body.delivery_receipts.map(\n (x) => new DetailedDeliveryReceipt(x)\n ),\n (pageToken, pageSize) =>\n this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }),\n response.body.meta.previous_token,\n response.body.meta.next_token\n );\n }\n}\n\nexport {\n Message,\n MessageServices,\n MessageType,\n MessageUpdateReason,\n MessageUpdatedEventArgs\n};\n"],"names":["Logger","ReplayEventEmitter","index","parseAttributes","Media","AggregatedDeliveryReceipt","isEqual","UriBuilder","RestPaginator","DetailedDeliveryReceipt","__decorate","validateTypes","nonEmptyString","validateTypesAsync","attributesValidator","custom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAsDpC;;;AAGA,MAAM,OAAQ,SAAQC,qCAAiC;;;;IAerD,YACE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CAAC,EACrE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EACjC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAC9B,CAAC;KACH;;AAxUD;;;;;;;;AAQgB,eAAO,GAAG,SAAS,CAAC;AAmGpCC;IADCC,sCAAa,CAACC,uCAAc,CAAC;;;8CACoBR,WAAK;2CAEtD;AAQDM;IADCC,sCAAa,CAACC,uCAAc,CAAC;;;8CACuBR,WAAK;8CAEzD;AA2IDM;IADCG,2CAAkB,CAAC,QAAQ,CAAC;;;;yCAW5B;AAODH;IADCG,2CAAkB,CAACC,8BAAmB,CAAC;;;;+CAWvC;AAUDJ;IAJCG,2CAAkB,CAACE,+BAAM,CAAC,KAAK,IAAI;QAClC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,YAAYX,WAAK,EAAE,IAAI,CAAC;QACnG,4BAA4B;KAC7B,CAAC,CAAC;;;;qDAUF;;;;"}
1
+ {"version":3,"file":"message.js","sources":["../src/message.ts"],"sourcesContent":["import { parseAttributes, UriBuilder } from \"./util\";\nimport { Logger } from \"./logger\";\nimport { Conversation } from \"./conversation\";\nimport { McsClient, MediaCategory } from \"@twilio/mcs-client\";\nimport { Media } from \"./media\";\nimport { Participant } from \"./participant\";\nimport {\n AggregatedDeliveryDescriptor,\n AggregatedDeliveryReceipt,\n} from \"./aggregated-delivery-receipt\";\nimport {\n validateTypes,\n validateTypesAsync,\n nonEmptyString,\n custom,\n} from \"@twilio/declarative-type-validator\";\nimport { attributesValidator } from \"./interfaces/attributes\";\nimport { Network } from \"./services/network\";\nimport { RestPaginator } from \"./rest-paginator\";\nimport { DetailedDeliveryReceipt } from \"./detailed-delivery-receipt\";\nimport { Paginator } from \"./interfaces/paginator\";\nimport { Configuration } from \"./configuration\";\nimport { CommandExecutor } from \"./command-executor\";\nimport { EditMessageRequest } from \"./interfaces/commands/edit-message\";\nimport { MessageResponse } from \"./interfaces/commands/message-response\";\nimport { ReplayEventEmitter } from \"@twilio/replay-event-emitter\";\nimport isEqual from \"lodash.isequal\";\nimport { JSONValue } from \"./types\";\nimport { ResponseMeta } from \"./interfaces/commands/response-meta\";\nimport { DeliveryReceiptResponse } from \"./interfaces/commands/delivery-receipt-response\";\n\ntype MessageEvents = {\n updated: (data: {\n message: Message;\n updateReasons: MessageUpdateReason[];\n }) => void;\n};\n\nconst log = Logger.scope(\"Message\");\n\ninterface MessageState {\n sid: string;\n index: number;\n author: string | null;\n subject: string | null;\n body: string | null;\n dateUpdated: Date | null;\n lastUpdatedBy: string | null;\n attributes: JSONValue;\n timestamp: Date | null;\n type: MessageType;\n media: Media | null;\n medias: Media[] | null;\n participantSid: string | null;\n aggregatedDeliveryReceipt: AggregatedDeliveryReceipt | null;\n}\n\ninterface MessageServices {\n mcsClient: McsClient;\n network: Network;\n commandExecutor: CommandExecutor;\n}\n\ninterface MessageLinks {\n self: string;\n conversation: string;\n messages_receipts: string;\n}\n\n/**\n * The reason for the `updated` event being emitted by a message.\n */\ntype MessageUpdateReason =\n | \"body\"\n | \"lastUpdatedBy\"\n | \"dateCreated\"\n | \"dateUpdated\"\n | \"attributes\"\n | \"author\"\n | \"deliveryReceipt\"\n | \"subject\";\n\n/**\n * Type of a message.\n */\ntype MessageType = \"text\" | \"media\";\n\ninterface MessageUpdatedEventArgs {\n message: Message;\n updateReasons: MessageUpdateReason[];\n}\n\nexport interface MessageData {\n sid: string;\n text?: string;\n type?: MessageType;\n author: string | null;\n subject: string | null;\n lastUpdatedBy?: string | null;\n attributes?: JSONValue;\n dateUpdated: string;\n timestamp?: string;\n medias?: Media[];\n media?: Media;\n memberSid?: string;\n delivery?: AggregatedDeliveryDescriptor;\n}\n\n/**\n * A message in a conversation.\n */\nclass Message extends ReplayEventEmitter<MessageEvents> {\n /**\n * Conversation that the message is in.\n */\n public readonly conversation: Conversation;\n\n private readonly links: MessageLinks;\n private readonly configuration: Configuration;\n private readonly services: MessageServices;\n\n private state: MessageState;\n\n /**\n * @internal\n */\n constructor(\n index: number,\n data: MessageData,\n conversation: Conversation,\n links: MessageLinks,\n configuration: Configuration,\n services: MessageServices\n ) {\n super();\n\n this.conversation = conversation;\n\n this.links = links;\n this.configuration = configuration;\n this.services = services;\n\n this.state = {\n sid: data.sid,\n index: index,\n author: data.author,\n subject: data.subject,\n body: data.text ?? null,\n timestamp: data.timestamp ? new Date(data.timestamp) : null,\n dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,\n lastUpdatedBy: data.lastUpdatedBy ?? null,\n attributes: parseAttributes(\n data.attributes,\n `Got malformed attributes for the message ${data.sid}`,\n log\n ),\n type: data.type ?? \"text\",\n media:\n data.type && data.type === \"media\" && data.media\n ? new Media(data.media, this.services)\n : null,\n medias:\n data.type && data.type === \"media\" && data.medias\n ? data.medias.map((m) => new Media(m, this.services))\n : null,\n participantSid: data.memberSid ?? null,\n aggregatedDeliveryReceipt: data.delivery\n ? new AggregatedDeliveryReceipt(data.delivery)\n : null,\n };\n }\n\n /**\n * Fired when the properties or the body of the message has been updated.\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 */\n static readonly updated = \"updated\";\n\n /**\n * The server-assigned unique identifier for the message.\n */\n public get sid(): string {\n return this.state.sid;\n }\n\n /**\n * Name of the user that sent the message.\n */\n public get author(): string | null {\n return this.state.author;\n }\n\n /**\n * Message subject. Used only in email conversations.\n */\n public get subject(): string | null {\n return this.state.subject;\n }\n\n /**\n * Body of the message.\n */\n public get body(): string | null {\n return this.state.body;\n }\n\n /**\n * Date this message was last updated on.\n */\n public get dateUpdated(): Date | null {\n return this.state.dateUpdated;\n }\n\n /**\n * Index of the message in the conversation's messages list.\n * By design of the Conversations system, the message indices may have arbitrary gaps between them,\n * that does not necessarily mean they were deleted or otherwise modified - just that\n * messages may have some non-contiguous indices even if they are being sent immediately one after another.\n *\n * Trying to use indices for some calculations is going to be unreliable.\n *\n * To calculate the number of unread messages it is better to use the read horizon API.\n * See {@link Conversation.getUnreadMessagesCount} for details.\n */\n public get index(): number {\n return this.state.index;\n }\n\n /**\n * Identity of the last user that updated the message.\n */\n public get lastUpdatedBy(): string | null {\n return this.state.lastUpdatedBy;\n }\n\n /**\n * Date this message was created on.\n */\n public get dateCreated(): Date | null {\n return this.state.timestamp;\n }\n\n /**\n * Custom attributes of the message.\n */\n public get attributes(): JSONValue {\n return this.state.attributes;\n }\n\n /**\n * Type of the message.\n */\n public get type(): MessageType {\n return this.state.type;\n }\n\n /**\n * One of the attached media (if present).\n * @deprecated Use attachedMedia instead. Note that the latter is now an array.\n */\n public get media(): Media | null {\n return this.state.media;\n }\n\n /**\n * Return all media attachments, except email body/history attachments, without temporary urls.\n */\n public get attachedMedia(): Array<Media> | null {\n return this.getMediaByCategory([\"media\"]);\n }\n\n /**\n * The server-assigned unique identifier of the authoring participant.\n */\n public get participantSid(): string {\n return this.state.participantSid ?? \"\";\n }\n\n /**\n * Aggregated information about the message delivery statuses across all participants of a conversation..\n */\n public get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null {\n return this.state.aggregatedDeliveryReceipt;\n }\n\n /**\n * Return a (possibly empty) array of media matching a specific set of categories.\n * Allowed category is so far only 'media'.\n * @param categories Array of categories to match.\n * @returns Array of media descriptors matching given categories.\n */\n public getMediaByCategory(\n categories: Array<MediaCategory>\n ): Array<Media> | null {\n return (this.state.medias ?? []).filter((m) =>\n categories.includes(m.category)\n );\n }\n\n /**\n * Get a media descriptor for an email body attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.\n * @param type Type of email body to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailBody(type = \"text/plain\"): Media | null {\n return (\n this.getMediaByCategory([\"body\"])\n ?.filter((m) => m.contentType == type)\n .shift() ?? null\n );\n }\n\n /**\n * Get a media descriptor for an email history attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.\n * @param type Type of email history to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailHistory(type = \"text/plain\"): Media | null {\n return (\n this.getMediaByCategory([\"history\"])\n ?.filter((m) => m.contentType == type)\n .shift() ?? null\n );\n }\n\n _update(data) {\n const updateReasons: MessageUpdateReason[] = [];\n\n if (\n (data.text || typeof data.text === \"string\") &&\n data.text !== this.state.body\n ) {\n this.state.body = data.text;\n updateReasons.push(\"body\");\n }\n\n if (data.subject && data.subject !== this.state.subject) {\n this.state.subject = data.subject;\n updateReasons.push(\"subject\");\n }\n\n if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {\n this.state.lastUpdatedBy = data.lastUpdatedBy;\n updateReasons.push(\"lastUpdatedBy\");\n }\n\n if (data.author && data.author !== this.state.author) {\n this.state.author = data.author;\n updateReasons.push(\"author\");\n }\n\n if (\n data.dateUpdated &&\n new Date(data.dateUpdated).getTime() !==\n (this.state.dateUpdated && this.state.dateUpdated.getTime())\n ) {\n this.state.dateUpdated = new Date(data.dateUpdated);\n updateReasons.push(\"dateUpdated\");\n }\n\n if (\n data.timestamp &&\n new Date(data.timestamp).getTime() !==\n (this.state.timestamp && this.state.timestamp.getTime())\n ) {\n this.state.timestamp = new Date(data.timestamp);\n updateReasons.push(\"dateCreated\");\n }\n\n const updatedAttributes = parseAttributes(\n data.attributes,\n `Got malformed attributes for the message ${this.sid}`,\n log\n );\n if (!isEqual(this.state.attributes, updatedAttributes)) {\n this.state.attributes = updatedAttributes;\n updateReasons.push(\"attributes\");\n }\n\n const updatedAggregatedDelivery = data.delivery;\n const currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;\n const isUpdatedAggregateDeliveryValid =\n !!updatedAggregatedDelivery &&\n !!updatedAggregatedDelivery.total &&\n !!updatedAggregatedDelivery.delivered &&\n !!updatedAggregatedDelivery.failed &&\n !!updatedAggregatedDelivery.read &&\n !!updatedAggregatedDelivery.sent &&\n !!updatedAggregatedDelivery.undelivered;\n if (isUpdatedAggregateDeliveryValid) {\n if (!currentAggregatedDelivery) {\n this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(\n updatedAggregatedDelivery\n );\n updateReasons.push(\"deliveryReceipt\");\n } else if (\n !currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)\n ) {\n currentAggregatedDelivery._update(updatedAggregatedDelivery);\n updateReasons.push(\"deliveryReceipt\");\n }\n }\n\n if (updateReasons.length > 0) {\n this.emit(\"updated\", { message: this, updateReasons: updateReasons });\n }\n }\n\n /**\n * Get the participant who is the author of the message.\n */\n public async getParticipant(): Promise<Participant> {\n let participant: Participant | null = null;\n if (this.state.participantSid) {\n participant = await this.conversation\n .getParticipantBySid(this.participantSid)\n .catch(() => {\n log.debug(\n `Participant with sid \"${this.participantSid}\" not found for message ${this.sid}`\n );\n return null;\n });\n }\n if (!participant && this.state.author) {\n participant = await this.conversation\n .getParticipantByIdentity(this.state.author)\n .catch(() => {\n log.debug(\n `Participant with identity \"${this.author}\" not found for message ${this.sid}`\n );\n return null;\n });\n }\n if (participant) {\n return participant;\n }\n let errorMesage = \"Participant with \";\n if (this.state.participantSid) {\n errorMesage += \"SID '\" + this.state.participantSid + \"' \";\n }\n if (this.state.author) {\n if (this.state.participantSid) {\n errorMesage += \"or \";\n }\n errorMesage += \"identity '\" + this.state.author + \"' \";\n }\n if (errorMesage === \"Participant with \") {\n errorMesage = \"Participant \";\n }\n errorMesage += \"was not found\";\n throw new Error(errorMesage);\n }\n\n /**\n * Get the delivery receipts of the message.\n */\n public async getDetailedDeliveryReceipts(): Promise<\n DetailedDeliveryReceipt[]\n > {\n let paginator: Paginator<DetailedDeliveryReceipt> =\n await this._getDetailedDeliveryReceiptsPaginator();\n let detailedDeliveryReceipts: DetailedDeliveryReceipt[] = [];\n\n while (true) {\n detailedDeliveryReceipts = [\n ...detailedDeliveryReceipts,\n ...paginator.items,\n ];\n\n if (!paginator.hasNextPage) {\n break;\n }\n\n paginator = await paginator.nextPage();\n }\n\n return detailedDeliveryReceipts;\n }\n\n /**\n * Remove the message.\n */\n public async remove(): Promise<Message> {\n await this.services.commandExecutor.mutateResource(\n \"delete\",\n this.links.self\n );\n\n return this;\n }\n\n /**\n * Edit the message body.\n * @param body New body of the message.\n */\n @validateTypesAsync(\"string\")\n public async updateBody(body: string): Promise<Message> {\n await this.services.commandExecutor.mutateResource<\n EditMessageRequest,\n MessageResponse\n >(\"post\", this.links.self, {\n body,\n });\n\n return this;\n }\n\n /**\n * Edit the message attributes.\n * @param attributes New attributes.\n */\n @validateTypesAsync(attributesValidator)\n public async updateAttributes(attributes: JSONValue): Promise<Message> {\n await this.services.commandExecutor.mutateResource<\n EditMessageRequest,\n MessageResponse\n >(\"post\", this.links.self, {\n attributes:\n typeof attributes !== \"undefined\"\n ? JSON.stringify(attributes)\n : undefined,\n });\n\n return this;\n }\n\n /**\n * Get content URLs for all media attachments in the given set using single operation.\n * @param contentSet Set of media attachments to query for content URL.\n */\n @validateTypesAsync(\n custom((value) => [\n value instanceof Array &&\n value.length > 0 &&\n value.reduce((a, c) => a && c instanceof Media, true),\n \"a non-empty array of Media\",\n ])\n )\n public async attachTemporaryUrlsFor(\n contentSet: Media[] | null\n ): Promise<Media[]> {\n // We ignore existing mcsMedia members of each of the media entries.\n // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.\n const sids = contentSet?.map((m) => m.sid);\n if (this.services.mcsClient && sids) {\n return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => {\n return new Media(item, this.services);\n });\n } else {\n throw new Error(\"Media Content Service is unavailable\");\n }\n }\n\n private async _getDetailedDeliveryReceiptsPaginator(options?: {\n pageToken?: string;\n pageSize?: number;\n }): Promise<Paginator<DetailedDeliveryReceipt>> {\n const messagesReceiptsUrl = this.configuration.links.messagesReceipts\n .replace(\"%s\", this.conversation.sid)\n .replace(\"%s\", this.sid);\n const url = new UriBuilder(messagesReceiptsUrl)\n .arg(\"PageToken\", options?.pageToken as string)\n .arg(\"PageSize\", options?.pageSize as number)\n .build();\n const response = await this.services.network.get<\n { delivery_receipts: DeliveryReceiptResponse[] } & ResponseMeta\n >(url);\n\n return new RestPaginator<DetailedDeliveryReceipt>(\n response.body.delivery_receipts.map(\n (x) => new DetailedDeliveryReceipt(x)\n ),\n (pageToken, pageSize) =>\n this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }),\n response.body.meta.previous_token,\n response.body.meta.next_token\n );\n }\n}\n\nexport {\n Message,\n MessageServices,\n MessageType,\n MessageUpdateReason,\n MessageUpdatedEventArgs,\n};\n"],"names":["Logger","ReplayEventEmitter","index","parseAttributes","Media","AggregatedDeliveryReceipt","isEqual","UriBuilder","RestPaginator","DetailedDeliveryReceipt","__decorate","validateTypes","nonEmptyString","validateTypesAsync","attributesValidator","custom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAsEpC;;;AAGA,MAAM,OAAQ,SAAQC,qCAAiC;;;;IAerD,YACEC,OAAa,EACb,IAAiB,EACjB,YAA0B,EAC1B,KAAmB,EACnB,aAA4B,EAC5B,QAAyB;;QAEzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,EAAE,IAA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AMjD;AA6KDM;IADCG,2CAAkB,CAAC,QAAQ,CAAC;;;;yCAU5B;AAODH;IADCG,2CAAkB,CAACC,8BAAmB,CAAC;;;;+CAavC;AAcDJ;IARCG,2CAAkB,CACjBE,+BAAM,CAAC,CAAC,KAAK,KAAK;QAChB,KAAK,YAAY,KAAK;YACpB,KAAK,CAAC,MAAM,GAAG,CAAC;YAChB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,YAAYX,WAAK,EAAE,IAAI,CAAC;QACvD,4BAA4B;KAC7B,CAAC,CACH;;;;qDAcA;;;;"}
@@ -130,7 +130,7 @@ This software includes platform.js under the following license.
130
130
 
131
131
  Object.defineProperty(exports, '__esModule', { value: true });
132
132
 
133
- var version = "2.1.0-rc.1";
133
+ var version = "2.1.0-rc.5";
134
134
 
135
135
  exports.version = version;
136
136
  //# sourceMappingURL=package.json.js.map