@univerjs-pro/collaboration-history-endpoint 1.3.1 → 1.5.2

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 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 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.
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
- 先注册认证,再注册 History Endpoint 和主协同 Endpoint。History Endpoint 使用 Transport
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(_0x264a02){if(this['_service']=_0x264a02,!_0x264a02)throw TypeError('UniverHistoryEndpoint\x20requires\x20a\x20service');}['register'](_0x256823){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');for(let [_0x2bdc63,_0x513812]of[['list','list'],['creators','creators'],['cs','changesets']])_0x256823['get']('/universer-api/history/:unitID/'+_0x2bdc63,_0x2401e1=>this['_handleHttp'](_0x2401e1,{'name':_0x513812,'unitID':_0x2401e1['params']['unitID']}));}async['_handleHttp'](_0x346509,_0x4a638a){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');let _0x1709cb=new URL(_0x346509['incomingMessage']['url']??'/','http://localhost');if(!_0x346509['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');let _0xa271f1={'userID':_0x346509['userID'],'customData':_0x346509['customData']};switch(_0x4a638a['name']){case'list':{let _0x9880f3=await this['_service']['getHistoryList']({'unitID':_0x4a638a['unitID'],'length':o(_0x1709cb['searchParams']['get']('length')),..._0x1709cb['searchParams']['get']('lastLabel')?{'lastLabel':_0x1709cb['searchParams']['get']('lastLabel')}:{},...c(_0x1709cb['searchParams']['get']('origin')),'userIDs':_0x1709cb['searchParams']['getAll']('userIds')['filter'](Boolean)},_0xa271f1);d(_0x346509['response'],0xc8,{'error':r,...a(_0x9880f3)});return;}case'creators':{let _0x210ee9=await this['_service']['listHistoryCreators']({'unitID':_0x4a638a['unitID']},_0xa271f1);d(_0x346509['response'],0xc8,{'error':r,'creators':_0x210ee9['creators']['map'](({userID:_0x3c7825,..._0x1de444})=>({..._0x1de444,'userId':_0x3c7825}))});return;}case'changesets':{let _0x2d6fef=s(_0x1709cb['searchParams']['get']('startRevision'),'startRevision'),_0x416eae=s(_0x1709cb['searchParams']['get']('endRevision'),'endRevision'),_0x572789=await this['_service']['getHistoryChangesets']({'unitID':_0x4a638a['unitID'],'startRevision':_0x2d6fef,'endRevision':_0x416eae},_0xa271f1);d(_0x346509['response'],0xc8,{'error':r,..._0x572789});return;}}}catch(_0x147fd6){l(_0x346509['response'],_0x147fd6);}}['dispose'](){this['_disposed']=!0x0;}};function a(_0x8bb784){let _0x3be0cb=Object['fromEntries'](Object['entries'](_0x8bb784['entities']['datas'])['map'](([_0x11f2ac,{userID:_0x30a179,unitID:_0x1f1a58,userIDs:_0x156753,..._0x5c5d60}])=>[_0x11f2ac,{..._0x5c5d60,'userId':_0x30a179,'unitId':_0x1f1a58,'userIds':_0x156753}]));return{..._0x8bb784,'entities':{..._0x8bb784['entities'],'datas':_0x3be0cb}};}function o(_0x2f6d4a){return _0x2f6d4a===null||_0x2f6d4a===''?0x14:s(_0x2f6d4a,'length');}function s(_0x204b47,_0x18d003){if(!_0x204b47||!/^\d+$/['test'](_0x204b47))throw new e['CollabError']('INVALID_REQUEST',_0x18d003+'\x20must\x20be\x20a\x20positive\x20integer');let _0x403892=Number(_0x204b47);if(!Number['isSafeInteger'](_0x403892)||_0x403892<0x1)throw new e['CollabError']('INVALID_REQUEST',_0x18d003+'\x20must\x20be\x20a\x20positive\x20integer');return _0x403892;}function c(_0x548090){if(_0x548090===null||_0x548090===''||_0x548090==='0')return{};if(_0x548090==='1'||_0x548090==='2')return{'origin':Number(_0x548090)};throw new e['CollabError']('INVALID_REQUEST','origin\x20must\x20be\x200,\x201\x20or\x202');}function l(_0x44507c,_0x46b8d2){let _0x3d36f3=u(_0x46b8d2);d(_0x44507c,_0x3d36f3['status'],{'error':_0x3d36f3['error']});}function u(_0x4cf39d){if(_0x4cf39d instanceof t['NodeTransportError'])return{'status':_0x4cf39d['code']==='REQUEST_BODY_TOO_LARGE'?0x19d:_0x4cf39d['code']==='TRANSPORT_DISPOSED'?0x1f7:0x190,'error':{'code':_0x4cf39d['code']==='TRANSPORT_DISPOSED'?n['ErrorCode']['INTERNAL_ERROR']:n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x4cf39d['message']}};if(!(_0x4cf39d instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20server\x20error'}};let _0x1591e1={'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':0x2337},'LICENSE_POLICY_INVALID':{'status':0x1f4,'code':0x232f},'LICENSE_VERSION_NOT_ALLOWED':{'status':0x1f4,'code':0x2334},'LICENSE_UNIT_TYPE_REJECTED':{'status':0x193,'code':0x2336},'LICENSE_DOMAIN_REJECTED':{'status':0x193,'code':0x233a}}[_0x4cf39d['code']];return{'status':_0x1591e1['status'],'error':{'code':_0x1591e1['code'],'message':_0x4cf39d['message']}};}function d(_0xbd963c,_0x145d3f,_0x43c637){_0xbd963c['writableEnded']||_0xbd963c['destroyed']||(_0xbd963c['statusCode']=_0x145d3f,_0xbd963c['setHeader']('content-type','application/json;\x20charset=utf-8'),_0xbd963c['end'](JSON['stringify'](_0x43c637)));}exports['UniverHistoryEndpoint']=i;
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(_0x211055){if(this['_service']=_0x211055,!_0x211055)throw TypeError('UniverHistoryEndpoint\x20requires\x20a\x20service');}['register'](_0x1ebf7c){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');for(let [_0x4bbd1a,_0x306837]of[['list','list'],['creators','creators'],['cs','changesets']])_0x1ebf7c['get']('/universer-api/history/:unitID/'+_0x4bbd1a,_0x4668e7=>this['_handleHttp'](_0x4668e7,{'name':_0x306837,'unitID':_0x4668e7['params']['unitID']}));}async['_handleHttp'](_0x304105,_0x5dedd0){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','History\x20Endpoint\x20is\x20disposed');let _0x505b55=new URL(_0x304105['incomingMessage']['url']??'/','http://localhost');if(!_0x304105['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');let _0x430571={'userID':_0x304105['userID'],'customData':_0x304105['customData']};switch(_0x5dedd0['name']){case'list':{let _0x32639b=await this['_service']['getHistoryList']({'unitID':_0x5dedd0['unitID'],'length':s(_0x505b55['searchParams']['get']('length')),..._0x505b55['searchParams']['get']('lastLabel')?{'lastLabel':_0x505b55['searchParams']['get']('lastLabel')}:{},...l(_0x505b55['searchParams']['get']('origin')),'userIDs':_0x505b55['searchParams']['getAll']('userIds')['filter'](Boolean)},_0x430571);f(_0x304105['response'],0xc8,{'error':r,...o(_0x32639b)});return;}case'creators':{let _0x53926b=await this['_service']['listHistoryCreators']({'unitID':_0x5dedd0['unitID']},_0x430571);f(_0x304105['response'],0xc8,{'error':r,'creators':_0x53926b['creators']['map'](({userID:_0xae449,..._0x43182b})=>({..._0x43182b,'userId':_0xae449}))});return;}case'changesets':{let _0x532fc9=c(_0x505b55['searchParams']['get']('startRevision'),'startRevision'),_0x545094=c(_0x505b55['searchParams']['get']('endRevision'),'endRevision'),_0x46178f=await this['_service']['getHistoryChangesets']({'unitID':_0x5dedd0['unitID'],'startRevision':_0x532fc9,'endRevision':_0x545094},_0x430571);f(_0x304105['response'],0xc8,{'error':r,..._0x46178f,'changesets':_0x46178f['changesets']['map'](a)});return;}}}catch(_0x3bcc3d){u(_0x304105['response'],_0x3bcc3d);}}['dispose'](){this['_disposed']=!0x0;}};function a(_0x2dcece){let _0x4fef88={..._0x2dcece};return delete _0x4fef88['metadata'],_0x4fef88;}function o(_0x28a4f0){let _0x276daa=Object['fromEntries'](Object['entries'](_0x28a4f0['entities']['datas'])['map'](([_0x76b594,{userID:_0x30aada,unitID:_0x5b0cf0,userIDs:_0x5dfbde,..._0x26bfc7}])=>[_0x76b594,{..._0x26bfc7,'userId':_0x30aada,'unitId':_0x5b0cf0,'userIds':_0x5dfbde}]));return{..._0x28a4f0,'entities':{..._0x28a4f0['entities'],'datas':_0x276daa}};}function s(_0x430a5b){return _0x430a5b===null||_0x430a5b===''?0x14:c(_0x430a5b,'length');}function c(_0x2da2c2,_0x55aa80){if(!_0x2da2c2||!/^\d+$/['test'](_0x2da2c2))throw new e['CollabError']('INVALID_REQUEST',_0x55aa80+'\x20must\x20be\x20a\x20positive\x20integer');let _0x4fb6fb=Number(_0x2da2c2);if(!Number['isSafeInteger'](_0x4fb6fb)||_0x4fb6fb<0x1)throw new e['CollabError']('INVALID_REQUEST',_0x55aa80+'\x20must\x20be\x20a\x20positive\x20integer');return _0x4fb6fb;}function l(_0x14c1d1){if(_0x14c1d1===null||_0x14c1d1===''||_0x14c1d1==='0')return{};if(_0x14c1d1==='1'||_0x14c1d1==='2')return{'origin':Number(_0x14c1d1)};throw new e['CollabError']('INVALID_REQUEST','origin\x20must\x20be\x200,\x201\x20or\x202');}function u(_0x2bed61,_0xea5e9b){let _0xbb7027=d(_0xea5e9b);f(_0x2bed61,_0xbb7027['status'],{'error':_0xbb7027['error']});}function d(_0x408d80){if(_0x408d80 instanceof t['NodeTransportError'])return{'status':_0x408d80['code']==='REQUEST_BODY_TOO_LARGE'?0x19d:_0x408d80['code']==='TRANSPORT_DISPOSED'?0x1f7:0x190,'error':{'code':_0x408d80['code']==='TRANSPORT_DISPOSED'?n['ErrorCode']['INTERNAL_ERROR']:n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x408d80['message']}};if(!(_0x408d80 instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20server\x20error'}};let _0xe441e3={'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']}}[_0x408d80['code']];return{'status':_0xe441e3['status'],'error':{'code':_0xe441e3['code'],'message':_0x408d80['message']}};}function f(_0x43683f,_0x55a0cd,_0x3134a4){_0x43683f['writableEnded']||_0x43683f['destroyed']||(_0x43683f['statusCode']=_0x55a0cd,_0x43683f['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x43683f['end'](JSON['stringify'](_0x3134a4)));}exports['UniverHistoryEndpoint']=i;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IUniverHistoryService } from "@univerjs-pro/collaboration-history-service";
2
2
  import { NodeRouter, NodeTransportEndpoint } from "@univerjs-pro/collaboration-transport-node";
3
3
 
4
- //#region src/endpoint.d.ts
4
+ // src/endpoint.d.ts
5
5
  declare class UniverHistoryEndpoint implements NodeTransportEndpoint {
6
6
  private readonly _service;
7
7
  private _disposed;
@@ -10,5 +10,4 @@ declare class UniverHistoryEndpoint implements NodeTransportEndpoint {
10
10
  private _handleHttp;
11
11
  dispose(): void;
12
12
  }
13
- //#endregion
14
13
  export { UniverHistoryEndpoint };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- (function(_0x15f131,_0x46c611){const _0x1a1e96=_0xc2e3,_0x25c5a6=_0x15f131();while(!![]){try{const _0x5a1c6b=parseInt(_0x1a1e96(0x10c))/0x1+parseInt(_0x1a1e96(0x10d))/0x2+-parseInt(_0x1a1e96(0x106))/0x3*(-parseInt(_0x1a1e96(0x10b))/0x4)+-parseInt(_0x1a1e96(0x107))/0x5+parseInt(_0x1a1e96(0x109))/0x6+-parseInt(_0x1a1e96(0x10a))/0x7+-parseInt(_0x1a1e96(0x108))/0x8;if(_0x5a1c6b===_0x46c611)break;else _0x25c5a6['push'](_0x25c5a6['shift']());}catch(_0x5ea574){_0x25c5a6['push'](_0x25c5a6['shift']());}}}(_0x5159,0x5cf7d));import _0x281fff from'./index.cjs';function _0x5159(){const _0x11bbf1=['7963688jfnkKB','3295086FCKtkx','972209LpLFJP','721708tyEzrK','675803iWhZYd','673756mEtfgQ','3yWDUXn','1135720RVxCEW'];_0x5159=function(){return _0x11bbf1;};return _0x5159();}const facadeExport0=_0x281fff['UniverHistoryEndpoint'];function _0xc2e3(_0x1f9ed9,_0x10da20){_0x1f9ed9=_0x1f9ed9-0x106;const _0x515950=_0x5159();let _0xc2e3ce=_0x515950[_0x1f9ed9];return _0xc2e3ce;}export{facadeExport0 as UniverHistoryEndpoint};
1
+ const _0x33500d=_0x4f2d;(function(_0x81b4ef,_0xeb9f5a){const _0x339819=_0x4f2d,_0x37fa84=_0x81b4ef();while(!![]){try{const _0x2b9320=-parseInt(_0x339819(0x169))/0x1+-parseInt(_0x339819(0x16e))/0x2+parseInt(_0x339819(0x171))/0x3+parseInt(_0x339819(0x16a))/0x4+parseInt(_0x339819(0x16f))/0x5*(parseInt(_0x339819(0x168))/0x6)+parseInt(_0x339819(0x16d))/0x7+parseInt(_0x339819(0x16b))/0x8*(-parseInt(_0x339819(0x170))/0x9);if(_0x2b9320===_0xeb9f5a)break;else _0x37fa84['push'](_0x37fa84['shift']());}catch(_0x9a32eb){_0x37fa84['push'](_0x37fa84['shift']());}}}(_0x26c1,0x4448f));import _0x303216 from'./index.cjs';function _0x26c1(){const _0x17d0d8=['756GOyDMw','1563549OeHxDV','10146XDRGuT','61113jfECsP','1960864vgoRhB','75336mLIyBj','UniverHistoryEndpoint','3635464beHwfb','895908LqWvjj','145hXyPRI'];_0x26c1=function(){return _0x17d0d8;};return _0x26c1();}const facadeExport0=_0x303216[_0x33500d(0x16c)];function _0x4f2d(_0x1a877f,_0x31d131){_0x1a877f=_0x1a877f-0x168;const _0x26c1fd=_0x26c1();let _0x4f2d22=_0x26c1fd[_0x1a877f];return _0x4f2d22;}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.3.1",
4
+ "version": "1.5.2",
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.3.1",
20
- "@univerjs-pro/collaboration-service": "1.3.1",
21
- "@univerjs-pro/collaboration-transport-node": "1.3.1",
22
- "@univerjs/protocol": "1.3.1"
19
+ "@univerjs-pro/collaboration-history-service": "1.5.2",
20
+ "@univerjs-pro/collaboration-service": "1.5.2",
21
+ "@univerjs-pro/collaboration-transport-node": "1.5.2",
22
+ "@univerjs/protocol": "1.5.2"
23
23
  }
24
24
  }