@univerjs-pro/collaboration-comment-database-memory 1.0.0-insiders.20260808-70eefdd → 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'](_0xe4754a,_0x854b26){return this['_call'](()=>this['_enqueue'](_0xe4754a['unitID'],()=>{let _0x5862d7=this['_unit'](_0xe4754a['unitID']);if(_0x5862d7['has'](_0xe4754a['threadID']))return{'status':'duplicate'};let _0x52bdd9=Date['now'](),_0x26450a={..._0xe4754a,'replyID':_0xe4754a['threadID'],'mentions':[..._0xe4754a['mentions']],'solved':t['CommentSolvedStatus']['OpenOrReOpen'],'createdAt':_0x52bdd9,'updatedAt':_0x52bdd9,'generation':(0x0,e['randomUUID'])()};return _0x5862d7['set'](_0x26450a['replyID'],_0x26450a),{'status':'created','record':r(_0x26450a)};}));}['createReply'](_0x533bf5,_0x311747){return this['_call'](()=>this['_enqueue'](_0x533bf5['unitID'],()=>{let _0x4ca848=this['_unit'](_0x533bf5['unitID']);if(_0x4ca848['has'](_0x533bf5['replyID']))return{'status':'duplicate'};let _0x515cc1=_0x4ca848['get'](_0x533bf5['threadID']);if(!_0x515cc1||_0x515cc1['replyID']!==_0x515cc1['threadID'])return{'status':'not-found'};if(_0x515cc1['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};let _0x297ca6=Date['now'](),_0x25922d={..._0x533bf5,'mentions':[..._0x533bf5['mentions']],'solved':_0x515cc1['solved'],'createdAt':_0x297ca6,'updatedAt':_0x297ca6,'generation':(0x0,e['randomUUID'])()};return _0x4ca848['set'](_0x25922d['replyID'],_0x25922d),{'status':'created','record':r(_0x25922d)};}));}['getComment'](_0x471db7,_0x528105){return this['_call'](()=>this['_enqueue'](_0x471db7['unitID'],()=>{let _0x4549b3=this['_units']['get'](_0x471db7['unitID'])?.['get'](_0x471db7['replyID']);return _0x4549b3?.['threadID']===_0x471db7['threadID']?r(_0x4549b3):null;}));}['listThreads'](_0x1d8016,_0x409762){return this['_call'](()=>this['_enqueue'](_0x1d8016['unitID'],()=>{let _0x577f86=new Set(_0x1d8016['threadIDs']);return[...this['_units']['get'](_0x1d8016['unitID'])?.['values']()??[]]['filter'](_0x574712=>_0x577f86['size']===0x0||_0x577f86['has'](_0x574712['threadID']))['sort'](i)['map'](r);}));}['editComment'](_0x277065,_0x14ac4d){return this['_call'](()=>this['_enqueue'](_0x277065['unitID'],()=>{let _0x31be4a=this['_units']['get'](_0x277065['unitID']),_0x50c35=_0x31be4a?.['get'](_0x277065['replyID']),_0x51a0bf=_0x31be4a?.['get'](_0x277065['threadID']);if(!_0x50c35||_0x50c35['threadID']!==_0x277065['threadID']||!_0x51a0bf)return{'status':'not-found'};if(_0x51a0bf['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};if(_0x50c35['authorUserID']!==_0x277065['expectedAuthorUserID'])return{'status':'author-mismatch'};if(_0x50c35['content']===_0x277065['content']&&a(_0x50c35['mentions'],_0x277065['mentions']))return{'status':'unchanged','record':r(_0x50c35)};let _0x4418ec={..._0x50c35,'content':_0x277065['content'],'mentions':[..._0x277065['mentions']],'updatedAt':Math['max'](Date['now'](),_0x50c35['updatedAt']+0x1)};return _0x31be4a['set'](_0x277065['replyID'],_0x4418ec),{'status':'edited','record':r(_0x4418ec)};}));}['setThreadSolved'](_0x589dd4,_0x4d95e8){return this['_call'](()=>this['_enqueue'](_0x589dd4['unitID'],()=>{let _0x178cc7=this['_units']['get'](_0x589dd4['unitID']),_0x277f59=_0x178cc7?.['get'](_0x589dd4['threadID']);return!_0x277f59||_0x277f59['replyID']!==_0x277f59['threadID']?{'status':'not-found'}:_0x277f59['solved']===_0x589dd4['solved']?{'status':'unchanged'}:(_0x178cc7['set'](_0x589dd4['threadID'],{..._0x277f59,'solved':_0x589dd4['solved'],'updatedAt':Math['max'](Date['now'](),_0x277f59['updatedAt']+0x1)}),{'status':'updated'});}));}['deleteComment'](_0x1b4021,_0x3bf491){return this['_call'](()=>this['_enqueue'](_0x1b4021['unitID'],()=>{let _0x49677a=this['_units']['get'](_0x1b4021['unitID']),_0x3e54f3=_0x1b4021['replyID']??_0x1b4021['threadID'],_0x2dfaf4=_0x49677a?.['get'](_0x3e54f3);if(!_0x2dfaf4||_0x2dfaf4['threadID']!==_0x1b4021['threadID'])return{'status':'not-found'};if(_0x2dfaf4['generation']!==_0x1b4021['expectedGeneration'])return{'status':'generation-mismatch'};if(_0x1b4021['replyID']===void 0x0){for(let [_0x47d3e1,_0x2e2fe2]of _0x49677a)_0x2e2fe2['threadID']===_0x1b4021['threadID']&&_0x49677a['delete'](_0x47d3e1);}else _0x49677a['delete'](_0x1b4021['replyID']);return _0x49677a['size']===0x0&&this['_units']['delete'](_0x1b4021['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'](_0x2b1eb1){let _0x370ac6=this['_units']['get'](_0x2b1eb1);if(_0x370ac6)return _0x370ac6;let _0x4cf69d=new Map();return this['_units']['set'](_0x2b1eb1,_0x4cf69d),_0x4cf69d;}['_enqueue'](_0x2e9b4a,_0x41f32c){let _0x5b1591=(this['_queues']['get'](_0x2e9b4a)??Promise['resolve']())['catch'](()=>void 0x0)['then'](_0x41f32c),_0x46c461=_0x5b1591['then'](()=>void 0x0,()=>void 0x0);return this['_queues']['set'](_0x2e9b4a,_0x46c461),_0x46c461['finally'](()=>{this['_queues']['get'](_0x2e9b4a)===_0x46c461&&this['_queues']['delete'](_0x2e9b4a);}),_0x5b1591;}['_call'](_0x590319){if(this['_state']!=='running')return Promise['reject'](Error('Memory\x20Comment\x20Database\x20Adapter\x20is\x20'+this['_state']));let _0x4f234d=_0x590319();return this['_calls']['add'](_0x4f234d),_0x4f234d['finally'](()=>this['_calls']['delete'](_0x4f234d))['catch'](()=>void 0x0),_0x4f234d;}};function r(_0x13bd37){return{..._0x13bd37,'mentions':[..._0x13bd37['mentions']]};}function i(_0x295182,_0x189c62){let _0x1db646=_0x295182['threadID']['localeCompare'](_0x189c62['threadID']);return _0x1db646===0x0?_0x295182['replyID']===_0x295182['threadID']?-0x1:_0x189c62['replyID']===_0x189c62['threadID']?0x1:_0x295182['createdAt']-_0x189c62['createdAt']||_0x295182['replyID']['localeCompare'](_0x189c62['replyID']):_0x1db646;}function a(_0x113568,_0x562573){return _0x113568['length']===_0x562573['length']&&_0x113568['every']((_0x577cef,_0x5b2175)=>_0x577cef===_0x562573[_0x5b2175]);}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
- const _0x116ba9=_0x2501;function _0x53d9(){const _0x27376a=['1791JQVIQi','1530nLGlRu','15wumlMR','2620xLQzNG','393096rukSlK','MemoryCommentDatabaseAdapter','28773DzzfyK','3306448RNnpWc','200553BQDsJg','1697283IcFFuJ','72248epMdcn'];_0x53d9=function(){return _0x27376a;};return _0x53d9();}(function(_0x326a48,_0x59d03b){const _0x35fdca=_0x2501,_0x4b625c=_0x326a48();while(!![]){try{const _0x4ce4a5=-parseInt(_0x35fdca(0x165))/0x1+-parseInt(_0x35fdca(0x15e))/0x2*(-parseInt(_0x35fdca(0x15d))/0x3)+parseInt(_0x35fdca(0x167))/0x4+-parseInt(_0x35fdca(0x15f))/0x5*(-parseInt(_0x35fdca(0x161))/0x6)+parseInt(_0x35fdca(0x166))/0x7+parseInt(_0x35fdca(0x164))/0x8+parseInt(_0x35fdca(0x163))/0x9*(-parseInt(_0x35fdca(0x160))/0xa);if(_0x4ce4a5===_0x59d03b)break;else _0x4b625c['push'](_0x4b625c['shift']());}catch(_0x7556af){_0x4b625c['push'](_0x4b625c['shift']());}}}(_0x53d9,0x4689b));function _0x2501(_0x5fe672,_0x5605ee){_0x5fe672=_0x5fe672-0x15d;const _0x53d911=_0x53d9();let _0x250176=_0x53d911[_0x5fe672];return _0x250176;}import _0x31117e from'./index.cjs';const facadeExport0=_0x31117e[_0x116ba9(0x162)];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.20260808-70eefdd",
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.20260808-70eefdd",
20
- "@univerjs/protocol": "1.0.0-insiders.20260808-70eefdd"
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
+ }