@k-table/next 1.0.24 → 1.0.26
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 _0x29eca2=_0x4342;(function(_0xb356c3,_0x492faf){const _0x1ac2e3=_0x4342,_0x339611=_0xb356c3();while(!![]){try{const _0x5d53a2=parseInt(_0x1ac2e3(0xc4))/0x1+parseInt(_0x1ac2e3(0xd8))/0x2*(parseInt(_0x1ac2e3(0xd5))/0x3)+parseInt(_0x1ac2e3(0xee))/0x4+parseInt(_0x1ac2e3(0xa4))/0x5*(parseInt(_0x1ac2e3(0xfd))/0x6)+-parseInt(_0x1ac2e3(0xa8))/0x7*(parseInt(_0x1ac2e3(0xde))/0x8)+parseInt(_0x1ac2e3(0xf3))/0x9+-parseInt(_0x1ac2e3(0xb4))/0xa*(parseInt(_0x1ac2e3(0xbc))/0xb);if(_0x5d53a2===_0x492faf)break;else _0x339611['push'](_0x339611['shift']());}catch(_0x511b43){_0x339611['push'](_0x339611['shift']());}}}(_0x26db,0xad0f1));var fs=require('fs'),path=require(_0x29eca2(0xda)),store=require('@k-table/report/store'),crypto=require('crypto');function resolveRoot(_0x375694,_0x4c68f2=process[_0x29eca2(0xc7)]()){const _0x1573d9=_0x29eca2,_0x3b7ccd=path[_0x1573d9(0xf9)](_0x375694)?_0x375694:path[_0x1573d9(0xc5)](_0x4c68f2,_0x375694);return fs[_0x1573d9(0xbf)](_0x3b7ccd,{'recursive':!![]}),_0x3b7ccd;}function artifactDir(_0x5047ca,_0xd0e1db){const _0x489ad1=_0x29eca2;return path[_0x489ad1(0xc9)](_0x5047ca,_0xd0e1db);}function objectPath(_0x4b7b1c,_0x4a1fa7){const _0x2bd9d3=_0x29eca2;return path[_0x2bd9d3(0xc9)](_0x4b7b1c,'objects',_0x4a1fa7[_0x2bd9d3(0xb1)](0x0,0x2),_0x4a1fa7);}function itemDir(_0x146830,_0x19ba0b,_0x182048){const _0x503d8c=_0x29eca2;return path[_0x503d8c(0xc9)](_0x146830,_0x503d8c(0xf7),_0x19ba0b,_0x182048);}function newEtag(){const _0x4fda50=_0x29eca2;return Date[_0x4fda50(0xf8)]()[_0x4fda50(0xd4)](0x24)+'-'+Math['random']()['toString'](0x24)[_0x4fda50(0xb1)](0x2,0x8);}function _0x26db(){const _0x3845db=['C3rYAw5N','A2v5CW','qvjusuzbq1rFrKLmrv9nrvrb','zMLSzxnuB0fYDgLMywn0','zMLUza','CM1tEw5J','s3roB3rgB3vUzevYCM9Y','lMPZB24','CMv2','zw5KC1DPDgG','C29YDa','zw50CMLLCW','qvjusuzbq1rFrKLmrv9srvbpuLq','DMvYC2LVBNnsB290','ndiWmZGWoePctKLSBG','C2vLza','C2HHmJu2','zgvJB2rL','Bwv0yq','ndi0nde3nu9QBLDfza','qvjusuzbq1rFrKLmrv9ct0rz','DMfSDwvZ','z2v0twLUDxrLCW','AxrLBxm','BM93','AxnbyNnVBhv0zq','C3rYAw5NAwz5','DxrMoa','AxneAxjLy3rVCNK','nZK4nNHYzM52AW','mtu4mgjJCvjQsq','zNjVBq','yxj0AwzHy3qG','lwXVy2fSlq','mJeZnZfLvgTqtLC','CMvHzgrPCLn5BMm','zgLNzxn0','qvjusuzbq1rFrKLmrv9gsuXm','DxbKyxrL','zxrHzW','yxj0AwzHy3rjza','z2v0','A2LUza','C2XPy2u','C2f2zq','z2v0sg91CNm','mtbtEePXqw0','y3jLyxrLsgfZAa','zMLSzxnfCxvHBa','CMv2ia','zgLYBMfTzq','Dg9ju09tDhjPBMC','C2vLzeLUC3rHBMnLCW','sevbra','mtGZodq3nZnpq2PNBwi','z2v0rgf0zq','Aw5ZDgfUy2vZuM9VDa','BwTKAxjtEw5J','BwfW','yxj0AwzHy3rZuM9VDa','DgfIq29TBw9U','D3jPDgvgAwXLu3LUyW','odmWmZeWtM9ovwPh','CMvZB2X2zq','DhjPBq','y3DK','y3jLyxrLs3rgC1n0B3jLCW','AM9PBG','CMfUzg9T','CgfYC2u','Bg9NlMPZB24','zMLSzxm','z2v0tw9UDgG','lMv0ywC','zMLSDgvY','y29TBw9U','zMfJzxm','s3rdB25MBgLJDevYCM9Y','Dg9tDhjPBMC','mtC0z2TLBwPe','CgfKu3rHCNq','z2v0rNvSBfLLyxi','mJqYmZrmBe9HEu0','AgvHza','Cgf0Aa','BMfTzq','zxHPC3rZu3LUyW','ru1qvfLFs1rm','mJG3mKXlAeH0sa','CMvHzezPBgvtEw5J'];_0x26db=function(){return _0x3845db;};return _0x26db();}function readEtag(_0xb05ca0){const _0x2f7efd=_0x29eca2,_0x50cfca=path['join'](_0xb05ca0,'.etag');return fs[_0x2f7efd(0xdc)](_0x50cfca)?fs[_0x2f7efd(0xdf)](_0x50cfca,'utf8')['trim']():void 0x0;}function writeArtifactDir(_0xcbc695,_0x12993d,_0x2bd372){const _0x1b0661=_0x29eca2;fs[_0x1b0661(0xbf)](path['join'](_0xcbc695,_0x1b0661(0xd2)),{'recursive':!![]});const _0x25b3a4=store['artifactToFiles'](_0x12993d);fs[_0x1b0661(0xc3)](path['join'](_0xcbc695,store['ARTIFACT_FILE_META']),_0x25b3a4[store[_0x1b0661(0xe2)]]??'{}',_0x1b0661(0xfb)),fs[_0x1b0661(0xc3)](path[_0x1b0661(0xc9)](_0xcbc695,store[_0x1b0661(0xf4)]),_0x25b3a4[store[_0x1b0661(0xf4)]]??'','utf8');const _0x4d4116=path[_0x1b0661(0xc9)](_0xcbc695,store[_0x1b0661(0xab)]),_0x22fee6=path['join'](_0xcbc695,store[_0x1b0661(0xec)]);if(_0x25b3a4[store[_0x1b0661(0xab)]])fs[_0x1b0661(0xc3)](_0x4d4116,_0x25b3a4[store[_0x1b0661(0xab)]],_0x1b0661(0xfb));else{if(fs[_0x1b0661(0xdc)](_0x4d4116))fs['rmSync'](_0x4d4116);}if(_0x25b3a4[store[_0x1b0661(0xec)]])fs[_0x1b0661(0xc3)](_0x22fee6,_0x25b3a4[store[_0x1b0661(0xec)]],_0x1b0661(0xfb));else{if(fs[_0x1b0661(0xdc)](_0x22fee6))fs[_0x1b0661(0xe5)](_0x22fee6);}fs[_0x1b0661(0xc3)](path['join'](_0xcbc695,_0x1b0661(0xcf)),_0x2bd372,_0x1b0661(0xfb));}function readArtifactDir(_0x3befa9,_0x5a7c24){const _0x1ce8b5=_0x29eca2,_0x2e8727={},_0xb7b8ac=path[_0x1ce8b5(0xc9)](_0x3befa9,store[_0x1ce8b5(0xe2)]),_0x4e6b7b=path[_0x1ce8b5(0xc9)](_0x3befa9,store[_0x1ce8b5(0xf4)]);if(fs[_0x1ce8b5(0xdc)](_0xb7b8ac))_0x2e8727[store[_0x1ce8b5(0xe2)]]=fs[_0x1ce8b5(0xdf)](_0xb7b8ac,_0x1ce8b5(0xfb));if(fs[_0x1ce8b5(0xdc)](_0x4e6b7b))_0x2e8727[store[_0x1ce8b5(0xf4)]]=fs[_0x1ce8b5(0xdf)](_0x4e6b7b,'utf8');const _0x5d4833=path[_0x1ce8b5(0xc9)](_0x3befa9,store[_0x1ce8b5(0xab)]),_0xa0ab5b=path[_0x1ce8b5(0xc9)](_0x3befa9,store[_0x1ce8b5(0xec)]);if(fs[_0x1ce8b5(0xdc)](_0x5d4833))_0x2e8727[store[_0x1ce8b5(0xab)]]=fs['readFileSync'](_0x5d4833,_0x1ce8b5(0xfb));if(fs[_0x1ce8b5(0xdc)](_0xa0ab5b))_0x2e8727[store[_0x1ce8b5(0xec)]]=fs[_0x1ce8b5(0xdf)](_0xa0ab5b,_0x1ce8b5(0xfb));return{...store['filesToArtifact'](_0x2e8727,_0x5a7c24),'etag':readEtag(_0x3befa9)};}function createFsArtifactStore(_0x1fd4a1,_0x57b18c=[]){const _0x1ff1cc=_0x29eca2;fs[_0x1ff1cc(0xbf)](_0x1fd4a1,{'recursive':!![]});for(const _0x56b1e3 of _0x57b18c){const _0x807f12=artifactDir(_0x1fd4a1,_0x56b1e3['id']),_0x54875c=path['join'](_0x807f12,store[_0x1ff1cc(0xf4)]);if(!fs['existsSync'](_0x54875c))writeArtifactDir(_0x807f12,_0x56b1e3,_0x56b1e3['etag']??newEtag());}return{async 'list'(_0x499460){const _0x3a57a8=_0x1ff1cc;if(!fs[_0x3a57a8(0xdc)](_0x1fd4a1))return[];const _0x2fa5ed=[];for(const _0x23c15f of fs[_0x3a57a8(0xa9)](_0x1fd4a1,{'withFileTypes':!![]})){if(!_0x23c15f[_0x3a57a8(0xfc)]())continue;try{const _0x1c0327=readArtifactDir(artifactDir(_0x1fd4a1,_0x23c15f[_0x3a57a8(0xdb)]),_0x23c15f[_0x3a57a8(0xdb)]);if(!_0x499460||_0x1c0327[_0x3a57a8(0xb0)]===_0x499460)_0x2fa5ed['push']({'id':_0x1c0327['id'],'name':_0x1c0327[_0x3a57a8(0xdb)],'kind':_0x1c0327[_0x3a57a8(0xb0)]});}catch{}}return _0x2fa5ed;},async 'get'(_0x29fd56){const _0x53f5f6=_0x1ff1cc,_0x3d234b=artifactDir(_0x1fd4a1,_0x29fd56);if(!fs[_0x53f5f6(0xdc)](_0x3d234b))throw new store[(_0x53f5f6(0xe6))](_0x53f5f6(0xa6)+_0x29fd56);return readArtifactDir(_0x3d234b,_0x29fd56);},async 'save'(_0x30e218){const _0x4f0793=_0x1ff1cc,_0x5c700a=artifactDir(_0x1fd4a1,_0x30e218['id']),_0x52f400=fs[_0x4f0793(0xdc)](_0x5c700a)?readArtifactDir(_0x5c700a,_0x30e218['id']):void 0x0;if(_0x30e218['etag']&&_0x52f400?.[_0x4f0793(0xad)]&&_0x30e218[_0x4f0793(0xad)]!==_0x52f400[_0x4f0793(0xad)])throw new store[(_0x4f0793(0xd3))]('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x52f400);const _0x4d2c44=newEtag();return writeArtifactDir(_0x5c700a,_0x30e218,_0x4d2c44),{..._0x30e218,'etag':_0x4d2c44};},async 'create'(_0x33937e){const _0x43dd77=_0x1ff1cc,_0x1efddd=_0x33937e['kind']+'-'+Math['random']()[_0x43dd77(0xd4)](0x24)[_0x43dd77(0xb1)](0x2,0xa),_0x5b7e5c={'id':_0x1efddd,'name':_0x33937e[_0x43dd77(0xdb)],'kind':_0x33937e['kind'],'ktl':store[_0x43dd77(0xdd)]};return this[_0x43dd77(0xb2)](_0x5b7e5c);},async 'remove'(_0x304839){const _0x18ce29=_0x1ff1cc,_0x356306=artifactDir(_0x1fd4a1,_0x304839);if(!fs[_0x18ce29(0xdc)](_0x356306))throw new store[(_0x18ce29(0xe6))]('artifact\x20'+_0x304839);fs[_0x18ce29(0xe5)](_0x356306,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0xdbd62a,_0x156faf={}){const _0x2abe1f=_0x29eca2;fs[_0x2abe1f(0xbf)](_0xdbd62a,{'recursive':!![]});const _0x2c65c8=_0x1f4070=>path[_0x2abe1f(0xc9)](_0xdbd62a,_0x1f4070+_0x2abe1f(0xe7));for(const [_0x1d4065,_0x286c08]of Object['entries'](_0x156faf)){if(!fs[_0x2abe1f(0xdc)](_0x2c65c8(_0x1d4065)))fs['writeFileSync'](_0x2c65c8(_0x1d4065),JSON[_0x2abe1f(0xfa)](_0x286c08,null,0x2),_0x2abe1f(0xfb));}return{async 'get'(_0x597227){const _0x2acaf6=_0x2abe1f,_0x3b24cb=_0x2c65c8(_0x597227);if(!fs[_0x2acaf6(0xdc)](_0x3b24cb))throw new store['KtNotFoundError']('instance\x20'+_0x597227);return JSON[_0x2acaf6(0xcb)](fs[_0x2acaf6(0xdf)](_0x3b24cb,_0x2acaf6(0xfb)));},async 'save'(_0x44aa62,_0x55c54c){const _0x54d750=_0x2abe1f,_0xe6a6f9=_0x2c65c8(_0x44aa62),_0xe1bd0=fs[_0x54d750(0xdc)](_0xe6a6f9)?JSON[_0x54d750(0xcb)](fs[_0x54d750(0xdf)](_0xe6a6f9,'utf8')):{'artifactId':'','values':{}},_0x350d26={'artifactId':_0xe1bd0[_0x54d750(0xae)],'values':{..._0xe1bd0[_0x54d750(0xf5)],..._0x55c54c[_0x54d750(0xf5)]},'common':{..._0xe1bd0[_0x54d750(0xd1)],..._0x55c54c[_0x54d750(0xd1)]},'tabCommon':{..._0xe1bd0[_0x54d750(0xc2)],..._0x55c54c['tabCommon']}};fs['writeFileSync'](_0xe6a6f9,JSON[_0x54d750(0xfa)](_0x350d26,null,0x2),'utf8');},async 'list'(_0x2542bd){const _0x5e73cb=_0x2abe1f;return fs[_0x5e73cb(0xa9)](_0xdbd62a)[_0x5e73cb(0xd0)](_0x37c7da=>_0x37c7da[_0x5e73cb(0xe9)](_0x5e73cb(0xe7)))[_0x5e73cb(0xc0)](_0x421b14=>{const _0x346570=_0x5e73cb,_0x36f4fa=_0x421b14['slice'](0x0,-0x5),_0x3dba23=JSON[_0x346570(0xcb)](fs[_0x346570(0xdf)](path['join'](_0xdbd62a,_0x421b14),_0x346570(0xfb)));return{'id':_0x36f4fa,'artifactId':_0x3dba23[_0x346570(0xae)]};})[_0x5e73cb(0xd0)](_0x478107=>!_0x2542bd||_0x478107[_0x5e73cb(0xae)]===_0x2542bd);},async 'create'(_0x8954a6){const _0x2b9eb5=_0x2abe1f,_0x5abe00='inst-'+Math[_0x2b9eb5(0xca)]()['toString'](0x24)['slice'](0x2,0xa);return fs[_0x2b9eb5(0xc3)](_0x2c65c8(_0x5abe00),JSON[_0x2b9eb5(0xfa)]({'artifactId':_0x8954a6[_0x2b9eb5(0xae)],'values':{},'common':{}},null,0x2),_0x2b9eb5(0xfb)),{'id':_0x5abe00};}};}function sha256Hex(_0x3af263){const _0x50ed82=_0x29eca2,_0xaf8ef7=typeof _0x3af263===_0x50ed82(0xe0)?Buffer['from'](_0x3af263,_0x50ed82(0xfb)):Buffer[_0x50ed82(0xa5)](_0x3af263);return crypto[_0x50ed82(0xb5)](_0x50ed82(0xf0))[_0x50ed82(0xac)](_0xaf8ef7)[_0x50ed82(0xaa)]('hex');}function writeObject(_0x3a0cc9,_0x37c910){const _0x2655e5=_0x29eca2,_0x3943a1=sha256Hex(_0x37c910),_0xe4c2a8=objectPath(_0x3a0cc9,_0x3943a1);fs[_0x2655e5(0xbf)](path[_0x2655e5(0xb8)](_0xe4c2a8),{'recursive':!![]});if(!fs[_0x2655e5(0xdc)](_0xe4c2a8))fs[_0x2655e5(0xc3)](_0xe4c2a8,_0x37c910);return _0x3943a1;}function readLog(_0x3fdaca,_0x2793fd,_0x250343){const _0xfaac6=_0x29eca2,_0x2fd9a5=itemDir(_0x3fdaca,_0x2793fd,_0x250343),_0x463e60=path[_0xfaac6(0xc9)](_0x2fd9a5,_0xfaac6(0xcc)),_0x5d675a=path[_0xfaac6(0xc9)](_0x2fd9a5,'HEAD'),_0x4dffe1=fs['existsSync'](_0x463e60)?JSON[_0xfaac6(0xcb)](fs[_0xfaac6(0xdf)](_0x463e60,_0xfaac6(0xfb))):[],_0x55130f=fs[_0xfaac6(0xdc)](_0x5d675a)?fs[_0xfaac6(0xdf)](_0x5d675a,_0xfaac6(0xfb))[_0xfaac6(0xc6)]():_0x4dffe1['at'](-0x1)?.[_0xfaac6(0xe8)]??null;return{'head':_0x55130f,'items':_0x4dffe1};}function writeLog(_0x2ff6ee,_0x34ba0f,_0x1bd64b,_0x322327,_0x1328af){const _0x40349a=_0x29eca2,_0x36dd3d=itemDir(_0x2ff6ee,_0x34ba0f,_0x1bd64b);fs['mkdirSync'](_0x36dd3d,{'recursive':!![]}),fs['writeFileSync'](path[_0x40349a(0xc9)](_0x36dd3d,'log.json'),JSON[_0x40349a(0xfa)](_0x1328af,null,0x2),'utf8'),fs[_0x40349a(0xc3)](path[_0x40349a(0xc9)](_0x36dd3d,_0x40349a(0xbb)),_0x322327+'\x0a',_0x40349a(0xfb));}function findRev(_0x264146,_0x58c709){const _0x280aaf=_0x29eca2,_0x197a88=path[_0x280aaf(0xc9)](_0x264146,_0x280aaf(0xf7));if(!fs['existsSync'](_0x197a88))return void 0x0;for(const _0x30a846 of fs[_0x280aaf(0xa9)](_0x197a88,{'withFileTypes':!![]})){if(!_0x30a846[_0x280aaf(0xfc)]())continue;for(const _0x43c8f1 of fs['readdirSync'](path[_0x280aaf(0xc9)](_0x197a88,_0x30a846[_0x280aaf(0xdb)]),{'withFileTypes':!![]})){if(!_0x43c8f1['isDirectory']())continue;const _0x589ddb=readLog(_0x264146,_0x30a846[_0x280aaf(0xdb)],_0x43c8f1[_0x280aaf(0xdb)])['items']['find'](_0xd8f20a=>_0xd8f20a['rev']===_0x58c709);if(_0x589ddb)return _0x589ddb;}}return void 0x0;}function filesTextOf(_0x489545,_0x3b4e52){const _0x5e629f=_0x29eca2,_0x1eda87={};for(const [_0x11c501,_0x499421]of Object[_0x5e629f(0xeb)](_0x3b4e52['files'])){const _0x4fb677=objectPath(_0x489545,_0x499421);if(fs[_0x5e629f(0xdc)](_0x4fb677))_0x1eda87[_0x11c501]=fs[_0x5e629f(0xdf)](_0x4fb677,_0x5e629f(0xfb));}return _0x1eda87;}function createFsVersionStore(_0x3edc4d,_0x320dc1){return fs['mkdirSync'](_0x3edc4d,{'recursive':!![]}),{async 'log'(_0x50f654,_0x332aed){const _0x2510cf=_0x4342,{head:_0x31146d,items:_0x32147e}=readLog(_0x3edc4d,_0x50f654,_0x332aed);return{'head':_0x31146d,'items':[..._0x32147e][_0x2510cf(0xea)]((_0x518865,_0x34a3c3)=>_0x518865['at']<_0x34a3c3['at']?0x1:-0x1)};},async 'get'(_0x58647d){const _0x4a2a1d=_0x4342,_0x35e1e8=findRev(_0x3edc4d,_0x58647d);if(!_0x35e1e8)throw new store[(_0x4a2a1d(0xe6))](_0x4a2a1d(0xb7)+_0x58647d);return _0x35e1e8;},async 'readFile'(_0x5401a6,_0x38686c){const _0x1249b5=_0x4342,_0x55622f=await this[_0x1249b5(0xaf)](_0x5401a6),_0x371650=_0x55622f[_0x1249b5(0xcd)][_0x38686c];if(!_0x371650)throw new store[(_0x1249b5(0xe6))](_0x38686c);const _0x1bff7c=objectPath(_0x3edc4d,_0x371650);if(!fs['existsSync'](_0x1bff7c))throw new store[(_0x1249b5(0xe6))](_0x38686c);return new Uint8Array(fs[_0x1249b5(0xdf)](_0x1bff7c));},async 'commit'(_0x4aa01d){const _0x20d0e1=_0x4342;let _0x5b0e42=_0x4aa01d['files'];if(!_0x5b0e42){const _0x1caf51=await _0x320dc1['get'](_0x4aa01d['id']);_0x5b0e42=store['artifactToFiles'](_0x1caf51);}const _0x5d1593={},_0x40bcf0={};for(const [_0x6e6f0a,_0x424193]of Object[_0x20d0e1(0xeb)](_0x5b0e42)){const _0xb8827d=typeof _0x424193==='string'?_0x424193:new TextDecoder()[_0x20d0e1(0xf1)](_0x424193);_0x5d1593[_0x6e6f0a]=_0xb8827d,_0x40bcf0[_0x6e6f0a]=writeObject(_0x3edc4d,typeof _0x424193===_0x20d0e1(0xe0)?Buffer[_0x20d0e1(0xa5)](_0x424193,'utf8'):_0x424193);}const _0x3ebef6=readLog(_0x3edc4d,_0x4aa01d[_0x20d0e1(0xb0)],_0x4aa01d['id']);if(_0x3ebef6[_0x20d0e1(0xd9)]){const _0x27168a=_0x3ebef6['items'][_0x20d0e1(0xe4)](_0x5c988b=>_0x5c988b[_0x20d0e1(0xe8)]===_0x3ebef6[_0x20d0e1(0xd9)]);if(_0x27168a&&store[_0x20d0e1(0xb6)](_0x5d1593,filesTextOf(_0x3edc4d,_0x27168a)))return _0x27168a;}const _0x963725=new Date(),_0x2612f7=String(_0x963725[_0x20d0e1(0xd7)]())['slice'](0x2)+String(_0x963725[_0x20d0e1(0xce)]()+0x1)[_0x20d0e1(0xd6)](0x2,'0')+String(_0x963725[_0x20d0e1(0xbd)]())[_0x20d0e1(0xd6)](0x2,'0')+String(_0x963725[_0x20d0e1(0xb3)]())[_0x20d0e1(0xd6)](0x2,'0')+String(_0x963725[_0x20d0e1(0xf6)]())[_0x20d0e1(0xd6)](0x2,'0'),_0x4c355b=sha256Hex(Object[_0x20d0e1(0xf5)](_0x40bcf0)[_0x20d0e1(0xea)]()[_0x20d0e1(0xc9)](','))[_0x20d0e1(0xb1)](0x0,0x8),_0x11fab2={'rev':_0x2612f7+_0x20d0e1(0xa7)+_0x4c355b,'kind':_0x4aa01d[_0x20d0e1(0xb0)],'id':_0x4aa01d['id'],'at':_0x963725[_0x20d0e1(0xb9)](),'parent':_0x3ebef6['head'],'by':_0x4aa01d['by'],'note':_0x4aa01d['note'],'files':_0x40bcf0,'meta':_0x4aa01d[_0x20d0e1(0xf2)]};return writeLog(_0x3edc4d,_0x4aa01d[_0x20d0e1(0xb0)],_0x4aa01d['id'],_0x11fab2[_0x20d0e1(0xe8)],[..._0x3ebef6[_0x20d0e1(0xf7)],_0x11fab2]),_0x11fab2;},async 'restore'(_0x438b6a,_0x3bd43b,_0x67d72b,_0x3a4dd8){const _0x159f7e=_0x4342,_0x27844d=await this[_0x159f7e(0xaf)](_0x67d72b),_0x2dc73f={};for(const _0x592d70 of Object[_0x159f7e(0xe1)](_0x27844d[_0x159f7e(0xcd)])){_0x2dc73f[_0x592d70]=new TextDecoder()['decode'](await this['readFile'](_0x67d72b,_0x592d70));}const _0x7ba00=store[_0x159f7e(0xe3)](_0x2dc73f,_0x3bd43b);return await _0x320dc1['save']({..._0x7ba00,'id':_0x3bd43b,'kind':_0x7ba00[_0x159f7e(0xb0)],'etag':void 0x0}),this['commit']({'kind':_0x438b6a,'id':_0x3bd43b,'files':_0x2dc73f,'by':_0x3a4dd8,'note':'\u6062\u590D\u81EA\x20'+_0x67d72b});}};}function createKtFsStores(_0x4d0495){const _0x4e4cbd=_0x29eca2,_0x2becc1=createFsArtifactStore(resolveRoot(_0x4d0495[_0x4e4cbd(0xc1)],_0x4d0495[_0x4e4cbd(0xc7)]),_0x4d0495[_0x4e4cbd(0xef)]),_0x188400=_0x4d0495[_0x4e4cbd(0xbe)]?createFsInstanceStore(resolveRoot(_0x4d0495['instancesRoot'],_0x4d0495['cwd']),_0x4d0495[_0x4e4cbd(0xba)]):void 0x0,_0x255c3e=_0x4d0495[_0x4e4cbd(0xed)]?createFsVersionStore(resolveRoot(_0x4d0495[_0x4e4cbd(0xed)],_0x4d0495[_0x4e4cbd(0xc7)]),_0x2becc1):void 0x0;return{'artifacts':_0x2becc1,'instances':_0x188400,'versions':_0x255c3e};}function _0x4342(_0x447022,_0x4db2fd){_0x447022=_0x447022-0xa4;const _0x26db0e=_0x26db();let _0x434286=_0x26db0e[_0x447022];if(_0x4342['zlzBMB']===undefined){var _0x2855da=function(_0x47b3d0){const _0x1341e2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3c8bf6='',_0x375694='';for(let _0x4c68f2=0x0,_0x3b7ccd,_0x5047ca,_0xd0e1db=0x0;_0x5047ca=_0x47b3d0['charAt'](_0xd0e1db++);~_0x5047ca&&(_0x3b7ccd=_0x4c68f2%0x4?_0x3b7ccd*0x40+_0x5047ca:_0x5047ca,_0x4c68f2++%0x4)?_0x3c8bf6+=String['fromCharCode'](0xff&_0x3b7ccd>>(-0x2*_0x4c68f2&0x6)):0x0){_0x5047ca=_0x1341e2['indexOf'](_0x5047ca);}for(let _0x4b7b1c=0x0,_0x4a1fa7=_0x3c8bf6['length'];_0x4b7b1c<_0x4a1fa7;_0x4b7b1c++){_0x375694+='%'+('00'+_0x3c8bf6['charCodeAt'](_0x4b7b1c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x375694);};_0x4342['bETaXJ']=_0x2855da,_0x4342['yRlgeg']={},_0x4342['zlzBMB']=!![];}const _0x1dbff5=_0x26db0e[0x0];_0x4342['xXzJjS']!==_0x1dbff5&&(_0x4342['yRlgeg']={},_0x4342['xXzJjS']=_0x1dbff5);const _0x36c231=_0x4342['yRlgeg'][_0x447022];return _0x36c231===undefined?(_0x434286=_0x4342['bETaXJ'](_0x434286),_0x4342['yRlgeg'][_0x447022]=_0x434286):_0x434286=_0x36c231,_0x434286;}exports[_0x29eca2(0xc8)]=createKtFsStores;
|
|
1
|
+
'use strict';const _0x56a09c=_0x2aae;function _0x34a1(){const _0x453038=['CgfKu3rHCNq','CMv2','BM90zq','C2vLzeLUC3rHBMnLCW','A2v5CW','sevbra','z2v0','CMvHzezPBgu','Aw5ZDgfUy2uG','Aw5ZDc0','DMvYC2LVBNnsB290','BM93','zgLNzxn0','mtaWntC2oe1VsKfzEq','DMfSDwvZ','zNjVBq','AxrLBxm','lMv0ywC','AxneAxjLy3rVCNK','ChvZAa','zgLYBMfTzq','mZC0oduWog9eAezoAW','CMvZB2X2zq','s3rdB25MBgLJDevYCM9Y','Cgf0Aa','mtaWotG2sLzpAxDH','zw50CMLLCW','C3rYAw5N','C2XPy2u','DhjPBq','CMvHzezPBgvtEw5J','zMLSzxnfCxvHBa','y29TBw9U','CMv2ia','CgfYC2u','s3roB3rgB3vUzevYCM9Y','yxj0AwzHy3rjza','BwTKAxjtEw5J','z2v0tw9UDgG','A2LUza','5OgI5Asn6iEQia','y29TBwL0','BMfTzq','qvjusuzbq1rFrKLmrv9nrvrb','DxrMoa','CMfUzg9T','mZm5odC4uxDVD0jV','y3DK','qgSTDgfIBguVCMvWB3j0l3n0B3jL','C2f2zq','AxnbyNnVBhv0zq','zxHPC3rZu3LUyW','AM9PBG','Bwv0yq','yxj0AwzHy3qG','yxj0AwzHy3ruB0zPBgvZ','Dg9tDhjPBMC','zMfJzxm','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','DgfIq29TBw9U','zgvJB2rL','qvjusuzbq1rFrKLmrv9srvbpuLq','zxrHzW','y3jLyxrLs3rgC1n0B3jLCW','mtq5mJCWAwDpvgTL','z2v0rNvSBfLLyxi','DxbKyxrL','C29YDa','D3jPDgvgAwXLu3LUyW','qvjusuzbq1rFrKLmrv9ct0rz','zMLSDgvY','z2v0twLUDxrLCW','zMLUza','zMLSzxm','zMLSzxnuB0fYDgLMywn0','qvjusuzbq1rFrKLmrv9gsuXm','ntzOt0Llrva','Bg9NlMPZB24','CMvHzgrPCLn5BMm','mZG1BhDSyMfR','yxj0AwzHy3rZuM9VDa','Aw5ZDgfUy2vZuM9VDa','zw5KC1DPDgG','lMPZB24','AgvHza','CM1tEw5J','mJCZodGYoxHdENvZAa','nde3oteWEgvYC1bM','C3rYAw5NAwz5','Dg9ju09tDhjPBMC'];_0x34a1=function(){return _0x453038;};return _0x34a1();}(function(_0xf773c,_0x5ec484){const _0x5da622=_0x2aae,_0x9f4b85=_0xf773c();while(!![]){try{const _0x416428=-parseInt(_0x5da622(0x1e0))/0x1+parseInt(_0x5da622(0x1f7))/0x2+-parseInt(_0x5da622(0x1f6))/0x3+parseInt(_0x5da622(0x20f))/0x4+parseInt(_0x5da622(0x1ef))/0x5*(parseInt(_0x5da622(0x213))/0x6)+parseInt(_0x5da622(0x1ce))/0x7*(-parseInt(_0x5da622(0x1ec))/0x8)+-parseInt(_0x5da622(0x207))/0x9;if(_0x416428===_0x5ec484)break;else _0x9f4b85['push'](_0x9f4b85['shift']());}catch(_0x42114e){_0x9f4b85['push'](_0x9f4b85['shift']());}}}(_0x34a1,0xe29e2));var fs=require('fs'),path=require(_0x56a09c(0x212)),store=require(_0x56a09c(0x1d0)),crypto=require('crypto');function resolveRoot(_0xf0d5c5,_0xca0c8=process[_0x56a09c(0x1cf)]()){const _0x5e298d=_0x56a09c,_0x1221c9=path[_0x5e298d(0x1d2)](_0xf0d5c5)?_0xf0d5c5:path[_0x5e298d(0x210)](_0xca0c8,_0xf0d5c5);return fs[_0x5e298d(0x1c5)](_0x1221c9,{'recursive':!![]}),_0x1221c9;}function artifactDir(_0x5ae6b0,_0x5cb725){const _0x1c46ae=_0x56a09c;return path[_0x1c46ae(0x1d4)](_0x5ae6b0,_0x5cb725);}function objectPath(_0x7dc071,_0x501c06){const _0x476ede=_0x56a09c;return path[_0x476ede(0x1d4)](_0x7dc071,'objects',_0x501c06['slice'](0x0,0x2),_0x501c06);}function itemDir(_0x3fc410,_0x25f4fa,_0x2a4397){const _0x2e7e6b=_0x56a09c;return path[_0x2e7e6b(0x1d4)](_0x3fc410,_0x2e7e6b(0x20a),_0x25f4fa,_0x2a4397);}function newEtag(){const _0xf1a6f2=_0x56a09c;return Date[_0xf1a6f2(0x205)]()[_0xf1a6f2(0x1d8)](0x24)+'-'+Math[_0xf1a6f2(0x1cd)]()['toString'](0x24)['slice'](0x2,0x8);}function readEtag(_0x385518){const _0x2c76bd=_0x56a09c,_0x5e9ec1=path[_0x2c76bd(0x1d4)](_0x385518,'.etag');return fs['existsSync'](_0x5e9ec1)?fs['readFileSync'](_0x5e9ec1,_0x2c76bd(0x1cc))[_0x2c76bd(0x217)]():void 0x0;}function writeArtifactDir(_0x4cd7c1,_0x22b255,_0x23d5b1){const _0x2146f9=_0x56a09c;fs[_0x2146f9(0x1c5)](path[_0x2146f9(0x1d4)](_0x4cd7c1,_0x2146f9(0x1d9)),{'recursive':!![]});const _0x303434=store[_0x2146f9(0x1d7)](_0x22b255);fs[_0x2146f9(0x1e4)](path[_0x2146f9(0x1d4)](_0x4cd7c1,store['ARTIFACT_FILE_META']),_0x303434[store[_0x2146f9(0x1cb)]]??'{}',_0x2146f9(0x1cc)),fs[_0x2146f9(0x1e4)](path['join'](_0x4cd7c1,store[_0x2146f9(0x1e5)]),_0x303434[store[_0x2146f9(0x1e5)]]??'',_0x2146f9(0x1cc));const _0x135733=path[_0x2146f9(0x1d4)](_0x4cd7c1,store[_0x2146f9(0x1eb)]),_0x3e323c=path[_0x2146f9(0x1d4)](_0x4cd7c1,store[_0x2146f9(0x1dd)]);if(_0x303434[store[_0x2146f9(0x1eb)]])fs[_0x2146f9(0x1e4)](_0x135733,_0x303434[store[_0x2146f9(0x1eb)]],_0x2146f9(0x1cc));else{if(fs['existsSync'](_0x135733))fs[_0x2146f9(0x1f5)](_0x135733);}if(_0x303434[store[_0x2146f9(0x1dd)]])fs[_0x2146f9(0x1e4)](_0x3e323c,_0x303434[store[_0x2146f9(0x1dd)]],'utf8');else{if(fs[_0x2146f9(0x1d3)](_0x3e323c))fs[_0x2146f9(0x1f5)](_0x3e323c);}fs[_0x2146f9(0x1e4)](path[_0x2146f9(0x1d4)](_0x4cd7c1,_0x2146f9(0x20b)),_0x23d5b1,_0x2146f9(0x1cc));}function readArtifactDir(_0x3644a3,_0x7ce1aa){const _0x402f10=_0x56a09c,_0x37f0c4={},_0x43dea6=path[_0x402f10(0x1d4)](_0x3644a3,store[_0x402f10(0x1cb)]),_0x3ea35e=path[_0x402f10(0x1d4)](_0x3644a3,store[_0x402f10(0x1e5)]);if(fs[_0x402f10(0x1d3)](_0x43dea6))_0x37f0c4[store[_0x402f10(0x1cb)]]=fs['readFileSync'](_0x43dea6,_0x402f10(0x1cc));if(fs['existsSync'](_0x3ea35e))_0x37f0c4[store[_0x402f10(0x1e5)]]=fs[_0x402f10(0x218)](_0x3ea35e,_0x402f10(0x1cc));const _0x35f7f3=path[_0x402f10(0x1d4)](_0x3644a3,store[_0x402f10(0x1eb)]),_0x2b8539=path[_0x402f10(0x1d4)](_0x3644a3,store['ARTIFACT_FILE_REPORT']);if(fs[_0x402f10(0x1d3)](_0x35f7f3))_0x37f0c4[store[_0x402f10(0x1eb)]]=fs[_0x402f10(0x218)](_0x35f7f3,'utf8');if(fs[_0x402f10(0x1d3)](_0x2b8539))_0x37f0c4[store['ARTIFACT_FILE_REPORT']]=fs[_0x402f10(0x218)](_0x2b8539,_0x402f10(0x1cc));return{...store[_0x402f10(0x1ea)](_0x37f0c4,_0x7ce1aa),'etag':readEtag(_0x3644a3)};}function createFsArtifactStore(_0x2b643a,_0x557c5a=[]){const _0x1ecb4f=_0x56a09c;fs['mkdirSync'](_0x2b643a,{'recursive':!![]});for(const _0x2fb472 of _0x557c5a){const _0xb1d0fc=artifactDir(_0x2b643a,_0x2fb472['id']),_0x41345f=path[_0x1ecb4f(0x1d4)](_0xb1d0fc,store[_0x1ecb4f(0x1e5)]);if(!fs[_0x1ecb4f(0x1d3)](_0x41345f))writeArtifactDir(_0xb1d0fc,_0x2fb472,_0x2fb472[_0x1ecb4f(0x1de)]??newEtag());}return{async 'list'(_0x24dc15){const _0x1d96a1=_0x1ecb4f;if(!fs['existsSync'](_0x2b643a))return[];const _0x59bd7a=[];for(const _0x5e42fd of fs[_0x1d96a1(0x1ee)](_0x2b643a,{'withFileTypes':!![]})){if(!_0x5e42fd[_0x1d96a1(0x20c)]())continue;try{const _0xe32e19=readArtifactDir(artifactDir(_0x2b643a,_0x5e42fd[_0x1d96a1(0x1ca)]),_0x5e42fd[_0x1d96a1(0x1ca)]);if(!_0x24dc15||_0xe32e19[_0x1d96a1(0x1c7)]===_0x24dc15)_0x59bd7a[_0x1d96a1(0x20d)]({'id':_0xe32e19['id'],'name':_0xe32e19['name'],'kind':_0xe32e19[_0x1d96a1(0x1c7)]});}catch{}}return _0x59bd7a;},async 'get'(_0x7e1b6e){const _0x3f54b1=_0x1ecb4f,_0x1ccb0e=artifactDir(_0x2b643a,_0x7e1b6e);if(!fs[_0x3f54b1(0x1d3)](_0x1ccb0e))throw new store['KtNotFoundError']('artifact\x20'+_0x7e1b6e);return readArtifactDir(_0x1ccb0e,_0x7e1b6e);},async 'save'(_0x357255){const _0x32e011=_0x1ecb4f,_0x50f34f=artifactDir(_0x2b643a,_0x357255['id']),_0x1b1fa4=fs[_0x32e011(0x1d3)](_0x50f34f)?readArtifactDir(_0x50f34f,_0x357255['id']):void 0x0;if(_0x357255[_0x32e011(0x1de)]&&_0x1b1fa4?.[_0x32e011(0x1de)]&&_0x357255[_0x32e011(0x1de)]!==_0x1b1fa4['etag'])throw new store[(_0x32e011(0x211))](_0x32e011(0x1da),_0x1b1fa4);const _0x3fcbdd=newEtag();return writeArtifactDir(_0x50f34f,_0x357255,_0x3fcbdd),{..._0x357255,'etag':_0x3fcbdd};},async 'create'(_0x7bb4f3){const _0x45b0c7=_0x1ecb4f,_0xd21129=_0x7bb4f3[_0x45b0c7(0x1c7)]+'-'+Math['random']()[_0x45b0c7(0x1d8)](0x24)[_0x45b0c7(0x216)](0x2,0xa),_0x3919af={'id':_0xd21129,'name':_0x7bb4f3[_0x45b0c7(0x1ca)],'kind':_0x7bb4f3[_0x45b0c7(0x1c7)],'ktl':store['EMPTY_KTL']};return this[_0x45b0c7(0x1d1)](_0x3919af);},async 'remove'(_0x521053){const _0x1bad36=_0x1ecb4f,_0x3a68e3=artifactDir(_0x2b643a,_0x521053);if(!fs[_0x1bad36(0x1d3)](_0x3a68e3))throw new store[(_0x1bad36(0x1c3))](_0x1bad36(0x1d6)+_0x521053);fs[_0x1bad36(0x1f5)](_0x3a68e3,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x341249,_0x431800={}){const _0x273243=_0x56a09c;fs[_0x273243(0x1c5)](_0x341249,{'recursive':!![]});const _0x433450=_0x2a880f=>path['join'](_0x341249,_0x2a880f+'.json');for(const [_0x32da55,_0xed66d6]of Object[_0x273243(0x214)](_0x431800)){if(!fs[_0x273243(0x1d3)](_0x433450(_0x32da55)))fs['writeFileSync'](_0x433450(_0x32da55),JSON['stringify'](_0xed66d6,null,0x2),_0x273243(0x1cc));}return{async 'get'(_0x683a33){const _0xe13bf6=_0x273243,_0x26edfa=_0x433450(_0x683a33);if(!fs['existsSync'](_0x26edfa))throw new store['KtNotFoundError'](_0xe13bf6(0x202)+_0x683a33);return JSON[_0xe13bf6(0x1c2)](fs[_0xe13bf6(0x218)](_0x26edfa,_0xe13bf6(0x1cc)));},async 'save'(_0xa63d0c,_0x1ab12d){const _0x1d1c4b=_0x273243,_0x505e6f=_0x433450(_0xa63d0c),_0x3db6f0=fs['existsSync'](_0x505e6f)?JSON[_0x1d1c4b(0x1c2)](fs[_0x1d1c4b(0x218)](_0x505e6f,_0x1d1c4b(0x1cc))):{'artifactId':'','values':{}},_0x226b77={'artifactId':_0x3db6f0[_0x1d1c4b(0x1c4)],'values':{..._0x3db6f0[_0x1d1c4b(0x208)],..._0x1ab12d[_0x1d1c4b(0x208)]},'common':{..._0x3db6f0[_0x1d1c4b(0x21a)],..._0x1ab12d[_0x1d1c4b(0x21a)]},'tabCommon':{..._0x3db6f0[_0x1d1c4b(0x1db)],..._0x1ab12d[_0x1d1c4b(0x1db)]}};fs[_0x1d1c4b(0x1e4)](_0x505e6f,JSON[_0x1d1c4b(0x1f8)](_0x226b77,null,0x2),_0x1d1c4b(0x1cc));},async 'list'(_0x155d0a){const _0x5dff2c=_0x273243;return fs['readdirSync'](_0x341249)[_0x5dff2c(0x1e6)](_0xaf3f6=>_0xaf3f6[_0x5dff2c(0x1f2)](_0x5dff2c(0x1f3)))['map'](_0x5e8752=>{const _0x1655fd=_0x5dff2c,_0xf1fb17=_0x5e8752[_0x1655fd(0x216)](0x0,-0x5),_0x582fa1=JSON[_0x1655fd(0x1c2)](fs[_0x1655fd(0x218)](path[_0x1655fd(0x1d4)](_0x341249,_0x5e8752),_0x1655fd(0x1cc)));return{'id':_0xf1fb17,'artifactId':_0x582fa1[_0x1655fd(0x1c4)]};})['filter'](_0x4dd2ac=>!_0x155d0a||_0x4dd2ac[_0x5dff2c(0x1c4)]===_0x155d0a);},async 'create'(_0xfb6d17){const _0x10c0a0=_0x273243,_0x485b3f=_0x10c0a0(0x203)+Math['random']()['toString'](0x24)[_0x10c0a0(0x216)](0x2,0xa);return fs[_0x10c0a0(0x1e4)](_0x433450(_0x485b3f),JSON[_0x10c0a0(0x1f8)]({'artifactId':_0xfb6d17[_0x10c0a0(0x1c4)],'values':{},'common':{}},null,0x2),_0x10c0a0(0x1cc)),{'id':_0x485b3f};}};}function sha256Hex(_0x7217f1){const _0x338976=_0x56a09c,_0x524544=typeof _0x7217f1==='string'?Buffer[_0x338976(0x209)](_0x7217f1,_0x338976(0x1cc)):Buffer['from'](_0x7217f1);return crypto['createHash']('sha256')[_0x338976(0x1e2)](_0x524544)[_0x338976(0x206)]('hex');}function _0x2aae(_0x381636,_0xdb93cf){_0x381636=_0x381636-0x1c1;const _0x34a1e0=_0x34a1();let _0x2aaec5=_0x34a1e0[_0x381636];if(_0x2aae['FsBjIi']===undefined){var _0x37181a=function(_0x2eb9e6){const _0x6080b5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x22531a='',_0xf0d5c5='';for(let _0xca0c8=0x0,_0x1221c9,_0x5ae6b0,_0x5cb725=0x0;_0x5ae6b0=_0x2eb9e6['charAt'](_0x5cb725++);~_0x5ae6b0&&(_0x1221c9=_0xca0c8%0x4?_0x1221c9*0x40+_0x5ae6b0:_0x5ae6b0,_0xca0c8++%0x4)?_0x22531a+=String['fromCharCode'](0xff&_0x1221c9>>(-0x2*_0xca0c8&0x6)):0x0){_0x5ae6b0=_0x6080b5['indexOf'](_0x5ae6b0);}for(let _0x7dc071=0x0,_0x501c06=_0x22531a['length'];_0x7dc071<_0x501c06;_0x7dc071++){_0xf0d5c5+='%'+('00'+_0x22531a['charCodeAt'](_0x7dc071)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xf0d5c5);};_0x2aae['tnPrkS']=_0x37181a,_0x2aae['yEiAHx']={},_0x2aae['FsBjIi']=!![];}const _0x3b31a3=_0x34a1e0[0x0];_0x2aae['JPcDpk']!==_0x3b31a3&&(_0x2aae['yEiAHx']={},_0x2aae['JPcDpk']=_0x3b31a3);const _0x567fd7=_0x2aae['yEiAHx'][_0x381636];return _0x567fd7===undefined?(_0x2aaec5=_0x2aae['tnPrkS'](_0x2aaec5),_0x2aae['yEiAHx'][_0x381636]=_0x2aaec5):_0x2aaec5=_0x567fd7,_0x2aaec5;}function writeObject(_0xc89a35,_0x55b19a){const _0x4d0845=_0x56a09c,_0x37974a=sha256Hex(_0x55b19a),_0x45b538=objectPath(_0xc89a35,_0x37974a);fs[_0x4d0845(0x1c5)](path[_0x4d0845(0x20e)](_0x45b538),{'recursive':!![]});if(!fs['existsSync'](_0x45b538))fs[_0x4d0845(0x1e4)](_0x45b538,_0x55b19a);return _0x37974a;}function readLog(_0x571e72,_0x5b65fb,_0x3a0c63){const _0x4c6cbc=_0x56a09c,_0x43e5e3=itemDir(_0x571e72,_0x5b65fb,_0x3a0c63),_0x450822=path[_0x4c6cbc(0x1d4)](_0x43e5e3,'log.json'),_0x18c661=path[_0x4c6cbc(0x1d4)](_0x43e5e3,_0x4c6cbc(0x1ff)),_0x11ef5e=fs[_0x4c6cbc(0x1d3)](_0x450822)?JSON['parse'](fs[_0x4c6cbc(0x218)](_0x450822,_0x4c6cbc(0x1cc))):[],_0x3d1cb6=fs['existsSync'](_0x18c661)?fs[_0x4c6cbc(0x218)](_0x18c661,'utf8')['trim']():_0x11ef5e['at'](-0x1)?.['rev']??null;return{'head':_0x3d1cb6,'items':_0x11ef5e};}function writeLog(_0x4810f7,_0x438d95,_0x5f2123,_0x26f389,_0x4bb7a9){const _0x248e36=_0x56a09c,_0x4a6a5d=itemDir(_0x4810f7,_0x438d95,_0x5f2123);fs['mkdirSync'](_0x4a6a5d,{'recursive':!![]}),fs[_0x248e36(0x1e4)](path[_0x248e36(0x1d4)](_0x4a6a5d,_0x248e36(0x1ed)),JSON[_0x248e36(0x1f8)](_0x4bb7a9,null,0x2),_0x248e36(0x1cc)),fs['writeFileSync'](path['join'](_0x4a6a5d,_0x248e36(0x1ff)),_0x26f389+'\x0a',_0x248e36(0x1cc));}function findRev(_0x377ebd,_0x46366a){const _0x5a8071=_0x56a09c,_0x5de6ff=path[_0x5a8071(0x1d4)](_0x377ebd,_0x5a8071(0x20a));if(!fs['existsSync'](_0x5de6ff))return void 0x0;for(const _0x3de0b2 of fs[_0x5a8071(0x1ee)](_0x5de6ff,{'withFileTypes':!![]})){if(!_0x3de0b2[_0x5a8071(0x20c)]())continue;for(const _0x4100cd of fs[_0x5a8071(0x1ee)](path[_0x5a8071(0x1d4)](_0x5de6ff,_0x3de0b2[_0x5a8071(0x1ca)]),{'withFileTypes':!![]})){if(!_0x4100cd[_0x5a8071(0x20c)]())continue;const _0x42c08c=readLog(_0x377ebd,_0x3de0b2[_0x5a8071(0x1ca)],_0x4100cd[_0x5a8071(0x1ca)])[_0x5a8071(0x20a)][_0x5a8071(0x1e8)](_0x44215f=>_0x44215f[_0x5a8071(0x1fb)]===_0x46366a);if(_0x42c08c)return _0x42c08c;}}return void 0x0;}function filesTextOf(_0x4c4a83,_0x2d2edc){const _0x26d88b=_0x56a09c,_0x37cbe8={};for(const [_0x157af4,_0x4b3cba]of Object[_0x26d88b(0x214)](_0x2d2edc[_0x26d88b(0x1e9)])){const _0x51061b=objectPath(_0x4c4a83,_0x4b3cba);if(fs[_0x26d88b(0x1d3)](_0x51061b))_0x37cbe8[_0x157af4]=fs['readFileSync'](_0x51061b,_0x26d88b(0x1cc));}return _0x37cbe8;}function createFsVersionStore(_0x5d7862,_0x50e2bb){const _0x54b0d0=_0x56a09c;return fs[_0x54b0d0(0x1c5)](_0x5d7862,{'recursive':!![]}),{async 'log'(_0x4fbd36,_0x51eee5){const {head:_0x2f8161,items:_0x310245}=readLog(_0x5d7862,_0x4fbd36,_0x51eee5);return{'head':_0x2f8161,'items':[..._0x310245]['sort']((_0x435f5e,_0x301ff9)=>_0x435f5e['at']<_0x301ff9['at']?0x1:-0x1)};},async 'get'(_0x4876d6){const _0x221bfd=_0x54b0d0,_0x42c043=findRev(_0x5d7862,_0x4876d6);if(!_0x42c043)throw new store[(_0x221bfd(0x1c3))](_0x221bfd(0x1c1)+_0x4876d6);return _0x42c043;},async 'readFile'(_0x596499,_0x3a6392){const _0x6a7dc6=_0x54b0d0,_0x8aefe8=await this[_0x6a7dc6(0x200)](_0x596499),_0x3f44d9=_0x8aefe8['files'][_0x3a6392];if(!_0x3f44d9)throw new store[(_0x6a7dc6(0x1c3))](_0x3a6392);const _0x37ff34=objectPath(_0x5d7862,_0x3f44d9);if(!fs['existsSync'](_0x37ff34))throw new store[(_0x6a7dc6(0x1c3))](_0x3a6392);return new Uint8Array(fs[_0x6a7dc6(0x218)](_0x37ff34));},async 'commit'(_0x3e5edd){const _0x211e94=_0x54b0d0;let _0x5c09b3=_0x3e5edd[_0x211e94(0x1e9)];if(!_0x5c09b3){const _0x485d4e=await _0x50e2bb[_0x211e94(0x200)](_0x3e5edd['id']);_0x5c09b3=store[_0x211e94(0x1d7)](_0x485d4e);}const _0x2e34c0={},_0x125f0e={};for(const [_0x27aae5,_0x1d8721]of Object[_0x211e94(0x214)](_0x5c09b3)){const _0x21ea9e=typeof _0x1d8721===_0x211e94(0x215)?_0x1d8721:new TextDecoder()['decode'](_0x1d8721);_0x2e34c0[_0x27aae5]=_0x21ea9e,_0x125f0e[_0x27aae5]=writeObject(_0x5d7862,typeof _0x1d8721===_0x211e94(0x215)?Buffer[_0x211e94(0x209)](_0x1d8721,_0x211e94(0x1cc)):_0x1d8721);}const _0x1e458c=readLog(_0x5d7862,_0x3e5edd[_0x211e94(0x1c7)],_0x3e5edd['id']);if(_0x1e458c[_0x211e94(0x1f4)]){const _0x417029=_0x1e458c['items']['find'](_0x2f9972=>_0x2f9972[_0x211e94(0x1fb)]===_0x1e458c[_0x211e94(0x1f4)]);if(_0x417029&&store[_0x211e94(0x219)](_0x2e34c0,filesTextOf(_0x5d7862,_0x417029)))return _0x417029;}const _0x1c9712=new Date(),_0x4f9c4c=String(_0x1c9712[_0x211e94(0x1e1)]())[_0x211e94(0x216)](0x2)+String(_0x1c9712[_0x211e94(0x1c6)]()+0x1)['padStart'](0x2,'0')+String(_0x1c9712['getDate']())[_0x211e94(0x1fa)](0x2,'0')+String(_0x1c9712['getHours']())[_0x211e94(0x1fa)](0x2,'0')+String(_0x1c9712[_0x211e94(0x1e7)]())[_0x211e94(0x1fa)](0x2,'0'),_0x1439ff=sha256Hex(Object[_0x211e94(0x208)](_0x125f0e)[_0x211e94(0x1e3)]()[_0x211e94(0x1d4)](','))['slice'](0x0,0x8),_0x2404db={'rev':_0x4f9c4c+'-local-'+_0x1439ff,'kind':_0x3e5edd[_0x211e94(0x1c7)],'id':_0x3e5edd['id'],'at':_0x1c9712[_0x211e94(0x1f9)](),'parent':_0x1e458c['head'],'by':_0x3e5edd['by'],'note':_0x3e5edd[_0x211e94(0x1fc)],'files':_0x125f0e,'meta':_0x3e5edd[_0x211e94(0x1d5)]};return writeLog(_0x5d7862,_0x3e5edd[_0x211e94(0x1c7)],_0x3e5edd['id'],_0x2404db['rev'],[..._0x1e458c[_0x211e94(0x20a)],_0x2404db]),_0x2404db;},async 'restore'(_0x15298b,_0x48793e,_0x471512,_0x3698ce){const _0x54bb75=_0x54b0d0,_0x522479=await this[_0x54bb75(0x200)](_0x471512),_0x17e068={};for(const _0x495a8e of Object[_0x54bb75(0x1fe)](_0x522479[_0x54bb75(0x1e9)])){_0x17e068[_0x495a8e]=new TextDecoder()[_0x54bb75(0x1dc)](await this[_0x54bb75(0x201)](_0x471512,_0x495a8e));}const _0x2b2c81=store['filesToArtifact'](_0x17e068,_0x48793e);return await _0x50e2bb[_0x54bb75(0x1d1)]({..._0x2b2c81,'id':_0x48793e,'kind':_0x2b2c81[_0x54bb75(0x1c7)],'etag':void 0x0}),this[_0x54bb75(0x1c9)]({'kind':_0x15298b,'id':_0x48793e,'files':_0x17e068,'by':_0x3698ce,'note':_0x54bb75(0x1c8)+_0x471512});}};}function createKtFsStores(_0x2d2c88){const _0x355e6e=_0x56a09c,_0x49ccfa=createFsArtifactStore(resolveRoot(_0x2d2c88[_0x355e6e(0x1f0)],_0x2d2c88['cwd']),_0x2d2c88['seed']),_0x46a1c9=_0x2d2c88['instancesRoot']?createFsInstanceStore(resolveRoot(_0x2d2c88[_0x355e6e(0x1f1)],_0x2d2c88['cwd']),_0x2d2c88[_0x355e6e(0x1fd)]):void 0x0,_0x2d2542=_0x2d2c88[_0x355e6e(0x204)]?createFsVersionStore(resolveRoot(_0x2d2c88[_0x355e6e(0x204)],_0x2d2c88[_0x355e6e(0x1cf)]),_0x49ccfa):void 0x0;return{'artifacts':_0x49ccfa,'instances':_0x46a1c9,'versions':_0x2d2542};}exports[_0x56a09c(0x1df)]=createKtFsStores;
|
package/dist/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x573eac,_0x1dbe44){const _0x17fb2e=_0x2f3c,_0x198948=_0x573eac();while(!![]){try{const _0x38f4bd=-parseInt(_0x17fb2e(0x92))/0x1+-parseInt(_0x17fb2e(0x78))/0x2+-parseInt(_0x17fb2e(0x84))/0x3+-parseInt(_0x17fb2e(0xba))/0x4*(parseInt(_0x17fb2e(0xad))/0x5)+-parseInt(_0x17fb2e(0xa6))/0x6*(parseInt(_0x17fb2e(0x91))/0x7)+parseInt(_0x17fb2e(0x9e))/0x8*(parseInt(_0x17fb2e(0x7f))/0x9)+parseInt(_0x17fb2e(0x86))/0xa;if(_0x38f4bd===_0x1dbe44)break;else _0x198948['push'](_0x198948['shift']());}catch(_0x3528fa){_0x198948['push'](_0x198948['shift']());}}}(_0x5ef1,0x34c39));import{mkdirSync,existsSync,rmSync,readdirSync,writeFileSync,readFileSync}from'fs';function _0x2f3c(_0x5d759a,_0x2ef9c2){_0x5d759a=_0x5d759a-0x77;const _0x5ef107=_0x5ef1();let _0x2f3cfa=_0x5ef107[_0x5d759a];if(_0x2f3c['uCvGJj']===undefined){var _0x58327a=function(_0x40da2d){const _0x2619f5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4e58b7='',_0x286c6c='';for(let _0x501e92=0x0,_0x4c5b94,_0x292c92,_0x33a9dc=0x0;_0x292c92=_0x40da2d['charAt'](_0x33a9dc++);~_0x292c92&&(_0x4c5b94=_0x501e92%0x4?_0x4c5b94*0x40+_0x292c92:_0x292c92,_0x501e92++%0x4)?_0x4e58b7+=String['fromCharCode'](0xff&_0x4c5b94>>(-0x2*_0x501e92&0x6)):0x0){_0x292c92=_0x2619f5['indexOf'](_0x292c92);}for(let _0x499ab9=0x0,_0x452745=_0x4e58b7['length'];_0x499ab9<_0x452745;_0x499ab9++){_0x286c6c+='%'+('00'+_0x4e58b7['charCodeAt'](_0x499ab9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x286c6c);};_0x2f3c['NNGPfm']=_0x58327a,_0x2f3c['hSiwQz']={},_0x2f3c['uCvGJj']=!![];}const _0xa9b8e5=_0x5ef107[0x0];_0x2f3c['pbDCIl']!==_0xa9b8e5&&(_0x2f3c['hSiwQz']={},_0x2f3c['pbDCIl']=_0xa9b8e5);const _0x3e4b38=_0x2f3c['hSiwQz'][_0x5d759a];return _0x3e4b38===undefined?(_0x2f3cfa=_0x2f3c['NNGPfm'](_0x2f3cfa),_0x2f3c['hSiwQz'][_0x5d759a]=_0x2f3cfa):_0x2f3cfa=_0x3e4b38,_0x2f3cfa;}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(_0x286c6c,_0x501e92=process['cwd']()){const _0x4c5b94=isAbsolute(_0x286c6c)?_0x286c6c:resolve(_0x501e92,_0x286c6c);return mkdirSync(_0x4c5b94,{'recursive':!![]}),_0x4c5b94;}function artifactDir(_0x292c92,_0x33a9dc){return join(_0x292c92,_0x33a9dc);}function objectPath(_0x499ab9,_0x452745){const _0x419ad7=_0x2f3c;return join(_0x499ab9,_0x419ad7(0x8a),_0x452745[_0x419ad7(0xa9)](0x0,0x2),_0x452745);}function itemDir(_0x400efc,_0x22b2ca,_0x1408b9){const _0x1756f1=_0x2f3c;return join(_0x400efc,_0x1756f1(0x95),_0x22b2ca,_0x1408b9);}function newEtag(){const _0x3a18ae=_0x2f3c;return Date[_0x3a18ae(0x81)]()[_0x3a18ae(0x83)](0x24)+'-'+Math[_0x3a18ae(0xaf)]()['toString'](0x24)[_0x3a18ae(0xa9)](0x2,0x8);}function readEtag(_0x4013ce){const _0x237825=_0x2f3c,_0x13858d=join(_0x4013ce,_0x237825(0xb1));return existsSync(_0x13858d)?readFileSync(_0x13858d,_0x237825(0xb8))[_0x237825(0x80)]():void 0x0;}function writeArtifactDir(_0x2baf73,_0x445da5,_0x562838){const _0x43f626=_0x2f3c;mkdirSync(join(_0x2baf73,_0x43f626(0x9a)),{'recursive':!![]});const _0xeb143b=artifactToFiles(_0x445da5);writeFileSync(join(_0x2baf73,ARTIFACT_FILE_META),_0xeb143b[ARTIFACT_FILE_META]??'{}',_0x43f626(0xb8)),writeFileSync(join(_0x2baf73,ARTIFACT_FILE_BODY),_0xeb143b[ARTIFACT_FILE_BODY]??'',_0x43f626(0xb8));const _0x193e2a=join(_0x2baf73,ARTIFACT_FILE_FILL),_0x4e8961=join(_0x2baf73,ARTIFACT_FILE_REPORT);if(_0xeb143b[ARTIFACT_FILE_FILL])writeFileSync(_0x193e2a,_0xeb143b[ARTIFACT_FILE_FILL],_0x43f626(0xb8));else{if(existsSync(_0x193e2a))rmSync(_0x193e2a);}if(_0xeb143b[ARTIFACT_FILE_REPORT])writeFileSync(_0x4e8961,_0xeb143b[ARTIFACT_FILE_REPORT],_0x43f626(0xb8));else{if(existsSync(_0x4e8961))rmSync(_0x4e8961);}writeFileSync(join(_0x2baf73,_0x43f626(0xb1)),_0x562838,'utf8');}function readArtifactDir(_0xf7e10f,_0x356715){const _0x2ee80a={},_0x45860a=join(_0xf7e10f,ARTIFACT_FILE_META),_0x3b252c=join(_0xf7e10f,ARTIFACT_FILE_BODY);if(existsSync(_0x45860a))_0x2ee80a[ARTIFACT_FILE_META]=readFileSync(_0x45860a,'utf8');if(existsSync(_0x3b252c))_0x2ee80a[ARTIFACT_FILE_BODY]=readFileSync(_0x3b252c,'utf8');const _0x4628f0=join(_0xf7e10f,ARTIFACT_FILE_FILL),_0x18ec77=join(_0xf7e10f,ARTIFACT_FILE_REPORT);if(existsSync(_0x4628f0))_0x2ee80a[ARTIFACT_FILE_FILL]=readFileSync(_0x4628f0,'utf8');if(existsSync(_0x18ec77))_0x2ee80a[ARTIFACT_FILE_REPORT]=readFileSync(_0x18ec77,'utf8');return{...filesToArtifact(_0x2ee80a,_0x356715),'etag':readEtag(_0xf7e10f)};}function createFsArtifactStore(_0x3648b3,_0x1b319b=[]){mkdirSync(_0x3648b3,{'recursive':!![]});for(const _0x4fa699 of _0x1b319b){const _0x2e2d94=artifactDir(_0x3648b3,_0x4fa699['id']),_0x4fd885=join(_0x2e2d94,ARTIFACT_FILE_BODY);if(!existsSync(_0x4fd885))writeArtifactDir(_0x2e2d94,_0x4fa699,_0x4fa699['etag']??newEtag());}return{async 'list'(_0x505a32){const _0x12c3e4=_0x2f3c;if(!existsSync(_0x3648b3))return[];const _0x6c6583=[];for(const _0x499a35 of readdirSync(_0x3648b3,{'withFileTypes':!![]})){if(!_0x499a35['isDirectory']())continue;try{const _0x190dd3=readArtifactDir(artifactDir(_0x3648b3,_0x499a35[_0x12c3e4(0xb5)]),_0x499a35[_0x12c3e4(0xb5)]);if(!_0x505a32||_0x190dd3[_0x12c3e4(0x9c)]===_0x505a32)_0x6c6583[_0x12c3e4(0xa8)]({'id':_0x190dd3['id'],'name':_0x190dd3['name'],'kind':_0x190dd3['kind']});}catch{}}return _0x6c6583;},async 'get'(_0xca7d30){const _0x5d4424=_0x2f3c,_0x244e17=artifactDir(_0x3648b3,_0xca7d30);if(!existsSync(_0x244e17))throw new KtNotFoundError(_0x5d4424(0x96)+_0xca7d30);return readArtifactDir(_0x244e17,_0xca7d30);},async 'save'(_0x298733){const _0x1aea86=_0x2f3c,_0x8f7cb2=artifactDir(_0x3648b3,_0x298733['id']),_0xa1cbf9=existsSync(_0x8f7cb2)?readArtifactDir(_0x8f7cb2,_0x298733['id']):void 0x0;if(_0x298733[_0x1aea86(0xb6)]&&_0xa1cbf9?.[_0x1aea86(0xb6)]&&_0x298733[_0x1aea86(0xb6)]!==_0xa1cbf9[_0x1aea86(0xb6)])throw new KtConflictError(_0x1aea86(0xa0),_0xa1cbf9);const _0x54ecde=newEtag();return writeArtifactDir(_0x8f7cb2,_0x298733,_0x54ecde),{..._0x298733,'etag':_0x54ecde};},async 'create'(_0xf17dca){const _0xc15994=_0x2f3c,_0xdad91=_0xf17dca[_0xc15994(0x9c)]+'-'+Math[_0xc15994(0xaf)]()[_0xc15994(0x83)](0x24)['slice'](0x2,0xa),_0x1fbb09={'id':_0xdad91,'name':_0xf17dca['name'],'kind':_0xf17dca[_0xc15994(0x9c)],'ktl':EMPTY_KTL};return this['save'](_0x1fbb09);},async 'remove'(_0x8fd220){const _0x3f2dc1=artifactDir(_0x3648b3,_0x8fd220);if(!existsSync(_0x3f2dc1))throw new KtNotFoundError('artifact\x20'+_0x8fd220);rmSync(_0x3f2dc1,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x316fbe,_0x59769e={}){const _0x5cf37b=_0x2f3c;mkdirSync(_0x316fbe,{'recursive':!![]});const _0x35635b=_0x22428b=>join(_0x316fbe,_0x22428b+_0x5cf37b(0xb9));for(const [_0x21864d,_0x475217]of Object['entries'](_0x59769e)){if(!existsSync(_0x35635b(_0x21864d)))writeFileSync(_0x35635b(_0x21864d),JSON[_0x5cf37b(0x7c)](_0x475217,null,0x2),_0x5cf37b(0xb8));}return{async 'get'(_0xee3dad){const _0x56cf84=_0x5cf37b,_0x539f59=_0x35635b(_0xee3dad);if(!existsSync(_0x539f59))throw new KtNotFoundError(_0x56cf84(0x7d)+_0xee3dad);return JSON[_0x56cf84(0x93)](readFileSync(_0x539f59,_0x56cf84(0xb8)));},async 'save'(_0x1b749f,_0x3a3ce2){const _0x257d4a=_0x5cf37b,_0x3e0ccd=_0x35635b(_0x1b749f),_0x47934d=existsSync(_0x3e0ccd)?JSON['parse'](readFileSync(_0x3e0ccd,'utf8')):{'artifactId':'','values':{}},_0x1ff66c={'artifactId':_0x47934d[_0x257d4a(0xab)],'values':{..._0x47934d[_0x257d4a(0x90)],..._0x3a3ce2[_0x257d4a(0x90)]},'common':{..._0x47934d[_0x257d4a(0x99)],..._0x3a3ce2[_0x257d4a(0x99)]},'tabCommon':{..._0x47934d[_0x257d4a(0x8b)],..._0x3a3ce2[_0x257d4a(0x8b)]}};writeFileSync(_0x3e0ccd,JSON[_0x257d4a(0x7c)](_0x1ff66c,null,0x2),_0x257d4a(0xb8));},async 'list'(_0x1251f3){const _0x56c6dc=_0x5cf37b;return readdirSync(_0x316fbe)[_0x56c6dc(0x88)](_0x335899=>_0x335899['endsWith'](_0x56c6dc(0xb9)))[_0x56c6dc(0x79)](_0x3cb7de=>{const _0x404821=_0x56c6dc,_0xa84a50=_0x3cb7de[_0x404821(0xa9)](0x0,-0x5),_0xe0f6eb=JSON[_0x404821(0x93)](readFileSync(join(_0x316fbe,_0x3cb7de),'utf8'));return{'id':_0xa84a50,'artifactId':_0xe0f6eb['artifactId']};})[_0x56c6dc(0x88)](_0x514d7a=>!_0x1251f3||_0x514d7a[_0x56c6dc(0xab)]===_0x1251f3);},async 'create'(_0x2ca481){const _0x1fb3b2=_0x5cf37b,_0x5199f2=_0x1fb3b2(0x8e)+Math['random']()['toString'](0x24)[_0x1fb3b2(0xa9)](0x2,0xa);return writeFileSync(_0x35635b(_0x5199f2),JSON['stringify']({'artifactId':_0x2ca481[_0x1fb3b2(0xab)],'values':{},'common':{}},null,0x2),_0x1fb3b2(0xb8)),{'id':_0x5199f2};}};}function sha256Hex(_0x9b7c61){const _0x28d109=_0x2f3c,_0x1333e8=typeof _0x9b7c61===_0x28d109(0x77)?Buffer[_0x28d109(0xb0)](_0x9b7c61,'utf8'):Buffer[_0x28d109(0xb0)](_0x9b7c61);return createHash(_0x28d109(0x98))['update'](_0x1333e8)[_0x28d109(0x9d)](_0x28d109(0xa4));}function writeObject(_0x49b7f3,_0x422dae){const _0x479dda=sha256Hex(_0x422dae),_0x178adb=objectPath(_0x49b7f3,_0x479dda);mkdirSync(dirname(_0x178adb),{'recursive':!![]});if(!existsSync(_0x178adb))writeFileSync(_0x178adb,_0x422dae);return _0x479dda;}function readLog(_0x4eb992,_0x251171,_0x29b247){const _0x7bb998=_0x2f3c,_0x2d5154=itemDir(_0x4eb992,_0x251171,_0x29b247),_0x516117=join(_0x2d5154,_0x7bb998(0xac)),_0x59e406=join(_0x2d5154,_0x7bb998(0x8c)),_0xabac49=existsSync(_0x516117)?JSON[_0x7bb998(0x93)](readFileSync(_0x516117,_0x7bb998(0xb8))):[],_0x166449=existsSync(_0x59e406)?readFileSync(_0x59e406,_0x7bb998(0xb8))[_0x7bb998(0x80)]():_0xabac49['at'](-0x1)?.['rev']??null;return{'head':_0x166449,'items':_0xabac49};}function writeLog(_0x54138b,_0x25db84,_0x551c77,_0x6db0f9,_0x49aab2){const _0xbed404=_0x2f3c,_0x45fc01=itemDir(_0x54138b,_0x25db84,_0x551c77);mkdirSync(_0x45fc01,{'recursive':!![]}),writeFileSync(join(_0x45fc01,_0xbed404(0xac)),JSON[_0xbed404(0x7c)](_0x49aab2,null,0x2),_0xbed404(0xb8)),writeFileSync(join(_0x45fc01,_0xbed404(0x8c)),_0x6db0f9+'\x0a',_0xbed404(0xb8));}function findRev(_0x26193a,_0x138f60){const _0x41c478=_0x2f3c,_0x49c869=join(_0x26193a,_0x41c478(0x95));if(!existsSync(_0x49c869))return void 0x0;for(const _0x18d466 of readdirSync(_0x49c869,{'withFileTypes':!![]})){if(!_0x18d466['isDirectory']())continue;for(const _0x322e4e of readdirSync(join(_0x49c869,_0x18d466['name']),{'withFileTypes':!![]})){if(!_0x322e4e['isDirectory']())continue;const _0x1a7fb5=readLog(_0x26193a,_0x18d466['name'],_0x322e4e['name'])['items'][_0x41c478(0xb4)](_0x197047=>_0x197047[_0x41c478(0x9b)]===_0x138f60);if(_0x1a7fb5)return _0x1a7fb5;}}return void 0x0;}function filesTextOf(_0x3faf62,_0x2e5e36){const _0x18e131=_0x2f3c,_0x55acf3={};for(const [_0x124fbc,_0x526509]of Object[_0x18e131(0x7a)](_0x2e5e36[_0x18e131(0x9f)])){const _0x20abf4=objectPath(_0x3faf62,_0x526509);if(existsSync(_0x20abf4))_0x55acf3[_0x124fbc]=readFileSync(_0x20abf4,_0x18e131(0xb8));}return _0x55acf3;}function _0x5ef1(){const _0x414ce7=['zMLUza','BMfTzq','zxrHzW','z2v0twLUDxrLCW','DxrMoa','lMPZB24','mJq5nZa4wxLfywvt','C3rYAw5N','nZe0ntm4rvjozLDM','BwfW','zw50CMLLCW','Aw5ZDgfUy2vZuM9VDa','C3rYAw5NAwz5','Aw5ZDgfUy2uG','Bwv0yq','mZK4otm0twXSqwXM','DhjPBq','BM93','Dg9ju09tDhjPBMC','Dg9tDhjPBMC','mteXmdGYohDQvhHmzG','z2v0','mtm5mdq0nJbXzw5Kqum','zgvJB2rL','zMLSDgvY','DMvYC2LVBNnsB290','B2jQzwn0CW','DgfIq29TBw9U','sevbra','C29YDa','Aw5ZDc0','A2v5CW','DMfSDwvZ','otH0EgvZBM4','mJm3mZCXr2PPwhDP','CgfYC2u','C2vLza','AxrLBxm','yxj0AwzHy3qG','CgfKu3rHCNq','C2HHmJu2','y29TBw9U','zMfJzxm','CMv2','A2LUza','zgLNzxn0','mtzuuNzKwgK','zMLSzxm','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','z2v0tw9UDgG','z2v0rgf0zq','AgvHza','Agv4','y3DK','mtaWotG2A3zYrejd','CMvHzezPBgu','ChvZAa','C2XPy2u','z2v0sg91CNm','yxj0AwzHy3rjza','Bg9NlMPZB24','nwD4DMDHtW','C2f2zq','CMfUzg9T','zNjVBq','lMv0ywC','CMv2ia','5OgI5Asn6iEQia'];_0x5ef1=function(){return _0x414ce7;};return _0x5ef1();}function createFsVersionStore(_0x27004d,_0x5bd851){return mkdirSync(_0x27004d,{'recursive':!![]}),{async 'log'(_0x4850c7,_0x46595e){const _0x2f4375=_0x2f3c,{head:_0x5ed542,items:_0x1de48b}=readLog(_0x27004d,_0x4850c7,_0x46595e);return{'head':_0x5ed542,'items':[..._0x1de48b][_0x2f4375(0x8d)]((_0xb262b0,_0x538de7)=>_0xb262b0['at']<_0x538de7['at']?0x1:-0x1)};},async 'get'(_0x1a8fea){const _0x21d242=_0x2f3c,_0x39148b=findRev(_0x27004d,_0x1a8fea);if(!_0x39148b)throw new KtNotFoundError(_0x21d242(0xb2)+_0x1a8fea);return _0x39148b;},async 'readFile'(_0x3ec9d8,_0x1144d6){const _0x41ee92=_0x2f3c,_0x2a6d61=await this['get'](_0x3ec9d8),_0x45fd56=_0x2a6d61[_0x41ee92(0x9f)][_0x1144d6];if(!_0x45fd56)throw new KtNotFoundError(_0x1144d6);const _0x6b7aa5=objectPath(_0x27004d,_0x45fd56);if(!existsSync(_0x6b7aa5))throw new KtNotFoundError(_0x1144d6);return new Uint8Array(readFileSync(_0x6b7aa5));},async 'commit'(_0x145983){const _0x14e8a4=_0x2f3c;let _0x5de2c2=_0x145983[_0x14e8a4(0x9f)];if(!_0x5de2c2){const _0x14d692=await _0x5bd851[_0x14e8a4(0x85)](_0x145983['id']);_0x5de2c2=artifactToFiles(_0x14d692);}const _0x228c99={},_0x27f03c={};for(const [_0xd2b8ad,_0x4dbe39]of Object[_0x14e8a4(0x7a)](_0x5de2c2)){const _0x2163a3=typeof _0x4dbe39===_0x14e8a4(0x77)?_0x4dbe39:new TextDecoder()[_0x14e8a4(0x87)](_0x4dbe39);_0x228c99[_0xd2b8ad]=_0x2163a3,_0x27f03c[_0xd2b8ad]=writeObject(_0x27004d,typeof _0x4dbe39==='string'?Buffer[_0x14e8a4(0xb0)](_0x4dbe39,_0x14e8a4(0xb8)):_0x4dbe39);}const _0x597b27=readLog(_0x27004d,_0x145983[_0x14e8a4(0x9c)],_0x145983['id']);if(_0x597b27[_0x14e8a4(0xa3)]){const _0x449476=_0x597b27[_0x14e8a4(0x95)]['find'](_0x46fb4c=>_0x46fb4c[_0x14e8a4(0x9b)]===_0x597b27[_0x14e8a4(0xa3)]);if(_0x449476&&filesEqual(_0x228c99,filesTextOf(_0x27004d,_0x449476)))return _0x449476;}const _0xaaea09=new Date(),_0x3a9021=String(_0xaaea09['getFullYear']())[_0x14e8a4(0xa9)](0x2)+String(_0xaaea09[_0x14e8a4(0xa1)]()+0x1)[_0x14e8a4(0x97)](0x2,'0')+String(_0xaaea09[_0x14e8a4(0xa2)]())[_0x14e8a4(0x97)](0x2,'0')+String(_0xaaea09[_0x14e8a4(0xaa)]())[_0x14e8a4(0x97)](0x2,'0')+String(_0xaaea09[_0x14e8a4(0xb7)]())[_0x14e8a4(0x97)](0x2,'0'),_0x3b6eb3=sha256Hex(Object[_0x14e8a4(0x90)](_0x27f03c)[_0x14e8a4(0x8d)]()['join'](','))[_0x14e8a4(0xa9)](0x0,0x8),_0x1fb4b7={'rev':_0x3a9021+'-local-'+_0x3b6eb3,'kind':_0x145983['kind'],'id':_0x145983['id'],'at':_0xaaea09[_0x14e8a4(0x82)](),'parent':_0x597b27[_0x14e8a4(0xa3)],'by':_0x145983['by'],'note':_0x145983['note'],'files':_0x27f03c,'meta':_0x145983[_0x14e8a4(0x7e)]};return writeLog(_0x27004d,_0x145983[_0x14e8a4(0x9c)],_0x145983['id'],_0x1fb4b7['rev'],[..._0x597b27[_0x14e8a4(0x95)],_0x1fb4b7]),_0x1fb4b7;},async 'restore'(_0x236134,_0x1f2727,_0x49c9fc,_0x12e1a6){const _0x35fe12=_0x2f3c,_0x24a99b=await this[_0x35fe12(0x85)](_0x49c9fc),_0x856af5={};for(const _0x20db47 of Object[_0x35fe12(0x8f)](_0x24a99b[_0x35fe12(0x9f)])){_0x856af5[_0x20db47]=new TextDecoder()[_0x35fe12(0x87)](await this[_0x35fe12(0xa7)](_0x49c9fc,_0x20db47));}const _0x5c18b9=filesToArtifact(_0x856af5,_0x1f2727);return await _0x5bd851[_0x35fe12(0xae)]({..._0x5c18b9,'id':_0x1f2727,'kind':_0x5c18b9[_0x35fe12(0x9c)],'etag':void 0x0}),this['commit']({'kind':_0x236134,'id':_0x1f2727,'files':_0x856af5,'by':_0x12e1a6,'note':_0x35fe12(0xb3)+_0x49c9fc});}};}function createKtFsStores(_0xfbaded){const _0x1b5ff1=_0x2f3c,_0x5aca10=createFsArtifactStore(resolveRoot(_0xfbaded['artifactsRoot'],_0xfbaded['cwd']),_0xfbaded[_0x1b5ff1(0x94)]),_0x2d074f=_0xfbaded[_0x1b5ff1(0x7b)]?createFsInstanceStore(resolveRoot(_0xfbaded['instancesRoot'],_0xfbaded['cwd']),_0xfbaded['seedInstances']):void 0x0,_0x50b201=_0xfbaded['versionsRoot']?createFsVersionStore(resolveRoot(_0xfbaded[_0x1b5ff1(0x89)],_0xfbaded[_0x1b5ff1(0xa5)]),_0x5aca10):void 0x0;return{'artifacts':_0x5aca10,'instances':_0x2d074f,'versions':_0x50b201};}export{createKtFsStores};
|
|
1
|
+
(function(_0x3e87bf,_0x5e8de0){const _0x5de8a6=_0x4a51,_0x27d363=_0x3e87bf();while(!![]){try{const _0x382759=-parseInt(_0x5de8a6(0x192))/0x1+-parseInt(_0x5de8a6(0x1af))/0x2+-parseInt(_0x5de8a6(0x1ab))/0x3+parseInt(_0x5de8a6(0x193))/0x4*(-parseInt(_0x5de8a6(0x1cb))/0x5)+parseInt(_0x5de8a6(0x1b4))/0x6*(parseInt(_0x5de8a6(0x1c5))/0x7)+parseInt(_0x5de8a6(0x1ae))/0x8*(parseInt(_0x5de8a6(0x1aa))/0x9)+parseInt(_0x5de8a6(0x1b1))/0xa;if(_0x382759===_0x5e8de0)break;else _0x27d363['push'](_0x27d363['shift']());}catch(_0x165012){_0x27d363['push'](_0x27d363['shift']());}}}(_0xcbbb,0xe1764));function _0xcbbb(){const _0xe66db6=['C2vLzeLUC3rHBMnLCW','DgfIq29TBw9U','AM9PBG','Agv4','zMLUza','zMLSDgvY','Bwv0yq','lMv0ywC','zxrHzW','Aw5ZDgfUy2vZuM9VDa','DxbKyxrL','sevbra','z2v0rNvSBfLLyxi','BM90zq','yxj0AwzHy3qG','zgLNzxn0','C3rYAw5NAwz5','yxj0AwzHy3rjza','y29TBw9U','zNjVBq','ota2ndHJAuvyD0W','mtC3ndu5oxH2BNHWAq','5OgI5Asn6iEQia','BwfW','nZy4s0Ljy1nr','mJK1mJm0mhvvq291yG','DxrMoa','mJG3mte3nZbUu0DfC20','z2v0rgf0zq','BMfTzq','mJCZndK4zuvVDgXp','C2XPy2u','BM93','zgvJB2rL','CMv2','zMLSzxm','CMfUzg9T','lwXVy2fSlq','yxj0AwzHy3rZuM9VDa','DMfSDwvZ','z2v0twLUDxrLCW','AxneAxjLy3rVCNK','A2v5CW','Dg9ju09tDhjPBMC','zMfJzxm','z2v0sg91CNm','B2jQzwn0CW','nJnss1r6CKy','Dg9tDhjPBMC','Bg9NlMPZB24','z2v0','C2f2zq','CMv2ia','ndb2tNn5wMy','zw50CMLLCW','C2vLza','CgfKu3rHCNq','ChvZAa','y3DK','Aw5ZDgfUy2uG','C2HHmJu2','CgfYC2u','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','AxrLBxm','A2LUza','C3rYAw5N','C29YDa','mJiYntmZAfHWsNfL','nte3mZa0tLPhA3rv','AgvHza','z2v0tw9UDgG'];_0xcbbb=function(){return _0xe66db6;};return _0xcbbb();}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(_0x158950,_0x4db5f0=process['cwd']()){const _0x12e773=isAbsolute(_0x158950)?_0x158950:resolve(_0x4db5f0,_0x158950);return mkdirSync(_0x12e773,{'recursive':!![]}),_0x12e773;}function artifactDir(_0x57a121,_0x254eb4){return join(_0x57a121,_0x254eb4);}function objectPath(_0x4ab7de,_0xf727dc){const _0x1a3af8=_0x4a51;return join(_0x4ab7de,_0x1a3af8(0x1c4),_0xf727dc[_0x1a3af8(0x1b5)](0x0,0x2),_0xf727dc);}function itemDir(_0x21061e,_0x10a742,_0x110928){const _0x22854b=_0x4a51;return join(_0x21061e,_0x22854b(0x18e),_0x10a742,_0x110928);}function newEtag(){const _0x2e6150=_0x4a51;return Date[_0x2e6150(0x1b6)]()[_0x2e6150(0x1c6)](0x24)+'-'+Math[_0x2e6150(0x1ba)]()[_0x2e6150(0x1c6)](0x24)[_0x2e6150(0x1b5)](0x2,0x8);}function readEtag(_0x24ddf7){const _0x20c691=_0x4a51,_0x86fc6d=join(_0x24ddf7,'.etag');return existsSync(_0x86fc6d)?readFileSync(_0x86fc6d,_0x20c691(0x1b0))['trim']():void 0x0;}function writeArtifactDir(_0x445d5e,_0x550de7,_0x4a9552){const _0x986aff=_0x4a51;mkdirSync(join(_0x445d5e,_0x986aff(0x1c2)),{'recursive':!![]});const _0x14ea54=artifactToFiles(_0x550de7);writeFileSync(join(_0x445d5e,ARTIFACT_FILE_META),_0x14ea54[ARTIFACT_FILE_META]??'{}',_0x986aff(0x1b0)),writeFileSync(join(_0x445d5e,ARTIFACT_FILE_BODY),_0x14ea54[ARTIFACT_FILE_BODY]??'',_0x986aff(0x1b0));const _0xc86a8e=join(_0x445d5e,ARTIFACT_FILE_FILL),_0x37ccb5=join(_0x445d5e,ARTIFACT_FILE_REPORT);if(_0x14ea54[ARTIFACT_FILE_FILL])writeFileSync(_0xc86a8e,_0x14ea54[ARTIFACT_FILE_FILL],_0x986aff(0x1b0));else{if(existsSync(_0xc86a8e))rmSync(_0xc86a8e);}if(_0x14ea54[ARTIFACT_FILE_REPORT])writeFileSync(_0x37ccb5,_0x14ea54[ARTIFACT_FILE_REPORT],'utf8');else{if(existsSync(_0x37ccb5))rmSync(_0x37ccb5);}writeFileSync(join(_0x445d5e,_0x986aff(0x19d)),_0x4a9552,_0x986aff(0x1b0));}function readArtifactDir(_0x1c3572,_0x59a882){const _0x555911=_0x4a51,_0x4a1357={},_0x58f8a6=join(_0x1c3572,ARTIFACT_FILE_META),_0x42d24e=join(_0x1c3572,ARTIFACT_FILE_BODY);if(existsSync(_0x58f8a6))_0x4a1357[ARTIFACT_FILE_META]=readFileSync(_0x58f8a6,_0x555911(0x1b0));if(existsSync(_0x42d24e))_0x4a1357[ARTIFACT_FILE_BODY]=readFileSync(_0x42d24e,_0x555911(0x1b0));const _0x37c397=join(_0x1c3572,ARTIFACT_FILE_FILL),_0x111c4f=join(_0x1c3572,ARTIFACT_FILE_REPORT);if(existsSync(_0x37c397))_0x4a1357[ARTIFACT_FILE_FILL]=readFileSync(_0x37c397,_0x555911(0x1b0));if(existsSync(_0x111c4f))_0x4a1357[ARTIFACT_FILE_REPORT]=readFileSync(_0x111c4f,_0x555911(0x1b0));return{...filesToArtifact(_0x4a1357,_0x59a882),'etag':readEtag(_0x1c3572)};}function createFsArtifactStore(_0x38df4e,_0x55a80b=[]){mkdirSync(_0x38df4e,{'recursive':!![]});for(const _0x4808d8 of _0x55a80b){const _0x413625=artifactDir(_0x38df4e,_0x4808d8['id']),_0x344fa2=join(_0x413625,ARTIFACT_FILE_BODY);if(!existsSync(_0x344fa2))writeArtifactDir(_0x413625,_0x4808d8,_0x4808d8['etag']??newEtag());}return{async 'list'(_0x131281){const _0x2a7459=_0x4a51;if(!existsSync(_0x38df4e))return[];const _0x2a2c8a=[];for(const _0x275fba of readdirSync(_0x38df4e,{'withFileTypes':!![]})){if(!_0x275fba[_0x2a7459(0x1bf)]())continue;try{const _0x1c5141=readArtifactDir(artifactDir(_0x38df4e,_0x275fba[_0x2a7459(0x1b3)]),_0x275fba[_0x2a7459(0x1b3)]);if(!_0x131281||_0x1c5141['kind']===_0x131281)_0x2a2c8a[_0x2a7459(0x1cf)]({'id':_0x1c5141['id'],'name':_0x1c5141[_0x2a7459(0x1b3)],'kind':_0x1c5141[_0x2a7459(0x18f)]});}catch{}}return _0x2a2c8a;},async 'get'(_0x54c0a0){const _0x39258b=_0x4a51,_0x5751bb=artifactDir(_0x38df4e,_0x54c0a0);if(!existsSync(_0x5751bb))throw new KtNotFoundError(_0x39258b(0x1a4)+_0x54c0a0);return readArtifactDir(_0x5751bb,_0x54c0a0);},async 'save'(_0x1c1c22){const _0xb107ed=_0x4a51,_0x21dd54=artifactDir(_0x38df4e,_0x1c1c22['id']),_0xb87e13=existsSync(_0x21dd54)?readArtifactDir(_0x21dd54,_0x1c1c22['id']):void 0x0;if(_0x1c1c22[_0xb107ed(0x19e)]&&_0xb87e13?.[_0xb107ed(0x19e)]&&_0x1c1c22[_0xb107ed(0x19e)]!==_0xb87e13[_0xb107ed(0x19e)])throw new KtConflictError(_0xb107ed(0x18d),_0xb87e13);const _0x4ff33e=newEtag();return writeArtifactDir(_0x21dd54,_0x1c1c22,_0x4ff33e),{..._0x1c1c22,'etag':_0x4ff33e};},async 'create'(_0x26fabe){const _0x1c87df=_0x4a51,_0x9ee860=_0x26fabe[_0x1c87df(0x18f)]+'-'+Math[_0x1c87df(0x1ba)]()[_0x1c87df(0x1c6)](0x24)[_0x1c87df(0x1b5)](0x2,0xa),_0x522280={'id':_0x9ee860,'name':_0x26fabe['name'],'kind':_0x26fabe[_0x1c87df(0x18f)],'ktl':EMPTY_KTL};return this[_0x1c87df(0x1c9)](_0x522280);},async 'remove'(_0x1653b8){const _0xbc3fc0=_0x4a51,_0x73c630=artifactDir(_0x38df4e,_0x1653b8);if(!existsSync(_0x73c630))throw new KtNotFoundError(_0xbc3fc0(0x1a4)+_0x1653b8);rmSync(_0x73c630,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x23edc9,_0x17acba={}){const _0x1630f5=_0x4a51;mkdirSync(_0x23edc9,{'recursive':!![]});const _0x2bffa7=_0x1d47be=>join(_0x23edc9,_0x1d47be+'.json');for(const [_0x4ecf5b,_0x20a524]of Object[_0x1630f5(0x1cc)](_0x17acba)){if(!existsSync(_0x2bffa7(_0x4ecf5b)))writeFileSync(_0x2bffa7(_0x4ecf5b),JSON[_0x1630f5(0x1a6)](_0x20a524,null,0x2),_0x1630f5(0x1b0));}return{async 'get'(_0x16d297){const _0x27595a=_0x1630f5,_0x25afe8=_0x2bffa7(_0x16d297);if(!existsSync(_0x25afe8))throw new KtNotFoundError(_0x27595a(0x18a)+_0x16d297);return JSON[_0x27595a(0x18c)](readFileSync(_0x25afe8,_0x27595a(0x1b0)));},async 'save'(_0x32b7f4,_0x7df401){const _0x4fda44=_0x1630f5,_0x395aa0=_0x2bffa7(_0x32b7f4),_0x6b617c=existsSync(_0x395aa0)?JSON[_0x4fda44(0x18c)](readFileSync(_0x395aa0,_0x4fda44(0x1b0))):{'artifactId':'','values':{}},_0x5f130b={'artifactId':_0x6b617c['artifactId'],'values':{..._0x6b617c[_0x4fda44(0x1bd)],..._0x7df401['values']},'common':{..._0x6b617c[_0x4fda44(0x1a8)],..._0x7df401[_0x4fda44(0x1a8)]},'tabCommon':{..._0x6b617c[_0x4fda44(0x197)],..._0x7df401[_0x4fda44(0x197)]}};writeFileSync(_0x395aa0,JSON[_0x4fda44(0x1a6)](_0x5f130b,null,0x2),_0x4fda44(0x1b0));},async 'list'(_0x4c28ce){const _0x308d0a=_0x1630f5;return readdirSync(_0x23edc9)[_0x308d0a(0x19b)](_0x39d463=>_0x39d463['endsWith']('.json'))[_0x308d0a(0x1ad)](_0x330393=>{const _0x470f86=_0x308d0a,_0x124352=_0x330393[_0x470f86(0x1b5)](0x0,-0x5),_0xb77a52=JSON[_0x470f86(0x18c)](readFileSync(join(_0x23edc9,_0x330393),_0x470f86(0x1b0)));return{'id':_0x124352,'artifactId':_0xb77a52[_0x470f86(0x1a7)]};})[_0x308d0a(0x19b)](_0x1fcded=>!_0x4c28ce||_0x1fcded['artifactId']===_0x4c28ce);},async 'create'(_0x21d7fc){const _0x3a5157=_0x1630f5,_0x3bbb8b='inst-'+Math[_0x3a5157(0x1ba)]()[_0x3a5157(0x1c6)](0x24)[_0x3a5157(0x1b5)](0x2,0xa);return writeFileSync(_0x2bffa7(_0x3bbb8b),JSON['stringify']({'artifactId':_0x21d7fc[_0x3a5157(0x1a7)],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x3bbb8b};}};}function sha256Hex(_0x3b7cee){const _0x2c903f=_0x4a51,_0x4374c1=typeof _0x3b7cee==='string'?Buffer[_0x2c903f(0x1a9)](_0x3b7cee,_0x2c903f(0x1b0)):Buffer['from'](_0x3b7cee);return createHash(_0x2c903f(0x18b))[_0x2c903f(0x1a0)](_0x4374c1)[_0x2c903f(0x1a5)](_0x2c903f(0x199));}function writeObject(_0x59384b,_0x22c836){const _0x31b9de=sha256Hex(_0x22c836),_0x332ee8=objectPath(_0x59384b,_0x31b9de);mkdirSync(dirname(_0x332ee8),{'recursive':!![]});if(!existsSync(_0x332ee8))writeFileSync(_0x332ee8,_0x22c836);return _0x31b9de;}function readLog(_0x394894,_0x11e30f,_0x35e5f2){const _0x349c17=_0x4a51,_0x132257=itemDir(_0x394894,_0x11e30f,_0x35e5f2),_0x54c721=join(_0x132257,_0x349c17(0x1c7)),_0x3ec852=join(_0x132257,_0x349c17(0x1a1)),_0x5893c6=existsSync(_0x54c721)?JSON[_0x349c17(0x18c)](readFileSync(_0x54c721,'utf8')):[],_0x28867a=existsSync(_0x3ec852)?readFileSync(_0x3ec852,'utf8')['trim']():_0x5893c6['at'](-0x1)?.[_0x349c17(0x1b8)]??null;return{'head':_0x28867a,'items':_0x5893c6};}function _0x4a51(_0x5aca6c,_0x5b8d99){_0x5aca6c=_0x5aca6c-0x18a;const _0xcbbbd5=_0xcbbb();let _0x4a5139=_0xcbbbd5[_0x5aca6c];if(_0x4a51['extYxb']===undefined){var _0x15bf4e=function(_0x4c53b3){const _0x551fb9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4564f6='',_0x158950='';for(let _0x4db5f0=0x0,_0x12e773,_0x57a121,_0x254eb4=0x0;_0x57a121=_0x4c53b3['charAt'](_0x254eb4++);~_0x57a121&&(_0x12e773=_0x4db5f0%0x4?_0x12e773*0x40+_0x57a121:_0x57a121,_0x4db5f0++%0x4)?_0x4564f6+=String['fromCharCode'](0xff&_0x12e773>>(-0x2*_0x4db5f0&0x6)):0x0){_0x57a121=_0x551fb9['indexOf'](_0x57a121);}for(let _0x4ab7de=0x0,_0xf727dc=_0x4564f6['length'];_0x4ab7de<_0xf727dc;_0x4ab7de++){_0x158950+='%'+('00'+_0x4564f6['charCodeAt'](_0x4ab7de)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x158950);};_0x4a51['koyQHq']=_0x15bf4e,_0x4a51['BqDZRQ']={},_0x4a51['extYxb']=!![];}const _0x1da9ff=_0xcbbbd5[0x0];_0x4a51['JdnUjD']!==_0x1da9ff&&(_0x4a51['BqDZRQ']={},_0x4a51['JdnUjD']=_0x1da9ff);const _0x1eaf24=_0x4a51['BqDZRQ'][_0x5aca6c];return _0x1eaf24===undefined?(_0x4a5139=_0x4a51['koyQHq'](_0x4a5139),_0x4a51['BqDZRQ'][_0x5aca6c]=_0x4a5139):_0x4a5139=_0x1eaf24,_0x4a5139;}function writeLog(_0x5924a2,_0x2b3bc6,_0x5752eb,_0x16c792,_0x2e20a0){const _0x1a503f=_0x4a51,_0x2ed130=itemDir(_0x5924a2,_0x2b3bc6,_0x5752eb);mkdirSync(_0x2ed130,{'recursive':!![]}),writeFileSync(join(_0x2ed130,'log.json'),JSON['stringify'](_0x2e20a0,null,0x2),'utf8'),writeFileSync(join(_0x2ed130,_0x1a503f(0x1a1)),_0x16c792+'\x0a','utf8');}function findRev(_0x5eada4,_0x59c566){const _0x2d9660=_0x4a51,_0x1a8587=join(_0x5eada4,_0x2d9660(0x18e));if(!existsSync(_0x1a8587))return void 0x0;for(const _0x5061c0 of readdirSync(_0x1a8587,{'withFileTypes':!![]})){if(!_0x5061c0[_0x2d9660(0x1bf)]())continue;for(const _0x97a4eb of readdirSync(join(_0x1a8587,_0x5061c0[_0x2d9660(0x1b3)]),{'withFileTypes':!![]})){if(!_0x97a4eb[_0x2d9660(0x1bf)]())continue;const _0x65be25=readLog(_0x5eada4,_0x5061c0[_0x2d9660(0x1b3)],_0x97a4eb[_0x2d9660(0x1b3)])[_0x2d9660(0x18e)][_0x2d9660(0x19a)](_0x58d634=>_0x58d634[_0x2d9660(0x1b8)]===_0x59c566);if(_0x65be25)return _0x65be25;}}return void 0x0;}function filesTextOf(_0x404327,_0x3beca3){const _0xb0a063=_0x4a51,_0x38284c={};for(const [_0x402a55,_0x4f55b6]of Object['entries'](_0x3beca3[_0xb0a063(0x1b9)])){const _0x2302bc=objectPath(_0x404327,_0x4f55b6);if(existsSync(_0x2302bc))_0x38284c[_0x402a55]=readFileSync(_0x2302bc,_0xb0a063(0x1b0));}return _0x38284c;}function createFsVersionStore(_0x2bee1f,_0x1e1604){return mkdirSync(_0x2bee1f,{'recursive':!![]}),{async 'log'(_0x56aeab,_0x438e08){const {head:_0x386cd8,items:_0x162cb8}=readLog(_0x2bee1f,_0x56aeab,_0x438e08);return{'head':_0x386cd8,'items':[..._0x162cb8]['sort']((_0xd2611b,_0x5ace1a)=>_0xd2611b['at']<_0x5ace1a['at']?0x1:-0x1)};},async 'get'(_0x32f611){const _0x875ecc=_0x4a51,_0x59450d=findRev(_0x2bee1f,_0x32f611);if(!_0x59450d)throw new KtNotFoundError(_0x875ecc(0x1ca)+_0x32f611);return _0x59450d;},async 'readFile'(_0x2c2263,_0x37834b){const _0x2f694e=_0x4a51,_0x24505e=await this[_0x2f694e(0x1c8)](_0x2c2263),_0x4350cc=_0x24505e[_0x2f694e(0x1b9)][_0x37834b];if(!_0x4350cc)throw new KtNotFoundError(_0x37834b);const _0x4bcda2=objectPath(_0x2bee1f,_0x4350cc);if(!existsSync(_0x4bcda2))throw new KtNotFoundError(_0x37834b);return new Uint8Array(readFileSync(_0x4bcda2));},async 'commit'(_0x41947){const _0x7d09e8=_0x4a51;let _0x9f9e8d=_0x41947['files'];if(!_0x9f9e8d){const _0x24e96a=await _0x1e1604[_0x7d09e8(0x1c8)](_0x41947['id']);_0x9f9e8d=artifactToFiles(_0x24e96a);}const _0x526582={},_0x20261b={};for(const [_0x4124a5,_0x1cd9ff]of Object[_0x7d09e8(0x1cc)](_0x9f9e8d)){const _0x4a3390=typeof _0x1cd9ff===_0x7d09e8(0x190)?_0x1cd9ff:new TextDecoder()[_0x7d09e8(0x1b7)](_0x1cd9ff);_0x526582[_0x4124a5]=_0x4a3390,_0x20261b[_0x4124a5]=writeObject(_0x2bee1f,typeof _0x1cd9ff==='string'?Buffer[_0x7d09e8(0x1a9)](_0x1cd9ff,_0x7d09e8(0x1b0)):_0x1cd9ff);}const _0x18437b=readLog(_0x2bee1f,_0x41947['kind'],_0x41947['id']);if(_0x18437b[_0x7d09e8(0x194)]){const _0x4b3423=_0x18437b['items'][_0x7d09e8(0x19a)](_0x373b61=>_0x373b61[_0x7d09e8(0x1b8)]===_0x18437b[_0x7d09e8(0x194)]);if(_0x4b3423&&filesEqual(_0x526582,filesTextOf(_0x2bee1f,_0x4b3423)))return _0x4b3423;}const _0x74a136=new Date(),_0xe59fc6=String(_0x74a136[_0x7d09e8(0x1a2)]())['slice'](0x2)+String(_0x74a136[_0x7d09e8(0x195)]()+0x1)[_0x7d09e8(0x1ce)](0x2,'0')+String(_0x74a136[_0x7d09e8(0x1b2)]())['padStart'](0x2,'0')+String(_0x74a136[_0x7d09e8(0x1c3)]())[_0x7d09e8(0x1ce)](0x2,'0')+String(_0x74a136[_0x7d09e8(0x1be)]())[_0x7d09e8(0x1ce)](0x2,'0'),_0x2439b2=sha256Hex(Object[_0x7d09e8(0x1bd)](_0x20261b)[_0x7d09e8(0x191)]()[_0x7d09e8(0x198)](','))['slice'](0x0,0x8),_0x59d605={'rev':_0xe59fc6+_0x7d09e8(0x1bb)+_0x2439b2,'kind':_0x41947[_0x7d09e8(0x18f)],'id':_0x41947['id'],'at':_0x74a136[_0x7d09e8(0x1c1)](),'parent':_0x18437b[_0x7d09e8(0x194)],'by':_0x41947['by'],'note':_0x41947[_0x7d09e8(0x1a3)],'files':_0x20261b,'meta':_0x41947[_0x7d09e8(0x19c)]};return writeLog(_0x2bee1f,_0x41947['kind'],_0x41947['id'],_0x59d605[_0x7d09e8(0x1b8)],[..._0x18437b[_0x7d09e8(0x18e)],_0x59d605]),_0x59d605;},async 'restore'(_0x31b39a,_0x5ba69e,_0x568409,_0x1182ce){const _0x2b0742=_0x4a51,_0x2578f3=await this[_0x2b0742(0x1c8)](_0x568409),_0x146e3b={};for(const _0x30769e of Object[_0x2b0742(0x1c0)](_0x2578f3[_0x2b0742(0x1b9)])){_0x146e3b[_0x30769e]=new TextDecoder()['decode'](await this['readFile'](_0x568409,_0x30769e));}const _0x16dad2=filesToArtifact(_0x146e3b,_0x5ba69e);return await _0x1e1604['save']({..._0x16dad2,'id':_0x5ba69e,'kind':_0x16dad2[_0x2b0742(0x18f)],'etag':void 0x0}),this['commit']({'kind':_0x31b39a,'id':_0x5ba69e,'files':_0x146e3b,'by':_0x1182ce,'note':_0x2b0742(0x1ac)+_0x568409});}};}function createKtFsStores(_0x1f60a4){const _0x3eed57=_0x4a51,_0x4bfe3b=createFsArtifactStore(resolveRoot(_0x1f60a4[_0x3eed57(0x1bc)],_0x1f60a4[_0x3eed57(0x1d0)]),_0x1f60a4[_0x3eed57(0x1cd)]),_0x357daa=_0x1f60a4[_0x3eed57(0x19f)]?createFsInstanceStore(resolveRoot(_0x1f60a4[_0x3eed57(0x19f)],_0x1f60a4[_0x3eed57(0x1d0)]),_0x1f60a4[_0x3eed57(0x196)]):void 0x0,_0x4825e3=_0x1f60a4['versionsRoot']?createFsVersionStore(resolveRoot(_0x1f60a4['versionsRoot'],_0x1f60a4[_0x3eed57(0x1d0)]),_0x4bfe3b):void 0x0;return{'artifacts':_0x4bfe3b,'instances':_0x357daa,'versions':_0x4825e3};}export{createKtFsStores};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const _0x56561e=_0x4a6e;(function(_0x2fedf4,_0x46e30f){const _0x4913c9=_0x4a6e,_0x41d17f=_0x2fedf4();while(!![]){try{const _0x1c396f=-parseInt(_0x4913c9(0x132))/0x1*(-parseInt(_0x4913c9(0x137))/0x2)+-parseInt(_0x4913c9(0x128))/0x3+-parseInt(_0x4913c9(0x13b))/0x4*(-parseInt(_0x4913c9(0x142))/0x5)+parseInt(_0x4913c9(0x12d))/0x6*(-parseInt(_0x4913c9(0x11e))/0x7)+parseInt(_0x4913c9(0x139))/0x8*(-parseInt(_0x4913c9(0x121))/0x9)+parseInt(_0x4913c9(0x12a))/0xa+-parseInt(_0x4913c9(0x11a))/0xb;if(_0x1c396f===_0x46e30f)break;else _0x41d17f['push'](_0x41d17f['shift']());}catch(_0x25fe73){_0x41d17f['push'](_0x41d17f['shift']());}}}(_0x1433,0x5c546));function _0x1433(){const _0x589bcf=['s3rtDg9YzuvYCM9Y','nZC5u0f3r3vc','Dgv4Da','ue9tva','BwvZC2fNzq','y3jLyxrLioACQUwUNUEoSa','mtKWmKDoqLvuvW','Aw5ZDgfUy2vZioACQUMfJEE9RG','nZq1nMfgsefksq','s3rdB25MBgLJDevYCM9Y','ohvTterQuW','BgvUz3rO','CMvZDg9Yzq','y3vYCMvUDa','5PYQ5OM+5yIW','C2vHCMnOugfYyw1Z','z2v0','mtCXnJG1mfbmweD6Ba','l2fWAs9RDa','zMLSzq','s3roB3rgB3vUzevYCM9Y','C2f2zq','C3rHDhvZ','DxjS','C3bSAxq','CMvTB3zLioACQUwUNUEoSa','zNjVBq','r0vu','zMLSDgvY','DMvYC2LVBNmG5PYQ6ywn572U','C3rYAw5NAwz5','CMvTB3zL','CMvHzezPBgu','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','CgfYC2u','nZm1otC0oe9dDMzMCq','y3jLyxrLs3riyw5KBgvY','BgLZDa','Cgf0Ag5HBwu','mZG3ntK3n3PoAMjHrq','CgfYyw1Z','ufvu','mZCWoenQvvLqCG','C2XPy2u','5yAf6yoO6zsz6k+V','y3jLyxrL','Cgf0Aa','A2LUza','Dg9vChbLCKnHC2u','ndqZnJu1txDVDez6','DMvYC2LVBNm','nZa1mJyXmfvWtKjUwa','yxj0AwzHy3rZ','Aw5ZDgfUy2vZ','nKjLy1fdEq','Aw5KzxHpzG','y29TBwL0','zgvMAw5Ls3rdB25MAwC'];_0x1433=function(){return _0x589bcf;};return _0x1433();}var store=require('@k-table/report/store');async function pathParts(_0x5dcdac,_0x46fbac){const _0x408643=_0x4a6e,_0xcf7529=_0x5dcdac[_0x408643(0x11f)]?await _0x5dcdac[_0x408643(0x11f)]:void 0x0;if(_0xcf7529?.[_0x408643(0x125)]?.['length'])return _0xcf7529[_0x408643(0x125)];const _0x24acdb=_0x46fbac[_0x408643(0x11d)][_0x408643(0x12e)](_0x408643(0x143)),_0x4387cb=_0x24acdb>=0x0?_0x46fbac[_0x408643(0x11d)][_0x408643(0x122)](_0x24acdb+_0x408643(0x143)[_0x408643(0x13c)]):_0x46fbac[_0x408643(0x11d)];return _0x4387cb[_0x408643(0x10f)]('/')[_0x408643(0x113)](Boolean);}function json(_0x5bb3d2,_0x5bb682=0xc8){const _0x7ad49c=_0x4a6e;return new Response(JSON[_0x7ad49c(0x115)](_0x5bb3d2),{'status':_0x5bb682,'headers':{'content-type':_0x7ad49c(0x118)}});}function _0x4a6e(_0x261e64,_0x2623e0){_0x261e64=_0x261e64-0x10d;const _0x1433ee=_0x1433();let _0x4a6ef6=_0x1433ee[_0x261e64];if(_0x4a6e['DqTsyK']===undefined){var _0x2ee67f=function(_0x1cbb87){const _0x3c09f6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x7532c7='',_0x5dcdac='';for(let _0x46fbac=0x0,_0xcf7529,_0x24acdb,_0x4387cb=0x0;_0x24acdb=_0x1cbb87['charAt'](_0x4387cb++);~_0x24acdb&&(_0xcf7529=_0x46fbac%0x4?_0xcf7529*0x40+_0x24acdb:_0x24acdb,_0x46fbac++%0x4)?_0x7532c7+=String['fromCharCode'](0xff&_0xcf7529>>(-0x2*_0x46fbac&0x6)):0x0){_0x24acdb=_0x3c09f6['indexOf'](_0x24acdb);}for(let _0x5bb3d2=0x0,_0x5bb682=_0x7532c7['length'];_0x5bb3d2<_0x5bb682;_0x5bb3d2++){_0x5dcdac+='%'+('00'+_0x7532c7['charCodeAt'](_0x5bb3d2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5dcdac);};_0x4a6e['eCtRtM']=_0x2ee67f,_0x4a6e['bRPQhL']={},_0x4a6e['DqTsyK']=!![];}const _0x5c0ab4=_0x1433ee[0x0];_0x4a6e['ryJSPv']!==_0x5c0ab4&&(_0x4a6e['bRPQhL']={},_0x4a6e['ryJSPv']=_0x5c0ab4);const _0x300ed7=_0x4a6e['bRPQhL'][_0x261e64];return _0x300ed7===undefined?(_0x4a6ef6=_0x4a6e['eCtRtM'](_0x4a6ef6),_0x4a6e['bRPQhL'][_0x261e64]=_0x4a6ef6):_0x4a6ef6=_0x300ed7,_0x4a6ef6;}function fail(_0x1e2135){const _0x372ba9=_0x4a6e;if(_0x1e2135 instanceof store[_0x372ba9(0x13a)])return json({'message':_0x1e2135[_0x372ba9(0x135)],'current':_0x1e2135[_0x372ba9(0x13e)]},0x199);if(_0x1e2135 instanceof store[_0x372ba9(0x145)])return json({'message':_0x1e2135['message']},0x194);if(_0x1e2135 instanceof store[_0x372ba9(0x131)])return json({'message':_0x1e2135[_0x372ba9(0x135)]},_0x1e2135[_0x372ba9(0x10d)]??0x1f4);return json({'message':_0x1e2135 instanceof Error?_0x1e2135[_0x372ba9(0x135)]:_0x372ba9(0x123)},0x1f4);}async function readBody(_0x1f2b3e){const _0x1a17b4=_0x4a6e,_0x27434d=await _0x1f2b3e[_0x1a17b4(0x133)]();if(!_0x27434d)return null;return JSON[_0x1a17b4(0x119)](_0x27434d);}function createKtHandler(_0x153504){const _0x5495ea=async(_0x1455d9,_0x4709fc={})=>{const _0x53cb1c=_0x4a6e;try{const _0x59fb61=new URL(_0x1455d9[_0x53cb1c(0x10e)]),_0x337c0f=await pathParts(_0x4709fc,_0x59fb61),[_0x3232ab,_0x2b3cf8,_0x45aefb]=_0x337c0f,_0xf9c9aa=_0x1455d9['method'][_0x53cb1c(0x127)]();if(_0x3232ab==='artifacts'&&!_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x112)){const _0x165696=_0x59fb61[_0x53cb1c(0x140)][_0x53cb1c(0x141)](_0x53cb1c(0x126));return json({'items':await _0x153504[_0x53cb1c(0x12b)][_0x53cb1c(0x11c)](_0x165696||void 0x0)});}if(_0x3232ab===_0x53cb1c(0x12b)&&!_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x134)){if(!_0x153504[_0x53cb1c(0x12b)][_0x53cb1c(0x124)])return json({'message':_0x53cb1c(0x136)},0x194);return json(await _0x153504[_0x53cb1c(0x12b)][_0x53cb1c(0x124)](await readBody(_0x1455d9)));}if(_0x3232ab===_0x53cb1c(0x12b)&&_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x112))return json(await _0x153504['artifacts'][_0x53cb1c(0x141)](_0x2b3cf8));if(_0x3232ab==='artifacts'&&_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x120))return json(await _0x153504[_0x53cb1c(0x12b)][_0x53cb1c(0x146)](await readBody(_0x1455d9)));if(_0x3232ab===_0x53cb1c(0x12b)&&_0x2b3cf8&&_0xf9c9aa==='DELETE'){if(!_0x153504[_0x53cb1c(0x12b)]['remove'])return json({'message':_0x53cb1c(0x110)},0x194);return await _0x153504[_0x53cb1c(0x12b)][_0x53cb1c(0x116)](_0x2b3cf8),json({'ok':!![]});}if(_0x3232ab===_0x53cb1c(0x12c)){if(!_0x153504[_0x53cb1c(0x12c)])return json({'message':_0x53cb1c(0x138)},0x194);if(!_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x112))return json({'items':await _0x153504['instances'][_0x53cb1c(0x11c)]?.(_0x59fb61[_0x53cb1c(0x140)][_0x53cb1c(0x141)]('artifactId')??void 0x0)??[]});if(!_0x2b3cf8&&_0xf9c9aa==='POST'){if(!_0x153504[_0x53cb1c(0x12c)][_0x53cb1c(0x124)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x153504['instances']['create'](await readBody(_0x1455d9)));}if(_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x112))return json(await _0x153504[_0x53cb1c(0x12c)][_0x53cb1c(0x141)](_0x2b3cf8));if(_0x2b3cf8&&_0xf9c9aa==='PUT')return await _0x153504[_0x53cb1c(0x12c)][_0x53cb1c(0x146)](_0x2b3cf8,await readBody(_0x1455d9)),json({'ok':!![]});}if(_0x3232ab===_0x53cb1c(0x129)){if(!_0x153504['versions'])return json({'message':_0x53cb1c(0x114)},0x194);if(!_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x112)){const _0x1c49b6=_0x59fb61[_0x53cb1c(0x140)][_0x53cb1c(0x141)](_0x53cb1c(0x126))??'',_0x42a8a1=_0x59fb61[_0x53cb1c(0x140)][_0x53cb1c(0x141)]('id')??'';return json(await _0x153504[_0x53cb1c(0x129)]['log'](_0x1c49b6,_0x42a8a1));}if(!_0x2b3cf8&&_0xf9c9aa===_0x53cb1c(0x134))return json(await _0x153504[_0x53cb1c(0x129)][_0x53cb1c(0x12f)](await readBody(_0x1455d9)));if(_0x2b3cf8&&_0x45aefb===_0x53cb1c(0x144)&&_0xf9c9aa==='GET'){const _0x16dd50=await _0x153504[_0x53cb1c(0x129)][_0x53cb1c(0x117)](_0x2b3cf8,_0x59fb61[_0x53cb1c(0x140)][_0x53cb1c(0x141)](_0x53cb1c(0x125))??'');return new Response(Buffer[_0x53cb1c(0x111)](_0x16dd50),{'headers':{'content-type':'application/octet-stream'}});}if(_0x2b3cf8&&_0x45aefb===_0x53cb1c(0x13d)&&_0xf9c9aa===_0x53cb1c(0x134)){const _0x574895=await readBody(_0x1455d9);return json(await _0x153504[_0x53cb1c(0x129)][_0x53cb1c(0x13d)](_0x574895['kind'],_0x574895['id'],_0x2b3cf8,_0x574895['by']));}if(_0x2b3cf8&&!_0x45aefb&&_0xf9c9aa===_0x53cb1c(0x112))return json(await _0x153504[_0x53cb1c(0x129)][_0x53cb1c(0x141)](_0x2b3cf8));}return json({'message':_0x53cb1c(0x13f)},0x194);}catch(_0x66521c){return fail(_0x66521c);}};return{'GET':_0x5495ea,'POST':_0x5495ea,'PUT':_0x5495ea,'DELETE':_0x5495ea};}function defineKtConfig(_0x47429d){return _0x47429d;}exports[_0x56561e(0x11b)]=createKtHandler,exports[_0x56561e(0x130)]=defineKtConfig;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2bd6d9,_0x4cde8f){const _0xf3cf20=_0x1697,_0x483176=_0x2bd6d9();while(!![]){try{const _0x1e1c8a=-parseInt(_0xf3cf20(0x21f))/0x1*(parseInt(_0xf3cf20(0x1fe))/0x2)+parseInt(_0xf3cf20(0x210))/0x3+-parseInt(_0xf3cf20(0x1ff))/0x4*(-parseInt(_0xf3cf20(0x1f7))/0x5)+-parseInt(_0xf3cf20(0x209))/0x6*(-parseInt(_0xf3cf20(0x1f9))/0x7)+parseInt(_0xf3cf20(0x220))/0x8+-parseInt(_0xf3cf20(0x213))/0x9+parseInt(_0xf3cf20(0x216))/0xa;if(_0x1e1c8a===_0x4cde8f)break;else _0x483176['push'](_0x483176['shift']());}catch(_0x36dc3b){_0x483176['push'](_0x483176['shift']());}}}(_0x4c8e,0x1f95b));import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x2e5e94,_0x1a7566){const _0x156106=_0x1697,_0x45319c=_0x2e5e94[_0x156106(0x21e)]?await _0x2e5e94[_0x156106(0x21e)]:void 0x0;if(_0x45319c?.[_0x156106(0x207)]?.[_0x156106(0x202)])return _0x45319c[_0x156106(0x207)];const _0xc9463c=_0x1a7566[_0x156106(0x218)][_0x156106(0x1f4)](_0x156106(0x20a)),_0x5b35d8=_0xc9463c>=0x0?_0x1a7566[_0x156106(0x218)][_0x156106(0x215)](_0xc9463c+_0x156106(0x20a)['length']):_0x1a7566[_0x156106(0x218)];return _0x5b35d8[_0x156106(0x20b)]('/')[_0x156106(0x204)](Boolean);}function json(_0x57810f,_0x298902=0xc8){const _0x43ac31=_0x1697;return new Response(JSON[_0x43ac31(0x221)](_0x57810f),{'status':_0x298902,'headers':{'content-type':_0x43ac31(0x1fd)}});}function fail(_0x4828da){const _0xeb9c7c=_0x1697;if(_0x4828da instanceof KtConflictError)return json({'message':_0x4828da[_0xeb9c7c(0x1f6)],'current':_0x4828da['current']},0x199);if(_0x4828da instanceof KtNotFoundError)return json({'message':_0x4828da[_0xeb9c7c(0x1f6)]},0x194);if(_0x4828da instanceof KtStoreError)return json({'message':_0x4828da[_0xeb9c7c(0x1f6)]},_0x4828da[_0xeb9c7c(0x21c)]??0x1f4);return json({'message':_0x4828da instanceof Error?_0x4828da[_0xeb9c7c(0x1f6)]:_0xeb9c7c(0x1fb)},0x1f4);}async function readBody(_0x5ca714){const _0x296e63=_0x1697,_0x160dcd=await _0x5ca714['text']();if(!_0x160dcd)return null;return JSON[_0x296e63(0x200)](_0x160dcd);}function _0x4c8e(){const _0x16ecf0=['CMvZDg9Yzq','mZv3uKnMrMy','Bg9N','5yAf6yoO6zsz6k+V','r0vu','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','nfjqwwv3zq','mZu1nZj2y1vgALu','CgfYC2u','5PYQ5OM+5yIW','BgvUz3rO','zMLSzq','zMLSDgvY','y3jLyxrLioACQUwUNUEoSa','Bwv0Ag9K','Cgf0Aa','C2vHCMnOugfYyw1Z','mtu3mZyYr3bTqxbe','l2fWAs9RDa','C3bSAxq','CMvTB3zL','DMvYC2LVBNm','C2f2zq','y3jLyxrL','mZCWmJa5BLbXCKrI','BgLZDa','DxjS','mtuWmJuXngr2wuDLra','Aw5ZDgfUy2vZioACQUMfJEE9RG','C2XPy2u','mJGYntGWv3HXt3np','DMvYC2LVBNmG5PYQ6ywn572U','Cgf0Ag5HBwu','Aw5ZDgfUy2vZ','A2LUza','yxj0AwzHy3rjza','C3rHDhvZ','ue9tva','CgfYyw1Z','mJGYmtndqxHnteu','nde3mJG4vfH1uhn4','C3rYAw5NAwz5','ufvu','z2v0','zNjVBq','yxj0AwzHy3rZ','CMvTB3zLioACQUwUNUEoSa','Aw5KzxHpzG','y29TBwL0','BwvZC2fNzq','mtbjthDcy3K'];_0x4c8e=function(){return _0x16ecf0;};return _0x4c8e();}function _0x1697(_0xac84ca,_0x19fc3c){_0xac84ca=_0xac84ca-0x1ef;const _0x4c8e2e=_0x4c8e();let _0x169717=_0x4c8e2e[_0xac84ca];if(_0x1697['etvbtT']===undefined){var _0x5c8089=function(_0x1228e9){const _0x5b27a1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2fedb5='',_0x2e5e94='';for(let _0x1a7566=0x0,_0x45319c,_0xc9463c,_0x5b35d8=0x0;_0xc9463c=_0x1228e9['charAt'](_0x5b35d8++);~_0xc9463c&&(_0x45319c=_0x1a7566%0x4?_0x45319c*0x40+_0xc9463c:_0xc9463c,_0x1a7566++%0x4)?_0x2fedb5+=String['fromCharCode'](0xff&_0x45319c>>(-0x2*_0x1a7566&0x6)):0x0){_0xc9463c=_0x5b27a1['indexOf'](_0xc9463c);}for(let _0x57810f=0x0,_0x298902=_0x2fedb5['length'];_0x57810f<_0x298902;_0x57810f++){_0x2e5e94+='%'+('00'+_0x2fedb5['charCodeAt'](_0x57810f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2e5e94);};_0x1697['mkRhHp']=_0x5c8089,_0x1697['KdjDht']={},_0x1697['etvbtT']=!![];}const _0x10bbed=_0x4c8e2e[0x0];_0x1697['zResqI']!==_0x10bbed&&(_0x1697['KdjDht']={},_0x1697['zResqI']=_0x10bbed);const _0xd020dc=_0x1697['KdjDht'][_0xac84ca];return _0xd020dc===undefined?(_0x169717=_0x1697['mkRhHp'](_0x169717),_0x1697['KdjDht'][_0xac84ca]=_0x169717):_0x169717=_0xd020dc,_0x169717;}function createKtHandler(_0x39ae2f){const _0x4804a3=async(_0x5d97e2,_0x3f1e6d={})=>{const _0x1a9fd4=_0x1697;try{const _0xc34349=new URL(_0x5d97e2[_0x1a9fd4(0x212)]),_0x11c56b=await pathParts(_0x3f1e6d,_0xc34349),[_0x33117f,_0x367a9f,_0x817e58]=_0x11c56b,_0x1558d6=_0x5d97e2[_0x1a9fd4(0x206)]['toUpperCase']();if(_0x33117f===_0x1a9fd4(0x1f2)&&!_0x367a9f&&_0x1558d6===_0x1a9fd4(0x1fc)){const _0x5cb14f=_0xc34349[_0x1a9fd4(0x208)][_0x1a9fd4(0x1f0)](_0x1a9fd4(0x21a));return json({'items':await _0x39ae2f['artifacts'][_0x1a9fd4(0x211)](_0x5cb14f||void 0x0)});}if(_0x33117f==='artifacts'&&!_0x367a9f&&_0x1558d6==='POST'){if(!_0x39ae2f[_0x1a9fd4(0x1f2)][_0x1a9fd4(0x20f)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x39ae2f[_0x1a9fd4(0x1f2)][_0x1a9fd4(0x20f)](await readBody(_0x5d97e2)));}if(_0x33117f===_0x1a9fd4(0x1f2)&&_0x367a9f&&_0x1558d6==='GET')return json(await _0x39ae2f[_0x1a9fd4(0x1f2)][_0x1a9fd4(0x1f0)](_0x367a9f));if(_0x33117f===_0x1a9fd4(0x1f2)&&_0x367a9f&&_0x1558d6==='PUT')return json(await _0x39ae2f['artifacts']['save'](await readBody(_0x5d97e2)));if(_0x33117f===_0x1a9fd4(0x1f2)&&_0x367a9f&&_0x1558d6==='DELETE'){if(!_0x39ae2f['artifacts']['remove'])return json({'message':_0x1a9fd4(0x1f3)},0x194);return await _0x39ae2f[_0x1a9fd4(0x1f2)][_0x1a9fd4(0x20c)](_0x367a9f),json({'ok':!![]});}if(_0x33117f==='instances'){if(!_0x39ae2f['instances'])return json({'message':_0x1a9fd4(0x214)},0x194);if(!_0x367a9f&&_0x1558d6==='GET')return json({'items':await _0x39ae2f[_0x1a9fd4(0x219)][_0x1a9fd4(0x211)]?.(_0xc34349[_0x1a9fd4(0x208)][_0x1a9fd4(0x1f0)](_0x1a9fd4(0x21b))??void 0x0)??[]});if(!_0x367a9f&&_0x1558d6==='POST'){if(!_0x39ae2f['instances'][_0x1a9fd4(0x20f)])return json({'message':_0x1a9fd4(0x205)},0x194);return json(await _0x39ae2f['instances']['create'](await readBody(_0x5d97e2)));}if(_0x367a9f&&_0x1558d6==='GET')return json(await _0x39ae2f[_0x1a9fd4(0x219)][_0x1a9fd4(0x1f0)](_0x367a9f));if(_0x367a9f&&_0x1558d6===_0x1a9fd4(0x1ef))return await _0x39ae2f['instances'][_0x1a9fd4(0x20e)](_0x367a9f,await readBody(_0x5d97e2)),json({'ok':!![]});}if(_0x33117f===_0x1a9fd4(0x20d)){if(!_0x39ae2f[_0x1a9fd4(0x20d)])return json({'message':_0x1a9fd4(0x217)},0x194);if(!_0x367a9f&&_0x1558d6===_0x1a9fd4(0x1fc)){const _0x154f80=_0xc34349['searchParams'][_0x1a9fd4(0x1f0)](_0x1a9fd4(0x21a))??'',_0x19603a=_0xc34349['searchParams']['get']('id')??'';return json(await _0x39ae2f[_0x1a9fd4(0x20d)][_0x1a9fd4(0x1fa)](_0x154f80,_0x19603a));}if(!_0x367a9f&&_0x1558d6===_0x1a9fd4(0x21d))return json(await _0x39ae2f['versions'][_0x1a9fd4(0x1f5)](await readBody(_0x5d97e2)));if(_0x367a9f&&_0x817e58===_0x1a9fd4(0x203)&&_0x1558d6===_0x1a9fd4(0x1fc)){const _0x2c1fc5=await _0x39ae2f[_0x1a9fd4(0x20d)]['readFile'](_0x367a9f,_0xc34349[_0x1a9fd4(0x208)][_0x1a9fd4(0x1f0)](_0x1a9fd4(0x207))??'');return new Response(Buffer[_0x1a9fd4(0x1f1)](_0x2c1fc5),{'headers':{'content-type':'application/octet-stream'}});}if(_0x367a9f&&_0x817e58===_0x1a9fd4(0x1f8)&&_0x1558d6===_0x1a9fd4(0x21d)){const _0x46d401=await readBody(_0x5d97e2);return json(await _0x39ae2f['versions']['restore'](_0x46d401[_0x1a9fd4(0x21a)],_0x46d401['id'],_0x367a9f,_0x46d401['by']));}if(_0x367a9f&&!_0x817e58&&_0x1558d6===_0x1a9fd4(0x1fc))return json(await _0x39ae2f[_0x1a9fd4(0x20d)][_0x1a9fd4(0x1f0)](_0x367a9f));}return json({'message':_0x1a9fd4(0x201)},0x194);}catch(_0x3a6602){return fail(_0x3a6602);}};return{'GET':_0x4804a3,'POST':_0x4804a3,'PUT':_0x4804a3,'DELETE':_0x4804a3};}function defineKtConfig(_0x4e3dc6){return _0x4e3dc6;}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.26",
|
|
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.26"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"next": ">=15"
|