@univerjs-pro/collaboration-database-memory 1.2.0 → 1.3.1
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.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
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'](
|
|
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'](_0x34f341,_0x27a2e5){this['_assertOpen']();let _0x3d6ec9=this['_activeUnit'](_0x27a2e5);return _0x3d6ec9?c(_0x3d6ec9['record']):null;}async['getSnapshot'](_0x311608,_0x10ab0d,_0x5aa17c){let _0x2b3f19=this['_getSnapshot'](_0x10ab0d,_0x5aa17c);return _0x2b3f19?c(_0x2b3f19):null;}async['getSnapshotInfo'](_0x2b88b6,_0x7ec16f,_0x127643){let _0x3499f8=this['_getSnapshot'](_0x7ec16f,_0x127643);return _0x3499f8?{'unitID':_0x3499f8['unitID'],'type':_0x3499f8['type'],'rev':_0x3499f8['rev']}:null;}['_getSnapshot'](_0x1bd228,_0x3f0bbb){this['_assertOpen']();let _0xc75b37=this['_activeUnit'](_0x1bd228);if(!_0xc75b37)return null;let _0xf704bd=_0x3f0bbb?.['revision'],_0x5b4317=_0xf704bd===void 0x0?_0xc75b37['record']['headRevision']:Math['min'](_0xf704bd,_0xc75b37['record']['headRevision']),_0x1b7fe1=-0x1;for(let _0x209d99 of _0xc75b37['snapshots']['keys']())_0x209d99<=_0x5b4317&&_0x209d99>_0x1b7fe1&&(_0x1b7fe1=_0x209d99);return _0xc75b37['snapshots']['get'](_0x1b7fe1)??null;}async['getChangesets'](_0xcdcb7c,_0x16b9b5,_0x793ff9){if(this['_assertOpen'](),_0x793ff9['from']<0x0||_0x793ff9['to']!==void 0x0&&_0x793ff9['to']<0x0)throw a('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x54eaae=this['_activeUnit'](_0x16b9b5);return _0x54eaae?[..._0x54eaae['changesets']['entries']()]['filter'](([_0x151afa])=>_0x151afa>_0x793ff9['from']&&(_0x793ff9['to']===void 0x0||_0x151afa<=_0x793ff9['to']))['sort'](([_0x3b24c9],[_0x263872])=>_0x3b24c9-_0x263872)['map'](([,_0x1a6b10])=>c(_0x1a6b10)):null;}async['createUnit'](_0x4b7730,_0x109433){this['_assertOpen'](),n(_0x109433);let _0x2fcd2f=this['_units']['get'](_0x109433['record']['unitID']);if(_0x2fcd2f){if(_0x2fcd2f['lifecycle']==='soft-deleted')throw a('A\x20soft-deleted\x20unit\x20ID\x20cannot\x20be\x20reused');return{'status':'already-exists','record':c(_0x2fcd2f['record'])};}if(this['_tombstones']['has'](_0x109433['record']['unitID']))throw a('A\x20purged\x20unit\x20ID\x20cannot\x20be\x20reused');let _0x21a8fe=r(_0x109433['sheetBlocks']),_0x20d3d9={'record':c(_0x109433['record']),'lifecycle':'active','snapshots':new Map([[0x1,c(_0x109433['snapshot'])]]),'changesets':new Map(),'sheetBlocks':_0x21a8fe};return this['_units']['set'](_0x109433['record']['unitID'],_0x20d3d9),{'status':'created','record':c(_0x20d3d9['record'])};}async['deleteUnits'](_0x53ed15,_0x5f5bc8){this['_assertOpen']();let _0x4e037f=s(_0x5f5bc8['unitIDs'])['map'](_0xb5c50=>{let _0x2e5940=this['_units']['get'](_0xb5c50);if(_0x5f5bc8['hardDelete']){if(_0x2e5940)return{'unitID':_0xb5c50,'stored':_0x2e5940,'status':'hard-deleted'};if(this['_tombstones']['has'](_0xb5c50))return{'unitID':_0xb5c50,'status':'already-hard-deleted'};throw o('Cannot\x20hard-delete\x20a\x20missing\x20unit');}if(!_0x2e5940||this['_tombstones']['has'](_0xb5c50))throw o('Cannot\x20soft-delete\x20a\x20missing\x20unit');return{'unitID':_0xb5c50,'stored':_0x2e5940,'status':_0x2e5940['lifecycle']==='active'?'soft-deleted':'already-soft-deleted'};});for(let _0x2a540c of _0x4e037f)_0x5f5bc8['hardDelete']&&_0x2a540c['status']==='hard-deleted'?(this['_units']['delete'](_0x2a540c['unitID']),this['_tombstones']['add'](_0x2a540c['unitID'])):!_0x5f5bc8['hardDelete']&&_0x2a540c['stored']&&(_0x2a540c['stored']['lifecycle']='soft-deleted');return{'units':_0x4e037f['map'](({unitID:_0xef292a,status:_0x1d6337})=>({'unitID':_0xef292a,'status':_0x1d6337}))};}async['recoverUnits'](_0x55e5fa,_0x2487a5){this['_assertOpen']();let _0x35ff6b=s(_0x2487a5['unitIDs'])['map'](_0x56aaad=>{if(this['_tombstones']['has'](_0x56aaad))throw a('A\x20purged\x20unit\x20cannot\x20be\x20recovered');let _0x545488=this['_units']['get'](_0x56aaad);if(!_0x545488)throw o('Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x56aaad,'stored':_0x545488,'status':_0x545488['lifecycle']==='active'?'already-active':'recovered'};});for(let _0x48abc2 of _0x35ff6b)_0x48abc2['stored']['lifecycle']='active';return{'units':_0x35ff6b['map'](({unitID:_0x2f4571,status:_0x348531})=>({'unitID':_0x2f4571,'status':_0x348531}))};}async['commitChangeset'](_0x141bc0,_0x110512){this['_assertOpen']();let {changeset:_0x503ef9}=_0x110512,_0x61d713=this['_activeUnit'](_0x503ef9['unitID']);if(!_0x61d713)throw o('Cannot\x20commit\x20to\x20a\x20missing\x20unit');if(_0x61d713['record']['headRevision']!==_0x503ef9['revision']-0x1)return{'status':'revision-mismatch','actualHeadRevision':_0x61d713['record']['headRevision']};let _0x14a94c=c(_0x503ef9);return _0x14a94c['createTime']=Math['floor'](Date['now']()/0x3e8),_0x61d713['changesets']['set'](_0x14a94c['revision'],_0x14a94c),_0x61d713['record']={..._0x61d713['record'],'headRevision':_0x14a94c['revision']},{'status':'committed','changeset':c(_0x14a94c),'headRevision':_0x61d713['record']['headRevision']};}async['saveSnapshot'](_0x88d786,_0x2d2f4d){this['_assertOpen']();let _0x283b46=this['_activeUnit'](_0x2d2f4d['snapshot']['unitID']);if(!_0x283b46)throw o('Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0x2d2f4d['snapshot']['type']!==_0x283b46['record']['type']||_0x2d2f4d['snapshot']['rev']<0x1||_0x2d2f4d['snapshot']['rev']>_0x283b46['record']['headRevision'])throw a('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');let _0x1f3225=c(_0x2d2f4d['snapshot']);i(_0x283b46,r(_0x2d2f4d['sheetBlocks'])),_0x283b46['snapshots']['set'](_0x1f3225['rev'],_0x1f3225);}async['getSheetBlock'](_0x451800,_0x27937a,_0x2c8bf3){this['_assertOpen']();let _0x50fdb5=this['_activeUnit'](_0x27937a)?.['sheetBlocks']['get'](_0x2c8bf3);return _0x50fdb5?c(_0x50fdb5):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_units']['clear'](),this['_tombstones']['clear']());}['_activeUnit'](_0x3c9285){let _0x4c7898=this['_units']['get'](_0x3c9285);return _0x4c7898?.['lifecycle']==='active'?_0x4c7898:void 0x0;}['_assertOpen'](){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Memory\x20Database\x20Adapter\x20is\x20disposed');}};function n(_0x13956d){let {record:_0xd17b1c,snapshot:_0x117453}=_0x13956d;if(_0xd17b1c['headRevision']!==0x1||_0x117453['rev']!==0x1||_0x117453['unitID']!==_0xd17b1c['unitID']||_0x117453['type']!==_0xd17b1c['type'])throw a('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');if(typeof _0xd17b1c['creatorID']!='string'||_0xd17b1c['creatorID']['length']===0x0||!Number['isSafeInteger'](_0xd17b1c['createdAt'])||_0xd17b1c['createdAt']<0x0)throw a('Unit\x20creation\x20requires\x20creatorID\x20and\x20createdAt\x20in\x20Unix\x20milliseconds');}function r(_0x3ff124){let _0xae8655=new Map();for(let _0x289851 of _0x3ff124??[])_0xae8655['set'](_0x289851['id'],c(_0x289851));return _0xae8655;}function i(_0x19b31f,_0x75e315){for(let [_0x2c4778,_0x59a6a9]of _0x75e315)_0x19b31f['sheetBlocks']['set'](_0x2c4778,_0x59a6a9);}function a(_0x4dc984){return new e['CollabError']('INVALID_REQUEST',_0x4dc984);}function o(_0x251bf4){return new e['CollabError']('UNIT_NOT_FOUND',_0x251bf4);}function s(_0x1d0105){return[...new Set(_0x1d0105)];}function c(_0x4b09c5){return structuredClone(_0x4b09c5);}exports['MemoryDatabaseAdapter']=t;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x29e0(_0x3f65c6,_0x18e4f7){_0x3f65c6=_0x3f65c6-0xbb;const _0x351787=_0x3517();let _0x29e018=_0x351787[_0x3f65c6];return _0x29e018;}const _0x58fd52=_0x29e0;(function(_0x1f3850,_0x5b8a96){const _0x50d18e=_0x29e0,_0x256ee3=_0x1f3850();while(!![]){try{const _0x4c45a9=parseInt(_0x50d18e(0xc5))/0x1+parseInt(_0x50d18e(0xbf))/0x2+-parseInt(_0x50d18e(0xc0))/0x3*(parseInt(_0x50d18e(0xbd))/0x4)+-parseInt(_0x50d18e(0xc3))/0x5*(-parseInt(_0x50d18e(0xc1))/0x6)+-parseInt(_0x50d18e(0xbb))/0x7*(-parseInt(_0x50d18e(0xbc))/0x8)+-parseInt(_0x50d18e(0xbe))/0x9+parseInt(_0x50d18e(0xc4))/0xa*(parseInt(_0x50d18e(0xc6))/0xb);if(_0x4c45a9===_0x5b8a96)break;else _0x256ee3['push'](_0x256ee3['shift']());}catch(_0x43e532){_0x256ee3['push'](_0x256ee3['shift']());}}}(_0x3517,0xc060a));function _0x3517(){const _0x1a6f98=['1965636VuwfYQ','339vdRter','2475906hxbSGr','MemoryDatabaseAdapter','15JeZLmS','590NXMsfq','448934awTqEo','157487CXowIz','223475AjrIMY','40ThMURU','50360HieASq','13170465mxVjMR'];_0x3517=function(){return _0x1a6f98;};return _0x3517();}import _0x512d49 from'./index.cjs';const facadeExport0=_0x512d49[_0x58fd52(0xc2)];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.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@univerjs-pro/collaboration-service": "1.
|
|
20
|
-
"@univerjs/protocol": "1.
|
|
19
|
+
"@univerjs-pro/collaboration-service": "1.3.1",
|
|
20
|
+
"@univerjs/protocol": "1.3.1"
|
|
21
21
|
}
|
|
22
22
|
}
|