@k-table/next 1.0.19 → 1.0.21
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/fs.cjs +1 -1
- package/dist/fs.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _0x1cddf9=_0x2715;(function(_0x22b372,_0x232b80){const _0x88e1eb=_0x2715,_0x2ca007=_0x22b372();while(!![]){try{const _0xb6861f=parseInt(_0x88e1eb(0xe8))/0x1+-parseInt(_0x88e1eb(0x126))/0x2*(-parseInt(_0x88e1eb(0xf5))/0x3)+parseInt(_0x88e1eb(0xd5))/0x4*(parseInt(_0x88e1eb(0xfe))/0x5)+-parseInt(_0x88e1eb(0xd4))/0x6+parseInt(_0x88e1eb(0xd9))/0x7+parseInt(_0x88e1eb(0x127))/0x8*(-parseInt(_0x88e1eb(0xfc))/0x9)+-parseInt(_0x88e1eb(0x101))/0xa;if(_0xb6861f===_0x232b80)break;else _0x2ca007['push'](_0x2ca007['shift']());}catch(_0x4e9aca){_0x2ca007['push'](_0x2ca007['shift']());}}}(_0x3c71,0x85c66));var fs=require('fs'),path=require(_0x1cddf9(0xd2)),store=require(_0x1cddf9(0xe3)),crypto=require('crypto');function resolveRoot(_0x295d84,_0x1c97cd=process['cwd']()){const _0x1845f6=_0x1cddf9,_0x3fffb5=path['isAbsolute'](_0x295d84)?_0x295d84:path[_0x1845f6(0xf4)](_0x1c97cd,_0x295d84);return fs[_0x1845f6(0xf7)](_0x3fffb5,{'recursive':!![]}),_0x3fffb5;}function artifactDir(_0x5d925f,_0x10c2d1){return path['join'](_0x5d925f,_0x10c2d1);}function objectPath(_0x5b5f81,_0x4c4283){const _0x4b0943=_0x1cddf9;return path[_0x4b0943(0xfa)](_0x5b5f81,_0x4b0943(0x11c),_0x4c4283[_0x4b0943(0xe2)](0x0,0x2),_0x4c4283);}function itemDir(_0x2c0f70,_0x1d0401,_0x3c647d){const _0x4e7a8f=_0x1cddf9;return path[_0x4e7a8f(0xfa)](_0x2c0f70,_0x4e7a8f(0x104),_0x1d0401,_0x3c647d);}function newEtag(){const _0x46c527=_0x1cddf9;return Date[_0x46c527(0xf1)]()['toString'](0x24)+'-'+Math[_0x46c527(0xdc)]()[_0x46c527(0xf0)](0x24)[_0x46c527(0xe2)](0x2,0x8);}function readEtag(_0x20844c){const _0x10e313=_0x1cddf9,_0x5aca40=path[_0x10e313(0xfa)](_0x20844c,_0x10e313(0x128));return fs[_0x10e313(0x10b)](_0x5aca40)?fs[_0x10e313(0xdf)](_0x5aca40,_0x10e313(0xd1))[_0x10e313(0xe0)]():void 0x0;}function writeArtifactDir(_0x4afef7,_0x497368,_0x5c4020){const _0x1cbb49=_0x1cddf9;fs[_0x1cbb49(0xf7)](path[_0x1cbb49(0xfa)](_0x4afef7,_0x1cbb49(0x11b)),{'recursive':!![]});const _0x250566=store[_0x1cbb49(0xea)](_0x497368);fs['writeFileSync'](path[_0x1cbb49(0xfa)](_0x4afef7,store[_0x1cbb49(0x106)]),_0x250566[store[_0x1cbb49(0x106)]]??'{}',_0x1cbb49(0xd1)),fs[_0x1cbb49(0x121)](path[_0x1cbb49(0xfa)](_0x4afef7,store[_0x1cbb49(0xd6)]),_0x250566[store[_0x1cbb49(0xd6)]]??'',_0x1cbb49(0xd1));const _0x5d0576=path[_0x1cbb49(0xfa)](_0x4afef7,store[_0x1cbb49(0x119)]),_0x14ab3e=path['join'](_0x4afef7,store[_0x1cbb49(0xf8)]);if(_0x250566[store[_0x1cbb49(0x119)]])fs[_0x1cbb49(0x121)](_0x5d0576,_0x250566[store[_0x1cbb49(0x119)]],_0x1cbb49(0xd1));else{if(fs[_0x1cbb49(0x10b)](_0x5d0576))fs['rmSync'](_0x5d0576);}if(_0x250566[store[_0x1cbb49(0xf8)]])fs['writeFileSync'](_0x14ab3e,_0x250566[store[_0x1cbb49(0xf8)]],'utf8');else{if(fs['existsSync'](_0x14ab3e))fs[_0x1cbb49(0x11e)](_0x14ab3e);}fs[_0x1cbb49(0x121)](path[_0x1cbb49(0xfa)](_0x4afef7,_0x1cbb49(0x128)),_0x5c4020,_0x1cbb49(0xd1));}function readArtifactDir(_0x4c40a9,_0x90e0b8){const _0x4e37f4=_0x1cddf9,_0x560a3e={},_0x1715cc=path[_0x4e37f4(0xfa)](_0x4c40a9,store[_0x4e37f4(0x106)]),_0xf6be00=path[_0x4e37f4(0xfa)](_0x4c40a9,store[_0x4e37f4(0xd6)]);if(fs[_0x4e37f4(0x10b)](_0x1715cc))_0x560a3e[store[_0x4e37f4(0x106)]]=fs[_0x4e37f4(0xdf)](_0x1715cc,_0x4e37f4(0xd1));if(fs[_0x4e37f4(0x10b)](_0xf6be00))_0x560a3e[store[_0x4e37f4(0xd6)]]=fs[_0x4e37f4(0xdf)](_0xf6be00,_0x4e37f4(0xd1));const _0x5ab20c=path[_0x4e37f4(0xfa)](_0x4c40a9,store['ARTIFACT_FILE_FILL']),_0x112471=path[_0x4e37f4(0xfa)](_0x4c40a9,store[_0x4e37f4(0xf8)]);if(fs[_0x4e37f4(0x10b)](_0x5ab20c))_0x560a3e[store[_0x4e37f4(0x119)]]=fs[_0x4e37f4(0xdf)](_0x5ab20c,'utf8');if(fs[_0x4e37f4(0x10b)](_0x112471))_0x560a3e[store[_0x4e37f4(0xf8)]]=fs[_0x4e37f4(0xdf)](_0x112471,'utf8');return{...store[_0x4e37f4(0x100)](_0x560a3e,_0x90e0b8),'etag':readEtag(_0x4c40a9)};}function createFsArtifactStore(_0x4272d3,_0x50076c=[]){const _0x3403e9=_0x1cddf9;fs[_0x3403e9(0xf7)](_0x4272d3,{'recursive':!![]});for(const _0xdcd77f of _0x50076c){const _0x328659=artifactDir(_0x4272d3,_0xdcd77f['id']),_0x323e27=path[_0x3403e9(0xfa)](_0x328659,store[_0x3403e9(0xd6)]);if(!fs[_0x3403e9(0x10b)](_0x323e27))writeArtifactDir(_0x328659,_0xdcd77f,_0xdcd77f[_0x3403e9(0xd7)]??newEtag());}return{async 'list'(_0x5d10a5){const _0x561ca3=_0x3403e9;if(!fs[_0x561ca3(0x10b)](_0x4272d3))return[];const _0x768b0a=[];for(const _0x5e40cb of fs[_0x561ca3(0x124)](_0x4272d3,{'withFileTypes':!![]})){if(!_0x5e40cb[_0x561ca3(0x115)]())continue;try{const _0x18fc57=readArtifactDir(artifactDir(_0x4272d3,_0x5e40cb[_0x561ca3(0xef)]),_0x5e40cb[_0x561ca3(0xef)]);if(!_0x5d10a5||_0x18fc57[_0x561ca3(0x125)]===_0x5d10a5)_0x768b0a[_0x561ca3(0x107)]({'id':_0x18fc57['id'],'name':_0x18fc57['name'],'kind':_0x18fc57['kind']});}catch{}}return _0x768b0a;},async 'get'(_0x423b8a){const _0x2a0834=_0x3403e9,_0x1fd844=artifactDir(_0x4272d3,_0x423b8a);if(!fs['existsSync'](_0x1fd844))throw new store['KtNotFoundError'](_0x2a0834(0x111)+_0x423b8a);return readArtifactDir(_0x1fd844,_0x423b8a);},async 'save'(_0x459f7b){const _0xf6871d=_0x3403e9,_0x4e98ff=artifactDir(_0x4272d3,_0x459f7b['id']),_0x48e677=fs[_0xf6871d(0x10b)](_0x4e98ff)?readArtifactDir(_0x4e98ff,_0x459f7b['id']):void 0x0;if(_0x459f7b['etag']&&_0x48e677?.[_0xf6871d(0xd7)]&&_0x459f7b['etag']!==_0x48e677['etag'])throw new store['KtConflictError'](_0xf6871d(0x123),_0x48e677);const _0x42f569=newEtag();return writeArtifactDir(_0x4e98ff,_0x459f7b,_0x42f569),{..._0x459f7b,'etag':_0x42f569};},async 'create'(_0x4c8c03){const _0x36f67b=_0x3403e9,_0x34ee39=_0x4c8c03['kind']+'-'+Math[_0x36f67b(0xdc)]()[_0x36f67b(0xf0)](0x24)['slice'](0x2,0xa),_0x5ede1e={'id':_0x34ee39,'name':_0x4c8c03[_0x36f67b(0xef)],'kind':_0x4c8c03[_0x36f67b(0x125)],'ktl':store[_0x36f67b(0xe7)]};return this[_0x36f67b(0xdd)](_0x5ede1e);},async 'remove'(_0xd10972){const _0x31271f=_0x3403e9,_0x2cecdf=artifactDir(_0x4272d3,_0xd10972);if(!fs[_0x31271f(0x10b)](_0x2cecdf))throw new store['KtNotFoundError'](_0x31271f(0x111)+_0xd10972);fs[_0x31271f(0x11e)](_0x2cecdf,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x577452,_0x2357bf={}){const _0x55b7ce=_0x1cddf9;fs[_0x55b7ce(0xf7)](_0x577452,{'recursive':!![]});const _0x3aec20=_0x2d2daf=>path[_0x55b7ce(0xfa)](_0x577452,_0x2d2daf+_0x55b7ce(0x11a));for(const [_0x203eda,_0x58b457]of Object['entries'](_0x2357bf)){if(!fs[_0x55b7ce(0x10b)](_0x3aec20(_0x203eda)))fs[_0x55b7ce(0x121)](_0x3aec20(_0x203eda),JSON[_0x55b7ce(0xfb)](_0x58b457,null,0x2),'utf8');}return{async 'get'(_0x4f2d29){const _0x1b9849=_0x55b7ce,_0x5a46b1=_0x3aec20(_0x4f2d29);if(!fs[_0x1b9849(0x10b)](_0x5a46b1))throw new store[(_0x1b9849(0x122))](_0x1b9849(0x109)+_0x4f2d29);return JSON[_0x1b9849(0x11f)](fs['readFileSync'](_0x5a46b1,_0x1b9849(0xd1)));},async 'save'(_0x396d6a,_0x480880){const _0x27d907=_0x55b7ce,_0x29f650=_0x3aec20(_0x396d6a),_0x568a9d=fs['existsSync'](_0x29f650)?JSON[_0x27d907(0x11f)](fs['readFileSync'](_0x29f650,_0x27d907(0xd1))):{'artifactId':'','values':{}},_0x5b41e9={'artifactId':_0x568a9d[_0x27d907(0x102)],'values':{..._0x568a9d[_0x27d907(0x12a)],..._0x480880[_0x27d907(0x12a)]},'common':{..._0x568a9d['common'],..._0x480880[_0x27d907(0x10a)]},'tabCommon':{..._0x568a9d['tabCommon'],..._0x480880[_0x27d907(0x120)]}};fs[_0x27d907(0x121)](_0x29f650,JSON['stringify'](_0x5b41e9,null,0x2),_0x27d907(0xd1));},async 'list'(_0x1ff4fb){const _0xf3e9f2=_0x55b7ce;return fs[_0xf3e9f2(0x124)](_0x577452)[_0xf3e9f2(0xf2)](_0x5cd80e=>_0x5cd80e[_0xf3e9f2(0x103)](_0xf3e9f2(0x11a)))[_0xf3e9f2(0x108)](_0x570b8c=>{const _0x1e8155=_0xf3e9f2,_0x118bd0=_0x570b8c[_0x1e8155(0xe2)](0x0,-0x5),_0x140359=JSON[_0x1e8155(0x11f)](fs['readFileSync'](path[_0x1e8155(0xfa)](_0x577452,_0x570b8c),'utf8'));return{'id':_0x118bd0,'artifactId':_0x140359[_0x1e8155(0x102)]};})['filter'](_0x3f3b44=>!_0x1ff4fb||_0x3f3b44[_0xf3e9f2(0x102)]===_0x1ff4fb);},async 'create'(_0x50776d){const _0x51149e=_0x55b7ce,_0x35f5f8=_0x51149e(0x10d)+Math[_0x51149e(0xdc)]()[_0x51149e(0xf0)](0x24)[_0x51149e(0xe2)](0x2,0xa);return fs[_0x51149e(0x121)](_0x3aec20(_0x35f5f8),JSON[_0x51149e(0xfb)]({'artifactId':_0x50776d[_0x51149e(0x102)],'values':{},'common':{}},null,0x2),_0x51149e(0xd1)),{'id':_0x35f5f8};}};}function sha256Hex(_0x19a223){const _0x45e2ca=_0x1cddf9,_0x3ac87e=typeof _0x19a223===_0x45e2ca(0x10f)?Buffer[_0x45e2ca(0xee)](_0x19a223,_0x45e2ca(0xd1)):Buffer[_0x45e2ca(0xee)](_0x19a223);return crypto['createHash'](_0x45e2ca(0x10c))[_0x45e2ca(0x113)](_0x3ac87e)[_0x45e2ca(0xda)](_0x45e2ca(0x12b));}function writeObject(_0x258f16,_0x360532){const _0x112684=_0x1cddf9,_0x4c5dbe=sha256Hex(_0x360532),_0x524eff=objectPath(_0x258f16,_0x4c5dbe);fs['mkdirSync'](path[_0x112684(0xe5)](_0x524eff),{'recursive':!![]});if(!fs[_0x112684(0x10b)](_0x524eff))fs[_0x112684(0x121)](_0x524eff,_0x360532);return _0x4c5dbe;}function _0x3c71(){const _0x5c65a1=['CgfKu3rHCNq','ndG1ntuZmfbIuKPbsG','mtK4mfHUwM5SDq','qvjusuzbq1rFrKLmrv9ct0rz','zxrHzW','zMLUza','nZaXmdu3n3HoB1D1qq','zgLNzxn0','z2v0rgf0zq','CMfUzg9T','C2f2zq','A2v5CW','CMvHzezPBgvtEw5J','DhjPBq','C29YDa','C2XPy2u','qgSTDgfIBguVCMvWB3j0l3n0B3jL','zMLSzxnfCxvHBa','zgLYBMfTzq','z2v0tw9UDgG','ru1qvfLFs1rm','mZCYoda2B3biuwvW','CMvHzezPBgu','yxj0AwzHy3ruB0zPBgvZ','zgvJB2rL','z2v0rNvSBfLLyxi','zMLSzxm','zNjVBq','BMfTzq','Dg9tDhjPBMC','BM93','zMLSDgvY','sevbra','CMvZB2X2zq','nZy3otrMC0T6y1G','C2vLzeLUC3rHBMnLCW','BwTKAxjtEw5J','qvjusuzbq1rFrKLmrv9srvbpuLq','DMvYC2LVBNnsB290','AM9PBG','C3rYAw5NAwz5','odm3EevPEw9N','CMv2','mJq2mhvzDMv1DW','zw50CMLLCW','zMLSzxnuB0fYDgLMywn0','mtuZmZeZmfnvDw1rzW','yxj0AwzHy3rjza','zw5KC1DPDgG','AxrLBxm','AgvHza','qvjusuzbq1rFrKLmrv9nrvrb','ChvZAa','BwfW','Aw5ZDgfUy2uG','y29TBw9U','zxHPC3rZu3LUyW','C2HHmJu2','Aw5ZDc0','Aw5ZDgfUy2vZuM9VDa','C3rYAw5N','C2vLza','yxj0AwzHy3qG','y3jLyxrLs3rgC1n0B3jLCW','DxbKyxrL','y3DK','AxneAxjLy3rVCNK','CMv2ia','z2v0sg91CNm','y29TBwL0','qvjusuzbq1rFrKLmrv9gsuXm','lMPZB24','zMfJzxm','B2jQzwn0CW','Bg9NlMPZB24','CM1tEw5J','CgfYC2u','DgfIq29TBw9U','D3jPDgvgAwXLu3LUyW','s3roB3rgB3vUzevYCM9Y','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','CMvHzgrPCLn5BMm','A2LUza','mtr1vNDtt0u','mJq2ndHQtun0txq','lMv0ywC','BM90zq','DMfSDwvZ','Agv4','DxrMoa','Cgf0Aa'];_0x3c71=function(){return _0x5c65a1;};return _0x3c71();}function readLog(_0x4b75be,_0x2531cb,_0x290f40){const _0x341f25=_0x1cddf9,_0x8f2487=itemDir(_0x4b75be,_0x2531cb,_0x290f40),_0x2c0708=path[_0x341f25(0xfa)](_0x8f2487,_0x341f25(0x11d)),_0x20b8ed=path[_0x341f25(0xfa)](_0x8f2487,'HEAD'),_0x2580b6=fs['existsSync'](_0x2c0708)?JSON[_0x341f25(0x11f)](fs[_0x341f25(0xdf)](_0x2c0708,_0x341f25(0xd1))):[],_0x58ba2a=fs[_0x341f25(0x10b)](_0x20b8ed)?fs['readFileSync'](_0x20b8ed,_0x341f25(0xd1))[_0x341f25(0xe0)]():_0x2580b6['at'](-0x1)?.['rev']??null;return{'head':_0x58ba2a,'items':_0x2580b6};}function writeLog(_0x1d5642,_0x5ec2ce,_0x3ee19b,_0x360705,_0x19e599){const _0x429ed8=_0x1cddf9,_0x29113e=itemDir(_0x1d5642,_0x5ec2ce,_0x3ee19b);fs[_0x429ed8(0xf7)](_0x29113e,{'recursive':!![]}),fs['writeFileSync'](path[_0x429ed8(0xfa)](_0x29113e,_0x429ed8(0x11d)),JSON[_0x429ed8(0xfb)](_0x19e599,null,0x2),_0x429ed8(0xd1)),fs['writeFileSync'](path[_0x429ed8(0xfa)](_0x29113e,_0x429ed8(0xf3)),_0x360705+'\x0a',_0x429ed8(0xd1));}function findRev(_0x11425c,_0x166c05){const _0x286db8=_0x1cddf9,_0x4fcf66=path[_0x286db8(0xfa)](_0x11425c,'items');if(!fs[_0x286db8(0x10b)](_0x4fcf66))return void 0x0;for(const _0x263436 of fs[_0x286db8(0x124)](_0x4fcf66,{'withFileTypes':!![]})){if(!_0x263436['isDirectory']())continue;for(const _0x59f6a2 of fs[_0x286db8(0x124)](path['join'](_0x4fcf66,_0x263436['name']),{'withFileTypes':!![]})){if(!_0x59f6a2[_0x286db8(0x115)]())continue;const _0x213ae8=readLog(_0x11425c,_0x263436['name'],_0x59f6a2[_0x286db8(0xef)])['items']['find'](_0x36a873=>_0x36a873[_0x286db8(0xfd)]===_0x166c05);if(_0x213ae8)return _0x213ae8;}}return void 0x0;}function filesTextOf(_0x2f2c27,_0x223349){const _0x249899=_0x1cddf9,_0x275874={};for(const [_0x3023d7,_0x196740]of Object[_0x249899(0xff)](_0x223349[_0x249899(0xed)])){const _0x28af22=objectPath(_0x2f2c27,_0x196740);if(fs['existsSync'](_0x28af22))_0x275874[_0x3023d7]=fs[_0x249899(0xdf)](_0x28af22,_0x249899(0xd1));}return _0x275874;}function createFsVersionStore(_0x368e2e,_0x426635){const _0x35f964=_0x1cddf9;return fs[_0x35f964(0xf7)](_0x368e2e,{'recursive':!![]}),{async 'log'(_0x560c1a,_0x50274b){const _0x2c4958=_0x35f964,{head:_0x5ab503,items:_0x527b52}=readLog(_0x368e2e,_0x560c1a,_0x50274b);return{'head':_0x5ab503,'items':[..._0x527b52][_0x2c4958(0xe1)]((_0x2f2ed9,_0x363613)=>_0x2f2ed9['at']<_0x363613['at']?0x1:-0x1)};},async 'get'(_0x4c4205){const _0x3906fa=_0x35f964,_0x17afff=findRev(_0x368e2e,_0x4c4205);if(!_0x17afff)throw new store['KtNotFoundError'](_0x3906fa(0x116)+_0x4c4205);return _0x17afff;},async 'readFile'(_0x17498c,_0x12d993){const _0x2cc710=_0x35f964,_0x565509=await this['get'](_0x17498c),_0x472227=_0x565509[_0x2cc710(0xed)][_0x12d993];if(!_0x472227)throw new store[(_0x2cc710(0x122))](_0x12d993);const _0x5a0984=objectPath(_0x368e2e,_0x472227);if(!fs[_0x2cc710(0x10b)](_0x5a0984))throw new store['KtNotFoundError'](_0x12d993);return new Uint8Array(fs[_0x2cc710(0xdf)](_0x5a0984));},async 'commit'(_0x3be47){const _0x49b865=_0x35f964;let _0x718933=_0x3be47['files'];if(!_0x718933){const _0x23c69f=await _0x426635['get'](_0x3be47['id']);_0x718933=store[_0x49b865(0xea)](_0x23c69f);}const _0x3c447f={},_0x68c0de={};for(const [_0xe4f6d9,_0x549c1e]of Object[_0x49b865(0xff)](_0x718933)){const _0x36925a=typeof _0x549c1e===_0x49b865(0x10f)?_0x549c1e:new TextDecoder()[_0x49b865(0xeb)](_0x549c1e);_0x3c447f[_0xe4f6d9]=_0x36925a,_0x68c0de[_0xe4f6d9]=writeObject(_0x368e2e,typeof _0x549c1e==='string'?Buffer['from'](_0x549c1e,_0x49b865(0xd1)):_0x549c1e);}const _0x59dac8=readLog(_0x368e2e,_0x3be47[_0x49b865(0x125)],_0x3be47['id']);if(_0x59dac8[_0x49b865(0x105)]){const _0x103fb5=_0x59dac8['items'][_0x49b865(0xd8)](_0x362688=>_0x362688[_0x49b865(0xfd)]===_0x59dac8[_0x49b865(0x105)]);if(_0x103fb5&&store[_0x49b865(0xe4)](_0x3c447f,filesTextOf(_0x368e2e,_0x103fb5)))return _0x103fb5;}const _0x4b86d8=new Date(),_0x3fe2aa=String(_0x4b86d8[_0x49b865(0xec)]())[_0x49b865(0xe2)](0x2)+String(_0x4b86d8[_0x49b865(0xe6)]()+0x1)[_0x49b865(0xd3)](0x2,'0')+String(_0x4b86d8[_0x49b865(0xdb)]())[_0x49b865(0xd3)](0x2,'0')+String(_0x4b86d8[_0x49b865(0x117)]())['padStart'](0x2,'0')+String(_0x4b86d8['getMinutes']())[_0x49b865(0xd3)](0x2,'0'),_0x4b1983=sha256Hex(Object[_0x49b865(0x12a)](_0x68c0de)[_0x49b865(0xe1)]()[_0x49b865(0xfa)](','))[_0x49b865(0xe2)](0x0,0x8),_0x4c00fd={'rev':_0x3fe2aa+'-local-'+_0x4b1983,'kind':_0x3be47['kind'],'id':_0x3be47['id'],'at':_0x4b86d8['toISOString'](),'parent':_0x59dac8[_0x49b865(0x105)],'by':_0x3be47['by'],'note':_0x3be47[_0x49b865(0x129)],'files':_0x68c0de,'meta':_0x3be47['meta']};return writeLog(_0x368e2e,_0x3be47[_0x49b865(0x125)],_0x3be47['id'],_0x4c00fd['rev'],[..._0x59dac8[_0x49b865(0x104)],_0x4c00fd]),_0x4c00fd;},async 'restore'(_0x4ca2ba,_0x358ffb,_0x73a8a5,_0x39f53f){const _0x4a2a6d=_0x35f964,_0x509e82=await this['get'](_0x73a8a5),_0x131339={};for(const _0x4fc06e of Object[_0x4a2a6d(0xde)](_0x509e82[_0x4a2a6d(0xed)])){_0x131339[_0x4fc06e]=new TextDecoder()[_0x4a2a6d(0xeb)](await this[_0x4a2a6d(0xe9)](_0x73a8a5,_0x4fc06e));}const _0x50a1e3=store[_0x4a2a6d(0x100)](_0x131339,_0x358ffb);return await _0x426635[_0x4a2a6d(0xdd)]({..._0x50a1e3,'id':_0x358ffb,'kind':_0x50a1e3[_0x4a2a6d(0x125)],'etag':void 0x0}),this[_0x4a2a6d(0x118)]({'kind':_0x4ca2ba,'id':_0x358ffb,'files':_0x131339,'by':_0x39f53f,'note':'\u6062\u590D\u81EA\x20'+_0x73a8a5});}};}function createKtFsStores(_0x15c6b8){const _0x379661=_0x1cddf9,_0x5e90ed=createFsArtifactStore(resolveRoot(_0x15c6b8['artifactsRoot'],_0x15c6b8[_0x379661(0x114)]),_0x15c6b8[_0x379661(0x110)]),_0x5a2dda=_0x15c6b8[_0x379661(0x10e)]?createFsInstanceStore(resolveRoot(_0x15c6b8['instancesRoot'],_0x15c6b8[_0x379661(0x114)]),_0x15c6b8[_0x379661(0xf6)]):void 0x0,_0x43b756=_0x15c6b8[_0x379661(0xf9)]?createFsVersionStore(resolveRoot(_0x15c6b8[_0x379661(0xf9)],_0x15c6b8[_0x379661(0x114)]),_0x5e90ed):void 0x0;return{'artifacts':_0x5e90ed,'instances':_0x5a2dda,'versions':_0x43b756};}function _0x2715(_0x3aeab7,_0xb35d8b){_0x3aeab7=_0x3aeab7-0xd1;const _0x3c71a2=_0x3c71();let _0x271514=_0x3c71a2[_0x3aeab7];if(_0x2715['hXwpGR']===undefined){var _0x28d437=function(_0x570722){const _0x3e11be='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x120277='',_0x295d84='';for(let _0x1c97cd=0x0,_0x3fffb5,_0x5d925f,_0x10c2d1=0x0;_0x5d925f=_0x570722['charAt'](_0x10c2d1++);~_0x5d925f&&(_0x3fffb5=_0x1c97cd%0x4?_0x3fffb5*0x40+_0x5d925f:_0x5d925f,_0x1c97cd++%0x4)?_0x120277+=String['fromCharCode'](0xff&_0x3fffb5>>(-0x2*_0x1c97cd&0x6)):0x0){_0x5d925f=_0x3e11be['indexOf'](_0x5d925f);}for(let _0x5b5f81=0x0,_0x4c4283=_0x120277['length'];_0x5b5f81<_0x4c4283;_0x5b5f81++){_0x295d84+='%'+('00'+_0x120277['charCodeAt'](_0x5b5f81)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x295d84);};_0x2715['dBqnqa']=_0x28d437,_0x2715['heoDWq']={},_0x2715['hXwpGR']=!![];}const _0x3e878c=_0x3c71a2[0x0];_0x2715['DgGLcE']!==_0x3e878c&&(_0x2715['heoDWq']={},_0x2715['DgGLcE']=_0x3e878c);const _0x41afe5=_0x2715['heoDWq'][_0x3aeab7];return _0x41afe5===undefined?(_0x271514=_0x2715['dBqnqa'](_0x271514),_0x2715['heoDWq'][_0x3aeab7]=_0x271514):_0x271514=_0x41afe5,_0x271514;}exports[_0x1cddf9(0x112)]=createKtFsStores;
|
|
1
|
+
'use strict';const _0x1a606f=_0x43d6;(function(_0x42a732,_0x197b01){const _0x4f094d=_0x43d6,_0x36795d=_0x42a732();while(!![]){try{const _0x3015c3=-parseInt(_0x4f094d(0x1f7))/0x1+-parseInt(_0x4f094d(0x21d))/0x2*(parseInt(_0x4f094d(0x20a))/0x3)+parseInt(_0x4f094d(0x20b))/0x4+-parseInt(_0x4f094d(0x210))/0x5+parseInt(_0x4f094d(0x20d))/0x6*(parseInt(_0x4f094d(0x237))/0x7)+-parseInt(_0x4f094d(0x1ec))/0x8*(-parseInt(_0x4f094d(0x1f6))/0x9)+parseInt(_0x4f094d(0x20c))/0xa*(parseInt(_0x4f094d(0x1fb))/0xb);if(_0x3015c3===_0x197b01)break;else _0x36795d['push'](_0x36795d['shift']());}catch(_0x114843){_0x36795d['push'](_0x36795d['shift']());}}}(_0x2efe,0xf2c0d));var fs=require('fs'),path=require('path'),store=require(_0x1a606f(0x234)),crypto=require('crypto');function resolveRoot(_0x240a97,_0x3b9150=process[_0x1a606f(0x240)]()){const _0x1e5d88=_0x1a606f,_0x20d202=path['isAbsolute'](_0x240a97)?_0x240a97:path[_0x1e5d88(0x1fc)](_0x3b9150,_0x240a97);return fs['mkdirSync'](_0x20d202,{'recursive':!![]}),_0x20d202;}function artifactDir(_0x3a2095,_0x5ba0a2){const _0x4568c8=_0x1a606f;return path[_0x4568c8(0x1f4)](_0x3a2095,_0x5ba0a2);}function objectPath(_0x2c5056,_0x815e5a){const _0x42ea81=_0x1a606f;return path[_0x42ea81(0x1f4)](_0x2c5056,_0x42ea81(0x20f),_0x815e5a['slice'](0x0,0x2),_0x815e5a);}function itemDir(_0x2a8460,_0x35fd1d,_0x4857cc){return path['join'](_0x2a8460,'items',_0x35fd1d,_0x4857cc);}function newEtag(){const _0x46b53f=_0x1a606f;return Date[_0x46b53f(0x1f9)]()[_0x46b53f(0x23e)](0x24)+'-'+Math[_0x46b53f(0x21a)]()[_0x46b53f(0x23e)](0x24)[_0x46b53f(0x216)](0x2,0x8);}function readEtag(_0x317d89){const _0x56fe75=_0x1a606f,_0x50dacd=path[_0x56fe75(0x1f4)](_0x317d89,_0x56fe75(0x23b));return fs[_0x56fe75(0x1fd)](_0x50dacd)?fs['readFileSync'](_0x50dacd,_0x56fe75(0x1ef))[_0x56fe75(0x203)]():void 0x0;}function writeArtifactDir(_0x189e20,_0x3f506a,_0x112b6d){const _0x5bee72=_0x1a606f;fs[_0x5bee72(0x21f)](path['join'](_0x189e20,_0x5bee72(0x22f)),{'recursive':!![]});const _0x268d11=store[_0x5bee72(0x206)](_0x3f506a);fs[_0x5bee72(0x200)](path['join'](_0x189e20,store[_0x5bee72(0x1ee)]),_0x268d11[store[_0x5bee72(0x1ee)]]??'{}','utf8'),fs['writeFileSync'](path['join'](_0x189e20,store['ARTIFACT_FILE_BODY']),_0x268d11[store[_0x5bee72(0x230)]]??'',_0x5bee72(0x1ef));const _0x139b91=path[_0x5bee72(0x1f4)](_0x189e20,store[_0x5bee72(0x239)]),_0x2c4fc4=path['join'](_0x189e20,store['ARTIFACT_FILE_REPORT']);if(_0x268d11[store[_0x5bee72(0x239)]])fs[_0x5bee72(0x200)](_0x139b91,_0x268d11[store['ARTIFACT_FILE_FILL']],_0x5bee72(0x1ef));else{if(fs[_0x5bee72(0x1fd)](_0x139b91))fs['rmSync'](_0x139b91);}if(_0x268d11[store[_0x5bee72(0x227)]])fs[_0x5bee72(0x200)](_0x2c4fc4,_0x268d11[store[_0x5bee72(0x227)]],_0x5bee72(0x1ef));else{if(fs['existsSync'](_0x2c4fc4))fs[_0x5bee72(0x21c)](_0x2c4fc4);}fs[_0x5bee72(0x200)](path[_0x5bee72(0x1f4)](_0x189e20,'.etag'),_0x112b6d,_0x5bee72(0x1ef));}function readArtifactDir(_0x523ee3,_0xe233e8){const _0x53d356=_0x1a606f,_0x5e32be={},_0x44aa38=path[_0x53d356(0x1f4)](_0x523ee3,store[_0x53d356(0x1ee)]),_0x1da896=path['join'](_0x523ee3,store[_0x53d356(0x230)]);if(fs['existsSync'](_0x44aa38))_0x5e32be[store['ARTIFACT_FILE_META']]=fs[_0x53d356(0x225)](_0x44aa38,_0x53d356(0x1ef));if(fs['existsSync'](_0x1da896))_0x5e32be[store['ARTIFACT_FILE_BODY']]=fs[_0x53d356(0x225)](_0x1da896,_0x53d356(0x1ef));const _0x98d3cc=path['join'](_0x523ee3,store[_0x53d356(0x239)]),_0x2f303e=path[_0x53d356(0x1f4)](_0x523ee3,store['ARTIFACT_FILE_REPORT']);if(fs['existsSync'](_0x98d3cc))_0x5e32be[store['ARTIFACT_FILE_FILL']]=fs[_0x53d356(0x225)](_0x98d3cc,_0x53d356(0x1ef));if(fs[_0x53d356(0x1fd)](_0x2f303e))_0x5e32be[store['ARTIFACT_FILE_REPORT']]=fs['readFileSync'](_0x2f303e,_0x53d356(0x1ef));return{...store['filesToArtifact'](_0x5e32be,_0xe233e8),'etag':readEtag(_0x523ee3)};}function _0x2efe(){const _0x49248d=['zMLSzxm','yxj0AwzHy3rjza','DhjPBq','Bg9NlMPZB24','z2v0rNvSBfLLyxi','yxj0AwzHy3ruB0zPBgvZ','zMLSzxnfCxvHBa','zNjVBq','Agv4','mJq5mduXC0TnD2fv','mZmXnZe2q0r5uKLY','mtuWy1f0Bhne','mZi0otmWzwLotg5O','zw50CMLLCW','B2jQzwn0CW','mJC4mdqYnwTzrLPIqW','CgfYC2u','zMLSDgvY','C3rYAw5NAwz5','DgfIq29TBw9U','z2v0twLUDxrLCW','C2XPy2u','BMfTzq','C29YDa','AxneAxjLy3rVCNK','CMfUzg9T','z2v0rgf0zq','CM1tEw5J','ndzpwvvxEgy','CMvHzezPBgu','BwTKAxjtEw5J','y3jLyxrLs3rgC1n0B3jLCW','C2f2zq','z2v0tw9UDgG','zgvJB2rL','A2LUza','CMvHzezPBgvtEw5J','z2v0','qvjusuzbq1rFrKLmrv9srvbpuLq','yxj0AwzHy3qG','zxrHzW','lMPZB24','zgLYBMfTzq','CMvHzgrPCLn5BMm','C2HHmJu2','AgvHza','zMfJzxm','qvjusuzbq1rFrKLmrv9ct0rz','s3rdB25MBgLJDevYCM9Y','C2vLzeLUC3rHBMnLCW','BM90zq','qgSTDgfIBguVCMvWB3j0l3n0B3jL','AxrLBxm','zgLNzxn0','mJi0B3DwEwz6','CgfKu3rHCNq','qvjusuzbq1rFrKLmrv9gsuXm','BwfW','lMv0ywC','lwXVy2fSlq','Aw5ZDc0','Dg9tDhjPBMC','A2v5CW','y3DK','Aw5ZDgfUy2vZuM9VDa','Bwv0yq','yxj0AwzHy3rZuM9VDa','oezwuvzPCq','ChvZAa','qvjusuzbq1rFrKLmrv9nrvrb','DxrMoa','zMLUza','y3jLyxrLsgfZAa','C3rYAw5N','sevbra','AM9PBG','s3roB3rgB3vUzevYCM9Y','ntG1otyZuKjRuNzp','mtq2nZu1m2XUthLUBa','5OgI5Asn6iEQia','BM93','y29TBw9U','mJiZmZK5mezkDgP2Dq','CMvZB2X2zq','zxHPC3rZu3LUyW','CMv2','DMfSDwvZ','D3jPDgvgAwXLu3LUyW'];_0x2efe=function(){return _0x49248d;};return _0x2efe();}function createFsArtifactStore(_0x4941c5,_0x1137a0=[]){const _0xc9cf3b=_0x1a606f;fs[_0xc9cf3b(0x21f)](_0x4941c5,{'recursive':!![]});for(const _0x218216 of _0x1137a0){const _0x6b44bc=artifactDir(_0x4941c5,_0x218216['id']),_0xd34c8f=path['join'](_0x6b44bc,store['ARTIFACT_FILE_BODY']);if(!fs[_0xc9cf3b(0x1fd)](_0xd34c8f))writeArtifactDir(_0x6b44bc,_0x218216,_0x218216[_0xc9cf3b(0x229)]??newEtag());}return{async 'list'(_0x5d30fa){const _0x2bb040=_0xc9cf3b;if(!fs['existsSync'](_0x4941c5))return[];const _0x4c4f40=[];for(const _0x584b30 of fs[_0x2bb040(0x22c)](_0x4941c5,{'withFileTypes':!![]})){if(!_0x584b30[_0x2bb040(0x219)]())continue;try{const _0x79ed6c=readArtifactDir(artifactDir(_0x4941c5,_0x584b30['name']),_0x584b30[_0x2bb040(0x217)]);if(!_0x5d30fa||_0x79ed6c[_0x2bb040(0x224)]===_0x5d30fa)_0x4c4f40[_0x2bb040(0x1ed)]({'id':_0x79ed6c['id'],'name':_0x79ed6c[_0x2bb040(0x217)],'kind':_0x79ed6c[_0x2bb040(0x224)]});}catch{}}return _0x4c4f40;},async 'get'(_0x33c9ba){const _0x3b5162=_0xc9cf3b,_0x4eeab0=artifactDir(_0x4941c5,_0x33c9ba);if(!fs[_0x3b5162(0x1fd)](_0x4eeab0))throw new store[(_0x3b5162(0x1f5))](_0x3b5162(0x228)+_0x33c9ba);return readArtifactDir(_0x4eeab0,_0x33c9ba);},async 'save'(_0x365ae8){const _0x153a3d=_0xc9cf3b,_0x5939a7=artifactDir(_0x4941c5,_0x365ae8['id']),_0x3353ca=fs[_0x153a3d(0x1fd)](_0x5939a7)?readArtifactDir(_0x5939a7,_0x365ae8['id']):void 0x0;if(_0x365ae8['etag']&&_0x3353ca?.[_0x153a3d(0x229)]&&_0x365ae8['etag']!==_0x3353ca['etag'])throw new store[(_0x153a3d(0x231))]('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x3353ca);const _0x392692=newEtag();return writeArtifactDir(_0x5939a7,_0x365ae8,_0x392692),{..._0x365ae8,'etag':_0x392692};},async 'create'(_0x4e984d){const _0x4fd37d=_0xc9cf3b,_0x2996ad=_0x4e984d[_0x4fd37d(0x224)]+'-'+Math['random']()[_0x4fd37d(0x23e)](0x24)[_0x4fd37d(0x216)](0x2,0xa),_0x20a04f={'id':_0x2996ad,'name':_0x4e984d['name'],'kind':_0x4e984d[_0x4fd37d(0x224)],'ktl':store['EMPTY_KTL']};return this[_0x4fd37d(0x221)](_0x20a04f);},async 'remove'(_0x346af2){const _0x4d7ecf=_0xc9cf3b,_0x33b9c2=artifactDir(_0x4941c5,_0x346af2);if(!fs[_0x4d7ecf(0x1fd)](_0x33b9c2))throw new store['KtNotFoundError']('artifact\x20'+_0x346af2);fs[_0x4d7ecf(0x21c)](_0x33b9c2,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x5f300b,_0xef6f41={}){const _0x59ba4e=_0x1a606f;fs['mkdirSync'](_0x5f300b,{'recursive':!![]});const _0x2a58ab=_0x243bab=>path[_0x59ba4e(0x1f4)](_0x5f300b,_0x243bab+'.json');for(const [_0x30d8b5,_0x5babed]of Object[_0x59ba4e(0x20e)](_0xef6f41)){if(!fs[_0x59ba4e(0x1fd)](_0x2a58ab(_0x30d8b5)))fs[_0x59ba4e(0x200)](_0x2a58ab(_0x30d8b5),JSON[_0x59ba4e(0x213)](_0x5babed,null,0x2),_0x59ba4e(0x1ef));}return{async 'get'(_0x39ef67){const _0x5e36f2=_0x59ba4e,_0x43a83a=_0x2a58ab(_0x39ef67);if(!fs['existsSync'](_0x43a83a))throw new store[(_0x5e36f2(0x1f5))]('instance\x20'+_0x39ef67);return JSON[_0x5e36f2(0x211)](fs['readFileSync'](_0x43a83a,_0x5e36f2(0x1ef)));},async 'save'(_0x5a4e38,_0x47910a){const _0x426319=_0x59ba4e,_0xd98e7a=_0x2a58ab(_0x5a4e38),_0x428033=fs[_0x426319(0x1fd)](_0xd98e7a)?JSON[_0x426319(0x211)](fs[_0x426319(0x225)](_0xd98e7a,'utf8')):{'artifactId':'','values':{}},_0x39d66a={'artifactId':_0x428033[_0x426319(0x202)],'values':{..._0x428033[_0x426319(0x1ff)],..._0x47910a[_0x426319(0x1ff)]},'common':{..._0x428033[_0x426319(0x1fa)],..._0x47910a['common']},'tabCommon':{..._0x428033[_0x426319(0x214)],..._0x47910a[_0x426319(0x214)]}};fs[_0x426319(0x200)](_0xd98e7a,JSON['stringify'](_0x39d66a,null,0x2),_0x426319(0x1ef));},async 'list'(_0xa0d725){const _0x432367=_0x59ba4e;return fs[_0x432367(0x22c)](_0x5f300b)[_0x432367(0x212)](_0x5659b1=>_0x5659b1['endsWith'](_0x432367(0x22a)))[_0x432367(0x23a)](_0x2b987b=>{const _0x2026dc=_0x432367,_0xb51557=_0x2b987b['slice'](0x0,-0x5),_0x592f95=JSON[_0x2026dc(0x211)](fs[_0x2026dc(0x225)](path['join'](_0x5f300b,_0x2b987b),_0x2026dc(0x1ef)));return{'id':_0xb51557,'artifactId':_0x592f95[_0x2026dc(0x202)]};})[_0x432367(0x212)](_0x4e110d=>!_0xa0d725||_0x4e110d[_0x432367(0x202)]===_0xa0d725);},async 'create'(_0x1a6700){const _0x7edaf3=_0x59ba4e,_0x8f9ea0=_0x7edaf3(0x23d)+Math[_0x7edaf3(0x21a)]()[_0x7edaf3(0x23e)](0x24)['slice'](0x2,0xa);return fs[_0x7edaf3(0x200)](_0x2a58ab(_0x8f9ea0),JSON[_0x7edaf3(0x213)]({'artifactId':_0x1a6700['artifactId'],'values':{},'common':{}},null,0x2),_0x7edaf3(0x1ef)),{'id':_0x8f9ea0};}};}function sha256Hex(_0xc622e4){const _0x15e0ea=_0x1a606f,_0x57e634=typeof _0xc622e4==='string'?Buffer[_0x15e0ea(0x208)](_0xc622e4,'utf8'):Buffer[_0x15e0ea(0x208)](_0xc622e4);return crypto[_0x15e0ea(0x1f1)](_0x15e0ea(0x22d))['update'](_0x57e634)[_0x15e0ea(0x236)](_0x15e0ea(0x209));}function writeObject(_0x1619c5,_0x29b8ec){const _0x37afd0=_0x1a606f,_0x418f49=sha256Hex(_0x29b8ec),_0x4b9893=objectPath(_0x1619c5,_0x418f49);fs[_0x37afd0(0x21f)](path[_0x37afd0(0x22b)](_0x4b9893),{'recursive':!![]});if(!fs['existsSync'](_0x4b9893))fs[_0x37afd0(0x200)](_0x4b9893,_0x29b8ec);return _0x418f49;}function readLog(_0x223160,_0xd4dd0f,_0xce614f){const _0x3d92bf=_0x1a606f,_0x222297=itemDir(_0x223160,_0xd4dd0f,_0xce614f),_0x4101d1=path[_0x3d92bf(0x1f4)](_0x222297,_0x3d92bf(0x204)),_0x147294=path[_0x3d92bf(0x1f4)](_0x222297,_0x3d92bf(0x1f3)),_0x1a07c9=fs[_0x3d92bf(0x1fd)](_0x4101d1)?JSON[_0x3d92bf(0x211)](fs[_0x3d92bf(0x225)](_0x4101d1,_0x3d92bf(0x1ef))):[],_0xb7c57d=fs['existsSync'](_0x147294)?fs['readFileSync'](_0x147294,_0x3d92bf(0x1ef))['trim']():_0x1a07c9['at'](-0x1)?.[_0x3d92bf(0x1fe)]??null;return{'head':_0xb7c57d,'items':_0x1a07c9};}function _0x43d6(_0x4c19d0,_0x421d08){_0x4c19d0=_0x4c19d0-0x1ec;const _0x2efee4=_0x2efe();let _0x43d66b=_0x2efee4[_0x4c19d0];if(_0x43d6['TFLnEn']===undefined){var _0x373cb1=function(_0x5c9fff){const _0x5566d7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x15373e='',_0x240a97='';for(let _0x3b9150=0x0,_0x20d202,_0x3a2095,_0x5ba0a2=0x0;_0x3a2095=_0x5c9fff['charAt'](_0x5ba0a2++);~_0x3a2095&&(_0x20d202=_0x3b9150%0x4?_0x20d202*0x40+_0x3a2095:_0x3a2095,_0x3b9150++%0x4)?_0x15373e+=String['fromCharCode'](0xff&_0x20d202>>(-0x2*_0x3b9150&0x6)):0x0){_0x3a2095=_0x5566d7['indexOf'](_0x3a2095);}for(let _0x2c5056=0x0,_0x815e5a=_0x15373e['length'];_0x2c5056<_0x815e5a;_0x2c5056++){_0x240a97+='%'+('00'+_0x15373e['charCodeAt'](_0x2c5056)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x240a97);};_0x43d6['DzYyxR']=_0x373cb1,_0x43d6['VebkLz']={},_0x43d6['TFLnEn']=!![];}const _0x521b43=_0x2efee4[0x0];_0x43d6['pOQVSA']!==_0x521b43&&(_0x43d6['VebkLz']={},_0x43d6['pOQVSA']=_0x521b43);const _0x1ec14b=_0x43d6['VebkLz'][_0x4c19d0];return _0x1ec14b===undefined?(_0x43d66b=_0x43d6['DzYyxR'](_0x43d66b),_0x43d6['VebkLz'][_0x4c19d0]=_0x43d66b):_0x43d66b=_0x1ec14b,_0x43d66b;}function writeLog(_0x4ebdbf,_0x5edb27,_0xe44871,_0x141ea4,_0x341d81){const _0x31bd1c=_0x1a606f,_0x217735=itemDir(_0x4ebdbf,_0x5edb27,_0xe44871);fs[_0x31bd1c(0x21f)](_0x217735,{'recursive':!![]}),fs[_0x31bd1c(0x200)](path[_0x31bd1c(0x1f4)](_0x217735,_0x31bd1c(0x204)),JSON[_0x31bd1c(0x213)](_0x341d81,null,0x2),_0x31bd1c(0x1ef)),fs[_0x31bd1c(0x200)](path[_0x31bd1c(0x1f4)](_0x217735,_0x31bd1c(0x1f3)),_0x141ea4+'\x0a',_0x31bd1c(0x1ef));}function findRev(_0x223611,_0x79606d){const _0x79107f=_0x1a606f,_0x669ef=path[_0x79107f(0x1f4)](_0x223611,_0x79107f(0x235));if(!fs[_0x79107f(0x1fd)](_0x669ef))return void 0x0;for(const _0x1a2aa6 of fs[_0x79107f(0x22c)](_0x669ef,{'withFileTypes':!![]})){if(!_0x1a2aa6[_0x79107f(0x219)]())continue;for(const _0x77ed17 of fs[_0x79107f(0x22c)](path[_0x79107f(0x1f4)](_0x669ef,_0x1a2aa6[_0x79107f(0x217)]),{'withFileTypes':!![]})){if(!_0x77ed17[_0x79107f(0x219)]())continue;const _0x146820=readLog(_0x223611,_0x1a2aa6[_0x79107f(0x217)],_0x77ed17[_0x79107f(0x217)])['items']['find'](_0x2e442e=>_0x2e442e[_0x79107f(0x1fe)]===_0x79606d);if(_0x146820)return _0x146820;}}return void 0x0;}function filesTextOf(_0x33c038,_0x54e170){const _0x196593=_0x1a606f,_0x253c4a={};for(const [_0x30f139,_0x4064b1]of Object['entries'](_0x54e170[_0x196593(0x201)])){const _0x3da3dc=objectPath(_0x33c038,_0x4064b1);if(fs[_0x196593(0x1fd)](_0x3da3dc))_0x253c4a[_0x30f139]=fs['readFileSync'](_0x3da3dc,_0x196593(0x1ef));}return _0x253c4a;}function createFsVersionStore(_0x3fc543,_0x5cfa3b){const _0x5ea265=_0x1a606f;return fs[_0x5ea265(0x21f)](_0x3fc543,{'recursive':!![]}),{async 'log'(_0x4bfdc0,_0x38fb9f){const {head:_0x1f210e,items:_0x331a68}=readLog(_0x3fc543,_0x4bfdc0,_0x38fb9f);return{'head':_0x1f210e,'items':[..._0x331a68]['sort']((_0x10596b,_0x348056)=>_0x10596b['at']<_0x348056['at']?0x1:-0x1)};},async 'get'(_0x4c07d0){const _0x521f92=_0x5ea265,_0x50886e=findRev(_0x3fc543,_0x4c07d0);if(!_0x50886e)throw new store[(_0x521f92(0x1f5))]('rev\x20'+_0x4c07d0);return _0x50886e;},async 'readFile'(_0x7dd0,_0x39e3b5){const _0x15dd68=_0x5ea265,_0x58a778=await this[_0x15dd68(0x226)](_0x7dd0),_0x52029b=_0x58a778['files'][_0x39e3b5];if(!_0x52029b)throw new store['KtNotFoundError'](_0x39e3b5);const _0xd05977=objectPath(_0x3fc543,_0x52029b);if(!fs[_0x15dd68(0x1fd)](_0xd05977))throw new store[(_0x15dd68(0x1f5))](_0x39e3b5);return new Uint8Array(fs[_0x15dd68(0x225)](_0xd05977));},async 'commit'(_0x355772){const _0x2c962e=_0x5ea265;let _0x16cd36=_0x355772[_0x2c962e(0x201)];if(!_0x16cd36){const _0x51652a=await _0x5cfa3b['get'](_0x355772['id']);_0x16cd36=store[_0x2c962e(0x206)](_0x51652a);}const _0x2e87a4={},_0x28f425={};for(const [_0x2445a5,_0x92ef17]of Object[_0x2c962e(0x20e)](_0x16cd36)){const _0x299371=typeof _0x92ef17===_0x2c962e(0x1f2)?_0x92ef17:new TextDecoder()[_0x2c962e(0x223)](_0x92ef17);_0x2e87a4[_0x2445a5]=_0x299371,_0x28f425[_0x2445a5]=writeObject(_0x3fc543,typeof _0x92ef17==='string'?Buffer[_0x2c962e(0x208)](_0x92ef17,'utf8'):_0x92ef17);}const _0x191684=readLog(_0x3fc543,_0x355772[_0x2c962e(0x224)],_0x355772['id']);if(_0x191684[_0x2c962e(0x22e)]){const _0x2968a2=_0x191684[_0x2c962e(0x235)][_0x2c962e(0x1f0)](_0x742f7b=>_0x742f7b[_0x2c962e(0x1fe)]===_0x191684['head']);if(_0x2968a2&&store[_0x2c962e(0x207)](_0x2e87a4,filesTextOf(_0x3fc543,_0x2968a2)))return _0x2968a2;}const _0x5df28c=new Date(),_0x167ced=String(_0x5df28c[_0x2c962e(0x205)]())[_0x2c962e(0x216)](0x2)+String(_0x5df28c[_0x2c962e(0x222)]()+0x1)[_0x2c962e(0x238)](0x2,'0')+String(_0x5df28c[_0x2c962e(0x21b)]())[_0x2c962e(0x238)](0x2,'0')+String(_0x5df28c['getHours']())['padStart'](0x2,'0')+String(_0x5df28c[_0x2c962e(0x215)]())['padStart'](0x2,'0'),_0x3f9a39=sha256Hex(Object['values'](_0x28f425)[_0x2c962e(0x218)]()[_0x2c962e(0x1f4)](','))[_0x2c962e(0x216)](0x0,0x8),_0x42f525={'rev':_0x167ced+_0x2c962e(0x23c)+_0x3f9a39,'kind':_0x355772[_0x2c962e(0x224)],'id':_0x355772['id'],'at':_0x5df28c['toISOString'](),'parent':_0x191684[_0x2c962e(0x22e)],'by':_0x355772['by'],'note':_0x355772[_0x2c962e(0x233)],'files':_0x28f425,'meta':_0x355772[_0x2c962e(0x242)]};return writeLog(_0x3fc543,_0x355772[_0x2c962e(0x224)],_0x355772['id'],_0x42f525[_0x2c962e(0x1fe)],[..._0x191684[_0x2c962e(0x235)],_0x42f525]),_0x42f525;},async 'restore'(_0x4e6bc5,_0x4448fb,_0x1ec352,_0x4418f6){const _0x70ced4=_0x5ea265,_0x2b27d1=await this[_0x70ced4(0x226)](_0x1ec352),_0x34c688={};for(const _0x3df5a5 of Object[_0x70ced4(0x23f)](_0x2b27d1[_0x70ced4(0x201)])){_0x34c688[_0x3df5a5]=new TextDecoder()[_0x70ced4(0x223)](await this[_0x70ced4(0x21e)](_0x1ec352,_0x3df5a5));}const _0x35fe2f=store['filesToArtifact'](_0x34c688,_0x4448fb);return await _0x5cfa3b['save']({..._0x35fe2f,'id':_0x4448fb,'kind':_0x35fe2f[_0x70ced4(0x224)],'etag':void 0x0}),this['commit']({'kind':_0x4e6bc5,'id':_0x4448fb,'files':_0x34c688,'by':_0x4418f6,'note':_0x70ced4(0x1f8)+_0x1ec352});}};}function createKtFsStores(_0x16b44e){const _0x405072=_0x1a606f,_0x401f2f=createFsArtifactStore(resolveRoot(_0x16b44e[_0x405072(0x243)],_0x16b44e[_0x405072(0x240)]),_0x16b44e['seed']),_0x50d86f=_0x16b44e[_0x405072(0x241)]?createFsInstanceStore(resolveRoot(_0x16b44e[_0x405072(0x241)],_0x16b44e['cwd']),_0x16b44e[_0x405072(0x232)]):void 0x0,_0x593471=_0x16b44e['versionsRoot']?createFsVersionStore(resolveRoot(_0x16b44e['versionsRoot'],_0x16b44e[_0x405072(0x240)]),_0x401f2f):void 0x0;return{'artifacts':_0x401f2f,'instances':_0x50d86f,'versions':_0x593471};}exports[_0x1a606f(0x220)]=createKtFsStores;
|
package/dist/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x120d08,_0x15bfd1){const _0x3f98b4=_0x2aa6,_0x440c4c=_0x120d08();while(!![]){try{const _0xc81375=parseInt(_0x3f98b4(0x18d))/0x1+-parseInt(_0x3f98b4(0x181))/0x2+parseInt(_0x3f98b4(0x19d))/0x3+-parseInt(_0x3f98b4(0x19a))/0x4+-parseInt(_0x3f98b4(0x1b6))/0x5+-parseInt(_0x3f98b4(0x1a9))/0x6+-parseInt(_0x3f98b4(0x1b9))/0x7*(-parseInt(_0x3f98b4(0x194))/0x8);if(_0xc81375===_0x15bfd1)break;else _0x440c4c['push'](_0x440c4c['shift']());}catch(_0xe64720){_0x440c4c['push'](_0x440c4c['shift']());}}}(_0x388a,0x7d2da));import{mkdirSync,existsSync,rmSync,readdirSync,writeFileSync,readFileSync}from'fs';import{join,isAbsolute,resolve,dirname}from'path';import{ARTIFACT_FILE_BODY,KtNotFoundError,EMPTY_KTL,KtConflictError,filesToArtifact,artifactToFiles,filesEqual,ARTIFACT_FILE_META,ARTIFACT_FILE_FILL,ARTIFACT_FILE_REPORT}from'@k-table/report/store';import{createHash}from'crypto';function resolveRoot(_0x5e50df,_0x50ae25=process['cwd']()){const _0x66da06=isAbsolute(_0x5e50df)?_0x5e50df:resolve(_0x50ae25,_0x5e50df);return mkdirSync(_0x66da06,{'recursive':!![]}),_0x66da06;}function artifactDir(_0x136fd3,_0x4228f6){return join(_0x136fd3,_0x4228f6);}function objectPath(_0x412fda,_0x40a7b5){const _0x2de84e=_0x2aa6;return join(_0x412fda,'objects',_0x40a7b5[_0x2de84e(0x18e)](0x0,0x2),_0x40a7b5);}function itemDir(_0x8079cf,_0x1e8001,_0x4d4c1d){const _0x53d7ff=_0x2aa6;return join(_0x8079cf,_0x53d7ff(0x1b5),_0x1e8001,_0x4d4c1d);}function newEtag(){const _0x25fb80=_0x2aa6;return Date[_0x25fb80(0x1a0)]()['toString'](0x24)+'-'+Math[_0x25fb80(0x180)]()[_0x25fb80(0x191)](0x24)[_0x25fb80(0x18e)](0x2,0x8);}function readEtag(_0x45f42c){const _0x3c560b=_0x2aa6,_0x4fecb2=join(_0x45f42c,_0x3c560b(0x1bd));return existsSync(_0x4fecb2)?readFileSync(_0x4fecb2,_0x3c560b(0x1af))['trim']():void 0x0;}function writeArtifactDir(_0x271c8c,_0x37d68b,_0x21aae6){const _0x241115=_0x2aa6;mkdirSync(join(_0x271c8c,'faces'),{'recursive':!![]});const _0x4f4d0a=artifactToFiles(_0x37d68b);writeFileSync(join(_0x271c8c,ARTIFACT_FILE_META),_0x4f4d0a[ARTIFACT_FILE_META]??'{}','utf8'),writeFileSync(join(_0x271c8c,ARTIFACT_FILE_BODY),_0x4f4d0a[ARTIFACT_FILE_BODY]??'',_0x241115(0x1af));const _0x4d6260=join(_0x271c8c,ARTIFACT_FILE_FILL),_0x1eac72=join(_0x271c8c,ARTIFACT_FILE_REPORT);if(_0x4f4d0a[ARTIFACT_FILE_FILL])writeFileSync(_0x4d6260,_0x4f4d0a[ARTIFACT_FILE_FILL],'utf8');else{if(existsSync(_0x4d6260))rmSync(_0x4d6260);}if(_0x4f4d0a[ARTIFACT_FILE_REPORT])writeFileSync(_0x1eac72,_0x4f4d0a[ARTIFACT_FILE_REPORT],_0x241115(0x1af));else{if(existsSync(_0x1eac72))rmSync(_0x1eac72);}writeFileSync(join(_0x271c8c,_0x241115(0x1bd)),_0x21aae6,'utf8');}function readArtifactDir(_0x7ec00c,_0x26c176){const _0x30d80f=_0x2aa6,_0x2e0f2f={},_0x505fbf=join(_0x7ec00c,ARTIFACT_FILE_META),_0x17ddcb=join(_0x7ec00c,ARTIFACT_FILE_BODY);if(existsSync(_0x505fbf))_0x2e0f2f[ARTIFACT_FILE_META]=readFileSync(_0x505fbf,_0x30d80f(0x1af));if(existsSync(_0x17ddcb))_0x2e0f2f[ARTIFACT_FILE_BODY]=readFileSync(_0x17ddcb,'utf8');const _0x23999b=join(_0x7ec00c,ARTIFACT_FILE_FILL),_0x159ca7=join(_0x7ec00c,ARTIFACT_FILE_REPORT);if(existsSync(_0x23999b))_0x2e0f2f[ARTIFACT_FILE_FILL]=readFileSync(_0x23999b,_0x30d80f(0x1af));if(existsSync(_0x159ca7))_0x2e0f2f[ARTIFACT_FILE_REPORT]=readFileSync(_0x159ca7,_0x30d80f(0x1af));return{...filesToArtifact(_0x2e0f2f,_0x26c176),'etag':readEtag(_0x7ec00c)};}function createFsArtifactStore(_0x4d8795,_0xdbbe6b=[]){mkdirSync(_0x4d8795,{'recursive':!![]});for(const _0x2037db of _0xdbbe6b){const _0x67d52a=artifactDir(_0x4d8795,_0x2037db['id']),_0x47ca4a=join(_0x67d52a,ARTIFACT_FILE_BODY);if(!existsSync(_0x47ca4a))writeArtifactDir(_0x67d52a,_0x2037db,_0x2037db['etag']??newEtag());}return{async 'list'(_0x4e4021){const _0x439762=_0x2aa6;if(!existsSync(_0x4d8795))return[];const _0xa7a4c8=[];for(const _0x4bf729 of readdirSync(_0x4d8795,{'withFileTypes':!![]})){if(!_0x4bf729[_0x439762(0x188)]())continue;try{const _0x416ea2=readArtifactDir(artifactDir(_0x4d8795,_0x4bf729[_0x439762(0x1ba)]),_0x4bf729[_0x439762(0x1ba)]);if(!_0x4e4021||_0x416ea2[_0x439762(0x17e)]===_0x4e4021)_0xa7a4c8[_0x439762(0x1ab)]({'id':_0x416ea2['id'],'name':_0x416ea2[_0x439762(0x1ba)],'kind':_0x416ea2['kind']});}catch{}}return _0xa7a4c8;},async 'get'(_0x3cfd60){const _0xf85ed8=artifactDir(_0x4d8795,_0x3cfd60);if(!existsSync(_0xf85ed8))throw new KtNotFoundError('artifact\x20'+_0x3cfd60);return readArtifactDir(_0xf85ed8,_0x3cfd60);},async 'save'(_0x36b95a){const _0x3da313=_0x2aa6,_0x33de7c=artifactDir(_0x4d8795,_0x36b95a['id']),_0x3d1975=existsSync(_0x33de7c)?readArtifactDir(_0x33de7c,_0x36b95a['id']):void 0x0;if(_0x36b95a['etag']&&_0x3d1975?.[_0x3da313(0x18f)]&&_0x36b95a[_0x3da313(0x18f)]!==_0x3d1975[_0x3da313(0x18f)])throw new KtConflictError(_0x3da313(0x19b),_0x3d1975);const _0x2decce=newEtag();return writeArtifactDir(_0x33de7c,_0x36b95a,_0x2decce),{..._0x36b95a,'etag':_0x2decce};},async 'create'(_0x1eacd5){const _0xd84b71=_0x2aa6,_0x506963=_0x1eacd5[_0xd84b71(0x17e)]+'-'+Math['random']()[_0xd84b71(0x191)](0x24)['slice'](0x2,0xa),_0x124ebd={'id':_0x506963,'name':_0x1eacd5['name'],'kind':_0x1eacd5['kind'],'ktl':EMPTY_KTL};return this[_0xd84b71(0x189)](_0x124ebd);},async 'remove'(_0x1ebbeb){const _0x2602ca=_0x2aa6,_0xe2ee0b=artifactDir(_0x4d8795,_0x1ebbeb);if(!existsSync(_0xe2ee0b))throw new KtNotFoundError(_0x2602ca(0x1a7)+_0x1ebbeb);rmSync(_0xe2ee0b,{'recursive':!![],'force':!![]});}};}function _0x388a(){const _0x3c483d=['Dg9tDhjPBMC','A2v5CW','C2vLzeLUC3rHBMnLCW','odHUrLfXCuu','y29TBw9U','z2v0rgf0zq','lMPZB24','AgvHza','Aw5ZDgfUy2vZuM9VDa','mtmWmdyZmLbywwLlBG','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','CgfYC2u','mtCZmZG0nfrzvxvPBG','DMfSDwvZ','Bg9NlMPZB24','BM93','zgLNzxn0','zMLSzxm','z2v0rNvSBfLLyxi','zMLSDgvY','lwXVy2fSlq','CMv2','yxj0AwzHy3qG','BM90zq','ndu4mdCZnMvktu5zzG','yxj0AwzHy3rjza','ChvZAa','C3rYAw5NAwz5','z2v0twLUDxrLCW','sevbra','DxrMoa','DxbKyxrL','CgfKu3rHCNq','AM9PBG','Aw5ZDgfUy2uG','Dg9ju09tDhjPBMC','AxrLBxm','mZGWmdC1nwnJr3HRyG','zNjVBq','z2v0','odG3mtG3D0D2u1Pk','BMfTzq','BwfW','DhjPBq','lMv0ywC','CMv2ia','zgvJB2rL','zMLUza','C2HHmJu2','Bwv0yq','C3rYAw5N','CMvHzezPBgu','A2LUza','DMvYC2LVBNnsB290','CMfUzg9T','mtu5ndCWzfHmvxvW','5OgI5Asn6iEQia','y29TBwL0','y3DK','DgfIq29TBw9U','z2v0tw9UDgG','C29YDa','AxneAxjLy3rVCNK','C2f2zq','zw50CMLLCW','zw5KC1DPDgG','Agv4','ndy5mtmXCuvdwKj5','C2XPy2u','zxrHzW','Aw5ZDc0'];_0x388a=function(){return _0x3c483d;};return _0x388a();}function createFsInstanceStore(_0x3364f5,_0x179da2={}){const _0x33f8b6=_0x2aa6;mkdirSync(_0x3364f5,{'recursive':!![]});const _0x3862dc=_0xbaf486=>join(_0x3364f5,_0xbaf486+_0x33f8b6(0x197));for(const [_0x4ce26f,_0x5666fb]of Object[_0x33f8b6(0x18a)](_0x179da2)){if(!existsSync(_0x3862dc(_0x4ce26f)))writeFileSync(_0x3862dc(_0x4ce26f),JSON['stringify'](_0x5666fb,null,0x2),_0x33f8b6(0x1af));}return{async 'get'(_0x2acb96){const _0x62c3eb=_0x33f8b6,_0x1f7e17=_0x3862dc(_0x2acb96);if(!existsSync(_0x1f7e17))throw new KtNotFoundError(_0x62c3eb(0x1b3)+_0x2acb96);return JSON[_0x62c3eb(0x19c)](readFileSync(_0x1f7e17,_0x62c3eb(0x1af)));},async 'save'(_0x141c62,_0x150a9b){const _0x515991=_0x33f8b6,_0x453b8c=_0x3862dc(_0x141c62),_0x25e4b8=existsSync(_0x453b8c)?JSON[_0x515991(0x19c)](readFileSync(_0x453b8c,_0x515991(0x1af))):{'artifactId':'','values':{}},_0x3082f8={'artifactId':_0x25e4b8[_0x515991(0x1aa)],'values':{..._0x25e4b8[_0x515991(0x19e)],..._0x150a9b['values']},'common':{..._0x25e4b8[_0x515991(0x195)],..._0x150a9b[_0x515991(0x195)]},'tabCommon':{..._0x25e4b8[_0x515991(0x185)],..._0x150a9b[_0x515991(0x185)]}};writeFileSync(_0x453b8c,JSON[_0x515991(0x1ac)](_0x3082f8,null,0x2),_0x515991(0x1af));},async 'list'(_0x352ffb){const _0x3825f4=_0x33f8b6;return readdirSync(_0x3364f5)[_0x3825f4(0x1a4)](_0x4e5036=>_0x4e5036[_0x3825f4(0x18b)](_0x3825f4(0x197)))[_0x3825f4(0x1bb)](_0x1f248b=>{const _0x457e37=_0x3825f4,_0x331810=_0x1f248b[_0x457e37(0x18e)](0x0,-0x5),_0x30b305=JSON[_0x457e37(0x19c)](readFileSync(join(_0x3364f5,_0x1f248b),'utf8'));return{'id':_0x331810,'artifactId':_0x30b305['artifactId']};})[_0x3825f4(0x1a4)](_0x4d4522=>!_0x352ffb||_0x4d4522[_0x3825f4(0x1aa)]===_0x352ffb);},async 'create'(_0x4301c5){const _0x3268dd=_0x33f8b6,_0x4772df=_0x3268dd(0x190)+Math[_0x3268dd(0x180)]()[_0x3268dd(0x191)](0x24)['slice'](0x2,0xa);return writeFileSync(_0x3862dc(_0x4772df),JSON[_0x3268dd(0x1ac)]({'artifactId':_0x4301c5[_0x3268dd(0x1aa)],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x4772df};}};}function sha256Hex(_0x5e0b85){const _0x5086d2=_0x2aa6,_0x466395=typeof _0x5e0b85==='string'?Buffer[_0x5086d2(0x1b7)](_0x5e0b85,'utf8'):Buffer[_0x5086d2(0x1b7)](_0x5e0b85);return createHash(_0x5086d2(0x17a))[_0x5086d2(0x1b0)](_0x466395)[_0x5086d2(0x1a1)](_0x5086d2(0x18c));}function writeObject(_0x33ee5f,_0x4704dc){const _0x104cba=sha256Hex(_0x4704dc),_0x2d221c=objectPath(_0x33ee5f,_0x104cba);mkdirSync(dirname(_0x2d221c),{'recursive':!![]});if(!existsSync(_0x2d221c))writeFileSync(_0x2d221c,_0x4704dc);return _0x104cba;}function readLog(_0x14f038,_0x1e1579,_0x1938aa){const _0x5230d5=_0x2aa6,_0x580d87=itemDir(_0x14f038,_0x1e1579,_0x1938aa),_0x27aa5c=join(_0x580d87,_0x5230d5(0x19f)),_0x5805a6=join(_0x580d87,_0x5230d5(0x1ae)),_0x5c1cd6=existsSync(_0x27aa5c)?JSON[_0x5230d5(0x19c)](readFileSync(_0x27aa5c,_0x5230d5(0x1af))):[],_0x4059cd=existsSync(_0x5805a6)?readFileSync(_0x5805a6,_0x5230d5(0x1af))[_0x5230d5(0x1bc)]():_0x5c1cd6['at'](-0x1)?.[_0x5230d5(0x1a6)]??null;return{'head':_0x4059cd,'items':_0x5c1cd6};}function writeLog(_0xd62a0e,_0x56eaaf,_0x51aada,_0x9af4b1,_0xffd71e){const _0x34964d=_0x2aa6,_0x153971=itemDir(_0xd62a0e,_0x56eaaf,_0x51aada);mkdirSync(_0x153971,{'recursive':!![]}),writeFileSync(join(_0x153971,_0x34964d(0x19f)),JSON[_0x34964d(0x1ac)](_0xffd71e,null,0x2),_0x34964d(0x1af)),writeFileSync(join(_0x153971,_0x34964d(0x1ae)),_0x9af4b1+'\x0a',_0x34964d(0x1af));}function findRev(_0x19564a,_0x4b6cd9){const _0x5dc184=_0x2aa6,_0x2144e7=join(_0x19564a,_0x5dc184(0x1b5));if(!existsSync(_0x2144e7))return void 0x0;for(const _0x4a2cee of readdirSync(_0x2144e7,{'withFileTypes':!![]})){if(!_0x4a2cee[_0x5dc184(0x188)]())continue;for(const _0x21de1e of readdirSync(join(_0x2144e7,_0x4a2cee[_0x5dc184(0x1ba)]),{'withFileTypes':!![]})){if(!_0x21de1e[_0x5dc184(0x188)]())continue;const _0x1bf967=readLog(_0x19564a,_0x4a2cee[_0x5dc184(0x1ba)],_0x21de1e[_0x5dc184(0x1ba)])[_0x5dc184(0x1b5)]['find'](_0x295138=>_0x295138[_0x5dc184(0x1a6)]===_0x4b6cd9);if(_0x1bf967)return _0x1bf967;}}return void 0x0;}function _0x2aa6(_0x374d1c,_0x4c8fc7){_0x374d1c=_0x374d1c-0x178;const _0x388a87=_0x388a();let _0x2aa664=_0x388a87[_0x374d1c];if(_0x2aa6['SHmIiz']===undefined){var _0x45a923=function(_0x202e1a){const _0x555c48='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3a0e21='',_0x5e50df='';for(let _0x50ae25=0x0,_0x66da06,_0x136fd3,_0x4228f6=0x0;_0x136fd3=_0x202e1a['charAt'](_0x4228f6++);~_0x136fd3&&(_0x66da06=_0x50ae25%0x4?_0x66da06*0x40+_0x136fd3:_0x136fd3,_0x50ae25++%0x4)?_0x3a0e21+=String['fromCharCode'](0xff&_0x66da06>>(-0x2*_0x50ae25&0x6)):0x0){_0x136fd3=_0x555c48['indexOf'](_0x136fd3);}for(let _0x412fda=0x0,_0x40a7b5=_0x3a0e21['length'];_0x412fda<_0x40a7b5;_0x412fda++){_0x5e50df+='%'+('00'+_0x3a0e21['charCodeAt'](_0x412fda)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5e50df);};_0x2aa6['YpseQN']=_0x45a923,_0x2aa6['gvheNi']={},_0x2aa6['SHmIiz']=!![];}const _0x2519ca=_0x388a87[0x0];_0x2aa6['VKQHVT']!==_0x2519ca&&(_0x2aa6['gvheNi']={},_0x2aa6['VKQHVT']=_0x2519ca);const _0x452391=_0x2aa6['gvheNi'][_0x374d1c];return _0x452391===undefined?(_0x2aa664=_0x2aa6['YpseQN'](_0x2aa664),_0x2aa6['gvheNi'][_0x374d1c]=_0x2aa664):_0x2aa664=_0x452391,_0x2aa664;}function filesTextOf(_0x17af8f,_0x586ca7){const _0x18e811={};for(const [_0x23e400,_0x1fafb1]of Object['entries'](_0x586ca7['files'])){const _0x34196f=objectPath(_0x17af8f,_0x1fafb1);if(existsSync(_0x34196f))_0x18e811[_0x23e400]=readFileSync(_0x34196f,'utf8');}return _0x18e811;}function createFsVersionStore(_0x7d35b8,_0x153bb3){return mkdirSync(_0x7d35b8,{'recursive':!![]}),{async 'log'(_0x1d93e9,_0x42f0c3){const _0x29c5c6=_0x2aa6,{head:_0x4f444a,items:_0x2cdb1b}=readLog(_0x7d35b8,_0x1d93e9,_0x42f0c3);return{'head':_0x4f444a,'items':[..._0x2cdb1b][_0x29c5c6(0x187)]((_0x418c33,_0x4eb377)=>_0x418c33['at']<_0x4eb377['at']?0x1:-0x1)};},async 'get'(_0x428abe){const _0x266588=_0x2aa6,_0x68d727=findRev(_0x7d35b8,_0x428abe);if(!_0x68d727)throw new KtNotFoundError(_0x266588(0x1be)+_0x428abe);return _0x68d727;},async 'readFile'(_0x2fa4b4,_0x2ff61e){const _0x3bc80e=_0x2aa6,_0x330168=await this[_0x3bc80e(0x1b8)](_0x2fa4b4),_0xe4186a=_0x330168['files'][_0x2ff61e];if(!_0xe4186a)throw new KtNotFoundError(_0x2ff61e);const _0x203971=objectPath(_0x7d35b8,_0xe4186a);if(!existsSync(_0x203971))throw new KtNotFoundError(_0x2ff61e);return new Uint8Array(readFileSync(_0x203971));},async 'commit'(_0x251d5b){const _0x21ba7b=_0x2aa6;let _0x2900ff=_0x251d5b[_0x21ba7b(0x1a2)];if(!_0x2900ff){const _0x4ebdd5=await _0x153bb3[_0x21ba7b(0x1b8)](_0x251d5b['id']);_0x2900ff=artifactToFiles(_0x4ebdd5);}const _0x4177d5={},_0x5bd0ea={};for(const [_0x4c6344,_0x3ef7d1]of Object[_0x21ba7b(0x18a)](_0x2900ff)){const _0x2d90fa=typeof _0x3ef7d1===_0x21ba7b(0x17c)?_0x3ef7d1:new TextDecoder()[_0x21ba7b(0x178)](_0x3ef7d1);_0x4177d5[_0x4c6344]=_0x2d90fa,_0x5bd0ea[_0x4c6344]=writeObject(_0x7d35b8,typeof _0x3ef7d1===_0x21ba7b(0x17c)?Buffer[_0x21ba7b(0x1b7)](_0x3ef7d1,_0x21ba7b(0x1af)):_0x3ef7d1);}const _0x26ab84=readLog(_0x7d35b8,_0x251d5b[_0x21ba7b(0x17e)],_0x251d5b['id']);if(_0x26ab84[_0x21ba7b(0x198)]){const _0x2bed6b=_0x26ab84[_0x21ba7b(0x1b5)][_0x21ba7b(0x179)](_0x5aa19b=>_0x5aa19b[_0x21ba7b(0x1a6)]===_0x26ab84[_0x21ba7b(0x198)]);if(_0x2bed6b&&filesEqual(_0x4177d5,filesTextOf(_0x7d35b8,_0x2bed6b)))return _0x2bed6b;}const _0x2f7725=new Date(),_0x46fd7e=String(_0x2f7725[_0x21ba7b(0x1a3)]())['slice'](0x2)+String(_0x2f7725[_0x21ba7b(0x186)]()+0x1)[_0x21ba7b(0x1b1)](0x2,'0')+String(_0x2f7725[_0x21ba7b(0x196)]())[_0x21ba7b(0x1b1)](0x2,'0')+String(_0x2f7725['getHours']())[_0x21ba7b(0x1b1)](0x2,'0')+String(_0x2f7725[_0x21ba7b(0x1ad)]())[_0x21ba7b(0x1b1)](0x2,'0'),_0x9d1a00=sha256Hex(Object[_0x21ba7b(0x19e)](_0x5bd0ea)[_0x21ba7b(0x187)]()[_0x21ba7b(0x1b2)](','))['slice'](0x0,0x8),_0xd3efd0={'rev':_0x46fd7e+_0x21ba7b(0x1a5)+_0x9d1a00,'kind':_0x251d5b['kind'],'id':_0x251d5b['id'],'at':_0x2f7725[_0x21ba7b(0x1b4)](),'parent':_0x26ab84[_0x21ba7b(0x198)],'by':_0x251d5b['by'],'note':_0x251d5b[_0x21ba7b(0x1a8)],'files':_0x5bd0ea,'meta':_0x251d5b[_0x21ba7b(0x17b)]};return writeLog(_0x7d35b8,_0x251d5b[_0x21ba7b(0x17e)],_0x251d5b['id'],_0xd3efd0[_0x21ba7b(0x1a6)],[..._0x26ab84[_0x21ba7b(0x1b5)],_0xd3efd0]),_0xd3efd0;},async 'restore'(_0x58e056,_0x20daa8,_0x4f58a5,_0x2d6d95){const _0x30c6eb=_0x2aa6,_0x5f1710=await this['get'](_0x4f58a5),_0x23e8af={};for(const _0x34736c of Object[_0x30c6eb(0x192)](_0x5f1710[_0x30c6eb(0x1a2)])){_0x23e8af[_0x34736c]=new TextDecoder()[_0x30c6eb(0x178)](await this[_0x30c6eb(0x17d)](_0x4f58a5,_0x34736c));}const _0x458f74=filesToArtifact(_0x23e8af,_0x20daa8);return await _0x153bb3[_0x30c6eb(0x189)]({..._0x458f74,'id':_0x20daa8,'kind':_0x458f74[_0x30c6eb(0x17e)],'etag':void 0x0}),this[_0x30c6eb(0x183)]({'kind':_0x58e056,'id':_0x20daa8,'files':_0x23e8af,'by':_0x2d6d95,'note':_0x30c6eb(0x182)+_0x4f58a5});}};}function createKtFsStores(_0x5ced50){const _0x15adb1=_0x2aa6,_0x361391=createFsArtifactStore(resolveRoot(_0x5ced50['artifactsRoot'],_0x5ced50[_0x15adb1(0x184)]),_0x5ced50['seed']),_0x19ee34=_0x5ced50[_0x15adb1(0x199)]?createFsInstanceStore(resolveRoot(_0x5ced50[_0x15adb1(0x199)],_0x5ced50[_0x15adb1(0x184)]),_0x5ced50[_0x15adb1(0x193)]):void 0x0,_0x1a478d=_0x5ced50[_0x15adb1(0x17f)]?createFsVersionStore(resolveRoot(_0x5ced50[_0x15adb1(0x17f)],_0x5ced50[_0x15adb1(0x184)]),_0x361391):void 0x0;return{'artifacts':_0x361391,'instances':_0x19ee34,'versions':_0x1a478d};}export{createKtFsStores};
|
|
1
|
+
const _0x4dcf78=_0x4d67;(function(_0x51ebf6,_0x54bff4){const _0x5128c5=_0x4d67,_0x557da2=_0x51ebf6();while(!![]){try{const _0x5bffaa=-parseInt(_0x5128c5(0x213))/0x1*(-parseInt(_0x5128c5(0x217))/0x2)+parseInt(_0x5128c5(0x212))/0x3+-parseInt(_0x5128c5(0x1ee))/0x4*(-parseInt(_0x5128c5(0x21c))/0x5)+-parseInt(_0x5128c5(0x206))/0x6*(-parseInt(_0x5128c5(0x1f5))/0x7)+-parseInt(_0x5128c5(0x228))/0x8*(parseInt(_0x5128c5(0x227))/0x9)+-parseInt(_0x5128c5(0x222))/0xa*(parseInt(_0x5128c5(0x1f3))/0xb)+-parseInt(_0x5128c5(0x1fa))/0xc;if(_0x5bffaa===_0x54bff4)break;else _0x557da2['push'](_0x557da2['shift']());}catch(_0x305c5b){_0x557da2['push'](_0x557da2['shift']());}}}(_0x3179,0x248f1));import{mkdirSync,existsSync,rmSync,readdirSync,writeFileSync,readFileSync}from'fs';function _0x3179(){const _0x25bd2a=['zxrHzW','Dg9tDhjPBMC','DMfSDwvZ','BwfW','nZuWotq4zxvgDM9r','BM90zq','AxneAxjLy3rVCNK','lMv0ywC','Bwv0yq','DMvYC2LVBNnsB290','AM9PBG','y29TBw9U','CgfYC2u','BM93','AxrLBxm','yxj0AwzHy3rjza','nMTuwxn3Ba','z2v0','zNjVBq','C2vLzeLUC3rHBMnLCW','zMLSzxm','DgfIq29TBw9U','z2v0sg91CNm','AgvHza','C3rYAw5NAwz5','C2f2zq','CgfKu3rHCNq','C29YDa','ntC0mtrtzeLrtMy','nhvVzgDiCa','Aw5ZDc0','ChvZAa','lwXVy2fSlq','mtm5nZC0qxLyt0zr','DxrMoa','A2LUza','A2v5CW','y29TBwL0','nxDICeLWsa','C2XPy2u','zMLUza','z2v0tw9UDgG','C2vLza','lMPZB24','mZbiy0vfyuG','sevbra','Aw5ZDgfUy2vZuM9VDa','Dg9ju09tDhjPBMC','y3DK','mZG0m0Pcvw5qDa','ndG4qKPVBMvY','5OgI5Asn6iEQia','zw5KC1DPDgG','C3rYAw5N','zMLSDgvY','yxj0AwzHy3qG','BMfTzq','zgvJB2rL','Bg9NlMPZB24','C2HHmJu2','CMv2','ntC3oda0ANHfqxvQ','zw50CMLLCW','z2v0twLUDxrLCW','CMfUzg9T','B2jQzwn0CW','nZCXotq3weXhqKzd','DhjPBq','ndaZntvOqM1zB0S'];_0x3179=function(){return _0x25bd2a;};return _0x3179();}import{join,isAbsolute,resolve,dirname}from'path';import{ARTIFACT_FILE_BODY,KtNotFoundError,EMPTY_KTL,KtConflictError,filesToArtifact,artifactToFiles,filesEqual,ARTIFACT_FILE_META,ARTIFACT_FILE_FILL,ARTIFACT_FILE_REPORT}from'@k-table/report/store';import{createHash}from'crypto';function resolveRoot(_0x5c526e,_0x87e9e3=process[_0x4dcf78(0x226)]()){const _0x19e872=isAbsolute(_0x5c526e)?_0x5c526e:resolve(_0x87e9e3,_0x5c526e);return mkdirSync(_0x19e872,{'recursive':!![]}),_0x19e872;}function artifactDir(_0x19b264,_0x859539){return join(_0x19b264,_0x859539);}function objectPath(_0x111dab,_0x49009d){const _0x2db53d=_0x4dcf78;return join(_0x111dab,_0x2db53d(0x1f2),_0x49009d[_0x2db53d(0x21d)](0x0,0x2),_0x49009d);}function itemDir(_0x441d55,_0x9a550c,_0x2ec33b){const _0x1359ba=_0x4dcf78;return join(_0x441d55,_0x1359ba(0x204),_0x9a550c,_0x2ec33b);}function newEtag(){const _0xa3ba5f=_0x4dcf78;return Date[_0xa3ba5f(0x203)]()[_0xa3ba5f(0x1f7)](0x24)+'-'+Math[_0xa3ba5f(0x1f1)]()[_0xa3ba5f(0x1f7)](0x24)['slice'](0x2,0x8);}function readEtag(_0x4925e4){const _0x5732b5=_0x4dcf78,_0x9caf1a=join(_0x4925e4,_0x5732b5(0x1fd));return existsSync(_0x9caf1a)?readFileSync(_0x9caf1a,_0x5732b5(0x218))[_0x5732b5(0x1f4)]():void 0x0;}function writeArtifactDir(_0x3b3275,_0x589620,_0x1dc2df){const _0x56bafe=_0x4dcf78;mkdirSync(join(_0x3b3275,'faces'),{'recursive':!![]});const _0x1eedce=artifactToFiles(_0x589620);writeFileSync(join(_0x3b3275,ARTIFACT_FILE_META),_0x1eedce[ARTIFACT_FILE_META]??'{}',_0x56bafe(0x218)),writeFileSync(join(_0x3b3275,ARTIFACT_FILE_BODY),_0x1eedce[ARTIFACT_FILE_BODY]??'',_0x56bafe(0x218));const _0x4a051e=join(_0x3b3275,ARTIFACT_FILE_FILL),_0x2d5f9b=join(_0x3b3275,ARTIFACT_FILE_REPORT);if(_0x1eedce[ARTIFACT_FILE_FILL])writeFileSync(_0x4a051e,_0x1eedce[ARTIFACT_FILE_FILL],_0x56bafe(0x218));else{if(existsSync(_0x4a051e))rmSync(_0x4a051e);}if(_0x1eedce[ARTIFACT_FILE_REPORT])writeFileSync(_0x2d5f9b,_0x1eedce[ARTIFACT_FILE_REPORT],_0x56bafe(0x218));else{if(existsSync(_0x2d5f9b))rmSync(_0x2d5f9b);}writeFileSync(join(_0x3b3275,_0x56bafe(0x1fd)),_0x1dc2df,_0x56bafe(0x218));}function readArtifactDir(_0x12f391,_0xfcfaad){const _0x4cd8c3=_0x4dcf78,_0x45a330={},_0x5894cb=join(_0x12f391,ARTIFACT_FILE_META),_0x15595a=join(_0x12f391,ARTIFACT_FILE_BODY);if(existsSync(_0x5894cb))_0x45a330[ARTIFACT_FILE_META]=readFileSync(_0x5894cb,'utf8');if(existsSync(_0x15595a))_0x45a330[ARTIFACT_FILE_BODY]=readFileSync(_0x15595a,_0x4cd8c3(0x218));const _0x982f2=join(_0x12f391,ARTIFACT_FILE_FILL),_0x28c832=join(_0x12f391,ARTIFACT_FILE_REPORT);if(existsSync(_0x982f2))_0x45a330[ARTIFACT_FILE_FILL]=readFileSync(_0x982f2,_0x4cd8c3(0x218));if(existsSync(_0x28c832))_0x45a330[ARTIFACT_FILE_REPORT]=readFileSync(_0x28c832,_0x4cd8c3(0x218));return{...filesToArtifact(_0x45a330,_0xfcfaad),'etag':readEtag(_0x12f391)};}function createFsArtifactStore(_0x429c7c,_0x1ca2b5=[]){const _0x55cc56=_0x4dcf78;mkdirSync(_0x429c7c,{'recursive':!![]});for(const _0x535dc1 of _0x1ca2b5){const _0x4c7e96=artifactDir(_0x429c7c,_0x535dc1['id']),_0x290f37=join(_0x4c7e96,ARTIFACT_FILE_BODY);if(!existsSync(_0x290f37))writeArtifactDir(_0x4c7e96,_0x535dc1,_0x535dc1[_0x55cc56(0x1f6)]??newEtag());}return{async 'list'(_0x350062){const _0x3e98a1=_0x55cc56;if(!existsSync(_0x429c7c))return[];const _0x43dfde=[];for(const _0x3bd1aa of readdirSync(_0x429c7c,{'withFileTypes':!![]})){if(!_0x3bd1aa[_0x3e98a1(0x1fc)]())continue;try{const _0x468295=readArtifactDir(artifactDir(_0x429c7c,_0x3bd1aa[_0x3e98a1(0x1e9)]),_0x3bd1aa[_0x3e98a1(0x1e9)]);if(!_0x350062||_0x468295['kind']===_0x350062)_0x43dfde[_0x3e98a1(0x215)]({'id':_0x468295['id'],'name':_0x468295[_0x3e98a1(0x1e9)],'kind':_0x468295[_0x3e98a1(0x219)]});}catch{}}return _0x43dfde;},async 'get'(_0x49537f){const _0x39aac0=artifactDir(_0x429c7c,_0x49537f);if(!existsSync(_0x39aac0))throw new KtNotFoundError('artifact\x20'+_0x49537f);return readArtifactDir(_0x39aac0,_0x49537f);},async 'save'(_0x1be000){const _0x66a3ec=_0x55cc56,_0x2b0664=artifactDir(_0x429c7c,_0x1be000['id']),_0x5113fb=existsSync(_0x2b0664)?readArtifactDir(_0x2b0664,_0x1be000['id']):void 0x0;if(_0x1be000[_0x66a3ec(0x1f6)]&&_0x5113fb?.[_0x66a3ec(0x1f6)]&&_0x1be000[_0x66a3ec(0x1f6)]!==_0x5113fb[_0x66a3ec(0x1f6)])throw new KtConflictError('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x5113fb);const _0x3a244f=newEtag();return writeArtifactDir(_0x2b0664,_0x1be000,_0x3a244f),{..._0x1be000,'etag':_0x3a244f};},async 'create'(_0x1d1efa){const _0x1dd24f=_0x55cc56,_0xf59378=_0x1d1efa[_0x1dd24f(0x219)]+'-'+Math[_0x1dd24f(0x1f1)]()[_0x1dd24f(0x1f7)](0x24)[_0x1dd24f(0x21d)](0x2,0xa),_0x45fe53={'id':_0xf59378,'name':_0x1d1efa[_0x1dd24f(0x1e9)],'kind':_0x1d1efa[_0x1dd24f(0x219)],'ktl':EMPTY_KTL};return this[_0x1dd24f(0x20f)](_0x45fe53);},async 'remove'(_0xe241f0){const _0x4c934e=_0x55cc56,_0x4e88c3=artifactDir(_0x429c7c,_0xe241f0);if(!existsSync(_0x4e88c3))throw new KtNotFoundError(_0x4c934e(0x1e8)+_0xe241f0);rmSync(_0x4e88c3,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x50882f,_0x3fa2a5={}){const _0x31282c=_0x4dcf78;mkdirSync(_0x50882f,{'recursive':!![]});const _0x5cadec=_0x368e9e=>join(_0x50882f,_0x368e9e+'.json');for(const [_0x29eb9c,_0x5b0ef1]of Object[_0x31282c(0x1ef)](_0x3fa2a5)){if(!existsSync(_0x5cadec(_0x29eb9c)))writeFileSync(_0x5cadec(_0x29eb9c),JSON[_0x31282c(0x20e)](_0x5b0ef1,null,0x2),_0x31282c(0x218));}return{async 'get'(_0x8aceb1){const _0xbe66e2=_0x31282c,_0xd99b35=_0x5cadec(_0x8aceb1);if(!existsSync(_0xd99b35))throw new KtNotFoundError('instance\x20'+_0x8aceb1);return JSON[_0xbe66e2(0x202)](readFileSync(_0xd99b35,_0xbe66e2(0x218)));},async 'save'(_0x56c2d2,_0x21653f){const _0x4f7019=_0x31282c,_0x3fcada=_0x5cadec(_0x56c2d2),_0x10f5bd=existsSync(_0x3fcada)?JSON[_0x4f7019(0x202)](readFileSync(_0x3fcada,_0x4f7019(0x218))):{'artifactId':'','values':{}},_0x389a45={'artifactId':_0x10f5bd[_0x4f7019(0x205)],'values':{..._0x10f5bd[_0x4f7019(0x1f8)],..._0x21653f[_0x4f7019(0x1f8)]},'common':{..._0x10f5bd['common'],..._0x21653f[_0x4f7019(0x201)]},'tabCommon':{..._0x10f5bd['tabCommon'],..._0x21653f[_0x4f7019(0x20b)]}};writeFileSync(_0x3fcada,JSON[_0x4f7019(0x20e)](_0x389a45,null,0x2),_0x4f7019(0x218));},async 'list'(_0x42ce45){const _0x3344a2=_0x31282c;return readdirSync(_0x50882f)[_0x3344a2(0x1e7)](_0x270974=>_0x270974[_0x3344a2(0x22a)](_0x3344a2(0x221)))[_0x3344a2(0x1f9)](_0x39b99b=>{const _0x543564=_0x3344a2,_0x135971=_0x39b99b[_0x543564(0x21d)](0x0,-0x5),_0x1d3472=JSON[_0x543564(0x202)](readFileSync(join(_0x50882f,_0x39b99b),_0x543564(0x218)));return{'id':_0x135971,'artifactId':_0x1d3472[_0x543564(0x205)]};})[_0x3344a2(0x1e7)](_0x13e4ea=>!_0x42ce45||_0x13e4ea[_0x3344a2(0x205)]===_0x42ce45);},async 'create'(_0x211b37){const _0x3eaff8=_0x31282c,_0x576f05=_0x3eaff8(0x214)+Math[_0x3eaff8(0x1f1)]()[_0x3eaff8(0x1f7)](0x24)[_0x3eaff8(0x21d)](0x2,0xa);return writeFileSync(_0x5cadec(_0x576f05),JSON['stringify']({'artifactId':_0x211b37[_0x3eaff8(0x205)],'values':{},'common':{}},null,0x2),_0x3eaff8(0x218)),{'id':_0x576f05};}};}function sha256Hex(_0x546fd0){const _0x57ecea=_0x4dcf78,_0x124f6c=typeof _0x546fd0===_0x57ecea(0x22b)?Buffer[_0x57ecea(0x208)](_0x546fd0,_0x57ecea(0x218)):Buffer[_0x57ecea(0x208)](_0x546fd0);return createHash(_0x57ecea(0x1ec))['update'](_0x124f6c)['digest']('hex');}function writeObject(_0x5a402d,_0x2e1d65){const _0x16dfe5=sha256Hex(_0x2e1d65),_0x545e3c=objectPath(_0x5a402d,_0x16dfe5);mkdirSync(dirname(_0x545e3c),{'recursive':!![]});if(!existsSync(_0x545e3c))writeFileSync(_0x545e3c,_0x2e1d65);return _0x16dfe5;}function readLog(_0x55de6e,_0xd4e8ac,_0x17267b){const _0xbdec2b=_0x4dcf78,_0x46aef7=itemDir(_0x55de6e,_0xd4e8ac,_0x17267b),_0x26cf31=join(_0x46aef7,_0xbdec2b(0x1eb)),_0x5ad6f6=join(_0x46aef7,'HEAD'),_0x21a9a4=existsSync(_0x26cf31)?JSON['parse'](readFileSync(_0x26cf31,_0xbdec2b(0x218))):[],_0xce87ca=existsSync(_0x5ad6f6)?readFileSync(_0x5ad6f6,'utf8')['trim']():_0x21a9a4['at'](-0x1)?.[_0xbdec2b(0x1ed)]??null;return{'head':_0xce87ca,'items':_0x21a9a4};}function writeLog(_0x17c3c0,_0x5ea1d1,_0x76bfa9,_0x722346,_0x1af61b){const _0x195492=_0x4dcf78,_0x1dab94=itemDir(_0x17c3c0,_0x5ea1d1,_0x76bfa9);mkdirSync(_0x1dab94,{'recursive':!![]}),writeFileSync(join(_0x1dab94,_0x195492(0x1eb)),JSON[_0x195492(0x20e)](_0x1af61b,null,0x2),_0x195492(0x218)),writeFileSync(join(_0x1dab94,_0x195492(0x223)),_0x722346+'\x0a',_0x195492(0x218));}function findRev(_0x32dc76,_0xc05bd4){const _0x523e2c=_0x4dcf78,_0xcf908=join(_0x32dc76,_0x523e2c(0x204));if(!existsSync(_0xcf908))return void 0x0;for(const _0x3129ad of readdirSync(_0xcf908,{'withFileTypes':!![]})){if(!_0x3129ad['isDirectory']())continue;for(const _0x346326 of readdirSync(join(_0xcf908,_0x3129ad['name']),{'withFileTypes':!![]})){if(!_0x346326[_0x523e2c(0x1fc)]())continue;const _0x101f78=readLog(_0x32dc76,_0x3129ad['name'],_0x346326[_0x523e2c(0x1e9)])[_0x523e2c(0x204)]['find'](_0x50924f=>_0x50924f[_0x523e2c(0x1ed)]===_0xc05bd4);if(_0x101f78)return _0x101f78;}}return void 0x0;}function filesTextOf(_0x503be0,_0x1d6607){const _0x19d39e=_0x4dcf78,_0x534014={};for(const [_0x3708c0,_0x5e0d69]of Object['entries'](_0x1d6607[_0x19d39e(0x20a)])){const _0x57c889=objectPath(_0x503be0,_0x5e0d69);if(existsSync(_0x57c889))_0x534014[_0x3708c0]=readFileSync(_0x57c889,_0x19d39e(0x218));}return _0x534014;}function createFsVersionStore(_0x2c4a7e,_0x4dccf6){return mkdirSync(_0x2c4a7e,{'recursive':!![]}),{async 'log'(_0x4ee63f,_0x25723c){const _0x1fdad4=_0x4d67,{head:_0x4cc64a,items:_0x2c6a66}=readLog(_0x2c4a7e,_0x4ee63f,_0x25723c);return{'head':_0x4cc64a,'items':[..._0x2c6a66][_0x1fdad4(0x211)]((_0x1b2f2f,_0x1ddee3)=>_0x1b2f2f['at']<_0x1ddee3['at']?0x1:-0x1)};},async 'get'(_0x402a52){const _0x48cd3f=findRev(_0x2c4a7e,_0x402a52);if(!_0x48cd3f)throw new KtNotFoundError('rev\x20'+_0x402a52);return _0x48cd3f;},async 'readFile'(_0x3bf030,_0x14588c){const _0x373676=_0x4d67,_0x48d790=await this[_0x373676(0x207)](_0x3bf030),_0x1535d0=_0x48d790[_0x373676(0x20a)][_0x14588c];if(!_0x1535d0)throw new KtNotFoundError(_0x14588c);const _0x356123=objectPath(_0x2c4a7e,_0x1535d0);if(!existsSync(_0x356123))throw new KtNotFoundError(_0x14588c);return new Uint8Array(readFileSync(_0x356123));},async 'commit'(_0xd2ceaf){const _0x27614a=_0x4d67;let _0x5c2ead=_0xd2ceaf[_0x27614a(0x20a)];if(!_0x5c2ead){const _0x4d94bf=await _0x4dccf6[_0x27614a(0x207)](_0xd2ceaf['id']);_0x5c2ead=artifactToFiles(_0x4d94bf);}const _0x14f042={},_0x4d7e2c={};for(const [_0xc89480,_0x1e9c6c]of Object['entries'](_0x5c2ead)){const _0x5a0346=typeof _0x1e9c6c===_0x27614a(0x22b)?_0x1e9c6c:new TextDecoder()[_0x27614a(0x1ea)](_0x1e9c6c);_0x14f042[_0xc89480]=_0x5a0346,_0x4d7e2c[_0xc89480]=writeObject(_0x2c4a7e,typeof _0x1e9c6c===_0x27614a(0x22b)?Buffer[_0x27614a(0x208)](_0x1e9c6c,'utf8'):_0x1e9c6c);}const _0x829947=readLog(_0x2c4a7e,_0xd2ceaf[_0x27614a(0x219)],_0xd2ceaf['id']);if(_0x829947[_0x27614a(0x20d)]){const _0x14c21b=_0x829947[_0x27614a(0x204)][_0x27614a(0x21e)](_0x54fe83=>_0x54fe83[_0x27614a(0x1ed)]===_0x829947[_0x27614a(0x20d)]);if(_0x14c21b&&filesEqual(_0x14f042,filesTextOf(_0x2c4a7e,_0x14c21b)))return _0x14c21b;}const _0x3c2b85=new Date(),_0x1f2ab7=String(_0x3c2b85['getFullYear']())[_0x27614a(0x21d)](0x2)+String(_0x3c2b85[_0x27614a(0x21f)]()+0x1)['padStart'](0x2,'0')+String(_0x3c2b85['getDate']())[_0x27614a(0x210)](0x2,'0')+String(_0x3c2b85[_0x27614a(0x20c)]())['padStart'](0x2,'0')+String(_0x3c2b85[_0x27614a(0x1f0)]())[_0x27614a(0x210)](0x2,'0'),_0x570365=sha256Hex(Object[_0x27614a(0x1f8)](_0x4d7e2c)[_0x27614a(0x211)]()[_0x27614a(0x200)](','))[_0x27614a(0x21d)](0x0,0x8),_0x39a665={'rev':_0x1f2ab7+_0x27614a(0x216)+_0x570365,'kind':_0xd2ceaf[_0x27614a(0x219)],'id':_0xd2ceaf['id'],'at':_0x3c2b85[_0x27614a(0x225)](),'parent':_0x829947[_0x27614a(0x20d)],'by':_0xd2ceaf['by'],'note':_0xd2ceaf[_0x27614a(0x1fb)],'files':_0x4d7e2c,'meta':_0xd2ceaf[_0x27614a(0x1fe)]};return writeLog(_0x2c4a7e,_0xd2ceaf[_0x27614a(0x219)],_0xd2ceaf['id'],_0x39a665['rev'],[..._0x829947[_0x27614a(0x204)],_0x39a665]),_0x39a665;},async 'restore'(_0x2bca15,_0x1b8d35,_0x359c52,_0x4473eb){const _0x18cfb9=_0x4d67,_0x2710fd=await this[_0x18cfb9(0x207)](_0x359c52),_0x4ca257={};for(const _0x508811 of Object[_0x18cfb9(0x21a)](_0x2710fd['files'])){_0x4ca257[_0x508811]=new TextDecoder()[_0x18cfb9(0x1ea)](await this['readFile'](_0x359c52,_0x508811));}const _0x500ec4=filesToArtifact(_0x4ca257,_0x1b8d35);return await _0x4dccf6[_0x18cfb9(0x20f)]({..._0x500ec4,'id':_0x1b8d35,'kind':_0x500ec4[_0x18cfb9(0x219)],'etag':void 0x0}),this[_0x18cfb9(0x21b)]({'kind':_0x2bca15,'id':_0x1b8d35,'files':_0x4ca257,'by':_0x4473eb,'note':_0x18cfb9(0x229)+_0x359c52});}};}function createKtFsStores(_0x4b2294){const _0x3c287b=_0x4dcf78,_0x1cc2ef=createFsArtifactStore(resolveRoot(_0x4b2294['artifactsRoot'],_0x4b2294[_0x3c287b(0x226)]),_0x4b2294[_0x3c287b(0x220)]),_0x1bec41=_0x4b2294[_0x3c287b(0x224)]?createFsInstanceStore(resolveRoot(_0x4b2294['instancesRoot'],_0x4b2294['cwd']),_0x4b2294[_0x3c287b(0x209)]):void 0x0,_0xb7bc94=_0x4b2294['versionsRoot']?createFsVersionStore(resolveRoot(_0x4b2294[_0x3c287b(0x1ff)],_0x4b2294['cwd']),_0x1cc2ef):void 0x0;return{'artifacts':_0x1cc2ef,'instances':_0x1bec41,'versions':_0xb7bc94};}function _0x4d67(_0x7e7ce2,_0x319b34){_0x7e7ce2=_0x7e7ce2-0x1e7;const _0x317903=_0x3179();let _0x4d67f1=_0x317903[_0x7e7ce2];if(_0x4d67['SnlbdF']===undefined){var _0x28fd8d=function(_0x474fd5){const _0x2d6d23='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x264891='',_0x5c526e='';for(let _0x87e9e3=0x0,_0x19e872,_0x19b264,_0x859539=0x0;_0x19b264=_0x474fd5['charAt'](_0x859539++);~_0x19b264&&(_0x19e872=_0x87e9e3%0x4?_0x19e872*0x40+_0x19b264:_0x19b264,_0x87e9e3++%0x4)?_0x264891+=String['fromCharCode'](0xff&_0x19e872>>(-0x2*_0x87e9e3&0x6)):0x0){_0x19b264=_0x2d6d23['indexOf'](_0x19b264);}for(let _0x111dab=0x0,_0x49009d=_0x264891['length'];_0x111dab<_0x49009d;_0x111dab++){_0x5c526e+='%'+('00'+_0x264891['charCodeAt'](_0x111dab)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5c526e);};_0x4d67['FmVdCI']=_0x28fd8d,_0x4d67['mnygIM']={},_0x4d67['SnlbdF']=!![];}const _0x1ebd6c=_0x317903[0x0];_0x4d67['vTwpbf']!==_0x1ebd6c&&(_0x4d67['mnygIM']={},_0x4d67['vTwpbf']=_0x1ebd6c);const _0x5610b7=_0x4d67['mnygIM'][_0x7e7ce2];return _0x5610b7===undefined?(_0x4d67f1=_0x4d67['FmVdCI'](_0x4d67f1),_0x4d67['mnygIM'][_0x7e7ce2]=_0x4d67f1):_0x4d67f1=_0x5610b7,_0x4d67f1;}export{createKtFsStores};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';function _0x58b5(_0xdf1ae9,_0x1a24fa){_0xdf1ae9=_0xdf1ae9-0x10c;const _0x42f141=_0x42f1();let _0x58b5a0=_0x42f141[_0xdf1ae9];if(_0x58b5['jKpUKc']===undefined){var _0x3fe5a=function(_0x13d9b4){const _0x9ebf5f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3aa0ca='',_0x59d871='';for(let _0x2525de=0x0,_0xf939d9,_0x4ec41f,_0x4d18c7=0x0;_0x4ec41f=_0x13d9b4['charAt'](_0x4d18c7++);~_0x4ec41f&&(_0xf939d9=_0x2525de%0x4?_0xf939d9*0x40+_0x4ec41f:_0x4ec41f,_0x2525de++%0x4)?_0x3aa0ca+=String['fromCharCode'](0xff&_0xf939d9>>(-0x2*_0x2525de&0x6)):0x0){_0x4ec41f=_0x9ebf5f['indexOf'](_0x4ec41f);}for(let _0x29ac6d=0x0,_0x2ec30c=_0x3aa0ca['length'];_0x29ac6d<_0x2ec30c;_0x29ac6d++){_0x59d871+='%'+('00'+_0x3aa0ca['charCodeAt'](_0x29ac6d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x59d871);};_0x58b5['yUhVAK']=_0x3fe5a,_0x58b5['hulVWp']={},_0x58b5['jKpUKc']=!![];}const _0x3ae86c=_0x42f141[0x0];_0x58b5['SmKCFo']!==_0x3ae86c&&(_0x58b5['hulVWp']={},_0x58b5['SmKCFo']=_0x3ae86c);const _0xc50328=_0x58b5['hulVWp'][_0xdf1ae9];return _0xc50328===undefined?(_0x58b5a0=_0x58b5['yUhVAK'](_0x58b5a0),_0x58b5['hulVWp'][_0xdf1ae9]=_0x58b5a0):_0x58b5a0=_0xc50328,_0x58b5a0;}const _0xf44a7a=_0x58b5;(function(_0x4d5838,_0x1bf36d){const _0x3422cc=_0x58b5,_0x50df5f=_0x4d5838();while(!![]){try{const _0x5a6381=-parseInt(_0x3422cc(0x137))/0x1*(parseInt(_0x3422cc(0x127))/0x2)+-parseInt(_0x3422cc(0x130))/0x3*(parseInt(_0x3422cc(0x144))/0x4)+-parseInt(_0x3422cc(0x12d))/0x5+parseInt(_0x3422cc(0x114))/0x6+-parseInt(_0x3422cc(0x10d))/0x7*(parseInt(_0x3422cc(0x140))/0x8)+parseInt(_0x3422cc(0x12e))/0x9+-parseInt(_0x3422cc(0x13f))/0xa*(-parseInt(_0x3422cc(0x11f))/0xb);if(_0x5a6381===_0x1bf36d)break;else _0x50df5f['push'](_0x50df5f['shift']());}catch(_0x3928ac){_0x50df5f['push'](_0x50df5f['shift']());}}}(_0x42f1,0x7ddeb));var store=require(_0xf44a7a(0x131));async function pathParts(_0x59d871,_0x2525de){const _0xdef86b=_0xf44a7a,_0xf939d9=_0x59d871[_0xdef86b(0x12c)]?await _0x59d871['params']:void 0x0;if(_0xf939d9?.[_0xdef86b(0x11a)]?.['length'])return _0xf939d9['path'];const _0x4ec41f=_0x2525de['pathname'][_0xdef86b(0x117)](_0xdef86b(0x116)),_0x4d18c7=_0x4ec41f>=0x0?_0x2525de['pathname'][_0xdef86b(0x129)](_0x4ec41f+'/api/kt'[_0xdef86b(0x143)]):_0x2525de[_0xdef86b(0x121)];return _0x4d18c7['split']('/')[_0xdef86b(0x139)](Boolean);}function json(_0x29ac6d,_0x2ec30c=0xc8){const _0x381f4f=_0xf44a7a;return new Response(JSON[_0x381f4f(0x141)](_0x29ac6d),{'status':_0x2ec30c,'headers':{'content-type':_0x381f4f(0x12b)}});}function fail(_0x3c9f05){const _0x1898eb=_0xf44a7a;if(_0x3c9f05 instanceof store[_0x1898eb(0x10c)])return json({'message':_0x3c9f05[_0x1898eb(0x13b)],'current':_0x3c9f05[_0x1898eb(0x11d)]},0x199);if(_0x3c9f05 instanceof store[_0x1898eb(0x142)])return json({'message':_0x3c9f05[_0x1898eb(0x13b)]},0x194);if(_0x3c9f05 instanceof store['KtStoreError'])return json({'message':_0x3c9f05[_0x1898eb(0x13b)]},_0x3c9f05['status']??0x1f4);return json({'message':_0x3c9f05 instanceof Error?_0x3c9f05[_0x1898eb(0x13b)]:'\u5185\u90E8\u9519\u8BEF'},0x1f4);}async function readBody(_0x3c5ffb){const _0x73098f=_0xf44a7a,_0x4f3822=await _0x3c5ffb[_0x73098f(0x133)]();if(!_0x4f3822)return null;return JSON[_0x73098f(0x13d)](_0x4f3822);}function createKtHandler(_0x59ecd2){const _0x26c66c=async(_0x59ea1b,_0x5d3e9e={})=>{const _0x3dc0b7=_0x58b5;try{const _0x33153f=new URL(_0x59ea1b[_0x3dc0b7(0x112)]),_0x332eb4=await pathParts(_0x5d3e9e,_0x33153f),[_0x1eced2,_0x2f6851,_0x1ce4fd]=_0x332eb4,_0x3e90c6=_0x59ea1b['method'][_0x3dc0b7(0x132)]();if(_0x1eced2===_0x3dc0b7(0x115)&&!_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x138)){const _0x9976dd=_0x33153f[_0x3dc0b7(0x134)][_0x3dc0b7(0x13e)](_0x3dc0b7(0x124));return json({'items':await _0x59ecd2[_0x3dc0b7(0x115)]['list'](_0x9976dd||void 0x0)});}if(_0x1eced2===_0x3dc0b7(0x115)&&!_0x2f6851&&_0x3e90c6==='POST'){if(!_0x59ecd2[_0x3dc0b7(0x115)][_0x3dc0b7(0x123)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x59ecd2[_0x3dc0b7(0x115)][_0x3dc0b7(0x123)](await readBody(_0x59ea1b)));}if(_0x1eced2==='artifacts'&&_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x138))return json(await _0x59ecd2[_0x3dc0b7(0x115)][_0x3dc0b7(0x13e)](_0x2f6851));if(_0x1eced2===_0x3dc0b7(0x115)&&_0x2f6851&&_0x3e90c6==='PUT')return json(await _0x59ecd2['artifacts']['save'](await readBody(_0x59ea1b)));if(_0x1eced2===_0x3dc0b7(0x115)&&_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x125)){if(!_0x59ecd2['artifacts'][_0x3dc0b7(0x119)])return json({'message':_0x3dc0b7(0x135)},0x194);return await _0x59ecd2[_0x3dc0b7(0x115)][_0x3dc0b7(0x119)](_0x2f6851),json({'ok':!![]});}if(_0x1eced2===_0x3dc0b7(0x126)){if(!_0x59ecd2[_0x3dc0b7(0x126)])return json({'message':_0x3dc0b7(0x122)},0x194);if(!_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x138))return json({'items':await _0x59ecd2['instances'][_0x3dc0b7(0x120)]?.(_0x33153f[_0x3dc0b7(0x134)][_0x3dc0b7(0x13e)](_0x3dc0b7(0x128))??void 0x0)??[]});if(!_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x12a)){if(!_0x59ecd2[_0x3dc0b7(0x126)][_0x3dc0b7(0x123)])return json({'message':_0x3dc0b7(0x10e)},0x194);return json(await _0x59ecd2['instances'][_0x3dc0b7(0x123)](await readBody(_0x59ea1b)));}if(_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x138))return json(await _0x59ecd2['instances'][_0x3dc0b7(0x13e)](_0x2f6851));if(_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x136))return await _0x59ecd2[_0x3dc0b7(0x126)][_0x3dc0b7(0x118)](_0x2f6851,await readBody(_0x59ea1b)),json({'ok':!![]});}if(_0x1eced2==='versions'){if(!_0x59ecd2[_0x3dc0b7(0x110)])return json({'message':_0x3dc0b7(0x11e)},0x194);if(!_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x138)){const _0x5b986e=_0x33153f['searchParams'][_0x3dc0b7(0x13e)](_0x3dc0b7(0x124))??'',_0x385aa3=_0x33153f[_0x3dc0b7(0x134)][_0x3dc0b7(0x13e)]('id')??'';return json(await _0x59ecd2[_0x3dc0b7(0x110)][_0x3dc0b7(0x11b)](_0x5b986e,_0x385aa3));}if(!_0x2f6851&&_0x3e90c6===_0x3dc0b7(0x12a))return json(await _0x59ecd2[_0x3dc0b7(0x110)]['commit'](await readBody(_0x59ea1b)));if(_0x2f6851&&_0x1ce4fd===_0x3dc0b7(0x13c)&&_0x3e90c6===_0x3dc0b7(0x138)){const _0x2656f2=await _0x59ecd2[_0x3dc0b7(0x110)][_0x3dc0b7(0x113)](_0x2f6851,_0x33153f[_0x3dc0b7(0x134)][_0x3dc0b7(0x13e)]('path')??'');return new Response(Buffer[_0x3dc0b7(0x13a)](_0x2656f2),{'headers':{'content-type':'application/octet-stream'}});}if(_0x2f6851&&_0x1ce4fd===_0x3dc0b7(0x11c)&&_0x3e90c6==='POST'){const _0x809a17=await readBody(_0x59ea1b);return json(await _0x59ecd2['versions'][_0x3dc0b7(0x11c)](_0x809a17[_0x3dc0b7(0x124)],_0x809a17['id'],_0x2f6851,_0x809a17['by']));}if(_0x2f6851&&!_0x1ce4fd&&_0x3e90c6===_0x3dc0b7(0x138))return json(await _0x59ecd2['versions'][_0x3dc0b7(0x13e)](_0x2f6851));}return json({'message':_0x3dc0b7(0x111)},0x194);}catch(_0x44b637){return fail(_0x44b637);}};return{'GET':_0x26c66c,'POST':_0x26c66c,'PUT':_0x26c66c,'DELETE':_0x26c66c};}function defineKtConfig(_0x52c67f){return _0x52c67f;}exports[_0xf44a7a(0x12f)]=createKtHandler,exports[_0xf44a7a(0x10f)]=defineKtConfig;function _0x42f1(){const _0x1c5c65=['mtu3oda4tvPrCvz6','y3jLyxrLioACQUwUNUEoSa','zgvMAw5Ls3rdB25MAwC','DMvYC2LVBNm','5PYQ5OM+5yIW','DxjS','CMvHzezPBgu','nta5ota4mMnvBMfMyq','yxj0AwzHy3rZ','l2fWAs9RDa','Aw5KzxHpzG','C2f2zq','CMvTB3zL','Cgf0Aa','Bg9N','CMvZDg9Yzq','y3vYCMvUDa','DMvYC2LVBNmG5PYQ6ywn572U','mtu2odiZnZbergfAthO','BgLZDa','Cgf0Ag5HBwu','Aw5ZDgfUy2vZioACQUMfJEE9RG','y3jLyxrL','A2LUza','revmrvrf','Aw5ZDgfUy2vZ','otG2nta4Auvntgjy','yxj0AwzHy3rjza','C2XPy2u','ue9tva','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','CgfYyw1Z','ndGYnti5mgDbtgLywq','ndm2nJCXowjMzw5TwG','y3jLyxrLs3riyw5KBgvY','mJC5mdyYn0LHDKHqyq','qgSTDgfIBguVCMvWB3j0l3n0B3jL','Dg9vChbLCKnHC2u','Dgv4Da','C2vHCMnOugfYyw1Z','CMvTB3zLioACQUwUNUEoSa','ufvu','mLnsrfPXsW','r0vu','zMLSDgvY','zNjVBq','BwvZC2fNzq','zMLSzq','CgfYC2u','z2v0','mJb6BfHkuum','mJGWyNbyBNr1','C3rYAw5NAwz5','s3roB3rgB3vUzevYCM9Y','BgvUz3rO','nfrsyMvgBa','s3rdB25MBgLJDevYCM9Y'];_0x42f1=function(){return _0x1c5c65;};return _0x42f1();}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41f4ab,_0x1feb34){const _0x30bb11=_0x2008,_0x5ba136=_0x41f4ab();while(!![]){try{const _0x439b73=parseInt(_0x30bb11(0x1b1))/0x1*(-parseInt(_0x30bb11(0x185))/0x2)+-parseInt(_0x30bb11(0x18a))/0x3+parseInt(_0x30bb11(0x189))/0x4+-parseInt(_0x30bb11(0x188))/0x5*(parseInt(_0x30bb11(0x19c))/0x6)+-parseInt(_0x30bb11(0x1b8))/0x7*(parseInt(_0x30bb11(0x1a5))/0x8)+parseInt(_0x30bb11(0x1a8))/0x9*(-parseInt(_0x30bb11(0x19e))/0xa)+parseInt(_0x30bb11(0x1b0))/0xb*(parseInt(_0x30bb11(0x187))/0xc);if(_0x439b73===_0x1feb34)break;else _0x5ba136['push'](_0x5ba136['shift']());}catch(_0x114c2d){_0x5ba136['push'](_0x5ba136['shift']());}}}(_0x28c7,0x7d25e));import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x504a80,_0x4c5eff){const _0x12372e=_0x2008,_0xcdeebd=_0x504a80[_0x12372e(0x191)]?await _0x504a80[_0x12372e(0x191)]:void 0x0;if(_0xcdeebd?.[_0x12372e(0x1a0)]?.[_0x12372e(0x196)])return _0xcdeebd[_0x12372e(0x1a0)];const _0x3ece77=_0x4c5eff[_0x12372e(0x1b7)][_0x12372e(0x19b)](_0x12372e(0x1b2)),_0x19586b=_0x3ece77>=0x0?_0x4c5eff[_0x12372e(0x1b7)][_0x12372e(0x1a3)](_0x3ece77+_0x12372e(0x1b2)[_0x12372e(0x196)]):_0x4c5eff[_0x12372e(0x1b7)];return _0x19586b[_0x12372e(0x181)]('/')['filter'](Boolean);}function json(_0x1d9675,_0x5dbb1f=0xc8){const _0x3ce9b4=_0x2008;return new Response(JSON[_0x3ce9b4(0x1a6)](_0x1d9675),{'status':_0x5dbb1f,'headers':{'content-type':_0x3ce9b4(0x1b3)}});}function fail(_0x1d469e){const _0x3a5425=_0x2008;if(_0x1d469e instanceof KtConflictError)return json({'message':_0x1d469e['message'],'current':_0x1d469e[_0x3a5425(0x198)]},0x199);if(_0x1d469e instanceof KtNotFoundError)return json({'message':_0x1d469e[_0x3a5425(0x18f)]},0x194);if(_0x1d469e instanceof KtStoreError)return json({'message':_0x1d469e['message']},_0x1d469e[_0x3a5425(0x1a1)]??0x1f4);return json({'message':_0x1d469e instanceof Error?_0x1d469e[_0x3a5425(0x18f)]:_0x3a5425(0x19d)},0x1f4);}function _0x2008(_0x4ff9ef,_0x3c0834){_0x4ff9ef=_0x4ff9ef-0x181;const _0x28c758=_0x28c7();let _0x200881=_0x28c758[_0x4ff9ef];if(_0x2008['RpIIXC']===undefined){var _0x529b26=function(_0x13b5d4){const _0x9eb94f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3acc41='',_0x504a80='';for(let _0x4c5eff=0x0,_0xcdeebd,_0x3ece77,_0x19586b=0x0;_0x3ece77=_0x13b5d4['charAt'](_0x19586b++);~_0x3ece77&&(_0xcdeebd=_0x4c5eff%0x4?_0xcdeebd*0x40+_0x3ece77:_0x3ece77,_0x4c5eff++%0x4)?_0x3acc41+=String['fromCharCode'](0xff&_0xcdeebd>>(-0x2*_0x4c5eff&0x6)):0x0){_0x3ece77=_0x9eb94f['indexOf'](_0x3ece77);}for(let _0x1d9675=0x0,_0x5dbb1f=_0x3acc41['length'];_0x1d9675<_0x5dbb1f;_0x1d9675++){_0x504a80+='%'+('00'+_0x3acc41['charCodeAt'](_0x1d9675)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x504a80);};_0x2008['tGENwf']=_0x529b26,_0x2008['RZazqL']={},_0x2008['RpIIXC']=!![];}const _0x2f0576=_0x28c758[0x0];_0x2008['RrtlRE']!==_0x2f0576&&(_0x2008['RZazqL']={},_0x2008['RrtlRE']=_0x2f0576);const _0x16784b=_0x2008['RZazqL'][_0x4ff9ef];return _0x16784b===undefined?(_0x200881=_0x2008['tGENwf'](_0x200881),_0x2008['RZazqL'][_0x4ff9ef]=_0x200881):_0x200881=_0x16784b,_0x200881;}async function readBody(_0x3fc229){const _0x1ec14a=_0x2008,_0x231b14=await _0x3fc229[_0x1ec14a(0x186)]();if(!_0x231b14)return null;return JSON[_0x1ec14a(0x199)](_0x231b14);}function _0x28c7(){const _0x3a46f7=['Cgf0Aa','C3rHDhvZ','y3jLyxrL','C2XPy2u','revmrvrf','ntm2EufeDer0','C3rYAw5NAwz5','A2LUza','mte3CgTfrMXf','Bwv0Ag9K','CMvTB3zLioACQUwUNUEoSa','BgLZDa','zNjVBq','C2vHCMnOugfYyw1Z','Aw5ZDgfUy2vZ','z2v0','mJjZu0DsA0i','mMLuDuHNsW','l2fWAs9RDa','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','CMvHzezPBgu','ufvu','C2f2zq','Cgf0Ag5HBwu','ntG5odjjDgTcvLu','C3bSAxq','yxj0AwzHy3rZ','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','CMvZDg9Yzq','odiWmtG2B3P1wwnX','Dgv4Da','mtGXmJiWnJryweDqqu0','mtGXnJqXmfjwtLzpCG','mti3otaYng9UrKrVzW','mtq0nJuXoxnfvxbrAa','Bg9N','DxjS','yxj0AwzHy3rjza','r0vu','BwvZC2fNzq','Aw5ZDgfUy2vZioACQUMfJEE9RG','CgfYyw1Z','DMvYC2LVBNm','DMvYC2LVBNmG5PYQ6ywn572U','ue9tva','y3jLyxrLioACQUwUNUEoSa','BgvUz3rO','Dg9vChbLCKnHC2u','y3vYCMvUDa','CgfYC2u','CMvTB3zL','Aw5KzxHpzG','nMDks1fysG','5yAf6yoO6zsz6k+V','ndu5ndCWBg50rw1e','5PYQ5OM+5yIW'];_0x28c7=function(){return _0x3a46f7;};return _0x28c7();}function createKtHandler(_0x5f4c90){const _0x23d1cd=async(_0x1cd5b5,_0x10bd51={})=>{const _0x159292=_0x2008;try{const _0x13000f=new URL(_0x1cd5b5[_0x159292(0x18c)]),_0x319c34=await pathParts(_0x10bd51,_0x13000f),[_0x39bb75,_0x5b3ff3,_0x494044]=_0x319c34,_0x4dbd23=_0x1cd5b5[_0x159292(0x1a9)][_0x159292(0x197)]();if(_0x39bb75===_0x159292(0x182)&&!_0x5b3ff3&&_0x4dbd23==='GET'){const _0x2fb093=_0x13000f[_0x159292(0x1ad)][_0x159292(0x1af)]('kind');return json({'items':await _0x5f4c90['artifacts'][_0x159292(0x1ab)](_0x2fb093||void 0x0)});}if(_0x39bb75===_0x159292(0x182)&&!_0x5b3ff3&&_0x4dbd23===_0x159292(0x194)){if(!_0x5f4c90[_0x159292(0x182)]['create'])return json({'message':_0x159292(0x195)},0x194);return json(await _0x5f4c90[_0x159292(0x182)][_0x159292(0x1a2)](await readBody(_0x1cd5b5)));}if(_0x39bb75==='artifacts'&&_0x5b3ff3&&_0x4dbd23===_0x159292(0x18e))return json(await _0x5f4c90['artifacts'][_0x159292(0x1af)](_0x5b3ff3));if(_0x39bb75===_0x159292(0x182)&&_0x5b3ff3&&_0x4dbd23===_0x159292(0x1b5))return json(await _0x5f4c90[_0x159292(0x182)]['save'](await readBody(_0x1cd5b5)));if(_0x39bb75===_0x159292(0x182)&&_0x5b3ff3&&_0x4dbd23===_0x159292(0x1a4)){if(!_0x5f4c90[_0x159292(0x182)][_0x159292(0x19a)])return json({'message':_0x159292(0x1aa)},0x194);return await _0x5f4c90['artifacts'][_0x159292(0x19a)](_0x5b3ff3),json({'ok':!![]});}if(_0x39bb75===_0x159292(0x1ae)){if(!_0x5f4c90[_0x159292(0x1ae)])return json({'message':_0x159292(0x190)},0x194);if(!_0x5b3ff3&&_0x4dbd23===_0x159292(0x18e))return json({'items':await _0x5f4c90[_0x159292(0x1ae)][_0x159292(0x1ab)]?.(_0x13000f[_0x159292(0x1ad)][_0x159292(0x1af)](_0x159292(0x18d))??void 0x0)??[]});if(!_0x5b3ff3&&_0x4dbd23==='POST'){if(!_0x5f4c90['instances'][_0x159292(0x1a2)])return json({'message':_0x159292(0x195)},0x194);return json(await _0x5f4c90[_0x159292(0x1ae)][_0x159292(0x1a2)](await readBody(_0x1cd5b5)));}if(_0x5b3ff3&&_0x4dbd23===_0x159292(0x18e))return json(await _0x5f4c90['instances']['get'](_0x5b3ff3));if(_0x5b3ff3&&_0x4dbd23==='PUT')return await _0x5f4c90[_0x159292(0x1ae)][_0x159292(0x1b6)](_0x5b3ff3,await readBody(_0x1cd5b5)),json({'ok':!![]});}if(_0x39bb75===_0x159292(0x192)){if(!_0x5f4c90[_0x159292(0x192)])return json({'message':_0x159292(0x193)},0x194);if(!_0x5b3ff3&&_0x4dbd23==='GET'){const _0x3ba3e5=_0x13000f['searchParams'][_0x159292(0x1af)](_0x159292(0x1a7))??'',_0x4436d9=_0x13000f[_0x159292(0x1ad)][_0x159292(0x1af)]('id')??'';return json(await _0x5f4c90[_0x159292(0x192)][_0x159292(0x18b)](_0x3ba3e5,_0x4436d9));}if(!_0x5b3ff3&&_0x4dbd23===_0x159292(0x194))return json(await _0x5f4c90['versions']['commit'](await readBody(_0x1cd5b5)));if(_0x5b3ff3&&_0x494044==='file'&&_0x4dbd23===_0x159292(0x18e)){const _0x29b476=await _0x5f4c90[_0x159292(0x192)][_0x159292(0x1b4)](_0x5b3ff3,_0x13000f[_0x159292(0x1ad)]['get'](_0x159292(0x1a0))??'');return new Response(Buffer[_0x159292(0x1ac)](_0x29b476),{'headers':{'content-type':_0x159292(0x183)}});}if(_0x5b3ff3&&_0x494044===_0x159292(0x184)&&_0x4dbd23===_0x159292(0x194)){const _0x352bc5=await readBody(_0x1cd5b5);return json(await _0x5f4c90[_0x159292(0x192)][_0x159292(0x184)](_0x352bc5[_0x159292(0x1a7)],_0x352bc5['id'],_0x5b3ff3,_0x352bc5['by']));}if(_0x5b3ff3&&!_0x494044&&_0x4dbd23===_0x159292(0x18e))return json(await _0x5f4c90[_0x159292(0x192)]['get'](_0x5b3ff3));}return json({'message':_0x159292(0x19f)},0x194);}catch(_0x57d5fd){return fail(_0x57d5fd);}};return{'GET':_0x23d1cd,'POST':_0x23d1cd,'PUT':_0x23d1cd,'DELETE':_0x23d1cd};}function defineKtConfig(_0x5f39a7){return _0x5f39a7;}export{createKtHandler,defineKtConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-table/next",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"publishConfig": { "access": "public" },
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "KT Next 适配:/api/kt 默认 handler 与 fs 存储(无鉴权)",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@k-table/report": "^1.0.
|
|
30
|
+
"@k-table/report": "^1.0.21"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"next": ">=15"
|