@univerjs-pro/collaboration-database-memory 1.2.0 → 1.3.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/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'](_0x27de13,_0x2aae97){this['_assertOpen']();let _0x4caa37=this['_activeUnit'](_0x2aae97);return _0x4caa37?c(_0x4caa37['record']):null;}async['getSnapshot'](_0x20af83,_0x2c13c2,_0xa8a2a){let _0x8c97f2=this['_getSnapshot'](_0x2c13c2,_0xa8a2a);return _0x8c97f2?c(_0x8c97f2):null;}async['getSnapshotInfo'](_0x3891e2,_0x4cfd13,_0x5780b1){let _0x4e5451=this['_getSnapshot'](_0x4cfd13,_0x5780b1);return _0x4e5451?{'unitID':_0x4e5451['unitID'],'type':_0x4e5451['type'],'rev':_0x4e5451['rev']}:null;}['_getSnapshot'](_0x2030e1,_0x27bcab){this['_assertOpen']();let _0x4c7096=this['_activeUnit'](_0x2030e1);if(!_0x4c7096)return null;let _0x53a929=_0x27bcab?.['revision'],_0x150733=_0x53a929===void 0x0?_0x4c7096['record']['headRevision']:Math['min'](_0x53a929,_0x4c7096['record']['headRevision']),_0x4d6e0a=-0x1;for(let _0x447ea7 of _0x4c7096['snapshots']['keys']())_0x447ea7<=_0x150733&&_0x447ea7>_0x4d6e0a&&(_0x4d6e0a=_0x447ea7);return _0x4c7096['snapshots']['get'](_0x4d6e0a)??null;}async['getChangesets'](_0x5befae,_0x42328b,_0x56131f){if(this['_assertOpen'](),_0x56131f['from']<0x0||_0x56131f['to']!==void 0x0&&_0x56131f['to']<0x0)throw a('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x39f3bb=this['_activeUnit'](_0x42328b);return _0x39f3bb?[..._0x39f3bb['changesets']['entries']()]['filter'](([_0x4e9edf])=>_0x4e9edf>_0x56131f['from']&&(_0x56131f['to']===void 0x0||_0x4e9edf<=_0x56131f['to']))['sort'](([_0x5b5d5d],[_0x521542])=>_0x5b5d5d-_0x521542)['map'](([,_0x52a28f])=>c(_0x52a28f)):null;}async['createUnit'](_0x4ff3f0,_0x135443){this['_assertOpen'](),n(_0x135443);let _0x430485=this['_units']['get'](_0x135443['record']['unitID']);if(_0x430485){if(_0x430485['lifecycle']==='soft-deleted')throw a('A\x20soft-deleted\x20unit\x20ID\x20cannot\x20be\x20reused');return{'status':'already-exists','record':c(_0x430485['record'])};}if(this['_tombstones']['has'](_0x135443['record']['unitID']))throw a('A\x20purged\x20unit\x20ID\x20cannot\x20be\x20reused');let _0x58b4cb=r(_0x135443['sheetBlocks']),_0x20c443={'record':c(_0x135443['record']),'lifecycle':'active','snapshots':new Map([[0x1,c(_0x135443['snapshot'])]]),'changesets':new Map(),'sheetBlocks':_0x58b4cb};return this['_units']['set'](_0x135443['record']['unitID'],_0x20c443),{'status':'created','record':c(_0x20c443['record'])};}async['deleteUnits'](_0x1a0ce2,_0x40373a){this['_assertOpen']();let _0x6145af=s(_0x40373a['unitIDs'])['map'](_0x59963b=>{let _0x482ba2=this['_units']['get'](_0x59963b);if(_0x40373a['hardDelete']){if(_0x482ba2)return{'unitID':_0x59963b,'stored':_0x482ba2,'status':'hard-deleted'};if(this['_tombstones']['has'](_0x59963b))return{'unitID':_0x59963b,'status':'already-hard-deleted'};throw o('Cannot\x20hard-delete\x20a\x20missing\x20unit');}if(!_0x482ba2||this['_tombstones']['has'](_0x59963b))throw o('Cannot\x20soft-delete\x20a\x20missing\x20unit');return{'unitID':_0x59963b,'stored':_0x482ba2,'status':_0x482ba2['lifecycle']==='active'?'soft-deleted':'already-soft-deleted'};});for(let _0x69d68f of _0x6145af)_0x40373a['hardDelete']&&_0x69d68f['status']==='hard-deleted'?(this['_units']['delete'](_0x69d68f['unitID']),this['_tombstones']['add'](_0x69d68f['unitID'])):!_0x40373a['hardDelete']&&_0x69d68f['stored']&&(_0x69d68f['stored']['lifecycle']='soft-deleted');return{'units':_0x6145af['map'](({unitID:_0x32622b,status:_0x431e56})=>({'unitID':_0x32622b,'status':_0x431e56}))};}async['recoverUnits'](_0x2b5681,_0x2bc5ca){this['_assertOpen']();let _0x4af50d=s(_0x2bc5ca['unitIDs'])['map'](_0x403918=>{if(this['_tombstones']['has'](_0x403918))throw a('A\x20purged\x20unit\x20cannot\x20be\x20recovered');let _0x4e090c=this['_units']['get'](_0x403918);if(!_0x4e090c)throw o('Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x403918,'stored':_0x4e090c,'status':_0x4e090c['lifecycle']==='active'?'already-active':'recovered'};});for(let _0x19da73 of _0x4af50d)_0x19da73['stored']['lifecycle']='active';return{'units':_0x4af50d['map'](({unitID:_0x4a342e,status:_0x1c4a01})=>({'unitID':_0x4a342e,'status':_0x1c4a01}))};}async['commitChangeset'](_0xbcef38,_0x3b478b){this['_assertOpen']();let {changeset:_0xc5025f}=_0x3b478b,_0x5acab4=this['_activeUnit'](_0xc5025f['unitID']);if(!_0x5acab4)throw o('Cannot\x20commit\x20to\x20a\x20missing\x20unit');if(_0x5acab4['record']['headRevision']!==_0xc5025f['revision']-0x1)return{'status':'revision-mismatch','actualHeadRevision':_0x5acab4['record']['headRevision']};let _0x2399a8=c(_0xc5025f);return _0x2399a8['createTime']=Math['floor'](Date['now']()/0x3e8),_0x5acab4['changesets']['set'](_0x2399a8['revision'],_0x2399a8),_0x5acab4['record']={..._0x5acab4['record'],'headRevision':_0x2399a8['revision']},{'status':'committed','changeset':c(_0x2399a8),'headRevision':_0x5acab4['record']['headRevision']};}async['saveSnapshot'](_0x5b4df6,_0xc5ed5f){this['_assertOpen']();let _0x384fbe=this['_activeUnit'](_0xc5ed5f['snapshot']['unitID']);if(!_0x384fbe)throw o('Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0xc5ed5f['snapshot']['type']!==_0x384fbe['record']['type']||_0xc5ed5f['snapshot']['rev']<0x1||_0xc5ed5f['snapshot']['rev']>_0x384fbe['record']['headRevision'])throw a('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');let _0x1bffab=c(_0xc5ed5f['snapshot']);i(_0x384fbe,r(_0xc5ed5f['sheetBlocks'])),_0x384fbe['snapshots']['set'](_0x1bffab['rev'],_0x1bffab);}async['getSheetBlock'](_0x5da940,_0x4a219b,_0x53c2d9){this['_assertOpen']();let _0x57f394=this['_activeUnit'](_0x4a219b)?.['sheetBlocks']['get'](_0x53c2d9);return _0x57f394?c(_0x57f394):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_units']['clear'](),this['_tombstones']['clear']());}['_activeUnit'](_0x58f416){let _0x5247cd=this['_units']['get'](_0x58f416);return _0x5247cd?.['lifecycle']==='active'?_0x5247cd:void 0x0;}['_assertOpen'](){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Memory\x20Database\x20Adapter\x20is\x20disposed');}};function n(_0x18faf4){let {record:_0x4578bb,snapshot:_0x19682e}=_0x18faf4;if(_0x4578bb['headRevision']!==0x1||_0x19682e['rev']!==0x1||_0x19682e['unitID']!==_0x4578bb['unitID']||_0x19682e['type']!==_0x4578bb['type'])throw a('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');if(typeof _0x4578bb['creatorID']!='string'||_0x4578bb['creatorID']['length']===0x0||!Number['isSafeInteger'](_0x4578bb['createdAt'])||_0x4578bb['createdAt']<0x0)throw a('Unit\x20creation\x20requires\x20creatorID\x20and\x20createdAt\x20in\x20Unix\x20milliseconds');}function r(_0xfe22f4){let _0x26ffbf=new Map();for(let _0x23dd94 of _0xfe22f4??[])_0x26ffbf['set'](_0x23dd94['id'],c(_0x23dd94));return _0x26ffbf;}function i(_0x1d0011,_0x3e8f2e){for(let [_0x5cbbb0,_0xb79603]of _0x3e8f2e)_0x1d0011['sheetBlocks']['set'](_0x5cbbb0,_0xb79603);}function a(_0x3a8084){return new e['CollabError']('INVALID_REQUEST',_0x3a8084);}function o(_0x2459be){return new e['CollabError']('UNIT_NOT_FOUND',_0x2459be);}function s(_0x1da507){return[...new Set(_0x1da507)];}function c(_0xd4f8b6){return structuredClone(_0xd4f8b6);}exports['MemoryDatabaseAdapter']=t;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x493485=_0x21bd;(function(_0x5247ca,_0x305308){const _0x121d12=_0x21bd,_0x48150b=_0x5247ca();while(!![]){try{const _0x1321e0=parseInt(_0x121d12(0x162))/0x1+-parseInt(_0x121d12(0x15d))/0x2*(-parseInt(_0x121d12(0x15c))/0x3)+-parseInt(_0x121d12(0x15e))/0x4+parseInt(_0x121d12(0x164))/0x5*(parseInt(_0x121d12(0x160))/0x6)+-parseInt(_0x121d12(0x161))/0x7+parseInt(_0x121d12(0x165))/0x8+parseInt(_0x121d12(0x163))/0x9;if(_0x1321e0===_0x305308)break;else _0x48150b['push'](_0x48150b['shift']());}catch(_0x1ef1e9){_0x48150b['push'](_0x48150b['shift']());}}}(_0x234d,0x3609e));function _0x21bd(_0x4e13ed,_0x1c64c5){_0x4e13ed=_0x4e13ed-0x15c;const _0x234df8=_0x234d();let _0x21bd34=_0x234df8[_0x4e13ed];return _0x21bd34;}import _0x2643a8 from'./index.cjs';const facadeExport0=_0x2643a8[_0x493485(0x15f)];function _0x234d(){const _0x5dc093=['2723623yRmUWE','4244bXMnFU','912177rQYFVx','472510QDUpCa','3083280rNYBwQ','151005IKlmYa','2MnZmjx','1235676kKqSXl','MemoryDatabaseAdapter','24RMCkqj'];_0x234d=function(){return _0x5dc093;};return _0x234d();}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.0",
|
|
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.0",
|
|
20
|
+
"@univerjs/protocol": "1.3.0"
|
|
21
21
|
}
|
|
22
22
|
}
|