@treasuredata/tdx 2026.3.28 → 2026.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-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/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-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/schedule-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/upgrade-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/oauth-keychain.js +1 -1
- package/dist/core/oauth.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/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.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/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-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/oauth-refresh.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/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.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-validator.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-recovery.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/segment-validator.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/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.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/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.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/file-reader.js +1 -1
- package/dist/utils/github-releases.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/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x4d0191=a31_0x3c02;(function(_0x27a316,_0x561bfb){const _0x36a3f0=a31_0x3c02,_0x719d09=_0x27a316();while(!![]){try{const _0x24a074=parseInt(_0x36a3f0(0x1ef))/0x1*(-parseInt(_0x36a3f0(0x21f))/0x2)+-parseInt(_0x36a3f0(0x1f2))/0x3*(parseInt(_0x36a3f0(0x219))/0x4)+-parseInt(_0x36a3f0(0x1fb))/0x5+parseInt(_0x36a3f0(0x1f0))/0x6*(parseInt(_0x36a3f0(0x1e5))/0x7)+parseInt(_0x36a3f0(0x1f6))/0x8+parseInt(_0x36a3f0(0x1ee))/0x9+parseInt(_0x36a3f0(0x21a))/0xa;if(_0x24a074===_0x561bfb)break;else _0x719d09['push'](_0x719d09['shift']());}catch(_0x518665){_0x719d09['push'](_0x719d09['shift']());}}}(a31_0x3816,0xe2c2e));import{BaseCommand}from'./command.js';function a31_0x3c02(_0x2599fd,_0x4cb67d){_0x2599fd=_0x2599fd-0x1e1;const _0x381661=a31_0x3816();let _0x3c026c=_0x381661[_0x2599fd];return _0x3c026c;}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a31_0x5cb1e1 from'chalk';export class PolicyCommand extends BaseCommand{[a31_0x4d0191(0x20b)]=a31_0x4d0191(0x1e2);[a31_0x4d0191(0x20c)]=a31_0x4d0191(0x1ed);async[a31_0x4d0191(0x209)](_0x5109bd){const _0x5e3138=a31_0x4d0191,{options:_0x1b0cb8,tdx:_0xaeb5a6}=_0x5109bd,_0x30f817=await withSpinner(_0x5e3138(0x1e3),async()=>{const _0x54dc5f=_0x5e3138,[_0xb02050,_0x4bbc26]=await Promise[_0x54dc5f(0x1fc)]([_0xaeb5a6[_0x54dc5f(0x21c)][_0x54dc5f(0x1ea)](),_0xaeb5a6['policy'][_0x54dc5f(0x1f7)]()]);return{'userInfo':_0xb02050,'permissions':_0x4bbc26};},{'verbose':_0x1b0cb8[_0x5e3138(0x208)]}),{userInfo:_0x5d9924,permissions:_0x4ca942}=_0x30f817[_0x5e3138(0x21b)];if(isStructuredFormat(_0x1b0cb8))return await handleSingleObjectOutput(_0x4ca942,_0x1b0cb8),0x0;const _0x395fcb=_0x5d9924[_0x5e3138(0x204)]?_0x5e3138(0x1fa):_0x5d9924[_0x5e3138(0x1ff)]?'Administrator':_0x5e3138(0x205);console[_0x5e3138(0x20a)]('\x0a'+a31_0x5cb1e1[_0x5e3138(0x1f5)]('👤')+'\x20'+a31_0x5cb1e1[_0x5e3138(0x1f5)](_0x5d9924[_0x5e3138(0x20b)])+'\x20'+a31_0x5cb1e1[_0x5e3138(0x1e6)]('('+_0x5d9924[_0x5e3138(0x216)]+')')+_0x5e3138(0x21e)+_0x395fcb),console[_0x5e3138(0x20a)](a31_0x5cb1e1['dim']('\x20\x20\x20'+_0xaeb5a6[_0x5e3138(0x1fd)][_0x5e3138(0x203)]+':'+_0x5d9924[_0x5e3138(0x1eb)]+_0x5e3138(0x206)+_0x5d9924['id']));const _0x40879b=_0x4ca942[_0x5e3138(0x1f9)];console[_0x5e3138(0x20a)]('\x0a'+a31_0x5cb1e1[_0x5e3138(0x1f5)](_0x5e3138(0x1e1))+'\x20('+_0x40879b[_0x5e3138(0x1f3)]+'):');if(_0x40879b[_0x5e3138(0x1f3)]===0x0)console['log'](a31_0x5cb1e1[_0x5e3138(0x1e6)](_0x5e3138(0x213)));else for(const _0x94e802 of _0x40879b){console[_0x5e3138(0x20a)](_0x5e3138(0x20e)+_0x94e802['name']);}return printPermissionsMap(_0x4ca942[_0x5e3138(0x20d)]),console[_0x5e3138(0x20a)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a31_0x4d0191(0x20b)]=a31_0x4d0191(0x200);[a31_0x4d0191(0x20c)]=a31_0x4d0191(0x215);async['execute'](_0x23488d){const _0x6fa2a4=a31_0x4d0191,{options:_0xa3f984,tdx:_0x256653}=_0x23488d,_0x1f4deb=await withSpinner(_0x6fa2a4(0x20f),()=>_0x256653[_0x6fa2a4(0x1e2)]['listPolicies'](),{'verbose':_0xa3f984[_0x6fa2a4(0x208)]}),_0x52478d=_0x1f4deb[_0x6fa2a4(0x21b)];console[_0x6fa2a4(0x1f4)]('✔\x20Found\x20'+_0x52478d[_0x6fa2a4(0x1f3)]+_0x6fa2a4(0x218)+(_0x52478d[_0x6fa2a4(0x1f3)]!==0x1?'ies':'y'));if(isStructuredFormat(_0xa3f984))return await handleSDKOutput(_0x52478d,_0xa3f984),0x0;if(_0x52478d[_0x6fa2a4(0x1f3)]===0x0)console['log'](a31_0x5cb1e1['dim'](_0x6fa2a4(0x214)));else for(const _0x3b9fb1 of _0x52478d){const _0x4cb849=_0x3b9fb1[_0x6fa2a4(0x20c)]?a31_0x5cb1e1['dim'](_0x6fa2a4(0x21e)+_0x3b9fb1[_0x6fa2a4(0x20c)]):'';console[_0x6fa2a4(0x20a)](_0x6fa2a4(0x20e)+_0x3b9fb1['name']+_0x4cb849);}return 0x0;}}function a31_0x3816(){const _0x178cae=['policy\x20list','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','join','site','account_owner','Member',',\x20user_id:','🔑\x20Effective\x20Permissions','verbose','execute','log','name','description','permissions','\x20\x20•\x20','Listing\x20policies...','\x20\x20No\x20permissions','👥\x20Assigned\x20Users','padEnd','\x20\x20No\x20policies\x20assigned','No\x20policies\x20found','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','email','map','\x20polic','70604RLthMk','32404230NMxxVY','data','user','operation','\x20—\x20','322hdTTgk','📋\x20Assigned\x20Policies','policy','Fetching\x20permissions...','getPolicyUsers','8407yAkWNM','dim','max','\x20\x20\x20','args','getCurrent','account_id','Fetching\x20policy...','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','9125046wlknaA','8534luwLIg','4842VKLAMg','entries','258oNqfUD','length','error','bold','708080TdscGK','getMyPermissions','validate','policies','Account\x20Owner','7456300MdKSIP','all','context','\x20user','administrator'];a31_0x3816=function(){return _0x178cae;};return a31_0x3816();}export class PolicyShowCommand extends BaseCommand{[a31_0x4d0191(0x20b)]='policy\x20show';[a31_0x4d0191(0x20c)]=a31_0x4d0191(0x201);[a31_0x4d0191(0x1f8)](_0x298fb7){const _0x38c9b6=a31_0x4d0191;if(_0x298fb7[_0x38c9b6(0x1e9)][_0x38c9b6(0x1f3)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a31_0x4d0191(0x209)](_0x3a0c7a){const _0x189103=a31_0x4d0191,{options:_0x2937d9,tdx:_0x15001d}=_0x3a0c7a,_0x5dd7f3=_0x3a0c7a[_0x189103(0x1e9)][0x0],_0x491211=await withSpinner(_0x189103(0x1ec),async()=>{const _0x110d14=_0x189103,_0x475db9=await _0x15001d[_0x110d14(0x1e2)]['getPolicy'](_0x5dd7f3),[_0x467e69,_0x56af3e]=await Promise['all']([_0x15001d[_0x110d14(0x1e2)]['getPolicyPermissions'](_0x475db9['id']),_0x15001d[_0x110d14(0x1e2)][_0x110d14(0x1e4)](_0x475db9['id'])]);return{'policy':_0x475db9,'perms':_0x467e69,'users':_0x56af3e};},{'verbose':_0x2937d9['verbose']}),{policy:_0x2b8e9a,perms:_0x284c93,users:_0xb899d3}=_0x491211['data'];if(isStructuredFormat(_0x2937d9))return await handleSingleObjectOutput({..._0x2b8e9a,'permissions':_0x284c93[_0x189103(0x20d)],'users':_0xb899d3},_0x2937d9),0x0;console['log']('\x0a'+a31_0x5cb1e1['bold']('📋')+'\x20'+a31_0x5cb1e1[_0x189103(0x1f5)](_0x2b8e9a['name'])+'\x20'+a31_0x5cb1e1[_0x189103(0x1e6)]('(ID:\x20'+_0x2b8e9a['id']+')'));_0x2b8e9a[_0x189103(0x20c)]&&console[_0x189103(0x20a)](_0x189103(0x1e8)+a31_0x5cb1e1[_0x189103(0x1e6)](_0x2b8e9a[_0x189103(0x20c)]));console['log'](_0x189103(0x1e8)+_0xb899d3[_0x189103(0x1f3)]+_0x189103(0x1fe)+(_0xb899d3[_0x189103(0x1f3)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x284c93[_0x189103(0x20d)]);if(_0xb899d3[_0x189103(0x1f3)]>0x0){console['log']('\x0a'+a31_0x5cb1e1[_0x189103(0x1f5)](_0x189103(0x211))+':');for(const _0x52db71 of _0xb899d3){const _0x116b8c=_0x52db71['email']&&_0x52db71[_0x189103(0x216)]!==_0x52db71['name']?a31_0x5cb1e1[_0x189103(0x1e6)]('\x20<'+_0x52db71[_0x189103(0x216)]+'>'):'';console['log'](_0x189103(0x20e)+_0x52db71[_0x189103(0x20b)]+_0x116b8c);}}return console[_0x189103(0x20a)](),0x0;}}function printPermissionsMap(_0x1916bf){const _0x425ede=a31_0x4d0191,_0x51c545=Object[_0x425ede(0x1f1)](_0x1916bf);console[_0x425ede(0x20a)]('\x0a'+a31_0x5cb1e1[_0x425ede(0x1f5)](_0x425ede(0x207))+':');if(_0x51c545[_0x425ede(0x1f3)]===0x0){console[_0x425ede(0x20a)](a31_0x5cb1e1['dim'](_0x425ede(0x210)));return;}const _0x2ecceb=Math[_0x425ede(0x1e7)](..._0x51c545[_0x425ede(0x217)](([_0x3673e3])=>_0x3673e3['length']));for(const [_0x436f18,_0x1673fe]of _0x51c545){const _0x427c61=formatOperations(_0x1673fe);console[_0x425ede(0x20a)]('\x20\x20'+_0x436f18[_0x425ede(0x212)](_0x2ecceb+0x2)+_0x427c61);}}function formatOperations(_0x11a753){const _0x30642b=a31_0x4d0191,_0x10e7ac=[...new Set(_0x11a753[_0x30642b(0x217)](_0x42b17b=>_0x42b17b[_0x30642b(0x21d)]))];return _0x10e7ac[_0x30642b(0x202)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x3ad395=a32_0x3479;(function(_0xd6601,_0x2798eb){const _0x40e9b3=a32_0x3479,_0x29d0f7=_0xd6601();while(!![]){try{const _0x19d22f=parseInt(_0x40e9b3(0xd0))/0x1*(parseInt(_0x40e9b3(0xc6))/0x2)+parseInt(_0x40e9b3(0xd9))/0x3*(-parseInt(_0x40e9b3(0xa3))/0x4)+parseInt(_0x40e9b3(0xe9))/0x5+-parseInt(_0x40e9b3(0xac))/0x6*(-parseInt(_0x40e9b3(0xf9))/0x7)+-parseInt(_0x40e9b3(0xff))/0x8*(-parseInt(_0x40e9b3(0x9a))/0x9)+parseInt(_0x40e9b3(0xe5))/0xa*(parseInt(_0x40e9b3(0xa8))/0xb)+-parseInt(_0x40e9b3(0xcc))/0xc*(parseInt(_0x40e9b3(0xdb))/0xd);if(_0x19d22f===_0x2798eb)break;else _0x29d0f7['push'](_0x29d0f7['shift']());}catch(_0x5036ac){_0x29d0f7['push'](_0x29d0f7['shift']());}}}(a32_0x3cbe,0x6cec2));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 a32_0x1c84a from'node:path';import{saveSessionContext,getSessionID,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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}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 a32_0x2a8710 from'prompts';import a32_0x2595c6 from'chalk';function validateProfileName(_0x3bec2b){const _0x16aeb2=a32_0x3479;if(!_0x3bec2b||!_0x3bec2b[_0x16aeb2(0xa5)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x2cb222=_0x3bec2b[_0x16aeb2(0xa5)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x2cb222))return _0x16aeb2(0xc8);if(profileExists(_0x2cb222))return _0x16aeb2(0xd8)+_0x2cb222+_0x16aeb2(0xc9);return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x3ad395(0xe7)]='profile:create';[a32_0x3ad395(0xe2)]=a32_0x3ad395(0xee);async[a32_0x3ad395(0xb2)](_0x496a4a){const _0x3dfaba=a32_0x3ad395,{options:_0x24beef,args:_0x504d02}=_0x496a4a;console[_0x3dfaba(0xb9)](a32_0x2595c6[_0x3dfaba(0xd4)]('tdx:\x20profile\x20create'));let _0x4ed360;if(_0x504d02[_0x3dfaba(0xbf)]>0x0&&_0x504d02[0x0]){const _0x5c68b9=_0x504d02[0x0][_0x3dfaba(0xa5)](),_0x52cbfb=validateProfileName(_0x5c68b9);if(_0x52cbfb!==!![])return console[_0x3dfaba(0xd7)](a32_0x2595c6[_0x3dfaba(0xb8)](_0x52cbfb)),0x1;_0x4ed360=_0x5c68b9;}else{const _0x22f089=await a32_0x2a8710({'type':_0x3dfaba(0xc3),'name':_0x3dfaba(0xf3),'message':_0x3dfaba(0xf1),'validate':validateProfileName});if(!_0x22f089[_0x3dfaba(0xf3)])return console[_0x3dfaba(0xb9)](_0x3dfaba(0xa7)),0x1;_0x4ed360=_0x22f089['profileName'][_0x3dfaba(0xa5)]();}const _0x2f1660=await a32_0x2a8710({'type':_0x3dfaba(0xc3),'name':_0x3dfaba(0xe2),'message':'Enter\x20description\x20(optional):'}),_0x4a6999=_0x2f1660[_0x3dfaba(0xe2)]?.[_0x3dfaba(0xa5)]()||undefined,_0x1d349c=_0x24beef[_0x3dfaba(0xba)]||_0x3dfaba(0xde),_0x5a8e3a=await promptSiteSelection(_0x1d349c,_0x4ed360,_0x3dfaba(0xc4));if(!_0x5a8e3a)return 0x1;const _0x19c1c5=resolveSite(_0x5a8e3a);if(isOAuthSupported(_0x19c1c5)){const _0x3baee6=await a32_0x2a8710({'type':_0x3dfaba(0xfe),'name':_0x3dfaba(0xdf),'message':'Choose\x20authentication\x20method:','choices':[{'title':'OAuth\x20(browser\x20login)','value':_0x3dfaba(0xda)},{'title':_0x3dfaba(0xf8),'value':'apikey'}]});if(!_0x3baee6[_0x3dfaba(0xdf)])return console[_0x3dfaba(0xb9)](_0x3dfaba(0xa7)),0x1;if(_0x3baee6[_0x3dfaba(0xdf)]==='oauth'){if(_0x4a6999){const _0x3e5f9a={'site':_0x19c1c5,'description':_0x4a6999};saveProfileToUserConfig(_0x4ed360,_0x3e5f9a);}return await runOAuthLoginFlow(_0x19c1c5,_0x4ed360,_0x24beef['logLevel']??LogLevel[_0x3dfaba(0x9f)]),0x0;}}console[_0x3dfaba(0xb9)](_0x3dfaba(0xad)+_0x19c1c5),console[_0x3dfaba(0xb9)](_0x3dfaba(0xc2)),console['log']('\x20\x20'+getConsoleUrl(_0x19c1c5,_0x3dfaba(0xb3)));const _0x5d396a=await a32_0x2a8710({'type':'password','name':_0x3dfaba(0xd2),'message':_0x3dfaba(0x9e),'validate':_0x49429a=>{const _0x53a409=_0x3dfaba;if(!_0x49429a||!_0x49429a[_0x53a409(0xa5)]())return _0x53a409(0xa2);return!![];}});if(!_0x5d396a[_0x3dfaba(0xd2)])return console[_0x3dfaba(0xb9)]('\x0aSetup\x20cancelled'),0x1;const _0xe26810=_0x5d396a['apiKey'];console['log']('Validating\x20API\x20key...');try{const _0x5f5b3b=TDX[_0x3dfaba(0xc0)]({'site':_0x19c1c5,'apiKey':_0xe26810[_0x3dfaba(0xa5)](),'logLevel':_0x24beef['logLevel']??LogLevel[_0x3dfaba(0x9f)]}),_0x4e3526=await _0x5f5b3b['jobs'][_0x3dfaba(0xef)]();console[_0x3dfaba(0xb9)](a32_0x2595c6[_0x3dfaba(0xe6)]('✓')+_0x3dfaba(0xe0)+_0x4e3526[_0x3dfaba(0xfb)]+')');const _0x558ee6=await isKeychainAvailable();_0x558ee6?(await saveAPIKeyAsync(_0xe26810['trim'](),_0x19c1c5,_0x4ed360),console[_0x3dfaba(0xb9)](a32_0x2595c6[_0x3dfaba(0xe6)]('✓')+_0x3dfaba(0xfa)+_0x4ed360+')')):(console['warn'](a32_0x2595c6[_0x3dfaba(0x100)](_0x3dfaba(0xbd))),console['warn'](a32_0x2595c6[_0x3dfaba(0x100)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1d67bc={'site':_0x19c1c5,..._0x4a6999&&{'description':_0x4a6999}};return saveProfileToUserConfig(_0x4ed360,_0x1d67bc),console[_0x3dfaba(0xb9)](a32_0x2595c6[_0x3dfaba(0xe6)]('✓')+_0x3dfaba(0xf4)+_0x4ed360+_0x3dfaba(0xa9)),console[_0x3dfaba(0xb9)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x3dfaba(0xb9)](_0x3dfaba(0xd6)+_0x4ed360+_0x3dfaba(0xd5)),console['log'](_0x3dfaba(0xd6)+_0x4ed360+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x9f867e){if(_0x9f867e instanceof HTTPClientError&&_0x9f867e[_0x3dfaba(0xae)]===0x191)return printAuthError(_0x9f867e),0x1;return console[_0x3dfaba(0xd7)](a32_0x2595c6[_0x3dfaba(0xb8)](_0x3dfaba(0xb5)+(_0x9f867e instanceof Error?_0x9f867e[_0x3dfaba(0xd3)]:String(_0x9f867e)))),console['error'](_0x3dfaba(0xb0)),0x1;}}}function a32_0x3479(_0x2d3845,_0x24791c){_0x2d3845=_0x2d3845-0x95;const _0x3cbe32=a32_0x3cbe();let _0x347948=_0x3cbe32[_0x2d3845];return _0x347948;}export class ProfileRemoveCommand extends BaseCommand{[a32_0x3ad395(0xe7)]='profile:remove';[a32_0x3ad395(0xe2)]=a32_0x3ad395(0x98);[a32_0x3ad395(0xfc)](_0x3db3bf){const _0x4f03af=a32_0x3ad395,{args:_0x63f48e}=_0x3db3bf;if(_0x63f48e[_0x4f03af(0xbf)]===0x0)return _0x4f03af(0xdc);return undefined;}async[a32_0x3ad395(0xb2)](_0x3ceef5){const _0x4e1cfc=a32_0x3ad395,{args:_0x4b6624}=_0x3ceef5,_0x1ab4af=_0x4b6624[0x0];console[_0x4e1cfc(0xb9)](a32_0x2595c6[_0x4e1cfc(0xd4)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x1ab4af)){console['error'](a32_0x2595c6[_0x4e1cfc(0xb8)](_0x4e1cfc(0xd8)+_0x1ab4af+_0x4e1cfc(0xa1))),console['log'](_0x4e1cfc(0xa4));const _0x26d626=listProfiles();if(_0x26d626[_0x4e1cfc(0xbf)]===0x0)console['log'](_0x4e1cfc(0x9c));else for(const _0xac109c of _0x26d626){console[_0x4e1cfc(0xb9)](_0x4e1cfc(0xab)+_0xac109c[_0x4e1cfc(0xe7)]);}return 0x1;}const _0x509c0e=await a32_0x2a8710({'type':'confirm','name':_0x4e1cfc(0xe3),'message':_0x4e1cfc(0xed)+_0x1ab4af+'\x27?','initial':![]});if(!_0x509c0e[_0x4e1cfc(0xe3)])return console[_0x4e1cfc(0xb9)](_0x4e1cfc(0xf2)),0x0;try{removeProfileFromUserConfig(_0x1ab4af),console[_0x4e1cfc(0xb9)](a32_0x2595c6[_0x4e1cfc(0xe6)]('✓')+_0x4e1cfc(0xf4)+_0x1ab4af+'\x27\x20removed\x20from\x20configuration');}catch(_0x2268b8){return console['error'](a32_0x2595c6[_0x4e1cfc(0xb8)](_0x4e1cfc(0xce)+(_0x2268b8 instanceof Error?_0x2268b8[_0x4e1cfc(0xd3)]:String(_0x2268b8)))),0x1;}const _0x36c410=await isKeychainAvailable();if(_0x36c410){const _0x4b8b89=await deleteKeychainAPIKey(_0x1ab4af);_0x4b8b89&&console[_0x4e1cfc(0xb9)](a32_0x2595c6['green']('✓')+_0x4e1cfc(0xf7));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a32_0x3ad395(0xe2)]=a32_0x3ad395(0xaf);static [a32_0x3ad395(0xaa)]=[a32_0x3ad395(0xba),a32_0x3ad395(0xa0),'parent_segment',a32_0x3ad395(0x95),'llm_agent',a32_0x3ad395(0xe2)];[a32_0x3ad395(0xfc)](_0x2f542e){const _0x130afe=a32_0x3ad395,{args:_0x1d480f,options:_0x221ce8}=_0x2f542e,_0x226d4e=_0x221ce8[_0x130afe(0xe1)]||getActiveProfile();if(!_0x226d4e)return _0x130afe(0xca);if(_0x1d480f[_0x130afe(0xbf)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x130afe(0xaa)][_0x130afe(0x99)](',\x20');const _0x5a7825=_0x1d480f[0x0];if(!_0x5a7825[_0x130afe(0xea)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x130afe(0xaa)][_0x130afe(0x99)](',\x20');const [_0x194de4]=_0x5a7825[_0x130afe(0xc7)]('=',0x2);if(!ProfileSetCommand[_0x130afe(0xaa)]['includes'](_0x194de4))return _0x130afe(0xf6)+_0x194de4+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x130afe(0xaa)]['join'](',\x20');return undefined;}async['execute'](_0x1d8692){const _0x135148=a32_0x3ad395,{args:_0x2f6ac2,options:_0x2e9a0f}=_0x1d8692,_0x6e53ac=_0x2e9a0f[_0x135148(0xe1)]||getActiveProfile(),[_0x522e5e,..._0x2bb91f]=_0x2f6ac2[0x0][_0x135148(0xc7)]('='),_0x46cc51=_0x2bb91f[_0x135148(0x99)]('=');console[_0x135148(0xb9)](a32_0x2595c6[_0x135148(0xd4)](_0x135148(0xc1)));if(!profileExists(_0x6e53ac)){const _0x5481cc=await a32_0x2a8710({'type':'confirm','name':'create','message':_0x135148(0xd8)+_0x6e53ac+_0x135148(0x9b),'initial':!![]});if(!_0x5481cc[_0x135148(0xc0)])return console[_0x135148(0xb9)](_0x135148(0xb7)),0x1;}const _0x495291=loadProfile(_0x6e53ac),_0x57f86d=_0x495291?.[_0x135148(0xb6)]||{};if(_0x522e5e===_0x135148(0xba)){const _0x4c5c70=resolveSite(_0x46cc51);console[_0x135148(0xb9)](_0x135148(0xbb)+_0x4c5c70+_0x135148(0x96)),console['log'](_0x135148(0xcb)),console[_0x135148(0xb9)]('\x20\x20'+getConsoleUrl(_0x4c5c70,'/app/mp/ak'));const _0xed5d04=await a32_0x2a8710({'type':'password','name':_0x135148(0xd2),'message':_0x135148(0xdd),'validate':_0x2d9075=>{const _0x27f1ff=_0x135148;if(!_0x2d9075||!_0x2d9075[_0x27f1ff(0xa5)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xed5d04[_0x135148(0xd2)])return console[_0x135148(0xb9)](_0x135148(0x102)),0x1;console[_0x135148(0xb9)](_0x135148(0xcf));try{const _0x2f6e30=TDX['create']({'site':_0x4c5c70,'apiKey':_0xed5d04[_0x135148(0xd2)][_0x135148(0xa5)](),'logLevel':_0x2e9a0f[_0x135148(0x9d)]??LogLevel[_0x135148(0x9f)]}),_0x5415d4=await _0x2f6e30[_0x135148(0xa6)][_0x135148(0xef)]();console[_0x135148(0xb9)](a32_0x2595c6['green']('✓')+_0x135148(0xe0)+_0x5415d4[_0x135148(0xfb)]+')');const _0x4df652=await isKeychainAvailable();_0x4df652?(await saveAPIKeyAsync(_0xed5d04['apiKey'][_0x135148(0xa5)](),_0x4c5c70,_0x6e53ac),console['log'](a32_0x2595c6[_0x135148(0xe6)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x135148(0xcd)](a32_0x2595c6[_0x135148(0x100)](_0x135148(0xbd))),_0x57f86d[_0x135148(0xba)]=_0x4c5c70;}catch(_0x66ec58){if(_0x66ec58 instanceof HTTPClientError&&_0x66ec58[_0x135148(0xae)]===0x191)return printAuthError(_0x66ec58),0x1;return console[_0x135148(0xd7)](a32_0x2595c6[_0x135148(0xb8)]('✗\x20Validation\x20failed:\x20'+(_0x66ec58 instanceof Error?_0x66ec58[_0x135148(0xd3)]:String(_0x66ec58)))),console[_0x135148(0xd7)](_0x135148(0x97)),0x1;}}else _0x57f86d[_0x522e5e]=_0x46cc51||undefined;return saveProfileToUserConfig(_0x6e53ac,_0x57f86d),console[_0x135148(0xb9)](a32_0x2595c6['green']('✓')+_0x135148(0xf4)+_0x6e53ac+_0x135148(0xc5)+_0x522e5e+'='+(_0x46cc51||_0x135148(0xf0))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x3ad395(0xe7)]='profile:use';[a32_0x3ad395(0xe2)]=a32_0x3ad395(0xb1);[a32_0x3ad395(0xfc)](_0x144fa9){const _0x496e96=a32_0x3ad395,{args:_0x303292}=_0x144fa9;if(_0x303292[_0x496e96(0xbf)]===0x0)return _0x496e96(0xe8);return undefined;}async[a32_0x3ad395(0xb2)](_0x4ab9a7){const _0x4e69ae=a32_0x3ad395,{args:_0x1a3afa,options:_0x2227b8}=_0x4ab9a7,_0x5f069a=_0x1a3afa[0x0],_0x1b96d8=_0x2227b8[_0x4e69ae(0xeb)];cleanExpiredSessions();if(!profileExists(_0x5f069a)){console['error'](a32_0x2595c6[_0x4e69ae(0xb8)](_0x4e69ae(0xd8)+_0x5f069a+_0x4e69ae(0xa1))),console[_0x4e69ae(0xb9)](_0x4e69ae(0xa4));const _0xa19184=listProfiles();if(_0xa19184[_0x4e69ae(0xbf)]===0x0)console[_0x4e69ae(0xb9)](_0x4e69ae(0x9c));else for(const _0x31a743 of _0xa19184){console['log'](_0x4e69ae(0xab)+_0x31a743[_0x4e69ae(0xe7)]);}return 0x1;}if(_0x1b96d8){const _0x65ee9a=a32_0x1c84a['join'](getConfigDir(),_0x4e69ae(0xd1));return saveActiveProfileToUserConfig(_0x5f069a),console[_0x4e69ae(0xb9)](_0x4e69ae(0xfd)+a32_0x2595c6[_0x4e69ae(0xe6)](_0x5f069a)),console[_0x4e69ae(0xb9)](a32_0x2595c6[_0x4e69ae(0xbe)](_0x4e69ae(0xec)+_0x65ee9a)),0x0;}const _0xbf271=getSessionID(_0x2227b8[_0x4e69ae(0xbc)]);return saveSessionContext({'profile':_0x5f069a},_0x2227b8[_0x4e69ae(0xbc)]),console[_0x4e69ae(0xb9)](_0x4e69ae(0xb4)+a32_0x2595c6[_0x4e69ae(0xe6)](_0x5f069a)+'\x20'+a32_0x2595c6[_0x4e69ae(0xbe)](_0x4e69ae(0x101)+_0xbf271+')')),console[_0x4e69ae(0xb9)](a32_0x2595c6[_0x4e69ae(0xbe)](_0x4e69ae(0xe4)+_0x5f069a+_0x4e69ae(0xf5))),0x0;}}function a32_0x3cbe(){const _0xfa0f52=['split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','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>','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','804RxbfQn','warn','Failed\x20to\x20remove\x20profile:\x20','Validating\x20API\x20key...','89ziKpfq','tdx.json','apiKey','message','bold','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20\x20tdx\x20--profile\x20','error','Profile\x20\x27','87fQDYbF','oauth','249964oLNsIK','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','us01','method','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile','description','confirm','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','10wIJPSo','green','name','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','2182755qECOAT','includes','default','\x0aSaved\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Create\x20a\x20new\x20profile','getUserInfo','(cleared)','Enter\x20profile\x20name:','Removal\x20cancelled','profileName','\x20Profile\x20\x27','\x20--default\x27\x20to\x20save\x20permanently','Unknown\x20key\x20\x27','\x20API\x20key\x20removed\x20from\x20system\x20keychain','API\x20Key','1562974SxrKOB','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','email','validate','Default\x20profile\x20set\x20to:\x20','select','2832dLuqLe','yellow','(session:\x20','\x0aOperation\x20cancelled','llm_project','\x27\x20requires\x20API\x20key\x20validation.','Site\x20was\x20not\x20changed.','Remove\x20a\x20profile','join','13959CDwZlS','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20(no\x20profiles\x20found)','logLevel','Enter\x20your\x20TD\x20API\x20key:','ERROR','database','\x27\x20does\x20not\x20exist.','API\x20key\x20cannot\x20be\x20empty','52196hDYYxd','\x0aAvailable\x20profiles:','trim','jobs','\x0aSetup\x20cancelled','5718361RyfMNj','\x27\x20created','VALID_KEYS','\x20\x20-\x20','12toydjw','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','status','Set\x20a\x20profile\x20configuration\x20value','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Set\x20session\x20profile','execute','/app/mp/ak','Session\x20profile\x20set\x20to:\x20','✗\x20Validation\x20failed:\x20','config','Operation\x20cancelled','red','log','site','Changing\x20site\x20to\x20\x27','session','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','dim','length','create','tdx:\x20profile\x20set','You\x20can\x20find\x20your\x20API\x20key\x20at:','text','Setup\x20cancelled','\x27\x20updated:\x20','3614WMHiZG'];a32_0x3cbe=function(){return _0xfa0f52;};return a32_0x3cbe();}
|
|
1
|
+
const a32_0x5b1a2f=a32_0x5912;(function(_0x36477f,_0x2408aa){const _0x3cc434=a32_0x5912,_0x271610=_0x36477f();while(!![]){try{const _0x357d72=-parseInt(_0x3cc434(0x1ae))/0x1*(-parseInt(_0x3cc434(0x190))/0x2)+parseInt(_0x3cc434(0x1c1))/0x3*(-parseInt(_0x3cc434(0x194))/0x4)+parseInt(_0x3cc434(0x1d4))/0x5+-parseInt(_0x3cc434(0x1a9))/0x6+-parseInt(_0x3cc434(0x17d))/0x7+parseInt(_0x3cc434(0x1b9))/0x8*(parseInt(_0x3cc434(0x17e))/0x9)+parseInt(_0x3cc434(0x1c9))/0xa;if(_0x357d72===_0x2408aa)break;else _0x271610['push'](_0x271610['shift']());}catch(_0x298448){_0x271610['push'](_0x271610['shift']());}}}(a32_0x16cb,0xbbd3f));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 a32_0x47eb4b from'node:path';import{saveSessionContext,getSessionID,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{runOAuthLoginFlow}from'./auth-login-command.js';function a32_0x16cb(){const _0x371197=['Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profile:use','Set\x20a\x20profile\x20configuration\x20value','Choose\x20authentication\x20method:','VALID_KEYS','test','Session\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20create','text','select','\x20API\x20key\x20removed\x20from\x20system\x20keychain','join','Site\x20was\x20not\x20changed.','52370OBLbNk','apiKey','Profile\x20\x27','yellow','5371240rDaTkY','\x0aAvailable\x20profiles:','dim','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','default','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Create\x20a\x20new\x20profile','(session:\x20','create','confirm','oauth','name','logLevel','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','log','llm_project','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','execute','Removal\x20cancelled','OAuth\x20(browser\x20login)','6523554KhsKTf','config','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20tdx\x20--profile\x20','37VcnVKE','Enter\x20profile\x20name:','includes','jobs','API\x20key\x20cannot\x20be\x20empty','Setup\x20cancelled','\x0aSaved\x20to:\x20','description','✗\x20Validation\x20failed:\x20','getUserInfo','method','72AtwJeM','Remove\x20a\x20profile','site','us01','\x0aSetup\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','status','(cleared)','3deOiTJ','profile:create','\x27\x20does\x20not\x20exist.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','length','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aOperation\x20cancelled','\x27\x20requires\x20API\x20key\x20validation.','30574810hqPiVo','\x20\x20(no\x20profiles\x20found)','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20is\x20valid\x20(User:\x20','ERROR','validate','message','Validating\x20API\x20key...','profileName','profile','warn','943855AgDVRW','trim','\x27\x20created','\x20--default\x27\x20to\x20save\x20permanently','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','bold','\x20Profile\x20\x27','tdx:\x20profile\x20set','llm_agent','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','parent_segment','password','Default\x20profile\x20set\x20to:\x20','red','Set\x20session\x20profile','apikey','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>','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Operation\x20cancelled','error','session','\x20\x20-\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','9755606UMIqmb','377973DhHyZg','API\x20Key','green','email','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'];a32_0x16cb=function(){return _0x371197;};return a32_0x16cb();}function a32_0x5912(_0x484374,_0x5cf2f9){_0x484374=_0x484374-0x17a;const _0x16cbeb=a32_0x16cb();let _0x59120f=_0x16cbeb[_0x484374];return _0x59120f;}import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}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 a32_0x2cb7d1 from'prompts';import a32_0x1d3a22 from'chalk';function validateProfileName(_0x1f92e5){const _0x117bfe=a32_0x5912;if(!_0x1f92e5||!_0x1f92e5[_0x117bfe(0x1d5)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x5d473a=_0x1f92e5[_0x117bfe(0x1d5)]();if(!/^[a-zA-Z0-9_-]+$/[_0x117bfe(0x188)](_0x5d473a))return _0x117bfe(0x1d8);if(profileExists(_0x5d473a))return _0x117bfe(0x192)+_0x5d473a+_0x117bfe(0x1ab);return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x5b1a2f(0x1a0)]=a32_0x5b1a2f(0x1c2);['description']=a32_0x5b1a2f(0x19b);async[a32_0x5b1a2f(0x1a6)](_0x41d331){const _0x17bbc2=a32_0x5b1a2f,{options:_0x3b3283,args:_0x3d9ef9}=_0x41d331;console[_0x17bbc2(0x1a3)](a32_0x1d3a22[_0x17bbc2(0x1d9)](_0x17bbc2(0x18a)));let _0x45f027;if(_0x3d9ef9[_0x17bbc2(0x1c5)]>0x0&&_0x3d9ef9[0x0]){const _0x43739a=_0x3d9ef9[0x0][_0x17bbc2(0x1d5)](),_0x5ca151=validateProfileName(_0x43739a);if(_0x5ca151!==!![])return console[_0x17bbc2(0x1e7)](a32_0x1d3a22['red'](_0x5ca151)),0x1;_0x45f027=_0x43739a;}else{const _0x17de91=await a32_0x2cb7d1({'type':_0x17bbc2(0x18b),'name':_0x17bbc2(0x1d1),'message':_0x17bbc2(0x1af),'validate':validateProfileName});if(!_0x17de91[_0x17bbc2(0x1d1)])return console[_0x17bbc2(0x1a3)]('\x0aSetup\x20cancelled'),0x1;_0x45f027=_0x17de91[_0x17bbc2(0x1d1)][_0x17bbc2(0x1d5)]();}const _0x5394a9=await a32_0x2cb7d1({'type':_0x17bbc2(0x18b),'name':_0x17bbc2(0x1b5),'message':_0x17bbc2(0x199)}),_0xbb01ea=_0x5394a9[_0x17bbc2(0x1b5)]?.[_0x17bbc2(0x1d5)]()||undefined,_0x39e89a=_0x3b3283[_0x17bbc2(0x1bb)]||_0x17bbc2(0x1bc),_0x31b616=await promptSiteSelection(_0x39e89a,_0x45f027,_0x17bbc2(0x1b3));if(!_0x31b616)return 0x1;const _0x19968b=resolveSite(_0x31b616);if(isOAuthSupported(_0x19968b)){const _0x2c4f39=await a32_0x2cb7d1({'type':_0x17bbc2(0x18c),'name':_0x17bbc2(0x1b8),'message':_0x17bbc2(0x186),'choices':[{'title':_0x17bbc2(0x1a8),'value':_0x17bbc2(0x19f)},{'title':_0x17bbc2(0x17f),'value':_0x17bbc2(0x1e3)}]});if(!_0x2c4f39[_0x17bbc2(0x1b8)])return console[_0x17bbc2(0x1a3)](_0x17bbc2(0x1bd)),0x1;if(_0x2c4f39[_0x17bbc2(0x1b8)]===_0x17bbc2(0x19f)){if(_0xbb01ea){const _0x213549={'site':_0x19968b,'description':_0xbb01ea};saveProfileToUserConfig(_0x45f027,_0x213549);}return await runOAuthLoginFlow(_0x19968b,_0x45f027,_0x3b3283[_0x17bbc2(0x1a1)]??LogLevel[_0x17bbc2(0x1cd)]),0x0;}}console[_0x17bbc2(0x1a3)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x19968b),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x17bbc2(0x1a3)]('\x20\x20'+getConsoleUrl(_0x19968b,'/app/mp/ak'));const _0x4ea9c6=await a32_0x2cb7d1({'type':_0x17bbc2(0x1df),'name':_0x17bbc2(0x191),'message':_0x17bbc2(0x1be),'validate':_0x5a783a=>{const _0x2e8667=_0x17bbc2;if(!_0x5a783a||!_0x5a783a[_0x2e8667(0x1d5)]())return _0x2e8667(0x1b2);return!![];}});if(!_0x4ea9c6['apiKey'])return console[_0x17bbc2(0x1a3)]('\x0aSetup\x20cancelled'),0x1;const _0x52fcc8=_0x4ea9c6['apiKey'];console[_0x17bbc2(0x1a3)](_0x17bbc2(0x1d0));try{const _0x2e2660=TDX[_0x17bbc2(0x19d)]({'site':_0x19968b,'apiKey':_0x52fcc8[_0x17bbc2(0x1d5)](),'logLevel':_0x3b3283['logLevel']??LogLevel[_0x17bbc2(0x1cd)]}),_0x5872b2=await _0x2e2660[_0x17bbc2(0x1b1)][_0x17bbc2(0x1b7)]();console['log'](a32_0x1d3a22['green']('✓')+_0x17bbc2(0x1cc)+_0x5872b2['email']+')');const _0x5029ed=await isKeychainAvailable();_0x5029ed?(await saveAPIKeyAsync(_0x52fcc8[_0x17bbc2(0x1d5)](),_0x19968b,_0x45f027),console[_0x17bbc2(0x1a3)](a32_0x1d3a22[_0x17bbc2(0x180)]('✓')+_0x17bbc2(0x19a)+_0x45f027+')')):(console[_0x17bbc2(0x1d3)](a32_0x1d3a22[_0x17bbc2(0x193)](_0x17bbc2(0x17c))),console['warn'](a32_0x1d3a22[_0x17bbc2(0x193)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xb1874e={'site':_0x19968b,..._0xbb01ea&&{'description':_0xbb01ea}};return saveProfileToUserConfig(_0x45f027,_0xb1874e),console[_0x17bbc2(0x1a3)](a32_0x1d3a22[_0x17bbc2(0x180)]('✓')+_0x17bbc2(0x1da)+_0x45f027+_0x17bbc2(0x1d6)),console[_0x17bbc2(0x1a3)](),console[_0x17bbc2(0x1a3)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x17bbc2(0x1a3)]('\x20\x20tdx\x20--profile\x20'+_0x45f027+_0x17bbc2(0x1a5)),console['log'](_0x17bbc2(0x1ad)+_0x45f027+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x4bf8e9){if(_0x4bf8e9 instanceof HTTPClientError&&_0x4bf8e9[_0x17bbc2(0x1bf)]===0x191)return printAuthError(_0x4bf8e9),0x1;return console[_0x17bbc2(0x1e7)](a32_0x1d3a22[_0x17bbc2(0x1e1)](_0x17bbc2(0x1b6)+(_0x4bf8e9 instanceof Error?_0x4bf8e9['message']:String(_0x4bf8e9)))),console[_0x17bbc2(0x1e7)](_0x17bbc2(0x182)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a32_0x5b1a2f(0x1a0)]='profile:remove';['description']=a32_0x5b1a2f(0x1ba);[a32_0x5b1a2f(0x1ce)](_0x5c7ddb){const _0x14f863=a32_0x5b1a2f,{args:_0x18b551}=_0x5c7ddb;if(_0x18b551[_0x14f863(0x1c5)]===0x0)return _0x14f863(0x1cb);return undefined;}async[a32_0x5b1a2f(0x1a6)](_0x23bd02){const _0x5cebbd=a32_0x5b1a2f,{args:_0x414c5e}=_0x23bd02,_0x3e7251=_0x414c5e[0x0];console[_0x5cebbd(0x1a3)](a32_0x1d3a22['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x3e7251)){console['error'](a32_0x1d3a22[_0x5cebbd(0x1e1)](_0x5cebbd(0x192)+_0x3e7251+_0x5cebbd(0x1c3))),console['log'](_0x5cebbd(0x195));const _0x188f05=listProfiles();if(_0x188f05['length']===0x0)console[_0x5cebbd(0x1a3)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2a91db of _0x188f05){console['log']('\x20\x20-\x20'+_0x2a91db['name']);}return 0x1;}const _0x18b35b=await a32_0x2cb7d1({'type':_0x5cebbd(0x19e),'name':_0x5cebbd(0x19e),'message':_0x5cebbd(0x183)+_0x3e7251+'\x27?','initial':![]});if(!_0x18b35b['confirm'])return console[_0x5cebbd(0x1a3)](_0x5cebbd(0x1a7)),0x0;try{removeProfileFromUserConfig(_0x3e7251),console['log'](a32_0x1d3a22['green']('✓')+_0x5cebbd(0x1da)+_0x3e7251+'\x27\x20removed\x20from\x20configuration');}catch(_0x84265e){return console[_0x5cebbd(0x1e7)](a32_0x1d3a22[_0x5cebbd(0x1e1)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x84265e instanceof Error?_0x84265e['message']:String(_0x84265e)))),0x1;}const _0x57b641=await isKeychainAvailable();if(_0x57b641){const _0x3b2927=await deleteKeychainAPIKey(_0x3e7251);_0x3b2927&&console[_0x5cebbd(0x1a3)](a32_0x1d3a22[_0x5cebbd(0x180)]('✓')+_0x5cebbd(0x18d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']=a32_0x5b1a2f(0x185);static [a32_0x5b1a2f(0x187)]=[a32_0x5b1a2f(0x1bb),'database',a32_0x5b1a2f(0x1de),a32_0x5b1a2f(0x1a4),a32_0x5b1a2f(0x1dc),a32_0x5b1a2f(0x1b5)];['validate'](_0x42d3e5){const _0x359b7e=a32_0x5b1a2f,{args:_0x304449,options:_0x38671e}=_0x42d3e5,_0x64fd42=_0x38671e['profile']||getActiveProfile();if(!_0x64fd42)return _0x359b7e(0x1e4);if(_0x304449['length']===0x0)return _0x359b7e(0x197)+ProfileSetCommand[_0x359b7e(0x187)]['join'](',\x20');const _0x14a823=_0x304449[0x0];if(!_0x14a823[_0x359b7e(0x1b0)]('='))return _0x359b7e(0x1c6)+ProfileSetCommand[_0x359b7e(0x187)][_0x359b7e(0x18e)](',\x20');const [_0x555198]=_0x14a823['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x555198))return'Unknown\x20key\x20\x27'+_0x555198+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x359b7e(0x187)][_0x359b7e(0x18e)](',\x20');return undefined;}async[a32_0x5b1a2f(0x1a6)](_0x33d1bc){const _0x246948=a32_0x5b1a2f,{args:_0x56240b,options:_0x16f812}=_0x33d1bc,_0x3af801=_0x16f812[_0x246948(0x1d2)]||getActiveProfile(),[_0x1b72e0,..._0x17930e]=_0x56240b[0x0]['split']('='),_0x30520d=_0x17930e[_0x246948(0x18e)]('=');console[_0x246948(0x1a3)](a32_0x1d3a22[_0x246948(0x1d9)](_0x246948(0x1db)));if(!profileExists(_0x3af801)){const _0x16ae22=await a32_0x2cb7d1({'type':_0x246948(0x19e),'name':_0x246948(0x19d),'message':_0x246948(0x192)+_0x3af801+_0x246948(0x1ac),'initial':!![]});if(!_0x16ae22[_0x246948(0x19d)])return console[_0x246948(0x1a3)](_0x246948(0x1e6)),0x1;}const _0x595cfb=loadProfile(_0x3af801),_0x2f8c67=_0x595cfb?.[_0x246948(0x1aa)]||{};if(_0x1b72e0==='site'){const _0x1b488c=resolveSite(_0x30520d);console[_0x246948(0x1a3)]('Changing\x20site\x20to\x20\x27'+_0x1b488c+_0x246948(0x1c8)),console[_0x246948(0x1a3)](_0x246948(0x1c4)),console[_0x246948(0x1a3)]('\x20\x20'+getConsoleUrl(_0x1b488c,'/app/mp/ak'));const _0x4882c6=await a32_0x2cb7d1({'type':'password','name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x12a8f2=>{const _0x37fc31=_0x246948;if(!_0x12a8f2||!_0x12a8f2[_0x37fc31(0x1d5)]())return _0x37fc31(0x1b2);return!![];}});if(!_0x4882c6[_0x246948(0x191)])return console[_0x246948(0x1a3)](_0x246948(0x1c7)),0x1;console['log'](_0x246948(0x1d0));try{const _0x591aef=TDX['create']({'site':_0x1b488c,'apiKey':_0x4882c6['apiKey'][_0x246948(0x1d5)](),'logLevel':_0x16f812['logLevel']??LogLevel['ERROR']}),_0x1bda6d=await _0x591aef[_0x246948(0x1b1)][_0x246948(0x1b7)]();console['log'](a32_0x1d3a22[_0x246948(0x180)]('✓')+_0x246948(0x1cc)+_0x1bda6d[_0x246948(0x181)]+')');const _0x4d19aa=await isKeychainAvailable();_0x4d19aa?(await saveAPIKeyAsync(_0x4882c6[_0x246948(0x191)]['trim'](),_0x1b488c,_0x3af801),console[_0x246948(0x1a3)](a32_0x1d3a22[_0x246948(0x180)]('✓')+_0x246948(0x1e5))):console[_0x246948(0x1d3)](a32_0x1d3a22[_0x246948(0x193)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x2f8c67['site']=_0x1b488c;}catch(_0x2519a3){if(_0x2519a3 instanceof HTTPClientError&&_0x2519a3[_0x246948(0x1bf)]===0x191)return printAuthError(_0x2519a3),0x1;return console[_0x246948(0x1e7)](a32_0x1d3a22[_0x246948(0x1e1)](_0x246948(0x1b6)+(_0x2519a3 instanceof Error?_0x2519a3[_0x246948(0x1cf)]:String(_0x2519a3)))),console[_0x246948(0x1e7)](_0x246948(0x18f)),0x1;}}else _0x2f8c67[_0x1b72e0]=_0x30520d||undefined;return saveProfileToUserConfig(_0x3af801,_0x2f8c67),console[_0x246948(0x1a3)](a32_0x1d3a22[_0x246948(0x180)]('✓')+_0x246948(0x1da)+_0x3af801+'\x27\x20updated:\x20'+_0x1b72e0+'='+(_0x30520d||_0x246948(0x1c0))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x5b1a2f(0x1a0)]=a32_0x5b1a2f(0x184);['description']=a32_0x5b1a2f(0x1e2);['validate'](_0x3306b0){const _0x5cf5f9=a32_0x5b1a2f,{args:_0xf5ced7}=_0x3306b0;if(_0xf5ced7['length']===0x0)return _0x5cf5f9(0x1dd);return undefined;}async[a32_0x5b1a2f(0x1a6)](_0x581e2d){const _0x503073=a32_0x5b1a2f,{args:_0x14bcea,options:_0x14e955}=_0x581e2d,_0xc00ea0=_0x14bcea[0x0],_0xa9c578=_0x14e955[_0x503073(0x198)];cleanExpiredSessions();if(!profileExists(_0xc00ea0)){console[_0x503073(0x1e7)](a32_0x1d3a22['red'](_0x503073(0x192)+_0xc00ea0+_0x503073(0x1c3))),console[_0x503073(0x1a3)]('\x0aAvailable\x20profiles:');const _0x35afa6=listProfiles();if(_0x35afa6[_0x503073(0x1c5)]===0x0)console['log'](_0x503073(0x1ca));else for(const _0x213d29 of _0x35afa6){console['log'](_0x503073(0x17b)+_0x213d29[_0x503073(0x1a0)]);}return 0x1;}if(_0xa9c578){const _0x587411=a32_0x47eb4b[_0x503073(0x18e)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0xc00ea0),console[_0x503073(0x1a3)](_0x503073(0x1e0)+a32_0x1d3a22[_0x503073(0x180)](_0xc00ea0)),console[_0x503073(0x1a3)](a32_0x1d3a22[_0x503073(0x196)](_0x503073(0x1b4)+_0x587411)),0x0;}const _0x417b75=getSessionID(_0x14e955['session']);return saveSessionContext({'profile':_0xc00ea0},_0x14e955[_0x503073(0x17a)]),console[_0x503073(0x1a3)](_0x503073(0x189)+a32_0x1d3a22[_0x503073(0x180)](_0xc00ea0)+'\x20'+a32_0x1d3a22[_0x503073(0x196)](_0x503073(0x19c)+_0x417b75+')')),console[_0x503073(0x1a3)](a32_0x1d3a22[_0x503073(0x196)](_0x503073(0x1a2)+_0xc00ea0+_0x503073(0x1d7))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x33011b=a33_0x3683;(function(_0x7ddbf5,_0x2e79f0){const _0x2b3591=a33_0x3683,_0x292d7e=_0x7ddbf5();while(!![]){try{const _0x186082=parseInt(_0x2b3591(0x10b))/0x1+parseInt(_0x2b3591(0x10e))/0x2*(parseInt(_0x2b3591(0x117))/0x3)+parseInt(_0x2b3591(0x10f))/0x4*(-parseInt(_0x2b3591(0x106))/0x5)+parseInt(_0x2b3591(0x111))/0x6*(-parseInt(_0x2b3591(0x11a))/0x7)+-parseInt(_0x2b3591(0x11d))/0x8+-parseInt(_0x2b3591(0x10a))/0x9*(-parseInt(_0x2b3591(0x103))/0xa)+-parseInt(_0x2b3591(0x110))/0xb*(-parseInt(_0x2b3591(0x11c))/0xc);if(_0x186082===_0x2e79f0)break;else _0x292d7e['push'](_0x292d7e['shift']());}catch(_0x19b520){_0x292d7e['push'](_0x292d7e['shift']());}}}(a33_0x1b8e,0xc5963));import{BaseCommand}from'./command.js';function a33_0x3683(_0x5966d9,_0x1d59bf){_0x5966d9=_0x5966d9-0xff;const _0x1b8ea9=a33_0x1b8e();let _0x368363=_0x1b8ea9[_0x5966d9];return _0x368363;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x1b8e(){const _0x34e2c1=['9wjQhYv','809486RbADkz','error','profiles','492868ODpghq','19288wHmYGF','3200890puZiaT','4466934HRpqOR','message','name','dim','log','config','18TNLpgQ','👤\x20','Error:\x20','7aNzFas','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','12adThxm','10800880TWypGb','List\x20all\x20available\x20profiles','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','site','length','4019860oUrafw','green','\x20\x20Global:\x20~/.config/tdx/tdx.json','80KwCYGj','map','description','execute'];a33_0x1b8e=function(){return _0x34e2c1;};return a33_0x1b8e();}import a33_0x336b56 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a33_0x33011b(0x10d);[a33_0x33011b(0x108)]=a33_0x33011b(0xff);async[a33_0x33011b(0x109)](_0x31a93d){const _0x232f7f=a33_0x33011b,{options:_0x61ce21}=_0x31a93d;try{const _0xabd484=listProfiles(),_0x5c3cdc=getActiveProfile();if(_0xabd484[_0x232f7f(0x102)]===0x0)return console[_0x232f7f(0x115)](_0x232f7f(0x100)),console[_0x232f7f(0x115)](_0x232f7f(0x11b)),console[_0x232f7f(0x115)](_0x232f7f(0x105)),0x0;const _0x456713=_0xabd484[_0x232f7f(0x107)](_0x1bf658=>{const _0x461ed6=_0x232f7f,_0x15f2c3=_0x1bf658[_0x461ed6(0x113)]===_0x5c3cdc,_0x1af424=getProfileParams(_0x1bf658['config']);return{'name':_0x1bf658[_0x461ed6(0x113)],'active':_0x15f2c3,'scope':_0x1bf658['scope'],'description':_0x1bf658['config']['description']||'','params':_0x1af424};});if(isStructuredFormat(_0x61ce21))await handleSDKOutput(_0x456713,_0x61ce21);else for(const _0x586af9 of _0xabd484){const _0x38ef58=_0x586af9[_0x232f7f(0x113)]===_0x5c3cdc?a33_0x336b56[_0x232f7f(0x104)]('\x20✓'):'',_0x7d2ec5=_0x586af9[_0x232f7f(0x116)]['site']?a33_0x336b56[_0x232f7f(0x114)]('\x20'+_0x586af9[_0x232f7f(0x116)][_0x232f7f(0x101)]):'',_0x3dc802=_0x586af9['config']['description']?a33_0x336b56[_0x232f7f(0x114)]('\x20\x20'+_0x586af9['config'][_0x232f7f(0x108)]):'';console[_0x232f7f(0x115)](_0x232f7f(0x118)+_0x586af9[_0x232f7f(0x113)]+_0x38ef58+_0x7d2ec5+_0x3dc802);}return 0x0;}catch(_0x596e0f){return _0x596e0f instanceof Error&&console[_0x232f7f(0x10c)](_0x232f7f(0x119)+_0x596e0f[_0x232f7f(0x112)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0xc36741=a34_0x4651;(function(_0x521909,_0x563307){const _0x4c2c3e=a34_0x4651,_0x1cfec5=_0x521909();while(!![]){try{const _0x18016b=-parseInt(_0x4c2c3e(0x123))/0x1+parseInt(_0x4c2c3e(0x11a))/0x2+-parseInt(_0x4c2c3e(0x132))/0x3*(parseInt(_0x4c2c3e(0x13e))/0x4)+-parseInt(_0x4c2c3e(0x14b))/0x5*(parseInt(_0x4c2c3e(0x122))/0x6)+-parseInt(_0x4c2c3e(0x120))/0x7*(parseInt(_0x4c2c3e(0x11f))/0x8)+parseInt(_0x4c2c3e(0x143))/0x9*(parseInt(_0x4c2c3e(0x135))/0xa)+-parseInt(_0x4c2c3e(0x12c))/0xb*(-parseInt(_0x4c2c3e(0x140))/0xc);if(_0x18016b===_0x563307)break;else _0x1cfec5['push'](_0x1cfec5['shift']());}catch(_0x48c838){_0x1cfec5['push'](_0x1cfec5['shift']());}}}(a34_0x5cea,0xe5d06));import{BaseCommand}from'./command.js';function a34_0x4651(_0x64be0f,_0x43ef09){_0x64be0f=_0x64be0f-0x116;const _0x5ceaad=a34_0x5cea();let _0x46513a=_0x5ceaad[_0x64be0f];return _0x46513a;}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{[a34_0xc36741(0x138)]=a34_0xc36741(0x126);[a34_0xc36741(0x130)]=a34_0xc36741(0x136);async[a34_0xc36741(0x147)](_0x23fcd9){const _0x11ff20=a34_0xc36741,{options:_0xc1909f,args:_0x1da5ff,tdx:_0x4fab56}=_0x23fcd9,_0x13794d={..._0xc1909f,'limitStructuredFormats':!![]},_0x4bc6f8=_0x1da5ff[0x0],_0xcce73f=_0xc1909f['file'];let _0x5855e2;try{if(_0xcce73f)_0x5855e2=readSqlStatementsFromFile(_0xcce73f);else{if(_0x4bc6f8==='-')_0x5855e2=await readSqlStatementsFromStdin();else{if(_0x4bc6f8&&isSqlFilePath(_0x4bc6f8))_0x5855e2=readSqlStatementsFromFile(_0x4bc6f8);else{if(_0x4bc6f8)_0x5855e2=splitSqlStatements(_0x4bc6f8);else throw new Error(_0x11ff20(0x141));}}}}catch(_0x19ccf3){return console[_0x11ff20(0x118)](_0x11ff20(0x119)+_0x19ccf3[_0x11ff20(0x13f)]),0x1;}const _0x578d37=_0xc1909f[_0x11ff20(0x148)]||_0x11ff20(0x11d),_0x4bfd02=_0xc1909f[_0x11ff20(0x131)];try{const _0x13d971=[],_0x3f1e74=!!_0xc1909f[_0x11ff20(0x117)];for(let _0x496184=0x0;_0x496184<_0x5855e2['length'];_0x496184++){const _0x5ca4b8=_0x5855e2[_0x496184],_0x8103f1=_0x496184+0x1,_0x3da302=_0x5855e2[_0x11ff20(0x116)],_0x5c8f01=_0x3da302>0x1;_0xc1909f[_0x11ff20(0x14c)]&&(console[_0x11ff20(0x118)]('\x0a'+(_0x5c8f01?_0x11ff20(0x134)+_0x8103f1+'/'+_0x3da302+':':'')),console[_0x11ff20(0x118)](_0x11ff20(0x124)+_0xc1909f[_0x11ff20(0x133)]),console[_0x11ff20(0x118)](_0x11ff20(0x139)+(_0x4bfd02||'td')),console['error'](_0x11ff20(0x144)+_0x578d37),console[_0x11ff20(0x118)](_0x11ff20(0x146)+_0x5ca4b8));const _0x5e18e1=_0x5c8f01?_0x11ff20(0x142)+_0x8103f1+'/'+_0x3da302+_0x11ff20(0x11c):'Executing\x20query...';try{const _0x29f02b=await withProgressSpinner(_0x5e18e1,async _0x38c296=>{const _0x3092f8=_0x11ff20,_0x19df06=await _0x4fab56['query'][_0x3092f8(0x147)](_0x5ca4b8,{'catalog':_0x4bfd02,'schema':_0x578d37,'onJobId':_0x5f3c3d=>{_0x38c296['setJobId'](_0x5f3c3d);},'onProgress':_0x530a32=>{const _0x221534=_0x3092f8;_0x38c296[_0x221534(0x11b)](_0x221534(0x145)+_0x530a32[_0x221534(0x128)]+']'),_0x38c296[_0x221534(0x125)](formatRows(_0x530a32['processedRows'])+_0x221534(0x14a)+_0x530a32[_0x221534(0x12f)]+'/'+_0x530a32['totalSplits']+_0x221534(0x149));}});return _0x19df06;},{'verbose':_0xc1909f[_0x11ff20(0x14c)]}),_0x177935=_0x29f02b['data'],_0x4dd824=_0x177935[_0x11ff20(0x121)]?_0x11ff20(0x129)+_0x177935[_0x11ff20(0x121)]+']':'',_0x4f21a8=_0x5c8f01?_0x11ff20(0x134)+_0x8103f1+'/'+_0x3da302+_0x11ff20(0x13b):'';console[_0x11ff20(0x118)]('✔\x20'+_0x4f21a8+_0x11ff20(0x12b)+formatRows(_0x177935[_0x11ff20(0x13a)][_0x11ff20(0x12e)])+_0x11ff20(0x14a)+(_0x11ff20(0x127)+formatElapsed(_0x177935[_0x11ff20(0x13a)][_0x11ff20(0x12d)])+_0x4dd824));if(_0x5c8f01&&_0x3f1e74){const _0x4fdbcd=resolveOutputOptions(_0x13794d),_0x566d9e=await formatQueryOutput(_0x177935,_0x4fdbcd);_0x13d971['push'](_0x566d9e);}else await handleQueryOutput(_0x177935,_0x13794d);}catch(_0x370376){const _0x19c2af=_0x5c8f01?'Statement\x20'+_0x8103f1+'/'+_0x3da302+':\x0a':'',_0x1effad=_0x370376 instanceof SDKError?_0x370376['originalMessage']:_0x370376[_0x11ff20(0x13f)];return console[_0x11ff20(0x118)](''+_0x19c2af+_0x1effad),0x1;}}if(_0x5855e2[_0x11ff20(0x116)]>0x1&&_0x3f1e74&&_0x13d971[_0x11ff20(0x116)]>0x0){const _0x4662ed=_0x13d971['join']('\x0a');writeFileSync(_0xc1909f[_0x11ff20(0x117)],_0x4662ed),console[_0x11ff20(0x118)](_0x11ff20(0x13d)+_0xc1909f['output']);}return 0x0;}catch(_0x1765e0){throw _0x1765e0;}}[a34_0xc36741(0x13c)](_0x1a29c4){const _0x4a7ccc=a34_0xc36741,_0x42fc7a=_0x1a29c4[_0x4a7ccc(0x137)][0x0],_0x3d19ea=_0x1a29c4[_0x4a7ccc(0x11e)][_0x4a7ccc(0x12a)];if(!_0x42fc7a&&!_0x3d19ea)return'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';if(_0x42fc7a&&_0x3d19ea)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}function a34_0x5cea(){const _0x3cf533=['options','41768NdUnGy','917DudYBV','jobId','120TvQCho','27778bMLrpE','Site:\x20','setExtra','query','in\x20','state','\x20[Job\x20ID:\x20','file','Query\x20completed:\x20Processed\x20','31330046CnehkJ','elapsedTimeMillis','processedRows','completedSplits','description','catalog','6IsJeZF','site','Statement\x20','230BhqWjg','Run\x20Trino\x20queries\x20(streaming)','args','name','Catalog:\x20','stats','\x20-\x20','validate','\x0aAll\x20results\x20saved\x20to\x20','1587980PwhoiN','message','12CtxRDm','No\x20SQL\x20provided','Executing\x20statement\x20','28791qqyAOL','Schema:\x20','Executing\x20query\x20[','SQL:\x20','execute','database','\x20splits','\x20rows\x20','192530mPptxj','verbose','length','output','error','Error:\x20','590788jmGvhn','setPhase','...','information_schema'];a34_0x5cea=function(){return _0x3cf533;};return a34_0x5cea();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a35_0x42a9e2=a35_0x53ea;(function(_0x363a0f,_0x2f692d){const _0x587a29=a35_0x53ea,_0x585be2=_0x363a0f();while(!![]){try{const _0x222df8=parseInt(_0x587a29(0x1e2))/0x1*(parseInt(_0x587a29(0x18d))/0x2)+parseInt(_0x587a29(0x206))/0x3+-parseInt(_0x587a29(0x1bf))/0x4+-parseInt(_0x587a29(0x1f6))/0x5+parseInt(_0x587a29(0x1f2))/0x6*(-parseInt(_0x587a29(0x1cb))/0x7)+-parseInt(_0x587a29(0x1cc))/0x8+-parseInt(_0x587a29(0x1ec))/0x9*(-parseInt(_0x587a29(0x1be))/0xa);if(_0x222df8===_0x2f692d)break;else _0x585be2['push'](_0x585be2['shift']());}catch(_0x54e5e1){_0x585be2['push'](_0x585be2['shift']());}}}(a35_0x1a6e,0xd01f7));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a35_0x1a6e(){const _0x4e1c73=['\x20matching\x20\x22','show','lastRun','last_job','\x22...','\x20(use\x20--limit\x20to\x20see\x20more)','success','delay','length','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20execution','Searching\x20scheduled\x20queries\x20matching\x20\x22','schedule:history','never','error','user_name','schedule:run','join','Listing\x20scheduled\x20queries...','schedules','No\x20scheduled\x20queries\x20found','nextRun','pagination','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','count','schedule:update','created_at','listQueries','ended_at','queryUrl','padEnd','jobs','Update\x20a\x20scheduled\x20query','engineVersion','List\x20scheduled\x20queries','10OTcotn','2602312CdKxQu','status','keys','args','delete','data','time_zone','Running\x20schedule...','verbose','Schedule\x20updated:\x20','query','getTime','7MdvMuq','246504xrBflr','\x20\x20Num:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','log','Failed\x20to\x20read\x20file:\x20','retry_limit','entries','retryLimit','file','\x20job','repeat','\x20\x20Type:\x20','dim','(unnamed)','name','yes','Creating\x20schedule:\x20','h\x20ago','trino','Show\x20schedule\x20details','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20run\x20submitted:\x20','164899LPlQsQ','job_id','start_at','list','queries','Cancelled','from','substring','user','next_run_at','21041181aAwPFg','\x20scheduled\x20quer','m\x20ago','time','format','\x20\x20Cron:\x20','6448626tPObIr','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','result','timezone','1061540nHwPbD','Delete\x20a\x20scheduled\x20query','INVALID_ARGUMENT','cron','history','tsv','type','Updating\x20schedule...','site','round','d\x20ago','scheduled_at','Creating\x20schedule...','trim','schedule:list','create','954399InSPXv','Found\x20','updated_at','Updating\x20schedule:\x20','num','in\x20','abs','jsonl','\x20\x20Timezone:\x20','Run\x20a\x20scheduled\x20query\x20immediately','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','...','utf-8','table','/app/queries/editor?queryId=','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Time:\x20','statusIcon','Schedule\x20deleted:\x20','schedule:show','executing_user_id','\x20created','database','cyan','validate','Getting\x20schedule\x20details...','2plcUMv','Create\x20a\x20scheduled\x20query','end_at','description','has_next_page','Showing\x20first\x20','priority','engine_version','📅\x20','just\x20now','execute','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','max','Deleting\x20schedule...'];a35_0x1a6e=function(){return _0x4e1c73;};return a35_0x1a6e();}import{hyperlink}from'../sdk/util/formatters.js';import a35_0x168a99 from'chalk';function a35_0x53ea(_0x6f2dd5,_0x3c2346){_0x6f2dd5=_0x6f2dd5-0x17a;const _0x1a6e5d=a35_0x1a6e();let _0x53ea56=_0x1a6e5d[_0x6f2dd5];return _0x53ea56;}function formatRelativeTime(_0x8b3818){const _0x3a6065=a35_0x53ea,_0x424b80=new Date(_0x8b3818),_0x5b5558=new Date(),_0x3c6fbf=_0x424b80['getTime']()-_0x5b5558[_0x3a6065(0x1ca)](),_0x61487f=Math[_0x3a6065(0x20c)](_0x3c6fbf)/0x3e8,_0x5909b3=_0x3c6fbf<0x0;if(_0x61487f<0x3c)return _0x5909b3?_0x3a6065(0x196):'soon';else{if(_0x61487f<0xe10){const _0x31645f=Math[_0x3a6065(0x1ff)](_0x61487f/0x3c);return _0x5909b3?_0x31645f+_0x3a6065(0x1ee):'in\x20'+_0x31645f+'m';}else{if(_0x61487f<0x15180){const _0x3ae283=Math[_0x3a6065(0x1ff)](_0x61487f/0xe10);return _0x5909b3?_0x3ae283+_0x3a6065(0x1dd):'in\x20'+_0x3ae283+'h';}else{if(_0x61487f<0x93a80){const _0x28483e=Math[_0x3a6065(0x1ff)](_0x61487f/0x15180);return _0x5909b3?_0x28483e+_0x3a6065(0x200):_0x3a6065(0x20b)+_0x28483e+'d';}else return _0x424b80['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a35_0x42a9e2(0x1da)]=a35_0x42a9e2(0x204);[a35_0x42a9e2(0x190)]=a35_0x42a9e2(0x1bd);async[a35_0x42a9e2(0x197)](_0x580191){const _0x219cb3=a35_0x42a9e2,{options:_0x371666,args:_0x3c600c,tdx:_0x34f2a2}=_0x580191,_0x389f51=resolveLimit(_0x371666['limit'],DEFAULT_DISPLAY_LIMIT),_0xa7e1d=_0x3c600c[0x0],_0x4a15c6=_0xa7e1d?_0x219cb3(0x1a6)+_0xa7e1d+_0x219cb3(0x19f):_0x219cb3(0x1ad),_0x1b2f31=await withSpinner(_0x4a15c6,()=>_0x34f2a2['schedules'][_0x219cb3(0x1b6)]({'limit':_0x389f51,'scheduled':!![],'pattern':_0xa7e1d}),{'verbose':_0x371666[_0x219cb3(0x1c7)]}),_0x2100c2=_0x1b2f31['data'][_0x219cb3(0x1e6)],_0x573b5a=_0x1b2f31['data'][_0x219cb3(0x1b1)][_0x219cb3(0x191)],_0x3f7d62=_0xa7e1d?_0x219cb3(0x19b)+_0xa7e1d+'\x22':'';_0x573b5a?console[_0x219cb3(0x1a9)](_0x219cb3(0x192)+_0x2100c2[_0x219cb3(0x1a3)]+'\x20schedules'+_0x3f7d62+_0x219cb3(0x1a0)):console['error']('Found\x20'+_0x2100c2[_0x219cb3(0x1a3)]+_0x219cb3(0x1ed)+(_0x2100c2['length']!==0x1?'ies':'y')+_0x3f7d62);if(_0x371666[_0x219cb3(0x1f0)]==='json'||_0x371666[_0x219cb3(0x1f0)]===_0x219cb3(0x20d)||_0x371666[_0x219cb3(0x1f0)]===_0x219cb3(0x17f)||_0x371666[_0x219cb3(0x1f0)]===_0x219cb3(0x1fb)){const _0x2abab0=_0x2100c2[_0x219cb3(0x181)](_0x30f1e6=>({'id':_0x30f1e6['id'],'name':_0x30f1e6['name'],'cron':_0x30f1e6[_0x219cb3(0x1f9)],'database':_0x30f1e6['database']?.[_0x219cb3(0x1da)],'type':_0x30f1e6[_0x219cb3(0x1fc)],'timezone':_0x30f1e6[_0x219cb3(0x1c5)],'user_name':_0x30f1e6[_0x219cb3(0x1ea)]?.[_0x219cb3(0x1da)],'updated_at':_0x30f1e6[_0x219cb3(0x208)],'next_run_at':_0x30f1e6[_0x219cb3(0x1eb)],'last_job_status':_0x30f1e6[_0x219cb3(0x19e)]?.['status']}));await handleSDKOutput(_0x2abab0,_0x371666);}else{if(_0x2100c2['length']===0x0)console[_0x219cb3(0x1cf)](_0x219cb3(0x1af));else{const _0x5a55ce=_0x371666[_0x219cb3(0x1fe)],_0x4c83f8=_0x2100c2[_0x219cb3(0x181)](_0x4353e9=>{const _0x772057=_0x219cb3,_0x71da2b=_0x4353e9['last_job']?.[_0x772057(0x1c0)]?_0x4353e9[_0x772057(0x19e)][_0x772057(0x1c0)]==='success'?'✓':'✗':'-',_0x109983=_0x4353e9['last_job']?.[_0x772057(0x1b7)]?formatRelativeTime(_0x4353e9['last_job']['ended_at']):_0x772057(0x1a8),_0x1c79db=_0x4353e9[_0x772057(0x1eb)]?formatRelativeTime(_0x4353e9[_0x772057(0x1eb)]):'-',_0x2b28c3=_0x4353e9[_0x772057(0x1f9)]||'',_0x2c3a0d=_0x4353e9[_0x772057(0x1da)]||_0x772057(0x1d9),_0x360231=getConsoleUrl(_0x5a55ce,_0x772057(0x180)+_0x4353e9['id']);return{'statusIcon':_0x71da2b,'lastRun':_0x109983,'nextRun':_0x1c79db,'cron':_0x2b28c3,'name':_0x2c3a0d,'queryUrl':_0x360231,'status':_0x4353e9['last_job']?.[_0x772057(0x1c0)]};}),_0x35b07b=Math[_0x219cb3(0x199)](..._0x4c83f8[_0x219cb3(0x181)](_0x37c5a2=>_0x37c5a2[_0x219cb3(0x19d)][_0x219cb3(0x1a3)])),_0x11960e=Math['max'](..._0x4c83f8['map'](_0x52e05f=>_0x52e05f[_0x219cb3(0x1b0)][_0x219cb3(0x1a3)])),_0x5d4c25=Math[_0x219cb3(0x199)](..._0x4c83f8[_0x219cb3(0x181)](_0x3a5b68=>_0x3a5b68[_0x219cb3(0x1f9)][_0x219cb3(0x1a3)])),_0x43d585=_0x4c83f8[_0x219cb3(0x181)](_0x5afe15=>{const _0xa9f241=_0x219cb3,_0x5c876e=_0x5afe15['status']===_0xa9f241(0x1a1)?a35_0x168a99['green'](_0x5afe15['statusIcon']):_0x5afe15['status']===_0xa9f241(0x1a9)?a35_0x168a99['red'](_0x5afe15[_0xa9f241(0x184)]):a35_0x168a99[_0xa9f241(0x1d8)](_0x5afe15[_0xa9f241(0x184)]),_0x36ff1d=_0x5afe15[_0xa9f241(0x19d)][_0xa9f241(0x1b9)](_0x35b07b),_0x2f300b=_0x5afe15[_0xa9f241(0x1b0)][_0xa9f241(0x1b9)](_0x11960e),_0x333ad6=_0x5afe15[_0xa9f241(0x1f9)]?a35_0x168a99[_0xa9f241(0x18a)](_0x5afe15[_0xa9f241(0x1f9)][_0xa9f241(0x1b9)](_0x5d4c25)):'\x20'[_0xa9f241(0x1d6)](_0x5d4c25),_0x4821a7=hyperlink(_0x5afe15[_0xa9f241(0x1da)],_0x5afe15[_0xa9f241(0x1b8)]);return _0xa9f241(0x195)+_0x5c876e+'\x20'+_0x36ff1d+'\x20\x20→\x20'+_0x2f300b+'\x20\x20'+_0x333ad6+'\x20\x20'+_0x4821a7;});await writeOutput(_0x43d585[_0x219cb3(0x1ac)]('\x0a'),_0x371666['output'],_0x219cb3(0x1e5));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a35_0x42a9e2(0x1da)]=a35_0x42a9e2(0x186);[a35_0x42a9e2(0x190)]=a35_0x42a9e2(0x1df);[a35_0x42a9e2(0x18b)](_0x51cf73){const _0x584023=a35_0x42a9e2,_0x1978fb=_0x51cf73[_0x584023(0x1c2)][0x0];if(!_0x1978fb)return _0x584023(0x1b2);return undefined;}async[a35_0x42a9e2(0x197)](_0x24ba04){const _0x3f2d57=a35_0x42a9e2,{options:_0x5ab8fb,args:_0xfbe77e,tdx:_0x28e1f6}=_0x24ba04,_0x1bef0d=_0xfbe77e[0x0],_0x58e008=await withSpinner(_0x3f2d57(0x18c),()=>_0x28e1f6[_0x3f2d57(0x1ae)][_0x3f2d57(0x19c)](_0x1bef0d),{'verbose':_0x5ab8fb[_0x3f2d57(0x1c7)]}),_0x2f63d2=_0x58e008[_0x3f2d57(0x1c4)],_0x2f735e={'name':_0x2f63d2[_0x3f2d57(0x1da)],'cron':_0x2f63d2['cron'],'database':_0x2f63d2[_0x3f2d57(0x189)],'type':_0x2f63d2[_0x3f2d57(0x1fc)],'timezone':_0x2f63d2[_0x3f2d57(0x1f5)],'user_name':_0x2f63d2[_0x3f2d57(0x1aa)],'created_at':_0x2f63d2[_0x3f2d57(0x1b5)],'engine_version':_0x2f63d2[_0x3f2d57(0x194)],'executing_user_id':_0x2f63d2[_0x3f2d57(0x187)],'query':_0x2f63d2[_0x3f2d57(0x1c9)],'delay':_0x2f63d2[_0x3f2d57(0x1a2)],'priority':_0x2f63d2[_0x3f2d57(0x193)],'retry_limit':_0x2f63d2[_0x3f2d57(0x1d1)],..._0x2f63d2[_0x3f2d57(0x1f4)]&&{'result':_0x2f63d2['result']}};return await handleSingleObjectOutput(_0x2f735e,_0x5ab8fb),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a35_0x42a9e2(0x1da)]='schedule:create';[a35_0x42a9e2(0x190)]=a35_0x42a9e2(0x18e);[a35_0x42a9e2(0x18b)](_0x153d1f){const _0x39127c=a35_0x42a9e2,_0x10e4bb=_0x153d1f[_0x39127c(0x1c2)][0x0];if(!_0x10e4bb)return _0x39127c(0x182);const _0x1d99b2=_0x153d1f['options'];if(!_0x1d99b2[_0x39127c(0x189)])return _0x39127c(0x1e0);return undefined;}async[a35_0x42a9e2(0x197)](_0x55b6f5){const _0x31c463=a35_0x42a9e2,{options:_0x393296,args:_0x44b3b3,tdx:_0x206d4f}=_0x55b6f5,_0xc521b9=_0x44b3b3[0x0],_0x43dcb6=_0x393296,_0x58873d=_0x43dcb6['database'],_0xc596a7=_0x43dcb6[_0x31c463(0x1d4)],_0x2c56cd=_0x43dcb6['type']||_0x31c463(0x1de);let _0x174d57;try{_0x174d57=readFileSync(_0xc596a7,_0x31c463(0x17e))[_0x31c463(0x203)]();}catch(_0x77ff2d){throw new SDKError(ErrorCode[_0x31c463(0x1f8)],_0x31c463(0x1d0)+_0xc596a7,_0x77ff2d instanceof Error?_0x77ff2d:undefined);}if(!_0x174d57)throw new SDKError(ErrorCode[_0x31c463(0x1f8)],'Query\x20file\x20is\x20empty');const _0x4cb0ef={'database':_0x58873d,'query':_0x174d57,'type':_0x2c56cd};if(_0x43dcb6['cron'])_0x4cb0ef[_0x31c463(0x1f9)]=_0x43dcb6['cron'];if(_0x43dcb6[_0x31c463(0x1f5)])_0x4cb0ef[_0x31c463(0x1f5)]=_0x43dcb6[_0x31c463(0x1f5)];if(_0x43dcb6[_0x31c463(0x1a2)]!==undefined)_0x4cb0ef[_0x31c463(0x1a2)]=Number(_0x43dcb6[_0x31c463(0x1a2)]);if(_0x43dcb6[_0x31c463(0x193)]!==undefined)_0x4cb0ef[_0x31c463(0x193)]=Number(_0x43dcb6[_0x31c463(0x193)]);if(_0x43dcb6[_0x31c463(0x1d3)]!==undefined)_0x4cb0ef[_0x31c463(0x1d1)]=Number(_0x43dcb6['retryLimit']);if(_0x43dcb6[_0x31c463(0x1bc)])_0x4cb0ef[_0x31c463(0x194)]=_0x43dcb6[_0x31c463(0x1bc)];if(_0x43dcb6[_0x31c463(0x1f4)])_0x4cb0ef['result']=_0x43dcb6[_0x31c463(0x1f4)];if(_0x393296[_0x31c463(0x1c7)]){console[_0x31c463(0x1a9)](_0x31c463(0x1dc)+_0xc521b9),console[_0x31c463(0x1a9)]('\x20\x20Database:\x20'+_0x58873d),console[_0x31c463(0x1a9)](_0x31c463(0x1d7)+_0x2c56cd);if(_0x4cb0ef[_0x31c463(0x1f9)])console[_0x31c463(0x1a9)](_0x31c463(0x1f1)+_0x4cb0ef[_0x31c463(0x1f9)]);if(_0x4cb0ef['timezone'])console[_0x31c463(0x1a9)](_0x31c463(0x17a)+_0x4cb0ef[_0x31c463(0x1f5)]);}const _0x23b7f8=await withSpinner(_0x31c463(0x202),()=>_0x206d4f[_0x31c463(0x1ae)][_0x31c463(0x205)](_0xc521b9,_0x4cb0ef),{'verbose':_0x393296[_0x31c463(0x1c7)]});return console[_0x31c463(0x1a9)]('Schedule\x20created:\x20'+_0x23b7f8[_0x31c463(0x1c4)]['name']),await handleSingleObjectOutput(_0x23b7f8[_0x31c463(0x1c4)],_0x393296),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a35_0x42a9e2(0x1b4);[a35_0x42a9e2(0x190)]=a35_0x42a9e2(0x1bb);[a35_0x42a9e2(0x18b)](_0x5cec79){const _0x1f617f=a35_0x42a9e2,_0x4c844b=_0x5cec79[_0x1f617f(0x1c2)][0x0];if(!_0x4c844b)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a35_0x42a9e2(0x197)](_0x1a06c7){const _0x31efc3=a35_0x42a9e2,{options:_0x145cba,args:_0x328137,tdx:_0x1933e9}=_0x1a06c7,_0xbfc238=_0x328137[0x0],_0x4e0966=_0x145cba,_0x8156dd={};if(_0x4e0966[_0x31efc3(0x189)])_0x8156dd['database']=_0x4e0966['database'];if(_0x4e0966[_0x31efc3(0x1fc)])_0x8156dd[_0x31efc3(0x1fc)]=_0x4e0966[_0x31efc3(0x1fc)];if(_0x4e0966[_0x31efc3(0x1f9)])_0x8156dd[_0x31efc3(0x1f9)]=_0x4e0966[_0x31efc3(0x1f9)];if(_0x4e0966[_0x31efc3(0x1f5)])_0x8156dd[_0x31efc3(0x1f5)]=_0x4e0966[_0x31efc3(0x1f5)];if(_0x4e0966['delay']!==undefined)_0x8156dd[_0x31efc3(0x1a2)]=Number(_0x4e0966['delay']);if(_0x4e0966[_0x31efc3(0x193)]!==undefined)_0x8156dd['priority']=Number(_0x4e0966[_0x31efc3(0x193)]);if(_0x4e0966['retryLimit']!==undefined)_0x8156dd['retry_limit']=Number(_0x4e0966[_0x31efc3(0x1d3)]);if(_0x4e0966[_0x31efc3(0x1bc)])_0x8156dd[_0x31efc3(0x194)]=_0x4e0966[_0x31efc3(0x1bc)];if(_0x4e0966[_0x31efc3(0x1f4)])_0x8156dd['result']=_0x4e0966['result'];if(_0x4e0966[_0x31efc3(0x1d4)])try{_0x8156dd[_0x31efc3(0x1c9)]=readFileSync(_0x4e0966[_0x31efc3(0x1d4)],'utf-8')[_0x31efc3(0x203)]();}catch(_0x5e5ff4){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x4e0966['file'],_0x5e5ff4 instanceof Error?_0x5e5ff4:undefined);}if(Object[_0x31efc3(0x1c1)](_0x8156dd)['length']===0x0)throw new SDKError(ErrorCode[_0x31efc3(0x1f8)],_0x31efc3(0x198));if(_0x145cba[_0x31efc3(0x1c7)]){console[_0x31efc3(0x1a9)](_0x31efc3(0x209)+_0xbfc238);for(const [_0x4a1a2b,_0x575976]of Object[_0x31efc3(0x1d2)](_0x8156dd)){_0x4a1a2b===_0x31efc3(0x1c9)?console[_0x31efc3(0x1a9)]('\x20\x20'+_0x4a1a2b+':\x20'+_0x575976[_0x31efc3(0x1e9)](0x0,0x32)+_0x31efc3(0x17d)):console[_0x31efc3(0x1a9)]('\x20\x20'+_0x4a1a2b+':\x20'+_0x575976);}}const _0x370ffb=await withSpinner(_0x31efc3(0x1fd),()=>_0x1933e9[_0x31efc3(0x1ae)]['update'](_0xbfc238,_0x8156dd),{'verbose':_0x145cba[_0x31efc3(0x1c7)]});return console[_0x31efc3(0x1a9)](_0x31efc3(0x1c8)+_0x370ffb['data']['name']),await handleSingleObjectOutput(_0x370ffb[_0x31efc3(0x1c4)],_0x145cba),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';['description']=a35_0x42a9e2(0x1f7);['validate'](_0x2e8bb5){const _0x512f9d=a35_0x42a9e2,_0x457007=_0x2e8bb5[_0x512f9d(0x1c2)][0x0];if(!_0x457007)return _0x512f9d(0x1a4);return undefined;}async[a35_0x42a9e2(0x197)](_0x2cb90f){const _0x2cb4c0=a35_0x42a9e2,{options:_0x21af3c,args:_0x2d016e,tdx:_0x39cfc2}=_0x2cb90f,_0x1eb8f1=_0x2d016e[0x0];if(!_0x21af3c[_0x2cb4c0(0x1db)]){const _0x650fc2=await confirm(_0x2cb4c0(0x1ce)+_0x1eb8f1+'\x22?');if(!_0x650fc2)return console[_0x2cb4c0(0x1a9)](_0x2cb4c0(0x1e7)),0x0;}const _0x22c0e4=await withSpinner(_0x2cb4c0(0x19a),()=>_0x39cfc2[_0x2cb4c0(0x1ae)][_0x2cb4c0(0x1c3)](_0x1eb8f1),{'verbose':_0x21af3c[_0x2cb4c0(0x1c7)]});return console[_0x2cb4c0(0x1a9)](_0x2cb4c0(0x185)+_0x22c0e4[_0x2cb4c0(0x1c4)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x42a9e2(0x1da)]=a35_0x42a9e2(0x1ab);[a35_0x42a9e2(0x190)]=a35_0x42a9e2(0x17b);[a35_0x42a9e2(0x18b)](_0x4e544c){const _0x4cc60f=a35_0x42a9e2,_0x221665=_0x4e544c[_0x4cc60f(0x1c2)][0x0];if(!_0x221665)return _0x4cc60f(0x1f3);return undefined;}async[a35_0x42a9e2(0x197)](_0x3e540e){const _0x3d9e54=a35_0x42a9e2,{options:_0x163bbf,args:_0x256275,tdx:_0x5cc04b}=_0x3e540e,_0x4a5936=_0x256275[0x0],_0x286477=_0x163bbf,_0x301ebf=_0x286477[_0x3d9e54(0x1ef)],_0x33a459=_0x286477[_0x3d9e54(0x20a)]!==undefined?Number(_0x286477[_0x3d9e54(0x20a)]):undefined;if(_0x163bbf[_0x3d9e54(0x1c7)]){console[_0x3d9e54(0x1a9)]('Running\x20schedule:\x20'+_0x4a5936);if(_0x301ebf)console[_0x3d9e54(0x1a9)](_0x3d9e54(0x183)+_0x301ebf);if(_0x33a459)console['error'](_0x3d9e54(0x1cd)+_0x33a459);}const _0x410b28=await withSpinner(_0x3d9e54(0x1c6),()=>_0x5cc04b[_0x3d9e54(0x1ae)]['run'](_0x4a5936,{'time':_0x301ebf,'num':_0x33a459}),{'verbose':_0x163bbf[_0x3d9e54(0x1c7)]}),_0x5dbb54=_0x410b28[_0x3d9e54(0x1c4)][_0x3d9e54(0x1ba)];console[_0x3d9e54(0x1a9)](_0x3d9e54(0x1e1)+_0x5dbb54[_0x3d9e54(0x1a3)]+_0x3d9e54(0x1d5)+(_0x5dbb54['length']!==0x1?'s':'')+_0x3d9e54(0x188));for(const _0x326d97 of _0x5dbb54){console[_0x3d9e54(0x1a9)]('\x20\x20Job\x20ID:\x20'+_0x326d97[_0x3d9e54(0x1e3)]);}return await handleSDKOutput(_0x5dbb54,_0x163bbf),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a35_0x42a9e2(0x1a7);[a35_0x42a9e2(0x190)]='Show\x20schedule\x20execution\x20history';[a35_0x42a9e2(0x18b)](_0x2de377){const _0x4d8628=a35_0x42a9e2,_0x277fab=_0x2de377[_0x4d8628(0x1c2)][0x0];if(!_0x277fab)return _0x4d8628(0x17c);return undefined;}async[a35_0x42a9e2(0x197)](_0x548329){const _0x42281f=a35_0x42a9e2,{options:_0x20ddca,args:_0x5b15d4,tdx:_0x4757c2}=_0x548329,_0x1496ad=_0x5b15d4[0x0],_0x228584=_0x20ddca,_0x19384f=_0x228584['from']!==undefined?Number(_0x228584['from']):undefined,_0x195064=_0x228584['to']!==undefined?Number(_0x228584['to']):undefined,_0x532856=await withSpinner('Getting\x20schedule\x20history...',()=>_0x4757c2['schedules']['history'](_0x1496ad,{'from':_0x19384f,'to':_0x195064}),{'verbose':_0x20ddca[_0x42281f(0x1c7)]}),_0x36895d=_0x532856['data'];console[_0x42281f(0x1a9)](_0x42281f(0x207)+_0x36895d[_0x42281f(0x1b3)]+_0x42281f(0x1a5)+(_0x36895d['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x36895d[_0x42281f(0x1e8)]+'-'+_0x36895d['to']+')');const _0x2a0320=_0x36895d[_0x42281f(0x1fa)][_0x42281f(0x181)](_0x5b122f=>({'job_id':_0x5b122f[_0x42281f(0x1e3)],'type':_0x5b122f[_0x42281f(0x1fc)],'status':_0x5b122f[_0x42281f(0x1c0)],'scheduled_at':_0x5b122f[_0x42281f(0x201)],'created_at':_0x5b122f[_0x42281f(0x1b5)],'start_at':_0x5b122f[_0x42281f(0x1e4)],'end_at':_0x5b122f[_0x42281f(0x18f)]}));return await handleSDKOutput(_0x2a0320,_0x20ddca),0x0;}}
|
|
1
|
+
const a35_0x46f486=a35_0x4f07;(function(_0x42f86e,_0x599319){const _0x3a5162=a35_0x4f07,_0x4b735f=_0x42f86e();while(!![]){try{const _0x468cc2=parseInt(_0x3a5162(0x10b))/0x1*(-parseInt(_0x3a5162(0x138))/0x2)+-parseInt(_0x3a5162(0x106))/0x3+-parseInt(_0x3a5162(0xf0))/0x4+-parseInt(_0x3a5162(0xec))/0x5+parseInt(_0x3a5162(0x115))/0x6+-parseInt(_0x3a5162(0x135))/0x7+parseInt(_0x3a5162(0x143))/0x8;if(_0x468cc2===_0x599319)break;else _0x4b735f['push'](_0x4b735f['shift']());}catch(_0x418edb){_0x4b735f['push'](_0x4b735f['shift']());}}}(a35_0x18ef,0x68f72));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a35_0x4f07(_0x3ca3ed,_0xd1412b){_0x3ca3ed=_0x3ca3ed-0xd6;const _0x18ef1d=a35_0x18ef();let _0x4f07da=_0x18ef1d[_0x3ca3ed];return _0x4f07da;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a35_0x18ef(){const _0x46001b=['Getting\x20schedule\x20details...','Found\x20','\x20(showing\x20','update','Listing\x20scheduled\x20queries...','run','json','format','end_at','num','queries','in\x20','Deleting\x20schedule...','output','limit','create','/app/queries/editor?queryId=','repeat','Delete\x20a\x20scheduled\x20query','keys','delay','engineVersion','priority','getTime','toLocaleDateString','3936330FlusLB','engine_version','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','List\x20scheduled\x20queries','1128472ZlWRHQ','query','site','execute','schedules','queryUrl','Query\x20file\x20is\x20empty','INVALID_ARGUMENT','user','padEnd','Running\x20schedule:\x20','show','retryLimit','cron','cyan','created_at','Updating\x20schedule...','Failed\x20to\x20read\x20file:\x20','options','\x20matching\x20\x22','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','entries','749598deYWnf','nextRun','list','timezone','\x20\x20Job\x20ID:\x20','11rwrFWR','dim','error','pagination','ended_at','lastRun','m\x20ago','status','join','jobs','2748150rzkQtw','Getting\x20schedule\x20history...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','verbose','schedule:update','scheduled_at','h\x20ago','time_zone','Create\x20a\x20scheduled\x20query','round','📅\x20','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','(unnamed)','\x20\x20Timezone:\x20','...','retry_limit','Showing\x20first\x20','data','args','Schedule\x20deleted:\x20','Show\x20schedule\x20details','type','listQueries','abs','\x20\x20Num:\x20','statusIcon','count','jsonl','database','next_run_at','3491264VjjuAM','updated_at','Update\x20a\x20scheduled\x20query','116898NQbdSH','schedule:run','\x20\x20Database:\x20','yes','Searching\x20scheduled\x20queries\x20matching\x20\x22','job_id','trim','last_job','substring','schedule:list','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','19462832xjSFyQ','map','\x20\x20→\x20','time','\x20scheduled\x20quer','result','history','success','schedule:delete','from','max','file','Cancelled','No\x20scheduled\x20queries\x20found','description','green','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','length','schedule:create','Run\x20a\x20scheduled\x20query\x20immediately','\x22...','executing_user_id','name'];a35_0x18ef=function(){return _0x46001b;};return a35_0x18ef();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a35_0x351e33 from'chalk';function formatRelativeTime(_0x110b25){const _0x55284c=a35_0x4f07,_0x402838=new Date(_0x110b25),_0x1d8c67=new Date(),_0x3481c7=_0x402838[_0x55284c(0xea)]()-_0x1d8c67['getTime'](),_0x49e883=Math[_0x55284c(0x12e)](_0x3481c7)/0x3e8,_0x353536=_0x3481c7<0x0;if(_0x49e883<0x3c)return _0x353536?'just\x20now':'soon';else{if(_0x49e883<0xe10){const _0x306e3b=Math[_0x55284c(0x11e)](_0x49e883/0x3c);return _0x353536?_0x306e3b+_0x55284c(0x111):_0x55284c(0xde)+_0x306e3b+'m';}else{if(_0x49e883<0x15180){const _0x46a11f=Math[_0x55284c(0x11e)](_0x49e883/0xe10);return _0x353536?_0x46a11f+_0x55284c(0x11b):'in\x20'+_0x46a11f+'h';}else{if(_0x49e883<0x93a80){const _0x47e647=Math['round'](_0x49e883/0x15180);return _0x353536?_0x47e647+_0x55284c(0x153):_0x55284c(0xde)+_0x47e647+'d';}else return _0x402838[_0x55284c(0xeb)]();}}}}export class ScheduleListCommand extends BaseCommand{[a35_0x46f486(0x15a)]=a35_0x46f486(0x141);[a35_0x46f486(0x151)]=a35_0x46f486(0xef);async[a35_0x46f486(0xf3)](_0x1c4fde){const _0x35507c=a35_0x46f486,{options:_0x4e848d,args:_0x2531f9,tdx:_0x57e1bf}=_0x1c4fde,_0x35308b=resolveLimit(_0x4e848d[_0x35507c(0xe1)],DEFAULT_DISPLAY_LIMIT),_0x26cc3b=_0x2531f9[0x0],_0x2d220e=_0x26cc3b?_0x35507c(0x13c)+_0x26cc3b+_0x35507c(0x158):_0x35507c(0xd7),_0x24c927=await withSpinner(_0x2d220e,()=>_0x57e1bf[_0x35507c(0xf4)][_0x35507c(0x12d)]({'limit':_0x35308b,'scheduled':!![],'pattern':_0x26cc3b}),{'verbose':_0x4e848d['verbose']}),_0x3bfd3e=_0x24c927[_0x35507c(0x128)][_0x35507c(0xdd)],_0x2bbb58=_0x24c927['data'][_0x35507c(0x10e)]['has_next_page'],_0x29df5c=_0x26cc3b?_0x35507c(0x103)+_0x26cc3b+'\x22':'';_0x2bbb58?console[_0x35507c(0x10d)](_0x35507c(0x127)+_0x3bfd3e[_0x35507c(0x155)]+'\x20schedules'+_0x29df5c+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x35507c(0x10d)](_0x35507c(0x15c)+_0x3bfd3e[_0x35507c(0x155)]+_0x35507c(0x147)+(_0x3bfd3e[_0x35507c(0x155)]!==0x1?'ies':'y')+_0x29df5c);if(_0x4e848d[_0x35507c(0xda)]===_0x35507c(0xd9)||_0x4e848d[_0x35507c(0xda)]===_0x35507c(0x132)||_0x4e848d[_0x35507c(0xda)]==='table'||_0x4e848d[_0x35507c(0xda)]==='tsv'){const _0x511a8c=_0x3bfd3e[_0x35507c(0x144)](_0x5e734e=>({'id':_0x5e734e['id'],'name':_0x5e734e[_0x35507c(0x15a)],'cron':_0x5e734e[_0x35507c(0xfd)],'database':_0x5e734e['database']?.[_0x35507c(0x15a)],'type':_0x5e734e[_0x35507c(0x12c)],'timezone':_0x5e734e[_0x35507c(0x11c)],'user_name':_0x5e734e[_0x35507c(0xf8)]?.[_0x35507c(0x15a)],'updated_at':_0x5e734e[_0x35507c(0x136)],'next_run_at':_0x5e734e[_0x35507c(0x134)],'last_job_status':_0x5e734e[_0x35507c(0x13f)]?.['status']}));await handleSDKOutput(_0x511a8c,_0x4e848d);}else{if(_0x3bfd3e[_0x35507c(0x155)]===0x0)console['log'](_0x35507c(0x150));else{const _0x3f1588=_0x4e848d[_0x35507c(0xf2)],_0x2b482f=_0x3bfd3e[_0x35507c(0x144)](_0x1936de=>{const _0x573f19=_0x35507c,_0x3248cf=_0x1936de[_0x573f19(0x13f)]?.['status']?_0x1936de[_0x573f19(0x13f)][_0x573f19(0x112)]===_0x573f19(0x14a)?'✓':'✗':'-',_0x6d3f0b=_0x1936de[_0x573f19(0x13f)]?.['ended_at']?formatRelativeTime(_0x1936de['last_job'][_0x573f19(0x10f)]):'never',_0x661b9b=_0x1936de['next_run_at']?formatRelativeTime(_0x1936de['next_run_at']):'-',_0x31d244=_0x1936de['cron']||'',_0xedfbc3=_0x1936de['name']||_0x573f19(0x123),_0x5d1d48=getConsoleUrl(_0x3f1588,_0x573f19(0xe3)+_0x1936de['id']);return{'statusIcon':_0x3248cf,'lastRun':_0x6d3f0b,'nextRun':_0x661b9b,'cron':_0x31d244,'name':_0xedfbc3,'queryUrl':_0x5d1d48,'status':_0x1936de[_0x573f19(0x13f)]?.[_0x573f19(0x112)]};}),_0x4d06a5=Math[_0x35507c(0x14d)](..._0x2b482f[_0x35507c(0x144)](_0x5a8184=>_0x5a8184[_0x35507c(0x110)][_0x35507c(0x155)])),_0x2b8c9a=Math[_0x35507c(0x14d)](..._0x2b482f[_0x35507c(0x144)](_0x4760e1=>_0x4760e1[_0x35507c(0x107)][_0x35507c(0x155)])),_0x368f9a=Math[_0x35507c(0x14d)](..._0x2b482f[_0x35507c(0x144)](_0x1ca7fc=>_0x1ca7fc[_0x35507c(0xfd)][_0x35507c(0x155)])),_0x52bcc1=_0x2b482f[_0x35507c(0x144)](_0x5b657f=>{const _0x42bb60=_0x35507c,_0x2c058d=_0x5b657f[_0x42bb60(0x112)]===_0x42bb60(0x14a)?a35_0x351e33[_0x42bb60(0x152)](_0x5b657f[_0x42bb60(0x130)]):_0x5b657f[_0x42bb60(0x112)]===_0x42bb60(0x10d)?a35_0x351e33['red'](_0x5b657f[_0x42bb60(0x130)]):a35_0x351e33[_0x42bb60(0x10c)](_0x5b657f[_0x42bb60(0x130)]),_0x463eea=_0x5b657f[_0x42bb60(0x110)][_0x42bb60(0xf9)](_0x4d06a5),_0x356b51=_0x5b657f['nextRun']['padEnd'](_0x2b8c9a),_0x209a06=_0x5b657f['cron']?a35_0x351e33[_0x42bb60(0xfe)](_0x5b657f[_0x42bb60(0xfd)][_0x42bb60(0xf9)](_0x368f9a)):'\x20'[_0x42bb60(0xe4)](_0x368f9a),_0x39a35c=hyperlink(_0x5b657f[_0x42bb60(0x15a)],_0x5b657f[_0x42bb60(0xf5)]);return _0x42bb60(0x11f)+_0x2c058d+'\x20'+_0x463eea+_0x42bb60(0x145)+_0x356b51+'\x20\x20'+_0x209a06+'\x20\x20'+_0x39a35c;});await writeOutput(_0x52bcc1[_0x35507c(0x113)]('\x0a'),_0x4e848d[_0x35507c(0xe0)],_0x35507c(0x108));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a35_0x46f486(0x15a)]='schedule:show';[a35_0x46f486(0x151)]=a35_0x46f486(0x12b);[a35_0x46f486(0x122)](_0x45bae3){const _0x83b276=a35_0x46f486,_0x34d3ed=_0x45bae3[_0x83b276(0x129)][0x0];if(!_0x34d3ed)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a35_0x46f486(0xf3)](_0x3c4cb2){const _0x42a914=a35_0x46f486,{options:_0x44fbfb,args:_0xefe03,tdx:_0x395133}=_0x3c4cb2,_0x4ee5ea=_0xefe03[0x0],_0x5e9a53=await withSpinner(_0x42a914(0x15b),()=>_0x395133['schedules'][_0x42a914(0xfb)](_0x4ee5ea),{'verbose':_0x44fbfb['verbose']}),_0x105db4=_0x5e9a53['data'],_0x30d523={'name':_0x105db4['name'],'cron':_0x105db4['cron'],'database':_0x105db4['database'],'type':_0x105db4[_0x42a914(0x12c)],'timezone':_0x105db4['timezone'],'user_name':_0x105db4['user_name'],'created_at':_0x105db4['created_at'],'engine_version':_0x105db4[_0x42a914(0xed)],'executing_user_id':_0x105db4[_0x42a914(0x159)],'query':_0x105db4['query'],'delay':_0x105db4[_0x42a914(0xe7)],'priority':_0x105db4[_0x42a914(0xe9)],'retry_limit':_0x105db4[_0x42a914(0x126)],..._0x105db4[_0x42a914(0x148)]&&{'result':_0x105db4[_0x42a914(0x148)]}};return await handleSingleObjectOutput(_0x30d523,_0x44fbfb),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a35_0x46f486(0x156);['description']=a35_0x46f486(0x11d);[a35_0x46f486(0x122)](_0x4886be){const _0x5afc9f=a35_0x46f486,_0x116126=_0x4886be[_0x5afc9f(0x129)][0x0];if(!_0x116126)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x9dedbf=_0x4886be[_0x5afc9f(0x102)];if(!_0x9dedbf['database'])return _0x5afc9f(0x120);return undefined;}async[a35_0x46f486(0xf3)](_0x1b7a9e){const _0x1fa4b3=a35_0x46f486,{options:_0x4315dd,args:_0x5395f0,tdx:_0x3d79cd}=_0x1b7a9e,_0x32865b=_0x5395f0[0x0],_0x164431=_0x4315dd,_0x39694e=_0x164431['database'],_0x33781c=_0x164431[_0x1fa4b3(0x14e)],_0x13af5b=_0x164431[_0x1fa4b3(0x12c)]||'trino';let _0x597678;try{_0x597678=readFileSync(_0x33781c,'utf-8')[_0x1fa4b3(0x13e)]();}catch(_0x2c934e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1fa4b3(0x101)+_0x33781c,_0x2c934e instanceof Error?_0x2c934e:undefined);}if(!_0x597678)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1fa4b3(0xf6));const _0x5186ff={'database':_0x39694e,'query':_0x597678,'type':_0x13af5b};if(_0x164431['cron'])_0x5186ff['cron']=_0x164431[_0x1fa4b3(0xfd)];if(_0x164431[_0x1fa4b3(0x109)])_0x5186ff['timezone']=_0x164431[_0x1fa4b3(0x109)];if(_0x164431[_0x1fa4b3(0xe7)]!==undefined)_0x5186ff[_0x1fa4b3(0xe7)]=Number(_0x164431['delay']);if(_0x164431[_0x1fa4b3(0xe9)]!==undefined)_0x5186ff[_0x1fa4b3(0xe9)]=Number(_0x164431[_0x1fa4b3(0xe9)]);if(_0x164431[_0x1fa4b3(0xfc)]!==undefined)_0x5186ff[_0x1fa4b3(0x126)]=Number(_0x164431[_0x1fa4b3(0xfc)]);if(_0x164431[_0x1fa4b3(0xe8)])_0x5186ff[_0x1fa4b3(0xed)]=_0x164431[_0x1fa4b3(0xe8)];if(_0x164431[_0x1fa4b3(0x148)])_0x5186ff[_0x1fa4b3(0x148)]=_0x164431[_0x1fa4b3(0x148)];if(_0x4315dd[_0x1fa4b3(0x118)]){console[_0x1fa4b3(0x10d)]('Creating\x20schedule:\x20'+_0x32865b),console[_0x1fa4b3(0x10d)](_0x1fa4b3(0x13a)+_0x39694e),console[_0x1fa4b3(0x10d)]('\x20\x20Type:\x20'+_0x13af5b);if(_0x5186ff['cron'])console[_0x1fa4b3(0x10d)]('\x20\x20Cron:\x20'+_0x5186ff[_0x1fa4b3(0xfd)]);if(_0x5186ff[_0x1fa4b3(0x109)])console[_0x1fa4b3(0x10d)](_0x1fa4b3(0x124)+_0x5186ff[_0x1fa4b3(0x109)]);}const _0x5a88d9=await withSpinner('Creating\x20schedule...',()=>_0x3d79cd[_0x1fa4b3(0xf4)][_0x1fa4b3(0xe2)](_0x32865b,_0x5186ff),{'verbose':_0x4315dd[_0x1fa4b3(0x118)]});return console['error']('Schedule\x20created:\x20'+_0x5a88d9['data']['name']),await handleSingleObjectOutput(_0x5a88d9['data'],_0x4315dd),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a35_0x46f486(0x15a)]=a35_0x46f486(0x119);[a35_0x46f486(0x151)]=a35_0x46f486(0x137);['validate'](_0x1cc9e3){const _0x59ea45=a35_0x46f486,_0xc0bdbd=_0x1cc9e3[_0x59ea45(0x129)][0x0];if(!_0xc0bdbd)return _0x59ea45(0x121);return undefined;}async[a35_0x46f486(0xf3)](_0x39ac15){const _0x24bcce=a35_0x46f486,{options:_0xa93095,args:_0x3f5685,tdx:_0x18cea2}=_0x39ac15,_0x286233=_0x3f5685[0x0],_0x5dfc42=_0xa93095,_0x3b3335={};if(_0x5dfc42[_0x24bcce(0x133)])_0x3b3335[_0x24bcce(0x133)]=_0x5dfc42[_0x24bcce(0x133)];if(_0x5dfc42[_0x24bcce(0x12c)])_0x3b3335['type']=_0x5dfc42[_0x24bcce(0x12c)];if(_0x5dfc42[_0x24bcce(0xfd)])_0x3b3335[_0x24bcce(0xfd)]=_0x5dfc42[_0x24bcce(0xfd)];if(_0x5dfc42[_0x24bcce(0x109)])_0x3b3335['timezone']=_0x5dfc42[_0x24bcce(0x109)];if(_0x5dfc42[_0x24bcce(0xe7)]!==undefined)_0x3b3335[_0x24bcce(0xe7)]=Number(_0x5dfc42[_0x24bcce(0xe7)]);if(_0x5dfc42[_0x24bcce(0xe9)]!==undefined)_0x3b3335[_0x24bcce(0xe9)]=Number(_0x5dfc42['priority']);if(_0x5dfc42[_0x24bcce(0xfc)]!==undefined)_0x3b3335['retry_limit']=Number(_0x5dfc42[_0x24bcce(0xfc)]);if(_0x5dfc42[_0x24bcce(0xe8)])_0x3b3335[_0x24bcce(0xed)]=_0x5dfc42[_0x24bcce(0xe8)];if(_0x5dfc42[_0x24bcce(0x148)])_0x3b3335['result']=_0x5dfc42[_0x24bcce(0x148)];if(_0x5dfc42[_0x24bcce(0x14e)])try{_0x3b3335[_0x24bcce(0xf1)]=readFileSync(_0x5dfc42[_0x24bcce(0x14e)],'utf-8')[_0x24bcce(0x13e)]();}catch(_0x20771f){throw new SDKError(ErrorCode[_0x24bcce(0xf7)],_0x24bcce(0x101)+_0x5dfc42[_0x24bcce(0x14e)],_0x20771f instanceof Error?_0x20771f:undefined);}if(Object[_0x24bcce(0xe6)](_0x3b3335)[_0x24bcce(0x155)]===0x0)throw new SDKError(ErrorCode[_0x24bcce(0xf7)],_0x24bcce(0x104));if(_0xa93095['verbose']){console['error']('Updating\x20schedule:\x20'+_0x286233);for(const [_0x250aa0,_0x215405]of Object[_0x24bcce(0x105)](_0x3b3335)){_0x250aa0===_0x24bcce(0xf1)?console[_0x24bcce(0x10d)]('\x20\x20'+_0x250aa0+':\x20'+_0x215405[_0x24bcce(0x140)](0x0,0x32)+_0x24bcce(0x125)):console['error']('\x20\x20'+_0x250aa0+':\x20'+_0x215405);}}const _0x5d23f5=await withSpinner(_0x24bcce(0x100),()=>_0x18cea2[_0x24bcce(0xf4)][_0x24bcce(0xd6)](_0x286233,_0x3b3335),{'verbose':_0xa93095['verbose']});return console[_0x24bcce(0x10d)]('Schedule\x20updated:\x20'+_0x5d23f5[_0x24bcce(0x128)][_0x24bcce(0x15a)]),await handleSingleObjectOutput(_0x5d23f5[_0x24bcce(0x128)],_0xa93095),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a35_0x46f486(0x15a)]=a35_0x46f486(0x14b);[a35_0x46f486(0x151)]=a35_0x46f486(0xe5);['validate'](_0x575526){const _0x58052b=a35_0x46f486,_0x467434=_0x575526[_0x58052b(0x129)][0x0];if(!_0x467434)return _0x58052b(0x117);return undefined;}async[a35_0x46f486(0xf3)](_0x405ac2){const _0x374372=a35_0x46f486,{options:_0x5182d2,args:_0x4dc438,tdx:_0x4feb40}=_0x405ac2,_0x2404a4=_0x4dc438[0x0];if(!_0x5182d2[_0x374372(0x13b)]){const _0x58ca17=await confirm(_0x374372(0xee)+_0x2404a4+'\x22?');if(!_0x58ca17)return console[_0x374372(0x10d)](_0x374372(0x14f)),0x0;}const _0x4612e3=await withSpinner(_0x374372(0xdf),()=>_0x4feb40[_0x374372(0xf4)]['delete'](_0x2404a4),{'verbose':_0x5182d2['verbose']});return console[_0x374372(0x10d)](_0x374372(0x12a)+_0x4612e3[_0x374372(0x128)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x46f486(0x15a)]=a35_0x46f486(0x139);[a35_0x46f486(0x151)]=a35_0x46f486(0x157);[a35_0x46f486(0x122)](_0x12cd30){const _0x19f487=a35_0x46f486,_0x4ee6e2=_0x12cd30[_0x19f487(0x129)][0x0];if(!_0x4ee6e2)return _0x19f487(0x154);return undefined;}async[a35_0x46f486(0xf3)](_0x1e322f){const _0x2879b0=a35_0x46f486,{options:_0x57a30d,args:_0x11c0fd,tdx:_0x32903f}=_0x1e322f,_0x1f8562=_0x11c0fd[0x0],_0x5b272f=_0x57a30d,_0x5f0b47=_0x5b272f[_0x2879b0(0x146)],_0x24d544=_0x5b272f['num']!==undefined?Number(_0x5b272f[_0x2879b0(0xdc)]):undefined;if(_0x57a30d[_0x2879b0(0x118)]){console[_0x2879b0(0x10d)](_0x2879b0(0xfa)+_0x1f8562);if(_0x5f0b47)console[_0x2879b0(0x10d)]('\x20\x20Time:\x20'+_0x5f0b47);if(_0x24d544)console['error'](_0x2879b0(0x12f)+_0x24d544);}const _0x5c7fe2=await withSpinner('Running\x20schedule...',()=>_0x32903f[_0x2879b0(0xf4)][_0x2879b0(0xd8)](_0x1f8562,{'time':_0x5f0b47,'num':_0x24d544}),{'verbose':_0x57a30d[_0x2879b0(0x118)]}),_0x30fed9=_0x5c7fe2[_0x2879b0(0x128)][_0x2879b0(0x114)];console[_0x2879b0(0x10d)]('Schedule\x20run\x20submitted:\x20'+_0x30fed9[_0x2879b0(0x155)]+'\x20job'+(_0x30fed9['length']!==0x1?'s':'')+'\x20created');for(const _0x325856 of _0x30fed9){console['error'](_0x2879b0(0x10a)+_0x325856[_0x2879b0(0x13d)]);}return await handleSDKOutput(_0x30fed9,_0x57a30d),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a35_0x46f486(0x15a)]='schedule:history';[a35_0x46f486(0x151)]='Show\x20schedule\x20execution\x20history';[a35_0x46f486(0x122)](_0x22786e){const _0x2d0190=a35_0x46f486,_0x52b003=_0x22786e[_0x2d0190(0x129)][0x0];if(!_0x52b003)return _0x2d0190(0x142);return undefined;}async['execute'](_0x1cd2c7){const _0x77ca99=a35_0x46f486,{options:_0x57e8a1,args:_0x5f23bb,tdx:_0x51fa4e}=_0x1cd2c7,_0x3d28e1=_0x5f23bb[0x0],_0x48b125=_0x57e8a1,_0x2a64dc=_0x48b125[_0x77ca99(0x14c)]!==undefined?Number(_0x48b125[_0x77ca99(0x14c)]):undefined,_0x3d5c47=_0x48b125['to']!==undefined?Number(_0x48b125['to']):undefined,_0x4662c6=await withSpinner(_0x77ca99(0x116),()=>_0x51fa4e[_0x77ca99(0xf4)][_0x77ca99(0x149)](_0x3d28e1,{'from':_0x2a64dc,'to':_0x3d5c47}),{'verbose':_0x57e8a1[_0x77ca99(0x118)]}),_0x50096f=_0x4662c6[_0x77ca99(0x128)];console[_0x77ca99(0x10d)](_0x77ca99(0x15c)+_0x50096f[_0x77ca99(0x131)]+'\x20execution'+(_0x50096f[_0x77ca99(0x131)]!==0x1?'s':'')+_0x77ca99(0x15d)+_0x50096f[_0x77ca99(0x14c)]+'-'+_0x50096f['to']+')');const _0x5c72bc=_0x50096f[_0x77ca99(0x149)][_0x77ca99(0x144)](_0x4d7cf7=>({'job_id':_0x4d7cf7[_0x77ca99(0x13d)],'type':_0x4d7cf7[_0x77ca99(0x12c)],'status':_0x4d7cf7[_0x77ca99(0x112)],'scheduled_at':_0x4d7cf7[_0x77ca99(0x11a)],'created_at':_0x4d7cf7[_0x77ca99(0xff)],'start_at':_0x4d7cf7['start_at'],'end_at':_0x4d7cf7[_0x77ca99(0xdb)]}));return await handleSDKOutput(_0x5c72bc,_0x57e8a1),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x2a13a5=a36_0x4310;(function(_0x5cc326,_0x1fe04b){const _0x2fde9c=a36_0x4310,_0x490bc7=_0x5cc326();while(!![]){try{const _0x345d22=-parseInt(_0x2fde9c(0x1df))/0x1+parseInt(_0x2fde9c(0x1b8))/0x2*(parseInt(_0x2fde9c(0x1cc))/0x3)+-parseInt(_0x2fde9c(0x1bb))/0x4*(parseInt(_0x2fde9c(0x1e3))/0x5)+-parseInt(_0x2fde9c(0x205))/0x6*(-parseInt(_0x2fde9c(0x1fd))/0x7)+parseInt(_0x2fde9c(0x230))/0x8+parseInt(_0x2fde9c(0x23a))/0x9*(-parseInt(_0x2fde9c(0x255))/0xa)+-parseInt(_0x2fde9c(0x1b0))/0xb*(-parseInt(_0x2fde9c(0x20f))/0xc);if(_0x345d22===_0x1fe04b)break;else _0x490bc7['push'](_0x490bc7['shift']());}catch(_0x54290b){_0x490bc7['push'](_0x490bc7['shift']());}}}(a36_0xcee7,0x450aa));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';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a36_0xcee7(){const _0x205487=['url','getSegment','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Creating\x20folder\x20\x27','cause','Create\x20segment\x20folder\x20for\x20organization','segment:sql','segmentId','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','setJobId','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Parent\x20segment:\x20','folderId','Site:\x20','SEGMENT_FOLDER_NOT_FOUND','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Get\x20SQL\x20query\x20for\x20child\x20segment','INVALID_ARGUMENT','resolveParentId','142856wkSEOR','green','Error:\x20Path\x20or\x20name\x20is\x20required','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20Folder\x20path:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','parentFolder','66pvgujF','Resolving\x20path\x20\x27','Executing\x20segment\x20query...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Fetching\x20SQL\x20from\x20rule...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','listFolders','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','parentId','log','1126392RRsoCW','resolveFolderId','\x27...','getSegmentSQL','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','folder','Segment\x20ID\x20missing\x20from\x20resolved\x20path','jsonl','parentSegment','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','information_schema','json','Use:\x20tdx\x20ps\x20view\x20-w','SEGMENT_NOT_FOUND','resolvePathToResource','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','execute','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','query','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Target\x20path:\x20','description','getSQLFromYamlFile','Parent\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:desc','fullPath','type','in\x20','3325936vjpFBm','jobId','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Show\x20folder\x20or\x20child\x20segment\x20details','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20folder\x20\x27','Resolved\x20type:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','5013wyEAzq','/e/','\x20Opening\x20','/app/ps/','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','format','segment:folder:show','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','✖\x20Query\x20failed\x20[','path','Error:\x20','Resolved\x20YAML\x20file:\x20','folderPath','parent','Show\x20segment\x20or\x20folder\x20details','test','\x20[Job\x20ID:\x20','Resolving\x20\x27','Folder\x20name:\x20','2390YkYVLR','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Examples:','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','red','replace','11kuOJQN','message','segmentName','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','stats','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getSegmentSQLFromYaml','218ByIUaL','(root)','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','228nuzycj','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20SQL\x20for\x20segment...','getSQLFromServerSegment','Listing\x20folders\x20for\x20parent\x20\x27','getParent','createFolder','Parent\x20name:\x20','limit','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Resolved\x20parent\x20ID:\x20','segment','Resolved\x20folder\x20ID:\x20','Folder\x20ID:\x20','Fetching\x20folder\x20details...','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','9129phLClA','processedRows','elapsedTimeMillis','Options:','Error:\x20Folder\x20reference\x20is\x20required','web','\x20\x20Parent\x20segment:\x20','segmentPath','error','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Use:\x20tdx\x20ps\x20show','length','segment:show','\x20folder','site','data','SQL\x20query:\x0a','208401LXuxiO','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20sg\x20desc\x20<name>','name','38725OJQWPD','✔\x20Query\x20completed:\x20Processed\x20','getFolder','Usage:','code'];a36_0xcee7=function(){return _0x205487;};return a36_0xcee7();}import a36_0x234e0a from'chalk';async function resolveSegmentTarget(_0x31e382,_0x259f6d,_0xf4afb6){const _0x102cbe=a36_0x4310;if(isYamlFilePath(_0x31e382))try{const _0x49b478=await resolveYamlFilePath(_0x31e382);return _0xf4afb6&&(console[_0x102cbe(0x1d4)](_0x102cbe(0x24d)+_0x31e382),console[_0x102cbe(0x1d4)](_0x102cbe(0x1d2)+_0x49b478[_0x102cbe(0x218)]),console[_0x102cbe(0x1d4)]('\x20\x20Segment\x20name:\x20'+_0x49b478[_0x102cbe(0x1b2)]),console['error'](_0x102cbe(0x202)+(_0x49b478[_0x102cbe(0x24e)]||_0x102cbe(0x1b9))),console[_0x102cbe(0x1d4)]('\x20\x20Full\x20path:\x20'+_0x49b478[_0x102cbe(0x22d)])),_0x49b478['fullPath'];}catch(_0x2278bc){throw new SDKError(ErrorCode[_0x102cbe(0x1fb)],_0x102cbe(0x21f)+_0x2278bc[_0x102cbe(0x1b1)]);}if(!_0x259f6d)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x102cbe(0x236));return _0x259f6d+'/'+_0x31e382;}function a36_0x4310(_0x536513,_0x56d715){_0x536513=_0x536513-0x1a7;const _0xcee7ad=a36_0xcee7();let _0x4310b5=_0xcee7ad[_0x536513];return _0x4310b5;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a36_0x2a13a5(0x226)]=a36_0x2a13a5(0x250);async[a36_0x2a13a5(0x220)](_0x335595){const _0x11151a=a36_0x2a13a5,{options:_0x11442d,args:_0x2288f2,tdx:_0x5713b6}=_0x335595,_0x1fbb22=_0x2288f2[0x0],_0x3a74d9=!_0x1fbb22&&!!_0x11442d['parentSegment'],_0x5dbe10=_0x1fbb22||_0x11442d[_0x11151a(0x218)];if(!_0x5dbe10)return console[_0x11151a(0x1d4)](_0x11151a(0x1ff)),console[_0x11151a(0x1d4)](_0x11151a(0x1aa)),console['error'](_0x11151a(0x1a9)),console[_0x11151a(0x1d4)](_0x11151a(0x1ab)),console['error'](_0x11151a(0x208)),console[_0x11151a(0x1d4)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x11151a(0x1d4)](_0x11151a(0x1a7)),0x1;try{const _0x5df1cc=_0x11442d[_0x11151a(0x1d3)];let _0x447a94=_0x5dbe10;!_0x3a74d9&&_0x5df1cc&&!_0x5dbe10['includes']('/')&&(_0x447a94=_0x5df1cc+'/'+_0x5dbe10,_0x11442d[_0x11151a(0x1cb)]&&console[_0x11151a(0x1d4)](_0x11151a(0x1f8)+_0x447a94));const _0x90df0f=await withSpinner(_0x11151a(0x206)+_0x447a94+'\x27...',()=>_0x5713b6['segment'][_0x11151a(0x21e)](_0x447a94),{'verbose':_0x11442d[_0x11151a(0x1cb)]}),_0x9fcad4=_0x90df0f[_0x11151a(0x1dd)];_0x11442d[_0x11151a(0x1cb)]&&(console['error']('Resolved\x20type:\x20'+_0x9fcad4['type']),console['error'](_0x11151a(0x228)+_0x9fcad4[_0x11151a(0x20d)]),_0x9fcad4[_0x11151a(0x1f5)]&&console[_0x11151a(0x1d4)](_0x11151a(0x1c8)+_0x9fcad4[_0x11151a(0x1f5)]),_0x9fcad4[_0x11151a(0x1f0)]&&console[_0x11151a(0x1d4)]('Segment\x20ID:\x20'+_0x9fcad4[_0x11151a(0x1f0)]));if(_0x9fcad4['type']==='parent'){const _0x4d3b5b=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5713b6['segment'][_0x11151a(0x1c0)](_0x9fcad4[_0x11151a(0x20d)]),{'verbose':_0x11442d[_0x11151a(0x1cb)]});await handleSingleObjectOutput(_0x4d3b5b[_0x11151a(0x1dd)],_0x11442d);}else{if(_0x9fcad4[_0x11151a(0x22e)]===_0x11151a(0x215)){if(!_0x9fcad4[_0x11151a(0x1f5)])throw new SDKError(ErrorCode[_0x11151a(0x1f7)],_0x11151a(0x1b6));const _0x157dea=await withSpinner(_0x11151a(0x1c9),()=>_0x5713b6[_0x11151a(0x1c6)][_0x11151a(0x1e5)](_0x9fcad4[_0x11151a(0x1f5)]),{'verbose':_0x11442d[_0x11151a(0x1cb)]});await handleSingleObjectOutput(_0x157dea[_0x11151a(0x1dd)],_0x11442d);}else{if(_0x9fcad4['type']===_0x11151a(0x1c6)){if(!_0x9fcad4[_0x11151a(0x1f0)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x11151a(0x216));const _0x27de04=await withSpinner(_0x11151a(0x242),()=>_0x5713b6['segment'][_0x11151a(0x1e9)](_0x9fcad4[_0x11151a(0x20d)],_0x9fcad4[_0x11151a(0x1f0)]),{'verbose':_0x11442d[_0x11151a(0x1cb)]});await handleSingleObjectOutput(_0x27de04[_0x11151a(0x1dd)],_0x11442d);}}}return 0x0;}catch(_0x5847f5){if(_0x5847f5 instanceof SDKError)return console[_0x11151a(0x1d4)]('Error:\x20'+_0x5847f5[_0x11151a(0x1b1)]),_0x5847f5[_0x11151a(0x1ed)]&&console['error'](_0x11151a(0x22a)+_0x5847f5[_0x11151a(0x1ed)]),0x1;throw _0x5847f5;}}}export class SegmentShowCommand extends BaseCommand{['name']=a36_0x2a13a5(0x1da);[a36_0x2a13a5(0x226)]=a36_0x2a13a5(0x1b3);async[a36_0x2a13a5(0x220)](_0x265dbe){const _0x1f62de=a36_0x2a13a5,{options:_0x544f29,args:_0x38540d,tdx:_0x114974}=_0x265dbe,_0x539a45=_0x38540d[0x0];if(!_0x539a45)return console[_0x1f62de(0x1d4)](_0x1f62de(0x1ac)),console[_0x1f62de(0x1d4)](_0x1f62de(0x203)),console[_0x1f62de(0x1d4)](_0x1f62de(0x246)),console[_0x1f62de(0x1d4)](_0x1f62de(0x1a9)),console['error'](_0x1f62de(0x1ad)),console[_0x1f62de(0x1d4)](_0x1f62de(0x224)),0x1;try{const _0x4cb7e0=_0x544f29['parentSegment'],_0x4c6163=await resolveSegmentTarget(_0x539a45,_0x4cb7e0,_0x544f29['verbose']);_0x544f29[_0x1f62de(0x1cb)]&&console[_0x1f62de(0x1d4)](_0x1f62de(0x225)+_0x4c6163);const _0x57fac2=await withSpinner('Resolving\x20\x27'+_0x539a45+_0x1f62de(0x211),()=>_0x114974['segment'][_0x1f62de(0x21e)](_0x4c6163),{'verbose':_0x544f29[_0x1f62de(0x1cb)]}),_0x32f0a0=_0x57fac2[_0x1f62de(0x1dd)];_0x544f29[_0x1f62de(0x1cb)]&&(console[_0x1f62de(0x1d4)](_0x1f62de(0x238)+_0x32f0a0['type']),console[_0x1f62de(0x1d4)](_0x1f62de(0x228)+_0x32f0a0[_0x1f62de(0x20d)]));if(_0x32f0a0['type']==='folder')return console[_0x1f62de(0x1d4)](_0x1f62de(0x245)),console[_0x1f62de(0x1d4)](_0x1f62de(0x1eb)),0x1;if(_0x32f0a0[_0x1f62de(0x22e)]===_0x1f62de(0x24f))return console[_0x1f62de(0x1d4)](_0x1f62de(0x1ea)),console['error'](_0x1f62de(0x1d8)),0x1;if(!_0x32f0a0[_0x1f62de(0x1f0)])throw new SDKError(ErrorCode[_0x1f62de(0x21d)],_0x1f62de(0x216));const _0x10296e=await withSpinner(_0x1f62de(0x1bd),()=>_0x114974[_0x1f62de(0x1c6)]['getSegmentSQL'](_0x32f0a0[_0x1f62de(0x20d)],_0x32f0a0[_0x1f62de(0x1f0)]),{'verbose':_0x544f29[_0x1f62de(0x1cb)]});let _0x14c116=_0x10296e['data'];const _0x5980c2=resolveLimit(_0x544f29[_0x1f62de(0x1c3)],DEFAULT_DISPLAY_LIMIT),_0x591df5=/\bLIMIT\s+\d+/i[_0x1f62de(0x251)](_0x14c116);!_0x591df5&&(_0x14c116=_0x14c116['trim']()[_0x1f62de(0x1af)](/;+$/,''),_0x14c116=_0x1f62de(0x1e0)+_0x14c116+_0x1f62de(0x1a8)+_0x5980c2);_0x544f29[_0x1f62de(0x1cb)]&&console[_0x1f62de(0x1d4)](_0x1f62de(0x1de)+_0x14c116);const _0x2f2c36=await withProgressSpinner(_0x1f62de(0x207),async _0x5e8c98=>{const _0x479d20=_0x1f62de,_0x4f78cd=await _0x114974[_0x479d20(0x222)][_0x479d20(0x220)](_0x14c116,{'catalog':'td','schema':_0x479d20(0x21a),'onJobId':_0x43d3bb=>{const _0x17c01b=_0x479d20;_0x5e8c98[_0x17c01b(0x1f2)](_0x43d3bb);}});return _0x4f78cd;},{'verbose':_0x544f29[_0x1f62de(0x1cb)]}),_0x133f14=_0x2f2c36[_0x1f62de(0x1dd)],_0x557f97=_0x133f14[_0x1f62de(0x231)]?_0x1f62de(0x252)+_0x133f14[_0x1f62de(0x231)]+']':'';return console[_0x1f62de(0x1d4)](_0x1f62de(0x1e4)+_0x133f14[_0x1f62de(0x1b5)][_0x1f62de(0x1cd)]['toLocaleString']()+'\x20rows\x20'+(_0x1f62de(0x22f)+formatElapsed(_0x133f14['stats'][_0x1f62de(0x1ce)])+_0x557f97)),await handleQueryOutput(_0x133f14,_0x544f29),0x0;}catch(_0x388594){if(_0x388594 instanceof SDKError)return console[_0x1f62de(0x1d4)](_0x1f62de(0x24a)+_0x388594[_0x1f62de(0x1e7)]+']'),console[_0x1f62de(0x1d4)]('\x0a'+_0x388594[_0x1f62de(0x1b1)]),0x1;throw _0x388594;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a36_0x2a13a5(0x226)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a36_0x2a13a5(0x220)](_0x2bb614){const _0x39667a=a36_0x2a13a5,{options:_0x38f6db,args:_0x2a666f,tdx:_0x2a235c}=_0x2bb614;if(_0x2a666f[_0x39667a(0x1d9)]===0x0)return console[_0x39667a(0x1d4)](_0x39667a(0x1ca)),console['error'](_0x39667a(0x221)),0x1;const _0x372c4b=_0x2a666f[0x0];try{_0x38f6db[_0x39667a(0x1cb)]&&(console[_0x39667a(0x1d4)](_0x39667a(0x1f6)+_0x38f6db[_0x39667a(0x1dc)]),console[_0x39667a(0x1d4)](_0x39667a(0x1c2)+_0x372c4b));const _0x1aeeeb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x372c4b+_0x39667a(0x211),()=>_0x2a235c['segment'][_0x39667a(0x1fc)](_0x372c4b),{'verbose':_0x38f6db[_0x39667a(0x1cb)]}),_0x5c5ea8=_0x1aeeeb[_0x39667a(0x1dd)];_0x38f6db[_0x39667a(0x1cb)]&&console[_0x39667a(0x1d4)](_0x39667a(0x1c5)+_0x5c5ea8);const _0xa2a001=await withSpinner(_0x39667a(0x1bf)+_0x372c4b+_0x39667a(0x211),()=>_0x2a235c[_0x39667a(0x1c6)][_0x39667a(0x20b)](_0x5c5ea8),{'verbose':_0x38f6db[_0x39667a(0x1cb)]}),_0x393347=_0xa2a001[_0x39667a(0x1dd)];return console[_0x39667a(0x1d4)]('✔\x20Found\x20'+_0x393347[_0x39667a(0x1d9)]+_0x39667a(0x1db)+(_0x393347[_0x39667a(0x1d9)]!==0x1?'s':'')),await handleSDKOutput(_0x393347,_0x38f6db),0x0;}catch(_0x39803f){if(_0x39803f instanceof SDKError)return console[_0x39667a(0x1d4)](_0x39667a(0x24c)+_0x39803f[_0x39667a(0x1b1)]),_0x39803f[_0x39667a(0x1ed)]&&console[_0x39667a(0x1d4)](_0x39667a(0x22a)+_0x39803f[_0x39667a(0x1ed)]),0x1;throw _0x39803f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x2a13a5(0x1e2)]=a36_0x2a13a5(0x248);[a36_0x2a13a5(0x226)]='Show\x20segment\x20folder\x20details';async[a36_0x2a13a5(0x220)](_0x34ae0d){const _0x508bcf=a36_0x2a13a5,{options:_0x9884f3,args:_0x52e413,tdx:_0x4fd324}=_0x34ae0d;if(_0x52e413[_0x508bcf(0x1d9)]===0x0)return console[_0x508bcf(0x1d4)](_0x508bcf(0x1d0)),console['error'](_0x508bcf(0x234)),0x1;try{const {parentId:_0x10f0a4,childId:_0x126e2a}=parseSegmentRef(_0x52e413[0x0]);_0x9884f3[_0x508bcf(0x1cb)]&&(console[_0x508bcf(0x1d4)](_0x508bcf(0x1f6)+_0x9884f3['site']),console[_0x508bcf(0x1d4)](_0x508bcf(0x1c2)+_0x10f0a4),_0x126e2a&&console[_0x508bcf(0x1d4)](_0x508bcf(0x254)+_0x126e2a));if(!_0x126e2a)return console[_0x508bcf(0x1d4)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x37a8c0=await withSpinner(_0x508bcf(0x244)+_0x10f0a4+_0x508bcf(0x211),()=>_0x4fd324[_0x508bcf(0x1c6)][_0x508bcf(0x1fc)](_0x10f0a4),{'verbose':_0x9884f3[_0x508bcf(0x1cb)]}),_0x201974=_0x37a8c0[_0x508bcf(0x1dd)];_0x9884f3['verbose']&&console[_0x508bcf(0x1d4)](_0x508bcf(0x1c5)+_0x201974);const _0x48c09d=await withSpinner(_0x508bcf(0x237)+_0x126e2a+_0x508bcf(0x211),()=>_0x4fd324[_0x508bcf(0x1c6)][_0x508bcf(0x210)](_0x201974,_0x126e2a),{'verbose':_0x9884f3['verbose']}),_0x382f9a=_0x48c09d[_0x508bcf(0x1dd)];_0x9884f3[_0x508bcf(0x1cb)]&&console[_0x508bcf(0x1d4)](_0x508bcf(0x1c7)+_0x382f9a);const _0x525818=await withSpinner('Fetching\x20folder\x20\x27'+_0x126e2a+_0x508bcf(0x211),()=>_0x4fd324[_0x508bcf(0x1c6)][_0x508bcf(0x1e5)](_0x382f9a),{'verbose':_0x9884f3[_0x508bcf(0x1cb)]});return await handleSDKOutput([_0x525818[_0x508bcf(0x1dd)]],_0x9884f3),0x0;}catch(_0x8de2a7){if(_0x8de2a7 instanceof SDKError)return console[_0x508bcf(0x1d4)]('Error:\x20'+_0x8de2a7[_0x508bcf(0x1b1)]),_0x8de2a7[_0x508bcf(0x1ed)]&&console[_0x508bcf(0x1d4)](_0x508bcf(0x22a)+_0x8de2a7[_0x508bcf(0x1ed)]),0x1;throw _0x8de2a7;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a36_0x2a13a5(0x1ef);[a36_0x2a13a5(0x226)]=a36_0x2a13a5(0x1fa);async['execute'](_0x109ca7){const _0x1a175d=a36_0x2a13a5,{options:_0x3b3f6,args:_0x37a6ae}=_0x109ca7,_0x3a06c5=_0x3b3f6,_0x18755b=_0x3a06c5[_0x1a175d(0x24b)],_0x29b792=_0x37a6ae[0x0];if(!_0x29b792&&!_0x18755b)return console[_0x1a175d(0x1d4)](a36_0x234e0a[_0x1a175d(0x1ae)](_0x1a175d(0x20c))),console[_0x1a175d(0x1d4)](_0x1a175d(0x1e6)),console[_0x1a175d(0x1d4)](_0x1a175d(0x1f3)),console[_0x1a175d(0x1d4)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error']('Examples:'),console['error'](_0x1a175d(0x22b)),console[_0x1a175d(0x1d4)](_0x1a175d(0x1bc)),0x1;if(_0x29b792&&_0x18755b)return console[_0x1a175d(0x1d4)](a36_0x234e0a['red'](_0x1a175d(0x229))),0x1;try{let _0x5eaf9;if(_0x18755b)_0x5eaf9=await this[_0x1a175d(0x227)](_0x18755b,_0x109ca7);else{if(isYamlFilePath(_0x29b792))return console[_0x1a175d(0x1d4)](a36_0x234e0a['red'](_0x1a175d(0x239))),console[_0x1a175d(0x1d4)](_0x1a175d(0x1c4)+_0x29b792),0x1;else _0x5eaf9=await this[_0x1a175d(0x1be)](_0x29b792,_0x109ca7);}return _0x3b3f6[_0x1a175d(0x247)]===_0x1a175d(0x21b)||_0x3b3f6['format']===_0x1a175d(0x217)?await handleSDKOutput([{'sql':_0x5eaf9}],_0x3b3f6):console[_0x1a175d(0x20e)](_0x5eaf9),0x0;}catch(_0x10e502){if(_0x10e502 instanceof SDKError)return console[_0x1a175d(0x1d4)](_0x1a175d(0x24c)+_0x10e502['message']),_0x10e502[_0x1a175d(0x1ed)]&&console[_0x1a175d(0x1d4)]('\x20\x20Cause:\x20'+_0x10e502[_0x1a175d(0x1ed)]),0x1;throw _0x10e502;}}async[a36_0x2a13a5(0x227)](_0xfa6f34,_0x5209a1){const _0x1edb5c=a36_0x2a13a5,{options:_0x304975,tdx:_0x1ed468}=_0x5209a1;let _0x5b2398;try{_0x5b2398=await resolveYamlFilePath(_0xfa6f34);}catch(_0x3a9f83){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1edb5c(0x21f)+_0x3a9f83[_0x1edb5c(0x1b1)]);}_0x304975['verbose']&&console[_0x1edb5c(0x1d4)]('Resolved:\x20'+_0x5b2398[_0x1edb5c(0x218)]+'/'+_0x5b2398['segmentName']);const _0x533bb3=await withSpinner(_0x1edb5c(0x209),()=>_0x1ed468[_0x1edb5c(0x1c6)][_0x1edb5c(0x1b7)](_0x5b2398['content'],_0x5b2398[_0x1edb5c(0x218)],_0x5b2398[_0x1edb5c(0x1b2)]),{'verbose':_0x304975[_0x1edb5c(0x1cb)]});return _0x533bb3[_0x1edb5c(0x1dd)];}async[a36_0x2a13a5(0x1be)](_0x5eaceb,_0x36ff44){const _0x6f43f6=a36_0x2a13a5,{options:_0x159934,tdx:_0x14c6b9}=_0x36ff44,_0x37b80e=_0x159934[_0x6f43f6(0x218)],_0x22b4b3=await resolveSegmentTarget(_0x5eaceb,_0x37b80e,_0x159934['verbose']);_0x159934['verbose']&&console[_0x6f43f6(0x1d4)]('Target\x20path:\x20'+_0x22b4b3);const _0x9b4a98=await withSpinner(_0x6f43f6(0x253)+_0x5eaceb+_0x6f43f6(0x211),()=>_0x14c6b9[_0x6f43f6(0x1c6)][_0x6f43f6(0x21e)](_0x22b4b3),{'verbose':_0x159934[_0x6f43f6(0x1cb)]}),_0x16d460=_0x9b4a98['data'];_0x159934[_0x6f43f6(0x1cb)]&&(console[_0x6f43f6(0x1d4)](_0x6f43f6(0x238)+_0x16d460['type']),console[_0x6f43f6(0x1d4)](_0x6f43f6(0x228)+_0x16d460[_0x6f43f6(0x20d)]));if(_0x16d460[_0x6f43f6(0x22e)]==='folder')throw new SDKError(ErrorCode[_0x6f43f6(0x1fb)],_0x6f43f6(0x1ba));if(_0x16d460[_0x6f43f6(0x22e)]===_0x6f43f6(0x24f))throw new SDKError(ErrorCode[_0x6f43f6(0x1fb)],_0x6f43f6(0x249));if(!_0x16d460['segmentId'])throw new SDKError(ErrorCode[_0x6f43f6(0x21d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2be914=await withSpinner(_0x6f43f6(0x1bd),()=>_0x14c6b9[_0x6f43f6(0x1c6)]['getSegmentSQL'](_0x16d460['parentId'],_0x16d460[_0x6f43f6(0x1f0)]),{'verbose':_0x159934['verbose']});return _0x2be914[_0x6f43f6(0x1dd)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';[a36_0x2a13a5(0x226)]=a36_0x2a13a5(0x1ee);async[a36_0x2a13a5(0x220)](_0x2e27a6){const _0x240df1=a36_0x2a13a5,{options:_0x294fee,args:_0x3fd184,tdx:_0x40911f}=_0x2e27a6,_0x11eb45=_0x294fee;if(_0x3fd184['length']<0x2)return console[_0x240df1(0x1d4)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x240df1(0x1d6)),0x1;const _0x35798f=_0x3fd184[0x0],_0x5ce0cd=_0x3fd184[0x1];_0x11eb45[_0x240df1(0x1cb)]&&(console[_0x240df1(0x1d4)](_0x240df1(0x1f6)+_0x11eb45['site']),console[_0x240df1(0x1d4)](_0x240df1(0x1f4)+_0x35798f),console['error'](_0x240df1(0x254)+_0x5ce0cd));let _0x355283;if(_0x11eb45[_0x240df1(0x204)]){const _0xde6c3=_0x11eb45['parentFolder'],_0x105e6f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x35798f+'\x27...',()=>_0x40911f['segment'][_0x240df1(0x1fc)](_0x35798f),{'verbose':_0x11eb45['verbose']}),_0x3935ac=_0x105e6f[_0x240df1(0x1dd)],_0x1bd0ac=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xde6c3+_0x240df1(0x211),()=>_0x40911f[_0x240df1(0x1c6)]['resolveFolderId'](_0x3935ac,_0xde6c3),{'verbose':_0x11eb45[_0x240df1(0x1cb)]});_0x355283=_0x1bd0ac['data'],_0x11eb45[_0x240df1(0x1cb)]&&console[_0x240df1(0x1d4)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x355283);}const _0x4b5fac={'name':_0x5ce0cd,'description':_0x11eb45[_0x240df1(0x226)],'parentFolderId':_0x355283},_0x153ae5=await withSpinner(_0x240df1(0x1ec)+_0x5ce0cd+_0x240df1(0x211),()=>_0x40911f['segment'][_0x240df1(0x1c1)](_0x35798f,_0x4b5fac),{'verbose':_0x11eb45[_0x240df1(0x1cb)]}),_0x38b7fb=_0x153ae5['data'];return console[_0x240df1(0x1d4)]('✔\x20Created\x20folder\x20\x27'+_0x38b7fb[_0x240df1(0x1e2)]+_0x240df1(0x200)+_0x38b7fb['id']),await handleSDKOutput([_0x38b7fb],_0x11eb45),0x0;}}export class SegmentViewCommand extends BaseCommand{[a36_0x2a13a5(0x1e2)]='segment:view';[a36_0x2a13a5(0x226)]=a36_0x2a13a5(0x235);async[a36_0x2a13a5(0x220)](_0x12b69e){const _0x2e8ca3=a36_0x2a13a5,{options:_0x4c87b6,args:_0x1406a1,tdx:_0x1fcb54}=_0x12b69e,_0x3d6a9c=_0x1406a1[0x0];if(!_0x3d6a9c)return console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x232)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1f9)),console[_0x2e8ca3(0x1d4)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1cf)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1b4)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1a9)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x233)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x20a)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x23e)),console['error'](_0x2e8ca3(0x1f1)),0x1;try{const _0x42dcf6=_0x4c87b6[_0x2e8ca3(0x218)],_0x350a82=await resolveSegmentTarget(_0x3d6a9c,_0x42dcf6,_0x4c87b6[_0x2e8ca3(0x1cb)]);_0x4c87b6[_0x2e8ca3(0x1cb)]&&console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x225)+_0x350a82);const _0x498f55=await withSpinner(_0x2e8ca3(0x253)+_0x3d6a9c+_0x2e8ca3(0x211),()=>_0x1fcb54[_0x2e8ca3(0x1c6)][_0x2e8ca3(0x21e)](_0x350a82),{'verbose':_0x4c87b6[_0x2e8ca3(0x1cb)]}),_0x49aaf6=_0x498f55['data'];_0x4c87b6[_0x2e8ca3(0x1cb)]&&(console[_0x2e8ca3(0x1d4)]('Resolved\x20type:\x20'+_0x49aaf6[_0x2e8ca3(0x22e)]),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x228)+_0x49aaf6[_0x2e8ca3(0x20d)]),_0x49aaf6[_0x2e8ca3(0x1f5)]&&console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1c8)+_0x49aaf6['folderId']),_0x49aaf6[_0x2e8ca3(0x1f0)]&&console[_0x2e8ca3(0x1d4)]('Segment\x20ID:\x20'+_0x49aaf6['segmentId']));if(_0x4c87b6[_0x2e8ca3(0x1d1)]){if(_0x49aaf6[_0x2e8ca3(0x22e)]==='folder')return console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1d7)),0x1;if(_0x49aaf6['type']===_0x2e8ca3(0x24f))return console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x1d5)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x21c)),0x1;if(!_0x49aaf6[_0x2e8ca3(0x1f0)])throw new SDKError(ErrorCode[_0x2e8ca3(0x21d)],_0x2e8ca3(0x216));const _0x1aa478=getConsoleNextUrl(_0x4c87b6[_0x2e8ca3(0x1dc)],_0x2e8ca3(0x23d)+_0x49aaf6[_0x2e8ca3(0x20d)]+_0x2e8ca3(0x23b)+_0x49aaf6[_0x2e8ca3(0x1f0)]);return console[_0x2e8ca3(0x1d4)](a36_0x234e0a[_0x2e8ca3(0x1fe)]('✔')+_0x2e8ca3(0x23c)+a36_0x234e0a['cyan'](_0x1aa478)),openBrowser(_0x1aa478),0x0;}if(_0x49aaf6[_0x2e8ca3(0x22e)]==='folder'){if(!_0x49aaf6[_0x2e8ca3(0x1f5)])throw new SDKError(ErrorCode[_0x2e8ca3(0x1f7)],_0x2e8ca3(0x1b6));const _0xa56a9e=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1fcb54['segment'][_0x2e8ca3(0x1e5)](_0x49aaf6[_0x2e8ca3(0x1f5)]),{'verbose':_0x4c87b6[_0x2e8ca3(0x1cb)]});await handleSingleObjectOutput(_0xa56a9e[_0x2e8ca3(0x1dd)],_0x4c87b6);}else{if(_0x49aaf6[_0x2e8ca3(0x22e)]===_0x2e8ca3(0x1c6)){if(!_0x49aaf6[_0x2e8ca3(0x1f0)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2e8ca3(0x216));const _0x55aa2c=await withSpinner(_0x2e8ca3(0x242),()=>_0x1fcb54[_0x2e8ca3(0x1c6)][_0x2e8ca3(0x1e9)](_0x49aaf6[_0x2e8ca3(0x20d)],_0x49aaf6[_0x2e8ca3(0x1f0)]),{'verbose':_0x4c87b6['verbose']}),_0x3eefee=getConsoleNextUrl(_0x4c87b6['site'],_0x2e8ca3(0x23d)+_0x49aaf6[_0x2e8ca3(0x20d)]+_0x2e8ca3(0x23b)+_0x49aaf6[_0x2e8ca3(0x1f0)]),_0x5973e6=_0x55aa2c[_0x2e8ca3(0x1dd)];_0x5973e6[_0x2e8ca3(0x1e8)]=_0x3eefee,await handleSingleObjectOutput(_0x5973e6,_0x4c87b6);}else return console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x201)),console[_0x2e8ca3(0x1d4)](_0x2e8ca3(0x241)),0x1;}return 0x0;}catch(_0x455005){if(_0x455005 instanceof SDKError)return console[_0x2e8ca3(0x1d4)]('Error:\x20'+_0x455005['message']),_0x455005[_0x2e8ca3(0x1ed)]&&console[_0x2e8ca3(0x1d4)]('\x20\x20Cause:\x20'+_0x455005['cause']),0x1;throw _0x455005;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a36_0x2a13a5(0x22c);[a36_0x2a13a5(0x226)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a36_0x2a13a5(0x220)](_0x5005a7){const _0x329867=a36_0x2a13a5,{options:_0x306103,args:_0x5391b9,tdx:_0x5bab0c}=_0x5005a7,_0x3aff3d=_0x5391b9[0x0];if(!_0x3aff3d)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x329867(0x1d4)](_0x329867(0x1e1)),console[_0x329867(0x1d4)](_0x329867(0x240)),console[_0x329867(0x1d4)](_0x329867(0x1a9)),console[_0x329867(0x1d4)](_0x329867(0x214)),console[_0x329867(0x1d4)](_0x329867(0x243)),0x1;try{const _0x29ebb0=_0x306103['parentSegment'],_0x2103d4=await resolveSegmentTarget(_0x3aff3d,_0x29ebb0,_0x306103[_0x329867(0x1cb)]);_0x306103[_0x329867(0x1cb)]&&console[_0x329867(0x1d4)](_0x329867(0x225)+_0x2103d4);const _0x4007d=await withSpinner(_0x329867(0x253)+_0x3aff3d+_0x329867(0x211),()=>_0x5bab0c[_0x329867(0x1c6)][_0x329867(0x21e)](_0x2103d4),{'verbose':_0x306103['verbose']}),_0x1ed104=_0x4007d[_0x329867(0x1dd)];_0x306103[_0x329867(0x1cb)]&&(console[_0x329867(0x1d4)](_0x329867(0x238)+_0x1ed104[_0x329867(0x22e)]),console[_0x329867(0x1d4)](_0x329867(0x228)+_0x1ed104[_0x329867(0x20d)]));if(_0x1ed104['type']===_0x329867(0x215))return console[_0x329867(0x1d4)](_0x329867(0x223)),console[_0x329867(0x1d4)](_0x329867(0x23f)),0x1;if(_0x1ed104[_0x329867(0x22e)]===_0x329867(0x24f))return console['error'](_0x329867(0x219)),console[_0x329867(0x1d4)](_0x329867(0x213)),0x1;if(!_0x1ed104[_0x329867(0x1f0)])throw new SDKError(ErrorCode[_0x329867(0x21d)],_0x329867(0x216));const _0x39528a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x5bab0c[_0x329867(0x1c6)][_0x329867(0x212)](_0x1ed104[_0x329867(0x20d)],_0x1ed104[_0x329867(0x1f0)]),{'verbose':_0x306103[_0x329867(0x1cb)]}),_0x502217=_0x39528a[_0x329867(0x1dd)],_0x550b10=await executeSchemaQuery(_0x502217,_0x5bab0c,_0x306103);return await handleQueryOutput(_0x550b10,_0x306103),0x0;}catch(_0x3157b7){if(_0x3157b7 instanceof SDKError)return console['error']('Error:\x20'+_0x3157b7[_0x329867(0x1b1)]),_0x3157b7['cause']&&console[_0x329867(0x1d4)]('\x20\x20Cause:\x20'+_0x3157b7[_0x329867(0x1ed)]),0x1;throw _0x3157b7;}}}
|
|
1
|
+
const a36_0xc02027=a36_0xf267;(function(_0x19e8c6,_0xb5191c){const _0x5c1676=a36_0xf267,_0x4b2903=_0x19e8c6();while(!![]){try{const _0x462057=-parseInt(_0x5c1676(0x19a))/0x1+-parseInt(_0x5c1676(0x1b2))/0x2*(parseInt(_0x5c1676(0x1b1))/0x3)+-parseInt(_0x5c1676(0x1d1))/0x4*(-parseInt(_0x5c1676(0x1a2))/0x5)+-parseInt(_0x5c1676(0x1be))/0x6*(parseInt(_0x5c1676(0x195))/0x7)+-parseInt(_0x5c1676(0x16f))/0x8+parseInt(_0x5c1676(0x1e5))/0x9*(parseInt(_0x5c1676(0x1db))/0xa)+parseInt(_0x5c1676(0x1f4))/0xb;if(_0x462057===_0xb5191c)break;else _0x4b2903['push'](_0x4b2903['shift']());}catch(_0xa5745f){_0x4b2903['push'](_0x4b2903['shift']());}}}(a36_0x149e,0xa2523));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';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a36_0x473c9d from'chalk';async function resolveSegmentTarget(_0x53a86d,_0x3fea8e,_0x1317fa){const _0x20cd65=a36_0xf267;if(isYamlFilePath(_0x53a86d))try{const _0x5652ce=await resolveYamlFilePath(_0x53a86d);return _0x1317fa&&(console[_0x20cd65(0x180)]('Resolved\x20YAML\x20file:\x20'+_0x53a86d),console[_0x20cd65(0x180)](_0x20cd65(0x1bf)+_0x5652ce[_0x20cd65(0x1d0)]),console[_0x20cd65(0x180)](_0x20cd65(0x18e)+_0x5652ce['segmentName']),console[_0x20cd65(0x180)](_0x20cd65(0x19e)+(_0x5652ce[_0x20cd65(0x1ce)]||'(root)')),console['error'](_0x20cd65(0x1b0)+_0x5652ce[_0x20cd65(0x17c)])),_0x5652ce[_0x20cd65(0x17c)];}catch(_0x433226){throw new SDKError(ErrorCode[_0x20cd65(0x1ff)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x433226[_0x20cd65(0x164)]);}if(!_0x3fea8e)throw new SDKError(ErrorCode[_0x20cd65(0x1ff)],_0x20cd65(0x1df));return _0x3fea8e+'/'+_0x53a86d;}export class SegmentDescribeCommand extends BaseCommand{[a36_0xc02027(0x1ee)]='segment:describe';[a36_0xc02027(0x1f7)]=a36_0xc02027(0x201);async['execute'](_0x115e8f){const _0x538859=a36_0xc02027,{options:_0x38122e,args:_0x329622,tdx:_0x476074}=_0x115e8f,_0x2c81b4=_0x329622[0x0],_0x574bed=!_0x2c81b4&&!!_0x38122e[_0x538859(0x1d0)],_0x4165ac=_0x2c81b4||_0x38122e[_0x538859(0x1d0)];if(!_0x4165ac)return console['error'](_0x538859(0x1ad)),console[_0x538859(0x180)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x538859(0x180)]('Examples:'),console[_0x538859(0x180)](_0x538859(0x1c8)),console[_0x538859(0x180)](_0x538859(0x182)),console['error'](_0x538859(0x1a3)),console[_0x538859(0x180)](_0x538859(0x1a8)),0x1;try{const _0x13f42c=_0x38122e[_0x538859(0x200)];let _0x2311ad=_0x4165ac;!_0x574bed&&_0x13f42c&&!_0x4165ac[_0x538859(0x1cc)]('/')&&(_0x2311ad=_0x13f42c+'/'+_0x4165ac,_0x38122e[_0x538859(0x1a7)]&&console['error'](_0x538859(0x202)+_0x2311ad));const _0x48647e=await withSpinner(_0x538859(0x1fa)+_0x2311ad+'\x27...',()=>_0x476074[_0x538859(0x1a4)][_0x538859(0x1e9)](_0x2311ad),{'verbose':_0x38122e[_0x538859(0x1a7)]}),_0x4be82b=_0x48647e[_0x538859(0x17d)];_0x38122e[_0x538859(0x1a7)]&&(console[_0x538859(0x180)](_0x538859(0x1f9)+_0x4be82b['type']),console[_0x538859(0x180)](_0x538859(0x179)+_0x4be82b[_0x538859(0x16a)]),_0x4be82b['folderId']&&console[_0x538859(0x180)](_0x538859(0x1a6)+_0x4be82b[_0x538859(0x1d9)]),_0x4be82b[_0x538859(0x1da)]&&console[_0x538859(0x180)]('Segment\x20ID:\x20'+_0x4be82b[_0x538859(0x1da)]));if(_0x4be82b['type']==='parent'){const _0x1976ad=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x476074['segment']['getParent'](_0x4be82b[_0x538859(0x16a)]),{'verbose':_0x38122e[_0x538859(0x1a7)]});await handleSingleObjectOutput(_0x1976ad[_0x538859(0x17d)],_0x38122e);}else{if(_0x4be82b[_0x538859(0x1fc)]===_0x538859(0x1c5)){if(!_0x4be82b[_0x538859(0x1d9)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x538859(0x1e8));const _0x273f36=await withSpinner(_0x538859(0x196),()=>_0x476074[_0x538859(0x1a4)][_0x538859(0x1a5)](_0x4be82b[_0x538859(0x1d9)]),{'verbose':_0x38122e[_0x538859(0x1a7)]});await handleSingleObjectOutput(_0x273f36[_0x538859(0x17d)],_0x38122e);}else{if(_0x4be82b['type']===_0x538859(0x1a4)){if(!_0x4be82b[_0x538859(0x1da)])throw new SDKError(ErrorCode[_0x538859(0x1ec)],_0x538859(0x161));const _0x4e1591=await withSpinner(_0x538859(0x1c2),()=>_0x476074[_0x538859(0x1a4)][_0x538859(0x1ef)](_0x4be82b['parentId'],_0x4be82b[_0x538859(0x1da)]),{'verbose':_0x38122e['verbose']});await handleSingleObjectOutput(_0x4e1591[_0x538859(0x17d)],_0x38122e);}}}return 0x0;}catch(_0x40b2fa){if(_0x40b2fa instanceof SDKError)return console[_0x538859(0x180)](_0x538859(0x19d)+_0x40b2fa[_0x538859(0x164)]),_0x40b2fa[_0x538859(0x1d8)]&&console[_0x538859(0x180)](_0x538859(0x1cd)+_0x40b2fa[_0x538859(0x1d8)]),0x1;throw _0x40b2fa;}}}export class SegmentShowCommand extends BaseCommand{[a36_0xc02027(0x1ee)]='segment:show';[a36_0xc02027(0x1f7)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a36_0xc02027(0x18b)](_0x139914){const _0xe26e8e=a36_0xc02027,{options:_0x8f9d57,args:_0xc7009b,tdx:_0x634a5f}=_0x139914,_0x2857a6=_0xc7009b[0x0];if(!_0x2857a6)return console[_0xe26e8e(0x180)](_0xe26e8e(0x171)),console[_0xe26e8e(0x180)](_0xe26e8e(0x192)),console[_0xe26e8e(0x180)](_0xe26e8e(0x185)),console[_0xe26e8e(0x180)](_0xe26e8e(0x1f2)),console[_0xe26e8e(0x180)](_0xe26e8e(0x1b9)),console[_0xe26e8e(0x180)](_0xe26e8e(0x16d)),0x1;try{const _0x565d79=_0x8f9d57[_0xe26e8e(0x1d0)],_0x4693f7=await resolveSegmentTarget(_0x2857a6,_0x565d79,_0x8f9d57[_0xe26e8e(0x1a7)]);_0x8f9d57[_0xe26e8e(0x1a7)]&&console[_0xe26e8e(0x180)](_0xe26e8e(0x1eb)+_0x4693f7);const _0xd1d665=await withSpinner(_0xe26e8e(0x1bc)+_0x2857a6+_0xe26e8e(0x160),()=>_0x634a5f[_0xe26e8e(0x1a4)][_0xe26e8e(0x1e9)](_0x4693f7),{'verbose':_0x8f9d57[_0xe26e8e(0x1a7)]}),_0x1e719e=_0xd1d665[_0xe26e8e(0x17d)];_0x8f9d57[_0xe26e8e(0x1a7)]&&(console[_0xe26e8e(0x180)]('Resolved\x20type:\x20'+_0x1e719e[_0xe26e8e(0x1fc)]),console[_0xe26e8e(0x180)](_0xe26e8e(0x179)+_0x1e719e[_0xe26e8e(0x16a)]));if(_0x1e719e[_0xe26e8e(0x1fc)]==='folder')return console[_0xe26e8e(0x180)](_0xe26e8e(0x1d4)),console[_0xe26e8e(0x180)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x1e719e['type']===_0xe26e8e(0x183))return console[_0xe26e8e(0x180)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0xe26e8e(0x180)](_0xe26e8e(0x17b)),0x1;if(!_0x1e719e[_0xe26e8e(0x1da)])throw new SDKError(ErrorCode[_0xe26e8e(0x1ec)],_0xe26e8e(0x161));const _0x256e1d=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x634a5f[_0xe26e8e(0x1a4)][_0xe26e8e(0x18d)](_0x1e719e[_0xe26e8e(0x16a)],_0x1e719e['segmentId']),{'verbose':_0x8f9d57['verbose']});let _0x19694e=_0x256e1d['data'];const _0x4cc33d=resolveLimit(_0x8f9d57[_0xe26e8e(0x193)],DEFAULT_DISPLAY_LIMIT),_0x1c09ac=/\bLIMIT\s+\d+/i[_0xe26e8e(0x1dc)](_0x19694e);!_0x1c09ac&&(_0x19694e=_0x19694e[_0xe26e8e(0x1c1)]()[_0xe26e8e(0x162)](/;+$/,''),_0x19694e='SELECT\x20*\x20FROM\x20(\x0a'+_0x19694e+_0xe26e8e(0x16c)+_0x4cc33d);_0x8f9d57[_0xe26e8e(0x1a7)]&&console[_0xe26e8e(0x180)]('SQL\x20query:\x0a'+_0x19694e);const _0x7110d5=await withProgressSpinner(_0xe26e8e(0x1d3),async _0x1b78ec=>{const _0x28fa31=_0xe26e8e,_0x5beec1=await _0x634a5f[_0x28fa31(0x1ab)][_0x28fa31(0x18b)](_0x19694e,{'catalog':'td','schema':_0x28fa31(0x173),'onJobId':_0x1c84a4=>{const _0x5b0ca4=_0x28fa31;_0x1b78ec[_0x5b0ca4(0x1bd)](_0x1c84a4);}});return _0x5beec1;},{'verbose':_0x8f9d57[_0xe26e8e(0x1a7)]}),_0x2ae8d4=_0x7110d5[_0xe26e8e(0x17d)],_0x3736cf=_0x2ae8d4['jobId']?_0xe26e8e(0x1c7)+_0x2ae8d4[_0xe26e8e(0x177)]+']':'';return console['error'](_0xe26e8e(0x1bb)+_0x2ae8d4[_0xe26e8e(0x1b6)][_0xe26e8e(0x1ed)][_0xe26e8e(0x1b5)]()+_0xe26e8e(0x1f6)+(_0xe26e8e(0x1b3)+formatElapsed(_0x2ae8d4['stats']['elapsedTimeMillis'])+_0x3736cf)),await handleQueryOutput(_0x2ae8d4,_0x8f9d57),0x0;}catch(_0x22fbbb){if(_0x22fbbb instanceof SDKError)return console[_0xe26e8e(0x180)](_0xe26e8e(0x1e2)+_0x22fbbb[_0xe26e8e(0x187)]+']'),console[_0xe26e8e(0x180)]('\x0a'+_0x22fbbb[_0xe26e8e(0x164)]),0x1;throw _0x22fbbb;}}}export class SegmentFolderListCommand extends BaseCommand{[a36_0xc02027(0x1ee)]='segment:folder:list';[a36_0xc02027(0x1f7)]=a36_0xc02027(0x1a0);async[a36_0xc02027(0x18b)](_0x1bce20){const _0x1a2452=a36_0xc02027,{options:_0x2fee4c,args:_0x11ef3c,tdx:_0x543abe}=_0x1bce20;if(_0x11ef3c[_0x1a2452(0x194)]===0x0)return console[_0x1a2452(0x180)](_0x1a2452(0x189)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x50fb7b=_0x11ef3c[0x0];try{_0x2fee4c[_0x1a2452(0x1a7)]&&(console[_0x1a2452(0x180)](_0x1a2452(0x191)+_0x2fee4c[_0x1a2452(0x1cf)]),console[_0x1a2452(0x180)]('Parent\x20name:\x20'+_0x50fb7b));const _0x2dc636=await withSpinner(_0x1a2452(0x176)+_0x50fb7b+_0x1a2452(0x160),()=>_0x543abe[_0x1a2452(0x1a4)][_0x1a2452(0x166)](_0x50fb7b),{'verbose':_0x2fee4c[_0x1a2452(0x1a7)]}),_0xa0bde7=_0x2dc636[_0x1a2452(0x17d)];_0x2fee4c[_0x1a2452(0x1a7)]&&console['error'](_0x1a2452(0x1e4)+_0xa0bde7);const _0x223cb9=await withSpinner(_0x1a2452(0x167)+_0x50fb7b+_0x1a2452(0x160),()=>_0x543abe[_0x1a2452(0x1a4)]['listFolders'](_0xa0bde7),{'verbose':_0x2fee4c['verbose']}),_0x13a072=_0x223cb9[_0x1a2452(0x17d)];return console[_0x1a2452(0x180)](_0x1a2452(0x188)+_0x13a072['length']+_0x1a2452(0x1e0)+(_0x13a072[_0x1a2452(0x194)]!==0x1?'s':'')),await handleSDKOutput(_0x13a072,_0x2fee4c),0x0;}catch(_0x515180){if(_0x515180 instanceof SDKError)return console['error'](_0x1a2452(0x19d)+_0x515180[_0x1a2452(0x164)]),_0x515180[_0x1a2452(0x1d8)]&&console[_0x1a2452(0x180)]('\x20\x20Cause:\x20'+_0x515180['cause']),0x1;throw _0x515180;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a36_0xc02027(0x170);['description']=a36_0xc02027(0x18f);async[a36_0xc02027(0x18b)](_0x43302d){const _0x462b83=a36_0xc02027,{options:_0x56c795,args:_0x555b53,tdx:_0x44b2e5}=_0x43302d;if(_0x555b53[_0x462b83(0x194)]===0x0)return console[_0x462b83(0x180)](_0x462b83(0x1c4)),console[_0x462b83(0x180)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x452915,childId:_0x43f67d}=parseSegmentRef(_0x555b53[0x0]);_0x56c795[_0x462b83(0x1a7)]&&(console[_0x462b83(0x180)](_0x462b83(0x191)+_0x56c795[_0x462b83(0x1cf)]),console[_0x462b83(0x180)](_0x462b83(0x1e1)+_0x452915),_0x43f67d&&console[_0x462b83(0x180)](_0x462b83(0x17e)+_0x43f67d));if(!_0x43f67d)return console[_0x462b83(0x180)](_0x462b83(0x16b)),0x1;const _0x5ad758=await withSpinner(_0x462b83(0x176)+_0x452915+_0x462b83(0x160),()=>_0x44b2e5[_0x462b83(0x1a4)]['resolveParentId'](_0x452915),{'verbose':_0x56c795['verbose']}),_0x281955=_0x5ad758[_0x462b83(0x17d)];_0x56c795[_0x462b83(0x1a7)]&&console[_0x462b83(0x180)](_0x462b83(0x1e4)+_0x281955);const _0x52653d=await withSpinner('Resolving\x20folder\x20\x27'+_0x43f67d+_0x462b83(0x160),()=>_0x44b2e5[_0x462b83(0x1a4)]['resolveFolderId'](_0x281955,_0x43f67d),{'verbose':_0x56c795['verbose']}),_0x41467c=_0x52653d[_0x462b83(0x17d)];_0x56c795[_0x462b83(0x1a7)]&&console[_0x462b83(0x180)](_0x462b83(0x1d5)+_0x41467c);const _0x2a0c12=await withSpinner(_0x462b83(0x163)+_0x43f67d+_0x462b83(0x160),()=>_0x44b2e5[_0x462b83(0x1a4)]['getFolder'](_0x41467c),{'verbose':_0x56c795['verbose']});return await handleSDKOutput([_0x2a0c12[_0x462b83(0x17d)]],_0x56c795),0x0;}catch(_0x4552ab){if(_0x4552ab instanceof SDKError)return console['error'](_0x462b83(0x19d)+_0x4552ab['message']),_0x4552ab[_0x462b83(0x1d8)]&&console['error'](_0x462b83(0x1cd)+_0x4552ab['cause']),0x1;throw _0x4552ab;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';[a36_0xc02027(0x1f7)]=a36_0xc02027(0x169);async['execute'](_0x36860a){const _0x411339=a36_0xc02027,{options:_0x4030db,args:_0x14d06d}=_0x36860a,_0x4c01c8=_0x4030db,_0x393e51=_0x4c01c8[_0x411339(0x1af)],_0x52de7a=_0x14d06d[0x0];if(!_0x52de7a&&!_0x393e51)return console[_0x411339(0x180)](a36_0x473c9d[_0x411339(0x1fe)](_0x411339(0x19f))),console[_0x411339(0x180)](_0x411339(0x16e)),console[_0x411339(0x180)](_0x411339(0x1d6)),console[_0x411339(0x180)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x411339(0x180)]('Examples:'),console['error'](_0x411339(0x1d7)),console[_0x411339(0x180)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x52de7a&&_0x393e51)return console['error'](a36_0x473c9d[_0x411339(0x1fe)](_0x411339(0x1fb))),0x1;try{let _0x41fac0;if(_0x393e51)_0x41fac0=await this[_0x411339(0x1b7)](_0x393e51,_0x36860a);else{if(isYamlFilePath(_0x52de7a))return console['error'](a36_0x473c9d['red'](_0x411339(0x172))),console[_0x411339(0x180)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x52de7a),0x1;else _0x41fac0=await this[_0x411339(0x1c9)](_0x52de7a,_0x36860a);}return _0x4030db[_0x411339(0x203)]===_0x411339(0x1f8)||_0x4030db['format']===_0x411339(0x18a)?await handleSDKOutput([{'sql':_0x41fac0}],_0x4030db):console['log'](_0x41fac0),0x0;}catch(_0x4a9d98){if(_0x4a9d98 instanceof SDKError)return console[_0x411339(0x180)]('Error:\x20'+_0x4a9d98[_0x411339(0x164)]),_0x4a9d98['cause']&&console[_0x411339(0x180)](_0x411339(0x1cd)+_0x4a9d98['cause']),0x1;throw _0x4a9d98;}}async['getSQLFromYamlFile'](_0x351591,_0xf6fe02){const _0x489c0a=a36_0xc02027,{options:_0x40dcf9,tdx:_0x47bd24}=_0xf6fe02;let _0x9c2e23;try{_0x9c2e23=await resolveYamlFilePath(_0x351591);}catch(_0x5fc9c6){throw new SDKError(ErrorCode[_0x489c0a(0x1ff)],_0x489c0a(0x1c6)+_0x5fc9c6[_0x489c0a(0x164)]);}_0x40dcf9['verbose']&&console[_0x489c0a(0x180)](_0x489c0a(0x17a)+_0x9c2e23[_0x489c0a(0x1d0)]+'/'+_0x9c2e23[_0x489c0a(0x178)]);const _0x1702b5=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x47bd24['segment']['getSegmentSQLFromYaml'](_0x9c2e23[_0x489c0a(0x1d2)],_0x9c2e23[_0x489c0a(0x1d0)],_0x9c2e23[_0x489c0a(0x178)]),{'verbose':_0x40dcf9['verbose']});return _0x1702b5[_0x489c0a(0x17d)];}async[a36_0xc02027(0x1c9)](_0x1161c0,_0x167a94){const _0x16b0b4=a36_0xc02027,{options:_0x123828,tdx:_0x15ce97}=_0x167a94,_0x5d4c87=_0x123828[_0x16b0b4(0x1d0)],_0x5b2565=await resolveSegmentTarget(_0x1161c0,_0x5d4c87,_0x123828['verbose']);_0x123828[_0x16b0b4(0x1a7)]&&console[_0x16b0b4(0x180)](_0x16b0b4(0x1eb)+_0x5b2565);const _0x4db687=await withSpinner(_0x16b0b4(0x1bc)+_0x1161c0+_0x16b0b4(0x160),()=>_0x15ce97[_0x16b0b4(0x1a4)][_0x16b0b4(0x1e9)](_0x5b2565),{'verbose':_0x123828['verbose']}),_0x3e5d5f=_0x4db687[_0x16b0b4(0x17d)];_0x123828[_0x16b0b4(0x1a7)]&&(console[_0x16b0b4(0x180)](_0x16b0b4(0x1f9)+_0x3e5d5f[_0x16b0b4(0x1fc)]),console[_0x16b0b4(0x180)](_0x16b0b4(0x179)+_0x3e5d5f[_0x16b0b4(0x16a)]));if(_0x3e5d5f[_0x16b0b4(0x1fc)]===_0x16b0b4(0x1c5))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x16b0b4(0x1f3));if(_0x3e5d5f[_0x16b0b4(0x1fc)]===_0x16b0b4(0x183))throw new SDKError(ErrorCode[_0x16b0b4(0x1ff)],_0x16b0b4(0x184));if(!_0x3e5d5f['segmentId'])throw new SDKError(ErrorCode[_0x16b0b4(0x1ec)],_0x16b0b4(0x161));const _0x3c779a=await withSpinner(_0x16b0b4(0x1ea),()=>_0x15ce97[_0x16b0b4(0x1a4)][_0x16b0b4(0x18d)](_0x3e5d5f[_0x16b0b4(0x16a)],_0x3e5d5f[_0x16b0b4(0x1da)]),{'verbose':_0x123828[_0x16b0b4(0x1a7)]});return _0x3c779a[_0x16b0b4(0x17d)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0xc02027(0x1ee)]=a36_0xc02027(0x1e7);['description']=a36_0xc02027(0x1b4);async[a36_0xc02027(0x18b)](_0x307745){const _0x4c94b7=a36_0xc02027,{options:_0x2849f6,args:_0x1c3ac1,tdx:_0x2aa855}=_0x307745,_0x2cc913=_0x2849f6;if(_0x1c3ac1[_0x4c94b7(0x194)]<0x2)return console[_0x4c94b7(0x180)](_0x4c94b7(0x198)),console[_0x4c94b7(0x180)](_0x4c94b7(0x1ba)),0x1;const _0x534773=_0x1c3ac1[0x0],_0x2bd2e1=_0x1c3ac1[0x1];_0x2cc913[_0x4c94b7(0x1a7)]&&(console[_0x4c94b7(0x180)](_0x4c94b7(0x191)+_0x2cc913[_0x4c94b7(0x1cf)]),console['error'](_0x4c94b7(0x197)+_0x534773),console['error'](_0x4c94b7(0x17e)+_0x2bd2e1));let _0x32cad1;if(_0x2cc913[_0x4c94b7(0x1e3)]){const _0x7c6c0c=_0x2cc913[_0x4c94b7(0x1e3)],_0x55c6d5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x534773+_0x4c94b7(0x160),()=>_0x2aa855[_0x4c94b7(0x1a4)][_0x4c94b7(0x166)](_0x534773),{'verbose':_0x2cc913[_0x4c94b7(0x1a7)]}),_0x375cd4=_0x55c6d5[_0x4c94b7(0x17d)],_0x21cc71=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x7c6c0c+_0x4c94b7(0x160),()=>_0x2aa855[_0x4c94b7(0x1a4)][_0x4c94b7(0x1de)](_0x375cd4,_0x7c6c0c),{'verbose':_0x2cc913[_0x4c94b7(0x1a7)]});_0x32cad1=_0x21cc71['data'],_0x2cc913[_0x4c94b7(0x1a7)]&&console[_0x4c94b7(0x180)](_0x4c94b7(0x1cb)+_0x32cad1);}const _0x4c4b27={'name':_0x2bd2e1,'description':_0x2cc913[_0x4c94b7(0x1f7)],'parentFolderId':_0x32cad1},_0x26fa23=await withSpinner('Creating\x20folder\x20\x27'+_0x2bd2e1+_0x4c94b7(0x160),()=>_0x2aa855[_0x4c94b7(0x1a4)][_0x4c94b7(0x1dd)](_0x534773,_0x4c4b27),{'verbose':_0x2cc913[_0x4c94b7(0x1a7)]}),_0x4e9831=_0x26fa23['data'];return console[_0x4c94b7(0x180)](_0x4c94b7(0x1e6)+_0x4e9831['name']+'\x27\x20with\x20ID:\x20'+_0x4e9831['id']),await handleSDKOutput([_0x4e9831],_0x2cc913),0x0;}}export class SegmentViewCommand extends BaseCommand{[a36_0xc02027(0x1ee)]=a36_0xc02027(0x1ca);['description']=a36_0xc02027(0x186);async[a36_0xc02027(0x18b)](_0x32074f){const _0x3d6172=a36_0xc02027,{options:_0x4eeb72,args:_0x571201,tdx:_0x42c0de}=_0x32074f,_0x170fad=_0x571201[0x0];if(!_0x170fad)return console['error'](_0x3d6172(0x181)),console['error'](_0x3d6172(0x19c)),console['error'](_0x3d6172(0x18c)),console[_0x3d6172(0x180)](_0x3d6172(0x165)),console[_0x3d6172(0x180)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3d6172(0x180)]('Examples:'),console[_0x3d6172(0x180)](_0x3d6172(0x1b8)),console[_0x3d6172(0x180)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x3d6172(0x180)](_0x3d6172(0x1fd)),console[_0x3d6172(0x180)](_0x3d6172(0x1f5)),0x1;try{const _0x3d154f=_0x4eeb72[_0x3d6172(0x1d0)],_0x5afb32=await resolveSegmentTarget(_0x170fad,_0x3d154f,_0x4eeb72[_0x3d6172(0x1a7)]);_0x4eeb72[_0x3d6172(0x1a7)]&&console['error'](_0x3d6172(0x1eb)+_0x5afb32);const _0x2f01f1=await withSpinner('Resolving\x20\x27'+_0x170fad+'\x27...',()=>_0x42c0de[_0x3d6172(0x1a4)][_0x3d6172(0x1e9)](_0x5afb32),{'verbose':_0x4eeb72['verbose']}),_0x13cb16=_0x2f01f1[_0x3d6172(0x17d)];_0x4eeb72[_0x3d6172(0x1a7)]&&(console[_0x3d6172(0x180)](_0x3d6172(0x1f9)+_0x13cb16['type']),console[_0x3d6172(0x180)](_0x3d6172(0x179)+_0x13cb16[_0x3d6172(0x16a)]),_0x13cb16['folderId']&&console[_0x3d6172(0x180)](_0x3d6172(0x1a6)+_0x13cb16['folderId']),_0x13cb16[_0x3d6172(0x1da)]&&console[_0x3d6172(0x180)](_0x3d6172(0x1aa)+_0x13cb16[_0x3d6172(0x1da)]));if(_0x4eeb72['web']){if(_0x13cb16[_0x3d6172(0x1fc)]==='folder')return console[_0x3d6172(0x180)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x13cb16[_0x3d6172(0x1fc)]===_0x3d6172(0x183))return console['error']('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3d6172(0x180)](_0x3d6172(0x168)),0x1;if(!_0x13cb16['segmentId'])throw new SDKError(ErrorCode[_0x3d6172(0x1ec)],_0x3d6172(0x161));const _0x22ac6a=getConsoleNextUrl(_0x4eeb72[_0x3d6172(0x1cf)],_0x3d6172(0x17f)+_0x13cb16[_0x3d6172(0x16a)]+'/e/'+_0x13cb16[_0x3d6172(0x1da)]);return console['error'](a36_0x473c9d[_0x3d6172(0x190)]('✔')+'\x20Opening\x20'+a36_0x473c9d[_0x3d6172(0x1f1)](_0x22ac6a)),openBrowser(_0x22ac6a),0x0;}if(_0x13cb16[_0x3d6172(0x1fc)]===_0x3d6172(0x1c5)){if(!_0x13cb16['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3d6172(0x1e8));const _0x36590e=await withSpinner(_0x3d6172(0x196),()=>_0x42c0de[_0x3d6172(0x1a4)][_0x3d6172(0x1a5)](_0x13cb16['folderId']),{'verbose':_0x4eeb72['verbose']});await handleSingleObjectOutput(_0x36590e[_0x3d6172(0x17d)],_0x4eeb72);}else{if(_0x13cb16[_0x3d6172(0x1fc)]==='segment'){if(!_0x13cb16['segmentId'])throw new SDKError(ErrorCode[_0x3d6172(0x1ec)],_0x3d6172(0x161));const _0x435990=await withSpinner(_0x3d6172(0x1c2),()=>_0x42c0de[_0x3d6172(0x1a4)][_0x3d6172(0x1ef)](_0x13cb16[_0x3d6172(0x16a)],_0x13cb16[_0x3d6172(0x1da)]),{'verbose':_0x4eeb72[_0x3d6172(0x1a7)]}),_0x3ce36d=getConsoleNextUrl(_0x4eeb72['site'],_0x3d6172(0x17f)+_0x13cb16[_0x3d6172(0x16a)]+_0x3d6172(0x175)+_0x13cb16[_0x3d6172(0x1da)]),_0x3154eb=_0x435990[_0x3d6172(0x17d)];_0x3154eb[_0x3d6172(0x174)]=_0x3ce36d,await handleSingleObjectOutput(_0x3154eb,_0x4eeb72);}else return console['error'](_0x3d6172(0x1f0)),console[_0x3d6172(0x180)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x40cdfd){if(_0x40cdfd instanceof SDKError)return console['error']('Error:\x20'+_0x40cdfd[_0x3d6172(0x164)]),_0x40cdfd[_0x3d6172(0x1d8)]&&console[_0x3d6172(0x180)]('\x20\x20Cause:\x20'+_0x40cdfd[_0x3d6172(0x1d8)]),0x1;throw _0x40cdfd;}}}function a36_0xf267(_0x421444,_0x2a5d59){_0x421444=_0x421444-0x160;const _0x149e82=a36_0x149e();let _0xf2675b=_0x149e82[_0x421444];return _0xf2675b;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a36_0xc02027(0x1ee)]=a36_0xc02027(0x1ac);['description']=a36_0xc02027(0x19b);async[a36_0xc02027(0x18b)](_0x5a61a7){const _0x3750a9=a36_0xc02027,{options:_0x179af9,args:_0x4fd9b3,tdx:_0x2d1bc7}=_0x5a61a7,_0x2321a4=_0x4fd9b3[0x0];if(!_0x2321a4)return console['error'](_0x3750a9(0x171)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x3750a9(0x1c0)),console[_0x3750a9(0x180)]('Examples:'),console[_0x3750a9(0x180)](_0x3750a9(0x199)),console[_0x3750a9(0x180)](_0x3750a9(0x1ae)),0x1;try{const _0x1fb8de=_0x179af9[_0x3750a9(0x1d0)],_0x25c38a=await resolveSegmentTarget(_0x2321a4,_0x1fb8de,_0x179af9[_0x3750a9(0x1a7)]);_0x179af9[_0x3750a9(0x1a7)]&&console[_0x3750a9(0x180)](_0x3750a9(0x1eb)+_0x25c38a);const _0x282fe3=await withSpinner(_0x3750a9(0x1bc)+_0x2321a4+_0x3750a9(0x160),()=>_0x2d1bc7[_0x3750a9(0x1a4)][_0x3750a9(0x1e9)](_0x25c38a),{'verbose':_0x179af9['verbose']}),_0x3d528a=_0x282fe3[_0x3750a9(0x17d)];_0x179af9[_0x3750a9(0x1a7)]&&(console[_0x3750a9(0x180)](_0x3750a9(0x1f9)+_0x3d528a[_0x3750a9(0x1fc)]),console[_0x3750a9(0x180)](_0x3750a9(0x179)+_0x3d528a[_0x3750a9(0x16a)]));if(_0x3d528a[_0x3750a9(0x1fc)]==='folder')return console[_0x3750a9(0x180)](_0x3750a9(0x1a1)),console['error'](_0x3750a9(0x1a9)),0x1;if(_0x3d528a[_0x3750a9(0x1fc)]==='parent')return console[_0x3750a9(0x180)](_0x3750a9(0x1c3)),console[_0x3750a9(0x180)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x3d528a['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3750a9(0x161));const _0x1fb9a6=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2d1bc7['segment'][_0x3750a9(0x18d)](_0x3d528a[_0x3750a9(0x16a)],_0x3d528a[_0x3750a9(0x1da)]),{'verbose':_0x179af9[_0x3750a9(0x1a7)]}),_0xf7f25=_0x1fb9a6[_0x3750a9(0x17d)],_0x1c9e57=await executeSchemaQuery(_0xf7f25,_0x2d1bc7,_0x179af9);return await handleQueryOutput(_0x1c9e57,_0x179af9),0x0;}catch(_0x3c50bc){if(_0x3c50bc instanceof SDKError)return console[_0x3750a9(0x180)](_0x3750a9(0x19d)+_0x3c50bc[_0x3750a9(0x164)]),_0x3c50bc[_0x3750a9(0x1d8)]&&console[_0x3750a9(0x180)](_0x3750a9(0x1cd)+_0x3c50bc['cause']),0x1;throw _0x3c50bc;}}}function a36_0x149e(){const _0x562b2e=['Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20reference\x20is\x20required','folder','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20[Job\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getSQLFromServerSegment','segment:view','Resolved\x20parent\x20folder\x20ID:\x20','includes','\x20\x20Cause:\x20','folderPath','site','parentSegment','848yHUZbl','content','Executing\x20segment\x20query...','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Resolved\x20folder\x20ID:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','cause','folderId','segmentId','782960wyytHw','test','createFolder','resolveFolderId','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20folder','Parent\x20name:\x20','✖\x20Query\x20failed\x20[','parentFolder','Resolved\x20parent\x20ID:\x20','135MBBzRW','✔\x20Created\x20folder\x20\x27','segment:folder:create','Folder\x20ID\x20missing\x20from\x20resolved\x20path','resolvePathToResource','Fetching\x20SQL\x20for\x20segment...','Target\x20path:\x20','SEGMENT_NOT_FOUND','processedRows','name','getSegment','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','cyan','Examples:','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','14590554upnBbw','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20rows\x20','description','json','Resolved\x20type:\x20','Resolving\x20path\x20\x27','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','type','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','red','INVALID_ARGUMENT','segmentPath','Show\x20segment\x20or\x20folder\x20details','Resolved\x20relative\x20path\x20to:\x20','format','\x27...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','replace','Fetching\x20folder\x20\x27','message','Options:','resolveParentId','Listing\x20folders\x20for\x20parent\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','Get\x20SQL\x20query\x20for\x20child\x20segment','parentId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Usage:','3717648uXduMl','segment:folder:show','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','information_schema','url','/e/','Resolving\x20parent\x20segment\x20\x27','jobId','segmentName','Parent\x20ID:\x20','Resolved:\x20','Use:\x20tdx\x20ps\x20show','fullPath','data','Folder\x20name:\x20','/app/ps/','error','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','parent','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Show\x20folder\x20or\x20child\x20segment\x20details','code','✔\x20Found\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','jsonl','execute','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getSegmentSQL','\x20\x20Segment\x20name:\x20','Show\x20segment\x20folder\x20details','green','Site:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','limit','length','7WHrsRe','Fetching\x20folder\x20details...','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','413248cEfbld','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20','\x20\x20Folder\x20path:\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','1075PGmktp','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segment','getFolder','Folder\x20ID:\x20','verbose','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Segment\x20ID:\x20','query','segment:desc','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','path','\x20\x20Full\x20path:\x20','102CiLSby','26900UxpDEk','in\x20','Create\x20segment\x20folder\x20for\x20organization','toLocaleString','stats','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Query\x20completed:\x20Processed\x20','Resolving\x20\x27','setJobId','3277878xncfdL','\x20\x20Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','trim','Fetching\x20segment\x20details...'];a36_0x149e=function(){return _0x562b2e;};return a36_0x149e();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a37_0x2a6d82=a37_0x390d;(function(_0x4b73d2,_0x1d4e25){const _0x2e4067=a37_0x390d,_0x3d1e1a=_0x4b73d2();while(!![]){try{const _0x4fa61e=parseInt(_0x2e4067(0x90))/0x1+parseInt(_0x2e4067(0x7e))/0x2*(parseInt(_0x2e4067(0x84))/0x3)+-parseInt(_0x2e4067(0xa1))/0x4*(parseInt(_0x2e4067(0x9d))/0x5)+parseInt(_0x2e4067(0x91))/0x6+-parseInt(_0x2e4067(0x97))/0x7*(parseInt(_0x2e4067(0x9a))/0x8)+parseInt(_0x2e4067(0x8d))/0x9*(-parseInt(_0x2e4067(0xac))/0xa)+-parseInt(_0x2e4067(0x7c))/0xb;if(_0x4fa61e===_0x1d4e25)break;else _0x3d1e1a['push'](_0x3d1e1a['shift']());}catch(_0x929e18){_0x3d1e1a['push'](_0x3d1e1a['shift']());}}}(a37_0x2658,0x98e17));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a37_0x390d(_0x175285,_0x5bc305){_0x175285=_0x175285-0x7b;const _0x265880=a37_0x2658();let _0x390da7=_0x265880[_0x175285];return _0x390da7;}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 a37_0x4adf1c from'chalk';function a37_0x2658(){const _0x53d8d3=['14gfnePv','Examples:','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','1145712OtpMng','noCountPopulation','Resolved\x20relative\x20path\x20to:\x20','5JSZhgg','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','folderId','segment','1716884VAkQcA','length','name','resolvePathToResource','Resolved\x20folder\x20ID:\x20','createSegment','\x27...','type','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','description','Resolving\x20folder\x20\x27','5465110BejYIA','includes','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','site','7580375vvHFcH','segment:create','2350786kFMckz','Site:\x20','Creating\x20segment\x20\x27','error','kind','✔\x20Created\x20segment\x20\x27','3YVBlpQ','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments','rule','yellow','verbose','data','18Gbdwrz','segmentPath','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','821917VDQGKD','6760110rcbCNQ','Resolving\x20folder\x20path\x20\x27','Parent:\x20','Resolving\x20parent\x20segment\x20\x27','folder','Target\x20path:\x20'];a37_0x2658=function(){return _0x53d8d3;};return a37_0x2658();}export class SegmentCreateCommand extends BaseCommand{[a37_0x2a6d82(0xa3)]=a37_0x2a6d82(0x7d);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x3c0e02){const _0x2a0020=a37_0x2a6d82;console[_0x2a0020(0x81)](a37_0x4adf1c[_0x2a0020(0x8a)](_0x2a0020(0x8f))),console[_0x2a0020(0x81)](a37_0x4adf1c[_0x2a0020(0x8a)](_0x2a0020(0x99)));const {options:_0x3bd5bb,args:_0x17ec2b,tdx:_0x11367e}=_0x3c0e02,_0x2c74a4=_0x3bd5bb;if(_0x17ec2b[_0x2a0020(0xa2)]===0x0)return console['error'](_0x2a0020(0xa9)),console[_0x2a0020(0x81)](_0x2a0020(0x87)),console['error'](_0x2a0020(0x98)),console[_0x2a0020(0x81)](_0x2a0020(0x85)),console[_0x2a0020(0x81)](_0x2a0020(0x86)),console[_0x2a0020(0x81)](_0x2a0020(0xae)),0x1;const _0x32a8a0=_0x17ec2b[0x0],_0x408a64=_0x3bd5bb[_0x2a0020(0x8e)];let _0x280667=_0x32a8a0;_0x408a64&&!_0x32a8a0[_0x2a0020(0xad)]('/')&&(_0x280667=_0x408a64+'/'+_0x32a8a0,_0x2c74a4[_0x2a0020(0x8b)]&&console[_0x2a0020(0x81)](_0x2a0020(0x9c)+_0x280667));const _0x16e199=parsePath(_0x280667);if(_0x16e199[_0x2a0020(0x88)][_0x2a0020(0xa2)]<0x2)return console[_0x2a0020(0x81)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x2a0020(0x81)](_0x2a0020(0x9e)),0x1;const _0x1b0a18=_0x16e199['segments'][0x0],_0x45add9=getBaseName(_0x280667),_0x1b4dfb=getParentPath(_0x280667);_0x2c74a4[_0x2a0020(0x8b)]&&(console[_0x2a0020(0x81)](_0x2a0020(0x7f)+_0x2c74a4[_0x2a0020(0x7b)]),console[_0x2a0020(0x81)](_0x2a0020(0x96)+_0x280667),console['error'](_0x2a0020(0x93)+_0x1b0a18),console[_0x2a0020(0x81)]('Segment\x20name:\x20'+_0x45add9),console['error']('Parent\x20path:\x20'+_0x1b4dfb));const _0x154d86=await withSpinner(_0x2a0020(0x94)+_0x1b0a18+_0x2a0020(0xa7),()=>_0x11367e[_0x2a0020(0xa0)]['resolveParentId'](_0x1b0a18),{'verbose':_0x2c74a4[_0x2a0020(0x8b)]}),_0x20d77c=_0x154d86['data'];let _0x4f98cc;if(_0x16e199[_0x2a0020(0x88)][_0x2a0020(0xa2)]>0x2){const _0x4fe084=await withSpinner(_0x2a0020(0x92)+_0x1b4dfb+_0x2a0020(0xa7),()=>_0x11367e['segment'][_0x2a0020(0xa4)](_0x1b4dfb),{'verbose':_0x2c74a4[_0x2a0020(0x8b)]}),_0x1cad60=_0x4fe084[_0x2a0020(0x8c)];if(_0x1cad60[_0x2a0020(0xa8)]!==_0x2a0020(0x95)&&_0x1cad60['type']!=='parent')return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x4f98cc=_0x1cad60[_0x2a0020(0x9f)];}else{if(_0x2c74a4[_0x2a0020(0x95)]){const _0x155942=await withSpinner(_0x2a0020(0xab)+_0x2c74a4[_0x2a0020(0x95)]+_0x2a0020(0xa7),()=>_0x11367e[_0x2a0020(0xa0)]['resolveFolderId'](_0x20d77c,_0x2c74a4[_0x2a0020(0x95)]),{'verbose':_0x2c74a4[_0x2a0020(0x8b)]});_0x4f98cc=_0x155942['data'];}}_0x2c74a4['verbose']&&_0x4f98cc&&console['error'](_0x2a0020(0xa5)+_0x4f98cc);const _0x1e0135=await loadJSONFromOptions(_0x2c74a4[_0x2a0020(0x89)],_0x2c74a4['ruleFile']),_0x30b679={'name':_0x45add9,'description':_0x2c74a4[_0x2a0020(0xaa)],'rule':_0x1e0135,'kind':_0x2c74a4[_0x2a0020(0x82)]!==undefined?parseInt(_0x2c74a4[_0x2a0020(0x82)],0xa):undefined,'isVisible':_0x2c74a4['invisible']?![]:undefined,'segmentFolderId':_0x4f98cc,'countPopulation':_0x2c74a4[_0x2a0020(0x9b)]?![]:undefined},_0x5b475f=await withSpinner(_0x2a0020(0x80)+_0x45add9+_0x2a0020(0xa7),()=>_0x11367e['segment'][_0x2a0020(0xa6)](_0x20d77c,_0x30b679),{'verbose':_0x2c74a4[_0x2a0020(0x8b)]}),_0x1f0579=_0x5b475f[_0x2a0020(0x8c)];return console[_0x2a0020(0x81)](_0x2a0020(0x83)+_0x1f0579[_0x2a0020(0xa3)]+'\x27\x20with\x20ID:\x20'+_0x1f0579['id']),_0x280667!==_0x32a8a0&&console['error']('\x20\x20\x20Path:\x20'+_0x280667),await handleSDKOutput([_0x1f0579],_0x2c74a4),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x4161f0=a38_0xeb63;function a38_0x182b(){const _0xf9b597=['listFields','site','11050FmwfKK','219axnLMf','\x20field','12aXgsmQ','4217888AxtAdC','List\x20available\x20fields\x20for\x20segmentation','verbose','execute','16534474ksmRjq','error','length','Site:\x20','jsonl','38106VkgKuq','1053QoGUYl','description','segment','Listing\x20fields\x20for\x20\x27','14BiEkyb','233260dQyCOc','json','105lYGxse','segment:fields','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','82905iQLznz','Error:\x20Parent\x20segment\x20name\x20is\x20required','2551614GXPHXT','✔\x20Found\x20','name'];a38_0x182b=function(){return _0xf9b597;};return a38_0x182b();}(function(_0x2157f1,_0x208e75){const _0x25da3b=a38_0xeb63,_0xa2319d=_0x2157f1();while(!![]){try{const _0x4f8a18=-parseInt(_0x25da3b(0x136))/0x1+parseInt(_0x25da3b(0x12b))/0x2*(-parseInt(_0x25da3b(0x11f))/0x3)+parseInt(_0x25da3b(0x131))/0x4*(parseInt(_0x25da3b(0x133))/0x5)+parseInt(_0x25da3b(0x138))/0x6+-parseInt(_0x25da3b(0x130))/0x7*(parseInt(_0x25da3b(0x122))/0x8)+parseInt(_0x25da3b(0x12c))/0x9*(parseInt(_0x25da3b(0x11e))/0xa)+-parseInt(_0x25da3b(0x126))/0xb*(-parseInt(_0x25da3b(0x121))/0xc);if(_0x4f8a18===_0x208e75)break;else _0xa2319d['push'](_0xa2319d['shift']());}catch(_0x4d54be){_0xa2319d['push'](_0xa2319d['shift']());}}}(a38_0x182b,0xb8189));function a38_0xeb63(_0x5cdb68,_0x3709d3){_0x5cdb68=_0x5cdb68-0x11e;const _0x182b3b=a38_0x182b();let _0xeb63f8=_0x182b3b[_0x5cdb68];return _0xeb63f8;}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{[a38_0x4161f0(0x13a)]=a38_0x4161f0(0x134);[a38_0x4161f0(0x12d)]=a38_0x4161f0(0x123);async[a38_0x4161f0(0x125)](_0x18b629){const _0x16332f=a38_0x4161f0,{options:_0x3a75fc,args:_0x192397,tdx:_0x38b2c6}=_0x18b629,_0x574526=_0x192397[0x0]||_0x3a75fc['parentSegment'];if(!_0x574526)return console[_0x16332f(0x127)](_0x16332f(0x137)),console['error'](_0x16332f(0x135)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x3a75fc[_0x16332f(0x124)]&&(console[_0x16332f(0x127)](_0x16332f(0x129)+_0x3a75fc[_0x16332f(0x13c)]),console[_0x16332f(0x127)]('Parent\x20segment:\x20'+_0x574526));const _0x150bc8=await withSpinner(_0x16332f(0x12f)+_0x574526+'\x27...',()=>_0x38b2c6[_0x16332f(0x12e)][_0x16332f(0x13b)](_0x574526),{'verbose':_0x3a75fc[_0x16332f(0x124)]}),_0x4947c9=_0x150bc8['data'];console[_0x16332f(0x127)](_0x16332f(0x139)+_0x4947c9[_0x16332f(0x128)]+_0x16332f(0x120)+(_0x4947c9['length']!==0x1?'s':''));if(_0x3a75fc[_0x16332f(0x132)]||_0x3a75fc[_0x16332f(0x12a)])return await handleSDKOutput(_0x4947c9,_0x3a75fc),0x0;return displayFieldsHumanReadable(_0x4947c9,_0x574526),0x0;}}
|