@twilio/conversations 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/builds/lib.d.ts CHANGED
@@ -2165,6 +2165,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2165
2165
  * Promise for the conversation entity document.
2166
2166
  */
2167
2167
  private _entityPromise;
2168
+ /**
2169
+ * Promise for the messages list.
2170
+ */
2171
+ private _streamsPromise;
2168
2172
  /**
2169
2173
  * Conversation entity document.
2170
2174
  */
@@ -2447,7 +2451,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2447
2451
  * will throw an exception that will be caught and handled gracefully.
2448
2452
  * @internal
2449
2453
  */
2450
- _fetchStreams(): Promise<void>;
2454
+ _fetchStreams(): Promise<boolean>;
2451
2455
  /**
2452
2456
  * Load the attributes of this conversation and instantiate its participants
2453
2457
  * and messages. This or _subscribe will need to be called before any events
@@ -2165,6 +2165,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2165
2165
  * Promise for the conversation entity document.
2166
2166
  */
2167
2167
  private _entityPromise;
2168
+ /**
2169
+ * Promise for the messages list.
2170
+ */
2171
+ private _streamsPromise;
2168
2172
  /**
2169
2173
  * Conversation entity document.
2170
2174
  */
@@ -2447,7 +2451,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2447
2451
  * will throw an exception that will be caught and handled gracefully.
2448
2452
  * @internal
2449
2453
  */
2450
- _fetchStreams(): Promise<void>;
2454
+ _fetchStreams(): Promise<boolean>;
2451
2455
  /**
2452
2456
  * Load the attributes of this conversation and instantiate its participants
2453
2457
  * and messages. This or _subscribe will need to be called before any events
package/builds/lib.esm.js CHANGED
@@ -4958,6 +4958,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4958
4958
  * Promise for the conversation entity document.
4959
4959
  */
4960
4960
 
4961
+ /**
4962
+ * Promise for the messages list.
4963
+ */
4964
+
4961
4965
  /**
4962
4966
  * Conversation entity document.
4963
4967
  */
@@ -6240,44 +6244,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6240
6244
  }, {
6241
6245
  key: "_fetchStreams",
6242
6246
  value: function () {
6243
- var _fetchStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
6244
- var _this$_entity, _this$_entity2;
6247
+ var _fetchStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
6248
+ var _this3 = this;
6245
6249
 
6246
- var data;
6247
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
6250
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
6248
6251
  while (1) {
6249
- switch (_context26.prev = _context26.next) {
6252
+ switch (_context27.prev = _context27.next) {
6250
6253
  case 0:
6251
- _context26.next = 2;
6252
- return this._subscribe();
6254
+ if (!this._streamsPromise) {
6255
+ _context27.next = 2;
6256
+ break;
6257
+ }
6253
6258
 
6254
- case 2:
6255
- Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
6259
+ return _context27.abrupt("return", this._streamsPromise);
6256
6260
 
6257
- data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
6258
- _context26.next = 6;
6259
- return this._services.syncClient.list({
6260
- id: data.messages,
6261
- mode: "open_existing"
6262
- });
6261
+ case 2:
6262
+ this._streamsPromise = new Promise( /*#__PURE__*/function () {
6263
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(resolve, reject) {
6264
+ var _this3$_entity, _this3$_entity2;
6265
+
6266
+ var data, messagesPromise, participantsPromise;
6267
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
6268
+ while (1) {
6269
+ switch (_context26.prev = _context26.next) {
6270
+ case 0:
6271
+ _context26.prev = 0;
6272
+ _context26.next = 3;
6273
+ return _this3._subscribe();
6274
+
6275
+ case 3:
6276
+ _context26.next = 9;
6277
+ break;
6263
6278
 
6264
- case 6:
6265
- this._messagesList = _context26.sent;
6266
- _context26.next = 9;
6267
- return this._services.syncClient.map({
6268
- id: data.roster,
6269
- mode: "open_existing"
6270
- });
6279
+ case 5:
6280
+ _context26.prev = 5;
6281
+ _context26.t0 = _context26["catch"](0);
6282
+
6283
+ Conversation._logger.trace("Failed to subscribe to conversation", _context26.t0);
6284
+
6285
+ return _context26.abrupt("return", reject(_context26.t0));
6286
+
6287
+ case 9:
6288
+ Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this3$_entity = _this3._entity) === null || _this3$_entity === void 0 ? void 0 : _this3$_entity.data);
6289
+
6290
+ data = (_this3$_entity2 = _this3._entity) === null || _this3$_entity2 === void 0 ? void 0 : _this3$_entity2.data;
6291
+ messagesPromise = _this3._services.syncClient.list({
6292
+ id: data.messages,
6293
+ mode: "open_existing"
6294
+ }).then(function (list) {
6295
+ _this3._messagesList = list;
6296
+ return list;
6297
+ });
6298
+ participantsPromise = _this3._services.syncClient.map({
6299
+ id: data.roster,
6300
+ mode: "open_existing"
6301
+ }).then(function (map) {
6302
+ _this3._participantsMap = map;
6303
+ return map;
6304
+ });
6305
+ Promise.all([messagesPromise, participantsPromise]).then(function () {
6306
+ return resolve(true);
6307
+ }).catch(function (err) {
6308
+ Conversation._logger.trace("Failed to fetch conversation streams for conversation", _this3.sid, err);
6309
+
6310
+ reject(err);
6311
+ });
6312
+
6313
+ case 14:
6314
+ case "end":
6315
+ return _context26.stop();
6316
+ }
6317
+ }
6318
+ }, _callee26, null, [[0, 5]]);
6319
+ }));
6271
6320
 
6272
- case 9:
6273
- this._participantsMap = _context26.sent;
6321
+ return function (_x20, _x21) {
6322
+ return _ref.apply(this, arguments);
6323
+ };
6324
+ }());
6325
+ return _context27.abrupt("return", this._streamsPromise.catch(function (err) {
6326
+ _this3._streamsPromise = null;
6327
+ throw err;
6328
+ }));
6274
6329
 
6275
- case 10:
6330
+ case 4:
6276
6331
  case "end":
6277
- return _context26.stop();
6332
+ return _context27.stop();
6278
6333
  }
6279
6334
  }
6280
- }, _callee26, this);
6335
+ }, _callee27, this);
6281
6336
  }));
6282
6337
 
6283
6338
  function _fetchStreams() {
@@ -6297,48 +6352,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6297
6352
  }, {
6298
6353
  key: "_subscribeStreams",
6299
6354
  value: function () {
6300
- var _subscribeStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
6301
- var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
6355
+ var _subscribeStreams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
6356
+ var _this$_entity, _this$_entity2, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
6302
6357
 
6303
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
6358
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
6304
6359
  while (1) {
6305
- switch (_context27.prev = _context27.next) {
6360
+ switch (_context28.prev = _context28.next) {
6306
6361
  case 0:
6307
- _context27.prev = 0;
6308
- _context27.next = 3;
6309
- return this._subscribe();
6362
+ _context28.prev = 0;
6363
+ _context28.next = 3;
6364
+ return this._fetchStreams();
6310
6365
 
6311
6366
  case 3:
6312
- Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity3 = this._entity) === null || _this$_entity3 === void 0 ? void 0 : _this$_entity3.data);
6367
+ Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
6313
6368
 
6314
- data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
6369
+ data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
6315
6370
  messagesObjectName = data.messages;
6316
6371
  rosterObjectName = data.roster;
6317
- _context27.next = 9;
6372
+ _context28.next = 9;
6318
6373
  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)]);
6319
6374
 
6320
6375
  case 9:
6321
- _context27.next = 16;
6376
+ _context28.next = 16;
6322
6377
  break;
6323
6378
 
6324
6379
  case 11:
6325
- _context27.prev = 11;
6326
- _context27.t0 = _context27["catch"](0);
6380
+ _context28.prev = 11;
6381
+ _context28.t0 = _context28["catch"](0);
6327
6382
 
6328
6383
  if (this._services.syncClient.connectionState !== "disconnected") {
6329
- Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
6384
+ Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context28.t0);
6330
6385
  }
6331
6386
 
6332
- Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
6387
+ Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context28.t0);
6333
6388
 
6334
- throw _context27.t0;
6389
+ throw _context28.t0;
6335
6390
 
6336
6391
  case 16:
6337
6392
  case "end":
6338
- return _context27.stop();
6393
+ return _context28.stop();
6339
6394
  }
6340
6395
  }
6341
- }, _callee27, this, [[0, 11]]);
6396
+ }, _callee28, this, [[0, 11]]);
6342
6397
  }));
6343
6398
 
6344
6399
  function _subscribeStreams() {
@@ -6355,10 +6410,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6355
6410
  }, {
6356
6411
  key: "_unsubscribe",
6357
6412
  value: function () {
6358
- var _unsubscribe2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
6359
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
6413
+ var _unsubscribe2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
6414
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
6360
6415
  while (1) {
6361
- switch (_context28.prev = _context28.next) {
6416
+ switch (_context29.prev = _context29.next) {
6362
6417
  case 0:
6363
6418
  if (this._entity) {
6364
6419
  this._entity.close();
@@ -6367,14 +6422,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6367
6422
  this._entityPromise = null;
6368
6423
  }
6369
6424
 
6370
- return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6425
+ return _context29.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6371
6426
 
6372
6427
  case 2:
6373
6428
  case "end":
6374
- return _context28.stop();
6429
+ return _context29.stop();
6375
6430
  }
6376
6431
  }
6377
- }, _callee28, this);
6432
+ }, _callee29, this);
6378
6433
  }));
6379
6434
 
6380
6435
  function _unsubscribe() {
@@ -6391,7 +6446,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6391
6446
  }, {
6392
6447
  key: "_setStatus",
6393
6448
  value: function _setStatus(status, source) {
6394
- var _this3 = this;
6449
+ var _this4 = this;
6395
6450
 
6396
6451
  this._dataSource = source;
6397
6452
 
@@ -6405,7 +6460,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6405
6460
  this._subscribeStreams().catch(function (err) {
6406
6461
  Conversation._logger.debug("ERROR while setting conversation status " + status, err);
6407
6462
 
6408
- if (_this3._services.syncClient.connectionState !== "disconnected") {
6463
+ if (_this4._services.syncClient.connectionState !== "disconnected") {
6409
6464
  throw err;
6410
6465
  }
6411
6466
  });
@@ -6417,7 +6472,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6417
6472
  this._unsubscribe().catch(function (err) {
6418
6473
  Conversation._logger.debug("ERROR while setting conversation status " + status, err);
6419
6474
 
6420
- if (_this3._services.syncClient.connectionState !== "disconnected") {
6475
+ if (_this4._services.syncClient.connectionState !== "disconnected") {
6421
6476
  throw err;
6422
6477
  }
6423
6478
  });
@@ -6580,30 +6635,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6580
6635
  }, {
6581
6636
  key: "_setLastReadMessageIndex",
6582
6637
  value: function () {
6583
- var _setLastReadMessageIndex2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(index) {
6638
+ var _setLastReadMessageIndex2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(index) {
6584
6639
  var result;
6585
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
6640
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
6586
6641
  while (1) {
6587
- switch (_context29.prev = _context29.next) {
6642
+ switch (_context30.prev = _context30.next) {
6588
6643
  case 0:
6589
- _context29.next = 2;
6644
+ _context30.next = 2;
6590
6645
  return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
6591
6646
  last_read_message_index: index
6592
6647
  });
6593
6648
 
6594
6649
  case 2:
6595
- result = _context29.sent;
6596
- return _context29.abrupt("return", result.unread_messages_count);
6650
+ result = _context30.sent;
6651
+ return _context30.abrupt("return", result.unread_messages_count);
6597
6652
 
6598
6653
  case 4:
6599
6654
  case "end":
6600
- return _context29.stop();
6655
+ return _context30.stop();
6601
6656
  }
6602
6657
  }
6603
- }, _callee29, this);
6658
+ }, _callee30, this);
6604
6659
  }));
6605
6660
 
6606
- function _setLastReadMessageIndex(_x20) {
6661
+ function _setLastReadMessageIndex(_x22) {
6607
6662
  return _setLastReadMessageIndex2.apply(this, arguments);
6608
6663
  }
6609
6664
 
@@ -8030,7 +8085,7 @@ function PushNotification(data) {
8030
8085
  this.data = data.data || {};
8031
8086
  });
8032
8087
 
8033
- var version = "2.6.4";
8088
+ var version = "2.6.5";
8034
8089
 
8035
8090
  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; }
8036
8091
 
package/builds/lib.js CHANGED
@@ -4997,6 +4997,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4997
4997
  * Promise for the conversation entity document.
4998
4998
  */
4999
4999
 
5000
+ /**
5001
+ * Promise for the messages list.
5002
+ */
5003
+
5000
5004
  /**
5001
5005
  * Conversation entity document.
5002
5006
  */
@@ -6279,44 +6283,95 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6279
6283
  }, {
6280
6284
  key: "_fetchStreams",
6281
6285
  value: function () {
6282
- var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26() {
6283
- var _this$_entity, _this$_entity2;
6286
+ var _fetchStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
6287
+ var _this3 = this;
6284
6288
 
6285
- var data;
6286
- return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
6289
+ return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
6287
6290
  while (1) {
6288
- switch (_context26.prev = _context26.next) {
6291
+ switch (_context27.prev = _context27.next) {
6289
6292
  case 0:
6290
- _context26.next = 2;
6291
- return this._subscribe();
6293
+ if (!this._streamsPromise) {
6294
+ _context27.next = 2;
6295
+ break;
6296
+ }
6292
6297
 
6293
- case 2:
6294
- Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
6298
+ return _context27.abrupt("return", this._streamsPromise);
6295
6299
 
6296
- data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
6297
- _context26.next = 6;
6298
- return this._services.syncClient.list({
6299
- id: data.messages,
6300
- mode: "open_existing"
6301
- });
6300
+ case 2:
6301
+ this._streamsPromise = new Promise( /*#__PURE__*/function () {
6302
+ var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee26(resolve, reject) {
6303
+ var _this3$_entity, _this3$_entity2;
6304
+
6305
+ var data, messagesPromise, participantsPromise;
6306
+ return _regeneratorRuntime__default["default"].wrap(function _callee26$(_context26) {
6307
+ while (1) {
6308
+ switch (_context26.prev = _context26.next) {
6309
+ case 0:
6310
+ _context26.prev = 0;
6311
+ _context26.next = 3;
6312
+ return _this3._subscribe();
6313
+
6314
+ case 3:
6315
+ _context26.next = 9;
6316
+ break;
6302
6317
 
6303
- case 6:
6304
- this._messagesList = _context26.sent;
6305
- _context26.next = 9;
6306
- return this._services.syncClient.map({
6307
- id: data.roster,
6308
- mode: "open_existing"
6309
- });
6318
+ case 5:
6319
+ _context26.prev = 5;
6320
+ _context26.t0 = _context26["catch"](0);
6321
+
6322
+ Conversation._logger.trace("Failed to subscribe to conversation", _context26.t0);
6323
+
6324
+ return _context26.abrupt("return", reject(_context26.t0));
6325
+
6326
+ case 9:
6327
+ Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this3$_entity = _this3._entity) === null || _this3$_entity === void 0 ? void 0 : _this3$_entity.data);
6328
+
6329
+ data = (_this3$_entity2 = _this3._entity) === null || _this3$_entity2 === void 0 ? void 0 : _this3$_entity2.data;
6330
+ messagesPromise = _this3._services.syncClient.list({
6331
+ id: data.messages,
6332
+ mode: "open_existing"
6333
+ }).then(function (list) {
6334
+ _this3._messagesList = list;
6335
+ return list;
6336
+ });
6337
+ participantsPromise = _this3._services.syncClient.map({
6338
+ id: data.roster,
6339
+ mode: "open_existing"
6340
+ }).then(function (map) {
6341
+ _this3._participantsMap = map;
6342
+ return map;
6343
+ });
6344
+ Promise.all([messagesPromise, participantsPromise]).then(function () {
6345
+ return resolve(true);
6346
+ }).catch(function (err) {
6347
+ Conversation._logger.trace("Failed to fetch conversation streams for conversation", _this3.sid, err);
6348
+
6349
+ reject(err);
6350
+ });
6351
+
6352
+ case 14:
6353
+ case "end":
6354
+ return _context26.stop();
6355
+ }
6356
+ }
6357
+ }, _callee26, null, [[0, 5]]);
6358
+ }));
6310
6359
 
6311
- case 9:
6312
- this._participantsMap = _context26.sent;
6360
+ return function (_x20, _x21) {
6361
+ return _ref.apply(this, arguments);
6362
+ };
6363
+ }());
6364
+ return _context27.abrupt("return", this._streamsPromise.catch(function (err) {
6365
+ _this3._streamsPromise = null;
6366
+ throw err;
6367
+ }));
6313
6368
 
6314
- case 10:
6369
+ case 4:
6315
6370
  case "end":
6316
- return _context26.stop();
6371
+ return _context27.stop();
6317
6372
  }
6318
6373
  }
6319
- }, _callee26, this);
6374
+ }, _callee27, this);
6320
6375
  }));
6321
6376
 
6322
6377
  function _fetchStreams() {
@@ -6336,48 +6391,48 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6336
6391
  }, {
6337
6392
  key: "_subscribeStreams",
6338
6393
  value: function () {
6339
- var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee27() {
6340
- var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
6394
+ var _subscribeStreams2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
6395
+ var _this$_entity, _this$_entity2, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
6341
6396
 
6342
- return _regeneratorRuntime__default["default"].wrap(function _callee27$(_context27) {
6397
+ return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
6343
6398
  while (1) {
6344
- switch (_context27.prev = _context27.next) {
6399
+ switch (_context28.prev = _context28.next) {
6345
6400
  case 0:
6346
- _context27.prev = 0;
6347
- _context27.next = 3;
6348
- return this._subscribe();
6401
+ _context28.prev = 0;
6402
+ _context28.next = 3;
6403
+ return this._fetchStreams();
6349
6404
 
6350
6405
  case 3:
6351
- Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity3 = this._entity) === null || _this$_entity3 === void 0 ? void 0 : _this$_entity3.data);
6406
+ Conversation._logger.trace("_subscribeStreams, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
6352
6407
 
6353
- data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
6408
+ data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
6354
6409
  messagesObjectName = data.messages;
6355
6410
  rosterObjectName = data.roster;
6356
- _context27.next = 9;
6411
+ _context28.next = 9;
6357
6412
  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)]);
6358
6413
 
6359
6414
  case 9:
6360
- _context27.next = 16;
6415
+ _context28.next = 16;
6361
6416
  break;
6362
6417
 
6363
6418
  case 11:
6364
- _context27.prev = 11;
6365
- _context27.t0 = _context27["catch"](0);
6419
+ _context28.prev = 11;
6420
+ _context28.t0 = _context28["catch"](0);
6366
6421
 
6367
6422
  if (this._services.syncClient.connectionState !== "disconnected") {
6368
- Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
6423
+ Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context28.t0);
6369
6424
  }
6370
6425
 
6371
- Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
6426
+ Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context28.t0);
6372
6427
 
6373
- throw _context27.t0;
6428
+ throw _context28.t0;
6374
6429
 
6375
6430
  case 16:
6376
6431
  case "end":
6377
- return _context27.stop();
6432
+ return _context28.stop();
6378
6433
  }
6379
6434
  }
6380
- }, _callee27, this, [[0, 11]]);
6435
+ }, _callee28, this, [[0, 11]]);
6381
6436
  }));
6382
6437
 
6383
6438
  function _subscribeStreams() {
@@ -6394,10 +6449,10 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6394
6449
  }, {
6395
6450
  key: "_unsubscribe",
6396
6451
  value: function () {
6397
- var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee28() {
6398
- return _regeneratorRuntime__default["default"].wrap(function _callee28$(_context28) {
6452
+ var _unsubscribe2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29() {
6453
+ return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
6399
6454
  while (1) {
6400
- switch (_context28.prev = _context28.next) {
6455
+ switch (_context29.prev = _context29.next) {
6401
6456
  case 0:
6402
6457
  if (this._entity) {
6403
6458
  this._entity.close();
@@ -6406,14 +6461,14 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6406
6461
  this._entityPromise = null;
6407
6462
  }
6408
6463
 
6409
- return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6464
+ return _context29.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6410
6465
 
6411
6466
  case 2:
6412
6467
  case "end":
6413
- return _context28.stop();
6468
+ return _context29.stop();
6414
6469
  }
6415
6470
  }
6416
- }, _callee28, this);
6471
+ }, _callee29, this);
6417
6472
  }));
6418
6473
 
6419
6474
  function _unsubscribe() {
@@ -6430,7 +6485,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6430
6485
  }, {
6431
6486
  key: "_setStatus",
6432
6487
  value: function _setStatus(status, source) {
6433
- var _this3 = this;
6488
+ var _this4 = this;
6434
6489
 
6435
6490
  this._dataSource = source;
6436
6491
 
@@ -6444,7 +6499,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6444
6499
  this._subscribeStreams().catch(function (err) {
6445
6500
  Conversation._logger.debug("ERROR while setting conversation status " + status, err);
6446
6501
 
6447
- if (_this3._services.syncClient.connectionState !== "disconnected") {
6502
+ if (_this4._services.syncClient.connectionState !== "disconnected") {
6448
6503
  throw err;
6449
6504
  }
6450
6505
  });
@@ -6456,7 +6511,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6456
6511
  this._unsubscribe().catch(function (err) {
6457
6512
  Conversation._logger.debug("ERROR while setting conversation status " + status, err);
6458
6513
 
6459
- if (_this3._services.syncClient.connectionState !== "disconnected") {
6514
+ if (_this4._services.syncClient.connectionState !== "disconnected") {
6460
6515
  throw err;
6461
6516
  }
6462
6517
  });
@@ -6619,30 +6674,30 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6619
6674
  }, {
6620
6675
  key: "_setLastReadMessageIndex",
6621
6676
  value: function () {
6622
- var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee29(index) {
6677
+ var _setLastReadMessageIndex2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee30(index) {
6623
6678
  var result;
6624
- return _regeneratorRuntime__default["default"].wrap(function _callee29$(_context29) {
6679
+ return _regeneratorRuntime__default["default"].wrap(function _callee30$(_context30) {
6625
6680
  while (1) {
6626
- switch (_context29.prev = _context29.next) {
6681
+ switch (_context30.prev = _context30.next) {
6627
6682
  case 0:
6628
- _context29.next = 2;
6683
+ _context30.next = 2;
6629
6684
  return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
6630
6685
  last_read_message_index: index
6631
6686
  });
6632
6687
 
6633
6688
  case 2:
6634
- result = _context29.sent;
6635
- return _context29.abrupt("return", result.unread_messages_count);
6689
+ result = _context30.sent;
6690
+ return _context30.abrupt("return", result.unread_messages_count);
6636
6691
 
6637
6692
  case 4:
6638
6693
  case "end":
6639
- return _context29.stop();
6694
+ return _context30.stop();
6640
6695
  }
6641
6696
  }
6642
- }, _callee29, this);
6697
+ }, _callee30, this);
6643
6698
  }));
6644
6699
 
6645
- function _setLastReadMessageIndex(_x20) {
6700
+ function _setLastReadMessageIndex(_x22) {
6646
6701
  return _setLastReadMessageIndex2.apply(this, arguments);
6647
6702
  }
6648
6703
 
@@ -8069,7 +8124,7 @@ function PushNotification(data) {
8069
8124
  this.data = data.data || {};
8070
8125
  });
8071
8126
 
8072
- var version = "2.6.4";
8127
+ var version = "2.6.5";
8073
8128
 
8074
8129
  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; }
8075
8130