@treasuredata/tdx 0.16.2 → 0.16.3
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/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.d.ts +9 -0
- package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/environment.js.map +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5a8b50,_0x28bd60){const _0x54a019=a159_0x3795,_0x2db778=_0x5a8b50();while(!![]){try{const _0x2098e4=parseInt(_0x54a019(0x126))/0x1+-parseInt(_0x54a019(0x124))/0x2*(-parseInt(_0x54a019(0x117))/0x3)+-parseInt(_0x54a019(0x11d))/0x4+-parseInt(_0x54a019(0x11b))/0x5*(-parseInt(_0x54a019(0x11f))/0x6)+-parseInt(_0x54a019(0x116))/0x7+parseInt(_0x54a019(0x128))/0x8*(parseInt(_0x54a019(0x113))/0x9)+-parseInt(_0x54a019(0x123))/0xa*(parseInt(_0x54a019(0x120))/0xb);if(_0x2098e4===_0x28bd60)break;else _0x2db778['push'](_0x2db778['shift']());}catch(_0x37f724){_0x2db778['push'](_0x2db778['shift']());}}}(a159_0x3668,0x85a97));import{readFile}from'fs/promises';import{SDKError,ErrorCode}from'../sdk/errors.js';function a159_0x3795(_0x31c25e,_0x1ca3b4){_0x31c25e=_0x31c25e-0x111;const _0x36682e=a159_0x3668();let _0x37959f=_0x36682e[_0x31c25e];return _0x37959f;}export async function loadJSON(_0x1391d5,_0x491d48){const _0x39d46f=a159_0x3795;try{if(_0x491d48){const _0x4dc37c=await readFile(_0x1391d5,_0x39d46f(0x11e));try{return JSON[_0x39d46f(0x111)](_0x4dc37c);}catch(_0x366b45){throw new SDKError(ErrorCode[_0x39d46f(0x125)],_0x39d46f(0x112)+_0x1391d5+_0x39d46f(0x118)+(_0x366b45 instanceof Error?_0x366b45[_0x39d46f(0x11c)]:String(_0x366b45)));}}else try{return JSON[_0x39d46f(0x111)](_0x1391d5);}catch(_0x4cd440){throw new SDKError(ErrorCode[_0x39d46f(0x125)],_0x39d46f(0x115)+(_0x4cd440 instanceof Error?_0x4cd440[_0x39d46f(0x11c)]:String(_0x4cd440)));}}catch(_0x167048){if(_0x167048 instanceof SDKError)throw _0x167048;if(_0x167048 instanceof Error&&'code'in _0x167048){const _0x41fb2b=_0x167048;if(_0x41fb2b[_0x39d46f(0x119)]===_0x39d46f(0x121))throw new SDKError(ErrorCode[_0x39d46f(0x114)],'File\x20not\x20found:\x20'+_0x1391d5);else{if(_0x41fb2b[_0x39d46f(0x119)]==='EACCES')throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied\x20reading\x20file:\x20'+_0x1391d5);}}throw new SDKError(ErrorCode[_0x39d46f(0x127)],_0x39d46f(0x122)+(_0x167048 instanceof Error?_0x167048['message']:String(_0x167048)));}}export async function loadJSONFromOptions(_0x26d775,_0x4cc8c4){const _0x56683a=a159_0x3795;if(_0x26d775&&_0x4cc8c4)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x56683a(0x11a));if(_0x26d775)return await loadJSON(_0x26d775,![]);if(_0x4cc8c4)return await loadJSON(_0x4cc8c4,!![]);return undefined;}function a159_0x3668(){const _0x5efa62=['NOT_FOUND','Invalid\x20JSON\x20string:\x20','1114876PneVXd','24711DdgtmH','\x27:\x20','code','Cannot\x20specify\x20both\x20inline\x20JSON\x20and\x20file\x20path.\x20Use\x20one\x20or\x20the\x20other.','3419545LOozwQ','message','3645240TeBWqp','utf-8','6PpvLdB','11gKjjwF','ENOENT','Failed\x20to\x20load\x20JSON:\x20','8491980XJxMKJ','62KwFynM','INVALID_ARGUMENT','673995UEYkTQ','INTERNAL','96fexuUF','parse','Invalid\x20JSON\x20in\x20file\x20\x27','640503xbgWsT'];a159_0x3668=function(){return _0x5efa62;};return a159_0x3668();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x20385e,_0x350e82){const _0x19ed8f=a160_0x3e30,_0x5ac395=_0x20385e();while(!![]){try{const _0x2a73be=parseInt(_0x19ed8f(0x12c))/0x1*(-parseInt(_0x19ed8f(0x129))/0x2)+-parseInt(_0x19ed8f(0x11f))/0x3+-parseInt(_0x19ed8f(0x123))/0x4*(parseInt(_0x19ed8f(0x12d))/0x5)+-parseInt(_0x19ed8f(0x121))/0x6*(-parseInt(_0x19ed8f(0x126))/0x7)+parseInt(_0x19ed8f(0x124))/0x8+parseInt(_0x19ed8f(0x128))/0x9+parseInt(_0x19ed8f(0x12f))/0xa*(-parseInt(_0x19ed8f(0x127))/0xb);if(_0x2a73be===_0x350e82)break;else _0x5ac395['push'](_0x5ac395['shift']());}catch(_0x4ae223){_0x5ac395['push'](_0x5ac395['shift']());}}}(a160_0x157e,0xc7b30));export function validateLimitOption(_0x211eb7){const _0x5884fa=a160_0x3e30;if(!Number[_0x5884fa(0x12b)](_0x211eb7))return{'isValid':![],'error':'Invalid\x20limit\x20value:\x20'+_0x211eb7+_0x5884fa(0x11e)};if(_0x211eb7<=0x0)return{'isValid':![],'error':_0x5884fa(0x12e)+_0x211eb7+_0x5884fa(0x120)};return{'isValid':!![],'value':_0x211eb7};}function a160_0x157e(){const _0x3a34b5=['1248622mBtRrf','number','isInteger','2dapFwP','25cNngCy','Invalid\x20limit\x20value:\x20','11710vkAQoN','.\x20Must\x20be\x20an\x20integer.','1518756YBxpSB','.\x20Must\x20be\x20a\x20positive\x20integer.','990246AUkTNb','Invalid\x20timeout\x20value:\x20','347012EpqNYn','7807640SVDfYn','.\x20Must\x20be\x20a\x20number.','42DQBVaF','253TvWcDl','9606051HdYTMy'];a160_0x157e=function(){return _0x3a34b5;};return a160_0x157e();}function a160_0x3e30(_0x3d3ce5,_0x144a20){_0x3d3ce5=_0x3d3ce5-0x11e;const _0x157eb9=a160_0x157e();let _0x3e3070=_0x157eb9[_0x3d3ce5];return _0x3e3070;}export function validateTimeoutOption(_0x14538a,_0xde4e83=0x1e){const _0x5d8fa5=a160_0x3e30;if(_0x14538a===undefined)return{'isValid':!![],'value':_0xde4e83};const _0x4e7775=typeof _0x14538a===_0x5d8fa5(0x12a)?_0x14538a:parseFloat(_0x14538a);if(isNaN(_0x4e7775))return{'isValid':![],'error':_0x5d8fa5(0x122)+_0x14538a+_0x5d8fa5(0x125)};if(_0x4e7775<=0x0)return{'isValid':![],'error':_0x5d8fa5(0x122)+_0x4e7775+'.\x20Must\x20be\x20a\x20positive\x20number.'};return{'isValid':!![],'value':_0x4e7775};}
|
package/dist/utils/port.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a161_0x511e(){const _0x33ffe7=['error','3548084AebdzT','code','418859SnqRPN','360MQnhri','2390376QjMfRQ','86jaMIcc','1693095nPfSlI','14588430cYHVQs','listen','5KcZxFs','\x20and\x20','26856hOtQcz','once','57543evGGYg'];a161_0x511e=function(){return _0x33ffe7;};return a161_0x511e();}function a161_0xd0a7(_0x348e6b,_0x213809){_0x348e6b=_0x348e6b-0x19b;const _0x511e8e=a161_0x511e();let _0xd0a7a2=_0x511e8e[_0x348e6b];return _0xd0a7a2;}(function(_0xcd0477,_0x48a3ec){const _0x570bb4=a161_0xd0a7,_0x29d6f1=_0xcd0477();while(!![]){try{const _0x52accd=parseInt(_0x570bb4(0x1a7))/0x1+-parseInt(_0x570bb4(0x1a6))/0x2*(parseInt(_0x570bb4(0x19f))/0x3)+parseInt(_0x570bb4(0x1a1))/0x4*(-parseInt(_0x570bb4(0x19b))/0x5)+-parseInt(_0x570bb4(0x1a5))/0x6+parseInt(_0x570bb4(0x1a3))/0x7+-parseInt(_0x570bb4(0x1a4))/0x8*(parseInt(_0x570bb4(0x19d))/0x9)+parseInt(_0x570bb4(0x1a8))/0xa;if(_0x52accd===_0x48a3ec)break;else _0x29d6f1['push'](_0x29d6f1['shift']());}catch(_0x1cd74f){_0x29d6f1['push'](_0x29d6f1['shift']());}}}(a161_0x511e,0xec27f));import{createServer}from'node:net';export async function isPortAvailable(_0x580828){return new Promise(_0x1476f8=>{const _0x4eecac=a161_0xd0a7,_0x226de7=createServer();_0x226de7[_0x4eecac(0x19e)](_0x4eecac(0x1a0),_0x58e572=>{const _0x320c7c=_0x4eecac;_0x58e572[_0x320c7c(0x1a2)]==='EADDRINUSE'?_0x1476f8(![]):_0x1476f8(![]);}),_0x226de7[_0x4eecac(0x19e)]('listening',()=>{_0x226de7['close'](),_0x1476f8(!![]);}),_0x226de7[_0x4eecac(0x1a9)](_0x580828,'0.0.0.0');});}export async function findAvailablePort(_0x2ebbb9=0xfa0,_0x3650ae=0x64){const _0x49c089=a161_0xd0a7;for(let _0x3f2c48=0x0;_0x3f2c48<_0x3650ae;_0x3f2c48++){const _0x3a7c5b=_0x2ebbb9+_0x3f2c48;if(await isPortAvailable(_0x3a7c5b))return _0x3a7c5b;}throw new Error('No\x20available\x20port\x20found\x20between\x20'+_0x2ebbb9+_0x49c089(0x19c)+(_0x2ebbb9+_0x3650ae-0x1));}
|
package/dist/utils/process.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a162_0x566437=a162_0x1d50;(function(_0x54c745,_0x242020){const _0x10e869=a162_0x1d50,_0x150947=_0x54c745();while(!![]){try{const _0x5d1282=parseInt(_0x10e869(0x1fb))/0x1*(parseInt(_0x10e869(0x1e0))/0x2)+-parseInt(_0x10e869(0x1e5))/0x3*(parseInt(_0x10e869(0x1de))/0x4)+parseInt(_0x10e869(0x1fc))/0x5+parseInt(_0x10e869(0x1df))/0x6*(parseInt(_0x10e869(0x201))/0x7)+parseInt(_0x10e869(0x1d5))/0x8*(-parseInt(_0x10e869(0x205))/0x9)+-parseInt(_0x10e869(0x1e9))/0xa*(-parseInt(_0x10e869(0x1e7))/0xb)+-parseInt(_0x10e869(0x1f5))/0xc;if(_0x5d1282===_0x242020)break;else _0x150947['push'](_0x150947['shift']());}catch(_0x45a77d){_0x150947['push'](_0x150947['shift']());}}}(a162_0x393d,0x9a586));import{execSync,spawn}from'node:child_process';const SHELL_NAMES=new Set([a162_0x566437(0x1d8),a162_0x566437(0x1f6),'sh','fish',a162_0x566437(0x1f0),a162_0x566437(0x1e8),a162_0x566437(0x1f7),a162_0x566437(0x1d3),'pwsh','powershell','nu',a162_0x566437(0x1d0),'elvish','xonsh']),EPHEMERAL_SHELL_SPAWNERS=new Set([a162_0x566437(0x1d7),a162_0x566437(0x1f2),a162_0x566437(0x204)]);function getProcessInfoWindows(_0x266020){const _0x4843f3=a162_0x566437;try{if(!Number[_0x4843f3(0x208)](_0x266020)||_0x266020<=0x0)return null;const _0x3ed412='Get-CimInstance\x20Win32_Process\x20-Filter\x20\x22ProcessId='+_0x266020+_0x4843f3(0x1eb),_0x4026e6=execSync('powershell.exe\x20-NoProfile\x20-NonInteractive\x20-Command\x20\x22'+_0x3ed412+'\x22',{'encoding':_0x4843f3(0x1ea),'windowsHide':!![],'stdio':['pipe',_0x4843f3(0x1ec),'pipe']})[_0x4843f3(0x1fe)]();if(!_0x4026e6)return null;const [_0x598029,..._0x3b9929]=_0x4026e6[_0x4843f3(0x1d4)](','),_0x1ade9c=parseInt(_0x598029,0xa),_0x5a0260=_0x3b9929['join'](',')[_0x4843f3(0x1fe)]();if(isNaN(_0x1ade9c)||!_0x5a0260)return null;return{'pid':_0x266020,'ppid':_0x1ade9c,'comm':_0x5a0260[_0x4843f3(0x1d2)](/\.exe$/i,'')};}catch{return null;}}function getProcessInfoPosix(_0x44cdb7){const _0x3f0bea=a162_0x566437;try{const _0x241c65=0x400000;if(!Number['isInteger'](_0x44cdb7)||_0x44cdb7<=0x0||_0x44cdb7>_0x241c65)return null;const _0xd2946b=execSync('ps\x20-p\x20'+_0x44cdb7+_0x3f0bea(0x1f3),{'encoding':_0x3f0bea(0x1ea),'stdio':'pipe'})['trim'](),[_0x58b31b,..._0x26cb18]=_0xd2946b[_0x3f0bea(0x1d4)](/\s+/),_0x8e9ba3=parseInt(_0x58b31b,0xa),_0x759984=_0x26cb18[_0x3f0bea(0x1dc)]('\x20');if(isNaN(_0x8e9ba3))return null;return{'pid':_0x44cdb7,'ppid':_0x8e9ba3,'comm':_0x759984};}catch{return null;}}function getProcessInfo(_0x34a9ed){const _0x5420ce=a162_0x566437;if(process[_0x5420ce(0x1d6)]===_0x5420ce(0x1db))return getProcessInfoWindows(_0x34a9ed);return getProcessInfoPosix(_0x34a9ed);}function getBasename(_0x9b35fa){const _0x1c84e2=a162_0x566437;return _0x9b35fa[_0x1c84e2(0x1d2)](/^-/,'')[_0x1c84e2(0x1d4)]('/')[_0x1c84e2(0x1dd)]()?.[_0x1c84e2(0x1f1)]()||'';}function a162_0x1d50(_0x27998a,_0x3d1b55){_0x27998a=_0x27998a-0x1cf;const _0x393db0=a162_0x393d();let _0x1d5033=_0x393db0[_0x27998a];return _0x1d5033;}function isShell(_0x4adf1d){const _0x299567=a162_0x566437;return SHELL_NAMES[_0x299567(0x1e4)](getBasename(_0x4adf1d));}function isEphemeralShellSpawner(_0x3cccb4){return EPHEMERAL_SHELL_SPAWNERS['has'](getBasename(_0x3cccb4));}let cachedShellPID;function findShellPID(){const _0xd8a8ab=a162_0x566437;if(process[_0xd8a8ab(0x1da)]===undefined)return process[_0xd8a8ab(0x200)];let _0xacc548=process[_0xd8a8ab(0x1da)];const _0x3bdd87=0xa;let _0x4cf52a=0x0;while(_0x4cf52a<_0x3bdd87){const _0x57a5d2=getProcessInfo(_0xacc548);if(!_0x57a5d2)break;if(isShell(_0x57a5d2[_0xd8a8ab(0x203)])){const _0xd2c203=getProcessInfo(_0x57a5d2['ppid']);if(_0xd2c203&&isEphemeralShellSpawner(_0xd2c203[_0xd8a8ab(0x203)])){_0xacc548=_0x57a5d2[_0xd8a8ab(0x1da)],_0x4cf52a++;continue;}return _0x57a5d2['pid'];}if(_0x57a5d2[_0xd8a8ab(0x1da)]===0x0||_0x57a5d2['ppid']===0x1){if(isShell(_0x57a5d2['comm']))return _0x57a5d2[_0xd8a8ab(0x200)];break;}_0xacc548=_0x57a5d2['ppid'],_0x4cf52a++;}return process[_0xd8a8ab(0x1da)]!==undefined?process['ppid']:process[_0xd8a8ab(0x200)];}export function getPPID(){return cachedShellPID===undefined&&(cachedShellPID=findShellPID()),cachedShellPID;}export function clearPPIDCache(){cachedShellPID=undefined;}export function isProcessRunning(_0x49a817){const _0xd22ff5=a162_0x566437;if(!Number[_0xd22ff5(0x208)](_0x49a817)||_0x49a817<=0x0)return![];try{return process[_0xd22ff5(0x1ef)](_0x49a817,0x0),!![];}catch{return![];}}export function openBrowser(_0x2910ad){const _0x3d462a=a162_0x566437;let _0x144b4b;try{_0x144b4b=new URL(_0x2910ad);}catch{throw new Error(_0x3d462a(0x1f8)+_0x2910ad);}if(_0x144b4b['protocol']!==_0x3d462a(0x1f4)&&_0x144b4b[_0x3d462a(0x206)]!==_0x3d462a(0x1e2))throw new Error('Unsupported\x20protocol:\x20'+_0x144b4b[_0x3d462a(0x206)]);const _0x5eec14=_0x144b4b[_0x3d462a(0x1e3)],_0x457399=process[_0x3d462a(0x1d6)];if(_0x457399==='win32')spawn('cmd.exe',['/c','start','',_0x5eec14],{'detached':!![],'stdio':'ignore'})[_0x3d462a(0x1ed)]();else{const _0x31a735=_0x457399==='darwin'?_0x3d462a(0x1d1):_0x3d462a(0x1e1);spawn(_0x31a735,[_0x5eec14],{'detached':!![],'stdio':_0x3d462a(0x1ee)})[_0x3d462a(0x1ed)]();}}function a162_0x393d(){const _0x3f718c=['508636RjJqYL','xdg-open','https:','href','has','21lecdYo','map','155749VCQuPB','tcsh','830ooXIVf','utf-8','\x22\x20|\x20Select-Object\x20-Property\x20ParentProcessId,Name\x20|\x20ForEach-Object\x20{\x20\x22$($_.ParentProcessId),$($_.Name)\x22\x20}','pipe','unref','ignore','kill','ksh','toLowerCase','code','\x20-o\x20ppid=,comm=','http:','21181752CuNPoL','zsh','csh','Invalid\x20URL:\x20','which','toString','1rfMBjj','3450755KINmEG','exit','trim','data','pid','5794733XvCeWo','where.exe','comm','cursor','99SBlVeI','protocol','error','isInteger','stderr','ion','open','replace','dash','split','367088TohZVQ','platform','claude','bash','stdout','ppid','win32','join','pop','25940vjSRlI','6mSgbva'];a162_0x393d=function(){return _0x3f718c;};return a162_0x393d();}export function isWindows(){const _0x5c70b5=a162_0x566437;return process[_0x5c70b5(0x1d6)]===_0x5c70b5(0x1db);}export function getCrossSpawnOptions(_0x35cfee){return{..._0x35cfee??{},'shell':isWindows()};}export function escapeWindowsArg(_0x474531){const _0x57e97f=a162_0x566437;if(!/[ \t"&|<>^%!`\r\n]/['test'](_0x474531))return _0x474531;const _0x3de3da=_0x474531[_0x57e97f(0x1d2)](/"/g,'\x22\x22');return'\x22'+_0x3de3da+'\x22';}export function crossSpawn(_0xbca48a,_0x29e7a6,_0x950ece){const _0x1814e8=a162_0x566437;if(isWindows()){const _0x33cb38=escapeWindowsArg(_0xbca48a),_0x9e83a2=_0x29e7a6[_0x1814e8(0x1e6)](escapeWindowsArg),_0x1e2106=[_0x33cb38,..._0x9e83a2]['join']('\x20');return spawn(_0x1e2106,[],{..._0x950ece,'shell':!![]});}return spawn(_0xbca48a,_0x29e7a6,{..._0x950ece,'shell':![]});}export function findExecutable(_0x2d40bb,_0x52e545=0x1388){return new Promise(_0x14cf16=>{const _0x2a6f80=a162_0x1d50,_0x5275f8=isWindows()?_0x2a6f80(0x202):_0x2a6f80(0x1f9);let _0xf7ff33=![];const _0x2e3920=crossSpawn(_0x5275f8,[_0x2d40bb],{'stdio':_0x2a6f80(0x1ec)}),_0x2cf926=setTimeout(()=>{const _0x27dc62=_0x2a6f80;!_0xf7ff33&&(_0xf7ff33=!![],_0x2e3920[_0x27dc62(0x1ef)](),_0x14cf16(null));},_0x52e545);let _0x4661c7='';_0x2e3920[_0x2a6f80(0x1d9)]?.['on'](_0x2a6f80(0x1ff),_0x4b4bb8=>{const _0x3ea16e=_0x2a6f80;_0x4661c7+=_0x4b4bb8[_0x3ea16e(0x1fa)]();}),_0x2e3920[_0x2a6f80(0x1cf)]?.['on'](_0x2a6f80(0x1ff),()=>{}),_0x2e3920['on'](_0x2a6f80(0x1fd),_0x5dc43b=>{const _0x5a2c38=_0x2a6f80;if(_0xf7ff33)return;_0xf7ff33=!![],clearTimeout(_0x2cf926);if(_0x5dc43b===0x0&&_0x4661c7[_0x5a2c38(0x1fe)]()){const _0x18971b=_0x4661c7[_0x5a2c38(0x1fe)]()[_0x5a2c38(0x1d4)](/\r?\n/)[0x0];_0x14cf16(_0x18971b);}else _0x14cf16(null);}),_0x2e3920['on'](_0x2a6f80(0x207),()=>{if(_0xf7ff33)return;_0xf7ff33=!![],clearTimeout(_0x2cf926),_0x14cf16(null);});});}
|
package/dist/utils/prompt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x896226,_0xf67505){const _0x358bbc=a163_0x124c,_0x3d22ab=_0x896226();while(!![]){try{const _0x1e4e87=-parseInt(_0x358bbc(0x183))/0x1*(-parseInt(_0x358bbc(0x175))/0x2)+-parseInt(_0x358bbc(0x18d))/0x3+-parseInt(_0x358bbc(0x181))/0x4*(-parseInt(_0x358bbc(0x186))/0x5)+-parseInt(_0x358bbc(0x188))/0x6*(parseInt(_0x358bbc(0x18c))/0x7)+parseInt(_0x358bbc(0x187))/0x8*(-parseInt(_0x358bbc(0x189))/0x9)+parseInt(_0x358bbc(0x17e))/0xa+-parseInt(_0x358bbc(0x179))/0xb*(-parseInt(_0x358bbc(0x17c))/0xc);if(_0x1e4e87===_0xf67505)break;else _0x3d22ab['push'](_0x3d22ab['shift']());}catch(_0x4b79d7){_0x3d22ab['push'](_0x3d22ab['shift']());}}}(a163_0x37f0,0xd3f9e));import*as a163_0x47e7cd from'readline';function a163_0x37f0(){const _0x522151=['282151wCaHfA','stderr','stdin','22450XvUrmf','110920IEAdQE','6EVIYTK','99rNiNgG','createInterface','yes','8414203dbnDHv','2753571dhrZtd','data','4qfvikx','toLowerCase','\x20(y/N):\x20','question','1090496tGJXBk','resume','isTTY','144BMQbLB','close','6817910KqqQzE','utf8','write','628PrAOIB','pause'];a163_0x37f0=function(){return _0x522151;};return a163_0x37f0();}function a163_0x124c(_0x28f5bc,_0x1545e9){_0x28f5bc=_0x28f5bc-0x175;const _0x37f0e2=a163_0x37f0();let _0x124c6b=_0x37f0e2[_0x28f5bc];return _0x124c6b;}export async function confirm(_0x33abca){const _0x2f6f36=a163_0x124c,_0x4e22c0=a163_0x47e7cd[_0x2f6f36(0x18a)]({'input':process[_0x2f6f36(0x185)],'output':process['stdout']});return new Promise(_0x181bec=>{const _0x30cdd5=_0x2f6f36;_0x4e22c0[_0x30cdd5(0x178)](_0x33abca+_0x30cdd5(0x177),_0x27d032=>{const _0x25e745=_0x30cdd5;_0x4e22c0[_0x25e745(0x17d)](),_0x181bec(_0x27d032[_0x25e745(0x176)]()==='y'||_0x27d032[_0x25e745(0x176)]()===_0x25e745(0x18b));});});}export async function confirmKey(_0x3d3e4e){const _0x4c824f=a163_0x124c;if(!process[_0x4c824f(0x185)][_0x4c824f(0x17b)])return![];return process['stderr'][_0x4c824f(0x180)](_0x3d3e4e+'\x20[y/N]\x20'),new Promise(_0x52687f=>{const _0x37b35e=_0x4c824f,_0x53cd82=process[_0x37b35e(0x185)];_0x53cd82['setRawMode'](!![]),_0x53cd82[_0x37b35e(0x17a)](),_0x53cd82['setEncoding'](_0x37b35e(0x17f));const _0x1bfaba=_0x15a568=>{const _0x24668d=_0x37b35e;_0x53cd82['setRawMode'](![]),_0x53cd82[_0x24668d(0x182)](),_0x53cd82['removeListener'](_0x24668d(0x18e),_0x1bfaba);if(_0x15a568==='\x1b'){process[_0x24668d(0x184)][_0x24668d(0x180)]('\x0a'),_0x52687f(![]);return;}_0x15a568==='\x03'&&(process[_0x24668d(0x184)]['write']('\x0a'),process['exit'](0x82));if(_0x15a568[_0x24668d(0x176)]()==='y'){process[_0x24668d(0x184)][_0x24668d(0x180)]('y\x0a'),_0x52687f(!![]);return;}process[_0x24668d(0x184)][_0x24668d(0x180)]('\x0a'),_0x52687f(![]);};_0x53cd82['on'](_0x37b35e(0x18e),_0x1bfaba);});}
|
package/dist/utils/spinner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x558f8f,_0x205f1){const _0x5c71f5=a164_0x3814,_0x1b9161=_0x558f8f();while(!![]){try{const _0x91fb17=-parseInt(_0x5c71f5(0x10a))/0x1*(parseInt(_0x5c71f5(0x106))/0x2)+parseInt(_0x5c71f5(0x103))/0x3+-parseInt(_0x5c71f5(0xfc))/0x4*(-parseInt(_0x5c71f5(0xf7))/0x5)+parseInt(_0x5c71f5(0x110))/0x6+-parseInt(_0x5c71f5(0xf8))/0x7*(parseInt(_0x5c71f5(0x102))/0x8)+-parseInt(_0x5c71f5(0xfd))/0x9+-parseInt(_0x5c71f5(0x108))/0xa*(parseInt(_0x5c71f5(0xfa))/0xb);if(_0x91fb17===_0x205f1)break;else _0x1b9161['push'](_0x1b9161['shift']());}catch(_0x24ea53){_0x1b9161['push'](_0x1b9161['shift']());}}}(a164_0x29a9,0x430d2));import a164_0x483aaa from'ora';import{isWindows}from'./process.js';const windowsSpinner={'interval':0x3e8,'frames':['•']};function a164_0x29a9(){const _0x1a833d=['now','extra','5TgHgOu','29575OHMuBp','text','39578mvjTlb','intervalFactory','1926124cEwjZl','3592125khcxSU','jobId','phase','...','clock','368wzTYPT','1495197rnxnOp','stderr','\x20[Job\x20ID:\x20','384518EPnYOm','floor','290PpGUrw','cyan','2Amsspb','trim','toFixed','isSpinning','Processing','start','2262282NWIwpI','stop','isTTY'];a164_0x29a9=function(){return _0x1a833d;};return a164_0x29a9();}export function createCommandSpinner(_0x2ee6df,_0x5d9f9e={}){const _0xb66637=a164_0x3814,{verbose:verbose=![],forceEnabled:forceEnabled=![]}=_0x5d9f9e;return a164_0x483aaa({'text':_0x2ee6df,'color':_0xb66637(0x109),'stream':process[_0xb66637(0x104)],'isEnabled':forceEnabled||process[_0xb66637(0x104)][_0xb66637(0x112)]&&!verbose,...isWindows()&&{'spinner':windowsSpinner}});}export async function withSpinner(_0x260031,_0x260489,_0x33e2ef={}){const _0x23fecd=a164_0x3814,_0x1e1576=_0x33e2ef[_0x23fecd(0x101)]??(()=>Date[_0x23fecd(0x113)]()),_0x1d6bcc=createCommandSpinner(_0x260031,_0x33e2ef);_0x1d6bcc['start']();const _0x3e5745=_0x1e1576();try{const _0x2b9130=await _0x260489(),_0x3c915f=_0x1e1576()-_0x3e5745;return _0x1d6bcc[_0x23fecd(0x111)](),{'data':_0x2b9130,'elapsedMs':_0x3c915f};}catch(_0x30236c){_0x1d6bcc['stop']();throw _0x30236c;}}function a164_0x3814(_0x52e988,_0x4d977e){_0x52e988=_0x52e988-0xf7;const _0x29a930=a164_0x29a9();let _0x3814fe=_0x29a930[_0x52e988];return _0x3814fe;}export async function withProgressSpinner(_0x4c77c2,_0x177013,_0x2278c9={}){const _0x5b0245=a164_0x3814,_0x4cddbf=_0x2278c9['clock']??(()=>Date[_0x5b0245(0x113)]()),_0x2d5201=_0x2278c9[_0x5b0245(0xfb)]??setInterval,_0x31f0ba=createCommandSpinner(_0x4c77c2,_0x2278c9);_0x31f0ba[_0x5b0245(0x10f)]();const _0x4a0527=_0x4cddbf(),_0x1aba27=_0x4c77c2['replace'](_0x5b0245(0x100),'')[_0x5b0245(0x10b)]()||_0x5b0245(0x10e),_0x47d677={};let _0x5d54a6=_0x4c77c2;const _0x5e6aa9=()=>{const _0x2ef54d=_0x5b0245;if(!_0x31f0ba[_0x2ef54d(0x10d)])return;const _0x592d90=_0x4cddbf()-_0x4a0527,_0x2c1803=formatElapsed(_0x592d90),_0x3480a4=_0x47d677[_0x2ef54d(0xff)]?.['trim']()||_0x1aba27,_0x21b93a=_0x47d677[_0x2ef54d(0xfe)]?'\x20[Job\x20ID:\x20'+_0x47d677[_0x2ef54d(0xfe)]+']':'',_0x229754=_0x47d677[_0x2ef54d(0x114)]?'\x20'+_0x47d677['extra']:'',_0x1a31a4=_0x3480a4+'\x20'+_0x2c1803+_0x229754+_0x21b93a;_0x1a31a4!==_0x5d54a6&&_0x1a31a4[_0x2ef54d(0x10b)]()&&(_0x31f0ba[_0x2ef54d(0xf9)]=_0x1a31a4,_0x5d54a6=_0x1a31a4);},_0xbeb337=_0x2d5201(()=>{_0x5e6aa9();},0x3e8),_0x2ed741={'setPhase':_0x42d994=>{const _0x349cc6=_0x5b0245;_0x47d677[_0x349cc6(0xff)]=_0x42d994;const _0x182308=_0x42d994?.[_0x349cc6(0x10b)]()||_0x1aba27,_0x5edfaa=_0x4cddbf()-_0x4a0527,_0x57d1f4=formatElapsed(_0x5edfaa),_0x48eefe=_0x47d677['jobId']?_0x349cc6(0x105)+_0x47d677['jobId']+']':'',_0x23384a=_0x47d677[_0x349cc6(0x114)]?'\x20'+_0x47d677[_0x349cc6(0x114)]:'',_0x5bcf4c=_0x182308+'\x20'+_0x57d1f4+_0x23384a+_0x48eefe;_0x31f0ba[_0x349cc6(0x10d)]&&_0x5bcf4c['trim']()&&(_0x31f0ba['text']=_0x5bcf4c,_0x5d54a6=_0x5bcf4c);},'setJobId':_0x5b911f=>{_0x47d677['jobId']=_0x5b911f,_0x5e6aa9();},'setExtra':_0x45d8f7=>{const _0x3ca117=_0x5b0245;_0x47d677[_0x3ca117(0x114)]=_0x45d8f7,_0x5e6aa9();}};_0x5e6aa9();try{const _0x27134e=await _0x177013(_0x2ed741),_0x3a5272=_0x4cddbf()-_0x4a0527;return{'data':_0x27134e,'elapsedMs':_0x3a5272};}finally{clearInterval(_0xbeb337),_0x31f0ba['stop']();}}export function formatElapsed(_0x1804d1){const _0x26d1e5=a164_0x3814,_0x5cd8f0=Math[_0x26d1e5(0x107)](_0x1804d1/0x3e8);if(_0x5cd8f0<0x3c)return(_0x1804d1/0x3e8)[_0x26d1e5(0x10c)](0x1)+'s';const _0x2701ea=Math[_0x26d1e5(0x107)](_0x5cd8f0/0x3c),_0x556c0d=_0x5cd8f0%0x3c;if(_0x2701ea<0x3c)return _0x2701ea+'m\x20'+_0x556c0d+'s';const _0x5dd8cf=Math[_0x26d1e5(0x107)](_0x2701ea/0x3c),_0x22e8b2=_0x2701ea%0x3c;return _0x5dd8cf+'h\x20'+_0x22e8b2+'m';}
|
package/dist/utils/sse-parser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x31841,_0x3d0a84){const _0x5bef21=a165_0x62f4,_0xe13591=_0x31841();while(!![]){try{const _0xfe2470=parseInt(_0x5bef21(0x1e5))/0x1*(parseInt(_0x5bef21(0x1d3))/0x2)+-parseInt(_0x5bef21(0x1e6))/0x3*(-parseInt(_0x5bef21(0x1d8))/0x4)+-parseInt(_0x5bef21(0x1dd))/0x5*(-parseInt(_0x5bef21(0x1cf))/0x6)+parseInt(_0x5bef21(0x1e0))/0x7*(-parseInt(_0x5bef21(0x1d0))/0x8)+parseInt(_0x5bef21(0x1e3))/0x9+parseInt(_0x5bef21(0x1d4))/0xa*(parseInt(_0x5bef21(0x1e1))/0xb)+-parseInt(_0x5bef21(0x1db))/0xc;if(_0xfe2470===_0x3d0a84)break;else _0xe13591['push'](_0xe13591['shift']());}catch(_0x48754e){_0xe13591['push'](_0xe13591['shift']());}}}(a165_0x2e4b,0x1a939));function a165_0x2e4b(){const _0x1f07be=['18baDvuF','debug','Response\x20body\x20is\x20null','read','30MjRSxl','45608TYbJWc','event','[LLM\x20API\x20SSE]\x20','2TzFvan','1045570leLzcN','pop','releaseLock','parse','12732jWXLuE','body','slice','1247544nyjEfA','indexOf','49850gtDepJ','getReader','split','154loItYf','11HgzlQO','startsWith','1323882TlzXJb','data','17638fasTis'];a165_0x2e4b=function(){return _0x1f07be;};return a165_0x2e4b();}function a165_0x62f4(_0x449454,_0x438745){_0x449454=_0x449454-0x1cf;const _0x2e4b6b=a165_0x2e4b();let _0x62f4da=_0x2e4b6b[_0x449454];return _0x62f4da;}export async function*parseSSEStream(_0x5dd530,_0x4113e0){const _0x8156b0=a165_0x62f4;if(!_0x5dd530['body'])throw new Error(_0x8156b0(0x1e8));const _0x4ea9e2=_0x5dd530[_0x8156b0(0x1d9)][_0x8156b0(0x1de)](),_0x23de36=new TextDecoder();let _0x5c7a3d='',_0x17f523={};try{while(!![]){const {done:_0x163473,value:_0x30d3cc}=await _0x4ea9e2[_0x8156b0(0x1e9)]();if(_0x163473){if(_0x17f523[_0x8156b0(0x1e4)]){_0x4113e0?.['debug'](_0x8156b0(0x1d2)+_0x17f523['data']);const _0x5d6a6e=parseSSEData(_0x17f523['data']);yield _0x5d6a6e;}break;}_0x5c7a3d+=_0x23de36['decode'](_0x30d3cc,{'stream':!![]});const _0x465952=_0x5c7a3d[_0x8156b0(0x1df)]('\x0a');_0x5c7a3d=_0x465952[_0x8156b0(0x1d5)]()||'';for(const _0x1d12e4 of _0x465952){if(_0x1d12e4['trim']()===''){if(_0x17f523[_0x8156b0(0x1e4)]){_0x4113e0?.[_0x8156b0(0x1e7)]('[LLM\x20API\x20SSE]\x20'+_0x17f523[_0x8156b0(0x1e4)]);const _0x1e6a5c=parseSSEData(_0x17f523['data']);yield _0x1e6a5c,_0x17f523={};}continue;}if(_0x1d12e4[_0x8156b0(0x1e2)](':'))continue;const _0x29a922=_0x1d12e4[_0x8156b0(0x1dc)](':');if(_0x29a922===-0x1)continue;const _0x2b5a4f=_0x1d12e4[_0x8156b0(0x1da)](0x0,_0x29a922);let _0x3388b7=_0x1d12e4[_0x8156b0(0x1da)](_0x29a922+0x1);_0x3388b7[_0x8156b0(0x1e2)]('\x20')&&(_0x3388b7=_0x3388b7[_0x8156b0(0x1da)](0x1));switch(_0x2b5a4f){case _0x8156b0(0x1d1):_0x17f523['event']=_0x3388b7;break;case'data':_0x17f523[_0x8156b0(0x1e4)]=_0x17f523[_0x8156b0(0x1e4)]?_0x17f523[_0x8156b0(0x1e4)]+'\x0a'+_0x3388b7:_0x3388b7;break;case'id':_0x17f523['id']=_0x3388b7;break;}}}}finally{_0x4ea9e2[_0x8156b0(0x1d6)]();}}function parseSSEData(_0x280bf2){const _0x5cf8d9=a165_0x62f4;try{return JSON[_0x5cf8d9(0x1d7)](_0x280bf2);}catch(_0x546c10){throw new Error('Failed\x20to\x20parse\x20SSE\x20data\x20as\x20JSON:\x20'+_0x280bf2,{'cause':_0x546c10});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3e55e0,_0x47e242){const _0xd2a82=a166_0x5b74,_0x4421d9=_0x3e55e0();while(!![]){try{const _0x469408=parseInt(_0xd2a82(0x86))/0x1+parseInt(_0xd2a82(0x6c))/0x2*(parseInt(_0xd2a82(0x6e))/0x3)+-parseInt(_0xd2a82(0x79))/0x4*(-parseInt(_0xd2a82(0x80))/0x5)+-parseInt(_0xd2a82(0x7a))/0x6*(parseInt(_0xd2a82(0x6f))/0x7)+-parseInt(_0xd2a82(0x7e))/0x8*(parseInt(_0xd2a82(0x74))/0x9)+-parseInt(_0xd2a82(0x84))/0xa*(parseInt(_0xd2a82(0x6d))/0xb)+parseInt(_0xd2a82(0x82))/0xc;if(_0x469408===_0x47e242)break;else _0x4421d9['push'](_0x4421d9['shift']());}catch(_0x491518){_0x4421d9['push'](_0x4421d9['shift']());}}}(a166_0x208e,0x50394));import a166_0x4f5edf from'string-width';export function stringWidth(_0x41c906){return a166_0x4f5edf(_0x41c906);}export function padEnd(_0x427829,_0x6211cb){const _0x3fa831=stringWidth(_0x427829);if(_0x3fa831>=_0x6211cb)return _0x427829;return _0x427829+'\x20'['repeat'](_0x6211cb-_0x3fa831);}export function padStart(_0x5d2d33,_0x273473){const _0x1c648d=a166_0x5b74,_0x26d8db=stringWidth(_0x5d2d33);if(_0x26d8db>=_0x273473)return _0x5d2d33;return'\x20'[_0x1c648d(0x77)](_0x273473-_0x26d8db)+_0x5d2d33;}export function centerAlign(_0x2cb0e6,_0x426d0c){const _0x58c790=a166_0x5b74,_0x5d277a=stringWidth(_0x2cb0e6);if(_0x5d277a>_0x426d0c){if(_0x426d0c<=0x1)return'…'[_0x58c790(0x7d)](0x0,_0x426d0c);let _0xf6936b=_0x2cb0e6;while(stringWidth(_0xf6936b+'…')>_0x426d0c){_0xf6936b=_0xf6936b[_0x58c790(0x6b)](0x0,-0x1);}return _0xf6936b+'…';}if(_0x5d277a===_0x426d0c)return _0x2cb0e6;const _0x5f69bd=_0x426d0c-_0x5d277a,_0x4d5c21=Math[_0x58c790(0x76)](_0x5f69bd/0x2),_0xbcc591=_0x5f69bd-_0x4d5c21;return'\x20'['repeat'](_0x4d5c21)+_0x2cb0e6+'\x20'['repeat'](_0xbcc591);}export function escapeStringLiteral(_0x330f3e){const _0x11de81=a166_0x5b74;if(!_0x330f3e||_0x330f3e[_0x11de81(0x83)]()[_0x11de81(0x72)]===0x0)throw new Error(_0x11de81(0x7c));const _0x3788a3=_0x330f3e[_0x11de81(0x7b)](/'/g,'\x27\x27');return'\x27'+_0x3788a3+'\x27';}export function globToLike(_0x34c582){const _0x2cb04d=a166_0x5b74;let _0x52d95a=_0x34c582[_0x2cb04d(0x7b)](/\\/g,'\x5c\x5c')[_0x2cb04d(0x7b)](/%/g,'\x5c%')['replace'](/_/g,'\x5c_');return _0x52d95a=_0x52d95a[_0x2cb04d(0x7b)](/\*/g,'%')['replace'](/\?/g,'_'),_0x52d95a;}export function buildLikePattern(_0x151363){const _0x5369ca=a166_0x5b74;if(!_0x151363||_0x151363[_0x5369ca(0x83)]()['length']===0x0)throw new Error(_0x5369ca(0x7f));const _0x450bfe=globToLike(_0x151363),_0xe0100c=_0x450bfe[_0x5369ca(0x7b)](/'/g,'\x27\x27');return'\x27'+_0xe0100c+'\x27';}export function matchGlobPattern(_0x14ac43,_0xa76235){const _0x43edb9=a166_0x5b74,_0x365b5b=_0xa76235['replace'](/[.+^${}()|[\]\\]/g,_0x43edb9(0x75))[_0x43edb9(0x7b)](/\*/g,'.*')[_0x43edb9(0x7b)](/\?/g,'.'),_0x3c22f0=new RegExp('^'+_0x365b5b+'$');return _0x3c22f0[_0x43edb9(0x85)](_0x14ac43);}export function getSanitizedUsername(){const _0x250e36=a166_0x5b74,_0x87fa68=process[_0x250e36(0x78)][_0x250e36(0x81)]||process['env'][_0x250e36(0x70)]||'unknown';return _0x87fa68['replace'](/[^a-zA-Z0-9]/g,'')['toLowerCase']();}export function generateRandomHex(){const _0x64cc0=a166_0x5b74,_0x1de8fb=Math[_0x64cc0(0x76)](Math[_0x64cc0(0x87)]()*0xfffff);return _0x1de8fb['toString'](0x10)[_0x64cc0(0x73)](0x5,'0');}function a166_0x5b74(_0x4c4da7,_0x370e91){_0x4c4da7=_0x4c4da7-0x6b;const _0x208e20=a166_0x208e();let _0x5b741f=_0x208e20[_0x4c4da7];return _0x5b741f;}export function sanitizeFileName(_0x1ed205){const _0x34244a=a166_0x5b74;return _0x1ed205[_0x34244a(0x71)]()[_0x34244a(0x7b)](/[/\\:*?"<>|]/g,'-')[_0x34244a(0x7b)](/\s+/g,'-')[_0x34244a(0x7b)](/-+/g,'-')['replace'](/^-|-$/g,'');}function a166_0x208e(){const _0x4a3374=['floor','repeat','env','8264UveYXC','571038nedzEs','replace','Cannot\x20escape\x20empty\x20string\x20literal','substring','2315072fXmXak','Cannot\x20build\x20LIKE\x20pattern\x20from\x20empty\x20string','370lYwWql','USER','6466608fBDZXN','trim','50enNFKZ','test','462685PtDJKp','random','slice','51670cSpgul','1368719heEivM','21ViyimL','7kVbzsA','USERNAME','toLowerCase','length','padStart','9fXupLr','\x5c$&'];a166_0x208e=function(){return _0x4a3374;};return a166_0x208e();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x200a9b,_0x43ca45){const _0x411bbe=a167_0x292e,_0x16320c=_0x200a9b();while(!![]){try{const _0x2bac0f=-parseInt(_0x411bbe(0xc2))/0x1*(-parseInt(_0x411bbe(0xc9))/0x2)+-parseInt(_0x411bbe(0xbd))/0x3*(-parseInt(_0x411bbe(0xc4))/0x4)+parseInt(_0x411bbe(0xbe))/0x5*(-parseInt(_0x411bbe(0xc7))/0x6)+parseInt(_0x411bbe(0xbb))/0x7+-parseInt(_0x411bbe(0xc6))/0x8+parseInt(_0x411bbe(0xd2))/0x9*(-parseInt(_0x411bbe(0xce))/0xa)+parseInt(_0x411bbe(0xba))/0xb;if(_0x2bac0f===_0x43ca45)break;else _0x16320c['push'](_0x16320c['shift']());}catch(_0x4553f0){_0x16320c['push'](_0x16320c['shift']());}}}(a167_0x596f,0xcdc54));function a167_0x292e(_0x684c7d,_0x2bafc2){_0x684c7d=_0x684c7d-0xba;const _0x596f8d=a167_0x596f();let _0x292e6b=_0x596f8d[_0x684c7d];return _0x292e6b;}function hasWildcard(_0x27c0aa){const _0x4583dc=a167_0x292e;return _0x27c0aa[_0x4583dc(0xcc)]('*')||_0x27c0aa[_0x4583dc(0xcc)]('?');}export function parseTableReference(_0x4fc44d){const _0x27301e=a167_0x292e;if(!_0x4fc44d||_0x4fc44d['trim']()[_0x27301e(0xd0)]===0x0)throw new Error(_0x27301e(0xbc));const _0x48551a=_0x4fc44d[_0x27301e(0xc5)](),_0x283325={'original':_0x48551a},_0x5b2e8a=_0x48551a[_0x27301e(0xd1)]('.');if(_0x5b2e8a[_0x27301e(0xd0)]===0x1){const _0x55929f=_0x5b2e8a[0x0];if(!_0x55929f)throw new Error(_0x27301e(0xc3));_0x283325[_0x27301e(0xcb)]=_0x55929f;}else{if(_0x5b2e8a[_0x27301e(0xd0)]===0x2){const [_0x22a62e,_0x4f38f1]=_0x5b2e8a;if(!_0x22a62e)throw new Error(_0x27301e(0xcd));if(!_0x4f38f1)throw new Error(_0x27301e(0xc1));_0x283325[_0x27301e(0xd4)]=_0x22a62e,_0x283325[_0x27301e(0xcb)]=_0x4f38f1;}else{if(_0x5b2e8a[_0x27301e(0xd0)]===0x3){const [_0x2676c2,_0x2098ac,_0x3c512f]=_0x5b2e8a;if(!_0x2676c2||!_0x2098ac||!_0x3c512f)throw new Error(_0x27301e(0xbf));_0x283325[_0x27301e(0xd3)]=_0x2676c2,_0x283325[_0x27301e(0xd4)]=_0x2098ac,_0x283325['table']=_0x3c512f;}else throw new Error(_0x27301e(0xca));}}return _0x283325;}function a167_0x596f(){const _0x3b1284=['1JhjKoe','Pattern\x20cannot\x20be\x20just\x20a\x20dot','793196QyQbVI','trim','5107616IXlUic','892464ZMcjTF','Table\x20name\x20is\x20required\x20for\x20describe\x20operation','3210926aPSoMc','Invalid\x20pattern\x20format\x20-\x20too\x20many\x20dots\x20(max:\x20catalog.database.table)','table','includes','Database\x20part\x20cannot\x20be\x20empty\x20-\x20use\x20\x22*\x22\x20for\x20all\x20databases\x20(e.g.,\x20\x22*.mytable\x22)','110SrskFM','push','length','split','820143rCJAVs','catalog','database','11223388hznWFM','2129575CIeiOj','Pattern\x20cannot\x20be\x20empty\x20or\x20whitespace-only','9dlHMNs','35oFLurb','Invalid\x20catalog.database.table\x20format\x20-\x20all\x20parts\x20must\x20be\x20non-empty','Wildcards\x20are\x20not\x20allowed\x20in\x20database\x20name\x20for\x20describe\x20operation','Table\x20part\x20cannot\x20be\x20empty\x20-\x20use\x20\x22*\x22\x20for\x20all\x20tables\x20(e.g.,\x20\x22mydb.*\x22)'];a167_0x596f=function(){return _0x3b1284;};return a167_0x596f();}export function formatTableReference(_0x26b0ff){const _0x421837=a167_0x292e,_0x5f0048=[];return _0x26b0ff[_0x421837(0xd3)]&&_0x5f0048[_0x421837(0xcf)](_0x26b0ff['catalog']),_0x26b0ff[_0x421837(0xd4)]&&_0x5f0048['push'](_0x26b0ff[_0x421837(0xd4)]),_0x26b0ff[_0x421837(0xcb)]&&_0x5f0048[_0x421837(0xcf)](_0x26b0ff['table']),_0x5f0048['join']('.');}export function validateTableListReference(_0x23743c){return undefined;}export function validateTableDescribeReference(_0x397e95){const _0xea94ee=a167_0x292e;if(!_0x397e95[_0xea94ee(0xcb)])return _0xea94ee(0xc8);if(_0x397e95[_0xea94ee(0xd4)]&&hasWildcard(_0x397e95['database']))return _0xea94ee(0xc0);if(hasWildcard(_0x397e95[_0xea94ee(0xcb)]))return'Wildcards\x20are\x20not\x20allowed\x20in\x20table\x20name\x20for\x20describe\x20operation';return undefined;}
|
package/dist/utils/tdx-logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a168_0x2c0cdf=a168_0x5373;(function(_0x2904fc,_0x407a08){const _0x154362=a168_0x5373,_0x5d2846=_0x2904fc();while(!![]){try{const _0x44549b=-parseInt(_0x154362(0x1be))/0x1*(-parseInt(_0x154362(0x1b7))/0x2)+-parseInt(_0x154362(0x1ce))/0x3+-parseInt(_0x154362(0x1c1))/0x4*(-parseInt(_0x154362(0x1c0))/0x5)+-parseInt(_0x154362(0x1b6))/0x6+-parseInt(_0x154362(0x1c7))/0x7*(-parseInt(_0x154362(0x1c4))/0x8)+-parseInt(_0x154362(0x199))/0x9*(parseInt(_0x154362(0x19f))/0xa)+parseInt(_0x154362(0x1b9))/0xb;if(_0x44549b===_0x407a08)break;else _0x5d2846['push'](_0x5d2846['shift']());}catch(_0x1dcc44){_0x5d2846['push'](_0x5d2846['shift']());}}}(a168_0x5224,0x3d6cf));function a168_0x5224(){const _0x15449f=['trace','WARN','info','INFO','test','name','debug','getMinutes','toString','red','replace','.cache','toISOString','join','abs','yellow','TRACE','722946HPhvee','32286gRIKoZ','close','2571877SDzdcg','getDate','log','filter','\x5c$&','7aodEWK','logStream','185KvoerW','33356ZbGnYE','padStart','gray','16JtTTNT','logFileName','stringify','270494WZlbOC','ERROR','fileOnly','mtime','rotateOldLogs','-(\x5cd{4}-\x5cd{2}-\x5cd{2})\x5c.log$','write','210282xbzgsf','Proxy\x20session\x20ended','logLevel','cause','.gz','getSeconds','logBaseName','logDir','Warning:\x20Failed\x20to\x20compress\x20','tdx.log','stack','split','getTimezoneOffset','373437znLyLJ','tdx','includes','warn','.log','error','70SQPfBl','message','getHours','getMilliseconds','cyan','DEBUG'];a168_0x5224=function(){return _0x15449f;};return a168_0x5224();}import{createWriteStream,createReadStream}from'fs';import{mkdir,readdir,unlink,stat,rename}from'fs/promises';import{join}from'path';import{homedir}from'os';import{createGzip}from'zlib';import{pipeline}from'stream/promises';import a168_0x1f989d from'chalk';function safeStringify(_0x3a4347){const _0x323ea4=a168_0x5373;if(typeof _0x3a4347==='string')return _0x3a4347;if(_0x3a4347 instanceof Error)return _0x3a4347[_0x323ea4(0x196)]||_0x3a4347['name']+':\x20'+_0x3a4347[_0x323ea4(0x1a0)];try{return JSON[_0x323ea4(0x1c6)](_0x3a4347,(_0x3013bf,_0x18d830)=>{const _0x25ecc5=_0x323ea4;if(_0x18d830 instanceof Error)return{'name':_0x18d830[_0x25ecc5(0x1aa)],'message':_0x18d830[_0x25ecc5(0x1a0)],'stack':_0x18d830[_0x25ecc5(0x196)],'cause':_0x18d830[_0x25ecc5(0x1d1)]};return _0x18d830;});}catch{return String(_0x3a4347);}}function getTimezoneOffset(){const _0xe2f198=a168_0x5373,_0x282acf=-new Date()[_0xe2f198(0x198)](),_0x2977f6=Math['floor'](Math['abs'](_0x282acf)/0x3c),_0x5f2edf=Math[_0xe2f198(0x1b3)](_0x282acf)%0x3c,_0x5351bc=_0x282acf>=0x0?'+':'-';return''+_0x5351bc+_0x2977f6[_0xe2f198(0x1ad)]()[_0xe2f198(0x1c2)](0x2,'0')+_0x5f2edf[_0xe2f198(0x1ad)]()[_0xe2f198(0x1c2)](0x2,'0');}function formatTimestamp(){const _0x4fb1b5=a168_0x5373,_0x4e78cb=new Date(),_0x280af1=_0x4e78cb['getFullYear'](),_0x3fbaf3=(_0x4e78cb['getMonth']()+0x1)[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x2,'0'),_0x5cac72=_0x4e78cb[_0x4fb1b5(0x1ba)]()[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x2,'0'),_0x582621=_0x4e78cb[_0x4fb1b5(0x1a1)]()[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x2,'0'),_0x2e59a2=_0x4e78cb[_0x4fb1b5(0x1ac)]()[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x2,'0'),_0x5a2a9d=_0x4e78cb[_0x4fb1b5(0x191)]()[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x2,'0'),_0x183801=_0x4e78cb[_0x4fb1b5(0x1a2)]()[_0x4fb1b5(0x1ad)]()[_0x4fb1b5(0x1c2)](0x3,'0'),_0x35f05a=getTimezoneOffset();return _0x280af1+'-'+_0x3fbaf3+'-'+_0x5cac72+'\x20'+_0x582621+':'+_0x2e59a2+':'+_0x5a2a9d+'.'+_0x183801+_0x35f05a;}function formatColoredLogEntry(_0x3cd613,_0x48deda){const _0x40165a=a168_0x5373,_0x5b2981=formatTimestamp(),_0x4305ed=_0x48deda['map'](safeStringify)[_0x40165a(0x1b2)]('\x20'),_0x1df698=a168_0x1f989d[_0x40165a(0x1c3)](_0x5b2981);let _0x456c56;switch(_0x3cd613){case _0x40165a(0x1a7):_0x456c56=a168_0x1f989d[_0x40165a(0x1a3)]('['+_0x3cd613+']\x20');break;case'warn':_0x456c56=a168_0x1f989d[_0x40165a(0x1b4)]('['+_0x3cd613+']\x20');break;case _0x40165a(0x19e):_0x456c56=a168_0x1f989d[_0x40165a(0x1ae)]('['+_0x3cd613+']');break;case _0x40165a(0x1ab):_0x456c56=a168_0x1f989d['gray']('['+_0x3cd613+']');break;default:_0x456c56='['+_0x3cd613+']';}return _0x1df698+'\x20'+_0x456c56+'\x20'+_0x4305ed;}export var LogLevel;(function(_0x54f904){const _0x13e38a=a168_0x5373;_0x54f904[_0x54f904[_0x13e38a(0x1b5)]=-0x2]='TRACE',_0x54f904[_0x54f904['DEBUG']=-0x1]=_0x13e38a(0x1a4),_0x54f904[_0x54f904[_0x13e38a(0x1a8)]=0x0]=_0x13e38a(0x1a8),_0x54f904[_0x54f904['WARN']=0x1]=_0x13e38a(0x1a6),_0x54f904[_0x54f904[_0x13e38a(0x1c8)]=0x2]=_0x13e38a(0x1c8);}(LogLevel||(LogLevel={})));function a168_0x5373(_0x576884,_0x5d341a){_0x576884=_0x576884-0x190;const _0x5224b8=a168_0x5224();let _0x537387=_0x5224b8[_0x576884];return _0x537387;}export class TDXLogger{['logStream'];['logDir'];['logLevel'];['fileOnly'];[a168_0x2c0cdf(0x1c5)];[a168_0x2c0cdf(0x192)];constructor(_0x20b6ad=LogLevel[a168_0x2c0cdf(0x1a8)],_0x3e94fd=![],_0x46bdd6,_0x377fcf=a168_0x2c0cdf(0x195)){const _0x4179fe=a168_0x2c0cdf;this[_0x4179fe(0x193)]=_0x46bdd6||join(homedir(),_0x4179fe(0x1b0),_0x4179fe(0x19a),'logs'),this[_0x4179fe(0x1d0)]=_0x20b6ad,this[_0x4179fe(0x1c9)]=_0x3e94fd,this[_0x4179fe(0x1c5)]=_0x377fcf,this['logBaseName']=_0x377fcf[_0x4179fe(0x1af)](/\.log$/,'');}async['init'](){const _0x2d5e4e=a168_0x2c0cdf;try{await mkdir(this[_0x2d5e4e(0x193)],{'recursive':!![]}),await this['rotateOldLogs']();const _0x2035fe=join(this[_0x2d5e4e(0x193)],this[_0x2d5e4e(0x1c5)]);this[_0x2d5e4e(0x1bf)]=createWriteStream(_0x2035fe,{'flags':'a'}),this[_0x2d5e4e(0x1bf)]['on'](_0x2d5e4e(0x19e),_0x579e9b=>{const _0x1af77f=_0x2d5e4e;console[_0x1af77f(0x19e)]('Warning:\x20Error\x20writing\x20to\x20'+this['logFileName']+':',_0x579e9b[_0x1af77f(0x1a0)]);});}catch(_0x2ee344){console[_0x2d5e4e(0x19e)]('Warning:\x20Failed\x20to\x20initialize\x20log\x20files:',_0x2ee344);}}async[a168_0x2c0cdf(0x1cb)](){const _0x5d7cf4=a168_0x2c0cdf;try{const _0x4821d7=await readdir(this[_0x5d7cf4(0x193)]),_0x1b6007=new Date()['toISOString']()[_0x5d7cf4(0x197)]('T')[0x0];if(_0x4821d7[_0x5d7cf4(0x19b)](this[_0x5d7cf4(0x1c5)])){const _0x10c8cc=join(this[_0x5d7cf4(0x193)],this['logFileName']),_0xdf6745=await stat(_0x10c8cc),_0x143c4d=new Date(_0xdf6745[_0x5d7cf4(0x1ca)])[_0x5d7cf4(0x1b1)]()[_0x5d7cf4(0x197)]('T')[0x0];if(_0x143c4d<_0x1b6007){const _0x3c55f1=join(this[_0x5d7cf4(0x193)],this[_0x5d7cf4(0x192)]+'-'+_0x143c4d+_0x5d7cf4(0x19d));await rename(_0x10c8cc,_0x3c55f1);}}const _0x228d86=await readdir(this[_0x5d7cf4(0x193)]),_0x122e3=this[_0x5d7cf4(0x192)][_0x5d7cf4(0x1af)](/[.*+?^${}()|[\]\\]/g,_0x5d7cf4(0x1bd)),_0x53129c=new RegExp('^'+_0x122e3+_0x5d7cf4(0x1cc)),_0x3c84a4=_0x228d86[_0x5d7cf4(0x1bc)](_0x41604d=>_0x53129c[_0x5d7cf4(0x1a9)](_0x41604d));for(const _0x52a9f5 of _0x3c84a4){const _0xe875f6=join(this[_0x5d7cf4(0x193)],_0x52a9f5),_0x13e074=join(this['logDir'],_0x52a9f5+_0x5d7cf4(0x190));try{await pipeline(createReadStream(_0xe875f6),createGzip(),createWriteStream(_0x13e074)),await unlink(_0xe875f6);}catch(_0x3c79eb){console[_0x5d7cf4(0x19e)](_0x5d7cf4(0x194)+_0x52a9f5+':',_0x3c79eb);}}}catch{}}[a168_0x2c0cdf(0x1ab)](..._0x243499){const _0x1f9cc1=a168_0x2c0cdf;if(this[_0x1f9cc1(0x1d0)]>LogLevel[_0x1f9cc1(0x1a4)])return;const _0x55b4aa=formatColoredLogEntry(_0x1f9cc1(0x1ab),_0x243499);this[_0x1f9cc1(0x1bf)]?.[_0x1f9cc1(0x1cd)](_0x55b4aa+'\x0a');}[a168_0x2c0cdf(0x1a5)](..._0x14660d){const _0x5b22a5=a168_0x2c0cdf;if(this[_0x5b22a5(0x1d0)]>LogLevel[_0x5b22a5(0x1b5)])return;const _0x580d71=formatColoredLogEntry(_0x5b22a5(0x1a5),_0x14660d);this['logStream']?.[_0x5b22a5(0x1cd)](_0x580d71+'\x0a');}[a168_0x2c0cdf(0x1a7)](..._0x5a1aec){const _0x3c9eb2=a168_0x2c0cdf;if(this[_0x3c9eb2(0x1d0)]>LogLevel['INFO'])return;const _0x226d87=formatColoredLogEntry(_0x3c9eb2(0x1a7),_0x5a1aec);!this[_0x3c9eb2(0x1c9)]&&console[_0x3c9eb2(0x1bb)](_0x226d87),this[_0x3c9eb2(0x1bf)]?.[_0x3c9eb2(0x1cd)](_0x226d87+'\x0a');}[a168_0x2c0cdf(0x19c)](..._0x107e03){const _0x22e411=a168_0x2c0cdf;if(this[_0x22e411(0x1d0)]>LogLevel[_0x22e411(0x1a6)])return;const _0x569f64=formatColoredLogEntry(_0x22e411(0x19c),_0x107e03);!this[_0x22e411(0x1c9)]&&console[_0x22e411(0x19e)](_0x569f64),this[_0x22e411(0x1bf)]?.[_0x22e411(0x1cd)](_0x569f64+'\x0a');}[a168_0x2c0cdf(0x19e)](..._0x145546){const _0x1ced88=a168_0x2c0cdf,_0x1fa46d=formatColoredLogEntry(_0x1ced88(0x19e),_0x145546);!this[_0x1ced88(0x1c9)]&&console[_0x1ced88(0x19e)](_0x1fa46d),this['logStream']?.[_0x1ced88(0x1cd)](_0x1fa46d+'\x0a');}async[a168_0x2c0cdf(0x1b8)](){const _0x395761=a168_0x2c0cdf;return this[_0x395761(0x1a7)](_0x395761(0x1cf)),new Promise(_0x4d7b4a=>{this['logStream']?this['logStream']['end'](()=>{_0x4d7b4a();}):_0x4d7b4a();});}['getLogPath'](){const _0x582207=a168_0x2c0cdf;return join(this[_0x582207(0x193)],this[_0x582207(0x1c5)]);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a169_0x307ed4=a169_0x494f;(function(_0x15baa3,_0x27003b){const _0x423eb5=a169_0x494f,_0x180b31=_0x15baa3();while(!![]){try{const _0x503500=parseInt(_0x423eb5(0x1a3))/0x1+parseInt(_0x423eb5(0x1a1))/0x2*(parseInt(_0x423eb5(0x1b2))/0x3)+parseInt(_0x423eb5(0x1a4))/0x4*(-parseInt(_0x423eb5(0x1a2))/0x5)+-parseInt(_0x423eb5(0x1b5))/0x6*(parseInt(_0x423eb5(0x19d))/0x7)+-parseInt(_0x423eb5(0x1b3))/0x8+-parseInt(_0x423eb5(0x19e))/0x9*(-parseInt(_0x423eb5(0x19c))/0xa)+parseInt(_0x423eb5(0x1a7))/0xb;if(_0x503500===_0x27003b)break;else _0x180b31['push'](_0x180b31['shift']());}catch(_0x3ef4d4){_0x180b31['push'](_0x180b31['shift']());}}}(a169_0x202f,0xefda4));import{get}from'https';import{readFileSync,writeFileSync,mkdirSync}from'fs';import{join}from'path';import{gt,valid}from'semver';import a169_0x12a3d7 from'chalk';function a169_0x202f(){const _0xfeff70=['write','5789718SZmBnN','last_version_check','Update\x20available:','stderr','data','https://registry.npmjs.org/@treasuredata/tdx/latest','getTime','latestVersion','\x0aUpdate\x20available:\x20','isTTY','toISOString','18hkkxRv','5416120StbFvq','\x0aRun:\x20','7026SzTfze','utf-8','error','statusCode','dim','Invalid\x20version\x20format','npm\x20install\x20-g\x20@treasuredata/tdx@latest','end','HTTP\x20','version','now','yellow','lastCheck','3413780YdwcxK','2366GOGGKL','9BouYEI','currentVersion','Run:','592356RYnjPX','4181795WVRHDB','1083183Zuzlei','8HydISx','stringify'];a169_0x202f=function(){return _0xfeff70;};return a169_0x202f();}import{getCacheDir}from'../core/config.js';const CACHE_DURATION_MS=0x18*0x3c*0x3c*0x3e8,NPM_REGISTRY_URL=a169_0x307ed4(0x1ac),TIMEOUT_MS=0x7d0;function getCacheFilePath(){const _0x5a2c39=a169_0x307ed4,_0x19bfe1=getCacheDir();return join(_0x19bfe1,_0x5a2c39(0x1a8));}function readCache(){const _0x257d94=a169_0x307ed4;try{const _0x356cef=getCacheFilePath(),_0x5bccac=readFileSync(_0x356cef,_0x257d94(0x1b6));return JSON['parse'](_0x5bccac);}catch{return null;}}function writeCache(_0x1cb58d){const _0x695800=a169_0x307ed4;try{const _0x272bfa=getCacheDir();mkdirSync(_0x272bfa,{'recursive':!![]});const _0xf28405={'lastCheck':new Date()[_0x695800(0x1b1)](),'latestVersion':_0x1cb58d},_0x5ebf95=getCacheFilePath();writeFileSync(_0x5ebf95,JSON[_0x695800(0x1a5)](_0xf28405,null,0x2),_0x695800(0x1b6));}catch{}}function a169_0x494f(_0x100fee,_0x309c92){_0x100fee=_0x100fee-0x196;const _0x202f9e=a169_0x202f();let _0x494f57=_0x202f9e[_0x100fee];return _0x494f57;}function isCacheValid(_0x22c0f1){const _0x4d6b6a=a169_0x307ed4;if(!_0x22c0f1)return![];const _0xdff2d1=new Date(_0x22c0f1[_0x4d6b6a(0x19b)])[_0x4d6b6a(0x1ad)](),_0x1b691c=Date[_0x4d6b6a(0x199)]();return _0x1b691c-_0xdff2d1<CACHE_DURATION_MS;}function fetchLatestVersion(){return new Promise((_0x108282,_0x599af4)=>{const _0x596f99=a169_0x494f,_0x4ebec9=get(NPM_REGISTRY_URL,_0x49e969=>{const _0x200a1d=a169_0x494f;if(_0x49e969[_0x200a1d(0x1b8)]!==0xc8){clearTimeout(_0x58d09f),_0x599af4(new Error(_0x200a1d(0x197)+_0x49e969[_0x200a1d(0x1b8)]));return;}let _0x27d555='';_0x49e969['on'](_0x200a1d(0x1ab),_0x25137b=>{_0x27d555+=_0x25137b;}),_0x49e969['on'](_0x200a1d(0x196),()=>{const _0x2a67c8=_0x200a1d;clearTimeout(_0x58d09f);try{const _0x1729ad=JSON['parse'](_0x27d555);if(!valid(_0x1729ad[_0x2a67c8(0x198)])){_0x599af4(new Error(_0x2a67c8(0x1ba)));return;}_0x108282(_0x1729ad[_0x2a67c8(0x198)]);}catch(_0x1b8c3f){_0x599af4(_0x1b8c3f);}});})['on'](_0x596f99(0x1b7),_0x288db3=>{clearTimeout(_0x58d09f),_0x599af4(_0x288db3);}),_0x58d09f=setTimeout(()=>{_0x4ebec9['destroy'](),_0x599af4(new Error('Request\x20timeout'));},TIMEOUT_MS);});}export async function checkForUpdate(_0x47ad2d){const _0xf97c8c=a169_0x307ed4;try{const _0x5d982c=readCache();if(isCacheValid(_0x5d982c)){const _0x9f2ca=gt(_0x5d982c['latestVersion'],_0x47ad2d);return{'updateAvailable':_0x9f2ca,'currentVersion':_0x47ad2d,'latestVersion':_0x5d982c[_0xf97c8c(0x1ae)]};}const _0x501ebf=await fetchLatestVersion();writeCache(_0x501ebf);const _0x1d64aa=gt(_0x501ebf,_0x47ad2d);return{'updateAvailable':_0x1d64aa,'currentVersion':_0x47ad2d,'latestVersion':_0x501ebf};}catch{return null;}}export function displayUpdateNotification(_0x35b34a){const _0x57840a=a169_0x307ed4;if(!_0x35b34a['updateAvailable'])return;const _0x28a9ed=process['stderr'][_0x57840a(0x1b0)]&&!process['env']['NO_COLOR'],_0x5f06c9=_0x28a9ed?a169_0x12a3d7['gray']('→'):'→',_0x415bb3=_0x28a9ed?a169_0x12a3d7[_0x57840a(0x1b9)](_0x35b34a[_0x57840a(0x19f)]):_0x35b34a[_0x57840a(0x19f)],_0x1e1e50=_0x28a9ed?a169_0x12a3d7['green'](_0x35b34a[_0x57840a(0x1ae)]):_0x35b34a[_0x57840a(0x1ae)],_0x1a38fe=_0x28a9ed?a169_0x12a3d7['cyan'](_0x57840a(0x1bb)):_0x57840a(0x1bb),_0x155a0c=_0x28a9ed?'\x0a'+a169_0x12a3d7[_0x57840a(0x19a)](_0x57840a(0x1a9))+'\x20'+_0x415bb3+'\x20'+_0x5f06c9+'\x20'+_0x1e1e50+'\x0a'+a169_0x12a3d7[_0x57840a(0x1b9)](_0x57840a(0x1a0))+'\x20'+_0x1a38fe+'\x0a':_0x57840a(0x1af)+_0x415bb3+'\x20'+_0x5f06c9+'\x20'+_0x1e1e50+_0x57840a(0x1b4)+_0x1a38fe+'\x0a';process[_0x57840a(0x1aa)][_0x57840a(0x1a6)](_0x155a0c);}
|