@treasuredata/tdx 0.8.7 → 0.8.8
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 +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.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.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +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/context-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/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-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/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.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/config.js +1 -1
- package/dist/core/connection-cache.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/index.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/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.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/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.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.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.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/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.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-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
package/dist/commands/tables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a40_0x572c2c=a40_0x5337;(function(_0x2a1d72,_0x4c8443){const _0x5c5932=a40_0x5337,_0x20f8b6=_0x2a1d72();while(!![]){try{const _0x25c7ee=parseInt(_0x5c5932(0xd5))/0x1+parseInt(_0x5c5932(0xe1))/0x2*(-parseInt(_0x5c5932(0xe2))/0x3)+parseInt(_0x5c5932(0xec))/0x4*(-parseInt(_0x5c5932(0xe3))/0x5)+-parseInt(_0x5c5932(0xd4))/0x6+parseInt(_0x5c5932(0xd0))/0x7*(-parseInt(_0x5c5932(0xea))/0x8)+parseInt(_0x5c5932(0xcc))/0x9+-parseInt(_0x5c5932(0xdc))/0xa*(-parseInt(_0x5c5932(0xee))/0xb);if(_0x25c7ee===_0x4c8443)break;else _0x20f8b6['push'](_0x20f8b6['shift']());}catch(_0x2fb8c8){_0x20f8b6['push'](_0x20f8b6['shift']());}}}(a40_0x516b,0x48aaf));function a40_0x5337(_0x3f87ba,_0x53e4d8){_0x3f87ba=_0x3f87ba-0xca;const _0x516bca=a40_0x516b();let _0x533739=_0x516bca[_0x3f87ba];return _0x533739;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a40_0x516b(){const _0x592ea0=['table','verbose','\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables','\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27','1498672mRXhKq','\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb','8VDSUgV','Site:\x20','11hAFZMc','length','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','\x20\x20Cause:\x20','Database:\x20','Listing\x20tables...','.*\x22','\x27\x20across\x20all\x20databases.','\x20\x20Use:\x20tdx\x20tables\x20\x22','Database:\x20all','message','Note:\x20\x27','3257253hIarLR','Database\x20pattern:\x20','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','validate','14GMpoHk','Error:\x20','error','includes','1450758hNzrqy','46460zlnWVY','tables','query','limit','cause','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','✖\x20No\x20tables\x20found','7547030cbUuVz','database','\x27\x20is\x20ambiguous.','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','execute','4dZPkju','273399wZxIJO','166765oZKnkA','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','Database\x20\x27'];a40_0x516b=function(){return _0x592ea0;};return a40_0x516b();}import{parseTableReference}from'../utils/table-ref-parser.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';import{withSpinner}from'../utils/spinner.js';export class TablesCommand extends BaseCommand{['name']=a40_0x572c2c(0xd6);['description']='List\x20tables\x20in\x20a\x20database';async[a40_0x572c2c(0xe0)](_0x402912){const _0x2fb8dd=a40_0x572c2c,{options:_0x565ed5,args:_0x553466,tdx:_0x1fc4ed}=_0x402912;let _0x200d53;if(_0x553466['length']===0x0)_0x200d53={'database':undefined,'table':undefined,'original':''};else{if(_0x553466['length']===0x1)try{_0x200d53=parseTableReference(_0x553466[0x0]);if(_0x200d53['table']&&!_0x200d53['database']&&!_0x200d53[_0x2fb8dd(0xe6)][_0x2fb8dd(0xd3)]('*')&&!_0x200d53['table'][_0x2fb8dd(0xd3)]('?'))return console[_0x2fb8dd(0xd2)]('Error:\x20Pattern\x20\x27'+_0x553466[0x0]+_0x2fb8dd(0xde)),console[_0x2fb8dd(0xd2)]('Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27'+_0x200d53[_0x2fb8dd(0xe6)]+'\x27?'),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xf6)+_0x200d53[_0x2fb8dd(0xe6)]+_0x2fb8dd(0xf4)),console[_0x2fb8dd(0xd2)]('\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20'+_0x200d53[_0x2fb8dd(0xe6)]),console['error'](_0x2fb8dd(0xe4)+_0x200d53[_0x2fb8dd(0xe6)]),console[_0x2fb8dd(0xd2)](''),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xcb)+_0x553466[0x0]+_0x2fb8dd(0xe9)+_0x200d53[_0x2fb8dd(0xe6)]+_0x2fb8dd(0xf5)),0x1;}catch(_0x264754){return console[_0x2fb8dd(0xd2)]('Error:\x20'+_0x264754[_0x2fb8dd(0xca)]),0x1;}else return console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xf0)),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xda)),console[_0x2fb8dd(0xd2)]('\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb'),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xeb)),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xce)),console[_0x2fb8dd(0xd2)]('Or\x20use\x20--in\x20flag:'),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xdf)),0x1;}const _0x4cbe0f=_0x565ed5[_0x2fb8dd(0xdd)];!_0x200d53[_0x2fb8dd(0xdd)]&&_0x4cbe0f&&(_0x200d53[_0x2fb8dd(0xdd)]=_0x4cbe0f);try{const _0x530f43=_0x5bb181=>_0x5bb181&&(_0x5bb181[_0x2fb8dd(0xd3)]('*')||_0x5bb181[_0x2fb8dd(0xd3)]('?')),_0x5262fd=_0x530f43(_0x200d53[_0x2fb8dd(0xdd)]);_0x565ed5[_0x2fb8dd(0xe7)]&&(console['error'](_0x2fb8dd(0xed)+_0x565ed5['site']),_0x200d53['database']?_0x5262fd?console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xcd)+_0x200d53[_0x2fb8dd(0xdd)]):console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xf2)+_0x200d53[_0x2fb8dd(0xdd)]):console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xf7)),_0x200d53[_0x2fb8dd(0xe6)]&&console[_0x2fb8dd(0xd2)]('Table\x20pattern:\x20'+_0x200d53['table']));const _0x3f59e9=_0x200d53[_0x2fb8dd(0xdd)]&&!_0x5262fd?_0x200d53[_0x2fb8dd(0xdd)]:undefined,_0x4ae2ba=_0x5262fd?_0x200d53[_0x2fb8dd(0xdd)]:undefined,_0x19e70d=_0x200d53['table'],_0x4692af=resolveLimit(_0x565ed5[_0x2fb8dd(0xd8)],DEFAULT_LISTING_LIMIT),_0x5c6f94=await withSpinner(_0x2fb8dd(0xf3),()=>_0x1fc4ed[_0x2fb8dd(0xd7)]['listTables'](_0x3f59e9,_0x19e70d,_0x4ae2ba,_0x4692af),{'verbose':_0x565ed5[_0x2fb8dd(0xe7)]}),_0x26c619=_0x5c6f94['data'];if(_0x26c619[_0x2fb8dd(0xef)]===0x0&&_0x200d53[_0x2fb8dd(0xdd)]&&!_0x5262fd)return console['error'](_0x2fb8dd(0xdb)),console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xe5)+_0x200d53[_0x2fb8dd(0xdd)]+_0x2fb8dd(0xe8)),0x1;return console['error']('✔\x20Found\x20'+_0x26c619[_0x2fb8dd(0xef)]+'\x20table'+(_0x26c619[_0x2fb8dd(0xef)]!==0x1?'s':'')),await handleSDKOutput(_0x26c619,{..._0x565ed5,'limit':_0x4692af}),0x0;}catch(_0x3267ea){if(_0x3267ea instanceof SDKError)return console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xd1)+_0x3267ea[_0x2fb8dd(0xca)]),_0x3267ea[_0x2fb8dd(0xd9)]&&console[_0x2fb8dd(0xd2)](_0x2fb8dd(0xf1)+_0x3267ea[_0x2fb8dd(0xd9)]),0x1;throw _0x3267ea;}}[a40_0x572c2c(0xcf)](_0x4a3a32){return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x434452=a41_0x2365;function a41_0x2365(_0x12529e,_0xef0472){_0x12529e=_0x12529e-0x1f4;const _0x24d599=a41_0x24d5();let _0x236583=_0x24d599[_0x12529e];return _0x236583;}(function(_0x3a490b,_0x3a444f){const _0x250923=a41_0x2365,_0x455d45=_0x3a490b();while(!![]){try{const _0x561607=parseInt(_0x250923(0x21a))/0x1*(-parseInt(_0x250923(0x21e))/0x2)+-parseInt(_0x250923(0x218))/0x3*(parseInt(_0x250923(0x1f7))/0x4)+-parseInt(_0x250923(0x1ff))/0x5*(-parseInt(_0x250923(0x215))/0x6)+-parseInt(_0x250923(0x207))/0x7*(parseInt(_0x250923(0x21d))/0x8)+parseInt(_0x250923(0x213))/0x9+-parseInt(_0x250923(0x20b))/0xa+parseInt(_0x250923(0x205))/0xb;if(_0x561607===_0x3a444f)break;else _0x455d45['push'](_0x455d45['shift']());}catch(_0x295514){_0x455d45['push'](_0x455d45['shift']());}}}(a41_0x24d5,0x52717));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import a41_0x4bdf83 from'chalk';export class UseCommand extends BaseCommand{['name']=a41_0x434452(0x1f6);[a41_0x434452(0x222)]=a41_0x434452(0x203);[a41_0x434452(0x223)](_0x75ec14){const _0x14ea10=a41_0x434452,{args:_0x980b10}=_0x75ec14;if(_0x980b10[_0x14ea10(0x20f)]===0x0)return undefined;if(_0x980b10[_0x14ea10(0x20f)]===0x1)return _0x14ea10(0x211)+_0x14ea10(0x224)+_0x14ea10(0x1fb)+'\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace\x0a'+_0x14ea10(0x217);const _0x3e1ac8=_0x980b10[0x0],_0x4cde1d=[_0x14ea10(0x1f4),_0x14ea10(0x216),_0x14ea10(0x202),_0x14ea10(0x208),_0x14ea10(0x21c)];if(!_0x4cde1d[_0x14ea10(0x219)](_0x3e1ac8))return _0x14ea10(0x20e)+_0x3e1ac8+_0x14ea10(0x210)+_0x4cde1d[_0x14ea10(0x21b)](',\x20');return undefined;}async[a41_0x434452(0x212)](_0x2ce9ec){const _0x32ece9=a41_0x434452,{args:_0x2656d5,options:_0x130fc1}=_0x2ce9ec,_0x3cbdfc=_0x130fc1[_0x32ece9(0x20c)],_0x40a414=_0x130fc1[_0x32ece9(0x226)];cleanExpiredSessions();try{if(_0x40a414){clearSessionContext(_0x130fc1[_0x32ece9(0x206)]);const _0x1d2d7c=_0x130fc1[_0x32ece9(0x206)]||getCurrentSessionPID()[_0x32ece9(0x1f9)]();return console['log'](_0x32ece9(0x204)+a41_0x4bdf83['green']('cleared')+'\x20'+a41_0x4bdf83[_0x32ece9(0x1fc)]('(session:\x20'+_0x1d2d7c+')')),0x0;}if(_0x2656d5[_0x32ece9(0x20f)]===0x0){const _0x379eb3=new GlobalContext(_0x130fc1);return _0x3cbdfc?_0x379eb3[_0x32ece9(0x20d)]():_0x379eb3['display'](),console['log'](a41_0x4bdf83[_0x32ece9(0x1fc)](_0x32ece9(0x209))),console[_0x32ece9(0x21f)](a41_0x4bdf83['dim'](_0x32ece9(0x1f8))),0x0;}const _0x2de426=_0x2656d5[0x0],_0x335a9e=_0x2656d5[0x1];if(_0x2de426==='profile'){if(!profileExists(_0x335a9e))return console[_0x32ece9(0x201)](_0x32ece9(0x1fe)+_0x335a9e+_0x32ece9(0x221)),console[_0x32ece9(0x201)](_0x32ece9(0x1f5)),0x1;const _0x1d98fc=_0x130fc1['session']||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x335a9e},_0x130fc1[_0x32ece9(0x206)]),console[_0x32ece9(0x21f)](_0x32ece9(0x214)+a41_0x4bdf83[_0x32ece9(0x1fa)](_0x335a9e)+'\x20'+a41_0x4bdf83['dim'](_0x32ece9(0x200)+_0x1d98fc+')')),console['log'](a41_0x4bdf83[_0x32ece9(0x1fc)](_0x32ece9(0x20a))),0x0;}const _0x12a151={},_0x44798a=_0x130fc1[_0x32ece9(0x206)]||getCurrentSessionPID()['toString']();switch(_0x2de426){case _0x32ece9(0x1f4):_0x12a151[_0x32ece9(0x1f4)]=_0x335a9e,console[_0x32ece9(0x21f)]('Session\x20database\x20set\x20to:\x20'+a41_0x4bdf83[_0x32ece9(0x1fa)](_0x335a9e)+'\x20'+a41_0x4bdf83['dim'](_0x32ece9(0x200)+_0x44798a+')'));break;case _0x32ece9(0x216):_0x12a151[_0x32ece9(0x216)]=_0x335a9e,console[_0x32ece9(0x21f)]('Session\x20parent_segment\x20set\x20to:\x20'+a41_0x4bdf83[_0x32ece9(0x1fa)](_0x335a9e)+'\x20'+a41_0x4bdf83[_0x32ece9(0x1fc)]('(session:\x20'+_0x44798a+')'));break;case _0x32ece9(0x202):_0x12a151[_0x32ece9(0x202)]=_0x335a9e,console[_0x32ece9(0x21f)](_0x32ece9(0x225)+a41_0x4bdf83['green'](_0x335a9e)+'\x20'+a41_0x4bdf83[_0x32ece9(0x1fc)](_0x32ece9(0x200)+_0x44798a+')'));break;case _0x32ece9(0x21c):_0x12a151[_0x32ece9(0x21c)]=_0x335a9e,console['log'](_0x32ece9(0x220)+a41_0x4bdf83['green'](_0x335a9e)+'\x20'+a41_0x4bdf83[_0x32ece9(0x1fc)](_0x32ece9(0x200)+_0x44798a+')'));break;}return saveSessionContext(_0x12a151,_0x130fc1[_0x32ece9(0x206)]),console['log'](a41_0x4bdf83[_0x32ece9(0x1fc)](_0x32ece9(0x20a))),0x0;}catch(_0x22a431){return _0x22a431 instanceof Error&&console[_0x32ece9(0x201)]('Error:\x20'+_0x22a431[_0x32ece9(0x1fd)]),0x1;}}}function a41_0x24d5(){const _0x3b8fc6=['execute','2450637zHCPGW','Session\x20profile\x20set\x20to:\x20','246aAECEu','parent_segment','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','9snQloS','includes','558039KWVJco','join','engage_workspace','503608gxaZyx','2syehwK','log','Session\x20engage_workspace\x20set\x20to:\x20','\x27\x20does\x20not\x20exist','description','validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a','Session\x20llm_project\x20set\x20to:\x20','clear','database','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','use','385428nEncwZ','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace','toString','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','dim','message','Error:\x20Profile\x20\x27','19770zDdUuF','(session:\x20','error','llm_project','Set\x20session-level\x20context','Session\x20context\x20','21543104SRBvAy','session','63lMwySW','profile','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','6415150XqQcsl','debug','displayWithSources','Invalid\x20resource:\x20','length','.\x20Must\x20be\x20one\x20of:\x20','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a'];a41_0x24d5=function(){return _0x3b8fc6;};return a41_0x24d5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x387fe0=a42_0x5658;function a42_0x5658(_0x16e3fd,_0x4e5b05){_0x16e3fd=_0x16e3fd-0xea;const _0x2642b5=a42_0x2642();let _0x56587d=_0x2642b5[_0x16e3fd];return _0x56587d;}function a42_0x2642(){const _0x5031cb=['12429172GPmXuu','length','✔\x20Found\x20','Error:\x20','Show\x20current\x20user\x20information','8suUUZR','user\x20list','Fetching\x20user\x20info...','message','cause','6UcBKLb','4327964bmWCrk','808683dCHOgf','user','verbose','error','922372MZYRan','10DqPhaW','Listing\x20users...','1326235xIKYYO','execute','name','description','2547130bWgRlV','45sbqTvj','18511229lvHZFy'];a42_0x2642=function(){return _0x5031cb;};return a42_0x2642();}(function(_0x58ccfb,_0x82b1b3){const _0x1861b1=a42_0x5658,_0xe7b1f8=_0x58ccfb();while(!![]){try{const _0x53dbb1=parseInt(_0x1861b1(0xfc))/0x1+-parseInt(_0x1861b1(0xfd))/0x2*(-parseInt(_0x1861b1(0xf8))/0x3)+parseInt(_0x1861b1(0xf7))/0x4+parseInt(_0x1861b1(0xff))/0x5*(-parseInt(_0x1861b1(0xf6))/0x6)+parseInt(_0x1861b1(0xec))/0x7*(-parseInt(_0x1861b1(0xf1))/0x8)+parseInt(_0x1861b1(0xea))/0x9*(parseInt(_0x1861b1(0x103))/0xa)+-parseInt(_0x1861b1(0xeb))/0xb;if(_0x53dbb1===_0x82b1b3)break;else _0xe7b1f8['push'](_0xe7b1f8['shift']());}catch(_0x3cfa32){_0xe7b1f8['push'](_0xe7b1f8['shift']());}}}(a42_0x2642,0xdc3a3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{['name']=a42_0x387fe0(0xf9);[a42_0x387fe0(0x102)]=a42_0x387fe0(0xf0);async[a42_0x387fe0(0x100)](_0x22503d){const _0x2004b8=a42_0x387fe0,{options:_0x2c905b,tdx:_0x20cd12}=_0x22503d;try{const _0x40f2e1=await withSpinner(_0x2004b8(0xf3),()=>_0x20cd12[_0x2004b8(0xf9)]['getCurrent'](),{'verbose':_0x2c905b[_0x2004b8(0xfa)]}),_0x3d8a8b=_0x40f2e1['data'];return await handleSingleObjectOutput(_0x3d8a8b,_0x2c905b),0x0;}catch(_0x4c64c2){if(_0x4c64c2 instanceof SDKError)return console[_0x2004b8(0xfb)](_0x2004b8(0xef)+_0x4c64c2[_0x2004b8(0xf4)]),_0x4c64c2['cause']&&console[_0x2004b8(0xfb)]('\x20\x20Cause:\x20'+_0x4c64c2[_0x2004b8(0xf5)]),0x1;throw _0x4c64c2;}}}export class UserListCommand extends BaseCommand{[a42_0x387fe0(0x101)]=a42_0x387fe0(0xf2);[a42_0x387fe0(0x102)]='List\x20all\x20users\x20in\x20the\x20account';async[a42_0x387fe0(0x100)](_0x2384c3){const _0x6ef686=a42_0x387fe0,{options:_0x3b2d0b,tdx:_0x5a83d7}=_0x2384c3;try{const _0x4fa4ec=await withSpinner(_0x6ef686(0xfe),()=>_0x5a83d7['user']['list'](),{'verbose':_0x3b2d0b[_0x6ef686(0xfa)]}),_0xc29e55=_0x4fa4ec['data'];return console[_0x6ef686(0xfb)](_0x6ef686(0xee)+_0xc29e55[_0x6ef686(0xed)]+'\x20user'+(_0xc29e55[_0x6ef686(0xed)]!==0x1?'s':'')),await handleSDKOutput(_0xc29e55,_0x3b2d0b),0x0;}catch(_0x279d17){if(_0x279d17 instanceof SDKError)return console[_0x6ef686(0xfb)](_0x6ef686(0xef)+_0x279d17[_0x6ef686(0xf4)]),_0x279d17[_0x6ef686(0xf5)]&&console['error']('\x20\x20Cause:\x20'+_0x279d17[_0x6ef686(0xf5)]),0x1;throw _0x279d17;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x20f80e=a43_0x4cb6;function a43_0x23f9(){const _0x1dcc6e=['\x22?\x20This\x20cannot\x20be\x20undone.','Error:\x20Invalid\x20JSON\x20in\x20--params','Include\x20retried:\x20yes','projects','status','Listing\x20workflow\x20attempts...','\x20\x20Project:\x20','force','Cancelled','download','54GOWYuM','workflow:workflows','\x20\x20Files\x20extracted:\x20','1179564YHzTkK','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','createdAt','List\x20all\x20workflow\x20projects','3100518OwdNzH','Pattern:\x20','map','execute','split','workflow','params','Project\x20filter:\x20','Getting\x20attempt\x20tasks...','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Killing\x20attempt...','push','from','Revision:\x20','\x20\x20Session\x20ID:\x20','\x20\x20Cause:\x20','includeSubtasks','resumeFrom','projectId','sessionTime','skipValidation','workflow:push','reason','10EMjTPA','✔\x20Pushed\x20','Project:\x20','indexOf','limit','\x20\x20Revision:\x20','Project\x20directory:\x20','\x20\x20New\x20attempt\x20ID:\x20','name','substring','\x20attempt','getTime','List\x20workflow\x20execution\x20sessions','Fetching\x20log\x20files...','parse','Attempt\x20ID:\x20','\x20\x20Workflow:\x20','✔\x20Deleted\x20project\x20','Task\x20name:\x20','retryAttempt','tasks','logFiles','workflow:retry','length','Retry\x20a\x20session\x20or\x20attempt','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Including\x20subtasks:\x20yes','workflow:logs','fileSize','Error:\x20Attempt\x20ID\x20is\x20required','workflow:projects','Usage:\x20workflow:delete\x20<project-name-or-id>','Reason:\x20','cause','Resume\x20from:\x20','...','Listing\x20workflow\x20sessions...','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','\x20\x20Attempt\x20ID:\x20','workflow:download','workflow:delete','attempt:','\x20is\x20not\x20a\x20directory','logs','Project\x20name:\x20','Output\x20directory:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','\x20workflow','fromTask','Show\x20specific\x20attempt\x20details','success','json','round','param','Select\x20a\x20task\x20to\x20view\x20logs:','✔\x20Found\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Filter:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','attempts','Target:\x20','description','project','53228JBWlih','Downloading\x20logs...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','\x20\x20Project\x20ID:\x20','error','No\x20log\x20content\x20found','workflow:attempts','List\x20workflow\x20attempts','Session\x20time:\x20','\x20task','projectName','Error:\x20Workflow\x20identifier\x20is\x20required','Deleting\x20project\x20','workflow:attempt','retryAttemptName','Filter:\x20project=','attempt','Workflow:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','workflow:tasks','message','561eykgdR','sessions','cancelRequested','Start\x20a\x20workflow\x20run','Error:\x20Project\x20name\x20is\x20required','yes','stat','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','sessionId','session:','workflow:kill','Listing\x20workflows...','Getting\x20attempt\x20details...','✔\x20Workflow\x20run\x20started','Validation:\x20skipped','verbose','Starting\x20workflow\x20run...','Listing\x20workflow\x20projects...','Error:\x20','isDirectory','task','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','format','run','Show\x20tasks\x20for\x20an\x20attempt','Downloading\x20project\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','session','From\x20task:\x20','data','delete','1149407hLupaA','finishedAt','startsWith','keys','No\x20log\x20files\x20found\x20for\x20this\x20attempt','revision','Expected\x20format:\x20--param\x20key=value','Kill\x20a\x20running\x20attempt','List\x20workflows','47925IofYaU','taskName','workflow:sessions','1742672xjArQa','index','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','retrySession'];a43_0x23f9=function(){return _0x1dcc6e;};return a43_0x23f9();}(function(_0x2cf9e6,_0x7ba50a){const _0x53c400=a43_0x4cb6,_0x2eea7b=_0x2cf9e6();while(!![]){try{const _0x5ac4d0=parseInt(_0x53c400(0x1f0))/0x1*(parseInt(_0x53c400(0x229))/0x2)+-parseInt(_0x53c400(0x218))/0x3+parseInt(_0x53c400(0x1db))/0x4*(parseInt(_0x53c400(0x19c))/0x5)+-parseInt(_0x53c400(0x22c))/0x6+parseInt(_0x53c400(0x20f))/0x7+-parseInt(_0x53c400(0x21b))/0x8+parseInt(_0x53c400(0x230))/0x9;if(_0x5ac4d0===_0x7ba50a)break;else _0x2eea7b['push'](_0x2eea7b['shift']());}catch(_0x54a176){_0x2eea7b['push'](_0x2eea7b['shift']());}}}(a43_0x23f9,0x1d4fd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x1a105c from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ba);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22f);async['execute'](_0x2997a4){const _0x3da6c1=a43_0x20f80e,{options:_0x17521d,args:_0x4dbdff,tdx:_0x2334c2}=_0x2997a4,_0x8ac48e=_0x4dbdff[0x0];try{_0x17521d['verbose']&&_0x8ac48e&&console['error'](_0x3da6c1(0x231)+_0x8ac48e);const _0x51ce37=await withSpinner(_0x3da6c1(0x201),()=>_0x2334c2['workflow'][_0x3da6c1(0x222)](_0x8ac48e,{'limit':_0x17521d['limit']}),{'verbose':_0x17521d[_0x3da6c1(0x1ff)]}),_0x5832ad=_0x51ce37['data'];return console[_0x3da6c1(0x1df)]('✔\x20Found\x20'+_0x5832ad['length']+'\x20project'+(_0x5832ad[_0x3da6c1(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x5832ad,_0x17521d),0x0;}catch(_0x4f9232){if(_0x4f9232 instanceof SDKError)return console[_0x3da6c1(0x1df)](_0x3da6c1(0x202)+_0x4f9232[_0x3da6c1(0x1ef)]),_0x4f9232[_0x3da6c1(0x1bd)]&&console[_0x3da6c1(0x1df)](_0x3da6c1(0x23f)+_0x4f9232[_0x3da6c1(0x1bd)]),0x1;throw _0x4f9232;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a43_0x20f80e(0x22a);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x217);async[a43_0x20f80e(0x233)](_0x5e6e71){const _0x20145f=a43_0x20f80e,{options:_0x496ae5,args:_0x531edb,tdx:_0xc6c6b1}=_0x5e6e71,_0x517b1a=_0x531edb[0x0];try{_0x496ae5['verbose']&&_0x517b1a&&console['error'](_0x20145f(0x237)+_0x517b1a);const _0x5f2b0a=await withSpinner(_0x20145f(0x1fb),()=>_0xc6c6b1[_0x20145f(0x235)]['workflows'](_0x517b1a,{'limit':_0x496ae5[_0x20145f(0x1a0)]}),{'verbose':_0x496ae5[_0x20145f(0x1ff)]}),_0x54cc61=_0x5f2b0a[_0x20145f(0x20d)];return console[_0x20145f(0x1df)](_0x20145f(0x1d3)+_0x54cc61[_0x20145f(0x1b3)]+_0x20145f(0x1cb)+(_0x54cc61[_0x20145f(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x54cc61,_0x496ae5),0x0;}catch(_0x9be6c6){if(_0x9be6c6 instanceof SDKError)return console[_0x20145f(0x1df)]('Error:\x20'+_0x9be6c6[_0x20145f(0x1ef)]),_0x9be6c6['cause']&&console['error'](_0x20145f(0x23f)+_0x9be6c6[_0x20145f(0x1bd)]),0x1;throw _0x9be6c6;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x21a);['description']=a43_0x20f80e(0x1a8);async['execute'](_0x61fc30){const _0x31a9c7=a43_0x20f80e,{options:_0x4369e8,args:_0x1fa680,tdx:_0x684902}=_0x61fc30;let _0x5ad637,_0xf96651;if(_0x1fa680[0x0]){const _0x5c7b52=_0x1fa680[0x0][_0x31a9c7(0x234)]('.');if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x1)_0x5ad637=_0x5c7b52[0x0];else{if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x2)[_0x5ad637,_0xf96651]=_0x5c7b52;else return console[_0x31a9c7(0x1df)](_0x31a9c7(0x239)),0x1;}}try{if(_0x4369e8[_0x31a9c7(0x1ff)]){if(_0x5ad637&&_0xf96651)console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d5)+_0x5ad637+'.'+_0xf96651);else _0x5ad637&&console['error'](_0x31a9c7(0x1ea)+_0x5ad637);const _0x25417f=_0x4369e8[_0x31a9c7(0x223)];_0x25417f&&console[_0x31a9c7(0x1df)]('Status:\x20'+_0x25417f);}const _0x5b1347=await withSpinner(_0x31a9c7(0x1c0),()=>_0x684902[_0x31a9c7(0x235)][_0x31a9c7(0x1f1)]({'projectName':_0x5ad637,'workflowName':_0xf96651,'status':_0x4369e8[_0x31a9c7(0x223)],'fromTime':_0x4369e8[_0x31a9c7(0x23c)],'toTime':_0x4369e8['to'],'limit':_0x4369e8[_0x31a9c7(0x1a0)]}),{'verbose':_0x4369e8[_0x31a9c7(0x1ff)]}),_0x591dc5=_0x5b1347['data'];return console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d3)+_0x591dc5[_0x31a9c7(0x1b3)]+'\x20session'+(_0x591dc5[_0x31a9c7(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x591dc5,_0x4369e8),0x0;}catch(_0x1bbfd2){if(_0x1bbfd2 instanceof SDKError)return console[_0x31a9c7(0x1df)](_0x31a9c7(0x202)+_0x1bbfd2[_0x31a9c7(0x1ef)]),_0x1bbfd2['cause']&&console[_0x31a9c7(0x1df)](_0x31a9c7(0x23f)+_0x1bbfd2['cause']),0x1;throw _0x1bbfd2;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e1);['description']=a43_0x20f80e(0x1e2);async['execute'](_0x4728e8){const _0x23d2e9=a43_0x20f80e,{options:_0x3aace3,args:_0x413eaf,tdx:_0x13bc3c}=_0x4728e8;let _0x34106b,_0x39f95a;if(_0x413eaf[0x0]){const _0x346053=_0x413eaf[0x0]['split']('.');if(_0x346053['length']===0x1)_0x34106b=_0x346053[0x0];else{if(_0x346053['length']===0x2)[_0x34106b,_0x39f95a]=_0x346053;else return console[_0x23d2e9(0x1df)](_0x23d2e9(0x239)),0x1;}}try{const _0x4d5d21=_0x3aace3['includeRetried'];if(_0x3aace3[_0x23d2e9(0x1ff)]){if(_0x34106b&&_0x39f95a)console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d5)+_0x34106b+'.'+_0x39f95a);else _0x34106b&&console[_0x23d2e9(0x1df)]('Filter:\x20project='+_0x34106b);_0x4d5d21&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x221));}const _0x1d2def=await withSpinner(_0x23d2e9(0x224),()=>_0x13bc3c[_0x23d2e9(0x235)][_0x23d2e9(0x1d7)]({'projectName':_0x34106b,'workflowName':_0x39f95a,'includeRetried':_0x4d5d21,'limit':_0x3aace3[_0x23d2e9(0x1a0)]}),{'verbose':_0x3aace3['verbose']}),_0x336de2=_0x1d2def[_0x23d2e9(0x20d)];return console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d3)+_0x336de2[_0x23d2e9(0x1b3)]+_0x23d2e9(0x1a6)+(_0x336de2[_0x23d2e9(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x336de2,_0x3aace3),0x0;}catch(_0x242364){if(_0x242364 instanceof SDKError)return console[_0x23d2e9(0x1df)](_0x23d2e9(0x202)+_0x242364[_0x23d2e9(0x1ef)]),_0x242364[_0x23d2e9(0x1bd)]&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x23f)+_0x242364['cause']),0x1;throw _0x242364;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e8);['description']=a43_0x20f80e(0x1cd);async[a43_0x20f80e(0x233)](_0x260540){const _0x411b54=a43_0x20f80e,{options:_0x30c776,args:_0x510a48,tdx:_0x294071}=_0x260540,_0x2c1289=_0x510a48[0x0];if(!_0x2c1289)return console[_0x411b54(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x30c776[_0x411b54(0x1ff)]&&console[_0x411b54(0x1df)](_0x411b54(0x1ab)+_0x2c1289);const _0x568e48=await withSpinner(_0x411b54(0x1fc),()=>_0x294071[_0x411b54(0x235)][_0x411b54(0x1eb)](_0x2c1289),{'verbose':_0x30c776['verbose']}),_0x3c2742=_0x568e48[_0x411b54(0x20d)];let _0x162fdc;!_0x3c2742['done']?_0x162fdc=_0x3c2742[_0x411b54(0x1f2)]?'canceling':'running':_0x162fdc=_0x3c2742['success']?_0x411b54(0x1ce):_0x411b54(0x1df);let _0x1371f6;if(_0x3c2742[_0x411b54(0x22e)]&&_0x3c2742[_0x411b54(0x210)]){const _0x13da13=new Date(_0x3c2742[_0x411b54(0x22e)])[_0x411b54(0x1a7)](),_0x5dd25c=new Date(_0x3c2742[_0x411b54(0x210)])['getTime']();_0x1371f6=Math[_0x411b54(0x1d0)]((_0x5dd25c-_0x13da13)/0x3e8);}const _0xaf2aff={'attempt_id':_0x3c2742['id'],'status':_0x162fdc,..._0x3c2742[_0x411b54(0x21c)]!==undefined&&{'index':_0x3c2742[_0x411b54(0x21c)]},..._0x3c2742[_0x411b54(0x1da)]&&{'project':_0x3c2742[_0x411b54(0x1da)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x235)]&&{'workflow':_0x3c2742[_0x411b54(0x235)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x1f8)]&&{'session_id':_0x3c2742[_0x411b54(0x1f8)]},..._0x3c2742[_0x411b54(0x243)]&&{'session_time':_0x3c2742[_0x411b54(0x243)]},..._0x3c2742[_0x411b54(0x1e9)]&&{'retry_attempt':_0x3c2742['retryAttemptName']},..._0x1371f6!==undefined&&{'duration_sec':_0x1371f6},..._0x3c2742[_0x411b54(0x22e)]&&{'created_at':_0x3c2742[_0x411b54(0x22e)]},..._0x3c2742[_0x411b54(0x210)]&&{'finished_at':_0x3c2742[_0x411b54(0x210)]},...Object[_0x411b54(0x212)](_0x3c2742[_0x411b54(0x236)])[_0x411b54(0x1b3)]>0x0&&{'params':_0x3c2742['params']}};return await handleSingleObjectOutput(_0xaf2aff,_0x30c776),0x0;}catch(_0x7fd602){if(_0x7fd602 instanceof SDKError)return console[_0x411b54(0x1df)](_0x411b54(0x202)+_0x7fd602[_0x411b54(0x1ef)]),_0x7fd602['cause']&&console[_0x411b54(0x1df)](_0x411b54(0x23f)+_0x7fd602[_0x411b54(0x1bd)]),0x1;throw _0x7fd602;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ee);['description']=a43_0x20f80e(0x208);async[a43_0x20f80e(0x233)](_0x3475bb){const _0x41f306=a43_0x20f80e,{options:_0x19e1ba,args:_0x2d10b7,tdx:_0x587dfb}=_0x3475bb,_0x36b97e=_0x2d10b7[0x0];if(!_0x36b97e)return console[_0x41f306(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x347cb6=_0x19e1ba[_0x41f306(0x240)];_0x19e1ba[_0x41f306(0x1ff)]&&(console[_0x41f306(0x1df)]('Attempt\x20ID:\x20'+_0x36b97e),_0x347cb6&&console[_0x41f306(0x1df)](_0x41f306(0x1b6)));const _0x3d7dab=await withSpinner(_0x41f306(0x238),()=>_0x587dfb[_0x41f306(0x235)][_0x41f306(0x1b0)](_0x36b97e,_0x347cb6||![]),{'verbose':_0x19e1ba[_0x41f306(0x1ff)]}),_0x4029ab=_0x3d7dab[_0x41f306(0x20d)];return console['error']('✔\x20Found\x20'+_0x4029ab[_0x41f306(0x1b3)]+_0x41f306(0x1e4)+(_0x4029ab[_0x41f306(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x4029ab,_0x19e1ba),0x0;}catch(_0x5537f7){if(_0x5537f7 instanceof SDKError)return console['error'](_0x41f306(0x202)+_0x5537f7[_0x41f306(0x1ef)]),_0x5537f7[_0x41f306(0x1bd)]&&console[_0x41f306(0x1df)](_0x41f306(0x23f)+_0x5537f7[_0x41f306(0x1bd)]),0x1;throw _0x5537f7;}}}export class WorkflowLogsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1b7);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1d4);async[a43_0x20f80e(0x233)](_0x14a1f0){const _0x4e69a7=a43_0x20f80e,{options:_0x1f2c37,args:_0x52e89b,tdx:_0x1f3711}=_0x14a1f0,_0x42c398=_0x52e89b[0x0];let _0xd8ffbd=_0x52e89b[0x1];if(!_0x42c398)return console[_0x4e69a7(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x1f2c37[_0x4e69a7(0x1ff)]&&(console['error']('Attempt\x20ID:\x20'+_0x42c398),_0xd8ffbd&&console[_0x4e69a7(0x1df)](_0x4e69a7(0x1ae)+_0xd8ffbd));const _0x3f40bb=await withSpinner(_0x4e69a7(0x1a9),()=>_0x1f3711['workflow'][_0x4e69a7(0x1b1)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x295b1a=_0x3f40bb[_0x4e69a7(0x20d)];if(_0x295b1a['length']===0x0)return console['error'](_0x4e69a7(0x213)),0x0;if(!_0xd8ffbd&&(_0x1f2c37[_0x4e69a7(0x1cf)]||_0x1f2c37[_0x4e69a7(0x206)]))return await handleSDKOutput(_0x295b1a,_0x1f2c37),0x0;if(!_0xd8ffbd){const _0x490a7b=_0x295b1a[_0x4e69a7(0x232)](_0x13690f=>({'title':_0x13690f[_0x4e69a7(0x219)]+'\x20('+formatBytes(_0x13690f[_0x4e69a7(0x1b8)])+')','value':_0x13690f[_0x4e69a7(0x219)]})),_0x37c28e=await a43_0x1a105c({'type':'select','name':'task','message':_0x4e69a7(0x1d2),'choices':_0x490a7b});if(!_0x37c28e[_0x4e69a7(0x204)])return console['error'](_0x4e69a7(0x227)),0x0;_0xd8ffbd=_0x37c28e['task'];}const _0x5b8dbf=await withSpinner(_0x4e69a7(0x1dc),()=>_0x1f3711[_0x4e69a7(0x235)][_0x4e69a7(0x1c7)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x130617=_0x5b8dbf['data'];return _0x130617?console['log'](_0x130617):console['error'](_0x4e69a7(0x1e0)),0x0;}catch(_0x4a19a4){if(_0x4a19a4 instanceof SDKError)return console[_0x4e69a7(0x1df)]('Error:\x20'+_0x4a19a4['message']),_0x4a19a4[_0x4e69a7(0x1bd)]&&console['error'](_0x4e69a7(0x23f)+_0x4a19a4['cause']),0x1;throw _0x4a19a4;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1fa);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x216);async[a43_0x20f80e(0x233)](_0x457880){const _0x5c6b39=a43_0x20f80e,{options:_0x435dfa,args:_0x41fc9e,tdx:_0x2576cb}=_0x457880,_0x1cd459=_0x41fc9e[0x0];if(!_0x1cd459)return console[_0x5c6b39(0x1df)](_0x5c6b39(0x1b9)),0x1;try{const _0x58d155=_0x435dfa[_0x5c6b39(0x19b)];_0x435dfa['verbose']&&(console[_0x5c6b39(0x1df)](_0x5c6b39(0x1ab)+_0x1cd459),_0x58d155&&console[_0x5c6b39(0x1df)](_0x5c6b39(0x1bc)+_0x58d155));if(!_0x435dfa[_0x5c6b39(0x1f5)]){const _0x40f8be=await confirm(_0x5c6b39(0x1ed)+_0x1cd459+'?');if(!_0x40f8be)return console[_0x5c6b39(0x1df)]('Cancelled'),0x0;}const _0x4fb8e8=await withSpinner(_0x5c6b39(0x23a),()=>_0x2576cb[_0x5c6b39(0x235)]['kill'](_0x1cd459,_0x58d155),{'verbose':_0x435dfa[_0x5c6b39(0x1ff)]}),_0x35d0c7=_0x4fb8e8['data'];return console['error']('✔\x20'+_0x35d0c7),0x0;}catch(_0x377903){if(_0x377903 instanceof SDKError)return console['error'](_0x5c6b39(0x202)+_0x377903['message']),_0x377903[_0x5c6b39(0x1bd)]&&console['error']('\x20\x20Cause:\x20'+_0x377903[_0x5c6b39(0x1bd)]),0x1;throw _0x377903;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a43_0x20f80e(0x1b2);['description']=a43_0x20f80e(0x1b4);async[a43_0x20f80e(0x233)](_0x207780){const _0x3f6532=a43_0x20f80e,{options:_0xf6c02,args:_0x6809ef,tdx:_0x185422}=_0x207780,_0x4b068e=_0x6809ef[0x0];if(!_0x4b068e)return console[_0x3f6532(0x1df)](_0x3f6532(0x205)),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;let _0x1a39d4=![],_0x179134=_0x4b068e;if(_0x4b068e['startsWith'](_0x3f6532(0x1f9)))_0x1a39d4=!![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else{if(_0x4b068e[_0x3f6532(0x211)](_0x3f6532(0x1c5)))_0x1a39d4=![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;}try{const _0x23ee62=_0xf6c02[_0x3f6532(0x1cc)],_0x1a61c1=_0xf6c02[_0x3f6532(0x241)],_0x914f86=_0xf6c02['params'],_0x3bea8d=_0xf6c02[_0x3f6532(0x226)];_0xf6c02[_0x3f6532(0x1ff)]&&(console[_0x3f6532(0x1df)](_0x3f6532(0x1d8)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134),_0x23ee62&&console[_0x3f6532(0x1df)](_0x3f6532(0x20c)+_0x23ee62),_0x1a61c1&&console[_0x3f6532(0x1df)](_0x3f6532(0x1be)+_0x1a61c1),_0x914f86&&console['error']('Params:\x20'+_0x914f86),_0x3bea8d&&console[_0x3f6532(0x1df)]('Force:\x20yes'));let _0x1d70f9;if(_0x914f86)try{if(_0x914f86[_0x3f6532(0x211)]('@')){const _0x38ddeb=await import('fs/promises'),_0x4cf646=_0x914f86['substring'](0x1),_0x500373=await _0x38ddeb['readFile'](_0x4cf646,'utf-8');_0x1d70f9=JSON[_0x3f6532(0x1aa)](_0x500373);}else _0x1d70f9=JSON['parse'](_0x914f86);}catch{return console[_0x3f6532(0x1df)](_0x3f6532(0x220)),0x1;}if(!_0xf6c02[_0x3f6532(0x1f5)]){const _0x3e11d0=await confirm(_0x3f6532(0x20a)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134+'?');if(!_0x3e11d0)return console[_0x3f6532(0x1df)](_0x3f6532(0x227)),0x0;}let _0x2356ff;_0x1a39d4?_0x2356ff=await withSpinner('Retrying\x20session...',()=>_0x185422[_0x3f6532(0x235)][_0x3f6532(0x21e)](_0x179134,{'fromTask':_0x23ee62,'retryParams':_0x1d70f9}),{'verbose':_0xf6c02['verbose']}):_0x2356ff=await withSpinner('Retrying\x20attempt...',()=>_0x185422['workflow'][_0x3f6532(0x1af)](_0x179134,{'resumeFrom':_0x1a61c1,'retryParams':_0x1d70f9,'force':_0x3bea8d}),{'verbose':_0xf6c02[_0x3f6532(0x1ff)]});const _0x4fe6f9=_0x2356ff['data'];return console[_0x3f6532(0x1df)]('✔\x20Retry\x20started'),console['error'](_0x3f6532(0x1a3)+_0x4fe6f9['attemptId']),console[_0x3f6532(0x1df)](_0x3f6532(0x23e)+_0x4fe6f9['sessionId']),0x0;}catch(_0x1bac21){if(_0x1bac21 instanceof SDKError)return console[_0x3f6532(0x1df)](_0x3f6532(0x202)+_0x1bac21[_0x3f6532(0x1ef)]),_0x1bac21[_0x3f6532(0x1bd)]&&console['error'](_0x3f6532(0x23f)+_0x1bac21[_0x3f6532(0x1bd)]),0x1;throw _0x1bac21;}}}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1f3);async[a43_0x20f80e(0x233)](_0x319b02){const _0x340caf=a43_0x20f80e,{options:_0x544144,args:_0x30e394,tdx:_0xbb002b}=_0x319b02,_0x73a0a7=_0x30e394[0x0];if(!_0x73a0a7)return console['error'](_0x340caf(0x1e6)),console[_0x340caf(0x1df)](_0x340caf(0x1c1)),0x1;const _0x123b3e=_0x544144[_0x340caf(0x1d1)],_0x542330=_0x544144[_0x340caf(0x243)],_0x3f6df9={};if(_0x123b3e&&Array['isArray'](_0x123b3e))for(const _0x1c834e of _0x123b3e){const _0x574599=_0x1c834e[_0x340caf(0x19f)]('=');if(_0x574599===-0x1)return console[_0x340caf(0x1df)](_0x340caf(0x1ca)+_0x1c834e),console[_0x340caf(0x1df)](_0x340caf(0x215)),0x1;const _0x5128ac=_0x1c834e['substring'](0x0,_0x574599),_0x29917d=_0x1c834e[_0x340caf(0x1a5)](_0x574599+0x1);try{_0x3f6df9[_0x5128ac]=JSON[_0x340caf(0x1aa)](_0x29917d);}catch{_0x3f6df9[_0x5128ac]=_0x29917d;}}_0x544144[_0x340caf(0x1ff)]&&(console[_0x340caf(0x1df)](_0x340caf(0x1ec)+_0x73a0a7),Object[_0x340caf(0x212)](_0x3f6df9)[_0x340caf(0x1b3)]>0x0&&console['error']('Parameters:\x20'+JSON['stringify'](_0x3f6df9)),_0x542330&&console[_0x340caf(0x1df)](_0x340caf(0x1e3)+_0x542330));const _0x4430ad=await withSpinner(_0x340caf(0x200),()=>_0xbb002b[_0x340caf(0x235)][_0x340caf(0x207)](_0x73a0a7,_0x3f6df9,{'sessionTime':_0x542330}),{'verbose':_0x544144['verbose']}),_0x38a755=_0x4430ad['data'];return console['error'](_0x340caf(0x1fd)),console[_0x340caf(0x1df)](_0x340caf(0x1c2)+_0x38a755['id']),console[_0x340caf(0x1df)]('\x20\x20Session\x20ID:\x20'+_0x38a755[_0x340caf(0x1f8)]),console[_0x340caf(0x1df)](_0x340caf(0x225)+_0x38a755[_0x340caf(0x1da)]?.['name']),console[_0x340caf(0x1df)](_0x340caf(0x1ac)+_0x38a755[_0x340caf(0x235)]?.[_0x340caf(0x1a4)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1c3);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x21d);async['execute'](_0x5bc304){const _0x133aa0=a43_0x20f80e,{options:_0x304b00,args:_0x295766,tdx:_0x2a6288}=_0x5bc304,_0x50b63b=_0x295766[0x0],_0x51ec7e=_0x295766[0x1]||'.';if(!_0x50b63b)return console[_0x133aa0(0x1df)](_0x133aa0(0x1f4)),console[_0x133aa0(0x1df)](_0x133aa0(0x1dd)),0x1;const _0x543ebe=_0x304b00[_0x133aa0(0x214)];_0x304b00[_0x133aa0(0x1ff)]&&(console['error'](_0x133aa0(0x19e)+_0x50b63b),console['error'](_0x133aa0(0x1c9)+_0x51ec7e),_0x543ebe&&console['error'](_0x133aa0(0x23d)+_0x543ebe));const _0x49f35d=await withSpinner(_0x133aa0(0x209)+_0x50b63b+_0x133aa0(0x1bf),()=>_0x2a6288[_0x133aa0(0x235)][_0x133aa0(0x228)](_0x50b63b,_0x51ec7e,{'revision':_0x543ebe}),{'verbose':_0x304b00[_0x133aa0(0x1ff)]}),_0x59324f=_0x49f35d[_0x133aa0(0x20d)];return console['error']('✔\x20Downloaded\x20'+_0x59324f[_0x133aa0(0x1e5)]),console[_0x133aa0(0x1df)](_0x133aa0(0x1a1)+_0x59324f[_0x133aa0(0x214)]),console['error'](_0x133aa0(0x22b)+_0x59324f['filesExtracted']),console[_0x133aa0(0x1df)]('\x20\x20Location:\x20'+_0x51ec7e+'/'+_0x59324f['projectName']),0x0;}}function a43_0x4cb6(_0x49c0e2,_0x50d60c){_0x49c0e2=_0x49c0e2-0x199;const _0x23f913=a43_0x23f9();let _0x4cb649=_0x23f913[_0x49c0e2];return _0x4cb649;}export class WorkflowPushCommand extends BaseCommand{['name']=a43_0x20f80e(0x19a);['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a43_0x20f80e(0x233)](_0x1c1e27){const _0x1630b2=a43_0x20f80e,{options:_0x3ddd85,args:_0x5be7fa,tdx:_0x4825fc}=_0x1c1e27;let _0x416104='.',_0x27edef=_0x3ddd85['name'];if(_0x5be7fa[0x0]){const {promises:_0x380e47}=await import('fs');try{const _0x139d23=await _0x380e47[_0x1630b2(0x1f6)](_0x5be7fa[0x0]);if(_0x139d23[_0x1630b2(0x203)]())_0x416104=_0x5be7fa[0x0];else return console[_0x1630b2(0x1df)](_0x1630b2(0x202)+_0x5be7fa[0x0]+_0x1630b2(0x1c6)),0x1;}catch{_0x27edef=_0x5be7fa[0x0],_0x416104='.';}}const _0x25a250=_0x3ddd85[_0x1630b2(0x214)],_0x99d55a=_0x3ddd85[_0x1630b2(0x199)];_0x3ddd85[_0x1630b2(0x1ff)]&&(console[_0x1630b2(0x1df)](_0x1630b2(0x1a2)+_0x416104),_0x27edef&&console[_0x1630b2(0x1df)](_0x1630b2(0x1c8)+_0x27edef),_0x25a250&&console['error'](_0x1630b2(0x23d)+_0x25a250),_0x99d55a&&console[_0x1630b2(0x1df)](_0x1630b2(0x1fe)));const _0x80cf32=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x4825fc[_0x1630b2(0x235)][_0x1630b2(0x23b)](_0x416104,{'projectName':_0x27edef,'revision':_0x25a250,'skipValidation':_0x99d55a}),{'verbose':_0x3ddd85[_0x1630b2(0x1ff)]}),_0x2b3e11=_0x80cf32[_0x1630b2(0x20d)];return console[_0x1630b2(0x1df)](_0x1630b2(0x19d)+_0x2b3e11[_0x1630b2(0x1e5)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1de)+_0x2b3e11[_0x1630b2(0x242)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1a1)+_0x2b3e11[_0x1630b2(0x214)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x20f80e(0x1c4);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22d);async['execute'](_0x3ec2a6){const _0x4ba6d6=a43_0x20f80e,{options:_0x3e7db1,args:_0x1f8ec3,tdx:_0xbc4735}=_0x3ec2a6,_0x45fdc7=_0x1f8ec3[0x0];if(!_0x45fdc7)return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1f7)),console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1bb)),0x1;_0x3e7db1[_0x4ba6d6(0x1ff)]&&console[_0x4ba6d6(0x1df)]('Project:\x20'+_0x45fdc7);if(!_0x3e7db1[_0x4ba6d6(0x1f5)]){const _0x5d96d3=await confirm(_0x4ba6d6(0x1b5)+_0x45fdc7+_0x4ba6d6(0x21f));if(!_0x5d96d3)return console[_0x4ba6d6(0x1df)]('Cancelled'),0x0;}const _0x27f1d3=await withSpinner(_0x4ba6d6(0x1e7)+_0x45fdc7+_0x4ba6d6(0x1bf),()=>_0xbc4735['workflow'][_0x4ba6d6(0x20e)](_0x45fdc7),{'verbose':_0x3e7db1[_0x4ba6d6(0x1ff)]}),_0x397a19=_0x27f1d3[_0x4ba6d6(0x20d)];return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1ad)+_0x397a19[_0x4ba6d6(0x1e5)]),console['error'](_0x4ba6d6(0x1de)+_0x397a19['projectId']),0x0;}}
|
|
1
|
+
const a43_0x26092c=a43_0x397f;function a43_0x397f(_0x3d6a47,_0x35c756){_0x3d6a47=_0x3d6a47-0xd2;const _0x6a1dc9=a43_0x6a1d();let _0x397f32=_0x6a1dc9[_0x3d6a47];return _0x397f32;}(function(_0x592f68,_0x3a4dac){const _0x55263d=a43_0x397f,_0x18764d=_0x592f68();while(!![]){try{const _0x1fabb3=parseInt(_0x55263d(0xe4))/0x1*(parseInt(_0x55263d(0x142))/0x2)+-parseInt(_0x55263d(0x169))/0x3+parseInt(_0x55263d(0x141))/0x4*(-parseInt(_0x55263d(0x157))/0x5)+-parseInt(_0x55263d(0x13c))/0x6+parseInt(_0x55263d(0xee))/0x7+parseInt(_0x55263d(0xea))/0x8*(-parseInt(_0x55263d(0x143))/0x9)+-parseInt(_0x55263d(0x133))/0xa*(-parseInt(_0x55263d(0x152))/0xb);if(_0x1fabb3===_0x3a4dac)break;else _0x18764d['push'](_0x18764d['shift']());}catch(_0x438897){_0x18764d['push'](_0x18764d['shift']());}}}(a43_0x6a1d,0x684c7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x140319 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0xe5);['description']='List\x20all\x20workflow\x20projects';async[a43_0x26092c(0xf6)](_0x165c46){const _0x140c6f=a43_0x26092c,{options:_0xbf039,args:_0x105a9b,tdx:_0x569692}=_0x165c46,_0x98245f=_0x105a9b[0x0];try{_0xbf039['verbose']&&_0x98245f&&console[_0x140c6f(0xf1)](_0x140c6f(0x102)+_0x98245f);const _0x20bed2=await withSpinner(_0x140c6f(0x10e),()=>_0x569692[_0x140c6f(0x149)][_0x140c6f(0x13b)](_0x98245f,{'limit':_0xbf039[_0x140c6f(0x111)]}),{'verbose':_0xbf039[_0x140c6f(0x163)]}),_0x365490=_0x20bed2['data'];return console[_0x140c6f(0xf1)](_0x140c6f(0xf7)+_0x365490[_0x140c6f(0x12a)]+_0x140c6f(0x122)+(_0x365490[_0x140c6f(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x365490,_0xbf039),0x0;}catch(_0x2888f5){if(_0x2888f5 instanceof SDKError)return console[_0x140c6f(0xf1)](_0x140c6f(0xf5)+_0x2888f5[_0x140c6f(0x14a)]),_0x2888f5[_0x140c6f(0x14e)]&&console['error'](_0x140c6f(0x114)+_0x2888f5['cause']),0x1;throw _0x2888f5;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x123);[a43_0x26092c(0xe6)]=a43_0x26092c(0x15d);async[a43_0x26092c(0xf6)](_0x591cfd){const _0xb81e02=a43_0x26092c,{options:_0x3b857e,args:_0x5f10e5,tdx:_0x4601eb}=_0x591cfd,_0x5924be=_0x5f10e5[0x0];try{_0x3b857e[_0xb81e02(0x163)]&&_0x5924be&&console[_0xb81e02(0xf1)](_0xb81e02(0x105)+_0x5924be);const _0x2354a7=await withSpinner(_0xb81e02(0x130),()=>_0x4601eb[_0xb81e02(0x149)]['workflows'](_0x5924be,{'limit':_0x3b857e[_0xb81e02(0x111)]}),{'verbose':_0x3b857e[_0xb81e02(0x163)]}),_0x494583=_0x2354a7[_0xb81e02(0xeb)];return console[_0xb81e02(0xf1)]('✔\x20Found\x20'+_0x494583[_0xb81e02(0x12a)]+_0xb81e02(0xd4)+(_0x494583[_0xb81e02(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x494583,_0x3b857e),0x0;}catch(_0x2f8f5e){if(_0x2f8f5e instanceof SDKError)return console[_0xb81e02(0xf1)](_0xb81e02(0xf5)+_0x2f8f5e[_0xb81e02(0x14a)]),_0x2f8f5e[_0xb81e02(0x14e)]&&console['error'](_0xb81e02(0x114)+_0x2f8f5e[_0xb81e02(0x14e)]),0x1;throw _0x2f8f5e;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a43_0x26092c(0xfb);[a43_0x26092c(0xe6)]=a43_0x26092c(0xff);async['execute'](_0x57b825){const _0x447a95=a43_0x26092c,{options:_0x217b5e,args:_0x4d4aa6,tdx:_0x1cfa06}=_0x57b825;let _0x5ef0f0,_0x536817;if(_0x4d4aa6[0x0]){const _0x539f3f=_0x4d4aa6[0x0][_0x447a95(0xfd)]('.');if(_0x539f3f[_0x447a95(0x12a)]===0x1)_0x5ef0f0=_0x539f3f[0x0];else{if(_0x539f3f[_0x447a95(0x12a)]===0x2)[_0x5ef0f0,_0x536817]=_0x539f3f;else return console[_0x447a95(0xf1)](_0x447a95(0x117)),0x1;}}try{if(_0x217b5e['verbose']){if(_0x5ef0f0&&_0x536817)console[_0x447a95(0xf1)]('Filter:\x20'+_0x5ef0f0+'.'+_0x536817);else _0x5ef0f0&&console[_0x447a95(0xf1)](_0x447a95(0xf2)+_0x5ef0f0);const _0x5d4e1b=_0x217b5e[_0x447a95(0xf4)];_0x5d4e1b&&console['error']('Status:\x20'+_0x5d4e1b);}const _0x10b310=await withSpinner(_0x447a95(0xe3),()=>_0x1cfa06['workflow'][_0x447a95(0x135)]({'projectName':_0x5ef0f0,'workflowName':_0x536817,'status':_0x217b5e[_0x447a95(0xf4)],'fromTime':_0x217b5e['from'],'toTime':_0x217b5e['to'],'limit':_0x217b5e[_0x447a95(0x111)]}),{'verbose':_0x217b5e[_0x447a95(0x163)]}),_0x58c3d3=_0x10b310[_0x447a95(0xeb)];return console['error'](_0x447a95(0xf7)+_0x58c3d3[_0x447a95(0x12a)]+_0x447a95(0x14d)+(_0x58c3d3[_0x447a95(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0x58c3d3,_0x217b5e),0x0;}catch(_0x4e0da1){if(_0x4e0da1 instanceof SDKError)return console[_0x447a95(0xf1)](_0x447a95(0xf5)+_0x4e0da1[_0x447a95(0x14a)]),_0x4e0da1[_0x447a95(0x14e)]&&console[_0x447a95(0xf1)](_0x447a95(0x114)+_0x4e0da1[_0x447a95(0x14e)]),0x1;throw _0x4e0da1;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x145);[a43_0x26092c(0xe6)]=a43_0x26092c(0x164);async[a43_0x26092c(0xf6)](_0x67a400){const _0x23d4fc=a43_0x26092c,{options:_0x20847,args:_0x144327,tdx:_0x24a4a6}=_0x67a400;let _0x3f3377,_0x51ff55;if(_0x144327[0x0]){const _0x220d9f=_0x144327[0x0]['split']('.');if(_0x220d9f['length']===0x1)_0x3f3377=_0x220d9f[0x0];else{if(_0x220d9f[_0x23d4fc(0x12a)]===0x2)[_0x3f3377,_0x51ff55]=_0x220d9f;else return console[_0x23d4fc(0xf1)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x3f8703=_0x20847[_0x23d4fc(0xe1)];if(_0x20847[_0x23d4fc(0x163)]){if(_0x3f3377&&_0x51ff55)console[_0x23d4fc(0xf1)]('Filter:\x20'+_0x3f3377+'.'+_0x51ff55);else _0x3f3377&&console['error'](_0x23d4fc(0xf2)+_0x3f3377);_0x3f8703&&console['error']('Include\x20retried:\x20yes');}const _0x49412c=await withSpinner(_0x23d4fc(0x10d),()=>_0x24a4a6[_0x23d4fc(0x149)][_0x23d4fc(0xd2)]({'projectName':_0x3f3377,'workflowName':_0x51ff55,'includeRetried':_0x3f8703,'limit':_0x20847['limit']}),{'verbose':_0x20847[_0x23d4fc(0x163)]}),_0x138a32=_0x49412c[_0x23d4fc(0xeb)];return console[_0x23d4fc(0xf1)](_0x23d4fc(0xf7)+_0x138a32[_0x23d4fc(0x12a)]+_0x23d4fc(0x115)+(_0x138a32['length']!==0x1?'s':'')),await handleSDKOutput(_0x138a32,_0x20847),0x0;}catch(_0x186055){if(_0x186055 instanceof SDKError)return console[_0x23d4fc(0xf1)]('Error:\x20'+_0x186055[_0x23d4fc(0x14a)]),_0x186055[_0x23d4fc(0x14e)]&&console[_0x23d4fc(0xf1)](_0x23d4fc(0x114)+_0x186055[_0x23d4fc(0x14e)]),0x1;throw _0x186055;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x156);[a43_0x26092c(0xe6)]=a43_0x26092c(0x12b);async['execute'](_0x338493){const _0x323d23=a43_0x26092c,{options:_0x2152c3,args:_0x4d071e,tdx:_0x3d6930}=_0x338493,_0x503e36=_0x4d071e[0x0];if(!_0x503e36)return console[_0x323d23(0xf1)](_0x323d23(0xe2)),0x1;try{_0x2152c3[_0x323d23(0x163)]&&console[_0x323d23(0xf1)](_0x323d23(0x150)+_0x503e36);const _0x3fbdbc=await withSpinner('Getting\x20attempt\x20details...',()=>_0x3d6930[_0x323d23(0x149)][_0x323d23(0x15a)](_0x503e36),{'verbose':_0x2152c3[_0x323d23(0x163)]}),_0x5ee70e=_0x3fbdbc[_0x323d23(0xeb)];let _0x3f5f79;!_0x5ee70e[_0x323d23(0x106)]?_0x3f5f79=_0x5ee70e[_0x323d23(0xdc)]?_0x323d23(0xd3):'running':_0x3f5f79=_0x5ee70e['success']?_0x323d23(0x110):_0x323d23(0xf1);let _0x35f4c7;if(_0x5ee70e[_0x323d23(0x159)]&&_0x5ee70e[_0x323d23(0x11f)]){const _0x563024=new Date(_0x5ee70e[_0x323d23(0x159)])[_0x323d23(0xfa)](),_0x3f5afa=new Date(_0x5ee70e[_0x323d23(0x11f)])[_0x323d23(0xfa)]();_0x35f4c7=Math[_0x323d23(0xe0)]((_0x3f5afa-_0x563024)/0x3e8);}const _0x1b436e={'attempt_id':_0x5ee70e['id'],'status':_0x3f5f79,..._0x5ee70e[_0x323d23(0xed)]!==undefined&&{'index':_0x5ee70e[_0x323d23(0xed)]},..._0x5ee70e['project']&&{'project':_0x5ee70e[_0x323d23(0x154)]['name']},..._0x5ee70e[_0x323d23(0x149)]&&{'workflow':_0x5ee70e[_0x323d23(0x149)][_0x323d23(0x131)]},..._0x5ee70e[_0x323d23(0x10b)]&&{'session_id':_0x5ee70e['sessionId']},..._0x5ee70e['sessionTime']&&{'session_time':_0x5ee70e[_0x323d23(0x171)]},..._0x5ee70e['retryAttemptName']&&{'retry_attempt':_0x5ee70e[_0x323d23(0xe8)]},..._0x35f4c7!==undefined&&{'duration_sec':_0x35f4c7},..._0x5ee70e[_0x323d23(0x159)]&&{'created_at':_0x5ee70e[_0x323d23(0x159)]},..._0x5ee70e['finishedAt']&&{'finished_at':_0x5ee70e['finishedAt']},...Object[_0x323d23(0x134)](_0x5ee70e['params'])[_0x323d23(0x12a)]>0x0&&{'params':_0x5ee70e[_0x323d23(0xec)]}};return await handleSingleObjectOutput(_0x1b436e,_0x2152c3),0x0;}catch(_0x3b8505){if(_0x3b8505 instanceof SDKError)return console[_0x323d23(0xf1)]('Error:\x20'+_0x3b8505[_0x323d23(0x14a)]),_0x3b8505['cause']&&console[_0x323d23(0xf1)](_0x323d23(0x114)+_0x3b8505[_0x323d23(0x14e)]),0x1;throw _0x3b8505;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a43_0x26092c(0x148);[a43_0x26092c(0xe6)]=a43_0x26092c(0x15b);async['execute'](_0x2e0ab2){const _0x36736d=a43_0x26092c,{options:_0x1ab2d1,args:_0x3b8c50,tdx:_0x121ace}=_0x2e0ab2,_0x3cf200=_0x3b8c50[0x0];if(!_0x3cf200)return console[_0x36736d(0xf1)](_0x36736d(0xe2)),0x1;try{const _0x4f473b=_0x1ab2d1['includeSubtasks'];_0x1ab2d1[_0x36736d(0x163)]&&(console[_0x36736d(0xf1)]('Attempt\x20ID:\x20'+_0x3cf200),_0x4f473b&&console['error']('Including\x20subtasks:\x20yes'));const _0x7d3a19=await withSpinner(_0x36736d(0x165),()=>_0x121ace['workflow']['tasks'](_0x3cf200,_0x4f473b||![]),{'verbose':_0x1ab2d1[_0x36736d(0x163)]}),_0x23562a=_0x7d3a19[_0x36736d(0xeb)];return console['error']('✔\x20Found\x20'+_0x23562a['length']+_0x36736d(0x11c)+(_0x23562a['length']!==0x1?'s':'')),await handleSDKOutput(_0x23562a,_0x1ab2d1),0x0;}catch(_0x442ded){if(_0x442ded instanceof SDKError)return console[_0x36736d(0xf1)](_0x36736d(0xf5)+_0x442ded[_0x36736d(0x14a)]),_0x442ded['cause']&&console['error'](_0x36736d(0x114)+_0x442ded[_0x36736d(0x14e)]),0x1;throw _0x442ded;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0x26092c(0x118);[a43_0x26092c(0xe6)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x26092c(0xf6)](_0x4a0c85){const _0x2ad9da=a43_0x26092c,{options:_0x310eb8,args:_0x2180a3,tdx:_0x38c6ce}=_0x4a0c85,_0x3aab5a=_0x2180a3[0x0];let _0x80004=_0x2180a3[0x1];if(!_0x3aab5a)return console['error']('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x310eb8[_0x2ad9da(0x163)]&&(console['error'](_0x2ad9da(0x150)+_0x3aab5a),_0x80004&&console['error'](_0x2ad9da(0x112)+_0x80004));const _0x39d914=await withSpinner(_0x2ad9da(0x16d),()=>_0x38c6ce[_0x2ad9da(0x149)]['logFiles'](_0x3aab5a,_0x80004),{'verbose':_0x310eb8['verbose']}),_0x13fc51=_0x39d914[_0x2ad9da(0xeb)];if(_0x13fc51['length']===0x0)return console[_0x2ad9da(0xf1)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x80004&&(_0x310eb8['json']||_0x310eb8[_0x2ad9da(0x16e)]))return await handleSDKOutput(_0x13fc51,_0x310eb8),0x0;if(!_0x80004){const _0x383430=_0x13fc51[_0x2ad9da(0xf8)](_0xb611a9=>({'title':_0xb611a9['taskName']+'\x20('+formatBytes(_0xb611a9[_0x2ad9da(0x119)])+')','value':_0xb611a9[_0x2ad9da(0x12f)]})),_0x22fa1c=await a43_0x140319({'type':_0x2ad9da(0x125),'name':_0x2ad9da(0x138),'message':_0x2ad9da(0x147),'choices':_0x383430});if(!_0x22fa1c[_0x2ad9da(0x138)])return console[_0x2ad9da(0xf1)](_0x2ad9da(0x121)),0x0;_0x80004=_0x22fa1c['task'];}const _0x5eb5e4=await withSpinner('Downloading\x20logs...',()=>_0x38c6ce[_0x2ad9da(0x149)][_0x2ad9da(0x136)](_0x3aab5a,_0x80004),{'verbose':_0x310eb8['verbose']}),_0x2c1fd1=_0x5eb5e4['data'];return _0x2c1fd1?console['log'](_0x2c1fd1):console[_0x2ad9da(0xf1)](_0x2ad9da(0x14f)),0x0;}catch(_0x3c8444){if(_0x3c8444 instanceof SDKError)return console[_0x2ad9da(0xf1)]('Error:\x20'+_0x3c8444['message']),_0x3c8444['cause']&&console[_0x2ad9da(0xf1)](_0x2ad9da(0x114)+_0x3c8444['cause']),0x1;throw _0x3c8444;}}}function a43_0x6a1d(){const _0x2380cb=['message','isDirectory','Expected\x20format:\x20--param\x20key=value','\x20session','cause','No\x20log\x20content\x20found','Attempt\x20ID:\x20','\x20\x20Project:\x20','10006832mOIOBB','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','project','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow:attempt','1061845dtgSft','download','createdAt','attempt','Show\x20tasks\x20for\x20an\x20attempt','Resume\x20from:\x20','List\x20workflows','Session\x20time:\x20','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','readFile','\x20\x20Files\x20extracted:\x20','Output\x20directory:\x20','verbose','List\x20workflow\x20attempts','Getting\x20attempt\x20tasks...','✔\x20Retry\x20started','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','startsWith','1130034obFSgq','✔\x20Workflow\x20run\x20started','workflow:kill','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Fetching\x20log\x20files...','format','Params:\x20','✔\x20Deleted\x20project\x20','sessionTime','Pushing\x20workflow\x20project...','attempts','canceling','\x20workflow','Usage:\x20workflow:delete\x20<project-name-or-id>','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Retrying\x20attempt...','Reason:\x20','isArray','cancelRequested','\x20\x20Project\x20ID:\x20','Project\x20directory:\x20','Error:\x20Workflow\x20identifier\x20is\x20required','round','includeRetried','Error:\x20Attempt\x20ID\x20is\x20required','Listing\x20workflow\x20sessions...','1OqTedT','workflow:projects','description','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','retryAttemptName','session','16kxJPvY','data','params','index','944328UBlkNV','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','kill','error','Filter:\x20project=','Retry\x20a\x20session\x20or\x20attempt','status','Error:\x20','execute','✔\x20Found\x20','map','param','getTime','workflow:sessions','Force:\x20yes','split','\x20\x20Revision:\x20','List\x20workflow\x20execution\x20sessions','\x20\x20Session\x20ID:\x20','...','Pattern:\x20','Validation:\x20skipped','Downloading\x20project\x20','Project\x20filter:\x20','done','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Project\x20name:\x20','revision','workflow:run','sessionId','stat','Listing\x20workflow\x20attempts...','Listing\x20workflow\x20projects...','\x20\x20Location:\x20','success','limit','Task\x20name:\x20','delete','\x20\x20Cause:\x20','\x20attempt','skipValidation','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','workflow:logs','fileSize','projectId','Retrying\x20session...','\x20task','\x20\x20New\x20attempt\x20ID:\x20','yes','finishedAt','\x22?\x20This\x20cannot\x20be\x20undone.','Cancelled','\x20project','workflow:workflows','filesExtracted','select','parse','Deleting\x20project\x20','retryAttempt','workflow:download','length','Show\x20specific\x20attempt\x20details','\x20\x20Workflow:\x20','Revision:\x20','Error:\x20Project\x20name\x20is\x20required','taskName','Listing\x20workflows...','name','Killing\x20attempt...','20qJBvTT','keys','sessions','logs','fromTask','task','Project:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','projects','1517892hoRglX','substring','workflow:delete','✔\x20Pushed\x20','Target:\x20','16LMezph','569626lEcQNu','1497591ITCzvQ','Workflow:\x20','workflow:attempts','projectName','Select\x20a\x20task\x20to\x20view\x20logs:','workflow:tasks','workflow'];a43_0x6a1d=function(){return _0x2380cb;};return a43_0x6a1d();}export class WorkflowKillCommand extends BaseCommand{['name']=a43_0x26092c(0x16b);['description']='Kill\x20a\x20running\x20attempt';async['execute'](_0x4ba037){const _0x3096fe=a43_0x26092c,{options:_0x48e5f0,args:_0x271acb,tdx:_0x13ea0d}=_0x4ba037,_0x5db049=_0x271acb[0x0];if(!_0x5db049)return console[_0x3096fe(0xf1)](_0x3096fe(0xe2)),0x1;try{const _0x4bf268=_0x48e5f0['reason'];_0x48e5f0['verbose']&&(console[_0x3096fe(0xf1)]('Attempt\x20ID:\x20'+_0x5db049),_0x4bf268&&console[_0x3096fe(0xf1)](_0x3096fe(0xda)+_0x4bf268));if(!_0x48e5f0[_0x3096fe(0x11e)]){const _0x3e9fa4=await confirm(_0x3096fe(0xe7)+_0x5db049+'?');if(!_0x3e9fa4)return console[_0x3096fe(0xf1)](_0x3096fe(0x121)),0x0;}const _0x4377eb=await withSpinner(_0x3096fe(0x132),()=>_0x13ea0d['workflow'][_0x3096fe(0xf0)](_0x5db049,_0x4bf268),{'verbose':_0x48e5f0[_0x3096fe(0x163)]}),_0x3a2942=_0x4377eb[_0x3096fe(0xeb)];return console[_0x3096fe(0xf1)]('✔\x20'+_0x3a2942),0x0;}catch(_0x540f09){if(_0x540f09 instanceof SDKError)return console[_0x3096fe(0xf1)](_0x3096fe(0xf5)+_0x540f09['message']),_0x540f09[_0x3096fe(0x14e)]&&console[_0x3096fe(0xf1)](_0x3096fe(0x114)+_0x540f09[_0x3096fe(0x14e)]),0x1;throw _0x540f09;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0x26092c(0x131)]='workflow:retry';[a43_0x26092c(0xe6)]=a43_0x26092c(0xf3);async['execute'](_0x5a8ded){const _0x3cbf41=a43_0x26092c,{options:_0x5ed9c2,args:_0x107442,tdx:_0x2b4a20}=_0x5a8ded,_0x220916=_0x107442[0x0];if(!_0x220916)return console[_0x3cbf41(0xf1)](_0x3cbf41(0x167)),console[_0x3cbf41(0xf1)](_0x3cbf41(0xd6)),0x1;let _0x3b9fc5=![],_0x24e073=_0x220916;if(_0x220916[_0x3cbf41(0x168)]('session:'))_0x3b9fc5=!![],_0x24e073=_0x220916[_0x3cbf41(0x13d)](0x8);else{if(_0x220916[_0x3cbf41(0x168)]('attempt:'))_0x3b9fc5=![],_0x24e073=_0x220916[_0x3cbf41(0x13d)](0x8);else return console[_0x3cbf41(0xf1)](_0x3cbf41(0xd7)),console[_0x3cbf41(0xf1)](_0x3cbf41(0xd6)),0x1;}try{const _0x358078=_0x5ed9c2[_0x3cbf41(0x137)],_0x58f730=_0x5ed9c2['resumeFrom'],_0xdd35bd=_0x5ed9c2[_0x3cbf41(0xec)],_0x1aec14=_0x5ed9c2['force'];_0x5ed9c2['verbose']&&(console['error'](_0x3cbf41(0x140)+(_0x3b9fc5?_0x3cbf41(0xe9):_0x3cbf41(0x15a))+'\x20'+_0x24e073),_0x358078&&console[_0x3cbf41(0xf1)]('From\x20task:\x20'+_0x358078),_0x58f730&&console[_0x3cbf41(0xf1)](_0x3cbf41(0x15c)+_0x58f730),_0xdd35bd&&console[_0x3cbf41(0xf1)](_0x3cbf41(0x16f)+_0xdd35bd),_0x1aec14&&console[_0x3cbf41(0xf1)](_0x3cbf41(0xfc)));let _0xe46e14;if(_0xdd35bd)try{if(_0xdd35bd[_0x3cbf41(0x168)]('@')){const _0x27e5c5=await import('fs/promises'),_0x21c8fa=_0xdd35bd[_0x3cbf41(0x13d)](0x1),_0x518d31=await _0x27e5c5[_0x3cbf41(0x160)](_0x21c8fa,'utf-8');_0xe46e14=JSON[_0x3cbf41(0x126)](_0x518d31);}else _0xe46e14=JSON['parse'](_0xdd35bd);}catch{return console[_0x3cbf41(0xf1)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x5ed9c2[_0x3cbf41(0x11e)]){const _0x121e74=await confirm(_0x3cbf41(0xef)+(_0x3b9fc5?'session':_0x3cbf41(0x15a))+'\x20'+_0x24e073+'?');if(!_0x121e74)return console[_0x3cbf41(0xf1)](_0x3cbf41(0x121)),0x0;}let _0x45d103;_0x3b9fc5?_0x45d103=await withSpinner(_0x3cbf41(0x11b),()=>_0x2b4a20[_0x3cbf41(0x149)]['retrySession'](_0x24e073,{'fromTask':_0x358078,'retryParams':_0xe46e14}),{'verbose':_0x5ed9c2[_0x3cbf41(0x163)]}):_0x45d103=await withSpinner(_0x3cbf41(0xd9),()=>_0x2b4a20[_0x3cbf41(0x149)][_0x3cbf41(0x128)](_0x24e073,{'resumeFrom':_0x58f730,'retryParams':_0xe46e14,'force':_0x1aec14}),{'verbose':_0x5ed9c2[_0x3cbf41(0x163)]});const _0x4226e8=_0x45d103[_0x3cbf41(0xeb)];return console['error'](_0x3cbf41(0x166)),console[_0x3cbf41(0xf1)](_0x3cbf41(0x11d)+_0x4226e8['attemptId']),console[_0x3cbf41(0xf1)](_0x3cbf41(0x100)+_0x4226e8[_0x3cbf41(0x10b)]),0x0;}catch(_0x197568){if(_0x197568 instanceof SDKError)return console[_0x3cbf41(0xf1)](_0x3cbf41(0xf5)+_0x197568[_0x3cbf41(0x14a)]),_0x197568[_0x3cbf41(0x14e)]&&console['error'](_0x3cbf41(0x114)+_0x197568[_0x3cbf41(0x14e)]),0x1;throw _0x197568;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a43_0x26092c(0x10a);[a43_0x26092c(0xe6)]='Start\x20a\x20workflow\x20run';async[a43_0x26092c(0xf6)](_0x612b8c){const _0x233d34=a43_0x26092c,{options:_0x204382,args:_0x5c3a38,tdx:_0x42f6dd}=_0x612b8c,_0x162c1b=_0x5c3a38[0x0];if(!_0x162c1b)return console[_0x233d34(0xf1)](_0x233d34(0xdf)),console[_0x233d34(0xf1)](_0x233d34(0x15f)),0x1;const _0x5838c4=_0x204382[_0x233d34(0xf9)],_0x8c1de2=_0x204382[_0x233d34(0x171)],_0x1a692a={};if(_0x5838c4&&Array[_0x233d34(0xdb)](_0x5838c4))for(const _0x1d285c of _0x5838c4){const _0x18aaf9=_0x1d285c['indexOf']('=');if(_0x18aaf9===-0x1)return console[_0x233d34(0xf1)](_0x233d34(0x13a)+_0x1d285c),console['error'](_0x233d34(0x14c)),0x1;const _0x399616=_0x1d285c[_0x233d34(0x13d)](0x0,_0x18aaf9),_0xaa056b=_0x1d285c[_0x233d34(0x13d)](_0x18aaf9+0x1);try{_0x1a692a[_0x399616]=JSON[_0x233d34(0x126)](_0xaa056b);}catch{_0x1a692a[_0x399616]=_0xaa056b;}}_0x204382['verbose']&&(console[_0x233d34(0xf1)](_0x233d34(0x144)+_0x162c1b),Object[_0x233d34(0x134)](_0x1a692a)[_0x233d34(0x12a)]>0x0&&console[_0x233d34(0xf1)]('Parameters:\x20'+JSON['stringify'](_0x1a692a)),_0x8c1de2&&console[_0x233d34(0xf1)](_0x233d34(0x15e)+_0x8c1de2));const _0x31c020=await withSpinner('Starting\x20workflow\x20run...',()=>_0x42f6dd[_0x233d34(0x149)]['run'](_0x162c1b,_0x1a692a,{'sessionTime':_0x8c1de2}),{'verbose':_0x204382[_0x233d34(0x163)]}),_0xda3f31=_0x31c020[_0x233d34(0xeb)];return console[_0x233d34(0xf1)](_0x233d34(0x16a)),console[_0x233d34(0xf1)]('\x20\x20Attempt\x20ID:\x20'+_0xda3f31['id']),console[_0x233d34(0xf1)](_0x233d34(0x100)+_0xda3f31[_0x233d34(0x10b)]),console['error'](_0x233d34(0x151)+_0xda3f31['project']?.[_0x233d34(0x131)]),console[_0x233d34(0xf1)](_0x233d34(0x12c)+_0xda3f31[_0x233d34(0x149)]?.[_0x233d34(0x131)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x26092c(0x131)]=a43_0x26092c(0x129);[a43_0x26092c(0xe6)]=a43_0x26092c(0x153);async[a43_0x26092c(0xf6)](_0x238baa){const _0x53d218=a43_0x26092c,{options:_0x5c11d5,args:_0x28ed91,tdx:_0x176e97}=_0x238baa,_0x25fa9c=_0x28ed91[0x0],_0x529dc2=_0x28ed91[0x1]||'.';if(!_0x25fa9c)return console['error'](_0x53d218(0x12e)),console[_0x53d218(0xf1)](_0x53d218(0x107)),0x1;const _0x88aa6f=_0x5c11d5[_0x53d218(0x109)];_0x5c11d5[_0x53d218(0x163)]&&(console[_0x53d218(0xf1)](_0x53d218(0x139)+_0x25fa9c),console[_0x53d218(0xf1)](_0x53d218(0x162)+_0x529dc2),_0x88aa6f&&console[_0x53d218(0xf1)](_0x53d218(0x12d)+_0x88aa6f));const _0x1580e4=await withSpinner(_0x53d218(0x104)+_0x25fa9c+_0x53d218(0x101),()=>_0x176e97[_0x53d218(0x149)][_0x53d218(0x158)](_0x25fa9c,_0x529dc2,{'revision':_0x88aa6f}),{'verbose':_0x5c11d5[_0x53d218(0x163)]}),_0x59d734=_0x1580e4[_0x53d218(0xeb)];return console[_0x53d218(0xf1)]('✔\x20Downloaded\x20'+_0x59d734[_0x53d218(0x146)]),console[_0x53d218(0xf1)](_0x53d218(0xfe)+_0x59d734[_0x53d218(0x109)]),console[_0x53d218(0xf1)](_0x53d218(0x161)+_0x59d734[_0x53d218(0x124)]),console['error'](_0x53d218(0x10f)+_0x529dc2+'/'+_0x59d734[_0x53d218(0x146)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x26092c(0x131)]='workflow:push';[a43_0x26092c(0xe6)]=a43_0x26092c(0x16c);async[a43_0x26092c(0xf6)](_0x54dad8){const _0x2628e8=a43_0x26092c,{options:_0x2fa658,args:_0x228e0e,tdx:_0x5ab6fe}=_0x54dad8;let _0x30d8e9='.',_0x44820a=_0x2fa658[_0x2628e8(0x131)];if(_0x228e0e[0x0]){const {promises:_0x2c526f}=await import('fs');try{const _0x469d4b=await _0x2c526f[_0x2628e8(0x10c)](_0x228e0e[0x0]);if(_0x469d4b[_0x2628e8(0x14b)]())_0x30d8e9=_0x228e0e[0x0];else return console[_0x2628e8(0xf1)](_0x2628e8(0xf5)+_0x228e0e[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x44820a=_0x228e0e[0x0],_0x30d8e9='.';}}const _0x341601=_0x2fa658['revision'],_0x2afda6=_0x2fa658[_0x2628e8(0x116)];_0x2fa658[_0x2628e8(0x163)]&&(console['error'](_0x2628e8(0xde)+_0x30d8e9),_0x44820a&&console[_0x2628e8(0xf1)](_0x2628e8(0x108)+_0x44820a),_0x341601&&console[_0x2628e8(0xf1)](_0x2628e8(0x12d)+_0x341601),_0x2afda6&&console[_0x2628e8(0xf1)](_0x2628e8(0x103)));const _0x142270=await withSpinner(_0x2628e8(0x172),()=>_0x5ab6fe[_0x2628e8(0x149)]['push'](_0x30d8e9,{'projectName':_0x44820a,'revision':_0x341601,'skipValidation':_0x2afda6}),{'verbose':_0x2fa658[_0x2628e8(0x163)]}),_0x15b200=_0x142270[_0x2628e8(0xeb)];return console[_0x2628e8(0xf1)](_0x2628e8(0x13f)+_0x15b200['projectName']),console['error'](_0x2628e8(0xdd)+_0x15b200[_0x2628e8(0x11a)]),console[_0x2628e8(0xf1)](_0x2628e8(0xfe)+_0x15b200['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x26092c(0x13e);[a43_0x26092c(0xe6)]=a43_0x26092c(0x155);async[a43_0x26092c(0xf6)](_0x598ec3){const _0x14d99d=a43_0x26092c,{options:_0x11431d,args:_0x4968da,tdx:_0x2dbce2}=_0x598ec3,_0xce6355=_0x4968da[0x0];if(!_0xce6355)return console[_0x14d99d(0xf1)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x14d99d(0xd5)),0x1;_0x11431d[_0x14d99d(0x163)]&&console[_0x14d99d(0xf1)](_0x14d99d(0x139)+_0xce6355);if(!_0x11431d[_0x14d99d(0x11e)]){const _0x4f04bf=await confirm(_0x14d99d(0xd8)+_0xce6355+_0x14d99d(0x120));if(!_0x4f04bf)return console[_0x14d99d(0xf1)](_0x14d99d(0x121)),0x0;}const _0x4ff4c1=await withSpinner(_0x14d99d(0x127)+_0xce6355+_0x14d99d(0x101),()=>_0x2dbce2[_0x14d99d(0x149)][_0x14d99d(0x113)](_0xce6355),{'verbose':_0x11431d[_0x14d99d(0x163)]}),_0xbf1e02=_0x4ff4c1['data'];return console['error'](_0x14d99d(0x170)+_0xbf1e02[_0x14d99d(0x146)]),console[_0x14d99d(0xf1)](_0x14d99d(0xdd)+_0xbf1e02[_0x14d99d(0x11a)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1a3189,_0x1541f8){const _0xfb166b=a44_0x471d,_0x53f0c9=_0x1a3189();while(!![]){try{const _0x25d40e=parseInt(_0xfb166b(0x114))/0x1+parseInt(_0xfb166b(0x128))/0x2*(parseInt(_0xfb166b(0x11e))/0x3)+parseInt(_0xfb166b(0x123))/0x4*(-parseInt(_0xfb166b(0x124))/0x5)+-parseInt(_0xfb166b(0x119))/0x6*(-parseInt(_0xfb166b(0x126))/0x7)+parseInt(_0xfb166b(0x118))/0x8+-parseInt(_0xfb166b(0x11a))/0x9+-parseInt(_0xfb166b(0x129))/0xa;if(_0x25d40e===_0x1541f8)break;else _0x53f0c9['push'](_0x53f0c9['shift']());}catch(_0x59bc6c){_0x53f0c9['push'](_0x53f0c9['shift']());}}}(a44_0x54bf,0x9427c));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a44_0x54bf(){const _0x5e47bb=['313820cSQxFX','utf-8','length','tdx/','8412856cPHwqT','18YaCfuX','3019725HNESvW','0.0.0','X-Trino-User','tdx','1695iojuos','TD1\x20','Authorization','parse','entries','1272geOZPc','7905iiyuRL','version','850976kmeTwa','replace','688GqCbJQ','4793640ukYAnq'];a44_0x54bf=function(){return _0x5e47bb;};return a44_0x54bf();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x8193b6=a44_0x471d;try{const _0x28381a=fileURLToPath(import.meta.url),_0x1fac34=dirname(_0x28381a),_0x3e0d21=join(_0x1fac34,'../../package.json'),_0xe4db34=JSON[_0x8193b6(0x121)](readFileSync(_0x3e0d21,_0x8193b6(0x115)));return _0xe4db34[_0x8193b6(0x125)];}catch{return _0x8193b6(0x11b);}}function a44_0x471d(_0x273218,_0x4df715){_0x273218=_0x273218-0x114;const _0x54bf09=a44_0x54bf();let _0x471d27=_0x54bf09[_0x273218];return _0x471d27;}export function getUserAgent(){const _0x43e286=a44_0x471d,_0x177729=getVersion(),_0x1acbf4=platform(),_0x3eef4b=process['version'][_0x43e286(0x127)]('v','');return _0x43e286(0x117)+_0x177729+'\x20('+_0x1acbf4+';\x20node/'+_0x3eef4b+')';}export function getAuthHeaders(_0xd54a30,_0x52ce9a){const _0x2e0085=a44_0x471d,_0xca107f=getVersion(),_0x10a9e3={'User-Agent':getUserAgent(),'X-TD-Client':_0x2e0085(0x11d),'X-TD-Client-Version':_0xca107f};return _0x52ce9a&&(_0x10a9e3[_0x2e0085(0x120)]=_0x2e0085(0x11f)+_0x52ce9a),_0x10a9e3;}export function toHeaderRecord(_0x2e377c){const _0x4f206f=a44_0x471d,_0x84bbf0={};for(const [_0x570a6a,_0x428501]of Object[_0x4f206f(0x122)](_0x2e377c)){_0x428501!==undefined&&(_0x84bbf0[_0x570a6a]=_0x428501);}return _0x84bbf0;}export function getTrinoHeaders(_0x259a78,_0x30a129){const _0x32f342=a44_0x471d,_0x59b1a2=getAuthHeaders(_0x259a78,_0x30a129),_0x3e1fb0=toHeaderRecord(_0x59b1a2);return delete _0x3e1fb0[_0x32f342(0x120)],_0x30a129&&(_0x3e1fb0[_0x32f342(0x11c)]=_0x30a129),_0x3e1fb0;}export function hasAPIKey(_0x289309){const _0x2121a6=a44_0x471d,_0x2baf70=getAPIKey(_0x289309);return _0x2baf70!==undefined&&_0x2baf70[_0x2121a6(0x116)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x51e490,_0x17c6b5){const _0x20884e=a45_0x1f34,_0xef1e82=_0x51e490();while(!![]){try{const _0x4d1cda=parseInt(_0x20884e(0x1c4))/0x1+parseInt(_0x20884e(0x1e2))/0x2*(parseInt(_0x20884e(0x1d3))/0x3)+parseInt(_0x20884e(0x1bd))/0x4*(parseInt(_0x20884e(0x1ee))/0x5)+-parseInt(_0x20884e(0x1bf))/0x6+parseInt(_0x20884e(0x1e4))/0x7+parseInt(_0x20884e(0x1ef))/0x8+parseInt(_0x20884e(0x1e7))/0x9*(-parseInt(_0x20884e(0x1e3))/0xa);if(_0x4d1cda===_0x17c6b5)break;else _0xef1e82['push'](_0xef1e82['shift']());}catch(_0x5a70ad){_0xef1e82['push'](_0xef1e82['shift']());}}}(a45_0x4fa2,0x7d4d9));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x49d92d from'node:fs';import*as a45_0x11fc62 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x4ee97d from'chalk';export function getConfigDir(){const _0x2f5341=a45_0x1f34;return process[_0x2f5341(0x1ea)][_0x2f5341(0x1df)]||join(homedir(),'.config',_0x2f5341(0x1c7));}export function getConfigFile(){const _0x9d9642=a45_0x1f34;return join(getConfigDir(),_0x9d9642(0x1f0));}export function getConfigFilePath(_0x22b434){const _0x2804d2=a45_0x1f34,_0x54859f=getConfigDir();return _0x22b434?a45_0x11fc62[_0x2804d2(0x1ab)](_0x54859f,'.env.'+_0x22b434):getConfigFile();}export function getCacheDir(){const _0x4b940b=a45_0x1f34;return process[_0x4b940b(0x1ea)][_0x4b940b(0x1da)]||join(homedir(),'.cache',_0x4b940b(0x1c7));}export function getLLMProjectCacheFile(_0x11aff1){const _0x5effa9=a45_0x1f34,_0x4db092=_0x11aff1?_0x5effa9(0x1b2)+_0x11aff1:_0x5effa9(0x1db);return join(getCacheDir(),_0x4db092);}export function readCachedLLMProject(_0x4fa5a6){const _0x5a9e5a=a45_0x1f34;try{const _0x4d7a00=getLLMProjectCacheFile(_0x4fa5a6);if(!existsSync(_0x4d7a00))return null;const _0x2fdc85=readFileSync(_0x4d7a00,_0x5a9e5a(0x1b8))[_0x5a9e5a(0x1cd)]();try{const _0x4e4d51=JSON['parse'](_0x2fdc85);if(_0x4e4d51&&typeof _0x4e4d51['id']===_0x5a9e5a(0x1f2)&&typeof _0x4e4d51[_0x5a9e5a(0x1bc)]===_0x5a9e5a(0x1f2))return _0x4e4d51;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x198589,_0x1e13ee,_0x424cdd){const _0x32fe6d=a45_0x1f34;try{const _0x353783=getCacheDir(),_0x26a34b=getLLMProjectCacheFile(_0x424cdd);!existsSync(_0x353783)&&mkdirSync(_0x353783,{'recursive':!![]});const _0x3658c3={'name':_0x198589,'id':_0x1e13ee};writeFileSync(_0x26a34b,JSON[_0x32fe6d(0x1ba)](_0x3658c3),'utf-8');}catch{}}export function getAccountInfoCacheFile(_0xa46a85){const _0x260086=a45_0x1f34,_0x20015d=_0xa46a85?_0x260086(0x1cb)+_0xa46a85+_0x260086(0x1d7):'account_info.json';return join(getCacheDir(),_0x20015d);}export function readCachedAccountInfo(_0x530d71){const _0xb2df2e=a45_0x1f34;try{const _0x4a461e=getAccountInfoCacheFile(_0x530d71);if(!existsSync(_0x4a461e))return null;const _0x4e9ddf=readFileSync(_0x4a461e,_0xb2df2e(0x1b8))['trim'](),_0x4d84e0=JSON['parse'](_0x4e9ddf);if(_0x4d84e0&&typeof _0x4d84e0[_0xb2df2e(0x1b7)]===_0xb2df2e(0x1f2)&&typeof _0x4d84e0[_0xb2df2e(0x1c0)]===_0xb2df2e(0x1c1))return _0x4d84e0;return null;}catch{return null;}}function a45_0x1f34(_0x534290,_0x3fb1bb){_0x534290=_0x534290-0x1a8;const _0x4fa28d=a45_0x4fa2();let _0x1f34fa=_0x4fa28d[_0x534290];return _0x1f34fa;}export function writeCachedAccountInfo(_0x18bf1d,_0x134224,_0x422fac){const _0xe8a8d3=a45_0x1f34;try{const _0x5e5b67=getCacheDir(),_0x2e9cb2=getAccountInfoCacheFile(_0x422fac);!existsSync(_0x5e5b67)&&mkdirSync(_0x5e5b67,{'recursive':!![]});const _0x1e548f={'site':_0x18bf1d,'accountId':_0x134224,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x2e9cb2,JSON[_0xe8a8d3(0x1ba)](_0x1e548f),'utf-8');}catch{}}export function parseEnvFile(_0xaab290){const _0x1d038a=a45_0x1f34,_0x4b32ca={};for(const _0xb84c9 of _0xaab290[_0x1d038a(0x1cc)]('\x0a')){const _0x1edae1=_0xb84c9[_0x1d038a(0x1cd)]();if(!_0x1edae1||_0x1edae1[_0x1d038a(0x1c9)]('#'))continue;const _0x22ca70=_0x1edae1[_0x1d038a(0x1e6)](/^([^=]+)=(.*)$/);if(_0x22ca70){const _0x4467a4=_0x22ca70[0x1][_0x1d038a(0x1cd)]();let _0x4dda58=_0x22ca70[0x2][_0x1d038a(0x1cd)]();(_0x4dda58[_0x1d038a(0x1c9)]('\x22')&&_0x4dda58[_0x1d038a(0x1b0)]('\x22')||_0x4dda58[_0x1d038a(0x1c9)]('\x27')&&_0x4dda58['endsWith']('\x27'))&&(_0x4dda58=_0x4dda58['slice'](0x1,-0x1)),_0x4b32ca[_0x4467a4]=_0x4dda58;}}return _0x4b32ca;}export function readUserConfig(){const _0x3da065=a45_0x1f34,_0x15e7f6=getConfigFile();if(!existsSync(_0x15e7f6))return{};try{const _0x5d0cb2=readFileSync(_0x15e7f6,_0x3da065(0x1b8));return parseEnvFile(_0x5d0cb2);}catch(_0x25f0e8){return console[_0x3da065(0x1c2)](_0x3da065(0x1d8)+_0x15e7f6+':',_0x25f0e8),{};}}export function resolveSite(_0x307440){const _0x29a2aa=a45_0x1f34,_0x2ce2b3=[_0x29a2aa(0x1e8),_0x29a2aa(0x1d0),_0x29a2aa(0x1ae),_0x29a2aa(0x1e0),_0x29a2aa(0x1de),_0x29a2aa(0x1d9),_0x29a2aa(0x1e9),_0x29a2aa(0x1b4),_0x29a2aa(0x1ac),_0x29a2aa(0x1c6)];if(_0x2ce2b3[_0x29a2aa(0x1d1)](_0x307440))return _0x307440;if(_0x307440 in SITE_ALIASES)return SITE_ALIASES[_0x307440];return console['warn'](_0x29a2aa(0x1a8)+_0x307440+'\x27,\x20defaulting\x20to\x20us01'),_0x29a2aa(0x1e8);}function a45_0x4fa2(){const _0x280955=['apiKeys','readFileSync','parse','.json','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','dev-us01','TDX_CACHE_DIR','llm_default_project','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','legacy\x20.env\x20file','ap03','TDX_CONFIG_DIR','ap02','TD_API_KEY\x20env\x20var\x20(deprecated)','550574qXqetm','230sWifUy','315532xKYtGW','isDeprecated','match','622341TVGWxB','us01','dev-eu01','env','toUpperCase','profile','keychain\x20(profile:\x20','210iAdptE','8208072bCRHuI','.env','source','string','TDX_API_KEY_','apiKey','Warning:\x20Unknown\x20site\x20\x27','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','TDX_API_KEY\x20env\x20var','join','stg-jp01','\x20env\x20var','eu01','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','endsWith','Warning:\x20Failed\x20to\x20read\x20','llm_default_project.','map','stg-us01','.env.','profiles','site','utf-8','TDX_API_KEY','stringify','TD_API_KEY','name','78152jhkSSl','filter','2116962AJUYwy','accountId','number','warn','Warning:\x20Failed\x20to\x20load\x20','289527qBTjtC','replace','stg-ap03','tdx','keychain','startsWith','TD_API_KEY_','account_info.','split','trim','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','existsSync','jp01','includes','yellow','3mDMOoz'];a45_0x4fa2=function(){return _0x280955;};return a45_0x4fa2();}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xe14ec8,_0x4a5f15){const _0x2fec50=a45_0x1f34,_0x41370b=_0x4a5f15||getActiveProfileName();if(_0x41370b){const _0x5381a3=_0x2fec50(0x1f3)+normalizeProfileForEnvVar(_0x41370b);if(process[_0x2fec50(0x1ea)][_0x5381a3])return process[_0x2fec50(0x1ea)][_0x5381a3];}if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1b9)])return process['env'][_0x2fec50(0x1b9)];if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1bb)])return process['env'][_0x2fec50(0x1bb)];const _0x5be3d9=_0xe14ec8['toUpperCase']()[_0x2fec50(0x1c5)](/-/g,'_'),_0x172028=_0x2fec50(0x1ca)+_0x5be3d9;if(_0x41370b){const _0x1c2b79=loadProfileEnv(_0x41370b);if(_0x1c2b79){if(_0x1c2b79[_0x172028])return _0x1c2b79[_0x172028];if(_0x1c2b79[_0x2fec50(0x1bb)])return _0x1c2b79[_0x2fec50(0x1bb)];}}const _0x56eb5c=loadUserConfigOnce();if(_0x56eb5c[_0x172028])return _0x56eb5c[_0x172028];if(_0x56eb5c[_0x2fec50(0x1bb)])return _0x56eb5c['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x10e7ba){const _0x22f2a6=a45_0x1f34;return _0x10e7ba[_0x22f2a6(0x1eb)]()[_0x22f2a6(0x1c5)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x294827,_0x3c6609){const _0x2fc4a5=a45_0x1f34,_0xfbe8f6=_0x3c6609||getActiveProfileName()||undefined;if(_0xfbe8f6){const _0x1e0940=_0x2fc4a5(0x1f3)+normalizeProfileForEnvVar(_0xfbe8f6);if(process[_0x2fc4a5(0x1ea)][_0x1e0940])return{'apiKey':process['env'][_0x1e0940],'source':_0x1e0940+_0x2fc4a5(0x1ad),'isDeprecated':![]};const _0xb20394=getCachedCredential(_0x294827,_0xfbe8f6);if(_0xb20394)return{'apiKey':_0xb20394,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};const _0x15fb85=await getKeychainAPIKey(_0xfbe8f6);if(_0x15fb85)return setCachedCredential(_0x15fb85,_0x294827,_0xfbe8f6),{'apiKey':_0x15fb85,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};}if(process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1b9)])return{'apiKey':process['env'][_0x2fc4a5(0x1b9)],'source':_0x2fc4a5(0x1aa),'isDeprecated':![]};if(!_0xfbe8f6){const _0x2fdea7=getCachedCredential(_0x294827,undefined);if(_0x2fdea7)return{'apiKey':_0x2fdea7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};const _0x4499c7=await getKeychainAPIKey(undefined);if(_0x4499c7)return setCachedCredential(_0x4499c7,_0x294827,undefined),{'apiKey':_0x4499c7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};}if(process['env'][_0x2fc4a5(0x1bb)])return{'apiKey':process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1bb)],'source':_0x2fc4a5(0x1e1),'isDeprecated':!![]};const _0x2d26c3=getLegacyEnvAPIKey(_0x294827,_0xfbe8f6);if(_0x2d26c3){const _0x387d23=await isKeychainAvailable();if(_0x387d23)try{await saveKeychainAPIKey(_0x2d26c3,_0xfbe8f6),setCachedCredential(_0x2d26c3,_0x294827,_0xfbe8f6);const _0x2da237=getConfigFilePath(_0xfbe8f6);cleanupLegacyEnvFile(_0x2da237)&&console[_0x2fc4a5(0x1c2)](a45_0x4ee97d[_0x2fc4a5(0x1d2)](_0x2fc4a5(0x1a9)));}catch(_0x6daa89){console[_0x2fc4a5(0x1c2)](a45_0x4ee97d['yellow'](_0x2fc4a5(0x1ce)+_0x6daa89));}const _0x34ad63=_0xfbe8f6?'legacy\x20.env\x20file\x20(profile:\x20'+_0xfbe8f6+')':_0x2fc4a5(0x1dd);return{'apiKey':_0x2d26c3,'source':_0x34ad63,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x4021aa,_0x82409a,_0x227a4f=!![]){const _0x446122=a45_0x1f34,_0x19ae52=await resolveAPIKeyAsync(_0x4021aa,_0x82409a);if(!_0x19ae52)return undefined;if(_0x227a4f&&_0x19ae52[_0x446122(0x1e5)]&&_0x19ae52[_0x446122(0x1f1)][_0x446122(0x1d1)]('TD_API_KEY')){const _0x41fe8f=_0x82409a||getActiveProfileName()||undefined,_0x2eff4f=_0x41fe8f?_0x446122(0x1f3)+normalizeProfileForEnvVar(_0x41fe8f):'TDX_API_KEY_<PROFILE>';console[_0x446122(0x1c2)](a45_0x4ee97d[_0x446122(0x1d2)](_0x446122(0x1af)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x2eff4f+').')));}return _0x19ae52[_0x446122(0x1f4)];}function getLegacyEnvAPIKey(_0x274489,_0x1b1dd8){const _0x58f1c8=a45_0x1f34,_0xeb406d=_0x274489[_0x58f1c8(0x1eb)]()[_0x58f1c8(0x1c5)](/-/g,'_'),_0x4448ae=_0x58f1c8(0x1ca)+_0xeb406d;if(_0x1b1dd8){const _0x27991d=loadProfileEnv(_0x1b1dd8);if(_0x27991d){if(_0x27991d[_0x4448ae])return _0x27991d[_0x4448ae];if(_0x27991d['TD_API_KEY'])return _0x27991d[_0x58f1c8(0x1bb)];}}const _0x14d913=loadUserConfigOnce();if(_0x14d913[_0x4448ae])return _0x14d913[_0x4448ae];if(_0x14d913[_0x58f1c8(0x1bb)])return _0x14d913['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x54e39a){const _0x23b302=a45_0x1f34;if(!existsSync(_0x54e39a))return![];try{const _0x24a336=readFileSync(_0x54e39a,_0x23b302(0x1b8)),_0xfebbb9=_0x24a336[_0x23b302(0x1cc)]('\x0a'),_0x23d575=_0xfebbb9[_0x23b302(0x1be)](_0x3d142f=>{const _0x1cb9d3=_0x23b302,_0xa5dd97=_0x3d142f[_0x1cb9d3(0x1cd)]();if(!_0xa5dd97||_0xa5dd97['startsWith']('#'))return!![];const [_0x190437]=_0xa5dd97[_0x1cb9d3(0x1cc)]('=');return!_0x190437['startsWith'](_0x1cb9d3(0x1bb));}),_0x18d612=_0x23d575['some'](_0x5253d5=>{const _0x505d29=_0x23b302,_0x526770=_0x5253d5[_0x505d29(0x1cd)]();return _0x526770&&!_0x526770[_0x505d29(0x1c9)]('#');});if(!_0x18d612)return unlinkSync(_0x54e39a),!![];return writeFileSync(_0x54e39a,_0x23d575['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x481988){const _0x46cc63=a45_0x1f34,_0x39bdc1=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b5)+_0x481988);if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x39bdc1)){validateSecureFilePermissions(_0x39bdc1);try{const _0x5e962a=a45_0x49d92d[_0x46cc63(0x1d5)](_0x39bdc1,_0x46cc63(0x1b8));return parseEnvFile(_0x5e962a);}catch(_0x201f38){console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x39bdc1+':\x20'+_0x201f38);}}const _0x4b09f0=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b6),_0x481988,_0x46cc63(0x1f0));if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x4b09f0)){validateSecureFilePermissions(_0x4b09f0);try{const _0x57e847=a45_0x49d92d['readFileSync'](_0x4b09f0,_0x46cc63(0x1b8));return parseEnvFile(_0x57e847);}catch(_0x8ced35){return console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x4b09f0+':\x20'+_0x8ced35),null;}}return null;}function getActiveProfileName(){const _0x8d57d1=a45_0x1f34,_0x142a79=a45_0x11fc62[_0x8d57d1(0x1ab)](getConfigDir(),'tdx.json');if(!a45_0x49d92d[_0x8d57d1(0x1cf)](_0x142a79))return null;try{const _0x2af00d=a45_0x49d92d['readFileSync'](_0x142a79,_0x8d57d1(0x1b8)),_0x524289=JSON[_0x8d57d1(0x1d6)](_0x2af00d);return _0x524289[_0x8d57d1(0x1ec)]||null;}catch{return null;}}export function saveAPIKey(_0x5ed1cd,_0x871a99,_0x22a0df){const _0x12a2a1=a45_0x1f34,_0x440bd0=getConfigDir(),_0x156768=getConfigFilePath(_0x22a0df);!existsSync(_0x440bd0)&&mkdirSync(_0x440bd0,{'recursive':!![],'mode':0x1c0});let _0xea6f04={};if(existsSync(_0x156768))try{const _0x215d74=readFileSync(_0x156768,_0x12a2a1(0x1b8));_0xea6f04=parseEnvFile(_0x215d74);}catch(_0x58e2a5){console[_0x12a2a1(0x1c2)](_0x12a2a1(0x1b1)+_0x156768+':',_0x58e2a5);}const _0x457885=_0x5ed1cd[_0x12a2a1(0x1eb)]()[_0x12a2a1(0x1c5)](/-/g,'_');_0xea6f04[_0x12a2a1(0x1ca)+_0x457885]=_0x871a99;const _0x80477e=Object['entries'](_0xea6f04)[_0x12a2a1(0x1b3)](([_0x2a619a,_0x5ec6fe])=>_0x2a619a+'='+_0x5ec6fe);writeFileSync(_0x156768,_0x80477e['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x103c92,_0x50e65c,_0x5ec87d){const _0x3740a0=a45_0x1f34;await saveKeychainAPIKey(_0x103c92,_0x5ec87d),setCachedCredential(_0x103c92,_0x50e65c,_0x5ec87d);const _0x4fdc1e=getConfigFilePath(_0x5ec87d);cleanupLegacyEnvFile(_0x4fdc1e)&&console[_0x3740a0(0x1c2)](a45_0x4ee97d['yellow'](_0x3740a0(0x1dc)));}export function loadConfig(){const _0x4cdbdc=a45_0x1f34,_0x48e3dc={'apiKeys':{},'defaultSite':_0x4cdbdc(0x1e8)},_0x33fb42=[_0x4cdbdc(0x1e8),_0x4cdbdc(0x1d0),_0x4cdbdc(0x1ae),_0x4cdbdc(0x1e0),_0x4cdbdc(0x1de),_0x4cdbdc(0x1d9),_0x4cdbdc(0x1e9),_0x4cdbdc(0x1b4),'stg-jp01',_0x4cdbdc(0x1c6)];for(const _0x171040 of _0x33fb42){const _0x5a7757=getAPIKey(_0x171040);_0x5a7757&&(_0x48e3dc[_0x4cdbdc(0x1d4)][_0x171040]=_0x5a7757);}return _0x48e3dc;}
|
|
1
|
+
(function(_0x52fbef,_0xae2636){const _0x79e5ff=a45_0x8daa,_0x46b9dd=_0x52fbef();while(!![]){try{const _0x3404ac=-parseInt(_0x79e5ff(0x128))/0x1+-parseInt(_0x79e5ff(0x14d))/0x2+parseInt(_0x79e5ff(0x109))/0x3*(-parseInt(_0x79e5ff(0x123))/0x4)+-parseInt(_0x79e5ff(0x153))/0x5*(-parseInt(_0x79e5ff(0x13e))/0x6)+parseInt(_0x79e5ff(0x12a))/0x7*(parseInt(_0x79e5ff(0x152))/0x8)+parseInt(_0x79e5ff(0x144))/0x9*(-parseInt(_0x79e5ff(0x129))/0xa)+parseInt(_0x79e5ff(0x116))/0xb*(parseInt(_0x79e5ff(0x111))/0xc);if(_0x3404ac===_0xae2636)break;else _0x46b9dd['push'](_0x46b9dd['shift']());}catch(_0x4f67b3){_0x46b9dd['push'](_0x46b9dd['shift']());}}}(a45_0x3d5f,0xd1cbb));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x45aaad from'node:fs';import*as a45_0x364fa5 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x19930c from'chalk';export function getConfigDir(){const _0x1ee5eb=a45_0x8daa;return process[_0x1ee5eb(0x107)][_0x1ee5eb(0x10c)]||join(homedir(),_0x1ee5eb(0x14b),_0x1ee5eb(0x131));}export function getConfigFile(){const _0x124bba=a45_0x8daa;return join(getConfigDir(),_0x124bba(0x125));}export function getConfigFilePath(_0x787bb4){const _0x594c51=a45_0x8daa,_0x44aa61=getConfigDir();return _0x787bb4?a45_0x364fa5[_0x594c51(0x11c)](_0x44aa61,'.env.'+_0x787bb4):getConfigFile();}function a45_0x3d5f(){const _0x1b3199=['llm_default_project.','number','.config','profiles','1881000Zqxtom','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_API_KEY_','keychain\x20(profile:\x20','keychain','2184uLSiHX','5BQawQN','account_info.','\x20env\x20var','env','TD_API_KEY_','102iYNIar','split','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TDX_CONFIG_DIR','TDX_API_KEY\x20env\x20var','dev-eu01','accountId','ap02','3348564wtmdWg','trim','yellow','TDX_API_KEY','apiKey','99wYMNPy','isDeprecated','existsSync','startsWith','.json','ap03','join','toUpperCase','map','replace','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','legacy\x20.env\x20file\x20(profile:\x20','.env.','111868ccFauT','llm_default_project','.env','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','source','173076jaeznL','4632120jUvQEk','4501PXdyQS','site','.cache','us01','warn','TD_API_KEY\x20env\x20var\x20(deprecated)','Warning:\x20Failed\x20to\x20read\x20','tdx','stringify','parse','TDX_CACHE_DIR','name','stg-us01','utf-8','Warning:\x20Unknown\x20site\x20\x27','jp01','includes','toISOString','string','TD_API_KEY','6979434uWondX','stg-jp01','stg-ap03','entries','endsWith','profile','18lYiOuG','readFileSync','filter','eu01','dev-us01'];a45_0x3d5f=function(){return _0x1b3199;};return a45_0x3d5f();}export function getCacheDir(){const _0x1d64a7=a45_0x8daa;return process[_0x1d64a7(0x107)][_0x1d64a7(0x134)]||join(homedir(),_0x1d64a7(0x12c),_0x1d64a7(0x131));}export function getLLMProjectCacheFile(_0x39d0a2){const _0xcb1c61=a45_0x8daa,_0x1eb846=_0x39d0a2?_0xcb1c61(0x149)+_0x39d0a2:_0xcb1c61(0x124);return join(getCacheDir(),_0x1eb846);}export function readCachedLLMProject(_0x54b886){const _0x542531=a45_0x8daa;try{const _0x1228d4=getLLMProjectCacheFile(_0x54b886);if(!existsSync(_0x1228d4))return null;const _0x2dcf6e=readFileSync(_0x1228d4,_0x542531(0x137))['trim']();try{const _0xdcce64=JSON[_0x542531(0x133)](_0x2dcf6e);if(_0xdcce64&&typeof _0xdcce64['id']===_0x542531(0x13c)&&typeof _0xdcce64[_0x542531(0x135)]===_0x542531(0x13c))return _0xdcce64;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x190967,_0x133ca8,_0x1cf823){const _0x49e5db=a45_0x8daa;try{const _0x4381de=getCacheDir(),_0x3e2383=getLLMProjectCacheFile(_0x1cf823);!existsSync(_0x4381de)&&mkdirSync(_0x4381de,{'recursive':!![]});const _0x57594e={'name':_0x190967,'id':_0x133ca8};writeFileSync(_0x3e2383,JSON['stringify'](_0x57594e),_0x49e5db(0x137));}catch{}}export function getAccountInfoCacheFile(_0xa1c736){const _0x57cd5f=a45_0x8daa,_0x380214=_0xa1c736?_0x57cd5f(0x154)+_0xa1c736+_0x57cd5f(0x11a):'account_info.json';return join(getCacheDir(),_0x380214);}export function readCachedAccountInfo(_0x4f7b14){const _0x4cdcd7=a45_0x8daa;try{const _0x1da536=getAccountInfoCacheFile(_0x4f7b14);if(!existsSync(_0x1da536))return null;const _0x3e6f9e=readFileSync(_0x1da536,_0x4cdcd7(0x137))[_0x4cdcd7(0x112)](),_0x14c562=JSON[_0x4cdcd7(0x133)](_0x3e6f9e);if(_0x14c562&&typeof _0x14c562[_0x4cdcd7(0x12b)]===_0x4cdcd7(0x13c)&&typeof _0x14c562[_0x4cdcd7(0x10f)]===_0x4cdcd7(0x14a))return _0x14c562;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x4dd6ee,_0x5b8e67,_0x316e8d){const _0x355cb3=a45_0x8daa;try{const _0x4655f0=getCacheDir(),_0x5739a2=getAccountInfoCacheFile(_0x316e8d);!existsSync(_0x4655f0)&&mkdirSync(_0x4655f0,{'recursive':!![]});const _0xd5b045={'site':_0x4dd6ee,'accountId':_0x5b8e67,'cachedAt':new Date()[_0x355cb3(0x13b)]()};writeFileSync(_0x5739a2,JSON[_0x355cb3(0x132)](_0xd5b045),'utf-8');}catch{}}export function parseEnvFile(_0xb50d75){const _0x24791f=a45_0x8daa,_0x5974fc={};for(const _0xadd129 of _0xb50d75['split']('\x0a')){const _0x3783f4=_0xadd129[_0x24791f(0x112)]();if(!_0x3783f4||_0x3783f4['startsWith']('#'))continue;const _0x5698b2=_0x3783f4['match'](/^([^=]+)=(.*)$/);if(_0x5698b2){const _0x319e88=_0x5698b2[0x1][_0x24791f(0x112)]();let _0x9f0dd1=_0x5698b2[0x2][_0x24791f(0x112)]();(_0x9f0dd1[_0x24791f(0x119)]('\x22')&&_0x9f0dd1[_0x24791f(0x142)]('\x22')||_0x9f0dd1[_0x24791f(0x119)]('\x27')&&_0x9f0dd1[_0x24791f(0x142)]('\x27'))&&(_0x9f0dd1=_0x9f0dd1['slice'](0x1,-0x1)),_0x5974fc[_0x319e88]=_0x9f0dd1;}}return _0x5974fc;}export function readUserConfig(){const _0x2ce988=a45_0x8daa,_0x2026c5=getConfigFile();if(!existsSync(_0x2026c5))return{};try{const _0x4eca22=readFileSync(_0x2026c5,'utf-8');return parseEnvFile(_0x4eca22);}catch(_0x3d6e16){return console[_0x2ce988(0x12e)](_0x2ce988(0x10b)+_0x2026c5+':',_0x3d6e16),{};}}export function resolveSite(_0x3329a0){const _0xb73ff4=a45_0x8daa,_0x51aaca=[_0xb73ff4(0x12d),_0xb73ff4(0x139),_0xb73ff4(0x147),'ap02','ap03',_0xb73ff4(0x148),_0xb73ff4(0x10e),_0xb73ff4(0x136),_0xb73ff4(0x13f),_0xb73ff4(0x140)];if(_0x51aaca[_0xb73ff4(0x13a)](_0x3329a0))return _0x3329a0;if(_0x3329a0 in SITE_ALIASES)return SITE_ALIASES[_0x3329a0];return console[_0xb73ff4(0x12e)](_0xb73ff4(0x138)+_0x3329a0+'\x27,\x20defaulting\x20to\x20us01'),_0xb73ff4(0x12d);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4244a9,_0x4d7ff4){const _0x2461a8=a45_0x8daa,_0x5a1f8e=_0x4d7ff4||getActiveProfileName();if(_0x5a1f8e){const _0x54e29d=_0x2461a8(0x14f)+normalizeProfileForEnvVar(_0x5a1f8e);if(process[_0x2461a8(0x107)][_0x54e29d])return process[_0x2461a8(0x107)][_0x54e29d];}if(process[_0x2461a8(0x107)][_0x2461a8(0x114)])return process[_0x2461a8(0x107)][_0x2461a8(0x114)];if(process[_0x2461a8(0x107)]['TD_API_KEY'])return process[_0x2461a8(0x107)][_0x2461a8(0x13d)];const _0x239085=_0x4244a9[_0x2461a8(0x11d)]()[_0x2461a8(0x11f)](/-/g,'_'),_0x2272ac=_0x2461a8(0x108)+_0x239085;if(_0x5a1f8e){const _0x211640=loadProfileEnv(_0x5a1f8e);if(_0x211640){if(_0x211640[_0x2272ac])return _0x211640[_0x2272ac];if(_0x211640[_0x2461a8(0x13d)])return _0x211640['TD_API_KEY'];}}const _0x47c92b=loadUserConfigOnce();if(_0x47c92b[_0x2272ac])return _0x47c92b[_0x2272ac];if(_0x47c92b['TD_API_KEY'])return _0x47c92b['TD_API_KEY'];return undefined;}function a45_0x8daa(_0x5d4706,_0x36f4e1){_0x5d4706=_0x5d4706-0x106;const _0x3d5f56=a45_0x3d5f();let _0x8daa6d=_0x3d5f56[_0x5d4706];return _0x8daa6d;}export function normalizeProfileForEnvVar(_0x1b6d5f){const _0x65d210=a45_0x8daa;return _0x1b6d5f[_0x65d210(0x11d)]()[_0x65d210(0x11f)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x316228,_0x9cb428){const _0x28cb8a=a45_0x8daa,_0x123a02=_0x9cb428||getActiveProfileName()||undefined;if(_0x123a02){const _0xedd9de=_0x28cb8a(0x14f)+normalizeProfileForEnvVar(_0x123a02);if(process['env'][_0xedd9de])return{'apiKey':process[_0x28cb8a(0x107)][_0xedd9de],'source':_0xedd9de+_0x28cb8a(0x106),'isDeprecated':![]};const _0x2a1849=getCachedCredential(_0x316228,_0x123a02);if(_0x2a1849)return{'apiKey':_0x2a1849,'source':_0x28cb8a(0x150)+_0x123a02+')','isDeprecated':![]};const _0x19fef7=await getKeychainAPIKey(_0x123a02);if(_0x19fef7)return setCachedCredential(_0x19fef7,_0x316228,_0x123a02),{'apiKey':_0x19fef7,'source':_0x28cb8a(0x150)+_0x123a02+')','isDeprecated':![]};}if(process[_0x28cb8a(0x107)][_0x28cb8a(0x114)])return{'apiKey':process[_0x28cb8a(0x107)]['TDX_API_KEY'],'source':_0x28cb8a(0x10d),'isDeprecated':![]};if(!_0x123a02){const _0x2b96e0=getCachedCredential(_0x316228,undefined);if(_0x2b96e0)return{'apiKey':_0x2b96e0,'source':_0x28cb8a(0x151),'isDeprecated':![]};const _0x4d3b13=await getKeychainAPIKey(undefined);if(_0x4d3b13)return setCachedCredential(_0x4d3b13,_0x316228,undefined),{'apiKey':_0x4d3b13,'source':'keychain','isDeprecated':![]};}if(process['env']['TD_API_KEY'])return{'apiKey':process[_0x28cb8a(0x107)][_0x28cb8a(0x13d)],'source':_0x28cb8a(0x12f),'isDeprecated':!![]};const _0x2f6295=getLegacyEnvAPIKey(_0x316228,_0x123a02);if(_0x2f6295){const _0x5d5d3b=await isKeychainAvailable();if(_0x5d5d3b)try{await saveKeychainAPIKey(_0x2f6295,_0x123a02),setCachedCredential(_0x2f6295,_0x316228,_0x123a02);const _0x43ad75=getConfigFilePath(_0x123a02);cleanupLegacyEnvFile(_0x43ad75)&&console[_0x28cb8a(0x12e)](a45_0x19930c['yellow'](_0x28cb8a(0x120)));}catch(_0x49cd65){console[_0x28cb8a(0x12e)](a45_0x19930c[_0x28cb8a(0x113)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x49cd65));}const _0x59ee0c=_0x123a02?_0x28cb8a(0x121)+_0x123a02+')':'legacy\x20.env\x20file';return{'apiKey':_0x2f6295,'source':_0x59ee0c,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x3d864d,_0x453461,_0x33e1a5=!![]){const _0x345bf1=a45_0x8daa,_0x595b43=await resolveAPIKeyAsync(_0x3d864d,_0x453461);if(!_0x595b43)return undefined;if(_0x33e1a5&&_0x595b43[_0x345bf1(0x117)]&&_0x595b43[_0x345bf1(0x127)][_0x345bf1(0x13a)](_0x345bf1(0x13d))){const _0x58c9ff=_0x453461||getActiveProfileName()||undefined,_0x3d9b56=_0x58c9ff?_0x345bf1(0x14f)+normalizeProfileForEnvVar(_0x58c9ff):'TDX_API_KEY_<PROFILE>';console['warn'](a45_0x19930c[_0x345bf1(0x113)](_0x345bf1(0x126)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x3d9b56+').')));}return _0x595b43[_0x345bf1(0x115)];}function getLegacyEnvAPIKey(_0x18e05b,_0x269aae){const _0xdf68fb=a45_0x8daa,_0x47a66c=_0x18e05b[_0xdf68fb(0x11d)]()[_0xdf68fb(0x11f)](/-/g,'_'),_0x2f8cd3=_0xdf68fb(0x108)+_0x47a66c;if(_0x269aae){const _0xb67a9d=loadProfileEnv(_0x269aae);if(_0xb67a9d){if(_0xb67a9d[_0x2f8cd3])return _0xb67a9d[_0x2f8cd3];if(_0xb67a9d[_0xdf68fb(0x13d)])return _0xb67a9d[_0xdf68fb(0x13d)];}}const _0x5a40f7=loadUserConfigOnce();if(_0x5a40f7[_0x2f8cd3])return _0x5a40f7[_0x2f8cd3];if(_0x5a40f7['TD_API_KEY'])return _0x5a40f7[_0xdf68fb(0x13d)];return undefined;}function cleanupLegacyEnvFile(_0x3aaa40){const _0x276699=a45_0x8daa;if(!existsSync(_0x3aaa40))return![];try{const _0x211bc4=readFileSync(_0x3aaa40,'utf-8'),_0x3a332f=_0x211bc4[_0x276699(0x10a)]('\x0a'),_0x3fd6a8=_0x3a332f[_0x276699(0x146)](_0x48b36d=>{const _0x330fd9=_0x276699,_0x6d802c=_0x48b36d[_0x330fd9(0x112)]();if(!_0x6d802c||_0x6d802c['startsWith']('#'))return!![];const [_0x11a476]=_0x6d802c[_0x330fd9(0x10a)]('=');return!_0x11a476[_0x330fd9(0x119)](_0x330fd9(0x13d));}),_0x26d99d=_0x3fd6a8['some'](_0x1f005c=>{const _0x1c9253=_0x276699,_0x5528c2=_0x1f005c[_0x1c9253(0x112)]();return _0x5528c2&&!_0x5528c2[_0x1c9253(0x119)]('#');});if(!_0x26d99d)return unlinkSync(_0x3aaa40),!![];return writeFileSync(_0x3aaa40,_0x3fd6a8[_0x276699(0x11c)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5ee39b){const _0x3a1a9d=a45_0x8daa,_0x5d6a4a=a45_0x364fa5[_0x3a1a9d(0x11c)](getConfigDir(),_0x3a1a9d(0x122)+_0x5ee39b);if(a45_0x45aaad['existsSync'](_0x5d6a4a)){validateSecureFilePermissions(_0x5d6a4a);try{const _0x3ef1fe=a45_0x45aaad['readFileSync'](_0x5d6a4a,_0x3a1a9d(0x137));return parseEnvFile(_0x3ef1fe);}catch(_0x3438a6){console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x5d6a4a+':\x20'+_0x3438a6);}}const _0x1c3a6f=a45_0x364fa5['join'](getConfigDir(),_0x3a1a9d(0x14c),_0x5ee39b,'.env');if(a45_0x45aaad[_0x3a1a9d(0x118)](_0x1c3a6f)){validateSecureFilePermissions(_0x1c3a6f);try{const _0x45318f=a45_0x45aaad['readFileSync'](_0x1c3a6f,'utf-8');return parseEnvFile(_0x45318f);}catch(_0x22c35b){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x1c3a6f+':\x20'+_0x22c35b),null;}}return null;}function getActiveProfileName(){const _0x46967c=a45_0x8daa,_0x4bc1e5=a45_0x364fa5[_0x46967c(0x11c)](getConfigDir(),'tdx.json');if(!a45_0x45aaad['existsSync'](_0x4bc1e5))return null;try{const _0x3e03ba=a45_0x45aaad[_0x46967c(0x145)](_0x4bc1e5,_0x46967c(0x137)),_0x521cae=JSON[_0x46967c(0x133)](_0x3e03ba);return _0x521cae[_0x46967c(0x143)]||null;}catch{return null;}}export function saveAPIKey(_0x5724fa,_0x1a9385,_0xf0478c){const _0x23e7e9=a45_0x8daa,_0x3adf85=getConfigDir(),_0x52f85c=getConfigFilePath(_0xf0478c);!existsSync(_0x3adf85)&&mkdirSync(_0x3adf85,{'recursive':!![],'mode':0x1c0});let _0x800ff1={};if(existsSync(_0x52f85c))try{const _0x1a36a9=readFileSync(_0x52f85c,'utf-8');_0x800ff1=parseEnvFile(_0x1a36a9);}catch(_0x17ffc9){console['warn'](_0x23e7e9(0x130)+_0x52f85c+':',_0x17ffc9);}const _0x4b5220=_0x5724fa[_0x23e7e9(0x11d)]()['replace'](/-/g,'_');_0x800ff1['TD_API_KEY_'+_0x4b5220]=_0x1a9385;const _0x432c4a=Object[_0x23e7e9(0x141)](_0x800ff1)[_0x23e7e9(0x11e)](([_0xc9c8c5,_0x3b6437])=>_0xc9c8c5+'='+_0x3b6437);writeFileSync(_0x52f85c,_0x432c4a['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x44c80c,_0x2a1c55,_0x27dc29){const _0x4193fa=a45_0x8daa;await saveKeychainAPIKey(_0x44c80c,_0x27dc29),setCachedCredential(_0x44c80c,_0x2a1c55,_0x27dc29);const _0xd9ca67=getConfigFilePath(_0x27dc29);cleanupLegacyEnvFile(_0xd9ca67)&&console[_0x4193fa(0x12e)](a45_0x19930c[_0x4193fa(0x113)](_0x4193fa(0x14e)));}export function loadConfig(){const _0x5f3006=a45_0x8daa,_0x23d776={'apiKeys':{},'defaultSite':_0x5f3006(0x12d)},_0x45cb65=[_0x5f3006(0x12d),_0x5f3006(0x139),_0x5f3006(0x147),_0x5f3006(0x110),_0x5f3006(0x11b),_0x5f3006(0x148),_0x5f3006(0x10e),_0x5f3006(0x136),_0x5f3006(0x13f),_0x5f3006(0x140)];for(const _0x5d2f8d of _0x45cb65){const _0x3cf8ba=getAPIKey(_0x5d2f8d);_0x3cf8ba&&(_0x23d776['apiKeys'][_0x5d2f8d]=_0x3cf8ba);}return _0x23d776;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x14f29c,_0x4a8109){const _0x1fd962=a46_0x14c8,_0xc8c52e=_0x14f29c();while(!![]){try{const _0x2de308=-parseInt(_0x1fd962(0xea))/0x1*(parseInt(_0x1fd962(0xec))/0x2)+-parseInt(_0x1fd962(0xe6))/0x3*(parseInt(_0x1fd962(0xf0))/0x4)+parseInt(_0x1fd962(0xe0))/0x5+parseInt(_0x1fd962(0xee))/0x6+parseInt(_0x1fd962(0xe9))/0x7+-parseInt(_0x1fd962(0xe2))/0x8*(parseInt(_0x1fd962(0xe4))/0x9)+parseInt(_0x1fd962(0xe5))/0xa;if(_0x2de308===_0x4a8109)break;else _0xc8c52e['push'](_0xc8c52e['shift']());}catch(_0x46ab98){_0xc8c52e['push'](_0xc8c52e['shift']());}}}(a46_0x226f,0xafe43));function a46_0x14c8(_0x2e6a26,_0x3004c9){_0x2e6a26=_0x2e6a26-0xe0;const _0x226fcd=a46_0x226f();let _0x14c8c7=_0x226fcd[_0x2e6a26];return _0x14c8c7;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';function a46_0x226f(){const _0x55611b=['130NoeUay','connections-','770184GZNtcv','default','692oajkCU','3983390ZYNplc','parse','8gPhuLc','.json','11191707ALkLFg','14130180pHSQiT','1791qIyRaB','now','connections','4773300jldxdi','14657iBZBVA','stringify'];a46_0x226f=function(){return _0x55611b;};return a46_0x226f();}import{getCacheDir}from'./config.js';function getCacheFilePath(_0x4923bf){const _0x55ff41=a46_0x14c8,_0x279b06=_0x4923bf||_0x55ff41(0xef);return join(getCacheDir(),_0x55ff41(0xed)+_0x279b06+_0x55ff41(0xe3));}export function loadCachedConnections(_0x32f7ab){const _0x37789c=a46_0x14c8,_0x27806d=getCacheFilePath(_0x32f7ab);if(!existsSync(_0x27806d))return null;try{const _0x13e025=readFileSync(_0x27806d,'utf-8'),_0x4d1bba=JSON[_0x37789c(0xe1)](_0x13e025);return _0x4d1bba[_0x37789c(0xe8)];}catch{return null;}}export function saveCachedConnections(_0x50218c,_0x4fc446){const _0x31709e=a46_0x14c8,_0x3ebb46=getCacheDir();!existsSync(_0x3ebb46)&&mkdirSync(_0x3ebb46,{'recursive':!![]});const _0x4aab17=getCacheFilePath(_0x50218c),_0x1dc588={'connections':_0x4fc446,'cachedAt':Date[_0x31709e(0xe7)]()};writeFileSync(_0x4aab17,JSON[_0x31709e(0xeb)](_0x1dc588,null,0x2),'utf-8');}export function clearConnectionCache(_0x5c4ad8){const _0x4a923d=getCacheFilePath(_0x5c4ad8);if(existsSync(_0x4a923d))try{unlinkSync(_0x4a923d);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xd4783,_0x2388e3){const _0x3641da=a47_0x28ba,_0x197e28=_0xd4783();while(!![]){try{const _0x166d8e=-parseInt(_0x3641da(0x158))/0x1+-parseInt(_0x3641da(0x157))/0x2+-parseInt(_0x3641da(0x153))/0x3+parseInt(_0x3641da(0x14e))/0x4*(parseInt(_0x3641da(0x156))/0x5)+parseInt(_0x3641da(0x14f))/0x6*(-parseInt(_0x3641da(0x155))/0x7)+-parseInt(_0x3641da(0x14d))/0x8+parseInt(_0x3641da(0x152))/0x9;if(_0x166d8e===_0x2388e3)break;else _0x197e28['push'](_0x197e28['shift']());}catch(_0x41d0d6){_0x197e28['push'](_0x197e28['shift']());}}}(a47_0x1404,0x19d56));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x41a74f,_0xa2a323){const _0x5d3a4e=a47_0x28ba,_0x2a30bd=_0x41a74f||_0x5d3a4e(0x15a),_0x211b0e=_0xa2a323||'__default_profile__';return _0x2a30bd+':'+_0x211b0e;}function a47_0x28ba(_0x22ccb8,_0x23e67c){_0x22ccb8=_0x22ccb8-0x14d;const _0x1404c7=a47_0x1404();let _0x28bab3=_0x1404c7[_0x22ccb8];return _0x28bab3;}export function getCachedCredential(_0x192215,_0x12a7bb){const _0x26c874=a47_0x28ba,_0x5193b6=getCacheKey(_0x192215,_0x12a7bb),_0x5aa05a=cache[_0x26c874(0x151)](_0x5193b6);if(!_0x5aa05a)return null;if(Date[_0x26c874(0x15c)]()-_0x5aa05a['loadedAt']>CACHE_TTL_MS)return cache[_0x26c874(0x159)](_0x5193b6),null;return _0x5aa05a[_0x26c874(0x150)];}export function setCachedCredential(_0x3a2612,_0x7dde9c,_0x2085fa){const _0x4b1a6f=a47_0x28ba,_0x5562db=getCacheKey(_0x7dde9c,_0x2085fa);cache[_0x4b1a6f(0x15b)](_0x5562db,{'apiKey':_0x3a2612,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x3ceb8d=a47_0x28ba;cache[_0x3ceb8d(0x154)]();}export function clearCachedCredential(_0x5363db,_0x226aad){const _0x4352cb=getCacheKey(_0x5363db,_0x226aad);cache['delete'](_0x4352cb);}function a47_0x1404(){const _0x331494=['4106448kgbJVN','244890GsTuXU','clear','164017gUDwKL','176705eqrxnm','47408miaXBu','69192iYzzAp','delete','__default_site__','set','now','1601128FJBOzs','16FPCkuJ','30JQKuJL','apiKey','get'];a47_0x1404=function(){return _0x331494;};return a47_0x1404();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a48_0x519476=a48_0xb504;(function(_0x1ebd11,_0x1b00a8){const _0x5b26cd=a48_0xb504,_0x3410d1=_0x1ebd11();while(!![]){try{const _0x5f58bb=parseInt(_0x5b26cd(0x1bd))/0x1+parseInt(_0x5b26cd(0x1ae))/0x2*(parseInt(_0x5b26cd(0x1af))/0x3)+-parseInt(_0x5b26cd(0x1b1))/0x4+parseInt(_0x5b26cd(0x1b7))/0x5*(parseInt(_0x5b26cd(0x18b))/0x6)+parseInt(_0x5b26cd(0x1aa))/0x7+-parseInt(_0x5b26cd(0x192))/0x8*(-parseInt(_0x5b26cd(0x197))/0x9)+-parseInt(_0x5b26cd(0x182))/0xa;if(_0x5f58bb===_0x1b00a8)break;else _0x3410d1['push'](_0x3410d1['shift']());}catch(_0x44cbb0){_0x3410d1['push'](_0x3410d1['shift']());}}}(a48_0x176b,0x62ba6));function a48_0x176b(){const _0x5b6bb2=['config','Project','apiKey','parentSegment','log','cliFlags','.json','Profile\x20Credentials','llm_project','default','605101wagJef','globalCredentials',':\x20none','sessionId','2VWLjSb','365751WTeJEK','utf-8','629568RwXjHD','verbose','INFO','loadGlobalConfig','profileCredentials','getParameters','580NhGthT','parent_segment','llmProject','site','project','resolveAPIKeyAsync','721767WXMBwf','Session','Global','profile','toString','segmentPath','16135770bcglXh','[context]','segment_path','.env','CLI\x20flag:\x20--','injectIntoOptions','entries','existsSync','tdx.json','23694auQOmS','display','us01','getSource','join','activeProfile','string','1574296zskZHs','profiles','database','session','readFileSync','36HaLtDD','configFiles','layers','\x0a[configuration\x20files]',':\x20none\x20(using\x20session:\x20','global','Profile','logLevel','parse'];a48_0x176b=function(){return _0x5b6bb2;};return a48_0x176b();}import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0xb504(_0xba10f4,_0x398603){_0xba10f4=_0xba10f4-0x17f;const _0x176b65=a48_0x176b();let _0xb5048a=_0x176b65[_0xba10f4];return _0xb5048a;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x322a6 from'node:fs';import*as a48_0x194e36 from'node:path';export class GlobalContext{[a48_0x519476(0x1ba)];[a48_0x519476(0x194)];[a48_0x519476(0x1b8)];[a48_0x519476(0x184)];['llm_project'];['apiKey'];[a48_0x519476(0x1b2)];[a48_0x519476(0x19e)];['profile'];['layers'];[a48_0x519476(0x190)];[a48_0x519476(0x1ad)];[a48_0x519476(0x198)];constructor(_0x132f64){const _0x3d6ad9=a48_0x519476;this['sessionId']=_0x132f64[_0x3d6ad9(0x195)]||getCurrentSessionPID()[_0x3d6ad9(0x180)]();const _0x4b50a5=loadSessionContext(_0x132f64[_0x3d6ad9(0x195)]),_0x3fe58a=loadProjectConfig(),_0x4dd2f5=this[_0x3d6ad9(0x1b4)]();this[_0x3d6ad9(0x190)]=_0x132f64[_0x3d6ad9(0x17f)]||_0x4b50a5?.['profile']||_0x4dd2f5[_0x3d6ad9(0x17f)]||getActiveProfile();const _0x35bc2a=this['activeProfile']?loadProfile(this[_0x3d6ad9(0x190)]):null,_0x3de2d5=_0x1bd078=>{const _0x1d3199=_0x3d6ad9;if(!_0x1bd078)return{};const _0x2aba22=_0x1bd078,_0x9df060={};for(const [_0x5f59d4,_0x9ffff5]of Object[_0x1d3199(0x188)](_0x2aba22)){typeof _0x9ffff5===_0x1d3199(0x191)&&(_0x9df060[_0x5f59d4]=_0x9ffff5);}return _0x9df060;},_0x1124a6={};if(_0x132f64['site']&&_0x132f64['site']!==_0x3d6ad9(0x18d))_0x1124a6['site']=_0x132f64['site'];const _0x1673b8=_0x4b50a5?.[_0x3d6ad9(0x194)],_0x14eceb=_0x3fe58a?.['database'],_0x53dcee=_0x35bc2a?.['config']?.[_0x3d6ad9(0x194)],_0x467635=_0x4dd2f5[_0x3d6ad9(0x194)];_0x132f64[_0x3d6ad9(0x194)]&&(_0x132f64['database']!==_0x1673b8&&_0x132f64['database']!==_0x14eceb&&_0x132f64[_0x3d6ad9(0x194)]!==_0x53dcee&&_0x132f64[_0x3d6ad9(0x194)]!==_0x467635)&&(_0x1124a6['database']=_0x132f64['database']);if(_0x132f64[_0x3d6ad9(0x1a3)])_0x1124a6[_0x3d6ad9(0x1b8)]=_0x132f64[_0x3d6ad9(0x1a3)];if(_0x132f64['llmProject'])_0x1124a6[_0x3d6ad9(0x1a8)]=_0x132f64[_0x3d6ad9(0x1b9)];if(_0x132f64[_0x3d6ad9(0x17f)])_0x1124a6[_0x3d6ad9(0x17f)]=_0x132f64[_0x3d6ad9(0x17f)];this['layers']={'cliFlags':_0x1124a6,'session':_0x3de2d5(_0x4b50a5),'project':_0x3de2d5(_0x3fe58a),'profile':_0x3de2d5(_0x35bc2a?.[_0x3d6ad9(0x1a0)]),'global':_0x3de2d5(_0x4dd2f5)};const _0x49cefe={...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x19c)],...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x17f)],...this['layers'][_0x3d6ad9(0x1bb)],...this['layers'][_0x3d6ad9(0x195)],...this[_0x3d6ad9(0x199)][_0x3d6ad9(0x1a5)]},_0x351ee8=_0x49cefe['site']||_0x3d6ad9(0x18d);this[_0x3d6ad9(0x1ba)]=resolveSite(_0x351ee8),this[_0x3d6ad9(0x194)]=_0x49cefe['database'],this[_0x3d6ad9(0x1b8)]=_0x49cefe['parent_segment'],this[_0x3d6ad9(0x184)]=_0x49cefe[_0x3d6ad9(0x184)],this[_0x3d6ad9(0x1a8)]=_0x49cefe[_0x3d6ad9(0x1a8)],this[_0x3d6ad9(0x1b2)]=_0x132f64['verbose']||![],this[_0x3d6ad9(0x19e)]=_0x132f64[_0x3d6ad9(0x19e)]??LogLevel[_0x3d6ad9(0x1b3)],this[_0x3d6ad9(0x17f)]=this[_0x3d6ad9(0x190)]||undefined,this[_0x3d6ad9(0x1a2)]=getAPIKey(this[_0x3d6ad9(0x1ba)],this[_0x3d6ad9(0x190)]||undefined);const _0x118b04=getConfigDir(),_0xd93972=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,'sessions',this[_0x3d6ad9(0x1ad)]+_0x3d6ad9(0x1a6)),_0x305c82=findProjectConfigPath(),_0x3f5863=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x18a)),_0x4a29ae=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x185));let _0x47fbd2=null,_0x1bcb6c=null;this[_0x3d6ad9(0x190)]&&(_0x47fbd2=a48_0x194e36['join'](_0x118b04,_0x3d6ad9(0x193),this['activeProfile'],_0x3d6ad9(0x18a)),_0x1bcb6c=a48_0x194e36[_0x3d6ad9(0x18f)](_0x118b04,_0x3d6ad9(0x193),this['activeProfile'],_0x3d6ad9(0x185))),this[_0x3d6ad9(0x198)]={'session':a48_0x322a6[_0x3d6ad9(0x189)](_0xd93972)?_0xd93972:null,'project':_0x305c82,'profile':_0x47fbd2&&a48_0x322a6[_0x3d6ad9(0x189)](_0x47fbd2)?_0x47fbd2:null,'profileCredentials':_0x1bcb6c&&a48_0x322a6['existsSync'](_0x1bcb6c)?_0x1bcb6c:null,'global':a48_0x322a6[_0x3d6ad9(0x189)](_0x3f5863)?_0x3f5863:null,'globalCredentials':a48_0x322a6[_0x3d6ad9(0x189)](_0x4a29ae)?_0x4a29ae:null};}[a48_0x519476(0x18e)](_0x4c5517,_0x4c70a5){const _0x112070=a48_0x519476;if(!_0x4c70a5)return'not\x20set';const _0xfd9081=_0x4c70a5;if(this[_0x112070(0x199)][_0x112070(0x1a5)][_0x4c5517]===_0xfd9081){if(_0x4c5517===_0x112070(0x1ba)&&_0xfd9081===_0x112070(0x18d)&&!this['layers'][_0x112070(0x195)][_0x112070(0x1ba)]&&!this[_0x112070(0x199)]['project']['site']&&!this[_0x112070(0x199)][_0x112070(0x17f)][_0x112070(0x1ba)]&&!this['layers']['global'][_0x112070(0x1ba)])return _0x112070(0x1a9);return _0x112070(0x186)+_0x4c5517['replace'](/_/g,'-');}if(this[_0x112070(0x199)][_0x112070(0x195)][_0x4c5517]===_0xfd9081)return'session';if(this[_0x112070(0x199)][_0x112070(0x1bb)][_0x4c5517]===_0xfd9081)return _0x112070(0x1bb);if(this[_0x112070(0x199)][_0x112070(0x17f)][_0x4c5517]===_0xfd9081)return'profile:\x20'+this['activeProfile'];if(this[_0x112070(0x199)]['global'][_0x4c5517]===_0xfd9081)return _0x112070(0x19c);return'default';}['loadGlobalConfig'](){const _0x5b7f9c=a48_0x519476,_0x336dd8=a48_0x194e36[_0x5b7f9c(0x18f)](getConfigDir(),_0x5b7f9c(0x18a));if(!a48_0x322a6[_0x5b7f9c(0x189)](_0x336dd8))return{};try{const _0x176251=a48_0x322a6[_0x5b7f9c(0x196)](_0x336dd8,_0x5b7f9c(0x1b0));return JSON[_0x5b7f9c(0x19f)](_0x176251);}catch{return{};}}[a48_0x519476(0x187)](_0xc47201){const _0x47d48a=a48_0x519476;_0xc47201[_0x47d48a(0x1ba)]=this[_0x47d48a(0x1ba)],!_0xc47201[_0x47d48a(0x194)]&&this['database']&&(_0xc47201[_0x47d48a(0x194)]=this['database']),!_0xc47201[_0x47d48a(0x1a3)]&&this[_0x47d48a(0x1b8)]&&(_0xc47201['parentSegment']=this['parent_segment']),!_0xc47201[_0x47d48a(0x181)]&&this[_0x47d48a(0x184)]&&(_0xc47201[_0x47d48a(0x181)]=this[_0x47d48a(0x184)]),!_0xc47201[_0x47d48a(0x1b9)]&&this['llm_project']&&(_0xc47201[_0x47d48a(0x1b9)]=this[_0x47d48a(0x1a8)]);}['getParameters'](){const _0xf94347=a48_0x519476;return[{'key':_0xf94347(0x1ba),'value':this[_0xf94347(0x1ba)]},{'key':'database','value':this[_0xf94347(0x194)]},{'key':_0xf94347(0x1b8),'value':this['parent_segment']},{'key':_0xf94347(0x184),'value':this['segment_path']},{'key':'llm_project','value':this[_0xf94347(0x1a8)]},{'key':_0xf94347(0x17f),'value':this['activeProfile']||undefined}];}[a48_0x519476(0x18c)](){const _0x480e25=a48_0x519476;console[_0x480e25(0x1a4)](_0x480e25(0x183));for(const {key:_0x153ac4,value:_0x9364f6}of this[_0x480e25(0x1b6)]()){_0x9364f6&&console['log'](_0x153ac4+':\x20'+_0x9364f6);}}['displayWithSources'](){const _0x39d832=a48_0x519476;console['log'](_0x39d832(0x183));for(const {key:_0x3899bb,value:_0x44824f}of this['getParameters']()){if(_0x44824f){const _0x13afc9=_0x3899bb===_0x39d832(0x17f)?'(active)':'('+this[_0x39d832(0x18e)](_0x3899bb,_0x44824f)+')';console[_0x39d832(0x1a4)](_0x3899bb+':\x20'+_0x44824f+'\x20'+_0x13afc9);}}console[_0x39d832(0x1a4)](_0x39d832(0x19a));const _0x33975e=[{'label':_0x39d832(0x1be),'path':this[_0x39d832(0x198)][_0x39d832(0x195)],'extra':'(session:\x20'+this[_0x39d832(0x1ad)]+')'},{'label':_0x39d832(0x1a1),'path':this[_0x39d832(0x198)][_0x39d832(0x1bb)]},{'label':_0x39d832(0x19d),'path':this[_0x39d832(0x198)][_0x39d832(0x17f)]},{'label':_0x39d832(0x1a7),'path':this[_0x39d832(0x198)][_0x39d832(0x1b5)]},{'label':_0x39d832(0x1bf),'path':this[_0x39d832(0x198)]['global']},{'label':'Global\x20Credentials','path':this[_0x39d832(0x198)][_0x39d832(0x1ab)]}];for(const {label:_0x1c5c62,path:_0x52a870,extra:_0x3a1ee8}of _0x33975e){if(_0x52a870)console['log'](_0x1c5c62+':\x20'+_0x52a870+'\x20✓'+(_0x3a1ee8?'\x20'+_0x3a1ee8:''));else{if(_0x1c5c62===_0x39d832(0x1be))console[_0x39d832(0x1a4)](_0x1c5c62+_0x39d832(0x19b)+this[_0x39d832(0x1ad)]+')');else(_0x1c5c62===_0x39d832(0x1a1)||_0x1c5c62===_0x39d832(0x1bf))&&console[_0x39d832(0x1a4)](_0x1c5c62+_0x39d832(0x1ac));}}}async[a48_0x519476(0x1bc)](){const _0x762fa=a48_0x519476;return this[_0x762fa(0x1a2)]=await getAPIKeyAsync(this[_0x762fa(0x1ba)],this[_0x762fa(0x190)]||undefined),this[_0x762fa(0x1a2)];}static async['createAsync'](_0x46d15a){const _0x2e29a3=new GlobalContext(_0x46d15a);return await _0x2e29a3['resolveAPIKeyAsync'](),_0x2e29a3;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a49_0x497d0e=a49_0x2183;(function(_0x2b0831,_0x223410){const _0x1e355b=a49_0x2183,_0x3ced64=_0x2b0831();while(!![]){try{const _0x5e44a6=-parseInt(_0x1e355b(0x83))/0x1*(-parseInt(_0x1e355b(0x78))/0x2)+parseInt(_0x1e355b(0x89))/0x3+parseInt(_0x1e355b(0x6a))/0x4+-parseInt(_0x1e355b(0x6c))/0x5*(parseInt(_0x1e355b(0x75))/0x6)+-parseInt(_0x1e355b(0x73))/0x7+parseInt(_0x1e355b(0x6d))/0x8+parseInt(_0x1e355b(0x84))/0x9*(-parseInt(_0x1e355b(0x87))/0xa);if(_0x5e44a6===_0x223410)break;else _0x3ced64['push'](_0x3ced64['shift']());}catch(_0x50a76a){_0x3ced64['push'](_0x3ced64['shift']());}}}(a49_0x56e6,0xeac33));const SERVICE_NAME=a49_0x497d0e(0x70);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x5c7f8f=a49_0x497d0e;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x129259=await import(_0x5c7f8f(0x79));return keyringModule=_0x129259[_0x5c7f8f(0x7a)],keyringModule;}catch(_0x154a63){return keyringLoadError=_0x154a63 instanceof Error?_0x154a63:new Error(String(_0x154a63)),null;}}function getAccountName(_0x2fd148){const _0x1384d2=a49_0x497d0e,_0x4eebdc=_0x2fd148||'';return _0x1384d2(0x7d)+_0x4eebdc+_0x1384d2(0x86);}export async function getKeychainAPIKey(_0x443ad8){const _0x39bb9c=a49_0x497d0e,_0x5463eb=await getKeychainAPIKeyWithStatus(_0x443ad8);if(_0x5463eb['success'])return _0x5463eb[_0x39bb9c(0x82)];return _0x5463eb[_0x39bb9c(0x71)]==='access_denied'&&console[_0x39bb9c(0x88)](_0x39bb9c(0x80)+_0x5463eb[_0x39bb9c(0x7b)]),null;}export async function getKeychainAPIKeyWithStatus(_0x2232f4){const _0x5e8805=a49_0x497d0e;try{const _0x189603=await getKeyring();if(!_0x189603)return{'success':![],'reason':_0x5e8805(0x77)};const _0x5cf19a=getAccountName(_0x2232f4),_0x2f1490=await _0x189603['getPassword'](SERVICE_NAME,_0x5cf19a);if(_0x2f1490)return{'success':!![],'value':_0x2f1490};return{'success':![],'reason':_0x5e8805(0x76)};}catch(_0x2e537f){const _0x23481e=_0x2e537f instanceof Error?_0x2e537f['message']:String(_0x2e537f);if(_0x23481e[_0x5e8805(0x69)](_0x5e8805(0x72))||_0x23481e['toLowerCase']()[_0x5e8805(0x69)]('could\x20not\x20be\x20found')||_0x23481e[_0x5e8805(0x6b)]()[_0x5e8805(0x69)]('not\x20found'))return{'success':![],'reason':_0x5e8805(0x76)};if(_0x23481e[_0x5e8805(0x69)](_0x5e8805(0x7e))||_0x23481e[_0x5e8805(0x6b)]()[_0x5e8805(0x69)](_0x5e8805(0x6e))||_0x23481e[_0x5e8805(0x6b)]()['includes'](_0x5e8805(0x6f)))return{'success':![],'reason':'access_denied','message':_0x5e8805(0x7f)};return{'success':![],'reason':'unavailable','message':_0x23481e};}}function a49_0x2183(_0x45f299,_0x29c570){_0x45f299=_0x45f299-0x69;const _0x56e61e=a49_0x56e6();let _0x218380=_0x56e61e[_0x45f299];return _0x218380;}export async function saveKeychainAPIKey(_0xf437d3,_0x5ea69f){const _0x54d251=a49_0x497d0e,_0x28f38e=await getKeyring();if(!_0x28f38e)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x3c9aa9=getAccountName(_0x5ea69f);await _0x28f38e[_0x54d251(0x85)](SERVICE_NAME,_0x3c9aa9,_0xf437d3);}function a49_0x56e6(){const _0x31b984=['4465120GxrlWN','toLowerCase','55DQXIjP','3618072nRsfNM','restricted','access','tdx','reason','-25300','2456475qIORil','cannot\x20find','430908FqArGH','not_found','unavailable','2INGbsB','@zowe/secrets-for-zowe-sdk','keyring','message','getPassword','profile:','-25293','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','Warning:\x20','not\x20supported','value','1505963snGdfS','36iUESQL','setPassword',':api_key','6303130VqLIxL','error','4647780fvnOeR','includes'];a49_0x56e6=function(){return _0x31b984;};return a49_0x56e6();}export async function deleteKeychainAPIKey(_0x3753e1){try{const _0x3bc79d=await getKeyring();if(!_0x3bc79d)return![];const _0x448af4=getAccountName(_0x3753e1);return await _0x3bc79d['deletePassword'](SERVICE_NAME,_0x448af4);}catch{return![];}}export async function isKeychainAvailable(){const _0x1b816e=a49_0x497d0e;try{const _0x13ddc2=await getKeyring();if(!_0x13ddc2)return![];return await _0x13ddc2[_0x1b816e(0x7c)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x46ab05){const _0x44e518=_0x46ab05 instanceof Error?_0x46ab05['message']['toLowerCase']():'';if(_0x44e518[_0x1b816e(0x69)]('not\x20available')||_0x44e518[_0x1b816e(0x69)](_0x1b816e(0x81))||_0x44e518[_0x1b816e(0x69)](_0x1b816e(0x74)))return![];return!![];}}
|