stream-chat 8.4.1 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +76 -67
- 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 +76 -67
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +76 -67
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +76 -67
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +3 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +1 -0
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +7 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/signing.d.ts +3 -2
- package/dist/types/signing.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +8 -3
- package/src/channel_state.ts +1 -1
- package/src/client.ts +7 -12
- package/src/signing.ts +9 -4
- package/src/types.ts +5 -0
package/dist/browser.es.js
CHANGED
|
@@ -1386,30 +1386,36 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1386
1386
|
|
|
1387
1387
|
_defineProperty(this, "disconnected", void 0);
|
|
1388
1388
|
|
|
1389
|
-
_defineProperty(this, "create", /*#__PURE__*/
|
|
1390
|
-
var options
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1389
|
+
_defineProperty(this, "create", /*#__PURE__*/function () {
|
|
1390
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
1391
|
+
var defaultOptions;
|
|
1392
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1393
|
+
while (1) {
|
|
1394
|
+
switch (_context.prev = _context.next) {
|
|
1395
|
+
case 0:
|
|
1396
|
+
defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
|
|
1397
|
+
watch: false,
|
|
1398
|
+
state: false,
|
|
1399
|
+
presence: false
|
|
1400
|
+
});
|
|
1401
|
+
_context.next = 3;
|
|
1402
|
+
return _this.query(defaultOptions, 'latest');
|
|
1402
1403
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1404
|
+
case 3:
|
|
1405
|
+
return _context.abrupt("return", _context.sent);
|
|
1405
1406
|
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1407
|
+
case 4:
|
|
1408
|
+
case "end":
|
|
1409
|
+
return _context.stop();
|
|
1410
|
+
}
|
|
1409
1411
|
}
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1412
|
+
}, _callee);
|
|
1413
|
+
}));
|
|
1414
|
+
|
|
1415
|
+
return function (_x) {
|
|
1416
|
+
return _ref.apply(this, arguments);
|
|
1417
|
+
};
|
|
1418
|
+
}());
|
|
1413
1419
|
|
|
1414
1420
|
_defineProperty(this, "_callChannelListeners", function (event) {
|
|
1415
1421
|
var channel = _this; // gather and call the listeners
|
|
@@ -1539,7 +1545,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1539
1545
|
}, _callee2, this);
|
|
1540
1546
|
}));
|
|
1541
1547
|
|
|
1542
|
-
function sendMessage(
|
|
1548
|
+
function sendMessage(_x2, _x3) {
|
|
1543
1549
|
return _sendMessage.apply(this, arguments);
|
|
1544
1550
|
}
|
|
1545
1551
|
|
|
@@ -1603,7 +1609,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1603
1609
|
}, _callee3, this);
|
|
1604
1610
|
}));
|
|
1605
1611
|
|
|
1606
|
-
function sendEvent(
|
|
1612
|
+
function sendEvent(_x4) {
|
|
1607
1613
|
return _sendEvent.apply(this, arguments);
|
|
1608
1614
|
}
|
|
1609
1615
|
|
|
@@ -1691,7 +1697,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1691
1697
|
}, _callee4, this);
|
|
1692
1698
|
}));
|
|
1693
1699
|
|
|
1694
|
-
function search(
|
|
1700
|
+
function search(_x5) {
|
|
1695
1701
|
return _search.apply(this, arguments);
|
|
1696
1702
|
}
|
|
1697
1703
|
|
|
@@ -1757,7 +1763,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1757
1763
|
}, _callee5, this);
|
|
1758
1764
|
}));
|
|
1759
1765
|
|
|
1760
|
-
function queryMembers(
|
|
1766
|
+
function queryMembers(_x6) {
|
|
1761
1767
|
return _queryMembers.apply(this, arguments);
|
|
1762
1768
|
}
|
|
1763
1769
|
|
|
@@ -1813,7 +1819,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1813
1819
|
}, _callee6, this);
|
|
1814
1820
|
}));
|
|
1815
1821
|
|
|
1816
|
-
function sendReaction(
|
|
1822
|
+
function sendReaction(_x7, _x8, _x9) {
|
|
1817
1823
|
return _sendReaction.apply(this, arguments);
|
|
1818
1824
|
}
|
|
1819
1825
|
|
|
@@ -1934,7 +1940,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1934
1940
|
}, _callee8, this);
|
|
1935
1941
|
}));
|
|
1936
1942
|
|
|
1937
|
-
function updatePartial(
|
|
1943
|
+
function updatePartial(_x10) {
|
|
1938
1944
|
return _updatePartial.apply(this, arguments);
|
|
1939
1945
|
}
|
|
1940
1946
|
|
|
@@ -1974,7 +1980,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1974
1980
|
}, _callee9, this);
|
|
1975
1981
|
}));
|
|
1976
1982
|
|
|
1977
|
-
function enableSlowMode(
|
|
1983
|
+
function enableSlowMode(_x11) {
|
|
1978
1984
|
return _enableSlowMode.apply(this, arguments);
|
|
1979
1985
|
}
|
|
1980
1986
|
|
|
@@ -2214,7 +2220,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2214
2220
|
}, _callee15, this);
|
|
2215
2221
|
}));
|
|
2216
2222
|
|
|
2217
|
-
function addMembers(
|
|
2223
|
+
function addMembers(_x12, _x13) {
|
|
2218
2224
|
return _addMembers.apply(this, arguments);
|
|
2219
2225
|
}
|
|
2220
2226
|
|
|
@@ -2257,7 +2263,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2257
2263
|
}, _callee16, this);
|
|
2258
2264
|
}));
|
|
2259
2265
|
|
|
2260
|
-
function addModerators(
|
|
2266
|
+
function addModerators(_x14, _x15) {
|
|
2261
2267
|
return _addModerators.apply(this, arguments);
|
|
2262
2268
|
}
|
|
2263
2269
|
|
|
@@ -2300,7 +2306,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2300
2306
|
}, _callee17, this);
|
|
2301
2307
|
}));
|
|
2302
2308
|
|
|
2303
|
-
function assignRoles(
|
|
2309
|
+
function assignRoles(_x16, _x17) {
|
|
2304
2310
|
return _assignRoles.apply(this, arguments);
|
|
2305
2311
|
}
|
|
2306
2312
|
|
|
@@ -2343,7 +2349,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2343
2349
|
}, _callee18, this);
|
|
2344
2350
|
}));
|
|
2345
2351
|
|
|
2346
|
-
function inviteMembers(
|
|
2352
|
+
function inviteMembers(_x18, _x19) {
|
|
2347
2353
|
return _inviteMembers.apply(this, arguments);
|
|
2348
2354
|
}
|
|
2349
2355
|
|
|
@@ -2386,7 +2392,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2386
2392
|
}, _callee19, this);
|
|
2387
2393
|
}));
|
|
2388
2394
|
|
|
2389
|
-
function removeMembers(
|
|
2395
|
+
function removeMembers(_x20, _x21) {
|
|
2390
2396
|
return _removeMembers.apply(this, arguments);
|
|
2391
2397
|
}
|
|
2392
2398
|
|
|
@@ -2429,7 +2435,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2429
2435
|
}, _callee20, this);
|
|
2430
2436
|
}));
|
|
2431
2437
|
|
|
2432
|
-
function demoteModerators(
|
|
2438
|
+
function demoteModerators(_x22, _x23) {
|
|
2433
2439
|
return _demoteModerators.apply(this, arguments);
|
|
2434
2440
|
}
|
|
2435
2441
|
|
|
@@ -2467,7 +2473,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2467
2473
|
}, _callee21, this);
|
|
2468
2474
|
}));
|
|
2469
2475
|
|
|
2470
|
-
function _update(
|
|
2476
|
+
function _update(_x24) {
|
|
2471
2477
|
return _update3.apply(this, arguments);
|
|
2472
2478
|
}
|
|
2473
2479
|
|
|
@@ -2640,7 +2646,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2640
2646
|
}, _callee24, this);
|
|
2641
2647
|
}));
|
|
2642
2648
|
|
|
2643
|
-
function keystroke(
|
|
2649
|
+
function keystroke(_x25) {
|
|
2644
2650
|
return _keystroke.apply(this, arguments);
|
|
2645
2651
|
}
|
|
2646
2652
|
|
|
@@ -2686,7 +2692,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2686
2692
|
}, _callee25, this);
|
|
2687
2693
|
}));
|
|
2688
2694
|
|
|
2689
|
-
function stopTyping(
|
|
2695
|
+
function stopTyping(_x26) {
|
|
2690
2696
|
return _stopTyping.apply(this, arguments);
|
|
2691
2697
|
}
|
|
2692
2698
|
|
|
@@ -2809,7 +2815,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2809
2815
|
}, _callee27, this);
|
|
2810
2816
|
}));
|
|
2811
2817
|
|
|
2812
|
-
function markUnread(
|
|
2818
|
+
function markUnread(_x27) {
|
|
2813
2819
|
return _markUnread.apply(this, arguments);
|
|
2814
2820
|
}
|
|
2815
2821
|
|
|
@@ -2888,7 +2894,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2888
2894
|
}, _callee28, this);
|
|
2889
2895
|
}));
|
|
2890
2896
|
|
|
2891
|
-
function watch(
|
|
2897
|
+
function watch(_x28) {
|
|
2892
2898
|
return _watch.apply(this, arguments);
|
|
2893
2899
|
}
|
|
2894
2900
|
|
|
@@ -2975,7 +2981,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2975
2981
|
}, _callee30, this);
|
|
2976
2982
|
}));
|
|
2977
2983
|
|
|
2978
|
-
function getReplies(
|
|
2984
|
+
function getReplies(_x29, _x30) {
|
|
2979
2985
|
return _getReplies.apply(this, arguments);
|
|
2980
2986
|
}
|
|
2981
2987
|
|
|
@@ -3019,7 +3025,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3019
3025
|
}, _callee31, this);
|
|
3020
3026
|
}));
|
|
3021
3027
|
|
|
3022
|
-
function getPinnedMessages(
|
|
3028
|
+
function getPinnedMessages(_x31) {
|
|
3023
3029
|
return _getPinnedMessages.apply(this, arguments);
|
|
3024
3030
|
}
|
|
3025
3031
|
|
|
@@ -3142,6 +3148,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3142
3148
|
* create - Creates a new channel
|
|
3143
3149
|
*
|
|
3144
3150
|
* @return {Promise<QueryChannelAPIResponse<StreamChatGenerics>>} The Server Response
|
|
3151
|
+
*
|
|
3145
3152
|
*/
|
|
3146
3153
|
|
|
3147
3154
|
}, {
|
|
@@ -3218,6 +3225,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3218
3225
|
|
|
3219
3226
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
3220
3227
|
this.data = state.channel;
|
|
3228
|
+
this.offlineMode = false;
|
|
3221
3229
|
this.getClient().dispatchEvent({
|
|
3222
3230
|
type: 'channels.queried',
|
|
3223
3231
|
queriedChannels: {
|
|
@@ -3227,7 +3235,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3227
3235
|
});
|
|
3228
3236
|
return _context32.abrupt("return", state);
|
|
3229
3237
|
|
|
3230
|
-
case
|
|
3238
|
+
case 15:
|
|
3231
3239
|
case "end":
|
|
3232
3240
|
return _context32.stop();
|
|
3233
3241
|
}
|
|
@@ -3235,7 +3243,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3235
3243
|
}, _callee32, this);
|
|
3236
3244
|
}));
|
|
3237
3245
|
|
|
3238
|
-
function query(
|
|
3246
|
+
function query(_x32) {
|
|
3239
3247
|
return _query.apply(this, arguments);
|
|
3240
3248
|
}
|
|
3241
3249
|
|
|
@@ -3276,7 +3284,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3276
3284
|
}, _callee33, this);
|
|
3277
3285
|
}));
|
|
3278
3286
|
|
|
3279
|
-
function banUser(
|
|
3287
|
+
function banUser(_x33, _x34) {
|
|
3280
3288
|
return _banUser.apply(this, arguments);
|
|
3281
3289
|
}
|
|
3282
3290
|
|
|
@@ -3407,7 +3415,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3407
3415
|
}, _callee36, this);
|
|
3408
3416
|
}));
|
|
3409
3417
|
|
|
3410
|
-
function unbanUser(
|
|
3418
|
+
function unbanUser(_x35) {
|
|
3411
3419
|
return _unbanUser.apply(this, arguments);
|
|
3412
3420
|
}
|
|
3413
3421
|
|
|
@@ -3448,7 +3456,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3448
3456
|
}, _callee37, this);
|
|
3449
3457
|
}));
|
|
3450
3458
|
|
|
3451
|
-
function shadowBan(
|
|
3459
|
+
function shadowBan(_x36, _x37) {
|
|
3452
3460
|
return _shadowBan.apply(this, arguments);
|
|
3453
3461
|
}
|
|
3454
3462
|
|
|
@@ -3488,7 +3496,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3488
3496
|
}, _callee38, this);
|
|
3489
3497
|
}));
|
|
3490
3498
|
|
|
3491
|
-
function removeShadowBan(
|
|
3499
|
+
function removeShadowBan(_x38) {
|
|
3492
3500
|
return _removeShadowBan.apply(this, arguments);
|
|
3493
3501
|
}
|
|
3494
3502
|
|
|
@@ -3523,7 +3531,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3523
3531
|
}, _callee39, this);
|
|
3524
3532
|
}));
|
|
3525
3533
|
|
|
3526
|
-
function createCall(
|
|
3534
|
+
function createCall(_x39) {
|
|
3527
3535
|
return _createCall.apply(this, arguments);
|
|
3528
3536
|
}
|
|
3529
3537
|
|
|
@@ -3931,6 +3939,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3931
3939
|
var read = _step3.value;
|
|
3932
3940
|
this.state.read[read.user.id] = {
|
|
3933
3941
|
last_read: new Date(read.last_read),
|
|
3942
|
+
last_read_message_id: read.last_read_message_id,
|
|
3934
3943
|
unread_messages: (_read$unread_messages = read.unread_messages) !== null && _read$unread_messages !== void 0 ? _read$unread_messages : 0,
|
|
3935
3944
|
user: read.user
|
|
3936
3945
|
};
|
|
@@ -5216,16 +5225,21 @@ function DevToken(userId) {
|
|
|
5216
5225
|
}
|
|
5217
5226
|
/**
|
|
5218
5227
|
*
|
|
5219
|
-
* @param {string} body the signed message
|
|
5228
|
+
* @param {string | Buffer} body the signed message
|
|
5220
5229
|
* @param {string} secret the shared secret used to generate the signature (Stream API secret)
|
|
5221
5230
|
* @param {string} signature the signature to validate
|
|
5222
5231
|
* @return {boolean}
|
|
5223
5232
|
*/
|
|
5224
5233
|
|
|
5225
5234
|
function CheckSignature(body, secret, signature) {
|
|
5226
|
-
var key = Buffer.from(secret, '
|
|
5235
|
+
var key = Buffer.from(secret, 'utf8');
|
|
5227
5236
|
var hash = crypto$1.createHmac('sha256', key).update(body).digest('hex');
|
|
5228
|
-
|
|
5237
|
+
|
|
5238
|
+
try {
|
|
5239
|
+
return crypto$1.timingSafeEqual(Buffer.from(hash), Buffer.from(signature));
|
|
5240
|
+
} catch (_unused) {
|
|
5241
|
+
return false;
|
|
5242
|
+
}
|
|
5229
5243
|
}
|
|
5230
5244
|
|
|
5231
5245
|
/**
|
|
@@ -8112,18 +8126,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8112
8126
|
_iterator3.f();
|
|
8113
8127
|
}
|
|
8114
8128
|
|
|
8115
|
-
if (!offlineMode) {
|
|
8116
|
-
// If the channels are coming from server, then clear out the
|
|
8117
|
-
// previously help offline channels.
|
|
8118
|
-
for (var _key5 in this.activeChannels) {
|
|
8119
|
-
var _channel7 = this.activeChannels[_key5];
|
|
8120
|
-
|
|
8121
|
-
if (_channel7.offlineMode) {
|
|
8122
|
-
delete this.activeChannels[_key5];
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
|
-
}
|
|
8126
|
-
|
|
8127
8129
|
return channels;
|
|
8128
8130
|
}
|
|
8129
8131
|
/**
|
|
@@ -10014,7 +10016,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10014
10016
|
}, {
|
|
10015
10017
|
key: "getUserAgent",
|
|
10016
10018
|
value: function getUserAgent() {
|
|
10017
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
10019
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.6.0");
|
|
10018
10020
|
}
|
|
10019
10021
|
}, {
|
|
10020
10022
|
key: "setUserAgent",
|
|
@@ -10091,9 +10093,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10091
10093
|
this.cleaningIntervalRef = setInterval(function () {
|
|
10092
10094
|
// call clean on the channel, used for calling the stop.typing event etc.
|
|
10093
10095
|
for (var _i3 = 0, _Object$values2 = Object.values(that.activeChannels); _i3 < _Object$values2.length; _i3++) {
|
|
10094
|
-
var
|
|
10096
|
+
var _channel7 = _Object$values2[_i3];
|
|
10095
10097
|
|
|
10096
|
-
|
|
10098
|
+
_channel7.clean();
|
|
10097
10099
|
}
|
|
10098
10100
|
}, 500);
|
|
10099
10101
|
}
|
|
@@ -10105,7 +10107,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10105
10107
|
|
|
10106
10108
|
}, {
|
|
10107
10109
|
key: "verifyWebhook",
|
|
10108
|
-
value:
|
|
10110
|
+
value:
|
|
10111
|
+
/**
|
|
10112
|
+
* checks signature of a request
|
|
10113
|
+
* @param {string | Buffer} rawBody
|
|
10114
|
+
* @param {string} signature from HTTP header
|
|
10115
|
+
* @returns {boolean}
|
|
10116
|
+
*/
|
|
10117
|
+
function verifyWebhook(requestBody, xSignature) {
|
|
10109
10118
|
return !!this.secret && CheckSignature(requestBody, this.secret, xSignature);
|
|
10110
10119
|
}
|
|
10111
10120
|
/** getPermission - gets the definition for a permission
|