@treasuredata/tdx 0.16.9 → 0.16.11
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/README.md +3 -2
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.d.ts.map +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/claude-usage-command.js.map +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/status-command.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.d.ts +31 -0
- package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/claude-usage-tracker.js.map +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/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.d.ts +0 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.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/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.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
- package/dist/sdk/claude-agent/claude-agent-client.d.ts +0 -73
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +0 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +0 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +0 -1
- package/dist/sdk/claude-agent/environment.d.ts +0 -59
- package/dist/sdk/claude-agent/environment.d.ts.map +0 -1
- package/dist/sdk/claude-agent/environment.js +0 -1
- package/dist/sdk/claude-agent/environment.js.map +0 -1
- package/dist/sdk/claude-agent/index.d.ts +0 -15
- package/dist/sdk/claude-agent/index.d.ts.map +0 -1
- package/dist/sdk/claude-agent/index.js +0 -1
- package/dist/sdk/claude-agent/index.js.map +0 -1
- package/dist/sdk/claude-agent/system-prompts.d.ts +0 -22
- package/dist/sdk/claude-agent/system-prompts.d.ts.map +0 -1
- package/dist/sdk/claude-agent/system-prompts.js +0 -1
- package/dist/sdk/claude-agent/system-prompts.js.map +0 -1
- package/dist/sdk/claude-agent/types.d.ts +0 -107
- package/dist/sdk/claude-agent/types.d.ts.map +0 -1
- package/dist/sdk/claude-agent/types.js +0 -1
- package/dist/sdk/claude-agent/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x588ef6=a24_0x38fa;(function(_0x413445,_0xed12be){const _0x227688=a24_0x38fa,_0x5707c9=_0x413445();while(!![]){try{const _0x1d8bf9=-parseInt(_0x227688(0x165))/0x1*(parseInt(_0x227688(0x124))/0x2)+-parseInt(_0x227688(0x147))/0x3+-parseInt(_0x227688(0x134))/0x4+-parseInt(_0x227688(0x173))/0x5*(-parseInt(_0x227688(0x179))/0x6)+parseInt(_0x227688(0x158))/0x7+-parseInt(_0x227688(0x128))/0x8*(-parseInt(_0x227688(0x182))/0x9)+parseInt(_0x227688(0x136))/0xa*(parseInt(_0x227688(0x171))/0xb);if(_0x1d8bf9===_0xed12be)break;else _0x5707c9['push'](_0x5707c9['shift']());}catch(_0x30e32d){_0x5707c9['push'](_0x5707c9['shift']());}}}(a24_0x1cc1,0x5c43d));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_0x4429d6 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a24_0x38fa(_0x1c8c05,_0x53e585){_0x1c8c05=_0x1c8c05-0x11e;const _0x1cc1f7=a24_0x1cc1();let _0x38fac4=_0x1cc1f7[_0x1c8c05];return _0x38fac4;}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x54d590 from'prompts';import a24_0x308155 from'chalk';function validateProfileName(_0x85816f){const _0x3f9846=a24_0x38fa;if(!_0x85816f||!_0x85816f[_0x3f9846(0x14f)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x1e97b2=_0x85816f['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x3f9846(0x183)](_0x1e97b2))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x1e97b2))return _0x3f9846(0x146)+_0x1e97b2+_0x3f9846(0x156);return!![];}function a24_0x1cc1(){const _0xb1c415=['llm_project','us01','You\x20can\x20find\x20your\x20API\x20key\x20at:','5577176ADWdGZ','\x27\x20does\x20not\x20exist.','site','split','\x0aSetup\x20cancelled','apiKey','\x0aOperation\x20cancelled','Remove\x20a\x20profile','Site\x20name\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profile:use','green','966456YkvQHN','\x20Profile\x20\x27','7730CmkWsB','\x20API\x20key\x20removed\x20from\x20system\x20keychain','log','name','\x27\x20updated:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','tdx:\x20profile\x20remove','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Enter\x20your\x20TD\x20API\x20key:','(cleared)','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','config','\x0aAvailable\x20profiles:','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20--default\x27\x20to\x20save\x20permanently','Profile\x20\x27','2260389apqTkm','execute','\x20API\x20key\x20saved\x20to\x20system\x20keychain','tdx.json','confirm','session','customSite','Session\x20profile\x20set\x20to:\x20','trim','includes','default','profile:set','Enter\x20profile\x20name:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','profileName','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20created','2613408NPPMRO','Enter\x20site\x20name:','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','logLevel','message','validate','bold','join','create','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','ERROR','profile','Enter\x20description\x20(optional):','1101KgjQEH','parent_segment','VALID_KEYS','email','\x27\x20requires\x20API\x20key\x20validation.','red','Site\x20was\x20not\x20changed.','dim','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Validating\x20API\x20key...','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','API\x20key\x20cannot\x20be\x20empty','5357ZGXkeL','✗\x20Validation\x20failed:\x20','5sVlfQX','llm_agent','(session:\x20','Operation\x20cancelled','\x20\x20(no\x20profiles\x20found)','length','91398ZEkJdk','Create\x20a\x20new\x20profile','password','\x20\x20tdx\x20--profile\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','error','status','description','9qmgnNT','test','/app/mp/ak','warn','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>','tdx:\x20profile\x20create','jobs','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','text','Set\x20a\x20profile\x20configuration\x20value','\x20\x20-\x20','getUserInfo','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','yellow','162EQmfpf'];a24_0x1cc1=function(){return _0xb1c415;};return a24_0x1cc1();}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x588ef6(0x181)]=a24_0x588ef6(0x17a);async[a24_0x588ef6(0x148)](_0x5a9a3b){const _0x4ab030=a24_0x588ef6,{options:_0x3aa5e1,args:_0xdbc03b}=_0x5a9a3b;console['log'](a24_0x308155[_0x4ab030(0x15e)](_0x4ab030(0x187)));let _0x19ee8c;if(_0xdbc03b[_0x4ab030(0x178)]>0x0&&_0xdbc03b[0x0]){const _0x4b7617=_0xdbc03b[0x0][_0x4ab030(0x14f)](),_0x1f2096=validateProfileName(_0x4b7617);if(_0x1f2096!==!![])return console[_0x4ab030(0x17f)](a24_0x308155[_0x4ab030(0x16a)](_0x1f2096)),0x1;_0x19ee8c=_0x4b7617;}else{const _0x584baf=await a24_0x54d590({'type':_0x4ab030(0x11e),'name':'profileName','message':_0x4ab030(0x153),'validate':validateProfileName});if(!_0x584baf[_0x4ab030(0x155)])return console[_0x4ab030(0x138)](_0x4ab030(0x12c)),0x1;_0x19ee8c=_0x584baf[_0x4ab030(0x155)][_0x4ab030(0x14f)]();}const _0x3332bc=await a24_0x54d590({'type':_0x4ab030(0x11e),'name':'description','message':_0x4ab030(0x164)}),_0x3766d9=_0x3332bc[_0x4ab030(0x181)]?.[_0x4ab030(0x14f)]()||undefined,_0x178aab=_0x3aa5e1[_0x4ab030(0x12a)]||_0x4ab030(0x126),{choices:_0x156d52,initialIndex:_0x3b8854}=buildSiteChoices(_0x178aab),_0x37c7ab=await a24_0x54d590({'type':'select','name':_0x4ab030(0x12a),'message':_0x4ab030(0x161)+_0x19ee8c+'\x27:','choices':_0x156d52,'initial':_0x3b8854});if(!_0x37c7ab[_0x4ab030(0x12a)])return console[_0x4ab030(0x138)](_0x4ab030(0x12c)),0x1;let _0x3d285c;if(_0x37c7ab[_0x4ab030(0x12a)]==='other'){const _0x1cf8fb=await a24_0x54d590({'type':'text','name':_0x4ab030(0x14d),'message':_0x4ab030(0x159),'initial':_0x4ab030(0x126),'validate':_0xd9a2fe=>{const _0x4049cc=_0x4ab030;if(!_0xd9a2fe||!_0xd9a2fe[_0x4049cc(0x14f)]())return _0x4049cc(0x130);if(!/^[a-z0-9-]+$/[_0x4049cc(0x183)](_0xd9a2fe[_0x4049cc(0x14f)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x1cf8fb[_0x4ab030(0x14d)])return console['log'](_0x4ab030(0x12c)),0x1;_0x3d285c=_0x1cf8fb[_0x4ab030(0x14d)];}else _0x3d285c=_0x37c7ab['site'];const _0x547d63=resolveSite(_0x3d285c);console[_0x4ab030(0x138)](_0x4ab030(0x13e)+_0x547d63),console[_0x4ab030(0x138)](_0x4ab030(0x127)),console[_0x4ab030(0x138)]('\x20\x20'+getConsoleUrl(_0x547d63,_0x4ab030(0x184)));const _0x3fe3b5=await a24_0x54d590({'type':_0x4ab030(0x17b),'name':'apiKey','message':_0x4ab030(0x13f),'validate':_0x116087=>{if(!_0x116087||!_0x116087['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3fe3b5[_0x4ab030(0x12d)])return console[_0x4ab030(0x138)]('\x0aSetup\x20cancelled'),0x1;const _0x2caebd=_0x3fe3b5[_0x4ab030(0x12d)];console[_0x4ab030(0x138)](_0x4ab030(0x16e));try{const _0xf7eb7f=TDX[_0x4ab030(0x160)]({'site':_0x547d63,'apiKey':_0x2caebd[_0x4ab030(0x14f)](),'logLevel':_0x3aa5e1['logLevel']??LogLevel['ERROR']}),_0x47a215=await _0xf7eb7f[_0x4ab030(0x188)]['getUserInfo']();console[_0x4ab030(0x138)](a24_0x308155[_0x4ab030(0x133)]('✓')+_0x4ab030(0x144)+_0x47a215[_0x4ab030(0x168)]+')');const _0x2efcae=await isKeychainAvailable();_0x2efcae?(await saveAPIKeyAsync(_0x2caebd['trim'](),_0x547d63,_0x19ee8c),console[_0x4ab030(0x138)](a24_0x308155['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x19ee8c+')')):(console[_0x4ab030(0x185)](a24_0x308155[_0x4ab030(0x123)](_0x4ab030(0x18a))),console[_0x4ab030(0x185)](a24_0x308155[_0x4ab030(0x123)](_0x4ab030(0x17d))));const _0x2405c6={'site':_0x547d63,..._0x3766d9&&{'description':_0x3766d9}};return saveProfileToUserConfig(_0x19ee8c,_0x2405c6),console['log'](a24_0x308155[_0x4ab030(0x133)]('✓')+'\x20Profile\x20\x27'+_0x19ee8c+_0x4ab030(0x157)),console[_0x4ab030(0x138)](),console[_0x4ab030(0x138)](_0x4ab030(0x16f)),console[_0x4ab030(0x138)](_0x4ab030(0x17c)+_0x19ee8c+_0x4ab030(0x13b)),console[_0x4ab030(0x138)](_0x4ab030(0x17c)+_0x19ee8c+_0x4ab030(0x16d)),0x0;}catch(_0x341a3c){if(_0x341a3c instanceof HTTPClientError&&_0x341a3c[_0x4ab030(0x180)]===0x191)return printAuthError(_0x341a3c),0x1;return console['error'](a24_0x308155[_0x4ab030(0x16a)]('✗\x20Validation\x20failed:\x20'+(_0x341a3c instanceof Error?_0x341a3c[_0x4ab030(0x15c)]:String(_0x341a3c)))),console[_0x4ab030(0x17f)](_0x4ab030(0x17e)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x588ef6(0x139)]='profile:remove';[a24_0x588ef6(0x181)]=a24_0x588ef6(0x12f);['validate'](_0x57d084){const _0x2789a7=a24_0x588ef6,{args:_0x5ae278}=_0x57d084;if(_0x5ae278[_0x2789a7(0x178)]===0x0)return _0x2789a7(0x154);return undefined;}async[a24_0x588ef6(0x148)](_0x58378b){const _0x4ef1c1=a24_0x588ef6,{args:_0x4b3c87}=_0x58378b,_0x133c71=_0x4b3c87[0x0];console[_0x4ef1c1(0x138)](a24_0x308155[_0x4ef1c1(0x15e)](_0x4ef1c1(0x13c)));if(!profileExists(_0x133c71)){console[_0x4ef1c1(0x17f)](a24_0x308155[_0x4ef1c1(0x16a)](_0x4ef1c1(0x146)+_0x133c71+'\x27\x20does\x20not\x20exist.')),console['log'](_0x4ef1c1(0x143));const _0xa89db7=listProfiles();if(_0xa89db7[_0x4ef1c1(0x178)]===0x0)console[_0x4ef1c1(0x138)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x44d2f0 of _0xa89db7){console[_0x4ef1c1(0x138)](_0x4ef1c1(0x120)+_0x44d2f0[_0x4ef1c1(0x139)]);}return 0x1;}const _0x206694=await a24_0x54d590({'type':_0x4ef1c1(0x14b),'name':'confirm','message':_0x4ef1c1(0x131)+_0x133c71+'\x27?','initial':![]});if(!_0x206694[_0x4ef1c1(0x14b)])return console[_0x4ef1c1(0x138)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x133c71),console[_0x4ef1c1(0x138)](a24_0x308155[_0x4ef1c1(0x133)]('✓')+_0x4ef1c1(0x135)+_0x133c71+'\x27\x20removed\x20from\x20configuration');}catch(_0x3db900){return console[_0x4ef1c1(0x17f)](a24_0x308155[_0x4ef1c1(0x16a)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x3db900 instanceof Error?_0x3db900[_0x4ef1c1(0x15c)]:String(_0x3db900)))),0x1;}const _0x33d8c4=await isKeychainAvailable();if(_0x33d8c4){const _0x50d460=await deleteKeychainAPIKey(_0x133c71);_0x50d460&&console['log'](a24_0x308155['green']('✓')+_0x4ef1c1(0x137));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x588ef6(0x139)]=a24_0x588ef6(0x152);['description']=a24_0x588ef6(0x11f);static ['VALID_KEYS']=[a24_0x588ef6(0x12a),'database',a24_0x588ef6(0x166),a24_0x588ef6(0x125),a24_0x588ef6(0x174),'description'];[a24_0x588ef6(0x15d)](_0x3363c9){const _0x56b0c6=a24_0x588ef6,{args:_0x447680,options:_0x79aee4}=_0x3363c9,_0x3c2b34=_0x79aee4[_0x56b0c6(0x163)]||getActiveProfile();if(!_0x3c2b34)return _0x56b0c6(0x186);if(_0x447680[_0x56b0c6(0x178)]===0x0)return _0x56b0c6(0x13d)+ProfileSetCommand[_0x56b0c6(0x167)][_0x56b0c6(0x15f)](',\x20');const _0x2df9d2=_0x447680[0x0];if(!_0x2df9d2[_0x56b0c6(0x150)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56b0c6(0x167)][_0x56b0c6(0x15f)](',\x20');const [_0x5341e1]=_0x2df9d2[_0x56b0c6(0x12b)]('=',0x2);if(!ProfileSetCommand[_0x56b0c6(0x167)][_0x56b0c6(0x150)](_0x5341e1))return'Unknown\x20key\x20\x27'+_0x5341e1+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56b0c6(0x167)][_0x56b0c6(0x15f)](',\x20');return undefined;}async[a24_0x588ef6(0x148)](_0x526070){const _0x2ebeff=a24_0x588ef6,{args:_0x29ece3,options:_0x55861f}=_0x526070,_0x7f1014=_0x55861f[_0x2ebeff(0x163)]||getActiveProfile(),[_0x3f4cdf,..._0x777121]=_0x29ece3[0x0][_0x2ebeff(0x12b)]('='),_0x18edd9=_0x777121[_0x2ebeff(0x15f)]('=');console['log'](a24_0x308155[_0x2ebeff(0x15e)]('tdx:\x20profile\x20set'));if(!profileExists(_0x7f1014)){const _0xa0bd78=await a24_0x54d590({'type':_0x2ebeff(0x14b),'name':_0x2ebeff(0x160),'message':_0x2ebeff(0x146)+_0x7f1014+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0xa0bd78['create'])return console[_0x2ebeff(0x138)](_0x2ebeff(0x176)),0x1;}const _0x38296c=loadProfile(_0x7f1014),_0x5b3f0d=_0x38296c?.[_0x2ebeff(0x142)]||{};if(_0x3f4cdf===_0x2ebeff(0x12a)){const _0xfc788d=resolveSite(_0x18edd9);console[_0x2ebeff(0x138)]('Changing\x20site\x20to\x20\x27'+_0xfc788d+_0x2ebeff(0x169)),console[_0x2ebeff(0x138)](_0x2ebeff(0x15a)),console[_0x2ebeff(0x138)]('\x20\x20'+getConsoleUrl(_0xfc788d,_0x2ebeff(0x184)));const _0x316d4c=await a24_0x54d590({'type':_0x2ebeff(0x17b),'name':_0x2ebeff(0x12d),'message':_0x2ebeff(0x122),'validate':_0x109f9d=>{const _0x1a5de1=_0x2ebeff;if(!_0x109f9d||!_0x109f9d[_0x1a5de1(0x14f)]())return _0x1a5de1(0x170);return!![];}});if(!_0x316d4c['apiKey'])return console[_0x2ebeff(0x138)](_0x2ebeff(0x12e)),0x1;console[_0x2ebeff(0x138)](_0x2ebeff(0x16e));try{const _0x1a0ca5=TDX[_0x2ebeff(0x160)]({'site':_0xfc788d,'apiKey':_0x316d4c[_0x2ebeff(0x12d)][_0x2ebeff(0x14f)](),'logLevel':_0x55861f[_0x2ebeff(0x15b)]??LogLevel[_0x2ebeff(0x162)]}),_0x48d0bb=await _0x1a0ca5[_0x2ebeff(0x188)][_0x2ebeff(0x121)]();console[_0x2ebeff(0x138)](a24_0x308155['green']('✓')+_0x2ebeff(0x144)+_0x48d0bb[_0x2ebeff(0x168)]+')');const _0x3ad7ef=await isKeychainAvailable();_0x3ad7ef?(await saveAPIKeyAsync(_0x316d4c['apiKey'][_0x2ebeff(0x14f)](),_0xfc788d,_0x7f1014),console['log'](a24_0x308155[_0x2ebeff(0x133)]('✓')+_0x2ebeff(0x149))):console['warn'](a24_0x308155[_0x2ebeff(0x123)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5b3f0d[_0x2ebeff(0x12a)]=_0xfc788d;}catch(_0x3f3609){if(_0x3f3609 instanceof HTTPClientError&&_0x3f3609[_0x2ebeff(0x180)]===0x191)return printAuthError(_0x3f3609),0x1;return console[_0x2ebeff(0x17f)](a24_0x308155[_0x2ebeff(0x16a)](_0x2ebeff(0x172)+(_0x3f3609 instanceof Error?_0x3f3609[_0x2ebeff(0x15c)]:String(_0x3f3609)))),console[_0x2ebeff(0x17f)](_0x2ebeff(0x16b)),0x1;}}else _0x5b3f0d[_0x3f4cdf]=_0x18edd9||undefined;return saveProfileToUserConfig(_0x7f1014,_0x5b3f0d),console['log'](a24_0x308155[_0x2ebeff(0x133)]('✓')+'\x20Profile\x20\x27'+_0x7f1014+_0x2ebeff(0x13a)+_0x3f4cdf+'='+(_0x18edd9||_0x2ebeff(0x140))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a24_0x588ef6(0x132);['description']='Set\x20session\x20profile';['validate'](_0x3dd0d5){const _0x295964=a24_0x588ef6,{args:_0x58fb1a}=_0x3dd0d5;if(_0x58fb1a[_0x295964(0x178)]===0x0)return _0x295964(0x141);return undefined;}async[a24_0x588ef6(0x148)](_0x131df7){const _0xb60ed=a24_0x588ef6,{args:_0xf0dd40,options:_0x31c64b}=_0x131df7,_0x1c9e8b=_0xf0dd40[0x0],_0x432faf=_0x31c64b[_0xb60ed(0x151)];cleanExpiredSessions();if(!profileExists(_0x1c9e8b)){console[_0xb60ed(0x17f)](a24_0x308155[_0xb60ed(0x16a)]('Profile\x20\x27'+_0x1c9e8b+_0xb60ed(0x129))),console['log']('\x0aAvailable\x20profiles:');const _0x2adde8=listProfiles();if(_0x2adde8['length']===0x0)console[_0xb60ed(0x138)](_0xb60ed(0x177));else for(const _0x40fac9 of _0x2adde8){console[_0xb60ed(0x138)](_0xb60ed(0x120)+_0x40fac9['name']);}return 0x1;}if(_0x432faf){const _0x477398=a24_0x4429d6['join'](getConfigDir(),_0xb60ed(0x14a));return saveActiveProfileToUserConfig(_0x1c9e8b),console[_0xb60ed(0x138)]('Default\x20profile\x20set\x20to:\x20'+a24_0x308155['green'](_0x1c9e8b)),console[_0xb60ed(0x138)](a24_0x308155[_0xb60ed(0x16c)]('\x0aSaved\x20to:\x20'+_0x477398)),0x0;}const _0x3b6bbf=_0x31c64b[_0xb60ed(0x14c)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x1c9e8b},_0x31c64b[_0xb60ed(0x14c)]),console[_0xb60ed(0x138)](_0xb60ed(0x14e)+a24_0x308155[_0xb60ed(0x133)](_0x1c9e8b)+'\x20'+a24_0x308155[_0xb60ed(0x16c)](_0xb60ed(0x175)+_0x3b6bbf+')')),console[_0xb60ed(0x138)](a24_0x308155[_0xb60ed(0x16c)](_0xb60ed(0x189)+_0x1c9e8b+_0xb60ed(0x145))),0x0;}}
|
|
1
|
+
const a24_0xd5dacc=a24_0x52dc;(function(_0x5ab933,_0x1979c6){const _0x117ef2=a24_0x52dc,_0x922f80=_0x5ab933();while(!![]){try{const _0xa9041f=parseInt(_0x117ef2(0x132))/0x1*(parseInt(_0x117ef2(0x113))/0x2)+-parseInt(_0x117ef2(0x135))/0x3*(parseInt(_0x117ef2(0x11f))/0x4)+parseInt(_0x117ef2(0x131))/0x5+-parseInt(_0x117ef2(0xfe))/0x6*(parseInt(_0x117ef2(0x12c))/0x7)+parseInt(_0x117ef2(0x12f))/0x8+-parseInt(_0x117ef2(0x117))/0x9+-parseInt(_0x117ef2(0xff))/0xa;if(_0xa9041f===_0x1979c6)break;else _0x922f80['push'](_0x922f80['shift']());}catch(_0x30de01){_0x922f80['push'](_0x922f80['shift']());}}}(a24_0x1ad3,0x5146b));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_0x2d8a52 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{buildSiteChoices}from'../core/constants.js';function a24_0x52dc(_0x4c4626,_0x406523){_0x4c4626=_0x4c4626-0xe7;const _0x1ad3ce=a24_0x1ad3();let _0x52dce9=_0x1ad3ce[_0x4c4626];return _0x52dce9;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x264049 from'prompts';import a24_0xf0d6ab from'chalk';function validateProfileName(_0x57422b){const _0xa12d51=a24_0x52dc;if(!_0x57422b||!_0x57422b[_0xa12d51(0x139)]())return _0xa12d51(0xf1);const _0xdfb062=_0x57422b[_0xa12d51(0x139)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0xdfb062))return _0xa12d51(0x103);if(profileExists(_0xdfb062))return _0xa12d51(0x119)+_0xdfb062+_0xa12d51(0xfb);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0xd5dacc(0x14a)]=a24_0xd5dacc(0x116);['description']=a24_0xd5dacc(0xf5);async[a24_0xd5dacc(0x11c)](_0x59044e){const _0x3128d1=a24_0xd5dacc,{options:_0x1e1542,args:_0x37e08a}=_0x59044e;console[_0x3128d1(0x14c)](a24_0xf0d6ab['bold'](_0x3128d1(0xec)));let _0xf2e9c;if(_0x37e08a[_0x3128d1(0x123)]>0x0&&_0x37e08a[0x0]){const _0x454a83=_0x37e08a[0x0][_0x3128d1(0x139)](),_0x4f14e3=validateProfileName(_0x454a83);if(_0x4f14e3!==!![])return console[_0x3128d1(0xfa)](a24_0xf0d6ab['red'](_0x4f14e3)),0x1;_0xf2e9c=_0x454a83;}else{const _0x3e6cc6=await a24_0x264049({'type':_0x3128d1(0x121),'name':_0x3128d1(0x111),'message':_0x3128d1(0x10c),'validate':validateProfileName});if(!_0x3e6cc6[_0x3128d1(0x111)])return console[_0x3128d1(0x14c)](_0x3128d1(0x133)),0x1;_0xf2e9c=_0x3e6cc6[_0x3128d1(0x111)][_0x3128d1(0x139)]();}const _0x582b93=await a24_0x264049({'type':_0x3128d1(0x121),'name':_0x3128d1(0x104),'message':_0x3128d1(0x109)}),_0x1b2f2f=_0x582b93[_0x3128d1(0x104)]?.[_0x3128d1(0x139)]()||undefined,_0x49e4fc=_0x1e1542['site']||_0x3128d1(0xef),{choices:_0x4c576e,initialIndex:_0x1371fe}=buildSiteChoices(_0x49e4fc),_0x4e3a14=await a24_0x264049({'type':_0x3128d1(0x149),'name':_0x3128d1(0xe8),'message':_0x3128d1(0x148)+_0xf2e9c+'\x27:','choices':_0x4c576e,'initial':_0x1371fe});if(!_0x4e3a14[_0x3128d1(0xe8)])return console[_0x3128d1(0x14c)](_0x3128d1(0x133)),0x1;let _0x39473c;if(_0x4e3a14[_0x3128d1(0xe8)]==='other'){const _0x12f64a=await a24_0x264049({'type':_0x3128d1(0x121),'name':_0x3128d1(0x106),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x397cca=>{const _0x53344b=_0x3128d1;if(!_0x397cca||!_0x397cca[_0x53344b(0x139)]())return _0x53344b(0x13d);if(!/^[a-z0-9-]+$/[_0x53344b(0x136)](_0x397cca[_0x53344b(0x139)]()))return _0x53344b(0x13f);return!![];}});if(!_0x12f64a['customSite'])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x39473c=_0x12f64a[_0x3128d1(0x106)];}else _0x39473c=_0x4e3a14[_0x3128d1(0xe8)];const _0x5b545a=resolveSite(_0x39473c);console[_0x3128d1(0x14c)](_0x3128d1(0x130)+_0x5b545a),console[_0x3128d1(0x14c)](_0x3128d1(0x10d)),console[_0x3128d1(0x14c)]('\x20\x20'+getConsoleUrl(_0x5b545a,_0x3128d1(0x10a)));const _0x4bfd4d=await a24_0x264049({'type':_0x3128d1(0x12d),'name':_0x3128d1(0x128),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x49add7=>{const _0x5dfedd=_0x3128d1;if(!_0x49add7||!_0x49add7[_0x5dfedd(0x139)]())return _0x5dfedd(0x11d);return!![];}});if(!_0x4bfd4d[_0x3128d1(0x128)])return console[_0x3128d1(0x14c)](_0x3128d1(0x133)),0x1;const _0xd13df4=_0x4bfd4d[_0x3128d1(0x128)];console['log'](_0x3128d1(0x145));try{const _0x12dabb=TDX[_0x3128d1(0x11a)]({'site':_0x5b545a,'apiKey':_0xd13df4[_0x3128d1(0x139)](),'logLevel':_0x1e1542['logLevel']??LogLevel[_0x3128d1(0x134)]}),_0x25a58f=await _0x12dabb['jobs'][_0x3128d1(0x143)]();console[_0x3128d1(0x14c)](a24_0xf0d6ab[_0x3128d1(0x142)]('✓')+_0x3128d1(0x14e)+_0x25a58f[_0x3128d1(0x13c)]+')');const _0x1ad406=await isKeychainAvailable();_0x1ad406?(await saveAPIKeyAsync(_0xd13df4['trim'](),_0x5b545a,_0xf2e9c),console[_0x3128d1(0x14c)](a24_0xf0d6ab[_0x3128d1(0x142)]('✓')+_0x3128d1(0x105)+_0xf2e9c+')')):(console[_0x3128d1(0x14d)](a24_0xf0d6ab[_0x3128d1(0xee)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x3128d1(0x14d)](a24_0xf0d6ab[_0x3128d1(0xee)](_0x3128d1(0x11e))));const _0x139a8e={'site':_0x5b545a,..._0x1b2f2f&&{'description':_0x1b2f2f}};return saveProfileToUserConfig(_0xf2e9c,_0x139a8e),console[_0x3128d1(0x14c)](a24_0xf0d6ab['green']('✓')+_0x3128d1(0xfd)+_0xf2e9c+_0x3128d1(0xe9)),console[_0x3128d1(0x14c)](),console[_0x3128d1(0x14c)](_0x3128d1(0x137)),console[_0x3128d1(0x14c)](_0x3128d1(0xf6)+_0xf2e9c+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x3128d1(0x14c)](_0x3128d1(0xf6)+_0xf2e9c+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x375902){if(_0x375902 instanceof HTTPClientError&&_0x375902[_0x3128d1(0x107)]===0x191)return printAuthError(_0x375902),0x1;return console[_0x3128d1(0xfa)](a24_0xf0d6ab[_0x3128d1(0x115)]('✗\x20Validation\x20failed:\x20'+(_0x375902 instanceof Error?_0x375902[_0x3128d1(0x140)]:String(_0x375902)))),console[_0x3128d1(0xfa)](_0x3128d1(0x138)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0xd5dacc(0x14a)]='profile:remove';['description']=a24_0xd5dacc(0x13a);[a24_0xd5dacc(0x10b)](_0x387ca4){const _0x1ee3b9=a24_0xd5dacc,{args:_0x182990}=_0x387ca4;if(_0x182990[_0x1ee3b9(0x123)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0xc2a476){const _0x5e9d38=a24_0xd5dacc,{args:_0x176857}=_0xc2a476,_0x40c096=_0x176857[0x0];console['log'](a24_0xf0d6ab[_0x5e9d38(0x151)](_0x5e9d38(0x14f)));if(!profileExists(_0x40c096)){console[_0x5e9d38(0xfa)](a24_0xf0d6ab[_0x5e9d38(0x115)]('Profile\x20\x27'+_0x40c096+_0x5e9d38(0xf0))),console[_0x5e9d38(0x14c)](_0x5e9d38(0x12b));const _0x30ab50=listProfiles();if(_0x30ab50[_0x5e9d38(0x123)]===0x0)console[_0x5e9d38(0x14c)](_0x5e9d38(0xf4));else for(const _0x416760 of _0x30ab50){console[_0x5e9d38(0x14c)](_0x5e9d38(0x144)+_0x416760['name']);}return 0x1;}const _0x2673db=await a24_0x264049({'type':'confirm','name':_0x5e9d38(0xfc),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x40c096+'\x27?','initial':![]});if(!_0x2673db[_0x5e9d38(0xfc)])return console['log'](_0x5e9d38(0xf8)),0x0;try{removeProfileFromUserConfig(_0x40c096),console['log'](a24_0xf0d6ab['green']('✓')+_0x5e9d38(0xfd)+_0x40c096+_0x5e9d38(0x11b));}catch(_0x4db3ef){return console[_0x5e9d38(0xfa)](a24_0xf0d6ab['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x4db3ef instanceof Error?_0x4db3ef[_0x5e9d38(0x140)]:String(_0x4db3ef)))),0x1;}const _0x2ac9ee=await isKeychainAvailable();if(_0x2ac9ee){const _0x31c171=await deleteKeychainAPIKey(_0x40c096);_0x31c171&&console[_0x5e9d38(0x14c)](a24_0xf0d6ab['green']('✓')+_0x5e9d38(0x14b));}return 0x0;}}function a24_0x1ad3(){const _0x55616b=['database','Profile\x20\x27','create','\x27\x20removed\x20from\x20configuration','execute','API\x20key\x20cannot\x20be\x20empty','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','2764RfpxVO','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','text','includes','length','toString','Session\x20profile\x20set\x20to:\x20','\x0aSaved\x20to:\x20','llm_agent','apiKey','session','\x27\x20requires\x20API\x20key\x20validation.','\x0aAvailable\x20profiles:','7bAPPgJ','password','tdx:\x20profile\x20set','1087112HaeeRN','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','340360jFnrtQ','4JBkuyc','\x0aSetup\x20cancelled','ERROR','537llgzrX','test','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','trim','Remove\x20a\x20profile','Changing\x20site\x20to\x20\x27','email','Site\x20name\x20cannot\x20be\x20empty','\x0aOperation\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','message','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','green','getUserInfo','\x20\x20-\x20','Validating\x20API\x20key...','Set\x20session\x20profile','tdx.json','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','select','name','\x20API\x20key\x20removed\x20from\x20system\x20keychain','log','warn','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx:\x20profile\x20remove','Unknown\x20key\x20\x27','bold','\x20API\x20key\x20saved\x20to\x20system\x20keychain','site','\x27\x20created','(cleared)','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20create','Operation\x20cancelled','yellow','us01','\x27\x20does\x20not\x20exist.','Profile\x20name\x20cannot\x20be\x20empty','profile','dim','\x20\x20(no\x20profiles\x20found)','Create\x20a\x20new\x20profile','\x20\x20tdx\x20--profile\x20','config','Removal\x20cancelled','join','error','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','confirm','\x20Profile\x20\x27','135534FwFyBy','1232240AoxjzL','(session:\x20','split','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','description','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','customSite','status','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Enter\x20description\x20(optional):','/app/mp/ak','validate','Enter\x20profile\x20name:','You\x20can\x20find\x20your\x20API\x20key\x20at:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Set\x20a\x20profile\x20configuration\x20value','\x20--default\x27\x20to\x20save\x20permanently','profileName','VALID_KEYS','329194CdlcLm','llm_project','red','profile:create','2339460KFSnlr'];a24_0x1ad3=function(){return _0x55616b;};return a24_0x1ad3();}export class ProfileSetCommand extends BaseCommand{[a24_0xd5dacc(0x14a)]='profile:set';[a24_0xd5dacc(0x104)]=a24_0xd5dacc(0x10f);static [a24_0xd5dacc(0x112)]=[a24_0xd5dacc(0xe8),a24_0xd5dacc(0x118),'parent_segment',a24_0xd5dacc(0x114),a24_0xd5dacc(0x127),'description'];[a24_0xd5dacc(0x10b)](_0x19ca57){const _0x488b26=a24_0xd5dacc,{args:_0x16e1c6,options:_0xc9d4a}=_0x19ca57,_0x1a28ce=_0xc9d4a[_0x488b26(0xf2)]||getActiveProfile();if(!_0x1a28ce)return'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>';if(_0x16e1c6[_0x488b26(0x123)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x488b26(0x112)][_0x488b26(0xf9)](',\x20');const _0x156a5b=_0x16e1c6[0x0];if(!_0x156a5b[_0x488b26(0x122)]('='))return _0x488b26(0x120)+ProfileSetCommand[_0x488b26(0x112)][_0x488b26(0xf9)](',\x20');const [_0x5cb7de]=_0x156a5b['split']('=',0x2);if(!ProfileSetCommand[_0x488b26(0x112)][_0x488b26(0x122)](_0x5cb7de))return _0x488b26(0x150)+_0x5cb7de+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x488b26(0xf9)](',\x20');return undefined;}async[a24_0xd5dacc(0x11c)](_0x48eda7){const _0x217afe=a24_0xd5dacc,{args:_0x41c40b,options:_0x4ff745}=_0x48eda7,_0x5a26a6=_0x4ff745[_0x217afe(0xf2)]||getActiveProfile(),[_0x434f95,..._0x5d49be]=_0x41c40b[0x0][_0x217afe(0x101)]('='),_0x4c808c=_0x5d49be['join']('=');console[_0x217afe(0x14c)](a24_0xf0d6ab[_0x217afe(0x151)](_0x217afe(0x12e)));if(!profileExists(_0x5a26a6)){const _0x4a8719=await a24_0x264049({'type':_0x217afe(0xfc),'name':_0x217afe(0x11a),'message':_0x217afe(0x119)+_0x5a26a6+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x4a8719[_0x217afe(0x11a)])return console['log'](_0x217afe(0xed)),0x1;}const _0x32130a=loadProfile(_0x5a26a6),_0x142c91=_0x32130a?.[_0x217afe(0xf7)]||{};if(_0x434f95===_0x217afe(0xe8)){const _0xe078b9=resolveSite(_0x4c808c);console[_0x217afe(0x14c)](_0x217afe(0x13b)+_0xe078b9+_0x217afe(0x12a)),console[_0x217afe(0x14c)](_0x217afe(0x141)),console[_0x217afe(0x14c)]('\x20\x20'+getConsoleUrl(_0xe078b9,'/app/mp/ak'));const _0x5e4171=await a24_0x264049({'type':_0x217afe(0x12d),'name':_0x217afe(0x128),'message':_0x217afe(0x108),'validate':_0x4b0ed2=>{const _0x2e39e1=_0x217afe;if(!_0x4b0ed2||!_0x4b0ed2['trim']())return _0x2e39e1(0x11d);return!![];}});if(!_0x5e4171['apiKey'])return console[_0x217afe(0x14c)](_0x217afe(0x13e)),0x1;console[_0x217afe(0x14c)](_0x217afe(0x145));try{const _0x5f2a1e=TDX[_0x217afe(0x11a)]({'site':_0xe078b9,'apiKey':_0x5e4171['apiKey']['trim'](),'logLevel':_0x4ff745['logLevel']??LogLevel[_0x217afe(0x134)]}),_0x2979b8=await _0x5f2a1e['jobs']['getUserInfo']();console[_0x217afe(0x14c)](a24_0xf0d6ab[_0x217afe(0x142)]('✓')+_0x217afe(0x14e)+_0x2979b8[_0x217afe(0x13c)]+')');const _0x30aee4=await isKeychainAvailable();_0x30aee4?(await saveAPIKeyAsync(_0x5e4171[_0x217afe(0x128)][_0x217afe(0x139)](),_0xe078b9,_0x5a26a6),console['log'](a24_0xf0d6ab[_0x217afe(0x142)]('✓')+_0x217afe(0xe7))):console[_0x217afe(0x14d)](a24_0xf0d6ab[_0x217afe(0xee)](_0x217afe(0x10e))),_0x142c91[_0x217afe(0xe8)]=_0xe078b9;}catch(_0x551762){if(_0x551762 instanceof HTTPClientError&&_0x551762[_0x217afe(0x107)]===0x191)return printAuthError(_0x551762),0x1;return console[_0x217afe(0xfa)](a24_0xf0d6ab[_0x217afe(0x115)]('✗\x20Validation\x20failed:\x20'+(_0x551762 instanceof Error?_0x551762['message']:String(_0x551762)))),console[_0x217afe(0xfa)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x142c91[_0x434f95]=_0x4c808c||undefined;return saveProfileToUserConfig(_0x5a26a6,_0x142c91),console['log'](a24_0xf0d6ab[_0x217afe(0x142)]('✓')+_0x217afe(0xfd)+_0x5a26a6+'\x27\x20updated:\x20'+_0x434f95+'='+(_0x4c808c||_0x217afe(0xea))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0xd5dacc(0x14a)]='profile:use';['description']=a24_0xd5dacc(0x146);[a24_0xd5dacc(0x10b)](_0x3d21ba){const _0x5ea133=a24_0xd5dacc,{args:_0x49df53}=_0x3d21ba;if(_0x49df53[_0x5ea133(0x123)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0xd5dacc(0x11c)](_0x2be24c){const _0x3e8cf6=a24_0xd5dacc,{args:_0x4add00,options:_0x3168ce}=_0x2be24c,_0x15f98d=_0x4add00[0x0],_0xace1a7=_0x3168ce['default'];cleanExpiredSessions();if(!profileExists(_0x15f98d)){console['error'](a24_0xf0d6ab[_0x3e8cf6(0x115)](_0x3e8cf6(0x119)+_0x15f98d+'\x27\x20does\x20not\x20exist.')),console[_0x3e8cf6(0x14c)]('\x0aAvailable\x20profiles:');const _0x574821=listProfiles();if(_0x574821[_0x3e8cf6(0x123)]===0x0)console[_0x3e8cf6(0x14c)](_0x3e8cf6(0xf4));else for(const _0x563987 of _0x574821){console['log'](_0x3e8cf6(0x144)+_0x563987[_0x3e8cf6(0x14a)]);}return 0x1;}if(_0xace1a7){const _0x2b75b9=a24_0x2d8a52[_0x3e8cf6(0xf9)](getConfigDir(),_0x3e8cf6(0x147));return saveActiveProfileToUserConfig(_0x15f98d),console[_0x3e8cf6(0x14c)](_0x3e8cf6(0xeb)+a24_0xf0d6ab['green'](_0x15f98d)),console['log'](a24_0xf0d6ab[_0x3e8cf6(0xf3)](_0x3e8cf6(0x126)+_0x2b75b9)),0x0;}const _0x42f56a=_0x3168ce[_0x3e8cf6(0x129)]||getCurrentSessionPID()[_0x3e8cf6(0x124)]();return saveSessionContext({'profile':_0x15f98d},_0x3168ce[_0x3e8cf6(0x129)]),console[_0x3e8cf6(0x14c)](_0x3e8cf6(0x125)+a24_0xf0d6ab[_0x3e8cf6(0x142)](_0x15f98d)+'\x20'+a24_0xf0d6ab['dim'](_0x3e8cf6(0x100)+_0x42f56a+')')),console[_0x3e8cf6(0x14c)](a24_0xf0d6ab[_0x3e8cf6(0xf3)](_0x3e8cf6(0x102)+_0x15f98d+_0x3e8cf6(0x110))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x24acfb=a25_0x4d68;function a25_0x586d(){const _0x504aaf=['1540296iEHRAO','33528fNmUCl','map','length','1868200WKvvPL','profiles','description','485776DmuBlc','error','Error:\x20','1993236lqOyci','message','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','319909KynDgO','execute','\x20\x20Global:\x20~/.config/tdx/tdx.json','657ZARfnf','18GoAOMs','config','234241ywyzqo','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'];a25_0x586d=function(){return _0x504aaf;};return a25_0x586d();}(function(_0x2592f0,_0x328b0c){const _0x1f25e1=a25_0x4d68,_0x362c45=_0x2592f0();while(!![]){try{const _0x1a0257=-parseInt(_0x1f25e1(0x145))/0x1+-parseInt(_0x1f25e1(0x13e))/0x2+parseInt(_0x1f25e1(0x137))/0x3+parseInt(_0x1f25e1(0x141))/0x4+-parseInt(_0x1f25e1(0x13b))/0x5+parseInt(_0x1f25e1(0x149))/0x6*(-parseInt(_0x1f25e1(0x134))/0x7)+parseInt(_0x1f25e1(0x138))/0x8*(parseInt(_0x1f25e1(0x148))/0x9);if(_0x1a0257===_0x328b0c)break;else _0x362c45['push'](_0x362c45['shift']());}catch(_0x561cba){_0x362c45['push'](_0x362c45['shift']());}}}(a25_0x586d,0x4491a));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x4d68(_0x312364,_0x35beb2){_0x312364=_0x312364-0x133;const _0x586daf=a25_0x586d();let _0x4d6841=_0x586daf[_0x312364];return _0x4d6841;}export class ProfilesCommand extends BaseCommand{[a25_0x24acfb(0x144)]=a25_0x24acfb(0x13c);[a25_0x24acfb(0x13d)]='List\x20all\x20available\x20profiles';async[a25_0x24acfb(0x146)](_0x37aa4e){const _0x3b77c9=a25_0x24acfb,{options:_0x5b4b36}=_0x37aa4e;try{const _0x37f80a=listProfiles(),_0x35e57a=getActiveProfile();if(_0x37f80a[_0x3b77c9(0x13a)]===0x0)return console['log'](_0x3b77c9(0x143)),console['log'](_0x3b77c9(0x136)),console['log'](_0x3b77c9(0x147)),0x0;const _0x42a1bc=_0x37f80a[_0x3b77c9(0x139)](_0x2bd867=>{const _0x205988=_0x3b77c9,_0x395859=_0x2bd867[_0x205988(0x144)]===_0x35e57a,_0x5b37e1=getProfileParams(_0x2bd867['config']);return{'name':_0x2bd867[_0x205988(0x144)],'active':_0x395859,'scope':_0x2bd867[_0x205988(0x135)],'description':_0x2bd867[_0x205988(0x133)][_0x205988(0x13d)]||'','params':_0x5b37e1};});return await handleSDKOutput(_0x42a1bc,_0x5b4b36),0x0;}catch(_0xd7ee27){return _0xd7ee27 instanceof Error&&console[_0x3b77c9(0x13f)](_0x3b77c9(0x140)+_0xd7ee27[_0x3b77c9(0x142)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a26_0x1a5a4e=a26_0x1616;function a26_0x5617(){const _0x52460b=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','656870wEqpEA','information_schema','validate','3256948LBqaYO','751814RMAYLb','processedRows','stats','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','15410fOEJsC','execute','Query\x20completed:\x20Processed\x20','output','join','totalSplits','setPhase','completedSplits','file','verbose','Schema:\x20','error','797368FGVCUQ','message','push','\x20splits','Catalog:\x20','\x20rows\x20','425817njxBAf','Error:\x20','catalog','database','8FQgdJq','Executing\x20query...','name','360bJGMid','Run\x20Trino\x20queries\x20(streaming)','elapsedTimeMillis','site','state','No\x20SQL\x20provided','Site:\x20','options','306bpecFq','originalMessage','...','3430176jnXHzi','\x20-\x20','setExtra','in\x20','setJobId','length','Statement\x20','query'];a26_0x5617=function(){return _0x52460b;};return a26_0x5617();}(function(_0x5954ae,_0x194286){const _0x175fed=a26_0x1616,_0x8ec3be=_0x5954ae();while(!![]){try{const _0x51098f=parseInt(_0x175fed(0x1d3))/0x1+parseInt(_0x175fed(0x1dd))/0x2*(parseInt(_0x175fed(0x1d9))/0x3)+parseInt(_0x175fed(0x1f7))/0x4+-parseInt(_0x175fed(0x1fc))/0x5*(-parseInt(_0x175fed(0x1e0))/0x6)+parseInt(_0x175fed(0x1f8))/0x7+parseInt(_0x175fed(0x1eb))/0x8+-parseInt(_0x175fed(0x1e8))/0x9*(parseInt(_0x175fed(0x1f4))/0xa);if(_0x51098f===_0x194286)break;else _0x8ec3be['push'](_0x8ec3be['shift']());}catch(_0xab4bb1){_0x8ec3be['push'](_0x8ec3be['shift']());}}}(a26_0x5617,0xa2dd9));import{BaseCommand}from'./command.js';function a26_0x1616(_0x3aefdb,_0x5971a1){_0x3aefdb=_0x3aefdb-0x1cd;const _0x561703=a26_0x5617();let _0x1616cb=_0x561703[_0x3aefdb];return _0x1616cb;}import{SDKError}from'../sdk/index.js';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{[a26_0x1a5a4e(0x1df)]=a26_0x1a5a4e(0x1f2);['description']=a26_0x1a5a4e(0x1e1);async[a26_0x1a5a4e(0x1fd)](_0xd6a621){const _0x9e1f0f=a26_0x1a5a4e,{options:_0x1ee144,args:_0x4b7bf9,tdx:_0x2dd104}=_0xd6a621,_0x1e7c3d=_0x4b7bf9[0x0],_0x2c727d=_0x1ee144['file'];let _0x2a395b;try{if(_0x2c727d)_0x2a395b=readSqlStatementsFromFile(_0x2c727d);else{if(_0x1e7c3d==='-')_0x2a395b=await readSqlStatementsFromStdin();else{if(_0x1e7c3d&&isSqlFilePath(_0x1e7c3d))_0x2a395b=readSqlStatementsFromFile(_0x1e7c3d);else{if(_0x1e7c3d)_0x2a395b=splitSqlStatements(_0x1e7c3d);else throw new Error(_0x9e1f0f(0x1e5));}}}}catch(_0x3d59e1){return console[_0x9e1f0f(0x1d2)](_0x9e1f0f(0x1da)+_0x3d59e1['message']),0x1;}const _0x3a407e=_0x1ee144[_0x9e1f0f(0x1dc)]||_0x9e1f0f(0x1f5),_0x2fb5fe=_0x1ee144[_0x9e1f0f(0x1db)];try{const _0x15a16a=[],_0x4b6939=!!_0x1ee144[_0x9e1f0f(0x1ff)];for(let _0x1a4302=0x0;_0x1a4302<_0x2a395b[_0x9e1f0f(0x1f0)];_0x1a4302++){const _0x3e7790=_0x2a395b[_0x1a4302],_0x17e81f=_0x1a4302+0x1,_0x43bf82=_0x2a395b[_0x9e1f0f(0x1f0)],_0xfa0635=_0x43bf82>0x1;_0x1ee144[_0x9e1f0f(0x1d0)]&&(console[_0x9e1f0f(0x1d2)]('\x0a'+(_0xfa0635?'Statement\x20'+_0x17e81f+'/'+_0x43bf82+':':'')),console['error'](_0x9e1f0f(0x1e6)+_0x1ee144[_0x9e1f0f(0x1e3)]),console[_0x9e1f0f(0x1d2)](_0x9e1f0f(0x1d7)+(_0x2fb5fe||'td')),console['error'](_0x9e1f0f(0x1d1)+_0x3a407e),console['error']('SQL:\x20'+_0x3e7790));const _0x5d0f85=_0xfa0635?'Executing\x20statement\x20'+_0x17e81f+'/'+_0x43bf82+_0x9e1f0f(0x1ea):_0x9e1f0f(0x1de);try{const _0x44c21e=await withProgressSpinner(_0x5d0f85,async _0xbeda46=>{const _0x44630a=_0x9e1f0f,_0x168ef6=await _0x2dd104[_0x44630a(0x1f2)][_0x44630a(0x1fd)](_0x3e7790,{'catalog':_0x2fb5fe,'schema':_0x3a407e,'onJobId':_0x3dd52f=>{const _0x3a49c1=_0x44630a;_0xbeda46[_0x3a49c1(0x1ef)](_0x3dd52f);},'onProgress':_0x469482=>{const _0x18b8a3=_0x44630a;_0xbeda46[_0x18b8a3(0x1cd)]('Executing\x20query\x20['+_0x469482[_0x18b8a3(0x1e4)]+']'),_0xbeda46[_0x18b8a3(0x1ed)](formatRows(_0x469482[_0x18b8a3(0x1f9)])+'\x20rows\x20'+_0x469482[_0x18b8a3(0x1ce)]+'/'+_0x469482[_0x18b8a3(0x201)]+_0x18b8a3(0x1d6));}});return _0x168ef6;},{'verbose':_0x1ee144[_0x9e1f0f(0x1d0)]}),_0x495f6c=_0x44c21e['data'],_0x280e9f=_0x495f6c['jobId']?'\x20[Job\x20ID:\x20'+_0x495f6c['jobId']+']':'',_0x48cad0=_0xfa0635?_0x9e1f0f(0x1f1)+_0x17e81f+'/'+_0x43bf82+_0x9e1f0f(0x1ec):'';console[_0x9e1f0f(0x1d2)]('✔\x20'+_0x48cad0+_0x9e1f0f(0x1fe)+formatRows(_0x495f6c[_0x9e1f0f(0x1fa)]['processedRows'])+_0x9e1f0f(0x1d8)+(_0x9e1f0f(0x1ee)+formatElapsed(_0x495f6c[_0x9e1f0f(0x1fa)][_0x9e1f0f(0x1e2)])+_0x280e9f));if(_0xfa0635&&_0x4b6939){const _0x4e69f5=resolveOutputOptions(_0x1ee144),_0x4338cd=await formatQueryOutput(_0x495f6c,_0x4e69f5);_0x15a16a[_0x9e1f0f(0x1d5)](_0x4338cd);}else await handleQueryOutput(_0x495f6c,_0x1ee144);}catch(_0x5d5785){const _0x344662=_0xfa0635?'Statement\x20'+_0x17e81f+'/'+_0x43bf82+':\x0a':'',_0x3b3b7e=_0x5d5785 instanceof SDKError?_0x5d5785[_0x9e1f0f(0x1e9)]:_0x5d5785[_0x9e1f0f(0x1d4)];return console[_0x9e1f0f(0x1d2)](''+_0x344662+_0x3b3b7e),0x1;}}if(_0x2a395b[_0x9e1f0f(0x1f0)]>0x1&&_0x4b6939&&_0x15a16a[_0x9e1f0f(0x1f0)]>0x0){const _0x1e0516=_0x15a16a[_0x9e1f0f(0x200)]('\x0a');writeFileSync(_0x1ee144['output'],_0x1e0516),console[_0x9e1f0f(0x1d2)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x1ee144['output']);}return 0x0;}catch(_0x5c00ba){throw _0x5c00ba;}}[a26_0x1a5a4e(0x1f6)](_0x29f44e){const _0x5bf7ea=a26_0x1a5a4e,_0x1e78b2=_0x29f44e['args'][0x0],_0x3b291d=_0x29f44e[_0x5bf7ea(0x1e7)][_0x5bf7ea(0x1cf)];if(!_0x1e78b2&&!_0x3b291d)return _0x5bf7ea(0x1fb);if(_0x1e78b2&&_0x3b291d)return _0x5bf7ea(0x1f3);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x2cbd8e=a27_0x30c6;(function(_0x38d533,_0x4be7a1){const _0x2f2666=a27_0x30c6,_0x40928a=_0x38d533();while(!![]){try{const _0x1f0566=parseInt(_0x2f2666(0x25c))/0x1+-parseInt(_0x2f2666(0x1d5))/0x2*(parseInt(_0x2f2666(0x254))/0x3)+-parseInt(_0x2f2666(0x1e6))/0x4*(-parseInt(_0x2f2666(0x1bd))/0x5)+-parseInt(_0x2f2666(0x1db))/0x6*(-parseInt(_0x2f2666(0x1c9))/0x7)+parseInt(_0x2f2666(0x216))/0x8*(-parseInt(_0x2f2666(0x1c4))/0x9)+-parseInt(_0x2f2666(0x245))/0xa*(-parseInt(_0x2f2666(0x1d4))/0xb)+-parseInt(_0x2f2666(0x1df))/0xc;if(_0x1f0566===_0x4be7a1)break;else _0x40928a['push'](_0x40928a['shift']());}catch(_0x950b68){_0x40928a['push'](_0x40928a['shift']());}}}(a27_0x518e,0xcf86c));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';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a27_0x518e(){const _0x109d05=['getParent','segment:view','Fetching\x20SQL\x20for\x20segment...','parentId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Folder\x20ID:\x20','Options:','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20Full\x20path:\x20','/e/','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','toLocaleString','Resolving\x20parent\x20segment\x20\x27','code','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolving\x20folder\x20\x27','parent','Examples:','folderPath','site','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','cyan','Usage:\x20tdx\x20sg\x20show\x20<name>','limit','parentSegment','length','folder','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','type','Site:\x20','information_schema','in\x20','resolvePathToResource','segment:folder:create','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','SEGMENT_NOT_FOUND','Show\x20child\x20segment\x20schema\x20(column\x20types)','format','folderId','Target\x20path:\x20','Creating\x20folder\x20\x27','Parent\x20ID:\x20','32KAxlRs','\x20\x20Parent\x20segment:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Use:\x20tdx\x20ps\x20view\x20-w','cause','Segment\x20ID:\x20','Fetching\x20folder\x20details...','/app/ps/','parentFolder','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20sql','url','green','getFolder','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','log','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','stats','Get\x20SQL\x20query\x20for\x20child\x20segment','query','description','✖\x20Query\x20failed\x20[','data','replace','Resolved\x20parent\x20folder\x20ID:\x20','✔\x20Created\x20folder\x20\x27','fullPath','resolveFolderId','segment','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:list','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','resolveParentId','\x20folder','Usage:\x20tdx\x20sg\x20desc\x20<name>','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','execute','Use:\x20tdx\x20ps\x20show','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Resolving\x20path\x20\x27','8151730vmcPwb','Usage:\x20tdx\x20sg\x20sql\x20<name>','message','trim','SEGMENT_FOLDER_NOT_FOUND','includes','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20segment\x20details...','name','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','error','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Folder\x20name:\x20','177876XUXhUP','\x27...','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','jobId','✔\x20Found\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20desc','elapsedTimeMillis','777097hawHIf','segmentName','891180zAKCxn','\x20\x20Cause:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','web','\x20rows\x20','Show\x20segment\x20or\x20folder\x20details','(root)','1793628XGrmhA','Resolving\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','2269862aqbThO','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20folder\x20ID:\x20','getSegment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','segment:folder:show','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segment:sql','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','11wOTVMj','34Bmijkd','Use:\x20tdx\x20ps\x20view','\x20\x20Folder\x20path:\x20','segmentId','setJobId','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','24FNVhxK','Show\x20segment\x20folder\x20details','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','22059576hOlLZg','verbose','processedRows','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','SQL\x20query:\x0a','Error:\x20Folder\x20reference\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','36NmpaAK','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>'];a27_0x518e=function(){return _0x109d05;};return a27_0x518e();}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_0xa1272f from'chalk';function a27_0x30c6(_0x2229fd,_0x4267d7){_0x2229fd=_0x2229fd-0x1bc;const _0x518e58=a27_0x518e();let _0x30c671=_0x518e58[_0x2229fd];return _0x30c671;}async function resolveSegmentTarget(_0x29850d,_0x363fd9,_0x32b975){const _0x44a05d=a27_0x30c6;if(isYamlFilePath(_0x29850d))try{const _0x2ed2f7=await resolveYamlFilePath(_0x29850d);return _0x32b975&&(console[_0x44a05d(0x251)]('Resolved\x20YAML\x20file:\x20'+_0x29850d),console[_0x44a05d(0x251)](_0x44a05d(0x217)+_0x2ed2f7[_0x44a05d(0x202)]),console[_0x44a05d(0x251)]('\x20\x20Segment\x20name:\x20'+_0x2ed2f7[_0x44a05d(0x1bc)]),console[_0x44a05d(0x251)](_0x44a05d(0x1d7)+(_0x2ed2f7[_0x44a05d(0x1fb)]||_0x44a05d(0x1c3))),console[_0x44a05d(0x251)](_0x44a05d(0x1f1)+_0x2ed2f7[_0x44a05d(0x233)])),_0x2ed2f7[_0x44a05d(0x233)];}catch(_0x4a8d36){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x44a05d(0x252)+_0x4a8d36[_0x44a05d(0x247)]);}if(!_0x363fd9)throw new SDKError(ErrorCode[_0x44a05d(0x1d2)],_0x44a05d(0x238));return _0x363fd9+'/'+_0x29850d;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a27_0x2cbd8e(0x22d)]=a27_0x2cbd8e(0x1c2);async[a27_0x2cbd8e(0x23f)](_0x19486a){const _0x5c50ed=a27_0x2cbd8e,{options:_0x39b05e,args:_0x1101f5,tdx:_0x52668e}=_0x19486a,_0x4c45e0=_0x1101f5[0x0],_0xc8e702=!_0x4c45e0&&!!_0x39b05e[_0x5c50ed(0x202)],_0x34ea03=_0x4c45e0||_0x39b05e['parentSegment'];if(!_0x34ea03)return console[_0x5c50ed(0x251)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x5c50ed(0x251)](_0x5c50ed(0x1e8)),console['error'](_0x5c50ed(0x1fa)),console[_0x5c50ed(0x251)](_0x5c50ed(0x23e)),console[_0x5c50ed(0x251)](_0x5c50ed(0x1e2)),console['error'](_0x5c50ed(0x24f)),console[_0x5c50ed(0x251)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x470bd7=_0x39b05e['segmentPath'];let _0x4d3e96=_0x34ea03;!_0xc8e702&&_0x470bd7&&!_0x34ea03[_0x5c50ed(0x24a)]('/')&&(_0x4d3e96=_0x470bd7+'/'+_0x34ea03,_0x39b05e[_0x5c50ed(0x1e0)]&&console['error'](_0x5c50ed(0x1de)+_0x4d3e96));const _0x492a17=await withSpinner(_0x5c50ed(0x244)+_0x4d3e96+_0x5c50ed(0x255),()=>_0x52668e[_0x5c50ed(0x235)][_0x5c50ed(0x20c)](_0x4d3e96),{'verbose':_0x39b05e[_0x5c50ed(0x1e0)]}),_0x5a3013=_0x492a17[_0x5c50ed(0x22f)];_0x39b05e[_0x5c50ed(0x1e0)]&&(console[_0x5c50ed(0x251)](_0x5c50ed(0x24b)+_0x5a3013[_0x5c50ed(0x208)]),console['error'](_0x5c50ed(0x215)+_0x5a3013[_0x5c50ed(0x1ec)]),_0x5a3013[_0x5c50ed(0x212)]&&console[_0x5c50ed(0x251)](_0x5c50ed(0x1ee)+_0x5a3013[_0x5c50ed(0x212)]),_0x5a3013[_0x5c50ed(0x1d8)]&&console[_0x5c50ed(0x251)]('Segment\x20ID:\x20'+_0x5a3013[_0x5c50ed(0x1d8)]));if(_0x5a3013[_0x5c50ed(0x208)]==='parent'){const _0x22f73c=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x52668e[_0x5c50ed(0x235)][_0x5c50ed(0x1e9)](_0x5a3013['parentId']),{'verbose':_0x39b05e[_0x5c50ed(0x1e0)]});await handleSingleObjectOutput(_0x22f73c['data'],_0x39b05e);}else{if(_0x5a3013['type']===_0x5c50ed(0x204)){if(!_0x5a3013[_0x5c50ed(0x212)])throw new SDKError(ErrorCode[_0x5c50ed(0x249)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1d8395=await withSpinner(_0x5c50ed(0x21c),()=>_0x52668e[_0x5c50ed(0x235)]['getFolder'](_0x5a3013[_0x5c50ed(0x212)]),{'verbose':_0x39b05e[_0x5c50ed(0x1e0)]});await handleSingleObjectOutput(_0x1d8395['data'],_0x39b05e);}else{if(_0x5a3013['type']===_0x5c50ed(0x235)){if(!_0x5a3013[_0x5c50ed(0x1d8)])throw new SDKError(ErrorCode[_0x5c50ed(0x20f)],_0x5c50ed(0x1dd));const _0x2516d3=await withSpinner(_0x5c50ed(0x24d),()=>_0x52668e[_0x5c50ed(0x235)][_0x5c50ed(0x1cc)](_0x5a3013[_0x5c50ed(0x1ec)],_0x5a3013[_0x5c50ed(0x1d8)]),{'verbose':_0x39b05e[_0x5c50ed(0x1e0)]});await handleSingleObjectOutput(_0x2516d3['data'],_0x39b05e);}}}return 0x0;}catch(_0x5bcd15){if(_0x5bcd15 instanceof SDKError)return console[_0x5c50ed(0x251)](_0x5c50ed(0x1c7)+_0x5bcd15['message']),_0x5bcd15['cause']&&console[_0x5c50ed(0x251)]('\x20\x20Cause:\x20'+_0x5bcd15[_0x5c50ed(0x21a)]),0x1;throw _0x5bcd15;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]='segment:show';[a27_0x2cbd8e(0x22d)]=a27_0x2cbd8e(0x23d);async[a27_0x2cbd8e(0x23f)](_0x13e016){const _0xd78574=a27_0x2cbd8e,{options:_0x2d9660,args:_0x59a9a2,tdx:_0x4e4f26}=_0x13e016,_0x317636=_0x59a9a2[0x0];if(!_0x317636)return console['error'](_0xd78574(0x225)),console[_0xd78574(0x251)](_0xd78574(0x200)),console['error'](_0xd78574(0x239)),console[_0xd78574(0x251)]('Examples:'),console[_0xd78574(0x251)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0xd78574(0x251)](_0xd78574(0x1d3)),0x1;try{const _0x3fb06f=_0x2d9660['parentSegment'],_0x51fa14=await resolveSegmentTarget(_0x317636,_0x3fb06f,_0x2d9660['verbose']);_0x2d9660[_0xd78574(0x1e0)]&&console[_0xd78574(0x251)](_0xd78574(0x213)+_0x51fa14);const _0x1f153a=await withSpinner(_0xd78574(0x1c5)+_0x317636+_0xd78574(0x255),()=>_0x4e4f26[_0xd78574(0x235)][_0xd78574(0x20c)](_0x51fa14),{'verbose':_0x2d9660[_0xd78574(0x1e0)]}),_0x22ed69=_0x1f153a['data'];_0x2d9660['verbose']&&(console[_0xd78574(0x251)]('Resolved\x20type:\x20'+_0x22ed69[_0xd78574(0x208)]),console[_0xd78574(0x251)](_0xd78574(0x215)+_0x22ed69[_0xd78574(0x1ec)]));if(_0x22ed69['type']===_0xd78574(0x204))return console[_0xd78574(0x251)](_0xd78574(0x1da)),console[_0xd78574(0x251)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x22ed69[_0xd78574(0x208)]===_0xd78574(0x1f9))return console[_0xd78574(0x251)](_0xd78574(0x1cf)),console['error'](_0xd78574(0x240)),0x1;if(!_0x22ed69['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd78574(0x1dd));const _0x2dad67=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4e4f26[_0xd78574(0x235)][_0xd78574(0x1fd)](_0x22ed69[_0xd78574(0x1ec)],_0x22ed69[_0xd78574(0x1d8)]),{'verbose':_0x2d9660[_0xd78574(0x1e0)]});let _0x2d9d7f=_0x2dad67['data'];const _0x4748a3=resolveLimit(_0x2d9660[_0xd78574(0x201)],DEFAULT_DISPLAY_LIMIT),_0x567e8f=/\bLIMIT\s+\d+/i['test'](_0x2d9d7f);!_0x567e8f&&(_0x2d9d7f=_0x2d9d7f[_0xd78574(0x248)]()[_0xd78574(0x230)](/;+$/,''),_0x2d9d7f=_0xd78574(0x1ca)+_0x2d9d7f+_0xd78574(0x218)+_0x4748a3);_0x2d9660[_0xd78574(0x1e0)]&&console[_0xd78574(0x251)](_0xd78574(0x1e3)+_0x2d9d7f);const _0x1186a0=await withProgressSpinner('Executing\x20segment\x20query...',async _0x681e7f=>{const _0x1dc083=_0xd78574,_0x53d8e9=await _0x4e4f26[_0x1dc083(0x22c)][_0x1dc083(0x23f)](_0x2d9d7f,{'catalog':'td','schema':_0x1dc083(0x20a),'onJobId':_0x168d2d=>{const _0x27d291=_0x1dc083;_0x681e7f[_0x27d291(0x1d9)](_0x168d2d);}});return _0x53d8e9;},{'verbose':_0x2d9660[_0xd78574(0x1e0)]}),_0x4611f9=_0x1186a0['data'],_0xcf2b53=_0x4611f9[_0xd78574(0x257)]?_0xd78574(0x1e7)+_0x4611f9[_0xd78574(0x257)]+']':'';return console[_0xd78574(0x251)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x4611f9[_0xd78574(0x22a)][_0xd78574(0x1e1)][_0xd78574(0x1f4)]()+_0xd78574(0x1c1)+(_0xd78574(0x20b)+formatElapsed(_0x4611f9['stats'][_0xd78574(0x25b)])+_0xcf2b53)),await handleQueryOutput(_0x4611f9,_0x2d9660),0x0;}catch(_0x1adaea){if(_0x1adaea instanceof SDKError)return console['error'](_0xd78574(0x22e)+_0x1adaea[_0xd78574(0x1f6)]+']'),console[_0xd78574(0x251)]('\x0a'+_0x1adaea['message']),0x1;throw _0x1adaea;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]=a27_0x2cbd8e(0x237);[a27_0x2cbd8e(0x22d)]=a27_0x2cbd8e(0x1bf);async[a27_0x2cbd8e(0x23f)](_0x3bacbb){const _0x77cfd6=a27_0x2cbd8e,{options:_0x2db9ab,args:_0x2728c0,tdx:_0x458e63}=_0x3bacbb;if(_0x2728c0['length']===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x77cfd6(0x251)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x5c5c35=_0x2728c0[0x0];try{_0x2db9ab['verbose']&&(console['error'](_0x77cfd6(0x209)+_0x2db9ab[_0x77cfd6(0x1fc)]),console[_0x77cfd6(0x251)]('Parent\x20name:\x20'+_0x5c5c35));const _0x30af15=await withSpinner(_0x77cfd6(0x1f5)+_0x5c5c35+'\x27...',()=>_0x458e63['segment'][_0x77cfd6(0x23a)](_0x5c5c35),{'verbose':_0x2db9ab[_0x77cfd6(0x1e0)]}),_0x1f2bb1=_0x30af15[_0x77cfd6(0x22f)];_0x2db9ab['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x1f2bb1);const _0x509307=await withSpinner(_0x77cfd6(0x1f0)+_0x5c5c35+'\x27...',()=>_0x458e63['segment']['listFolders'](_0x1f2bb1),{'verbose':_0x2db9ab[_0x77cfd6(0x1e0)]}),_0x5d4559=_0x509307['data'];return console['error'](_0x77cfd6(0x258)+_0x5d4559['length']+_0x77cfd6(0x23b)+(_0x5d4559['length']!==0x1?'s':'')),await handleSDKOutput(_0x5d4559,_0x2db9ab),0x0;}catch(_0x511c22){if(_0x511c22 instanceof SDKError)return console['error'](_0x77cfd6(0x1c7)+_0x511c22[_0x77cfd6(0x247)]),_0x511c22[_0x77cfd6(0x21a)]&&console[_0x77cfd6(0x251)](_0x77cfd6(0x1be)+_0x511c22['cause']),0x1;throw _0x511c22;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a27_0x2cbd8e(0x1ce);['description']=a27_0x2cbd8e(0x1dc);async['execute'](_0x3ecf97){const _0x37e18e=a27_0x2cbd8e,{options:_0x3cd6a2,args:_0x117e19,tdx:_0x2b9320}=_0x3ecf97;if(_0x117e19[_0x37e18e(0x203)]===0x0)return console[_0x37e18e(0x251)](_0x37e18e(0x1e4)),console[_0x37e18e(0x251)](_0x37e18e(0x1cd)),0x1;try{const {parentId:_0x14b60c,childId:_0x3a4169}=parseSegmentRef(_0x117e19[0x0]);_0x3cd6a2[_0x37e18e(0x1e0)]&&(console[_0x37e18e(0x251)](_0x37e18e(0x209)+_0x3cd6a2[_0x37e18e(0x1fc)]),console[_0x37e18e(0x251)]('Parent\x20name:\x20'+_0x14b60c),_0x3a4169&&console[_0x37e18e(0x251)](_0x37e18e(0x253)+_0x3a4169));if(!_0x3a4169)return console[_0x37e18e(0x251)](_0x37e18e(0x259)),0x1;const _0x3f54c4=await withSpinner(_0x37e18e(0x1f5)+_0x14b60c+_0x37e18e(0x255),()=>_0x2b9320['segment'][_0x37e18e(0x23a)](_0x14b60c),{'verbose':_0x3cd6a2[_0x37e18e(0x1e0)]}),_0x385f16=_0x3f54c4[_0x37e18e(0x22f)];_0x3cd6a2['verbose']&&console[_0x37e18e(0x251)]('Resolved\x20parent\x20ID:\x20'+_0x385f16);const _0x3ce489=await withSpinner(_0x37e18e(0x1f8)+_0x3a4169+_0x37e18e(0x255),()=>_0x2b9320[_0x37e18e(0x235)]['resolveFolderId'](_0x385f16,_0x3a4169),{'verbose':_0x3cd6a2[_0x37e18e(0x1e0)]}),_0x5cf521=_0x3ce489[_0x37e18e(0x22f)];_0x3cd6a2[_0x37e18e(0x1e0)]&&console[_0x37e18e(0x251)](_0x37e18e(0x1cb)+_0x5cf521);const _0x23779d=await withSpinner('Fetching\x20folder\x20\x27'+_0x3a4169+_0x37e18e(0x255),()=>_0x2b9320[_0x37e18e(0x235)][_0x37e18e(0x224)](_0x5cf521),{'verbose':_0x3cd6a2[_0x37e18e(0x1e0)]});return await handleSDKOutput([_0x23779d[_0x37e18e(0x22f)]],_0x3cd6a2),0x0;}catch(_0x1003cb){if(_0x1003cb instanceof SDKError)return console['error'](_0x37e18e(0x1c7)+_0x1003cb[_0x37e18e(0x247)]),_0x1003cb[_0x37e18e(0x21a)]&&console[_0x37e18e(0x251)]('\x20\x20Cause:\x20'+_0x1003cb[_0x37e18e(0x21a)]),0x1;throw _0x1003cb;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]=a27_0x2cbd8e(0x1d1);['description']=a27_0x2cbd8e(0x22b);async[a27_0x2cbd8e(0x23f)](_0x425a9f){const _0x54daa4=a27_0x2cbd8e,{options:_0x1b67ef,args:_0xafbf6,tdx:_0x511644}=_0x425a9f,_0x528615=_0xafbf6[0x0];if(!_0x528615)return console[_0x54daa4(0x251)](_0x54daa4(0x225)),console[_0x54daa4(0x251)](_0x54daa4(0x246)),console[_0x54daa4(0x251)](_0x54daa4(0x250)),console[_0x54daa4(0x251)]('Examples:'),console['error'](_0x54daa4(0x226)),console[_0x54daa4(0x251)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x527da1=_0x1b67ef[_0x54daa4(0x202)],_0x2a1f00=await resolveSegmentTarget(_0x528615,_0x527da1,_0x1b67ef[_0x54daa4(0x1e0)]);_0x1b67ef[_0x54daa4(0x1e0)]&&console[_0x54daa4(0x251)](_0x54daa4(0x213)+_0x2a1f00);const _0x3ac45d=await withSpinner('Resolving\x20\x27'+_0x528615+_0x54daa4(0x255),()=>_0x511644[_0x54daa4(0x235)]['resolvePathToResource'](_0x2a1f00),{'verbose':_0x1b67ef[_0x54daa4(0x1e0)]}),_0x3b2188=_0x3ac45d[_0x54daa4(0x22f)];_0x1b67ef[_0x54daa4(0x1e0)]&&(console[_0x54daa4(0x251)](_0x54daa4(0x24b)+_0x3b2188[_0x54daa4(0x208)]),console[_0x54daa4(0x251)](_0x54daa4(0x215)+_0x3b2188[_0x54daa4(0x1ec)]));if(_0x3b2188[_0x54daa4(0x208)]==='folder')return console[_0x54daa4(0x251)](_0x54daa4(0x1f3)),console[_0x54daa4(0x251)](_0x54daa4(0x1ed)),0x1;if(_0x3b2188[_0x54daa4(0x208)]===_0x54daa4(0x1f9))return console[_0x54daa4(0x251)](_0x54daa4(0x236)),console['error'](_0x54daa4(0x221)),0x1;if(!_0x3b2188['segmentId'])throw new SDKError(ErrorCode[_0x54daa4(0x20f)],_0x54daa4(0x1dd));const _0x395203=await withSpinner(_0x54daa4(0x1eb),()=>_0x511644['segment'][_0x54daa4(0x1fd)](_0x3b2188[_0x54daa4(0x1ec)],_0x3b2188[_0x54daa4(0x1d8)]),{'verbose':_0x1b67ef[_0x54daa4(0x1e0)]}),_0x2b047e=_0x395203[_0x54daa4(0x22f)];return _0x1b67ef[_0x54daa4(0x211)]==='json'||_0x1b67ef[_0x54daa4(0x211)]==='jsonl'?await handleSDKOutput([{'sql':_0x2b047e}],_0x1b67ef):console[_0x54daa4(0x228)](_0x2b047e),0x0;}catch(_0x4551f7){if(_0x4551f7 instanceof SDKError)return console[_0x54daa4(0x251)]('Error:\x20'+_0x4551f7['message']),_0x4551f7[_0x54daa4(0x21a)]&&console[_0x54daa4(0x251)](_0x54daa4(0x1be)+_0x4551f7[_0x54daa4(0x21a)]),0x1;throw _0x4551f7;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]=a27_0x2cbd8e(0x20d);[a27_0x2cbd8e(0x22d)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x599ae0){const _0x6b9cdb=a27_0x2cbd8e,{options:_0x4d8574,args:_0x83bdd9,tdx:_0x25e165}=_0x599ae0,_0x24634a=_0x4d8574;if(_0x83bdd9['length']<0x2)return console[_0x6b9cdb(0x251)](_0x6b9cdb(0x207)),console[_0x6b9cdb(0x251)](_0x6b9cdb(0x20e)),0x1;const _0x1771dc=_0x83bdd9[0x0],_0x401e58=_0x83bdd9[0x1];_0x24634a[_0x6b9cdb(0x1e0)]&&(console[_0x6b9cdb(0x251)](_0x6b9cdb(0x209)+_0x24634a[_0x6b9cdb(0x1fc)]),console[_0x6b9cdb(0x251)]('Parent\x20segment:\x20'+_0x1771dc),console[_0x6b9cdb(0x251)](_0x6b9cdb(0x253)+_0x401e58));let _0x36aeca;if(_0x24634a[_0x6b9cdb(0x21e)]){const _0x3a4000=_0x24634a[_0x6b9cdb(0x21e)],_0x2dbba3=await withSpinner(_0x6b9cdb(0x1f5)+_0x1771dc+'\x27...',()=>_0x25e165['segment'][_0x6b9cdb(0x23a)](_0x1771dc),{'verbose':_0x24634a[_0x6b9cdb(0x1e0)]}),_0x146e65=_0x2dbba3['data'],_0x221021=await withSpinner(_0x6b9cdb(0x205)+_0x3a4000+'\x27...',()=>_0x25e165[_0x6b9cdb(0x235)][_0x6b9cdb(0x234)](_0x146e65,_0x3a4000),{'verbose':_0x24634a[_0x6b9cdb(0x1e0)]});_0x36aeca=_0x221021[_0x6b9cdb(0x22f)],_0x24634a[_0x6b9cdb(0x1e0)]&&console[_0x6b9cdb(0x251)](_0x6b9cdb(0x231)+_0x36aeca);}const _0x32a16a={'name':_0x401e58,'description':_0x24634a['description'],'parentFolderId':_0x36aeca},_0x2e18a9=await withSpinner(_0x6b9cdb(0x214)+_0x401e58+_0x6b9cdb(0x255),()=>_0x25e165[_0x6b9cdb(0x235)]['createFolder'](_0x1771dc,_0x32a16a),{'verbose':_0x24634a[_0x6b9cdb(0x1e0)]}),_0x2df6c5=_0x2e18a9['data'];return console[_0x6b9cdb(0x251)](_0x6b9cdb(0x232)+_0x2df6c5[_0x6b9cdb(0x24e)]+_0x6b9cdb(0x21f)+_0x2df6c5['id']),await handleSDKOutput([_0x2df6c5],_0x24634a),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]=a27_0x2cbd8e(0x1ea);[a27_0x2cbd8e(0x22d)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x5c5575){const _0x894c78=a27_0x2cbd8e,{options:_0x47441b,args:_0x1d5368,tdx:_0x29950}=_0x5c5575,_0xc253d3=_0x1d5368[0x0];if(!_0xc253d3)return console['error'](_0x894c78(0x256)),console[_0x894c78(0x251)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x894c78(0x251)](_0x894c78(0x1fe)),console[_0x894c78(0x251)](_0x894c78(0x1ef)),console[_0x894c78(0x251)](_0x894c78(0x1f7)),console[_0x894c78(0x251)](_0x894c78(0x1fa)),console['error'](_0x894c78(0x24c)),console[_0x894c78(0x251)](_0x894c78(0x1c6)),console['error'](_0x894c78(0x227)),console[_0x894c78(0x251)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x20cfd3=_0x47441b['parentSegment'],_0x501375=await resolveSegmentTarget(_0xc253d3,_0x20cfd3,_0x47441b[_0x894c78(0x1e0)]);_0x47441b[_0x894c78(0x1e0)]&&console[_0x894c78(0x251)](_0x894c78(0x213)+_0x501375);const _0x351de2=await withSpinner(_0x894c78(0x1c5)+_0xc253d3+_0x894c78(0x255),()=>_0x29950['segment'][_0x894c78(0x20c)](_0x501375),{'verbose':_0x47441b[_0x894c78(0x1e0)]}),_0x5ce147=_0x351de2[_0x894c78(0x22f)];_0x47441b[_0x894c78(0x1e0)]&&(console['error']('Resolved\x20type:\x20'+_0x5ce147[_0x894c78(0x208)]),console[_0x894c78(0x251)](_0x894c78(0x215)+_0x5ce147[_0x894c78(0x1ec)]),_0x5ce147['folderId']&&console[_0x894c78(0x251)]('Folder\x20ID:\x20'+_0x5ce147[_0x894c78(0x212)]),_0x5ce147[_0x894c78(0x1d8)]&&console[_0x894c78(0x251)](_0x894c78(0x21b)+_0x5ce147['segmentId']));if(_0x47441b[_0x894c78(0x1c0)]){if(_0x5ce147['type']===_0x894c78(0x204))return console[_0x894c78(0x251)](_0x894c78(0x241)),0x1;if(_0x5ce147[_0x894c78(0x208)]===_0x894c78(0x1f9))return console[_0x894c78(0x251)](_0x894c78(0x220)),console[_0x894c78(0x251)](_0x894c78(0x219)),0x1;if(!_0x5ce147[_0x894c78(0x1d8)])throw new SDKError(ErrorCode[_0x894c78(0x20f)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3b9c16=getConsoleNextUrl(_0x47441b[_0x894c78(0x1fc)],'/app/ps/'+_0x5ce147[_0x894c78(0x1ec)]+'/e/'+_0x5ce147[_0x894c78(0x1d8)]);return console['error'](a27_0xa1272f[_0x894c78(0x223)]('✔')+_0x894c78(0x243)+a27_0xa1272f[_0x894c78(0x1ff)](_0x3b9c16)),openBrowser(_0x3b9c16),0x0;}if(_0x5ce147[_0x894c78(0x208)]===_0x894c78(0x204)){if(!_0x5ce147[_0x894c78(0x212)])throw new SDKError(ErrorCode[_0x894c78(0x249)],_0x894c78(0x1e5));const _0x5dc572=await withSpinner(_0x894c78(0x21c),()=>_0x29950[_0x894c78(0x235)][_0x894c78(0x224)](_0x5ce147[_0x894c78(0x212)]),{'verbose':_0x47441b[_0x894c78(0x1e0)]});await handleSingleObjectOutput(_0x5dc572[_0x894c78(0x22f)],_0x47441b);}else{if(_0x5ce147['type']==='segment'){if(!_0x5ce147[_0x894c78(0x1d8)])throw new SDKError(ErrorCode[_0x894c78(0x20f)],_0x894c78(0x1dd));const _0x5f1e40=await withSpinner(_0x894c78(0x24d),()=>_0x29950[_0x894c78(0x235)][_0x894c78(0x1cc)](_0x5ce147[_0x894c78(0x1ec)],_0x5ce147[_0x894c78(0x1d8)]),{'verbose':_0x47441b[_0x894c78(0x1e0)]}),_0xa83bb3=getConsoleNextUrl(_0x47441b['site'],_0x894c78(0x21d)+_0x5ce147[_0x894c78(0x1ec)]+_0x894c78(0x1f2)+_0x5ce147[_0x894c78(0x1d8)]),_0x28a584=_0x5f1e40[_0x894c78(0x22f)];_0x28a584[_0x894c78(0x222)]=_0xa83bb3,await handleSingleObjectOutput(_0x28a584,_0x47441b);}else return console[_0x894c78(0x251)](_0x894c78(0x206)),console['error'](_0x894c78(0x1d6)),0x1;}return 0x0;}catch(_0x1fe771){if(_0x1fe771 instanceof SDKError)return console[_0x894c78(0x251)](_0x894c78(0x1c7)+_0x1fe771[_0x894c78(0x247)]),_0x1fe771[_0x894c78(0x21a)]&&console[_0x894c78(0x251)]('\x20\x20Cause:\x20'+_0x1fe771[_0x894c78(0x21a)]),0x1;throw _0x1fe771;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x2cbd8e(0x24e)]='segment:desc';[a27_0x2cbd8e(0x22d)]=a27_0x2cbd8e(0x210);async[a27_0x2cbd8e(0x23f)](_0x5d032c){const _0x544a14=a27_0x2cbd8e,{options:_0x454992,args:_0x3d3a1c,tdx:_0x58091c}=_0x5d032c,_0x2c0f2a=_0x3d3a1c[0x0];if(!_0x2c0f2a)return console[_0x544a14(0x251)](_0x544a14(0x225)),console[_0x544a14(0x251)](_0x544a14(0x23c)),console[_0x544a14(0x251)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x544a14(0x251)]('Examples:'),console[_0x544a14(0x251)](_0x544a14(0x229)),console[_0x544a14(0x251)](_0x544a14(0x1d0)),0x1;try{const _0x596ed6=_0x454992[_0x544a14(0x202)],_0x25af62=await resolveSegmentTarget(_0x2c0f2a,_0x596ed6,_0x454992[_0x544a14(0x1e0)]);_0x454992['verbose']&&console['error'](_0x544a14(0x213)+_0x25af62);const _0x2b8d43=await withSpinner(_0x544a14(0x1c5)+_0x2c0f2a+_0x544a14(0x255),()=>_0x58091c['segment'][_0x544a14(0x20c)](_0x25af62),{'verbose':_0x454992[_0x544a14(0x1e0)]}),_0x181bd8=_0x2b8d43[_0x544a14(0x22f)];_0x454992[_0x544a14(0x1e0)]&&(console['error']('Resolved\x20type:\x20'+_0x181bd8['type']),console[_0x544a14(0x251)](_0x544a14(0x215)+_0x181bd8[_0x544a14(0x1ec)]));if(_0x181bd8[_0x544a14(0x208)]===_0x544a14(0x204))return console[_0x544a14(0x251)](_0x544a14(0x1c8)),console[_0x544a14(0x251)](_0x544a14(0x1ed)),0x1;if(_0x181bd8['type']===_0x544a14(0x1f9))return console[_0x544a14(0x251)](_0x544a14(0x242)),console[_0x544a14(0x251)](_0x544a14(0x25a)),0x1;if(!_0x181bd8['segmentId'])throw new SDKError(ErrorCode[_0x544a14(0x20f)],_0x544a14(0x1dd));const _0x5d1e8b=await withSpinner(_0x544a14(0x1eb),()=>_0x58091c[_0x544a14(0x235)][_0x544a14(0x1fd)](_0x181bd8[_0x544a14(0x1ec)],_0x181bd8['segmentId']),{'verbose':_0x454992[_0x544a14(0x1e0)]}),_0x36fefa=_0x5d1e8b[_0x544a14(0x22f)],_0x2cbd4a=await executeSchemaQuery(_0x36fefa,_0x58091c,_0x454992);return await handleQueryOutput(_0x2cbd4a,_0x454992),0x0;}catch(_0xa55ece){if(_0xa55ece instanceof SDKError)return console[_0x544a14(0x251)]('Error:\x20'+_0xa55ece['message']),_0xa55ece['cause']&&console[_0x544a14(0x251)](_0x544a14(0x1be)+_0xa55ece['cause']),0x1;throw _0xa55ece;}}}
|
|
1
|
+
function a27_0x2bc9(){const _0x1e271f=['Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Show\x20folder\x20or\x20child\x20segment\x20details','SEGMENT_FOLDER_NOT_FOUND','Use:\x20tdx\x20ps\x20view','resolveFolderId','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x27...','parentFolder','Resolving\x20\x27','112110dMkkge','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','cause','INVALID_ARGUMENT','format','data','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','length','Fetching\x20SQL\x20for\x20segment...','2008128eaTUmV','Resolved\x20type:\x20','Examples:','SELECT\x20*\x20FROM\x20(\x0a','SEGMENT_NOT_FOUND','resolvePathToResource','segment:folder:show','folderPath','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','information_schema','getSegmentSQL','segmentName','stats','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','jobId','Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20Folder\x20path:\x20','Resolving\x20path\x20\x27','test','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','web','8652TyfeCF','json','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','verbose','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20sql','resolveParentId','Error:\x20Path\x20or\x20name\x20is\x20required','Target\x20path:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Get\x20SQL\x20query\x20for\x20child\x20segment','folder','type','Segment\x20ID:\x20','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20show\x20<name>','description','in\x20','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','name','416204HzoZeZ','jsonl','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','✖\x20Query\x20failed\x20[','parent','getSegment','Resolved\x20relative\x20path\x20to:\x20','Show\x20segment\x20folder\x20details','Usage:\x20tdx\x20sg\x20desc\x20<name>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Cause:\x20','execute','Listing\x20folders\x20for\x20parent\x20\x27','setJobId','includes','Resolving\x20parent\x20segment\x20\x27','parentId','133240lqYoxf','Usage:\x20tdx\x20segment\x20describe\x20<path>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20segment\x20details...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20folder\x20details...','Parent\x20ID:\x20','fullPath','error','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:create','replace','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','parentSegment','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20Parent\x20segment:\x20','segment:sql','/e/','Usage:\x20tdx\x20sg\x20sql\x20<name>','url','toLocaleString','segment:folder:list','Error:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','segmentId','Parent\x20name:\x20','log','Resolved\x20YAML\x20file:\x20','Parent\x20segment:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','segment:desc','Use:\x20tdx\x20ps\x20show','getFolder','Folder\x20name:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolving\x20parent\x20folder\x20\x27','site','\x20Opening\x20','134907ATFEbL','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','processedRows','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Resolved\x20parent\x20folder\x20ID:\x20','988308UKZnJk','code','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Site:\x20','elapsedTimeMillis','\x20folder','message','limit','\x20\x20Segment\x20name:\x20','segment','/app/ps/'];a27_0x2bc9=function(){return _0x1e271f;};return a27_0x2bc9();}const a27_0x551ed1=a27_0x3cbe;(function(_0x3c2689,_0x5801ca){const _0x37ba10=a27_0x3cbe,_0x4fb672=_0x3c2689();while(!![]){try{const _0x4aed9c=-parseInt(_0x37ba10(0x128))/0x1+parseInt(_0x37ba10(0x183))/0x2+-parseInt(_0x37ba10(0x163))/0x3+parseInt(_0x37ba10(0x18c))/0x4+parseInt(_0x37ba10(0x13c))/0x5+parseInt(_0x37ba10(0x16c))/0x6+parseInt(_0x37ba10(0x112))/0x7;if(_0x4aed9c===_0x5801ca)break;else _0x4fb672['push'](_0x4fb672['shift']());}catch(_0x541e23){_0x4fb672['push'](_0x4fb672['shift']());}}}(a27_0x2bc9,0x46aec));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';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a27_0x3cbe(_0xc5b13a,_0x5c97ec){_0xc5b13a=_0xc5b13a-0x104;const _0x2bc95e=a27_0x2bc9();let _0x3cbe8d=_0x2bc95e[_0xc5b13a];return _0x3cbe8d;}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_0x516e33 from'chalk';async function resolveSegmentTarget(_0x379574,_0x396103,_0x480cf2){const _0x4ce04f=a27_0x3cbe;if(isYamlFilePath(_0x379574))try{const _0x44b54f=await resolveYamlFilePath(_0x379574);return _0x480cf2&&(console[_0x4ce04f(0x144)](_0x4ce04f(0x158)+_0x379574),console[_0x4ce04f(0x144)](_0x4ce04f(0x14c)+_0x44b54f[_0x4ce04f(0x14a)]),console['error'](_0x4ce04f(0x174)+_0x44b54f[_0x4ce04f(0x107)]),console[_0x4ce04f(0x144)](_0x4ce04f(0x10d)+(_0x44b54f[_0x4ce04f(0x193)]||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x44b54f[_0x4ce04f(0x143)])),_0x44b54f[_0x4ce04f(0x143)];}catch(_0x44e08b){throw new SDKError(ErrorCode[_0x4ce04f(0x186)],_0x4ce04f(0x133)+_0x44e08b[_0x4ce04f(0x172)]);}if(!_0x396103)throw new SDKError(ErrorCode[_0x4ce04f(0x186)],_0x4ce04f(0x149));return _0x396103+'/'+_0x379574;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x551ed1(0x127)]='segment:describe';[a27_0x551ed1(0x123)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x551ed1(0x136)](_0x3e4493){const _0x5d65bb=a27_0x551ed1,{options:_0x42929c,args:_0x12d695,tdx:_0x40b18f}=_0x3e4493,_0x549181=_0x12d695[0x0],_0x558aa2=!_0x549181&&!!_0x42929c[_0x5d65bb(0x14a)],_0x3c5b69=_0x549181||_0x42929c['parentSegment'];if(!_0x3c5b69)return console['error'](_0x5d65bb(0x119)),console[_0x5d65bb(0x144)](_0x5d65bb(0x13d)),console[_0x5d65bb(0x144)]('Examples:'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x5d65bb(0x144)](_0x5d65bb(0x145)),console['error'](_0x5d65bb(0x14b)),console[_0x5d65bb(0x144)](_0x5d65bb(0x17e)),0x1;try{const _0xfe3053=_0x42929c['segmentPath'];let _0x95690a=_0x3c5b69;!_0x558aa2&&_0xfe3053&&!_0x3c5b69[_0x5d65bb(0x139)]('/')&&(_0x95690a=_0xfe3053+'/'+_0x3c5b69,_0x42929c['verbose']&&console[_0x5d65bb(0x144)](_0x5d65bb(0x130)+_0x95690a));const _0x21f52d=await withSpinner(_0x5d65bb(0x10e)+_0x95690a+_0x5d65bb(0x180),()=>_0x40b18f[_0x5d65bb(0x175)]['resolvePathToResource'](_0x95690a),{'verbose':_0x42929c[_0x5d65bb(0x115)]}),_0x47d66d=_0x21f52d['data'];_0x42929c[_0x5d65bb(0x115)]&&(console['error'](_0x5d65bb(0x18d)+_0x47d66d[_0x5d65bb(0x11e)]),console[_0x5d65bb(0x144)]('Parent\x20ID:\x20'+_0x47d66d['parentId']),_0x47d66d[_0x5d65bb(0x169)]&&console[_0x5d65bb(0x144)]('Folder\x20ID:\x20'+_0x47d66d['folderId']),_0x47d66d[_0x5d65bb(0x155)]&&console[_0x5d65bb(0x144)](_0x5d65bb(0x11f)+_0x47d66d[_0x5d65bb(0x155)]));if(_0x47d66d['type']===_0x5d65bb(0x12e)){const _0x3a34a3=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x40b18f['segment']['getParent'](_0x47d66d[_0x5d65bb(0x13b)]),{'verbose':_0x42929c[_0x5d65bb(0x115)]});await handleSingleObjectOutput(_0x3a34a3[_0x5d65bb(0x188)],_0x42929c);}else{if(_0x47d66d[_0x5d65bb(0x11e)]==='folder'){if(!_0x47d66d['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x5d65bb(0x13e));const _0x406c75=await withSpinner('Fetching\x20folder\x20details...',()=>_0x40b18f[_0x5d65bb(0x175)]['getFolder'](_0x47d66d[_0x5d65bb(0x169)]),{'verbose':_0x42929c[_0x5d65bb(0x115)]});await handleSingleObjectOutput(_0x406c75[_0x5d65bb(0x188)],_0x42929c);}else{if(_0x47d66d['type']===_0x5d65bb(0x175)){if(!_0x47d66d[_0x5d65bb(0x155)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x12c65b=await withSpinner(_0x5d65bb(0x13f),()=>_0x40b18f['segment']['getSegment'](_0x47d66d[_0x5d65bb(0x13b)],_0x47d66d[_0x5d65bb(0x155)]),{'verbose':_0x42929c[_0x5d65bb(0x115)]});await handleSingleObjectOutput(_0x12c65b[_0x5d65bb(0x188)],_0x42929c);}}}return 0x0;}catch(_0x50e268){if(_0x50e268 instanceof SDKError)return console[_0x5d65bb(0x144)](_0x5d65bb(0x153)+_0x50e268[_0x5d65bb(0x172)]),_0x50e268[_0x5d65bb(0x185)]&&console[_0x5d65bb(0x144)](_0x5d65bb(0x135)+_0x50e268['cause']),0x1;throw _0x50e268;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x551ed1(0x127)]='segment:show';[a27_0x551ed1(0x123)]=a27_0x551ed1(0x12c);async['execute'](_0x131a69){const _0x3a3f3e=a27_0x551ed1,{options:_0x547a6f,args:_0x296da7,tdx:_0x8de6c}=_0x131a69,_0x532784=_0x296da7[0x0];if(!_0x532784)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3a3f3e(0x144)](_0x3a3f3e(0x122)),console['error'](_0x3a3f3e(0x10c)),console[_0x3a3f3e(0x144)]('Examples:'),console[_0x3a3f3e(0x144)](_0x3a3f3e(0x121)),console['error'](_0x3a3f3e(0x16e)),0x1;try{const _0x5d23f0=_0x547a6f[_0x3a3f3e(0x14a)],_0x7155d5=await resolveSegmentTarget(_0x532784,_0x5d23f0,_0x547a6f[_0x3a3f3e(0x115)]);_0x547a6f[_0x3a3f3e(0x115)]&&console[_0x3a3f3e(0x144)](_0x3a3f3e(0x11a)+_0x7155d5);const _0x35490e=await withSpinner('Resolving\x20\x27'+_0x532784+_0x3a3f3e(0x180),()=>_0x8de6c[_0x3a3f3e(0x175)][_0x3a3f3e(0x191)](_0x7155d5),{'verbose':_0x547a6f[_0x3a3f3e(0x115)]}),_0x57a1ca=_0x35490e[_0x3a3f3e(0x188)];_0x547a6f['verbose']&&(console[_0x3a3f3e(0x144)](_0x3a3f3e(0x18d)+_0x57a1ca[_0x3a3f3e(0x11e)]),console[_0x3a3f3e(0x144)](_0x3a3f3e(0x142)+_0x57a1ca[_0x3a3f3e(0x13b)]));if(_0x57a1ca[_0x3a3f3e(0x11e)]===_0x3a3f3e(0x11d))return console[_0x3a3f3e(0x144)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x3a3f3e(0x144)](_0x3a3f3e(0x189)),0x1;if(_0x57a1ca[_0x3a3f3e(0x11e)]==='parent')return console[_0x3a3f3e(0x144)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3a3f3e(0x144)](_0x3a3f3e(0x15c)),0x1;if(!_0x57a1ca['segmentId'])throw new SDKError(ErrorCode[_0x3a3f3e(0x190)],_0x3a3f3e(0x140));const _0x5500b7=await withSpinner(_0x3a3f3e(0x18b),()=>_0x8de6c[_0x3a3f3e(0x175)][_0x3a3f3e(0x106)](_0x57a1ca['parentId'],_0x57a1ca[_0x3a3f3e(0x155)]),{'verbose':_0x547a6f[_0x3a3f3e(0x115)]});let _0x2f6ef4=_0x5500b7[_0x3a3f3e(0x188)];const _0x21d627=resolveLimit(_0x547a6f[_0x3a3f3e(0x173)],DEFAULT_DISPLAY_LIMIT),_0x3e7b85=/\bLIMIT\s+\d+/i[_0x3a3f3e(0x10f)](_0x2f6ef4);!_0x3e7b85&&(_0x2f6ef4=_0x2f6ef4['trim']()[_0x3a3f3e(0x148)](/;+$/,''),_0x2f6ef4=_0x3a3f3e(0x18f)+_0x2f6ef4+_0x3a3f3e(0x168)+_0x21d627);_0x547a6f[_0x3a3f3e(0x115)]&&console[_0x3a3f3e(0x144)](_0x3a3f3e(0x125)+_0x2f6ef4);const _0x57f03a=await withProgressSpinner('Executing\x20segment\x20query...',async _0x25819c=>{const _0x3176d8=_0x3a3f3e,_0x38fd71=await _0x8de6c['query'][_0x3176d8(0x136)](_0x2f6ef4,{'catalog':'td','schema':_0x3176d8(0x105),'onJobId':_0x1a9246=>{const _0x53dbf1=_0x3176d8;_0x25819c[_0x53dbf1(0x138)](_0x1a9246);}});return _0x38fd71;},{'verbose':_0x547a6f[_0x3a3f3e(0x115)]}),_0x23f8e5=_0x57f03a[_0x3a3f3e(0x188)],_0x1e1a1b=_0x23f8e5[_0x3a3f3e(0x10a)]?'\x20[Job\x20ID:\x20'+_0x23f8e5[_0x3a3f3e(0x10a)]+']':'';return console[_0x3a3f3e(0x144)](_0x3a3f3e(0x17c)+_0x23f8e5[_0x3a3f3e(0x108)][_0x3a3f3e(0x165)][_0x3a3f3e(0x151)]()+'\x20rows\x20'+(_0x3a3f3e(0x124)+formatElapsed(_0x23f8e5[_0x3a3f3e(0x108)][_0x3a3f3e(0x170)])+_0x1e1a1b)),await handleQueryOutput(_0x23f8e5,_0x547a6f),0x0;}catch(_0x201fe2){if(_0x201fe2 instanceof SDKError)return console[_0x3a3f3e(0x144)](_0x3a3f3e(0x12d)+_0x201fe2[_0x3a3f3e(0x16d)]+']'),console[_0x3a3f3e(0x144)]('\x0a'+_0x201fe2[_0x3a3f3e(0x172)]),0x1;throw _0x201fe2;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x551ed1(0x127)]=a27_0x551ed1(0x152);[a27_0x551ed1(0x123)]=a27_0x551ed1(0x11b);async['execute'](_0x5e7f85){const _0x3c4f95=a27_0x551ed1,{options:_0x414baa,args:_0x246608,tdx:_0x31804e}=_0x5e7f85;if(_0x246608[_0x3c4f95(0x18a)]===0x0)return console[_0x3c4f95(0x144)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x3c4f95(0x144)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x569f1e=_0x246608[0x0];try{_0x414baa[_0x3c4f95(0x115)]&&(console['error']('Site:\x20'+_0x414baa[_0x3c4f95(0x161)]),console['error'](_0x3c4f95(0x156)+_0x569f1e));const _0x5ba234=await withSpinner(_0x3c4f95(0x13a)+_0x569f1e+_0x3c4f95(0x180),()=>_0x31804e[_0x3c4f95(0x175)][_0x3c4f95(0x118)](_0x569f1e),{'verbose':_0x414baa[_0x3c4f95(0x115)]}),_0xa11724=_0x5ba234[_0x3c4f95(0x188)];_0x414baa['verbose']&&console[_0x3c4f95(0x144)]('Resolved\x20parent\x20ID:\x20'+_0xa11724);const _0x4376ca=await withSpinner(_0x3c4f95(0x137)+_0x569f1e+_0x3c4f95(0x180),()=>_0x31804e[_0x3c4f95(0x175)]['listFolders'](_0xa11724),{'verbose':_0x414baa[_0x3c4f95(0x115)]}),_0x316553=_0x4376ca['data'];return console[_0x3c4f95(0x144)]('✔\x20Found\x20'+_0x316553[_0x3c4f95(0x18a)]+_0x3c4f95(0x171)+(_0x316553[_0x3c4f95(0x18a)]!==0x1?'s':'')),await handleSDKOutput(_0x316553,_0x414baa),0x0;}catch(_0x4d2a6e){if(_0x4d2a6e instanceof SDKError)return console[_0x3c4f95(0x144)](_0x3c4f95(0x153)+_0x4d2a6e[_0x3c4f95(0x172)]),_0x4d2a6e[_0x3c4f95(0x185)]&&console[_0x3c4f95(0x144)]('\x20\x20Cause:\x20'+_0x4d2a6e[_0x3c4f95(0x185)]),0x1;throw _0x4d2a6e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x551ed1(0x127)]=a27_0x551ed1(0x192);[a27_0x551ed1(0x123)]=a27_0x551ed1(0x131);async[a27_0x551ed1(0x136)](_0x4e506a){const _0x16d513=a27_0x551ed1,{options:_0x3ec530,args:_0x5ac205,tdx:_0x54ab84}=_0x4e506a;if(_0x5ac205[_0x16d513(0x18a)]===0x0)return console[_0x16d513(0x144)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x16d513(0x144)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0xf27dd7,childId:_0x508e0b}=parseSegmentRef(_0x5ac205[0x0]);_0x3ec530[_0x16d513(0x115)]&&(console['error'](_0x16d513(0x16f)+_0x3ec530[_0x16d513(0x161)]),console['error'](_0x16d513(0x156)+_0xf27dd7),_0x508e0b&&console[_0x16d513(0x144)](_0x16d513(0x15e)+_0x508e0b));if(!_0x508e0b)return console[_0x16d513(0x144)](_0x16d513(0x164)),0x1;const _0x21c090=await withSpinner(_0x16d513(0x13a)+_0xf27dd7+_0x16d513(0x180),()=>_0x54ab84['segment'][_0x16d513(0x118)](_0xf27dd7),{'verbose':_0x3ec530[_0x16d513(0x115)]}),_0x14321b=_0x21c090[_0x16d513(0x188)];_0x3ec530[_0x16d513(0x115)]&&console[_0x16d513(0x144)](_0x16d513(0x12b)+_0x14321b);const _0x13bc63=await withSpinner('Resolving\x20folder\x20\x27'+_0x508e0b+_0x16d513(0x180),()=>_0x54ab84[_0x16d513(0x175)][_0x16d513(0x17b)](_0x14321b,_0x508e0b),{'verbose':_0x3ec530[_0x16d513(0x115)]}),_0x2171b8=_0x13bc63[_0x16d513(0x188)];_0x3ec530[_0x16d513(0x115)]&&console[_0x16d513(0x144)]('Resolved\x20folder\x20ID:\x20'+_0x2171b8);const _0x5bcbe2=await withSpinner('Fetching\x20folder\x20\x27'+_0x508e0b+_0x16d513(0x180),()=>_0x54ab84[_0x16d513(0x175)][_0x16d513(0x15d)](_0x2171b8),{'verbose':_0x3ec530['verbose']});return await handleSDKOutput([_0x5bcbe2[_0x16d513(0x188)]],_0x3ec530),0x0;}catch(_0xe13bed){if(_0xe13bed instanceof SDKError)return console[_0x16d513(0x144)]('Error:\x20'+_0xe13bed[_0x16d513(0x172)]),_0xe13bed[_0x16d513(0x185)]&&console['error'](_0x16d513(0x135)+_0xe13bed[_0x16d513(0x185)]),0x1;throw _0xe13bed;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x551ed1(0x127)]=a27_0x551ed1(0x14d);[a27_0x551ed1(0x123)]=a27_0x551ed1(0x11c);async[a27_0x551ed1(0x136)](_0x1c5c0a){const _0x48c81b=a27_0x551ed1,{options:_0x58ff15,args:_0x2d19da,tdx:_0x452018}=_0x1c5c0a,_0x5bedcb=_0x2d19da[0x0];if(!_0x5bedcb)return console[_0x48c81b(0x144)](_0x48c81b(0x154)),console[_0x48c81b(0x144)](_0x48c81b(0x14f)),console[_0x48c81b(0x144)](_0x48c81b(0x16a)),console[_0x48c81b(0x144)](_0x48c81b(0x18e)),console[_0x48c81b(0x144)](_0x48c81b(0x17d)),console[_0x48c81b(0x144)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x574665=_0x58ff15[_0x48c81b(0x14a)],_0x9019a3=await resolveSegmentTarget(_0x5bedcb,_0x574665,_0x58ff15[_0x48c81b(0x115)]);_0x58ff15['verbose']&&console[_0x48c81b(0x144)](_0x48c81b(0x11a)+_0x9019a3);const _0x4d7181=await withSpinner(_0x48c81b(0x182)+_0x5bedcb+_0x48c81b(0x180),()=>_0x452018[_0x48c81b(0x175)][_0x48c81b(0x191)](_0x9019a3),{'verbose':_0x58ff15[_0x48c81b(0x115)]}),_0x5c2635=_0x4d7181[_0x48c81b(0x188)];_0x58ff15[_0x48c81b(0x115)]&&(console[_0x48c81b(0x144)](_0x48c81b(0x18d)+_0x5c2635[_0x48c81b(0x11e)]),console[_0x48c81b(0x144)]('Parent\x20ID:\x20'+_0x5c2635['parentId']));if(_0x5c2635[_0x48c81b(0x11e)]==='folder')return console[_0x48c81b(0x144)](_0x48c81b(0x114)),console['error'](_0x48c81b(0x184)),0x1;if(_0x5c2635['type']===_0x48c81b(0x12e))return console[_0x48c81b(0x144)](_0x48c81b(0x104)),console['error'](_0x48c81b(0x117)),0x1;if(!_0x5c2635[_0x48c81b(0x155)])throw new SDKError(ErrorCode[_0x48c81b(0x190)],_0x48c81b(0x140));const _0x5d6cde=await withSpinner(_0x48c81b(0x18b),()=>_0x452018['segment'][_0x48c81b(0x106)](_0x5c2635[_0x48c81b(0x13b)],_0x5c2635[_0x48c81b(0x155)]),{'verbose':_0x58ff15[_0x48c81b(0x115)]}),_0x339757=_0x5d6cde[_0x48c81b(0x188)];return _0x58ff15[_0x48c81b(0x187)]===_0x48c81b(0x113)||_0x58ff15[_0x48c81b(0x187)]===_0x48c81b(0x129)?await handleSDKOutput([{'sql':_0x339757}],_0x58ff15):console[_0x48c81b(0x157)](_0x339757),0x0;}catch(_0x2c3dd5){if(_0x2c3dd5 instanceof SDKError)return console[_0x48c81b(0x144)](_0x48c81b(0x153)+_0x2c3dd5[_0x48c81b(0x172)]),_0x2c3dd5[_0x48c81b(0x185)]&&console['error'](_0x48c81b(0x135)+_0x2c3dd5['cause']),0x1;throw _0x2c3dd5;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x551ed1(0x127)]=a27_0x551ed1(0x147);[a27_0x551ed1(0x123)]=a27_0x551ed1(0x120);async[a27_0x551ed1(0x136)](_0x327be0){const _0x2e4b16=a27_0x551ed1,{options:_0x39f175,args:_0x239e75,tdx:_0x44e853}=_0x327be0,_0x40fb90=_0x39f175;if(_0x239e75[_0x2e4b16(0x18a)]<0x2)return console['error'](_0x2e4b16(0x17f)),console['error'](_0x2e4b16(0x110)),0x1;const _0x27292b=_0x239e75[0x0],_0x190471=_0x239e75[0x1];_0x40fb90[_0x2e4b16(0x115)]&&(console[_0x2e4b16(0x144)](_0x2e4b16(0x16f)+_0x40fb90[_0x2e4b16(0x161)]),console[_0x2e4b16(0x144)](_0x2e4b16(0x159)+_0x27292b),console['error'](_0x2e4b16(0x15e)+_0x190471));let _0x4dc5e3;if(_0x40fb90[_0x2e4b16(0x181)]){const _0x18cbda=_0x40fb90['parentFolder'],_0x682ec9=await withSpinner(_0x2e4b16(0x13a)+_0x27292b+'\x27...',()=>_0x44e853[_0x2e4b16(0x175)]['resolveParentId'](_0x27292b),{'verbose':_0x40fb90[_0x2e4b16(0x115)]}),_0x3d1005=_0x682ec9['data'],_0x4eadf9=await withSpinner(_0x2e4b16(0x160)+_0x18cbda+_0x2e4b16(0x180),()=>_0x44e853['segment']['resolveFolderId'](_0x3d1005,_0x18cbda),{'verbose':_0x40fb90['verbose']});_0x4dc5e3=_0x4eadf9[_0x2e4b16(0x188)],_0x40fb90['verbose']&&console[_0x2e4b16(0x144)](_0x2e4b16(0x16b)+_0x4dc5e3);}const _0x1b0a07={'name':_0x190471,'description':_0x40fb90[_0x2e4b16(0x123)],'parentFolderId':_0x4dc5e3},_0x524bef=await withSpinner('Creating\x20folder\x20\x27'+_0x190471+_0x2e4b16(0x180),()=>_0x44e853[_0x2e4b16(0x175)]['createFolder'](_0x27292b,_0x1b0a07),{'verbose':_0x40fb90[_0x2e4b16(0x115)]}),_0x1c948d=_0x524bef[_0x2e4b16(0x188)];return console[_0x2e4b16(0x144)]('✔\x20Created\x20folder\x20\x27'+_0x1c948d[_0x2e4b16(0x127)]+_0x2e4b16(0x12a)+_0x1c948d['id']),await handleSDKOutput([_0x1c948d],_0x40fb90),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x551ed1(0x127)]='segment:view';[a27_0x551ed1(0x123)]=a27_0x551ed1(0x178);async[a27_0x551ed1(0x136)](_0x4271ed){const _0x3c7cc0=a27_0x551ed1,{options:_0x47dfa1,args:_0x1a9f0b,tdx:_0x43e7f1}=_0x4271ed,_0x4a92bf=_0x1a9f0b[0x0];if(!_0x4a92bf)return console['error'](_0x3c7cc0(0x134)),console['error'](_0x3c7cc0(0x167)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x3c7cc0(0x10b)),console[_0x3c7cc0(0x144)](_0x3c7cc0(0x15f)),console['error']('Examples:'),console[_0x3c7cc0(0x144)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x3c7cc0(0x144)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3c7cc0(0x144)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5a567a=_0x47dfa1[_0x3c7cc0(0x14a)],_0x3eecbd=await resolveSegmentTarget(_0x4a92bf,_0x5a567a,_0x47dfa1[_0x3c7cc0(0x115)]);_0x47dfa1[_0x3c7cc0(0x115)]&&console['error'](_0x3c7cc0(0x11a)+_0x3eecbd);const _0xf5f0d7=await withSpinner('Resolving\x20\x27'+_0x4a92bf+'\x27...',()=>_0x43e7f1[_0x3c7cc0(0x175)]['resolvePathToResource'](_0x3eecbd),{'verbose':_0x47dfa1[_0x3c7cc0(0x115)]}),_0x55cdcb=_0xf5f0d7[_0x3c7cc0(0x188)];_0x47dfa1[_0x3c7cc0(0x115)]&&(console[_0x3c7cc0(0x144)]('Resolved\x20type:\x20'+_0x55cdcb[_0x3c7cc0(0x11e)]),console[_0x3c7cc0(0x144)]('Parent\x20ID:\x20'+_0x55cdcb[_0x3c7cc0(0x13b)]),_0x55cdcb[_0x3c7cc0(0x169)]&&console[_0x3c7cc0(0x144)]('Folder\x20ID:\x20'+_0x55cdcb[_0x3c7cc0(0x169)]),_0x55cdcb['segmentId']&&console[_0x3c7cc0(0x144)](_0x3c7cc0(0x11f)+_0x55cdcb[_0x3c7cc0(0x155)]));if(_0x47dfa1[_0x3c7cc0(0x111)]){if(_0x55cdcb[_0x3c7cc0(0x11e)]===_0x3c7cc0(0x11d))return console[_0x3c7cc0(0x144)](_0x3c7cc0(0x109)),0x1;if(_0x55cdcb[_0x3c7cc0(0x11e)]===_0x3c7cc0(0x12e))return console['error'](_0x3c7cc0(0x146)),console[_0x3c7cc0(0x144)](_0x3c7cc0(0x194)),0x1;if(!_0x55cdcb[_0x3c7cc0(0x155)])throw new SDKError(ErrorCode[_0x3c7cc0(0x190)],_0x3c7cc0(0x140));const _0x45af98=getConsoleNextUrl(_0x47dfa1[_0x3c7cc0(0x161)],_0x3c7cc0(0x176)+_0x55cdcb['parentId']+'/e/'+_0x55cdcb['segmentId']);return console[_0x3c7cc0(0x144)](a27_0x516e33['green']('✔')+_0x3c7cc0(0x162)+a27_0x516e33['cyan'](_0x45af98)),openBrowser(_0x45af98),0x0;}if(_0x55cdcb['type']===_0x3c7cc0(0x11d)){if(!_0x55cdcb[_0x3c7cc0(0x169)])throw new SDKError(ErrorCode[_0x3c7cc0(0x179)],_0x3c7cc0(0x13e));const _0x34669e=await withSpinner(_0x3c7cc0(0x141),()=>_0x43e7f1[_0x3c7cc0(0x175)][_0x3c7cc0(0x15d)](_0x55cdcb[_0x3c7cc0(0x169)]),{'verbose':_0x47dfa1[_0x3c7cc0(0x115)]});await handleSingleObjectOutput(_0x34669e[_0x3c7cc0(0x188)],_0x47dfa1);}else{if(_0x55cdcb[_0x3c7cc0(0x11e)]===_0x3c7cc0(0x175)){if(!_0x55cdcb[_0x3c7cc0(0x155)])throw new SDKError(ErrorCode[_0x3c7cc0(0x190)],_0x3c7cc0(0x140));const _0x4b2cd9=await withSpinner(_0x3c7cc0(0x13f),()=>_0x43e7f1[_0x3c7cc0(0x175)][_0x3c7cc0(0x12f)](_0x55cdcb[_0x3c7cc0(0x13b)],_0x55cdcb[_0x3c7cc0(0x155)]),{'verbose':_0x47dfa1[_0x3c7cc0(0x115)]}),_0x22cfd6=getConsoleNextUrl(_0x47dfa1[_0x3c7cc0(0x161)],_0x3c7cc0(0x176)+_0x55cdcb['parentId']+_0x3c7cc0(0x14e)+_0x55cdcb['segmentId']),_0x107995=_0x4b2cd9[_0x3c7cc0(0x188)];_0x107995[_0x3c7cc0(0x150)]=_0x22cfd6,await handleSingleObjectOutput(_0x107995,_0x47dfa1);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x3c7cc0(0x144)](_0x3c7cc0(0x17a)),0x1;}return 0x0;}catch(_0x4c31d5){if(_0x4c31d5 instanceof SDKError)return console[_0x3c7cc0(0x144)](_0x3c7cc0(0x153)+_0x4c31d5[_0x3c7cc0(0x172)]),_0x4c31d5[_0x3c7cc0(0x185)]&&console['error'](_0x3c7cc0(0x135)+_0x4c31d5[_0x3c7cc0(0x185)]),0x1;throw _0x4c31d5;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a27_0x551ed1(0x15b);[a27_0x551ed1(0x123)]=a27_0x551ed1(0x15a);async[a27_0x551ed1(0x136)](_0xca9e5){const _0x2ffad4=a27_0x551ed1,{options:_0x1ef742,args:_0x5a9781,tdx:_0x829808}=_0xca9e5,_0x352f43=_0x5a9781[0x0];if(!_0x352f43)return console[_0x2ffad4(0x144)](_0x2ffad4(0x154)),console[_0x2ffad4(0x144)](_0x2ffad4(0x132)),console[_0x2ffad4(0x144)](_0x2ffad4(0x116)),console['error'](_0x2ffad4(0x18e)),console[_0x2ffad4(0x144)](_0x2ffad4(0x126)),console[_0x2ffad4(0x144)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4bd540=_0x1ef742[_0x2ffad4(0x14a)],_0x4df294=await resolveSegmentTarget(_0x352f43,_0x4bd540,_0x1ef742['verbose']);_0x1ef742[_0x2ffad4(0x115)]&&console[_0x2ffad4(0x144)]('Target\x20path:\x20'+_0x4df294);const _0x2357c9=await withSpinner(_0x2ffad4(0x182)+_0x352f43+_0x2ffad4(0x180),()=>_0x829808[_0x2ffad4(0x175)]['resolvePathToResource'](_0x4df294),{'verbose':_0x1ef742[_0x2ffad4(0x115)]}),_0x3dbc59=_0x2357c9[_0x2ffad4(0x188)];_0x1ef742['verbose']&&(console[_0x2ffad4(0x144)](_0x2ffad4(0x18d)+_0x3dbc59[_0x2ffad4(0x11e)]),console['error'](_0x2ffad4(0x142)+_0x3dbc59[_0x2ffad4(0x13b)]));if(_0x3dbc59[_0x2ffad4(0x11e)]===_0x2ffad4(0x11d))return console['error'](_0x2ffad4(0x177)),console[_0x2ffad4(0x144)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x3dbc59['type']==='parent')return console['error'](_0x2ffad4(0x166)),console[_0x2ffad4(0x144)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x3dbc59[_0x2ffad4(0x155)])throw new SDKError(ErrorCode[_0x2ffad4(0x190)],_0x2ffad4(0x140));const _0x3e33d8=await withSpinner(_0x2ffad4(0x18b),()=>_0x829808[_0x2ffad4(0x175)][_0x2ffad4(0x106)](_0x3dbc59[_0x2ffad4(0x13b)],_0x3dbc59['segmentId']),{'verbose':_0x1ef742['verbose']}),_0x2df241=_0x3e33d8['data'],_0x5b2f84=await executeSchemaQuery(_0x2df241,_0x829808,_0x1ef742);return await handleQueryOutput(_0x5b2f84,_0x1ef742),0x0;}catch(_0x2b2ef3){if(_0x2b2ef3 instanceof SDKError)return console[_0x2ffad4(0x144)](_0x2ffad4(0x153)+_0x2b2ef3[_0x2ffad4(0x172)]),_0x2b2ef3[_0x2ffad4(0x185)]&&console['error'](_0x2ffad4(0x135)+_0x2b2ef3[_0x2ffad4(0x185)]),0x1;throw _0x2b2ef3;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a28_0x4b720d=a28_0x1fbb;(function(_0x2a2404,_0x2762b1){const _0x55e6c3=a28_0x1fbb,_0xe28ca9=_0x2a2404();while(!![]){try{const _0x35686f=-parseInt(_0x55e6c3(0xe5))/0x1+-parseInt(_0x55e6c3(0xf6))/0x2*(parseInt(_0x55e6c3(0xf3))/0x3)+parseInt(_0x55e6c3(0xff))/0x4*(parseInt(_0x55e6c3(0xda))/0x5)+-parseInt(_0x55e6c3(0x107))/0x6+-parseInt(_0x55e6c3(0x101))/0x7+-parseInt(_0x55e6c3(0xfb))/0x8*(-parseInt(_0x55e6c3(0xeb))/0x9)+-parseInt(_0x55e6c3(0xf4))/0xa*(-parseInt(_0x55e6c3(0xf9))/0xb);if(_0x35686f===_0x2762b1)break;else _0xe28ca9['push'](_0xe28ca9['shift']());}catch(_0xc50bd7){_0xe28ca9['push'](_0xe28ca9['shift']());}}}(a28_0x1dc5,0xd9ef7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0xe26854 from'chalk';function a28_0x1fbb(_0x322b58,_0x54163e){_0x322b58=_0x322b58-0xd7;const _0x1dc5ee=a28_0x1dc5();let _0x1fbbfa=_0x1dc5ee[_0x322b58];return _0x1fbbfa;}export class SegmentCreateCommand extends BaseCommand{[a28_0x4b720d(0x108)]='segment:create';[a28_0x4b720d(0xdf)]=a28_0x4b720d(0x105);async[a28_0x4b720d(0xe0)](_0x349fb2){const _0x45a84a=a28_0x4b720d;console[_0x45a84a(0xdb)](a28_0xe26854[_0x45a84a(0xe7)](_0x45a84a(0xed))),console[_0x45a84a(0xdb)](a28_0xe26854[_0x45a84a(0xe7)](_0x45a84a(0xef)));const {options:_0x4e3a0d,args:_0x38baad,tdx:_0x14f040}=_0x349fb2,_0x569421=_0x4e3a0d;if(_0x38baad[_0x45a84a(0xfe)]===0x0)return console[_0x45a84a(0xdb)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x45a84a(0xdb)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x45a84a(0xdb)](_0x45a84a(0x103)),console['error'](_0x45a84a(0xd8)),console['error'](_0x45a84a(0xe6)),console[_0x45a84a(0xdb)](_0x45a84a(0xdd)),0x1;const _0x42e18b=_0x38baad[0x0],_0x6c08e3=_0x4e3a0d['segmentPath'];let _0x312404=_0x42e18b;_0x6c08e3&&!_0x42e18b[_0x45a84a(0xe9)]('/')&&(_0x312404=_0x6c08e3+'/'+_0x42e18b,_0x569421[_0x45a84a(0xf0)]&&console['error'](_0x45a84a(0xd7)+_0x312404));const _0x45c13d=parsePath(_0x312404);if(_0x45c13d[_0x45a84a(0x104)][_0x45a84a(0xfe)]<0x2)return console[_0x45a84a(0xdb)](_0x45a84a(0xdc)),console[_0x45a84a(0xdb)](_0x45a84a(0xfc)),0x1;const _0x15bfee=_0x45c13d['segments'][0x0],_0xe39ad0=getBaseName(_0x312404),_0x3ab258=getParentPath(_0x312404);_0x569421[_0x45a84a(0xf0)]&&(console[_0x45a84a(0xdb)]('Site:\x20'+_0x569421[_0x45a84a(0x106)]),console[_0x45a84a(0xdb)]('Target\x20path:\x20'+_0x312404),console[_0x45a84a(0xdb)](_0x45a84a(0xf5)+_0x15bfee),console[_0x45a84a(0xdb)](_0x45a84a(0xf1)+_0xe39ad0),console['error'](_0x45a84a(0xf2)+_0x3ab258));const _0x503f96=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x15bfee+'\x27...',()=>_0x14f040[_0x45a84a(0xd9)]['resolveParentId'](_0x15bfee),{'verbose':_0x569421[_0x45a84a(0xf0)]}),_0x37cf4c=_0x503f96[_0x45a84a(0xe8)];let _0x1985c4;if(_0x45c13d[_0x45a84a(0x104)][_0x45a84a(0xfe)]>0x2){const _0x4f4b03=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x3ab258+_0x45a84a(0x109),()=>_0x14f040['segment']['resolvePathToResource'](_0x3ab258),{'verbose':_0x569421[_0x45a84a(0xf0)]}),_0x524a35=_0x4f4b03[_0x45a84a(0xe8)];if(_0x524a35[_0x45a84a(0xe3)]!==_0x45a84a(0x102)&&_0x524a35[_0x45a84a(0xe3)]!==_0x45a84a(0xe1))return console[_0x45a84a(0xdb)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x1985c4=_0x524a35[_0x45a84a(0xe4)];}else{if(_0x569421[_0x45a84a(0x102)]){const _0x2a5e34=await withSpinner(_0x45a84a(0xfa)+_0x569421[_0x45a84a(0x102)]+_0x45a84a(0x109),()=>_0x14f040['segment']['resolveFolderId'](_0x37cf4c,_0x569421[_0x45a84a(0x102)]),{'verbose':_0x569421[_0x45a84a(0xf0)]});_0x1985c4=_0x2a5e34['data'];}}_0x569421[_0x45a84a(0xf0)]&&_0x1985c4&&console[_0x45a84a(0xdb)](_0x45a84a(0xe2)+_0x1985c4);const _0x17db6f=await loadJSONFromOptions(_0x569421['rule'],_0x569421[_0x45a84a(0x100)]),_0x11864a={'name':_0xe39ad0,'description':_0x569421[_0x45a84a(0xdf)],'rule':_0x17db6f,'kind':_0x569421['kind']!==undefined?parseInt(_0x569421[_0x45a84a(0xea)],0xa):undefined,'isVisible':_0x569421[_0x45a84a(0xde)]?![]:undefined,'segmentFolderId':_0x1985c4,'countPopulation':_0x569421[_0x45a84a(0xec)]?![]:undefined},_0x5f2ee5=await withSpinner(_0x45a84a(0xf7)+_0xe39ad0+_0x45a84a(0x109),()=>_0x14f040[_0x45a84a(0xd9)][_0x45a84a(0xfd)](_0x37cf4c,_0x11864a),{'verbose':_0x569421[_0x45a84a(0xf0)]}),_0xabf766=_0x5f2ee5[_0x45a84a(0xe8)];return console[_0x45a84a(0xdb)]('✔\x20Created\x20segment\x20\x27'+_0xabf766[_0x45a84a(0x108)]+_0x45a84a(0xf8)+_0xabf766['id']),_0x312404!==_0x42e18b&&console['error'](_0x45a84a(0xee)+_0x312404),await handleSDKOutput([_0xabf766],_0x569421),0x0;}}function a28_0x1dc5(){const _0x3d6cea=['8bwciWB','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','createSegment','length','6103716jVgGNy','ruleFile','12397000UyBjek','folder','Examples:','segments','Create\x20child\x20segment\x20with\x20filtering\x20rules','site','4773228eSNLoN','name','\x27...','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','5LJgjSj','error','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','invisible','description','execute','parent','Resolved\x20folder\x20ID:\x20','type','folderId','939037ycAJaY','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','yellow','data','includes','kind','11476773qoJhFI','noCountPopulation','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','verbose','Segment\x20name:\x20','Parent\x20path:\x20','3EplMNe','30fQjMYA','Parent:\x20','306086UEByor','Creating\x20segment\x20\x27','\x27\x20with\x20ID:\x20','6417235wyInGC','Resolving\x20folder\x20\x27'];a28_0x1dc5=function(){return _0x3d6cea;};return a28_0x1dc5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a29_0x3678(){const _0x40a205=['Error:\x20Parent\x20segment\x20name\x20is\x20required','2024212hkgHmS','jsonl','✔\x20Found\x20','description','Parent\x20segment:\x20','length','547846izoYlc','data','execute','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2437317UODywc','4762264sUfjqp','segment:fields','name','segment','verbose','listFields','475aJIGlz','error','70UwGORB','1406770OiXTmv','Site:\x20','7XEmODj','\x27...','26238NdvBjt','1634538TGgtLi'];a29_0x3678=function(){return _0x40a205;};return a29_0x3678();}function a29_0x307b(_0x1fc264,_0x54c6b7){_0x1fc264=_0x1fc264-0xc0;const _0x3678a0=a29_0x3678();let _0x307b89=_0x3678a0[_0x1fc264];return _0x307b89;}const a29_0x2c28c2=a29_0x307b;(function(_0x2b6573,_0x105015){const _0x3a92a6=a29_0x307b,_0xcfb13e=_0x2b6573();while(!![]){try{const _0x3789d0=parseInt(_0x3a92a6(0xce))/0x1+parseInt(_0x3a92a6(0xc1))/0x2+parseInt(_0x3a92a6(0xc6))/0x3+parseInt(_0x3a92a6(0xc8))/0x4+-parseInt(_0x3a92a6(0xda))/0x5*(parseInt(_0x3a92a6(0xc5))/0x6)+parseInt(_0x3a92a6(0xc3))/0x7*(parseInt(_0x3a92a6(0xd4))/0x8)+parseInt(_0x3a92a6(0xd3))/0x9*(-parseInt(_0x3a92a6(0xc0))/0xa);if(_0x3789d0===_0x105015)break;else _0xcfb13e['push'](_0xcfb13e['shift']());}catch(_0x1bd69b){_0xcfb13e['push'](_0xcfb13e['shift']());}}}(a29_0x3678,0x8f22f));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x2c28c2(0xd6)]=a29_0x2c28c2(0xd5);[a29_0x2c28c2(0xcb)]='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x2c28c2(0xd0)](_0x25e24a){const _0x2fe4a7=a29_0x2c28c2,{options:_0x43e2f3,args:_0x2cf8f3,tdx:_0x566280}=_0x25e24a,_0x12053c=_0x2cf8f3[0x0]||_0x43e2f3['parentSegment'];if(!_0x12053c)return console[_0x2fe4a7(0xdb)](_0x2fe4a7(0xc7)),console[_0x2fe4a7(0xdb)](_0x2fe4a7(0xd1)),console['error'](_0x2fe4a7(0xd2)),0x1;_0x43e2f3[_0x2fe4a7(0xd8)]&&(console[_0x2fe4a7(0xdb)](_0x2fe4a7(0xc2)+_0x43e2f3['site']),console[_0x2fe4a7(0xdb)](_0x2fe4a7(0xcc)+_0x12053c));const _0x1eaf7b=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x12053c+_0x2fe4a7(0xc4),()=>_0x566280[_0x2fe4a7(0xd7)][_0x2fe4a7(0xd9)](_0x12053c),{'verbose':_0x43e2f3[_0x2fe4a7(0xd8)]}),_0x5ca36b=_0x1eaf7b[_0x2fe4a7(0xcf)];console[_0x2fe4a7(0xdb)](_0x2fe4a7(0xca)+_0x5ca36b[_0x2fe4a7(0xcd)]+'\x20field'+(_0x5ca36b['length']!==0x1?'s':''));if(_0x43e2f3['json']||_0x43e2f3[_0x2fe4a7(0xc9)])return await handleSDKOutput(_0x5ca36b,_0x43e2f3),0x0;return displayFieldsHumanReadable(_0x5ca36b,_0x12053c),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x544b30=a30_0x1a37;function a30_0x1a37(_0x7f7e08,_0x96f6b8){_0x7f7e08=_0x7f7e08-0xcc;const _0x261fe6=a30_0x261f();let _0x1a37d5=_0x261fe6[_0x7f7e08];return _0x1a37d5;}(function(_0x2952eb,_0x19ddb7){const _0xf99d83=a30_0x1a37,_0x5128ce=_0x2952eb();while(!![]){try{const _0x12a9c0=-parseInt(_0xf99d83(0x119))/0x1+parseInt(_0xf99d83(0xdd))/0x2*(parseInt(_0xf99d83(0x116))/0x3)+-parseInt(_0xf99d83(0xd1))/0x4+parseInt(_0xf99d83(0xea))/0x5+-parseInt(_0xf99d83(0x110))/0x6*(parseInt(_0xf99d83(0xf0))/0x7)+parseInt(_0xf99d83(0xd3))/0x8+parseInt(_0xf99d83(0x108))/0x9*(parseInt(_0xf99d83(0xe3))/0xa);if(_0x12a9c0===_0x19ddb7)break;else _0x5128ce['push'](_0x5128ce['shift']());}catch(_0x2ae377){_0x5128ce['push'](_0x5128ce['shift']());}}}(a30_0x261f,0xf0772));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a30_0x261f(){const _0x772042=['\x20=\x20','diff','1970RcdTYH','relativePath','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','session','segments','\x0aChanges\x20to\x20\x27','2062760BnCpwG','absolutePath','content','files','helpText','verbose','7claENl','✔\x20Pulled\x20','execute','name','parentSegment','\x0aPull\x20summary\x20for\x20\x27','Aborted.','cwd','dirname','no_parent','Parent\x20segment:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','data','journeyVersions','hasChanges','\x20unchanged\x20files','message','red','\x20versions)','\x20with\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','isNew','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','segment','120168tdYbyC','type','parentName','site','\x20\x20Target:\x20','green','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','activations','4252662sdFPrn','errorCode','filter','pullSegments','Site:\x20','✔\x20Context\x20set:\x20','117543NeivCS','dim','file','568253hMHisR','length','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','Target\x20resource:\x20','\x20segments','Write\x20','cyan','targetDir','repeat','\x20files?','\x20\x20🗺️\x20\x20','segment:pull','6904420iVItiZ','counts','665624wKnOCg','\x20activations','\x27...','\x20files\x20to\x20','\x20\x20🎯\x20','\x20changed\x20files','yes','Error:\x20','Pulling\x20segments\x20from\x20\x27','error','44UmlGMp','journeys','parent_segment','dryRun'];a30_0x261f=function(){return _0x772042;};return a30_0x261f();}import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x2e4c95 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x389bb0 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x544b30(0xf3)]=a30_0x544b30(0xd0);['description']=a30_0x544b30(0x10e);async[a30_0x544b30(0xf2)](_0x374e0b){const _0x2253c0=a30_0x544b30,{options:_0x4daee3,args:_0xbe4dc7,tdx:_0x497dac}=_0x374e0b,_0x3240d6=_0x4daee3,_0x46ba73=await resolveTarget({'arg':_0xbe4dc7[0x0],'contextParent':_0x4daee3[_0x2253c0(0xf4)],'cwd':process[_0x2253c0(0xf7)]()});if(!isSuccessfulResolution(_0x46ba73))return _0x46ba73[_0x2253c0(0x111)]===_0x2253c0(0xf9)?(console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0xe5)](_0x2253c0(0xfb))),console['error']('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)'),console['error'](_0x2253c0(0xe6)),console[_0x2253c0(0xdc)](_0x2253c0(0x104))):(console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0x101)](_0x2253c0(0xda)+_0x46ba73[_0x2253c0(0x100)]+'\x0a')),_0x46ba73[_0x2253c0(0xee)]&&console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0x11f)](_0x46ba73[_0x2253c0(0xee)]))),0x1;const _0x298ea3=_0x46ba73[_0x2253c0(0x10a)],_0x4aa31b=_0x46ba73['targetDir'],_0x7bd4d8=_0x46ba73[_0x2253c0(0x109)]===_0x2253c0(0x118)?_0x46ba73['resourceName']:undefined;_0x3240d6['verbose']&&(console[_0x2253c0(0xdc)](_0x2253c0(0x114)+_0x3240d6[_0x2253c0(0x10b)]),console[_0x2253c0(0xdc)](_0x2253c0(0xfa)+_0x298ea3),_0x7bd4d8&&console[_0x2253c0(0xdc)](_0x2253c0(0x11c)+_0x7bd4d8));const _0x1dad6c=await withProgressSpinner(_0x2253c0(0xdb)+_0x298ea3+_0x2253c0(0xd5),_0x5c44de=>_0x497dac[_0x2253c0(0x107)][_0x2253c0(0x113)](_0x298ea3,{'targetDir':_0x4aa31b,'targetResourceName':_0x7bd4d8,'verbose':_0x3240d6[_0x2253c0(0xef)],'progress':{'update':_0x1836c4=>{const _0xaac993=_0x2253c0;_0x5c44de['setPhase'](_0x1836c4),_0x3240d6[_0xaac993(0xef)]&&console['error']('\x20\x20'+_0x1836c4);}}}),{'verbose':_0x3240d6[_0x2253c0(0xef)]}),_0x326abe=_0x1dad6c[_0x2253c0(0xfc)];if(_0x326abe[_0x2253c0(0xd2)]['segments']===0x0&&_0x326abe[_0x2253c0(0xd2)]['journeys']===0x0)return console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0xe5)](_0x2253c0(0x11b)+_0x326abe[_0x2253c0(0x10a)]+'\x27')),0x0;const _0x387736=_0x326abe['files'][_0x2253c0(0x112)](_0x5e2c39=>_0x5e2c39[_0x2253c0(0x105)]),_0x3493f5=_0x326abe[_0x2253c0(0xed)][_0x2253c0(0x112)](_0x5ccdf4=>!_0x5ccdf4[_0x2253c0(0x105)]&&_0x5ccdf4[_0x2253c0(0xfe)]),_0x126f6e=_0x326abe[_0x2253c0(0xed)][_0x2253c0(0x112)](_0xeb349d=>!_0xeb349d[_0x2253c0(0x105)]&&!_0xeb349d[_0x2253c0(0xfe)]);console['error'](_0x2253c0(0xf5)+_0x326abe['parentName']+'\x27:'),console['error'](_0x2253c0(0xd7)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0xe8)]+_0x2253c0(0x11d))+_0x2253c0(0x103)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0x10f)]+_0x2253c0(0xd4)));if(_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0xde)]>0x0){const _0x1713c2=_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0xfd)]>_0x326abe['counts'][_0x2253c0(0xde)]?'\x20('+_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0xfd)]+_0x2253c0(0x102):'';console[_0x2253c0(0xdc)](_0x2253c0(0xcf)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe[_0x2253c0(0xd2)][_0x2253c0(0xde)]+'\x20journeys')+a30_0x2e4c95[_0x2253c0(0x117)](_0x1713c2));}console[_0x2253c0(0xdc)]('\x20\x20'+a30_0x2e4c95[_0x2253c0(0x10d)]('+\x20'+_0x387736[_0x2253c0(0x11a)]+'\x20new\x20files')),console[_0x2253c0(0xdc)]('\x20\x20'+a30_0x2e4c95[_0x2253c0(0xe5)]('~\x20'+_0x3493f5['length']+_0x2253c0(0xd8))),console[_0x2253c0(0xdc)]('\x20\x20'+a30_0x2e4c95['dim']('=\x20'+_0x126f6e[_0x2253c0(0x11a)]+_0x2253c0(0xff))),console[_0x2253c0(0xdc)](_0x2253c0(0x10c)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe[_0x2253c0(0xcc)])+'\x0a');if(_0x3493f5[_0x2253c0(0x11a)]>0x0)for(const _0x210d9c of _0x3493f5){console['error'](_0x2253c0(0xe9)+_0x210d9c[_0x2253c0(0xe4)]+'\x27:'),console[_0x2253c0(0xdc)]('─'[_0x2253c0(0xcd)](0x3c)),console['error'](_0x210d9c[_0x2253c0(0xe2)]),console[_0x2253c0(0xdc)]('─'[_0x2253c0(0xcd)](0x3c));}if(_0x3240d6[_0x2253c0(0xe0)])return console[_0x2253c0(0xdc)](a30_0x2e4c95['yellow'](_0x2253c0(0x106))),0x0;if(_0x387736[_0x2253c0(0x11a)]===0x0&&_0x3493f5['length']===0x0)return console[_0x2253c0(0xdc)](a30_0x2e4c95['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x326abe[_0x2253c0(0x10a)]},_0x3240d6['session']),console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0x10d)]('✔\x20Context\x20set:\x20'+a30_0x2e4c95['dim'](_0x2253c0(0xdf))+_0x2253c0(0xe1)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe[_0x2253c0(0x10a)]))),0x0;if(!_0x3240d6[_0x2253c0(0xd9)]){const _0x142155=await confirmKey(_0x2253c0(0x11e)+(_0x387736[_0x2253c0(0x11a)]+_0x3493f5[_0x2253c0(0x11a)])+_0x2253c0(0xce));if(!_0x142155)return console[_0x2253c0(0xdc)](_0x2253c0(0xf6)),0x1;}for(const _0x57bad2 of _0x326abe[_0x2253c0(0xed)]){if(_0x57bad2[_0x2253c0(0x105)]||_0x57bad2[_0x2253c0(0xfe)]){const _0x5683d4=a30_0x389bb0[_0x2253c0(0xf8)](_0x57bad2[_0x2253c0(0xeb)]);!existsSync(_0x5683d4)&&mkdirSync(_0x5683d4,{'recursive':!![]}),writeFileSync(_0x57bad2[_0x2253c0(0xeb)],_0x57bad2[_0x2253c0(0xec)],'utf-8');}}return console[_0x2253c0(0xdc)](a30_0x2e4c95['green'](_0x2253c0(0xf1)+(_0x387736[_0x2253c0(0x11a)]+_0x3493f5[_0x2253c0(0x11a)])+_0x2253c0(0xd6)+_0x326abe[_0x2253c0(0xcc)])),saveSessionContext({'parent_segment':_0x326abe[_0x2253c0(0x10a)]},_0x3240d6[_0x2253c0(0xe7)]),console[_0x2253c0(0xdc)](a30_0x2e4c95[_0x2253c0(0x10d)](_0x2253c0(0x115)+a30_0x2e4c95[_0x2253c0(0x117)](_0x2253c0(0xdf))+_0x2253c0(0xe1)+a30_0x2e4c95[_0x2253c0(0x11f)](_0x326abe['parentName']))),0x0;}}
|