@univerjs-pro/collaboration-comment-database-memory 1.0.0-insiders.20260805-b15e7f3 → 1.0.0-rc.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,23 @@
1
+ # @univerjs-pro/collaboration-comment-database-memory
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ An in-process `ICommentDatabaseAdapter` for tests, local development, and temporary Thread Comment Services.
6
+
7
+ ```bash
8
+ pnpm add \
9
+ @univerjs-pro/collaboration-comment-service \
10
+ @univerjs-pro/collaboration-comment-database-memory
11
+ ```
12
+
13
+ ```ts
14
+ const database = new MemoryCommentDatabaseAdapter();
15
+ const commentService = new UniverCommentService({ database });
16
+
17
+ await commentService.dispose();
18
+ await database.dispose();
19
+ ```
20
+
21
+ The Adapter serializes operations per Unit and implements the same concurrency-version checks as the SQLite Adapter.
22
+
23
+ All comments are lost when the process exits, and state is not shared between Node.js processes. Use SQLite or another persistent Adapter for persistent production data.
@@ -0,0 +1,24 @@
1
+ # @univerjs-pro/collaboration-comment-database-memory
2
+
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
5
+ 进程内 `ICommentDatabaseAdapter`,适合测试、本地开发和临时 Thread Comment Service。
6
+
7
+ ```bash
8
+ pnpm add \
9
+ @univerjs-pro/collaboration-comment-service \
10
+ @univerjs-pro/collaboration-comment-database-memory
11
+ ```
12
+
13
+ ```ts
14
+ const database = new MemoryCommentDatabaseAdapter();
15
+ const commentService = new UniverCommentService({ database });
16
+
17
+ await commentService.dispose();
18
+ await database.dispose();
19
+ ```
20
+
21
+ Adapter 按 Unit 串行操作,并实现与 SQLite Adapter 相同的并发版本检查。
22
+
23
+ 进程退出后所有评论丢失,多个 Node.js 进程也不共享状态。持久化生产数据应使用 SQLite
24
+ 或其他持久化 Adapter。
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('node:crypto'),t=require('@univerjs/protocol');var n=class{['_units']=new Map();['_queues']=new Map();['_calls']=new Set();['_state']='running';['_disposePromise'];['createRoot'](_0x3f5fbd,_0x3d0e19){return this['_call'](()=>this['_enqueue'](_0x3f5fbd['unitID'],()=>{let _0x3a45bf=this['_unit'](_0x3f5fbd['unitID']);if(_0x3a45bf['has'](_0x3f5fbd['threadID']))return{'status':'duplicate'};let _0x28ecfc=Date['now'](),_0x58255e={..._0x3f5fbd,'replyID':_0x3f5fbd['threadID'],'mentions':[..._0x3f5fbd['mentions']],'solved':t['CommentSolvedStatus']['OpenOrReOpen'],'createdAt':_0x28ecfc,'updatedAt':_0x28ecfc,'generation':(0x0,e['randomUUID'])()};return _0x3a45bf['set'](_0x58255e['replyID'],_0x58255e),{'status':'created','record':r(_0x58255e)};}));}['createReply'](_0x5e41f4,_0x3e097e){return this['_call'](()=>this['_enqueue'](_0x5e41f4['unitID'],()=>{let _0x40ff38=this['_unit'](_0x5e41f4['unitID']);if(_0x40ff38['has'](_0x5e41f4['replyID']))return{'status':'duplicate'};let _0x81e853=_0x40ff38['get'](_0x5e41f4['threadID']);if(!_0x81e853||_0x81e853['replyID']!==_0x81e853['threadID'])return{'status':'not-found'};if(_0x81e853['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};let _0x1171c2=Date['now'](),_0x56d020={..._0x5e41f4,'mentions':[..._0x5e41f4['mentions']],'solved':_0x81e853['solved'],'createdAt':_0x1171c2,'updatedAt':_0x1171c2,'generation':(0x0,e['randomUUID'])()};return _0x40ff38['set'](_0x56d020['replyID'],_0x56d020),{'status':'created','record':r(_0x56d020)};}));}['getComment'](_0x527c98,_0xb7594e){return this['_call'](()=>this['_enqueue'](_0x527c98['unitID'],()=>{let _0x413802=this['_units']['get'](_0x527c98['unitID'])?.['get'](_0x527c98['replyID']);return _0x413802?.['threadID']===_0x527c98['threadID']?r(_0x413802):null;}));}['listThreads'](_0x1f8d3f,_0x20b78e){return this['_call'](()=>this['_enqueue'](_0x1f8d3f['unitID'],()=>{let _0x119fdd=new Set(_0x1f8d3f['threadIDs']);return[...this['_units']['get'](_0x1f8d3f['unitID'])?.['values']()??[]]['filter'](_0x57fcf5=>_0x119fdd['size']===0x0||_0x119fdd['has'](_0x57fcf5['threadID']))['sort'](i)['map'](r);}));}['editComment'](_0x4c5deb,_0x2c95a3){return this['_call'](()=>this['_enqueue'](_0x4c5deb['unitID'],()=>{let _0x47ab41=this['_units']['get'](_0x4c5deb['unitID']),_0x177d9c=_0x47ab41?.['get'](_0x4c5deb['replyID']),_0x2ff930=_0x47ab41?.['get'](_0x4c5deb['threadID']);if(!_0x177d9c||_0x177d9c['threadID']!==_0x4c5deb['threadID']||!_0x2ff930)return{'status':'not-found'};if(_0x2ff930['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};if(_0x177d9c['authorUserID']!==_0x4c5deb['expectedAuthorUserID'])return{'status':'author-mismatch'};if(_0x177d9c['content']===_0x4c5deb['content']&&a(_0x177d9c['mentions'],_0x4c5deb['mentions']))return{'status':'unchanged','record':r(_0x177d9c)};let _0xcaef26={..._0x177d9c,'content':_0x4c5deb['content'],'mentions':[..._0x4c5deb['mentions']],'updatedAt':Math['max'](Date['now'](),_0x177d9c['updatedAt']+0x1)};return _0x47ab41['set'](_0x4c5deb['replyID'],_0xcaef26),{'status':'edited','record':r(_0xcaef26)};}));}['setThreadSolved'](_0x1c0381,_0x59cab9){return this['_call'](()=>this['_enqueue'](_0x1c0381['unitID'],()=>{let _0x45a88f=this['_units']['get'](_0x1c0381['unitID']),_0x2b4cf6=_0x45a88f?.['get'](_0x1c0381['threadID']);return!_0x2b4cf6||_0x2b4cf6['replyID']!==_0x2b4cf6['threadID']?{'status':'not-found'}:_0x2b4cf6['solved']===_0x1c0381['solved']?{'status':'unchanged'}:(_0x45a88f['set'](_0x1c0381['threadID'],{..._0x2b4cf6,'solved':_0x1c0381['solved'],'updatedAt':Math['max'](Date['now'](),_0x2b4cf6['updatedAt']+0x1)}),{'status':'updated'});}));}['deleteComment'](_0x50dd15,_0x3ea196){return this['_call'](()=>this['_enqueue'](_0x50dd15['unitID'],()=>{let _0x53f49e=this['_units']['get'](_0x50dd15['unitID']),_0x52d51d=_0x50dd15['replyID']??_0x50dd15['threadID'],_0x1f31d4=_0x53f49e?.['get'](_0x52d51d);if(!_0x1f31d4||_0x1f31d4['threadID']!==_0x50dd15['threadID'])return{'status':'not-found'};if(_0x1f31d4['generation']!==_0x50dd15['expectedGeneration'])return{'status':'generation-mismatch'};if(_0x50dd15['replyID']===void 0x0){for(let [_0x3044e2,_0x625e83]of _0x53f49e)_0x625e83['threadID']===_0x50dd15['threadID']&&_0x53f49e['delete'](_0x3044e2);}else _0x53f49e['delete'](_0x50dd15['replyID']);return _0x53f49e['size']===0x0&&this['_units']['delete'](_0x50dd15['unitID']),{'status':'deleted'};}));}['dispose'](){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=((async()=>{await Promise['allSettled']([...this['_calls']]),this['_queues']['clear'](),this['_state']='disposed';})()),this['_disposePromise']);}['_unit'](_0x4a294e){let _0x50ed4=this['_units']['get'](_0x4a294e);if(_0x50ed4)return _0x50ed4;let _0xf130a3=new Map();return this['_units']['set'](_0x4a294e,_0xf130a3),_0xf130a3;}['_enqueue'](_0x9bccde,_0x1f9b6b){let _0x4512a1=(this['_queues']['get'](_0x9bccde)??Promise['resolve']())['catch'](()=>void 0x0)['then'](_0x1f9b6b),_0x5cce76=_0x4512a1['then'](()=>void 0x0,()=>void 0x0);return this['_queues']['set'](_0x9bccde,_0x5cce76),_0x5cce76['finally'](()=>{this['_queues']['get'](_0x9bccde)===_0x5cce76&&this['_queues']['delete'](_0x9bccde);}),_0x4512a1;}['_call'](_0x32291a){if(this['_state']!=='running')return Promise['reject'](Error('Memory\x20Comment\x20Database\x20Adapter\x20is\x20'+this['_state']));let _0x3207c5=_0x32291a();return this['_calls']['add'](_0x3207c5),_0x3207c5['finally'](()=>this['_calls']['delete'](_0x3207c5))['catch'](()=>void 0x0),_0x3207c5;}};function r(_0x2075f7){return{..._0x2075f7,'mentions':[..._0x2075f7['mentions']]};}function i(_0x4547e4,_0x5bc770){let _0x1075d0=_0x4547e4['threadID']['localeCompare'](_0x5bc770['threadID']);return _0x1075d0===0x0?_0x4547e4['replyID']===_0x4547e4['threadID']?-0x1:_0x5bc770['replyID']===_0x5bc770['threadID']?0x1:_0x4547e4['createdAt']-_0x5bc770['createdAt']||_0x4547e4['replyID']['localeCompare'](_0x5bc770['replyID']):_0x1075d0;}function a(_0x28673d,_0x5aad51){return _0x28673d['length']===_0x5aad51['length']&&_0x28673d['every']((_0x10e093,_0x5b88c8)=>_0x10e093===_0x5aad51[_0x5b88c8]);}exports['MemoryCommentDatabaseAdapter']=n;
1
+ Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('node:crypto'),t=require('@univerjs/protocol');var n=class{['_units']=new Map();['_queues']=new Map();['_calls']=new Set();['_state']='running';['_disposePromise'];['createRoot'](_0x5be4b8,_0x4e930a){return this['_call'](()=>this['_enqueue'](_0x5be4b8['unitID'],()=>{let _0x455210=this['_unit'](_0x5be4b8['unitID']);if(_0x455210['has'](_0x5be4b8['threadID']))return{'status':'duplicate'};let _0x40be39=Date['now'](),_0x1f3e2f={..._0x5be4b8,'replyID':_0x5be4b8['threadID'],'mentions':[..._0x5be4b8['mentions']],'solved':t['CommentSolvedStatus']['OpenOrReOpen'],'createdAt':_0x40be39,'updatedAt':_0x40be39,'generation':(0x0,e['randomUUID'])()};return _0x455210['set'](_0x1f3e2f['replyID'],_0x1f3e2f),{'status':'created','record':r(_0x1f3e2f)};}));}['createReply'](_0x121c7f,_0x58344e){return this['_call'](()=>this['_enqueue'](_0x121c7f['unitID'],()=>{let _0x5e17ff=this['_unit'](_0x121c7f['unitID']);if(_0x5e17ff['has'](_0x121c7f['replyID']))return{'status':'duplicate'};let _0x46990e=_0x5e17ff['get'](_0x121c7f['threadID']);if(!_0x46990e||_0x46990e['replyID']!==_0x46990e['threadID'])return{'status':'not-found'};if(_0x46990e['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};let _0x5b826c=Date['now'](),_0x16f521={..._0x121c7f,'mentions':[..._0x121c7f['mentions']],'solved':_0x46990e['solved'],'createdAt':_0x5b826c,'updatedAt':_0x5b826c,'generation':(0x0,e['randomUUID'])()};return _0x5e17ff['set'](_0x16f521['replyID'],_0x16f521),{'status':'created','record':r(_0x16f521)};}));}['getComment'](_0x2c4e34,_0x43f220){return this['_call'](()=>this['_enqueue'](_0x2c4e34['unitID'],()=>{let _0xf41f73=this['_units']['get'](_0x2c4e34['unitID'])?.['get'](_0x2c4e34['replyID']);return _0xf41f73?.['threadID']===_0x2c4e34['threadID']?r(_0xf41f73):null;}));}['listThreads'](_0x2ff58d,_0x25660a){return this['_call'](()=>this['_enqueue'](_0x2ff58d['unitID'],()=>{let _0x4901d4=new Set(_0x2ff58d['threadIDs']);return[...this['_units']['get'](_0x2ff58d['unitID'])?.['values']()??[]]['filter'](_0x50501d=>_0x4901d4['size']===0x0||_0x4901d4['has'](_0x50501d['threadID']))['sort'](i)['map'](r);}));}['editComment'](_0x2189df,_0x45c591){return this['_call'](()=>this['_enqueue'](_0x2189df['unitID'],()=>{let _0x3b6bf3=this['_units']['get'](_0x2189df['unitID']),_0x5cec17=_0x3b6bf3?.['get'](_0x2189df['replyID']),_0x240295=_0x3b6bf3?.['get'](_0x2189df['threadID']);if(!_0x5cec17||_0x5cec17['threadID']!==_0x2189df['threadID']||!_0x240295)return{'status':'not-found'};if(_0x240295['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};if(_0x5cec17['authorUserID']!==_0x2189df['expectedAuthorUserID'])return{'status':'author-mismatch'};if(_0x5cec17['content']===_0x2189df['content']&&a(_0x5cec17['mentions'],_0x2189df['mentions']))return{'status':'unchanged','record':r(_0x5cec17)};let _0x204e94={..._0x5cec17,'content':_0x2189df['content'],'mentions':[..._0x2189df['mentions']],'updatedAt':Math['max'](Date['now'](),_0x5cec17['updatedAt']+0x1)};return _0x3b6bf3['set'](_0x2189df['replyID'],_0x204e94),{'status':'edited','record':r(_0x204e94)};}));}['setThreadSolved'](_0x39844b,_0x215603){return this['_call'](()=>this['_enqueue'](_0x39844b['unitID'],()=>{let _0x1046a6=this['_units']['get'](_0x39844b['unitID']),_0x444df1=_0x1046a6?.['get'](_0x39844b['threadID']);return!_0x444df1||_0x444df1['replyID']!==_0x444df1['threadID']?{'status':'not-found'}:_0x444df1['solved']===_0x39844b['solved']?{'status':'unchanged'}:(_0x1046a6['set'](_0x39844b['threadID'],{..._0x444df1,'solved':_0x39844b['solved'],'updatedAt':Math['max'](Date['now'](),_0x444df1['updatedAt']+0x1)}),{'status':'updated'});}));}['deleteComment'](_0x276570,_0x41bad9){return this['_call'](()=>this['_enqueue'](_0x276570['unitID'],()=>{let _0x3d0617=this['_units']['get'](_0x276570['unitID']),_0x1225ce=_0x276570['replyID']??_0x276570['threadID'],_0x565221=_0x3d0617?.['get'](_0x1225ce);if(!_0x565221||_0x565221['threadID']!==_0x276570['threadID'])return{'status':'not-found'};if(_0x565221['generation']!==_0x276570['expectedGeneration'])return{'status':'generation-mismatch'};if(_0x276570['replyID']===void 0x0){for(let [_0x3c4892,_0x4c1c1f]of _0x3d0617)_0x4c1c1f['threadID']===_0x276570['threadID']&&_0x3d0617['delete'](_0x3c4892);}else _0x3d0617['delete'](_0x276570['replyID']);return _0x3d0617['size']===0x0&&this['_units']['delete'](_0x276570['unitID']),{'status':'deleted'};}));}['dispose'](){return this['_disposePromise']?this['_disposePromise']:(this['_state']='disposing',this['_disposePromise']=((async()=>{await Promise['allSettled']([...this['_calls']]),this['_queues']['clear'](),this['_state']='disposed';})()),this['_disposePromise']);}['_unit'](_0x2d7088){let _0x3d1ae6=this['_units']['get'](_0x2d7088);if(_0x3d1ae6)return _0x3d1ae6;let _0x15a541=new Map();return this['_units']['set'](_0x2d7088,_0x15a541),_0x15a541;}['_enqueue'](_0x5607ab,_0x5a284b){let _0x7b0e44=(this['_queues']['get'](_0x5607ab)??Promise['resolve']())['catch'](()=>void 0x0)['then'](_0x5a284b),_0x186f61=_0x7b0e44['then'](()=>void 0x0,()=>void 0x0);return this['_queues']['set'](_0x5607ab,_0x186f61),_0x186f61['finally'](()=>{this['_queues']['get'](_0x5607ab)===_0x186f61&&this['_queues']['delete'](_0x5607ab);}),_0x7b0e44;}['_call'](_0x428204){if(this['_state']!=='running')return Promise['reject'](Error('Memory\x20Comment\x20Database\x20Adapter\x20is\x20'+this['_state']));let _0x30eeab=_0x428204();return this['_calls']['add'](_0x30eeab),_0x30eeab['finally'](()=>this['_calls']['delete'](_0x30eeab))['catch'](()=>void 0x0),_0x30eeab;}};function r(_0xb5fdd){return{..._0xb5fdd,'mentions':[..._0xb5fdd['mentions']]};}function i(_0x590fbc,_0x44c578){let _0x110e60=_0x590fbc['threadID']['localeCompare'](_0x44c578['threadID']);return _0x110e60===0x0?_0x590fbc['replyID']===_0x590fbc['threadID']?-0x1:_0x44c578['replyID']===_0x44c578['threadID']?0x1:_0x590fbc['createdAt']-_0x44c578['createdAt']||_0x590fbc['replyID']['localeCompare'](_0x44c578['replyID']):_0x110e60;}function a(_0x539616,_0x12a8c4){return _0x539616['length']===_0x12a8c4['length']&&_0x539616['every']((_0x31fc30,_0x4f7068)=>_0x31fc30===_0x12a8c4[_0x4f7068]);}exports['MemoryCommentDatabaseAdapter']=n;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function _0x3860(_0x1aab14,_0x5a28cf){_0x1aab14=_0x1aab14-0xf3;const _0xdacfa2=_0xdacf();let _0x386032=_0xdacfa2[_0x1aab14];return _0x386032;}const _0x9ad655=_0x3860;(function(_0x426a68,_0xdef80c){const _0x730f47=_0x3860,_0xd286af=_0x426a68();while(!![]){try{const _0xf054a4=-parseInt(_0x730f47(0xf5))/0x1+-parseInt(_0x730f47(0xf4))/0x2+parseInt(_0x730f47(0xf3))/0x3*(-parseInt(_0x730f47(0xf7))/0x4)+parseInt(_0x730f47(0xfe))/0x5*(parseInt(_0x730f47(0xf6))/0x6)+-parseInt(_0x730f47(0xf9))/0x7*(parseInt(_0x730f47(0xfd))/0x8)+-parseInt(_0x730f47(0xfa))/0x9*(parseInt(_0x730f47(0xfc))/0xa)+parseInt(_0x730f47(0xfb))/0xb;if(_0xf054a4===_0xdef80c)break;else _0xd286af['push'](_0xd286af['shift']());}catch(_0x561bdb){_0xd286af['push'](_0xd286af['shift']());}}}(_0xdacf,0x8ff8a));import _0x5ac534 from'./index.cjs';function _0xdacf(){const _0x1b9741=['1281752VsPAQe','648131kPVpLa','282bAjcqW','8hAtEPI','MemoryCommentDatabaseAdapter','14aIYBmL','6521535ZZUMig','41880212gnlZkD','10miysyS','1883840wIyfTl','37910GSYVbB','1634037hPeldd'];_0xdacf=function(){return _0x1b9741;};return _0xdacf();}const facadeExport0=_0x5ac534[_0x9ad655(0xf8)];export{facadeExport0 as MemoryCommentDatabaseAdapter};
1
+ (function(_0x3b7196,_0x38ea0f){const _0x43757f=_0x7e60,_0x92411=_0x3b7196();while(!![]){try{const _0x277aaf=parseInt(_0x43757f(0xb5))/0x1+-parseInt(_0x43757f(0xb9))/0x2+-parseInt(_0x43757f(0xb8))/0x3+parseInt(_0x43757f(0xba))/0x4*(parseInt(_0x43757f(0xbd))/0x5)+parseInt(_0x43757f(0xbc))/0x6*(-parseInt(_0x43757f(0xbb))/0x7)+parseInt(_0x43757f(0xb7))/0x8+parseInt(_0x43757f(0xb6))/0x9;if(_0x277aaf===_0x38ea0f)break;else _0x92411['push'](_0x92411['shift']());}catch(_0xb681f5){_0x92411['push'](_0x92411['shift']());}}}(_0x2d32,0x766a5));function _0x2d32(){const _0x5567c4=['235998eMIxqY','150kfYPIG','3018485Kbcbgp','674898xaNECG','9804996tAdXDA','2149688mJnFse','1511349zLidws','1610176hsxqQr','4YjRrwO'];_0x2d32=function(){return _0x5567c4;};return _0x2d32();}import _0x50741a from'./index.cjs';function _0x7e60(_0x27e8d6,_0x4b0bc0){_0x27e8d6=_0x27e8d6-0xb5;const _0x2d32eb=_0x2d32();let _0x7e604c=_0x2d32eb[_0x27e8d6];return _0x7e604c;}const facadeExport0=_0x50741a['MemoryCommentDatabaseAdapter'];export{facadeExport0 as MemoryCommentDatabaseAdapter};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univerjs-pro/collaboration-comment-database-memory",
3
3
  "type": "module",
4
- "version": "1.0.0-insiders.20260805-b15e7f3",
4
+ "version": "1.0.0-rc.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
@@ -16,10 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@univerjs-pro/collaboration-comment-service": "1.0.0-insiders.20260805-b15e7f3",
20
- "@univerjs/protocol": "1.0.0-insiders.20260805-b15e7f3"
21
- },
22
- "publishConfig": {
23
- "access": "public"
19
+ "@univerjs-pro/collaboration-comment-service": "1.0.0-rc.0",
20
+ "@univerjs/protocol": "1.0.0-rc.0"
24
21
  }
25
- }
22
+ }