@twilio/conversations 2.3.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
@@ -856,6 +860,10 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
856
860
  log$6.debug(_this3.state.entityName + " (" + _this3.state.identity + ") itemUpdated: " + args.item.key);
857
861
  return _this3._update(args.item.key, args.item.data);
858
862
  });
863
+ map.on("itemAdded", function (args) {
864
+ log$6.debug(_this3.state.entityName + " (" + _this3.state.identity + ") itemAdded: " + args.item.key);
865
+ return _this3._update(args.item.key, args.item.data);
866
+ });
859
867
  return Promise.all([map.get("friendlyName").then(function (item) {
860
868
  return _this3._update(item.key, item.data);
861
869
  }), map.get("attributes").then(function (item) {
@@ -1085,11 +1093,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
1085
1093
 
1086
1094
  __decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
1087
1095
 
1088
- 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; } } }; }
1089
1097
 
1090
- 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); }
1091
1099
 
1092
- 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; }
1093
1101
 
1094
1102
  var Network = /*#__PURE__*/function () {
1095
1103
  function Network(configuration, services) {
@@ -1110,7 +1118,7 @@ var Network = /*#__PURE__*/function () {
1110
1118
  }, {
1111
1119
  key: "cleanupCache",
1112
1120
  value: function cleanupCache() {
1113
- var _iterator = _createForOfIteratorHelper$3(this.cache),
1121
+ var _iterator = _createForOfIteratorHelper$4(this.cache),
1114
1122
  _step;
1115
1123
 
1116
1124
  try {
@@ -1254,9 +1262,9 @@ _defineProperty__default["default"](NotificationTypes, "REMOVED_FROM_CONVERSATIO
1254
1262
 
1255
1263
  _defineProperty__default["default"](NotificationTypes, "CONSUMPTION_UPDATE", "twilio.channel.consumption_update");
1256
1264
 
1257
- 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); }; }
1258
1266
 
1259
- 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; } }
1260
1268
  var log$5 = Logger.scope("Participant");
1261
1269
  /**
1262
1270
  * A participant represents a remote client in a conversation.
@@ -1265,7 +1273,7 @@ var log$5 = Logger.scope("Participant");
1265
1273
  var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1266
1274
  _inherits__default["default"](Participant, _ReplayEventEmitter);
1267
1275
 
1268
- var _super = _createSuper$7(Participant);
1276
+ var _super = _createSuper$8(Participant);
1269
1277
 
1270
1278
  /**
1271
1279
  * @internal
@@ -1637,9 +1645,9 @@ _defineProperty__default["default"](Participant, "updated", "updated");
1637
1645
 
1638
1646
  __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
1639
1647
 
1640
- 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); }; }
1641
1649
 
1642
- 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; } }
1643
1651
  var log$4 = Logger.scope("Participants");
1644
1652
  /**
1645
1653
  * @classdesc Represents the collection of participants for the conversation
@@ -1651,7 +1659,7 @@ var log$4 = Logger.scope("Participants");
1651
1659
  var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1652
1660
  _inherits__default["default"](Participants, _ReplayEventEmitter);
1653
1661
 
1654
- var _super = _createSuper$6(Participants);
1662
+ var _super = _createSuper$7(Participants);
1655
1663
 
1656
1664
  function Participants(conversation, participants, links, configuration, services) {
1657
1665
  var _this;
@@ -2805,9 +2813,9 @@ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if
2805
2813
 
2806
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; }
2807
2815
 
2808
- 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); }; }
2809
2817
 
2810
- 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; } }
2811
2819
  var log$3 = Logger.scope("Message");
2812
2820
 
2813
2821
  var XHR = // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -2820,7 +2828,7 @@ global["XMLHttpRequest"] || {};
2820
2828
  var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2821
2829
  _inherits__default["default"](Message, _ReplayEventEmitter);
2822
2830
 
2823
- var _super = _createSuper$5(Message);
2831
+ var _super = _createSuper$6(Message);
2824
2832
 
2825
2833
  /**
2826
2834
  * Conversation that the message is in.
@@ -2830,7 +2838,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2830
2838
  * @internal
2831
2839
  */
2832
2840
  function Message(index, data, conversation, links, configuration, services) {
2833
- var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid;
2841
+ var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid, _data$channelMetadata;
2834
2842
 
2835
2843
  var _this;
2836
2844
 
@@ -2860,7 +2868,8 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2860
2868
  category: "media"
2861
2869
  }), _this.services)] : null,
2862
2870
  participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
2863
- 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
2864
2873
  };
2865
2874
  return _this;
2866
2875
  }
@@ -3712,6 +3721,47 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3712
3721
  };
3713
3722
  }());
3714
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
+ }()
3715
3765
  }]);
3716
3766
 
3717
3767
  return Message;
@@ -3739,15 +3789,15 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
3739
3789
 
3740
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; }
3741
3791
 
3742
- 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; } } }; }
3743
3793
 
3744
- 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); }
3745
3795
 
3746
- 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; }
3747
3797
 
3748
- 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); }; }
3749
3799
 
3750
- 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; } }
3751
3801
  var log$2 = Logger.scope("Messages");
3752
3802
  /**
3753
3803
  * Represents the collection of messages in a conversation
@@ -3756,7 +3806,7 @@ var log$2 = Logger.scope("Messages");
3756
3806
  var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3757
3807
  _inherits__default["default"](Messages, _ReplayEventEmitter);
3758
3808
 
3759
- var _super = _createSuper$4(Messages);
3809
+ var _super = _createSuper$5(Messages);
3760
3810
 
3761
3811
  function Messages(conversation, configuration, services) {
3762
3812
  var _this;
@@ -3951,7 +4001,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
3951
4001
  return request.cancel();
3952
4002
  });
3953
4003
  });
3954
- _iterator = _createForOfIteratorHelper$2(message.mediaContent);
4004
+ _iterator = _createForOfIteratorHelper$3(message.mediaContent);
3955
4005
  _context3.prev = 4;
3956
4006
 
3957
4007
  _iterator.s();
@@ -4604,15 +4654,15 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
4604
4654
 
4605
4655
  __decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
4606
4656
 
4607
- 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; } } }; }
4608
4658
 
4609
- 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); }
4610
4660
 
4611
- 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; }
4612
4662
 
4613
- 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); }; }
4614
4664
 
4615
- 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; } }
4616
4666
  /**
4617
4667
  * Map of the fields that will be processed with update messages.
4618
4668
  */
@@ -4640,7 +4690,7 @@ var fieldMappings = {
4640
4690
  var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4641
4691
  _inherits__default["default"](Conversation, _ReplayEventEmitter);
4642
4692
 
4643
- var _super = _createSuper$3(Conversation);
4693
+ var _super = _createSuper$4(Conversation);
4644
4694
 
4645
4695
  /**
4646
4696
  * Fired when a participant has joined the conversation.
@@ -6300,7 +6350,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6300
6350
  }, {
6301
6351
  key: "_onMessageAdded",
6302
6352
  value: function _onMessageAdded(message) {
6303
- var _iterator = _createForOfIteratorHelper$1(this._participants.values()),
6353
+ var _iterator = _createForOfIteratorHelper$2(this._participants.values()),
6304
6354
  _step;
6305
6355
 
6306
6356
  try {
@@ -6508,19 +6558,19 @@ var Deferred = /*#__PURE__*/function () {
6508
6558
  return Deferred;
6509
6559
  }();
6510
6560
 
6511
- 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; } } }; }
6512
6562
 
6513
- 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); }
6514
6564
 
6515
- 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; }
6516
6566
 
6517
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; }
6518
6568
 
6519
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; }
6520
6570
 
6521
- 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); }; }
6522
6572
 
6523
- 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; } }
6524
6574
  var log$1 = Logger.scope("Conversations");
6525
6575
  /**
6526
6576
  * Represents conversations collection
@@ -6530,7 +6580,7 @@ var log$1 = Logger.scope("Conversations");
6530
6580
  var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6531
6581
  _inherits__default["default"](Conversations, _ReplayEventEmitter);
6532
6582
 
6533
- var _super = _createSuper$2(Conversations);
6583
+ var _super = _createSuper$3(Conversations);
6534
6584
 
6535
6585
  function Conversations(configuration, services) {
6536
6586
  var _this;
@@ -6692,7 +6742,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6692
6742
  case 9:
6693
6743
  myConversations = _context2.sent;
6694
6744
  upserts = [];
6695
- _iterator = _createForOfIteratorHelper(myConversations);
6745
+ _iterator = _createForOfIteratorHelper$1(myConversations);
6696
6746
 
6697
6747
  try {
6698
6748
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -7317,9 +7367,9 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
7317
7367
  return Conversations;
7318
7368
  }(replayEventEmitter.ReplayEventEmitter);
7319
7369
 
7320
- 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); }; }
7321
7371
 
7322
- 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; } }
7323
7373
  /**
7324
7374
  * Container for known users
7325
7375
  */
@@ -7327,7 +7377,7 @@ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !
7327
7377
  var Users = /*#__PURE__*/function (_ReplayEventEmitter) {
7328
7378
  _inherits__default["default"](Users, _ReplayEventEmitter);
7329
7379
 
7330
- var _super = _createSuper$1(Users);
7380
+ var _super = _createSuper$2(Users);
7331
7381
 
7332
7382
  function Users(myself, configuration, services) {
7333
7383
  var _this;
@@ -7774,12 +7824,16 @@ function PushNotification(data) {
7774
7824
  this.data = data.data || {};
7775
7825
  });
7776
7826
 
7777
- var version = "2.3.0";
7827
+ var version = "2.4.0-rc.0";
7778
7828
 
7779
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; }
7780
7830
 
7781
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; }
7782
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
+
7783
7837
  var trimSlashes = function trimSlashes(url) {
7784
7838
  return url.replace(/(^\/+|\/+$)/g, "");
7785
7839
  };
@@ -7788,6 +7842,20 @@ var isMutationConflictResponse = function isMutationConflictResponse(response) {
7788
7842
  return response.status.code === 202;
7789
7843
  };
7790
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
+
7791
7859
  var CommandExecutor = /*#__PURE__*/function () {
7792
7860
  function CommandExecutor(_serviceUrl, _services, _productId) {
7793
7861
  _classCallCheck__default["default"](this, CommandExecutor);
@@ -7885,40 +7953,91 @@ var CommandExecutor = /*#__PURE__*/function () {
7885
7953
  }, {
7886
7954
  key: "fetchResource",
7887
7955
  value: function () {
7888
- 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) {
7889
7957
  var _this = this;
7890
7958
 
7891
- var maxAttemptsCount, result;
7892
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
7959
+ var maxAttemptsCount, retrier, resolution;
7960
+ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
7893
7961
  while (1) {
7894
- switch (_context2.prev = _context2.next) {
7962
+ switch (_context3.prev = _context3.next) {
7895
7963
  case 0:
7896
7964
  maxAttemptsCount = 6;
7897
- _context2.prev = 1;
7898
- _context2.next = 4;
7899
- return new operationRetrier.AsyncRetrier({
7965
+ retrier = new operationRetrier.AsyncRetrier({
7900
7966
  min: 50,
7901
7967
  max: 1600,
7902
7968
  maxAttemptsCount: maxAttemptsCount
7903
- }).run(function () {
7904
- return _this._makeRequest("get", url, requestBody);
7905
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
+ })));
7906
8013
 
7907
- case 4:
7908
- result = _context2.sent;
7909
- return _context2.abrupt("return", result.body);
8014
+ case 5:
8015
+ resolution = _context3.sent;
8016
+ _context3.next = 11;
8017
+ break;
7910
8018
 
7911
8019
  case 8:
7912
- _context2.prev = 8;
7913
- _context2.t0 = _context2["catch"](1);
8020
+ _context3.prev = 8;
8021
+ _context3.t0 = _context3["catch"](2);
7914
8022
  throw new Error("Fetch resource from \"".concat(url, "\" failed."));
7915
8023
 
7916
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:
7917
8036
  case "end":
7918
- return _context2.stop();
8037
+ return _context3.stop();
7919
8038
  }
7920
8039
  }
7921
- }, _callee2, null, [[1, 8]]);
8040
+ }, _callee3, null, [[2, 8]]);
7922
8041
  }));
7923
8042
 
7924
8043
  function fetchResource(_x5, _x6) {
@@ -7930,40 +8049,40 @@ var CommandExecutor = /*#__PURE__*/function () {
7930
8049
  }, {
7931
8050
  key: "mutateResource",
7932
8051
  value: function () {
7933
- 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) {
7934
8053
  var result;
7935
- return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
8054
+ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
7936
8055
  while (1) {
7937
- switch (_context3.prev = _context3.next) {
8056
+ switch (_context4.prev = _context4.next) {
7938
8057
  case 0:
7939
- _context3.next = 2;
8058
+ _context4.next = 2;
7940
8059
  return this._makeRequest(method, url, requestBody, {
7941
8060
  "X-Twilio-Mutation-Id": uuid.v4()
7942
8061
  });
7943
8062
 
7944
8063
  case 2:
7945
- result = _context3.sent;
8064
+ result = _context4.sent;
7946
8065
 
7947
8066
  if (!isMutationConflictResponse(result)) {
7948
- _context3.next = 7;
8067
+ _context4.next = 7;
7949
8068
  break;
7950
8069
  }
7951
8070
 
7952
- _context3.next = 6;
8071
+ _context4.next = 6;
7953
8072
  return this.fetchResource(result.body.resource_url);
7954
8073
 
7955
8074
  case 6:
7956
- return _context3.abrupt("return", _context3.sent);
8075
+ return _context4.abrupt("return", _context4.sent);
7957
8076
 
7958
8077
  case 7:
7959
- return _context3.abrupt("return", result.body);
8078
+ return _context4.abrupt("return", result.body);
7960
8079
 
7961
8080
  case 8:
7962
8081
  case "end":
7963
- return _context3.stop();
8082
+ return _context4.stop();
7964
8083
  }
7965
8084
  }
7966
- }, _callee3, this);
8085
+ }, _callee4, this);
7967
8086
  }));
7968
8087
 
7969
8088
  function mutateResource(_x7, _x8, _x9) {
@@ -8106,6 +8225,448 @@ var ContentClient = /*#__PURE__*/function () {
8106
8225
  return ContentClient;
8107
8226
  }();
8108
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
+
8109
8670
  var _class;
8110
8671
 
8111
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; }
@@ -9326,6 +9887,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9326
9887
  case 2:
9327
9888
  configurationResponse = _context17.sent;
9328
9889
  this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
9890
+ this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
9329
9891
 
9330
9892
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
9331
9893
 
@@ -9404,10 +9966,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9404
9966
  }).catch(function (error) {
9405
9967
  throw error;
9406
9968
  });
9407
- _context17.next = 28;
9969
+ _context17.next = 29;
9408
9970
  return this._services.users.myself._ensureFetched();
9409
9971
 
9410
- case 28:
9972
+ case 29:
9411
9973
  Client_1._supportedPushChannels.forEach(function (channelType) {
9412
9974
  return _this3._subscribeToPushNotifications(channelType);
9413
9975
  });
@@ -9423,7 +9985,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9423
9985
  this.emit("stateChanged", "initialized");
9424
9986
  this.emit("initialized");
9425
9987
 
9426
- case 34:
9988
+ case 35:
9427
9989
  case "end":
9428
9990
  return _context17.stop();
9429
9991
  }