@univerjs-pro/collaboration-history-endpoint 1.0.0-rc.0 → 1.0.1
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/README.md +3 -3
- package/README.zh-CN.md +5 -6
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ transport.register(historyEndpoint);
|
|
|
34
34
|
transport.register(collabEndpoint);
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Register authentication first, followed by History Endpoint and the main Collaboration Endpoint. History Endpoint uses the
|
|
37
|
+
Register authentication first, followed by History Endpoint and the main Collaboration Endpoint. History Endpoint uses the `userID` provided by Transport authentication and maps protocol requests to History Service calls. Configure authorization in History Service middleware.
|
|
38
38
|
|
|
39
39
|
## HTTP routes
|
|
40
40
|
|
|
@@ -44,6 +44,6 @@ Register authentication first, followed by History Endpoint and the main Collabo
|
|
|
44
44
|
| `GET` | `/universer-api/history/:unitID/creators` | `listHistoryCreators` | Read history creators |
|
|
45
45
|
| `GET` | `/universer-api/history/:unitID/cs` | `getHistoryChangesets` | Read changesets for history revisions |
|
|
46
46
|
|
|
47
|
-
All three routes call History Service with `ctx.userID/customData` set by Transport middleware for the current HTTP request and enter the corresponding History Service middleware.
|
|
47
|
+
All three routes call History Service with `ctx.userID/customData` set by Transport middleware for the current HTTP request and enter the corresponding History Service middleware.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Transport disposes the Endpoint. The application manages History Service and its Database Adapter.
|
package/README.zh-CN.md
CHANGED
|
@@ -35,9 +35,9 @@ transport.register(historyEndpoint);
|
|
|
35
35
|
transport.register(collabEndpoint);
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
先注册认证,再注册 History Endpoint 和主协同 Endpoint。History Endpoint
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
先注册认证,再注册 History Endpoint 和主协同 Endpoint。History Endpoint 使用 Transport
|
|
39
|
+
认证提供的 `userID`,将协议请求映射为 History Service 调用。权限校验配置在 History
|
|
40
|
+
Service middleware 中。
|
|
41
41
|
|
|
42
42
|
## HTTP 路由
|
|
43
43
|
|
|
@@ -48,7 +48,6 @@ History 存储或分段策略。
|
|
|
48
48
|
| `GET` | `/universer-api/history/:unitID/cs` | `getHistoryChangesets` | 读取历史 revision 对应的 changesets |
|
|
49
49
|
|
|
50
50
|
三条路由都使用当前 HTTP 请求由 Transport middleware 设置的 `ctx.userID/customData`,并
|
|
51
|
-
进入对应 History Service middleware
|
|
51
|
+
进入对应 History Service middleware。
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
Endpoint;释放 Endpoint 不会释放 History Service 或 Database Adapter。
|
|
53
|
+
Transport 负责释放 Endpoint,应用管理 History Service 和 Database Adapter。
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration-service'),t=require('@univerjs-pro/collaboration-transport-node'),n=require('@univerjs/protocol');var r={'code':n['ErrorCode']['OK'],'message':''},i=class{['_service'];['_disposed']=!0x1;constructor(
|
|
1
|
+
Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration-service'),t=require('@univerjs-pro/collaboration-transport-node'),n=require('@univerjs/protocol');var r={'code':n['ErrorCode']['OK'],'message':''},i=class{['_service'];['_disposed']=!0x1;constructor(_0x33c768){if(this['_service']=_0x33c768,!_0x33c768)throw TypeError('UniverHistoryEndpoint\x20requires\x20a\x20service');}['register'](_0x1ed33b){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');for(let [_0x4400c7,_0x1d8086]of[['list','list'],['creators','creators'],['cs','changesets']])_0x1ed33b['get']('/universer-api/history/:unitID/'+_0x4400c7,_0x3cae7f=>this['_handleHttp'](_0x3cae7f,{'name':_0x1d8086,'unitID':_0x3cae7f['params']['unitID']}));}async['_handleHttp'](_0x422b8e,_0x34df90){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');let _0x52df9d=new URL(_0x422b8e['incomingMessage']['url']??'/','http://localhost');if(!_0x422b8e['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');let _0x5d0588={'userID':_0x422b8e['userID'],'customData':_0x422b8e['customData']};switch(_0x34df90['name']){case'list':{let _0x2afa14=await this['_service']['getHistoryList']({'unitID':_0x34df90['unitID'],'length':o(_0x52df9d['searchParams']['get']('length')),..._0x52df9d['searchParams']['get']('lastLabel')?{'lastLabel':_0x52df9d['searchParams']['get']('lastLabel')}:{},...c(_0x52df9d['searchParams']['get']('origin')),'userIDs':_0x52df9d['searchParams']['getAll']('userIds')['filter'](Boolean)},_0x5d0588);d(_0x422b8e['response'],0xc8,{'error':r,...a(_0x2afa14)});return;}case'creators':{let _0xeb5c97=await this['_service']['listHistoryCreators']({'unitID':_0x34df90['unitID']},_0x5d0588);d(_0x422b8e['response'],0xc8,{'error':r,'creators':_0xeb5c97['creators']['map'](({userID:_0x37000d,..._0x4fcfce})=>({..._0x4fcfce,'userId':_0x37000d}))});return;}case'changesets':{let _0x38d3ce=s(_0x52df9d['searchParams']['get']('startRevision'),'startRevision'),_0x4e238d=s(_0x52df9d['searchParams']['get']('endRevision'),'endRevision'),_0x1f46ed=await this['_service']['getHistoryChangesets']({'unitID':_0x34df90['unitID'],'startRevision':_0x38d3ce,'endRevision':_0x4e238d},_0x5d0588);d(_0x422b8e['response'],0xc8,{'error':r,..._0x1f46ed});return;}}}catch(_0x554ac1){l(_0x422b8e['response'],_0x554ac1);}}['dispose'](){this['_disposed']=!0x0;}};function a(_0x3e1de5){let _0x2011ca=Object['fromEntries'](Object['entries'](_0x3e1de5['entities']['datas'])['map'](([_0x208f28,{userID:_0x292af2,unitID:_0x54b6c8,userIDs:_0x488f34,..._0x1067f5}])=>[_0x208f28,{..._0x1067f5,'userId':_0x292af2,'unitId':_0x54b6c8,'userIds':_0x488f34}]));return{..._0x3e1de5,'entities':{..._0x3e1de5['entities'],'datas':_0x2011ca}};}function o(_0x16b9e6){return _0x16b9e6===null||_0x16b9e6===''?0x14:s(_0x16b9e6,'length');}function s(_0x5c33b1,_0x120f1d){if(!_0x5c33b1||!/^\d+$/['test'](_0x5c33b1))throw new e['CollabError']('INVALID_REQUEST',_0x120f1d+'\x20must\x20be\x20a\x20positive\x20integer');let _0x188d22=Number(_0x5c33b1);if(!Number['isSafeInteger'](_0x188d22)||_0x188d22<0x1)throw new e['CollabError']('INVALID_REQUEST',_0x120f1d+'\x20must\x20be\x20a\x20positive\x20integer');return _0x188d22;}function c(_0x1596d8){if(_0x1596d8===null||_0x1596d8===''||_0x1596d8==='0')return{};if(_0x1596d8==='1'||_0x1596d8==='2')return{'origin':Number(_0x1596d8)};throw new e['CollabError']('INVALID_REQUEST','origin\x20must\x20be\x200,\x201\x20or\x202');}function l(_0x19fca6,_0x4b425d){let _0x17078e=u(_0x4b425d);d(_0x19fca6,_0x17078e['status'],{'error':_0x17078e['error']});}function u(_0x2bdc88){if(_0x2bdc88 instanceof t['NodeTransportError'])return{'status':_0x2bdc88['code']==='REQUEST_BODY_TOO_LARGE'?0x19d:_0x2bdc88['code']==='TRANSPORT_DISPOSED'?0x1f7:0x190,'error':{'code':_0x2bdc88['code']==='TRANSPORT_DISPOSED'?n['ErrorCode']['INTERNAL_ERROR']:n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x2bdc88['message']}};if(!(_0x2bdc88 instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20server\x20error'}};let _0x43f70b={'UNAUTHENTICATED':{'status':0x191,'code':n['ErrorCode']['UNAUTHENTICATED']},'INVALID_REQUEST':{'status':0x190,'code':n['ErrorCode']['INVALID_ARGUMENT']},'UNIT_NOT_FOUND':{'status':0x194,'code':n['ErrorCode']['NOT_FOUND']},'PERMISSION_DENIED':{'status':0x193,'code':n['ErrorCode']['PERMISSION_DENIED']},'OT_CONFLICT':{'status':0x199,'code':n['ErrorCode']['APPLY_REJECT']},'REVISION_MISMATCH':{'status':0x199,'code':n['ErrorCode']['CHANGESET_REVISION_CONFILICT']},'ADAPTER_FAILURE':{'status':0x1f7,'code':n['ErrorCode']['INTERNAL_ERROR']},'INTERNAL_ERROR':{'status':0x1f4,'code':n['ErrorCode']['INTERNAL_ERROR']}}[_0x2bdc88['code']];return{'status':_0x43f70b['status'],'error':{'code':_0x43f70b['code'],'message':_0x2bdc88['message']}};}function d(_0x4ae129,_0x5550ae,_0x38715c){_0x4ae129['writableEnded']||_0x4ae129['destroyed']||(_0x4ae129['statusCode']=_0x5550ae,_0x4ae129['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x4ae129['end'](JSON['stringify'](_0x38715c)));}exports['UniverHistoryEndpoint']=i;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x34c7a3=_0x5711;(function(_0x5a209d,_0x1fef61){const _0x54a737=_0x5711,_0x2ab9a6=_0x5a209d();while(!![]){try{const _0x4a6cde=parseInt(_0x54a737(0x137))/0x1+-parseInt(_0x54a737(0x136))/0x2*(-parseInt(_0x54a737(0x135))/0x3)+-parseInt(_0x54a737(0x13e))/0x4+parseInt(_0x54a737(0x13a))/0x5*(-parseInt(_0x54a737(0x13c))/0x6)+parseInt(_0x54a737(0x134))/0x7*(-parseInt(_0x54a737(0x13b))/0x8)+parseInt(_0x54a737(0x13d))/0x9+-parseInt(_0x54a737(0x138))/0xa*(parseInt(_0x54a737(0x139))/0xb);if(_0x4a6cde===_0x1fef61)break;else _0x2ab9a6['push'](_0x2ab9a6['shift']());}catch(_0x3a17a2){_0x2ab9a6['push'](_0x2ab9a6['shift']());}}}(_0x49f7,0xe711c));function _0x49f7(){const _0x5e7687=['UniverHistoryEndpoint','14knkhcL','15XuFodS','374390isXUGV','1366483qmlTwg','69790KjFwKH','2189Umkfme','5356240cTmlPa','2567208ZBCtSe','6IPeSRB','16590861UAXSXx','390224hqoXlp'];_0x49f7=function(){return _0x5e7687;};return _0x49f7();}function _0x5711(_0x473953,_0x15e645){_0x473953=_0x473953-0x133;const _0x49f7be=_0x49f7();let _0x57119c=_0x49f7be[_0x473953];return _0x57119c;}import _0x374c93 from'./index.cjs';const facadeExport0=_0x374c93[_0x34c7a3(0x133)];export{facadeExport0 as UniverHistoryEndpoint};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs-pro/collaboration-history-endpoint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/collaboration-history-service": "1.0.
|
|
20
|
-
"@univerjs-pro/collaboration-service": "1.0.
|
|
21
|
-
"@univerjs-pro/collaboration-transport-node": "1.0.
|
|
22
|
-
"@univerjs/protocol": "1.0.
|
|
19
|
+
"@univerjs-pro/collaboration-history-service": "1.0.1",
|
|
20
|
+
"@univerjs-pro/collaboration-service": "1.0.1",
|
|
21
|
+
"@univerjs-pro/collaboration-transport-node": "1.0.1",
|
|
22
|
+
"@univerjs/protocol": "1.0.1"
|
|
23
23
|
}
|
|
24
24
|
}
|