@twilio/conversations 2.3.1-rc.0 → 2.4.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/builds/lib.js CHANGED
@@ -216,6 +216,7 @@ var deprecationDecorator = require('@twilio/deprecation-decorator');
216
216
  require('core-js/modules/es.object.entries.js');
217
217
  require('core-js/modules/es.array.find.js');
218
218
  require('core-js/modules/es.array.splice.js');
219
+ var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
219
220
  var uuid = require('uuid');
220
221
  require('core-js/modules/es.object.freeze.js');
221
222
 
@@ -253,6 +254,7 @@ var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
253
254
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
254
255
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
255
256
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
257
+ var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
256
258
 
257
259
  function __decorate(decorators, target, key, desc) {
258
260
  var c = arguments.length,
@@ -405,7 +407,7 @@ var MAXIMUM_ATTEMPTS_COUNT = 3;
405
407
  var RETRY_WHEN_THROTTLED = true;
406
408
 
407
409
  var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
408
- var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c;
410
+ var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
409
411
 
410
412
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
411
413
  var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
@@ -463,6 +465,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
463
465
  logger.error("Failed to parse consumption report interval ".concat(consumptionReportInterval, ", using default value ").concat(CONSUMPTION_HORIZON_SENDING_INTERVAL));
464
466
  this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
465
467
  }
468
+
469
+ this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : 100;
466
470
  });
467
471
 
468
472
  /**
@@ -567,9 +571,9 @@ var sendMediaOptions = declarativeTypeValidator.objectSchema("send media options
567
571
  media: [declarativeTypeValidator.literal("null"), "string"].concat(_toConsumableArray__default["default"](typeof Buffer === "function" ? [Buffer] : []), _toConsumableArray__default["default"](typeof Blob === "function" ? [Blob] : []))
568
572
  });
569
573
 
570
- function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); 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); }; }
574
+ function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); 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); }; }
571
575
 
572
- function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
576
+ function _isNativeReflectConstruct$9() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
573
577
  var log$6 = Logger.scope("User");
574
578
  /**
575
579
  * Extended user information.
@@ -581,7 +585,7 @@ var log$6 = Logger.scope("User");
581
585
  var User = /*#__PURE__*/function (_ReplayEventEmitter) {
582
586
  _inherits__default["default"](User, _ReplayEventEmitter);
583
587
 
584
- var _super = _createSuper$8(User);
588
+ var _super = _createSuper$9(User);
585
589
 
586
590
  /**
587
591
  * @internal
@@ -1080,11 +1084,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
1080
1084
 
1081
1085
  __decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
1082
1086
 
1083
- 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; } } }; }
1087
+ 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; } } }; }
1084
1088
 
1085
- 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); }
1089
+ 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); }
1086
1090
 
1087
- 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; }
1091
+ 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; }
1088
1092
 
1089
1093
  var Network = /*#__PURE__*/function () {
1090
1094
  function Network(configuration, services) {
@@ -1105,7 +1109,7 @@ var Network = /*#__PURE__*/function () {
1105
1109
  }, {
1106
1110
  key: "cleanupCache",
1107
1111
  value: function cleanupCache() {
1108
- var _iterator = _createForOfIteratorHelper$3(this.cache),
1112
+ var _iterator = _createForOfIteratorHelper$4(this.cache),
1109
1113
  _step;
1110
1114
 
1111
1115
  try {
@@ -1249,9 +1253,9 @@ _defineProperty__default["default"](NotificationTypes, "REMOVED_FROM_CONVERSATIO
1249
1253
 
1250
1254
  _defineProperty__default["default"](NotificationTypes, "CONSUMPTION_UPDATE", "twilio.channel.consumption_update");
1251
1255
 
1252
- function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); 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); }; }
1256
+ function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); 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); }; }
1253
1257
 
1254
- function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1258
+ function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1255
1259
  var log$5 = Logger.scope("Participant");
1256
1260
  /**
1257
1261
  * A participant represents a remote client in a conversation.
@@ -1260,7 +1264,7 @@ var log$5 = Logger.scope("Participant");
1260
1264
  var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1261
1265
  _inherits__default["default"](Participant, _ReplayEventEmitter);
1262
1266
 
1263
- var _super = _createSuper$7(Participant);
1267
+ var _super = _createSuper$8(Participant);
1264
1268
 
1265
1269
  /**
1266
1270
  * @internal
@@ -1632,9 +1636,9 @@ _defineProperty__default["default"](Participant, "updated", "updated");
1632
1636
 
1633
1637
  __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
1634
1638
 
1635
- function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); 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); }; }
1639
+ function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); 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); }; }
1636
1640
 
1637
- function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1641
+ function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1638
1642
  var log$4 = Logger.scope("Participants");
1639
1643
  /**
1640
1644
  * @classdesc Represents the collection of participants for the conversation
@@ -1646,7 +1650,7 @@ var log$4 = Logger.scope("Participants");
1646
1650
  var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1647
1651
  _inherits__default["default"](Participants, _ReplayEventEmitter);
1648
1652
 
1649
- var _super = _createSuper$6(Participants);
1653
+ var _super = _createSuper$7(Participants);
1650
1654
 
1651
1655
  function Participants(conversation, participants, links, configuration, services) {
1652
1656
  var _this;
@@ -2800,9 +2804,9 @@ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if
2800
2804
 
2801
2805
  function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2802
2806
 
2803
- 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); }; }
2807
+ function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); 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); }; }
2804
2808
 
2805
- function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2809
+ function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2806
2810
  var log$3 = Logger.scope("Message");
2807
2811
 
2808
2812
  var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -2815,7 +2819,7 @@ global["XMLHttpRequest"] || require("xmlhttprequest").XMLHttpRequest;
2815
2819
  var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2816
2820
  _inherits__default["default"](Message, _ReplayEventEmitter);
2817
2821
 
2818
- var _super = _createSuper$5(Message);
2822
+ var _super = _createSuper$6(Message);
2819
2823
 
2820
2824
  /**
2821
2825
  * Conversation that the message is in.
@@ -2825,7 +2829,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2825
2829
  * @internal
2826
2830
  */
2827
2831
  function Message(index, data, conversation, links, configuration, services) {
2828
- var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid;
2832
+ var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata;
2829
2833
 
2830
2834
  var _this;
2831
2835
 
@@ -2855,7 +2859,8 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2855
2859
  category: "media"
2856
2860
  }), _this.services)] : null,
2857
2861
  participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
2858
- aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null
2862
+ aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null,
2863
+ hasChannelMetadata: (_data$channelMetadata = data.channelMetadata) !== null && _data$channelMetadata !== void 0 ? _data$channelMetadata : false
2859
2864
  };
2860
2865
  return _this;
2861
2866
  }
@@ -3707,6 +3712,47 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3707
3712
  };
3708
3713
  }());
3709
3714
  }
3715
+ /**
3716
+ * Get the {@link ChannelMetadata} for this message. Resolves to `null` if
3717
+ * the message doesn't have any channel metadata.
3718
+ */
3719
+
3720
+ }, {
3721
+ key: "getChannelMetadata",
3722
+ value: function () {
3723
+ var _getChannelMetadata = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10() {
3724
+ return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
3725
+ while (1) {
3726
+ switch (_context10.prev = _context10.next) {
3727
+ case 0:
3728
+ if (this.state.hasChannelMetadata) {
3729
+ _context10.next = 2;
3730
+ break;
3731
+ }
3732
+
3733
+ return _context10.abrupt("return", null);
3734
+
3735
+ case 2:
3736
+ _context10.next = 4;
3737
+ return this.services.channelMetadataClient.getChannelMetadata(this.conversation.sid, this.sid);
3738
+
3739
+ case 4:
3740
+ return _context10.abrupt("return", _context10.sent);
3741
+
3742
+ case 5:
3743
+ case "end":
3744
+ return _context10.stop();
3745
+ }
3746
+ }
3747
+ }, _callee10, this);
3748
+ }));
3749
+
3750
+ function getChannelMetadata() {
3751
+ return _getChannelMetadata.apply(this, arguments);
3752
+ }
3753
+
3754
+ return getChannelMetadata;
3755
+ }()
3710
3756
  }]);
3711
3757
 
3712
3758
  return Message;
@@ -3734,15 +3780,15 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
3734
3780
 
3735
3781
  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; }
3736
3782
 
3737
- 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; } } }; }
3783
+ 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; } } }; }
3738
3784
 
3739
- 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); }
3785
+ 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); }
3740
3786
 
3741
- 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; }
3787
+ 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; }
3742
3788
 
3743
- 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); }; }
3789
+ 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); }; }
3744
3790
 
3745
- function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3791
+ function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3746
3792
  var log$2 = Logger.scope("Messages");
3747
3793
  /**
3748
3794
  * Represents the collection of messages in a conversation
@@ -3751,7 +3797,7 @@ var log$2 = Logger.scope("Messages");
3751
3797
  var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3752
3798
  _inherits__default["default"](Messages, _ReplayEventEmitter);
3753
3799
 
3754
- var _super = _createSuper$4(Messages);
3800
+ var _super = _createSuper$5(Messages);
3755
3801
 
3756
3802
  function Messages(conversation, configuration, services) {
3757
3803
  var _this;
@@ -3946,7 +3992,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3946
3992
  return request.cancel();
3947
3993
  });
3948
3994
  });
3949
- _iterator = _createForOfIteratorHelper$2(message.mediaContent);
3995
+ _iterator = _createForOfIteratorHelper$3(message.mediaContent);
3950
3996
  _context3.prev = 4;
3951
3997
 
3952
3998
  _iterator.s();
@@ -4599,15 +4645,15 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
4599
4645
 
4600
4646
  __decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
4601
4647
 
4602
- 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; } } }; }
4648
+ 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; } } }; }
4603
4649
 
4604
- 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); }
4650
+ 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); }
4605
4651
 
4606
- 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; }
4652
+ 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; }
4607
4653
 
4608
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); 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); }; }
4654
+ 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); }; }
4609
4655
 
4610
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4656
+ function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4611
4657
  /**
4612
4658
  * Map of the fields that will be processed with update messages.
4613
4659
  */
@@ -4635,7 +4681,7 @@ var fieldMappings = {
4635
4681
  var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4636
4682
  _inherits__default["default"](Conversation, _ReplayEventEmitter);
4637
4683
 
4638
- var _super = _createSuper$3(Conversation);
4684
+ var _super = _createSuper$4(Conversation);
4639
4685
 
4640
4686
  /**
4641
4687
  * Fired when a participant has joined the conversation.
@@ -6295,7 +6341,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6295
6341
  }, {
6296
6342
  key: "_onMessageAdded",
6297
6343
  value: function _onMessageAdded(message) {
6298
- var _iterator = _createForOfIteratorHelper$1(this._participants.values()),
6344
+ var _iterator = _createForOfIteratorHelper$2(this._participants.values()),
6299
6345
  _step;
6300
6346
 
6301
6347
  try {
@@ -6503,19 +6549,19 @@ var Deferred = /*#__PURE__*/function () {
6503
6549
  return Deferred;
6504
6550
  }();
6505
6551
 
6506
- 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; } } }; }
6552
+ 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; } } }; }
6507
6553
 
6508
- 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); }
6554
+ 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); }
6509
6555
 
6510
- 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; }
6556
+ 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; }
6511
6557
 
6512
6558
  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; }
6513
6559
 
6514
6560
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6515
6561
 
6516
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); 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); }; }
6562
+ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); 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); }; }
6517
6563
 
6518
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6564
+ function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6519
6565
  var log$1 = Logger.scope("Conversations");
6520
6566
  /**
6521
6567
  * Represents conversations collection
@@ -6525,7 +6571,7 @@ var log$1 = Logger.scope("Conversations");
6525
6571
  var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6526
6572
  _inherits__default["default"](Conversations, _ReplayEventEmitter);
6527
6573
 
6528
- var _super = _createSuper$2(Conversations);
6574
+ var _super = _createSuper$3(Conversations);
6529
6575
 
6530
6576
  function Conversations(configuration, services) {
6531
6577
  var _this;
@@ -6687,7 +6733,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6687
6733
  case 9:
6688
6734
  myConversations = _context2.sent;
6689
6735
  upserts = [];
6690
- _iterator = _createForOfIteratorHelper(myConversations);
6736
+ _iterator = _createForOfIteratorHelper$1(myConversations);
6691
6737
 
6692
6738
  try {
6693
6739
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -7312,9 +7358,9 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
7312
7358
  return Conversations;
7313
7359
  }(replayEventEmitter.ReplayEventEmitter);
7314
7360
 
7315
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); 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); }; }
7361
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); 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); }; }
7316
7362
 
7317
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7363
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7318
7364
  /**
7319
7365
  * Container for known users
7320
7366
  */
@@ -7322,7 +7368,7 @@ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !
7322
7368
  var Users = /*#__PURE__*/function (_ReplayEventEmitter) {
7323
7369
  _inherits__default["default"](Users, _ReplayEventEmitter);
7324
7370
 
7325
- var _super = _createSuper$1(Users);
7371
+ var _super = _createSuper$2(Users);
7326
7372
 
7327
7373
  function Users(myself, configuration, services) {
7328
7374
  var _this;
@@ -7769,12 +7815,16 @@ function PushNotification(data) {
7769
7815
  this.data = data.data || {};
7770
7816
  });
7771
7817
 
7772
- var version = "2.3.1-rc.0";
7818
+ var version = "2.4.0-rc.0";
7773
7819
 
7774
7820
  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; }
7775
7821
 
7776
7822
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7777
7823
 
7824
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); 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); }; }
7825
+
7826
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7827
+
7778
7828
  var trimSlashes = function trimSlashes(url) {
7779
7829
  return url.replace(/(^\/+|\/+$)/g, "");
7780
7830
  };
@@ -7783,6 +7833,20 @@ var isMutationConflictResponse = function isMutationConflictResponse(response) {
7783
7833
  return response.status.code === 202;
7784
7834
  };
7785
7835
 
7836
+ var ChannelMetadataNotFoundError = /*#__PURE__*/function (_Error) {
7837
+ _inherits__default["default"](ChannelMetadataNotFoundError, _Error);
7838
+
7839
+ var _super = _createSuper$1(ChannelMetadataNotFoundError);
7840
+
7841
+ function ChannelMetadataNotFoundError(message) {
7842
+ _classCallCheck__default["default"](this, ChannelMetadataNotFoundError);
7843
+
7844
+ return _super.call(this, message);
7845
+ }
7846
+
7847
+ return _createClass__default["default"](ChannelMetadataNotFoundError);
7848
+ }( /*#__PURE__*/_wrapNativeSuper__default["default"](Error));
7849
+
7786
7850
  var CommandExecutor = /*#__PURE__*/function () {
7787
7851
  function CommandExecutor(_serviceUrl, _services, _productId) {
7788
7852
  _classCallCheck__default["default"](this, CommandExecutor);
@@ -7880,40 +7944,91 @@ var CommandExecutor = /*#__PURE__*/function () {
7880
7944
  }, {
7881
7945
  key: "fetchResource",
7882
7946
  value: function () {
7883
- var _fetchResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(url, requestBody) {
7947
+ var _fetchResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(url, requestBody) {
7884
7948
  var _this = this;
7885
7949
 
7886
- var maxAttemptsCount, result;
7887
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
7950
+ var maxAttemptsCount, retrier, resolution;
7951
+ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
7888
7952
  while (1) {
7889
- switch (_context2.prev = _context2.next) {
7953
+ switch (_context3.prev = _context3.next) {
7890
7954
  case 0:
7891
7955
  maxAttemptsCount = 6;
7892
- _context2.prev = 1;
7893
- _context2.next = 4;
7894
- return new operationRetrier.AsyncRetrier({
7956
+ retrier = new operationRetrier.AsyncRetrier({
7895
7957
  min: 50,
7896
7958
  max: 1600,
7897
7959
  maxAttemptsCount: maxAttemptsCount
7898
- }).run(function () {
7899
- return _this._makeRequest("get", url, requestBody);
7900
7960
  });
7961
+ _context3.prev = 2;
7962
+ _context3.next = 5;
7963
+ return retrier.run( /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
7964
+ var response, _e$body, _e$body2;
7965
+
7966
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
7967
+ while (1) {
7968
+ switch (_context2.prev = _context2.next) {
7969
+ case 0:
7970
+ _context2.prev = 0;
7971
+ _context2.next = 3;
7972
+ return _this._makeRequest("get", url, requestBody);
7973
+
7974
+ case 3:
7975
+ response = _context2.sent;
7976
+ return _context2.abrupt("return", {
7977
+ type: "success",
7978
+ data: response.body
7979
+ });
7980
+
7981
+ case 7:
7982
+ _context2.prev = 7;
7983
+ _context2.t0 = _context2["catch"](0);
7984
+
7985
+ if (!((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_e$body = _context2.t0.body) === null || _e$body === void 0 ? void 0 : _e$body.status) === 404 && (_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_e$body2 = _context2.t0.body) === null || _e$body2 === void 0 ? void 0 : _e$body2.code) === 50530)) {
7986
+ _context2.next = 11;
7987
+ break;
7988
+ }
7989
+
7990
+ return _context2.abrupt("return", {
7991
+ type: "noMetadata"
7992
+ });
7993
+
7994
+ case 11:
7995
+ throw _context2.t0;
7996
+
7997
+ case 12:
7998
+ case "end":
7999
+ return _context2.stop();
8000
+ }
8001
+ }
8002
+ }, _callee2, null, [[0, 7]]);
8003
+ })));
7901
8004
 
7902
- case 4:
7903
- result = _context2.sent;
7904
- return _context2.abrupt("return", result.body);
8005
+ case 5:
8006
+ resolution = _context3.sent;
8007
+ _context3.next = 11;
8008
+ break;
7905
8009
 
7906
8010
  case 8:
7907
- _context2.prev = 8;
7908
- _context2.t0 = _context2["catch"](1);
8011
+ _context3.prev = 8;
8012
+ _context3.t0 = _context3["catch"](2);
7909
8013
  throw new Error("Fetch resource from \"".concat(url, "\" failed."));
7910
8014
 
7911
8015
  case 11:
8016
+ if (!(resolution.type === "noMetadata")) {
8017
+ _context3.next = 13;
8018
+ break;
8019
+ }
8020
+
8021
+ throw new ChannelMetadataNotFoundError("No metadata found.");
8022
+
8023
+ case 13:
8024
+ return _context3.abrupt("return", resolution.data);
8025
+
8026
+ case 14:
7912
8027
  case "end":
7913
- return _context2.stop();
8028
+ return _context3.stop();
7914
8029
  }
7915
8030
  }
7916
- }, _callee2, null, [[1, 8]]);
8031
+ }, _callee3, null, [[2, 8]]);
7917
8032
  }));
7918
8033
 
7919
8034
  function fetchResource(_x5, _x6) {
@@ -7925,40 +8040,40 @@ var CommandExecutor = /*#__PURE__*/function () {
7925
8040
  }, {
7926
8041
  key: "mutateResource",
7927
8042
  value: function () {
7928
- var _mutateResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(method, url, requestBody) {
8043
+ var _mutateResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(method, url, requestBody) {
7929
8044
  var result;
7930
- return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
8045
+ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
7931
8046
  while (1) {
7932
- switch (_context3.prev = _context3.next) {
8047
+ switch (_context4.prev = _context4.next) {
7933
8048
  case 0:
7934
- _context3.next = 2;
8049
+ _context4.next = 2;
7935
8050
  return this._makeRequest(method, url, requestBody, {
7936
8051
  "X-Twilio-Mutation-Id": uuid.v4()
7937
8052
  });
7938
8053
 
7939
8054
  case 2:
7940
- result = _context3.sent;
8055
+ result = _context4.sent;
7941
8056
 
7942
8057
  if (!isMutationConflictResponse(result)) {
7943
- _context3.next = 7;
8058
+ _context4.next = 7;
7944
8059
  break;
7945
8060
  }
7946
8061
 
7947
- _context3.next = 6;
8062
+ _context4.next = 6;
7948
8063
  return this.fetchResource(result.body.resource_url);
7949
8064
 
7950
8065
  case 6:
7951
- return _context3.abrupt("return", _context3.sent);
8066
+ return _context4.abrupt("return", _context4.sent);
7952
8067
 
7953
8068
  case 7:
7954
- return _context3.abrupt("return", result.body);
8069
+ return _context4.abrupt("return", result.body);
7955
8070
 
7956
8071
  case 8:
7957
8072
  case "end":
7958
- return _context3.stop();
8073
+ return _context4.stop();
7959
8074
  }
7960
8075
  }
7961
- }, _callee3, this);
8076
+ }, _callee4, this);
7962
8077
  }));
7963
8078
 
7964
8079
  function mutateResource(_x7, _x8, _x9) {
@@ -8101,6 +8216,448 @@ var ContentClient = /*#__PURE__*/function () {
8101
8216
  return ContentClient;
8102
8217
  }();
8103
8218
 
8219
+ 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; } } }; }
8220
+
8221
+ 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); }
8222
+
8223
+ 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; }
8224
+
8225
+ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8226
+ function QuickLRU() {
8227
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8228
+
8229
+ _classCallCheck__default["default"](this, QuickLRU);
8230
+
8231
+ if (!(options.maxSize && options.maxSize > 0)) {
8232
+ throw new TypeError('`maxSize` must be a number greater than 0');
8233
+ }
8234
+
8235
+ this.maxSize = options.maxSize;
8236
+ this.onEviction = options.onEviction;
8237
+ this.cache = new Map();
8238
+ this.oldCache = new Map();
8239
+ this._size = 0;
8240
+ }
8241
+
8242
+ _createClass__default["default"](QuickLRU, [{
8243
+ key: "_set",
8244
+ value: function _set(key, value) {
8245
+ this.cache.set(key, value);
8246
+ this._size++;
8247
+
8248
+ if (this._size >= this.maxSize) {
8249
+ this._size = 0;
8250
+
8251
+ if (typeof this.onEviction === 'function') {
8252
+ var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
8253
+ _step;
8254
+
8255
+ try {
8256
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8257
+ var _step$value = _slicedToArray__default["default"](_step.value, 2),
8258
+ _key = _step$value[0],
8259
+ _value = _step$value[1];
8260
+
8261
+ this.onEviction(_key, _value);
8262
+ }
8263
+ } catch (err) {
8264
+ _iterator.e(err);
8265
+ } finally {
8266
+ _iterator.f();
8267
+ }
8268
+ }
8269
+
8270
+ this.oldCache = this.cache;
8271
+ this.cache = new Map();
8272
+ }
8273
+ }
8274
+ }, {
8275
+ key: "get",
8276
+ value: function get(key) {
8277
+ if (this.cache.has(key)) {
8278
+ return this.cache.get(key);
8279
+ }
8280
+
8281
+ if (this.oldCache.has(key)) {
8282
+ var value = this.oldCache.get(key);
8283
+ this.oldCache.delete(key);
8284
+
8285
+ this._set(key, value);
8286
+
8287
+ return value;
8288
+ }
8289
+ }
8290
+ }, {
8291
+ key: "set",
8292
+ value: function set(key, value) {
8293
+ if (this.cache.has(key)) {
8294
+ this.cache.set(key, value);
8295
+ } else {
8296
+ this._set(key, value);
8297
+ }
8298
+
8299
+ return this;
8300
+ }
8301
+ }, {
8302
+ key: "has",
8303
+ value: function has(key) {
8304
+ return this.cache.has(key) || this.oldCache.has(key);
8305
+ }
8306
+ }, {
8307
+ key: "peek",
8308
+ value: function peek(key) {
8309
+ if (this.cache.has(key)) {
8310
+ return this.cache.get(key);
8311
+ }
8312
+
8313
+ if (this.oldCache.has(key)) {
8314
+ return this.oldCache.get(key);
8315
+ }
8316
+ }
8317
+ }, {
8318
+ key: "delete",
8319
+ value: function _delete(key) {
8320
+ var deleted = this.cache.delete(key);
8321
+
8322
+ if (deleted) {
8323
+ this._size--;
8324
+ }
8325
+
8326
+ return this.oldCache.delete(key) || deleted;
8327
+ }
8328
+ }, {
8329
+ key: "clear",
8330
+ value: function clear() {
8331
+ this.cache.clear();
8332
+ this.oldCache.clear();
8333
+ this._size = 0;
8334
+ }
8335
+ }, {
8336
+ key: "keys",
8337
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function keys() {
8338
+ var _iterator2, _step2, _step2$value, key;
8339
+
8340
+ return _regeneratorRuntime__default["default"].wrap(function keys$(_context) {
8341
+ while (1) {
8342
+ switch (_context.prev = _context.next) {
8343
+ case 0:
8344
+ _iterator2 = _createForOfIteratorHelper(this);
8345
+ _context.prev = 1;
8346
+
8347
+ _iterator2.s();
8348
+
8349
+ case 3:
8350
+ if ((_step2 = _iterator2.n()).done) {
8351
+ _context.next = 9;
8352
+ break;
8353
+ }
8354
+
8355
+ _step2$value = _slicedToArray__default["default"](_step2.value, 1), key = _step2$value[0];
8356
+ _context.next = 7;
8357
+ return key;
8358
+
8359
+ case 7:
8360
+ _context.next = 3;
8361
+ break;
8362
+
8363
+ case 9:
8364
+ _context.next = 14;
8365
+ break;
8366
+
8367
+ case 11:
8368
+ _context.prev = 11;
8369
+ _context.t0 = _context["catch"](1);
8370
+
8371
+ _iterator2.e(_context.t0);
8372
+
8373
+ case 14:
8374
+ _context.prev = 14;
8375
+
8376
+ _iterator2.f();
8377
+
8378
+ return _context.finish(14);
8379
+
8380
+ case 17:
8381
+ case "end":
8382
+ return _context.stop();
8383
+ }
8384
+ }
8385
+ }, keys, this, [[1, 11, 14, 17]]);
8386
+ })
8387
+ }, {
8388
+ key: "values",
8389
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function values() {
8390
+ var _iterator3, _step3, _step3$value, value;
8391
+
8392
+ return _regeneratorRuntime__default["default"].wrap(function values$(_context2) {
8393
+ while (1) {
8394
+ switch (_context2.prev = _context2.next) {
8395
+ case 0:
8396
+ _iterator3 = _createForOfIteratorHelper(this);
8397
+ _context2.prev = 1;
8398
+
8399
+ _iterator3.s();
8400
+
8401
+ case 3:
8402
+ if ((_step3 = _iterator3.n()).done) {
8403
+ _context2.next = 9;
8404
+ break;
8405
+ }
8406
+
8407
+ _step3$value = _slicedToArray__default["default"](_step3.value, 2), value = _step3$value[1];
8408
+ _context2.next = 7;
8409
+ return value;
8410
+
8411
+ case 7:
8412
+ _context2.next = 3;
8413
+ break;
8414
+
8415
+ case 9:
8416
+ _context2.next = 14;
8417
+ break;
8418
+
8419
+ case 11:
8420
+ _context2.prev = 11;
8421
+ _context2.t0 = _context2["catch"](1);
8422
+
8423
+ _iterator3.e(_context2.t0);
8424
+
8425
+ case 14:
8426
+ _context2.prev = 14;
8427
+
8428
+ _iterator3.f();
8429
+
8430
+ return _context2.finish(14);
8431
+
8432
+ case 17:
8433
+ case "end":
8434
+ return _context2.stop();
8435
+ }
8436
+ }
8437
+ }, values, this, [[1, 11, 14, 17]]);
8438
+ })
8439
+ }, {
8440
+ key: _Symbol$iterator,
8441
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function value() {
8442
+ var _iterator4, _step4, item, _iterator5, _step5, _item, _item2, key;
8443
+
8444
+ return _regeneratorRuntime__default["default"].wrap(function value$(_context3) {
8445
+ while (1) {
8446
+ switch (_context3.prev = _context3.next) {
8447
+ case 0:
8448
+ _iterator4 = _createForOfIteratorHelper(this.cache);
8449
+ _context3.prev = 1;
8450
+
8451
+ _iterator4.s();
8452
+
8453
+ case 3:
8454
+ if ((_step4 = _iterator4.n()).done) {
8455
+ _context3.next = 9;
8456
+ break;
8457
+ }
8458
+
8459
+ item = _step4.value;
8460
+ _context3.next = 7;
8461
+ return item;
8462
+
8463
+ case 7:
8464
+ _context3.next = 3;
8465
+ break;
8466
+
8467
+ case 9:
8468
+ _context3.next = 14;
8469
+ break;
8470
+
8471
+ case 11:
8472
+ _context3.prev = 11;
8473
+ _context3.t0 = _context3["catch"](1);
8474
+
8475
+ _iterator4.e(_context3.t0);
8476
+
8477
+ case 14:
8478
+ _context3.prev = 14;
8479
+
8480
+ _iterator4.f();
8481
+
8482
+ return _context3.finish(14);
8483
+
8484
+ case 17:
8485
+ _iterator5 = _createForOfIteratorHelper(this.oldCache);
8486
+ _context3.prev = 18;
8487
+
8488
+ _iterator5.s();
8489
+
8490
+ case 20:
8491
+ if ((_step5 = _iterator5.n()).done) {
8492
+ _context3.next = 28;
8493
+ break;
8494
+ }
8495
+
8496
+ _item = _step5.value;
8497
+ _item2 = _slicedToArray__default["default"](_item, 1), key = _item2[0];
8498
+
8499
+ if (this.cache.has(key)) {
8500
+ _context3.next = 26;
8501
+ break;
8502
+ }
8503
+
8504
+ _context3.next = 26;
8505
+ return _item;
8506
+
8507
+ case 26:
8508
+ _context3.next = 20;
8509
+ break;
8510
+
8511
+ case 28:
8512
+ _context3.next = 33;
8513
+ break;
8514
+
8515
+ case 30:
8516
+ _context3.prev = 30;
8517
+ _context3.t1 = _context3["catch"](18);
8518
+
8519
+ _iterator5.e(_context3.t1);
8520
+
8521
+ case 33:
8522
+ _context3.prev = 33;
8523
+
8524
+ _iterator5.f();
8525
+
8526
+ return _context3.finish(33);
8527
+
8528
+ case 36:
8529
+ case "end":
8530
+ return _context3.stop();
8531
+ }
8532
+ }
8533
+ }, value, this, [[1, 11, 14, 17], [18, 30, 33, 36]]);
8534
+ })
8535
+ }, {
8536
+ key: "size",
8537
+ get: function get() {
8538
+ var oldCacheSize = 0;
8539
+
8540
+ var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
8541
+ _step6;
8542
+
8543
+ try {
8544
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
8545
+ var key = _step6.value;
8546
+
8547
+ if (!this.cache.has(key)) {
8548
+ oldCacheSize++;
8549
+ }
8550
+ }
8551
+ } catch (err) {
8552
+ _iterator6.e(err);
8553
+ } finally {
8554
+ _iterator6.f();
8555
+ }
8556
+
8557
+ return Math.min(this._size + oldCacheSize, this.maxSize);
8558
+ }
8559
+ }]);
8560
+
8561
+ return QuickLRU;
8562
+ }(Symbol.iterator);
8563
+
8564
+ var quickLru = QuickLRU;
8565
+
8566
+ var ChannelMetadata = /*#__PURE__*/_createClass__default["default"](function ChannelMetadata(type, data) {
8567
+ _classCallCheck__default["default"](this, ChannelMetadata);
8568
+
8569
+ this.type = type;
8570
+ this.data = data;
8571
+ Object.freeze(data);
8572
+ });
8573
+
8574
+ var ChannelMetadataClient = /*#__PURE__*/function () {
8575
+ function ChannelMetadataClient(services, configuration) {
8576
+ _classCallCheck__default["default"](this, ChannelMetadataClient);
8577
+
8578
+ this._services = services;
8579
+ this._configuration = configuration;
8580
+ this._cache = new quickLru({
8581
+ maxSize: configuration.channelMetadataCacheCapacity
8582
+ });
8583
+ }
8584
+
8585
+ _createClass__default["default"](ChannelMetadataClient, [{
8586
+ key: "getChannelMetadata",
8587
+ value: function () {
8588
+ var _getChannelMetadata = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
8589
+ var key, cachedItem, url, metadataResponse, metadata;
8590
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
8591
+ while (1) {
8592
+ switch (_context.prev = _context.next) {
8593
+ case 0:
8594
+ key = "".concat(conversationSid, ",").concat(messageSid);
8595
+ cachedItem = this._cache.get(key);
8596
+
8597
+ if (!cachedItem) {
8598
+ _context.next = 4;
8599
+ break;
8600
+ }
8601
+
8602
+ return _context.abrupt("return", cachedItem.item);
8603
+
8604
+ case 4:
8605
+ url = "".concat(this._configuration.links.conversations, "/").concat(conversationSid, "/Messages/").concat(messageSid, "/ChannelMetadata");
8606
+ _context.prev = 5;
8607
+ _context.next = 8;
8608
+ return this._services.commandExecutor.fetchResource(url);
8609
+
8610
+ case 8:
8611
+ metadataResponse = _context.sent;
8612
+ _context.next = 17;
8613
+ break;
8614
+
8615
+ case 11:
8616
+ _context.prev = 11;
8617
+ _context.t0 = _context["catch"](5);
8618
+
8619
+ if (!(_context.t0 instanceof ChannelMetadataNotFoundError)) {
8620
+ _context.next = 16;
8621
+ break;
8622
+ }
8623
+
8624
+ this._cache.set(key, {
8625
+ item: null
8626
+ });
8627
+
8628
+ return _context.abrupt("return", null);
8629
+
8630
+ case 16:
8631
+ throw new Error(_context.t0);
8632
+
8633
+ case 17:
8634
+ metadata = new ChannelMetadata(metadataResponse.type, metadataResponse.data);
8635
+
8636
+ this._cache.set(key, {
8637
+ item: metadata
8638
+ });
8639
+
8640
+ return _context.abrupt("return", metadata);
8641
+
8642
+ case 20:
8643
+ case "end":
8644
+ return _context.stop();
8645
+ }
8646
+ }
8647
+ }, _callee, this, [[5, 11]]);
8648
+ }));
8649
+
8650
+ function getChannelMetadata(_x, _x2) {
8651
+ return _getChannelMetadata.apply(this, arguments);
8652
+ }
8653
+
8654
+ return getChannelMetadata;
8655
+ }()
8656
+ }]);
8657
+
8658
+ return ChannelMetadataClient;
8659
+ }();
8660
+
8104
8661
  var _class;
8105
8662
 
8106
8663
  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; }
@@ -9321,6 +9878,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9321
9878
  case 2:
9322
9879
  configurationResponse = _context17.sent;
9323
9880
  this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
9881
+ this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
9324
9882
 
9325
9883
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
9326
9884
 
@@ -9399,10 +9957,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9399
9957
  }).catch(function (error) {
9400
9958
  throw error;
9401
9959
  });
9402
- _context17.next = 28;
9960
+ _context17.next = 29;
9403
9961
  return this._services.users.myself._ensureFetched();
9404
9962
 
9405
- case 28:
9963
+ case 29:
9406
9964
  Client_1._supportedPushChannels.forEach(function (channelType) {
9407
9965
  return _this3._subscribeToPushNotifications(channelType);
9408
9966
  });
@@ -9418,7 +9976,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9418
9976
  this.emit("stateChanged", "initialized");
9419
9977
  this.emit("initialized");
9420
9978
 
9421
- case 34:
9979
+ case 35:
9422
9980
  case "end":
9423
9981
  return _context17.stop();
9424
9982
  }