@treasuredata/tdx 2026.3.40 → 2026.3.42
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/cas-command.js +1 -1
- package/dist/commands/cas-segment-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/work-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/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.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.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/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/segment-validator.js.map +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/cdp.d.ts +3 -0
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.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/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.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 a33_0x3172a7=a33_0x4a28;(function(_0x1f622a,_0x4a2a37){const _0xab3855=a33_0x4a28,_0x46c35b=_0x1f622a();while(!![]){try{const _0x440699=parseInt(_0xab3855(0x11c))/0x1*(parseInt(_0xab3855(0x148))/0x2)+parseInt(_0xab3855(0x141))/0x3+parseInt(_0xab3855(0x139))/0x4+-parseInt(_0xab3855(0x146))/0x5+-parseInt(_0xab3855(0x135))/0x6+-parseInt(_0xab3855(0x123))/0x7+parseInt(_0xab3855(0x12a))/0x8*(parseInt(_0xab3855(0x13d))/0x9);if(_0x440699===_0x4a2a37)break;else _0x46c35b['push'](_0x46c35b['shift']());}catch(_0x183532){_0x46c35b['push'](_0x46c35b['shift']());}}}(a33_0x4320,0x92f63));import{BaseCommand}from'./command.js';function a33_0x4a28(_0x1ede3a,_0x4b8217){_0x1ede3a=_0x1ede3a-0x118;const _0x432095=a33_0x4320();let _0x4a2861=_0x432095[_0x1ede3a];return _0x4a2861;}function a33_0x4320(){const _0x3599cc=['\x20—\x20','Fetching\x20permissions...','policy','🔑\x20Effective\x20Permissions','Account\x20Owner','\x20polic','👥\x20Assigned\x20Users','verbose','ies','execute','1aiVIwd','length','site','\x20\x20No\x20permissions','getPolicy','map','\x20\x20No\x20policies\x20assigned','8302539FdeMkv','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','user','validate','name','error','email','691688dUBiEO',',\x20user_id:','operation','\x20\x20\x20','\x20\x20•\x20','log','getMyPermissions','max','Administrator','permissions','args','5246952yHmwzm','📋\x20Assigned\x20Policies','join','policy\x20show','2232848gtOMjG','✔\x20Found\x20','data','context','243WYzLVQ','dim','policy\x20list','all','251403xwneKd','bold','(ID:\x20','description','administrator','4582845VvDmzA','entries','1205266FEsjFw','No\x20policies\x20found','getCurrent','listPolicies'];a33_0x4320=function(){return _0x3599cc;};return a33_0x4320();}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x6494aa from'chalk';export class PolicyCommand extends BaseCommand{[a33_0x3172a7(0x127)]=a33_0x3172a7(0x14e);['description']='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a33_0x3172a7(0x11b)](_0xe390a){const _0x215ca9=a33_0x3172a7,{options:_0x2ee6cc,tdx:_0x236c57}=_0xe390a,_0x364759=await withSpinner(_0x215ca9(0x14d),async()=>{const _0x3e135d=_0x215ca9,[_0x26838b,_0x50f558]=await Promise[_0x3e135d(0x140)]([_0x236c57[_0x3e135d(0x125)][_0x3e135d(0x14a)](),_0x236c57[_0x3e135d(0x14e)][_0x3e135d(0x130)]()]);return{'userInfo':_0x26838b,'permissions':_0x50f558};},{'verbose':_0x2ee6cc['verbose']}),{userInfo:_0x4c6cd4,permissions:_0x505f56}=_0x364759[_0x215ca9(0x13b)];if(isStructuredFormat(_0x2ee6cc))return await handleSingleObjectOutput(_0x505f56,_0x2ee6cc),0x0;const _0x54c6bb=_0x4c6cd4['account_owner']?_0x215ca9(0x150):_0x4c6cd4[_0x215ca9(0x145)]?_0x215ca9(0x132):'Member';console[_0x215ca9(0x12f)]('\x0a'+a33_0x6494aa[_0x215ca9(0x142)]('👤')+'\x20'+a33_0x6494aa[_0x215ca9(0x142)](_0x4c6cd4[_0x215ca9(0x127)])+'\x20'+a33_0x6494aa[_0x215ca9(0x13e)]('('+_0x4c6cd4[_0x215ca9(0x129)]+')')+_0x215ca9(0x14c)+_0x54c6bb),console[_0x215ca9(0x12f)](a33_0x6494aa['dim'](_0x215ca9(0x12d)+_0x236c57[_0x215ca9(0x13c)][_0x215ca9(0x11e)]+':'+_0x4c6cd4['account_id']+_0x215ca9(0x12b)+_0x4c6cd4['id']));const _0x27bc7e=_0x505f56['policies'];console[_0x215ca9(0x12f)]('\x0a'+a33_0x6494aa[_0x215ca9(0x142)](_0x215ca9(0x136))+'\x20('+_0x27bc7e[_0x215ca9(0x11d)]+'):');if(_0x27bc7e['length']===0x0)console[_0x215ca9(0x12f)](a33_0x6494aa[_0x215ca9(0x13e)](_0x215ca9(0x122)));else for(const _0x12086b of _0x27bc7e){console[_0x215ca9(0x12f)](_0x215ca9(0x12e)+_0x12086b[_0x215ca9(0x127)]);}return printPermissionsMap(_0x505f56[_0x215ca9(0x133)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x3172a7(0x127)]=a33_0x3172a7(0x13f);[a33_0x3172a7(0x144)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x3172a7(0x11b)](_0x18404e){const _0x5c27c7=a33_0x3172a7,{options:_0x4ae2a5,tdx:_0x531b41}=_0x18404e,_0x6340d1=await withSpinner('Listing\x20policies...',()=>_0x531b41[_0x5c27c7(0x14e)][_0x5c27c7(0x14b)](),{'verbose':_0x4ae2a5[_0x5c27c7(0x119)]}),_0x32424b=_0x6340d1[_0x5c27c7(0x13b)];console[_0x5c27c7(0x128)](_0x5c27c7(0x13a)+_0x32424b['length']+_0x5c27c7(0x151)+(_0x32424b[_0x5c27c7(0x11d)]!==0x1?_0x5c27c7(0x11a):'y'));if(isStructuredFormat(_0x4ae2a5))return await handleSDKOutput(_0x32424b,_0x4ae2a5),0x0;if(_0x32424b['length']===0x0)console[_0x5c27c7(0x12f)](a33_0x6494aa[_0x5c27c7(0x13e)](_0x5c27c7(0x149)));else for(const _0x4bd4e7 of _0x32424b){const _0x48406a=_0x4bd4e7['description']?a33_0x6494aa[_0x5c27c7(0x13e)](_0x5c27c7(0x14c)+_0x4bd4e7[_0x5c27c7(0x144)]):'';console[_0x5c27c7(0x12f)](_0x5c27c7(0x12e)+_0x4bd4e7['name']+_0x48406a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x3172a7(0x127)]=a33_0x3172a7(0x138);[a33_0x3172a7(0x144)]='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a33_0x3172a7(0x126)](_0x1fad9a){const _0x4f46df=a33_0x3172a7;if(_0x1fad9a[_0x4f46df(0x134)][_0x4f46df(0x11d)]===0x0)return _0x4f46df(0x124);return undefined;}async[a33_0x3172a7(0x11b)](_0x14b95c){const _0x521bcb=a33_0x3172a7,{options:_0x4ec60a,tdx:_0x273068}=_0x14b95c,_0x1e010e=_0x14b95c[_0x521bcb(0x134)][0x0],_0x3e7866=await withSpinner('Fetching\x20policy...',async()=>{const _0x256424=_0x521bcb,_0xc30904=await _0x273068[_0x256424(0x14e)][_0x256424(0x120)](_0x1e010e),[_0x2df096,_0x19fa21]=await Promise[_0x256424(0x140)]([_0x273068[_0x256424(0x14e)]['getPolicyPermissions'](_0xc30904['id']),_0x273068[_0x256424(0x14e)]['getPolicyUsers'](_0xc30904['id'])]);return{'policy':_0xc30904,'perms':_0x2df096,'users':_0x19fa21};},{'verbose':_0x4ec60a[_0x521bcb(0x119)]}),{policy:_0x195067,perms:_0xc373b1,users:_0x3f19ad}=_0x3e7866[_0x521bcb(0x13b)];if(isStructuredFormat(_0x4ec60a))return await handleSingleObjectOutput({..._0x195067,'permissions':_0xc373b1[_0x521bcb(0x133)],'users':_0x3f19ad},_0x4ec60a),0x0;console[_0x521bcb(0x12f)]('\x0a'+a33_0x6494aa[_0x521bcb(0x142)]('📋')+'\x20'+a33_0x6494aa[_0x521bcb(0x142)](_0x195067[_0x521bcb(0x127)])+'\x20'+a33_0x6494aa[_0x521bcb(0x13e)](_0x521bcb(0x143)+_0x195067['id']+')'));_0x195067['description']&&console[_0x521bcb(0x12f)](_0x521bcb(0x12d)+a33_0x6494aa[_0x521bcb(0x13e)](_0x195067[_0x521bcb(0x144)]));console[_0x521bcb(0x12f)](_0x521bcb(0x12d)+_0x3f19ad[_0x521bcb(0x11d)]+'\x20user'+(_0x3f19ad[_0x521bcb(0x11d)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0xc373b1[_0x521bcb(0x133)]);if(_0x3f19ad[_0x521bcb(0x11d)]>0x0){console[_0x521bcb(0x12f)]('\x0a'+a33_0x6494aa['bold'](_0x521bcb(0x118))+':');for(const _0x1c7c7a of _0x3f19ad){const _0x58740a=_0x1c7c7a['email']&&_0x1c7c7a[_0x521bcb(0x129)]!==_0x1c7c7a[_0x521bcb(0x127)]?a33_0x6494aa[_0x521bcb(0x13e)]('\x20<'+_0x1c7c7a[_0x521bcb(0x129)]+'>'):'';console[_0x521bcb(0x12f)](_0x521bcb(0x12e)+_0x1c7c7a[_0x521bcb(0x127)]+_0x58740a);}}return console[_0x521bcb(0x12f)](),0x0;}}function printPermissionsMap(_0x4986ac){const _0x5c0d70=a33_0x3172a7,_0x2ecec0=Object[_0x5c0d70(0x147)](_0x4986ac);console[_0x5c0d70(0x12f)]('\x0a'+a33_0x6494aa[_0x5c0d70(0x142)](_0x5c0d70(0x14f))+':');if(_0x2ecec0[_0x5c0d70(0x11d)]===0x0){console[_0x5c0d70(0x12f)](a33_0x6494aa['dim'](_0x5c0d70(0x11f)));return;}const _0xad4775=Math[_0x5c0d70(0x131)](..._0x2ecec0[_0x5c0d70(0x121)](([_0x2c99a9])=>_0x2c99a9['length']));for(const [_0x3ac9cb,_0x14c10f]of _0x2ecec0){const _0x2f042e=formatOperations(_0x14c10f);console['log']('\x20\x20'+_0x3ac9cb['padEnd'](_0xad4775+0x2)+_0x2f042e);}}function formatOperations(_0x4510d6){const _0x4e92bf=a33_0x3172a7,_0x2dde2d=[...new Set(_0x4510d6[_0x4e92bf(0x121)](_0x364472=>_0x364472[_0x4e92bf(0x12c)]))];return _0x2dde2d[_0x4e92bf(0x137)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a34_0x55b236=a34_0x4008;(function(_0x34958f,_0x1fca30){const _0x5b7477=a34_0x4008,_0x13b64a=_0x34958f();while(!![]){try{const _0x56c1ef=-parseInt(_0x5b7477(0x182))/0x1+parseInt(_0x5b7477(0x19f))/0x2*(-parseInt(_0x5b7477(0x1d4))/0x3)+-parseInt(_0x5b7477(0x1be))/0x4+parseInt(_0x5b7477(0x188))/0x5+-parseInt(_0x5b7477(0x16c))/0x6*(parseInt(_0x5b7477(0x16a))/0x7)+parseInt(_0x5b7477(0x165))/0x8+parseInt(_0x5b7477(0x1ae))/0x9*(parseInt(_0x5b7477(0x1d6))/0xa);if(_0x56c1ef===_0x1fca30)break;else _0x13b64a['push'](_0x13b64a['shift']());}catch(_0x6f5e71){_0x13b64a['push'](_0x13b64a['shift']());}}}(a34_0x31f8,0xd8fe3));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a34_0x31f8(){const _0x12ec5a=['logLevel','Profile\x20\x27','create','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','error','getUserInfo','llm_agent','oauth','\x27\x20removed\x20from\x20configuration','trim','5335hMXjyh','method','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20your\x20TD\x20API\x20key:','test','Profile\x20name\x20cannot\x20be\x20empty','7404905GmTAcq','Set\x20a\x20profile\x20configuration\x20value','✗\x20Validation\x20failed:\x20','\x20\x20tdx\x20--profile\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','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>','profile:remove','OAuth\x20(browser\x20login)','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20\x20(no\x20profiles\x20found)','warn','profile:use','(cleared)','validate','session','dim','VALID_KEYS','bold','\x0aOperation\x20cancelled','split','\x20API\x20key\x20removed\x20from\x20system\x20keychain','jobs','62YoSJaZ','tdx:\x20profile\x20set','Enter\x20profile\x20name:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile','red','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Validating\x20API\x20key...','\x0aSetup\x20cancelled','API\x20Key','You\x20can\x20find\x20your\x20API\x20key\x20at:','site','\x27.\x0a\x0aValid\x20keys:\x20','select','join','19269729InmcwD','API\x20key\x20cannot\x20be\x20empty','(session:\x20','\x27\x20created','Removal\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Default\x20profile\x20set\x20to:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us01','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','ERROR','Create\x20a\x20new\x20profile','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','text','email','5628516eOduNh','parent_segment','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aSaved\x20to:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','apikey','Set\x20session\x20profile','execute','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x27\x20does\x20not\x20exist.','length','\x20\x20-\x20','tdx:\x20profile\x20create','Session\x20profile\x20set\x20to:\x20','\x27\x20updated:\x20','\x0aAvailable\x20profiles:','status','description','/app/mp/ak','profileName','profile:create','160101WIRRtQ','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','10AdUjIi','apiKey','Enter\x20description\x20(optional):','13499280ikenZT','\x20--default\x27\x20to\x20save\x20permanently','\x20Profile\x20\x27','llm_project','config','11123Qctwco','name','5112xUvJQu','\x27\x20requires\x20API\x20key\x20validation.','confirm','password','tdx.json','yellow','Unknown\x20key\x20\x27','database','includes','Failed\x20to\x20remove\x20profile:\x20','Setup\x20cancelled'];a34_0x31f8=function(){return _0x12ec5a;};return a34_0x31f8();}import*as a34_0x18c07e 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';function a34_0x4008(_0x429b73,_0x383091){_0x429b73=_0x429b73-0x165;const _0x31f82d=a34_0x31f8();let _0x4008b0=_0x31f82d[_0x429b73];return _0x4008b0;}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 a34_0x5c4639 from'prompts';import a34_0x12a1f4 from'chalk';function validateProfileName(_0x5a2769){const _0xb1af7d=a34_0x4008;if(!_0x5a2769||!_0x5a2769[_0xb1af7d(0x181)]())return _0xb1af7d(0x187);const _0x1e2cfd=_0x5a2769[_0xb1af7d(0x181)]();if(!/^[a-zA-Z0-9_-]+$/[_0xb1af7d(0x186)](_0x1e2cfd))return _0xb1af7d(0x1c2);if(profileExists(_0x1e2cfd))return _0xb1af7d(0x178)+_0x1e2cfd+_0xb1af7d(0x1b3);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x55b236(0x16b)]=a34_0x55b236(0x1d3);[a34_0x55b236(0x1d0)]=a34_0x55b236(0x1b9);async[a34_0x55b236(0x1c5)](_0x149f29){const _0x151160=a34_0x55b236,{options:_0x370067,args:_0x58404d}=_0x149f29;console[_0x151160(0x1c6)](a34_0x12a1f4[_0x151160(0x19a)](_0x151160(0x1cb)));let _0x16f896;if(_0x58404d[_0x151160(0x1c9)]>0x0&&_0x58404d[0x0]){const _0x3db22d=_0x58404d[0x0][_0x151160(0x181)](),_0x13ca54=validateProfileName(_0x3db22d);if(_0x13ca54!==!![])return console['error'](a34_0x12a1f4[_0x151160(0x1a4)](_0x13ca54)),0x1;_0x16f896=_0x3db22d;}else{const _0x4ddb7=await a34_0x5c4639({'type':'text','name':_0x151160(0x1d2),'message':_0x151160(0x1a1),'validate':validateProfileName});if(!_0x4ddb7[_0x151160(0x1d2)])return console[_0x151160(0x1c6)]('\x0aSetup\x20cancelled'),0x1;_0x16f896=_0x4ddb7[_0x151160(0x1d2)][_0x151160(0x181)]();}const _0x4b775a=await a34_0x5c4639({'type':_0x151160(0x1bc),'name':'description','message':_0x151160(0x1d8)}),_0xa924a2=_0x4b775a[_0x151160(0x1d0)]?.[_0x151160(0x181)]()||undefined,_0x4e28c1=_0x370067['site']||_0x151160(0x1b6),_0x4f08f4=await promptSiteSelection(_0x4e28c1,_0x16f896,_0x151160(0x176));if(!_0x4f08f4)return 0x1;const _0x50c29a=resolveSite(_0x4f08f4);if(isOAuthSupported(_0x50c29a)){const _0x5272cb=await a34_0x5c4639({'type':_0x151160(0x1ac),'name':_0x151160(0x183),'message':'Choose\x20authentication\x20method:','choices':[{'title':_0x151160(0x18f),'value':'oauth'},{'title':_0x151160(0x1a8),'value':_0x151160(0x1c3)}]});if(!_0x5272cb[_0x151160(0x183)])return console[_0x151160(0x1c6)]('\x0aSetup\x20cancelled'),0x1;if(_0x5272cb[_0x151160(0x183)]===_0x151160(0x17f)){if(_0xa924a2){const _0x536714={'site':_0x50c29a,'description':_0xa924a2};saveProfileToUserConfig(_0x16f896,_0x536714);}return await runOAuthLoginFlow(_0x50c29a,_0x16f896,_0x370067[_0x151160(0x177)]??LogLevel[_0x151160(0x1b8)]),0x0;}}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x50c29a),console[_0x151160(0x1c6)](_0x151160(0x1a9)),console[_0x151160(0x1c6)]('\x20\x20'+getConsoleUrl(_0x50c29a,_0x151160(0x1d1)));const _0x5edcce=await a34_0x5c4639({'type':_0x151160(0x16f),'name':_0x151160(0x1d7),'message':_0x151160(0x185),'validate':_0x312388=>{const _0x4ac7bc=_0x151160;if(!_0x312388||!_0x312388[_0x4ac7bc(0x181)]())return _0x4ac7bc(0x1af);return!![];}});if(!_0x5edcce[_0x151160(0x1d7)])return console[_0x151160(0x1c6)](_0x151160(0x1a7)),0x1;const _0x2f31db=_0x5edcce[_0x151160(0x1d7)];console[_0x151160(0x1c6)](_0x151160(0x1a6));try{const _0x287b8c=TDX['create']({'site':_0x50c29a,'apiKey':_0x2f31db['trim'](),'logLevel':_0x370067['logLevel']??LogLevel['ERROR']}),_0x57a788=await _0x287b8c[_0x151160(0x19e)][_0x151160(0x17d)]();console['log'](a34_0x12a1f4[_0x151160(0x1bb)]('✓')+_0x151160(0x18c)+_0x57a788[_0x151160(0x1bd)]+')');const _0x53ed72=await isKeychainAvailable();_0x53ed72?(await saveAPIKeyAsync(_0x2f31db[_0x151160(0x181)](),_0x50c29a,_0x16f896),console[_0x151160(0x1c6)](a34_0x12a1f4['green']('✓')+_0x151160(0x1ba)+_0x16f896+')')):(console[_0x151160(0x193)](a34_0x12a1f4['yellow'](_0x151160(0x1c0))),console['warn'](a34_0x12a1f4[_0x151160(0x171)](_0x151160(0x1b7))));const _0xa51f92={'site':_0x50c29a,..._0xa924a2&&{'description':_0xa924a2}};return saveProfileToUserConfig(_0x16f896,_0xa51f92),console[_0x151160(0x1c6)](a34_0x12a1f4[_0x151160(0x1bb)]('✓')+_0x151160(0x167)+_0x16f896+_0x151160(0x1b1)),console[_0x151160(0x1c6)](),console[_0x151160(0x1c6)](_0x151160(0x17b)),console[_0x151160(0x1c6)](_0x151160(0x18b)+_0x16f896+_0x151160(0x1c7)),console[_0x151160(0x1c6)](_0x151160(0x18b)+_0x16f896+_0x151160(0x1a2)),0x0;}catch(_0x3fb6a7){if(_0x3fb6a7 instanceof HTTPClientError&&_0x3fb6a7[_0x151160(0x1cf)]===0x191)return printAuthError(_0x3fb6a7),0x1;return console[_0x151160(0x17c)](a34_0x12a1f4['red'](_0x151160(0x18a)+(_0x3fb6a7 instanceof Error?_0x3fb6a7[_0x151160(0x190)]:String(_0x3fb6a7)))),console[_0x151160(0x17c)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a34_0x55b236(0x18e);[a34_0x55b236(0x1d0)]='Remove\x20a\x20profile';[a34_0x55b236(0x196)](_0x3d2cfe){const _0x15251e=a34_0x55b236,{args:_0x333507}=_0x3d2cfe;if(_0x333507[_0x15251e(0x1c9)]===0x0)return _0x15251e(0x191);return undefined;}async[a34_0x55b236(0x1c5)](_0x23ed09){const _0x56738f=a34_0x55b236,{args:_0x2f71b2}=_0x23ed09,_0x213ab8=_0x2f71b2[0x0];console[_0x56738f(0x1c6)](a34_0x12a1f4['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x213ab8)){console[_0x56738f(0x17c)](a34_0x12a1f4[_0x56738f(0x1a4)](_0x56738f(0x178)+_0x213ab8+'\x27\x20does\x20not\x20exist.')),console[_0x56738f(0x1c6)](_0x56738f(0x1ce));const _0xd2c2e5=listProfiles();if(_0xd2c2e5[_0x56738f(0x1c9)]===0x0)console[_0x56738f(0x1c6)](_0x56738f(0x192));else for(const _0x576299 of _0xd2c2e5){console[_0x56738f(0x1c6)](_0x56738f(0x1ca)+_0x576299[_0x56738f(0x16b)]);}return 0x1;}const _0x4e4400=await a34_0x5c4639({'type':_0x56738f(0x16e),'name':_0x56738f(0x16e),'message':_0x56738f(0x17a)+_0x213ab8+'\x27?','initial':![]});if(!_0x4e4400[_0x56738f(0x16e)])return console[_0x56738f(0x1c6)](_0x56738f(0x1b2)),0x0;try{removeProfileFromUserConfig(_0x213ab8),console[_0x56738f(0x1c6)](a34_0x12a1f4['green']('✓')+'\x20Profile\x20\x27'+_0x213ab8+_0x56738f(0x180));}catch(_0x21ba91){return console[_0x56738f(0x17c)](a34_0x12a1f4[_0x56738f(0x1a4)](_0x56738f(0x175)+(_0x21ba91 instanceof Error?_0x21ba91[_0x56738f(0x190)]:String(_0x21ba91)))),0x1;}const _0x4a43d7=await isKeychainAvailable();if(_0x4a43d7){const _0x2169fe=await deleteKeychainAPIKey(_0x213ab8);_0x2169fe&&console[_0x56738f(0x1c6)](a34_0x12a1f4[_0x56738f(0x1bb)]('✓')+_0x56738f(0x19d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x55b236(0x16b)]='profile:set';['description']=a34_0x55b236(0x189);static ['VALID_KEYS']=[a34_0x55b236(0x1aa),a34_0x55b236(0x173),a34_0x55b236(0x1bf),a34_0x55b236(0x168),a34_0x55b236(0x17e),a34_0x55b236(0x1d0)];[a34_0x55b236(0x196)](_0x277166){const _0x324abf=a34_0x55b236,{args:_0x533f00,options:_0x2b4374}=_0x277166,_0x6f66fd=_0x2b4374[_0x324abf(0x1a3)]||getActiveProfile();if(!_0x6f66fd)return _0x324abf(0x18d);if(_0x533f00[_0x324abf(0x1c9)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x324abf(0x199)][_0x324abf(0x1ad)](',\x20');const _0x3281ae=_0x533f00[0x0];if(!_0x3281ae[_0x324abf(0x174)]('='))return _0x324abf(0x1b5)+ProfileSetCommand[_0x324abf(0x199)][_0x324abf(0x1ad)](',\x20');const [_0x481b1c]=_0x3281ae['split']('=',0x2);if(!ProfileSetCommand[_0x324abf(0x199)][_0x324abf(0x174)](_0x481b1c))return _0x324abf(0x172)+_0x481b1c+_0x324abf(0x1ab)+ProfileSetCommand[_0x324abf(0x199)]['join'](',\x20');return undefined;}async['execute'](_0x1312c6){const _0x1651c2=a34_0x55b236,{args:_0x23e50c,options:_0xde7211}=_0x1312c6,_0x41fbe7=_0xde7211[_0x1651c2(0x1a3)]||getActiveProfile(),[_0x48dcc6,..._0x5ed69f]=_0x23e50c[0x0][_0x1651c2(0x19c)]('='),_0x289660=_0x5ed69f[_0x1651c2(0x1ad)]('=');console[_0x1651c2(0x1c6)](a34_0x12a1f4['bold'](_0x1651c2(0x1a0)));if(!profileExists(_0x41fbe7)){const _0x5274e8=await a34_0x5c4639({'type':_0x1651c2(0x16e),'name':_0x1651c2(0x179),'message':_0x1651c2(0x178)+_0x41fbe7+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x5274e8[_0x1651c2(0x179)])return console[_0x1651c2(0x1c6)]('Operation\x20cancelled'),0x1;}const _0x59144b=loadProfile(_0x41fbe7),_0x4bbcd2=_0x59144b?.[_0x1651c2(0x169)]||{};if(_0x48dcc6===_0x1651c2(0x1aa)){const _0x1f6cc0=resolveSite(_0x289660);console[_0x1651c2(0x1c6)]('Changing\x20site\x20to\x20\x27'+_0x1f6cc0+_0x1651c2(0x16d)),console[_0x1651c2(0x1c6)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1651c2(0x1c6)]('\x20\x20'+getConsoleUrl(_0x1f6cc0,_0x1651c2(0x1d1)));const _0x3ec388=await a34_0x5c4639({'type':'password','name':_0x1651c2(0x1d7),'message':_0x1651c2(0x1a5),'validate':_0x20485f=>{const _0x55330c=_0x1651c2;if(!_0x20485f||!_0x20485f[_0x55330c(0x181)]())return _0x55330c(0x1af);return!![];}});if(!_0x3ec388[_0x1651c2(0x1d7)])return console[_0x1651c2(0x1c6)](_0x1651c2(0x19b)),0x1;console[_0x1651c2(0x1c6)](_0x1651c2(0x1a6));try{const _0x114e4=TDX[_0x1651c2(0x179)]({'site':_0x1f6cc0,'apiKey':_0x3ec388[_0x1651c2(0x1d7)]['trim'](),'logLevel':_0xde7211[_0x1651c2(0x177)]??LogLevel[_0x1651c2(0x1b8)]}),_0xa2549d=await _0x114e4[_0x1651c2(0x19e)]['getUserInfo']();console[_0x1651c2(0x1c6)](a34_0x12a1f4['green']('✓')+_0x1651c2(0x18c)+_0xa2549d[_0x1651c2(0x1bd)]+')');const _0x345312=await isKeychainAvailable();_0x345312?(await saveAPIKeyAsync(_0x3ec388[_0x1651c2(0x1d7)][_0x1651c2(0x181)](),_0x1f6cc0,_0x41fbe7),console['log'](a34_0x12a1f4[_0x1651c2(0x1bb)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x1651c2(0x193)](a34_0x12a1f4[_0x1651c2(0x171)](_0x1651c2(0x1c0))),_0x4bbcd2['site']=_0x1f6cc0;}catch(_0x1d8229){if(_0x1d8229 instanceof HTTPClientError&&_0x1d8229[_0x1651c2(0x1cf)]===0x191)return printAuthError(_0x1d8229),0x1;return console['error'](a34_0x12a1f4[_0x1651c2(0x1a4)]('✗\x20Validation\x20failed:\x20'+(_0x1d8229 instanceof Error?_0x1d8229['message']:String(_0x1d8229)))),console[_0x1651c2(0x17c)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4bbcd2[_0x48dcc6]=_0x289660||undefined;return saveProfileToUserConfig(_0x41fbe7,_0x4bbcd2),console['log'](a34_0x12a1f4[_0x1651c2(0x1bb)]('✓')+_0x1651c2(0x167)+_0x41fbe7+_0x1651c2(0x1cd)+_0x48dcc6+'='+(_0x289660||_0x1651c2(0x195))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x55b236(0x16b)]=a34_0x55b236(0x194);[a34_0x55b236(0x1d0)]=a34_0x55b236(0x1c4);['validate'](_0x80ce0c){const _0x4c874c=a34_0x55b236,{args:_0x316f1c}=_0x80ce0c;if(_0x316f1c[_0x4c874c(0x1c9)]===0x0)return _0x4c874c(0x184);return undefined;}async['execute'](_0x453bcf){const _0x3c3fd5=a34_0x55b236,{args:_0x159142,options:_0x5c5814}=_0x453bcf,_0x3bcfe3=_0x159142[0x0],_0x533151=_0x5c5814['default'];cleanExpiredSessions();if(!profileExists(_0x3bcfe3)){console[_0x3c3fd5(0x17c)](a34_0x12a1f4[_0x3c3fd5(0x1a4)](_0x3c3fd5(0x178)+_0x3bcfe3+_0x3c3fd5(0x1c8))),console[_0x3c3fd5(0x1c6)](_0x3c3fd5(0x1ce));const _0x4a183b=listProfiles();if(_0x4a183b[_0x3c3fd5(0x1c9)]===0x0)console[_0x3c3fd5(0x1c6)](_0x3c3fd5(0x192));else for(const _0x3707bf of _0x4a183b){console[_0x3c3fd5(0x1c6)](_0x3c3fd5(0x1ca)+_0x3707bf[_0x3c3fd5(0x16b)]);}return 0x1;}if(_0x533151){const _0x597d5b=a34_0x18c07e[_0x3c3fd5(0x1ad)](getConfigDir(),_0x3c3fd5(0x170));return saveActiveProfileToUserConfig(_0x3bcfe3),console[_0x3c3fd5(0x1c6)](_0x3c3fd5(0x1b4)+a34_0x12a1f4['green'](_0x3bcfe3)),console[_0x3c3fd5(0x1c6)](a34_0x12a1f4[_0x3c3fd5(0x198)](_0x3c3fd5(0x1c1)+_0x597d5b)),0x0;}const _0x4dd7d8=getSessionID(_0x5c5814[_0x3c3fd5(0x197)]);return saveSessionContext({'profile':_0x3bcfe3},_0x5c5814[_0x3c3fd5(0x197)]),console[_0x3c3fd5(0x1c6)](_0x3c3fd5(0x1cc)+a34_0x12a1f4['green'](_0x3bcfe3)+'\x20'+a34_0x12a1f4['dim'](_0x3c3fd5(0x1b0)+_0x4dd7d8+')')),console[_0x3c3fd5(0x1c6)](a34_0x12a1f4['dim'](_0x3c3fd5(0x1d5)+_0x3bcfe3+_0x3c3fd5(0x166))),0x0;}}
|
|
1
|
+
const a34_0x38dded=a34_0x343b;(function(_0x2a9d6f,_0x592699){const _0x51ce92=a34_0x343b,_0x3675e1=_0x2a9d6f();while(!![]){try{const _0x387472=-parseInt(_0x51ce92(0x134))/0x1*(-parseInt(_0x51ce92(0x11c))/0x2)+-parseInt(_0x51ce92(0x14c))/0x3+parseInt(_0x51ce92(0x109))/0x4*(-parseInt(_0x51ce92(0x11d))/0x5)+-parseInt(_0x51ce92(0x15e))/0x6+parseInt(_0x51ce92(0x162))/0x7+parseInt(_0x51ce92(0x118))/0x8+parseInt(_0x51ce92(0x14b))/0x9;if(_0x387472===_0x592699)break;else _0x3675e1['push'](_0x3675e1['shift']());}catch(_0x426586){_0x3675e1['push'](_0x3675e1['shift']());}}}(a34_0x285d,0x4c4c2));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a34_0x343b(_0x11f417,_0x188c99){_0x11f417=_0x11f417-0xfa;const _0x285d46=a34_0x285d();let _0x343b3b=_0x285d46[_0x11f417];return _0x343b3b;}import{getConfigDir}from'../core/config.js';import*as a34_0x43e14c 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 a34_0x285d(){const _0xd568d1=['\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSaved\x20to:\x20','default','llm_agent','tdx:\x20profile\x20create','221931NmRMsN','641169VibGcf','\x20Profile\x20\x27','VALID_KEYS','bold','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20set','Default\x20profile\x20set\x20to:\x20','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>','us01','join','description','✗\x20Validation\x20failed:\x20','create','confirm','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','2971254bPXRTp','length','text','status','2670521TAbaHP','(cleared)','execute','yellow','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','API\x20key\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','name','dim','Failed\x20to\x20remove\x20profile:\x20','log','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profile:use','Site\x20was\x20not\x20changed.','Operation\x20cancelled','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','getUserInfo','\x0aAvailable\x20profiles:','\x27\x20created','610560lgWNLg','green','warn','includes','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','session','tdx:\x20profile\x20remove','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profileName','Enter\x20profile\x20name:','\x20--default\x27\x20to\x20save\x20permanently','message','jobs','Validating\x20API\x20key...','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','4444032YZkjNx','Profile\x20\x27','Choose\x20authentication\x20method:','\x27\x20requires\x20API\x20key\x20validation.','36506LwUAxa','10VooYTb','tdx.json','trim','Create\x20a\x20new\x20profile','ERROR','apikey','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Remove\x20a\x20profile','logLevel','Unknown\x20key\x20\x27','llm_project','profile:remove','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20-\x20','parent_segment','\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','error','Setup\x20cancelled','profile','oauth','Profile\x20name\x20cannot\x20be\x20empty','password','20XmrxBz','validate','site','Changing\x20site\x20to\x20\x27','\x20\x20tdx\x20--profile\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','API\x20Key','profile:set','method','red','\x27\x20does\x20not\x20exist.','OAuth\x20(browser\x20login)','test','(session:\x20'];a34_0x285d=function(){return _0xd568d1;};return a34_0x285d();}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 a34_0x402816 from'prompts';import a34_0x596778 from'chalk';function validateProfileName(_0x301cf1){const _0x40442c=a34_0x343b;if(!_0x301cf1||!_0x301cf1[_0x40442c(0x11f)]())return _0x40442c(0x132);const _0x130927=_0x301cf1[_0x40442c(0x11f)]();if(!/^[a-zA-Z0-9_-]+$/[_0x40442c(0x141)](_0x130927))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x130927))return'Profile\x20\x27'+_0x130927+_0x40442c(0x123);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a34_0x38dded(0x120);async['execute'](_0x5dfad1){const _0x1db27c=a34_0x38dded,{options:_0x85ea04,args:_0x560cbb}=_0x5dfad1;console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x14f)](_0x1db27c(0x14a)));let _0x14f08e;if(_0x560cbb[_0x1db27c(0x15f)]>0x0&&_0x560cbb[0x0]){const _0x3fa066=_0x560cbb[0x0][_0x1db27c(0x11f)](),_0x26eaf8=validateProfileName(_0x3fa066);if(_0x26eaf8!==!![])return console[_0x1db27c(0x12e)](a34_0x596778[_0x1db27c(0x13e)](_0x26eaf8)),0x1;_0x14f08e=_0x3fa066;}else{const _0x50435a=await a34_0x402816({'type':_0x1db27c(0x160),'name':_0x1db27c(0x111),'message':_0x1db27c(0x112),'validate':validateProfileName});if(!_0x50435a[_0x1db27c(0x111)])return console[_0x1db27c(0xff)]('\x0aSetup\x20cancelled'),0x1;_0x14f08e=_0x50435a[_0x1db27c(0x111)][_0x1db27c(0x11f)]();}const _0x6336d0=await a34_0x402816({'type':_0x1db27c(0x160),'name':_0x1db27c(0x157),'message':'Enter\x20description\x20(optional):'}),_0x31a8b2=_0x6336d0['description']?.[_0x1db27c(0x11f)]()||undefined,_0x22c973=_0x85ea04[_0x1db27c(0x136)]||_0x1db27c(0x155),_0x95ad0d=await promptSiteSelection(_0x22c973,_0x14f08e,_0x1db27c(0x12f));if(!_0x95ad0d)return 0x1;const _0x2811c0=resolveSite(_0x95ad0d);if(isOAuthSupported(_0x2811c0)){const _0x336e6b=await a34_0x402816({'type':'select','name':_0x1db27c(0x13d),'message':_0x1db27c(0x11a),'choices':[{'title':_0x1db27c(0x140),'value':'oauth'},{'title':_0x1db27c(0x13b),'value':_0x1db27c(0x122)}]});if(!_0x336e6b[_0x1db27c(0x13d)])return console[_0x1db27c(0xff)](_0x1db27c(0x12c)),0x1;if(_0x336e6b['method']===_0x1db27c(0x131)){if(_0x31a8b2){const _0x58b3d1={'site':_0x2811c0,'description':_0x31a8b2};saveProfileToUserConfig(_0x14f08e,_0x58b3d1);}return await runOAuthLoginFlow(_0x2811c0,_0x14f08e,_0x85ea04[_0x1db27c(0x125)]??LogLevel[_0x1db27c(0x121)]),0x0;}}console['log'](_0x1db27c(0x15d)+_0x2811c0),console[_0x1db27c(0xff)](_0x1db27c(0x139)),console['log']('\x20\x20'+getConsoleUrl(_0x2811c0,'/app/mp/ak'));const _0x4671ee=await a34_0x402816({'type':_0x1db27c(0x133),'name':_0x1db27c(0x153),'message':_0x1db27c(0x145),'validate':_0x3143ed=>{const _0x52aeed=_0x1db27c;if(!_0x3143ed||!_0x3143ed['trim']())return _0x52aeed(0xfa);return!![];}});if(!_0x4671ee[_0x1db27c(0x153)])return console[_0x1db27c(0xff)]('\x0aSetup\x20cancelled'),0x1;const _0x5130f1=_0x4671ee[_0x1db27c(0x153)];console[_0x1db27c(0xff)]('Validating\x20API\x20key...');try{const _0x3b90ba=TDX[_0x1db27c(0x159)]({'site':_0x2811c0,'apiKey':_0x5130f1[_0x1db27c(0x11f)](),'logLevel':_0x85ea04[_0x1db27c(0x125)]??LogLevel[_0x1db27c(0x121)]}),_0x2944fb=await _0x3b90ba[_0x1db27c(0x115)]['getUserInfo']();console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x10a)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2944fb['email']+')');const _0x48fe46=await isKeychainAvailable();_0x48fe46?(await saveAPIKeyAsync(_0x5130f1['trim'](),_0x2811c0,_0x14f08e),console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x10a)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x14f08e+')')):(console[_0x1db27c(0x10b)](a34_0x596778[_0x1db27c(0x165)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x1db27c(0x10b)](a34_0x596778['yellow'](_0x1db27c(0x117))));const _0x3e0a2f={'site':_0x2811c0,..._0x31a8b2&&{'description':_0x31a8b2}};return saveProfileToUserConfig(_0x14f08e,_0x3e0a2f),console[_0x1db27c(0xff)](a34_0x596778['green']('✓')+_0x1db27c(0x14d)+_0x14f08e+_0x1db27c(0x108)),console[_0x1db27c(0xff)](),console[_0x1db27c(0xff)](_0x1db27c(0x150)),console['log'](_0x1db27c(0x138)+_0x14f08e+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x1db27c(0x138)+_0x14f08e+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x25e1c3){if(_0x25e1c3 instanceof HTTPClientError&&_0x25e1c3[_0x1db27c(0x161)]===0x191)return printAuthError(_0x25e1c3),0x1;return console[_0x1db27c(0x12e)](a34_0x596778[_0x1db27c(0x13e)](_0x1db27c(0x158)+(_0x25e1c3 instanceof Error?_0x25e1c3[_0x1db27c(0x114)]:String(_0x25e1c3)))),console[_0x1db27c(0x12e)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a34_0x38dded(0x128);[a34_0x38dded(0x157)]=a34_0x38dded(0x124);[a34_0x38dded(0x135)](_0x18ffd2){const _0x123a79=a34_0x38dded,{args:_0x457f4a}=_0x18ffd2;if(_0x457f4a[_0x123a79(0x15f)]===0x0)return _0x123a79(0x13a);return undefined;}async[a34_0x38dded(0x164)](_0xaaee14){const _0x9589bf=a34_0x38dded,{args:_0x368118}=_0xaaee14,_0x162d43=_0x368118[0x0];console['log'](a34_0x596778[_0x9589bf(0x14f)](_0x9589bf(0x10f)));if(!profileExists(_0x162d43)){console['error'](a34_0x596778[_0x9589bf(0x13e)]('Profile\x20\x27'+_0x162d43+_0x9589bf(0x13f))),console[_0x9589bf(0xff)]('\x0aAvailable\x20profiles:');const _0x51a149=listProfiles();if(_0x51a149['length']===0x0)console['log'](_0x9589bf(0x143));else for(const _0x3289e9 of _0x51a149){console[_0x9589bf(0xff)](_0x9589bf(0x12a)+_0x3289e9[_0x9589bf(0xfc)]);}return 0x1;}const _0x550b34=await a34_0x402816({'type':_0x9589bf(0x15a),'name':'confirm','message':_0x9589bf(0x110)+_0x162d43+'\x27?','initial':![]});if(!_0x550b34['confirm'])return console[_0x9589bf(0xff)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x162d43),console['log'](a34_0x596778[_0x9589bf(0x10a)]('✓')+_0x9589bf(0x14d)+_0x162d43+'\x27\x20removed\x20from\x20configuration');}catch(_0x4e1382){return console[_0x9589bf(0x12e)](a34_0x596778[_0x9589bf(0x13e)](_0x9589bf(0xfe)+(_0x4e1382 instanceof Error?_0x4e1382[_0x9589bf(0x114)]:String(_0x4e1382)))),0x1;}const _0x311c5f=await isKeychainAvailable();if(_0x311c5f){const _0x2f0b41=await deleteKeychainAPIKey(_0x162d43);_0x2f0b41&&console[_0x9589bf(0xff)](a34_0x596778[_0x9589bf(0x10a)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x38dded(0xfc)]=a34_0x38dded(0x13c);['description']='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=['site',a34_0x38dded(0x105),a34_0x38dded(0x12b),a34_0x38dded(0x127),a34_0x38dded(0x149),a34_0x38dded(0x157)];[a34_0x38dded(0x135)](_0xf9a61b){const _0x4437ef=a34_0x38dded,{args:_0x190ad1,options:_0x343725}=_0xf9a61b,_0x170008=_0x343725[_0x4437ef(0x130)]||getActiveProfile();if(!_0x170008)return _0x4437ef(0x154);if(_0x190ad1['length']===0x0)return _0x4437ef(0x104)+ProfileSetCommand[_0x4437ef(0x14e)][_0x4437ef(0x156)](',\x20');const _0x383e21=_0x190ad1[0x0];if(!_0x383e21['includes']('='))return _0x4437ef(0xfb)+ProfileSetCommand['VALID_KEYS'][_0x4437ef(0x156)](',\x20');const [_0x1bbe94]=_0x383e21['split']('=',0x2);if(!ProfileSetCommand[_0x4437ef(0x14e)][_0x4437ef(0x10c)](_0x1bbe94))return _0x4437ef(0x126)+_0x1bbe94+_0x4437ef(0x144)+ProfileSetCommand[_0x4437ef(0x14e)]['join'](',\x20');return undefined;}async['execute'](_0x374896){const _0x5983ac=a34_0x38dded,{args:_0x13508a,options:_0xe27ca}=_0x374896,_0x2b6c79=_0xe27ca['profile']||getActiveProfile(),[_0x55761f,..._0x23452c]=_0x13508a[0x0][_0x5983ac(0x167)]('='),_0xcf76a5=_0x23452c[_0x5983ac(0x156)]('=');console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x14f)](_0x5983ac(0x151)));if(!profileExists(_0x2b6c79)){const _0x133d9a=await a34_0x402816({'type':'confirm','name':_0x5983ac(0x159),'message':'Profile\x20\x27'+_0x2b6c79+_0x5983ac(0x166),'initial':!![]});if(!_0x133d9a['create'])return console['log'](_0x5983ac(0x103)),0x1;}const _0x36eed4=loadProfile(_0x2b6c79),_0x2fc007=_0x36eed4?.['config']||{};if(_0x55761f===_0x5983ac(0x136)){const _0xb5b0cd=resolveSite(_0xcf76a5);console[_0x5983ac(0xff)](_0x5983ac(0x137)+_0xb5b0cd+_0x5983ac(0x11b)),console['log'](_0x5983ac(0x100)),console['log']('\x20\x20'+getConsoleUrl(_0xb5b0cd,_0x5983ac(0x15b)));const _0x196f3f=await a34_0x402816({'type':_0x5983ac(0x133),'name':_0x5983ac(0x153),'message':_0x5983ac(0x15c),'validate':_0x237049=>{const _0x3ae6f6=_0x5983ac;if(!_0x237049||!_0x237049[_0x3ae6f6(0x11f)]())return _0x3ae6f6(0xfa);return!![];}});if(!_0x196f3f[_0x5983ac(0x153)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x5983ac(0xff)](_0x5983ac(0x116));try{const _0x4ed23a=TDX[_0x5983ac(0x159)]({'site':_0xb5b0cd,'apiKey':_0x196f3f[_0x5983ac(0x153)][_0x5983ac(0x11f)](),'logLevel':_0xe27ca[_0x5983ac(0x125)]??LogLevel[_0x5983ac(0x121)]}),_0x31972f=await _0x4ed23a['jobs'][_0x5983ac(0x106)]();console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x146)+_0x31972f['email']+')');const _0x5caed6=await isKeychainAvailable();_0x5caed6?(await saveAPIKeyAsync(_0x196f3f[_0x5983ac(0x153)][_0x5983ac(0x11f)](),_0xb5b0cd,_0x2b6c79),console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x12d))):console[_0x5983ac(0x10b)](a34_0x596778['yellow'](_0x5983ac(0x129))),_0x2fc007[_0x5983ac(0x136)]=_0xb5b0cd;}catch(_0x1b1c46){if(_0x1b1c46 instanceof HTTPClientError&&_0x1b1c46['status']===0x191)return printAuthError(_0x1b1c46),0x1;return console[_0x5983ac(0x12e)](a34_0x596778[_0x5983ac(0x13e)](_0x5983ac(0x158)+(_0x1b1c46 instanceof Error?_0x1b1c46[_0x5983ac(0x114)]:String(_0x1b1c46)))),console[_0x5983ac(0x12e)](_0x5983ac(0x102)),0x1;}}else _0x2fc007[_0x55761f]=_0xcf76a5||undefined;return saveProfileToUserConfig(_0x2b6c79,_0x2fc007),console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x14d)+_0x2b6c79+'\x27\x20updated:\x20'+_0x55761f+'='+(_0xcf76a5||_0x5983ac(0x163))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x38dded(0xfc)]=a34_0x38dded(0x101);[a34_0x38dded(0x157)]='Set\x20session\x20profile';[a34_0x38dded(0x135)](_0x6a766f){const _0x40c9cc=a34_0x38dded,{args:_0x102a72}=_0x6a766f;if(_0x102a72[_0x40c9cc(0x15f)]===0x0)return _0x40c9cc(0x10d);return undefined;}async[a34_0x38dded(0x164)](_0x4dc541){const _0x2cba78=a34_0x38dded,{args:_0x1f0b57,options:_0x3d11bd}=_0x4dc541,_0x2b77e1=_0x1f0b57[0x0],_0x247502=_0x3d11bd[_0x2cba78(0x148)];cleanExpiredSessions();if(!profileExists(_0x2b77e1)){console[_0x2cba78(0x12e)](a34_0x596778['red'](_0x2cba78(0x119)+_0x2b77e1+_0x2cba78(0x13f))),console[_0x2cba78(0xff)](_0x2cba78(0x107));const _0x4b5547=listProfiles();if(_0x4b5547[_0x2cba78(0x15f)]===0x0)console['log'](_0x2cba78(0x143));else for(const _0x55289e of _0x4b5547){console[_0x2cba78(0xff)](_0x2cba78(0x12a)+_0x55289e[_0x2cba78(0xfc)]);}return 0x1;}if(_0x247502){const _0x305373=a34_0x43e14c[_0x2cba78(0x156)](getConfigDir(),_0x2cba78(0x11e));return saveActiveProfileToUserConfig(_0x2b77e1),console['log'](_0x2cba78(0x152)+a34_0x596778[_0x2cba78(0x10a)](_0x2b77e1)),console[_0x2cba78(0xff)](a34_0x596778[_0x2cba78(0xfd)](_0x2cba78(0x147)+_0x305373)),0x0;}const _0x325cf5=getSessionID(_0x3d11bd[_0x2cba78(0x10e)]);return saveSessionContext({'profile':_0x2b77e1},_0x3d11bd[_0x2cba78(0x10e)]),console[_0x2cba78(0xff)]('Session\x20profile\x20set\x20to:\x20'+a34_0x596778[_0x2cba78(0x10a)](_0x2b77e1)+'\x20'+a34_0x596778[_0x2cba78(0xfd)](_0x2cba78(0x142)+_0x325cf5+')')),console['log'](a34_0x596778[_0x2cba78(0xfd)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2b77e1+_0x2cba78(0x113))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0xac0fa3=a35_0x48fb;(function(_0x9554b2,_0x5d1357){const _0x1d42f8=a35_0x48fb,_0x5ec6aa=_0x9554b2();while(!![]){try{const _0x2ea468=-parseInt(_0x1d42f8(0x88))/0x1*(parseInt(_0x1d42f8(0x7f))/0x2)+parseInt(_0x1d42f8(0x87))/0x3*(-parseInt(_0x1d42f8(0x8e))/0x4)+-parseInt(_0x1d42f8(0x89))/0x5*(-parseInt(_0x1d42f8(0x7d))/0x6)+parseInt(_0x1d42f8(0x83))/0x7*(-parseInt(_0x1d42f8(0x80))/0x8)+parseInt(_0x1d42f8(0x7e))/0x9*(parseInt(_0x1d42f8(0x78))/0xa)+-parseInt(_0x1d42f8(0x92))/0xb+-parseInt(_0x1d42f8(0x93))/0xc*(-parseInt(_0x1d42f8(0x7a))/0xd);if(_0x2ea468===_0x5d1357)break;else _0x5ec6aa['push'](_0x5ec6aa['shift']());}catch(_0x1a8b30){_0x5ec6aa['push'](_0x5ec6aa['shift']());}}}(a35_0x592e,0x6a10c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0x592e(){const _0x4ad304=['5bODMLD','Error:\x20','List\x20all\x20available\x20profiles','green','config','2468ICnSSP','dim','length','message','6545671BtRbAq','26579484aONavI','name','scope','1774390xcoODs','log','13WBCNJU','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','242022cstcKd','27jPezcM','51268LOwGOG','8wkgIsh','map','execute','2871617zBLVsK','👤\x20','description','site','3687UOhgJe','23cHfrdv'];a35_0x592e=function(){return _0x4ad304;};return a35_0x592e();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a35_0x48fb(_0x1991d9,_0x5ee297){_0x1991d9=_0x1991d9-0x77;const _0x592ecd=a35_0x592e();let _0x48fbdb=_0x592ecd[_0x1991d9];return _0x48fbdb;}import a35_0x3ba724 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a35_0xac0fa3(0x7b);['description']=a35_0xac0fa3(0x8b);async[a35_0xac0fa3(0x82)](_0x388380){const _0x404f3b=a35_0xac0fa3,{options:_0x529e8b}=_0x388380;try{const _0x52a031=listProfiles(),_0x23a7b4=getActiveProfile();if(_0x52a031[_0x404f3b(0x90)]===0x0)return console[_0x404f3b(0x79)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x404f3b(0x79)](_0x404f3b(0x7c)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x4f9d53=_0x52a031[_0x404f3b(0x81)](_0x195c45=>{const _0x3a341d=_0x404f3b,_0x259cbf=_0x195c45[_0x3a341d(0x94)]===_0x23a7b4,_0x43a87d=getProfileParams(_0x195c45['config']);return{'name':_0x195c45[_0x3a341d(0x94)],'active':_0x259cbf,'scope':_0x195c45[_0x3a341d(0x77)],'description':_0x195c45[_0x3a341d(0x8d)][_0x3a341d(0x85)]||'','params':_0x43a87d};});if(isStructuredFormat(_0x529e8b))await handleSDKOutput(_0x4f9d53,_0x529e8b);else for(const _0x45b560 of _0x52a031){const _0x3c00fc=_0x45b560[_0x404f3b(0x94)]===_0x23a7b4?a35_0x3ba724[_0x404f3b(0x8c)]('\x20✓'):'',_0x59cbc8=_0x45b560['config'][_0x404f3b(0x86)]?a35_0x3ba724[_0x404f3b(0x8f)]('\x20'+_0x45b560[_0x404f3b(0x8d)]['site']):'',_0x150b29=_0x45b560[_0x404f3b(0x8d)][_0x404f3b(0x85)]?a35_0x3ba724[_0x404f3b(0x8f)]('\x20\x20'+_0x45b560[_0x404f3b(0x8d)][_0x404f3b(0x85)]):'';console[_0x404f3b(0x79)](_0x404f3b(0x84)+_0x45b560[_0x404f3b(0x94)]+_0x3c00fc+_0x59cbc8+_0x150b29);}return 0x0;}catch(_0xbe4e19){return _0xbe4e19 instanceof Error&&console['error'](_0x404f3b(0x8a)+_0xbe4e19[_0x404f3b(0x91)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x57b905=a36_0x4751;function a36_0x4751(_0x4ef847,_0x14fa02){_0x4ef847=_0x4ef847-0x193;const _0xa819b9=a36_0xa819();let _0x4751f4=_0xa819b9[_0x4ef847];return _0x4751f4;}function a36_0xa819(){const _0x5a26a0=['file','setExtra','name','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','9rkNxmi','database','1042580rXxXKV','error','Error:\x20','Site:\x20','\x20rows\x20','query','setPhase','setJobId','elapsedTimeMillis','description','processedRows','message','join','completedSplits','SQL:\x20','output','information_schema','520XewLuJ','state','2528735ozgVLS','Schema:\x20','\x20[Job\x20ID:\x20','\x20splits','options','2622712aGtLlA','execute','stats','Executing\x20statement\x20','verbose','Run\x20Trino\x20queries\x20(streaming)','\x0aAll\x20results\x20saved\x20to\x20','1037604vGDjoZ','926502QRAILS','4CRXPhk','14srxHDk','210914xEFqwW','args','Query\x20completed:\x20Processed\x20','data','originalMessage','Statement\x20','totalSplits','push','in\x20','...','length','105218PaLLIS'];a36_0xa819=function(){return _0x5a26a0;};return a36_0xa819();}(function(_0x2240b9,_0xe5d03f){const _0x4e8cec=a36_0x4751,_0xca9921=_0x2240b9();while(!![]){try{const _0x5b6098=-parseInt(_0x4e8cec(0x19c))/0x1*(-parseInt(_0x4e8cec(0x1a9))/0x2)+parseInt(_0x4e8cec(0x19a))/0x3+parseInt(_0x4e8cec(0x1b0))/0x4+parseInt(_0x4e8cec(0x1c3))/0x5+-parseInt(_0x4e8cec(0x19b))/0x6*(-parseInt(_0x4e8cec(0x19d))/0x7)+-parseInt(_0x4e8cec(0x193))/0x8*(parseInt(_0x4e8cec(0x1ae))/0x9)+-parseInt(_0x4e8cec(0x1c1))/0xa*(parseInt(_0x4e8cec(0x19e))/0xb);if(_0x5b6098===_0xe5d03f)break;else _0xca9921['push'](_0xca9921['shift']());}catch(_0x5a56b9){_0xca9921['push'](_0xca9921['shift']());}}}(a36_0xa819,0x4add3));import{BaseCommand}from'./command.js';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{[a36_0x57b905(0x1ac)]=a36_0x57b905(0x1b5);[a36_0x57b905(0x1b9)]=a36_0x57b905(0x198);async[a36_0x57b905(0x194)](_0x3f5d20){const _0xe4e7bf=a36_0x57b905,{options:_0x3b8886,args:_0x33fd75,tdx:_0xcf8932}=_0x3f5d20,_0x23747c={..._0x3b8886,'limitStructuredFormats':!![]},_0x57c474=_0x33fd75[0x0],_0x5c4b97=_0x3b8886[_0xe4e7bf(0x1aa)];let _0x5062e4;try{if(_0x5c4b97)_0x5062e4=readSqlStatementsFromFile(_0x5c4b97);else{if(_0x57c474==='-')_0x5062e4=await readSqlStatementsFromStdin();else{if(_0x57c474&&isSqlFilePath(_0x57c474))_0x5062e4=readSqlStatementsFromFile(_0x57c474);else{if(_0x57c474)_0x5062e4=splitSqlStatements(_0x57c474);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x5bafd6){return console[_0xe4e7bf(0x1b1)](_0xe4e7bf(0x1b2)+_0x5bafd6[_0xe4e7bf(0x1bb)]),0x1;}const _0x156ac2=_0x3b8886[_0xe4e7bf(0x1af)]||_0xe4e7bf(0x1c0),_0x495193=_0x3b8886['catalog'];try{const _0x3dd8b9=[],_0x35a7ee=!!_0x3b8886[_0xe4e7bf(0x1bf)];for(let _0x33878e=0x0;_0x33878e<_0x5062e4[_0xe4e7bf(0x1a8)];_0x33878e++){const _0x143519=_0x5062e4[_0x33878e],_0x1750e2=_0x33878e+0x1,_0x345bea=_0x5062e4[_0xe4e7bf(0x1a8)],_0x5f0104=_0x345bea>0x1;_0x3b8886['verbose']&&(console[_0xe4e7bf(0x1b1)]('\x0a'+(_0x5f0104?_0xe4e7bf(0x1a3)+_0x1750e2+'/'+_0x345bea+':':'')),console[_0xe4e7bf(0x1b1)](_0xe4e7bf(0x1b3)+_0x3b8886['site']),console[_0xe4e7bf(0x1b1)]('Catalog:\x20'+(_0x495193||'td')),console[_0xe4e7bf(0x1b1)](_0xe4e7bf(0x1c4)+_0x156ac2),console['error'](_0xe4e7bf(0x1be)+_0x143519));const _0x3733ec=_0x5f0104?_0xe4e7bf(0x196)+_0x1750e2+'/'+_0x345bea+_0xe4e7bf(0x1a7):'Executing\x20query...';try{const _0x5e8821=await withProgressSpinner(_0x3733ec,async _0x2c8510=>{const _0x4e78af=_0xe4e7bf,_0x1e20cc=await _0xcf8932[_0x4e78af(0x1b5)]['execute'](_0x143519,{'catalog':_0x495193,'schema':_0x156ac2,'onJobId':_0x58879c=>{const _0x2a8bf5=_0x4e78af;_0x2c8510[_0x2a8bf5(0x1b7)](_0x58879c);},'onProgress':_0x25aa3c=>{const _0x109d8d=_0x4e78af;_0x2c8510[_0x109d8d(0x1b6)]('Executing\x20query\x20['+_0x25aa3c[_0x109d8d(0x1c2)]+']'),_0x2c8510[_0x109d8d(0x1ab)](formatRows(_0x25aa3c[_0x109d8d(0x1ba)])+'\x20rows\x20'+_0x25aa3c[_0x109d8d(0x1bd)]+'/'+_0x25aa3c[_0x109d8d(0x1a4)]+_0x109d8d(0x1c6));}});return _0x1e20cc;},{'verbose':_0x3b8886[_0xe4e7bf(0x197)]}),_0x37717e=_0x5e8821[_0xe4e7bf(0x1a1)],_0x3723d3=_0x37717e['jobId']?_0xe4e7bf(0x1c5)+_0x37717e['jobId']+']':'',_0x3fcae8=_0x5f0104?_0xe4e7bf(0x1a3)+_0x1750e2+'/'+_0x345bea+'\x20-\x20':'';console[_0xe4e7bf(0x1b1)]('✔\x20'+_0x3fcae8+_0xe4e7bf(0x1a0)+formatRows(_0x37717e[_0xe4e7bf(0x195)][_0xe4e7bf(0x1ba)])+_0xe4e7bf(0x1b4)+(_0xe4e7bf(0x1a6)+formatElapsed(_0x37717e['stats'][_0xe4e7bf(0x1b8)])+_0x3723d3));if(_0x5f0104&&_0x35a7ee){const _0x5da88f=resolveOutputOptions(_0x23747c),_0x2a0bf0=await formatQueryOutput(_0x37717e,_0x5da88f);_0x3dd8b9[_0xe4e7bf(0x1a5)](_0x2a0bf0);}else await handleQueryOutput(_0x37717e,_0x23747c);}catch(_0x3aed32){const _0x45fb1b=_0x5f0104?_0xe4e7bf(0x1a3)+_0x1750e2+'/'+_0x345bea+':\x0a':'',_0x55f68f=_0x3aed32 instanceof SDKError?_0x3aed32[_0xe4e7bf(0x1a2)]:_0x3aed32[_0xe4e7bf(0x1bb)];return console['error'](''+_0x45fb1b+_0x55f68f),0x1;}}if(_0x5062e4[_0xe4e7bf(0x1a8)]>0x1&&_0x35a7ee&&_0x3dd8b9[_0xe4e7bf(0x1a8)]>0x0){const _0x2b057f=_0x3dd8b9[_0xe4e7bf(0x1bc)]('\x0a');writeFileSync(_0x3b8886[_0xe4e7bf(0x1bf)],_0x2b057f),console[_0xe4e7bf(0x1b1)](_0xe4e7bf(0x199)+_0x3b8886['output']);}return 0x0;}catch(_0x46429b){throw _0x46429b;}}['validate'](_0x46f143){const _0x22048f=a36_0x57b905,_0x3aa581=_0x46f143[_0x22048f(0x19f)][0x0],_0x47a2ce=_0x46f143[_0x22048f(0x1c7)][_0x22048f(0x1aa)];if(!_0x3aa581&&!_0x47a2ce)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(_0x3aa581&&_0x47a2ce)return _0x22048f(0x1ad);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x57288e=a37_0x1634;(function(_0x4cd76b,_0xa2a018){const _0x5b2cfe=a37_0x1634,_0x5f0d67=_0x4cd76b();while(!![]){try{const _0x43fd4d=-parseInt(_0x5b2cfe(0x209))/0x1+-parseInt(_0x5b2cfe(0x227))/0x2*(-parseInt(_0x5b2cfe(0x1d8))/0x3)+-parseInt(_0x5b2cfe(0x1cb))/0x4+-parseInt(_0x5b2cfe(0x221))/0x5*(-parseInt(_0x5b2cfe(0x1eb))/0x6)+parseInt(_0x5b2cfe(0x1f8))/0x7*(-parseInt(_0x5b2cfe(0x256))/0x8)+-parseInt(_0x5b2cfe(0x1e2))/0x9+-parseInt(_0x5b2cfe(0x1ef))/0xa*(-parseInt(_0x5b2cfe(0x237))/0xb);if(_0x43fd4d===_0xa2a018)break;else _0x5f0d67['push'](_0x5f0d67['shift']());}catch(_0x6d4c6){_0x5f0d67['push'](_0x5f0d67['shift']());}}}(a37_0x5a60,0xa5cc1));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';function a37_0x5a60(){const _0x41a9d4=['timezone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Getting\x20schedule\x20details...','options','Run\x20a\x20scheduled\x20query\x20immediately','next_run_at','\x20execution','120iDKHIc','Schedule\x20deleted:\x20','executing_user_id','Searching\x20scheduled\x20queries\x20matching\x20\x22','19456540mIVVPy','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','abs','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20\x20→\x20','\x20job','Running\x20schedule:\x20','substring','yes','1471918KtUNDd','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','m\x20ago','json','type','queryUrl','time_zone','listQueries','\x20(use\x20--limit\x20to\x20see\x20more)','user_name','schedule:delete','Updating\x20schedule...','jsonl','success','Deleting\x20schedule...','(unnamed)','d\x20ago','1253229HzkXsC','status','just\x20now','\x20\x20Job\x20ID:\x20','query','nextRun','schedule:run','Failed\x20to\x20read\x20file:\x20','list','Running\x20schedule...','result','num','validate','Showing\x20first\x20','trim','delay','schedule:show','schedules','delete','schedule:history','statusIcon','history','data','retry_limit','294055JccFPz','table','\x20\x20Num:\x20','show','queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','32586kPsfJM','format','job_id','getTime','Creating\x20schedule...','never','Show\x20schedule\x20execution\x20history','priority','Query\x20file\x20is\x20empty','h\x20ago','\x20scheduled\x20quer','end_at','description','Getting\x20schedule\x20history...','error','verbose','11KKAlCm','entries','No\x20scheduled\x20queries\x20found','log','count','updated_at','utf-8','schedule:update','dim','Creating\x20schedule:\x20','Found\x20','cron','List\x20scheduled\x20queries','create','update','created_at','engine_version','file','cyan','repeat','padEnd','\x20\x20Cron:\x20','engineVersion','from','Schedule\x20created:\x20','INVALID_ARGUMENT','red','database','Updating\x20schedule:\x20','schedule:create','output','40CNyqiI','jobs','in\x20','/app/queries/editor?queryId=','Create\x20a\x20scheduled\x20query','last_job','Schedule\x20updated:\x20','round','424544HQHkcb','length','lastRun','\x22...','join','map','run','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','ies','limit','max','tsv','\x20\x20Time:\x20','237DnzvZf','name','toLocaleDateString','site','has_next_page','retryLimit','ended_at','scheduled_at','args','execute','11872629VmtSCP','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]'];a37_0x5a60=function(){return _0x41a9d4;};return a37_0x5a60();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x17549d from'chalk';function formatRelativeTime(_0x2dd361){const _0x23c76c=a37_0x1634,_0x44536d=new Date(_0x2dd361),_0x10f512=new Date(),_0x4e7ff7=_0x44536d[_0x23c76c(0x22a)]()-_0x10f512[_0x23c76c(0x22a)](),_0x28f30a=Math[_0x23c76c(0x1f1)](_0x4e7ff7)/0x3e8,_0x52973a=_0x4e7ff7<0x0;if(_0x28f30a<0x3c)return _0x52973a?_0x23c76c(0x20b):'soon';else{if(_0x28f30a<0xe10){const _0x12dda8=Math[_0x23c76c(0x1ca)](_0x28f30a/0x3c);return _0x52973a?_0x12dda8+_0x23c76c(0x1fa):_0x23c76c(0x258)+_0x12dda8+'m';}else{if(_0x28f30a<0x15180){const _0x438d5e=Math[_0x23c76c(0x1ca)](_0x28f30a/0xe10);return _0x52973a?_0x438d5e+_0x23c76c(0x230):_0x23c76c(0x258)+_0x438d5e+'h';}else{if(_0x28f30a<0x93a80){const _0x2c70b6=Math[_0x23c76c(0x1ca)](_0x28f30a/0x15180);return _0x52973a?_0x2c70b6+_0x23c76c(0x208):_0x23c76c(0x258)+_0x2c70b6+'d';}else return _0x44536d[_0x23c76c(0x1da)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x57288e(0x1d9)]='schedule:list';[a37_0x57288e(0x233)]=a37_0x57288e(0x243);async['execute'](_0x501e57){const _0x9cd866=a37_0x57288e,{options:_0x1e908b,args:_0x1a64ec,tdx:_0xe6b64d}=_0x501e57,_0x569583=resolveLimit(_0x1e908b[_0x9cd866(0x1d4)],DEFAULT_DISPLAY_LIMIT),_0x18d5a5=_0x1a64ec[0x0],_0x4109f7=_0x18d5a5?_0x9cd866(0x1ee)+_0x18d5a5+_0x9cd866(0x1ce):'Listing\x20scheduled\x20queries...',_0x4ad827=await withSpinner(_0x4109f7,()=>_0xe6b64d[_0x9cd866(0x21a)][_0x9cd866(0x1ff)]({'limit':_0x569583,'scheduled':!![],'pattern':_0x18d5a5}),{'verbose':_0x1e908b[_0x9cd866(0x236)]}),_0x5f0de9=_0x4ad827['data'][_0x9cd866(0x225)],_0xd2f1ed=_0x4ad827[_0x9cd866(0x21f)]['pagination'][_0x9cd866(0x1dc)],_0x26a53b=_0x18d5a5?'\x20matching\x20\x22'+_0x18d5a5+'\x22':'';_0xd2f1ed?console[_0x9cd866(0x235)](_0x9cd866(0x216)+_0x5f0de9[_0x9cd866(0x1cc)]+'\x20schedules'+_0x26a53b+_0x9cd866(0x200)):console[_0x9cd866(0x235)](_0x9cd866(0x241)+_0x5f0de9[_0x9cd866(0x1cc)]+_0x9cd866(0x231)+(_0x5f0de9[_0x9cd866(0x1cc)]!==0x1?_0x9cd866(0x1d3):'y')+_0x26a53b);if(_0x1e908b[_0x9cd866(0x228)]===_0x9cd866(0x1fb)||_0x1e908b['format']===_0x9cd866(0x204)||_0x1e908b[_0x9cd866(0x228)]===_0x9cd866(0x222)||_0x1e908b[_0x9cd866(0x228)]===_0x9cd866(0x1d6)){const _0x1aa754=_0x5f0de9[_0x9cd866(0x1d0)](_0x3b8348=>({'id':_0x3b8348['id'],'name':_0x3b8348['name'],'cron':_0x3b8348['cron'],'database':_0x3b8348[_0x9cd866(0x252)]?.[_0x9cd866(0x1d9)],'type':_0x3b8348[_0x9cd866(0x1fc)],'timezone':_0x3b8348[_0x9cd866(0x1fe)],'user_name':_0x3b8348['user']?.[_0x9cd866(0x1d9)],'updated_at':_0x3b8348[_0x9cd866(0x23c)],'next_run_at':_0x3b8348[_0x9cd866(0x1e9)],'last_job_status':_0x3b8348[_0x9cd866(0x1c8)]?.[_0x9cd866(0x20a)]}));await handleSDKOutput(_0x1aa754,_0x1e908b);}else{if(_0x5f0de9[_0x9cd866(0x1cc)]===0x0)console[_0x9cd866(0x23a)](_0x9cd866(0x239));else{const _0x47dbbf=_0x1e908b[_0x9cd866(0x1db)],_0x51113e=_0x5f0de9[_0x9cd866(0x1d0)](_0x579716=>{const _0x1fea8c=_0x9cd866,_0x416631=_0x579716['last_job']?.['status']?_0x579716[_0x1fea8c(0x1c8)]['status']===_0x1fea8c(0x205)?'✓':'✗':'-',_0x44e3b4=_0x579716[_0x1fea8c(0x1c8)]?.[_0x1fea8c(0x1de)]?formatRelativeTime(_0x579716[_0x1fea8c(0x1c8)][_0x1fea8c(0x1de)]):_0x1fea8c(0x22c),_0x2e248a=_0x579716['next_run_at']?formatRelativeTime(_0x579716['next_run_at']):'-',_0x50f07e=_0x579716[_0x1fea8c(0x242)]||'',_0x136ba4=_0x579716[_0x1fea8c(0x1d9)]||_0x1fea8c(0x207),_0x19aa10=getConsoleUrl(_0x47dbbf,_0x1fea8c(0x259)+_0x579716['id']);return{'statusIcon':_0x416631,'lastRun':_0x44e3b4,'nextRun':_0x2e248a,'cron':_0x50f07e,'name':_0x136ba4,'queryUrl':_0x19aa10,'status':_0x579716[_0x1fea8c(0x1c8)]?.['status']};}),_0x469578=Math[_0x9cd866(0x1d5)](..._0x51113e[_0x9cd866(0x1d0)](_0x4240c1=>_0x4240c1[_0x9cd866(0x1cd)][_0x9cd866(0x1cc)])),_0x14168e=Math[_0x9cd866(0x1d5)](..._0x51113e[_0x9cd866(0x1d0)](_0x54df18=>_0x54df18[_0x9cd866(0x20e)][_0x9cd866(0x1cc)])),_0x2c0920=Math['max'](..._0x51113e[_0x9cd866(0x1d0)](_0x570da7=>_0x570da7[_0x9cd866(0x242)]['length'])),_0x3d4044=_0x51113e['map'](_0x24a27f=>{const _0x3cde33=_0x9cd866,_0x3fca0c=_0x24a27f[_0x3cde33(0x20a)]==='success'?a37_0x17549d['green'](_0x24a27f[_0x3cde33(0x21d)]):_0x24a27f[_0x3cde33(0x20a)]===_0x3cde33(0x235)?a37_0x17549d[_0x3cde33(0x251)](_0x24a27f[_0x3cde33(0x21d)]):a37_0x17549d[_0x3cde33(0x23f)](_0x24a27f[_0x3cde33(0x21d)]),_0x116a16=_0x24a27f[_0x3cde33(0x1cd)]['padEnd'](_0x469578),_0x28247f=_0x24a27f[_0x3cde33(0x20e)]['padEnd'](_0x14168e),_0x45e6f1=_0x24a27f[_0x3cde33(0x242)]?a37_0x17549d[_0x3cde33(0x249)](_0x24a27f['cron'][_0x3cde33(0x24b)](_0x2c0920)):'\x20'[_0x3cde33(0x24a)](_0x2c0920),_0xbe263f=hyperlink(_0x24a27f[_0x3cde33(0x1d9)],_0x24a27f[_0x3cde33(0x1fd)]);return'📅\x20'+_0x3fca0c+'\x20'+_0x116a16+_0x3cde33(0x1f3)+_0x28247f+'\x20\x20'+_0x45e6f1+'\x20\x20'+_0xbe263f;});await writeOutput(_0x3d4044[_0x9cd866(0x1cf)]('\x0a'),_0x1e908b[_0x9cd866(0x255)],_0x9cd866(0x211));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a37_0x57288e(0x219);[a37_0x57288e(0x233)]='Show\x20schedule\x20details';['validate'](_0xc0f4bb){const _0x2227f5=a37_0x57288e,_0x1c9923=_0xc0f4bb[_0x2227f5(0x1e0)][0x0];if(!_0x1c9923)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a37_0x57288e(0x1e1)](_0x51d93d){const _0x2aa90b=a37_0x57288e,{options:_0x536585,args:_0x593d5b,tdx:_0x348e0f}=_0x51d93d,_0x1117b7=_0x593d5b[0x0],_0x96e1c8=await withSpinner(_0x2aa90b(0x1e6),()=>_0x348e0f[_0x2aa90b(0x21a)][_0x2aa90b(0x224)](_0x1117b7),{'verbose':_0x536585[_0x2aa90b(0x236)]}),_0x27e369=_0x96e1c8[_0x2aa90b(0x21f)],_0x3eda0d={'name':_0x27e369[_0x2aa90b(0x1d9)],'cron':_0x27e369[_0x2aa90b(0x242)],'database':_0x27e369[_0x2aa90b(0x252)],'type':_0x27e369['type'],'timezone':_0x27e369[_0x2aa90b(0x1e4)],'user_name':_0x27e369[_0x2aa90b(0x201)],'created_at':_0x27e369[_0x2aa90b(0x246)],'engine_version':_0x27e369[_0x2aa90b(0x247)],'executing_user_id':_0x27e369[_0x2aa90b(0x1ed)],'query':_0x27e369[_0x2aa90b(0x20d)],'delay':_0x27e369['delay'],'priority':_0x27e369['priority'],'retry_limit':_0x27e369[_0x2aa90b(0x220)],..._0x27e369['result']&&{'result':_0x27e369['result']}};return await handleSingleObjectOutput(_0x3eda0d,_0x536585),0x0;}}function a37_0x1634(_0x2062e3,_0x2fc9f7){_0x2062e3=_0x2062e3-0x1c8;const _0x5a6084=a37_0x5a60();let _0x1634e6=_0x5a6084[_0x2062e3];return _0x1634e6;}export class ScheduleCreateCommand extends BaseCommand{[a37_0x57288e(0x1d9)]=a37_0x57288e(0x254);['description']=a37_0x57288e(0x25a);['validate'](_0x2fd539){const _0x8daf99=a37_0x57288e,_0x4a1c51=_0x2fd539[_0x8daf99(0x1e0)][0x0];if(!_0x4a1c51)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x238b0f=_0x2fd539[_0x8daf99(0x1e7)];if(!_0x238b0f[_0x8daf99(0x252)])return _0x8daf99(0x1f9);return undefined;}async[a37_0x57288e(0x1e1)](_0x5270ca){const _0x59d5df=a37_0x57288e,{options:_0x3c050c,args:_0x575836,tdx:_0x27cd67}=_0x5270ca,_0x2fb06e=_0x575836[0x0],_0x406be7=_0x3c050c,_0x356111=_0x406be7[_0x59d5df(0x252)],_0x10b39a=_0x406be7[_0x59d5df(0x248)],_0x51d995=_0x406be7[_0x59d5df(0x1fc)]||'trino';let _0x257327;try{_0x257327=readFileSync(_0x10b39a,_0x59d5df(0x23d))[_0x59d5df(0x217)]();}catch(_0x5ade52){throw new SDKError(ErrorCode[_0x59d5df(0x250)],_0x59d5df(0x210)+_0x10b39a,_0x5ade52 instanceof Error?_0x5ade52:undefined);}if(!_0x257327)throw new SDKError(ErrorCode[_0x59d5df(0x250)],_0x59d5df(0x22f));const _0x1ecde2={'database':_0x356111,'query':_0x257327,'type':_0x51d995};if(_0x406be7[_0x59d5df(0x242)])_0x1ecde2[_0x59d5df(0x242)]=_0x406be7[_0x59d5df(0x242)];if(_0x406be7['timezone'])_0x1ecde2[_0x59d5df(0x1e4)]=_0x406be7[_0x59d5df(0x1e4)];if(_0x406be7[_0x59d5df(0x218)]!==undefined)_0x1ecde2['delay']=Number(_0x406be7[_0x59d5df(0x218)]);if(_0x406be7['priority']!==undefined)_0x1ecde2['priority']=Number(_0x406be7[_0x59d5df(0x22e)]);if(_0x406be7[_0x59d5df(0x1dd)]!==undefined)_0x1ecde2[_0x59d5df(0x220)]=Number(_0x406be7[_0x59d5df(0x1dd)]);if(_0x406be7[_0x59d5df(0x24d)])_0x1ecde2[_0x59d5df(0x247)]=_0x406be7[_0x59d5df(0x24d)];if(_0x406be7[_0x59d5df(0x213)])_0x1ecde2['result']=_0x406be7[_0x59d5df(0x213)];if(_0x3c050c[_0x59d5df(0x236)]){console[_0x59d5df(0x235)](_0x59d5df(0x240)+_0x2fb06e),console[_0x59d5df(0x235)]('\x20\x20Database:\x20'+_0x356111),console[_0x59d5df(0x235)]('\x20\x20Type:\x20'+_0x51d995);if(_0x1ecde2['cron'])console[_0x59d5df(0x235)](_0x59d5df(0x24c)+_0x1ecde2[_0x59d5df(0x242)]);if(_0x1ecde2['timezone'])console[_0x59d5df(0x235)]('\x20\x20Timezone:\x20'+_0x1ecde2[_0x59d5df(0x1e4)]);}const _0x532ae5=await withSpinner(_0x59d5df(0x22b),()=>_0x27cd67['schedules'][_0x59d5df(0x244)](_0x2fb06e,_0x1ecde2),{'verbose':_0x3c050c['verbose']});return console[_0x59d5df(0x235)](_0x59d5df(0x24f)+_0x532ae5[_0x59d5df(0x21f)][_0x59d5df(0x1d9)]),await handleSingleObjectOutput(_0x532ae5[_0x59d5df(0x21f)],_0x3c050c),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x57288e(0x1d9)]=a37_0x57288e(0x23e);['description']='Update\x20a\x20scheduled\x20query';[a37_0x57288e(0x215)](_0x355203){const _0x387337=a37_0x57288e,_0x7de3e3=_0x355203[_0x387337(0x1e0)][0x0];if(!_0x7de3e3)return _0x387337(0x1e5);return undefined;}async[a37_0x57288e(0x1e1)](_0xeeed6a){const _0x260fee=a37_0x57288e,{options:_0x8c254d,args:_0x22fd89,tdx:_0x2f3951}=_0xeeed6a,_0x543e4d=_0x22fd89[0x0],_0x1585e7=_0x8c254d,_0x53108c={};if(_0x1585e7['database'])_0x53108c['database']=_0x1585e7[_0x260fee(0x252)];if(_0x1585e7[_0x260fee(0x1fc)])_0x53108c[_0x260fee(0x1fc)]=_0x1585e7['type'];if(_0x1585e7[_0x260fee(0x242)])_0x53108c[_0x260fee(0x242)]=_0x1585e7['cron'];if(_0x1585e7[_0x260fee(0x1e4)])_0x53108c[_0x260fee(0x1e4)]=_0x1585e7['timezone'];if(_0x1585e7[_0x260fee(0x218)]!==undefined)_0x53108c[_0x260fee(0x218)]=Number(_0x1585e7['delay']);if(_0x1585e7[_0x260fee(0x22e)]!==undefined)_0x53108c[_0x260fee(0x22e)]=Number(_0x1585e7[_0x260fee(0x22e)]);if(_0x1585e7[_0x260fee(0x1dd)]!==undefined)_0x53108c[_0x260fee(0x220)]=Number(_0x1585e7['retryLimit']);if(_0x1585e7[_0x260fee(0x24d)])_0x53108c[_0x260fee(0x247)]=_0x1585e7[_0x260fee(0x24d)];if(_0x1585e7['result'])_0x53108c['result']=_0x1585e7[_0x260fee(0x213)];if(_0x1585e7['file'])try{_0x53108c[_0x260fee(0x20d)]=readFileSync(_0x1585e7[_0x260fee(0x248)],_0x260fee(0x23d))[_0x260fee(0x217)]();}catch(_0x5e7cb7){throw new SDKError(ErrorCode[_0x260fee(0x250)],_0x260fee(0x210)+_0x1585e7['file'],_0x5e7cb7 instanceof Error?_0x5e7cb7:undefined);}if(Object['keys'](_0x53108c)[_0x260fee(0x1cc)]===0x0)throw new SDKError(ErrorCode[_0x260fee(0x250)],_0x260fee(0x1f0));if(_0x8c254d[_0x260fee(0x236)]){console['error'](_0x260fee(0x253)+_0x543e4d);for(const [_0x50dc96,_0x353d2d]of Object[_0x260fee(0x238)](_0x53108c)){_0x50dc96===_0x260fee(0x20d)?console[_0x260fee(0x235)]('\x20\x20'+_0x50dc96+':\x20'+_0x353d2d[_0x260fee(0x1f6)](0x0,0x32)+'...'):console[_0x260fee(0x235)]('\x20\x20'+_0x50dc96+':\x20'+_0x353d2d);}}const _0x564827=await withSpinner(_0x260fee(0x203),()=>_0x2f3951[_0x260fee(0x21a)][_0x260fee(0x245)](_0x543e4d,_0x53108c),{'verbose':_0x8c254d['verbose']});return console[_0x260fee(0x235)](_0x260fee(0x1c9)+_0x564827[_0x260fee(0x21f)][_0x260fee(0x1d9)]),await handleSingleObjectOutput(_0x564827['data'],_0x8c254d),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x57288e(0x1d9)]=a37_0x57288e(0x202);[a37_0x57288e(0x233)]='Delete\x20a\x20scheduled\x20query';[a37_0x57288e(0x215)](_0x2da606){const _0x2aa2b6=a37_0x57288e,_0x436d33=_0x2da606[_0x2aa2b6(0x1e0)][0x0];if(!_0x436d33)return _0x2aa2b6(0x1f2);return undefined;}async[a37_0x57288e(0x1e1)](_0x1ca02){const _0xc60a83=a37_0x57288e,{options:_0x4e08bf,args:_0x512b86,tdx:_0x2c23d8}=_0x1ca02,_0x398331=_0x512b86[0x0];if(!_0x4e08bf[_0xc60a83(0x1f7)]){const _0x46b628=await confirm(_0xc60a83(0x1d2)+_0x398331+'\x22?');if(!_0x46b628)return console[_0xc60a83(0x235)]('Cancelled'),0x0;}const _0x3a28ee=await withSpinner(_0xc60a83(0x206),()=>_0x2c23d8[_0xc60a83(0x21a)][_0xc60a83(0x21b)](_0x398331),{'verbose':_0x4e08bf[_0xc60a83(0x236)]});return console[_0xc60a83(0x235)](_0xc60a83(0x1ec)+_0x3a28ee['data'][_0xc60a83(0x1d9)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x57288e(0x1d9)]=a37_0x57288e(0x20f);['description']=a37_0x57288e(0x1e8);[a37_0x57288e(0x215)](_0x3b1640){const _0x2700b8=a37_0x57288e,_0x2248cf=_0x3b1640['args'][0x0];if(!_0x2248cf)return _0x2700b8(0x226);return undefined;}async['execute'](_0x3a3e27){const _0x4efe8d=a37_0x57288e,{options:_0x584db0,args:_0x24fe0d,tdx:_0xe0257f}=_0x3a3e27,_0x192bdc=_0x24fe0d[0x0],_0x3d111d=_0x584db0,_0x4eb015=_0x3d111d['time'],_0x1c51a9=_0x3d111d['num']!==undefined?Number(_0x3d111d[_0x4efe8d(0x214)]):undefined;if(_0x584db0['verbose']){console[_0x4efe8d(0x235)](_0x4efe8d(0x1f5)+_0x192bdc);if(_0x4eb015)console['error'](_0x4efe8d(0x1d7)+_0x4eb015);if(_0x1c51a9)console[_0x4efe8d(0x235)](_0x4efe8d(0x223)+_0x1c51a9);}const _0x3178e1=await withSpinner(_0x4efe8d(0x212),()=>_0xe0257f[_0x4efe8d(0x21a)][_0x4efe8d(0x1d1)](_0x192bdc,{'time':_0x4eb015,'num':_0x1c51a9}),{'verbose':_0x584db0[_0x4efe8d(0x236)]}),_0x77212f=_0x3178e1[_0x4efe8d(0x21f)][_0x4efe8d(0x257)];console[_0x4efe8d(0x235)]('Schedule\x20run\x20submitted:\x20'+_0x77212f[_0x4efe8d(0x1cc)]+_0x4efe8d(0x1f4)+(_0x77212f[_0x4efe8d(0x1cc)]!==0x1?'s':'')+'\x20created');for(const _0x31ea19 of _0x77212f){console['error'](_0x4efe8d(0x20c)+_0x31ea19[_0x4efe8d(0x229)]);}return await handleSDKOutput(_0x77212f,_0x584db0),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x57288e(0x1d9)]=a37_0x57288e(0x21c);[a37_0x57288e(0x233)]=a37_0x57288e(0x22d);[a37_0x57288e(0x215)](_0x5754b7){const _0x5616ff=a37_0x57288e,_0x3a4b27=_0x5754b7[_0x5616ff(0x1e0)][0x0];if(!_0x3a4b27)return _0x5616ff(0x1e3);return undefined;}async[a37_0x57288e(0x1e1)](_0x403bcb){const _0x375e2d=a37_0x57288e,{options:_0x45662d,args:_0x580f85,tdx:_0x1ad4ae}=_0x403bcb,_0x29da7b=_0x580f85[0x0],_0xd2360d=_0x45662d,_0x3681ab=_0xd2360d[_0x375e2d(0x24e)]!==undefined?Number(_0xd2360d['from']):undefined,_0x4f762a=_0xd2360d['to']!==undefined?Number(_0xd2360d['to']):undefined,_0x3da492=await withSpinner(_0x375e2d(0x234),()=>_0x1ad4ae['schedules'][_0x375e2d(0x21e)](_0x29da7b,{'from':_0x3681ab,'to':_0x4f762a}),{'verbose':_0x45662d[_0x375e2d(0x236)]}),_0x2d949f=_0x3da492[_0x375e2d(0x21f)];console[_0x375e2d(0x235)]('Found\x20'+_0x2d949f[_0x375e2d(0x23b)]+_0x375e2d(0x1ea)+(_0x2d949f[_0x375e2d(0x23b)]!==0x1?'s':'')+'\x20(showing\x20'+_0x2d949f[_0x375e2d(0x24e)]+'-'+_0x2d949f['to']+')');const _0x4c0adf=_0x2d949f[_0x375e2d(0x21e)]['map'](_0x1e2899=>({'job_id':_0x1e2899[_0x375e2d(0x229)],'type':_0x1e2899['type'],'status':_0x1e2899['status'],'scheduled_at':_0x1e2899[_0x375e2d(0x1df)],'created_at':_0x1e2899[_0x375e2d(0x246)],'start_at':_0x1e2899['start_at'],'end_at':_0x1e2899[_0x375e2d(0x232)]}));return await handleSDKOutput(_0x4c0adf,_0x45662d),0x0;}}
|
|
1
|
+
const a37_0x46ec0e=a37_0x4484;(function(_0x2c1b32,_0x2d03b0){const _0x405bf9=a37_0x4484,_0x1eaf28=_0x2c1b32();while(!![]){try{const _0x5b97de=parseInt(_0x405bf9(0x1ca))/0x1+parseInt(_0x405bf9(0x18d))/0x2+-parseInt(_0x405bf9(0x1aa))/0x3*(parseInt(_0x405bf9(0x1d7))/0x4)+-parseInt(_0x405bf9(0x164))/0x5+parseInt(_0x405bf9(0x1c0))/0x6*(-parseInt(_0x405bf9(0x1ad))/0x7)+parseInt(_0x405bf9(0x173))/0x8+parseInt(_0x405bf9(0x157))/0x9;if(_0x5b97de===_0x2d03b0)break;else _0x1eaf28['push'](_0x1eaf28['shift']());}catch(_0x12ccb9){_0x1eaf28['push'](_0x1eaf28['shift']());}}}(a37_0x3889,0xc8515));function a37_0x4484(_0x3c88e8,_0x430a18){_0x3c88e8=_0x3c88e8-0x146;const _0x38895f=a37_0x3889();let _0x4484fb=_0x38895f[_0x3c88e8];return _0x4484fb;}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';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x2f87b1 from'chalk';function formatRelativeTime(_0x3744ae){const _0x4f35d3=a37_0x4484,_0x582397=new Date(_0x3744ae),_0x429217=new Date(),_0x35b402=_0x582397[_0x4f35d3(0x1b0)]()-_0x429217[_0x4f35d3(0x1b0)](),_0x17c702=Math[_0x4f35d3(0x19b)](_0x35b402)/0x3e8,_0x58e119=_0x35b402<0x0;if(_0x17c702<0x3c)return _0x58e119?'just\x20now':'soon';else{if(_0x17c702<0xe10){const _0x3cea00=Math[_0x4f35d3(0x17a)](_0x17c702/0x3c);return _0x58e119?_0x3cea00+_0x4f35d3(0x1c2):_0x4f35d3(0x181)+_0x3cea00+'m';}else{if(_0x17c702<0x15180){const _0x4f5a65=Math[_0x4f35d3(0x17a)](_0x17c702/0xe10);return _0x58e119?_0x4f5a65+_0x4f35d3(0x189):_0x4f35d3(0x181)+_0x4f5a65+'h';}else{if(_0x17c702<0x93a80){const _0xc836fd=Math[_0x4f35d3(0x17a)](_0x17c702/0x15180);return _0x58e119?_0xc836fd+_0x4f35d3(0x18c):_0x4f35d3(0x181)+_0xc836fd+'d';}else return _0x582397[_0x4f35d3(0x194)]();}}}}function a37_0x3889(){const _0x2b4be8=['656910hNuDTI','utf-8','log','\x20\x20→\x20','engineVersion','query','start_at','schedule:delete','green','\x20(showing\x20','Creating\x20schedule...','history','jsonl','5324eVCnbm','Running\x20schedule:\x20','trim','\x20\x20Time:\x20','\x20scheduled\x20quer','run','args','ended_at','never','success','\x20job','keys','show','limit','delay','cron','status','Listing\x20scheduled\x20queries...','options','3061242ItwUSz','created_at','statusIcon','delete','execute','Show\x20schedule\x20execution\x20history','pagination','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','site','output','schedule:create','\x22...','engine_version','1639420xUmdRH','Cancelled','listQueries','No\x20scheduled\x20queries\x20found','Updating\x20schedule...','\x20\x20Type:\x20','\x20execution','user','padEnd','Failed\x20to\x20read\x20file:\x20','from','lastRun','\x20schedules','schedule:list','retry_limit','4364176cFELqQ','...','data','last_job','queryUrl','format','\x20matching\x20\x22','round','\x20\x20Database:\x20','priority','Getting\x20schedule\x20history...','error','validate','Running\x20schedule...','in\x20','schedule:history','max','dim','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','trino','Query\x20file\x20is\x20empty','h\x20ago','verbose','repeat','d\x20ago','2190298HKjsAJ','type','json','time_zone','num','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','ies','toLocaleDateString','jobs','schedules','Found\x20','timezone','Schedule\x20updated:\x20','\x20(use\x20--limit\x20to\x20see\x20more)','abs','Run\x20a\x20scheduled\x20query\x20immediately','(unnamed)','update','file','nextRun','name','Updating\x20schedule:\x20','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','length','Showing\x20first\x20','substring','Schedule\x20created:\x20','retryLimit','2166EOMfjV','Update\x20a\x20scheduled\x20query','/app/queries/editor?queryId=','2926OooCSX','Show\x20schedule\x20details','INVALID_ARGUMENT','getTime','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','description','Deleting\x20schedule...','Creating\x20schedule:\x20','entries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','red','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','map','result','Schedule\x20deleted:\x20','create','scheduled_at','next_run_at','join','7584WJkOEL','database','m\x20ago','cyan','schedule:run','executing_user_id','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','user_name','schedule:update'];a37_0x3889=function(){return _0x2b4be8;};return a37_0x3889();}export class ScheduleListCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x171);[a37_0x46ec0e(0x1b2)]='List\x20scheduled\x20queries';async[a37_0x46ec0e(0x15b)](_0x9442c3){const _0x1c2c89=a37_0x46ec0e,{options:_0x16d341,args:_0x17eaea,tdx:_0x578778}=_0x9442c3,_0x3830ad=resolveLimit(_0x16d341[_0x1c2c89(0x151)],DEFAULT_DISPLAY_LIMIT),_0x172381=_0x17eaea[0x0],_0x312366=_0x172381?_0x1c2c89(0x1a4)+_0x172381+_0x1c2c89(0x162):_0x1c2c89(0x155),_0x781079=await withSpinner(_0x312366,()=>_0x578778[_0x1c2c89(0x196)][_0x1c2c89(0x166)]({'limit':_0x3830ad,'scheduled':!![],'pattern':_0x172381}),{'verbose':_0x16d341[_0x1c2c89(0x18a)]}),_0x569949=_0x781079['data']['queries'],_0x37ba39=_0x781079[_0x1c2c89(0x175)][_0x1c2c89(0x15d)]['has_next_page'],_0x868081=_0x172381?_0x1c2c89(0x179)+_0x172381+'\x22':'';_0x37ba39?console['error'](_0x1c2c89(0x1a6)+_0x569949[_0x1c2c89(0x1a5)]+_0x1c2c89(0x170)+_0x868081+_0x1c2c89(0x19a)):console[_0x1c2c89(0x17e)]('Found\x20'+_0x569949[_0x1c2c89(0x1a5)]+_0x1c2c89(0x148)+(_0x569949['length']!==0x1?_0x1c2c89(0x193):'y')+_0x868081);if(_0x16d341[_0x1c2c89(0x178)]===_0x1c2c89(0x18f)||_0x16d341[_0x1c2c89(0x178)]===_0x1c2c89(0x1d6)||_0x16d341[_0x1c2c89(0x178)]==='table'||_0x16d341[_0x1c2c89(0x178)]==='tsv'){const _0x15a503=_0x569949['map'](_0x4c76e9=>({'id':_0x4c76e9['id'],'name':_0x4c76e9[_0x1c2c89(0x1a1)],'cron':_0x4c76e9[_0x1c2c89(0x153)],'database':_0x4c76e9[_0x1c2c89(0x1c1)]?.[_0x1c2c89(0x1a1)],'type':_0x4c76e9['type'],'timezone':_0x4c76e9[_0x1c2c89(0x190)],'user_name':_0x4c76e9[_0x1c2c89(0x16b)]?.[_0x1c2c89(0x1a1)],'updated_at':_0x4c76e9['updated_at'],'next_run_at':_0x4c76e9[_0x1c2c89(0x1be)],'last_job_status':_0x4c76e9[_0x1c2c89(0x176)]?.[_0x1c2c89(0x154)]}));await handleSDKOutput(_0x15a503,_0x16d341);}else{if(_0x569949[_0x1c2c89(0x1a5)]===0x0)console[_0x1c2c89(0x1cc)](_0x1c2c89(0x167));else{const _0xd032fd=_0x16d341[_0x1c2c89(0x15f)],_0x4d067c=_0x569949['map'](_0x128bdf=>{const _0x4c0b5b=_0x1c2c89,_0x42790b=_0x128bdf[_0x4c0b5b(0x176)]?.[_0x4c0b5b(0x154)]?_0x128bdf[_0x4c0b5b(0x176)][_0x4c0b5b(0x154)]===_0x4c0b5b(0x14d)?'✓':'✗':'-',_0x5e1f1c=_0x128bdf[_0x4c0b5b(0x176)]?.[_0x4c0b5b(0x14b)]?formatRelativeTime(_0x128bdf['last_job'][_0x4c0b5b(0x14b)]):_0x4c0b5b(0x14c),_0x1230c8=_0x128bdf[_0x4c0b5b(0x1be)]?formatRelativeTime(_0x128bdf[_0x4c0b5b(0x1be)]):'-',_0x36df1c=_0x128bdf['cron']||'',_0x5b53aa=_0x128bdf[_0x4c0b5b(0x1a1)]||_0x4c0b5b(0x19d),_0x5baf4d=getConsoleUrl(_0xd032fd,_0x4c0b5b(0x1ac)+_0x128bdf['id']);return{'statusIcon':_0x42790b,'lastRun':_0x5e1f1c,'nextRun':_0x1230c8,'cron':_0x36df1c,'name':_0x5b53aa,'queryUrl':_0x5baf4d,'status':_0x128bdf['last_job']?.['status']};}),_0x4abf61=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x56ee79=>_0x56ee79[_0x1c2c89(0x16f)][_0x1c2c89(0x1a5)])),_0x1b21e4=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x37d4ac=>_0x37d4ac[_0x1c2c89(0x1a0)][_0x1c2c89(0x1a5)])),_0x4618cd=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x288213=>_0x288213[_0x1c2c89(0x153)][_0x1c2c89(0x1a5)])),_0x4b5844=_0x4d067c[_0x1c2c89(0x1b9)](_0xb23bf9=>{const _0x408e3d=_0x1c2c89,_0x46c6c=_0xb23bf9['status']===_0x408e3d(0x14d)?a37_0x2f87b1[_0x408e3d(0x1d2)](_0xb23bf9[_0x408e3d(0x159)]):_0xb23bf9[_0x408e3d(0x154)]==='error'?a37_0x2f87b1[_0x408e3d(0x1b7)](_0xb23bf9['statusIcon']):a37_0x2f87b1[_0x408e3d(0x184)](_0xb23bf9['statusIcon']),_0x205b02=_0xb23bf9['lastRun'][_0x408e3d(0x16c)](_0x4abf61),_0x42eeda=_0xb23bf9['nextRun'][_0x408e3d(0x16c)](_0x1b21e4),_0xb36d70=_0xb23bf9[_0x408e3d(0x153)]?a37_0x2f87b1[_0x408e3d(0x1c3)](_0xb23bf9[_0x408e3d(0x153)]['padEnd'](_0x4618cd)):'\x20'[_0x408e3d(0x18b)](_0x4618cd),_0x1bca3e=hyperlink(_0xb23bf9[_0x408e3d(0x1a1)],_0xb23bf9[_0x408e3d(0x177)]);return _0x408e3d(0x185)+_0x46c6c+'\x20'+_0x205b02+_0x408e3d(0x1cd)+_0x42eeda+'\x20\x20'+_0xb36d70+'\x20\x20'+_0x1bca3e;});await writeOutput(_0x4b5844[_0x1c2c89(0x1bf)]('\x0a'),_0x16d341[_0x1c2c89(0x160)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x1ae);[a37_0x46ec0e(0x17f)](_0x29f9e7){const _0x4ea7d=a37_0x46ec0e,_0x5a6728=_0x29f9e7[_0x4ea7d(0x14a)][0x0];if(!_0x5a6728)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a37_0x46ec0e(0x15b)](_0x212c5f){const _0x3b147e=a37_0x46ec0e,{options:_0x307499,args:_0xa9eed5,tdx:_0x369a5c}=_0x212c5f,_0xc57994=_0xa9eed5[0x0],_0xd445d3=await withSpinner('Getting\x20schedule\x20details...',()=>_0x369a5c['schedules'][_0x3b147e(0x150)](_0xc57994),{'verbose':_0x307499[_0x3b147e(0x18a)]}),_0x2e6720=_0xd445d3[_0x3b147e(0x175)],_0x5efbb5={'name':_0x2e6720[_0x3b147e(0x1a1)],'cron':_0x2e6720[_0x3b147e(0x153)],'database':_0x2e6720[_0x3b147e(0x1c1)],'type':_0x2e6720[_0x3b147e(0x18e)],'timezone':_0x2e6720[_0x3b147e(0x198)],'user_name':_0x2e6720[_0x3b147e(0x1c8)],'created_at':_0x2e6720[_0x3b147e(0x158)],'engine_version':_0x2e6720[_0x3b147e(0x163)],'executing_user_id':_0x2e6720[_0x3b147e(0x1c5)],'query':_0x2e6720[_0x3b147e(0x1cf)],'delay':_0x2e6720[_0x3b147e(0x152)],'priority':_0x2e6720[_0x3b147e(0x17c)],'retry_limit':_0x2e6720[_0x3b147e(0x172)],..._0x2e6720['result']&&{'result':_0x2e6720[_0x3b147e(0x1ba)]}};return await handleSingleObjectOutput(_0x5efbb5,_0x307499),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x161);[a37_0x46ec0e(0x1b2)]='Create\x20a\x20scheduled\x20query';['validate'](_0x279565){const _0x2a8301=a37_0x46ec0e,_0x1f094c=_0x279565[_0x2a8301(0x14a)][0x0];if(!_0x1f094c)return _0x2a8301(0x1c7);const _0x53b698=_0x279565[_0x2a8301(0x156)];if(!_0x53b698[_0x2a8301(0x1c1)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x311691){const _0x41fd79=a37_0x46ec0e,{options:_0x326bf6,args:_0x536f6d,tdx:_0xf47cba}=_0x311691,_0x449e14=_0x536f6d[0x0],_0x542b61=_0x326bf6,_0x13a1dc=_0x542b61['database'],_0x2fba22=_0x542b61['file'],_0x31c135=_0x542b61[_0x41fd79(0x18e)]||_0x41fd79(0x187);let _0x3de8f3;try{_0x3de8f3=readFileSync(_0x2fba22,_0x41fd79(0x1cb))['trim']();}catch(_0x24a117){throw new SDKError(ErrorCode[_0x41fd79(0x1af)],_0x41fd79(0x16d)+_0x2fba22,_0x24a117 instanceof Error?_0x24a117:undefined);}if(!_0x3de8f3)throw new SDKError(ErrorCode[_0x41fd79(0x1af)],_0x41fd79(0x188));const _0x215d33={'database':_0x13a1dc,'query':_0x3de8f3,'type':_0x31c135};if(_0x542b61[_0x41fd79(0x153)])_0x215d33[_0x41fd79(0x153)]=_0x542b61['cron'];if(_0x542b61[_0x41fd79(0x198)])_0x215d33[_0x41fd79(0x198)]=_0x542b61[_0x41fd79(0x198)];if(_0x542b61['delay']!==undefined)_0x215d33[_0x41fd79(0x152)]=Number(_0x542b61[_0x41fd79(0x152)]);if(_0x542b61[_0x41fd79(0x17c)]!==undefined)_0x215d33[_0x41fd79(0x17c)]=Number(_0x542b61[_0x41fd79(0x17c)]);if(_0x542b61['retryLimit']!==undefined)_0x215d33[_0x41fd79(0x172)]=Number(_0x542b61[_0x41fd79(0x1a9)]);if(_0x542b61[_0x41fd79(0x1ce)])_0x215d33[_0x41fd79(0x163)]=_0x542b61[_0x41fd79(0x1ce)];if(_0x542b61[_0x41fd79(0x1ba)])_0x215d33[_0x41fd79(0x1ba)]=_0x542b61[_0x41fd79(0x1ba)];if(_0x326bf6[_0x41fd79(0x18a)]){console[_0x41fd79(0x17e)](_0x41fd79(0x1b4)+_0x449e14),console[_0x41fd79(0x17e)](_0x41fd79(0x17b)+_0x13a1dc),console[_0x41fd79(0x17e)](_0x41fd79(0x169)+_0x31c135);if(_0x215d33['cron'])console[_0x41fd79(0x17e)]('\x20\x20Cron:\x20'+_0x215d33[_0x41fd79(0x153)]);if(_0x215d33[_0x41fd79(0x198)])console[_0x41fd79(0x17e)]('\x20\x20Timezone:\x20'+_0x215d33[_0x41fd79(0x198)]);}const _0x3a65e5=await withSpinner(_0x41fd79(0x1d4),()=>_0xf47cba[_0x41fd79(0x196)][_0x41fd79(0x1bc)](_0x449e14,_0x215d33),{'verbose':_0x326bf6[_0x41fd79(0x18a)]});return console['error'](_0x41fd79(0x1a8)+_0x3a65e5['data'][_0x41fd79(0x1a1)]),await handleSingleObjectOutput(_0x3a65e5['data'],_0x326bf6),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1c9);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x1ab);[a37_0x46ec0e(0x17f)](_0x418761){const _0x1a39ed=a37_0x46ec0e,_0x31501a=_0x418761[_0x1a39ed(0x14a)][0x0];if(!_0x31501a)return _0x1a39ed(0x1b8);return undefined;}async['execute'](_0x5f28e6){const _0x14c338=a37_0x46ec0e,{options:_0x441f61,args:_0x4ef376,tdx:_0x57f94c}=_0x5f28e6,_0x44fe19=_0x4ef376[0x0],_0x5e9c2e=_0x441f61,_0x533e5d={};if(_0x5e9c2e['database'])_0x533e5d['database']=_0x5e9c2e['database'];if(_0x5e9c2e['type'])_0x533e5d[_0x14c338(0x18e)]=_0x5e9c2e['type'];if(_0x5e9c2e[_0x14c338(0x153)])_0x533e5d[_0x14c338(0x153)]=_0x5e9c2e[_0x14c338(0x153)];if(_0x5e9c2e[_0x14c338(0x198)])_0x533e5d['timezone']=_0x5e9c2e['timezone'];if(_0x5e9c2e[_0x14c338(0x152)]!==undefined)_0x533e5d[_0x14c338(0x152)]=Number(_0x5e9c2e['delay']);if(_0x5e9c2e['priority']!==undefined)_0x533e5d[_0x14c338(0x17c)]=Number(_0x5e9c2e[_0x14c338(0x17c)]);if(_0x5e9c2e[_0x14c338(0x1a9)]!==undefined)_0x533e5d[_0x14c338(0x172)]=Number(_0x5e9c2e['retryLimit']);if(_0x5e9c2e[_0x14c338(0x1ce)])_0x533e5d[_0x14c338(0x163)]=_0x5e9c2e[_0x14c338(0x1ce)];if(_0x5e9c2e['result'])_0x533e5d[_0x14c338(0x1ba)]=_0x5e9c2e[_0x14c338(0x1ba)];if(_0x5e9c2e[_0x14c338(0x19f)])try{_0x533e5d[_0x14c338(0x1cf)]=readFileSync(_0x5e9c2e[_0x14c338(0x19f)],_0x14c338(0x1cb))[_0x14c338(0x146)]();}catch(_0x45e41f){throw new SDKError(ErrorCode[_0x14c338(0x1af)],_0x14c338(0x16d)+_0x5e9c2e['file'],_0x45e41f instanceof Error?_0x45e41f:undefined);}if(Object[_0x14c338(0x14f)](_0x533e5d)[_0x14c338(0x1a5)]===0x0)throw new SDKError(ErrorCode[_0x14c338(0x1af)],_0x14c338(0x192));if(_0x441f61['verbose']){console['error'](_0x14c338(0x1a2)+_0x44fe19);for(const [_0x8ec899,_0x5d852f]of Object[_0x14c338(0x1b5)](_0x533e5d)){_0x8ec899==='query'?console[_0x14c338(0x17e)]('\x20\x20'+_0x8ec899+':\x20'+_0x5d852f[_0x14c338(0x1a7)](0x0,0x32)+_0x14c338(0x174)):console['error']('\x20\x20'+_0x8ec899+':\x20'+_0x5d852f);}}const _0x3aa91e=await withSpinner(_0x14c338(0x168),()=>_0x57f94c['schedules'][_0x14c338(0x19e)](_0x44fe19,_0x533e5d),{'verbose':_0x441f61[_0x14c338(0x18a)]});return console['error'](_0x14c338(0x199)+_0x3aa91e['data'][_0x14c338(0x1a1)]),await handleSingleObjectOutput(_0x3aa91e[_0x14c338(0x175)],_0x441f61),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1d1);['description']='Delete\x20a\x20scheduled\x20query';[a37_0x46ec0e(0x17f)](_0x1ef7e5){const _0x5e6972=a37_0x46ec0e,_0x15d576=_0x1ef7e5[_0x5e6972(0x14a)][0x0];if(!_0x15d576)return _0x5e6972(0x186);return undefined;}async[a37_0x46ec0e(0x15b)](_0x2481dc){const _0x35cc82=a37_0x46ec0e,{options:_0x1c333b,args:_0x54de57,tdx:_0x5527f6}=_0x2481dc,_0x33210f=_0x54de57[0x0];if(!_0x1c333b['yes']){const _0x33a29f=await confirm(_0x35cc82(0x15e)+_0x33210f+'\x22?');if(!_0x33a29f)return console[_0x35cc82(0x17e)](_0x35cc82(0x165)),0x0;}const _0x15d4f6=await withSpinner(_0x35cc82(0x1b3),()=>_0x5527f6['schedules'][_0x35cc82(0x15a)](_0x33210f),{'verbose':_0x1c333b[_0x35cc82(0x18a)]});return console[_0x35cc82(0x17e)](_0x35cc82(0x1bb)+_0x15d4f6[_0x35cc82(0x175)][_0x35cc82(0x1a1)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1c4);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x19c);['validate'](_0x460e31){const _0x1ced06=a37_0x46ec0e,_0x322a46=_0x460e31[_0x1ced06(0x14a)][0x0];if(!_0x322a46)return _0x1ced06(0x1b1);return undefined;}async[a37_0x46ec0e(0x15b)](_0x438237){const _0x29f52a=a37_0x46ec0e,{options:_0x3cc767,args:_0x264dc5,tdx:_0x323911}=_0x438237,_0x19d780=_0x264dc5[0x0],_0x54d1f1=_0x3cc767,_0x2988a6=_0x54d1f1['time'],_0x29364d=_0x54d1f1[_0x29f52a(0x191)]!==undefined?Number(_0x54d1f1['num']):undefined;if(_0x3cc767[_0x29f52a(0x18a)]){console['error'](_0x29f52a(0x1d8)+_0x19d780);if(_0x2988a6)console[_0x29f52a(0x17e)](_0x29f52a(0x147)+_0x2988a6);if(_0x29364d)console['error']('\x20\x20Num:\x20'+_0x29364d);}const _0x32929d=await withSpinner(_0x29f52a(0x180),()=>_0x323911[_0x29f52a(0x196)][_0x29f52a(0x149)](_0x19d780,{'time':_0x2988a6,'num':_0x29364d}),{'verbose':_0x3cc767[_0x29f52a(0x18a)]}),_0x5dca4b=_0x32929d['data'][_0x29f52a(0x195)];console[_0x29f52a(0x17e)]('Schedule\x20run\x20submitted:\x20'+_0x5dca4b[_0x29f52a(0x1a5)]+_0x29f52a(0x14e)+(_0x5dca4b[_0x29f52a(0x1a5)]!==0x1?'s':'')+_0x29f52a(0x1a3));for(const _0x3d0e41 of _0x5dca4b){console['error']('\x20\x20Job\x20ID:\x20'+_0x3d0e41['job_id']);}return await handleSDKOutput(_0x5dca4b,_0x3cc767),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x182);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x15c);['validate'](_0x1851e5){const _0x4d7537=a37_0x46ec0e,_0x435da9=_0x1851e5[_0x4d7537(0x14a)][0x0];if(!_0x435da9)return _0x4d7537(0x1b6);return undefined;}async[a37_0x46ec0e(0x15b)](_0x1eeb46){const _0x48fcda=a37_0x46ec0e,{options:_0x44873c,args:_0x268fe0,tdx:_0x13a820}=_0x1eeb46,_0x72f7d2=_0x268fe0[0x0],_0x1f4b3e=_0x44873c,_0x2f08b0=_0x1f4b3e[_0x48fcda(0x16e)]!==undefined?Number(_0x1f4b3e[_0x48fcda(0x16e)]):undefined,_0x5de5e1=_0x1f4b3e['to']!==undefined?Number(_0x1f4b3e['to']):undefined,_0x4580ae=await withSpinner(_0x48fcda(0x17d),()=>_0x13a820['schedules'][_0x48fcda(0x1d5)](_0x72f7d2,{'from':_0x2f08b0,'to':_0x5de5e1}),{'verbose':_0x44873c['verbose']}),_0xe49fe9=_0x4580ae[_0x48fcda(0x175)];console[_0x48fcda(0x17e)](_0x48fcda(0x197)+_0xe49fe9['count']+_0x48fcda(0x16a)+(_0xe49fe9[_0x48fcda(0x1c6)]!==0x1?'s':'')+_0x48fcda(0x1d3)+_0xe49fe9[_0x48fcda(0x16e)]+'-'+_0xe49fe9['to']+')');const _0x196efd=_0xe49fe9[_0x48fcda(0x1d5)]['map'](_0x173d61=>({'job_id':_0x173d61['job_id'],'type':_0x173d61[_0x48fcda(0x18e)],'status':_0x173d61[_0x48fcda(0x154)],'scheduled_at':_0x173d61[_0x48fcda(0x1bd)],'created_at':_0x173d61[_0x48fcda(0x158)],'start_at':_0x173d61[_0x48fcda(0x1d0)],'end_at':_0x173d61['end_at']}));return await handleSDKOutput(_0x196efd,_0x44873c),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a38_0x1e7a(_0x46e793,_0x3d73af){_0x46e793=_0x46e793-0xf6;const _0xb8c9dd=a38_0xb8c9();let _0x1e7a51=_0xb8c9dd[_0x46e793];return _0x1e7a51;}const a38_0x10f641=a38_0x1e7a;(function(_0x1191ca,_0x26597f){const _0x2997d2=a38_0x1e7a,_0x471661=_0x1191ca();while(!![]){try{const _0x263b90=-parseInt(_0x2997d2(0x138))/0x1*(-parseInt(_0x2997d2(0x173))/0x2)+parseInt(_0x2997d2(0x113))/0x3+-parseInt(_0x2997d2(0x166))/0x4+parseInt(_0x2997d2(0x168))/0x5*(parseInt(_0x2997d2(0x11d))/0x6)+-parseInt(_0x2997d2(0x149))/0x7+parseInt(_0x2997d2(0x13b))/0x8+parseInt(_0x2997d2(0x10d))/0x9*(-parseInt(_0x2997d2(0x12b))/0xa);if(_0x263b90===_0x26597f)break;else _0x471661['push'](_0x471661['shift']());}catch(_0x42eae8){_0x471661['push'](_0x471661['shift']());}}}(a38_0xb8c9,0x1eb4f));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 a38_0x51ca9a from'chalk';async function resolveSegmentTarget(_0x2b93a0,_0x41ec99,_0x55e0ac){const _0x294ab3=a38_0x1e7a;if(isYamlFilePath(_0x2b93a0))try{const _0x5e8e5d=await resolveYamlFilePath(_0x2b93a0);return _0x55e0ac&&(console[_0x294ab3(0x14d)](_0x294ab3(0x14b)+_0x2b93a0),console[_0x294ab3(0x14d)]('\x20\x20Parent\x20segment:\x20'+_0x5e8e5d[_0x294ab3(0x100)]),console[_0x294ab3(0x14d)](_0x294ab3(0x135)+_0x5e8e5d[_0x294ab3(0x177)]),console[_0x294ab3(0x14d)]('\x20\x20Folder\x20path:\x20'+(_0x5e8e5d[_0x294ab3(0x160)]||_0x294ab3(0x194))),console[_0x294ab3(0x14d)](_0x294ab3(0x143)+_0x5e8e5d[_0x294ab3(0x151)])),_0x5e8e5d[_0x294ab3(0x151)];}catch(_0x12a518){throw new SDKError(ErrorCode[_0x294ab3(0x18e)],_0x294ab3(0x183)+_0x12a518[_0x294ab3(0x125)]);}if(!_0x41ec99)throw new SDKError(ErrorCode[_0x294ab3(0x18e)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x41ec99+'/'+_0x2b93a0;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x10f641(0x147);[a38_0x10f641(0xf6)]='Show\x20segment\x20or\x20folder\x20details';async[a38_0x10f641(0x122)](_0x3adca8){const _0x29eb7c=a38_0x10f641,{options:_0x52c658,args:_0x4183ee,tdx:_0xf063f0}=_0x3adca8,_0x4c4818=_0x4183ee[0x0],_0x6243ce=!_0x4c4818&&!!_0x52c658['parentSegment'],_0x51db51=_0x4c4818||_0x52c658[_0x29eb7c(0x100)];if(!_0x51db51)return console[_0x29eb7c(0x14d)](_0x29eb7c(0x17a)),console[_0x29eb7c(0x14d)](_0x29eb7c(0x176)),console[_0x29eb7c(0x14d)]('Examples:'),console['error'](_0x29eb7c(0x17e)),console[_0x29eb7c(0x14d)](_0x29eb7c(0x11a)),console[_0x29eb7c(0x14d)](_0x29eb7c(0x136)),console[_0x29eb7c(0x14d)](_0x29eb7c(0x153)),0x1;try{const _0x455b17=_0x52c658[_0x29eb7c(0x12e)];let _0x4459e5=_0x51db51;!_0x6243ce&&_0x455b17&&!_0x51db51['includes']('/')&&(_0x4459e5=_0x455b17+'/'+_0x51db51,_0x52c658[_0x29eb7c(0x112)]&&console[_0x29eb7c(0x14d)](_0x29eb7c(0x11b)+_0x4459e5));const _0x58f3c0=await withSpinner(_0x29eb7c(0x12c)+_0x4459e5+'\x27...',()=>_0xf063f0[_0x29eb7c(0x181)]['resolvePathToResource'](_0x4459e5),{'verbose':_0x52c658['verbose']}),_0x15d8dd=_0x58f3c0[_0x29eb7c(0x11c)];_0x52c658[_0x29eb7c(0x112)]&&(console[_0x29eb7c(0x14d)](_0x29eb7c(0x15b)+_0x15d8dd['type']),console['error'](_0x29eb7c(0x124)+_0x15d8dd[_0x29eb7c(0x14c)]),_0x15d8dd[_0x29eb7c(0x19d)]&&console[_0x29eb7c(0x14d)]('Folder\x20ID:\x20'+_0x15d8dd['folderId']),_0x15d8dd['segmentId']&&console[_0x29eb7c(0x14d)]('Segment\x20ID:\x20'+_0x15d8dd[_0x29eb7c(0x14a)]));if(_0x15d8dd[_0x29eb7c(0x10b)]===_0x29eb7c(0x104)){const _0x50c797=await withSpinner(_0x29eb7c(0x161),()=>_0xf063f0[_0x29eb7c(0x181)][_0x29eb7c(0x157)](_0x15d8dd[_0x29eb7c(0x14c)]),{'verbose':_0x52c658['verbose']});await handleSingleObjectOutput(_0x50c797[_0x29eb7c(0x11c)],_0x52c658);}else{if(_0x15d8dd['type']===_0x29eb7c(0x139)){if(!_0x15d8dd['folderId'])throw new SDKError(ErrorCode[_0x29eb7c(0x16f)],_0x29eb7c(0x158));const _0x10e9b0=await withSpinner(_0x29eb7c(0x17f),()=>_0xf063f0[_0x29eb7c(0x181)][_0x29eb7c(0x187)](_0x15d8dd[_0x29eb7c(0x19d)]),{'verbose':_0x52c658[_0x29eb7c(0x112)]});await handleSingleObjectOutput(_0x10e9b0[_0x29eb7c(0x11c)],_0x52c658);}else{if(_0x15d8dd[_0x29eb7c(0x10b)]===_0x29eb7c(0x181)){if(!_0x15d8dd[_0x29eb7c(0x14a)])throw new SDKError(ErrorCode[_0x29eb7c(0x16b)],_0x29eb7c(0x146));const _0x3689b5=await withSpinner(_0x29eb7c(0x199),()=>_0xf063f0[_0x29eb7c(0x181)][_0x29eb7c(0x116)](_0x15d8dd['parentId'],_0x15d8dd[_0x29eb7c(0x14a)]),{'verbose':_0x52c658[_0x29eb7c(0x112)]});await handleSingleObjectOutput(_0x3689b5[_0x29eb7c(0x11c)],_0x52c658);}}}return 0x0;}catch(_0x2fad99){if(_0x2fad99 instanceof SDKError)return console[_0x29eb7c(0x14d)](_0x29eb7c(0x123)+_0x2fad99[_0x29eb7c(0x125)]),_0x2fad99[_0x29eb7c(0x141)]&&console[_0x29eb7c(0x14d)]('\x20\x20Cause:\x20'+_0x2fad99['cause']),0x1;throw _0x2fad99;}}}function a38_0xb8c9(){const _0x435919=['url','segment:view','Usage:\x20tdx\x20sg\x20show\x20<name>','174748uWwUPx','Show\x20folder\x20or\x20child\x20segment\x20details','5TAbwGH','SELECT\x20*\x20FROM\x20(\x0a','Resolving\x20parent\x20segment\x20\x27','SEGMENT_NOT_FOUND','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','content','SEGMENT_FOLDER_NOT_FOUND','getSegmentSQL','Executing\x20segment\x20query...','Examples:','171228juQdea','site','resolveFolderId','Usage:\x20tdx\x20segment\x20describe\x20<path>','segmentName','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','json','Error:\x20Path\x20or\x20name\x20is\x20required','stats','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Fetching\x20folder\x20details...','setJobId','segment','SQL\x20query:\x0a','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','elapsedTimeMillis','jobId','segment:sql','getFolder','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','Options:','segment:folder:list','INVALID_ARGUMENT','green','path','Folder\x20name:\x20','segment:desc','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','(root)','resolvePathToResource','Usage:','Resolved\x20parent\x20ID:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Fetching\x20segment\x20details...','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','folderId','Target\x20path:\x20','description','processedRows','Resolving\x20\x27','Resolved\x20folder\x20ID:\x20','log','segment:show','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x27\x20with\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolved:\x20','parentSegment','web','format','jsonl','parent','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:folder:create','type','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','218223TBFJAX','cyan','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','query','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','verbose','657618lGyRfB','code','✖\x20Query\x20failed\x20[','getSegment','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Segment\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Resolved\x20relative\x20path\x20to:\x20','data','192432sCRorP','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','getSQLFromYamlFile','execute','Error:\x20','Parent\x20ID:\x20','message','information_schema','red','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Show\x20child\x20segment\x20schema\x20(column\x20types)','70DEbsgG','Resolving\x20path\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','segmentPath','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x27...','Create\x20segment\x20folder\x20for\x20organization','Creating\x20folder\x20\x27','/e/','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','toLocaleString','2HzGhAM','folder','Folder\x20ID:\x20','554200Czluuk','getSQLFromServerSegment','Use:\x20tdx\x20ps\x20show','\x20\x20tdx\x20sg\x20sql\x20--path\x20','resolveParentId','Get\x20SQL\x20query\x20for\x20child\x20segment','cause','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment:describe','name','1068130QjxYnd','segmentId','Resolved\x20YAML\x20file:\x20','parentId','error','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20Cause:\x20','segment:folder:show','fullPath','\x20Opening\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20view','/app/ps/','getParent','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20folder','\x20[Job\x20ID:\x20','trim','folderPath','Fetching\x20parent\x20segment\x20details...','getSegmentSQLFromYaml'];a38_0xb8c9=function(){return _0x435919;};return a38_0xb8c9();}export class SegmentShowCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0xfb);[a38_0x10f641(0xf6)]=a38_0x10f641(0x198);async[a38_0x10f641(0x122)](_0x3334ab){const _0x5ab82d=a38_0x10f641,{options:_0x3e6814,args:_0x269b77,tdx:_0x4c775c}=_0x3334ab,_0x5a507b=_0x269b77[0x0];if(!_0x5a507b)return console[_0x5ab82d(0x14d)](_0x5ab82d(0x17c)),console[_0x5ab82d(0x14d)](_0x5ab82d(0x165)),console['error'](_0x5ab82d(0x145)),console[_0x5ab82d(0x14d)](_0x5ab82d(0x172)),console[_0x5ab82d(0x14d)](_0x5ab82d(0x178)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x211fc4=_0x3e6814[_0x5ab82d(0x100)],_0x1f1985=await resolveSegmentTarget(_0x5a507b,_0x211fc4,_0x3e6814[_0x5ab82d(0x112)]);_0x3e6814[_0x5ab82d(0x112)]&&console['error'](_0x5ab82d(0x19e)+_0x1f1985);const _0x2613e3=await withSpinner('Resolving\x20\x27'+_0x5a507b+_0x5ab82d(0x131),()=>_0x4c775c[_0x5ab82d(0x181)][_0x5ab82d(0x195)](_0x1f1985),{'verbose':_0x3e6814['verbose']}),_0x5ab578=_0x2613e3[_0x5ab82d(0x11c)];_0x3e6814[_0x5ab82d(0x112)]&&(console[_0x5ab82d(0x14d)](_0x5ab82d(0x15b)+_0x5ab578[_0x5ab82d(0x10b)]),console[_0x5ab82d(0x14d)](_0x5ab82d(0x124)+_0x5ab578[_0x5ab82d(0x14c)]));if(_0x5ab578[_0x5ab82d(0x10b)]===_0x5ab82d(0x139))return console[_0x5ab82d(0x14d)](_0x5ab82d(0x118)),console['error'](_0x5ab82d(0x19a)),0x1;if(_0x5ab578[_0x5ab82d(0x10b)]==='parent')return console['error'](_0x5ab82d(0x144)),console[_0x5ab82d(0x14d)](_0x5ab82d(0x13d)),0x1;if(!_0x5ab578[_0x5ab82d(0x14a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5ab82d(0x146));const _0x5c8481=await withSpinner(_0x5ab82d(0x11f),()=>_0x4c775c[_0x5ab82d(0x181)][_0x5ab82d(0x170)](_0x5ab578[_0x5ab82d(0x14c)],_0x5ab578[_0x5ab82d(0x14a)]),{'verbose':_0x3e6814['verbose']});let _0x2fe173=_0x5c8481[_0x5ab82d(0x11c)];const _0x236724=resolveLimit(_0x3e6814['limit'],DEFAULT_DISPLAY_LIMIT),_0x134fb5=/\bLIMIT\s+\d+/i['test'](_0x2fe173);!_0x134fb5&&(_0x2fe173=_0x2fe173[_0x5ab82d(0x15f)]()['replace'](/;+$/,''),_0x2fe173=_0x5ab82d(0x169)+_0x2fe173+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x236724);_0x3e6814[_0x5ab82d(0x112)]&&console['error'](_0x5ab82d(0x182)+_0x2fe173);const _0x3ff60a=await withProgressSpinner(_0x5ab82d(0x171),async _0x43084d=>{const _0x2378f5=_0x5ab82d,_0x41cd9a=await _0x4c775c[_0x2378f5(0x110)][_0x2378f5(0x122)](_0x2fe173,{'catalog':'td','schema':_0x2378f5(0x126),'onJobId':_0xb28801=>{const _0x3a5b8d=_0x2378f5;_0x43084d[_0x3a5b8d(0x180)](_0xb28801);}});return _0x41cd9a;},{'verbose':_0x3e6814['verbose']}),_0x39ea0e=_0x3ff60a[_0x5ab82d(0x11c)],_0x1b9dab=_0x39ea0e[_0x5ab82d(0x185)]?_0x5ab82d(0x15e)+_0x39ea0e[_0x5ab82d(0x185)]+']':'';return console[_0x5ab82d(0x14d)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x39ea0e[_0x5ab82d(0x17b)][_0x5ab82d(0xf7)][_0x5ab82d(0x137)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x39ea0e[_0x5ab82d(0x17b)][_0x5ab82d(0x184)])+_0x1b9dab)),await handleQueryOutput(_0x39ea0e,_0x3e6814),0x0;}catch(_0xf42452){if(_0xf42452 instanceof SDKError)return console[_0x5ab82d(0x14d)](_0x5ab82d(0x115)+_0xf42452[_0x5ab82d(0x114)]+']'),console[_0x5ab82d(0x14d)]('\x0a'+_0xf42452['message']),0x1;throw _0xf42452;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a38_0x10f641(0x18d);['description']=a38_0x10f641(0x189);async[a38_0x10f641(0x122)](_0xf8891e){const _0x2d9dfe=a38_0x10f641,{options:_0x516ff3,args:_0xa7acd0,tdx:_0x418a8e}=_0xf8891e;if(_0xa7acd0['length']===0x0)return console[_0x2d9dfe(0x14d)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2d9dfe(0x14d)](_0x2d9dfe(0x10c)),0x1;const _0x4d22e5=_0xa7acd0[0x0];try{_0x516ff3['verbose']&&(console[_0x2d9dfe(0x14d)](_0x2d9dfe(0x16c)+_0x516ff3[_0x2d9dfe(0x174)]),console[_0x2d9dfe(0x14d)]('Parent\x20name:\x20'+_0x4d22e5));const _0xc1f540=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4d22e5+_0x2d9dfe(0x131),()=>_0x418a8e['segment'][_0x2d9dfe(0x13f)](_0x4d22e5),{'verbose':_0x516ff3['verbose']}),_0x2291c0=_0xc1f540[_0x2d9dfe(0x11c)];_0x516ff3[_0x2d9dfe(0x112)]&&console[_0x2d9dfe(0x14d)](_0x2d9dfe(0x197)+_0x2291c0);const _0x6691a9=await withSpinner(_0x2d9dfe(0x18b)+_0x4d22e5+_0x2d9dfe(0x131),()=>_0x418a8e[_0x2d9dfe(0x181)]['listFolders'](_0x2291c0),{'verbose':_0x516ff3[_0x2d9dfe(0x112)]}),_0x479566=_0x6691a9[_0x2d9dfe(0x11c)];return console['error']('✔\x20Found\x20'+_0x479566[_0x2d9dfe(0x107)]+_0x2d9dfe(0x15d)+(_0x479566[_0x2d9dfe(0x107)]!==0x1?'s':'')),await handleSDKOutput(_0x479566,_0x516ff3),0x0;}catch(_0x279b19){if(_0x279b19 instanceof SDKError)return console[_0x2d9dfe(0x14d)]('Error:\x20'+_0x279b19[_0x2d9dfe(0x125)]),_0x279b19[_0x2d9dfe(0x141)]&&console[_0x2d9dfe(0x14d)](_0x2d9dfe(0x14f)+_0x279b19['cause']),0x1;throw _0x279b19;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0x150);[a38_0x10f641(0xf6)]=a38_0x10f641(0x12f);async[a38_0x10f641(0x122)](_0x319446){const _0x519cc3=a38_0x10f641,{options:_0x213600,args:_0x22c7d3,tdx:_0x338c30}=_0x319446;if(_0x22c7d3[_0x519cc3(0x107)]===0x0)return console[_0x519cc3(0x14d)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x519cc3(0x106)),0x1;try{const {parentId:_0x112108,childId:_0x2af914}=parseSegmentRef(_0x22c7d3[0x0]);_0x213600['verbose']&&(console[_0x519cc3(0x14d)](_0x519cc3(0x16c)+_0x213600['site']),console[_0x519cc3(0x14d)]('Parent\x20name:\x20'+_0x112108),_0x2af914&&console[_0x519cc3(0x14d)](_0x519cc3(0x191)+_0x2af914));if(!_0x2af914)return console[_0x519cc3(0x14d)](_0x519cc3(0x109)),0x1;const _0x4ae2fb=await withSpinner(_0x519cc3(0x16a)+_0x112108+_0x519cc3(0x131),()=>_0x338c30[_0x519cc3(0x181)][_0x519cc3(0x13f)](_0x112108),{'verbose':_0x213600[_0x519cc3(0x112)]}),_0x4df8d5=_0x4ae2fb[_0x519cc3(0x11c)];_0x213600[_0x519cc3(0x112)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x4df8d5);const _0x57aed9=await withSpinner('Resolving\x20folder\x20\x27'+_0x2af914+_0x519cc3(0x131),()=>_0x338c30[_0x519cc3(0x181)]['resolveFolderId'](_0x4df8d5,_0x2af914),{'verbose':_0x213600['verbose']}),_0xe38129=_0x57aed9[_0x519cc3(0x11c)];_0x213600[_0x519cc3(0x112)]&&console['error'](_0x519cc3(0xf9)+_0xe38129);const _0x10eb8c=await withSpinner('Fetching\x20folder\x20\x27'+_0x2af914+_0x519cc3(0x131),()=>_0x338c30[_0x519cc3(0x181)][_0x519cc3(0x187)](_0xe38129),{'verbose':_0x213600[_0x519cc3(0x112)]});return await handleSDKOutput([_0x10eb8c[_0x519cc3(0x11c)]],_0x213600),0x0;}catch(_0x4ec367){if(_0x4ec367 instanceof SDKError)return console[_0x519cc3(0x14d)](_0x519cc3(0x123)+_0x4ec367[_0x519cc3(0x125)]),_0x4ec367[_0x519cc3(0x141)]&&console['error'](_0x519cc3(0x14f)+_0x4ec367[_0x519cc3(0x141)]),0x1;throw _0x4ec367;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0x186);[a38_0x10f641(0xf6)]=a38_0x10f641(0x140);async[a38_0x10f641(0x122)](_0x1a373b){const _0x39a0f8=a38_0x10f641,{options:_0xade0f4,args:_0x7b01c0}=_0x1a373b,_0x5400bc=_0xade0f4,_0x48b107=_0x5400bc[_0x39a0f8(0x190)],_0x1bbbc0=_0x7b01c0[0x0];if(!_0x1bbbc0&&!_0x48b107)return console[_0x39a0f8(0x14d)](a38_0x51ca9a[_0x39a0f8(0x127)](_0x39a0f8(0x18a))),console['error'](_0x39a0f8(0x196)),console['error'](_0x39a0f8(0x142)),console[_0x39a0f8(0x14d)](_0x39a0f8(0x19b)),console[_0x39a0f8(0x14d)](_0x39a0f8(0x172)),console[_0x39a0f8(0x14d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x39a0f8(0x14d)](_0x39a0f8(0x188)),0x1;if(_0x1bbbc0&&_0x48b107)return console[_0x39a0f8(0x14d)](a38_0x51ca9a['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x5d8e33;if(_0x48b107)_0x5d8e33=await this[_0x39a0f8(0x121)](_0x48b107,_0x1a373b);else{if(isYamlFilePath(_0x1bbbc0))return console[_0x39a0f8(0x14d)](a38_0x51ca9a[_0x39a0f8(0x127)](_0x39a0f8(0x120))),console[_0x39a0f8(0x14d)](_0x39a0f8(0x13e)+_0x1bbbc0),0x1;else _0x5d8e33=await this[_0x39a0f8(0x13c)](_0x1bbbc0,_0x1a373b);}return _0xade0f4[_0x39a0f8(0x102)]===_0x39a0f8(0x179)||_0xade0f4[_0x39a0f8(0x102)]===_0x39a0f8(0x103)?await handleSDKOutput([{'sql':_0x5d8e33}],_0xade0f4):console[_0x39a0f8(0xfa)](_0x5d8e33),0x0;}catch(_0x16a7b2){if(_0x16a7b2 instanceof SDKError)return console[_0x39a0f8(0x14d)](_0x39a0f8(0x123)+_0x16a7b2[_0x39a0f8(0x125)]),_0x16a7b2[_0x39a0f8(0x141)]&&console[_0x39a0f8(0x14d)](_0x39a0f8(0x14f)+_0x16a7b2['cause']),0x1;throw _0x16a7b2;}}async[a38_0x10f641(0x121)](_0x53de05,_0x3718c1){const _0x344fda=a38_0x10f641,{options:_0x3f4cec,tdx:_0x9044f1}=_0x3718c1;let _0x4eacbc;try{_0x4eacbc=await resolveYamlFilePath(_0x53de05);}catch(_0x581c39){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x344fda(0x183)+_0x581c39[_0x344fda(0x125)]);}_0x3f4cec[_0x344fda(0x112)]&&console[_0x344fda(0x14d)](_0x344fda(0xff)+_0x4eacbc[_0x344fda(0x100)]+'/'+_0x4eacbc[_0x344fda(0x177)]);const _0x49599b=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x9044f1[_0x344fda(0x181)][_0x344fda(0x162)](_0x4eacbc[_0x344fda(0x16e)],_0x4eacbc[_0x344fda(0x100)],_0x4eacbc[_0x344fda(0x177)]),{'verbose':_0x3f4cec[_0x344fda(0x112)]});return _0x49599b[_0x344fda(0x11c)];}async[a38_0x10f641(0x13c)](_0x311adf,_0x1978bd){const _0x26f4d2=a38_0x10f641,{options:_0x31ef42,tdx:_0x568ee1}=_0x1978bd,_0x11ab96=_0x31ef42['parentSegment'],_0x2bed90=await resolveSegmentTarget(_0x311adf,_0x11ab96,_0x31ef42[_0x26f4d2(0x112)]);_0x31ef42['verbose']&&console[_0x26f4d2(0x14d)](_0x26f4d2(0x19e)+_0x2bed90);const _0x257f25=await withSpinner(_0x26f4d2(0xf8)+_0x311adf+_0x26f4d2(0x131),()=>_0x568ee1[_0x26f4d2(0x181)]['resolvePathToResource'](_0x2bed90),{'verbose':_0x31ef42[_0x26f4d2(0x112)]}),_0x44385c=_0x257f25[_0x26f4d2(0x11c)];_0x31ef42['verbose']&&(console['error'](_0x26f4d2(0x15b)+_0x44385c['type']),console[_0x26f4d2(0x14d)]('Parent\x20ID:\x20'+_0x44385c['parentId']));if(_0x44385c['type']===_0x26f4d2(0x139))throw new SDKError(ErrorCode[_0x26f4d2(0x18e)],_0x26f4d2(0x154));if(_0x44385c[_0x26f4d2(0x10b)]===_0x26f4d2(0x104))throw new SDKError(ErrorCode[_0x26f4d2(0x18e)],_0x26f4d2(0x14e));if(!_0x44385c[_0x26f4d2(0x14a)])throw new SDKError(ErrorCode[_0x26f4d2(0x16b)],_0x26f4d2(0x146));const _0x2e9508=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x568ee1[_0x26f4d2(0x181)][_0x26f4d2(0x170)](_0x44385c[_0x26f4d2(0x14c)],_0x44385c[_0x26f4d2(0x14a)]),{'verbose':_0x31ef42[_0x26f4d2(0x112)]});return _0x2e9508[_0x26f4d2(0x11c)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0x10a);[a38_0x10f641(0xf6)]=a38_0x10f641(0x132);async[a38_0x10f641(0x122)](_0x124cce){const _0x5b6177=a38_0x10f641,{options:_0xc09f2b,args:_0x2a3d53,tdx:_0x43409b}=_0x124cce,_0x5a3245=_0xc09f2b;if(_0x2a3d53[_0x5b6177(0x107)]<0x2)return console[_0x5b6177(0x14d)](_0x5b6177(0x17d)),console[_0x5b6177(0x14d)](_0x5b6177(0x105)),0x1;const _0x4b8073=_0x2a3d53[0x0],_0x112a68=_0x2a3d53[0x1];_0x5a3245['verbose']&&(console['error'](_0x5b6177(0x16c)+_0x5a3245[_0x5b6177(0x174)]),console[_0x5b6177(0x14d)]('Parent\x20segment:\x20'+_0x4b8073),console[_0x5b6177(0x14d)](_0x5b6177(0x191)+_0x112a68));let _0x34c816;if(_0x5a3245['parentFolder']){const _0x218b87=_0x5a3245['parentFolder'],_0x561a4b=await withSpinner(_0x5b6177(0x16a)+_0x4b8073+_0x5b6177(0x131),()=>_0x43409b[_0x5b6177(0x181)][_0x5b6177(0x13f)](_0x4b8073),{'verbose':_0x5a3245[_0x5b6177(0x112)]}),_0x1cf8b8=_0x561a4b[_0x5b6177(0x11c)],_0x47de16=await withSpinner(_0x5b6177(0x159)+_0x218b87+_0x5b6177(0x131),()=>_0x43409b[_0x5b6177(0x181)][_0x5b6177(0x175)](_0x1cf8b8,_0x218b87),{'verbose':_0x5a3245[_0x5b6177(0x112)]});_0x34c816=_0x47de16[_0x5b6177(0x11c)],_0x5a3245[_0x5b6177(0x112)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x34c816);}const _0x502c74={'name':_0x112a68,'description':_0x5a3245[_0x5b6177(0xf6)],'parentFolderId':_0x34c816},_0x4ab3f1=await withSpinner(_0x5b6177(0x133)+_0x112a68+_0x5b6177(0x131),()=>_0x43409b[_0x5b6177(0x181)]['createFolder'](_0x4b8073,_0x502c74),{'verbose':_0x5a3245[_0x5b6177(0x112)]}),_0x24c5fa=_0x4ab3f1[_0x5b6177(0x11c)];return console[_0x5b6177(0x14d)]('✔\x20Created\x20folder\x20\x27'+_0x24c5fa[_0x5b6177(0x148)]+_0x5b6177(0xfd)+_0x24c5fa['id']),await handleSDKOutput([_0x24c5fa],_0x5a3245),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0x164);['description']=a38_0x10f641(0x167);async[a38_0x10f641(0x122)](_0x3616e7){const _0x583a44=a38_0x10f641,{options:_0x119dd9,args:_0x36d010,tdx:_0x4b1149}=_0x3616e7,_0x3560c9=_0x36d010[0x0];if(!_0x3560c9)return console[_0x583a44(0x14d)](_0x583a44(0x129)),console[_0x583a44(0x14d)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x583a44(0x14d)](_0x583a44(0x108)),console[_0x583a44(0x14d)](_0x583a44(0x18c)),console[_0x583a44(0x14d)](_0x583a44(0xfe)),console['error'](_0x583a44(0x172)),console['error'](_0x583a44(0x15c)),console[_0x583a44(0x14d)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x583a44(0x15a)),console[_0x583a44(0x14d)](_0x583a44(0x128)),0x1;try{const _0x51edd7=_0x119dd9[_0x583a44(0x100)],_0x217eda=await resolveSegmentTarget(_0x3560c9,_0x51edd7,_0x119dd9['verbose']);_0x119dd9[_0x583a44(0x112)]&&console['error'](_0x583a44(0x19e)+_0x217eda);const _0x345abb=await withSpinner(_0x583a44(0xf8)+_0x3560c9+'\x27...',()=>_0x4b1149['segment']['resolvePathToResource'](_0x217eda),{'verbose':_0x119dd9[_0x583a44(0x112)]}),_0x13a85b=_0x345abb[_0x583a44(0x11c)];_0x119dd9[_0x583a44(0x112)]&&(console[_0x583a44(0x14d)](_0x583a44(0x15b)+_0x13a85b[_0x583a44(0x10b)]),console[_0x583a44(0x14d)](_0x583a44(0x124)+_0x13a85b['parentId']),_0x13a85b['folderId']&&console[_0x583a44(0x14d)](_0x583a44(0x13a)+_0x13a85b[_0x583a44(0x19d)]),_0x13a85b['segmentId']&&console['error'](_0x583a44(0x119)+_0x13a85b[_0x583a44(0x14a)]));if(_0x119dd9[_0x583a44(0x101)]){if(_0x13a85b[_0x583a44(0x10b)]===_0x583a44(0x139))return console[_0x583a44(0x14d)](_0x583a44(0x10f)),0x1;if(_0x13a85b['type']===_0x583a44(0x104))return console['error'](_0x583a44(0x19c)),console[_0x583a44(0x14d)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x13a85b[_0x583a44(0x14a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x583a44(0x146));const _0x2003d0=getConsoleNextUrl(_0x119dd9[_0x583a44(0x174)],_0x583a44(0x156)+_0x13a85b['parentId']+_0x583a44(0x134)+_0x13a85b[_0x583a44(0x14a)]);return console[_0x583a44(0x14d)](a38_0x51ca9a[_0x583a44(0x18f)]('✔')+_0x583a44(0x152)+a38_0x51ca9a[_0x583a44(0x10e)](_0x2003d0)),openBrowser(_0x2003d0),0x0;}if(_0x13a85b[_0x583a44(0x10b)]==='folder'){if(!_0x13a85b[_0x583a44(0x19d)])throw new SDKError(ErrorCode[_0x583a44(0x16f)],_0x583a44(0x158));const _0xe2585=await withSpinner(_0x583a44(0x17f),()=>_0x4b1149[_0x583a44(0x181)]['getFolder'](_0x13a85b['folderId']),{'verbose':_0x119dd9['verbose']});await handleSingleObjectOutput(_0xe2585[_0x583a44(0x11c)],_0x119dd9);}else{if(_0x13a85b['type']==='segment'){if(!_0x13a85b[_0x583a44(0x14a)])throw new SDKError(ErrorCode[_0x583a44(0x16b)],_0x583a44(0x146));const _0x584102=await withSpinner(_0x583a44(0x199),()=>_0x4b1149[_0x583a44(0x181)]['getSegment'](_0x13a85b[_0x583a44(0x14c)],_0x13a85b[_0x583a44(0x14a)]),{'verbose':_0x119dd9[_0x583a44(0x112)]}),_0x358185=getConsoleNextUrl(_0x119dd9[_0x583a44(0x174)],_0x583a44(0x156)+_0x13a85b[_0x583a44(0x14c)]+_0x583a44(0x134)+_0x13a85b[_0x583a44(0x14a)]),_0x261437=_0x584102[_0x583a44(0x11c)];_0x261437[_0x583a44(0x163)]=_0x358185,await handleSingleObjectOutput(_0x261437,_0x119dd9);}else return console[_0x583a44(0x14d)](_0x583a44(0x111)),console[_0x583a44(0x14d)](_0x583a44(0x155)),0x1;}return 0x0;}catch(_0x4b35df){if(_0x4b35df instanceof SDKError)return console[_0x583a44(0x14d)](_0x583a44(0x123)+_0x4b35df[_0x583a44(0x125)]),_0x4b35df[_0x583a44(0x141)]&&console[_0x583a44(0x14d)](_0x583a44(0x14f)+_0x4b35df[_0x583a44(0x141)]),0x1;throw _0x4b35df;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x10f641(0x148)]=a38_0x10f641(0x192);[a38_0x10f641(0xf6)]=a38_0x10f641(0x12a);async[a38_0x10f641(0x122)](_0x4c2704){const _0xa90e87=a38_0x10f641,{options:_0x1b87a7,args:_0x2a7889,tdx:_0xc6d803}=_0x4c2704,_0x55100e=_0x2a7889[0x0];if(!_0x55100e)return console[_0xa90e87(0x14d)](_0xa90e87(0x17c)),console[_0xa90e87(0x14d)](_0xa90e87(0xfc)),console['error'](_0xa90e87(0x16d)),console['error'](_0xa90e87(0x172)),console[_0xa90e87(0x14d)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0xa90e87(0x14d)](_0xa90e87(0x130)),0x1;try{const _0x5c4fc6=_0x1b87a7[_0xa90e87(0x100)],_0x163e5a=await resolveSegmentTarget(_0x55100e,_0x5c4fc6,_0x1b87a7[_0xa90e87(0x112)]);_0x1b87a7[_0xa90e87(0x112)]&&console[_0xa90e87(0x14d)](_0xa90e87(0x19e)+_0x163e5a);const _0x3adbcd=await withSpinner(_0xa90e87(0xf8)+_0x55100e+_0xa90e87(0x131),()=>_0xc6d803[_0xa90e87(0x181)][_0xa90e87(0x195)](_0x163e5a),{'verbose':_0x1b87a7[_0xa90e87(0x112)]}),_0x119a3e=_0x3adbcd[_0xa90e87(0x11c)];_0x1b87a7[_0xa90e87(0x112)]&&(console[_0xa90e87(0x14d)](_0xa90e87(0x15b)+_0x119a3e[_0xa90e87(0x10b)]),console[_0xa90e87(0x14d)]('Parent\x20ID:\x20'+_0x119a3e['parentId']));if(_0x119a3e[_0xa90e87(0x10b)]===_0xa90e87(0x139))return console['error'](_0xa90e87(0x12d)),console[_0xa90e87(0x14d)](_0xa90e87(0x117)),0x1;if(_0x119a3e[_0xa90e87(0x10b)]===_0xa90e87(0x104))return console[_0xa90e87(0x14d)](_0xa90e87(0x193)),console[_0xa90e87(0x14d)](_0xa90e87(0x11e)),0x1;if(!_0x119a3e[_0xa90e87(0x14a)])throw new SDKError(ErrorCode[_0xa90e87(0x16b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x211a76=await withSpinner(_0xa90e87(0x11f),()=>_0xc6d803[_0xa90e87(0x181)]['getSegmentSQL'](_0x119a3e[_0xa90e87(0x14c)],_0x119a3e[_0xa90e87(0x14a)]),{'verbose':_0x1b87a7[_0xa90e87(0x112)]}),_0x135461=_0x211a76[_0xa90e87(0x11c)],_0x3efb66=await executeSchemaQuery(_0x135461,_0xc6d803,_0x1b87a7);return await handleQueryOutput(_0x3efb66,_0x1b87a7),0x0;}catch(_0x1e0dc5){if(_0x1e0dc5 instanceof SDKError)return console['error'](_0xa90e87(0x123)+_0x1e0dc5[_0xa90e87(0x125)]),_0x1e0dc5['cause']&&console[_0xa90e87(0x14d)]('\x20\x20Cause:\x20'+_0x1e0dc5[_0xa90e87(0x141)]),0x1;throw _0x1e0dc5;}}}
|
|
1
|
+
const a38_0x51a13b=a38_0x383b;(function(_0x10d410,_0x4bfe61){const _0x3a0439=a38_0x383b,_0x4f43fb=_0x10d410();while(!![]){try{const _0x5c683b=parseInt(_0x3a0439(0xdf))/0x1*(-parseInt(_0x3a0439(0x140))/0x2)+-parseInt(_0x3a0439(0x12e))/0x3+parseInt(_0x3a0439(0x10c))/0x4*(parseInt(_0x3a0439(0xbf))/0x5)+parseInt(_0x3a0439(0xfe))/0x6*(-parseInt(_0x3a0439(0x126))/0x7)+parseInt(_0x3a0439(0xc1))/0x8*(-parseInt(_0x3a0439(0xd9))/0x9)+parseInt(_0x3a0439(0xf7))/0xa+parseInt(_0x3a0439(0xe7))/0xb;if(_0x5c683b===_0x4bfe61)break;else _0x4f43fb['push'](_0x4f43fb['shift']());}catch(_0x2fd216){_0x4f43fb['push'](_0x4f43fb['shift']());}}}(a38_0x4863,0x823d1));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';function a38_0x383b(_0x3075d7,_0x191b6f){_0x3075d7=_0x3075d7-0xae;const _0x4863b8=a38_0x4863();let _0x383be3=_0x4863b8[_0x3075d7];return _0x383be3;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x138c10 from'chalk';async function resolveSegmentTarget(_0x2c5fca,_0x18b936,_0x1178ed){const _0xaad752=a38_0x383b;if(isYamlFilePath(_0x2c5fca))try{const _0x24bdd6=await resolveYamlFilePath(_0x2c5fca);return _0x1178ed&&(console[_0xaad752(0x12f)](_0xaad752(0x145)+_0x2c5fca),console[_0xaad752(0x12f)](_0xaad752(0x130)+_0x24bdd6[_0xaad752(0xc6)]),console['error'](_0xaad752(0x12c)+_0x24bdd6[_0xaad752(0xc4)]),console['error'](_0xaad752(0xdd)+(_0x24bdd6[_0xaad752(0xd7)]||'(root)')),console[_0xaad752(0x12f)](_0xaad752(0x112)+_0x24bdd6[_0xaad752(0xd8)])),_0x24bdd6[_0xaad752(0xd8)];}catch(_0x5173ce){throw new SDKError(ErrorCode[_0xaad752(0xd4)],_0xaad752(0xae)+_0x5173ce[_0xaad752(0xc3)]);}if(!_0x18b936)throw new SDKError(ErrorCode[_0xaad752(0xd4)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x18b936+'/'+_0x2c5fca;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x51a13b(0x12b);['description']=a38_0x51a13b(0xc2);async['execute'](_0x952fb8){const _0x3bb768=a38_0x51a13b,{options:_0x1a3e48,args:_0x5ac029,tdx:_0x4de324}=_0x952fb8,_0x1921dd=_0x5ac029[0x0],_0x2ec782=!_0x1921dd&&!!_0x1a3e48[_0x3bb768(0xc6)],_0x3c0df8=_0x1921dd||_0x1a3e48['parentSegment'];if(!_0x3c0df8)return console['error'](_0x3bb768(0xf5)),console['error'](_0x3bb768(0xde)),console[_0x3bb768(0x12f)]('Examples:'),console[_0x3bb768(0x12f)](_0x3bb768(0xeb)),console['error'](_0x3bb768(0xdc)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x153a82=_0x1a3e48[_0x3bb768(0xb1)];let _0x1ff66d=_0x3c0df8;!_0x2ec782&&_0x153a82&&!_0x3c0df8[_0x3bb768(0x128)]('/')&&(_0x1ff66d=_0x153a82+'/'+_0x3c0df8,_0x1a3e48[_0x3bb768(0xdb)]&&console[_0x3bb768(0x12f)](_0x3bb768(0xc9)+_0x1ff66d));const _0xbd0a68=await withSpinner('Resolving\x20path\x20\x27'+_0x1ff66d+_0x3bb768(0x14c),()=>_0x4de324['segment'][_0x3bb768(0xd2)](_0x1ff66d),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]}),_0xd7b46b=_0xbd0a68['data'];_0x1a3e48[_0x3bb768(0xdb)]&&(console[_0x3bb768(0x12f)]('Resolved\x20type:\x20'+_0xd7b46b['type']),console[_0x3bb768(0x12f)](_0x3bb768(0xc0)+_0xd7b46b['parentId']),_0xd7b46b[_0x3bb768(0x13f)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x14f)+_0xd7b46b[_0x3bb768(0x13f)]),_0xd7b46b[_0x3bb768(0x10d)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x109)+_0xd7b46b[_0x3bb768(0x10d)]));if(_0xd7b46b['type']==='parent'){const _0x2a82ec=await withSpinner(_0x3bb768(0xec),()=>_0x4de324['segment'][_0x3bb768(0xed)](_0xd7b46b[_0x3bb768(0x150)]),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]});await handleSingleObjectOutput(_0x2a82ec[_0x3bb768(0x100)],_0x1a3e48);}else{if(_0xd7b46b['type']===_0x3bb768(0x14e)){if(!_0xd7b46b[_0x3bb768(0x13f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3bb768(0x117));const _0x1975c3=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4de324[_0x3bb768(0x144)][_0x3bb768(0xea)](_0xd7b46b[_0x3bb768(0x13f)]),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]});await handleSingleObjectOutput(_0x1975c3[_0x3bb768(0x100)],_0x1a3e48);}else{if(_0xd7b46b['type']===_0x3bb768(0x144)){if(!_0xd7b46b[_0x3bb768(0x10d)])throw new SDKError(ErrorCode[_0x3bb768(0xb5)],_0x3bb768(0x11c));const _0xd14d5a=await withSpinner(_0x3bb768(0x138),()=>_0x4de324[_0x3bb768(0x144)][_0x3bb768(0xe1)](_0xd7b46b['parentId'],_0xd7b46b['segmentId']),{'verbose':_0x1a3e48['verbose']});await handleSingleObjectOutput(_0xd14d5a['data'],_0x1a3e48);}}}return 0x0;}catch(_0x2a2a23){if(_0x2a2a23 instanceof SDKError)return console['error'](_0x3bb768(0xb6)+_0x2a2a23[_0x3bb768(0xc3)]),_0x2a2a23[_0x3bb768(0x104)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x11e)+_0x2a2a23[_0x3bb768(0x104)]),0x1;throw _0x2a2a23;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x13e);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xb7);async['execute'](_0x52ef75){const _0x7290ff=a38_0x51a13b,{options:_0x3f8300,args:_0x55ee73,tdx:_0x48a355}=_0x52ef75,_0x40e29c=_0x55ee73[0x0];if(!_0x40e29c)return console[_0x7290ff(0x12f)](_0x7290ff(0xca)),console['error'](_0x7290ff(0xd0)),console[_0x7290ff(0x12f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x7290ff(0x12f)](_0x7290ff(0x106)),console[_0x7290ff(0x12f)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x7290ff(0x12f)](_0x7290ff(0x14b)),0x1;try{const _0x1ff7c1=_0x3f8300[_0x7290ff(0xc6)],_0x5e14c8=await resolveSegmentTarget(_0x40e29c,_0x1ff7c1,_0x3f8300['verbose']);_0x3f8300['verbose']&&console[_0x7290ff(0x12f)]('Target\x20path:\x20'+_0x5e14c8);const _0x2721bb=await withSpinner(_0x7290ff(0x13c)+_0x40e29c+_0x7290ff(0x14c),()=>_0x48a355[_0x7290ff(0x144)][_0x7290ff(0xd2)](_0x5e14c8),{'verbose':_0x3f8300[_0x7290ff(0xdb)]}),_0x59ebdd=_0x2721bb[_0x7290ff(0x100)];_0x3f8300[_0x7290ff(0xdb)]&&(console[_0x7290ff(0x12f)]('Resolved\x20type:\x20'+_0x59ebdd['type']),console[_0x7290ff(0x12f)]('Parent\x20ID:\x20'+_0x59ebdd['parentId']));if(_0x59ebdd[_0x7290ff(0xf6)]===_0x7290ff(0x14e))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x59ebdd[_0x7290ff(0xf6)]===_0x7290ff(0x107))return console[_0x7290ff(0x12f)](_0x7290ff(0x122)),console[_0x7290ff(0x12f)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x59ebdd[_0x7290ff(0x10d)])throw new SDKError(ErrorCode[_0x7290ff(0xb5)],_0x7290ff(0x11c));const _0x4bbfe1=await withSpinner(_0x7290ff(0xee),()=>_0x48a355[_0x7290ff(0x144)][_0x7290ff(0xce)](_0x59ebdd['parentId'],_0x59ebdd[_0x7290ff(0x10d)]),{'verbose':_0x3f8300[_0x7290ff(0xdb)]});let _0x53b981=_0x4bbfe1[_0x7290ff(0x100)];const _0x4f8175=resolveLimit(_0x3f8300[_0x7290ff(0xba)],DEFAULT_DISPLAY_LIMIT),_0x2657cf=/\bLIMIT\s+\d+/i[_0x7290ff(0xf3)](_0x53b981);!_0x2657cf&&(_0x53b981=_0x53b981[_0x7290ff(0x132)]()[_0x7290ff(0x105)](/;+$/,''),_0x53b981='SELECT\x20*\x20FROM\x20(\x0a'+_0x53b981+_0x7290ff(0x11f)+_0x4f8175);_0x3f8300[_0x7290ff(0xdb)]&&console[_0x7290ff(0x12f)](_0x7290ff(0xe3)+_0x53b981);const _0x32ab4b=await withProgressSpinner('Executing\x20segment\x20query...',async _0x357d55=>{const _0x14d8d4=_0x7290ff,_0x5b22a3=await _0x48a355[_0x14d8d4(0x11b)][_0x14d8d4(0xe2)](_0x53b981,{'catalog':'td','schema':_0x14d8d4(0xe6),'onJobId':_0x5d63a6=>{_0x357d55['setJobId'](_0x5d63a6);}});return _0x5b22a3;},{'verbose':_0x3f8300[_0x7290ff(0xdb)]}),_0x23b4ae=_0x32ab4b['data'],_0x408f34=_0x23b4ae[_0x7290ff(0x131)]?'\x20[Job\x20ID:\x20'+_0x23b4ae[_0x7290ff(0x131)]+']':'';return console[_0x7290ff(0x12f)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x23b4ae[_0x7290ff(0xf0)][_0x7290ff(0x142)][_0x7290ff(0x115)]()+'\x20rows\x20'+(_0x7290ff(0x111)+formatElapsed(_0x23b4ae[_0x7290ff(0xf0)][_0x7290ff(0xef)])+_0x408f34)),await handleQueryOutput(_0x23b4ae,_0x3f8300),0x0;}catch(_0xc54510){if(_0xc54510 instanceof SDKError)return console['error'](_0x7290ff(0x146)+_0xc54510[_0x7290ff(0xff)]+']'),console[_0x7290ff(0x12f)]('\x0a'+_0xc54510[_0x7290ff(0xc3)]),0x1;throw _0xc54510;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x51a13b(0xfa)]='segment:folder:list';[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xbc);async[a38_0x51a13b(0xe2)](_0x5d9545){const _0x5c4e51=a38_0x51a13b,{options:_0x2526ab,args:_0x1c5d70,tdx:_0x34a6f8}=_0x5d9545;if(_0x1c5d70[_0x5c4e51(0x110)]===0x0)return console[_0x5c4e51(0x12f)](_0x5c4e51(0x12a)),console[_0x5c4e51(0x12f)](_0x5c4e51(0xcd)),0x1;const _0xce8d3=_0x1c5d70[0x0];try{_0x2526ab[_0x5c4e51(0xdb)]&&(console[_0x5c4e51(0x12f)](_0x5c4e51(0x101)+_0x2526ab[_0x5c4e51(0x119)]),console[_0x5c4e51(0x12f)]('Parent\x20name:\x20'+_0xce8d3));const _0x514d0a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xce8d3+_0x5c4e51(0x14c),()=>_0x34a6f8['segment'][_0x5c4e51(0x136)](_0xce8d3),{'verbose':_0x2526ab[_0x5c4e51(0xdb)]}),_0x1857ff=_0x514d0a[_0x5c4e51(0x100)];_0x2526ab[_0x5c4e51(0xdb)]&&console[_0x5c4e51(0x12f)]('Resolved\x20parent\x20ID:\x20'+_0x1857ff);const _0x132b74=await withSpinner(_0x5c4e51(0xc7)+_0xce8d3+_0x5c4e51(0x14c),()=>_0x34a6f8[_0x5c4e51(0x144)][_0x5c4e51(0x152)](_0x1857ff),{'verbose':_0x2526ab[_0x5c4e51(0xdb)]}),_0x4af379=_0x132b74[_0x5c4e51(0x100)];return console[_0x5c4e51(0x12f)](_0x5c4e51(0x125)+_0x4af379['length']+'\x20folder'+(_0x4af379['length']!==0x1?'s':'')),await handleSDKOutput(_0x4af379,_0x2526ab),0x0;}catch(_0x5b8aef){if(_0x5b8aef instanceof SDKError)return console['error'](_0x5c4e51(0xb6)+_0x5b8aef[_0x5c4e51(0xc3)]),_0x5b8aef[_0x5c4e51(0x104)]&&console[_0x5c4e51(0x12f)]('\x20\x20Cause:\x20'+_0x5b8aef[_0x5c4e51(0x104)]),0x1;throw _0x5b8aef;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x10b);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xf2);async['execute'](_0x3f351f){const _0x37481=a38_0x51a13b,{options:_0x4c181d,args:_0x55c03f,tdx:_0x1ccc20}=_0x3f351f;if(_0x55c03f['length']===0x0)return console[_0x37481(0x12f)](_0x37481(0xb8)),console[_0x37481(0x12f)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x5f0762,childId:_0x393482}=parseSegmentRef(_0x55c03f[0x0]);_0x4c181d['verbose']&&(console[_0x37481(0x12f)]('Site:\x20'+_0x4c181d['site']),console[_0x37481(0x12f)](_0x37481(0xaf)+_0x5f0762),_0x393482&&console['error'](_0x37481(0x116)+_0x393482));if(!_0x393482)return console[_0x37481(0x12f)](_0x37481(0x121)),0x1;const _0x49da91=await withSpinner(_0x37481(0xe4)+_0x5f0762+_0x37481(0x14c),()=>_0x1ccc20[_0x37481(0x144)]['resolveParentId'](_0x5f0762),{'verbose':_0x4c181d[_0x37481(0xdb)]}),_0x239072=_0x49da91['data'];_0x4c181d[_0x37481(0xdb)]&&console[_0x37481(0x12f)]('Resolved\x20parent\x20ID:\x20'+_0x239072);const _0x133dd2=await withSpinner(_0x37481(0x120)+_0x393482+_0x37481(0x14c),()=>_0x1ccc20['segment'][_0x37481(0x133)](_0x239072,_0x393482),{'verbose':_0x4c181d[_0x37481(0xdb)]}),_0x464a3a=_0x133dd2[_0x37481(0x100)];_0x4c181d[_0x37481(0xdb)]&&console[_0x37481(0x12f)](_0x37481(0x123)+_0x464a3a);const _0x406a4f=await withSpinner(_0x37481(0xfd)+_0x393482+_0x37481(0x14c),()=>_0x1ccc20[_0x37481(0x144)]['getFolder'](_0x464a3a),{'verbose':_0x4c181d[_0x37481(0xdb)]});return await handleSDKOutput([_0x406a4f['data']],_0x4c181d),0x0;}catch(_0x3bb6e0){if(_0x3bb6e0 instanceof SDKError)return console[_0x37481(0x12f)](_0x37481(0xb6)+_0x3bb6e0[_0x37481(0xc3)]),_0x3bb6e0[_0x37481(0x104)]&&console['error'](_0x37481(0x11e)+_0x3bb6e0[_0x37481(0x104)]),0x1;throw _0x3bb6e0;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a38_0x51a13b(0x143);['description']=a38_0x51a13b(0xb3);async[a38_0x51a13b(0xe2)](_0x2c6446){const _0x38dc1b=a38_0x51a13b,{options:_0x2bd79a,args:_0x41bfb0}=_0x2c6446,_0x291664=_0x2bd79a,_0xa7b8c2=_0x291664[_0x38dc1b(0xe8)],_0x2c0173=_0x41bfb0[0x0];if(!_0x2c0173&&!_0xa7b8c2)return console['error'](a38_0x138c10[_0x38dc1b(0x137)](_0x38dc1b(0xd1))),console[_0x38dc1b(0x12f)](_0x38dc1b(0x108)),console['error'](_0x38dc1b(0xe0)),console[_0x38dc1b(0x12f)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x38dc1b(0x106)),console['error'](_0x38dc1b(0x135)),console[_0x38dc1b(0x12f)](_0x38dc1b(0x10e)),0x1;if(_0x2c0173&&_0xa7b8c2)return console['error'](a38_0x138c10['red'](_0x38dc1b(0x134))),0x1;try{let _0x47d49e;if(_0xa7b8c2)_0x47d49e=await this[_0x38dc1b(0xbd)](_0xa7b8c2,_0x2c6446);else{if(isYamlFilePath(_0x2c0173))return console[_0x38dc1b(0x12f)](a38_0x138c10[_0x38dc1b(0x137)](_0x38dc1b(0x10a))),console[_0x38dc1b(0x12f)](_0x38dc1b(0xcb)+_0x2c0173),0x1;else _0x47d49e=await this['getSQLFromServerSegment'](_0x2c0173,_0x2c6446);}return _0x2bd79a['format']===_0x38dc1b(0x102)||_0x2bd79a[_0x38dc1b(0xf1)]===_0x38dc1b(0xf9)?await handleSDKOutput([{'sql':_0x47d49e}],_0x2bd79a):console['log'](_0x47d49e),0x0;}catch(_0x259b28){if(_0x259b28 instanceof SDKError)return console[_0x38dc1b(0x12f)](_0x38dc1b(0xb6)+_0x259b28['message']),_0x259b28[_0x38dc1b(0x104)]&&console[_0x38dc1b(0x12f)](_0x38dc1b(0x11e)+_0x259b28[_0x38dc1b(0x104)]),0x1;throw _0x259b28;}}async[a38_0x51a13b(0xbd)](_0x662625,_0x17ad67){const _0x1d994c=a38_0x51a13b,{options:_0x19db42,tdx:_0x587533}=_0x17ad67;let _0x2f82f5;try{_0x2f82f5=await resolveYamlFilePath(_0x662625);}catch(_0x5d96e5){throw new SDKError(ErrorCode[_0x1d994c(0xd4)],_0x1d994c(0xae)+_0x5d96e5[_0x1d994c(0xc3)]);}_0x19db42[_0x1d994c(0xdb)]&&console[_0x1d994c(0x12f)](_0x1d994c(0xc8)+_0x2f82f5[_0x1d994c(0xc6)]+'/'+_0x2f82f5[_0x1d994c(0xc4)]);const _0x3ad959=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x587533[_0x1d994c(0x144)]['getSegmentSQLFromYaml'](_0x2f82f5[_0x1d994c(0x11a)],_0x2f82f5[_0x1d994c(0xc6)],_0x2f82f5[_0x1d994c(0xc4)]),{'verbose':_0x19db42[_0x1d994c(0xdb)]});return _0x3ad959[_0x1d994c(0x100)];}async['getSQLFromServerSegment'](_0x558038,_0x1ffd68){const _0x26465a=a38_0x51a13b,{options:_0x5f1ee2,tdx:_0xe59c7c}=_0x1ffd68,_0x71bbcc=_0x5f1ee2[_0x26465a(0xc6)],_0x27b325=await resolveSegmentTarget(_0x558038,_0x71bbcc,_0x5f1ee2['verbose']);_0x5f1ee2[_0x26465a(0xdb)]&&console['error']('Target\x20path:\x20'+_0x27b325);const _0x471c8f=await withSpinner(_0x26465a(0x13c)+_0x558038+'\x27...',()=>_0xe59c7c[_0x26465a(0x144)][_0x26465a(0xd2)](_0x27b325),{'verbose':_0x5f1ee2[_0x26465a(0xdb)]}),_0x46a2a5=_0x471c8f[_0x26465a(0x100)];_0x5f1ee2[_0x26465a(0xdb)]&&(console['error'](_0x26465a(0x139)+_0x46a2a5[_0x26465a(0xf6)]),console['error'](_0x26465a(0xc0)+_0x46a2a5[_0x26465a(0x150)]));if(_0x46a2a5[_0x26465a(0xf6)]===_0x26465a(0x14e))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x26465a(0xcc));if(_0x46a2a5[_0x26465a(0xf6)]===_0x26465a(0x107))throw new SDKError(ErrorCode[_0x26465a(0xd4)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x46a2a5[_0x26465a(0x10d)])throw new SDKError(ErrorCode[_0x26465a(0xb5)],_0x26465a(0x11c));const _0x302ab9=await withSpinner(_0x26465a(0xee),()=>_0xe59c7c['segment'][_0x26465a(0xce)](_0x46a2a5[_0x26465a(0x150)],_0x46a2a5[_0x26465a(0x10d)]),{'verbose':_0x5f1ee2['verbose']});return _0x302ab9[_0x26465a(0x100)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a38_0x51a13b(0x14d);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0x149);async[a38_0x51a13b(0xe2)](_0x4e9004){const _0x5c2148=a38_0x51a13b,{options:_0x3e6365,args:_0xf443f5,tdx:_0x56a986}=_0x4e9004,_0x1b10cd=_0x3e6365;if(_0xf443f5[_0x5c2148(0x110)]<0x2)return console[_0x5c2148(0x12f)](_0x5c2148(0x10f)),console[_0x5c2148(0x12f)](_0x5c2148(0x124)),0x1;const _0x152251=_0xf443f5[0x0],_0x21c613=_0xf443f5[0x1];_0x1b10cd[_0x5c2148(0xdb)]&&(console['error'](_0x5c2148(0x101)+_0x1b10cd[_0x5c2148(0x119)]),console[_0x5c2148(0x12f)](_0x5c2148(0xb9)+_0x152251),console[_0x5c2148(0x12f)](_0x5c2148(0x116)+_0x21c613));let _0xb08e2d;if(_0x1b10cd[_0x5c2148(0x151)]){const _0x33b468=_0x1b10cd[_0x5c2148(0x151)],_0x4d8959=await withSpinner(_0x5c2148(0xe4)+_0x152251+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0x136)](_0x152251),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]}),_0x4ad45f=_0x4d8959[_0x5c2148(0x100)],_0x3a61cc=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x33b468+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0x133)](_0x4ad45f,_0x33b468),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]});_0xb08e2d=_0x3a61cc[_0x5c2148(0x100)],_0x1b10cd[_0x5c2148(0xdb)]&&console[_0x5c2148(0x12f)](_0x5c2148(0xbb)+_0xb08e2d);}const _0x4fe86c={'name':_0x21c613,'description':_0x1b10cd[_0x5c2148(0xbe)],'parentFolderId':_0xb08e2d},_0x21f302=await withSpinner(_0x5c2148(0xf8)+_0x21c613+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0xc5)](_0x152251,_0x4fe86c),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]}),_0x3478f7=_0x21f302[_0x5c2148(0x100)];return console[_0x5c2148(0x12f)](_0x5c2148(0x13d)+_0x3478f7[_0x5c2148(0xfa)]+'\x27\x20with\x20ID:\x20'+_0x3478f7['id']),await handleSDKOutput([_0x3478f7],_0x1b10cd),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x113);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0x147);async[a38_0x51a13b(0xe2)](_0x13d531){const _0x48ed18=a38_0x51a13b,{options:_0x1a998e,args:_0x41fedb,tdx:_0x187555}=_0x13d531,_0x4ab0f2=_0x41fedb[0x0];if(!_0x4ab0f2)return console[_0x48ed18(0x12f)](_0x48ed18(0x141)),console[_0x48ed18(0x12f)](_0x48ed18(0xb4)),console[_0x48ed18(0x12f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x48ed18(0x12f)](_0x48ed18(0x12d)),console[_0x48ed18(0x12f)](_0x48ed18(0xe5)),console[_0x48ed18(0x12f)](_0x48ed18(0x106)),console['error'](_0x48ed18(0x11d)),console['error'](_0x48ed18(0x14a)),console[_0x48ed18(0x12f)](_0x48ed18(0xd6)),console[_0x48ed18(0x12f)](_0x48ed18(0x129)),0x1;try{const _0x79303e=_0x1a998e[_0x48ed18(0xc6)],_0x53bf13=await resolveSegmentTarget(_0x4ab0f2,_0x79303e,_0x1a998e['verbose']);_0x1a998e[_0x48ed18(0xdb)]&&console['error'](_0x48ed18(0x127)+_0x53bf13);const _0x15ec83=await withSpinner('Resolving\x20\x27'+_0x4ab0f2+_0x48ed18(0x14c),()=>_0x187555[_0x48ed18(0x144)]['resolvePathToResource'](_0x53bf13),{'verbose':_0x1a998e['verbose']}),_0x10d309=_0x15ec83[_0x48ed18(0x100)];_0x1a998e[_0x48ed18(0xdb)]&&(console[_0x48ed18(0x12f)](_0x48ed18(0x139)+_0x10d309[_0x48ed18(0xf6)]),console[_0x48ed18(0x12f)](_0x48ed18(0xc0)+_0x10d309[_0x48ed18(0x150)]),_0x10d309[_0x48ed18(0x13f)]&&console[_0x48ed18(0x12f)]('Folder\x20ID:\x20'+_0x10d309[_0x48ed18(0x13f)]),_0x10d309[_0x48ed18(0x10d)]&&console[_0x48ed18(0x12f)](_0x48ed18(0x109)+_0x10d309[_0x48ed18(0x10d)]));if(_0x1a998e['web']){if(_0x10d309[_0x48ed18(0xf6)]===_0x48ed18(0x14e))return console[_0x48ed18(0x12f)](_0x48ed18(0xd5)),0x1;if(_0x10d309[_0x48ed18(0xf6)]===_0x48ed18(0x107))return console[_0x48ed18(0x12f)](_0x48ed18(0x114)),console[_0x48ed18(0x12f)](_0x48ed18(0x103)),0x1;if(!_0x10d309[_0x48ed18(0x10d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x48ed18(0x11c));const _0x53458b=getConsoleNextUrl(_0x1a998e['site'],_0x48ed18(0xfc)+_0x10d309[_0x48ed18(0x150)]+_0x48ed18(0xda)+_0x10d309[_0x48ed18(0x10d)]);return console[_0x48ed18(0x12f)](a38_0x138c10[_0x48ed18(0xf4)]('✔')+_0x48ed18(0xfb)+a38_0x138c10[_0x48ed18(0x148)](_0x53458b)),openBrowser(_0x53458b),0x0;}if(_0x10d309['type']===_0x48ed18(0x14e)){if(!_0x10d309[_0x48ed18(0x13f)])throw new SDKError(ErrorCode[_0x48ed18(0x13b)],_0x48ed18(0x117));const _0x4f0fdf=await withSpinner('Fetching\x20folder\x20details...',()=>_0x187555[_0x48ed18(0x144)][_0x48ed18(0xea)](_0x10d309['folderId']),{'verbose':_0x1a998e[_0x48ed18(0xdb)]});await handleSingleObjectOutput(_0x4f0fdf[_0x48ed18(0x100)],_0x1a998e);}else{if(_0x10d309['type']==='segment'){if(!_0x10d309[_0x48ed18(0x10d)])throw new SDKError(ErrorCode[_0x48ed18(0xb5)],_0x48ed18(0x11c));const _0xbdb155=await withSpinner(_0x48ed18(0x138),()=>_0x187555['segment']['getSegment'](_0x10d309[_0x48ed18(0x150)],_0x10d309['segmentId']),{'verbose':_0x1a998e[_0x48ed18(0xdb)]}),_0x447e1c=getConsoleNextUrl(_0x1a998e['site'],_0x48ed18(0xfc)+_0x10d309[_0x48ed18(0x150)]+_0x48ed18(0xda)+_0x10d309['segmentId']),_0x49a727=_0xbdb155[_0x48ed18(0x100)];_0x49a727[_0x48ed18(0xb2)]=_0x447e1c,await handleSingleObjectOutput(_0x49a727,_0x1a998e);}else return console['error'](_0x48ed18(0xd3)),console[_0x48ed18(0x12f)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x1219b0){if(_0x1219b0 instanceof SDKError)return console['error'](_0x48ed18(0xb6)+_0x1219b0[_0x48ed18(0xc3)]),_0x1219b0[_0x48ed18(0x104)]&&console[_0x48ed18(0x12f)](_0x48ed18(0x11e)+_0x1219b0[_0x48ed18(0x104)]),0x1;throw _0x1219b0;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x51a13b(0xfa)]='segment:desc';[a38_0x51a13b(0xbe)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x540ea8){const _0x149a5b=a38_0x51a13b,{options:_0x45426e,args:_0x108887,tdx:_0x3dc178}=_0x540ea8,_0x369f3c=_0x108887[0x0];if(!_0x369f3c)return console[_0x149a5b(0x12f)](_0x149a5b(0xca)),console[_0x149a5b(0x12f)](_0x149a5b(0x118)),console[_0x149a5b(0x12f)](_0x149a5b(0xcf)),console[_0x149a5b(0x12f)](_0x149a5b(0x106)),console[_0x149a5b(0x12f)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error'](_0x149a5b(0xb0)),0x1;try{const _0x2b22d2=_0x45426e[_0x149a5b(0xc6)],_0x10dce9=await resolveSegmentTarget(_0x369f3c,_0x2b22d2,_0x45426e[_0x149a5b(0xdb)]);_0x45426e[_0x149a5b(0xdb)]&&console[_0x149a5b(0x12f)]('Target\x20path:\x20'+_0x10dce9);const _0x19378f=await withSpinner(_0x149a5b(0x13c)+_0x369f3c+_0x149a5b(0x14c),()=>_0x3dc178[_0x149a5b(0x144)][_0x149a5b(0xd2)](_0x10dce9),{'verbose':_0x45426e[_0x149a5b(0xdb)]}),_0x14ddd2=_0x19378f[_0x149a5b(0x100)];_0x45426e[_0x149a5b(0xdb)]&&(console['error'](_0x149a5b(0x139)+_0x14ddd2[_0x149a5b(0xf6)]),console[_0x149a5b(0x12f)](_0x149a5b(0xc0)+_0x14ddd2['parentId']));if(_0x14ddd2[_0x149a5b(0xf6)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x149a5b(0x12f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x14ddd2['type']===_0x149a5b(0x107))return console[_0x149a5b(0x12f)](_0x149a5b(0xe9)),console[_0x149a5b(0x12f)](_0x149a5b(0x13a)),0x1;if(!_0x14ddd2[_0x149a5b(0x10d)])throw new SDKError(ErrorCode[_0x149a5b(0xb5)],_0x149a5b(0x11c));const _0x113c1c=await withSpinner(_0x149a5b(0xee),()=>_0x3dc178[_0x149a5b(0x144)]['getSegmentSQL'](_0x14ddd2[_0x149a5b(0x150)],_0x14ddd2[_0x149a5b(0x10d)]),{'verbose':_0x45426e[_0x149a5b(0xdb)]}),_0x3bab10=_0x113c1c[_0x149a5b(0x100)],_0x359d83=await executeSchemaQuery(_0x3bab10,_0x3dc178,_0x45426e);return await handleQueryOutput(_0x359d83,_0x45426e),0x0;}catch(_0x131af3){if(_0x131af3 instanceof SDKError)return console[_0x149a5b(0x12f)](_0x149a5b(0xb6)+_0x131af3[_0x149a5b(0xc3)]),_0x131af3[_0x149a5b(0x104)]&&console[_0x149a5b(0x12f)]('\x20\x20Cause:\x20'+_0x131af3[_0x149a5b(0x104)]),0x1;throw _0x131af3;}}}function a38_0x4863(){const _0xe66675=['\x20\x20Segment\x20name:\x20','Options:','1781616QrQgJs','error','\x20\x20Parent\x20segment:\x20','jobId','trim','resolveFolderId','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','resolveParentId','red','Fetching\x20segment\x20details...','Resolved\x20type:\x20','Use:\x20tdx\x20ps\x20desc','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20\x27','✔\x20Created\x20folder\x20\x27','segment:show','folderId','14eYKQZn','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','processedRows','segment:sql','segment','Resolved\x20YAML\x20file:\x20','✖\x20Query\x20failed\x20[','Show\x20folder\x20or\x20child\x20segment\x20details','cyan','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x27...','segment:folder:create','folder','Folder\x20ID:\x20','parentId','parentFolder','listFolders','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segmentPath','url','Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','SEGMENT_NOT_FOUND','Error:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Folder\x20reference\x20is\x20required','Parent\x20segment:\x20','limit','Resolved\x20parent\x20folder\x20ID:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','getSQLFromYamlFile','description','4486355QteLxf','Parent\x20ID:\x20','466040YJsoJO','Show\x20segment\x20or\x20folder\x20details','message','segmentName','createFolder','parentSegment','Listing\x20folders\x20for\x20parent\x20\x27','Resolved:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','resolvePathToResource','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','INVALID_ARGUMENT','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','folderPath','fullPath','153CDgGvM','/e/','verbose','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Folder\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','131266ggEoPA','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','getSegment','execute','SQL\x20query:\x0a','Resolving\x20parent\x20segment\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','information_schema','21665644dchjKQ','path','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getFolder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Fetching\x20parent\x20segment\x20details...','getParent','Fetching\x20SQL\x20for\x20segment...','elapsedTimeMillis','stats','format','Show\x20segment\x20folder\x20details','test','green','Error:\x20Path\x20or\x20name\x20is\x20required','type','10396890oTaGiC','Creating\x20folder\x20\x27','jsonl','name','\x20Opening\x20','/app/ps/','Fetching\x20folder\x20\x27','3684cbwiCA','code','data','Site:\x20','json','Use:\x20tdx\x20ps\x20view\x20-w','cause','replace','Examples:','parent','Usage:','Segment\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segment:folder:show','4jwYaAI','segmentId','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','length','in\x20','\x20\x20Full\x20path:\x20','segment:view','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','Folder\x20name:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20desc\x20<name>','site','content','query','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Cause:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20folder\x20\x27','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Found\x20','9919GwEgcm','Target\x20path:\x20','includes','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:describe'];a38_0x4863=function(){return _0xe66675;};return a38_0x4863();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a39_0x518727=a39_0x53cb;(function(_0x2df66d,_0x2753a4){const _0x1af133=a39_0x53cb,_0x2ff236=_0x2df66d();while(!![]){try{const _0xee1805=-parseInt(_0x1af133(0xc2))/0x1*(parseInt(_0x1af133(0xa2))/0x2)+-parseInt(_0x1af133(0xc5))/0x3*(-parseInt(_0x1af133(0xbb))/0x4)+-parseInt(_0x1af133(0xab))/0x5*(parseInt(_0x1af133(0xd1))/0x6)+-parseInt(_0x1af133(0xce))/0x7+parseInt(_0x1af133(0xaa))/0x8+-parseInt(_0x1af133(0xa3))/0x9*(parseInt(_0x1af133(0xcd))/0xa)+-parseInt(_0x1af133(0xaf))/0xb*(-parseInt(_0x1af133(0xc9))/0xc);if(_0xee1805===_0x2753a4)break;else _0x2ff236['push'](_0x2ff236['shift']());}catch(_0x192d7a){_0x2ff236['push'](_0x2ff236['shift']());}}}(a39_0x4982,0x30739));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x53cb(_0x350dc7,_0xf37a83){_0x350dc7=_0x350dc7-0x9e;const _0x4982eb=a39_0x4982();let _0x53cbbd=_0x4982eb[_0x350dc7];return _0x53cbbd;}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 a39_0x3dbc38 from'chalk';function a39_0x4982(){const _0x35847e=['type','40988bwpkhr','segment','invisible','rule','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','error','24069ZbVasv','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Examples:','57NbNMie','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20\x27','12JFclXc','resolveFolderId','resolvePathToResource','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','140QoBAlP','1652777VfLaYc','parent','segment:create','1260QHTrTJ','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','data','verbose','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','30ilcTkI','140841IFIKOh','Parent:\x20','Resolving\x20folder\x20path\x20\x27','Parent\x20path:\x20','folder','length','segmentPath','1950536fJnXgJ','2985dXCumc','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','yellow','segments','7717039vfQFjn','resolveParentId','name','description','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','kind','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','Creating\x20segment\x20\x27','site'];a39_0x4982=function(){return _0x35847e;};return a39_0x4982();}export class SegmentCreateCommand extends BaseCommand{[a39_0x518727(0xb1)]=a39_0x518727(0xd0);[a39_0x518727(0xb2)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x42ed44){const _0x374ac4=a39_0x518727;console[_0x374ac4(0xc1)](a39_0x3dbc38[_0x374ac4(0xad)](_0x374ac4(0xbf))),console[_0x374ac4(0xc1)](a39_0x3dbc38[_0x374ac4(0xad)](_0x374ac4(0xd2)));const {options:_0x3449f3,args:_0x4fd6a9,tdx:_0x54e55b}=_0x42ed44,_0x8d4d5a=_0x3449f3;if(_0x4fd6a9[_0x374ac4(0xa8)]===0x0)return console[_0x374ac4(0xc1)](_0x374ac4(0xb3)),console[_0x374ac4(0xc1)](_0x374ac4(0xc7)),console[_0x374ac4(0xc1)](_0x374ac4(0xc4)),console[_0x374ac4(0xc1)](_0x374ac4(0xa1)),console[_0x374ac4(0xc1)](_0x374ac4(0xb5)),console[_0x374ac4(0xc1)](_0x374ac4(0xc3)),0x1;const _0x49dde0=_0x4fd6a9[0x0],_0x5a16c8=_0x3449f3[_0x374ac4(0xa9)];let _0x12c21e=_0x49dde0;_0x5a16c8&&!_0x49dde0['includes']('/')&&(_0x12c21e=_0x5a16c8+'/'+_0x49dde0,_0x8d4d5a[_0x374ac4(0x9f)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x12c21e));const _0x532662=parsePath(_0x12c21e);if(_0x532662['segments'][_0x374ac4(0xa8)]<0x2)return console[_0x374ac4(0xc1)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error'](_0x374ac4(0xac)),0x1;const _0x2c5eb8=_0x532662[_0x374ac4(0xae)][0x0],_0x3b2589=getBaseName(_0x12c21e),_0x3a5bab=getParentPath(_0x12c21e);_0x8d4d5a['verbose']&&(console[_0x374ac4(0xc1)]('Site:\x20'+_0x8d4d5a[_0x374ac4(0xb9)]),console[_0x374ac4(0xc1)](_0x374ac4(0xb7)+_0x12c21e),console[_0x374ac4(0xc1)](_0x374ac4(0xa4)+_0x2c5eb8),console[_0x374ac4(0xc1)]('Segment\x20name:\x20'+_0x3b2589),console[_0x374ac4(0xc1)](_0x374ac4(0xa6)+_0x3a5bab));const _0x251d60=await withSpinner(_0x374ac4(0xa0)+_0x2c5eb8+_0x374ac4(0xc0),()=>_0x54e55b['segment'][_0x374ac4(0xb0)](_0x2c5eb8),{'verbose':_0x8d4d5a[_0x374ac4(0x9f)]}),_0x412634=_0x251d60['data'];let _0x103e1d;if(_0x532662[_0x374ac4(0xae)][_0x374ac4(0xa8)]>0x2){const _0x5ac2c0=await withSpinner(_0x374ac4(0xa5)+_0x3a5bab+_0x374ac4(0xc0),()=>_0x54e55b[_0x374ac4(0xbc)][_0x374ac4(0xcb)](_0x3a5bab),{'verbose':_0x8d4d5a[_0x374ac4(0x9f)]}),_0x218651=_0x5ac2c0['data'];if(_0x218651['type']!=='folder'&&_0x218651[_0x374ac4(0xba)]!==_0x374ac4(0xcf))return console[_0x374ac4(0xc1)](_0x374ac4(0xcc)),0x1;_0x103e1d=_0x218651['folderId'];}else{if(_0x8d4d5a[_0x374ac4(0xa7)]){const _0x355286=await withSpinner(_0x374ac4(0xc8)+_0x8d4d5a['folder']+'\x27...',()=>_0x54e55b[_0x374ac4(0xbc)][_0x374ac4(0xca)](_0x412634,_0x8d4d5a[_0x374ac4(0xa7)]),{'verbose':_0x8d4d5a[_0x374ac4(0x9f)]});_0x103e1d=_0x355286[_0x374ac4(0x9e)];}}_0x8d4d5a['verbose']&&_0x103e1d&&console[_0x374ac4(0xc1)](_0x374ac4(0xb6)+_0x103e1d);const _0x299a6a=await loadJSONFromOptions(_0x8d4d5a[_0x374ac4(0xbe)],_0x8d4d5a[_0x374ac4(0xc6)]),_0xbd37da={'name':_0x3b2589,'description':_0x8d4d5a[_0x374ac4(0xb2)],'rule':_0x299a6a,'kind':_0x8d4d5a['kind']!==undefined?parseInt(_0x8d4d5a[_0x374ac4(0xb4)],0xa):undefined,'isVisible':_0x8d4d5a[_0x374ac4(0xbd)]?![]:undefined,'segmentFolderId':_0x103e1d,'countPopulation':_0x8d4d5a['noCountPopulation']?![]:undefined},_0x29bbf4=await withSpinner(_0x374ac4(0xb8)+_0x3b2589+_0x374ac4(0xc0),()=>_0x54e55b[_0x374ac4(0xbc)]['createSegment'](_0x412634,_0xbd37da),{'verbose':_0x8d4d5a[_0x374ac4(0x9f)]}),_0x58de40=_0x29bbf4[_0x374ac4(0x9e)];return console[_0x374ac4(0xc1)]('✔\x20Created\x20segment\x20\x27'+_0x58de40[_0x374ac4(0xb1)]+'\x27\x20with\x20ID:\x20'+_0x58de40['id']),_0x12c21e!==_0x49dde0&&console[_0x374ac4(0xc1)]('\x20\x20\x20Path:\x20'+_0x12c21e),await handleSDKOutput([_0x58de40],_0x8d4d5a),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a40_0xdd69f=a40_0x5807;(function(_0x5a9fd4,_0x11f3f3){const _0x5307c9=a40_0x5807,_0x4738a1=_0x5a9fd4();while(!![]){try{const _0x46c730=parseInt(_0x5307c9(0x10b))/0x1+-parseInt(_0x5307c9(0xf4))/0x2*(parseInt(_0x5307c9(0xf9))/0x3)+parseInt(_0x5307c9(0x10c))/0x4+parseInt(_0x5307c9(0xfe))/0x5+parseInt(_0x5307c9(0x104))/0x6+parseInt(_0x5307c9(0x108))/0x7+-parseInt(_0x5307c9(0xf8))/0x8;if(_0x46c730===_0x11f3f3)break;else _0x4738a1['push'](_0x4738a1['shift']());}catch(_0x349f89){_0x4738a1['push'](_0x4738a1['shift']());}}}(a40_0x5f3f,0xce638));function a40_0x5807(_0x2195e0,_0x58b84c){_0x2195e0=_0x2195e0-0xf4;const _0x5f3f10=a40_0x5f3f();let _0x58073b=_0x5f3f10[_0x2195e0];return _0x58073b;}import{BaseCommand}from'./command.js';function a40_0x5f3f(){const _0x23914f=['Parent\x20segment:\x20','9797004ldGBxI','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','jsonl','431258HLcfJm','1952156oJPJwJ','length','error','\x20field','listFields','22zvWUnh','json','Error:\x20Parent\x20segment\x20name\x20is\x20required','execute','16045360Yvkvjw','360969QCRPZm','Site:\x20','name','Listing\x20fields\x20for\x20\x27','\x27...','3130080OVxfsZ','description','site','verbose','data','segment:fields','7378236IKDwNu','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation'];a40_0x5f3f=function(){return _0x23914f;};return a40_0x5f3f();}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{[a40_0xdd69f(0xfb)]=a40_0xdd69f(0x103);[a40_0xdd69f(0xff)]=a40_0xdd69f(0x106);async[a40_0xdd69f(0xf7)](_0x4ccccb){const _0x805895=a40_0xdd69f,{options:_0x9f5429,args:_0x3db83e,tdx:_0x1219a6}=_0x4ccccb,_0x210f7e=_0x3db83e[0x0]||_0x9f5429['parentSegment'];if(!_0x210f7e)return console[_0x805895(0x10e)](_0x805895(0xf6)),console['error'](_0x805895(0x109)),console[_0x805895(0x10e)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x9f5429[_0x805895(0x101)]&&(console['error'](_0x805895(0xfa)+_0x9f5429[_0x805895(0x100)]),console[_0x805895(0x10e)](_0x805895(0x107)+_0x210f7e));const _0x236cd4=await withSpinner(_0x805895(0xfc)+_0x210f7e+_0x805895(0xfd),()=>_0x1219a6['segment'][_0x805895(0x110)](_0x210f7e),{'verbose':_0x9f5429['verbose']}),_0x198138=_0x236cd4[_0x805895(0x102)];console['error'](_0x805895(0x105)+_0x198138[_0x805895(0x10d)]+_0x805895(0x10f)+(_0x198138[_0x805895(0x10d)]!==0x1?'s':''));if(_0x9f5429[_0x805895(0xf5)]||_0x9f5429[_0x805895(0x10a)])return await handleSDKOutput(_0x198138,_0x9f5429),0x0;return displayFieldsHumanReadable(_0x198138,_0x210f7e),0x0;}}
|