@twilio/conversations 2.6.0-rc.0 → 2.6.0-rc.1

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
@@ -2669,6 +2669,7 @@ interface ClientOptions {
2669
2669
  disableDeepClone?: boolean;
2670
2670
  typingUri?: string;
2671
2671
  apiUri?: string;
2672
+ throwErrorsAlways?: boolean;
2672
2673
  }
2673
2674
  type ConnectionError = {
2674
2675
  terminal: boolean;
@@ -2937,7 +2938,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2937
2938
  /**
2938
2939
  * Promise that resolves on successful initialization.
2939
2940
  */
2940
- private readonly _ensureReady;
2941
+ private _ensureReady;
2941
2942
  /**
2942
2943
  * Options passed to the client.
2943
2944
  */
@@ -3154,6 +3155,10 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
3154
3155
  * @param channelType The channel type to unsubscribe from.
3155
3156
  */
3156
3157
  private _unsubscribeFromPushNotifications;
3158
+ /**
3159
+ * Initialize the ensureReady promise.
3160
+ */
3161
+ private _initializeEnsureReady;
3157
3162
  }
3158
3163
  declare class NotificationTypes {
3159
3164
  static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";
@@ -2669,6 +2669,7 @@ interface ClientOptions {
2669
2669
  disableDeepClone?: boolean;
2670
2670
  typingUri?: string;
2671
2671
  apiUri?: string;
2672
+ throwErrorsAlways?: boolean;
2672
2673
  }
2673
2674
  type ConnectionError = {
2674
2675
  terminal: boolean;
@@ -2937,7 +2938,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2937
2938
  /**
2938
2939
  * Promise that resolves on successful initialization.
2939
2940
  */
2940
- private readonly _ensureReady;
2941
+ private _ensureReady;
2941
2942
  /**
2942
2943
  * Options passed to the client.
2943
2944
  */
@@ -3154,6 +3155,10 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
3154
3155
  * @param channelType The channel type to unsubscribe from.
3155
3156
  */
3156
3157
  private _unsubscribeFromPushNotifications;
3158
+ /**
3159
+ * Initialize the ensureReady promise.
3160
+ */
3161
+ private _initializeEnsureReady;
3157
3162
  }
3158
3163
  declare class NotificationTypes {
3159
3164
  static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";
package/builds/lib.esm.js CHANGED
@@ -150,10 +150,10 @@ import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
150
150
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
151
151
  import _createClass from '@babel/runtime/helpers/esm/createClass';
152
152
  import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
153
- import 'core-js/modules/es.object.to-string.js';
154
- import 'core-js/modules/es.promise.js';
155
153
  import 'core-js/modules/es.array.map.js';
154
+ import 'core-js/modules/es.object.to-string.js';
156
155
  import 'core-js/modules/web.dom-collections.for-each.js';
156
+ import 'core-js/modules/es.promise.js';
157
157
  import _regeneratorRuntime from '@babel/runtime/regenerator';
158
158
  import _typeof from '@babel/runtime/helpers/esm/typeof';
159
159
  import 'core-js/modules/es.array.concat.js';
@@ -8025,7 +8025,7 @@ function PushNotification(data) {
8025
8025
  this.data = data.data || {};
8026
8026
  });
8027
8027
 
8028
- var version = "2.6.0-rc.0";
8028
+ var version = "2.6.0-rc.1";
8029
8029
 
8030
8030
  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; }
8031
8031
 
@@ -9546,6 +9546,8 @@ var Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter) {
9546
9546
  terminal: true,
9547
9547
  message: "Twilsock has disconnected."
9548
9548
  });
9549
+
9550
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9549
9551
  };
9550
9552
 
9551
9553
  _this._services.twilsockClient.once("connectionError", emitFailed);
@@ -9603,12 +9605,7 @@ var Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter) {
9603
9605
  }, _callee, null, [[3, 11]]);
9604
9606
  })));
9605
9607
 
9606
- _this._ensureReady = new Promise(function (resolve, reject) {
9607
- _this._resolveEnsureReady = resolve;
9608
- _this._rejectEnsureReady = reject;
9609
- }).catch(function () {
9610
- return void 0;
9611
- }); // @todo How to process unhandled rejection here?
9608
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9612
9609
 
9613
9610
  if (startTwilsock) {
9614
9611
  _this._services.twilsockClient.connect();
@@ -10501,6 +10498,26 @@ var Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter) {
10501
10498
  _this5._services.notificationClient.unsubscribe(channelType, messageType);
10502
10499
  });
10503
10500
  }
10501
+ /**
10502
+ * Initialize the ensureReady promise.
10503
+ */
10504
+
10505
+ }, {
10506
+ key: "_initializeEnsureReady",
10507
+ value: function _initializeEnsureReady(throwErrorsAlways) {
10508
+ var _this6 = this;
10509
+
10510
+ this._ensureReady = new Promise(function (resolve, reject) {
10511
+ _this6._resolveEnsureReady = resolve;
10512
+ _this6._rejectEnsureReady = reject;
10513
+ }).catch(function (error) {
10514
+ if (throwErrorsAlways) {
10515
+ throw error;
10516
+ } else {
10517
+ return void 0;
10518
+ }
10519
+ });
10520
+ }
10504
10521
  }], [{
10505
10522
  key: "create",
10506
10523
  value: function () {
package/builds/lib.js CHANGED
@@ -154,10 +154,10 @@ var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
154
154
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
155
155
  var _createClass = require('@babel/runtime/helpers/createClass');
156
156
  var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
157
- require('core-js/modules/es.object.to-string.js');
158
- require('core-js/modules/es.promise.js');
159
157
  require('core-js/modules/es.array.map.js');
158
+ require('core-js/modules/es.object.to-string.js');
160
159
  require('core-js/modules/web.dom-collections.for-each.js');
160
+ require('core-js/modules/es.promise.js');
161
161
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
162
162
  var _typeof = require('@babel/runtime/helpers/typeof');
163
163
  require('core-js/modules/es.array.concat.js');
@@ -8064,7 +8064,7 @@ function PushNotification(data) {
8064
8064
  this.data = data.data || {};
8065
8065
  });
8066
8066
 
8067
- var version = "2.6.0-rc.0";
8067
+ var version = "2.6.0-rc.1";
8068
8068
 
8069
8069
  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; }
8070
8070
 
@@ -9585,6 +9585,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9585
9585
  terminal: true,
9586
9586
  message: "Twilsock has disconnected."
9587
9587
  });
9588
+
9589
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9588
9590
  };
9589
9591
 
9590
9592
  _this._services.twilsockClient.once("connectionError", emitFailed);
@@ -9642,12 +9644,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9642
9644
  }, _callee, null, [[3, 11]]);
9643
9645
  })));
9644
9646
 
9645
- _this._ensureReady = new Promise(function (resolve, reject) {
9646
- _this._resolveEnsureReady = resolve;
9647
- _this._rejectEnsureReady = reject;
9648
- }).catch(function () {
9649
- return void 0;
9650
- }); // @todo How to process unhandled rejection here?
9647
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9651
9648
 
9652
9649
  if (startTwilsock) {
9653
9650
  _this._services.twilsockClient.connect();
@@ -10540,6 +10537,26 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
10540
10537
  _this5._services.notificationClient.unsubscribe(channelType, messageType);
10541
10538
  });
10542
10539
  }
10540
+ /**
10541
+ * Initialize the ensureReady promise.
10542
+ */
10543
+
10544
+ }, {
10545
+ key: "_initializeEnsureReady",
10546
+ value: function _initializeEnsureReady(throwErrorsAlways) {
10547
+ var _this6 = this;
10548
+
10549
+ this._ensureReady = new Promise(function (resolve, reject) {
10550
+ _this6._resolveEnsureReady = resolve;
10551
+ _this6._rejectEnsureReady = reject;
10552
+ }).catch(function (error) {
10553
+ if (throwErrorsAlways) {
10554
+ throw error;
10555
+ } else {
10556
+ return void 0;
10557
+ }
10558
+ });
10559
+ }
10543
10560
  }], [{
10544
10561
  key: "create",
10545
10562
  value: function () {