polfan-server-js-client 0.2.102 → 0.2.104
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 +49 -47
- package/build/index.cjs.js +72 -38
- 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/WebApiChatClient.d.ts +10 -8
- package/package.json +1 -1
- package/src/WebApiChatClient.ts +62 -23
- package/src/state-tracker/TopicHistoryWindow.ts +7 -8
package/.idea/workspace.xml
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
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$/src/state-tracker/
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Fixes in WebApiChatClient">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" afterDir="false" />
|
|
9
9
|
</list>
|
|
10
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -59,32 +59,32 @@
|
|
|
59
59
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
60
60
|
<option name="showLibraryContents" value="true" />
|
|
61
61
|
</component>
|
|
62
|
-
<component name="PropertiesComponent"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
<component name="PropertiesComponent">{
|
|
63
|
+
"keyToString": {
|
|
64
|
+
"RunOnceActivity.MCP Project settings loaded": "true",
|
|
65
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
66
|
+
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
|
67
|
+
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
|
68
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
69
|
+
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
|
70
|
+
"codeWithMe.voiceChat.enabledByDefault": "false",
|
|
71
|
+
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
|
|
72
|
+
"git-widget-placeholder": "master",
|
|
73
|
+
"git.auto.fetch.suggestion.counter": "1",
|
|
74
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
75
|
+
"junie.onboarding.icon.badge.shown": "true",
|
|
76
|
+
"last_opened_file_path": "//wsl.localhost/Debian/home/jarek/polfan-js-client-library",
|
|
77
|
+
"node.js.detected.package.eslint": "true",
|
|
78
|
+
"node.js.detected.package.tslint": "true",
|
|
79
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
80
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
81
|
+
"nodejs_package_manager_path": "npm",
|
|
82
|
+
"settings.editor.selected.configurable": "com.github.copilot.settings.chat.ChatConfigurable",
|
|
83
|
+
"to.speed.mode.migration.done": "true",
|
|
84
|
+
"ts.external.directory.path": "\\\\wsl.localhost\\Debian\\home\\jarek\\polfan-js-client-library\\node_modules\\typescript\\lib",
|
|
85
|
+
"vue.rearranger.settings.migration": "true"
|
|
86
86
|
}
|
|
87
|
-
}
|
|
87
|
+
}</component>
|
|
88
88
|
<component name="SharedIndexes">
|
|
89
89
|
<attachedChunks>
|
|
90
90
|
<set>
|
|
@@ -208,23 +208,9 @@
|
|
|
208
208
|
<workItem from="1782664203095" duration="5539000" />
|
|
209
209
|
<workItem from="1782909199211" duration="2404000" />
|
|
210
210
|
<workItem from="1783939298935" duration="21428000" />
|
|
211
|
-
<workItem from="1784102649250" duration="
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
<option name="closed" value="true" />
|
|
215
|
-
<created>1754319172537</created>
|
|
216
|
-
<option name="number" value="00053" />
|
|
217
|
-
<option name="presentableId" value="LOCAL-00053" />
|
|
218
|
-
<option name="project" value="LOCAL" />
|
|
219
|
-
<updated>1754319172537</updated>
|
|
220
|
-
</task>
|
|
221
|
-
<task id="LOCAL-00054" summary="Version bump">
|
|
222
|
-
<option name="closed" value="true" />
|
|
223
|
-
<created>1754567912510</created>
|
|
224
|
-
<option name="number" value="00054" />
|
|
225
|
-
<option name="presentableId" value="LOCAL-00054" />
|
|
226
|
-
<option name="project" value="LOCAL" />
|
|
227
|
-
<updated>1754567912510</updated>
|
|
211
|
+
<workItem from="1784102649250" duration="12484000" />
|
|
212
|
+
<workItem from="1784524117686" duration="79000" />
|
|
213
|
+
<workItem from="1784562428378" duration="1297000" />
|
|
228
214
|
</task>
|
|
229
215
|
<task id="LOCAL-00055" summary="RoomSummaryUpdated event support">
|
|
230
216
|
<option name="closed" value="true" />
|
|
@@ -602,7 +588,23 @@
|
|
|
602
588
|
<option name="project" value="LOCAL" />
|
|
603
589
|
<updated>1784229730189</updated>
|
|
604
590
|
</task>
|
|
605
|
-
<
|
|
591
|
+
<task id="LOCAL-00102" summary="Topic unfollowing">
|
|
592
|
+
<option name="closed" value="true" />
|
|
593
|
+
<created>1784236719408</created>
|
|
594
|
+
<option name="number" value="00102" />
|
|
595
|
+
<option name="presentableId" value="LOCAL-00102" />
|
|
596
|
+
<option name="project" value="LOCAL" />
|
|
597
|
+
<updated>1784236719408</updated>
|
|
598
|
+
</task>
|
|
599
|
+
<task id="LOCAL-00103" summary="Fixes in WebApiChatClient">
|
|
600
|
+
<option name="closed" value="true" />
|
|
601
|
+
<created>1784454304263</created>
|
|
602
|
+
<option name="number" value="00103" />
|
|
603
|
+
<option name="presentableId" value="LOCAL-00103" />
|
|
604
|
+
<option name="project" value="LOCAL" />
|
|
605
|
+
<updated>1784454304263</updated>
|
|
606
|
+
</task>
|
|
607
|
+
<option name="localTasksCounter" value="104" />
|
|
606
608
|
<servers />
|
|
607
609
|
</component>
|
|
608
610
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -647,7 +649,6 @@
|
|
|
647
649
|
</option>
|
|
648
650
|
</component>
|
|
649
651
|
<component name="VcsManagerConfiguration">
|
|
650
|
-
<MESSAGE value="Improve hasOldest behavior when resetToLatest used" />
|
|
651
652
|
<MESSAGE value="Align permissions to server changes" />
|
|
652
653
|
<MESSAGE value="Allow to define ManageRoom permission on room level" />
|
|
653
654
|
<MESSAGE value="Remove unused exports" />
|
|
@@ -672,7 +673,8 @@
|
|
|
672
673
|
<MESSAGE value="Fix roles checking in spaceless rooms" />
|
|
673
674
|
<MESSAGE value="Adjust session data changes" />
|
|
674
675
|
<MESSAGE value="Topic unfollowing" />
|
|
675
|
-
<
|
|
676
|
+
<MESSAGE value="Fixes in WebApiChatClient" />
|
|
677
|
+
<option name="LAST_COMMIT_MESSAGE" value="Fixes in WebApiChatClient" />
|
|
676
678
|
</component>
|
|
677
679
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
678
680
|
<expand />
|
package/build/index.cjs.js
CHANGED
|
@@ -960,22 +960,21 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
960
960
|
case 3:
|
|
961
961
|
result = _context4.v;
|
|
962
962
|
this.internalState.lastFetchCount = result ? result.length : 0;
|
|
963
|
+
if (!result) {
|
|
964
|
+
_context4.n = 4;
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
|
|
968
|
+
this.addItems(result, 'tail');
|
|
969
|
+
_context4.n = 4;
|
|
970
|
+
return this.refreshFetchedState();
|
|
963
971
|
case 4:
|
|
964
972
|
_context4.p = 4;
|
|
965
973
|
this.internalState.ongoing = undefined;
|
|
966
974
|
return _context4.f(4);
|
|
967
975
|
case 5:
|
|
968
|
-
|
|
969
|
-
_context4.n = 6;
|
|
970
|
-
break;
|
|
971
|
-
}
|
|
972
|
-
return _context4.a(2);
|
|
976
|
+
this.emitChangeWithDiff(!!result, originalState);
|
|
973
977
|
case 6:
|
|
974
|
-
this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
|
|
975
|
-
this.addItems(result, 'tail');
|
|
976
|
-
this.internalState.current = WindowState.PAST;
|
|
977
|
-
this.emitChangeWithDiff(true, originalState);
|
|
978
|
-
case 7:
|
|
979
978
|
return _context4.a(2);
|
|
980
979
|
}
|
|
981
980
|
}, _callee4, this, [[2,, 4, 5]]);
|
|
@@ -5228,7 +5227,7 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
5228
5227
|
WebApiChatClient_classCallCheck(this, WebApiChatClient);
|
|
5229
5228
|
_this = WebApiChatClient_callSuper(this, WebApiChatClient);
|
|
5230
5229
|
WebApiChatClient_defineProperty(_this, "Event", WebApiChatClientEvent);
|
|
5231
|
-
WebApiChatClient_defineProperty(_this, "sendStack",
|
|
5230
|
+
WebApiChatClient_defineProperty(_this, "sendStack", []);
|
|
5232
5231
|
_this.options = options;
|
|
5233
5232
|
return _this;
|
|
5234
5233
|
}
|
|
@@ -5237,17 +5236,18 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
5237
5236
|
key: "send",
|
|
5238
5237
|
value: function () {
|
|
5239
5238
|
var _send = WebApiChatClient_asyncToGenerator(/*#__PURE__*/WebApiChatClient_regenerator().m(function _callee(commandType, commandData) {
|
|
5240
|
-
var envelope;
|
|
5239
|
+
var envelope, item;
|
|
5241
5240
|
return WebApiChatClient_regenerator().w(function (_context) {
|
|
5242
5241
|
while (1) switch (_context.n) {
|
|
5243
5242
|
case 0:
|
|
5244
5243
|
envelope = this.createEnvelope(commandType, commandData);
|
|
5245
|
-
|
|
5244
|
+
item = {
|
|
5246
5245
|
data: envelope,
|
|
5247
5246
|
attempts: 0,
|
|
5248
5247
|
lastTimeoutId: null
|
|
5249
|
-
}
|
|
5250
|
-
this.
|
|
5248
|
+
};
|
|
5249
|
+
this.sendStack.push(item);
|
|
5250
|
+
this.makeApiCall(item);
|
|
5251
5251
|
return _context.a(2, this.createPromiseFromCommandEnvelope(envelope));
|
|
5252
5252
|
}
|
|
5253
5253
|
}, _callee, this);
|
|
@@ -5261,36 +5261,53 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
5261
5261
|
key: "destroy",
|
|
5262
5262
|
value: function destroy() {
|
|
5263
5263
|
var _this2 = this;
|
|
5264
|
-
// Cancel all awaiting requests
|
|
5265
|
-
|
|
5264
|
+
// Cancel all awaiting requests, rejecting their promises so no caller
|
|
5265
|
+
// is left awaiting forever
|
|
5266
|
+
var pending = this.sendStack;
|
|
5267
|
+
this.sendStack = [];
|
|
5268
|
+
pending.forEach(function (item) {
|
|
5266
5269
|
if (item.lastTimeoutId) {
|
|
5267
5270
|
clearTimeout(item.lastTimeoutId);
|
|
5268
5271
|
}
|
|
5269
|
-
_this2.
|
|
5272
|
+
_this2.handleEnvelopeSendError(item.data, new Error('Client destroyed'));
|
|
5270
5273
|
});
|
|
5271
|
-
this.sendStack = [];
|
|
5272
5274
|
this.emit(this.Event.destroy, false);
|
|
5273
5275
|
}
|
|
5274
5276
|
}, {
|
|
5275
5277
|
key: "onMessage",
|
|
5276
5278
|
value: function () {
|
|
5277
|
-
var _onMessage = WebApiChatClient_asyncToGenerator(/*#__PURE__*/WebApiChatClient_regenerator().m(function _callee2(
|
|
5278
|
-
var envelope;
|
|
5279
|
+
var _onMessage = WebApiChatClient_asyncToGenerator(/*#__PURE__*/WebApiChatClient_regenerator().m(function _callee2(item, response) {
|
|
5280
|
+
var envelope, _t;
|
|
5279
5281
|
return WebApiChatClient_regenerator().w(function (_context2) {
|
|
5280
|
-
while (1) switch (_context2.n) {
|
|
5282
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
5281
5283
|
case 0:
|
|
5282
|
-
|
|
5284
|
+
_context2.p = 0;
|
|
5283
5285
|
_context2.n = 1;
|
|
5284
5286
|
return response.json();
|
|
5285
5287
|
case 1:
|
|
5286
5288
|
envelope = _context2.v;
|
|
5289
|
+
_context2.n = 3;
|
|
5290
|
+
break;
|
|
5291
|
+
case 2:
|
|
5292
|
+
_context2.p = 2;
|
|
5293
|
+
_t = _context2.v;
|
|
5294
|
+
// Non-envelope response (e.g. a proxy error page) - failed attempt
|
|
5295
|
+
this.onError(item, "envelope ".concat(item.data.ref, " (HTTP ").concat(response.status, ", unparsable body)"));
|
|
5296
|
+
return _context2.a(2);
|
|
5297
|
+
case 3:
|
|
5298
|
+
if (this.removeFromStack(item)) {
|
|
5299
|
+
_context2.n = 4;
|
|
5300
|
+
break;
|
|
5301
|
+
}
|
|
5302
|
+
return _context2.a(2);
|
|
5303
|
+
case 4:
|
|
5287
5304
|
this.handleIncomingEnvelope(envelope);
|
|
5288
5305
|
this.emit(envelope.type, envelope.data);
|
|
5289
5306
|
this.emit(this.Event.message, envelope);
|
|
5290
|
-
case
|
|
5307
|
+
case 5:
|
|
5291
5308
|
return _context2.a(2);
|
|
5292
5309
|
}
|
|
5293
|
-
}, _callee2, this);
|
|
5310
|
+
}, _callee2, this, [[0, 2]]);
|
|
5294
5311
|
}));
|
|
5295
5312
|
function onMessage(_x3, _x4) {
|
|
5296
5313
|
return _onMessage.apply(this, arguments);
|
|
@@ -5299,43 +5316,60 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
5299
5316
|
}()
|
|
5300
5317
|
}, {
|
|
5301
5318
|
key: "onError",
|
|
5302
|
-
value: function onError(
|
|
5319
|
+
value: function onError(item, body) {
|
|
5303
5320
|
var _this$options$attempt,
|
|
5304
5321
|
_this3 = this,
|
|
5305
5322
|
_this$options$attempt2;
|
|
5306
|
-
if (this.sendStack
|
|
5307
|
-
|
|
5308
|
-
|
|
5323
|
+
if (!this.sendStack.includes(item)) {
|
|
5324
|
+
return; // Destroyed in the meantime
|
|
5325
|
+
}
|
|
5326
|
+
if (item.attempts >= ((_this$options$attempt = this.options.attemptsToSend) !== null && _this$options$attempt !== void 0 ? _this$options$attempt : 10)) {
|
|
5327
|
+
this.removeFromStack(item);
|
|
5328
|
+
this.handleEnvelopeSendError(item.data, new Error("Cannot send ".concat(body, "; aborting after reaching the maximum connection errors")));
|
|
5309
5329
|
return;
|
|
5310
5330
|
}
|
|
5311
|
-
|
|
5312
|
-
return _this3.makeApiCall(
|
|
5331
|
+
item.lastTimeoutId = setTimeout(function () {
|
|
5332
|
+
return _this3.makeApiCall(item);
|
|
5313
5333
|
}, (_this$options$attempt2 = this.options.attemptDelayMs) !== null && _this$options$attempt2 !== void 0 ? _this$options$attempt2 : 3000);
|
|
5314
5334
|
}
|
|
5315
5335
|
}, {
|
|
5316
5336
|
key: "makeApiCall",
|
|
5317
|
-
value: function makeApiCall(
|
|
5337
|
+
value: function makeApiCall(item) {
|
|
5318
5338
|
var _this$options$queryPa,
|
|
5319
5339
|
_this4 = this;
|
|
5320
|
-
this.sendStack
|
|
5321
|
-
|
|
5340
|
+
if (!this.sendStack.includes(item)) {
|
|
5341
|
+
return; // Destroyed before this (re)try fired
|
|
5342
|
+
}
|
|
5343
|
+
item.attempts++;
|
|
5344
|
+
item.lastTimeoutId = null;
|
|
5345
|
+
var bodyJson = JSON.stringify(item.data);
|
|
5322
5346
|
var headers = {
|
|
5323
5347
|
'Content-Type': 'application/json',
|
|
5324
5348
|
Accept: 'application/json'
|
|
5325
5349
|
};
|
|
5326
5350
|
headers.Authorization = "Bearer ".concat(this.options.token);
|
|
5327
|
-
var
|
|
5328
|
-
var url = "".concat(this.options.url).concat(
|
|
5351
|
+
var query = new URLSearchParams((_this$options$queryPa = this.options.queryParams) !== null && _this$options$queryPa !== void 0 ? _this$options$queryPa : {}).toString();
|
|
5352
|
+
var url = query ? "".concat(this.options.url, "?").concat(query) : this.options.url;
|
|
5329
5353
|
fetch(url, {
|
|
5330
5354
|
headers: headers,
|
|
5331
5355
|
body: bodyJson,
|
|
5332
5356
|
method: 'POST'
|
|
5333
5357
|
}).then(function (response) {
|
|
5334
|
-
return _this4.onMessage(
|
|
5358
|
+
return _this4.onMessage(item, response);
|
|
5335
5359
|
})["catch"](function () {
|
|
5336
|
-
return _this4.onError(
|
|
5360
|
+
return _this4.onError(item, bodyJson);
|
|
5337
5361
|
});
|
|
5338
5362
|
}
|
|
5363
|
+
}, {
|
|
5364
|
+
key: "removeFromStack",
|
|
5365
|
+
value: function removeFromStack(item) {
|
|
5366
|
+
var index = this.sendStack.indexOf(item);
|
|
5367
|
+
if (index === -1) {
|
|
5368
|
+
return false;
|
|
5369
|
+
}
|
|
5370
|
+
this.sendStack.splice(index, 1);
|
|
5371
|
+
return true;
|
|
5372
|
+
}
|
|
5339
5373
|
}]);
|
|
5340
5374
|
}(AbstractChatClient);
|
|
5341
5375
|
;// ./src/AbstractRestClient.ts
|