@treasuredata/tdx 0.8.9 → 0.8.10
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.d.ts +10 -1
- package/dist/client/cdp-api-client.d.ts.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/cdp-api-client.js.map +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.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/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.d.ts.map +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +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.d.ts +4 -0
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +6 -0
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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.d.ts +15 -1
- package/dist/sdk/segment.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/cdp.d.ts +30 -0
- package/dist/types/cdp.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +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/journey-utils.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
|
@@ -1 +1 @@
|
|
|
1
|
-
const a38_0x59051d=a38_0x550c;(function(_0x177a22,_0x27b67c){const _0x7c7e83=a38_0x550c,_0x2fcc63=_0x177a22();while(!![]){try{const _0x25d1bc=parseInt(_0x7c7e83(0x1cf))/0x1+-parseInt(_0x7c7e83(0x1e0))/0x2*(-parseInt(_0x7c7e83(0x1e2))/0x3)+parseInt(_0x7c7e83(0x1d4))/0x4+-parseInt(_0x7c7e83(0x1bf))/0x5+parseInt(_0x7c7e83(0x1ce))/0x6+parseInt(_0x7c7e83(0x1d1))/0x7*(-parseInt(_0x7c7e83(0x1c7))/0x8)+-parseInt(_0x7c7e83(0x1e5))/0x9*(parseInt(_0x7c7e83(0x1ae))/0xa);if(_0x25d1bc===_0x27b67c)break;else _0x2fcc63['push'](_0x2fcc63['shift']());}catch(_0x290630){_0x2fcc63['push'](_0x2fcc63['shift']());}}}(a38_0x2948,0x45b27));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a38_0x2948(){const _0x3cca9d=['dim','\x20folder','Building\x20hierarchy\x20tree...','journeyBundleName','\x20top-level\x20items','length','15608RRqhdq','segments','No\x20items\x20match\x20pattern:\x20','Resolving\x20path\x20\x27','Folder/pattern\x20arg:\x20','replace','log','1217808ZHRlZT','446847JmCMvL','folder','1638AfDnGP','listJourneysFromParentSegment','site','1406824ZhscIZ','verbose','message','parentId','listUnified','Parent\x20ID:\x20','\x5c$&','jsonl','segment','json','test','maxDepth','108574HYOTQJ','✔\x20Found\x20','24QZiJzb',',\x20and\x20','listWithPattern','3069045VKawqQ','List\x20folders\x20and\x20child\x20segments','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','description','Set\x20a\x20parent\x20segment\x20context\x20first:','Folder\x20ID:\x20','journey','web','Resolving\x20parent\x20segment\x20\x27','filter','\x20journey','error','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','Recursive\x20mode:\x20enabled','folderId','cause','resolvePathToResource','name','\x20segment','Listing\x20folders,\x20segments,\x20and\x20journeys...','Error:\x20','10wcFzUo','\x27...','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','\x20matching\x20\x27','Site:\x20','Error:\x20No\x20parent\x20segment\x20context\x20set.','format','data','localeCompare','listRecursive','/app/ps/','/e/','parentSegment','✔\x20Built\x20tree\x20with\x20','map','(empty)','all','1763995pRuMWo','sort'];a38_0x2948=function(){return _0x3cca9d;};return a38_0x2948();}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x550c(_0x371373,_0xd1d6cc){_0x371373=_0x371373-0x1a9;const _0x29483c=a38_0x2948();let _0x550c74=_0x29483c[_0x371373];return _0x550c74;}import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';import a38_0x3c99bb from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x59051d(0x1aa)]=a38_0x59051d(0x1c8);[a38_0x59051d(0x1e8)]=a38_0x59051d(0x1e6);async['execute'](_0x46832d){const _0x2675dd=a38_0x59051d,{options:_0xf45623,args:_0x19c784}=_0x46832d,_0x51aba1=_0xf45623['recursive'],_0x22e533=_0x19c784[0x0];try{const _0x5e1cfe=_0xf45623[_0x2675dd(0x1ba)];_0xf45623[_0x2675dd(0x1d5)]&&(console[_0x2675dd(0x1f0)](_0x2675dd(0x1b2)+_0xf45623['site']),console[_0x2675dd(0x1f0)]('Parent\x20segment\x20context:\x20'+(_0x5e1cfe||'(not\x20set)')),_0x22e533&&console[_0x2675dd(0x1f0)](_0x2675dd(0x1cb)+_0x22e533),_0x51aba1&&console[_0x2675dd(0x1f0)](_0x2675dd(0x1f2)));if(!_0x5e1cfe)return console[_0x2675dd(0x1f0)](_0x2675dd(0x1b3)),console[_0x2675dd(0x1f0)](''),console[_0x2675dd(0x1f0)](_0x2675dd(0x1e9)),console['error'](_0x2675dd(0x1b0)),console[_0x2675dd(0x1f0)](_0x2675dd(0x1f1)),console['error'](''),console[_0x2675dd(0x1f0)](_0x2675dd(0x1e7)),0x1;const _0x14b14c=_0x22e533&&(_0x22e533['includes']('*')||_0x22e533['includes']('?'));if(_0x14b14c)return await this[_0x2675dd(0x1e4)](_0x46832d,_0x5e1cfe,_0x22e533);const _0xe97d2b=_0x22e533?_0x5e1cfe+'/'+_0x22e533:_0x5e1cfe;return _0x51aba1?await this[_0x2675dd(0x1b7)](_0x46832d,_0xe97d2b):await this[_0x2675dd(0x1d8)](_0x46832d,_0xe97d2b);}catch(_0x25a182){if(_0x25a182 instanceof SDKError)return console[_0x2675dd(0x1f0)](_0x2675dd(0x1ad)+_0x25a182[_0x2675dd(0x1d6)]),_0x25a182[_0x2675dd(0x1f4)]&&console[_0x2675dd(0x1f0)]('\x20\x20Cause:\x20'+_0x25a182[_0x2675dd(0x1f4)]),0x1;throw _0x25a182;}}async[a38_0x59051d(0x1e4)](_0x5de7a5,_0xeb4099,_0x1909be){const _0x167ce7=a38_0x59051d,{options:_0x53d81f,tdx:_0x3fabab}=_0x5de7a5,_0xf6a9bc=_0x53d81f[_0x167ce7(0x1ec)],_0x95ad8c=await withSpinner(_0x167ce7(0x1ed)+_0xeb4099+_0x167ce7(0x1af),()=>_0x3fabab[_0x167ce7(0x1dc)]['resolvePathToResource'](_0xeb4099),{'verbose':_0x53d81f[_0x167ce7(0x1d5)]}),_0x12d8ba=_0x95ad8c[_0x167ce7(0x1b5)],_0x6ed14d=await withSpinner(_0x167ce7(0x1ac),()=>Promise[_0x167ce7(0x1be)]([_0x3fabab[_0x167ce7(0x1dc)][_0x167ce7(0x1d8)](_0x12d8ba['parentId'],_0x12d8ba[_0x167ce7(0x1f3)]),_0x3fabab[_0x167ce7(0x1eb)][_0x167ce7(0x1d2)](_0x12d8ba[_0x167ce7(0x1d7)])]),{'verbose':_0x53d81f[_0x167ce7(0x1d5)]}),[_0x3f9ec8,_0x4f97a5]=_0x6ed14d[_0x167ce7(0x1b5)],{folders:_0x14ac3d,segments:_0x3034a3}=_0x3f9ec8,_0x419704=_0x1909be[_0x167ce7(0x1cc)](/[.+^${}()|[\]\\]/g,_0x167ce7(0x1da))[_0x167ce7(0x1cc)](/\*/g,'.*')[_0x167ce7(0x1cc)](/\?/g,'.'),_0x50bd9=new RegExp('^'+_0x419704+'$','i'),_0x492796=_0x14ac3d[_0x167ce7(0x1ee)](_0x15c6da=>_0x50bd9[_0x167ce7(0x1de)](_0x15c6da[_0x167ce7(0x1aa)])),_0x5de7dd=_0x3034a3[_0x167ce7(0x1ee)](_0x3e459f=>_0x50bd9[_0x167ce7(0x1de)](_0x3e459f[_0x167ce7(0x1aa)])),_0x2215aa=_0x4f97a5['filter'](_0x90e58c=>_0x50bd9['test'](_0x90e58c['journeyBundleName'])),_0x3e310f=_0x492796[_0x167ce7(0x1c6)]+_0x5de7dd['length']+_0x2215aa['length'];console[_0x167ce7(0x1f0)](_0x167ce7(0x1e1)+_0x492796[_0x167ce7(0x1c6)]+_0x167ce7(0x1c2)+(_0x492796[_0x167ce7(0x1c6)]!==0x1?'s':'')+',\x20'+_0x5de7dd[_0x167ce7(0x1c6)]+'\x20segment'+(_0x5de7dd[_0x167ce7(0x1c6)]!==0x1?'s':'')+_0x167ce7(0x1e3)+_0x2215aa[_0x167ce7(0x1c6)]+_0x167ce7(0x1ef)+(_0x2215aa['length']!==0x1?'s':'')+_0x167ce7(0x1b1)+_0x1909be+'\x27');const _0x5889b1=_0xa62a47=>{const _0x5be402=_0x167ce7;return getConsoleNextUrl(_0x53d81f[_0x5be402(0x1d3)],_0x5be402(0x1b8)+_0x12d8ba[_0x5be402(0x1d7)]+_0x5be402(0x1b9)+_0xa62a47);},_0x17112d=_0x53d81f[_0x167ce7(0x1b4)]===_0x167ce7(0x1dd)||_0x53d81f[_0x167ce7(0x1b4)]===_0x167ce7(0x1db);if(_0x17112d){const _0x340162=[..._0x492796[_0x167ce7(0x1bc)](_0x7a229d=>({..._0x7a229d,'type':_0x167ce7(0x1d0)})),..._0x5de7dd[_0x167ce7(0x1bc)](_0x4c4169=>({..._0x4c4169,'type':'segment','url':_0x5889b1(_0x4c4169['id'])})),..._0x2215aa['map'](_0x2655b8=>({..._0x2655b8,'name':_0x2655b8[_0x167ce7(0x1c4)],'type':_0x167ce7(0x1eb)}))][_0x167ce7(0x1c0)]((_0x11d9f7,_0x14c99f)=>_0x11d9f7[_0x167ce7(0x1aa)][_0x167ce7(0x1b6)](_0x14c99f[_0x167ce7(0x1aa)]));await handleSDKOutput(_0x340162,_0x53d81f);}else{if(_0x3e310f===0x0)console[_0x167ce7(0x1cd)](_0x167ce7(0x1c9)+_0x1909be);else{console[_0x167ce7(0x1cd)](a38_0x3c99bb[_0x167ce7(0x1c1)]('['+_0xeb4099+']\x20matching\x20\x27'+_0x1909be+'\x27'));const _0x3e2efa=formatFlatList(_0x492796,_0x5de7dd,{'showMetadata':!![],'showUrl':_0xf6a9bc,'getSegmentUrl':_0x5889b1},_0x2215aa);console['log'](_0x3e2efa);}}return 0x0;}async[a38_0x59051d(0x1d8)](_0xdb8d12,_0x24eaf4){const _0x3d18c9=a38_0x59051d,{options:_0x21c375,tdx:_0x5af3bd}=_0xdb8d12,_0x569bfc=_0x21c375[_0x3d18c9(0x1ec)],_0x30013e=await withSpinner(_0x3d18c9(0x1ca)+_0x24eaf4+'\x27...',()=>_0x5af3bd['segment'][_0x3d18c9(0x1a9)](_0x24eaf4),{'verbose':_0x21c375['verbose']}),_0x1211ed=_0x30013e[_0x3d18c9(0x1b5)];_0x21c375[_0x3d18c9(0x1d5)]&&(console['error'](_0x3d18c9(0x1d9)+_0x1211ed[_0x3d18c9(0x1d7)]),_0x1211ed[_0x3d18c9(0x1f3)]&&console[_0x3d18c9(0x1f0)](_0x3d18c9(0x1ea)+_0x1211ed['folderId']));const _0x446712=await withSpinner(_0x3d18c9(0x1ac),()=>Promise['all']([_0x5af3bd[_0x3d18c9(0x1dc)][_0x3d18c9(0x1d8)](_0x1211ed[_0x3d18c9(0x1d7)],_0x1211ed[_0x3d18c9(0x1f3)]),_0x5af3bd[_0x3d18c9(0x1eb)]['listJourneysFromParentSegment'](_0x1211ed[_0x3d18c9(0x1d7)])]),{'verbose':_0x21c375[_0x3d18c9(0x1d5)]}),[_0x55937f,_0x1a40fb]=_0x446712[_0x3d18c9(0x1b5)],{folders:_0x55deb4,segments:_0x45064a}=_0x55937f,_0x1cb7fa=_0x55deb4['length']+_0x45064a[_0x3d18c9(0x1c6)]+_0x1a40fb[_0x3d18c9(0x1c6)];console[_0x3d18c9(0x1f0)](_0x3d18c9(0x1e1)+_0x55deb4[_0x3d18c9(0x1c6)]+_0x3d18c9(0x1c2)+(_0x55deb4['length']!==0x1?'s':'')+',\x20'+_0x45064a['length']+_0x3d18c9(0x1ab)+(_0x45064a[_0x3d18c9(0x1c6)]!==0x1?'s':'')+_0x3d18c9(0x1e3)+_0x1a40fb[_0x3d18c9(0x1c6)]+_0x3d18c9(0x1ef)+(_0x1a40fb['length']!==0x1?'s':''));const _0xa00a3d=_0x39c5ae=>{const _0x436e09=_0x3d18c9;return getConsoleNextUrl(_0x21c375[_0x436e09(0x1d3)],_0x436e09(0x1b8)+_0x1211ed[_0x436e09(0x1d7)]+_0x436e09(0x1b9)+_0x39c5ae);},_0x114429=_0x21c375[_0x3d18c9(0x1b4)]===_0x3d18c9(0x1dd)||_0x21c375[_0x3d18c9(0x1b4)]===_0x3d18c9(0x1db);if(_0x114429){const _0x36b7f7=[..._0x55deb4['map'](_0x5b2115=>({..._0x5b2115,'type':_0x3d18c9(0x1d0)})),..._0x45064a[_0x3d18c9(0x1bc)](_0x207ff9=>({..._0x207ff9,'type':_0x3d18c9(0x1dc),'url':_0xa00a3d(_0x207ff9['id'])})),..._0x1a40fb[_0x3d18c9(0x1bc)](_0x2e1f1c=>({..._0x2e1f1c,'name':_0x2e1f1c[_0x3d18c9(0x1c4)],'type':_0x3d18c9(0x1eb)}))][_0x3d18c9(0x1c0)]((_0x4bcffc,_0x593fc5)=>_0x4bcffc['name']['localeCompare'](_0x593fc5[_0x3d18c9(0x1aa)]));await handleSDKOutput(_0x36b7f7,_0x21c375);}else{if(_0x1cb7fa===0x0)console['log'](a38_0x3c99bb[_0x3d18c9(0x1c1)]('['+_0x24eaf4+']')),console[_0x3d18c9(0x1cd)](_0x3d18c9(0x1bd));else{console[_0x3d18c9(0x1cd)](a38_0x3c99bb['dim']('['+_0x24eaf4+']'));const _0x40cc9e=formatFlatList(_0x55deb4,_0x45064a,{'showMetadata':!![],'showUrl':_0x569bfc,'getSegmentUrl':_0xa00a3d},_0x1a40fb);console[_0x3d18c9(0x1cd)](_0x40cc9e);}}return 0x0;}async[a38_0x59051d(0x1b7)](_0xebbe7e,_0x21d3fa){const _0x5a65fc=a38_0x59051d,{options:_0x38d014,tdx:_0xa6774c}=_0xebbe7e,_0x5afdeb=_0x38d014[_0x5a65fc(0x1ec)],_0x4eccdd=await withSpinner(_0x5a65fc(0x1ca)+_0x21d3fa+_0x5a65fc(0x1af),()=>_0xa6774c['segment'][_0x5a65fc(0x1a9)](_0x21d3fa),{'verbose':_0x38d014['verbose']}),_0x3e154f=_0x4eccdd[_0x5a65fc(0x1b5)];_0x38d014[_0x5a65fc(0x1d5)]&&(console[_0x5a65fc(0x1f0)](_0x5a65fc(0x1d9)+_0x3e154f['parentId']),_0x3e154f[_0x5a65fc(0x1f3)]&&console[_0x5a65fc(0x1f0)](_0x5a65fc(0x1ea)+_0x3e154f['folderId']));const _0x148f0c=_0x38d014[_0x5a65fc(0x1df)]||0xa,_0x173687=await withSpinner(_0x5a65fc(0x1c3),()=>_0xa6774c['segment'][_0x5a65fc(0x1b7)](_0x3e154f['parentId'],_0x3e154f[_0x5a65fc(0x1f3)],0x0,_0x148f0c),{'verbose':_0x38d014[_0x5a65fc(0x1d5)]}),_0x4aed55=_0x173687[_0x5a65fc(0x1b5)];console[_0x5a65fc(0x1f0)](_0x5a65fc(0x1bb)+_0x4aed55[_0x5a65fc(0x1c6)]+_0x5a65fc(0x1c5));const _0x2e9282=_0x522bcc=>{const _0x390d92=_0x5a65fc;return getConsoleNextUrl(_0x38d014['site'],_0x390d92(0x1b8)+_0x3e154f[_0x390d92(0x1d7)]+_0x390d92(0x1b9)+_0x522bcc);};if(_0x38d014[_0x5a65fc(0x1b4)]===_0x5a65fc(0x1dd)||_0x38d014['format']===_0x5a65fc(0x1db))await handleSDKOutput(_0x4aed55,_0x38d014);else{console[_0x5a65fc(0x1cd)](a38_0x3c99bb[_0x5a65fc(0x1c1)]('['+_0x21d3fa+']'));const _0x20401e=formatTree(_0x4aed55,{'showMetadata':!![],'showUrl':_0x5afdeb,'getSegmentUrl':_0x2e9282});console['log'](_0x20401e);}return 0x0;}}
|
|
1
|
+
const a38_0x191606=a38_0x4c13;(function(_0x8a35d,_0x5be5a9){const _0x35c242=a38_0x4c13,_0x58afcd=_0x8a35d();while(!![]){try{const _0x4b103b=parseInt(_0x35c242(0x161))/0x1*(-parseInt(_0x35c242(0x173))/0x2)+-parseInt(_0x35c242(0x14b))/0x3+parseInt(_0x35c242(0x15e))/0x4*(parseInt(_0x35c242(0x15c))/0x5)+parseInt(_0x35c242(0x16c))/0x6+parseInt(_0x35c242(0x15a))/0x7*(-parseInt(_0x35c242(0x17b))/0x8)+parseInt(_0x35c242(0x14c))/0x9+-parseInt(_0x35c242(0x177))/0xa*(-parseInt(_0x35c242(0x187))/0xb);if(_0x4b103b===_0x5be5a9)break;else _0x58afcd['push'](_0x58afcd['shift']());}catch(_0x5ce72a){_0x58afcd['push'](_0x58afcd['shift']());}}}(a38_0x41b4,0x244d8));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';function a38_0x4c13(_0x30c001,_0x51ae3a){_0x30c001=_0x30c001-0x149;const _0x41b41d=a38_0x41b4();let _0x4c1387=_0x41b41d[_0x30c001];return _0x4c1387;}import a38_0x360da9 from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x191606(0x180)]=a38_0x191606(0x167);[a38_0x191606(0x151)]='List\x20folders\x20and\x20child\x20segments';async[a38_0x191606(0x18f)](_0xa15496){const _0xd21b5d=a38_0x191606,{options:_0x4d07ef,args:_0x5d9120}=_0xa15496,_0x1fd33f=_0x4d07ef['recursive'],_0xb249a5=_0x5d9120[0x0];try{const _0x505f60=_0x4d07ef[_0xd21b5d(0x18d)];_0x4d07ef['verbose']&&(console['error'](_0xd21b5d(0x14f)+_0x4d07ef['site']),console['error'](_0xd21b5d(0x160)+(_0x505f60||'(not\x20set)')),_0xb249a5&&console[_0xd21b5d(0x176)]('Folder/pattern\x20arg:\x20'+_0xb249a5),_0x1fd33f&&console['error']('Recursive\x20mode:\x20enabled'));if(!_0x505f60)return console[_0xd21b5d(0x176)](_0xd21b5d(0x162)),console[_0xd21b5d(0x176)](''),console['error']('Set\x20a\x20parent\x20segment\x20context\x20first:'),console[_0xd21b5d(0x176)](_0xd21b5d(0x164)),console[_0xd21b5d(0x176)](_0xd21b5d(0x165)),console[_0xd21b5d(0x176)](''),console[_0xd21b5d(0x176)](_0xd21b5d(0x149)),0x1;const _0x1369ca=_0xb249a5&&(_0xb249a5[_0xd21b5d(0x17d)]('*')||_0xb249a5[_0xd21b5d(0x17d)]('?'));if(_0x1369ca)return await this[_0xd21b5d(0x15b)](_0xa15496,_0x505f60,_0xb249a5);const _0x2ac6ca=_0xb249a5?_0x505f60+'/'+_0xb249a5:_0x505f60;return _0x1fd33f?await this[_0xd21b5d(0x163)](_0xa15496,_0x2ac6ca):await this[_0xd21b5d(0x154)](_0xa15496,_0x2ac6ca);}catch(_0x42d7b3){if(_0x42d7b3 instanceof SDKError)return console['error'](_0xd21b5d(0x184)+_0x42d7b3[_0xd21b5d(0x181)]),_0x42d7b3[_0xd21b5d(0x150)]&&console[_0xd21b5d(0x176)](_0xd21b5d(0x185)+_0x42d7b3['cause']),0x1;throw _0x42d7b3;}}async[a38_0x191606(0x15b)](_0x4564c3,_0x5551c8,_0x230aa6){const _0x39e810=a38_0x191606,{options:_0x5eadbf,tdx:_0x24e9e3}=_0x4564c3,_0x11d840=_0x5eadbf[_0x39e810(0x191)],_0x141c8d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5551c8+_0x39e810(0x192),()=>_0x24e9e3['segment'][_0x39e810(0x155)](_0x5551c8),{'verbose':_0x5eadbf[_0x39e810(0x18b)]}),_0x11e94=_0x141c8d['data'],_0x2376ff=await withSpinner(_0x39e810(0x190),()=>Promise[_0x39e810(0x178)]([_0x24e9e3[_0x39e810(0x17f)][_0x39e810(0x154)](_0x11e94[_0x39e810(0x16a)],_0x11e94['folderId']),_0x24e9e3[_0x39e810(0x18c)]['listJourneysFromParentSegment'](_0x11e94[_0x39e810(0x16a)])]),{'verbose':_0x5eadbf[_0x39e810(0x18b)]}),[_0x3e2290,_0x7836d4]=_0x2376ff[_0x39e810(0x186)],{folders:_0x5c68d9,segments:_0x5dddcc}=_0x3e2290,_0x19b5c8=_0x230aa6['replace'](/[.+^${}()|[\]\\]/g,_0x39e810(0x174))[_0x39e810(0x168)](/\*/g,'.*')[_0x39e810(0x168)](/\?/g,'.'),_0x4365a6=new RegExp('^'+_0x19b5c8+'$','i'),_0x2f8a74=_0x5c68d9[_0x39e810(0x182)](_0x182063=>_0x4365a6['test'](_0x182063['name'])),_0xff155d=_0x5dddcc[_0x39e810(0x182)](_0x3ed96e=>_0x4365a6[_0x39e810(0x159)](_0x3ed96e[_0x39e810(0x180)])),_0x29349e=_0x7836d4[_0x39e810(0x182)](_0x263b01=>_0x4365a6[_0x39e810(0x159)](_0x263b01[_0x39e810(0x16b)])),_0x5962ce=_0x2f8a74['length']+_0xff155d['length']+_0x29349e[_0x39e810(0x15f)];console[_0x39e810(0x176)]('✔\x20Found\x20'+_0x2f8a74[_0x39e810(0x15f)]+_0x39e810(0x152)+(_0x2f8a74[_0x39e810(0x15f)]!==0x1?'s':'')+',\x20'+_0xff155d[_0x39e810(0x15f)]+_0x39e810(0x153)+(_0xff155d[_0x39e810(0x15f)]!==0x1?'s':'')+_0x39e810(0x157)+_0x29349e[_0x39e810(0x15f)]+_0x39e810(0x14a)+(_0x29349e[_0x39e810(0x15f)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x230aa6+'\x27');const _0x25201f=_0x253b00=>{const _0x2985d7=_0x39e810;return getConsoleNextUrl(_0x5eadbf[_0x2985d7(0x166)],'/app/ps/'+_0x11e94[_0x2985d7(0x16a)]+_0x2985d7(0x17c)+_0x253b00);},_0x17bb8c=_0x5eadbf['format']===_0x39e810(0x156)||_0x5eadbf[_0x39e810(0x169)]===_0x39e810(0x17a);if(_0x17bb8c){const _0x509d8a=[..._0x2f8a74[_0x39e810(0x179)](_0x3af50a=>({..._0x3af50a,'type':_0x39e810(0x16f)})),..._0xff155d['map'](_0x3c3f55=>({..._0x3c3f55,'type':_0x39e810(0x17f),'url':_0x25201f(_0x3c3f55['id'])})),..._0x29349e[_0x39e810(0x179)](_0x15c79a=>({..._0x15c79a,'name':_0x15c79a[_0x39e810(0x16b)],'type':'journey'}))]['sort']((_0x17660b,_0x62da0d)=>_0x17660b[_0x39e810(0x180)][_0x39e810(0x16d)](_0x62da0d[_0x39e810(0x180)]));await handleSDKOutput(_0x509d8a,_0x5eadbf);}else{if(_0x5962ce===0x0)console['log'](_0x39e810(0x16e)+_0x230aa6);else{console[_0x39e810(0x171)](a38_0x360da9[_0x39e810(0x189)]('['+_0x5551c8+']\x20matching\x20\x27'+_0x230aa6+'\x27'));const _0x15d27f=formatFlatList(_0x2f8a74,_0xff155d,{'showMetadata':!![],'showUrl':_0x11d840,'getSegmentUrl':_0x25201f},_0x29349e);console[_0x39e810(0x171)](_0x15d27f);}}return 0x0;}async[a38_0x191606(0x154)](_0x44759f,_0x30de3e){const _0x19bd4b=a38_0x191606,{options:_0x4beb1d,tdx:_0x2bb087}=_0x44759f,_0x267195=_0x4beb1d[_0x19bd4b(0x191)],_0x15cbd0=await withSpinner(_0x19bd4b(0x14d)+_0x30de3e+_0x19bd4b(0x192),()=>_0x2bb087[_0x19bd4b(0x17f)]['resolvePathToResource'](_0x30de3e),{'verbose':_0x4beb1d['verbose']}),_0x5bf517=_0x15cbd0[_0x19bd4b(0x186)];_0x4beb1d[_0x19bd4b(0x18b)]&&(console['error'](_0x19bd4b(0x158)+_0x5bf517[_0x19bd4b(0x16a)]),_0x5bf517[_0x19bd4b(0x172)]&&console['error'](_0x19bd4b(0x18a)+_0x5bf517[_0x19bd4b(0x172)]));const _0x10f289=await withSpinner(_0x19bd4b(0x190),()=>Promise[_0x19bd4b(0x178)]([_0x2bb087['segment'][_0x19bd4b(0x154)](_0x5bf517[_0x19bd4b(0x16a)],_0x5bf517[_0x19bd4b(0x172)]),_0x2bb087[_0x19bd4b(0x18c)][_0x19bd4b(0x170)](_0x5bf517[_0x19bd4b(0x16a)])]),{'verbose':_0x4beb1d[_0x19bd4b(0x18b)]}),[_0x31311d,_0x53911c]=_0x10f289[_0x19bd4b(0x186)],{folders:_0xef3a18,segments:_0x5de175}=_0x31311d,_0x5b367f=_0xef3a18[_0x19bd4b(0x15f)]+_0x5de175[_0x19bd4b(0x15f)]+_0x53911c[_0x19bd4b(0x15f)];console['error'](_0x19bd4b(0x175)+_0xef3a18[_0x19bd4b(0x15f)]+_0x19bd4b(0x152)+(_0xef3a18[_0x19bd4b(0x15f)]!==0x1?'s':'')+',\x20'+_0x5de175['length']+_0x19bd4b(0x153)+(_0x5de175['length']!==0x1?'s':'')+',\x20and\x20'+_0x53911c['length']+_0x19bd4b(0x14a)+(_0x53911c[_0x19bd4b(0x15f)]!==0x1?'s':''));const _0x57d652=_0xfc4977=>{const _0x5a003c=_0x19bd4b;return getConsoleNextUrl(_0x4beb1d[_0x5a003c(0x166)],'/app/ps/'+_0x5bf517['parentId']+_0x5a003c(0x17c)+_0xfc4977);},_0x139975=_0x4beb1d['format']===_0x19bd4b(0x156)||_0x4beb1d['format']===_0x19bd4b(0x17a);if(_0x139975){const _0x1a5e9c=[..._0xef3a18[_0x19bd4b(0x179)](_0x2d9f0d=>({..._0x2d9f0d,'type':'folder'})),..._0x5de175['map'](_0x2cf6fd=>({..._0x2cf6fd,'type':_0x19bd4b(0x17f),'url':_0x57d652(_0x2cf6fd['id'])})),..._0x53911c['map'](_0x5611c4=>({..._0x5611c4,'name':_0x5611c4[_0x19bd4b(0x16b)],'type':_0x19bd4b(0x18c)}))]['sort']((_0x4ac732,_0x4cdd76)=>_0x4ac732[_0x19bd4b(0x180)]['localeCompare'](_0x4cdd76[_0x19bd4b(0x180)]));await handleSDKOutput(_0x1a5e9c,_0x4beb1d);}else{if(_0x5b367f===0x0)console[_0x19bd4b(0x171)](a38_0x360da9[_0x19bd4b(0x189)]('['+_0x30de3e+']')),console[_0x19bd4b(0x171)](_0x19bd4b(0x14e));else{console['log'](a38_0x360da9['dim']('['+_0x30de3e+']'));const _0x2b1ffc=formatFlatList(_0xef3a18,_0x5de175,{'showMetadata':!![],'showUrl':_0x267195,'getSegmentUrl':_0x57d652},_0x53911c);console['log'](_0x2b1ffc);}}return 0x0;}async[a38_0x191606(0x163)](_0x550783,_0x5285b8){const _0x1037de=a38_0x191606,{options:_0x549bc0,tdx:_0x510426}=_0x550783,_0x23bfd9=_0x549bc0[_0x1037de(0x191)],_0x2bd964=await withSpinner(_0x1037de(0x14d)+_0x5285b8+_0x1037de(0x192),()=>_0x510426[_0x1037de(0x17f)][_0x1037de(0x155)](_0x5285b8),{'verbose':_0x549bc0[_0x1037de(0x18b)]}),_0x5b7a6b=_0x2bd964[_0x1037de(0x186)];_0x549bc0[_0x1037de(0x18b)]&&(console['error'](_0x1037de(0x158)+_0x5b7a6b['parentId']),_0x5b7a6b[_0x1037de(0x172)]&&console[_0x1037de(0x176)]('Folder\x20ID:\x20'+_0x5b7a6b[_0x1037de(0x172)]));const _0xf94256=_0x549bc0[_0x1037de(0x183)]||0xa,_0x5cd836=await withSpinner(_0x1037de(0x15d),()=>_0x510426[_0x1037de(0x17f)]['listRecursive'](_0x5b7a6b[_0x1037de(0x16a)],_0x5b7a6b[_0x1037de(0x172)],0x0,_0xf94256),{'verbose':_0x549bc0[_0x1037de(0x18b)]}),_0x28aaea=_0x5cd836[_0x1037de(0x186)];console[_0x1037de(0x176)](_0x1037de(0x17e)+_0x28aaea[_0x1037de(0x15f)]+_0x1037de(0x188));const _0x552f60=_0x5b8776=>{const _0x535b5a=_0x1037de;return getConsoleNextUrl(_0x549bc0[_0x535b5a(0x166)],_0x535b5a(0x18e)+_0x5b7a6b[_0x535b5a(0x16a)]+_0x535b5a(0x17c)+_0x5b8776);};if(_0x549bc0[_0x1037de(0x169)]===_0x1037de(0x156)||_0x549bc0[_0x1037de(0x169)]===_0x1037de(0x17a))await handleSDKOutput(_0x28aaea,_0x549bc0);else{console[_0x1037de(0x171)](a38_0x360da9['dim']('['+_0x5285b8+']'));const _0x1f0866=formatTree(_0x28aaea,{'showMetadata':!![],'showUrl':_0x23bfd9,'getSegmentUrl':_0x552f60});console[_0x1037de(0x171)](_0x1f0866);}return 0x0;}}function a38_0x41b4(){const _0x352129=['web','\x27...','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','\x20journey','171774EbNYjE','283473MofkGB','Resolving\x20path\x20\x27','(empty)','Site:\x20','cause','description','\x20folder','\x20segment','listUnified','resolvePathToResource','json',',\x20and\x20','Parent\x20ID:\x20','test','11004wTzqrg','listWithPattern','945095oOXuAv','Building\x20hierarchy\x20tree...','4aNvUkG','length','Parent\x20segment\x20context:\x20','134089POdnPB','Error:\x20No\x20parent\x20segment\x20context\x20set.','listRecursive','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','site','segments','replace','format','parentId','journeyBundleName','824136bcvJlZ','localeCompare','No\x20items\x20match\x20pattern:\x20','folder','listJourneysFromParentSegment','log','folderId','2dYcACY','\x5c$&','✔\x20Found\x20','error','150eCJskb','all','map','jsonl','976vMQaqe','/e/','includes','✔\x20Built\x20tree\x20with\x20','segment','name','message','filter','maxDepth','Error:\x20','\x20\x20Cause:\x20','data','127567vYeqfM','\x20top-level\x20items','dim','Folder\x20ID:\x20','verbose','journey','parentSegment','/app/ps/','execute','Listing\x20folders,\x20segments,\x20and\x20journeys...'];a38_0x41b4=function(){return _0x352129;};return a38_0x41b4();}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x59a2f4=a39_0x4ba7;(function(_0x2dc756,_0x4cdea1){const _0x41e9db=a39_0x4ba7,_0x1126f8=_0x2dc756();while(!![]){try{const _0x33094f=-parseInt(_0x41e9db(0x125))/0x1*(-parseInt(_0x41e9db(0x137))/0x2)+parseInt(_0x41e9db(0x114))/0x3*(parseInt(_0x41e9db(0x132))/0x4)+parseInt(_0x41e9db(0x11a))/0x5+parseInt(_0x41e9db(0x12f))/0x6*(parseInt(_0x41e9db(0x122))/0x7)+-parseInt(_0x41e9db(0x121))/0x8+parseInt(_0x41e9db(0x12b))/0x9+-parseInt(_0x41e9db(0x11b))/0xa;if(_0x33094f===_0x4cdea1)break;else _0x1126f8['push'](_0x1126f8['shift']());}catch(_0x41af08){_0x1126f8['push'](_0x1126f8['shift']());}}}(a39_0x5e7d,0x41194));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a39_0x5e7d(){const _0x146747=['Limit:\x20','✔\x20Retrieved\x20','args','60StuQSS','error','data','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','message','cause','659880FUGZpN','8109090EdbTKJ','\x20row','\x20\x20Cause:\x20','length','Database:\x20','site','2885104GjTLCs','1131641Wtkgsv','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Site:\x20','20nUjFiq','table','Error:\x20','Usage:\x20tdx\x20show\x20<database.table>','Show\x20table\x20contents','showTable','1226088GFLDPk','show','validate','\x20from\x20','6KKCmwc','Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Table:\x20','100156FzBxwN','database','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','verbose','catalog','50754EFEgfU','description'];a39_0x5e7d=function(){return _0x146747;};return a39_0x5e7d();}function a39_0x4ba7(_0x31ec20,_0x38d76e){_0x31ec20=_0x31ec20-0x112;const _0x5e7d12=a39_0x5e7d();let _0x4ba784=_0x5e7d12[_0x31ec20];return _0x4ba784;}import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class ShowCommand extends BaseCommand{['name']=a39_0x59a2f4(0x12c);[a39_0x59a2f4(0x138)]=a39_0x59a2f4(0x129);async['execute'](_0x7ed1f0){const _0x312f5c=a39_0x59a2f4;return this[_0x312f5c(0x12a)](_0x7ed1f0);}async[a39_0x59a2f4(0x12a)](_0x571032){const _0x239c03=a39_0x59a2f4,{options:_0x59cc5f,args:_0x8ea67d,tdx:_0x4358aa}=_0x571032;let _0x3a217f;try{_0x3a217f=parseTableReference(_0x8ea67d[0x0]);const _0x1bf4d1=_0x59cc5f[_0x239c03(0x133)];!_0x3a217f[_0x239c03(0x133)]&&_0x1bf4d1&&(_0x3a217f[_0x239c03(0x133)]=_0x1bf4d1);const _0x4cdd94=validateTableDescribeReference(_0x3a217f);if(_0x4cdd94)return console['error']('Error:\x20'+_0x4cdd94),console[_0x239c03(0x115)](_0x239c03(0x128)),console[_0x239c03(0x115)](_0x239c03(0x117)),console[_0x239c03(0x115)](_0x239c03(0x134)),0x1;}catch(_0xdb3c8){return console[_0x239c03(0x115)](_0x239c03(0x127)+_0xdb3c8[_0x239c03(0x118)]),console[_0x239c03(0x115)]('Usage:\x20tdx\x20show\x20<database.table>'),console[_0x239c03(0x115)]('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x239c03(0x115)](_0x239c03(0x134)),0x1;}const _0x5a3fae=_0x3a217f[_0x239c03(0x136)],_0x2fb3a5=_0x3a217f[_0x239c03(0x133)],_0x492e3c=_0x3a217f[_0x239c03(0x126)],_0x5ac52f=resolveLimit(_0x59cc5f['limit'],DEFAULT_DISPLAY_LIMIT);try{_0x59cc5f[_0x239c03(0x135)]&&(console[_0x239c03(0x115)](_0x239c03(0x124)+_0x59cc5f[_0x239c03(0x120)]),_0x5a3fae&&console[_0x239c03(0x115)]('Catalog:\x20'+_0x5a3fae),console[_0x239c03(0x115)](_0x239c03(0x11f)+_0x2fb3a5),console[_0x239c03(0x115)](_0x239c03(0x131)+_0x492e3c),console[_0x239c03(0x115)](_0x239c03(0x139)+_0x5ac52f));const _0xabbe77=_0x5a3fae?_0x5a3fae+'.'+_0x2fb3a5+'.'+_0x492e3c:_0x2fb3a5+'.'+_0x492e3c,_0x2aed6a=await withSpinner('Querying\x20'+_0xabbe77+'...',()=>_0x4358aa['query']['showTable'](_0x2fb3a5,_0x492e3c,_0x5ac52f,_0x5a3fae),{'verbose':_0x59cc5f['verbose']}),_0x888399=_0x2aed6a[_0x239c03(0x116)],_0x492f61=_0x888399['data'];return _0x492f61[_0x239c03(0x11e)]===0x0?console[_0x239c03(0x115)]('✔\x20Query\x20successful\x20-\x200\x20rows\x20returned'):console[_0x239c03(0x115)](_0x239c03(0x112)+_0x492f61[_0x239c03(0x11e)]+_0x239c03(0x11c)+(_0x492f61['length']!==0x1?'s':'')+_0x239c03(0x12e)+_0xabbe77),await handleSDKOutput(_0x492f61,_0x59cc5f),0x0;}catch(_0x5c2496){if(_0x5c2496 instanceof SDKError)return console['error'](_0x239c03(0x127)+_0x5c2496[_0x239c03(0x118)]),_0x5c2496['cause']&&console['error'](_0x239c03(0x11d)+_0x5c2496[_0x239c03(0x119)]),0x1;throw _0x5c2496;}}[a39_0x59a2f4(0x12d)](_0x51a1c7){const _0x5a313b=a39_0x59a2f4;if(_0x51a1c7[_0x5a313b(0x113)][_0x5a313b(0x11e)]===0x0)return _0x5a313b(0x130);if(_0x51a1c7['args'][_0x5a313b(0x11e)]>0x1)return _0x5a313b(0x123);return undefined;}}
|
package/dist/commands/tables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a40_0x350797=a40_0x491a;(function(_0x23b81f,_0x55ef68){const _0x2d53fd=a40_0x491a,_0x43ccc3=_0x23b81f();while(!![]){try{const _0x1da778=-parseInt(_0x2d53fd(0x161))/0x1+-parseInt(_0x2d53fd(0x157))/0x2*(-parseInt(_0x2d53fd(0x185))/0x3)+-parseInt(_0x2d53fd(0x167))/0x4*(parseInt(_0x2d53fd(0x16f))/0x5)+parseInt(_0x2d53fd(0x175))/0x6*(-parseInt(_0x2d53fd(0x177))/0x7)+-parseInt(_0x2d53fd(0x171))/0x8*(-parseInt(_0x2d53fd(0x16a))/0x9)+parseInt(_0x2d53fd(0x179))/0xa*(parseInt(_0x2d53fd(0x181))/0xb)+-parseInt(_0x2d53fd(0x174))/0xc*(-parseInt(_0x2d53fd(0x17b))/0xd);if(_0x1da778===_0x55ef68)break;else _0x43ccc3['push'](_0x43ccc3['shift']());}catch(_0x23b062){_0x43ccc3['push'](_0x43ccc3['shift']());}}}(a40_0x380d,0xeec7e));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a40_0x380d(){const _0x5f15f9=['1482SZtgZt','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','verbose','cause','Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27','5765947KfMLZn','name','limit','\x27\x20is\x20ambiguous.','1046802OevprS','Database\x20\x27','query','\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','Table\x20pattern:\x20','4qtVGMH','listTables','Error:\x20Pattern\x20\x27','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','Error:\x20','message','✔\x20Found\x20','includes','Database\x20pattern:\x20','\x20table','993331vSYCQB','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','Or\x20use\x20--in\x20flag:','data','Listing\x20tables...','table','9320PPSJgn','error','\x20\x20Use:\x20tdx\x20tables\x20\x22','198rZQQjY','execute','Note:\x20\x27','\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','1275SRanKH','length','247048ZzzQVN','\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables','.*\x22','61860dwDXtW','171516ZaHHEy','\x27\x20across\x20all\x20databases.','238OoVxQI','database','30bsaBVA','validate'];a40_0x380d=function(){return _0x5f15f9;};return a40_0x380d();}function a40_0x491a(_0x5c8a24,_0x5b302c){_0x5c8a24=_0x5c8a24-0x155;const _0x380da6=a40_0x380d();let _0x491a30=_0x380da6[_0x5c8a24];return _0x491a30;}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{[a40_0x350797(0x182)]='tables';['description']='List\x20tables\x20in\x20a\x20database';async[a40_0x350797(0x16b)](_0x4db11c){const _0x49e753=a40_0x350797,{options:_0x2291f4,args:_0xde8c07,tdx:_0x22e94f}=_0x4db11c;let _0x143b2f;if(_0xde8c07[_0x49e753(0x170)]===0x0)_0x143b2f={'database':undefined,'table':undefined,'original':''};else{if(_0xde8c07[_0x49e753(0x170)]===0x1)try{_0x143b2f=parseTableReference(_0xde8c07[0x0]);if(_0x143b2f['table']&&!_0x143b2f[_0x49e753(0x178)]&&!_0x143b2f[_0x49e753(0x166)]['includes']('*')&&!_0x143b2f[_0x49e753(0x166)][_0x49e753(0x15e)]('?'))return console[_0x49e753(0x168)](_0x49e753(0x159)+_0xde8c07[0x0]+_0x49e753(0x184)),console[_0x49e753(0x168)](_0x49e753(0x180)+_0x143b2f['table']+'\x27?'),console[_0x49e753(0x168)](_0x49e753(0x169)+_0x143b2f[_0x49e753(0x166)]+_0x49e753(0x173)),console[_0x49e753(0x168)](_0x49e753(0x188)+_0x143b2f['table']),console[_0x49e753(0x168)](_0x49e753(0x15a)+_0x143b2f['table']),console[_0x49e753(0x168)](''),console['error'](_0x49e753(0x16c)+_0xde8c07[0x0]+_0x49e753(0x16d)+_0x143b2f['table']+_0x49e753(0x176)),0x1;}catch(_0x1ab5b3){return console[_0x49e753(0x168)](_0x49e753(0x15b)+_0x1ab5b3[_0x49e753(0x15c)]),0x1;}else return console['error'](_0x49e753(0x17c)),console['error'](_0x49e753(0x162)),console[_0x49e753(0x168)](_0x49e753(0x16e)),console[_0x49e753(0x168)]('\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb'),console['error'](_0x49e753(0x17d)),console[_0x49e753(0x168)](_0x49e753(0x163)),console[_0x49e753(0x168)](_0x49e753(0x155)),0x1;}const _0x3b3649=_0x2291f4[_0x49e753(0x178)];!_0x143b2f[_0x49e753(0x178)]&&_0x3b3649&&(_0x143b2f[_0x49e753(0x178)]=_0x3b3649);try{const _0x430c7b=_0x4e7744=>_0x4e7744&&(_0x4e7744[_0x49e753(0x15e)]('*')||_0x4e7744['includes']('?')),_0x543462=_0x430c7b(_0x143b2f[_0x49e753(0x178)]);_0x2291f4[_0x49e753(0x17e)]&&(console[_0x49e753(0x168)]('Site:\x20'+_0x2291f4['site']),_0x143b2f[_0x49e753(0x178)]?_0x543462?console[_0x49e753(0x168)](_0x49e753(0x15f)+_0x143b2f['database']):console[_0x49e753(0x168)]('Database:\x20'+_0x143b2f[_0x49e753(0x178)]):console['error']('Database:\x20all'),_0x143b2f[_0x49e753(0x166)]&&console[_0x49e753(0x168)](_0x49e753(0x156)+_0x143b2f['table']));const _0x1899ed=_0x143b2f[_0x49e753(0x178)]&&!_0x543462?_0x143b2f[_0x49e753(0x178)]:undefined,_0x52523b=_0x543462?_0x143b2f['database']:undefined,_0x4e9cfb=_0x143b2f[_0x49e753(0x166)],_0x2db5ea=resolveLimit(_0x2291f4[_0x49e753(0x183)],DEFAULT_LISTING_LIMIT),_0x3c04ed=await withSpinner(_0x49e753(0x165),()=>_0x22e94f[_0x49e753(0x187)][_0x49e753(0x158)](_0x1899ed,_0x4e9cfb,_0x52523b,_0x2db5ea),{'verbose':_0x2291f4[_0x49e753(0x17e)]}),_0x5333e7=_0x3c04ed[_0x49e753(0x164)];if(_0x5333e7['length']===0x0&&_0x143b2f[_0x49e753(0x178)]&&!_0x543462)return console['error']('✖\x20No\x20tables\x20found'),console[_0x49e753(0x168)](_0x49e753(0x186)+_0x143b2f[_0x49e753(0x178)]+_0x49e753(0x172)),0x1;return console[_0x49e753(0x168)](_0x49e753(0x15d)+_0x5333e7[_0x49e753(0x170)]+_0x49e753(0x160)+(_0x5333e7['length']!==0x1?'s':'')),await handleSDKOutput(_0x5333e7,{..._0x2291f4,'limit':_0x2db5ea}),0x0;}catch(_0x1b317f){if(_0x1b317f instanceof SDKError)return console[_0x49e753(0x168)]('Error:\x20'+_0x1b317f['message']),_0x1b317f[_0x49e753(0x17f)]&&console[_0x49e753(0x168)]('\x20\x20Cause:\x20'+_0x1b317f['cause']),0x1;throw _0x1b317f;}}[a40_0x350797(0x17a)](_0x5d2949){return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x3597b7=a41_0x3ecc;(function(_0x4c7ce0,_0x426994){const _0x397451=a41_0x3ecc,_0x5dfa11=_0x4c7ce0();while(!![]){try{const _0x1f5700=-parseInt(_0x397451(0x13a))/0x1+-parseInt(_0x397451(0x145))/0x2*(parseInt(_0x397451(0x121))/0x3)+parseInt(_0x397451(0x120))/0x4+parseInt(_0x397451(0x133))/0x5+parseInt(_0x397451(0x137))/0x6+parseInt(_0x397451(0x12c))/0x7*(-parseInt(_0x397451(0x11d))/0x8)+parseInt(_0x397451(0x13c))/0x9;if(_0x1f5700===_0x426994)break;else _0x5dfa11['push'](_0x5dfa11['shift']());}catch(_0x1d33f7){_0x5dfa11['push'](_0x5dfa11['shift']());}}}(a41_0x3d16,0xdf6a9));function a41_0x3ecc(_0x570604,_0x553bf2){_0x570604=_0x570604-0x115;const _0x3d1628=a41_0x3d16();let _0x3ecc03=_0x3d1628[_0x570604];return _0x3ecc03;}import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';function a41_0x3d16(){const _0x50a0ca=['error','Error:\x20','3088351zJnhcq','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','parent_segment','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace','database','Set\x20session-level\x20context','debug','1537175shlOBh','cleared','validate','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','23526gqDYUb','name','.\x20Must\x20be\x20one\x20of:\x20','1656452FWjJHF','session','29903652JbAyUE','\x27\x20does\x20not\x20exist','green','display','(session:\x20','profile','toString','Session\x20context\x20','\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','2752476KBDmPO','log','includes','Session\x20parent_segment\x20set\x20to:\x20','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','displayWithSources','dim','Session\x20database\x20set\x20to:\x20','engage_workspace','8ZeJVET','use','length','3020048hsykBa','3GRQQpB','Session\x20llm_project\x20set\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','message','description','Session\x20engage_workspace\x20set\x20to:\x20','Session\x20profile\x20set\x20to:\x20','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','llm_project'];a41_0x3d16=function(){return _0x50a0ca;};return a41_0x3d16();}import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import a41_0x12186b from'chalk';export class UseCommand extends BaseCommand{[a41_0x3597b7(0x138)]=a41_0x3597b7(0x11e);[a41_0x3597b7(0x125)]=a41_0x3597b7(0x131);[a41_0x3597b7(0x135)](_0x4d1702){const _0x417844=a41_0x3597b7,{args:_0x410b7d}=_0x4d1702;if(_0x410b7d[_0x417844(0x11f)]===0x0)return undefined;if(_0x410b7d['length']===0x1)return'Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a'+_0x417844(0x144)+_0x417844(0x123)+'\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace\x0a'+_0x417844(0x128);const _0x58eebc=_0x410b7d[0x0],_0x3d5f67=[_0x417844(0x130),_0x417844(0x12e),_0x417844(0x129),_0x417844(0x141),_0x417844(0x11c)];if(!_0x3d5f67[_0x417844(0x116)](_0x58eebc))return'Invalid\x20resource:\x20'+_0x58eebc+_0x417844(0x139)+_0x3d5f67['join'](',\x20');return undefined;}async['execute'](_0x171dd2){const _0x9b1566=a41_0x3597b7,{args:_0x5bcef6,options:_0x123bcf}=_0x171dd2,_0x3de691=_0x123bcf[_0x9b1566(0x132)],_0x277fee=_0x123bcf['clear'];cleanExpiredSessions();try{if(_0x277fee){clearSessionContext(_0x123bcf[_0x9b1566(0x13b)]);const _0x2f0dfe=_0x123bcf[_0x9b1566(0x13b)]||getCurrentSessionPID()[_0x9b1566(0x142)]();return console[_0x9b1566(0x115)](_0x9b1566(0x143)+a41_0x12186b[_0x9b1566(0x13e)](_0x9b1566(0x134))+'\x20'+a41_0x12186b[_0x9b1566(0x11a)]('(session:\x20'+_0x2f0dfe+')')),0x0;}if(_0x5bcef6[_0x9b1566(0x11f)]===0x0){const _0x875a3=new GlobalContext(_0x123bcf);return _0x3de691?_0x875a3[_0x9b1566(0x119)]():_0x875a3[_0x9b1566(0x13f)](),console[_0x9b1566(0x115)](a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x12d))),console[_0x9b1566(0x115)](a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x12f))),0x0;}const _0x3921ff=_0x5bcef6[0x0],_0xfb39a8=_0x5bcef6[0x1];if(_0x3921ff===_0x9b1566(0x141)){if(!profileExists(_0xfb39a8))return console['error']('Error:\x20Profile\x20\x27'+_0xfb39a8+_0x9b1566(0x13d)),console[_0x9b1566(0x12a)](_0x9b1566(0x118)),0x1;const _0x31629b=_0x123bcf['session']||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0xfb39a8},_0x123bcf[_0x9b1566(0x13b)]),console[_0x9b1566(0x115)](_0x9b1566(0x127)+a41_0x12186b[_0x9b1566(0x13e)](_0xfb39a8)+'\x20'+a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x140)+_0x31629b+')')),console['log'](a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x136))),0x0;}const _0xbec0bd={},_0x13367a=_0x123bcf[_0x9b1566(0x13b)]||getCurrentSessionPID()[_0x9b1566(0x142)]();switch(_0x3921ff){case'database':_0xbec0bd[_0x9b1566(0x130)]=_0xfb39a8,console['log'](_0x9b1566(0x11b)+a41_0x12186b[_0x9b1566(0x13e)](_0xfb39a8)+'\x20'+a41_0x12186b[_0x9b1566(0x11a)]('(session:\x20'+_0x13367a+')'));break;case _0x9b1566(0x12e):_0xbec0bd[_0x9b1566(0x12e)]=_0xfb39a8,console[_0x9b1566(0x115)](_0x9b1566(0x117)+a41_0x12186b[_0x9b1566(0x13e)](_0xfb39a8)+'\x20'+a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x140)+_0x13367a+')'));break;case _0x9b1566(0x129):_0xbec0bd[_0x9b1566(0x129)]=_0xfb39a8,console['log'](_0x9b1566(0x122)+a41_0x12186b[_0x9b1566(0x13e)](_0xfb39a8)+'\x20'+a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x140)+_0x13367a+')'));break;case'engage_workspace':_0xbec0bd[_0x9b1566(0x11c)]=_0xfb39a8,console['log'](_0x9b1566(0x126)+a41_0x12186b['green'](_0xfb39a8)+'\x20'+a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x140)+_0x13367a+')'));break;}return saveSessionContext(_0xbec0bd,_0x123bcf['session']),console[_0x9b1566(0x115)](a41_0x12186b[_0x9b1566(0x11a)](_0x9b1566(0x136))),0x0;}catch(_0x25ef31){return _0x25ef31 instanceof Error&&console[_0x9b1566(0x12a)](_0x9b1566(0x12b)+_0x25ef31[_0x9b1566(0x124)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x52ef73=a42_0x119a;(function(_0xecfd95,_0x5e2606){const _0x18d0fd=a42_0x119a,_0x47bec7=_0xecfd95();while(!![]){try{const _0x34f5a6=-parseInt(_0x18d0fd(0x99))/0x1+-parseInt(_0x18d0fd(0x89))/0x2*(-parseInt(_0x18d0fd(0x8f))/0x3)+parseInt(_0x18d0fd(0xa2))/0x4*(parseInt(_0x18d0fd(0x9f))/0x5)+parseInt(_0x18d0fd(0x9c))/0x6*(-parseInt(_0x18d0fd(0x8a))/0x7)+parseInt(_0x18d0fd(0x8c))/0x8+-parseInt(_0x18d0fd(0x90))/0x9+parseInt(_0x18d0fd(0x8d))/0xa;if(_0x34f5a6===_0x5e2606)break;else _0x47bec7['push'](_0x47bec7['shift']());}catch(_0x5ccef6){_0x47bec7['push'](_0x47bec7['shift']());}}}(a42_0x5a9d,0x80bd0));function a42_0x119a(_0x119700,_0xcd57d3){_0x119700=_0x119700-0x89;const _0x5a9dd6=a42_0x5a9d();let _0x119a22=_0x5a9dd6[_0x119700];return _0x119a22;}function a42_0x5a9d(){const _0x2c43c4=['\x20\x20Cause:\x20','List\x20all\x20users\x20in\x20the\x20account','Show\x20current\x20user\x20information','Listing\x20users...','Error:\x20','data','length','user','717791ehKNgo','✔\x20Found\x20','cause','402xPOraG','error','description','40505HAvvmx','user\x20list','message','116UZuBgE','name','getCurrent','2010lCmFZK','20363SrpdKr','verbose','840880ESWtuA','14618870stXoMv','execute','1920FJGdpC','9046080HZhMAB'];a42_0x5a9d=function(){return _0x2c43c4;};return a42_0x5a9d();}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{[a42_0x52ef73(0xa3)]=a42_0x52ef73(0x98);[a42_0x52ef73(0x9e)]=a42_0x52ef73(0x93);async[a42_0x52ef73(0x8e)](_0x397f0e){const _0x14c98=a42_0x52ef73,{options:_0x4f8b9c,tdx:_0x5187b9}=_0x397f0e;try{const _0x2caa33=await withSpinner('Fetching\x20user\x20info...',()=>_0x5187b9[_0x14c98(0x98)][_0x14c98(0xa4)](),{'verbose':_0x4f8b9c[_0x14c98(0x8b)]}),_0xdcc789=_0x2caa33[_0x14c98(0x96)];return await handleSingleObjectOutput(_0xdcc789,_0x4f8b9c),0x0;}catch(_0x8d047f){if(_0x8d047f instanceof SDKError)return console[_0x14c98(0x9d)](_0x14c98(0x95)+_0x8d047f[_0x14c98(0xa1)]),_0x8d047f[_0x14c98(0x9b)]&&console[_0x14c98(0x9d)](_0x14c98(0x91)+_0x8d047f['cause']),0x1;throw _0x8d047f;}}}export class UserListCommand extends BaseCommand{['name']=a42_0x52ef73(0xa0);[a42_0x52ef73(0x9e)]=a42_0x52ef73(0x92);async[a42_0x52ef73(0x8e)](_0x38bd1b){const _0x19dfad=a42_0x52ef73,{options:_0x2268e3,tdx:_0x17221d}=_0x38bd1b;try{const _0x18e0d5=await withSpinner(_0x19dfad(0x94),()=>_0x17221d['user']['list'](),{'verbose':_0x2268e3['verbose']}),_0x4be6db=_0x18e0d5['data'];return console[_0x19dfad(0x9d)](_0x19dfad(0x9a)+_0x4be6db[_0x19dfad(0x97)]+'\x20user'+(_0x4be6db['length']!==0x1?'s':'')),await handleSDKOutput(_0x4be6db,_0x2268e3),0x0;}catch(_0x310c03){if(_0x310c03 instanceof SDKError)return console['error'](_0x19dfad(0x95)+_0x310c03['message']),_0x310c03[_0x19dfad(0x9b)]&&console[_0x19dfad(0x9d)](_0x19dfad(0x91)+_0x310c03['cause']),0x1;throw _0x310c03;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a43_0x5c4b(_0xe275ca,_0x22f322){_0xe275ca=_0xe275ca-0x165;const _0x2830a4=a43_0x2830();let _0x5c4b91=_0x2830a4[_0xe275ca];return _0x5c4b91;}const a43_0x5f26a1=a43_0x5c4b;function a43_0x2830(){const _0x49bc2c=['workflow:attempts','session:','Downloading\x20project\x20','✔\x20Downloaded\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','keys','✔\x20Pushed\x20','taskName','fs/promises','attemptId','description','includeRetried','\x20\x20Session\x20ID:\x20','sessions','json','Validation:\x20skipped','cause','Start\x20a\x20workflow\x20run','utf-8','Output\x20directory:\x20','Killing\x20attempt...','length','Expected\x20format:\x20--param\x20key=value','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','run','Error:\x20Invalid\x20JSON\x20in\x20--params','Listing\x20workflow\x20attempts...','split','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Error:\x20Invalid\x20parameter\x20format:\x20','indexOf','Error:\x20Attempt\x20ID\x20is\x20required','Including\x20subtasks:\x20yes','select','Session\x20time:\x20','\x22?\x20This\x20cannot\x20be\x20undone.','retryAttemptName','Include\x20retried:\x20yes','index','workflows','Listing\x20workflow\x20sessions...','attempt','8418MXbVwZ','\x20session','Kill\x20a\x20running\x20attempt','cancelRequested','yes','message','Getting\x20attempt\x20details...','execute','List\x20workflow\x20attempts','Starting\x20workflow\x20run...','substring','name','\x20project','projectName','delete','error','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Downloading\x20logs...','skipValidation','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','\x20\x20New\x20attempt\x20ID:\x20','projectId','282pnbZSA','data','success','isDirectory','List\x20all\x20workflow\x20projects','✔\x20Retry\x20started','project','\x20\x20Project\x20ID:\x20','fromTask','Workflow:\x20','workflow:attempt','Attempt\x20ID:\x20','tasks','✔\x20Deleted\x20project\x20','limit','session','attempts','revision','Project:\x20','sessionId','params','\x20\x20Revision:\x20','340AndLOq','fileSize','sessionTime','Filter:\x20project=','\x20is\x20not\x20a\x20directory','Cancelled','workflow:workflows','7864yTYYBa','No\x20log\x20files\x20found\x20for\x20this\x20attempt','createdAt','6798300WyKwoR','workflow:download','map','status','from','14keMlDe','workflow:kill','35226LjRbCc','5929ZYHYfg','includeSubtasks','Params:\x20','\x20\x20Location:\x20','startsWith','Error:\x20','Reason:\x20','verbose','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Fetching\x20log\x20files...','parse','Pattern:\x20','Status:\x20','resumeFrom','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','workflow:tasks','retrySession','Select\x20a\x20task\x20to\x20view\x20logs:','Project\x20directory:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow','Pushing\x20workflow\x20project...','finishedAt','Usage:\x20workflow:delete\x20<project-name-or-id>','Retrying\x20attempt...','log','canceling','Error:\x20Workflow\x20identifier\x20is\x20required','workflow:delete','isArray','\x20attempt','Deleting\x20project\x20','\x20workflow','attempt:','logs','✔\x20Found\x20','15646455OOQorD','From\x20task:\x20','Filter:\x20','Show\x20specific\x20attempt\x20details','List\x20workflows','reason','task','\x20\x20Attempt\x20ID:\x20','7834473ouULfN','getTime','readFile','logFiles','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','retryAttempt','...','force','\x20task','\x20\x20Cause:\x20','Target:\x20','115740pnsAQT','Project\x20name:\x20','Error:\x20Project\x20name\x20is\x20required','Retrying\x20session...'];a43_0x2830=function(){return _0x49bc2c;};return a43_0x2830();}(function(_0x2f833d,_0xa5914){const _0x16a45e=a43_0x5c4b,_0x51cbce=_0x2f833d();while(!![]){try{const _0x4654de=-parseInt(_0x16a45e(0x1da))/0x1*(-parseInt(_0x16a45e(0x19f))/0x2)+-parseInt(_0x16a45e(0x1dc))/0x3*(parseInt(_0x16a45e(0x1cb))/0x4)+parseInt(_0x16a45e(0x171))/0x5*(parseInt(_0x16a45e(0x1b5))/0x6)+parseInt(_0x16a45e(0x1dd))/0x7*(-parseInt(_0x16a45e(0x1d2))/0x8)+-parseInt(_0x16a45e(0x166))/0x9+parseInt(_0x16a45e(0x1d5))/0xa+parseInt(_0x16a45e(0x201))/0xb;if(_0x4654de===_0xa5914)break;else _0x51cbce['push'](_0x51cbce['shift']());}catch(_0x2875d7){_0x51cbce['push'](_0x51cbce['shift']());}}}(a43_0x2830,0x85c6d));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_0x2c8fc3 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']='workflow:projects';[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x1b9);async[a43_0x5f26a1(0x1a6)](_0x40135b){const _0x14c519=a43_0x5f26a1,{options:_0x5772ef,args:_0x4ffc64,tdx:_0x1bdc8c}=_0x40135b,_0x214a64=_0x4ffc64[0x0];try{_0x5772ef[_0x14c519(0x1e4)]&&_0x214a64&&console['error'](_0x14c519(0x1e8)+_0x214a64);const _0x2ff075=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x1bdc8c['workflow']['projects'](_0x214a64,{'limit':_0x5772ef[_0x14c519(0x1c3)]}),{'verbose':_0x5772ef[_0x14c519(0x1e4)]}),_0x38b010=_0x2ff075[_0x14c519(0x1b6)];return console[_0x14c519(0x1ae)]('✔\x20Found\x20'+_0x38b010[_0x14c519(0x18a)]+_0x14c519(0x1ab)+(_0x38b010[_0x14c519(0x18a)]!==0x1?'s':'')),await handleSDKOutput(_0x38b010,_0x5772ef),0x0;}catch(_0x4c3cbc){if(_0x4c3cbc instanceof SDKError)return console['error'](_0x14c519(0x1e2)+_0x4c3cbc[_0x14c519(0x1a4)]),_0x4c3cbc[_0x14c519(0x185)]&&console[_0x14c519(0x1ae)]('\x20\x20Cause:\x20'+_0x4c3cbc['cause']),0x1;throw _0x4c3cbc;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x1d1);[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x205);async[a43_0x5f26a1(0x1a6)](_0x461be9){const _0x57b990=a43_0x5f26a1,{options:_0x5ce71d,args:_0x21d511,tdx:_0x4568ff}=_0x461be9,_0x35343c=_0x21d511[0x0];try{_0x5ce71d[_0x57b990(0x1e4)]&&_0x35343c&&console['error']('Project\x20filter:\x20'+_0x35343c);const _0x484616=await withSpinner('Listing\x20workflows...',()=>_0x4568ff[_0x57b990(0x1f1)][_0x57b990(0x19c)](_0x35343c,{'limit':_0x5ce71d[_0x57b990(0x1c3)]}),{'verbose':_0x5ce71d[_0x57b990(0x1e4)]}),_0x2aaa6c=_0x484616[_0x57b990(0x1b6)];return console['error']('✔\x20Found\x20'+_0x2aaa6c['length']+_0x57b990(0x1fd)+(_0x2aaa6c[_0x57b990(0x18a)]!==0x1?'s':'')),await handleSDKOutput(_0x2aaa6c,_0x5ce71d),0x0;}catch(_0x1d49ed){if(_0x1d49ed instanceof SDKError)return console[_0x57b990(0x1ae)](_0x57b990(0x1e2)+_0x1d49ed[_0x57b990(0x1a4)]),_0x1d49ed[_0x57b990(0x185)]&&console[_0x57b990(0x1ae)](_0x57b990(0x16f)+_0x1d49ed[_0x57b990(0x185)]),0x1;throw _0x1d49ed;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]='workflow:sessions';[a43_0x5f26a1(0x17f)]='List\x20workflow\x20execution\x20sessions';async[a43_0x5f26a1(0x1a6)](_0x5a7ef4){const _0x4c8dde=a43_0x5f26a1,{options:_0x5b659e,args:_0x244680,tdx:_0x4d2aaa}=_0x5a7ef4;let _0x1db277,_0xa4f03a;if(_0x244680[0x0]){const _0x1675ac=_0x244680[0x0][_0x4c8dde(0x190)]('.');if(_0x1675ac[_0x4c8dde(0x18a)]===0x1)_0x1db277=_0x1675ac[0x0];else{if(_0x1675ac[_0x4c8dde(0x18a)]===0x2)[_0x1db277,_0xa4f03a]=_0x1675ac;else return console[_0x4c8dde(0x1ae)](_0x4c8dde(0x1af)),0x1;}}try{if(_0x5b659e[_0x4c8dde(0x1e4)]){if(_0x1db277&&_0xa4f03a)console[_0x4c8dde(0x1ae)](_0x4c8dde(0x203)+_0x1db277+'.'+_0xa4f03a);else _0x1db277&&console['error'](_0x4c8dde(0x1ce)+_0x1db277);const _0x319590=_0x5b659e[_0x4c8dde(0x1d8)];_0x319590&&console[_0x4c8dde(0x1ae)](_0x4c8dde(0x1e9)+_0x319590);}const _0x35eb5f=await withSpinner(_0x4c8dde(0x19d),()=>_0x4d2aaa[_0x4c8dde(0x1f1)][_0x4c8dde(0x182)]({'projectName':_0x1db277,'workflowName':_0xa4f03a,'status':_0x5b659e[_0x4c8dde(0x1d8)],'fromTime':_0x5b659e[_0x4c8dde(0x1d9)],'toTime':_0x5b659e['to'],'limit':_0x5b659e[_0x4c8dde(0x1c3)]}),{'verbose':_0x5b659e[_0x4c8dde(0x1e4)]}),_0x26737d=_0x35eb5f[_0x4c8dde(0x1b6)];return console[_0x4c8dde(0x1ae)](_0x4c8dde(0x200)+_0x26737d[_0x4c8dde(0x18a)]+_0x4c8dde(0x1a0)+(_0x26737d['length']!==0x1?'s':'')),await handleSDKOutput(_0x26737d,_0x5b659e),0x0;}catch(_0x20bc85){if(_0x20bc85 instanceof SDKError)return console['error']('Error:\x20'+_0x20bc85[_0x4c8dde(0x1a4)]),_0x20bc85[_0x4c8dde(0x185)]&&console[_0x4c8dde(0x1ae)](_0x4c8dde(0x16f)+_0x20bc85[_0x4c8dde(0x185)]),0x1;throw _0x20bc85;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x175);['description']=a43_0x5f26a1(0x1a7);async[a43_0x5f26a1(0x1a6)](_0x3c5212){const _0x1b7485=a43_0x5f26a1,{options:_0x5cdffd,args:_0x23d2cd,tdx:_0x4958dc}=_0x3c5212;let _0x2dd097,_0x497702;if(_0x23d2cd[0x0]){const _0x465813=_0x23d2cd[0x0][_0x1b7485(0x190)]('.');if(_0x465813[_0x1b7485(0x18a)]===0x1)_0x2dd097=_0x465813[0x0];else{if(_0x465813[_0x1b7485(0x18a)]===0x2)[_0x2dd097,_0x497702]=_0x465813;else return console[_0x1b7485(0x1ae)](_0x1b7485(0x1af)),0x1;}}try{const _0x175afc=_0x5cdffd[_0x1b7485(0x180)];if(_0x5cdffd['verbose']){if(_0x2dd097&&_0x497702)console['error']('Filter:\x20'+_0x2dd097+'.'+_0x497702);else _0x2dd097&&console[_0x1b7485(0x1ae)]('Filter:\x20project='+_0x2dd097);_0x175afc&&console[_0x1b7485(0x1ae)](_0x1b7485(0x19a));}const _0x490d1b=await withSpinner(_0x1b7485(0x18f),()=>_0x4958dc[_0x1b7485(0x1f1)][_0x1b7485(0x1c5)]({'projectName':_0x2dd097,'workflowName':_0x497702,'includeRetried':_0x175afc,'limit':_0x5cdffd[_0x1b7485(0x1c3)]}),{'verbose':_0x5cdffd[_0x1b7485(0x1e4)]}),_0x562e23=_0x490d1b[_0x1b7485(0x1b6)];return console['error'](_0x1b7485(0x200)+_0x562e23[_0x1b7485(0x18a)]+_0x1b7485(0x1fb)+(_0x562e23[_0x1b7485(0x18a)]!==0x1?'s':'')),await handleSDKOutput(_0x562e23,_0x5cdffd),0x0;}catch(_0x1b896f){if(_0x1b896f instanceof SDKError)return console[_0x1b7485(0x1ae)]('Error:\x20'+_0x1b896f['message']),_0x1b896f[_0x1b7485(0x185)]&&console[_0x1b7485(0x1ae)](_0x1b7485(0x16f)+_0x1b896f[_0x1b7485(0x185)]),0x1;throw _0x1b896f;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x1bf);[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x204);async[a43_0x5f26a1(0x1a6)](_0x24f4cd){const _0x20b299=a43_0x5f26a1,{options:_0x4fbc45,args:_0x5dea80,tdx:_0x3d46db}=_0x24f4cd,_0xcb8b1c=_0x5dea80[0x0];if(!_0xcb8b1c)return console[_0x20b299(0x1ae)](_0x20b299(0x194)),0x1;try{_0x4fbc45['verbose']&&console[_0x20b299(0x1ae)](_0x20b299(0x1c0)+_0xcb8b1c);const _0x822f96=await withSpinner(_0x20b299(0x1a5),()=>_0x3d46db['workflow'][_0x20b299(0x19e)](_0xcb8b1c),{'verbose':_0x4fbc45[_0x20b299(0x1e4)]}),_0x2802a7=_0x822f96[_0x20b299(0x1b6)];let _0xac40be;!_0x2802a7['done']?_0xac40be=_0x2802a7[_0x20b299(0x1a2)]?_0x20b299(0x1f7):'running':_0xac40be=_0x2802a7[_0x20b299(0x1b7)]?_0x20b299(0x1b7):_0x20b299(0x1ae);let _0x286cdb;if(_0x2802a7[_0x20b299(0x1d4)]&&_0x2802a7[_0x20b299(0x1f3)]){const _0x1d1a44=new Date(_0x2802a7[_0x20b299(0x1d4)])[_0x20b299(0x167)](),_0x11c358=new Date(_0x2802a7['finishedAt'])[_0x20b299(0x167)]();_0x286cdb=Math['round']((_0x11c358-_0x1d1a44)/0x3e8);}const _0xad9bd2={'attempt_id':_0x2802a7['id'],'status':_0xac40be,..._0x2802a7[_0x20b299(0x19b)]!==undefined&&{'index':_0x2802a7[_0x20b299(0x19b)]},..._0x2802a7[_0x20b299(0x1bb)]&&{'project':_0x2802a7[_0x20b299(0x1bb)]['name']},..._0x2802a7[_0x20b299(0x1f1)]&&{'workflow':_0x2802a7['workflow']['name']},..._0x2802a7['sessionId']&&{'session_id':_0x2802a7['sessionId']},..._0x2802a7[_0x20b299(0x1cd)]&&{'session_time':_0x2802a7[_0x20b299(0x1cd)]},..._0x2802a7[_0x20b299(0x199)]&&{'retry_attempt':_0x2802a7[_0x20b299(0x199)]},..._0x286cdb!==undefined&&{'duration_sec':_0x286cdb},..._0x2802a7[_0x20b299(0x1d4)]&&{'created_at':_0x2802a7['createdAt']},..._0x2802a7[_0x20b299(0x1f3)]&&{'finished_at':_0x2802a7[_0x20b299(0x1f3)]},...Object[_0x20b299(0x17a)](_0x2802a7['params'])[_0x20b299(0x18a)]>0x0&&{'params':_0x2802a7['params']}};return await handleSingleObjectOutput(_0xad9bd2,_0x4fbc45),0x0;}catch(_0x50817a){if(_0x50817a instanceof SDKError)return console[_0x20b299(0x1ae)]('Error:\x20'+_0x50817a['message']),_0x50817a[_0x20b299(0x185)]&&console[_0x20b299(0x1ae)](_0x20b299(0x16f)+_0x50817a[_0x20b299(0x185)]),0x1;throw _0x50817a;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x1ec);[a43_0x5f26a1(0x17f)]='Show\x20tasks\x20for\x20an\x20attempt';async[a43_0x5f26a1(0x1a6)](_0x26967d){const _0x2114cd=a43_0x5f26a1,{options:_0x5b5d46,args:_0x58941f,tdx:_0x21434a}=_0x26967d,_0x4314d9=_0x58941f[0x0];if(!_0x4314d9)return console[_0x2114cd(0x1ae)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x3a6804=_0x5b5d46[_0x2114cd(0x1de)];_0x5b5d46[_0x2114cd(0x1e4)]&&(console[_0x2114cd(0x1ae)](_0x2114cd(0x1c0)+_0x4314d9),_0x3a6804&&console[_0x2114cd(0x1ae)](_0x2114cd(0x195)));const _0x5ef723=await withSpinner('Getting\x20attempt\x20tasks...',()=>_0x21434a[_0x2114cd(0x1f1)][_0x2114cd(0x1c1)](_0x4314d9,_0x3a6804||![]),{'verbose':_0x5b5d46[_0x2114cd(0x1e4)]}),_0x34fffa=_0x5ef723['data'];return console['error'](_0x2114cd(0x200)+_0x34fffa[_0x2114cd(0x18a)]+_0x2114cd(0x16e)+(_0x34fffa[_0x2114cd(0x18a)]!==0x1?'s':'')),await handleSDKOutput(_0x34fffa,_0x5b5d46),0x0;}catch(_0xedcfc0){if(_0xedcfc0 instanceof SDKError)return console[_0x2114cd(0x1ae)]('Error:\x20'+_0xedcfc0[_0x2114cd(0x1a4)]),_0xedcfc0['cause']&&console[_0x2114cd(0x1ae)](_0x2114cd(0x16f)+_0xedcfc0['cause']),0x1;throw _0xedcfc0;}}}export class WorkflowLogsCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]='workflow:logs';[a43_0x5f26a1(0x17f)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x5f26a1(0x1a6)](_0x480f97){const _0xb65a70=a43_0x5f26a1,{options:_0x53189d,args:_0x327f28,tdx:_0x3f50e0}=_0x480f97,_0x59425c=_0x327f28[0x0];let _0x25d0f1=_0x327f28[0x1];if(!_0x59425c)return console[_0xb65a70(0x1ae)](_0xb65a70(0x194)),0x1;try{_0x53189d['verbose']&&(console[_0xb65a70(0x1ae)]('Attempt\x20ID:\x20'+_0x59425c),_0x25d0f1&&console[_0xb65a70(0x1ae)]('Task\x20name:\x20'+_0x25d0f1));const _0x4ff6f7=await withSpinner(_0xb65a70(0x1e6),()=>_0x3f50e0[_0xb65a70(0x1f1)][_0xb65a70(0x169)](_0x59425c,_0x25d0f1),{'verbose':_0x53189d[_0xb65a70(0x1e4)]}),_0x116d3e=_0x4ff6f7['data'];if(_0x116d3e['length']===0x0)return console['error'](_0xb65a70(0x1d3)),0x0;if(!_0x25d0f1&&(_0x53189d[_0xb65a70(0x183)]||_0x53189d['format']))return await handleSDKOutput(_0x116d3e,_0x53189d),0x0;if(!_0x25d0f1){const _0x232c90=_0x116d3e[_0xb65a70(0x1d7)](_0x16c960=>({'title':_0x16c960[_0xb65a70(0x17c)]+'\x20('+formatBytes(_0x16c960[_0xb65a70(0x1cc)])+')','value':_0x16c960[_0xb65a70(0x17c)]})),_0x54e0ac=await a43_0x2c8fc3({'type':_0xb65a70(0x196),'name':_0xb65a70(0x207),'message':_0xb65a70(0x1ee),'choices':_0x232c90});if(!_0x54e0ac[_0xb65a70(0x207)])return console[_0xb65a70(0x1ae)](_0xb65a70(0x1d0)),0x0;_0x25d0f1=_0x54e0ac[_0xb65a70(0x207)];}const _0x2dd4c9=await withSpinner(_0xb65a70(0x1b0),()=>_0x3f50e0[_0xb65a70(0x1f1)][_0xb65a70(0x1ff)](_0x59425c,_0x25d0f1),{'verbose':_0x53189d[_0xb65a70(0x1e4)]}),_0x5423bf=_0x2dd4c9[_0xb65a70(0x1b6)];return _0x5423bf?console[_0xb65a70(0x1f6)](_0x5423bf):console[_0xb65a70(0x1ae)]('No\x20log\x20content\x20found'),0x0;}catch(_0x3ce006){if(_0x3ce006 instanceof SDKError)return console[_0xb65a70(0x1ae)](_0xb65a70(0x1e2)+_0x3ce006[_0xb65a70(0x1a4)]),_0x3ce006[_0xb65a70(0x185)]&&console[_0xb65a70(0x1ae)](_0xb65a70(0x16f)+_0x3ce006[_0xb65a70(0x185)]),0x1;throw _0x3ce006;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x1db);['description']=a43_0x5f26a1(0x1a1);async[a43_0x5f26a1(0x1a6)](_0xfffaa4){const _0x20cdf1=a43_0x5f26a1,{options:_0x2e016a,args:_0x550dab,tdx:_0x19d649}=_0xfffaa4,_0x169a1c=_0x550dab[0x0];if(!_0x169a1c)return console[_0x20cdf1(0x1ae)](_0x20cdf1(0x194)),0x1;try{const _0x50cfed=_0x2e016a[_0x20cdf1(0x206)];_0x2e016a[_0x20cdf1(0x1e4)]&&(console[_0x20cdf1(0x1ae)](_0x20cdf1(0x1c0)+_0x169a1c),_0x50cfed&&console[_0x20cdf1(0x1ae)](_0x20cdf1(0x1e3)+_0x50cfed));if(!_0x2e016a[_0x20cdf1(0x1a3)]){const _0x4d20e1=await confirm(_0x20cdf1(0x179)+_0x169a1c+'?');if(!_0x4d20e1)return console[_0x20cdf1(0x1ae)](_0x20cdf1(0x1d0)),0x0;}const _0x56bc95=await withSpinner(_0x20cdf1(0x189),()=>_0x19d649['workflow']['kill'](_0x169a1c,_0x50cfed),{'verbose':_0x2e016a['verbose']}),_0x131d7f=_0x56bc95[_0x20cdf1(0x1b6)];return console[_0x20cdf1(0x1ae)]('✔\x20'+_0x131d7f),0x0;}catch(_0x1be7d1){if(_0x1be7d1 instanceof SDKError)return console['error'](_0x20cdf1(0x1e2)+_0x1be7d1['message']),_0x1be7d1[_0x20cdf1(0x185)]&&console[_0x20cdf1(0x1ae)]('\x20\x20Cause:\x20'+_0x1be7d1['cause']),0x1;throw _0x1be7d1;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]='workflow:retry';['description']='Retry\x20a\x20session\x20or\x20attempt';async['execute'](_0x4e024c){const _0x111467=a43_0x5f26a1,{options:_0x44d907,args:_0x545da1,tdx:_0x50de7d}=_0x4e024c,_0x499be7=_0x545da1[0x0];if(!_0x499be7)return console[_0x111467(0x1ae)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x111467(0x1ae)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x3af654=![],_0x5763da=_0x499be7;if(_0x499be7[_0x111467(0x1e1)](_0x111467(0x176)))_0x3af654=!![],_0x5763da=_0x499be7[_0x111467(0x1a9)](0x8);else{if(_0x499be7[_0x111467(0x1e1)](_0x111467(0x1fe)))_0x3af654=![],_0x5763da=_0x499be7[_0x111467(0x1a9)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x111467(0x1ae)](_0x111467(0x1b2)),0x1;}try{const _0x21d1eb=_0x44d907[_0x111467(0x1bd)],_0x280766=_0x44d907[_0x111467(0x1ea)],_0x40497f=_0x44d907[_0x111467(0x1c9)],_0x5334d9=_0x44d907[_0x111467(0x16d)];_0x44d907[_0x111467(0x1e4)]&&(console[_0x111467(0x1ae)](_0x111467(0x170)+(_0x3af654?_0x111467(0x1c4):'attempt')+'\x20'+_0x5763da),_0x21d1eb&&console[_0x111467(0x1ae)](_0x111467(0x202)+_0x21d1eb),_0x280766&&console[_0x111467(0x1ae)]('Resume\x20from:\x20'+_0x280766),_0x40497f&&console[_0x111467(0x1ae)](_0x111467(0x1df)+_0x40497f),_0x5334d9&&console[_0x111467(0x1ae)]('Force:\x20yes'));let _0xc49fec;if(_0x40497f)try{if(_0x40497f[_0x111467(0x1e1)]('@')){const _0x24d842=await import(_0x111467(0x17d)),_0x4d6fcb=_0x40497f[_0x111467(0x1a9)](0x1),_0x357b0e=await _0x24d842[_0x111467(0x168)](_0x4d6fcb,_0x111467(0x187));_0xc49fec=JSON[_0x111467(0x1e7)](_0x357b0e);}else _0xc49fec=JSON[_0x111467(0x1e7)](_0x40497f);}catch{return console[_0x111467(0x1ae)](_0x111467(0x18e)),0x1;}if(!_0x44d907[_0x111467(0x1a3)]){const _0x1ef33f=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x3af654?'session':_0x111467(0x19e))+'\x20'+_0x5763da+'?');if(!_0x1ef33f)return console[_0x111467(0x1ae)](_0x111467(0x1d0)),0x0;}let _0x159ac7;_0x3af654?_0x159ac7=await withSpinner(_0x111467(0x174),()=>_0x50de7d[_0x111467(0x1f1)][_0x111467(0x1ed)](_0x5763da,{'fromTask':_0x21d1eb,'retryParams':_0xc49fec}),{'verbose':_0x44d907[_0x111467(0x1e4)]}):_0x159ac7=await withSpinner(_0x111467(0x1f5),()=>_0x50de7d['workflow'][_0x111467(0x16b)](_0x5763da,{'resumeFrom':_0x280766,'retryParams':_0xc49fec,'force':_0x5334d9}),{'verbose':_0x44d907['verbose']});const _0x244074=_0x159ac7[_0x111467(0x1b6)];return console['error'](_0x111467(0x1ba)),console[_0x111467(0x1ae)](_0x111467(0x1b3)+_0x244074[_0x111467(0x17e)]),console[_0x111467(0x1ae)](_0x111467(0x181)+_0x244074[_0x111467(0x1c8)]),0x0;}catch(_0x4b6bf8){if(_0x4b6bf8 instanceof SDKError)return console['error'](_0x111467(0x1e2)+_0x4b6bf8[_0x111467(0x1a4)]),_0x4b6bf8[_0x111467(0x185)]&&console[_0x111467(0x1ae)](_0x111467(0x16f)+_0x4b6bf8[_0x111467(0x185)]),0x1;throw _0x4b6bf8;}}}export class WorkflowRunCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]='workflow:run';[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x186);async['execute'](_0x2aa402){const _0x5d06cd=a43_0x5f26a1,{options:_0x2e9331,args:_0x4645a8,tdx:_0x44ae0e}=_0x2aa402,_0x53f244=_0x4645a8[0x0];if(!_0x53f244)return console['error'](_0x5d06cd(0x1f8)),console[_0x5d06cd(0x1ae)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x5199b0=_0x2e9331['param'],_0x58b5a2=_0x2e9331[_0x5d06cd(0x1cd)],_0x8a3a04={};if(_0x5199b0&&Array[_0x5d06cd(0x1fa)](_0x5199b0))for(const _0x5e2e97 of _0x5199b0){const _0x910ff0=_0x5e2e97[_0x5d06cd(0x193)]('=');if(_0x910ff0===-0x1)return console[_0x5d06cd(0x1ae)](_0x5d06cd(0x192)+_0x5e2e97),console[_0x5d06cd(0x1ae)](_0x5d06cd(0x18b)),0x1;const _0x348e6d=_0x5e2e97['substring'](0x0,_0x910ff0),_0xba52cf=_0x5e2e97[_0x5d06cd(0x1a9)](_0x910ff0+0x1);try{_0x8a3a04[_0x348e6d]=JSON[_0x5d06cd(0x1e7)](_0xba52cf);}catch{_0x8a3a04[_0x348e6d]=_0xba52cf;}}_0x2e9331[_0x5d06cd(0x1e4)]&&(console['error'](_0x5d06cd(0x1be)+_0x53f244),Object[_0x5d06cd(0x17a)](_0x8a3a04)[_0x5d06cd(0x18a)]>0x0&&console[_0x5d06cd(0x1ae)]('Parameters:\x20'+JSON['stringify'](_0x8a3a04)),_0x58b5a2&&console[_0x5d06cd(0x1ae)](_0x5d06cd(0x197)+_0x58b5a2));const _0x9ed31b=await withSpinner(_0x5d06cd(0x1a8),()=>_0x44ae0e[_0x5d06cd(0x1f1)][_0x5d06cd(0x18d)](_0x53f244,_0x8a3a04,{'sessionTime':_0x58b5a2}),{'verbose':_0x2e9331[_0x5d06cd(0x1e4)]}),_0x18e5ae=_0x9ed31b['data'];return console[_0x5d06cd(0x1ae)]('✔\x20Workflow\x20run\x20started'),console[_0x5d06cd(0x1ae)](_0x5d06cd(0x165)+_0x18e5ae['id']),console['error'](_0x5d06cd(0x181)+_0x18e5ae[_0x5d06cd(0x1c8)]),console[_0x5d06cd(0x1ae)]('\x20\x20Project:\x20'+_0x18e5ae[_0x5d06cd(0x1bb)]?.[_0x5d06cd(0x1aa)]),console[_0x5d06cd(0x1ae)]('\x20\x20Workflow:\x20'+_0x18e5ae[_0x5d06cd(0x1f1)]?.[_0x5d06cd(0x1aa)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]=a43_0x5f26a1(0x1d6);['description']=a43_0x5f26a1(0x191);async['execute'](_0x5c305f){const _0x5a73b2=a43_0x5f26a1,{options:_0x16a212,args:_0x20aeea,tdx:_0x1b422d}=_0x5c305f,_0x4b1f56=_0x20aeea[0x0],_0x2e6717=_0x20aeea[0x1]||'.';if(!_0x4b1f56)return console[_0x5a73b2(0x1ae)](_0x5a73b2(0x173)),console[_0x5a73b2(0x1ae)](_0x5a73b2(0x18c)),0x1;const _0x103582=_0x16a212['revision'];_0x16a212['verbose']&&(console[_0x5a73b2(0x1ae)]('Project:\x20'+_0x4b1f56),console[_0x5a73b2(0x1ae)](_0x5a73b2(0x188)+_0x2e6717),_0x103582&&console[_0x5a73b2(0x1ae)]('Revision:\x20'+_0x103582));const _0x42b9bf=await withSpinner(_0x5a73b2(0x177)+_0x4b1f56+_0x5a73b2(0x16c),()=>_0x1b422d[_0x5a73b2(0x1f1)]['download'](_0x4b1f56,_0x2e6717,{'revision':_0x103582}),{'verbose':_0x16a212[_0x5a73b2(0x1e4)]}),_0x34115d=_0x42b9bf[_0x5a73b2(0x1b6)];return console['error'](_0x5a73b2(0x178)+_0x34115d[_0x5a73b2(0x1ac)]),console['error']('\x20\x20Revision:\x20'+_0x34115d[_0x5a73b2(0x1c6)]),console['error']('\x20\x20Files\x20extracted:\x20'+_0x34115d['filesExtracted']),console[_0x5a73b2(0x1ae)](_0x5a73b2(0x1e0)+_0x2e6717+'/'+_0x34115d['projectName']),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x5f26a1(0x1aa)]='workflow:push';[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x1eb);async[a43_0x5f26a1(0x1a6)](_0x4a0488){const _0x526740=a43_0x5f26a1,{options:_0x12e874,args:_0x23ee61,tdx:_0x3bd47e}=_0x4a0488;let _0x2cc1ab='.',_0x51e260=_0x12e874[_0x526740(0x1aa)];if(_0x23ee61[0x0]){const {promises:_0x3b2494}=await import('fs');try{const _0x461037=await _0x3b2494['stat'](_0x23ee61[0x0]);if(_0x461037[_0x526740(0x1b8)]())_0x2cc1ab=_0x23ee61[0x0];else return console['error']('Error:\x20'+_0x23ee61[0x0]+_0x526740(0x1cf)),0x1;}catch{_0x51e260=_0x23ee61[0x0],_0x2cc1ab='.';}}const _0x4cdf7c=_0x12e874[_0x526740(0x1c6)],_0x5ce026=_0x12e874[_0x526740(0x1b1)];_0x12e874[_0x526740(0x1e4)]&&(console[_0x526740(0x1ae)](_0x526740(0x1ef)+_0x2cc1ab),_0x51e260&&console[_0x526740(0x1ae)](_0x526740(0x172)+_0x51e260),_0x4cdf7c&&console[_0x526740(0x1ae)]('Revision:\x20'+_0x4cdf7c),_0x5ce026&&console[_0x526740(0x1ae)](_0x526740(0x184)));const _0x482fb4=await withSpinner(_0x526740(0x1f2),()=>_0x3bd47e[_0x526740(0x1f1)]['push'](_0x2cc1ab,{'projectName':_0x51e260,'revision':_0x4cdf7c,'skipValidation':_0x5ce026}),{'verbose':_0x12e874[_0x526740(0x1e4)]}),_0x35ee3c=_0x482fb4['data'];return console['error'](_0x526740(0x17b)+_0x35ee3c[_0x526740(0x1ac)]),console[_0x526740(0x1ae)]('\x20\x20Project\x20ID:\x20'+_0x35ee3c[_0x526740(0x1b4)]),console['error'](_0x526740(0x1ca)+_0x35ee3c[_0x526740(0x1c6)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x5f26a1(0x1f9);[a43_0x5f26a1(0x17f)]=a43_0x5f26a1(0x1f0);async[a43_0x5f26a1(0x1a6)](_0x2a2a64){const _0x20c2a2=a43_0x5f26a1,{options:_0xc9a379,args:_0x4865b6,tdx:_0x41592e}=_0x2a2a64,_0x13dc9b=_0x4865b6[0x0];if(!_0x13dc9b)return console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1e5)),console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1f4)),0x1;_0xc9a379['verbose']&&console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1c7)+_0x13dc9b);if(!_0xc9a379[_0x20c2a2(0x1a3)]){const _0x27a9bf=await confirm(_0x20c2a2(0x16a)+_0x13dc9b+_0x20c2a2(0x198));if(!_0x27a9bf)return console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1d0)),0x0;}const _0x1b139e=await withSpinner(_0x20c2a2(0x1fc)+_0x13dc9b+_0x20c2a2(0x16c),()=>_0x41592e[_0x20c2a2(0x1f1)][_0x20c2a2(0x1ad)](_0x13dc9b),{'verbose':_0xc9a379[_0x20c2a2(0x1e4)]}),_0xda1ed5=_0x1b139e['data'];return console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1c2)+_0xda1ed5[_0x20c2a2(0x1ac)]),console[_0x20c2a2(0x1ae)](_0x20c2a2(0x1bc)+_0xda1ed5[_0x20c2a2(0x1b4)]),0x0;}}
|
|
1
|
+
const a43_0x5759ce=a43_0x54fe;(function(_0x31542d,_0x23bbe7){const _0x5c72d9=a43_0x54fe,_0x5600da=_0x31542d();while(!![]){try{const _0x4156ae=-parseInt(_0x5c72d9(0x19f))/0x1+parseInt(_0x5c72d9(0x16f))/0x2*(parseInt(_0x5c72d9(0x160))/0x3)+-parseInt(_0x5c72d9(0x17d))/0x4+-parseInt(_0x5c72d9(0x149))/0x5+-parseInt(_0x5c72d9(0x1b8))/0x6+parseInt(_0x5c72d9(0x190))/0x7+-parseInt(_0x5c72d9(0x1cc))/0x8*(-parseInt(_0x5c72d9(0x193))/0x9);if(_0x4156ae===_0x23bbe7)break;else _0x5600da['push'](_0x5600da['shift']());}catch(_0x16bcc4){_0x5600da['push'](_0x5600da['shift']());}}}(a43_0x2a3e,0x66fc1));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_0x5d36d4 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x1af);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x187);async['execute'](_0x4fcdbf){const _0x49b9ac=a43_0x5759ce,{options:_0x237c22,args:_0x45a166,tdx:_0x1d745e}=_0x4fcdbf,_0x3494df=_0x45a166[0x0];try{_0x237c22[_0x49b9ac(0x1db)]&&_0x3494df&&console['error']('Pattern:\x20'+_0x3494df);const _0x30a304=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x1d745e['workflow'][_0x49b9ac(0x1c8)](_0x3494df,{'limit':_0x237c22['limit']}),{'verbose':_0x237c22[_0x49b9ac(0x1db)]}),_0x1dc60c=_0x30a304[_0x49b9ac(0x1cb)];return console[_0x49b9ac(0x1a6)]('✔\x20Found\x20'+_0x1dc60c[_0x49b9ac(0x179)]+_0x49b9ac(0x175)+(_0x1dc60c[_0x49b9ac(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x1dc60c,_0x237c22),0x0;}catch(_0x1015b1){if(_0x1015b1 instanceof SDKError)return console[_0x49b9ac(0x1a6)](_0x49b9ac(0x1a9)+_0x1015b1[_0x49b9ac(0x17f)]),_0x1015b1[_0x49b9ac(0x184)]&&console[_0x49b9ac(0x1a6)](_0x49b9ac(0x168)+_0x1015b1['cause']),0x1;throw _0x1015b1;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x19e);[a43_0x5759ce(0x1ab)]='List\x20workflows';async[a43_0x5759ce(0x14d)](_0x274e2d){const _0x4e90a1=a43_0x5759ce,{options:_0x4c1e87,args:_0x54c618,tdx:_0x4c20f5}=_0x274e2d,_0x53f30f=_0x54c618[0x0];try{_0x4c1e87[_0x4e90a1(0x1db)]&&_0x53f30f&&console['error'](_0x4e90a1(0x1be)+_0x53f30f);const _0x1baa7a=await withSpinner(_0x4e90a1(0x1c3),()=>_0x4c20f5['workflow']['workflows'](_0x53f30f,{'limit':_0x4c1e87['limit']}),{'verbose':_0x4c1e87['verbose']}),_0x3cf3f1=_0x1baa7a[_0x4e90a1(0x1cb)];return console[_0x4e90a1(0x1a6)](_0x4e90a1(0x1d2)+_0x3cf3f1[_0x4e90a1(0x179)]+_0x4e90a1(0x1a4)+(_0x3cf3f1[_0x4e90a1(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x3cf3f1,_0x4c1e87),0x0;}catch(_0x4c790a){if(_0x4c790a instanceof SDKError)return console[_0x4e90a1(0x1a6)](_0x4e90a1(0x1a9)+_0x4c790a[_0x4e90a1(0x17f)]),_0x4c790a[_0x4e90a1(0x184)]&&console['error']('\x20\x20Cause:\x20'+_0x4c790a[_0x4e90a1(0x184)]),0x1;throw _0x4c790a;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:sessions';['description']='List\x20workflow\x20execution\x20sessions';async[a43_0x5759ce(0x14d)](_0x489340){const _0x328d88=a43_0x5759ce,{options:_0x33ed87,args:_0x1bbe36,tdx:_0x2f100e}=_0x489340;let _0xdedd27,_0x53ee91;if(_0x1bbe36[0x0]){const _0x1eed44=_0x1bbe36[0x0][_0x328d88(0x1b2)]('.');if(_0x1eed44[_0x328d88(0x179)]===0x1)_0xdedd27=_0x1eed44[0x0];else{if(_0x1eed44['length']===0x2)[_0xdedd27,_0x53ee91]=_0x1eed44;else return console[_0x328d88(0x1a6)](_0x328d88(0x173)),0x1;}}try{if(_0x33ed87[_0x328d88(0x1db)]){if(_0xdedd27&&_0x53ee91)console[_0x328d88(0x1a6)](_0x328d88(0x15c)+_0xdedd27+'.'+_0x53ee91);else _0xdedd27&&console['error'](_0x328d88(0x170)+_0xdedd27);const _0x4fc865=_0x33ed87['status'];_0x4fc865&&console[_0x328d88(0x1a6)]('Status:\x20'+_0x4fc865);}const _0x125bb4=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x2f100e[_0x328d88(0x178)][_0x328d88(0x150)]({'projectName':_0xdedd27,'workflowName':_0x53ee91,'status':_0x33ed87[_0x328d88(0x1c7)],'fromTime':_0x33ed87[_0x328d88(0x1ad)],'toTime':_0x33ed87['to'],'limit':_0x33ed87[_0x328d88(0x1b7)]}),{'verbose':_0x33ed87[_0x328d88(0x1db)]}),_0x4a718b=_0x125bb4[_0x328d88(0x1cb)];return console[_0x328d88(0x1a6)](_0x328d88(0x1d2)+_0x4a718b[_0x328d88(0x179)]+'\x20session'+(_0x4a718b[_0x328d88(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x4a718b,_0x33ed87),0x0;}catch(_0x5d4021){if(_0x5d4021 instanceof SDKError)return console[_0x328d88(0x1a6)]('Error:\x20'+_0x5d4021[_0x328d88(0x17f)]),_0x5d4021[_0x328d88(0x184)]&&console[_0x328d88(0x1a6)](_0x328d88(0x168)+_0x5d4021[_0x328d88(0x184)]),0x1;throw _0x5d4021;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a43_0x5759ce(0x164);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1b9);async[a43_0x5759ce(0x14d)](_0x5ec42b){const _0x2fb267=a43_0x5759ce,{options:_0x47e97e,args:_0x10ce82,tdx:_0x46ddd9}=_0x5ec42b;let _0x590969,_0x3d5d8b;if(_0x10ce82[0x0]){const _0x26b0fc=_0x10ce82[0x0][_0x2fb267(0x1b2)]('.');if(_0x26b0fc['length']===0x1)_0x590969=_0x26b0fc[0x0];else{if(_0x26b0fc[_0x2fb267(0x179)]===0x2)[_0x590969,_0x3d5d8b]=_0x26b0fc;else return console[_0x2fb267(0x1a6)](_0x2fb267(0x173)),0x1;}}try{const _0x2ce844=_0x47e97e[_0x2fb267(0x1b6)];if(_0x47e97e['verbose']){if(_0x590969&&_0x3d5d8b)console[_0x2fb267(0x1a6)]('Filter:\x20'+_0x590969+'.'+_0x3d5d8b);else _0x590969&&console[_0x2fb267(0x1a6)](_0x2fb267(0x170)+_0x590969);_0x2ce844&&console[_0x2fb267(0x1a6)](_0x2fb267(0x1d1));}const _0x25c689=await withSpinner(_0x2fb267(0x13f),()=>_0x46ddd9['workflow']['attempts']({'projectName':_0x590969,'workflowName':_0x3d5d8b,'includeRetried':_0x2ce844,'limit':_0x47e97e['limit']}),{'verbose':_0x47e97e[_0x2fb267(0x1db)]}),_0x2d8e88=_0x25c689[_0x2fb267(0x1cb)];return console[_0x2fb267(0x1a6)](_0x2fb267(0x1d2)+_0x2d8e88['length']+_0x2fb267(0x1a5)+(_0x2d8e88['length']!==0x1?'s':'')),await handleSDKOutput(_0x2d8e88,_0x47e97e),0x0;}catch(_0x1370fb){if(_0x1370fb instanceof SDKError)return console[_0x2fb267(0x1a6)]('Error:\x20'+_0x1370fb[_0x2fb267(0x17f)]),_0x1370fb[_0x2fb267(0x184)]&&console[_0x2fb267(0x1a6)]('\x20\x20Cause:\x20'+_0x1370fb[_0x2fb267(0x184)]),0x1;throw _0x1370fb;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:attempt';[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x152);async[a43_0x5759ce(0x14d)](_0x342b51){const _0x46ac1b=a43_0x5759ce,{options:_0x45208e,args:_0x527af7,tdx:_0x3ba499}=_0x342b51,_0x112b04=_0x527af7[0x0];if(!_0x112b04)return console['error'](_0x46ac1b(0x1b4)),0x1;try{_0x45208e[_0x46ac1b(0x1db)]&&console[_0x46ac1b(0x1a6)](_0x46ac1b(0x153)+_0x112b04);const _0x4e37f7=await withSpinner(_0x46ac1b(0x183),()=>_0x3ba499[_0x46ac1b(0x178)][_0x46ac1b(0x1a2)](_0x112b04),{'verbose':_0x45208e[_0x46ac1b(0x1db)]}),_0xfe7828=_0x4e37f7['data'];let _0x2ac0a4;!_0xfe7828[_0x46ac1b(0x1da)]?_0x2ac0a4=_0xfe7828[_0x46ac1b(0x1d6)]?_0x46ac1b(0x158):_0x46ac1b(0x165):_0x2ac0a4=_0xfe7828[_0x46ac1b(0x16c)]?_0x46ac1b(0x16c):_0x46ac1b(0x1a6);let _0x451cf4;if(_0xfe7828[_0x46ac1b(0x1bd)]&&_0xfe7828[_0x46ac1b(0x1c2)]){const _0x56c6c2=new Date(_0xfe7828[_0x46ac1b(0x1bd)])['getTime'](),_0x310b66=new Date(_0xfe7828[_0x46ac1b(0x1c2)])[_0x46ac1b(0x1c9)]();_0x451cf4=Math[_0x46ac1b(0x1c1)]((_0x310b66-_0x56c6c2)/0x3e8);}const _0x24abc4={'attempt_id':_0xfe7828['id'],'status':_0x2ac0a4,..._0xfe7828[_0x46ac1b(0x1c0)]!==undefined&&{'index':_0xfe7828['index']},..._0xfe7828[_0x46ac1b(0x191)]&&{'project':_0xfe7828[_0x46ac1b(0x191)]['name']},..._0xfe7828[_0x46ac1b(0x178)]&&{'workflow':_0xfe7828[_0x46ac1b(0x178)]['name']},..._0xfe7828[_0x46ac1b(0x1cf)]&&{'session_id':_0xfe7828[_0x46ac1b(0x1cf)]},..._0xfe7828[_0x46ac1b(0x199)]&&{'session_time':_0xfe7828[_0x46ac1b(0x199)]},..._0xfe7828[_0x46ac1b(0x15e)]&&{'retry_attempt':_0xfe7828['retryAttemptName']},..._0x451cf4!==undefined&&{'duration_sec':_0x451cf4},..._0xfe7828[_0x46ac1b(0x1bd)]&&{'created_at':_0xfe7828[_0x46ac1b(0x1bd)]},..._0xfe7828[_0x46ac1b(0x1c2)]&&{'finished_at':_0xfe7828[_0x46ac1b(0x1c2)]},...Object[_0x46ac1b(0x1c5)](_0xfe7828['params'])[_0x46ac1b(0x179)]>0x0&&{'params':_0xfe7828[_0x46ac1b(0x1e1)]}};return await handleSingleObjectOutput(_0x24abc4,_0x45208e),0x0;}catch(_0x204156){if(_0x204156 instanceof SDKError)return console[_0x46ac1b(0x1a6)](_0x46ac1b(0x1a9)+_0x204156[_0x46ac1b(0x17f)]),_0x204156[_0x46ac1b(0x184)]&&console[_0x46ac1b(0x1a6)](_0x46ac1b(0x168)+_0x204156[_0x46ac1b(0x184)]),0x1;throw _0x204156;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]='workflow:tasks';[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x19a);async['execute'](_0x477a20){const _0x3eae38=a43_0x5759ce,{options:_0x26d271,args:_0x4d0c6f,tdx:_0x1c10f6}=_0x477a20,_0x2f752d=_0x4d0c6f[0x0];if(!_0x2f752d)return console[_0x3eae38(0x1a6)](_0x3eae38(0x1b4)),0x1;try{const _0x225f10=_0x26d271[_0x3eae38(0x192)];_0x26d271[_0x3eae38(0x1db)]&&(console[_0x3eae38(0x1a6)](_0x3eae38(0x153)+_0x2f752d),_0x225f10&&console[_0x3eae38(0x1a6)]('Including\x20subtasks:\x20yes'));const _0x3c9d42=await withSpinner(_0x3eae38(0x17e),()=>_0x1c10f6['workflow'][_0x3eae38(0x185)](_0x2f752d,_0x225f10||![]),{'verbose':_0x26d271[_0x3eae38(0x1db)]}),_0x99f482=_0x3c9d42[_0x3eae38(0x1cb)];return console[_0x3eae38(0x1a6)](_0x3eae38(0x1d2)+_0x99f482['length']+_0x3eae38(0x1b0)+(_0x99f482[_0x3eae38(0x179)]!==0x1?'s':'')),await handleSDKOutput(_0x99f482,_0x26d271),0x0;}catch(_0x27331f){if(_0x27331f instanceof SDKError)return console[_0x3eae38(0x1a6)](_0x3eae38(0x1a9)+_0x27331f[_0x3eae38(0x17f)]),_0x27331f['cause']&&console[_0x3eae38(0x1a6)](_0x3eae38(0x168)+_0x27331f[_0x3eae38(0x184)]),0x1;throw _0x27331f;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0x5759ce(0x19c);[a43_0x5759ce(0x1ab)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x5759ce(0x14d)](_0x535770){const _0x62d5e6=a43_0x5759ce,{options:_0x39e7ed,args:_0x25e685,tdx:_0x3bd9b2}=_0x535770,_0x12a159=_0x25e685[0x0];let _0x3d56c4=_0x25e685[0x1];if(!_0x12a159)return console[_0x62d5e6(0x1a6)](_0x62d5e6(0x1b4)),0x1;try{_0x39e7ed[_0x62d5e6(0x1db)]&&(console[_0x62d5e6(0x1a6)](_0x62d5e6(0x153)+_0x12a159),_0x3d56c4&&console[_0x62d5e6(0x1a6)](_0x62d5e6(0x1ca)+_0x3d56c4));const _0x523831=await withSpinner(_0x62d5e6(0x144),()=>_0x3bd9b2['workflow'][_0x62d5e6(0x180)](_0x12a159,_0x3d56c4),{'verbose':_0x39e7ed[_0x62d5e6(0x1db)]}),_0xc9ccbc=_0x523831[_0x62d5e6(0x1cb)];if(_0xc9ccbc[_0x62d5e6(0x179)]===0x0)return console['error']('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x3d56c4&&(_0x39e7ed[_0x62d5e6(0x140)]||_0x39e7ed[_0x62d5e6(0x189)]))return await handleSDKOutput(_0xc9ccbc,_0x39e7ed),0x0;if(!_0x3d56c4){const _0x488a14=_0xc9ccbc[_0x62d5e6(0x1d8)](_0x2a9b66=>({'title':_0x2a9b66[_0x62d5e6(0x15f)]+'\x20('+formatBytes(_0x2a9b66[_0x62d5e6(0x141)])+')','value':_0x2a9b66[_0x62d5e6(0x15f)]})),_0x12f68f=await a43_0x5d36d4({'type':_0x62d5e6(0x1aa),'name':_0x62d5e6(0x1cd),'message':_0x62d5e6(0x14c),'choices':_0x488a14});if(!_0x12f68f[_0x62d5e6(0x1cd)])return console['error'](_0x62d5e6(0x19b)),0x0;_0x3d56c4=_0x12f68f['task'];}const _0x6e91af=await withSpinner('Downloading\x20logs...',()=>_0x3bd9b2[_0x62d5e6(0x178)][_0x62d5e6(0x14e)](_0x12a159,_0x3d56c4),{'verbose':_0x39e7ed[_0x62d5e6(0x1db)]}),_0x83b3d3=_0x6e91af[_0x62d5e6(0x1cb)];return _0x83b3d3?console['log'](_0x83b3d3):console[_0x62d5e6(0x1a6)](_0x62d5e6(0x177)),0x0;}catch(_0x33429e){if(_0x33429e instanceof SDKError)return console['error']('Error:\x20'+_0x33429e['message']),_0x33429e['cause']&&console[_0x62d5e6(0x1a6)](_0x62d5e6(0x168)+_0x33429e['cause']),0x1;throw _0x33429e;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x1d9);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1a7);async[a43_0x5759ce(0x14d)](_0x1f559a){const _0x866bcd=a43_0x5759ce,{options:_0x29eceb,args:_0x24d592,tdx:_0x4e406c}=_0x1f559a,_0x5eaac1=_0x24d592[0x0];if(!_0x5eaac1)return console['error'](_0x866bcd(0x1b4)),0x1;try{const _0x243e84=_0x29eceb['reason'];_0x29eceb[_0x866bcd(0x1db)]&&(console[_0x866bcd(0x1a6)]('Attempt\x20ID:\x20'+_0x5eaac1),_0x243e84&&console[_0x866bcd(0x1a6)](_0x866bcd(0x1d7)+_0x243e84));if(!_0x29eceb[_0x866bcd(0x17b)]){const _0xedb1f=await confirm(_0x866bcd(0x18b)+_0x5eaac1+'?');if(!_0xedb1f)return console[_0x866bcd(0x1a6)](_0x866bcd(0x19b)),0x0;}const _0x5534a3=await withSpinner(_0x866bcd(0x1df),()=>_0x4e406c[_0x866bcd(0x178)][_0x866bcd(0x154)](_0x5eaac1,_0x243e84),{'verbose':_0x29eceb['verbose']}),_0x331ee5=_0x5534a3[_0x866bcd(0x1cb)];return console['error']('✔\x20'+_0x331ee5),0x0;}catch(_0x903343){if(_0x903343 instanceof SDKError)return console[_0x866bcd(0x1a6)](_0x866bcd(0x1a9)+_0x903343[_0x866bcd(0x17f)]),_0x903343[_0x866bcd(0x184)]&&console[_0x866bcd(0x1a6)]('\x20\x20Cause:\x20'+_0x903343[_0x866bcd(0x184)]),0x1;throw _0x903343;}}}function a43_0x54fe(_0x3327e1,_0x3187e9){_0x3327e1=_0x3327e1-0x13f;const _0x2a3e56=a43_0x2a3e();let _0x54fe70=_0x2a3e56[_0x3327e1];return _0x54fe70;}export class WorkflowRetryCommand extends BaseCommand{['name']=a43_0x5759ce(0x161);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1a3);async[a43_0x5759ce(0x14d)](_0x1d0714){const _0x13aba4=a43_0x5759ce,{options:_0x359570,args:_0x2a76aa,tdx:_0x11a04f}=_0x1d0714,_0x5ce68e=_0x2a76aa[0x0];if(!_0x5ce68e)return console[_0x13aba4(0x1a6)](_0x13aba4(0x196)),console[_0x13aba4(0x1a6)](_0x13aba4(0x1a0)),0x1;let _0x1c3831=![],_0x2dc192=_0x5ce68e;if(_0x5ce68e[_0x13aba4(0x1e3)](_0x13aba4(0x188)))_0x1c3831=!![],_0x2dc192=_0x5ce68e[_0x13aba4(0x1a8)](0x8);else{if(_0x5ce68e[_0x13aba4(0x1e3)](_0x13aba4(0x15d)))_0x1c3831=![],_0x2dc192=_0x5ce68e[_0x13aba4(0x1a8)](0x8);else return console[_0x13aba4(0x1a6)](_0x13aba4(0x17c)),console['error'](_0x13aba4(0x1a0)),0x1;}try{const _0x1416dc=_0x359570[_0x13aba4(0x148)],_0x4d9e5a=_0x359570[_0x13aba4(0x15b)],_0x4b5d67=_0x359570[_0x13aba4(0x1e1)],_0x3a4be4=_0x359570[_0x13aba4(0x16d)];_0x359570[_0x13aba4(0x1db)]&&(console['error']('Target:\x20'+(_0x1c3831?_0x13aba4(0x18f):_0x13aba4(0x1a2))+'\x20'+_0x2dc192),_0x1416dc&&console[_0x13aba4(0x1a6)]('From\x20task:\x20'+_0x1416dc),_0x4d9e5a&&console[_0x13aba4(0x1a6)]('Resume\x20from:\x20'+_0x4d9e5a),_0x4b5d67&&console[_0x13aba4(0x1a6)](_0x13aba4(0x198)+_0x4b5d67),_0x3a4be4&&console['error'](_0x13aba4(0x16a)));let _0x4479fd;if(_0x4b5d67)try{if(_0x4b5d67[_0x13aba4(0x1e3)]('@')){const _0x2ffd4e=await import('fs/promises'),_0x43aa7f=_0x4b5d67[_0x13aba4(0x1a8)](0x1),_0x3bf86d=await _0x2ffd4e[_0x13aba4(0x147)](_0x43aa7f,_0x13aba4(0x159));_0x4479fd=JSON[_0x13aba4(0x151)](_0x3bf86d);}else _0x4479fd=JSON[_0x13aba4(0x151)](_0x4b5d67);}catch{return console[_0x13aba4(0x1a6)](_0x13aba4(0x174)),0x1;}if(!_0x359570[_0x13aba4(0x17b)]){const _0x385517=await confirm(_0x13aba4(0x1bf)+(_0x1c3831?_0x13aba4(0x18f):_0x13aba4(0x1a2))+'\x20'+_0x2dc192+'?');if(!_0x385517)return console[_0x13aba4(0x1a6)]('Cancelled'),0x0;}let _0x556ea3;_0x1c3831?_0x556ea3=await withSpinner('Retrying\x20session...',()=>_0x11a04f[_0x13aba4(0x178)][_0x13aba4(0x17a)](_0x2dc192,{'fromTask':_0x1416dc,'retryParams':_0x4479fd}),{'verbose':_0x359570['verbose']}):_0x556ea3=await withSpinner('Retrying\x20attempt...',()=>_0x11a04f[_0x13aba4(0x178)][_0x13aba4(0x1ba)](_0x2dc192,{'resumeFrom':_0x4d9e5a,'retryParams':_0x4479fd,'force':_0x3a4be4}),{'verbose':_0x359570[_0x13aba4(0x1db)]});const _0x4136c9=_0x556ea3[_0x13aba4(0x1cb)];return console['error'](_0x13aba4(0x1ae)),console[_0x13aba4(0x1a6)](_0x13aba4(0x162)+_0x4136c9[_0x13aba4(0x1bc)]),console[_0x13aba4(0x1a6)](_0x13aba4(0x1c6)+_0x4136c9[_0x13aba4(0x1cf)]),0x0;}catch(_0x52f6a0){if(_0x52f6a0 instanceof SDKError)return console['error'](_0x13aba4(0x1a9)+_0x52f6a0[_0x13aba4(0x17f)]),_0x52f6a0[_0x13aba4(0x184)]&&console[_0x13aba4(0x1a6)](_0x13aba4(0x168)+_0x52f6a0[_0x13aba4(0x184)]),0x1;throw _0x52f6a0;}}}function a43_0x2a3e(){const _0x36a9f3=['No\x20log\x20content\x20found','workflow','length','retrySession','yes','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','3234064BuHIiy','Getting\x20attempt\x20tasks...','message','logFiles','Error:\x20Invalid\x20parameter\x20format:\x20','\x20\x20Revision:\x20','Getting\x20attempt\x20details...','cause','tasks','✔\x20Downloaded\x20','List\x20all\x20workflow\x20projects','session:','format','param','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','workflow:push','\x20\x20Workflow:\x20','projectName','session','4204382YiYrAQ','project','includeSubtasks','9TOtZWk','Workflow:\x20','run','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','✔\x20Pushed\x20','Params:\x20','sessionTime','Show\x20tasks\x20for\x20an\x20attempt','Cancelled','workflow:logs','Revision:\x20','workflow:workflows','613258WHMOny','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','\x20\x20Location:\x20','attempt','Retry\x20a\x20session\x20or\x20attempt','\x20workflow','\x20attempt','error','Kill\x20a\x20running\x20attempt','substring','Error:\x20','select','description','Start\x20a\x20workflow\x20run','from','✔\x20Retry\x20started','workflow:projects','\x20task','projectId','split','\x22?\x20This\x20cannot\x20be\x20undone.','Error:\x20Attempt\x20ID\x20is\x20required','workflow:run','includeRetried','limit','4359420QrrSDm','List\x20workflow\x20attempts','retryAttempt','\x20\x20Project\x20ID:\x20','attemptId','createdAt','Project\x20filter:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','index','round','finishedAt','Listing\x20workflows...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','keys','\x20\x20Session\x20ID:\x20','status','projects','getTime','Task\x20name:\x20','data','14586344kMWliM','task','name','sessionId','download','Include\x20retried:\x20yes','✔\x20Found\x20','stat','\x20\x20Files\x20extracted:\x20','filesExtracted','cancelRequested','Reason:\x20','map','workflow:kill','done','verbose','Parameters:\x20','revision','\x20\x20Project:\x20','Killing\x20attempt...','isDirectory','params','Output\x20directory:\x20','startsWith','Listing\x20workflow\x20attempts...','json','fileSize','Downloading\x20project\x20','\x20is\x20not\x20a\x20directory','Fetching\x20log\x20files...','indexOf','workflow:delete','readFile','fromTask','2316855GFObgp','Deleting\x20project\x20','Project\x20directory:\x20','Select\x20a\x20task\x20to\x20view\x20logs:','execute','logs','Error:\x20Workflow\x20identifier\x20is\x20required','sessions','parse','Show\x20specific\x20attempt\x20details','Attempt\x20ID:\x20','kill','Validation:\x20skipped','✔\x20Workflow\x20run\x20started','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','canceling','utf-8','workflow:download','resumeFrom','Filter:\x20','attempt:','retryAttemptName','taskName','1828863EIouVl','workflow:retry','\x20\x20New\x20attempt\x20ID:\x20','Expected\x20format:\x20--param\x20key=value','workflow:attempts','running','...','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20Cause:\x20','delete','Force:\x20yes','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','success','force','skipValidation','2eBmSHm','Filter:\x20project=','✔\x20Deleted\x20project\x20','Session\x20time:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20project','Error:\x20Project\x20name\x20is\x20required'];a43_0x2a3e=function(){return _0x36a9f3;};return a43_0x2a3e();}export class WorkflowRunCommand extends BaseCommand{['name']=a43_0x5759ce(0x1b5);[a43_0x5759ce(0x1ab)]=a43_0x5759ce(0x1ac);async[a43_0x5759ce(0x14d)](_0x5e468c){const _0x492439=a43_0x5759ce,{options:_0x4e78f0,args:_0x3fb2f4,tdx:_0x3cd2c4}=_0x5e468c,_0x3ffe86=_0x3fb2f4[0x0];if(!_0x3ffe86)return console[_0x492439(0x1a6)](_0x492439(0x14f)),console[_0x492439(0x1a6)](_0x492439(0x16b)),0x1;const _0x17aaea=_0x4e78f0[_0x492439(0x18a)],_0x33d165=_0x4e78f0[_0x492439(0x199)],_0x3206d8={};if(_0x17aaea&&Array['isArray'](_0x17aaea))for(const _0x4a35c7 of _0x17aaea){const _0x276231=_0x4a35c7[_0x492439(0x145)]('=');if(_0x276231===-0x1)return console[_0x492439(0x1a6)](_0x492439(0x181)+_0x4a35c7),console[_0x492439(0x1a6)](_0x492439(0x163)),0x1;const _0x157d22=_0x4a35c7['substring'](0x0,_0x276231),_0x326b30=_0x4a35c7['substring'](_0x276231+0x1);try{_0x3206d8[_0x157d22]=JSON[_0x492439(0x151)](_0x326b30);}catch{_0x3206d8[_0x157d22]=_0x326b30;}}_0x4e78f0['verbose']&&(console[_0x492439(0x1a6)](_0x492439(0x194)+_0x3ffe86),Object[_0x492439(0x1c5)](_0x3206d8)[_0x492439(0x179)]>0x0&&console[_0x492439(0x1a6)](_0x492439(0x1dc)+JSON['stringify'](_0x3206d8)),_0x33d165&&console['error'](_0x492439(0x172)+_0x33d165));const _0x5afb00=await withSpinner('Starting\x20workflow\x20run...',()=>_0x3cd2c4[_0x492439(0x178)][_0x492439(0x195)](_0x3ffe86,_0x3206d8,{'sessionTime':_0x33d165}),{'verbose':_0x4e78f0[_0x492439(0x1db)]}),_0x1e5e25=_0x5afb00[_0x492439(0x1cb)];return console['error'](_0x492439(0x156)),console[_0x492439(0x1a6)]('\x20\x20Attempt\x20ID:\x20'+_0x1e5e25['id']),console[_0x492439(0x1a6)](_0x492439(0x1c6)+_0x1e5e25[_0x492439(0x1cf)]),console[_0x492439(0x1a6)](_0x492439(0x1de)+_0x1e5e25['project']?.[_0x492439(0x1ce)]),console[_0x492439(0x1a6)](_0x492439(0x18d)+_0x1e5e25['workflow']?.[_0x492439(0x1ce)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a43_0x5759ce(0x15a);[a43_0x5759ce(0x1ab)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x304240){const _0x282188=a43_0x5759ce,{options:_0x341349,args:_0x5bdf6d,tdx:_0x5411aa}=_0x304240,_0x159a24=_0x5bdf6d[0x0],_0xf0606d=_0x5bdf6d[0x1]||'.';if(!_0x159a24)return console[_0x282188(0x1a6)](_0x282188(0x176)),console[_0x282188(0x1a6)](_0x282188(0x1c4)),0x1;const _0x1f877c=_0x341349[_0x282188(0x1dd)];_0x341349[_0x282188(0x1db)]&&(console[_0x282188(0x1a6)]('Project:\x20'+_0x159a24),console[_0x282188(0x1a6)](_0x282188(0x1e2)+_0xf0606d),_0x1f877c&&console[_0x282188(0x1a6)](_0x282188(0x19d)+_0x1f877c));const _0x59e7da=await withSpinner(_0x282188(0x142)+_0x159a24+_0x282188(0x166),()=>_0x5411aa[_0x282188(0x178)][_0x282188(0x1d0)](_0x159a24,_0xf0606d,{'revision':_0x1f877c}),{'verbose':_0x341349[_0x282188(0x1db)]}),_0x4debd5=_0x59e7da[_0x282188(0x1cb)];return console[_0x282188(0x1a6)](_0x282188(0x186)+_0x4debd5[_0x282188(0x18e)]),console[_0x282188(0x1a6)]('\x20\x20Revision:\x20'+_0x4debd5[_0x282188(0x1dd)]),console[_0x282188(0x1a6)](_0x282188(0x1d4)+_0x4debd5[_0x282188(0x1d5)]),console['error'](_0x282188(0x1a1)+_0xf0606d+'/'+_0x4debd5[_0x282188(0x18e)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x18c);[a43_0x5759ce(0x1ab)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x488b7e){const _0x352a0d=a43_0x5759ce,{options:_0x1ce9df,args:_0x1e4888,tdx:_0x546ef5}=_0x488b7e;let _0x2ae18d='.',_0x2e9ac7=_0x1ce9df[_0x352a0d(0x1ce)];if(_0x1e4888[0x0]){const {promises:_0x29aa8c}=await import('fs');try{const _0x2fd756=await _0x29aa8c[_0x352a0d(0x1d3)](_0x1e4888[0x0]);if(_0x2fd756[_0x352a0d(0x1e0)]())_0x2ae18d=_0x1e4888[0x0];else return console[_0x352a0d(0x1a6)](_0x352a0d(0x1a9)+_0x1e4888[0x0]+_0x352a0d(0x143)),0x1;}catch{_0x2e9ac7=_0x1e4888[0x0],_0x2ae18d='.';}}const _0x2b8f45=_0x1ce9df[_0x352a0d(0x1dd)],_0x3413ab=_0x1ce9df[_0x352a0d(0x16e)];_0x1ce9df[_0x352a0d(0x1db)]&&(console[_0x352a0d(0x1a6)](_0x352a0d(0x14b)+_0x2ae18d),_0x2e9ac7&&console['error']('Project\x20name:\x20'+_0x2e9ac7),_0x2b8f45&&console[_0x352a0d(0x1a6)](_0x352a0d(0x19d)+_0x2b8f45),_0x3413ab&&console['error'](_0x352a0d(0x155)));const _0x2189a7=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x546ef5[_0x352a0d(0x178)]['push'](_0x2ae18d,{'projectName':_0x2e9ac7,'revision':_0x2b8f45,'skipValidation':_0x3413ab}),{'verbose':_0x1ce9df[_0x352a0d(0x1db)]}),_0x2d1503=_0x2189a7[_0x352a0d(0x1cb)];return console[_0x352a0d(0x1a6)](_0x352a0d(0x197)+_0x2d1503[_0x352a0d(0x18e)]),console[_0x352a0d(0x1a6)](_0x352a0d(0x1bb)+_0x2d1503[_0x352a0d(0x1b1)]),console[_0x352a0d(0x1a6)](_0x352a0d(0x182)+_0x2d1503['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a43_0x5759ce(0x1ce)]=a43_0x5759ce(0x146);[a43_0x5759ce(0x1ab)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0x5759ce(0x14d)](_0x2894bf){const _0x16ab89=a43_0x5759ce,{options:_0x477eba,args:_0x5586f1,tdx:_0x540838}=_0x2894bf,_0x5882c0=_0x5586f1[0x0];if(!_0x5882c0)return console[_0x16ab89(0x1a6)](_0x16ab89(0x167)),console['error']('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x477eba[_0x16ab89(0x1db)]&&console[_0x16ab89(0x1a6)]('Project:\x20'+_0x5882c0);if(!_0x477eba[_0x16ab89(0x17b)]){const _0x58f57c=await confirm(_0x16ab89(0x157)+_0x5882c0+_0x16ab89(0x1b3));if(!_0x58f57c)return console[_0x16ab89(0x1a6)](_0x16ab89(0x19b)),0x0;}const _0x15692d=await withSpinner(_0x16ab89(0x14a)+_0x5882c0+_0x16ab89(0x166),()=>_0x540838[_0x16ab89(0x178)][_0x16ab89(0x169)](_0x5882c0),{'verbose':_0x477eba[_0x16ab89(0x1db)]}),_0x238642=_0x15692d[_0x16ab89(0x1cb)];return console[_0x16ab89(0x1a6)](_0x16ab89(0x171)+_0x238642[_0x16ab89(0x18e)]),console[_0x16ab89(0x1a6)](_0x16ab89(0x1bb)+_0x238642[_0x16ab89(0x1b1)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5534aa,_0x4a21ff){const _0x34c545=a44_0x3980,_0x12f7e5=_0x5534aa();while(!![]){try{const _0x331509=-parseInt(_0x34c545(0x1a8))/0x1*(-parseInt(_0x34c545(0x1aa))/0x2)+parseInt(_0x34c545(0x1a9))/0x3+-parseInt(_0x34c545(0x19e))/0x4+-parseInt(_0x34c545(0x1a6))/0x5+-parseInt(_0x34c545(0x1ae))/0x6+-parseInt(_0x34c545(0x1ad))/0x7+-parseInt(_0x34c545(0x1ab))/0x8*(-parseInt(_0x34c545(0x1ac))/0x9);if(_0x331509===_0x4a21ff)break;else _0x12f7e5['push'](_0x12f7e5['shift']());}catch(_0x2c1cd8){_0x12f7e5['push'](_0x12f7e5['shift']());}}}(a44_0x3682,0x4c4b5));import{platform}from'os';import{readFileSync}from'fs';function a44_0x3980(_0x295ccb,_0x3d9b29){_0x295ccb=_0x295ccb-0x19d;const _0x368258=a44_0x3682();let _0x398006=_0x368258[_0x295ccb];return _0x398006;}import{fileURLToPath}from'url';function a44_0x3682(){const _0x34125e=['../../package.json','Authorization','tdx/','2516535XwBRMV','X-Trino-User','16403wnjHDL','1503660eXyHfP','28GgOnTn','29096NfnZfH','2511vZAYcS','3621653DKEhQi','2331810PAPCrF','replace','95052KDrZtl','length','tdx','entries','version'];a44_0x3682=function(){return _0x34125e;};return a44_0x3682();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0xc538c7=a44_0x3980;try{const _0x4963de=fileURLToPath(import.meta.url),_0x41c693=dirname(_0x4963de),_0x53c3fd=join(_0x41c693,_0xc538c7(0x1a3)),_0xf15eb8=JSON['parse'](readFileSync(_0x53c3fd,'utf-8'));return _0xf15eb8[_0xc538c7(0x1a2)];}catch{return'0.0.0';}}export function getUserAgent(){const _0x555ba4=a44_0x3980,_0x36b529=getVersion(),_0x13f43d=platform(),_0x3b20a5=process[_0x555ba4(0x1a2)][_0x555ba4(0x19d)]('v','');return _0x555ba4(0x1a5)+_0x36b529+'\x20('+_0x13f43d+';\x20node/'+_0x3b20a5+')';}export function getAuthHeaders(_0x6861ca,_0x189e36){const _0x60f046=a44_0x3980,_0x5edb32=getVersion(),_0x16351c={'User-Agent':getUserAgent(),'X-TD-Client':_0x60f046(0x1a0),'X-TD-Client-Version':_0x5edb32};return _0x189e36&&(_0x16351c['Authorization']='TD1\x20'+_0x189e36),_0x16351c;}export function toHeaderRecord(_0x3a05d6){const _0x23810e=a44_0x3980,_0x71258b={};for(const [_0x10f21e,_0x52de10]of Object[_0x23810e(0x1a1)](_0x3a05d6)){_0x52de10!==undefined&&(_0x71258b[_0x10f21e]=_0x52de10);}return _0x71258b;}export function getTrinoHeaders(_0x3f4a09,_0x259314){const _0x42c8da=a44_0x3980,_0x12ad7d=getAuthHeaders(_0x3f4a09,_0x259314),_0x2b2540=toHeaderRecord(_0x12ad7d);return delete _0x2b2540[_0x42c8da(0x1a4)],_0x259314&&(_0x2b2540[_0x42c8da(0x1a7)]=_0x259314),_0x2b2540;}export function hasAPIKey(_0x1e7eee){const _0x3c3fa6=a44_0x3980,_0x240ecf=getAPIKey(_0x1e7eee);return _0x240ecf!==undefined&&_0x240ecf[_0x3c3fa6(0x19f)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x208ad7,_0x2c78a0){const _0x103ab9=a45_0x4312,_0x16b768=_0x208ad7();while(!![]){try{const _0x59efb6=parseInt(_0x103ab9(0x1de))/0x1*(-parseInt(_0x103ab9(0x1df))/0x2)+-parseInt(_0x103ab9(0x1c6))/0x3+parseInt(_0x103ab9(0x196))/0x4*(-parseInt(_0x103ab9(0x1aa))/0x5)+parseInt(_0x103ab9(0x1be))/0x6+-parseInt(_0x103ab9(0x1d0))/0x7*(-parseInt(_0x103ab9(0x1b3))/0x8)+-parseInt(_0x103ab9(0x1a9))/0x9*(parseInt(_0x103ab9(0x19a))/0xa)+-parseInt(_0x103ab9(0x1d1))/0xb*(-parseInt(_0x103ab9(0x1ba))/0xc);if(_0x59efb6===_0x2c78a0)break;else _0x16b768['push'](_0x16b768['shift']());}catch(_0x11dedf){_0x16b768['push'](_0x16b768['shift']());}}}(a45_0x57eb,0x88600));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x418d12 from'node:fs';import*as a45_0x5bd526 from'node:path';import{SITE_ALIASES}from'../types/index.js';function a45_0x4312(_0x4911e5,_0x12971e){_0x4911e5=_0x4911e5-0x191;const _0x57eb0b=a45_0x57eb();let _0x4312d5=_0x57eb0b[_0x4911e5];return _0x4312d5;}import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x2cad6f from'chalk';export function getConfigDir(){const _0x199ac0=a45_0x4312;return process[_0x199ac0(0x1d7)]['TDX_CONFIG_DIR']||join(homedir(),_0x199ac0(0x191),_0x199ac0(0x192));}function a45_0x57eb(){const _0x373d43=['ap02','TDX_API_KEY_<PROFILE>','us01','keychain','50532HYHmcr','accountId','legacy\x20.env\x20file\x20(profile:\x20','.env.','5630658SxzaIY','dev-us01','TD_API_KEY','endsWith','stg-ap03','apiKeys','TDX_API_KEY\x20env\x20var','trim','1295040VFCQPM','entries','account_info.','readFileSync','stg-jp01','ap03','eu01','dev-eu01','stringify','\x20env\x20var','650636yGyZIJ','5599wdOILt','isDeprecated','keychain\x20(profile:\x20','Warning:\x20Failed\x20to\x20read\x20','filter','number','env','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','string','TD_API_KEY\x20env\x20var\x20(deprecated)','llm_default_project','some','.json','5GQkSdL','389622yNnNkd','existsSync','toISOString','.config','tdx','toUpperCase','TD_API_KEY_','utf-8','44CmyRYM','stg-us01','replace','map','90JczQvE','match','apiKey','TDX_API_KEY','parse','yellow','TDX_CACHE_DIR','split','tdx.json','startsWith','jp01','slice','includes','llm_default_project.','.env','199935lKfTuv','501580BymFrh','\x27,\x20defaulting\x20to\x20us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','name','warn','account_info.json','Warning:\x20Unknown\x20site\x20\x27','TDX_API_KEY_','16rWoXme','join','site'];a45_0x57eb=function(){return _0x373d43;};return a45_0x57eb();}export function getConfigFile(){const _0x5d0c2f=a45_0x4312;return join(getConfigDir(),_0x5d0c2f(0x1a8));}export function getConfigFilePath(_0x45e8ea){const _0x5e7777=a45_0x4312,_0x461d3c=getConfigDir();return _0x45e8ea?a45_0x5bd526[_0x5e7777(0x1b4)](_0x461d3c,'.env.'+_0x45e8ea):getConfigFile();}export function getCacheDir(){const _0x4ebf0c=a45_0x4312;return process['env'][_0x4ebf0c(0x1a0)]||join(homedir(),'.cache',_0x4ebf0c(0x192));}export function getLLMProjectCacheFile(_0x4ece6d){const _0x249136=a45_0x4312,_0x48a987=_0x4ece6d?_0x249136(0x1a7)+_0x4ece6d:_0x249136(0x1db);return join(getCacheDir(),_0x48a987);}export function readCachedLLMProject(_0x5da3cc){const _0xc5f33b=a45_0x4312;try{const _0x171aae=getLLMProjectCacheFile(_0x5da3cc);if(!existsSync(_0x171aae))return null;const _0x2232e3=readFileSync(_0x171aae,'utf-8')['trim']();try{const _0xc333b8=JSON[_0xc5f33b(0x19e)](_0x2232e3);if(_0xc333b8&&typeof _0xc333b8['id']==='string'&&typeof _0xc333b8[_0xc5f33b(0x1ae)]===_0xc5f33b(0x1d9))return _0xc333b8;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x272b47,_0x27dd18,_0x3a9897){const _0x13d812=a45_0x4312;try{const _0x4f2f02=getCacheDir(),_0x4ce124=getLLMProjectCacheFile(_0x3a9897);!existsSync(_0x4f2f02)&&mkdirSync(_0x4f2f02,{'recursive':!![]});const _0x53aa88={'name':_0x272b47,'id':_0x27dd18};writeFileSync(_0x4ce124,JSON[_0x13d812(0x1ce)](_0x53aa88),_0x13d812(0x195));}catch{}}export function getAccountInfoCacheFile(_0xd94134){const _0x279903=a45_0x4312,_0x1d760a=_0xd94134?_0x279903(0x1c8)+_0xd94134+_0x279903(0x1dd):_0x279903(0x1b0);return join(getCacheDir(),_0x1d760a);}export function readCachedAccountInfo(_0x2e5274){const _0x4d7c7c=a45_0x4312;try{const _0x40de0a=getAccountInfoCacheFile(_0x2e5274);if(!existsSync(_0x40de0a))return null;const _0x266dc1=readFileSync(_0x40de0a,_0x4d7c7c(0x195))[_0x4d7c7c(0x1c5)](),_0x497175=JSON[_0x4d7c7c(0x19e)](_0x266dc1);if(_0x497175&&typeof _0x497175[_0x4d7c7c(0x1b5)]===_0x4d7c7c(0x1d9)&&typeof _0x497175[_0x4d7c7c(0x1bb)]===_0x4d7c7c(0x1d6))return _0x497175;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xe1c8af,_0xd7bbae,_0x39315e){const _0x52a23d=a45_0x4312;try{const _0x206f41=getCacheDir(),_0x1f9320=getAccountInfoCacheFile(_0x39315e);!existsSync(_0x206f41)&&mkdirSync(_0x206f41,{'recursive':!![]});const _0x33707d={'site':_0xe1c8af,'accountId':_0xd7bbae,'cachedAt':new Date()[_0x52a23d(0x1e1)]()};writeFileSync(_0x1f9320,JSON[_0x52a23d(0x1ce)](_0x33707d),_0x52a23d(0x195));}catch{}}export function parseEnvFile(_0x40d130){const _0x5b42d6=a45_0x4312,_0x298291={};for(const _0x565f72 of _0x40d130[_0x5b42d6(0x1a1)]('\x0a')){const _0x328aef=_0x565f72[_0x5b42d6(0x1c5)]();if(!_0x328aef||_0x328aef[_0x5b42d6(0x1a3)]('#'))continue;const _0x529d70=_0x328aef[_0x5b42d6(0x19b)](/^([^=]+)=(.*)$/);if(_0x529d70){const _0x93c8f0=_0x529d70[0x1]['trim']();let _0x3880bd=_0x529d70[0x2][_0x5b42d6(0x1c5)]();(_0x3880bd[_0x5b42d6(0x1a3)]('\x22')&&_0x3880bd[_0x5b42d6(0x1c1)]('\x22')||_0x3880bd['startsWith']('\x27')&&_0x3880bd[_0x5b42d6(0x1c1)]('\x27'))&&(_0x3880bd=_0x3880bd[_0x5b42d6(0x1a5)](0x1,-0x1)),_0x298291[_0x93c8f0]=_0x3880bd;}}return _0x298291;}export function readUserConfig(){const _0x14b546=a45_0x4312,_0x466ac3=getConfigFile();if(!existsSync(_0x466ac3))return{};try{const _0x1ae776=readFileSync(_0x466ac3,'utf-8');return parseEnvFile(_0x1ae776);}catch(_0x5b749f){return console[_0x14b546(0x1af)](_0x14b546(0x1ac)+_0x466ac3+':',_0x5b749f),{};}}export function resolveSite(_0x165e4d){const _0x29a0ca=a45_0x4312,_0x4d743f=[_0x29a0ca(0x1b8),_0x29a0ca(0x1a4),_0x29a0ca(0x1cc),_0x29a0ca(0x1b6),_0x29a0ca(0x1cb),_0x29a0ca(0x1bf),_0x29a0ca(0x1cd),_0x29a0ca(0x197),_0x29a0ca(0x1ca),_0x29a0ca(0x1c2)];if(_0x4d743f[_0x29a0ca(0x1a6)](_0x165e4d))return _0x165e4d;if(_0x165e4d in SITE_ALIASES)return SITE_ALIASES[_0x165e4d];return console['warn'](_0x29a0ca(0x1b1)+_0x165e4d+_0x29a0ca(0x1ab)),_0x29a0ca(0x1b8);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x19db1a,_0x367d01){const _0xe8ca85=a45_0x4312,_0x138e61=_0x367d01||getActiveProfileName();if(_0x138e61){const _0x29a555=_0xe8ca85(0x1b2)+normalizeProfileForEnvVar(_0x138e61);if(process[_0xe8ca85(0x1d7)][_0x29a555])return process['env'][_0x29a555];}if(process['env'][_0xe8ca85(0x19d)])return process[_0xe8ca85(0x1d7)][_0xe8ca85(0x19d)];if(process[_0xe8ca85(0x1d7)]['TD_API_KEY'])return process[_0xe8ca85(0x1d7)]['TD_API_KEY'];const _0x1bb6c1=_0x19db1a['toUpperCase']()['replace'](/-/g,'_'),_0x42e993=_0xe8ca85(0x194)+_0x1bb6c1;if(_0x138e61){const _0x49716c=loadProfileEnv(_0x138e61);if(_0x49716c){if(_0x49716c[_0x42e993])return _0x49716c[_0x42e993];if(_0x49716c[_0xe8ca85(0x1c0)])return _0x49716c[_0xe8ca85(0x1c0)];}}const _0x14eb6d=loadUserConfigOnce();if(_0x14eb6d[_0x42e993])return _0x14eb6d[_0x42e993];if(_0x14eb6d[_0xe8ca85(0x1c0)])return _0x14eb6d[_0xe8ca85(0x1c0)];return undefined;}export function normalizeProfileForEnvVar(_0xe8775d){const _0x2f2b2f=a45_0x4312;return _0xe8775d[_0x2f2b2f(0x193)]()[_0x2f2b2f(0x198)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x237504,_0x25f1a6){const _0x3be49e=a45_0x4312,_0x3afbd3=_0x25f1a6||getActiveProfileName()||undefined;if(_0x3afbd3){const _0x1a38d5=_0x3be49e(0x1b2)+normalizeProfileForEnvVar(_0x3afbd3);if(process[_0x3be49e(0x1d7)][_0x1a38d5])return{'apiKey':process[_0x3be49e(0x1d7)][_0x1a38d5],'source':_0x1a38d5+_0x3be49e(0x1cf),'isDeprecated':![]};const _0x2c1d25=getCachedCredential(_0x237504,_0x3afbd3);if(_0x2c1d25)return{'apiKey':_0x2c1d25,'source':_0x3be49e(0x1d3)+_0x3afbd3+')','isDeprecated':![]};const _0x59907f=await getKeychainAPIKey(_0x3afbd3);if(_0x59907f)return setCachedCredential(_0x59907f,_0x237504,_0x3afbd3),{'apiKey':_0x59907f,'source':'keychain\x20(profile:\x20'+_0x3afbd3+')','isDeprecated':![]};}if(process[_0x3be49e(0x1d7)][_0x3be49e(0x19d)])return{'apiKey':process['env'][_0x3be49e(0x19d)],'source':_0x3be49e(0x1c4),'isDeprecated':![]};if(!_0x3afbd3){const _0x2b98fc=getCachedCredential(_0x237504,undefined);if(_0x2b98fc)return{'apiKey':_0x2b98fc,'source':_0x3be49e(0x1b9),'isDeprecated':![]};const _0x256d2c=await getKeychainAPIKey(undefined);if(_0x256d2c)return setCachedCredential(_0x256d2c,_0x237504,undefined),{'apiKey':_0x256d2c,'source':_0x3be49e(0x1b9),'isDeprecated':![]};}if(process[_0x3be49e(0x1d7)][_0x3be49e(0x1c0)])return{'apiKey':process['env'][_0x3be49e(0x1c0)],'source':_0x3be49e(0x1da),'isDeprecated':!![]};const _0x18cd99=getLegacyEnvAPIKey(_0x237504,_0x3afbd3);if(_0x18cd99){const _0x41178f=await isKeychainAvailable();if(_0x41178f)try{await saveKeychainAPIKey(_0x18cd99,_0x3afbd3),setCachedCredential(_0x18cd99,_0x237504,_0x3afbd3);const _0x2a014a=getConfigFilePath(_0x3afbd3);cleanupLegacyEnvFile(_0x2a014a)&&console[_0x3be49e(0x1af)](a45_0x2cad6f[_0x3be49e(0x19f)](_0x3be49e(0x1ad)));}catch(_0x1d75b8){console[_0x3be49e(0x1af)](a45_0x2cad6f[_0x3be49e(0x19f)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x1d75b8));}const _0x2eca1a=_0x3afbd3?_0x3be49e(0x1bc)+_0x3afbd3+')':'legacy\x20.env\x20file';return{'apiKey':_0x18cd99,'source':_0x2eca1a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x488125,_0x3e8155,_0x28f667=!![]){const _0x5dbabf=a45_0x4312,_0x5a2482=await resolveAPIKeyAsync(_0x488125,_0x3e8155);if(!_0x5a2482)return undefined;if(_0x28f667&&_0x5a2482[_0x5dbabf(0x1d2)]&&_0x5a2482['source'][_0x5dbabf(0x1a6)](_0x5dbabf(0x1c0))){const _0x55f995=_0x3e8155||getActiveProfileName()||undefined,_0xd32deb=_0x55f995?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x55f995):_0x5dbabf(0x1b7);console[_0x5dbabf(0x1af)](a45_0x2cad6f[_0x5dbabf(0x19f)](_0x5dbabf(0x1d8)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0xd32deb+').')));}return _0x5a2482[_0x5dbabf(0x19c)];}function getLegacyEnvAPIKey(_0x56ce48,_0x2b196a){const _0xdb7b28=a45_0x4312,_0x3db586=_0x56ce48['toUpperCase']()[_0xdb7b28(0x198)](/-/g,'_'),_0x5112d7=_0xdb7b28(0x194)+_0x3db586;if(_0x2b196a){const _0x34cb9e=loadProfileEnv(_0x2b196a);if(_0x34cb9e){if(_0x34cb9e[_0x5112d7])return _0x34cb9e[_0x5112d7];if(_0x34cb9e['TD_API_KEY'])return _0x34cb9e[_0xdb7b28(0x1c0)];}}const _0x32fbda=loadUserConfigOnce();if(_0x32fbda[_0x5112d7])return _0x32fbda[_0x5112d7];if(_0x32fbda['TD_API_KEY'])return _0x32fbda[_0xdb7b28(0x1c0)];return undefined;}function cleanupLegacyEnvFile(_0x5e355){const _0x15285c=a45_0x4312;if(!existsSync(_0x5e355))return![];try{const _0x3c1d4f=readFileSync(_0x5e355,_0x15285c(0x195)),_0x154d17=_0x3c1d4f['split']('\x0a'),_0x47925f=_0x154d17[_0x15285c(0x1d5)](_0x57f856=>{const _0x2e65e6=_0x15285c,_0x267b08=_0x57f856['trim']();if(!_0x267b08||_0x267b08[_0x2e65e6(0x1a3)]('#'))return!![];const [_0x454ad0]=_0x267b08[_0x2e65e6(0x1a1)]('=');return!_0x454ad0[_0x2e65e6(0x1a3)](_0x2e65e6(0x1c0));}),_0x46b5c9=_0x47925f[_0x15285c(0x1dc)](_0x3660ca=>{const _0x435c6f=_0x15285c,_0x40cd05=_0x3660ca[_0x435c6f(0x1c5)]();return _0x40cd05&&!_0x40cd05[_0x435c6f(0x1a3)]('#');});if(!_0x46b5c9)return unlinkSync(_0x5e355),!![];return writeFileSync(_0x5e355,_0x47925f[_0x15285c(0x1b4)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x246712){const _0x810104=a45_0x4312,_0x4357eb=a45_0x5bd526[_0x810104(0x1b4)](getConfigDir(),_0x810104(0x1bd)+_0x246712);if(a45_0x418d12[_0x810104(0x1e0)](_0x4357eb)){validateSecureFilePermissions(_0x4357eb);try{const _0x22723b=a45_0x418d12[_0x810104(0x1c9)](_0x4357eb,_0x810104(0x195));return parseEnvFile(_0x22723b);}catch(_0x1927e9){console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x4357eb+':\x20'+_0x1927e9);}}const _0x238bb6=a45_0x5bd526[_0x810104(0x1b4)](getConfigDir(),'profiles',_0x246712,'.env');if(a45_0x418d12[_0x810104(0x1e0)](_0x238bb6)){validateSecureFilePermissions(_0x238bb6);try{const _0x1f6972=a45_0x418d12['readFileSync'](_0x238bb6,_0x810104(0x195));return parseEnvFile(_0x1f6972);}catch(_0x969448){return console[_0x810104(0x1af)]('Warning:\x20Failed\x20to\x20load\x20'+_0x238bb6+':\x20'+_0x969448),null;}}return null;}function getActiveProfileName(){const _0x123f0b=a45_0x4312,_0x6ebe5f=a45_0x5bd526[_0x123f0b(0x1b4)](getConfigDir(),_0x123f0b(0x1a2));if(!a45_0x418d12[_0x123f0b(0x1e0)](_0x6ebe5f))return null;try{const _0x209674=a45_0x418d12[_0x123f0b(0x1c9)](_0x6ebe5f,_0x123f0b(0x195)),_0x2cb42f=JSON[_0x123f0b(0x19e)](_0x209674);return _0x2cb42f['profile']||null;}catch{return null;}}export function saveAPIKey(_0x24fb4a,_0x29ebc9,_0x34dd55){const _0x4af703=a45_0x4312,_0x3b38f2=getConfigDir(),_0x70ca11=getConfigFilePath(_0x34dd55);!existsSync(_0x3b38f2)&&mkdirSync(_0x3b38f2,{'recursive':!![],'mode':0x1c0});let _0x25fa15={};if(existsSync(_0x70ca11))try{const _0x5ef91c=readFileSync(_0x70ca11,'utf-8');_0x25fa15=parseEnvFile(_0x5ef91c);}catch(_0x59eb89){console[_0x4af703(0x1af)](_0x4af703(0x1d4)+_0x70ca11+':',_0x59eb89);}const _0x1d2c5c=_0x24fb4a[_0x4af703(0x193)]()[_0x4af703(0x198)](/-/g,'_');_0x25fa15[_0x4af703(0x194)+_0x1d2c5c]=_0x29ebc9;const _0x38b568=Object[_0x4af703(0x1c7)](_0x25fa15)[_0x4af703(0x199)](([_0x2f8d7b,_0x265151])=>_0x2f8d7b+'='+_0x265151);writeFileSync(_0x70ca11,_0x38b568['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2f98db,_0x38f4c0,_0x1bf0c3){const _0x2f6747=a45_0x4312;await saveKeychainAPIKey(_0x2f98db,_0x1bf0c3),setCachedCredential(_0x2f98db,_0x38f4c0,_0x1bf0c3);const _0x3ea02a=getConfigFilePath(_0x1bf0c3);cleanupLegacyEnvFile(_0x3ea02a)&&console[_0x2f6747(0x1af)](a45_0x2cad6f['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x43ac3c=a45_0x4312,_0x3194b9={'apiKeys':{},'defaultSite':_0x43ac3c(0x1b8)},_0xfc977e=['us01',_0x43ac3c(0x1a4),_0x43ac3c(0x1cc),_0x43ac3c(0x1b6),_0x43ac3c(0x1cb),'dev-us01',_0x43ac3c(0x1cd),_0x43ac3c(0x197),_0x43ac3c(0x1ca),_0x43ac3c(0x1c2)];for(const _0x4e8a35 of _0xfc977e){const _0x36f775=getAPIKey(_0x4e8a35);_0x36f775&&(_0x3194b9[_0x43ac3c(0x1c3)][_0x4e8a35]=_0x36f775);}return _0x3194b9;}
|
|
1
|
+
(function(_0x1e1ff4,_0x12c630){const _0x396976=a45_0x15c5,_0x1b9e77=_0x1e1ff4();while(!![]){try{const _0x4c904e=-parseInt(_0x396976(0x107))/0x1*(parseInt(_0x396976(0x105))/0x2)+parseInt(_0x396976(0xc5))/0x3*(-parseInt(_0x396976(0xf5))/0x4)+parseInt(_0x396976(0xff))/0x5*(parseInt(_0x396976(0xea))/0x6)+-parseInt(_0x396976(0xf8))/0x7*(-parseInt(_0x396976(0xb8))/0x8)+parseInt(_0x396976(0xd1))/0x9*(parseInt(_0x396976(0xfd))/0xa)+-parseInt(_0x396976(0xe9))/0xb*(parseInt(_0x396976(0xe2))/0xc)+parseInt(_0x396976(0xd3))/0xd*(parseInt(_0x396976(0xca))/0xe);if(_0x4c904e===_0x12c630)break;else _0x1b9e77['push'](_0x1b9e77['shift']());}catch(_0x1e851f){_0x1b9e77['push'](_0x1b9e77['shift']());}}}(a45_0x5d6e,0xe0026));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x3241dd from'node:fs';import*as a45_0x71f558 from'node:path';function a45_0x5d6e(){const _0x35b775=['site','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','TD_API_KEY_','14WKvlvU','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','source','profiles','apiKey','tdx.json','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','36GcblKi','startsWith','11045879eLDmIE','us01','entries','parse','some','Warning:\x20Failed\x20to\x20read\x20','TDX_CACHE_DIR','endsWith','.env.','keychain\x20(profile:\x20','filter','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_API_KEY_','\x20env\x20var','stg-jp01','33972ozJiNi','TDX_API_KEY\x20env\x20var','warn','TDX_CONFIG_DIR','join','yellow','toUpperCase','2629TilmCp','43698mtpURh','dev-us01','dev-eu01','readFileSync','TD_API_KEY\x20env\x20var\x20(deprecated)','stg-ap03','apiKeys','llm_default_project.','.cache','keychain','name','3067532PMNXMk','existsSync','stg-us01','7lTPKgP','TDX_API_KEY','includes','legacy\x20.env\x20file','jp01','3987930gCKdqw','account_info.json','20BNESqO','llm_default_project','slice','stringify','string','\x27,\x20defaulting\x20to\x20us01','6TBmoGN','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','396682BUkJyV','accountId','split','tdx','8616744MKOgiO','replace','map','.json','Warning:\x20Unknown\x20site\x20\x27','ap02','TD_API_KEY','trim','env','eu01','number','ap03','utf-8','3wRrtIb','.config'];a45_0x5d6e=function(){return _0x35b775;};return a45_0x5d6e();}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_0x5a6362 from'chalk';export function getConfigDir(){const _0x256155=a45_0x15c5;return process[_0x256155(0xc0)][_0x256155(0xe5)]||join(homedir(),_0x256155(0xc6),_0x256155(0x10a));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x48cfb1){const _0x4cb2a9=a45_0x15c5,_0xe9d57c=getConfigDir();return _0x48cfb1?a45_0x71f558[_0x4cb2a9(0xe6)](_0xe9d57c,_0x4cb2a9(0xdb)+_0x48cfb1):getConfigFile();}export function getCacheDir(){const _0x19a07e=a45_0x15c5;return process[_0x19a07e(0xc0)][_0x19a07e(0xd9)]||join(homedir(),_0x19a07e(0xf2),_0x19a07e(0x10a));}export function getLLMProjectCacheFile(_0x4c7a47){const _0x1d5794=a45_0x15c5,_0x46968f=_0x4c7a47?_0x1d5794(0xf1)+_0x4c7a47:_0x1d5794(0x100);return join(getCacheDir(),_0x46968f);}export function readCachedLLMProject(_0x5d4961){const _0x2178fe=a45_0x15c5;try{const _0xc0ae09=getLLMProjectCacheFile(_0x5d4961);if(!existsSync(_0xc0ae09))return null;const _0x580f49=readFileSync(_0xc0ae09,_0x2178fe(0xc4))[_0x2178fe(0xbf)]();try{const _0x5659cd=JSON[_0x2178fe(0xd6)](_0x580f49);if(_0x5659cd&&typeof _0x5659cd['id']===_0x2178fe(0x103)&&typeof _0x5659cd[_0x2178fe(0xf4)]===_0x2178fe(0x103))return _0x5659cd;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x409cab,_0x922947,_0x5b5d5a){const _0x5e6541=a45_0x15c5;try{const _0x28cbec=getCacheDir(),_0x54ea0b=getLLMProjectCacheFile(_0x5b5d5a);!existsSync(_0x28cbec)&&mkdirSync(_0x28cbec,{'recursive':!![]});const _0x3ec66e={'name':_0x409cab,'id':_0x922947};writeFileSync(_0x54ea0b,JSON[_0x5e6541(0x102)](_0x3ec66e),_0x5e6541(0xc4));}catch{}}export function getAccountInfoCacheFile(_0x22cfb2){const _0x1b5a56=a45_0x15c5,_0x3614df=_0x22cfb2?'account_info.'+_0x22cfb2+_0x1b5a56(0xbb):_0x1b5a56(0xfe);return join(getCacheDir(),_0x3614df);}export function readCachedAccountInfo(_0x5a09d0){const _0x367d26=a45_0x15c5;try{const _0x52b753=getAccountInfoCacheFile(_0x5a09d0);if(!existsSync(_0x52b753))return null;const _0x4a9111=readFileSync(_0x52b753,'utf-8')[_0x367d26(0xbf)](),_0xba6bc7=JSON['parse'](_0x4a9111);if(_0xba6bc7&&typeof _0xba6bc7[_0x367d26(0xc7)]===_0x367d26(0x103)&&typeof _0xba6bc7[_0x367d26(0x108)]===_0x367d26(0xc2))return _0xba6bc7;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x1c69d8,_0x246dc6,_0x5f9737){const _0xf48100=a45_0x15c5;try{const _0x2308b1=getCacheDir(),_0x54c0f2=getAccountInfoCacheFile(_0x5f9737);!existsSync(_0x2308b1)&&mkdirSync(_0x2308b1,{'recursive':!![]});const _0x59c084={'site':_0x1c69d8,'accountId':_0x246dc6,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x54c0f2,JSON[_0xf48100(0x102)](_0x59c084),_0xf48100(0xc4));}catch{}}export function parseEnvFile(_0x5ece61){const _0x2e15eb=a45_0x15c5,_0x1975dd={};for(const _0x39511c of _0x5ece61[_0x2e15eb(0x109)]('\x0a')){const _0x1b3ab5=_0x39511c[_0x2e15eb(0xbf)]();if(!_0x1b3ab5||_0x1b3ab5[_0x2e15eb(0xd2)]('#'))continue;const _0x18e176=_0x1b3ab5['match'](/^([^=]+)=(.*)$/);if(_0x18e176){const _0x4dde11=_0x18e176[0x1][_0x2e15eb(0xbf)]();let _0x4e51e1=_0x18e176[0x2][_0x2e15eb(0xbf)]();(_0x4e51e1[_0x2e15eb(0xd2)]('\x22')&&_0x4e51e1['endsWith']('\x22')||_0x4e51e1[_0x2e15eb(0xd2)]('\x27')&&_0x4e51e1[_0x2e15eb(0xda)]('\x27'))&&(_0x4e51e1=_0x4e51e1[_0x2e15eb(0x101)](0x1,-0x1)),_0x1975dd[_0x4dde11]=_0x4e51e1;}}return _0x1975dd;}export function readUserConfig(){const _0x8b888c=a45_0x15c5,_0x8c53a2=getConfigFile();if(!existsSync(_0x8c53a2))return{};try{const _0x2cb209=readFileSync(_0x8c53a2,_0x8b888c(0xc4));return parseEnvFile(_0x2cb209);}catch(_0x337f8c){return console[_0x8b888c(0xe4)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x8c53a2+':',_0x337f8c),{};}}export function resolveSite(_0x44ee50){const _0x52215f=a45_0x15c5,_0x3f2f0e=[_0x52215f(0xd4),_0x52215f(0xfc),_0x52215f(0xc1),_0x52215f(0xbd),_0x52215f(0xc3),'dev-us01',_0x52215f(0xec),_0x52215f(0xf7),_0x52215f(0xe1),_0x52215f(0xef)];if(_0x3f2f0e[_0x52215f(0xfa)](_0x44ee50))return _0x44ee50;if(_0x44ee50 in SITE_ALIASES)return SITE_ALIASES[_0x44ee50];return console['warn'](_0x52215f(0xbc)+_0x44ee50+_0x52215f(0x104)),_0x52215f(0xd4);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2e8d04,_0x54bd3f){const _0x1daca4=a45_0x15c5,_0x328775=_0x54bd3f||getActiveProfileName();if(_0x328775){const _0x1b6765=_0x1daca4(0xdf)+normalizeProfileForEnvVar(_0x328775);if(process[_0x1daca4(0xc0)][_0x1b6765])return process[_0x1daca4(0xc0)][_0x1b6765];}if(process['env']['TDX_API_KEY'])return process[_0x1daca4(0xc0)][_0x1daca4(0xf9)];if(process[_0x1daca4(0xc0)][_0x1daca4(0xbe)])return process[_0x1daca4(0xc0)][_0x1daca4(0xbe)];const _0x90408c=_0x2e8d04[_0x1daca4(0xe8)]()['replace'](/-/g,'_'),_0x2c9629=_0x1daca4(0xc9)+_0x90408c;if(_0x328775){const _0x35879b=loadProfileEnv(_0x328775);if(_0x35879b){if(_0x35879b[_0x2c9629])return _0x35879b[_0x2c9629];if(_0x35879b['TD_API_KEY'])return _0x35879b[_0x1daca4(0xbe)];}}const _0x4d7d1d=loadUserConfigOnce();if(_0x4d7d1d[_0x2c9629])return _0x4d7d1d[_0x2c9629];if(_0x4d7d1d[_0x1daca4(0xbe)])return _0x4d7d1d[_0x1daca4(0xbe)];return undefined;}export function normalizeProfileForEnvVar(_0x24dc0e){const _0x16be70=a45_0x15c5;return _0x24dc0e[_0x16be70(0xe8)]()[_0x16be70(0xb9)](/[^A-Z0-9]/g,'_');}function a45_0x15c5(_0x915f48,_0x1ba9dc){_0x915f48=_0x915f48-0xb8;const _0x5d6e74=a45_0x5d6e();let _0x15c5d3=_0x5d6e74[_0x915f48];return _0x15c5d3;}export async function resolveAPIKeyAsync(_0x18982d,_0x31252c){const _0x2cdc6b=a45_0x15c5,_0x1ee92d=_0x31252c||getActiveProfileName()||undefined;if(_0x1ee92d){const _0x2cbe74=_0x2cdc6b(0xdf)+normalizeProfileForEnvVar(_0x1ee92d);if(process['env'][_0x2cbe74])return{'apiKey':process[_0x2cdc6b(0xc0)][_0x2cbe74],'source':_0x2cbe74+_0x2cdc6b(0xe0),'isDeprecated':![]};const _0x47c146=getCachedCredential(_0x18982d,_0x1ee92d);if(_0x47c146)return{'apiKey':_0x47c146,'source':_0x2cdc6b(0xdc)+_0x1ee92d+')','isDeprecated':![]};const _0x385bbf=await getKeychainAPIKey(_0x1ee92d);if(_0x385bbf)return setCachedCredential(_0x385bbf,_0x18982d,_0x1ee92d),{'apiKey':_0x385bbf,'source':_0x2cdc6b(0xdc)+_0x1ee92d+')','isDeprecated':![]};}if(process[_0x2cdc6b(0xc0)]['TDX_API_KEY'])return{'apiKey':process['env'][_0x2cdc6b(0xf9)],'source':_0x2cdc6b(0xe3),'isDeprecated':![]};if(!_0x1ee92d){const _0x19167c=getCachedCredential(_0x18982d,undefined);if(_0x19167c)return{'apiKey':_0x19167c,'source':_0x2cdc6b(0xf3),'isDeprecated':![]};const _0x337c74=await getKeychainAPIKey(undefined);if(_0x337c74)return setCachedCredential(_0x337c74,_0x18982d,undefined),{'apiKey':_0x337c74,'source':_0x2cdc6b(0xf3),'isDeprecated':![]};}if(process[_0x2cdc6b(0xc0)][_0x2cdc6b(0xbe)])return{'apiKey':process[_0x2cdc6b(0xc0)][_0x2cdc6b(0xbe)],'source':_0x2cdc6b(0xee),'isDeprecated':!![]};const _0x363db5=getLegacyEnvAPIKey(_0x18982d,_0x1ee92d);if(_0x363db5){const _0x43e69d=await isKeychainAvailable();if(_0x43e69d)try{await saveKeychainAPIKey(_0x363db5,_0x1ee92d),setCachedCredential(_0x363db5,_0x18982d,_0x1ee92d);const _0x439691=getConfigFilePath(_0x1ee92d);cleanupLegacyEnvFile(_0x439691)&&console[_0x2cdc6b(0xe4)](a45_0x5a6362[_0x2cdc6b(0xe7)](_0x2cdc6b(0x106)));}catch(_0x438168){console[_0x2cdc6b(0xe4)](a45_0x5a6362[_0x2cdc6b(0xe7)](_0x2cdc6b(0xcb)+_0x438168));}const _0x428e0a=_0x1ee92d?'legacy\x20.env\x20file\x20(profile:\x20'+_0x1ee92d+')':_0x2cdc6b(0xfb);return{'apiKey':_0x363db5,'source':_0x428e0a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x47f1a5,_0x5cd59e,_0x498792=!![]){const _0x235667=a45_0x15c5,_0x345f1e=await resolveAPIKeyAsync(_0x47f1a5,_0x5cd59e);if(!_0x345f1e)return undefined;if(_0x498792&&_0x345f1e['isDeprecated']&&_0x345f1e[_0x235667(0xcc)]['includes'](_0x235667(0xbe))){const _0x2eabcf=_0x5cd59e||getActiveProfileName()||undefined,_0x238be3=_0x2eabcf?_0x235667(0xdf)+normalizeProfileForEnvVar(_0x2eabcf):'TDX_API_KEY_<PROFILE>';console[_0x235667(0xe4)](a45_0x5a6362[_0x235667(0xe7)](_0x235667(0xc8)+(_0x235667(0xd0)+_0x238be3+').')));}return _0x345f1e[_0x235667(0xce)];}function getLegacyEnvAPIKey(_0x42b361,_0x221224){const _0x16ba55=a45_0x15c5,_0x242b9c=_0x42b361['toUpperCase']()[_0x16ba55(0xb9)](/-/g,'_'),_0x3f91aa=_0x16ba55(0xc9)+_0x242b9c;if(_0x221224){const _0x4da2ad=loadProfileEnv(_0x221224);if(_0x4da2ad){if(_0x4da2ad[_0x3f91aa])return _0x4da2ad[_0x3f91aa];if(_0x4da2ad[_0x16ba55(0xbe)])return _0x4da2ad[_0x16ba55(0xbe)];}}const _0x2165ec=loadUserConfigOnce();if(_0x2165ec[_0x3f91aa])return _0x2165ec[_0x3f91aa];if(_0x2165ec[_0x16ba55(0xbe)])return _0x2165ec[_0x16ba55(0xbe)];return undefined;}function cleanupLegacyEnvFile(_0x4fb33a){const _0x1035d7=a45_0x15c5;if(!existsSync(_0x4fb33a))return![];try{const _0x685e7e=readFileSync(_0x4fb33a,_0x1035d7(0xc4)),_0x549737=_0x685e7e[_0x1035d7(0x109)]('\x0a'),_0xa0c758=_0x549737[_0x1035d7(0xdd)](_0x207533=>{const _0xcff125=_0x1035d7,_0x28c4bc=_0x207533[_0xcff125(0xbf)]();if(!_0x28c4bc||_0x28c4bc[_0xcff125(0xd2)]('#'))return!![];const [_0x573657]=_0x28c4bc[_0xcff125(0x109)]('=');return!_0x573657[_0xcff125(0xd2)]('TD_API_KEY');}),_0x5beaf7=_0xa0c758[_0x1035d7(0xd7)](_0xe5f56a=>{const _0x212dfd=_0xe5f56a['trim']();return _0x212dfd&&!_0x212dfd['startsWith']('#');});if(!_0x5beaf7)return unlinkSync(_0x4fb33a),!![];return writeFileSync(_0x4fb33a,_0xa0c758[_0x1035d7(0xe6)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x353262){const _0x3c208a=a45_0x15c5,_0x1101e7=a45_0x71f558[_0x3c208a(0xe6)](getConfigDir(),_0x3c208a(0xdb)+_0x353262);if(a45_0x3241dd[_0x3c208a(0xf6)](_0x1101e7)){validateSecureFilePermissions(_0x1101e7);try{const _0x220df8=a45_0x3241dd[_0x3c208a(0xed)](_0x1101e7,'utf-8');return parseEnvFile(_0x220df8);}catch(_0x28aaba){console[_0x3c208a(0xe4)]('Warning:\x20Failed\x20to\x20load\x20'+_0x1101e7+':\x20'+_0x28aaba);}}const _0x22fdac=a45_0x71f558[_0x3c208a(0xe6)](getConfigDir(),_0x3c208a(0xcd),_0x353262,'.env');if(a45_0x3241dd[_0x3c208a(0xf6)](_0x22fdac)){validateSecureFilePermissions(_0x22fdac);try{const _0x289fae=a45_0x3241dd[_0x3c208a(0xed)](_0x22fdac,_0x3c208a(0xc4));return parseEnvFile(_0x289fae);}catch(_0x3ce68b){return console[_0x3c208a(0xe4)]('Warning:\x20Failed\x20to\x20load\x20'+_0x22fdac+':\x20'+_0x3ce68b),null;}}return null;}function getActiveProfileName(){const _0x4951d5=a45_0x15c5,_0x63f5e=a45_0x71f558[_0x4951d5(0xe6)](getConfigDir(),_0x4951d5(0xcf));if(!a45_0x3241dd[_0x4951d5(0xf6)](_0x63f5e))return null;try{const _0x32b386=a45_0x3241dd[_0x4951d5(0xed)](_0x63f5e,'utf-8'),_0x1ff59b=JSON[_0x4951d5(0xd6)](_0x32b386);return _0x1ff59b['profile']||null;}catch{return null;}}export function saveAPIKey(_0x2a326e,_0x2749f8,_0x7c267e){const _0x3ebae7=a45_0x15c5,_0x3e4b4d=getConfigDir(),_0x4dc0dc=getConfigFilePath(_0x7c267e);!existsSync(_0x3e4b4d)&&mkdirSync(_0x3e4b4d,{'recursive':!![],'mode':0x1c0});let _0x21d997={};if(existsSync(_0x4dc0dc))try{const _0x41891d=readFileSync(_0x4dc0dc,_0x3ebae7(0xc4));_0x21d997=parseEnvFile(_0x41891d);}catch(_0x5688d3){console['warn'](_0x3ebae7(0xd8)+_0x4dc0dc+':',_0x5688d3);}const _0x35c91d=_0x2a326e[_0x3ebae7(0xe8)]()[_0x3ebae7(0xb9)](/-/g,'_');_0x21d997[_0x3ebae7(0xc9)+_0x35c91d]=_0x2749f8;const _0x398cf9=Object[_0x3ebae7(0xd5)](_0x21d997)[_0x3ebae7(0xba)](([_0x5f5c73,_0x3908d3])=>_0x5f5c73+'='+_0x3908d3);writeFileSync(_0x4dc0dc,_0x398cf9[_0x3ebae7(0xe6)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x3b587c,_0x1632da,_0x33c14b){const _0x629d92=a45_0x15c5;await saveKeychainAPIKey(_0x3b587c,_0x33c14b),setCachedCredential(_0x3b587c,_0x1632da,_0x33c14b);const _0x396486=getConfigFilePath(_0x33c14b);cleanupLegacyEnvFile(_0x396486)&&console['warn'](a45_0x5a6362['yellow'](_0x629d92(0xde)));}export function loadConfig(){const _0x2c773b=a45_0x15c5,_0xddf1be={'apiKeys':{},'defaultSite':_0x2c773b(0xd4)},_0x25d042=[_0x2c773b(0xd4),'jp01','eu01','ap02',_0x2c773b(0xc3),_0x2c773b(0xeb),_0x2c773b(0xec),'stg-us01','stg-jp01',_0x2c773b(0xef)];for(const _0x7f37f4 of _0x25d042){const _0x333dc0=getAPIKey(_0x7f37f4);_0x333dc0&&(_0xddf1be[_0x2c773b(0xf0)][_0x7f37f4]=_0x333dc0);}return _0xddf1be;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a46_0x45b8(){const _0x395507=['connections','6324590xkAmzK','stringify','46554ohzjvD','parse','39GNQkxu','475021ydJHpy','1908186VsiTOe','12023330fMEYON','9269144fJvCJs','utf-8','7028073bjZJIA','4tWpoTY','connections-','now','.json','7znEQWe'];a46_0x45b8=function(){return _0x395507;};return a46_0x45b8();}(function(_0x4810fe,_0x80fb13){const _0x641c54=a46_0x3a47,_0x4e2390=_0x4810fe();while(!![]){try{const _0x43caff=-parseInt(_0x641c54(0x1d8))/0x1+-parseInt(_0x641c54(0x1d5))/0x2*(-parseInt(_0x641c54(0x1d7))/0x3)+-parseInt(_0x641c54(0x1cd))/0x4*(-parseInt(_0x641c54(0x1d3))/0x5)+parseInt(_0x641c54(0x1d9))/0x6+-parseInt(_0x641c54(0x1d1))/0x7*(parseInt(_0x641c54(0x1db))/0x8)+-parseInt(_0x641c54(0x1cc))/0x9+parseInt(_0x641c54(0x1da))/0xa;if(_0x43caff===_0x80fb13)break;else _0x4e2390['push'](_0x4e2390['shift']());}catch(_0x18f56b){_0x4e2390['push'](_0x4e2390['shift']());}}}(a46_0x45b8,0xa462a));function a46_0x3a47(_0x3134c9,_0x529739){_0x3134c9=_0x3134c9-0x1cc;const _0x45b8e9=a46_0x45b8();let _0x3a471b=_0x45b8e9[_0x3134c9];return _0x3a471b;}import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x547cf1){const _0xbd7cf1=a46_0x3a47,_0x4d416d=_0x547cf1||'default';return join(getCacheDir(),_0xbd7cf1(0x1ce)+_0x4d416d+_0xbd7cf1(0x1d0));}export function loadCachedConnections(_0x238004){const _0x49c1b2=a46_0x3a47,_0x23fd7b=getCacheFilePath(_0x238004);if(!existsSync(_0x23fd7b))return null;try{const _0x4f8edc=readFileSync(_0x23fd7b,_0x49c1b2(0x1dc)),_0x14644d=JSON[_0x49c1b2(0x1d6)](_0x4f8edc);return _0x14644d[_0x49c1b2(0x1d2)];}catch{return null;}}export function saveCachedConnections(_0x3f4714,_0x5cf131){const _0x4de7c5=a46_0x3a47,_0x35a120=getCacheDir();!existsSync(_0x35a120)&&mkdirSync(_0x35a120,{'recursive':!![]});const _0x5f0a2c=getCacheFilePath(_0x3f4714),_0x1e11a7={'connections':_0x5cf131,'cachedAt':Date[_0x4de7c5(0x1cf)]()};writeFileSync(_0x5f0a2c,JSON[_0x4de7c5(0x1d4)](_0x1e11a7,null,0x2),_0x4de7c5(0x1dc));}export function clearConnectionCache(_0x15bb60){const _0x376878=getCacheFilePath(_0x15bb60);if(existsSync(_0x376878))try{unlinkSync(_0x376878);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x51a977,_0x222714){const _0x23a81a=a47_0xe08d,_0x3e38c5=_0x51a977();while(!![]){try{const _0x240923=parseInt(_0x23a81a(0x17e))/0x1+parseInt(_0x23a81a(0x180))/0x2+parseInt(_0x23a81a(0x176))/0x3*(-parseInt(_0x23a81a(0x179))/0x4)+parseInt(_0x23a81a(0x173))/0x5+parseInt(_0x23a81a(0x17c))/0x6+parseInt(_0x23a81a(0x175))/0x7+parseInt(_0x23a81a(0x178))/0x8*(-parseInt(_0x23a81a(0x17f))/0x9);if(_0x240923===_0x222714)break;else _0x3e38c5['push'](_0x3e38c5['shift']());}catch(_0x479bb6){_0x3e38c5['push'](_0x3e38c5['shift']());}}}(a47_0x5de4,0x3c5ae));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a47_0x5de4(){const _0x19a3df=['60RQXqZL','__default_profile__','loadedAt','2438502PIidjg','now','45413XOZgmi','19233OwWEZf','716330PEMDQN','clear','set','1926220ZBkRDb','__default_site__','2967307eDlEay','59403qrPKYr','delete','4024FCAmHl'];a47_0x5de4=function(){return _0x19a3df;};return a47_0x5de4();}function getCacheKey(_0x5c4e37,_0x570d40){const _0x1ce5c9=a47_0xe08d,_0x36f6bc=_0x5c4e37||_0x1ce5c9(0x174),_0x50364e=_0x570d40||_0x1ce5c9(0x17a);return _0x36f6bc+':'+_0x50364e;}export function getCachedCredential(_0x3cb829,_0x28d144){const _0xeaf6f8=a47_0xe08d,_0x546e19=getCacheKey(_0x3cb829,_0x28d144),_0x5acb42=cache['get'](_0x546e19);if(!_0x5acb42)return null;if(Date['now']()-_0x5acb42[_0xeaf6f8(0x17b)]>CACHE_TTL_MS)return cache[_0xeaf6f8(0x177)](_0x546e19),null;return _0x5acb42['apiKey'];}export function setCachedCredential(_0xecb2b2,_0x1ac7a9,_0x32369c){const _0x4d209b=a47_0xe08d,_0x34a13a=getCacheKey(_0x1ac7a9,_0x32369c);cache[_0x4d209b(0x182)](_0x34a13a,{'apiKey':_0xecb2b2,'loadedAt':Date[_0x4d209b(0x17d)]()});}function a47_0xe08d(_0x339863,_0x382187){_0x339863=_0x339863-0x173;const _0x5de4ff=a47_0x5de4();let _0xe08d27=_0x5de4ff[_0x339863];return _0xe08d27;}export function clearCredentialCache(){const _0x156cae=a47_0xe08d;cache[_0x156cae(0x181)]();}export function clearCachedCredential(_0x54e70a,_0x5d00de){const _0x1ad3a1=a47_0xe08d,_0x43226c=getCacheKey(_0x54e70a,_0x5d00de);cache[_0x1ad3a1(0x177)](_0x43226c);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a48_0x554303=a48_0x502d;function a48_0x3067(){const _0x3c17ad=['parse','config','95NXGGee','profiles','string','apiKey','cliFlags','27059BWIgfL','configFiles','1709834AWEceY','Project','.json','parentSegment','(active)','profileCredentials',':\x20none\x20(using\x20session:\x20','site','Profile','log','global','verbose','Profile\x20Credentials','Session','not\x20set','injectIntoOptions','340400XvUbiD','us01','getSource','12tHtlEv','60BLLwAP','logLevel','loadGlobalConfig','Global\x20Credentials','CLI\x20flag:\x20--','profile','entries','display','350OPfgIZ','displayWithSources','globalCredentials','join','layers','tdx.json','activeProfile','profile:\x20','getParameters','resolveAPIKeyAsync','9FgJDFt','Global','llmProject','8UQflzz','existsSync','default','project','session','(session:\x20','2199790bbSenn','llm_project','toString','1443233JPYxqr','segmentPath','segment_path','8NwzeaD','148002nlQHzJ','utf-8','database','517907iznmjz','parent_segment','sessions','sessionId','\x0a[configuration\x20files]'];a48_0x3067=function(){return _0x3c17ad;};return a48_0x3067();}(function(_0x941bbd,_0x392cca){const _0x1dbd42=a48_0x502d,_0x5508dc=_0x941bbd();while(!![]){try{const _0x1daa09=-parseInt(_0x1dbd42(0x180))/0x1*(parseInt(_0x1dbd42(0x1b7))/0x2)+parseInt(_0x1dbd42(0x195))/0x3*(parseInt(_0x1dbd42(0x192))/0x4)+-parseInt(_0x1dbd42(0x17b))/0x5*(-parseInt(_0x1dbd42(0x1b8))/0x6)+parseInt(_0x1dbd42(0x182))/0x7*(parseInt(_0x1dbd42(0x1ab))/0x8)+parseInt(_0x1dbd42(0x1a8))/0x9*(-parseInt(_0x1dbd42(0x1b1))/0xa)+parseInt(_0x1dbd42(0x1b4))/0xb*(parseInt(_0x1dbd42(0x196))/0xc)+parseInt(_0x1dbd42(0x1bb))/0xd*(-parseInt(_0x1dbd42(0x19e))/0xe);if(_0x1daa09===_0x392cca)break;else _0x5508dc['push'](_0x5508dc['shift']());}catch(_0x489d29){_0x5508dc['push'](_0x5508dc['shift']());}}}(a48_0x3067,0x5e088));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a48_0x502d(_0x41f36d,_0x5b567b){_0x41f36d=_0x41f36d-0x17a;const _0x306724=a48_0x3067();let _0x502dab=_0x306724[_0x41f36d];return _0x502dab;}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x55bdec from'node:fs';import*as a48_0x3cc280 from'node:path';export class GlobalContext{['site'];[a48_0x554303(0x1ba)];[a48_0x554303(0x1bc)];[a48_0x554303(0x1b6)];['llm_project'];[a48_0x554303(0x17e)];[a48_0x554303(0x18d)];['logLevel'];[a48_0x554303(0x19b)];[a48_0x554303(0x1a2)];[a48_0x554303(0x1a4)];[a48_0x554303(0x1be)];[a48_0x554303(0x181)];constructor(_0x459805){const _0x41433b=a48_0x554303;this['sessionId']=_0x459805[_0x41433b(0x1af)]||getCurrentSessionPID()[_0x41433b(0x1b3)]();const _0x5f5b3c=loadSessionContext(_0x459805['session']),_0x414a92=loadProjectConfig(),_0x1eb927=this[_0x41433b(0x198)]();this['activeProfile']=_0x459805[_0x41433b(0x19b)]||_0x5f5b3c?.[_0x41433b(0x19b)]||_0x1eb927[_0x41433b(0x19b)]||getActiveProfile();const _0x4dbd06=this[_0x41433b(0x1a4)]?loadProfile(this[_0x41433b(0x1a4)]):null,_0x4bffc2=_0xfa4260=>{const _0x5a676f=_0x41433b;if(!_0xfa4260)return{};const _0x4ac57b=_0xfa4260,_0x10d105={};for(const [_0x584a82,_0x28df22]of Object[_0x5a676f(0x19c)](_0x4ac57b)){typeof _0x28df22===_0x5a676f(0x17d)&&(_0x10d105[_0x584a82]=_0x28df22);}return _0x10d105;},_0x517aab={};if(_0x459805[_0x41433b(0x189)]&&_0x459805['site']!==_0x41433b(0x193))_0x517aab[_0x41433b(0x189)]=_0x459805['site'];const _0x1ae2d7=_0x5f5b3c?.[_0x41433b(0x1ba)],_0x13c5dc=_0x414a92?.[_0x41433b(0x1ba)],_0x122f80=_0x4dbd06?.[_0x41433b(0x17a)]?.[_0x41433b(0x1ba)],_0x46dfcc=_0x1eb927[_0x41433b(0x1ba)];_0x459805[_0x41433b(0x1ba)]&&(_0x459805['database']!==_0x1ae2d7&&_0x459805[_0x41433b(0x1ba)]!==_0x13c5dc&&_0x459805[_0x41433b(0x1ba)]!==_0x122f80&&_0x459805[_0x41433b(0x1ba)]!==_0x46dfcc)&&(_0x517aab['database']=_0x459805[_0x41433b(0x1ba)]);if(_0x459805[_0x41433b(0x185)])_0x517aab[_0x41433b(0x1bc)]=_0x459805[_0x41433b(0x185)];if(_0x459805['llmProject'])_0x517aab[_0x41433b(0x1b2)]=_0x459805['llmProject'];if(_0x459805['profile'])_0x517aab[_0x41433b(0x19b)]=_0x459805['profile'];this['layers']={'cliFlags':_0x517aab,'session':_0x4bffc2(_0x5f5b3c),'project':_0x4bffc2(_0x414a92),'profile':_0x4bffc2(_0x4dbd06?.[_0x41433b(0x17a)]),'global':_0x4bffc2(_0x1eb927)};const _0x497918={...this[_0x41433b(0x1a2)]['global'],...this[_0x41433b(0x1a2)][_0x41433b(0x19b)],...this[_0x41433b(0x1a2)]['project'],...this[_0x41433b(0x1a2)][_0x41433b(0x1af)],...this['layers'][_0x41433b(0x17f)]},_0x330490=_0x497918[_0x41433b(0x189)]||'us01';this[_0x41433b(0x189)]=resolveSite(_0x330490),this['database']=_0x497918[_0x41433b(0x1ba)],this[_0x41433b(0x1bc)]=_0x497918[_0x41433b(0x1bc)],this[_0x41433b(0x1b6)]=_0x497918['segment_path'],this[_0x41433b(0x1b2)]=_0x497918[_0x41433b(0x1b2)],this[_0x41433b(0x18d)]=_0x459805[_0x41433b(0x18d)]||![],this['logLevel']=_0x459805[_0x41433b(0x197)]??LogLevel['INFO'],this[_0x41433b(0x19b)]=this[_0x41433b(0x1a4)]||undefined,this[_0x41433b(0x17e)]=getAPIKey(this[_0x41433b(0x189)],this[_0x41433b(0x1a4)]||undefined);const _0x2f0866=getConfigDir(),_0x3ed206=a48_0x3cc280['join'](_0x2f0866,_0x41433b(0x1bd),this[_0x41433b(0x1be)]+_0x41433b(0x184)),_0x15500=findProjectConfigPath(),_0x54871c=a48_0x3cc280[_0x41433b(0x1a1)](_0x2f0866,_0x41433b(0x1a3)),_0x2c4fc6=a48_0x3cc280[_0x41433b(0x1a1)](_0x2f0866,'.env');let _0x532869=null,_0x396a58=null;this[_0x41433b(0x1a4)]&&(_0x532869=a48_0x3cc280[_0x41433b(0x1a1)](_0x2f0866,_0x41433b(0x17c),this['activeProfile'],_0x41433b(0x1a3)),_0x396a58=a48_0x3cc280['join'](_0x2f0866,_0x41433b(0x17c),this[_0x41433b(0x1a4)],'.env')),this[_0x41433b(0x181)]={'session':a48_0x55bdec[_0x41433b(0x1ac)](_0x3ed206)?_0x3ed206:null,'project':_0x15500,'profile':_0x532869&&a48_0x55bdec['existsSync'](_0x532869)?_0x532869:null,'profileCredentials':_0x396a58&&a48_0x55bdec[_0x41433b(0x1ac)](_0x396a58)?_0x396a58:null,'global':a48_0x55bdec['existsSync'](_0x54871c)?_0x54871c:null,'globalCredentials':a48_0x55bdec['existsSync'](_0x2c4fc6)?_0x2c4fc6:null};}[a48_0x554303(0x194)](_0x59e088,_0x25151a){const _0x551f5f=a48_0x554303;if(!_0x25151a)return _0x551f5f(0x190);const _0x48cfd6=_0x25151a;if(this[_0x551f5f(0x1a2)][_0x551f5f(0x17f)][_0x59e088]===_0x48cfd6){if(_0x59e088===_0x551f5f(0x189)&&_0x48cfd6==='us01'&&!this[_0x551f5f(0x1a2)][_0x551f5f(0x1af)][_0x551f5f(0x189)]&&!this['layers'][_0x551f5f(0x1ae)][_0x551f5f(0x189)]&&!this[_0x551f5f(0x1a2)]['profile'][_0x551f5f(0x189)]&&!this['layers'][_0x551f5f(0x18c)][_0x551f5f(0x189)])return _0x551f5f(0x1ad);return _0x551f5f(0x19a)+_0x59e088['replace'](/_/g,'-');}if(this[_0x551f5f(0x1a2)][_0x551f5f(0x1af)][_0x59e088]===_0x48cfd6)return _0x551f5f(0x1af);if(this[_0x551f5f(0x1a2)][_0x551f5f(0x1ae)][_0x59e088]===_0x48cfd6)return'project';if(this[_0x551f5f(0x1a2)][_0x551f5f(0x19b)][_0x59e088]===_0x48cfd6)return _0x551f5f(0x1a5)+this[_0x551f5f(0x1a4)];if(this[_0x551f5f(0x1a2)][_0x551f5f(0x18c)][_0x59e088]===_0x48cfd6)return _0x551f5f(0x18c);return _0x551f5f(0x1ad);}[a48_0x554303(0x198)](){const _0x503e8f=a48_0x554303,_0x27a8b0=a48_0x3cc280['join'](getConfigDir(),_0x503e8f(0x1a3));if(!a48_0x55bdec['existsSync'](_0x27a8b0))return{};try{const _0x3140ce=a48_0x55bdec['readFileSync'](_0x27a8b0,_0x503e8f(0x1b9));return JSON[_0x503e8f(0x1c0)](_0x3140ce);}catch{return{};}}[a48_0x554303(0x191)](_0x11b8ed){const _0xad3d02=a48_0x554303;_0x11b8ed[_0xad3d02(0x189)]=this[_0xad3d02(0x189)],!_0x11b8ed[_0xad3d02(0x1ba)]&&this[_0xad3d02(0x1ba)]&&(_0x11b8ed[_0xad3d02(0x1ba)]=this[_0xad3d02(0x1ba)]),!_0x11b8ed[_0xad3d02(0x185)]&&this[_0xad3d02(0x1bc)]&&(_0x11b8ed[_0xad3d02(0x185)]=this[_0xad3d02(0x1bc)]),!_0x11b8ed[_0xad3d02(0x1b5)]&&this[_0xad3d02(0x1b6)]&&(_0x11b8ed['segmentPath']=this['segment_path']),!_0x11b8ed['llmProject']&&this[_0xad3d02(0x1b2)]&&(_0x11b8ed[_0xad3d02(0x1aa)]=this[_0xad3d02(0x1b2)]);}[a48_0x554303(0x1a6)](){const _0xd59069=a48_0x554303;return[{'key':_0xd59069(0x189),'value':this['site']},{'key':_0xd59069(0x1ba),'value':this[_0xd59069(0x1ba)]},{'key':'parent_segment','value':this[_0xd59069(0x1bc)]},{'key':_0xd59069(0x1b6),'value':this[_0xd59069(0x1b6)]},{'key':_0xd59069(0x1b2),'value':this[_0xd59069(0x1b2)]},{'key':'profile','value':this[_0xd59069(0x1a4)]||undefined}];}[a48_0x554303(0x19d)](){const _0x275188=a48_0x554303;console[_0x275188(0x18b)]('[context]');for(const {key:_0x23ac80,value:_0x4bec20}of this[_0x275188(0x1a6)]()){_0x4bec20&&console['log'](_0x23ac80+':\x20'+_0x4bec20);}}[a48_0x554303(0x19f)](){const _0x2cb4ba=a48_0x554303;console[_0x2cb4ba(0x18b)]('[context]');for(const {key:_0xca3970,value:_0x5b2723}of this[_0x2cb4ba(0x1a6)]()){if(_0x5b2723){const _0x421b4f=_0xca3970===_0x2cb4ba(0x19b)?_0x2cb4ba(0x186):'('+this['getSource'](_0xca3970,_0x5b2723)+')';console['log'](_0xca3970+':\x20'+_0x5b2723+'\x20'+_0x421b4f);}}console['log'](_0x2cb4ba(0x1bf));const _0x3e2d21=[{'label':'Session','path':this[_0x2cb4ba(0x181)][_0x2cb4ba(0x1af)],'extra':_0x2cb4ba(0x1b0)+this[_0x2cb4ba(0x1be)]+')'},{'label':_0x2cb4ba(0x183),'path':this[_0x2cb4ba(0x181)]['project']},{'label':_0x2cb4ba(0x18a),'path':this[_0x2cb4ba(0x181)][_0x2cb4ba(0x19b)]},{'label':_0x2cb4ba(0x18e),'path':this[_0x2cb4ba(0x181)][_0x2cb4ba(0x187)]},{'label':_0x2cb4ba(0x1a9),'path':this[_0x2cb4ba(0x181)][_0x2cb4ba(0x18c)]},{'label':_0x2cb4ba(0x199),'path':this[_0x2cb4ba(0x181)][_0x2cb4ba(0x1a0)]}];for(const {label:_0x175254,path:_0x5c6ec0,extra:_0x3c4f87}of _0x3e2d21){if(_0x5c6ec0)console[_0x2cb4ba(0x18b)](_0x175254+':\x20'+_0x5c6ec0+'\x20✓'+(_0x3c4f87?'\x20'+_0x3c4f87:''));else{if(_0x175254===_0x2cb4ba(0x18f))console[_0x2cb4ba(0x18b)](_0x175254+_0x2cb4ba(0x188)+this['sessionId']+')');else(_0x175254===_0x2cb4ba(0x183)||_0x175254===_0x2cb4ba(0x1a9))&&console[_0x2cb4ba(0x18b)](_0x175254+':\x20none');}}}async[a48_0x554303(0x1a7)](){const _0x28f34b=a48_0x554303;return this['apiKey']=await getAPIKeyAsync(this[_0x28f34b(0x189)],this['activeProfile']||undefined),this[_0x28f34b(0x17e)];}static async['createAsync'](_0x2f2c94){const _0x1a87bb=a48_0x554303,_0x18da38=new GlobalContext(_0x2f2c94);return await _0x18da38[_0x1a87bb(0x1a7)](),_0x18da38;}}
|
|
1
|
+
function a48_0x5ba6(){const _0x143e8b=['Project','INFO','site','session','(active)','database','injectIntoOptions','Global\x20Credentials','profile','Profile\x20Credentials','join','930dGqbBJ','default','verbose','9rQOVed','apiKey','getSource','Profile','754ifCKpd','layers','entries','segment_path','createAsync','readFileSync','cliFlags','us01','existsSync','project','Global','1444360fATWDD','\x0a[configuration\x20files]','global','sessions','segmentPath','not\x20set','454321vNqYEm','1743216pecpbV',':\x20none','llm_project','utf-8','logLevel','configFiles','string','profiles','profile:\x20','config','[context]','loadGlobalConfig','parse',':\x20none\x20(using\x20session:\x20','displayWithSources','getParameters','resolveAPIKeyAsync','parent_segment','replace','activeProfile','CLI\x20flag:\x20--','219oqIAkO','.env','parentSegment','tdx.json','sessionId','llmProject','4125uWWCel','1096260ukSkBy','(session:\x20','log','926541rthSww'];a48_0x5ba6=function(){return _0x143e8b;};return a48_0x5ba6();}const a48_0x6bb0aa=a48_0x4786;(function(_0x29bdac,_0x1b96cc){const _0x49c41a=a48_0x4786,_0x59df74=_0x29bdac();while(!![]){try{const _0x45c9cf=-parseInt(_0x49c41a(0x119))/0x1*(-parseInt(_0x49c41a(0xf2))/0x2)+-parseInt(_0x49c41a(0x123))/0x3+parseInt(_0x49c41a(0x120))/0x4+-parseInt(_0x49c41a(0x11f))/0x5*(-parseInt(_0x49c41a(0x12f))/0x6)+parseInt(_0x49c41a(0x103))/0x7+parseInt(_0x49c41a(0x104))/0x8*(-parseInt(_0x49c41a(0x132))/0x9)+parseInt(_0x49c41a(0xfd))/0xa;if(_0x45c9cf===_0x1b96cc)break;else _0x59df74['push'](_0x59df74['shift']());}catch(_0x192e29){_0x59df74['push'](_0x59df74['shift']());}}}(a48_0x5ba6,0x28cb5));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0x4786(_0x5d5dbd,_0x25166b){_0x5d5dbd=_0x5d5dbd-0xf2;const _0x5ba642=a48_0x5ba6();let _0x478661=_0x5ba642[_0x5d5dbd];return _0x478661;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x23e2a1 from'node:fs';import*as a48_0x4ad2b6 from'node:path';export class GlobalContext{['site'];[a48_0x6bb0aa(0x129)];['parent_segment'];[a48_0x6bb0aa(0xf5)];[a48_0x6bb0aa(0x106)];[a48_0x6bb0aa(0x133)];[a48_0x6bb0aa(0x131)];[a48_0x6bb0aa(0x108)];[a48_0x6bb0aa(0x12c)];['layers'];[a48_0x6bb0aa(0x117)];[a48_0x6bb0aa(0x11d)];[a48_0x6bb0aa(0x109)];constructor(_0x46842a){const _0x21f7d0=a48_0x6bb0aa;this['sessionId']=_0x46842a[_0x21f7d0(0x127)]||getCurrentSessionPID()['toString']();const _0x7bd2f1=loadSessionContext(_0x46842a[_0x21f7d0(0x127)]),_0x312007=loadProjectConfig(),_0x5e59c1=this[_0x21f7d0(0x10f)]();this[_0x21f7d0(0x117)]=_0x46842a[_0x21f7d0(0x12c)]||_0x7bd2f1?.[_0x21f7d0(0x12c)]||_0x5e59c1[_0x21f7d0(0x12c)]||getActiveProfile();const _0x394636=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x385a4c=_0x31675f=>{const _0x4d53f2=_0x21f7d0;if(!_0x31675f)return{};const _0x5bfa90=_0x31675f,_0x55d842={};for(const [_0x39cc57,_0x38e338]of Object[_0x4d53f2(0xf4)](_0x5bfa90)){typeof _0x38e338===_0x4d53f2(0x10a)&&(_0x55d842[_0x39cc57]=_0x38e338);}return _0x55d842;},_0x9d0b7e={};if(_0x46842a[_0x21f7d0(0x126)]&&_0x46842a[_0x21f7d0(0x126)]!==_0x21f7d0(0xf9))_0x9d0b7e[_0x21f7d0(0x126)]=_0x46842a[_0x21f7d0(0x126)];const _0x284eb7=_0x7bd2f1?.['database'],_0x13a9ea=_0x312007?.[_0x21f7d0(0x129)],_0x414525=_0x394636?.[_0x21f7d0(0x10d)]?.[_0x21f7d0(0x129)],_0x333e30=_0x5e59c1[_0x21f7d0(0x129)];_0x46842a['database']&&(_0x46842a[_0x21f7d0(0x129)]!==_0x284eb7&&_0x46842a[_0x21f7d0(0x129)]!==_0x13a9ea&&_0x46842a[_0x21f7d0(0x129)]!==_0x414525&&_0x46842a[_0x21f7d0(0x129)]!==_0x333e30)&&(_0x9d0b7e[_0x21f7d0(0x129)]=_0x46842a[_0x21f7d0(0x129)]);if(_0x46842a[_0x21f7d0(0x11b)])_0x9d0b7e[_0x21f7d0(0x115)]=_0x46842a[_0x21f7d0(0x11b)];if(_0x46842a[_0x21f7d0(0x11e)])_0x9d0b7e[_0x21f7d0(0x106)]=_0x46842a[_0x21f7d0(0x11e)];if(_0x46842a[_0x21f7d0(0x12c)])_0x9d0b7e['profile']=_0x46842a[_0x21f7d0(0x12c)];this[_0x21f7d0(0xf3)]={'cliFlags':_0x9d0b7e,'session':_0x385a4c(_0x7bd2f1),'project':_0x385a4c(_0x312007),'profile':_0x385a4c(_0x394636?.['config']),'global':_0x385a4c(_0x5e59c1)};const _0x33f5c9={...this[_0x21f7d0(0xf3)][_0x21f7d0(0xff)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0x12c)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0xfb)],...this['layers'][_0x21f7d0(0x127)],...this[_0x21f7d0(0xf3)][_0x21f7d0(0xf8)]},_0x22220c=_0x33f5c9[_0x21f7d0(0x126)]||_0x21f7d0(0xf9);this[_0x21f7d0(0x126)]=resolveSite(_0x22220c),this[_0x21f7d0(0x129)]=_0x33f5c9[_0x21f7d0(0x129)],this[_0x21f7d0(0x115)]=_0x33f5c9[_0x21f7d0(0x115)],this[_0x21f7d0(0xf5)]=_0x33f5c9['segment_path'],this['llm_project']=_0x33f5c9['llm_project'],this[_0x21f7d0(0x131)]=_0x46842a['verbose']||![],this[_0x21f7d0(0x108)]=_0x46842a[_0x21f7d0(0x108)]??LogLevel[_0x21f7d0(0x125)],this['profile']=this[_0x21f7d0(0x117)]||undefined,this[_0x21f7d0(0x133)]=getAPIKey(this[_0x21f7d0(0x126)],this[_0x21f7d0(0x117)]||undefined);const _0x29ad12=getConfigDir(),_0x1716be=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x100),this['sessionId']+'.json'),_0x329146=findProjectConfigPath(),_0x42ce86=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x11c)),_0x417a76=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x11a));let _0x369493=null,_0x3ebe73=null;this[_0x21f7d0(0x117)]&&(_0x369493=a48_0x4ad2b6['join'](_0x29ad12,'profiles',this['activeProfile'],'tdx.json'),_0x3ebe73=a48_0x4ad2b6[_0x21f7d0(0x12e)](_0x29ad12,_0x21f7d0(0x10b),this[_0x21f7d0(0x117)],_0x21f7d0(0x11a))),this[_0x21f7d0(0x109)]={'session':a48_0x23e2a1['existsSync'](_0x1716be)?_0x1716be:null,'project':_0x329146,'profile':_0x369493&&a48_0x23e2a1[_0x21f7d0(0xfa)](_0x369493)?_0x369493:null,'profileCredentials':_0x3ebe73&&a48_0x23e2a1[_0x21f7d0(0xfa)](_0x3ebe73)?_0x3ebe73:null,'global':a48_0x23e2a1['existsSync'](_0x42ce86)?_0x42ce86:null,'globalCredentials':a48_0x23e2a1['existsSync'](_0x417a76)?_0x417a76:null};}[a48_0x6bb0aa(0x134)](_0x7a80b5,_0x4d757a){const _0x6151f2=a48_0x6bb0aa;if(!_0x4d757a)return _0x6151f2(0x102);const _0x54fc85=_0x4d757a;if(this['layers'][_0x6151f2(0xf8)][_0x7a80b5]===_0x54fc85){if(_0x7a80b5==='site'&&_0x54fc85===_0x6151f2(0xf9)&&!this[_0x6151f2(0xf3)][_0x6151f2(0x127)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0xfb)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0x12c)][_0x6151f2(0x126)]&&!this[_0x6151f2(0xf3)][_0x6151f2(0xff)][_0x6151f2(0x126)])return _0x6151f2(0x130);return _0x6151f2(0x118)+_0x7a80b5[_0x6151f2(0x116)](/_/g,'-');}if(this[_0x6151f2(0xf3)][_0x6151f2(0x127)][_0x7a80b5]===_0x54fc85)return'session';if(this[_0x6151f2(0xf3)]['project'][_0x7a80b5]===_0x54fc85)return _0x6151f2(0xfb);if(this[_0x6151f2(0xf3)]['profile'][_0x7a80b5]===_0x54fc85)return _0x6151f2(0x10c)+this[_0x6151f2(0x117)];if(this[_0x6151f2(0xf3)][_0x6151f2(0xff)][_0x7a80b5]===_0x54fc85)return _0x6151f2(0xff);return _0x6151f2(0x130);}[a48_0x6bb0aa(0x10f)](){const _0x3534c3=a48_0x6bb0aa,_0x2ffc51=a48_0x4ad2b6[_0x3534c3(0x12e)](getConfigDir(),_0x3534c3(0x11c));if(!a48_0x23e2a1[_0x3534c3(0xfa)](_0x2ffc51))return{};try{const _0x17f1f8=a48_0x23e2a1[_0x3534c3(0xf7)](_0x2ffc51,_0x3534c3(0x107));return JSON[_0x3534c3(0x110)](_0x17f1f8);}catch{return{};}}[a48_0x6bb0aa(0x12a)](_0x50f84c){const _0x2555a0=a48_0x6bb0aa;_0x50f84c[_0x2555a0(0x126)]=this[_0x2555a0(0x126)],!_0x50f84c['database']&&this[_0x2555a0(0x129)]&&(_0x50f84c[_0x2555a0(0x129)]=this[_0x2555a0(0x129)]),!_0x50f84c[_0x2555a0(0x11b)]&&this[_0x2555a0(0x115)]&&(_0x50f84c[_0x2555a0(0x11b)]=this[_0x2555a0(0x115)]),!_0x50f84c[_0x2555a0(0x101)]&&this[_0x2555a0(0xf5)]&&(_0x50f84c[_0x2555a0(0x101)]=this['segment_path']),!_0x50f84c['llmProject']&&this[_0x2555a0(0x106)]&&(_0x50f84c['llmProject']=this[_0x2555a0(0x106)]);}[a48_0x6bb0aa(0x113)](){const _0x5a21d1=a48_0x6bb0aa;return[{'key':'site','value':this[_0x5a21d1(0x126)]},{'key':'database','value':this[_0x5a21d1(0x129)]},{'key':'parent_segment','value':this['parent_segment']},{'key':_0x5a21d1(0xf5),'value':this[_0x5a21d1(0xf5)]},{'key':_0x5a21d1(0x106),'value':this[_0x5a21d1(0x106)]},{'key':_0x5a21d1(0x12c),'value':this['activeProfile']||undefined}];}['display'](){const _0x55ee55=a48_0x6bb0aa;console['log'](_0x55ee55(0x10e));for(const {key:_0x434b51,value:_0x3651a2}of this[_0x55ee55(0x113)]()){_0x3651a2&&console[_0x55ee55(0x122)](_0x434b51+':\x20'+_0x3651a2);}}[a48_0x6bb0aa(0x112)](){const _0x4a0886=a48_0x6bb0aa;console[_0x4a0886(0x122)](_0x4a0886(0x10e));for(const {key:_0x34105a,value:_0x17bc34}of this[_0x4a0886(0x113)]()){if(_0x17bc34){const _0xac2fab=_0x34105a===_0x4a0886(0x12c)?_0x4a0886(0x128):'('+this['getSource'](_0x34105a,_0x17bc34)+')';console[_0x4a0886(0x122)](_0x34105a+':\x20'+_0x17bc34+'\x20'+_0xac2fab);}}console[_0x4a0886(0x122)](_0x4a0886(0xfe));const _0x2df1d1=[{'label':'Session','path':this[_0x4a0886(0x109)][_0x4a0886(0x127)],'extra':_0x4a0886(0x121)+this[_0x4a0886(0x11d)]+')'},{'label':_0x4a0886(0x124),'path':this[_0x4a0886(0x109)]['project']},{'label':_0x4a0886(0x135),'path':this[_0x4a0886(0x109)][_0x4a0886(0x12c)]},{'label':_0x4a0886(0x12d),'path':this[_0x4a0886(0x109)]['profileCredentials']},{'label':_0x4a0886(0xfc),'path':this[_0x4a0886(0x109)][_0x4a0886(0xff)]},{'label':_0x4a0886(0x12b),'path':this[_0x4a0886(0x109)]['globalCredentials']}];for(const {label:_0xd0cf75,path:_0x356241,extra:_0x21e9b1}of _0x2df1d1){if(_0x356241)console[_0x4a0886(0x122)](_0xd0cf75+':\x20'+_0x356241+'\x20✓'+(_0x21e9b1?'\x20'+_0x21e9b1:''));else{if(_0xd0cf75==='Session')console[_0x4a0886(0x122)](_0xd0cf75+_0x4a0886(0x111)+this['sessionId']+')');else(_0xd0cf75===_0x4a0886(0x124)||_0xd0cf75==='Global')&&console[_0x4a0886(0x122)](_0xd0cf75+_0x4a0886(0x105));}}}async[a48_0x6bb0aa(0x114)](){const _0x297c0c=a48_0x6bb0aa;return this[_0x297c0c(0x133)]=await getAPIKeyAsync(this[_0x297c0c(0x126)],this['activeProfile']||undefined),this[_0x297c0c(0x133)];}static async[a48_0x6bb0aa(0xf6)](_0x1c2ad1){const _0x2093e9=new GlobalContext(_0x1c2ad1);return await _0x2093e9['resolveAPIKeyAsync'](),_0x2093e9;}}
|