stream-chat 8.5.0 → 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 +22 -20
- 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 +22 -20
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +22 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -20
- package/dist/index.js.map +1 -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 +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +2 -0
- package/src/channel_state.ts +1 -1
- package/src/client.ts +7 -12
- package/src/signing.ts +9 -4
- package/src/types.ts +1 -0
package/dist/browser.es.js
CHANGED
|
@@ -3225,6 +3225,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3225
3225
|
|
|
3226
3226
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
3227
3227
|
this.data = state.channel;
|
|
3228
|
+
this.offlineMode = false;
|
|
3228
3229
|
this.getClient().dispatchEvent({
|
|
3229
3230
|
type: 'channels.queried',
|
|
3230
3231
|
queriedChannels: {
|
|
@@ -3234,7 +3235,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3234
3235
|
});
|
|
3235
3236
|
return _context32.abrupt("return", state);
|
|
3236
3237
|
|
|
3237
|
-
case
|
|
3238
|
+
case 15:
|
|
3238
3239
|
case "end":
|
|
3239
3240
|
return _context32.stop();
|
|
3240
3241
|
}
|
|
@@ -3938,6 +3939,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3938
3939
|
var read = _step3.value;
|
|
3939
3940
|
this.state.read[read.user.id] = {
|
|
3940
3941
|
last_read: new Date(read.last_read),
|
|
3942
|
+
last_read_message_id: read.last_read_message_id,
|
|
3941
3943
|
unread_messages: (_read$unread_messages = read.unread_messages) !== null && _read$unread_messages !== void 0 ? _read$unread_messages : 0,
|
|
3942
3944
|
user: read.user
|
|
3943
3945
|
};
|
|
@@ -5223,16 +5225,21 @@ function DevToken(userId) {
|
|
|
5223
5225
|
}
|
|
5224
5226
|
/**
|
|
5225
5227
|
*
|
|
5226
|
-
* @param {string} body the signed message
|
|
5228
|
+
* @param {string | Buffer} body the signed message
|
|
5227
5229
|
* @param {string} secret the shared secret used to generate the signature (Stream API secret)
|
|
5228
5230
|
* @param {string} signature the signature to validate
|
|
5229
5231
|
* @return {boolean}
|
|
5230
5232
|
*/
|
|
5231
5233
|
|
|
5232
5234
|
function CheckSignature(body, secret, signature) {
|
|
5233
|
-
var key = Buffer.from(secret, '
|
|
5235
|
+
var key = Buffer.from(secret, 'utf8');
|
|
5234
5236
|
var hash = crypto$1.createHmac('sha256', key).update(body).digest('hex');
|
|
5235
|
-
|
|
5237
|
+
|
|
5238
|
+
try {
|
|
5239
|
+
return crypto$1.timingSafeEqual(Buffer.from(hash), Buffer.from(signature));
|
|
5240
|
+
} catch (_unused) {
|
|
5241
|
+
return false;
|
|
5242
|
+
}
|
|
5236
5243
|
}
|
|
5237
5244
|
|
|
5238
5245
|
/**
|
|
@@ -8119,18 +8126,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8119
8126
|
_iterator3.f();
|
|
8120
8127
|
}
|
|
8121
8128
|
|
|
8122
|
-
if (!offlineMode) {
|
|
8123
|
-
// If the channels are coming from server, then clear out the
|
|
8124
|
-
// previously help offline channels.
|
|
8125
|
-
for (var _key5 in this.activeChannels) {
|
|
8126
|
-
var _channel7 = this.activeChannels[_key5];
|
|
8127
|
-
|
|
8128
|
-
if (_channel7.offlineMode) {
|
|
8129
|
-
delete this.activeChannels[_key5];
|
|
8130
|
-
}
|
|
8131
|
-
}
|
|
8132
|
-
}
|
|
8133
|
-
|
|
8134
8129
|
return channels;
|
|
8135
8130
|
}
|
|
8136
8131
|
/**
|
|
@@ -10021,7 +10016,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10021
10016
|
}, {
|
|
10022
10017
|
key: "getUserAgent",
|
|
10023
10018
|
value: function getUserAgent() {
|
|
10024
|
-
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");
|
|
10025
10020
|
}
|
|
10026
10021
|
}, {
|
|
10027
10022
|
key: "setUserAgent",
|
|
@@ -10098,9 +10093,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10098
10093
|
this.cleaningIntervalRef = setInterval(function () {
|
|
10099
10094
|
// call clean on the channel, used for calling the stop.typing event etc.
|
|
10100
10095
|
for (var _i3 = 0, _Object$values2 = Object.values(that.activeChannels); _i3 < _Object$values2.length; _i3++) {
|
|
10101
|
-
var
|
|
10096
|
+
var _channel7 = _Object$values2[_i3];
|
|
10102
10097
|
|
|
10103
|
-
|
|
10098
|
+
_channel7.clean();
|
|
10104
10099
|
}
|
|
10105
10100
|
}, 500);
|
|
10106
10101
|
}
|
|
@@ -10112,7 +10107,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10112
10107
|
|
|
10113
10108
|
}, {
|
|
10114
10109
|
key: "verifyWebhook",
|
|
10115
|
-
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) {
|
|
10116
10118
|
return !!this.secret && CheckSignature(requestBody, this.secret, xSignature);
|
|
10117
10119
|
}
|
|
10118
10120
|
/** getPermission - gets the definition for a permission
|