polfan-server-js-client 0.1.99928 → 0.1.99929

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.
Files changed (33) hide show
  1. package/.idea/workspace.xml +43 -4
  2. package/build/index.js +30 -19
  3. package/build/index.js.map +1 -1
  4. package/build/types/AbstractChatClient.d.ts +6 -1
  5. package/build/types/Permissions.d.ts +8 -0
  6. package/build/types/WebApiChatClient.d.ts +2 -2
  7. package/build/types/WebSocketChatClient.d.ts +2 -2
  8. package/build/types/types/src/index.d.ts +8 -1
  9. package/build/types/types/src/schemes/BanObject.d.ts +11 -0
  10. package/build/types/types/src/schemes/LeaveReason.d.ts +6 -0
  11. package/build/types/types/src/schemes/commands/Ban.d.ts +8 -0
  12. package/build/types/types/src/schemes/commands/GetBans.d.ts +4 -0
  13. package/build/types/types/src/schemes/commands/Kick.d.ts +6 -0
  14. package/build/types/types/src/schemes/commands/Unban.d.ts +5 -0
  15. package/build/types/types/src/schemes/events/Bans.d.ts +6 -0
  16. package/build/types/types/src/schemes/events/RoomLeft.d.ts +2 -0
  17. package/build/types/types/src/schemes/events/SpaceLeft.d.ts +2 -0
  18. package/package.json +1 -1
  19. package/src/AbstractChatClient.ts +6 -1
  20. package/src/Permissions.ts +2 -0
  21. package/src/WebApiChatClient.ts +7 -11
  22. package/src/WebSocketChatClient.ts +7 -7
  23. package/src/state-tracker/TopicHistoryWindow.ts +7 -1
  24. package/src/types/src/index.ts +14 -0
  25. package/src/types/src/schemes/BanObject.ts +12 -0
  26. package/src/types/src/schemes/LeaveReason.ts +7 -0
  27. package/src/types/src/schemes/commands/Ban.ts +9 -0
  28. package/src/types/src/schemes/commands/GetBans.ts +5 -0
  29. package/src/types/src/schemes/commands/Kick.ts +7 -0
  30. package/src/types/src/schemes/commands/Unban.ts +6 -0
  31. package/src/types/src/schemes/events/Bans.ts +7 -0
  32. package/src/types/src/schemes/events/RoomLeft.ts +3 -0
  33. package/src/types/src/schemes/events/SpaceLeft.ts +3 -0
@@ -4,7 +4,24 @@
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="ClassicText room type" />
7
+ <list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Restore support for nullable parameter in permission overwrites id function">
8
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/BanObject.ts" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/LeaveReason.ts" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/Ban.ts" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/GetBans.ts" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/Kick.ts" afterDir="false" />
13
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/Unban.ts" afterDir="false" />
14
+ <change afterPath="$PROJECT_DIR$/src/types/src/schemes/events/Bans.ts" afterDir="false" />
15
+ <change beforePath="$PROJECT_DIR$/src/AbstractChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/AbstractChatClient.ts" afterDir="false" />
16
+ <change beforePath="$PROJECT_DIR$/src/Permissions.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/Permissions.ts" afterDir="false" />
17
+ <change beforePath="$PROJECT_DIR$/src/WebApiChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/WebApiChatClient.ts" afterDir="false" />
18
+ <change beforePath="$PROJECT_DIR$/src/WebSocketChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/WebSocketChatClient.ts" afterDir="false" />
19
+ <change beforePath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" afterDir="false" />
20
+ <change beforePath="$PROJECT_DIR$/src/types" beforeDir="false" afterPath="$PROJECT_DIR$/src/types" afterDir="false" />
21
+ <change beforePath="$PROJECT_DIR$/src/types/src/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/index.ts" afterDir="false" />
22
+ <change beforePath="$PROJECT_DIR$/src/types/src/schemes/events/RoomLeft.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/events/RoomLeft.ts" afterDir="false" />
23
+ <change beforePath="$PROJECT_DIR$/src/types/src/schemes/events/SpaceLeft.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/events/SpaceLeft.ts" afterDir="false" />
24
+ </list>
8
25
  <option name="SHOW_DIALOG" value="false" />
9
26
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
27
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -67,7 +84,9 @@
67
84
  <updated>1737999300590</updated>
68
85
  <workItem from="1737999301306" duration="16008000" />
69
86
  <workItem from="1738661852731" duration="2057000" />
70
- <workItem from="1738919042657" duration="4889000" />
87
+ <workItem from="1738919042657" duration="6387000" />
88
+ <workItem from="1739804640466" duration="629000" />
89
+ <workItem from="1740063527512" duration="4753000" />
71
90
  </task>
72
91
  <task id="LOCAL-00001" summary="Emoticons objects">
73
92
  <option name="closed" value="true" />
@@ -181,18 +200,38 @@
181
200
  <option name="project" value="LOCAL" />
182
201
  <updated>1739184754443</updated>
183
202
  </task>
184
- <option name="localTasksCounter" value="15" />
203
+ <task id="LOCAL-00015" summary="Restore support for nullable parameter in permission overwrites id function">
204
+ <option name="closed" value="true" />
205
+ <created>1739444617033</created>
206
+ <option name="number" value="00015" />
207
+ <option name="presentableId" value="LOCAL-00015" />
208
+ <option name="project" value="LOCAL" />
209
+ <updated>1739444617033</updated>
210
+ </task>
211
+ <option name="localTasksCounter" value="16" />
185
212
  <servers />
186
213
  </component>
187
214
  <component name="TypeScriptGeneratedFilesManager">
188
215
  <option name="version" value="3" />
189
216
  </component>
217
+ <component name="Vcs.Log.Tabs.Properties">
218
+ <option name="TAB_STATES">
219
+ <map>
220
+ <entry key="MAIN">
221
+ <value>
222
+ <State />
223
+ </value>
224
+ </entry>
225
+ </map>
226
+ </option>
227
+ </component>
190
228
  <component name="VcsManagerConfiguration">
191
229
  <MESSAGE value="Emoticons objects" />
192
230
  <MESSAGE value="Emoticons support" />
193
231
  <MESSAGE value="Emoticon permissions support" />
194
232
  <MESSAGE value="Permission related changes in protocol types" />
195
233
  <MESSAGE value="ClassicText room type" />
196
- <option name="LAST_COMMIT_MESSAGE" value="ClassicText room type" />
234
+ <MESSAGE value="Restore support for nullable parameter in permission overwrites id function" />
235
+ <option name="LAST_COMMIT_MESSAGE" value="Restore support for nullable parameter in permission overwrites id function" />
197
236
  </component>
198
237
  </project>
package/build/index.js CHANGED
@@ -1010,7 +1010,15 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
1010
1010
  }, {
1011
1011
  key: "handleSession",
1012
1012
  value: function handleSession(ev) {
1013
- this.resetToLatest();
1013
+ var _this3 = this;
1014
+ var rooms = ev.state.rooms;
1015
+ if (rooms.find(function (room) {
1016
+ return room.id === _this3.roomId;
1017
+ })) {
1018
+ this.resetToLatest();
1019
+ } else {
1020
+ this.deleteAll();
1021
+ }
1014
1022
  }
1015
1023
  }, {
1016
1024
  key: "fetchItemsAfter",
@@ -3038,6 +3046,14 @@ Permissions_defineProperty(Permissions, "list", {
3038
3046
  ManageEmoticon: {
3039
3047
  value: 1 << 14,
3040
3048
  maxLayer: Layer.Space
3049
+ },
3050
+ ManageBan: {
3051
+ value: 1 << 15,
3052
+ maxLayer: Layer.Room
3053
+ },
3054
+ Kick: {
3055
+ value: 1 << 16,
3056
+ maxLayer: Layer.Room
3041
3057
  }
3042
3058
  });
3043
3059
  ;// CONCATENATED MODULE: ./src/state-tracker/PermissionsManager.ts
@@ -3943,9 +3959,6 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
3943
3959
  WebSocketChatClient_defineProperty(WebSocketChatClient_assertThisInitialized(_this), "connectingTimeoutId", void 0);
3944
3960
  WebSocketChatClient_defineProperty(WebSocketChatClient_assertThisInitialized(_this), "authenticated", void 0);
3945
3961
  WebSocketChatClient_defineProperty(WebSocketChatClient_assertThisInitialized(_this), "authenticatedResolvers", void 0);
3946
- if (!_this.options.token && !_this.options.temporaryNick) {
3947
- throw new Error('Token or temporary nick is required');
3948
- }
3949
3962
  if ((_this$options$stateTr = _this.options.stateTracking) !== null && _this$options$stateTr !== void 0 ? _this$options$stateTr : true) {
3950
3963
  _this.state = new ChatStateTracker(WebSocketChatClient_assertThisInitialized(_this));
3951
3964
  }
@@ -3955,15 +3968,17 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
3955
3968
  key: "connect",
3956
3969
  value: function () {
3957
3970
  var _connect = WebSocketChatClient_asyncToGenerator( /*#__PURE__*/WebSocketChatClient_regeneratorRuntime().mark(function _callee() {
3958
- var _this2 = this,
3971
+ var _this$options$queryPa,
3972
+ _this2 = this,
3959
3973
  _this$options$connect;
3960
- var authString;
3974
+ var params;
3961
3975
  return WebSocketChatClient_regeneratorRuntime().wrap(function _callee$(_context) {
3962
3976
  while (1) {
3963
3977
  switch (_context.prev = _context.next) {
3964
3978
  case 0:
3965
- authString = this.options.token ? "token=".concat(this.options.token) : "nick=".concat(this.options.temporaryNick);
3966
- this.ws = new WebSocket("".concat(this.options.url, "?").concat(authString));
3979
+ params = new URLSearchParams((_this$options$queryPa = this.options.queryParams) !== null && _this$options$queryPa !== void 0 ? _this$options$queryPa : {});
3980
+ params.set('token', this.options.token);
3981
+ this.ws = new WebSocket("".concat(this.options.url, "?").concat(params));
3967
3982
  this.ws.onclose = function (ev) {
3968
3983
  return _this2.onClose(ev);
3969
3984
  };
@@ -3980,7 +3995,7 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
3980
3995
  }
3981
3996
  return _this2.authenticatedResolvers = args;
3982
3997
  }));
3983
- case 7:
3998
+ case 8:
3984
3999
  case "end":
3985
4000
  return _context.stop();
3986
4001
  }
@@ -4144,9 +4159,6 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
4144
4159
  _this.options = options;
4145
4160
  WebApiChatClient_defineProperty(WebApiChatClient_assertThisInitialized(_this), "Event", WebApiChatClientEvent);
4146
4161
  WebApiChatClient_defineProperty(WebApiChatClient_assertThisInitialized(_this), "sendStack", void 0);
4147
- if (!_this.options.token && !_this.options.temporaryNick) {
4148
- throw new Error('Token or temporary nick is required');
4149
- }
4150
4162
  return _this;
4151
4163
  }
4152
4164
  WebApiChatClient_createClass(WebApiChatClient, [{
@@ -4239,19 +4251,18 @@ var WebApiChatClient = /*#__PURE__*/function (_AbstractChatClient) {
4239
4251
  }, {
4240
4252
  key: "makeApiCall",
4241
4253
  value: function makeApiCall(reqId) {
4242
- var _this4 = this;
4254
+ var _this$options$queryPa,
4255
+ _this4 = this;
4243
4256
  this.sendStack[reqId].attempts++;
4244
4257
  var bodyJson = JSON.stringify(this.sendStack[reqId].data);
4245
4258
  var headers = {
4246
4259
  'Content-Type': 'application/json',
4247
4260
  Accept: 'application/json'
4248
4261
  };
4249
- if (this.options.token) {
4250
- headers.Authorization = "Bearer ".concat(this.options.token);
4251
- } else if (this.options.temporaryNick) {
4252
- headers.Authorization = "Temp ".concat(this.options.temporaryNick);
4253
- }
4254
- fetch(this.options.url, {
4262
+ headers.Authorization = "Bearer ".concat(this.options.token);
4263
+ var params = new URLSearchParams((_this$options$queryPa = this.options.queryParams) !== null && _this$options$queryPa !== void 0 ? _this$options$queryPa : {});
4264
+ var url = "".concat(this.options.url).concat(params ? '?' + params : '');
4265
+ fetch(url, {
4255
4266
  headers: headers,
4256
4267
  body: bodyJson,
4257
4268
  method: 'POST'