polfan-server-js-client 0.1.99927 → 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 (34) hide show
  1. package/.idea/workspace.xml +59 -9
  2. package/build/index.js +31 -20
  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/PermissionsManager.ts +1 -1
  24. package/src/state-tracker/TopicHistoryWindow.ts +7 -1
  25. package/src/types/src/index.ts +14 -0
  26. package/src/types/src/schemes/BanObject.ts +12 -0
  27. package/src/types/src/schemes/LeaveReason.ts +7 -0
  28. package/src/types/src/schemes/commands/Ban.ts +9 -0
  29. package/src/types/src/schemes/commands/GetBans.ts +5 -0
  30. package/src/types/src/schemes/commands/Kick.ts +7 -0
  31. package/src/types/src/schemes/commands/Unban.ts +6 -0
  32. package/src/types/src/schemes/events/Bans.ts +7 -0
  33. package/src/types/src/schemes/events/RoomLeft.ts +3 -0
  34. package/src/types/src/schemes/events/SpaceLeft.ts +3 -0
@@ -4,12 +4,23 @@
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="Permission related changes in protocol types">
8
- <change beforePath="$PROJECT_DIR$/build/types/state-tracker/PermissionsManager.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/state-tracker/PermissionsManager.d.ts" afterDir="false" />
9
- <change beforePath="$PROJECT_DIR$/build/types/types/src/schemes/commands/GetPermissionOverwrites.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/types/src/schemes/commands/GetPermissionOverwrites.d.ts" afterDir="false" />
10
- <change beforePath="$PROJECT_DIR$/build/types/types/src/schemes/commands/SetPermissionOverwrites.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/types/src/schemes/commands/SetPermissionOverwrites.d.ts" afterDir="false" />
11
- <change beforePath="$PROJECT_DIR$/build/types/types/src/schemes/events/PermissionOverwrites.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/types/src/schemes/events/PermissionOverwrites.d.ts" afterDir="false" />
12
- <change beforePath="$PROJECT_DIR$/build/types/types/src/schemes/events/PermissionOverwritesUpdated.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/types/src/schemes/events/PermissionOverwritesUpdated.d.ts" afterDir="false" />
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" />
13
24
  </list>
14
25
  <option name="SHOW_DIALOG" value="false" />
15
26
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -73,7 +84,9 @@
73
84
  <updated>1737999300590</updated>
74
85
  <workItem from="1737999301306" duration="16008000" />
75
86
  <workItem from="1738661852731" duration="2057000" />
76
- <workItem from="1738919042657" duration="3601000" />
87
+ <workItem from="1738919042657" duration="6387000" />
88
+ <workItem from="1739804640466" duration="629000" />
89
+ <workItem from="1740063527512" duration="4753000" />
77
90
  </task>
78
91
  <task id="LOCAL-00001" summary="Emoticons objects">
79
92
  <option name="closed" value="true" />
@@ -171,17 +184,54 @@
171
184
  <option name="project" value="LOCAL" />
172
185
  <updated>1739137397104</updated>
173
186
  </task>
174
- <option name="localTasksCounter" value="13" />
187
+ <task id="LOCAL-00013" summary="Permission related changes in protocol types">
188
+ <option name="closed" value="true" />
189
+ <created>1739184624920</created>
190
+ <option name="number" value="00013" />
191
+ <option name="presentableId" value="LOCAL-00013" />
192
+ <option name="project" value="LOCAL" />
193
+ <updated>1739184624920</updated>
194
+ </task>
195
+ <task id="LOCAL-00014" summary="ClassicText room type">
196
+ <option name="closed" value="true" />
197
+ <created>1739184754443</created>
198
+ <option name="number" value="00014" />
199
+ <option name="presentableId" value="LOCAL-00014" />
200
+ <option name="project" value="LOCAL" />
201
+ <updated>1739184754443</updated>
202
+ </task>
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" />
175
212
  <servers />
176
213
  </component>
177
214
  <component name="TypeScriptGeneratedFilesManager">
178
215
  <option name="version" value="3" />
179
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>
180
228
  <component name="VcsManagerConfiguration">
181
229
  <MESSAGE value="Emoticons objects" />
182
230
  <MESSAGE value="Emoticons support" />
183
231
  <MESSAGE value="Emoticon permissions support" />
184
232
  <MESSAGE value="Permission related changes in protocol types" />
185
- <option name="LAST_COMMIT_MESSAGE" value="Permission related changes in protocol types" />
233
+ <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" />
186
236
  </component>
187
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
@@ -3076,7 +3092,7 @@ function PermissionsManager_toPrimitive(input, hint) { if (PermissionsManager_ty
3076
3092
 
3077
3093
 
3078
3094
  var getOvId = function getOvId(location, target) {
3079
- return [location.spaceId, location.roomId, location.topicId, target.type, target.userId, target.roleId].filter(Boolean).join('/');
3095
+ return [location.spaceId, location.roomId, location.topicId, target === null || target === void 0 ? void 0 : target.type, target === null || target === void 0 ? void 0 : target.userId, target === null || target === void 0 ? void 0 : target.roleId].filter(Boolean).join('/');
3080
3096
  };
3081
3097
  var getOvIdByObject = function getOvIdByObject(overwrites) {
3082
3098
  return getOvId(overwrites.location, overwrites.target);
@@ -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'