stream-chat 8.12.2 → 8.12.4
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 +57 -5
- 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 +57 -4
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +57 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +8 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/events.d.ts +23 -0
- package/dist/types/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +25 -1
- package/src/events.ts +25 -0
package/dist/index.es.js
CHANGED
|
@@ -1357,6 +1357,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1357
1357
|
* Static state indicates that channel exists on backend, but is not being watched yet.
|
|
1358
1358
|
*/
|
|
1359
1359
|
|
|
1360
|
+
/**
|
|
1361
|
+
* Collects the incoming WS events before the channel is marked as initialized.
|
|
1362
|
+
* This prevents executing procedures that depend on channel being initialized.
|
|
1363
|
+
* Once the channel is marked as initialized the queue is flushed.
|
|
1364
|
+
*/
|
|
1365
|
+
|
|
1360
1366
|
/**
|
|
1361
1367
|
* constructor - Create a channel
|
|
1362
1368
|
*
|
|
@@ -1400,6 +1406,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1400
1406
|
|
|
1401
1407
|
_defineProperty(this, "disconnected", void 0);
|
|
1402
1408
|
|
|
1409
|
+
_defineProperty(this, "wsEventQueue", void 0);
|
|
1410
|
+
|
|
1403
1411
|
_defineProperty(this, "create", /*#__PURE__*/function () {
|
|
1404
1412
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
1405
1413
|
var defaultOptions;
|
|
@@ -1489,6 +1497,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1489
1497
|
this.lastTypingEvent = null;
|
|
1490
1498
|
this.isTyping = false;
|
|
1491
1499
|
this.disconnected = false;
|
|
1500
|
+
this.wsEventQueue = [];
|
|
1492
1501
|
}
|
|
1493
1502
|
/**
|
|
1494
1503
|
* getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
|
|
@@ -2892,6 +2901,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2892
2901
|
case 7:
|
|
2893
2902
|
state = _context28.sent;
|
|
2894
2903
|
this.initialized = true;
|
|
2904
|
+
|
|
2905
|
+
this._flushWsEventQueue();
|
|
2906
|
+
|
|
2895
2907
|
this.data = state.channel;
|
|
2896
2908
|
|
|
2897
2909
|
this._client.logger('info', "channel:watch() - started watching channel ".concat(this.cid), {
|
|
@@ -2901,7 +2913,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2901
2913
|
|
|
2902
2914
|
return _context28.abrupt("return", state);
|
|
2903
2915
|
|
|
2904
|
-
case
|
|
2916
|
+
case 13:
|
|
2905
2917
|
case "end":
|
|
2906
2918
|
return _context28.stop();
|
|
2907
2919
|
}
|
|
@@ -3083,8 +3095,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3083
3095
|
}, {
|
|
3084
3096
|
key: "lastRead",
|
|
3085
3097
|
value: function lastRead() {
|
|
3086
|
-
this._checkInitialized();
|
|
3087
|
-
|
|
3088
3098
|
var _this$getClient = this.getClient(),
|
|
3089
3099
|
userID = _this$getClient.userID;
|
|
3090
3100
|
|
|
@@ -3626,6 +3636,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3626
3636
|
|
|
3627
3637
|
var channel = this;
|
|
3628
3638
|
|
|
3639
|
+
if (!this._isInitialized()) {
|
|
3640
|
+
this.wsEventQueue.push(event);
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3629
3644
|
this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
|
|
3630
3645
|
tags: ['event', 'channel'],
|
|
3631
3646
|
channel: this
|
|
@@ -3876,6 +3891,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3876
3891
|
channel.state.watcher_count = event.watcher_count;
|
|
3877
3892
|
}
|
|
3878
3893
|
}
|
|
3894
|
+
}, {
|
|
3895
|
+
key: "_isInitialized",
|
|
3896
|
+
value: function _isInitialized() {
|
|
3897
|
+
return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
|
|
3898
|
+
}
|
|
3879
3899
|
}, {
|
|
3880
3900
|
key: "_checkInitialized",
|
|
3881
3901
|
value: function _checkInitialized() {
|
|
@@ -4037,6 +4057,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4037
4057
|
this.disconnected = true;
|
|
4038
4058
|
this.state.setIsUpToDate(false);
|
|
4039
4059
|
}
|
|
4060
|
+
}, {
|
|
4061
|
+
key: "_flushWsEventQueue",
|
|
4062
|
+
value: function _flushWsEventQueue() {
|
|
4063
|
+
while (this.wsEventQueue.length) {
|
|
4064
|
+
var event = this.wsEventQueue.shift();
|
|
4065
|
+
if (event) this.getClient().dispatchEvent(event);
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4040
4068
|
}]);
|
|
4041
4069
|
|
|
4042
4070
|
return Channel;
|
|
@@ -10090,7 +10118,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10090
10118
|
}, {
|
|
10091
10119
|
key: "getUserAgent",
|
|
10092
10120
|
value: function getUserAgent() {
|
|
10093
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.
|
|
10121
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.4");
|
|
10094
10122
|
}
|
|
10095
10123
|
}, {
|
|
10096
10124
|
key: "setUserAgent",
|
|
@@ -11484,6 +11512,30 @@ var EVENT_MAP = {
|
|
|
11484
11512
|
'connection.changed': true,
|
|
11485
11513
|
'connection.recovered': true,
|
|
11486
11514
|
'transport.changed': true
|
|
11515
|
+
}; // events handled by channel._handleChannelEvent
|
|
11516
|
+
|
|
11517
|
+
var CHANNEL_HANDLED_EVENTS = {
|
|
11518
|
+
'typing.start': true,
|
|
11519
|
+
'typing.stop': true,
|
|
11520
|
+
'message.read': true,
|
|
11521
|
+
'user.watching.start': true,
|
|
11522
|
+
'user.updated': true,
|
|
11523
|
+
'user.watching.stop': true,
|
|
11524
|
+
'message.deleted': true,
|
|
11525
|
+
'message.new': true,
|
|
11526
|
+
'message.updated': true,
|
|
11527
|
+
'channel.truncated': true,
|
|
11528
|
+
'member.added': true,
|
|
11529
|
+
'member.updated': true,
|
|
11530
|
+
'member.removed': true,
|
|
11531
|
+
'channel.updated': true,
|
|
11532
|
+
'reaction.new': true,
|
|
11533
|
+
'reaction.deleted': true,
|
|
11534
|
+
'reaction.updated': true,
|
|
11535
|
+
'channel.hidden': true,
|
|
11536
|
+
'channel.visible': true,
|
|
11537
|
+
'user.banned': true,
|
|
11538
|
+
'user.unbanned': true
|
|
11487
11539
|
};
|
|
11488
11540
|
|
|
11489
11541
|
var Allow = 'Allow';
|
|
@@ -11560,5 +11612,5 @@ var BuiltinPermissions = {
|
|
|
11560
11612
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
11561
11613
|
};
|
|
11562
11614
|
|
|
11563
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
|
|
11615
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, CHANNEL_HANDLED_EVENTS, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
|
|
11564
11616
|
//# sourceMappingURL=index.es.js.map
|