@k-table/next 1.0.10 → 1.0.11

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 CHANGED
@@ -1 +1 @@
1
- 'use strict';const _0x11aed5=_0x5b74;(function(_0x1f0d65,_0x514f25){const _0x5421ee=_0x5b74,_0x231e8f=_0x1f0d65();while(!![]){try{const _0x5e1923=-parseInt(_0x5421ee(0x1f2))/0x1+-parseInt(_0x5421ee(0x1c3))/0x2+-parseInt(_0x5421ee(0x1db))/0x3*(parseInt(_0x5421ee(0x1fa))/0x4)+parseInt(_0x5421ee(0x1d4))/0x5*(parseInt(_0x5421ee(0x1e3))/0x6)+parseInt(_0x5421ee(0x1ff))/0x7*(-parseInt(_0x5421ee(0x1c2))/0x8)+-parseInt(_0x5421ee(0x1d0))/0x9+parseInt(_0x5421ee(0x1d9))/0xa;if(_0x5e1923===_0x514f25)break;else _0x231e8f['push'](_0x231e8f['shift']());}catch(_0x22f409){_0x231e8f['push'](_0x231e8f['shift']());}}}(_0x4548,0x26483));var fs=require('fs'),path=require('path'),store=require(_0x11aed5(0x1ce)),crypto=require('crypto');function resolveRoot(_0x3968a2,_0xf68b48=process[_0x11aed5(0x1ec)]()){const _0x548f4f=_0x11aed5,_0x3570a8=path[_0x548f4f(0x1e5)](_0x3968a2)?_0x3968a2:path[_0x548f4f(0x207)](_0xf68b48,_0x3968a2);return fs[_0x548f4f(0x1c8)](_0x3570a8,{'recursive':!![]}),_0x3570a8;}function artifactDir(_0x275342,_0x534e1c){const _0x3147fe=_0x11aed5;return path[_0x3147fe(0x1e7)](_0x275342,_0x534e1c);}function objectPath(_0x926a24,_0x1497f2){const _0x294eff=_0x11aed5;return path[_0x294eff(0x1e7)](_0x926a24,_0x294eff(0x1f4),_0x1497f2['slice'](0x0,0x2),_0x1497f2);}function itemDir(_0x408e8a,_0x14cecb,_0x5c1aaa){const _0x321c55=_0x11aed5;return path[_0x321c55(0x1e7)](_0x408e8a,_0x321c55(0x1e9),_0x14cecb,_0x5c1aaa);}function newEtag(){const _0x39afef=_0x11aed5;return Date[_0x39afef(0x1f0)]()[_0x39afef(0x1c9)](0x24)+'-'+Math[_0x39afef(0x20d)]()[_0x39afef(0x1c9)](0x24)[_0x39afef(0x1d5)](0x2,0x8);}function readEtag(_0xfdb421){const _0x237d43=_0x11aed5,_0x15426c=path[_0x237d43(0x1e7)](_0xfdb421,_0x237d43(0x1cb));return fs['existsSync'](_0x15426c)?fs[_0x237d43(0x1dc)](_0x15426c,_0x237d43(0x1b0))[_0x237d43(0x1c5)]():void 0x0;}function writeArtifactDir(_0x548899,_0x540f2d,_0x4448f0){const _0x5f16ab=_0x11aed5;fs['mkdirSync'](path[_0x5f16ab(0x1e7)](_0x548899,_0x5f16ab(0x1ea)),{'recursive':!![]});const _0x22e580=store[_0x5f16ab(0x1df)](_0x540f2d);fs[_0x5f16ab(0x1bd)](path[_0x5f16ab(0x1e7)](_0x548899,store['ARTIFACT_FILE_META']),_0x22e580[store[_0x5f16ab(0x1c4)]]??'{}','utf8'),fs[_0x5f16ab(0x1bd)](path['join'](_0x548899,store[_0x5f16ab(0x203)]),_0x22e580[store['ARTIFACT_FILE_BODY']]??'',_0x5f16ab(0x1b0));const _0x257bc3=path[_0x5f16ab(0x1e7)](_0x548899,store[_0x5f16ab(0x1b2)]),_0x6734f8=path[_0x5f16ab(0x1e7)](_0x548899,store['ARTIFACT_FILE_REPORT']);if(_0x22e580[store['ARTIFACT_FILE_FILL']])fs[_0x5f16ab(0x1bd)](_0x257bc3,_0x22e580[store[_0x5f16ab(0x1b2)]],_0x5f16ab(0x1b0));else{if(fs[_0x5f16ab(0x201)](_0x257bc3))fs[_0x5f16ab(0x1d8)](_0x257bc3);}if(_0x22e580[store[_0x5f16ab(0x1ca)]])fs[_0x5f16ab(0x1bd)](_0x6734f8,_0x22e580[store['ARTIFACT_FILE_REPORT']],'utf8');else{if(fs[_0x5f16ab(0x201)](_0x6734f8))fs['rmSync'](_0x6734f8);}fs[_0x5f16ab(0x1bd)](path['join'](_0x548899,_0x5f16ab(0x1cb)),_0x4448f0,_0x5f16ab(0x1b0));}function _0x5b74(_0x5cefd2,_0x4e2859){_0x5cefd2=_0x5cefd2-0x1af;const _0x4548f6=_0x4548();let _0x5b74c5=_0x4548f6[_0x5cefd2];if(_0x5b74['BANkld']===undefined){var _0x3c27e8=function(_0x25c4a4){const _0x5366d4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x47e4f2='',_0x3968a2='';for(let _0xf68b48=0x0,_0x3570a8,_0x275342,_0x534e1c=0x0;_0x275342=_0x25c4a4['charAt'](_0x534e1c++);~_0x275342&&(_0x3570a8=_0xf68b48%0x4?_0x3570a8*0x40+_0x275342:_0x275342,_0xf68b48++%0x4)?_0x47e4f2+=String['fromCharCode'](0xff&_0x3570a8>>(-0x2*_0xf68b48&0x6)):0x0){_0x275342=_0x5366d4['indexOf'](_0x275342);}for(let _0x926a24=0x0,_0x1497f2=_0x47e4f2['length'];_0x926a24<_0x1497f2;_0x926a24++){_0x3968a2+='%'+('00'+_0x47e4f2['charCodeAt'](_0x926a24)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3968a2);};_0x5b74['pZRLTB']=_0x3c27e8,_0x5b74['rEXOwc']={},_0x5b74['BANkld']=!![];}const _0x4e78af=_0x4548f6[0x0];_0x5b74['RtupSc']!==_0x4e78af&&(_0x5b74['rEXOwc']={},_0x5b74['RtupSc']=_0x4e78af);const _0x41330f=_0x5b74['rEXOwc'][_0x5cefd2];return _0x41330f===undefined?(_0x5b74c5=_0x5b74['pZRLTB'](_0x5b74c5),_0x5b74['rEXOwc'][_0x5cefd2]=_0x5b74c5):_0x5b74c5=_0x41330f,_0x5b74c5;}function _0x4548(){const _0x175e45=['DMfSDwvZ','zw50CMLLCW','nu9bu3jwtq','C2XPy2u','zMLSzxnuB0fYDgLMywn0','CgfYC2u','CM1tEw5J','odu2mdG5mgXkr2LcsW','C2f2zq','nZu3nZe5rLjQEKrh','CMvHzezPBgvtEw5J','z2v0rgf0zq','C2vLza','yxj0AwzHy3ruB0zPBgvZ','z2v0','y29TBwL0','yxj0AwzHy3rjza','nZy3mdq2Cg9PB2vi','zxrHzW','AxnbyNnVBhv0zq','s3roB3rgB3vUzevYCM9Y','AM9PBG','C3rYAw5N','AxrLBxm','zMfJzxm','BMfTzq','y3DK','C2HHmJu2','s3rdB25MBgLJDevYCM9Y','CMvHzezPBgu','BM93','zMLSDgvY','mJGYnda4ueTbtgDL','5OgI5Asn6iEQia','B2jQzwn0CW','z2v0twLUDxrLCW','Dg9ju09tDhjPBMC','Aw5ZDgfUy2uG','yxj0AwzHy3rZuM9VDa','y3jLyxrLsgfZAa','nhDkseHcva','z2v0rNvSBfLLyxi','BM90zq','zw5KC1DPDgG','ChvZAa','nZqYrNrgrMLh','yxj0AwzHy3qG','zxHPC3rZu3LUyW','CMvHzgrPCLn5BMm','qvjusuzbq1rFrKLmrv9ct0rz','sevbra','zgLYBMfTzq','ru1qvfLFs1rm','CMvZB2X2zq','z2v0tw9UDgG','zNjVBq','lMPZB24','Bwv0yq','y29TBw9U','CMfUzg9T','A2v5CW','DxrMoa','CgfKu3rHCNq','qvjusuzbq1rFrKLmrv9gsuXm','AxneAxjLy3rVCNK','zMLUza','AgvHza','z2v0sg91CNm','DgfIq29TBw9U','C3rYAw5NAwz5','Bg9NlMPZB24','DMvYC2LVBNnsB290','zMLSzxm','lwXVy2fSlq','D3jPDgvgAwXLu3LUyW','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','CMv2ia','DxbKyxrL','C29YDa','nZuYEuDcBvvu','mte1otK0v29gEvvX','qvjusuzbq1rFrKLmrv9nrvrb','DhjPBq','BwfW','Aw5ZDgfUy2vZuM9VDa','BwTKAxjtEw5J','Dg9tDhjPBMC','qvjusuzbq1rFrKLmrv9srvbpuLq','lMv0ywC','CMv2','Agv4','qgSTDgfIBguVCMvWB3j0l3n0B3jL','zgLNzxn0','mJaXnZy2nw1Kwxb5vG','A2LUza'];_0x4548=function(){return _0x175e45;};return _0x4548();}function readArtifactDir(_0x601253,_0x304cda){const _0xba2bed=_0x11aed5,_0x5935ee={},_0x2937cc=path['join'](_0x601253,store[_0xba2bed(0x1c4)]),_0xe9c6de=path[_0xba2bed(0x1e7)](_0x601253,store['ARTIFACT_FILE_BODY']);if(fs[_0xba2bed(0x201)](_0x2937cc))_0x5935ee[store['ARTIFACT_FILE_META']]=fs[_0xba2bed(0x1dc)](_0x2937cc,'utf8');if(fs[_0xba2bed(0x201)](_0xe9c6de))_0x5935ee[store['ARTIFACT_FILE_BODY']]=fs[_0xba2bed(0x1dc)](_0xe9c6de,_0xba2bed(0x1b0));const _0xb9a96d=path[_0xba2bed(0x1e7)](_0x601253,store[_0xba2bed(0x1b2)]),_0x3cd856=path[_0xba2bed(0x1e7)](_0x601253,store['ARTIFACT_FILE_REPORT']);if(fs[_0xba2bed(0x201)](_0xb9a96d))_0x5935ee[store[_0xba2bed(0x1b2)]]=fs[_0xba2bed(0x1dc)](_0xb9a96d,_0xba2bed(0x1b0));if(fs[_0xba2bed(0x201)](_0x3cd856))_0x5935ee[store[_0xba2bed(0x1ca)]]=fs[_0xba2bed(0x1dc)](_0x3cd856,_0xba2bed(0x1b0));return{...store[_0xba2bed(0x1d6)](_0x5935ee,_0x304cda),'etag':readEtag(_0x601253)};}function createFsArtifactStore(_0x158c7a,_0x345306=[]){const _0x508761=_0x11aed5;fs['mkdirSync'](_0x158c7a,{'recursive':!![]});for(const _0x30b194 of _0x345306){const _0x2fa08f=artifactDir(_0x158c7a,_0x30b194['id']),_0x399ae8=path[_0x508761(0x1e7)](_0x2fa08f,store[_0x508761(0x203)]);if(!fs[_0x508761(0x201)](_0x399ae8))writeArtifactDir(_0x2fa08f,_0x30b194,_0x30b194[_0x508761(0x1e4)]??newEtag());}return{async 'list'(_0x4991db){const _0x5c5ee6=_0x508761;if(!fs['existsSync'](_0x158c7a))return[];const _0x22e2d8=[];for(const _0x43a1dc of fs['readdirSync'](_0x158c7a,{'withFileTypes':!![]})){if(!_0x43a1dc[_0x5c5ee6(0x1b3)]())continue;try{const _0x40e6df=readArtifactDir(artifactDir(_0x158c7a,_0x43a1dc[_0x5c5ee6(0x1eb)]),_0x43a1dc['name']);if(!_0x4991db||_0x40e6df[_0x5c5ee6(0x1d1)]===_0x4991db)_0x22e2d8[_0x5c5ee6(0x1fe)]({'id':_0x40e6df['id'],'name':_0x40e6df[_0x5c5ee6(0x1eb)],'kind':_0x40e6df[_0x5c5ee6(0x1d1)]});}catch{}}return _0x22e2d8;},async 'get'(_0x5ce4fc){const _0x4d78f6=_0x508761,_0x25eb15=artifactDir(_0x158c7a,_0x5ce4fc);if(!fs[_0x4d78f6(0x201)](_0x25eb15))throw new store[(_0x4d78f6(0x1e6))]('artifact\x20'+_0x5ce4fc);return readArtifactDir(_0x25eb15,_0x5ce4fc);},async 'save'(_0xf66181){const _0x3eb2b8=_0x508761,_0x4cc845=artifactDir(_0x158c7a,_0xf66181['id']),_0x2f9b33=fs[_0x3eb2b8(0x201)](_0x4cc845)?readArtifactDir(_0x4cc845,_0xf66181['id']):void 0x0;if(_0xf66181[_0x3eb2b8(0x1e4)]&&_0x2f9b33?.[_0x3eb2b8(0x1e4)]&&_0xf66181[_0x3eb2b8(0x1e4)]!==_0x2f9b33[_0x3eb2b8(0x1e4)])throw new store[(_0x3eb2b8(0x1ee))](_0x3eb2b8(0x1be),_0x2f9b33);const _0x163958=newEtag();return writeArtifactDir(_0x4cc845,_0xf66181,_0x163958),{..._0xf66181,'etag':_0x163958};},async 'create'(_0x57da43){const _0x513a1f=_0x508761,_0x1aa425=_0x57da43[_0x513a1f(0x1d1)]+'-'+Math[_0x513a1f(0x20d)]()['toString'](0x24)[_0x513a1f(0x1d5)](0x2,0xa),_0x48864b={'id':_0x1aa425,'name':_0x57da43[_0x513a1f(0x1eb)],'kind':_0x57da43[_0x513a1f(0x1d1)],'ktl':store[_0x513a1f(0x206)]};return this['save'](_0x48864b);},async 'remove'(_0x1a7ea4){const _0x4dd575=_0x508761,_0x29b91d=artifactDir(_0x158c7a,_0x1a7ea4);if(!fs[_0x4dd575(0x201)](_0x29b91d))throw new store[(_0x4dd575(0x1e6))](_0x4dd575(0x200)+_0x1a7ea4);fs['rmSync'](_0x29b91d,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x51a0dc,_0x45bd25={}){const _0x45d69d=_0x11aed5;fs[_0x45d69d(0x1c8)](_0x51a0dc,{'recursive':!![]});const _0x2e295b=_0x568a58=>path['join'](_0x51a0dc,_0x568a58+_0x45d69d(0x20a));for(const [_0x3c1e36,_0x5bf5b6]of Object[_0x45d69d(0x1d3)](_0x45bd25)){if(!fs[_0x45d69d(0x201)](_0x2e295b(_0x3c1e36)))fs[_0x45d69d(0x1bd)](_0x2e295b(_0x3c1e36),JSON[_0x45d69d(0x1b8)](_0x5bf5b6,null,0x2),_0x45d69d(0x1b0));}return{async 'get'(_0x2341da){const _0x53f8ff=_0x45d69d,_0x279d04=_0x2e295b(_0x2341da);if(!fs[_0x53f8ff(0x201)](_0x279d04))throw new store[(_0x53f8ff(0x1e6))](_0x53f8ff(0x1f7)+_0x2341da);return JSON[_0x53f8ff(0x1d7)](fs[_0x53f8ff(0x1dc)](_0x279d04,'utf8'));},async 'save'(_0xff2e85,_0x130fb1){const _0x288303=_0x45d69d,_0x3c2f9b=_0x2e295b(_0xff2e85),_0x33b065=fs['existsSync'](_0x3c2f9b)?JSON[_0x288303(0x1d7)](fs[_0x288303(0x1dc)](_0x3c2f9b,_0x288303(0x1b0))):{'artifactId':'','values':{}},_0xb19bdd={'artifactId':_0x33b065[_0x288303(0x1e2)],'values':{..._0x33b065[_0x288303(0x1d2)],..._0x130fb1[_0x288303(0x1d2)]},'common':{..._0x33b065[_0x288303(0x20c)],..._0x130fb1['common']},'tabCommon':{..._0x33b065[_0x288303(0x1b7)],..._0x130fb1[_0x288303(0x1b7)]}};fs[_0x288303(0x1bd)](_0x3c2f9b,JSON['stringify'](_0xb19bdd,null,0x2),'utf8');},async 'list'(_0xca40ce){const _0x301a0a=_0x45d69d;return fs['readdirSync'](_0x51a0dc)[_0x301a0a(0x1f1)](_0x7045ac=>_0x7045ac[_0x301a0a(0x1fd)](_0x301a0a(0x20a)))[_0x301a0a(0x1c6)](_0x407907=>{const _0x4320b6=_0x301a0a,_0x4dcfd2=_0x407907[_0x4320b6(0x1d5)](0x0,-0x5),_0x5baf11=JSON[_0x4320b6(0x1d7)](fs[_0x4320b6(0x1dc)](path[_0x4320b6(0x1e7)](_0x51a0dc,_0x407907),_0x4320b6(0x1b0)));return{'id':_0x4dcfd2,'artifactId':_0x5baf11[_0x4320b6(0x1e2)]};})[_0x301a0a(0x1f1)](_0x3dc544=>!_0xca40ce||_0x3dc544['artifactId']===_0xca40ce);},async 'create'(_0x6064a9){const _0x453bfd=_0x45d69d,_0x67d3c0='inst-'+Math['random']()[_0x453bfd(0x1c9)](0x24)['slice'](0x2,0xa);return fs[_0x453bfd(0x1bd)](_0x2e295b(_0x67d3c0),JSON[_0x453bfd(0x1b8)]({'artifactId':_0x6064a9[_0x453bfd(0x1e2)],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x67d3c0};}};}function sha256Hex(_0x23a0ef){const _0x262645=_0x11aed5,_0x3c2c2f=typeof _0x23a0ef===_0x262645(0x1e8)?Buffer['from'](_0x23a0ef,_0x262645(0x1b0)):Buffer['from'](_0x23a0ef);return crypto[_0x262645(0x1f9)](_0x262645(0x1ed))[_0x262645(0x1c0)](_0x3c2c2f)[_0x262645(0x1cf)](_0x262645(0x1cd));}function writeObject(_0x689947,_0x4bafa3){const _0x43b2c3=_0x11aed5,_0x3aa902=sha256Hex(_0x4bafa3),_0x5da7e9=objectPath(_0x689947,_0x3aa902);fs[_0x43b2c3(0x1c8)](path[_0x43b2c3(0x205)](_0x5da7e9),{'recursive':!![]});if(!fs[_0x43b2c3(0x201)](_0x5da7e9))fs[_0x43b2c3(0x1bd)](_0x5da7e9,_0x4bafa3);return _0x3aa902;}function readLog(_0x50bd97,_0x37723e,_0x4079fe){const _0x397ac9=_0x11aed5,_0x158a00=itemDir(_0x50bd97,_0x37723e,_0x4079fe),_0x1f1d67=path[_0x397ac9(0x1e7)](_0x158a00,'log.json'),_0xdc65c1=path[_0x397ac9(0x1e7)](_0x158a00,'HEAD'),_0x2cdd06=fs[_0x397ac9(0x201)](_0x1f1d67)?JSON['parse'](fs['readFileSync'](_0x1f1d67,_0x397ac9(0x1b0))):[],_0x1707f2=fs['existsSync'](_0xdc65c1)?fs[_0x397ac9(0x1dc)](_0xdc65c1,'utf8')['trim']():_0x2cdd06['at'](-0x1)?.[_0x397ac9(0x1cc)]??null;return{'head':_0x1707f2,'items':_0x2cdd06};}function writeLog(_0x40e043,_0x2cc33c,_0x1276d4,_0x4882fd,_0x3b3508){const _0x5c021d=_0x11aed5,_0x36b149=itemDir(_0x40e043,_0x2cc33c,_0x1276d4);fs['mkdirSync'](_0x36b149,{'recursive':!![]}),fs['writeFileSync'](path[_0x5c021d(0x1e7)](_0x36b149,_0x5c021d(0x1b9)),JSON[_0x5c021d(0x1b8)](_0x3b3508,null,0x2),_0x5c021d(0x1b0)),fs[_0x5c021d(0x1bd)](path['join'](_0x36b149,_0x5c021d(0x204)),_0x4882fd+'\x0a',_0x5c021d(0x1b0));}function findRev(_0x17ef87,_0x5bbd4c){const _0x3f4c1a=_0x11aed5,_0x43b0fe=path[_0x3f4c1a(0x1e7)](_0x17ef87,_0x3f4c1a(0x1e9));if(!fs[_0x3f4c1a(0x201)](_0x43b0fe))return void 0x0;for(const _0x33567e of fs[_0x3f4c1a(0x202)](_0x43b0fe,{'withFileTypes':!![]})){if(!_0x33567e['isDirectory']())continue;for(const _0x1e9b20 of fs[_0x3f4c1a(0x202)](path[_0x3f4c1a(0x1e7)](_0x43b0fe,_0x33567e[_0x3f4c1a(0x1eb)]),{'withFileTypes':!![]})){if(!_0x1e9b20[_0x3f4c1a(0x1b3)]())continue;const _0x4f4e6c=readLog(_0x17ef87,_0x33567e[_0x3f4c1a(0x1eb)],_0x1e9b20['name'])[_0x3f4c1a(0x1e9)]['find'](_0x563a72=>_0x563a72[_0x3f4c1a(0x1cc)]===_0x5bbd4c);if(_0x4f4e6c)return _0x4f4e6c;}}return void 0x0;}function filesTextOf(_0x1dff95,_0xe9bc09){const _0x58c1fd=_0x11aed5,_0x2c8e9b={};for(const [_0x22bd2a,_0x104522]of Object[_0x58c1fd(0x1d3)](_0xe9bc09[_0x58c1fd(0x1bb)])){const _0x413d34=objectPath(_0x1dff95,_0x104522);if(fs[_0x58c1fd(0x201)](_0x413d34))_0x2c8e9b[_0x22bd2a]=fs[_0x58c1fd(0x1dc)](_0x413d34,'utf8');}return _0x2c8e9b;}function createFsVersionStore(_0x5eb9c9,_0xedb870){const _0x5d166f=_0x11aed5;return fs[_0x5d166f(0x1c8)](_0x5eb9c9,{'recursive':!![]}),{async 'log'(_0xc2ff7d,_0x59af0f){const _0x328a05=_0x5d166f,{head:_0x4c2e1a,items:_0x384e5f}=readLog(_0x5eb9c9,_0xc2ff7d,_0x59af0f);return{'head':_0x4c2e1a,'items':[..._0x384e5f][_0x328a05(0x1c1)]((_0x24a42a,_0x4bacf4)=>_0x24a42a['at']<_0x4bacf4['at']?0x1:-0x1)};},async 'get'(_0x4cc2fe){const _0x59bd77=_0x5d166f,_0x309e05=findRev(_0x5eb9c9,_0x4cc2fe);if(!_0x309e05)throw new store['KtNotFoundError'](_0x59bd77(0x1bf)+_0x4cc2fe);return _0x309e05;},async 'readFile'(_0x260ccb,_0xd7d9a0){const _0x2319f1=_0x5d166f,_0x42081a=await this[_0x2319f1(0x1e0)](_0x260ccb),_0xe59a5c=_0x42081a[_0x2319f1(0x1bb)][_0xd7d9a0];if(!_0xe59a5c)throw new store[(_0x2319f1(0x1e6))](_0xd7d9a0);const _0x19595a=objectPath(_0x5eb9c9,_0xe59a5c);if(!fs['existsSync'](_0x19595a))throw new store[(_0x2319f1(0x1e6))](_0xd7d9a0);return new Uint8Array(fs['readFileSync'](_0x19595a));},async 'commit'(_0x3756b6){const _0x56ab59=_0x5d166f;let _0x485dfe=_0x3756b6['files'];if(!_0x485dfe){const _0xb6bf46=await _0xedb870[_0x56ab59(0x1e0)](_0x3756b6['id']);_0x485dfe=store['artifactToFiles'](_0xb6bf46);}const _0x1f7247={},_0x410b88={};for(const [_0x2664e1,_0xaf1bbb]of Object[_0x56ab59(0x1d3)](_0x485dfe)){const _0x330ab4=typeof _0xaf1bbb==='string'?_0xaf1bbb:new TextDecoder()['decode'](_0xaf1bbb);_0x1f7247[_0x2664e1]=_0x330ab4,_0x410b88[_0x2664e1]=writeObject(_0x5eb9c9,typeof _0xaf1bbb==='string'?Buffer[_0x56ab59(0x209)](_0xaf1bbb,_0x56ab59(0x1b0)):_0xaf1bbb);}const _0x32111e=readLog(_0x5eb9c9,_0x3756b6[_0x56ab59(0x1d1)],_0x3756b6['id']);if(_0x32111e[_0x56ab59(0x1b5)]){const _0x3fc38e=_0x32111e[_0x56ab59(0x1e9)][_0x56ab59(0x1b4)](_0x171b4f=>_0x171b4f[_0x56ab59(0x1cc)]===_0x32111e[_0x56ab59(0x1b5)]);if(_0x3fc38e&&store['filesEqual'](_0x1f7247,filesTextOf(_0x5eb9c9,_0x3fc38e)))return _0x3fc38e;}const _0xb3ab22=new Date(),_0x395786=String(_0xb3ab22[_0x56ab59(0x1fb)]())[_0x56ab59(0x1d5)](0x2)+String(_0xb3ab22[_0x56ab59(0x208)]()+0x1)[_0x56ab59(0x1b1)](0x2,'0')+String(_0xb3ab22[_0x56ab59(0x1dd)]())[_0x56ab59(0x1b1)](0x2,'0')+String(_0xb3ab22[_0x56ab59(0x1b6)]())['padStart'](0x2,'0')+String(_0xb3ab22[_0x56ab59(0x1f5)]())['padStart'](0x2,'0'),_0x312b75=sha256Hex(Object[_0x56ab59(0x1d2)](_0x410b88)['sort']()[_0x56ab59(0x1e7)](','))[_0x56ab59(0x1d5)](0x0,0x8),_0x1d586e={'rev':_0x395786+_0x56ab59(0x1bc)+_0x312b75,'kind':_0x3756b6[_0x56ab59(0x1d1)],'id':_0x3756b6['id'],'at':_0xb3ab22[_0x56ab59(0x1f6)](),'parent':_0x32111e[_0x56ab59(0x1b5)],'by':_0x3756b6['by'],'note':_0x3756b6[_0x56ab59(0x1fc)],'files':_0x410b88,'meta':_0x3756b6[_0x56ab59(0x20b)]};return writeLog(_0x5eb9c9,_0x3756b6['kind'],_0x3756b6['id'],_0x1d586e[_0x56ab59(0x1cc)],[..._0x32111e['items'],_0x1d586e]),_0x1d586e;},async 'restore'(_0x50eb06,_0x605e8a,_0x167577,_0x194ac9){const _0x489825=_0x5d166f,_0xab3efd=await this[_0x489825(0x1e0)](_0x167577),_0x1059b1={};for(const _0x156b6b of Object[_0x489825(0x1af)](_0xab3efd[_0x489825(0x1bb)])){_0x1059b1[_0x156b6b]=new TextDecoder()['decode'](await this[_0x489825(0x1ef)](_0x167577,_0x156b6b));}const _0x30c86f=store['filesToArtifact'](_0x1059b1,_0x605e8a);return await _0xedb870[_0x489825(0x1da)]({..._0x30c86f,'id':_0x605e8a,'kind':_0x30c86f['kind'],'etag':void 0x0}),this[_0x489825(0x1e1)]({'kind':_0x50eb06,'id':_0x605e8a,'files':_0x1059b1,'by':_0x194ac9,'note':_0x489825(0x1f3)+_0x167577});}};}function createKtFsStores(_0x13d8ea){const _0x49e73b=_0x11aed5,_0x5ef806=createFsArtifactStore(resolveRoot(_0x13d8ea[_0x49e73b(0x1f8)],_0x13d8ea[_0x49e73b(0x1ec)]),_0x13d8ea[_0x49e73b(0x1de)]),_0x6cc507=_0x13d8ea[_0x49e73b(0x1c7)]?createFsInstanceStore(resolveRoot(_0x13d8ea[_0x49e73b(0x1c7)],_0x13d8ea[_0x49e73b(0x1ec)]),_0x13d8ea['seedInstances']):void 0x0,_0x14045b=_0x13d8ea[_0x49e73b(0x1ba)]?createFsVersionStore(resolveRoot(_0x13d8ea[_0x49e73b(0x1ba)],_0x13d8ea[_0x49e73b(0x1ec)]),_0x5ef806):void 0x0;return{'artifacts':_0x5ef806,'instances':_0x6cc507,'versions':_0x14045b};}exports['createKtFsStores']=createKtFsStores;
1
+ 'use strict';const _0x4aaa52=_0x6bdc;(function(_0x3270d3,_0x379246){const _0xfa281=_0x6bdc,_0x4f315c=_0x3270d3();while(!![]){try{const _0x3a4996=parseInt(_0xfa281(0x1e5))/0x1+-parseInt(_0xfa281(0x207))/0x2*(-parseInt(_0xfa281(0x211))/0x3)+parseInt(_0xfa281(0x213))/0x4*(-parseInt(_0xfa281(0x225))/0x5)+-parseInt(_0xfa281(0x204))/0x6+parseInt(_0xfa281(0x236))/0x7+parseInt(_0xfa281(0x20d))/0x8*(-parseInt(_0xfa281(0x1e8))/0x9)+parseInt(_0xfa281(0x1f7))/0xa*(parseInt(_0xfa281(0x1fd))/0xb);if(_0x3a4996===_0x379246)break;else _0x4f315c['push'](_0x4f315c['shift']());}catch(_0x4e969e){_0x4f315c['push'](_0x4f315c['shift']());}}}(_0x3940,0x57a12));var fs=require('fs'),path=require(_0x4aaa52(0x215)),store=require(_0x4aaa52(0x1ff)),crypto=require('crypto');function resolveRoot(_0xabfbb8,_0x424aa8=process[_0x4aaa52(0x21c)]()){const _0x59109d=_0x4aaa52,_0x2f7354=path[_0x59109d(0x21b)](_0xabfbb8)?_0xabfbb8:path[_0x59109d(0x219)](_0x424aa8,_0xabfbb8);return fs[_0x59109d(0x212)](_0x2f7354,{'recursive':!![]}),_0x2f7354;}function artifactDir(_0x4bcf5e,_0x27f28a){const _0x41d1a7=_0x4aaa52;return path[_0x41d1a7(0x20a)](_0x4bcf5e,_0x27f28a);}function objectPath(_0x1940b2,_0x446986){const _0x31b503=_0x4aaa52;return path[_0x31b503(0x20a)](_0x1940b2,_0x31b503(0x229),_0x446986['slice'](0x0,0x2),_0x446986);}function itemDir(_0x22afb9,_0x18e246,_0x40df0f){const _0x4ef231=_0x4aaa52;return path[_0x4ef231(0x20a)](_0x22afb9,_0x4ef231(0x221),_0x18e246,_0x40df0f);}function newEtag(){const _0x110c72=_0x4aaa52;return Date['now']()[_0x110c72(0x1e0)](0x24)+'-'+Math['random']()['toString'](0x24)[_0x110c72(0x222)](0x2,0x8);}function readEtag(_0x30d384){const _0x5d8b55=_0x4aaa52,_0x53ad00=path[_0x5d8b55(0x20a)](_0x30d384,_0x5d8b55(0x1e9));return fs[_0x5d8b55(0x20c)](_0x53ad00)?fs[_0x5d8b55(0x232)](_0x53ad00,_0x5d8b55(0x231))[_0x5d8b55(0x1e1)]():void 0x0;}function writeArtifactDir(_0x37c8f7,_0x2621e4,_0xefe08a){const _0x3682c5=_0x4aaa52;fs['mkdirSync'](path['join'](_0x37c8f7,_0x3682c5(0x20f)),{'recursive':!![]});const _0x13a179=store[_0x3682c5(0x1e3)](_0x2621e4);fs[_0x3682c5(0x210)](path[_0x3682c5(0x20a)](_0x37c8f7,store[_0x3682c5(0x22f)]),_0x13a179[store[_0x3682c5(0x22f)]]??'{}',_0x3682c5(0x231)),fs[_0x3682c5(0x210)](path[_0x3682c5(0x20a)](_0x37c8f7,store[_0x3682c5(0x1ea)]),_0x13a179[store['ARTIFACT_FILE_BODY']]??'',_0x3682c5(0x231));const _0x40b309=path[_0x3682c5(0x20a)](_0x37c8f7,store[_0x3682c5(0x1fc)]),_0x3664c2=path[_0x3682c5(0x20a)](_0x37c8f7,store[_0x3682c5(0x1f3)]);if(_0x13a179[store[_0x3682c5(0x1fc)]])fs['writeFileSync'](_0x40b309,_0x13a179[store[_0x3682c5(0x1fc)]],_0x3682c5(0x231));else{if(fs['existsSync'](_0x40b309))fs['rmSync'](_0x40b309);}if(_0x13a179[store['ARTIFACT_FILE_REPORT']])fs[_0x3682c5(0x210)](_0x3664c2,_0x13a179[store['ARTIFACT_FILE_REPORT']],'utf8');else{if(fs[_0x3682c5(0x20c)](_0x3664c2))fs[_0x3682c5(0x209)](_0x3664c2);}fs[_0x3682c5(0x210)](path[_0x3682c5(0x20a)](_0x37c8f7,'.etag'),_0xefe08a,'utf8');}function readArtifactDir(_0x237810,_0x28162d){const _0x4b6c31=_0x4aaa52,_0x5c0388={},_0x5adfca=path[_0x4b6c31(0x20a)](_0x237810,store[_0x4b6c31(0x22f)]),_0x5ada9d=path[_0x4b6c31(0x20a)](_0x237810,store[_0x4b6c31(0x1ea)]);if(fs[_0x4b6c31(0x20c)](_0x5adfca))_0x5c0388[store[_0x4b6c31(0x22f)]]=fs['readFileSync'](_0x5adfca,'utf8');if(fs[_0x4b6c31(0x20c)](_0x5ada9d))_0x5c0388[store[_0x4b6c31(0x1ea)]]=fs['readFileSync'](_0x5ada9d,_0x4b6c31(0x231));const _0x398925=path[_0x4b6c31(0x20a)](_0x237810,store[_0x4b6c31(0x1fc)]),_0x422fb6=path[_0x4b6c31(0x20a)](_0x237810,store[_0x4b6c31(0x1f3)]);if(fs[_0x4b6c31(0x20c)](_0x398925))_0x5c0388[store[_0x4b6c31(0x1fc)]]=fs[_0x4b6c31(0x232)](_0x398925,_0x4b6c31(0x231));if(fs[_0x4b6c31(0x20c)](_0x422fb6))_0x5c0388[store['ARTIFACT_FILE_REPORT']]=fs['readFileSync'](_0x422fb6,_0x4b6c31(0x231));return{...store[_0x4b6c31(0x1ed)](_0x5c0388,_0x28162d),'etag':readEtag(_0x237810)};}function createFsArtifactStore(_0x55ebe0,_0x4dd2c0=[]){const _0x5bd8b7=_0x4aaa52;fs['mkdirSync'](_0x55ebe0,{'recursive':!![]});for(const _0x267f6f of _0x4dd2c0){const _0x550b32=artifactDir(_0x55ebe0,_0x267f6f['id']),_0x5bf0f7=path['join'](_0x550b32,store[_0x5bd8b7(0x1ea)]);if(!fs[_0x5bd8b7(0x20c)](_0x5bf0f7))writeArtifactDir(_0x550b32,_0x267f6f,_0x267f6f[_0x5bd8b7(0x22b)]??newEtag());}return{async 'list'(_0x40c2c0){const _0x5ef31d=_0x5bd8b7;if(!fs[_0x5ef31d(0x20c)](_0x55ebe0))return[];const _0x25759d=[];for(const _0x3b0dc0 of fs[_0x5ef31d(0x202)](_0x55ebe0,{'withFileTypes':!![]})){if(!_0x3b0dc0[_0x5ef31d(0x1f1)]())continue;try{const _0x4760fb=readArtifactDir(artifactDir(_0x55ebe0,_0x3b0dc0[_0x5ef31d(0x237)]),_0x3b0dc0[_0x5ef31d(0x237)]);if(!_0x40c2c0||_0x4760fb[_0x5ef31d(0x21d)]===_0x40c2c0)_0x25759d[_0x5ef31d(0x218)]({'id':_0x4760fb['id'],'name':_0x4760fb[_0x5ef31d(0x237)],'kind':_0x4760fb[_0x5ef31d(0x21d)]});}catch{}}return _0x25759d;},async 'get'(_0x519a54){const _0x46dd3d=_0x5bd8b7,_0x4afe48=artifactDir(_0x55ebe0,_0x519a54);if(!fs['existsSync'](_0x4afe48))throw new store[(_0x46dd3d(0x1f5))](_0x46dd3d(0x22e)+_0x519a54);return readArtifactDir(_0x4afe48,_0x519a54);},async 'save'(_0x357b32){const _0x4bcd50=_0x5bd8b7,_0x52ba62=artifactDir(_0x55ebe0,_0x357b32['id']),_0x1bd838=fs[_0x4bcd50(0x20c)](_0x52ba62)?readArtifactDir(_0x52ba62,_0x357b32['id']):void 0x0;if(_0x357b32[_0x4bcd50(0x22b)]&&_0x1bd838?.[_0x4bcd50(0x22b)]&&_0x357b32[_0x4bcd50(0x22b)]!==_0x1bd838['etag'])throw new store[(_0x4bcd50(0x206))](_0x4bcd50(0x233),_0x1bd838);const _0xd4f37b=newEtag();return writeArtifactDir(_0x52ba62,_0x357b32,_0xd4f37b),{..._0x357b32,'etag':_0xd4f37b};},async 'create'(_0x382313){const _0x136c01=_0x5bd8b7,_0x19d33a=_0x382313['kind']+'-'+Math[_0x136c01(0x238)]()['toString'](0x24)[_0x136c01(0x222)](0x2,0xa),_0x31f1b6={'id':_0x19d33a,'name':_0x382313[_0x136c01(0x237)],'kind':_0x382313['kind'],'ktl':store[_0x136c01(0x1eb)]};return this[_0x136c01(0x239)](_0x31f1b6);},async 'remove'(_0x5b0bea){const _0x8b17c5=_0x5bd8b7,_0x48f188=artifactDir(_0x55ebe0,_0x5b0bea);if(!fs[_0x8b17c5(0x20c)](_0x48f188))throw new store[(_0x8b17c5(0x1f5))](_0x8b17c5(0x22e)+_0x5b0bea);fs[_0x8b17c5(0x209)](_0x48f188,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x4e7476,_0x5e6374={}){const _0x549a57=_0x4aaa52;fs[_0x549a57(0x212)](_0x4e7476,{'recursive':!![]});const _0x36fb16=_0x26f332=>path[_0x549a57(0x20a)](_0x4e7476,_0x26f332+_0x549a57(0x223));for(const [_0x46c518,_0x5da218]of Object[_0x549a57(0x230)](_0x5e6374)){if(!fs[_0x549a57(0x20c)](_0x36fb16(_0x46c518)))fs[_0x549a57(0x210)](_0x36fb16(_0x46c518),JSON['stringify'](_0x5da218,null,0x2),_0x549a57(0x231));}return{async 'get'(_0x5e3fc0){const _0xe8cf3f=_0x549a57,_0x161490=_0x36fb16(_0x5e3fc0);if(!fs[_0xe8cf3f(0x20c)](_0x161490))throw new store[(_0xe8cf3f(0x1f5))]('instance\x20'+_0x5e3fc0);return JSON[_0xe8cf3f(0x1e7)](fs[_0xe8cf3f(0x232)](_0x161490,_0xe8cf3f(0x231)));},async 'save'(_0x235505,_0x48bc53){const _0x236921=_0x549a57,_0x1819d9=_0x36fb16(_0x235505),_0x3951d7=fs[_0x236921(0x20c)](_0x1819d9)?JSON['parse'](fs[_0x236921(0x232)](_0x1819d9,_0x236921(0x231))):{'artifactId':'','values':{}},_0x2682dc={'artifactId':_0x3951d7[_0x236921(0x216)],'values':{..._0x3951d7[_0x236921(0x1fe)],..._0x48bc53[_0x236921(0x1fe)]},'common':{..._0x3951d7[_0x236921(0x22d)],..._0x48bc53[_0x236921(0x22d)]},'tabCommon':{..._0x3951d7[_0x236921(0x220)],..._0x48bc53[_0x236921(0x220)]}};fs[_0x236921(0x210)](_0x1819d9,JSON[_0x236921(0x200)](_0x2682dc,null,0x2),_0x236921(0x231));},async 'list'(_0x463db5){const _0x1f4f97=_0x549a57;return fs['readdirSync'](_0x4e7476)[_0x1f4f97(0x1e6)](_0x1d2f83=>_0x1d2f83[_0x1f4f97(0x214)](_0x1f4f97(0x223)))[_0x1f4f97(0x1ef)](_0x286794=>{const _0x1b8101=_0x1f4f97,_0x564702=_0x286794[_0x1b8101(0x222)](0x0,-0x5),_0x4532ef=JSON['parse'](fs[_0x1b8101(0x232)](path[_0x1b8101(0x20a)](_0x4e7476,_0x286794),_0x1b8101(0x231)));return{'id':_0x564702,'artifactId':_0x4532ef['artifactId']};})[_0x1f4f97(0x1e6)](_0x4af339=>!_0x463db5||_0x4af339[_0x1f4f97(0x216)]===_0x463db5);},async 'create'(_0x3cf28c){const _0x4006ea=_0x549a57,_0x55bc7e=_0x4006ea(0x1f6)+Math[_0x4006ea(0x238)]()['toString'](0x24)[_0x4006ea(0x222)](0x2,0xa);return fs[_0x4006ea(0x210)](_0x36fb16(_0x55bc7e),JSON['stringify']({'artifactId':_0x3cf28c[_0x4006ea(0x216)],'values':{},'common':{}},null,0x2),_0x4006ea(0x231)),{'id':_0x55bc7e};}};}function sha256Hex(_0x3befd){const _0x39444f=_0x4aaa52,_0x416d5b=typeof _0x3befd===_0x39444f(0x21e)?Buffer[_0x39444f(0x20e)](_0x3befd,_0x39444f(0x231)):Buffer[_0x39444f(0x20e)](_0x3befd);return crypto[_0x39444f(0x1f0)](_0x39444f(0x235))[_0x39444f(0x21f)](_0x416d5b)[_0x39444f(0x1f9)](_0x39444f(0x203));}function writeObject(_0x140f01,_0x5af43b){const _0x20e45c=_0x4aaa52,_0x386de1=sha256Hex(_0x5af43b),_0x1d88e8=objectPath(_0x140f01,_0x386de1);fs[_0x20e45c(0x212)](path[_0x20e45c(0x21a)](_0x1d88e8),{'recursive':!![]});if(!fs[_0x20e45c(0x20c)](_0x1d88e8))fs[_0x20e45c(0x210)](_0x1d88e8,_0x5af43b);return _0x386de1;}function readLog(_0x23e909,_0x9d8c59,_0x318da9){const _0x4c42ad=_0x4aaa52,_0x186f5f=itemDir(_0x23e909,_0x9d8c59,_0x318da9),_0x1370fb=path['join'](_0x186f5f,_0x4c42ad(0x1f4)),_0x2880f1=path[_0x4c42ad(0x20a)](_0x186f5f,'HEAD'),_0x58d66e=fs[_0x4c42ad(0x20c)](_0x1370fb)?JSON[_0x4c42ad(0x1e7)](fs[_0x4c42ad(0x232)](_0x1370fb,'utf8')):[],_0x40cb7c=fs[_0x4c42ad(0x20c)](_0x2880f1)?fs[_0x4c42ad(0x232)](_0x2880f1,_0x4c42ad(0x231))[_0x4c42ad(0x1e1)]():_0x58d66e['at'](-0x1)?.[_0x4c42ad(0x20b)]??null;return{'head':_0x40cb7c,'items':_0x58d66e};}function _0x6bdc(_0x1b0880,_0x4653f9){_0x1b0880=_0x1b0880-0x1df;const _0x39405d=_0x3940();let _0x6bdc90=_0x39405d[_0x1b0880];if(_0x6bdc['EXVmdn']===undefined){var _0x1829dd=function(_0x503f69){const _0x6e4ad0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3ebc35='',_0xabfbb8='';for(let _0x424aa8=0x0,_0x2f7354,_0x4bcf5e,_0x27f28a=0x0;_0x4bcf5e=_0x503f69['charAt'](_0x27f28a++);~_0x4bcf5e&&(_0x2f7354=_0x424aa8%0x4?_0x2f7354*0x40+_0x4bcf5e:_0x4bcf5e,_0x424aa8++%0x4)?_0x3ebc35+=String['fromCharCode'](0xff&_0x2f7354>>(-0x2*_0x424aa8&0x6)):0x0){_0x4bcf5e=_0x6e4ad0['indexOf'](_0x4bcf5e);}for(let _0x1940b2=0x0,_0x446986=_0x3ebc35['length'];_0x1940b2<_0x446986;_0x1940b2++){_0xabfbb8+='%'+('00'+_0x3ebc35['charCodeAt'](_0x1940b2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xabfbb8);};_0x6bdc['pwswEu']=_0x1829dd,_0x6bdc['AWjnZm']={},_0x6bdc['EXVmdn']=!![];}const _0x5aa247=_0x39405d[0x0];_0x6bdc['HvQrDD']!==_0x5aa247&&(_0x6bdc['AWjnZm']={},_0x6bdc['HvQrDD']=_0x5aa247);const _0x1b642f=_0x6bdc['AWjnZm'][_0x1b0880];return _0x1b642f===undefined?(_0x6bdc90=_0x6bdc['pwswEu'](_0x6bdc90),_0x6bdc['AWjnZm'][_0x1b0880]=_0x6bdc90):_0x6bdc90=_0x1b642f,_0x6bdc90;}function writeLog(_0x37f2d3,_0x167196,_0x1620d5,_0x41901f,_0x4b4768){const _0x4825f1=_0x4aaa52,_0x53056f=itemDir(_0x37f2d3,_0x167196,_0x1620d5);fs[_0x4825f1(0x212)](_0x53056f,{'recursive':!![]}),fs[_0x4825f1(0x210)](path[_0x4825f1(0x20a)](_0x53056f,_0x4825f1(0x1f4)),JSON[_0x4825f1(0x200)](_0x4b4768,null,0x2),_0x4825f1(0x231)),fs[_0x4825f1(0x210)](path[_0x4825f1(0x20a)](_0x53056f,_0x4825f1(0x1f2)),_0x41901f+'\x0a',_0x4825f1(0x231));}function findRev(_0x37e25a,_0x564a91){const _0x22f593=_0x4aaa52,_0x895e2c=path[_0x22f593(0x20a)](_0x37e25a,'items');if(!fs[_0x22f593(0x20c)](_0x895e2c))return void 0x0;for(const _0x388586 of fs[_0x22f593(0x202)](_0x895e2c,{'withFileTypes':!![]})){if(!_0x388586[_0x22f593(0x1f1)]())continue;for(const _0x3a857e of fs[_0x22f593(0x202)](path[_0x22f593(0x20a)](_0x895e2c,_0x388586[_0x22f593(0x237)]),{'withFileTypes':!![]})){if(!_0x3a857e[_0x22f593(0x1f1)]())continue;const _0x1cc927=readLog(_0x37e25a,_0x388586['name'],_0x3a857e[_0x22f593(0x237)])['items'][_0x22f593(0x1e4)](_0x4a4be1=>_0x4a4be1[_0x22f593(0x20b)]===_0x564a91);if(_0x1cc927)return _0x1cc927;}}return void 0x0;}function filesTextOf(_0x302872,_0x1b9dfd){const _0x367d42=_0x4aaa52,_0x1fc0c5={};for(const [_0x5b8419,_0x51b1a0]of Object[_0x367d42(0x230)](_0x1b9dfd[_0x367d42(0x217)])){const _0x1fbbc1=objectPath(_0x302872,_0x51b1a0);if(fs[_0x367d42(0x20c)](_0x1fbbc1))_0x1fc0c5[_0x5b8419]=fs[_0x367d42(0x232)](_0x1fbbc1,_0x367d42(0x231));}return _0x1fc0c5;}function createFsVersionStore(_0x4bb0e1,_0x5859ae){const _0x5abd39=_0x4aaa52;return fs[_0x5abd39(0x212)](_0x4bb0e1,{'recursive':!![]}),{async 'log'(_0x49efe4,_0xdc1ce5){const _0x29ffd1=_0x5abd39,{head:_0xcf9f18,items:_0x3e5426}=readLog(_0x4bb0e1,_0x49efe4,_0xdc1ce5);return{'head':_0xcf9f18,'items':[..._0x3e5426][_0x29ffd1(0x228)]((_0x541662,_0xb77d63)=>_0x541662['at']<_0xb77d63['at']?0x1:-0x1)};},async 'get'(_0x49b4eb){const _0x5a0633=_0x5abd39,_0x1adb46=findRev(_0x4bb0e1,_0x49b4eb);if(!_0x1adb46)throw new store[(_0x5a0633(0x1f5))]('rev\x20'+_0x49b4eb);return _0x1adb46;},async 'readFile'(_0x1608ac,_0x3a6b24){const _0x4b56f3=_0x5abd39,_0x2d3aee=await this[_0x4b56f3(0x22a)](_0x1608ac),_0x41549a=_0x2d3aee['files'][_0x3a6b24];if(!_0x41549a)throw new store[(_0x4b56f3(0x1f5))](_0x3a6b24);const _0x193abd=objectPath(_0x4bb0e1,_0x41549a);if(!fs[_0x4b56f3(0x20c)](_0x193abd))throw new store[(_0x4b56f3(0x1f5))](_0x3a6b24);return new Uint8Array(fs[_0x4b56f3(0x232)](_0x193abd));},async 'commit'(_0x31d969){const _0x409909=_0x5abd39;let _0x1ad295=_0x31d969[_0x409909(0x217)];if(!_0x1ad295){const _0x4dc48b=await _0x5859ae[_0x409909(0x22a)](_0x31d969['id']);_0x1ad295=store[_0x409909(0x1e3)](_0x4dc48b);}const _0x265b98={},_0x40f4de={};for(const [_0x377d4d,_0x5f3834]of Object[_0x409909(0x230)](_0x1ad295)){const _0x1f3dc2=typeof _0x5f3834===_0x409909(0x21e)?_0x5f3834:new TextDecoder()['decode'](_0x5f3834);_0x265b98[_0x377d4d]=_0x1f3dc2,_0x40f4de[_0x377d4d]=writeObject(_0x4bb0e1,typeof _0x5f3834===_0x409909(0x21e)?Buffer[_0x409909(0x20e)](_0x5f3834,_0x409909(0x231)):_0x5f3834);}const _0x5b8fae=readLog(_0x4bb0e1,_0x31d969[_0x409909(0x21d)],_0x31d969['id']);if(_0x5b8fae[_0x409909(0x201)]){const _0x582015=_0x5b8fae[_0x409909(0x221)][_0x409909(0x1e4)](_0x286478=>_0x286478[_0x409909(0x20b)]===_0x5b8fae['head']);if(_0x582015&&store['filesEqual'](_0x265b98,filesTextOf(_0x4bb0e1,_0x582015)))return _0x582015;}const _0x59b71f=new Date(),_0x135371=String(_0x59b71f[_0x409909(0x22c)]())[_0x409909(0x222)](0x2)+String(_0x59b71f[_0x409909(0x227)]()+0x1)[_0x409909(0x208)](0x2,'0')+String(_0x59b71f[_0x409909(0x1df)]())[_0x409909(0x208)](0x2,'0')+String(_0x59b71f[_0x409909(0x224)]())['padStart'](0x2,'0')+String(_0x59b71f[_0x409909(0x1f8)]())[_0x409909(0x208)](0x2,'0'),_0x4be691=sha256Hex(Object[_0x409909(0x1fe)](_0x40f4de)[_0x409909(0x228)]()[_0x409909(0x20a)](','))[_0x409909(0x222)](0x0,0x8),_0x5ed864={'rev':_0x135371+_0x409909(0x1ec)+_0x4be691,'kind':_0x31d969['kind'],'id':_0x31d969['id'],'at':_0x59b71f['toISOString'](),'parent':_0x5b8fae[_0x409909(0x201)],'by':_0x31d969['by'],'note':_0x31d969[_0x409909(0x226)],'files':_0x40f4de,'meta':_0x31d969[_0x409909(0x234)]};return writeLog(_0x4bb0e1,_0x31d969[_0x409909(0x21d)],_0x31d969['id'],_0x5ed864[_0x409909(0x20b)],[..._0x5b8fae['items'],_0x5ed864]),_0x5ed864;},async 'restore'(_0x445850,_0x22de22,_0x59f782,_0x4a781b){const _0xd66b4a=_0x5abd39,_0x1af1e2=await this[_0xd66b4a(0x22a)](_0x59f782),_0x1aa609={};for(const _0x3e1480 of Object['keys'](_0x1af1e2[_0xd66b4a(0x217)])){_0x1aa609[_0x3e1480]=new TextDecoder()['decode'](await this['readFile'](_0x59f782,_0x3e1480));}const _0x99f643=store['filesToArtifact'](_0x1aa609,_0x22de22);return await _0x5859ae[_0xd66b4a(0x239)]({..._0x99f643,'id':_0x22de22,'kind':_0x99f643[_0xd66b4a(0x21d)],'etag':void 0x0}),this[_0xd66b4a(0x23a)]({'kind':_0x445850,'id':_0x22de22,'files':_0x1aa609,'by':_0x4a781b,'note':'\u6062\u590D\u81EA\x20'+_0x59f782});}};}function _0x3940(){const _0x3b8601=['Cgf0Aa','yxj0AwzHy3rjza','zMLSzxm','ChvZAa','CMvZB2X2zq','zgLYBMfTzq','AxnbyNnVBhv0zq','y3DK','A2LUza','C3rYAw5N','DxbKyxrL','DgfIq29TBw9U','AxrLBxm','C2XPy2u','lMPZB24','z2v0sg91CNm','ntbzzNfKv28','BM90zq','z2v0tw9UDgG','C29YDa','B2jQzwn0CW','z2v0','zxrHzW','z2v0rNvSBfLLyxi','y29TBw9U','yxj0AwzHy3qG','qvjusuzbq1rFrKLmrv9nrvrb','zw50CMLLCW','DxrMoa','CMvHzezPBgvtEw5J','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','Bwv0yq','C2HHmJu2','mtKWnZK5menlufLUBa','BMfTzq','CMfUzg9T','C2f2zq','y29TBwL0','z2v0rgf0zq','Dg9tDhjPBMC','DhjPBq','y3jLyxrLs3rgC1n0B3jLCW','yxj0AwzHy3ruB0zPBgvZ','zMLUza','mJKXmZyYCgfzCfzJ','zMLSDgvY','CgfYC2u','mJmYmtKXENzOrg9J','lMv0ywC','qvjusuzbq1rFrKLmrv9ct0rz','ru1qvfLFs1rm','lwXVy2fSlq','zMLSzxnuB0fYDgLMywn0','C2vLzeLUC3rHBMnLCW','BwfW','y3jLyxrLsgfZAa','AxneAxjLy3rVCNK','sevbra','qvjusuzbq1rFrKLmrv9srvbpuLq','Bg9NlMPZB24','s3roB3rgB3vUzevYCM9Y','Aw5ZDc0','ndmWqNniEvzs','z2v0twLUDxrLCW','zgLNzxn0','Aw5ZDgfUy2vZuM9VDa','DMvYC2LVBNnsB290','qvjusuzbq1rFrKLmrv9gsuXm','mJeYmdKXzgf3EwzA','DMfSDwvZ','qgSTDgfIBguVCMvWB3j0l3n0B3jL','C3rYAw5NAwz5','AgvHza','CMvHzgrPCLn5BMm','Agv4','mZiZnJy5nezPvevxCq','C2vLza','s3rdB25MBgLJDevYCM9Y','ntm3mffoqwvjza','CgfKu3rHCNq','CM1tEw5J','AM9PBG','CMv2','zxHPC3rZu3LUyW','nZjgyu55u0C','zNjVBq','zMfJzxm','D3jPDgvgAwXLu3LUyW','mZaZzhvrCKTs','BwTKAxjtEw5J','mJeZnduYBgrJr1DT','zw5KC1DPDgG'];_0x3940=function(){return _0x3b8601;};return _0x3940();}function createKtFsStores(_0x494c07){const _0xeac51a=_0x4aaa52,_0x4ccbf9=createFsArtifactStore(resolveRoot(_0x494c07['artifactsRoot'],_0x494c07[_0xeac51a(0x21c)]),_0x494c07[_0xeac51a(0x205)]),_0x305364=_0x494c07['instancesRoot']?createFsInstanceStore(resolveRoot(_0x494c07[_0xeac51a(0x1fa)],_0x494c07[_0xeac51a(0x21c)]),_0x494c07[_0xeac51a(0x1ee)]):void 0x0,_0x18b7a9=_0x494c07[_0xeac51a(0x1fb)]?createFsVersionStore(resolveRoot(_0x494c07[_0xeac51a(0x1fb)],_0x494c07['cwd']),_0x4ccbf9):void 0x0;return{'artifacts':_0x4ccbf9,'instances':_0x305364,'versions':_0x18b7a9};}exports[_0x4aaa52(0x1e2)]=createKtFsStores;
package/dist/fs.js CHANGED
@@ -1 +1 @@
1
- const _0x51bfbd=_0x1652;(function(_0x5e7529,_0x595a15){const _0x567495=_0x1652,_0x27cead=_0x5e7529();while(!![]){try{const _0xd254f2=parseInt(_0x567495(0xae))/0x1*(parseInt(_0x567495(0x9e))/0x2)+-parseInt(_0x567495(0xb8))/0x3+-parseInt(_0x567495(0xab))/0x4*(-parseInt(_0x567495(0xba))/0x5)+-parseInt(_0x567495(0xb9))/0x6*(-parseInt(_0x567495(0x79))/0x7)+-parseInt(_0x567495(0x8c))/0x8+parseInt(_0x567495(0x99))/0x9+-parseInt(_0x567495(0xa1))/0xa;if(_0xd254f2===_0x595a15)break;else _0x27cead['push'](_0x27cead['shift']());}catch(_0x5b3495){_0x27cead['push'](_0x27cead['shift']());}}}(_0x3215,0xcb872));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(_0x591c21,_0x1d48bf=process[_0x51bfbd(0xa3)]()){const _0x340baf=isAbsolute(_0x591c21)?_0x591c21:resolve(_0x1d48bf,_0x591c21);return mkdirSync(_0x340baf,{'recursive':!![]}),_0x340baf;}function artifactDir(_0x4f959f,_0x5a1194){return join(_0x4f959f,_0x5a1194);}function objectPath(_0x17bac7,_0x5424b0){const _0x464ff3=_0x51bfbd;return join(_0x17bac7,_0x464ff3(0x8b),_0x5424b0[_0x464ff3(0x77)](0x0,0x2),_0x5424b0);}function itemDir(_0x3b0424,_0x4f628b,_0x2a785c){return join(_0x3b0424,'items',_0x4f628b,_0x2a785c);}function _0x3215(){const _0x5b29aa=['mte1mtaYmZvVyxHhAMi','ChvZAa','DMvYC2LVBNnsB290','zw5KC1DPDgG','z2v0twLUDxrLCW','mJbwBwjNu0q','CMfUzg9T','BM90zq','otKWnZyZmgDPt0fIAq','lwXVy2fSlq','y3DK','DxrMoa','CgfYC2u','y29TBwL0','Aw5ZDgfUy2uG','CgfKu3rHCNq','lMPZB24','C2HHmJu2','ne1hDgrWqW','zMLUza','z2v0','mte5nJeWq2fAvgrL','yxj0AwzHy3qG','sevbra','zMLSzxm','CMv2','zMLSDgvY','yxj0AwzHy3rZuM9VDa','y29TBw9U','Bwv0yq','AgvHza','mZa3nJiZmgvRCu5ZDq','mtGZnduWCuHVAKTr','nty2odC1nwj2z3zItq','C29YDa','yxj0AwzHy3rjza','AM9PBG','C2XPy2u','Bg9NlMPZB24','mJfmtwLuvLq','z2v0rNvSBfLLyxi','C2vLza','BwfW','zxrHzW','lMv0ywC','C2f2zq','AxneAxjLy3rVCNK','BMfTzq','5OgI5Asn6iEQia','CMvHzezPBgu','zw50CMLLCW','A2LUza','zNjVBq','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','DMfSDwvZ','C3rYAw5NAwz5','C3rYAw5N','B2jQzwn0CW','nJGWntm0nezhvvHwra','DxbKyxrL','Dg9tDhjPBMC','DgfIq29TBw9U','Aw5ZDgfUy2vZuM9VDa','Agv4','z2v0tw9UDgG','AxrLBxm','z2v0rgf0zq','zgLNzxn0','DhjPBq','z2v0sg91CNm','zgvJB2rL'];_0x3215=function(){return _0x5b29aa;};return _0x3215();}function newEtag(){const _0x6764ff=_0x51bfbd;return Date['now']()[_0x6764ff(0x8e)](0x24)+'-'+Math[_0x6764ff(0x9f)]()[_0x6764ff(0x8e)](0x24)[_0x6764ff(0x77)](0x2,0x8);}function readEtag(_0x29b869){const _0x4a6c35=_0x51bfbd,_0x2206da=join(_0x29b869,_0x4a6c35(0x7e));return existsSync(_0x2206da)?readFileSync(_0x2206da,_0x4a6c35(0xa4))[_0x4a6c35(0x96)]():void 0x0;}function writeArtifactDir(_0x59b182,_0x4d0ea1,_0x17d22a){const _0x319a3b=_0x51bfbd;mkdirSync(join(_0x59b182,'faces'),{'recursive':!![]});const _0x17a998=artifactToFiles(_0x4d0ea1);writeFileSync(join(_0x59b182,ARTIFACT_FILE_META),_0x17a998[ARTIFACT_FILE_META]??'{}',_0x319a3b(0xa4)),writeFileSync(join(_0x59b182,ARTIFACT_FILE_BODY),_0x17a998[ARTIFACT_FILE_BODY]??'','utf8');const _0x3f2530=join(_0x59b182,ARTIFACT_FILE_FILL),_0x1281fb=join(_0x59b182,ARTIFACT_FILE_REPORT);if(_0x17a998[ARTIFACT_FILE_FILL])writeFileSync(_0x3f2530,_0x17a998[ARTIFACT_FILE_FILL],_0x319a3b(0xa4));else{if(existsSync(_0x3f2530))rmSync(_0x3f2530);}if(_0x17a998[ARTIFACT_FILE_REPORT])writeFileSync(_0x1281fb,_0x17a998[ARTIFACT_FILE_REPORT],'utf8');else{if(existsSync(_0x1281fb))rmSync(_0x1281fb);}writeFileSync(join(_0x59b182,_0x319a3b(0x7e)),_0x17d22a,'utf8');}function readArtifactDir(_0x2be966,_0x20f4b9){const _0x5125fb=_0x51bfbd,_0x2f2b2e={},_0x250d8f=join(_0x2be966,ARTIFACT_FILE_META),_0x87083d=join(_0x2be966,ARTIFACT_FILE_BODY);if(existsSync(_0x250d8f))_0x2f2b2e[ARTIFACT_FILE_META]=readFileSync(_0x250d8f,_0x5125fb(0xa4));if(existsSync(_0x87083d))_0x2f2b2e[ARTIFACT_FILE_BODY]=readFileSync(_0x87083d,_0x5125fb(0xa4));const _0x312494=join(_0x2be966,ARTIFACT_FILE_FILL),_0x2562c5=join(_0x2be966,ARTIFACT_FILE_REPORT);if(existsSync(_0x312494))_0x2f2b2e[ARTIFACT_FILE_FILL]=readFileSync(_0x312494,_0x5125fb(0xa4));if(existsSync(_0x2562c5))_0x2f2b2e[ARTIFACT_FILE_REPORT]=readFileSync(_0x2562c5,_0x5125fb(0xa4));return{...filesToArtifact(_0x2f2b2e,_0x20f4b9),'etag':readEtag(_0x2be966)};}function createFsArtifactStore(_0x3ebc48,_0x487947=[]){const _0x1866c7=_0x51bfbd;mkdirSync(_0x3ebc48,{'recursive':!![]});for(const _0x3cd1f3 of _0x487947){const _0x34834c=artifactDir(_0x3ebc48,_0x3cd1f3['id']),_0x3b1729=join(_0x34834c,ARTIFACT_FILE_BODY);if(!existsSync(_0x3b1729))writeArtifactDir(_0x34834c,_0x3cd1f3,_0x3cd1f3[_0x1866c7(0x7d)]??newEtag());}return{async 'list'(_0x363b2f){const _0x1d1336=_0x1866c7;if(!existsSync(_0x3ebc48))return[];const _0x197e60=[];for(const _0x5793ee of readdirSync(_0x3ebc48,{'withFileTypes':!![]})){if(!_0x5793ee[_0x1d1336(0x80)]())continue;try{const _0x4df899=readArtifactDir(artifactDir(_0x3ebc48,_0x5793ee[_0x1d1336(0x81)]),_0x5793ee['name']);if(!_0x363b2f||_0x4df899[_0x1d1336(0x85)]===_0x363b2f)_0x197e60[_0x1d1336(0x9a)]({'id':_0x4df899['id'],'name':_0x4df899[_0x1d1336(0x81)],'kind':_0x4df899[_0x1d1336(0x85)]});}catch{}}return _0x197e60;},async 'get'(_0x1fc33a){const _0x271dac=_0x1866c7,_0x5922eb=artifactDir(_0x3ebc48,_0x1fc33a);if(!existsSync(_0x5922eb))throw new KtNotFoundError(_0x271dac(0xaf)+_0x1fc33a);return readArtifactDir(_0x5922eb,_0x1fc33a);},async 'save'(_0x4281ff){const _0x3df295=_0x1866c7,_0x5f08e7=artifactDir(_0x3ebc48,_0x4281ff['id']),_0x42e3f3=existsSync(_0x5f08e7)?readArtifactDir(_0x5f08e7,_0x4281ff['id']):void 0x0;if(_0x4281ff['etag']&&_0x42e3f3?.[_0x3df295(0x7d)]&&_0x4281ff[_0x3df295(0x7d)]!==_0x42e3f3['etag'])throw new KtConflictError(_0x3df295(0x87),_0x42e3f3);const _0x49defa=newEtag();return writeArtifactDir(_0x5f08e7,_0x4281ff,_0x49defa),{..._0x4281ff,'etag':_0x49defa};},async 'create'(_0x19b546){const _0x59410c=_0x1866c7,_0x480f21=_0x19b546[_0x59410c(0x85)]+'-'+Math[_0x59410c(0x9f)]()[_0x59410c(0x8e)](0x24)[_0x59410c(0x77)](0x2,0xa),_0x9bff61={'id':_0x480f21,'name':_0x19b546[_0x59410c(0x81)],'kind':_0x19b546[_0x59410c(0x85)],'ktl':EMPTY_KTL};return this['save'](_0x9bff61);},async 'remove'(_0x24037d){const _0x526118=artifactDir(_0x3ebc48,_0x24037d);if(!existsSync(_0x526118))throw new KtNotFoundError('artifact\x20'+_0x24037d);rmSync(_0x526118,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x4ff767,_0x2094dd={}){const _0xd03251=_0x51bfbd;mkdirSync(_0x4ff767,{'recursive':!![]});const _0x918db3=_0x63bab5=>join(_0x4ff767,_0x63bab5+_0xd03251(0xa9));for(const [_0x10f976,_0x5b1cb6]of Object[_0xd03251(0x84)](_0x2094dd)){if(!existsSync(_0x918db3(_0x10f976)))writeFileSync(_0x918db3(_0x10f976),JSON[_0xd03251(0x89)](_0x5b1cb6,null,0x2),_0xd03251(0xa4));}return{async 'get'(_0x39a268){const _0xc04609=_0xd03251,_0x37dc14=_0x918db3(_0x39a268);if(!existsSync(_0x37dc14))throw new KtNotFoundError(_0xc04609(0xa7)+_0x39a268);return JSON[_0xc04609(0xa5)](readFileSync(_0x37dc14,_0xc04609(0xa4)));},async 'save'(_0x1dc033,_0x136389){const _0x430d9a=_0xd03251,_0xfb447a=_0x918db3(_0x1dc033),_0x453812=existsSync(_0xfb447a)?JSON['parse'](readFileSync(_0xfb447a,_0x430d9a(0xa4))):{'artifactId':'','values':{}},_0x35f835={'artifactId':_0x453812['artifactId'],'values':{..._0x453812[_0x430d9a(0x88)],..._0x136389[_0x430d9a(0x88)]},'common':{..._0x453812[_0x430d9a(0xb5)],..._0x136389['common']},'tabCommon':{..._0x453812[_0x430d9a(0x8f)],..._0x136389[_0x430d9a(0x8f)]}};writeFileSync(_0xfb447a,JSON[_0x430d9a(0x89)](_0x35f835,null,0x2),_0x430d9a(0xa4));},async 'list'(_0x2fdff7){const _0x458f2b=_0xd03251;return readdirSync(_0x4ff767)[_0x458f2b(0xb3)](_0x3af7fb=>_0x3af7fb[_0x458f2b(0x9c)](_0x458f2b(0xa9)))[_0x458f2b(0x7c)](_0x4ef35c=>{const _0x3b8fd8=_0x458f2b,_0x18f109=_0x4ef35c[_0x3b8fd8(0x77)](0x0,-0x5),_0xa79d0d=JSON[_0x3b8fd8(0xa5)](readFileSync(join(_0x4ff767,_0x4ef35c),_0x3b8fd8(0xa4)));return{'id':_0x18f109,'artifactId':_0xa79d0d[_0x3b8fd8(0xbc)]};})[_0x458f2b(0xb3)](_0x49b4db=>!_0x2fdff7||_0x49b4db[_0x458f2b(0xbc)]===_0x2fdff7);},async 'create'(_0x270a44){const _0x18e4be=_0xd03251,_0x5aadbb='inst-'+Math[_0x18e4be(0x9f)]()[_0x18e4be(0x8e)](0x24)[_0x18e4be(0x77)](0x2,0xa);return writeFileSync(_0x918db3(_0x5aadbb),JSON[_0x18e4be(0x89)]({'artifactId':_0x270a44[_0x18e4be(0xbc)],'values':{},'common':{}},null,0x2),'utf8'),{'id':_0x5aadbb};}};}function sha256Hex(_0xca9af1){const _0x15268a=_0x51bfbd,_0x3951b7=typeof _0xca9af1===_0x15268a(0x8a)?Buffer[_0x15268a(0x86)](_0xca9af1,_0x15268a(0xa4)):Buffer['from'](_0xca9af1);return createHash(_0x15268a(0xaa))[_0x15268a(0x8d)](_0x3951b7)[_0x15268a(0x95)](_0x15268a(0x91));}function writeObject(_0x476229,_0x16ec41){const _0x1bcb5c=sha256Hex(_0x16ec41),_0x1d8ee1=objectPath(_0x476229,_0x1bcb5c);mkdirSync(dirname(_0x1d8ee1),{'recursive':!![]});if(!existsSync(_0x1d8ee1))writeFileSync(_0x1d8ee1,_0x16ec41);return _0x1bcb5c;}function readLog(_0x35d7ce,_0x3cd4fb,_0x31ac0f){const _0x16cc3b=_0x51bfbd,_0x1ab86f=itemDir(_0x35d7ce,_0x3cd4fb,_0x31ac0f),_0xfd3a2e=join(_0x1ab86f,'log.json'),_0x4f6f49=join(_0x1ab86f,'HEAD'),_0x5dd5ee=existsSync(_0xfd3a2e)?JSON[_0x16cc3b(0xa5)](readFileSync(_0xfd3a2e,_0x16cc3b(0xa4))):[],_0x350548=existsSync(_0x4f6f49)?readFileSync(_0x4f6f49,_0x16cc3b(0xa4))[_0x16cc3b(0x96)]():_0x5dd5ee['at'](-0x1)?.[_0x16cc3b(0xb2)]??null;return{'head':_0x350548,'items':_0x5dd5ee};}function writeLog(_0x18a149,_0x4f5d50,_0x563005,_0x20287f,_0x5338df){const _0x28a2e2=_0x51bfbd,_0x7e896=itemDir(_0x18a149,_0x4f5d50,_0x563005);mkdirSync(_0x7e896,{'recursive':!![]}),writeFileSync(join(_0x7e896,_0x28a2e2(0x78)),JSON[_0x28a2e2(0x89)](_0x5338df,null,0x2),_0x28a2e2(0xa4)),writeFileSync(join(_0x7e896,_0x28a2e2(0xb0)),_0x20287f+'\x0a',_0x28a2e2(0xa4));}function findRev(_0x2f1c19,_0x23b0eb){const _0x116c64=_0x51bfbd,_0x57d20f=join(_0x2f1c19,_0x116c64(0x93));if(!existsSync(_0x57d20f))return void 0x0;for(const _0xb431be of readdirSync(_0x57d20f,{'withFileTypes':!![]})){if(!_0xb431be['isDirectory']())continue;for(const _0x2d895d of readdirSync(join(_0x57d20f,_0xb431be[_0x116c64(0x81)]),{'withFileTypes':!![]})){if(!_0x2d895d['isDirectory']())continue;const _0x303ede=readLog(_0x2f1c19,_0xb431be[_0x116c64(0x81)],_0x2d895d[_0x116c64(0x81)])[_0x116c64(0x93)][_0x116c64(0xac)](_0x48619d=>_0x48619d['rev']===_0x23b0eb);if(_0x303ede)return _0x303ede;}}return void 0x0;}function filesTextOf(_0x4844d8,_0x23a295){const _0x33f9bf=_0x51bfbd,_0x2e1b3b={};for(const [_0x317da8,_0x81023e]of Object[_0x33f9bf(0x84)](_0x23a295['files'])){const _0x1d271a=objectPath(_0x4844d8,_0x81023e);if(existsSync(_0x1d271a))_0x2e1b3b[_0x317da8]=readFileSync(_0x1d271a,_0x33f9bf(0xa4));}return _0x2e1b3b;}function createFsVersionStore(_0x5c140a,_0x4d94aa){return mkdirSync(_0x5c140a,{'recursive':!![]}),{async 'log'(_0x5d3cae,_0x37d1f7){const _0x125821=_0x1652,{head:_0x1dfcee,items:_0x22f53c}=readLog(_0x5c140a,_0x5d3cae,_0x37d1f7);return{'head':_0x1dfcee,'items':[..._0x22f53c][_0x125821(0xbb)]((_0x33b010,_0x1801f9)=>_0x33b010['at']<_0x1801f9['at']?0x1:-0x1)};},async 'get'(_0x3a5e57){const _0x1464a7=findRev(_0x5c140a,_0x3a5e57);if(!_0x1464a7)throw new KtNotFoundError('rev\x20'+_0x3a5e57);return _0x1464a7;},async 'readFile'(_0x1d2ef2,_0x438040){const _0x28ac9d=await this['get'](_0x1d2ef2),_0x38fddc=_0x28ac9d['files'][_0x438040];if(!_0x38fddc)throw new KtNotFoundError(_0x438040);const _0x2d5044=objectPath(_0x5c140a,_0x38fddc);if(!existsSync(_0x2d5044))throw new KtNotFoundError(_0x438040);return new Uint8Array(readFileSync(_0x2d5044));},async 'commit'(_0x2572d0){const _0x171a66=_0x1652;let _0x22ae49=_0x2572d0[_0x171a66(0xb1)];if(!_0x22ae49){const _0x5f1af8=await _0x4d94aa[_0x171a66(0xad)](_0x2572d0['id']);_0x22ae49=artifactToFiles(_0x5f1af8);}const _0x3adcbd={},_0x4a3df9={};for(const [_0x3a798f,_0x26f459]of Object[_0x171a66(0x84)](_0x22ae49)){const _0x342dc6=typeof _0x26f459===_0x171a66(0x8a)?_0x26f459:new TextDecoder()[_0x171a66(0x98)](_0x26f459);_0x3adcbd[_0x3a798f]=_0x342dc6,_0x4a3df9[_0x3a798f]=writeObject(_0x5c140a,typeof _0x26f459===_0x171a66(0x8a)?Buffer[_0x171a66(0x86)](_0x26f459,'utf8'):_0x26f459);}const _0x3df824=readLog(_0x5c140a,_0x2572d0[_0x171a66(0x85)],_0x2572d0['id']);if(_0x3df824[_0x171a66(0xb7)]){const _0x345020=_0x3df824[_0x171a66(0x93)][_0x171a66(0xac)](_0x4bcafe=>_0x4bcafe[_0x171a66(0xb2)]===_0x3df824[_0x171a66(0xb7)]);if(_0x345020&&filesEqual(_0x3adcbd,filesTextOf(_0x5c140a,_0x345020)))return _0x345020;}const _0x19cd0a=new Date(),_0x1e2505=String(_0x19cd0a[_0x171a66(0x7a)]())['slice'](0x2)+String(_0x19cd0a[_0x171a66(0x92)]()+0x1)['padStart'](0x2,'0')+String(_0x19cd0a[_0x171a66(0x94)]())[_0x171a66(0xa8)](0x2,'0')+String(_0x19cd0a[_0x171a66(0x97)]())[_0x171a66(0xa8)](0x2,'0')+String(_0x19cd0a[_0x171a66(0x9d)]())['padStart'](0x2,'0'),_0x55d231=sha256Hex(Object[_0x171a66(0x88)](_0x4a3df9)[_0x171a66(0xbb)]()[_0x171a66(0x76)](','))[_0x171a66(0x77)](0x0,0x8),_0x56c302={'rev':_0x1e2505+_0x171a66(0xa2)+_0x55d231,'kind':_0x2572d0['kind'],'id':_0x2572d0['id'],'at':_0x19cd0a['toISOString'](),'parent':_0x3df824['head'],'by':_0x2572d0['by'],'note':_0x2572d0[_0x171a66(0xa0)],'files':_0x4a3df9,'meta':_0x2572d0[_0x171a66(0xb6)]};return writeLog(_0x5c140a,_0x2572d0[_0x171a66(0x85)],_0x2572d0['id'],_0x56c302[_0x171a66(0xb2)],[..._0x3df824[_0x171a66(0x93)],_0x56c302]),_0x56c302;},async 'restore'(_0x1df14d,_0x1ec43b,_0x12ed0a,_0x232327){const _0x121803=_0x1652,_0x3f9276=await this[_0x121803(0xad)](_0x12ed0a),_0x1151ee={};for(const _0x2b366f of Object['keys'](_0x3f9276['files'])){_0x1151ee[_0x2b366f]=new TextDecoder()['decode'](await this[_0x121803(0x83)](_0x12ed0a,_0x2b366f));}const _0x2d66e7=filesToArtifact(_0x1151ee,_0x1ec43b);return await _0x4d94aa[_0x121803(0x7f)]({..._0x2d66e7,'id':_0x1ec43b,'kind':_0x2d66e7[_0x121803(0x85)],'etag':void 0x0}),this[_0x121803(0xa6)]({'kind':_0x1df14d,'id':_0x1ec43b,'files':_0x1151ee,'by':_0x232327,'note':_0x121803(0x82)+_0x12ed0a});}};}function _0x1652(_0x1bca2b,_0x4c1cb6){_0x1bca2b=_0x1bca2b-0x76;const _0x321569=_0x3215();let _0x165217=_0x321569[_0x1bca2b];if(_0x1652['qeRrCm']===undefined){var _0x115ee9=function(_0x187903){const _0x4228ea='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x187abb='',_0x591c21='';for(let _0x1d48bf=0x0,_0x340baf,_0x4f959f,_0x5a1194=0x0;_0x4f959f=_0x187903['charAt'](_0x5a1194++);~_0x4f959f&&(_0x340baf=_0x1d48bf%0x4?_0x340baf*0x40+_0x4f959f:_0x4f959f,_0x1d48bf++%0x4)?_0x187abb+=String['fromCharCode'](0xff&_0x340baf>>(-0x2*_0x1d48bf&0x6)):0x0){_0x4f959f=_0x4228ea['indexOf'](_0x4f959f);}for(let _0x17bac7=0x0,_0x5424b0=_0x187abb['length'];_0x17bac7<_0x5424b0;_0x17bac7++){_0x591c21+='%'+('00'+_0x187abb['charCodeAt'](_0x17bac7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x591c21);};_0x1652['yhhrGA']=_0x115ee9,_0x1652['nvWlvl']={},_0x1652['qeRrCm']=!![];}const _0x3e5f2f=_0x321569[0x0];_0x1652['KgDiaS']!==_0x3e5f2f&&(_0x1652['nvWlvl']={},_0x1652['KgDiaS']=_0x3e5f2f);const _0x27a391=_0x1652['nvWlvl'][_0x1bca2b];return _0x27a391===undefined?(_0x165217=_0x1652['yhhrGA'](_0x165217),_0x1652['nvWlvl'][_0x1bca2b]=_0x165217):_0x165217=_0x27a391,_0x165217;}function createKtFsStores(_0x20779d){const _0x157377=_0x51bfbd,_0x370a4d=createFsArtifactStore(resolveRoot(_0x20779d[_0x157377(0xb4)],_0x20779d['cwd']),_0x20779d[_0x157377(0x7b)]),_0x1af294=_0x20779d[_0x157377(0x90)]?createFsInstanceStore(resolveRoot(_0x20779d[_0x157377(0x90)],_0x20779d['cwd']),_0x20779d['seedInstances']):void 0x0,_0x3264c1=_0x20779d['versionsRoot']?createFsVersionStore(resolveRoot(_0x20779d[_0x157377(0x9b)],_0x20779d[_0x157377(0xa3)]),_0x370a4d):void 0x0;return{'artifacts':_0x370a4d,'instances':_0x1af294,'versions':_0x3264c1};}export{createKtFsStores};
1
+ const _0x3094ce=_0x6f1c;(function(_0x9b06cf,_0x252bbb){const _0x10fcc9=_0x6f1c,_0x96d6da=_0x9b06cf();while(!![]){try{const _0x5df160=parseInt(_0x10fcc9(0x21c))/0x1+parseInt(_0x10fcc9(0x1f9))/0x2*(parseInt(_0x10fcc9(0x1ff))/0x3)+parseInt(_0x10fcc9(0x20a))/0x4+parseInt(_0x10fcc9(0x1fb))/0x5+parseInt(_0x10fcc9(0x1fa))/0x6*(parseInt(_0x10fcc9(0x1fe))/0x7)+parseInt(_0x10fcc9(0x219))/0x8*(-parseInt(_0x10fcc9(0x218))/0x9)+parseInt(_0x10fcc9(0x220))/0xa*(-parseInt(_0x10fcc9(0x1e3))/0xb);if(_0x5df160===_0x252bbb)break;else _0x96d6da['push'](_0x96d6da['shift']());}catch(_0x1c2754){_0x96d6da['push'](_0x96d6da['shift']());}}}(_0x7de7,0x67cc2));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(_0x5e0302,_0x47dfae=process[_0x3094ce(0x205)]()){const _0x1b17c8=isAbsolute(_0x5e0302)?_0x5e0302:resolve(_0x47dfae,_0x5e0302);return mkdirSync(_0x1b17c8,{'recursive':!![]}),_0x1b17c8;}function artifactDir(_0x24f9e4,_0x382247){return join(_0x24f9e4,_0x382247);}function _0x7de7(){const _0x17d64c=['zgvJB2rL','mZe3ndiWrxvxC2XW','zMLUza','CMv2','B2jQzwn0CW','C29YDa','z2v0tw9UDgG','DMfSDwvZ','ChvZAa','Dg9tDhjPBMC','Aw5ZDc0','yxj0AwzHy3rjza','Bg9NlMPZB24','DMvYC2LVBNnsB290','AxneAxjLy3rVCNK','mJi4nZG5u011terZ','mJaWsuHLuM11','BM93','z2v0','nZa2mdmXr2r6C1Dg','BwfW','sevbra','A2LUza','ndC3nZCWvwrqtenx','CMvHzezPBgu','y29TBw9U','C3rYAw5NAwz5','C3rYAw5N','5OgI5Asn6iEQia','zgLNzxn0','lMPZB24','lwXVy2fSlq','mJa5BKDkA1rU','zNjVBq','CMfUzg9T','Bwv0yq','zw5KC1DPDgG','z2v0rgf0zq','BM90zq','zw50CMLLCW','zMLSzxm','Dg9ju09tDhjPBMC','Aw5ZDgfUy2vZuM9VDa','AgvHza','CMv2ia','DgfIq29TBw9U','C2XPy2u','DxrMoa','yxj0AwzHy3rZuM9VDa','DxbKyxrL','AM9PBG','z2v0sg91CNm','C2HHmJu2','zxrHzW','ndeWnZa4uePrrMPk','mJmZnfjuuMn2EG','nJyYnda1EuXXzKXr','CgfYC2u','CgfKu3rHCNq','nZGXovDlDvn6vq','ovv6AgjmyG','zMLSDgvY','AxrLBxm','DhjPBq','y29TBwL0','C2f2zq','y3DK','BMfTzq','lMv0ywC','z2v0rNvSBfLLyxi'];_0x7de7=function(){return _0x17d64c;};return _0x7de7();}function objectPath(_0x260a78,_0x34c2f0){const _0x1e8a0d=_0x3094ce;return join(_0x260a78,_0x1e8a0d(0x20d),_0x34c2f0[_0x1e8a0d(0x1f1)](0x0,0x2),_0x34c2f0);}function itemDir(_0x28ef4a,_0x29f3c1,_0x5f43cc){const _0x1c37a5=_0x3094ce;return join(_0x28ef4a,_0x1c37a5(0x201),_0x29f3c1,_0x5f43cc);}function newEtag(){const _0x577113=_0x3094ce;return Date[_0x577113(0x21a)]()['toString'](0x24)+'-'+Math[_0x577113(0x1e5)]()[_0x577113(0x212)](0x24)[_0x577113(0x1f1)](0x2,0x8);}function readEtag(_0x12090b){const _0x49133d=join(_0x12090b,'.etag');return existsSync(_0x49133d)?readFileSync(_0x49133d,'utf8')['trim']():void 0x0;}function writeArtifactDir(_0x1bb59a,_0x2a0b24,_0x195b67){const _0x4e34df=_0x3094ce;mkdirSync(join(_0x1bb59a,'faces'),{'recursive':!![]});const _0x91c229=artifactToFiles(_0x2a0b24);writeFileSync(join(_0x1bb59a,ARTIFACT_FILE_META),_0x91c229[ARTIFACT_FILE_META]??'{}',_0x4e34df(0x1f2)),writeFileSync(join(_0x1bb59a,ARTIFACT_FILE_BODY),_0x91c229[ARTIFACT_FILE_BODY]??'','utf8');const _0x377b72=join(_0x1bb59a,ARTIFACT_FILE_FILL),_0x30f4ba=join(_0x1bb59a,ARTIFACT_FILE_REPORT);if(_0x91c229[ARTIFACT_FILE_FILL])writeFileSync(_0x377b72,_0x91c229[ARTIFACT_FILE_FILL],_0x4e34df(0x1f2));else{if(existsSync(_0x377b72))rmSync(_0x377b72);}if(_0x91c229[ARTIFACT_FILE_REPORT])writeFileSync(_0x30f4ba,_0x91c229[ARTIFACT_FILE_REPORT],_0x4e34df(0x1f2));else{if(existsSync(_0x30f4ba))rmSync(_0x30f4ba);}writeFileSync(join(_0x1bb59a,_0x4e34df(0x207)),_0x195b67,_0x4e34df(0x1f2));}function readArtifactDir(_0x1a2a3f,_0x1990e0){const _0x2c7a7a=_0x3094ce,_0x16065f={},_0x536717=join(_0x1a2a3f,ARTIFACT_FILE_META),_0x186622=join(_0x1a2a3f,ARTIFACT_FILE_BODY);if(existsSync(_0x536717))_0x16065f[ARTIFACT_FILE_META]=readFileSync(_0x536717,_0x2c7a7a(0x1f2));if(existsSync(_0x186622))_0x16065f[ARTIFACT_FILE_BODY]=readFileSync(_0x186622,_0x2c7a7a(0x1f2));const _0x352075=join(_0x1a2a3f,ARTIFACT_FILE_FILL),_0x50095d=join(_0x1a2a3f,ARTIFACT_FILE_REPORT);if(existsSync(_0x352075))_0x16065f[ARTIFACT_FILE_FILL]=readFileSync(_0x352075,'utf8');if(existsSync(_0x50095d))_0x16065f[ARTIFACT_FILE_REPORT]=readFileSync(_0x50095d,'utf8');return{...filesToArtifact(_0x16065f,_0x1990e0),'etag':readEtag(_0x1a2a3f)};}function createFsArtifactStore(_0x34337d,_0x2a176a=[]){const _0x110bfd=_0x3094ce;mkdirSync(_0x34337d,{'recursive':!![]});for(const _0x48f572 of _0x2a176a){const _0x18eedd=artifactDir(_0x34337d,_0x48f572['id']),_0xaca0a2=join(_0x18eedd,ARTIFACT_FILE_BODY);if(!existsSync(_0xaca0a2))writeArtifactDir(_0x18eedd,_0x48f572,_0x48f572[_0x110bfd(0x1f8)]??newEtag());}return{async 'list'(_0x415b6a){const _0x1ff934=_0x110bfd;if(!existsSync(_0x34337d))return[];const _0x4e0476=[];for(const _0x576f2 of readdirSync(_0x34337d,{'withFileTypes':!![]})){if(!_0x576f2['isDirectory']())continue;try{const _0x49394e=readArtifactDir(artifactDir(_0x34337d,_0x576f2[_0x1ff934(0x206)]),_0x576f2[_0x1ff934(0x206)]);if(!_0x415b6a||_0x49394e[_0x1ff934(0x21f)]===_0x415b6a)_0x4e0476[_0x1ff934(0x211)]({'id':_0x49394e['id'],'name':_0x49394e[_0x1ff934(0x206)],'kind':_0x49394e[_0x1ff934(0x21f)]});}catch{}}return _0x4e0476;},async 'get'(_0x11518e){const _0x31ebb3=artifactDir(_0x34337d,_0x11518e);if(!existsSync(_0x31ebb3))throw new KtNotFoundError('artifact\x20'+_0x11518e);return readArtifactDir(_0x31ebb3,_0x11518e);},async 'save'(_0x1d4712){const _0x5cc7a7=_0x110bfd,_0x4687e2=artifactDir(_0x34337d,_0x1d4712['id']),_0x5d6f10=existsSync(_0x4687e2)?readArtifactDir(_0x4687e2,_0x1d4712['id']):void 0x0;if(_0x1d4712[_0x5cc7a7(0x1f8)]&&_0x5d6f10?.['etag']&&_0x1d4712[_0x5cc7a7(0x1f8)]!==_0x5d6f10[_0x5cc7a7(0x1f8)])throw new KtConflictError('\u5DE5\u4F5C\u526F\u672C\u5DF2\u53D8\u66F4',_0x5d6f10);const _0x5056d7=newEtag();return writeArtifactDir(_0x4687e2,_0x1d4712,_0x5056d7),{..._0x1d4712,'etag':_0x5056d7};},async 'create'(_0x594a0e){const _0x2ec2d8=_0x110bfd,_0x17f85c=_0x594a0e['kind']+'-'+Math[_0x2ec2d8(0x1e5)]()['toString'](0x24)[_0x2ec2d8(0x1f1)](0x2,0xa),_0x52fadb={'id':_0x17f85c,'name':_0x594a0e[_0x2ec2d8(0x206)],'kind':_0x594a0e['kind'],'ktl':EMPTY_KTL};return this['save'](_0x52fadb);},async 'remove'(_0x3e5545){const _0x5a016f=artifactDir(_0x34337d,_0x3e5545);if(!existsSync(_0x5a016f))throw new KtNotFoundError('artifact\x20'+_0x3e5545);rmSync(_0x5a016f,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x5e3e90,_0x49165c={}){const _0x156eeb=_0x3094ce;mkdirSync(_0x5e3e90,{'recursive':!![]});const _0x57e1da=_0x3761cc=>join(_0x5e3e90,_0x3761cc+_0x156eeb(0x1e1));for(const [_0x2a7fec,_0x2a5a70]of Object[_0x156eeb(0x1ea)](_0x49165c)){if(!existsSync(_0x57e1da(_0x2a7fec)))writeFileSync(_0x57e1da(_0x2a7fec),JSON[_0x156eeb(0x223)](_0x2a5a70,null,0x2),_0x156eeb(0x1f2));}return{async 'get'(_0x29341){const _0x29eb4e=_0x156eeb,_0xafa0a9=_0x57e1da(_0x29341);if(!existsSync(_0xafa0a9))throw new KtNotFoundError('instance\x20'+_0x29341);return JSON[_0x29eb4e(0x1fc)](readFileSync(_0xafa0a9,_0x29eb4e(0x1f2)));},async 'save'(_0x5676e8,_0x30db77){const _0x235b89=_0x156eeb,_0x41064e=_0x57e1da(_0x5676e8),_0x38afd1=existsSync(_0x41064e)?JSON[_0x235b89(0x1fc)](readFileSync(_0x41064e,_0x235b89(0x1f2))):{'artifactId':'','values':{}},_0x5f4489={'artifactId':_0x38afd1[_0x235b89(0x214)],'values':{..._0x38afd1[_0x235b89(0x210)],..._0x30db77[_0x235b89(0x210)]},'common':{..._0x38afd1[_0x235b89(0x222)],..._0x30db77[_0x235b89(0x222)]},'tabCommon':{..._0x38afd1[_0x235b89(0x1f0)],..._0x30db77[_0x235b89(0x1f0)]}};writeFileSync(_0x41064e,JSON[_0x235b89(0x223)](_0x5f4489,null,0x2),_0x235b89(0x1f2));},async 'list'(_0x522b43){const _0x3ae6a8=_0x156eeb;return readdirSync(_0x5e3e90)[_0x3ae6a8(0x200)](_0x3f6a23=>_0x3f6a23[_0x3ae6a8(0x1e7)](_0x3ae6a8(0x1e1)))[_0x3ae6a8(0x21d)](_0x33ebfc=>{const _0xce321d=_0x3ae6a8,_0x408324=_0x33ebfc[_0xce321d(0x1f1)](0x0,-0x5),_0x5f26b6=JSON['parse'](readFileSync(join(_0x5e3e90,_0x33ebfc),'utf8'));return{'id':_0x408324,'artifactId':_0x5f26b6['artifactId']};})[_0x3ae6a8(0x200)](_0x3c4046=>!_0x522b43||_0x3c4046['artifactId']===_0x522b43);},async 'create'(_0x161282){const _0x3efa68=_0x156eeb,_0x16ee77=_0x3efa68(0x213)+Math[_0x3efa68(0x1e5)]()[_0x3efa68(0x212)](0x24)[_0x3efa68(0x1f1)](0x2,0xa);return writeFileSync(_0x57e1da(_0x16ee77),JSON[_0x3efa68(0x223)]({'artifactId':_0x161282[_0x3efa68(0x214)],'values':{},'common':{}},null,0x2),_0x3efa68(0x1f2)),{'id':_0x16ee77};}};}function _0x6f1c(_0x139e93,_0x1f5010){_0x139e93=_0x139e93-0x1de;const _0x7de71f=_0x7de7();let _0x6f1c83=_0x7de71f[_0x139e93];if(_0x6f1c['WTzKab']===undefined){var _0x2350cd=function(_0x57c60f){const _0x29d141='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1398db='',_0x5e0302='';for(let _0x47dfae=0x0,_0x1b17c8,_0x24f9e4,_0x382247=0x0;_0x24f9e4=_0x57c60f['charAt'](_0x382247++);~_0x24f9e4&&(_0x1b17c8=_0x47dfae%0x4?_0x1b17c8*0x40+_0x24f9e4:_0x24f9e4,_0x47dfae++%0x4)?_0x1398db+=String['fromCharCode'](0xff&_0x1b17c8>>(-0x2*_0x47dfae&0x6)):0x0){_0x24f9e4=_0x29d141['indexOf'](_0x24f9e4);}for(let _0x260a78=0x0,_0x34c2f0=_0x1398db['length'];_0x260a78<_0x34c2f0;_0x260a78++){_0x5e0302+='%'+('00'+_0x1398db['charCodeAt'](_0x260a78)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5e0302);};_0x6f1c['hdLxUX']=_0x2350cd,_0x6f1c['WTXXgL']={},_0x6f1c['WTzKab']=!![];}const _0x20e693=_0x7de71f[0x0];_0x6f1c['NHzoUW']!==_0x20e693&&(_0x6f1c['WTXXgL']={},_0x6f1c['NHzoUW']=_0x20e693);const _0x247320=_0x6f1c['WTXXgL'][_0x139e93];return _0x247320===undefined?(_0x6f1c83=_0x6f1c['hdLxUX'](_0x6f1c83),_0x6f1c['WTXXgL'][_0x139e93]=_0x6f1c83):_0x6f1c83=_0x247320,_0x6f1c83;}function sha256Hex(_0x2f2264){const _0x457fe3=_0x3094ce,_0x37eab3=typeof _0x2f2264==='string'?Buffer[_0x457fe3(0x1e4)](_0x2f2264,_0x457fe3(0x1f2)):Buffer[_0x457fe3(0x1e4)](_0x2f2264);return createHash(_0x457fe3(0x1f7))[_0x457fe3(0x1f4)](_0x37eab3)[_0x457fe3(0x1e0)]('hex');}function writeObject(_0x5dee77,_0x1978ab){const _0x389191=sha256Hex(_0x1978ab),_0x568a3b=objectPath(_0x5dee77,_0x389191);mkdirSync(dirname(_0x568a3b),{'recursive':!![]});if(!existsSync(_0x568a3b))writeFileSync(_0x568a3b,_0x1978ab);return _0x389191;}function readLog(_0x2fa876,_0x131af3,_0x21ef0a){const _0x2aa3be=_0x3094ce,_0x3827e8=itemDir(_0x2fa876,_0x131af3,_0x21ef0a),_0x590449=join(_0x3827e8,_0x2aa3be(0x215)),_0x14da8d=join(_0x3827e8,_0x2aa3be(0x21e)),_0x1c3aaf=existsSync(_0x590449)?JSON[_0x2aa3be(0x1fc)](readFileSync(_0x590449,'utf8')):[],_0x31f426=existsSync(_0x14da8d)?readFileSync(_0x14da8d,_0x2aa3be(0x1f2))[_0x2aa3be(0x202)]():_0x1c3aaf['at'](-0x1)?.['rev']??null;return{'head':_0x31f426,'items':_0x1c3aaf};}function writeLog(_0x231658,_0x1b57ea,_0x3b2dab,_0x2d2381,_0x49ff74){const _0x100e29=_0x3094ce,_0x47eb43=itemDir(_0x231658,_0x1b57ea,_0x3b2dab);mkdirSync(_0x47eb43,{'recursive':!![]}),writeFileSync(join(_0x47eb43,_0x100e29(0x215)),JSON['stringify'](_0x49ff74,null,0x2),_0x100e29(0x1f2)),writeFileSync(join(_0x47eb43,'HEAD'),_0x2d2381+'\x0a','utf8');}function findRev(_0x4d68b9,_0x55cc44){const _0x450fd6=_0x3094ce,_0x21377f=join(_0x4d68b9,_0x450fd6(0x201));if(!existsSync(_0x21377f))return void 0x0;for(const _0x557a78 of readdirSync(_0x21377f,{'withFileTypes':!![]})){if(!_0x557a78[_0x450fd6(0x217)]())continue;for(const _0x2b22e7 of readdirSync(join(_0x21377f,_0x557a78['name']),{'withFileTypes':!![]})){if(!_0x2b22e7['isDirectory']())continue;const _0x250fde=readLog(_0x4d68b9,_0x557a78[_0x450fd6(0x206)],_0x2b22e7['name'])[_0x450fd6(0x201)]['find'](_0x48c1b8=>_0x48c1b8[_0x450fd6(0x20c)]===_0x55cc44);if(_0x250fde)return _0x250fde;}}return void 0x0;}function filesTextOf(_0x4a0256,_0x2f462b){const _0x5c4c57=_0x3094ce,_0x1131c7={};for(const [_0x12cf7f,_0x6740d9]of Object['entries'](_0x2f462b[_0x5c4c57(0x1eb)])){const _0x278a06=objectPath(_0x4a0256,_0x6740d9);if(existsSync(_0x278a06))_0x1131c7[_0x12cf7f]=readFileSync(_0x278a06,'utf8');}return _0x1131c7;}function createFsVersionStore(_0x5ec914,_0x2b12ed){return mkdirSync(_0x5ec914,{'recursive':!![]}),{async 'log'(_0x313641,_0x39639f){const _0x1a4ac6=_0x6f1c,{head:_0x3d202b,items:_0x22fe51}=readLog(_0x5ec914,_0x313641,_0x39639f);return{'head':_0x3d202b,'items':[..._0x22fe51][_0x1a4ac6(0x20e)]((_0x283be1,_0x5e5131)=>_0x283be1['at']<_0x5e5131['at']?0x1:-0x1)};},async 'get'(_0x4c1955){const _0x10fab6=_0x6f1c,_0x49e1bf=findRev(_0x5ec914,_0x4c1955);if(!_0x49e1bf)throw new KtNotFoundError(_0x10fab6(0x1ef)+_0x4c1955);return _0x49e1bf;},async 'readFile'(_0x4fa07b,_0x1d8fab){const _0x540099=_0x6f1c,_0x100157=await this[_0x540099(0x21b)](_0x4fa07b),_0x21b0a2=_0x100157['files'][_0x1d8fab];if(!_0x21b0a2)throw new KtNotFoundError(_0x1d8fab);const _0x22fe7f=objectPath(_0x5ec914,_0x21b0a2);if(!existsSync(_0x22fe7f))throw new KtNotFoundError(_0x1d8fab);return new Uint8Array(readFileSync(_0x22fe7f));},async 'commit'(_0x38e6fa){const _0x45b31b=_0x6f1c;let _0x143cf7=_0x38e6fa[_0x45b31b(0x1eb)];if(!_0x143cf7){const _0x56d553=await _0x2b12ed[_0x45b31b(0x21b)](_0x38e6fa['id']);_0x143cf7=artifactToFiles(_0x56d553);}const _0x3ec1bb={},_0x3ffcce={};for(const [_0x5ce231,_0x2aa720]of Object[_0x45b31b(0x1ea)](_0x143cf7)){const _0x3b9d94=typeof _0x2aa720===_0x45b31b(0x1de)?_0x2aa720:new TextDecoder()[_0x45b31b(0x209)](_0x2aa720);_0x3ec1bb[_0x5ce231]=_0x3b9d94,_0x3ffcce[_0x5ce231]=writeObject(_0x5ec914,typeof _0x2aa720===_0x45b31b(0x1de)?Buffer['from'](_0x2aa720,'utf8'):_0x2aa720);}const _0x3f3586=readLog(_0x5ec914,_0x38e6fa[_0x45b31b(0x21f)],_0x38e6fa['id']);if(_0x3f3586[_0x45b31b(0x1ee)]){const _0x4a2e36=_0x3f3586['items'][_0x45b31b(0x20b)](_0x48eebd=>_0x48eebd['rev']===_0x3f3586[_0x45b31b(0x1ee)]);if(_0x4a2e36&&filesEqual(_0x3ec1bb,filesTextOf(_0x5ec914,_0x4a2e36)))return _0x4a2e36;}const _0x86dd2c=new Date(),_0x1cc720=String(_0x86dd2c[_0x45b31b(0x208)]())['slice'](0x2)+String(_0x86dd2c[_0x45b31b(0x20f)]()+0x1)['padStart'](0x2,'0')+String(_0x86dd2c[_0x45b31b(0x1e8)]())[_0x45b31b(0x1fd)](0x2,'0')+String(_0x86dd2c[_0x45b31b(0x1f6)]())[_0x45b31b(0x1fd)](0x2,'0')+String(_0x86dd2c['getMinutes']())[_0x45b31b(0x1fd)](0x2,'0'),_0x43e1f2=sha256Hex(Object[_0x45b31b(0x210)](_0x3ffcce)[_0x45b31b(0x20e)]()[_0x45b31b(0x1f5)](','))[_0x45b31b(0x1f1)](0x0,0x8),_0x18419a={'rev':_0x1cc720+_0x45b31b(0x1e2)+_0x43e1f2,'kind':_0x38e6fa['kind'],'id':_0x38e6fa['id'],'at':_0x86dd2c[_0x45b31b(0x1ec)](),'parent':_0x3f3586[_0x45b31b(0x1ee)],'by':_0x38e6fa['by'],'note':_0x38e6fa[_0x45b31b(0x1e9)],'files':_0x3ffcce,'meta':_0x38e6fa[_0x45b31b(0x1e6)]};return writeLog(_0x5ec914,_0x38e6fa[_0x45b31b(0x21f)],_0x38e6fa['id'],_0x18419a[_0x45b31b(0x20c)],[..._0x3f3586[_0x45b31b(0x201)],_0x18419a]),_0x18419a;},async 'restore'(_0x48a483,_0x4804fa,_0x5db768,_0x2e128e){const _0x314612=_0x6f1c,_0x130353=await this[_0x314612(0x21b)](_0x5db768),_0x8543a5={};for(const _0x535866 of Object['keys'](_0x130353[_0x314612(0x1eb)])){_0x8543a5[_0x535866]=new TextDecoder()[_0x314612(0x209)](await this[_0x314612(0x221)](_0x5db768,_0x535866));}const _0x466a02=filesToArtifact(_0x8543a5,_0x4804fa);return await _0x2b12ed[_0x314612(0x204)]({..._0x466a02,'id':_0x4804fa,'kind':_0x466a02[_0x314612(0x21f)],'etag':void 0x0}),this[_0x314612(0x203)]({'kind':_0x48a483,'id':_0x4804fa,'files':_0x8543a5,'by':_0x2e128e,'note':_0x314612(0x1df)+_0x5db768});}};}function createKtFsStores(_0x49f5d7){const _0x5011c6=_0x3094ce,_0x59e926=createFsArtifactStore(resolveRoot(_0x49f5d7[_0x5011c6(0x1f3)],_0x49f5d7[_0x5011c6(0x205)]),_0x49f5d7['seed']),_0x389d8c=_0x49f5d7[_0x5011c6(0x1ed)]?createFsInstanceStore(resolveRoot(_0x49f5d7[_0x5011c6(0x1ed)],_0x49f5d7['cwd']),_0x49f5d7['seedInstances']):void 0x0,_0x298d4c=_0x49f5d7[_0x5011c6(0x216)]?createFsVersionStore(resolveRoot(_0x49f5d7['versionsRoot'],_0x49f5d7[_0x5011c6(0x205)]),_0x59e926):void 0x0;return{'artifacts':_0x59e926,'instances':_0x389d8c,'versions':_0x298d4c};}export{createKtFsStores};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';const _0x3b8471=_0x42b9;function _0x42b9(_0xb29486,_0x4fa94c){_0xb29486=_0xb29486-0xf0;const _0x1a489d=_0x1a48();let _0x42b902=_0x1a489d[_0xb29486];if(_0x42b9['XShlSM']===undefined){var _0x58d814=function(_0x381407){const _0x41b7c4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x333f12='',_0x34d143='';for(let _0x2ed987=0x0,_0x3351ea,_0x204ce0,_0xfa9338=0x0;_0x204ce0=_0x381407['charAt'](_0xfa9338++);~_0x204ce0&&(_0x3351ea=_0x2ed987%0x4?_0x3351ea*0x40+_0x204ce0:_0x204ce0,_0x2ed987++%0x4)?_0x333f12+=String['fromCharCode'](0xff&_0x3351ea>>(-0x2*_0x2ed987&0x6)):0x0){_0x204ce0=_0x41b7c4['indexOf'](_0x204ce0);}for(let _0x4a9fb4=0x0,_0x355d2c=_0x333f12['length'];_0x4a9fb4<_0x355d2c;_0x4a9fb4++){_0x34d143+='%'+('00'+_0x333f12['charCodeAt'](_0x4a9fb4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x34d143);};_0x42b9['IOHzyl']=_0x58d814,_0x42b9['efdZqi']={},_0x42b9['XShlSM']=!![];}const _0x58a296=_0x1a489d[0x0];_0x42b9['eeeCxD']!==_0x58a296&&(_0x42b9['efdZqi']={},_0x42b9['eeeCxD']=_0x58a296);const _0x2d500a=_0x42b9['efdZqi'][_0xb29486];return _0x2d500a===undefined?(_0x42b902=_0x42b9['IOHzyl'](_0x42b902),_0x42b9['efdZqi'][_0xb29486]=_0x42b902):_0x42b902=_0x2d500a,_0x42b902;}(function(_0x1706be,_0x564de9){const _0x75055e=_0x42b9,_0x2b3d39=_0x1706be();while(!![]){try{const _0x4de46e=parseInt(_0x75055e(0x11a))/0x1*(parseInt(_0x75055e(0x10e))/0x2)+-parseInt(_0x75055e(0x105))/0x3*(parseInt(_0x75055e(0xf6))/0x4)+-parseInt(_0x75055e(0xf5))/0x5*(-parseInt(_0x75055e(0x118))/0x6)+-parseInt(_0x75055e(0x108))/0x7*(parseInt(_0x75055e(0xfc))/0x8)+parseInt(_0x75055e(0x125))/0x9*(-parseInt(_0x75055e(0xf4))/0xa)+parseInt(_0x75055e(0xf8))/0xb+-parseInt(_0x75055e(0x115))/0xc;if(_0x4de46e===_0x564de9)break;else _0x2b3d39['push'](_0x2b3d39['shift']());}catch(_0x199c32){_0x2b3d39['push'](_0x2b3d39['shift']());}}}(_0x1a48,0xc8bb7));var store=require('@k-table/report/store');async function pathParts(_0x34d143,_0x2ed987){const _0x9f0faa=_0x42b9,_0x3351ea=_0x34d143[_0x9f0faa(0xfd)]?await _0x34d143[_0x9f0faa(0xfd)]:void 0x0;if(_0x3351ea?.[_0x9f0faa(0x11b)]?.[_0x9f0faa(0x112)])return _0x3351ea[_0x9f0faa(0x11b)];const _0x204ce0=_0x2ed987[_0x9f0faa(0xf9)]['indexOf'](_0x9f0faa(0xf7)),_0xfa9338=_0x204ce0>=0x0?_0x2ed987[_0x9f0faa(0xf9)][_0x9f0faa(0x113)](_0x204ce0+_0x9f0faa(0xf7)['length']):_0x2ed987[_0x9f0faa(0xf9)];return _0xfa9338[_0x9f0faa(0x124)]('/')['filter'](Boolean);}function json(_0x4a9fb4,_0x355d2c=0xc8){const _0x1f6821=_0x42b9;return new Response(JSON[_0x1f6821(0x11e)](_0x4a9fb4),{'status':_0x355d2c,'headers':{'content-type':_0x1f6821(0x10c)}});}function _0x1a48(){const _0x3c2318=['y3jLyxrL','zNjVBq','r0vu','C3bSAxq','nde2mJG2oujXz2Dxwq','zMLSzq','A2LUza','yxj0AwzHy3rjza','DMvYC2LVBNmG5PYQ6ywn572U','BwvZC2fNzq','mtb2v1ziqvi','mtv3twLvtey','mZq3ndu2nhrSr3DHrW','l2fWAs9RDa','otC3odC4mef2whbdAa','Cgf0Ag5HBwu','z2v0','s3roB3rgB3vUzevYCM9Y','oe5xDhfYuG','CgfYyw1Z','Aw5ZDgfUy2vZ','CMvHzezPBgu','Bwv0Ag9K','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','DMvYC2LVBNm','CgfYC2u','CMvZDg9Yzq','m3HlyvzTwG','ue9tva','Dg9vChbLCKnHC2u','mJC1mZeXne5rwfvVwq','CMvTB3zL','y3jLyxrLioACQUwUNUEoSa','y29TBwL0','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','Bg9N','mtG4ntGYnM9Ts2POsG','Dgv4Da','C2f2zq','C3rHDhvZ','BgvUz3rO','C2XPy2u','C2vHCMnOugfYyw1Z','ndq2mZKXnMXPB3z6AG','5yAf6yoO6zsz6k+V','y3jLyxrLs3riyw5KBgvY','mJe3mZu2nNjnuKzKzq','s3rtDg9YzuvYCM9Y','mu9YrMDdqG','Cgf0Aa','Aw5ZDgfUy2vZioACQUMfJEE9RG','ufvu','C3rYAw5NAwz5','y3vYCMvUDa','yxj0AwzHy3rZ'];_0x1a48=function(){return _0x3c2318;};return _0x1a48();}function fail(_0x3be286){const _0xe272d9=_0x42b9;if(_0x3be286 instanceof store['KtConflictError'])return json({'message':_0x3be286[_0xe272d9(0xf3)],'current':_0x3be286[_0xe272d9(0x11f)]},0x199);if(_0x3be286 instanceof store[_0xe272d9(0xfb)])return json({'message':_0x3be286[_0xe272d9(0xf3)]},0x194);if(_0x3be286 instanceof store[_0xe272d9(0x119)])return json({'message':_0x3be286[_0xe272d9(0xf3)]},_0x3be286[_0xe272d9(0x111)]??0x1f4);return json({'message':_0x3be286 instanceof Error?_0x3be286[_0xe272d9(0xf3)]:_0xe272d9(0x116)},0x1f4);}async function readBody(_0x1612b0){const _0x59d432=_0x42b9,_0x5f01c2=await _0x1612b0[_0x59d432(0x10f)]();if(!_0x5f01c2)return null;return JSON[_0x59d432(0x103)](_0x5f01c2);}function createKtHandler(_0xff2681){const _0x1a1992=async(_0x2522eb,_0x5cdd76={})=>{const _0x2ddafa=_0x42b9;try{const _0x1199c8=new URL(_0x2522eb['url']),_0x2928cf=await pathParts(_0x5cdd76,_0x1199c8),[_0x5865ec,_0x27dc8b,_0x77a5f4]=_0x2928cf,_0x2202cd=_0x2522eb[_0x2ddafa(0x100)][_0x2ddafa(0x107)]();if(_0x5865ec==='artifacts'&&!_0x27dc8b&&_0x2202cd===_0x2ddafa(0x123)){const _0x2c8257=_0x1199c8[_0x2ddafa(0x114)][_0x2ddafa(0xfa)]('kind');return json({'items':await _0xff2681['artifacts']['list'](_0x2c8257||void 0x0)});}if(_0x5865ec===_0x2ddafa(0x120)&&!_0x27dc8b&&_0x2202cd===_0x2ddafa(0x106)){if(!_0xff2681[_0x2ddafa(0x120)][_0x2ddafa(0x121)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0xff2681[_0x2ddafa(0x120)][_0x2ddafa(0x121)](await readBody(_0x2522eb)));}if(_0x5865ec===_0x2ddafa(0x120)&&_0x27dc8b&&_0x2202cd===_0x2ddafa(0x123))return json(await _0xff2681[_0x2ddafa(0x120)]['get'](_0x27dc8b));if(_0x5865ec===_0x2ddafa(0x120)&&_0x27dc8b&&_0x2202cd===_0x2ddafa(0x11d))return json(await _0xff2681[_0x2ddafa(0x120)][_0x2ddafa(0x110)](await readBody(_0x2522eb)));if(_0x5865ec==='artifacts'&&_0x27dc8b&&_0x2202cd==='DELETE'){if(!_0xff2681[_0x2ddafa(0x120)][_0x2ddafa(0x109)])return json({'message':'remove\x20\u672A\u5B9E\u73B0'},0x194);return await _0xff2681[_0x2ddafa(0x120)][_0x2ddafa(0x109)](_0x27dc8b),json({'ok':!![]});}if(_0x5865ec===_0x2ddafa(0xfe)){if(!_0xff2681[_0x2ddafa(0xfe)])return json({'message':_0x2ddafa(0x11c)},0x194);if(!_0x27dc8b&&_0x2202cd===_0x2ddafa(0x123))return json({'items':await _0xff2681[_0x2ddafa(0xfe)]['list']?.(_0x1199c8[_0x2ddafa(0x114)][_0x2ddafa(0xfa)](_0x2ddafa(0xf1))??void 0x0)??[]});if(!_0x27dc8b&&_0x2202cd===_0x2ddafa(0x106)){if(!_0xff2681[_0x2ddafa(0xfe)][_0x2ddafa(0x121)])return json({'message':_0x2ddafa(0x10a)},0x194);return json(await _0xff2681[_0x2ddafa(0xfe)][_0x2ddafa(0x121)](await readBody(_0x2522eb)));}if(_0x27dc8b&&_0x2202cd===_0x2ddafa(0x123))return json(await _0xff2681['instances']['get'](_0x27dc8b));if(_0x27dc8b&&_0x2202cd===_0x2ddafa(0x11d))return await _0xff2681[_0x2ddafa(0xfe)][_0x2ddafa(0x110)](_0x27dc8b,await readBody(_0x2522eb)),json({'ok':!![]});}if(_0x5865ec==='versions'){if(!_0xff2681['versions'])return json({'message':_0x2ddafa(0xf2)},0x194);if(!_0x27dc8b&&_0x2202cd==='GET'){const _0x1532c1=_0x1199c8[_0x2ddafa(0x114)][_0x2ddafa(0xfa)](_0x2ddafa(0xf0))??'',_0x246cda=_0x1199c8[_0x2ddafa(0x114)][_0x2ddafa(0xfa)]('id')??'';return json(await _0xff2681[_0x2ddafa(0x102)][_0x2ddafa(0x10d)](_0x1532c1,_0x246cda));}if(!_0x27dc8b&&_0x2202cd==='POST')return json(await _0xff2681[_0x2ddafa(0x102)][_0x2ddafa(0x10b)](await readBody(_0x2522eb)));if(_0x27dc8b&&_0x77a5f4===_0x2ddafa(0x126)&&_0x2202cd==='GET'){const _0x14dc90=await _0xff2681[_0x2ddafa(0x102)][_0x2ddafa(0xff)](_0x27dc8b,_0x1199c8['searchParams'][_0x2ddafa(0xfa)](_0x2ddafa(0x11b))??'');return new Response(Buffer[_0x2ddafa(0x122)](_0x14dc90),{'headers':{'content-type':_0x2ddafa(0x101)}});}if(_0x27dc8b&&_0x77a5f4===_0x2ddafa(0x104)&&_0x2202cd===_0x2ddafa(0x106)){const _0x2928d8=await readBody(_0x2522eb);return json(await _0xff2681[_0x2ddafa(0x102)]['restore'](_0x2928d8[_0x2ddafa(0xf0)],_0x2928d8['id'],_0x27dc8b,_0x2928d8['by']));}if(_0x27dc8b&&!_0x77a5f4&&_0x2202cd===_0x2ddafa(0x123))return json(await _0xff2681[_0x2ddafa(0x102)]['get'](_0x27dc8b));}return json({'message':'\u672A\u627E\u5230'},0x194);}catch(_0x33f80e){return fail(_0x33f80e);}};return{'GET':_0x1a1992,'POST':_0x1a1992,'PUT':_0x1a1992,'DELETE':_0x1a1992};}function defineKtConfig(_0x126018){return _0x126018;}exports[_0x3b8471(0x117)]=createKtHandler,exports['defineKtConfig']=defineKtConfig;
1
+ 'use strict';const _0x381fac=_0x4343;(function(_0x20b5b2,_0x5ce16f){const _0x1d9919=_0x4343,_0x146f9f=_0x20b5b2();while(!![]){try{const _0x3de689=-parseInt(_0x1d9919(0x219))/0x1*(parseInt(_0x1d9919(0x21e))/0x2)+parseInt(_0x1d9919(0x204))/0x3+parseInt(_0x1d9919(0x20c))/0x4*(parseInt(_0x1d9919(0x202))/0x5)+-parseInt(_0x1d9919(0x1f6))/0x6+parseInt(_0x1d9919(0x21c))/0x7*(parseInt(_0x1d9919(0x1f8))/0x8)+-parseInt(_0x1d9919(0x210))/0x9+parseInt(_0x1d9919(0x1ee))/0xa;if(_0x3de689===_0x5ce16f)break;else _0x146f9f['push'](_0x146f9f['shift']());}catch(_0x62ecd4){_0x146f9f['push'](_0x146f9f['shift']());}}}(_0xe3f9,0xee2a0));function _0x4343(_0x228f12,_0x3abb3b){_0x228f12=_0x228f12-0x1ec;const _0xe3f970=_0xe3f9();let _0x434316=_0xe3f970[_0x228f12];if(_0x4343['eGnoOZ']===undefined){var _0x48e279=function(_0x28ce46){const _0x1bc62e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5054a1='',_0x5f4ac8='';for(let _0x2f8b7a=0x0,_0x5c776f,_0x4ca56e,_0x571336=0x0;_0x4ca56e=_0x28ce46['charAt'](_0x571336++);~_0x4ca56e&&(_0x5c776f=_0x2f8b7a%0x4?_0x5c776f*0x40+_0x4ca56e:_0x4ca56e,_0x2f8b7a++%0x4)?_0x5054a1+=String['fromCharCode'](0xff&_0x5c776f>>(-0x2*_0x2f8b7a&0x6)):0x0){_0x4ca56e=_0x1bc62e['indexOf'](_0x4ca56e);}for(let _0x403a12=0x0,_0x7ba960=_0x5054a1['length'];_0x403a12<_0x7ba960;_0x403a12++){_0x5f4ac8+='%'+('00'+_0x5054a1['charCodeAt'](_0x403a12)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5f4ac8);};_0x4343['IAxqFm']=_0x48e279,_0x4343['uRzLvZ']={},_0x4343['eGnoOZ']=!![];}const _0x3d90b0=_0xe3f970[0x0];_0x4343['RDdWkf']!==_0x3d90b0&&(_0x4343['uRzLvZ']={},_0x4343['RDdWkf']=_0x3d90b0);const _0x5ef3e9=_0x4343['uRzLvZ'][_0x228f12];return _0x5ef3e9===undefined?(_0x434316=_0x4343['IAxqFm'](_0x434316),_0x4343['uRzLvZ'][_0x228f12]=_0x434316):_0x434316=_0x5ef3e9,_0x434316;}var store=require('@k-table/report/store');function _0xe3f9(){const _0x9da6f9=['yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','z2v0','C2vHCMnOugfYyw1Z','zMLSDgvY','nZzpDwrzAgC','5PYQ5OM+5yIW','C3rYAw5NAwz5','BgLZDa','nZu4mJqZn2zwt0P2CW','CMvHzezPBgu','CgfYC2u','l2fWAs9RDa','Aw5KzxHpzG','BwvZC2fNzq','zgvMAw5Ls3rdB25MAwC','DMvYC2LVBNm','CMvZDg9Yzq','mJu3CeTTze5z','5yAf6yoO6zsz6k+V','Aw5ZDgfUy2vZ','ndC2qvPHDhny','C2XPy2u','nJGZohfbBwnLuG','Dg9vChbLCKnHC2u','Dgv4Da','CMvTB3zLioACQUwUNUEoSa','C2f2zq','ndK5nJu4mgHpA3rsAG','Cgf0Ag5HBwu','ue9tva','yxj0AwzHy3rZ','s3rtDg9YzuvYCM9Y','CgfYyw1Z','A2LUza','y3jLyxrLioACQUwUNUEoSa','nde0mdy0mNPUzg1Pra','ufvu','mZC3odrfEejWu1u','CMvTB3zL','zMLSzq','C3rHDhvZ','s3rdB25MBgLJDevYCM9Y','y3vYCMvUDa','y3jLyxrL','s3roB3rgB3vUzevYCM9Y','C3bSAxq','DxjS','mJe1nJC1uM96zNvT','Cgf0Aa','ntiZoti0ofriu1PXrW','Aw5ZDgfUy2vZioACQUMfJEE9RG','r0vu','y29TBwL0'];_0xe3f9=function(){return _0x9da6f9;};return _0xe3f9();}async function pathParts(_0x5f4ac8,_0x2f8b7a){const _0x54247a=_0x4343,_0x5c776f=_0x5f4ac8['params']?await _0x5f4ac8[_0x54247a(0x1f3)]:void 0x0;if(_0x5c776f?.['path']?.['length'])return _0x5c776f[_0x54247a(0x203)];const _0x4ca56e=_0x2f8b7a['pathname'][_0x54247a(0x214)](_0x54247a(0x213)),_0x571336=_0x4ca56e>=0x0?_0x2f8b7a[_0x54247a(0x1ef)][_0x54247a(0x21d)](_0x4ca56e+_0x54247a(0x213)['length']):_0x2f8b7a[_0x54247a(0x1ef)];return _0x571336[_0x54247a(0x200)]('/')[_0x54247a(0x20b)](Boolean);}function json(_0x403a12,_0x7ba960=0xc8){const _0x28813c=_0x4343;return new Response(JSON[_0x28813c(0x20e)](_0x403a12),{'status':_0x7ba960,'headers':{'content-type':_0x28813c(0x208)}});}function fail(_0x788c2d){const _0x284c82=_0x4343;if(_0x788c2d instanceof store[_0x284c82(0x1fc)])return json({'message':_0x788c2d['message'],'current':_0x788c2d[_0x284c82(0x1fd)]},0x199);if(_0x788c2d instanceof store[_0x284c82(0x1ff)])return json({'message':_0x788c2d['message']},0x194);if(_0x788c2d instanceof store[_0x284c82(0x1f2)])return json({'message':_0x788c2d[_0x284c82(0x215)]},_0x788c2d[_0x284c82(0x1fb)]??0x1f4);return json({'message':_0x788c2d instanceof Error?_0x788c2d[_0x284c82(0x215)]:_0x284c82(0x21a)},0x1f4);}async function readBody(_0x24829b){const _0x37e8fa=_0x4343,_0x5a6835=await _0x24829b[_0x37e8fa(0x220)]();if(!_0x5a6835)return null;return JSON[_0x37e8fa(0x212)](_0x5a6835);}function createKtHandler(_0x154699){const _0x3af450=async(_0x5bf68c,_0x29d203={})=>{const _0x2ec39d=_0x4343;try{const _0x553291=new URL(_0x5bf68c[_0x2ec39d(0x201)]),_0x47cd47=await pathParts(_0x29d203,_0x553291),[_0x29f6e9,_0x31371f,_0x2de91f]=_0x47cd47,_0x4eeec0=_0x5bf68c['method'][_0x2ec39d(0x21f)]();if(_0x29f6e9===_0x2ec39d(0x1f1)&&!_0x31371f&&_0x4eeec0==='GET'){const _0x50304d=_0x553291['searchParams'][_0x2ec39d(0x209)](_0x2ec39d(0x1f4));return json({'items':await _0x154699[_0x2ec39d(0x1f1)][_0x2ec39d(0x20f)](_0x50304d||void 0x0)});}if(_0x29f6e9===_0x2ec39d(0x1f1)&&!_0x31371f&&_0x4eeec0===_0x2ec39d(0x1f0)){if(!_0x154699[_0x2ec39d(0x1f1)][_0x2ec39d(0x1fe)])return json({'message':_0x2ec39d(0x1f5)},0x194);return json(await _0x154699[_0x2ec39d(0x1f1)][_0x2ec39d(0x1fe)](await readBody(_0x5bf68c)));}if(_0x29f6e9===_0x2ec39d(0x1f1)&&_0x31371f&&_0x4eeec0===_0x2ec39d(0x206))return json(await _0x154699['artifacts'][_0x2ec39d(0x209)](_0x31371f));if(_0x29f6e9===_0x2ec39d(0x1f1)&&_0x31371f&&_0x4eeec0===_0x2ec39d(0x1f7))return json(await _0x154699[_0x2ec39d(0x1f1)]['save'](await readBody(_0x5bf68c)));if(_0x29f6e9===_0x2ec39d(0x1f1)&&_0x31371f&&_0x4eeec0==='DELETE'){if(!_0x154699[_0x2ec39d(0x1f1)][_0x2ec39d(0x1f9)])return json({'message':_0x2ec39d(0x1ec)},0x194);return await _0x154699[_0x2ec39d(0x1f1)][_0x2ec39d(0x1f9)](_0x31371f),json({'ok':!![]});}if(_0x29f6e9===_0x2ec39d(0x21b)){if(!_0x154699['instances'])return json({'message':_0x2ec39d(0x205)},0x194);if(!_0x31371f&&_0x4eeec0==='GET')return json({'items':await _0x154699[_0x2ec39d(0x21b)]['list']?.(_0x553291[_0x2ec39d(0x20a)][_0x2ec39d(0x209)]('artifactId')??void 0x0)??[]});if(!_0x31371f&&_0x4eeec0===_0x2ec39d(0x1f0)){if(!_0x154699[_0x2ec39d(0x21b)][_0x2ec39d(0x1fe)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x154699['instances'][_0x2ec39d(0x1fe)](await readBody(_0x5bf68c)));}if(_0x31371f&&_0x4eeec0==='GET')return json(await _0x154699[_0x2ec39d(0x21b)]['get'](_0x31371f));if(_0x31371f&&_0x4eeec0==='PUT')return await _0x154699[_0x2ec39d(0x21b)][_0x2ec39d(0x1ed)](_0x31371f,await readBody(_0x5bf68c)),json({'ok':!![]});}if(_0x29f6e9===_0x2ec39d(0x217)){if(!_0x154699['versions'])return json({'message':'versions\x20\u672A\u914D\u7F6E'},0x194);if(!_0x31371f&&_0x4eeec0===_0x2ec39d(0x206)){const _0x3d6a46=_0x553291[_0x2ec39d(0x20a)][_0x2ec39d(0x209)](_0x2ec39d(0x1f4))??'',_0x24a4b3=_0x553291[_0x2ec39d(0x20a)][_0x2ec39d(0x209)]('id')??'';return json(await _0x154699['versions']['log'](_0x3d6a46,_0x24a4b3));}if(!_0x31371f&&_0x4eeec0===_0x2ec39d(0x1f0))return json(await _0x154699[_0x2ec39d(0x217)][_0x2ec39d(0x207)](await readBody(_0x5bf68c)));if(_0x31371f&&_0x2de91f===_0x2ec39d(0x1fa)&&_0x4eeec0===_0x2ec39d(0x206)){const _0x45fd85=await _0x154699[_0x2ec39d(0x217)][_0x2ec39d(0x211)](_0x31371f,_0x553291[_0x2ec39d(0x20a)][_0x2ec39d(0x209)]('path')??'');return new Response(Buffer['from'](_0x45fd85),{'headers':{'content-type':'application/octet-stream'}});}if(_0x31371f&&_0x2de91f===_0x2ec39d(0x218)&&_0x4eeec0===_0x2ec39d(0x1f0)){const _0x3d89bf=await readBody(_0x5bf68c);return json(await _0x154699['versions']['restore'](_0x3d89bf[_0x2ec39d(0x1f4)],_0x3d89bf['id'],_0x31371f,_0x3d89bf['by']));}if(_0x31371f&&!_0x2de91f&&_0x4eeec0===_0x2ec39d(0x206))return json(await _0x154699[_0x2ec39d(0x217)][_0x2ec39d(0x209)](_0x31371f));}return json({'message':_0x2ec39d(0x20d)},0x194);}catch(_0x4ff7f8){return fail(_0x4ff7f8);}};return{'GET':_0x3af450,'POST':_0x3af450,'PUT':_0x3af450,'DELETE':_0x3af450};}function defineKtConfig(_0x1cb81c){return _0x1cb81c;}exports['createKtHandler']=createKtHandler,exports[_0x381fac(0x216)]=defineKtConfig;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x59893a,_0x588fd0){const _0x2f34a8=_0x43a2,_0x55e456=_0x59893a();while(!![]){try{const _0x32738d=-parseInt(_0x2f34a8(0x199))/0x1+parseInt(_0x2f34a8(0x197))/0x2+parseInt(_0x2f34a8(0x179))/0x3*(-parseInt(_0x2f34a8(0x182))/0x4)+parseInt(_0x2f34a8(0x17f))/0x5*(-parseInt(_0x2f34a8(0x183))/0x6)+parseInt(_0x2f34a8(0x18b))/0x7*(-parseInt(_0x2f34a8(0x195))/0x8)+-parseInt(_0x2f34a8(0x174))/0x9+-parseInt(_0x2f34a8(0x19d))/0xa*(-parseInt(_0x2f34a8(0x16e))/0xb);if(_0x32738d===_0x588fd0)break;else _0x55e456['push'](_0x55e456['shift']());}catch(_0x4ab758){_0x55e456['push'](_0x55e456['shift']());}}}(_0x1194,0xbe208));import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x5342a6,_0x3ec7aa){const _0x5c64fb=_0x43a2,_0xca2cc1=_0x5342a6[_0x5c64fb(0x194)]?await _0x5342a6['params']:void 0x0;if(_0xca2cc1?.[_0x5c64fb(0x17d)]?.['length'])return _0xca2cc1['path'];const _0xd62297=_0x3ec7aa['pathname']['indexOf']('/api/kt'),_0x5c6d3f=_0xd62297>=0x0?_0x3ec7aa[_0x5c64fb(0x185)][_0x5c64fb(0x18e)](_0xd62297+_0x5c64fb(0x19c)[_0x5c64fb(0x16d)]):_0x3ec7aa[_0x5c64fb(0x185)];return _0x5c6d3f[_0x5c64fb(0x17b)]('/')['filter'](Boolean);}function _0x1194(){const _0x10cd6f=['yxj0AwzHy3rZ','BgvUz3rO','mtmYAeL2y01n','Bwv0Ag9K','zMLSzq','ufvu','Aw5ZDgfUy2vZ','y29TBwL0','mteZnduWndbLuffKyKS','y3jLyxrLioACQUwUNUEoSa','y3jLyxrL','CMvTB3zLioACQUwUNUEoSa','5PYQ5OM+5yIW','oty5surhrKny','CMvTB3zL','C3bSAxq','revmrvrf','Cgf0Aa','Dgv4Da','mZa1wvLPA2XK','DMvYC2LVBNmG5PYQ6ywn572U','C2vHCMnOugfYyw1Z','otiWEKPMtejY','mtm4nZiWD2zQAwfW','z2v0','Cgf0Ag5HBwu','5yAf6yoO6zsz6k+V','ue9tva','yxj0AwzHy3rjza','Bg9N','A2LUza','n2roDhHlDq','CgfYC2u','DMvYC2LVBNm','C2XPy2u','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','BwvZC2fNzq','C3rYAw5NAwz5','C2f2zq','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','CgfYyw1Z','mZuYmtG0ofL6vLrZCG','y3vYCMvUDa','ndq0ndu2zwrgtKDU','r0vu','ota4mtuXvhjZz2Hx','CMvZDg9Yzq','BgLZDa','l2fWAs9RDa','mZG3nta3mfzer1LUva'];_0x1194=function(){return _0x10cd6f;};return _0x1194();}function json(_0x494bb7,_0x4459fa=0xc8){const _0x4e3a62=_0x43a2;return new Response(JSON[_0x4e3a62(0x191)](_0x494bb7),{'status':_0x4459fa,'headers':{'content-type':_0x4e3a62(0x18f)}});}function fail(_0x27452f){const _0x59ced0=_0x43a2;if(_0x27452f instanceof KtConflictError)return json({'message':_0x27452f['message'],'current':_0x27452f[_0x59ced0(0x196)]},0x199);if(_0x27452f instanceof KtNotFoundError)return json({'message':_0x27452f[_0x59ced0(0x190)]},0x194);if(_0x27452f instanceof KtStoreError)return json({'message':_0x27452f['message']},_0x27452f['status']??0x1f4);return json({'message':_0x27452f instanceof Error?_0x27452f['message']:_0x59ced0(0x186)},0x1f4);}function _0x43a2(_0x512661,_0x1865bc){_0x512661=_0x512661-0x16d;const _0x119456=_0x1194();let _0x43a26d=_0x119456[_0x512661];if(_0x43a2['jcqPYG']===undefined){var _0x597902=function(_0x5d389d){const _0x171beb='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xfc6da6='',_0x5342a6='';for(let _0x3ec7aa=0x0,_0xca2cc1,_0xd62297,_0x5c6d3f=0x0;_0xd62297=_0x5d389d['charAt'](_0x5c6d3f++);~_0xd62297&&(_0xca2cc1=_0x3ec7aa%0x4?_0xca2cc1*0x40+_0xd62297:_0xd62297,_0x3ec7aa++%0x4)?_0xfc6da6+=String['fromCharCode'](0xff&_0xca2cc1>>(-0x2*_0x3ec7aa&0x6)):0x0){_0xd62297=_0x171beb['indexOf'](_0xd62297);}for(let _0x494bb7=0x0,_0x4459fa=_0xfc6da6['length'];_0x494bb7<_0x4459fa;_0x494bb7++){_0x5342a6+='%'+('00'+_0xfc6da6['charCodeAt'](_0x494bb7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5342a6);};_0x43a2['krIxQl']=_0x597902,_0x43a2['AZyFZL']={},_0x43a2['jcqPYG']=!![];}const _0x2fb051=_0x119456[0x0];_0x43a2['UxFrti']!==_0x2fb051&&(_0x43a2['AZyFZL']={},_0x43a2['UxFrti']=_0x2fb051);const _0x4e2935=_0x43a2['AZyFZL'][_0x512661];return _0x4e2935===undefined?(_0x43a26d=_0x43a2['krIxQl'](_0x43a26d),_0x43a2['AZyFZL'][_0x512661]=_0x43a26d):_0x43a26d=_0x4e2935,_0x43a26d;}async function readBody(_0xdef9f3){const _0x2b5e1a=_0x43a2,_0x1ef9fa=await _0xdef9f3[_0x2b5e1a(0x17e)]();if(!_0x1ef9fa)return null;return JSON[_0x2b5e1a(0x18c)](_0x1ef9fa);}function createKtHandler(_0x14be3c){const _0x1639c9=async(_0x5e3367,_0xdcf2fd={})=>{const _0x3fe25b=_0x43a2;try{const _0x23adab=new URL(_0x5e3367['url']),_0x543f0d=await pathParts(_0xdcf2fd,_0x23adab),[_0x567f0b,_0x7a54a4,_0x528664]=_0x543f0d,_0x77dffa=_0x5e3367[_0x3fe25b(0x16f)]['toUpperCase']();if(_0x567f0b===_0x3fe25b(0x19e)&&!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x198)){const _0x4fe211=_0x23adab['searchParams'][_0x3fe25b(0x184)](_0x3fe25b(0x18a));return json({'items':await _0x14be3c['artifacts'][_0x3fe25b(0x19b)](_0x4fe211||void 0x0)});}if(_0x567f0b==='artifacts'&&!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x187)){if(!_0x14be3c[_0x3fe25b(0x19e)][_0x3fe25b(0x176)])return json({'message':_0x3fe25b(0x175)},0x194);return json(await _0x14be3c[_0x3fe25b(0x19e)][_0x3fe25b(0x176)](await readBody(_0x5e3367)));}if(_0x567f0b===_0x3fe25b(0x19e)&&_0x7a54a4&&_0x77dffa===_0x3fe25b(0x198))return json(await _0x14be3c['artifacts'][_0x3fe25b(0x184)](_0x7a54a4));if(_0x567f0b===_0x3fe25b(0x19e)&&_0x7a54a4&&_0x77dffa===_0x3fe25b(0x171))return json(await _0x14be3c[_0x3fe25b(0x19e)][_0x3fe25b(0x192)](await readBody(_0x5e3367)));if(_0x567f0b===_0x3fe25b(0x19e)&&_0x7a54a4&&_0x77dffa===_0x3fe25b(0x17c)){if(!_0x14be3c[_0x3fe25b(0x19e)]['remove'])return json({'message':_0x3fe25b(0x177)},0x194);return await _0x14be3c[_0x3fe25b(0x19e)][_0x3fe25b(0x17a)](_0x7a54a4),json({'ok':!![]});}if(_0x567f0b==='instances'){if(!_0x14be3c['instances'])return json({'message':'instances\x20\u672A\u914D\u7F6E'},0x194);if(!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x198))return json({'items':await _0x14be3c[_0x3fe25b(0x172)][_0x3fe25b(0x19b)]?.(_0x23adab[_0x3fe25b(0x181)][_0x3fe25b(0x184)](_0x3fe25b(0x188))??void 0x0)??[]});if(!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x187)){if(!_0x14be3c[_0x3fe25b(0x172)]['create'])return json({'message':_0x3fe25b(0x175)},0x194);return json(await _0x14be3c[_0x3fe25b(0x172)][_0x3fe25b(0x176)](await readBody(_0x5e3367)));}if(_0x7a54a4&&_0x77dffa===_0x3fe25b(0x198))return json(await _0x14be3c[_0x3fe25b(0x172)][_0x3fe25b(0x184)](_0x7a54a4));if(_0x7a54a4&&_0x77dffa===_0x3fe25b(0x171))return await _0x14be3c[_0x3fe25b(0x172)]['save'](_0x7a54a4,await readBody(_0x5e3367)),json({'ok':!![]});}if(_0x567f0b===_0x3fe25b(0x18d)){if(!_0x14be3c[_0x3fe25b(0x18d)])return json({'message':_0x3fe25b(0x180)},0x194);if(!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x198)){const _0x499a84=_0x23adab['searchParams'][_0x3fe25b(0x184)](_0x3fe25b(0x18a))??'',_0x4c5f35=_0x23adab[_0x3fe25b(0x181)][_0x3fe25b(0x184)]('id')??'';return json(await _0x14be3c[_0x3fe25b(0x18d)][_0x3fe25b(0x189)](_0x499a84,_0x4c5f35));}if(!_0x7a54a4&&_0x77dffa===_0x3fe25b(0x187))return json(await _0x14be3c[_0x3fe25b(0x18d)][_0x3fe25b(0x173)](await readBody(_0x5e3367)));if(_0x7a54a4&&_0x528664===_0x3fe25b(0x170)&&_0x77dffa===_0x3fe25b(0x198)){const _0x45bc89=await _0x14be3c['versions']['readFile'](_0x7a54a4,_0x23adab[_0x3fe25b(0x181)][_0x3fe25b(0x184)]('path')??'');return new Response(Buffer['from'](_0x45bc89),{'headers':{'content-type':_0x3fe25b(0x193)}});}if(_0x7a54a4&&_0x528664===_0x3fe25b(0x19a)&&_0x77dffa===_0x3fe25b(0x187)){const _0x1f5697=await readBody(_0x5e3367);return json(await _0x14be3c[_0x3fe25b(0x18d)][_0x3fe25b(0x19a)](_0x1f5697['kind'],_0x1f5697['id'],_0x7a54a4,_0x1f5697['by']));}if(_0x7a54a4&&!_0x528664&&_0x77dffa===_0x3fe25b(0x198))return json(await _0x14be3c['versions'][_0x3fe25b(0x184)](_0x7a54a4));}return json({'message':_0x3fe25b(0x178)},0x194);}catch(_0x2b3672){return fail(_0x2b3672);}};return{'GET':_0x1639c9,'POST':_0x1639c9,'PUT':_0x1639c9,'DELETE':_0x1639c9};}function defineKtConfig(_0x31c524){return _0x31c524;}export{createKtHandler,defineKtConfig};
1
+ function _0x2d6e(){const _0x3681fc=['Cgf0Aa','C3rHDhvZ','C3rYAw5NAwz5','CMvHzezPBgu','y3jLyxrL','mtKZntK0mNDVu3foyW','n2XIEvPhBa','A2LUza','yxj0AwzHy3rjza','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','z2v0','y29TBwL0','CMvZDg9Yzq','CMvTB3zL','DxjS','Cgf0Ag5HBwu','mtyWteLSs2DA','mtu1ntuYqLrStePt','mtj3DMXMtw8','mty4ndyWzeHfCe1w','ufvu','mZqZnZu5ofPHD0LZwa','5yAf6yoO6zsz6k+V','y3vYCMvUDa','Dgv4Da','Aw5KzxHpzG','Dg9vChbLCKnHC2u','C3bSAxq','5PYQ5OM+5yIW','CgfYC2u','ogzOtgrywa','mte2nde5ndLHsLDVCxG','l2fWAs9RDa','BwvZC2fNzq','C2vHCMnOugfYyw1Z','revmrvrf','nJK3odG4ofzktgvgvq','Aw5ZDgfUy2vZ','DMvYC2LVBNm','zMLSDgvY','r0vu','DMvYC2LVBNmG5PYQ6ywn572U','BgLZDa','ndCXmJC2oxDItMXZAq','CgfYyw1Z','ue9tva','yxj0AwzHy3rZ','y3jLyxrLioACQUwUNUEoSa','mtbhrxzlquG','Bwv0Ag9K','BgvUz3rO','zNjVBq'];_0x2d6e=function(){return _0x3681fc;};return _0x2d6e();}(function(_0x459349,_0x41fa65){const _0x4b0750=_0x421f,_0xfa9a5f=_0x459349();while(!![]){try{const _0x5b0363=parseInt(_0x4b0750(0x1a1))/0x1+parseInt(_0x4b0750(0x17b))/0x2*(-parseInt(_0x4b0750(0x17a))/0x3)+parseInt(_0x4b0750(0x179))/0x4*(-parseInt(_0x4b0750(0x178))/0x5)+parseInt(_0x4b0750(0x17d))/0x6*(parseInt(_0x4b0750(0x1a2))/0x7)+-parseInt(_0x4b0750(0x186))/0x8*(-parseInt(_0x4b0750(0x193))/0x9)+parseInt(_0x4b0750(0x198))/0xa*(-parseInt(_0x4b0750(0x187))/0xb)+parseInt(_0x4b0750(0x18c))/0xc;if(_0x5b0363===_0x41fa65)break;else _0xfa9a5f['push'](_0xfa9a5f['shift']());}catch(_0x3e75d7){_0xfa9a5f['push'](_0xfa9a5f['shift']());}}}(_0x2d6e,0xede3b));import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x2127ac,_0x564b69){const _0x4945a7=_0x421f,_0x42b226=_0x2127ac[_0x4945a7(0x194)]?await _0x2127ac[_0x4945a7(0x194)]:void 0x0;if(_0x42b226?.[_0x4945a7(0x19c)]?.[_0x4945a7(0x19a)])return _0x42b226[_0x4945a7(0x19c)];const _0x15e1d6=_0x564b69[_0x4945a7(0x177)][_0x4945a7(0x181)](_0x4945a7(0x188)),_0x2d6a37=_0x15e1d6>=0x0?_0x564b69[_0x4945a7(0x177)]['slice'](_0x15e1d6+_0x4945a7(0x188)['length']):_0x564b69[_0x4945a7(0x177)];return _0x2d6a37[_0x4945a7(0x183)]('/')[_0x4945a7(0x18f)](Boolean);}function json(_0x487f53,_0x42437f=0xc8){const _0x3c0ad1=_0x421f;return new Response(JSON[_0x3c0ad1(0x19e)](_0x487f53),{'status':_0x42437f,'headers':{'content-type':'application/json;\x20charset=utf-8'}});}function fail(_0x5bdafc){const _0x44aba5=_0x421f;if(_0x5bdafc instanceof KtConflictError)return json({'message':_0x5bdafc['message'],'current':_0x5bdafc[_0x44aba5(0x17f)]},0x199);if(_0x5bdafc instanceof KtNotFoundError)return json({'message':_0x5bdafc[_0x44aba5(0x189)]},0x194);if(_0x5bdafc instanceof KtStoreError)return json({'message':_0x5bdafc[_0x44aba5(0x189)]},_0x5bdafc[_0x44aba5(0x19d)]??0x1f4);return json({'message':_0x5bdafc instanceof Error?_0x5bdafc[_0x44aba5(0x189)]:_0x44aba5(0x17e)},0x1f4);}async function readBody(_0x47a07a){const _0x4b3cd2=_0x421f,_0xa738a=await _0x47a07a[_0x4b3cd2(0x180)]();if(!_0xa738a)return null;return JSON[_0x4b3cd2(0x185)](_0xa738a);}function createKtHandler(_0x38304a){const _0x1f920c=async(_0x1208b1,_0x5ef9e5={})=>{const _0x2b573f=_0x421f;try{const _0x2189e3=new URL(_0x1208b1[_0x2b573f(0x176)]),_0x520cb0=await pathParts(_0x5ef9e5,_0x2189e3),[_0x178b5a,_0x1b4daa,_0x4957ef]=_0x520cb0,_0x1b674b=_0x1208b1[_0x2b573f(0x199)][_0x2b573f(0x182)]();if(_0x178b5a===_0x2b573f(0x196)&&!_0x1b4daa&&_0x1b674b==='GET'){const _0x166334=_0x2189e3[_0x2b573f(0x18a)][_0x2b573f(0x1a6)](_0x2b573f(0x1a3));return json({'items':await _0x38304a[_0x2b573f(0x196)][_0x2b573f(0x192)](_0x166334||void 0x0)});}if(_0x178b5a===_0x2b573f(0x196)&&!_0x1b4daa&&_0x1b674b===_0x2b573f(0x195)){if(!_0x38304a[_0x2b573f(0x196)][_0x2b573f(0x1a0)])return json({'message':_0x2b573f(0x197)},0x194);return json(await _0x38304a['artifacts'][_0x2b573f(0x1a0)](await readBody(_0x1208b1)));}if(_0x178b5a===_0x2b573f(0x196)&&_0x1b4daa&&_0x1b674b===_0x2b573f(0x190))return json(await _0x38304a[_0x2b573f(0x196)][_0x2b573f(0x1a6)](_0x1b4daa));if(_0x178b5a===_0x2b573f(0x196)&&_0x1b4daa&&_0x1b674b==='PUT')return json(await _0x38304a[_0x2b573f(0x196)]['save'](await readBody(_0x1208b1)));if(_0x178b5a===_0x2b573f(0x196)&&_0x1b4daa&&_0x1b674b===_0x2b573f(0x18b)){if(!_0x38304a['artifacts'][_0x2b573f(0x175)])return json({'message':'remove\x20\u672A\u5B9E\u73B0'},0x194);return await _0x38304a[_0x2b573f(0x196)][_0x2b573f(0x175)](_0x1b4daa),json({'ok':!![]});}if(_0x178b5a===_0x2b573f(0x18d)){if(!_0x38304a[_0x2b573f(0x18d)])return json({'message':'instances\x20\u672A\u914D\u7F6E'},0x194);if(!_0x1b4daa&&_0x1b674b===_0x2b573f(0x190))return json({'items':await _0x38304a[_0x2b573f(0x18d)][_0x2b573f(0x192)]?.(_0x2189e3['searchParams'][_0x2b573f(0x1a6)](_0x2b573f(0x1a4))??void 0x0)??[]});if(!_0x1b4daa&&_0x1b674b===_0x2b573f(0x195)){if(!_0x38304a[_0x2b573f(0x18d)][_0x2b573f(0x1a0)])return json({'message':_0x2b573f(0x197)},0x194);return json(await _0x38304a[_0x2b573f(0x18d)][_0x2b573f(0x1a0)](await readBody(_0x1208b1)));}if(_0x1b4daa&&_0x1b674b===_0x2b573f(0x190))return json(await _0x38304a[_0x2b573f(0x18d)][_0x2b573f(0x1a6)](_0x1b4daa));if(_0x1b4daa&&_0x1b674b===_0x2b573f(0x17c))return await _0x38304a[_0x2b573f(0x18d)]['save'](_0x1b4daa,await readBody(_0x1208b1)),json({'ok':!![]});}if(_0x178b5a===_0x2b573f(0x18e)){if(!_0x38304a['versions'])return json({'message':_0x2b573f(0x191)},0x194);if(!_0x1b4daa&&_0x1b674b===_0x2b573f(0x190)){const _0x3a22eb=_0x2189e3[_0x2b573f(0x18a)][_0x2b573f(0x1a6)](_0x2b573f(0x1a3))??'',_0x3dea0c=_0x2189e3[_0x2b573f(0x18a)][_0x2b573f(0x1a6)]('id')??'';return json(await _0x38304a[_0x2b573f(0x18e)]['log'](_0x3a22eb,_0x3dea0c));}if(!_0x1b4daa&&_0x1b674b===_0x2b573f(0x195))return json(await _0x38304a[_0x2b573f(0x18e)][_0x2b573f(0x1a7)](await readBody(_0x1208b1)));if(_0x1b4daa&&_0x4957ef==='file'&&_0x1b674b===_0x2b573f(0x190)){const _0x3f742d=await _0x38304a[_0x2b573f(0x18e)][_0x2b573f(0x19f)](_0x1b4daa,_0x2189e3[_0x2b573f(0x18a)][_0x2b573f(0x1a6)](_0x2b573f(0x19c))??'');return new Response(Buffer[_0x2b573f(0x19b)](_0x3f742d),{'headers':{'content-type':_0x2b573f(0x1a5)}});}if(_0x1b4daa&&_0x4957ef==='restore'&&_0x1b674b==='POST'){const _0xda143e=await readBody(_0x1208b1);return json(await _0x38304a[_0x2b573f(0x18e)][_0x2b573f(0x174)](_0xda143e[_0x2b573f(0x1a3)],_0xda143e['id'],_0x1b4daa,_0xda143e['by']));}if(_0x1b4daa&&!_0x4957ef&&_0x1b674b===_0x2b573f(0x190))return json(await _0x38304a['versions']['get'](_0x1b4daa));}return json({'message':_0x2b573f(0x184)},0x194);}catch(_0x331420){return fail(_0x331420);}};return{'GET':_0x1f920c,'POST':_0x1f920c,'PUT':_0x1f920c,'DELETE':_0x1f920c};}function defineKtConfig(_0x2002ff){return _0x2002ff;}function _0x421f(_0x26f421,_0x373b00){_0x26f421=_0x26f421-0x174;const _0x2d6e5d=_0x2d6e();let _0x421feb=_0x2d6e5d[_0x26f421];if(_0x421f['xTcEvf']===undefined){var _0x2128dd=function(_0x4fde08){const _0x483c14='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1bd119='',_0x2127ac='';for(let _0x564b69=0x0,_0x42b226,_0x15e1d6,_0x2d6a37=0x0;_0x15e1d6=_0x4fde08['charAt'](_0x2d6a37++);~_0x15e1d6&&(_0x42b226=_0x564b69%0x4?_0x42b226*0x40+_0x15e1d6:_0x15e1d6,_0x564b69++%0x4)?_0x1bd119+=String['fromCharCode'](0xff&_0x42b226>>(-0x2*_0x564b69&0x6)):0x0){_0x15e1d6=_0x483c14['indexOf'](_0x15e1d6);}for(let _0x487f53=0x0,_0x42437f=_0x1bd119['length'];_0x487f53<_0x42437f;_0x487f53++){_0x2127ac+='%'+('00'+_0x1bd119['charCodeAt'](_0x487f53)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2127ac);};_0x421f['nUrLSn']=_0x2128dd,_0x421f['hmHDum']={},_0x421f['xTcEvf']=!![];}const _0x370c71=_0x2d6e5d[0x0];_0x421f['vckMKq']!==_0x370c71&&(_0x421f['hmHDum']={},_0x421f['vckMKq']=_0x370c71);const _0x4d1b72=_0x421f['hmHDum'][_0x26f421];return _0x4d1b72===undefined?(_0x421feb=_0x421f['nUrLSn'](_0x421feb),_0x421f['hmHDum'][_0x26f421]=_0x421feb):_0x421feb=_0x4d1b72,_0x421feb;}export{createKtHandler,defineKtConfig};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k-table/next",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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.10"
30
+ "@k-table/report": "^1.0.11"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "next": ">=15"