@univerjs-pro/collaboration-database-memory 1.0.0-rc.0 → 1.0.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 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'](_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;
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'](_0x100885,_0x4f871d){this['_assertOpen']();let _0x45d8cd=this['_activeUnit'](_0x4f871d);return _0x45d8cd?c(_0x45d8cd['record']):null;}async['getSnapshot'](_0x200060,_0x1b6a24,_0x951b3e){let _0x569796=this['_getSnapshot'](_0x1b6a24,_0x951b3e);return _0x569796?c(_0x569796):null;}async['getSnapshotInfo'](_0xadb0e8,_0x5e0e77,_0x142d09){let _0x481cd1=this['_getSnapshot'](_0x5e0e77,_0x142d09);return _0x481cd1?{'unitID':_0x481cd1['unitID'],'type':_0x481cd1['type'],'rev':_0x481cd1['rev']}:null;}['_getSnapshot'](_0x302c8a,_0x5d3586){this['_assertOpen']();let _0x20bea7=this['_activeUnit'](_0x302c8a);if(!_0x20bea7)return null;let _0x584c7e=_0x5d3586?.['revision'],_0x106928=_0x584c7e===void 0x0?_0x20bea7['record']['headRevision']:Math['min'](_0x584c7e,_0x20bea7['record']['headRevision']),_0x388979=-0x1;for(let _0x564a4d of _0x20bea7['snapshots']['keys']())_0x564a4d<=_0x106928&&_0x564a4d>_0x388979&&(_0x388979=_0x564a4d);return _0x20bea7['snapshots']['get'](_0x388979)??null;}async['getChangesets'](_0x28d9b4,_0x28c8ef,_0xa9b3ff){if(this['_assertOpen'](),_0xa9b3ff['from']<0x0||_0xa9b3ff['to']!==void 0x0&&_0xa9b3ff['to']<0x0)throw a('Changeset\x20range\x20revisions\x20cannot\x20be\x20negative');let _0x172f56=this['_activeUnit'](_0x28c8ef);return _0x172f56?[..._0x172f56['changesets']['entries']()]['filter'](([_0x2c3a70])=>_0x2c3a70>_0xa9b3ff['from']&&(_0xa9b3ff['to']===void 0x0||_0x2c3a70<=_0xa9b3ff['to']))['sort'](([_0x42f689],[_0x41ddbe])=>_0x42f689-_0x41ddbe)['map'](([,_0x22c1e3])=>c(_0x22c1e3)):null;}async['createUnit'](_0x6c67b8,_0x2f78db){this['_assertOpen'](),n(_0x2f78db);let _0x5d43a4=this['_units']['get'](_0x2f78db['record']['unitID']);if(_0x5d43a4){if(_0x5d43a4['lifecycle']==='soft-deleted')throw a('A\x20soft-deleted\x20unit\x20ID\x20cannot\x20be\x20reused');return{'status':'already-exists','record':c(_0x5d43a4['record'])};}if(this['_tombstones']['has'](_0x2f78db['record']['unitID']))throw a('A\x20purged\x20unit\x20ID\x20cannot\x20be\x20reused');let _0x20da6e=r(_0x2f78db['sheetBlocks']),_0x3badd4={'record':c(_0x2f78db['record']),'lifecycle':'active','snapshots':new Map([[0x1,c(_0x2f78db['snapshot'])]]),'changesets':new Map(),'sheetBlocks':_0x20da6e};return this['_units']['set'](_0x2f78db['record']['unitID'],_0x3badd4),{'status':'created','record':c(_0x3badd4['record'])};}async['deleteUnits'](_0x16be4d,_0x114caa){this['_assertOpen']();let _0x4349f2=s(_0x114caa['unitIDs'])['map'](_0x621bc9=>{let _0x13b1c8=this['_units']['get'](_0x621bc9);if(_0x114caa['hardDelete']){if(_0x13b1c8)return{'unitID':_0x621bc9,'stored':_0x13b1c8,'status':'hard-deleted'};if(this['_tombstones']['has'](_0x621bc9))return{'unitID':_0x621bc9,'status':'already-hard-deleted'};throw o('Cannot\x20hard-delete\x20a\x20missing\x20unit');}if(!_0x13b1c8||this['_tombstones']['has'](_0x621bc9))throw o('Cannot\x20soft-delete\x20a\x20missing\x20unit');return{'unitID':_0x621bc9,'stored':_0x13b1c8,'status':_0x13b1c8['lifecycle']==='active'?'soft-deleted':'already-soft-deleted'};});for(let _0x3de7d7 of _0x4349f2)_0x114caa['hardDelete']&&_0x3de7d7['status']==='hard-deleted'?(this['_units']['delete'](_0x3de7d7['unitID']),this['_tombstones']['add'](_0x3de7d7['unitID'])):!_0x114caa['hardDelete']&&_0x3de7d7['stored']&&(_0x3de7d7['stored']['lifecycle']='soft-deleted');return{'units':_0x4349f2['map'](({unitID:_0xd887f6,status:_0x47ac10})=>({'unitID':_0xd887f6,'status':_0x47ac10}))};}async['recoverUnits'](_0x543d9b,_0x7a730f){this['_assertOpen']();let _0x2cbf6e=s(_0x7a730f['unitIDs'])['map'](_0x4d34f9=>{if(this['_tombstones']['has'](_0x4d34f9))throw a('A\x20purged\x20unit\x20cannot\x20be\x20recovered');let _0x4996a3=this['_units']['get'](_0x4d34f9);if(!_0x4996a3)throw o('Cannot\x20recover\x20a\x20missing\x20unit');return{'unitID':_0x4d34f9,'stored':_0x4996a3,'status':_0x4996a3['lifecycle']==='active'?'already-active':'recovered'};});for(let _0x49c434 of _0x2cbf6e)_0x49c434['stored']['lifecycle']='active';return{'units':_0x2cbf6e['map'](({unitID:_0x544231,status:_0x5d97b5})=>({'unitID':_0x544231,'status':_0x5d97b5}))};}async['commitChangeset'](_0x9e6d5b,_0xe919e4){this['_assertOpen']();let {changeset:_0x47367b}=_0xe919e4,_0x2270e7=this['_activeUnit'](_0x47367b['unitID']);if(!_0x2270e7)throw o('Cannot\x20commit\x20to\x20a\x20missing\x20unit');if(_0x2270e7['record']['headRevision']!==_0x47367b['revision']-0x1)return{'status':'revision-mismatch','actualHeadRevision':_0x2270e7['record']['headRevision']};let _0x1ba64a=c(_0x47367b);return _0x1ba64a['createTime']=Math['floor'](Date['now']()/0x3e8),_0x2270e7['changesets']['set'](_0x1ba64a['revision'],_0x1ba64a),_0x2270e7['record']={..._0x2270e7['record'],'headRevision':_0x1ba64a['revision']},{'status':'committed','changeset':c(_0x1ba64a),'headRevision':_0x2270e7['record']['headRevision']};}async['saveSnapshot'](_0x434896,_0x3c8872){this['_assertOpen']();let _0x3ddb9f=this['_activeUnit'](_0x3c8872['snapshot']['unitID']);if(!_0x3ddb9f)throw o('Cannot\x20snapshot\x20a\x20missing\x20unit');if(_0x3c8872['snapshot']['type']!==_0x3ddb9f['record']['type']||_0x3c8872['snapshot']['rev']<0x1||_0x3c8872['snapshot']['rev']>_0x3ddb9f['record']['headRevision'])throw a('Snapshot\x20does\x20not\x20match\x20the\x20stored\x20unit\x20head');let _0xbdccde=c(_0x3c8872['snapshot']);i(_0x3ddb9f,r(_0x3c8872['sheetBlocks'])),_0x3ddb9f['snapshots']['set'](_0xbdccde['rev'],_0xbdccde);}async['getSheetBlock'](_0x27adee,_0x3f6fb0,_0x46e0e3){this['_assertOpen']();let _0x58450=this['_activeUnit'](_0x3f6fb0)?.['sheetBlocks']['get'](_0x46e0e3);return _0x58450?c(_0x58450):null;}async['dispose'](){this['_disposed']||(this['_disposed']=!0x0,this['_units']['clear'](),this['_tombstones']['clear']());}['_activeUnit'](_0x43096b){let _0x143341=this['_units']['get'](_0x43096b);return _0x143341?.['lifecycle']==='active'?_0x143341:void 0x0;}['_assertOpen'](){if(this['_disposed'])throw new e['CollabError']('INTERNAL_ERROR','Memory\x20Database\x20Adapter\x20is\x20disposed');}};function n(_0x3b4ad1){let {record:_0x1e526b,snapshot:_0x652af}=_0x3b4ad1;if(_0x1e526b['headRevision']!==0x1||_0x652af['rev']!==0x1||_0x652af['unitID']!==_0x1e526b['unitID']||_0x652af['type']!==_0x1e526b['type'])throw a('Initial\x20unit\x20record\x20and\x20snapshot\x20must\x20match\x20at\x20revision\x201');if(typeof _0x1e526b['creatorID']!='string'||_0x1e526b['creatorID']['length']===0x0||!Number['isSafeInteger'](_0x1e526b['createdAt'])||_0x1e526b['createdAt']<0x0)throw a('Unit\x20creation\x20requires\x20creatorID\x20and\x20createdAt\x20in\x20Unix\x20milliseconds');}function r(_0x5c701d){let _0x3a5bbe=new Map();for(let _0x27c486 of _0x5c701d??[])_0x3a5bbe['set'](_0x27c486['id'],c(_0x27c486));return _0x3a5bbe;}function i(_0x806437,_0x41031c){for(let [_0xaee5dd,_0x3964b4]of _0x41031c)_0x806437['sheetBlocks']['set'](_0xaee5dd,_0x3964b4);}function a(_0x5c4e9f){return new e['CollabError']('INVALID_REQUEST',_0x5c4e9f);}function o(_0x528681){return new e['CollabError']('UNIT_NOT_FOUND',_0x528681);}function s(_0x4a28d2){return[...new Set(_0x4a28d2)];}function c(_0x265461){return structuredClone(_0x265461);}exports['MemoryDatabaseAdapter']=t;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
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};
1
+ const _0x2df162=_0x2a8e;(function(_0x291cbe,_0x57058d){const _0x4a9c5a=_0x2a8e,_0x4f060d=_0x291cbe();while(!![]){try{const _0xecdc99=-parseInt(_0x4a9c5a(0x109))/0x1*(parseInt(_0x4a9c5a(0x113))/0x2)+parseInt(_0x4a9c5a(0x111))/0x3+-parseInt(_0x4a9c5a(0x10b))/0x4*(parseInt(_0x4a9c5a(0x10e))/0x5)+parseInt(_0x4a9c5a(0x10c))/0x6*(-parseInt(_0x4a9c5a(0x108))/0x7)+parseInt(_0x4a9c5a(0x10f))/0x8+parseInt(_0x4a9c5a(0x112))/0x9*(parseInt(_0x4a9c5a(0x107))/0xa)+parseInt(_0x4a9c5a(0x10d))/0xb*(parseInt(_0x4a9c5a(0x110))/0xc);if(_0xecdc99===_0x57058d)break;else _0x4f060d['push'](_0x4f060d['shift']());}catch(_0x5c3ffa){_0x4f060d['push'](_0x4f060d['shift']());}}}(_0x2af3,0x5e6ab));import _0x550f42 from'./index.cjs';const facadeExport0=_0x550f42[_0x2df162(0x10a)];function _0x2a8e(_0x3701ce,_0xe49fca){_0x3701ce=_0x3701ce-0x107;const _0x2af3d4=_0x2af3();let _0x2a8e88=_0x2af3d4[_0x3701ce];return _0x2a8e88;}function _0x2af3(){const _0x11ab3e=['11PZcqbD','7505XBzpNJ','1248880ZSETXd','12801072XmdQCJ','2258574sOAENO','251109ibWwgU','2xgSoOu','130RvBkts','6412EUeQWk','603835JwOcCK','MemoryDatabaseAdapter','1788HHwHHM','4434GPQEnC'];_0x2af3=function(){return _0x11ab3e;};return _0x2af3();}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-rc.0",
4
+ "version": "1.0.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.0.0-rc.0",
20
- "@univerjs/protocol": "1.0.0-rc.0"
19
+ "@univerjs-pro/collaboration-service": "1.0.1",
20
+ "@univerjs/protocol": "1.0.1"
21
21
  }
22
22
  }