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

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 (44) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/builds/browser.js +9 -7
  3. package/builds/browser.js.map +1 -1
  4. package/builds/lib.d.ts +36 -6
  5. package/builds/lib.js +9 -7
  6. package/builds/lib.js.map +1 -1
  7. package/builds/twilio-conversations.js +81 -64
  8. package/builds/twilio-conversations.min.js +2 -2
  9. package/dist/configuration.js.map +1 -1
  10. package/dist/conversation.js +3 -0
  11. package/dist/conversation.js.map +1 -1
  12. package/dist/message-builder.js.map +1 -1
  13. package/dist/message.js +4 -5
  14. package/dist/message.js.map +1 -1
  15. package/dist/packages/conversations/package.json.js +1 -1
  16. package/docs/assets/js/search.js +1 -1
  17. package/docs/classes/AggregatedDeliveryReceipt.html +0 -117
  18. package/docs/classes/Client.html +0 -117
  19. package/docs/classes/Conversation.html +35 -129
  20. package/docs/classes/DetailedDeliveryReceipt.html +0 -117
  21. package/docs/classes/Media.html +0 -117
  22. package/docs/classes/Message.html +4 -121
  23. package/docs/classes/MessageBuilder.html +2 -119
  24. package/docs/classes/Participant.html +4 -121
  25. package/docs/classes/PushNotification.html +0 -117
  26. package/docs/classes/RestPaginator.html +0 -117
  27. package/docs/classes/UnsentMessage.html +0 -117
  28. package/docs/classes/User.html +4 -121
  29. package/docs/index.html +60 -0
  30. package/docs/interfaces/ClientOptions.html +0 -117
  31. package/docs/interfaces/ConversationBindings.html +0 -117
  32. package/docs/interfaces/ConversationEmailBinding.html +0 -117
  33. package/docs/interfaces/ConversationLimits.html +3098 -0
  34. package/docs/interfaces/ConversationState.html +0 -117
  35. package/docs/interfaces/CreateConversationOptions.html +1 -118
  36. package/docs/interfaces/LastMessage.html +0 -117
  37. package/docs/interfaces/Paginator.html +0 -117
  38. package/docs/interfaces/ParticipantBindings.html +0 -117
  39. package/docs/interfaces/ParticipantEmailBinding.html +0 -117
  40. package/docs/interfaces/PushNotificationData.html +0 -117
  41. package/docs/interfaces/SendEmailOptions.html +0 -117
  42. package/docs/interfaces/SendMediaOptions.html +0 -117
  43. package/docs/modules.html +60 -0
  44. package/package.json +2 -2
@@ -22949,7 +22949,7 @@ this.Twilio.Conversations = (function (exports) {
22949
22949
  }).length;
22950
22950
  log$1$1.debug("Attempting '".concat(action, "' request (c:").concat(correlationId, "):"), requests);
22951
22951
  var requestBody = {
22952
- event_protocol_version: 3,
22952
+ event_protocol_version: 4,
22953
22953
  action: action,
22954
22954
  correlation_id: correlationId,
22955
22955
  retried_requests: retriedRequests,
@@ -23026,71 +23026,86 @@ this.Twilio.Conversations = (function (exports) {
23026
23026
  key: "acceptMessage",
23027
23027
  value: function acceptMessage(message, isStrictlyOrdered) {
23028
23028
  log$1$1.trace('Subscriptions received', message);
23029
+ var eventType = message.event_type;
23030
+ var events = typeof message.events !== 'undefined' ? message.events : [message.event];
23031
+ var correlationId = message.correlation_id;
23029
23032
 
23030
- if (message.correlation_id) {
23031
- this.latestPokeResponseArrivalTimestampByCorrelationId.set(message.correlation_id, new Date().getTime());
23033
+ if (correlationId) {
23034
+ this.latestPokeResponseArrivalTimestampByCorrelationId.set(correlationId, new Date().getTime());
23032
23035
  }
23033
23036
 
23034
- var event_type;
23037
+ var _iterator4 = _createForOfIteratorHelper$3(events),
23038
+ _step4;
23035
23039
 
23036
- switch (message.event_type) {
23037
- case 'subscription_established':
23038
- this.applySubscriptionEstablishedMessage(message.event, message.correlation_id);
23039
- break;
23040
+ try {
23041
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
23042
+ var event = _step4.value;
23043
+ var matchedEventType = void 0;
23040
23044
 
23041
- case 'subscription_canceled':
23042
- this.applySubscriptionCancelledMessage(message.event, message.correlation_id);
23043
- break;
23045
+ switch (message.event_type) {
23046
+ case 'subscription_established':
23047
+ this.applySubscriptionEstablishedMessage(event, correlationId);
23048
+ break;
23044
23049
 
23045
- case 'subscription_failed':
23046
- this.applySubscriptionFailedMessage(message.event, message.correlation_id);
23047
- break;
23050
+ case 'subscription_canceled':
23051
+ this.applySubscriptionCancelledMessage(event, correlationId);
23052
+ break;
23048
23053
 
23049
- case (event_type = message.event_type.match(/^(?:map|list|document|stream|live_query)_/) || {}).input:
23050
- {
23051
- var typedSid;
23054
+ case 'subscription_failed':
23055
+ this.applySubscriptionFailedMessage(event, correlationId);
23056
+ break;
23052
23057
 
23053
- switch (event_type[0]) {
23054
- case 'map_':
23055
- typedSid = message.event.map_sid;
23056
- break;
23058
+ case (matchedEventType = eventType.match(/^(?:map|list|document|stream|live_query)_/) || {}).input:
23059
+ {
23060
+ var typedSid = void 0;
23057
23061
 
23058
- case 'list_':
23059
- typedSid = message.event.list_sid;
23060
- break;
23062
+ switch (matchedEventType[0]) {
23063
+ case 'map_':
23064
+ typedSid = event.map_sid;
23065
+ break;
23061
23066
 
23062
- case 'document_':
23063
- typedSid = message.event.document_sid;
23064
- break;
23067
+ case 'list_':
23068
+ typedSid = event.list_sid;
23069
+ break;
23065
23070
 
23066
- case 'stream_':
23067
- typedSid = message.event.stream_sid;
23068
- break;
23071
+ case 'document_':
23072
+ typedSid = event.document_sid;
23073
+ break;
23074
+
23075
+ case 'stream_':
23076
+ typedSid = event.stream_sid;
23077
+ break;
23078
+
23079
+ case 'live_query_':
23080
+ typedSid = event.query_id; // hack to mark replay events for LiveQuery as strictly ordered, due to lack of special type of notification for them
23081
+ // (normally only replay events would have `twilio.sync.event` type, but LiveQuery non-replay events were also assigned
23082
+ // to this type in legacy clients, which we have to support now; hence a hack)
23083
+
23084
+ isStrictlyOrdered = false; // explicitly override it due to code in router.ts does not know about LiveQueries
23069
23085
 
23070
- case 'live_query_':
23071
- typedSid = message.event.query_id; // hack to mark replay events for LiveQuery as strictly ordered, due to lack of special type of notification for them
23072
- // (normally only replay events would have `twilio.sync.event` type, but LiveQuery non-replay events were also assigned
23073
- // to this type in legacy clients, which we have to support now; hence a hack)
23086
+ if (message.strictly_ordered === true) {
23087
+ isStrictlyOrdered = true;
23088
+ }
23074
23089
 
23075
- isStrictlyOrdered = false; // explicitly override it due to code in router.ts does not know about LiveQueries
23090
+ break;
23076
23091
 
23077
- if (message.strictly_ordered === true) {
23078
- isStrictlyOrdered = true;
23092
+ default:
23093
+ typedSid = undefined;
23079
23094
  }
23080
23095
 
23096
+ this.applyEventToSubscribedEntity(typedSid, event, eventType, isStrictlyOrdered);
23081
23097
  break;
23098
+ }
23082
23099
 
23083
- default:
23084
- typedSid = undefined;
23085
- }
23086
-
23087
- this.applyEventToSubscribedEntity(typedSid, message, isStrictlyOrdered);
23100
+ default:
23101
+ log$1$1.debug("Dropping unknown message type ".concat(eventType));
23102
+ break;
23088
23103
  }
23089
- break;
23090
-
23091
- default:
23092
- log$1$1.debug("Dropping unknown message type ".concat(message.event_type));
23093
- break;
23104
+ }
23105
+ } catch (err) {
23106
+ _iterator4.e(err);
23107
+ } finally {
23108
+ _iterator4.f();
23094
23109
  }
23095
23110
  }
23096
23111
  }, {
@@ -23155,7 +23170,7 @@ this.Twilio.Conversations = (function (exports) {
23155
23170
  }
23156
23171
  }, {
23157
23172
  key: "applyEventToSubscribedEntity",
23158
- value: function applyEventToSubscribedEntity(sid, message, isStrictlyOrdered) {
23173
+ value: function applyEventToSubscribedEntity(sid, event, eventType, isStrictlyOrdered) {
23159
23174
  var _this4 = this;
23160
23175
 
23161
23176
  if (!sid) {
@@ -23173,8 +23188,8 @@ this.Twilio.Conversations = (function (exports) {
23173
23188
  var subscriptionIntent = this.subscriptions.get(sid);
23174
23189
 
23175
23190
  if (subscriptionIntent) {
23176
- message.event.type = message.event_type;
23177
- subscriptionIntent.update(message.event, isStrictlyOrdered);
23191
+ event.type = eventType;
23192
+ subscriptionIntent.update(event, isStrictlyOrdered);
23178
23193
  } else {
23179
23194
  log$1$1.debug("Message dropped for SID '".concat(sid, "', for which there is no subscription."));
23180
23195
  }
@@ -23216,12 +23231,12 @@ this.Twilio.Conversations = (function (exports) {
23216
23231
 
23217
23232
  var failedSubscriptions = [];
23218
23233
 
23219
- var _iterator4 = _createForOfIteratorHelper$3(this.persisted.values()),
23220
- _step4;
23234
+ var _iterator5 = _createForOfIteratorHelper$3(this.persisted.values()),
23235
+ _step5;
23221
23236
 
23222
23237
  try {
23223
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
23224
- var _it = _step4.value;
23238
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
23239
+ var _it = _step5.value;
23225
23240
 
23226
23241
  _it.reset();
23227
23242
 
@@ -23230,9 +23245,9 @@ this.Twilio.Conversations = (function (exports) {
23230
23245
  }
23231
23246
  }
23232
23247
  } catch (err) {
23233
- _iterator4.e(err);
23248
+ _iterator5.e(err);
23234
23249
  } finally {
23235
- _iterator4.f();
23250
+ _iterator5.f();
23236
23251
  }
23237
23252
 
23238
23253
  this.persisted.clear();
@@ -30415,7 +30430,7 @@ this.Twilio.Conversations = (function (exports) {
30415
30430
 
30416
30431
  __decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], InstantQuery.prototype, "updateIndexName", null);
30417
30432
 
30418
- var version$1 = "3.0.7-rc.0";
30433
+ var version$1 = "3.1.0-rc.0";
30419
30434
 
30420
30435
  function _createSuper$9(Derived) {
30421
30436
  var hasNativeReflectConstruct = _isNativeReflectConstruct$a();
@@ -36183,9 +36198,7 @@ this.Twilio.Conversations = (function (exports) {
36183
36198
  }, {
36184
36199
  key: "participantSid",
36185
36200
  get: function get() {
36186
- var _this$state$participa;
36187
-
36188
- return (_this$state$participa = this.state.participantSid) !== null && _this$state$participa !== void 0 ? _this$state$participa : "";
36201
+ return this.state.participantSid;
36189
36202
  }
36190
36203
  /**
36191
36204
  * Aggregated information about the message delivery statuses across all participants of a conversation..
@@ -36331,7 +36344,7 @@ this.Twilio.Conversations = (function (exports) {
36331
36344
  }
36332
36345
 
36333
36346
  _context.next = 4;
36334
- return this.conversation.getParticipantBySid(this.participantSid).catch(function () {
36347
+ return this.conversation.getParticipantBySid(this.state.participantSid).catch(function () {
36335
36348
  log$5.debug("Participant with sid \"".concat(_this2.participantSid, "\" not found for message ").concat(_this2.sid));
36336
36349
  return null;
36337
36350
  });
@@ -36657,9 +36670,9 @@ this.Twilio.Conversations = (function (exports) {
36657
36670
 
36658
36671
  _defineProperty$3(Message, "updated", "updated");
36659
36672
 
36660
- __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailBody", null);
36673
+ __decorate$1([validateTypes_1([nonEmptyString_1, "undefined"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailBody", null);
36661
36674
 
36662
- __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailHistory", null);
36675
+ __decorate$1([validateTypes_1([nonEmptyString_1, "undefined"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailHistory", null);
36663
36676
 
36664
36677
  __decorate$1([validateTypesAsync_1("string"), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateBody", null);
36665
36678
 
@@ -37709,6 +37722,10 @@ this.Twilio.Conversations = (function (exports) {
37709
37722
  get: function get() {
37710
37723
  return this.channelState.bindings;
37711
37724
  }
37725
+ /**
37726
+ * Current conversation limits.
37727
+ */
37728
+
37712
37729
  }, {
37713
37730
  key: "limits",
37714
37731
  get: function get() {
@@ -40416,7 +40433,7 @@ this.Twilio.Conversations = (function (exports) {
40416
40433
  this.data = data.data || {};
40417
40434
  };
40418
40435
 
40419
- var version = "2.1.0-rc.5";
40436
+ var version = "2.1.0-rc.9";
40420
40437
 
40421
40438
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
40422
40439