@treasuredata/tdx 2026.8.1 → 2026.8.2
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/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-always-on-campaign-pull-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-validate-command.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-move-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/table-deleted.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/site-mismatch.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/tools/work-create-item.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/auth-token.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-schema.d.ts +2 -0
- package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -1
- package/dist/sdk/cas/cas-audience-schema.js +1 -1
- package/dist/sdk/cas/cas-audience-schema.js.map +1 -1
- package/dist/sdk/cas/cas-audience-validator.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js.map +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.d.ts.map +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js.map +1 -1
- package/dist/sdk/cas/types.d.ts +2 -0
- package/dist/sdk/cas/types.d.ts.map +1 -1
- package/dist/sdk/cas/validate-files.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/always-on-campaign-pull.js +1 -1
- package/dist/sdk/engage/always-on-campaign-push.js +1 -1
- package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.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/always-on-campaign-schema.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/llm/user-settings.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cas.d.ts +4 -0
- package/dist/sdk/types/cas.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/util/tree-search.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/task-graph.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/access-tracker.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/claude-code-state.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/proxy-fetch.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 a35_0x503f22=a35_0x39ea;(function(_0x475ab8,_0x208ea5){const _0x1501a4=a35_0x39ea,_0x1f20ea=_0x475ab8();while(!![]){try{const _0x4e9875=parseInt(_0x1501a4(0x1a4))/0x1+-parseInt(_0x1501a4(0x1a3))/0x2+parseInt(_0x1501a4(0x1bd))/0x3+parseInt(_0x1501a4(0x1c8))/0x4*(-parseInt(_0x1501a4(0x1ae))/0x5)+parseInt(_0x1501a4(0x1c4))/0x6+parseInt(_0x1501a4(0x1d2))/0x7*(parseInt(_0x1501a4(0x1c2))/0x8)+-parseInt(_0x1501a4(0x19f))/0x9*(parseInt(_0x1501a4(0x1d0))/0xa);if(_0x4e9875===_0x208ea5)break;else _0x1f20ea['push'](_0x1f20ea['shift']());}catch(_0x135039){_0x1f20ea['push'](_0x1f20ea['shift']());}}}(a35_0x3351,0x9e60f));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a35_0x3e6119 from'chalk';function a35_0x3351(){const _0x43f16e=['324474gLxiLx','381773iPgXaF','description','\x20—\x20','getCurrent','Member','padEnd','policy','account_owner','📋\x20Assigned\x20Policies','map','105PAyURW','getMyPermissions','name','account_id','log','args','administrator','policy\x20show','\x20\x20No\x20policies\x20assigned','site','\x20\x20No\x20permissions','listPolicies','bold','No\x20policies\x20found','\x20\x20\x20','2309469YiNqMS','error','Fetching\x20policy...','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','length','248VVOIcm','validate','3675186TObGmE','operation','Administrator','permissions','175388sOHlEm','data','👥\x20Assigned\x20Users','email','join','dim','\x20polic','\x20user','608110BOrujG','verbose','6419NzfpWD','execute','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','ies','all','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Listing\x20policies...','9aCfBxN','\x20\x20•\x20','✔\x20Found\x20','max'];a35_0x3351=function(){return _0x43f16e;};return a35_0x3351();}export class PolicyCommand extends BaseCommand{[a35_0x503f22(0x1b0)]=a35_0x503f22(0x1aa);[a35_0x503f22(0x1a5)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async['execute'](_0x1176a2){const _0x40f902=a35_0x503f22,{options:_0x1ddbeb,tdx:_0x4ed975}=_0x1176a2,_0x134928=await withSpinner('Fetching\x20permissions...',async()=>{const _0x3f17b4=a35_0x39ea,[_0x2180c8,_0x53c0e2]=await Promise[_0x3f17b4(0x19c)]([_0x4ed975['user'][_0x3f17b4(0x1a7)](),_0x4ed975[_0x3f17b4(0x1aa)][_0x3f17b4(0x1af)]()]);return{'userInfo':_0x2180c8,'permissions':_0x53c0e2};},{'verbose':_0x1ddbeb[_0x40f902(0x1d1)]}),{userInfo:_0x45d2fa,permissions:_0x2c6f4d}=_0x134928['data'];if(isStructuredFormat(_0x1ddbeb))return await handleSingleObjectOutput(_0x2c6f4d,_0x1ddbeb),0x0;const _0x432495=_0x45d2fa[_0x40f902(0x1ab)]?'Account\x20Owner':_0x45d2fa[_0x40f902(0x1b4)]?_0x40f902(0x1c6):_0x40f902(0x1a8);console[_0x40f902(0x1b2)]('\x0a'+a35_0x3e6119[_0x40f902(0x1ba)]('👤')+'\x20'+a35_0x3e6119[_0x40f902(0x1ba)](_0x45d2fa[_0x40f902(0x1b0)])+'\x20'+a35_0x3e6119[_0x40f902(0x1cd)]('('+_0x45d2fa[_0x40f902(0x1cb)]+')')+_0x40f902(0x1a6)+_0x432495),console['log'](a35_0x3e6119[_0x40f902(0x1cd)](_0x40f902(0x1bc)+_0x4ed975['context'][_0x40f902(0x1b7)]+':'+_0x45d2fa[_0x40f902(0x1b1)]+',\x20user_id:'+_0x45d2fa['id']));const _0xb0f3f7=_0x2c6f4d['policies'];console[_0x40f902(0x1b2)]('\x0a'+a35_0x3e6119[_0x40f902(0x1ba)](_0x40f902(0x1ac))+'\x20('+_0xb0f3f7[_0x40f902(0x1c1)]+'):');if(_0xb0f3f7[_0x40f902(0x1c1)]===0x0)console[_0x40f902(0x1b2)](a35_0x3e6119[_0x40f902(0x1cd)](_0x40f902(0x1b6)));else for(const _0x470bf0 of _0xb0f3f7){console[_0x40f902(0x1b2)](_0x40f902(0x1a0)+_0x470bf0[_0x40f902(0x1b0)]);}return printPermissionsMap(_0x2c6f4d[_0x40f902(0x1c7)]),console[_0x40f902(0x1b2)](),0x0;}}function a35_0x39ea(_0xa4811b,_0x2ce3eb){_0xa4811b=_0xa4811b-0x19b;const _0x3351a4=a35_0x3351();let _0x39ea64=_0x3351a4[_0xa4811b];return _0x39ea64;}export class PolicyListCommand extends BaseCommand{['name']='policy\x20list';[a35_0x503f22(0x1a5)]=a35_0x503f22(0x1c0);async[a35_0x503f22(0x1d3)](_0x1277fd){const _0x395d86=a35_0x503f22,{options:_0xa3dd67,tdx:_0x3cf8ee}=_0x1277fd,_0x3f5aea=await withSpinner(_0x395d86(0x19e),()=>_0x3cf8ee[_0x395d86(0x1aa)][_0x395d86(0x1b9)](),{'verbose':_0xa3dd67[_0x395d86(0x1d1)]}),_0x34ef4f=_0x3f5aea['data'];console[_0x395d86(0x1be)](_0x395d86(0x1a1)+_0x34ef4f['length']+_0x395d86(0x1ce)+(_0x34ef4f[_0x395d86(0x1c1)]!==0x1?_0x395d86(0x19b):'y'));if(isStructuredFormat(_0xa3dd67))return await handleSDKOutput(_0x34ef4f,_0xa3dd67),0x0;if(_0x34ef4f[_0x395d86(0x1c1)]===0x0)console[_0x395d86(0x1b2)](a35_0x3e6119[_0x395d86(0x1cd)](_0x395d86(0x1bb)));else for(const _0x52d726 of _0x34ef4f){const _0x3fca05=_0x52d726[_0x395d86(0x1a5)]?a35_0x3e6119['dim'](_0x395d86(0x1a6)+_0x52d726[_0x395d86(0x1a5)]):'';console[_0x395d86(0x1b2)]('\x20\x20•\x20'+_0x52d726[_0x395d86(0x1b0)]+_0x3fca05);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a35_0x503f22(0x1b0)]=a35_0x503f22(0x1b5);[a35_0x503f22(0x1a5)]=a35_0x503f22(0x19d);[a35_0x503f22(0x1c3)](_0x147837){const _0x2704c6=a35_0x503f22;if(_0x147837['args']['length']===0x0)return _0x2704c6(0x1d4);return undefined;}async[a35_0x503f22(0x1d3)](_0x309b2e){const _0x61a274=a35_0x503f22,{options:_0x39f3f9,tdx:_0x3737b4}=_0x309b2e,_0x49825d=_0x309b2e[_0x61a274(0x1b3)][0x0],_0x20ea62=await withSpinner(_0x61a274(0x1bf),async()=>{const _0x9d03c1=_0x61a274,_0x3c3759=await _0x3737b4['policy']['getPolicy'](_0x49825d),[_0x448a46,_0x2be6be]=await Promise[_0x9d03c1(0x19c)]([_0x3737b4[_0x9d03c1(0x1aa)]['getPolicyPermissions'](_0x3c3759['id']),_0x3737b4['policy']['getPolicyUsers'](_0x3c3759['id'])]);return{'policy':_0x3c3759,'perms':_0x448a46,'users':_0x2be6be};},{'verbose':_0x39f3f9[_0x61a274(0x1d1)]}),{policy:_0xac4061,perms:_0x136422,users:_0x4bd2c4}=_0x20ea62[_0x61a274(0x1c9)];if(isStructuredFormat(_0x39f3f9))return await handleSingleObjectOutput({..._0xac4061,'permissions':_0x136422[_0x61a274(0x1c7)],'users':_0x4bd2c4},_0x39f3f9),0x0;console[_0x61a274(0x1b2)]('\x0a'+a35_0x3e6119['bold']('📋')+'\x20'+a35_0x3e6119['bold'](_0xac4061[_0x61a274(0x1b0)])+'\x20'+a35_0x3e6119[_0x61a274(0x1cd)]('(ID:\x20'+_0xac4061['id']+')'));_0xac4061[_0x61a274(0x1a5)]&&console['log'](_0x61a274(0x1bc)+a35_0x3e6119[_0x61a274(0x1cd)](_0xac4061[_0x61a274(0x1a5)]));console[_0x61a274(0x1b2)]('\x20\x20\x20'+_0x4bd2c4[_0x61a274(0x1c1)]+_0x61a274(0x1cf)+(_0x4bd2c4[_0x61a274(0x1c1)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x136422['permissions']);if(_0x4bd2c4[_0x61a274(0x1c1)]>0x0){console['log']('\x0a'+a35_0x3e6119[_0x61a274(0x1ba)](_0x61a274(0x1ca))+':');for(const _0x57225e of _0x4bd2c4){const _0x1eeac8=_0x57225e['email']&&_0x57225e[_0x61a274(0x1cb)]!==_0x57225e[_0x61a274(0x1b0)]?a35_0x3e6119['dim']('\x20<'+_0x57225e[_0x61a274(0x1cb)]+'>'):'';console['log']('\x20\x20•\x20'+_0x57225e[_0x61a274(0x1b0)]+_0x1eeac8);}}return console[_0x61a274(0x1b2)](),0x0;}}function printPermissionsMap(_0x1f272c){const _0x103b65=a35_0x503f22,_0x4d2516=Object['entries'](_0x1f272c);console[_0x103b65(0x1b2)]('\x0a'+a35_0x3e6119[_0x103b65(0x1ba)]('🔑\x20Effective\x20Permissions')+':');if(_0x4d2516['length']===0x0){console[_0x103b65(0x1b2)](a35_0x3e6119[_0x103b65(0x1cd)](_0x103b65(0x1b8)));return;}const _0x382bd7=Math[_0x103b65(0x1a2)](..._0x4d2516['map'](([_0x18b471])=>_0x18b471['length']));for(const [_0x4775db,_0x32f432]of _0x4d2516){const _0x3866f0=formatOperations(_0x32f432);console['log']('\x20\x20'+_0x4775db[_0x103b65(0x1a9)](_0x382bd7+0x2)+_0x3866f0);}}function formatOperations(_0x2e1052){const _0x18fe28=a35_0x503f22,_0x17b694=[...new Set(_0x2e1052[_0x18fe28(0x1ad)](_0x4dc67c=>_0x4dc67c[_0x18fe28(0x1c5)]))];return _0x17b694[_0x18fe28(0x1cc)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x5e3513=a36_0x2041;(function(_0x273054,_0x4d2cc7){const _0x551a59=a36_0x2041,_0x2d7966=_0x273054();while(!![]){try{const _0x65bb10=-parseInt(_0x551a59(0xbd))/0x1+parseInt(_0x551a59(0xe8))/0x2*(-parseInt(_0x551a59(0xd5))/0x3)+parseInt(_0x551a59(0xc6))/0x4+parseInt(_0x551a59(0x90))/0x5*(parseInt(_0x551a59(0xab))/0x6)+parseInt(_0x551a59(0xa3))/0x7*(-parseInt(_0x551a59(0x93))/0x8)+parseInt(_0x551a59(0x94))/0x9*(-parseInt(_0x551a59(0xe6))/0xa)+parseInt(_0x551a59(0xa7))/0xb*(parseInt(_0x551a59(0xdc))/0xc);if(_0x65bb10===_0x4d2cc7)break;else _0x2d7966['push'](_0x2d7966['shift']());}catch(_0x1a9a0e){_0x2d7966['push'](_0x2d7966['shift']());}}}(a36_0x3e34,0x49629));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a36_0x457c08 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';function a36_0x3e34(){const _0x29d894=['password','skipExistsCheck','parent_segment','\x0aSetup\x20cancelled','red','\x20\x20(no\x20profiles\x20found)','create','message','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','ERROR','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','green','Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','config','validate','site','95dMmHvJ','Enter\x20description\x20(optional):','\x20API\x20key\x20is\x20valid\x20(User:\x20','2056ZAbDCj','9KlxKFl','\x0aSaved\x20to:\x20','\x27\x20updated:\x20','confirm','Unknown\x20key\x20\x27','\x20Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','profile:create','trim','Session\x20profile\x20set\x20to:\x20','oauth','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','description','VALID_KEYS','API\x20key\x20cannot\x20be\x20empty','6538Itgkyw','logLevel','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','error','8041vJRHhq','profileName','profile:use','Validating\x20API\x20key...','28332xhnUqT','Removed\x20existing\x20profile\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20--default\x27\x20to\x20save\x20permanently','length','Delete\x20a\x20profile','Failed\x20to\x20delete\x20profile:\x20','\x27\x20created','session','\x20\x20tdx\x20--profile\x20','Operation\x20cancelled','tdx:\x20profile\x20set','tdx:\x20profile\x20delete','Removal\x20cancelled','(cleared)','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','includes','157338GeDCME','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','status','all','\x27\x20deleted','Create\x20a\x20new\x20profile','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','1592768pDbiGj','/app/mp/ak','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Default\x20profile\x20set\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','yellow','tdx:\x20profile\x20create','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Changing\x20site\x20to\x20\x27','tdx.json','default','llm_agent','getUserInfo','\x0aAvailable\x20profiles:','profile:set','238227NfVOhM','text','\x27\x20does\x20not\x20exist.','dim','\x20\x20-\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','apiKey','13404cYjeCs','bold','join','jobs','execute','Enter\x20profile\x20name:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','log','profile','email','506130dHorgp','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','14uYDGEy','Site\x20was\x20not\x20changed.','split','warn','profile:delete','llm_project','Set\x20a\x20profile\x20configuration\x20value','✗\x20Validation\x20failed:\x20','name','test','\x0aOperation\x20cancelled'];a36_0x3e34=function(){return _0x29d894;};return a36_0x3e34();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';function a36_0x2041(_0x1edce8,_0x3093c9){_0x1edce8=_0x1edce8-0x8d;const _0x3e343a=a36_0x3e34();let _0x2041fd=_0x3e343a[_0x1edce8];return _0x2041fd;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a36_0x292d23 from'prompts';import a36_0x468bff from'chalk';function validateProfileName(_0x3a9cad,_0x1a27e2){const _0x194bad=a36_0x2041;if(!_0x3a9cad||!_0x3a9cad['trim']())return _0x194bad(0x100);const _0x21c145=_0x3a9cad['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x194bad(0xf1)](_0x21c145))return _0x194bad(0xe2);if(!_0x1a27e2?.[_0x194bad(0xf4)]&&profileExists(_0x21c145))return'Profile\x20\x27'+_0x21c145+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x21c145+_0x194bad(0xfd);return!![];}async function deleteProfileAndCredentials(_0x379a2b){const _0x4b21df=a36_0x2041;removeProfileFromUserConfig(_0x379a2b);const _0x124bbd=await isKeychainAvailable();_0x124bbd&&await Promise[_0x4b21df(0xc1)]([deleteKeychainAPIKey(_0x379a2b),deleteOAuthTokens(_0x379a2b)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a36_0x5e3513(0x9b);[a36_0x5e3513(0xa0)]=a36_0x5e3513(0xc3);async['execute'](_0x38572c){const _0x14a290=a36_0x5e3513,{options:_0xb58014,args:_0xb14a66}=_0x38572c,_0x28adef=!!_0xb58014['force'];console[_0x14a290(0xe3)](a36_0x468bff['bold'](_0x14a290(0xcc)));let _0x3222b9;if(_0xb14a66[_0x14a290(0xb0)]>0x0&&_0xb14a66[0x0]){const _0x5a5ce7=_0xb14a66[0x0][_0x14a290(0x9c)]();_0x28adef&&profileExists(_0x5a5ce7)&&(await deleteProfileAndCredentials(_0x5a5ce7),console[_0x14a290(0xe3)](_0x14a290(0xac)+_0x5a5ce7+'\x27'));const _0x540ba5=validateProfileName(_0x5a5ce7);if(_0x540ba5!==!![])return console['error'](a36_0x468bff['red'](_0x540ba5)),0x1;_0x3222b9=_0x5a5ce7;}else{const _0x370434=await a36_0x292d23({'type':_0x14a290(0xd6),'name':'profileName','message':_0x14a290(0xe1),'validate':_0x4c5b7a=>validateProfileName(_0x4c5b7a,{'skipExistsCheck':_0x28adef})});if(!_0x370434[_0x14a290(0xa8)])return console[_0x14a290(0xe3)](_0x14a290(0xf6)),0x1;_0x3222b9=_0x370434[_0x14a290(0xa8)]['trim'](),_0x28adef&&profileExists(_0x3222b9)&&(await deleteProfileAndCredentials(_0x3222b9),console['log'](_0x14a290(0xac)+_0x3222b9+'\x27'));}const _0x41d7f=await a36_0x292d23({'type':_0x14a290(0xd6),'name':'description','message':_0x14a290(0x91)}),_0x16c8d1=_0x41d7f[_0x14a290(0xa0)]?.[_0x14a290(0x9c)]()||undefined,_0x381aaa=_0xb58014[_0x14a290(0x8f)]||_0x14a290(0xc5),_0x1e361e=await promptSiteSelection(_0x381aaa,_0x3222b9,'Setup\x20cancelled');if(!_0x1e361e)return 0x1;const _0x32f829=resolveSite(_0x1e361e),_0x18e12d=await promptAuthMethod();if(!_0x18e12d)return console['log']('\x0aSetup\x20cancelled'),0x1;if(_0x18e12d===_0x14a290(0x9e)){if(_0x16c8d1){const _0x90b6fb={'site':_0x32f829,'description':_0x16c8d1};saveProfileToUserConfig(_0x3222b9,_0x90b6fb);}const {accountName:_0x50516b}=_0xb58014;return await runOAuthLoginFlow(_0x32f829,_0x3222b9,_0xb58014[_0x14a290(0xa4)]??LogLevel[_0x14a290(0xfc)],{'accountName':_0x50516b}),0x0;}console[_0x14a290(0xe3)](_0x14a290(0xbb)+_0x32f829),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x14a290(0xe3)]('\x20\x20'+getConsoleUrl(_0x32f829,'/app/mp/ak'));const _0x96cf0d=await a36_0x292d23({'type':_0x14a290(0xf3),'name':_0x14a290(0xdb),'message':_0x14a290(0xca),'validate':_0x57465e=>{const _0x2e7d3c=_0x14a290;if(!_0x57465e||!_0x57465e[_0x2e7d3c(0x9c)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x96cf0d[_0x14a290(0xdb)])return console[_0x14a290(0xe3)](_0x14a290(0xf6)),0x1;const _0x211eea=_0x96cf0d['apiKey'];console[_0x14a290(0xe3)](_0x14a290(0xaa));try{const _0x341e54=TDX[_0x14a290(0xf9)]({'site':_0x32f829,'apiKey':_0x211eea[_0x14a290(0x9c)](),'logLevel':_0xb58014['logLevel']??LogLevel['ERROR']}),_0x1df91e=await _0x341e54['jobs'][_0x14a290(0xd2)]();console[_0x14a290(0xe3)](a36_0x468bff['green']('✓')+_0x14a290(0x92)+_0x1df91e[_0x14a290(0xe5)]+')');const _0x319e80=await isKeychainAvailable();_0x319e80?(await saveAPIKeyAsync(_0x211eea[_0x14a290(0x9c)](),_0x32f829,_0x3222b9),console[_0x14a290(0xe3)](a36_0x468bff[_0x14a290(0xfe)]('✓')+_0x14a290(0xbf)+_0x3222b9+')')):(console[_0x14a290(0xeb)](a36_0x468bff['yellow'](_0x14a290(0xae))),console[_0x14a290(0xeb)](a36_0x468bff[_0x14a290(0xcb)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x42b6f5={'site':_0x32f829,..._0x16c8d1&&{'description':_0x16c8d1}};return saveProfileToUserConfig(_0x3222b9,_0x42b6f5),console['log'](a36_0x468bff['green']('✓')+_0x14a290(0x99)+_0x3222b9+_0x14a290(0xb3)),console['log'](),console[_0x14a290(0xe3)](_0x14a290(0xe7)),console['log'](_0x14a290(0xb5)+_0x3222b9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x14a290(0xb5)+_0x3222b9+_0x14a290(0xcd)),0x0;}catch(_0x5bc9e4){if(_0x5bc9e4 instanceof HTTPClientError&&_0x5bc9e4[_0x14a290(0xc0)]===0x191)return printAuthError(_0x5bc9e4),0x1;return console[_0x14a290(0xa6)](a36_0x468bff['red'](_0x14a290(0xef)+(_0x5bc9e4 instanceof Error?_0x5bc9e4[_0x14a290(0xfa)]:String(_0x5bc9e4)))),console[_0x14a290(0xa6)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a36_0x5e3513(0xf0)]=a36_0x5e3513(0xec);[a36_0x5e3513(0xa0)]=a36_0x5e3513(0xb1);['validate'](_0xa7f93e){const _0x39aba2=a36_0x5e3513,{args:_0x59bafe}=_0xa7f93e;if(_0x59bafe[_0x39aba2(0xb0)]===0x0)return _0x39aba2(0x9a);return undefined;}async[a36_0x5e3513(0xe0)](_0x16e07c){const _0x3dc476=a36_0x5e3513,{args:_0x4f0b64}=_0x16e07c,_0x4b08e6=_0x4f0b64[0x0];console[_0x3dc476(0xe3)](a36_0x468bff[_0x3dc476(0xdd)](_0x3dc476(0xb8)));if(!profileExists(_0x4b08e6)){console[_0x3dc476(0xa6)](a36_0x468bff[_0x3dc476(0xf7)]('Profile\x20\x27'+_0x4b08e6+_0x3dc476(0xd7))),console[_0x3dc476(0xe3)](_0x3dc476(0xd3));const _0x898f8c=listProfiles();if(_0x898f8c[_0x3dc476(0xb0)]===0x0)console[_0x3dc476(0xe3)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2a2cd5 of _0x898f8c){console[_0x3dc476(0xe3)](_0x3dc476(0xd9)+_0x2a2cd5['name']);}return 0x1;}const _0x4cacaf=await a36_0x292d23({'type':_0x3dc476(0x97),'name':_0x3dc476(0x97),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4b08e6+'\x27?','initial':![]});if(!_0x4cacaf[_0x3dc476(0x97)])return console[_0x3dc476(0xe3)](_0x3dc476(0xb9)),0x0;try{await deleteProfileAndCredentials(_0x4b08e6),console[_0x3dc476(0xe3)](a36_0x468bff[_0x3dc476(0xfe)]('✓')+_0x3dc476(0x99)+_0x4b08e6+_0x3dc476(0xc2));}catch(_0x12da31){return console[_0x3dc476(0xa6)](a36_0x468bff[_0x3dc476(0xf7)](_0x3dc476(0xb2)+(_0x12da31 instanceof Error?_0x12da31[_0x3dc476(0xfa)]:String(_0x12da31)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a36_0x5e3513(0xf0)]=a36_0x5e3513(0xd4);[a36_0x5e3513(0xa0)]=a36_0x5e3513(0xee);static [a36_0x5e3513(0xa1)]=[a36_0x5e3513(0x8f),'database',a36_0x5e3513(0xf5),a36_0x5e3513(0xed),a36_0x5e3513(0xd1),a36_0x5e3513(0xa0)];[a36_0x5e3513(0x8e)](_0x17f6a3){const _0x4b42a0=a36_0x5e3513,{args:_0x41d047,options:_0x234410}=_0x17f6a3,_0x30748a=_0x234410[_0x4b42a0(0xe4)]||getActiveProfile();if(!_0x30748a)return _0x4b42a0(0xc4);if(_0x41d047[_0x4b42a0(0xb0)]===0x0)return _0x4b42a0(0x9f)+ProfileSetCommand[_0x4b42a0(0xa1)][_0x4b42a0(0xde)](',\x20');const _0x3a4135=_0x41d047[0x0];if(!_0x3a4135['includes']('='))return _0x4b42a0(0xda)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x28866e]=_0x3a4135[_0x4b42a0(0xea)]('=',0x2);if(!ProfileSetCommand[_0x4b42a0(0xa1)][_0x4b42a0(0xbc)](_0x28866e))return _0x4b42a0(0x98)+_0x28866e+_0x4b42a0(0xad)+ProfileSetCommand[_0x4b42a0(0xa1)][_0x4b42a0(0xde)](',\x20');return undefined;}async[a36_0x5e3513(0xe0)](_0x1ea662){const _0x3d6dd4=a36_0x5e3513,{args:_0x161a57,options:_0x2865f3}=_0x1ea662,_0x54ece7=_0x2865f3[_0x3d6dd4(0xe4)]||getActiveProfile(),[_0x2190ca,..._0x27a239]=_0x161a57[0x0][_0x3d6dd4(0xea)]('='),_0x5274d4=_0x27a239[_0x3d6dd4(0xde)]('=');console['log'](a36_0x468bff[_0x3d6dd4(0xdd)](_0x3d6dd4(0xb7)));if(!profileExists(_0x54ece7)){const _0x190dcf=await a36_0x292d23({'type':_0x3d6dd4(0x97),'name':_0x3d6dd4(0xf9),'message':_0x3d6dd4(0xff)+_0x54ece7+_0x3d6dd4(0xc8),'initial':!![]});if(!_0x190dcf['create'])return console[_0x3d6dd4(0xe3)](_0x3d6dd4(0xb6)),0x1;}const _0x504a27=loadProfile(_0x54ece7),_0x2d6bd1=_0x504a27?.[_0x3d6dd4(0x8d)]||{};if(_0x2190ca===_0x3d6dd4(0x8f)){const _0x3eb64f=resolveSite(_0x5274d4);console[_0x3d6dd4(0xe3)](_0x3d6dd4(0xce)+_0x3eb64f+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x3d6dd4(0xa5)),console[_0x3d6dd4(0xe3)]('\x20\x20'+getConsoleUrl(_0x3eb64f,_0x3d6dd4(0xc7)));const _0x352103=await a36_0x292d23({'type':_0x3d6dd4(0xf3),'name':_0x3d6dd4(0xdb),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x2e425c=>{const _0x412c79=_0x3d6dd4;if(!_0x2e425c||!_0x2e425c[_0x412c79(0x9c)]())return _0x412c79(0xa2);return!![];}});if(!_0x352103['apiKey'])return console[_0x3d6dd4(0xe3)](_0x3d6dd4(0xf2)),0x1;console[_0x3d6dd4(0xe3)](_0x3d6dd4(0xaa));try{const _0x1cd85d=TDX['create']({'site':_0x3eb64f,'apiKey':_0x352103[_0x3d6dd4(0xdb)][_0x3d6dd4(0x9c)](),'logLevel':_0x2865f3[_0x3d6dd4(0xa4)]??LogLevel[_0x3d6dd4(0xfc)]}),_0x5e3bb2=await _0x1cd85d[_0x3d6dd4(0xdf)][_0x3d6dd4(0xd2)]();console[_0x3d6dd4(0xe3)](a36_0x468bff[_0x3d6dd4(0xfe)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5e3bb2[_0x3d6dd4(0xe5)]+')');const _0x4a0ac0=await isKeychainAvailable();_0x4a0ac0?(await saveAPIKeyAsync(_0x352103[_0x3d6dd4(0xdb)][_0x3d6dd4(0x9c)](),_0x3eb64f,_0x54ece7),console[_0x3d6dd4(0xe3)](a36_0x468bff['green']('✓')+_0x3d6dd4(0xbe))):console[_0x3d6dd4(0xeb)](a36_0x468bff['yellow'](_0x3d6dd4(0xae))),_0x2d6bd1['site']=_0x3eb64f;}catch(_0x200627){if(_0x200627 instanceof HTTPClientError&&_0x200627[_0x3d6dd4(0xc0)]===0x191)return printAuthError(_0x200627),0x1;return console[_0x3d6dd4(0xa6)](a36_0x468bff[_0x3d6dd4(0xf7)]('✗\x20Validation\x20failed:\x20'+(_0x200627 instanceof Error?_0x200627['message']:String(_0x200627)))),console[_0x3d6dd4(0xa6)](_0x3d6dd4(0xe9)),0x1;}}else _0x2d6bd1[_0x2190ca]=_0x5274d4||undefined;return saveProfileToUserConfig(_0x54ece7,_0x2d6bd1),console[_0x3d6dd4(0xe3)](a36_0x468bff[_0x3d6dd4(0xfe)]('✓')+_0x3d6dd4(0x99)+_0x54ece7+_0x3d6dd4(0x96)+_0x2190ca+'='+(_0x5274d4||_0x3d6dd4(0xba))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a36_0x5e3513(0xa9);[a36_0x5e3513(0xa0)]='Set\x20session\x20profile';[a36_0x5e3513(0x8e)](_0x4a2e63){const {args:_0x2f7b32}=_0x4a2e63;if(_0x2f7b32['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a36_0x5e3513(0xe0)](_0x4aba89){const _0x75e765=a36_0x5e3513,{args:_0x577122,options:_0x54607d}=_0x4aba89,_0x15e9ab=_0x577122[0x0],_0x436c48=_0x54607d[_0x75e765(0xd0)];cleanExpiredSessions();if(!profileExists(_0x15e9ab)){console['error'](a36_0x468bff[_0x75e765(0xf7)](_0x75e765(0xff)+_0x15e9ab+_0x75e765(0xd7))),console['log'](_0x75e765(0xd3));const _0x516da2=listProfiles();if(_0x516da2[_0x75e765(0xb0)]===0x0)console[_0x75e765(0xe3)](_0x75e765(0xf8));else for(const _0x4b9c13 of _0x516da2){console[_0x75e765(0xe3)](_0x75e765(0xd9)+_0x4b9c13[_0x75e765(0xf0)]);}return 0x1;}if(_0x436c48){const _0x3e8054=a36_0x457c08[_0x75e765(0xde)](getConfigDir(),_0x75e765(0xcf));return saveActiveProfileToUserConfig(_0x15e9ab),console[_0x75e765(0xe3)](_0x75e765(0xc9)+a36_0x468bff[_0x75e765(0xfe)](_0x15e9ab)),console['log'](a36_0x468bff[_0x75e765(0xd8)](_0x75e765(0x95)+_0x3e8054)),0x0;}const _0x11b703=getSessionID(_0x54607d[_0x75e765(0xb4)]);return saveSessionContext({'profile':_0x15e9ab},_0x54607d['session']),console['log'](_0x75e765(0x9d)+a36_0x468bff['green'](_0x15e9ab)+'\x20'+a36_0x468bff[_0x75e765(0xd8)]('(session:\x20'+_0x11b703+')')),console[_0x75e765(0xe3)](a36_0x468bff[_0x75e765(0xd8)](_0x75e765(0xfb)+_0x15e9ab+_0x75e765(0xaf))),0x0;}}
|
|
1
|
+
const a36_0x240c61=a36_0x5021;(function(_0x30913,_0xcb43e0){const _0x120b7d=a36_0x5021,_0x4f5179=_0x30913();while(!![]){try{const _0x481dbf=parseInt(_0x120b7d(0x14f))/0x1*(-parseInt(_0x120b7d(0x16f))/0x2)+-parseInt(_0x120b7d(0x165))/0x3+parseInt(_0x120b7d(0x156))/0x4*(parseInt(_0x120b7d(0x1b5))/0x5)+parseInt(_0x120b7d(0x1bf))/0x6*(-parseInt(_0x120b7d(0x171))/0x7)+-parseInt(_0x120b7d(0x16b))/0x8*(-parseInt(_0x120b7d(0x180))/0x9)+parseInt(_0x120b7d(0x18b))/0xa*(parseInt(_0x120b7d(0x160))/0xb)+parseInt(_0x120b7d(0x170))/0xc;if(_0x481dbf===_0xcb43e0)break;else _0x4f5179['push'](_0x4f5179['shift']());}catch(_0x41c3da){_0x4f5179['push'](_0x4f5179['shift']());}}}(a36_0x5220,0x54c3d));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 a36_0x5220(){const _0x3b47e8=['Site\x20was\x20not\x20changed.','message','Enter\x20description\x20(optional):','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx.json','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','force','VALID_KEYS','logLevel','llm_project','\x27\x20requires\x20API\x20key\x20validation.','dim','join','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x20\x20-\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','skipExistsCheck','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20profile\x20delete','Removal\x20cancelled','Set\x20session\x20profile','Validating\x20API\x20key...','Failed\x20to\x20delete\x20profile:\x20','\x0aSetup\x20cancelled','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','log','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','yellow','\x0aOperation\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','1471855zRuhLm','Profile\x20name\x20cannot\x20be\x20empty','\x20Profile\x20\x27','\x27\x20updated:\x20','Session\x20profile\x20set\x20to:\x20','name','Default\x20profile\x20set\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','getUserInfo','test','6iHYJiQ','\x27\x20does\x20not\x20exist.','execute','\x0aSaved\x20to:\x20','text','profile:delete','1VVNoHK','✗\x20Validation\x20failed:\x20','Changing\x20site\x20to\x20\x27','green','Enter\x20profile\x20name:','Create\x20a\x20new\x20profile','jobs','4SOkzgw','API\x20key\x20cannot\x20be\x20empty','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','bold','length','split','confirm','(session:\x20','3279892IQNgsq','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','create','Setup\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','783474arRRKL','description','profileName','red','Profile\x20\x27','llm_agent','184DxoAcj','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','us01','config','349462PGztSf','4068264WwTYeA','2596706YRTech','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>','Operation\x20cancelled','tdx:\x20profile\x20create','includes','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','database','apiKey','error','site','\x20--default\x27\x20to\x20save\x20permanently','oauth','session','Unknown\x20key\x20\x27','trim','87057TnUwvP','email','(cleared)','warn','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20\x20(no\x20profiles\x20found)','Removed\x20existing\x20profile\x20\x27','/app/mp/ak','Set\x20a\x20profile\x20configuration\x20value','validate','\x27\x20does\x20not\x20exist.\x20Create\x20it?','10rEEagC','\x0aAvailable\x20profiles:','password','profile:set','ERROR','profile:create','all','profile:use','profile'];a36_0x5220=function(){return _0x3b47e8;};return a36_0x5220();}import*as a36_0xc2b971 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a36_0x5021(_0x5c61c3,_0xcd4691){_0x5c61c3=_0x5c61c3-0x14f;const _0x5220c7=a36_0x5220();let _0x5021b8=_0x5220c7[_0x5c61c3];return _0x5021b8;}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.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 a36_0x5ae9b6 from'prompts';import a36_0xb7a97b from'chalk';function validateProfileName(_0x269963,_0x5eba66){const _0x421d98=a36_0x5021;if(!_0x269963||!_0x269963[_0x421d98(0x17f)]())return _0x421d98(0x1b6);const _0x8d11fe=_0x269963[_0x421d98(0x17f)]();if(!/^[a-zA-Z0-9_-]+$/[_0x421d98(0x1be)](_0x8d11fe))return _0x421d98(0x16c);if(!_0x5eba66?.[_0x421d98(0x1a6)]&&profileExists(_0x8d11fe))return _0x421d98(0x169)+_0x8d11fe+_0x421d98(0x15a)+_0x8d11fe+_0x421d98(0x1a3);return!![];}async function deleteProfileAndCredentials(_0x323ef1){const _0x4571a4=a36_0x5021;removeProfileFromUserConfig(_0x323ef1);const _0x138b61=await isKeychainAvailable();_0x138b61&&await Promise[_0x4571a4(0x191)]([deleteKeychainAPIKey(_0x323ef1),deleteOAuthTokens(_0x323ef1)]);}export class ProfileCreateCommand extends BaseCommand{[a36_0x240c61(0x1ba)]=a36_0x240c61(0x190);[a36_0x240c61(0x166)]=a36_0x240c61(0x154);async[a36_0x240c61(0x1c1)](_0x578ea8){const _0x477843=a36_0x240c61,{options:_0x4e52a0,args:_0x13b49c}=_0x578ea8,_0x591c21=!!_0x4e52a0[_0x477843(0x19c)];console[_0x477843(0x1b0)](a36_0xb7a97b[_0x477843(0x15b)](_0x477843(0x174)));let _0x1b07d5;if(_0x13b49c['length']>0x0&&_0x13b49c[0x0]){const _0x3282d6=_0x13b49c[0x0]['trim']();_0x591c21&&profileExists(_0x3282d6)&&(await deleteProfileAndCredentials(_0x3282d6),console[_0x477843(0x1b0)](_0x477843(0x186)+_0x3282d6+'\x27'));const _0x453fc1=validateProfileName(_0x3282d6);if(_0x453fc1!==!![])return console[_0x477843(0x179)](a36_0xb7a97b[_0x477843(0x168)](_0x453fc1)),0x1;_0x1b07d5=_0x3282d6;}else{const _0x8766c5=await a36_0x5ae9b6({'type':_0x477843(0x1c3),'name':_0x477843(0x167),'message':_0x477843(0x153),'validate':_0x464c73=>validateProfileName(_0x464c73,{'skipExistsCheck':_0x591c21})});if(!_0x8766c5[_0x477843(0x167)])return console['log'](_0x477843(0x1ad)),0x1;_0x1b07d5=_0x8766c5[_0x477843(0x167)]['trim'](),_0x591c21&&profileExists(_0x1b07d5)&&(await deleteProfileAndCredentials(_0x1b07d5),console[_0x477843(0x1b0)](_0x477843(0x186)+_0x1b07d5+'\x27'));}const _0x233f0f=await a36_0x5ae9b6({'type':'text','name':_0x477843(0x166),'message':_0x477843(0x196)}),_0x13f40f=_0x233f0f[_0x477843(0x166)]?.[_0x477843(0x17f)]()||undefined,_0xb06ce0=_0x4e52a0[_0x477843(0x17a)]||_0x477843(0x16d),_0x19d24a=await promptSiteSelection(_0xb06ce0,_0x1b07d5,_0x477843(0x163));if(!_0x19d24a)return 0x1;const _0x15bddc=resolveSite(_0x19d24a),_0x22f4fa=await promptAuthMethod();if(!_0x22f4fa)return console[_0x477843(0x1b0)]('\x0aSetup\x20cancelled'),0x1;if(_0x22f4fa===_0x477843(0x17c)){if(_0x13f40f){const _0x14d634={'site':_0x15bddc,'description':_0x13f40f};saveProfileToUserConfig(_0x1b07d5,_0x14d634);}const {accountName:_0xbca13c}=_0x4e52a0;return await runOAuthLoginFlow(_0x15bddc,_0x1b07d5,_0x4e52a0[_0x477843(0x19e)]??LogLevel['ERROR'],{'accountName':_0xbca13c}),0x0;}console[_0x477843(0x1b0)](_0x477843(0x1af)+_0x15bddc),console['log'](_0x477843(0x158)),console['log']('\x20\x20'+getConsoleUrl(_0x15bddc,_0x477843(0x187)));const _0x29211=await a36_0x5ae9b6({'type':_0x477843(0x18d),'name':'apiKey','message':_0x477843(0x1a7),'validate':_0x2792c9=>{const _0x3657a2=_0x477843;if(!_0x2792c9||!_0x2792c9[_0x3657a2(0x17f)]())return _0x3657a2(0x157);return!![];}});if(!_0x29211[_0x477843(0x178)])return console['log'](_0x477843(0x1ad)),0x1;const _0x1bec90=_0x29211[_0x477843(0x178)];console['log'](_0x477843(0x1ab));try{const _0x558a28=TDX['create']({'site':_0x15bddc,'apiKey':_0x1bec90[_0x477843(0x17f)](),'logLevel':_0x4e52a0[_0x477843(0x19e)]??LogLevel[_0x477843(0x18f)]}),_0x5adba5=await _0x558a28[_0x477843(0x155)][_0x477843(0x1bd)]();console[_0x477843(0x1b0)](a36_0xb7a97b['green']('✓')+_0x477843(0x197)+_0x5adba5[_0x477843(0x181)]+')');const _0x3fabd0=await isKeychainAvailable();_0x3fabd0?(await saveAPIKeyAsync(_0x1bec90[_0x477843(0x17f)](),_0x15bddc,_0x1b07d5),console[_0x477843(0x1b0)](a36_0xb7a97b[_0x477843(0x152)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1b07d5+')')):(console[_0x477843(0x183)](a36_0xb7a97b[_0x477843(0x1b2)](_0x477843(0x164))),console[_0x477843(0x183)](a36_0xb7a97b[_0x477843(0x1b2)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x462451={'site':_0x15bddc,..._0x13f40f&&{'description':_0x13f40f}};return saveProfileToUserConfig(_0x1b07d5,_0x462451),console[_0x477843(0x1b0)](a36_0xb7a97b[_0x477843(0x152)]('✓')+_0x477843(0x1b7)+_0x1b07d5+'\x27\x20created'),console[_0x477843(0x1b0)](),console['log'](_0x477843(0x176)),console[_0x477843(0x1b0)](_0x477843(0x159)+_0x1b07d5+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x477843(0x1b0)](_0x477843(0x159)+_0x1b07d5+_0x477843(0x19b)),0x0;}catch(_0xa4f331){if(_0xa4f331 instanceof HTTPClientError&&_0xa4f331['status']===0x191)return printAuthError(_0xa4f331),0x1;return console[_0x477843(0x179)](a36_0xb7a97b[_0x477843(0x168)]('✗\x20Validation\x20failed:\x20'+(_0xa4f331 instanceof Error?_0xa4f331[_0x477843(0x195)]:String(_0xa4f331)))),console[_0x477843(0x179)](_0x477843(0x198)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a36_0x240c61(0x1ba)]=a36_0x240c61(0x1c4);['description']='Delete\x20a\x20profile';[a36_0x240c61(0x189)](_0x409e94){const _0x3a9fca=a36_0x240c61,{args:_0x329e08}=_0x409e94;if(_0x329e08['length']===0x0)return _0x3a9fca(0x1ae);return undefined;}async[a36_0x240c61(0x1c1)](_0x3236a5){const _0x4d0dd3=a36_0x240c61,{args:_0x5e8eb6}=_0x3236a5,_0x374b7f=_0x5e8eb6[0x0];console[_0x4d0dd3(0x1b0)](a36_0xb7a97b[_0x4d0dd3(0x15b)](_0x4d0dd3(0x1a8)));if(!profileExists(_0x374b7f)){console['error'](a36_0xb7a97b[_0x4d0dd3(0x168)](_0x4d0dd3(0x169)+_0x374b7f+_0x4d0dd3(0x1c0))),console[_0x4d0dd3(0x1b0)]('\x0aAvailable\x20profiles:');const _0x283463=listProfiles();if(_0x283463[_0x4d0dd3(0x15c)]===0x0)console[_0x4d0dd3(0x1b0)](_0x4d0dd3(0x185));else for(const _0x1a3c02 of _0x283463){console[_0x4d0dd3(0x1b0)](_0x4d0dd3(0x1a4)+_0x1a3c02[_0x4d0dd3(0x1ba)]);}return 0x1;}const _0x1f2874=await a36_0x5ae9b6({'type':'confirm','name':_0x4d0dd3(0x15e),'message':_0x4d0dd3(0x1b4)+_0x374b7f+'\x27?','initial':![]});if(!_0x1f2874[_0x4d0dd3(0x15e)])return console[_0x4d0dd3(0x1b0)](_0x4d0dd3(0x1a9)),0x0;try{await deleteProfileAndCredentials(_0x374b7f),console['log'](a36_0xb7a97b['green']('✓')+_0x4d0dd3(0x1b7)+_0x374b7f+'\x27\x20deleted');}catch(_0x3f318c){return console[_0x4d0dd3(0x179)](a36_0xb7a97b[_0x4d0dd3(0x168)](_0x4d0dd3(0x1ac)+(_0x3f318c instanceof Error?_0x3f318c[_0x4d0dd3(0x195)]:String(_0x3f318c)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a36_0x240c61(0x1ba)]=a36_0x240c61(0x18e);[a36_0x240c61(0x166)]=a36_0x240c61(0x188);static [a36_0x240c61(0x19d)]=['site',a36_0x240c61(0x177),'parent_segment',a36_0x240c61(0x19f),a36_0x240c61(0x16a),a36_0x240c61(0x166)];['validate'](_0x54ce6b){const _0x3963ab=a36_0x240c61,{args:_0x2b9fa0,options:_0x21d8dd}=_0x54ce6b,_0x9cc7e3=_0x21d8dd['profile']||getActiveProfile();if(!_0x9cc7e3)return _0x3963ab(0x172);if(_0x2b9fa0[_0x3963ab(0x15c)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3963ab(0x19d)][_0x3963ab(0x1a2)](',\x20');const _0x16d637=_0x2b9fa0[0x0];if(!_0x16d637[_0x3963ab(0x175)]('='))return _0x3963ab(0x161)+ProfileSetCommand[_0x3963ab(0x19d)]['join'](',\x20');const [_0x58cb4f]=_0x16d637[_0x3963ab(0x15d)]('=',0x2);if(!ProfileSetCommand[_0x3963ab(0x19d)][_0x3963ab(0x175)](_0x58cb4f))return _0x3963ab(0x17e)+_0x58cb4f+_0x3963ab(0x1bc)+ProfileSetCommand[_0x3963ab(0x19d)]['join'](',\x20');return undefined;}async[a36_0x240c61(0x1c1)](_0x3b54c9){const _0x47c35e=a36_0x240c61,{args:_0x183e4a,options:_0x44f363}=_0x3b54c9,_0x1abd6=_0x44f363[_0x47c35e(0x193)]||getActiveProfile(),[_0xb85c21,..._0x44f825]=_0x183e4a[0x0][_0x47c35e(0x15d)]('='),_0x4b92aa=_0x44f825[_0x47c35e(0x1a2)]('=');console[_0x47c35e(0x1b0)](a36_0xb7a97b[_0x47c35e(0x15b)]('tdx:\x20profile\x20set'));if(!profileExists(_0x1abd6)){const _0x4a9bcf=await a36_0x5ae9b6({'type':'confirm','name':'create','message':_0x47c35e(0x169)+_0x1abd6+_0x47c35e(0x18a),'initial':!![]});if(!_0x4a9bcf[_0x47c35e(0x162)])return console[_0x47c35e(0x1b0)](_0x47c35e(0x173)),0x1;}const _0x273068=loadProfile(_0x1abd6),_0x597257=_0x273068?.[_0x47c35e(0x16e)]||{};if(_0xb85c21==='site'){const _0x2adab1=resolveSite(_0x4b92aa);console[_0x47c35e(0x1b0)](_0x47c35e(0x151)+_0x2adab1+_0x47c35e(0x1a0)),console['log'](_0x47c35e(0x1b1)),console[_0x47c35e(0x1b0)]('\x20\x20'+getConsoleUrl(_0x2adab1,_0x47c35e(0x187)));const _0x1cbd29=await a36_0x5ae9b6({'type':'password','name':_0x47c35e(0x178),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x21c664=>{const _0x514503=_0x47c35e;if(!_0x21c664||!_0x21c664[_0x514503(0x17f)]())return _0x514503(0x157);return!![];}});if(!_0x1cbd29[_0x47c35e(0x178)])return console[_0x47c35e(0x1b0)](_0x47c35e(0x1b3)),0x1;console[_0x47c35e(0x1b0)]('Validating\x20API\x20key...');try{const _0x1b76e2=TDX[_0x47c35e(0x162)]({'site':_0x2adab1,'apiKey':_0x1cbd29[_0x47c35e(0x178)][_0x47c35e(0x17f)](),'logLevel':_0x44f363['logLevel']??LogLevel[_0x47c35e(0x18f)]}),_0x39b239=await _0x1b76e2[_0x47c35e(0x155)][_0x47c35e(0x1bd)]();console[_0x47c35e(0x1b0)](a36_0xb7a97b[_0x47c35e(0x152)]('✓')+_0x47c35e(0x197)+_0x39b239[_0x47c35e(0x181)]+')');const _0x4fa204=await isKeychainAvailable();_0x4fa204?(await saveAPIKeyAsync(_0x1cbd29[_0x47c35e(0x178)][_0x47c35e(0x17f)](),_0x2adab1,_0x1abd6),console['log'](a36_0xb7a97b['green']('✓')+_0x47c35e(0x184))):console[_0x47c35e(0x183)](a36_0xb7a97b[_0x47c35e(0x1b2)](_0x47c35e(0x164))),_0x597257[_0x47c35e(0x17a)]=_0x2adab1;}catch(_0x52355a){if(_0x52355a instanceof HTTPClientError&&_0x52355a['status']===0x191)return printAuthError(_0x52355a),0x1;return console['error'](a36_0xb7a97b[_0x47c35e(0x168)](_0x47c35e(0x150)+(_0x52355a instanceof Error?_0x52355a[_0x47c35e(0x195)]:String(_0x52355a)))),console[_0x47c35e(0x179)](_0x47c35e(0x194)),0x1;}}else _0x597257[_0xb85c21]=_0x4b92aa||undefined;return saveProfileToUserConfig(_0x1abd6,_0x597257),console[_0x47c35e(0x1b0)](a36_0xb7a97b[_0x47c35e(0x152)]('✓')+_0x47c35e(0x1b7)+_0x1abd6+_0x47c35e(0x1b8)+_0xb85c21+'='+(_0x4b92aa||_0x47c35e(0x182))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a36_0x240c61(0x192);[a36_0x240c61(0x166)]=a36_0x240c61(0x1aa);[a36_0x240c61(0x189)](_0x525102){const _0x483b85=a36_0x240c61,{args:_0x263778}=_0x525102;if(_0x263778[_0x483b85(0x15c)]===0x0)return _0x483b85(0x1a5);return undefined;}async['execute'](_0x1adb31){const _0x2069b2=a36_0x240c61,{args:_0x3f9184,options:_0x4bdcf8}=_0x1adb31,_0x5effd2=_0x3f9184[0x0],_0x5caba7=_0x4bdcf8['default'];cleanExpiredSessions();if(!profileExists(_0x5effd2)){console[_0x2069b2(0x179)](a36_0xb7a97b[_0x2069b2(0x168)](_0x2069b2(0x169)+_0x5effd2+'\x27\x20does\x20not\x20exist.')),console[_0x2069b2(0x1b0)](_0x2069b2(0x18c));const _0x1619ca=listProfiles();if(_0x1619ca['length']===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x7f147d of _0x1619ca){console['log'](_0x2069b2(0x1a4)+_0x7f147d[_0x2069b2(0x1ba)]);}return 0x1;}if(_0x5caba7){const _0x261200=a36_0xc2b971[_0x2069b2(0x1a2)](getConfigDir(),_0x2069b2(0x19a));return saveActiveProfileToUserConfig(_0x5effd2),console[_0x2069b2(0x1b0)](_0x2069b2(0x1bb)+a36_0xb7a97b[_0x2069b2(0x152)](_0x5effd2)),console[_0x2069b2(0x1b0)](a36_0xb7a97b['dim'](_0x2069b2(0x1c2)+_0x261200)),0x0;}const _0xd008bb=getSessionID(_0x4bdcf8[_0x2069b2(0x17d)]);return saveSessionContext({'profile':_0x5effd2},_0x4bdcf8['session']),console[_0x2069b2(0x1b0)](_0x2069b2(0x1b9)+a36_0xb7a97b[_0x2069b2(0x152)](_0x5effd2)+'\x20'+a36_0xb7a97b['dim'](_0x2069b2(0x15f)+_0xd008bb+')')),console['log'](a36_0xb7a97b[_0x2069b2(0x1a1)](_0x2069b2(0x199)+_0x5effd2+_0x2069b2(0x17b))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a37_0x3f5102=a37_0xe29a;function a37_0x2dab(){const _0x353ed3=['2042772QgrxMG','map','172IDLnHT','config','name','description','8105XJWmWN','3188fWZAwh','11941110VCKOPG','8RqgiqO','log','483345ktChqt','12whUFjr','👤\x20','length','5989DTmUJw','2280888eDRVGc','33HHiCAW','dim','site','scope','2262057fbfzRn'];a37_0x2dab=function(){return _0x353ed3;};return a37_0x2dab();}function a37_0xe29a(_0x58d870,_0x28c42c){_0x58d870=_0x58d870-0xff;const _0x2daba6=a37_0x2dab();let _0xe29a42=_0x2daba6[_0x58d870];return _0xe29a42;}(function(_0x1f83b3,_0x72e48){const _0x431791=a37_0xe29a,_0x1fa4de=_0x1f83b3();while(!![]){try{const _0x52540b=parseInt(_0x431791(0x108))/0x1*(parseInt(_0x431791(0x111))/0x2)+parseInt(_0x431791(0x104))/0x3+-parseInt(_0x431791(0x100))/0x4*(-parseInt(_0x431791(0xff))/0x5)+parseInt(_0x431791(0x105))/0x6*(parseInt(_0x431791(0x10e))/0x7)+-parseInt(_0x431791(0x102))/0x8*(parseInt(_0x431791(0x109))/0x9)+-parseInt(_0x431791(0x101))/0xa+parseInt(_0x431791(0x10a))/0xb*(-parseInt(_0x431791(0x10f))/0xc);if(_0x52540b===_0x72e48)break;else _0x1fa4de['push'](_0x1fa4de['shift']());}catch(_0x3d6de4){_0x1fa4de['push'](_0x1fa4de['shift']());}}}(a37_0x2dab,0xa032c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a37_0xaf3d4 from'chalk';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a37_0x3f5102(0x114)]='List\x20all\x20available\x20profiles';async['execute'](_0x258621){const _0x2f229d=a37_0x3f5102,{options:_0x152cac}=_0x258621;try{const _0x1cb2c2=listProfiles(),_0x48f3f1=getActiveProfile();if(_0x1cb2c2[_0x2f229d(0x107)]===0x0)return console[_0x2f229d(0x103)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x2f229d(0x103)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x4f1b9c=_0x1cb2c2[_0x2f229d(0x110)](_0x212002=>{const _0x529677=_0x2f229d,_0x59d7d8=_0x212002[_0x529677(0x113)]===_0x48f3f1,_0x317348=getProfileParams(_0x212002[_0x529677(0x112)]);return{'name':_0x212002[_0x529677(0x113)],'active':_0x59d7d8,'scope':_0x212002[_0x529677(0x10d)],'description':_0x212002[_0x529677(0x112)]['description']||'','params':_0x317348};});if(isStructuredFormat(_0x152cac))await handleSDKOutput(_0x4f1b9c,_0x152cac);else for(const _0x1b20da of _0x1cb2c2){const _0x15d6cd=_0x1b20da[_0x2f229d(0x113)]===_0x48f3f1?a37_0xaf3d4['green']('\x20✓'):'',_0x354240=_0x1b20da[_0x2f229d(0x112)]['site']?a37_0xaf3d4[_0x2f229d(0x10b)]('\x20'+_0x1b20da['config'][_0x2f229d(0x10c)]):'',_0x4dcc82=_0x1b20da[_0x2f229d(0x112)][_0x2f229d(0x114)]?a37_0xaf3d4[_0x2f229d(0x10b)]('\x20\x20'+_0x1b20da[_0x2f229d(0x112)][_0x2f229d(0x114)]):'';console['log'](_0x2f229d(0x106)+_0x1b20da[_0x2f229d(0x113)]+_0x15d6cd+_0x354240+_0x4dcc82);}return 0x0;}catch(_0x3038dd){return _0x3038dd instanceof Error&&console['error']('Error:\x20'+_0x3038dd['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x12be2f=a38_0x2806;(function(_0x39b752,_0x26c415){const _0x2433c8=a38_0x2806,_0x31c85e=_0x39b752();while(!![]){try{const _0x337dee=parseInt(_0x2433c8(0x1dd))/0x1+parseInt(_0x2433c8(0x1f1))/0x2+-parseInt(_0x2433c8(0x1f3))/0x3*(parseInt(_0x2433c8(0x1e0))/0x4)+parseInt(_0x2433c8(0x1c5))/0x5+parseInt(_0x2433c8(0x1cc))/0x6+-parseInt(_0x2433c8(0x1e9))/0x7*(parseInt(_0x2433c8(0x1ee))/0x8)+-parseInt(_0x2433c8(0x1ea))/0x9;if(_0x337dee===_0x26c415)break;else _0x31c85e['push'](_0x31c85e['shift']());}catch(_0x160ec8){_0x31c85e['push'](_0x31c85e['shift']());}}}(a38_0x44c2,0x3baaa));import{BaseCommand}from'./command.js';function a38_0x2806(_0x5329a1,_0x4455b0){_0x5329a1=_0x5329a1-0x1c2;const _0x44c2b5=a38_0x44c2();let _0x2806c9=_0x44c2b5[_0x5329a1];return _0x2806c9;}function a38_0x44c2(){const _0x4b976c=['SQL:\x20','Site:\x20','Query\x20completed:\x20Processed\x20','\x20-\x20','\x0aAll\x20results\x20saved\x20to\x20','information_schema','setJobId','site','...','333426goKhoh','jobId','push','4ysiXfD','completedSplits','validate','\x20[Job\x20ID:\x20','Executing\x20query\x20[','join','file','data','verbose','3241NduiOL','4076280qJpEbA','message','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','catalog','6088AgxBST','Executing\x20statement\x20','No\x20SQL\x20provided','646226FJOwku','database','8241iuigGb','Executing\x20query...','in\x20','query','args','error','processedRows','1531490RNKpHw','output','elapsedTimeMillis','Catalog:\x20','\x20rows\x20','setExtra','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','537402ssCiyI','state','stats','Statement\x20','length','execute','name','Error:\x20'];a38_0x44c2=function(){return _0x4b976c;};return a38_0x44c2();}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{[a38_0x12be2f(0x1d2)]=a38_0x12be2f(0x1f6);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a38_0x12be2f(0x1d1)](_0x2b3fb3){const _0x27ef72=a38_0x12be2f,{options:_0x698b50,args:_0x49c84d,tdx:_0x1d0bef}=_0x2b3fb3,_0x44aea6={..._0x698b50,'limitStructuredFormats':!![]},_0xa0d9de=_0x49c84d[0x0],_0x456fb3=_0x698b50['file'];let _0x134bcd;try{if(_0x456fb3)_0x134bcd=readSqlStatementsFromFile(_0x456fb3);else{if(_0xa0d9de==='-')_0x134bcd=await readSqlStatementsFromStdin();else{if(_0xa0d9de&&isSqlFilePath(_0xa0d9de))_0x134bcd=readSqlStatementsFromFile(_0xa0d9de);else{if(_0xa0d9de)_0x134bcd=splitSqlStatements(_0xa0d9de);else throw new Error(_0x27ef72(0x1f0));}}}}catch(_0x59c6f5){return console[_0x27ef72(0x1c3)](_0x27ef72(0x1d3)+_0x59c6f5[_0x27ef72(0x1eb)]),0x1;}const _0x2d1a23=_0x698b50[_0x27ef72(0x1f2)]||_0x27ef72(0x1d9),_0xadcfd0=_0x698b50[_0x27ef72(0x1ed)];try{const _0x4e5fc9=[],_0x15073c=!!_0x698b50['output'];for(let _0x2a6e8a=0x0;_0x2a6e8a<_0x134bcd['length'];_0x2a6e8a++){const _0x14f479=_0x134bcd[_0x2a6e8a],_0x2ddbb4=_0x2a6e8a+0x1,_0x312c8a=_0x134bcd[_0x27ef72(0x1d0)],_0x4d81ee=_0x312c8a>0x1;_0x698b50[_0x27ef72(0x1e8)]&&(console[_0x27ef72(0x1c3)]('\x0a'+(_0x4d81ee?'Statement\x20'+_0x2ddbb4+'/'+_0x312c8a+':':'')),console['error'](_0x27ef72(0x1d5)+_0x698b50[_0x27ef72(0x1db)]),console[_0x27ef72(0x1c3)](_0x27ef72(0x1c8)+(_0xadcfd0||'td')),console['error']('Schema:\x20'+_0x2d1a23),console['error'](_0x27ef72(0x1d4)+_0x14f479));const _0x12b32d=_0x4d81ee?_0x27ef72(0x1ef)+_0x2ddbb4+'/'+_0x312c8a+_0x27ef72(0x1dc):_0x27ef72(0x1f4);try{const _0xc5e6ee=await withProgressSpinner(_0x12b32d,async _0x38d699=>{const _0x2fbc55=_0x27ef72,_0x493b16=await _0x1d0bef[_0x2fbc55(0x1f6)][_0x2fbc55(0x1d1)](_0x14f479,{'catalog':_0xadcfd0,'schema':_0x2d1a23,'onJobId':_0x1e1ae2=>{const _0x3b9543=_0x2fbc55;_0x38d699[_0x3b9543(0x1da)](_0x1e1ae2);},'onProgress':_0x153027=>{const _0x3f6f4f=_0x2fbc55;_0x38d699['setPhase'](_0x3f6f4f(0x1e4)+_0x153027[_0x3f6f4f(0x1cd)]+']'),_0x38d699[_0x3f6f4f(0x1ca)](formatRows(_0x153027['processedRows'])+_0x3f6f4f(0x1c9)+_0x153027[_0x3f6f4f(0x1e1)]+'/'+_0x153027['totalSplits']+'\x20splits');}});return _0x493b16;},{'verbose':_0x698b50['verbose']}),_0x127c7b=_0xc5e6ee[_0x27ef72(0x1e7)],_0x26e619=_0x127c7b['jobId']?_0x27ef72(0x1e3)+_0x127c7b[_0x27ef72(0x1de)]+']':'',_0x46b421=_0x4d81ee?_0x27ef72(0x1cf)+_0x2ddbb4+'/'+_0x312c8a+_0x27ef72(0x1d7):'';console['error']('✔\x20'+_0x46b421+_0x27ef72(0x1d6)+formatRows(_0x127c7b[_0x27ef72(0x1ce)][_0x27ef72(0x1c4)])+_0x27ef72(0x1c9)+(_0x27ef72(0x1f5)+formatElapsed(_0x127c7b[_0x27ef72(0x1ce)][_0x27ef72(0x1c7)])+_0x26e619));if(_0x4d81ee&&_0x15073c){const _0x6f9732=resolveOutputOptions(_0x44aea6),_0x21999d=await formatQueryOutput(_0x127c7b,_0x6f9732);_0x4e5fc9[_0x27ef72(0x1df)](_0x21999d);}else await handleQueryOutput(_0x127c7b,_0x44aea6);}catch(_0x4d0010){const _0x3af24f=_0x4d81ee?'Statement\x20'+_0x2ddbb4+'/'+_0x312c8a+':\x0a':'',_0x126ad9=_0x4d0010 instanceof SDKError?_0x4d0010['originalMessage']:_0x4d0010[_0x27ef72(0x1eb)];return console[_0x27ef72(0x1c3)](''+_0x3af24f+_0x126ad9),0x1;}}if(_0x134bcd[_0x27ef72(0x1d0)]>0x1&&_0x15073c&&_0x4e5fc9[_0x27ef72(0x1d0)]>0x0){const _0x4400ec=_0x4e5fc9[_0x27ef72(0x1e5)]('\x0a');writeFileSync(_0x698b50[_0x27ef72(0x1c6)],_0x4400ec),console[_0x27ef72(0x1c3)](_0x27ef72(0x1d8)+_0x698b50[_0x27ef72(0x1c6)]);}return 0x0;}catch(_0x4abb06){throw _0x4abb06;}}[a38_0x12be2f(0x1e2)](_0x5ec437){const _0x5b0692=a38_0x12be2f,_0x4cbe5b=_0x5ec437[_0x5b0692(0x1c2)][0x0],_0xda42da=_0x5ec437['options'][_0x5b0692(0x1e6)];if(!_0x4cbe5b&&!_0xda42da)return _0x5b0692(0x1ec);if(_0x4cbe5b&&_0xda42da)return _0x5b0692(0x1cb);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a39_0x3202(){const _0x3733e=['round','json','\x20scheduled\x20quer','list','last_job','never','\x20(use\x20--limit\x20to\x20see\x20more)','h\x20ago','Searching\x20scheduled\x20queries\x20matching\x20\x22','trim','No\x20scheduled\x20queries\x20found','d\x20ago','ended_at','Run\x20a\x20scheduled\x20query\x20immediately','dim','17496KfrPKQ','time','map','has_next_page','delete','Updating\x20schedule...','\x20job','Showing\x20first\x20','abs','INVALID_ARGUMENT','padEnd','11436muequE','join','3910bYruQH','schedules','nextRun','data','create','queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','updated_at','2706026SVpzMe','retry_limit','\x20matching\x20\x22','delay','repeat','Schedule\x20created:\x20','utf-8','soon','\x20(showing\x20','5dFoYuY','from','error','11cIHQRH','/app/queries/editor?queryId=','Listing\x20scheduled\x20queries...','Show\x20schedule\x20execution\x20history','schedule:show','\x20execution','\x20\x20Database:\x20','result','success','4963HOaYwu','3352284rxjnEN','Found\x20','Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Updating\x20schedule:\x20','schedule:history','verbose','start_at','count','\x20\x20→\x20','1dKQPOD','max','Deleting\x20schedule...','just\x20now','status','show','cron','schedule:update','Creating\x20schedule...','created_at','engine_version','Running\x20schedule:\x20','m\x20ago','validate','listQueries','entries','options','in\x20','toLocaleDateString','1827kbcgcD','Getting\x20schedule\x20history...','execute','job_id','time_zone','schedule:list','statusIcon','file','195xfxIOZ','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:delete','timezone','next_run_at','393gUhnqa','\x22...','num','executing_user_id','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','args','type','Cancelled','Running\x20schedule...','lastRun','table','query','...','Delete\x20a\x20scheduled\x20query','Create\x20a\x20scheduled\x20query','run','site','getTime','ies','Schedule\x20updated:\x20','length','3441978WPuDJv','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedule:create','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','description','jobs','retryLimit','scheduled_at','engineVersion','Getting\x20schedule\x20details...','\x20created','Failed\x20to\x20read\x20file:\x20','name','log','607124JeqsEf','format','output','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','database','Show\x20schedule\x20details','user','history'];a39_0x3202=function(){return _0x3733e;};return a39_0x3202();}const a39_0x1e2661=a39_0x40a5;(function(_0x175087,_0x104d1e){const _0x438f6d=a39_0x40a5,_0xd64ce1=_0x175087();while(!![]){try{const _0x36a793=-parseInt(_0x438f6d(0x1b3))/0x1*(parseInt(_0x438f6d(0x193))/0x2)+-parseInt(_0x438f6d(0x1d3))/0x3*(-parseInt(_0x438f6d(0x189))/0x4)+parseInt(_0x438f6d(0x19c))/0x5*(parseInt(_0x438f6d(0x158))/0x6)+-parseInt(_0x438f6d(0x1a8))/0x7*(-parseInt(_0x438f6d(0x17e))/0x8)+parseInt(_0x438f6d(0x1c6))/0x9*(parseInt(_0x438f6d(0x18b))/0xa)+parseInt(_0x438f6d(0x19f))/0xb*(parseInt(_0x438f6d(0x1a9))/0xc)+-parseInt(_0x438f6d(0x1ce))/0xd*(parseInt(_0x438f6d(0x167))/0xe);if(_0x36a793===_0x104d1e)break;else _0xd64ce1['push'](_0xd64ce1['shift']());}catch(_0x47b777){_0xd64ce1['push'](_0xd64ce1['shift']());}}}(a39_0x3202,0xd07f2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a39_0x40a5(_0x28085a,_0x4b1e74){_0x28085a=_0x28085a-0x152;const _0x3202c6=a39_0x3202();let _0x40a5ee=_0x3202c6[_0x28085a];return _0x40a5ee;}import{hyperlink}from'../sdk/util/formatters.js';import a39_0xee8d1e from'chalk';function formatRelativeTime(_0x541dfd){const _0x2c3499=a39_0x40a5,_0x5571bb=new Date(_0x541dfd),_0x210bb1=new Date(),_0x29a3c4=_0x5571bb[_0x2c3499(0x154)]()-_0x210bb1['getTime'](),_0x392a31=Math[_0x2c3499(0x186)](_0x29a3c4)/0x3e8,_0x45e65a=_0x29a3c4<0x0;if(_0x392a31<0x3c)return _0x45e65a?_0x2c3499(0x1b6):_0x2c3499(0x19a);else{if(_0x392a31<0xe10){const _0x2a9579=Math[_0x2c3499(0x16f)](_0x392a31/0x3c);return _0x45e65a?_0x2a9579+_0x2c3499(0x1bf):'in\x20'+_0x2a9579+'m';}else{if(_0x392a31<0x15180){const _0x48b81b=Math[_0x2c3499(0x16f)](_0x392a31/0xe10);return _0x45e65a?_0x48b81b+_0x2c3499(0x176):_0x2c3499(0x1c4)+_0x48b81b+'h';}else{if(_0x392a31<0x93a80){const _0x5b6c49=Math[_0x2c3499(0x16f)](_0x392a31/0x15180);return _0x45e65a?_0x5b6c49+_0x2c3499(0x17a):'in\x20'+_0x5b6c49+'d';}else return _0x5571bb[_0x2c3499(0x1c5)]();}}}}export class ScheduleListCommand extends BaseCommand{[a39_0x1e2661(0x165)]=a39_0x1e2661(0x1cb);['description']='List\x20scheduled\x20queries';async['execute'](_0x52aa27){const _0x2c7554=a39_0x1e2661,{options:_0x460ecf,args:_0x726147,tdx:_0x52e4e2}=_0x52aa27,_0x14eca3=resolveLimit(_0x460ecf['limit'],DEFAULT_DISPLAY_LIMIT),_0x5d75d8=_0x726147[0x0],_0x518ff4=_0x5d75d8?_0x2c7554(0x177)+_0x5d75d8+_0x2c7554(0x1d4):_0x2c7554(0x1a1),_0x22f2ce=await withSpinner(_0x518ff4,()=>_0x52e4e2['schedules'][_0x2c7554(0x1c1)]({'limit':_0x14eca3,'scheduled':!![],'pattern':_0x5d75d8}),{'verbose':_0x460ecf[_0x2c7554(0x1af)]}),_0x58f036=_0x22f2ce[_0x2c7554(0x18e)][_0x2c7554(0x190)],_0x42a2b2=_0x22f2ce[_0x2c7554(0x18e)]['pagination'][_0x2c7554(0x181)],_0x30fa99=_0x5d75d8?_0x2c7554(0x195)+_0x5d75d8+'\x22':'';_0x42a2b2?console[_0x2c7554(0x19e)](_0x2c7554(0x185)+_0x58f036['length']+'\x20schedules'+_0x30fa99+_0x2c7554(0x175)):console[_0x2c7554(0x19e)](_0x2c7554(0x1aa)+_0x58f036[_0x2c7554(0x157)]+_0x2c7554(0x171)+(_0x58f036[_0x2c7554(0x157)]!==0x1?_0x2c7554(0x155):'y')+_0x30fa99);if(_0x460ecf[_0x2c7554(0x168)]===_0x2c7554(0x170)||_0x460ecf[_0x2c7554(0x168)]==='jsonl'||_0x460ecf['format']===_0x2c7554(0x1dd)||_0x460ecf[_0x2c7554(0x168)]==='tsv'){const _0x7d27b3=_0x58f036[_0x2c7554(0x180)](_0x36ec30=>({'id':_0x36ec30['id'],'name':_0x36ec30['name'],'cron':_0x36ec30[_0x2c7554(0x1b9)],'database':_0x36ec30[_0x2c7554(0x16b)]?.['name'],'type':_0x36ec30[_0x2c7554(0x1d9)],'timezone':_0x36ec30[_0x2c7554(0x1ca)],'user_name':_0x36ec30[_0x2c7554(0x16d)]?.[_0x2c7554(0x165)],'updated_at':_0x36ec30[_0x2c7554(0x192)],'next_run_at':_0x36ec30['next_run_at'],'last_job_status':_0x36ec30[_0x2c7554(0x173)]?.[_0x2c7554(0x1b7)]}));await handleSDKOutput(_0x7d27b3,_0x460ecf);}else{if(_0x58f036[_0x2c7554(0x157)]===0x0)console[_0x2c7554(0x166)](_0x2c7554(0x179));else{const _0x58d1d1=_0x460ecf[_0x2c7554(0x153)],_0x43b4ed=_0x58f036['map'](_0x3b5ccc=>{const _0x45398f=_0x2c7554,_0x1c2c04=_0x3b5ccc[_0x45398f(0x173)]?.['status']?_0x3b5ccc[_0x45398f(0x173)][_0x45398f(0x1b7)]==='success'?'✓':'✗':'-',_0x447be3=_0x3b5ccc[_0x45398f(0x173)]?.[_0x45398f(0x17b)]?formatRelativeTime(_0x3b5ccc['last_job'][_0x45398f(0x17b)]):_0x45398f(0x174),_0x28c781=_0x3b5ccc[_0x45398f(0x1d2)]?formatRelativeTime(_0x3b5ccc['next_run_at']):'-',_0x478915=_0x3b5ccc[_0x45398f(0x1b9)]||'',_0x271d48=_0x3b5ccc[_0x45398f(0x165)]||'(unnamed)',_0x205da2=getConsoleUrl(_0x58d1d1,_0x45398f(0x1a0)+_0x3b5ccc['id']);return{'statusIcon':_0x1c2c04,'lastRun':_0x447be3,'nextRun':_0x28c781,'cron':_0x478915,'name':_0x271d48,'queryUrl':_0x205da2,'status':_0x3b5ccc['last_job']?.[_0x45398f(0x1b7)]};}),_0x229b14=Math[_0x2c7554(0x1b4)](..._0x43b4ed[_0x2c7554(0x180)](_0x51bf82=>_0x51bf82[_0x2c7554(0x1dc)][_0x2c7554(0x157)])),_0x3836cd=Math['max'](..._0x43b4ed[_0x2c7554(0x180)](_0x3c42cf=>_0x3c42cf['nextRun']['length'])),_0x3e1d9c=Math[_0x2c7554(0x1b4)](..._0x43b4ed[_0x2c7554(0x180)](_0x3f1a67=>_0x3f1a67[_0x2c7554(0x1b9)][_0x2c7554(0x157)])),_0x3165be=_0x43b4ed[_0x2c7554(0x180)](_0x513c34=>{const _0x2e25e0=_0x2c7554,_0x297a90=_0x513c34[_0x2e25e0(0x1b7)]===_0x2e25e0(0x1a7)?a39_0xee8d1e['green'](_0x513c34['statusIcon']):_0x513c34[_0x2e25e0(0x1b7)]===_0x2e25e0(0x19e)?a39_0xee8d1e['red'](_0x513c34[_0x2e25e0(0x1cc)]):a39_0xee8d1e[_0x2e25e0(0x17d)](_0x513c34[_0x2e25e0(0x1cc)]),_0xdfe13f=_0x513c34[_0x2e25e0(0x1dc)][_0x2e25e0(0x188)](_0x229b14),_0x5ab93b=_0x513c34[_0x2e25e0(0x18d)][_0x2e25e0(0x188)](_0x3836cd),_0x53943a=_0x513c34['cron']?a39_0xee8d1e['cyan'](_0x513c34[_0x2e25e0(0x1b9)]['padEnd'](_0x3e1d9c)):'\x20'[_0x2e25e0(0x197)](_0x3e1d9c),_0x5e8188=hyperlink(_0x513c34['name'],_0x513c34['queryUrl']);return'📅\x20'+_0x297a90+'\x20'+_0xdfe13f+_0x2e25e0(0x1b2)+_0x5ab93b+'\x20\x20'+_0x53943a+'\x20\x20'+_0x5e8188;});await writeOutput(_0x3165be[_0x2c7554(0x18a)]('\x0a'),_0x460ecf[_0x2c7554(0x169)],_0x2c7554(0x172));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a39_0x1e2661(0x165)]=a39_0x1e2661(0x1a3);[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x16c);[a39_0x1e2661(0x1c0)](_0x1f0c66){const _0x1b919b=a39_0x1e2661,_0x146158=_0x1f0c66[_0x1b919b(0x1d8)][0x0];if(!_0x146158)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x14e2c1){const _0x4e5651=a39_0x1e2661,{options:_0x114392,args:_0x2a40d5,tdx:_0x5b0ce7}=_0x14e2c1,_0x11b8b6=_0x2a40d5[0x0],_0x1c0aa1=await withSpinner(_0x4e5651(0x162),()=>_0x5b0ce7[_0x4e5651(0x18c)][_0x4e5651(0x1b8)](_0x11b8b6),{'verbose':_0x114392['verbose']}),_0x197de6=_0x1c0aa1[_0x4e5651(0x18e)],_0x29b15d={'name':_0x197de6[_0x4e5651(0x165)],'cron':_0x197de6[_0x4e5651(0x1b9)],'database':_0x197de6['database'],'type':_0x197de6[_0x4e5651(0x1d9)],'timezone':_0x197de6['timezone'],'user_name':_0x197de6['user_name'],'created_at':_0x197de6[_0x4e5651(0x1bc)],'engine_version':_0x197de6['engine_version'],'executing_user_id':_0x197de6[_0x4e5651(0x1d6)],'query':_0x197de6[_0x4e5651(0x1de)],'delay':_0x197de6[_0x4e5651(0x196)],'priority':_0x197de6[_0x4e5651(0x15b)],'retry_limit':_0x197de6[_0x4e5651(0x194)],..._0x197de6[_0x4e5651(0x1a6)]&&{'result':_0x197de6[_0x4e5651(0x1a6)]}};return await handleSingleObjectOutput(_0x29b15d,_0x114392),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a39_0x1e2661(0x15a);[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x1e1);[a39_0x1e2661(0x1c0)](_0xc065f5){const _0x3c7b90=a39_0x1e2661,_0x4697e4=_0xc065f5[_0x3c7b90(0x1d8)][0x0];if(!_0x4697e4)return _0x3c7b90(0x15c);const _0x230da1=_0xc065f5[_0x3c7b90(0x1c3)];if(!_0x230da1[_0x3c7b90(0x16b)])return _0x3c7b90(0x1cf);return undefined;}async[a39_0x1e2661(0x1c8)](_0x5e2ae4){const _0x1ba98a=a39_0x1e2661,{options:_0x3199c9,args:_0xd7b2bd,tdx:_0x56e579}=_0x5e2ae4,_0x5199cb=_0xd7b2bd[0x0],_0x2bcf16=_0x3199c9,_0x4ccb27=_0x2bcf16['database'],_0x17d182=_0x2bcf16[_0x1ba98a(0x1cd)],_0x11e669=_0x2bcf16[_0x1ba98a(0x1d9)]||'trino';let _0x32b310;try{_0x32b310=readFileSync(_0x17d182,_0x1ba98a(0x199))[_0x1ba98a(0x178)]();}catch(_0x20f311){throw new SDKError(ErrorCode[_0x1ba98a(0x187)],_0x1ba98a(0x164)+_0x17d182,_0x20f311 instanceof Error?_0x20f311:undefined);}if(!_0x32b310)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x18106c={'database':_0x4ccb27,'query':_0x32b310,'type':_0x11e669};if(_0x2bcf16[_0x1ba98a(0x1b9)])_0x18106c[_0x1ba98a(0x1b9)]=_0x2bcf16['cron'];if(_0x2bcf16[_0x1ba98a(0x1d1)])_0x18106c[_0x1ba98a(0x1d1)]=_0x2bcf16[_0x1ba98a(0x1d1)];if(_0x2bcf16['delay']!==undefined)_0x18106c['delay']=Number(_0x2bcf16['delay']);if(_0x2bcf16[_0x1ba98a(0x15b)]!==undefined)_0x18106c[_0x1ba98a(0x15b)]=Number(_0x2bcf16[_0x1ba98a(0x15b)]);if(_0x2bcf16[_0x1ba98a(0x15f)]!==undefined)_0x18106c[_0x1ba98a(0x194)]=Number(_0x2bcf16[_0x1ba98a(0x15f)]);if(_0x2bcf16[_0x1ba98a(0x161)])_0x18106c[_0x1ba98a(0x1bd)]=_0x2bcf16[_0x1ba98a(0x161)];if(_0x2bcf16['result'])_0x18106c[_0x1ba98a(0x1a6)]=_0x2bcf16[_0x1ba98a(0x1a6)];if(_0x3199c9[_0x1ba98a(0x1af)]){console[_0x1ba98a(0x19e)]('Creating\x20schedule:\x20'+_0x5199cb),console[_0x1ba98a(0x19e)](_0x1ba98a(0x1a5)+_0x4ccb27),console[_0x1ba98a(0x19e)]('\x20\x20Type:\x20'+_0x11e669);if(_0x18106c['cron'])console[_0x1ba98a(0x19e)]('\x20\x20Cron:\x20'+_0x18106c[_0x1ba98a(0x1b9)]);if(_0x18106c[_0x1ba98a(0x1d1)])console[_0x1ba98a(0x19e)]('\x20\x20Timezone:\x20'+_0x18106c['timezone']);}const _0x5efd9b=await withSpinner(_0x1ba98a(0x1bb),()=>_0x56e579[_0x1ba98a(0x18c)][_0x1ba98a(0x18f)](_0x5199cb,_0x18106c),{'verbose':_0x3199c9[_0x1ba98a(0x1af)]});return console[_0x1ba98a(0x19e)](_0x1ba98a(0x198)+_0x5efd9b['data']['name']),await handleSingleObjectOutput(_0x5efd9b['data'],_0x3199c9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a39_0x1e2661(0x1ba);[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x1ab);[a39_0x1e2661(0x1c0)](_0x422b79){const _0x106438=a39_0x1e2661,_0x1a93d7=_0x422b79['args'][0x0];if(!_0x1a93d7)return _0x106438(0x191);return undefined;}async[a39_0x1e2661(0x1c8)](_0x2fd57e){const _0x38a520=a39_0x1e2661,{options:_0x49134c,args:_0xca4dd0,tdx:_0x3690fa}=_0x2fd57e,_0x1c6073=_0xca4dd0[0x0],_0x2dd3ae=_0x49134c,_0x564bc2={};if(_0x2dd3ae[_0x38a520(0x16b)])_0x564bc2[_0x38a520(0x16b)]=_0x2dd3ae[_0x38a520(0x16b)];if(_0x2dd3ae[_0x38a520(0x1d9)])_0x564bc2[_0x38a520(0x1d9)]=_0x2dd3ae[_0x38a520(0x1d9)];if(_0x2dd3ae['cron'])_0x564bc2[_0x38a520(0x1b9)]=_0x2dd3ae['cron'];if(_0x2dd3ae[_0x38a520(0x1d1)])_0x564bc2['timezone']=_0x2dd3ae[_0x38a520(0x1d1)];if(_0x2dd3ae[_0x38a520(0x196)]!==undefined)_0x564bc2[_0x38a520(0x196)]=Number(_0x2dd3ae['delay']);if(_0x2dd3ae['priority']!==undefined)_0x564bc2['priority']=Number(_0x2dd3ae[_0x38a520(0x15b)]);if(_0x2dd3ae[_0x38a520(0x15f)]!==undefined)_0x564bc2[_0x38a520(0x194)]=Number(_0x2dd3ae[_0x38a520(0x15f)]);if(_0x2dd3ae['engineVersion'])_0x564bc2[_0x38a520(0x1bd)]=_0x2dd3ae['engineVersion'];if(_0x2dd3ae[_0x38a520(0x1a6)])_0x564bc2[_0x38a520(0x1a6)]=_0x2dd3ae[_0x38a520(0x1a6)];if(_0x2dd3ae['file'])try{_0x564bc2[_0x38a520(0x1de)]=readFileSync(_0x2dd3ae['file'],_0x38a520(0x199))['trim']();}catch(_0x34461a){throw new SDKError(ErrorCode[_0x38a520(0x187)],_0x38a520(0x164)+_0x2dd3ae[_0x38a520(0x1cd)],_0x34461a instanceof Error?_0x34461a:undefined);}if(Object['keys'](_0x564bc2)[_0x38a520(0x157)]===0x0)throw new SDKError(ErrorCode[_0x38a520(0x187)],_0x38a520(0x1d7));if(_0x49134c[_0x38a520(0x1af)]){console['error'](_0x38a520(0x1ad)+_0x1c6073);for(const [_0x256ead,_0x5940a0]of Object[_0x38a520(0x1c2)](_0x564bc2)){_0x256ead===_0x38a520(0x1de)?console['error']('\x20\x20'+_0x256ead+':\x20'+_0x5940a0['substring'](0x0,0x32)+_0x38a520(0x1df)):console[_0x38a520(0x19e)]('\x20\x20'+_0x256ead+':\x20'+_0x5940a0);}}const _0x1b422b=await withSpinner(_0x38a520(0x183),()=>_0x3690fa[_0x38a520(0x18c)]['update'](_0x1c6073,_0x564bc2),{'verbose':_0x49134c[_0x38a520(0x1af)]});return console['error'](_0x38a520(0x156)+_0x1b422b[_0x38a520(0x18e)][_0x38a520(0x165)]),await handleSingleObjectOutput(_0x1b422b[_0x38a520(0x18e)],_0x49134c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a39_0x1e2661(0x165)]=a39_0x1e2661(0x1d0);[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x1e0);[a39_0x1e2661(0x1c0)](_0x4e3f9f){const _0x3c2f1b=a39_0x1e2661,_0x208008=_0x4e3f9f[_0x3c2f1b(0x1d8)][0x0];if(!_0x208008)return _0x3c2f1b(0x1ac);return undefined;}async[a39_0x1e2661(0x1c8)](_0x42b0be){const _0x5d2144=a39_0x1e2661,{options:_0x418451,args:_0x3bb48a,tdx:_0x4645c8}=_0x42b0be,_0x2b54b2=_0x3bb48a[0x0];if(!_0x418451['yes']){const _0x5ad161=await confirm(_0x5d2144(0x159)+_0x2b54b2+'\x22?');if(!_0x5ad161)return console[_0x5d2144(0x19e)](_0x5d2144(0x1da)),0x0;}const _0x140ca5=await withSpinner(_0x5d2144(0x1b5),()=>_0x4645c8[_0x5d2144(0x18c)][_0x5d2144(0x182)](_0x2b54b2),{'verbose':_0x418451['verbose']});return console[_0x5d2144(0x19e)]('Schedule\x20deleted:\x20'+_0x140ca5[_0x5d2144(0x18e)][_0x5d2144(0x165)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a39_0x1e2661(0x165)]='schedule:run';[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x17c);['validate'](_0x1a1bed){const _0x2a98e1=_0x1a1bed['args'][0x0];if(!_0x2a98e1)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a39_0x1e2661(0x1c8)](_0x460836){const _0x23503c=a39_0x1e2661,{options:_0x22aa3a,args:_0x29b2aa,tdx:_0x2b500c}=_0x460836,_0x28bf02=_0x29b2aa[0x0],_0x387fc9=_0x22aa3a,_0x28f2d5=_0x387fc9[_0x23503c(0x17f)],_0x448291=_0x387fc9[_0x23503c(0x1d5)]!==undefined?Number(_0x387fc9[_0x23503c(0x1d5)]):undefined;if(_0x22aa3a[_0x23503c(0x1af)]){console[_0x23503c(0x19e)](_0x23503c(0x1be)+_0x28bf02);if(_0x28f2d5)console[_0x23503c(0x19e)]('\x20\x20Time:\x20'+_0x28f2d5);if(_0x448291)console[_0x23503c(0x19e)]('\x20\x20Num:\x20'+_0x448291);}const _0x2230ed=await withSpinner(_0x23503c(0x1db),()=>_0x2b500c[_0x23503c(0x18c)][_0x23503c(0x152)](_0x28bf02,{'time':_0x28f2d5,'num':_0x448291}),{'verbose':_0x22aa3a[_0x23503c(0x1af)]}),_0x4f3d02=_0x2230ed['data'][_0x23503c(0x15e)];console[_0x23503c(0x19e)]('Schedule\x20run\x20submitted:\x20'+_0x4f3d02[_0x23503c(0x157)]+_0x23503c(0x184)+(_0x4f3d02[_0x23503c(0x157)]!==0x1?'s':'')+_0x23503c(0x163));for(const _0x1218e3 of _0x4f3d02){console['error']('\x20\x20Job\x20ID:\x20'+_0x1218e3[_0x23503c(0x1c9)]);}return await handleSDKOutput(_0x4f3d02,_0x22aa3a),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a39_0x1e2661(0x165)]=a39_0x1e2661(0x1ae);[a39_0x1e2661(0x15d)]=a39_0x1e2661(0x1a2);[a39_0x1e2661(0x1c0)](_0x44bfec){const _0x1f0540=a39_0x1e2661,_0x2817ff=_0x44bfec['args'][0x0];if(!_0x2817ff)return _0x1f0540(0x16a);return undefined;}async['execute'](_0x299e20){const _0x5ae405=a39_0x1e2661,{options:_0x543239,args:_0x399786,tdx:_0x562740}=_0x299e20,_0x50cc39=_0x399786[0x0],_0x55c134=_0x543239,_0x4dc348=_0x55c134[_0x5ae405(0x19d)]!==undefined?Number(_0x55c134[_0x5ae405(0x19d)]):undefined,_0xc3e403=_0x55c134['to']!==undefined?Number(_0x55c134['to']):undefined,_0x678d00=await withSpinner(_0x5ae405(0x1c7),()=>_0x562740[_0x5ae405(0x18c)][_0x5ae405(0x16e)](_0x50cc39,{'from':_0x4dc348,'to':_0xc3e403}),{'verbose':_0x543239['verbose']}),_0x4c562e=_0x678d00[_0x5ae405(0x18e)];console['error'](_0x5ae405(0x1aa)+_0x4c562e['count']+_0x5ae405(0x1a4)+(_0x4c562e[_0x5ae405(0x1b1)]!==0x1?'s':'')+_0x5ae405(0x19b)+_0x4c562e[_0x5ae405(0x19d)]+'-'+_0x4c562e['to']+')');const _0x223837=_0x4c562e[_0x5ae405(0x16e)][_0x5ae405(0x180)](_0x5e5394=>({'job_id':_0x5e5394[_0x5ae405(0x1c9)],'type':_0x5e5394[_0x5ae405(0x1d9)],'status':_0x5e5394[_0x5ae405(0x1b7)],'scheduled_at':_0x5e5394[_0x5ae405(0x160)],'created_at':_0x5e5394[_0x5ae405(0x1bc)],'start_at':_0x5e5394[_0x5ae405(0x1b0)],'end_at':_0x5e5394['end_at']}));return await handleSDKOutput(_0x223837,_0x543239),0x0;}}
|
|
1
|
+
const a39_0xeb912=a39_0x57fa;(function(_0x4d0d01,_0x16d7f4){const _0x17b879=a39_0x57fa,_0x40d827=_0x4d0d01();while(!![]){try{const _0x3f1d9d=parseInt(_0x17b879(0x105))/0x1*(-parseInt(_0x17b879(0xd1))/0x2)+parseInt(_0x17b879(0xe2))/0x3+parseInt(_0x17b879(0xd7))/0x4+parseInt(_0x17b879(0x9d))/0x5*(-parseInt(_0x17b879(0xc0))/0x6)+parseInt(_0x17b879(0xa9))/0x7+parseInt(_0x17b879(0xb9))/0x8*(-parseInt(_0x17b879(0xff))/0x9)+-parseInt(_0x17b879(0xb1))/0xa*(-parseInt(_0x17b879(0x89))/0xb);if(_0x3f1d9d===_0x16d7f4)break;else _0x40d827['push'](_0x40d827['shift']());}catch(_0x42b8ad){_0x40d827['push'](_0x40d827['shift']());}}}(a39_0x4ce1,0xd9fcb));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x57fa(_0x4737a0,_0x510d2b){_0x4737a0=_0x4737a0-0x7c;const _0x4ce19f=a39_0x4ce1();let _0x57fa19=_0x4ce19f[_0x4737a0];return _0x57fa19;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a39_0x4ce1(){const _0x42e5d4=['\x20\x20Job\x20ID:\x20','Delete\x20a\x20scheduled\x20query','Show\x20schedule\x20execution\x20history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','list','schedule:run','\x20\x20Type:\x20','error','📅\x20','Schedule\x20created:\x20','Deleting\x20schedule...','1339009JWbdLe','Running\x20schedule:\x20','h\x20ago','\x20(showing\x20','\x20\x20→\x20','entries','table','format','10IeYqvk','updated_at','\x20created','Listing\x20scheduled\x20queries...','last_job','lastRun','join','map','2184VhmCGB','queries','Update\x20a\x20scheduled\x20query','Showing\x20first\x20','dim','\x20schedules','limit','3314646BVuLaj','Run\x20a\x20scheduled\x20query\x20immediately','engine_version','pagination','schedule:list','statusIcon','args','schedule:show','Getting\x20schedule\x20history...','\x20(use\x20--limit\x20to\x20see\x20more)','nextRun','Show\x20schedule\x20details','from','soon','options','green','trino','17970VIzRJV','created_at','Updating\x20schedule:\x20','time','site','num','2055272aGmPlM','round','status','Getting\x20schedule\x20details...','description','No\x20scheduled\x20queries\x20found','priority','getTime','\x20execution','List\x20scheduled\x20queries','\x20job','3802758VUZZsL','Schedule\x20run\x20submitted:\x20','result','\x22...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','padEnd','jobs','/app/queries/editor?queryId=','Failed\x20to\x20read\x20file:\x20','end_at','INVALID_ARGUMENT','cron','timezone','keys','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','length','verbose','data','repeat','Schedule\x20updated:\x20','...','\x20\x20Timezone:\x20','next_run_at','file','never','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','(unnamed)','success','\x20matching\x20\x22','53595bJHDsd','abs','database','\x20\x20Time:\x20','engineVersion','just\x20now','91JwbZTZ','queryUrl','history','Creating\x20schedule:\x20','query','m\x20ago','utf-8','has_next_page','schedules','substring','show','Cancelled','in\x20','validate','retryLimit','Creating\x20schedule...','\x20\x20Num:\x20','33229427agQZzY','scheduled_at','delay','schedule:delete','execute','Searching\x20scheduled\x20queries\x20matching\x20\x22','count','trim','name','cyan','Running\x20schedule...','Create\x20a\x20scheduled\x20query','schedule:create','\x20\x20Cron:\x20','job_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','type','retry_limit','max','Found\x20','15adTRPP'];a39_0x4ce1=function(){return _0x42e5d4;};return a39_0x4ce1();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a39_0x17a7de from'chalk';function formatRelativeTime(_0xde79f8){const _0x205cf3=a39_0x57fa,_0x5b705e=new Date(_0xde79f8),_0x2f6b7b=new Date(),_0x2d159a=_0x5b705e['getTime']()-_0x2f6b7b[_0x205cf3(0xde)](),_0x436692=Math[_0x205cf3(0x100)](_0x2d159a)/0x3e8,_0x2ae4cb=_0x2d159a<0x0;if(_0x436692<0x3c)return _0x2ae4cb?_0x205cf3(0x104):_0x205cf3(0xcd);else{if(_0x436692<0xe10){const _0x4cfe06=Math[_0x205cf3(0xd8)](_0x436692/0x3c);return _0x2ae4cb?_0x4cfe06+_0x205cf3(0x7d):_0x205cf3(0x84)+_0x4cfe06+'m';}else{if(_0x436692<0x15180){const _0x30af56=Math[_0x205cf3(0xd8)](_0x436692/0xe10);return _0x2ae4cb?_0x30af56+_0x205cf3(0xab):_0x205cf3(0x84)+_0x30af56+'h';}else{if(_0x436692<0x93a80){const _0x46166e=Math[_0x205cf3(0xd8)](_0x436692/0x15180);return _0x2ae4cb?_0x46166e+'d\x20ago':_0x205cf3(0x84)+_0x46166e+'d';}else return _0x5b705e['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a39_0xeb912(0x91)]=a39_0xeb912(0xc4);[a39_0xeb912(0xdb)]=a39_0xeb912(0xe0);async['execute'](_0x575655){const _0x5acfc1=a39_0xeb912,{options:_0x7cada2,args:_0x4feed3,tdx:_0x1a8c3e}=_0x575655,_0xbcbb09=resolveLimit(_0x7cada2[_0x5acfc1(0xbf)],DEFAULT_DISPLAY_LIMIT),_0x3243cb=_0x4feed3[0x0],_0x3d1ce3=_0x3243cb?_0x5acfc1(0x8e)+_0x3243cb+_0x5acfc1(0xe5):_0x5acfc1(0xb4),_0x3486ba=await withSpinner(_0x3d1ce3,()=>_0x1a8c3e[_0x5acfc1(0x80)]['listQueries']({'limit':_0xbcbb09,'scheduled':!![],'pattern':_0x3243cb}),{'verbose':_0x7cada2[_0x5acfc1(0xf2)]}),_0x25f749=_0x3486ba[_0x5acfc1(0xf3)][_0x5acfc1(0xba)],_0x52fe77=_0x3486ba[_0x5acfc1(0xf3)][_0x5acfc1(0xc3)][_0x5acfc1(0x7f)],_0x48f442=_0x3243cb?_0x5acfc1(0xfe)+_0x3243cb+'\x22':'';_0x52fe77?console['error'](_0x5acfc1(0xbc)+_0x25f749[_0x5acfc1(0xf1)]+_0x5acfc1(0xbe)+_0x48f442+_0x5acfc1(0xc9)):console[_0x5acfc1(0xa5)]('Found\x20'+_0x25f749[_0x5acfc1(0xf1)]+'\x20scheduled\x20quer'+(_0x25f749[_0x5acfc1(0xf1)]!==0x1?'ies':'y')+_0x48f442);if(_0x7cada2['format']==='json'||_0x7cada2[_0x5acfc1(0xb0)]==='jsonl'||_0x7cada2[_0x5acfc1(0xb0)]===_0x5acfc1(0xaf)||_0x7cada2[_0x5acfc1(0xb0)]==='tsv'){const _0x35ae20=_0x25f749[_0x5acfc1(0xb8)](_0x42d367=>({'id':_0x42d367['id'],'name':_0x42d367[_0x5acfc1(0x91)],'cron':_0x42d367[_0x5acfc1(0xed)],'database':_0x42d367['database']?.['name'],'type':_0x42d367[_0x5acfc1(0x99)],'timezone':_0x42d367['time_zone'],'user_name':_0x42d367['user']?.[_0x5acfc1(0x91)],'updated_at':_0x42d367[_0x5acfc1(0xb2)],'next_run_at':_0x42d367[_0x5acfc1(0xf8)],'last_job_status':_0x42d367[_0x5acfc1(0xb5)]?.['status']}));await handleSDKOutput(_0x35ae20,_0x7cada2);}else{if(_0x25f749['length']===0x0)console['log'](_0x5acfc1(0xdc));else{const _0x8ac392=_0x7cada2[_0x5acfc1(0xd5)],_0x56e95b=_0x25f749['map'](_0xcb55b1=>{const _0x214c4c=_0x5acfc1,_0xac4c1d=_0xcb55b1['last_job']?.['status']?_0xcb55b1[_0x214c4c(0xb5)][_0x214c4c(0xd9)]===_0x214c4c(0xfd)?'✓':'✗':'-',_0xf840ef=_0xcb55b1[_0x214c4c(0xb5)]?.['ended_at']?formatRelativeTime(_0xcb55b1[_0x214c4c(0xb5)]['ended_at']):_0x214c4c(0xfa),_0x1e113c=_0xcb55b1[_0x214c4c(0xf8)]?formatRelativeTime(_0xcb55b1['next_run_at']):'-',_0x2b6ba0=_0xcb55b1[_0x214c4c(0xed)]||'',_0x54b8fb=_0xcb55b1[_0x214c4c(0x91)]||_0x214c4c(0xfc),_0x48700d=getConsoleUrl(_0x8ac392,_0x214c4c(0xe9)+_0xcb55b1['id']);return{'statusIcon':_0xac4c1d,'lastRun':_0xf840ef,'nextRun':_0x1e113c,'cron':_0x2b6ba0,'name':_0x54b8fb,'queryUrl':_0x48700d,'status':_0xcb55b1[_0x214c4c(0xb5)]?.[_0x214c4c(0xd9)]};}),_0x4219e2=Math[_0x5acfc1(0x9b)](..._0x56e95b[_0x5acfc1(0xb8)](_0x7ef474=>_0x7ef474[_0x5acfc1(0xb6)]['length'])),_0x17518c=Math[_0x5acfc1(0x9b)](..._0x56e95b['map'](_0x3026cd=>_0x3026cd[_0x5acfc1(0xca)][_0x5acfc1(0xf1)])),_0x5c37f4=Math[_0x5acfc1(0x9b)](..._0x56e95b[_0x5acfc1(0xb8)](_0x4ddb4a=>_0x4ddb4a[_0x5acfc1(0xed)][_0x5acfc1(0xf1)])),_0x4e8810=_0x56e95b[_0x5acfc1(0xb8)](_0x10b67e=>{const _0x3fc121=_0x5acfc1,_0x14014e=_0x10b67e[_0x3fc121(0xd9)]===_0x3fc121(0xfd)?a39_0x17a7de[_0x3fc121(0xcf)](_0x10b67e[_0x3fc121(0xc5)]):_0x10b67e[_0x3fc121(0xd9)]==='error'?a39_0x17a7de['red'](_0x10b67e['statusIcon']):a39_0x17a7de[_0x3fc121(0xbd)](_0x10b67e['statusIcon']),_0x532cf7=_0x10b67e[_0x3fc121(0xb6)]['padEnd'](_0x4219e2),_0x11b7c6=_0x10b67e[_0x3fc121(0xca)][_0x3fc121(0xe7)](_0x17518c),_0x5aaf57=_0x10b67e[_0x3fc121(0xed)]?a39_0x17a7de[_0x3fc121(0x92)](_0x10b67e[_0x3fc121(0xed)][_0x3fc121(0xe7)](_0x5c37f4)):'\x20'[_0x3fc121(0xf4)](_0x5c37f4),_0x4bf512=hyperlink(_0x10b67e['name'],_0x10b67e[_0x3fc121(0x106)]);return _0x3fc121(0xa6)+_0x14014e+'\x20'+_0x532cf7+_0x3fc121(0xad)+_0x11b7c6+'\x20\x20'+_0x5aaf57+'\x20\x20'+_0x4bf512;});await writeOutput(_0x4e8810[_0x5acfc1(0xb7)]('\x0a'),_0x7cada2['output'],_0x5acfc1(0xa2));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a39_0xeb912(0x91)]=a39_0xeb912(0xc7);['description']=a39_0xeb912(0xcb);['validate'](_0x51f666){const _0x2f4934=a39_0xeb912,_0xeb576d=_0x51f666[_0x2f4934(0xc6)][0x0];if(!_0xeb576d)return _0x2f4934(0xe6);return undefined;}async[a39_0xeb912(0x8d)](_0x3441f5){const _0x343ab4=a39_0xeb912,{options:_0x358ad8,args:_0x5cd4cc,tdx:_0x19a462}=_0x3441f5,_0x4acb7e=_0x5cd4cc[0x0],_0x3167e1=await withSpinner(_0x343ab4(0xda),()=>_0x19a462[_0x343ab4(0x80)][_0x343ab4(0x82)](_0x4acb7e),{'verbose':_0x358ad8[_0x343ab4(0xf2)]}),_0x442d5d=_0x3167e1[_0x343ab4(0xf3)],_0x489243={'name':_0x442d5d['name'],'cron':_0x442d5d[_0x343ab4(0xed)],'database':_0x442d5d[_0x343ab4(0x101)],'type':_0x442d5d[_0x343ab4(0x99)],'timezone':_0x442d5d[_0x343ab4(0xee)],'user_name':_0x442d5d['user_name'],'created_at':_0x442d5d[_0x343ab4(0xd2)],'engine_version':_0x442d5d[_0x343ab4(0xc2)],'executing_user_id':_0x442d5d['executing_user_id'],'query':_0x442d5d[_0x343ab4(0x7c)],'delay':_0x442d5d['delay'],'priority':_0x442d5d[_0x343ab4(0xdd)],'retry_limit':_0x442d5d[_0x343ab4(0x9a)],..._0x442d5d[_0x343ab4(0xe4)]&&{'result':_0x442d5d['result']}};return await handleSingleObjectOutput(_0x489243,_0x358ad8),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a39_0xeb912(0x91)]=a39_0xeb912(0x95);[a39_0xeb912(0xdb)]=a39_0xeb912(0x94);[a39_0xeb912(0x85)](_0x58554c){const _0x1591fb=a39_0xeb912,_0x3c50df=_0x58554c[_0x1591fb(0xc6)][0x0];if(!_0x3c50df)return _0x1591fb(0xa1);const _0xb0bdb4=_0x58554c[_0x1591fb(0xce)];if(!_0xb0bdb4['database'])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x14458d){const _0x110240=a39_0xeb912,{options:_0x5e791f,args:_0x4e0807,tdx:_0x446157}=_0x14458d,_0x51a9ed=_0x4e0807[0x0],_0x5e59e2=_0x5e791f,_0x30d17a=_0x5e59e2[_0x110240(0x101)],_0x43c0d4=_0x5e59e2[_0x110240(0xf9)],_0x4dba83=_0x5e59e2[_0x110240(0x99)]||_0x110240(0xd0);let _0x36c044;try{_0x36c044=readFileSync(_0x43c0d4,'utf-8')['trim']();}catch(_0x6df821){throw new SDKError(ErrorCode[_0x110240(0xec)],_0x110240(0xea)+_0x43c0d4,_0x6df821 instanceof Error?_0x6df821:undefined);}if(!_0x36c044)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0xf574f9={'database':_0x30d17a,'query':_0x36c044,'type':_0x4dba83};if(_0x5e59e2[_0x110240(0xed)])_0xf574f9['cron']=_0x5e59e2[_0x110240(0xed)];if(_0x5e59e2[_0x110240(0xee)])_0xf574f9[_0x110240(0xee)]=_0x5e59e2[_0x110240(0xee)];if(_0x5e59e2[_0x110240(0x8b)]!==undefined)_0xf574f9[_0x110240(0x8b)]=Number(_0x5e59e2[_0x110240(0x8b)]);if(_0x5e59e2[_0x110240(0xdd)]!==undefined)_0xf574f9[_0x110240(0xdd)]=Number(_0x5e59e2['priority']);if(_0x5e59e2['retryLimit']!==undefined)_0xf574f9['retry_limit']=Number(_0x5e59e2[_0x110240(0x86)]);if(_0x5e59e2[_0x110240(0x103)])_0xf574f9['engine_version']=_0x5e59e2['engineVersion'];if(_0x5e59e2['result'])_0xf574f9[_0x110240(0xe4)]=_0x5e59e2['result'];if(_0x5e791f['verbose']){console[_0x110240(0xa5)](_0x110240(0x108)+_0x51a9ed),console[_0x110240(0xa5)]('\x20\x20Database:\x20'+_0x30d17a),console[_0x110240(0xa5)](_0x110240(0xa4)+_0x4dba83);if(_0xf574f9['cron'])console[_0x110240(0xa5)](_0x110240(0x96)+_0xf574f9[_0x110240(0xed)]);if(_0xf574f9[_0x110240(0xee)])console[_0x110240(0xa5)](_0x110240(0xf7)+_0xf574f9[_0x110240(0xee)]);}const _0x25795=await withSpinner(_0x110240(0x87),()=>_0x446157[_0x110240(0x80)]['create'](_0x51a9ed,_0xf574f9),{'verbose':_0x5e791f[_0x110240(0xf2)]});return console[_0x110240(0xa5)](_0x110240(0xa7)+_0x25795[_0x110240(0xf3)]['name']),await handleSingleObjectOutput(_0x25795[_0x110240(0xf3)],_0x5e791f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a39_0xeb912(0x91)]='schedule:update';[a39_0xeb912(0xdb)]=a39_0xeb912(0xbb);[a39_0xeb912(0x85)](_0x2db709){const _0x4f98aa=a39_0xeb912,_0x3da438=_0x2db709[_0x4f98aa(0xc6)][0x0];if(!_0x3da438)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a39_0xeb912(0x8d)](_0x7151ee){const _0x3c0672=a39_0xeb912,{options:_0x420137,args:_0xb9bba5,tdx:_0x40fac5}=_0x7151ee,_0xcfe328=_0xb9bba5[0x0],_0x5b1a05=_0x420137,_0x503611={};if(_0x5b1a05['database'])_0x503611[_0x3c0672(0x101)]=_0x5b1a05[_0x3c0672(0x101)];if(_0x5b1a05[_0x3c0672(0x99)])_0x503611[_0x3c0672(0x99)]=_0x5b1a05[_0x3c0672(0x99)];if(_0x5b1a05[_0x3c0672(0xed)])_0x503611[_0x3c0672(0xed)]=_0x5b1a05[_0x3c0672(0xed)];if(_0x5b1a05['timezone'])_0x503611[_0x3c0672(0xee)]=_0x5b1a05[_0x3c0672(0xee)];if(_0x5b1a05['delay']!==undefined)_0x503611[_0x3c0672(0x8b)]=Number(_0x5b1a05['delay']);if(_0x5b1a05['priority']!==undefined)_0x503611[_0x3c0672(0xdd)]=Number(_0x5b1a05[_0x3c0672(0xdd)]);if(_0x5b1a05[_0x3c0672(0x86)]!==undefined)_0x503611['retry_limit']=Number(_0x5b1a05[_0x3c0672(0x86)]);if(_0x5b1a05[_0x3c0672(0x103)])_0x503611[_0x3c0672(0xc2)]=_0x5b1a05[_0x3c0672(0x103)];if(_0x5b1a05['result'])_0x503611['result']=_0x5b1a05[_0x3c0672(0xe4)];if(_0x5b1a05[_0x3c0672(0xf9)])try{_0x503611[_0x3c0672(0x7c)]=readFileSync(_0x5b1a05[_0x3c0672(0xf9)],_0x3c0672(0x7e))[_0x3c0672(0x90)]();}catch(_0x25d20b){throw new SDKError(ErrorCode[_0x3c0672(0xec)],_0x3c0672(0xea)+_0x5b1a05[_0x3c0672(0xf9)],_0x25d20b instanceof Error?_0x25d20b:undefined);}if(Object[_0x3c0672(0xef)](_0x503611)[_0x3c0672(0xf1)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x420137[_0x3c0672(0xf2)]){console['error'](_0x3c0672(0xd3)+_0xcfe328);for(const [_0x3297ad,_0xa71bad]of Object[_0x3c0672(0xae)](_0x503611)){_0x3297ad===_0x3c0672(0x7c)?console[_0x3c0672(0xa5)]('\x20\x20'+_0x3297ad+':\x20'+_0xa71bad[_0x3c0672(0x81)](0x0,0x32)+_0x3c0672(0xf6)):console[_0x3c0672(0xa5)]('\x20\x20'+_0x3297ad+':\x20'+_0xa71bad);}}const _0x38e6d4=await withSpinner('Updating\x20schedule...',()=>_0x40fac5[_0x3c0672(0x80)]['update'](_0xcfe328,_0x503611),{'verbose':_0x420137[_0x3c0672(0xf2)]});return console['error'](_0x3c0672(0xf5)+_0x38e6d4['data']['name']),await handleSingleObjectOutput(_0x38e6d4[_0x3c0672(0xf3)],_0x420137),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a39_0xeb912(0x91)]=a39_0xeb912(0x8c);[a39_0xeb912(0xdb)]=a39_0xeb912(0x9f);[a39_0xeb912(0x85)](_0x2f6015){const _0x43e9e7=a39_0xeb912,_0x3cd41f=_0x2f6015[_0x43e9e7(0xc6)][0x0];if(!_0x3cd41f)return _0x43e9e7(0x98);return undefined;}async[a39_0xeb912(0x8d)](_0x1fac6b){const _0x2b511c=a39_0xeb912,{options:_0x3fdd3e,args:_0x958e1b,tdx:_0xa79314}=_0x1fac6b,_0x10215b=_0x958e1b[0x0];if(!_0x3fdd3e['yes']){const _0x268cfb=await confirm(_0x2b511c(0xfb)+_0x10215b+'\x22?');if(!_0x268cfb)return console['error'](_0x2b511c(0x83)),0x0;}const _0x4bdaf4=await withSpinner(_0x2b511c(0xa8),()=>_0xa79314['schedules']['delete'](_0x10215b),{'verbose':_0x3fdd3e[_0x2b511c(0xf2)]});return console[_0x2b511c(0xa5)]('Schedule\x20deleted:\x20'+_0x4bdaf4[_0x2b511c(0xf3)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a39_0xeb912(0x91)]=a39_0xeb912(0xa3);[a39_0xeb912(0xdb)]=a39_0xeb912(0xc1);[a39_0xeb912(0x85)](_0x3319f8){const _0x1e896f=a39_0xeb912,_0x286472=_0x3319f8[_0x1e896f(0xc6)][0x0];if(!_0x286472)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a39_0xeb912(0x8d)](_0x40514c){const _0x3bcc50=a39_0xeb912,{options:_0xd5cbc3,args:_0x4c0c26,tdx:_0x55132b}=_0x40514c,_0x149dbf=_0x4c0c26[0x0],_0xbb70ed=_0xd5cbc3,_0x2131b5=_0xbb70ed[_0x3bcc50(0xd4)],_0xbc392e=_0xbb70ed[_0x3bcc50(0xd6)]!==undefined?Number(_0xbb70ed[_0x3bcc50(0xd6)]):undefined;if(_0xd5cbc3[_0x3bcc50(0xf2)]){console[_0x3bcc50(0xa5)](_0x3bcc50(0xaa)+_0x149dbf);if(_0x2131b5)console[_0x3bcc50(0xa5)](_0x3bcc50(0x102)+_0x2131b5);if(_0xbc392e)console[_0x3bcc50(0xa5)](_0x3bcc50(0x88)+_0xbc392e);}const _0x455e6f=await withSpinner(_0x3bcc50(0x93),()=>_0x55132b[_0x3bcc50(0x80)]['run'](_0x149dbf,{'time':_0x2131b5,'num':_0xbc392e}),{'verbose':_0xd5cbc3[_0x3bcc50(0xf2)]}),_0x2ef4ff=_0x455e6f[_0x3bcc50(0xf3)][_0x3bcc50(0xe8)];console[_0x3bcc50(0xa5)](_0x3bcc50(0xe3)+_0x2ef4ff['length']+_0x3bcc50(0xe1)+(_0x2ef4ff['length']!==0x1?'s':'')+_0x3bcc50(0xb3));for(const _0x5b30d5 of _0x2ef4ff){console[_0x3bcc50(0xa5)](_0x3bcc50(0x9e)+_0x5b30d5[_0x3bcc50(0x97)]);}return await handleSDKOutput(_0x2ef4ff,_0xd5cbc3),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a39_0xeb912(0x91)]='schedule:history';['description']=a39_0xeb912(0xa0);[a39_0xeb912(0x85)](_0x292286){const _0x55c7e8=a39_0xeb912,_0x38338f=_0x292286[_0x55c7e8(0xc6)][0x0];if(!_0x38338f)return _0x55c7e8(0xf0);return undefined;}async[a39_0xeb912(0x8d)](_0x885ac2){const _0x3baf89=a39_0xeb912,{options:_0x1b1f48,args:_0x1471c0,tdx:_0x26fa60}=_0x885ac2,_0x21a911=_0x1471c0[0x0],_0x367cef=_0x1b1f48,_0x5737a1=_0x367cef['from']!==undefined?Number(_0x367cef[_0x3baf89(0xcc)]):undefined,_0x1eeacd=_0x367cef['to']!==undefined?Number(_0x367cef['to']):undefined,_0x1b18bc=await withSpinner(_0x3baf89(0xc8),()=>_0x26fa60[_0x3baf89(0x80)][_0x3baf89(0x107)](_0x21a911,{'from':_0x5737a1,'to':_0x1eeacd}),{'verbose':_0x1b1f48['verbose']}),_0x3ce410=_0x1b18bc[_0x3baf89(0xf3)];console['error'](_0x3baf89(0x9c)+_0x3ce410[_0x3baf89(0x8f)]+_0x3baf89(0xdf)+(_0x3ce410[_0x3baf89(0x8f)]!==0x1?'s':'')+_0x3baf89(0xac)+_0x3ce410[_0x3baf89(0xcc)]+'-'+_0x3ce410['to']+')');const _0x35be03=_0x3ce410['history'][_0x3baf89(0xb8)](_0x265af8=>({'job_id':_0x265af8['job_id'],'type':_0x265af8['type'],'status':_0x265af8[_0x3baf89(0xd9)],'scheduled_at':_0x265af8[_0x3baf89(0x8a)],'created_at':_0x265af8[_0x3baf89(0xd2)],'start_at':_0x265af8['start_at'],'end_at':_0x265af8[_0x3baf89(0xeb)]}));return await handleSDKOutput(_0x35be03,_0x1b1f48),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a40_0x51e6c7=a40_0x4039;(function(_0x343d40,_0x297227){const _0x3def8c=a40_0x4039,_0x163349=_0x343d40();while(!![]){try{const _0x379261=-parseInt(_0x3def8c(0xea))/0x1*(-parseInt(_0x3def8c(0x11c))/0x2)+-parseInt(_0x3def8c(0x126))/0x3+parseInt(_0x3def8c(0x123))/0x4*(parseInt(_0x3def8c(0xdc))/0x5)+-parseInt(_0x3def8c(0xc5))/0x6*(-parseInt(_0x3def8c(0x113))/0x7)+parseInt(_0x3def8c(0x116))/0x8+parseInt(_0x3def8c(0x15e))/0x9*(-parseInt(_0x3def8c(0xe0))/0xa)+parseInt(_0x3def8c(0x13d))/0xb*(-parseInt(_0x3def8c(0x104))/0xc);if(_0x379261===_0x297227)break;else _0x163349['push'](_0x163349['shift']());}catch(_0x292cd4){_0x163349['push'](_0x163349['shift']());}}}(a40_0x4abb,0x86ce2));import{BaseCommand}from'./command.js';function a40_0x4abb(){const _0xc698e3=['Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Error:\x20Folder\x20reference\x20is\x20required','Parent\x20ID:\x20','test','/app/ps/','limit','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segmentName','6jViOVO','code','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view\x20-w','resolveFolderId','Resolving\x20path\x20\x27','Parent\x20segment:\x20','Usage:','\x20\x20Cause:\x20','✖\x20Query\x20failed\x20[','verbose','Resolved\x20YAML\x20file:\x20','segmentPath','Parent\x20name:\x20','\x20\x20Segment\x20name:\x20','information_schema','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','parent','Get\x20SQL\x20query\x20for\x20child\x20segment','cause','error','segment','Resolved\x20type:\x20','107315eepsjU','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','getSegmentSQL','Resolved:\x20','280360dzZiUu','Error:\x20','getSQLFromYamlFile','Executing\x20segment\x20query...','Usage:\x20tdx\x20sg\x20desc\x20<name>','execute','folder','Fetching\x20segment\x20details...','Fetching\x20parent\x20segment\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','20738tFOeYo','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Folder\x20ID:\x20','processedRows','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','fullPath','Creating\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','red','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','description','query','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','stats','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','SQL\x20query:\x0a','INVALID_ARGUMENT','segment:folder:show','1375692AMNGQh','Target\x20path:\x20','\x20folder','folderId','Resolved\x20parent\x20ID:\x20','message','Resolved\x20relative\x20path\x20to:\x20','format','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','trim','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','web','3481261duvnrt','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','SELECT\x20*\x20FROM\x20(\x0a','7997960gMqvUn','Fetching\x20folder\x20details...','json','\x20\x20Parent\x20segment:\x20','getSQLFromServerSegment','name','54HCUAox','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','/e/','Create\x20segment\x20folder\x20for\x20organization','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','44itqoCy','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Site:\x20','331236EYmfaY','segment:sql','elapsedTimeMillis','getFolder','\x20rows\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getSegment','site','Folder\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20Opening\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Examples:','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parentFolder','Fetching\x20SQL\x20for\x20segment...','includes','length','Resolved\x20folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','resolvePathToResource','segment:desc','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','143oVkKyM','data','SEGMENT_NOT_FOUND','Resolved\x20parent\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','toLocaleString','Use:\x20tdx\x20ps\x20view','Resolving\x20folder\x20\x27','type','Resolving\x20parent\x20segment\x20\x27','\x20\x20Full\x20path:\x20','segment:view','path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','resolveParentId','setJobId','\x27...','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Options:','SEGMENT_FOLDER_NOT_FOUND','createFolder','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Segment\x20ID:\x20','replace','Show\x20segment\x20or\x20folder\x20details','parentSegment','Fetching\x20folder\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','parentId','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','45mafSOU','Error:\x20Parent\x20segment\x20name\x20is\x20required','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segmentId','✔\x20Found\x20','jobId','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','url'];a40_0x4abb=function(){return _0xc698e3;};return a40_0x4abb();}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 a40_0xf70a6c from'chalk';function a40_0x4039(_0x56fe3f,_0x5122c5){_0x56fe3f=_0x56fe3f-0xc3;const _0x4abbdb=a40_0x4abb();let _0x4039c1=_0x4abbdb[_0x56fe3f];return _0x4039c1;}async function resolveSegmentTarget(_0x18c79a,_0x2444f4,_0x7c411){const _0x537f4f=a40_0x4039;if(isYamlFilePath(_0x18c79a))try{const _0x2ec07c=await resolveYamlFilePath(_0x18c79a);return _0x7c411&&(console[_0x537f4f(0xd9)](_0x537f4f(0xd0)+_0x18c79a),console[_0x537f4f(0xd9)](_0x537f4f(0x119)+_0x2ec07c[_0x537f4f(0x159)]),console[_0x537f4f(0xd9)](_0x537f4f(0xd3)+_0x2ec07c[_0x537f4f(0xc4)]),console[_0x537f4f(0xd9)]('\x20\x20Folder\x20path:\x20'+(_0x2ec07c['folderPath']||'(root)')),console[_0x537f4f(0xd9)](_0x537f4f(0x149)+_0x2ec07c[_0x537f4f(0xf3)])),_0x2ec07c[_0x537f4f(0xf3)];}catch(_0x28ba88){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x28ba88['message']);}if(!_0x2444f4)throw new SDKError(ErrorCode[_0x537f4f(0x102)],_0x537f4f(0x160));return _0x2444f4+'/'+_0x18c79a;}export class SegmentDescribeCommand extends BaseCommand{[a40_0x51e6c7(0x11b)]='segment:describe';[a40_0x51e6c7(0xf8)]=a40_0x51e6c7(0x158);async[a40_0x51e6c7(0xe5)](_0x509d80){const _0x24ae44=a40_0x51e6c7,{options:_0x52d776,args:_0x453bfd,tdx:_0x180adb}=_0x509d80,_0xce9f54=_0x453bfd[0x0],_0x17a7e5=!_0xce9f54&&!!_0x52d776[_0x24ae44(0x159)],_0x9bee0e=_0xce9f54||_0x52d776[_0x24ae44(0x159)];if(!_0x9bee0e)return console[_0x24ae44(0xd9)](_0x24ae44(0x121)),console[_0x24ae44(0xd9)](_0x24ae44(0x141)),console[_0x24ae44(0xd9)](_0x24ae44(0x132)),console[_0x24ae44(0xd9)](_0x24ae44(0x11d)),console[_0x24ae44(0xd9)](_0x24ae44(0xf5)),console[_0x24ae44(0xd9)](_0x24ae44(0x131)),console[_0x24ae44(0xd9)](_0x24ae44(0xfc)),0x1;try{const _0x160bf5=_0x52d776[_0x24ae44(0xd1)];let _0x243a75=_0x9bee0e;!_0x17a7e5&&_0x160bf5&&!_0x9bee0e[_0x24ae44(0x136)]('/')&&(_0x243a75=_0x160bf5+'/'+_0x9bee0e,_0x52d776[_0x24ae44(0xcf)]&&console[_0x24ae44(0xd9)](_0x24ae44(0x10a)+_0x243a75));const _0x22b9c7=await withSpinner(_0x24ae44(0xca)+_0x243a75+_0x24ae44(0x14f),()=>_0x180adb[_0x24ae44(0xda)]['resolvePathToResource'](_0x243a75),{'verbose':_0x52d776[_0x24ae44(0xcf)]}),_0xbd742a=_0x22b9c7[_0x24ae44(0x13e)];_0x52d776[_0x24ae44(0xcf)]&&(console['error'](_0x24ae44(0xdb)+_0xbd742a['type']),console[_0x24ae44(0xd9)](_0x24ae44(0x169)+_0xbd742a[_0x24ae44(0x15c)]),_0xbd742a[_0x24ae44(0x107)]&&console['error']('Folder\x20ID:\x20'+_0xbd742a['folderId']),_0xbd742a[_0x24ae44(0x162)]&&console[_0x24ae44(0xd9)](_0x24ae44(0x156)+_0xbd742a[_0x24ae44(0x162)]));if(_0xbd742a['type']===_0x24ae44(0xd6)){const _0x4b22f2=await withSpinner(_0x24ae44(0xe8),()=>_0x180adb['segment']['getParent'](_0xbd742a[_0x24ae44(0x15c)]),{'verbose':_0x52d776[_0x24ae44(0xcf)]});await handleSingleObjectOutput(_0x4b22f2[_0x24ae44(0x13e)],_0x52d776);}else{if(_0xbd742a['type']===_0x24ae44(0xe6)){if(!_0xbd742a[_0x24ae44(0x107)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x24ae44(0x14c));const _0x5bb4ba=await withSpinner('Fetching\x20folder\x20details...',()=>_0x180adb[_0x24ae44(0xda)][_0x24ae44(0x129)](_0xbd742a['folderId']),{'verbose':_0x52d776[_0x24ae44(0xcf)]});await handleSingleObjectOutput(_0x5bb4ba[_0x24ae44(0x13e)],_0x52d776);}else{if(_0xbd742a[_0x24ae44(0x147)]===_0x24ae44(0xda)){if(!_0xbd742a[_0x24ae44(0x162)])throw new SDKError(ErrorCode[_0x24ae44(0x13f)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x11c160=await withSpinner(_0x24ae44(0xe7),()=>_0x180adb['segment'][_0x24ae44(0x12c)](_0xbd742a[_0x24ae44(0x15c)],_0xbd742a['segmentId']),{'verbose':_0x52d776['verbose']});await handleSingleObjectOutput(_0x11c160['data'],_0x52d776);}}}return 0x0;}catch(_0x467035){if(_0x467035 instanceof SDKError)return console[_0x24ae44(0xd9)]('Error:\x20'+_0x467035[_0x24ae44(0x109)]),_0x467035[_0x24ae44(0xd8)]&&console[_0x24ae44(0xd9)]('\x20\x20Cause:\x20'+_0x467035[_0x24ae44(0xd8)]),0x1;throw _0x467035;}}}export class SegmentShowCommand extends BaseCommand{[a40_0x51e6c7(0x11b)]='segment:show';[a40_0x51e6c7(0xf8)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a40_0x51e6c7(0xe5)](_0x48869f){const _0x35b415=a40_0x51e6c7,{options:_0x58b30b,args:_0x593f89,tdx:_0x57626e}=_0x48869f,_0x39b424=_0x593f89[0x0];if(!_0x39b424)return console[_0x35b415(0xd9)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x35b415(0xff)),console[_0x35b415(0xd9)](_0x35b415(0x139)),console[_0x35b415(0xd9)](_0x35b415(0x132)),console[_0x35b415(0xd9)](_0x35b415(0x10c)),console[_0x35b415(0xd9)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x9b9ba6=_0x58b30b[_0x35b415(0x159)],_0xf6f285=await resolveSegmentTarget(_0x39b424,_0x9b9ba6,_0x58b30b['verbose']);_0x58b30b[_0x35b415(0xcf)]&&console['error'](_0x35b415(0x105)+_0xf6f285);const _0x19e3a4=await withSpinner(_0x35b415(0x10e)+_0x39b424+_0x35b415(0x14f),()=>_0x57626e[_0x35b415(0xda)][_0x35b415(0x13a)](_0xf6f285),{'verbose':_0x58b30b[_0x35b415(0xcf)]}),_0x314595=_0x19e3a4[_0x35b415(0x13e)];_0x58b30b[_0x35b415(0xcf)]&&(console[_0x35b415(0xd9)](_0x35b415(0xdb)+_0x314595[_0x35b415(0x147)]),console[_0x35b415(0xd9)](_0x35b415(0x169)+_0x314595[_0x35b415(0x15c)]));if(_0x314595[_0x35b415(0x147)]==='folder')return console[_0x35b415(0xd9)](_0x35b415(0x111)),console[_0x35b415(0xd9)](_0x35b415(0xee)),0x1;if(_0x314595[_0x35b415(0x147)]===_0x35b415(0xd6))return console[_0x35b415(0xd9)](_0x35b415(0x122)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x314595[_0x35b415(0x162)])throw new SDKError(ErrorCode[_0x35b415(0x13f)],_0x35b415(0xfe));const _0x47f9b8=await withSpinner(_0x35b415(0x135),()=>_0x57626e[_0x35b415(0xda)][_0x35b415(0xde)](_0x314595[_0x35b415(0x15c)],_0x314595[_0x35b415(0x162)]),{'verbose':_0x58b30b[_0x35b415(0xcf)]});let _0x5391ec=_0x47f9b8[_0x35b415(0x13e)];const _0x39b4ce=resolveLimit(_0x58b30b[_0x35b415(0x16c)],DEFAULT_DISPLAY_LIMIT),_0x48be55=/\bLIMIT\s+\d+/i[_0x35b415(0x16a)](_0x5391ec);!_0x48be55&&(_0x5391ec=_0x5391ec[_0x35b415(0x110)]()[_0x35b415(0x157)](/;+$/,''),_0x5391ec=_0x35b415(0x115)+_0x5391ec+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x39b4ce);_0x58b30b[_0x35b415(0xcf)]&&console[_0x35b415(0xd9)](_0x35b415(0x101)+_0x5391ec);const _0x2b668e=await withProgressSpinner(_0x35b415(0xe3),async _0x1d3765=>{const _0x1c398d=_0x35b415,_0x93a3da=await _0x57626e[_0x1c398d(0xf9)][_0x1c398d(0xe5)](_0x5391ec,{'catalog':'td','schema':_0x1c398d(0xd4),'onJobId':_0x567d28=>{const _0x4714bb=_0x1c398d;_0x1d3765[_0x4714bb(0x14e)](_0x567d28);}});return _0x93a3da;},{'verbose':_0x58b30b[_0x35b415(0xcf)]}),_0x2738ab=_0x2b668e[_0x35b415(0x13e)],_0x33cf7b=_0x2738ab[_0x35b415(0x164)]?'\x20[Job\x20ID:\x20'+_0x2738ab['jobId']+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x2738ab[_0x35b415(0xfd)][_0x35b415(0xf0)][_0x35b415(0x144)]()+_0x35b415(0x12a)+('in\x20'+formatElapsed(_0x2738ab[_0x35b415(0xfd)][_0x35b415(0x128)])+_0x33cf7b)),await handleQueryOutput(_0x2738ab,_0x58b30b),0x0;}catch(_0x15cd72){if(_0x15cd72 instanceof SDKError)return console[_0x35b415(0xd9)](_0x35b415(0xce)+_0x15cd72[_0x35b415(0xc6)]+']'),console[_0x35b415(0xd9)]('\x0a'+_0x15cd72[_0x35b415(0x109)]),0x1;throw _0x15cd72;}}}export class SegmentFolderListCommand extends BaseCommand{[a40_0x51e6c7(0x11b)]='segment:folder:list';[a40_0x51e6c7(0xf8)]=a40_0x51e6c7(0xdd);async[a40_0x51e6c7(0xe5)](_0x255cae){const _0x3f0ebc=a40_0x51e6c7,{options:_0x19cb63,args:_0x51b910,tdx:_0x53f955}=_0x255cae;if(_0x51b910[_0x3f0ebc(0x137)]===0x0)return console[_0x3f0ebc(0xd9)](_0x3f0ebc(0x15f)),console[_0x3f0ebc(0xd9)](_0x3f0ebc(0x124)),0x1;const _0x1cddad=_0x51b910[0x0];try{_0x19cb63[_0x3f0ebc(0xcf)]&&(console[_0x3f0ebc(0xd9)](_0x3f0ebc(0x125)+_0x19cb63[_0x3f0ebc(0x12d)]),console['error'](_0x3f0ebc(0xd2)+_0x1cddad));const _0x1dff25=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1cddad+_0x3f0ebc(0x14f),()=>_0x53f955['segment']['resolveParentId'](_0x1cddad),{'verbose':_0x19cb63[_0x3f0ebc(0xcf)]}),_0x37a0fc=_0x1dff25[_0x3f0ebc(0x13e)];_0x19cb63[_0x3f0ebc(0xcf)]&&console[_0x3f0ebc(0xd9)](_0x3f0ebc(0x108)+_0x37a0fc);const _0x31dcce=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x1cddad+_0x3f0ebc(0x14f),()=>_0x53f955[_0x3f0ebc(0xda)]['listFolders'](_0x37a0fc),{'verbose':_0x19cb63[_0x3f0ebc(0xcf)]}),_0x49e359=_0x31dcce['data'];return console[_0x3f0ebc(0xd9)](_0x3f0ebc(0x163)+_0x49e359[_0x3f0ebc(0x137)]+_0x3f0ebc(0x106)+(_0x49e359[_0x3f0ebc(0x137)]!==0x1?'s':'')),await handleSDKOutput(_0x49e359,_0x19cb63),0x0;}catch(_0x5c9571){if(_0x5c9571 instanceof SDKError)return console['error'](_0x3f0ebc(0xe1)+_0x5c9571[_0x3f0ebc(0x109)]),_0x5c9571[_0x3f0ebc(0xd8)]&&console[_0x3f0ebc(0xd9)](_0x3f0ebc(0xcd)+_0x5c9571['cause']),0x1;throw _0x5c9571;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a40_0x51e6c7(0x103);['description']=a40_0x51e6c7(0x154);async['execute'](_0x1192b0){const _0x40094a=a40_0x51e6c7,{options:_0x3e3f39,args:_0x4381b0,tdx:_0x45a4b1}=_0x1192b0;if(_0x4381b0[_0x40094a(0x137)]===0x0)return console[_0x40094a(0xd9)](_0x40094a(0x168)),console['error'](_0x40094a(0x10d)),0x1;try{const {parentId:_0x5d7086,childId:_0x2e07e9}=parseSegmentRef(_0x4381b0[0x0]);_0x3e3f39[_0x40094a(0xcf)]&&(console[_0x40094a(0xd9)](_0x40094a(0x125)+_0x3e3f39['site']),console['error'](_0x40094a(0xd2)+_0x5d7086),_0x2e07e9&&console[_0x40094a(0xd9)](_0x40094a(0x12e)+_0x2e07e9));if(!_0x2e07e9)return console['error'](_0x40094a(0x161)),0x1;const _0x52e53b=await withSpinner(_0x40094a(0x148)+_0x5d7086+_0x40094a(0x14f),()=>_0x45a4b1[_0x40094a(0xda)][_0x40094a(0x14d)](_0x5d7086),{'verbose':_0x3e3f39[_0x40094a(0xcf)]}),_0x19cbb8=_0x52e53b[_0x40094a(0x13e)];_0x3e3f39[_0x40094a(0xcf)]&&console[_0x40094a(0xd9)](_0x40094a(0x108)+_0x19cbb8);const _0x58d9a6=await withSpinner(_0x40094a(0x146)+_0x2e07e9+_0x40094a(0x14f),()=>_0x45a4b1['segment'][_0x40094a(0xc9)](_0x19cbb8,_0x2e07e9),{'verbose':_0x3e3f39[_0x40094a(0xcf)]}),_0x327f63=_0x58d9a6[_0x40094a(0x13e)];_0x3e3f39[_0x40094a(0xcf)]&&console[_0x40094a(0xd9)](_0x40094a(0x138)+_0x327f63);const _0x29823c=await withSpinner(_0x40094a(0x15a)+_0x2e07e9+_0x40094a(0x14f),()=>_0x45a4b1[_0x40094a(0xda)]['getFolder'](_0x327f63),{'verbose':_0x3e3f39['verbose']});return await handleSDKOutput([_0x29823c['data']],_0x3e3f39),0x0;}catch(_0x350dea){if(_0x350dea instanceof SDKError)return console[_0x40094a(0xd9)](_0x40094a(0xe1)+_0x350dea[_0x40094a(0x109)]),_0x350dea[_0x40094a(0xd8)]&&console['error']('\x20\x20Cause:\x20'+_0x350dea[_0x40094a(0xd8)]),0x1;throw _0x350dea;}}}export class SegmentSQLCommand extends BaseCommand{[a40_0x51e6c7(0x11b)]=a40_0x51e6c7(0x127);[a40_0x51e6c7(0xf8)]=a40_0x51e6c7(0xd7);async[a40_0x51e6c7(0xe5)](_0xc66cc){const _0x84b4c0=a40_0x51e6c7,{options:_0x11522a,args:_0x53a1c7}=_0xc66cc,_0x5cf5bd=_0x11522a,_0x1de613=_0x5cf5bd[_0x84b4c0(0x14b)],_0x38a0a1=_0x53a1c7[0x0];if(!_0x38a0a1&&!_0x1de613)return console[_0x84b4c0(0xd9)](a40_0xf70a6c[_0x84b4c0(0xf6)](_0x84b4c0(0x167))),console['error'](_0x84b4c0(0xcc)),console[_0x84b4c0(0xd9)](_0x84b4c0(0xf7)),console[_0x84b4c0(0xd9)](_0x84b4c0(0x15b)),console[_0x84b4c0(0xd9)](_0x84b4c0(0x132)),console[_0x84b4c0(0xd9)](_0x84b4c0(0x12b)),console[_0x84b4c0(0xd9)](_0x84b4c0(0x13c)),0x1;if(_0x38a0a1&&_0x1de613)return console['error'](a40_0xf70a6c[_0x84b4c0(0xf6)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0xafe2f7;if(_0x1de613)_0xafe2f7=await this[_0x84b4c0(0xe2)](_0x1de613,_0xc66cc);else{if(isYamlFilePath(_0x38a0a1))return console['error'](a40_0xf70a6c[_0x84b4c0(0xf6)](_0x84b4c0(0xc3))),console[_0x84b4c0(0xd9)](_0x84b4c0(0x142)+_0x38a0a1),0x1;else _0xafe2f7=await this[_0x84b4c0(0x11a)](_0x38a0a1,_0xc66cc);}return _0x11522a[_0x84b4c0(0x10b)]===_0x84b4c0(0x118)||_0x11522a['format']==='jsonl'?await handleSDKOutput([{'sql':_0xafe2f7}],_0x11522a):console['log'](_0xafe2f7),0x0;}catch(_0x37a424){if(_0x37a424 instanceof SDKError)return console[_0x84b4c0(0xd9)]('Error:\x20'+_0x37a424['message']),_0x37a424[_0x84b4c0(0xd8)]&&console[_0x84b4c0(0xd9)](_0x84b4c0(0xcd)+_0x37a424[_0x84b4c0(0xd8)]),0x1;throw _0x37a424;}}async[a40_0x51e6c7(0xe2)](_0x118f1f,_0x16ac46){const _0x538ea4=a40_0x51e6c7,{options:_0x553fcf,tdx:_0x115e0f}=_0x16ac46;let _0x3052ee;try{_0x3052ee=await resolveYamlFilePath(_0x118f1f);}catch(_0x154426){throw new SDKError(ErrorCode[_0x538ea4(0x102)],_0x538ea4(0x15d)+_0x154426['message']);}_0x553fcf[_0x538ea4(0xcf)]&&console[_0x538ea4(0xd9)](_0x538ea4(0xdf)+_0x3052ee[_0x538ea4(0x159)]+'/'+_0x3052ee['segmentName']);const _0x47643b=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x115e0f[_0x538ea4(0xda)]['getSegmentSQLFromYaml'](_0x3052ee['content'],_0x3052ee[_0x538ea4(0x159)],_0x3052ee[_0x538ea4(0xc4)]),{'verbose':_0x553fcf[_0x538ea4(0xcf)]});return _0x47643b['data'];}async[a40_0x51e6c7(0x11a)](_0x350641,_0x514bb1){const _0x1c57b9=a40_0x51e6c7,{options:_0x47a3a9,tdx:_0x1f0562}=_0x514bb1,_0x5eafcd=_0x47a3a9[_0x1c57b9(0x159)],_0x433e91=await resolveSegmentTarget(_0x350641,_0x5eafcd,_0x47a3a9[_0x1c57b9(0xcf)]);_0x47a3a9['verbose']&&console[_0x1c57b9(0xd9)]('Target\x20path:\x20'+_0x433e91);const _0x89cba0=await withSpinner(_0x1c57b9(0x10e)+_0x350641+'\x27...',()=>_0x1f0562[_0x1c57b9(0xda)][_0x1c57b9(0x13a)](_0x433e91),{'verbose':_0x47a3a9['verbose']}),_0x48144f=_0x89cba0[_0x1c57b9(0x13e)];_0x47a3a9[_0x1c57b9(0xcf)]&&(console[_0x1c57b9(0xd9)]('Resolved\x20type:\x20'+_0x48144f[_0x1c57b9(0x147)]),console[_0x1c57b9(0xd9)](_0x1c57b9(0x169)+_0x48144f['parentId']));if(_0x48144f[_0x1c57b9(0x147)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1c57b9(0x165));if(_0x48144f[_0x1c57b9(0x147)]===_0x1c57b9(0xd6))throw new SDKError(ErrorCode[_0x1c57b9(0x102)],_0x1c57b9(0x120));if(!_0x48144f[_0x1c57b9(0x162)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1c57b9(0xfe));const _0x3a54a7=await withSpinner(_0x1c57b9(0x135),()=>_0x1f0562[_0x1c57b9(0xda)]['getSegmentSQL'](_0x48144f[_0x1c57b9(0x15c)],_0x48144f[_0x1c57b9(0x162)]),{'verbose':_0x47a3a9[_0x1c57b9(0xcf)]});return _0x3a54a7[_0x1c57b9(0x13e)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a40_0x51e6c7(0x11b)]='segment:folder:create';[a40_0x51e6c7(0xf8)]=a40_0x51e6c7(0x11f);async[a40_0x51e6c7(0xe5)](_0x2026ab){const _0x3b2c62=a40_0x51e6c7,{options:_0x21f9c7,args:_0x4e4590,tdx:_0x1e40ed}=_0x2026ab,_0x408e1a=_0x21f9c7;if(_0x4e4590['length']<0x2)return console[_0x3b2c62(0xd9)](_0x3b2c62(0x143)),console[_0x3b2c62(0xd9)](_0x3b2c62(0x133)),0x1;const _0x43ba46=_0x4e4590[0x0],_0x1635ec=_0x4e4590[0x1];_0x408e1a[_0x3b2c62(0xcf)]&&(console[_0x3b2c62(0xd9)]('Site:\x20'+_0x408e1a[_0x3b2c62(0x12d)]),console['error'](_0x3b2c62(0xcb)+_0x43ba46),console[_0x3b2c62(0xd9)]('Folder\x20name:\x20'+_0x1635ec));let _0x446c8d;if(_0x408e1a[_0x3b2c62(0x134)]){const _0x4b79e7=_0x408e1a['parentFolder'],_0x143a07=await withSpinner(_0x3b2c62(0x148)+_0x43ba46+_0x3b2c62(0x14f),()=>_0x1e40ed[_0x3b2c62(0xda)][_0x3b2c62(0x14d)](_0x43ba46),{'verbose':_0x408e1a[_0x3b2c62(0xcf)]}),_0x568f5a=_0x143a07[_0x3b2c62(0x13e)],_0x3ca294=await withSpinner(_0x3b2c62(0xfa)+_0x4b79e7+_0x3b2c62(0x14f),()=>_0x1e40ed[_0x3b2c62(0xda)]['resolveFolderId'](_0x568f5a,_0x4b79e7),{'verbose':_0x408e1a[_0x3b2c62(0xcf)]});_0x446c8d=_0x3ca294[_0x3b2c62(0x13e)],_0x408e1a[_0x3b2c62(0xcf)]&&console['error'](_0x3b2c62(0x140)+_0x446c8d);}const _0x27323f={'name':_0x1635ec,'description':_0x408e1a[_0x3b2c62(0xf8)],'parentFolderId':_0x446c8d},_0x132af8=await withSpinner(_0x3b2c62(0xf4)+_0x1635ec+_0x3b2c62(0x14f),()=>_0x1e40ed[_0x3b2c62(0xda)][_0x3b2c62(0x153)](_0x43ba46,_0x27323f),{'verbose':_0x408e1a[_0x3b2c62(0xcf)]}),_0x28c079=_0x132af8[_0x3b2c62(0x13e)];return console[_0x3b2c62(0xd9)]('✔\x20Created\x20folder\x20\x27'+_0x28c079['name']+'\x27\x20with\x20ID:\x20'+_0x28c079['id']),await handleSDKOutput([_0x28c079],_0x408e1a),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a40_0x51e6c7(0x14a);[a40_0x51e6c7(0xf8)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a40_0x51e6c7(0xe5)](_0x1cfa5a){const _0x253f44=a40_0x51e6c7,{options:_0x2c8862,args:_0x222b5c,tdx:_0x5fa3b3}=_0x1cfa5a,_0x26fe2f=_0x222b5c[0x0];if(!_0x26fe2f)return console[_0x253f44(0xd9)](_0x253f44(0x150)),console[_0x253f44(0xd9)](_0x253f44(0xd5)),console[_0x253f44(0xd9)](_0x253f44(0xc7)),console[_0x253f44(0xd9)](_0x253f44(0x151)),console[_0x253f44(0xd9)](_0x253f44(0x10f)),console[_0x253f44(0xd9)](_0x253f44(0x132)),console['error'](_0x253f44(0x114)),console['error'](_0x253f44(0xeb)),console[_0x253f44(0xd9)](_0x253f44(0xed)),console[_0x253f44(0xd9)](_0x253f44(0x12f)),0x1;try{const _0x3383d2=_0x2c8862[_0x253f44(0x159)],_0x4fcbe0=await resolveSegmentTarget(_0x26fe2f,_0x3383d2,_0x2c8862[_0x253f44(0xcf)]);_0x2c8862[_0x253f44(0xcf)]&&console[_0x253f44(0xd9)](_0x253f44(0x105)+_0x4fcbe0);const _0x53a231=await withSpinner('Resolving\x20\x27'+_0x26fe2f+'\x27...',()=>_0x5fa3b3[_0x253f44(0xda)][_0x253f44(0x13a)](_0x4fcbe0),{'verbose':_0x2c8862[_0x253f44(0xcf)]}),_0x3fd18a=_0x53a231[_0x253f44(0x13e)];_0x2c8862[_0x253f44(0xcf)]&&(console[_0x253f44(0xd9)](_0x253f44(0xdb)+_0x3fd18a['type']),console['error']('Parent\x20ID:\x20'+_0x3fd18a[_0x253f44(0x15c)]),_0x3fd18a[_0x253f44(0x107)]&&console[_0x253f44(0xd9)](_0x253f44(0xef)+_0x3fd18a[_0x253f44(0x107)]),_0x3fd18a[_0x253f44(0x162)]&&console[_0x253f44(0xd9)](_0x253f44(0x156)+_0x3fd18a[_0x253f44(0x162)]));if(_0x2c8862[_0x253f44(0x112)]){if(_0x3fd18a[_0x253f44(0x147)]==='folder')return console[_0x253f44(0xd9)](_0x253f44(0xf1)),0x1;if(_0x3fd18a[_0x253f44(0x147)]==='parent')return console['error'](_0x253f44(0x100)),console[_0x253f44(0xd9)](_0x253f44(0xc8)),0x1;if(!_0x3fd18a[_0x253f44(0x162)])throw new SDKError(ErrorCode[_0x253f44(0x13f)],_0x253f44(0xfe));const _0x18c3a5=getConsoleNextUrl(_0x2c8862[_0x253f44(0x12d)],_0x253f44(0x16b)+_0x3fd18a['parentId']+_0x253f44(0x11e)+_0x3fd18a[_0x253f44(0x162)]);return console[_0x253f44(0xd9)](a40_0xf70a6c['green']('✔')+_0x253f44(0x130)+a40_0xf70a6c['cyan'](_0x18c3a5)),openBrowser(_0x18c3a5),0x0;}if(_0x3fd18a[_0x253f44(0x147)]===_0x253f44(0xe6)){if(!_0x3fd18a[_0x253f44(0x107)])throw new SDKError(ErrorCode[_0x253f44(0x152)],_0x253f44(0x14c));const _0x3172c9=await withSpinner(_0x253f44(0x117),()=>_0x5fa3b3[_0x253f44(0xda)]['getFolder'](_0x3fd18a[_0x253f44(0x107)]),{'verbose':_0x2c8862[_0x253f44(0xcf)]});await handleSingleObjectOutput(_0x3172c9[_0x253f44(0x13e)],_0x2c8862);}else{if(_0x3fd18a[_0x253f44(0x147)]==='segment'){if(!_0x3fd18a[_0x253f44(0x162)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x253f44(0xfe));const _0x4de6a9=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5fa3b3[_0x253f44(0xda)][_0x253f44(0x12c)](_0x3fd18a[_0x253f44(0x15c)],_0x3fd18a['segmentId']),{'verbose':_0x2c8862[_0x253f44(0xcf)]}),_0x558380=getConsoleNextUrl(_0x2c8862['site'],'/app/ps/'+_0x3fd18a[_0x253f44(0x15c)]+_0x253f44(0x11e)+_0x3fd18a['segmentId']),_0x59c2ac=_0x4de6a9[_0x253f44(0x13e)];_0x59c2ac[_0x253f44(0x166)]=_0x558380,await handleSingleObjectOutput(_0x59c2ac,_0x2c8862);}else return console['error'](_0x253f44(0xfb)),console[_0x253f44(0xd9)](_0x253f44(0x145)),0x1;}return 0x0;}catch(_0x10b710){if(_0x10b710 instanceof SDKError)return console[_0x253f44(0xd9)](_0x253f44(0xe1)+_0x10b710['message']),_0x10b710['cause']&&console[_0x253f44(0xd9)](_0x253f44(0xcd)+_0x10b710[_0x253f44(0xd8)]),0x1;throw _0x10b710;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a40_0x51e6c7(0x13b);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a40_0x51e6c7(0xe5)](_0x22c2da){const _0x26621e=a40_0x51e6c7,{options:_0x20b4a0,args:_0xfbc119,tdx:_0xcc1042}=_0x22c2da,_0x3ffa75=_0xfbc119[0x0];if(!_0x3ffa75)return console[_0x26621e(0xd9)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x26621e(0xd9)](_0x26621e(0xe4)),console[_0x26621e(0xd9)](_0x26621e(0xf2)),console['error']('Examples:'),console[_0x26621e(0xd9)](_0x26621e(0xec)),console[_0x26621e(0xd9)](_0x26621e(0x155)),0x1;try{const _0x1aa647=_0x20b4a0[_0x26621e(0x159)],_0x341303=await resolveSegmentTarget(_0x3ffa75,_0x1aa647,_0x20b4a0[_0x26621e(0xcf)]);_0x20b4a0[_0x26621e(0xcf)]&&console[_0x26621e(0xd9)](_0x26621e(0x105)+_0x341303);const _0x57f471=await withSpinner('Resolving\x20\x27'+_0x3ffa75+_0x26621e(0x14f),()=>_0xcc1042[_0x26621e(0xda)][_0x26621e(0x13a)](_0x341303),{'verbose':_0x20b4a0[_0x26621e(0xcf)]}),_0x536d9c=_0x57f471[_0x26621e(0x13e)];_0x20b4a0[_0x26621e(0xcf)]&&(console[_0x26621e(0xd9)](_0x26621e(0xdb)+_0x536d9c[_0x26621e(0x147)]),console['error'](_0x26621e(0x169)+_0x536d9c['parentId']));if(_0x536d9c['type']===_0x26621e(0xe6))return console[_0x26621e(0xd9)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x26621e(0xe9)),0x1;if(_0x536d9c['type']===_0x26621e(0xd6))return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x26621e(0xd9)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x536d9c[_0x26621e(0x162)])throw new SDKError(ErrorCode[_0x26621e(0x13f)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x439b44=await withSpinner(_0x26621e(0x135),()=>_0xcc1042[_0x26621e(0xda)][_0x26621e(0xde)](_0x536d9c[_0x26621e(0x15c)],_0x536d9c[_0x26621e(0x162)]),{'verbose':_0x20b4a0['verbose']}),_0x58b6ba=_0x439b44[_0x26621e(0x13e)],_0x2a0120=await executeSchemaQuery(_0x58b6ba,_0xcc1042,_0x20b4a0);return await handleQueryOutput(_0x2a0120,_0x20b4a0),0x0;}catch(_0x511403){if(_0x511403 instanceof SDKError)return console[_0x26621e(0xd9)]('Error:\x20'+_0x511403['message']),_0x511403[_0x26621e(0xd8)]&&console[_0x26621e(0xd9)](_0x26621e(0xcd)+_0x511403['cause']),0x1;throw _0x511403;}}}
|
|
1
|
+
const a40_0x38ed66=a40_0x21f9;(function(_0x25dc87,_0x5614a8){const _0xdba63e=a40_0x21f9,_0x2c40c6=_0x25dc87();while(!![]){try{const _0x47134c=parseInt(_0xdba63e(0x146))/0x1+-parseInt(_0xdba63e(0x14a))/0x2*(parseInt(_0xdba63e(0x13f))/0x3)+-parseInt(_0xdba63e(0x109))/0x4*(parseInt(_0xdba63e(0x101))/0x5)+-parseInt(_0xdba63e(0x172))/0x6+-parseInt(_0xdba63e(0x14b))/0x7+parseInt(_0xdba63e(0x151))/0x8+parseInt(_0xdba63e(0x12c))/0x9;if(_0x47134c===_0x5614a8)break;else _0x2c40c6['push'](_0x2c40c6['shift']());}catch(_0x496ddc){_0x2c40c6['push'](_0x2c40c6['shift']());}}}(a40_0x4bb8,0x6bfe7));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 a40_0x4686ff from'chalk';async function resolveSegmentTarget(_0x29dbc5,_0x3407d7,_0x574227){const _0x2584c5=a40_0x21f9;if(isYamlFilePath(_0x29dbc5))try{const _0x323cc1=await resolveYamlFilePath(_0x29dbc5);return _0x574227&&(console[_0x2584c5(0x113)]('Resolved\x20YAML\x20file:\x20'+_0x29dbc5),console[_0x2584c5(0x113)](_0x2584c5(0x10e)+_0x323cc1[_0x2584c5(0xfe)]),console[_0x2584c5(0x113)](_0x2584c5(0x133)+_0x323cc1[_0x2584c5(0x10c)]),console[_0x2584c5(0x113)](_0x2584c5(0x11b)+(_0x323cc1['folderPath']||_0x2584c5(0xe4))),console[_0x2584c5(0x113)](_0x2584c5(0x17b)+_0x323cc1[_0x2584c5(0x12f)])),_0x323cc1[_0x2584c5(0x12f)];}catch(_0x4573f5){throw new SDKError(ErrorCode[_0x2584c5(0x130)],_0x2584c5(0xf1)+_0x4573f5[_0x2584c5(0x185)]);}if(!_0x3407d7)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2584c5(0x164));return _0x3407d7+'/'+_0x29dbc5;}export class SegmentDescribeCommand extends BaseCommand{[a40_0x38ed66(0x15f)]='segment:describe';[a40_0x38ed66(0xfc)]=a40_0x38ed66(0x13b);async['execute'](_0x1aca32){const _0x39882a=a40_0x38ed66,{options:_0x1f5352,args:_0x3ae5d9,tdx:_0x1fa973}=_0x1aca32,_0x4b5bc0=_0x3ae5d9[0x0],_0x39f192=!_0x4b5bc0&&!!_0x1f5352[_0x39882a(0xfe)],_0x536c7a=_0x4b5bc0||_0x1f5352['parentSegment'];if(!_0x536c7a)return console['error'](_0x39882a(0xf5)),console[_0x39882a(0x113)](_0x39882a(0x132)),console[_0x39882a(0x113)]('Examples:'),console['error'](_0x39882a(0xef)),console[_0x39882a(0x113)](_0x39882a(0xed)),console[_0x39882a(0x113)](_0x39882a(0x103)),console['error'](_0x39882a(0x106)),0x1;try{const _0x250be4=_0x1f5352[_0x39882a(0x162)];let _0x1bdbf2=_0x536c7a;!_0x39f192&&_0x250be4&&!_0x536c7a['includes']('/')&&(_0x1bdbf2=_0x250be4+'/'+_0x536c7a,_0x1f5352['verbose']&&console[_0x39882a(0x113)](_0x39882a(0x163)+_0x1bdbf2));const _0x3f5f5a=await withSpinner(_0x39882a(0x175)+_0x1bdbf2+_0x39882a(0x11d),()=>_0x1fa973['segment'][_0x39882a(0xfa)](_0x1bdbf2),{'verbose':_0x1f5352[_0x39882a(0xe0)]}),_0x5eeb83=_0x3f5f5a[_0x39882a(0x158)];_0x1f5352['verbose']&&(console[_0x39882a(0x113)](_0x39882a(0xf6)+_0x5eeb83[_0x39882a(0x186)]),console[_0x39882a(0x113)]('Parent\x20ID:\x20'+_0x5eeb83[_0x39882a(0x108)]),_0x5eeb83[_0x39882a(0x156)]&&console[_0x39882a(0x113)](_0x39882a(0x117)+_0x5eeb83['folderId']),_0x5eeb83[_0x39882a(0xee)]&&console['error'](_0x39882a(0xea)+_0x5eeb83['segmentId']));if(_0x5eeb83[_0x39882a(0x186)]==='parent'){const _0x45478b=await withSpinner(_0x39882a(0x157),()=>_0x1fa973['segment'][_0x39882a(0x13c)](_0x5eeb83[_0x39882a(0x108)]),{'verbose':_0x1f5352[_0x39882a(0xe0)]});await handleSingleObjectOutput(_0x45478b['data'],_0x1f5352);}else{if(_0x5eeb83[_0x39882a(0x186)]==='folder'){if(!_0x5eeb83[_0x39882a(0x156)])throw new SDKError(ErrorCode[_0x39882a(0x112)],_0x39882a(0x107));const _0x1bfc6f=await withSpinner(_0x39882a(0x12a),()=>_0x1fa973['segment'][_0x39882a(0x17d)](_0x5eeb83[_0x39882a(0x156)]),{'verbose':_0x1f5352[_0x39882a(0xe0)]});await handleSingleObjectOutput(_0x1bfc6f['data'],_0x1f5352);}else{if(_0x5eeb83['type']===_0x39882a(0xf3)){if(!_0x5eeb83[_0x39882a(0xee)])throw new SDKError(ErrorCode[_0x39882a(0x131)],_0x39882a(0x160));const _0x3c5b89=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1fa973[_0x39882a(0xf3)][_0x39882a(0x15a)](_0x5eeb83['parentId'],_0x5eeb83[_0x39882a(0xee)]),{'verbose':_0x1f5352[_0x39882a(0xe0)]});await handleSingleObjectOutput(_0x3c5b89[_0x39882a(0x158)],_0x1f5352);}}}return 0x0;}catch(_0x33e94e){if(_0x33e94e instanceof SDKError)return console[_0x39882a(0x113)]('Error:\x20'+_0x33e94e[_0x39882a(0x185)]),_0x33e94e[_0x39882a(0x105)]&&console[_0x39882a(0x113)](_0x39882a(0x129)+_0x33e94e[_0x39882a(0x105)]),0x1;throw _0x33e94e;}}}export class SegmentShowCommand extends BaseCommand{[a40_0x38ed66(0x15f)]=a40_0x38ed66(0x170);['description']=a40_0x38ed66(0x124);async['execute'](_0x231e1b){const _0x23d1ae=a40_0x38ed66,{options:_0x257e5b,args:_0x455db5,tdx:_0x33b0d5}=_0x231e1b,_0x45c7ea=_0x455db5[0x0];if(!_0x45c7ea)return console['error'](_0x23d1ae(0x127)),console[_0x23d1ae(0x113)](_0x23d1ae(0x10f)),console[_0x23d1ae(0x113)](_0x23d1ae(0xeb)),console[_0x23d1ae(0x113)](_0x23d1ae(0xe9)),console['error'](_0x23d1ae(0x153)),console[_0x23d1ae(0x113)](_0x23d1ae(0xe8)),0x1;try{const _0x4315db=_0x257e5b['parentSegment'],_0x38bdfd=await resolveSegmentTarget(_0x45c7ea,_0x4315db,_0x257e5b['verbose']);_0x257e5b[_0x23d1ae(0xe0)]&&console[_0x23d1ae(0x113)](_0x23d1ae(0x159)+_0x38bdfd);const _0xa0fd89=await withSpinner('Resolving\x20\x27'+_0x45c7ea+'\x27...',()=>_0x33b0d5[_0x23d1ae(0xf3)][_0x23d1ae(0xfa)](_0x38bdfd),{'verbose':_0x257e5b[_0x23d1ae(0xe0)]}),_0x582ac3=_0xa0fd89[_0x23d1ae(0x158)];_0x257e5b[_0x23d1ae(0xe0)]&&(console['error'](_0x23d1ae(0xf6)+_0x582ac3[_0x23d1ae(0x186)]),console[_0x23d1ae(0x113)](_0x23d1ae(0x143)+_0x582ac3[_0x23d1ae(0x108)]));if(_0x582ac3['type']==='folder')return console['error'](_0x23d1ae(0x13d)),console[_0x23d1ae(0x113)](_0x23d1ae(0x155)),0x1;if(_0x582ac3[_0x23d1ae(0x186)]===_0x23d1ae(0xf2))return console[_0x23d1ae(0x113)](_0x23d1ae(0xf7)),console[_0x23d1ae(0x113)](_0x23d1ae(0xe3)),0x1;if(!_0x582ac3['segmentId'])throw new SDKError(ErrorCode[_0x23d1ae(0x131)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2e0f65=await withSpinner(_0x23d1ae(0x171),()=>_0x33b0d5['segment'][_0x23d1ae(0x167)](_0x582ac3[_0x23d1ae(0x108)],_0x582ac3[_0x23d1ae(0xee)]),{'verbose':_0x257e5b[_0x23d1ae(0xe0)]});let _0x158046=_0x2e0f65[_0x23d1ae(0x158)];const _0x1f1a68=resolveLimit(_0x257e5b[_0x23d1ae(0x173)],DEFAULT_DISPLAY_LIMIT),_0x71695a=/\bLIMIT\s+\d+/i['test'](_0x158046);!_0x71695a&&(_0x158046=_0x158046[_0x23d1ae(0x138)]()['replace'](/;+$/,''),_0x158046='SELECT\x20*\x20FROM\x20(\x0a'+_0x158046+_0x23d1ae(0x14c)+_0x1f1a68);_0x257e5b[_0x23d1ae(0xe0)]&&console['error'](_0x23d1ae(0x166)+_0x158046);const _0x42cfca=await withProgressSpinner(_0x23d1ae(0x177),async _0x53a61a=>{const _0x5454da=_0x23d1ae,_0x4229fb=await _0x33b0d5['query']['execute'](_0x158046,{'catalog':'td','schema':_0x5454da(0x120),'onJobId':_0x231a50=>{const _0x4e4a87=_0x5454da;_0x53a61a[_0x4e4a87(0x10a)](_0x231a50);}});return _0x4229fb;},{'verbose':_0x257e5b[_0x23d1ae(0xe0)]}),_0x312577=_0x42cfca[_0x23d1ae(0x158)],_0x154c53=_0x312577[_0x23d1ae(0x10d)]?'\x20[Job\x20ID:\x20'+_0x312577[_0x23d1ae(0x10d)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x312577['stats'][_0x23d1ae(0x17f)][_0x23d1ae(0x126)]()+_0x23d1ae(0xe7)+(_0x23d1ae(0x145)+formatElapsed(_0x312577[_0x23d1ae(0x180)][_0x23d1ae(0xe1)])+_0x154c53)),await handleQueryOutput(_0x312577,_0x257e5b),0x0;}catch(_0x2c3e24){if(_0x2c3e24 instanceof SDKError)return console[_0x23d1ae(0x113)](_0x23d1ae(0x139)+_0x2c3e24[_0x23d1ae(0x13a)]+']'),console[_0x23d1ae(0x113)]('\x0a'+_0x2c3e24['message']),0x1;throw _0x2c3e24;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a40_0x38ed66(0xfc)]=a40_0x38ed66(0x141);async[a40_0x38ed66(0x17a)](_0x4c6517){const _0x2d4957=a40_0x38ed66,{options:_0x1332b3,args:_0x1150ef,tdx:_0x476f00}=_0x4c6517;if(_0x1150ef[_0x2d4957(0x149)]===0x0)return console[_0x2d4957(0x113)](_0x2d4957(0x183)),console[_0x2d4957(0x113)](_0x2d4957(0x116)),0x1;const _0x84d7c3=_0x1150ef[0x0];try{_0x1332b3['verbose']&&(console[_0x2d4957(0x113)](_0x2d4957(0xff)+_0x1332b3[_0x2d4957(0x16e)]),console['error']('Parent\x20name:\x20'+_0x84d7c3));const _0x8e87fe=await withSpinner(_0x2d4957(0x114)+_0x84d7c3+_0x2d4957(0x11d),()=>_0x476f00[_0x2d4957(0xf3)][_0x2d4957(0x102)](_0x84d7c3),{'verbose':_0x1332b3['verbose']}),_0x121a88=_0x8e87fe[_0x2d4957(0x158)];_0x1332b3['verbose']&&console[_0x2d4957(0x113)](_0x2d4957(0x144)+_0x121a88);const _0x5a7a88=await withSpinner(_0x2d4957(0x184)+_0x84d7c3+_0x2d4957(0x11d),()=>_0x476f00[_0x2d4957(0xf3)][_0x2d4957(0x168)](_0x121a88),{'verbose':_0x1332b3[_0x2d4957(0xe0)]}),_0x427a70=_0x5a7a88['data'];return console[_0x2d4957(0x113)](_0x2d4957(0x15d)+_0x427a70[_0x2d4957(0x149)]+_0x2d4957(0x17e)+(_0x427a70[_0x2d4957(0x149)]!==0x1?'s':'')),await handleSDKOutput(_0x427a70,_0x1332b3),0x0;}catch(_0x399312){if(_0x399312 instanceof SDKError)return console['error'](_0x2d4957(0x174)+_0x399312['message']),_0x399312['cause']&&console[_0x2d4957(0x113)]('\x20\x20Cause:\x20'+_0x399312['cause']),0x1;throw _0x399312;}}}export class SegmentFolderShowCommand extends BaseCommand{[a40_0x38ed66(0x15f)]=a40_0x38ed66(0xf8);[a40_0x38ed66(0xfc)]='Show\x20segment\x20folder\x20details';async[a40_0x38ed66(0x17a)](_0x1f0052){const _0xb112a2=a40_0x38ed66,{options:_0x5eac3a,args:_0xd99628,tdx:_0x2f435}=_0x1f0052;if(_0xd99628[_0xb112a2(0x149)]===0x0)return console[_0xb112a2(0x113)](_0xb112a2(0x11e)),console[_0xb112a2(0x113)](_0xb112a2(0x137)),0x1;try{const {parentId:_0x39ab88,childId:_0x5c7d96}=parseSegmentRef(_0xd99628[0x0]);_0x5eac3a[_0xb112a2(0xe0)]&&(console[_0xb112a2(0x113)](_0xb112a2(0xff)+_0x5eac3a[_0xb112a2(0x16e)]),console[_0xb112a2(0x113)](_0xb112a2(0x16a)+_0x39ab88),_0x5c7d96&&console[_0xb112a2(0x113)](_0xb112a2(0x15c)+_0x5c7d96));if(!_0x5c7d96)return console[_0xb112a2(0x113)](_0xb112a2(0xe2)),0x1;const _0x105307=await withSpinner(_0xb112a2(0x114)+_0x39ab88+'\x27...',()=>_0x2f435[_0xb112a2(0xf3)][_0xb112a2(0x102)](_0x39ab88),{'verbose':_0x5eac3a[_0xb112a2(0xe0)]}),_0x41b774=_0x105307[_0xb112a2(0x158)];_0x5eac3a['verbose']&&console[_0xb112a2(0x113)](_0xb112a2(0x144)+_0x41b774);const _0x5ac2c8=await withSpinner(_0xb112a2(0x136)+_0x5c7d96+_0xb112a2(0x11d),()=>_0x2f435[_0xb112a2(0xf3)][_0xb112a2(0x187)](_0x41b774,_0x5c7d96),{'verbose':_0x5eac3a['verbose']}),_0x4b26cd=_0x5ac2c8[_0xb112a2(0x158)];_0x5eac3a[_0xb112a2(0xe0)]&&console[_0xb112a2(0x113)]('Resolved\x20folder\x20ID:\x20'+_0x4b26cd);const _0x53e8e4=await withSpinner(_0xb112a2(0x148)+_0x5c7d96+_0xb112a2(0x11d),()=>_0x2f435['segment'][_0xb112a2(0x17d)](_0x4b26cd),{'verbose':_0x5eac3a[_0xb112a2(0xe0)]});return await handleSDKOutput([_0x53e8e4['data']],_0x5eac3a),0x0;}catch(_0x310776){if(_0x310776 instanceof SDKError)return console[_0xb112a2(0x113)](_0xb112a2(0x174)+_0x310776[_0xb112a2(0x185)]),_0x310776['cause']&&console['error']('\x20\x20Cause:\x20'+_0x310776[_0xb112a2(0x105)]),0x1;throw _0x310776;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a40_0x38ed66(0x121);[a40_0x38ed66(0xfc)]=a40_0x38ed66(0x134);async[a40_0x38ed66(0x17a)](_0x1f128c){const _0x254712=a40_0x38ed66,{options:_0x43be11,args:_0x800039}=_0x1f128c,_0x124f6c=_0x43be11,_0x12030f=_0x124f6c[_0x254712(0x110)],_0x424662=_0x800039[0x0];if(!_0x424662&&!_0x12030f)return console[_0x254712(0x113)](a40_0x4686ff[_0x254712(0x165)](_0x254712(0xf0))),console[_0x254712(0x113)]('Usage:'),console[_0x254712(0x113)](_0x254712(0x176)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x254712(0x113)](_0x254712(0xe9)),console['error'](_0x254712(0x15b)),console[_0x254712(0x113)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x424662&&_0x12030f)return console[_0x254712(0x113)](a40_0x4686ff[_0x254712(0x165)](_0x254712(0xf4))),0x1;try{let _0x1e65ce;if(_0x12030f)_0x1e65ce=await this[_0x254712(0x169)](_0x12030f,_0x1f128c);else{if(isYamlFilePath(_0x424662))return console[_0x254712(0x113)](a40_0x4686ff[_0x254712(0x165)](_0x254712(0x16d))),console[_0x254712(0x113)](_0x254712(0x12b)+_0x424662),0x1;else _0x1e65ce=await this[_0x254712(0xe6)](_0x424662,_0x1f128c);}return _0x43be11[_0x254712(0x14e)]===_0x254712(0x100)||_0x43be11[_0x254712(0x14e)]===_0x254712(0x15e)?await handleSDKOutput([{'sql':_0x1e65ce}],_0x43be11):console[_0x254712(0x118)](_0x1e65ce),0x0;}catch(_0xcfd867){if(_0xcfd867 instanceof SDKError)return console[_0x254712(0x113)](_0x254712(0x174)+_0xcfd867['message']),_0xcfd867[_0x254712(0x105)]&&console[_0x254712(0x113)](_0x254712(0x129)+_0xcfd867[_0x254712(0x105)]),0x1;throw _0xcfd867;}}async[a40_0x38ed66(0x169)](_0x310d94,_0x56c7ab){const _0x2afc2d=a40_0x38ed66,{options:_0x39acd4,tdx:_0x1ffd95}=_0x56c7ab;let _0x2706b2;try{_0x2706b2=await resolveYamlFilePath(_0x310d94);}catch(_0xf944d8){throw new SDKError(ErrorCode[_0x2afc2d(0x130)],_0x2afc2d(0xf1)+_0xf944d8[_0x2afc2d(0x185)]);}_0x39acd4[_0x2afc2d(0xe0)]&&console[_0x2afc2d(0x113)](_0x2afc2d(0x125)+_0x2706b2[_0x2afc2d(0xfe)]+'/'+_0x2706b2[_0x2afc2d(0x10c)]);const _0x5b0b6e=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x1ffd95[_0x2afc2d(0xf3)]['getSegmentSQLFromYaml'](_0x2706b2[_0x2afc2d(0x115)],_0x2706b2['parentSegment'],_0x2706b2['segmentName']),{'verbose':_0x39acd4['verbose']});return _0x5b0b6e['data'];}async[a40_0x38ed66(0xe6)](_0x7a8259,_0x189c8c){const _0x1a11d4=a40_0x38ed66,{options:_0x4d3013,tdx:_0x52f3c6}=_0x189c8c,_0x516f37=_0x4d3013['parentSegment'],_0x485541=await resolveSegmentTarget(_0x7a8259,_0x516f37,_0x4d3013[_0x1a11d4(0xe0)]);_0x4d3013['verbose']&&console[_0x1a11d4(0x113)](_0x1a11d4(0x159)+_0x485541);const _0x4c7226=await withSpinner(_0x1a11d4(0x16c)+_0x7a8259+'\x27...',()=>_0x52f3c6['segment'][_0x1a11d4(0xfa)](_0x485541),{'verbose':_0x4d3013[_0x1a11d4(0xe0)]}),_0x48c37d=_0x4c7226['data'];_0x4d3013[_0x1a11d4(0xe0)]&&(console[_0x1a11d4(0x113)](_0x1a11d4(0xf6)+_0x48c37d[_0x1a11d4(0x186)]),console['error']('Parent\x20ID:\x20'+_0x48c37d['parentId']));if(_0x48c37d[_0x1a11d4(0x186)]===_0x1a11d4(0x14f))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1a11d4(0x14d));if(_0x48c37d['type']==='parent')throw new SDKError(ErrorCode[_0x1a11d4(0x130)],_0x1a11d4(0x140));if(!_0x48c37d[_0x1a11d4(0xee)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1a11d4(0x160));const _0x1745b4=await withSpinner(_0x1a11d4(0x171),()=>_0x52f3c6[_0x1a11d4(0xf3)][_0x1a11d4(0x167)](_0x48c37d[_0x1a11d4(0x108)],_0x48c37d[_0x1a11d4(0xee)]),{'verbose':_0x4d3013[_0x1a11d4(0xe0)]});return _0x1745b4[_0x1a11d4(0x158)];}}function a40_0x4bb8(){const _0x2d95be=['jobId','\x20\x20Parent\x20segment:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','path','web','SEGMENT_FOLDER_NOT_FOUND','error','Resolving\x20parent\x20segment\x20\x27','content','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Folder\x20ID:\x20','log','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20Folder\x20path:\x20','segment:folder:create','\x27...','Error:\x20Folder\x20reference\x20is\x20required','\x27\x20with\x20ID:\x20','information_schema','segment:sql','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved:\x20','toLocaleString','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20view','\x20\x20Cause:\x20','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20sql\x20--path\x20','11338560cWHULI','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','fullPath','INVALID_ARGUMENT','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20Segment\x20name:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','trim','✖\x20Query\x20failed\x20[','code','Show\x20segment\x20or\x20folder\x20details','getParent','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:desc','22089ZSIiUs','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20ID:\x20','Resolved\x20parent\x20ID:\x20','in\x20','74369ZTMZdE','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Fetching\x20folder\x20\x27','length','24kEnCmj','4283958UGZKJH','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','format','folder','url','4494424cFyFjr','/e/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Show\x20child\x20segment\x20schema\x20(column\x20types)','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','folderId','Fetching\x20parent\x20segment\x20details...','data','Target\x20path:\x20','getSegment','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Folder\x20name:\x20','✔\x20Found\x20','jsonl','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20desc\x20<name>','segmentPath','Resolved\x20relative\x20path\x20to:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','red','SQL\x20query:\x0a','getSegmentSQL','listFolders','getSQLFromYamlFile','Parent\x20name:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolving\x20\x27','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','site','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','segment:show','Fetching\x20SQL\x20for\x20segment...','406620qoyqHN','limit','Error:\x20','Resolving\x20path\x20\x27','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Executing\x20segment\x20query...','green','Fetching\x20segment\x20details...','execute','\x20\x20Full\x20path:\x20','cyan','getFolder','\x20folder','processedRows','stats','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Parent\x20segment\x20name\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','message','type','resolveFolderId','verbose','elapsedTimeMillis','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20show','(root)','/app/ps/','getSQLFromServerSegment','\x20rows\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Examples:','Segment\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Parent\x20segment:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','parent','segment','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Error:\x20Path\x20or\x20name\x20is\x20required','Resolved\x20type:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:show','✔\x20Created\x20folder\x20\x27','resolvePathToResource','parentFolder','description','Show\x20folder\x20or\x20child\x20segment\x20details','parentSegment','Site:\x20','json','32035lPLPie','resolveParentId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','cause','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','parentId','428zuujtq','setJobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segmentName'];a40_0x4bb8=function(){return _0x2d95be;};return a40_0x4bb8();}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a40_0x38ed66(0x11c);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a40_0x38ed66(0x17a)](_0x568017){const _0x18e996=a40_0x38ed66,{options:_0x7564a4,args:_0x10453e,tdx:_0x20d858}=_0x568017,_0x3e68a5=_0x7564a4;if(_0x10453e['length']<0x2)return console[_0x18e996(0x113)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x18e996(0x113)](_0x18e996(0x182)),0x1;const _0x52a3c7=_0x10453e[0x0],_0x10af00=_0x10453e[0x1];_0x3e68a5[_0x18e996(0xe0)]&&(console[_0x18e996(0x113)](_0x18e996(0xff)+_0x3e68a5[_0x18e996(0x16e)]),console[_0x18e996(0x113)](_0x18e996(0xec)+_0x52a3c7),console[_0x18e996(0x113)](_0x18e996(0x15c)+_0x10af00));let _0x446810;if(_0x3e68a5[_0x18e996(0xfb)]){const _0x37f304=_0x3e68a5['parentFolder'],_0x35ccdf=await withSpinner(_0x18e996(0x114)+_0x52a3c7+_0x18e996(0x11d),()=>_0x20d858[_0x18e996(0xf3)]['resolveParentId'](_0x52a3c7),{'verbose':_0x3e68a5[_0x18e996(0xe0)]}),_0x11892c=_0x35ccdf[_0x18e996(0x158)],_0x24c5cd=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x37f304+_0x18e996(0x11d),()=>_0x20d858['segment'][_0x18e996(0x187)](_0x11892c,_0x37f304),{'verbose':_0x3e68a5[_0x18e996(0xe0)]});_0x446810=_0x24c5cd[_0x18e996(0x158)],_0x3e68a5['verbose']&&console[_0x18e996(0x113)](_0x18e996(0x142)+_0x446810);}const _0x154085={'name':_0x10af00,'description':_0x3e68a5[_0x18e996(0xfc)],'parentFolderId':_0x446810},_0x3baacc=await withSpinner('Creating\x20folder\x20\x27'+_0x10af00+'\x27...',()=>_0x20d858['segment']['createFolder'](_0x52a3c7,_0x154085),{'verbose':_0x3e68a5[_0x18e996(0xe0)]}),_0x29f228=_0x3baacc[_0x18e996(0x158)];return console[_0x18e996(0x113)](_0x18e996(0xf9)+_0x29f228[_0x18e996(0x15f)]+_0x18e996(0x11f)+_0x29f228['id']),await handleSDKOutput([_0x29f228],_0x3e68a5),0x0;}}export class SegmentViewCommand extends BaseCommand{[a40_0x38ed66(0x15f)]='segment:view';[a40_0x38ed66(0xfc)]=a40_0x38ed66(0xfd);async['execute'](_0x21386e){const _0x5cccfc=a40_0x38ed66,{options:_0x1279c9,args:_0x314961,tdx:_0x349483}=_0x21386e,_0x536c28=_0x314961[0x0];if(!_0x536c28)return console[_0x5cccfc(0x113)](_0x5cccfc(0x104)),console[_0x5cccfc(0x113)](_0x5cccfc(0x123)),console['error'](_0x5cccfc(0x10b)),console[_0x5cccfc(0x113)]('Options:'),console[_0x5cccfc(0x113)](_0x5cccfc(0x16b)),console[_0x5cccfc(0x113)](_0x5cccfc(0xe9)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x5cccfc(0x113)](_0x5cccfc(0x122)),console[_0x5cccfc(0x113)](_0x5cccfc(0x12d)),console[_0x5cccfc(0x113)](_0x5cccfc(0x11a)),0x1;try{const _0x28370c=_0x1279c9[_0x5cccfc(0xfe)],_0xf59a94=await resolveSegmentTarget(_0x536c28,_0x28370c,_0x1279c9['verbose']);_0x1279c9[_0x5cccfc(0xe0)]&&console[_0x5cccfc(0x113)](_0x5cccfc(0x159)+_0xf59a94);const _0x3e448=await withSpinner(_0x5cccfc(0x16c)+_0x536c28+_0x5cccfc(0x11d),()=>_0x349483['segment'][_0x5cccfc(0xfa)](_0xf59a94),{'verbose':_0x1279c9[_0x5cccfc(0xe0)]}),_0x509459=_0x3e448[_0x5cccfc(0x158)];_0x1279c9[_0x5cccfc(0xe0)]&&(console['error']('Resolved\x20type:\x20'+_0x509459[_0x5cccfc(0x186)]),console[_0x5cccfc(0x113)](_0x5cccfc(0x143)+_0x509459['parentId']),_0x509459[_0x5cccfc(0x156)]&&console['error'](_0x5cccfc(0x117)+_0x509459['folderId']),_0x509459[_0x5cccfc(0xee)]&&console[_0x5cccfc(0x113)](_0x5cccfc(0xea)+_0x509459['segmentId']));if(_0x1279c9[_0x5cccfc(0x111)]){if(_0x509459[_0x5cccfc(0x186)]===_0x5cccfc(0x14f))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x509459[_0x5cccfc(0x186)]===_0x5cccfc(0xf2))return console['error'](_0x5cccfc(0x181)),console[_0x5cccfc(0x113)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x509459[_0x5cccfc(0xee)])throw new SDKError(ErrorCode[_0x5cccfc(0x131)],_0x5cccfc(0x160));const _0x52aad1=getConsoleNextUrl(_0x1279c9['site'],_0x5cccfc(0xe5)+_0x509459[_0x5cccfc(0x108)]+_0x5cccfc(0x152)+_0x509459['segmentId']);return console[_0x5cccfc(0x113)](a40_0x4686ff[_0x5cccfc(0x178)]('✔')+'\x20Opening\x20'+a40_0x4686ff[_0x5cccfc(0x17c)](_0x52aad1)),openBrowser(_0x52aad1),0x0;}if(_0x509459[_0x5cccfc(0x186)]===_0x5cccfc(0x14f)){if(!_0x509459[_0x5cccfc(0x156)])throw new SDKError(ErrorCode[_0x5cccfc(0x112)],_0x5cccfc(0x107));const _0x5119ea=await withSpinner('Fetching\x20folder\x20details...',()=>_0x349483[_0x5cccfc(0xf3)][_0x5cccfc(0x17d)](_0x509459[_0x5cccfc(0x156)]),{'verbose':_0x1279c9['verbose']});await handleSingleObjectOutput(_0x5119ea[_0x5cccfc(0x158)],_0x1279c9);}else{if(_0x509459['type']==='segment'){if(!_0x509459[_0x5cccfc(0xee)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5cccfc(0x160));const _0x5d2a7f=await withSpinner(_0x5cccfc(0x179),()=>_0x349483[_0x5cccfc(0xf3)][_0x5cccfc(0x15a)](_0x509459['parentId'],_0x509459[_0x5cccfc(0xee)]),{'verbose':_0x1279c9['verbose']}),_0x5c7d53=getConsoleNextUrl(_0x1279c9[_0x5cccfc(0x16e)],_0x5cccfc(0xe5)+_0x509459[_0x5cccfc(0x108)]+_0x5cccfc(0x152)+_0x509459[_0x5cccfc(0xee)]),_0x5ce303=_0x5d2a7f[_0x5cccfc(0x158)];_0x5ce303[_0x5cccfc(0x150)]=_0x5c7d53,await handleSingleObjectOutput(_0x5ce303,_0x1279c9);}else return console[_0x5cccfc(0x113)](_0x5cccfc(0x147)),console[_0x5cccfc(0x113)](_0x5cccfc(0x128)),0x1;}return 0x0;}catch(_0x577c49){if(_0x577c49 instanceof SDKError)return console[_0x5cccfc(0x113)](_0x5cccfc(0x174)+_0x577c49[_0x5cccfc(0x185)]),_0x577c49[_0x5cccfc(0x105)]&&console[_0x5cccfc(0x113)]('\x20\x20Cause:\x20'+_0x577c49[_0x5cccfc(0x105)]),0x1;throw _0x577c49;}}}export const SegmentInfoCommand=SegmentViewCommand;function a40_0x21f9(_0x50d604,_0x20e633){_0x50d604=_0x50d604-0xe0;const _0x4bb8a8=a40_0x4bb8();let _0x21f91a=_0x4bb8a8[_0x50d604];return _0x21f91a;}export class SegmentDescCommand extends BaseCommand{['name']=a40_0x38ed66(0x13e);[a40_0x38ed66(0xfc)]=a40_0x38ed66(0x154);async[a40_0x38ed66(0x17a)](_0x76c75d){const _0x533e61=a40_0x38ed66,{options:_0x58072c,args:_0x5f2ac7,tdx:_0x4ca65f}=_0x76c75d,_0x2e523b=_0x5f2ac7[0x0];if(!_0x2e523b)return console[_0x533e61(0x113)](_0x533e61(0x127)),console[_0x533e61(0x113)](_0x533e61(0x161)),console[_0x533e61(0x113)](_0x533e61(0x119)),console[_0x533e61(0x113)](_0x533e61(0xe9)),console[_0x533e61(0x113)](_0x533e61(0x16f)),console[_0x533e61(0x113)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5059e5=_0x58072c[_0x533e61(0xfe)],_0x4ae9c6=await resolveSegmentTarget(_0x2e523b,_0x5059e5,_0x58072c[_0x533e61(0xe0)]);_0x58072c['verbose']&&console[_0x533e61(0x113)](_0x533e61(0x159)+_0x4ae9c6);const _0x5c1a3d=await withSpinner(_0x533e61(0x16c)+_0x2e523b+_0x533e61(0x11d),()=>_0x4ca65f[_0x533e61(0xf3)]['resolvePathToResource'](_0x4ae9c6),{'verbose':_0x58072c[_0x533e61(0xe0)]}),_0x504e8b=_0x5c1a3d[_0x533e61(0x158)];_0x58072c[_0x533e61(0xe0)]&&(console[_0x533e61(0x113)]('Resolved\x20type:\x20'+_0x504e8b[_0x533e61(0x186)]),console[_0x533e61(0x113)](_0x533e61(0x143)+_0x504e8b[_0x533e61(0x108)]));if(_0x504e8b['type']===_0x533e61(0x14f))return console[_0x533e61(0x113)](_0x533e61(0x135)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x504e8b[_0x533e61(0x186)]===_0x533e61(0xf2))return console[_0x533e61(0x113)](_0x533e61(0x12e)),console[_0x533e61(0x113)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x504e8b[_0x533e61(0xee)])throw new SDKError(ErrorCode[_0x533e61(0x131)],_0x533e61(0x160));const _0x2ffeca=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4ca65f[_0x533e61(0xf3)][_0x533e61(0x167)](_0x504e8b[_0x533e61(0x108)],_0x504e8b[_0x533e61(0xee)]),{'verbose':_0x58072c['verbose']}),_0x59b8a6=_0x2ffeca[_0x533e61(0x158)],_0x26e5dd=await executeSchemaQuery(_0x59b8a6,_0x4ca65f,_0x58072c);return await handleQueryOutput(_0x26e5dd,_0x58072c),0x0;}catch(_0x111e94){if(_0x111e94 instanceof SDKError)return console['error'](_0x533e61(0x174)+_0x111e94['message']),_0x111e94[_0x533e61(0x105)]&&console['error'](_0x533e61(0x129)+_0x111e94[_0x533e61(0x105)]),0x1;throw _0x111e94;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x36c835=a41_0x41b5;function a41_0x45b5(){const _0x44a8d5=['\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','kind','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','90yHFerX','20hAVclf','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolvePathToResource','6585vBmZha','1872036gjqWfX','✔\x20Created\x20segment\x20\x27','Site:\x20','Resolved\x20folder\x20ID:\x20','\x27...','includes','1IuTOgl','name','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','917824wMuTpH','error','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','folder','execute','Resolving\x20folder\x20\x27','length','312804QbEnXE','\x27\x20with\x20ID:\x20','yellow','390756ILozpa','segment:create','1457542BWzCfe','segments','verbose','Segment\x20name:\x20','ruleFile','data','1520XThjaE','segmentPath','\x20\x20\x20Path:\x20','Parent\x20path:\x20','Parent:\x20','folderId','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','createSegment','resolveParentId','noCountPopulation','invisible','Resolved\x20relative\x20path\x20to:\x20','Target\x20path:\x20','Creating\x20segment\x20\x27','site','8165941OIqXqc','type','parent','Resolving\x20folder\x20path\x20\x27','286TNMuxL'];a41_0x45b5=function(){return _0x44a8d5;};return a41_0x45b5();}(function(_0x4f1f17,_0x464e7d){const _0x584b02=a41_0x41b5,_0x13c10e=_0x4f1f17();while(!![]){try{const _0x273f0d=-parseInt(_0x584b02(0xe7))/0x1*(-parseInt(_0x584b02(0xf6))/0x2)+-parseInt(_0x584b02(0xe0))/0x3*(-parseInt(_0x584b02(0xc3))/0x4)+parseInt(_0x584b02(0xdc))/0x5*(parseInt(_0x584b02(0xf4))/0x6)+-parseInt(_0x584b02(0xd2))/0x7+parseInt(_0x584b02(0xea))/0x8+-parseInt(_0x584b02(0xe1))/0x9*(parseInt(_0x584b02(0xdd))/0xa)+-parseInt(_0x584b02(0xd6))/0xb*(parseInt(_0x584b02(0xf1))/0xc);if(_0x273f0d===_0x464e7d)break;else _0x13c10e['push'](_0x13c10e['shift']());}catch(_0x2238b5){_0x13c10e['push'](_0x13c10e['shift']());}}}(a41_0x45b5,0x8fef2));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a41_0x41b5(_0x2c2d9d,_0x587621){_0x2c2d9d=_0x2c2d9d-0xc1;const _0x45b5ef=a41_0x45b5();let _0x41b5bb=_0x45b5ef[_0x2c2d9d];return _0x41b5bb;}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 a41_0x5b8c89 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a41_0x36c835(0xe8)]=a41_0x36c835(0xf5);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a41_0x36c835(0xee)](_0x1e75ac){const _0x2909c7=a41_0x36c835;console[_0x2909c7(0xeb)](a41_0x5b8c89[_0x2909c7(0xf3)](_0x2909c7(0xe9))),console[_0x2909c7(0xeb)](a41_0x5b8c89[_0x2909c7(0xf3)](_0x2909c7(0xc9)));const {options:_0x41da31,args:_0x2c14a4,tdx:_0x46099c}=_0x1e75ac,_0x2edbd2=_0x41da31;if(_0x2c14a4[_0x2909c7(0xf0)]===0x0)return console[_0x2909c7(0xeb)](_0x2909c7(0xd9)),console[_0x2909c7(0xeb)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x2909c7(0xeb)]('Examples:'),console['error'](_0x2909c7(0xdb)),console[_0x2909c7(0xeb)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x2909c7(0xeb)](_0x2909c7(0xd7)),0x1;const _0x5456bb=_0x2c14a4[0x0],_0x30d9bf=_0x41da31[_0x2909c7(0xc4)];let _0x309328=_0x5456bb;_0x30d9bf&&!_0x5456bb[_0x2909c7(0xe6)]('/')&&(_0x309328=_0x30d9bf+'/'+_0x5456bb,_0x2edbd2[_0x2909c7(0xf8)]&&console[_0x2909c7(0xeb)](_0x2909c7(0xce)+_0x309328));const _0x2a07f7=parsePath(_0x309328);if(_0x2a07f7[_0x2909c7(0xf7)][_0x2909c7(0xf0)]<0x2)return console[_0x2909c7(0xeb)](_0x2909c7(0xde)),console[_0x2909c7(0xeb)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x19f109=_0x2a07f7[_0x2909c7(0xf7)][0x0],_0x119888=getBaseName(_0x309328),_0x26e115=getParentPath(_0x309328);_0x2edbd2['verbose']&&(console[_0x2909c7(0xeb)](_0x2909c7(0xe3)+_0x2edbd2[_0x2909c7(0xd1)]),console['error'](_0x2909c7(0xcf)+_0x309328),console['error'](_0x2909c7(0xc7)+_0x19f109),console[_0x2909c7(0xeb)](_0x2909c7(0xf9)+_0x119888),console[_0x2909c7(0xeb)](_0x2909c7(0xc6)+_0x26e115));const _0x29e0ea=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x19f109+_0x2909c7(0xe5),()=>_0x46099c[_0x2909c7(0xda)][_0x2909c7(0xcb)](_0x19f109),{'verbose':_0x2edbd2[_0x2909c7(0xf8)]}),_0x3113ac=_0x29e0ea['data'];let _0xa7a86;if(_0x2a07f7[_0x2909c7(0xf7)][_0x2909c7(0xf0)]>0x2){const _0x57fcb5=await withSpinner(_0x2909c7(0xd5)+_0x26e115+_0x2909c7(0xe5),()=>_0x46099c[_0x2909c7(0xda)][_0x2909c7(0xdf)](_0x26e115),{'verbose':_0x2edbd2[_0x2909c7(0xf8)]}),_0x5816da=_0x57fcb5[_0x2909c7(0xc2)];if(_0x5816da[_0x2909c7(0xd3)]!==_0x2909c7(0xed)&&_0x5816da[_0x2909c7(0xd3)]!==_0x2909c7(0xd4))return console[_0x2909c7(0xeb)](_0x2909c7(0xec)),0x1;_0xa7a86=_0x5816da[_0x2909c7(0xc8)];}else{if(_0x2edbd2[_0x2909c7(0xed)]){const _0x11439a=await withSpinner(_0x2909c7(0xef)+_0x2edbd2[_0x2909c7(0xed)]+_0x2909c7(0xe5),()=>_0x46099c[_0x2909c7(0xda)]['resolveFolderId'](_0x3113ac,_0x2edbd2[_0x2909c7(0xed)]),{'verbose':_0x2edbd2[_0x2909c7(0xf8)]});_0xa7a86=_0x11439a['data'];}}_0x2edbd2[_0x2909c7(0xf8)]&&_0xa7a86&&console[_0x2909c7(0xeb)](_0x2909c7(0xe4)+_0xa7a86);const _0xe8fac7=await loadJSONFromOptions(_0x2edbd2['rule'],_0x2edbd2[_0x2909c7(0xc1)]),_0x55830d={'name':_0x119888,'description':_0x2edbd2['description'],'rule':_0xe8fac7,'kind':_0x2edbd2['kind']!==undefined?parseInt(_0x2edbd2[_0x2909c7(0xd8)],0xa):undefined,'isVisible':_0x2edbd2[_0x2909c7(0xcd)]?![]:undefined,'segmentFolderId':_0xa7a86,'countPopulation':_0x2edbd2[_0x2909c7(0xcc)]?![]:undefined},_0x5664cb=await withSpinner(_0x2909c7(0xd0)+_0x119888+_0x2909c7(0xe5),()=>_0x46099c['segment'][_0x2909c7(0xca)](_0x3113ac,_0x55830d),{'verbose':_0x2edbd2['verbose']}),_0x21201c=_0x5664cb[_0x2909c7(0xc2)];return console['error'](_0x2909c7(0xe2)+_0x21201c['name']+_0x2909c7(0xf2)+_0x21201c['id']),_0x309328!==_0x5456bb&&console[_0x2909c7(0xeb)](_0x2909c7(0xc5)+_0x309328),await handleSDKOutput([_0x21201c],_0x2edbd2),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x566818=a42_0x2c5c;(function(_0x5b1308,_0x9bab8e){const _0x393079=a42_0x2c5c,_0xf53d=_0x5b1308();while(!![]){try{const _0x59486e=parseInt(_0x393079(0x111))/0x1+parseInt(_0x393079(0x10a))/0x2+parseInt(_0x393079(0x10d))/0x3*(-parseInt(_0x393079(0x103))/0x4)+parseInt(_0x393079(0x10f))/0x5*(-parseInt(_0x393079(0x113))/0x6)+parseInt(_0x393079(0x10c))/0x7*(parseInt(_0x393079(0x115))/0x8)+-parseInt(_0x393079(0x109))/0x9+parseInt(_0x393079(0x110))/0xa;if(_0x59486e===_0x9bab8e)break;else _0xf53d['push'](_0xf53d['shift']());}catch(_0x3ba9f3){_0xf53d['push'](_0xf53d['shift']());}}}(a42_0x4877,0x8dd7a));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a42_0x566818(0x116)]=a42_0x566818(0x106);async['execute'](_0x517f4e){const _0x6f5ae1=a42_0x566818,{options:_0x3c59dd,args:_0x300656,tdx:_0x5ada2a}=_0x517f4e,_0x40229a=_0x300656[0x0]||_0x3c59dd['parentSegment'];if(!_0x40229a)return console[_0x6f5ae1(0x107)](_0x6f5ae1(0x104)),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x6f5ae1(0x107)](_0x6f5ae1(0x112)),0x1;_0x3c59dd[_0x6f5ae1(0x10e)]&&(console['error']('Site:\x20'+_0x3c59dd['site']),console[_0x6f5ae1(0x107)](_0x6f5ae1(0x117)+_0x40229a));const _0x37c270=await withSpinner(_0x6f5ae1(0x102)+_0x40229a+_0x6f5ae1(0x105),()=>_0x5ada2a[_0x6f5ae1(0x108)][_0x6f5ae1(0x114)](_0x40229a),{'verbose':_0x3c59dd['verbose']}),_0x334b70=_0x37c270['data'];console['error'](_0x6f5ae1(0x119)+_0x334b70[_0x6f5ae1(0x118)]+_0x6f5ae1(0x10b)+(_0x334b70[_0x6f5ae1(0x118)]!==0x1?'s':''));if(_0x3c59dd['json']||_0x3c59dd['jsonl'])return await handleSDKOutput(_0x334b70,_0x3c59dd),0x0;return displayFieldsHumanReadable(_0x334b70,_0x40229a),0x0;}}function a42_0x2c5c(_0x29f206,_0x2e8f8b){_0x29f206=_0x29f206-0x102;const _0x48771f=a42_0x4877();let _0x2c5cce=_0x48771f[_0x29f206];return _0x2c5cce;}function a42_0x4877(){const _0x4b2510=['\x20field','2586367TiZNLK','24bzZdpI','verbose','1415pvBwVr','410600TqTCkM','1085592GCFnAQ','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','7836SEQfQK','listFields','8zISEUs','description','Parent\x20segment:\x20','length','✔\x20Found\x20','Listing\x20fields\x20for\x20\x27','382516Zzkpcr','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27...','List\x20available\x20fields\x20for\x20segmentation','error','segment','7658253hlzUjb','2140800pBjcpU'];a42_0x4877=function(){return _0x4b2510;};return a42_0x4877();}
|