stream-chat 5.3.0 → 6.0.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.
Files changed (43) hide show
  1. package/README.md +21 -13
  2. package/dist/browser.es.js +290 -149
  3. package/dist/browser.es.js.map +1 -1
  4. package/dist/browser.full-bundle.min.js +1 -1
  5. package/dist/browser.full-bundle.min.js.map +1 -1
  6. package/dist/browser.js +290 -149
  7. package/dist/browser.js.map +1 -1
  8. package/dist/index.es.js +290 -149
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/index.js +290 -149
  11. package/dist/index.js.map +1 -1
  12. package/dist/types/channel.d.ts +127 -123
  13. package/dist/types/channel.d.ts.map +1 -1
  14. package/dist/types/channel_state.d.ts +41 -41
  15. package/dist/types/channel_state.d.ts.map +1 -1
  16. package/dist/types/client.d.ts +200 -170
  17. package/dist/types/client.d.ts.map +1 -1
  18. package/dist/types/client_state.d.ts +6 -6
  19. package/dist/types/client_state.d.ts.map +1 -1
  20. package/dist/types/connection.d.ts +10 -10
  21. package/dist/types/connection.d.ts.map +1 -1
  22. package/dist/types/connection_fallback.d.ts +7 -7
  23. package/dist/types/connection_fallback.d.ts.map +1 -1
  24. package/dist/types/events.d.ts +1 -0
  25. package/dist/types/events.d.ts.map +1 -1
  26. package/dist/types/insights.d.ts +2 -2
  27. package/dist/types/token_manager.d.ts +6 -6
  28. package/dist/types/token_manager.d.ts.map +1 -1
  29. package/dist/types/types.d.ts +370 -234
  30. package/dist/types/types.d.ts.map +1 -1
  31. package/dist/types/utils.d.ts +2 -2
  32. package/dist/types/utils.d.ts.map +1 -1
  33. package/package.json +4 -4
  34. package/src/channel.ts +195 -290
  35. package/src/channel_state.ts +54 -219
  36. package/src/client.ts +300 -521
  37. package/src/client_state.ts +6 -6
  38. package/src/connection.ts +10 -23
  39. package/src/connection_fallback.ts +9 -21
  40. package/src/events.ts +1 -0
  41. package/src/token_manager.ts +6 -6
  42. package/src/types.ts +482 -528
  43. package/src/utils.ts +7 -11
package/dist/index.es.js CHANGED
@@ -255,7 +255,7 @@ var ChannelState = /*#__PURE__*/function () {
255
255
  /**
256
256
  * addMessageSorted - Add a message to the state
257
257
  *
258
- * @param {MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} newMessage A new message
258
+ * @param {MessageResponse<StreamChatGenerics>} newMessage A new message
259
259
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
260
260
  * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
261
261
  *
@@ -273,7 +273,7 @@ var ChannelState = /*#__PURE__*/function () {
273
273
  * formatMessage - Takes the message object. Parses the dates, sets __html
274
274
  * and sets the status to received if missing. Returns a message object
275
275
  *
276
- * @param {MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} message a message object
276
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
277
277
  *
278
278
  */
279
279
 
@@ -295,7 +295,7 @@ var ChannelState = /*#__PURE__*/function () {
295
295
  /**
296
296
  * addMessagesSorted - Add the list of messages to state and resorts the messages
297
297
  *
298
- * @param {Array<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} newMessages A list of messages
298
+ * @param {Array<MessageResponse<StreamChatGenerics>>} newMessages A list of messages
299
299
  * @param {boolean} timestampChanged Whether updating messages with changed created_at value.
300
300
  * @param {boolean} initializing Whether channel is being initialized.
301
301
  * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
@@ -374,7 +374,7 @@ var ChannelState = /*#__PURE__*/function () {
374
374
  /**
375
375
  * addPinnedMessages - adds messages in pinnedMessages property
376
376
  *
377
- * @param {Array<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} pinnedMessages A list of pinned messages
377
+ * @param {Array<MessageResponse<StreamChatGenerics>>} pinnedMessages A list of pinned messages
378
378
  *
379
379
  */
380
380
 
@@ -388,7 +388,7 @@ var ChannelState = /*#__PURE__*/function () {
388
388
  /**
389
389
  * addPinnedMessage - adds message in pinnedMessages
390
390
  *
391
- * @param {MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} pinnedMessage message to update
391
+ * @param {MessageResponse<StreamChatGenerics>} pinnedMessage message to update
392
392
  *
393
393
  */
394
394
 
@@ -400,7 +400,7 @@ var ChannelState = /*#__PURE__*/function () {
400
400
  /**
401
401
  * removePinnedMessage - removes pinned message from pinnedMessages
402
402
  *
403
- * @param {MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} message message to remove
403
+ * @param {MessageResponse<StreamChatGenerics>} message message to remove
404
404
  *
405
405
  */
406
406
 
@@ -554,7 +554,7 @@ var ChannelState = /*#__PURE__*/function () {
554
554
  /**
555
555
  * _addToMessageList - Adds a message to a list of messages, tries to update first, appends if message isn't found
556
556
  *
557
- * @param {Array<ReturnType<ChannelState<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>['formatMessage']>>} messages A list of messages
557
+ * @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
558
558
  * @param message
559
559
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
560
560
  * @param {string} sortBy field name to use to sort the messages by
@@ -754,7 +754,8 @@ var EVENT_MAP = {
754
754
  'user.watching.stop': true,
755
755
  // local events
756
756
  'connection.changed': true,
757
- 'connection.recovered': true
757
+ 'connection.recovered': true,
758
+ 'transport.changed': true
758
759
  };
759
760
 
760
761
  var IS_VALID_EVENT_MAP_TYPE = _objectSpread$6(_objectSpread$6({}, EVENT_MAP), {}, {
@@ -811,13 +812,14 @@ function isFileWebAPI(uri) {
811
812
  return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
812
813
  }
813
814
 
815
+ function isOwnUser(user) {
816
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
817
+ }
818
+
814
819
  function isBlobWebAPI(uri) {
815
820
  return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
816
821
  }
817
822
 
818
- function isOwnUser(user) {
819
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
820
- }
821
823
  function isOwnUserBaseProperty(property) {
822
824
  var ownUserBaseProperties = {
823
825
  channel_mutes: true,
@@ -1012,12 +1014,12 @@ var Channel = /*#__PURE__*/function () {
1012
1014
  /**
1013
1015
  * constructor - Create a channel
1014
1016
  *
1015
- * @param {StreamChat<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} client the chat client
1017
+ * @param {StreamChat<StreamChatGenerics>} client the chat client
1016
1018
  * @param {string} type the type of channel
1017
1019
  * @param {string} [id] the id of the chat
1018
- * @param {ChannelData<ChannelType>} data any additional custom params
1020
+ * @param {ChannelData<StreamChatGenerics>} data any additional custom params
1019
1021
  *
1020
- * @return {Channel<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} Returns a new uninitialized channel
1022
+ * @return {Channel<StreamChatGenerics>} Returns a new uninitialized channel
1021
1023
  */
1022
1024
  function Channel(client, type, id, data) {
1023
1025
  var _this = this;
@@ -1136,7 +1138,7 @@ var Channel = /*#__PURE__*/function () {
1136
1138
  /**
1137
1139
  * getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
1138
1140
  *
1139
- * @return {StreamChat<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>}
1141
+ * @return {StreamChat<StreamChatGenerics>}
1140
1142
  */
1141
1143
 
1142
1144
 
@@ -1164,11 +1166,11 @@ var Channel = /*#__PURE__*/function () {
1164
1166
  /**
1165
1167
  * sendMessage - Send a message to this channel
1166
1168
  *
1167
- * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1169
+ * @param {Message<StreamChatGenerics>} message The Message object
1168
1170
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1169
1171
  * @param {boolean} [options.skip_push] Skip sending push notifications
1170
1172
  *
1171
- * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1173
+ * @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response
1172
1174
  */
1173
1175
 
1174
1176
  }, {
@@ -1232,9 +1234,9 @@ var Channel = /*#__PURE__*/function () {
1232
1234
  /**
1233
1235
  * sendEvent - Send an event on this channel
1234
1236
  *
1235
- * @param {Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} event for example {type: 'message.read'}
1237
+ * @param {Event<StreamChatGenerics>} event for example {type: 'message.read'}
1236
1238
  *
1237
- * @return {Promise<EventAPIResponse<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>>} The Server Response
1239
+ * @return {Promise<EventAPIResponse<StreamChatGenerics>>} The Server Response
1238
1240
  */
1239
1241
 
1240
1242
  }, {
@@ -1272,10 +1274,10 @@ var Channel = /*#__PURE__*/function () {
1272
1274
  /**
1273
1275
  * search - Query messages
1274
1276
  *
1275
- * @param {MessageFilters<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> | string} query search query or object MongoDB style filters
1276
- * @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>}} options Option object, {user_id: 'tommaso'}
1277
+ * @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
1278
+ * @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<StreamChatGenerics>}} options Option object, {user_id: 'tommaso'}
1277
1279
  *
1278
- * @return {Promise<SearchAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} search messages response
1280
+ * @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
1279
1281
  */
1280
1282
 
1281
1283
  }, {
@@ -1360,12 +1362,12 @@ var Channel = /*#__PURE__*/function () {
1360
1362
  /**
1361
1363
  * queryMembers - Query Members
1362
1364
  *
1363
- * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1364
- * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1365
+ * @param {UserFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
1366
+ * @param {MemberSort<StreamChatGenerics>} [sort] Sort options, for instance [{created_at: -1}].
1365
1367
  * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1366
1368
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1367
1369
  *
1368
- * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
1370
+ * @return {Promise<ChannelMemberAPIResponse<StreamChatGenerics>>} Query Members response
1369
1371
  */
1370
1372
 
1371
1373
  }, {
@@ -1427,10 +1429,10 @@ var Channel = /*#__PURE__*/function () {
1427
1429
  * sendReaction - Send a reaction about a message
1428
1430
  *
1429
1431
  * @param {string} messageID the message id
1430
- * @param {Reaction<ReactionType, UserType>} reaction the reaction object for instance {type: 'love'}
1432
+ * @param {Reaction<StreamChatGenerics>} reaction the reaction object for instance {type: 'love'}
1431
1433
  * @param {{ enforce_unique?: boolean, skip_push?: boolean }} [options] Option object, {enforce_unique: true, skip_push: true} to override any existing reaction or skip sending push notifications
1432
1434
  *
1433
- * @return {Promise<ReactionAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1435
+ * @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
1434
1436
  */
1435
1437
 
1436
1438
  }, {
@@ -1486,7 +1488,7 @@ var Channel = /*#__PURE__*/function () {
1486
1488
  * @param {string} reactionType the type of reaction that should be removed
1487
1489
  * @param {string} [user_id] the id of the user (used only for server side request) default null
1488
1490
  *
1489
- * @return {Promise<ReactionAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1491
+ * @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
1490
1492
  */
1491
1493
 
1492
1494
  }, {
@@ -1511,10 +1513,10 @@ var Channel = /*#__PURE__*/function () {
1511
1513
  /**
1512
1514
  * update - Edit the channel's custom properties
1513
1515
  *
1514
- * @param {ChannelData<ChannelType>} channelData The object to update the custom properties of this channel with
1515
- * @param {Message<AttachmentType, MessageType, UserType>} [updateMessage] Optional message object for channel members notification
1516
+ * @param {ChannelData<StreamChatGenerics>} channelData The object to update the custom properties of this channel with
1517
+ * @param {Message<StreamChatGenerics>} [updateMessage] Optional message object for channel members notification
1516
1518
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
1517
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1519
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1518
1520
  */
1519
1521
 
1520
1522
  }, {
@@ -1564,9 +1566,9 @@ var Channel = /*#__PURE__*/function () {
1564
1566
  /**
1565
1567
  * updatePartial - partial update channel properties
1566
1568
  *
1567
- * @param {PartialUpdateChannel<ChannelType>} partial update request
1569
+ * @param {PartialUpdateChannel<StreamChatGenerics>} partial update request
1568
1570
  *
1569
- * @return {Promise<PartialUpdateChannelAPIResponse<ChannelType,CommandType, UserType>>}
1571
+ * @return {Promise<PartialUpdateChannelAPIResponse<StreamChatGenerics>>}
1570
1572
  */
1571
1573
 
1572
1574
  }, {
@@ -1601,7 +1603,7 @@ var Channel = /*#__PURE__*/function () {
1601
1603
  * enableSlowMode - enable slow mode
1602
1604
  *
1603
1605
  * @param {number} coolDownInterval the cooldown interval in seconds
1604
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1606
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1605
1607
  */
1606
1608
 
1607
1609
  }, {
@@ -1640,7 +1642,7 @@ var Channel = /*#__PURE__*/function () {
1640
1642
  /**
1641
1643
  * disableSlowMode - disable slow mode
1642
1644
  *
1643
- * @return {Promise<UpdateChannelAPIResponse<ChannelType, AttachmentType, MessageType, ReactionType, UserType>>} The server response
1645
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1644
1646
  */
1645
1647
 
1646
1648
  }, {
@@ -1679,24 +1681,29 @@ var Channel = /*#__PURE__*/function () {
1679
1681
  /**
1680
1682
  * delete - Delete the channel. Messages are permanently removed.
1681
1683
  *
1682
- * @return {Promise<DeleteChannelAPIResponse<ChannelType, CommandType, UserType>>} The server response
1684
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
1685
+ *
1686
+ * @return {Promise<DeleteChannelAPIResponse<StreamChatGenerics>>} The server response
1683
1687
  */
1684
1688
 
1685
1689
  }, {
1686
1690
  key: "delete",
1687
1691
  value: function () {
1688
1692
  var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
1693
+ var options,
1694
+ _args11 = arguments;
1689
1695
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1690
1696
  while (1) {
1691
1697
  switch (_context11.prev = _context11.next) {
1692
1698
  case 0:
1693
- _context11.next = 2;
1694
- return this.getClient().delete(this._channelURL(), {});
1699
+ options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
1700
+ _context11.next = 3;
1701
+ return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
1695
1702
 
1696
- case 2:
1703
+ case 3:
1697
1704
  return _context11.abrupt("return", _context11.sent);
1698
1705
 
1699
- case 3:
1706
+ case 4:
1700
1707
  case "end":
1701
1708
  return _context11.stop();
1702
1709
  }
@@ -1712,8 +1719,8 @@ var Channel = /*#__PURE__*/function () {
1712
1719
  }()
1713
1720
  /**
1714
1721
  * truncate - Removes all messages from the channel
1715
- * @param {TruncateOptions<AttachmentType, MessageType, UserType>} [options] Defines truncation options
1716
- * @return {Promise<TruncateChannelAPIResponse<ChannelType, CommandType, UserType, MessageType, ReactionType>>} The server response
1722
+ * @param {TruncateOptions<StreamChatGenerics>} [options] Defines truncation options
1723
+ * @return {Promise<TruncateChannelAPIResponse<StreamChatGenerics>>} The server response
1717
1724
  */
1718
1725
 
1719
1726
  }, {
@@ -1750,9 +1757,9 @@ var Channel = /*#__PURE__*/function () {
1750
1757
  /**
1751
1758
  * acceptInvite - accept invitation to the channel
1752
1759
  *
1753
- * @param {InviteOptions<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} [options] The object to update the custom properties of this channel with
1760
+ * @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
1754
1761
  *
1755
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1762
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1756
1763
  */
1757
1764
 
1758
1765
  }, {
@@ -1791,9 +1798,9 @@ var Channel = /*#__PURE__*/function () {
1791
1798
  /**
1792
1799
  * rejectInvite - reject invitation to the channel
1793
1800
  *
1794
- * @param {InviteOptions<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} [options] The object to update the custom properties of this channel with
1801
+ * @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
1795
1802
  *
1796
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1803
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1797
1804
  */
1798
1805
 
1799
1806
  }, {
@@ -1833,9 +1840,9 @@ var Channel = /*#__PURE__*/function () {
1833
1840
  * addMembers - add members to the channel
1834
1841
  *
1835
1842
  * @param {{user_id: string, channel_role?: Role}[]} members An array of members to add to the channel
1836
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
1843
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
1837
1844
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
1838
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1845
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1839
1846
  */
1840
1847
 
1841
1848
  }, {
@@ -1876,9 +1883,9 @@ var Channel = /*#__PURE__*/function () {
1876
1883
  * addModerators - add moderators to the channel
1877
1884
  *
1878
1885
  * @param {string[]} members An array of member identifiers
1879
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
1886
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
1880
1887
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
1881
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1888
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1882
1889
  */
1883
1890
 
1884
1891
  }, {
@@ -1919,9 +1926,9 @@ var Channel = /*#__PURE__*/function () {
1919
1926
  * assignRoles - sets member roles in a channel
1920
1927
  *
1921
1928
  * @param {{channel_role: Role, user_id: string}[]} roles List of role assignments
1922
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
1929
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
1923
1930
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
1924
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1931
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1925
1932
  */
1926
1933
 
1927
1934
  }, {
@@ -1962,9 +1969,9 @@ var Channel = /*#__PURE__*/function () {
1962
1969
  * inviteMembers - invite members to the channel
1963
1970
  *
1964
1971
  * @param {{user_id: string, channel_role?: Role}[]} members An array of members to invite to the channel
1965
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
1972
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
1966
1973
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
1967
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
1974
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
1968
1975
  */
1969
1976
 
1970
1977
  }, {
@@ -2005,9 +2012,9 @@ var Channel = /*#__PURE__*/function () {
2005
2012
  * removeMembers - remove members from channel
2006
2013
  *
2007
2014
  * @param {string[]} members An array of member identifiers
2008
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
2015
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
2009
2016
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
2010
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
2017
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
2011
2018
  */
2012
2019
 
2013
2020
  }, {
@@ -2048,9 +2055,9 @@ var Channel = /*#__PURE__*/function () {
2048
2055
  * demoteModerators - remove moderator role from channel members
2049
2056
  *
2050
2057
  * @param {string[]} members An array of member identifiers
2051
- * @param {Message<AttachmentType, MessageType, UserType>} [message] Optional message object for channel members notification
2058
+ * @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
2052
2059
  * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
2053
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
2060
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
2054
2061
  */
2055
2062
 
2056
2063
  }, {
@@ -2090,7 +2097,7 @@ var Channel = /*#__PURE__*/function () {
2090
2097
  /**
2091
2098
  * _update - executes channel update request
2092
2099
  * @param payload Object Update Channel payload
2093
- * @return {Promise<UpdateChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
2100
+ * @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
2094
2101
  * TODO: introduce new type instead of Object in the next major update
2095
2102
  */
2096
2103
 
@@ -2128,7 +2135,7 @@ var Channel = /*#__PURE__*/function () {
2128
2135
  /**
2129
2136
  * mute - mutes the current channel
2130
2137
  * @param {{ user_id?: string, expiration?: string }} opts expiration in minutes or user_id
2131
- * @return {Promise<MuteChannelAPIResponse<ChannelType, CommandType, UserType>>} The server response
2138
+ * @return {Promise<MuteChannelAPIResponse<StreamChatGenerics>>} The server response
2132
2139
  *
2133
2140
  * example with expiration:
2134
2141
  * await channel.mute({expiration: moment.duration(2, 'weeks')});
@@ -2347,7 +2354,7 @@ var Channel = /*#__PURE__*/function () {
2347
2354
  /**
2348
2355
  * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
2349
2356
  *
2350
- * @return {ReturnType<ChannelState<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>['formatMessage']> | undefined} Description
2357
+ * @return {ReturnType<ChannelState<StreamChatGenerics>['formatMessage']> | undefined} Description
2351
2358
  */
2352
2359
 
2353
2360
  }, {
@@ -2372,8 +2379,8 @@ var Channel = /*#__PURE__*/function () {
2372
2379
  /**
2373
2380
  * markRead - Send the mark read event for this user, only works if the `read_events` setting is enabled
2374
2381
  *
2375
- * @param {MarkReadOptions<UserType>} data
2376
- * @return {Promise<EventAPIResponse<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType> | null>} Description
2382
+ * @param {MarkReadOptions<StreamChatGenerics>} data
2383
+ * @return {Promise<EventAPIResponse<StreamChatGenerics> | null>} Description
2377
2384
  */
2378
2385
 
2379
2386
  }, {
@@ -2441,9 +2448,9 @@ var Channel = /*#__PURE__*/function () {
2441
2448
  /**
2442
2449
  * watch - Loads the initial channel state and watches for changes
2443
2450
  *
2444
- * @param {ChannelQueryOptions<ChannelType, CommandType, UserType>} options additional options for the query endpoint
2451
+ * @param {ChannelQueryOptions<StreamChatGenerics>} options additional options for the query endpoint
2445
2452
  *
2446
- * @return {Promise<ChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The server response
2453
+ * @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The server response
2447
2454
  */
2448
2455
 
2449
2456
  }, {
@@ -2545,9 +2552,9 @@ var Channel = /*#__PURE__*/function () {
2545
2552
  * getReplies - List the message replies for a parent message
2546
2553
  *
2547
2554
  * @param {string} parent_id The message parent id, ie the top of the thread
2548
- * @param {PaginationOptions & { user?: UserResponse<UserType>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
2555
+ * @param {PaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
2549
2556
  *
2550
- * @return {Promise<GetRepliesAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} A response with a list of messages
2557
+ * @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
2551
2558
  */
2552
2559
 
2553
2560
  }, {
@@ -2589,10 +2596,10 @@ var Channel = /*#__PURE__*/function () {
2589
2596
  /**
2590
2597
  * getPinnedMessages - List list pinned messages of the channel
2591
2598
  *
2592
- * @param {PinnedMessagePaginationOptions & { user?: UserResponse<UserType>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
2599
+ * @param {PinnedMessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
2593
2600
  * @param {PinnedMessagesSort} sort defines sorting direction of pinned messages
2594
2601
  *
2595
- * @return {Promise<GetRepliesAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} A response with a list of messages
2602
+ * @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
2596
2603
  */
2597
2604
 
2598
2605
  }, {
@@ -2636,7 +2643,7 @@ var Channel = /*#__PURE__*/function () {
2636
2643
  * @param {string} message_id The message id
2637
2644
  * @param {{ limit?: number; offset?: number }} options The pagination options
2638
2645
  *
2639
- * @return {Promise<GetReactionsAPIResponse<ReactionType, UserType>>} Server response
2646
+ * @return {Promise<GetReactionsAPIResponse<StreamChatGenerics>>} Server response
2640
2647
  */
2641
2648
 
2642
2649
  }, {
@@ -2649,7 +2656,7 @@ var Channel = /*#__PURE__*/function () {
2649
2656
  *
2650
2657
  * @param {string[]} messageIds The ids of the messages to retrieve from this channel
2651
2658
  *
2652
- * @return {Promise<GetMultipleMessagesAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} Server response
2659
+ * @return {Promise<GetMultipleMessagesAPIResponse<StreamChatGenerics>>} Server response
2653
2660
  */
2654
2661
 
2655
2662
  }, {
@@ -2683,6 +2690,7 @@ var Channel = /*#__PURE__*/function () {
2683
2690
 
2684
2691
  if (message.shadowed) return false;
2685
2692
  if (message.silent) return false;
2693
+ if (message.parent_id && !message.show_in_channel) return false;
2686
2694
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2687
2695
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2688
2696
  if (message.type === 'system') return false;
@@ -2743,7 +2751,7 @@ var Channel = /*#__PURE__*/function () {
2743
2751
  /**
2744
2752
  * create - Creates a new channel
2745
2753
  *
2746
- * @return {Promise<ChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
2754
+ * @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The Server Response
2747
2755
  */
2748
2756
 
2749
2757
  }, {
@@ -2752,9 +2760,9 @@ var Channel = /*#__PURE__*/function () {
2752
2760
  /**
2753
2761
  * query - Query the API, get messages, members or other channel fields
2754
2762
  *
2755
- * @param {ChannelQueryOptions<ChannelType, CommandType, UserType>} options The query options
2763
+ * @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
2756
2764
  *
2757
- * @return {Promise<ChannelAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} Returns a query response
2765
+ * @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
2758
2766
  */
2759
2767
  function () {
2760
2768
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(options) {
@@ -2830,7 +2838,7 @@ var Channel = /*#__PURE__*/function () {
2830
2838
  * banUser - Bans a user from a channel
2831
2839
  *
2832
2840
  * @param {string} targetUserID
2833
- * @param {BanUserOptions<UserType>} options
2841
+ * @param {BanUserOptions<StreamChatGenerics>} options
2834
2842
  * @returns {Promise<APIResponse>}
2835
2843
  */
2836
2844
 
@@ -3002,7 +3010,7 @@ var Channel = /*#__PURE__*/function () {
3002
3010
  * shadowBan - Shadow bans a user from a channel
3003
3011
  *
3004
3012
  * @param {string} targetUserID
3005
- * @param {BanUserOptions<UserType>} options
3013
+ * @param {BanUserOptions<StreamChatGenerics>} options
3006
3014
  * @returns {Promise<APIResponse>}
3007
3015
  */
3008
3016
 
@@ -3086,8 +3094,8 @@ var Channel = /*#__PURE__*/function () {
3086
3094
  * or
3087
3095
  * channel.on(event => {console.log(event.type)})
3088
3096
  *
3089
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType> | EventTypes} callbackOrString The event type to listen for (optional)
3090
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} [callbackOrNothing] The callback to call
3097
+ * @param {EventHandler<StreamChatGenerics> | EventTypes} callbackOrString The event type to listen for (optional)
3098
+ * @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
3091
3099
  */
3092
3100
 
3093
3101
  }, {
@@ -3807,6 +3815,12 @@ var StableWSConnection = /*#__PURE__*/function () {
3807
3815
 
3808
3816
  _defineProperty(this, "onmessage", function (wsID, event) {
3809
3817
  if (_this.wsID !== wsID) return;
3818
+
3819
+ _this._log('onmessage() - onmessage callback', {
3820
+ event: event,
3821
+ wsID: wsID
3822
+ });
3823
+
3810
3824
  var data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open..
3811
3825
  // the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
3812
3826
  // after that a ws.onclose..
@@ -3831,11 +3845,6 @@ var StableWSConnection = /*#__PURE__*/function () {
3831
3845
 
3832
3846
  _this.lastEvent = new Date();
3833
3847
 
3834
- _this._log('onmessage() - onmessage callback', {
3835
- event: event,
3836
- wsID: wsID
3837
- });
3838
-
3839
3848
  if (data && data.type === 'health.check') {
3840
3849
  _this.scheduleNextPing();
3841
3850
  }
@@ -3912,7 +3921,6 @@ var StableWSConnection = /*#__PURE__*/function () {
3912
3921
  _this.isHealthy = healthy;
3913
3922
 
3914
3923
  if (_this.isHealthy) {
3915
- //@ts-expect-error
3916
3924
  _this.client.dispatchEvent({
3917
3925
  type: 'connection.changed',
3918
3926
  online: _this.isHealthy
@@ -3923,7 +3931,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3923
3931
 
3924
3932
 
3925
3933
  setTimeout(function () {
3926
- if (_this.isHealthy) return; //@ts-expect-error
3934
+ if (_this.isHealthy) return;
3927
3935
 
3928
3936
  _this.client.dispatchEvent({
3929
3937
  type: 'connection.changed',
@@ -4365,27 +4373,36 @@ var StableWSConnection = /*#__PURE__*/function () {
4365
4373
  this.requestID = randomId();
4366
4374
  this.client.insightMetrics.connectionStartTimestamp = new Date().getTime();
4367
4375
  _context5.prev = 5;
4368
- _context5.next = 8;
4376
+
4377
+ this._log("_connect() - waiting for token");
4378
+
4379
+ _context5.next = 9;
4369
4380
  return this.client.tokenManager.tokenReady();
4370
4381
 
4371
- case 8:
4382
+ case 9:
4372
4383
  this._setupConnectionPromise();
4373
4384
 
4374
4385
  wsURL = this._buildUrl();
4386
+
4387
+ this._log("_connect() - Connecting to ".concat(wsURL), {
4388
+ wsURL: wsURL,
4389
+ requestID: this.requestID
4390
+ });
4391
+
4375
4392
  this.ws = new WebSocket(wsURL);
4376
4393
  this.ws.onopen = this.onopen.bind(this, this.wsID);
4377
4394
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4378
4395
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4379
4396
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4380
- _context5.next = 17;
4397
+ _context5.next = 19;
4381
4398
  return this.connectionOpen;
4382
4399
 
4383
- case 17:
4400
+ case 19:
4384
4401
  response = _context5.sent;
4385
4402
  this.isConnecting = false;
4386
4403
 
4387
4404
  if (!response) {
4388
- _context5.next = 23;
4405
+ _context5.next = 25;
4389
4406
  break;
4390
4407
  }
4391
4408
 
@@ -4398,12 +4415,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4398
4415
 
4399
4416
  return _context5.abrupt("return", response);
4400
4417
 
4401
- case 23:
4402
- _context5.next = 30;
4418
+ case 25:
4419
+ _context5.next = 32;
4403
4420
  break;
4404
4421
 
4405
- case 25:
4406
- _context5.prev = 25;
4422
+ case 27:
4423
+ _context5.prev = 27;
4407
4424
  _context5.t0 = _context5["catch"](5);
4408
4425
  this.isConnecting = false;
4409
4426
 
@@ -4416,12 +4433,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4416
4433
 
4417
4434
  throw _context5.t0;
4418
4435
 
4419
- case 30:
4436
+ case 32:
4420
4437
  case "end":
4421
4438
  return _context5.stop();
4422
4439
  }
4423
4440
  }
4424
- }, _callee5, this, [[5, 25]]);
4441
+ }, _callee5, this, [[5, 27]]);
4425
4442
  }));
4426
4443
 
4427
4444
  function _connect() {
@@ -4884,7 +4901,7 @@ function TokenManager(secret) {
4884
4901
  * Token provider should return a token string or a promise which resolves to string token.
4885
4902
  *
4886
4903
  * @param {TokenOrProvider} tokenOrProvider
4887
- * @param {UserResponse<UserType>} user
4904
+ * @param {UserResponse<StreamChatGenerics>} user
4888
4905
  */
4889
4906
  ;
4890
4907
 
@@ -5272,7 +5289,9 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5272
5289
 
5273
5290
  _this._setState(ConnectionState.Connected);
5274
5291
 
5275
- _this.connectionID = event.connection_id;
5292
+ _this.connectionID = event.connection_id; // @ts-expect-error
5293
+
5294
+ _this.client.dispatchEvent(event);
5276
5295
 
5277
5296
  _this._poll();
5278
5297
 
@@ -5282,20 +5301,20 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5282
5301
 
5283
5302
  return _context3.abrupt("return", event);
5284
5303
 
5285
- case 21:
5286
- _context3.prev = 21;
5304
+ case 22:
5305
+ _context3.prev = 22;
5287
5306
  _context3.t0 = _context3["catch"](9);
5288
5307
 
5289
5308
  _this._setState(ConnectionState.Closed);
5290
5309
 
5291
5310
  throw _context3.t0;
5292
5311
 
5293
- case 25:
5312
+ case 26:
5294
5313
  case "end":
5295
5314
  return _context3.stop();
5296
5315
  }
5297
5316
  }
5298
- }, _callee3, null, [[9, 21]]);
5317
+ }, _callee3, null, [[9, 22]]);
5299
5318
  })));
5300
5319
 
5301
5320
  _defineProperty(this, "isHealthy", function () {
@@ -5374,7 +5393,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5374
5393
 
5375
5394
 
5376
5395
  if (this.state === ConnectionState.Connecting && state === ConnectionState.Connected) {
5377
- //@ts-expect-error
5378
5396
  this.client.dispatchEvent({
5379
5397
  type: 'connection.changed',
5380
5398
  online: true
@@ -5382,7 +5400,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5382
5400
  }
5383
5401
 
5384
5402
  if (state === ConnectionState.Closed || state === ConnectionState.Disconnected) {
5385
- //@ts-expect-error
5386
5403
  this.client.dispatchEvent({
5387
5404
  type: 'connection.changed',
5388
5405
  online: false
@@ -6675,9 +6692,9 @@ var StreamChat = /*#__PURE__*/function () {
6675
6692
  /**
6676
6693
  * setGuestUser - Setup a temporary guest user
6677
6694
  *
6678
- * @param {UserResponse<UserType>} user Data about this user. IE {name: "john"}
6695
+ * @param {UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
6679
6696
  *
6680
- * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
6697
+ * @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
6681
6698
  */
6682
6699
  function () {
6683
6700
  var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(user) {
@@ -6765,8 +6782,8 @@ var StreamChat = /*#__PURE__*/function () {
6765
6782
  * or
6766
6783
  * client.on(event => {console.log(event.type)})
6767
6784
  *
6768
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType> | string} callbackOrString The event type to listen for (optional)
6769
- * @param {EventHandler<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>} [callbackOrNothing] The callback to call
6785
+ * @param {EventHandler<StreamChatGenerics> | string} callbackOrString The event type to listen for (optional)
6786
+ * @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
6770
6787
  *
6771
6788
  * @return {{ unsubscribe: () => void }} Description
6772
6789
  */
@@ -7101,8 +7118,7 @@ var StreamChat = /*#__PURE__*/function () {
7101
7118
 
7102
7119
  this.logger('info', 'client:connect() - WS failed, fallback to longpoll', {
7103
7120
  tags: ['connection', 'client']
7104
- }); // @ts-expect-error
7105
-
7121
+ });
7106
7122
  this.dispatchEvent({
7107
7123
  type: 'transport.changed',
7108
7124
  mode: 'longpoll'
@@ -7168,12 +7184,12 @@ var StreamChat = /*#__PURE__*/function () {
7168
7184
  /**
7169
7185
  * queryUsers - Query users and watch user presence
7170
7186
  *
7171
- * @param {UserFilters<UserType>} filterConditions MongoDB style filter conditions
7172
- * @param {UserSort<UserType>} sort Sort options, for instance [{last_active: -1}].
7187
+ * @param {UserFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
7188
+ * @param {UserSort<StreamChatGenerics>} sort Sort options, for instance [{last_active: -1}].
7173
7189
  * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
7174
7190
  * @param {UserOptions} options Option object, {presence: true}
7175
7191
  *
7176
- * @return {Promise<APIResponse & { users: Array<UserResponse<UserType>> }>} User Query Response
7192
+ * @return {Promise<{ users: Array<UserResponse<StreamChatGenerics>> }>} User Query Response
7177
7193
  */
7178
7194
 
7179
7195
  }, {
@@ -7238,7 +7254,7 @@ var StreamChat = /*#__PURE__*/function () {
7238
7254
  * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
7239
7255
  * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
7240
7256
  *
7241
- * @return {Promise<BannedUsersResponse<ChannelType, CommandType, UserType>>} Ban Query Response
7257
+ * @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
7242
7258
  */
7243
7259
 
7244
7260
  }, {
@@ -7287,7 +7303,7 @@ var StreamChat = /*#__PURE__*/function () {
7287
7303
  * @param {MessageFlagsFilters} filterConditions MongoDB style filter conditions
7288
7304
  * @param {MessageFlagsPaginationOptions} options Option object, {limit: 10, offset:0}
7289
7305
  *
7290
- * @return {Promise<MessageFlagsResponse<ChannelType, CommandType, UserType>>} Message Flags Response
7306
+ * @return {Promise<MessageFlagsResponse<StreamChatGenerics>>} Message Flags Response
7291
7307
  */
7292
7308
 
7293
7309
  }, {
@@ -7330,14 +7346,14 @@ var StreamChat = /*#__PURE__*/function () {
7330
7346
  /**
7331
7347
  * queryChannels - Query channels
7332
7348
  *
7333
- * @param {ChannelFilters<ChannelType, CommandType, UserType>} filterConditions object MongoDB style filters
7334
- * @param {ChannelSort<ChannelType>} [sort] Sort options, for instance {created_at: -1}.
7349
+ * @param {ChannelFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
7350
+ * @param {ChannelSort<StreamChatGenerics>} [sort] Sort options, for instance {created_at: -1}.
7335
7351
  * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
7336
7352
  * @param {ChannelOptions} [options] Options object
7337
7353
  * @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
7338
7354
  * - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
7339
7355
  *
7340
- * @return {Promise<APIResponse & { channels: Array<ChannelAPIResponse<AttachmentType,ChannelType,CommandType,MessageType,ReactionType,UserType>>}> } search channels response
7356
+ * @return {Promise<{ channels: Array<ChannelAPIResponse<AStreamChatGenerics>>}> } search channels response
7341
7357
  */
7342
7358
 
7343
7359
  }, {
@@ -7453,11 +7469,11 @@ var StreamChat = /*#__PURE__*/function () {
7453
7469
  /**
7454
7470
  * search - Query messages
7455
7471
  *
7456
- * @param {ChannelFilters<ChannelType, CommandType, UserType>} filterConditions MongoDB style filter conditions
7457
- * @param {MessageFilters<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> | string} query search query or object MongoDB style filters
7458
- * @param {SearchOptions<MessageType>} [options] Option object, {user_id: 'tommaso'}
7472
+ * @param {ChannelFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
7473
+ * @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
7474
+ * @param {SearchOptions<StreamChatGenerics>} [options] Option object, {user_id: 'tommaso'}
7459
7475
  *
7460
- * @return {Promise<SearchAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} search messages response
7476
+ * @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
7461
7477
  */
7462
7478
 
7463
7479
  }, {
@@ -7601,7 +7617,7 @@ var StreamChat = /*#__PURE__*/function () {
7601
7617
  *
7602
7618
  * @param {string} [userID] User ID. Only works on serverside
7603
7619
  *
7604
- * @return {APIResponse & Device<UserType>[]} Array of devices
7620
+ * @return {Device<StreamChatGenerics>[]} Array of devices
7605
7621
  */
7606
7622
 
7607
7623
  }, {
@@ -7729,7 +7745,7 @@ var StreamChat = /*#__PURE__*/function () {
7729
7745
  * await channel.create() to assign an ID to channel
7730
7746
  *
7731
7747
  * @param {string} channelType The channel type
7732
- * @param {string | ChannelData<ChannelType> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
7748
+ * @param {string | ChannelData<StreamChatGenerics> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
7733
7749
  * @param {object} [custom] Custom data to attach to the channel
7734
7750
  *
7735
7751
  * @return {channel} The channel object, initialize it using channel.watch()
@@ -7785,10 +7801,10 @@ var StreamChat = /*#__PURE__*/function () {
7785
7801
  /**
7786
7802
  * partialUpdateUser - Update the given user object
7787
7803
  *
7788
- * @param {PartialUserUpdate<UserType>} partialUserObject which should contain id and any of "set" or "unset" params;
7804
+ * @param {PartialUserUpdate<StreamChatGenerics>} partialUserObject which should contain id and any of "set" or "unset" params;
7789
7805
  * example: {id: "user1", set:{field: value}, unset:["field2"]}
7790
7806
  *
7791
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>} list of updated users
7807
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
7792
7808
  */
7793
7809
  function () {
7794
7810
  var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(partialUserObject) {
@@ -7819,9 +7835,9 @@ var StreamChat = /*#__PURE__*/function () {
7819
7835
  /**
7820
7836
  * upsertUsers - Batch upsert the list of users
7821
7837
  *
7822
- * @param {UserResponse<UserType>[]} users list of users
7838
+ * @param {UserResponse<StreamChatGenerics>[]} users list of users
7823
7839
  *
7824
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7840
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
7825
7841
  */
7826
7842
 
7827
7843
  }, {
@@ -7907,8 +7923,8 @@ var StreamChat = /*#__PURE__*/function () {
7907
7923
  *
7908
7924
  * updateUsers - Batch update the list of users
7909
7925
  *
7910
- * @param {UserResponse<UserType>[]} users list of users
7911
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7926
+ * @param {UserResponse<StreamChatGenerics>[]} users list of users
7927
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
7912
7928
  */
7913
7929
 
7914
7930
  }, {
@@ -7917,9 +7933,9 @@ var StreamChat = /*#__PURE__*/function () {
7917
7933
  /**
7918
7934
  * upsertUser - Update or Create the given user object
7919
7935
  *
7920
- * @param {UserResponse<UserType>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
7936
+ * @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
7921
7937
  *
7922
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7938
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
7923
7939
  */
7924
7940
  function upsertUser(userObject) {
7925
7941
  return this.upsertUsers([userObject]);
@@ -7929,8 +7945,8 @@ var StreamChat = /*#__PURE__*/function () {
7929
7945
  *
7930
7946
  * updateUser - Update or Create the given user object
7931
7947
  *
7932
- * @param {UserResponse<UserType>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
7933
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7948
+ * @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
7949
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
7934
7950
  */
7935
7951
 
7936
7952
  }, {
@@ -7939,9 +7955,9 @@ var StreamChat = /*#__PURE__*/function () {
7939
7955
  /**
7940
7956
  * partialUpdateUsers - Batch partial update of users
7941
7957
  *
7942
- * @param {PartialUserUpdate<UserType>[]} users list of partial update requests
7958
+ * @param {PartialUserUpdate<StreamChatGenerics>[]} users list of partial update requests
7943
7959
  *
7944
- * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7960
+ * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
7945
7961
  */
7946
7962
  function () {
7947
7963
  var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(users) {
@@ -8130,7 +8146,7 @@ var StreamChat = /*#__PURE__*/function () {
8130
8146
  /** banUser - bans a user from all channels
8131
8147
  *
8132
8148
  * @param {string} targetUserID
8133
- * @param {BanUserOptions<UserType>} [options]
8149
+ * @param {BanUserOptions<StreamChatGenerics>} [options]
8134
8150
  * @returns {Promise<APIResponse>}
8135
8151
  */
8136
8152
 
@@ -8204,7 +8220,7 @@ var StreamChat = /*#__PURE__*/function () {
8204
8220
  /** shadowBan - shadow bans a user from all channels
8205
8221
  *
8206
8222
  * @param {string} targetUserID
8207
- * @param {BanUserOptions<UserType>} [options]
8223
+ * @param {BanUserOptions<StreamChatGenerics>} [options]
8208
8224
  * @returns {Promise<APIResponse>}
8209
8225
  */
8210
8226
 
@@ -8279,8 +8295,8 @@ var StreamChat = /*#__PURE__*/function () {
8279
8295
  *
8280
8296
  * @param {string} targetID
8281
8297
  * @param {string} [userID] Only used with serverside auth
8282
- * @param {MuteUserOptions<UserType>} [options]
8283
- * @returns {Promise<MuteUserResponse<ChannelType, CommandType, UserType>>}
8298
+ * @param {MuteUserOptions<StreamChatGenerics>} [options]
8299
+ * @returns {Promise<MuteUserResponse<StreamChatGenerics>>}
8284
8300
  */
8285
8301
 
8286
8302
  }, {
@@ -8547,7 +8563,7 @@ var StreamChat = /*#__PURE__*/function () {
8547
8563
  * @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
8548
8564
  * @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
8549
8565
  *
8550
- * @return {Promise<FlagReportsResponse<ChannelType, CommandType, UserType>>} Flag Reports Response
8566
+ * @return {Promise<FlagReportsResponse<StreamChatGenerics>>} Flag Reports Response
8551
8567
  */
8552
8568
 
8553
8569
  }, {
@@ -8683,7 +8699,7 @@ var StreamChat = /*#__PURE__*/function () {
8683
8699
  * @deprecated use markChannelsRead instead
8684
8700
  *
8685
8701
  * markAllRead - marks all channels for this user as read
8686
- * @param {MarkAllReadOptions<UserType>} [data]
8702
+ * @param {MarkAllReadOptions<StreamChatGenerics>} [data]
8687
8703
  *
8688
8704
  * @return {Promise<APIResponse>}
8689
8705
  */
@@ -8695,7 +8711,7 @@ var StreamChat = /*#__PURE__*/function () {
8695
8711
  * markChannelsRead - marks channels read -
8696
8712
  * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
8697
8713
  *
8698
- * @param {MarkChannelsReadOptions <UserType>} [data]
8714
+ * @param {MarkChannelsReadOptions <StreamChatGenerics>} [data]
8699
8715
  *
8700
8716
  * @return {Promise<APIResponse>}
8701
8717
  */
@@ -8785,7 +8801,7 @@ var StreamChat = /*#__PURE__*/function () {
8785
8801
  * @param {string} messageId
8786
8802
  * @param {string} language
8787
8803
  *
8788
- * @return {APIResponse & MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>} Response that includes the message
8804
+ * @return {MessageResponse<StreamChatGenerics>} Response that includes the message
8789
8805
  */
8790
8806
 
8791
8807
  }, {
@@ -8904,11 +8920,11 @@ var StreamChat = /*#__PURE__*/function () {
8904
8920
  /**
8905
8921
  * updateMessage - Update the given message
8906
8922
  *
8907
- * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
8923
+ * @param {Omit<MessageResponse<StreamChatGenerics>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
8908
8924
  * @param {string | { id: string }} [userId]
8909
8925
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8910
8926
  *
8911
- * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
8927
+ * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the message
8912
8928
  */
8913
8929
 
8914
8930
  }, {
@@ -8985,13 +9001,13 @@ var StreamChat = /*#__PURE__*/function () {
8985
9001
  *
8986
9002
  * @param {string} id the message id
8987
9003
  *
8988
- * @param {PartialUpdateMessage<MessageType>} partialMessageObject which should contain id and any of "set" or "unset" params;
9004
+ * @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
8989
9005
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8990
9006
  * @param {string | { id: string }} [userId]
8991
9007
  *
8992
9008
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8993
9009
  *
8994
- * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
9010
+ * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
8995
9011
  */
8996
9012
 
8997
9013
  }, {
@@ -9109,7 +9125,7 @@ var StreamChat = /*#__PURE__*/function () {
9109
9125
  }, {
9110
9126
  key: "getUserAgent",
9111
9127
  value: function getUserAgent() {
9112
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "5.3.0");
9128
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.0.0");
9113
9129
  }
9114
9130
  }, {
9115
9131
  key: "setUserAgent",
@@ -10111,6 +10127,131 @@ var StreamChat = /*#__PURE__*/function () {
10111
10127
 
10112
10128
  return deleteUsers;
10113
10129
  }()
10130
+ /**
10131
+ * _createImport - Create an Import Task.
10132
+ *
10133
+ * Note: Do not use this.
10134
+ * It is present for internal usage only.
10135
+ * This function can, and will, break and/or be removed at any point in time.
10136
+ *
10137
+ * @private
10138
+ * @param {string} filename filename of uploaded data
10139
+ *
10140
+ * @return {APIResponse & CreateImportResponse} An ImportTask
10141
+ */
10142
+
10143
+ }, {
10144
+ key: "_createImport",
10145
+ value: function () {
10146
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(filename) {
10147
+ return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10148
+ while (1) {
10149
+ switch (_context70.prev = _context70.next) {
10150
+ case 0:
10151
+ _context70.next = 2;
10152
+ return this.post(this.baseURL + "/imports", {
10153
+ filename: filename
10154
+ });
10155
+
10156
+ case 2:
10157
+ return _context70.abrupt("return", _context70.sent);
10158
+
10159
+ case 3:
10160
+ case "end":
10161
+ return _context70.stop();
10162
+ }
10163
+ }
10164
+ }, _callee70, this);
10165
+ }));
10166
+
10167
+ function _createImport(_x94) {
10168
+ return _createImport2.apply(this, arguments);
10169
+ }
10170
+
10171
+ return _createImport;
10172
+ }()
10173
+ /**
10174
+ * _getImport - Get an Import Task.
10175
+ *
10176
+ * Note: Do not use this.
10177
+ * It is present for internal usage only.
10178
+ * This function can, and will, break and/or be removed at any point in time.
10179
+ *
10180
+ * @private
10181
+ * @param {string} id id of Import Task
10182
+ *
10183
+ * @return {APIResponse & GetImportResponse} An ImportTask
10184
+ */
10185
+
10186
+ }, {
10187
+ key: "_getImport",
10188
+ value: function () {
10189
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(id) {
10190
+ return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10191
+ while (1) {
10192
+ switch (_context71.prev = _context71.next) {
10193
+ case 0:
10194
+ _context71.next = 2;
10195
+ return this.get(this.baseURL + "/imports/".concat(id));
10196
+
10197
+ case 2:
10198
+ return _context71.abrupt("return", _context71.sent);
10199
+
10200
+ case 3:
10201
+ case "end":
10202
+ return _context71.stop();
10203
+ }
10204
+ }
10205
+ }, _callee71, this);
10206
+ }));
10207
+
10208
+ function _getImport(_x95) {
10209
+ return _getImport2.apply(this, arguments);
10210
+ }
10211
+
10212
+ return _getImport;
10213
+ }()
10214
+ /**
10215
+ * _listImports - Lists Import Tasks.
10216
+ *
10217
+ * Note: Do not use this.
10218
+ * It is present for internal usage only.
10219
+ * This function can, and will, break and/or be removed at any point in time.
10220
+ *
10221
+ * @private
10222
+ * @param {ListImportsPaginationOptions} options pagination options
10223
+ *
10224
+ * @return {APIResponse & ListImportsResponse} An ImportTask
10225
+ */
10226
+
10227
+ }, {
10228
+ key: "_listImports",
10229
+ value: function () {
10230
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(options) {
10231
+ return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10232
+ while (1) {
10233
+ switch (_context72.prev = _context72.next) {
10234
+ case 0:
10235
+ _context72.next = 2;
10236
+ return this.get(this.baseURL + "/imports", options);
10237
+
10238
+ case 2:
10239
+ return _context72.abrupt("return", _context72.sent);
10240
+
10241
+ case 3:
10242
+ case "end":
10243
+ return _context72.stop();
10244
+ }
10245
+ }
10246
+ }, _callee72, this);
10247
+ }));
10248
+
10249
+ function _listImports(_x96) {
10250
+ return _listImports2.apply(this, arguments);
10251
+ }
10252
+
10253
+ return _listImports;
10254
+ }()
10114
10255
  }], [{
10115
10256
  key: "getInstance",
10116
10257
  value: function getInstance(key, secretOrOptions, options) {