@twilio/conversations 2.4.1 → 2.5.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/builds/browser.js +379 -103
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +130 -30
- package/builds/lib.js +379 -103
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +11641 -11356
- package/builds/twilio-conversations.min.js +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/configuration.js +8 -4
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +9 -2
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/logger.js +6 -2
- package/dist/logger.js.map +1 -1
- package/dist/message-recipients-client.js +237 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +7 -1
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/rest-paginator.js +4 -3
- package/dist/rest-paginator.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/Conversation.html +32 -0
- package/docs/classes/EmailRecipientDescriptor.html +3098 -0
- package/docs/classes/Message.html +23 -0
- package/docs/classes/UnknownRecipientDescriptor.html +3067 -0
- package/docs/index.html +43 -3
- package/docs/interfaces/ClientOptions.html +16 -0
- package/docs/modules.html +42 -2
- package/package.json +13 -12
package/builds/browser.js
CHANGED
@@ -302,11 +302,13 @@ var Logger = /*#__PURE__*/function () {
|
|
302
302
|
}, {
|
303
303
|
key: "trace",
|
304
304
|
value: function trace() {
|
305
|
-
|
306
|
-
args
|
307
|
-
|
305
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
306
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
307
|
+
args[_key] = arguments[_key];
|
308
|
+
}
|
308
309
|
|
309
|
-
|
310
|
+
log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
|
311
|
+
}
|
310
312
|
}
|
311
313
|
}, {
|
312
314
|
key: "debug",
|
@@ -357,11 +359,13 @@ var Logger = /*#__PURE__*/function () {
|
|
357
359
|
}, {
|
358
360
|
key: "trace",
|
359
361
|
value: function trace() {
|
360
|
-
|
361
|
-
args
|
362
|
-
|
362
|
+
if (log$7.getLevel() == log$7.levels.TRACE) {
|
363
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
364
|
+
args[_key6] = arguments[_key6];
|
365
|
+
}
|
363
366
|
|
364
|
-
|
367
|
+
log$7.debug.apply(null, prepareLine("T", args));
|
368
|
+
}
|
365
369
|
}
|
366
370
|
}, {
|
367
371
|
key: "debug",
|
@@ -415,9 +419,11 @@ var MINIMUM_RETRY_DELAY = 1000;
|
|
415
419
|
var MAXIMUM_RETRY_DELAY = 4000;
|
416
420
|
var MAXIMUM_ATTEMPTS_COUNT = 3;
|
417
421
|
var RETRY_WHEN_THROTTLED = true;
|
422
|
+
var CHANNEL_METADATA_CACHE_CAPACITY = 100;
|
423
|
+
var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
|
418
424
|
|
419
425
|
var Configuration = /*#__PURE__*/_createClass__default["default"](function Configuration() {
|
420
|
-
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
|
426
|
+
var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
|
421
427
|
|
422
428
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
423
429
|
var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -476,7 +482,8 @@ var Configuration = /*#__PURE__*/_createClass__default["default"](function Confi
|
|
476
482
|
this.consumptionReportInterval = iso8601Duration.toSeconds(iso8601Duration.parse(CONSUMPTION_HORIZON_SENDING_INTERVAL));
|
477
483
|
}
|
478
484
|
|
479
|
-
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad :
|
485
|
+
this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
|
486
|
+
this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
|
480
487
|
});
|
481
488
|
|
482
489
|
/**
|
@@ -1094,11 +1101,11 @@ __decorate([declarativeTypeValidator.validateTypesAsync(json), __metadata("desig
|
|
1094
1101
|
|
1095
1102
|
__decorate([declarativeTypeValidator.validateTypesAsync(["string"]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
|
1096
1103
|
|
1097
|
-
function _createForOfIteratorHelper$
|
1104
|
+
function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
1098
1105
|
|
1099
|
-
function _unsupportedIterableToArray$
|
1106
|
+
function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
|
1100
1107
|
|
1101
|
-
function _arrayLikeToArray$
|
1108
|
+
function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
1102
1109
|
|
1103
1110
|
var Network = /*#__PURE__*/function () {
|
1104
1111
|
function Network(configuration, services) {
|
@@ -1119,7 +1126,7 @@ var Network = /*#__PURE__*/function () {
|
|
1119
1126
|
}, {
|
1120
1127
|
key: "cleanupCache",
|
1121
1128
|
value: function cleanupCache() {
|
1122
|
-
var _iterator = _createForOfIteratorHelper$
|
1129
|
+
var _iterator = _createForOfIteratorHelper$5(this.cache),
|
1123
1130
|
_step;
|
1124
1131
|
|
1125
1132
|
try {
|
@@ -2459,14 +2466,15 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2459
2466
|
/**
|
2460
2467
|
* @internal
|
2461
2468
|
*/
|
2462
|
-
function RestPaginator(items, source, prevToken, nextToken) {
|
2469
|
+
function RestPaginator(items, source, prevToken, nextToken, pageSize) {
|
2463
2470
|
_classCallCheck__default["default"](this, RestPaginator);
|
2464
2471
|
|
2465
2472
|
this.state = {
|
2466
2473
|
prevToken: prevToken,
|
2467
2474
|
nextToken: nextToken,
|
2468
2475
|
source: source,
|
2469
|
-
items: items
|
2476
|
+
items: items,
|
2477
|
+
pageSize: pageSize
|
2470
2478
|
};
|
2471
2479
|
}
|
2472
2480
|
/**
|
@@ -2504,7 +2512,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2504
2512
|
}, {
|
2505
2513
|
key: "nextPage",
|
2506
2514
|
value: function nextPage() {
|
2507
|
-
return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
|
2515
|
+
return this.hasNextPage ? this.state.source(this.state.nextToken, this.state.pageSize) : Promise.reject(new Error("No next page"));
|
2508
2516
|
}
|
2509
2517
|
/**
|
2510
2518
|
* Request the previous page. Does not modify the existing object.
|
@@ -2513,7 +2521,7 @@ var RestPaginator = /*#__PURE__*/function () {
|
|
2513
2521
|
}, {
|
2514
2522
|
key: "prevPage",
|
2515
2523
|
value: function prevPage() {
|
2516
|
-
return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
|
2524
|
+
return this.hasPrevPage ? this.state.source(this.state.prevToken, this.state.pageSize) : Promise.reject(new Error("No previous page"));
|
2517
2525
|
}
|
2518
2526
|
}]);
|
2519
2527
|
|
@@ -3605,7 +3613,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3605
3613
|
pageToken: pageToken,
|
3606
3614
|
pageSize: pageSize
|
3607
3615
|
});
|
3608
|
-
}, response.body.meta.previous_token, response.body.meta.next_token));
|
3616
|
+
}, response.body.meta.previous_token, response.body.meta.next_token, options === null || options === void 0 ? void 0 : options.pageSize));
|
3609
3617
|
|
3610
3618
|
case 6:
|
3611
3619
|
case "end":
|
@@ -3803,6 +3811,38 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
3803
3811
|
|
3804
3812
|
return getChannelMetadata;
|
3805
3813
|
}()
|
3814
|
+
/**
|
3815
|
+
* Get recipients of the message.
|
3816
|
+
*/
|
3817
|
+
|
3818
|
+
}, {
|
3819
|
+
key: "getMessageRecipients",
|
3820
|
+
value: function () {
|
3821
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
|
3822
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
|
3823
|
+
while (1) {
|
3824
|
+
switch (_context11.prev = _context11.next) {
|
3825
|
+
case 0:
|
3826
|
+
_context11.next = 2;
|
3827
|
+
return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
|
3828
|
+
|
3829
|
+
case 2:
|
3830
|
+
return _context11.abrupt("return", _context11.sent);
|
3831
|
+
|
3832
|
+
case 3:
|
3833
|
+
case "end":
|
3834
|
+
return _context11.stop();
|
3835
|
+
}
|
3836
|
+
}
|
3837
|
+
}, _callee11, this);
|
3838
|
+
}));
|
3839
|
+
|
3840
|
+
function getMessageRecipients() {
|
3841
|
+
return _getMessageRecipients.apply(this, arguments);
|
3842
|
+
}
|
3843
|
+
|
3844
|
+
return getMessageRecipients;
|
3845
|
+
}()
|
3806
3846
|
}]);
|
3807
3847
|
|
3808
3848
|
return Message;
|
@@ -3852,11 +3892,11 @@ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
3852
3892
|
|
3853
3893
|
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; }
|
3854
3894
|
|
3855
|
-
function _createForOfIteratorHelper$
|
3895
|
+
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; } } }; }
|
3856
3896
|
|
3857
|
-
function _unsupportedIterableToArray$
|
3897
|
+
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); }
|
3858
3898
|
|
3859
|
-
function _arrayLikeToArray$
|
3899
|
+
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; }
|
3860
3900
|
|
3861
3901
|
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); }; }
|
3862
3902
|
|
@@ -4064,7 +4104,7 @@ var Messages = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
4064
4104
|
return request.cancel();
|
4065
4105
|
});
|
4066
4106
|
});
|
4067
|
-
_iterator = _createForOfIteratorHelper$
|
4107
|
+
_iterator = _createForOfIteratorHelper$4(message.mediaContent);
|
4068
4108
|
_context3.prev = 4;
|
4069
4109
|
|
4070
4110
|
_iterator.s();
|
@@ -4717,11 +4757,11 @@ __decorate([declarativeTypeValidator.validateTypes("string", [declarativeTypeVal
|
|
4717
4757
|
|
4718
4758
|
__decorate([declarativeTypeValidator.validateTypes([FormData, sendMediaOptions]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
|
4719
4759
|
|
4720
|
-
function _createForOfIteratorHelper$
|
4760
|
+
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; } } }; }
|
4721
4761
|
|
4722
|
-
function _unsupportedIterableToArray$
|
4762
|
+
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); }
|
4723
4763
|
|
4724
|
-
function _arrayLikeToArray$
|
4764
|
+
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; }
|
4725
4765
|
|
4726
4766
|
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); }; }
|
4727
4767
|
|
@@ -6007,41 +6047,74 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6007
6047
|
|
6008
6048
|
return updateUniqueName;
|
6009
6049
|
}()
|
6050
|
+
/**
|
6051
|
+
* Get recipients of all messages in the conversation.
|
6052
|
+
* @param options Optional configuration, set pageSize to request a specific pagination page size. Page size specifies a number of messages to include in a single batch. Each message may include multiple recipients.
|
6053
|
+
*/
|
6054
|
+
|
6055
|
+
}, {
|
6056
|
+
key: "getMessageRecipients",
|
6057
|
+
value: function () {
|
6058
|
+
var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
|
6059
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
|
6060
|
+
while (1) {
|
6061
|
+
switch (_context24.prev = _context24.next) {
|
6062
|
+
case 0:
|
6063
|
+
_context24.next = 2;
|
6064
|
+
return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
|
6065
|
+
|
6066
|
+
case 2:
|
6067
|
+
return _context24.abrupt("return", _context24.sent);
|
6068
|
+
|
6069
|
+
case 3:
|
6070
|
+
case "end":
|
6071
|
+
return _context24.stop();
|
6072
|
+
}
|
6073
|
+
}
|
6074
|
+
}, _callee24, this);
|
6075
|
+
}));
|
6076
|
+
|
6077
|
+
function getMessageRecipients(_x19) {
|
6078
|
+
return _getMessageRecipients.apply(this, arguments);
|
6079
|
+
}
|
6080
|
+
|
6081
|
+
return getMessageRecipients;
|
6082
|
+
}()
|
6010
6083
|
/**
|
6011
6084
|
* Load and subscribe to this conversation and do not subscribe to its
|
6012
6085
|
* participants and messages. This or _subscribeStreams will need to be called
|
6013
|
-
* before any events
|
6086
|
+
* before any events in the conversation will fire.
|
6014
6087
|
* @internal
|
6015
6088
|
*/
|
6016
6089
|
|
6017
6090
|
}, {
|
6018
6091
|
key: "_subscribe",
|
6019
6092
|
value: function () {
|
6020
|
-
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6093
|
+
var _subscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee25() {
|
6021
6094
|
var _this2 = this;
|
6022
6095
|
|
6023
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6096
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee25$(_context25) {
|
6024
6097
|
while (1) {
|
6025
|
-
switch (
|
6098
|
+
switch (_context25.prev = _context25.next) {
|
6026
6099
|
case 0:
|
6027
6100
|
if (!this._entityPromise) {
|
6028
|
-
|
6101
|
+
_context25.next = 2;
|
6029
6102
|
break;
|
6030
6103
|
}
|
6031
6104
|
|
6032
|
-
return
|
6105
|
+
return _context25.abrupt("return", this._entityPromise);
|
6033
6106
|
|
6034
6107
|
case 2:
|
6035
6108
|
this._entityPromise = this._services.syncClient.document({
|
6036
6109
|
id: this._entityName,
|
6037
6110
|
mode: "open_existing"
|
6038
6111
|
});
|
6039
|
-
|
6040
|
-
|
6112
|
+
_context25.prev = 3;
|
6113
|
+
_context25.next = 6;
|
6041
6114
|
return this._entityPromise;
|
6042
6115
|
|
6043
6116
|
case 6:
|
6044
|
-
this._entity =
|
6117
|
+
this._entity = _context25.sent;
|
6045
6118
|
|
6046
6119
|
this._entity.on("updated", function (args) {
|
6047
6120
|
return _this2._update(args.data);
|
@@ -6053,28 +6126,28 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6053
6126
|
|
6054
6127
|
this._update(this._entity.data);
|
6055
6128
|
|
6056
|
-
return
|
6129
|
+
return _context25.abrupt("return", this._entity);
|
6057
6130
|
|
6058
6131
|
case 13:
|
6059
|
-
|
6060
|
-
|
6132
|
+
_context25.prev = 13;
|
6133
|
+
_context25.t0 = _context25["catch"](3);
|
6061
6134
|
this._entity = null;
|
6062
6135
|
this._entityPromise = null;
|
6063
6136
|
|
6064
6137
|
if (this._services.syncClient.connectionState != "disconnected") {
|
6065
|
-
Conversation._logger.error("Failed to get conversation object",
|
6138
|
+
Conversation._logger.error("Failed to get conversation object", _context25.t0);
|
6066
6139
|
}
|
6067
6140
|
|
6068
|
-
Conversation._logger.debug("ERROR: Failed to get conversation object",
|
6141
|
+
Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
|
6069
6142
|
|
6070
|
-
throw
|
6143
|
+
throw _context25.t0;
|
6071
6144
|
|
6072
6145
|
case 20:
|
6073
6146
|
case "end":
|
6074
|
-
return
|
6147
|
+
return _context25.stop();
|
6075
6148
|
}
|
6076
6149
|
}
|
6077
|
-
},
|
6150
|
+
}, _callee25, this, [[3, 13]]);
|
6078
6151
|
}));
|
6079
6152
|
|
6080
6153
|
function _subscribe() {
|
@@ -6096,44 +6169,44 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6096
6169
|
}, {
|
6097
6170
|
key: "_fetchStreams",
|
6098
6171
|
value: function () {
|
6099
|
-
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6172
|
+
var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
|
6100
6173
|
var _this$_entity, _this$_entity2;
|
6101
6174
|
|
6102
6175
|
var data;
|
6103
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6176
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
|
6104
6177
|
while (1) {
|
6105
|
-
switch (
|
6178
|
+
switch (_context26.prev = _context26.next) {
|
6106
6179
|
case 0:
|
6107
|
-
|
6180
|
+
_context26.next = 2;
|
6108
6181
|
return this._subscribe();
|
6109
6182
|
|
6110
6183
|
case 2:
|
6111
6184
|
Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
|
6112
6185
|
|
6113
6186
|
data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
|
6114
|
-
|
6187
|
+
_context26.next = 6;
|
6115
6188
|
return this._services.syncClient.list({
|
6116
6189
|
id: data.messages,
|
6117
6190
|
mode: "open_existing"
|
6118
6191
|
});
|
6119
6192
|
|
6120
6193
|
case 6:
|
6121
|
-
this._messagesList =
|
6122
|
-
|
6194
|
+
this._messagesList = _context26.sent;
|
6195
|
+
_context26.next = 9;
|
6123
6196
|
return this._services.syncClient.map({
|
6124
6197
|
id: data.roster,
|
6125
6198
|
mode: "open_existing"
|
6126
6199
|
});
|
6127
6200
|
|
6128
6201
|
case 9:
|
6129
|
-
this._participantsMap =
|
6202
|
+
this._participantsMap = _context26.sent;
|
6130
6203
|
|
6131
6204
|
case 10:
|
6132
6205
|
case "end":
|
6133
|
-
return
|
6206
|
+
return _context26.stop();
|
6134
6207
|
}
|
6135
6208
|
}
|
6136
|
-
},
|
6209
|
+
}, _callee26, this);
|
6137
6210
|
}));
|
6138
6211
|
|
6139
6212
|
function _fetchStreams() {
|
@@ -6153,15 +6226,15 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6153
6226
|
}, {
|
6154
6227
|
key: "_subscribeStreams",
|
6155
6228
|
value: function () {
|
6156
|
-
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6229
|
+
var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
|
6157
6230
|
var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
|
6158
6231
|
|
6159
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6232
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
|
6160
6233
|
while (1) {
|
6161
|
-
switch (
|
6234
|
+
switch (_context27.prev = _context27.next) {
|
6162
6235
|
case 0:
|
6163
|
-
|
6164
|
-
|
6236
|
+
_context27.prev = 0;
|
6237
|
+
_context27.next = 3;
|
6165
6238
|
return this._subscribe();
|
6166
6239
|
|
6167
6240
|
case 3:
|
@@ -6170,31 +6243,31 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6170
6243
|
data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
|
6171
6244
|
messagesObjectName = data.messages;
|
6172
6245
|
rosterObjectName = data.roster;
|
6173
|
-
|
6246
|
+
_context27.next = 9;
|
6174
6247
|
return Promise.all([this._messagesEntity.subscribe((_this$_messagesList = this._messagesList) !== null && _this$_messagesList !== void 0 ? _this$_messagesList : messagesObjectName), this._participantsEntity.subscribe((_this$_participantsMa = this._participantsMap) !== null && _this$_participantsMa !== void 0 ? _this$_participantsMa : rosterObjectName)]);
|
6175
6248
|
|
6176
6249
|
case 9:
|
6177
|
-
|
6250
|
+
_context27.next = 16;
|
6178
6251
|
break;
|
6179
6252
|
|
6180
6253
|
case 11:
|
6181
|
-
|
6182
|
-
|
6254
|
+
_context27.prev = 11;
|
6255
|
+
_context27.t0 = _context27["catch"](0);
|
6183
6256
|
|
6184
6257
|
if (this._services.syncClient.connectionState !== "disconnected") {
|
6185
|
-
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid,
|
6258
|
+
Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6186
6259
|
}
|
6187
6260
|
|
6188
|
-
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid,
|
6261
|
+
Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
|
6189
6262
|
|
6190
|
-
throw
|
6263
|
+
throw _context27.t0;
|
6191
6264
|
|
6192
6265
|
case 16:
|
6193
6266
|
case "end":
|
6194
|
-
return
|
6267
|
+
return _context27.stop();
|
6195
6268
|
}
|
6196
6269
|
}
|
6197
|
-
},
|
6270
|
+
}, _callee27, this, [[0, 11]]);
|
6198
6271
|
}));
|
6199
6272
|
|
6200
6273
|
function _subscribeStreams() {
|
@@ -6211,17 +6284,17 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6211
6284
|
}, {
|
6212
6285
|
key: "_unsubscribe",
|
6213
6286
|
value: function () {
|
6214
|
-
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6215
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6287
|
+
var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
|
6288
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
|
6216
6289
|
while (1) {
|
6217
|
-
switch (
|
6290
|
+
switch (_context28.prev = _context28.next) {
|
6218
6291
|
case 0:
|
6219
6292
|
if (!this._entity) {
|
6220
|
-
|
6293
|
+
_context28.next = 5;
|
6221
6294
|
break;
|
6222
6295
|
}
|
6223
6296
|
|
6224
|
-
|
6297
|
+
_context28.next = 3;
|
6225
6298
|
return this._entity.close();
|
6226
6299
|
|
6227
6300
|
case 3:
|
@@ -6229,14 +6302,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6229
6302
|
this._entityPromise = null;
|
6230
6303
|
|
6231
6304
|
case 5:
|
6232
|
-
return
|
6305
|
+
return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
|
6233
6306
|
|
6234
6307
|
case 6:
|
6235
6308
|
case "end":
|
6236
|
-
return
|
6309
|
+
return _context28.stop();
|
6237
6310
|
}
|
6238
6311
|
}
|
6239
|
-
},
|
6312
|
+
}, _callee28, this);
|
6240
6313
|
}));
|
6241
6314
|
|
6242
6315
|
function _unsubscribe() {
|
@@ -6413,7 +6486,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6413
6486
|
}, {
|
6414
6487
|
key: "_onMessageAdded",
|
6415
6488
|
value: function _onMessageAdded(message) {
|
6416
|
-
var _iterator = _createForOfIteratorHelper$
|
6489
|
+
var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
|
6417
6490
|
_step;
|
6418
6491
|
|
6419
6492
|
try {
|
@@ -6442,30 +6515,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6442
6515
|
}, {
|
6443
6516
|
key: "_setLastReadMessageIndex",
|
6444
6517
|
value: function () {
|
6445
|
-
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
6518
|
+
var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29(index) {
|
6446
6519
|
var result;
|
6447
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
6520
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
|
6448
6521
|
while (1) {
|
6449
|
-
switch (
|
6522
|
+
switch (_context29.prev = _context29.next) {
|
6450
6523
|
case 0:
|
6451
|
-
|
6524
|
+
_context29.next = 2;
|
6452
6525
|
return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
|
6453
6526
|
last_read_message_index: index
|
6454
6527
|
});
|
6455
6528
|
|
6456
6529
|
case 2:
|
6457
|
-
result =
|
6458
|
-
return
|
6530
|
+
result = _context29.sent;
|
6531
|
+
return _context29.abrupt("return", result.unread_messages_count);
|
6459
6532
|
|
6460
6533
|
case 4:
|
6461
6534
|
case "end":
|
6462
|
-
return
|
6535
|
+
return _context29.stop();
|
6463
6536
|
}
|
6464
6537
|
}
|
6465
|
-
},
|
6538
|
+
}, _callee29, this);
|
6466
6539
|
}));
|
6467
6540
|
|
6468
|
-
function _setLastReadMessageIndex(
|
6541
|
+
function _setLastReadMessageIndex(_x20) {
|
6469
6542
|
return _setLastReadMessageIndex2.apply(this, arguments);
|
6470
6543
|
}
|
6471
6544
|
|
@@ -6545,7 +6618,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
|
|
6545
6618
|
|
6546
6619
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
|
6547
6620
|
|
6548
|
-
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
|
6621
|
+
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
|
6549
6622
|
|
6550
6623
|
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
|
6551
6624
|
|
@@ -6621,11 +6694,11 @@ var Deferred = /*#__PURE__*/function () {
|
|
6621
6694
|
return Deferred;
|
6622
6695
|
}();
|
6623
6696
|
|
6624
|
-
function _createForOfIteratorHelper$
|
6697
|
+
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; } } }; }
|
6625
6698
|
|
6626
|
-
function _unsupportedIterableToArray$
|
6699
|
+
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); }
|
6627
6700
|
|
6628
|
-
function _arrayLikeToArray$
|
6701
|
+
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; }
|
6629
6702
|
|
6630
6703
|
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; }
|
6631
6704
|
|
@@ -6805,7 +6878,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
|
|
6805
6878
|
case 9:
|
6806
6879
|
myConversations = _context2.sent;
|
6807
6880
|
upserts = [];
|
6808
|
-
_iterator = _createForOfIteratorHelper$
|
6881
|
+
_iterator = _createForOfIteratorHelper$2(myConversations);
|
6809
6882
|
|
6810
6883
|
try {
|
6811
6884
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
@@ -7887,7 +7960,7 @@ function PushNotification(data) {
|
|
7887
7960
|
this.data = data.data || {};
|
7888
7961
|
});
|
7889
7962
|
|
7890
|
-
var version = "2.
|
7963
|
+
var version = "2.5.0-rc.8";
|
7891
7964
|
|
7892
7965
|
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; }
|
7893
7966
|
|
@@ -8288,11 +8361,11 @@ var ContentClient = /*#__PURE__*/function () {
|
|
8288
8361
|
return ContentClient;
|
8289
8362
|
}();
|
8290
8363
|
|
8291
|
-
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; } } }; }
|
8364
|
+
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; } } }; }
|
8292
8365
|
|
8293
|
-
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); }
|
8366
|
+
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); }
|
8294
8367
|
|
8295
|
-
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; }
|
8368
|
+
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; }
|
8296
8369
|
|
8297
8370
|
var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
8298
8371
|
function QuickLRU() {
|
@@ -8321,7 +8394,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8321
8394
|
this._size = 0;
|
8322
8395
|
|
8323
8396
|
if (typeof this.onEviction === 'function') {
|
8324
|
-
var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
|
8397
|
+
var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
|
8325
8398
|
_step;
|
8326
8399
|
|
8327
8400
|
try {
|
@@ -8413,7 +8486,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8413
8486
|
while (1) {
|
8414
8487
|
switch (_context.prev = _context.next) {
|
8415
8488
|
case 0:
|
8416
|
-
_iterator2 = _createForOfIteratorHelper(this);
|
8489
|
+
_iterator2 = _createForOfIteratorHelper$1(this);
|
8417
8490
|
_context.prev = 1;
|
8418
8491
|
|
8419
8492
|
_iterator2.s();
|
@@ -8465,7 +8538,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8465
8538
|
while (1) {
|
8466
8539
|
switch (_context2.prev = _context2.next) {
|
8467
8540
|
case 0:
|
8468
|
-
_iterator3 = _createForOfIteratorHelper(this);
|
8541
|
+
_iterator3 = _createForOfIteratorHelper$1(this);
|
8469
8542
|
_context2.prev = 1;
|
8470
8543
|
|
8471
8544
|
_iterator3.s();
|
@@ -8517,7 +8590,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8517
8590
|
while (1) {
|
8518
8591
|
switch (_context3.prev = _context3.next) {
|
8519
8592
|
case 0:
|
8520
|
-
_iterator4 = _createForOfIteratorHelper(this.cache);
|
8593
|
+
_iterator4 = _createForOfIteratorHelper$1(this.cache);
|
8521
8594
|
_context3.prev = 1;
|
8522
8595
|
|
8523
8596
|
_iterator4.s();
|
@@ -8554,7 +8627,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8554
8627
|
return _context3.finish(14);
|
8555
8628
|
|
8556
8629
|
case 17:
|
8557
|
-
_iterator5 = _createForOfIteratorHelper(this.oldCache);
|
8630
|
+
_iterator5 = _createForOfIteratorHelper$1(this.oldCache);
|
8558
8631
|
_context3.prev = 18;
|
8559
8632
|
|
8560
8633
|
_iterator5.s();
|
@@ -8609,7 +8682,7 @@ var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
|
|
8609
8682
|
get: function get() {
|
8610
8683
|
var oldCacheSize = 0;
|
8611
8684
|
|
8612
|
-
var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
|
8685
|
+
var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
|
8613
8686
|
_step6;
|
8614
8687
|
|
8615
8688
|
try {
|
@@ -8746,6 +8819,206 @@ var ChannelMetadataClient = /*#__PURE__*/function () {
|
|
8746
8819
|
return ChannelMetadataClient;
|
8747
8820
|
}();
|
8748
8821
|
|
8822
|
+
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; } } }; }
|
8823
|
+
|
8824
|
+
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); }
|
8825
|
+
|
8826
|
+
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; }
|
8827
|
+
/**
|
8828
|
+
* Email recipient descriptor.
|
8829
|
+
*/
|
8830
|
+
|
8831
|
+
var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8832
|
+
/**
|
8833
|
+
* Type of recipient.
|
8834
|
+
*/
|
8835
|
+
|
8836
|
+
/**
|
8837
|
+
* @internal
|
8838
|
+
*/
|
8839
|
+
function EmailRecipientDescriptor(recipient) {
|
8840
|
+
_classCallCheck__default["default"](this, EmailRecipientDescriptor);
|
8841
|
+
|
8842
|
+
_defineProperty__default["default"](this, "type", "email");
|
8843
|
+
|
8844
|
+
this.messageSid = recipient.message_sid;
|
8845
|
+
this.level = recipient.level;
|
8846
|
+
this.name = recipient.name;
|
8847
|
+
this.address = recipient.address;
|
8848
|
+
});
|
8849
|
+
/**
|
8850
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
8851
|
+
* are not supported by the current version of the SDK.
|
8852
|
+
*/
|
8853
|
+
|
8854
|
+
|
8855
|
+
var UnknownRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
|
8856
|
+
/**
|
8857
|
+
* Type of recipient.
|
8858
|
+
*/
|
8859
|
+
|
8860
|
+
/**
|
8861
|
+
* Sid of the message that this recipient belongs to.
|
8862
|
+
*/
|
8863
|
+
|
8864
|
+
/**
|
8865
|
+
* Recipient data as a JSON string.
|
8866
|
+
*/
|
8867
|
+
|
8868
|
+
/**
|
8869
|
+
* @internal
|
8870
|
+
*/
|
8871
|
+
function UnknownRecipientDescriptor(recipient) {
|
8872
|
+
_classCallCheck__default["default"](this, UnknownRecipientDescriptor);
|
8873
|
+
|
8874
|
+
this.type = recipient.type;
|
8875
|
+
this.messageSid = recipient.message_sid;
|
8876
|
+
this.rawData = JSON.stringify(recipient);
|
8877
|
+
});
|
8878
|
+
|
8879
|
+
var MessageRecipientsClient = /*#__PURE__*/function () {
|
8880
|
+
function MessageRecipientsClient(services, configuration) {
|
8881
|
+
_classCallCheck__default["default"](this, MessageRecipientsClient);
|
8882
|
+
|
8883
|
+
this._services = services;
|
8884
|
+
this._configuration = configuration;
|
8885
|
+
this._cache = new quickLru({
|
8886
|
+
maxSize: configuration.messageRecipientsCacheCapacity
|
8887
|
+
});
|
8888
|
+
}
|
8889
|
+
|
8890
|
+
_createClass__default["default"](MessageRecipientsClient, [{
|
8891
|
+
key: "getRecipientsFromMessage",
|
8892
|
+
value: function () {
|
8893
|
+
var _getRecipientsFromMessage = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(conversationSid, messageSid) {
|
8894
|
+
var _this = this;
|
8895
|
+
|
8896
|
+
var key, cachedItem, url, recipientsResponse, recipients;
|
8897
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
8898
|
+
while (1) {
|
8899
|
+
switch (_context.prev = _context.next) {
|
8900
|
+
case 0:
|
8901
|
+
key = "".concat(conversationSid, ",").concat(messageSid);
|
8902
|
+
cachedItem = this._cache.get(key);
|
8903
|
+
|
8904
|
+
if (!cachedItem) {
|
8905
|
+
_context.next = 4;
|
8906
|
+
break;
|
8907
|
+
}
|
8908
|
+
|
8909
|
+
return _context.abrupt("return", cachedItem.item);
|
8910
|
+
|
8911
|
+
case 4:
|
8912
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
|
8913
|
+
_context.next = 7;
|
8914
|
+
return this._services.commandExecutor.fetchResource(url);
|
8915
|
+
|
8916
|
+
case 7:
|
8917
|
+
recipientsResponse = _context.sent;
|
8918
|
+
recipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8919
|
+
return _this._wrapResponse(recipient);
|
8920
|
+
});
|
8921
|
+
|
8922
|
+
if (recipients.length > 0) {
|
8923
|
+
this._cache.set(key, {
|
8924
|
+
item: recipients
|
8925
|
+
});
|
8926
|
+
}
|
8927
|
+
|
8928
|
+
return _context.abrupt("return", recipients);
|
8929
|
+
|
8930
|
+
case 11:
|
8931
|
+
case "end":
|
8932
|
+
return _context.stop();
|
8933
|
+
}
|
8934
|
+
}
|
8935
|
+
}, _callee, this);
|
8936
|
+
}));
|
8937
|
+
|
8938
|
+
function getRecipientsFromMessage(_x, _x2) {
|
8939
|
+
return _getRecipientsFromMessage.apply(this, arguments);
|
8940
|
+
}
|
8941
|
+
|
8942
|
+
return getRecipientsFromMessage;
|
8943
|
+
}()
|
8944
|
+
}, {
|
8945
|
+
key: "getRecipientsFromConversation",
|
8946
|
+
value: function () {
|
8947
|
+
var _getRecipientsFromConversation = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(conversationSid, paginatorOptions) {
|
8948
|
+
var _paginatorOptions$pag,
|
8949
|
+
_paginatorOptions$pag2,
|
8950
|
+
_this2 = this;
|
8951
|
+
|
8952
|
+
var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
|
8953
|
+
|
8954
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
8955
|
+
while (1) {
|
8956
|
+
switch (_context2.prev = _context2.next) {
|
8957
|
+
case 0:
|
8958
|
+
url = new UriBuilder(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("PageToken", (_paginatorOptions$pag = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _paginatorOptions$pag !== void 0 ? _paginatorOptions$pag : undefined).arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : undefined).build();
|
8959
|
+
_context2.next = 3;
|
8960
|
+
return this._services.commandExecutor.fetchResource(url);
|
8961
|
+
|
8962
|
+
case 3:
|
8963
|
+
recipientsResponse = _context2.sent;
|
8964
|
+
allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
|
8965
|
+
return _this2._wrapResponse(recipient);
|
8966
|
+
});
|
8967
|
+
_iterator = _createForOfIteratorHelper(allRecipients);
|
8968
|
+
|
8969
|
+
try {
|
8970
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
8971
|
+
recipient = _step.value;
|
8972
|
+
key = "".concat(conversationSid, ",").concat(recipient.messageSid);
|
8973
|
+
existingMessageRecipients = (_this$_cache$get$item = (_this$_cache$get = this._cache.get(key)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.item) !== null && _this$_cache$get$item !== void 0 ? _this$_cache$get$item : [];
|
8974
|
+
|
8975
|
+
this._cache.set(key, {
|
8976
|
+
item: [].concat(_toConsumableArray__default["default"](existingMessageRecipients), [recipient])
|
8977
|
+
});
|
8978
|
+
}
|
8979
|
+
} catch (err) {
|
8980
|
+
_iterator.e(err);
|
8981
|
+
} finally {
|
8982
|
+
_iterator.f();
|
8983
|
+
}
|
8984
|
+
|
8985
|
+
return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
|
8986
|
+
return _this2.getRecipientsFromConversation(conversationSid, {
|
8987
|
+
pageToken: pageToken,
|
8988
|
+
pageSize: pageSize
|
8989
|
+
});
|
8990
|
+
}, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token, paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize));
|
8991
|
+
|
8992
|
+
case 8:
|
8993
|
+
case "end":
|
8994
|
+
return _context2.stop();
|
8995
|
+
}
|
8996
|
+
}
|
8997
|
+
}, _callee2, this);
|
8998
|
+
}));
|
8999
|
+
|
9000
|
+
function getRecipientsFromConversation(_x3, _x4) {
|
9001
|
+
return _getRecipientsFromConversation.apply(this, arguments);
|
9002
|
+
}
|
9003
|
+
|
9004
|
+
return getRecipientsFromConversation;
|
9005
|
+
}()
|
9006
|
+
}, {
|
9007
|
+
key: "_wrapResponse",
|
9008
|
+
value: function _wrapResponse(recipient) {
|
9009
|
+
switch (recipient.type) {
|
9010
|
+
case "email":
|
9011
|
+
return new EmailRecipientDescriptor(recipient);
|
9012
|
+
|
9013
|
+
default:
|
9014
|
+
return new UnknownRecipientDescriptor(recipient);
|
9015
|
+
}
|
9016
|
+
}
|
9017
|
+
}]);
|
9018
|
+
|
9019
|
+
return MessageRecipientsClient;
|
9020
|
+
}();
|
9021
|
+
|
8749
9022
|
var _class;
|
8750
9023
|
|
8751
9024
|
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; }
|
@@ -9967,6 +10240,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
9967
10240
|
configurationResponse = _context17.sent;
|
9968
10241
|
this._configuration = new Configuration(this._options, configurationResponse, Client_1._logger);
|
9969
10242
|
this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
|
10243
|
+
this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
|
9970
10244
|
|
9971
10245
|
this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
|
9972
10246
|
|
@@ -10045,10 +10319,10 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10045
10319
|
}).catch(function (error) {
|
10046
10320
|
throw error;
|
10047
10321
|
});
|
10048
|
-
_context17.next =
|
10322
|
+
_context17.next = 30;
|
10049
10323
|
return this._services.users.myself._ensureFetched();
|
10050
10324
|
|
10051
|
-
case
|
10325
|
+
case 30:
|
10052
10326
|
Client_1._supportedPushChannels.forEach(function (channelType) {
|
10053
10327
|
return _this3._subscribeToPushNotifications(channelType);
|
10054
10328
|
});
|
@@ -10064,7 +10338,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
|
|
10064
10338
|
this.emit("stateChanged", "initialized");
|
10065
10339
|
this.emit("initialized");
|
10066
10340
|
|
10067
|
-
case
|
10341
|
+
case 36:
|
10068
10342
|
case "end":
|
10069
10343
|
return _context17.stop();
|
10070
10344
|
}
|
@@ -10324,6 +10598,7 @@ exports.ContentTemplate = ContentTemplate;
|
|
10324
10598
|
exports.ContentTemplateVariable = ContentTemplateVariable;
|
10325
10599
|
exports.Conversation = Conversation;
|
10326
10600
|
exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
|
10601
|
+
exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
|
10327
10602
|
exports.Media = Media;
|
10328
10603
|
exports.Message = Message;
|
10329
10604
|
exports.MessageBuilder = MessageBuilder;
|
@@ -10331,6 +10606,7 @@ exports.NotificationTypes = NotificationTypes;
|
|
10331
10606
|
exports.Participant = Participant;
|
10332
10607
|
exports.PushNotification = PushNotification;
|
10333
10608
|
exports.RestPaginator = RestPaginator;
|
10609
|
+
exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
|
10334
10610
|
exports.UnsentMessage = UnsentMessage;
|
10335
10611
|
exports.User = User;
|
10336
10612
|
//# sourceMappingURL=browser.js.map
|