@univerjs-pro/collaboration-history-endpoint 1.3.0 → 1.4.0
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 +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -30,11 +30,11 @@ const historyEndpoint = new UniverHistoryEndpoint(historyService);
|
|
|
30
30
|
const collabEndpoint = new UniverCollabEndpoint(collabService);
|
|
31
31
|
|
|
32
32
|
transport.use(authenticationMiddleware);
|
|
33
|
-
transport.register(historyEndpoint);
|
|
34
33
|
transport.register(collabEndpoint);
|
|
34
|
+
transport.register(historyEndpoint);
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Register authentication first, followed by
|
|
37
|
+
Register authentication first, followed by the main Collaboration Endpoint and History 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
|
|
package/README.zh-CN.md
CHANGED
|
@@ -31,11 +31,11 @@ const historyEndpoint = new UniverHistoryEndpoint(historyService);
|
|
|
31
31
|
const collabEndpoint = new UniverCollabEndpoint(collabService);
|
|
32
32
|
|
|
33
33
|
transport.use(authenticationMiddleware);
|
|
34
|
-
transport.register(historyEndpoint);
|
|
35
34
|
transport.register(collabEndpoint);
|
|
35
|
+
transport.register(historyEndpoint);
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
先注册认证,再注册主协同 Endpoint 和 History Endpoint。History Endpoint 使用 Transport
|
|
39
39
|
认证提供的 `userID`,将协议请求映射为 History Service 调用。权限校验配置在 History
|
|
40
40
|
Service middleware 中。
|
|
41
41
|
|
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(_0x2292cd){if(this['_service']=_0x2292cd,!_0x2292cd)throw TypeError('UniverHistoryEndpoint\x20requires\x20a\x20service');}['register'](_0x43da41){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');for(let [_0xd68b09,_0xf56e6e]of[['list','list'],['creators','creators'],['cs','changesets']])_0x43da41['get']('/universer-api/history/:unitID/'+_0xd68b09,_0x2518b7=>this['_handleHttp'](_0x2518b7,{'name':_0xf56e6e,'unitID':_0x2518b7['params']['unitID']}));}async['_handleHttp'](_0x48bce7,_0x530dcd){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');let _0x3c6b83=new URL(_0x48bce7['incomingMessage']['url']??'/','http://localhost');if(!_0x48bce7['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');let _0x186299={'userID':_0x48bce7['userID'],'customData':_0x48bce7['customData']};switch(_0x530dcd['name']){case'list':{let _0x945e01=await this['_service']['getHistoryList']({'unitID':_0x530dcd['unitID'],'length':o(_0x3c6b83['searchParams']['get']('length')),..._0x3c6b83['searchParams']['get']('lastLabel')?{'lastLabel':_0x3c6b83['searchParams']['get']('lastLabel')}:{},...c(_0x3c6b83['searchParams']['get']('origin')),'userIDs':_0x3c6b83['searchParams']['getAll']('userIds')['filter'](Boolean)},_0x186299);d(_0x48bce7['response'],0xc8,{'error':r,...a(_0x945e01)});return;}case'creators':{let _0x2a55b9=await this['_service']['listHistoryCreators']({'unitID':_0x530dcd['unitID']},_0x186299);d(_0x48bce7['response'],0xc8,{'error':r,'creators':_0x2a55b9['creators']['map'](({userID:_0x5bfe15,..._0x27c06d})=>({..._0x27c06d,'userId':_0x5bfe15}))});return;}case'changesets':{let _0x283d44=s(_0x3c6b83['searchParams']['get']('startRevision'),'startRevision'),_0x1e579f=s(_0x3c6b83['searchParams']['get']('endRevision'),'endRevision'),_0x2bee80=await this['_service']['getHistoryChangesets']({'unitID':_0x530dcd['unitID'],'startRevision':_0x283d44,'endRevision':_0x1e579f},_0x186299);d(_0x48bce7['response'],0xc8,{'error':r,..._0x2bee80});return;}}}catch(_0x4d9872){l(_0x48bce7['response'],_0x4d9872);}}['dispose'](){this['_disposed']=!0x0;}};function a(_0x1ec3d0){let _0x85bf97=Object['fromEntries'](Object['entries'](_0x1ec3d0['entities']['datas'])['map'](([_0x82acf8,{userID:_0x1c7886,unitID:_0xa80650,userIDs:_0x1905ec,..._0x3cca1d}])=>[_0x82acf8,{..._0x3cca1d,'userId':_0x1c7886,'unitId':_0xa80650,'userIds':_0x1905ec}]));return{..._0x1ec3d0,'entities':{..._0x1ec3d0['entities'],'datas':_0x85bf97}};}function o(_0x37c13c){return _0x37c13c===null||_0x37c13c===''?0x14:s(_0x37c13c,'length');}function s(_0x1ec7dd,_0x21639f){if(!_0x1ec7dd||!/^\d+$/['test'](_0x1ec7dd))throw new e['CollabError']('INVALID_REQUEST',_0x21639f+'\x20must\x20be\x20a\x20positive\x20integer');let _0x110a75=Number(_0x1ec7dd);if(!Number['isSafeInteger'](_0x110a75)||_0x110a75<0x1)throw new e['CollabError']('INVALID_REQUEST',_0x21639f+'\x20must\x20be\x20a\x20positive\x20integer');return _0x110a75;}function c(_0x55bc84){if(_0x55bc84===null||_0x55bc84===''||_0x55bc84==='0')return{};if(_0x55bc84==='1'||_0x55bc84==='2')return{'origin':Number(_0x55bc84)};throw new e['CollabError']('INVALID_REQUEST','origin\x20must\x20be\x200,\x201\x20or\x202');}function l(_0x104d91,_0x5db234){let _0x595ab1=u(_0x5db234);d(_0x104d91,_0x595ab1['status'],{'error':_0x595ab1['error']});}function u(_0x214d0a){if(_0x214d0a instanceof t['NodeTransportError'])return{'status':_0x214d0a['code']==='REQUEST_BODY_TOO_LARGE'?0x19d:_0x214d0a['code']==='TRANSPORT_DISPOSED'?0x1f7:0x190,'error':{'code':_0x214d0a['code']==='TRANSPORT_DISPOSED'?n['ErrorCode']['INTERNAL_ERROR']:n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x214d0a['message']}};if(!(_0x214d0a instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20server\x20error'}};let _0x4f31ff={'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']},'LICENSE_INVALID':{'status':0x1f4,'code':n['ErrorCode']['LICENSE_INVALID']},'LICENSE_POLICY_INVALID':{'status':0x1f4,'code':n['ErrorCode']['LICENSE_POLICY_INVALID']},'LICENSE_VERSION_NOT_ALLOWED':{'status':0x1f4,'code':n['ErrorCode']['LICENSE_VERSION_NOT_ALLOWED']},'LICENSE_UNIT_TYPE_REJECTED':{'status':0x193,'code':n['ErrorCode']['LICENSE_UNIT_TYPE_REJECTED']},'LICENSE_DOMAIN_REJECTED':{'status':0x193,'code':n['ErrorCode']['LICENSE_DOMAIN_REJECTED']}}[_0x214d0a['code']];return{'status':_0x4f31ff['status'],'error':{'code':_0x4f31ff['code'],'message':_0x214d0a['message']}};}function d(_0x1f00d1,_0x23b56d,_0x14f0c5){_0x1f00d1['writableEnded']||_0x1f00d1['destroyed']||(_0x1f00d1['statusCode']=_0x23b56d,_0x1f00d1['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x1f00d1['end'](JSON['stringify'](_0x14f0c5)));}exports['UniverHistoryEndpoint']=i;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const _0xb741a2=_0x34f2;(function(_0x45f30d,_0x5b9af8){const _0x5bc6bd=_0x34f2,_0x3796bf=_0x45f30d();while(!![]){try{const _0x5d293c=-parseInt(_0x5bc6bd(0x177))/0x1*(parseInt(_0x5bc6bd(0x17a))/0x2)+-parseInt(_0x5bc6bd(0x176))/0x3+-parseInt(_0x5bc6bd(0x175))/0x4*(-parseInt(_0x5bc6bd(0x174))/0x5)+parseInt(_0x5bc6bd(0x17c))/0x6+-parseInt(_0x5bc6bd(0x17b))/0x7*(-parseInt(_0x5bc6bd(0x173))/0x8)+-parseInt(_0x5bc6bd(0x17d))/0x9*(-parseInt(_0x5bc6bd(0x179))/0xa)+-parseInt(_0x5bc6bd(0x178))/0xb;if(_0x5d293c===_0x5b9af8)break;else _0x3796bf['push'](_0x3796bf['shift']());}catch(_0x3cfcd9){_0x3796bf['push'](_0x3796bf['shift']());}}}(_0x2f17,0xbe1a0));import _0x2e9aa2 from'./index.cjs';const facadeExport0=_0x2e9aa2[_0xb741a2(0x17e)];function _0x34f2(_0x67cf1e,_0x4ed1a9){_0x67cf1e=_0x67cf1e-0x173;const _0x2f1759=_0x2f17();let _0x34f275=_0x2f1759[_0x67cf1e];return _0x34f275;}function _0x2f17(){const _0x765ed1=['113180BKcpaS','1834HgtDGn','7582638TrUpGG','9nGLkvl','UniverHistoryEndpoint','46776zSJvgO','30XImHek','516932aOfAGM','3062982IxGhOG','1PKIZdm','27914062AWuYjs','8227970vVOdSN'];_0x2f17=function(){return _0x765ed1;};return _0x2f17();}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.
|
|
4
|
+
"version": "1.4.0",
|
|
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.
|
|
20
|
-
"@univerjs-pro/collaboration-service": "1.
|
|
21
|
-
"@univerjs-pro/collaboration-transport-node": "1.
|
|
22
|
-
"@univerjs/protocol": "1.
|
|
19
|
+
"@univerjs-pro/collaboration-history-service": "1.4.0",
|
|
20
|
+
"@univerjs-pro/collaboration-service": "1.4.0",
|
|
21
|
+
"@univerjs-pro/collaboration-transport-node": "1.4.0",
|
|
22
|
+
"@univerjs/protocol": "1.4.0"
|
|
23
23
|
}
|
|
24
24
|
}
|