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