@twilio/conversations 2.4.1 → 2.5.0-rc.8

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/builds/lib.js CHANGED
@@ -293,11 +293,13 @@ var Logger = /*#__PURE__*/function () {
293
293
  }, {
294
294
  key: "trace",
295
295
  value: function trace() {
296
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
297
- args[_key] = arguments[_key];
298
- }
296
+ if (log$7.getLevel() == log$7.levels.TRACE) {
297
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
298
+ args[_key] = arguments[_key];
299
+ }
299
300
 
300
- log$7.trace.apply(null, prepareLine(this.prefix + "T", args));
301
+ log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
302
+ }
301
303
  }
302
304
  }, {
303
305
  key: "debug",
@@ -348,11 +350,13 @@ var Logger = /*#__PURE__*/function () {
348
350
  }, {
349
351
  key: "trace",
350
352
  value: function trace() {
351
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
352
- args[_key6] = arguments[_key6];
353
- }
353
+ if (log$7.getLevel() == log$7.levels.TRACE) {
354
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
355
+ args[_key6] = arguments[_key6];
356
+ }
354
357
 
355
- log$7.trace.apply(null, prepareLine("T", args));
358
+ log$7.debug.apply(null, prepareLine("T", args));
359
+ }
356
360
  }
357
361
  }, {
358
362
  key: "debug",
@@ -406,9 +410,11 @@ var MINIMUM_RETRY_DELAY = 1000;
406
410
  var MAXIMUM_RETRY_DELAY = 4000;
407
411
  var MAXIMUM_ATTEMPTS_COUNT = 3;
408
412
  var RETRY_WHEN_THROTTLED = true;
413
+ var CHANNEL_METADATA_CACHE_CAPACITY = 100;
414
+ var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
409
415
 
410
416
  var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
411
- var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
417
+ var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
412
418
 
413
419
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
414
420
  var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
@@ -467,7 +473,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
467
473
  this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
468
474
  }
469
475
 
470
- this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : 100;
476
+ this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
477
+ this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
471
478
  });
472
479
 
473
480
  /**
@@ -1085,11 +1092,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
1085
1092
 
1086
1093
  __decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
1087
1094
 
1088
- function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1095
+ function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1089
1096
 
1090
- function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
1097
+ function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
1091
1098
 
1092
- function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1099
+ function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1093
1100
 
1094
1101
  var Network = /*#__PURE__*/function () {
1095
1102
  function Network(configuration, services) {
@@ -1110,7 +1117,7 @@ var Network = /*#__PURE__*/function () {
1110
1117
  }, {
1111
1118
  key: "cleanupCache",
1112
1119
  value: function cleanupCache() {
1113
- var _iterator = _createForOfIteratorHelper$4(this.cache),
1120
+ var _iterator = _createForOfIteratorHelper$5(this.cache),
1114
1121
  _step;
1115
1122
 
1116
1123
  try {
@@ -2450,14 +2457,15 @@ var RestPaginator = /*#__PURE__*/function () {
2450
2457
  /**
2451
2458
  * @internal
2452
2459
  */
2453
- function RestPaginator(items, source, prevToken, nextToken) {
2460
+ function RestPaginator(items, source, prevToken, nextToken, pageSize) {
2454
2461
  _classCallCheck__default["default"](this, RestPaginator);
2455
2462
 
2456
2463
  this.state = {
2457
2464
  prevToken: prevToken,
2458
2465
  nextToken: nextToken,
2459
2466
  source: source,
2460
- items: items
2467
+ items: items,
2468
+ pageSize: pageSize
2461
2469
  };
2462
2470
  }
2463
2471
  /**
@@ -2495,7 +2503,7 @@ var RestPaginator = /*#__PURE__*/function () {
2495
2503
  }, {
2496
2504
  key: "nextPage",
2497
2505
  value: function nextPage() {
2498
- return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
2506
+ return this.hasNextPage ? this.state.source(this.state.nextToken, this.state.pageSize) : Promise.reject(new Error("No next page"));
2499
2507
  }
2500
2508
  /**
2501
2509
  * Request the previous page. Does not modify the existing object.
@@ -2504,7 +2512,7 @@ var RestPaginator = /*#__PURE__*/function () {
2504
2512
  }, {
2505
2513
  key: "prevPage",
2506
2514
  value: function prevPage() {
2507
- return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
2515
+ return this.hasPrevPage ? this.state.source(this.state.prevToken, this.state.pageSize) : Promise.reject(new Error("No previous page"));
2508
2516
  }
2509
2517
  }]);
2510
2518
 
@@ -3596,7 +3604,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3596
3604
  pageToken: pageToken,
3597
3605
  pageSize: pageSize
3598
3606
  });
3599
- }, response.body.meta.previous_token, response.body.meta.next_token));
3607
+ }, response.body.meta.previous_token, response.body.meta.next_token, options === null || options === void 0 ? void 0 : options.pageSize));
3600
3608
 
3601
3609
  case 6:
3602
3610
  case "end":
@@ -3794,6 +3802,38 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3794
3802
 
3795
3803
  return getChannelMetadata;
3796
3804
  }()
3805
+ /**
3806
+ * Get recipients of the message.
3807
+ */
3808
+
3809
+ }, {
3810
+ key: "getMessageRecipients",
3811
+ value: function () {
3812
+ var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
3813
+ return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
3814
+ while (1) {
3815
+ switch (_context11.prev = _context11.next) {
3816
+ case 0:
3817
+ _context11.next = 2;
3818
+ return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
3819
+
3820
+ case 2:
3821
+ return _context11.abrupt("return", _context11.sent);
3822
+
3823
+ case 3:
3824
+ case "end":
3825
+ return _context11.stop();
3826
+ }
3827
+ }
3828
+ }, _callee11, this);
3829
+ }));
3830
+
3831
+ function getMessageRecipients() {
3832
+ return _getMessageRecipients.apply(this, arguments);
3833
+ }
3834
+
3835
+ return getMessageRecipients;
3836
+ }()
3797
3837
  }]);
3798
3838
 
3799
3839
  return Message;
@@ -3843,11 +3883,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
3843
3883
 
3844
3884
  function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3845
3885
 
3846
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3886
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3847
3887
 
3848
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
3888
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
3849
3889
 
3850
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3890
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3851
3891
 
3852
3892
  function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
3853
3893
 
@@ -4055,7 +4095,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
4055
4095
  return request.cancel();
4056
4096
  });
4057
4097
  });
4058
- _iterator = _createForOfIteratorHelper$3(message.mediaContent);
4098
+ _iterator = _createForOfIteratorHelper$4(message.mediaContent);
4059
4099
  _context3.prev = 4;
4060
4100
 
4061
4101
  _iterator.s();
@@ -4708,11 +4748,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
4708
4748
 
4709
4749
  __decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
4710
4750
 
4711
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4751
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4712
4752
 
4713
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
4753
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
4714
4754
 
4715
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4755
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4716
4756
 
4717
4757
  function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
4718
4758
 
@@ -5998,41 +6038,74 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
5998
6038
 
5999
6039
  return updateUniqueName;
6000
6040
  }()
6041
+ /**
6042
+ * Get recipients of all messages in the conversation.
6043
+ * @param options Optional configuration, set pageSize to request a specific pagination page size. Page size specifies a number of messages to include in a single batch. Each message may include multiple recipients.
6044
+ */
6045
+
6046
+ }, {
6047
+ key: "getMessageRecipients",
6048
+ value: function () {
6049
+ var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
6050
+ return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
6051
+ while (1) {
6052
+ switch (_context24.prev = _context24.next) {
6053
+ case 0:
6054
+ _context24.next = 2;
6055
+ return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
6056
+
6057
+ case 2:
6058
+ return _context24.abrupt("return", _context24.sent);
6059
+
6060
+ case 3:
6061
+ case "end":
6062
+ return _context24.stop();
6063
+ }
6064
+ }
6065
+ }, _callee24, this);
6066
+ }));
6067
+
6068
+ function getMessageRecipients(_x19) {
6069
+ return _getMessageRecipients.apply(this, arguments);
6070
+ }
6071
+
6072
+ return getMessageRecipients;
6073
+ }()
6001
6074
  /**
6002
6075
  * Load and subscribe to this conversation and do not subscribe to its
6003
6076
  * participants and messages. This or _subscribeStreams will need to be called
6004
- * before any events on conversation will fire.
6077
+ * before any events in the conversation will fire.
6005
6078
  * @internal
6006
6079
  */
6007
6080
 
6008
6081
  }, {
6009
6082
  key: "_subscribe",
6010
6083
  value: function () {
6011
- var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
6084
+ var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
6012
6085
  var _this2 = this;
6013
6086
 
6014
- return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
6087
+ return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
6015
6088
  while (1) {
6016
- switch (_context24.prev = _context24.next) {
6089
+ switch (_context25.prev = _context25.next) {
6017
6090
  case 0:
6018
6091
  if (!this._entityPromise) {
6019
- _context24.next = 2;
6092
+ _context25.next = 2;
6020
6093
  break;
6021
6094
  }
6022
6095
 
6023
- return _context24.abrupt("return", this._entityPromise);
6096
+ return _context25.abrupt("return", this._entityPromise);
6024
6097
 
6025
6098
  case 2:
6026
6099
  this._entityPromise = this._services.syncClient.document({
6027
6100
  id: this._entityName,
6028
6101
  mode: "open_existing"
6029
6102
  });
6030
- _context24.prev = 3;
6031
- _context24.next = 6;
6103
+ _context25.prev = 3;
6104
+ _context25.next = 6;
6032
6105
  return this._entityPromise;
6033
6106
 
6034
6107
  case 6:
6035
- this._entity = _context24.sent;
6108
+ this._entity = _context25.sent;
6036
6109
 
6037
6110
  this._entity.on("updated", function (args) {
6038
6111
  return _this2._update(args.data);
@@ -6044,28 +6117,28 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6044
6117
 
6045
6118
  this._update(this._entity.data);
6046
6119
 
6047
- return _context24.abrupt("return", this._entity);
6120
+ return _context25.abrupt("return", this._entity);
6048
6121
 
6049
6122
  case 13:
6050
- _context24.prev = 13;
6051
- _context24.t0 = _context24["catch"](3);
6123
+ _context25.prev = 13;
6124
+ _context25.t0 = _context25["catch"](3);
6052
6125
  this._entity = null;
6053
6126
  this._entityPromise = null;
6054
6127
 
6055
6128
  if (this._services.syncClient.connectionState != "disconnected") {
6056
- Conversation._logger.error("Failed to get conversation object", _context24.t0);
6129
+ Conversation._logger.error("Failed to get conversation object", _context25.t0);
6057
6130
  }
6058
6131
 
6059
- Conversation._logger.debug("ERROR: Failed to get conversation object", _context24.t0);
6132
+ Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
6060
6133
 
6061
- throw _context24.t0;
6134
+ throw _context25.t0;
6062
6135
 
6063
6136
  case 20:
6064
6137
  case "end":
6065
- return _context24.stop();
6138
+ return _context25.stop();
6066
6139
  }
6067
6140
  }
6068
- }, _callee24, this, [[3, 13]]);
6141
+ }, _callee25, this, [[3, 13]]);
6069
6142
  }));
6070
6143
 
6071
6144
  function _subscribe() {
@@ -6087,44 +6160,44 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6087
6160
  }, {
6088
6161
  key: "_fetchStreams",
6089
6162
  value: function () {
6090
- var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
6163
+ var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
6091
6164
  var _this$_entity, _this$_entity2;
6092
6165
 
6093
6166
  var data;
6094
- return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
6167
+ return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
6095
6168
  while (1) {
6096
- switch (_context25.prev = _context25.next) {
6169
+ switch (_context26.prev = _context26.next) {
6097
6170
  case 0:
6098
- _context25.next = 2;
6171
+ _context26.next = 2;
6099
6172
  return this._subscribe();
6100
6173
 
6101
6174
  case 2:
6102
6175
  Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
6103
6176
 
6104
6177
  data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
6105
- _context25.next = 6;
6178
+ _context26.next = 6;
6106
6179
  return this._services.syncClient.list({
6107
6180
  id: data.messages,
6108
6181
  mode: "open_existing"
6109
6182
  });
6110
6183
 
6111
6184
  case 6:
6112
- this._messagesList = _context25.sent;
6113
- _context25.next = 9;
6185
+ this._messagesList = _context26.sent;
6186
+ _context26.next = 9;
6114
6187
  return this._services.syncClient.map({
6115
6188
  id: data.roster,
6116
6189
  mode: "open_existing"
6117
6190
  });
6118
6191
 
6119
6192
  case 9:
6120
- this._participantsMap = _context25.sent;
6193
+ this._participantsMap = _context26.sent;
6121
6194
 
6122
6195
  case 10:
6123
6196
  case "end":
6124
- return _context25.stop();
6197
+ return _context26.stop();
6125
6198
  }
6126
6199
  }
6127
- }, _callee25, this);
6200
+ }, _callee26, this);
6128
6201
  }));
6129
6202
 
6130
6203
  function _fetchStreams() {
@@ -6144,15 +6217,15 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6144
6217
  }, {
6145
6218
  key: "_subscribeStreams",
6146
6219
  value: function () {
6147
- var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
6220
+ var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
6148
6221
  var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
6149
6222
 
6150
- return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
6223
+ return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
6151
6224
  while (1) {
6152
- switch (_context26.prev = _context26.next) {
6225
+ switch (_context27.prev = _context27.next) {
6153
6226
  case 0:
6154
- _context26.prev = 0;
6155
- _context26.next = 3;
6227
+ _context27.prev = 0;
6228
+ _context27.next = 3;
6156
6229
  return this._subscribe();
6157
6230
 
6158
6231
  case 3:
@@ -6161,31 +6234,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6161
6234
  data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
6162
6235
  messagesObjectName = data.messages;
6163
6236
  rosterObjectName = data.roster;
6164
- _context26.next = 9;
6237
+ _context27.next = 9;
6165
6238
  return Promise.all([this._messagesEntity.subscribe((_this$_messagesList = this._messagesList) !== null && _this$_messagesList !== void 0 ? _this$_messagesList : messagesObjectName), this._participantsEntity.subscribe((_this$_participantsMa = this._participantsMap) !== null && _this$_participantsMa !== void 0 ? _this$_participantsMa : rosterObjectName)]);
6166
6239
 
6167
6240
  case 9:
6168
- _context26.next = 16;
6241
+ _context27.next = 16;
6169
6242
  break;
6170
6243
 
6171
6244
  case 11:
6172
- _context26.prev = 11;
6173
- _context26.t0 = _context26["catch"](0);
6245
+ _context27.prev = 11;
6246
+ _context27.t0 = _context27["catch"](0);
6174
6247
 
6175
6248
  if (this._services.syncClient.connectionState !== "disconnected") {
6176
- Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context26.t0);
6249
+ Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
6177
6250
  }
6178
6251
 
6179
- Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context26.t0);
6252
+ Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
6180
6253
 
6181
- throw _context26.t0;
6254
+ throw _context27.t0;
6182
6255
 
6183
6256
  case 16:
6184
6257
  case "end":
6185
- return _context26.stop();
6258
+ return _context27.stop();
6186
6259
  }
6187
6260
  }
6188
- }, _callee26, this, [[0, 11]]);
6261
+ }, _callee27, this, [[0, 11]]);
6189
6262
  }));
6190
6263
 
6191
6264
  function _subscribeStreams() {
@@ -6202,17 +6275,17 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6202
6275
  }, {
6203
6276
  key: "_unsubscribe",
6204
6277
  value: function () {
6205
- var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
6206
- return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
6278
+ var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
6279
+ return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
6207
6280
  while (1) {
6208
- switch (_context27.prev = _context27.next) {
6281
+ switch (_context28.prev = _context28.next) {
6209
6282
  case 0:
6210
6283
  if (!this._entity) {
6211
- _context27.next = 5;
6284
+ _context28.next = 5;
6212
6285
  break;
6213
6286
  }
6214
6287
 
6215
- _context27.next = 3;
6288
+ _context28.next = 3;
6216
6289
  return this._entity.close();
6217
6290
 
6218
6291
  case 3:
@@ -6220,14 +6293,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6220
6293
  this._entityPromise = null;
6221
6294
 
6222
6295
  case 5:
6223
- return _context27.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6296
+ return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6224
6297
 
6225
6298
  case 6:
6226
6299
  case "end":
6227
- return _context27.stop();
6300
+ return _context28.stop();
6228
6301
  }
6229
6302
  }
6230
- }, _callee27, this);
6303
+ }, _callee28, this);
6231
6304
  }));
6232
6305
 
6233
6306
  function _unsubscribe() {
@@ -6404,7 +6477,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6404
6477
  }, {
6405
6478
  key: "_onMessageAdded",
6406
6479
  value: function _onMessageAdded(message) {
6407
- var _iterator = _createForOfIteratorHelper$2(this._participants.values()),
6480
+ var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
6408
6481
  _step;
6409
6482
 
6410
6483
  try {
@@ -6433,30 +6506,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6433
6506
  }, {
6434
6507
  key: "_setLastReadMessageIndex",
6435
6508
  value: function () {
6436
- var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28(index) {
6509
+ var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29(index) {
6437
6510
  var result;
6438
- return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
6511
+ return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
6439
6512
  while (1) {
6440
- switch (_context28.prev = _context28.next) {
6513
+ switch (_context29.prev = _context29.next) {
6441
6514
  case 0:
6442
- _context28.next = 2;
6515
+ _context29.next = 2;
6443
6516
  return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
6444
6517
  last_read_message_index: index
6445
6518
  });
6446
6519
 
6447
6520
  case 2:
6448
- result = _context28.sent;
6449
- return _context28.abrupt("return", result.unread_messages_count);
6521
+ result = _context29.sent;
6522
+ return _context29.abrupt("return", result.unread_messages_count);
6450
6523
 
6451
6524
  case 4:
6452
6525
  case "end":
6453
- return _context28.stop();
6526
+ return _context29.stop();
6454
6527
  }
6455
6528
  }
6456
- }, _callee28, this);
6529
+ }, _callee29, this);
6457
6530
  }));
6458
6531
 
6459
- function _setLastReadMessageIndex(_x19) {
6532
+ function _setLastReadMessageIndex(_x20) {
6460
6533
  return _setLastReadMessageIndex2.apply(this, arguments);
6461
6534
  }
6462
6535
 
@@ -6536,7 +6609,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
6536
6609
 
6537
6610
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
6538
6611
 
6539
- __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6612
+ __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6540
6613
 
6541
6614
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
6542
6615
 
@@ -6612,11 +6685,11 @@ var Deferred = /*#__PURE__*/function () {
6612
6685
  return Deferred;
6613
6686
  }();
6614
6687
 
6615
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6688
+ function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6616
6689
 
6617
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
6690
+ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
6618
6691
 
6619
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6692
+ function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6620
6693
 
6621
6694
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6622
6695
 
@@ -6796,7 +6869,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6796
6869
  case 9:
6797
6870
  myConversations = _context2.sent;
6798
6871
  upserts = [];
6799
- _iterator = _createForOfIteratorHelper$1(myConversations);
6872
+ _iterator = _createForOfIteratorHelper$2(myConversations);
6800
6873
 
6801
6874
  try {
6802
6875
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -7878,7 +7951,7 @@ function PushNotification(data) {
7878
7951
  this.data = data.data || {};
7879
7952
  });
7880
7953
 
7881
- var version = "2.4.1";
7954
+ var version = "2.5.0-rc.8";
7882
7955
 
7883
7956
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7884
7957
 
@@ -8279,11 +8352,11 @@ var ContentClient = /*#__PURE__*/function () {
8279
8352
  return ContentClient;
8280
8353
  }();
8281
8354
 
8282
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8355
+ function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8283
8356
 
8284
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8357
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
8285
8358
 
8286
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8359
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8287
8360
 
8288
8361
  var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8289
8362
  function QuickLRU() {
@@ -8312,7 +8385,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8312
8385
  this._size = 0;
8313
8386
 
8314
8387
  if (typeof this.onEviction === 'function') {
8315
- var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
8388
+ var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
8316
8389
  _step;
8317
8390
 
8318
8391
  try {
@@ -8404,7 +8477,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8404
8477
  while (1) {
8405
8478
  switch (_context.prev = _context.next) {
8406
8479
  case 0:
8407
- _iterator2 = _createForOfIteratorHelper(this);
8480
+ _iterator2 = _createForOfIteratorHelper$1(this);
8408
8481
  _context.prev = 1;
8409
8482
 
8410
8483
  _iterator2.s();
@@ -8456,7 +8529,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8456
8529
  while (1) {
8457
8530
  switch (_context2.prev = _context2.next) {
8458
8531
  case 0:
8459
- _iterator3 = _createForOfIteratorHelper(this);
8532
+ _iterator3 = _createForOfIteratorHelper$1(this);
8460
8533
  _context2.prev = 1;
8461
8534
 
8462
8535
  _iterator3.s();
@@ -8508,7 +8581,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8508
8581
  while (1) {
8509
8582
  switch (_context3.prev = _context3.next) {
8510
8583
  case 0:
8511
- _iterator4 = _createForOfIteratorHelper(this.cache);
8584
+ _iterator4 = _createForOfIteratorHelper$1(this.cache);
8512
8585
  _context3.prev = 1;
8513
8586
 
8514
8587
  _iterator4.s();
@@ -8545,7 +8618,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8545
8618
  return _context3.finish(14);
8546
8619
 
8547
8620
  case 17:
8548
- _iterator5 = _createForOfIteratorHelper(this.oldCache);
8621
+ _iterator5 = _createForOfIteratorHelper$1(this.oldCache);
8549
8622
  _context3.prev = 18;
8550
8623
 
8551
8624
  _iterator5.s();
@@ -8600,7 +8673,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8600
8673
  get: function get() {
8601
8674
  var oldCacheSize = 0;
8602
8675
 
8603
- var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
8676
+ var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
8604
8677
  _step6;
8605
8678
 
8606
8679
  try {
@@ -8737,6 +8810,206 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
8737
8810
  return ChannelMetadataClient;
8738
8811
  }();
8739
8812
 
8813
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8814
+
8815
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8816
+
8817
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8818
+ /**
8819
+ * Email recipient descriptor.
8820
+ */
8821
+
8822
+ var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
8823
+ /**
8824
+ * Type of recipient.
8825
+ */
8826
+
8827
+ /**
8828
+ * @internal
8829
+ */
8830
+ function EmailRecipientDescriptor(recipient) {
8831
+ _classCallCheck__default["default"](this, EmailRecipientDescriptor);
8832
+
8833
+ _defineProperty__default["default"](this, "type", "email");
8834
+
8835
+ this.messageSid = recipient.message_sid;
8836
+ this.level = recipient.level;
8837
+ this.name = recipient.name;
8838
+ this.address = recipient.address;
8839
+ });
8840
+ /**
8841
+ * Unknown recipient descriptor. Used to be able to handle recipient types that
8842
+ * are not supported by the current version of the SDK.
8843
+ */
8844
+
8845
+
8846
+ var UnknownRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
8847
+ /**
8848
+ * Type of recipient.
8849
+ */
8850
+
8851
+ /**
8852
+ * Sid of the message that this recipient belongs to.
8853
+ */
8854
+
8855
+ /**
8856
+ * Recipient data as a JSON string.
8857
+ */
8858
+
8859
+ /**
8860
+ * @internal
8861
+ */
8862
+ function UnknownRecipientDescriptor(recipient) {
8863
+ _classCallCheck__default["default"](this, UnknownRecipientDescriptor);
8864
+
8865
+ this.type = recipient.type;
8866
+ this.messageSid = recipient.message_sid;
8867
+ this.rawData = JSON.stringify(recipient);
8868
+ });
8869
+
8870
+ var MessageRecipientsClient = /*#__PURE__*/function () {
8871
+ function MessageRecipientsClient(services, configuration) {
8872
+ _classCallCheck__default["default"](this, MessageRecipientsClient);
8873
+
8874
+ this._services = services;
8875
+ this._configuration = configuration;
8876
+ this._cache = new quickLru({
8877
+ maxSize: configuration.messageRecipientsCacheCapacity
8878
+ });
8879
+ }
8880
+
8881
+ _createClass__default["default"](MessageRecipientsClient, [{
8882
+ key: "getRecipientsFromMessage",
8883
+ value: function () {
8884
+ var _getRecipientsFromMessage = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
8885
+ var _this = this;
8886
+
8887
+ var key, cachedItem, url, recipientsResponse, recipients;
8888
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
8889
+ while (1) {
8890
+ switch (_context.prev = _context.next) {
8891
+ case 0:
8892
+ key = "".concat(conversationSid, ",").concat(messageSid);
8893
+ cachedItem = this._cache.get(key);
8894
+
8895
+ if (!cachedItem) {
8896
+ _context.next = 4;
8897
+ break;
8898
+ }
8899
+
8900
+ return _context.abrupt("return", cachedItem.item);
8901
+
8902
+ case 4:
8903
+ url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
8904
+ _context.next = 7;
8905
+ return this._services.commandExecutor.fetchResource(url);
8906
+
8907
+ case 7:
8908
+ recipientsResponse = _context.sent;
8909
+ recipients = recipientsResponse.message_recipients.map(function (recipient) {
8910
+ return _this._wrapResponse(recipient);
8911
+ });
8912
+
8913
+ if (recipients.length > 0) {
8914
+ this._cache.set(key, {
8915
+ item: recipients
8916
+ });
8917
+ }
8918
+
8919
+ return _context.abrupt("return", recipients);
8920
+
8921
+ case 11:
8922
+ case "end":
8923
+ return _context.stop();
8924
+ }
8925
+ }
8926
+ }, _callee, this);
8927
+ }));
8928
+
8929
+ function getRecipientsFromMessage(_x, _x2) {
8930
+ return _getRecipientsFromMessage.apply(this, arguments);
8931
+ }
8932
+
8933
+ return getRecipientsFromMessage;
8934
+ }()
8935
+ }, {
8936
+ key: "getRecipientsFromConversation",
8937
+ value: function () {
8938
+ var _getRecipientsFromConversation = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(conversationSid, paginatorOptions) {
8939
+ var _paginatorOptions$pag,
8940
+ _paginatorOptions$pag2,
8941
+ _this2 = this;
8942
+
8943
+ var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
8944
+
8945
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
8946
+ while (1) {
8947
+ switch (_context2.prev = _context2.next) {
8948
+ case 0:
8949
+ url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("PageToken", (_paginatorOptions$pag = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _paginatorOptions$pag !== void 0 ? _paginatorOptions$pag : undefined).arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : undefined).build();
8950
+ _context2.next = 3;
8951
+ return this._services.commandExecutor.fetchResource(url);
8952
+
8953
+ case 3:
8954
+ recipientsResponse = _context2.sent;
8955
+ allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
8956
+ return _this2._wrapResponse(recipient);
8957
+ });
8958
+ _iterator = _createForOfIteratorHelper(allRecipients);
8959
+
8960
+ try {
8961
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8962
+ recipient = _step.value;
8963
+ key = "".concat(conversationSid, ",").concat(recipient.messageSid);
8964
+ existingMessageRecipients = (_this$_cache$get$item = (_this$_cache$get = this._cache.get(key)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.item) !== null && _this$_cache$get$item !== void 0 ? _this$_cache$get$item : [];
8965
+
8966
+ this._cache.set(key, {
8967
+ item: [].concat(_toConsumableArray__default["default"](existingMessageRecipients), [recipient])
8968
+ });
8969
+ }
8970
+ } catch (err) {
8971
+ _iterator.e(err);
8972
+ } finally {
8973
+ _iterator.f();
8974
+ }
8975
+
8976
+ return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
8977
+ return _this2.getRecipientsFromConversation(conversationSid, {
8978
+ pageToken: pageToken,
8979
+ pageSize: pageSize
8980
+ });
8981
+ }, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token, paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize));
8982
+
8983
+ case 8:
8984
+ case "end":
8985
+ return _context2.stop();
8986
+ }
8987
+ }
8988
+ }, _callee2, this);
8989
+ }));
8990
+
8991
+ function getRecipientsFromConversation(_x3, _x4) {
8992
+ return _getRecipientsFromConversation.apply(this, arguments);
8993
+ }
8994
+
8995
+ return getRecipientsFromConversation;
8996
+ }()
8997
+ }, {
8998
+ key: "_wrapResponse",
8999
+ value: function _wrapResponse(recipient) {
9000
+ switch (recipient.type) {
9001
+ case "email":
9002
+ return new EmailRecipientDescriptor(recipient);
9003
+
9004
+ default:
9005
+ return new UnknownRecipientDescriptor(recipient);
9006
+ }
9007
+ }
9008
+ }]);
9009
+
9010
+ return MessageRecipientsClient;
9011
+ }();
9012
+
8740
9013
  var _class;
8741
9014
 
8742
9015
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -9958,6 +10231,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9958
10231
  configurationResponse = _context17.sent;
9959
10232
  this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
9960
10233
  this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
10234
+ this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
9961
10235
 
9962
10236
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
9963
10237
 
@@ -10036,10 +10310,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
10036
10310
  }).catch(function (error) {
10037
10311
  throw error;
10038
10312
  });
10039
- _context17.next = 29;
10313
+ _context17.next = 30;
10040
10314
  return this._services.users.myself._ensureFetched();
10041
10315
 
10042
- case 29:
10316
+ case 30:
10043
10317
  Client_1._supportedPushChannels.forEach(function (channelType) {
10044
10318
  return _this3._subscribeToPushNotifications(channelType);
10045
10319
  });
@@ -10055,7 +10329,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
10055
10329
  this.emit("stateChanged", "initialized");
10056
10330
  this.emit("initialized");
10057
10331
 
10058
- case 35:
10332
+ case 36:
10059
10333
  case "end":
10060
10334
  return _context17.stop();
10061
10335
  }
@@ -10315,6 +10589,7 @@ exports.ContentTemplate = ContentTemplate;
10315
10589
  exports.ContentTemplateVariable = ContentTemplateVariable;
10316
10590
  exports.Conversation = Conversation;
10317
10591
  exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
10592
+ exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
10318
10593
  exports.Media = Media;
10319
10594
  exports.Message = Message;
10320
10595
  exports.MessageBuilder = MessageBuilder;
@@ -10322,6 +10597,7 @@ exports.NotificationTypes = NotificationTypes;
10322
10597
  exports.Participant = Participant;
10323
10598
  exports.PushNotification = PushNotification;
10324
10599
  exports.RestPaginator = RestPaginator;
10600
+ exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
10325
10601
  exports.UnsentMessage = UnsentMessage;
10326
10602
  exports.User = User;
10327
10603
  //# sourceMappingURL=lib.js.map