@univerjs-pro/collaboration-comment-database-memory 1.0.0-insiders.20260727-46ed76c
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.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MemoryCommentDatabaseAdapter } from "./memory-comment-database-adapter.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['MemoryCommentDatabaseAdapter']=void 0x0;var memory_comment_database_adapter_js_1=require('./memory-comment-database-adapter.js');Object['defineProperty'](exports,'MemoryCommentDatabaseAdapter',{'enumerable':!![],'get':function(){return memory_comment_database_adapter_js_1['MemoryCommentDatabaseAdapter'];}});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CommentDatabaseContext, CommentRecord, CreateCommentDatabaseResult, CreateReplyDatabaseInput, CreateReplyDatabaseResult, CreateRootDatabaseInput, DeleteCommentDatabaseInput, DeleteCommentDatabaseResult, EditCommentDatabaseInput, EditCommentDatabaseResult, GetCommentDatabaseInput, ICommentDatabaseAdapter, ListThreadsDatabaseInput, SetThreadSolvedDatabaseInput, SetThreadSolvedDatabaseResult } from "@univerjs-pro/collaboration-comment-service";
|
|
2
|
+
export declare class MemoryCommentDatabaseAdapter implements ICommentDatabaseAdapter {
|
|
3
|
+
private readonly _units;
|
|
4
|
+
private readonly _queues;
|
|
5
|
+
private readonly _calls;
|
|
6
|
+
private _state;
|
|
7
|
+
private _disposePromise;
|
|
8
|
+
createRoot(input: CreateRootDatabaseInput, _context: CommentDatabaseContext): Promise<CreateCommentDatabaseResult>;
|
|
9
|
+
createReply(input: CreateReplyDatabaseInput, _context: CommentDatabaseContext): Promise<CreateReplyDatabaseResult>;
|
|
10
|
+
getComment(input: GetCommentDatabaseInput, _context: CommentDatabaseContext): Promise<CommentRecord | null>;
|
|
11
|
+
listThreads(input: ListThreadsDatabaseInput, _context: CommentDatabaseContext): Promise<readonly CommentRecord[]>;
|
|
12
|
+
editComment(input: EditCommentDatabaseInput, _context: CommentDatabaseContext): Promise<EditCommentDatabaseResult>;
|
|
13
|
+
setThreadSolved(input: SetThreadSolvedDatabaseInput, _context: CommentDatabaseContext): Promise<SetThreadSolvedDatabaseResult>;
|
|
14
|
+
deleteComment(input: DeleteCommentDatabaseInput, _context: CommentDatabaseContext): Promise<DeleteCommentDatabaseResult>;
|
|
15
|
+
dispose(): Promise<void>;
|
|
16
|
+
private _unit;
|
|
17
|
+
private _enqueue;
|
|
18
|
+
private _call;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const _0x4784bc=_0x12f1;(function(_0x4b7e1c,_0x193e75){const _0x1f6ab5=_0x12f1,_0x9a531a=_0x4b7e1c();while(!![]){try{const _0x1b0f76=parseInt(_0x1f6ab5(0x19c))/0x1+-parseInt(_0x1f6ab5(0x1cb))/0x2*(parseInt(_0x1f6ab5(0x1bc))/0x3)+parseInt(_0x1f6ab5(0x1a0))/0x4+parseInt(_0x1f6ab5(0x1a5))/0x5*(parseInt(_0x1f6ab5(0x1b9))/0x6)+parseInt(_0x1f6ab5(0x1c2))/0x7+parseInt(_0x1f6ab5(0x1d8))/0x8+parseInt(_0x1f6ab5(0x1d2))/0x9*(-parseInt(_0x1f6ab5(0x1cd))/0xa);if(_0x1b0f76===_0x193e75)break;else _0x9a531a['push'](_0x9a531a['shift']());}catch(_0x56e8b7){_0x9a531a['push'](_0x9a531a['shift']());}}}(_0x192e,0x4b09a));function _0x12f1(_0x56867d,_0x14eacb){_0x56867d=_0x56867d-0x19b;const _0x192e30=_0x192e();let _0x12f136=_0x192e30[_0x56867d];return _0x12f136;}Object[_0x4784bc(0x19d)](exports,'__esModule',{'value':!![]}),exports[_0x4784bc(0x19f)]=void 0x0;const node_crypto_1=require('node:crypto'),protocol_1=require('@univerjs/protocol');class MemoryCommentDatabaseAdapter{['_units']=new Map();[_0x4784bc(0x1d0)]=new Map();[_0x4784bc(0x1a1)]=new Set();[_0x4784bc(0x1dc)]=_0x4784bc(0x1b7);[_0x4784bc(0x1bd)];['createRoot'](_0x3e38ee,_0x33f867){const _0x440c72=_0x4784bc;return this['_call'](()=>this[_0x440c72(0x1b3)](_0x3e38ee[_0x440c72(0x1b6)],()=>{const _0x43133c=_0x440c72,_0x3e4917=this['_unit'](_0x3e38ee[_0x43133c(0x1b6)]);if(_0x3e4917[_0x43133c(0x1a7)](_0x3e38ee['threadID']))return{'status':_0x43133c(0x1c0)};const _0x3ba470=Date['now'](),_0x4c5533={..._0x3e38ee,'replyID':_0x3e38ee['threadID'],'mentions':[..._0x3e38ee[_0x43133c(0x1ba)]],'solved':protocol_1[_0x43133c(0x1cc)][_0x43133c(0x1db)],'createdAt':_0x3ba470,'updatedAt':_0x3ba470,'generation':(0x0,node_crypto_1[_0x43133c(0x1c1)])()};return _0x3e4917[_0x43133c(0x1c5)](_0x4c5533[_0x43133c(0x1da)],_0x4c5533),{'status':_0x43133c(0x19e),'record':cloneRecord(_0x4c5533)};}));}[_0x4784bc(0x1a2)](_0x188102,_0x523118){const _0x5cc6d2=_0x4784bc;return this[_0x5cc6d2(0x1a8)](()=>this[_0x5cc6d2(0x1b3)](_0x188102['unitID'],()=>{const _0x37e67e=_0x5cc6d2,_0x4fc5d9=this[_0x37e67e(0x1d4)](_0x188102[_0x37e67e(0x1b6)]);if(_0x4fc5d9['has'](_0x188102[_0x37e67e(0x1da)]))return{'status':_0x37e67e(0x1c0)};const _0x3f2298=_0x4fc5d9[_0x37e67e(0x1ad)](_0x188102[_0x37e67e(0x1d9)]);if(!_0x3f2298||_0x3f2298[_0x37e67e(0x1da)]!==_0x3f2298[_0x37e67e(0x1d9)])return{'status':'not-found'};if(_0x3f2298[_0x37e67e(0x1e2)]!==protocol_1[_0x37e67e(0x1cc)][_0x37e67e(0x1db)])return{'status':_0x37e67e(0x1b0)};const _0x3f6f5a=Date[_0x37e67e(0x1d6)](),_0xdc3a={..._0x188102,'mentions':[..._0x188102[_0x37e67e(0x1ba)]],'solved':_0x3f2298[_0x37e67e(0x1e2)],'createdAt':_0x3f6f5a,'updatedAt':_0x3f6f5a,'generation':(0x0,node_crypto_1[_0x37e67e(0x1c1)])()};return _0x4fc5d9['set'](_0xdc3a[_0x37e67e(0x1da)],_0xdc3a),{'status':_0x37e67e(0x19e),'record':cloneRecord(_0xdc3a)};}));}[_0x4784bc(0x1aa)](_0x49f036,_0x4a86c5){const _0x5c2c59=_0x4784bc;return this[_0x5c2c59(0x1a8)](()=>this[_0x5c2c59(0x1b3)](_0x49f036[_0x5c2c59(0x1b6)],()=>{const _0x272eac=_0x5c2c59,_0x1ee408=this[_0x272eac(0x1ab)][_0x272eac(0x1ad)](_0x49f036[_0x272eac(0x1b6)])?.[_0x272eac(0x1ad)](_0x49f036[_0x272eac(0x1da)]);return _0x1ee408?.[_0x272eac(0x1d9)]===_0x49f036[_0x272eac(0x1d9)]?cloneRecord(_0x1ee408):null;}));}[_0x4784bc(0x1a9)](_0x39d213,_0xab4264){const _0x52994d=_0x4784bc;return this[_0x52994d(0x1a8)](()=>this[_0x52994d(0x1b3)](_0x39d213[_0x52994d(0x1b6)],()=>{const _0x5bb5c6=_0x52994d,_0x57ec87=new Set(_0x39d213[_0x5bb5c6(0x1c8)]);return[...this[_0x5bb5c6(0x1ab)]['get'](_0x39d213[_0x5bb5c6(0x1b6)])?.[_0x5bb5c6(0x1d3)]()??[]][_0x5bb5c6(0x1a4)](_0x22ea39=>_0x57ec87[_0x5bb5c6(0x1bf)]===0x0||_0x57ec87[_0x5bb5c6(0x1a7)](_0x22ea39[_0x5bb5c6(0x1d9)]))[_0x5bb5c6(0x1c7)](compareRecords)['map'](cloneRecord);}));}[_0x4784bc(0x1af)](_0x452072,_0x2b7775){const _0x3729ec=_0x4784bc;return this[_0x3729ec(0x1a8)](()=>this[_0x3729ec(0x1b3)](_0x452072[_0x3729ec(0x1b6)],()=>{const _0x59f2c5=_0x3729ec,_0x5445e4=this['_units']['get'](_0x452072[_0x59f2c5(0x1b6)]),_0x12d2a7=_0x5445e4?.['get'](_0x452072[_0x59f2c5(0x1da)]),_0x11c21d=_0x5445e4?.[_0x59f2c5(0x1ad)](_0x452072[_0x59f2c5(0x1d9)]);if(!_0x12d2a7||_0x12d2a7[_0x59f2c5(0x1d9)]!==_0x452072['threadID']||!_0x11c21d)return{'status':_0x59f2c5(0x1d5)};if(_0x11c21d['solved']!==protocol_1[_0x59f2c5(0x1cc)][_0x59f2c5(0x1db)])return{'status':'closed'};if(_0x12d2a7[_0x59f2c5(0x1de)]!==_0x452072['expectedAuthorUserID'])return{'status':_0x59f2c5(0x1d7)};if(_0x12d2a7[_0x59f2c5(0x1e1)]===_0x452072['content']&&equalStrings(_0x12d2a7[_0x59f2c5(0x1ba)],_0x452072['mentions']))return{'status':_0x59f2c5(0x1bb),'record':cloneRecord(_0x12d2a7)};const _0x2e6baf={..._0x12d2a7,'content':_0x452072[_0x59f2c5(0x1e1)],'mentions':[..._0x452072[_0x59f2c5(0x1ba)]],'updatedAt':Math[_0x59f2c5(0x1ca)](Date['now'](),_0x12d2a7[_0x59f2c5(0x1c6)]+0x1)};return _0x5445e4[_0x59f2c5(0x1c5)](_0x452072[_0x59f2c5(0x1da)],_0x2e6baf),{'status':'edited','record':cloneRecord(_0x2e6baf)};}));}[_0x4784bc(0x1e0)](_0x1b1fe3,_0x413bca){const _0x193f9d=_0x4784bc;return this[_0x193f9d(0x1a8)](()=>this[_0x193f9d(0x1b3)](_0x1b1fe3['unitID'],()=>{const _0x296b59=_0x193f9d,_0x344dae=this[_0x296b59(0x1ab)][_0x296b59(0x1ad)](_0x1b1fe3[_0x296b59(0x1b6)]),_0x8d609d=_0x344dae?.['get'](_0x1b1fe3[_0x296b59(0x1d9)]);if(!_0x8d609d||_0x8d609d['replyID']!==_0x8d609d['threadID'])return{'status':_0x296b59(0x1d5)};if(_0x8d609d[_0x296b59(0x1e2)]===_0x1b1fe3[_0x296b59(0x1e2)])return{'status':_0x296b59(0x1bb)};return _0x344dae[_0x296b59(0x1c5)](_0x1b1fe3[_0x296b59(0x1d9)],{..._0x8d609d,'solved':_0x1b1fe3['solved'],'updatedAt':Math['max'](Date[_0x296b59(0x1d6)](),_0x8d609d['updatedAt']+0x1)}),{'status':'updated'};}));}[_0x4784bc(0x1a3)](_0x3fe929,_0x58e03d){const _0x310981=_0x4784bc;return this[_0x310981(0x1a8)](()=>this['_enqueue'](_0x3fe929[_0x310981(0x1b6)],()=>{const _0x31e591=_0x310981,_0x1e6625=this[_0x31e591(0x1ab)][_0x31e591(0x1ad)](_0x3fe929[_0x31e591(0x1b6)]),_0x561c62=_0x3fe929[_0x31e591(0x1da)]??_0x3fe929[_0x31e591(0x1d9)],_0x3dd481=_0x1e6625?.[_0x31e591(0x1ad)](_0x561c62);if(!_0x3dd481||_0x3dd481[_0x31e591(0x1d9)]!==_0x3fe929[_0x31e591(0x1d9)])return{'status':_0x31e591(0x1d5)};if(_0x3dd481[_0x31e591(0x1c9)]!==_0x3fe929['expectedGeneration'])return{'status':_0x31e591(0x1ac)};if(_0x3fe929[_0x31e591(0x1da)]===undefined)for(const [_0x1039df,_0x5ec6df]of _0x1e6625){if(_0x5ec6df[_0x31e591(0x1d9)]===_0x3fe929['threadID'])_0x1e6625[_0x31e591(0x1e3)](_0x1039df);}else _0x1e6625[_0x31e591(0x1e3)](_0x3fe929[_0x31e591(0x1da)]);if(_0x1e6625[_0x31e591(0x1bf)]===0x0)this['_units']['delete'](_0x3fe929[_0x31e591(0x1b6)]);return{'status':_0x31e591(0x19b)};}));}[_0x4784bc(0x1c3)](){const _0x18c9a6=_0x4784bc;if(this[_0x18c9a6(0x1bd)])return this[_0x18c9a6(0x1bd)];return this['_state']='disposing',this[_0x18c9a6(0x1bd)]=((async()=>{const _0x4456b7=_0x18c9a6;await Promise[_0x4456b7(0x1be)]([...this['_calls']]),this[_0x4456b7(0x1d0)][_0x4456b7(0x1d1)](),this[_0x4456b7(0x1dc)]=_0x4456b7(0x1ce);})()),this['_disposePromise'];}['_unit'](_0x54b63b){const _0x3d9e03=_0x4784bc,_0x5159e4=this['_units'][_0x3d9e03(0x1ad)](_0x54b63b);if(_0x5159e4)return _0x5159e4;const _0x4897e8=new Map();return this['_units']['set'](_0x54b63b,_0x4897e8),_0x4897e8;}['_enqueue'](_0x200481,_0x95f7d7){const _0x41d5f6=_0x4784bc,_0x3f6b10=this[_0x41d5f6(0x1d0)][_0x41d5f6(0x1ad)](_0x200481)??Promise[_0x41d5f6(0x1b1)](),_0x430fad=_0x3f6b10[_0x41d5f6(0x1b4)](()=>undefined)['then'](_0x95f7d7),_0x363847=_0x430fad[_0x41d5f6(0x1a6)](()=>undefined,()=>undefined);return this['_queues'][_0x41d5f6(0x1c5)](_0x200481,_0x363847),void _0x363847[_0x41d5f6(0x1b5)](()=>{const _0x3d9dbc=_0x41d5f6;if(this['_queues'][_0x3d9dbc(0x1ad)](_0x200481)===_0x363847)this[_0x3d9dbc(0x1d0)][_0x3d9dbc(0x1e3)](_0x200481);}),_0x430fad;}[_0x4784bc(0x1a8)](_0x27ff0e){const _0xd803a=_0x4784bc;if(this[_0xd803a(0x1dc)]!=='running')return Promise[_0xd803a(0x1b8)](new Error(_0xd803a(0x1c4)+this['_state']));const _0x5ceb68=_0x27ff0e();return this[_0xd803a(0x1a1)][_0xd803a(0x1cf)](_0x5ceb68),void _0x5ceb68[_0xd803a(0x1b5)](()=>this['_calls']['delete'](_0x5ceb68))[_0xd803a(0x1b4)](()=>undefined),_0x5ceb68;}}exports['MemoryCommentDatabaseAdapter']=MemoryCommentDatabaseAdapter;function _0x192e(){const _0x549024=['threadIDs','generation','max','4PkPopE','CommentSolvedStatus','10MEmiVV','disposed','add','_queues','clear','6396993rjfesl','values','_unit','not-found','now','author-mismatch','917232JSOGLi','threadID','replyID','OpenOrReOpen','_state','localeCompare','authorUserID','every','setThreadSolved','content','solved','delete','deleted','97181ZeXeRJ','defineProperty','created','MemoryCommentDatabaseAdapter','1419096zQeZtq','_calls','createReply','deleteComment','filter','75BwBlFI','then','has','_call','listThreads','getComment','_units','generation-mismatch','get','createdAt','editComment','closed','resolve','length','_enqueue','catch','finally','unitID','running','reject','172614sZNfmQ','mentions','unchanged','321717RIYPdh','_disposePromise','allSettled','size','duplicate','randomUUID','1641255jJaMvx','dispose','Memory\x20Comment\x20Database\x20Adapter\x20is\x20','set','updatedAt','sort'];_0x192e=function(){return _0x549024;};return _0x192e();}function cloneRecord(_0x56e2ec){const _0x3d6f79=_0x4784bc;return{..._0x56e2ec,'mentions':[..._0x56e2ec[_0x3d6f79(0x1ba)]]};}function compareRecords(_0x3f4e1b,_0x1ef28c){const _0x601d3a=_0x4784bc,_0x4ace27=_0x3f4e1b[_0x601d3a(0x1d9)][_0x601d3a(0x1dd)](_0x1ef28c[_0x601d3a(0x1d9)]);if(_0x4ace27!==0x0)return _0x4ace27;if(_0x3f4e1b[_0x601d3a(0x1da)]===_0x3f4e1b[_0x601d3a(0x1d9)])return-0x1;if(_0x1ef28c[_0x601d3a(0x1da)]===_0x1ef28c[_0x601d3a(0x1d9)])return 0x1;return _0x3f4e1b[_0x601d3a(0x1ae)]-_0x1ef28c[_0x601d3a(0x1ae)]||_0x3f4e1b[_0x601d3a(0x1da)][_0x601d3a(0x1dd)](_0x1ef28c[_0x601d3a(0x1da)]);}function equalStrings(_0x42c39a,_0x2c74cd){const _0x18be95=_0x4784bc;return _0x42c39a[_0x18be95(0x1b2)]===_0x2c74cd[_0x18be95(0x1b2)]&&_0x42c39a[_0x18be95(0x1df)]((_0x5010f5,_0x20bb46)=>_0x5010f5===_0x2c74cd[_0x20bb46]);}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univerjs-pro/collaboration-comment-database-memory",
|
|
3
|
+
"type": "commonjs",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"version": "1.0.0-insiders.20260727-46ed76c",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@univerjs-pro/collaboration-comment-service": "1.0.0-insiders.20260727-46ed76c",
|
|
19
|
+
"@univerjs/protocol": "1.0.0-insiders.20260727-46ed76c"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|