stream-chat 8.12.2 → 8.12.3
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 -3
- 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 -2
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +57 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +57 -2
- 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 -0
- 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
|
}
|
|
@@ -3626,6 +3638,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3626
3638
|
|
|
3627
3639
|
var channel = this;
|
|
3628
3640
|
|
|
3641
|
+
if (!this._isInitialized()) {
|
|
3642
|
+
this.wsEventQueue.push(event);
|
|
3643
|
+
return;
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3629
3646
|
this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
|
|
3630
3647
|
tags: ['event', 'channel'],
|
|
3631
3648
|
channel: this
|
|
@@ -3876,6 +3893,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3876
3893
|
channel.state.watcher_count = event.watcher_count;
|
|
3877
3894
|
}
|
|
3878
3895
|
}
|
|
3896
|
+
}, {
|
|
3897
|
+
key: "_isInitialized",
|
|
3898
|
+
value: function _isInitialized() {
|
|
3899
|
+
return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
|
|
3900
|
+
}
|
|
3879
3901
|
}, {
|
|
3880
3902
|
key: "_checkInitialized",
|
|
3881
3903
|
value: function _checkInitialized() {
|
|
@@ -4037,6 +4059,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4037
4059
|
this.disconnected = true;
|
|
4038
4060
|
this.state.setIsUpToDate(false);
|
|
4039
4061
|
}
|
|
4062
|
+
}, {
|
|
4063
|
+
key: "_flushWsEventQueue",
|
|
4064
|
+
value: function _flushWsEventQueue() {
|
|
4065
|
+
while (this.wsEventQueue.length) {
|
|
4066
|
+
var event = this.wsEventQueue.shift();
|
|
4067
|
+
if (event) this.getClient().dispatchEvent(event);
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4040
4070
|
}]);
|
|
4041
4071
|
|
|
4042
4072
|
return Channel;
|
|
@@ -10090,7 +10120,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10090
10120
|
}, {
|
|
10091
10121
|
key: "getUserAgent",
|
|
10092
10122
|
value: function getUserAgent() {
|
|
10093
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.
|
|
10123
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.3");
|
|
10094
10124
|
}
|
|
10095
10125
|
}, {
|
|
10096
10126
|
key: "setUserAgent",
|
|
@@ -11484,6 +11514,30 @@ var EVENT_MAP = {
|
|
|
11484
11514
|
'connection.changed': true,
|
|
11485
11515
|
'connection.recovered': true,
|
|
11486
11516
|
'transport.changed': true
|
|
11517
|
+
}; // events handled by channel._handleChannelEvent
|
|
11518
|
+
|
|
11519
|
+
var CHANNEL_HANDLED_EVENTS = {
|
|
11520
|
+
'typing.start': true,
|
|
11521
|
+
'typing.stop': true,
|
|
11522
|
+
'message.read': true,
|
|
11523
|
+
'user.watching.start': true,
|
|
11524
|
+
'user.updated': true,
|
|
11525
|
+
'user.watching.stop': true,
|
|
11526
|
+
'message.deleted': true,
|
|
11527
|
+
'message.new': true,
|
|
11528
|
+
'message.updated': true,
|
|
11529
|
+
'channel.truncated': true,
|
|
11530
|
+
'member.added': true,
|
|
11531
|
+
'member.updated': true,
|
|
11532
|
+
'member.removed': true,
|
|
11533
|
+
'channel.updated': true,
|
|
11534
|
+
'reaction.new': true,
|
|
11535
|
+
'reaction.deleted': true,
|
|
11536
|
+
'reaction.updated': true,
|
|
11537
|
+
'channel.hidden': true,
|
|
11538
|
+
'channel.visible': true,
|
|
11539
|
+
'user.banned': true,
|
|
11540
|
+
'user.unbanned': true
|
|
11487
11541
|
};
|
|
11488
11542
|
|
|
11489
11543
|
var Allow = 'Allow';
|
|
@@ -11560,5 +11614,5 @@ var BuiltinPermissions = {
|
|
|
11560
11614
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
11561
11615
|
};
|
|
11562
11616
|
|
|
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 };
|
|
11617
|
+
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
11618
|
//# sourceMappingURL=index.es.js.map
|