stream-chat 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1679,6 +1679,8 @@ var Channel = /*#__PURE__*/function () {
1679
1679
  /**
1680
1680
  * delete - Delete the channel. Messages are permanently removed.
1681
1681
  *
1682
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
1683
+ *
1682
1684
  * @return {Promise<DeleteChannelAPIResponse<ChannelType, CommandType, UserType>>} The server response
1683
1685
  */
1684
1686
 
@@ -1686,17 +1688,20 @@ var Channel = /*#__PURE__*/function () {
1686
1688
  key: "delete",
1687
1689
  value: function () {
1688
1690
  var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
1691
+ var options,
1692
+ _args11 = arguments;
1689
1693
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1690
1694
  while (1) {
1691
1695
  switch (_context11.prev = _context11.next) {
1692
1696
  case 0:
1693
- _context11.next = 2;
1694
- return this.getClient().delete(this._channelURL(), {});
1697
+ options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
1698
+ _context11.next = 3;
1699
+ return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
1695
1700
 
1696
- case 2:
1701
+ case 3:
1697
1702
  return _context11.abrupt("return", _context11.sent);
1698
1703
 
1699
- case 3:
1704
+ case 4:
1700
1705
  case "end":
1701
1706
  return _context11.stop();
1702
1707
  }
@@ -3807,6 +3812,12 @@ var StableWSConnection = /*#__PURE__*/function () {
3807
3812
 
3808
3813
  _defineProperty(this, "onmessage", function (wsID, event) {
3809
3814
  if (_this.wsID !== wsID) return;
3815
+
3816
+ _this._log('onmessage() - onmessage callback', {
3817
+ event: event,
3818
+ wsID: wsID
3819
+ });
3820
+
3810
3821
  var data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open..
3811
3822
  // the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
3812
3823
  // after that a ws.onclose..
@@ -3831,11 +3842,6 @@ var StableWSConnection = /*#__PURE__*/function () {
3831
3842
 
3832
3843
  _this.lastEvent = new Date();
3833
3844
 
3834
- _this._log('onmessage() - onmessage callback', {
3835
- event: event,
3836
- wsID: wsID
3837
- });
3838
-
3839
3845
  if (data && data.type === 'health.check') {
3840
3846
  _this.scheduleNextPing();
3841
3847
  }
@@ -4365,27 +4371,36 @@ var StableWSConnection = /*#__PURE__*/function () {
4365
4371
  this.requestID = randomId();
4366
4372
  this.client.insightMetrics.connectionStartTimestamp = new Date().getTime();
4367
4373
  _context5.prev = 5;
4368
- _context5.next = 8;
4374
+
4375
+ this._log("_connect() - waiting for token");
4376
+
4377
+ _context5.next = 9;
4369
4378
  return this.client.tokenManager.tokenReady();
4370
4379
 
4371
- case 8:
4380
+ case 9:
4372
4381
  this._setupConnectionPromise();
4373
4382
 
4374
4383
  wsURL = this._buildUrl();
4384
+
4385
+ this._log("_connect() - Connecting to ".concat(wsURL), {
4386
+ wsURL: wsURL,
4387
+ requestID: this.requestID
4388
+ });
4389
+
4375
4390
  this.ws = new WebSocket(wsURL);
4376
4391
  this.ws.onopen = this.onopen.bind(this, this.wsID);
4377
4392
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4378
4393
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4379
4394
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4380
- _context5.next = 17;
4395
+ _context5.next = 19;
4381
4396
  return this.connectionOpen;
4382
4397
 
4383
- case 17:
4398
+ case 19:
4384
4399
  response = _context5.sent;
4385
4400
  this.isConnecting = false;
4386
4401
 
4387
4402
  if (!response) {
4388
- _context5.next = 23;
4403
+ _context5.next = 25;
4389
4404
  break;
4390
4405
  }
4391
4406
 
@@ -4398,12 +4413,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4398
4413
 
4399
4414
  return _context5.abrupt("return", response);
4400
4415
 
4401
- case 23:
4402
- _context5.next = 30;
4416
+ case 25:
4417
+ _context5.next = 32;
4403
4418
  break;
4404
4419
 
4405
- case 25:
4406
- _context5.prev = 25;
4420
+ case 27:
4421
+ _context5.prev = 27;
4407
4422
  _context5.t0 = _context5["catch"](5);
4408
4423
  this.isConnecting = false;
4409
4424
 
@@ -4416,12 +4431,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4416
4431
 
4417
4432
  throw _context5.t0;
4418
4433
 
4419
- case 30:
4434
+ case 32:
4420
4435
  case "end":
4421
4436
  return _context5.stop();
4422
4437
  }
4423
4438
  }
4424
- }, _callee5, this, [[5, 25]]);
4439
+ }, _callee5, this, [[5, 27]]);
4425
4440
  }));
4426
4441
 
4427
4442
  function _connect() {
@@ -9109,7 +9124,7 @@ var StreamChat = /*#__PURE__*/function () {
9109
9124
  }, {
9110
9125
  key: "getUserAgent",
9111
9126
  value: function getUserAgent() {
9112
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "5.3.0");
9127
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "5.4.0");
9113
9128
  }
9114
9129
  }, {
9115
9130
  key: "setUserAgent",