@twilio/conversations 2.5.0-rc.0 → 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/builds/lib.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
3
2
  import { LogLevelDesc } from "loglevel";
4
3
  import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
@@ -1241,6 +1240,9 @@ interface Paginator<T> {
1241
1240
  */
1242
1241
  prevPage(): Promise<Paginator<T>>;
1243
1242
  }
1243
+ interface PaginatorOptions {
1244
+ pageSize?: number;
1245
+ }
1244
1246
  type MessageRecipientsClientServices = {
1245
1247
  commandExecutor: CommandExecutor;
1246
1248
  };
@@ -1311,7 +1313,7 @@ declare class MessageRecipientsClient {
1311
1313
  getRecipientsFromMessage(conversationSid: string, messageSid: string): Promise<RecipientDescriptor[]>;
1312
1314
  getRecipientsFromConversation(conversationSid: string, paginatorOptions?: {
1313
1315
  pageToken?: string;
1314
- pageSize?: string;
1316
+ pageSize?: number;
1315
1317
  }): Promise<Paginator<RecipientDescriptor>>;
1316
1318
  private _wrapResponse;
1317
1319
  }
@@ -1609,7 +1611,7 @@ declare class RestPaginator<T> implements Paginator<T> {
1609
1611
  /**
1610
1612
  * @internal
1611
1613
  */
1612
- constructor(items: any, source: any, prevToken: any, nextToken: any);
1614
+ constructor(items: any, source: any, prevToken: any, nextToken: any, pageSize: any);
1613
1615
  /**
1614
1616
  * Request the next page. Does not modify the existing object.
1615
1617
  */
@@ -2425,12 +2427,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2425
2427
  updateUniqueName(uniqueName: string | null): Promise<Conversation>;
2426
2428
  /**
2427
2429
  * Get recipients of all messages in the conversation.
2430
+ * @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.
2428
2431
  */
2429
- getMessageRecipients(): Promise<Paginator<RecipientDescriptor>>;
2432
+ getMessageRecipients(options?: PaginatorOptions): Promise<Paginator<RecipientDescriptor>>;
2430
2433
  /**
2431
2434
  * Load and subscribe to this conversation and do not subscribe to its
2432
2435
  * participants and messages. This or _subscribeStreams will need to be called
2433
- * before any events on conversation will fire.
2436
+ * before any events in the conversation will fire.
2434
2437
  * @internal
2435
2438
  */
2436
2439
  _subscribe(): Promise<SyncDocument>;
package/builds/lib.js CHANGED
@@ -293,11 +293,13 @@ var Logger = /*#__PURE__*/function () {
293
293
  }, {
294
294
  key: "trace",
295
295
  value: function trace() {
296
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
297
- args[_key] = arguments[_key];
298
- }
296
+ if (log$7.getLevel() == log$7.levels.TRACE) {
297
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
298
+ args[_key] = arguments[_key];
299
+ }
299
300
 
300
- log$7.trace.apply(null, prepareLine(this.prefix + "T", args));
301
+ log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
302
+ }
301
303
  }
302
304
  }, {
303
305
  key: "debug",
@@ -348,11 +350,13 @@ var Logger = /*#__PURE__*/function () {
348
350
  }, {
349
351
  key: "trace",
350
352
  value: function trace() {
351
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
352
- args[_key6] = arguments[_key6];
353
- }
353
+ if (log$7.getLevel() == log$7.levels.TRACE) {
354
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
355
+ args[_key6] = arguments[_key6];
356
+ }
354
357
 
355
- log$7.trace.apply(null, prepareLine("T", args));
358
+ log$7.debug.apply(null, prepareLine("T", args));
359
+ }
356
360
  }
357
361
  }, {
358
362
  key: "debug",
@@ -2453,14 +2457,15 @@ var RestPaginator = /*#__PURE__*/function () {
2453
2457
  /**
2454
2458
  * @internal
2455
2459
  */
2456
- function RestPaginator(items, source, prevToken, nextToken) {
2460
+ function RestPaginator(items, source, prevToken, nextToken, pageSize) {
2457
2461
  _classCallCheck__default["default"](this, RestPaginator);
2458
2462
 
2459
2463
  this.state = {
2460
2464
  prevToken: prevToken,
2461
2465
  nextToken: nextToken,
2462
2466
  source: source,
2463
- items: items
2467
+ items: items,
2468
+ pageSize: pageSize
2464
2469
  };
2465
2470
  }
2466
2471
  /**
@@ -2498,7 +2503,7 @@ var RestPaginator = /*#__PURE__*/function () {
2498
2503
  }, {
2499
2504
  key: "nextPage",
2500
2505
  value: function nextPage() {
2501
- return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
2506
+ return this.hasNextPage ? this.state.source(this.state.nextToken, this.state.pageSize) : Promise.reject(new Error("No next page"));
2502
2507
  }
2503
2508
  /**
2504
2509
  * Request the previous page. Does not modify the existing object.
@@ -2507,7 +2512,7 @@ var RestPaginator = /*#__PURE__*/function () {
2507
2512
  }, {
2508
2513
  key: "prevPage",
2509
2514
  value: function prevPage() {
2510
- return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
2515
+ return this.hasPrevPage ? this.state.source(this.state.prevToken, this.state.pageSize) : Promise.reject(new Error("No previous page"));
2511
2516
  }
2512
2517
  }]);
2513
2518
 
@@ -3599,7 +3604,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3599
3604
  pageToken: pageToken,
3600
3605
  pageSize: pageSize
3601
3606
  });
3602
- }, response.body.meta.previous_token, response.body.meta.next_token));
3607
+ }, response.body.meta.previous_token, response.body.meta.next_token, options === null || options === void 0 ? void 0 : options.pageSize));
3603
3608
 
3604
3609
  case 6:
3605
3610
  case "end":
@@ -6035,18 +6040,19 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6035
6040
  }()
6036
6041
  /**
6037
6042
  * Get recipients of all messages in the conversation.
6043
+ * @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.
6038
6044
  */
6039
6045
 
6040
6046
  }, {
6041
6047
  key: "getMessageRecipients",
6042
6048
  value: function () {
6043
- var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
6049
+ var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
6044
6050
  return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
6045
6051
  while (1) {
6046
6052
  switch (_context24.prev = _context24.next) {
6047
6053
  case 0:
6048
6054
  _context24.next = 2;
6049
- return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
6055
+ return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
6050
6056
 
6051
6057
  case 2:
6052
6058
  return _context24.abrupt("return", _context24.sent);
@@ -6059,7 +6065,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6059
6065
  }, _callee24, this);
6060
6066
  }));
6061
6067
 
6062
- function getMessageRecipients() {
6068
+ function getMessageRecipients(_x19) {
6063
6069
  return _getMessageRecipients.apply(this, arguments);
6064
6070
  }
6065
6071
 
@@ -6068,7 +6074,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6068
6074
  /**
6069
6075
  * Load and subscribe to this conversation and do not subscribe to its
6070
6076
  * participants and messages. This or _subscribeStreams will need to be called
6071
- * before any events on conversation will fire.
6077
+ * before any events in the conversation will fire.
6072
6078
  * @internal
6073
6079
  */
6074
6080
 
@@ -6523,7 +6529,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6523
6529
  }, _callee29, this);
6524
6530
  }));
6525
6531
 
6526
- function _setLastReadMessageIndex(_x19) {
6532
+ function _setLastReadMessageIndex(_x20) {
6527
6533
  return _setLastReadMessageIndex2.apply(this, arguments);
6528
6534
  }
6529
6535
 
@@ -6603,7 +6609,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
6603
6609
 
6604
6610
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
6605
6611
 
6606
- __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);
6612
+ __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);
6607
6613
 
6608
6614
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
6609
6615
 
@@ -7945,7 +7951,7 @@ function PushNotification(data) {
7945
7951
  this.data = data.data || {};
7946
7952
  });
7947
7953
 
7948
- var version = "2.5.0-rc.0";
7954
+ var version = "2.5.0-rc.8";
7949
7955
 
7950
7956
  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; }
7951
7957
 
@@ -8940,7 +8946,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
8940
8946
  while (1) {
8941
8947
  switch (_context2.prev = _context2.next) {
8942
8948
  case 0:
8943
- 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 : "").arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : "").build();
8949
+ 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();
8944
8950
  _context2.next = 3;
8945
8951
  return this._services.commandExecutor.fetchResource(url);
8946
8952
 
@@ -8972,7 +8978,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
8972
8978
  pageToken: pageToken,
8973
8979
  pageSize: pageSize
8974
8980
  });
8975
- }, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
8981
+ }, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token, paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize));
8976
8982
 
8977
8983
  case 8:
8978
8984
  case "end":