@k-table/next 1.0.33 → 1.0.34
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 _0x32a17d=_0x5b3f;(function(_0x3457e7,_0xc06680){const _0x345f9d=_0x5b3f,_0x406a3d=_0x3457e7();while(!![]){try{const _0x552c9f=-parseInt(_0x345f9d(0xa8))/0x1+-parseInt(_0x345f9d(0x9a))/0x2*(parseInt(_0x345f9d(0x9b))/0x3)+parseInt(_0x345f9d(0x9d))/0x4+-parseInt(_0x345f9d(0xba))/0x5*(parseInt(_0x345f9d(0xb9))/0x6)+parseInt(_0x345f9d(0xe8))/0x7+-parseInt(_0x345f9d(0xc0))/0x8*(parseInt(_0x345f9d(0xc3))/0x9)+parseInt(_0x345f9d(0xb8))/0xa;if(_0x552c9f===_0xc06680)break;else _0x406a3d['push'](_0x406a3d['shift']());}catch(_0x5c28e0){_0x406a3d['push'](_0x406a3d['shift']());}}}(_0x46e5,0xdce7f));var fs=require('fs'),path=require(_0x32a17d(0xe1)),store=require(_0x32a17d(0xc6)),crypto=require('crypto');function resolveRoot(_0x14895a,_0x36e078=process[_0x32a17d(0x98)]()){const _0x29d3c6=_0x32a17d,_0x17835a=path['isAbsolute'](_0x14895a)?_0x14895a:path[_0x29d3c6(0xb1)](_0x36e078,_0x14895a);return fs[_0x29d3c6(0xb5)](_0x17835a,{'recursive':!![]}),_0x17835a;}function artifactDir(_0x3c2159,_0x50d088){const _0x30cc73=_0x32a17d;return path[_0x30cc73(0xa3)](_0x3c2159,_0x50d088);}function objectPath(_0x11161e,_0x4db21a){const _0x5e38ae=_0x32a17d;return path[_0x5e38ae(0xa3)](_0x11161e,'objects',_0x4db21a['slice'](0x0,0x2),_0x4db21a);}function itemDir(_0x222ec3,_0x145376,_0x254947){const _0x553dfd=_0x32a17d;return path[_0x553dfd(0xa3)](_0x222ec3,_0x553dfd(0xc9),_0x145376,_0x254947);}function newEtag(){const _0xbf0112=_0x32a17d;return Date['now']()[_0xbf0112(0xcb)](0x24)+'-'+Math['random']()[_0xbf0112(0xcb)](0x24)['slice'](0x2,0x8);}function _0x46e5(){const _0x30d3f7=['DgfIq29TBw9U','zgLYBMfTzq','Aw5ZDc0','Cgf0Aa','lMPZB24','z2v0sg91CNm','zMLSDgvY','qvjusuzbq1rFrKLmrv9nrvrb','DMvYC2LVBNnsB290','qvjusuzbq1rFrKLmrv9ct0rz','mteWmdG2ndHWyxDvuKS','y3jLyxrLsgfZAa','Aw5ZDgfUy2uG','zMLUza','zMLSzxnuB0fYDgLMywn0','y29TBw9U','qvjusuzbq1rFrKLmrv9gsuXm','y3DK','DxrMoa','ntK5nda2CMLXBKP1','mtHJtND2suK','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','mJK2otqWmgXqChfgsa','DhjPBq','C3rYAw5NAwz5','y29TBwL0','D3jPDgvgAwXLu3LUyW','zMLSzxm','AM9PBG','CMfUzg9T','CM1tEw5J','zxrHzW','CMvHzezPBgvtEw5J','mti2mdG3nLzzr09ZzW','zMLSzxnfCxvHBa','lwXVy2fSlq','BMfTzq','yxj0AwzHy3qG','A2LUza','C3rYAw5N','AxneAxjLy3rVCNK','yxj0AwzHy3ruB0zPBgvZ','CMvZB2X2zq','CgfKu3rHCNq','DxbKyxrL','zw50CMLLCW','BwTKAxjtEw5J','sevbra','zNjVBq','mZC0nJaXmZbWDuTNy3e','mZG0tvLvELbU','odeYodvgD2T2v28','AgvHza','CgfYC2u','z2v0tw9UDgG','Aw5ZDgfUy2vZuM9VDa','5OgI5Asn6iEQia','otK5mK95tMj4va','Dg9ju09tDhjPBMC','C2f2zq','nZyXnfPRqMnzsG','CMvHzgrPCLn5BMm','yxj0AwzHy3rZuM9VDa','qgSTDgfIBguVCMvWB3j0l3n0B3jL','C2HHmJu2','DMfSDwvZ','AxrLBxm','zw5KC1DPDgG','Dg9tDhjPBMC','CMvHzezPBgu','A2v5CW','yxj0AwzHy3rjza','CMv2','lMv0ywC','zMfJzxm','C2XPy2u','ru1qvfLFs1rm','zgvJB2rL','qvjusuzbq1rFrKLmrv9srvbpuLq','zgLNzxn0','C2vLza','s3roB3rgB3vUzevYCM9Y','zxHPC3rZu3LUyW','CMv2ia','C2vLzeLUC3rHBMnLCW','C29YDa','z2v0'];_0x46e5=function(){return _0x30d3f7;};return _0x46e5();}function readEtag(_0x261cc7){const _0x37db98=_0x32a17d,_0xcea46b=path['join'](_0x261cc7,_0x37db98(0xd0));return fs[_0x37db98(0xd9)](_0xcea46b)?fs[_0x37db98(0xa7)](_0xcea46b,_0x37db98(0x99))[_0x37db98(0x9e)]():void 0x0;}function writeArtifactDir(_0x4d2628,_0x50199e,_0x4bd218){const _0x263372=_0x32a17d;fs[_0x263372(0xb5)](path[_0x263372(0xa3)](_0x4d2628,_0x263372(0xd1)),{'recursive':!![]});const _0x49ff2e=store[_0x263372(0xb0)](_0x50199e);fs[_0x263372(0xa1)](path['join'](_0x4d2628,store[_0x263372(0xe5)]),_0x49ff2e[store[_0x263372(0xe5)]]??'{}',_0x263372(0x99)),fs['writeFileSync'](path[_0x263372(0xa3)](_0x4d2628,store[_0x263372(0xe7)]),_0x49ff2e[store[_0x263372(0xe7)]]??'',_0x263372(0x99));const _0x325b1b=path[_0x263372(0xa3)](_0x4d2628,store['ARTIFACT_FILE_FILL']),_0x476bee=path[_0x263372(0xa3)](_0x4d2628,store[_0x263372(0xd5)]);if(_0x49ff2e[store['ARTIFACT_FILE_FILL']])fs[_0x263372(0xa1)](_0x325b1b,_0x49ff2e[store['ARTIFACT_FILE_FILL']],_0x263372(0x99));else{if(fs[_0x263372(0xd9)](_0x325b1b))fs[_0x263372(0xa5)](_0x325b1b);}if(_0x49ff2e[store[_0x263372(0xd5)]])fs['writeFileSync'](_0x476bee,_0x49ff2e[store[_0x263372(0xd5)]],_0x263372(0x99));else{if(fs[_0x263372(0xd9)](_0x476bee))fs['rmSync'](_0x476bee);}fs[_0x263372(0xa1)](path[_0x263372(0xa3)](_0x4d2628,_0x263372(0xd0)),_0x4bd218,'utf8');}function readArtifactDir(_0x59b4f3,_0x84cbb6){const _0x4c2fcc=_0x32a17d,_0x3a32d3={},_0x12c666=path[_0x4c2fcc(0xa3)](_0x59b4f3,store['ARTIFACT_FILE_META']),_0x54a598=path['join'](_0x59b4f3,store['ARTIFACT_FILE_BODY']);if(fs[_0x4c2fcc(0xd9)](_0x12c666))_0x3a32d3[store['ARTIFACT_FILE_META']]=fs[_0x4c2fcc(0xa7)](_0x12c666,_0x4c2fcc(0x99));if(fs[_0x4c2fcc(0xd9)](_0x54a598))_0x3a32d3[store[_0x4c2fcc(0xe7)]]=fs[_0x4c2fcc(0xa7)](_0x54a598,_0x4c2fcc(0x99));const _0x2ae6b8=path[_0x4c2fcc(0xa3)](_0x59b4f3,store[_0x4c2fcc(0xee)]),_0x12c7cf=path[_0x4c2fcc(0xa3)](_0x59b4f3,store['ARTIFACT_FILE_REPORT']);if(fs[_0x4c2fcc(0xd9)](_0x2ae6b8))_0x3a32d3[store['ARTIFACT_FILE_FILL']]=fs[_0x4c2fcc(0xa7)](_0x2ae6b8,_0x4c2fcc(0x99));if(fs['existsSync'](_0x12c7cf))_0x3a32d3[store[_0x4c2fcc(0xd5)]]=fs[_0x4c2fcc(0xa7)](_0x12c7cf,'utf8');return{...store[_0x4c2fcc(0xec)](_0x3a32d3,_0x84cbb6),'etag':readEtag(_0x59b4f3)};}function createFsArtifactStore(_0x55a66f,_0x2cec1a=[]){const _0x54d8cc=_0x32a17d;fs[_0x54d8cc(0xb5)](_0x55a66f,{'recursive':!![]});for(const _0x2f081e of _0x2cec1a){const _0x4f989a=artifactDir(_0x55a66f,_0x2f081e['id']),_0x3593ed=path[_0x54d8cc(0xa3)](_0x4f989a,store[_0x54d8cc(0xe7)]);if(!fs['existsSync'](_0x3593ed))writeArtifactDir(_0x4f989a,_0x2f081e,_0x2f081e[_0x54d8cc(0xa6)]??newEtag());}return{async 'list'(_0x2bc398){const _0x4e5cc4=_0x54d8cc;if(!fs[_0x4e5cc4(0xd9)](_0x55a66f))return[];const _0x149fb1=[];for(const _0x22e089 of fs[_0x4e5cc4(0xc4)](_0x55a66f,{'withFileTypes':!![]})){if(!_0x22e089['isDirectory']())continue;try{const _0x5be3c4=readArtifactDir(artifactDir(_0x55a66f,_0x22e089[_0x4e5cc4(0xab)]),_0x22e089[_0x4e5cc4(0xab)]);if(!_0x2bc398||_0x5be3c4[_0x4e5cc4(0xad)]===_0x2bc398)_0x149fb1['push']({'id':_0x5be3c4['id'],'name':_0x5be3c4[_0x4e5cc4(0xab)],'kind':_0x5be3c4[_0x4e5cc4(0xad)]});}catch{}}return _0x149fb1;},async 'get'(_0x3b2dc4){const _0x4339ce=_0x54d8cc,_0x3f3865=artifactDir(_0x55a66f,_0x3b2dc4);if(!fs[_0x4339ce(0xd9)](_0x3f3865))throw new store[(_0x4339ce(0xd8))](_0x4339ce(0xac)+_0x3b2dc4);return readArtifactDir(_0x3f3865,_0x3b2dc4);},async 'save'(_0x3626ce){const _0x54a71e=_0x54d8cc,_0x219edf=artifactDir(_0x55a66f,_0x3626ce['id']),_0x38348f=fs['existsSync'](_0x219edf)?readArtifactDir(_0x219edf,_0x3626ce['id']):void 0x0;if(_0x3626ce[_0x54a71e(0xa6)]&&_0x38348f?.[_0x54a71e(0xa6)]&&_0x3626ce[_0x54a71e(0xa6)]!==_0x38348f['etag'])throw new store['KtConflictError'](_0x54a71e(0x9c),_0x38348f);const _0x91d96c=newEtag();return writeArtifactDir(_0x219edf,_0x3626ce,_0x91d96c),{..._0x3626ce,'etag':_0x91d96c};},async 'create'(_0x192d6a){const _0x3b18f5=_0x54d8cc,_0x57fa34=_0x192d6a['kind']+'-'+Math[_0x3b18f5(0xa4)]()['toString'](0x24)['slice'](0x2,0xa),_0x48aa06={'id':_0x57fa34,'name':_0x192d6a[_0x3b18f5(0xab)],'kind':_0x192d6a[_0x3b18f5(0xad)],'ktl':store[_0x3b18f5(0xd3)]};return this[_0x3b18f5(0xc2)](_0x48aa06);},async 'remove'(_0xf7d3ad){const _0xd4bb57=_0x54d8cc,_0x584657=artifactDir(_0x55a66f,_0xf7d3ad);if(!fs[_0xd4bb57(0xd9)](_0x584657))throw new store[(_0xd4bb57(0xd8))](_0xd4bb57(0xac)+_0xf7d3ad);fs[_0xd4bb57(0xa5)](_0x584657,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x1c408a,_0x499587={}){const _0x5f3379=_0x32a17d;fs['mkdirSync'](_0x1c408a,{'recursive':!![]});const _0x496b07=_0x5bc3c1=>path[_0x5f3379(0xa3)](_0x1c408a,_0x5bc3c1+_0x5f3379(0xe2));for(const [_0x9cb282,_0x5c5c88]of Object[_0x5f3379(0xb4)](_0x499587)){if(!fs['existsSync'](_0x496b07(_0x9cb282)))fs[_0x5f3379(0xa1)](_0x496b07(_0x9cb282),JSON[_0x5f3379(0x9f)](_0x5c5c88,null,0x2),_0x5f3379(0x99));}return{async 'get'(_0x147004){const _0x54b869=_0x5f3379,_0x3e0636=_0x496b07(_0x147004);if(!fs[_0x54b869(0xd9)](_0x3e0636))throw new store[(_0x54b869(0xd8))](_0x54b869(0xea)+_0x147004);return JSON['parse'](fs[_0x54b869(0xa7)](_0x3e0636,_0x54b869(0x99)));},async 'save'(_0x169d9d,_0x156b4a){const _0x39c8b0=_0x5f3379,_0x4a665a=_0x496b07(_0x169d9d),_0x538013=fs[_0x39c8b0(0xd9)](_0x4a665a)?JSON[_0x39c8b0(0xbc)](fs[_0x39c8b0(0xa7)](_0x4a665a,_0x39c8b0(0x99))):{'artifactId':'','values':{}},_0x16e73a={'artifactId':_0x538013['artifactId'],'values':{..._0x538013[_0x39c8b0(0xc8)],..._0x156b4a[_0x39c8b0(0xc8)]},'common':{..._0x538013[_0x39c8b0(0xed)],..._0x156b4a['common']},'tabCommon':{..._0x538013['tabCommon'],..._0x156b4a[_0x39c8b0(0xde)]}};fs['writeFileSync'](_0x4a665a,JSON[_0x39c8b0(0x9f)](_0x16e73a,null,0x2),_0x39c8b0(0x99));},async 'list'(_0x1b5162){const _0x2de471=_0x5f3379;return fs['readdirSync'](_0x1c408a)[_0x2de471(0xe4)](_0x3e5ddf=>_0x3e5ddf[_0x2de471(0xca)](_0x2de471(0xe2)))['map'](_0x1a901a=>{const _0x183f16=_0x2de471,_0x18e04a=_0x1a901a['slice'](0x0,-0x5),_0x219376=JSON[_0x183f16(0xbc)](fs[_0x183f16(0xa7)](path[_0x183f16(0xa3)](_0x1c408a,_0x1a901a),'utf8'));return{'id':_0x18e04a,'artifactId':_0x219376[_0x183f16(0xce)]};})['filter'](_0xdadbef=>!_0x1b5162||_0xdadbef[_0x2de471(0xce)]===_0x1b5162);},async 'create'(_0x44fef3){const _0x39dedf=_0x5f3379,_0x434ea6=_0x39dedf(0xe0)+Math[_0x39dedf(0xa4)]()[_0x39dedf(0xcb)](0x24)[_0x39dedf(0xd2)](0x2,0xa);return fs[_0x39dedf(0xa1)](_0x496b07(_0x434ea6),JSON['stringify']({'artifactId':_0x44fef3['artifactId'],'values':{},'common':{}},null,0x2),_0x39dedf(0x99)),{'id':_0x434ea6};}};}function sha256Hex(_0x1eaa3b){const _0x4f258b=_0x32a17d,_0x2383c8=typeof _0x1eaa3b===_0x4f258b(0xae)?Buffer['from'](_0x1eaa3b,'utf8'):Buffer[_0x4f258b(0xb7)](_0x1eaa3b);return crypto[_0x4f258b(0xe9)](_0x4f258b(0xc7))[_0x4f258b(0xb3)](_0x2383c8)[_0x4f258b(0xd6)]('hex');}function _0x5b3f(_0x317f5e,_0x3345a8){_0x317f5e=_0x317f5e-0x98;const _0x46e5a1=_0x46e5();let _0x5b3f74=_0x46e5a1[_0x317f5e];if(_0x5b3f['fODoPl']===undefined){var _0x35b4ea=function(_0x3cf26a){const _0x101292='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x40e149='',_0x14895a='';for(let _0x36e078=0x0,_0x17835a,_0x3c2159,_0x50d088=0x0;_0x3c2159=_0x3cf26a['charAt'](_0x50d088++);~_0x3c2159&&(_0x17835a=_0x36e078%0x4?_0x17835a*0x40+_0x3c2159:_0x3c2159,_0x36e078++%0x4)?_0x40e149+=String['fromCharCode'](0xff&_0x17835a>>(-0x2*_0x36e078&0x6)):0x0){_0x3c2159=_0x101292['indexOf'](_0x3c2159);}for(let _0x11161e=0x0,_0x4db21a=_0x40e149['length'];_0x11161e<_0x4db21a;_0x11161e++){_0x14895a+='%'+('00'+_0x40e149['charCodeAt'](_0x11161e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x14895a);};_0x5b3f['kGWMae']=_0x35b4ea,_0x5b3f['TIjDpY']={},_0x5b3f['fODoPl']=!![];}const _0x3f6c91=_0x46e5a1[0x0];_0x5b3f['JejUfy']!==_0x3f6c91&&(_0x5b3f['TIjDpY']={},_0x5b3f['JejUfy']=_0x3f6c91);const _0x1479e9=_0x5b3f['TIjDpY'][_0x317f5e];return _0x1479e9===undefined?(_0x5b3f74=_0x5b3f['kGWMae'](_0x5b3f74),_0x5b3f['TIjDpY'][_0x317f5e]=_0x5b3f74):_0x5b3f74=_0x1479e9,_0x5b3f74;}function writeObject(_0x139970,_0x3d8cc8){const _0x430201=_0x32a17d,_0x22ee05=sha256Hex(_0x3d8cc8),_0x43422a=objectPath(_0x139970,_0x22ee05);fs[_0x430201(0xb5)](path[_0x430201(0xdf)](_0x43422a),{'recursive':!![]});if(!fs['existsSync'](_0x43422a))fs[_0x430201(0xa1)](_0x43422a,_0x3d8cc8);return _0x22ee05;}function readLog(_0x34e58d,_0x4ff3e1,_0x229b5d){const _0x475bd4=_0x32a17d,_0x53209f=itemDir(_0x34e58d,_0x4ff3e1,_0x229b5d),_0x54d888=path['join'](_0x53209f,'log.json'),_0x3caf7e=path[_0x475bd4(0xa3)](_0x53209f,_0x475bd4(0xb6)),_0x24ee6b=fs['existsSync'](_0x54d888)?JSON[_0x475bd4(0xbc)](fs[_0x475bd4(0xa7)](_0x54d888,_0x475bd4(0x99))):[],_0x6f96b2=fs[_0x475bd4(0xd9)](_0x3caf7e)?fs['readFileSync'](_0x3caf7e,'utf8')[_0x475bd4(0x9e)]():_0x24ee6b['at'](-0x1)?.['rev']??null;return{'head':_0x6f96b2,'items':_0x24ee6b};}function writeLog(_0x475482,_0x11a881,_0x2c1c21,_0x50392c,_0x36895a){const _0x2c64f8=_0x32a17d,_0x8fb56b=itemDir(_0x475482,_0x11a881,_0x2c1c21);fs[_0x2c64f8(0xb5)](_0x8fb56b,{'recursive':!![]}),fs[_0x2c64f8(0xa1)](path[_0x2c64f8(0xa3)](_0x8fb56b,'log.json'),JSON[_0x2c64f8(0x9f)](_0x36895a,null,0x2),_0x2c64f8(0x99)),fs[_0x2c64f8(0xa1)](path[_0x2c64f8(0xa3)](_0x8fb56b,_0x2c64f8(0xb6)),_0x50392c+'\x0a',_0x2c64f8(0x99));}function findRev(_0x324ff3,_0x53659e){const _0x27d501=_0x32a17d,_0x107b46=path['join'](_0x324ff3,'items');if(!fs[_0x27d501(0xd9)](_0x107b46))return void 0x0;for(const _0x470b4d of fs[_0x27d501(0xc4)](_0x107b46,{'withFileTypes':!![]})){if(!_0x470b4d[_0x27d501(0xaf)]())continue;for(const _0x88f643 of fs['readdirSync'](path['join'](_0x107b46,_0x470b4d[_0x27d501(0xab)]),{'withFileTypes':!![]})){if(!_0x88f643[_0x27d501(0xaf)]())continue;const _0x34b96e=readLog(_0x324ff3,_0x470b4d[_0x27d501(0xab)],_0x88f643[_0x27d501(0xab)])[_0x27d501(0xc9)][_0x27d501(0xeb)](_0x42b85a=>_0x42b85a[_0x27d501(0xcf)]===_0x53659e);if(_0x34b96e)return _0x34b96e;}}return void 0x0;}function filesTextOf(_0x1d6cde,_0x2161fa){const _0x2f913f=_0x32a17d,_0x2562f6={};for(const [_0x14605b,_0x461ada]of Object[_0x2f913f(0xb4)](_0x2161fa['files'])){const _0x50c397=objectPath(_0x1d6cde,_0x461ada);if(fs['existsSync'](_0x50c397))_0x2562f6[_0x14605b]=fs[_0x2f913f(0xa7)](_0x50c397,_0x2f913f(0x99));}return _0x2562f6;}function createFsVersionStore(_0xd51e2a,_0x42cb1d){const _0x2f6faa=_0x32a17d;return fs[_0x2f6faa(0xb5)](_0xd51e2a,{'recursive':!![]}),{async 'log'(_0x26ba03,_0x321106){const _0x37eb21=_0x2f6faa,{head:_0xf0b866,items:_0x4088eb}=readLog(_0xd51e2a,_0x26ba03,_0x321106);return{'head':_0xf0b866,'items':[..._0x4088eb][_0x37eb21(0xdc)]((_0x2bc04c,_0xc2f345)=>_0x2bc04c['at']<_0xc2f345['at']?0x1:-0x1)};},async 'get'(_0x5e2a95){const _0x191474=_0x2f6faa,_0x2bf1e5=findRev(_0xd51e2a,_0x5e2a95);if(!_0x2bf1e5)throw new store['KtNotFoundError'](_0x191474(0xda)+_0x5e2a95);return _0x2bf1e5;},async 'readFile'(_0x102b7d,_0x56bf30){const _0x4a1606=_0x2f6faa,_0x5c1e8d=await this[_0x4a1606(0xdd)](_0x102b7d),_0x1bb9c5=_0x5c1e8d[_0x4a1606(0xa2)][_0x56bf30];if(!_0x1bb9c5)throw new store[(_0x4a1606(0xd8))](_0x56bf30);const _0x5ad934=objectPath(_0xd51e2a,_0x1bb9c5);if(!fs[_0x4a1606(0xd9)](_0x5ad934))throw new store[(_0x4a1606(0xd8))](_0x56bf30);return new Uint8Array(fs[_0x4a1606(0xa7)](_0x5ad934));},async 'commit'(_0x3d61d0){const _0x2b2fc8=_0x2f6faa;let _0x3f3a28=_0x3d61d0[_0x2b2fc8(0xa2)];if(!_0x3f3a28){const _0x591c74=await _0x42cb1d[_0x2b2fc8(0xdd)](_0x3d61d0['id']);_0x3f3a28=store['artifactToFiles'](_0x591c74);}const _0x4c45b0={},_0x12b022={};for(const [_0x4f1d09,_0x3abb02]of Object['entries'](_0x3f3a28)){const _0x5bd28f=typeof _0x3abb02===_0x2b2fc8(0xae)?_0x3abb02:new TextDecoder()[_0x2b2fc8(0xd4)](_0x3abb02);_0x4c45b0[_0x4f1d09]=_0x5bd28f,_0x12b022[_0x4f1d09]=writeObject(_0xd51e2a,typeof _0x3abb02===_0x2b2fc8(0xae)?Buffer['from'](_0x3abb02,'utf8'):_0x3abb02);}const _0x3b3b5d=readLog(_0xd51e2a,_0x3d61d0[_0x2b2fc8(0xad)],_0x3d61d0['id']);if(_0x3b3b5d[_0x2b2fc8(0xbb)]){const _0x2fe175=_0x3b3b5d[_0x2b2fc8(0xc9)][_0x2b2fc8(0xeb)](_0x1e5cd2=>_0x1e5cd2[_0x2b2fc8(0xcf)]===_0x3b3b5d['head']);if(_0x2fe175&&store[_0x2b2fc8(0xa9)](_0x4c45b0,filesTextOf(_0xd51e2a,_0x2fe175)))return _0x2fe175;}const _0x1c1177=new Date(),_0x1dddd7=String(_0x1c1177['getFullYear']())[_0x2b2fc8(0xd2)](0x2)+String(_0x1c1177[_0x2b2fc8(0xbd)]()+0x1)[_0x2b2fc8(0xb2)](0x2,'0')+String(_0x1c1177['getDate']())[_0x2b2fc8(0xb2)](0x2,'0')+String(_0x1c1177[_0x2b2fc8(0xe3)]())[_0x2b2fc8(0xb2)](0x2,'0')+String(_0x1c1177['getMinutes']())[_0x2b2fc8(0xb2)](0x2,'0'),_0x5663e2=sha256Hex(Object[_0x2b2fc8(0xc8)](_0x12b022)[_0x2b2fc8(0xdc)]()[_0x2b2fc8(0xa3)](','))[_0x2b2fc8(0xd2)](0x0,0x8),_0x5d16be={'rev':_0x1dddd7+_0x2b2fc8(0xaa)+_0x5663e2,'kind':_0x3d61d0[_0x2b2fc8(0xad)],'id':_0x3d61d0['id'],'at':_0x1c1177[_0x2b2fc8(0xc1)](),'parent':_0x3b3b5d['head'],'by':_0x3d61d0['by'],'note':_0x3d61d0['note'],'files':_0x12b022,'meta':_0x3d61d0['meta']};return writeLog(_0xd51e2a,_0x3d61d0['kind'],_0x3d61d0['id'],_0x5d16be[_0x2b2fc8(0xcf)],[..._0x3b3b5d['items'],_0x5d16be]),_0x5d16be;},async 'restore'(_0x2353c3,_0x474789,_0x37a7cd,_0x528476){const _0x39f528=_0x2f6faa,_0x1dd9ba=await this[_0x39f528(0xdd)](_0x37a7cd),_0x39b640={};for(const _0x44a645 of Object[_0x39f528(0xcd)](_0x1dd9ba[_0x39f528(0xa2)])){_0x39b640[_0x44a645]=new TextDecoder()[_0x39f528(0xd4)](await this[_0x39f528(0xcc)](_0x37a7cd,_0x44a645));}const _0x5f1f45=store[_0x39f528(0xec)](_0x39b640,_0x474789);return await _0x42cb1d[_0x39f528(0xc2)]({..._0x5f1f45,'id':_0x474789,'kind':_0x5f1f45['kind'],'etag':void 0x0}),this[_0x39f528(0xa0)]({'kind':_0x2353c3,'id':_0x474789,'files':_0x39b640,'by':_0x528476,'note':_0x39f528(0xbf)+_0x37a7cd});}};}function createKtFsStores(_0x133a54){const _0x484967=_0x32a17d,_0x3bd789=createFsArtifactStore(resolveRoot(_0x133a54[_0x484967(0xc5)],_0x133a54[_0x484967(0x98)]),_0x133a54[_0x484967(0xd7)]),_0x4e9194=_0x133a54[_0x484967(0xbe)]?createFsInstanceStore(resolveRoot(_0x133a54['instancesRoot'],_0x133a54[_0x484967(0x98)]),_0x133a54[_0x484967(0xdb)]):void 0x0,_0x1e20cc=_0x133a54[_0x484967(0xe6)]?createFsVersionStore(resolveRoot(_0x133a54[_0x484967(0xe6)],_0x133a54['cwd']),_0x3bd789):void 0x0;return{'artifacts':_0x3bd789,'instances':_0x4e9194,'versions':_0x1e20cc};}exports['createKtFsStores']=createKtFsStores;
|
|
1
|
+
'use strict';const _0x1c48a8=_0x4511;(function(_0x34ad96,_0x306bc8){const _0xea51f=_0x4511,_0x23ffd6=_0x34ad96();while(!![]){try{const _0x2d8635=-parseInt(_0xea51f(0x163))/0x1*(-parseInt(_0xea51f(0x168))/0x2)+parseInt(_0xea51f(0x13e))/0x3+-parseInt(_0xea51f(0x141))/0x4+-parseInt(_0xea51f(0x13d))/0x5*(-parseInt(_0xea51f(0x13a))/0x6)+-parseInt(_0xea51f(0x132))/0x7+parseInt(_0xea51f(0x159))/0x8+parseInt(_0xea51f(0x135))/0x9*(parseInt(_0xea51f(0x118))/0xa);if(_0x2d8635===_0x306bc8)break;else _0x23ffd6['push'](_0x23ffd6['shift']());}catch(_0x174353){_0x23ffd6['push'](_0x23ffd6['shift']());}}}(_0x59d8,0x2460f));var fs=require('fs'),path=require(_0x1c48a8(0x12c)),store=require(_0x1c48a8(0x14d)),crypto=require('crypto');function resolveRoot(_0x4cd9df,_0x1cbbd8=process[_0x1c48a8(0x15b)]()){const _0x55ab86=_0x1c48a8,_0x286c45=path[_0x55ab86(0x130)](_0x4cd9df)?_0x4cd9df:path['resolve'](_0x1cbbd8,_0x4cd9df);return fs[_0x55ab86(0x157)](_0x286c45,{'recursive':!![]}),_0x286c45;}function artifactDir(_0x34d923,_0x31e9a6){const _0x77f1ab=_0x1c48a8;return path[_0x77f1ab(0x12f)](_0x34d923,_0x31e9a6);}function objectPath(_0x119e30,_0x2c1b7a){const _0x359c98=_0x1c48a8;return path['join'](_0x119e30,_0x359c98(0x117),_0x2c1b7a[_0x359c98(0x15d)](0x0,0x2),_0x2c1b7a);}function itemDir(_0x5d65b3,_0x279787,_0xdad098){const _0x4eb9e1=_0x1c48a8;return path[_0x4eb9e1(0x12f)](_0x5d65b3,_0x4eb9e1(0x13c),_0x279787,_0xdad098);}function newEtag(){const _0x4d13b8=_0x1c48a8;return Date[_0x4d13b8(0x11e)]()[_0x4d13b8(0x150)](0x24)+'-'+Math[_0x4d13b8(0x145)]()[_0x4d13b8(0x150)](0x24)[_0x4d13b8(0x15d)](0x2,0x8);}function readEtag(_0x1243bf){const _0x391374=_0x1c48a8,_0x35035b=path[_0x391374(0x12f)](_0x1243bf,_0x391374(0x133));return fs[_0x391374(0x158)](_0x35035b)?fs['readFileSync'](_0x35035b,_0x391374(0x16c))[_0x391374(0x153)]():void 0x0;}function writeArtifactDir(_0x2326e8,_0x35e904,_0x309747){const _0x2b37ca=_0x1c48a8;fs[_0x2b37ca(0x157)](path[_0x2b37ca(0x12f)](_0x2326e8,_0x2b37ca(0x14e)),{'recursive':!![]});const _0x212869=store[_0x2b37ca(0x16b)](_0x35e904);fs[_0x2b37ca(0x128)](path[_0x2b37ca(0x12f)](_0x2326e8,store['ARTIFACT_FILE_META']),_0x212869[store[_0x2b37ca(0x11b)]]??'{}','utf8'),fs[_0x2b37ca(0x128)](path[_0x2b37ca(0x12f)](_0x2326e8,store['ARTIFACT_FILE_BODY']),_0x212869[store['ARTIFACT_FILE_BODY']]??'',_0x2b37ca(0x16c));const _0xc57143=path[_0x2b37ca(0x12f)](_0x2326e8,store[_0x2b37ca(0x146)]),_0x3085fe=path[_0x2b37ca(0x12f)](_0x2326e8,store[_0x2b37ca(0x167)]);if(_0x212869[store[_0x2b37ca(0x146)]])fs[_0x2b37ca(0x128)](_0xc57143,_0x212869[store['ARTIFACT_FILE_FILL']],_0x2b37ca(0x16c));else{if(fs['existsSync'](_0xc57143))fs['rmSync'](_0xc57143);}if(_0x212869[store[_0x2b37ca(0x167)]])fs[_0x2b37ca(0x128)](_0x3085fe,_0x212869[store[_0x2b37ca(0x167)]],_0x2b37ca(0x16c));else{if(fs['existsSync'](_0x3085fe))fs[_0x2b37ca(0x11c)](_0x3085fe);}fs[_0x2b37ca(0x128)](path[_0x2b37ca(0x12f)](_0x2326e8,_0x2b37ca(0x133)),_0x309747,_0x2b37ca(0x16c));}function readArtifactDir(_0x22cf00,_0x1bb90b){const _0x34c698=_0x1c48a8,_0x392d18={},_0x539027=path[_0x34c698(0x12f)](_0x22cf00,store[_0x34c698(0x11b)]),_0x1f437a=path[_0x34c698(0x12f)](_0x22cf00,store[_0x34c698(0x147)]);if(fs[_0x34c698(0x158)](_0x539027))_0x392d18[store['ARTIFACT_FILE_META']]=fs[_0x34c698(0x126)](_0x539027,_0x34c698(0x16c));if(fs['existsSync'](_0x1f437a))_0x392d18[store[_0x34c698(0x147)]]=fs[_0x34c698(0x126)](_0x1f437a,_0x34c698(0x16c));const _0x521e62=path[_0x34c698(0x12f)](_0x22cf00,store['ARTIFACT_FILE_FILL']),_0x13863e=path[_0x34c698(0x12f)](_0x22cf00,store['ARTIFACT_FILE_REPORT']);if(fs[_0x34c698(0x158)](_0x521e62))_0x392d18[store['ARTIFACT_FILE_FILL']]=fs[_0x34c698(0x126)](_0x521e62,_0x34c698(0x16c));if(fs[_0x34c698(0x158)](_0x13863e))_0x392d18[store[_0x34c698(0x167)]]=fs[_0x34c698(0x126)](_0x13863e,_0x34c698(0x16c));return{...store[_0x34c698(0x116)](_0x392d18,_0x1bb90b),'etag':readEtag(_0x22cf00)};}function createFsArtifactStore(_0xbe169,_0x41fcae=[]){const _0x7b2bfd=_0x1c48a8;fs[_0x7b2bfd(0x157)](_0xbe169,{'recursive':!![]});for(const _0x3803e2 of _0x41fcae){const _0x500982=artifactDir(_0xbe169,_0x3803e2['id']),_0x22572d=path[_0x7b2bfd(0x12f)](_0x500982,store[_0x7b2bfd(0x147)]);if(!fs[_0x7b2bfd(0x158)](_0x22572d))writeArtifactDir(_0x500982,_0x3803e2,_0x3803e2[_0x7b2bfd(0x138)]??newEtag());}return{async 'list'(_0x407b16){const _0x2c4a74=_0x7b2bfd;if(!fs[_0x2c4a74(0x158)](_0xbe169))return[];const _0x52ba3a=[];for(const _0x5323b9 of fs[_0x2c4a74(0x15a)](_0xbe169,{'withFileTypes':!![]})){if(!_0x5323b9[_0x2c4a74(0x134)]())continue;try{const _0x6e7e34=readArtifactDir(artifactDir(_0xbe169,_0x5323b9[_0x2c4a74(0x14c)]),_0x5323b9[_0x2c4a74(0x14c)]);if(!_0x407b16||_0x6e7e34[_0x2c4a74(0x115)]===_0x407b16)_0x52ba3a['push']({'id':_0x6e7e34['id'],'name':_0x6e7e34[_0x2c4a74(0x14c)],'kind':_0x6e7e34[_0x2c4a74(0x115)]});}catch{}}return _0x52ba3a;},async 'get'(_0x2644cc){const _0x5f0c51=_0x7b2bfd,_0x480694=artifactDir(_0xbe169,_0x2644cc);if(!fs[_0x5f0c51(0x158)](_0x480694))throw new store[(_0x5f0c51(0x13f))](_0x5f0c51(0x124)+_0x2644cc);return readArtifactDir(_0x480694,_0x2644cc);},async 'save'(_0x129c56){const _0x383938=_0x7b2bfd,_0x2b00b0=artifactDir(_0xbe169,_0x129c56['id']),_0x475a00=fs[_0x383938(0x158)](_0x2b00b0)?readArtifactDir(_0x2b00b0,_0x129c56['id']):void 0x0;if(_0x129c56[_0x383938(0x138)]&&_0x475a00?.[_0x383938(0x138)]&&_0x129c56['etag']!==_0x475a00[_0x383938(0x138)])throw new store[(_0x383938(0x143))](_0x383938(0x142),_0x475a00);const _0x59ea91=newEtag();return writeArtifactDir(_0x2b00b0,_0x129c56,_0x59ea91),{..._0x129c56,'etag':_0x59ea91};},async 'create'(_0x13519b){const _0x5e8cd3=_0x7b2bfd,_0x3d17ae=_0x13519b[_0x5e8cd3(0x115)]+'-'+Math[_0x5e8cd3(0x145)]()['toString'](0x24)[_0x5e8cd3(0x15d)](0x2,0xa),_0x5ac6c6={'id':_0x3d17ae,'name':_0x13519b[_0x5e8cd3(0x14c)],'kind':_0x13519b['kind'],'ktl':store[_0x5e8cd3(0x129)]};return this[_0x5e8cd3(0x156)](_0x5ac6c6);},async 'remove'(_0x4287ed){const _0x26b372=_0x7b2bfd,_0x41678a=artifactDir(_0xbe169,_0x4287ed);if(!fs['existsSync'](_0x41678a))throw new store['KtNotFoundError']('artifact\x20'+_0x4287ed);fs[_0x26b372(0x11c)](_0x41678a,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x2df1e1,_0x8533b6={}){const _0x38fabb=_0x1c48a8;fs[_0x38fabb(0x157)](_0x2df1e1,{'recursive':!![]});const _0x58f239=_0x3a082d=>path[_0x38fabb(0x12f)](_0x2df1e1,_0x3a082d+_0x38fabb(0x121));for(const [_0x316fe0,_0x3dbb14]of Object[_0x38fabb(0x11f)](_0x8533b6)){if(!fs[_0x38fabb(0x158)](_0x58f239(_0x316fe0)))fs[_0x38fabb(0x128)](_0x58f239(_0x316fe0),JSON[_0x38fabb(0x114)](_0x3dbb14,null,0x2),_0x38fabb(0x16c));}return{async 'get'(_0x4e648e){const _0x21841c=_0x38fabb,_0x58b7df=_0x58f239(_0x4e648e);if(!fs['existsSync'](_0x58b7df))throw new store[(_0x21841c(0x13f))](_0x21841c(0x144)+_0x4e648e);return JSON[_0x21841c(0x125)](fs[_0x21841c(0x126)](_0x58b7df,_0x21841c(0x16c)));},async 'save'(_0x4cfa87,_0x340c42){const _0xb510e0=_0x38fabb,_0x548e98=_0x58f239(_0x4cfa87),_0xeb38dc=fs['existsSync'](_0x548e98)?JSON[_0xb510e0(0x125)](fs[_0xb510e0(0x126)](_0x548e98,_0xb510e0(0x16c))):{'artifactId':'','values':{}},_0x95d937={'artifactId':_0xeb38dc[_0xb510e0(0x12a)],'values':{..._0xeb38dc['values'],..._0x340c42[_0xb510e0(0x169)]},'common':{..._0xeb38dc[_0xb510e0(0x149)],..._0x340c42[_0xb510e0(0x149)]},'tabCommon':{..._0xeb38dc['tabCommon'],..._0x340c42[_0xb510e0(0x14a)]}};fs['writeFileSync'](_0x548e98,JSON['stringify'](_0x95d937,null,0x2),_0xb510e0(0x16c));},async 'list'(_0x37b724){const _0x327f0c=_0x38fabb;return fs[_0x327f0c(0x15a)](_0x2df1e1)[_0x327f0c(0x123)](_0x1424fd=>_0x1424fd[_0x327f0c(0x136)](_0x327f0c(0x121)))[_0x327f0c(0x160)](_0x519b18=>{const _0x1ec8bf=_0x327f0c,_0x596467=_0x519b18[_0x1ec8bf(0x15d)](0x0,-0x5),_0x2061dc=JSON[_0x1ec8bf(0x125)](fs[_0x1ec8bf(0x126)](path[_0x1ec8bf(0x12f)](_0x2df1e1,_0x519b18),_0x1ec8bf(0x16c)));return{'id':_0x596467,'artifactId':_0x2061dc[_0x1ec8bf(0x12a)]};})[_0x327f0c(0x123)](_0x469aa5=>!_0x37b724||_0x469aa5[_0x327f0c(0x12a)]===_0x37b724);},async 'create'(_0x4bcfb5){const _0x2cae05=_0x38fabb,_0x5bb247='inst-'+Math[_0x2cae05(0x145)]()['toString'](0x24)[_0x2cae05(0x15d)](0x2,0xa);return fs[_0x2cae05(0x128)](_0x58f239(_0x5bb247),JSON[_0x2cae05(0x114)]({'artifactId':_0x4bcfb5[_0x2cae05(0x12a)],'values':{},'common':{}},null,0x2),_0x2cae05(0x16c)),{'id':_0x5bb247};}};}function sha256Hex(_0xa69759){const _0x2b3863=_0x1c48a8,_0x439f08=typeof _0xa69759===_0x2b3863(0x164)?Buffer[_0x2b3863(0x15e)](_0xa69759,_0x2b3863(0x16c)):Buffer[_0x2b3863(0x15e)](_0xa69759);return crypto[_0x2b3863(0x11d)](_0x2b3863(0x122))['update'](_0x439f08)[_0x2b3863(0x12e)](_0x2b3863(0x140));}function writeObject(_0x18d64e,_0x1ae899){const _0xe18077=_0x1c48a8,_0x559699=sha256Hex(_0x1ae899),_0x29fb21=objectPath(_0x18d64e,_0x559699);fs[_0xe18077(0x157)](path[_0xe18077(0x131)](_0x29fb21),{'recursive':!![]});if(!fs[_0xe18077(0x158)](_0x29fb21))fs[_0xe18077(0x128)](_0x29fb21,_0x1ae899);return _0x559699;}function readLog(_0x5d982e,_0x156989,_0x1ea341){const _0x352a63=_0x1c48a8,_0x2e9ad0=itemDir(_0x5d982e,_0x156989,_0x1ea341),_0x4d847a=path[_0x352a63(0x12f)](_0x2e9ad0,_0x352a63(0x15f)),_0x232101=path[_0x352a63(0x12f)](_0x2e9ad0,_0x352a63(0x120)),_0x4409e1=fs[_0x352a63(0x158)](_0x4d847a)?JSON[_0x352a63(0x125)](fs['readFileSync'](_0x4d847a,_0x352a63(0x16c))):[],_0x380a21=fs[_0x352a63(0x158)](_0x232101)?fs[_0x352a63(0x126)](_0x232101,_0x352a63(0x16c))[_0x352a63(0x153)]():_0x4409e1['at'](-0x1)?.[_0x352a63(0x161)]??null;return{'head':_0x380a21,'items':_0x4409e1};}function writeLog(_0x123537,_0x647465,_0x1de940,_0x22d8ff,_0x3519ad){const _0x2cd7cf=_0x1c48a8,_0x23811f=itemDir(_0x123537,_0x647465,_0x1de940);fs['mkdirSync'](_0x23811f,{'recursive':!![]}),fs[_0x2cd7cf(0x128)](path['join'](_0x23811f,_0x2cd7cf(0x15f)),JSON[_0x2cd7cf(0x114)](_0x3519ad,null,0x2),_0x2cd7cf(0x16c)),fs[_0x2cd7cf(0x128)](path[_0x2cd7cf(0x12f)](_0x23811f,_0x2cd7cf(0x120)),_0x22d8ff+'\x0a',_0x2cd7cf(0x16c));}function findRev(_0x28eb25,_0x5db388){const _0x3433ea=_0x1c48a8,_0x1d21ac=path[_0x3433ea(0x12f)](_0x28eb25,'items');if(!fs[_0x3433ea(0x158)](_0x1d21ac))return void 0x0;for(const _0x1870c9 of fs[_0x3433ea(0x15a)](_0x1d21ac,{'withFileTypes':!![]})){if(!_0x1870c9[_0x3433ea(0x134)]())continue;for(const _0x4b7c5c of fs['readdirSync'](path[_0x3433ea(0x12f)](_0x1d21ac,_0x1870c9['name']),{'withFileTypes':!![]})){if(!_0x4b7c5c['isDirectory']())continue;const _0x490a87=readLog(_0x28eb25,_0x1870c9[_0x3433ea(0x14c)],_0x4b7c5c[_0x3433ea(0x14c)])[_0x3433ea(0x13c)][_0x3433ea(0x127)](_0x4e4488=>_0x4e4488[_0x3433ea(0x161)]===_0x5db388);if(_0x490a87)return _0x490a87;}}return void 0x0;}function _0x4511(_0x4f85fc,_0x4e32cd){_0x4f85fc=_0x4f85fc-0x114;const _0x59d88b=_0x59d8();let _0x45117e=_0x59d88b[_0x4f85fc];if(_0x4511['VmIVwT']===undefined){var _0x2a6934=function(_0x2e0f7b){const _0x10c2e9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5320cf='',_0x4cd9df='';for(let _0x1cbbd8=0x0,_0x286c45,_0x34d923,_0x31e9a6=0x0;_0x34d923=_0x2e0f7b['charAt'](_0x31e9a6++);~_0x34d923&&(_0x286c45=_0x1cbbd8%0x4?_0x286c45*0x40+_0x34d923:_0x34d923,_0x1cbbd8++%0x4)?_0x5320cf+=String['fromCharCode'](0xff&_0x286c45>>(-0x2*_0x1cbbd8&0x6)):0x0){_0x34d923=_0x10c2e9['indexOf'](_0x34d923);}for(let _0x119e30=0x0,_0x2c1b7a=_0x5320cf['length'];_0x119e30<_0x2c1b7a;_0x119e30++){_0x4cd9df+='%'+('00'+_0x5320cf['charCodeAt'](_0x119e30)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4cd9df);};_0x4511['NnwOyU']=_0x2a6934,_0x4511['aLZYfx']={},_0x4511['VmIVwT']=!![];}const _0x383afd=_0x59d88b[0x0];_0x4511['wwpCdG']!==_0x383afd&&(_0x4511['aLZYfx']={},_0x4511['wwpCdG']=_0x383afd);const _0x561f7c=_0x4511['aLZYfx'][_0x4f85fc];return _0x561f7c===undefined?(_0x45117e=_0x4511['NnwOyU'](_0x45117e),_0x4511['aLZYfx'][_0x4f85fc]=_0x45117e):_0x45117e=_0x561f7c,_0x45117e;}function _0x59d8(){const _0x240176=['mtG3ntK2rNbbvKDW','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','s3rdB25MBgLJDevYCM9Y','Aw5ZDgfUy2uG','CMfUzg9T','qvjusuzbq1rFrKLmrv9gsuXm','qvjusuzbq1rFrKLmrv9ct0rz','AgvHza','y29TBw9U','DgfIq29TBw9U','zMLSzxnfCxvHBa','BMfTzq','qgSTDgfIBguVCMvWB3j0l3n0B3jL','zMfJzxm','CgfKu3rHCNq','Dg9tDhjPBMC','Dg9ju09tDhjPBMC','z2v0twLUDxrLCW','DhjPBq','y29TBwL0','zgvJB2rL','C2f2zq','BwTKAxjtEw5J','zxHPC3rZu3LUyW','mtCYmdqWofPWyvrzuW','CMvHzgrPCLn5BMm','y3DK','C2vLza','C2XPy2u','zNjVBq','Bg9NlMPZB24','BwfW','CMv2','lwXVy2fSlq','mZGZvgzWC1zz','C3rYAw5N','C29YDa','z2v0tw9UDgG','qvjusuzbq1rFrKLmrv9srvbpuLq','mtqWwKzwBLbS','DMfSDwvZ','DMvYC2LVBNnsB290','yxj0AwzHy3ruB0zPBgvZ','DxrMoa','zMLSzxm','y3jLyxrLs3rgC1n0B3jLCW','C3rYAw5NAwz5','A2LUza','zMLSzxnuB0fYDgLMywn0','B2jQzwn0CW','nZy3mgfOyKXmtq','z2v0rNvSBfLLyxi','z2v0rgf0zq','qvjusuzbq1rFrKLmrv9nrvrb','CM1tEw5J','y3jLyxrLsgfZAa','BM93','zw50CMLLCW','sevbra','lMPZB24','C2HHmJu2','zMLSDgvY','yxj0AwzHy3qG','CgfYC2u','CMvHzezPBgvtEw5J','zMLUza','D3jPDgvgAwXLu3LUyW','ru1qvfLFs1rm','yxj0AwzHy3rjza','z2v0','Cgf0Aa','Aw5ZDgfUy2vZuM9VDa','zgLNzxn0','AM9PBG','AxnbyNnVBhv0zq','zgLYBMfTzq','mtG5mtGYmhLjBgjbEq','lMv0ywC','AxneAxjLy3rVCNK','mJe2ouHjzNrqEG','zw5KC1DPDgG','yxj0AwzHy3rZuM9VDa','zxrHzW','z2v0sg91CNm','nLfxrLDpyG','5OgI5Asn6iEQia','AxrLBxm','mtyXndq1t1j6Ew1X','mJe1mdDHDw1jEeq','s3roB3rgB3vUzevYCM9Y','Agv4'];_0x59d8=function(){return _0x240176;};return _0x59d8();}function filesTextOf(_0xd0bc49,_0x458d48){const _0x135124=_0x1c48a8,_0x2edbea={};for(const [_0x49fe2a,_0x47ef6b]of Object[_0x135124(0x11f)](_0x458d48[_0x135124(0x16d)])){const _0x792b31=objectPath(_0xd0bc49,_0x47ef6b);if(fs[_0x135124(0x158)](_0x792b31))_0x2edbea[_0x49fe2a]=fs[_0x135124(0x126)](_0x792b31,_0x135124(0x16c));}return _0x2edbea;}function createFsVersionStore(_0x96d5ec,_0x311dcd){const _0x509b40=_0x1c48a8;return fs[_0x509b40(0x157)](_0x96d5ec,{'recursive':!![]}),{async 'log'(_0x12d342,_0x33db5d){const {head:_0x2d0fc8,items:_0x2ff8c2}=readLog(_0x96d5ec,_0x12d342,_0x33db5d);return{'head':_0x2d0fc8,'items':[..._0x2ff8c2]['sort']((_0x1de397,_0x67e940)=>_0x1de397['at']<_0x67e940['at']?0x1:-0x1)};},async 'get'(_0x44099a){const _0x50ba48=_0x509b40,_0xe291b5=findRev(_0x96d5ec,_0x44099a);if(!_0xe291b5)throw new store[(_0x50ba48(0x13f))]('rev\x20'+_0x44099a);return _0xe291b5;},async 'readFile'(_0x4f83b6,_0xa287fb){const _0x566fed=_0x509b40,_0x18996a=await this[_0x566fed(0x12b)](_0x4f83b6),_0x5b9a33=_0x18996a[_0x566fed(0x16d)][_0xa287fb];if(!_0x5b9a33)throw new store['KtNotFoundError'](_0xa287fb);const _0x293734=objectPath(_0x96d5ec,_0x5b9a33);if(!fs[_0x566fed(0x158)](_0x293734))throw new store[(_0x566fed(0x13f))](_0xa287fb);return new Uint8Array(fs[_0x566fed(0x126)](_0x293734));},async 'commit'(_0x2ee462){const _0x3beb5f=_0x509b40;let _0x26a9a2=_0x2ee462[_0x3beb5f(0x16d)];if(!_0x26a9a2){const _0x192cb1=await _0x311dcd['get'](_0x2ee462['id']);_0x26a9a2=store[_0x3beb5f(0x16b)](_0x192cb1);}const _0x3bf659={},_0x56a642={};for(const [_0x12e71b,_0x4fb1a6]of Object[_0x3beb5f(0x11f)](_0x26a9a2)){const _0x1a457e=typeof _0x4fb1a6===_0x3beb5f(0x164)?_0x4fb1a6:new TextDecoder()[_0x3beb5f(0x155)](_0x4fb1a6);_0x3bf659[_0x12e71b]=_0x1a457e,_0x56a642[_0x12e71b]=writeObject(_0x96d5ec,typeof _0x4fb1a6===_0x3beb5f(0x164)?Buffer['from'](_0x4fb1a6,'utf8'):_0x4fb1a6);}const _0x57a64a=readLog(_0x96d5ec,_0x2ee462[_0x3beb5f(0x115)],_0x2ee462['id']);if(_0x57a64a[_0x3beb5f(0x148)]){const _0x1c9f2d=_0x57a64a['items']['find'](_0x5b8ad2=>_0x5b8ad2[_0x3beb5f(0x161)]===_0x57a64a['head']);if(_0x1c9f2d&&store[_0x3beb5f(0x14b)](_0x3bf659,filesTextOf(_0x96d5ec,_0x1c9f2d)))return _0x1c9f2d;}const _0x1bacbe=new Date(),_0xfe5ce2=String(_0x1bacbe[_0x3beb5f(0x119)]())[_0x3beb5f(0x15d)](0x2)+String(_0x1bacbe[_0x3beb5f(0x166)]()+0x1)[_0x3beb5f(0x14f)](0x2,'0')+String(_0x1bacbe[_0x3beb5f(0x11a)]())[_0x3beb5f(0x14f)](0x2,'0')+String(_0x1bacbe[_0x3beb5f(0x139)]())[_0x3beb5f(0x14f)](0x2,'0')+String(_0x1bacbe[_0x3beb5f(0x152)]())[_0x3beb5f(0x14f)](0x2,'0'),_0x2d71ee=sha256Hex(Object['values'](_0x56a642)[_0x3beb5f(0x165)]()[_0x3beb5f(0x12f)](','))['slice'](0x0,0x8),_0x2e23a2={'rev':_0xfe5ce2+_0x3beb5f(0x162)+_0x2d71ee,'kind':_0x2ee462['kind'],'id':_0x2ee462['id'],'at':_0x1bacbe[_0x3beb5f(0x151)](),'parent':_0x57a64a[_0x3beb5f(0x148)],'by':_0x2ee462['by'],'note':_0x2ee462['note'],'files':_0x56a642,'meta':_0x2ee462['meta']};return writeLog(_0x96d5ec,_0x2ee462[_0x3beb5f(0x115)],_0x2ee462['id'],_0x2e23a2['rev'],[..._0x57a64a['items'],_0x2e23a2]),_0x2e23a2;},async 'restore'(_0x1cf6b9,_0x269be5,_0x4c75c7,_0x5163be){const _0x28f822=_0x509b40,_0x314173=await this[_0x28f822(0x12b)](_0x4c75c7),_0x295381={};for(const _0x3530b8 of Object['keys'](_0x314173['files'])){_0x295381[_0x3530b8]=new TextDecoder()['decode'](await this['readFile'](_0x4c75c7,_0x3530b8));}const _0x1ea399=store[_0x28f822(0x116)](_0x295381,_0x269be5);return await _0x311dcd[_0x28f822(0x156)]({..._0x1ea399,'id':_0x269be5,'kind':_0x1ea399[_0x28f822(0x115)],'etag':void 0x0}),this[_0x28f822(0x154)]({'kind':_0x1cf6b9,'id':_0x269be5,'files':_0x295381,'by':_0x5163be,'note':_0x28f822(0x13b)+_0x4c75c7});}};}function createKtFsStores(_0x31b791){const _0x34e05f=_0x1c48a8,_0x3abe03=createFsArtifactStore(resolveRoot(_0x31b791[_0x34e05f(0x137)],_0x31b791[_0x34e05f(0x15b)]),_0x31b791[_0x34e05f(0x15c)]),_0x1aff80=_0x31b791[_0x34e05f(0x12d)]?createFsInstanceStore(resolveRoot(_0x31b791['instancesRoot'],_0x31b791['cwd']),_0x31b791['seedInstances']):void 0x0,_0x12f638=_0x31b791[_0x34e05f(0x16a)]?createFsVersionStore(resolveRoot(_0x31b791[_0x34e05f(0x16a)],_0x31b791['cwd']),_0x3abe03):void 0x0;return{'artifacts':_0x3abe03,'instances':_0x1aff80,'versions':_0x12f638};}exports[_0x1c48a8(0x16e)]=createKtFsStores;
|
package/dist/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5b66fe,_0x4146cb){const _0x356e14=_0x3d54,_0xf57188=_0x5b66fe();while(!![]){try{const _0x308ca5=parseInt(_0x356e14(0xa8))/0x1*(parseInt(_0x356e14(0xb0))/0x2)+-parseInt(_0x356e14(0xa0))/0x3*(parseInt(_0x356e14(0x99))/0x4)+parseInt(_0x356e14(0x90))/0x5+-parseInt(_0x356e14(0xca))/0x6*(-parseInt(_0x356e14(0x93))/0x7)+-parseInt(_0x356e14(0xa9))/0x8+parseInt(_0x356e14(0xaf))/0x9+parseInt(_0x356e14(0x9b))/0xa*(-parseInt(_0x356e14(0xb8))/0xb);if(_0x308ca5===_0x4146cb)break;else _0xf57188['push'](_0xf57188['shift']());}catch(_0x207def){_0xf57188['push'](_0xf57188['shift']());}}}(_0x18aa,0x8d3aa));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 _0x3d54(_0x5152fe,_0x13e7b1){_0x5152fe=_0x5152fe-0x8a;const _0x18aa89=_0x18aa();let _0x3d5436=_0x18aa89[_0x5152fe];if(_0x3d54['BxAJGC']===undefined){var _0x4c1b3d=function(_0x1ce162){const _0x1a9d39='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x288594='',_0x17c666='';for(let _0x24644e=0x0,_0x564893,_0x4965db,_0x1db821=0x0;_0x4965db=_0x1ce162['charAt'](_0x1db821++);~_0x4965db&&(_0x564893=_0x24644e%0x4?_0x564893*0x40+_0x4965db:_0x4965db,_0x24644e++%0x4)?_0x288594+=String['fromCharCode'](0xff&_0x564893>>(-0x2*_0x24644e&0x6)):0x0){_0x4965db=_0x1a9d39['indexOf'](_0x4965db);}for(let _0x234e58=0x0,_0x675468=_0x288594['length'];_0x234e58<_0x675468;_0x234e58++){_0x17c666+='%'+('00'+_0x288594['charCodeAt'](_0x234e58)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x17c666);};_0x3d54['DVMMDE']=_0x4c1b3d,_0x3d54['DdJMby']={},_0x3d54['BxAJGC']=!![];}const _0x5b28be=_0x18aa89[0x0];_0x3d54['OHObQa']!==_0x5b28be&&(_0x3d54['DdJMby']={},_0x3d54['OHObQa']=_0x5b28be);const _0x2925cd=_0x3d54['DdJMby'][_0x5152fe];return _0x2925cd===undefined?(_0x3d5436=_0x3d54['DVMMDE'](_0x3d5436),_0x3d54['DdJMby'][_0x5152fe]=_0x3d5436):_0x3d5436=_0x2925cd,_0x3d5436;}function resolveRoot(_0x17c666,_0x24644e=process['cwd']()){const _0x564893=isAbsolute(_0x17c666)?_0x17c666:resolve(_0x24644e,_0x17c666);return mkdirSync(_0x564893,{'recursive':!![]}),_0x564893;}function artifactDir(_0x4965db,_0x1db821){return join(_0x4965db,_0x1db821);}function objectPath(_0x234e58,_0x675468){const _0x456e95=_0x3d54;return join(_0x234e58,'objects',_0x675468[_0x456e95(0xbc)](0x0,0x2),_0x675468);}function itemDir(_0x1553d1,_0x57c266,_0x5c4c9b){return join(_0x1553d1,'items',_0x57c266,_0x5c4c9b);}function newEtag(){const _0x26e82a=_0x3d54;return Date[_0x26e82a(0x94)]()[_0x26e82a(0xb5)](0x24)+'-'+Math[_0x26e82a(0xa5)]()[_0x26e82a(0xb5)](0x24)[_0x26e82a(0xbc)](0x2,0x8);}function readEtag(_0x20c49b){const _0x9a92fa=_0x3d54,_0xf88c36=join(_0x20c49b,_0x9a92fa(0xcd));return existsSync(_0xf88c36)?readFileSync(_0xf88c36,_0x9a92fa(0x95))['trim']():void 0x0;}function writeArtifactDir(_0x58b313,_0x2674e3,_0x18f3cf){const _0x1228aa=_0x3d54;mkdirSync(join(_0x58b313,_0x1228aa(0xd1)),{'recursive':!![]});const _0xd5c982=artifactToFiles(_0x2674e3);writeFileSync(join(_0x58b313,ARTIFACT_FILE_META),_0xd5c982[ARTIFACT_FILE_META]??'{}',_0x1228aa(0x95)),writeFileSync(join(_0x58b313,ARTIFACT_FILE_BODY),_0xd5c982[ARTIFACT_FILE_BODY]??'',_0x1228aa(0x95));const _0x124bfd=join(_0x58b313,ARTIFACT_FILE_FILL),_0x57fd80=join(_0x58b313,ARTIFACT_FILE_REPORT);if(_0xd5c982[ARTIFACT_FILE_FILL])writeFileSync(_0x124bfd,_0xd5c982[ARTIFACT_FILE_FILL],_0x1228aa(0x95));else{if(existsSync(_0x124bfd))rmSync(_0x124bfd);}if(_0xd5c982[ARTIFACT_FILE_REPORT])writeFileSync(_0x57fd80,_0xd5c982[ARTIFACT_FILE_REPORT],_0x1228aa(0x95));else{if(existsSync(_0x57fd80))rmSync(_0x57fd80);}writeFileSync(join(_0x58b313,_0x1228aa(0xcd)),_0x18f3cf,_0x1228aa(0x95));}function readArtifactDir(_0x2fdc0e,_0x19f087){const _0x496dce=_0x3d54,_0x48535e={},_0x3017eb=join(_0x2fdc0e,ARTIFACT_FILE_META),_0x164123=join(_0x2fdc0e,ARTIFACT_FILE_BODY);if(existsSync(_0x3017eb))_0x48535e[ARTIFACT_FILE_META]=readFileSync(_0x3017eb,'utf8');if(existsSync(_0x164123))_0x48535e[ARTIFACT_FILE_BODY]=readFileSync(_0x164123,_0x496dce(0x95));const _0x523932=join(_0x2fdc0e,ARTIFACT_FILE_FILL),_0xf26273=join(_0x2fdc0e,ARTIFACT_FILE_REPORT);if(existsSync(_0x523932))_0x48535e[ARTIFACT_FILE_FILL]=readFileSync(_0x523932,'utf8');if(existsSync(_0xf26273))_0x48535e[ARTIFACT_FILE_REPORT]=readFileSync(_0xf26273,_0x496dce(0x95));return{...filesToArtifact(_0x48535e,_0x19f087),'etag':readEtag(_0x2fdc0e)};}function createFsArtifactStore(_0x5d79ba,_0x1a980b=[]){mkdirSync(_0x5d79ba,{'recursive':!![]});for(const _0x4c3808 of _0x1a980b){const _0x2ec9d7=artifactDir(_0x5d79ba,_0x4c3808['id']),_0x44023a=join(_0x2ec9d7,ARTIFACT_FILE_BODY);if(!existsSync(_0x44023a))writeArtifactDir(_0x2ec9d7,_0x4c3808,_0x4c3808['etag']??newEtag());}return{async 'list'(_0x47aa26){const _0x951e71=_0x3d54;if(!existsSync(_0x5d79ba))return[];const _0x4d387d=[];for(const _0x306553 of readdirSync(_0x5d79ba,{'withFileTypes':!![]})){if(!_0x306553['isDirectory']())continue;try{const _0x5e8f94=readArtifactDir(artifactDir(_0x5d79ba,_0x306553[_0x951e71(0x91)]),_0x306553[_0x951e71(0x91)]);if(!_0x47aa26||_0x5e8f94[_0x951e71(0xb4)]===_0x47aa26)_0x4d387d[_0x951e71(0xae)]({'id':_0x5e8f94['id'],'name':_0x5e8f94['name'],'kind':_0x5e8f94['kind']});}catch{}}return _0x4d387d;},async 'get'(_0x58c5ee){const _0x4b7d00=artifactDir(_0x5d79ba,_0x58c5ee);if(!existsSync(_0x4b7d00))throw new KtNotFoundError('artifact\x20'+_0x58c5ee);return readArtifactDir(_0x4b7d00,_0x58c5ee);},async 'save'(_0x5c0f29){const _0x4f2280=_0x3d54,_0x3b8c34=artifactDir(_0x5d79ba,_0x5c0f29['id']),_0x58a029=existsSync(_0x3b8c34)?readArtifactDir(_0x3b8c34,_0x5c0f29['id']):void 0x0;if(_0x5c0f29['etag']&&_0x58a029?.[_0x4f2280(0xc8)]&&_0x5c0f29['etag']!==_0x58a029[_0x4f2280(0xc8)])throw new KtConflictError(_0x4f2280(0xd2),_0x58a029);const _0xaf8c7f=newEtag();return writeArtifactDir(_0x3b8c34,_0x5c0f29,_0xaf8c7f),{..._0x5c0f29,'etag':_0xaf8c7f};},async 'create'(_0x3fd5cb){const _0xb0c684=_0x3d54,_0x40cd9a=_0x3fd5cb[_0xb0c684(0xb4)]+'-'+Math[_0xb0c684(0xa5)]()['toString'](0x24)['slice'](0x2,0xa),_0x2399e0={'id':_0x40cd9a,'name':_0x3fd5cb[_0xb0c684(0x91)],'kind':_0x3fd5cb[_0xb0c684(0xb4)],'ktl':EMPTY_KTL};return this[_0xb0c684(0xcb)](_0x2399e0);},async 'remove'(_0x9a3a2c){const _0x2f305e=_0x3d54,_0x3e833b=artifactDir(_0x5d79ba,_0x9a3a2c);if(!existsSync(_0x3e833b))throw new KtNotFoundError(_0x2f305e(0x9a)+_0x9a3a2c);rmSync(_0x3e833b,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x415253,_0x1acc19={}){const _0x4d1270=_0x3d54;mkdirSync(_0x415253,{'recursive':!![]});const _0x4571c0=_0x274929=>join(_0x415253,_0x274929+'.json');for(const [_0x1d8f89,_0x5ba91c]of Object[_0x4d1270(0xc5)](_0x1acc19)){if(!existsSync(_0x4571c0(_0x1d8f89)))writeFileSync(_0x4571c0(_0x1d8f89),JSON[_0x4d1270(0xc4)](_0x5ba91c,null,0x2),'utf8');}return{async 'get'(_0x4d95ba){const _0x399abf=_0x4d1270,_0x56d3eb=_0x4571c0(_0x4d95ba);if(!existsSync(_0x56d3eb))throw new KtNotFoundError(_0x399abf(0xba)+_0x4d95ba);return JSON['parse'](readFileSync(_0x56d3eb,'utf8'));},async 'save'(_0x2be0db,_0x4421a2){const _0x27f3c5=_0x4d1270,_0xab18a8=_0x4571c0(_0x2be0db),_0x5a6457=existsSync(_0xab18a8)?JSON[_0x27f3c5(0xad)](readFileSync(_0xab18a8,'utf8')):{'artifactId':'','values':{}},_0x12dd45={'artifactId':_0x5a6457['artifactId'],'values':{..._0x5a6457[_0x27f3c5(0xbb)],..._0x4421a2[_0x27f3c5(0xbb)]},'common':{..._0x5a6457[_0x27f3c5(0xc2)],..._0x4421a2['common']},'tabCommon':{..._0x5a6457[_0x27f3c5(0xb7)],..._0x4421a2[_0x27f3c5(0xb7)]}};writeFileSync(_0xab18a8,JSON[_0x27f3c5(0xc4)](_0x12dd45,null,0x2),'utf8');},async 'list'(_0x1070be){const _0x3f2ac2=_0x4d1270;return readdirSync(_0x415253)[_0x3f2ac2(0xaa)](_0x213831=>_0x213831[_0x3f2ac2(0x9c)](_0x3f2ac2(0x9d)))[_0x3f2ac2(0xc9)](_0x7b9b63=>{const _0x47e052=_0x3f2ac2,_0x3b3084=_0x7b9b63[_0x47e052(0xbc)](0x0,-0x5),_0x55e808=JSON['parse'](readFileSync(join(_0x415253,_0x7b9b63),'utf8'));return{'id':_0x3b3084,'artifactId':_0x55e808[_0x47e052(0xac)]};})[_0x3f2ac2(0xaa)](_0x27b9f2=>!_0x1070be||_0x27b9f2[_0x3f2ac2(0xac)]===_0x1070be);},async 'create'(_0x3029e4){const _0x3517bd=_0x4d1270,_0x50cd40='inst-'+Math['random']()[_0x3517bd(0xb5)](0x24)[_0x3517bd(0xbc)](0x2,0xa);return writeFileSync(_0x4571c0(_0x50cd40),JSON[_0x3517bd(0xc4)]({'artifactId':_0x3029e4['artifactId'],'values':{},'common':{}},null,0x2),_0x3517bd(0x95)),{'id':_0x50cd40};}};}function sha256Hex(_0x361c2c){const _0x2946ea=_0x3d54,_0x233c8d=typeof _0x361c2c===_0x2946ea(0xb1)?Buffer['from'](_0x361c2c,_0x2946ea(0x95)):Buffer[_0x2946ea(0xa7)](_0x361c2c);return createHash('sha256')[_0x2946ea(0x98)](_0x233c8d)[_0x2946ea(0xa6)](_0x2946ea(0x9f));}function writeObject(_0x4fed6e,_0xbe4b){const _0x20c28e=sha256Hex(_0xbe4b),_0x5c184e=objectPath(_0x4fed6e,_0x20c28e);mkdirSync(dirname(_0x5c184e),{'recursive':!![]});if(!existsSync(_0x5c184e))writeFileSync(_0x5c184e,_0xbe4b);return _0x20c28e;}function _0x18aa(){const _0x17e082=['mtK2otznDg9tDe8','yxj0AwzHy3qG','mtyWDe5vwMjW','zw5KC1DPDgG','lMPZB24','z2v0twLUDxrLCW','Agv4','mZz4C0fQqMy','sevbra','C2vLza','zMLSzxm','A2v5CW','CMfUzg9T','zgLNzxn0','zNjVBq','nJm4ntfZvhjzufK','mZi1ndKYoendB0PuBq','zMLSDgvY','Dg9ju09tDhjPBMC','yxj0AwzHy3rjza','CgfYC2u','ChvZAa','mZeYmdmWmfjXCff6Bq','mtrQs0vms1u','C3rYAw5N','zMLUza','y3DK','A2LUza','Dg9tDhjPBMC','z2v0tw9UDgG','DgfIq29TBw9U','ndK1oteZy2nTDK5P','z2v0','Aw5ZDgfUy2uG','DMfSDwvZ','C2XPy2u','AxneAxjLy3rVCNK','y29TBwL0','AxrLBxm','5OgI5Asn6iEQia','DhjPBq','y29TBw9U','C2vLzeLUC3rHBMnLCW','C3rYAw5NAwz5','zw50CMLLCW','AgvHza','CgfKu3rHCNq','zxrHzW','BwfW','mtHwsvHlAge','C2f2zq','z2v0rgf0zq','lMv0ywC','AM9PBG','DMvYC2LVBNnsB290','Bwv0yq','zMfJzxm','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','CMv2','BM90zq','yxj0AwzHy3rZuM9VDa','CMvHzezPBgu','C29YDa','zgvJB2rL','lwXVy2fSlq','ndC1mte2mhPws2fpsq','BMfTzq','Aw5ZDgfUy2vZuM9VDa','nteWmJntBfnPr1K','BM93','DxrMoa','Bg9NlMPZB24','z2v0rNvSBfLLyxi','DxbKyxrL'];_0x18aa=function(){return _0x17e082;};return _0x18aa();}function readLog(_0x468231,_0x1992b1,_0x4d0229){const _0xcd2ed2=_0x3d54,_0x41abcb=itemDir(_0x468231,_0x1992b1,_0x4d0229),_0x2a6a15=join(_0x41abcb,_0xcd2ed2(0x96)),_0x55520c=join(_0x41abcb,_0xcd2ed2(0xa1)),_0x20a44d=existsSync(_0x2a6a15)?JSON[_0xcd2ed2(0xad)](readFileSync(_0x2a6a15,_0xcd2ed2(0x95))):[],_0x392c29=existsSync(_0x55520c)?readFileSync(_0x55520c,_0xcd2ed2(0x95))[_0xcd2ed2(0xc1)]():_0x20a44d['at'](-0x1)?.['rev']??null;return{'head':_0x392c29,'items':_0x20a44d};}function writeLog(_0x454015,_0x49f3fa,_0x601d34,_0xf86d69,_0x120ae4){const _0x1f594b=_0x3d54,_0x5e29aa=itemDir(_0x454015,_0x49f3fa,_0x601d34);mkdirSync(_0x5e29aa,{'recursive':!![]}),writeFileSync(join(_0x5e29aa,_0x1f594b(0x96)),JSON[_0x1f594b(0xc4)](_0x120ae4,null,0x2),'utf8'),writeFileSync(join(_0x5e29aa,_0x1f594b(0xa1)),_0xf86d69+'\x0a',_0x1f594b(0x95));}function findRev(_0x116d34,_0x5095cd){const _0x1db77c=_0x3d54,_0x56be0e=join(_0x116d34,_0x1db77c(0xbf));if(!existsSync(_0x56be0e))return void 0x0;for(const _0x4221bd of readdirSync(_0x56be0e,{'withFileTypes':!![]})){if(!_0x4221bd[_0x1db77c(0xbd)]())continue;for(const _0x548625 of readdirSync(join(_0x56be0e,_0x4221bd[_0x1db77c(0x91)]),{'withFileTypes':!![]})){if(!_0x548625['isDirectory']())continue;const _0x53c8fb=readLog(_0x116d34,_0x4221bd[_0x1db77c(0x91)],_0x548625['name'])[_0x1db77c(0xbf)][_0x1db77c(0xb2)](_0x2b4557=>_0x2b4557[_0x1db77c(0xd3)]===_0x5095cd);if(_0x53c8fb)return _0x53c8fb;}}return void 0x0;}function filesTextOf(_0x1ae1d1,_0x563370){const _0x4cb759=_0x3d54,_0x1367dc={};for(const [_0x38fd19,_0x2e2039]of Object['entries'](_0x563370[_0x4cb759(0xa3)])){const _0xf0eb4=objectPath(_0x1ae1d1,_0x2e2039);if(existsSync(_0xf0eb4))_0x1367dc[_0x38fd19]=readFileSync(_0xf0eb4,_0x4cb759(0x95));}return _0x1367dc;}function createFsVersionStore(_0x247b0d,_0x3e12d3){return mkdirSync(_0x247b0d,{'recursive':!![]}),{async 'log'(_0x396622,_0x2fc1a3){const _0x495af3=_0x3d54,{head:_0x3d44fd,items:_0xb476a3}=readLog(_0x247b0d,_0x396622,_0x2fc1a3);return{'head':_0x3d44fd,'items':[..._0xb476a3][_0x495af3(0x8d)]((_0x3d3319,_0x473bc8)=>_0x3d3319['at']<_0x473bc8['at']?0x1:-0x1)};},async 'get'(_0xa2dd61){const _0xa1c8c2=findRev(_0x247b0d,_0xa2dd61);if(!_0xa1c8c2)throw new KtNotFoundError('rev\x20'+_0xa2dd61);return _0xa1c8c2;},async 'readFile'(_0x3794f0,_0x59ef62){const _0x838f32=_0x3d54,_0x426ea5=await this[_0x838f32(0xb9)](_0x3794f0),_0x5be1a4=_0x426ea5[_0x838f32(0xa3)][_0x59ef62];if(!_0x5be1a4)throw new KtNotFoundError(_0x59ef62);const _0x27766e=objectPath(_0x247b0d,_0x5be1a4);if(!existsSync(_0x27766e))throw new KtNotFoundError(_0x59ef62);return new Uint8Array(readFileSync(_0x27766e));},async 'commit'(_0x3ce27a){const _0x3b3859=_0x3d54;let _0x21b736=_0x3ce27a['files'];if(!_0x21b736){const _0x19bf4e=await _0x3e12d3[_0x3b3859(0xb9)](_0x3ce27a['id']);_0x21b736=artifactToFiles(_0x19bf4e);}const _0x82747e={},_0x52ffd3={};for(const [_0x15ee23,_0x3572a1]of Object[_0x3b3859(0xc5)](_0x21b736)){const _0x2212c0=typeof _0x3572a1==='string'?_0x3572a1:new TextDecoder()[_0x3b3859(0x8e)](_0x3572a1);_0x82747e[_0x15ee23]=_0x2212c0,_0x52ffd3[_0x15ee23]=writeObject(_0x247b0d,typeof _0x3572a1===_0x3b3859(0xb1)?Buffer[_0x3b3859(0xa7)](_0x3572a1,'utf8'):_0x3572a1);}const _0xb80ca=readLog(_0x247b0d,_0x3ce27a['kind'],_0x3ce27a['id']);if(_0xb80ca[_0x3b3859(0xc6)]){const _0x14695e=_0xb80ca['items'][_0x3b3859(0xb2)](_0x3d5c63=>_0x3d5c63['rev']===_0xb80ca[_0x3b3859(0xc6)]);if(_0x14695e&&filesEqual(_0x82747e,filesTextOf(_0x247b0d,_0x14695e)))return _0x14695e;}const _0x2fe798=new Date(),_0x3e6098=String(_0x2fe798[_0x3b3859(0x97)]())[_0x3b3859(0xbc)](0x2)+String(_0x2fe798[_0x3b3859(0xb6)]()+0x1)[_0x3b3859(0xc7)](0x2,'0')+String(_0x2fe798[_0x3b3859(0xcc)]())[_0x3b3859(0xc7)](0x2,'0')+String(_0x2fe798['getHours']())['padStart'](0x2,'0')+String(_0x2fe798[_0x3b3859(0x9e)]())[_0x3b3859(0xc7)](0x2,'0'),_0x21dd8=sha256Hex(Object['values'](_0x52ffd3)['sort']()[_0x3b3859(0xce)](','))[_0x3b3859(0xbc)](0x0,0x8),_0x13e1df={'rev':_0x3e6098+_0x3b3859(0x8f)+_0x21dd8,'kind':_0x3ce27a[_0x3b3859(0xb4)],'id':_0x3ce27a['id'],'at':_0x2fe798[_0x3b3859(0xab)](),'parent':_0xb80ca['head'],'by':_0x3ce27a['by'],'note':_0x3ce27a[_0x3b3859(0x8a)],'files':_0x52ffd3,'meta':_0x3ce27a[_0x3b3859(0xd0)]};return writeLog(_0x247b0d,_0x3ce27a[_0x3b3859(0xb4)],_0x3ce27a['id'],_0x13e1df[_0x3b3859(0xd3)],[..._0xb80ca[_0x3b3859(0xbf)],_0x13e1df]),_0x13e1df;},async 'restore'(_0x567f03,_0x120993,_0x2096fb,_0xbb88eb){const _0x25f4ea=_0x3d54,_0x28e0af=await this[_0x25f4ea(0xb9)](_0x2096fb),_0x3e22d1={};for(const _0x113328 of Object[_0x25f4ea(0xa4)](_0x28e0af[_0x25f4ea(0xa3)])){_0x3e22d1[_0x113328]=new TextDecoder()[_0x25f4ea(0x8e)](await this[_0x25f4ea(0x8c)](_0x2096fb,_0x113328));}const _0x3d3d59=filesToArtifact(_0x3e22d1,_0x120993);return await _0x3e12d3[_0x25f4ea(0xcb)]({..._0x3d3d59,'id':_0x120993,'kind':_0x3d3d59['kind'],'etag':void 0x0}),this[_0x25f4ea(0xbe)]({'kind':_0x567f03,'id':_0x120993,'files':_0x3e22d1,'by':_0xbb88eb,'note':_0x25f4ea(0xc0)+_0x2096fb});}};}function createKtFsStores(_0x30486e){const _0x3f1fd9=_0x3d54,_0x1e8307=createFsArtifactStore(resolveRoot(_0x30486e[_0x3f1fd9(0x8b)],_0x30486e[_0x3f1fd9(0xb3)]),_0x30486e[_0x3f1fd9(0xa2)]),_0x474ac6=_0x30486e['instancesRoot']?createFsInstanceStore(resolveRoot(_0x30486e[_0x3f1fd9(0x92)],_0x30486e['cwd']),_0x30486e[_0x3f1fd9(0xc3)]):void 0x0,_0x27a7de=_0x30486e[_0x3f1fd9(0xcf)]?createFsVersionStore(resolveRoot(_0x30486e[_0x3f1fd9(0xcf)],_0x30486e[_0x3f1fd9(0xb3)]),_0x1e8307):void 0x0;return{'artifacts':_0x1e8307,'instances':_0x474ac6,'versions':_0x27a7de};}export{createKtFsStores};
|
|
1
|
+
function _0x2ad0(_0x19cee3,_0x137b43){_0x19cee3=_0x19cee3-0xe9;const _0x1fe7cb=_0x1fe7();let _0x2ad0cb=_0x1fe7cb[_0x19cee3];if(_0x2ad0['IwBAti']===undefined){var _0x166161=function(_0x4dab4f){const _0x4d21e7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x53b6cb='',_0x3ad539='';for(let _0xc891f=0x0,_0x24346d,_0x13ad40,_0x42aa47=0x0;_0x13ad40=_0x4dab4f['charAt'](_0x42aa47++);~_0x13ad40&&(_0x24346d=_0xc891f%0x4?_0x24346d*0x40+_0x13ad40:_0x13ad40,_0xc891f++%0x4)?_0x53b6cb+=String['fromCharCode'](0xff&_0x24346d>>(-0x2*_0xc891f&0x6)):0x0){_0x13ad40=_0x4d21e7['indexOf'](_0x13ad40);}for(let _0x15f205=0x0,_0x4e2379=_0x53b6cb['length'];_0x15f205<_0x4e2379;_0x15f205++){_0x3ad539+='%'+('00'+_0x53b6cb['charCodeAt'](_0x15f205)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3ad539);};_0x2ad0['yFHpQg']=_0x166161,_0x2ad0['yhgnZA']={},_0x2ad0['IwBAti']=!![];}const _0x406643=_0x1fe7cb[0x0];_0x2ad0['ViEvWd']!==_0x406643&&(_0x2ad0['yhgnZA']={},_0x2ad0['ViEvWd']=_0x406643);const _0xc9988b=_0x2ad0['yhgnZA'][_0x19cee3];return _0xc9988b===undefined?(_0x2ad0cb=_0x2ad0['yFHpQg'](_0x2ad0cb),_0x2ad0['yhgnZA'][_0x19cee3]=_0x2ad0cb):_0x2ad0cb=_0xc9988b,_0x2ad0cb;}const _0x2e7ec5=_0x2ad0;(function(_0x5a1455,_0x2defd7){const _0x3839bf=_0x2ad0,_0x33f521=_0x5a1455();while(!![]){try{const _0x1f82fa=-parseInt(_0x3839bf(0x115))/0x1*(parseInt(_0x3839bf(0x10b))/0x2)+parseInt(_0x3839bf(0x126))/0x3*(-parseInt(_0x3839bf(0x129))/0x4)+-parseInt(_0x3839bf(0xfe))/0x5*(parseInt(_0x3839bf(0x10c))/0x6)+parseInt(_0x3839bf(0x106))/0x7*(-parseInt(_0x3839bf(0xf7))/0x8)+parseInt(_0x3839bf(0x124))/0x9+-parseInt(_0x3839bf(0x11b))/0xa+parseInt(_0x3839bf(0x12f))/0xb;if(_0x1f82fa===_0x2defd7)break;else _0x33f521['push'](_0x33f521['shift']());}catch(_0xeecb85){_0x33f521['push'](_0x33f521['shift']());}}}(_0x1fe7,0x25cfb));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(_0x3ad539,_0xc891f=process[_0x2e7ec5(0x12b)]()){const _0x24346d=isAbsolute(_0x3ad539)?_0x3ad539:resolve(_0xc891f,_0x3ad539);return mkdirSync(_0x24346d,{'recursive':!![]}),_0x24346d;}function _0x1fe7(){const _0x1a2e49=['AxneAxjLy3rVCNK','mtq5mtKWmfnfD2zyyW','CMvHzezPBgu','BM93','lMv0ywC','CMv2ia','DxbKyxrL','DMfSDwvZ','C3rYAw5NAwz5','C2HHmJu2','odGZndC2z3HwC1fy','C2vLza','mty4y2TiuvvO','Aw5ZDgfUy2uG','C2XPy2u','mtm0mZzAtu1iu0O','BMfTzq','y3DK','yxj0AwzHy3rZuM9VDa','DxrMoa','z2v0twLUDxrLCW','mta4mZyWnJDzuMrIzM0','Dg9tDhjPBMC','zw5KC1DPDgG','CMfUzg9T','z2v0sg91CNm','BM90zq','DMvYC2LVBNnsB290','BwfW','z2v0tw9UDgG','Aw5ZDc0','Aw5ZDgfUy2vZuM9VDa','zMfJzxm','zMLUza','yxj0AwzHy3rjza','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','yxj0AwzHy3qG','mtz4sKzIwMG','DgfIq29TBw9U','zw50CMLLCW','z2v0','y29TBwL0','B2jQzwn0CW','zMLSzxm','mtb2u2vxA1a','Bg9NlMPZB24','zgvJB2rL','y29TBw9U','CMv2','CgfKu3rHCNq','zxrHzW','AgvHza','mtiZndq1wvDrBenn','zNjVBq','zMLSDgvY','CgfYC2u','C2f2zq','mJK4ndC2D2rTCwD2','nZCYmdm4tKLfDgr4','Dg9ju09tDhjPBMC','C3rYAw5N','AM9PBG','sevbra','DhjPBq','C29YDa','A2v5CW','lwXVy2fSlq','mMf4CxvHsW','lMPZB24','AxrLBxm','z2v0rgf0zq','A2LUza'];_0x1fe7=function(){return _0x1a2e49;};return _0x1fe7();}function artifactDir(_0x13ad40,_0x42aa47){return join(_0x13ad40,_0x42aa47);}function objectPath(_0x15f205,_0x4e2379){const _0x1cacd2=_0x2e7ec5;return join(_0x15f205,_0x1cacd2(0xfc),_0x4e2379[_0x1cacd2(0x128)](0x0,0x2),_0x4e2379);}function itemDir(_0x51bee3,_0xe3d7d4,_0x3740e9){const _0x498c7d=_0x2e7ec5;return join(_0x51bee3,_0x498c7d(0x117),_0xe3d7d4,_0x3740e9);}function newEtag(){const _0x3a6cff=_0x2e7ec5;return Date[_0x3a6cff(0x11d)]()[_0x3a6cff(0x130)](0x24)+'-'+Math[_0x3a6cff(0xea)]()[_0x3a6cff(0x130)](0x24)[_0x3a6cff(0x128)](0x2,0x8);}function readEtag(_0x6ef7b7){const _0x532c2b=_0x2e7ec5,_0x9f5b2c=join(_0x6ef7b7,'.etag');return existsSync(_0x9f5b2c)?readFileSync(_0x9f5b2c,_0x532c2b(0x12d))[_0x532c2b(0x111)]():void 0x0;}function writeArtifactDir(_0x51e527,_0x1c47b7,_0x4e917f){const _0x56bd75=_0x2e7ec5;mkdirSync(join(_0x51e527,_0x56bd75(0xf2)),{'recursive':!![]});const _0x5b6242=artifactToFiles(_0x1c47b7);writeFileSync(join(_0x51e527,ARTIFACT_FILE_META),_0x5b6242[ARTIFACT_FILE_META]??'{}',_0x56bd75(0x12d)),writeFileSync(join(_0x51e527,ARTIFACT_FILE_BODY),_0x5b6242[ARTIFACT_FILE_BODY]??'',_0x56bd75(0x12d));const _0x54ee2a=join(_0x51e527,ARTIFACT_FILE_FILL),_0x457736=join(_0x51e527,ARTIFACT_FILE_REPORT);if(_0x5b6242[ARTIFACT_FILE_FILL])writeFileSync(_0x54ee2a,_0x5b6242[ARTIFACT_FILE_FILL],_0x56bd75(0x12d));else{if(existsSync(_0x54ee2a))rmSync(_0x54ee2a);}if(_0x5b6242[ARTIFACT_FILE_REPORT])writeFileSync(_0x457736,_0x5b6242[ARTIFACT_FILE_REPORT],_0x56bd75(0x12d));else{if(existsSync(_0x457736))rmSync(_0x457736);}writeFileSync(join(_0x51e527,_0x56bd75(0x11e)),_0x4e917f,_0x56bd75(0x12d));}function readArtifactDir(_0x40f561,_0x358ddd){const _0x30514a=_0x2e7ec5,_0xc7a315={},_0x614bd1=join(_0x40f561,ARTIFACT_FILE_META),_0x3ea9f4=join(_0x40f561,ARTIFACT_FILE_BODY);if(existsSync(_0x614bd1))_0xc7a315[ARTIFACT_FILE_META]=readFileSync(_0x614bd1,_0x30514a(0x12d));if(existsSync(_0x3ea9f4))_0xc7a315[ARTIFACT_FILE_BODY]=readFileSync(_0x3ea9f4,_0x30514a(0x12d));const _0x3d5a82=join(_0x40f561,ARTIFACT_FILE_FILL),_0x494ba9=join(_0x40f561,ARTIFACT_FILE_REPORT);if(existsSync(_0x3d5a82))_0xc7a315[ARTIFACT_FILE_FILL]=readFileSync(_0x3d5a82,'utf8');if(existsSync(_0x494ba9))_0xc7a315[ARTIFACT_FILE_REPORT]=readFileSync(_0x494ba9,_0x30514a(0x12d));return{...filesToArtifact(_0xc7a315,_0x358ddd),'etag':readEtag(_0x40f561)};}function createFsArtifactStore(_0xe8c1a2,_0x2dc33e=[]){const _0x224c31=_0x2e7ec5;mkdirSync(_0xe8c1a2,{'recursive':!![]});for(const _0x24fb31 of _0x2dc33e){const _0x120cfa=artifactDir(_0xe8c1a2,_0x24fb31['id']),_0xb58ed0=join(_0x120cfa,ARTIFACT_FILE_BODY);if(!existsSync(_0xb58ed0))writeArtifactDir(_0x120cfa,_0x24fb31,_0x24fb31[_0x224c31(0x104)]??newEtag());}return{async 'list'(_0x5443d7){const _0x445b24=_0x224c31;if(!existsSync(_0xe8c1a2))return[];const _0x2fc46d=[];for(const _0x4c7df4 of readdirSync(_0xe8c1a2,{'withFileTypes':!![]})){if(!_0x4c7df4[_0x445b24(0x11a)]())continue;try{const _0x3eb70c=readArtifactDir(artifactDir(_0xe8c1a2,_0x4c7df4[_0x445b24(0x12a)]),_0x4c7df4[_0x445b24(0x12a)]);if(!_0x5443d7||_0x3eb70c[_0x445b24(0x119)]===_0x5443d7)_0x2fc46d['push']({'id':_0x3eb70c['id'],'name':_0x3eb70c[_0x445b24(0x12a)],'kind':_0x3eb70c[_0x445b24(0x119)]});}catch{}}return _0x2fc46d;},async 'get'(_0x25225f){const _0x145471=_0x224c31,_0x4126e0=artifactDir(_0xe8c1a2,_0x25225f);if(!existsSync(_0x4126e0))throw new KtNotFoundError(_0x145471(0xf6)+_0x25225f);return readArtifactDir(_0x4126e0,_0x25225f);},async 'save'(_0x32333c){const _0x5e9b4a=_0x224c31,_0x15ec2d=artifactDir(_0xe8c1a2,_0x32333c['id']),_0x21656a=existsSync(_0x15ec2d)?readArtifactDir(_0x15ec2d,_0x32333c['id']):void 0x0;if(_0x32333c[_0x5e9b4a(0x104)]&&_0x21656a?.['etag']&&_0x32333c[_0x5e9b4a(0x104)]!==_0x21656a[_0x5e9b4a(0x104)])throw new KtConflictError(_0x5e9b4a(0xf5),_0x21656a);const _0x1c264f=newEtag();return writeArtifactDir(_0x15ec2d,_0x32333c,_0x1c264f),{..._0x32333c,'etag':_0x1c264f};},async 'create'(_0x43f3bc){const _0x1909da=_0x224c31,_0x2bfcc7=_0x43f3bc[_0x1909da(0x119)]+'-'+Math[_0x1909da(0xea)]()[_0x1909da(0x130)](0x24)['slice'](0x2,0xa),_0x1d2ebd={'id':_0x2bfcc7,'name':_0x43f3bc[_0x1909da(0x12a)],'kind':_0x43f3bc[_0x1909da(0x119)],'ktl':EMPTY_KTL};return this[_0x1909da(0x10a)](_0x1d2ebd);},async 'remove'(_0x152bd0){const _0x4af6be=_0x224c31,_0x14eb3e=artifactDir(_0xe8c1a2,_0x152bd0);if(!existsSync(_0x14eb3e))throw new KtNotFoundError(_0x4af6be(0xf6)+_0x152bd0);rmSync(_0x14eb3e,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0xbeaa98,_0x359dd5={}){const _0x4096dd=_0x2e7ec5;mkdirSync(_0xbeaa98,{'recursive':!![]});const _0x32222a=_0x4525b0=>join(_0xbeaa98,_0x4525b0+_0x4096dd(0x116));for(const [_0x1d6480,_0x2f7378]of Object[_0x4096dd(0xf9)](_0x359dd5)){if(!existsSync(_0x32222a(_0x1d6480)))writeFileSync(_0x32222a(_0x1d6480),JSON[_0x4096dd(0x122)](_0x2f7378,null,0x2),_0x4096dd(0x12d));}return{async 'get'(_0x2d1732){const _0x491213=_0x4096dd,_0x276ffa=_0x32222a(_0x2d1732);if(!existsSync(_0x276ffa))throw new KtNotFoundError(_0x491213(0x127)+_0x2d1732);return JSON['parse'](readFileSync(_0x276ffa,_0x491213(0x12d)));},async 'save'(_0x29d44a,_0x45cdda){const _0x3352d7=_0x4096dd,_0x114b2d=_0x32222a(_0x29d44a),_0x2f5424=existsSync(_0x114b2d)?JSON[_0x3352d7(0x109)](readFileSync(_0x114b2d,'utf8')):{'artifactId':'','values':{}},_0x12e955={'artifactId':_0x2f5424[_0x3352d7(0xf4)],'values':{..._0x2f5424[_0x3352d7(0x121)],..._0x45cdda['values']},'common':{..._0x2f5424[_0x3352d7(0x101)],..._0x45cdda[_0x3352d7(0x101)]},'tabCommon':{..._0x2f5424[_0x3352d7(0xf8)],..._0x45cdda[_0x3352d7(0xf8)]}};writeFileSync(_0x114b2d,JSON[_0x3352d7(0x122)](_0x12e955,null,0x2),_0x3352d7(0x12d));},async 'list'(_0x52f141){const _0x43464a=_0x4096dd;return readdirSync(_0xbeaa98)[_0x43464a(0x108)](_0x2430dd=>_0x2430dd[_0x43464a(0xe9)](_0x43464a(0x116)))[_0x43464a(0xee)](_0x47c579=>{const _0x2b2c69=_0x43464a,_0x3804a2=_0x47c579[_0x2b2c69(0x128)](0x0,-0x5),_0x3fc8f3=JSON[_0x2b2c69(0x109)](readFileSync(join(_0xbeaa98,_0x47c579),_0x2b2c69(0x12d)));return{'id':_0x3804a2,'artifactId':_0x3fc8f3['artifactId']};})['filter'](_0x407c4c=>!_0x52f141||_0x407c4c['artifactId']===_0x52f141);},async 'create'(_0x15ebb6){const _0x58e071=_0x4096dd,_0x3d897e=_0x58e071(0xf0)+Math[_0x58e071(0xea)]()[_0x58e071(0x130)](0x24)[_0x58e071(0x128)](0x2,0xa);return writeFileSync(_0x32222a(_0x3d897e),JSON['stringify']({'artifactId':_0x15ebb6[_0x58e071(0xf4)],'values':{},'common':{}},null,0x2),_0x58e071(0x12d)),{'id':_0x3d897e};}};}function sha256Hex(_0x116fd4){const _0x3e098b=_0x2e7ec5,_0x3ff0af=typeof _0x116fd4===_0x3e098b(0x10e)?Buffer[_0x3e098b(0x107)](_0x116fd4,_0x3e098b(0x12d)):Buffer[_0x3e098b(0x107)](_0x116fd4);return createHash(_0x3e098b(0x123))[_0x3e098b(0x120)](_0x3ff0af)['digest']('hex');}function writeObject(_0x275423,_0x1b217e){const _0x134117=sha256Hex(_0x1b217e),_0x2b0e28=objectPath(_0x275423,_0x134117);mkdirSync(dirname(_0x2b0e28),{'recursive':!![]});if(!existsSync(_0x2b0e28))writeFileSync(_0x2b0e28,_0x1b217e);return _0x134117;}function readLog(_0x4f90ec,_0x39f3df,_0x2bc601){const _0x468c33=_0x2e7ec5,_0x41bf7b=itemDir(_0x4f90ec,_0x39f3df,_0x2bc601),_0x2894e8=join(_0x41bf7b,_0x468c33(0xff)),_0x524490=join(_0x41bf7b,'HEAD'),_0x3ee062=existsSync(_0x2894e8)?JSON[_0x468c33(0x109)](readFileSync(_0x2894e8,_0x468c33(0x12d))):[],_0x3594b8=existsSync(_0x524490)?readFileSync(_0x524490,_0x468c33(0x12d))[_0x468c33(0x111)]():_0x3ee062['at'](-0x1)?.[_0x468c33(0x102)]??null;return{'head':_0x3594b8,'items':_0x3ee062};}function writeLog(_0x4f0076,_0x2b9355,_0x5443cb,_0x27f0d6,_0x452d5e){const _0xa73dd1=_0x2e7ec5,_0x69365d=itemDir(_0x4f0076,_0x2b9355,_0x5443cb);mkdirSync(_0x69365d,{'recursive':!![]}),writeFileSync(join(_0x69365d,_0xa73dd1(0xff)),JSON[_0xa73dd1(0x122)](_0x452d5e,null,0x2),'utf8'),writeFileSync(join(_0x69365d,_0xa73dd1(0x110)),_0x27f0d6+'\x0a','utf8');}function findRev(_0x1800cd,_0x268764){const _0x5763c0=_0x2e7ec5,_0x3e478a=join(_0x1800cd,_0x5763c0(0x117));if(!existsSync(_0x3e478a))return void 0x0;for(const _0x3e2a20 of readdirSync(_0x3e478a,{'withFileTypes':!![]})){if(!_0x3e2a20[_0x5763c0(0x11a)]())continue;for(const _0x5224d6 of readdirSync(join(_0x3e478a,_0x3e2a20[_0x5763c0(0x12a)]),{'withFileTypes':!![]})){if(!_0x5224d6[_0x5763c0(0x11a)]())continue;const _0x4853b3=readLog(_0x1800cd,_0x3e2a20['name'],_0x5224d6[_0x5763c0(0x12a)])[_0x5763c0(0x117)][_0x5763c0(0xf3)](_0x150af5=>_0x150af5[_0x5763c0(0x102)]===_0x268764);if(_0x4853b3)return _0x4853b3;}}return void 0x0;}function filesTextOf(_0x3ec2f9,_0x20e6c0){const _0x5f3c7b=_0x2e7ec5,_0x56df68={};for(const [_0x2c37d9,_0x2ac57b]of Object[_0x5f3c7b(0xf9)](_0x20e6c0[_0x5f3c7b(0xfd)])){const _0x47b7b8=objectPath(_0x3ec2f9,_0x2ac57b);if(existsSync(_0x47b7b8))_0x56df68[_0x2c37d9]=readFileSync(_0x47b7b8,_0x5f3c7b(0x12d));}return _0x56df68;}function createFsVersionStore(_0x3a654b,_0x52bbea){return mkdirSync(_0x3a654b,{'recursive':!![]}),{async 'log'(_0x5e0dce,_0x44ab60){const _0x218a2e=_0x2ad0,{head:_0x4e23e4,items:_0xec6024}=readLog(_0x3a654b,_0x5e0dce,_0x44ab60);return{'head':_0x4e23e4,'items':[..._0xec6024][_0x218a2e(0x112)]((_0x2ebfef,_0x274f0e)=>_0x2ebfef['at']<_0x274f0e['at']?0x1:-0x1)};},async 'get'(_0x339c22){const _0x383d10=_0x2ad0,_0x5d9676=findRev(_0x3a654b,_0x339c22);if(!_0x5d9676)throw new KtNotFoundError(_0x383d10(0x11f)+_0x339c22);return _0x5d9676;},async 'readFile'(_0x2c0689,_0x1c50a2){const _0x7a4d7d=_0x2ad0,_0x351a60=await this[_0x7a4d7d(0xfa)](_0x2c0689),_0x5336c4=_0x351a60[_0x7a4d7d(0xfd)][_0x1c50a2];if(!_0x5336c4)throw new KtNotFoundError(_0x1c50a2);const _0x9cd760=objectPath(_0x3a654b,_0x5336c4);if(!existsSync(_0x9cd760))throw new KtNotFoundError(_0x1c50a2);return new Uint8Array(readFileSync(_0x9cd760));},async 'commit'(_0x40c266){const _0x1d2888=_0x2ad0;let _0x425876=_0x40c266[_0x1d2888(0xfd)];if(!_0x425876){const _0x48de79=await _0x52bbea[_0x1d2888(0xfa)](_0x40c266['id']);_0x425876=artifactToFiles(_0x48de79);}const _0x461dd6={},_0x39c3ff={};for(const [_0x50f01a,_0x5a5a3f]of Object['entries'](_0x425876)){const _0xfae9cc=typeof _0x5a5a3f===_0x1d2888(0x10e)?_0x5a5a3f:new TextDecoder()[_0x1d2888(0x100)](_0x5a5a3f);_0x461dd6[_0x50f01a]=_0xfae9cc,_0x39c3ff[_0x50f01a]=writeObject(_0x3a654b,typeof _0x5a5a3f==='string'?Buffer[_0x1d2888(0x107)](_0x5a5a3f,_0x1d2888(0x12d)):_0x5a5a3f);}const _0x33ea6e=readLog(_0x3a654b,_0x40c266[_0x1d2888(0x119)],_0x40c266['id']);if(_0x33ea6e[_0x1d2888(0x105)]){const _0x2cb783=_0x33ea6e['items']['find'](_0x37f14e=>_0x37f14e['rev']===_0x33ea6e[_0x1d2888(0x105)]);if(_0x2cb783&&filesEqual(_0x461dd6,filesTextOf(_0x3a654b,_0x2cb783)))return _0x2cb783;}const _0x4e97db=new Date(),_0x2b196f=String(_0x4e97db['getFullYear']())[_0x1d2888(0x128)](0x2)+String(_0x4e97db[_0x1d2888(0xef)]()+0x1)[_0x1d2888(0x103)](0x2,'0')+String(_0x4e97db[_0x1d2888(0x118)]())['padStart'](0x2,'0')+String(_0x4e97db[_0x1d2888(0xeb)]())[_0x1d2888(0x103)](0x2,'0')+String(_0x4e97db[_0x1d2888(0x12e)]())[_0x1d2888(0x103)](0x2,'0'),_0x10b335=sha256Hex(Object[_0x1d2888(0x121)](_0x39c3ff)['sort']()[_0x1d2888(0x10f)](','))[_0x1d2888(0x128)](0x0,0x8),_0x5c0bd6={'rev':_0x2b196f+_0x1d2888(0x114)+_0x10b335,'kind':_0x40c266[_0x1d2888(0x119)],'id':_0x40c266['id'],'at':_0x4e97db[_0x1d2888(0x10d)](),'parent':_0x33ea6e['head'],'by':_0x40c266['by'],'note':_0x40c266[_0x1d2888(0xec)],'files':_0x39c3ff,'meta':_0x40c266['meta']};return writeLog(_0x3a654b,_0x40c266[_0x1d2888(0x119)],_0x40c266['id'],_0x5c0bd6['rev'],[..._0x33ea6e['items'],_0x5c0bd6]),_0x5c0bd6;},async 'restore'(_0x367053,_0x3e7dae,_0x202094,_0xf885ae){const _0x470b8b=_0x2ad0,_0xe11d32=await this['get'](_0x202094),_0x34439e={};for(const _0x445e46 of Object[_0x470b8b(0x113)](_0xe11d32[_0x470b8b(0xfd)])){_0x34439e[_0x445e46]=new TextDecoder()[_0x470b8b(0x100)](await this[_0x470b8b(0x11c)](_0x202094,_0x445e46));}const _0x3488ae=filesToArtifact(_0x34439e,_0x3e7dae);return await _0x52bbea['save']({..._0x3488ae,'id':_0x3e7dae,'kind':_0x3488ae[_0x470b8b(0x119)],'etag':void 0x0}),this[_0x470b8b(0xfb)]({'kind':_0x367053,'id':_0x3e7dae,'files':_0x34439e,'by':_0xf885ae,'note':'\u6062\u590D\u81EA\x20'+_0x202094});}};}function createKtFsStores(_0x5daf39){const _0xaafbb6=_0x2e7ec5,_0x1156d2=createFsArtifactStore(resolveRoot(_0x5daf39[_0xaafbb6(0x12c)],_0x5daf39[_0xaafbb6(0x12b)]),_0x5daf39[_0xaafbb6(0x125)]),_0x3109a7=_0x5daf39[_0xaafbb6(0xf1)]?createFsInstanceStore(resolveRoot(_0x5daf39[_0xaafbb6(0xf1)],_0x5daf39[_0xaafbb6(0x12b)]),_0x5daf39['seedInstances']):void 0x0,_0x45b329=_0x5daf39[_0xaafbb6(0xed)]?createFsVersionStore(resolveRoot(_0x5daf39[_0xaafbb6(0xed)],_0x5daf39[_0xaafbb6(0x12b)]),_0x1156d2):void 0x0;return{'artifacts':_0x1156d2,'instances':_0x3109a7,'versions':_0x45b329};}export{createKtFsStores};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';function _0x2da7(_0x5c85b9,_0x33461a){_0x5c85b9=_0x5c85b9-0x11d;const _0x51f432=_0x51f4();let _0x2da72d=_0x51f432[_0x5c85b9];if(_0x2da7['iZOBpx']===undefined){var _0x19345e=function(_0x1ac19a){const _0x5e90c8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x30a094='',_0x2781ce='';for(let _0x2f20af=0x0,_0x344f7d,_0x238060,_0x1d84df=0x0;_0x238060=_0x1ac19a['charAt'](_0x1d84df++);~_0x238060&&(_0x344f7d=_0x2f20af%0x4?_0x344f7d*0x40+_0x238060:_0x238060,_0x2f20af++%0x4)?_0x30a094+=String['fromCharCode'](0xff&_0x344f7d>>(-0x2*_0x2f20af&0x6)):0x0){_0x238060=_0x5e90c8['indexOf'](_0x238060);}for(let _0x24faff=0x0,_0x4e9eed=_0x30a094['length'];_0x24faff<_0x4e9eed;_0x24faff++){_0x2781ce+='%'+('00'+_0x30a094['charCodeAt'](_0x24faff)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2781ce);};_0x2da7['WgYQQM']=_0x19345e,_0x2da7['houssj']={},_0x2da7['iZOBpx']=!![];}const _0x310f51=_0x51f432[0x0];_0x2da7['JfrNqm']!==_0x310f51&&(_0x2da7['houssj']={},_0x2da7['JfrNqm']=_0x310f51);const _0x35c23e=_0x2da7['houssj'][_0x5c85b9];return _0x35c23e===undefined?(_0x2da72d=_0x2da7['WgYQQM'](_0x2da72d),_0x2da7['houssj'][_0x5c85b9]=_0x2da72d):_0x2da72d=_0x35c23e,_0x2da72d;}const _0x2797f7=_0x2da7;(function(_0x5196bb,_0x27b1cd){const _0xaa79bd=_0x2da7,_0x5c9900=_0x5196bb();while(!![]){try{const _0x186668=-parseInt(_0xaa79bd(0x12a))/0x1+-parseInt(_0xaa79bd(0x141))/0x2*(parseInt(_0xaa79bd(0x140))/0x3)+parseInt(_0xaa79bd(0x122))/0x4*(parseInt(_0xaa79bd(0x11d))/0x5)+-parseInt(_0xaa79bd(0x132))/0x6+-parseInt(_0xaa79bd(0x123))/0x7+parseInt(_0xaa79bd(0x14e))/0x8+-parseInt(_0xaa79bd(0x144))/0x9*(-parseInt(_0xaa79bd(0x12f))/0xa);if(_0x186668===_0x27b1cd)break;else _0x5c9900['push'](_0x5c9900['shift']());}catch(_0x327fa9){_0x5c9900['push'](_0x5c9900['shift']());}}}(_0x51f4,0xdf3b1));var store=require(_0x2797f7(0x137));async function pathParts(_0x2781ce,_0x2f20af){const _0x42173b=_0x2797f7,_0x344f7d=_0x2781ce['params']?await _0x2781ce[_0x42173b(0x12e)]:void 0x0;if(_0x344f7d?.[_0x42173b(0x145)]?.[_0x42173b(0x138)])return _0x344f7d['path'];const _0x238060=_0x2f20af[_0x42173b(0x143)][_0x42173b(0x129)](_0x42173b(0x13c)),_0x1d84df=_0x238060>=0x0?_0x2f20af[_0x42173b(0x143)][_0x42173b(0x11f)](_0x238060+_0x42173b(0x13c)[_0x42173b(0x138)]):_0x2f20af[_0x42173b(0x143)];return _0x1d84df[_0x42173b(0x14b)]('/')['filter'](Boolean);}function json(_0x24faff,_0x4e9eed=0xc8){const _0x5def76=_0x2797f7;return new Response(JSON['stringify'](_0x24faff),{'status':_0x4e9eed,'headers':{'content-type':_0x5def76(0x150)}});}function fail(_0x44c39f){const _0x227042=_0x2797f7;if(_0x44c39f instanceof store['KtConflictError'])return json({'message':_0x44c39f['message'],'current':_0x44c39f[_0x227042(0x13f)]},0x199);if(_0x44c39f instanceof store[_0x227042(0x139)])return json({'message':_0x44c39f[_0x227042(0x134)]},0x194);if(_0x44c39f instanceof store[_0x227042(0x146)])return json({'message':_0x44c39f[_0x227042(0x134)]},_0x44c39f['status']??0x1f4);return json({'message':_0x44c39f instanceof Error?_0x44c39f[_0x227042(0x134)]:_0x227042(0x130)},0x1f4);}async function readBody(_0x21313f){const _0x5ea5c7=await _0x21313f['text']();if(!_0x5ea5c7)return null;return JSON['parse'](_0x5ea5c7);}function _0x51f4(){const _0x32f023=['zgvMAw5Ls3rdB25MAwC','C3bSAxq','CMvZDg9Yzq','yxj0AwzHy3rjza','nda4oti2nfzrq01Usq','CMvTB3zL','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','5PYQ5OM+5yIW','mti4nxzUzfPXzq','r0vu','C2XPy2u','BgLZDa','zNjVBq','mJeZmJHfCu1uqLC','nJG3nJK1neznt3DiCG','Aw5ZDgfUy2vZioACQUMfJEE9RG','z2v0','Aw5ZDgfUy2vZ','ufvu','ue9tva','Aw5KzxHpzG','mta2oda2ngryvhnHuq','CMvTB3zLioACQUwUNUEoSa','DxjS','y3jLyxrLioACQUwUNUEoSa','CgfYyw1Z','nJqYmZGWB2rdtxLo','5yAf6yoO6zsz6k+V','yxj0AwzHy3rZ','odq2nZi0mLrnwgDlra','DMvYC2LVBNm','BwvZC2fNzq','Bg9N','DMvYC2LVBNmG5PYQ6ywn572U','qgSTDgfIBguVCMvWB3j0l3n0B3jL','BgvUz3rO','s3roB3rgB3vUzevYCM9Y','y3jLyxrLs3riyw5KBgvY','revmrvrf','l2fWAs9RDa','zMLSzq','A2LUza','y3vYCMvUDa','ndjbBufWANa','nZq5ndznEfjSyLu','y29TBwL0','Cgf0Ag5HBwu','ndiZzMvktxfb','Cgf0Aa','s3rtDg9YzuvYCM9Y','C2vHCMnOugfYyw1Z','y3jLyxrL','C2f2zq'];_0x51f4=function(){return _0x32f023;};return _0x51f4();}function createKtHandler(_0x2748fb){const _0x34919e=async(_0x4ba339,_0x4039d3={})=>{const _0x4081cd=_0x2da7;try{const _0xea4654=new URL(_0x4ba339[_0x4081cd(0x12c)]),_0x46c773=await pathParts(_0x4039d3,_0xea4654),[_0x31e9ad,_0x53b3fb,_0x52ea95]=_0x46c773,_0x31fb0a=_0x4ba339['method']['toUpperCase']();if(_0x31e9ad==='artifacts'&&!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x11e)){const _0x392bca=_0xea4654[_0x4081cd(0x147)]['get'](_0x4081cd(0x13e));return json({'items':await _0x2748fb['artifacts'][_0x4081cd(0x120)](_0x392bca||void 0x0)});}if(_0x31e9ad===_0x4081cd(0x131)&&!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x128)){if(!_0x2748fb[_0x4081cd(0x131)]['create'])return json({'message':_0x4081cd(0x12d)},0x194);return json(await _0x2748fb[_0x4081cd(0x131)][_0x4081cd(0x148)](await readBody(_0x4ba339)));}if(_0x31e9ad===_0x4081cd(0x131)&&_0x53b3fb&&_0x31fb0a===_0x4081cd(0x11e))return json(await _0x2748fb[_0x4081cd(0x131)]['get'](_0x53b3fb));if(_0x31e9ad===_0x4081cd(0x131)&&_0x53b3fb&&_0x31fb0a===_0x4081cd(0x127))return json(await _0x2748fb[_0x4081cd(0x131)][_0x4081cd(0x149)](await readBody(_0x4ba339)));if(_0x31e9ad===_0x4081cd(0x131)&&_0x53b3fb&&_0x31fb0a===_0x4081cd(0x13b)){if(!_0x2748fb[_0x4081cd(0x131)]['remove'])return json({'message':_0x4081cd(0x12b)},0x194);return await _0x2748fb[_0x4081cd(0x131)][_0x4081cd(0x14f)](_0x53b3fb),json({'ok':!![]});}if(_0x31e9ad===_0x4081cd(0x126)){if(!_0x2748fb['instances'])return json({'message':_0x4081cd(0x124)},0x194);if(!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x11e))return json({'items':await _0x2748fb[_0x4081cd(0x126)]['list']?.(_0xea4654[_0x4081cd(0x147)][_0x4081cd(0x125)](_0x4081cd(0x14d))??void 0x0)??[]});if(!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x128)){if(!_0x2748fb[_0x4081cd(0x126)]['create'])return json({'message':_0x4081cd(0x12d)},0x194);return json(await _0x2748fb['instances'][_0x4081cd(0x148)](await readBody(_0x4ba339)));}if(_0x53b3fb&&_0x31fb0a===_0x4081cd(0x11e))return json(await _0x2748fb[_0x4081cd(0x126)][_0x4081cd(0x125)](_0x53b3fb));if(_0x53b3fb&&_0x31fb0a===_0x4081cd(0x127))return await _0x2748fb['instances'][_0x4081cd(0x149)](_0x53b3fb,await readBody(_0x4ba339)),json({'ok':!![]});}if(_0x31e9ad==='versions'){if(!_0x2748fb[_0x4081cd(0x133)])return json({'message':_0x4081cd(0x136)},0x194);if(!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x11e)){const _0x5381b6=_0xea4654[_0x4081cd(0x147)][_0x4081cd(0x125)](_0x4081cd(0x13e))??'',_0x557a7c=_0xea4654['searchParams'][_0x4081cd(0x125)]('id')??'';return json(await _0x2748fb[_0x4081cd(0x133)][_0x4081cd(0x135)](_0x5381b6,_0x557a7c));}if(!_0x53b3fb&&_0x31fb0a===_0x4081cd(0x128))return json(await _0x2748fb['versions'][_0x4081cd(0x142)](await readBody(_0x4ba339)));if(_0x53b3fb&&_0x52ea95===_0x4081cd(0x13d)&&_0x31fb0a==='GET'){const _0x3f3578=await _0x2748fb[_0x4081cd(0x133)]['readFile'](_0x53b3fb,_0xea4654[_0x4081cd(0x147)][_0x4081cd(0x125)](_0x4081cd(0x145))??'');return new Response(Buffer[_0x4081cd(0x121)](_0x3f3578),{'headers':{'content-type':'application/octet-stream'}});}if(_0x53b3fb&&_0x52ea95===_0x4081cd(0x14c)&&_0x31fb0a===_0x4081cd(0x128)){const _0x4dce77=await readBody(_0x4ba339);return json(await _0x2748fb['versions'][_0x4081cd(0x14c)](_0x4dce77[_0x4081cd(0x13e)],_0x4dce77['id'],_0x53b3fb,_0x4dce77['by']));}if(_0x53b3fb&&!_0x52ea95&&_0x31fb0a==='GET')return json(await _0x2748fb[_0x4081cd(0x133)][_0x4081cd(0x125)](_0x53b3fb));}return json({'message':_0x4081cd(0x151)},0x194);}catch(_0x54767a){return fail(_0x54767a);}};return{'GET':_0x34919e,'POST':_0x34919e,'PUT':_0x34919e,'DELETE':_0x34919e};}function defineKtConfig(_0x5d1587){return _0x5d1587;}exports[_0x2797f7(0x13a)]=createKtHandler,exports[_0x2797f7(0x14a)]=defineKtConfig;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x306d6e,_0x28a49e){const _0x7d58c=_0x329b,_0x35e133=_0x306d6e();while(!![]){try{const _0x333fc8=-parseInt(_0x7d58c(0x18f))/0x1+-parseInt(_0x7d58c(0x180))/0x2+parseInt(_0x7d58c(0x185))/0x3+parseInt(_0x7d58c(0x18c))/0x4*(parseInt(_0x7d58c(0x197))/0x5)+parseInt(_0x7d58c(0x186))/0x6*(parseInt(_0x7d58c(0x172))/0x7)+parseInt(_0x7d58c(0x179))/0x8+-parseInt(_0x7d58c(0x18e))/0x9;if(_0x333fc8===_0x28a49e)break;else _0x35e133['push'](_0x35e133['shift']());}catch(_0x4e5826){_0x35e133['push'](_0x35e133['shift']());}}}(_0x142b,0x34252));function _0x142b(){const _0x11ff63=['CgfYyw1Z','C3bSAxq','Aw5KzxHpzG','CgfYC2u','5PYQ5OM+5yIW','nZi1otGWEMf6AKPN','DMvYC2LVBNmG5PYQ6ywn572U','zMLSDgvY','5yAf6yoO6zsz6k+V','yxj0AwzHy3rZ','ndC1mJi0quPHtenh','mZq4nM1pA1LSta','revmrvrf','ufvu','y3vYCMvUDa','A2LUza','BgvUz3rO','odi4ndm2q0Pzzhz5','DMvYC2LVBNm','ndy0mtK2nK5gvu1Iwa','mti1otCYrwHbzerz','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','y3jLyxrL','Aw5ZDgfUy2vZ','C2XPy2u','CMvZDg9Yzq','z2v0','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','mtb6EuDryM4','Aw5ZDgfUy2vZioACQUMfJEE9RG','BgLZDa','y29TBwL0','C2vHCMnOugfYyw1Z','DxjS','Dg9vChbLCKnHC2u','Cgf0Ag5HBwu','C2f2zq','CMvHzezPBgu','zMLSzq','C3rYAw5NAwz5','ue9tva','mJy5nuHUEvnHrW','CMvTB3zLioACQUwUNUEoSa','r0vu','CMvTB3zL','Bg9N','Cgf0Aa','BwvZC2fNzq','mZm3nJa4ohb1vezUvG','l2fWAs9RDa'];_0x142b=function(){return _0x11ff63;};return _0x142b();}import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x21f10c,_0x4eca45){const _0xaefb3d=_0x329b,_0x38072f=_0x21f10c[_0xaefb3d(0x17b)]?await _0x21f10c[_0xaefb3d(0x17b)]:void 0x0;if(_0x38072f?.[_0xaefb3d(0x177)]?.['length'])return _0x38072f[_0xaefb3d(0x177)];const _0x12a4e4=_0x4eca45[_0xaefb3d(0x19e)][_0xaefb3d(0x17d)](_0xaefb3d(0x17a)),_0x1ff0d0=_0x12a4e4>=0x0?_0x4eca45[_0xaefb3d(0x19e)][_0xaefb3d(0x193)](_0x12a4e4+'/api/kt'[_0xaefb3d(0x18b)]):_0x4eca45[_0xaefb3d(0x19e)];return _0x1ff0d0[_0xaefb3d(0x17c)]('/')[_0xaefb3d(0x182)](Boolean);}function json(_0x53f1a5,_0x1a123b=0xc8){const _0x2984dc=_0x329b;return new Response(JSON[_0x2984dc(0x170)](_0x53f1a5),{'status':_0x1a123b,'headers':{'content-type':_0x2984dc(0x190)}});}function _0x329b(_0x270e8a,_0x1326ac){_0x270e8a=_0x270e8a-0x170;const _0x142b43=_0x142b();let _0x329bad=_0x142b43[_0x270e8a];if(_0x329b['sDqBMn']===undefined){var _0x2d4474=function(_0xb55acf){const _0x4c3b85='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ce096='',_0x21f10c='';for(let _0x4eca45=0x0,_0x38072f,_0x12a4e4,_0x1ff0d0=0x0;_0x12a4e4=_0xb55acf['charAt'](_0x1ff0d0++);~_0x12a4e4&&(_0x38072f=_0x4eca45%0x4?_0x38072f*0x40+_0x12a4e4:_0x12a4e4,_0x4eca45++%0x4)?_0x2ce096+=String['fromCharCode'](0xff&_0x38072f>>(-0x2*_0x4eca45&0x6)):0x0){_0x12a4e4=_0x4c3b85['indexOf'](_0x12a4e4);}for(let _0x53f1a5=0x0,_0x1a123b=_0x2ce096['length'];_0x53f1a5<_0x1a123b;_0x53f1a5++){_0x21f10c+='%'+('00'+_0x2ce096['charCodeAt'](_0x53f1a5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x21f10c);};_0x329b['yVecaQ']=_0x2d4474,_0x329b['PhhYiw']={},_0x329b['sDqBMn']=!![];}const _0x3fc779=_0x142b43[0x0];_0x329b['JumOHv']!==_0x3fc779&&(_0x329b['PhhYiw']={},_0x329b['JumOHv']=_0x3fc779);const _0x2e014f=_0x329b['PhhYiw'][_0x270e8a];return _0x2e014f===undefined?(_0x329bad=_0x329b['yVecaQ'](_0x329bad),_0x329b['PhhYiw'][_0x270e8a]=_0x329bad):_0x329bad=_0x2e014f,_0x329bad;}function fail(_0x51ebf7){const _0x45a9b5=_0x329b;if(_0x51ebf7 instanceof KtConflictError)return json({'message':_0x51ebf7[_0x45a9b5(0x178)],'current':_0x51ebf7[_0x45a9b5(0x189)]},0x199);if(_0x51ebf7 instanceof KtNotFoundError)return json({'message':_0x51ebf7[_0x45a9b5(0x178)]},0x194);if(_0x51ebf7 instanceof KtStoreError)return json({'message':_0x51ebf7['message']},_0x51ebf7['status']??0x1f4);return json({'message':_0x51ebf7 instanceof Error?_0x51ebf7[_0x45a9b5(0x178)]:_0x45a9b5(0x183)},0x1f4);}async function readBody(_0x589a27){const _0x1457fb=_0x329b,_0x5127af=await _0x589a27['text']();if(!_0x5127af)return null;return JSON[_0x1457fb(0x17e)](_0x5127af);}function createKtHandler(_0x5b832){const _0x502c7d=async(_0x4439b2,_0x5887b4={})=>{const _0x4cb64f=_0x329b;try{const _0x368a9d=new URL(_0x4439b2[_0x4cb64f(0x19c)]),_0x8893a2=await pathParts(_0x5887b4,_0x368a9d),[_0x4af429,_0x1e5fa0,_0x2bb641]=_0x8893a2,_0x4a7365=_0x4439b2['method'][_0x4cb64f(0x19d)]();if(_0x4af429===_0x4cb64f(0x184)&&!_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x174)){const _0xdb3d52=_0x368a9d[_0x4cb64f(0x19b)][_0x4cb64f(0x195)](_0x4cb64f(0x18a));return json({'items':await _0x5b832['artifacts'][_0x4cb64f(0x199)](_0xdb3d52||void 0x0)});}if(_0x4af429===_0x4cb64f(0x184)&&!_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x171)){if(!_0x5b832[_0x4cb64f(0x184)][_0x4cb64f(0x191)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x5b832['artifacts'][_0x4cb64f(0x191)](await readBody(_0x4439b2)));}if(_0x4af429===_0x4cb64f(0x184)&&_0x1e5fa0&&_0x4a7365==='GET')return json(await _0x5b832['artifacts'][_0x4cb64f(0x195)](_0x1e5fa0));if(_0x4af429===_0x4cb64f(0x184)&&_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x188))return json(await _0x5b832[_0x4cb64f(0x184)][_0x4cb64f(0x19f)](await readBody(_0x4439b2)));if(_0x4af429==='artifacts'&&_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x187)){if(!_0x5b832[_0x4cb64f(0x184)][_0x4cb64f(0x175)])return json({'message':_0x4cb64f(0x173)},0x194);return await _0x5b832[_0x4cb64f(0x184)]['remove'](_0x1e5fa0),json({'ok':!![]});}if(_0x4af429===_0x4cb64f(0x192)){if(!_0x5b832[_0x4cb64f(0x192)])return json({'message':_0x4cb64f(0x198)},0x194);if(!_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x174))return json({'items':await _0x5b832['instances']['list']?.(_0x368a9d[_0x4cb64f(0x19b)][_0x4cb64f(0x195)]('artifactId')??void 0x0)??[]});if(!_0x1e5fa0&&_0x4a7365==='POST'){if(!_0x5b832[_0x4cb64f(0x192)][_0x4cb64f(0x191)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x5b832[_0x4cb64f(0x192)][_0x4cb64f(0x191)](await readBody(_0x4439b2)));}if(_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x174))return json(await _0x5b832['instances']['get'](_0x1e5fa0));if(_0x1e5fa0&&_0x4a7365===_0x4cb64f(0x188))return await _0x5b832[_0x4cb64f(0x192)]['save'](_0x1e5fa0,await readBody(_0x4439b2)),json({'ok':!![]});}if(_0x4af429===_0x4cb64f(0x18d)){if(!_0x5b832[_0x4cb64f(0x18d)])return json({'message':_0x4cb64f(0x181)},0x194);if(!_0x1e5fa0&&_0x4a7365==='GET'){const _0x404bbb=_0x368a9d['searchParams']['get'](_0x4cb64f(0x18a))??'',_0x1ea9ac=_0x368a9d[_0x4cb64f(0x19b)][_0x4cb64f(0x195)]('id')??'';return json(await _0x5b832['versions'][_0x4cb64f(0x176)](_0x404bbb,_0x1ea9ac));}if(!_0x1e5fa0&&_0x4a7365==='POST')return json(await _0x5b832[_0x4cb64f(0x18d)][_0x4cb64f(0x19a)](await readBody(_0x4439b2)));if(_0x1e5fa0&&_0x2bb641===_0x4cb64f(0x1a1)&&_0x4a7365==='GET'){const _0x2fb5de=await _0x5b832[_0x4cb64f(0x18d)][_0x4cb64f(0x1a0)](_0x1e5fa0,_0x368a9d[_0x4cb64f(0x19b)][_0x4cb64f(0x195)](_0x4cb64f(0x177))??'');return new Response(Buffer['from'](_0x2fb5de),{'headers':{'content-type':_0x4cb64f(0x196)}});}if(_0x1e5fa0&&_0x2bb641===_0x4cb64f(0x194)&&_0x4a7365===_0x4cb64f(0x171)){const _0x40e55e=await readBody(_0x4439b2);return json(await _0x5b832[_0x4cb64f(0x18d)][_0x4cb64f(0x194)](_0x40e55e[_0x4cb64f(0x18a)],_0x40e55e['id'],_0x1e5fa0,_0x40e55e['by']));}if(_0x1e5fa0&&!_0x2bb641&&_0x4a7365==='GET')return json(await _0x5b832[_0x4cb64f(0x18d)][_0x4cb64f(0x195)](_0x1e5fa0));}return json({'message':_0x4cb64f(0x17f)},0x194);}catch(_0x1c2737){return fail(_0x1c2737);}};return{'GET':_0x502c7d,'POST':_0x502c7d,'PUT':_0x502c7d,'DELETE':_0x502c7d};}function defineKtConfig(_0x5c338d){return _0x5c338d;}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.34",
|
|
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.34"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"next": ">=15"
|