@univerjs-pro/collaboration-comment-endpoint 1.1.0 → 1.2.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/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +6 -6
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'];['_roomHost'];['_protocolBasePath'];['_subscription'];['_calls']=new Set();['_disposed']=!0x1;['_disposePromise'];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'];['_roomHost'];['_protocolBasePath'];['_subscription'];['_calls']=new Set();['_disposed']=!0x1;['_disposePromise'];constructor(_0x297528){if(!_0x297528?.['service'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20service');if(!_0x297528?.['roomHost'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20roomHost');this['_service']=_0x297528['service'],this['_roomHost']=_0x297528['roomHost'],this['_protocolBasePath']=f(_0x297528['protocolBasePath']??'/universer-api'),this['_subscription']=this['_service']['on']('commentCommitted',_0x291d78=>this['_track'](this['_publish'](_0x291d78)));}['register'](_0x294b2b){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x1ac6c0=_0x3275de=>_0x4990a5=>this['_track'](this['_handleHttp'](_0x4990a5,{'action':_0x3275de,'unitID':_0x4990a5['params']['unitID']}));for(let _0x17d0b1 of['add','list','reply','solved','edit','delete'])_0x294b2b['post'](this['_protocolBasePath']+'/comment/unit/:unitID/'+_0x17d0b1,_0x1ac6c0(_0x17d0b1));_0x294b2b['get'](this['_protocolBasePath']+'/comment/unit/:unitID/list',_0x1ac6c0('list'));}['dispose'](){return this['_disposePromise']?this['_disposePromise']:(this['_disposed']=!0x0,this['_subscription']['dispose'](),this['_disposePromise']=Promise['allSettled']([...this['_calls']])['then'](()=>void 0x0),this['_disposePromise']);}['_track'](_0x432d65){return this['_calls']['add'](_0x432d65),_0x432d65['finally'](()=>this['_calls']['delete'](_0x432d65))['catch'](()=>void 0x0),_0x432d65;}async['_handleHttp'](_0x26de9b,_0x38e6a0){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x255a65=new URL(_0x26de9b['incomingMessage']['url']??'/','http://localhost');if(!_0x38e6a0['unitID']||_0x38e6a0['unitID']['includes']('/'))throw d('Invalid\x20route\x20unitId');if(!_0x26de9b['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');if(_0x38e6a0['action']==='list'){let _0x4222df=a(_0x26de9b['incomingMessage']['method']==='GET'?{'unitId':_0x38e6a0['unitID'],'threadId':_0x255a65['searchParams']['getAll']('threadId')}:await _0x26de9b['readJson'](),_0x38e6a0['unitID']),_0x1e846f=await this['_service']['listComments']({'unitID':_0x38e6a0['unitID'],'threadIDs':_0x4222df['threadId']},{'userID':_0x26de9b['userID'],'customData':_0x26de9b['customData']});h(_0x26de9b['response'],0xc8,{'error':r,..._0x1e846f});return;}let _0x1d8677=o(await _0x26de9b['readJson']());if(s(_0x1d8677['unitId'],'unitId')!==_0x38e6a0['unitID'])throw d('Route\x20and\x20body\x20unitId\x20must\x20match');let _0x56f450=s(_0x1d8677['memberId'],'memberId'),_0x4079a4={'userID':_0x26de9b['userID'],'memberID':_0x56f450,'customData':_0x26de9b['customData']};switch(_0x38e6a0['action']){case'add':{let _0x263d1c=await this['_service']['addComment']({'unitID':_0x38e6a0['unitID'],'content':s(_0x1d8677['content'],'content'),'mentions':l(_0x1d8677['mention'],'mention')},_0x4079a4);h(_0x26de9b['response'],0xc8,{'error':r,'comment':_0x263d1c});return;}case'reply':{let _0x17ccfd=await this['_service']['replyComment']({'unitID':_0x38e6a0['unitID'],'threadID':s(_0x1d8677['threadId'],'threadId'),'content':s(_0x1d8677['content'],'content'),'mentions':l(_0x1d8677['mention'],'mention')},_0x4079a4);h(_0x26de9b['response'],0xc8,{'error':r,'reply':_0x17ccfd});return;}case'solved':{let _0x565fe9=u(_0x1d8677['solved']);await this['_service']['setThreadSolved']({'unitID':_0x38e6a0['unitID'],'threadID':s(_0x1d8677['threadId'],'threadId'),'solved':_0x565fe9},_0x4079a4),h(_0x26de9b['response'],0xc8,{'error':r});return;}case'edit':await this['_service']['editComment']({'unitID':_0x38e6a0['unitID'],'threadID':s(_0x1d8677['threadId'],'threadId'),'replyID':s(_0x1d8677['replyId'],'replyId'),'content':s(_0x1d8677['content'],'content'),'mentions':l(_0x1d8677['mention'],'mention')},_0x4079a4),h(_0x26de9b['response'],0xc8,{'error':r});return;case'delete':await this['_service']['deleteComment']({'unitID':_0x38e6a0['unitID'],'threadID':s(_0x1d8677['threadId'],'threadId'),...c(_0x1d8677['replyId'],'replyId')},_0x4079a4),h(_0x26de9b['response'],0xc8,{'error':r});return;}}catch(_0x54efa4){p(_0x26de9b['response'],_0x54efa4,_0x38e6a0['action']);}}async['_publish'](_0x1cc0f4){try{await this['_roomHost']['publishTrustedUnitEvent']({'unitID':_0x1cc0f4['update']['unitId'],'memberID':_0x1cc0f4['memberID'],'userID':_0x1cc0f4['userID'],'eventID':'comment_update','data':{'commentUpdateEvent':_0x1cc0f4['update']}});}catch{}}};function a(_0x1bc2ba,_0x4d45d0){let _0x5475c2=o(_0x1bc2ba),_0x48a6bf=s(_0x5475c2['unitId'],'unitId');if(_0x48a6bf!==_0x4d45d0)throw d('Route\x20and\x20body\x20unitId\x20must\x20match');return{'unitId':_0x48a6bf,'threadId':l(_0x5475c2['threadId'],'threadId')};}function o(_0x28c0ff){if(!_0x28c0ff||typeof _0x28c0ff!='object'||Array['isArray'](_0x28c0ff))throw d('Request\x20body\x20must\x20be\x20an\x20object');return _0x28c0ff;}function s(_0x121406,_0x31d091){if(typeof _0x121406!='string'||_0x121406['length']===0x0)throw d(_0x31d091+'\x20must\x20be\x20a\x20non-empty\x20string');return _0x121406;}function c(_0x25630c,_0x233a82){return _0x25630c==null||_0x25630c===''?{}:{'replyID':s(_0x25630c,_0x233a82)};}function l(_0x1d2059,_0x2e7455){if(!Array['isArray'](_0x1d2059)||_0x1d2059['some'](_0x224135=>typeof _0x224135!='string'||_0x224135['length']===0x0))throw d(_0x2e7455+'\x20must\x20be\x20an\x20array\x20of\x20non-empty\x20strings');return[..._0x1d2059];}function u(_0x3fbeb9){if(_0x3fbeb9!==n['CommentSolvedStatus']['OpenOrReOpen']&&_0x3fbeb9!==n['CommentSolvedStatus']['Solved'])throw d('solved\x20must\x20be\x20OpenOrReOpen\x20or\x20Solved');return _0x3fbeb9;}function d(_0x57f2d7){return new e['CollabError']('INVALID_REQUEST',_0x57f2d7);}function f(_0x4d4b50){if(!_0x4d4b50['startsWith']('/')||_0x4d4b50==='/'||_0x4d4b50['endsWith']('/')||_0x4d4b50['includes']('//'))throw TypeError('protocolBasePath\x20must\x20be\x20an\x20absolute\x20path\x20without\x20a\x20trailing\x20slash');return _0x4d4b50;}function p(_0x2ddfdf,_0x5a70c5,_0x44d338){let _0x54b3ab=m(_0x5a70c5),_0x5bc509=_0x44d338==='list'?{'comments':{},'users':{}}:_0x44d338==='add'?{'comment':void 0x0}:_0x44d338==='reply'?{'reply':void 0x0}:{};h(_0x2ddfdf,_0x54b3ab['status'],{'error':_0x54b3ab['error'],..._0x5bc509});}function m(_0x418274){if(_0x418274 instanceof t['NodeTransportError'])return _0x418274['code']==='REQUEST_BODY_TOO_LARGE'?{'status':0x19d,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x418274['message']}}:_0x418274['code']==='INVALID_JSON'||_0x418274['code']==='REQUEST_ABORTED'?{'status':0x190,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x418274['message']}}:{'status':0x1f7,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':_0x418274['message']}};if(!(_0x418274 instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20error'}};let [_0x468248,_0x2d680e]=((()=>{switch(_0x418274['code']){case'INVALID_REQUEST':return[0x190,n['ErrorCode']['INVALID_ARGUMENT']];case'UNAUTHENTICATED':return[0x191,n['ErrorCode']['UNAUTHENTICATED']];case'PERMISSION_DENIED':return[0x193,n['ErrorCode']['PERMISSION_DENIED']];case'UNIT_NOT_FOUND':return[0x194,n['ErrorCode']['NOT_FOUND']];case'ADAPTER_FAILURE':return[0x1f7,n['ErrorCode']['INTERNAL_ERROR']];default:return[0x1f4,n['ErrorCode']['INTERNAL_ERROR']];}})());return{'status':_0x468248,'error':{'code':_0x2d680e,'message':_0x418274['message']}};}function h(_0x463c47,_0x2edcc9,_0x4dc03c){_0x463c47['writableEnded']||(_0x463c47['statusCode']=_0x2edcc9,_0x463c47['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x463c47['end'](JSON['stringify'](_0x4dc03c)));}exports['UniverCommentEndpoint']=i;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x23a3(){const _0x1afc92=['2012390BmmpZP','277180LVhRsj','32BhGHiA','30TXOeSK','12bbbhrN','1EFIMrz','874162znOILk','11912648MnFjAR','452084fdKIlA','245126PqVlnz','15ZsDRji','1010196WrOhnf'];_0x23a3=function(){return _0x1afc92;};return _0x23a3();}(function(_0x45ca87,_0x3755b6){const _0x287258=_0x2a88,_0x51a044=_0x45ca87();while(!![]){try{const _0x4be33b=parseInt(_0x287258(0x125))/0x1*(-parseInt(_0x287258(0x126))/0x2)+parseInt(_0x287258(0x11e))/0x3*(-parseInt(_0x287258(0x128))/0x4)+-parseInt(_0x287258(0x120))/0x5+-parseInt(_0x287258(0x123))/0x6*(-parseInt(_0x287258(0x129))/0x7)+-parseInt(_0x287258(0x122))/0x8*(-parseInt(_0x287258(0x11f))/0x9)+parseInt(_0x287258(0x121))/0xa+-parseInt(_0x287258(0x127))/0xb*(-parseInt(_0x287258(0x124))/0xc);if(_0x4be33b===_0x3755b6)break;else _0x51a044['push'](_0x51a044['shift']());}catch(_0x31de3a){_0x51a044['push'](_0x51a044['shift']());}}}(_0x23a3,0x50968));import _0x39499b from'./index.cjs';function _0x2a88(_0x234645,_0x313965){_0x234645=_0x234645-0x11e;const _0x23a30b=_0x23a3();let _0x2a88bb=_0x23a30b[_0x234645];return _0x2a88bb;}const facadeExport0=_0x39499b['UniverCommentEndpoint'];export{facadeExport0 as UniverCommentEndpoint};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs-pro/collaboration-comment-endpoint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/collaboration-comment-service": "1.
|
|
20
|
-
"@univerjs-pro/collaboration-endpoint": "1.
|
|
21
|
-
"@univerjs-pro/collaboration-service": "1.
|
|
22
|
-
"@univerjs-pro/collaboration-transport-node": "1.
|
|
23
|
-
"@univerjs/protocol": "1.
|
|
19
|
+
"@univerjs-pro/collaboration-comment-service": "1.2.0",
|
|
20
|
+
"@univerjs-pro/collaboration-endpoint": "1.2.0",
|
|
21
|
+
"@univerjs-pro/collaboration-service": "1.2.0",
|
|
22
|
+
"@univerjs-pro/collaboration-transport-node": "1.2.0",
|
|
23
|
+
"@univerjs/protocol": "1.2.0"
|
|
24
24
|
}
|
|
25
25
|
}
|