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.
- package/README.md +21 -13
- package/dist/browser.es.js +290 -149
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +290 -149
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +290 -149
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +290 -149
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +127 -123
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +41 -41
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +200 -170
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client_state.d.ts +6 -6
- package/dist/types/client_state.d.ts.map +1 -1
- package/dist/types/connection.d.ts +10 -10
- package/dist/types/connection.d.ts.map +1 -1
- package/dist/types/connection_fallback.d.ts +7 -7
- package/dist/types/connection_fallback.d.ts.map +1 -1
- package/dist/types/events.d.ts +1 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/insights.d.ts +2 -2
- package/dist/types/token_manager.d.ts +6 -6
- package/dist/types/token_manager.d.ts.map +1 -1
- package/dist/types/types.d.ts +370 -234
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/channel.ts +195 -290
- package/src/channel_state.ts +54 -219
- package/src/client.ts +300 -521
- package/src/client_state.ts +6 -6
- package/src/connection.ts +10 -23
- package/src/connection_fallback.ts +9 -21
- package/src/events.ts +1 -0
- package/src/token_manager.ts +6 -6
- package/src/types.ts +482 -528
- package/src/utils.ts +7 -11
package/dist/browser.js
CHANGED
|
@@ -274,7 +274,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
274
274
|
/**
|
|
275
275
|
* addMessageSorted - Add a message to the state
|
|
276
276
|
*
|
|
277
|
-
* @param {MessageResponse<
|
|
277
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
278
278
|
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
279
279
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
280
280
|
*
|
|
@@ -292,7 +292,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
292
292
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
293
293
|
* and sets the status to received if missing. Returns a message object
|
|
294
294
|
*
|
|
295
|
-
* @param {MessageResponse<
|
|
295
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
296
296
|
*
|
|
297
297
|
*/
|
|
298
298
|
|
|
@@ -314,7 +314,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
314
314
|
/**
|
|
315
315
|
* addMessagesSorted - Add the list of messages to state and resorts the messages
|
|
316
316
|
*
|
|
317
|
-
* @param {Array<MessageResponse<
|
|
317
|
+
* @param {Array<MessageResponse<StreamChatGenerics>>} newMessages A list of messages
|
|
318
318
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
319
319
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
320
320
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
@@ -393,7 +393,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
393
393
|
/**
|
|
394
394
|
* addPinnedMessages - adds messages in pinnedMessages property
|
|
395
395
|
*
|
|
396
|
-
* @param {Array<MessageResponse<
|
|
396
|
+
* @param {Array<MessageResponse<StreamChatGenerics>>} pinnedMessages A list of pinned messages
|
|
397
397
|
*
|
|
398
398
|
*/
|
|
399
399
|
|
|
@@ -407,7 +407,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
407
407
|
/**
|
|
408
408
|
* addPinnedMessage - adds message in pinnedMessages
|
|
409
409
|
*
|
|
410
|
-
* @param {MessageResponse<
|
|
410
|
+
* @param {MessageResponse<StreamChatGenerics>} pinnedMessage message to update
|
|
411
411
|
*
|
|
412
412
|
*/
|
|
413
413
|
|
|
@@ -419,7 +419,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
419
419
|
/**
|
|
420
420
|
* removePinnedMessage - removes pinned message from pinnedMessages
|
|
421
421
|
*
|
|
422
|
-
* @param {MessageResponse<
|
|
422
|
+
* @param {MessageResponse<StreamChatGenerics>} message message to remove
|
|
423
423
|
*
|
|
424
424
|
*/
|
|
425
425
|
|
|
@@ -573,7 +573,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
573
573
|
/**
|
|
574
574
|
* _addToMessageList - Adds a message to a list of messages, tries to update first, appends if message isn't found
|
|
575
575
|
*
|
|
576
|
-
* @param {Array<ReturnType<ChannelState<
|
|
576
|
+
* @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
|
|
577
577
|
* @param message
|
|
578
578
|
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
579
579
|
* @param {string} sortBy field name to use to sort the messages by
|
|
@@ -773,7 +773,8 @@ var EVENT_MAP = {
|
|
|
773
773
|
'user.watching.stop': true,
|
|
774
774
|
// local events
|
|
775
775
|
'connection.changed': true,
|
|
776
|
-
'connection.recovered': true
|
|
776
|
+
'connection.recovered': true,
|
|
777
|
+
'transport.changed': true
|
|
777
778
|
};
|
|
778
779
|
|
|
779
780
|
var IS_VALID_EVENT_MAP_TYPE = _objectSpread$6(_objectSpread$6({}, EVENT_MAP), {}, {
|
|
@@ -830,13 +831,14 @@ function isFileWebAPI(uri) {
|
|
|
830
831
|
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
831
832
|
}
|
|
832
833
|
|
|
834
|
+
function isOwnUser(user) {
|
|
835
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
836
|
+
}
|
|
837
|
+
|
|
833
838
|
function isBlobWebAPI(uri) {
|
|
834
839
|
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
835
840
|
}
|
|
836
841
|
|
|
837
|
-
function isOwnUser(user) {
|
|
838
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
839
|
-
}
|
|
840
842
|
function isOwnUserBaseProperty(property) {
|
|
841
843
|
var ownUserBaseProperties = {
|
|
842
844
|
channel_mutes: true,
|
|
@@ -1031,12 +1033,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1031
1033
|
/**
|
|
1032
1034
|
* constructor - Create a channel
|
|
1033
1035
|
*
|
|
1034
|
-
* @param {StreamChat<
|
|
1036
|
+
* @param {StreamChat<StreamChatGenerics>} client the chat client
|
|
1035
1037
|
* @param {string} type the type of channel
|
|
1036
1038
|
* @param {string} [id] the id of the chat
|
|
1037
|
-
* @param {ChannelData<
|
|
1039
|
+
* @param {ChannelData<StreamChatGenerics>} data any additional custom params
|
|
1038
1040
|
*
|
|
1039
|
-
* @return {Channel<
|
|
1041
|
+
* @return {Channel<StreamChatGenerics>} Returns a new uninitialized channel
|
|
1040
1042
|
*/
|
|
1041
1043
|
function Channel(client, type, id, data) {
|
|
1042
1044
|
var _this = this;
|
|
@@ -1155,7 +1157,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1155
1157
|
/**
|
|
1156
1158
|
* getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
|
|
1157
1159
|
*
|
|
1158
|
-
* @return {StreamChat<
|
|
1160
|
+
* @return {StreamChat<StreamChatGenerics>}
|
|
1159
1161
|
*/
|
|
1160
1162
|
|
|
1161
1163
|
|
|
@@ -1183,11 +1185,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1183
1185
|
/**
|
|
1184
1186
|
* sendMessage - Send a message to this channel
|
|
1185
1187
|
*
|
|
1186
|
-
* @param {Message<
|
|
1188
|
+
* @param {Message<StreamChatGenerics>} message The Message object
|
|
1187
1189
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
1188
1190
|
* @param {boolean} [options.skip_push] Skip sending push notifications
|
|
1189
1191
|
*
|
|
1190
|
-
* @return {Promise<SendMessageAPIResponse<
|
|
1192
|
+
* @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1191
1193
|
*/
|
|
1192
1194
|
|
|
1193
1195
|
}, {
|
|
@@ -1251,9 +1253,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1251
1253
|
/**
|
|
1252
1254
|
* sendEvent - Send an event on this channel
|
|
1253
1255
|
*
|
|
1254
|
-
* @param {Event<
|
|
1256
|
+
* @param {Event<StreamChatGenerics>} event for example {type: 'message.read'}
|
|
1255
1257
|
*
|
|
1256
|
-
* @return {Promise<EventAPIResponse<
|
|
1258
|
+
* @return {Promise<EventAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1257
1259
|
*/
|
|
1258
1260
|
|
|
1259
1261
|
}, {
|
|
@@ -1291,10 +1293,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1291
1293
|
/**
|
|
1292
1294
|
* search - Query messages
|
|
1293
1295
|
*
|
|
1294
|
-
* @param {MessageFilters<
|
|
1295
|
-
* @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<
|
|
1296
|
+
* @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
|
|
1297
|
+
* @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<StreamChatGenerics>}} options Option object, {user_id: 'tommaso'}
|
|
1296
1298
|
*
|
|
1297
|
-
* @return {Promise<SearchAPIResponse<
|
|
1299
|
+
* @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
|
|
1298
1300
|
*/
|
|
1299
1301
|
|
|
1300
1302
|
}, {
|
|
@@ -1379,12 +1381,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1379
1381
|
/**
|
|
1380
1382
|
* queryMembers - Query Members
|
|
1381
1383
|
*
|
|
1382
|
-
* @param {UserFilters<
|
|
1383
|
-
* @param {MemberSort<
|
|
1384
|
+
* @param {UserFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
|
|
1385
|
+
* @param {MemberSort<StreamChatGenerics>} [sort] Sort options, for instance [{created_at: -1}].
|
|
1384
1386
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
|
|
1385
1387
|
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
|
|
1386
1388
|
*
|
|
1387
|
-
* @return {Promise<ChannelMemberAPIResponse<
|
|
1389
|
+
* @return {Promise<ChannelMemberAPIResponse<StreamChatGenerics>>} Query Members response
|
|
1388
1390
|
*/
|
|
1389
1391
|
|
|
1390
1392
|
}, {
|
|
@@ -1446,10 +1448,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1446
1448
|
* sendReaction - Send a reaction about a message
|
|
1447
1449
|
*
|
|
1448
1450
|
* @param {string} messageID the message id
|
|
1449
|
-
* @param {Reaction<
|
|
1451
|
+
* @param {Reaction<StreamChatGenerics>} reaction the reaction object for instance {type: 'love'}
|
|
1450
1452
|
* @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
|
|
1451
1453
|
*
|
|
1452
|
-
* @return {Promise<ReactionAPIResponse<
|
|
1454
|
+
* @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1453
1455
|
*/
|
|
1454
1456
|
|
|
1455
1457
|
}, {
|
|
@@ -1505,7 +1507,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1505
1507
|
* @param {string} reactionType the type of reaction that should be removed
|
|
1506
1508
|
* @param {string} [user_id] the id of the user (used only for server side request) default null
|
|
1507
1509
|
*
|
|
1508
|
-
* @return {Promise<ReactionAPIResponse<
|
|
1510
|
+
* @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1509
1511
|
*/
|
|
1510
1512
|
|
|
1511
1513
|
}, {
|
|
@@ -1530,10 +1532,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1530
1532
|
/**
|
|
1531
1533
|
* update - Edit the channel's custom properties
|
|
1532
1534
|
*
|
|
1533
|
-
* @param {ChannelData<
|
|
1534
|
-
* @param {Message<
|
|
1535
|
+
* @param {ChannelData<StreamChatGenerics>} channelData The object to update the custom properties of this channel with
|
|
1536
|
+
* @param {Message<StreamChatGenerics>} [updateMessage] Optional message object for channel members notification
|
|
1535
1537
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1536
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1538
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1537
1539
|
*/
|
|
1538
1540
|
|
|
1539
1541
|
}, {
|
|
@@ -1583,9 +1585,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1583
1585
|
/**
|
|
1584
1586
|
* updatePartial - partial update channel properties
|
|
1585
1587
|
*
|
|
1586
|
-
* @param {PartialUpdateChannel<
|
|
1588
|
+
* @param {PartialUpdateChannel<StreamChatGenerics>} partial update request
|
|
1587
1589
|
*
|
|
1588
|
-
* @return {Promise<PartialUpdateChannelAPIResponse<
|
|
1590
|
+
* @return {Promise<PartialUpdateChannelAPIResponse<StreamChatGenerics>>}
|
|
1589
1591
|
*/
|
|
1590
1592
|
|
|
1591
1593
|
}, {
|
|
@@ -1620,7 +1622,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1620
1622
|
* enableSlowMode - enable slow mode
|
|
1621
1623
|
*
|
|
1622
1624
|
* @param {number} coolDownInterval the cooldown interval in seconds
|
|
1623
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1625
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1624
1626
|
*/
|
|
1625
1627
|
|
|
1626
1628
|
}, {
|
|
@@ -1659,7 +1661,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1659
1661
|
/**
|
|
1660
1662
|
* disableSlowMode - disable slow mode
|
|
1661
1663
|
*
|
|
1662
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1664
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1663
1665
|
*/
|
|
1664
1666
|
|
|
1665
1667
|
}, {
|
|
@@ -1698,24 +1700,29 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1698
1700
|
/**
|
|
1699
1701
|
* delete - Delete the channel. Messages are permanently removed.
|
|
1700
1702
|
*
|
|
1701
|
-
* @
|
|
1703
|
+
* @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
|
|
1704
|
+
*
|
|
1705
|
+
* @return {Promise<DeleteChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1702
1706
|
*/
|
|
1703
1707
|
|
|
1704
1708
|
}, {
|
|
1705
1709
|
key: "delete",
|
|
1706
1710
|
value: function () {
|
|
1707
1711
|
var _delete2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee11() {
|
|
1712
|
+
var options,
|
|
1713
|
+
_args11 = arguments;
|
|
1708
1714
|
return _regeneratorRuntime__default['default'].wrap(function _callee11$(_context11) {
|
|
1709
1715
|
while (1) {
|
|
1710
1716
|
switch (_context11.prev = _context11.next) {
|
|
1711
1717
|
case 0:
|
|
1712
|
-
|
|
1713
|
-
|
|
1718
|
+
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
1719
|
+
_context11.next = 3;
|
|
1720
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
|
|
1714
1721
|
|
|
1715
|
-
case
|
|
1722
|
+
case 3:
|
|
1716
1723
|
return _context11.abrupt("return", _context11.sent);
|
|
1717
1724
|
|
|
1718
|
-
case
|
|
1725
|
+
case 4:
|
|
1719
1726
|
case "end":
|
|
1720
1727
|
return _context11.stop();
|
|
1721
1728
|
}
|
|
@@ -1731,8 +1738,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1731
1738
|
}()
|
|
1732
1739
|
/**
|
|
1733
1740
|
* truncate - Removes all messages from the channel
|
|
1734
|
-
* @param {TruncateOptions<
|
|
1735
|
-
* @return {Promise<TruncateChannelAPIResponse<
|
|
1741
|
+
* @param {TruncateOptions<StreamChatGenerics>} [options] Defines truncation options
|
|
1742
|
+
* @return {Promise<TruncateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1736
1743
|
*/
|
|
1737
1744
|
|
|
1738
1745
|
}, {
|
|
@@ -1769,9 +1776,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1769
1776
|
/**
|
|
1770
1777
|
* acceptInvite - accept invitation to the channel
|
|
1771
1778
|
*
|
|
1772
|
-
* @param {InviteOptions<
|
|
1779
|
+
* @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
|
|
1773
1780
|
*
|
|
1774
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1781
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1775
1782
|
*/
|
|
1776
1783
|
|
|
1777
1784
|
}, {
|
|
@@ -1810,9 +1817,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1810
1817
|
/**
|
|
1811
1818
|
* rejectInvite - reject invitation to the channel
|
|
1812
1819
|
*
|
|
1813
|
-
* @param {InviteOptions<
|
|
1820
|
+
* @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
|
|
1814
1821
|
*
|
|
1815
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1822
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1816
1823
|
*/
|
|
1817
1824
|
|
|
1818
1825
|
}, {
|
|
@@ -1852,9 +1859,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1852
1859
|
* addMembers - add members to the channel
|
|
1853
1860
|
*
|
|
1854
1861
|
* @param {{user_id: string, channel_role?: Role}[]} members An array of members to add to the channel
|
|
1855
|
-
* @param {Message<
|
|
1862
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1856
1863
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1857
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1864
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1858
1865
|
*/
|
|
1859
1866
|
|
|
1860
1867
|
}, {
|
|
@@ -1895,9 +1902,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1895
1902
|
* addModerators - add moderators to the channel
|
|
1896
1903
|
*
|
|
1897
1904
|
* @param {string[]} members An array of member identifiers
|
|
1898
|
-
* @param {Message<
|
|
1905
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1899
1906
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1900
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1907
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1901
1908
|
*/
|
|
1902
1909
|
|
|
1903
1910
|
}, {
|
|
@@ -1938,9 +1945,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1938
1945
|
* assignRoles - sets member roles in a channel
|
|
1939
1946
|
*
|
|
1940
1947
|
* @param {{channel_role: Role, user_id: string}[]} roles List of role assignments
|
|
1941
|
-
* @param {Message<
|
|
1948
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1942
1949
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1943
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1950
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1944
1951
|
*/
|
|
1945
1952
|
|
|
1946
1953
|
}, {
|
|
@@ -1981,9 +1988,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1981
1988
|
* inviteMembers - invite members to the channel
|
|
1982
1989
|
*
|
|
1983
1990
|
* @param {{user_id: string, channel_role?: Role}[]} members An array of members to invite to the channel
|
|
1984
|
-
* @param {Message<
|
|
1991
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1985
1992
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1986
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1993
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1987
1994
|
*/
|
|
1988
1995
|
|
|
1989
1996
|
}, {
|
|
@@ -2024,9 +2031,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2024
2031
|
* removeMembers - remove members from channel
|
|
2025
2032
|
*
|
|
2026
2033
|
* @param {string[]} members An array of member identifiers
|
|
2027
|
-
* @param {Message<
|
|
2034
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2028
2035
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2029
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2036
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2030
2037
|
*/
|
|
2031
2038
|
|
|
2032
2039
|
}, {
|
|
@@ -2067,9 +2074,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2067
2074
|
* demoteModerators - remove moderator role from channel members
|
|
2068
2075
|
*
|
|
2069
2076
|
* @param {string[]} members An array of member identifiers
|
|
2070
|
-
* @param {Message<
|
|
2077
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2071
2078
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2072
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2079
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2073
2080
|
*/
|
|
2074
2081
|
|
|
2075
2082
|
}, {
|
|
@@ -2109,7 +2116,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2109
2116
|
/**
|
|
2110
2117
|
* _update - executes channel update request
|
|
2111
2118
|
* @param payload Object Update Channel payload
|
|
2112
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2119
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2113
2120
|
* TODO: introduce new type instead of Object in the next major update
|
|
2114
2121
|
*/
|
|
2115
2122
|
|
|
@@ -2147,7 +2154,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2147
2154
|
/**
|
|
2148
2155
|
* mute - mutes the current channel
|
|
2149
2156
|
* @param {{ user_id?: string, expiration?: string }} opts expiration in minutes or user_id
|
|
2150
|
-
* @return {Promise<MuteChannelAPIResponse<
|
|
2157
|
+
* @return {Promise<MuteChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2151
2158
|
*
|
|
2152
2159
|
* example with expiration:
|
|
2153
2160
|
* await channel.mute({expiration: moment.duration(2, 'weeks')});
|
|
@@ -2366,7 +2373,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2366
2373
|
/**
|
|
2367
2374
|
* lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
|
|
2368
2375
|
*
|
|
2369
|
-
* @return {ReturnType<ChannelState<
|
|
2376
|
+
* @return {ReturnType<ChannelState<StreamChatGenerics>['formatMessage']> | undefined} Description
|
|
2370
2377
|
*/
|
|
2371
2378
|
|
|
2372
2379
|
}, {
|
|
@@ -2391,8 +2398,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2391
2398
|
/**
|
|
2392
2399
|
* markRead - Send the mark read event for this user, only works if the `read_events` setting is enabled
|
|
2393
2400
|
*
|
|
2394
|
-
* @param {MarkReadOptions<
|
|
2395
|
-
* @return {Promise<EventAPIResponse<
|
|
2401
|
+
* @param {MarkReadOptions<StreamChatGenerics>} data
|
|
2402
|
+
* @return {Promise<EventAPIResponse<StreamChatGenerics> | null>} Description
|
|
2396
2403
|
*/
|
|
2397
2404
|
|
|
2398
2405
|
}, {
|
|
@@ -2460,9 +2467,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2460
2467
|
/**
|
|
2461
2468
|
* watch - Loads the initial channel state and watches for changes
|
|
2462
2469
|
*
|
|
2463
|
-
* @param {ChannelQueryOptions<
|
|
2470
|
+
* @param {ChannelQueryOptions<StreamChatGenerics>} options additional options for the query endpoint
|
|
2464
2471
|
*
|
|
2465
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2472
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2466
2473
|
*/
|
|
2467
2474
|
|
|
2468
2475
|
}, {
|
|
@@ -2564,9 +2571,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2564
2571
|
* getReplies - List the message replies for a parent message
|
|
2565
2572
|
*
|
|
2566
2573
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2567
|
-
* @param {PaginationOptions & { user?: UserResponse<
|
|
2574
|
+
* @param {PaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2568
2575
|
*
|
|
2569
|
-
* @return {Promise<GetRepliesAPIResponse<
|
|
2576
|
+
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2570
2577
|
*/
|
|
2571
2578
|
|
|
2572
2579
|
}, {
|
|
@@ -2608,10 +2615,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2608
2615
|
/**
|
|
2609
2616
|
* getPinnedMessages - List list pinned messages of the channel
|
|
2610
2617
|
*
|
|
2611
|
-
* @param {PinnedMessagePaginationOptions & { user?: UserResponse<
|
|
2618
|
+
* @param {PinnedMessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2612
2619
|
* @param {PinnedMessagesSort} sort defines sorting direction of pinned messages
|
|
2613
2620
|
*
|
|
2614
|
-
* @return {Promise<GetRepliesAPIResponse<
|
|
2621
|
+
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2615
2622
|
*/
|
|
2616
2623
|
|
|
2617
2624
|
}, {
|
|
@@ -2655,7 +2662,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2655
2662
|
* @param {string} message_id The message id
|
|
2656
2663
|
* @param {{ limit?: number; offset?: number }} options The pagination options
|
|
2657
2664
|
*
|
|
2658
|
-
* @return {Promise<GetReactionsAPIResponse<
|
|
2665
|
+
* @return {Promise<GetReactionsAPIResponse<StreamChatGenerics>>} Server response
|
|
2659
2666
|
*/
|
|
2660
2667
|
|
|
2661
2668
|
}, {
|
|
@@ -2668,7 +2675,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2668
2675
|
*
|
|
2669
2676
|
* @param {string[]} messageIds The ids of the messages to retrieve from this channel
|
|
2670
2677
|
*
|
|
2671
|
-
* @return {Promise<GetMultipleMessagesAPIResponse<
|
|
2678
|
+
* @return {Promise<GetMultipleMessagesAPIResponse<StreamChatGenerics>>} Server response
|
|
2672
2679
|
*/
|
|
2673
2680
|
|
|
2674
2681
|
}, {
|
|
@@ -2702,6 +2709,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2702
2709
|
|
|
2703
2710
|
if (message.shadowed) return false;
|
|
2704
2711
|
if (message.silent) return false;
|
|
2712
|
+
if (message.parent_id && !message.show_in_channel) return false;
|
|
2705
2713
|
if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
|
|
2706
2714
|
if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
|
|
2707
2715
|
if (message.type === 'system') return false;
|
|
@@ -2762,7 +2770,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2762
2770
|
/**
|
|
2763
2771
|
* create - Creates a new channel
|
|
2764
2772
|
*
|
|
2765
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2773
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The Server Response
|
|
2766
2774
|
*/
|
|
2767
2775
|
|
|
2768
2776
|
}, {
|
|
@@ -2771,9 +2779,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2771
2779
|
/**
|
|
2772
2780
|
* query - Query the API, get messages, members or other channel fields
|
|
2773
2781
|
*
|
|
2774
|
-
* @param {ChannelQueryOptions<
|
|
2782
|
+
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
2775
2783
|
*
|
|
2776
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2784
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2777
2785
|
*/
|
|
2778
2786
|
function () {
|
|
2779
2787
|
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee31(options) {
|
|
@@ -2849,7 +2857,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2849
2857
|
* banUser - Bans a user from a channel
|
|
2850
2858
|
*
|
|
2851
2859
|
* @param {string} targetUserID
|
|
2852
|
-
* @param {BanUserOptions<
|
|
2860
|
+
* @param {BanUserOptions<StreamChatGenerics>} options
|
|
2853
2861
|
* @returns {Promise<APIResponse>}
|
|
2854
2862
|
*/
|
|
2855
2863
|
|
|
@@ -3021,7 +3029,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3021
3029
|
* shadowBan - Shadow bans a user from a channel
|
|
3022
3030
|
*
|
|
3023
3031
|
* @param {string} targetUserID
|
|
3024
|
-
* @param {BanUserOptions<
|
|
3032
|
+
* @param {BanUserOptions<StreamChatGenerics>} options
|
|
3025
3033
|
* @returns {Promise<APIResponse>}
|
|
3026
3034
|
*/
|
|
3027
3035
|
|
|
@@ -3105,8 +3113,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3105
3113
|
* or
|
|
3106
3114
|
* channel.on(event => {console.log(event.type)})
|
|
3107
3115
|
*
|
|
3108
|
-
* @param {EventHandler<
|
|
3109
|
-
* @param {EventHandler<
|
|
3116
|
+
* @param {EventHandler<StreamChatGenerics> | EventTypes} callbackOrString The event type to listen for (optional)
|
|
3117
|
+
* @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
|
|
3110
3118
|
*/
|
|
3111
3119
|
|
|
3112
3120
|
}, {
|
|
@@ -3826,6 +3834,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3826
3834
|
|
|
3827
3835
|
_defineProperty__default['default'](this, "onmessage", function (wsID, event) {
|
|
3828
3836
|
if (_this.wsID !== wsID) return;
|
|
3837
|
+
|
|
3838
|
+
_this._log('onmessage() - onmessage callback', {
|
|
3839
|
+
event: event,
|
|
3840
|
+
wsID: wsID
|
|
3841
|
+
});
|
|
3842
|
+
|
|
3829
3843
|
var data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open..
|
|
3830
3844
|
// the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
|
|
3831
3845
|
// after that a ws.onclose..
|
|
@@ -3850,11 +3864,6 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3850
3864
|
|
|
3851
3865
|
_this.lastEvent = new Date();
|
|
3852
3866
|
|
|
3853
|
-
_this._log('onmessage() - onmessage callback', {
|
|
3854
|
-
event: event,
|
|
3855
|
-
wsID: wsID
|
|
3856
|
-
});
|
|
3857
|
-
|
|
3858
3867
|
if (data && data.type === 'health.check') {
|
|
3859
3868
|
_this.scheduleNextPing();
|
|
3860
3869
|
}
|
|
@@ -3931,7 +3940,6 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3931
3940
|
_this.isHealthy = healthy;
|
|
3932
3941
|
|
|
3933
3942
|
if (_this.isHealthy) {
|
|
3934
|
-
//@ts-expect-error
|
|
3935
3943
|
_this.client.dispatchEvent({
|
|
3936
3944
|
type: 'connection.changed',
|
|
3937
3945
|
online: _this.isHealthy
|
|
@@ -3942,7 +3950,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3942
3950
|
|
|
3943
3951
|
|
|
3944
3952
|
setTimeout(function () {
|
|
3945
|
-
if (_this.isHealthy) return;
|
|
3953
|
+
if (_this.isHealthy) return;
|
|
3946
3954
|
|
|
3947
3955
|
_this.client.dispatchEvent({
|
|
3948
3956
|
type: 'connection.changed',
|
|
@@ -4384,27 +4392,36 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4384
4392
|
this.requestID = randomId();
|
|
4385
4393
|
this.client.insightMetrics.connectionStartTimestamp = new Date().getTime();
|
|
4386
4394
|
_context5.prev = 5;
|
|
4387
|
-
|
|
4395
|
+
|
|
4396
|
+
this._log("_connect() - waiting for token");
|
|
4397
|
+
|
|
4398
|
+
_context5.next = 9;
|
|
4388
4399
|
return this.client.tokenManager.tokenReady();
|
|
4389
4400
|
|
|
4390
|
-
case
|
|
4401
|
+
case 9:
|
|
4391
4402
|
this._setupConnectionPromise();
|
|
4392
4403
|
|
|
4393
4404
|
wsURL = this._buildUrl();
|
|
4405
|
+
|
|
4406
|
+
this._log("_connect() - Connecting to ".concat(wsURL), {
|
|
4407
|
+
wsURL: wsURL,
|
|
4408
|
+
requestID: this.requestID
|
|
4409
|
+
});
|
|
4410
|
+
|
|
4394
4411
|
this.ws = new WebSocket__default['default'](wsURL);
|
|
4395
4412
|
this.ws.onopen = this.onopen.bind(this, this.wsID);
|
|
4396
4413
|
this.ws.onclose = this.onclose.bind(this, this.wsID);
|
|
4397
4414
|
this.ws.onerror = this.onerror.bind(this, this.wsID);
|
|
4398
4415
|
this.ws.onmessage = this.onmessage.bind(this, this.wsID);
|
|
4399
|
-
_context5.next =
|
|
4416
|
+
_context5.next = 19;
|
|
4400
4417
|
return this.connectionOpen;
|
|
4401
4418
|
|
|
4402
|
-
case
|
|
4419
|
+
case 19:
|
|
4403
4420
|
response = _context5.sent;
|
|
4404
4421
|
this.isConnecting = false;
|
|
4405
4422
|
|
|
4406
4423
|
if (!response) {
|
|
4407
|
-
_context5.next =
|
|
4424
|
+
_context5.next = 25;
|
|
4408
4425
|
break;
|
|
4409
4426
|
}
|
|
4410
4427
|
|
|
@@ -4417,12 +4434,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4417
4434
|
|
|
4418
4435
|
return _context5.abrupt("return", response);
|
|
4419
4436
|
|
|
4420
|
-
case
|
|
4421
|
-
_context5.next =
|
|
4437
|
+
case 25:
|
|
4438
|
+
_context5.next = 32;
|
|
4422
4439
|
break;
|
|
4423
4440
|
|
|
4424
|
-
case
|
|
4425
|
-
_context5.prev =
|
|
4441
|
+
case 27:
|
|
4442
|
+
_context5.prev = 27;
|
|
4426
4443
|
_context5.t0 = _context5["catch"](5);
|
|
4427
4444
|
this.isConnecting = false;
|
|
4428
4445
|
|
|
@@ -4435,12 +4452,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4435
4452
|
|
|
4436
4453
|
throw _context5.t0;
|
|
4437
4454
|
|
|
4438
|
-
case
|
|
4455
|
+
case 32:
|
|
4439
4456
|
case "end":
|
|
4440
4457
|
return _context5.stop();
|
|
4441
4458
|
}
|
|
4442
4459
|
}
|
|
4443
|
-
}, _callee5, this, [[5,
|
|
4460
|
+
}, _callee5, this, [[5, 27]]);
|
|
4444
4461
|
}));
|
|
4445
4462
|
|
|
4446
4463
|
function _connect() {
|
|
@@ -4901,7 +4918,7 @@ function TokenManager(secret) {
|
|
|
4901
4918
|
* Token provider should return a token string or a promise which resolves to string token.
|
|
4902
4919
|
*
|
|
4903
4920
|
* @param {TokenOrProvider} tokenOrProvider
|
|
4904
|
-
* @param {UserResponse<
|
|
4921
|
+
* @param {UserResponse<StreamChatGenerics>} user
|
|
4905
4922
|
*/
|
|
4906
4923
|
;
|
|
4907
4924
|
|
|
@@ -5289,7 +5306,9 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5289
5306
|
|
|
5290
5307
|
_this._setState(ConnectionState.Connected);
|
|
5291
5308
|
|
|
5292
|
-
_this.connectionID = event.connection_id;
|
|
5309
|
+
_this.connectionID = event.connection_id; // @ts-expect-error
|
|
5310
|
+
|
|
5311
|
+
_this.client.dispatchEvent(event);
|
|
5293
5312
|
|
|
5294
5313
|
_this._poll();
|
|
5295
5314
|
|
|
@@ -5299,20 +5318,20 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5299
5318
|
|
|
5300
5319
|
return _context3.abrupt("return", event);
|
|
5301
5320
|
|
|
5302
|
-
case
|
|
5303
|
-
_context3.prev =
|
|
5321
|
+
case 22:
|
|
5322
|
+
_context3.prev = 22;
|
|
5304
5323
|
_context3.t0 = _context3["catch"](9);
|
|
5305
5324
|
|
|
5306
5325
|
_this._setState(ConnectionState.Closed);
|
|
5307
5326
|
|
|
5308
5327
|
throw _context3.t0;
|
|
5309
5328
|
|
|
5310
|
-
case
|
|
5329
|
+
case 26:
|
|
5311
5330
|
case "end":
|
|
5312
5331
|
return _context3.stop();
|
|
5313
5332
|
}
|
|
5314
5333
|
}
|
|
5315
|
-
}, _callee3, null, [[9,
|
|
5334
|
+
}, _callee3, null, [[9, 22]]);
|
|
5316
5335
|
})));
|
|
5317
5336
|
|
|
5318
5337
|
_defineProperty__default['default'](this, "isHealthy", function () {
|
|
@@ -5391,7 +5410,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5391
5410
|
|
|
5392
5411
|
|
|
5393
5412
|
if (this.state === ConnectionState.Connecting && state === ConnectionState.Connected) {
|
|
5394
|
-
//@ts-expect-error
|
|
5395
5413
|
this.client.dispatchEvent({
|
|
5396
5414
|
type: 'connection.changed',
|
|
5397
5415
|
online: true
|
|
@@ -5399,7 +5417,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5399
5417
|
}
|
|
5400
5418
|
|
|
5401
5419
|
if (state === ConnectionState.Closed || state === ConnectionState.Disconnected) {
|
|
5402
|
-
//@ts-expect-error
|
|
5403
5420
|
this.client.dispatchEvent({
|
|
5404
5421
|
type: 'connection.changed',
|
|
5405
5422
|
online: false
|
|
@@ -6692,9 +6709,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6692
6709
|
/**
|
|
6693
6710
|
* setGuestUser - Setup a temporary guest user
|
|
6694
6711
|
*
|
|
6695
|
-
* @param {UserResponse<
|
|
6712
|
+
* @param {UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
|
|
6696
6713
|
*
|
|
6697
|
-
* @return {ConnectAPIResponse<
|
|
6714
|
+
* @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
|
|
6698
6715
|
*/
|
|
6699
6716
|
function () {
|
|
6700
6717
|
var _setGuestUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee14(user) {
|
|
@@ -6782,8 +6799,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6782
6799
|
* or
|
|
6783
6800
|
* client.on(event => {console.log(event.type)})
|
|
6784
6801
|
*
|
|
6785
|
-
* @param {EventHandler<
|
|
6786
|
-
* @param {EventHandler<
|
|
6802
|
+
* @param {EventHandler<StreamChatGenerics> | string} callbackOrString The event type to listen for (optional)
|
|
6803
|
+
* @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
|
|
6787
6804
|
*
|
|
6788
6805
|
* @return {{ unsubscribe: () => void }} Description
|
|
6789
6806
|
*/
|
|
@@ -7118,8 +7135,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7118
7135
|
|
|
7119
7136
|
this.logger('info', 'client:connect() - WS failed, fallback to longpoll', {
|
|
7120
7137
|
tags: ['connection', 'client']
|
|
7121
|
-
});
|
|
7122
|
-
|
|
7138
|
+
});
|
|
7123
7139
|
this.dispatchEvent({
|
|
7124
7140
|
type: 'transport.changed',
|
|
7125
7141
|
mode: 'longpoll'
|
|
@@ -7185,12 +7201,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7185
7201
|
/**
|
|
7186
7202
|
* queryUsers - Query users and watch user presence
|
|
7187
7203
|
*
|
|
7188
|
-
* @param {UserFilters<
|
|
7189
|
-
* @param {UserSort<
|
|
7204
|
+
* @param {UserFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
|
|
7205
|
+
* @param {UserSort<StreamChatGenerics>} sort Sort options, for instance [{last_active: -1}].
|
|
7190
7206
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
|
|
7191
7207
|
* @param {UserOptions} options Option object, {presence: true}
|
|
7192
7208
|
*
|
|
7193
|
-
* @return {Promise<
|
|
7209
|
+
* @return {Promise<{ users: Array<UserResponse<StreamChatGenerics>> }>} User Query Response
|
|
7194
7210
|
*/
|
|
7195
7211
|
|
|
7196
7212
|
}, {
|
|
@@ -7255,7 +7271,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7255
7271
|
* @param {BannedUsersSort} sort Sort options [{created_at: 1}].
|
|
7256
7272
|
* @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
7257
7273
|
*
|
|
7258
|
-
* @return {Promise<BannedUsersResponse<
|
|
7274
|
+
* @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
|
|
7259
7275
|
*/
|
|
7260
7276
|
|
|
7261
7277
|
}, {
|
|
@@ -7304,7 +7320,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7304
7320
|
* @param {MessageFlagsFilters} filterConditions MongoDB style filter conditions
|
|
7305
7321
|
* @param {MessageFlagsPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
7306
7322
|
*
|
|
7307
|
-
* @return {Promise<MessageFlagsResponse<
|
|
7323
|
+
* @return {Promise<MessageFlagsResponse<StreamChatGenerics>>} Message Flags Response
|
|
7308
7324
|
*/
|
|
7309
7325
|
|
|
7310
7326
|
}, {
|
|
@@ -7347,14 +7363,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7347
7363
|
/**
|
|
7348
7364
|
* queryChannels - Query channels
|
|
7349
7365
|
*
|
|
7350
|
-
* @param {ChannelFilters<
|
|
7351
|
-
* @param {ChannelSort<
|
|
7366
|
+
* @param {ChannelFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
|
|
7367
|
+
* @param {ChannelSort<StreamChatGenerics>} [sort] Sort options, for instance {created_at: -1}.
|
|
7352
7368
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
|
|
7353
7369
|
* @param {ChannelOptions} [options] Options object
|
|
7354
7370
|
* @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
|
|
7355
7371
|
* - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
|
|
7356
7372
|
*
|
|
7357
|
-
* @return {Promise<
|
|
7373
|
+
* @return {Promise<{ channels: Array<ChannelAPIResponse<AStreamChatGenerics>>}> } search channels response
|
|
7358
7374
|
*/
|
|
7359
7375
|
|
|
7360
7376
|
}, {
|
|
@@ -7470,11 +7486,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7470
7486
|
/**
|
|
7471
7487
|
* search - Query messages
|
|
7472
7488
|
*
|
|
7473
|
-
* @param {ChannelFilters<
|
|
7474
|
-
* @param {MessageFilters<
|
|
7475
|
-
* @param {SearchOptions<
|
|
7489
|
+
* @param {ChannelFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
|
|
7490
|
+
* @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
|
|
7491
|
+
* @param {SearchOptions<StreamChatGenerics>} [options] Option object, {user_id: 'tommaso'}
|
|
7476
7492
|
*
|
|
7477
|
-
* @return {Promise<SearchAPIResponse<
|
|
7493
|
+
* @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
|
|
7478
7494
|
*/
|
|
7479
7495
|
|
|
7480
7496
|
}, {
|
|
@@ -7618,7 +7634,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7618
7634
|
*
|
|
7619
7635
|
* @param {string} [userID] User ID. Only works on serverside
|
|
7620
7636
|
*
|
|
7621
|
-
* @return {
|
|
7637
|
+
* @return {Device<StreamChatGenerics>[]} Array of devices
|
|
7622
7638
|
*/
|
|
7623
7639
|
|
|
7624
7640
|
}, {
|
|
@@ -7746,7 +7762,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7746
7762
|
* await channel.create() to assign an ID to channel
|
|
7747
7763
|
*
|
|
7748
7764
|
* @param {string} channelType The channel type
|
|
7749
|
-
* @param {string | ChannelData<
|
|
7765
|
+
* @param {string | ChannelData<StreamChatGenerics> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
|
|
7750
7766
|
* @param {object} [custom] Custom data to attach to the channel
|
|
7751
7767
|
*
|
|
7752
7768
|
* @return {channel} The channel object, initialize it using channel.watch()
|
|
@@ -7802,10 +7818,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7802
7818
|
/**
|
|
7803
7819
|
* partialUpdateUser - Update the given user object
|
|
7804
7820
|
*
|
|
7805
|
-
* @param {PartialUserUpdate<
|
|
7821
|
+
* @param {PartialUserUpdate<StreamChatGenerics>} partialUserObject which should contain id and any of "set" or "unset" params;
|
|
7806
7822
|
* example: {id: "user1", set:{field: value}, unset:["field2"]}
|
|
7807
7823
|
*
|
|
7808
|
-
* @return {Promise<
|
|
7824
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
|
|
7809
7825
|
*/
|
|
7810
7826
|
function () {
|
|
7811
7827
|
var _partialUpdateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(partialUserObject) {
|
|
@@ -7836,9 +7852,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7836
7852
|
/**
|
|
7837
7853
|
* upsertUsers - Batch upsert the list of users
|
|
7838
7854
|
*
|
|
7839
|
-
* @param {UserResponse<
|
|
7855
|
+
* @param {UserResponse<StreamChatGenerics>[]} users list of users
|
|
7840
7856
|
*
|
|
7841
|
-
* @return {Promise<
|
|
7857
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7842
7858
|
*/
|
|
7843
7859
|
|
|
7844
7860
|
}, {
|
|
@@ -7924,8 +7940,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7924
7940
|
*
|
|
7925
7941
|
* updateUsers - Batch update the list of users
|
|
7926
7942
|
*
|
|
7927
|
-
* @param {UserResponse<
|
|
7928
|
-
* @return {Promise<
|
|
7943
|
+
* @param {UserResponse<StreamChatGenerics>[]} users list of users
|
|
7944
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7929
7945
|
*/
|
|
7930
7946
|
|
|
7931
7947
|
}, {
|
|
@@ -7934,9 +7950,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7934
7950
|
/**
|
|
7935
7951
|
* upsertUser - Update or Create the given user object
|
|
7936
7952
|
*
|
|
7937
|
-
* @param {UserResponse<
|
|
7953
|
+
* @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
|
|
7938
7954
|
*
|
|
7939
|
-
* @return {Promise<
|
|
7955
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7940
7956
|
*/
|
|
7941
7957
|
function upsertUser(userObject) {
|
|
7942
7958
|
return this.upsertUsers([userObject]);
|
|
@@ -7946,8 +7962,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7946
7962
|
*
|
|
7947
7963
|
* updateUser - Update or Create the given user object
|
|
7948
7964
|
*
|
|
7949
|
-
* @param {UserResponse<
|
|
7950
|
-
* @return {Promise<
|
|
7965
|
+
* @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
|
|
7966
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7951
7967
|
*/
|
|
7952
7968
|
|
|
7953
7969
|
}, {
|
|
@@ -7956,9 +7972,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7956
7972
|
/**
|
|
7957
7973
|
* partialUpdateUsers - Batch partial update of users
|
|
7958
7974
|
*
|
|
7959
|
-
* @param {PartialUserUpdate<
|
|
7975
|
+
* @param {PartialUserUpdate<StreamChatGenerics>[]} users list of partial update requests
|
|
7960
7976
|
*
|
|
7961
|
-
* @return {Promise<
|
|
7977
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7962
7978
|
*/
|
|
7963
7979
|
function () {
|
|
7964
7980
|
var _partialUpdateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee27(users) {
|
|
@@ -8147,7 +8163,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8147
8163
|
/** banUser - bans a user from all channels
|
|
8148
8164
|
*
|
|
8149
8165
|
* @param {string} targetUserID
|
|
8150
|
-
* @param {BanUserOptions<
|
|
8166
|
+
* @param {BanUserOptions<StreamChatGenerics>} [options]
|
|
8151
8167
|
* @returns {Promise<APIResponse>}
|
|
8152
8168
|
*/
|
|
8153
8169
|
|
|
@@ -8221,7 +8237,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8221
8237
|
/** shadowBan - shadow bans a user from all channels
|
|
8222
8238
|
*
|
|
8223
8239
|
* @param {string} targetUserID
|
|
8224
|
-
* @param {BanUserOptions<
|
|
8240
|
+
* @param {BanUserOptions<StreamChatGenerics>} [options]
|
|
8225
8241
|
* @returns {Promise<APIResponse>}
|
|
8226
8242
|
*/
|
|
8227
8243
|
|
|
@@ -8296,8 +8312,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8296
8312
|
*
|
|
8297
8313
|
* @param {string} targetID
|
|
8298
8314
|
* @param {string} [userID] Only used with serverside auth
|
|
8299
|
-
* @param {MuteUserOptions<
|
|
8300
|
-
* @returns {Promise<MuteUserResponse<
|
|
8315
|
+
* @param {MuteUserOptions<StreamChatGenerics>} [options]
|
|
8316
|
+
* @returns {Promise<MuteUserResponse<StreamChatGenerics>>}
|
|
8301
8317
|
*/
|
|
8302
8318
|
|
|
8303
8319
|
}, {
|
|
@@ -8564,7 +8580,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8564
8580
|
* @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
|
|
8565
8581
|
* @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
8566
8582
|
*
|
|
8567
|
-
* @return {Promise<FlagReportsResponse<
|
|
8583
|
+
* @return {Promise<FlagReportsResponse<StreamChatGenerics>>} Flag Reports Response
|
|
8568
8584
|
*/
|
|
8569
8585
|
|
|
8570
8586
|
}, {
|
|
@@ -8700,7 +8716,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8700
8716
|
* @deprecated use markChannelsRead instead
|
|
8701
8717
|
*
|
|
8702
8718
|
* markAllRead - marks all channels for this user as read
|
|
8703
|
-
* @param {MarkAllReadOptions<
|
|
8719
|
+
* @param {MarkAllReadOptions<StreamChatGenerics>} [data]
|
|
8704
8720
|
*
|
|
8705
8721
|
* @return {Promise<APIResponse>}
|
|
8706
8722
|
*/
|
|
@@ -8712,7 +8728,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8712
8728
|
* markChannelsRead - marks channels read -
|
|
8713
8729
|
* it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
|
|
8714
8730
|
*
|
|
8715
|
-
* @param {MarkChannelsReadOptions <
|
|
8731
|
+
* @param {MarkChannelsReadOptions <StreamChatGenerics>} [data]
|
|
8716
8732
|
*
|
|
8717
8733
|
* @return {Promise<APIResponse>}
|
|
8718
8734
|
*/
|
|
@@ -8802,7 +8818,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8802
8818
|
* @param {string} messageId
|
|
8803
8819
|
* @param {string} language
|
|
8804
8820
|
*
|
|
8805
|
-
* @return {
|
|
8821
|
+
* @return {MessageResponse<StreamChatGenerics>} Response that includes the message
|
|
8806
8822
|
*/
|
|
8807
8823
|
|
|
8808
8824
|
}, {
|
|
@@ -8921,11 +8937,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8921
8937
|
/**
|
|
8922
8938
|
* updateMessage - Update the given message
|
|
8923
8939
|
*
|
|
8924
|
-
* @param {Omit<MessageResponse<
|
|
8940
|
+
* @param {Omit<MessageResponse<StreamChatGenerics>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
|
|
8925
8941
|
* @param {string | { id: string }} [userId]
|
|
8926
8942
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
8927
8943
|
*
|
|
8928
|
-
* @return {
|
|
8944
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the message
|
|
8929
8945
|
*/
|
|
8930
8946
|
|
|
8931
8947
|
}, {
|
|
@@ -9002,13 +9018,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9002
9018
|
*
|
|
9003
9019
|
* @param {string} id the message id
|
|
9004
9020
|
*
|
|
9005
|
-
* @param {PartialUpdateMessage<
|
|
9021
|
+
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
9006
9022
|
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
9007
9023
|
* @param {string | { id: string }} [userId]
|
|
9008
9024
|
*
|
|
9009
9025
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
9010
9026
|
*
|
|
9011
|
-
* @return {
|
|
9027
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
|
|
9012
9028
|
*/
|
|
9013
9029
|
|
|
9014
9030
|
}, {
|
|
@@ -9126,7 +9142,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9126
9142
|
}, {
|
|
9127
9143
|
key: "getUserAgent",
|
|
9128
9144
|
value: function getUserAgent() {
|
|
9129
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "
|
|
9145
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.0.0");
|
|
9130
9146
|
}
|
|
9131
9147
|
}, {
|
|
9132
9148
|
key: "setUserAgent",
|
|
@@ -10128,6 +10144,131 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10128
10144
|
|
|
10129
10145
|
return deleteUsers;
|
|
10130
10146
|
}()
|
|
10147
|
+
/**
|
|
10148
|
+
* _createImport - Create an Import Task.
|
|
10149
|
+
*
|
|
10150
|
+
* Note: Do not use this.
|
|
10151
|
+
* It is present for internal usage only.
|
|
10152
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10153
|
+
*
|
|
10154
|
+
* @private
|
|
10155
|
+
* @param {string} filename filename of uploaded data
|
|
10156
|
+
*
|
|
10157
|
+
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10158
|
+
*/
|
|
10159
|
+
|
|
10160
|
+
}, {
|
|
10161
|
+
key: "_createImport",
|
|
10162
|
+
value: function () {
|
|
10163
|
+
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(filename) {
|
|
10164
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
|
|
10165
|
+
while (1) {
|
|
10166
|
+
switch (_context70.prev = _context70.next) {
|
|
10167
|
+
case 0:
|
|
10168
|
+
_context70.next = 2;
|
|
10169
|
+
return this.post(this.baseURL + "/imports", {
|
|
10170
|
+
filename: filename
|
|
10171
|
+
});
|
|
10172
|
+
|
|
10173
|
+
case 2:
|
|
10174
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10175
|
+
|
|
10176
|
+
case 3:
|
|
10177
|
+
case "end":
|
|
10178
|
+
return _context70.stop();
|
|
10179
|
+
}
|
|
10180
|
+
}
|
|
10181
|
+
}, _callee70, this);
|
|
10182
|
+
}));
|
|
10183
|
+
|
|
10184
|
+
function _createImport(_x94) {
|
|
10185
|
+
return _createImport2.apply(this, arguments);
|
|
10186
|
+
}
|
|
10187
|
+
|
|
10188
|
+
return _createImport;
|
|
10189
|
+
}()
|
|
10190
|
+
/**
|
|
10191
|
+
* _getImport - Get an Import Task.
|
|
10192
|
+
*
|
|
10193
|
+
* Note: Do not use this.
|
|
10194
|
+
* It is present for internal usage only.
|
|
10195
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10196
|
+
*
|
|
10197
|
+
* @private
|
|
10198
|
+
* @param {string} id id of Import Task
|
|
10199
|
+
*
|
|
10200
|
+
* @return {APIResponse & GetImportResponse} An ImportTask
|
|
10201
|
+
*/
|
|
10202
|
+
|
|
10203
|
+
}, {
|
|
10204
|
+
key: "_getImport",
|
|
10205
|
+
value: function () {
|
|
10206
|
+
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(id) {
|
|
10207
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
10208
|
+
while (1) {
|
|
10209
|
+
switch (_context71.prev = _context71.next) {
|
|
10210
|
+
case 0:
|
|
10211
|
+
_context71.next = 2;
|
|
10212
|
+
return this.get(this.baseURL + "/imports/".concat(id));
|
|
10213
|
+
|
|
10214
|
+
case 2:
|
|
10215
|
+
return _context71.abrupt("return", _context71.sent);
|
|
10216
|
+
|
|
10217
|
+
case 3:
|
|
10218
|
+
case "end":
|
|
10219
|
+
return _context71.stop();
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
}, _callee71, this);
|
|
10223
|
+
}));
|
|
10224
|
+
|
|
10225
|
+
function _getImport(_x95) {
|
|
10226
|
+
return _getImport2.apply(this, arguments);
|
|
10227
|
+
}
|
|
10228
|
+
|
|
10229
|
+
return _getImport;
|
|
10230
|
+
}()
|
|
10231
|
+
/**
|
|
10232
|
+
* _listImports - Lists Import Tasks.
|
|
10233
|
+
*
|
|
10234
|
+
* Note: Do not use this.
|
|
10235
|
+
* It is present for internal usage only.
|
|
10236
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10237
|
+
*
|
|
10238
|
+
* @private
|
|
10239
|
+
* @param {ListImportsPaginationOptions} options pagination options
|
|
10240
|
+
*
|
|
10241
|
+
* @return {APIResponse & ListImportsResponse} An ImportTask
|
|
10242
|
+
*/
|
|
10243
|
+
|
|
10244
|
+
}, {
|
|
10245
|
+
key: "_listImports",
|
|
10246
|
+
value: function () {
|
|
10247
|
+
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(options) {
|
|
10248
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
10249
|
+
while (1) {
|
|
10250
|
+
switch (_context72.prev = _context72.next) {
|
|
10251
|
+
case 0:
|
|
10252
|
+
_context72.next = 2;
|
|
10253
|
+
return this.get(this.baseURL + "/imports", options);
|
|
10254
|
+
|
|
10255
|
+
case 2:
|
|
10256
|
+
return _context72.abrupt("return", _context72.sent);
|
|
10257
|
+
|
|
10258
|
+
case 3:
|
|
10259
|
+
case "end":
|
|
10260
|
+
return _context72.stop();
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
}, _callee72, this);
|
|
10264
|
+
}));
|
|
10265
|
+
|
|
10266
|
+
function _listImports(_x96) {
|
|
10267
|
+
return _listImports2.apply(this, arguments);
|
|
10268
|
+
}
|
|
10269
|
+
|
|
10270
|
+
return _listImports;
|
|
10271
|
+
}()
|
|
10131
10272
|
}], [{
|
|
10132
10273
|
key: "getInstance",
|
|
10133
10274
|
value: function getInstance(key, secretOrOptions, options) {
|