@univerjs-pro/collaboration-comment-endpoint 1.4.0 → 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/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -2
- 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(_0x24b682){if(!_0x24b682?.['service'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20service');if(!_0x24b682?.['roomHost'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20roomHost');this['_service']=_0x24b682['service'],this['_roomHost']=_0x24b682['roomHost'],this['_protocolBasePath']=f(_0x24b682['protocolBasePath']??'/universer-api'),this['_subscription']=this['_service']['on']('commentCommitted',_0x5710e4=>this['_track'](this['_publish'](_0x5710e4)));}['register'](_0x5b146a){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x4d2bf5=_0x22e194=>_0x353e84=>this['_track'](this['_handleHttp'](_0x353e84,{'action':_0x22e194,'unitID':_0x353e84['params']['unitID']}));for(let _0x530367 of['add','list','reply','solved','edit','delete'])_0x5b146a['post'](this['_protocolBasePath']+'/comment/unit/:unitID/'+_0x530367,_0x4d2bf5(_0x530367));_0x5b146a['get'](this['_protocolBasePath']+'/comment/unit/:unitID/list',_0x4d2bf5('list'));}['dispose'](){return this['_disposePromise']||=(this['_disposed']=!0x0,this['_subscription']['dispose'](),Promise['allSettled']([...this['_calls']])['then'](()=>void 0x0)),this['_disposePromise'];}['_track'](_0x49a930){return this['_calls']['add'](_0x49a930),_0x49a930['finally'](()=>this['_calls']['delete'](_0x49a930))['catch'](()=>void 0x0),_0x49a930;}async['_handleHttp'](_0x562e75,_0xb6da90){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x12dc91=new URL(_0x562e75['incomingMessage']['url']??'/','http://localhost');if(!_0xb6da90['unitID']||_0xb6da90['unitID']['includes']('/'))throw d('Invalid\x20route\x20unitId');if(!_0x562e75['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');if(_0xb6da90['action']==='list'){let _0x45609c=a(_0x562e75['incomingMessage']['method']==='GET'?{'unitId':_0xb6da90['unitID'],'threadId':_0x12dc91['searchParams']['getAll']('threadId')}:await _0x562e75['readJson'](),_0xb6da90['unitID']),_0x8298ab=await this['_service']['listComments']({'unitID':_0xb6da90['unitID'],'threadIDs':_0x45609c['threadId']},{'userID':_0x562e75['userID'],'customData':_0x562e75['customData']});h(_0x562e75['response'],0xc8,{'error':r,..._0x8298ab});return;}let _0x27edc4=o(await _0x562e75['readJson']());if(s(_0x27edc4['unitId'],'unitId')!==_0xb6da90['unitID'])throw d('Route\x20and\x20body\x20unitId\x20must\x20match');let _0x208505=s(_0x27edc4['memberId'],'memberId'),_0x2e4820={'userID':_0x562e75['userID'],'memberID':_0x208505,'customData':_0x562e75['customData']};switch(_0xb6da90['action']){case'add':{let _0x427c4d=await this['_service']['addComment']({'unitID':_0xb6da90['unitID'],'content':s(_0x27edc4['content'],'content'),'mentions':l(_0x27edc4['mention'],'mention')},_0x2e4820);h(_0x562e75['response'],0xc8,{'error':r,'comment':_0x427c4d});return;}case'reply':{let _0x41bc0a=await this['_service']['replyComment']({'unitID':_0xb6da90['unitID'],'threadID':s(_0x27edc4['threadId'],'threadId'),'content':s(_0x27edc4['content'],'content'),'mentions':l(_0x27edc4['mention'],'mention')},_0x2e4820);h(_0x562e75['response'],0xc8,{'error':r,'reply':_0x41bc0a});return;}case'solved':{let _0x467c22=u(_0x27edc4['solved']);await this['_service']['setThreadSolved']({'unitID':_0xb6da90['unitID'],'threadID':s(_0x27edc4['threadId'],'threadId'),'solved':_0x467c22},_0x2e4820),h(_0x562e75['response'],0xc8,{'error':r});return;}case'edit':await this['_service']['editComment']({'unitID':_0xb6da90['unitID'],'threadID':s(_0x27edc4['threadId'],'threadId'),'replyID':s(_0x27edc4['replyId'],'replyId'),'content':s(_0x27edc4['content'],'content'),'mentions':l(_0x27edc4['mention'],'mention')},_0x2e4820),h(_0x562e75['response'],0xc8,{'error':r});return;case'delete':await this['_service']['deleteComment']({'unitID':_0xb6da90['unitID'],'threadID':s(_0x27edc4['threadId'],'threadId'),...c(_0x27edc4['replyId'],'replyId')},_0x2e4820),h(_0x562e75['response'],0xc8,{'error':r});return;}}catch(_0x556f7e){p(_0x562e75['response'],_0x556f7e,_0xb6da90['action']);}}async['_publish'](_0x4bcab1){try{await this['_roomHost']['publishTrustedUnitEvent']({'unitID':_0x4bcab1['update']['unitId'],'memberID':_0x4bcab1['memberID'],'userID':_0x4bcab1['userID'],'eventID':'comment_update','data':{'commentUpdateEvent':_0x4bcab1['update']}});}catch{}}};function a(_0x3325b2,_0x457a34){let _0x5417cd=o(_0x3325b2),_0x3cf887=s(_0x5417cd['unitId'],'unitId');if(_0x3cf887!==_0x457a34)throw d('Route\x20and\x20body\x20unitId\x20must\x20match');return{'unitId':_0x3cf887,'threadId':l(_0x5417cd['threadId'],'threadId')};}function o(_0x48d186){if(!_0x48d186||typeof _0x48d186!='object'||Array['isArray'](_0x48d186))throw d('Request\x20body\x20must\x20be\x20an\x20object');return _0x48d186;}function s(_0x31316b,_0x555a5a){if(typeof _0x31316b!='string'||_0x31316b['length']===0x0)throw d(_0x555a5a+'\x20must\x20be\x20a\x20non-empty\x20string');return _0x31316b;}function c(_0x53be2a,_0x5a964f){return _0x53be2a==null||_0x53be2a===''?{}:{'replyID':s(_0x53be2a,_0x5a964f)};}function l(_0x1c3f39,_0x3e2d91){if(!Array['isArray'](_0x1c3f39)||_0x1c3f39['some'](_0x206556=>typeof _0x206556!='string'||_0x206556['length']===0x0))throw d(_0x3e2d91+'\x20must\x20be\x20an\x20array\x20of\x20non-empty\x20strings');return[..._0x1c3f39];}function u(_0x3575d3){if(_0x3575d3!==n['CommentSolvedStatus']['OpenOrReOpen']&&_0x3575d3!==n['CommentSolvedStatus']['Solved'])throw d('solved\x20must\x20be\x20OpenOrReOpen\x20or\x20Solved');return _0x3575d3;}function d(_0x8caeb5){return new e['CollabError']('INVALID_REQUEST',_0x8caeb5);}function f(_0x505ed9){if(!_0x505ed9['startsWith']('/')||_0x505ed9==='/'||_0x505ed9['endsWith']('/')||_0x505ed9['includes']('//'))throw TypeError('protocolBasePath\x20must\x20be\x20an\x20absolute\x20path\x20without\x20a\x20trailing\x20slash');return _0x505ed9;}function p(_0x237f0f,_0x46afa8,_0x3b6174){let _0x5b954f=m(_0x46afa8),_0x1235ea=_0x3b6174==='list'?{'comments':{},'users':{}}:_0x3b6174==='add'?{'comment':void 0x0}:_0x3b6174==='reply'?{'reply':void 0x0}:{};h(_0x237f0f,_0x5b954f['status'],{'error':_0x5b954f['error'],..._0x1235ea});}function m(_0x42d467){if(_0x42d467 instanceof t['NodeTransportError'])return _0x42d467['code']==='REQUEST_BODY_TOO_LARGE'?{'status':0x19d,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x42d467['message']}}:_0x42d467['code']==='INVALID_JSON'||_0x42d467['code']==='REQUEST_ABORTED'?{'status':0x190,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x42d467['message']}}:{'status':0x1f7,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':_0x42d467['message']}};if(!(_0x42d467 instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20error'}};let [_0x4423b6,_0x24ee5b]=((()=>{switch(_0x42d467['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':_0x4423b6,'error':{'code':_0x24ee5b,'message':_0x42d467['message']}};}function h(_0x2fef1f,_0x1d80cc,_0x11b0ac){_0x2fef1f['writableEnded']||(_0x2fef1f['statusCode']=_0x1d80cc,_0x2fef1f['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x2fef1f['end'](JSON['stringify'](_0x11b0ac)));}exports['UniverCommentEndpoint']=i;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IUniverCommentService } from "@univerjs-pro/collaboration-comment-servi
|
|
|
2
2
|
import { ITrustedUnitRoomHost } from "@univerjs-pro/collaboration-endpoint";
|
|
3
3
|
import { NodeRouter, NodeTransportEndpoint } from "@univerjs-pro/collaboration-transport-node";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/endpoint.d.ts
|
|
6
6
|
interface UniverCommentEndpointOptions {
|
|
7
7
|
readonly service: IUniverCommentService;
|
|
8
8
|
readonly roomHost: ITrustedUnitRoomHost;
|
|
@@ -23,5 +23,4 @@ declare class UniverCommentEndpoint implements NodeTransportEndpoint {
|
|
|
23
23
|
private _handleHttp;
|
|
24
24
|
private _publish;
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
26
|
export { UniverCommentEndpoint, type UniverCommentEndpointOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x516f64=_0x5baf;function _0x5baf(_0x121da6,_0x1dd18a){_0x121da6=_0x121da6-0x1d4;const _0x3e550e=_0x3e55();let _0x5baf7c=_0x3e550e[_0x121da6];return _0x5baf7c;}(function(_0x46f69a,_0x29771c){const _0x40eba9=_0x5baf,_0x56249c=_0x46f69a();while(!![]){try{const _0x404969=-parseInt(_0x40eba9(0x1d7))/0x1*(parseInt(_0x40eba9(0x1d9))/0x2)+parseInt(_0x40eba9(0x1d4))/0x3+-parseInt(_0x40eba9(0x1dc))/0x4*(parseInt(_0x40eba9(0x1df))/0x5)+-parseInt(_0x40eba9(0x1de))/0x6*(parseInt(_0x40eba9(0x1d8))/0x7)+-parseInt(_0x40eba9(0x1e0))/0x8+-parseInt(_0x40eba9(0x1d5))/0x9*(parseInt(_0x40eba9(0x1dd))/0xa)+parseInt(_0x40eba9(0x1db))/0xb*(parseInt(_0x40eba9(0x1d6))/0xc);if(_0x404969===_0x29771c)break;else _0x56249c['push'](_0x56249c['shift']());}catch(_0x4d727a){_0x56249c['push'](_0x56249c['shift']());}}}(_0x3e55,0x22c1f));import _0x23d871 from'./index.cjs';const facadeExport0=_0x23d871[_0x516f64(0x1da)];export{facadeExport0 as UniverCommentEndpoint};function _0x3e55(){const _0xdb81b1=['76840OpHpZU','UniverCommentEndpoint','2431693fxfZKf','14568QHrfAF','40KyGwgq','306Oopcxw','230zyUlaI','1947024IRHcdb','575367nVNdMW','137322SOKAqK','36XkrWiv','3JHSWZI','17213yXCOhs'];_0x3e55=function(){return _0xdb81b1;};return _0x3e55();}
|
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.5.2",
|
|
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.5.2",
|
|
20
|
+
"@univerjs-pro/collaboration-endpoint": "1.5.2",
|
|
21
|
+
"@univerjs-pro/collaboration-service": "1.5.2",
|
|
22
|
+
"@univerjs-pro/collaboration-transport-node": "1.5.2",
|
|
23
|
+
"@univerjs/protocol": "1.5.2"
|
|
24
24
|
}
|
|
25
25
|
}
|