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/browser.js
CHANGED
|
@@ -1381,6 +1381,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1381
1381
|
* Static state indicates that channel exists on backend, but is not being watched yet.
|
|
1382
1382
|
*/
|
|
1383
1383
|
|
|
1384
|
+
/**
|
|
1385
|
+
* Collects the incoming WS events before the channel is marked as initialized.
|
|
1386
|
+
* This prevents executing procedures that depend on channel being initialized.
|
|
1387
|
+
* Once the channel is marked as initialized the queue is flushed.
|
|
1388
|
+
*/
|
|
1389
|
+
|
|
1384
1390
|
/**
|
|
1385
1391
|
* constructor - Create a channel
|
|
1386
1392
|
*
|
|
@@ -1424,6 +1430,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1424
1430
|
|
|
1425
1431
|
_defineProperty__default['default'](this, "disconnected", void 0);
|
|
1426
1432
|
|
|
1433
|
+
_defineProperty__default['default'](this, "wsEventQueue", void 0);
|
|
1434
|
+
|
|
1427
1435
|
_defineProperty__default['default'](this, "create", /*#__PURE__*/function () {
|
|
1428
1436
|
var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(options) {
|
|
1429
1437
|
var defaultOptions;
|
|
@@ -1513,6 +1521,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1513
1521
|
this.lastTypingEvent = null;
|
|
1514
1522
|
this.isTyping = false;
|
|
1515
1523
|
this.disconnected = false;
|
|
1524
|
+
this.wsEventQueue = [];
|
|
1516
1525
|
}
|
|
1517
1526
|
/**
|
|
1518
1527
|
* getClient - Get the chat client for this channel. If client.disconnect() was called, this function will error
|
|
@@ -2916,6 +2925,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2916
2925
|
case 7:
|
|
2917
2926
|
state = _context28.sent;
|
|
2918
2927
|
this.initialized = true;
|
|
2928
|
+
|
|
2929
|
+
this._flushWsEventQueue();
|
|
2930
|
+
|
|
2919
2931
|
this.data = state.channel;
|
|
2920
2932
|
|
|
2921
2933
|
this._client.logger('info', "channel:watch() - started watching channel ".concat(this.cid), {
|
|
@@ -2925,7 +2937,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2925
2937
|
|
|
2926
2938
|
return _context28.abrupt("return", state);
|
|
2927
2939
|
|
|
2928
|
-
case
|
|
2940
|
+
case 13:
|
|
2929
2941
|
case "end":
|
|
2930
2942
|
return _context28.stop();
|
|
2931
2943
|
}
|
|
@@ -3107,8 +3119,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3107
3119
|
}, {
|
|
3108
3120
|
key: "lastRead",
|
|
3109
3121
|
value: function lastRead() {
|
|
3110
|
-
this._checkInitialized();
|
|
3111
|
-
|
|
3112
3122
|
var _this$getClient = this.getClient(),
|
|
3113
3123
|
userID = _this$getClient.userID;
|
|
3114
3124
|
|
|
@@ -3650,6 +3660,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3650
3660
|
|
|
3651
3661
|
var channel = this;
|
|
3652
3662
|
|
|
3663
|
+
if (!this._isInitialized()) {
|
|
3664
|
+
this.wsEventQueue.push(event);
|
|
3665
|
+
return;
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3653
3668
|
this._client.logger('info', "channel:_handleChannelEvent - Received event of type { ".concat(event.type, " } on ").concat(this.cid), {
|
|
3654
3669
|
tags: ['event', 'channel'],
|
|
3655
3670
|
channel: this
|
|
@@ -3900,6 +3915,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3900
3915
|
channel.state.watcher_count = event.watcher_count;
|
|
3901
3916
|
}
|
|
3902
3917
|
}
|
|
3918
|
+
}, {
|
|
3919
|
+
key: "_isInitialized",
|
|
3920
|
+
value: function _isInitialized() {
|
|
3921
|
+
return this.initialized || this.offlineMode || this.getClient()._isUsingServerAuth();
|
|
3922
|
+
}
|
|
3903
3923
|
}, {
|
|
3904
3924
|
key: "_checkInitialized",
|
|
3905
3925
|
value: function _checkInitialized() {
|
|
@@ -4061,6 +4081,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4061
4081
|
this.disconnected = true;
|
|
4062
4082
|
this.state.setIsUpToDate(false);
|
|
4063
4083
|
}
|
|
4084
|
+
}, {
|
|
4085
|
+
key: "_flushWsEventQueue",
|
|
4086
|
+
value: function _flushWsEventQueue() {
|
|
4087
|
+
while (this.wsEventQueue.length) {
|
|
4088
|
+
var event = this.wsEventQueue.shift();
|
|
4089
|
+
if (event) this.getClient().dispatchEvent(event);
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4064
4092
|
}]);
|
|
4065
4093
|
|
|
4066
4094
|
return Channel;
|
|
@@ -10112,7 +10140,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10112
10140
|
}, {
|
|
10113
10141
|
key: "getUserAgent",
|
|
10114
10142
|
value: function getUserAgent() {
|
|
10115
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.
|
|
10143
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.4");
|
|
10116
10144
|
}
|
|
10117
10145
|
}, {
|
|
10118
10146
|
key: "setUserAgent",
|
|
@@ -11506,6 +11534,30 @@ var EVENT_MAP = {
|
|
|
11506
11534
|
'connection.changed': true,
|
|
11507
11535
|
'connection.recovered': true,
|
|
11508
11536
|
'transport.changed': true
|
|
11537
|
+
}; // events handled by channel._handleChannelEvent
|
|
11538
|
+
|
|
11539
|
+
var CHANNEL_HANDLED_EVENTS = {
|
|
11540
|
+
'typing.start': true,
|
|
11541
|
+
'typing.stop': true,
|
|
11542
|
+
'message.read': true,
|
|
11543
|
+
'user.watching.start': true,
|
|
11544
|
+
'user.updated': true,
|
|
11545
|
+
'user.watching.stop': true,
|
|
11546
|
+
'message.deleted': true,
|
|
11547
|
+
'message.new': true,
|
|
11548
|
+
'message.updated': true,
|
|
11549
|
+
'channel.truncated': true,
|
|
11550
|
+
'member.added': true,
|
|
11551
|
+
'member.updated': true,
|
|
11552
|
+
'member.removed': true,
|
|
11553
|
+
'channel.updated': true,
|
|
11554
|
+
'reaction.new': true,
|
|
11555
|
+
'reaction.deleted': true,
|
|
11556
|
+
'reaction.updated': true,
|
|
11557
|
+
'channel.hidden': true,
|
|
11558
|
+
'channel.visible': true,
|
|
11559
|
+
'user.banned': true,
|
|
11560
|
+
'user.unbanned': true
|
|
11509
11561
|
};
|
|
11510
11562
|
|
|
11511
11563
|
var Allow = 'Allow';
|
|
@@ -11588,6 +11640,7 @@ exports.AnyResource = AnyResource;
|
|
|
11588
11640
|
exports.AnyRole = AnyRole;
|
|
11589
11641
|
exports.BuiltinPermissions = BuiltinPermissions;
|
|
11590
11642
|
exports.BuiltinRoles = BuiltinRoles;
|
|
11643
|
+
exports.CHANNEL_HANDLED_EVENTS = CHANNEL_HANDLED_EVENTS;
|
|
11591
11644
|
exports.Channel = Channel;
|
|
11592
11645
|
exports.ChannelState = ChannelState;
|
|
11593
11646
|
exports.CheckSignature = CheckSignature;
|