@univerjs-pro/collaboration-comment-database-memory 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 +23 -0
- package/README.zh-CN.md +24 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -7
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.
|
package/README.zh-CN.md
ADDED
|
@@ -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'](
|
|
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'](_0x2b6fdf,_0x5bb936){return this['_call'](()=>this['_enqueue'](_0x2b6fdf['unitID'],()=>{let _0x32b21f=this['_unit'](_0x2b6fdf['unitID']);if(_0x32b21f['has'](_0x2b6fdf['threadID']))return{'status':'duplicate'};let _0x1763bb=Date['now'](),_0x1d7181={..._0x2b6fdf,'replyID':_0x2b6fdf['threadID'],'mentions':[..._0x2b6fdf['mentions']],'solved':t['CommentSolvedStatus']['OpenOrReOpen'],'createdAt':_0x1763bb,'updatedAt':_0x1763bb,'generation':(0x0,e['randomUUID'])()};return _0x32b21f['set'](_0x1d7181['replyID'],_0x1d7181),{'status':'created','record':r(_0x1d7181)};}));}['createReply'](_0x18b1b7,_0x58124d){return this['_call'](()=>this['_enqueue'](_0x18b1b7['unitID'],()=>{let _0x544f9d=this['_unit'](_0x18b1b7['unitID']);if(_0x544f9d['has'](_0x18b1b7['replyID']))return{'status':'duplicate'};let _0x12bf7e=_0x544f9d['get'](_0x18b1b7['threadID']);if(!_0x12bf7e||_0x12bf7e['replyID']!==_0x12bf7e['threadID'])return{'status':'not-found'};if(_0x12bf7e['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};let _0x20a487=Date['now'](),_0x2bf724={..._0x18b1b7,'mentions':[..._0x18b1b7['mentions']],'solved':_0x12bf7e['solved'],'createdAt':_0x20a487,'updatedAt':_0x20a487,'generation':(0x0,e['randomUUID'])()};return _0x544f9d['set'](_0x2bf724['replyID'],_0x2bf724),{'status':'created','record':r(_0x2bf724)};}));}['getComment'](_0x39a951,_0x1a62d9){return this['_call'](()=>this['_enqueue'](_0x39a951['unitID'],()=>{let _0x2f7c1a=this['_units']['get'](_0x39a951['unitID'])?.['get'](_0x39a951['replyID']);return _0x2f7c1a?.['threadID']===_0x39a951['threadID']?r(_0x2f7c1a):null;}));}['listThreads'](_0x43e184,_0x12fedb){return this['_call'](()=>this['_enqueue'](_0x43e184['unitID'],()=>{let _0x12866c=new Set(_0x43e184['threadIDs']);return[...this['_units']['get'](_0x43e184['unitID'])?.['values']()??[]]['filter'](_0x284def=>_0x12866c['size']===0x0||_0x12866c['has'](_0x284def['threadID']))['sort'](i)['map'](r);}));}['editComment'](_0x1e7585,_0x38da63){return this['_call'](()=>this['_enqueue'](_0x1e7585['unitID'],()=>{let _0x59cb3d=this['_units']['get'](_0x1e7585['unitID']),_0x2e9be8=_0x59cb3d?.['get'](_0x1e7585['replyID']),_0x45416a=_0x59cb3d?.['get'](_0x1e7585['threadID']);if(!_0x2e9be8||_0x2e9be8['threadID']!==_0x1e7585['threadID']||!_0x45416a)return{'status':'not-found'};if(_0x45416a['solved']!==t['CommentSolvedStatus']['OpenOrReOpen'])return{'status':'closed'};if(_0x2e9be8['authorUserID']!==_0x1e7585['expectedAuthorUserID'])return{'status':'author-mismatch'};if(_0x2e9be8['content']===_0x1e7585['content']&&a(_0x2e9be8['mentions'],_0x1e7585['mentions']))return{'status':'unchanged','record':r(_0x2e9be8)};let _0x57b476={..._0x2e9be8,'content':_0x1e7585['content'],'mentions':[..._0x1e7585['mentions']],'updatedAt':Math['max'](Date['now'](),_0x2e9be8['updatedAt']+0x1)};return _0x59cb3d['set'](_0x1e7585['replyID'],_0x57b476),{'status':'edited','record':r(_0x57b476)};}));}['setThreadSolved'](_0x34f835,_0x480e7c){return this['_call'](()=>this['_enqueue'](_0x34f835['unitID'],()=>{let _0x1f4724=this['_units']['get'](_0x34f835['unitID']),_0x56ac16=_0x1f4724?.['get'](_0x34f835['threadID']);return!_0x56ac16||_0x56ac16['replyID']!==_0x56ac16['threadID']?{'status':'not-found'}:_0x56ac16['solved']===_0x34f835['solved']?{'status':'unchanged'}:(_0x1f4724['set'](_0x34f835['threadID'],{..._0x56ac16,'solved':_0x34f835['solved'],'updatedAt':Math['max'](Date['now'](),_0x56ac16['updatedAt']+0x1)}),{'status':'updated'});}));}['deleteComment'](_0x27de96,_0x3a6078){return this['_call'](()=>this['_enqueue'](_0x27de96['unitID'],()=>{let _0x193360=this['_units']['get'](_0x27de96['unitID']),_0x967b=_0x27de96['replyID']??_0x27de96['threadID'],_0x4d96e4=_0x193360?.['get'](_0x967b);if(!_0x4d96e4||_0x4d96e4['threadID']!==_0x27de96['threadID'])return{'status':'not-found'};if(_0x4d96e4['generation']!==_0x27de96['expectedGeneration'])return{'status':'generation-mismatch'};if(_0x27de96['replyID']===void 0x0){for(let [_0x190e7d,_0x529158]of _0x193360)_0x529158['threadID']===_0x27de96['threadID']&&_0x193360['delete'](_0x190e7d);}else _0x193360['delete'](_0x27de96['replyID']);return _0x193360['size']===0x0&&this['_units']['delete'](_0x27de96['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'](_0x4a3c5a){let _0x1c886c=this['_units']['get'](_0x4a3c5a);if(_0x1c886c)return _0x1c886c;let _0x3bc44d=new Map();return this['_units']['set'](_0x4a3c5a,_0x3bc44d),_0x3bc44d;}['_enqueue'](_0x459501,_0x2c7981){let _0x34ca6e=(this['_queues']['get'](_0x459501)??Promise['resolve']())['catch'](()=>void 0x0)['then'](_0x2c7981),_0x27cdc0=_0x34ca6e['then'](()=>void 0x0,()=>void 0x0);return this['_queues']['set'](_0x459501,_0x27cdc0),_0x27cdc0['finally'](()=>{this['_queues']['get'](_0x459501)===_0x27cdc0&&this['_queues']['delete'](_0x459501);}),_0x34ca6e;}['_call'](_0x3ff79e){if(this['_state']!=='running')return Promise['reject'](Error('Memory\x20Comment\x20Database\x20Adapter\x20is\x20'+this['_state']));let _0x53eb49=_0x3ff79e();return this['_calls']['add'](_0x53eb49),_0x53eb49['finally'](()=>this['_calls']['delete'](_0x53eb49))['catch'](()=>void 0x0),_0x53eb49;}};function r(_0x32ede2){return{..._0x32ede2,'mentions':[..._0x32ede2['mentions']]};}function i(_0x2e99c4,_0x5a289d){let _0x412198=_0x2e99c4['threadID']['localeCompare'](_0x5a289d['threadID']);return _0x412198===0x0?_0x2e99c4['replyID']===_0x2e99c4['threadID']?-0x1:_0x5a289d['replyID']===_0x5a289d['threadID']?0x1:_0x2e99c4['createdAt']-_0x5a289d['createdAt']||_0x2e99c4['replyID']['localeCompare'](_0x5a289d['replyID']):_0x412198;}function a(_0x256a59,_0x2b680d){return _0x256a59['length']===_0x2b680d['length']&&_0x256a59['every']((_0x7cf05,_0x11ae6b)=>_0x7cf05===_0x2b680d[_0x11ae6b]);}exports['MemoryCommentDatabaseAdapter']=n;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0xf08c01=_0x167c;(function(_0xf2cf5f,_0x23a71e){const _0x13a0fd=_0x167c,_0x454ab8=_0xf2cf5f();while(!![]){try{const _0x1f2d75=-parseInt(_0x13a0fd(0x166))/0x1+parseInt(_0x13a0fd(0x165))/0x2*(parseInt(_0x13a0fd(0x16a))/0x3)+-parseInt(_0x13a0fd(0x164))/0x4+-parseInt(_0x13a0fd(0x169))/0x5+-parseInt(_0x13a0fd(0x167))/0x6+-parseInt(_0x13a0fd(0x16d))/0x7+-parseInt(_0x13a0fd(0x16c))/0x8*(-parseInt(_0x13a0fd(0x16b))/0x9);if(_0x1f2d75===_0x23a71e)break;else _0x454ab8['push'](_0x454ab8['shift']());}catch(_0x294219){_0x454ab8['push'](_0x454ab8['shift']());}}}(_0x3808,0xb4511));function _0x3808(){const _0x364d7e=['1378250yINRWL','6674322FZSxin','MemoryCommentDatabaseAdapter','5177720ulcWGs','17535rPHjHZ','57141PsxdBo','7496TucAXs','9529156AIorcq','1969808LYwFcK','58ZXnWtu'];_0x3808=function(){return _0x364d7e;};return _0x3808();}import _0x579725 from'./index.cjs';function _0x167c(_0x227cd0,_0x31dd21){_0x227cd0=_0x227cd0-0x164;const _0x380862=_0x3808();let _0x167c34=_0x380862[_0x227cd0];return _0x167c34;}const facadeExport0=_0x579725[_0xf08c01(0x168)];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
|
|
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,10 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/collaboration-comment-service": "1.0.0
|
|
20
|
-
"@univerjs/protocol": "1.0.0
|
|
21
|
-
},
|
|
22
|
-
"publishConfig": {
|
|
23
|
-
"access": "public"
|
|
19
|
+
"@univerjs-pro/collaboration-comment-service": "1.0.0",
|
|
20
|
+
"@univerjs/protocol": "1.0.0"
|
|
24
21
|
}
|
|
25
|
-
}
|
|
22
|
+
}
|