@seafile/sdoc-editor 2.0.211 → 2.0.212

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.
@@ -21,6 +21,10 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
21
21
  _this.socket.on('connect', _this.onConnected);
22
22
  _this.socket.on('disconnect', _this.onDisconnected);
23
23
  _this.socket.on('connect_error', _this.onConnectError);
24
+ _this.socket.on('token-expired', function () {
25
+ var socketManager = _socketManager3["default"].getInstance();
26
+ socketManager.dispatchConnectState('token_expired');
27
+ });
24
28
  _this.socket.on('join-room', _this.onJoinRoom);
25
29
  _this.socket.on('leave-room', _this.onLeaveRoom);
26
30
  _this.socket.on('user-updated', _this.onUserUpdated);
@@ -114,10 +118,11 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
114
118
  socketManager.dispatchConnectState('disconnect');
115
119
  });
116
120
  (0, _defineProperty2["default"])(this, "onConnectError", function (error) {
121
+ var _error$data;
117
122
  (0, _debug.clientDebug)('connect_error. %s', error.message);
118
123
  (0, _debug.clientDebug)('connect_error. %s', error.type);
119
124
  (0, _debug.clientDebug)('connect_error. %O', error.context);
120
- if (error.message === 'jwt expired') {
125
+ if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === 'token_expired' || error.message === 'jwt expired') {
121
126
  var _socketManager2 = _socketManager3["default"].getInstance();
122
127
  _socketManager2.dispatchConnectState('token_expired');
123
128
  return;
@@ -233,6 +238,9 @@ var SocketClient = /*#__PURE__*/(0, _createClass2["default"])(function SocketCli
233
238
  }, function (result) {
234
239
  if (result.success) {
235
240
  socketManager.onGetRecentOperations(result);
241
+ } else {
242
+ var errorType = result.error_type === 'token_expired' ? 'token_expired' : 'sync_server_operations_error';
243
+ socketManager.dispatchConnectState(errorType);
236
244
  }
237
245
  });
238
246
  });
@@ -112,7 +112,8 @@ var SocketManager = /*#__PURE__*/(0, _createClass2["default"])(function SocketMa
112
112
  }
113
113
 
114
114
  // Operations are execute failure
115
- var error_type = result.error_type;
115
+ var _ref = result || {},
116
+ error_type = _ref.error_type;
116
117
  if (error_type === 'load_document_content_error' || error_type === 'save_operations_to_database_error' || error_type === 'token_expired') {
117
118
  // load_document_content_error: After a short-term reconnection, the content of the document fails to load
118
119
  // save_operation_to_database_error: Save operation to database error
@@ -147,6 +148,10 @@ var SocketManager = /*#__PURE__*/(0, _createClass2["default"])(function SocketMa
147
148
  _this._sendingOperations = null;
148
149
  _this.sendNextOperations();
149
150
  });
151
+ } else {
152
+ _this.state = STATE.NEED_RELOAD;
153
+ _this._sendingOperations = null;
154
+ _this.dispatchConnectState('sync_server_operations_error');
150
155
  }
151
156
  });
152
157
  (0, _defineProperty2["default"])(this, "onReceiveRemoteOperations", function (params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.211",
3
+ "version": "2.0.212",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -70,6 +70,5 @@
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public"
73
- },
74
- "gitHead": "0012aa81d40fe7abc7aa0592421d26dc1a12eae8"
73
+ }
75
74
  }
package/LICENSE.txt DELETED
@@ -1,13 +0,0 @@
1
- Copyright (c) 2025 Seafile Ltd.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.