polfan-server-js-client 0.2.53 → 0.2.55
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/.idea/workspace.xml +17 -16
- package/build/index.cjs.js +25 -13
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/IndexedObjectCollection.d.ts +4 -3
- package/package.json +1 -1
- package/src/IndexedObjectCollection.ts +26 -12
- package/src/WebSocketChatClient.ts +3 -3
package/.idea/workspace.xml
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/src/
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/src/WebSocketChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/WebSocketChatClient.ts" afterDir="false" />
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Fix websocket state error handling">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/src/IndexedObjectCollection.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/IndexedObjectCollection.ts" afterDir="false" />
|
|
11
10
|
</list>
|
|
12
11
|
<option name="SHOW_DIALOG" value="false" />
|
|
13
12
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -137,15 +136,9 @@
|
|
|
137
136
|
<workItem from="1757108361675" duration="5000" />
|
|
138
137
|
<workItem from="1759771277022" duration="584000" />
|
|
139
138
|
<workItem from="1759848250548" duration="413000" />
|
|
140
|
-
<workItem from="1761857165939" duration="
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<option name="closed" value="true" />
|
|
144
|
-
<created>1738413358814</created>
|
|
145
|
-
<option name="number" value="00011" />
|
|
146
|
-
<option name="presentableId" value="LOCAL-00011" />
|
|
147
|
-
<option name="project" value="LOCAL" />
|
|
148
|
-
<updated>1738413358814</updated>
|
|
139
|
+
<workItem from="1761857165939" duration="4293000" />
|
|
140
|
+
<workItem from="1762715993044" duration="642000" />
|
|
141
|
+
<workItem from="1762724230487" duration="4909000" />
|
|
149
142
|
</task>
|
|
150
143
|
<task id="LOCAL-00012" summary="Permission related changes in protocol types">
|
|
151
144
|
<option name="closed" value="true" />
|
|
@@ -531,7 +524,15 @@
|
|
|
531
524
|
<option name="project" value="LOCAL" />
|
|
532
525
|
<updated>1756804976724</updated>
|
|
533
526
|
</task>
|
|
534
|
-
<
|
|
527
|
+
<task id="LOCAL-00060" summary="Fix websocket state error handling">
|
|
528
|
+
<option name="closed" value="true" />
|
|
529
|
+
<created>1761861305919</created>
|
|
530
|
+
<option name="number" value="00060" />
|
|
531
|
+
<option name="presentableId" value="LOCAL-00060" />
|
|
532
|
+
<option name="project" value="LOCAL" />
|
|
533
|
+
<updated>1761861305919</updated>
|
|
534
|
+
</task>
|
|
535
|
+
<option name="localTasksCounter" value="61" />
|
|
535
536
|
<servers />
|
|
536
537
|
</component>
|
|
537
538
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -549,7 +550,6 @@
|
|
|
549
550
|
</option>
|
|
550
551
|
</component>
|
|
551
552
|
<component name="VcsManagerConfiguration">
|
|
552
|
-
<MESSAGE value="Private rooms and space summaries" />
|
|
553
553
|
<MESSAGE value="Custom nicks support" />
|
|
554
554
|
<MESSAGE value="CustomNickChange message type" />
|
|
555
555
|
<MESSAGE value="Fix module exporting (node + browser)" />
|
|
@@ -574,6 +574,7 @@
|
|
|
574
574
|
<MESSAGE value="Ephemeral room history support" />
|
|
575
575
|
<MESSAGE value="Protocol version support" />
|
|
576
576
|
<MESSAGE value="Update room on recipient user change" />
|
|
577
|
-
<
|
|
577
|
+
<MESSAGE value="Fix websocket state error handling" />
|
|
578
|
+
<option name="LAST_COMMIT_MESSAGE" value="Fix websocket state error handling" />
|
|
578
579
|
</component>
|
|
579
580
|
</project>
|
package/build/index.cjs.js
CHANGED
|
@@ -155,12 +155,8 @@ function IndexedObjectCollection_toPrimitive(input, hint) { if (typeof input !==
|
|
|
155
155
|
class IndexedCollection {
|
|
156
156
|
constructor(items = []) {
|
|
157
157
|
IndexedObjectCollection_defineProperty(this, "_items", new Map());
|
|
158
|
-
IndexedObjectCollection_defineProperty(this, "_mutationCounter", 0);
|
|
159
158
|
this.set(...items);
|
|
160
159
|
}
|
|
161
|
-
get mutationCounter() {
|
|
162
|
-
return this._mutationCounter;
|
|
163
|
-
}
|
|
164
160
|
get items() {
|
|
165
161
|
return this._items;
|
|
166
162
|
}
|
|
@@ -168,7 +164,6 @@ class IndexedCollection {
|
|
|
168
164
|
return this._items.size;
|
|
169
165
|
}
|
|
170
166
|
set(...items) {
|
|
171
|
-
this._mutationCounter++;
|
|
172
167
|
for (const item of items) {
|
|
173
168
|
this._items.set(item[0], item[1]);
|
|
174
169
|
}
|
|
@@ -183,11 +178,9 @@ class IndexedCollection {
|
|
|
183
178
|
for (const id of ids) {
|
|
184
179
|
this.items.delete(id);
|
|
185
180
|
}
|
|
186
|
-
this._mutationCounter++;
|
|
187
181
|
}
|
|
188
182
|
deleteAll() {
|
|
189
183
|
this.items.clear();
|
|
190
|
-
this._mutationCounter++;
|
|
191
184
|
}
|
|
192
185
|
findBy(field, valueToFind, limit = null) {
|
|
193
186
|
const result = new IndexedCollection();
|
|
@@ -202,6 +195,11 @@ class IndexedCollection {
|
|
|
202
195
|
}
|
|
203
196
|
return result;
|
|
204
197
|
}
|
|
198
|
+
shallowCopy() {
|
|
199
|
+
const copy = new IndexedCollection();
|
|
200
|
+
copy._items = this._items;
|
|
201
|
+
return copy;
|
|
202
|
+
}
|
|
205
203
|
}
|
|
206
204
|
class IndexedObjectCollection {
|
|
207
205
|
constructor(id, items = []) {
|
|
@@ -216,9 +214,6 @@ class IndexedObjectCollection {
|
|
|
216
214
|
get length() {
|
|
217
215
|
return this._items.length;
|
|
218
216
|
}
|
|
219
|
-
get mutationCounter() {
|
|
220
|
-
return this._items.mutationCounter;
|
|
221
|
-
}
|
|
222
217
|
set(...items) {
|
|
223
218
|
this._items.set(...items.map(item => [this.getId(item), item]));
|
|
224
219
|
}
|
|
@@ -249,6 +244,11 @@ class IndexedObjectCollection {
|
|
|
249
244
|
}
|
|
250
245
|
return result;
|
|
251
246
|
}
|
|
247
|
+
shallowCopy() {
|
|
248
|
+
const copy = new IndexedObjectCollection(this.id);
|
|
249
|
+
copy._items = this._items;
|
|
250
|
+
return copy;
|
|
251
|
+
}
|
|
252
252
|
getId(item) {
|
|
253
253
|
return typeof this.id === 'function' ? this.id(item) : item[this.id];
|
|
254
254
|
}
|
|
@@ -285,6 +285,12 @@ class ObservableIndexedCollection extends IndexedCollection {
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
+
shallowCopy() {
|
|
289
|
+
const copy = new ObservableIndexedCollection();
|
|
290
|
+
copy.eventTarget = this.eventTarget;
|
|
291
|
+
copy._items = this._items;
|
|
292
|
+
return copy;
|
|
293
|
+
}
|
|
288
294
|
on(eventName, handler) {
|
|
289
295
|
this.eventTarget.on(eventName, handler);
|
|
290
296
|
return this;
|
|
@@ -331,6 +337,12 @@ class ObservableIndexedObjectCollection extends IndexedObjectCollection {
|
|
|
331
337
|
});
|
|
332
338
|
}
|
|
333
339
|
}
|
|
340
|
+
shallowCopy() {
|
|
341
|
+
const copy = new ObservableIndexedObjectCollection(this.id);
|
|
342
|
+
copy.eventTarget = this.eventTarget;
|
|
343
|
+
copy._items = this._items;
|
|
344
|
+
return copy;
|
|
345
|
+
}
|
|
334
346
|
on(eventName, handler) {
|
|
335
347
|
this.eventTarget.on(eventName, handler);
|
|
336
348
|
return this;
|
|
@@ -2159,7 +2171,7 @@ class WebSocketChatClient extends AbstractChatClient {
|
|
|
2159
2171
|
this.ws.send(JSON.stringify(envelope));
|
|
2160
2172
|
return;
|
|
2161
2173
|
}
|
|
2162
|
-
this.handleEnvelopeSendError(envelope, new Error(`Cannot send; invalid websocket state=${this.ws?.readyState}`));
|
|
2174
|
+
this.handleEnvelopeSendError(envelope, new Error(`Cannot send; invalid websocket state=${this.ws?.readyState ?? '[no connection]'}`));
|
|
2163
2175
|
}
|
|
2164
2176
|
onMessage(event) {
|
|
2165
2177
|
const envelope = JSON.parse(event.data);
|
|
@@ -2204,10 +2216,10 @@ class WebSocketChatClient extends AbstractChatClient {
|
|
|
2204
2216
|
this.emit(this.Event.error, new Error('Connection timeout'));
|
|
2205
2217
|
}
|
|
2206
2218
|
isPendingReadyWsState() {
|
|
2207
|
-
return this.ws.readyState === this.ws.CONNECTING || !this.authenticated;
|
|
2219
|
+
return this.ws && this.ws.readyState === this.ws.CONNECTING || !this.authenticated;
|
|
2208
2220
|
}
|
|
2209
2221
|
isReadyToSendWsState() {
|
|
2210
|
-
return this.ws
|
|
2222
|
+
return this.ws && this.ws.readyState === this.ws.OPEN && this.authenticated;
|
|
2211
2223
|
}
|
|
2212
2224
|
}
|
|
2213
2225
|
;// CONCATENATED MODULE: ./src/WebApiChatClient.ts
|