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.es.js
CHANGED
|
@@ -254,7 +254,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
254
254
|
/**
|
|
255
255
|
* addMessageSorted - Add a message to the state
|
|
256
256
|
*
|
|
257
|
-
* @param {MessageResponse<
|
|
257
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
258
258
|
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
259
259
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
260
260
|
*
|
|
@@ -272,7 +272,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
272
272
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
273
273
|
* and sets the status to received if missing. Returns a message object
|
|
274
274
|
*
|
|
275
|
-
* @param {MessageResponse<
|
|
275
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
276
276
|
*
|
|
277
277
|
*/
|
|
278
278
|
|
|
@@ -294,7 +294,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
294
294
|
/**
|
|
295
295
|
* addMessagesSorted - Add the list of messages to state and resorts the messages
|
|
296
296
|
*
|
|
297
|
-
* @param {Array<MessageResponse<
|
|
297
|
+
* @param {Array<MessageResponse<StreamChatGenerics>>} newMessages A list of messages
|
|
298
298
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
299
299
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
300
300
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
@@ -373,7 +373,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
373
373
|
/**
|
|
374
374
|
* addPinnedMessages - adds messages in pinnedMessages property
|
|
375
375
|
*
|
|
376
|
-
* @param {Array<MessageResponse<
|
|
376
|
+
* @param {Array<MessageResponse<StreamChatGenerics>>} pinnedMessages A list of pinned messages
|
|
377
377
|
*
|
|
378
378
|
*/
|
|
379
379
|
|
|
@@ -387,7 +387,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
387
387
|
/**
|
|
388
388
|
* addPinnedMessage - adds message in pinnedMessages
|
|
389
389
|
*
|
|
390
|
-
* @param {MessageResponse<
|
|
390
|
+
* @param {MessageResponse<StreamChatGenerics>} pinnedMessage message to update
|
|
391
391
|
*
|
|
392
392
|
*/
|
|
393
393
|
|
|
@@ -399,7 +399,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
399
399
|
/**
|
|
400
400
|
* removePinnedMessage - removes pinned message from pinnedMessages
|
|
401
401
|
*
|
|
402
|
-
* @param {MessageResponse<
|
|
402
|
+
* @param {MessageResponse<StreamChatGenerics>} message message to remove
|
|
403
403
|
*
|
|
404
404
|
*/
|
|
405
405
|
|
|
@@ -553,7 +553,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
553
553
|
/**
|
|
554
554
|
* _addToMessageList - Adds a message to a list of messages, tries to update first, appends if message isn't found
|
|
555
555
|
*
|
|
556
|
-
* @param {Array<ReturnType<ChannelState<
|
|
556
|
+
* @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
|
|
557
557
|
* @param message
|
|
558
558
|
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
559
559
|
* @param {string} sortBy field name to use to sort the messages by
|
|
@@ -753,7 +753,8 @@ var EVENT_MAP = {
|
|
|
753
753
|
'user.watching.stop': true,
|
|
754
754
|
// local events
|
|
755
755
|
'connection.changed': true,
|
|
756
|
-
'connection.recovered': true
|
|
756
|
+
'connection.recovered': true,
|
|
757
|
+
'transport.changed': true
|
|
757
758
|
};
|
|
758
759
|
|
|
759
760
|
var IS_VALID_EVENT_MAP_TYPE = _objectSpread$6(_objectSpread$6({}, EVENT_MAP), {}, {
|
|
@@ -810,13 +811,14 @@ function isFileWebAPI(uri) {
|
|
|
810
811
|
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
811
812
|
}
|
|
812
813
|
|
|
814
|
+
function isOwnUser(user) {
|
|
815
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
816
|
+
}
|
|
817
|
+
|
|
813
818
|
function isBlobWebAPI(uri) {
|
|
814
819
|
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
815
820
|
}
|
|
816
821
|
|
|
817
|
-
function isOwnUser(user) {
|
|
818
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
819
|
-
}
|
|
820
822
|
function isOwnUserBaseProperty(property) {
|
|
821
823
|
var ownUserBaseProperties = {
|
|
822
824
|
channel_mutes: true,
|
|
@@ -1011,12 +1013,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1011
1013
|
/**
|
|
1012
1014
|
* constructor - Create a channel
|
|
1013
1015
|
*
|
|
1014
|
-
* @param {StreamChat<
|
|
1016
|
+
* @param {StreamChat<StreamChatGenerics>} client the chat client
|
|
1015
1017
|
* @param {string} type the type of channel
|
|
1016
1018
|
* @param {string} [id] the id of the chat
|
|
1017
|
-
* @param {ChannelData<
|
|
1019
|
+
* @param {ChannelData<StreamChatGenerics>} data any additional custom params
|
|
1018
1020
|
*
|
|
1019
|
-
* @return {Channel<
|
|
1021
|
+
* @return {Channel<StreamChatGenerics>} Returns a new uninitialized channel
|
|
1020
1022
|
*/
|
|
1021
1023
|
function Channel(client, type, id, data) {
|
|
1022
1024
|
var _this = this;
|
|
@@ -1135,7 +1137,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1135
1137
|
/**
|
|
1136
1138
|
* getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
|
|
1137
1139
|
*
|
|
1138
|
-
* @return {StreamChat<
|
|
1140
|
+
* @return {StreamChat<StreamChatGenerics>}
|
|
1139
1141
|
*/
|
|
1140
1142
|
|
|
1141
1143
|
|
|
@@ -1163,11 +1165,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1163
1165
|
/**
|
|
1164
1166
|
* sendMessage - Send a message to this channel
|
|
1165
1167
|
*
|
|
1166
|
-
* @param {Message<
|
|
1168
|
+
* @param {Message<StreamChatGenerics>} message The Message object
|
|
1167
1169
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
1168
1170
|
* @param {boolean} [options.skip_push] Skip sending push notifications
|
|
1169
1171
|
*
|
|
1170
|
-
* @return {Promise<SendMessageAPIResponse<
|
|
1172
|
+
* @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1171
1173
|
*/
|
|
1172
1174
|
|
|
1173
1175
|
}, {
|
|
@@ -1231,9 +1233,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1231
1233
|
/**
|
|
1232
1234
|
* sendEvent - Send an event on this channel
|
|
1233
1235
|
*
|
|
1234
|
-
* @param {Event<
|
|
1236
|
+
* @param {Event<StreamChatGenerics>} event for example {type: 'message.read'}
|
|
1235
1237
|
*
|
|
1236
|
-
* @return {Promise<EventAPIResponse<
|
|
1238
|
+
* @return {Promise<EventAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1237
1239
|
*/
|
|
1238
1240
|
|
|
1239
1241
|
}, {
|
|
@@ -1271,10 +1273,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1271
1273
|
/**
|
|
1272
1274
|
* search - Query messages
|
|
1273
1275
|
*
|
|
1274
|
-
* @param {MessageFilters<
|
|
1275
|
-
* @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<
|
|
1276
|
+
* @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
|
|
1277
|
+
* @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters<StreamChatGenerics>}} options Option object, {user_id: 'tommaso'}
|
|
1276
1278
|
*
|
|
1277
|
-
* @return {Promise<SearchAPIResponse<
|
|
1279
|
+
* @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
|
|
1278
1280
|
*/
|
|
1279
1281
|
|
|
1280
1282
|
}, {
|
|
@@ -1359,12 +1361,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1359
1361
|
/**
|
|
1360
1362
|
* queryMembers - Query Members
|
|
1361
1363
|
*
|
|
1362
|
-
* @param {UserFilters<
|
|
1363
|
-
* @param {MemberSort<
|
|
1364
|
+
* @param {UserFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
|
|
1365
|
+
* @param {MemberSort<StreamChatGenerics>} [sort] Sort options, for instance [{created_at: -1}].
|
|
1364
1366
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
|
|
1365
1367
|
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
|
|
1366
1368
|
*
|
|
1367
|
-
* @return {Promise<ChannelMemberAPIResponse<
|
|
1369
|
+
* @return {Promise<ChannelMemberAPIResponse<StreamChatGenerics>>} Query Members response
|
|
1368
1370
|
*/
|
|
1369
1371
|
|
|
1370
1372
|
}, {
|
|
@@ -1426,10 +1428,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1426
1428
|
* sendReaction - Send a reaction about a message
|
|
1427
1429
|
*
|
|
1428
1430
|
* @param {string} messageID the message id
|
|
1429
|
-
* @param {Reaction<
|
|
1431
|
+
* @param {Reaction<StreamChatGenerics>} reaction the reaction object for instance {type: 'love'}
|
|
1430
1432
|
* @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
|
|
1431
1433
|
*
|
|
1432
|
-
* @return {Promise<ReactionAPIResponse<
|
|
1434
|
+
* @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1433
1435
|
*/
|
|
1434
1436
|
|
|
1435
1437
|
}, {
|
|
@@ -1485,7 +1487,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1485
1487
|
* @param {string} reactionType the type of reaction that should be removed
|
|
1486
1488
|
* @param {string} [user_id] the id of the user (used only for server side request) default null
|
|
1487
1489
|
*
|
|
1488
|
-
* @return {Promise<ReactionAPIResponse<
|
|
1490
|
+
* @return {Promise<ReactionAPIResponse<StreamChatGenerics>>} The Server Response
|
|
1489
1491
|
*/
|
|
1490
1492
|
|
|
1491
1493
|
}, {
|
|
@@ -1510,10 +1512,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1510
1512
|
/**
|
|
1511
1513
|
* update - Edit the channel's custom properties
|
|
1512
1514
|
*
|
|
1513
|
-
* @param {ChannelData<
|
|
1514
|
-
* @param {Message<
|
|
1515
|
+
* @param {ChannelData<StreamChatGenerics>} channelData The object to update the custom properties of this channel with
|
|
1516
|
+
* @param {Message<StreamChatGenerics>} [updateMessage] Optional message object for channel members notification
|
|
1515
1517
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1516
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1518
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1517
1519
|
*/
|
|
1518
1520
|
|
|
1519
1521
|
}, {
|
|
@@ -1563,9 +1565,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1563
1565
|
/**
|
|
1564
1566
|
* updatePartial - partial update channel properties
|
|
1565
1567
|
*
|
|
1566
|
-
* @param {PartialUpdateChannel<
|
|
1568
|
+
* @param {PartialUpdateChannel<StreamChatGenerics>} partial update request
|
|
1567
1569
|
*
|
|
1568
|
-
* @return {Promise<PartialUpdateChannelAPIResponse<
|
|
1570
|
+
* @return {Promise<PartialUpdateChannelAPIResponse<StreamChatGenerics>>}
|
|
1569
1571
|
*/
|
|
1570
1572
|
|
|
1571
1573
|
}, {
|
|
@@ -1600,7 +1602,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1600
1602
|
* enableSlowMode - enable slow mode
|
|
1601
1603
|
*
|
|
1602
1604
|
* @param {number} coolDownInterval the cooldown interval in seconds
|
|
1603
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1605
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1604
1606
|
*/
|
|
1605
1607
|
|
|
1606
1608
|
}, {
|
|
@@ -1639,7 +1641,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1639
1641
|
/**
|
|
1640
1642
|
* disableSlowMode - disable slow mode
|
|
1641
1643
|
*
|
|
1642
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1644
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1643
1645
|
*/
|
|
1644
1646
|
|
|
1645
1647
|
}, {
|
|
@@ -1678,24 +1680,29 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1678
1680
|
/**
|
|
1679
1681
|
* delete - Delete the channel. Messages are permanently removed.
|
|
1680
1682
|
*
|
|
1681
|
-
* @
|
|
1683
|
+
* @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
|
|
1684
|
+
*
|
|
1685
|
+
* @return {Promise<DeleteChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1682
1686
|
*/
|
|
1683
1687
|
|
|
1684
1688
|
}, {
|
|
1685
1689
|
key: "delete",
|
|
1686
1690
|
value: function () {
|
|
1687
1691
|
var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
1692
|
+
var options,
|
|
1693
|
+
_args11 = arguments;
|
|
1688
1694
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1689
1695
|
while (1) {
|
|
1690
1696
|
switch (_context11.prev = _context11.next) {
|
|
1691
1697
|
case 0:
|
|
1692
|
-
|
|
1693
|
-
|
|
1698
|
+
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
1699
|
+
_context11.next = 3;
|
|
1700
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
|
|
1694
1701
|
|
|
1695
|
-
case
|
|
1702
|
+
case 3:
|
|
1696
1703
|
return _context11.abrupt("return", _context11.sent);
|
|
1697
1704
|
|
|
1698
|
-
case
|
|
1705
|
+
case 4:
|
|
1699
1706
|
case "end":
|
|
1700
1707
|
return _context11.stop();
|
|
1701
1708
|
}
|
|
@@ -1711,8 +1718,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1711
1718
|
}()
|
|
1712
1719
|
/**
|
|
1713
1720
|
* truncate - Removes all messages from the channel
|
|
1714
|
-
* @param {TruncateOptions<
|
|
1715
|
-
* @return {Promise<TruncateChannelAPIResponse<
|
|
1721
|
+
* @param {TruncateOptions<StreamChatGenerics>} [options] Defines truncation options
|
|
1722
|
+
* @return {Promise<TruncateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1716
1723
|
*/
|
|
1717
1724
|
|
|
1718
1725
|
}, {
|
|
@@ -1749,9 +1756,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1749
1756
|
/**
|
|
1750
1757
|
* acceptInvite - accept invitation to the channel
|
|
1751
1758
|
*
|
|
1752
|
-
* @param {InviteOptions<
|
|
1759
|
+
* @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
|
|
1753
1760
|
*
|
|
1754
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1761
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1755
1762
|
*/
|
|
1756
1763
|
|
|
1757
1764
|
}, {
|
|
@@ -1790,9 +1797,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1790
1797
|
/**
|
|
1791
1798
|
* rejectInvite - reject invitation to the channel
|
|
1792
1799
|
*
|
|
1793
|
-
* @param {InviteOptions<
|
|
1800
|
+
* @param {InviteOptions<StreamChatGenerics>} [options] The object to update the custom properties of this channel with
|
|
1794
1801
|
*
|
|
1795
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1802
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1796
1803
|
*/
|
|
1797
1804
|
|
|
1798
1805
|
}, {
|
|
@@ -1832,9 +1839,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1832
1839
|
* addMembers - add members to the channel
|
|
1833
1840
|
*
|
|
1834
1841
|
* @param {{user_id: string, channel_role?: Role}[]} members An array of members to add to the channel
|
|
1835
|
-
* @param {Message<
|
|
1842
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1836
1843
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1837
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1844
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1838
1845
|
*/
|
|
1839
1846
|
|
|
1840
1847
|
}, {
|
|
@@ -1875,9 +1882,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1875
1882
|
* addModerators - add moderators to the channel
|
|
1876
1883
|
*
|
|
1877
1884
|
* @param {string[]} members An array of member identifiers
|
|
1878
|
-
* @param {Message<
|
|
1885
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1879
1886
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1880
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1887
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1881
1888
|
*/
|
|
1882
1889
|
|
|
1883
1890
|
}, {
|
|
@@ -1918,9 +1925,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1918
1925
|
* assignRoles - sets member roles in a channel
|
|
1919
1926
|
*
|
|
1920
1927
|
* @param {{channel_role: Role, user_id: string}[]} roles List of role assignments
|
|
1921
|
-
* @param {Message<
|
|
1928
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1922
1929
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1923
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1930
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1924
1931
|
*/
|
|
1925
1932
|
|
|
1926
1933
|
}, {
|
|
@@ -1961,9 +1968,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1961
1968
|
* inviteMembers - invite members to the channel
|
|
1962
1969
|
*
|
|
1963
1970
|
* @param {{user_id: string, channel_role?: Role}[]} members An array of members to invite to the channel
|
|
1964
|
-
* @param {Message<
|
|
1971
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
1965
1972
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
1966
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
1973
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
1967
1974
|
*/
|
|
1968
1975
|
|
|
1969
1976
|
}, {
|
|
@@ -2004,9 +2011,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2004
2011
|
* removeMembers - remove members from channel
|
|
2005
2012
|
*
|
|
2006
2013
|
* @param {string[]} members An array of member identifiers
|
|
2007
|
-
* @param {Message<
|
|
2014
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2008
2015
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2009
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2016
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2010
2017
|
*/
|
|
2011
2018
|
|
|
2012
2019
|
}, {
|
|
@@ -2047,9 +2054,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2047
2054
|
* demoteModerators - remove moderator role from channel members
|
|
2048
2055
|
*
|
|
2049
2056
|
* @param {string[]} members An array of member identifiers
|
|
2050
|
-
* @param {Message<
|
|
2057
|
+
* @param {Message<StreamChatGenerics>} [message] Optional message object for channel members notification
|
|
2051
2058
|
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
2052
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2059
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2053
2060
|
*/
|
|
2054
2061
|
|
|
2055
2062
|
}, {
|
|
@@ -2089,7 +2096,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2089
2096
|
/**
|
|
2090
2097
|
* _update - executes channel update request
|
|
2091
2098
|
* @param payload Object Update Channel payload
|
|
2092
|
-
* @return {Promise<UpdateChannelAPIResponse<
|
|
2099
|
+
* @return {Promise<UpdateChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2093
2100
|
* TODO: introduce new type instead of Object in the next major update
|
|
2094
2101
|
*/
|
|
2095
2102
|
|
|
@@ -2127,7 +2134,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2127
2134
|
/**
|
|
2128
2135
|
* mute - mutes the current channel
|
|
2129
2136
|
* @param {{ user_id?: string, expiration?: string }} opts expiration in minutes or user_id
|
|
2130
|
-
* @return {Promise<MuteChannelAPIResponse<
|
|
2137
|
+
* @return {Promise<MuteChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2131
2138
|
*
|
|
2132
2139
|
* example with expiration:
|
|
2133
2140
|
* await channel.mute({expiration: moment.duration(2, 'weeks')});
|
|
@@ -2346,7 +2353,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2346
2353
|
/**
|
|
2347
2354
|
* lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
|
|
2348
2355
|
*
|
|
2349
|
-
* @return {ReturnType<ChannelState<
|
|
2356
|
+
* @return {ReturnType<ChannelState<StreamChatGenerics>['formatMessage']> | undefined} Description
|
|
2350
2357
|
*/
|
|
2351
2358
|
|
|
2352
2359
|
}, {
|
|
@@ -2371,8 +2378,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2371
2378
|
/**
|
|
2372
2379
|
* markRead - Send the mark read event for this user, only works if the `read_events` setting is enabled
|
|
2373
2380
|
*
|
|
2374
|
-
* @param {MarkReadOptions<
|
|
2375
|
-
* @return {Promise<EventAPIResponse<
|
|
2381
|
+
* @param {MarkReadOptions<StreamChatGenerics>} data
|
|
2382
|
+
* @return {Promise<EventAPIResponse<StreamChatGenerics> | null>} Description
|
|
2376
2383
|
*/
|
|
2377
2384
|
|
|
2378
2385
|
}, {
|
|
@@ -2440,9 +2447,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2440
2447
|
/**
|
|
2441
2448
|
* watch - Loads the initial channel state and watches for changes
|
|
2442
2449
|
*
|
|
2443
|
-
* @param {ChannelQueryOptions<
|
|
2450
|
+
* @param {ChannelQueryOptions<StreamChatGenerics>} options additional options for the query endpoint
|
|
2444
2451
|
*
|
|
2445
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2452
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The server response
|
|
2446
2453
|
*/
|
|
2447
2454
|
|
|
2448
2455
|
}, {
|
|
@@ -2544,9 +2551,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2544
2551
|
* getReplies - List the message replies for a parent message
|
|
2545
2552
|
*
|
|
2546
2553
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2547
|
-
* @param {PaginationOptions & { user?: UserResponse<
|
|
2554
|
+
* @param {PaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2548
2555
|
*
|
|
2549
|
-
* @return {Promise<GetRepliesAPIResponse<
|
|
2556
|
+
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2550
2557
|
*/
|
|
2551
2558
|
|
|
2552
2559
|
}, {
|
|
@@ -2588,10 +2595,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2588
2595
|
/**
|
|
2589
2596
|
* getPinnedMessages - List list pinned messages of the channel
|
|
2590
2597
|
*
|
|
2591
|
-
* @param {PinnedMessagePaginationOptions & { user?: UserResponse<
|
|
2598
|
+
* @param {PinnedMessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2592
2599
|
* @param {PinnedMessagesSort} sort defines sorting direction of pinned messages
|
|
2593
2600
|
*
|
|
2594
|
-
* @return {Promise<GetRepliesAPIResponse<
|
|
2601
|
+
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2595
2602
|
*/
|
|
2596
2603
|
|
|
2597
2604
|
}, {
|
|
@@ -2635,7 +2642,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2635
2642
|
* @param {string} message_id The message id
|
|
2636
2643
|
* @param {{ limit?: number; offset?: number }} options The pagination options
|
|
2637
2644
|
*
|
|
2638
|
-
* @return {Promise<GetReactionsAPIResponse<
|
|
2645
|
+
* @return {Promise<GetReactionsAPIResponse<StreamChatGenerics>>} Server response
|
|
2639
2646
|
*/
|
|
2640
2647
|
|
|
2641
2648
|
}, {
|
|
@@ -2648,7 +2655,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2648
2655
|
*
|
|
2649
2656
|
* @param {string[]} messageIds The ids of the messages to retrieve from this channel
|
|
2650
2657
|
*
|
|
2651
|
-
* @return {Promise<GetMultipleMessagesAPIResponse<
|
|
2658
|
+
* @return {Promise<GetMultipleMessagesAPIResponse<StreamChatGenerics>>} Server response
|
|
2652
2659
|
*/
|
|
2653
2660
|
|
|
2654
2661
|
}, {
|
|
@@ -2682,6 +2689,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2682
2689
|
|
|
2683
2690
|
if (message.shadowed) return false;
|
|
2684
2691
|
if (message.silent) return false;
|
|
2692
|
+
if (message.parent_id && !message.show_in_channel) return false;
|
|
2685
2693
|
if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
|
|
2686
2694
|
if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
|
|
2687
2695
|
if (message.type === 'system') return false;
|
|
@@ -2742,7 +2750,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2742
2750
|
/**
|
|
2743
2751
|
* create - Creates a new channel
|
|
2744
2752
|
*
|
|
2745
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2753
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} The Server Response
|
|
2746
2754
|
*/
|
|
2747
2755
|
|
|
2748
2756
|
}, {
|
|
@@ -2751,9 +2759,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2751
2759
|
/**
|
|
2752
2760
|
* query - Query the API, get messages, members or other channel fields
|
|
2753
2761
|
*
|
|
2754
|
-
* @param {ChannelQueryOptions<
|
|
2762
|
+
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
2755
2763
|
*
|
|
2756
|
-
* @return {Promise<ChannelAPIResponse<
|
|
2764
|
+
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2757
2765
|
*/
|
|
2758
2766
|
function () {
|
|
2759
2767
|
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(options) {
|
|
@@ -2829,7 +2837,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2829
2837
|
* banUser - Bans a user from a channel
|
|
2830
2838
|
*
|
|
2831
2839
|
* @param {string} targetUserID
|
|
2832
|
-
* @param {BanUserOptions<
|
|
2840
|
+
* @param {BanUserOptions<StreamChatGenerics>} options
|
|
2833
2841
|
* @returns {Promise<APIResponse>}
|
|
2834
2842
|
*/
|
|
2835
2843
|
|
|
@@ -3001,7 +3009,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3001
3009
|
* shadowBan - Shadow bans a user from a channel
|
|
3002
3010
|
*
|
|
3003
3011
|
* @param {string} targetUserID
|
|
3004
|
-
* @param {BanUserOptions<
|
|
3012
|
+
* @param {BanUserOptions<StreamChatGenerics>} options
|
|
3005
3013
|
* @returns {Promise<APIResponse>}
|
|
3006
3014
|
*/
|
|
3007
3015
|
|
|
@@ -3085,8 +3093,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3085
3093
|
* or
|
|
3086
3094
|
* channel.on(event => {console.log(event.type)})
|
|
3087
3095
|
*
|
|
3088
|
-
* @param {EventHandler<
|
|
3089
|
-
* @param {EventHandler<
|
|
3096
|
+
* @param {EventHandler<StreamChatGenerics> | EventTypes} callbackOrString The event type to listen for (optional)
|
|
3097
|
+
* @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
|
|
3090
3098
|
*/
|
|
3091
3099
|
|
|
3092
3100
|
}, {
|
|
@@ -3806,6 +3814,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3806
3814
|
|
|
3807
3815
|
_defineProperty(this, "onmessage", function (wsID, event) {
|
|
3808
3816
|
if (_this.wsID !== wsID) return;
|
|
3817
|
+
|
|
3818
|
+
_this._log('onmessage() - onmessage callback', {
|
|
3819
|
+
event: event,
|
|
3820
|
+
wsID: wsID
|
|
3821
|
+
});
|
|
3822
|
+
|
|
3809
3823
|
var data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open..
|
|
3810
3824
|
// the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
|
|
3811
3825
|
// after that a ws.onclose..
|
|
@@ -3830,11 +3844,6 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3830
3844
|
|
|
3831
3845
|
_this.lastEvent = new Date();
|
|
3832
3846
|
|
|
3833
|
-
_this._log('onmessage() - onmessage callback', {
|
|
3834
|
-
event: event,
|
|
3835
|
-
wsID: wsID
|
|
3836
|
-
});
|
|
3837
|
-
|
|
3838
3847
|
if (data && data.type === 'health.check') {
|
|
3839
3848
|
_this.scheduleNextPing();
|
|
3840
3849
|
}
|
|
@@ -3911,7 +3920,6 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3911
3920
|
_this.isHealthy = healthy;
|
|
3912
3921
|
|
|
3913
3922
|
if (_this.isHealthy) {
|
|
3914
|
-
//@ts-expect-error
|
|
3915
3923
|
_this.client.dispatchEvent({
|
|
3916
3924
|
type: 'connection.changed',
|
|
3917
3925
|
online: _this.isHealthy
|
|
@@ -3922,7 +3930,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
3922
3930
|
|
|
3923
3931
|
|
|
3924
3932
|
setTimeout(function () {
|
|
3925
|
-
if (_this.isHealthy) return;
|
|
3933
|
+
if (_this.isHealthy) return;
|
|
3926
3934
|
|
|
3927
3935
|
_this.client.dispatchEvent({
|
|
3928
3936
|
type: 'connection.changed',
|
|
@@ -4364,27 +4372,36 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4364
4372
|
this.requestID = randomId();
|
|
4365
4373
|
this.client.insightMetrics.connectionStartTimestamp = new Date().getTime();
|
|
4366
4374
|
_context5.prev = 5;
|
|
4367
|
-
|
|
4375
|
+
|
|
4376
|
+
this._log("_connect() - waiting for token");
|
|
4377
|
+
|
|
4378
|
+
_context5.next = 9;
|
|
4368
4379
|
return this.client.tokenManager.tokenReady();
|
|
4369
4380
|
|
|
4370
|
-
case
|
|
4381
|
+
case 9:
|
|
4371
4382
|
this._setupConnectionPromise();
|
|
4372
4383
|
|
|
4373
4384
|
wsURL = this._buildUrl();
|
|
4385
|
+
|
|
4386
|
+
this._log("_connect() - Connecting to ".concat(wsURL), {
|
|
4387
|
+
wsURL: wsURL,
|
|
4388
|
+
requestID: this.requestID
|
|
4389
|
+
});
|
|
4390
|
+
|
|
4374
4391
|
this.ws = new WebSocket(wsURL);
|
|
4375
4392
|
this.ws.onopen = this.onopen.bind(this, this.wsID);
|
|
4376
4393
|
this.ws.onclose = this.onclose.bind(this, this.wsID);
|
|
4377
4394
|
this.ws.onerror = this.onerror.bind(this, this.wsID);
|
|
4378
4395
|
this.ws.onmessage = this.onmessage.bind(this, this.wsID);
|
|
4379
|
-
_context5.next =
|
|
4396
|
+
_context5.next = 19;
|
|
4380
4397
|
return this.connectionOpen;
|
|
4381
4398
|
|
|
4382
|
-
case
|
|
4399
|
+
case 19:
|
|
4383
4400
|
response = _context5.sent;
|
|
4384
4401
|
this.isConnecting = false;
|
|
4385
4402
|
|
|
4386
4403
|
if (!response) {
|
|
4387
|
-
_context5.next =
|
|
4404
|
+
_context5.next = 25;
|
|
4388
4405
|
break;
|
|
4389
4406
|
}
|
|
4390
4407
|
|
|
@@ -4397,12 +4414,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4397
4414
|
|
|
4398
4415
|
return _context5.abrupt("return", response);
|
|
4399
4416
|
|
|
4400
|
-
case
|
|
4401
|
-
_context5.next =
|
|
4417
|
+
case 25:
|
|
4418
|
+
_context5.next = 32;
|
|
4402
4419
|
break;
|
|
4403
4420
|
|
|
4404
|
-
case
|
|
4405
|
-
_context5.prev =
|
|
4421
|
+
case 27:
|
|
4422
|
+
_context5.prev = 27;
|
|
4406
4423
|
_context5.t0 = _context5["catch"](5);
|
|
4407
4424
|
this.isConnecting = false;
|
|
4408
4425
|
|
|
@@ -4415,12 +4432,12 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4415
4432
|
|
|
4416
4433
|
throw _context5.t0;
|
|
4417
4434
|
|
|
4418
|
-
case
|
|
4435
|
+
case 32:
|
|
4419
4436
|
case "end":
|
|
4420
4437
|
return _context5.stop();
|
|
4421
4438
|
}
|
|
4422
4439
|
}
|
|
4423
|
-
}, _callee5, this, [[5,
|
|
4440
|
+
}, _callee5, this, [[5, 27]]);
|
|
4424
4441
|
}));
|
|
4425
4442
|
|
|
4426
4443
|
function _connect() {
|
|
@@ -4881,7 +4898,7 @@ function TokenManager(secret) {
|
|
|
4881
4898
|
* Token provider should return a token string or a promise which resolves to string token.
|
|
4882
4899
|
*
|
|
4883
4900
|
* @param {TokenOrProvider} tokenOrProvider
|
|
4884
|
-
* @param {UserResponse<
|
|
4901
|
+
* @param {UserResponse<StreamChatGenerics>} user
|
|
4885
4902
|
*/
|
|
4886
4903
|
;
|
|
4887
4904
|
|
|
@@ -5269,7 +5286,9 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5269
5286
|
|
|
5270
5287
|
_this._setState(ConnectionState.Connected);
|
|
5271
5288
|
|
|
5272
|
-
_this.connectionID = event.connection_id;
|
|
5289
|
+
_this.connectionID = event.connection_id; // @ts-expect-error
|
|
5290
|
+
|
|
5291
|
+
_this.client.dispatchEvent(event);
|
|
5273
5292
|
|
|
5274
5293
|
_this._poll();
|
|
5275
5294
|
|
|
@@ -5279,20 +5298,20 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5279
5298
|
|
|
5280
5299
|
return _context3.abrupt("return", event);
|
|
5281
5300
|
|
|
5282
|
-
case
|
|
5283
|
-
_context3.prev =
|
|
5301
|
+
case 22:
|
|
5302
|
+
_context3.prev = 22;
|
|
5284
5303
|
_context3.t0 = _context3["catch"](9);
|
|
5285
5304
|
|
|
5286
5305
|
_this._setState(ConnectionState.Closed);
|
|
5287
5306
|
|
|
5288
5307
|
throw _context3.t0;
|
|
5289
5308
|
|
|
5290
|
-
case
|
|
5309
|
+
case 26:
|
|
5291
5310
|
case "end":
|
|
5292
5311
|
return _context3.stop();
|
|
5293
5312
|
}
|
|
5294
5313
|
}
|
|
5295
|
-
}, _callee3, null, [[9,
|
|
5314
|
+
}, _callee3, null, [[9, 22]]);
|
|
5296
5315
|
})));
|
|
5297
5316
|
|
|
5298
5317
|
_defineProperty(this, "isHealthy", function () {
|
|
@@ -5371,7 +5390,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5371
5390
|
|
|
5372
5391
|
|
|
5373
5392
|
if (this.state === ConnectionState.Connecting && state === ConnectionState.Connected) {
|
|
5374
|
-
//@ts-expect-error
|
|
5375
5393
|
this.client.dispatchEvent({
|
|
5376
5394
|
type: 'connection.changed',
|
|
5377
5395
|
online: true
|
|
@@ -5379,7 +5397,6 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5379
5397
|
}
|
|
5380
5398
|
|
|
5381
5399
|
if (state === ConnectionState.Closed || state === ConnectionState.Disconnected) {
|
|
5382
|
-
//@ts-expect-error
|
|
5383
5400
|
this.client.dispatchEvent({
|
|
5384
5401
|
type: 'connection.changed',
|
|
5385
5402
|
online: false
|
|
@@ -6672,9 +6689,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6672
6689
|
/**
|
|
6673
6690
|
* setGuestUser - Setup a temporary guest user
|
|
6674
6691
|
*
|
|
6675
|
-
* @param {UserResponse<
|
|
6692
|
+
* @param {UserResponse<StreamChatGenerics>} user Data about this user. IE {name: "john"}
|
|
6676
6693
|
*
|
|
6677
|
-
* @return {ConnectAPIResponse<
|
|
6694
|
+
* @return {ConnectAPIResponse<StreamChatGenerics>} Returns a promise that resolves when the connection is setup
|
|
6678
6695
|
*/
|
|
6679
6696
|
function () {
|
|
6680
6697
|
var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(user) {
|
|
@@ -6762,8 +6779,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6762
6779
|
* or
|
|
6763
6780
|
* client.on(event => {console.log(event.type)})
|
|
6764
6781
|
*
|
|
6765
|
-
* @param {EventHandler<
|
|
6766
|
-
* @param {EventHandler<
|
|
6782
|
+
* @param {EventHandler<StreamChatGenerics> | string} callbackOrString The event type to listen for (optional)
|
|
6783
|
+
* @param {EventHandler<StreamChatGenerics>} [callbackOrNothing] The callback to call
|
|
6767
6784
|
*
|
|
6768
6785
|
* @return {{ unsubscribe: () => void }} Description
|
|
6769
6786
|
*/
|
|
@@ -7098,8 +7115,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7098
7115
|
|
|
7099
7116
|
this.logger('info', 'client:connect() - WS failed, fallback to longpoll', {
|
|
7100
7117
|
tags: ['connection', 'client']
|
|
7101
|
-
});
|
|
7102
|
-
|
|
7118
|
+
});
|
|
7103
7119
|
this.dispatchEvent({
|
|
7104
7120
|
type: 'transport.changed',
|
|
7105
7121
|
mode: 'longpoll'
|
|
@@ -7165,12 +7181,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7165
7181
|
/**
|
|
7166
7182
|
* queryUsers - Query users and watch user presence
|
|
7167
7183
|
*
|
|
7168
|
-
* @param {UserFilters<
|
|
7169
|
-
* @param {UserSort<
|
|
7184
|
+
* @param {UserFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
|
|
7185
|
+
* @param {UserSort<StreamChatGenerics>} sort Sort options, for instance [{last_active: -1}].
|
|
7170
7186
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
|
|
7171
7187
|
* @param {UserOptions} options Option object, {presence: true}
|
|
7172
7188
|
*
|
|
7173
|
-
* @return {Promise<
|
|
7189
|
+
* @return {Promise<{ users: Array<UserResponse<StreamChatGenerics>> }>} User Query Response
|
|
7174
7190
|
*/
|
|
7175
7191
|
|
|
7176
7192
|
}, {
|
|
@@ -7235,7 +7251,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7235
7251
|
* @param {BannedUsersSort} sort Sort options [{created_at: 1}].
|
|
7236
7252
|
* @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
7237
7253
|
*
|
|
7238
|
-
* @return {Promise<BannedUsersResponse<
|
|
7254
|
+
* @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
|
|
7239
7255
|
*/
|
|
7240
7256
|
|
|
7241
7257
|
}, {
|
|
@@ -7284,7 +7300,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7284
7300
|
* @param {MessageFlagsFilters} filterConditions MongoDB style filter conditions
|
|
7285
7301
|
* @param {MessageFlagsPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
7286
7302
|
*
|
|
7287
|
-
* @return {Promise<MessageFlagsResponse<
|
|
7303
|
+
* @return {Promise<MessageFlagsResponse<StreamChatGenerics>>} Message Flags Response
|
|
7288
7304
|
*/
|
|
7289
7305
|
|
|
7290
7306
|
}, {
|
|
@@ -7327,14 +7343,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7327
7343
|
/**
|
|
7328
7344
|
* queryChannels - Query channels
|
|
7329
7345
|
*
|
|
7330
|
-
* @param {ChannelFilters<
|
|
7331
|
-
* @param {ChannelSort<
|
|
7346
|
+
* @param {ChannelFilters<StreamChatGenerics>} filterConditions object MongoDB style filters
|
|
7347
|
+
* @param {ChannelSort<StreamChatGenerics>} [sort] Sort options, for instance {created_at: -1}.
|
|
7332
7348
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
|
|
7333
7349
|
* @param {ChannelOptions} [options] Options object
|
|
7334
7350
|
* @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
|
|
7335
7351
|
* - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
|
|
7336
7352
|
*
|
|
7337
|
-
* @return {Promise<
|
|
7353
|
+
* @return {Promise<{ channels: Array<ChannelAPIResponse<AStreamChatGenerics>>}> } search channels response
|
|
7338
7354
|
*/
|
|
7339
7355
|
|
|
7340
7356
|
}, {
|
|
@@ -7450,11 +7466,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7450
7466
|
/**
|
|
7451
7467
|
* search - Query messages
|
|
7452
7468
|
*
|
|
7453
|
-
* @param {ChannelFilters<
|
|
7454
|
-
* @param {MessageFilters<
|
|
7455
|
-
* @param {SearchOptions<
|
|
7469
|
+
* @param {ChannelFilters<StreamChatGenerics>} filterConditions MongoDB style filter conditions
|
|
7470
|
+
* @param {MessageFilters<StreamChatGenerics> | string} query search query or object MongoDB style filters
|
|
7471
|
+
* @param {SearchOptions<StreamChatGenerics>} [options] Option object, {user_id: 'tommaso'}
|
|
7456
7472
|
*
|
|
7457
|
-
* @return {Promise<SearchAPIResponse<
|
|
7473
|
+
* @return {Promise<SearchAPIResponse<StreamChatGenerics>>} search messages response
|
|
7458
7474
|
*/
|
|
7459
7475
|
|
|
7460
7476
|
}, {
|
|
@@ -7598,7 +7614,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7598
7614
|
*
|
|
7599
7615
|
* @param {string} [userID] User ID. Only works on serverside
|
|
7600
7616
|
*
|
|
7601
|
-
* @return {
|
|
7617
|
+
* @return {Device<StreamChatGenerics>[]} Array of devices
|
|
7602
7618
|
*/
|
|
7603
7619
|
|
|
7604
7620
|
}, {
|
|
@@ -7726,7 +7742,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7726
7742
|
* await channel.create() to assign an ID to channel
|
|
7727
7743
|
*
|
|
7728
7744
|
* @param {string} channelType The channel type
|
|
7729
|
-
* @param {string | ChannelData<
|
|
7745
|
+
* @param {string | ChannelData<StreamChatGenerics> | null} [channelIDOrCustom] The channel ID, you can leave this out if you want to create a conversation channel
|
|
7730
7746
|
* @param {object} [custom] Custom data to attach to the channel
|
|
7731
7747
|
*
|
|
7732
7748
|
* @return {channel} The channel object, initialize it using channel.watch()
|
|
@@ -7782,10 +7798,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7782
7798
|
/**
|
|
7783
7799
|
* partialUpdateUser - Update the given user object
|
|
7784
7800
|
*
|
|
7785
|
-
* @param {PartialUserUpdate<
|
|
7801
|
+
* @param {PartialUserUpdate<StreamChatGenerics>} partialUserObject which should contain id and any of "set" or "unset" params;
|
|
7786
7802
|
* example: {id: "user1", set:{field: value}, unset:["field2"]}
|
|
7787
7803
|
*
|
|
7788
|
-
* @return {Promise<
|
|
7804
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
|
|
7789
7805
|
*/
|
|
7790
7806
|
function () {
|
|
7791
7807
|
var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(partialUserObject) {
|
|
@@ -7816,9 +7832,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7816
7832
|
/**
|
|
7817
7833
|
* upsertUsers - Batch upsert the list of users
|
|
7818
7834
|
*
|
|
7819
|
-
* @param {UserResponse<
|
|
7835
|
+
* @param {UserResponse<StreamChatGenerics>[]} users list of users
|
|
7820
7836
|
*
|
|
7821
|
-
* @return {Promise<
|
|
7837
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7822
7838
|
*/
|
|
7823
7839
|
|
|
7824
7840
|
}, {
|
|
@@ -7904,8 +7920,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7904
7920
|
*
|
|
7905
7921
|
* updateUsers - Batch update the list of users
|
|
7906
7922
|
*
|
|
7907
|
-
* @param {UserResponse<
|
|
7908
|
-
* @return {Promise<
|
|
7923
|
+
* @param {UserResponse<StreamChatGenerics>[]} users list of users
|
|
7924
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7909
7925
|
*/
|
|
7910
7926
|
|
|
7911
7927
|
}, {
|
|
@@ -7914,9 +7930,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7914
7930
|
/**
|
|
7915
7931
|
* upsertUser - Update or Create the given user object
|
|
7916
7932
|
*
|
|
7917
|
-
* @param {UserResponse<
|
|
7933
|
+
* @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
|
|
7918
7934
|
*
|
|
7919
|
-
* @return {Promise<
|
|
7935
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7920
7936
|
*/
|
|
7921
7937
|
function upsertUser(userObject) {
|
|
7922
7938
|
return this.upsertUsers([userObject]);
|
|
@@ -7926,8 +7942,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7926
7942
|
*
|
|
7927
7943
|
* updateUser - Update or Create the given user object
|
|
7928
7944
|
*
|
|
7929
|
-
* @param {UserResponse<
|
|
7930
|
-
* @return {Promise<
|
|
7945
|
+
* @param {UserResponse<StreamChatGenerics>} userObject user object, the only required field is the user id. IE {id: "myuser"} is valid
|
|
7946
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7931
7947
|
*/
|
|
7932
7948
|
|
|
7933
7949
|
}, {
|
|
@@ -7936,9 +7952,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7936
7952
|
/**
|
|
7937
7953
|
* partialUpdateUsers - Batch partial update of users
|
|
7938
7954
|
*
|
|
7939
|
-
* @param {PartialUserUpdate<
|
|
7955
|
+
* @param {PartialUserUpdate<StreamChatGenerics>[]} users list of partial update requests
|
|
7940
7956
|
*
|
|
7941
|
-
* @return {Promise<
|
|
7957
|
+
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
7942
7958
|
*/
|
|
7943
7959
|
function () {
|
|
7944
7960
|
var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(users) {
|
|
@@ -8127,7 +8143,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8127
8143
|
/** banUser - bans a user from all channels
|
|
8128
8144
|
*
|
|
8129
8145
|
* @param {string} targetUserID
|
|
8130
|
-
* @param {BanUserOptions<
|
|
8146
|
+
* @param {BanUserOptions<StreamChatGenerics>} [options]
|
|
8131
8147
|
* @returns {Promise<APIResponse>}
|
|
8132
8148
|
*/
|
|
8133
8149
|
|
|
@@ -8201,7 +8217,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8201
8217
|
/** shadowBan - shadow bans a user from all channels
|
|
8202
8218
|
*
|
|
8203
8219
|
* @param {string} targetUserID
|
|
8204
|
-
* @param {BanUserOptions<
|
|
8220
|
+
* @param {BanUserOptions<StreamChatGenerics>} [options]
|
|
8205
8221
|
* @returns {Promise<APIResponse>}
|
|
8206
8222
|
*/
|
|
8207
8223
|
|
|
@@ -8276,8 +8292,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8276
8292
|
*
|
|
8277
8293
|
* @param {string} targetID
|
|
8278
8294
|
* @param {string} [userID] Only used with serverside auth
|
|
8279
|
-
* @param {MuteUserOptions<
|
|
8280
|
-
* @returns {Promise<MuteUserResponse<
|
|
8295
|
+
* @param {MuteUserOptions<StreamChatGenerics>} [options]
|
|
8296
|
+
* @returns {Promise<MuteUserResponse<StreamChatGenerics>>}
|
|
8281
8297
|
*/
|
|
8282
8298
|
|
|
8283
8299
|
}, {
|
|
@@ -8544,7 +8560,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8544
8560
|
* @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
|
|
8545
8561
|
* @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
|
|
8546
8562
|
*
|
|
8547
|
-
* @return {Promise<FlagReportsResponse<
|
|
8563
|
+
* @return {Promise<FlagReportsResponse<StreamChatGenerics>>} Flag Reports Response
|
|
8548
8564
|
*/
|
|
8549
8565
|
|
|
8550
8566
|
}, {
|
|
@@ -8680,7 +8696,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8680
8696
|
* @deprecated use markChannelsRead instead
|
|
8681
8697
|
*
|
|
8682
8698
|
* markAllRead - marks all channels for this user as read
|
|
8683
|
-
* @param {MarkAllReadOptions<
|
|
8699
|
+
* @param {MarkAllReadOptions<StreamChatGenerics>} [data]
|
|
8684
8700
|
*
|
|
8685
8701
|
* @return {Promise<APIResponse>}
|
|
8686
8702
|
*/
|
|
@@ -8692,7 +8708,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8692
8708
|
* markChannelsRead - marks channels read -
|
|
8693
8709
|
* it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
|
|
8694
8710
|
*
|
|
8695
|
-
* @param {MarkChannelsReadOptions <
|
|
8711
|
+
* @param {MarkChannelsReadOptions <StreamChatGenerics>} [data]
|
|
8696
8712
|
*
|
|
8697
8713
|
* @return {Promise<APIResponse>}
|
|
8698
8714
|
*/
|
|
@@ -8782,7 +8798,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8782
8798
|
* @param {string} messageId
|
|
8783
8799
|
* @param {string} language
|
|
8784
8800
|
*
|
|
8785
|
-
* @return {
|
|
8801
|
+
* @return {MessageResponse<StreamChatGenerics>} Response that includes the message
|
|
8786
8802
|
*/
|
|
8787
8803
|
|
|
8788
8804
|
}, {
|
|
@@ -8901,11 +8917,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8901
8917
|
/**
|
|
8902
8918
|
* updateMessage - Update the given message
|
|
8903
8919
|
*
|
|
8904
|
-
* @param {Omit<MessageResponse<
|
|
8920
|
+
* @param {Omit<MessageResponse<StreamChatGenerics>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
|
|
8905
8921
|
* @param {string | { id: string }} [userId]
|
|
8906
8922
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
8907
8923
|
*
|
|
8908
|
-
* @return {
|
|
8924
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the message
|
|
8909
8925
|
*/
|
|
8910
8926
|
|
|
8911
8927
|
}, {
|
|
@@ -8982,13 +8998,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8982
8998
|
*
|
|
8983
8999
|
* @param {string} id the message id
|
|
8984
9000
|
*
|
|
8985
|
-
* @param {PartialUpdateMessage<
|
|
9001
|
+
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
8986
9002
|
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
8987
9003
|
* @param {string | { id: string }} [userId]
|
|
8988
9004
|
*
|
|
8989
9005
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
8990
9006
|
*
|
|
8991
|
-
* @return {
|
|
9007
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
|
|
8992
9008
|
*/
|
|
8993
9009
|
|
|
8994
9010
|
}, {
|
|
@@ -9106,7 +9122,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9106
9122
|
}, {
|
|
9107
9123
|
key: "getUserAgent",
|
|
9108
9124
|
value: function getUserAgent() {
|
|
9109
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "
|
|
9125
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.0.0");
|
|
9110
9126
|
}
|
|
9111
9127
|
}, {
|
|
9112
9128
|
key: "setUserAgent",
|
|
@@ -10108,6 +10124,131 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10108
10124
|
|
|
10109
10125
|
return deleteUsers;
|
|
10110
10126
|
}()
|
|
10127
|
+
/**
|
|
10128
|
+
* _createImport - Create an Import Task.
|
|
10129
|
+
*
|
|
10130
|
+
* Note: Do not use this.
|
|
10131
|
+
* It is present for internal usage only.
|
|
10132
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10133
|
+
*
|
|
10134
|
+
* @private
|
|
10135
|
+
* @param {string} filename filename of uploaded data
|
|
10136
|
+
*
|
|
10137
|
+
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10138
|
+
*/
|
|
10139
|
+
|
|
10140
|
+
}, {
|
|
10141
|
+
key: "_createImport",
|
|
10142
|
+
value: function () {
|
|
10143
|
+
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(filename) {
|
|
10144
|
+
return _regeneratorRuntime.wrap(function _callee70$(_context70) {
|
|
10145
|
+
while (1) {
|
|
10146
|
+
switch (_context70.prev = _context70.next) {
|
|
10147
|
+
case 0:
|
|
10148
|
+
_context70.next = 2;
|
|
10149
|
+
return this.post(this.baseURL + "/imports", {
|
|
10150
|
+
filename: filename
|
|
10151
|
+
});
|
|
10152
|
+
|
|
10153
|
+
case 2:
|
|
10154
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10155
|
+
|
|
10156
|
+
case 3:
|
|
10157
|
+
case "end":
|
|
10158
|
+
return _context70.stop();
|
|
10159
|
+
}
|
|
10160
|
+
}
|
|
10161
|
+
}, _callee70, this);
|
|
10162
|
+
}));
|
|
10163
|
+
|
|
10164
|
+
function _createImport(_x94) {
|
|
10165
|
+
return _createImport2.apply(this, arguments);
|
|
10166
|
+
}
|
|
10167
|
+
|
|
10168
|
+
return _createImport;
|
|
10169
|
+
}()
|
|
10170
|
+
/**
|
|
10171
|
+
* _getImport - Get an Import Task.
|
|
10172
|
+
*
|
|
10173
|
+
* Note: Do not use this.
|
|
10174
|
+
* It is present for internal usage only.
|
|
10175
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10176
|
+
*
|
|
10177
|
+
* @private
|
|
10178
|
+
* @param {string} id id of Import Task
|
|
10179
|
+
*
|
|
10180
|
+
* @return {APIResponse & GetImportResponse} An ImportTask
|
|
10181
|
+
*/
|
|
10182
|
+
|
|
10183
|
+
}, {
|
|
10184
|
+
key: "_getImport",
|
|
10185
|
+
value: function () {
|
|
10186
|
+
var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(id) {
|
|
10187
|
+
return _regeneratorRuntime.wrap(function _callee71$(_context71) {
|
|
10188
|
+
while (1) {
|
|
10189
|
+
switch (_context71.prev = _context71.next) {
|
|
10190
|
+
case 0:
|
|
10191
|
+
_context71.next = 2;
|
|
10192
|
+
return this.get(this.baseURL + "/imports/".concat(id));
|
|
10193
|
+
|
|
10194
|
+
case 2:
|
|
10195
|
+
return _context71.abrupt("return", _context71.sent);
|
|
10196
|
+
|
|
10197
|
+
case 3:
|
|
10198
|
+
case "end":
|
|
10199
|
+
return _context71.stop();
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
}, _callee71, this);
|
|
10203
|
+
}));
|
|
10204
|
+
|
|
10205
|
+
function _getImport(_x95) {
|
|
10206
|
+
return _getImport2.apply(this, arguments);
|
|
10207
|
+
}
|
|
10208
|
+
|
|
10209
|
+
return _getImport;
|
|
10210
|
+
}()
|
|
10211
|
+
/**
|
|
10212
|
+
* _listImports - Lists Import Tasks.
|
|
10213
|
+
*
|
|
10214
|
+
* Note: Do not use this.
|
|
10215
|
+
* It is present for internal usage only.
|
|
10216
|
+
* This function can, and will, break and/or be removed at any point in time.
|
|
10217
|
+
*
|
|
10218
|
+
* @private
|
|
10219
|
+
* @param {ListImportsPaginationOptions} options pagination options
|
|
10220
|
+
*
|
|
10221
|
+
* @return {APIResponse & ListImportsResponse} An ImportTask
|
|
10222
|
+
*/
|
|
10223
|
+
|
|
10224
|
+
}, {
|
|
10225
|
+
key: "_listImports",
|
|
10226
|
+
value: function () {
|
|
10227
|
+
var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(options) {
|
|
10228
|
+
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
|
|
10229
|
+
while (1) {
|
|
10230
|
+
switch (_context72.prev = _context72.next) {
|
|
10231
|
+
case 0:
|
|
10232
|
+
_context72.next = 2;
|
|
10233
|
+
return this.get(this.baseURL + "/imports", options);
|
|
10234
|
+
|
|
10235
|
+
case 2:
|
|
10236
|
+
return _context72.abrupt("return", _context72.sent);
|
|
10237
|
+
|
|
10238
|
+
case 3:
|
|
10239
|
+
case "end":
|
|
10240
|
+
return _context72.stop();
|
|
10241
|
+
}
|
|
10242
|
+
}
|
|
10243
|
+
}, _callee72, this);
|
|
10244
|
+
}));
|
|
10245
|
+
|
|
10246
|
+
function _listImports(_x96) {
|
|
10247
|
+
return _listImports2.apply(this, arguments);
|
|
10248
|
+
}
|
|
10249
|
+
|
|
10250
|
+
return _listImports;
|
|
10251
|
+
}()
|
|
10111
10252
|
}], [{
|
|
10112
10253
|
key: "getInstance",
|
|
10113
10254
|
value: function getInstance(key, secretOrOptions, options) {
|