@k-table/next 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fs.cjs +1 -1
- package/dist/fs.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const _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;
|
|
1
|
+
'use strict';const _0x3f0497=_0x19c8;(function(_0x42ce21,_0x2acbc2){const _0x319a7a=_0x19c8,_0x2dc75a=_0x42ce21();while(!![]){try{const _0x1e742a=parseInt(_0x319a7a(0x1ba))/0x1+parseInt(_0x319a7a(0x1c0))/0x2*(-parseInt(_0x319a7a(0x1cd))/0x3)+-parseInt(_0x319a7a(0x1d5))/0x4+parseInt(_0x319a7a(0x1c2))/0x5*(-parseInt(_0x319a7a(0x1e7))/0x6)+-parseInt(_0x319a7a(0x1f5))/0x7+parseInt(_0x319a7a(0x1d9))/0x8*(-parseInt(_0x319a7a(0x1fb))/0x9)+parseInt(_0x319a7a(0x1c7))/0xa;if(_0x1e742a===_0x2acbc2)break;else _0x2dc75a['push'](_0x2dc75a['shift']());}catch(_0x2ffc99){_0x2dc75a['push'](_0x2dc75a['shift']());}}}(_0x5968,0x60bef));function _0x19c8(_0x84ef4a,_0x49a2cc){_0x84ef4a=_0x84ef4a-0x1b6;const _0x596815=_0x5968();let _0x19c808=_0x596815[_0x84ef4a];if(_0x19c8['XUBJWa']===undefined){var _0x258982=function(_0x49b6ae){const _0x244c73='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x32abe5='',_0x5957c8='';for(let _0x17b2f9=0x0,_0x28c070,_0x54331b,_0x4a7a1c=0x0;_0x54331b=_0x49b6ae['charAt'](_0x4a7a1c++);~_0x54331b&&(_0x28c070=_0x17b2f9%0x4?_0x28c070*0x40+_0x54331b:_0x54331b,_0x17b2f9++%0x4)?_0x32abe5+=String['fromCharCode'](0xff&_0x28c070>>(-0x2*_0x17b2f9&0x6)):0x0){_0x54331b=_0x244c73['indexOf'](_0x54331b);}for(let _0x4d9a12=0x0,_0x4fb02d=_0x32abe5['length'];_0x4d9a12<_0x4fb02d;_0x4d9a12++){_0x5957c8+='%'+('00'+_0x32abe5['charCodeAt'](_0x4d9a12)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5957c8);};_0x19c8['WBpQET']=_0x258982,_0x19c8['vpaLad']={},_0x19c8['XUBJWa']=!![];}const _0x26d169=_0x596815[0x0];_0x19c8['ufltcu']!==_0x26d169&&(_0x19c8['vpaLad']={},_0x19c8['ufltcu']=_0x26d169);const _0x2f01cc=_0x19c8['vpaLad'][_0x84ef4a];return _0x2f01cc===undefined?(_0x19c808=_0x19c8['WBpQET'](_0x19c808),_0x19c8['vpaLad'][_0x84ef4a]=_0x19c808):_0x19c808=_0x2f01cc,_0x19c808;}var fs=require('fs'),path=require(_0x3f0497(0x1f4)),store=require(_0x3f0497(0x1de)),crypto=require('crypto');function resolveRoot(_0x5957c8,_0x17b2f9=process[_0x3f0497(0x20e)]()){const _0x195069=_0x3f0497,_0x28c070=path[_0x195069(0x1f9)](_0x5957c8)?_0x5957c8:path[_0x195069(0x1c4)](_0x17b2f9,_0x5957c8);return fs[_0x195069(0x20a)](_0x28c070,{'recursive':!![]}),_0x28c070;}function artifactDir(_0x54331b,_0x4a7a1c){return path['join'](_0x54331b,_0x4a7a1c);}function objectPath(_0x4d9a12,_0x4fb02d){const _0x3b332f=_0x3f0497;return path[_0x3b332f(0x1bb)](_0x4d9a12,_0x3b332f(0x1d1),_0x4fb02d[_0x3b332f(0x206)](0x0,0x2),_0x4fb02d);}function itemDir(_0xc2a8c8,_0x20f01d,_0x230803){const _0x6223be=_0x3f0497;return path['join'](_0xc2a8c8,_0x6223be(0x201),_0x20f01d,_0x230803);}function newEtag(){const _0x1f86f9=_0x3f0497;return Date['now']()[_0x1f86f9(0x1e5)](0x24)+'-'+Math[_0x1f86f9(0x1f6)]()[_0x1f86f9(0x1e5)](0x24)[_0x1f86f9(0x206)](0x2,0x8);}function readEtag(_0x20d698){const _0x4b6d68=_0x3f0497,_0x3f8565=path['join'](_0x20d698,_0x4b6d68(0x1fd));return fs[_0x4b6d68(0x1fe)](_0x3f8565)?fs[_0x4b6d68(0x1bd)](_0x3f8565,_0x4b6d68(0x1df))[_0x4b6d68(0x1eb)]():void 0x0;}function writeArtifactDir(_0x2f98d7,_0x33fbd6,_0x4066f0){const _0x23005a=_0x3f0497;fs['mkdirSync'](path[_0x23005a(0x1bb)](_0x2f98d7,_0x23005a(0x1db)),{'recursive':!![]});const _0x4801c6=store['artifactToFiles'](_0x33fbd6);fs[_0x23005a(0x1e0)](path[_0x23005a(0x1bb)](_0x2f98d7,store[_0x23005a(0x1c1)]),_0x4801c6[store[_0x23005a(0x1c1)]]??'{}',_0x23005a(0x1df)),fs[_0x23005a(0x1e0)](path[_0x23005a(0x1bb)](_0x2f98d7,store[_0x23005a(0x204)]),_0x4801c6[store[_0x23005a(0x204)]]??'',_0x23005a(0x1df));const _0x2b82ca=path[_0x23005a(0x1bb)](_0x2f98d7,store[_0x23005a(0x1d7)]),_0x1ec8b0=path[_0x23005a(0x1bb)](_0x2f98d7,store[_0x23005a(0x1ff)]);if(_0x4801c6[store[_0x23005a(0x1d7)]])fs[_0x23005a(0x1e0)](_0x2b82ca,_0x4801c6[store['ARTIFACT_FILE_FILL']],_0x23005a(0x1df));else{if(fs[_0x23005a(0x1fe)](_0x2b82ca))fs['rmSync'](_0x2b82ca);}if(_0x4801c6[store[_0x23005a(0x1ff)]])fs[_0x23005a(0x1e0)](_0x1ec8b0,_0x4801c6[store[_0x23005a(0x1ff)]],_0x23005a(0x1df));else{if(fs['existsSync'](_0x1ec8b0))fs['rmSync'](_0x1ec8b0);}fs[_0x23005a(0x1e0)](path[_0x23005a(0x1bb)](_0x2f98d7,_0x23005a(0x1fd)),_0x4066f0,_0x23005a(0x1df));}function readArtifactDir(_0x236e36,_0x21b417){const _0x3bbb91=_0x3f0497,_0x2e3475={},_0xfadec0=path[_0x3bbb91(0x1bb)](_0x236e36,store[_0x3bbb91(0x1c1)]),_0x19565b=path[_0x3bbb91(0x1bb)](_0x236e36,store[_0x3bbb91(0x204)]);if(fs[_0x3bbb91(0x1fe)](_0xfadec0))_0x2e3475[store['ARTIFACT_FILE_META']]=fs[_0x3bbb91(0x1bd)](_0xfadec0,_0x3bbb91(0x1df));if(fs[_0x3bbb91(0x1fe)](_0x19565b))_0x2e3475[store['ARTIFACT_FILE_BODY']]=fs[_0x3bbb91(0x1bd)](_0x19565b,_0x3bbb91(0x1df));const _0x17c60d=path[_0x3bbb91(0x1bb)](_0x236e36,store['ARTIFACT_FILE_FILL']),_0x32d214=path['join'](_0x236e36,store[_0x3bbb91(0x1ff)]);if(fs[_0x3bbb91(0x1fe)](_0x17c60d))_0x2e3475[store['ARTIFACT_FILE_FILL']]=fs[_0x3bbb91(0x1bd)](_0x17c60d,_0x3bbb91(0x1df));if(fs[_0x3bbb91(0x1fe)](_0x32d214))_0x2e3475[store[_0x3bbb91(0x1ff)]]=fs[_0x3bbb91(0x1bd)](_0x32d214,'utf8');return{...store[_0x3bbb91(0x1d0)](_0x2e3475,_0x21b417),'etag':readEtag(_0x236e36)};}function createFsArtifactStore(_0x4e1c5f,_0x47b08d=[]){const _0x54d846=_0x3f0497;fs[_0x54d846(0x20a)](_0x4e1c5f,{'recursive':!![]});for(const _0x19d711 of _0x47b08d){const _0x3ffcee=artifactDir(_0x4e1c5f,_0x19d711['id']),_0x5a807b=path[_0x54d846(0x1bb)](_0x3ffcee,store['ARTIFACT_FILE_BODY']);if(!fs[_0x54d846(0x1fe)](_0x5a807b))writeArtifactDir(_0x3ffcee,_0x19d711,_0x19d711['etag']??newEtag());}return{async 'list'(_0x5f21f2){const _0x4f0d92=_0x54d846;if(!fs[_0x4f0d92(0x1fe)](_0x4e1c5f))return[];const _0x357dec=[];for(const _0x7eabc3 of fs['readdirSync'](_0x4e1c5f,{'withFileTypes':!![]})){if(!_0x7eabc3[_0x4f0d92(0x209)]())continue;try{const _0x58dd95=readArtifactDir(artifactDir(_0x4e1c5f,_0x7eabc3[_0x4f0d92(0x1ea)]),_0x7eabc3[_0x4f0d92(0x1ea)]);if(!_0x5f21f2||_0x58dd95[_0x4f0d92(0x20b)]===_0x5f21f2)_0x357dec[_0x4f0d92(0x1f7)]({'id':_0x58dd95['id'],'name':_0x58dd95[_0x4f0d92(0x1ea)],'kind':_0x58dd95[_0x4f0d92(0x20b)]});}catch{}}return _0x357dec;},async 'get'(_0x208079){const _0x598d8c=_0x54d846,_0x2c685e=artifactDir(_0x4e1c5f,_0x208079);if(!fs['existsSync'](_0x2c685e))throw new store[(_0x598d8c(0x1fa))](_0x598d8c(0x1d4)+_0x208079);return readArtifactDir(_0x2c685e,_0x208079);},async 'save'(_0x2c06a9){const _0x235cff=_0x54d846,_0x4cd12d=artifactDir(_0x4e1c5f,_0x2c06a9['id']),_0x456776=fs[_0x235cff(0x1fe)](_0x4cd12d)?readArtifactDir(_0x4cd12d,_0x2c06a9['id']):void 0x0;if(_0x2c06a9['etag']&&_0x456776?.['etag']&&_0x2c06a9[_0x235cff(0x1e3)]!==_0x456776['etag'])throw new store[(_0x235cff(0x208))](_0x235cff(0x1e6),_0x456776);const _0x4c5bc2=newEtag();return writeArtifactDir(_0x4cd12d,_0x2c06a9,_0x4c5bc2),{..._0x2c06a9,'etag':_0x4c5bc2};},async 'create'(_0x16dd3d){const _0x1f578c=_0x54d846,_0x1636d6=_0x16dd3d[_0x1f578c(0x20b)]+'-'+Math[_0x1f578c(0x1f6)]()[_0x1f578c(0x1e5)](0x24)[_0x1f578c(0x206)](0x2,0xa),_0x276765={'id':_0x1636d6,'name':_0x16dd3d[_0x1f578c(0x1ea)],'kind':_0x16dd3d[_0x1f578c(0x20b)],'ktl':store[_0x1f578c(0x1b9)]};return this[_0x1f578c(0x1e9)](_0x276765);},async 'remove'(_0x5d2994){const _0x3a9dc1=_0x54d846,_0x25cf61=artifactDir(_0x4e1c5f,_0x5d2994);if(!fs[_0x3a9dc1(0x1fe)](_0x25cf61))throw new store['KtNotFoundError']('artifact\x20'+_0x5d2994);fs['rmSync'](_0x25cf61,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x4c2225,_0x5ec070={}){const _0x5f1cbe=_0x3f0497;fs[_0x5f1cbe(0x20a)](_0x4c2225,{'recursive':!![]});const _0x197b17=_0x2f7a8f=>path[_0x5f1cbe(0x1bb)](_0x4c2225,_0x2f7a8f+_0x5f1cbe(0x20c));for(const [_0x3424a2,_0xf4be68]of Object['entries'](_0x5ec070)){if(!fs['existsSync'](_0x197b17(_0x3424a2)))fs[_0x5f1cbe(0x1e0)](_0x197b17(_0x3424a2),JSON[_0x5f1cbe(0x1be)](_0xf4be68,null,0x2),'utf8');}return{async 'get'(_0x287e72){const _0x22fbf1=_0x5f1cbe,_0x44d0d2=_0x197b17(_0x287e72);if(!fs[_0x22fbf1(0x1fe)](_0x44d0d2))throw new store[(_0x22fbf1(0x1fa))]('instance\x20'+_0x287e72);return JSON['parse'](fs[_0x22fbf1(0x1bd)](_0x44d0d2,_0x22fbf1(0x1df)));},async 'save'(_0x1addad,_0x5e8a3c){const _0xde9d49=_0x5f1cbe,_0x476360=_0x197b17(_0x1addad),_0x56223c=fs['existsSync'](_0x476360)?JSON[_0xde9d49(0x207)](fs[_0xde9d49(0x1bd)](_0x476360,_0xde9d49(0x1df))):{'artifactId':'','values':{}},_0x2aa4cc={'artifactId':_0x56223c['artifactId'],'values':{..._0x56223c[_0xde9d49(0x1f1)],..._0x5e8a3c[_0xde9d49(0x1f1)]},'common':{..._0x56223c['common'],..._0x5e8a3c[_0xde9d49(0x1c8)]},'tabCommon':{..._0x56223c['tabCommon'],..._0x5e8a3c['tabCommon']}};fs[_0xde9d49(0x1e0)](_0x476360,JSON[_0xde9d49(0x1be)](_0x2aa4cc,null,0x2),_0xde9d49(0x1df));},async 'list'(_0x3e9cd4){const _0x4dddbe=_0x5f1cbe;return fs[_0x4dddbe(0x1f2)](_0x4c2225)['filter'](_0x2399a4=>_0x2399a4[_0x4dddbe(0x203)](_0x4dddbe(0x20c)))[_0x4dddbe(0x1d2)](_0x2f4410=>{const _0xd3995f=_0x4dddbe,_0x4ac663=_0x2f4410['slice'](0x0,-0x5),_0x1d2cb3=JSON[_0xd3995f(0x207)](fs[_0xd3995f(0x1bd)](path[_0xd3995f(0x1bb)](_0x4c2225,_0x2f4410),'utf8'));return{'id':_0x4ac663,'artifactId':_0x1d2cb3[_0xd3995f(0x1da)]};})[_0x4dddbe(0x1b7)](_0x251f59=>!_0x3e9cd4||_0x251f59[_0x4dddbe(0x1da)]===_0x3e9cd4);},async 'create'(_0x3fde7f){const _0x122ca2=_0x5f1cbe,_0x15fcc2=_0x122ca2(0x1f8)+Math[_0x122ca2(0x1f6)]()[_0x122ca2(0x1e5)](0x24)[_0x122ca2(0x206)](0x2,0xa);return fs[_0x122ca2(0x1e0)](_0x197b17(_0x15fcc2),JSON[_0x122ca2(0x1be)]({'artifactId':_0x3fde7f[_0x122ca2(0x1da)],'values':{},'common':{}},null,0x2),_0x122ca2(0x1df)),{'id':_0x15fcc2};}};}function sha256Hex(_0x38a9a6){const _0x553f35=_0x3f0497,_0x36ae97=typeof _0x38a9a6===_0x553f35(0x1cb)?Buffer['from'](_0x38a9a6,'utf8'):Buffer[_0x553f35(0x1dd)](_0x38a9a6);return crypto[_0x553f35(0x1b6)]('sha256')[_0x553f35(0x1e4)](_0x36ae97)[_0x553f35(0x1dc)](_0x553f35(0x1c9));}function writeObject(_0x5e5e66,_0xe07eba){const _0x4bd87c=_0x3f0497,_0x308e78=sha256Hex(_0xe07eba),_0x559eb5=objectPath(_0x5e5e66,_0x308e78);fs[_0x4bd87c(0x20a)](path[_0x4bd87c(0x200)](_0x559eb5),{'recursive':!![]});if(!fs[_0x4bd87c(0x1fe)](_0x559eb5))fs[_0x4bd87c(0x1e0)](_0x559eb5,_0xe07eba);return _0x308e78;}function _0x5968(){const _0x313f63=['zMfJzxm','zgLNzxn0','zNjVBq','qgSTDgfIBguVCMvWB3j0l3n0B3jL','DxrMoa','D3jPDgvgAwXLu3LUyW','y29TBwL0','z2v0rNvSBfLLyxi','zxrHzW','DxbKyxrL','Dg9tDhjPBMC','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','mJC0mJm2nNjrvgHKqW','z2v0rgf0zq','C2f2zq','BMfTzq','DhjPBq','CMv2','z2v0','yxj0AwzHy3rZuM9VDa','z2v0sg91CNm','C2vLza','DMfSDwvZ','CMvHzgrPCLn5BMm','5OgI5Asn6iEQia','Cgf0Aa','mZuXmZeZmKTjB0v0rG','CMfUzg9T','ChvZAa','Aw5ZDc0','AxnbyNnVBhv0zq','s3roB3rgB3vUzevYCM9Y','mJa4mtuYA0nkt0L6','CMv2ia','lMv0ywC','zxHPC3rZu3LUyW','qvjusuzbq1rFrKLmrv9srvbpuLq','zgLYBMfTzq','AxrLBxm','lwXVy2fSlq','zw5KC1DPDgG','qvjusuzbq1rFrKLmrv9ct0rz','C2vLzeLUC3rHBMnLCW','C2XPy2u','CgfYC2u','s3rdB25MBgLJDevYCM9Y','AxneAxjLy3rVCNK','BwTKAxjtEw5J','A2LUza','lMPZB24','Aw5ZDgfUy2vZuM9VDa','y3DK','y3jLyxrLsgfZAa','zMLSDgvY','Bg9NlMPZB24','ru1qvfLFs1rm','nZaWmdK3DvDXu3Hy','AM9PBG','A2v5CW','CMvHzezPBgvtEw5J','C3rYAw5NAwz5','yxj0AwzHy3ruB0zPBgvZ','nJu5nZjxCeztyvq','qvjusuzbq1rFrKLmrv9nrvrb','nxPys3vUAG','CgfKu3rHCNq','CMvZB2X2zq','zMLUza','sevbra','mtiXnduYnJboteXYCwi','y29TBw9U','Agv4','zgvJB2rL','C3rYAw5N','zMLSzxm','oxbcBvbfBG','zw50CMLLCW','C29YDa','zMLSzxnuB0fYDgLMywn0','B2jQzwn0CW','BwfW','Dg9ju09tDhjPBMC','yxj0AwzHy3qG','mtq3mtC4mgjzAfjHBq','AgvHza','qvjusuzbq1rFrKLmrv9gsuXm','y3jLyxrLs3rgC1n0B3jLCW','mZjRtNvozK4','yxj0AwzHy3rjza'];_0x5968=function(){return _0x313f63;};return _0x5968();}function readLog(_0x1c39ee,_0x5988f9,_0x3da3e2){const _0x1fd752=_0x3f0497,_0x2e4efe=itemDir(_0x1c39ee,_0x5988f9,_0x3da3e2),_0x47280c=path[_0x1fd752(0x1bb)](_0x2e4efe,_0x1fd752(0x1b8)),_0x1384fb=path['join'](_0x2e4efe,_0x1fd752(0x1c6)),_0x1d9c0b=fs[_0x1fd752(0x1fe)](_0x47280c)?JSON[_0x1fd752(0x207)](fs['readFileSync'](_0x47280c,_0x1fd752(0x1df))):[],_0x368b7d=fs['existsSync'](_0x1384fb)?fs[_0x1fd752(0x1bd)](_0x1384fb,_0x1fd752(0x1df))[_0x1fd752(0x1eb)]():_0x1d9c0b['at'](-0x1)?.[_0x1fd752(0x1ec)]??null;return{'head':_0x368b7d,'items':_0x1d9c0b};}function writeLog(_0x2c322d,_0x49f8f0,_0x3703f7,_0x47aac8,_0x26d616){const _0x185dd4=_0x3f0497,_0x1d7ccc=itemDir(_0x2c322d,_0x49f8f0,_0x3703f7);fs[_0x185dd4(0x20a)](_0x1d7ccc,{'recursive':!![]}),fs[_0x185dd4(0x1e0)](path[_0x185dd4(0x1bb)](_0x1d7ccc,'log.json'),JSON[_0x185dd4(0x1be)](_0x26d616,null,0x2),'utf8'),fs['writeFileSync'](path[_0x185dd4(0x1bb)](_0x1d7ccc,_0x185dd4(0x1c6)),_0x47aac8+'\x0a',_0x185dd4(0x1df));}function findRev(_0x497092,_0x264abc){const _0x4af96b=_0x3f0497,_0x1e2a9a=path[_0x4af96b(0x1bb)](_0x497092,_0x4af96b(0x201));if(!fs[_0x4af96b(0x1fe)](_0x1e2a9a))return void 0x0;for(const _0x441dc4 of fs[_0x4af96b(0x1f2)](_0x1e2a9a,{'withFileTypes':!![]})){if(!_0x441dc4['isDirectory']())continue;for(const _0xc069f1 of fs[_0x4af96b(0x1f2)](path['join'](_0x1e2a9a,_0x441dc4['name']),{'withFileTypes':!![]})){if(!_0xc069f1[_0x4af96b(0x209)]())continue;const _0x212c60=readLog(_0x497092,_0x441dc4[_0x4af96b(0x1ea)],_0xc069f1[_0x4af96b(0x1ea)])[_0x4af96b(0x201)]['find'](_0x12dd79=>_0x12dd79[_0x4af96b(0x1ec)]===_0x264abc);if(_0x212c60)return _0x212c60;}}return void 0x0;}function filesTextOf(_0x45e3f0,_0x1cebeb){const _0x43a794=_0x3f0497,_0x542d31={};for(const [_0x5ba622,_0x2fbf4c]of Object[_0x43a794(0x1ce)](_0x1cebeb['files'])){const _0x1b8e8f=objectPath(_0x45e3f0,_0x2fbf4c);if(fs['existsSync'](_0x1b8e8f))_0x542d31[_0x5ba622]=fs[_0x43a794(0x1bd)](_0x1b8e8f,_0x43a794(0x1df));}return _0x542d31;}function createFsVersionStore(_0x5c0b78,_0xa78984){const _0x50a36a=_0x3f0497;return fs[_0x50a36a(0x20a)](_0x5c0b78,{'recursive':!![]}),{async 'log'(_0x2928c1,_0xbbe966){const _0x16f3a5=_0x50a36a,{head:_0x2093a9,items:_0x394cf2}=readLog(_0x5c0b78,_0x2928c1,_0xbbe966);return{'head':_0x2093a9,'items':[..._0x394cf2][_0x16f3a5(0x1cf)]((_0x568039,_0x59ecdc)=>_0x568039['at']<_0x59ecdc['at']?0x1:-0x1)};},async 'get'(_0x2fa693){const _0x4788a8=_0x50a36a,_0x5673f8=findRev(_0x5c0b78,_0x2fa693);if(!_0x5673f8)throw new store[(_0x4788a8(0x1fa))](_0x4788a8(0x1fc)+_0x2fa693);return _0x5673f8;},async 'readFile'(_0x39dd7c,_0x47f6bc){const _0x36ba43=_0x50a36a,_0x1a7dc8=await this[_0x36ba43(0x1ed)](_0x39dd7c),_0x3aaa0c=_0x1a7dc8[_0x36ba43(0x1cc)][_0x47f6bc];if(!_0x3aaa0c)throw new store[(_0x36ba43(0x1fa))](_0x47f6bc);const _0x587c27=objectPath(_0x5c0b78,_0x3aaa0c);if(!fs[_0x36ba43(0x1fe)](_0x587c27))throw new store[(_0x36ba43(0x1fa))](_0x47f6bc);return new Uint8Array(fs[_0x36ba43(0x1bd)](_0x587c27));},async 'commit'(_0x5f209e){const _0x50d6ba=_0x50a36a;let _0x53d8fe=_0x5f209e[_0x50d6ba(0x1cc)];if(!_0x53d8fe){const _0x3a6adf=await _0xa78984['get'](_0x5f209e['id']);_0x53d8fe=store[_0x50d6ba(0x1bf)](_0x3a6adf);}const _0x2a0521={},_0x5454d9={};for(const [_0x97cf2e,_0x32b2bf]of Object['entries'](_0x53d8fe)){const _0x5077d6=typeof _0x32b2bf===_0x50d6ba(0x1cb)?_0x32b2bf:new TextDecoder()[_0x50d6ba(0x1ca)](_0x32b2bf);_0x2a0521[_0x97cf2e]=_0x5077d6,_0x5454d9[_0x97cf2e]=writeObject(_0x5c0b78,typeof _0x32b2bf===_0x50d6ba(0x1cb)?Buffer['from'](_0x32b2bf,_0x50d6ba(0x1df)):_0x32b2bf);}const _0x21f0f8=readLog(_0x5c0b78,_0x5f209e[_0x50d6ba(0x20b)],_0x5f209e['id']);if(_0x21f0f8[_0x50d6ba(0x1d6)]){const _0x36147d=_0x21f0f8[_0x50d6ba(0x201)][_0x50d6ba(0x1c5)](_0x1adb96=>_0x1adb96[_0x50d6ba(0x1ec)]===_0x21f0f8[_0x50d6ba(0x1d6)]);if(_0x36147d&&store['filesEqual'](_0x2a0521,filesTextOf(_0x5c0b78,_0x36147d)))return _0x36147d;}const _0x415fc4=new Date(),_0x1c550b=String(_0x415fc4[_0x50d6ba(0x1e2)]())[_0x50d6ba(0x206)](0x2)+String(_0x415fc4['getMonth']()+0x1)[_0x50d6ba(0x1c3)](0x2,'0')+String(_0x415fc4[_0x50d6ba(0x1e8)]())[_0x50d6ba(0x1c3)](0x2,'0')+String(_0x415fc4[_0x50d6ba(0x1ef)]())['padStart'](0x2,'0')+String(_0x415fc4['getMinutes']())[_0x50d6ba(0x1c3)](0x2,'0'),_0x5030e1=sha256Hex(Object[_0x50d6ba(0x1f1)](_0x5454d9)[_0x50d6ba(0x1cf)]()[_0x50d6ba(0x1bb)](','))[_0x50d6ba(0x206)](0x0,0x8),_0x9d90e9={'rev':_0x1c550b+_0x50d6ba(0x202)+_0x5030e1,'kind':_0x5f209e['kind'],'id':_0x5f209e['id'],'at':_0x415fc4[_0x50d6ba(0x1d3)](),'parent':_0x21f0f8[_0x50d6ba(0x1d6)],'by':_0x5f209e['by'],'note':_0x5f209e['note'],'files':_0x5454d9,'meta':_0x5f209e['meta']};return writeLog(_0x5c0b78,_0x5f209e[_0x50d6ba(0x20b)],_0x5f209e['id'],_0x9d90e9['rev'],[..._0x21f0f8[_0x50d6ba(0x201)],_0x9d90e9]),_0x9d90e9;},async 'restore'(_0x330555,_0x372fc6,_0x191537,_0x2f50af){const _0x314206=_0x50a36a,_0x21a67d=await this[_0x314206(0x1ed)](_0x191537),_0x1c2c42={};for(const _0x3d28d0 of Object[_0x314206(0x1bc)](_0x21a67d[_0x314206(0x1cc)])){_0x1c2c42[_0x3d28d0]=new TextDecoder()[_0x314206(0x1ca)](await this['readFile'](_0x191537,_0x3d28d0));}const _0x43e296=store['filesToArtifact'](_0x1c2c42,_0x372fc6);return await _0xa78984[_0x314206(0x1e9)]({..._0x43e296,'id':_0x372fc6,'kind':_0x43e296[_0x314206(0x20b)],'etag':void 0x0}),this[_0x314206(0x1e1)]({'kind':_0x330555,'id':_0x372fc6,'files':_0x1c2c42,'by':_0x2f50af,'note':_0x314206(0x1f3)+_0x191537});}};}function createKtFsStores(_0x2a5050){const _0x2f09ef=_0x3f0497,_0x5bc871=createFsArtifactStore(resolveRoot(_0x2a5050[_0x2f09ef(0x1ee)],_0x2a5050['cwd']),_0x2a5050[_0x2f09ef(0x1f0)]),_0x51fa91=_0x2a5050[_0x2f09ef(0x20d)]?createFsInstanceStore(resolveRoot(_0x2a5050[_0x2f09ef(0x20d)],_0x2a5050[_0x2f09ef(0x20e)]),_0x2a5050[_0x2f09ef(0x205)]):void 0x0,_0xf70dd0=_0x2a5050['versionsRoot']?createFsVersionStore(resolveRoot(_0x2a5050['versionsRoot'],_0x2a5050[_0x2f09ef(0x20e)]),_0x5bc871):void 0x0;return{'artifacts':_0x5bc871,'instances':_0x51fa91,'versions':_0xf70dd0};}exports[_0x3f0497(0x1d8)]=createKtFsStores;
|
package/dist/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
const _0x10d79a=_0x3c19;(function(_0x33d4ca,_0x35f4a3){const _0x2f4b87=_0x3c19,_0xa34c9a=_0x33d4ca();while(!![]){try{const _0x24e217=parseInt(_0x2f4b87(0x16c))/0x1*(parseInt(_0x2f4b87(0x143))/0x2)+-parseInt(_0x2f4b87(0x141))/0x3+parseInt(_0x2f4b87(0x174))/0x4*(parseInt(_0x2f4b87(0x14c))/0x5)+parseInt(_0x2f4b87(0x14f))/0x6*(parseInt(_0x2f4b87(0x16a))/0x7)+-parseInt(_0x2f4b87(0x15c))/0x8*(parseInt(_0x2f4b87(0x14a))/0x9)+-parseInt(_0x2f4b87(0x148))/0xa+-parseInt(_0x2f4b87(0x166))/0xb*(-parseInt(_0x2f4b87(0x151))/0xc);if(_0x24e217===_0x35f4a3)break;else _0xa34c9a['push'](_0xa34c9a['shift']());}catch(_0x28aebd){_0xa34c9a['push'](_0xa34c9a['shift']());}}}(_0x5e53,0x5dff3));import{mkdirSync,existsSync,rmSync,readdirSync,writeFileSync,readFileSync}from'fs';function _0x5e53(){const _0xdb7c27=['yxj0AwzHy3rjza','mZC2ChjrvwHM','CMfUzg9T','lwXVy2fSlq','A2LUza','zw50CMLLCW','C3rYAw5N','zMLSDgvY','y3DK','yxj0AwzHy3rZuM9VDa','BMfTzq','Bg9NlMPZB24','sevbra','DMfSDwvZ','CMvHzezPBgu','C2vLza','DMvYC2LVBNnsB290','z2v0rNvSBfLLyxi','Dg9ju09tDhjPBMC','yxj0AwzHy3qG','5BEL5l2C5yMV5PYS5BEY5y+y5PU0','AxrLBxm','mtu0mtqYngXXC3fiza','zxrHzW','mJm4CxvNzKfk','zNjVBq','AxneAxjLy3rVCNK','zMLSzxm','C2vLzeLUC3rHBMnLCW','nZe2mtCYmgzwz0XPqG','AgvHza','mJDdvhrnDeC','AM9PBG','nJeWnwrREK9eDq','lMPZB24','BM93','oty0otG2BhfnzND1','zgLNzxn0','mtj1yLPftvi','DxbKyxrL','DhjPBq','z2v0twLUDxrLCW','zgvJB2rL','CgfYC2u','C29YDa','Dg9tDhjPBMC','C2HHmJu2','CMv2','C3rYAw5NAwz5','nJyYmJq4DNP4EuLZ','Bwv0yq','z2v0sg91CNm','CgfKu3rHCNq','lMv0ywC','z2v0rgf0zq','y29TBw9U','BM90zq','Agv4','zMLUza','ntKZoduZn2fHvgvNEq','BwfW','DxrMoa','y29TBwL0','mJHnzMvPq1m','B2jQzwn0CW','ndC1mxzRDNjVCq','C2XPy2u','DgfIq29TBw9U','z2v0','z2v0tw9UDgG','Aw5ZDgfUy2vZuM9VDa','C2f2zq'];_0x5e53=function(){return _0xdb7c27;};return _0x5e53();}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(_0x459604,_0x217967=process[_0x10d79a(0x17b)]()){const _0x453aee=isAbsolute(_0x459604)?_0x459604:resolve(_0x217967,_0x459604);return mkdirSync(_0x453aee,{'recursive':!![]}),_0x453aee;}function artifactDir(_0x1b29bb,_0x710e8b){return join(_0x1b29bb,_0x710e8b);}function objectPath(_0xda810a,_0x2998f5){const _0x1abca6=_0x10d79a;return join(_0xda810a,_0x1abca6(0x16b),_0x2998f5[_0x1abca6(0x16d)](0x0,0x2),_0x2998f5);}function itemDir(_0x4d7517,_0x2ab4cd,_0x5c98dc){const _0x5611b2=_0x10d79a;return join(_0x4d7517,_0x5611b2(0x188),_0x2ab4cd,_0x5c98dc);}function newEtag(){const _0x45f636=_0x10d79a;return Date[_0x45f636(0x14e)]()['toString'](0x24)+'-'+Math['random']()['toString'](0x24)['slice'](0x2,0x8);}function _0x3c19(_0x35d921,_0x3d24a3){_0x35d921=_0x35d921-0x141;const _0x5e535d=_0x5e53();let _0x3c199a=_0x5e535d[_0x35d921];if(_0x3c19['SICUIB']===undefined){var _0x1df0e3=function(_0x2949bf){const _0x2c4b94='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x48a46f='',_0x459604='';for(let _0x217967=0x0,_0x453aee,_0x1b29bb,_0x710e8b=0x0;_0x1b29bb=_0x2949bf['charAt'](_0x710e8b++);~_0x1b29bb&&(_0x453aee=_0x217967%0x4?_0x453aee*0x40+_0x1b29bb:_0x1b29bb,_0x217967++%0x4)?_0x48a46f+=String['fromCharCode'](0xff&_0x453aee>>(-0x2*_0x217967&0x6)):0x0){_0x1b29bb=_0x2c4b94['indexOf'](_0x1b29bb);}for(let _0xda810a=0x0,_0x2998f5=_0x48a46f['length'];_0xda810a<_0x2998f5;_0xda810a++){_0x459604+='%'+('00'+_0x48a46f['charCodeAt'](_0xda810a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x459604);};_0x3c19['DxaUkW']=_0x1df0e3,_0x3c19['igXpQc']={},_0x3c19['SICUIB']=!![];}const _0x2e1496=_0x5e535d[0x0];_0x3c19['IHYTTz']!==_0x2e1496&&(_0x3c19['igXpQc']={},_0x3c19['IHYTTz']=_0x2e1496);const _0x24844a=_0x3c19['igXpQc'][_0x35d921];return _0x24844a===undefined?(_0x3c199a=_0x3c19['DxaUkW'](_0x3c199a),_0x3c19['igXpQc'][_0x35d921]=_0x3c199a):_0x3c199a=_0x24844a,_0x3c199a;}function readEtag(_0x575dba){const _0x2ad4c0=_0x10d79a,_0x5f5cd6=join(_0x575dba,_0x2ad4c0(0x160));return existsSync(_0x5f5cd6)?readFileSync(_0x5f5cd6,_0x2ad4c0(0x168))[_0x2ad4c0(0x153)]():void 0x0;}function writeArtifactDir(_0x1a7eb6,_0x4344c1,_0x4383e7){const _0x3e6a6a=_0x10d79a;mkdirSync(join(_0x1a7eb6,'faces'),{'recursive':!![]});const _0x2e9517=artifactToFiles(_0x4344c1);writeFileSync(join(_0x1a7eb6,ARTIFACT_FILE_META),_0x2e9517[ARTIFACT_FILE_META]??'{}','utf8'),writeFileSync(join(_0x1a7eb6,ARTIFACT_FILE_BODY),_0x2e9517[ARTIFACT_FILE_BODY]??'',_0x3e6a6a(0x168));const _0x23186e=join(_0x1a7eb6,ARTIFACT_FILE_FILL),_0x2c818f=join(_0x1a7eb6,ARTIFACT_FILE_REPORT);if(_0x2e9517[ARTIFACT_FILE_FILL])writeFileSync(_0x23186e,_0x2e9517[ARTIFACT_FILE_FILL],'utf8');else{if(existsSync(_0x23186e))rmSync(_0x23186e);}if(_0x2e9517[ARTIFACT_FILE_REPORT])writeFileSync(_0x2c818f,_0x2e9517[ARTIFACT_FILE_REPORT],_0x3e6a6a(0x168));else{if(existsSync(_0x2c818f))rmSync(_0x2c818f);}writeFileSync(join(_0x1a7eb6,_0x3e6a6a(0x160)),_0x4383e7,_0x3e6a6a(0x168));}function readArtifactDir(_0x4d1912,_0x5fc445){const _0x8a82ff=_0x10d79a,_0x308fcc={},_0x5313de=join(_0x4d1912,ARTIFACT_FILE_META),_0x56215c=join(_0x4d1912,ARTIFACT_FILE_BODY);if(existsSync(_0x5313de))_0x308fcc[ARTIFACT_FILE_META]=readFileSync(_0x5313de,_0x8a82ff(0x168));if(existsSync(_0x56215c))_0x308fcc[ARTIFACT_FILE_BODY]=readFileSync(_0x56215c,_0x8a82ff(0x168));const _0x472643=join(_0x4d1912,ARTIFACT_FILE_FILL),_0x4c6b5a=join(_0x4d1912,ARTIFACT_FILE_REPORT);if(existsSync(_0x472643))_0x308fcc[ARTIFACT_FILE_FILL]=readFileSync(_0x472643,_0x8a82ff(0x168));if(existsSync(_0x4c6b5a))_0x308fcc[ARTIFACT_FILE_REPORT]=readFileSync(_0x4c6b5a,_0x8a82ff(0x168));return{...filesToArtifact(_0x308fcc,_0x5fc445),'etag':readEtag(_0x4d1912)};}function createFsArtifactStore(_0xc5080f,_0x43dc35=[]){const _0x5a97a6=_0x10d79a;mkdirSync(_0xc5080f,{'recursive':!![]});for(const _0x1f319d of _0x43dc35){const _0x31fb38=artifactDir(_0xc5080f,_0x1f319d['id']),_0x4afbde=join(_0x31fb38,ARTIFACT_FILE_BODY);if(!existsSync(_0x4afbde))writeArtifactDir(_0x31fb38,_0x1f319d,_0x1f319d[_0x5a97a6(0x142)]??newEtag());}return{async 'list'(_0x49a861){const _0x3ff209=_0x5a97a6;if(!existsSync(_0xc5080f))return[];const _0x26991c=[];for(const _0x4eed5e of readdirSync(_0xc5080f,{'withFileTypes':!![]})){if(!_0x4eed5e['isDirectory']())continue;try{const _0x5458a=readArtifactDir(artifactDir(_0xc5080f,_0x4eed5e[_0x3ff209(0x17d)]),_0x4eed5e[_0x3ff209(0x17d)]);if(!_0x49a861||_0x5458a[_0x3ff209(0x177)]===_0x49a861)_0x26991c['push']({'id':_0x5458a['id'],'name':_0x5458a['name'],'kind':_0x5458a[_0x3ff209(0x177)]});}catch{}}return _0x26991c;},async 'get'(_0x5e6fa0){const _0x1bbf96=_0x5a97a6,_0x567d24=artifactDir(_0xc5080f,_0x5e6fa0);if(!existsSync(_0x567d24))throw new KtNotFoundError(_0x1bbf96(0x186)+_0x5e6fa0);return readArtifactDir(_0x567d24,_0x5e6fa0);},async 'save'(_0x3773f0){const _0x5023ce=_0x5a97a6,_0x7cd2ee=artifactDir(_0xc5080f,_0x3773f0['id']),_0x5a6799=existsSync(_0x7cd2ee)?readArtifactDir(_0x7cd2ee,_0x3773f0['id']):void 0x0;if(_0x3773f0['etag']&&_0x5a6799?.['etag']&&_0x3773f0[_0x5023ce(0x142)]!==_0x5a6799['etag'])throw new KtConflictError(_0x5023ce(0x187),_0x5a6799);const _0x1c38f3=newEtag();return writeArtifactDir(_0x7cd2ee,_0x3773f0,_0x1c38f3),{..._0x3773f0,'etag':_0x1c38f3};},async 'create'(_0x58e1ff){const _0x3f4f2b=_0x5a97a6,_0x202db2=_0x58e1ff[_0x3f4f2b(0x177)]+'-'+Math[_0x3f4f2b(0x175)]()['toString'](0x24)[_0x3f4f2b(0x16d)](0x2,0xa),_0x487024={'id':_0x202db2,'name':_0x58e1ff['name'],'kind':_0x58e1ff[_0x3f4f2b(0x177)],'ktl':EMPTY_KTL};return this[_0x3f4f2b(0x172)](_0x487024);},async 'remove'(_0x54aec0){const _0x1cbc7f=_0x5a97a6,_0xb3e6fc=artifactDir(_0xc5080f,_0x54aec0);if(!existsSync(_0xb3e6fc))throw new KtNotFoundError(_0x1cbc7f(0x186)+_0x54aec0);rmSync(_0xb3e6fc,{'recursive':!![],'force':!![]});}};}function createFsInstanceStore(_0x210907,_0x45f064={}){const _0x1225af=_0x10d79a;mkdirSync(_0x210907,{'recursive':!![]});const _0x2e03d2=_0xb73dc2=>join(_0x210907,_0xb73dc2+'.json');for(const [_0x88a4e4,_0x160fa1]of Object[_0x1225af(0x178)](_0x45f064)){if(!existsSync(_0x2e03d2(_0x88a4e4)))writeFileSync(_0x2e03d2(_0x88a4e4),JSON['stringify'](_0x160fa1,null,0x2),_0x1225af(0x168));}return{async 'get'(_0x55c80c){const _0x4b4482=_0x1225af,_0x337cf6=_0x2e03d2(_0x55c80c);if(!existsSync(_0x337cf6))throw new KtNotFoundError('instance\x20'+_0x55c80c);return JSON[_0x4b4482(0x156)](readFileSync(_0x337cf6,_0x4b4482(0x168)));},async 'save'(_0x5ee90a,_0x243a20){const _0x49c59b=_0x1225af,_0x392b60=_0x2e03d2(_0x5ee90a),_0x55381f=existsSync(_0x392b60)?JSON[_0x49c59b(0x156)](readFileSync(_0x392b60,_0x49c59b(0x168))):{'artifactId':'','values':{}},_0x53375b={'artifactId':_0x55381f['artifactId'],'values':{..._0x55381f[_0x49c59b(0x180)],..._0x243a20[_0x49c59b(0x180)]},'common':{..._0x55381f[_0x49c59b(0x162)],..._0x243a20['common']},'tabCommon':{..._0x55381f[_0x49c59b(0x16e)],..._0x243a20['tabCommon']}};writeFileSync(_0x392b60,JSON[_0x49c59b(0x15b)](_0x53375b,null,0x2),_0x49c59b(0x168));},async 'list'(_0x365a7c){const _0x425414=_0x1225af;return readdirSync(_0x210907)[_0x425414(0x17a)](_0x1e304f=>_0x1e304f['endsWith'](_0x425414(0x14d)))[_0x425414(0x167)](_0x48bd56=>{const _0x108b42=_0x425414,_0xf38f5=_0x48bd56[_0x108b42(0x16d)](0x0,-0x5),_0x259204=JSON['parse'](readFileSync(join(_0x210907,_0x48bd56),_0x108b42(0x168)));return{'id':_0xf38f5,'artifactId':_0x259204[_0x108b42(0x173)]};})['filter'](_0x40d8c5=>!_0x365a7c||_0x40d8c5[_0x425414(0x173)]===_0x365a7c);},async 'create'(_0x34594d){const _0x2dea41=_0x1225af,_0x43cfd8='inst-'+Math[_0x2dea41(0x175)]()[_0x2dea41(0x158)](0x24)[_0x2dea41(0x16d)](0x2,0xa);return writeFileSync(_0x2e03d2(_0x43cfd8),JSON['stringify']({'artifactId':_0x34594d[_0x2dea41(0x173)],'values':{},'common':{}},null,0x2),_0x2dea41(0x168)),{'id':_0x43cfd8};}};}function sha256Hex(_0x57cdae){const _0x2a884f=_0x10d79a,_0x505c60=typeof _0x57cdae===_0x2a884f(0x179)?Buffer[_0x2a884f(0x144)](_0x57cdae,_0x2a884f(0x168)):Buffer[_0x2a884f(0x144)](_0x57cdae);return createHash(_0x2a884f(0x159))[_0x2a884f(0x152)](_0x505c60)[_0x2a884f(0x150)](_0x2a884f(0x164));}function writeObject(_0x3f1a0d,_0x170ab6){const _0x2e3bbe=sha256Hex(_0x170ab6),_0x2ec74f=objectPath(_0x3f1a0d,_0x2e3bbe);mkdirSync(dirname(_0x2ec74f),{'recursive':!![]});if(!existsSync(_0x2ec74f))writeFileSync(_0x2ec74f,_0x170ab6);return _0x2e3bbe;}function readLog(_0xcd3804,_0x3b478d,_0x3d5ca5){const _0x25cd59=_0x10d79a,_0x14f564=itemDir(_0xcd3804,_0x3b478d,_0x3d5ca5),_0x3f53e8=join(_0x14f564,'log.json'),_0x1c297f=join(_0x14f564,_0x25cd59(0x17f)),_0x300b36=existsSync(_0x3f53e8)?JSON[_0x25cd59(0x156)](readFileSync(_0x3f53e8,_0x25cd59(0x168))):[],_0x33d729=existsSync(_0x1c297f)?readFileSync(_0x1c297f,_0x25cd59(0x168))[_0x25cd59(0x153)]():_0x300b36['at'](-0x1)?.[_0x25cd59(0x15a)]??null;return{'head':_0x33d729,'items':_0x300b36};}function writeLog(_0x2e4899,_0x2d0b88,_0x5c007e,_0x4239c0,_0x34ab12){const _0x3740d6=_0x10d79a,_0x1358e3=itemDir(_0x2e4899,_0x2d0b88,_0x5c007e);mkdirSync(_0x1358e3,{'recursive':!![]}),writeFileSync(join(_0x1358e3,_0x3740d6(0x17e)),JSON[_0x3740d6(0x15b)](_0x34ab12,null,0x2),'utf8'),writeFileSync(join(_0x1358e3,_0x3740d6(0x17f)),_0x4239c0+'\x0a','utf8');}function findRev(_0x3c06ec,_0x516279){const _0x2832f2=_0x10d79a,_0x271958=join(_0x3c06ec,'items');if(!existsSync(_0x271958))return void 0x0;for(const _0x3d900e of readdirSync(_0x271958,{'withFileTypes':!![]})){if(!_0x3d900e[_0x2832f2(0x145)]())continue;for(const _0x5cc581 of readdirSync(join(_0x271958,_0x3d900e['name']),{'withFileTypes':!![]})){if(!_0x5cc581[_0x2832f2(0x145)]())continue;const _0x1c76f1=readLog(_0x3c06ec,_0x3d900e[_0x2832f2(0x17d)],_0x5cc581[_0x2832f2(0x17d)])[_0x2832f2(0x188)][_0x2832f2(0x165)](_0x507104=>_0x507104[_0x2832f2(0x15a)]===_0x516279);if(_0x1c76f1)return _0x1c76f1;}}return void 0x0;}function filesTextOf(_0x408886,_0x2d0b3e){const _0x3dc9ab=_0x10d79a,_0x235268={};for(const [_0x30f59c,_0x3b8ed9]of Object[_0x3dc9ab(0x178)](_0x2d0b3e['files'])){const _0x2e944a=objectPath(_0x408886,_0x3b8ed9);if(existsSync(_0x2e944a))_0x235268[_0x30f59c]=readFileSync(_0x2e944a,_0x3dc9ab(0x168));}return _0x235268;}function createFsVersionStore(_0x18975f,_0x40cfe4){return mkdirSync(_0x18975f,{'recursive':!![]}),{async 'log'(_0x49a3cc,_0x22dc43){const _0x78949e=_0x3c19,{head:_0x1a6fb7,items:_0x5062db}=readLog(_0x18975f,_0x49a3cc,_0x22dc43);return{'head':_0x1a6fb7,'items':[..._0x5062db][_0x78949e(0x157)]((_0x3416c2,_0x5773b5)=>_0x3416c2['at']<_0x5773b5['at']?0x1:-0x1)};},async 'get'(_0xf70973){const _0x5d21c9=findRev(_0x18975f,_0xf70973);if(!_0x5d21c9)throw new KtNotFoundError('rev\x20'+_0xf70973);return _0x5d21c9;},async 'readFile'(_0x2c5fe7,_0x5d28b5){const _0x1d79d7=_0x3c19,_0x4c8281=await this[_0x1d79d7(0x16f)](_0x2c5fe7),_0x21daaf=_0x4c8281['files'][_0x5d28b5];if(!_0x21daaf)throw new KtNotFoundError(_0x5d28b5);const _0x42ae06=objectPath(_0x18975f,_0x21daaf);if(!existsSync(_0x42ae06))throw new KtNotFoundError(_0x5d28b5);return new Uint8Array(readFileSync(_0x42ae06));},async 'commit'(_0x5761ae){const _0x46889d=_0x3c19;let _0x6a8dc7=_0x5761ae[_0x46889d(0x146)];if(!_0x6a8dc7){const _0x5f1614=await _0x40cfe4[_0x46889d(0x16f)](_0x5761ae['id']);_0x6a8dc7=artifactToFiles(_0x5f1614);}const _0x2fd9b8={},_0x39f314={};for(const [_0x1b7c51,_0x59fb1f]of Object['entries'](_0x6a8dc7)){const _0x4b45f4=typeof _0x59fb1f===_0x46889d(0x179)?_0x59fb1f:new TextDecoder()['decode'](_0x59fb1f);_0x2fd9b8[_0x1b7c51]=_0x4b45f4,_0x39f314[_0x1b7c51]=writeObject(_0x18975f,typeof _0x59fb1f==='string'?Buffer[_0x46889d(0x144)](_0x59fb1f,_0x46889d(0x168)):_0x59fb1f);}const _0x5d0c9b=readLog(_0x18975f,_0x5761ae[_0x46889d(0x177)],_0x5761ae['id']);if(_0x5d0c9b[_0x46889d(0x149)]){const _0x1de677=_0x5d0c9b[_0x46889d(0x188)]['find'](_0x3d5507=>_0x3d5507[_0x46889d(0x15a)]===_0x5d0c9b[_0x46889d(0x149)]);if(_0x1de677&&filesEqual(_0x2fd9b8,filesTextOf(_0x18975f,_0x1de677)))return _0x1de677;}const _0x50be89=new Date(),_0x568e9b=String(_0x50be89[_0x46889d(0x184)]())[_0x46889d(0x16d)](0x2)+String(_0x50be89[_0x46889d(0x170)]()+0x1)['padStart'](0x2,'0')+String(_0x50be89[_0x46889d(0x161)]())['padStart'](0x2,'0')+String(_0x50be89[_0x46889d(0x15e)]())[_0x46889d(0x15f)](0x2,'0')+String(_0x50be89[_0x46889d(0x154)]())[_0x46889d(0x15f)](0x2,'0'),_0x4d1492=sha256Hex(Object['values'](_0x39f314)['sort']()[_0x46889d(0x14b)](','))[_0x46889d(0x16d)](0x0,0x8),_0x24335e={'rev':_0x568e9b+_0x46889d(0x176)+_0x4d1492,'kind':_0x5761ae[_0x46889d(0x177)],'id':_0x5761ae['id'],'at':_0x50be89[_0x46889d(0x185)](),'parent':_0x5d0c9b[_0x46889d(0x149)],'by':_0x5761ae['by'],'note':_0x5761ae[_0x46889d(0x163)],'files':_0x39f314,'meta':_0x5761ae[_0x46889d(0x15d)]};return writeLog(_0x18975f,_0x5761ae[_0x46889d(0x177)],_0x5761ae['id'],_0x24335e[_0x46889d(0x15a)],[..._0x5d0c9b[_0x46889d(0x188)],_0x24335e]),_0x24335e;},async 'restore'(_0x1dbb66,_0x53fbe5,_0x4e1754,_0x2ff4c2){const _0x465fcf=_0x3c19,_0x7de088=await this[_0x465fcf(0x16f)](_0x4e1754),_0x3448db={};for(const _0x1b9d9b of Object['keys'](_0x7de088[_0x465fcf(0x146)])){_0x3448db[_0x1b9d9b]=new TextDecoder()[_0x465fcf(0x155)](await this[_0x465fcf(0x181)](_0x4e1754,_0x1b9d9b));}const _0x219b6a=filesToArtifact(_0x3448db,_0x53fbe5);return await _0x40cfe4[_0x465fcf(0x172)]({..._0x219b6a,'id':_0x53fbe5,'kind':_0x219b6a[_0x465fcf(0x177)],'etag':void 0x0}),this[_0x465fcf(0x169)]({'kind':_0x1dbb66,'id':_0x53fbe5,'files':_0x3448db,'by':_0x2ff4c2,'note':'\u6062\u590D\u81EA\x20'+_0x4e1754});}};}function createKtFsStores(_0x5ee207){const _0x2bd423=_0x10d79a,_0x267e42=createFsArtifactStore(resolveRoot(_0x5ee207[_0x2bd423(0x17c)],_0x5ee207[_0x2bd423(0x17b)]),_0x5ee207[_0x2bd423(0x182)]),_0x3fff59=_0x5ee207['instancesRoot']?createFsInstanceStore(resolveRoot(_0x5ee207[_0x2bd423(0x171)],_0x5ee207[_0x2bd423(0x17b)]),_0x5ee207[_0x2bd423(0x147)]):void 0x0,_0x3d1ac2=_0x5ee207[_0x2bd423(0x183)]?createFsVersionStore(resolveRoot(_0x5ee207[_0x2bd423(0x183)],_0x5ee207[_0x2bd423(0x17b)]),_0x267e42):void 0x0;return{'artifacts':_0x267e42,'instances':_0x3fff59,'versions':_0x3d1ac2};}export{createKtFsStores};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const _0x57821b=_0x1721;function _0xcfa7(){const _0xc101d4=['5yAf6yoO6zsz6k+V','ohDMtwnkva','s3rtDg9YzuvYCM9Y','C2XPy2u','Aw5ZDgfUy2vZioACQUMfJEE9RG','y3vYCMvUDa','C2vHCMnOugfYyw1Z','A2LUza','DMvYC2LVBNm','yxbWBgLJyxrPB24VB2n0zxqTC3rYzwfT','mJy2mNvNvMrIra','CMvTB3zLioACQUwUNUEoSa','C3bSAxq','Bg9N','BgLZDa','5PYQ5OM+5yIW','y29TBwL0','ue9tva','qgSTDgfIBguVCMvWB3j0l3n0B3jL','CMvZDg9Yzq','mta0ntmWveXJu0TN','Aw5ZDgfUy2vZ','ufvu','mJeXmZiYn2rrwuzzva','s3rdB25MBgLJDevYCM9Y','Bwv0Ag9K','BwvZC2fNzq','y3jLyxrLs3riyw5KBgvY','CgfYyw1Z','y3jLyxrLioACQUwUNUEoSa','y3jLyxrL','DMvYC2LVBNmG5PYQ6ywn572U','zgvMAw5Ls3rdB25MAwC','yxj0AwzHy3rZ','BgvUz3rO','Dg9vChbLCKnHC2u','Cgf0Ag5HBwu','nJC3mdGYrevdBM1m','r0vu','z2v0','yxj0AwzHy3rjza','DxjS','Cgf0Aa','nJy5mdi2n2T2swPjtq','ntKZnZC4Ewvvt0T2','mte1ntiYoejxtwDLtq','l2fWAs9RDa','mJfPC2zUAeW','mJu2otC4mhv4B2LkAW','CMvHzezPBgu','nhznwLvfzW','Aw5KzxHpzG'];_0xcfa7=function(){return _0xc101d4;};return _0xcfa7();}(function(_0x2e085e,_0x2ba0a6){const _0x4874bb=_0x1721,_0x4d57b3=_0x2e085e();while(!![]){try{const _0x3f01eb=parseInt(_0x4874bb(0x1e9))/0x1+-parseInt(_0x4874bb(0x1f0))/0x2+parseInt(_0x4874bb(0x20f))/0x3+-parseInt(_0x4874bb(0x1f6))/0x4*(-parseInt(_0x4874bb(0x1f4))/0x5)+parseInt(_0x4874bb(0x1f1))/0x6*(parseInt(_0x4874bb(0x1f3))/0x7)+parseInt(_0x4874bb(0x1f9))/0x8*(parseInt(_0x4874bb(0x1ef))/0x9)+parseInt(_0x4874bb(0x20c))/0xa*(-parseInt(_0x4874bb(0x202))/0xb);if(_0x3f01eb===_0x2ba0a6)break;else _0x4d57b3['push'](_0x4d57b3['shift']());}catch(_0x1bb166){_0x4d57b3['push'](_0x4d57b3['shift']());}}}(_0xcfa7,0x5f315));var store=require(_0x57821b(0x20a));async function pathParts(_0x3a5039,_0x431439){const _0x35423d=_0x57821b,_0x13152b=_0x3a5039[_0x35423d(0x214)]?await _0x3a5039['params']:void 0x0;if(_0x13152b?.[_0x35423d(0x1ee)]?.[_0x35423d(0x1e6)])return _0x13152b['path'];const _0x4b06b5=_0x431439['pathname'][_0x35423d(0x1f7)](_0x35423d(0x1f2)),_0x53bee7=_0x4b06b5>=0x0?_0x431439[_0x35423d(0x1e8)][_0x35423d(0x1fb)](_0x4b06b5+_0x35423d(0x1f2)[_0x35423d(0x1e6)]):_0x431439[_0x35423d(0x1e8)];return _0x53bee7[_0x35423d(0x204)]('/')['filter'](Boolean);}function _0x1721(_0x31eb35,_0x28282a){_0x31eb35=_0x31eb35-0x1e2;const _0xcfa7de=_0xcfa7();let _0x17213f=_0xcfa7de[_0x31eb35];if(_0x1721['IytDXS']===undefined){var _0x32699f=function(_0x2c39b4){const _0x2087ba='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2ccff4='',_0x3a5039='';for(let _0x431439=0x0,_0x13152b,_0x4b06b5,_0x53bee7=0x0;_0x4b06b5=_0x2c39b4['charAt'](_0x53bee7++);~_0x4b06b5&&(_0x13152b=_0x431439%0x4?_0x13152b*0x40+_0x4b06b5:_0x4b06b5,_0x431439++%0x4)?_0x2ccff4+=String['fromCharCode'](0xff&_0x13152b>>(-0x2*_0x431439&0x6)):0x0){_0x4b06b5=_0x2087ba['indexOf'](_0x4b06b5);}for(let _0x2f33b5=0x0,_0x1061f5=_0x2ccff4['length'];_0x2f33b5<_0x1061f5;_0x2f33b5++){_0x3a5039+='%'+('00'+_0x2ccff4['charCodeAt'](_0x2f33b5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3a5039);};_0x1721['CleQGt']=_0x32699f,_0x1721['queuND']={},_0x1721['IytDXS']=!![];}const _0x2ccf1c=_0xcfa7de[0x0];_0x1721['xDfNEC']!==_0x2ccf1c&&(_0x1721['queuND']={},_0x1721['xDfNEC']=_0x2ccf1c);const _0x321e8a=_0x1721['queuND'][_0x31eb35];return _0x321e8a===undefined?(_0x17213f=_0x1721['CleQGt'](_0x17213f),_0x1721['queuND'][_0x31eb35]=_0x17213f):_0x17213f=_0x321e8a,_0x17213f;}function json(_0x2f33b5,_0x1061f5=0xc8){return new Response(JSON['stringify'](_0x2f33b5),{'status':_0x1061f5,'headers':{'content-type':'application/json;\x20charset=utf-8'}});}function fail(_0x1e2ab3){const _0x33a672=_0x57821b;if(_0x1e2ab3 instanceof store[_0x33a672(0x210)])return json({'message':_0x1e2ab3[_0x33a672(0x212)],'current':_0x1e2ab3[_0x33a672(0x1fd)]},0x199);if(_0x1e2ab3 instanceof store['KtNotFoundError'])return json({'message':_0x1e2ab3[_0x33a672(0x212)]},0x194);if(_0x1e2ab3 instanceof store[_0x33a672(0x1fa)])return json({'message':_0x1e2ab3['message']},_0x1e2ab3['status']??0x1f4);return json({'message':_0x1e2ab3 instanceof Error?_0x1e2ab3['message']:_0x33a672(0x1f8)},0x1f4);}async function readBody(_0x25b0eb){const _0x2dab84=await _0x25b0eb['text']();if(!_0x2dab84)return null;return JSON['parse'](_0x2dab84);}function createKtHandler(_0x506eb6){const _0x4b7420=async(_0x311614,_0x3242ac={})=>{const _0x4acbb6=_0x1721;try{const _0x361629=new URL(_0x311614[_0x4acbb6(0x1ed)]),_0x46318f=await pathParts(_0x3242ac,_0x361629),[_0x321d5a,_0x36353d,_0x1c474a]=_0x46318f,_0x4a4359=_0x311614[_0x4acbb6(0x211)][_0x4acbb6(0x1e7)]();if(_0x321d5a===_0x4acbb6(0x1e5)&&!_0x36353d&&_0x4a4359==='GET'){const _0x972bff=_0x361629['searchParams'][_0x4acbb6(0x1eb)](_0x4acbb6(0x1ff));return json({'items':await _0x506eb6[_0x4acbb6(0x1e5)][_0x4acbb6(0x206)](_0x972bff||void 0x0)});}if(_0x321d5a===_0x4acbb6(0x1e5)&&!_0x36353d&&_0x4a4359===_0x4acbb6(0x209)){if(!_0x506eb6[_0x4acbb6(0x1e5)][_0x4acbb6(0x1e2)])return json({'message':_0x4acbb6(0x215)},0x194);return json(await _0x506eb6[_0x4acbb6(0x1e5)][_0x4acbb6(0x1e2)](await readBody(_0x311614)));}if(_0x321d5a===_0x4acbb6(0x1e5)&&_0x36353d&&_0x4a4359===_0x4acbb6(0x1ea))return json(await _0x506eb6[_0x4acbb6(0x1e5)][_0x4acbb6(0x1eb)](_0x36353d));if(_0x321d5a===_0x4acbb6(0x1e5)&&_0x36353d&&_0x4a4359===_0x4acbb6(0x20e))return json(await _0x506eb6[_0x4acbb6(0x1e5)]['save'](await readBody(_0x311614)));if(_0x321d5a===_0x4acbb6(0x1e5)&&_0x36353d&&_0x4a4359==='DELETE'){if(!_0x506eb6[_0x4acbb6(0x1e5)]['remove'])return json({'message':_0x4acbb6(0x203)},0x194);return await _0x506eb6[_0x4acbb6(0x1e5)]['remove'](_0x36353d),json({'ok':!![]});}if(_0x321d5a===_0x4acbb6(0x20d)){if(!_0x506eb6[_0x4acbb6(0x20d)])return json({'message':_0x4acbb6(0x1fc)},0x194);if(!_0x36353d&&_0x4a4359===_0x4acbb6(0x1ea))return json({'items':await _0x506eb6[_0x4acbb6(0x20d)][_0x4acbb6(0x206)]?.(_0x361629[_0x4acbb6(0x1fe)][_0x4acbb6(0x1eb)](_0x4acbb6(0x1ec))??void 0x0)??[]});if(!_0x36353d&&_0x4a4359===_0x4acbb6(0x209)){if(!_0x506eb6[_0x4acbb6(0x20d)]['create'])return json({'message':_0x4acbb6(0x215)},0x194);return json(await _0x506eb6['instances'][_0x4acbb6(0x1e2)](await readBody(_0x311614)));}if(_0x36353d&&_0x4a4359===_0x4acbb6(0x1ea))return json(await _0x506eb6[_0x4acbb6(0x20d)][_0x4acbb6(0x1eb)](_0x36353d));if(_0x36353d&&_0x4a4359===_0x4acbb6(0x20e))return await _0x506eb6[_0x4acbb6(0x20d)]['save'](_0x36353d,await readBody(_0x311614)),json({'ok':!![]});}if(_0x321d5a===_0x4acbb6(0x200)){if(!_0x506eb6[_0x4acbb6(0x200)])return json({'message':_0x4acbb6(0x1e3)},0x194);if(!_0x36353d&&_0x4a4359==='GET'){const _0x542ff9=_0x361629[_0x4acbb6(0x1fe)][_0x4acbb6(0x1eb)](_0x4acbb6(0x1ff))??'',_0x1bb336=_0x361629['searchParams'][_0x4acbb6(0x1eb)]('id')??'';return json(await _0x506eb6[_0x4acbb6(0x200)][_0x4acbb6(0x205)](_0x542ff9,_0x1bb336));}if(!_0x36353d&&_0x4a4359===_0x4acbb6(0x209))return json(await _0x506eb6[_0x4acbb6(0x200)][_0x4acbb6(0x208)](await readBody(_0x311614)));if(_0x36353d&&_0x1c474a==='file'&&_0x4a4359===_0x4acbb6(0x1ea)){const _0x4522b8=await _0x506eb6[_0x4acbb6(0x200)][_0x4acbb6(0x1f5)](_0x36353d,_0x361629['searchParams'][_0x4acbb6(0x1eb)](_0x4acbb6(0x1ee))??'');return new Response(Buffer['from'](_0x4522b8),{'headers':{'content-type':_0x4acbb6(0x201)}});}if(_0x36353d&&_0x1c474a===_0x4acbb6(0x20b)&&_0x4a4359==='POST'){const _0x525934=await readBody(_0x311614);return json(await _0x506eb6[_0x4acbb6(0x200)][_0x4acbb6(0x20b)](_0x525934[_0x4acbb6(0x1ff)],_0x525934['id'],_0x36353d,_0x525934['by']));}if(_0x36353d&&!_0x1c474a&&_0x4a4359==='GET')return json(await _0x506eb6['versions'][_0x4acbb6(0x1eb)](_0x36353d));}return json({'message':_0x4acbb6(0x207)},0x194);}catch(_0x2df919){return fail(_0x2df919);}};return{'GET':_0x4b7420,'POST':_0x4b7420,'PUT':_0x4b7420,'DELETE':_0x4b7420};}function defineKtConfig(_0x358c69){return _0x358c69;}exports[_0x57821b(0x213)]=createKtHandler,exports[_0x57821b(0x1e4)]=defineKtConfig;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x30cce7,_0x16d873){const _0x3e37cb=_0x1666,_0x2558b5=_0x30cce7();while(!![]){try{const _0x2fc00f=parseInt(_0x3e37cb(0x113))/0x1+parseInt(_0x3e37cb(0xfd))/0x2*(-parseInt(_0x3e37cb(0x118))/0x3)+parseInt(_0x3e37cb(0xf4))/0x4*(parseInt(_0x3e37cb(0xef))/0x5)+-parseInt(_0x3e37cb(0x115))/0x6+parseInt(_0x3e37cb(0x11b))/0x7*(-parseInt(_0x3e37cb(0xfa))/0x8)+parseInt(_0x3e37cb(0xf3))/0x9+parseInt(_0x3e37cb(0x119))/0xa;if(_0x2fc00f===_0x16d873)break;else _0x2558b5['push'](_0x2558b5['shift']());}catch(_0xd6ecaf){_0x2558b5['push'](_0x2558b5['shift']());}}}(_0x81cc,0x5956d));function _0x81cc(){const _0x2fb662=['ntmZmtKWnhnqCNL6Aq','C3bSAxq','Cgf0Aa','nhP2uwPdvW','CMvTB3zLioACQUwUNUEoSa','BgvUz3rO','BgLZDa','Aw5KzxHpzG','Aw5ZDgfUy2vZ','Aw5ZDgfUy2vZioACQUMfJEE9RG','C3rYAw5NAwz5','yxj0AwzHy3rjza','Bg9N','ue9tva','ufvu','A2LUza','CgfYC2u','r0vu','y3vYCMvUDa','yxj0AwzHy3rZ','C2vHCMnOugfYyw1Z','BwvZC2fNzq','DMvYC2LVBNmG5PYQ6ywn572U','Dgv4Da','y29TBwL0','mJq2nJe1yxLuufDd','CMvZDg9Yzq','mJmZntGXmND2t2HwCq','yxbWBgLJyxrPB24VANnVBJSGy2HHCNnLDd11DgyToa','CMvTB3zL','ntyXndG5EhrVANLN','odm4mtK2mhr6rLzrwG','z2v0','n2rly2Peza','revmrvrf','DMvYC2LVBNm','CMvHzezPBgu','zMLSzq','C2XPy2u','DxjS','mJC3mhHzqvDfCG','CgfYyw1Z','C3rHDhvZ','Dg9vChbLCKnHC2u','ntaYmdaYmeTWD3fpDW','mteWognptwvHuq','zMLSDgvY','l2fWAs9RDa','C2f2zq','y3jLyxrLioACQUwUNUEoSa','y3jLyxrL'];_0x81cc=function(){return _0x2fb662;};return _0x81cc();}import{KtConflictError,KtNotFoundError,KtStoreError}from'@k-table/report/store';async function pathParts(_0x5e8320,_0x28b89c){const _0xfa9480=_0x1666,_0x43f544=_0x5e8320[_0xfa9480(0xf0)]?await _0x5e8320[_0xfa9480(0xf0)]:void 0x0;if(_0x43f544?.[_0xfa9480(0xfc)]?.[_0xfa9480(0xff)])return _0x43f544['path'];const _0x592c8f=_0x28b89c['pathname'][_0xfa9480(0x101)]('/api/kt'),_0x2690ee=_0x592c8f>=0x0?_0x28b89c['pathname'][_0xfa9480(0xed)](_0x592c8f+_0xfa9480(0xf6)[_0xfa9480(0xff)]):_0x28b89c['pathname'];return _0x2690ee[_0xfa9480(0xfb)]('/')[_0xfa9480(0xf5)](Boolean);}function json(_0x535116,_0x34bcd7=0xc8){const _0x358db3=_0x1666;return new Response(JSON[_0x358db3(0x104)](_0x535116),{'status':_0x34bcd7,'headers':{'content-type':_0x358db3(0x116)}});}function fail(_0x5856bd){const _0x49f5ad=_0x1666;if(_0x5856bd instanceof KtConflictError)return json({'message':_0x5856bd[_0x49f5ad(0x10f)],'current':_0x5856bd[_0x49f5ad(0x10c)]},0x199);if(_0x5856bd instanceof KtNotFoundError)return json({'message':_0x5856bd[_0x49f5ad(0x10f)]},0x194);if(_0x5856bd instanceof KtStoreError)return json({'message':_0x5856bd['message']},_0x5856bd[_0x49f5ad(0xf1)]??0x1f4);return json({'message':_0x5856bd instanceof Error?_0x5856bd['message']:'\u5185\u90E8\u9519\u8BEF'},0x1f4);}async function readBody(_0x2b629f){const _0x5b939c=_0x1666,_0x2af377=await _0x2b629f[_0x5b939c(0x111)]();if(!_0x2af377)return null;return JSON[_0x5b939c(0x10a)](_0x2af377);}function createKtHandler(_0x167462){const _0x39dcb1=async(_0x8f2e98,_0x2dc771={})=>{const _0x3b79c6=_0x1666;try{const _0x2505d3=new URL(_0x8f2e98[_0x3b79c6(0xee)]),_0x54170f=await pathParts(_0x2dc771,_0x2505d3),[_0x4eca9b,_0x15d276,_0x51749b]=_0x54170f,_0x110e26=_0x8f2e98['method'][_0x3b79c6(0xf2)]();if(_0x4eca9b===_0x3b79c6(0x10d)&&!_0x15d276&&_0x110e26===_0x3b79c6(0x10b)){const _0x8e0868=_0x2505d3[_0x3b79c6(0x10e)]['get'](_0x3b79c6(0x109));return json({'items':await _0x167462['artifacts'][_0x3b79c6(0x100)](_0x8e0868||void 0x0)});}if(_0x4eca9b===_0x3b79c6(0x10d)&&!_0x15d276&&_0x110e26===_0x3b79c6(0x107)){if(!_0x167462['artifacts'][_0x3b79c6(0xf9)])return json({'message':_0x3b79c6(0xf8)},0x194);return json(await _0x167462['artifacts'][_0x3b79c6(0xf9)](await readBody(_0x8f2e98)));}if(_0x4eca9b===_0x3b79c6(0x10d)&&_0x15d276&&_0x110e26===_0x3b79c6(0x10b))return json(await _0x167462[_0x3b79c6(0x10d)][_0x3b79c6(0x11a)](_0x15d276));if(_0x4eca9b===_0x3b79c6(0x10d)&&_0x15d276&&_0x110e26===_0x3b79c6(0x108))return json(await _0x167462[_0x3b79c6(0x10d)][_0x3b79c6(0xf7)](await readBody(_0x8f2e98)));if(_0x4eca9b===_0x3b79c6(0x10d)&&_0x15d276&&_0x110e26===_0x3b79c6(0x11c)){if(!_0x167462['artifacts'][_0x3b79c6(0x117)])return json({'message':_0x3b79c6(0xfe)},0x194);return await _0x167462[_0x3b79c6(0x10d)][_0x3b79c6(0x117)](_0x15d276),json({'ok':!![]});}if(_0x4eca9b===_0x3b79c6(0x102)){if(!_0x167462[_0x3b79c6(0x102)])return json({'message':_0x3b79c6(0x103)},0x194);if(!_0x15d276&&_0x110e26===_0x3b79c6(0x10b))return json({'items':await _0x167462['instances'][_0x3b79c6(0x100)]?.(_0x2505d3[_0x3b79c6(0x10e)][_0x3b79c6(0x11a)](_0x3b79c6(0x105))??void 0x0)??[]});if(!_0x15d276&&_0x110e26==='POST'){if(!_0x167462[_0x3b79c6(0x102)][_0x3b79c6(0xf9)])return json({'message':'create\x20\u672A\u5B9E\u73B0'},0x194);return json(await _0x167462['instances']['create'](await readBody(_0x8f2e98)));}if(_0x15d276&&_0x110e26===_0x3b79c6(0x10b))return json(await _0x167462[_0x3b79c6(0x102)][_0x3b79c6(0x11a)](_0x15d276));if(_0x15d276&&_0x110e26==='PUT')return await _0x167462[_0x3b79c6(0x102)]['save'](_0x15d276,await readBody(_0x8f2e98)),json({'ok':!![]});}if(_0x4eca9b===_0x3b79c6(0x11d)){if(!_0x167462['versions'])return json({'message':_0x3b79c6(0x110)},0x194);if(!_0x15d276&&_0x110e26==='GET'){const _0x347cd2=_0x2505d3[_0x3b79c6(0x10e)][_0x3b79c6(0x11a)]('kind')??'',_0x354625=_0x2505d3[_0x3b79c6(0x10e)][_0x3b79c6(0x11a)]('id')??'';return json(await _0x167462[_0x3b79c6(0x11d)][_0x3b79c6(0x106)](_0x347cd2,_0x354625));}if(!_0x15d276&&_0x110e26==='POST')return json(await _0x167462[_0x3b79c6(0x11d)][_0x3b79c6(0x112)](await readBody(_0x8f2e98)));if(_0x15d276&&_0x51749b===_0x3b79c6(0x11f)&&_0x110e26===_0x3b79c6(0x10b)){const _0x47f819=await _0x167462[_0x3b79c6(0x11d)][_0x3b79c6(0x11e)](_0x15d276,_0x2505d3[_0x3b79c6(0x10e)][_0x3b79c6(0x11a)](_0x3b79c6(0xfc))??'');return new Response(Buffer['from'](_0x47f819),{'headers':{'content-type':'application/octet-stream'}});}if(_0x15d276&&_0x51749b===_0x3b79c6(0x114)&&_0x110e26===_0x3b79c6(0x107)){const _0x2ef2af=await readBody(_0x8f2e98);return json(await _0x167462[_0x3b79c6(0x11d)][_0x3b79c6(0x114)](_0x2ef2af['kind'],_0x2ef2af['id'],_0x15d276,_0x2ef2af['by']));}if(_0x15d276&&!_0x51749b&&_0x110e26===_0x3b79c6(0x10b))return json(await _0x167462[_0x3b79c6(0x11d)][_0x3b79c6(0x11a)](_0x15d276));}return json({'message':'\u672A\u627E\u5230'},0x194);}catch(_0x2c3f14){return fail(_0x2c3f14);}};return{'GET':_0x39dcb1,'POST':_0x39dcb1,'PUT':_0x39dcb1,'DELETE':_0x39dcb1};}function defineKtConfig(_0xbcc98f){return _0xbcc98f;}function _0x1666(_0x247e35,_0x38da69){_0x247e35=_0x247e35-0xed;const _0x81cc65=_0x81cc();let _0x166650=_0x81cc65[_0x247e35];if(_0x1666['iartxa']===undefined){var _0x592af8=function(_0x12e5ea){const _0x5b8284='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4abc34='',_0x5e8320='';for(let _0x28b89c=0x0,_0x43f544,_0x592c8f,_0x2690ee=0x0;_0x592c8f=_0x12e5ea['charAt'](_0x2690ee++);~_0x592c8f&&(_0x43f544=_0x28b89c%0x4?_0x43f544*0x40+_0x592c8f:_0x592c8f,_0x28b89c++%0x4)?_0x4abc34+=String['fromCharCode'](0xff&_0x43f544>>(-0x2*_0x28b89c&0x6)):0x0){_0x592c8f=_0x5b8284['indexOf'](_0x592c8f);}for(let _0x535116=0x0,_0x34bcd7=_0x4abc34['length'];_0x535116<_0x34bcd7;_0x535116++){_0x5e8320+='%'+('00'+_0x4abc34['charCodeAt'](_0x535116)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5e8320);};_0x1666['MBRXMT']=_0x592af8,_0x1666['QSVlSN']={},_0x1666['iartxa']=!![];}const _0x1b7b60=_0x81cc65[0x0];_0x1666['aFrgVb']!==_0x1b7b60&&(_0x1666['QSVlSN']={},_0x1666['aFrgVb']=_0x1b7b60);const _0x2552f7=_0x1666['QSVlSN'][_0x247e35];return _0x2552f7===undefined?(_0x166650=_0x1666['MBRXMT'](_0x166650),_0x1666['QSVlSN'][_0x247e35]=_0x166650):_0x166650=_0x2552f7,_0x166650;}export{createKtHandler,defineKtConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-table/next",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"publishConfig": { "access": "public" },
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "KT Next 适配:/api/kt 默认 handler 与 fs 存储(无鉴权)",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@k-table/report": "^1.0.
|
|
30
|
+
"@k-table/report": "^1.0.12"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"next": ">=15"
|