@treasuredata/tdx 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts.map +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-command.js.map +1 -1
- package/dist/commands/agent-test-command.d.ts.map +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/agent-test-command.js.map +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.d.ts.map +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-config.js.map +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +44 -0
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.d.ts +2 -1
- package/dist/sdk/claude-agent/index.d.ts.map +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/index.js.map +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/claude-agent/types.d.ts +4 -1
- package/dist/sdk/claude-agent/types.d.ts.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0xf49889=a24_0x5519;(function(_0x94a314,_0x1f5cb6){const _0x3e5c52=a24_0x5519,_0x43618a=_0x94a314();while(!![]){try{const _0x4f4427=parseInt(_0x3e5c52(0x1a2))/0x1+-parseInt(_0x3e5c52(0x1a4))/0x2+parseInt(_0x3e5c52(0x17d))/0x3*(-parseInt(_0x3e5c52(0x1a1))/0x4)+parseInt(_0x3e5c52(0x13f))/0x5+-parseInt(_0x3e5c52(0x16e))/0x6*(parseInt(_0x3e5c52(0x168))/0x7)+-parseInt(_0x3e5c52(0x199))/0x8*(parseInt(_0x3e5c52(0x1ab))/0x9)+-parseInt(_0x3e5c52(0x1a7))/0xa*(-parseInt(_0x3e5c52(0x138))/0xb);if(_0x4f4427===_0x1f5cb6)break;else _0x43618a['push'](_0x43618a['shift']());}catch(_0xb4044){_0x43618a['push'](_0x43618a['shift']());}}}(a24_0x185a,0xa3108));function a24_0x5519(_0x19b000,_0x3a707f){_0x19b000=_0x19b000-0x138;const _0x185a4e=a24_0x185a();let _0x551900=_0x185a4e[_0x19b000];return _0x551900;}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0x65f31e from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x390373 from'prompts';import a24_0x54691e from'chalk';function validateProfileName(_0x2f5683){const _0x218d9d=a24_0x5519;if(!_0x2f5683||!_0x2f5683[_0x218d9d(0x184)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x21d392=_0x2f5683[_0x218d9d(0x184)]();if(!/^[a-zA-Z0-9_-]+$/[_0x218d9d(0x187)](_0x21d392))return _0x218d9d(0x17b);if(profileExists(_0x21d392))return _0x218d9d(0x154)+_0x21d392+_0x218d9d(0x147);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0xf49889(0x190);[a24_0xf49889(0x185)]=a24_0xf49889(0x14a);async[a24_0xf49889(0x162)](_0x24ec85){const _0x5610d7=a24_0xf49889,{options:_0x3c68e0,args:_0x1bd5f5}=_0x24ec85;console['log'](a24_0x54691e[_0x5610d7(0x165)]('tdx:\x20profile\x20create'));let _0x1d1250;if(_0x1bd5f5[_0x5610d7(0x1a9)]>0x0&&_0x1bd5f5[0x0]){const _0x44cd62=_0x1bd5f5[0x0][_0x5610d7(0x184)](),_0x24f0f1=validateProfileName(_0x44cd62);if(_0x24f0f1!==!![])return console[_0x5610d7(0x18a)](a24_0x54691e[_0x5610d7(0x1b2)](_0x24f0f1)),0x1;_0x1d1250=_0x44cd62;}else{const _0x272bb0=await a24_0x390373({'type':_0x5610d7(0x1a8),'name':'profileName','message':_0x5610d7(0x197),'validate':validateProfileName});if(!_0x272bb0['profileName'])return console[_0x5610d7(0x140)](_0x5610d7(0x16b)),0x1;_0x1d1250=_0x272bb0[_0x5610d7(0x153)][_0x5610d7(0x184)]();}const _0x1692e7=await a24_0x390373({'type':_0x5610d7(0x1a8),'name':_0x5610d7(0x185),'message':'Enter\x20description\x20(optional):'}),_0x1c4116=_0x1692e7[_0x5610d7(0x185)]?.[_0x5610d7(0x184)]()||undefined,_0x25d59d=_0x3c68e0['site']||_0x5610d7(0x177),_0x33b50f=[{'title':_0x5610d7(0x156),'value':_0x5610d7(0x177)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x5610d7(0x17c)},{'title':_0x5610d7(0x14e),'value':_0x5610d7(0x179)},{'title':_0x5610d7(0x186),'value':_0x5610d7(0x157)}];let _0x1f5ab9=_0x33b50f[_0x5610d7(0x16d)](_0x57da2d=>_0x57da2d[_0x5610d7(0x15e)]===_0x25d59d);_0x1f5ab9===-0x1&&_0x25d59d!=='us01'&&(_0x33b50f[_0x5610d7(0x1b4)]({'title':_0x25d59d,'value':_0x25d59d}),_0x1f5ab9=_0x33b50f[_0x5610d7(0x1a9)]-0x1);_0x33b50f[_0x5610d7(0x1b4)]({'title':_0x5610d7(0x1a0),'value':_0x5610d7(0x15a)});const _0x21cea4=await a24_0x390373({'type':'select','name':_0x5610d7(0x18e),'message':_0x5610d7(0x161)+_0x1d1250+'\x27:','choices':_0x33b50f,'initial':_0x1f5ab9>=0x0?_0x1f5ab9:0x0});if(!_0x21cea4[_0x5610d7(0x18e)])return console[_0x5610d7(0x140)]('\x0aSetup\x20cancelled'),0x1;let _0x3f3859;if(_0x21cea4['site']==='other'){const _0x38cc7e=await a24_0x390373({'type':_0x5610d7(0x1a8),'name':_0x5610d7(0x15f),'message':_0x5610d7(0x14c),'initial':_0x5610d7(0x177),'validate':_0x5297c8=>{const _0x59c2ec=_0x5610d7;if(!_0x5297c8||!_0x5297c8[_0x59c2ec(0x184)]())return _0x59c2ec(0x1a6);if(!/^[a-z0-9-]+$/[_0x59c2ec(0x187)](_0x5297c8[_0x59c2ec(0x184)]()))return _0x59c2ec(0x19b);return!![];}});if(!_0x38cc7e['customSite'])return console[_0x5610d7(0x140)]('\x0aSetup\x20cancelled'),0x1;_0x3f3859=_0x38cc7e[_0x5610d7(0x15f)];}else _0x3f3859=_0x21cea4[_0x5610d7(0x18e)];const _0xc0bcaa=resolveSite(_0x3f3859);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0xc0bcaa),console[_0x5610d7(0x140)](_0x5610d7(0x173)),console[_0x5610d7(0x140)]('\x20\x20'+getConsoleUrl(_0xc0bcaa,_0x5610d7(0x1a3)));const _0x560e22=await a24_0x390373({'type':_0x5610d7(0x159),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x231dc2=>{const _0x4c9800=_0x5610d7;if(!_0x231dc2||!_0x231dc2[_0x4c9800(0x184)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x560e22['apiKey'])return console['log'](_0x5610d7(0x16b)),0x1;const _0x7e5f23=_0x560e22[_0x5610d7(0x1aa)];console[_0x5610d7(0x140)](_0x5610d7(0x150));try{const _0x122987=TDX[_0x5610d7(0x1b6)]({'site':_0xc0bcaa,'apiKey':_0x7e5f23[_0x5610d7(0x184)](),'logLevel':_0x3c68e0[_0x5610d7(0x196)]??LogLevel[_0x5610d7(0x19f)]}),_0x16bdd5=await _0x122987[_0x5610d7(0x193)][_0x5610d7(0x191)]();console[_0x5610d7(0x140)](a24_0x54691e[_0x5610d7(0x182)]('✓')+_0x5610d7(0x19e)+_0x16bdd5['email']+')');const _0x1618c7=await isKeychainAvailable();_0x1618c7?(await saveAPIKeyAsync(_0x7e5f23[_0x5610d7(0x184)](),_0xc0bcaa,_0x1d1250),console[_0x5610d7(0x140)](a24_0x54691e[_0x5610d7(0x182)]('✓')+_0x5610d7(0x188)+_0x1d1250+')')):(console[_0x5610d7(0x1b3)](a24_0x54691e[_0x5610d7(0x167)](_0x5610d7(0x19d))),console['warn'](a24_0x54691e[_0x5610d7(0x167)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x33f91a={'site':_0xc0bcaa,..._0x1c4116&&{'description':_0x1c4116}};return saveProfileToUserConfig(_0x1d1250,_0x33f91a),console[_0x5610d7(0x140)](a24_0x54691e[_0x5610d7(0x182)]('✓')+_0x5610d7(0x18f)+_0x1d1250+_0x5610d7(0x158)),console[_0x5610d7(0x140)](),console['log'](_0x5610d7(0x19c)),console['log'](_0x5610d7(0x198)+_0x1d1250+_0x5610d7(0x152)),console[_0x5610d7(0x140)](_0x5610d7(0x198)+_0x1d1250+_0x5610d7(0x164)),0x0;}catch(_0x47a0e2){if(_0x47a0e2 instanceof HTTPClientError&&_0x47a0e2[_0x5610d7(0x17f)]===0x191)return printAuthError(_0x47a0e2),0x1;return console[_0x5610d7(0x18a)](a24_0x54691e[_0x5610d7(0x1b2)]('✗\x20Validation\x20failed:\x20'+(_0x47a0e2 instanceof Error?_0x47a0e2[_0x5610d7(0x166)]:String(_0x47a0e2)))),console['error'](_0x5610d7(0x181)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0xf49889(0x175)]=a24_0xf49889(0x146);[a24_0xf49889(0x185)]='Remove\x20a\x20profile';[a24_0xf49889(0x1b0)](_0xf4170){const _0x2991d3=a24_0xf49889,{args:_0xa26bc1}=_0xf4170;if(_0xa26bc1[_0x2991d3(0x1a9)]===0x0)return _0x2991d3(0x1ae);return undefined;}async[a24_0xf49889(0x162)](_0x2cad47){const _0x5edd54=a24_0xf49889,{args:_0x3ab97f}=_0x2cad47,_0x220b93=_0x3ab97f[0x0];console[_0x5edd54(0x140)](a24_0x54691e['bold'](_0x5edd54(0x171)));if(!profileExists(_0x220b93)){console[_0x5edd54(0x18a)](a24_0x54691e[_0x5edd54(0x1b2)](_0x5edd54(0x154)+_0x220b93+_0x5edd54(0x1b1))),console[_0x5edd54(0x140)](_0x5edd54(0x189));const _0x51e734=listProfiles();if(_0x51e734[_0x5edd54(0x1a9)]===0x0)console[_0x5edd54(0x140)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x15e6ec of _0x51e734){console[_0x5edd54(0x140)](_0x5edd54(0x145)+_0x15e6ec['name']);}return 0x1;}const _0x2e157a=await a24_0x390373({'type':'confirm','name':_0x5edd54(0x183),'message':_0x5edd54(0x15c)+_0x220b93+'\x27?','initial':![]});if(!_0x2e157a[_0x5edd54(0x183)])return console[_0x5edd54(0x140)](_0x5edd54(0x169)),0x0;try{removeProfileFromUserConfig(_0x220b93),console[_0x5edd54(0x140)](a24_0x54691e[_0x5edd54(0x182)]('✓')+_0x5edd54(0x18f)+_0x220b93+'\x27\x20removed\x20from\x20configuration');}catch(_0x5da281){return console[_0x5edd54(0x18a)](a24_0x54691e[_0x5edd54(0x1b2)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5da281 instanceof Error?_0x5da281[_0x5edd54(0x166)]:String(_0x5da281)))),0x1;}const _0x1d212a=await isKeychainAvailable();if(_0x1d212a){const _0x2cf9ce=await deleteKeychainAPIKey(_0x220b93);_0x2cf9ce&&console['log'](a24_0x54691e['green']('✓')+_0x5edd54(0x13a));}return 0x0;}}function a24_0x185a(){const _0x3a16b3=['You\x20can\x20find\x20your\x20API\x20key\x20at:','parent_segment','name','\x27\x20requires\x20API\x20key\x20validation.','us01','\x20\x20(no\x20profiles\x20found)','eu01','join','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','jp01','481512noheBz','\x20--default\x27\x20to\x20save\x20permanently','status','\x0aOperation\x20cancelled','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','green','confirm','trim','description','ap02\x20-\x20Korea','test','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aAvailable\x20profiles:','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','includes','database','site','\x20Profile\x20\x27','profile:create','getUserInfo','\x20API\x20key\x20saved\x20to\x20system\x20keychain','jobs','dim','split','logLevel','Enter\x20profile\x20name:','\x20\x20tdx\x20--profile\x20','24QGhUsM','default','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20is\x20valid\x20(User:\x20','ERROR','Enter\x20custom\x20site','8XTEZBC','518464jDsbTC','/app/mp/ak','1653900KDbHZR','profile','Site\x20name\x20cannot\x20be\x20empty','3290qJerUC','text','length','apiKey','607293scztDE','llm_project','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','llm_agent','validate','\x27\x20does\x20not\x20exist.','red','warn','push','\x27\x20updated:\x20','create','44913fqsXhp','\x27.\x0a\x0aValid\x20keys:\x20','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','API\x20key\x20cannot\x20be\x20empty','tdx.json','✗\x20Validation\x20failed:\x20','5417860yMszTB','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Set\x20session\x20profile','\x20\x20-\x20','profile:remove','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Changing\x20site\x20to\x20\x27','Create\x20a\x20new\x20profile','toString','Enter\x20site\x20name:','profile:set','eu\x20\x20\x20-\x20Europe','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','(session:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profileName','Profile\x20\x27','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','us\x20\x20\x20-\x20United\x20States','ap02','\x27\x20created','password','other','Site\x20was\x20not\x20changed.','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','config','value','customSite','Set\x20a\x20profile\x20configuration\x20value','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','execute','Unknown\x20key\x20\x27','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','bold','message','yellow','42UbnpsJ','Removal\x20cancelled','VALID_KEYS','\x0aSetup\x20cancelled','(cleared)','findIndex','927042fYLhva','email','profile:use','tdx:\x20profile\x20remove','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'];a24_0x185a=function(){return _0x3a16b3;};return a24_0x185a();}export class ProfileSetCommand extends BaseCommand{[a24_0xf49889(0x175)]=a24_0xf49889(0x14d);[a24_0xf49889(0x185)]=a24_0xf49889(0x160);static ['VALID_KEYS']=[a24_0xf49889(0x18e),a24_0xf49889(0x18d),a24_0xf49889(0x174),a24_0xf49889(0x1ac),a24_0xf49889(0x1af),'description'];[a24_0xf49889(0x1b0)](_0x1b8e77){const _0x3e8faa=a24_0xf49889,{args:_0x44be67,options:_0x9c5a5a}=_0x1b8e77,_0x3e1c27=_0x9c5a5a[_0x3e8faa(0x1a5)]||getActiveProfile();if(!_0x3e1c27)return _0x3e8faa(0x155);if(_0x44be67[_0x3e8faa(0x1a9)]===0x0)return _0x3e8faa(0x142)+ProfileSetCommand[_0x3e8faa(0x16a)][_0x3e8faa(0x17a)](',\x20');const _0x3f273=_0x44be67[0x0];if(!_0x3f273['includes']('='))return _0x3e8faa(0x141)+ProfileSetCommand['VALID_KEYS'][_0x3e8faa(0x17a)](',\x20');const [_0x418e8d]=_0x3f273[_0x3e8faa(0x195)]('=',0x2);if(!ProfileSetCommand[_0x3e8faa(0x16a)][_0x3e8faa(0x18c)](_0x418e8d))return _0x3e8faa(0x163)+_0x418e8d+_0x3e8faa(0x139)+ProfileSetCommand['VALID_KEYS'][_0x3e8faa(0x17a)](',\x20');return undefined;}async[a24_0xf49889(0x162)](_0x3bc399){const _0x304b80=a24_0xf49889,{args:_0x4024e7,options:_0x4694ea}=_0x3bc399,_0x4bb008=_0x4694ea[_0x304b80(0x1a5)]||getActiveProfile(),[_0xb20935,..._0xe85c8d]=_0x4024e7[0x0]['split']('='),_0xeb69a5=_0xe85c8d['join']('=');console[_0x304b80(0x140)](a24_0x54691e[_0x304b80(0x165)]('tdx:\x20profile\x20set'));if(!profileExists(_0x4bb008)){const _0x4c3183=await a24_0x390373({'type':'confirm','name':_0x304b80(0x1b6),'message':_0x304b80(0x154)+_0x4bb008+_0x304b80(0x143),'initial':!![]});if(!_0x4c3183[_0x304b80(0x1b6)])return console[_0x304b80(0x140)]('Operation\x20cancelled'),0x1;}const _0x2e03c9=loadProfile(_0x4bb008),_0x4a6f44=_0x2e03c9?.[_0x304b80(0x15d)]||{};if(_0xb20935===_0x304b80(0x18e)){const _0x55eeb3=resolveSite(_0xeb69a5);console['log'](_0x304b80(0x149)+_0x55eeb3+_0x304b80(0x176)),console[_0x304b80(0x140)](_0x304b80(0x13b)),console[_0x304b80(0x140)]('\x20\x20'+getConsoleUrl(_0x55eeb3,_0x304b80(0x1a3)));const _0x15457a=await a24_0x390373({'type':_0x304b80(0x159),'name':_0x304b80(0x1aa),'message':_0x304b80(0x18b),'validate':_0x9988d7=>{const _0x51987f=_0x304b80;if(!_0x9988d7||!_0x9988d7[_0x51987f(0x184)]())return _0x51987f(0x13c);return!![];}});if(!_0x15457a[_0x304b80(0x1aa)])return console['log'](_0x304b80(0x180)),0x1;console[_0x304b80(0x140)](_0x304b80(0x150));try{const _0x2d7ee0=TDX[_0x304b80(0x1b6)]({'site':_0x55eeb3,'apiKey':_0x15457a['apiKey']['trim'](),'logLevel':_0x4694ea[_0x304b80(0x196)]??LogLevel['ERROR']}),_0x5b7dce=await _0x2d7ee0[_0x304b80(0x193)]['getUserInfo']();console[_0x304b80(0x140)](a24_0x54691e[_0x304b80(0x182)]('✓')+_0x304b80(0x19e)+_0x5b7dce[_0x304b80(0x16f)]+')');const _0x1775f9=await isKeychainAvailable();_0x1775f9?(await saveAPIKeyAsync(_0x15457a[_0x304b80(0x1aa)][_0x304b80(0x184)](),_0x55eeb3,_0x4bb008),console['log'](a24_0x54691e[_0x304b80(0x182)]('✓')+_0x304b80(0x192))):console['warn'](a24_0x54691e['yellow'](_0x304b80(0x19d))),_0x4a6f44[_0x304b80(0x18e)]=_0x55eeb3;}catch(_0x26e6cd){if(_0x26e6cd instanceof HTTPClientError&&_0x26e6cd[_0x304b80(0x17f)]===0x191)return printAuthError(_0x26e6cd),0x1;return console[_0x304b80(0x18a)](a24_0x54691e[_0x304b80(0x1b2)](_0x304b80(0x13e)+(_0x26e6cd instanceof Error?_0x26e6cd[_0x304b80(0x166)]:String(_0x26e6cd)))),console['error'](_0x304b80(0x15b)),0x1;}}else _0x4a6f44[_0xb20935]=_0xeb69a5||undefined;return saveProfileToUserConfig(_0x4bb008,_0x4a6f44),console[_0x304b80(0x140)](a24_0x54691e['green']('✓')+_0x304b80(0x18f)+_0x4bb008+_0x304b80(0x1b5)+_0xb20935+'='+(_0xeb69a5||_0x304b80(0x16c))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0xf49889(0x175)]=a24_0xf49889(0x170);['description']=a24_0xf49889(0x144);[a24_0xf49889(0x1b0)](_0x303234){const _0x58f769=a24_0xf49889,{args:_0x3fbea3}=_0x303234;if(_0x3fbea3[_0x58f769(0x1a9)]===0x0)return _0x58f769(0x148);return undefined;}async[a24_0xf49889(0x162)](_0x9622d7){const _0x512e2a=a24_0xf49889,{args:_0x2e48fb,options:_0x1e5940}=_0x9622d7,_0x17183f=_0x2e48fb[0x0],_0x3e64d5=_0x1e5940[_0x512e2a(0x19a)];cleanExpiredSessions();if(!profileExists(_0x17183f)){console['error'](a24_0x54691e[_0x512e2a(0x1b2)](_0x512e2a(0x154)+_0x17183f+'\x27\x20does\x20not\x20exist.')),console[_0x512e2a(0x140)](_0x512e2a(0x189));const _0x42a781=listProfiles();if(_0x42a781['length']===0x0)console[_0x512e2a(0x140)](_0x512e2a(0x178));else for(const _0x13457c of _0x42a781){console[_0x512e2a(0x140)](_0x512e2a(0x145)+_0x13457c[_0x512e2a(0x175)]);}return 0x1;}if(_0x3e64d5){const _0x483303=a24_0x65f31e[_0x512e2a(0x17a)](getConfigDir(),_0x512e2a(0x13d));return saveActiveProfileToUserConfig(_0x17183f),console[_0x512e2a(0x140)](_0x512e2a(0x14f)+a24_0x54691e[_0x512e2a(0x182)](_0x17183f)),console[_0x512e2a(0x140)](a24_0x54691e[_0x512e2a(0x194)]('\x0aSaved\x20to:\x20'+_0x483303)),0x0;}const _0x3cbcd6=_0x1e5940[_0x512e2a(0x1ad)]||getCurrentSessionPID()[_0x512e2a(0x14b)]();return saveSessionContext({'profile':_0x17183f},_0x1e5940[_0x512e2a(0x1ad)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x54691e[_0x512e2a(0x182)](_0x17183f)+'\x20'+a24_0x54691e['dim'](_0x512e2a(0x151)+_0x3cbcd6+')')),console[_0x512e2a(0x140)](a24_0x54691e[_0x512e2a(0x194)](_0x512e2a(0x172)+_0x17183f+_0x512e2a(0x17e))),0x0;}}
|
|
1
|
+
const a24_0x5aa101=a24_0x4b8f;(function(_0x5497a1,_0x2bb0c3){const _0xd0befd=a24_0x4b8f,_0x335db2=_0x5497a1();while(!![]){try{const _0x7bc73d=-parseInt(_0xd0befd(0xf7))/0x1*(parseInt(_0xd0befd(0x116))/0x2)+-parseInt(_0xd0befd(0x108))/0x3+-parseInt(_0xd0befd(0xfd))/0x4+parseInt(_0xd0befd(0x129))/0x5*(parseInt(_0xd0befd(0x101))/0x6)+-parseInt(_0xd0befd(0x10e))/0x7*(-parseInt(_0xd0befd(0x118))/0x8)+-parseInt(_0xd0befd(0x149))/0x9+parseInt(_0xd0befd(0x143))/0xa;if(_0x7bc73d===_0x2bb0c3)break;else _0x335db2['push'](_0x335db2['shift']());}catch(_0x3e6738){_0x335db2['push'](_0x335db2['shift']());}}}(a24_0x58d3,0x34bcd));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0x142e8f from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x58d3(){const _0x1fe2aa=['jobs','Enter\x20custom\x20site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile:remove','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','\x0aAvailable\x20profiles:','customSite','(cleared)','tdx.json','green','(session:\x20','validate','toString','default','profileName','404sPtmDt','ERROR','Removal\x20cancelled','Site\x20was\x20not\x20changed.','profile:use','confirm','1709448mUdcnR','warn','llm_project','✗\x20Validation\x20failed:\x20','2387322gjFJvO','Create\x20a\x20new\x20profile','error','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','test','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','871548TmPCIy','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','61355ZCNTCW','\x20Profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','VALID_KEYS','\x27\x20updated:\x20','1906yMAkaI','\x0aOperation\x20cancelled','8sCGqJt','Unknown\x20key\x20\x27','API\x20key\x20cannot\x20be\x20empty','red','\x20\x20-\x20','jp01','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','yellow','profile:set','select','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','message','email','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','value','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','5gzeXel','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20remove','bold','ap02\x20-\x20Korea','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20profile\x20name:','\x27\x20created','\x20API\x20key\x20is\x20valid\x20(User:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetup\x20cancelled','tdx:\x20profile\x20create','text','name','profile','password','findIndex','Set\x20session\x20profile','us01','Enter\x20site\x20name:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','create','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','database','site','10893150OYdevK','getUserInfo','status','push','\x0aSaved\x20to:\x20','join','1593576aPforP','split','session','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Session\x20profile\x20set\x20to:\x20','includes','trim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','length','eu\x20\x20\x20-\x20Europe','log','apiKey','logLevel','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','other','Validating\x20API\x20key...'];a24_0x58d3=function(){return _0x1fe2aa;};return a24_0x58d3();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x3c204d from'prompts';import a24_0x2a13d2 from'chalk';function a24_0x4b8f(_0x4eb622,_0x38ec32){_0x4eb622=_0x4eb622-0xe8;const _0x58d37a=a24_0x58d3();let _0x4b8f6c=_0x58d37a[_0x4eb622];return _0x4b8f6c;}function validateProfileName(_0x11967c){const _0x4e5098=a24_0x4b8f;if(!_0x11967c||!_0x11967c[_0x4e5098(0x14f)]())return _0x4e5098(0x12f);const _0x305cf3=_0x11967c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x4e5098(0x106)](_0x305cf3))return _0x4e5098(0xe9);if(profileExists(_0x305cf3))return'Profile\x20\x27'+_0x305cf3+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0x5aa101(0x126);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x102);async[a24_0x5aa101(0x112)](_0x23e958){const _0x57b087=a24_0x5aa101,{options:_0x5e70fa,args:_0x5f3514}=_0x23e958;console['log'](a24_0x2a13d2[_0x57b087(0x12c)](_0x57b087(0x135)));let _0x3a73b6;if(_0x5f3514[_0x57b087(0x151)]>0x0&&_0x5f3514[0x0]){const _0x4b6a07=_0x5f3514[0x0][_0x57b087(0x14f)](),_0xa66a2=validateProfileName(_0x4b6a07);if(_0xa66a2!==!![])return console[_0x57b087(0x103)](a24_0x2a13d2['red'](_0xa66a2)),0x1;_0x3a73b6=_0x4b6a07;}else{const _0x4ee62d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xf6),'message':_0x57b087(0x130),'validate':validateProfileName});if(!_0x4ee62d[_0x57b087(0xf6)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x3a73b6=_0x4ee62d[_0x57b087(0xf6)][_0x57b087(0x14f)]();}const _0x417d1d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xea),'message':'Enter\x20description\x20(optional):'}),_0x37db67=_0x417d1d['description']?.[_0x57b087(0x14f)]()||undefined,_0x1c2a73=_0x5e70fa[_0x57b087(0x142)]||_0x57b087(0x13c),_0x2120e8=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x57b087(0x13c)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x57b087(0x11d)},{'title':_0x57b087(0x152),'value':'eu01'},{'title':_0x57b087(0x12d),'value':'ap02'}];let _0x52fd9d=_0x2120e8[_0x57b087(0x13a)](_0x2b835c=>_0x2b835c[_0x57b087(0x127)]===_0x1c2a73);_0x52fd9d===-0x1&&_0x1c2a73!=='us01'&&(_0x2120e8[_0x57b087(0x146)]({'title':_0x1c2a73,'value':_0x1c2a73}),_0x52fd9d=_0x2120e8['length']-0x1);_0x2120e8[_0x57b087(0x146)]({'title':_0x57b087(0x15a),'value':_0x57b087(0x157)});const _0x5d9ff3=await a24_0x3c204d({'type':_0x57b087(0x121),'name':'site','message':_0x57b087(0x13e)+_0x3a73b6+'\x27:','choices':_0x2120e8,'initial':_0x52fd9d>=0x0?_0x52fd9d:0x0});if(!_0x5d9ff3[_0x57b087(0x142)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;let _0x53737a;if(_0x5d9ff3['site']===_0x57b087(0x157)){const _0x322092=await a24_0x3c204d({'type':_0x57b087(0x136),'name':'customSite','message':_0x57b087(0x13d),'initial':_0x57b087(0x13c),'validate':_0x5292d2=>{const _0x5c8d60=_0x57b087;if(!_0x5292d2||!_0x5292d2['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x5292d2[_0x5c8d60(0x14f)]()))return _0x5c8d60(0x15d);return!![];}});if(!_0x322092[_0x57b087(0xee)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x53737a=_0x322092[_0x57b087(0xee)];}else _0x53737a=_0x5d9ff3[_0x57b087(0x142)];const _0x1c5f85=resolveSite(_0x53737a);console[_0x57b087(0x153)](_0x57b087(0x128)+_0x1c5f85),console[_0x57b087(0x153)](_0x57b087(0x109)),console['log']('\x20\x20'+getConsoleUrl(_0x1c5f85,'/app/mp/ak'));const _0x53fb92=await a24_0x3c204d({'type':'password','name':_0x57b087(0x154),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x58d8e8=>{const _0x52f8c1=_0x57b087;if(!_0x58d8e8||!_0x58d8e8[_0x52f8c1(0x14f)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x53fb92['apiKey'])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;const _0x30a5a3=_0x53fb92['apiKey'];console['log'](_0x57b087(0x158));try{const _0x3f9185=TDX['create']({'site':_0x1c5f85,'apiKey':_0x30a5a3[_0x57b087(0x14f)](),'logLevel':_0x5e70fa[_0x57b087(0x155)]??LogLevel[_0x57b087(0xf8)]}),_0xc5ccdf=await _0x3f9185['jobs'][_0x57b087(0x144)]();console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x132)+_0xc5ccdf[_0x57b087(0x124)]+')');const _0x299734=await isKeychainAvailable();_0x299734?(await saveAPIKeyAsync(_0x30a5a3[_0x57b087(0x14f)](),_0x1c5f85,_0x3a73b6),console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3a73b6+')')):(console[_0x57b087(0xfe)](a24_0x2a13d2['yellow'](_0x57b087(0x140))),console['warn'](a24_0x2a13d2[_0x57b087(0x11f)](_0x57b087(0x15b))));const _0x1f3a93={'site':_0x1c5f85,..._0x37db67&&{'description':_0x37db67}};return saveProfileToUserConfig(_0x3a73b6,_0x1f3a93),console[_0x57b087(0x153)](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x10f)+_0x3a73b6+_0x57b087(0x131)),console[_0x57b087(0x153)](),console[_0x57b087(0x153)](_0x57b087(0x122)),console[_0x57b087(0x153)](_0x57b087(0x110)+_0x3a73b6+_0x57b087(0x111)),console[_0x57b087(0x153)]('\x20\x20tdx\x20--profile\x20'+_0x3a73b6+_0x57b087(0x156)),0x0;}catch(_0xc4770){if(_0xc4770 instanceof HTTPClientError&&_0xc4770[_0x57b087(0x145)]===0x191)return printAuthError(_0xc4770),0x1;return console['error'](a24_0x2a13d2[_0x57b087(0x11b)](_0x57b087(0x100)+(_0xc4770 instanceof Error?_0xc4770[_0x57b087(0x123)]:String(_0xc4770)))),console[_0x57b087(0x103)](_0x57b087(0x113)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x5aa101(0xe8);['description']=a24_0x5aa101(0x105);['validate'](_0x107ecf){const _0x282e9e=a24_0x5aa101,{args:_0x1d6ff5}=_0x107ecf;if(_0x1d6ff5['length']===0x0)return _0x282e9e(0x15c);return undefined;}async[a24_0x5aa101(0x112)](_0x1d0f38){const _0x317156=a24_0x5aa101,{args:_0x3d10c3}=_0x1d0f38,_0xae82e9=_0x3d10c3[0x0];console['log'](a24_0x2a13d2[_0x317156(0x12c)](_0x317156(0x12b)));if(!profileExists(_0xae82e9)){console['error'](a24_0x2a13d2[_0x317156(0x11b)](_0x317156(0x10d)+_0xae82e9+'\x27\x20does\x20not\x20exist.')),console['log'](_0x317156(0xed));const _0x54ec68=listProfiles();if(_0x54ec68[_0x317156(0x151)]===0x0)console[_0x317156(0x153)](_0x317156(0x10a));else for(const _0x5c7a2a of _0x54ec68){console[_0x317156(0x153)](_0x317156(0x11c)+_0x5c7a2a[_0x317156(0x137)]);}return 0x1;}const _0x14e7a6=await a24_0x3c204d({'type':'confirm','name':_0x317156(0xfc),'message':_0x317156(0x11e)+_0xae82e9+'\x27?','initial':![]});if(!_0x14e7a6['confirm'])return console[_0x317156(0x153)](_0x317156(0xf9)),0x0;try{removeProfileFromUserConfig(_0xae82e9),console[_0x317156(0x153)](a24_0x2a13d2['green']('✓')+'\x20Profile\x20\x27'+_0xae82e9+'\x27\x20removed\x20from\x20configuration');}catch(_0x19881b){return console[_0x317156(0x103)](a24_0x2a13d2['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x19881b instanceof Error?_0x19881b[_0x317156(0x123)]:String(_0x19881b)))),0x1;}const _0x1f1487=await isKeychainAvailable();if(_0x1f1487){const _0x2406ee=await deleteKeychainAPIKey(_0xae82e9);_0x2406ee&&console[_0x317156(0x153)](a24_0x2a13d2[_0x317156(0xf1)]('✓')+_0x317156(0xeb));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a24_0x5aa101(0x120);[a24_0x5aa101(0xea)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a24_0x5aa101(0x142),a24_0x5aa101(0x141),'parent_segment',a24_0x5aa101(0xff),'llm_agent',a24_0x5aa101(0xea)];[a24_0x5aa101(0xf3)](_0x284cfd){const _0x956da7=a24_0x5aa101,{args:_0x51b3ee,options:_0x1018c5}=_0x284cfd,_0x5dae60=_0x1018c5['profile']||getActiveProfile();if(!_0x5dae60)return _0x956da7(0x14c);if(_0x51b3ee[_0x956da7(0x151)]===0x0)return _0x956da7(0x104)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const _0x13bb94=_0x51b3ee[0x0];if(!_0x13bb94[_0x956da7(0x14e)]('='))return _0x956da7(0x12a)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const [_0xf4d4d1]=_0x13bb94[_0x956da7(0x14a)]('=',0x2);if(!ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x14e)](_0xf4d4d1))return _0x956da7(0x119)+_0xf4d4d1+_0x956da7(0x10b)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');return undefined;}async['execute'](_0x2fcb25){const _0x48870b=a24_0x5aa101,{args:_0x20ef05,options:_0x24e7f4}=_0x2fcb25,_0x1cbe69=_0x24e7f4[_0x48870b(0x138)]||getActiveProfile(),[_0x584c3e,..._0x425abc]=_0x20ef05[0x0][_0x48870b(0x14a)]('='),_0x5ceef4=_0x425abc[_0x48870b(0x148)]('=');console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0x12c)]('tdx:\x20profile\x20set'));if(!profileExists(_0x1cbe69)){const _0x25ac28=await a24_0x3c204d({'type':_0x48870b(0xfc),'name':_0x48870b(0x13f),'message':_0x48870b(0x10d)+_0x1cbe69+_0x48870b(0x125),'initial':!![]});if(!_0x25ac28[_0x48870b(0x13f)])return console[_0x48870b(0x153)]('Operation\x20cancelled'),0x1;}const _0x56816e=loadProfile(_0x1cbe69),_0x135875=_0x56816e?.['config']||{};if(_0x584c3e===_0x48870b(0x142)){const _0x453129=resolveSite(_0x5ceef4);console[_0x48870b(0x153)]('Changing\x20site\x20to\x20\x27'+_0x453129+_0x48870b(0x12e)),console['log'](_0x48870b(0x10c)),console[_0x48870b(0x153)]('\x20\x20'+getConsoleUrl(_0x453129,'/app/mp/ak'));const _0xa6097f=await a24_0x3c204d({'type':_0x48870b(0x139),'name':'apiKey','message':_0x48870b(0x133),'validate':_0x55842c=>{const _0x294f02=_0x48870b;if(!_0x55842c||!_0x55842c[_0x294f02(0x14f)]())return _0x294f02(0x11a);return!![];}});if(!_0xa6097f['apiKey'])return console['log'](_0x48870b(0x117)),0x1;console[_0x48870b(0x153)](_0x48870b(0x158));try{const _0x5ed27a=TDX[_0x48870b(0x13f)]({'site':_0x453129,'apiKey':_0xa6097f[_0x48870b(0x154)][_0x48870b(0x14f)](),'logLevel':_0x24e7f4[_0x48870b(0x155)]??LogLevel[_0x48870b(0xf8)]}),_0x4974fa=await _0x5ed27a[_0x48870b(0x159)][_0x48870b(0x144)]();console[_0x48870b(0x153)](a24_0x2a13d2['green']('✓')+_0x48870b(0x132)+_0x4974fa[_0x48870b(0x124)]+')');const _0x932b2e=await isKeychainAvailable();_0x932b2e?(await saveAPIKeyAsync(_0xa6097f['apiKey'][_0x48870b(0x14f)](),_0x453129,_0x1cbe69),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+_0x48870b(0x150))):console['warn'](a24_0x2a13d2['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x135875[_0x48870b(0x142)]=_0x453129;}catch(_0x58e249){if(_0x58e249 instanceof HTTPClientError&&_0x58e249[_0x48870b(0x145)]===0x191)return printAuthError(_0x58e249),0x1;return console[_0x48870b(0x103)](a24_0x2a13d2['red'](_0x48870b(0x100)+(_0x58e249 instanceof Error?_0x58e249[_0x48870b(0x123)]:String(_0x58e249)))),console[_0x48870b(0x103)](_0x48870b(0xfa)),0x1;}}else _0x135875[_0x584c3e]=_0x5ceef4||undefined;return saveProfileToUserConfig(_0x1cbe69,_0x135875),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+'\x20Profile\x20\x27'+_0x1cbe69+_0x48870b(0x115)+_0x584c3e+'='+(_0x5ceef4||_0x48870b(0xef))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x5aa101(0x137)]=a24_0x5aa101(0xfb);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x13b);[a24_0x5aa101(0xf3)](_0x21185c){const _0x579893=a24_0x5aa101,{args:_0x1b61b8}=_0x21185c;if(_0x1b61b8['length']===0x0)return _0x579893(0x107);return undefined;}async[a24_0x5aa101(0x112)](_0x4e345b){const _0x3ea510=a24_0x5aa101,{args:_0x95c4e3,options:_0xb779f6}=_0x4e345b,_0x1b3e6a=_0x95c4e3[0x0],_0x3e8937=_0xb779f6[_0x3ea510(0xf5)];cleanExpiredSessions();if(!profileExists(_0x1b3e6a)){console['error'](a24_0x2a13d2[_0x3ea510(0x11b)](_0x3ea510(0x10d)+_0x1b3e6a+'\x27\x20does\x20not\x20exist.')),console['log']('\x0aAvailable\x20profiles:');const _0x45c291=listProfiles();if(_0x45c291[_0x3ea510(0x151)]===0x0)console[_0x3ea510(0x153)](_0x3ea510(0x10a));else for(const _0x43b268 of _0x45c291){console['log'](_0x3ea510(0x11c)+_0x43b268[_0x3ea510(0x137)]);}return 0x1;}if(_0x3e8937){const _0x53eccd=a24_0x142e8f[_0x3ea510(0x148)](getConfigDir(),_0x3ea510(0xf0));return saveActiveProfileToUserConfig(_0x1b3e6a),console[_0x3ea510(0x153)](_0x3ea510(0xec)+a24_0x2a13d2['green'](_0x1b3e6a)),console['log'](a24_0x2a13d2['dim'](_0x3ea510(0x147)+_0x53eccd)),0x0;}const _0x42744a=_0xb779f6[_0x3ea510(0x14b)]||getCurrentSessionPID()[_0x3ea510(0xf4)]();return saveSessionContext({'profile':_0x1b3e6a},_0xb779f6[_0x3ea510(0x14b)]),console[_0x3ea510(0x153)](_0x3ea510(0x14d)+a24_0x2a13d2[_0x3ea510(0xf1)](_0x1b3e6a)+'\x20'+a24_0x2a13d2['dim'](_0x3ea510(0xf2)+_0x42744a+')')),console[_0x3ea510(0x153)](a24_0x2a13d2['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x1b3e6a+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a25_0x18aa(){const _0x858917=['error','843055DTtjJl','10717xUxepA','548408tysRsR','execute','description','302215HQgfEt','message','profiles','name','2006152RDopLT','2432kwrfaH','map','Error:\x20','449847GWkBVk','log','config','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2278794EIuzQP'];a25_0x18aa=function(){return _0x858917;};return a25_0x18aa();}const a25_0x16e5a5=a25_0x1129;(function(_0x45f223,_0x1f9d0b){const _0x875c76=a25_0x1129,_0x4eee92=_0x45f223();while(!![]){try{const _0x13184f=parseInt(_0x875c76(0x19e))/0x1+parseInt(_0x875c76(0x1ae))/0x2+-parseInt(_0x875c76(0x1a6))/0x3+parseInt(_0x875c76(0x1a2))/0x4+parseInt(_0x875c76(0x1ac))/0x5+-parseInt(_0x875c76(0x1aa))/0x6+parseInt(_0x875c76(0x1ad))/0x7*(-parseInt(_0x875c76(0x1a3))/0x8);if(_0x13184f===_0x1f9d0b)break;else _0x4eee92['push'](_0x4eee92['shift']());}catch(_0x1b90b7){_0x4eee92['push'](_0x4eee92['shift']());}}}(a25_0x18aa,0x3d604));function a25_0x1129(_0x133a56,_0x12cec8){_0x133a56=_0x133a56-0x19e;const _0x18aae1=a25_0x18aa();let _0x1129e9=_0x18aae1[_0x133a56];return _0x1129e9;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x16e5a5(0x1a1)]=a25_0x16e5a5(0x1a0);[a25_0x16e5a5(0x1b0)]='List\x20all\x20available\x20profiles';async[a25_0x16e5a5(0x1af)](_0xf9a84d){const _0x115cb1=a25_0x16e5a5,{options:_0x50f0e9}=_0xf9a84d;try{const _0x44b2c9=listProfiles(),_0x392e8c=getActiveProfile();if(_0x44b2c9['length']===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x115cb1(0x1a7)](_0x115cb1(0x1a9)),console[_0x115cb1(0x1a7)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x3a2e49=_0x44b2c9[_0x115cb1(0x1a4)](_0x2b19fc=>{const _0x57a723=_0x115cb1,_0x5e5c97=_0x2b19fc[_0x57a723(0x1a1)]===_0x392e8c,_0x5cfd70=getProfileParams(_0x2b19fc['config']);return{'name':_0x2b19fc['name'],'active':_0x5e5c97,'scope':_0x2b19fc['scope'],'description':_0x2b19fc[_0x57a723(0x1a8)][_0x57a723(0x1b0)]||'','params':_0x5cfd70};});return await handleSDKOutput(_0x3a2e49,_0x50f0e9),0x0;}catch(_0x4ec6fa){return _0x4ec6fa instanceof Error&&console[_0x115cb1(0x1ab)](_0x115cb1(0x1a5)+_0x4ec6fa[_0x115cb1(0x19f)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a26_0x1b370e=a26_0x443d;(function(_0x35e0fc,_0x21cd85){const _0x507ed4=a26_0x443d,_0x362352=_0x35e0fc();while(!![]){try{const _0xea94de=parseInt(_0x507ed4(0x121))/0x1*(parseInt(_0x507ed4(0x128))/0x2)+-parseInt(_0x507ed4(0x132))/0x3+-parseInt(_0x507ed4(0x109))/0x4+-parseInt(_0x507ed4(0x123))/0x5*(parseInt(_0x507ed4(0x126))/0x6)+parseInt(_0x507ed4(0x101))/0x7*(parseInt(_0x507ed4(0x11f))/0x8)+parseInt(_0x507ed4(0x122))/0x9+-parseInt(_0x507ed4(0x115))/0xa*(-parseInt(_0x507ed4(0x130))/0xb);if(_0xea94de===_0x21cd85)break;else _0x362352['push'](_0x362352['shift']());}catch(_0x2bdbae){_0x362352['push'](_0x362352['shift']());}}}(a26_0x3c97,0xac3ce));import{BaseCommand}from'./command.js';function a26_0x3c97(){const _0x29d4fa=['validate','totalSplits','8634cfZalm','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','6hrgMIi','error','\x0aAll\x20results\x20saved\x20to\x20','information_schema','completedSplits','Executing\x20query\x20[','processedRows','SQL:\x20','16159XPFPqO','\x20rows\x20','3745950gkHQOC','stats','data','81893HozVMD','verbose','setExtra','database','output','join','originalMessage','message','2056196SNfGms','jobId','Site:\x20','options','\x20[Job\x20ID:\x20','setPhase','Error:\x20','Executing\x20statement\x20','Executing\x20query...','...','Statement\x20','site','12020dzUKGI','Run\x20Trino\x20queries\x20(streaming)','description','length','push','query','catalog','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20-\x20','execute','824SWKmuY','in\x20','127685elRMML','2118384kUWOEA','3895rYXulQ'];a26_0x3c97=function(){return _0x29d4fa;};return a26_0x3c97();}import{SDKError}from'../sdk/index.js';function a26_0x443d(_0x32db43,_0x5b3350){_0x32db43=_0x32db43-0xff;const _0x3c976d=a26_0x3c97();let _0x443d57=_0x3c976d[_0x32db43];return _0x443d57;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x1b370e(0x11a);[a26_0x1b370e(0x117)]=a26_0x1b370e(0x116);async['execute'](_0x39547d){const _0x4300db=a26_0x1b370e,{options:_0x1a6bef,args:_0x271577,tdx:_0x1166d2}=_0x39547d,_0x36420a=_0x271577[0x0],_0x581fb5=_0x1a6bef['file'];let _0x139ced;try{if(_0x581fb5)_0x139ced=readSqlStatementsFromFile(_0x581fb5);else{if(_0x36420a==='-')_0x139ced=await readSqlStatementsFromStdin();else{if(_0x36420a&&isSqlFilePath(_0x36420a))_0x139ced=readSqlStatementsFromFile(_0x36420a);else{if(_0x36420a)_0x139ced=splitSqlStatements(_0x36420a);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3594bf){return console[_0x4300db(0x129)](_0x4300db(0x10f)+_0x3594bf['message']),0x1;}const _0x564e00=_0x1a6bef[_0x4300db(0x104)]||_0x4300db(0x12b),_0x398c3d=_0x1a6bef[_0x4300db(0x11b)];try{const _0x1c64a4=[],_0x1ed2ea=!!_0x1a6bef[_0x4300db(0x105)];for(let _0x44d5c0=0x0;_0x44d5c0<_0x139ced[_0x4300db(0x118)];_0x44d5c0++){const _0x480e59=_0x139ced[_0x44d5c0],_0x5a6bdc=_0x44d5c0+0x1,_0x50bbd0=_0x139ced[_0x4300db(0x118)],_0x45f9a7=_0x50bbd0>0x1;_0x1a6bef[_0x4300db(0x102)]&&(console['error']('\x0a'+(_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':':'')),console[_0x4300db(0x129)](_0x4300db(0x10b)+_0x1a6bef[_0x4300db(0x114)]),console['error']('Catalog:\x20'+(_0x398c3d||'td')),console[_0x4300db(0x129)]('Schema:\x20'+_0x564e00),console[_0x4300db(0x129)](_0x4300db(0x12f)+_0x480e59));const _0x5e052c=_0x45f9a7?_0x4300db(0x110)+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x112):_0x4300db(0x111);try{const _0x54ce96=await withProgressSpinner(_0x5e052c,async _0x369e8e=>{const _0x5da0d7=_0x4300db,_0x39801e=await _0x1166d2['query'][_0x5da0d7(0x11e)](_0x480e59,{'catalog':_0x398c3d,'schema':_0x564e00,'onJobId':_0x871de1=>{_0x369e8e['setJobId'](_0x871de1);},'onProgress':_0x43c6e4=>{const _0x53543c=_0x5da0d7;_0x369e8e[_0x53543c(0x10e)](_0x53543c(0x12d)+_0x43c6e4['state']+']'),_0x369e8e[_0x53543c(0x103)](formatRows(_0x43c6e4[_0x53543c(0x12e)])+_0x53543c(0x131)+_0x43c6e4[_0x53543c(0x12c)]+'/'+_0x43c6e4[_0x53543c(0x125)]+'\x20splits');}});return _0x39801e;},{'verbose':_0x1a6bef[_0x4300db(0x102)]}),_0x42efdf=_0x54ce96[_0x4300db(0x100)],_0x2ca288=_0x42efdf[_0x4300db(0x10a)]?_0x4300db(0x10d)+_0x42efdf['jobId']+']':'',_0x68bda8=_0x45f9a7?'Statement\x20'+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x11d):'';console['error']('✔\x20'+_0x68bda8+'Query\x20completed:\x20Processed\x20'+formatRows(_0x42efdf[_0x4300db(0xff)]['processedRows'])+_0x4300db(0x131)+(_0x4300db(0x120)+formatElapsed(_0x42efdf[_0x4300db(0xff)]['elapsedTimeMillis'])+_0x2ca288));if(_0x45f9a7&&_0x1ed2ea){const _0x42fe49=resolveOutputOptions(_0x1a6bef),_0x4980e6=await formatQueryOutput(_0x42efdf,_0x42fe49);_0x1c64a4[_0x4300db(0x119)](_0x4980e6);}else await handleQueryOutput(_0x42efdf,_0x1a6bef);}catch(_0x425b2e){const _0x37330b=_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':\x0a':'',_0x5d71d0=_0x425b2e instanceof SDKError?_0x425b2e[_0x4300db(0x107)]:_0x425b2e[_0x4300db(0x108)];return console['error'](''+_0x37330b+_0x5d71d0),0x1;}}if(_0x139ced[_0x4300db(0x118)]>0x1&&_0x1ed2ea&&_0x1c64a4[_0x4300db(0x118)]>0x0){const _0x2f993b=_0x1c64a4[_0x4300db(0x106)]('\x0a');writeFileSync(_0x1a6bef[_0x4300db(0x105)],_0x2f993b),console[_0x4300db(0x129)](_0x4300db(0x12a)+_0x1a6bef[_0x4300db(0x105)]);}return 0x0;}catch(_0x3bffea){throw _0x3bffea;}}[a26_0x1b370e(0x124)](_0x5562a9){const _0xf5faa6=a26_0x1b370e,_0x2f320c=_0x5562a9['args'][0x0],_0x303f64=_0x5562a9[_0xf5faa6(0x10c)]['file'];if(!_0x2f320c&&!_0x303f64)return _0xf5faa6(0x127);if(_0x2f320c&&_0x303f64)return _0xf5faa6(0x11c);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x5e2678=a27_0x4084;(function(_0x394d2e,_0x235495){const _0x4e62d4=a27_0x4084,_0x35ae50=_0x394d2e();while(!![]){try{const _0x4dd111=-parseInt(_0x4e62d4(0x21d))/0x1+parseInt(_0x4e62d4(0x1f8))/0x2*(-parseInt(_0x4e62d4(0x1b1))/0x3)+-parseInt(_0x4e62d4(0x19a))/0x4+parseInt(_0x4e62d4(0x202))/0x5+-parseInt(_0x4e62d4(0x19e))/0x6*(parseInt(_0x4e62d4(0x1c9))/0x7)+-parseInt(_0x4e62d4(0x225))/0x8+parseInt(_0x4e62d4(0x19f))/0x9;if(_0x4dd111===_0x235495)break;else _0x35ae50['push'](_0x35ae50['shift']());}catch(_0x101bd7){_0x35ae50['push'](_0x35ae50['shift']());}}}(a27_0x585d,0xab4d0));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a27_0x4084(_0xc0b1ff,_0x301c5e){_0xc0b1ff=_0xc0b1ff-0x18b;const _0x585db9=a27_0x585d();let _0x408487=_0x585db9[_0xc0b1ff];return _0x408487;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x2a3810 from'chalk';async function resolveSegmentTarget(_0x26e361,_0x204103,_0x280e83){const _0xcb4c83=a27_0x4084;if(isYamlFilePath(_0x26e361))try{const _0x549d64=await resolveYamlFilePath(_0x26e361);return _0x280e83&&(console[_0xcb4c83(0x222)](_0xcb4c83(0x1e9)+_0x26e361),console['error']('\x20\x20Parent\x20segment:\x20'+_0x549d64[_0xcb4c83(0x1d9)]),console[_0xcb4c83(0x222)](_0xcb4c83(0x203)+_0x549d64[_0xcb4c83(0x19c)]),console[_0xcb4c83(0x222)](_0xcb4c83(0x1dc)+(_0x549d64[_0xcb4c83(0x218)]||_0xcb4c83(0x1bc))),console[_0xcb4c83(0x222)](_0xcb4c83(0x21f)+_0x549d64[_0xcb4c83(0x1c3)])),_0x549d64[_0xcb4c83(0x1c3)];}catch(_0x7b4565){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xcb4c83(0x226)+_0x7b4565[_0xcb4c83(0x1bb)]);}if(!_0x204103)throw new SDKError(ErrorCode[_0xcb4c83(0x1ca)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x204103+'/'+_0x26e361;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x5e2678(0x214)]='segment:describe';['description']=a27_0x5e2678(0x1ac);async[a27_0x5e2678(0x1d4)](_0x1c8cf7){const _0x61e02f=a27_0x5e2678,{options:_0x169b64,args:_0x4a42eb,tdx:_0x5bdfd3}=_0x1c8cf7,_0x359d8e=_0x4a42eb[0x0],_0x18fbb0=!_0x359d8e&&!!_0x169b64[_0x61e02f(0x1d9)],_0x5b499e=_0x359d8e||_0x169b64['parentSegment'];if(!_0x5b499e)return console[_0x61e02f(0x222)](_0x61e02f(0x1af)),console[_0x61e02f(0x222)](_0x61e02f(0x221)),console[_0x61e02f(0x222)](_0x61e02f(0x1cc)),console['error'](_0x61e02f(0x1fd)),console['error'](_0x61e02f(0x215)),console[_0x61e02f(0x222)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x61e02f(0x222)](_0x61e02f(0x1b0)),0x1;try{const _0xac41c1=_0x169b64[_0x61e02f(0x228)];let _0x586181=_0x5b499e;!_0x18fbb0&&_0xac41c1&&!_0x5b499e['includes']('/')&&(_0x586181=_0xac41c1+'/'+_0x5b499e,_0x169b64[_0x61e02f(0x18d)]&&console[_0x61e02f(0x222)](_0x61e02f(0x20e)+_0x586181));const _0x1c5f45=await withSpinner('Resolving\x20path\x20\x27'+_0x586181+_0x61e02f(0x1fb),()=>_0x5bdfd3[_0x61e02f(0x1cf)]['resolvePathToResource'](_0x586181),{'verbose':_0x169b64[_0x61e02f(0x18d)]}),_0xcd8d98=_0x1c5f45[_0x61e02f(0x196)];_0x169b64[_0x61e02f(0x18d)]&&(console[_0x61e02f(0x222)](_0x61e02f(0x1eb)+_0xcd8d98['type']),console['error'](_0x61e02f(0x205)+_0xcd8d98[_0x61e02f(0x220)]),_0xcd8d98[_0x61e02f(0x1dd)]&&console[_0x61e02f(0x222)](_0x61e02f(0x1f9)+_0xcd8d98[_0x61e02f(0x1dd)]),_0xcd8d98['segmentId']&&console[_0x61e02f(0x222)]('Segment\x20ID:\x20'+_0xcd8d98[_0x61e02f(0x1ea)]));if(_0xcd8d98[_0x61e02f(0x197)]==='parent'){const _0x5d66a4=await withSpinner(_0x61e02f(0x1ee),()=>_0x5bdfd3[_0x61e02f(0x1cf)][_0x61e02f(0x1ab)](_0xcd8d98[_0x61e02f(0x220)]),{'verbose':_0x169b64[_0x61e02f(0x18d)]});await handleSingleObjectOutput(_0x5d66a4['data'],_0x169b64);}else{if(_0xcd8d98[_0x61e02f(0x197)]===_0x61e02f(0x1bd)){if(!_0xcd8d98[_0x61e02f(0x1dd)])throw new SDKError(ErrorCode[_0x61e02f(0x200)],_0x61e02f(0x1f5));const _0x8c7fa7=await withSpinner(_0x61e02f(0x1a9),()=>_0x5bdfd3[_0x61e02f(0x1cf)][_0x61e02f(0x1d6)](_0xcd8d98[_0x61e02f(0x1dd)]),{'verbose':_0x169b64['verbose']});await handleSingleObjectOutput(_0x8c7fa7[_0x61e02f(0x196)],_0x169b64);}else{if(_0xcd8d98[_0x61e02f(0x197)]===_0x61e02f(0x1cf)){if(!_0xcd8d98[_0x61e02f(0x1ea)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x61e02f(0x1f3));const _0x4bbce9=await withSpinner(_0x61e02f(0x1aa),()=>_0x5bdfd3[_0x61e02f(0x1cf)][_0x61e02f(0x193)](_0xcd8d98['parentId'],_0xcd8d98['segmentId']),{'verbose':_0x169b64['verbose']});await handleSingleObjectOutput(_0x4bbce9['data'],_0x169b64);}}}return 0x0;}catch(_0x4d51fd){if(_0x4d51fd instanceof SDKError)return console[_0x61e02f(0x222)]('Error:\x20'+_0x4d51fd[_0x61e02f(0x1bb)]),_0x4d51fd[_0x61e02f(0x20d)]&&console['error']('\x20\x20Cause:\x20'+_0x4d51fd[_0x61e02f(0x20d)]),0x1;throw _0x4d51fd;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x5e2678(0x214)]=a27_0x5e2678(0x18e);[a27_0x5e2678(0x18b)]=a27_0x5e2678(0x208);async[a27_0x5e2678(0x1d4)](_0x2ca725){const _0x3ca5ae=a27_0x5e2678,{options:_0x306308,args:_0x2c1d1a,tdx:_0x5df1fa}=_0x2ca725,_0x112667=_0x2c1d1a[0x0];if(!_0x112667)return console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1cd)),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1fa)),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1f1)),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1cc)),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x20a)),console['error'](_0x3ca5ae(0x217)),0x1;try{const _0x5baa9f=_0x306308[_0x3ca5ae(0x1d9)],_0x2417f6=await resolveSegmentTarget(_0x112667,_0x5baa9f,_0x306308['verbose']);_0x306308['verbose']&&console['error'](_0x3ca5ae(0x195)+_0x2417f6);const _0x537e83=await withSpinner('Resolving\x20\x27'+_0x112667+_0x3ca5ae(0x1fb),()=>_0x5df1fa['segment']['resolvePathToResource'](_0x2417f6),{'verbose':_0x306308[_0x3ca5ae(0x18d)]}),_0x9131df=_0x537e83[_0x3ca5ae(0x196)];_0x306308[_0x3ca5ae(0x18d)]&&(console['error']('Resolved\x20type:\x20'+_0x9131df['type']),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x205)+_0x9131df[_0x3ca5ae(0x220)]));if(_0x9131df[_0x3ca5ae(0x197)]===_0x3ca5ae(0x1bd))return console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1e3)),console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1c6)),0x1;if(_0x9131df[_0x3ca5ae(0x197)]===_0x3ca5ae(0x1f4))return console[_0x3ca5ae(0x222)](_0x3ca5ae(0x1df)),console['error'](_0x3ca5ae(0x1ec)),0x1;if(!_0x9131df[_0x3ca5ae(0x1ea)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3ca5ae(0x1f3));const _0xef5bcb=await withSpinner(_0x3ca5ae(0x1e7),()=>_0x5df1fa[_0x3ca5ae(0x1cf)][_0x3ca5ae(0x1ff)](_0x9131df[_0x3ca5ae(0x220)],_0x9131df[_0x3ca5ae(0x1ea)]),{'verbose':_0x306308[_0x3ca5ae(0x18d)]});let _0x35167c=_0xef5bcb['data'];const _0x32227e=resolveLimit(_0x306308[_0x3ca5ae(0x1f7)],DEFAULT_DISPLAY_LIMIT),_0x27670a=/\bLIMIT\s+\d+/i[_0x3ca5ae(0x1e8)](_0x35167c);!_0x27670a&&(_0x35167c=_0x35167c[_0x3ca5ae(0x1a7)]()[_0x3ca5ae(0x1a4)](/;+$/,''),_0x35167c=_0x3ca5ae(0x1f6)+_0x35167c+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x32227e);_0x306308[_0x3ca5ae(0x18d)]&&console[_0x3ca5ae(0x222)](_0x3ca5ae(0x191)+_0x35167c);const _0xd63099=await withProgressSpinner(_0x3ca5ae(0x192),async _0x181fcf=>{const _0x4014f4=_0x3ca5ae,_0x29a753=await _0x5df1fa[_0x4014f4(0x1ed)][_0x4014f4(0x1d4)](_0x35167c,{'catalog':'td','schema':'information_schema','onJobId':_0x746e5a=>{const _0x412556=_0x4014f4;_0x181fcf[_0x412556(0x198)](_0x746e5a);}});return _0x29a753;},{'verbose':_0x306308['verbose']}),_0x16ee37=_0xd63099[_0x3ca5ae(0x196)],_0x5aca78=_0x16ee37[_0x3ca5ae(0x219)]?'\x20[Job\x20ID:\x20'+_0x16ee37[_0x3ca5ae(0x219)]+']':'';return console['error'](_0x3ca5ae(0x204)+_0x16ee37[_0x3ca5ae(0x1e2)][_0x3ca5ae(0x21c)][_0x3ca5ae(0x21b)]()+_0x3ca5ae(0x207)+(_0x3ca5ae(0x216)+formatElapsed(_0x16ee37[_0x3ca5ae(0x1e2)][_0x3ca5ae(0x1e4)])+_0x5aca78)),await handleQueryOutput(_0x16ee37,_0x306308),0x0;}catch(_0x2ec6f1){if(_0x2ec6f1 instanceof SDKError)return console['error'](_0x3ca5ae(0x1d7)+_0x2ec6f1[_0x3ca5ae(0x1cb)]+']'),console['error']('\x0a'+_0x2ec6f1['message']),0x1;throw _0x2ec6f1;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x5e2678(0x1be);[a27_0x5e2678(0x18b)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a27_0x5e2678(0x1d4)](_0x232cc8){const _0x1f9f98=a27_0x5e2678,{options:_0x103bd9,args:_0x1a923d,tdx:_0x2f1e5b}=_0x232cc8;if(_0x1a923d[_0x1f9f98(0x1b6)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x159a24=_0x1a923d[0x0];try{_0x103bd9[_0x1f9f98(0x18d)]&&(console[_0x1f9f98(0x222)](_0x1f9f98(0x19b)+_0x103bd9[_0x1f9f98(0x1c8)]),console[_0x1f9f98(0x222)](_0x1f9f98(0x1d5)+_0x159a24));const _0x332e91=await withSpinner(_0x1f9f98(0x1db)+_0x159a24+_0x1f9f98(0x1fb),()=>_0x2f1e5b['segment']['resolveParentId'](_0x159a24),{'verbose':_0x103bd9[_0x1f9f98(0x18d)]}),_0x428de4=_0x332e91['data'];_0x103bd9[_0x1f9f98(0x18d)]&&console['error'](_0x1f9f98(0x1e5)+_0x428de4);const _0x14b08b=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x159a24+'\x27...',()=>_0x2f1e5b[_0x1f9f98(0x1cf)][_0x1f9f98(0x1d0)](_0x428de4),{'verbose':_0x103bd9['verbose']}),_0x129ded=_0x14b08b[_0x1f9f98(0x196)];return console[_0x1f9f98(0x222)]('✔\x20Found\x20'+_0x129ded[_0x1f9f98(0x1b6)]+_0x1f9f98(0x1a2)+(_0x129ded[_0x1f9f98(0x1b6)]!==0x1?'s':'')),await handleSDKOutput(_0x129ded,_0x103bd9),0x0;}catch(_0x31ff1f){if(_0x31ff1f instanceof SDKError)return console[_0x1f9f98(0x222)](_0x1f9f98(0x1a8)+_0x31ff1f[_0x1f9f98(0x1bb)]),_0x31ff1f[_0x1f9f98(0x20d)]&&console['error'](_0x1f9f98(0x1b5)+_0x31ff1f[_0x1f9f98(0x20d)]),0x1;throw _0x31ff1f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x5e2678(0x214)]='segment:folder:show';['description']='Show\x20segment\x20folder\x20details';async[a27_0x5e2678(0x1d4)](_0x4b540c){const _0x11e851=a27_0x5e2678,{options:_0x24c121,args:_0xe96fd1,tdx:_0xc8478f}=_0x4b540c;if(_0xe96fd1[_0x11e851(0x1b6)]===0x0)return console['error'](_0x11e851(0x1b9)),console['error'](_0x11e851(0x1b3)),0x1;try{const {parentId:_0x5df78b,childId:_0x202289}=parseSegmentRef(_0xe96fd1[0x0]);_0x24c121[_0x11e851(0x18d)]&&(console[_0x11e851(0x222)](_0x11e851(0x19b)+_0x24c121[_0x11e851(0x1c8)]),console[_0x11e851(0x222)]('Parent\x20name:\x20'+_0x5df78b),_0x202289&&console[_0x11e851(0x222)](_0x11e851(0x20f)+_0x202289));if(!_0x202289)return console[_0x11e851(0x222)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x427a10=await withSpinner(_0x11e851(0x1db)+_0x5df78b+_0x11e851(0x1fb),()=>_0xc8478f['segment']['resolveParentId'](_0x5df78b),{'verbose':_0x24c121[_0x11e851(0x18d)]}),_0x4562c8=_0x427a10[_0x11e851(0x196)];_0x24c121['verbose']&&console[_0x11e851(0x222)](_0x11e851(0x1e5)+_0x4562c8);const _0x4a2d12=await withSpinner(_0x11e851(0x1f2)+_0x202289+_0x11e851(0x1fb),()=>_0xc8478f[_0x11e851(0x1cf)][_0x11e851(0x1e0)](_0x4562c8,_0x202289),{'verbose':_0x24c121[_0x11e851(0x18d)]}),_0xadb8ec=_0x4a2d12[_0x11e851(0x196)];_0x24c121['verbose']&&console[_0x11e851(0x222)](_0x11e851(0x1c7)+_0xadb8ec);const _0x4b3bb6=await withSpinner('Fetching\x20folder\x20\x27'+_0x202289+_0x11e851(0x1fb),()=>_0xc8478f['segment'][_0x11e851(0x1d6)](_0xadb8ec),{'verbose':_0x24c121['verbose']});return await handleSDKOutput([_0x4b3bb6[_0x11e851(0x196)]],_0x24c121),0x0;}catch(_0x3e3353){if(_0x3e3353 instanceof SDKError)return console['error'](_0x11e851(0x1a8)+_0x3e3353['message']),_0x3e3353['cause']&&console[_0x11e851(0x222)](_0x11e851(0x1b5)+_0x3e3353['cause']),0x1;throw _0x3e3353;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x5e2678(0x214)]=a27_0x5e2678(0x1ad);[a27_0x5e2678(0x18b)]=a27_0x5e2678(0x21e);async[a27_0x5e2678(0x1d4)](_0x25b45b){const _0x17ad67=a27_0x5e2678,{options:_0x2d4a2d,args:_0xe75895,tdx:_0x49bde7}=_0x25b45b,_0x5a0604=_0xe75895[0x0];if(!_0x5a0604)return console[_0x17ad67(0x222)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x17ad67(0x222)](_0x17ad67(0x1ae)),console[_0x17ad67(0x222)](_0x17ad67(0x224)),console[_0x17ad67(0x222)](_0x17ad67(0x1cc)),console[_0x17ad67(0x222)](_0x17ad67(0x211)),console[_0x17ad67(0x222)](_0x17ad67(0x1ba)),0x1;try{const _0x361c87=_0x2d4a2d['parentSegment'],_0x2c4039=await resolveSegmentTarget(_0x5a0604,_0x361c87,_0x2d4a2d['verbose']);_0x2d4a2d[_0x17ad67(0x18d)]&&console[_0x17ad67(0x222)](_0x17ad67(0x195)+_0x2c4039);const _0x183f0c=await withSpinner('Resolving\x20\x27'+_0x5a0604+_0x17ad67(0x1fb),()=>_0x49bde7[_0x17ad67(0x1cf)]['resolvePathToResource'](_0x2c4039),{'verbose':_0x2d4a2d['verbose']}),_0x52c0bc=_0x183f0c[_0x17ad67(0x196)];_0x2d4a2d[_0x17ad67(0x18d)]&&(console[_0x17ad67(0x222)](_0x17ad67(0x1eb)+_0x52c0bc['type']),console[_0x17ad67(0x222)]('Parent\x20ID:\x20'+_0x52c0bc[_0x17ad67(0x220)]));if(_0x52c0bc[_0x17ad67(0x197)]===_0x17ad67(0x1bd))return console['error'](_0x17ad67(0x1c0)),console[_0x17ad67(0x222)](_0x17ad67(0x1d2)),0x1;if(_0x52c0bc[_0x17ad67(0x197)]==='parent')return console[_0x17ad67(0x222)](_0x17ad67(0x1f0)),console['error']('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x52c0bc['segmentId'])throw new SDKError(ErrorCode[_0x17ad67(0x223)],_0x17ad67(0x1f3));const _0x50d8d7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x49bde7['segment'][_0x17ad67(0x1ff)](_0x52c0bc[_0x17ad67(0x220)],_0x52c0bc['segmentId']),{'verbose':_0x2d4a2d[_0x17ad67(0x18d)]}),_0x217691=_0x50d8d7[_0x17ad67(0x196)];return _0x2d4a2d[_0x17ad67(0x1a1)]===_0x17ad67(0x206)||_0x2d4a2d[_0x17ad67(0x1a1)]===_0x17ad67(0x1e1)?await handleSDKOutput([{'sql':_0x217691}],_0x2d4a2d):console[_0x17ad67(0x21a)](_0x217691),0x0;}catch(_0x45c406){if(_0x45c406 instanceof SDKError)return console[_0x17ad67(0x222)]('Error:\x20'+_0x45c406['message']),_0x45c406[_0x17ad67(0x20d)]&&console[_0x17ad67(0x222)]('\x20\x20Cause:\x20'+_0x45c406['cause']),0x1;throw _0x45c406;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x5e2678(0x214)]=a27_0x5e2678(0x1fe);[a27_0x5e2678(0x18b)]=a27_0x5e2678(0x1fc);async[a27_0x5e2678(0x1d4)](_0x529bae){const _0x3819da=a27_0x5e2678,{options:_0x319fa4,args:_0x536c4b,tdx:_0x332080}=_0x529bae,_0x246158=_0x319fa4;if(_0x536c4b[_0x3819da(0x1b6)]<0x2)return console[_0x3819da(0x222)](_0x3819da(0x1b8)),console[_0x3819da(0x222)](_0x3819da(0x1a6)),0x1;const _0x1a247c=_0x536c4b[0x0],_0x2a0f78=_0x536c4b[0x1];_0x246158[_0x3819da(0x18d)]&&(console[_0x3819da(0x222)](_0x3819da(0x19b)+_0x246158[_0x3819da(0x1c8)]),console['error'](_0x3819da(0x20c)+_0x1a247c),console[_0x3819da(0x222)](_0x3819da(0x20f)+_0x2a0f78));let _0x4677ed;if(_0x246158[_0x3819da(0x1d3)]){const _0x5a5d68=_0x246158[_0x3819da(0x1d3)],_0x5d794e=await withSpinner(_0x3819da(0x1db)+_0x1a247c+_0x3819da(0x1fb),()=>_0x332080[_0x3819da(0x1cf)][_0x3819da(0x194)](_0x1a247c),{'verbose':_0x246158[_0x3819da(0x18d)]}),_0x33e8a8=_0x5d794e[_0x3819da(0x196)],_0x5e0ef5=await withSpinner(_0x3819da(0x19d)+_0x5a5d68+_0x3819da(0x1fb),()=>_0x332080['segment']['resolveFolderId'](_0x33e8a8,_0x5a5d68),{'verbose':_0x246158[_0x3819da(0x18d)]});_0x4677ed=_0x5e0ef5[_0x3819da(0x196)],_0x246158['verbose']&&console[_0x3819da(0x222)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4677ed);}const _0x11d836={'name':_0x2a0f78,'description':_0x246158['description'],'parentFolderId':_0x4677ed},_0x565785=await withSpinner('Creating\x20folder\x20\x27'+_0x2a0f78+_0x3819da(0x1fb),()=>_0x332080[_0x3819da(0x1cf)][_0x3819da(0x1b7)](_0x1a247c,_0x11d836),{'verbose':_0x246158[_0x3819da(0x18d)]}),_0x1357cd=_0x565785[_0x3819da(0x196)];return console[_0x3819da(0x222)](_0x3819da(0x1d8)+_0x1357cd[_0x3819da(0x214)]+_0x3819da(0x199)+_0x1357cd['id']),await handleSDKOutput([_0x1357cd],_0x246158),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a27_0x5e2678(0x1de);['description']=a27_0x5e2678(0x1c4);async[a27_0x5e2678(0x1d4)](_0x228122){const _0x1445ed=a27_0x5e2678,{options:_0x4a3c22,args:_0x3840dd,tdx:_0x475b77}=_0x228122,_0x51788e=_0x3840dd[0x0];if(!_0x51788e)return console[_0x1445ed(0x222)](_0x1445ed(0x210)),console[_0x1445ed(0x222)](_0x1445ed(0x1b4)),console[_0x1445ed(0x222)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x1445ed(0x222)](_0x1445ed(0x1c2)),console[_0x1445ed(0x222)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1445ed(0x222)](_0x1445ed(0x1cc)),console['error'](_0x1445ed(0x1a5)),console[_0x1445ed(0x222)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x1445ed(0x222)](_0x1445ed(0x201)),console[_0x1445ed(0x222)](_0x1445ed(0x1d1)),0x1;try{const _0x37c928=_0x4a3c22[_0x1445ed(0x1d9)],_0x24d1ad=await resolveSegmentTarget(_0x51788e,_0x37c928,_0x4a3c22['verbose']);_0x4a3c22[_0x1445ed(0x18d)]&&console[_0x1445ed(0x222)](_0x1445ed(0x195)+_0x24d1ad);const _0xddd89=await withSpinner(_0x1445ed(0x1c5)+_0x51788e+_0x1445ed(0x1fb),()=>_0x475b77[_0x1445ed(0x1cf)]['resolvePathToResource'](_0x24d1ad),{'verbose':_0x4a3c22[_0x1445ed(0x18d)]}),_0x953b68=_0xddd89[_0x1445ed(0x196)];_0x4a3c22[_0x1445ed(0x18d)]&&(console[_0x1445ed(0x222)]('Resolved\x20type:\x20'+_0x953b68[_0x1445ed(0x197)]),console['error'](_0x1445ed(0x205)+_0x953b68[_0x1445ed(0x220)]),_0x953b68[_0x1445ed(0x1dd)]&&console['error'](_0x1445ed(0x1f9)+_0x953b68[_0x1445ed(0x1dd)]),_0x953b68[_0x1445ed(0x1ea)]&&console[_0x1445ed(0x222)](_0x1445ed(0x18c)+_0x953b68[_0x1445ed(0x1ea)]));if(_0x4a3c22[_0x1445ed(0x20b)]){if(_0x953b68[_0x1445ed(0x197)]==='folder')return console['error'](_0x1445ed(0x190)),0x1;if(_0x953b68[_0x1445ed(0x197)]===_0x1445ed(0x1f4))return console[_0x1445ed(0x222)](_0x1445ed(0x1ce)),console[_0x1445ed(0x222)](_0x1445ed(0x212)),0x1;if(!_0x953b68[_0x1445ed(0x1ea)])throw new SDKError(ErrorCode[_0x1445ed(0x223)],_0x1445ed(0x1f3));const _0x4f6ba=getConsoleNextUrl(_0x4a3c22[_0x1445ed(0x1c8)],_0x1445ed(0x209)+_0x953b68[_0x1445ed(0x220)]+_0x1445ed(0x1ef)+_0x953b68[_0x1445ed(0x1ea)]);return console[_0x1445ed(0x222)](a27_0x2a3810[_0x1445ed(0x213)]('✔')+_0x1445ed(0x227)+a27_0x2a3810['cyan'](_0x4f6ba)),openBrowser(_0x4f6ba),0x0;}if(_0x953b68[_0x1445ed(0x197)]===_0x1445ed(0x1bd)){if(!_0x953b68[_0x1445ed(0x1dd)])throw new SDKError(ErrorCode[_0x1445ed(0x200)],_0x1445ed(0x1f5));const _0x5108f2=await withSpinner('Fetching\x20folder\x20details...',()=>_0x475b77[_0x1445ed(0x1cf)]['getFolder'](_0x953b68[_0x1445ed(0x1dd)]),{'verbose':_0x4a3c22[_0x1445ed(0x18d)]});await handleSingleObjectOutput(_0x5108f2[_0x1445ed(0x196)],_0x4a3c22);}else{if(_0x953b68['type']===_0x1445ed(0x1cf)){if(!_0x953b68[_0x1445ed(0x1ea)])throw new SDKError(ErrorCode[_0x1445ed(0x223)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1c5132=await withSpinner(_0x1445ed(0x1aa),()=>_0x475b77['segment'][_0x1445ed(0x193)](_0x953b68[_0x1445ed(0x220)],_0x953b68['segmentId']),{'verbose':_0x4a3c22['verbose']}),_0x7a2336=getConsoleNextUrl(_0x4a3c22[_0x1445ed(0x1c8)],_0x1445ed(0x209)+_0x953b68['parentId']+_0x1445ed(0x1ef)+_0x953b68[_0x1445ed(0x1ea)]),_0x3c21f9=_0x1c5132[_0x1445ed(0x196)];_0x3c21f9[_0x1445ed(0x1c1)]=_0x7a2336,await handleSingleObjectOutput(_0x3c21f9,_0x4a3c22);}else return console[_0x1445ed(0x222)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x5aa128){if(_0x5aa128 instanceof SDKError)return console['error'](_0x1445ed(0x1a8)+_0x5aa128['message']),_0x5aa128[_0x1445ed(0x20d)]&&console[_0x1445ed(0x222)](_0x1445ed(0x1b5)+_0x5aa128[_0x1445ed(0x20d)]),0x1;throw _0x5aa128;}}}function a27_0x585d(){const _0x18788d=['9766720IEGbYH','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20Opening\x20','segmentPath','description','Segment\x20ID:\x20','verbose','segment:show','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','SQL\x20query:\x0a','Executing\x20segment\x20query...','getSegment','resolveParentId','Target\x20path:\x20','data','type','setJobId','\x27\x20with\x20ID:\x20','4162064QePuiR','Site:\x20','segmentName','Resolving\x20parent\x20folder\x20\x27','6054dVNzzn','33962535DjduMY','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','format','\x20folder','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','replace','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','trim','Error:\x20','Fetching\x20folder\x20details...','Fetching\x20segment\x20details...','getParent','Show\x20segment\x20or\x20folder\x20details','segment:sql','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','150pdmlrF','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20Cause:\x20','length','createFolder','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','message','(root)','folder','segment:folder:list','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','url','Options:','fullPath','Show\x20folder\x20or\x20child\x20segment\x20details','Resolving\x20\x27','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolved\x20folder\x20ID:\x20','site','3689LBjBRY','INVALID_ARGUMENT','code','Examples:','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','segment','listFolders','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','parentFolder','execute','Parent\x20name:\x20','getFolder','✖\x20Query\x20failed\x20[','✔\x20Created\x20folder\x20\x27','parentSegment','resolvePathToResource','Resolving\x20parent\x20segment\x20\x27','\x20\x20Folder\x20path:\x20','folderId','segment:view','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','jsonl','stats','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','elapsedTimeMillis','Resolved\x20parent\x20ID:\x20','segment:desc','Fetching\x20SQL\x20for\x20segment...','test','Resolved\x20YAML\x20file:\x20','segmentId','Resolved\x20type:\x20','Use:\x20tdx\x20ps\x20show','query','Fetching\x20parent\x20segment\x20details...','/e/','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','parent','Folder\x20ID\x20missing\x20from\x20resolved\x20path','SELECT\x20*\x20FROM\x20(\x0a','limit','52930hbriJb','Folder\x20ID:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','\x27...','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','segment:folder:create','getSegmentSQL','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','5395100LEfbGO','\x20\x20Segment\x20name:\x20','✔\x20Query\x20completed:\x20Processed\x20','Parent\x20ID:\x20','json','\x20rows\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','/app/ps/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','web','Parent\x20segment:\x20','cause','Resolved\x20relative\x20path\x20to:\x20','Folder\x20name:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20view\x20-w','green','name','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','in\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','folderPath','jobId','log','toLocaleString','processedRows','34638TZxbEM','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Full\x20path:\x20','parentId','Usage:\x20tdx\x20segment\x20describe\x20<path>','error','SEGMENT_NOT_FOUND','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'];a27_0x585d=function(){return _0x18788d;};return a27_0x585d();}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a27_0x5e2678(0x1e6);[a27_0x5e2678(0x18b)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a27_0x5e2678(0x1d4)](_0x3cc339){const _0x53fe95=a27_0x5e2678,{options:_0x4cf4b8,args:_0x16dab0,tdx:_0x566a9a}=_0x3cc339,_0x4f7cbb=_0x16dab0[0x0];if(!_0x4f7cbb)return console['error'](_0x53fe95(0x1cd)),console['error'](_0x53fe95(0x18f)),console['error'](_0x53fe95(0x1b2)),console[_0x53fe95(0x222)](_0x53fe95(0x1cc)),console[_0x53fe95(0x222)](_0x53fe95(0x1bf)),console['error'](_0x53fe95(0x1a0)),0x1;try{const _0x4098e3=_0x4cf4b8[_0x53fe95(0x1d9)],_0x2909dc=await resolveSegmentTarget(_0x4f7cbb,_0x4098e3,_0x4cf4b8[_0x53fe95(0x18d)]);_0x4cf4b8[_0x53fe95(0x18d)]&&console['error'](_0x53fe95(0x195)+_0x2909dc);const _0x3f4734=await withSpinner(_0x53fe95(0x1c5)+_0x4f7cbb+_0x53fe95(0x1fb),()=>_0x566a9a['segment'][_0x53fe95(0x1da)](_0x2909dc),{'verbose':_0x4cf4b8[_0x53fe95(0x18d)]}),_0x34f906=_0x3f4734['data'];_0x4cf4b8[_0x53fe95(0x18d)]&&(console[_0x53fe95(0x222)](_0x53fe95(0x1eb)+_0x34f906['type']),console[_0x53fe95(0x222)]('Parent\x20ID:\x20'+_0x34f906['parentId']));if(_0x34f906[_0x53fe95(0x197)]===_0x53fe95(0x1bd))return console[_0x53fe95(0x222)](_0x53fe95(0x1a3)),console['error'](_0x53fe95(0x1d2)),0x1;if(_0x34f906['type']==='parent')return console[_0x53fe95(0x222)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x53fe95(0x222)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x34f906['segmentId'])throw new SDKError(ErrorCode[_0x53fe95(0x223)],_0x53fe95(0x1f3));const _0x5b5554=await withSpinner(_0x53fe95(0x1e7),()=>_0x566a9a['segment']['getSegmentSQL'](_0x34f906[_0x53fe95(0x220)],_0x34f906[_0x53fe95(0x1ea)]),{'verbose':_0x4cf4b8[_0x53fe95(0x18d)]}),_0xc709e7=_0x5b5554[_0x53fe95(0x196)],_0x5a2854=await executeSchemaQuery(_0xc709e7,_0x566a9a,_0x4cf4b8);return await handleQueryOutput(_0x5a2854,_0x4cf4b8),0x0;}catch(_0x19a7b8){if(_0x19a7b8 instanceof SDKError)return console['error'](_0x53fe95(0x1a8)+_0x19a7b8[_0x53fe95(0x1bb)]),_0x19a7b8[_0x53fe95(0x20d)]&&console[_0x53fe95(0x222)](_0x53fe95(0x1b5)+_0x19a7b8[_0x53fe95(0x20d)]),0x1;throw _0x19a7b8;}}}
|
|
1
|
+
const a27_0x502d7c=a27_0x5363;(function(_0x5109b2,_0x5f0633){const _0x181896=a27_0x5363,_0x2ee712=_0x5109b2();while(!![]){try{const _0xef91a5=parseInt(_0x181896(0x218))/0x1+parseInt(_0x181896(0x1c7))/0x2*(-parseInt(_0x181896(0x19e))/0x3)+parseInt(_0x181896(0x19d))/0x4+parseInt(_0x181896(0x1fd))/0x5+parseInt(_0x181896(0x1d3))/0x6*(parseInt(_0x181896(0x1de))/0x7)+-parseInt(_0x181896(0x1d6))/0x8+parseInt(_0x181896(0x217))/0x9*(parseInt(_0x181896(0x1a2))/0xa);if(_0xef91a5===_0x5f0633)break;else _0x2ee712['push'](_0x2ee712['shift']());}catch(_0x17d7cc){_0x2ee712['push'](_0x2ee712['shift']());}}}(a27_0x2a82,0x8d89c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a27_0x2a82(){const _0x2638af=['\x20\x20Parent\x20segment:\x20','7779050PODZPn','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20Segment\x20name:\x20','segment:show','limit','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x27...','Use:\x20tdx\x20ps\x20view\x20-w','getFolder','Fetching\x20parent\x20segment\x20details...','Parent\x20ID:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','✔\x20Query\x20completed:\x20Processed\x20','message','\x20Opening\x20','log','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Options:','\x20folder','SEGMENT_NOT_FOUND','fullPath','✖\x20Query\x20failed\x20[','segment:folder:list','Target\x20path:\x20','setJobId','Fetching\x20folder\x20details...','in\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','json','Site:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Usage:\x20tdx\x20sg\x20desc\x20<name>','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20folder\x20\x27','type','2648dnFLJL','Create\x20segment\x20folder\x20for\x20organization','Segment\x20ID:\x20','Resolved\x20YAML\x20file:\x20','processedRows','query','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','site','segment:desc','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20SQL\x20for\x20segment...','111258bdOsXA','\x20[Job\x20ID:\x20','INVALID_ARGUMENT','7153816PIexSU','length','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','cause','resolveFolderId','execute','Error:\x20Path\x20or\x20name\x20is\x20required','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','7cAJvtR','Fetching\x20segment\x20details...','/e/','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27\x20with\x20ID:\x20','Resolving\x20\x27','✔\x20Found\x20','Folder\x20name:\x20','Examples:','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segment:view','Folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment','Show\x20child\x20segment\x20schema\x20(column\x20types)','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:sql','Resolving\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','format','folderId','segment:folder:create','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','/app/ps/','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20relative\x20path\x20to:\x20','trim','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','766865AoOSLN','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','elapsedTimeMillis','Executing\x20segment\x20query...','stats','replace','Parent\x20segment:\x20','resolveParentId','folder','Resolved\x20type:\x20','Resolved\x20parent\x20ID:\x20','parent','Resolving\x20parent\x20segment\x20\x27','parentId','segment:folder:show','Error:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','includes','segment:describe','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','verbose','test','Resolving\x20path\x20\x27','folderPath','9CKggsI','645026XMQYpT','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Use:\x20tdx\x20ps\x20sql','name','\x20\x20Cause:\x20','\x20\x20Folder\x20path:\x20','getSegment','jobId','Creating\x20folder\x20\x27','Parent\x20name:\x20','getParent','parentSegment','data','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','error','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segmentId','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','resolvePathToResource','Resolving\x20parent\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','getSegmentSQL','code','web','\x20rows\x20','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','988768eAadbD','834nzFyIq','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20show'];a27_0x2a82=function(){return _0x2638af;};return a27_0x2a82();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x2ad0cb from'chalk';async function resolveSegmentTarget(_0x14d7ff,_0x4067aa,_0x4e3a56){const _0x1f390e=a27_0x5363;if(isYamlFilePath(_0x14d7ff))try{const _0x1a55c0=await resolveYamlFilePath(_0x14d7ff);return _0x4e3a56&&(console['error'](_0x1f390e(0x1ca)+_0x14d7ff),console[_0x1f390e(0x18e)](_0x1f390e(0x1a1)+_0x1a55c0[_0x1f390e(0x229)]),console[_0x1f390e(0x18e)](_0x1f390e(0x1a4)+_0x1a55c0['segmentName']),console[_0x1f390e(0x18e)](_0x1f390e(0x223)+(_0x1a55c0[_0x1f390e(0x216)]||'(root)')),console[_0x1f390e(0x18e)]('\x20\x20Full\x20path:\x20'+_0x1a55c0[_0x1f390e(0x1b7)])),_0x1a55c0[_0x1f390e(0x1b7)];}catch(_0x1de3dc){throw new SDKError(ErrorCode[_0x1f390e(0x1d5)],_0x1f390e(0x1dd)+_0x1de3dc[_0x1f390e(0x1b0)]);}if(!_0x4067aa)throw new SDKError(ErrorCode[_0x1f390e(0x1d5)],_0x1f390e(0x1e7));return _0x4067aa+'/'+_0x14d7ff;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x20f);['description']='Show\x20segment\x20or\x20folder\x20details';async[a27_0x502d7c(0x1db)](_0x4fd308){const _0x330eda=a27_0x502d7c,{options:_0x546f98,args:_0x35c2e8,tdx:_0x16209c}=_0x4fd308,_0xa849f8=_0x35c2e8[0x0],_0x7369cd=!_0xa849f8&&!!_0x546f98[_0x330eda(0x229)],_0x570123=_0xa849f8||_0x546f98[_0x330eda(0x229)];if(!_0x570123)return console[_0x330eda(0x18e)](_0x330eda(0x1dc)),console[_0x330eda(0x18e)](_0x330eda(0x1eb)),console[_0x330eda(0x18e)](_0x330eda(0x1e6)),console[_0x330eda(0x18e)](_0x330eda(0x1b3)),console['error'](_0x330eda(0x212)),console['error'](_0x330eda(0x21e)),console[_0x330eda(0x18e)](_0x330eda(0x1ae)),0x1;try{const _0x5e430a=_0x546f98['segmentPath'];let _0xa3c450=_0x570123;!_0x7369cd&&_0x5e430a&&!_0x570123[_0x330eda(0x20e)]('/')&&(_0xa3c450=_0x5e430a+'/'+_0x570123,_0x546f98[_0x330eda(0x213)]&&console['error'](_0x330eda(0x1f9)+_0xa3c450));const _0x5cef80=await withSpinner(_0x330eda(0x215)+_0xa3c450+'\x27...',()=>_0x16209c[_0x330eda(0x1ec)]['resolvePathToResource'](_0xa3c450),{'verbose':_0x546f98[_0x330eda(0x213)]}),_0xf4347c=_0x5cef80[_0x330eda(0x22a)];_0x546f98[_0x330eda(0x213)]&&(console['error'](_0x330eda(0x206)+_0xf4347c['type']),console['error'](_0x330eda(0x1ad)+_0xf4347c[_0x330eda(0x20a)]),_0xf4347c[_0x330eda(0x1f4)]&&console[_0x330eda(0x18e)](_0x330eda(0x1ea)+_0xf4347c[_0x330eda(0x1f4)]),_0xf4347c[_0x330eda(0x191)]&&console[_0x330eda(0x18e)](_0x330eda(0x1c9)+_0xf4347c[_0x330eda(0x191)]));if(_0xf4347c[_0x330eda(0x1c6)]===_0x330eda(0x208)){const _0x18ecd3=await withSpinner(_0x330eda(0x1ac),()=>_0x16209c['segment'][_0x330eda(0x228)](_0xf4347c['parentId']),{'verbose':_0x546f98[_0x330eda(0x213)]});await handleSingleObjectOutput(_0x18ecd3['data'],_0x546f98);}else{if(_0xf4347c[_0x330eda(0x1c6)]===_0x330eda(0x205)){if(!_0xf4347c[_0x330eda(0x1f4)])throw new SDKError(ErrorCode[_0x330eda(0x1c4)],_0x330eda(0x219));const _0x10fc5b=await withSpinner('Fetching\x20folder\x20details...',()=>_0x16209c['segment'][_0x330eda(0x1ab)](_0xf4347c[_0x330eda(0x1f4)]),{'verbose':_0x546f98[_0x330eda(0x213)]});await handleSingleObjectOutput(_0x10fc5b[_0x330eda(0x22a)],_0x546f98);}else{if(_0xf4347c[_0x330eda(0x1c6)]===_0x330eda(0x1ec)){if(!_0xf4347c[_0x330eda(0x191)])throw new SDKError(ErrorCode[_0x330eda(0x1b6)],_0x330eda(0x21d));const _0xf7f1cc=await withSpinner(_0x330eda(0x1df),()=>_0x16209c[_0x330eda(0x1ec)][_0x330eda(0x224)](_0xf4347c['parentId'],_0xf4347c['segmentId']),{'verbose':_0x546f98[_0x330eda(0x213)]});await handleSingleObjectOutput(_0xf7f1cc[_0x330eda(0x22a)],_0x546f98);}}}return 0x0;}catch(_0x1d2b70){if(_0x1d2b70 instanceof SDKError)return console[_0x330eda(0x18e)](_0x330eda(0x20c)+_0x1d2b70[_0x330eda(0x1b0)]),_0x1d2b70[_0x330eda(0x1d9)]&&console[_0x330eda(0x18e)](_0x330eda(0x222)+_0x1d2b70[_0x330eda(0x1d9)]),0x1;throw _0x1d2b70;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x1a5);[a27_0x502d7c(0x210)]=a27_0x502d7c(0x1ee);async[a27_0x502d7c(0x1db)](_0x264d68){const _0x17c6a2=a27_0x502d7c,{options:_0x55f417,args:_0x499f79,tdx:_0x156ba5}=_0x264d68,_0x3c829a=_0x499f79[0x0];if(!_0x3c829a)return console[_0x17c6a2(0x18e)](_0x17c6a2(0x1f6)),console[_0x17c6a2(0x18e)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x17c6a2(0x18e)](_0x17c6a2(0x195)),console[_0x17c6a2(0x18e)](_0x17c6a2(0x1e6)),console['error'](_0x17c6a2(0x20d)),console[_0x17c6a2(0x18e)](_0x17c6a2(0x19c)),0x1;try{const _0x2a16e8=_0x55f417[_0x17c6a2(0x229)],_0xd04508=await resolveSegmentTarget(_0x3c829a,_0x2a16e8,_0x55f417[_0x17c6a2(0x213)]);_0x55f417[_0x17c6a2(0x213)]&&console[_0x17c6a2(0x18e)](_0x17c6a2(0x1ba)+_0xd04508);const _0x2e2948=await withSpinner(_0x17c6a2(0x1e3)+_0x3c829a+_0x17c6a2(0x1a9),()=>_0x156ba5[_0x17c6a2(0x1ec)][_0x17c6a2(0x193)](_0xd04508),{'verbose':_0x55f417[_0x17c6a2(0x213)]}),_0x14f846=_0x2e2948['data'];_0x55f417[_0x17c6a2(0x213)]&&(console['error'](_0x17c6a2(0x206)+_0x14f846[_0x17c6a2(0x1c6)]),console[_0x17c6a2(0x18e)]('Parent\x20ID:\x20'+_0x14f846[_0x17c6a2(0x20a)]));if(_0x14f846[_0x17c6a2(0x1c6)]===_0x17c6a2(0x205))return console[_0x17c6a2(0x18e)](_0x17c6a2(0x1d8)),console['error'](_0x17c6a2(0x21f)),0x1;if(_0x14f846[_0x17c6a2(0x1c6)]==='parent')return console[_0x17c6a2(0x18e)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x17c6a2(0x18e)](_0x17c6a2(0x1a0)),0x1;if(!_0x14f846['segmentId'])throw new SDKError(ErrorCode[_0x17c6a2(0x1b6)],_0x17c6a2(0x21d));const _0xa8a791=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x156ba5[_0x17c6a2(0x1ec)][_0x17c6a2(0x197)](_0x14f846[_0x17c6a2(0x20a)],_0x14f846['segmentId']),{'verbose':_0x55f417['verbose']});let _0x24e3c4=_0xa8a791[_0x17c6a2(0x22a)];const _0x4ab11d=resolveLimit(_0x55f417[_0x17c6a2(0x1a6)],DEFAULT_DISPLAY_LIMIT),_0x5bf5d5=/\bLIMIT\s+\d+/i[_0x17c6a2(0x214)](_0x24e3c4);!_0x5bf5d5&&(_0x24e3c4=_0x24e3c4[_0x17c6a2(0x1fa)]()[_0x17c6a2(0x202)](/;+$/,''),_0x24e3c4=_0x17c6a2(0x1a7)+_0x24e3c4+_0x17c6a2(0x1f1)+_0x4ab11d);_0x55f417[_0x17c6a2(0x213)]&&console['error'](_0x17c6a2(0x19b)+_0x24e3c4);const _0xce04a0=await withProgressSpinner(_0x17c6a2(0x200),async _0x20c3cb=>{const _0x2613b1=_0x17c6a2,_0x468c9e=await _0x156ba5[_0x2613b1(0x1cc)][_0x2613b1(0x1db)](_0x24e3c4,{'catalog':'td','schema':'information_schema','onJobId':_0x36e7b4=>{const _0x456fb8=_0x2613b1;_0x20c3cb[_0x456fb8(0x1bb)](_0x36e7b4);}});return _0x468c9e;},{'verbose':_0x55f417['verbose']}),_0x4f5061=_0xce04a0[_0x17c6a2(0x22a)],_0x17c96c=_0x4f5061[_0x17c6a2(0x225)]?_0x17c6a2(0x1d4)+_0x4f5061[_0x17c6a2(0x225)]+']':'';return console[_0x17c6a2(0x18e)](_0x17c6a2(0x1af)+_0x4f5061[_0x17c6a2(0x201)][_0x17c6a2(0x1cb)]['toLocaleString']()+_0x17c6a2(0x19a)+(_0x17c6a2(0x1bd)+formatElapsed(_0x4f5061['stats'][_0x17c6a2(0x1ff)])+_0x17c96c)),await handleQueryOutput(_0x4f5061,_0x55f417),0x0;}catch(_0x411d6f){if(_0x411d6f instanceof SDKError)return console[_0x17c6a2(0x18e)](_0x17c6a2(0x1b8)+_0x411d6f[_0x17c6a2(0x198)]+']'),console[_0x17c6a2(0x18e)]('\x0a'+_0x411d6f[_0x17c6a2(0x1b0)]),0x1;throw _0x411d6f;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x502d7c(0x1b9);['description']=a27_0x502d7c(0x21c);async['execute'](_0x52af48){const _0x7e777=a27_0x502d7c,{options:_0x41ff45,args:_0x524111,tdx:_0x555c60}=_0x52af48;if(_0x524111[_0x7e777(0x1d7)]===0x0)return console[_0x7e777(0x18e)](_0x7e777(0x1cd)),console[_0x7e777(0x18e)](_0x7e777(0x190)),0x1;const _0x1fca2e=_0x524111[0x0];try{_0x41ff45[_0x7e777(0x213)]&&(console[_0x7e777(0x18e)](_0x7e777(0x1c0)+_0x41ff45[_0x7e777(0x1cf)]),console[_0x7e777(0x18e)](_0x7e777(0x227)+_0x1fca2e));const _0x3c2835=await withSpinner(_0x7e777(0x209)+_0x1fca2e+'\x27...',()=>_0x555c60[_0x7e777(0x1ec)][_0x7e777(0x204)](_0x1fca2e),{'verbose':_0x41ff45[_0x7e777(0x213)]}),_0x485235=_0x3c2835['data'];_0x41ff45[_0x7e777(0x213)]&&console[_0x7e777(0x18e)](_0x7e777(0x207)+_0x485235);const _0x33ebd0=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x1fca2e+_0x7e777(0x1a9),()=>_0x555c60[_0x7e777(0x1ec)]['listFolders'](_0x485235),{'verbose':_0x41ff45[_0x7e777(0x213)]}),_0x15e2d6=_0x33ebd0['data'];return console['error'](_0x7e777(0x1e4)+_0x15e2d6[_0x7e777(0x1d7)]+_0x7e777(0x1b5)+(_0x15e2d6[_0x7e777(0x1d7)]!==0x1?'s':'')),await handleSDKOutput(_0x15e2d6,_0x41ff45),0x0;}catch(_0x2f2bb5){if(_0x2f2bb5 instanceof SDKError)return console[_0x7e777(0x18e)]('Error:\x20'+_0x2f2bb5[_0x7e777(0x1b0)]),_0x2f2bb5[_0x7e777(0x1d9)]&&console[_0x7e777(0x18e)](_0x7e777(0x222)+_0x2f2bb5[_0x7e777(0x1d9)]),0x1;throw _0x2f2bb5;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x20b);[a27_0x502d7c(0x210)]='Show\x20segment\x20folder\x20details';async[a27_0x502d7c(0x1db)](_0x17e0b9){const _0x7b720a=a27_0x502d7c,{options:_0x5af944,args:_0x55f2d9,tdx:_0x45f368}=_0x17e0b9;if(_0x55f2d9['length']===0x0)return console[_0x7b720a(0x18e)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x7b720a(0x18e)](_0x7b720a(0x22b)),0x1;try{const {parentId:_0x3f35e2,childId:_0x104f79}=parseSegmentRef(_0x55f2d9[0x0]);_0x5af944[_0x7b720a(0x213)]&&(console['error']('Site:\x20'+_0x5af944[_0x7b720a(0x1cf)]),console['error'](_0x7b720a(0x227)+_0x3f35e2),_0x104f79&&console[_0x7b720a(0x18e)](_0x7b720a(0x1e5)+_0x104f79));if(!_0x104f79)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x9b1e57=await withSpinner(_0x7b720a(0x209)+_0x3f35e2+_0x7b720a(0x1a9),()=>_0x45f368[_0x7b720a(0x1ec)][_0x7b720a(0x204)](_0x3f35e2),{'verbose':_0x5af944[_0x7b720a(0x213)]}),_0x30c8ab=_0x9b1e57[_0x7b720a(0x22a)];_0x5af944[_0x7b720a(0x213)]&&console[_0x7b720a(0x18e)]('Resolved\x20parent\x20ID:\x20'+_0x30c8ab);const _0x75bc93=await withSpinner(_0x7b720a(0x1f0)+_0x104f79+_0x7b720a(0x1a9),()=>_0x45f368[_0x7b720a(0x1ec)][_0x7b720a(0x1da)](_0x30c8ab,_0x104f79),{'verbose':_0x5af944['verbose']}),_0x1b7c1b=_0x75bc93[_0x7b720a(0x22a)];_0x5af944['verbose']&&console[_0x7b720a(0x18e)]('Resolved\x20folder\x20ID:\x20'+_0x1b7c1b);const _0x5384ad=await withSpinner(_0x7b720a(0x1c5)+_0x104f79+_0x7b720a(0x1a9),()=>_0x45f368['segment'][_0x7b720a(0x1ab)](_0x1b7c1b),{'verbose':_0x5af944[_0x7b720a(0x213)]});return await handleSDKOutput([_0x5384ad[_0x7b720a(0x22a)]],_0x5af944),0x0;}catch(_0x1dfacd){if(_0x1dfacd instanceof SDKError)return console[_0x7b720a(0x18e)]('Error:\x20'+_0x1dfacd[_0x7b720a(0x1b0)]),_0x1dfacd[_0x7b720a(0x1d9)]&&console[_0x7b720a(0x18e)]('\x20\x20Cause:\x20'+_0x1dfacd[_0x7b720a(0x1d9)]),0x1;throw _0x1dfacd;}}}function a27_0x5363(_0x4bb5e4,_0x229c4d){_0x4bb5e4=_0x4bb5e4-0x18d;const _0x2a82b9=a27_0x2a82();let _0x5363f9=_0x2a82b9[_0x4bb5e4];return _0x5363f9;}export class SegmentSQLCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x1ef);[a27_0x502d7c(0x210)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x502d7c(0x1db)](_0x174b38){const _0x2fdac7=a27_0x502d7c,{options:_0x45ec9a,args:_0xbaf8f8,tdx:_0x3903b3}=_0x174b38,_0x3c7578=_0xbaf8f8[0x0];if(!_0x3c7578)return console[_0x2fdac7(0x18e)](_0x2fdac7(0x1f6)),console[_0x2fdac7(0x18e)](_0x2fdac7(0x1f2)),console[_0x2fdac7(0x18e)](_0x2fdac7(0x211)),console[_0x2fdac7(0x18e)]('Examples:'),console[_0x2fdac7(0x18e)](_0x2fdac7(0x18f)),console[_0x2fdac7(0x18e)](_0x2fdac7(0x1a3)),0x1;try{const _0x483ef2=_0x45ec9a[_0x2fdac7(0x229)],_0x34d39d=await resolveSegmentTarget(_0x3c7578,_0x483ef2,_0x45ec9a[_0x2fdac7(0x213)]);_0x45ec9a['verbose']&&console[_0x2fdac7(0x18e)](_0x2fdac7(0x1ba)+_0x34d39d);const _0x3a5dbc=await withSpinner(_0x2fdac7(0x1e3)+_0x3c7578+_0x2fdac7(0x1a9),()=>_0x3903b3[_0x2fdac7(0x1ec)][_0x2fdac7(0x193)](_0x34d39d),{'verbose':_0x45ec9a[_0x2fdac7(0x213)]}),_0x20677d=_0x3a5dbc[_0x2fdac7(0x22a)];_0x45ec9a['verbose']&&(console[_0x2fdac7(0x18e)]('Resolved\x20type:\x20'+_0x20677d[_0x2fdac7(0x1c6)]),console[_0x2fdac7(0x18e)](_0x2fdac7(0x1ad)+_0x20677d[_0x2fdac7(0x20a)]));if(_0x20677d[_0x2fdac7(0x1c6)]==='folder')return console['error'](_0x2fdac7(0x21b)),console[_0x2fdac7(0x18e)](_0x2fdac7(0x1e8)),0x1;if(_0x20677d[_0x2fdac7(0x1c6)]==='parent')return console[_0x2fdac7(0x18e)](_0x2fdac7(0x1fe)),console[_0x2fdac7(0x18e)](_0x2fdac7(0x220)),0x1;if(!_0x20677d[_0x2fdac7(0x191)])throw new SDKError(ErrorCode[_0x2fdac7(0x1b6)],_0x2fdac7(0x21d));const _0x454c20=await withSpinner(_0x2fdac7(0x1d2),()=>_0x3903b3[_0x2fdac7(0x1ec)][_0x2fdac7(0x197)](_0x20677d['parentId'],_0x20677d[_0x2fdac7(0x191)]),{'verbose':_0x45ec9a[_0x2fdac7(0x213)]}),_0x3c88d0=_0x454c20[_0x2fdac7(0x22a)];return _0x45ec9a[_0x2fdac7(0x1f3)]===_0x2fdac7(0x1bf)||_0x45ec9a['format']==='jsonl'?await handleSDKOutput([{'sql':_0x3c88d0}],_0x45ec9a):console[_0x2fdac7(0x1b2)](_0x3c88d0),0x0;}catch(_0x2364b1){if(_0x2364b1 instanceof SDKError)return console['error'](_0x2fdac7(0x20c)+_0x2364b1[_0x2fdac7(0x1b0)]),_0x2364b1[_0x2fdac7(0x1d9)]&&console['error'](_0x2fdac7(0x222)+_0x2364b1['cause']),0x1;throw _0x2364b1;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x1f5);[a27_0x502d7c(0x210)]=a27_0x502d7c(0x1c8);async[a27_0x502d7c(0x1db)](_0xe356a8){const _0x5e91de=a27_0x502d7c,{options:_0x119bc8,args:_0x2de190,tdx:_0x22bafa}=_0xe356a8,_0xe5f7f4=_0x119bc8;if(_0x2de190[_0x5e91de(0x1d7)]<0x2)return console[_0x5e91de(0x18e)](_0x5e91de(0x192)),console[_0x5e91de(0x18e)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x23bba8=_0x2de190[0x0],_0x5a6883=_0x2de190[0x1];_0xe5f7f4[_0x5e91de(0x213)]&&(console[_0x5e91de(0x18e)]('Site:\x20'+_0xe5f7f4[_0x5e91de(0x1cf)]),console[_0x5e91de(0x18e)](_0x5e91de(0x203)+_0x23bba8),console[_0x5e91de(0x18e)](_0x5e91de(0x1e5)+_0x5a6883));let _0x13ded3;if(_0xe5f7f4['parentFolder']){const _0x3d2ecb=_0xe5f7f4['parentFolder'],_0x4ee2ca=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x23bba8+'\x27...',()=>_0x22bafa[_0x5e91de(0x1ec)][_0x5e91de(0x204)](_0x23bba8),{'verbose':_0xe5f7f4[_0x5e91de(0x213)]}),_0x1902b1=_0x4ee2ca[_0x5e91de(0x22a)],_0x418a9b=await withSpinner(_0x5e91de(0x194)+_0x3d2ecb+_0x5e91de(0x1a9),()=>_0x22bafa['segment'][_0x5e91de(0x1da)](_0x1902b1,_0x3d2ecb),{'verbose':_0xe5f7f4['verbose']});_0x13ded3=_0x418a9b['data'],_0xe5f7f4['verbose']&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x13ded3);}const _0x436806={'name':_0x5a6883,'description':_0xe5f7f4['description'],'parentFolderId':_0x13ded3},_0x590cf9=await withSpinner(_0x5e91de(0x226)+_0x5a6883+_0x5e91de(0x1a9),()=>_0x22bafa['segment']['createFolder'](_0x23bba8,_0x436806),{'verbose':_0xe5f7f4[_0x5e91de(0x213)]}),_0x3330f9=_0x590cf9[_0x5e91de(0x22a)];return console[_0x5e91de(0x18e)]('✔\x20Created\x20folder\x20\x27'+_0x3330f9['name']+_0x5e91de(0x1e2)+_0x3330f9['id']),await handleSDKOutput([_0x3330f9],_0xe5f7f4),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a27_0x502d7c(0x1e9);[a27_0x502d7c(0x210)]=a27_0x502d7c(0x1f8);async[a27_0x502d7c(0x1db)](_0x2bd366){const _0x1ff4d7=a27_0x502d7c,{options:_0x169871,args:_0x4297e5,tdx:_0x217366}=_0x2bd366,_0x2d3e21=_0x4297e5[0x0];if(!_0x2d3e21)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x18d)),console['error'](_0x1ff4d7(0x1fc)),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1b4)),console[_0x1ff4d7(0x18e)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1e6)),console[_0x1ff4d7(0x18e)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1c2)),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1c1)),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1ce)),0x1;try{const _0x2819dc=_0x169871[_0x1ff4d7(0x229)],_0xe49b5a=await resolveSegmentTarget(_0x2d3e21,_0x2819dc,_0x169871['verbose']);_0x169871[_0x1ff4d7(0x213)]&&console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1ba)+_0xe49b5a);const _0x578a33=await withSpinner(_0x1ff4d7(0x1e3)+_0x2d3e21+_0x1ff4d7(0x1a9),()=>_0x217366['segment'][_0x1ff4d7(0x193)](_0xe49b5a),{'verbose':_0x169871['verbose']}),_0x1c8b9b=_0x578a33[_0x1ff4d7(0x22a)];_0x169871['verbose']&&(console[_0x1ff4d7(0x18e)]('Resolved\x20type:\x20'+_0x1c8b9b['type']),console[_0x1ff4d7(0x18e)]('Parent\x20ID:\x20'+_0x1c8b9b['parentId']),_0x1c8b9b[_0x1ff4d7(0x1f4)]&&console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1ea)+_0x1c8b9b['folderId']),_0x1c8b9b[_0x1ff4d7(0x191)]&&console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1c9)+_0x1c8b9b[_0x1ff4d7(0x191)]));if(_0x169871[_0x1ff4d7(0x199)]){if(_0x1c8b9b[_0x1ff4d7(0x1c6)]===_0x1ff4d7(0x205))return console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1d1)),0x1;if(_0x1c8b9b['type']==='parent')return console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x21a)),console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1aa)),0x1;if(!_0x1c8b9b[_0x1ff4d7(0x191)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1ff4d7(0x21d));const _0x1f11ee=getConsoleNextUrl(_0x169871['site'],_0x1ff4d7(0x1f7)+_0x1c8b9b['parentId']+'/e/'+_0x1c8b9b['segmentId']);return console[_0x1ff4d7(0x18e)](a27_0x2ad0cb['green']('✔')+_0x1ff4d7(0x1b1)+a27_0x2ad0cb['cyan'](_0x1f11ee)),openBrowser(_0x1f11ee),0x0;}if(_0x1c8b9b[_0x1ff4d7(0x1c6)]==='folder'){if(!_0x1c8b9b[_0x1ff4d7(0x1f4)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2a4b91=await withSpinner(_0x1ff4d7(0x1bc),()=>_0x217366[_0x1ff4d7(0x1ec)][_0x1ff4d7(0x1ab)](_0x1c8b9b['folderId']),{'verbose':_0x169871[_0x1ff4d7(0x213)]});await handleSingleObjectOutput(_0x2a4b91[_0x1ff4d7(0x22a)],_0x169871);}else{if(_0x1c8b9b[_0x1ff4d7(0x1c6)]==='segment'){if(!_0x1c8b9b[_0x1ff4d7(0x191)])throw new SDKError(ErrorCode[_0x1ff4d7(0x1b6)],_0x1ff4d7(0x21d));const _0x244118=await withSpinner(_0x1ff4d7(0x1df),()=>_0x217366[_0x1ff4d7(0x1ec)]['getSegment'](_0x1c8b9b['parentId'],_0x1c8b9b['segmentId']),{'verbose':_0x169871['verbose']}),_0x4d37f1=getConsoleNextUrl(_0x169871[_0x1ff4d7(0x1cf)],_0x1ff4d7(0x1f7)+_0x1c8b9b['parentId']+_0x1ff4d7(0x1e0)+_0x1c8b9b[_0x1ff4d7(0x191)]),_0x1e9a72=_0x244118[_0x1ff4d7(0x22a)];_0x1e9a72['url']=_0x4d37f1,await handleSingleObjectOutput(_0x1e9a72,_0x169871);}else return console[_0x1ff4d7(0x18e)](_0x1ff4d7(0x1e1)),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x4a1825){if(_0x4a1825 instanceof SDKError)return console[_0x1ff4d7(0x18e)]('Error:\x20'+_0x4a1825[_0x1ff4d7(0x1b0)]),_0x4a1825[_0x1ff4d7(0x1d9)]&&console[_0x1ff4d7(0x18e)]('\x20\x20Cause:\x20'+_0x4a1825['cause']),0x1;throw _0x4a1825;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x502d7c(0x221)]=a27_0x502d7c(0x1d0);[a27_0x502d7c(0x210)]=a27_0x502d7c(0x1ed);async[a27_0x502d7c(0x1db)](_0xa63ac8){const _0x1e0d9a=a27_0x502d7c,{options:_0x409dcd,args:_0x11e11b,tdx:_0x14e4d3}=_0xa63ac8,_0x20c166=_0x11e11b[0x0];if(!_0x20c166)return console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1f6)),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1c3)),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x196)),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1e6)),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1fb)),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x19f)),0x1;try{const _0x13754b=_0x409dcd[_0x1e0d9a(0x229)],_0x3ae8c3=await resolveSegmentTarget(_0x20c166,_0x13754b,_0x409dcd[_0x1e0d9a(0x213)]);_0x409dcd[_0x1e0d9a(0x213)]&&console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1ba)+_0x3ae8c3);const _0x2e5c54=await withSpinner(_0x1e0d9a(0x1e3)+_0x20c166+_0x1e0d9a(0x1a9),()=>_0x14e4d3[_0x1e0d9a(0x1ec)][_0x1e0d9a(0x193)](_0x3ae8c3),{'verbose':_0x409dcd['verbose']}),_0x23c2bb=_0x2e5c54[_0x1e0d9a(0x22a)];_0x409dcd['verbose']&&(console[_0x1e0d9a(0x18e)]('Resolved\x20type:\x20'+_0x23c2bb[_0x1e0d9a(0x1c6)]),console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x1ad)+_0x23c2bb[_0x1e0d9a(0x20a)]));if(_0x23c2bb['type']===_0x1e0d9a(0x205))return console['error'](_0x1e0d9a(0x1be)),console['error'](_0x1e0d9a(0x1e8)),0x1;if(_0x23c2bb[_0x1e0d9a(0x1c6)]===_0x1e0d9a(0x208))return console['error'](_0x1e0d9a(0x1a8)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x23c2bb['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1e0d9a(0x21d));const _0x3ab0a1=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x14e4d3[_0x1e0d9a(0x1ec)][_0x1e0d9a(0x197)](_0x23c2bb[_0x1e0d9a(0x20a)],_0x23c2bb['segmentId']),{'verbose':_0x409dcd['verbose']}),_0x30840a=_0x3ab0a1['data'],_0x1d409d=await executeSchemaQuery(_0x30840a,_0x14e4d3,_0x409dcd);return await handleQueryOutput(_0x1d409d,_0x409dcd),0x0;}catch(_0x592c07){if(_0x592c07 instanceof SDKError)return console[_0x1e0d9a(0x18e)](_0x1e0d9a(0x20c)+_0x592c07['message']),_0x592c07[_0x1e0d9a(0x1d9)]&&console['error'](_0x1e0d9a(0x222)+_0x592c07[_0x1e0d9a(0x1d9)]),0x1;throw _0x592c07;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x48fd04=a28_0x2395;(function(_0x3b8156,_0x30dda5){const _0x32a860=a28_0x2395,_0x2a54a0=_0x3b8156();while(!![]){try{const _0x53725b=parseInt(_0x32a860(0x1e6))/0x1*(-parseInt(_0x32a860(0x206))/0x2)+-parseInt(_0x32a860(0x1f0))/0x3*(parseInt(_0x32a860(0x1ec))/0x4)+parseInt(_0x32a860(0x1ee))/0x5*(parseInt(_0x32a860(0x207))/0x6)+parseInt(_0x32a860(0x1f5))/0x7+parseInt(_0x32a860(0x1e4))/0x8+-parseInt(_0x32a860(0x1fc))/0x9+parseInt(_0x32a860(0x217))/0xa;if(_0x53725b===_0x30dda5)break;else _0x2a54a0['push'](_0x2a54a0['shift']());}catch(_0x2c9446){_0x2a54a0['push'](_0x2a54a0['shift']());}}}(a28_0x4cdb,0x3d5c4));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a28_0x2395(_0x149ee4,_0x1eabd4){_0x149ee4=_0x149ee4-0x1e3;const _0x4cdba5=a28_0x4cdb();let _0x239554=_0x4cdba5[_0x149ee4];return _0x239554;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a28_0x4cdb(){const _0x88e5bf=['\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segment','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','990444mKNCEf','parent','165kfHFey','Resolving\x20parent\x20segment\x20\x27','6eBEgIU','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Parent\x20path:\x20','createSegment','folder','2708559IPrmbw','includes','Resolving\x20folder\x20\x27','name','Resolved\x20folder\x20ID:\x20','Examples:','data','2254311AWQJHG','segments','Segment\x20name:\x20','site','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','length','invisible','\x27...','44570ggXubq','59982PCKZiz','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','type','error','noCountPopulation','segmentPath','verbose','Site:\x20','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','yellow','resolveFolderId','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','kind','folderId','ruleFile','3838880hrTXUY','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','description','2914336sTlTll','✔\x20Created\x20segment\x20\x27','21lVZsCP','rule','resolveParentId'];a28_0x4cdb=function(){return _0x88e5bf;};return a28_0x4cdb();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x3d3e3a from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x48fd04(0x1f8)]='segment:create';[a28_0x48fd04(0x1e3)]=a28_0x48fd04(0x210);async['execute'](_0x2f53f9){const _0x531722=a28_0x48fd04;console['error'](a28_0x3d3e3a['yellow'](_0x531722(0x213))),console['error'](a28_0x3d3e3a[_0x531722(0x211)](_0x531722(0x1e9)));const {options:_0x51e33d,args:_0x50be3d,tdx:_0x2ab69c}=_0x2f53f9,_0x28068c=_0x51e33d;if(_0x50be3d['length']===0x0)return console[_0x531722(0x20a)](_0x531722(0x1f1)),console['error'](_0x531722(0x1eb)),console[_0x531722(0x20a)](_0x531722(0x1fa)),console[_0x531722(0x20a)](_0x531722(0x218)),console['error'](_0x531722(0x202)),console[_0x531722(0x20a)](_0x531722(0x200)),0x1;const _0x4d3d9b=_0x50be3d[0x0],_0x15494b=_0x51e33d[_0x531722(0x20c)];let _0x102fe4=_0x4d3d9b;_0x15494b&&!_0x4d3d9b[_0x531722(0x1f6)]('/')&&(_0x102fe4=_0x15494b+'/'+_0x4d3d9b,_0x28068c['verbose']&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x102fe4));const _0x4c5aa9=parsePath(_0x102fe4);if(_0x4c5aa9[_0x531722(0x1fd)]['length']<0x2)return console[_0x531722(0x20a)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x531722(0x20a)](_0x531722(0x201)),0x1;const _0x1429b3=_0x4c5aa9[_0x531722(0x1fd)][0x0],_0x17a967=getBaseName(_0x102fe4),_0x25441f=getParentPath(_0x102fe4);_0x28068c[_0x531722(0x20d)]&&(console[_0x531722(0x20a)](_0x531722(0x20e)+_0x28068c[_0x531722(0x1ff)]),console[_0x531722(0x20a)]('Target\x20path:\x20'+_0x102fe4),console[_0x531722(0x20a)]('Parent:\x20'+_0x1429b3),console[_0x531722(0x20a)](_0x531722(0x1fe)+_0x17a967),console[_0x531722(0x20a)](_0x531722(0x1f2)+_0x25441f));const _0x28a314=await withSpinner(_0x531722(0x1ef)+_0x1429b3+_0x531722(0x205),()=>_0x2ab69c[_0x531722(0x1ea)][_0x531722(0x1e8)](_0x1429b3),{'verbose':_0x28068c['verbose']}),_0x2569e1=_0x28a314[_0x531722(0x1fb)];let _0x4d57fa;if(_0x4c5aa9['segments'][_0x531722(0x203)]>0x2){const _0x2233dd=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x25441f+_0x531722(0x205),()=>_0x2ab69c['segment'][_0x531722(0x20f)](_0x25441f),{'verbose':_0x28068c['verbose']}),_0x27b2e7=_0x2233dd[_0x531722(0x1fb)];if(_0x27b2e7[_0x531722(0x209)]!==_0x531722(0x1f4)&&_0x27b2e7['type']!==_0x531722(0x1ed))return console[_0x531722(0x20a)](_0x531722(0x208)),0x1;_0x4d57fa=_0x27b2e7[_0x531722(0x215)];}else{if(_0x28068c[_0x531722(0x1f4)]){const _0x196d67=await withSpinner(_0x531722(0x1f7)+_0x28068c[_0x531722(0x1f4)]+'\x27...',()=>_0x2ab69c[_0x531722(0x1ea)][_0x531722(0x212)](_0x2569e1,_0x28068c[_0x531722(0x1f4)]),{'verbose':_0x28068c['verbose']});_0x4d57fa=_0x196d67[_0x531722(0x1fb)];}}_0x28068c[_0x531722(0x20d)]&&_0x4d57fa&&console[_0x531722(0x20a)](_0x531722(0x1f9)+_0x4d57fa);const _0x41947d=await loadJSONFromOptions(_0x28068c[_0x531722(0x1e7)],_0x28068c[_0x531722(0x216)]),_0x9bb9b2={'name':_0x17a967,'description':_0x28068c[_0x531722(0x1e3)],'rule':_0x41947d,'kind':_0x28068c[_0x531722(0x214)]!==undefined?parseInt(_0x28068c['kind'],0xa):undefined,'isVisible':_0x28068c[_0x531722(0x204)]?![]:undefined,'segmentFolderId':_0x4d57fa,'countPopulation':_0x28068c[_0x531722(0x20b)]?![]:undefined},_0xb83a6c=await withSpinner('Creating\x20segment\x20\x27'+_0x17a967+_0x531722(0x205),()=>_0x2ab69c[_0x531722(0x1ea)][_0x531722(0x1f3)](_0x2569e1,_0x9bb9b2),{'verbose':_0x28068c[_0x531722(0x20d)]}),_0x5c20db=_0xb83a6c[_0x531722(0x1fb)];return console[_0x531722(0x20a)](_0x531722(0x1e5)+_0x5c20db[_0x531722(0x1f8)]+'\x27\x20with\x20ID:\x20'+_0x5c20db['id']),_0x102fe4!==_0x4d3d9b&&console[_0x531722(0x20a)]('\x20\x20\x20Path:\x20'+_0x102fe4),await handleSDKOutput([_0x5c20db],_0x28068c),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x37750e=a29_0x566d;(function(_0x39a6d1,_0x195623){const _0x20ef1a=a29_0x566d,_0x58b24b=_0x39a6d1();while(!![]){try{const _0x137055=-parseInt(_0x20ef1a(0x1f9))/0x1*(parseInt(_0x20ef1a(0x203))/0x2)+parseInt(_0x20ef1a(0x202))/0x3+-parseInt(_0x20ef1a(0x204))/0x4*(-parseInt(_0x20ef1a(0x1ef))/0x5)+-parseInt(_0x20ef1a(0x20a))/0x6*(-parseInt(_0x20ef1a(0x1ff))/0x7)+parseInt(_0x20ef1a(0x207))/0x8*(parseInt(_0x20ef1a(0x1f2))/0x9)+parseInt(_0x20ef1a(0x1fb))/0xa+-parseInt(_0x20ef1a(0x20b))/0xb*(parseInt(_0x20ef1a(0x1f8))/0xc);if(_0x137055===_0x195623)break;else _0x58b24b['push'](_0x58b24b['shift']());}catch(_0x35ba41){_0x58b24b['push'](_0x58b24b['shift']());}}}(a29_0x17e8,0x2fc16));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a29_0x17e8(){const _0x1b0da8=['description','error','\x27...','execute','408HiwRit','1JBftvb','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','2596740JxDTTf','✔\x20Found\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','name','1715MOGZTp','segment','listFields','648060ObaNpa','431142vmBqpn','18468mSOaUh','List\x20available\x20fields\x20for\x20segmentation','Listing\x20fields\x20for\x20\x27','8wLrPNO','verbose','segment:fields','7428psWXao','282832MOIlJC','Site:\x20','json','length','180Nqbyuz','jsonl','\x20field','3061521BSjCQZ','data'];a29_0x17e8=function(){return _0x1b0da8;};return a29_0x17e8();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a29_0x566d(_0x52331f,_0x3d9cdb){_0x52331f=_0x52331f-0x1ec;const _0x17e8ca=a29_0x17e8();let _0x566d8e=_0x17e8ca[_0x52331f];return _0x566d8e;}export class SegmentFieldsCommand extends BaseCommand{[a29_0x37750e(0x1fe)]=a29_0x37750e(0x209);[a29_0x37750e(0x1f4)]=a29_0x37750e(0x205);async[a29_0x37750e(0x1f7)](_0x210bba){const _0x6777f8=a29_0x37750e,{options:_0x3e785c,args:_0x5e0ea5,tdx:_0x1ba36f}=_0x210bba,_0xa334c9=_0x5e0ea5[0x0]||_0x3e785c['parentSegment'];if(!_0xa334c9)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x6777f8(0x1f5)](_0x6777f8(0x1fa)),console[_0x6777f8(0x1f5)](_0x6777f8(0x1fd)),0x1;_0x3e785c['verbose']&&(console[_0x6777f8(0x1f5)](_0x6777f8(0x1ec)+_0x3e785c['site']),console['error']('Parent\x20segment:\x20'+_0xa334c9));const _0x28fb0d=await withSpinner(_0x6777f8(0x206)+_0xa334c9+_0x6777f8(0x1f6),()=>_0x1ba36f[_0x6777f8(0x200)][_0x6777f8(0x201)](_0xa334c9),{'verbose':_0x3e785c[_0x6777f8(0x208)]}),_0x30d348=_0x28fb0d[_0x6777f8(0x1f3)];console[_0x6777f8(0x1f5)](_0x6777f8(0x1fc)+_0x30d348[_0x6777f8(0x1ee)]+_0x6777f8(0x1f1)+(_0x30d348['length']!==0x1?'s':''));if(_0x3e785c[_0x6777f8(0x1ed)]||_0x3e785c[_0x6777f8(0x1f0)])return await handleSDKOutput(_0x30d348,_0x3e785c),0x0;return displayFieldsHumanReadable(_0x30d348,_0xa334c9),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a30_0x34457b=a30_0x57af;function a30_0x57af(_0xb488c,_0x4335ea){_0xb488c=_0xb488c-0x16b;const _0x3c7fdf=a30_0x3c7f();let _0x57afb7=_0x3c7fdf[_0xb488c];return _0x57afb7;}(function(_0xa17086,_0x126939){const _0xd9def6=a30_0x57af,_0x193ef1=_0xa17086();while(!![]){try{const _0x35dca1=-parseInt(_0xd9def6(0x1a4))/0x1+parseInt(_0xd9def6(0x176))/0x2+-parseInt(_0xd9def6(0x193))/0x3*(-parseInt(_0xd9def6(0x171))/0x4)+parseInt(_0xd9def6(0x186))/0x5+-parseInt(_0xd9def6(0x191))/0x6*(-parseInt(_0xd9def6(0x190))/0x7)+parseInt(_0xd9def6(0x17d))/0x8*(parseInt(_0xd9def6(0x197))/0x9)+parseInt(_0xd9def6(0x184))/0xa*(-parseInt(_0xd9def6(0x19b))/0xb);if(_0x35dca1===_0x126939)break;else _0x193ef1['push'](_0x193ef1['shift']());}catch(_0x6065f1){_0x193ef1['push'](_0x193ef1['shift']());}}}(a30_0x3c7f,0x3f5a7));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x2e4635 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x4ff755 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a30_0x3c7f(){const _0x12f5de=['474644IlXPec','\x20files\x20to\x20','filter','parent_segment','site','\x0aChanges\x20to\x20\x27','journeyVersions','8Xzzcao','dim','cyan','Aborted.','name','✔\x20All\x20files\x20are\x20up\x20to\x20date','description','311810XFzxVc','verbose','1486100oCFRBv','diff','\x20with\x20','\x20activations','hasChanges','✔\x20Context\x20set:\x20','\x27...','\x20versions)','errorCode','segments','23219GsLVwp','738etukks','repeat','39sbakSw','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','isNew','journeys','4606137quqcDD','setPhase','pullSegments','segment','330QvgDHA','\x20changed\x20files','files','\x20\x20🎯\x20','\x20unchanged\x20files','error','relativePath','resourceName','\x20=\x20','387295CQhhoP','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20\x20🗺️\x20\x20','counts','targetDir','yellow','\x0aPull\x20summary\x20for\x20\x27','no_parent','\x20segments','session','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','message','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','✔\x20Pulled\x20','utf-8','data','content','Parent\x20segment:\x20','Target\x20resource:\x20','Write\x20','parentName','green','length','absolutePath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','cwd','39352oiVgBO','execute','parentSegment','Pulling\x20segments\x20from\x20\x27','\x20files?'];a30_0x3c7f=function(){return _0x12f5de;};return a30_0x3c7f();}export class SegmentPullCommand extends BaseCommand{[a30_0x34457b(0x181)]='segment:pull';[a30_0x34457b(0x183)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a30_0x34457b(0x172)](_0x5d0c17){const _0xd76e63=a30_0x34457b,{options:_0x2b08b1,args:_0x4f7862,tdx:_0x4d8644}=_0x5d0c17,_0x496be5=_0x2b08b1,_0xc793fa=await resolveTarget({'arg':_0x4f7862[0x0],'contextParent':_0x2b08b1[_0xd76e63(0x173)],'cwd':process[_0xd76e63(0x170)]()});if(!isSuccessfulResolution(_0xc793fa))return _0xc793fa[_0xd76e63(0x18e)]===_0xd76e63(0x1ab)?(console['error'](a30_0x2e4635[_0xd76e63(0x1a9)](_0xd76e63(0x1b0))),console[_0xd76e63(0x1a0)](_0xd76e63(0x1ae)),console[_0xd76e63(0x1a0)](_0xd76e63(0x16e)),console[_0xd76e63(0x1a0)](_0xd76e63(0x16f))):(console['error'](a30_0x2e4635['red']('Error:\x20'+_0xc793fa[_0xd76e63(0x1af)]+'\x0a')),_0xc793fa['helpText']&&console['error'](a30_0x2e4635['cyan'](_0xc793fa['helpText']))),0x1;const _0x33707d=_0xc793fa[_0xd76e63(0x1b8)],_0x3edd3f=_0xc793fa[_0xd76e63(0x1a8)],_0x409ae5=_0xc793fa['type']==='file'?_0xc793fa[_0xd76e63(0x1a2)]:undefined;_0x496be5[_0xd76e63(0x185)]&&(console[_0xd76e63(0x1a0)]('Site:\x20'+_0x496be5[_0xd76e63(0x17a)]),console[_0xd76e63(0x1a0)](_0xd76e63(0x1b5)+_0x33707d),_0x409ae5&&console['error'](_0xd76e63(0x1b6)+_0x409ae5));const _0x5308ac=await withProgressSpinner(_0xd76e63(0x174)+_0x33707d+_0xd76e63(0x18c),_0x290eb2=>_0x4d8644[_0xd76e63(0x19a)][_0xd76e63(0x199)](_0x33707d,{'targetDir':_0x3edd3f,'targetResourceName':_0x409ae5,'verbose':_0x496be5['verbose'],'progress':{'update':_0x3746fe=>{const _0x4ee8d6=_0xd76e63;_0x290eb2[_0x4ee8d6(0x198)](_0x3746fe),_0x496be5['verbose']&&console[_0x4ee8d6(0x1a0)]('\x20\x20'+_0x3746fe);}}}),{'verbose':_0x496be5[_0xd76e63(0x185)]}),_0x103185=_0x5308ac[_0xd76e63(0x1b3)];if(_0x103185[_0xd76e63(0x1a7)][_0xd76e63(0x18f)]===0x0&&_0x103185['counts'][_0xd76e63(0x196)]===0x0)return console['error'](a30_0x2e4635['yellow'](_0xd76e63(0x1a5)+_0x103185['parentName']+'\x27')),0x0;const _0x55c006=_0x103185[_0xd76e63(0x19d)][_0xd76e63(0x178)](_0x5a5280=>_0x5a5280[_0xd76e63(0x195)]),_0x59bde3=_0x103185[_0xd76e63(0x19d)][_0xd76e63(0x178)](_0xfa7ac9=>!_0xfa7ac9[_0xd76e63(0x195)]&&_0xfa7ac9[_0xd76e63(0x18a)]),_0x1c5331=_0x103185[_0xd76e63(0x19d)][_0xd76e63(0x178)](_0x337ced=>!_0x337ced[_0xd76e63(0x195)]&&!_0x337ced[_0xd76e63(0x18a)]);console[_0xd76e63(0x1a0)](_0xd76e63(0x1aa)+_0x103185[_0xd76e63(0x1b8)]+'\x27:'),console[_0xd76e63(0x1a0)](_0xd76e63(0x19e)+a30_0x2e4635[_0xd76e63(0x17f)](_0x103185[_0xd76e63(0x1a7)]['segments']+_0xd76e63(0x1ac))+_0xd76e63(0x188)+a30_0x2e4635['cyan'](_0x103185[_0xd76e63(0x1a7)]['activations']+_0xd76e63(0x189)));if(_0x103185[_0xd76e63(0x1a7)][_0xd76e63(0x196)]>0x0){const _0xbfe64a=_0x103185['counts']['journeyVersions']>_0x103185[_0xd76e63(0x1a7)]['journeys']?'\x20('+_0x103185[_0xd76e63(0x1a7)][_0xd76e63(0x17c)]+_0xd76e63(0x18d):'';console[_0xd76e63(0x1a0)](_0xd76e63(0x1a6)+a30_0x2e4635['cyan'](_0x103185['counts'][_0xd76e63(0x196)]+'\x20journeys')+a30_0x2e4635[_0xd76e63(0x17e)](_0xbfe64a));}console[_0xd76e63(0x1a0)]('\x20\x20'+a30_0x2e4635[_0xd76e63(0x16b)]('+\x20'+_0x55c006[_0xd76e63(0x16c)]+'\x20new\x20files')),console[_0xd76e63(0x1a0)]('\x20\x20'+a30_0x2e4635[_0xd76e63(0x1a9)]('~\x20'+_0x59bde3[_0xd76e63(0x16c)]+_0xd76e63(0x19c))),console[_0xd76e63(0x1a0)]('\x20\x20'+a30_0x2e4635['dim']('=\x20'+_0x1c5331[_0xd76e63(0x16c)]+_0xd76e63(0x19f))),console[_0xd76e63(0x1a0)]('\x20\x20Target:\x20'+a30_0x2e4635['cyan'](_0x103185[_0xd76e63(0x1a8)])+'\x0a');if(_0x59bde3['length']>0x0)for(const _0x4de924 of _0x59bde3){console[_0xd76e63(0x1a0)](_0xd76e63(0x17b)+_0x4de924[_0xd76e63(0x1a1)]+'\x27:'),console[_0xd76e63(0x1a0)]('─'['repeat'](0x3c)),console[_0xd76e63(0x1a0)](_0x4de924[_0xd76e63(0x187)]),console['error']('─'[_0xd76e63(0x192)](0x3c));}if(_0x496be5['dryRun'])return console[_0xd76e63(0x1a0)](a30_0x2e4635[_0xd76e63(0x1a9)](_0xd76e63(0x194))),0x0;if(_0x55c006[_0xd76e63(0x16c)]===0x0&&_0x59bde3[_0xd76e63(0x16c)]===0x0)return console['error'](a30_0x2e4635[_0xd76e63(0x16b)](_0xd76e63(0x182))),saveSessionContext({'parent_segment':_0x103185[_0xd76e63(0x1b8)]},_0x496be5[_0xd76e63(0x1ad)]),console[_0xd76e63(0x1a0)](a30_0x2e4635[_0xd76e63(0x16b)](_0xd76e63(0x18b)+a30_0x2e4635['dim']('parent_segment')+'\x20=\x20'+a30_0x2e4635[_0xd76e63(0x17f)](_0x103185[_0xd76e63(0x1b8)]))),0x0;if(!_0x496be5['yes']){const _0x5297d2=await confirmKey(_0xd76e63(0x1b7)+(_0x55c006[_0xd76e63(0x16c)]+_0x59bde3['length'])+_0xd76e63(0x175));if(!_0x5297d2)return console[_0xd76e63(0x1a0)](_0xd76e63(0x180)),0x1;}for(const _0x1604a1 of _0x103185['files']){if(_0x1604a1['isNew']||_0x1604a1['hasChanges']){const _0x5b0256=a30_0x4ff755['dirname'](_0x1604a1[_0xd76e63(0x16d)]);!existsSync(_0x5b0256)&&mkdirSync(_0x5b0256,{'recursive':!![]}),writeFileSync(_0x1604a1[_0xd76e63(0x16d)],_0x1604a1[_0xd76e63(0x1b4)],_0xd76e63(0x1b2));}}return console[_0xd76e63(0x1a0)](a30_0x2e4635[_0xd76e63(0x16b)](_0xd76e63(0x1b1)+(_0x55c006['length']+_0x59bde3[_0xd76e63(0x16c)])+_0xd76e63(0x177)+_0x103185[_0xd76e63(0x1a8)])),saveSessionContext({'parent_segment':_0x103185['parentName']},_0x496be5[_0xd76e63(0x1ad)]),console['error'](a30_0x2e4635['green'](_0xd76e63(0x18b)+a30_0x2e4635[_0xd76e63(0x17e)](_0xd76e63(0x179))+_0xd76e63(0x1a3)+a30_0x2e4635[_0xd76e63(0x17f)](_0x103185[_0xd76e63(0x1b8)]))),0x0;}}
|