@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/browser.js CHANGED
@@ -225,6 +225,7 @@ var deprecationDecorator = require('@twilio/deprecation-decorator');
225
225
  require('core-js/modules/es.object.entries.js');
226
226
  require('core-js/modules/es.array.find.js');
227
227
  require('core-js/modules/es.array.splice.js');
228
+ var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
228
229
  var uuid = require('uuid');
229
230
  require('core-js/modules/es.object.freeze.js');
230
231
 
@@ -262,6 +263,7 @@ var loglevelLog__namespace = /*#__PURE__*/_interopNamespace(loglevelLog);
262
263
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
263
264
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
264
265
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
266
+ var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
265
267
 
266
268
  function __decorate(decorators, target, key, desc) {
267
269
  var c = arguments.length,
@@ -414,7 +416,7 @@ var MAXIMUM_ATTEMPTS_COUNT = 3;
414
416
  var RETRY_WHEN_THROTTLED = true;
415
417
 
416
418
  var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
417
- var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c;
419
+ var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
418
420
 
419
421
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
420
422
  var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
@@ -472,6 +474,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
472
474
  logger.error("Failed to parse consumption report interval ".concat(consumptionReportInterval, ", using default value ").concat(CONSUMPTION_HORIZON_SENDING_INTERVAL));
473
475
  this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
474
476
  }
477
+
478
+ this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : 100;
475
479
  });
476
480
 
477
481
  /**
@@ -576,9 +580,9 @@ var sendMediaOptions = declarativeTypeValidator.objectSchema("send media options
576
580
  media: [declarativeTypeValidator.literal("null"), "string"].concat(_toConsumableArray__default["default"](typeof Buffer === "function" ? [Buffer] : []), _toConsumableArray__default["default"](typeof Blob === "function" ? [Blob] : []))
577
581
  });
578
582
 
579
- 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); }; }
583
+ 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); }; }
580
584
 
581
- 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; } }
585
+ 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; } }
582
586
  var log$6 = Logger.scope("User");
583
587
  /**
584
588
  * Extended user information.
@@ -590,7 +594,7 @@ var log$6 = Logger.scope("User");
590
594
  var User = /*#__PURE__*/function (_ReplayEventEmitter) {
591
595
  _inherits__default["default"](User, _ReplayEventEmitter);
592
596
 
593
- var _super = _createSuper$8(User);
597
+ var _super = _createSuper$9(User);
594
598
 
595
599
  /**
596
600
  * @internal
@@ -1089,11 +1093,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
1089
1093
 
1090
1094
  __decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
1091
1095
 
1092
- 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; } } }; }
1096
+ 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; } } }; }
1093
1097
 
1094
- 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); }
1098
+ 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); }
1095
1099
 
1096
- 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; }
1100
+ 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; }
1097
1101
 
1098
1102
  var Network = /*#__PURE__*/function () {
1099
1103
  function Network(configuration, services) {
@@ -1114,7 +1118,7 @@ var Network = /*#__PURE__*/function () {
1114
1118
  }, {
1115
1119
  key: "cleanupCache",
1116
1120
  value: function cleanupCache() {
1117
- var _iterator = _createForOfIteratorHelper$3(this.cache),
1121
+ var _iterator = _createForOfIteratorHelper$4(this.cache),
1118
1122
  _step;
1119
1123
 
1120
1124
  try {
@@ -1258,9 +1262,9 @@ _defineProperty__default["default"](NotificationTypes, "REMOVED_FROM_CONVERSATIO
1258
1262
 
1259
1263
  _defineProperty__default["default"](NotificationTypes, "CONSUMPTION_UPDATE", "twilio.channel.consumption_update");
1260
1264
 
1261
- 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); }; }
1265
+ 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); }; }
1262
1266
 
1263
- 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; } }
1267
+ 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; } }
1264
1268
  var log$5 = Logger.scope("Participant");
1265
1269
  /**
1266
1270
  * A participant represents a remote client in a conversation.
@@ -1269,7 +1273,7 @@ var log$5 = Logger.scope("Participant");
1269
1273
  var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1270
1274
  _inherits__default["default"](Participant, _ReplayEventEmitter);
1271
1275
 
1272
- var _super = _createSuper$7(Participant);
1276
+ var _super = _createSuper$8(Participant);
1273
1277
 
1274
1278
  /**
1275
1279
  * @internal
@@ -1641,9 +1645,9 @@ _defineProperty__default["default"](Participant, "updated", "updated");
1641
1645
 
1642
1646
  __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
1643
1647
 
1644
- 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); }; }
1648
+ 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); }; }
1645
1649
 
1646
- 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; } }
1650
+ 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; } }
1647
1651
  var log$4 = Logger.scope("Participants");
1648
1652
  /**
1649
1653
  * @classdesc Represents the collection of participants for the conversation
@@ -1655,7 +1659,7 @@ var log$4 = Logger.scope("Participants");
1655
1659
  var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1656
1660
  _inherits__default["default"](Participants, _ReplayEventEmitter);
1657
1661
 
1658
- var _super = _createSuper$6(Participants);
1662
+ var _super = _createSuper$7(Participants);
1659
1663
 
1660
1664
  function Participants(conversation, participants, links, configuration, services) {
1661
1665
  var _this;
@@ -2809,9 +2813,9 @@ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if
2809
2813
 
2810
2814
  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; }
2811
2815
 
2812
- 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); }; }
2816
+ 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); }; }
2813
2817
 
2814
- 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; } }
2818
+ 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; } }
2815
2819
  var log$3 = Logger.scope("Message");
2816
2820
 
2817
2821
  var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -2824,7 +2828,7 @@ global["XMLHttpRequest"] || {};
2824
2828
  var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2825
2829
  _inherits__default["default"](Message, _ReplayEventEmitter);
2826
2830
 
2827
- var _super = _createSuper$5(Message);
2831
+ var _super = _createSuper$6(Message);
2828
2832
 
2829
2833
  /**
2830
2834
  * Conversation that the message is in.
@@ -2834,7 +2838,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2834
2838
  * @internal
2835
2839
  */
2836
2840
  function Message(index, data, conversation, links, configuration, services) {
2837
- var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid;
2841
+ var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata;
2838
2842
 
2839
2843
  var _this;
2840
2844
 
@@ -2864,7 +2868,8 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2864
2868
  category: "media"
2865
2869
  }), _this.services)] : null,
2866
2870
  participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
2867
- aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null
2871
+ aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null,
2872
+ hasChannelMetadata: (_data$channelMetadata = data.channelMetadata) !== null && _data$channelMetadata !== void 0 ? _data$channelMetadata : false
2868
2873
  };
2869
2874
  return _this;
2870
2875
  }
@@ -3716,6 +3721,47 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3716
3721
  };
3717
3722
  }());
3718
3723
  }
3724
+ /**
3725
+ * Get the {@link ChannelMetadata} for this message. Resolves to `null` if
3726
+ * the message doesn't have any channel metadata.
3727
+ */
3728
+
3729
+ }, {
3730
+ key: "getChannelMetadata",
3731
+ value: function () {
3732
+ var _getChannelMetadata = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10() {
3733
+ return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
3734
+ while (1) {
3735
+ switch (_context10.prev = _context10.next) {
3736
+ case 0:
3737
+ if (this.state.hasChannelMetadata) {
3738
+ _context10.next = 2;
3739
+ break;
3740
+ }
3741
+
3742
+ return _context10.abrupt("return", null);
3743
+
3744
+ case 2:
3745
+ _context10.next = 4;
3746
+ return this.services.channelMetadataClient.getChannelMetadata(this.conversation.sid, this.sid);
3747
+
3748
+ case 4:
3749
+ return _context10.abrupt("return", _context10.sent);
3750
+
3751
+ case 5:
3752
+ case "end":
3753
+ return _context10.stop();
3754
+ }
3755
+ }
3756
+ }, _callee10, this);
3757
+ }));
3758
+
3759
+ function getChannelMetadata() {
3760
+ return _getChannelMetadata.apply(this, arguments);
3761
+ }
3762
+
3763
+ return getChannelMetadata;
3764
+ }()
3719
3765
  }]);
3720
3766
 
3721
3767
  return Message;
@@ -3743,15 +3789,15 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
3743
3789
 
3744
3790
  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; }
3745
3791
 
3746
- 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; } } }; }
3792
+ 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; } } }; }
3747
3793
 
3748
- 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); }
3794
+ 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); }
3749
3795
 
3750
- 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; }
3796
+ 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; }
3751
3797
 
3752
- 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); }; }
3798
+ 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); }; }
3753
3799
 
3754
- 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; } }
3800
+ 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; } }
3755
3801
  var log$2 = Logger.scope("Messages");
3756
3802
  /**
3757
3803
  * Represents the collection of messages in a conversation
@@ -3760,7 +3806,7 @@ var log$2 = Logger.scope("Messages");
3760
3806
  var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3761
3807
  _inherits__default["default"](Messages, _ReplayEventEmitter);
3762
3808
 
3763
- var _super = _createSuper$4(Messages);
3809
+ var _super = _createSuper$5(Messages);
3764
3810
 
3765
3811
  function Messages(conversation, configuration, services) {
3766
3812
  var _this;
@@ -3955,7 +4001,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3955
4001
  return request.cancel();
3956
4002
  });
3957
4003
  });
3958
- _iterator = _createForOfIteratorHelper$2(message.mediaContent);
4004
+ _iterator = _createForOfIteratorHelper$3(message.mediaContent);
3959
4005
  _context3.prev = 4;
3960
4006
 
3961
4007
  _iterator.s();
@@ -4608,15 +4654,15 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
4608
4654
 
4609
4655
  __decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
4610
4656
 
4611
- 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; } } }; }
4657
+ 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; } } }; }
4612
4658
 
4613
- 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); }
4659
+ 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); }
4614
4660
 
4615
- 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; }
4661
+ 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; }
4616
4662
 
4617
- 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); }; }
4663
+ 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); }; }
4618
4664
 
4619
- 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; } }
4665
+ 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; } }
4620
4666
  /**
4621
4667
  * Map of the fields that will be processed with update messages.
4622
4668
  */
@@ -4644,7 +4690,7 @@ var fieldMappings = {
4644
4690
  var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4645
4691
  _inherits__default["default"](Conversation, _ReplayEventEmitter);
4646
4692
 
4647
- var _super = _createSuper$3(Conversation);
4693
+ var _super = _createSuper$4(Conversation);
4648
4694
 
4649
4695
  /**
4650
4696
  * Fired when a participant has joined the conversation.
@@ -6304,7 +6350,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6304
6350
  }, {
6305
6351
  key: "_onMessageAdded",
6306
6352
  value: function _onMessageAdded(message) {
6307
- var _iterator = _createForOfIteratorHelper$1(this._participants.values()),
6353
+ var _iterator = _createForOfIteratorHelper$2(this._participants.values()),
6308
6354
  _step;
6309
6355
 
6310
6356
  try {
@@ -6512,19 +6558,19 @@ var Deferred = /*#__PURE__*/function () {
6512
6558
  return Deferred;
6513
6559
  }();
6514
6560
 
6515
- 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; } } }; }
6561
+ 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; } } }; }
6516
6562
 
6517
- 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); }
6563
+ 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); }
6518
6564
 
6519
- 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; }
6565
+ 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; }
6520
6566
 
6521
6567
  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; }
6522
6568
 
6523
6569
  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; }
6524
6570
 
6525
- 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); }; }
6571
+ 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); }; }
6526
6572
 
6527
- 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; } }
6573
+ 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; } }
6528
6574
  var log$1 = Logger.scope("Conversations");
6529
6575
  /**
6530
6576
  * Represents conversations collection
@@ -6534,7 +6580,7 @@ var log$1 = Logger.scope("Conversations");
6534
6580
  var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6535
6581
  _inherits__default["default"](Conversations, _ReplayEventEmitter);
6536
6582
 
6537
- var _super = _createSuper$2(Conversations);
6583
+ var _super = _createSuper$3(Conversations);
6538
6584
 
6539
6585
  function Conversations(configuration, services) {
6540
6586
  var _this;
@@ -6696,7 +6742,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6696
6742
  case 9:
6697
6743
  myConversations = _context2.sent;
6698
6744
  upserts = [];
6699
- _iterator = _createForOfIteratorHelper(myConversations);
6745
+ _iterator = _createForOfIteratorHelper$1(myConversations);
6700
6746
 
6701
6747
  try {
6702
6748
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -7321,9 +7367,9 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
7321
7367
  return Conversations;
7322
7368
  }(replayEventEmitter.ReplayEventEmitter);
7323
7369
 
7324
- 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); }; }
7370
+ 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); }; }
7325
7371
 
7326
- 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; } }
7372
+ 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; } }
7327
7373
  /**
7328
7374
  * Container for known users
7329
7375
  */
@@ -7331,7 +7377,7 @@ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !
7331
7377
  var Users = /*#__PURE__*/function (_ReplayEventEmitter) {
7332
7378
  _inherits__default["default"](Users, _ReplayEventEmitter);
7333
7379
 
7334
- var _super = _createSuper$1(Users);
7380
+ var _super = _createSuper$2(Users);
7335
7381
 
7336
7382
  function Users(myself, configuration, services) {
7337
7383
  var _this;
@@ -7778,12 +7824,16 @@ function PushNotification(data) {
7778
7824
  this.data = data.data || {};
7779
7825
  });
7780
7826
 
7781
- var version = "2.3.1-rc.0";
7827
+ var version = "2.4.0-rc.0";
7782
7828
 
7783
7829
  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; }
7784
7830
 
7785
7831
  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; }
7786
7832
 
7833
+ 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); }; }
7834
+
7835
+ 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; } }
7836
+
7787
7837
  var trimSlashes = function trimSlashes(url) {
7788
7838
  return url.replace(/(^\/+|\/+$)/g, "");
7789
7839
  };
@@ -7792,6 +7842,20 @@ var isMutationConflictResponse = function isMutationConflictResponse(response) {
7792
7842
  return response.status.code === 202;
7793
7843
  };
7794
7844
 
7845
+ var ChannelMetadataNotFoundError = /*#__PURE__*/function (_Error) {
7846
+ _inherits__default["default"](ChannelMetadataNotFoundError, _Error);
7847
+
7848
+ var _super = _createSuper$1(ChannelMetadataNotFoundError);
7849
+
7850
+ function ChannelMetadataNotFoundError(message) {
7851
+ _classCallCheck__default["default"](this, ChannelMetadataNotFoundError);
7852
+
7853
+ return _super.call(this, message);
7854
+ }
7855
+
7856
+ return _createClass__default["default"](ChannelMetadataNotFoundError);
7857
+ }( /*#__PURE__*/_wrapNativeSuper__default["default"](Error));
7858
+
7795
7859
  var CommandExecutor = /*#__PURE__*/function () {
7796
7860
  function CommandExecutor(_serviceUrl, _services, _productId) {
7797
7861
  _classCallCheck__default["default"](this, CommandExecutor);
@@ -7889,40 +7953,91 @@ var CommandExecutor = /*#__PURE__*/function () {
7889
7953
  }, {
7890
7954
  key: "fetchResource",
7891
7955
  value: function () {
7892
- var _fetchResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(url, requestBody) {
7956
+ var _fetchResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(url, requestBody) {
7893
7957
  var _this = this;
7894
7958
 
7895
- var maxAttemptsCount, result;
7896
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
7959
+ var maxAttemptsCount, retrier, resolution;
7960
+ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
7897
7961
  while (1) {
7898
- switch (_context2.prev = _context2.next) {
7962
+ switch (_context3.prev = _context3.next) {
7899
7963
  case 0:
7900
7964
  maxAttemptsCount = 6;
7901
- _context2.prev = 1;
7902
- _context2.next = 4;
7903
- return new operationRetrier.AsyncRetrier({
7965
+ retrier = new operationRetrier.AsyncRetrier({
7904
7966
  min: 50,
7905
7967
  max: 1600,
7906
7968
  maxAttemptsCount: maxAttemptsCount
7907
- }).run(function () {
7908
- return _this._makeRequest("get", url, requestBody);
7909
7969
  });
7970
+ _context3.prev = 2;
7971
+ _context3.next = 5;
7972
+ return retrier.run( /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
7973
+ var response, _e$body, _e$body2;
7974
+
7975
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
7976
+ while (1) {
7977
+ switch (_context2.prev = _context2.next) {
7978
+ case 0:
7979
+ _context2.prev = 0;
7980
+ _context2.next = 3;
7981
+ return _this._makeRequest("get", url, requestBody);
7982
+
7983
+ case 3:
7984
+ response = _context2.sent;
7985
+ return _context2.abrupt("return", {
7986
+ type: "success",
7987
+ data: response.body
7988
+ });
7989
+
7990
+ case 7:
7991
+ _context2.prev = 7;
7992
+ _context2.t0 = _context2["catch"](0);
7993
+
7994
+ 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)) {
7995
+ _context2.next = 11;
7996
+ break;
7997
+ }
7998
+
7999
+ return _context2.abrupt("return", {
8000
+ type: "noMetadata"
8001
+ });
8002
+
8003
+ case 11:
8004
+ throw _context2.t0;
8005
+
8006
+ case 12:
8007
+ case "end":
8008
+ return _context2.stop();
8009
+ }
8010
+ }
8011
+ }, _callee2, null, [[0, 7]]);
8012
+ })));
7910
8013
 
7911
- case 4:
7912
- result = _context2.sent;
7913
- return _context2.abrupt("return", result.body);
8014
+ case 5:
8015
+ resolution = _context3.sent;
8016
+ _context3.next = 11;
8017
+ break;
7914
8018
 
7915
8019
  case 8:
7916
- _context2.prev = 8;
7917
- _context2.t0 = _context2["catch"](1);
8020
+ _context3.prev = 8;
8021
+ _context3.t0 = _context3["catch"](2);
7918
8022
  throw new Error("Fetch resource from \"".concat(url, "\" failed."));
7919
8023
 
7920
8024
  case 11:
8025
+ if (!(resolution.type === "noMetadata")) {
8026
+ _context3.next = 13;
8027
+ break;
8028
+ }
8029
+
8030
+ throw new ChannelMetadataNotFoundError("No metadata found.");
8031
+
8032
+ case 13:
8033
+ return _context3.abrupt("return", resolution.data);
8034
+
8035
+ case 14:
7921
8036
  case "end":
7922
- return _context2.stop();
8037
+ return _context3.stop();
7923
8038
  }
7924
8039
  }
7925
- }, _callee2, null, [[1, 8]]);
8040
+ }, _callee3, null, [[2, 8]]);
7926
8041
  }));
7927
8042
 
7928
8043
  function fetchResource(_x5, _x6) {
@@ -7934,40 +8049,40 @@ var CommandExecutor = /*#__PURE__*/function () {
7934
8049
  }, {
7935
8050
  key: "mutateResource",
7936
8051
  value: function () {
7937
- var _mutateResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(method, url, requestBody) {
8052
+ var _mutateResource = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(method, url, requestBody) {
7938
8053
  var result;
7939
- return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
8054
+ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
7940
8055
  while (1) {
7941
- switch (_context3.prev = _context3.next) {
8056
+ switch (_context4.prev = _context4.next) {
7942
8057
  case 0:
7943
- _context3.next = 2;
8058
+ _context4.next = 2;
7944
8059
  return this._makeRequest(method, url, requestBody, {
7945
8060
  "X-Twilio-Mutation-Id": uuid.v4()
7946
8061
  });
7947
8062
 
7948
8063
  case 2:
7949
- result = _context3.sent;
8064
+ result = _context4.sent;
7950
8065
 
7951
8066
  if (!isMutationConflictResponse(result)) {
7952
- _context3.next = 7;
8067
+ _context4.next = 7;
7953
8068
  break;
7954
8069
  }
7955
8070
 
7956
- _context3.next = 6;
8071
+ _context4.next = 6;
7957
8072
  return this.fetchResource(result.body.resource_url);
7958
8073
 
7959
8074
  case 6:
7960
- return _context3.abrupt("return", _context3.sent);
8075
+ return _context4.abrupt("return", _context4.sent);
7961
8076
 
7962
8077
  case 7:
7963
- return _context3.abrupt("return", result.body);
8078
+ return _context4.abrupt("return", result.body);
7964
8079
 
7965
8080
  case 8:
7966
8081
  case "end":
7967
- return _context3.stop();
8082
+ return _context4.stop();
7968
8083
  }
7969
8084
  }
7970
- }, _callee3, this);
8085
+ }, _callee4, this);
7971
8086
  }));
7972
8087
 
7973
8088
  function mutateResource(_x7, _x8, _x9) {
@@ -8110,6 +8225,448 @@ var ContentClient = /*#__PURE__*/function () {
8110
8225
  return ContentClient;
8111
8226
  }();
8112
8227
 
8228
+ 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; } } }; }
8229
+
8230
+ 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); }
8231
+
8232
+ 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; }
8233
+
8234
+ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
8235
+ function QuickLRU() {
8236
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8237
+
8238
+ _classCallCheck__default["default"](this, QuickLRU);
8239
+
8240
+ if (!(options.maxSize && options.maxSize > 0)) {
8241
+ throw new TypeError('`maxSize` must be a number greater than 0');
8242
+ }
8243
+
8244
+ this.maxSize = options.maxSize;
8245
+ this.onEviction = options.onEviction;
8246
+ this.cache = new Map();
8247
+ this.oldCache = new Map();
8248
+ this._size = 0;
8249
+ }
8250
+
8251
+ _createClass__default["default"](QuickLRU, [{
8252
+ key: "_set",
8253
+ value: function _set(key, value) {
8254
+ this.cache.set(key, value);
8255
+ this._size++;
8256
+
8257
+ if (this._size >= this.maxSize) {
8258
+ this._size = 0;
8259
+
8260
+ if (typeof this.onEviction === 'function') {
8261
+ var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
8262
+ _step;
8263
+
8264
+ try {
8265
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
8266
+ var _step$value = _slicedToArray__default["default"](_step.value, 2),
8267
+ _key = _step$value[0],
8268
+ _value = _step$value[1];
8269
+
8270
+ this.onEviction(_key, _value);
8271
+ }
8272
+ } catch (err) {
8273
+ _iterator.e(err);
8274
+ } finally {
8275
+ _iterator.f();
8276
+ }
8277
+ }
8278
+
8279
+ this.oldCache = this.cache;
8280
+ this.cache = new Map();
8281
+ }
8282
+ }
8283
+ }, {
8284
+ key: "get",
8285
+ value: function get(key) {
8286
+ if (this.cache.has(key)) {
8287
+ return this.cache.get(key);
8288
+ }
8289
+
8290
+ if (this.oldCache.has(key)) {
8291
+ var value = this.oldCache.get(key);
8292
+ this.oldCache.delete(key);
8293
+
8294
+ this._set(key, value);
8295
+
8296
+ return value;
8297
+ }
8298
+ }
8299
+ }, {
8300
+ key: "set",
8301
+ value: function set(key, value) {
8302
+ if (this.cache.has(key)) {
8303
+ this.cache.set(key, value);
8304
+ } else {
8305
+ this._set(key, value);
8306
+ }
8307
+
8308
+ return this;
8309
+ }
8310
+ }, {
8311
+ key: "has",
8312
+ value: function has(key) {
8313
+ return this.cache.has(key) || this.oldCache.has(key);
8314
+ }
8315
+ }, {
8316
+ key: "peek",
8317
+ value: function peek(key) {
8318
+ if (this.cache.has(key)) {
8319
+ return this.cache.get(key);
8320
+ }
8321
+
8322
+ if (this.oldCache.has(key)) {
8323
+ return this.oldCache.get(key);
8324
+ }
8325
+ }
8326
+ }, {
8327
+ key: "delete",
8328
+ value: function _delete(key) {
8329
+ var deleted = this.cache.delete(key);
8330
+
8331
+ if (deleted) {
8332
+ this._size--;
8333
+ }
8334
+
8335
+ return this.oldCache.delete(key) || deleted;
8336
+ }
8337
+ }, {
8338
+ key: "clear",
8339
+ value: function clear() {
8340
+ this.cache.clear();
8341
+ this.oldCache.clear();
8342
+ this._size = 0;
8343
+ }
8344
+ }, {
8345
+ key: "keys",
8346
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function keys() {
8347
+ var _iterator2, _step2, _step2$value, key;
8348
+
8349
+ return _regeneratorRuntime__default["default"].wrap(function keys$(_context) {
8350
+ while (1) {
8351
+ switch (_context.prev = _context.next) {
8352
+ case 0:
8353
+ _iterator2 = _createForOfIteratorHelper(this);
8354
+ _context.prev = 1;
8355
+
8356
+ _iterator2.s();
8357
+
8358
+ case 3:
8359
+ if ((_step2 = _iterator2.n()).done) {
8360
+ _context.next = 9;
8361
+ break;
8362
+ }
8363
+
8364
+ _step2$value = _slicedToArray__default["default"](_step2.value, 1), key = _step2$value[0];
8365
+ _context.next = 7;
8366
+ return key;
8367
+
8368
+ case 7:
8369
+ _context.next = 3;
8370
+ break;
8371
+
8372
+ case 9:
8373
+ _context.next = 14;
8374
+ break;
8375
+
8376
+ case 11:
8377
+ _context.prev = 11;
8378
+ _context.t0 = _context["catch"](1);
8379
+
8380
+ _iterator2.e(_context.t0);
8381
+
8382
+ case 14:
8383
+ _context.prev = 14;
8384
+
8385
+ _iterator2.f();
8386
+
8387
+ return _context.finish(14);
8388
+
8389
+ case 17:
8390
+ case "end":
8391
+ return _context.stop();
8392
+ }
8393
+ }
8394
+ }, keys, this, [[1, 11, 14, 17]]);
8395
+ })
8396
+ }, {
8397
+ key: "values",
8398
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function values() {
8399
+ var _iterator3, _step3, _step3$value, value;
8400
+
8401
+ return _regeneratorRuntime__default["default"].wrap(function values$(_context2) {
8402
+ while (1) {
8403
+ switch (_context2.prev = _context2.next) {
8404
+ case 0:
8405
+ _iterator3 = _createForOfIteratorHelper(this);
8406
+ _context2.prev = 1;
8407
+
8408
+ _iterator3.s();
8409
+
8410
+ case 3:
8411
+ if ((_step3 = _iterator3.n()).done) {
8412
+ _context2.next = 9;
8413
+ break;
8414
+ }
8415
+
8416
+ _step3$value = _slicedToArray__default["default"](_step3.value, 2), value = _step3$value[1];
8417
+ _context2.next = 7;
8418
+ return value;
8419
+
8420
+ case 7:
8421
+ _context2.next = 3;
8422
+ break;
8423
+
8424
+ case 9:
8425
+ _context2.next = 14;
8426
+ break;
8427
+
8428
+ case 11:
8429
+ _context2.prev = 11;
8430
+ _context2.t0 = _context2["catch"](1);
8431
+
8432
+ _iterator3.e(_context2.t0);
8433
+
8434
+ case 14:
8435
+ _context2.prev = 14;
8436
+
8437
+ _iterator3.f();
8438
+
8439
+ return _context2.finish(14);
8440
+
8441
+ case 17:
8442
+ case "end":
8443
+ return _context2.stop();
8444
+ }
8445
+ }
8446
+ }, values, this, [[1, 11, 14, 17]]);
8447
+ })
8448
+ }, {
8449
+ key: _Symbol$iterator,
8450
+ value: /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function value() {
8451
+ var _iterator4, _step4, item, _iterator5, _step5, _item, _item2, key;
8452
+
8453
+ return _regeneratorRuntime__default["default"].wrap(function value$(_context3) {
8454
+ while (1) {
8455
+ switch (_context3.prev = _context3.next) {
8456
+ case 0:
8457
+ _iterator4 = _createForOfIteratorHelper(this.cache);
8458
+ _context3.prev = 1;
8459
+
8460
+ _iterator4.s();
8461
+
8462
+ case 3:
8463
+ if ((_step4 = _iterator4.n()).done) {
8464
+ _context3.next = 9;
8465
+ break;
8466
+ }
8467
+
8468
+ item = _step4.value;
8469
+ _context3.next = 7;
8470
+ return item;
8471
+
8472
+ case 7:
8473
+ _context3.next = 3;
8474
+ break;
8475
+
8476
+ case 9:
8477
+ _context3.next = 14;
8478
+ break;
8479
+
8480
+ case 11:
8481
+ _context3.prev = 11;
8482
+ _context3.t0 = _context3["catch"](1);
8483
+
8484
+ _iterator4.e(_context3.t0);
8485
+
8486
+ case 14:
8487
+ _context3.prev = 14;
8488
+
8489
+ _iterator4.f();
8490
+
8491
+ return _context3.finish(14);
8492
+
8493
+ case 17:
8494
+ _iterator5 = _createForOfIteratorHelper(this.oldCache);
8495
+ _context3.prev = 18;
8496
+
8497
+ _iterator5.s();
8498
+
8499
+ case 20:
8500
+ if ((_step5 = _iterator5.n()).done) {
8501
+ _context3.next = 28;
8502
+ break;
8503
+ }
8504
+
8505
+ _item = _step5.value;
8506
+ _item2 = _slicedToArray__default["default"](_item, 1), key = _item2[0];
8507
+
8508
+ if (this.cache.has(key)) {
8509
+ _context3.next = 26;
8510
+ break;
8511
+ }
8512
+
8513
+ _context3.next = 26;
8514
+ return _item;
8515
+
8516
+ case 26:
8517
+ _context3.next = 20;
8518
+ break;
8519
+
8520
+ case 28:
8521
+ _context3.next = 33;
8522
+ break;
8523
+
8524
+ case 30:
8525
+ _context3.prev = 30;
8526
+ _context3.t1 = _context3["catch"](18);
8527
+
8528
+ _iterator5.e(_context3.t1);
8529
+
8530
+ case 33:
8531
+ _context3.prev = 33;
8532
+
8533
+ _iterator5.f();
8534
+
8535
+ return _context3.finish(33);
8536
+
8537
+ case 36:
8538
+ case "end":
8539
+ return _context3.stop();
8540
+ }
8541
+ }
8542
+ }, value, this, [[1, 11, 14, 17], [18, 30, 33, 36]]);
8543
+ })
8544
+ }, {
8545
+ key: "size",
8546
+ get: function get() {
8547
+ var oldCacheSize = 0;
8548
+
8549
+ var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
8550
+ _step6;
8551
+
8552
+ try {
8553
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
8554
+ var key = _step6.value;
8555
+
8556
+ if (!this.cache.has(key)) {
8557
+ oldCacheSize++;
8558
+ }
8559
+ }
8560
+ } catch (err) {
8561
+ _iterator6.e(err);
8562
+ } finally {
8563
+ _iterator6.f();
8564
+ }
8565
+
8566
+ return Math.min(this._size + oldCacheSize, this.maxSize);
8567
+ }
8568
+ }]);
8569
+
8570
+ return QuickLRU;
8571
+ }(Symbol.iterator);
8572
+
8573
+ var quickLru = QuickLRU;
8574
+
8575
+ var ChannelMetadata = /*#__PURE__*/_createClass__default["default"](function ChannelMetadata(type, data) {
8576
+ _classCallCheck__default["default"](this, ChannelMetadata);
8577
+
8578
+ this.type = type;
8579
+ this.data = data;
8580
+ Object.freeze(data);
8581
+ });
8582
+
8583
+ var ChannelMetadataClient = /*#__PURE__*/function () {
8584
+ function ChannelMetadataClient(services, configuration) {
8585
+ _classCallCheck__default["default"](this, ChannelMetadataClient);
8586
+
8587
+ this._services = services;
8588
+ this._configuration = configuration;
8589
+ this._cache = new quickLru({
8590
+ maxSize: configuration.channelMetadataCacheCapacity
8591
+ });
8592
+ }
8593
+
8594
+ _createClass__default["default"](ChannelMetadataClient, [{
8595
+ key: "getChannelMetadata",
8596
+ value: function () {
8597
+ var _getChannelMetadata = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
8598
+ var key, cachedItem, url, metadataResponse, metadata;
8599
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
8600
+ while (1) {
8601
+ switch (_context.prev = _context.next) {
8602
+ case 0:
8603
+ key = "".concat(conversationSid, ",").concat(messageSid);
8604
+ cachedItem = this._cache.get(key);
8605
+
8606
+ if (!cachedItem) {
8607
+ _context.next = 4;
8608
+ break;
8609
+ }
8610
+
8611
+ return _context.abrupt("return", cachedItem.item);
8612
+
8613
+ case 4:
8614
+ url = "".concat(this._configuration.links.conversations, "/").concat(conversationSid, "/Messages/").concat(messageSid, "/ChannelMetadata");
8615
+ _context.prev = 5;
8616
+ _context.next = 8;
8617
+ return this._services.commandExecutor.fetchResource(url);
8618
+
8619
+ case 8:
8620
+ metadataResponse = _context.sent;
8621
+ _context.next = 17;
8622
+ break;
8623
+
8624
+ case 11:
8625
+ _context.prev = 11;
8626
+ _context.t0 = _context["catch"](5);
8627
+
8628
+ if (!(_context.t0 instanceof ChannelMetadataNotFoundError)) {
8629
+ _context.next = 16;
8630
+ break;
8631
+ }
8632
+
8633
+ this._cache.set(key, {
8634
+ item: null
8635
+ });
8636
+
8637
+ return _context.abrupt("return", null);
8638
+
8639
+ case 16:
8640
+ throw new Error(_context.t0);
8641
+
8642
+ case 17:
8643
+ metadata = new ChannelMetadata(metadataResponse.type, metadataResponse.data);
8644
+
8645
+ this._cache.set(key, {
8646
+ item: metadata
8647
+ });
8648
+
8649
+ return _context.abrupt("return", metadata);
8650
+
8651
+ case 20:
8652
+ case "end":
8653
+ return _context.stop();
8654
+ }
8655
+ }
8656
+ }, _callee, this, [[5, 11]]);
8657
+ }));
8658
+
8659
+ function getChannelMetadata(_x, _x2) {
8660
+ return _getChannelMetadata.apply(this, arguments);
8661
+ }
8662
+
8663
+ return getChannelMetadata;
8664
+ }()
8665
+ }]);
8666
+
8667
+ return ChannelMetadataClient;
8668
+ }();
8669
+
8113
8670
  var _class;
8114
8671
 
8115
8672
  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; }
@@ -9330,6 +9887,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9330
9887
  case 2:
9331
9888
  configurationResponse = _context17.sent;
9332
9889
  this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
9890
+ this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
9333
9891
 
9334
9892
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
9335
9893
 
@@ -9408,10 +9966,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9408
9966
  }).catch(function (error) {
9409
9967
  throw error;
9410
9968
  });
9411
- _context17.next = 28;
9969
+ _context17.next = 29;
9412
9970
  return this._services.users.myself._ensureFetched();
9413
9971
 
9414
- case 28:
9972
+ case 29:
9415
9973
  Client_1._supportedPushChannels.forEach(function (channelType) {
9416
9974
  return _this3._subscribeToPushNotifications(channelType);
9417
9975
  });
@@ -9427,7 +9985,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9427
9985
  this.emit("stateChanged", "initialized");
9428
9986
  this.emit("initialized");
9429
9987
 
9430
- case 34:
9988
+ case 35:
9431
9989
  case "end":
9432
9990
  return _context17.stop();
9433
9991
  }