@univerjs-pro/collaboration-comment-endpoint 1.0.0-insiders.20260808-70eefdd → 1.0.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 ADDED
@@ -0,0 +1,65 @@
1
+ # @univerjs-pro/collaboration-comment-endpoint
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ A Univer Thread Comment HTTP and realtime Endpoint for `@univerjs-pro/collaboration-comment-service`.
6
+
7
+ It handles Univer Comment protocol requests with the Comment Service API and publishes `comment_update` to online members through the main Collaboration Endpoint's Unit rooms.
8
+
9
+ ```text
10
+ HTTP Comment request
11
+ → Transport authentication middleware
12
+ → UniverCommentEndpoint
13
+ → Comment Service middleware
14
+ → Comment Database Adapter
15
+
16
+ Comment commit succeeds
17
+ → main UniverCollabEndpoint Unit room
18
+ → comment_update
19
+ ```
20
+
21
+ ## Installation and registration
22
+
23
+ ```bash
24
+ pnpm add \
25
+ @univerjs-pro/collaboration-comment-service \
26
+ @univerjs-pro/collaboration-comment-endpoint \
27
+ @univerjs-pro/collaboration-endpoint \
28
+ @univerjs-pro/collaboration-transport-node
29
+ ```
30
+
31
+ ```ts
32
+ const collabEndpoint = new UniverCollabEndpoint(collabService);
33
+ const commentEndpoint = new UniverCommentEndpoint({
34
+ service: commentService,
35
+ roomHost: collabEndpoint,
36
+ protocolBasePath: '/universer-api',
37
+ });
38
+
39
+ transport.use(authenticationMiddleware);
40
+ transport.register(commentEndpoint);
41
+ transport.register(collabEndpoint);
42
+ ```
43
+
44
+ Registration order is authentication → Comment Endpoint → main Collaboration Endpoint. `roomHost` lets Comment realtime delivery reuse Sessions and Unit rooms already established by the main Endpoint.
45
+
46
+ ## HTTP and realtime updates
47
+
48
+ The table uses the default `protocolBasePath=/universer-api`:
49
+
50
+ | Method | Path | Service action | Session requirement |
51
+ | --- | --- | --- | --- |
52
+ | `GET/POST` | `/universer-api/comment/unit/:unitID/list` | `listComments` | No online Session required |
53
+ | `POST` | `/universer-api/comment/unit/:unitID/add` | `addComment` | User and `memberId` must match a joined Session |
54
+ | `POST` | `/universer-api/comment/unit/:unitID/reply` | `replyComment` | Same as above |
55
+ | `POST` | `/universer-api/comment/unit/:unitID/edit` | `editComment` | Same as above |
56
+ | `POST` | `/universer-api/comment/unit/:unitID/solved` | `setThreadSolved` | Must associate the current user with a joined Session |
57
+ | `POST` | `/universer-api/comment/unit/:unitID/delete` | `deleteComment` | User and `memberId` must match a joined Session |
58
+
59
+ Every route calls Comment Service with `ctx.userID/customData` set by Transport middleware for the current HTTP request. List is a regular HTTP read. Writes additionally associate an online Session so the submitter can be excluded from realtime broadcasts. Comment ACL remains controlled by Comment Service middleware.
60
+
61
+ After Comment Service commits successfully, Endpoint sends `comment_update` to other online members of the Unit. If the application calls Comment Service directly and its `memberID` resolves to an online Session, that Session is treated as the initiator and does not receive its own broadcast. If it cannot be resolved, the update is broadcast to all currently online members. The HTTP response does not depend on realtime delivery succeeding.
62
+
63
+ Endpoint handles protocol errors and realtime updates but does not define Comment ACL. Install permissions in Comment Service. Realtime broadcasts currently cover only one main Endpoint process. Send failure does not roll back committed Comments; clients recover by listing again.
64
+
65
+ Transport disposes registered Endpoints. Comment Endpoint does not own Comment Service or the main Endpoint.
@@ -0,0 +1,75 @@
1
+ # @univerjs-pro/collaboration-comment-endpoint
2
+
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
5
+ 面向 `@univerjs-pro/collaboration-comment-service` 的 Univer Thread Comment HTTP 和
6
+ 实时 Endpoint。
7
+
8
+ 它使用 Comment Service API 处理 Univer Comment 协议请求,并通过主协同 Endpoint 的 Unit
9
+ 房间向在线成员发布 `comment_update`。
10
+
11
+ ```text
12
+ HTTP Comment 请求
13
+ → Transport authentication middleware
14
+ → UniverCommentEndpoint
15
+ → Comment Service middleware
16
+ → Comment Database Adapter
17
+
18
+ Comment 提交成功
19
+ → 主 UniverCollabEndpoint 的 Unit room
20
+ → comment_update
21
+ ```
22
+
23
+ ## 安装与注册
24
+
25
+ ```bash
26
+ pnpm add \
27
+ @univerjs-pro/collaboration-comment-service \
28
+ @univerjs-pro/collaboration-comment-endpoint \
29
+ @univerjs-pro/collaboration-endpoint \
30
+ @univerjs-pro/collaboration-transport-node
31
+ ```
32
+
33
+ ```ts
34
+ const collabEndpoint = new UniverCollabEndpoint(collabService);
35
+ const commentEndpoint = new UniverCommentEndpoint({
36
+ service: commentService,
37
+ roomHost: collabEndpoint,
38
+ protocolBasePath: '/universer-api',
39
+ });
40
+
41
+ transport.use(authenticationMiddleware);
42
+ transport.register(commentEndpoint);
43
+ transport.register(collabEndpoint);
44
+ ```
45
+
46
+ 注册顺序是认证 → Comment Endpoint → 主协同 Endpoint。`roomHost` 让 Comment 实时投递
47
+ 复用主 Endpoint 已建立的 Session 和 Unit room。
48
+
49
+ ## HTTP 与实时更新
50
+
51
+ 下表使用默认 `protocolBasePath=/universer-api`:
52
+
53
+ | Method | Path | Service action | Session 要求 |
54
+ | --- | --- | --- | --- |
55
+ | `GET/POST` | `/universer-api/comment/unit/:unitID/list` | `listComments` | 不要求在线 Session |
56
+ | `POST` | `/universer-api/comment/unit/:unitID/add` | `addComment` | 用户和 `memberId` 必须对应已 JOIN 的 Session |
57
+ | `POST` | `/universer-api/comment/unit/:unitID/reply` | `replyComment` | 同上 |
58
+ | `POST` | `/universer-api/comment/unit/:unitID/edit` | `editComment` | 同上 |
59
+ | `POST` | `/universer-api/comment/unit/:unitID/solved` | `setThreadSolved` | 必须能关联当前用户已 JOIN 的 Session |
60
+ | `POST` | `/universer-api/comment/unit/:unitID/delete` | `deleteComment` | 用户和 `memberId` 必须对应已 JOIN 的 Session |
61
+
62
+ 所有路由都使用当前 HTTP 请求由 Transport middleware 设置的 `ctx.userID/customData` 调用
63
+ Comment Service。list 是普通 HTTP 读取;写操作额外关联在线 Session,以便把提交者从实时
64
+ 广播中排除。Comment ACL 仍由 Comment Service middleware 控制。
65
+
66
+ Comment Service 提交成功后,Endpoint 会向同一 Unit 的其他在线成员发送
67
+ `comment_update`。如果应用直接调用 Comment Service,并传入的 `memberID` 能找到在线
68
+ Session,该 Session 会被视为发起方而不接收自己的广播;找不到时则向当前全部在线成员
69
+ 广播。HTTP 返回结果本身不依赖实时发送成功。
70
+
71
+ Endpoint 只负责协议错误处理和实时更新,不定义 Comment ACL;权限必须安装在 Comment
72
+ Service。当前实时广播只覆盖单个主 Endpoint 进程,发送失败不回滚已提交的
73
+ Comment,客户端通过重新 list 恢复。
74
+
75
+ Transport 释放已注册 Endpoint;Comment Endpoint 不拥有 Comment Service 或主 Endpoint。
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('node:crypto'),t=require('@univerjs-pro/collaboration-service'),n=require('@univerjs-pro/collaboration-transport-node'),r=require('@univerjs/protocol');var i={'code':r['ErrorCode']['OK'],'message':''},a=class{['_service'];['_roomHost'];['_protocolBasePath'];['_subscription'];['_calls']=new Set();['_disposed']=!0x1;['_disposePromise'];constructor(_0x43b71d){if(!_0x43b71d?.['service'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20service');if(!_0x43b71d?.['roomHost'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20roomHost');this['_service']=_0x43b71d['service'],this['_roomHost']=_0x43b71d['roomHost'],this['_protocolBasePath']=h(_0x43b71d['protocolBasePath']??'/universer-api'),this['_subscription']=this['_service']['on']('commentCommitted',_0x32d21b=>this['_track'](this['_publish'](_0x32d21b)));}['handle'](_0x4aa9e8,_0x2f00a1){return this['_disposed']||_0x4aa9e8['kind']!=='http'?_0x2f00a1():this['_track'](this['_handleHttp'](_0x4aa9e8,_0x2f00a1));}['dispose'](){return this['_disposePromise']?this['_disposePromise']:(this['_disposed']=!0x0,this['_subscription']['dispose'](),this['_disposePromise']=Promise['allSettled']([...this['_calls']])['then'](()=>void 0x0),this['_disposePromise']);}['_track'](_0x3f6426){return this['_calls']['add'](_0x3f6426),_0x3f6426['finally'](()=>this['_calls']['delete'](_0x3f6426))['catch'](()=>void 0x0),_0x3f6426;}async['_handleHttp'](_0x2f969c,_0x575cd9){let _0x41f0de,_0x5eb709;try{_0x5eb709=new URL(_0x2f969c['incomingMessage']['url']??'/','http://localhost'),_0x41f0de=o(_0x2f969c['incomingMessage']['method'],_0x5eb709['pathname'],this['_protocolBasePath']);}catch(_0x450ea7){g(_0x2f969c['response'],_0x450ea7,'unknown');return;}if(!_0x41f0de)return _0x575cd9();try{if(!_0x2f969c['userId'])throw new t['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');if(_0x41f0de['action']==='list'){let _0x2ac151=s(_0x2f969c['incomingMessage']['method']==='GET'?{'unitId':_0x41f0de['unitID'],'threadId':_0x5eb709['searchParams']['getAll']('threadId')}:await _0x2f969c['readJson'](),_0x41f0de['unitID']),_0x153d03=await this['_service']['listComments']({'unitID':_0x41f0de['unitID'],'threadIDs':_0x2ac151['threadId']},{'session':p(_0x2f969c['userId']),'customData':_0x2f969c['customData']});v(_0x2f969c['response'],0xc8,{'error':i,..._0x153d03});return;}let _0x77ee41=c(await _0x2f969c['readJson']());if(l(_0x77ee41['unitId'],'unitId')!==_0x41f0de['unitID'])throw m('Route\x20and\x20body\x20unitId\x20must\x20match');let _0x3daf73=l(_0x77ee41['memberId'],'memberId'),_0x20caec={'session':this['_resolveWriteSession'](_0x41f0de['action'],_0x41f0de['unitID'],_0x3daf73,_0x2f969c['userId']),'customData':_0x2f969c['customData']};switch(_0x41f0de['action']){case'add':{let _0x468560=await this['_service']['addComment']({'unitID':_0x41f0de['unitID'],'content':l(_0x77ee41['content'],'content'),'mentions':d(_0x77ee41['mention'],'mention')},_0x20caec);v(_0x2f969c['response'],0xc8,{'error':i,'comment':_0x468560});return;}case'reply':{let _0x486fbb=await this['_service']['replyComment']({'unitID':_0x41f0de['unitID'],'threadID':l(_0x77ee41['threadId'],'threadId'),'content':l(_0x77ee41['content'],'content'),'mentions':d(_0x77ee41['mention'],'mention')},_0x20caec);v(_0x2f969c['response'],0xc8,{'error':i,'reply':_0x486fbb});return;}case'solved':{let _0x430ad8=f(_0x77ee41['solved']);await this['_service']['setThreadSolved']({'unitID':_0x41f0de['unitID'],'threadID':l(_0x77ee41['threadId'],'threadId'),'solved':_0x430ad8},_0x20caec),v(_0x2f969c['response'],0xc8,{'error':i});return;}case'edit':await this['_service']['editComment']({'unitID':_0x41f0de['unitID'],'threadID':l(_0x77ee41['threadId'],'threadId'),'replyID':l(_0x77ee41['replyId'],'replyId'),'content':l(_0x77ee41['content'],'content'),'mentions':d(_0x77ee41['mention'],'mention')},_0x20caec),v(_0x2f969c['response'],0xc8,{'error':i});return;case'delete':await this['_service']['deleteComment']({'unitID':_0x41f0de['unitID'],'threadID':l(_0x77ee41['threadId'],'threadId'),...u(_0x77ee41['replyId'],'replyId')},_0x20caec),v(_0x2f969c['response'],0xc8,{'error':i});return;}}catch(_0x1e46ad){g(_0x2f969c['response'],_0x1e46ad,_0x41f0de['action']);}}['_resolveWriteSession'](_0x248c69,_0x2788cd,_0x5d8436,_0x317061){let _0x23080b=this['_roomHost']['findJoinedSession']({'unitID':_0x2788cd,'memberID':_0x5d8436,'authenticatedUserID':_0x317061});if(_0x23080b)return _0x23080b;if(_0x248c69==='solved'&&_0x5d8436===_0x317061){let _0x3a292e=this['_roomHost']['findJoinedSessionByUser']({'unitID':_0x2788cd,'authenticatedUserID':_0x317061});if(_0x3a292e)return _0x3a292e;}throw new t['CollabError']('PERMISSION_DENIED','Comment\x20member\x20is\x20not\x20an\x20authenticated\x20joined\x20Session');}async['_publish'](_0x1d7a16){try{await this['_roomHost']['publishTrustedUnitEvent']({'unitID':_0x1d7a16['update']['unitId'],'origin':_0x1d7a16['session'],'eventID':'comment_update','data':{'commentUpdateEvent':_0x1d7a16['update']}});}catch{}}};function o(_0x4513eb,_0x4943a5,_0x16c695){let _0x2386cd=_0x16c695+'/comment/unit/';if(!_0x4943a5['startsWith'](_0x2386cd))return null;let _0x260d24=_0x4943a5['slice'](_0x2386cd['length'])['split']('/');if(_0x260d24['length']!==0x2||!_0x260d24[0x0]||!_0x260d24[0x1])return null;let _0x15a25f=_0x260d24[0x1];if(!['add','list','reply','solved','edit','delete']['includes'](_0x15a25f)||_0x15a25f==='list'&&_0x4513eb!=='GET'&&_0x4513eb!=='POST'||_0x15a25f!=='list'&&_0x4513eb!=='POST')return null;let _0x4ea4e6;try{_0x4ea4e6=decodeURIComponent(_0x260d24[0x0]);}catch{throw m('Route\x20contains\x20invalid\x20encoding');}if(!_0x4ea4e6||_0x4ea4e6['includes']('/'))throw m('Invalid\x20route\x20unitId');return{'action':_0x15a25f,'unitID':_0x4ea4e6};}function s(_0x50acca,_0x4922ff){let _0x3a3213=c(_0x50acca),_0x58cd64=l(_0x3a3213['unitId'],'unitId');if(_0x58cd64!==_0x4922ff)throw m('Route\x20and\x20body\x20unitId\x20must\x20match');return{'unitId':_0x58cd64,'threadId':d(_0x3a3213['threadId'],'threadId')};}function c(_0x390624){if(!_0x390624||typeof _0x390624!='object'||Array['isArray'](_0x390624))throw m('Request\x20body\x20must\x20be\x20an\x20object');return _0x390624;}function l(_0x3013c1,_0x232c51){if(typeof _0x3013c1!='string'||_0x3013c1['length']===0x0)throw m(_0x232c51+'\x20must\x20be\x20a\x20non-empty\x20string');return _0x3013c1;}function u(_0x13cab7,_0x5d9172){return _0x13cab7==null||_0x13cab7===''?{}:{'replyID':l(_0x13cab7,_0x5d9172)};}function d(_0x1d49f9,_0x89cde0){if(!Array['isArray'](_0x1d49f9)||_0x1d49f9['some'](_0x243853=>typeof _0x243853!='string'||_0x243853['length']===0x0))throw m(_0x89cde0+'\x20must\x20be\x20an\x20array\x20of\x20non-empty\x20strings');return[..._0x1d49f9];}function f(_0x2c1dac){if(_0x2c1dac!==r['CommentSolvedStatus']['OpenOrReOpen']&&_0x2c1dac!==r['CommentSolvedStatus']['Solved'])throw m('solved\x20must\x20be\x20OpenOrReOpen\x20or\x20Solved');return _0x2c1dac;}function p(_0x50aede){return{'memberId':'http-'+(0x0,e['randomUUID'])(),'userId':_0x50aede,'customData':Object['create'](null)};}function m(_0x141c91){return new t['CollabError']('INVALID_REQUEST',_0x141c91);}function h(_0x35c5a9){if(!_0x35c5a9['startsWith']('/')||_0x35c5a9==='/'||_0x35c5a9['endsWith']('/')||_0x35c5a9['includes']('//'))throw TypeError('protocolBasePath\x20must\x20be\x20an\x20absolute\x20path\x20without\x20a\x20trailing\x20slash');return _0x35c5a9;}function g(_0x2012ce,_0x10ea57,_0x288c57){let _0x43531f=_(_0x10ea57),_0x4e8bd3=_0x288c57==='list'?{'comments':{},'users':{}}:_0x288c57==='add'?{'comment':void 0x0}:_0x288c57==='reply'?{'reply':void 0x0}:{};v(_0x2012ce,_0x43531f['status'],{'error':_0x43531f['error'],..._0x4e8bd3});}function _(_0x39b9ea){if(_0x39b9ea instanceof n['NodeTransportError'])return _0x39b9ea['code']==='REQUEST_BODY_TOO_LARGE'?{'status':0x19d,'error':{'code':r['ErrorCode']['INVALID_ARGUMENT'],'message':_0x39b9ea['message']}}:_0x39b9ea['code']==='INVALID_JSON'||_0x39b9ea['code']==='REQUEST_ABORTED'?{'status':0x190,'error':{'code':r['ErrorCode']['INVALID_ARGUMENT'],'message':_0x39b9ea['message']}}:{'status':0x1f7,'error':{'code':r['ErrorCode']['INTERNAL_ERROR'],'message':_0x39b9ea['message']}};if(!(_0x39b9ea instanceof t['CollabError']))return{'status':0x1f4,'error':{'code':r['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20error'}};let [_0x8130c4,_0x1db4eb]=((()=>{switch(_0x39b9ea['code']){case'INVALID_REQUEST':return[0x190,r['ErrorCode']['INVALID_ARGUMENT']];case'UNAUTHENTICATED':return[0x191,r['ErrorCode']['UNAUTHENTICATED']];case'PERMISSION_DENIED':return[0x193,r['ErrorCode']['PERMISSION_DENIED']];case'UNIT_NOT_FOUND':return[0x194,r['ErrorCode']['NOT_FOUND']];case'ADAPTER_FAILURE':return[0x1f7,r['ErrorCode']['INTERNAL_ERROR']];default:return[0x1f4,r['ErrorCode']['INTERNAL_ERROR']];}})());return{'status':_0x8130c4,'error':{'code':_0x1db4eb,'message':_0x39b9ea['message']}};}function v(_0x529e7d,_0x3bc8fe,_0x54cfbc){_0x529e7d['writableEnded']||(_0x529e7d['statusCode']=_0x3bc8fe,_0x529e7d['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x529e7d['end'](JSON['stringify'](_0x54cfbc)));}exports['UniverCommentEndpoint']=a;
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(_0x268ab6){if(!_0x268ab6?.['service'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20service');if(!_0x268ab6?.['roomHost'])throw TypeError('UniverCommentEndpoint\x20requires\x20a\x20roomHost');this['_service']=_0x268ab6['service'],this['_roomHost']=_0x268ab6['roomHost'],this['_protocolBasePath']=f(_0x268ab6['protocolBasePath']??'/universer-api'),this['_subscription']=this['_service']['on']('commentCommitted',_0x2f0993=>this['_track'](this['_publish'](_0x2f0993)));}['register'](_0x5f2ea3){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x329a58=_0x164355=>_0x2d4b27=>this['_track'](this['_handleHttp'](_0x2d4b27,{'action':_0x164355,'unitID':_0x2d4b27['params']['unitID']}));for(let _0x5c8d76 of['add','list','reply','solved','edit','delete'])_0x5f2ea3['post'](this['_protocolBasePath']+'/comment/unit/:unitID/'+_0x5c8d76,_0x329a58(_0x5c8d76));_0x5f2ea3['get'](this['_protocolBasePath']+'/comment/unit/:unitID/list',_0x329a58('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'](_0x141a77){return this['_calls']['add'](_0x141a77),_0x141a77['finally'](()=>this['_calls']['delete'](_0x141a77))['catch'](()=>void 0x0),_0x141a77;}async['_handleHttp'](_0x4fb9d2,_0x444dfd){try{if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Comment\x20Endpoint\x20is\x20disposed');let _0x3d9397=new URL(_0x4fb9d2['incomingMessage']['url']??'/','http://localhost');if(!_0x444dfd['unitID']||_0x444dfd['unitID']['includes']('/'))throw d('Invalid\x20route\x20unitId');if(!_0x4fb9d2['userID'])throw new e['CollabError']('UNAUTHENTICATED','HTTP\x20user\x20is\x20not\x20authenticated');if(_0x444dfd['action']==='list'){let _0x3f2f7e=a(_0x4fb9d2['incomingMessage']['method']==='GET'?{'unitId':_0x444dfd['unitID'],'threadId':_0x3d9397['searchParams']['getAll']('threadId')}:await _0x4fb9d2['readJson'](),_0x444dfd['unitID']),_0x4f0bb2=await this['_service']['listComments']({'unitID':_0x444dfd['unitID'],'threadIDs':_0x3f2f7e['threadId']},{'userID':_0x4fb9d2['userID'],'customData':_0x4fb9d2['customData']});h(_0x4fb9d2['response'],0xc8,{'error':r,..._0x4f0bb2});return;}let _0x428c9f=o(await _0x4fb9d2['readJson']());if(s(_0x428c9f['unitId'],'unitId')!==_0x444dfd['unitID'])throw d('Route\x20and\x20body\x20unitId\x20must\x20match');let _0x1c5b3b=s(_0x428c9f['memberId'],'memberId'),_0x54a1a8=this['_resolveWriteSession'](_0x444dfd['action'],_0x444dfd['unitID'],_0x1c5b3b,_0x4fb9d2['userID']),_0x393c77={'userID':_0x4fb9d2['userID'],'memberID':_0x54a1a8['memberID'],'customData':_0x4fb9d2['customData']};switch(_0x444dfd['action']){case'add':{let _0x2027eb=await this['_service']['addComment']({'unitID':_0x444dfd['unitID'],'content':s(_0x428c9f['content'],'content'),'mentions':l(_0x428c9f['mention'],'mention')},_0x393c77);h(_0x4fb9d2['response'],0xc8,{'error':r,'comment':_0x2027eb});return;}case'reply':{let _0x135c0f=await this['_service']['replyComment']({'unitID':_0x444dfd['unitID'],'threadID':s(_0x428c9f['threadId'],'threadId'),'content':s(_0x428c9f['content'],'content'),'mentions':l(_0x428c9f['mention'],'mention')},_0x393c77);h(_0x4fb9d2['response'],0xc8,{'error':r,'reply':_0x135c0f});return;}case'solved':{let _0x28068a=u(_0x428c9f['solved']);await this['_service']['setThreadSolved']({'unitID':_0x444dfd['unitID'],'threadID':s(_0x428c9f['threadId'],'threadId'),'solved':_0x28068a},_0x393c77),h(_0x4fb9d2['response'],0xc8,{'error':r});return;}case'edit':await this['_service']['editComment']({'unitID':_0x444dfd['unitID'],'threadID':s(_0x428c9f['threadId'],'threadId'),'replyID':s(_0x428c9f['replyId'],'replyId'),'content':s(_0x428c9f['content'],'content'),'mentions':l(_0x428c9f['mention'],'mention')},_0x393c77),h(_0x4fb9d2['response'],0xc8,{'error':r});return;case'delete':await this['_service']['deleteComment']({'unitID':_0x444dfd['unitID'],'threadID':s(_0x428c9f['threadId'],'threadId'),...c(_0x428c9f['replyId'],'replyId')},_0x393c77),h(_0x4fb9d2['response'],0xc8,{'error':r});return;}}catch(_0x162875){p(_0x4fb9d2['response'],_0x162875,_0x444dfd['action']);}}['_resolveWriteSession'](_0xc4e0f1,_0x265510,_0x1ede8d,_0x5e0d88){let _0x3ed6f7=this['_roomHost']['findJoinedSession']({'unitID':_0x265510,'memberID':_0x1ede8d,'authenticatedUserID':_0x5e0d88});if(_0x3ed6f7)return _0x3ed6f7;if(_0xc4e0f1==='solved'&&_0x1ede8d===_0x5e0d88){let _0x2fd2d6=this['_roomHost']['findJoinedSessionByUser']({'unitID':_0x265510,'authenticatedUserID':_0x5e0d88});if(_0x2fd2d6)return _0x2fd2d6;}throw new e['CollabError']('PERMISSION_DENIED','Comment\x20member\x20is\x20not\x20an\x20authenticated\x20joined\x20Session');}async['_publish'](_0x4ce2e6){try{await this['_roomHost']['publishTrustedUnitEvent']({'unitID':_0x4ce2e6['update']['unitId'],'memberID':_0x4ce2e6['memberID'],'eventID':'comment_update','data':{'commentUpdateEvent':_0x4ce2e6['update']}});}catch{}}};function a(_0x470f63,_0x50a1f8){let _0x5f3cc2=o(_0x470f63),_0x3b845a=s(_0x5f3cc2['unitId'],'unitId');if(_0x3b845a!==_0x50a1f8)throw d('Route\x20and\x20body\x20unitId\x20must\x20match');return{'unitId':_0x3b845a,'threadId':l(_0x5f3cc2['threadId'],'threadId')};}function o(_0x22bab0){if(!_0x22bab0||typeof _0x22bab0!='object'||Array['isArray'](_0x22bab0))throw d('Request\x20body\x20must\x20be\x20an\x20object');return _0x22bab0;}function s(_0xbc4b6a,_0x3a24bd){if(typeof _0xbc4b6a!='string'||_0xbc4b6a['length']===0x0)throw d(_0x3a24bd+'\x20must\x20be\x20a\x20non-empty\x20string');return _0xbc4b6a;}function c(_0x540fc9,_0x4479d1){return _0x540fc9==null||_0x540fc9===''?{}:{'replyID':s(_0x540fc9,_0x4479d1)};}function l(_0x4fa6ba,_0x88d466){if(!Array['isArray'](_0x4fa6ba)||_0x4fa6ba['some'](_0x52b147=>typeof _0x52b147!='string'||_0x52b147['length']===0x0))throw d(_0x88d466+'\x20must\x20be\x20an\x20array\x20of\x20non-empty\x20strings');return[..._0x4fa6ba];}function u(_0x1dbfcc){if(_0x1dbfcc!==n['CommentSolvedStatus']['OpenOrReOpen']&&_0x1dbfcc!==n['CommentSolvedStatus']['Solved'])throw d('solved\x20must\x20be\x20OpenOrReOpen\x20or\x20Solved');return _0x1dbfcc;}function d(_0x328562){return new e['CollabError']('INVALID_REQUEST',_0x328562);}function f(_0x1d3ad3){if(!_0x1d3ad3['startsWith']('/')||_0x1d3ad3==='/'||_0x1d3ad3['endsWith']('/')||_0x1d3ad3['includes']('//'))throw TypeError('protocolBasePath\x20must\x20be\x20an\x20absolute\x20path\x20without\x20a\x20trailing\x20slash');return _0x1d3ad3;}function p(_0x4c2801,_0x3ee285,_0x4f6287){let _0x2343e3=m(_0x3ee285),_0x3434c6=_0x4f6287==='list'?{'comments':{},'users':{}}:_0x4f6287==='add'?{'comment':void 0x0}:_0x4f6287==='reply'?{'reply':void 0x0}:{};h(_0x4c2801,_0x2343e3['status'],{'error':_0x2343e3['error'],..._0x3434c6});}function m(_0x3be60b){if(_0x3be60b instanceof t['NodeTransportError'])return _0x3be60b['code']==='REQUEST_BODY_TOO_LARGE'?{'status':0x19d,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x3be60b['message']}}:_0x3be60b['code']==='INVALID_JSON'||_0x3be60b['code']==='REQUEST_ABORTED'?{'status':0x190,'error':{'code':n['ErrorCode']['INVALID_ARGUMENT'],'message':_0x3be60b['message']}}:{'status':0x1f7,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':_0x3be60b['message']}};if(!(_0x3be60b instanceof e['CollabError']))return{'status':0x1f4,'error':{'code':n['ErrorCode']['INTERNAL_ERROR'],'message':'Internal\x20error'}};let [_0x2ec08c,_0x359420]=((()=>{switch(_0x3be60b['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':_0x2ec08c,'error':{'code':_0x359420,'message':_0x3be60b['message']}};}function h(_0x2c995f,_0x1492c1,_0x1158b9){_0x2c995f['writableEnded']||(_0x2c995f['statusCode']=_0x1492c1,_0x2c995f['setHeader']('content-type','application/json;\x20charset=utf-8'),_0x2c995f['end'](JSON['stringify'](_0x1158b9)));}exports['UniverCommentEndpoint']=i;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IUniverCommentService } from "@univerjs-pro/collaboration-comment-service";
2
2
  import { ITrustedUnitRoomHost } from "@univerjs-pro/collaboration-endpoint";
3
- import { NodeTransportContext, NodeTransportMiddlewareObject, NodeTransportNext } from "@univerjs-pro/collaboration-transport-node";
3
+ import { NodeRouter, NodeTransportEndpoint } from "@univerjs-pro/collaboration-transport-node";
4
4
 
5
5
  //#region src/endpoint.d.ts
6
6
  interface UniverCommentEndpointOptions {
@@ -8,7 +8,7 @@ interface UniverCommentEndpointOptions {
8
8
  readonly roomHost: ITrustedUnitRoomHost;
9
9
  readonly protocolBasePath?: string;
10
10
  }
11
- declare class UniverCommentEndpoint implements NodeTransportMiddlewareObject {
11
+ declare class UniverCommentEndpoint implements NodeTransportEndpoint {
12
12
  private readonly _service;
13
13
  private readonly _roomHost;
14
14
  private readonly _protocolBasePath;
@@ -17,7 +17,7 @@ declare class UniverCommentEndpoint implements NodeTransportMiddlewareObject {
17
17
  private _disposed;
18
18
  private _disposePromise;
19
19
  constructor(options: UniverCommentEndpointOptions);
20
- handle(context: NodeTransportContext, next: NodeTransportNext): Promise<void>;
20
+ register(router: NodeRouter): void;
21
21
  dispose(): Promise<void>;
22
22
  private _track;
23
23
  private _handleHttp;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function _0x101b(){const _0x2eed1b=['409624IjNvHE','3846535IHRaJN','11306nNheSp','3vYuOlM','164028dtuTRk','100SWjMeA','45RTZOBI','175QbbYus','9353070juCXSX','9284InSwnY','969622YMfiHr'];_0x101b=function(){return _0x2eed1b;};return _0x101b();}(function(_0x47b901,_0x5f5341){const _0x1434d7=_0x3cd6,_0x48b356=_0x47b901();while(!![]){try{const _0x4ae0aa=parseInt(_0x1434d7(0x1d5))/0x1+-parseInt(_0x1434d7(0x1d2))/0x2*(parseInt(_0x1434d7(0x1d6))/0x3)+-parseInt(_0x1434d7(0x1d1))/0x4*(parseInt(_0x1434d7(0x1d8))/0x5)+-parseInt(_0x1434d7(0x1d7))/0x6*(-parseInt(_0x1434d7(0x1cf))/0x7)+parseInt(_0x1434d7(0x1d3))/0x8*(-parseInt(_0x1434d7(0x1d9))/0x9)+parseInt(_0x1434d7(0x1d0))/0xa+-parseInt(_0x1434d7(0x1d4))/0xb;if(_0x4ae0aa===_0x5f5341)break;else _0x48b356['push'](_0x48b356['shift']());}catch(_0x31f1fb){_0x48b356['push'](_0x48b356['shift']());}}}(_0x101b,0x7864c));import _0x3ec0bf from'./index.cjs';function _0x3cd6(_0x13c525,_0x2b0e22){_0x13c525=_0x13c525-0x1cf;const _0x101b16=_0x101b();let _0x3cd682=_0x101b16[_0x13c525];return _0x3cd682;}const facadeExport0=_0x3ec0bf['UniverCommentEndpoint'];export{facadeExport0 as UniverCommentEndpoint};
1
+ function _0x52f1(_0x5f4e19,_0x4ec737){_0x5f4e19=_0x5f4e19-0x6e;const _0x9bca4a=_0x9bca();let _0x52f18c=_0x9bca4a[_0x5f4e19];return _0x52f18c;}function _0x9bca(){const _0xd1afb4=['42DfgAUx','8150424bIpfQE','4867767jfynih','30426737pHgukF','20EViQtv','5pwluuR','7WHUqZP','30645qQEQiB','428046AAiKGy','1633140jbobfD','1537652GjiClN'];_0x9bca=function(){return _0xd1afb4;};return _0x9bca();}(function(_0x110ba9,_0x253e69){const _0x27f239=_0x52f1,_0x2e7b84=_0x110ba9();while(!![]){try{const _0x146de1=-parseInt(_0x27f239(0x77))/0x1*(parseInt(_0x27f239(0x6f))/0x2)+parseInt(_0x27f239(0x70))/0x3+parseInt(_0x27f239(0x71))/0x4+parseInt(_0x27f239(0x6e))/0x5*(parseInt(_0x27f239(0x72))/0x6)+parseInt(_0x27f239(0x78))/0x7*(-parseInt(_0x27f239(0x73))/0x8)+-parseInt(_0x27f239(0x74))/0x9*(parseInt(_0x27f239(0x76))/0xa)+parseInt(_0x27f239(0x75))/0xb;if(_0x146de1===_0x253e69)break;else _0x2e7b84['push'](_0x2e7b84['shift']());}catch(_0x334ce4){_0x2e7b84['push'](_0x2e7b84['shift']());}}}(_0x9bca,0x8a74f));import _0x321cc8 from'./index.cjs';const facadeExport0=_0x321cc8['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.0.0-insiders.20260808-70eefdd",
4
+ "version": "1.0.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -16,13 +16,10 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@univerjs-pro/collaboration-comment-service": "1.0.0-insiders.20260808-70eefdd",
20
- "@univerjs-pro/collaboration-endpoint": "1.0.0-insiders.20260808-70eefdd",
21
- "@univerjs-pro/collaboration-service": "1.0.0-insiders.20260808-70eefdd",
22
- "@univerjs-pro/collaboration-transport-node": "1.0.0-insiders.20260808-70eefdd",
23
- "@univerjs/protocol": "1.0.0-insiders.20260808-70eefdd"
24
- },
25
- "publishConfig": {
26
- "access": "public"
19
+ "@univerjs-pro/collaboration-comment-service": "1.0.0",
20
+ "@univerjs-pro/collaboration-endpoint": "1.0.0",
21
+ "@univerjs-pro/collaboration-service": "1.0.0",
22
+ "@univerjs-pro/collaboration-transport-node": "1.0.0",
23
+ "@univerjs/protocol": "1.0.0"
27
24
  }
28
- }
25
+ }