@univerjs-pro/collaboration-comment-endpoint 1.6.2 → 1.7.0-alpha.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(_0x349b69){if(!_0x349b69?.['service'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20service');if(!_0x349b69?.['roomHost'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20roomHost');this['_service']=_0x349b69['service'],this['_roomHost']=_0x349b69['roomHost'],this['_protocolBasePath']=f(_0x349b69['protocolBasePath']??'/universer-api'),this['_subscription']=this['_service']['on']('commentCommitted',_0x45ca9e=>this['_track'](this['_publish'](_0x45ca9e)));}['register'](_0x394f20){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x2f005a=_0x24c807=>_0x12e1b6=>this['_track'](this['_handleHttp'](_0x12e1b6,{'action':_0x24c807,'unitID':_0x12e1b6['params']['unitID']}));for(let _0x59b871 of['add','list','reply','solved','edit','delete'])_0x394f20['post'](this['_protocolBasePath']+'/comment/unit/:unitID/'+_0x59b871,_0x2f005a(_0x59b871));_0x394f20['get'](this['_protocolBasePath']+'/comment/unit/:unitID/list',_0x2f005a('list'));}['dispose'](){return this['_disposePromise']||=(this['_disposed']=!0x0,this['_subscription']['dispose'](),Promise['allSettled']([...this['_calls']])['then'](()=>void 0x0)),this['_disposePromise'];}['_track'](_0x366fb7){return this['_calls']['add'](_0x366fb7),_0x366fb7['finally'](()=>this['_calls']['delete'](_0x366fb7))['catch'](()=>void 0x0),_0x366fb7;}async['_handleHttp'](_0x58581a,_0x1ef61b){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x18efa0=new URL(_0x58581a['incomingMessage']['url']??'/','http://localhost');if(!_0x1ef61b['unitID']||_0x1ef61b['unitID']['includes']('/'))throw d('Invalid\x20route\x20unitId');if(!_0x58581a['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');if(_0x1ef61b['action']==='list'){let _0x5852b=a(_0x58581a['incomingMessage']['method']==='GET'?{'unitId':_0x1ef61b['unitID'],'threadId':_0x18efa0['searchParams']['getAll']('threadId')}:await _0x58581a['readJson'](),_0x1ef61b['unitID']),_0x35d144=await this['_service']['listComments']({'unitID':_0x1ef61b['unitID'],'threadIDs':_0x5852b['threadId']},{'userID':_0x58581a['userID'],'customData':_0x58581a['customData']});h(_0x58581a['response'],0xc8,{'error':r,..._0x35d144});return;}let _0x48c0dc=o(await _0x58581a['readJson']());if(s(_0x48c0dc['unitId'],'unitId')!==_0x1ef61b['unitID'])throw d('Route\x20and\x20body\x20unitId\x20must\x20match');let _0x253b4f=s(_0x48c0dc['memberId'],'memberId'),_0xfe936a={'userID':_0x58581a['userID'],'memberID':_0x253b4f,'customData':_0x58581a['customData']};switch(_0x1ef61b['action']){case'add':{let _0x2fef05=await this['_service']['addComment']({'unitID':_0x1ef61b['unitID'],'content':s(_0x48c0dc['content'],'content'),'mentions':l(_0x48c0dc['mention'],'mention')},_0xfe936a);h(_0x58581a['response'],0xc8,{'error':r,'comment':_0x2fef05});return;}case'reply':{let _0x1ee873=await this['_service']['replyComment']({'unitID':_0x1ef61b['unitID'],'threadID':s(_0x48c0dc['threadId'],'threadId'),'content':s(_0x48c0dc['content'],'content'),'mentions':l(_0x48c0dc['mention'],'mention')},_0xfe936a);h(_0x58581a['response'],0xc8,{'error':r,'reply':_0x1ee873});return;}case'solved':{let _0x5713f2=u(_0x48c0dc['solved']);await this['_service']['setThreadSolved']({'unitID':_0x1ef61b['unitID'],'threadID':s(_0x48c0dc['threadId'],'threadId'),'solved':_0x5713f2},_0xfe936a),h(_0x58581a['response'],0xc8,{'error':r});return;}case'edit':await this['_service']['editComment']({'unitID':_0x1ef61b['unitID'],'threadID':s(_0x48c0dc['threadId'],'threadId'),'replyID':s(_0x48c0dc['replyId'],'replyId'),'content':s(_0x48c0dc['content'],'content'),'mentions':l(_0x48c0dc['mention'],'mention')},_0xfe936a),h(_0x58581a['response'],0xc8,{'error':r});return;case'delete':await this['_service']['deleteComment']({'unitID':_0x1ef61b['unitID'],'threadID':s(_0x48c0dc['threadId'],'threadId'),...c(_0x48c0dc['replyId'],'replyId')},_0xfe936a),h(_0x58581a['response'],0xc8,{'error':r});return;}}catch(_0x44125c){p(_0x58581a['response'],_0x44125c,_0x1ef61b['action']);}}async['_publish'](_0xe47395){try{await this['_roomHost']['publishTrustedUnitEvent']({'unitID':_0xe47395['update']['unitId'],'memberID':_0xe47395['memberID'],'userID':_0xe47395['userID'],'eventID':'comment_update','data':{'commentUpdateEvent':_0xe47395['update']}});}catch{}}};function a(_0x132374,_0x38bdf5){let _0x57d175=o(_0x132374),_0x1fd7fc=s(_0x57d175['unitId'],'unitId');if(_0x1fd7fc!==_0x38bdf5)throw d('Route\x20and\x20body\x20unitId\x20must\x20match');return{'unitId':_0x1fd7fc,'threadId':l(_0x57d175['threadId'],'threadId')};}function o(_0x197d47){if(!_0x197d47||typeof _0x197d47!='object'||Array['isArray'](_0x197d47))throw d('Request\x20body\x20must\x20be\x20an\x20object');return _0x197d47;}function s(_0x16bae0,_0x5742f7){if(typeof _0x16bae0!='string'||_0x16bae0['length']===0x0)throw d(_0x5742f7+'\x20must\x20be\x20a\x20non-empty\x20string');return _0x16bae0;}function c(_0x59a0f7,_0x46c736){return _0x59a0f7==null||_0x59a0f7===''?{}:{'replyID':s(_0x59a0f7,_0x46c736)};}function l(_0x528417,_0x409c06){if(!Array['isArray'](_0x528417)||_0x528417['some'](_0x3b7eea=>typeof _0x3b7eea!='string'||_0x3b7eea['length']===0x0))throw d(_0x409c06+'\x20must\x20be\x20an\x20array\x20of\x20non-empty\x20strings');return[..._0x528417];}function u(_0x4e5517){if(_0x4e5517!==n['CommentSolvedStatus']['OpenOrReOpen']&&_0x4e5517!==n['CommentSolvedStatus']['Solved'])throw d('solved\x20must\x20be\x20OpenOrReOpen\x20or\x20Solved');return _0x4e5517;}function d(_0x549e99){return new e['CollabError']('INVALID_REQUEST',_0x549e99);}function f(_0x2322e8){if(!_0x2322e8['startsWith']('/')||_0x2322e8==='/'||_0x2322e8['endsWith']('/')||_0x2322e8['includes']('//'))throw TypeError('protocolBasePath\x20must\x20be\x20an\x20absolute\x20path\x20without\x20a\x20trailing\x20slash');return _0x2322e8;}function p(_0x3e7595,_0x5396c6,_0xf9c6){let _0x1e8e0c=m(_0x5396c6),_0x42fce7=_0xf9c6==='list'?{'comments':{},'users':{}}:_0xf9c6==='add'?{'comment':void 0x0}:_0xf9c6==='reply'?{'reply':void 0x0}:{};h(_0x3e7595,_0x1e8e0c['status'],{'error':_0x1e8e0c['error'],..._0x42fce7});}function m(_0x1a3562){if(_0x1a3562 instanceof t['NodeTransportError'])return _0x1a3562['code']==='REQUEST_BODY_TOO_LARGE'?{'status':0x19d,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x1a3562['message']}}:_0x1a3562['code']==='INVALID_JSON'||_0x1a3562['code']==='REQUEST_ABORTED'?{'status':0x190,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x1a3562['message']}}:{'status':0x1f7,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':_0x1a3562['message']}};if(!(_0x1a3562 instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20error'}};let [_0x132e94,_0x3a3051]=((()=>{switch(_0x1a3562['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':_0x132e94,'error':{'code':_0x3a3051,'message':_0x1a3562['message']}};}function h(_0x19504a,_0x42f8ac,_0x18f83e){_0x19504a['writableEnded']||(_0x19504a['statusCode']=_0x42f8ac,_0x19504a['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x19504a['end'](JSON['stringify'](_0x18f83e)));}exports['UniverCommentEndpoint']=i;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x2e7034=_0x3bff;(function(_0x488fd6,_0x516eda){const _0x1b80a6=_0x3bff,_0x391178=_0x488fd6();while(!![]){try{const _0x2ba06c=parseInt(_0x1b80a6(0xce))/0x1+-parseInt(_0x1b80a6(0xcc))/0x2+parseInt(_0x1b80a6(0xca))/0x3+parseInt(_0x1b80a6(0xcb))/0x4+parseInt(_0x1b80a6(0xcf))/0x5+-parseInt(_0x1b80a6(0xd2))/0x6+parseInt(_0x1b80a6(0xcd))/0x7*(-parseInt(_0x1b80a6(0xd0))/0x8);if(_0x2ba06c===_0x516eda)break;else _0x391178['push'](_0x391178['shift']());}catch(_0x7ac198){_0x391178['push'](_0x391178['shift']());}}}(_0x3c62,0xf1f26));import _0x12920d from'./index.cjs';function _0x3c62(){const _0x4b1f93=['2057760AYjFvV','446606OfaRjt','859243FxfwzW','377766rEcdGD','4062750YGGzGU','8atVPmI','UniverCommentEndpoint','8567736FCWoAi','3180798ojYcOw'];_0x3c62=function(){return _0x4b1f93;};return _0x3c62();}function _0x3bff(_0x41b56f,_0x3d2bfc){_0x41b56f=_0x41b56f-0xca;const _0x3c621e=_0x3c62();let _0x3bffb6=_0x3c621e[_0x41b56f];return _0x3bffb6;}const facadeExport0=_0x12920d[_0x2e7034(0xd1)];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.7.0-alpha.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.7.0-alpha.0",
|
|
20
|
+
"@univerjs-pro/collaboration-endpoint": "1.7.0-alpha.0",
|
|
21
|
+
"@univerjs-pro/collaboration-service": "1.7.0-alpha.0",
|
|
22
|
+
"@univerjs-pro/collaboration-transport-node": "1.7.0-alpha.0",
|
|
23
|
+
"@univerjs/protocol": "1.7.0-alpha.0"
|
|
24
24
|
}
|
|
25
25
|
}
|