@univerjs-pro/collaboration-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,35 @@
1
+ # @univerjs-pro/collaboration-database-memory
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ An in-process `IDatabaseAdapter` for tests, local development, and temporary collaboration services.
6
+
7
+ ## Create the Adapter
8
+
9
+ ```bash
10
+ pnpm add \
11
+ @univerjs-pro/collaboration-service \
12
+ @univerjs-pro/collaboration-database-memory
13
+ ```
14
+
15
+ ```ts
16
+ import { MemoryDatabaseAdapter } from '@univerjs-pro/collaboration-database-memory';
17
+ import { UniverCollabService } from '@univerjs-pro/collaboration-service';
18
+
19
+ const database = new MemoryDatabaseAdapter();
20
+ const service = new UniverCollabService({ dbAdapter: database });
21
+
22
+ await service.dispose();
23
+ await database.dispose();
24
+ ```
25
+
26
+ Pass the Adapter to `UniverCollabService` as `dbAdapter`.
27
+
28
+ It follows the same collaboration persistence contract as the SQLite Adapter, including revision CAS, revisioned snapshots, Sheet blocks, and atomic Unit lifecycle batches. Submission idempotency is resolved by the Service from continuous changeset history, not by the Adapter.
29
+
30
+ ## Limitations
31
+
32
+ - All data is lost when the process exits.
33
+ - State is not shared between Node.js processes.
34
+ - It is intended only for tests and temporary environments, not persistent production data.
35
+ - Hard delete removes core Unit data from the current process and retains a permanent deletion marker that prevents ID reuse.
@@ -0,0 +1,37 @@
1
+ # @univerjs-pro/collaboration-database-memory
2
+
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
5
+ 进程内 `IDatabaseAdapter`,适合测试、本地开发和临时协同服务。
6
+
7
+ ## 创建 Adapter
8
+
9
+ ```bash
10
+ pnpm add \
11
+ @univerjs-pro/collaboration-service \
12
+ @univerjs-pro/collaboration-database-memory
13
+ ```
14
+
15
+ ```ts
16
+ import { MemoryDatabaseAdapter } from '@univerjs-pro/collaboration-database-memory';
17
+ import { UniverCollabService } from '@univerjs-pro/collaboration-service';
18
+
19
+ const database = new MemoryDatabaseAdapter();
20
+ const service = new UniverCollabService({ dbAdapter: database });
21
+
22
+ await service.dispose();
23
+ await database.dispose();
24
+ ```
25
+
26
+ 将 Adapter 作为 `dbAdapter` 传给 `UniverCollabService`。
27
+
28
+ 它与 SQLite Adapter 遵守相同的协同持久化契约,包括 revision CAS、revisioned
29
+ snapshot、Sheet blocks 和原子 Unit 生命周期批次。提交幂等由 Service 从连续
30
+ changeset history 中判断,不由 Adapter 维护 submission 索引。
31
+
32
+ ## 限制
33
+
34
+ - 进程退出后全部数据丢失。
35
+ - 多个 Node.js 进程之间不共享状态。
36
+ - 只适合测试和临时环境,不适合持久化生产数据。
37
+ - hard delete 会清理当前进程中的核心 Unit 数据,并保留永久删除标记以禁止 ID 复用。
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration-service');var t=class{['_units']=new Map();['_tombstones']=new Set();['_disposed']=!0x1;async['getUnit'](_0x1a58ed,_0x2eb59c){this['_assertOpen']();let _0xfededf=this['_activeUnit'](_0x2eb59c);return _0xfededf?d(_0xfededf['record']):null;}async['getSnapshot'](_0x4bd07e,_0x60a0a5,_0x27719d){this['_assertOpen']();let _0x3d080b=this['_activeUnit'](_0x60a0a5);if(!_0x3d080b)return null;let _0x5c4e72=_0x27719d?.['revision'],_0x536b34=_0x5c4e72===void 0x0||_0x5c4e72===0x0?_0x3d080b['record']['headRevision']:Math['min'](_0x5c4e72,_0x3d080b['record']['headRevision']),_0x5bc2a6=-0x1;for(let _0x5e8211 of _0x3d080b['snapshots']['keys']())_0x5e8211<=_0x536b34&&_0x5e8211>_0x5bc2a6&&(_0x5bc2a6=_0x5e8211);let _0x50bf09=_0x3d080b['snapshots']['get'](_0x5bc2a6);return _0x50bf09?d(_0x50bf09):null;}async['getChangesets'](_0x6085d4,_0x2cccab,_0x55bc0f){if(this['_assertOpen'](),_0x55bc0f['from']<0x0||_0x55bc0f['to']<0x0)throw c('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x149d77=this['_activeUnit'](_0x2cccab);if(!_0x149d77)return{'changesets':[],'latestRevision':0x0};let _0x5547df=_0x55bc0f['to']===0x0?_0x149d77['record']['headRevision']:Math['min'](_0x55bc0f['to'],_0x149d77['record']['headRevision']);return{'changesets':[..._0x149d77['changesets']['entries']()]['filter'](([_0x2d895d])=>_0x2d895d>_0x55bc0f['from']&&_0x2d895d<=_0x5547df)['sort'](([_0x9bcde8],[_0x55677b])=>_0x9bcde8-_0x55677b)['map'](([,_0xb31d1e])=>d(_0xb31d1e)),'latestRevision':_0x149d77['record']['headRevision']};}async['getSubmission'](_0x390c80,_0x4e296e,_0x3cd33a,_0x55aa7a){this['_assertOpen']();let _0x46b21e=this['_activeUnit'](_0x4e296e)?.['submissions']['get'](s(_0x3cd33a,_0x55aa7a));return _0x46b21e?d(_0x46b21e):null;}async['createUnit'](_0x3b65df,_0x5aaeee){this['_assertOpen'](),n(_0x5aaeee);let _0x6e088b=this['_units']['get'](_0x5aaeee['record']['unitID']);if(_0x6e088b){if(_0x6e088b['lifecycle']==='soft-deleted')throw c('A\x20soft-deleted\x20unit\x20ID\x20cannot\x20be\x20reused');return{'status':'already-exists','record':d(_0x6e088b['record'])};}if(this['_tombstones']['has'](_0x5aaeee['record']['unitID']))throw c('A\x20purged\x20unit\x20ID\x20cannot\x20be\x20reused');let _0x2256f8=a(_0x5aaeee['sheetBlocks'],_0x5aaeee['resources']),_0x275b18={'record':d(_0x5aaeee['record']),'lifecycle':'active','snapshots':new Map([[0x1,d(_0x5aaeee['snapshot'])]]),'changesets':new Map(),'submissions':new Map(),'sheetBlocks':_0x2256f8['sheetBlocks'],'resources':_0x2256f8['resources']};return this['_units']['set'](_0x5aaeee['record']['unitID'],_0x275b18),{'status':'created','record':d(_0x275b18['record'])};}async['deleteUnits'](_0x51539d,_0x4daee2){this['_assertOpen']();let _0x521fe4=u(_0x4daee2['unitIDs'])['map'](_0x48a329=>{let _0x14578d=this['_units']['get'](_0x48a329);if(_0x4daee2['hardDelete']){if(_0x14578d)return{'unitID':_0x48a329,'stored':_0x14578d,'status':'hard-deleted'};if(this['_tombstones']['has'](_0x48a329))return{'unitID':_0x48a329,'status':'already-hard-deleted'};throw l('Cannot\x20hard-delete\x20a\x20missing\x20unit');}if(!_0x14578d||this['_tombstones']['has'](_0x48a329))throw l('Cannot\x20soft-delete\x20a\x20missing\x20unit');return{'unitID':_0x48a329,'stored':_0x14578d,'status':_0x14578d['lifecycle']==='active'?'soft-deleted':'already-soft-deleted'};});for(let _0x3ce811 of _0x521fe4)_0x4daee2['hardDelete']&&_0x3ce811['status']==='hard-deleted'?(this['_units']['delete'](_0x3ce811['unitID']),this['_tombstones']['add'](_0x3ce811['unitID'])):!_0x4daee2['hardDelete']&&_0x3ce811['stored']&&(_0x3ce811['stored']['lifecycle']='soft-deleted');return{'units':_0x521fe4['map'](({unitID:_0x18be44,status:_0x3adff2})=>({'unitID':_0x18be44,'status':_0x3adff2}))};}async['recoverUnits'](_0x168095,_0x40fc2a){this['_assertOpen']();let _0xa88c60=u(_0x40fc2a['unitIDs'])['map'](_0xf77d31=>{if(this['_tombstones']['has'](_0xf77d31))throw c('A\x20purged\x20unit\x20cannot\x20be\x20recovered');let _0x37a4a4=this['_units']['get'](_0xf77d31);if(!_0x37a4a4)throw l('Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0xf77d31,'stored':_0x37a4a4,'status':_0x37a4a4['lifecycle']==='active'?'already-active':'recovered'};});for(let _0x886a2a of _0xa88c60)_0x886a2a['stored']['lifecycle']='active';return{'units':_0xa88c60['map'](({unitID:_0x527376,status:_0x1a9e86})=>({'unitID':_0x527376,'status':_0x1a9e86}))};}async['commitChangeset'](_0x302855,_0x34907e){this['_assertOpen']();let {changeset:_0xb4497a,expectedHeadRevision:_0x135849}=_0x34907e,_0x15b4ce=this['_activeUnit'](_0xb4497a['unitID']);if(!_0x15b4ce)throw l('Cannot\x20commit\x20to\x20a\x20missing\x20unit');r(_0xb4497a);let _0x36b8d0=s(_0xb4497a['sid'],_0xb4497a['reqId']),_0x2f4d4f=_0x15b4ce['submissions']['get'](_0x36b8d0);if(_0x2f4d4f)return{'status':'already-committed','changeset':d(_0x2f4d4f)};if(_0x15b4ce['record']['headRevision']!==_0x135849)return{'status':'revision-mismatch','actualHeadRevision':_0x15b4ce['record']['headRevision']};i(_0x15b4ce['record'],_0x34907e);let _0x416b3c=d(_0xb4497a);return _0x15b4ce['changesets']['set'](_0x416b3c['revision'],_0x416b3c),_0x15b4ce['submissions']['set'](_0x36b8d0,_0x416b3c),_0x15b4ce['record']={..._0x15b4ce['record'],'headRevision':_0x416b3c['revision']},{'status':'committed','changeset':d(_0x416b3c),'headRevision':_0x15b4ce['record']['headRevision']};}async['saveSnapshot'](_0x14a028,_0xcc0f33){this['_assertOpen']();let _0x277ff0=this['_activeUnit'](_0xcc0f33['snapshot']['unitID']);if(!_0x277ff0)throw l('Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0xcc0f33['snapshot']['type']!==_0x277ff0['record']['type']||_0xcc0f33['snapshot']['rev']<0x1||_0xcc0f33['snapshot']['rev']>_0x277ff0['record']['headRevision'])throw c('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');let _0x2852e2=d(_0xcc0f33['snapshot']);o(_0x277ff0,a(_0xcc0f33['sheetBlocks'],_0xcc0f33['resources'])),_0x277ff0['snapshots']['set'](_0x2852e2['rev'],_0x2852e2);}async['getSheetBlock'](_0xd55662,_0x5e54b4,_0x3c9256){this['_assertOpen']();let _0x25cf95=this['_activeUnit'](_0x5e54b4)?.['sheetBlocks']['get'](_0x3c9256);return _0x25cf95?d(_0x25cf95):null;}async['getResources'](_0x3b6f00,_0x4465c1,_0x3043ab){this['_assertOpen']();let _0x32505a=this['_activeUnit'](_0x4465c1)?.['resources'];if(!_0x32505a)return{};let _0x5f1e7e={};for(let _0x12a3a8 of _0x3043ab){let _0x2d7d96=_0x32505a['get'](_0x12a3a8);_0x2d7d96&&(_0x5f1e7e[_0x12a3a8]=d(_0x2d7d96));}return _0x5f1e7e;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_units']['clear'](),this['_tombstones']['clear']());}['_activeUnit'](_0x37fb06){let _0x4d392b=this['_units']['get'](_0x37fb06);return _0x4d392b?.['lifecycle']==='active'?_0x4d392b:void 0x0;}['_assertOpen'](){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Memory\x20Database\x20Adapter\x20is\x20disposed');}};function n(_0x103355){let {record:_0x4c3027,snapshot:_0x5f2c13}=_0x103355;if(_0x4c3027['headRevision']!==0x1||_0x5f2c13['rev']!==0x1||_0x5f2c13['unitID']!==_0x4c3027['unitID']||_0x5f2c13['type']!==_0x4c3027['type'])throw c('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');}function r(_0x192283){if(!_0x192283['sid']||!Number['isSafeInteger'](_0x192283['reqId'])||_0x192283['reqId']<0x1)throw c('Changeset\x20sid\x20and\x20positive\x20integer\x20reqId\x20are\x20required');}function i(_0x40c646,_0x5db913){let {changeset:_0x1a5748,expectedHeadRevision:_0x2b35af}=_0x5db913;if(_0x1a5748['type']!==_0x40c646['type']||_0x1a5748['baseRev']!==_0x2b35af||_0x1a5748['revision']!==_0x2b35af+0x1)throw c('Confirmed\x20changeset\x20must\x20match\x20the\x20unit\x20type\x20and\x20expected\x20revision');}function a(_0x1de0f8,_0x26b588){let _0x374a13={'sheetBlocks':new Map(),'resources':new Map()};for(let _0x196b10 of _0x1de0f8??[])_0x374a13['sheetBlocks']['set'](_0x196b10['id'],d(_0x196b10));for(let [_0x8ea314,_0x211390]of Object['entries'](_0x26b588??{}))_0x374a13['resources']['set'](_0x8ea314,d(_0x211390));return _0x374a13;}function o(_0x5d3607,_0x1116cf){for(let [_0x21016f,_0x5b5388]of _0x1116cf['sheetBlocks'])_0x5d3607['sheetBlocks']['set'](_0x21016f,_0x5b5388);for(let [_0x439e45,_0x131634]of _0x1116cf['resources'])_0x5d3607['resources']['set'](_0x439e45,_0x131634);}function s(_0x48aabe,_0x33325c){return _0x48aabe['length']+':'+_0x48aabe+':'+_0x33325c;}function c(_0x1dfba3){return new e['CollabError']('INVALID_REQUEST',_0x1dfba3);}function l(_0x20c11c){return new e['CollabError']('UNIT_NOT_FOUND',_0x20c11c);}function u(_0x16a772){return[...new Set(_0x16a772)];}function d(_0x2fdc71){return structuredClone(_0x2fdc71);}exports['MemoryDatabaseAdapter']=t;
1
+ Object['defineProperty'](exports,Symbol['toStringTag'],{'value':'Module'});let e=require('@univerjs-pro/collaboration-service');var t=class{['_units']=new Map();['_tombstones']=new Set();['_disposed']=!0x1;async['getUnit'](_0x52fcd8,_0x2a331c){this['_assertOpen']();let _0x146d26=this['_activeUnit'](_0x2a331c);return _0x146d26?c(_0x146d26['record']):null;}async['getSnapshot'](_0x3ffc37,_0x31f0eb,_0x53838c){let _0x347835=this['_getSnapshot'](_0x31f0eb,_0x53838c);return _0x347835?c(_0x347835):null;}async['getSnapshotInfo'](_0x9c57c7,_0x1b1f51,_0x502463){let _0x2c42ba=this['_getSnapshot'](_0x1b1f51,_0x502463);return _0x2c42ba?{'unitID':_0x2c42ba['unitID'],'type':_0x2c42ba['type'],'rev':_0x2c42ba['rev']}:null;}['_getSnapshot'](_0x24c74d,_0x345925){this['_assertOpen']();let _0x55547d=this['_activeUnit'](_0x24c74d);if(!_0x55547d)return null;let _0xcd7615=_0x345925?.['revision'],_0xda4b2e=_0xcd7615===void 0x0?_0x55547d['record']['headRevision']:Math['min'](_0xcd7615,_0x55547d['record']['headRevision']),_0x24da2f=-0x1;for(let _0x334cd1 of _0x55547d['snapshots']['keys']())_0x334cd1<=_0xda4b2e&&_0x334cd1>_0x24da2f&&(_0x24da2f=_0x334cd1);return _0x55547d['snapshots']['get'](_0x24da2f)??null;}async['getChangesets'](_0x31c180,_0x5f40b3,_0x9ea548){if(this['_assertOpen'](),_0x9ea548['from']<0x0||_0x9ea548['to']!==void 0x0&&_0x9ea548['to']<0x0)throw a('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x55a8d2=this['_activeUnit'](_0x5f40b3);return _0x55a8d2?[..._0x55a8d2['changesets']['entries']()]['filter'](([_0x47c38e])=>_0x47c38e>_0x9ea548['from']&&(_0x9ea548['to']===void 0x0||_0x47c38e<=_0x9ea548['to']))['sort'](([_0x242875],[_0x2c316e])=>_0x242875-_0x2c316e)['map'](([,_0x3613c5])=>c(_0x3613c5)):null;}async['createUnit'](_0x30cec2,_0x1c8b0c){this['_assertOpen'](),n(_0x1c8b0c);let _0x2931ef=this['_units']['get'](_0x1c8b0c['record']['unitID']);if(_0x2931ef){if(_0x2931ef['lifecycle']==='soft-deleted')throw a('A\x20soft-deleted\x20unit\x20ID\x20cannot\x20be\x20reused');return{'status':'already-exists','record':c(_0x2931ef['record'])};}if(this['_tombstones']['has'](_0x1c8b0c['record']['unitID']))throw a('A\x20purged\x20unit\x20ID\x20cannot\x20be\x20reused');let _0x3b6fce=r(_0x1c8b0c['sheetBlocks']),_0x5b088c={'record':c(_0x1c8b0c['record']),'lifecycle':'active','snapshots':new Map([[0x1,c(_0x1c8b0c['snapshot'])]]),'changesets':new Map(),'sheetBlocks':_0x3b6fce};return this['_units']['set'](_0x1c8b0c['record']['unitID'],_0x5b088c),{'status':'created','record':c(_0x5b088c['record'])};}async['deleteUnits'](_0x15333d,_0x3f63f8){this['_assertOpen']();let _0x5e38c7=s(_0x3f63f8['unitIDs'])['map'](_0xb3f64e=>{let _0x3bbd41=this['_units']['get'](_0xb3f64e);if(_0x3f63f8['hardDelete']){if(_0x3bbd41)return{'unitID':_0xb3f64e,'stored':_0x3bbd41,'status':'hard-deleted'};if(this['_tombstones']['has'](_0xb3f64e))return{'unitID':_0xb3f64e,'status':'already-hard-deleted'};throw o('Cannot\x20hard-delete\x20a\x20missing\x20unit');}if(!_0x3bbd41||this['_tombstones']['has'](_0xb3f64e))throw o('Cannot\x20soft-delete\x20a\x20missing\x20unit');return{'unitID':_0xb3f64e,'stored':_0x3bbd41,'status':_0x3bbd41['lifecycle']==='active'?'soft-deleted':'already-soft-deleted'};});for(let _0x226636 of _0x5e38c7)_0x3f63f8['hardDelete']&&_0x226636['status']==='hard-deleted'?(this['_units']['delete'](_0x226636['unitID']),this['_tombstones']['add'](_0x226636['unitID'])):!_0x3f63f8['hardDelete']&&_0x226636['stored']&&(_0x226636['stored']['lifecycle']='soft-deleted');return{'units':_0x5e38c7['map'](({unitID:_0x1564a7,status:_0x1a7d0a})=>({'unitID':_0x1564a7,'status':_0x1a7d0a}))};}async['recoverUnits'](_0x165427,_0x2a20a0){this['_assertOpen']();let _0x510f43=s(_0x2a20a0['unitIDs'])['map'](_0x13daf0=>{if(this['_tombstones']['has'](_0x13daf0))throw a('A\x20purged\x20unit\x20cannot\x20be\x20recovered');let _0x4d4888=this['_units']['get'](_0x13daf0);if(!_0x4d4888)throw o('Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x13daf0,'stored':_0x4d4888,'status':_0x4d4888['lifecycle']==='active'?'already-active':'recovered'};});for(let _0x480680 of _0x510f43)_0x480680['stored']['lifecycle']='active';return{'units':_0x510f43['map'](({unitID:_0x4dded5,status:_0x125db1})=>({'unitID':_0x4dded5,'status':_0x125db1}))};}async['commitChangeset'](_0x57d66b,_0x580b69){this['_assertOpen']();let {changeset:_0x271db0}=_0x580b69,_0x24ea82=this['_activeUnit'](_0x271db0['unitID']);if(!_0x24ea82)throw o('Cannot\x20commit\x20to\x20a\x20missing\x20unit');if(_0x24ea82['record']['headRevision']!==_0x271db0['revision']-0x1)return{'status':'revision-mismatch','actualHeadRevision':_0x24ea82['record']['headRevision']};let _0x15b537=c(_0x271db0);return _0x24ea82['changesets']['set'](_0x15b537['revision'],_0x15b537),_0x24ea82['record']={..._0x24ea82['record'],'headRevision':_0x15b537['revision']},{'status':'committed','changeset':c(_0x15b537),'headRevision':_0x24ea82['record']['headRevision']};}async['saveSnapshot'](_0x67b2c2,_0x444aaa){this['_assertOpen']();let _0x3c4837=this['_activeUnit'](_0x444aaa['snapshot']['unitID']);if(!_0x3c4837)throw o('Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0x444aaa['snapshot']['type']!==_0x3c4837['record']['type']||_0x444aaa['snapshot']['rev']<0x1||_0x444aaa['snapshot']['rev']>_0x3c4837['record']['headRevision'])throw a('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');let _0x251855=c(_0x444aaa['snapshot']);i(_0x3c4837,r(_0x444aaa['sheetBlocks'])),_0x3c4837['snapshots']['set'](_0x251855['rev'],_0x251855);}async['getSheetBlock'](_0x53d2e3,_0x521256,_0x305fd6){this['_assertOpen']();let _0x558030=this['_activeUnit'](_0x521256)?.['sheetBlocks']['get'](_0x305fd6);return _0x558030?c(_0x558030):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_units']['clear'](),this['_tombstones']['clear']());}['_activeUnit'](_0x42d75b){let _0x9e399a=this['_units']['get'](_0x42d75b);return _0x9e399a?.['lifecycle']==='active'?_0x9e399a:void 0x0;}['_assertOpen'](){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Memory\x20Database\x20Adapter\x20is\x20disposed');}};function n(_0x3832bc){let {record:_0x501b50,snapshot:_0x3f3815}=_0x3832bc;if(_0x501b50['headRevision']!==0x1||_0x3f3815['rev']!==0x1||_0x3f3815['unitID']!==_0x501b50['unitID']||_0x3f3815['type']!==_0x501b50['type'])throw a('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');}function r(_0x22183e){let _0x570799=new Map();for(let _0x37975a of _0x22183e??[])_0x570799['set'](_0x37975a['id'],c(_0x37975a));return _0x570799;}function i(_0x3c63e3,_0x1510e0){for(let [_0x4f6073,_0x1f0cea]of _0x1510e0)_0x3c63e3['sheetBlocks']['set'](_0x4f6073,_0x1f0cea);}function a(_0xb559a8){return new e['CollabError']('INVALID_REQUEST',_0xb559a8);}function o(_0x251f8e){return new e['CollabError']('UNIT_NOT_FOUND',_0x251f8e);}function s(_0x8b1e78){return[...new Set(_0x8b1e78)];}function c(_0x16b7fb){return structuredClone(_0x16b7fb);}exports['MemoryDatabaseAdapter']=t;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ChangesetRange, CommitChangesetInput, CommitChangesetResult, CreateUnitDatabaseInput, CreateUnitDatabaseResult, DatabaseContext, DeleteUnitsDatabaseInput, DeleteUnitsDatabaseResult, IDatabaseAdapter, RecoverUnitsDatabaseInput, RecoverUnitsDatabaseResult, SaveSnapshotInput, UnitRecord } from "@univerjs-pro/collaboration-service";
2
- import { IChangeset, IGetResourcesResponse, ISheetBlock, ISnapshot } from "@univerjs/protocol";
1
+ import { CommitChangesetInput, CommitChangesetResult, CreateUnitDatabaseInput, CreateUnitDatabaseResult, DatabaseContext, DeleteUnitsDatabaseInput, DeleteUnitsDatabaseResult, IDatabaseAdapter, RecoverUnitsDatabaseInput, RecoverUnitsDatabaseResult, SaveSnapshotInput, SnapshotInfo, UnitRecord } from "@univerjs-pro/collaboration-service";
2
+ import { IChangeset, ISheetBlock, ISnapshot } from "@univerjs/protocol";
3
3
 
4
4
  //#region src/memory-database-adapter.d.ts
5
5
  declare class MemoryDatabaseAdapter implements IDatabaseAdapter {
@@ -10,18 +10,20 @@ declare class MemoryDatabaseAdapter implements IDatabaseAdapter {
10
10
  getSnapshot(_context: DatabaseContext, unitID: string, options?: {
11
11
  readonly revision?: number;
12
12
  }): Promise<ISnapshot | null>;
13
+ getSnapshotInfo(_context: DatabaseContext, unitID: string, options?: {
14
+ readonly revision?: number;
15
+ }): Promise<SnapshotInfo | null>;
16
+ private _getSnapshot;
13
17
  getChangesets(_context: DatabaseContext, unitID: string, range: {
14
18
  readonly from: number;
15
- readonly to: number;
16
- }): Promise<ChangesetRange>;
17
- getSubmission(_context: DatabaseContext, unitID: string, sid: string, reqId: number): Promise<IChangeset | null>;
19
+ readonly to?: number;
20
+ }): Promise<readonly IChangeset[] | null>;
18
21
  createUnit(_context: DatabaseContext, input: CreateUnitDatabaseInput): Promise<CreateUnitDatabaseResult>;
19
22
  deleteUnits(_context: DatabaseContext, input: DeleteUnitsDatabaseInput): Promise<DeleteUnitsDatabaseResult>;
20
23
  recoverUnits(_context: DatabaseContext, input: RecoverUnitsDatabaseInput): Promise<RecoverUnitsDatabaseResult>;
21
24
  commitChangeset(_context: DatabaseContext, input: CommitChangesetInput): Promise<CommitChangesetResult>;
22
25
  saveSnapshot(_context: DatabaseContext, input: SaveSnapshotInput): Promise<void>;
23
26
  getSheetBlock(_context: DatabaseContext, unitID: string, blockID: string): Promise<ISheetBlock | null>;
24
- getResources(_context: DatabaseContext, unitID: string, resourceIDs: readonly string[]): Promise<Readonly<IGetResourcesResponse["resources"]>>;
25
27
  dispose(): Promise<void>;
26
28
  private _activeUnit;
27
29
  private _assertOpen;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function _0x2d58(){const _0x9e1f24=['405716wGsvRE','1990950aVljtS','276324tyJJJh','MemoryDatabaseAdapter','444055HFRkeH','16RJzvHZ','2309377gbxlvR','240642hKIWGj','549600exneSH'];_0x2d58=function(){return _0x9e1f24;};return _0x2d58();}function _0x3a08(_0x5bc750,_0x1a843f){_0x5bc750=_0x5bc750-0x132;const _0x2d58c5=_0x2d58();let _0x3a0896=_0x2d58c5[_0x5bc750];return _0x3a0896;}const _0x5054ad=_0x3a08;(function(_0xf2d7,_0x3558e0){const _0x524e37=_0x3a08,_0x2141f5=_0xf2d7();while(!![]){try{const _0x214d61=-parseInt(_0x524e37(0x135))/0x1+parseInt(_0x524e37(0x133))/0x2+parseInt(_0x524e37(0x138))/0x3+parseInt(_0x524e37(0x13a))/0x4+-parseInt(_0x524e37(0x132))/0x5+parseInt(_0x524e37(0x139))/0x6+parseInt(_0x524e37(0x137))/0x7*(parseInt(_0x524e37(0x136))/0x8);if(_0x214d61===_0x3558e0)break;else _0x2141f5['push'](_0x2141f5['shift']());}catch(_0x5726ad){_0x2141f5['push'](_0x2141f5['shift']());}}}(_0x2d58,0x37e76));import _0xd3a324 from'./index.cjs';const facadeExport0=_0xd3a324[_0x5054ad(0x134)];export{facadeExport0 as MemoryDatabaseAdapter};
1
+ const _0x4615ee=_0x4705;(function(_0x2ca01c,_0x1ea91f){const _0x99e431=_0x4705,_0x10b85e=_0x2ca01c();while(!![]){try{const _0x58d75a=parseInt(_0x99e431(0xce))/0x1+parseInt(_0x99e431(0xcd))/0x2*(-parseInt(_0x99e431(0xc8))/0x3)+-parseInt(_0x99e431(0xcf))/0x4+parseInt(_0x99e431(0xc9))/0x5+-parseInt(_0x99e431(0xcb))/0x6+-parseInt(_0x99e431(0xca))/0x7*(-parseInt(_0x99e431(0xc6))/0x8)+parseInt(_0x99e431(0xc7))/0x9;if(_0x58d75a===_0x1ea91f)break;else _0x10b85e['push'](_0x10b85e['shift']());}catch(_0x586293){_0x10b85e['push'](_0x10b85e['shift']());}}}(_0x2b37,0xd2b30));function _0x2b37(){const _0x11d9a9=['10839690IHzyAf','137625XgBhKM','2679560AAXGdz','91ALmpTJ','87324rGZMaG','MemoryDatabaseAdapter','70oxDNXx','672806xtxXlN','2937148HjbFIB','494992HSskwM'];_0x2b37=function(){return _0x11d9a9;};return _0x2b37();}function _0x4705(_0x14c905,_0x24e93b){_0x14c905=_0x14c905-0xc6;const _0x2b3754=_0x2b37();let _0x470566=_0x2b3754[_0x14c905];return _0x470566;}import _0x2517e8 from'./index.cjs';const facadeExport0=_0x2517e8[_0x4615ee(0xcc)];export{facadeExport0 as MemoryDatabaseAdapter};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univerjs-pro/collaboration-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-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-service": "1.0.0-rc.0",
20
+ "@univerjs/protocol": "1.0.0-rc.0"
24
21
  }
25
- }
22
+ }