@k-table/next 1.0.35 → 1.0.37
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 _0x489bbe=_0x35e9;(function(_0xce71cc,_0x555024){const _0x3321aa=_0x35e9,_0x424149=_0xce71cc();while(!![]){try{const _0x3ce3f7=parseInt(_0x3321aa(0xbb))/0x1+-parseInt(_0x3321aa(0xa2))/0x2+-parseInt(_0x3321aa(0xe3))/0x3*(parseInt(_0x3321aa(0x97))/0x4)+parseInt(_0x3321aa(0xd8))/0x5+parseInt(_0x3321aa(0x99))/0x6*(parseInt(_0x3321aa(0xca))/0x7)+parseInt(_0x3321aa(0xa3))/0x8+-parseInt(_0x3321aa(0xd4))/0x9;if(_0x3ce3f7===_0x555024)break;else _0x424149['push'](_0x424149['shift']());}catch(_0x317f04){_0x424149['push'](_0x424149['shift']());}}}(_0x5404,0xf27c0));var fs=require('fs'),path=require(_0x489bbe(0xcf)),store=require(_0x489bbe(0xe1)),crypto=require('crypto');function resolveRoot(_0x4e5c0c,_0x3544c1=process[_0x489bbe(0xb1)]()){const _0x4ebe35=_0x489bbe,_0x2e5da4=path[_0x4ebe35(0xb3)](_0x4e5c0c)?_0x4e5c0c:path['resolve'](_0x3544c1,_0x4e5c0c);return fs[_0x4ebe35(0x9b)](_0x2e5da4,{'recursive':!![]}),_0x2e5da4;}function _0x35e9(_0x371597,_0x4547b9){_0x371597=_0x371597-0x90;const _0x540465=_0x5404();let _0x35e943=_0x540465[_0x371597];if(_0x35e9['shTkIQ']===undefined){var _0x1cb09d=function(_0x467c20){const _0x348649='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x56e55a='',_0x4e5c0c='';for(let _0x3544c1=0x0,_0x2e5da4,_0xd9b13a,_0x11c0d1=0x0;_0xd9b13a=_0x467c20['charAt'](_0x11c0d1++);~_0xd9b13a&&(_0x2e5da4=_0x3544c1%0x4?_0x2e5da4*0x40+_0xd9b13a:_0xd9b13a,_0x3544c1++%0x4)?_0x56e55a+=String['fromCharCode'](0xff&_0x2e5da4>>(-0x2*_0x3544c1&0x6)):0x0){_0xd9b13a=_0x348649['indexOf'](_0xd9b13a);}for(let _0x3ea19a=0x0,_0x4d22b4=_0x56e55a['length'];_0x3ea19a<_0x4d22b4;_0x3ea19a++){_0x4e5c0c+='%'+('00'+_0x56e55a['charCodeAt'](_0x3ea19a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4e5c0c);};_0x35e9['mxjMOQ']=_0x1cb09d,_0x35e9['beFvau']={},_0x35e9['shTkIQ']=!![];}const _0x201cf7=_0x540465[0x0];_0x35e9['LBTjLe']!==_0x201cf7&&(_0x35e9['beFvau']={},_0x35e9['LBTjLe']=_0x201cf7);const _0x3f1bb9=_0x35e9['beFvau'][_0x371597];return _0x3f1bb9===undefined?(_0x35e943=_0x35e9['mxjMOQ'](_0x35e943),_0x35e9['beFvau'][_0x371597]=_0x35e943):_0x35e943=_0x3f1bb9,_0x35e943;}function artifactDir(_0xd9b13a,_0x11c0d1){return path['join'](_0xd9b13a,_0x11c0d1);}function objectPath(_0x3ea19a,_0x4d22b4){const _0x52a9d6=_0x489bbe;return path['join'](_0x3ea19a,_0x52a9d6(0xd1),_0x4d22b4[_0x52a9d6(0xdd)](0x0,0x2),_0x4d22b4);}function itemDir(_0x595da8,_0x28e926,_0x150aab){const _0x280807=_0x489bbe;return path['join'](_0x595da8,_0x280807(0xe0),_0x28e926,_0x150aab);}function newEtag(){const _0x3ba2eb=_0x489bbe;return Date[_0x3ba2eb(0xea)]()['toString'](0x24)+'-'+Math['random']()[_0x3ba2eb(0xa1)](0x24)[_0x3ba2eb(0xdd)](0x2,0x8);}function readEtag(_0x5df9de){const _0xf21aeb=_0x489bbe,_0x59e240=path['join'](_0x5df9de,_0xf21aeb(0xbd));return fs[_0xf21aeb(0xce)](_0x59e240)?fs[_0xf21aeb(0xa9)](_0x59e240,_0xf21aeb(0xd3))[_0xf21aeb(0x98)]():void 0x0;}function writeArtifactDir(_0x10d54f,_0x41425c,_0x38542a){const _0x139a49=_0x489bbe;fs[_0x139a49(0x9b)](path['join'](_0x10d54f,_0x139a49(0xa4)),{'recursive':!![]});const _0x33ac26=store['artifactToFiles'](_0x41425c);fs[_0x139a49(0xaa)](path['join'](_0x10d54f,store[_0x139a49(0xac)]),_0x33ac26[store[_0x139a49(0xac)]]??'{}',_0x139a49(0xd3)),fs[_0x139a49(0xaa)](path[_0x139a49(0xc1)](_0x10d54f,store[_0x139a49(0xad)]),_0x33ac26[store[_0x139a49(0xad)]]??'','utf8');const _0x241915=path[_0x139a49(0xc1)](_0x10d54f,store[_0x139a49(0xba)]),_0x179f96=path[_0x139a49(0xc1)](_0x10d54f,store[_0x139a49(0xb0)]);if(_0x33ac26[store['ARTIFACT_FILE_FILL']])fs[_0x139a49(0xaa)](_0x241915,_0x33ac26[store[_0x139a49(0xba)]],_0x139a49(0xd3));else{if(fs[_0x139a49(0xce)](_0x241915))fs[_0x139a49(0xc4)](_0x241915);}if(_0x33ac26[store['ARTIFACT_FILE_REPORT']])fs['writeFileSync'](_0x179f96,_0x33ac26[store[_0x139a49(0xb0)]],_0x139a49(0xd3));else{if(fs['existsSync'](_0x179f96))fs[_0x139a49(0xc4)](_0x179f96);}fs[_0x139a49(0xaa)](path[_0x139a49(0xc1)](_0x10d54f,_0x139a49(0xbd)),_0x38542a,'utf8');}function readArtifactDir(_0x5ce0b4,_0x2d710c){const _0x21c60c=_0x489bbe,_0x159342={},_0x420b35=path[_0x21c60c(0xc1)](_0x5ce0b4,store[_0x21c60c(0xac)]),_0x5011cb=path[_0x21c60c(0xc1)](_0x5ce0b4,store['ARTIFACT_FILE_BODY']);if(fs[_0x21c60c(0xce)](_0x420b35))_0x159342[store[_0x21c60c(0xac)]]=fs[_0x21c60c(0xa9)](_0x420b35,'utf8');if(fs['existsSync'](_0x5011cb))_0x159342[store[_0x21c60c(0xad)]]=fs[_0x21c60c(0xa9)](_0x5011cb,_0x21c60c(0xd3));const _0x328d05=path[_0x21c60c(0xc1)](_0x5ce0b4,store['ARTIFACT_FILE_FILL']),_0x592f7=path['join'](_0x5ce0b4,store['ARTIFACT_FILE_REPORT']);if(fs[_0x21c60c(0xce)](_0x328d05))_0x159342[store[_0x21c60c(0xba)]]=fs[_0x21c60c(0xa9)](_0x328d05,_0x21c60c(0xd3));if(fs[_0x21c60c(0xce)](_0x592f7))_0x159342[store[_0x21c60c(0xb0)]]=fs[_0x21c60c(0xa9)](_0x592f7,_0x21c60c(0xd3));return{...store[_0x21c60c(0xe4)](_0x159342,_0x2d710c),'etag':readEtag(_0x5ce0b4)};}function createFsArtifactStore(_0x34f4da,_0x50613f=[]){const _0x8bf40d=_0x489bbe;fs[_0x8bf40d(0x9b)](_0x34f4da,{'recursive':!![]});for(const _0x3cf0a9 of _0x50613f){const _0x324827=artifactDir(_0x34f4da,_0x3cf0a9['id']),_0x2c246b=path['join'](_0x324827,store['ARTIFACT_FILE_BODY']);if(!fs['existsSync'](_0x2c246b))writeArtifactDir(_0x324827,_0x3cf0a9,_0x3cf0a9[_0x8bf40d(0xc3)]??newEtag());}return{async 'list'(_0x4e19b7){const _0x1feda1=_0x8bf40d;if(!fs[_0x1feda1(0xce)](_0x34f4da))return[];const _0x4e3a22=[];for(const _0x59b173 of fs[_0x1feda1(0xbe)](_0x34f4da,{'withFileTypes':!![]})){if(!_0x59b173[_0x1feda1(0x9a)]())continue;try{const _0x1d2612=readArtifactDir(artifactDir(_0x34f4da,_0x59b173[_0x1feda1(0xb9)]),_0x59b173['name']);if(!_0x4e19b7||_0x1d2612[_0x1feda1(0xb2)]===_0x4e19b7)_0x4e3a22['push']({'id':_0x1d2612['id'],'name':_0x1d2612[_0x1feda1(0xb9)],'kind':_0x1d2612[_0x1feda1(0xb2)]});}catch{}}return _0x4e3a22;},async 'get'(_0x400b74){const _0x51bed0=_0x8bf40d,_0x31d520=artifactDir(_0x34f4da,_0x400b74);if(!fs[_0x51bed0(0xce)](_0x31d520))throw new store[(_0x51bed0(0xdb))](_0x51bed0(0xe9)+_0x400b74);return readArtifactDir(_0x31d520,_0x400b74);},async 'save'(_0x4a18e0){const _0xc21ad5=_0x8bf40d,_0x204455=artifactDir(_0x34f4da,_0x4a18e0['id']),_0x57a759=fs[_0xc21ad5(0xce)](_0x204455)?readArtifactDir(_0x204455,_0x4a18e0['id']):void 0x0;if(_0x4a18e0[_0xc21ad5(0xc3)]&&_0x57a759?.['etag']&&_0x4a18e0[_0xc21ad5(0xc3)]!==_0x57a759[_0xc21ad5(0xc3)])throw new store[(_0xc21ad5(0xbc))](_0xc21ad5(0xb5),_0x57a759);const _0x54a893=newEtag();return writeArtifactDir(_0x204455,_0x4a18e0,_0x54a893),{..._0x4a18e0,'etag':_0x54a893};},async 'create'(_0x27a851){const _0x418c02=_0x8bf40d,_0x4de4a5=_0x27a851[_0x418c02(0xb2)]+'-'+Math['random']()[_0x418c02(0xa1)](0x24)[_0x418c02(0xdd)](0x2,0xa),_0x2e9633={'id':_0x4de4a5,'name':_0x27a851['name'],'kind':_0x27a851[_0x418c02(0xb2)],'ktl':store['EMPTY_KTL']};return this[_0x418c02(0xe8)](_0x2e9633);},async 'remove'(_0x100f5c){const _0x256df5=_0x8bf40d,_0xde76fc=artifactDir(_0x34f4da,_0x100f5c);if(!fs['existsSync'](_0xde76fc))throw new store[(_0x256df5(0xdb))](_0x256df5(0xe9)+_0x100f5c);fs[_0x256df5(0xc4)](_0xde76fc,{'recursive':!![],'force':!![]});}};}function _0x5404(){const _0x54efc7=['nJK2mJu4mfbACeTYra','C3rYAw5N','Bwv0yq','s3roB3rgB3vUzevYCM9Y','zMLUza','C2XPy2u','zMLSzxm','zw5KC1DPDgG','AxrLBxm','qgSTDgfIBguVCMvWB3j0l3n0B3jL','C2HHmJu2','mJm4mJi3BfbAuLfX','zMLSzxnuB0fYDgLMywn0','zgLYBMfTzq','CgfKu3rHCNq','CMv2','C2f2zq','yxj0AwzHy3qG','BM93','BM90zq','zMLSDgvY','zNjVBq','C2vLza','Dg9ju09tDhjPBMC','zgLNzxn0','CMv2ia','neXiEwf0uG','DhjPBq','ndeXnZj3DeHYyu0','AxneAxjLy3rVCNK','BwTKAxjtEw5J','y3jLyxrLsgfZAa','C29YDa','Agv4','yxj0AwzHy3rjza','DgfIq29TBw9U','Dg9tDhjPBMC','mJGYodyXngXnsvHNyq','mti0ntKWodbYrLbqs1q','zMfJzxm','CMfUzg9T','zw50CMLLCW','DMvYC2LVBNnsB290','z2v0','CMvHzezPBgvtEw5J','D3jPDgvgAwXLu3LUyW','Bg9NlMPZB24','qvjusuzbq1rFrKLmrv9nrvrb','qvjusuzbq1rFrKLmrv9ct0rz','DMfSDwvZ','C3rYAw5NAwz5','qvjusuzbq1rFrKLmrv9srvbpuLq','y3DK','A2LUza','AxnbyNnVBhv0zq','zgvJB2rL','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','Aw5ZDgfUy2uG','lMPZB24','yxj0AwzHy3rZuM9VDa','BMfTzq','qvjusuzbq1rFrKLmrv9gsuXm','mtaXoti3nuTpqNzovW','s3rdB25MBgLJDevYCM9Y','lMv0ywC','CMvHzgrPCLn5BMm','z2v0tw9UDgG','Aw5ZDgfUy2vZuM9VDa','AM9PBG','zMLSzxnfCxvHBa','zxrHzW','CM1tEw5J','BwfW','y3jLyxrLs3rgC1n0B3jLCW','C2vLzeLUC3rHBMnLCW','lwXVy2fSlq','CMvHzezPBgu','mZuWvezQr2Tl','y29TBw9U','AgvHza','DxbKyxrL','zxHPC3rZu3LUyW','Cgf0Aa','CgfYC2u','B2jQzwn0CW','y29TBwL0','DxrMoa','mty0mJGWotzAze1iAeO','sevbra','z2v0sg91CNm','z2v0twLUDxrLCW'];_0x5404=function(){return _0x54efc7;};return _0x5404();}function createFsInstanceStore(_0x4125c6,_0x485d31={}){const _0x5234a0=_0x489bbe;fs[_0x5234a0(0x9b)](_0x4125c6,{'recursive':!![]});const _0x3ef3d3=_0x50c140=>path[_0x5234a0(0xc1)](_0x4125c6,_0x50c140+'.json');for(const [_0x5ef4c7,_0x2501b9]of Object['entries'](_0x485d31)){if(!fs[_0x5234a0(0xce)](_0x3ef3d3(_0x5ef4c7)))fs[_0x5234a0(0xaa)](_0x3ef3d3(_0x5ef4c7),JSON[_0x5234a0(0xaf)](_0x2501b9,null,0x2),_0x5234a0(0xd3));}return{async 'get'(_0x4d5f6e){const _0xeccb43=_0x5234a0,_0x2a7390=_0x3ef3d3(_0x4d5f6e);if(!fs['existsSync'](_0x2a7390))throw new store[(_0xeccb43(0xdb))](_0xeccb43(0xb6)+_0x4d5f6e);return JSON['parse'](fs[_0xeccb43(0xa9)](_0x2a7390,'utf8'));},async 'save'(_0x240f8f,_0x2b2b9b){const _0x488a2a=_0x5234a0,_0x5d5bc7=_0x3ef3d3(_0x240f8f),_0x38978d=fs[_0x488a2a(0xce)](_0x5d5bc7)?JSON['parse'](fs[_0x488a2a(0xa9)](_0x5d5bc7,_0x488a2a(0xd3))):{'artifactId':'','values':{}},_0x52c84f={'artifactId':_0x38978d['artifactId'],'values':{..._0x38978d[_0x488a2a(0xae)],..._0x2b2b9b['values']},'common':{..._0x38978d['common'],..._0x2b2b9b[_0x488a2a(0xcb)]},'tabCommon':{..._0x38978d[_0x488a2a(0xa0)],..._0x2b2b9b['tabCommon']}};fs[_0x488a2a(0xaa)](_0x5d5bc7,JSON['stringify'](_0x52c84f,null,0x2),_0x488a2a(0xd3));},async 'list'(_0x3045e8){const _0x326e42=_0x5234a0;return fs['readdirSync'](_0x4125c6)[_0x326e42(0x91)](_0x3c6e8d=>_0x3c6e8d[_0x326e42(0xdf)](_0x326e42(0xb7)))[_0x326e42(0xc5)](_0x2e2669=>{const _0x25b8f3=_0x326e42,_0x16ba66=_0x2e2669[_0x25b8f3(0xdd)](0x0,-0x5),_0x1ad7d9=JSON[_0x25b8f3(0xd0)](fs['readFileSync'](path['join'](_0x4125c6,_0x2e2669),_0x25b8f3(0xd3)));return{'id':_0x16ba66,'artifactId':_0x1ad7d9[_0x25b8f3(0x9f)]};})[_0x326e42(0x91)](_0x49b5a3=>!_0x3045e8||_0x49b5a3[_0x326e42(0x9f)]===_0x3045e8);},async 'create'(_0x135863){const _0x49c892=_0x5234a0,_0x295ba5='inst-'+Math[_0x49c892(0xa5)]()[_0x49c892(0xa1)](0x24)[_0x49c892(0xdd)](0x2,0xa);return fs[_0x49c892(0xaa)](_0x3ef3d3(_0x295ba5),JSON[_0x49c892(0xaf)]({'artifactId':_0x135863['artifactId'],'values':{},'common':{}},null,0x2),_0x49c892(0xd3)),{'id':_0x295ba5};}};}function sha256Hex(_0x3962ad){const _0x314915=_0x489bbe,_0x335d3f=typeof _0x3962ad==='string'?Buffer[_0x314915(0x92)](_0x3962ad,_0x314915(0xd3)):Buffer[_0x314915(0x92)](_0x3962ad);return crypto[_0x314915(0x9c)](_0x314915(0xe2))[_0x314915(0xcd)](_0x335d3f)[_0x314915(0x95)](_0x314915(0x9e));}function writeObject(_0x24713e,_0xa1a43b){const _0x27ae86=_0x489bbe,_0x10282c=sha256Hex(_0xa1a43b),_0x58130d=objectPath(_0x24713e,_0x10282c);fs['mkdirSync'](path[_0x27ae86(0xe5)](_0x58130d),{'recursive':!![]});if(!fs[_0x27ae86(0xce)](_0x58130d))fs['writeFileSync'](_0x58130d,_0xa1a43b);return _0x10282c;}function readLog(_0x1190ff,_0x290e72,_0x1893dc){const _0x34f628=_0x489bbe,_0x5d2701=itemDir(_0x1190ff,_0x290e72,_0x1893dc),_0x40bbc0=path[_0x34f628(0xc1)](_0x5d2701,_0x34f628(0xab)),_0x4b8793=path[_0x34f628(0xc1)](_0x5d2701,_0x34f628(0xd5)),_0x32ce96=fs[_0x34f628(0xce)](_0x40bbc0)?JSON[_0x34f628(0xd0)](fs[_0x34f628(0xa9)](_0x40bbc0,_0x34f628(0xd3))):[],_0x514809=fs[_0x34f628(0xce)](_0x4b8793)?fs[_0x34f628(0xa9)](_0x4b8793,_0x34f628(0xd3))['trim']():_0x32ce96['at'](-0x1)?.[_0x34f628(0xe7)]??null;return{'head':_0x514809,'items':_0x32ce96};}function writeLog(_0x2c559a,_0xfb6d31,_0x471fe2,_0xa6a663,_0x2da7ee){const _0x274057=_0x489bbe,_0x28a51f=itemDir(_0x2c559a,_0xfb6d31,_0x471fe2);fs[_0x274057(0x9b)](_0x28a51f,{'recursive':!![]}),fs[_0x274057(0xaa)](path[_0x274057(0xc1)](_0x28a51f,'log.json'),JSON['stringify'](_0x2da7ee,null,0x2),_0x274057(0xd3)),fs['writeFileSync'](path[_0x274057(0xc1)](_0x28a51f,_0x274057(0xd5)),_0xa6a663+'\x0a',_0x274057(0xd3));}function findRev(_0x58ebf8,_0x591d16){const _0x3b30d1=_0x489bbe,_0x450ffa=path[_0x3b30d1(0xc1)](_0x58ebf8,'items');if(!fs['existsSync'](_0x450ffa))return void 0x0;for(const _0x38ced7 of fs['readdirSync'](_0x450ffa,{'withFileTypes':!![]})){if(!_0x38ced7[_0x3b30d1(0x9a)]())continue;for(const _0x391966 of fs[_0x3b30d1(0xbe)](path[_0x3b30d1(0xc1)](_0x450ffa,_0x38ced7['name']),{'withFileTypes':!![]})){if(!_0x391966[_0x3b30d1(0x9a)]())continue;const _0x135e42=readLog(_0x58ebf8,_0x38ced7['name'],_0x391966['name'])[_0x3b30d1(0xe0)][_0x3b30d1(0xdc)](_0x31a5f9=>_0x31a5f9[_0x3b30d1(0xe7)]===_0x591d16);if(_0x135e42)return _0x135e42;}}return void 0x0;}function filesTextOf(_0x375a03,_0x4a27d5){const _0x345637=_0x489bbe,_0x169571={};for(const [_0x2ed9bf,_0xb3c2ed]of Object[_0x345637(0xa6)](_0x4a27d5['files'])){const _0x17dde0=objectPath(_0x375a03,_0xb3c2ed);if(fs['existsSync'](_0x17dde0))_0x169571[_0x2ed9bf]=fs[_0x345637(0xa9)](_0x17dde0,_0x345637(0xd3));}return _0x169571;}function createFsVersionStore(_0x4993aa,_0x7add18){const _0x44cfa8=_0x489bbe;return fs[_0x44cfa8(0x9b)](_0x4993aa,{'recursive':!![]}),{async 'log'(_0x4e4662,_0x1e6f5c){const _0x7abc01=_0x44cfa8,{head:_0x484070,items:_0x5557d}=readLog(_0x4993aa,_0x4e4662,_0x1e6f5c);return{'head':_0x484070,'items':[..._0x5557d][_0x7abc01(0x9d)]((_0x18e087,_0x1c0d15)=>_0x18e087['at']<_0x1c0d15['at']?0x1:-0x1)};},async 'get'(_0x162c66){const _0x3ef5b1=_0x44cfa8,_0x187928=findRev(_0x4993aa,_0x162c66);if(!_0x187928)throw new store[(_0x3ef5b1(0xdb))](_0x3ef5b1(0x96)+_0x162c66);return _0x187928;},async 'readFile'(_0x24cc13,_0xa9ce4a){const _0x53468b=_0x44cfa8,_0x5bc7bb=await this['get'](_0x24cc13),_0x3f7214=_0x5bc7bb[_0x53468b(0xde)][_0xa9ce4a];if(!_0x3f7214)throw new store[(_0x53468b(0xdb))](_0xa9ce4a);const _0x1c9413=objectPath(_0x4993aa,_0x3f7214);if(!fs[_0x53468b(0xce)](_0x1c9413))throw new store[(_0x53468b(0xdb))](_0xa9ce4a);return new Uint8Array(fs['readFileSync'](_0x1c9413));},async 'commit'(_0x56ba05){const _0x11f170=_0x44cfa8;let _0x4c8373=_0x56ba05[_0x11f170(0xde)];if(!_0x4c8373){const _0x32fc1b=await _0x7add18[_0x11f170(0xa8)](_0x56ba05['id']);_0x4c8373=store['artifactToFiles'](_0x32fc1b);}const _0x11c86e={},_0x2c2efa={};for(const [_0x4c2e82,_0x534431]of Object[_0x11f170(0xa6)](_0x4c8373)){const _0x293dbb=typeof _0x534431===_0x11f170(0xd9)?_0x534431:new TextDecoder()[_0x11f170(0xb4)](_0x534431);_0x11c86e[_0x4c2e82]=_0x293dbb,_0x2c2efa[_0x4c2e82]=writeObject(_0x4993aa,typeof _0x534431===_0x11f170(0xd9)?Buffer[_0x11f170(0x92)](_0x534431,_0x11f170(0xd3)):_0x534431);}const _0x41ad92=readLog(_0x4993aa,_0x56ba05['kind'],_0x56ba05['id']);if(_0x41ad92[_0x11f170(0xcc)]){const _0x2c6645=_0x41ad92[_0x11f170(0xe0)][_0x11f170(0xdc)](_0x2148c9=>_0x2148c9[_0x11f170(0xe7)]===_0x41ad92['head']);if(_0x2c6645&&store[_0x11f170(0xc2)](_0x11c86e,filesTextOf(_0x4993aa,_0x2c6645)))return _0x2c6645;}const _0x195bca=new Date(),_0x20a3f1=String(_0x195bca['getFullYear']())['slice'](0x2)+String(_0x195bca[_0x11f170(0xbf)]()+0x1)[_0x11f170(0xe6)](0x2,'0')+String(_0x195bca['getDate']())['padStart'](0x2,'0')+String(_0x195bca[_0x11f170(0xd6)]())[_0x11f170(0xe6)](0x2,'0')+String(_0x195bca[_0x11f170(0xd7)]())[_0x11f170(0xe6)](0x2,'0'),_0x3db4c5=sha256Hex(Object[_0x11f170(0xae)](_0x2c2efa)['sort']()[_0x11f170(0xc1)](','))['slice'](0x0,0x8),_0x26eaf1={'rev':_0x20a3f1+_0x11f170(0xc8)+_0x3db4c5,'kind':_0x56ba05[_0x11f170(0xb2)],'id':_0x56ba05['id'],'at':_0x195bca[_0x11f170(0x94)](),'parent':_0x41ad92[_0x11f170(0xcc)],'by':_0x56ba05['by'],'note':_0x56ba05[_0x11f170(0x90)],'files':_0x2c2efa,'meta':_0x56ba05[_0x11f170(0xda)]};return writeLog(_0x4993aa,_0x56ba05[_0x11f170(0xb2)],_0x56ba05['id'],_0x26eaf1[_0x11f170(0xe7)],[..._0x41ad92['items'],_0x26eaf1]),_0x26eaf1;},async 'restore'(_0x562afa,_0xcf24a7,_0x2b7da1,_0x1cbd2b){const _0x4e3af6=_0x44cfa8,_0x1f6cbc=await this['get'](_0x2b7da1),_0x366572={};for(const _0x4d5e99 of Object['keys'](_0x1f6cbc['files'])){_0x366572[_0x4d5e99]=new TextDecoder()[_0x4e3af6(0xb4)](await this[_0x4e3af6(0xc9)](_0x2b7da1,_0x4d5e99));}const _0x214658=store['filesToArtifact'](_0x366572,_0xcf24a7);return await _0x7add18[_0x4e3af6(0xe8)]({..._0x214658,'id':_0xcf24a7,'kind':_0x214658[_0x4e3af6(0xb2)],'etag':void 0x0}),this[_0x4e3af6(0xd2)]({'kind':_0x562afa,'id':_0xcf24a7,'files':_0x366572,'by':_0x1cbd2b,'note':'\u6062\u590D\u81EA\x20'+_0x2b7da1});}};}function createKtFsStores(_0x2845dd){const _0x4f8afa=_0x489bbe,_0x3bc0e1=createFsArtifactStore(resolveRoot(_0x2845dd[_0x4f8afa(0xb8)],_0x2845dd[_0x4f8afa(0xb1)]),_0x2845dd[_0x4f8afa(0x93)]),_0x2f9390=_0x2845dd[_0x4f8afa(0xc0)]?createFsInstanceStore(resolveRoot(_0x2845dd[_0x4f8afa(0xc0)],_0x2845dd[_0x4f8afa(0xb1)]),_0x2845dd[_0x4f8afa(0xc7)]):void 0x0,_0x5b96c7=_0x2845dd[_0x4f8afa(0xa7)]?createFsVersionStore(resolveRoot(_0x2845dd[_0x4f8afa(0xa7)],_0x2845dd['cwd']),_0x3bc0e1):void 0x0;return{'artifacts':_0x3bc0e1,'instances':_0x2f9390,'versions':_0x5b96c7};}exports[_0x489bbe(0xc6)]=createKtFsStores;
|
|
1
|
+
'use strict';const _0x457114=_0x2c62;(function(_0x5ceb51,_0x4b2393){const _0x5ca2c0=_0x2c62,_0x2f0eda=_0x5ceb51();while(!![]){try{const _0x1e144c=parseInt(_0x5ca2c0(0xe0))/0x1*(parseInt(_0x5ca2c0(0xf9))/0x2)+-parseInt(_0x5ca2c0(0xf7))/0x3*(-parseInt(_0x5ca2c0(0xdd))/0x4)+parseInt(_0x5ca2c0(0xc0))/0x5+parseInt(_0x5ca2c0(0xf4))/0x6*(parseInt(_0x5ca2c0(0xc5))/0x7)+-parseInt(_0x5ca2c0(0xef))/0x8*(parseInt(_0x5ca2c0(0xda))/0x9)+parseInt(_0x5ca2c0(0xe9))/0xa+parseInt(_0x5ca2c0(0xd2))/0xb*(-parseInt(_0x5ca2c0(0xb8))/0xc);if(_0x1e144c===_0x4b2393)break;else _0x2f0eda['push'](_0x2f0eda['shift']());}catch(_0x469e13){_0x2f0eda['push'](_0x2f0eda['shift']());}}}(_0x4371,0xf25ee));var fs=require('fs'),path=require(_0x457114(0xf8)),store=require(_0x457114(0x10e)),crypto=require('crypto');function resolveRoot(_0x485b82,_0x1ed657=process[_0x457114(0xfd)]()){const _0x4b750b=_0x457114,_0x384c74=path[_0x4b750b(0x100)](_0x485b82)?_0x485b82:path['resolve'](_0x1ed657,_0x485b82);return fs[_0x4b750b(0xe3)](_0x384c74,{'recursive':!![]}),_0x384c74;}function artifactDir(_0x6d89aa,_0x462c5e){const _0x45fa36=_0x457114;return path[_0x45fa36(0xc8)](_0x6d89aa,_0x462c5e);}function objectPath(_0x5baa30,_0x324fef){const _0x44b087=_0x457114;return path[_0x44b087(0xc8)](_0x5baa30,_0x44b087(0xe8),_0x324fef[_0x44b087(0xbd)](0x0,0x2),_0x324fef);}function itemDir(_0x52f07f,_0xc2bf4a,_0x117f90){const _0x5d253d=_0x457114;return path[_0x5d253d(0xc8)](_0x52f07f,'items',_0xc2bf4a,_0x117f90);}function newEtag(){const _0x58789d=_0x457114;return Date[_0x58789d(0xde)]()['toString'](0x24)+'-'+Math[_0x58789d(0xeb)]()[_0x58789d(0xcc)](0x24)[_0x58789d(0xbd)](0x2,0x8);}function readEtag(_0x1b5df9){const _0x5eec8e=_0x457114,_0xa461cd=path[_0x5eec8e(0xc8)](_0x1b5df9,_0x5eec8e(0xc4));return fs['existsSync'](_0xa461cd)?fs['readFileSync'](_0xa461cd,_0x5eec8e(0xc6))['trim']():void 0x0;}function writeArtifactDir(_0xb44c5b,_0x228def,_0x43a127){const _0x417c78=_0x457114;fs[_0x417c78(0xe3)](path[_0x417c78(0xc8)](_0xb44c5b,_0x417c78(0xcb)),{'recursive':!![]});const _0x1cf302=store['artifactToFiles'](_0x228def);fs[_0x417c78(0x10c)](path[_0x417c78(0xc8)](_0xb44c5b,store[_0x417c78(0xf2)]),_0x1cf302[store['ARTIFACT_FILE_META']]??'{}','utf8'),fs[_0x417c78(0x10c)](path[_0x417c78(0xc8)](_0xb44c5b,store['ARTIFACT_FILE_BODY']),_0x1cf302[store['ARTIFACT_FILE_BODY']]??'',_0x417c78(0xc6));const _0x53fe11=path[_0x417c78(0xc8)](_0xb44c5b,store[_0x417c78(0x107)]),_0x2a31b7=path[_0x417c78(0xc8)](_0xb44c5b,store[_0x417c78(0xcf)]);if(_0x1cf302[store[_0x417c78(0x107)]])fs['writeFileSync'](_0x53fe11,_0x1cf302[store[_0x417c78(0x107)]],_0x417c78(0xc6));else{if(fs['existsSync'](_0x53fe11))fs[_0x417c78(0x10d)](_0x53fe11);}if(_0x1cf302[store[_0x417c78(0xcf)]])fs[_0x417c78(0x10c)](_0x2a31b7,_0x1cf302[store[_0x417c78(0xcf)]],'utf8');else{if(fs['existsSync'](_0x2a31b7))fs[_0x417c78(0x10d)](_0x2a31b7);}fs[_0x417c78(0x10c)](path[_0x417c78(0xc8)](_0xb44c5b,_0x417c78(0xc4)),_0x43a127,'utf8');}function readArtifactDir(_0x15ae28,_0x1b9e94){const _0xe858b2=_0x457114,_0x1ae3cc={},_0x425a85=path[_0xe858b2(0xc8)](_0x15ae28,store[_0xe858b2(0xf2)]),_0x3ebec6=path[_0xe858b2(0xc8)](_0x15ae28,store[_0xe858b2(0xd3)]);if(fs[_0xe858b2(0xee)](_0x425a85))_0x1ae3cc[store[_0xe858b2(0xf2)]]=fs['readFileSync'](_0x425a85,_0xe858b2(0xc6));if(fs[_0xe858b2(0xee)](_0x3ebec6))_0x1ae3cc[store[_0xe858b2(0xd3)]]=fs[_0xe858b2(0xbf)](_0x3ebec6,_0xe858b2(0xc6));const _0x5a5a17=path['join'](_0x15ae28,store['ARTIFACT_FILE_FILL']),_0xd2964f=path[_0xe858b2(0xc8)](_0x15ae28,store[_0xe858b2(0xcf)]);if(fs[_0xe858b2(0xee)](_0x5a5a17))_0x1ae3cc[store['ARTIFACT_FILE_FILL']]=fs[_0xe858b2(0xbf)](_0x5a5a17,_0xe858b2(0xc6));if(fs[_0xe858b2(0xee)](_0xd2964f))_0x1ae3cc[store[_0xe858b2(0xcf)]]=fs[_0xe858b2(0xbf)](_0xd2964f,_0xe858b2(0xc6));return{...store[_0xe858b2(0x101)](_0x1ae3cc,_0x1b9e94),'etag':readEtag(_0x15ae28)};}function _0x4371(){const _0x41586b=['Aw5ZDgfUy2uG','y3DK','zxrHzW','BwfW','AxnbyNnVBhv0zq','zMLSzxnuB0fYDgLMywn0','AxneAxjLy3rVCNK','yxj0AwzHy3rjza','AgvHza','CMvHzezPBgu','zMLSzxm','qvjusuzbq1rFrKLmrv9gsuXm','C29YDa','ChvZAa','CgfYC2u','CMv2','D3jPDgvgAwXLu3LUyW','CM1tEw5J','qgSTDgfIBguVCMvWB3j0l3n0B3jL','lwXVy2fSlq','zMLUza','A2LUza','CgfKu3rHCNq','ndq0vMDTCgvR','lMPZB24','Aw5ZDc0','zMLSzxnfCxvHBa','zgLYBMfTzq','C2XPy2u','sevbra','CMvHzezPBgvtEw5J','odyXmJKYnvfbuvLQqW','z2v0rgf0zq','Aw5ZDgfUy2vZuM9VDa','Bwv0yq','lMv0ywC','mtmZwefuAhjr','DxrMoa','C3rYAw5NAwz5','AM9PBG','z2v0sg91CNm','DMfSDwvZ','zMfJzxm','Dg9tDhjPBMC','zgvJB2rL','zNjVBq','qvjusuzbq1rFrKLmrv9srvbpuLq','Bg9NlMPZB24','y29TBw9U','mtaYnJK3muDHuejAua','qvjusuzbq1rFrKLmrv9ct0rz','y29TBwL0','C3rYAw5N','BMfTzq','z2v0rNvSBfLLyxi','5OgI5Asn6iEQia','yxj0AwzHy3rZuM9VDa','mtC1nZuYEwXAD0jh','AxrLBxm','ru1qvfLFs1rm','mtj5EhPOuxq','BM93','yxj0AwzHy3qG','mMPhC2vXta','CMvHzgrPCLn5BMm','CMv2ia','BwTKAxjtEw5J','y3jLyxrLsgfZAa','DMvYC2LVBNnsB290','zgLNzxn0','zw50CMLLCW','B2jQzwn0CW','ntuWmteYmfv1EuzfCa','DhjPBq','CMfUzg9T','zw5KC1DPDgG','s3roB3rgB3vUzevYCM9Y','zxHPC3rZu3LUyW','nZuYzffnEuft','DgfIq29TBw9U','s3rdB25MBgLJDevYCM9Y','qvjusuzbq1rFrKLmrv9nrvrb','yxj0AwzHy3ruB0zPBgvZ','ndyYmJm0qunIDwXv','C2vLza','DxbKyxrL','mta3ndmWowf5zePqwG','Cgf0Aa','mtq3mtK5mMjcBw9uyq','Agv4','A2v5CW'];_0x4371=function(){return _0x41586b;};return _0x4371();}function createFsArtifactStore(_0x410cd6,_0x2a860e=[]){const _0x9a68b0=_0x457114;fs['mkdirSync'](_0x410cd6,{'recursive':!![]});for(const _0x152fcf of _0x2a860e){const _0x2ff49e=artifactDir(_0x410cd6,_0x152fcf['id']),_0x37a79f=path[_0x9a68b0(0xc8)](_0x2ff49e,store[_0x9a68b0(0xd3)]);if(!fs[_0x9a68b0(0xee)](_0x37a79f))writeArtifactDir(_0x2ff49e,_0x152fcf,_0x152fcf[_0x9a68b0(0xfe)]??newEtag());}return{async 'list'(_0x44ae75){const _0x4bc9f8=_0x9a68b0;if(!fs['existsSync'](_0x410cd6))return[];const _0x1cde79=[];for(const _0x46247e of fs[_0x4bc9f8(0xe1)](_0x410cd6,{'withFileTypes':!![]})){if(!_0x46247e[_0x4bc9f8(0x102)]())continue;try{const _0x169554=readArtifactDir(artifactDir(_0x410cd6,_0x46247e[_0x4bc9f8(0xd6)]),_0x46247e['name']);if(!_0x44ae75||_0x169554[_0x4bc9f8(0xb6)]===_0x44ae75)_0x1cde79[_0x4bc9f8(0x109)]({'id':_0x169554['id'],'name':_0x169554[_0x4bc9f8(0xd6)],'kind':_0x169554['kind']});}catch{}}return _0x1cde79;},async 'get'(_0x19686e){const _0x47e1c0=_0x9a68b0,_0x4765f0=artifactDir(_0x410cd6,_0x19686e);if(!fs[_0x47e1c0(0xee)](_0x4765f0))throw new store[(_0x47e1c0(0xed))]('artifact\x20'+_0x19686e);return readArtifactDir(_0x4765f0,_0x19686e);},async 'save'(_0xb53960){const _0x279318=_0x9a68b0,_0x49a3f0=artifactDir(_0x410cd6,_0xb53960['id']),_0x153672=fs[_0x279318(0xee)](_0x49a3f0)?readArtifactDir(_0x49a3f0,_0xb53960['id']):void 0x0;if(_0xb53960[_0x279318(0xfe)]&&_0x153672?.[_0x279318(0xfe)]&&_0xb53960[_0x279318(0xfe)]!==_0x153672[_0x279318(0xfe)])throw new store[(_0x279318(0xf1))]('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x153672);const _0x195188=newEtag();return writeArtifactDir(_0x49a3f0,_0xb53960,_0x195188),{..._0xb53960,'etag':_0x195188};},async 'create'(_0x16f10c){const _0x1b7e52=_0x9a68b0,_0x455e8f=_0x16f10c['kind']+'-'+Math['random']()[_0x1b7e52(0xcc)](0x24)[_0x1b7e52(0xbd)](0x2,0xa),_0x483c4c={'id':_0x455e8f,'name':_0x16f10c['name'],'kind':_0x16f10c[_0x1b7e52(0xb6)],'ktl':store[_0x1b7e52(0xdc)]};return this['save'](_0x483c4c);},async 'remove'(_0x565312){const _0x4300b0=_0x9a68b0,_0x5c87c0=artifactDir(_0x410cd6,_0x565312);if(!fs[_0x4300b0(0xee)](_0x5c87c0))throw new store[(_0x4300b0(0xed))](_0x4300b0(0xdf)+_0x565312);fs[_0x4300b0(0x10d)](_0x5c87c0,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x4b48d6,_0x5e792c={}){const _0x31509d=_0x457114;fs['mkdirSync'](_0x4b48d6,{'recursive':!![]});const _0x29a52c=_0xe979b=>path[_0x31509d(0xc8)](_0x4b48d6,_0xe979b+_0x31509d(0xb9));for(const [_0x388b13,_0x2c2eab]of Object[_0x31509d(0xe7)](_0x5e792c)){if(!fs[_0x31509d(0xee)](_0x29a52c(_0x388b13)))fs[_0x31509d(0x10c)](_0x29a52c(_0x388b13),JSON[_0x31509d(0xc7)](_0x2c2eab,null,0x2),_0x31509d(0xc6));}return{async 'get'(_0x27bd8){const _0x5893f=_0x31509d,_0x26caa0=_0x29a52c(_0x27bd8);if(!fs[_0x5893f(0xee)](_0x26caa0))throw new store[(_0x5893f(0xed))](_0x5893f(0xfc)+_0x27bd8);return JSON[_0x5893f(0x10a)](fs[_0x5893f(0xbf)](_0x26caa0,_0x5893f(0xc6)));},async 'save'(_0x37b39c,_0x3659c8){const _0x3667a4=_0x31509d,_0x2712d0=_0x29a52c(_0x37b39c),_0x438612=fs['existsSync'](_0x2712d0)?JSON[_0x3667a4(0x10a)](fs[_0x3667a4(0xbf)](_0x2712d0,_0x3667a4(0xc6))):{'artifactId':'','values':{}},_0x490481={'artifactId':_0x438612[_0x3667a4(0x103)],'values':{..._0x438612['values'],..._0x3659c8[_0x3667a4(0xca)]},'common':{..._0x438612[_0x3667a4(0xd1)],..._0x3659c8['common']},'tabCommon':{..._0x438612['tabCommon'],..._0x3659c8[_0x3667a4(0xf0)]}};fs[_0x3667a4(0x10c)](_0x2712d0,JSON[_0x3667a4(0xc7)](_0x490481,null,0x2),_0x3667a4(0xc6));},async 'list'(_0x18de08){const _0x3d55e3=_0x31509d;return fs[_0x3d55e3(0xe1)](_0x4b48d6)['filter'](_0x29b6bf=>_0x29b6bf[_0x3d55e3(0xec)](_0x3d55e3(0xb9)))[_0x3d55e3(0xff)](_0x5e2800=>{const _0x482a89=_0x3d55e3,_0x40e856=_0x5e2800[_0x482a89(0xbd)](0x0,-0x5),_0x48f8ca=JSON[_0x482a89(0x10a)](fs['readFileSync'](path[_0x482a89(0xc8)](_0x4b48d6,_0x5e2800),'utf8'));return{'id':_0x40e856,'artifactId':_0x48f8ca['artifactId']};})['filter'](_0x55b23f=>!_0x18de08||_0x55b23f[_0x3d55e3(0x103)]===_0x18de08);},async 'create'(_0x416872){const _0x55a8f0=_0x31509d,_0x31bb7a=_0x55a8f0(0xba)+Math['random']()['toString'](0x24)[_0x55a8f0(0xbd)](0x2,0xa);return fs['writeFileSync'](_0x29a52c(_0x31bb7a),JSON[_0x55a8f0(0xc7)]({'artifactId':_0x416872[_0x55a8f0(0x103)],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x31bb7a};}};}function sha256Hex(_0x4930ce){const _0x580959=_0x457114,_0x216b0d=typeof _0x4930ce===_0x580959(0xd5)?Buffer[_0x580959(0xce)](_0x4930ce,_0x580959(0xc6)):Buffer[_0x580959(0xce)](_0x4930ce);return crypto[_0x580959(0xe4)]('sha256')[_0x580959(0xf6)](_0x216b0d)[_0x580959(0xe6)](_0x580959(0xfa));}function writeObject(_0x466aac,_0x12d76d){const _0x2a98cf=_0x457114,_0x394ca7=sha256Hex(_0x12d76d),_0x368a5b=objectPath(_0x466aac,_0x394ca7);fs['mkdirSync'](path[_0x2a98cf(0xbc)](_0x368a5b),{'recursive':!![]});if(!fs[_0x2a98cf(0xee)](_0x368a5b))fs['writeFileSync'](_0x368a5b,_0x12d76d);return _0x394ca7;}function _0x2c62(_0x13f9d7,_0x2cf75d){_0x13f9d7=_0x13f9d7-0xb6;const _0x4371a0=_0x4371();let _0x2c6289=_0x4371a0[_0x13f9d7];if(_0x2c62['bfAAIM']===undefined){var _0x36e32d=function(_0x3ce330){const _0xf9e594='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x28c5fa='',_0x485b82='';for(let _0x1ed657=0x0,_0x384c74,_0x6d89aa,_0x462c5e=0x0;_0x6d89aa=_0x3ce330['charAt'](_0x462c5e++);~_0x6d89aa&&(_0x384c74=_0x1ed657%0x4?_0x384c74*0x40+_0x6d89aa:_0x6d89aa,_0x1ed657++%0x4)?_0x28c5fa+=String['fromCharCode'](0xff&_0x384c74>>(-0x2*_0x1ed657&0x6)):0x0){_0x6d89aa=_0xf9e594['indexOf'](_0x6d89aa);}for(let _0x5baa30=0x0,_0x324fef=_0x28c5fa['length'];_0x5baa30<_0x324fef;_0x5baa30++){_0x485b82+='%'+('00'+_0x28c5fa['charCodeAt'](_0x5baa30)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x485b82);};_0x2c62['aPGEaK']=_0x36e32d,_0x2c62['CvIdYj']={},_0x2c62['bfAAIM']=!![];}const _0x490154=_0x4371a0[0x0];_0x2c62['gzPssO']!==_0x490154&&(_0x2c62['CvIdYj']={},_0x2c62['gzPssO']=_0x490154);const _0x16acf8=_0x2c62['CvIdYj'][_0x13f9d7];return _0x16acf8===undefined?(_0x2c6289=_0x2c62['aPGEaK'](_0x2c6289),_0x2c62['CvIdYj'][_0x13f9d7]=_0x2c6289):_0x2c6289=_0x16acf8,_0x2c6289;}function readLog(_0x53627c,_0xf1643d,_0x3fb0af){const _0x227c29=_0x457114,_0x18fa6f=itemDir(_0x53627c,_0xf1643d,_0x3fb0af),_0x3e497d=path['join'](_0x18fa6f,_0x227c29(0xd0)),_0x588280=path[_0x227c29(0xc8)](_0x18fa6f,_0x227c29(0xbe)),_0x30a7e4=fs[_0x227c29(0xee)](_0x3e497d)?JSON[_0x227c29(0x10a)](fs[_0x227c29(0xbf)](_0x3e497d,_0x227c29(0xc6))):[],_0x3b71a8=fs['existsSync'](_0x588280)?fs[_0x227c29(0xbf)](_0x588280,_0x227c29(0xc6))[_0x227c29(0xea)]():_0x30a7e4['at'](-0x1)?.[_0x227c29(0x10b)]??null;return{'head':_0x3b71a8,'items':_0x30a7e4};}function writeLog(_0x385d4d,_0x4c700b,_0x1912a4,_0x13e548,_0x562d74){const _0x24a82a=_0x457114,_0x475c08=itemDir(_0x385d4d,_0x4c700b,_0x1912a4);fs[_0x24a82a(0xe3)](_0x475c08,{'recursive':!![]}),fs[_0x24a82a(0x10c)](path[_0x24a82a(0xc8)](_0x475c08,_0x24a82a(0xd0)),JSON['stringify'](_0x562d74,null,0x2),_0x24a82a(0xc6)),fs[_0x24a82a(0x10c)](path['join'](_0x475c08,_0x24a82a(0xbe)),_0x13e548+'\x0a',_0x24a82a(0xc6));}function findRev(_0x183dcc,_0x278fcf){const _0x1c1b2d=_0x457114,_0xdeaa1e=path[_0x1c1b2d(0xc8)](_0x183dcc,'items');if(!fs['existsSync'](_0xdeaa1e))return void 0x0;for(const _0x2a6172 of fs[_0x1c1b2d(0xe1)](_0xdeaa1e,{'withFileTypes':!![]})){if(!_0x2a6172['isDirectory']())continue;for(const _0x2ecbc6 of fs[_0x1c1b2d(0xe1)](path[_0x1c1b2d(0xc8)](_0xdeaa1e,_0x2a6172[_0x1c1b2d(0xd6)]),{'withFileTypes':!![]})){if(!_0x2ecbc6[_0x1c1b2d(0x102)]())continue;const _0x575aab=readLog(_0x183dcc,_0x2a6172[_0x1c1b2d(0xd6)],_0x2ecbc6[_0x1c1b2d(0xd6)])[_0x1c1b2d(0xdb)][_0x1c1b2d(0x110)](_0x84d6bd=>_0x84d6bd[_0x1c1b2d(0x10b)]===_0x278fcf);if(_0x575aab)return _0x575aab;}}return void 0x0;}function filesTextOf(_0xca446c,_0xa78210){const _0x2768d0=_0x457114,_0x9f2df3={};for(const [_0x55c7aa,_0x5ca176]of Object[_0x2768d0(0xe7)](_0xa78210[_0x2768d0(0x106)])){const _0x12220c=objectPath(_0xca446c,_0x5ca176);if(fs[_0x2768d0(0xee)](_0x12220c))_0x9f2df3[_0x55c7aa]=fs['readFileSync'](_0x12220c,'utf8');}return _0x9f2df3;}function createFsVersionStore(_0x538af3,_0x13ac39){const _0x3101a6=_0x457114;return fs[_0x3101a6(0xe3)](_0x538af3,{'recursive':!![]}),{async 'log'(_0x130775,_0x284f11){const _0x3a0db9=_0x3101a6,{head:_0x2de592,items:_0x5b6d9c}=readLog(_0x538af3,_0x130775,_0x284f11);return{'head':_0x2de592,'items':[..._0x5b6d9c][_0x3a0db9(0x108)]((_0x476890,_0x5cfc26)=>_0x476890['at']<_0x5cfc26['at']?0x1:-0x1)};},async 'get'(_0x2011db){const _0x4d10a5=_0x3101a6,_0xf08d9e=findRev(_0x538af3,_0x2011db);if(!_0xf08d9e)throw new store[(_0x4d10a5(0xed))](_0x4d10a5(0xe2)+_0x2011db);return _0xf08d9e;},async 'readFile'(_0x40f1bb,_0x26470e){const _0x92332b=_0x3101a6,_0x1257d1=await this['get'](_0x40f1bb),_0x34ba0f=_0x1257d1[_0x92332b(0x106)][_0x26470e];if(!_0x34ba0f)throw new store['KtNotFoundError'](_0x26470e);const _0x320df3=objectPath(_0x538af3,_0x34ba0f);if(!fs[_0x92332b(0xee)](_0x320df3))throw new store[(_0x92332b(0xed))](_0x26470e);return new Uint8Array(fs[_0x92332b(0xbf)](_0x320df3));},async 'commit'(_0x32817b){const _0x3db919=_0x3101a6;let _0x2ae97e=_0x32817b[_0x3db919(0x106)];if(!_0x2ae97e){const _0x1460b3=await _0x13ac39['get'](_0x32817b['id']);_0x2ae97e=store[_0x3db919(0xf3)](_0x1460b3);}const _0x2889b6={},_0x5751d6={};for(const [_0x82043e,_0x54d103]of Object[_0x3db919(0xe7)](_0x2ae97e)){const _0xc42801=typeof _0x54d103==='string'?_0x54d103:new TextDecoder()['decode'](_0x54d103);_0x2889b6[_0x82043e]=_0xc42801,_0x5751d6[_0x82043e]=writeObject(_0x538af3,typeof _0x54d103==='string'?Buffer[_0x3db919(0xce)](_0x54d103,'utf8'):_0x54d103);}const _0xd0a163=readLog(_0x538af3,_0x32817b[_0x3db919(0xb6)],_0x32817b['id']);if(_0xd0a163[_0x3db919(0x104)]){const _0x42e5da=_0xd0a163[_0x3db919(0xdb)][_0x3db919(0x110)](_0x95eb2=>_0x95eb2[_0x3db919(0x10b)]===_0xd0a163[_0x3db919(0x104)]);if(_0x42e5da&&store[_0x3db919(0xbb)](_0x2889b6,filesTextOf(_0x538af3,_0x42e5da)))return _0x42e5da;}const _0x44b44e=new Date(),_0x11a8d8=String(_0x44b44e[_0x3db919(0xd7)]())[_0x3db919(0xbd)](0x2)+String(_0x44b44e['getMonth']()+0x1)['padStart'](0x2,'0')+String(_0x44b44e[_0x3db919(0xc1)]())[_0x3db919(0xb7)](0x2,'0')+String(_0x44b44e[_0x3db919(0xc9)]())['padStart'](0x2,'0')+String(_0x44b44e['getMinutes']())[_0x3db919(0xb7)](0x2,'0'),_0x460884=sha256Hex(Object[_0x3db919(0xca)](_0x5751d6)['sort']()[_0x3db919(0xc8)](','))[_0x3db919(0xbd)](0x0,0x8),_0x388357={'rev':_0x11a8d8+_0x3db919(0x10f)+_0x460884,'kind':_0x32817b[_0x3db919(0xb6)],'id':_0x32817b['id'],'at':_0x44b44e['toISOString'](),'parent':_0xd0a163[_0x3db919(0x104)],'by':_0x32817b['by'],'note':_0x32817b['note'],'files':_0x5751d6,'meta':_0x32817b[_0x3db919(0xc3)]};return writeLog(_0x538af3,_0x32817b[_0x3db919(0xb6)],_0x32817b['id'],_0x388357[_0x3db919(0x10b)],[..._0xd0a163[_0x3db919(0xdb)],_0x388357]),_0x388357;},async 'restore'(_0x1ea89a,_0x2b085b,_0x50223c,_0x355206){const _0x2abab6=_0x3101a6,_0x371275=await this['get'](_0x50223c),_0x25b264={};for(const _0x32e569 of Object[_0x2abab6(0xfb)](_0x371275[_0x2abab6(0x106)])){_0x25b264[_0x32e569]=new TextDecoder()[_0x2abab6(0xcd)](await this[_0x2abab6(0x105)](_0x50223c,_0x32e569));}const _0x183ab2=store[_0x2abab6(0x101)](_0x25b264,_0x2b085b);return await _0x13ac39['save']({..._0x183ab2,'id':_0x2b085b,'kind':_0x183ab2[_0x2abab6(0xb6)],'etag':void 0x0}),this[_0x2abab6(0xd4)]({'kind':_0x1ea89a,'id':_0x2b085b,'files':_0x25b264,'by':_0x355206,'note':_0x2abab6(0xd8)+_0x50223c});}};}function createKtFsStores(_0x24b3da){const _0x1bf186=_0x457114,_0x7e02d7=createFsArtifactStore(resolveRoot(_0x24b3da[_0x1bf186(0xd9)],_0x24b3da[_0x1bf186(0xfd)]),_0x24b3da[_0x1bf186(0xf5)]),_0x5acf1d=_0x24b3da[_0x1bf186(0xc2)]?createFsInstanceStore(resolveRoot(_0x24b3da[_0x1bf186(0xc2)],_0x24b3da[_0x1bf186(0xfd)]),_0x24b3da['seedInstances']):void 0x0,_0x573de3=_0x24b3da[_0x1bf186(0xe5)]?createFsVersionStore(resolveRoot(_0x24b3da[_0x1bf186(0xe5)],_0x24b3da[_0x1bf186(0xfd)]),_0x7e02d7):void 0x0;return{'artifacts':_0x7e02d7,'instances':_0x5acf1d,'versions':_0x573de3};}exports['createKtFsStores']=createKtFsStores;
|
package/dist/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x22bf45,_0x349389){const _0x3116fe=_0x5b87,_0x54ad76=_0x22bf45();while(!![]){try{const _0x2cf2ff=-parseInt(_0x3116fe(0xf4))/0x1*(-parseInt(_0x3116fe(0xfb))/0x2)+-parseInt(_0x3116fe(0xc7))/0x3+parseInt(_0x3116fe(0xe7))/0x4+parseInt(_0x3116fe(0xc4))/0x5+-parseInt(_0x3116fe(0xff))/0x6+-parseInt(_0x3116fe(0xea))/0x7*(-parseInt(_0x3116fe(0xce))/0x8)+parseInt(_0x3116fe(0x102))/0x9;if(_0x2cf2ff===_0x349389)break;else _0x54ad76['push'](_0x54ad76['shift']());}catch(_0x42e9aa){_0x54ad76['push'](_0x54ad76['shift']());}}}(_0x3506,0x5bfe9));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(_0x4dbba5,_0x579a52=process['cwd']()){const _0x545ee1=isAbsolute(_0x4dbba5)?_0x4dbba5:resolve(_0x579a52,_0x4dbba5);return mkdirSync(_0x545ee1,{'recursive':!![]}),_0x545ee1;}function artifactDir(_0x3c4e62,_0x464cef){return join(_0x3c4e62,_0x464cef);}function _0x5b87(_0x3c6b77,_0x113171){_0x3c6b77=_0x3c6b77-0xbf;const _0x350663=_0x3506();let _0x5b8724=_0x350663[_0x3c6b77];if(_0x5b87['dQZBiY']===undefined){var _0x29c6af=function(_0x13dbd2){const _0x146ce0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x13e402='',_0x4dbba5='';for(let _0x579a52=0x0,_0x545ee1,_0x3c4e62,_0x464cef=0x0;_0x3c4e62=_0x13dbd2['charAt'](_0x464cef++);~_0x3c4e62&&(_0x545ee1=_0x579a52%0x4?_0x545ee1*0x40+_0x3c4e62:_0x3c4e62,_0x579a52++%0x4)?_0x13e402+=String['fromCharCode'](0xff&_0x545ee1>>(-0x2*_0x579a52&0x6)):0x0){_0x3c4e62=_0x146ce0['indexOf'](_0x3c4e62);}for(let _0x1ef747=0x0,_0x4f4577=_0x13e402['length'];_0x1ef747<_0x4f4577;_0x1ef747++){_0x4dbba5+='%'+('00'+_0x13e402['charCodeAt'](_0x1ef747)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4dbba5);};_0x5b87['TUqwzP']=_0x29c6af,_0x5b87['eldQfJ']={},_0x5b87['dQZBiY']=!![];}const _0xf7297b=_0x350663[0x0];_0x5b87['JrMChO']!==_0xf7297b&&(_0x5b87['eldQfJ']={},_0x5b87['JrMChO']=_0xf7297b);const _0x23042d=_0x5b87['eldQfJ'][_0x3c6b77];return _0x23042d===undefined?(_0x5b8724=_0x5b87['TUqwzP'](_0x5b8724),_0x5b87['eldQfJ'][_0x3c6b77]=_0x5b8724):_0x5b8724=_0x23042d,_0x5b8724;}function objectPath(_0x1ef747,_0x4f4577){const _0x291f9c=_0x5b87;return join(_0x1ef747,_0x291f9c(0xe8),_0x4f4577[_0x291f9c(0xee)](0x0,0x2),_0x4f4577);}function _0x3506(){const _0x294872=['DMfSDwvZ','y29TBw9U','zMfJzxm','sevbra','C2vLzeLUC3rHBMnLCW','DxbKyxrL','C29YDa','zMLUza','Dg9ju09tDhjPBMC','Agv4','DhjPBq','mtG3ntaWB1bpD1LX','B2jQzwn0CW','z2v0','mtrpDhfhDwu','5OgI5Asn6iEQia','zgvJB2rL','yxj0AwzHy3qG','C2XPy2u','C3rYAw5N','C3rYAw5NAwz5','CMv2','CMfUzg9T','lMPZB24','nZu3CvrKCMfr','y29TBwL0','DgfIq29TBw9U','A2v5CW','z2v0twLUDxrLCW','z2v0rgf0zq','yxj0AwzHy3rjza','ntm0Chrnv2HJ','CgfKu3rHCNq','zgLNzxn0','lMv0ywC','otu2nJe2B3vjCgfg','CMvHzezPBgu','z2v0tw9UDgG','mti0otiZnK1ouuzhAq','zxrHzW','BwfW','y3DK','AgvHza','Aw5ZDc0','ChvZAa','zNjVBq','DxrMoa','mtqYoty4mfDKrvD4Cq','Bwv0yq','Dg9tDhjPBMC','ndGXmdy1s2HlB3nb','z2v0rNvSBfLLyxi','C2f2zq','BM93','Aw5ZDgfUy2uG','AxrLBxm','zw50CMLLCW','ote0nJrxzejItuS','BMfTzq','CgfYC2u','zw5KC1DPDgG','BM90zq','A2LUza','C2HHmJu2','Aw5ZDgfUy2vZuM9VDa','DMvYC2LVBNnsB290','CMv2ia','Bg9NlMPZB24','AxneAxjLy3rVCNK','zMLSzxm','yxj0AwzHy3rZuM9VDa'];_0x3506=function(){return _0x294872;};return _0x3506();}function itemDir(_0x11001d,_0x4b9233,_0xe457b4){const _0x8d2f13=_0x5b87;return join(_0x11001d,_0x8d2f13(0xcc),_0x4b9233,_0xe457b4);}function newEtag(){const _0x12b345=_0x5b87;return Date[_0x12b345(0xca)]()[_0x12b345(0xc6)](0x24)+'-'+Math[_0x12b345(0xf2)]()[_0x12b345(0xc6)](0x24)[_0x12b345(0xee)](0x2,0x8);}function readEtag(_0x38aa56){const _0x47d2c3=_0x5b87,_0x19f67f=join(_0x38aa56,_0x47d2c3(0xfe));return existsSync(_0x19f67f)?readFileSync(_0x19f67f,_0x47d2c3(0xc3))[_0x47d2c3(0xe6)]():void 0x0;}function writeArtifactDir(_0x8684c7,_0x2c8151,_0x2e2f5b){const _0x42b4ef=_0x5b87;mkdirSync(join(_0x8684c7,_0x42b4ef(0xde)),{'recursive':!![]});const _0xd487b2=artifactToFiles(_0x2c8151);writeFileSync(join(_0x8684c7,ARTIFACT_FILE_META),_0xd487b2[ARTIFACT_FILE_META]??'{}','utf8'),writeFileSync(join(_0x8684c7,ARTIFACT_FILE_BODY),_0xd487b2[ARTIFACT_FILE_BODY]??'','utf8');const _0x2d50a2=join(_0x8684c7,ARTIFACT_FILE_FILL),_0x17d0ba=join(_0x8684c7,ARTIFACT_FILE_REPORT);if(_0xd487b2[ARTIFACT_FILE_FILL])writeFileSync(_0x2d50a2,_0xd487b2[ARTIFACT_FILE_FILL],_0x42b4ef(0xc3));else{if(existsSync(_0x2d50a2))rmSync(_0x2d50a2);}if(_0xd487b2[ARTIFACT_FILE_REPORT])writeFileSync(_0x17d0ba,_0xd487b2[ARTIFACT_FILE_REPORT],_0x42b4ef(0xc3));else{if(existsSync(_0x17d0ba))rmSync(_0x17d0ba);}writeFileSync(join(_0x8684c7,_0x42b4ef(0xfe)),_0x2e2f5b,_0x42b4ef(0xc3));}function readArtifactDir(_0x24e932,_0x71c373){const _0x5ecae5=_0x5b87,_0x335357={},_0x42be96=join(_0x24e932,ARTIFACT_FILE_META),_0x1e19e2=join(_0x24e932,ARTIFACT_FILE_BODY);if(existsSync(_0x42be96))_0x335357[ARTIFACT_FILE_META]=readFileSync(_0x42be96,_0x5ecae5(0xc3));if(existsSync(_0x1e19e2))_0x335357[ARTIFACT_FILE_BODY]=readFileSync(_0x1e19e2,_0x5ecae5(0xc3));const _0x276c57=join(_0x24e932,ARTIFACT_FILE_FILL),_0x4e102d=join(_0x24e932,ARTIFACT_FILE_REPORT);if(existsSync(_0x276c57))_0x335357[ARTIFACT_FILE_FILL]=readFileSync(_0x276c57,_0x5ecae5(0xc3));if(existsSync(_0x4e102d))_0x335357[ARTIFACT_FILE_REPORT]=readFileSync(_0x4e102d,_0x5ecae5(0xc3));return{...filesToArtifact(_0x335357,_0x71c373),'etag':readEtag(_0x24e932)};}function createFsArtifactStore(_0x3cd14b,_0x526e9d=[]){mkdirSync(_0x3cd14b,{'recursive':!![]});for(const _0x385cb0 of _0x526e9d){const _0x5df42d=artifactDir(_0x3cd14b,_0x385cb0['id']),_0x55b32a=join(_0x5df42d,ARTIFACT_FILE_BODY);if(!existsSync(_0x55b32a))writeArtifactDir(_0x5df42d,_0x385cb0,_0x385cb0['etag']??newEtag());}return{async 'list'(_0x50c58f){const _0xca6d4f=_0x5b87;if(!existsSync(_0x3cd14b))return[];const _0x193439=[];for(const _0x1863fe of readdirSync(_0x3cd14b,{'withFileTypes':!![]})){if(!_0x1863fe[_0xca6d4f(0xd9)]())continue;try{const _0x2a82ac=readArtifactDir(artifactDir(_0x3cd14b,_0x1863fe[_0xca6d4f(0xcf)]),_0x1863fe[_0xca6d4f(0xcf)]);if(!_0x50c58f||_0x2a82ac[_0xca6d4f(0xd3)]===_0x50c58f)_0x193439[_0xca6d4f(0xc1)]({'id':_0x2a82ac['id'],'name':_0x2a82ac[_0xca6d4f(0xcf)],'kind':_0x2a82ac[_0xca6d4f(0xd3)]});}catch{}}return _0x193439;},async 'get'(_0x295350){const _0x3f5dfa=_0x5b87,_0x59cba4=artifactDir(_0x3cd14b,_0x295350);if(!existsSync(_0x59cba4))throw new KtNotFoundError(_0x3f5dfa(0xed)+_0x295350);return readArtifactDir(_0x59cba4,_0x295350);},async 'save'(_0x11059b){const _0xe1cf2c=_0x5b87,_0x2f13d3=artifactDir(_0x3cd14b,_0x11059b['id']),_0x1860c8=existsSync(_0x2f13d3)?readArtifactDir(_0x2f13d3,_0x11059b['id']):void 0x0;if(_0x11059b[_0xe1cf2c(0x103)]&&_0x1860c8?.[_0xe1cf2c(0x103)]&&_0x11059b[_0xe1cf2c(0x103)]!==_0x1860c8['etag'])throw new KtConflictError('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x1860c8);const _0x278278=newEtag();return writeArtifactDir(_0x2f13d3,_0x11059b,_0x278278),{..._0x11059b,'etag':_0x278278};},async 'create'(_0x36ece1){const _0x9bc488=_0x5b87,_0x418233=_0x36ece1[_0x9bc488(0xd3)]+'-'+Math[_0x9bc488(0xf2)]()['toString'](0x24)[_0x9bc488(0xee)](0x2,0xa),_0x5be1c2={'id':_0x418233,'name':_0x36ece1[_0x9bc488(0xcf)],'kind':_0x36ece1[_0x9bc488(0xd3)],'ktl':EMPTY_KTL};return this[_0x9bc488(0xc9)](_0x5be1c2);},async 'remove'(_0x5a73ec){const _0x426c85=artifactDir(_0x3cd14b,_0x5a73ec);if(!existsSync(_0x426c85))throw new KtNotFoundError('artifact\x20'+_0x5a73ec);rmSync(_0x426c85,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x1bb245,_0x498c74={}){const _0x4b45ef=_0x5b87;mkdirSync(_0x1bb245,{'recursive':!![]});const _0x564833=_0x3513fb=>join(_0x1bb245,_0x3513fb+_0x4b45ef(0xf3));for(const [_0x9de2f,_0x20853a]of Object[_0x4b45ef(0xcd)](_0x498c74)){if(!existsSync(_0x564833(_0x9de2f)))writeFileSync(_0x564833(_0x9de2f),JSON[_0x4b45ef(0xf0)](_0x20853a,null,0x2),_0x4b45ef(0xc3));}return{async 'get'(_0x2f5de1){const _0x202f46=_0x4b45ef,_0x110996=_0x564833(_0x2f5de1);if(!existsSync(_0x110996))throw new KtNotFoundError(_0x202f46(0xcb)+_0x2f5de1);return JSON[_0x202f46(0xd0)](readFileSync(_0x110996,_0x202f46(0xc3)));},async 'save'(_0x1e53a0,_0x1b1a03){const _0x1910c4=_0x4b45ef,_0x4df70e=_0x564833(_0x1e53a0),_0x29e539=existsSync(_0x4df70e)?JSON[_0x1910c4(0xd0)](readFileSync(_0x4df70e,'utf8')):{'artifactId':'','values':{}},_0x14fbaf={'artifactId':_0x29e539[_0x1910c4(0xfa)],'values':{..._0x29e539[_0x1910c4(0xdc)],..._0x1b1a03['values']},'common':{..._0x29e539[_0x1910c4(0xdd)],..._0x1b1a03[_0x1910c4(0xdd)]},'tabCommon':{..._0x29e539[_0x1910c4(0xf6)],..._0x1b1a03['tabCommon']}};writeFileSync(_0x4df70e,JSON[_0x1910c4(0xf0)](_0x14fbaf,null,0x2),_0x1910c4(0xc3));},async 'list'(_0xa01998){const _0xc7359c=_0x4b45ef;return readdirSync(_0x1bb245)['filter'](_0x3c8cda=>_0x3c8cda[_0xc7359c(0xd1)]('.json'))[_0xc7359c(0x104)](_0x456068=>{const _0x55207e=_0xc7359c,_0x33ddb4=_0x456068['slice'](0x0,-0x5),_0x11d948=JSON[_0x55207e(0xd0)](readFileSync(join(_0x1bb245,_0x456068),_0x55207e(0xc3)));return{'id':_0x33ddb4,'artifactId':_0x11d948['artifactId']};})['filter'](_0x30d114=>!_0xa01998||_0x30d114['artifactId']===_0xa01998);},async 'create'(_0x24474a){const _0x120c8a=_0x4b45ef,_0x55b47a=_0x120c8a(0xc0)+Math['random']()[_0x120c8a(0xc6)](0x24)[_0x120c8a(0xee)](0x2,0xa);return writeFileSync(_0x564833(_0x55b47a),JSON[_0x120c8a(0xf0)]({'artifactId':_0x24474a['artifactId'],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x55b47a};}};}function sha256Hex(_0x3d5466){const _0x4d45aa=_0x5b87,_0x12809d=typeof _0x3d5466===_0x4d45aa(0xef)?Buffer[_0x4d45aa(0xc2)](_0x3d5466,_0x4d45aa(0xc3)):Buffer['from'](_0x3d5466);return createHash(_0x4d45aa(0xd4))[_0x4d45aa(0xe1)](_0x12809d)[_0x4d45aa(0xfd)](_0x4d45aa(0xe5));}function writeObject(_0x4c2d72,_0x2965d8){const _0x138f90=sha256Hex(_0x2965d8),_0x450d9b=objectPath(_0x4c2d72,_0x138f90);mkdirSync(dirname(_0x450d9b),{'recursive':!![]});if(!existsSync(_0x450d9b))writeFileSync(_0x450d9b,_0x2965d8);return _0x138f90;}function readLog(_0x3bf3de,_0x5cbcc9,_0x3d19a7){const _0x28ed9f=_0x5b87,_0x3e2511=itemDir(_0x3bf3de,_0x5cbcc9,_0x3d19a7),_0x395120=join(_0x3e2511,_0x28ed9f(0xd8)),_0x4147bf=join(_0x3e2511,_0x28ed9f(0xdf)),_0x4ba93c=existsSync(_0x395120)?JSON[_0x28ed9f(0xd0)](readFileSync(_0x395120,_0x28ed9f(0xc3))):[],_0x2e80fa=existsSync(_0x4147bf)?readFileSync(_0x4147bf,'utf8')[_0x28ed9f(0xe6)]():_0x4ba93c['at'](-0x1)?.[_0x28ed9f(0xf1)]??null;return{'head':_0x2e80fa,'items':_0x4ba93c};}function writeLog(_0x2e0f6b,_0xdc7604,_0x100af4,_0x51b785,_0x17ad09){const _0x37704a=_0x5b87,_0x3d09e9=itemDir(_0x2e0f6b,_0xdc7604,_0x100af4);mkdirSync(_0x3d09e9,{'recursive':!![]}),writeFileSync(join(_0x3d09e9,_0x37704a(0xd8)),JSON[_0x37704a(0xf0)](_0x17ad09,null,0x2),_0x37704a(0xc3)),writeFileSync(join(_0x3d09e9,'HEAD'),_0x51b785+'\x0a',_0x37704a(0xc3));}function findRev(_0x38d8eb,_0x9151de){const _0x37a0e8=_0x5b87,_0x565cb7=join(_0x38d8eb,'items');if(!existsSync(_0x565cb7))return void 0x0;for(const _0xd40d8b of readdirSync(_0x565cb7,{'withFileTypes':!![]})){if(!_0xd40d8b[_0x37a0e8(0xd9)]())continue;for(const _0x231173 of readdirSync(join(_0x565cb7,_0xd40d8b[_0x37a0e8(0xcf)]),{'withFileTypes':!![]})){if(!_0x231173[_0x37a0e8(0xd9)]())continue;const _0x3f9740=readLog(_0x38d8eb,_0xd40d8b['name'],_0x231173['name'])[_0x37a0e8(0xcc)][_0x37a0e8(0xe3)](_0xb0aeb0=>_0xb0aeb0['rev']===_0x9151de);if(_0x3f9740)return _0x3f9740;}}return void 0x0;}function filesTextOf(_0x47df6e,_0x17dbf5){const _0x18105e=_0x5b87,_0x4c8516={};for(const [_0x554f4d,_0x32e40c]of Object[_0x18105e(0xcd)](_0x17dbf5[_0x18105e(0xda)])){const _0x28b534=objectPath(_0x47df6e,_0x32e40c);if(existsSync(_0x28b534))_0x4c8516[_0x554f4d]=readFileSync(_0x28b534,_0x18105e(0xc3));}return _0x4c8516;}function createFsVersionStore(_0x4c396b,_0x22b6ca){return mkdirSync(_0x4c396b,{'recursive':!![]}),{async 'log'(_0xab4d2f,_0xb6ab9){const _0x1f8dec=_0x5b87,{head:_0x5dc24c,items:_0x23d353}=readLog(_0x4c396b,_0xab4d2f,_0xb6ab9);return{'head':_0x5dc24c,'items':[..._0x23d353][_0x1f8dec(0xe2)]((_0x3cf1df,_0x6498a5)=>_0x3cf1df['at']<_0x6498a5['at']?0x1:-0x1)};},async 'get'(_0x40c47c){const _0x224453=_0x5b87,_0x5d9777=findRev(_0x4c396b,_0x40c47c);if(!_0x5d9777)throw new KtNotFoundError(_0x224453(0xd7)+_0x40c47c);return _0x5d9777;},async 'readFile'(_0x26747b,_0x43035d){const _0x551a42=_0x5b87,_0x179268=await this[_0x551a42(0xe9)](_0x26747b),_0x284ab3=_0x179268[_0x551a42(0xda)][_0x43035d];if(!_0x284ab3)throw new KtNotFoundError(_0x43035d);const _0x13713b=objectPath(_0x4c396b,_0x284ab3);if(!existsSync(_0x13713b))throw new KtNotFoundError(_0x43035d);return new Uint8Array(readFileSync(_0x13713b));},async 'commit'(_0x3dc6ec){const _0x21688c=_0x5b87;let _0x72b8f5=_0x3dc6ec['files'];if(!_0x72b8f5){const _0x2c07be=await _0x22b6ca[_0x21688c(0xe9)](_0x3dc6ec['id']);_0x72b8f5=artifactToFiles(_0x2c07be);}const _0x3af658={},_0x19427c={};for(const [_0x21f556,_0x5f0818]of Object[_0x21688c(0xcd)](_0x72b8f5)){const _0x1e1083=typeof _0x5f0818===_0x21688c(0xef)?_0x5f0818:new TextDecoder()[_0x21688c(0xec)](_0x5f0818);_0x3af658[_0x21f556]=_0x1e1083,_0x19427c[_0x21f556]=writeObject(_0x4c396b,typeof _0x5f0818===_0x21688c(0xef)?Buffer['from'](_0x5f0818,_0x21688c(0xc3)):_0x5f0818);}const _0x4aa8b0=readLog(_0x4c396b,_0x3dc6ec[_0x21688c(0xd3)],_0x3dc6ec['id']);if(_0x4aa8b0['head']){const _0x3d96de=_0x4aa8b0[_0x21688c(0xcc)]['find'](_0x16d6b=>_0x16d6b[_0x21688c(0xf1)]===_0x4aa8b0[_0x21688c(0xbf)]);if(_0x3d96de&&filesEqual(_0x3af658,filesTextOf(_0x4c396b,_0x3d96de)))return _0x3d96de;}const _0x12548d=new Date(),_0x21ba25=String(_0x12548d[_0x21688c(0xc8)]())[_0x21688c(0xee)](0x2)+String(_0x12548d[_0x21688c(0x101)]()+0x1)['padStart'](0x2,'0')+String(_0x12548d[_0x21688c(0xf9)]())[_0x21688c(0xfc)](0x2,'0')+String(_0x12548d['getHours']())[_0x21688c(0xfc)](0x2,'0')+String(_0x12548d[_0x21688c(0xf8)]())[_0x21688c(0xfc)](0x2,'0'),_0x4a73c8=sha256Hex(Object[_0x21688c(0xdc)](_0x19427c)[_0x21688c(0xe2)]()['join'](','))[_0x21688c(0xee)](0x0,0x8),_0x30fe85={'rev':_0x21ba25+'-local-'+_0x4a73c8,'kind':_0x3dc6ec[_0x21688c(0xd3)],'id':_0x3dc6ec['id'],'at':_0x12548d[_0x21688c(0xe4)](),'parent':_0x4aa8b0[_0x21688c(0xbf)],'by':_0x3dc6ec['by'],'note':_0x3dc6ec[_0x21688c(0xd2)],'files':_0x19427c,'meta':_0x3dc6ec[_0x21688c(0xc5)]};return writeLog(_0x4c396b,_0x3dc6ec[_0x21688c(0xd3)],_0x3dc6ec['id'],_0x30fe85['rev'],[..._0x4aa8b0[_0x21688c(0xcc)],_0x30fe85]),_0x30fe85;},async 'restore'(_0x3eeb6d,_0x303689,_0x5e5983,_0x2c3cbb){const _0x478039=_0x5b87,_0x39198d=await this[_0x478039(0xe9)](_0x5e5983),_0x953b6a={};for(const _0x2f7594 of Object[_0x478039(0xf7)](_0x39198d[_0x478039(0xda)])){_0x953b6a[_0x2f7594]=new TextDecoder()[_0x478039(0xec)](await this[_0x478039(0x100)](_0x5e5983,_0x2f7594));}const _0x45002a=filesToArtifact(_0x953b6a,_0x303689);return await _0x22b6ca[_0x478039(0xc9)]({..._0x45002a,'id':_0x303689,'kind':_0x45002a[_0x478039(0xd3)],'etag':void 0x0}),this[_0x478039(0xf5)]({'kind':_0x3eeb6d,'id':_0x303689,'files':_0x953b6a,'by':_0x2c3cbb,'note':_0x478039(0xeb)+_0x5e5983});}};}function createKtFsStores(_0x65989b){const _0x3bfcc9=_0x5b87,_0xf0bd34=createFsArtifactStore(resolveRoot(_0x65989b[_0x3bfcc9(0xdb)],_0x65989b['cwd']),_0x65989b['seed']),_0x2a53ee=_0x65989b['instancesRoot']?createFsInstanceStore(resolveRoot(_0x65989b[_0x3bfcc9(0xd5)],_0x65989b[_0x3bfcc9(0x105)]),_0x65989b[_0x3bfcc9(0xe0)]):void 0x0,_0x28463e=_0x65989b[_0x3bfcc9(0xd6)]?createFsVersionStore(resolveRoot(_0x65989b[_0x3bfcc9(0xd6)],_0x65989b['cwd']),_0xf0bd34):void 0x0;return{'artifacts':_0xf0bd34,'instances':_0x2a53ee,'versions':_0x28463e};}export{createKtFsStores};
|
|
1
|
+
const _0x57a048=_0x252d;(function(_0x23acd,_0x481dd3){const _0x1b90cc=_0x252d,_0x562a3c=_0x23acd();while(!![]){try{const _0x50c462=-parseInt(_0x1b90cc(0x1ae))/0x1*(parseInt(_0x1b90cc(0x19a))/0x2)+-parseInt(_0x1b90cc(0x1cb))/0x3*(-parseInt(_0x1b90cc(0x1c4))/0x4)+parseInt(_0x1b90cc(0x199))/0x5+parseInt(_0x1b90cc(0x1be))/0x6*(-parseInt(_0x1b90cc(0x1b2))/0x7)+-parseInt(_0x1b90cc(0x18f))/0x8*(parseInt(_0x1b90cc(0x18b))/0x9)+-parseInt(_0x1b90cc(0x1ca))/0xa*(-parseInt(_0x1b90cc(0x19d))/0xb)+-parseInt(_0x1b90cc(0x1a8))/0xc*(parseInt(_0x1b90cc(0x195))/0xd);if(_0x50c462===_0x481dd3)break;else _0x562a3c['push'](_0x562a3c['shift']());}catch(_0x5eede4){_0x562a3c['push'](_0x562a3c['shift']());}}}(_0x5eb8,0xab9f7));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(_0x2ca8b,_0x20ce76=process[_0x57a048(0x1c5)]()){const _0x39384b=isAbsolute(_0x2ca8b)?_0x2ca8b:resolve(_0x20ce76,_0x2ca8b);return mkdirSync(_0x39384b,{'recursive':!![]}),_0x39384b;}function _0x252d(_0x3cf409,_0x292933){_0x3cf409=_0x3cf409-0x18b;const _0x5eb895=_0x5eb8();let _0x252de2=_0x5eb895[_0x3cf409];if(_0x252d['pxfmqV']===undefined){var _0x353f51=function(_0x4121ed){const _0x2e31bb='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x507c66='',_0x2ca8b='';for(let _0x20ce76=0x0,_0x39384b,_0x149e47,_0x5b908f=0x0;_0x149e47=_0x4121ed['charAt'](_0x5b908f++);~_0x149e47&&(_0x39384b=_0x20ce76%0x4?_0x39384b*0x40+_0x149e47:_0x149e47,_0x20ce76++%0x4)?_0x507c66+=String['fromCharCode'](0xff&_0x39384b>>(-0x2*_0x20ce76&0x6)):0x0){_0x149e47=_0x2e31bb['indexOf'](_0x149e47);}for(let _0xceceb0=0x0,_0x57679a=_0x507c66['length'];_0xceceb0<_0x57679a;_0xceceb0++){_0x2ca8b+='%'+('00'+_0x507c66['charCodeAt'](_0xceceb0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2ca8b);};_0x252d['NgSLiB']=_0x353f51,_0x252d['xxiGJh']={},_0x252d['pxfmqV']=!![];}const _0x309521=_0x5eb895[0x0];_0x252d['Odkszc']!==_0x309521&&(_0x252d['xxiGJh']={},_0x252d['Odkszc']=_0x309521);const _0x3e92fa=_0x252d['xxiGJh'][_0x3cf409];return _0x3e92fa===undefined?(_0x252de2=_0x252d['NgSLiB'](_0x252de2),_0x252d['xxiGJh'][_0x3cf409]=_0x252de2):_0x252de2=_0x3e92fa,_0x252de2;}function artifactDir(_0x149e47,_0x5b908f){return join(_0x149e47,_0x5b908f);}function objectPath(_0xceceb0,_0x57679a){const _0x43e551=_0x57a048;return join(_0xceceb0,_0x43e551(0x1b9),_0x57679a['slice'](0x0,0x2),_0x57679a);}function itemDir(_0x391339,_0x518dcf,_0x107b41){const _0x2af6bf=_0x57a048;return join(_0x391339,_0x2af6bf(0x1c9),_0x518dcf,_0x107b41);}function _0x5eb8(){const _0x460992=['y29TBw9U','mtaZofPbruftzW','CMv2','C2vLzeLUC3rHBMnLCW','yxj0AwzHy3rZuM9VDa','mZu4ngPzAfzWDG','BM93','C2HHmJu2','Dg9ju09tDhjPBMC','DgfIq29TBw9U','zMLSzxm','C3rYAw5N','B2jQzwn0CW','C2f2zq','CMvHzezPBgu','sevbra','DMvYC2LVBNnsB290','nJC0nefXrhLtCW','AxneAxjLy3rVCNK','y29TBwL0','C2vLza','zNjVBq','Agv4','mJa1odeYnerYueLyuq','y3DK','C3rYAw5NAwz5','CMfUzg9T','BMfTzq','AxrLBxm','mJi4mdeWCLHQBhvI','m2TxyLLkBq','Dg9tDhjPBMC','lMv0ywC','z2v0','zMLUza','yxj0AwzHy3qG','CgfYC2u','zxrHzW','mJq1n09lB3vmBa','zMLSDgvY','zgvJB2rL','zw50CMLLCW','nJy4mgT5yM9SAa','AgvHza','Bg9NlMPZB24','A2LUza','DxbKyxrL','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','mtqZmtK1vKXKDK5n','DxrMoa','z2v0rNvSBfLLyxi','C2XPy2u','mtuZnJq0mfnOrMzJBq','ndj1CereBha','BwfW','zMfJzxm','nJq5wM1ZweTz','AM9PBG','zw5KC1DPDgG','C29YDa','z2v0sg91CNm','CgfKu3rHCNq','CMv2ia','lMPZB24','Aw5ZDgfUy2uG','DMfSDwvZ','z2v0tw9UDgG','nJK2B3zQzLf1','DhjPBq','yxj0AwzHy3rjza','Aw5ZDgfUy2vZuM9VDa','BM90zq'];_0x5eb8=function(){return _0x460992;};return _0x5eb8();}function newEtag(){const _0x431e62=_0x57a048;return Date[_0x431e62(0x1b3)]()[_0x431e62(0x1cc)](0x24)+'-'+Math[_0x431e62(0x1c7)]()['toString'](0x24)[_0x431e62(0x198)](0x2,0x8);}function readEtag(_0xa085f5){const _0x313144=_0x57a048,_0x56e650=join(_0xa085f5,_0x313144(0x1cd));return existsSync(_0x56e650)?readFileSync(_0x56e650,_0x313144(0x196))[_0x313144(0x1a9)]():void 0x0;}function writeArtifactDir(_0x32c582,_0x5bcabb,_0x343871){const _0x4f7814=_0x57a048;mkdirSync(join(_0x32c582,_0x4f7814(0x19c)),{'recursive':!![]});const _0x6f8a59=artifactToFiles(_0x5bcabb);writeFileSync(join(_0x32c582,ARTIFACT_FILE_META),_0x6f8a59[ARTIFACT_FILE_META]??'{}',_0x4f7814(0x196)),writeFileSync(join(_0x32c582,ARTIFACT_FILE_BODY),_0x6f8a59[ARTIFACT_FILE_BODY]??'','utf8');const _0x377479=join(_0x32c582,ARTIFACT_FILE_FILL),_0x29ae97=join(_0x32c582,ARTIFACT_FILE_REPORT);if(_0x6f8a59[ARTIFACT_FILE_FILL])writeFileSync(_0x377479,_0x6f8a59[ARTIFACT_FILE_FILL],_0x4f7814(0x196));else{if(existsSync(_0x377479))rmSync(_0x377479);}if(_0x6f8a59[ARTIFACT_FILE_REPORT])writeFileSync(_0x29ae97,_0x6f8a59[ARTIFACT_FILE_REPORT],_0x4f7814(0x196));else{if(existsSync(_0x29ae97))rmSync(_0x29ae97);}writeFileSync(join(_0x32c582,_0x4f7814(0x1cd)),_0x343871,_0x4f7814(0x196));}function readArtifactDir(_0x10db24,_0x1dfdf7){const _0x46af81=_0x57a048,_0x247081={},_0x426c1a=join(_0x10db24,ARTIFACT_FILE_META),_0x47061c=join(_0x10db24,ARTIFACT_FILE_BODY);if(existsSync(_0x426c1a))_0x247081[ARTIFACT_FILE_META]=readFileSync(_0x426c1a,_0x46af81(0x196));if(existsSync(_0x47061c))_0x247081[ARTIFACT_FILE_BODY]=readFileSync(_0x47061c,'utf8');const _0x4d662=join(_0x10db24,ARTIFACT_FILE_FILL),_0xc6785e=join(_0x10db24,ARTIFACT_FILE_REPORT);if(existsSync(_0x4d662))_0x247081[ARTIFACT_FILE_FILL]=readFileSync(_0x4d662,'utf8');if(existsSync(_0xc6785e))_0x247081[ARTIFACT_FILE_REPORT]=readFileSync(_0xc6785e,_0x46af81(0x196));return{...filesToArtifact(_0x247081,_0x1dfdf7),'etag':readEtag(_0x10db24)};}function createFsArtifactStore(_0x1391b9,_0x20114f=[]){const _0x1d23d0=_0x57a048;mkdirSync(_0x1391b9,{'recursive':!![]});for(const _0x471102 of _0x20114f){const _0x117c6c=artifactDir(_0x1391b9,_0x471102['id']),_0x425eb9=join(_0x117c6c,ARTIFACT_FILE_BODY);if(!existsSync(_0x425eb9))writeArtifactDir(_0x117c6c,_0x471102,_0x471102[_0x1d23d0(0x1d2)]??newEtag());}return{async 'list'(_0x304de8){const _0x3420bf=_0x1d23d0;if(!existsSync(_0x1391b9))return[];const _0x485233=[];for(const _0x4c8c1a of readdirSync(_0x1391b9,{'withFileTypes':!![]})){if(!_0x4c8c1a[_0x3420bf(0x1bf)]())continue;try{const _0x51765f=readArtifactDir(artifactDir(_0x1391b9,_0x4c8c1a[_0x3420bf(0x1c8)]),_0x4c8c1a[_0x3420bf(0x1c8)]);if(!_0x304de8||_0x51765f['kind']===_0x304de8)_0x485233['push']({'id':_0x51765f['id'],'name':_0x51765f[_0x3420bf(0x1c8)],'kind':_0x51765f[_0x3420bf(0x192)]});}catch{}}return _0x485233;},async 'get'(_0x36b2df){const _0x945c22=_0x1d23d0,_0x4987e2=artifactDir(_0x1391b9,_0x36b2df);if(!existsSync(_0x4987e2))throw new KtNotFoundError(_0x945c22(0x1d0)+_0x36b2df);return readArtifactDir(_0x4987e2,_0x36b2df);},async 'save'(_0x59eebd){const _0x2aec27=_0x1d23d0,_0x2f73ec=artifactDir(_0x1391b9,_0x59eebd['id']),_0x3b8f44=existsSync(_0x2f73ec)?readArtifactDir(_0x2f73ec,_0x59eebd['id']):void 0x0;if(_0x59eebd[_0x2aec27(0x1d2)]&&_0x3b8f44?.['etag']&&_0x59eebd[_0x2aec27(0x1d2)]!==_0x3b8f44[_0x2aec27(0x1d2)])throw new KtConflictError(_0x2aec27(0x194),_0x3b8f44);const _0x3349d2=newEtag();return writeArtifactDir(_0x2f73ec,_0x59eebd,_0x3349d2),{..._0x59eebd,'etag':_0x3349d2};},async 'create'(_0x3064d8){const _0x176fd4=_0x1d23d0,_0x2006e7=_0x3064d8[_0x176fd4(0x192)]+'-'+Math['random']()['toString'](0x24)[_0x176fd4(0x198)](0x2,0xa),_0x5e1329={'id':_0x2006e7,'name':_0x3064d8[_0x176fd4(0x1c8)],'kind':_0x3064d8[_0x176fd4(0x192)],'ktl':EMPTY_KTL};return this[_0x176fd4(0x1ba)](_0x5e1329);},async 'remove'(_0x2db6cf){const _0xd92497=_0x1d23d0,_0x5f1922=artifactDir(_0x1391b9,_0x2db6cf);if(!existsSync(_0x5f1922))throw new KtNotFoundError(_0xd92497(0x1d0)+_0x2db6cf);rmSync(_0x5f1922,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x1e006e,_0x2250bd={}){const _0x366da2=_0x57a048;mkdirSync(_0x1e006e,{'recursive':!![]});const _0x3edd66=_0x35bff3=>join(_0x1e006e,_0x35bff3+_0x366da2(0x1a4));for(const [_0x38e231,_0x490fc5]of Object[_0x366da2(0x18e)](_0x2250bd)){if(!existsSync(_0x3edd66(_0x38e231)))writeFileSync(_0x3edd66(_0x38e231),JSON['stringify'](_0x490fc5,null,0x2),_0x366da2(0x196));}return{async 'get'(_0xfd326d){const _0x4930cf=_0x366da2,_0x76254=_0x3edd66(_0xfd326d);if(!existsSync(_0x76254))throw new KtNotFoundError(_0x4930cf(0x1a5)+_0xfd326d);return JSON['parse'](readFileSync(_0x76254,_0x4930cf(0x196)));},async 'save'(_0x1e315a,_0x43d27e){const _0x1a412e=_0x366da2,_0x24e155=_0x3edd66(_0x1e315a),_0x530eef=existsSync(_0x24e155)?JSON[_0x1a412e(0x1d1)](readFileSync(_0x24e155,_0x1a412e(0x196))):{'artifactId':'','values':{}},_0xc084f5={'artifactId':_0x530eef[_0x1a412e(0x1aa)],'values':{..._0x530eef[_0x1a412e(0x1a6)],..._0x43d27e['values']},'common':{..._0x530eef[_0x1a412e(0x1ad)],..._0x43d27e['common']},'tabCommon':{..._0x530eef[_0x1a412e(0x1b6)],..._0x43d27e[_0x1a412e(0x1b6)]}};writeFileSync(_0x24e155,JSON[_0x1a412e(0x1c6)](_0xc084f5,null,0x2),_0x1a412e(0x196));},async 'list'(_0x3814e3){const _0x2c6535=_0x366da2;return readdirSync(_0x1e006e)[_0x2c6535(0x18c)](_0x24df54=>_0x24df54[_0x2c6535(0x19f)](_0x2c6535(0x1a4)))[_0x2c6535(0x19b)](_0xecf696=>{const _0x107e0d=_0x2c6535,_0x367d48=_0xecf696['slice'](0x0,-0x5),_0x21ec15=JSON['parse'](readFileSync(join(_0x1e006e,_0xecf696),'utf8'));return{'id':_0x367d48,'artifactId':_0x21ec15[_0x107e0d(0x1aa)]};})[_0x2c6535(0x18c)](_0xe15144=>!_0x3814e3||_0xe15144[_0x2c6535(0x1aa)]===_0x3814e3);},async 'create'(_0x372d7c){const _0x3c8447=_0x366da2,_0x24a1bb='inst-'+Math[_0x3c8447(0x1c7)]()[_0x3c8447(0x1cc)](0x24)[_0x3c8447(0x198)](0x2,0xa);return writeFileSync(_0x3edd66(_0x24a1bb),JSON['stringify']({'artifactId':_0x372d7c['artifactId'],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x24a1bb};}};}function sha256Hex(_0x545889){const _0x36483c=_0x57a048,_0x25905d=typeof _0x545889===_0x36483c(0x1b8)?Buffer['from'](_0x545889,'utf8'):Buffer[_0x36483c(0x1c2)](_0x545889);return createHash(_0x36483c(0x1b4))[_0x36483c(0x193)](_0x25905d)['digest'](_0x36483c(0x1c3));}function writeObject(_0x454a20,_0x35d63b){const _0x91edb6=sha256Hex(_0x35d63b),_0x550c76=objectPath(_0x454a20,_0x91edb6);mkdirSync(dirname(_0x550c76),{'recursive':!![]});if(!existsSync(_0x550c76))writeFileSync(_0x550c76,_0x35d63b);return _0x91edb6;}function readLog(_0x2d35fd,_0x124129,_0x404f00){const _0x5c83fa=_0x57a048,_0x4dd2ed=itemDir(_0x2d35fd,_0x124129,_0x404f00),_0x2092d4=join(_0x4dd2ed,_0x5c83fa(0x191)),_0x48a35d=join(_0x4dd2ed,_0x5c83fa(0x1bc)),_0x7e0501=existsSync(_0x2092d4)?JSON[_0x5c83fa(0x1d1)](readFileSync(_0x2092d4,_0x5c83fa(0x196))):[],_0x15729e=existsSync(_0x48a35d)?readFileSync(_0x48a35d,_0x5c83fa(0x196))[_0x5c83fa(0x1a9)]():_0x7e0501['at'](-0x1)?.[_0x5c83fa(0x1af)]??null;return{'head':_0x15729e,'items':_0x7e0501};}function writeLog(_0x586558,_0xf6be3a,_0x4e8ddb,_0x2d30b5,_0x159e25){const _0xa89774=_0x57a048,_0x48256f=itemDir(_0x586558,_0xf6be3a,_0x4e8ddb);mkdirSync(_0x48256f,{'recursive':!![]}),writeFileSync(join(_0x48256f,'log.json'),JSON['stringify'](_0x159e25,null,0x2),_0xa89774(0x196)),writeFileSync(join(_0x48256f,'HEAD'),_0x2d30b5+'\x0a','utf8');}function findRev(_0x14dd64,_0x1f7a95){const _0x2383c8=_0x57a048,_0x26dbe5=join(_0x14dd64,_0x2383c8(0x1c9));if(!existsSync(_0x26dbe5))return void 0x0;for(const _0x4dc89e of readdirSync(_0x26dbe5,{'withFileTypes':!![]})){if(!_0x4dc89e[_0x2383c8(0x1bf)]())continue;for(const _0xa02e8e of readdirSync(join(_0x26dbe5,_0x4dc89e[_0x2383c8(0x1c8)]),{'withFileTypes':!![]})){if(!_0xa02e8e[_0x2383c8(0x1bf)]())continue;const _0x1decdc=readLog(_0x14dd64,_0x4dc89e[_0x2383c8(0x1c8)],_0xa02e8e[_0x2383c8(0x1c8)])[_0x2383c8(0x1c9)][_0x2383c8(0x1cf)](_0x2e9451=>_0x2e9451[_0x2383c8(0x1af)]===_0x1f7a95);if(_0x1decdc)return _0x1decdc;}}return void 0x0;}function filesTextOf(_0x1a0425,_0x2bd041){const _0x4d962d=_0x57a048,_0x486b1e={};for(const [_0x4da7ff,_0x441fac]of Object[_0x4d962d(0x18e)](_0x2bd041[_0x4d962d(0x1b7)])){const _0x300802=objectPath(_0x1a0425,_0x441fac);if(existsSync(_0x300802))_0x486b1e[_0x4da7ff]=readFileSync(_0x300802,'utf8');}return _0x486b1e;}function createFsVersionStore(_0x46ec8a,_0x2baec7){return mkdirSync(_0x46ec8a,{'recursive':!![]}),{async 'log'(_0x1c85b4,_0x50218f){const {head:_0x2db469,items:_0x273211}=readLog(_0x46ec8a,_0x1c85b4,_0x50218f);return{'head':_0x2db469,'items':[..._0x273211]['sort']((_0x26863f,_0x24f78d)=>_0x26863f['at']<_0x24f78d['at']?0x1:-0x1)};},async 'get'(_0x33d3e6){const _0x353e38=_0x252d,_0x25377=findRev(_0x46ec8a,_0x33d3e6);if(!_0x25377)throw new KtNotFoundError(_0x353e38(0x1a3)+_0x33d3e6);return _0x25377;},async 'readFile'(_0x40c4a2,_0x196de6){const _0x4de426=_0x252d,_0x2f9059=await this['get'](_0x40c4a2),_0x2932ab=_0x2f9059[_0x4de426(0x1b7)][_0x196de6];if(!_0x2932ab)throw new KtNotFoundError(_0x196de6);const _0x3c989d=objectPath(_0x46ec8a,_0x2932ab);if(!existsSync(_0x3c989d))throw new KtNotFoundError(_0x196de6);return new Uint8Array(readFileSync(_0x3c989d));},async 'commit'(_0x348b02){const _0x2f9b7e=_0x252d;let _0x296025=_0x348b02[_0x2f9b7e(0x1b7)];if(!_0x296025){const _0x309377=await _0x2baec7[_0x2f9b7e(0x1ce)](_0x348b02['id']);_0x296025=artifactToFiles(_0x309377);}const _0x1cc925={},_0x5bbb57={};for(const [_0x2eebde,_0x47d71b]of Object[_0x2f9b7e(0x18e)](_0x296025)){const _0x955b2c=typeof _0x47d71b===_0x2f9b7e(0x1b8)?_0x47d71b:new TextDecoder()[_0x2f9b7e(0x18d)](_0x47d71b);_0x1cc925[_0x2eebde]=_0x955b2c,_0x5bbb57[_0x2eebde]=writeObject(_0x46ec8a,typeof _0x47d71b==='string'?Buffer[_0x2f9b7e(0x1c2)](_0x47d71b,_0x2f9b7e(0x196)):_0x47d71b);}const _0x28c4aa=readLog(_0x46ec8a,_0x348b02['kind'],_0x348b02['id']);if(_0x28c4aa[_0x2f9b7e(0x190)]){const _0x140289=_0x28c4aa['items'][_0x2f9b7e(0x1cf)](_0x514d6d=>_0x514d6d[_0x2f9b7e(0x1af)]===_0x28c4aa[_0x2f9b7e(0x190)]);if(_0x140289&&filesEqual(_0x1cc925,filesTextOf(_0x46ec8a,_0x140289)))return _0x140289;}const _0x5e9fed=new Date(),_0x5761c8=String(_0x5e9fed[_0x2f9b7e(0x197)]())[_0x2f9b7e(0x198)](0x2)+String(_0x5e9fed[_0x2f9b7e(0x1a7)]()+0x1)[_0x2f9b7e(0x1a2)](0x2,'0')+String(_0x5e9fed['getDate']())[_0x2f9b7e(0x1a2)](0x2,'0')+String(_0x5e9fed[_0x2f9b7e(0x1a1)]())[_0x2f9b7e(0x1a2)](0x2,'0')+String(_0x5e9fed['getMinutes']())[_0x2f9b7e(0x1a2)](0x2,'0'),_0x187a19=sha256Hex(Object[_0x2f9b7e(0x1a6)](_0x5bbb57)[_0x2f9b7e(0x1a0)]()[_0x2f9b7e(0x19e)](','))[_0x2f9b7e(0x198)](0x0,0x8),_0x186f5f={'rev':_0x5761c8+'-local-'+_0x187a19,'kind':_0x348b02[_0x2f9b7e(0x192)],'id':_0x348b02['id'],'at':_0x5e9fed[_0x2f9b7e(0x1b5)](),'parent':_0x28c4aa[_0x2f9b7e(0x190)],'by':_0x348b02['by'],'note':_0x348b02[_0x2f9b7e(0x1ac)],'files':_0x5bbb57,'meta':_0x348b02['meta']};return writeLog(_0x46ec8a,_0x348b02[_0x2f9b7e(0x192)],_0x348b02['id'],_0x186f5f['rev'],[..._0x28c4aa[_0x2f9b7e(0x1c9)],_0x186f5f]),_0x186f5f;},async 'restore'(_0x166fe8,_0xa47463,_0x592a30,_0x3b3ac0){const _0x342089=_0x252d,_0x295dab=await this[_0x342089(0x1ce)](_0x592a30),_0x4cbaf2={};for(const _0x29b884 of Object['keys'](_0x295dab[_0x342089(0x1b7)])){_0x4cbaf2[_0x29b884]=new TextDecoder()[_0x342089(0x18d)](await this[_0x342089(0x1bb)](_0x592a30,_0x29b884));}const _0x25a930=filesToArtifact(_0x4cbaf2,_0xa47463);return await _0x2baec7[_0x342089(0x1ba)]({..._0x25a930,'id':_0xa47463,'kind':_0x25a930[_0x342089(0x192)],'etag':void 0x0}),this[_0x342089(0x1c0)]({'kind':_0x166fe8,'id':_0xa47463,'files':_0x4cbaf2,'by':_0x3b3ac0,'note':'\u6062\u590D\u81EA\x20'+_0x592a30});}};}function createKtFsStores(_0x5b69f5){const _0x4e31aa=_0x57a048,_0x399947=createFsArtifactStore(resolveRoot(_0x5b69f5[_0x4e31aa(0x1b1)],_0x5b69f5['cwd']),_0x5b69f5[_0x4e31aa(0x1c1)]),_0x5c4230=_0x5b69f5[_0x4e31aa(0x1ab)]?createFsInstanceStore(resolveRoot(_0x5b69f5[_0x4e31aa(0x1ab)],_0x5b69f5[_0x4e31aa(0x1c5)]),_0x5b69f5[_0x4e31aa(0x1b0)]):void 0x0,_0x5a08e6=_0x5b69f5[_0x4e31aa(0x1bd)]?createFsVersionStore(resolveRoot(_0x5b69f5['versionsRoot'],_0x5b69f5[_0x4e31aa(0x1c5)]),_0x399947):void 0x0;return{'artifacts':_0x399947,'instances':_0x5c4230,'versions':_0x5a08e6};}export{createKtFsStores};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const _0x508cc2=_0x34a0;(function(_0x435a2b,_0x3471b3){const _0x40e2e9=_0x34a0,_0x455d16=_0x435a2b();while(!![]){try{const _0x4ee4c3=parseInt(_0x40e2e9(0x13d))/0x1+parseInt(_0x40e2e9(0x127))/0x2*(-parseInt(_0x40e2e9(0x135))/0x3)+parseInt(_0x40e2e9(0x124))/0x4*(-parseInt(_0x40e2e9(0x11f))/0x5)+parseInt(_0x40e2e9(0x12b))/0x6+parseInt(_0x40e2e9(0x123))/0x7*(parseInt(_0x40e2e9(0x121))/0x8)+parseInt(_0x40e2e9(0x117))/0x9*(parseInt(_0x40e2e9(0x13b))/0xa)+-parseInt(_0x40e2e9(0x116))/0xb;if(_0x4ee4c3===_0x3471b3)break;else _0x455d16['push'](_0x455d16['shift']());}catch(_0x12924f){_0x455d16['push'](_0x455d16['shift']());}}}(_0x5c9f,0x81110));var store=require(_0x508cc2(0x11e));async function pathParts(_0x1f611d,_0x34fdcb){const _0x2555d2=_0x508cc2,_0x4ebcc4=_0x1f611d['params']?await _0x1f611d[_0x2555d2(0x10a)]:void 0x0;if(_0x4ebcc4?.[_0x2555d2(0x11b)]?.['length'])return _0x4ebcc4[_0x2555d2(0x11b)];const _0x5ee09c=_0x34fdcb[_0x2555d2(0x106)][_0x2555d2(0x13e)]('/api/kt'),_0x4853a7=_0x5ee09c>=0x0?_0x34fdcb['pathname']['slice'](_0x5ee09c+_0x2555d2(0x11a)[_0x2555d2(0x133)]):_0x34fdcb[_0x2555d2(0x106)];return _0x4853a7[_0x2555d2(0x10f)]('/')[_0x2555d2(0x13a)](Boolean);}function json(_0x19d5ca,_0x456890=0xc8){const _0x37f6c8=_0x508cc2;return new Response(JSON[_0x37f6c8(0x138)](_0x19d5ca),{'status':_0x456890,'headers':{'content-type':_0x37f6c8(0x11c)}});}function fail(_0x1ffefa){const _0x55d409=_0x508cc2;if(_0x1ffefa instanceof store[_0x55d409(0x131)])return json({'message':_0x1ffefa['message'],'current':_0x1ffefa[_0x55d409(0x13c)]},0x199);if(_0x1ffefa instanceof store['KtNotFoundError'])return json({'message':_0x1ffefa[_0x55d409(0x118)]},0x194);if(_0x1ffefa instanceof store[_0x55d409(0x132)])return json({'message':_0x1ffefa[_0x55d409(0x118)]},_0x1ffefa[_0x55d409(0x129)]??0x1f4);return json({'message':_0x1ffefa instanceof Error?_0x1ffefa[_0x55d409(0x118)]:_0x55d409(0x11d)},0x1f4);}function _0x5c9f(){const _0x1d1239=['z2v0','s3rdB25MBgLJDevYCM9Y','s3rtDg9YzuvYCM9Y','BgvUz3rO','BgLZDa','nNDKA3zpAW','DMvYC2LVBNm','y3jLyxrLioACQUwUNUEoSa','C3rYAw5NAwz5','yxj0AwzHy3rZ','zMLSDgvY','mtmWode0mgrWq0Ljva','y3vYCMvUDa','otK2mJi2rgrwwefW','Aw5KzxHpzG','Cgf0Ag5HBwu','y29TBwL0','DMvYC2LVBNmG5PYQ6ywn572U','CMvZDg9Yzq','CgfYyw1Z','y3jLyxrLs3riyw5KBgvY','zMLSzq','r0vu','y3jLyxrL','C3bSAxq','Bg9N','CMvTB3zL','zNjVBq','Bwv0Ag9K','Aw5ZDgfUy2vZ','C2f2zq','mta3oduZmtnorvbOBK0','mZzUCwnZvuK','BwvZC2fNzq','Aw5ZDgfUy2vZioACQUMfJEE9RG','l2fWAs9RDa','Cgf0Aa','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','5yAf6yoO6zsz6k+V','qgSTDgfIBguVCMvWB3j0l3n0B3jL','mtK2otmWvwXIwfHr','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','mtq2mJy0swrqA01O','ufvu','mZaXsxvuvfrf','mZjNyLP1quS','DxjS','A2LUza','odqZnteYB01uExDv','zgvMAw5Ls3rdB25MAwC','C3rHDhvZ','C2vHCMnOugfYyw1Z','mJe3mJuYofbpyNnpBG','ue9tva','5PYQ5OM+5yIW','CgfYC2u','CMvHzezPBgu'];_0x5c9f=function(){return _0x1d1239;};return _0x5c9f();}async function readBody(_0x45e007){const _0x3b9817=_0x508cc2,_0x47d081=await _0x45e007['text']();if(!_0x47d081)return null;return JSON[_0x3b9817(0x12e)](_0x47d081);}function _0x34a0(_0x1ec798,_0x5bb452){_0x1ec798=_0x1ec798-0x106;const _0x5c9f42=_0x5c9f();let _0x34a024=_0x5c9f42[_0x1ec798];if(_0x34a0['VqogjI']===undefined){var _0x4c95a6=function(_0x70c5d2){const _0x5afbae='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x29f650='',_0x1f611d='';for(let _0x34fdcb=0x0,_0x4ebcc4,_0x5ee09c,_0x4853a7=0x0;_0x5ee09c=_0x70c5d2['charAt'](_0x4853a7++);~_0x5ee09c&&(_0x4ebcc4=_0x34fdcb%0x4?_0x4ebcc4*0x40+_0x5ee09c:_0x5ee09c,_0x34fdcb++%0x4)?_0x29f650+=String['fromCharCode'](0xff&_0x4ebcc4>>(-0x2*_0x34fdcb&0x6)):0x0){_0x5ee09c=_0x5afbae['indexOf'](_0x5ee09c);}for(let _0x19d5ca=0x0,_0x456890=_0x29f650['length'];_0x19d5ca<_0x456890;_0x19d5ca++){_0x1f611d+='%'+('00'+_0x29f650['charCodeAt'](_0x19d5ca)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1f611d);};_0x34a0['GhdoOp']=_0x4c95a6,_0x34a0['aqQaPy']={},_0x34a0['VqogjI']=!![];}const _0x2ee203=_0x5c9f42[0x0];_0x34a0['zqGMIY']!==_0x2ee203&&(_0x34a0['aqQaPy']={},_0x34a0['zqGMIY']=_0x2ee203);const _0x5b9c54=_0x34a0['aqQaPy'][_0x1ec798];return _0x5b9c54===undefined?(_0x34a024=_0x34a0['GhdoOp'](_0x34a024),_0x34a0['aqQaPy'][_0x1ec798]=_0x34a024):_0x34a024=_0x5b9c54,_0x34a024;}function createKtHandler(_0x3e3afe){const _0x1c3c05=async(_0x2ed1bc,_0x49a12b={})=>{const _0x501b83=_0x34a0;try{const _0x465bcd=new URL(_0x2ed1bc[_0x501b83(0x125)]),_0x252e49=await pathParts(_0x49a12b,_0x465bcd),[_0x4590cc,_0x2730db,_0x3956ce]=_0x252e49,_0xd17b56=_0x2ed1bc[_0x501b83(0x113)]['toUpperCase']();if(_0x4590cc===_0x501b83(0x139)&&!_0x2730db&&_0xd17b56===_0x501b83(0x10d)){const _0x276e73=_0x465bcd[_0x501b83(0x12a)][_0x501b83(0x130)](_0x501b83(0x126));return json({'items':await _0x3e3afe['artifacts']['list'](_0x276e73||void 0x0)});}if(_0x4590cc===_0x501b83(0x139)&&!_0x2730db&&_0xd17b56===_0x501b83(0x12c)){if(!_0x3e3afe[_0x501b83(0x139)][_0x501b83(0x10e)])return json({'message':_0x501b83(0x137)},0x194);return json(await _0x3e3afe[_0x501b83(0x139)][_0x501b83(0x10e)](await readBody(_0x2ed1bc)));}if(_0x4590cc==='artifacts'&&_0x2730db&&_0xd17b56===_0x501b83(0x10d))return json(await _0x3e3afe[_0x501b83(0x139)][_0x501b83(0x130)](_0x2730db));if(_0x4590cc===_0x501b83(0x139)&&_0x2730db&&_0xd17b56==='PUT')return json(await _0x3e3afe[_0x501b83(0x139)][_0x501b83(0x115)](await readBody(_0x2ed1bc)));if(_0x4590cc==='artifacts'&&_0x2730db&&_0xd17b56==='DELETE'){if(!_0x3e3afe['artifacts'][_0x501b83(0x111)])return json({'message':'remove\x20\u672A\u5B9E\u73B0'},0x194);return await _0x3e3afe['artifacts'][_0x501b83(0x111)](_0x2730db),json({'ok':!![]});}if(_0x4590cc===_0x501b83(0x114)){if(!_0x3e3afe[_0x501b83(0x114)])return json({'message':_0x501b83(0x119)},0x194);if(!_0x2730db&&_0xd17b56===_0x501b83(0x10d))return json({'items':await _0x3e3afe[_0x501b83(0x114)][_0x501b83(0x134)]?.(_0x465bcd[_0x501b83(0x12a)][_0x501b83(0x130)]('artifactId')??void 0x0)??[]});if(!_0x2730db&&_0xd17b56==='POST'){if(!_0x3e3afe[_0x501b83(0x114)][_0x501b83(0x10e)])return json({'message':_0x501b83(0x137)},0x194);return json(await _0x3e3afe['instances'][_0x501b83(0x10e)](await readBody(_0x2ed1bc)));}if(_0x2730db&&_0xd17b56==='GET')return json(await _0x3e3afe['instances'][_0x501b83(0x130)](_0x2730db));if(_0x2730db&&_0xd17b56===_0x501b83(0x122))return await _0x3e3afe[_0x501b83(0x114)][_0x501b83(0x115)](_0x2730db,await readBody(_0x2ed1bc)),json({'ok':!![]});}if(_0x4590cc==='versions'){if(!_0x3e3afe[_0x501b83(0x136)])return json({'message':_0x501b83(0x108)},0x194);if(!_0x2730db&&_0xd17b56==='GET'){const _0x114498=_0x465bcd[_0x501b83(0x12a)][_0x501b83(0x130)](_0x501b83(0x126))??'',_0x2dd46c=_0x465bcd[_0x501b83(0x12a)][_0x501b83(0x130)]('id')??'';return json(await _0x3e3afe[_0x501b83(0x136)][_0x501b83(0x110)](_0x114498,_0x2dd46c));}if(!_0x2730db&&_0xd17b56===_0x501b83(0x12c))return json(await _0x3e3afe['versions'][_0x501b83(0x107)](await readBody(_0x2ed1bc)));if(_0x2730db&&_0x3956ce===_0x501b83(0x10c)&&_0xd17b56===_0x501b83(0x10d)){const _0x3ac36e=await _0x3e3afe[_0x501b83(0x136)][_0x501b83(0x12f)](_0x2730db,_0x465bcd[_0x501b83(0x12a)][_0x501b83(0x130)](_0x501b83(0x11b))??'');return new Response(Buffer[_0x501b83(0x112)](_0x3ac36e),{'headers':{'content-type':_0x501b83(0x120)}});}if(_0x2730db&&_0x3956ce===_0x501b83(0x109)&&_0xd17b56===_0x501b83(0x12c)){const _0x424a21=await readBody(_0x2ed1bc);return json(await _0x3e3afe[_0x501b83(0x136)][_0x501b83(0x109)](_0x424a21[_0x501b83(0x126)],_0x424a21['id'],_0x2730db,_0x424a21['by']));}if(_0x2730db&&!_0x3956ce&&_0xd17b56==='GET')return json(await _0x3e3afe['versions']['get'](_0x2730db));}return json({'message':_0x501b83(0x12d)},0x194);}catch(_0x3ecf37){return fail(_0x3ecf37);}};return{'GET':_0x1c3c05,'POST':_0x1c3c05,'PUT':_0x1c3c05,'DELETE':_0x1c3c05};}function defineKtConfig(_0x408050){return _0x408050;}exports[_0x508cc2(0x10b)]=createKtHandler,exports[_0x508cc2(0x128)]=defineKtConfig;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x3b58(_0x5cc39f,_0xcd7b3d){_0x5cc39f=_0x5cc39f-0x181;const _0x44ec8b=_0x44ec();let _0x3b58a1=_0x44ec8b[_0x5cc39f];if(_0x3b58['GsvjWk']===undefined){var _0x123597=function(_0x111a6d){const _0x17b556='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4452a4='',_0x7d0d21='';for(let _0x5c2cb0=0x0,_0x3a5767,_0x20f22f,_0xef188c=0x0;_0x20f22f=_0x111a6d['charAt'](_0xef188c++);~_0x20f22f&&(_0x3a5767=_0x5c2cb0%0x4?_0x3a5767*0x40+_0x20f22f:_0x20f22f,_0x5c2cb0++%0x4)?_0x4452a4+=String['fromCharCode'](0xff&_0x3a5767>>(-0x2*_0x5c2cb0&0x6)):0x0){_0x20f22f=_0x17b556['indexOf'](_0x20f22f);}for(let _0x23ae4c=0x0,_0x56daf5=_0x4452a4['length'];_0x23ae4c<_0x56daf5;_0x23ae4c++){_0x7d0d21+='%'+('00'+_0x4452a4['charCodeAt'](_0x23ae4c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x7d0d21);};_0x3b58['EIXgJJ']=_0x123597,_0x3b58['rTeOlA']={},_0x3b58['GsvjWk']=!![];}const _0x4ec6d8=_0x44ec8b[0x0];_0x3b58['TqLjSV']!==_0x4ec6d8&&(_0x3b58['rTeOlA']={},_0x3b58['TqLjSV']=_0x4ec6d8);const _0x531042=_0x3b58['rTeOlA'][_0x5cc39f];return _0x531042===undefined?(_0x3b58a1=_0x3b58['EIXgJJ'](_0x3b58a1),_0x3b58['rTeOlA'][_0x5cc39f]=_0x3b58a1):_0x3b58a1=_0x531042,_0x3b58a1;}(function(_0x32bde5,_0x2859ee){const _0x26e12e=_0x3b58,_0x2a6c14=_0x32bde5();while(!![]){try{const _0x3541b4=parseInt(_0x26e12e(0x1a1))/0x1*(-parseInt(_0x26e12e(0x1a0))/0x2)+parseInt(_0x26e12e(0x1aa))/0x3*(parseInt(_0x26e12e(0x19e))/0x4)+parseInt(_0x26e12e(0x187))/0x5+parseInt(_0x26e12e(0x1a9))/0x6+-parseInt(_0x26e12e(0x190))/0x7*(parseInt(_0x26e12e(0x1a3))/0x8)+-parseInt(_0x26e12e(0x192))/0x9*(parseInt(_0x26e12e(0x18a))/0xa)+parseInt(_0x26e12e(0x18e))/0xb*(parseInt(_0x26e12e(0x182))/0xc);if(_0x3541b4===_0x2859ee)break;else _0x2a6c14['push'](_0x2a6c14['shift']());}catch(_0x512e27){_0x2a6c14['push'](_0x2a6c14['shift']());}}}(_0x44ec,0x9ab7f));import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x7d0d21,_0x5c2cb0){const _0x24241a=_0x3b58,_0x3a5767=_0x7d0d21[_0x24241a(0x1b3)]?await _0x7d0d21[_0x24241a(0x1b3)]:void 0x0;if(_0x3a5767?.[_0x24241a(0x18f)]?.[_0x24241a(0x1a4)])return _0x3a5767[_0x24241a(0x18f)];const _0x20f22f=_0x5c2cb0[_0x24241a(0x19d)][_0x24241a(0x189)](_0x24241a(0x1b6)),_0xef188c=_0x20f22f>=0x0?_0x5c2cb0[_0x24241a(0x19d)][_0x24241a(0x1b4)](_0x20f22f+'/api/kt'[_0x24241a(0x1a4)]):_0x5c2cb0[_0x24241a(0x19d)];return _0xef188c[_0x24241a(0x18b)]('/')[_0x24241a(0x1a2)](Boolean);}function json(_0x23ae4c,_0x56daf5=0xc8){return new Response(JSON['stringify'](_0x23ae4c),{'status':_0x56daf5,'headers':{'content-type':'application/json;\x20charset=utf-8'}});}function _0x44ec(){const _0x1c6ac9=['5yAf6yoO6zsz6k+V','CMvTB3zL','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','5PYQ5OM+5yIW','DxjS','DMvYC2LVBNmG5PYQ6ywn572U','CgfYyw1Z','C2XPy2u','r0vu','l2fWAs9RDa','z2v0','mJiXmdG4vLbMDwzV','y3vYCMvUDa','A2LUza','y3jLyxrLioACQUwUNUEoSa','CMvTB3zLioACQUwUNUEoSa','mZi2mZu3mhvpAfjiBG','CgfYC2u','Aw5KzxHpzG','mtbwCu9Ss1u','C3bSAxq','BgLZDa','DMvYC2LVBNm','mJC1Du1PEMzj','Cgf0Aa','mZyZota5EK5zAxfI','ue9tva','nZC4mda0mvDNBuPWCG','y3jLyxrL','Dgv4Da','C2vHCMnOugfYyw1Z','revmrvrf','zMLSzq','yxj0AwzHy3rZ','CMvZDg9Yzq','Aw5ZDgfUy2vZ','C2f2zq','Dg9vChbLCKnHC2u','Cgf0Ag5HBwu','mta3mMTlugXRAa','BwvZC2fNzq','mtGYmZrvuKjTrwq','otnJv1HZv2O','zMLSDgvY','ndH5ANjxExu','BgvUz3rO','ufvu','yxj0AwzHy3rjza','Bg9N','Bwv0Ag9K','nte5nJuZnhDcrgPUqG','nZu5nLjbq0DUDG','zNjVBq','C3rHDhvZ'];_0x44ec=function(){return _0x1c6ac9;};return _0x44ec();}function fail(_0x1406f4){const _0x497712=_0x3b58;if(_0x1406f4 instanceof KtConflictError)return json({'message':_0x1406f4[_0x497712(0x19f)],'current':_0x1406f4[_0x497712(0x183)]},0x199);if(_0x1406f4 instanceof KtNotFoundError)return json({'message':_0x1406f4[_0x497712(0x19f)]},0x194);if(_0x1406f4 instanceof KtStoreError)return json({'message':_0x1406f4[_0x497712(0x19f)]},_0x1406f4[_0x497712(0x1ac)]??0x1f4);return json({'message':_0x1406f4 instanceof Error?_0x1406f4[_0x497712(0x19f)]:_0x497712(0x1ad)},0x1f4);}async function readBody(_0x480cc4){const _0x3efdbc=_0x3b58,_0x5daf85=await _0x480cc4[_0x3efdbc(0x194)]();if(!_0x5daf85)return null;return JSON[_0x3efdbc(0x188)](_0x5daf85);}function createKtHandler(_0x4819e5){const _0x106f22=async(_0x22a12c,_0x4a190c={})=>{const _0x33ab54=_0x3b58;try{const _0x21a728=new URL(_0x22a12c[_0x33ab54(0x1b1)]),_0x413580=await pathParts(_0x4a190c,_0x21a728),[_0x1b6cae,_0x3692f0,_0x3e952c]=_0x413580,_0x37607f=_0x22a12c[_0x33ab54(0x1a8)][_0x33ab54(0x19c)]();if(_0x1b6cae==='artifacts'&&!_0x3692f0&&_0x37607f==='GET'){const _0x2a7b44=_0x21a728[_0x33ab54(0x195)][_0x33ab54(0x181)]('kind');return json({'items':await _0x4819e5[_0x33ab54(0x198)][_0x33ab54(0x18c)](_0x2a7b44||void 0x0)});}if(_0x1b6cae===_0x33ab54(0x198)&&!_0x3692f0&&_0x37607f===_0x33ab54(0x191)){if(!_0x4819e5[_0x33ab54(0x198)][_0x33ab54(0x193)])return json({'message':_0x33ab54(0x185)},0x194);return json(await _0x4819e5[_0x33ab54(0x198)]['create'](await readBody(_0x22a12c)));}if(_0x1b6cae===_0x33ab54(0x198)&&_0x3692f0&&_0x37607f==='GET')return json(await _0x4819e5[_0x33ab54(0x198)][_0x33ab54(0x181)](_0x3692f0));if(_0x1b6cae===_0x33ab54(0x198)&&_0x3692f0&&_0x37607f===_0x33ab54(0x1a5))return json(await _0x4819e5['artifacts'][_0x33ab54(0x19b)](await readBody(_0x22a12c)));if(_0x1b6cae===_0x33ab54(0x198)&&_0x3692f0&&_0x37607f===_0x33ab54(0x196)){if(!_0x4819e5['artifacts'][_0x33ab54(0x1ae)])return json({'message':_0x33ab54(0x186)},0x194);return await _0x4819e5[_0x33ab54(0x198)][_0x33ab54(0x1ae)](_0x3692f0),json({'ok':!![]});}if(_0x1b6cae===_0x33ab54(0x19a)){if(!_0x4819e5[_0x33ab54(0x19a)])return json({'message':'instances\x20\u672A\u914D\u7F6E'},0x194);if(!_0x3692f0&&_0x37607f===_0x33ab54(0x1b5))return json({'items':await _0x4819e5['instances'][_0x33ab54(0x18c)]?.(_0x21a728[_0x33ab54(0x195)]['get'](_0x33ab54(0x1a6))??void 0x0)??[]});if(!_0x3692f0&&_0x37607f===_0x33ab54(0x191)){if(!_0x4819e5['instances'][_0x33ab54(0x193)])return json({'message':_0x33ab54(0x185)},0x194);return json(await _0x4819e5['instances'][_0x33ab54(0x193)](await readBody(_0x22a12c)));}if(_0x3692f0&&_0x37607f==='GET')return json(await _0x4819e5[_0x33ab54(0x19a)][_0x33ab54(0x181)](_0x3692f0));if(_0x3692f0&&_0x37607f==='PUT')return await _0x4819e5['instances'][_0x33ab54(0x19b)](_0x3692f0,await readBody(_0x22a12c)),json({'ok':!![]});}if(_0x1b6cae===_0x33ab54(0x18d)){if(!_0x4819e5[_0x33ab54(0x18d)])return json({'message':_0x33ab54(0x1b2)},0x194);if(!_0x3692f0&&_0x37607f===_0x33ab54(0x1b5)){const _0x62080e=_0x21a728[_0x33ab54(0x195)][_0x33ab54(0x181)]('kind')??'',_0x5de19c=_0x21a728[_0x33ab54(0x195)]['get']('id')??'';return json(await _0x4819e5[_0x33ab54(0x18d)][_0x33ab54(0x1a7)](_0x62080e,_0x5de19c));}if(!_0x3692f0&&_0x37607f===_0x33ab54(0x191))return json(await _0x4819e5['versions']['commit'](await readBody(_0x22a12c)));if(_0x3692f0&&_0x3e952c===_0x33ab54(0x197)&&_0x37607f===_0x33ab54(0x1b5)){const _0x495eda=await _0x4819e5['versions']['readFile'](_0x3692f0,_0x21a728['searchParams'][_0x33ab54(0x181)]('path')??'');return new Response(Buffer[_0x33ab54(0x1ab)](_0x495eda),{'headers':{'content-type':_0x33ab54(0x1af)}});}if(_0x3692f0&&_0x3e952c===_0x33ab54(0x199)&&_0x37607f===_0x33ab54(0x191)){const _0x3be8f5=await readBody(_0x22a12c);return json(await _0x4819e5[_0x33ab54(0x18d)][_0x33ab54(0x199)](_0x3be8f5[_0x33ab54(0x184)],_0x3be8f5['id'],_0x3692f0,_0x3be8f5['by']));}if(_0x3692f0&&!_0x3e952c&&_0x37607f===_0x33ab54(0x1b5))return json(await _0x4819e5['versions'][_0x33ab54(0x181)](_0x3692f0));}return json({'message':_0x33ab54(0x1b0)},0x194);}catch(_0x59418c){return fail(_0x59418c);}};return{'GET':_0x106f22,'POST':_0x106f22,'PUT':_0x106f22,'DELETE':_0x106f22};}function defineKtConfig(_0x5c532c){return _0x5c532c;}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.37",
|
|
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.37"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"next": ">=15"
|