@treasuredata/tdx 2026.3.29 → 2026.3.31
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.d.ts +1 -1
- package/dist/cli-categories.d.ts.map +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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/api-command.js.map +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/cas-command.d.ts +55 -0
- package/dist/commands/cas-command.d.ts.map +1 -0
- package/dist/commands/cas-command.js +1 -0
- package/dist/commands/cas-command.js.map +1 -0
- package/dist/commands/cas-segment-command.d.ts +18 -0
- package/dist/commands/cas-segment-command.d.ts.map +1 -0
- package/dist/commands/cas-segment-command.js +1 -0
- package/dist/commands/cas-segment-command.js.map +1 -0
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.d.ts.map +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/unset-command.js.map +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.d.ts +1 -0
- package/dist/core/global-context.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +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.d.ts +2 -1
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/session.js.map +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.d.ts +77 -0
- package/dist/sdk/cas/cas-api-client.d.ts.map +1 -0
- package/dist/sdk/cas/cas-api-client.js +1 -0
- package/dist/sdk/cas/cas-api-client.js.map +1 -0
- package/dist/sdk/cas/cas-audience-yaml.d.ts +32 -0
- package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -0
- package/dist/sdk/cas/cas-audience-yaml.js +1 -0
- package/dist/sdk/cas/cas-audience-yaml.js.map +1 -0
- package/dist/sdk/cas/cas-segment-yaml.d.ts +38 -0
- package/dist/sdk/cas/cas-segment-yaml.d.ts.map +1 -0
- package/dist/sdk/cas/cas-segment-yaml.js +1 -0
- package/dist/sdk/cas/cas-segment-yaml.js.map +1 -0
- package/dist/sdk/cas/index.d.ts +61 -0
- package/dist/sdk/cas/index.d.ts.map +1 -0
- package/dist/sdk/cas/index.js +1 -0
- package/dist/sdk/cas/index.js.map +1 -0
- package/dist/sdk/cas/pull-workflow.d.ts +53 -0
- package/dist/sdk/cas/pull-workflow.d.ts.map +1 -0
- package/dist/sdk/cas/pull-workflow.js +1 -0
- package/dist/sdk/cas/pull-workflow.js.map +1 -0
- package/dist/sdk/cas/push-workflow.d.ts +50 -0
- package/dist/sdk/cas/push-workflow.d.ts.map +1 -0
- package/dist/sdk/cas/push-workflow.js +1 -0
- package/dist/sdk/cas/push-workflow.js.map +1 -0
- package/dist/sdk/cas/types.d.ts +115 -0
- package/dist/sdk/cas/types.d.ts.map +1 -0
- package/dist/sdk/cas/types.js +1 -0
- package/dist/sdk/cas/types.js.map +1 -0
- 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.d.ts +4 -0
- package/dist/sdk/client/endpoints.d.ts.map +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/endpoints.js.map +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.d.ts +6 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cas.d.ts +242 -0
- package/dist/sdk/types/cas.d.ts.map +1 -0
- package/dist/sdk/types/cas.js +1 -0
- package/dist/sdk/types/cas.js.map +1 -0
- package/dist/sdk/types/index.d.ts +3 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x22d585=a33_0x52ae;function a33_0x45e1(){const _0x513c37=['\x20polic','length','getPolicyUsers','name','📋\x20Assigned\x20Policies','bold','description','1796022pZuQLf','101304fWoyPH','policy','getMyPermissions','permissions','entries','1941930nbIVsA','dim','account_owner','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','args','site','20MXaHzo','map','operation','email','✔\x20Found\x20','\x20\x20No\x20policies\x20assigned','204LDhvjV','join','Listing\x20policies...','\x20\x20•\x20','\x20—\x20','91206nhoiCK','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','context','error','getPolicyPermissions','policy\x20list','\x20user','execute','\x20assigned','Account\x20Owner','max','getPolicy','👥\x20Assigned\x20Users','105589DEmhdH','administrator','padEnd','verbose','20mcepln','49397YGWEoW','No\x20policies\x20found','log','Administrator','\x20\x20\x20','all','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','data','user','8xeywyE','policies','account_id','(ID:\x20','104AkcyZu','Member','10512kNLCoc','validate'];a33_0x45e1=function(){return _0x513c37;};return a33_0x45e1();}(function(_0xe6ebe0,_0x1dcec5){const _0x4227cb=a33_0x52ae,_0x43e0f4=_0xe6ebe0();while(!![]){try{const _0x34d6c6=parseInt(_0x4227cb(0x138))/0x1*(-parseInt(_0x4227cb(0x141))/0x2)+parseInt(_0x4227cb(0x147))/0x3*(parseInt(_0x4227cb(0x11b))/0x4)+-parseInt(_0x4227cb(0x137))/0x5*(parseInt(_0x4227cb(0x126))/0x6)+-parseInt(_0x4227cb(0x110))/0x7*(-parseInt(_0x4227cb(0x145))/0x8)+-parseInt(_0x4227cb(0x10f))/0x9+parseInt(_0x4227cb(0x115))/0xa+parseInt(_0x4227cb(0x133))/0xb*(parseInt(_0x4227cb(0x121))/0xc);if(_0x34d6c6===_0x1dcec5)break;else _0x43e0f4['push'](_0x43e0f4['shift']());}catch(_0x16d577){_0x43e0f4['push'](_0x43e0f4['shift']());}}}(a33_0x45e1,0x19a7a));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x52ae(_0x423d06,_0x24b935){_0x423d06=_0x423d06-0x109;const _0x45e112=a33_0x45e1();let _0x52ae31=_0x45e112[_0x423d06];return _0x52ae31;}import{withSpinner}from'../utils/spinner.js';import a33_0x3dd3b7 from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';['description']=a33_0x22d585(0x118);async[a33_0x22d585(0x12d)](_0x10462e){const _0x18f671=a33_0x22d585,{options:_0x1bd437,tdx:_0x20f802}=_0x10462e,_0x4359cd=await withSpinner('Fetching\x20permissions...',async()=>{const _0x4b4f9c=a33_0x52ae,[_0x28ad2e,_0x3ebe7a]=await Promise[_0x4b4f9c(0x13d)]([_0x20f802[_0x4b4f9c(0x140)]['getCurrent'](),_0x20f802['policy'][_0x4b4f9c(0x112)]()]);return{'userInfo':_0x28ad2e,'permissions':_0x3ebe7a};},{'verbose':_0x1bd437['verbose']}),{userInfo:_0x30d651,permissions:_0x56c9bc}=_0x4359cd['data'];if(isStructuredFormat(_0x1bd437))return await handleSingleObjectOutput(_0x56c9bc,_0x1bd437),0x0;const _0x577aac=_0x30d651[_0x18f671(0x117)]?_0x18f671(0x12f):_0x30d651[_0x18f671(0x134)]?_0x18f671(0x13b):_0x18f671(0x146);console[_0x18f671(0x13a)]('\x0a'+a33_0x3dd3b7[_0x18f671(0x10d)]('👤')+'\x20'+a33_0x3dd3b7[_0x18f671(0x10d)](_0x30d651[_0x18f671(0x10b)])+'\x20'+a33_0x3dd3b7['dim']('('+_0x30d651[_0x18f671(0x11e)]+')')+'\x20—\x20'+_0x577aac),console[_0x18f671(0x13a)](a33_0x3dd3b7['dim'](_0x18f671(0x13c)+_0x20f802[_0x18f671(0x128)][_0x18f671(0x11a)]+':'+_0x30d651[_0x18f671(0x143)]+',\x20user_id:'+_0x30d651['id']));const _0x3fef4d=_0x56c9bc[_0x18f671(0x142)];console[_0x18f671(0x13a)]('\x0a'+a33_0x3dd3b7[_0x18f671(0x10d)](_0x18f671(0x10c))+'\x20('+_0x3fef4d[_0x18f671(0x109)]+'):');if(_0x3fef4d['length']===0x0)console[_0x18f671(0x13a)](a33_0x3dd3b7[_0x18f671(0x116)](_0x18f671(0x120)));else for(const _0x4e6fc7 of _0x3fef4d){console[_0x18f671(0x13a)](_0x18f671(0x124)+_0x4e6fc7[_0x18f671(0x10b)]);}return printPermissionsMap(_0x56c9bc[_0x18f671(0x113)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x22d585(0x10b)]=a33_0x22d585(0x12b);[a33_0x22d585(0x10e)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x22d585(0x12d)](_0x25b8f5){const _0x53d74a=a33_0x22d585,{options:_0x5382ae,tdx:_0x4706ff}=_0x25b8f5,_0x552636=await withSpinner(_0x53d74a(0x123),()=>_0x4706ff['policy']['listPolicies'](),{'verbose':_0x5382ae[_0x53d74a(0x136)]}),_0x46564f=_0x552636[_0x53d74a(0x13f)];console[_0x53d74a(0x129)](_0x53d74a(0x11f)+_0x46564f[_0x53d74a(0x109)]+_0x53d74a(0x149)+(_0x46564f[_0x53d74a(0x109)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x5382ae))return await handleSDKOutput(_0x46564f,_0x5382ae),0x0;if(_0x46564f['length']===0x0)console[_0x53d74a(0x13a)](a33_0x3dd3b7['dim'](_0x53d74a(0x139)));else for(const _0x2b055e of _0x46564f){const _0x23ea55=_0x2b055e[_0x53d74a(0x10e)]?a33_0x3dd3b7[_0x53d74a(0x116)](_0x53d74a(0x125)+_0x2b055e[_0x53d74a(0x10e)]):'';console[_0x53d74a(0x13a)](_0x53d74a(0x124)+_0x2b055e[_0x53d74a(0x10b)]+_0x23ea55);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x22d585(0x10b)]='policy\x20show';[a33_0x22d585(0x10e)]=a33_0x22d585(0x127);[a33_0x22d585(0x148)](_0xafabd){const _0x547263=a33_0x22d585;if(_0xafabd[_0x547263(0x119)][_0x547263(0x109)]===0x0)return _0x547263(0x13e);return undefined;}async[a33_0x22d585(0x12d)](_0xc9a922){const _0x2e5899=a33_0x22d585,{options:_0x4255bb,tdx:_0x16225d}=_0xc9a922,_0x2cc4e2=_0xc9a922[_0x2e5899(0x119)][0x0],_0x19f5fb=await withSpinner('Fetching\x20policy...',async()=>{const _0x13794e=_0x2e5899,_0x2082ee=await _0x16225d[_0x13794e(0x111)][_0x13794e(0x131)](_0x2cc4e2),[_0x46771d,_0xe43cd8]=await Promise[_0x13794e(0x13d)]([_0x16225d['policy'][_0x13794e(0x12a)](_0x2082ee['id']),_0x16225d[_0x13794e(0x111)][_0x13794e(0x10a)](_0x2082ee['id'])]);return{'policy':_0x2082ee,'perms':_0x46771d,'users':_0xe43cd8};},{'verbose':_0x4255bb[_0x2e5899(0x136)]}),{policy:_0x1b57ff,perms:_0x4bb02a,users:_0x201ff4}=_0x19f5fb[_0x2e5899(0x13f)];if(isStructuredFormat(_0x4255bb))return await handleSingleObjectOutput({..._0x1b57ff,'permissions':_0x4bb02a[_0x2e5899(0x113)],'users':_0x201ff4},_0x4255bb),0x0;console['log']('\x0a'+a33_0x3dd3b7[_0x2e5899(0x10d)]('📋')+'\x20'+a33_0x3dd3b7[_0x2e5899(0x10d)](_0x1b57ff[_0x2e5899(0x10b)])+'\x20'+a33_0x3dd3b7[_0x2e5899(0x116)](_0x2e5899(0x144)+_0x1b57ff['id']+')'));_0x1b57ff['description']&&console[_0x2e5899(0x13a)](_0x2e5899(0x13c)+a33_0x3dd3b7['dim'](_0x1b57ff[_0x2e5899(0x10e)]));console['log'](_0x2e5899(0x13c)+_0x201ff4[_0x2e5899(0x109)]+_0x2e5899(0x12c)+(_0x201ff4[_0x2e5899(0x109)]!==0x1?'s':'')+_0x2e5899(0x12e)),printPermissionsMap(_0x4bb02a[_0x2e5899(0x113)]);if(_0x201ff4['length']>0x0){console['log']('\x0a'+a33_0x3dd3b7[_0x2e5899(0x10d)](_0x2e5899(0x132))+':');for(const _0x22d30d of _0x201ff4){const _0x1d4c68=_0x22d30d['email']&&_0x22d30d[_0x2e5899(0x11e)]!==_0x22d30d['name']?a33_0x3dd3b7[_0x2e5899(0x116)]('\x20<'+_0x22d30d['email']+'>'):'';console['log'](_0x2e5899(0x124)+_0x22d30d[_0x2e5899(0x10b)]+_0x1d4c68);}}return console[_0x2e5899(0x13a)](),0x0;}}function printPermissionsMap(_0x4363cc){const _0x47c2b0=a33_0x22d585,_0x175402=Object[_0x47c2b0(0x114)](_0x4363cc);console[_0x47c2b0(0x13a)]('\x0a'+a33_0x3dd3b7['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x175402[_0x47c2b0(0x109)]===0x0){console[_0x47c2b0(0x13a)](a33_0x3dd3b7['dim']('\x20\x20No\x20permissions'));return;}const _0x4a9d61=Math[_0x47c2b0(0x130)](..._0x175402[_0x47c2b0(0x11c)](([_0x3cdf00])=>_0x3cdf00[_0x47c2b0(0x109)]));for(const [_0x4b16b1,_0x177b9b]of _0x175402){const _0x4312cb=formatOperations(_0x177b9b);console[_0x47c2b0(0x13a)]('\x20\x20'+_0x4b16b1[_0x47c2b0(0x135)](_0x4a9d61+0x2)+_0x4312cb);}}function formatOperations(_0x2390d4){const _0x1a15a5=a33_0x22d585,_0x265ef5=[...new Set(_0x2390d4['map'](_0x55dc45=>_0x55dc45[_0x1a15a5(0x11d)]))];return _0x265ef5[_0x1a15a5(0x122)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x3a5b04=a32_0x1136;(function(_0x48ac81,_0xa3ebbe){const _0x154c64=a32_0x1136,_0x421efb=_0x48ac81();while(!![]){try{const _0x4079e6=parseInt(_0x154c64(0x105))/0x1+-parseInt(_0x154c64(0x137))/0x2*(-parseInt(_0x154c64(0xe6))/0x3)+-parseInt(_0x154c64(0x115))/0x4+-parseInt(_0x154c64(0xfc))/0x5*(parseInt(_0x154c64(0x144))/0x6)+-parseInt(_0x154c64(0x130))/0x7*(parseInt(_0x154c64(0x11c))/0x8)+-parseInt(_0x154c64(0x145))/0x9+-parseInt(_0x154c64(0xea))/0xa*(-parseInt(_0x154c64(0x11f))/0xb);if(_0x4079e6===_0xa3ebbe)break;else _0x421efb['push'](_0x421efb['shift']());}catch(_0x4d9dcb){_0x421efb['push'](_0x421efb['shift']());}}}(a32_0x3951,0xc099c));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a32_0x2e86ee from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a32_0x3951(){const _0x5a665b=['\x20--default\x27\x20to\x20save\x20permanently','tdx:\x20profile\x20set','(cleared)','validate','profile:set','Operation\x20cancelled','5982rfqrac','13030074OLfwtQ','\x20API\x20key\x20is\x20valid\x20(User:\x20','select','logLevel','warn','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','trim','create','Default\x20profile\x20set\x20to:\x20','VALID_KEYS','ERROR','4107351EnLIec','Failed\x20to\x20remove\x20profile:\x20','profile:use','\x20\x20-\x20','16997030uJiprj','Enter\x20description\x20(optional):','profileName','us01','description','email','profile:create','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','text','database','\x20API\x20key\x20removed\x20from\x20system\x20keychain','✗\x20Validation\x20failed:\x20','API\x20Key','Set\x20a\x20profile\x20configuration\x20value','status','Validating\x20API\x20key...','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','yellow','35vZJYwI','bold','tdx:\x20profile\x20create','\x0aOperation\x20cancelled','message','split','error','Site\x20was\x20not\x20changed.','includes','284080JzgZYU','config','password','method','Profile\x20\x27','default','log','green','/app/mp/ak','length','name','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','site','dim','tdx.json','\x20\x20tdx\x20--profile\x20','6039652odLAgR','Removal\x20cancelled','\x27\x20updated:\x20','execute','Setup\x20cancelled','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','8ydGeJa','Session\x20profile\x20set\x20to:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','22kbWrpx','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.','llm_project','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','confirm','session','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Remove\x20a\x20profile','\x0aSetup\x20cancelled','API\x20key\x20cannot\x20be\x20empty','jobs','profile:remove','Profile\x20name\x20cannot\x20be\x20empty','\x27.\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20remove','9093231AuWGGq','profile','Create\x20a\x20new\x20profile','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','apiKey','\x0aAvailable\x20profiles:','2lfgLXJ','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','red','getUserInfo','Set\x20session\x20profile','\x20\x20(no\x20profiles\x20found)','oauth'];a32_0x3951=function(){return _0x5a665b;};return a32_0x3951();}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a32_0x1136(_0x5657cb,_0x7ec4fd){_0x5657cb=_0x5657cb-0xde;const _0x39514d=a32_0x3951();let _0x11366c=_0x39514d[_0x5657cb];return _0x11366c;}import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a32_0x2a86f2 from'prompts';import a32_0x42377d from'chalk';function validateProfileName(_0x5c3c47){const _0xa65023=a32_0x1136;if(!_0x5c3c47||!_0x5c3c47[_0xa65023(0xe1)]())return _0xa65023(0x12d);const _0x3e58da=_0x5c3c47[_0xa65023(0xe1)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x3e58da))return _0xa65023(0xe0);if(profileExists(_0x3e58da))return _0xa65023(0x109)+_0x3e58da+_0xa65023(0xde);return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x3a5b04(0x10f)]=a32_0x3a5b04(0xf0);['description']=a32_0x3a5b04(0x132);async[a32_0x3a5b04(0x118)](_0x3306f0){const _0x118929=a32_0x3a5b04,{options:_0x206572,args:_0x4074cb}=_0x3306f0;console[_0x118929(0x10b)](a32_0x42377d[_0x118929(0xfd)](_0x118929(0xfe)));let _0x5464ea;if(_0x4074cb[_0x118929(0x10e)]>0x0&&_0x4074cb[0x0]){const _0x5bd895=_0x4074cb[0x0]['trim'](),_0x17ddbf=validateProfileName(_0x5bd895);if(_0x17ddbf!==!![])return console[_0x118929(0x102)](a32_0x42377d[_0x118929(0x139)](_0x17ddbf)),0x1;_0x5464ea=_0x5bd895;}else{const _0x599394=await a32_0x2a86f2({'type':_0x118929(0xf2),'name':_0x118929(0xec),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x599394[_0x118929(0xec)])return console['log'](_0x118929(0x129)),0x1;_0x5464ea=_0x599394[_0x118929(0xec)][_0x118929(0xe1)]();}const _0x35324f=await a32_0x2a86f2({'type':_0x118929(0xf2),'name':_0x118929(0xee),'message':_0x118929(0xeb)}),_0x50d145=_0x35324f['description']?.['trim']()||undefined,_0x34f548=_0x206572[_0x118929(0x111)]||_0x118929(0xed),_0x323397=await promptSiteSelection(_0x34f548,_0x5464ea,_0x118929(0x119));if(!_0x323397)return 0x1;const _0x42901e=resolveSite(_0x323397);if(isOAuthSupported(_0x42901e)){const _0x3cfb27=await a32_0x2a86f2({'type':_0x118929(0x147),'name':_0x118929(0x108),'message':'Choose\x20authentication\x20method:','choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':_0x118929(0xf6),'value':'apikey'}]});if(!_0x3cfb27['method'])return console['log']('\x0aSetup\x20cancelled'),0x1;if(_0x3cfb27[_0x118929(0x108)]===_0x118929(0x13d)){if(_0x50d145){const _0x19bb38={'site':_0x42901e,'description':_0x50d145};saveProfileToUserConfig(_0x5464ea,_0x19bb38);}return await runOAuthLoginFlow(_0x42901e,_0x5464ea,_0x206572[_0x118929(0x148)]??LogLevel[_0x118929(0xe5)]),0x0;}}console['log'](_0x118929(0x138)+_0x42901e),console[_0x118929(0x10b)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x118929(0x10b)]('\x20\x20'+getConsoleUrl(_0x42901e,_0x118929(0x10d)));const _0x2e5f6d=await a32_0x2a86f2({'type':_0x118929(0x107),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x373aec=>{const _0x5446c7=_0x118929;if(!_0x373aec||!_0x373aec[_0x5446c7(0xe1)]())return _0x5446c7(0x12a);return!![];}});if(!_0x2e5f6d[_0x118929(0x135)])return console[_0x118929(0x10b)](_0x118929(0x129)),0x1;const _0x306df2=_0x2e5f6d[_0x118929(0x135)];console['log'](_0x118929(0xf9));try{const _0x5e4c36=TDX['create']({'site':_0x42901e,'apiKey':_0x306df2[_0x118929(0xe1)](),'logLevel':_0x206572[_0x118929(0x148)]??LogLevel[_0x118929(0xe5)]}),_0x5dad21=await _0x5e4c36[_0x118929(0x12b)]['getUserInfo']();console[_0x118929(0x10b)](a32_0x42377d[_0x118929(0x10c)]('✓')+_0x118929(0x146)+_0x5dad21['email']+')');const _0x4baea9=await isKeychainAvailable();_0x4baea9?(await saveAPIKeyAsync(_0x306df2[_0x118929(0xe1)](),_0x42901e,_0x5464ea),console['log'](a32_0x42377d['green']('✓')+_0x118929(0xf1)+_0x5464ea+')')):(console['warn'](a32_0x42377d['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a32_0x42377d[_0x118929(0xfb)](_0x118929(0x134))));const _0x3a2f13={'site':_0x42901e,..._0x50d145&&{'description':_0x50d145}};return saveProfileToUserConfig(_0x5464ea,_0x3a2f13),console[_0x118929(0x10b)](a32_0x42377d[_0x118929(0x10c)]('✓')+_0x118929(0x11b)+_0x5464ea+'\x27\x20created'),console[_0x118929(0x10b)](),console[_0x118929(0x10b)](_0x118929(0x11e)),console[_0x118929(0x10b)](_0x118929(0x114)+_0x5464ea+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x118929(0x10b)](_0x118929(0x114)+_0x5464ea+_0x118929(0xfa)),0x0;}catch(_0x3f2c78){if(_0x3f2c78 instanceof HTTPClientError&&_0x3f2c78[_0x118929(0xf8)]===0x191)return printAuthError(_0x3f2c78),0x1;return console[_0x118929(0x102)](a32_0x42377d[_0x118929(0x139)](_0x118929(0xf5)+(_0x3f2c78 instanceof Error?_0x3f2c78[_0x118929(0x100)]:String(_0x3f2c78)))),console[_0x118929(0x102)](_0x118929(0xdf)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a32_0x3a5b04(0x10f)]=a32_0x3a5b04(0x12c);['description']=a32_0x3a5b04(0x128);['validate'](_0x1fccfb){const _0xf6e202=a32_0x3a5b04,{args:_0x138ade}=_0x1fccfb;if(_0x138ade[_0xf6e202(0x10e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0x5d19ac){const _0xe87861=a32_0x3a5b04,{args:_0x4bd8d5}=_0x5d19ac,_0xa6ee8e=_0x4bd8d5[0x0];console[_0xe87861(0x10b)](a32_0x42377d[_0xe87861(0xfd)](_0xe87861(0x12f)));if(!profileExists(_0xa6ee8e)){console[_0xe87861(0x102)](a32_0x42377d[_0xe87861(0x139)](_0xe87861(0x109)+_0xa6ee8e+_0xe87861(0x121))),console[_0xe87861(0x10b)](_0xe87861(0x136));const _0x480996=listProfiles();if(_0x480996[_0xe87861(0x10e)]===0x0)console['log'](_0xe87861(0x13c));else for(const _0x5b6677 of _0x480996){console[_0xe87861(0x10b)](_0xe87861(0xe9)+_0x5b6677[_0xe87861(0x10f)]);}return 0x1;}const _0x1e1024=await a32_0x2a86f2({'type':_0xe87861(0x125),'name':_0xe87861(0x125),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xa6ee8e+'\x27?','initial':![]});if(!_0x1e1024[_0xe87861(0x125)])return console['log'](_0xe87861(0x116)),0x0;try{removeProfileFromUserConfig(_0xa6ee8e),console[_0xe87861(0x10b)](a32_0x42377d[_0xe87861(0x10c)]('✓')+'\x20Profile\x20\x27'+_0xa6ee8e+'\x27\x20removed\x20from\x20configuration');}catch(_0x48fe8d){return console[_0xe87861(0x102)](a32_0x42377d[_0xe87861(0x139)](_0xe87861(0xe7)+(_0x48fe8d instanceof Error?_0x48fe8d[_0xe87861(0x100)]:String(_0x48fe8d)))),0x1;}const _0x58fbe0=await isKeychainAvailable();if(_0x58fbe0){const _0x1967bc=await deleteKeychainAPIKey(_0xa6ee8e);_0x1967bc&&console[_0xe87861(0x10b)](a32_0x42377d[_0xe87861(0x10c)]('✓')+_0xe87861(0xf4));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a32_0x3a5b04(0x10f)]=a32_0x3a5b04(0x142);[a32_0x3a5b04(0xee)]=a32_0x3a5b04(0xf7);static ['VALID_KEYS']=[a32_0x3a5b04(0x111),a32_0x3a5b04(0xf3),'parent_segment',a32_0x3a5b04(0x122),'llm_agent','description'];[a32_0x3a5b04(0x141)](_0x17d0d7){const _0x40a8ea=a32_0x3a5b04,{args:_0x3aae7f,options:_0x1eeb60}=_0x17d0d7,_0x289cfe=_0x1eeb60[_0x40a8ea(0x131)]||getActiveProfile();if(!_0x289cfe)return _0x40a8ea(0x127);if(_0x3aae7f['length']===0x0)return _0x40a8ea(0x11a)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x5975db=_0x3aae7f[0x0];if(!_0x5975db[_0x40a8ea(0x104)]('='))return _0x40a8ea(0x120)+ProfileSetCommand[_0x40a8ea(0xe4)][_0x40a8ea(0x123)](',\x20');const [_0x5a88c8]=_0x5975db[_0x40a8ea(0x101)]('=',0x2);if(!ProfileSetCommand[_0x40a8ea(0xe4)]['includes'](_0x5a88c8))return'Unknown\x20key\x20\x27'+_0x5a88c8+_0x40a8ea(0x12e)+ProfileSetCommand[_0x40a8ea(0xe4)]['join'](',\x20');return undefined;}async['execute'](_0x2a1e42){const _0x3f5948=a32_0x3a5b04,{args:_0x3e9bc8,options:_0x1257dc}=_0x2a1e42,_0x4489ea=_0x1257dc[_0x3f5948(0x131)]||getActiveProfile(),[_0x4166e6,..._0x6191f9]=_0x3e9bc8[0x0][_0x3f5948(0x101)]('='),_0x30b3d2=_0x6191f9[_0x3f5948(0x123)]('=');console[_0x3f5948(0x10b)](a32_0x42377d[_0x3f5948(0xfd)](_0x3f5948(0x13f)));if(!profileExists(_0x4489ea)){const _0xded1f5=await a32_0x2a86f2({'type':_0x3f5948(0x125),'name':'create','message':_0x3f5948(0x109)+_0x4489ea+_0x3f5948(0x124),'initial':!![]});if(!_0xded1f5['create'])return console['log'](_0x3f5948(0x143)),0x1;}const _0xbad227=loadProfile(_0x4489ea),_0x45791e=_0xbad227?.[_0x3f5948(0x106)]||{};if(_0x4166e6===_0x3f5948(0x111)){const _0x23d102=resolveSite(_0x30b3d2);console[_0x3f5948(0x10b)]('Changing\x20site\x20to\x20\x27'+_0x23d102+'\x27\x20requires\x20API\x20key\x20validation.'),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3f5948(0x10b)]('\x20\x20'+getConsoleUrl(_0x23d102,_0x3f5948(0x10d)));const _0x44816b=await a32_0x2a86f2({'type':'password','name':_0x3f5948(0x135),'message':_0x3f5948(0x133),'validate':_0x226658=>{const _0x19c839=_0x3f5948;if(!_0x226658||!_0x226658[_0x19c839(0xe1)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x44816b[_0x3f5948(0x135)])return console[_0x3f5948(0x10b)](_0x3f5948(0xff)),0x1;console[_0x3f5948(0x10b)]('Validating\x20API\x20key...');try{const _0x422db7=TDX[_0x3f5948(0xe2)]({'site':_0x23d102,'apiKey':_0x44816b[_0x3f5948(0x135)][_0x3f5948(0xe1)](),'logLevel':_0x1257dc[_0x3f5948(0x148)]??LogLevel[_0x3f5948(0xe5)]}),_0x5c0eb5=await _0x422db7[_0x3f5948(0x12b)][_0x3f5948(0x13a)]();console['log'](a32_0x42377d[_0x3f5948(0x10c)]('✓')+_0x3f5948(0x146)+_0x5c0eb5[_0x3f5948(0xef)]+')');const _0x12cf7e=await isKeychainAvailable();_0x12cf7e?(await saveAPIKeyAsync(_0x44816b[_0x3f5948(0x135)][_0x3f5948(0xe1)](),_0x23d102,_0x4489ea),console[_0x3f5948(0x10b)](a32_0x42377d[_0x3f5948(0x10c)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x3f5948(0x149)](a32_0x42377d[_0x3f5948(0xfb)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x45791e[_0x3f5948(0x111)]=_0x23d102;}catch(_0x5a5173){if(_0x5a5173 instanceof HTTPClientError&&_0x5a5173['status']===0x191)return printAuthError(_0x5a5173),0x1;return console[_0x3f5948(0x102)](a32_0x42377d['red'](_0x3f5948(0xf5)+(_0x5a5173 instanceof Error?_0x5a5173[_0x3f5948(0x100)]:String(_0x5a5173)))),console[_0x3f5948(0x102)](_0x3f5948(0x103)),0x1;}}else _0x45791e[_0x4166e6]=_0x30b3d2||undefined;return saveProfileToUserConfig(_0x4489ea,_0x45791e),console['log'](a32_0x42377d[_0x3f5948(0x10c)]('✓')+_0x3f5948(0x11b)+_0x4489ea+_0x3f5948(0x117)+_0x4166e6+'='+(_0x30b3d2||_0x3f5948(0x140))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a32_0x3a5b04(0xe8);[a32_0x3a5b04(0xee)]=a32_0x3a5b04(0x13b);[a32_0x3a5b04(0x141)](_0x1b92ac){const _0x4ee5eb=a32_0x3a5b04,{args:_0x4f67ae}=_0x1b92ac;if(_0x4f67ae['length']===0x0)return _0x4ee5eb(0x110);return undefined;}async[a32_0x3a5b04(0x118)](_0x4ee757){const _0x28e8aa=a32_0x3a5b04,{args:_0xa4162b,options:_0x10e734}=_0x4ee757,_0x4531e7=_0xa4162b[0x0],_0x12b5fb=_0x10e734[_0x28e8aa(0x10a)];cleanExpiredSessions();if(!profileExists(_0x4531e7)){console['error'](a32_0x42377d[_0x28e8aa(0x139)](_0x28e8aa(0x109)+_0x4531e7+_0x28e8aa(0x121))),console[_0x28e8aa(0x10b)](_0x28e8aa(0x136));const _0x32077a=listProfiles();if(_0x32077a[_0x28e8aa(0x10e)]===0x0)console[_0x28e8aa(0x10b)](_0x28e8aa(0x13c));else for(const _0x5165a3 of _0x32077a){console[_0x28e8aa(0x10b)](_0x28e8aa(0xe9)+_0x5165a3[_0x28e8aa(0x10f)]);}return 0x1;}if(_0x12b5fb){const _0x291f15=a32_0x2e86ee[_0x28e8aa(0x123)](getConfigDir(),_0x28e8aa(0x113));return saveActiveProfileToUserConfig(_0x4531e7),console[_0x28e8aa(0x10b)](_0x28e8aa(0xe3)+a32_0x42377d['green'](_0x4531e7)),console[_0x28e8aa(0x10b)](a32_0x42377d[_0x28e8aa(0x112)]('\x0aSaved\x20to:\x20'+_0x291f15)),0x0;}const _0x3b7520=getSessionID(_0x10e734[_0x28e8aa(0x126)]);return saveSessionContext({'profile':_0x4531e7},_0x10e734['session']),console[_0x28e8aa(0x10b)](_0x28e8aa(0x11d)+a32_0x42377d[_0x28e8aa(0x10c)](_0x4531e7)+'\x20'+a32_0x42377d[_0x28e8aa(0x112)]('(session:\x20'+_0x3b7520+')')),console[_0x28e8aa(0x10b)](a32_0x42377d['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4531e7+_0x28e8aa(0x13e))),0x0;}}
|
|
1
|
+
const a34_0x5a809c=a34_0x18f4;(function(_0x4412e9,_0x201ea8){const _0x55f413=a34_0x18f4,_0x3d52c9=_0x4412e9();while(!![]){try{const _0x5d92af=parseInt(_0x55f413(0xee))/0x1+parseInt(_0x55f413(0xde))/0x2*(-parseInt(_0x55f413(0x121))/0x3)+parseInt(_0x55f413(0xcc))/0x4+-parseInt(_0x55f413(0x108))/0x5*(-parseInt(_0x55f413(0x103))/0x6)+parseInt(_0x55f413(0xd3))/0x7*(parseInt(_0x55f413(0xc4))/0x8)+-parseInt(_0x55f413(0xba))/0x9+parseInt(_0x55f413(0xc0))/0xa*(-parseInt(_0x55f413(0x110))/0xb);if(_0x5d92af===_0x201ea8)break;else _0x3d52c9['push'](_0x3d52c9['shift']());}catch(_0x40f6ed){_0x3d52c9['push'](_0x3d52c9['shift']());}}}(a34_0x565d,0x51132));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 a34_0x45bb33 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';function a34_0x18f4(_0x336e84,_0x3a3252){_0x336e84=_0x336e84-0xb7;const _0x565d2f=a34_0x565d();let _0x18f450=_0x565d2f[_0x336e84];return _0x18f450;}import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0x42c1aa from'prompts';import a34_0x3d7d2f from'chalk';function validateProfileName(_0x16a102){const _0x424d3e=a34_0x18f4;if(!_0x16a102||!_0x16a102[_0x424d3e(0xfb)]())return _0x424d3e(0x114);const _0x28612e=_0x16a102[_0x424d3e(0xfb)]();if(!/^[a-zA-Z0-9_-]+$/[_0x424d3e(0xdf)](_0x28612e))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x28612e))return _0x424d3e(0xd7)+_0x28612e+_0x424d3e(0xbb);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x5a809c(0x11c)]='profile:create';[a34_0x5a809c(0x100)]=a34_0x5a809c(0x105);async[a34_0x5a809c(0x104)](_0x432e8a){const _0x3c62e0=a34_0x5a809c,{options:_0x4771b4,args:_0x4c367e}=_0x432e8a;console[_0x3c62e0(0xd5)](a34_0x3d7d2f[_0x3c62e0(0x116)]('tdx:\x20profile\x20create'));let _0x69e2a3;if(_0x4c367e[_0x3c62e0(0xce)]>0x0&&_0x4c367e[0x0]){const _0x28f2fa=_0x4c367e[0x0][_0x3c62e0(0xfb)](),_0x13b4bf=validateProfileName(_0x28f2fa);if(_0x13b4bf!==!![])return console[_0x3c62e0(0x115)](a34_0x3d7d2f[_0x3c62e0(0xcd)](_0x13b4bf)),0x1;_0x69e2a3=_0x28f2fa;}else{const _0x179cde=await a34_0x42c1aa({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x179cde[_0x3c62e0(0xd4)])return console[_0x3c62e0(0xd5)](_0x3c62e0(0xfd)),0x1;_0x69e2a3=_0x179cde['profileName']['trim']();}const _0x1e2ded=await a34_0x42c1aa({'type':_0x3c62e0(0xcb),'name':_0x3c62e0(0x100),'message':_0x3c62e0(0x109)}),_0x21c084=_0x1e2ded['description']?.[_0x3c62e0(0xfb)]()||undefined,_0x36e900=_0x4771b4[_0x3c62e0(0x118)]||_0x3c62e0(0xc6),_0x3293ec=await promptSiteSelection(_0x36e900,_0x69e2a3,_0x3c62e0(0xbe));if(!_0x3293ec)return 0x1;const _0x30a52a=resolveSite(_0x3293ec);if(isOAuthSupported(_0x30a52a)){const _0x2810b5=await a34_0x42c1aa({'type':_0x3c62e0(0xf3),'name':'method','message':'Choose\x20authentication\x20method:','choices':[{'title':_0x3c62e0(0xb8),'value':_0x3c62e0(0x107)},{'title':_0x3c62e0(0x11d),'value':'apikey'}]});if(!_0x2810b5['method'])return console[_0x3c62e0(0xd5)](_0x3c62e0(0xfd)),0x1;if(_0x2810b5[_0x3c62e0(0xeb)]===_0x3c62e0(0x107)){if(_0x21c084){const _0x4a0f76={'site':_0x30a52a,'description':_0x21c084};saveProfileToUserConfig(_0x69e2a3,_0x4a0f76);}return await runOAuthLoginFlow(_0x30a52a,_0x69e2a3,_0x4771b4[_0x3c62e0(0xc7)]??LogLevel[_0x3c62e0(0x11a)]),0x0;}}console[_0x3c62e0(0xd5)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x30a52a),console[_0x3c62e0(0xd5)](_0x3c62e0(0xc5)),console[_0x3c62e0(0xd5)]('\x20\x20'+getConsoleUrl(_0x30a52a,_0x3c62e0(0x10e)));const _0x8678b6=await a34_0x42c1aa({'type':'password','name':_0x3c62e0(0xda),'message':_0x3c62e0(0xbd),'validate':_0x23119e=>{const _0x54f5c6=_0x3c62e0;if(!_0x23119e||!_0x23119e['trim']())return _0x54f5c6(0x120);return!![];}});if(!_0x8678b6[_0x3c62e0(0xda)])return console[_0x3c62e0(0xd5)]('\x0aSetup\x20cancelled'),0x1;const _0x1932a4=_0x8678b6['apiKey'];console[_0x3c62e0(0xd5)](_0x3c62e0(0xcf));try{const _0x49c97a=TDX[_0x3c62e0(0xe9)]({'site':_0x30a52a,'apiKey':_0x1932a4['trim'](),'logLevel':_0x4771b4[_0x3c62e0(0xc7)]??LogLevel[_0x3c62e0(0x11a)]}),_0x591619=await _0x49c97a[_0x3c62e0(0xe5)]['getUserInfo']();console[_0x3c62e0(0xd5)](a34_0x3d7d2f['green']('✓')+_0x3c62e0(0xfc)+_0x591619[_0x3c62e0(0xec)]+')');const _0x1dbea8=await isKeychainAvailable();_0x1dbea8?(await saveAPIKeyAsync(_0x1932a4['trim'](),_0x30a52a,_0x69e2a3),console[_0x3c62e0(0xd5)](a34_0x3d7d2f[_0x3c62e0(0xea)]('✓')+_0x3c62e0(0xc2)+_0x69e2a3+')')):(console[_0x3c62e0(0xdb)](a34_0x3d7d2f[_0x3c62e0(0x106)](_0x3c62e0(0x11e))),console[_0x3c62e0(0xdb)](a34_0x3d7d2f[_0x3c62e0(0x106)](_0x3c62e0(0xb9))));const _0x3a2e1c={'site':_0x30a52a,..._0x21c084&&{'description':_0x21c084}};return saveProfileToUserConfig(_0x69e2a3,_0x3a2e1c),console[_0x3c62e0(0xd5)](a34_0x3d7d2f[_0x3c62e0(0xea)]('✓')+_0x3c62e0(0xf0)+_0x69e2a3+_0x3c62e0(0xc1)),console[_0x3c62e0(0xd5)](),console[_0x3c62e0(0xd5)](_0x3c62e0(0x10a)),console[_0x3c62e0(0xd5)]('\x20\x20tdx\x20--profile\x20'+_0x69e2a3+_0x3c62e0(0xd8)),console[_0x3c62e0(0xd5)](_0x3c62e0(0x11b)+_0x69e2a3+_0x3c62e0(0xe4)),0x0;}catch(_0x383ab0){if(_0x383ab0 instanceof HTTPClientError&&_0x383ab0[_0x3c62e0(0x10c)]===0x191)return printAuthError(_0x383ab0),0x1;return console[_0x3c62e0(0x115)](a34_0x3d7d2f[_0x3c62e0(0xcd)](_0x3c62e0(0xe3)+(_0x383ab0 instanceof Error?_0x383ab0[_0x3c62e0(0xfe)]:String(_0x383ab0)))),console['error'](_0x3c62e0(0xe7)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a34_0x5a809c(0xc3);[a34_0x5a809c(0x100)]='Remove\x20a\x20profile';[a34_0x5a809c(0xf4)](_0x470874){const _0x53f603=a34_0x5a809c,{args:_0x54701a}=_0x470874;if(_0x54701a['length']===0x0)return _0x53f603(0xe2);return undefined;}async[a34_0x5a809c(0x104)](_0x2eccc9){const _0xb73970=a34_0x5a809c,{args:_0x170403}=_0x2eccc9,_0x17e350=_0x170403[0x0];console[_0xb73970(0xd5)](a34_0x3d7d2f['bold'](_0xb73970(0x10b)));if(!profileExists(_0x17e350)){console[_0xb73970(0x115)](a34_0x3d7d2f[_0xb73970(0xcd)](_0xb73970(0xd7)+_0x17e350+_0xb73970(0x102))),console[_0xb73970(0xd5)]('\x0aAvailable\x20profiles:');const _0x14ce4d=listProfiles();if(_0x14ce4d[_0xb73970(0xce)]===0x0)console[_0xb73970(0xd5)](_0xb73970(0x101));else for(const _0x5f4aff of _0x14ce4d){console['log'](_0xb73970(0xd6)+_0x5f4aff[_0xb73970(0x11c)]);}return 0x1;}const _0x4d8861=await a34_0x42c1aa({'type':_0xb73970(0x10d),'name':_0xb73970(0x10d),'message':_0xb73970(0xf2)+_0x17e350+'\x27?','initial':![]});if(!_0x4d8861[_0xb73970(0x10d)])return console[_0xb73970(0xd5)](_0xb73970(0x112)),0x0;try{removeProfileFromUserConfig(_0x17e350),console[_0xb73970(0xd5)](a34_0x3d7d2f[_0xb73970(0xea)]('✓')+_0xb73970(0xf0)+_0x17e350+_0xb73970(0xb7));}catch(_0x4db489){return console[_0xb73970(0x115)](a34_0x3d7d2f[_0xb73970(0xcd)](_0xb73970(0xdd)+(_0x4db489 instanceof Error?_0x4db489['message']:String(_0x4db489)))),0x1;}const _0x2b48df=await isKeychainAvailable();if(_0x2b48df){const _0x2fad3d=await deleteKeychainAPIKey(_0x17e350);_0x2fad3d&&console[_0xb73970(0xd5)](a34_0x3d7d2f[_0xb73970(0xea)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}function a34_0x565d(){const _0x588c05=['Removal\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','Profile\x20name\x20cannot\x20be\x20empty','error','bold','Unknown\x20key\x20\x27','site','default','ERROR','\x20\x20tdx\x20--profile\x20','name','API\x20Key','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx.json','API\x20key\x20cannot\x20be\x20empty','21aeggSc','join','\x27\x20removed\x20from\x20configuration','OAuth\x20(browser\x20login)','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','5409990RJdWFr','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x0aOperation\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','Setup\x20cancelled','profile:use','200DAYxIy','\x27\x20created','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:remove','8sPRgPs','You\x20can\x20find\x20your\x20API\x20key\x20at:','us01','logLevel','Set\x20a\x20profile\x20configuration\x20value','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Changing\x20site\x20to\x20\x27','text','1748116zyVhjo','red','length','Validating\x20API\x20key...','Session\x20profile\x20set\x20to:\x20','includes','llm_agent','1699117YtMNAZ','profileName','log','\x20\x20-\x20','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','apiKey','warn','database','Failed\x20to\x20remove\x20profile:\x20','12434vJfosX','test','Default\x20profile\x20set\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','✗\x20Validation\x20failed:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','jobs','parent_segment','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','profile:set','create','green','method','email','getUserInfo','200175yglPkW','\x0aAvailable\x20profiles:','\x20Profile\x20\x27','profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','select','validate','\x0aSaved\x20to:\x20','VALID_KEYS','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','dim','(cleared)','split','trim','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSetup\x20cancelled','message','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','description','\x20\x20(no\x20profiles\x20found)','\x27\x20does\x20not\x20exist.','153726AGsfLc','execute','Create\x20a\x20new\x20profile','yellow','oauth','80lqFUBx','Enter\x20description\x20(optional):','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20remove','status','confirm','/app/mp/ak','session','172238zpSuzx','Set\x20session\x20profile'];a34_0x565d=function(){return _0x588c05;};return a34_0x565d();}export class ProfileSetCommand extends BaseCommand{['name']=a34_0x5a809c(0xe8);[a34_0x5a809c(0x100)]=a34_0x5a809c(0xc8);static [a34_0x5a809c(0xf6)]=[a34_0x5a809c(0x118),a34_0x5a809c(0xdc),a34_0x5a809c(0xe6),'llm_project',a34_0x5a809c(0xd2),a34_0x5a809c(0x100)];[a34_0x5a809c(0xf4)](_0xb8cf68){const _0x16266e=a34_0x5a809c,{args:_0x2c28fb,options:_0x557392}=_0xb8cf68,_0x19d856=_0x557392[_0x16266e(0xf1)]||getActiveProfile();if(!_0x19d856)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2c28fb[_0x16266e(0xce)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x16266e(0x122)](',\x20');const _0x50a17a=_0x2c28fb[0x0];if(!_0x50a17a['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x16266e(0xf6)][_0x16266e(0x122)](',\x20');const [_0x357164]=_0x50a17a[_0x16266e(0xfa)]('=',0x2);if(!ProfileSetCommand[_0x16266e(0xf6)][_0x16266e(0xd1)](_0x357164))return _0x16266e(0x117)+_0x357164+_0x16266e(0xe1)+ProfileSetCommand[_0x16266e(0xf6)][_0x16266e(0x122)](',\x20');return undefined;}async['execute'](_0xa82080){const _0x534386=a34_0x5a809c,{args:_0x230cb6,options:_0x1de5b3}=_0xa82080,_0x7127f2=_0x1de5b3['profile']||getActiveProfile(),[_0x26bda5,..._0x14a3e8]=_0x230cb6[0x0][_0x534386(0xfa)]('='),_0x3a26dc=_0x14a3e8[_0x534386(0x122)]('=');console['log'](a34_0x3d7d2f[_0x534386(0x116)]('tdx:\x20profile\x20set'));if(!profileExists(_0x7127f2)){const _0x449dbb=await a34_0x42c1aa({'type':_0x534386(0x10d),'name':_0x534386(0xe9),'message':_0x534386(0xd7)+_0x7127f2+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x449dbb['create'])return console[_0x534386(0xd5)]('Operation\x20cancelled'),0x1;}const _0x40f401=loadProfile(_0x7127f2),_0x3d468=_0x40f401?.['config']||{};if(_0x26bda5===_0x534386(0x118)){const _0x514f08=resolveSite(_0x3a26dc);console[_0x534386(0xd5)](_0x534386(0xca)+_0x514f08+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x534386(0xd5)](_0x534386(0xd9)),console[_0x534386(0xd5)]('\x20\x20'+getConsoleUrl(_0x514f08,_0x534386(0x10e)));const _0x286607=await a34_0x42c1aa({'type':'password','name':_0x534386(0xda),'message':_0x534386(0xff),'validate':_0x48f42b=>{const _0x364c40=_0x534386;if(!_0x48f42b||!_0x48f42b['trim']())return _0x364c40(0x120);return!![];}});if(!_0x286607['apiKey'])return console[_0x534386(0xd5)](_0x534386(0xbc)),0x1;console[_0x534386(0xd5)](_0x534386(0xcf));try{const _0x1d2763=TDX[_0x534386(0xe9)]({'site':_0x514f08,'apiKey':_0x286607['apiKey'][_0x534386(0xfb)](),'logLevel':_0x1de5b3[_0x534386(0xc7)]??LogLevel[_0x534386(0x11a)]}),_0x536f05=await _0x1d2763[_0x534386(0xe5)][_0x534386(0xed)]();console['log'](a34_0x3d7d2f[_0x534386(0xea)]('✓')+_0x534386(0xfc)+_0x536f05[_0x534386(0xec)]+')');const _0xd8dc81=await isKeychainAvailable();_0xd8dc81?(await saveAPIKeyAsync(_0x286607[_0x534386(0xda)][_0x534386(0xfb)](),_0x514f08,_0x7127f2),console[_0x534386(0xd5)](a34_0x3d7d2f['green']('✓')+_0x534386(0xc9))):console[_0x534386(0xdb)](a34_0x3d7d2f[_0x534386(0x106)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3d468[_0x534386(0x118)]=_0x514f08;}catch(_0x230039){if(_0x230039 instanceof HTTPClientError&&_0x230039[_0x534386(0x10c)]===0x191)return printAuthError(_0x230039),0x1;return console[_0x534386(0x115)](a34_0x3d7d2f[_0x534386(0xcd)](_0x534386(0xe3)+(_0x230039 instanceof Error?_0x230039[_0x534386(0xfe)]:String(_0x230039)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x3d468[_0x26bda5]=_0x3a26dc||undefined;return saveProfileToUserConfig(_0x7127f2,_0x3d468),console[_0x534386(0xd5)](a34_0x3d7d2f['green']('✓')+'\x20Profile\x20\x27'+_0x7127f2+'\x27\x20updated:\x20'+_0x26bda5+'='+(_0x3a26dc||_0x534386(0xf9))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x5a809c(0x11c)]=a34_0x5a809c(0xbf);[a34_0x5a809c(0x100)]=a34_0x5a809c(0x111);[a34_0x5a809c(0xf4)](_0x168402){const _0x3a0977=a34_0x5a809c,{args:_0x4df7cc}=_0x168402;if(_0x4df7cc[_0x3a0977(0xce)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x51caf7){const _0x2bdc6d=a34_0x5a809c,{args:_0x405e17,options:_0xa3e98d}=_0x51caf7,_0x5c32df=_0x405e17[0x0],_0x44432e=_0xa3e98d[_0x2bdc6d(0x119)];cleanExpiredSessions();if(!profileExists(_0x5c32df)){console['error'](a34_0x3d7d2f[_0x2bdc6d(0xcd)]('Profile\x20\x27'+_0x5c32df+_0x2bdc6d(0x102))),console[_0x2bdc6d(0xd5)](_0x2bdc6d(0xef));const _0x107477=listProfiles();if(_0x107477[_0x2bdc6d(0xce)]===0x0)console[_0x2bdc6d(0xd5)](_0x2bdc6d(0x101));else for(const _0x16ef32 of _0x107477){console[_0x2bdc6d(0xd5)](_0x2bdc6d(0xd6)+_0x16ef32[_0x2bdc6d(0x11c)]);}return 0x1;}if(_0x44432e){const _0x294080=a34_0x45bb33['join'](getConfigDir(),_0x2bdc6d(0x11f));return saveActiveProfileToUserConfig(_0x5c32df),console['log'](_0x2bdc6d(0xe0)+a34_0x3d7d2f[_0x2bdc6d(0xea)](_0x5c32df)),console[_0x2bdc6d(0xd5)](a34_0x3d7d2f['dim'](_0x2bdc6d(0xf5)+_0x294080)),0x0;}const _0x2a9a15=getSessionID(_0xa3e98d[_0x2bdc6d(0x10f)]);return saveSessionContext({'profile':_0x5c32df},_0xa3e98d[_0x2bdc6d(0x10f)]),console[_0x2bdc6d(0xd5)](_0x2bdc6d(0xd0)+a34_0x3d7d2f[_0x2bdc6d(0xea)](_0x5c32df)+'\x20'+a34_0x3d7d2f[_0x2bdc6d(0xf8)]('(session:\x20'+_0x2a9a15+')')),console[_0x2bdc6d(0xd5)](a34_0x3d7d2f['dim'](_0x2bdc6d(0xf7)+_0x5c32df+_0x2bdc6d(0x113))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x3177a1=a35_0x228d;(function(_0x1026b0,_0x303930){const _0xa888b3=a35_0x228d,_0x1465fc=_0x1026b0();while(!![]){try{const _0x3b5764=parseInt(_0xa888b3(0x1a0))/0x1+-parseInt(_0xa888b3(0x194))/0x2*(-parseInt(_0xa888b3(0x195))/0x3)+-parseInt(_0xa888b3(0x1aa))/0x4*(parseInt(_0xa888b3(0x19a))/0x5)+parseInt(_0xa888b3(0x19b))/0x6*(-parseInt(_0xa888b3(0x1a4))/0x7)+parseInt(_0xa888b3(0x198))/0x8*(-parseInt(_0xa888b3(0x1a6))/0x9)+-parseInt(_0xa888b3(0x1ae))/0xa+parseInt(_0xa888b3(0x1a5))/0xb;if(_0x3b5764===_0x303930)break;else _0x1465fc['push'](_0x1465fc['shift']());}catch(_0x39b897){_0x1465fc['push'](_0x1465fc['shift']());}}}(a35_0x24b5,0x677b5));import{BaseCommand}from'./command.js';function a35_0x228d(_0x5ea4e6,_0x45f6a7){_0x5ea4e6=_0x5ea4e6-0x194;const _0x24b573=a35_0x24b5();let _0x228dbd=_0x24b573[_0x5ea4e6];return _0x228dbd;}function a35_0x24b5(){const _0x12bbdd=['error','message','16dkNUQR','scope','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','6671470XMTWpI','22HwEfkh','121698KVkUua','👤\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','592632bGYYbP','profiles','95105fmFTrp','217254zoynnJ','dim','map','name','site','96926qFUCNy','log','config','description','126PFrEAr','21366543hgeQgV','81wMQbxC','Error:\x20'];a35_0x24b5=function(){return _0x12bbdd;};return a35_0x24b5();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x58010c from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a35_0x3177a1(0x199);[a35_0x3177a1(0x1a3)]='List\x20all\x20available\x20profiles';async['execute'](_0x23fe3f){const _0x18a49e=a35_0x3177a1,{options:_0x1aa918}=_0x23fe3f;try{const _0x478b47=listProfiles(),_0x304655=getActiveProfile();if(_0x478b47[_0x18a49e(0x1ac)]===0x0)return console[_0x18a49e(0x1a1)](_0x18a49e(0x1ad)),console[_0x18a49e(0x1a1)](_0x18a49e(0x197)),console[_0x18a49e(0x1a1)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2a885=_0x478b47[_0x18a49e(0x19d)](_0x90ac9f=>{const _0x5b0ea8=_0x18a49e,_0x374dbc=_0x90ac9f[_0x5b0ea8(0x19e)]===_0x304655,_0xc658ad=getProfileParams(_0x90ac9f[_0x5b0ea8(0x1a2)]);return{'name':_0x90ac9f[_0x5b0ea8(0x19e)],'active':_0x374dbc,'scope':_0x90ac9f[_0x5b0ea8(0x1ab)],'description':_0x90ac9f[_0x5b0ea8(0x1a2)]['description']||'','params':_0xc658ad};});if(isStructuredFormat(_0x1aa918))await handleSDKOutput(_0x2a885,_0x1aa918);else for(const _0x56620c of _0x478b47){const _0x2db903=_0x56620c['name']===_0x304655?a35_0x58010c['green']('\x20✓'):'',_0x5012cf=_0x56620c['config']['site']?a35_0x58010c[_0x18a49e(0x19c)]('\x20'+_0x56620c[_0x18a49e(0x1a2)][_0x18a49e(0x19f)]):'',_0x264524=_0x56620c['config'][_0x18a49e(0x1a3)]?a35_0x58010c[_0x18a49e(0x19c)]('\x20\x20'+_0x56620c[_0x18a49e(0x1a2)]['description']):'';console['log'](_0x18a49e(0x196)+_0x56620c[_0x18a49e(0x19e)]+_0x2db903+_0x5012cf+_0x264524);}return 0x0;}catch(_0x5a10ae){return _0x5a10ae instanceof Error&&console[_0x18a49e(0x1a8)](_0x18a49e(0x1a7)+_0x5a10ae[_0x18a49e(0x1a9)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x50eb9f=a36_0x4eb0;(function(_0x3e93fe,_0x98bebd){const _0x473214=a36_0x4eb0,_0x211f52=_0x3e93fe();while(!![]){try{const _0x47ed01=parseInt(_0x473214(0x140))/0x1+-parseInt(_0x473214(0x143))/0x2*(-parseInt(_0x473214(0x13b))/0x3)+-parseInt(_0x473214(0x13d))/0x4+parseInt(_0x473214(0x164))/0x5+-parseInt(_0x473214(0x159))/0x6*(parseInt(_0x473214(0x139))/0x7)+-parseInt(_0x473214(0x15c))/0x8+parseInt(_0x473214(0x163))/0x9;if(_0x47ed01===_0x98bebd)break;else _0x211f52['push'](_0x211f52['shift']());}catch(_0x179496){_0x211f52['push'](_0x211f52['shift']());}}}(a36_0x4f9e,0x8ab6a));import{BaseCommand}from'./command.js';function a36_0x4eb0(_0x8eeae2,_0x173a63){_0x8eeae2=_0x8eeae2-0x139;const _0x4f9e8a=a36_0x4f9e();let _0x4eb06a=_0x4f9e8a[_0x8eeae2];return _0x4eb06a;}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';function a36_0x4f9e(){const _0x470e6e=['1693984wneFNE','setExtra','No\x20SQL\x20provided','name','database','setPhase','Error:\x20','6817914TnBKad','370590LVyTtk','\x20splits','query','7synKYa','validate','369rDenjK','processedRows','3578452bzmNCV','length','output','484028lOGzmP','execute','\x20-\x20','9656tWaDNp','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','error','SQL:\x20','Query\x20completed:\x20Processed\x20','Executing\x20statement\x20','push','file','Run\x20Trino\x20queries\x20(streaming)','Statement\x20','setJobId','\x20[Job\x20ID:\x20','jobId','...','stats','description','data','state','message','args','verbose','\x0aAll\x20results\x20saved\x20to\x20','1410030qEeGAw','options','in\x20'];a36_0x4f9e=function(){return _0x470e6e;};return a36_0x4f9e();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x50eb9f(0x15f)]='query';[a36_0x50eb9f(0x152)]=a36_0x50eb9f(0x14b);async[a36_0x50eb9f(0x141)](_0x508adf){const _0x23631d=a36_0x50eb9f,{options:_0xec5c2d,args:_0x56e3ac,tdx:_0x599a6a}=_0x508adf,_0x13cedf={..._0xec5c2d,'limitStructuredFormats':!![]},_0x4f24d6=_0x56e3ac[0x0],_0x337487=_0xec5c2d[_0x23631d(0x14a)];let _0x262762;try{if(_0x337487)_0x262762=readSqlStatementsFromFile(_0x337487);else{if(_0x4f24d6==='-')_0x262762=await readSqlStatementsFromStdin();else{if(_0x4f24d6&&isSqlFilePath(_0x4f24d6))_0x262762=readSqlStatementsFromFile(_0x4f24d6);else{if(_0x4f24d6)_0x262762=splitSqlStatements(_0x4f24d6);else throw new Error(_0x23631d(0x15e));}}}}catch(_0x2045b9){return console[_0x23631d(0x145)](_0x23631d(0x162)+_0x2045b9['message']),0x1;}const _0x3475aa=_0xec5c2d[_0x23631d(0x160)]||'information_schema',_0x38ef60=_0xec5c2d['catalog'];try{const _0x40ca8f=[],_0x1e8b40=!!_0xec5c2d[_0x23631d(0x13f)];for(let _0xf065ca=0x0;_0xf065ca<_0x262762['length'];_0xf065ca++){const _0x1d0c63=_0x262762[_0xf065ca],_0x2e6596=_0xf065ca+0x1,_0x2eced3=_0x262762['length'],_0x375877=_0x2eced3>0x1;_0xec5c2d[_0x23631d(0x157)]&&(console[_0x23631d(0x145)]('\x0a'+(_0x375877?_0x23631d(0x14c)+_0x2e6596+'/'+_0x2eced3+':':'')),console[_0x23631d(0x145)]('Site:\x20'+_0xec5c2d['site']),console[_0x23631d(0x145)]('Catalog:\x20'+(_0x38ef60||'td')),console[_0x23631d(0x145)]('Schema:\x20'+_0x3475aa),console[_0x23631d(0x145)](_0x23631d(0x146)+_0x1d0c63));const _0xa34b10=_0x375877?_0x23631d(0x148)+_0x2e6596+'/'+_0x2eced3+_0x23631d(0x150):'Executing\x20query...';try{const _0x4c02e5=await withProgressSpinner(_0xa34b10,async _0x1de364=>{const _0xca0212=_0x23631d,_0x1d5121=await _0x599a6a[_0xca0212(0x166)][_0xca0212(0x141)](_0x1d0c63,{'catalog':_0x38ef60,'schema':_0x3475aa,'onJobId':_0x16973c=>{const _0x10f6ee=_0xca0212;_0x1de364[_0x10f6ee(0x14d)](_0x16973c);},'onProgress':_0x3fece1=>{const _0x330887=_0xca0212;_0x1de364[_0x330887(0x161)]('Executing\x20query\x20['+_0x3fece1[_0x330887(0x154)]+']'),_0x1de364[_0x330887(0x15d)](formatRows(_0x3fece1[_0x330887(0x13c)])+'\x20rows\x20'+_0x3fece1['completedSplits']+'/'+_0x3fece1['totalSplits']+_0x330887(0x165));}});return _0x1d5121;},{'verbose':_0xec5c2d[_0x23631d(0x157)]}),_0x419006=_0x4c02e5[_0x23631d(0x153)],_0x3fe7d3=_0x419006[_0x23631d(0x14f)]?_0x23631d(0x14e)+_0x419006[_0x23631d(0x14f)]+']':'',_0x4d0015=_0x375877?'Statement\x20'+_0x2e6596+'/'+_0x2eced3+_0x23631d(0x142):'';console[_0x23631d(0x145)]('✔\x20'+_0x4d0015+_0x23631d(0x147)+formatRows(_0x419006[_0x23631d(0x151)][_0x23631d(0x13c)])+'\x20rows\x20'+(_0x23631d(0x15b)+formatElapsed(_0x419006['stats']['elapsedTimeMillis'])+_0x3fe7d3));if(_0x375877&&_0x1e8b40){const _0x47b21c=resolveOutputOptions(_0x13cedf),_0x427084=await formatQueryOutput(_0x419006,_0x47b21c);_0x40ca8f[_0x23631d(0x149)](_0x427084);}else await handleQueryOutput(_0x419006,_0x13cedf);}catch(_0x231f66){const _0x1daff1=_0x375877?_0x23631d(0x14c)+_0x2e6596+'/'+_0x2eced3+':\x0a':'',_0x42833a=_0x231f66 instanceof SDKError?_0x231f66['originalMessage']:_0x231f66[_0x23631d(0x155)];return console['error'](''+_0x1daff1+_0x42833a),0x1;}}if(_0x262762['length']>0x1&&_0x1e8b40&&_0x40ca8f[_0x23631d(0x13e)]>0x0){const _0x2290a7=_0x40ca8f['join']('\x0a');writeFileSync(_0xec5c2d['output'],_0x2290a7),console['error'](_0x23631d(0x158)+_0xec5c2d[_0x23631d(0x13f)]);}return 0x0;}catch(_0x407705){throw _0x407705;}}[a36_0x50eb9f(0x13a)](_0x25980a){const _0x50e071=a36_0x50eb9f,_0x29bbfd=_0x25980a[_0x50e071(0x156)][0x0],_0x4640d7=_0x25980a[_0x50e071(0x15a)][_0x50e071(0x14a)];if(!_0x29bbfd&&!_0x4640d7)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x29bbfd&&_0x4640d7)return _0x50e071(0x144);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a35_0x5bf13f=a35_0x45f2;(function(_0x27176d,_0x156daf){const _0x33bbff=a35_0x45f2,_0x41ad1b=_0x27176d();while(!![]){try{const _0x3a1bf7=-parseInt(_0x33bbff(0x224))/0x1+parseInt(_0x33bbff(0x1f3))/0x2+-parseInt(_0x33bbff(0x228))/0x3*(parseInt(_0x33bbff(0x255))/0x4)+-parseInt(_0x33bbff(0x1e8))/0x5*(-parseInt(_0x33bbff(0x233))/0x6)+parseInt(_0x33bbff(0x261))/0x7*(-parseInt(_0x33bbff(0x1f5))/0x8)+-parseInt(_0x33bbff(0x211))/0x9*(parseInt(_0x33bbff(0x263))/0xa)+parseInt(_0x33bbff(0x202))/0xb;if(_0x3a1bf7===_0x156daf)break;else _0x41ad1b['push'](_0x41ad1b['shift']());}catch(_0x5a728c){_0x41ad1b['push'](_0x41ad1b['shift']());}}}(a35_0xbecc,0x83142));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a35_0x1993fd from'chalk';function formatRelativeTime(_0x55a866){const _0x18e48e=a35_0x45f2,_0x55db42=new Date(_0x55a866),_0x471729=new Date(),_0x2c4b2b=_0x55db42[_0x18e48e(0x1fc)]()-_0x471729['getTime'](),_0x22602d=Math[_0x18e48e(0x26b)](_0x2c4b2b)/0x3e8,_0x3ab293=_0x2c4b2b<0x0;if(_0x22602d<0x3c)return _0x3ab293?_0x18e48e(0x269):_0x18e48e(0x266);else{if(_0x22602d<0xe10){const _0x5083bd=Math[_0x18e48e(0x23e)](_0x22602d/0x3c);return _0x3ab293?_0x5083bd+'m\x20ago':_0x18e48e(0x25b)+_0x5083bd+'m';}else{if(_0x22602d<0x15180){const _0x30ad51=Math['round'](_0x22602d/0xe10);return _0x3ab293?_0x30ad51+_0x18e48e(0x26e):_0x18e48e(0x25b)+_0x30ad51+'h';}else{if(_0x22602d<0x93a80){const _0x216a6c=Math[_0x18e48e(0x23e)](_0x22602d/0x15180);return _0x3ab293?_0x216a6c+_0x18e48e(0x22a):_0x18e48e(0x25b)+_0x216a6c+'d';}else return _0x55db42['toLocaleDateString']();}}}}function a35_0x45f2(_0x131141,_0x9bc890){_0x131141=_0x131141-0x1e0;const _0xbecc19=a35_0xbecc();let _0x45f267=_0xbecc19[_0x131141];return _0x45f267;}export class ScheduleListCommand extends BaseCommand{[a35_0x5bf13f(0x209)]=a35_0x5bf13f(0x204);[a35_0x5bf13f(0x248)]=a35_0x5bf13f(0x1f2);async['execute'](_0x1770b4){const _0x2c6b2d=a35_0x5bf13f,{options:_0x1f54b6,args:_0x7782d3,tdx:_0x293531}=_0x1770b4,_0x4b61d7=resolveLimit(_0x1f54b6[_0x2c6b2d(0x267)],DEFAULT_DISPLAY_LIMIT),_0xfbcfe=_0x7782d3[0x0],_0x1e342d=_0xfbcfe?_0x2c6b2d(0x1e3)+_0xfbcfe+_0x2c6b2d(0x236):_0x2c6b2d(0x244),_0x147c75=await withSpinner(_0x1e342d,()=>_0x293531[_0x2c6b2d(0x260)]['listQueries']({'limit':_0x4b61d7,'scheduled':!![],'pattern':_0xfbcfe}),{'verbose':_0x1f54b6[_0x2c6b2d(0x246)]}),_0x173024=_0x147c75[_0x2c6b2d(0x229)][_0x2c6b2d(0x215)],_0x3a6d5d=_0x147c75[_0x2c6b2d(0x229)][_0x2c6b2d(0x24c)]['has_next_page'],_0x36f9c5=_0xfbcfe?_0x2c6b2d(0x25c)+_0xfbcfe+'\x22':'';_0x3a6d5d?console['error'](_0x2c6b2d(0x24b)+_0x173024['length']+_0x2c6b2d(0x207)+_0x36f9c5+_0x2c6b2d(0x1e5)):console[_0x2c6b2d(0x1ea)](_0x2c6b2d(0x221)+_0x173024[_0x2c6b2d(0x22f)]+'\x20scheduled\x20quer'+(_0x173024['length']!==0x1?'ies':'y')+_0x36f9c5);if(_0x1f54b6[_0x2c6b2d(0x1e4)]===_0x2c6b2d(0x1fe)||_0x1f54b6[_0x2c6b2d(0x1e4)]===_0x2c6b2d(0x1ef)||_0x1f54b6[_0x2c6b2d(0x1e4)]===_0x2c6b2d(0x241)||_0x1f54b6[_0x2c6b2d(0x1e4)]==='tsv'){const _0x126074=_0x173024['map'](_0x33bb2a=>({'id':_0x33bb2a['id'],'name':_0x33bb2a[_0x2c6b2d(0x209)],'cron':_0x33bb2a[_0x2c6b2d(0x1ee)],'database':_0x33bb2a[_0x2c6b2d(0x251)]?.[_0x2c6b2d(0x209)],'type':_0x33bb2a[_0x2c6b2d(0x272)],'timezone':_0x33bb2a[_0x2c6b2d(0x25e)],'user_name':_0x33bb2a[_0x2c6b2d(0x245)]?.['name'],'updated_at':_0x33bb2a[_0x2c6b2d(0x20a)],'next_run_at':_0x33bb2a[_0x2c6b2d(0x214)],'last_job_status':_0x33bb2a[_0x2c6b2d(0x24f)]?.[_0x2c6b2d(0x250)]}));await handleSDKOutput(_0x126074,_0x1f54b6);}else{if(_0x173024[_0x2c6b2d(0x22f)]===0x0)console[_0x2c6b2d(0x23d)](_0x2c6b2d(0x1f4));else{const _0x4c6c4c=_0x1f54b6[_0x2c6b2d(0x21b)],_0x4df152=_0x173024[_0x2c6b2d(0x262)](_0x14e49a=>{const _0x150956=_0x2c6b2d,_0x56bdd4=_0x14e49a[_0x150956(0x24f)]?.[_0x150956(0x250)]?_0x14e49a[_0x150956(0x24f)]['status']==='success'?'✓':'✗':'-',_0x5ccef1=_0x14e49a[_0x150956(0x24f)]?.[_0x150956(0x1e9)]?formatRelativeTime(_0x14e49a[_0x150956(0x24f)][_0x150956(0x1e9)]):_0x150956(0x21e),_0x4b7d60=_0x14e49a[_0x150956(0x214)]?formatRelativeTime(_0x14e49a[_0x150956(0x214)]):'-',_0x4efc96=_0x14e49a['cron']||'',_0x232363=_0x14e49a[_0x150956(0x209)]||'(unnamed)',_0x2dc265=getConsoleUrl(_0x4c6c4c,_0x150956(0x1f7)+_0x14e49a['id']);return{'statusIcon':_0x56bdd4,'lastRun':_0x5ccef1,'nextRun':_0x4b7d60,'cron':_0x4efc96,'name':_0x232363,'queryUrl':_0x2dc265,'status':_0x14e49a[_0x150956(0x24f)]?.['status']};}),_0xd6d037=Math[_0x2c6b2d(0x259)](..._0x4df152['map'](_0x283474=>_0x283474[_0x2c6b2d(0x200)][_0x2c6b2d(0x22f)])),_0x5dc239=Math[_0x2c6b2d(0x259)](..._0x4df152[_0x2c6b2d(0x262)](_0x14c60a=>_0x14c60a[_0x2c6b2d(0x25d)][_0x2c6b2d(0x22f)])),_0x33098d=Math[_0x2c6b2d(0x259)](..._0x4df152['map'](_0x30886d=>_0x30886d['cron']['length'])),_0x482bed=_0x4df152[_0x2c6b2d(0x262)](_0xa91452=>{const _0x20f051=_0x2c6b2d,_0x10058f=_0xa91452[_0x20f051(0x250)]===_0x20f051(0x1ff)?a35_0x1993fd[_0x20f051(0x230)](_0xa91452[_0x20f051(0x265)]):_0xa91452[_0x20f051(0x250)]==='error'?a35_0x1993fd[_0x20f051(0x223)](_0xa91452[_0x20f051(0x265)]):a35_0x1993fd['dim'](_0xa91452[_0x20f051(0x265)]),_0x27a499=_0xa91452[_0x20f051(0x200)]['padEnd'](_0xd6d037),_0x21754c=_0xa91452[_0x20f051(0x25d)][_0x20f051(0x1e7)](_0x5dc239),_0x212f78=_0xa91452['cron']?a35_0x1993fd[_0x20f051(0x253)](_0xa91452['cron']['padEnd'](_0x33098d)):'\x20'[_0x20f051(0x22e)](_0x33098d),_0x3e4fd7=hyperlink(_0xa91452[_0x20f051(0x209)],_0xa91452[_0x20f051(0x26d)]);return _0x20f051(0x22d)+_0x10058f+'\x20'+_0x27a499+_0x20f051(0x226)+_0x21754c+'\x20\x20'+_0x212f78+'\x20\x20'+_0x3e4fd7;});await writeOutput(_0x482bed[_0x2c6b2d(0x216)]('\x0a'),_0x1f54b6[_0x2c6b2d(0x264)],_0x2c6b2d(0x25f));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a35_0x5bf13f(0x209)]=a35_0x5bf13f(0x258);['description']=a35_0x5bf13f(0x238);['validate'](_0x549a17){const _0x483e29=a35_0x5bf13f,_0x2a4a41=_0x549a17[_0x483e29(0x240)][0x0];if(!_0x2a4a41)return _0x483e29(0x26a);return undefined;}async['execute'](_0x783cc){const _0x3c09fc=a35_0x5bf13f,{options:_0x24b9e2,args:_0x422b57,tdx:_0x157cc3}=_0x783cc,_0x5b0de5=_0x422b57[0x0],_0x4cedc1=await withSpinner(_0x3c09fc(0x20f),()=>_0x157cc3[_0x3c09fc(0x260)][_0x3c09fc(0x270)](_0x5b0de5),{'verbose':_0x24b9e2[_0x3c09fc(0x246)]}),_0x422bf3=_0x4cedc1[_0x3c09fc(0x229)],_0x531067={'name':_0x422bf3[_0x3c09fc(0x209)],'cron':_0x422bf3[_0x3c09fc(0x1ee)],'database':_0x422bf3[_0x3c09fc(0x251)],'type':_0x422bf3[_0x3c09fc(0x272)],'timezone':_0x422bf3['timezone'],'user_name':_0x422bf3[_0x3c09fc(0x1e2)],'created_at':_0x422bf3[_0x3c09fc(0x26f)],'engine_version':_0x422bf3['engine_version'],'executing_user_id':_0x422bf3[_0x3c09fc(0x218)],'query':_0x422bf3['query'],'delay':_0x422bf3[_0x3c09fc(0x237)],'priority':_0x422bf3[_0x3c09fc(0x25a)],'retry_limit':_0x422bf3['retry_limit'],..._0x422bf3[_0x3c09fc(0x235)]&&{'result':_0x422bf3['result']}};return await handleSingleObjectOutput(_0x531067,_0x24b9e2),0x0;}}function a35_0xbecc(){const _0x350c1e=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedule:show','max','priority','in\x20','\x20matching\x20\x22','nextRun','time_zone','list','schedules','899647QpcfwJ','map','1480wHDYKV','output','statusIcon','soon','limit','Running\x20schedule...','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','abs','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','queryUrl','h\x20ago','created_at','show','keys','type','Run\x20a\x20scheduled\x20query\x20immediately','utf-8','user_name','Searching\x20scheduled\x20queries\x20matching\x20\x22','format','\x20(use\x20--limit\x20to\x20see\x20more)','trino','padEnd','145dJqloz','ended_at','error','query','Schedule\x20deleted:\x20','...','cron','jsonl','num','file','List\x20scheduled\x20queries','1237062SfLRAl','No\x20scheduled\x20queries\x20found','32vepXRp','Schedule\x20run\x20submitted:\x20','/app/queries/editor?queryId=','\x20\x20Num:\x20','\x20\x20Type:\x20','run','\x20created','getTime','trim','json','success','lastRun','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','24521915aNhjib','retryLimit','schedule:list','entries','Schedule\x20updated:\x20','\x20schedules','delete','name','updated_at','Delete\x20a\x20scheduled\x20query','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Getting\x20schedule\x20history...','Getting\x20schedule\x20details...','retry_limit','60102MmNlce','yes','timezone','next_run_at','queries','join','Create\x20a\x20scheduled\x20query','executing_user_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','engineVersion','site','Cancelled','validate','never','time','\x20\x20Time:\x20','Found\x20','end_at','red','182567mWPHdU','schedule:run','\x20\x20→\x20','count','3NCtGvJ','data','d\x20ago','Updating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','📅\x20','repeat','length','green','Running\x20schedule:\x20','job_id','57324rXqiTf','history','result','\x22...','delay','Show\x20schedule\x20details','\x20job','\x20\x20Timezone:\x20','from','Schedule\x20created:\x20','log','round','INVALID_ARGUMENT','args','table','jobs','Failed\x20to\x20read\x20file:\x20','Listing\x20scheduled\x20queries...','user','verbose','Updating\x20schedule...','description','Creating\x20schedule...','options','Showing\x20first\x20','pagination','execute','Query\x20file\x20is\x20empty','last_job','status','database','engine_version','cyan','schedule:update','3611876YQrBAZ','\x20execution'];a35_0xbecc=function(){return _0x350c1e;};return a35_0xbecc();}export class ScheduleCreateCommand extends BaseCommand{[a35_0x5bf13f(0x209)]='schedule:create';[a35_0x5bf13f(0x248)]=a35_0x5bf13f(0x217);[a35_0x5bf13f(0x21d)](_0x5141c8){const _0x33d64a=a35_0x5bf13f,_0x5f5731=_0x5141c8[_0x33d64a(0x240)][0x0];if(!_0x5f5731)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x4c5077=_0x5141c8[_0x33d64a(0x24a)];if(!_0x4c5077['database'])return _0x33d64a(0x201);return undefined;}async[a35_0x5bf13f(0x24d)](_0x3be46b){const _0xcb662=a35_0x5bf13f,{options:_0x292d0f,args:_0x316b0a,tdx:_0x3430a6}=_0x3be46b,_0x554b5b=_0x316b0a[0x0],_0x356692=_0x292d0f,_0xcbc8e1=_0x356692['database'],_0x4dcce1=_0x356692[_0xcb662(0x1f1)],_0x378a1d=_0x356692[_0xcb662(0x272)]||_0xcb662(0x1e6);let _0x315c4a;try{_0x315c4a=readFileSync(_0x4dcce1,_0xcb662(0x1e1))[_0xcb662(0x1fd)]();}catch(_0x46d790){throw new SDKError(ErrorCode[_0xcb662(0x23f)],'Failed\x20to\x20read\x20file:\x20'+_0x4dcce1,_0x46d790 instanceof Error?_0x46d790:undefined);}if(!_0x315c4a)throw new SDKError(ErrorCode[_0xcb662(0x23f)],_0xcb662(0x24e));const _0x15b9e4={'database':_0xcbc8e1,'query':_0x315c4a,'type':_0x378a1d};if(_0x356692[_0xcb662(0x1ee)])_0x15b9e4[_0xcb662(0x1ee)]=_0x356692[_0xcb662(0x1ee)];if(_0x356692[_0xcb662(0x213)])_0x15b9e4['timezone']=_0x356692[_0xcb662(0x213)];if(_0x356692[_0xcb662(0x237)]!==undefined)_0x15b9e4[_0xcb662(0x237)]=Number(_0x356692[_0xcb662(0x237)]);if(_0x356692[_0xcb662(0x25a)]!==undefined)_0x15b9e4[_0xcb662(0x25a)]=Number(_0x356692[_0xcb662(0x25a)]);if(_0x356692[_0xcb662(0x203)]!==undefined)_0x15b9e4['retry_limit']=Number(_0x356692[_0xcb662(0x203)]);if(_0x356692[_0xcb662(0x21a)])_0x15b9e4[_0xcb662(0x252)]=_0x356692[_0xcb662(0x21a)];if(_0x356692[_0xcb662(0x235)])_0x15b9e4[_0xcb662(0x235)]=_0x356692['result'];if(_0x292d0f[_0xcb662(0x246)]){console[_0xcb662(0x1ea)]('Creating\x20schedule:\x20'+_0x554b5b),console[_0xcb662(0x1ea)]('\x20\x20Database:\x20'+_0xcbc8e1),console[_0xcb662(0x1ea)](_0xcb662(0x1f9)+_0x378a1d);if(_0x15b9e4['cron'])console['error']('\x20\x20Cron:\x20'+_0x15b9e4['cron']);if(_0x15b9e4[_0xcb662(0x213)])console[_0xcb662(0x1ea)](_0xcb662(0x23a)+_0x15b9e4[_0xcb662(0x213)]);}const _0x25c280=await withSpinner(_0xcb662(0x249),()=>_0x3430a6['schedules'][_0xcb662(0x20c)](_0x554b5b,_0x15b9e4),{'verbose':_0x292d0f['verbose']});return console[_0xcb662(0x1ea)](_0xcb662(0x23c)+_0x25c280[_0xcb662(0x229)][_0xcb662(0x209)]),await handleSingleObjectOutput(_0x25c280[_0xcb662(0x229)],_0x292d0f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a35_0x5bf13f(0x254);[a35_0x5bf13f(0x248)]='Update\x20a\x20scheduled\x20query';['validate'](_0x353cdb){const _0xc5a29b=a35_0x5bf13f,_0x9a8867=_0x353cdb['args'][0x0];if(!_0x9a8867)return _0xc5a29b(0x22c);return undefined;}async[a35_0x5bf13f(0x24d)](_0x4978b8){const _0xc1656=a35_0x5bf13f,{options:_0x460f17,args:_0x39cc21,tdx:_0x56db17}=_0x4978b8,_0x6eb457=_0x39cc21[0x0],_0x4453de=_0x460f17,_0x587187={};if(_0x4453de[_0xc1656(0x251)])_0x587187[_0xc1656(0x251)]=_0x4453de[_0xc1656(0x251)];if(_0x4453de[_0xc1656(0x272)])_0x587187[_0xc1656(0x272)]=_0x4453de[_0xc1656(0x272)];if(_0x4453de[_0xc1656(0x1ee)])_0x587187['cron']=_0x4453de[_0xc1656(0x1ee)];if(_0x4453de[_0xc1656(0x213)])_0x587187[_0xc1656(0x213)]=_0x4453de[_0xc1656(0x213)];if(_0x4453de[_0xc1656(0x237)]!==undefined)_0x587187[_0xc1656(0x237)]=Number(_0x4453de[_0xc1656(0x237)]);if(_0x4453de[_0xc1656(0x25a)]!==undefined)_0x587187[_0xc1656(0x25a)]=Number(_0x4453de['priority']);if(_0x4453de[_0xc1656(0x203)]!==undefined)_0x587187[_0xc1656(0x210)]=Number(_0x4453de[_0xc1656(0x203)]);if(_0x4453de[_0xc1656(0x21a)])_0x587187[_0xc1656(0x252)]=_0x4453de[_0xc1656(0x21a)];if(_0x4453de['result'])_0x587187[_0xc1656(0x235)]=_0x4453de[_0xc1656(0x235)];if(_0x4453de['file'])try{_0x587187[_0xc1656(0x1eb)]=readFileSync(_0x4453de[_0xc1656(0x1f1)],_0xc1656(0x1e1))[_0xc1656(0x1fd)]();}catch(_0x4fe145){throw new SDKError(ErrorCode[_0xc1656(0x23f)],_0xc1656(0x243)+_0x4453de[_0xc1656(0x1f1)],_0x4fe145 instanceof Error?_0x4fe145:undefined);}if(Object[_0xc1656(0x271)](_0x587187)['length']===0x0)throw new SDKError(ErrorCode[_0xc1656(0x23f)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x460f17['verbose']){console['error'](_0xc1656(0x22b)+_0x6eb457);for(const [_0x475c89,_0x1e5f49]of Object[_0xc1656(0x205)](_0x587187)){_0x475c89===_0xc1656(0x1eb)?console[_0xc1656(0x1ea)]('\x20\x20'+_0x475c89+':\x20'+_0x1e5f49['substring'](0x0,0x32)+_0xc1656(0x1ed)):console[_0xc1656(0x1ea)]('\x20\x20'+_0x475c89+':\x20'+_0x1e5f49);}}const _0x218bc7=await withSpinner(_0xc1656(0x247),()=>_0x56db17[_0xc1656(0x260)]['update'](_0x6eb457,_0x587187),{'verbose':_0x460f17['verbose']});return console[_0xc1656(0x1ea)](_0xc1656(0x206)+_0x218bc7[_0xc1656(0x229)]['name']),await handleSingleObjectOutput(_0x218bc7[_0xc1656(0x229)],_0x460f17),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';[a35_0x5bf13f(0x248)]=a35_0x5bf13f(0x20b);[a35_0x5bf13f(0x21d)](_0x37921e){const _0x412831=a35_0x5bf13f,_0x4135df=_0x37921e[_0x412831(0x240)][0x0];if(!_0x4135df)return _0x412831(0x257);return undefined;}async[a35_0x5bf13f(0x24d)](_0x283160){const _0x67ecee=a35_0x5bf13f,{options:_0x5b906a,args:_0x2cf32f,tdx:_0x445903}=_0x283160,_0x4d48f4=_0x2cf32f[0x0];if(!_0x5b906a[_0x67ecee(0x212)]){const _0x55011b=await confirm(_0x67ecee(0x26c)+_0x4d48f4+'\x22?');if(!_0x55011b)return console[_0x67ecee(0x1ea)](_0x67ecee(0x21c)),0x0;}const _0x21f420=await withSpinner('Deleting\x20schedule...',()=>_0x445903[_0x67ecee(0x260)][_0x67ecee(0x208)](_0x4d48f4),{'verbose':_0x5b906a[_0x67ecee(0x246)]});return console[_0x67ecee(0x1ea)](_0x67ecee(0x1ec)+_0x21f420[_0x67ecee(0x229)][_0x67ecee(0x209)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x5bf13f(0x209)]=a35_0x5bf13f(0x225);['description']=a35_0x5bf13f(0x1e0);['validate'](_0x34e6ae){const _0x1e5eff=a35_0x5bf13f,_0x17d58b=_0x34e6ae[_0x1e5eff(0x240)][0x0];if(!_0x17d58b)return _0x1e5eff(0x219);return undefined;}async['execute'](_0x20652f){const _0x37ba6b=a35_0x5bf13f,{options:_0x1c789f,args:_0x40ec0d,tdx:_0x2a0b69}=_0x20652f,_0x101118=_0x40ec0d[0x0],_0x3f0d5d=_0x1c789f,_0x584aac=_0x3f0d5d[_0x37ba6b(0x21f)],_0x49f892=_0x3f0d5d['num']!==undefined?Number(_0x3f0d5d[_0x37ba6b(0x1f0)]):undefined;if(_0x1c789f[_0x37ba6b(0x246)]){console[_0x37ba6b(0x1ea)](_0x37ba6b(0x231)+_0x101118);if(_0x584aac)console[_0x37ba6b(0x1ea)](_0x37ba6b(0x220)+_0x584aac);if(_0x49f892)console[_0x37ba6b(0x1ea)](_0x37ba6b(0x1f8)+_0x49f892);}const _0x51dc25=await withSpinner(_0x37ba6b(0x268),()=>_0x2a0b69['schedules'][_0x37ba6b(0x1fa)](_0x101118,{'time':_0x584aac,'num':_0x49f892}),{'verbose':_0x1c789f[_0x37ba6b(0x246)]}),_0x5aa337=_0x51dc25[_0x37ba6b(0x229)][_0x37ba6b(0x242)];console[_0x37ba6b(0x1ea)](_0x37ba6b(0x1f6)+_0x5aa337['length']+_0x37ba6b(0x239)+(_0x5aa337[_0x37ba6b(0x22f)]!==0x1?'s':'')+_0x37ba6b(0x1fb));for(const _0x546aec of _0x5aa337){console['error']('\x20\x20Job\x20ID:\x20'+_0x546aec[_0x37ba6b(0x232)]);}return await handleSDKOutput(_0x5aa337,_0x1c789f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a35_0x5bf13f(0x248)]='Show\x20schedule\x20execution\x20history';[a35_0x5bf13f(0x21d)](_0x59690c){const _0x2dac30=a35_0x5bf13f,_0x818527=_0x59690c[_0x2dac30(0x240)][0x0];if(!_0x818527)return _0x2dac30(0x20d);return undefined;}async['execute'](_0x46aba8){const _0x2ed816=a35_0x5bf13f,{options:_0xff40c3,args:_0x3924ba,tdx:_0x2ebb94}=_0x46aba8,_0x553ea8=_0x3924ba[0x0],_0xbe4188=_0xff40c3,_0x222d1c=_0xbe4188[_0x2ed816(0x23b)]!==undefined?Number(_0xbe4188[_0x2ed816(0x23b)]):undefined,_0xb48be1=_0xbe4188['to']!==undefined?Number(_0xbe4188['to']):undefined,_0x451a39=await withSpinner(_0x2ed816(0x20e),()=>_0x2ebb94[_0x2ed816(0x260)][_0x2ed816(0x234)](_0x553ea8,{'from':_0x222d1c,'to':_0xb48be1}),{'verbose':_0xff40c3['verbose']}),_0x31196d=_0x451a39[_0x2ed816(0x229)];console[_0x2ed816(0x1ea)](_0x2ed816(0x221)+_0x31196d[_0x2ed816(0x227)]+_0x2ed816(0x256)+(_0x31196d[_0x2ed816(0x227)]!==0x1?'s':'')+'\x20(showing\x20'+_0x31196d[_0x2ed816(0x23b)]+'-'+_0x31196d['to']+')');const _0x884773=_0x31196d[_0x2ed816(0x234)][_0x2ed816(0x262)](_0x154ce0=>({'job_id':_0x154ce0[_0x2ed816(0x232)],'type':_0x154ce0[_0x2ed816(0x272)],'status':_0x154ce0['status'],'scheduled_at':_0x154ce0['scheduled_at'],'created_at':_0x154ce0[_0x2ed816(0x26f)],'start_at':_0x154ce0['start_at'],'end_at':_0x154ce0[_0x2ed816(0x222)]}));return await handleSDKOutput(_0x884773,_0xff40c3),0x0;}}
|
|
1
|
+
const a37_0x144c92=a37_0x20b6;(function(_0xc5e54a,_0x570101){const _0x77663b=a37_0x20b6,_0x45c5f6=_0xc5e54a();while(!![]){try{const _0x51c8e8=-parseInt(_0x77663b(0x7f))/0x1*(parseInt(_0x77663b(0xa8))/0x2)+-parseInt(_0x77663b(0x88))/0x3*(-parseInt(_0x77663b(0x71))/0x4)+parseInt(_0x77663b(0xad))/0x5+-parseInt(_0x77663b(0xe2))/0x6*(parseInt(_0x77663b(0xa5))/0x7)+-parseInt(_0x77663b(0xe8))/0x8*(parseInt(_0x77663b(0xec))/0x9)+parseInt(_0x77663b(0x8d))/0xa*(-parseInt(_0x77663b(0xac))/0xb)+parseInt(_0x77663b(0xe5))/0xc;if(_0x51c8e8===_0x570101)break;else _0x45c5f6['push'](_0x45c5f6['shift']());}catch(_0x319b8c){_0x45c5f6['push'](_0x45c5f6['shift']());}}}(a37_0x4065,0x5b631));function a37_0x20b6(_0x46e1ac,_0x3e2fcb){_0x46e1ac=_0x46e1ac-0x71;const _0x406599=a37_0x4065();let _0x20b6df=_0x406599[_0x46e1ac];return _0x20b6df;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a37_0x4065(){const _0x705707=['queries','time_zone','format','utf-8','jobs','limit','m\x20ago','schedule:update','h\x20ago','Schedule\x20updated:\x20','Show\x20schedule\x20details','Updating\x20schedule...','cyan','Schedule\x20deleted:\x20','370518EtnAap','trino','abs','8740020sMmPPC','\x20\x20Job\x20ID:\x20','created_at','40vwVTAF','Getting\x20schedule\x20history...','description','engineVersion','782199kKLgAN','Listing\x20scheduled\x20queries...','round','from','schedule:delete','dim','ies','file','type','user','retryLimit','queryUrl','database','INVALID_ARGUMENT','table','\x20execution','map','\x20(showing\x20','Running\x20schedule:\x20','2220dRYtPI','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','status','site','schedule:list','\x20(use\x20--limit\x20to\x20see\x20more)','red','delay','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','json','end_at','pagination','never','103043IRKrAx','cron','(unnamed)','padEnd','lastRun','Failed\x20to\x20read\x20file:\x20','execute','output','history','1221CQhlje','scheduled_at','job_id','soon','show','20mZsOkb','timezone','nextRun','data','count','entries','Schedule\x20run\x20submitted:\x20','\x20\x20Type:\x20','Deleting\x20schedule...','engine_version','args','substring','time','verbose','user_name','Showing\x20first\x20','num','error','\x20schedules','\x20\x20Database:\x20','name','Getting\x20schedule\x20details...','trim','create','7OFzCfl','/app/queries/editor?queryId=','schedule:run','8MRCBdV','\x20\x20Cron:\x20','last_job','schedule:history','194557nrAinl','1819775FLPlXh','retry_limit','list','\x20matching\x20\x22','success','Running\x20schedule...','start_at','List\x20scheduled\x20queries','schedule:create','yes','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','statusIcon','toLocaleDateString','ended_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','run','delete','\x20created','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','join','Create\x20a\x20scheduled\x20query','Found\x20','query','Run\x20a\x20scheduled\x20query\x20immediately','jsonl','Creating\x20schedule...','getTime','repeat','just\x20now','schedules','validate','📅\x20','next_run_at','max','Delete\x20a\x20scheduled\x20query','has_next_page','result','length','d\x20ago'];a37_0x4065=function(){return _0x705707;};return a37_0x4065();}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x59dcf5 from'chalk';function formatRelativeTime(_0x5212a1){const _0x2459f4=a37_0x20b6,_0x51f82f=new Date(_0x5212a1),_0x415dcb=new Date(),_0x40ed0f=_0x51f82f['getTime']()-_0x415dcb[_0x2459f4(0xc7)](),_0x1ab4ad=Math[_0x2459f4(0xe4)](_0x40ed0f)/0x3e8,_0x432e0f=_0x40ed0f<0x0;if(_0x1ab4ad<0x3c)return _0x432e0f?_0x2459f4(0xc9):_0x2459f4(0x8b);else{if(_0x1ab4ad<0xe10){const _0x4f167a=Math[_0x2459f4(0xee)](_0x1ab4ad/0x3c);return _0x432e0f?_0x4f167a+_0x2459f4(0xda):'in\x20'+_0x4f167a+'m';}else{if(_0x1ab4ad<0x15180){const _0x4b7103=Math[_0x2459f4(0xee)](_0x1ab4ad/0xe10);return _0x432e0f?_0x4b7103+_0x2459f4(0xdc):'in\x20'+_0x4b7103+'h';}else{if(_0x1ab4ad<0x93a80){const _0x281123=Math[_0x2459f4(0xee)](_0x1ab4ad/0x15180);return _0x432e0f?_0x281123+_0x2459f4(0xd3):'in\x20'+_0x281123+'d';}else return _0x51f82f[_0x2459f4(0xb9)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x144c92(0xa1)]=a37_0x144c92(0x76);[a37_0x144c92(0xea)]=a37_0x144c92(0xb4);async[a37_0x144c92(0x85)](_0x5bd514){const _0x4d4813=a37_0x144c92,{options:_0x59f7fc,args:_0x53a124,tdx:_0x31b065}=_0x5bd514,_0x2ae76f=resolveLimit(_0x59f7fc[_0x4d4813(0xd9)],DEFAULT_DISPLAY_LIMIT),_0x5d11da=_0x53a124[0x0],_0x471467=_0x5d11da?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x5d11da+'\x22...':_0x4d4813(0xed),_0x398d32=await withSpinner(_0x471467,()=>_0x31b065[_0x4d4813(0xca)]['listQueries']({'limit':_0x2ae76f,'scheduled':!![],'pattern':_0x5d11da}),{'verbose':_0x59f7fc[_0x4d4813(0x9a)]}),_0x4527ec=_0x398d32['data'][_0x4d4813(0xd4)],_0x45f31e=_0x398d32[_0x4d4813(0x90)][_0x4d4813(0x7d)][_0x4d4813(0xd0)],_0x3ee5d9=_0x5d11da?_0x4d4813(0xb0)+_0x5d11da+'\x22':'';_0x45f31e?console[_0x4d4813(0x9e)](_0x4d4813(0x9c)+_0x4527ec[_0x4d4813(0xd2)]+_0x4d4813(0x9f)+_0x3ee5d9+_0x4d4813(0x77)):console['error'](_0x4d4813(0xc2)+_0x4527ec[_0x4d4813(0xd2)]+'\x20scheduled\x20quer'+(_0x4527ec[_0x4d4813(0xd2)]!==0x1?_0x4d4813(0xf2):'y')+_0x3ee5d9);if(_0x59f7fc[_0x4d4813(0xd6)]===_0x4d4813(0x7b)||_0x59f7fc[_0x4d4813(0xd6)]===_0x4d4813(0xc5)||_0x59f7fc[_0x4d4813(0xd6)]===_0x4d4813(0xfa)||_0x59f7fc[_0x4d4813(0xd6)]==='tsv'){const _0x459e49=_0x4527ec[_0x4d4813(0xfc)](_0x5bfe0f=>({'id':_0x5bfe0f['id'],'name':_0x5bfe0f[_0x4d4813(0xa1)],'cron':_0x5bfe0f[_0x4d4813(0x80)],'database':_0x5bfe0f[_0x4d4813(0xf8)]?.[_0x4d4813(0xa1)],'type':_0x5bfe0f[_0x4d4813(0xf4)],'timezone':_0x5bfe0f[_0x4d4813(0xd5)],'user_name':_0x5bfe0f[_0x4d4813(0xf5)]?.[_0x4d4813(0xa1)],'updated_at':_0x5bfe0f['updated_at'],'next_run_at':_0x5bfe0f[_0x4d4813(0xcd)],'last_job_status':_0x5bfe0f[_0x4d4813(0xaa)]?.[_0x4d4813(0x74)]}));await handleSDKOutput(_0x459e49,_0x59f7fc);}else{if(_0x4527ec['length']===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x1a0ab4=_0x59f7fc[_0x4d4813(0x75)],_0x37fff0=_0x4527ec[_0x4d4813(0xfc)](_0x13d5e8=>{const _0x260018=_0x4d4813,_0xf22735=_0x13d5e8[_0x260018(0xaa)]?.[_0x260018(0x74)]?_0x13d5e8[_0x260018(0xaa)][_0x260018(0x74)]===_0x260018(0xb1)?'✓':'✗':'-',_0x36d1f5=_0x13d5e8[_0x260018(0xaa)]?.[_0x260018(0xba)]?formatRelativeTime(_0x13d5e8[_0x260018(0xaa)][_0x260018(0xba)]):_0x260018(0x7e),_0x37532b=_0x13d5e8[_0x260018(0xcd)]?formatRelativeTime(_0x13d5e8[_0x260018(0xcd)]):'-',_0x18970c=_0x13d5e8[_0x260018(0x80)]||'',_0x5eca83=_0x13d5e8[_0x260018(0xa1)]||_0x260018(0x81),_0x1e0626=getConsoleUrl(_0x1a0ab4,_0x260018(0xa6)+_0x13d5e8['id']);return{'statusIcon':_0xf22735,'lastRun':_0x36d1f5,'nextRun':_0x37532b,'cron':_0x18970c,'name':_0x5eca83,'queryUrl':_0x1e0626,'status':_0x13d5e8[_0x260018(0xaa)]?.[_0x260018(0x74)]};}),_0x2d2ade=Math[_0x4d4813(0xce)](..._0x37fff0[_0x4d4813(0xfc)](_0x4d06d5=>_0x4d06d5[_0x4d4813(0x83)][_0x4d4813(0xd2)])),_0xf7cde2=Math[_0x4d4813(0xce)](..._0x37fff0[_0x4d4813(0xfc)](_0x211dc9=>_0x211dc9[_0x4d4813(0x8f)][_0x4d4813(0xd2)])),_0x4e1b4e=Math[_0x4d4813(0xce)](..._0x37fff0[_0x4d4813(0xfc)](_0x17bc01=>_0x17bc01[_0x4d4813(0x80)][_0x4d4813(0xd2)])),_0x545a03=_0x37fff0[_0x4d4813(0xfc)](_0x48e9ab=>{const _0x34416c=_0x4d4813,_0x29c925=_0x48e9ab[_0x34416c(0x74)]===_0x34416c(0xb1)?a37_0x59dcf5['green'](_0x48e9ab[_0x34416c(0xb8)]):_0x48e9ab[_0x34416c(0x74)]===_0x34416c(0x9e)?a37_0x59dcf5[_0x34416c(0x78)](_0x48e9ab[_0x34416c(0xb8)]):a37_0x59dcf5[_0x34416c(0xf1)](_0x48e9ab['statusIcon']),_0x1358b6=_0x48e9ab[_0x34416c(0x83)][_0x34416c(0x82)](_0x2d2ade),_0xaa5938=_0x48e9ab[_0x34416c(0x8f)][_0x34416c(0x82)](_0xf7cde2),_0x2c86af=_0x48e9ab['cron']?a37_0x59dcf5[_0x34416c(0xe0)](_0x48e9ab['cron'][_0x34416c(0x82)](_0x4e1b4e)):'\x20'[_0x34416c(0xc8)](_0x4e1b4e),_0x480e8c=hyperlink(_0x48e9ab['name'],_0x48e9ab[_0x34416c(0xf7)]);return _0x34416c(0xcc)+_0x29c925+'\x20'+_0x1358b6+'\x20\x20→\x20'+_0xaa5938+'\x20\x20'+_0x2c86af+'\x20\x20'+_0x480e8c;});await writeOutput(_0x545a03[_0x4d4813(0xc0)]('\x0a'),_0x59f7fc[_0x4d4813(0x86)],_0x4d4813(0xaf));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x144c92(0xa1)]='schedule:show';['description']=a37_0x144c92(0xde);['validate'](_0x18a11c){const _0x18e2fe=a37_0x144c92,_0x42821a=_0x18a11c['args'][0x0];if(!_0x42821a)return _0x18e2fe(0x73);return undefined;}async[a37_0x144c92(0x85)](_0x416822){const _0x12b363=a37_0x144c92,{options:_0x302cbb,args:_0x2b9574,tdx:_0xbc7080}=_0x416822,_0x517115=_0x2b9574[0x0],_0x41abf7=await withSpinner(_0x12b363(0xa2),()=>_0xbc7080[_0x12b363(0xca)][_0x12b363(0x8c)](_0x517115),{'verbose':_0x302cbb[_0x12b363(0x9a)]}),_0xac1736=_0x41abf7[_0x12b363(0x90)],_0x32e1e1={'name':_0xac1736['name'],'cron':_0xac1736['cron'],'database':_0xac1736[_0x12b363(0xf8)],'type':_0xac1736[_0x12b363(0xf4)],'timezone':_0xac1736[_0x12b363(0x8e)],'user_name':_0xac1736[_0x12b363(0x9b)],'created_at':_0xac1736[_0x12b363(0xe7)],'engine_version':_0xac1736[_0x12b363(0x96)],'executing_user_id':_0xac1736['executing_user_id'],'query':_0xac1736[_0x12b363(0xc3)],'delay':_0xac1736[_0x12b363(0x79)],'priority':_0xac1736['priority'],'retry_limit':_0xac1736[_0x12b363(0xae)],..._0xac1736[_0x12b363(0xd1)]&&{'result':_0xac1736[_0x12b363(0xd1)]}};return await handleSingleObjectOutput(_0x32e1e1,_0x302cbb),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a37_0x144c92(0xb5);[a37_0x144c92(0xea)]=a37_0x144c92(0xc1);[a37_0x144c92(0xcb)](_0x2e2726){const _0x2b2d23=a37_0x144c92,_0x2ffcc3=_0x2e2726[_0x2b2d23(0x97)][0x0];if(!_0x2ffcc3)return _0x2b2d23(0x7a);const _0x583b8e=_0x2e2726['options'];if(!_0x583b8e[_0x2b2d23(0xf8)])return _0x2b2d23(0xbb);return undefined;}async[a37_0x144c92(0x85)](_0x5e4b20){const _0x9e13fa=a37_0x144c92,{options:_0x2af9b7,args:_0x2ed655,tdx:_0x5c2fb4}=_0x5e4b20,_0x2f424e=_0x2ed655[0x0],_0x804024=_0x2af9b7,_0x11730b=_0x804024['database'],_0x3251ed=_0x804024[_0x9e13fa(0xf3)],_0xbde20b=_0x804024[_0x9e13fa(0xf4)]||_0x9e13fa(0xe3);let _0x18f567;try{_0x18f567=readFileSync(_0x3251ed,_0x9e13fa(0xd7))['trim']();}catch(_0x4f7380){throw new SDKError(ErrorCode[_0x9e13fa(0xf9)],'Failed\x20to\x20read\x20file:\x20'+_0x3251ed,_0x4f7380 instanceof Error?_0x4f7380:undefined);}if(!_0x18f567)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x437458={'database':_0x11730b,'query':_0x18f567,'type':_0xbde20b};if(_0x804024[_0x9e13fa(0x80)])_0x437458[_0x9e13fa(0x80)]=_0x804024[_0x9e13fa(0x80)];if(_0x804024[_0x9e13fa(0x8e)])_0x437458[_0x9e13fa(0x8e)]=_0x804024[_0x9e13fa(0x8e)];if(_0x804024['delay']!==undefined)_0x437458['delay']=Number(_0x804024[_0x9e13fa(0x79)]);if(_0x804024[_0x9e13fa(0x72)]!==undefined)_0x437458[_0x9e13fa(0x72)]=Number(_0x804024[_0x9e13fa(0x72)]);if(_0x804024[_0x9e13fa(0xf6)]!==undefined)_0x437458[_0x9e13fa(0xae)]=Number(_0x804024[_0x9e13fa(0xf6)]);if(_0x804024[_0x9e13fa(0xeb)])_0x437458['engine_version']=_0x804024[_0x9e13fa(0xeb)];if(_0x804024[_0x9e13fa(0xd1)])_0x437458[_0x9e13fa(0xd1)]=_0x804024[_0x9e13fa(0xd1)];if(_0x2af9b7[_0x9e13fa(0x9a)]){console[_0x9e13fa(0x9e)]('Creating\x20schedule:\x20'+_0x2f424e),console[_0x9e13fa(0x9e)](_0x9e13fa(0xa0)+_0x11730b),console['error'](_0x9e13fa(0x94)+_0xbde20b);if(_0x437458[_0x9e13fa(0x80)])console[_0x9e13fa(0x9e)](_0x9e13fa(0xa9)+_0x437458[_0x9e13fa(0x80)]);if(_0x437458[_0x9e13fa(0x8e)])console['error']('\x20\x20Timezone:\x20'+_0x437458[_0x9e13fa(0x8e)]);}const _0x2ca2d6=await withSpinner(_0x9e13fa(0xc6),()=>_0x5c2fb4[_0x9e13fa(0xca)][_0x9e13fa(0xa4)](_0x2f424e,_0x437458),{'verbose':_0x2af9b7['verbose']});return console[_0x9e13fa(0x9e)]('Schedule\x20created:\x20'+_0x2ca2d6[_0x9e13fa(0x90)][_0x9e13fa(0xa1)]),await handleSingleObjectOutput(_0x2ca2d6[_0x9e13fa(0x90)],_0x2af9b7),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x144c92(0xa1)]=a37_0x144c92(0xdb);[a37_0x144c92(0xea)]='Update\x20a\x20scheduled\x20query';[a37_0x144c92(0xcb)](_0x2386f3){const _0x1b9b45=a37_0x144c92,_0x2849ff=_0x2386f3[_0x1b9b45(0x97)][0x0];if(!_0x2849ff)return _0x1b9b45(0xbf);return undefined;}async[a37_0x144c92(0x85)](_0x5b9915){const _0x548506=a37_0x144c92,{options:_0x1d05e7,args:_0x3edb82,tdx:_0x376664}=_0x5b9915,_0x3fec45=_0x3edb82[0x0],_0xdf5fed=_0x1d05e7,_0x197077={};if(_0xdf5fed[_0x548506(0xf8)])_0x197077[_0x548506(0xf8)]=_0xdf5fed['database'];if(_0xdf5fed[_0x548506(0xf4)])_0x197077[_0x548506(0xf4)]=_0xdf5fed[_0x548506(0xf4)];if(_0xdf5fed[_0x548506(0x80)])_0x197077[_0x548506(0x80)]=_0xdf5fed['cron'];if(_0xdf5fed[_0x548506(0x8e)])_0x197077['timezone']=_0xdf5fed[_0x548506(0x8e)];if(_0xdf5fed[_0x548506(0x79)]!==undefined)_0x197077['delay']=Number(_0xdf5fed[_0x548506(0x79)]);if(_0xdf5fed['priority']!==undefined)_0x197077[_0x548506(0x72)]=Number(_0xdf5fed[_0x548506(0x72)]);if(_0xdf5fed[_0x548506(0xf6)]!==undefined)_0x197077[_0x548506(0xae)]=Number(_0xdf5fed['retryLimit']);if(_0xdf5fed['engineVersion'])_0x197077[_0x548506(0x96)]=_0xdf5fed[_0x548506(0xeb)];if(_0xdf5fed['result'])_0x197077[_0x548506(0xd1)]=_0xdf5fed['result'];if(_0xdf5fed[_0x548506(0xf3)])try{_0x197077[_0x548506(0xc3)]=readFileSync(_0xdf5fed[_0x548506(0xf3)],_0x548506(0xd7))[_0x548506(0xa3)]();}catch(_0x2464d2){throw new SDKError(ErrorCode[_0x548506(0xf9)],_0x548506(0x84)+_0xdf5fed[_0x548506(0xf3)],_0x2464d2 instanceof Error?_0x2464d2:undefined);}if(Object['keys'](_0x197077)[_0x548506(0xd2)]===0x0)throw new SDKError(ErrorCode[_0x548506(0xf9)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x1d05e7[_0x548506(0x9a)]){console[_0x548506(0x9e)]('Updating\x20schedule:\x20'+_0x3fec45);for(const [_0x193cb3,_0x3a4e80]of Object[_0x548506(0x92)](_0x197077)){_0x193cb3===_0x548506(0xc3)?console[_0x548506(0x9e)]('\x20\x20'+_0x193cb3+':\x20'+_0x3a4e80[_0x548506(0x98)](0x0,0x32)+'...'):console[_0x548506(0x9e)]('\x20\x20'+_0x193cb3+':\x20'+_0x3a4e80);}}const _0xda7f13=await withSpinner(_0x548506(0xdf),()=>_0x376664[_0x548506(0xca)]['update'](_0x3fec45,_0x197077),{'verbose':_0x1d05e7[_0x548506(0x9a)]});return console[_0x548506(0x9e)](_0x548506(0xdd)+_0xda7f13['data'][_0x548506(0xa1)]),await handleSingleObjectOutput(_0xda7f13[_0x548506(0x90)],_0x1d05e7),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a37_0x144c92(0xf0);['description']=a37_0x144c92(0xcf);[a37_0x144c92(0xcb)](_0x44b7ff){const _0x5c63a0=_0x44b7ff['args'][0x0];if(!_0x5c63a0)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a37_0x144c92(0x85)](_0x136951){const _0x571fdc=a37_0x144c92,{options:_0x4f87da,args:_0x2689cf,tdx:_0x35856e}=_0x136951,_0x33e455=_0x2689cf[0x0];if(!_0x4f87da[_0x571fdc(0xb6)]){const _0x47e2f9=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x33e455+'\x22?');if(!_0x47e2f9)return console[_0x571fdc(0x9e)]('Cancelled'),0x0;}const _0x533807=await withSpinner(_0x571fdc(0x95),()=>_0x35856e['schedules'][_0x571fdc(0xbd)](_0x33e455),{'verbose':_0x4f87da['verbose']});return console[_0x571fdc(0x9e)](_0x571fdc(0xe1)+_0x533807['data'][_0x571fdc(0xa1)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x144c92(0xa1)]=a37_0x144c92(0xa7);[a37_0x144c92(0xea)]=a37_0x144c92(0xc4);[a37_0x144c92(0xcb)](_0x13c426){const _0x18b968=_0x13c426['args'][0x0];if(!_0x18b968)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x1fceb8){const _0x19b64d=a37_0x144c92,{options:_0x3d6611,args:_0x36adaf,tdx:_0x52433f}=_0x1fceb8,_0x30a4ec=_0x36adaf[0x0],_0x3cf26e=_0x3d6611,_0x3e44fb=_0x3cf26e[_0x19b64d(0x99)],_0x3459f6=_0x3cf26e[_0x19b64d(0x9d)]!==undefined?Number(_0x3cf26e[_0x19b64d(0x9d)]):undefined;if(_0x3d6611[_0x19b64d(0x9a)]){console[_0x19b64d(0x9e)](_0x19b64d(0xfe)+_0x30a4ec);if(_0x3e44fb)console['error']('\x20\x20Time:\x20'+_0x3e44fb);if(_0x3459f6)console['error']('\x20\x20Num:\x20'+_0x3459f6);}const _0x16a1fe=await withSpinner(_0x19b64d(0xb2),()=>_0x52433f[_0x19b64d(0xca)][_0x19b64d(0xbc)](_0x30a4ec,{'time':_0x3e44fb,'num':_0x3459f6}),{'verbose':_0x3d6611[_0x19b64d(0x9a)]}),_0x2a51bd=_0x16a1fe[_0x19b64d(0x90)][_0x19b64d(0xd8)];console['error'](_0x19b64d(0x93)+_0x2a51bd[_0x19b64d(0xd2)]+'\x20job'+(_0x2a51bd[_0x19b64d(0xd2)]!==0x1?'s':'')+_0x19b64d(0xbe));for(const _0x3dba88 of _0x2a51bd){console['error'](_0x19b64d(0xe6)+_0x3dba88[_0x19b64d(0x8a)]);}return await handleSDKOutput(_0x2a51bd,_0x3d6611),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a37_0x144c92(0xab);['description']='Show\x20schedule\x20execution\x20history';[a37_0x144c92(0xcb)](_0x514155){const _0xff446f=a37_0x144c92,_0xca513d=_0x514155[_0xff446f(0x97)][0x0];if(!_0xca513d)return _0xff446f(0xb7);return undefined;}async[a37_0x144c92(0x85)](_0x4d32d9){const _0x16611a=a37_0x144c92,{options:_0x24c117,args:_0x384c36,tdx:_0x4486c2}=_0x4d32d9,_0x35599a=_0x384c36[0x0],_0x472afa=_0x24c117,_0x19c280=_0x472afa['from']!==undefined?Number(_0x472afa[_0x16611a(0xef)]):undefined,_0x499ef8=_0x472afa['to']!==undefined?Number(_0x472afa['to']):undefined,_0x4acf59=await withSpinner(_0x16611a(0xe9),()=>_0x4486c2['schedules'][_0x16611a(0x87)](_0x35599a,{'from':_0x19c280,'to':_0x499ef8}),{'verbose':_0x24c117['verbose']}),_0x47d9ac=_0x4acf59[_0x16611a(0x90)];console[_0x16611a(0x9e)](_0x16611a(0xc2)+_0x47d9ac['count']+_0x16611a(0xfb)+(_0x47d9ac[_0x16611a(0x91)]!==0x1?'s':'')+_0x16611a(0xfd)+_0x47d9ac['from']+'-'+_0x47d9ac['to']+')');const _0x50e731=_0x47d9ac[_0x16611a(0x87)][_0x16611a(0xfc)](_0x3c6fc1=>({'job_id':_0x3c6fc1[_0x16611a(0x8a)],'type':_0x3c6fc1['type'],'status':_0x3c6fc1[_0x16611a(0x74)],'scheduled_at':_0x3c6fc1[_0x16611a(0x89)],'created_at':_0x3c6fc1[_0x16611a(0xe7)],'start_at':_0x3c6fc1[_0x16611a(0xb3)],'end_at':_0x3c6fc1[_0x16611a(0x7c)]}));return await handleSDKOutput(_0x50e731,_0x24c117),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x18f4a0=a36_0x2864;(function(_0x1001b1,_0x2bb37e){const _0x2c003d=a36_0x2864,_0x138ee5=_0x1001b1();while(!![]){try{const _0x4eb33c=parseInt(_0x2c003d(0x14a))/0x1*(-parseInt(_0x2c003d(0x118))/0x2)+parseInt(_0x2c003d(0xe2))/0x3+parseInt(_0x2c003d(0x119))/0x4+parseInt(_0x2c003d(0xb7))/0x5*(parseInt(_0x2c003d(0x100))/0x6)+-parseInt(_0x2c003d(0xe4))/0x7*(parseInt(_0x2c003d(0x145))/0x8)+-parseInt(_0x2c003d(0x126))/0x9+parseInt(_0x2c003d(0xc5))/0xa;if(_0x4eb33c===_0x2bb37e)break;else _0x138ee5['push'](_0x138ee5['shift']());}catch(_0x35bdd3){_0x138ee5['push'](_0x138ee5['shift']());}}}(a36_0x5a7e,0xdb587));function a36_0x2864(_0x33b044,_0x4a122c){_0x33b044=_0x33b044-0xaf;const _0x5a7e26=a36_0x5a7e();let _0x2864fc=_0x5a7e26[_0x33b044];return _0x2864fc;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a36_0x5a7e(){const _0x65104f=['2113140gbMvFf','✔\x20Created\x20folder\x20\x27','Resolved:\x20','parentFolder','Fetching\x20SQL\x20for\x20segment...','Folder\x20name:\x20','Resolving\x20folder\x20\x27','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','getFolder','14314113nUyDmE','SEGMENT_NOT_FOUND','Fetching\x20folder\x20details...','type','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Creating\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','trim','verbose','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Use:\x20tdx\x20ps\x20view','segmentName','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Parent\x20segment:\x20','\x20Opening\x20','folder','\x20folder','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20','\x20\x20Segment\x20name:\x20','listFolders','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolving\x20parent\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20Cause:\x20','segment:view','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Folder\x20path:\x20','1256OoYCyG','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','/app/ps/','segment','Parent\x20ID:\x20','45NGyGMk','SEGMENT_FOLDER_NOT_FOUND','segment:describe','cause','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','information_schema','Target\x20path:\x20','\x27...','5ulHCAI','toLocaleString','processedRows','segment:sql','stats','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20reference\x20is\x20required','createFolder','Usage:','Show\x20child\x20segment\x20schema\x20(column\x20types)','data','log','fullPath','Parent\x20name:\x20','28476800kVBJEU','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','length','Use:\x20tdx\x20ps\x20desc','getSegment','Folder\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','getSQLFromYamlFile','Error:\x20Path\x20or\x20name\x20is\x20required','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','resolvePathToResource','includes','Segment\x20ID:\x20','parent','Resolving\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Fetching\x20parent\x20segment\x20details...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','folderId','SELECT\x20*\x20FROM\x20(\x0a','Show\x20folder\x20or\x20child\x20segment\x20details','site','Site:\x20','segment:folder:show','red','Resolving\x20parent\x20segment\x20\x27','3236436bZnekT','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','33418XeZwQd','name','in\x20','/e/','folderPath','content','cyan','segment:show','getSegmentSQL','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Parent\x20segment:\x20','parentId','green','Fetching\x20segment\x20details...','query','Use:\x20tdx\x20ps\x20show','(root)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','setJobId','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','error','format','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','json','replace','segment:folder:create','2667522svvsWC','resolveFolderId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','message','Resolved\x20type:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','execute','\x20\x20tdx\x20sg\x20sql\x20--path\x20','✖\x20Query\x20failed\x20[','Fetching\x20SQL\x20from\x20rule...','Create\x20segment\x20folder\x20for\x20organization','parentSegment','resolveParentId','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','getSQLFromServerSegment','description','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SQL\x20query:\x0a','getSegmentSQLFromYaml','jobId','Examples:','73820boSkTJ'];a36_0x5a7e=function(){return _0x65104f;};return a36_0x5a7e();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a36_0x132e25 from'chalk';async function resolveSegmentTarget(_0x436a48,_0x3c1073,_0x2509cb){const _0x54eebf=a36_0x2864;if(isYamlFilePath(_0x436a48))try{const _0x52172b=await resolveYamlFilePath(_0x436a48);return _0x2509cb&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x436a48),console[_0x54eebf(0xf9)](_0x54eebf(0x135)+_0x52172b['parentSegment']),console[_0x54eebf(0xf9)](_0x54eebf(0x13b)+_0x52172b[_0x54eebf(0x133)]),console['error'](_0x54eebf(0x144)+(_0x52172b[_0x54eebf(0xe8)]||_0x54eebf(0xf4))),console[_0x54eebf(0xf9)]('\x20\x20Full\x20path:\x20'+_0x52172b[_0x54eebf(0xc3)])),_0x52172b[_0x54eebf(0xc3)];}catch(_0x270b76){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x270b76['message']);}if(!_0x3c1073)throw new SDKError(ErrorCode[_0x54eebf(0x122)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x3c1073+'/'+_0x436a48;}export class SegmentDescribeCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0xb0);['description']='Show\x20segment\x20or\x20folder\x20details';async[a36_0x18f4a0(0x109)](_0x39e71e){const _0x11e119=a36_0x18f4a0,{options:_0x4401ca,args:_0x2cad44,tdx:_0x3f06c3}=_0x39e71e,_0x43a865=_0x2cad44[0x0],_0x16a07f=!_0x43a865&&!!_0x4401ca[_0x11e119(0x10e)],_0x121b3c=_0x43a865||_0x4401ca[_0x11e119(0x10e)];if(!_0x121b3c)return console[_0x11e119(0xf9)](_0x11e119(0xcd)),console['error'](_0x11e119(0x121)),console[_0x11e119(0xf9)](_0x11e119(0x117)),console[_0x11e119(0xf9)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x11e119(0xf9)](_0x11e119(0x106)),console[_0x11e119(0xf9)](_0x11e119(0x146)),console[_0x11e119(0xf9)](_0x11e119(0xd9)),0x1;try{const _0x207ee4=_0x4401ca['segmentPath'];let _0x408d03=_0x121b3c;!_0x16a07f&&_0x207ee4&&!_0x121b3c[_0x11e119(0xd1)]('/')&&(_0x408d03=_0x207ee4+'/'+_0x121b3c,_0x4401ca[_0x11e119(0x130)]&&console[_0x11e119(0xf9)](_0x11e119(0x12d)+_0x408d03));const _0x486cad=await withSpinner('Resolving\x20path\x20\x27'+_0x408d03+_0x11e119(0xb6),()=>_0x3f06c3[_0x11e119(0x148)][_0x11e119(0xd0)](_0x408d03),{'verbose':_0x4401ca[_0x11e119(0x130)]}),_0x13c9c5=_0x486cad[_0x11e119(0xc1)];_0x4401ca[_0x11e119(0x130)]&&(console['error'](_0x11e119(0x104)+_0x13c9c5[_0x11e119(0x129)]),console[_0x11e119(0xf9)](_0x11e119(0x149)+_0x13c9c5[_0x11e119(0xef)]),_0x13c9c5[_0x11e119(0xda)]&&console[_0x11e119(0xf9)](_0x11e119(0xca)+_0x13c9c5[_0x11e119(0xda)]),_0x13c9c5[_0x11e119(0x107)]&&console[_0x11e119(0xf9)](_0x11e119(0xd2)+_0x13c9c5[_0x11e119(0x107)]));if(_0x13c9c5[_0x11e119(0x129)]==='parent'){const _0x12251f=await withSpinner(_0x11e119(0xd8),()=>_0x3f06c3['segment']['getParent'](_0x13c9c5['parentId']),{'verbose':_0x4401ca[_0x11e119(0x130)]});await handleSingleObjectOutput(_0x12251f[_0x11e119(0xc1)],_0x4401ca);}else{if(_0x13c9c5[_0x11e119(0x129)]===_0x11e119(0x137)){if(!_0x13c9c5['folderId'])throw new SDKError(ErrorCode[_0x11e119(0xaf)],_0x11e119(0x12c));const _0x21c757=await withSpinner(_0x11e119(0x128),()=>_0x3f06c3[_0x11e119(0x148)][_0x11e119(0x125)](_0x13c9c5[_0x11e119(0xda)]),{'verbose':_0x4401ca[_0x11e119(0x130)]});await handleSingleObjectOutput(_0x21c757['data'],_0x4401ca);}else{if(_0x13c9c5[_0x11e119(0x129)]===_0x11e119(0x148)){if(!_0x13c9c5['segmentId'])throw new SDKError(ErrorCode[_0x11e119(0x127)],_0x11e119(0x134));const _0x219c0a=await withSpinner(_0x11e119(0xf1),()=>_0x3f06c3[_0x11e119(0x148)][_0x11e119(0xc9)](_0x13c9c5[_0x11e119(0xef)],_0x13c9c5[_0x11e119(0x107)]),{'verbose':_0x4401ca[_0x11e119(0x130)]});await handleSingleObjectOutput(_0x219c0a[_0x11e119(0xc1)],_0x4401ca);}}}return 0x0;}catch(_0x75f77f){if(_0x75f77f instanceof SDKError)return console[_0x11e119(0xf9)](_0x11e119(0x13a)+_0x75f77f[_0x11e119(0x103)]),_0x75f77f[_0x11e119(0xb1)]&&console['error'](_0x11e119(0x141)+_0x75f77f[_0x11e119(0xb1)]),0x1;throw _0x75f77f;}}}export class SegmentShowCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0xeb);[a36_0x18f4a0(0x112)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a36_0x18f4a0(0x109)](_0x30bb7b){const _0x35e415=a36_0x18f4a0,{options:_0xf15988,args:_0x27a779,tdx:_0x1cd92c}=_0x30bb7b,_0x143ab9=_0x27a779[0x0];if(!_0x143ab9)return console[_0x35e415(0xf9)](_0x35e415(0x12a)),console[_0x35e415(0xf9)](_0x35e415(0x105)),console[_0x35e415(0xf9)](_0x35e415(0x13d)),console['error']('Examples:'),console[_0x35e415(0xf9)](_0x35e415(0xe3)),console[_0x35e415(0xf9)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x523189=_0xf15988[_0x35e415(0x10e)],_0x356282=await resolveSegmentTarget(_0x143ab9,_0x523189,_0xf15988['verbose']);_0xf15988[_0x35e415(0x130)]&&console[_0x35e415(0xf9)](_0x35e415(0xb5)+_0x356282);const _0x2582c1=await withSpinner(_0x35e415(0xd4)+_0x143ab9+_0x35e415(0xb6),()=>_0x1cd92c[_0x35e415(0x148)][_0x35e415(0xd0)](_0x356282),{'verbose':_0xf15988[_0x35e415(0x130)]}),_0x421e54=_0x2582c1['data'];_0xf15988[_0x35e415(0x130)]&&(console[_0x35e415(0xf9)](_0x35e415(0x104)+_0x421e54[_0x35e415(0x129)]),console[_0x35e415(0xf9)]('Parent\x20ID:\x20'+_0x421e54[_0x35e415(0xef)]));if(_0x421e54[_0x35e415(0x129)]===_0x35e415(0x137))return console['error'](_0x35e415(0xd5)),console[_0x35e415(0xf9)](_0x35e415(0x13e)),0x1;if(_0x421e54[_0x35e415(0x129)]==='parent')return console[_0x35e415(0xf9)](_0x35e415(0xb3)),console['error'](_0x35e415(0xf3)),0x1;if(!_0x421e54['segmentId'])throw new SDKError(ErrorCode[_0x35e415(0x127)],_0x35e415(0x134));const _0x3c5fa9=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1cd92c[_0x35e415(0x148)][_0x35e415(0xec)](_0x421e54[_0x35e415(0xef)],_0x421e54[_0x35e415(0x107)]),{'verbose':_0xf15988[_0x35e415(0x130)]});let _0x431702=_0x3c5fa9['data'];const _0x5ac853=resolveLimit(_0xf15988['limit'],DEFAULT_DISPLAY_LIMIT),_0x376164=/\bLIMIT\s+\d+/i['test'](_0x431702);!_0x376164&&(_0x431702=_0x431702[_0x35e415(0x12f)]()[_0x35e415(0xfe)](/;+$/,''),_0x431702=_0x35e415(0xdb)+_0x431702+_0x35e415(0xcb)+_0x5ac853);_0xf15988[_0x35e415(0x130)]&&console[_0x35e415(0xf9)](_0x35e415(0x114)+_0x431702);const _0x2fd34f=await withProgressSpinner('Executing\x20segment\x20query...',async _0x1367f2=>{const _0x5acae3=_0x35e415,_0x16986b=await _0x1cd92c[_0x5acae3(0xf2)]['execute'](_0x431702,{'catalog':'td','schema':_0x5acae3(0xb4),'onJobId':_0x46d8d1=>{const _0x221159=_0x5acae3;_0x1367f2[_0x221159(0xf7)](_0x46d8d1);}});return _0x16986b;},{'verbose':_0xf15988[_0x35e415(0x130)]}),_0x427275=_0x2fd34f[_0x35e415(0xc1)],_0x29725b=_0x427275[_0x35e415(0x116)]?_0x35e415(0x120)+_0x427275[_0x35e415(0x116)]+']':'';return console[_0x35e415(0xf9)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x427275[_0x35e415(0xbb)][_0x35e415(0xb9)][_0x35e415(0xb8)]()+'\x20rows\x20'+(_0x35e415(0xe6)+formatElapsed(_0x427275[_0x35e415(0xbb)][_0x35e415(0xd6)])+_0x29725b)),await handleQueryOutput(_0x427275,_0xf15988),0x0;}catch(_0x1a846b){if(_0x1a846b instanceof SDKError)return console['error'](_0x35e415(0x10b)+_0x1a846b['code']+']'),console['error']('\x0a'+_0x1a846b[_0x35e415(0x103)]),0x1;throw _0x1a846b;}}}export class SegmentFolderListCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]='segment:folder:list';[a36_0x18f4a0(0x112)]=a36_0x18f4a0(0xce);async[a36_0x18f4a0(0x109)](_0x231b01){const _0x37dba8=a36_0x18f4a0,{options:_0x5d86b2,args:_0x24d903,tdx:_0x7d02db}=_0x231b01;if(_0x24d903[_0x37dba8(0xc7)]===0x0)return console[_0x37dba8(0xf9)](_0x37dba8(0x143)),console[_0x37dba8(0xf9)](_0x37dba8(0x113)),0x1;const _0x2a745c=_0x24d903[0x0];try{_0x5d86b2['verbose']&&(console['error'](_0x37dba8(0xde)+_0x5d86b2['site']),console['error']('Parent\x20name:\x20'+_0x2a745c));const _0x12c297=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2a745c+_0x37dba8(0xb6),()=>_0x7d02db[_0x37dba8(0x148)][_0x37dba8(0x10f)](_0x2a745c),{'verbose':_0x5d86b2[_0x37dba8(0x130)]}),_0x3d9cba=_0x12c297['data'];_0x5d86b2[_0x37dba8(0x130)]&&console[_0x37dba8(0xf9)]('Resolved\x20parent\x20ID:\x20'+_0x3d9cba);const _0x29a77b=await withSpinner(_0x37dba8(0xb2)+_0x2a745c+_0x37dba8(0xb6),()=>_0x7d02db[_0x37dba8(0x148)][_0x37dba8(0x13c)](_0x3d9cba),{'verbose':_0x5d86b2[_0x37dba8(0x130)]}),_0x10fbd3=_0x29a77b[_0x37dba8(0xc1)];return console['error']('✔\x20Found\x20'+_0x10fbd3[_0x37dba8(0xc7)]+_0x37dba8(0x138)+(_0x10fbd3[_0x37dba8(0xc7)]!==0x1?'s':'')),await handleSDKOutput(_0x10fbd3,_0x5d86b2),0x0;}catch(_0x4551b5){if(_0x4551b5 instanceof SDKError)return console[_0x37dba8(0xf9)](_0x37dba8(0x13a)+_0x4551b5[_0x37dba8(0x103)]),_0x4551b5[_0x37dba8(0xb1)]&&console[_0x37dba8(0xf9)](_0x37dba8(0x141)+_0x4551b5[_0x37dba8(0xb1)]),0x1;throw _0x4551b5;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0xdf);[a36_0x18f4a0(0x112)]='Show\x20segment\x20folder\x20details';async[a36_0x18f4a0(0x109)](_0x5edaed){const _0x501f8b=a36_0x18f4a0,{options:_0x48255a,args:_0x4ff787,tdx:_0x8844d}=_0x5edaed;if(_0x4ff787['length']===0x0)return console['error'](_0x501f8b(0xbd)),console['error'](_0x501f8b(0x140)),0x1;try{const {parentId:_0x2e5535,childId:_0x20c966}=parseSegmentRef(_0x4ff787[0x0]);_0x48255a[_0x501f8b(0x130)]&&(console['error'](_0x501f8b(0xde)+_0x48255a['site']),console[_0x501f8b(0xf9)](_0x501f8b(0xc4)+_0x2e5535),_0x20c966&&console[_0x501f8b(0xf9)](_0x501f8b(0x11e)+_0x20c966));if(!_0x20c966)return console[_0x501f8b(0xf9)](_0x501f8b(0xcf)),0x1;const _0x8e55f6=await withSpinner(_0x501f8b(0xe1)+_0x2e5535+'\x27...',()=>_0x8844d[_0x501f8b(0x148)][_0x501f8b(0x10f)](_0x2e5535),{'verbose':_0x48255a['verbose']}),_0x4f2b91=_0x8e55f6[_0x501f8b(0xc1)];_0x48255a[_0x501f8b(0x130)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x4f2b91);const _0x104434=await withSpinner(_0x501f8b(0x11f)+_0x20c966+'\x27...',()=>_0x8844d['segment'][_0x501f8b(0x101)](_0x4f2b91,_0x20c966),{'verbose':_0x48255a['verbose']}),_0x34dd4d=_0x104434[_0x501f8b(0xc1)];_0x48255a[_0x501f8b(0x130)]&&console[_0x501f8b(0xf9)]('Resolved\x20folder\x20ID:\x20'+_0x34dd4d);const _0x4d3b50=await withSpinner('Fetching\x20folder\x20\x27'+_0x20c966+_0x501f8b(0xb6),()=>_0x8844d[_0x501f8b(0x148)][_0x501f8b(0x125)](_0x34dd4d),{'verbose':_0x48255a[_0x501f8b(0x130)]});return await handleSDKOutput([_0x4d3b50['data']],_0x48255a),0x0;}catch(_0x3dd390){if(_0x3dd390 instanceof SDKError)return console[_0x501f8b(0xf9)](_0x501f8b(0x13a)+_0x3dd390[_0x501f8b(0x103)]),_0x3dd390['cause']&&console['error'](_0x501f8b(0x141)+_0x3dd390[_0x501f8b(0xb1)]),0x1;throw _0x3dd390;}}}export class SegmentSQLCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0xba);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x2ff0af){const _0x18194c=a36_0x18f4a0,{options:_0x3c4a4d,args:_0x310e26}=_0x2ff0af,_0x289100=_0x3c4a4d,_0x9e5750=_0x289100['path'],_0x48b214=_0x310e26[0x0];if(!_0x48b214&&!_0x9e5750)return console['error'](a36_0x132e25['red']('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x18194c(0xf9)](_0x18194c(0xbf)),console[_0x18194c(0xf9)](_0x18194c(0xfc)),console[_0x18194c(0xf9)](_0x18194c(0x110)),console[_0x18194c(0xf9)]('Examples:'),console[_0x18194c(0xf9)](_0x18194c(0xf8)),console['error'](_0x18194c(0xbc)),0x1;if(_0x48b214&&_0x9e5750)return console[_0x18194c(0xf9)](a36_0x132e25[_0x18194c(0xe0)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x1a3cc9;if(_0x9e5750)_0x1a3cc9=await this[_0x18194c(0xcc)](_0x9e5750,_0x2ff0af);else{if(isYamlFilePath(_0x48b214))return console[_0x18194c(0xf9)](a36_0x132e25[_0x18194c(0xe0)](_0x18194c(0x131))),console[_0x18194c(0xf9)](_0x18194c(0x10a)+_0x48b214),0x1;else _0x1a3cc9=await this['getSQLFromServerSegment'](_0x48b214,_0x2ff0af);}return _0x3c4a4d[_0x18194c(0xfa)]===_0x18194c(0xfd)||_0x3c4a4d['format']==='jsonl'?await handleSDKOutput([{'sql':_0x1a3cc9}],_0x3c4a4d):console[_0x18194c(0xc2)](_0x1a3cc9),0x0;}catch(_0x3767a0){if(_0x3767a0 instanceof SDKError)return console[_0x18194c(0xf9)](_0x18194c(0x13a)+_0x3767a0[_0x18194c(0x103)]),_0x3767a0[_0x18194c(0xb1)]&&console['error']('\x20\x20Cause:\x20'+_0x3767a0[_0x18194c(0xb1)]),0x1;throw _0x3767a0;}}async[a36_0x18f4a0(0xcc)](_0xbfa5e7,_0x5893de){const _0x592ab4=a36_0x18f4a0,{options:_0x122b1a,tdx:_0x23056a}=_0x5893de;let _0x4e9b44;try{_0x4e9b44=await resolveYamlFilePath(_0xbfa5e7);}catch(_0xa58db2){throw new SDKError(ErrorCode[_0x592ab4(0x122)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xa58db2[_0x592ab4(0x103)]);}_0x122b1a[_0x592ab4(0x130)]&&console[_0x592ab4(0xf9)](_0x592ab4(0x11b)+_0x4e9b44[_0x592ab4(0x10e)]+'/'+_0x4e9b44['segmentName']);const _0x1ececc=await withSpinner(_0x592ab4(0x10c),()=>_0x23056a[_0x592ab4(0x148)][_0x592ab4(0x115)](_0x4e9b44[_0x592ab4(0xe9)],_0x4e9b44['parentSegment'],_0x4e9b44[_0x592ab4(0x133)]),{'verbose':_0x122b1a[_0x592ab4(0x130)]});return _0x1ececc[_0x592ab4(0xc1)];}async[a36_0x18f4a0(0x111)](_0x341c41,_0x1b88f5){const _0xd3c273=a36_0x18f4a0,{options:_0x407c3e,tdx:_0x33de31}=_0x1b88f5,_0x3daf87=_0x407c3e[_0xd3c273(0x10e)],_0x2170a9=await resolveSegmentTarget(_0x341c41,_0x3daf87,_0x407c3e['verbose']);_0x407c3e[_0xd3c273(0x130)]&&console[_0xd3c273(0xf9)](_0xd3c273(0xb5)+_0x2170a9);const _0x2f2540=await withSpinner(_0xd3c273(0xd4)+_0x341c41+_0xd3c273(0xb6),()=>_0x33de31[_0xd3c273(0x148)][_0xd3c273(0xd0)](_0x2170a9),{'verbose':_0x407c3e[_0xd3c273(0x130)]}),_0x4e9114=_0x2f2540[_0xd3c273(0xc1)];_0x407c3e[_0xd3c273(0x130)]&&(console['error'](_0xd3c273(0x104)+_0x4e9114[_0xd3c273(0x129)]),console[_0xd3c273(0xf9)](_0xd3c273(0x149)+_0x4e9114[_0xd3c273(0xef)]));if(_0x4e9114[_0xd3c273(0x129)]===_0xd3c273(0x137))throw new SDKError(ErrorCode[_0xd3c273(0x122)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x4e9114[_0xd3c273(0x129)]===_0xd3c273(0xd3))throw new SDKError(ErrorCode[_0xd3c273(0x122)],_0xd3c273(0x12e));if(!_0x4e9114[_0xd3c273(0x107)])throw new SDKError(ErrorCode[_0xd3c273(0x127)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3db9e9=await withSpinner(_0xd3c273(0x11d),()=>_0x33de31[_0xd3c273(0x148)][_0xd3c273(0xec)](_0x4e9114[_0xd3c273(0xef)],_0x4e9114[_0xd3c273(0x107)]),{'verbose':_0x407c3e['verbose']});return _0x3db9e9[_0xd3c273(0xc1)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0xff);[a36_0x18f4a0(0x112)]=a36_0x18f4a0(0x10d);async[a36_0x18f4a0(0x109)](_0x229291){const _0x1c167a=a36_0x18f4a0,{options:_0x292551,args:_0x284ab1,tdx:_0x21024a}=_0x229291,_0x482ba6=_0x292551;if(_0x284ab1[_0x1c167a(0xc7)]<0x2)return console[_0x1c167a(0xf9)](_0x1c167a(0xd7)),console['error'](_0x1c167a(0x108)),0x1;const _0x822cf4=_0x284ab1[0x0],_0x4d1f29=_0x284ab1[0x1];_0x482ba6[_0x1c167a(0x130)]&&(console[_0x1c167a(0xf9)]('Site:\x20'+_0x482ba6['site']),console[_0x1c167a(0xf9)](_0x1c167a(0xee)+_0x822cf4),console['error'](_0x1c167a(0x11e)+_0x4d1f29));let _0x1b8076;if(_0x482ba6[_0x1c167a(0x11c)]){const _0x202807=_0x482ba6[_0x1c167a(0x11c)],_0x37f24a=await withSpinner(_0x1c167a(0xe1)+_0x822cf4+_0x1c167a(0xb6),()=>_0x21024a['segment'][_0x1c167a(0x10f)](_0x822cf4),{'verbose':_0x482ba6[_0x1c167a(0x130)]}),_0x25398a=_0x37f24a[_0x1c167a(0xc1)],_0x5c7b51=await withSpinner(_0x1c167a(0x13f)+_0x202807+_0x1c167a(0xb6),()=>_0x21024a['segment'][_0x1c167a(0x101)](_0x25398a,_0x202807),{'verbose':_0x482ba6[_0x1c167a(0x130)]});_0x1b8076=_0x5c7b51[_0x1c167a(0xc1)],_0x482ba6[_0x1c167a(0x130)]&&console[_0x1c167a(0xf9)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x1b8076);}const _0x5d22b5={'name':_0x4d1f29,'description':_0x482ba6[_0x1c167a(0x112)],'parentFolderId':_0x1b8076},_0xac5f6d=await withSpinner(_0x1c167a(0x12b)+_0x4d1f29+'\x27...',()=>_0x21024a[_0x1c167a(0x148)][_0x1c167a(0xbe)](_0x822cf4,_0x5d22b5),{'verbose':_0x482ba6[_0x1c167a(0x130)]}),_0x5eaa62=_0xac5f6d['data'];return console['error'](_0x1c167a(0x11a)+_0x5eaa62['name']+'\x27\x20with\x20ID:\x20'+_0x5eaa62['id']),await handleSDKOutput([_0x5eaa62],_0x482ba6),0x0;}}export class SegmentViewCommand extends BaseCommand{[a36_0x18f4a0(0xe5)]=a36_0x18f4a0(0x142);[a36_0x18f4a0(0x112)]=a36_0x18f4a0(0xdc);async[a36_0x18f4a0(0x109)](_0x32eb3b){const _0x23674a=a36_0x18f4a0,{options:_0x3af976,args:_0x33773a,tdx:_0x5f11fb}=_0x32eb3b,_0x153c5c=_0x33773a[0x0];if(!_0x153c5c)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x23674a(0xf9)](_0x23674a(0x124)),console['error'](_0x23674a(0xf5)),console[_0x23674a(0xf9)]('Options:'),console[_0x23674a(0xf9)](_0x23674a(0x139)),console[_0x23674a(0xf9)](_0x23674a(0x117)),console[_0x23674a(0xf9)](_0x23674a(0xc6)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x23674a(0xf9)](_0x23674a(0xed)),console[_0x23674a(0xf9)](_0x23674a(0x123)),0x1;try{const _0x1f044c=_0x3af976[_0x23674a(0x10e)],_0x37aa8e=await resolveSegmentTarget(_0x153c5c,_0x1f044c,_0x3af976[_0x23674a(0x130)]);_0x3af976[_0x23674a(0x130)]&&console[_0x23674a(0xf9)]('Target\x20path:\x20'+_0x37aa8e);const _0x2c32e5=await withSpinner(_0x23674a(0xd4)+_0x153c5c+_0x23674a(0xb6),()=>_0x5f11fb[_0x23674a(0x148)][_0x23674a(0xd0)](_0x37aa8e),{'verbose':_0x3af976[_0x23674a(0x130)]}),_0x5dfb6e=_0x2c32e5[_0x23674a(0xc1)];_0x3af976[_0x23674a(0x130)]&&(console[_0x23674a(0xf9)](_0x23674a(0x104)+_0x5dfb6e['type']),console[_0x23674a(0xf9)](_0x23674a(0x149)+_0x5dfb6e[_0x23674a(0xef)]),_0x5dfb6e['folderId']&&console[_0x23674a(0xf9)](_0x23674a(0xca)+_0x5dfb6e[_0x23674a(0xda)]),_0x5dfb6e[_0x23674a(0x107)]&&console[_0x23674a(0xf9)]('Segment\x20ID:\x20'+_0x5dfb6e[_0x23674a(0x107)]));if(_0x3af976['web']){if(_0x5dfb6e[_0x23674a(0x129)]===_0x23674a(0x137))return console[_0x23674a(0xf9)](_0x23674a(0xfb)),0x1;if(_0x5dfb6e['type']===_0x23674a(0xd3))return console[_0x23674a(0xf9)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x23674a(0xf9)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x5dfb6e['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x23674a(0x134));const _0x45c0c8=getConsoleNextUrl(_0x3af976[_0x23674a(0xdd)],_0x23674a(0x147)+_0x5dfb6e[_0x23674a(0xef)]+'/e/'+_0x5dfb6e['segmentId']);return console[_0x23674a(0xf9)](a36_0x132e25[_0x23674a(0xf0)]('✔')+_0x23674a(0x136)+a36_0x132e25[_0x23674a(0xea)](_0x45c0c8)),openBrowser(_0x45c0c8),0x0;}if(_0x5dfb6e[_0x23674a(0x129)]===_0x23674a(0x137)){if(!_0x5dfb6e[_0x23674a(0xda)])throw new SDKError(ErrorCode[_0x23674a(0xaf)],_0x23674a(0x12c));const _0x1308d2=await withSpinner(_0x23674a(0x128),()=>_0x5f11fb[_0x23674a(0x148)][_0x23674a(0x125)](_0x5dfb6e[_0x23674a(0xda)]),{'verbose':_0x3af976[_0x23674a(0x130)]});await handleSingleObjectOutput(_0x1308d2[_0x23674a(0xc1)],_0x3af976);}else{if(_0x5dfb6e[_0x23674a(0x129)]===_0x23674a(0x148)){if(!_0x5dfb6e['segmentId'])throw new SDKError(ErrorCode[_0x23674a(0x127)],_0x23674a(0x134));const _0x4ecac9=await withSpinner(_0x23674a(0xf1),()=>_0x5f11fb[_0x23674a(0x148)][_0x23674a(0xc9)](_0x5dfb6e[_0x23674a(0xef)],_0x5dfb6e['segmentId']),{'verbose':_0x3af976['verbose']}),_0x19c60d=getConsoleNextUrl(_0x3af976[_0x23674a(0xdd)],_0x23674a(0x147)+_0x5dfb6e[_0x23674a(0xef)]+_0x23674a(0xe7)+_0x5dfb6e[_0x23674a(0x107)]),_0x417284=_0x4ecac9[_0x23674a(0xc1)];_0x417284['url']=_0x19c60d,await handleSingleObjectOutput(_0x417284,_0x3af976);}else return console[_0x23674a(0xf9)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x23674a(0xf9)](_0x23674a(0x132)),0x1;}return 0x0;}catch(_0x22fe86){if(_0x22fe86 instanceof SDKError)return console['error'](_0x23674a(0x13a)+_0x22fe86[_0x23674a(0x103)]),_0x22fe86[_0x23674a(0xb1)]&&console[_0x23674a(0xf9)](_0x23674a(0x141)+_0x22fe86[_0x23674a(0xb1)]),0x1;throw _0x22fe86;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';[a36_0x18f4a0(0x112)]=a36_0x18f4a0(0xc0);async[a36_0x18f4a0(0x109)](_0x4a78d7){const _0x1bee4a=a36_0x18f4a0,{options:_0x25daaa,args:_0x39b5ab,tdx:_0x25697a}=_0x4a78d7,_0x21e966=_0x39b5ab[0x0];if(!_0x21e966)return console['error'](_0x1bee4a(0x12a)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x1bee4a(0xf9)](_0x1bee4a(0xf6)),console[_0x1bee4a(0xf9)](_0x1bee4a(0x117)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1bee4a(0xf9)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3e354b=_0x25daaa[_0x1bee4a(0x10e)],_0x582ad6=await resolveSegmentTarget(_0x21e966,_0x3e354b,_0x25daaa[_0x1bee4a(0x130)]);_0x25daaa[_0x1bee4a(0x130)]&&console['error'](_0x1bee4a(0xb5)+_0x582ad6);const _0x18b7a2=await withSpinner(_0x1bee4a(0xd4)+_0x21e966+_0x1bee4a(0xb6),()=>_0x25697a['segment'][_0x1bee4a(0xd0)](_0x582ad6),{'verbose':_0x25daaa[_0x1bee4a(0x130)]}),_0x303c03=_0x18b7a2['data'];_0x25daaa['verbose']&&(console[_0x1bee4a(0xf9)](_0x1bee4a(0x104)+_0x303c03['type']),console[_0x1bee4a(0xf9)](_0x1bee4a(0x149)+_0x303c03[_0x1bee4a(0xef)]));if(_0x303c03[_0x1bee4a(0x129)]===_0x1bee4a(0x137))return console[_0x1bee4a(0xf9)](_0x1bee4a(0x102)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x303c03[_0x1bee4a(0x129)]==='parent')return console[_0x1bee4a(0xf9)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x1bee4a(0xc8)),0x1;if(!_0x303c03[_0x1bee4a(0x107)])throw new SDKError(ErrorCode[_0x1bee4a(0x127)],_0x1bee4a(0x134));const _0x4c4600=await withSpinner(_0x1bee4a(0x11d),()=>_0x25697a[_0x1bee4a(0x148)][_0x1bee4a(0xec)](_0x303c03['parentId'],_0x303c03['segmentId']),{'verbose':_0x25daaa[_0x1bee4a(0x130)]}),_0x1ee504=_0x4c4600['data'],_0x284007=await executeSchemaQuery(_0x1ee504,_0x25697a,_0x25daaa);return await handleQueryOutput(_0x284007,_0x25daaa),0x0;}catch(_0x4144c1){if(_0x4144c1 instanceof SDKError)return console['error'](_0x1bee4a(0x13a)+_0x4144c1[_0x1bee4a(0x103)]),_0x4144c1['cause']&&console[_0x1bee4a(0xf9)](_0x1bee4a(0x141)+_0x4144c1[_0x1bee4a(0xb1)]),0x1;throw _0x4144c1;}}}
|
|
1
|
+
const a38_0x26d544=a38_0x4ffa;(function(_0x5a0dd5,_0x21b3a8){const _0x3f38a7=a38_0x4ffa,_0x20a5e3=_0x5a0dd5();while(!![]){try{const _0x3b485b=-parseInt(_0x3f38a7(0x183))/0x1+parseInt(_0x3f38a7(0x19b))/0x2+parseInt(_0x3f38a7(0x1db))/0x3*(-parseInt(_0x3f38a7(0x1a2))/0x4)+parseInt(_0x3f38a7(0x1cb))/0x5*(parseInt(_0x3f38a7(0x1af))/0x6)+parseInt(_0x3f38a7(0x1f9))/0x7*(-parseInt(_0x3f38a7(0x1a3))/0x8)+parseInt(_0x3f38a7(0x18c))/0x9*(-parseInt(_0x3f38a7(0x175))/0xa)+parseInt(_0x3f38a7(0x1aa))/0xb;if(_0x3b485b===_0x21b3a8)break;else _0x20a5e3['push'](_0x20a5e3['shift']());}catch(_0x18aa6f){_0x20a5e3['push'](_0x20a5e3['shift']());}}}(a38_0x3bc5,0xbe892));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x1b27b4 from'chalk';async function resolveSegmentTarget(_0x1d36e5,_0x199e34,_0x3b4a7e){const _0x11a57b=a38_0x4ffa;if(isYamlFilePath(_0x1d36e5))try{const _0x5b1b49=await resolveYamlFilePath(_0x1d36e5);return _0x3b4a7e&&(console[_0x11a57b(0x1c9)](_0x11a57b(0x1fb)+_0x1d36e5),console[_0x11a57b(0x1c9)](_0x11a57b(0x1e3)+_0x5b1b49[_0x11a57b(0x187)]),console[_0x11a57b(0x1c9)](_0x11a57b(0x19f)+_0x5b1b49['segmentName']),console[_0x11a57b(0x1c9)](_0x11a57b(0x203)+(_0x5b1b49[_0x11a57b(0x1cc)]||_0x11a57b(0x1b7))),console[_0x11a57b(0x1c9)](_0x11a57b(0x1b0)+_0x5b1b49[_0x11a57b(0x1a4)])),_0x5b1b49[_0x11a57b(0x1a4)];}catch(_0x2bf318){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x11a57b(0x20c)+_0x2bf318[_0x11a57b(0x1c3)]);}if(!_0x199e34)throw new SDKError(ErrorCode[_0x11a57b(0x201)],_0x11a57b(0x17b));return _0x199e34+'/'+_0x1d36e5;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x26d544(0x1f8)]=a38_0x26d544(0x1e5);[a38_0x26d544(0x18a)]=a38_0x26d544(0x1bd);async[a38_0x26d544(0x1a8)](_0x49bb4e){const _0x49f860=a38_0x26d544,{options:_0x1a389f,args:_0x58b104,tdx:_0x59a9c9}=_0x49bb4e,_0x178181=_0x58b104[0x0],_0x4c6f0c=!_0x178181&&!!_0x1a389f[_0x49f860(0x187)],_0x5c2e0e=_0x178181||_0x1a389f[_0x49f860(0x187)];if(!_0x5c2e0e)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x49f860(0x1c9)](_0x49f860(0x1d6)),console[_0x49f860(0x1c9)](_0x49f860(0x170)),console[_0x49f860(0x1c9)](_0x49f860(0x18f)),console[_0x49f860(0x1c9)](_0x49f860(0x1c5)),console[_0x49f860(0x1c9)](_0x49f860(0x1c7)),console[_0x49f860(0x1c9)](_0x49f860(0x1b6)),0x1;try{const _0x3cd2a1=_0x1a389f[_0x49f860(0x172)];let _0x4bc486=_0x5c2e0e;!_0x4c6f0c&&_0x3cd2a1&&!_0x5c2e0e['includes']('/')&&(_0x4bc486=_0x3cd2a1+'/'+_0x5c2e0e,_0x1a389f[_0x49f860(0x1d7)]&&console[_0x49f860(0x1c9)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4bc486));const _0x83ad0=await withSpinner(_0x49f860(0x1b5)+_0x4bc486+_0x49f860(0x192),()=>_0x59a9c9['segment']['resolvePathToResource'](_0x4bc486),{'verbose':_0x1a389f[_0x49f860(0x1d7)]}),_0x5f1db0=_0x83ad0[_0x49f860(0x20a)];_0x1a389f[_0x49f860(0x1d7)]&&(console[_0x49f860(0x1c9)]('Resolved\x20type:\x20'+_0x5f1db0['type']),console[_0x49f860(0x1c9)](_0x49f860(0x207)+_0x5f1db0['parentId']),_0x5f1db0[_0x49f860(0x1d5)]&&console['error'](_0x49f860(0x1ae)+_0x5f1db0['folderId']),_0x5f1db0[_0x49f860(0x1c4)]&&console[_0x49f860(0x1c9)](_0x49f860(0x1f2)+_0x5f1db0[_0x49f860(0x1c4)]));if(_0x5f1db0['type']===_0x49f860(0x1ad)){const _0x52c9df=await withSpinner(_0x49f860(0x20f),()=>_0x59a9c9[_0x49f860(0x1a7)]['getParent'](_0x5f1db0[_0x49f860(0x17e)]),{'verbose':_0x1a389f[_0x49f860(0x1d7)]});await handleSingleObjectOutput(_0x52c9df[_0x49f860(0x20a)],_0x1a389f);}else{if(_0x5f1db0[_0x49f860(0x184)]===_0x49f860(0x1cf)){if(!_0x5f1db0[_0x49f860(0x1d5)])throw new SDKError(ErrorCode[_0x49f860(0x208)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3c9265=await withSpinner('Fetching\x20folder\x20details...',()=>_0x59a9c9[_0x49f860(0x1a7)][_0x49f860(0x1b8)](_0x5f1db0['folderId']),{'verbose':_0x1a389f[_0x49f860(0x1d7)]});await handleSingleObjectOutput(_0x3c9265['data'],_0x1a389f);}else{if(_0x5f1db0[_0x49f860(0x184)]===_0x49f860(0x1a7)){if(!_0x5f1db0[_0x49f860(0x1c4)])throw new SDKError(ErrorCode[_0x49f860(0x1dd)],_0x49f860(0x202));const _0x2b441d=await withSpinner('Fetching\x20segment\x20details...',()=>_0x59a9c9['segment'][_0x49f860(0x1e8)](_0x5f1db0[_0x49f860(0x17e)],_0x5f1db0[_0x49f860(0x1c4)]),{'verbose':_0x1a389f[_0x49f860(0x1d7)]});await handleSingleObjectOutput(_0x2b441d['data'],_0x1a389f);}}}return 0x0;}catch(_0x3c0c4f){if(_0x3c0c4f instanceof SDKError)return console[_0x49f860(0x1c9)](_0x49f860(0x1eb)+_0x3c0c4f[_0x49f860(0x1c3)]),_0x3c0c4f['cause']&&console[_0x49f860(0x1c9)]('\x20\x20Cause:\x20'+_0x3c0c4f[_0x49f860(0x171)]),0x1;throw _0x3c0c4f;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x26d544(0x1f8)]='segment:show';['description']=a38_0x26d544(0x1e6);async['execute'](_0x4869c7){const _0x1e15e3=a38_0x26d544,{options:_0x319fc4,args:_0x1813cd,tdx:_0x1d2e4c}=_0x4869c7,_0x13df8b=_0x1813cd[0x0];if(!_0x13df8b)return console[_0x1e15e3(0x1c9)](_0x1e15e3(0x1c8)),console[_0x1e15e3(0x1c9)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console['error'](_0x1e15e3(0x170)),console[_0x1e15e3(0x1c9)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x1e15e3(0x1c9)](_0x1e15e3(0x173)),0x1;try{const _0x22a199=_0x319fc4['parentSegment'],_0x1e7c16=await resolveSegmentTarget(_0x13df8b,_0x22a199,_0x319fc4[_0x1e15e3(0x1d7)]);_0x319fc4[_0x1e15e3(0x1d7)]&&console[_0x1e15e3(0x1c9)](_0x1e15e3(0x1d4)+_0x1e7c16);const _0xf4e477=await withSpinner(_0x1e15e3(0x1ca)+_0x13df8b+_0x1e15e3(0x192),()=>_0x1d2e4c[_0x1e15e3(0x1a7)]['resolvePathToResource'](_0x1e7c16),{'verbose':_0x319fc4[_0x1e15e3(0x1d7)]}),_0x15bbfc=_0xf4e477[_0x1e15e3(0x20a)];_0x319fc4['verbose']&&(console[_0x1e15e3(0x1c9)](_0x1e15e3(0x18e)+_0x15bbfc[_0x1e15e3(0x184)]),console['error'](_0x1e15e3(0x207)+_0x15bbfc[_0x1e15e3(0x17e)]));if(_0x15bbfc['type']===_0x1e15e3(0x1cf))return console[_0x1e15e3(0x1c9)](_0x1e15e3(0x188)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x15bbfc[_0x1e15e3(0x184)]===_0x1e15e3(0x1ad))return console['error'](_0x1e15e3(0x206)),console[_0x1e15e3(0x1c9)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x15bbfc[_0x1e15e3(0x1c4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3e62e7=await withSpinner(_0x1e15e3(0x1a9),()=>_0x1d2e4c[_0x1e15e3(0x1a7)][_0x1e15e3(0x1f0)](_0x15bbfc[_0x1e15e3(0x17e)],_0x15bbfc['segmentId']),{'verbose':_0x319fc4[_0x1e15e3(0x1d7)]});let _0x3c9eb0=_0x3e62e7['data'];const _0x21c450=resolveLimit(_0x319fc4[_0x1e15e3(0x1fc)],DEFAULT_DISPLAY_LIMIT),_0xcb4f31=/\bLIMIT\s+\d+/i[_0x1e15e3(0x211)](_0x3c9eb0);!_0xcb4f31&&(_0x3c9eb0=_0x3c9eb0[_0x1e15e3(0x1df)]()[_0x1e15e3(0x215)](/;+$/,''),_0x3c9eb0=_0x1e15e3(0x1bb)+_0x3c9eb0+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x21c450);_0x319fc4['verbose']&&console[_0x1e15e3(0x1c9)](_0x1e15e3(0x178)+_0x3c9eb0);const _0x2b18ef=await withProgressSpinner(_0x1e15e3(0x191),async _0x32a665=>{const _0xdda85e=_0x1e15e3,_0x19adfb=await _0x1d2e4c[_0xdda85e(0x205)]['execute'](_0x3c9eb0,{'catalog':'td','schema':_0xdda85e(0x210),'onJobId':_0x8b6bbe=>{const _0x7dadc1=_0xdda85e;_0x32a665[_0x7dadc1(0x17d)](_0x8b6bbe);}});return _0x19adfb;},{'verbose':_0x319fc4[_0x1e15e3(0x1d7)]}),_0x1b6573=_0x2b18ef[_0x1e15e3(0x20a)],_0x2e6eff=_0x1b6573[_0x1e15e3(0x1da)]?_0x1e15e3(0x20e)+_0x1b6573[_0x1e15e3(0x1da)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x1b6573['stats']['processedRows'][_0x1e15e3(0x1fe)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x1b6573[_0x1e15e3(0x1f5)][_0x1e15e3(0x1cd)])+_0x2e6eff)),await handleQueryOutput(_0x1b6573,_0x319fc4),0x0;}catch(_0x4854a7){if(_0x4854a7 instanceof SDKError)return console['error']('✖\x20Query\x20failed\x20['+_0x4854a7[_0x1e15e3(0x199)]+']'),console['error']('\x0a'+_0x4854a7[_0x1e15e3(0x1c3)]),0x1;throw _0x4854a7;}}}function a38_0x3bc5(){const _0x5ce528=['Examples:','cause','segmentPath','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Creating\x20folder\x20\x27','20THAMhN','cyan','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20folder','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Listing\x20folders\x20for\x20parent\x20\x27','setJobId','parentId','parentFolder','Get\x20SQL\x20query\x20for\x20child\x20segment','Parent\x20segment:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','1171867nRprjt','type','web','segment:folder:create','parentSegment','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','green','description','Fetching\x20folder\x20\x27','4174074JHYdZN','log','Resolved\x20type:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Fetching\x20SQL\x20from\x20rule...','Executing\x20segment\x20query...','\x27...','Folder\x20name:\x20','resolvePathToResource','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','code','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','2044036ItSBtl','Show\x20folder\x20or\x20child\x20segment\x20details','resolveFolderId','\x27\x20with\x20ID:\x20','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolving\x20parent\x20folder\x20\x27','677272kdYnKw','8XFAnRz','fullPath','length','jsonl','segment','execute','Fetching\x20SQL\x20for\x20segment...','24449513kPcvee','Usage:','Show\x20segment\x20folder\x20details','parent','Folder\x20ID:\x20','6evECgt','\x20\x20Full\x20path:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Options:','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20path\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','(root)','getFolder','✔\x20Found\x20','Use:\x20tdx\x20ps\x20view\x20-w','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20segment\x20or\x20folder\x20details','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Show\x20child\x20segment\x20schema\x20(column\x20types)','json','Resolving\x20folder\x20\x27','getSegmentSQLFromYaml','message','segmentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segment:sql','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','error','Resolving\x20\x27','360985imuPOb','folderPath','elapsedTimeMillis','Parent\x20name:\x20','folder','red','createFolder','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Cause:\x20','Target\x20path:\x20','folderId','Usage:\x20tdx\x20segment\x20describe\x20<path>','verbose','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','jobId','6vcMVRh','getSQLFromYamlFile','SEGMENT_NOT_FOUND','/e/','trim','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','site','getSQLFromServerSegment','\x20\x20Parent\x20segment:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:describe','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','getSegment','Create\x20segment\x20folder\x20for\x20organization','segmentName','Error:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20sql\x20--path\x20','resolveParentId','format','getSegmentSQL','segment:desc','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','url','stats','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','path','name','688723GUwLBj','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20YAML\x20file:\x20','limit','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','toLocaleString','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Resolved:\x20','INVALID_ARGUMENT','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Folder\x20path:\x20','Resolved\x20parent\x20ID:\x20','query','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','segment:view','data','Fetching\x20folder\x20details...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20[Job\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','information_schema','test','Site:\x20','content','Resolved\x20folder\x20ID:\x20','replace'];a38_0x3bc5=function(){return _0x5ce528;};return a38_0x3bc5();}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a38_0x26d544(0x18a)]=a38_0x26d544(0x1b1);async[a38_0x26d544(0x1a8)](_0x2c829b){const _0x49c334=a38_0x26d544,{options:_0x53cc5a,args:_0x3383c5,tdx:_0x47789}=_0x2c829b;if(_0x3383c5[_0x49c334(0x1a5)]===0x0)return console['error'](_0x49c334(0x1d2)),console[_0x49c334(0x1c9)](_0x49c334(0x1d8)),0x1;const _0x3818a2=_0x3383c5[0x0];try{_0x53cc5a[_0x49c334(0x1d7)]&&(console[_0x49c334(0x1c9)](_0x49c334(0x212)+_0x53cc5a[_0x49c334(0x1e1)]),console['error'](_0x49c334(0x1ce)+_0x3818a2));const _0x19adb2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3818a2+_0x49c334(0x192),()=>_0x47789[_0x49c334(0x1a7)]['resolveParentId'](_0x3818a2),{'verbose':_0x53cc5a[_0x49c334(0x1d7)]}),_0xd3b190=_0x19adb2['data'];_0x53cc5a[_0x49c334(0x1d7)]&&console[_0x49c334(0x1c9)](_0x49c334(0x204)+_0xd3b190);const _0x345818=await withSpinner(_0x49c334(0x17c)+_0x3818a2+_0x49c334(0x192),()=>_0x47789[_0x49c334(0x1a7)]['listFolders'](_0xd3b190),{'verbose':_0x53cc5a['verbose']}),_0x1219ce=_0x345818[_0x49c334(0x20a)];return console[_0x49c334(0x1c9)](_0x49c334(0x1b9)+_0x1219ce['length']+_0x49c334(0x17a)+(_0x1219ce['length']!==0x1?'s':'')),await handleSDKOutput(_0x1219ce,_0x53cc5a),0x0;}catch(_0x5a5451){if(_0x5a5451 instanceof SDKError)return console['error'](_0x49c334(0x1eb)+_0x5a5451[_0x49c334(0x1c3)]),_0x5a5451[_0x49c334(0x171)]&&console[_0x49c334(0x1c9)](_0x49c334(0x1d3)+_0x5a5451[_0x49c334(0x171)]),0x1;throw _0x5a5451;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x26d544(0x1f8)]='segment:folder:show';['description']=a38_0x26d544(0x1ac);async['execute'](_0x2fa927){const _0x487c1f=a38_0x26d544,{options:_0x5d70c1,args:_0x2e2c18,tdx:_0x44383b}=_0x2fa927;if(_0x2e2c18['length']===0x0)return console[_0x487c1f(0x1c9)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x487c1f(0x1b4)),0x1;try{const {parentId:_0x43e1ba,childId:_0x50ac38}=parseSegmentRef(_0x2e2c18[0x0]);_0x5d70c1[_0x487c1f(0x1d7)]&&(console[_0x487c1f(0x1c9)](_0x487c1f(0x212)+_0x5d70c1['site']),console[_0x487c1f(0x1c9)]('Parent\x20name:\x20'+_0x43e1ba),_0x50ac38&&console['error']('Folder\x20name:\x20'+_0x50ac38));if(!_0x50ac38)return console['error'](_0x487c1f(0x195)),0x1;const _0x489cf9=await withSpinner(_0x487c1f(0x1b3)+_0x43e1ba+_0x487c1f(0x192),()=>_0x44383b[_0x487c1f(0x1a7)][_0x487c1f(0x1ee)](_0x43e1ba),{'verbose':_0x5d70c1['verbose']}),_0x5bbb2c=_0x489cf9[_0x487c1f(0x20a)];_0x5d70c1[_0x487c1f(0x1d7)]&&console[_0x487c1f(0x1c9)](_0x487c1f(0x204)+_0x5bbb2c);const _0x3584d7=await withSpinner(_0x487c1f(0x1c1)+_0x50ac38+_0x487c1f(0x192),()=>_0x44383b['segment'][_0x487c1f(0x19d)](_0x5bbb2c,_0x50ac38),{'verbose':_0x5d70c1[_0x487c1f(0x1d7)]}),_0x438461=_0x3584d7[_0x487c1f(0x20a)];_0x5d70c1['verbose']&&console[_0x487c1f(0x1c9)](_0x487c1f(0x214)+_0x438461);const _0x48d3ab=await withSpinner(_0x487c1f(0x18b)+_0x50ac38+_0x487c1f(0x192),()=>_0x44383b[_0x487c1f(0x1a7)]['getFolder'](_0x438461),{'verbose':_0x5d70c1[_0x487c1f(0x1d7)]});return await handleSDKOutput([_0x48d3ab[_0x487c1f(0x20a)]],_0x5d70c1),0x0;}catch(_0x5249c0){if(_0x5249c0 instanceof SDKError)return console[_0x487c1f(0x1c9)](_0x487c1f(0x1eb)+_0x5249c0[_0x487c1f(0x1c3)]),_0x5249c0['cause']&&console[_0x487c1f(0x1c9)](_0x487c1f(0x1d3)+_0x5249c0[_0x487c1f(0x171)]),0x1;throw _0x5249c0;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x26d544(0x1f8)]=a38_0x26d544(0x1c6);[a38_0x26d544(0x18a)]=a38_0x26d544(0x180);async[a38_0x26d544(0x1a8)](_0x1b7e9e){const _0xd1eb1d=a38_0x26d544,{options:_0x4a81ee,args:_0x2d207}=_0x1b7e9e,_0x5e19ff=_0x4a81ee,_0x3058f3=_0x5e19ff[_0xd1eb1d(0x1f7)],_0x286482=_0x2d207[0x0];if(!_0x286482&&!_0x3058f3)return console[_0xd1eb1d(0x1c9)](a38_0x1b27b4[_0xd1eb1d(0x1d0)](_0xd1eb1d(0x19a))),console['error'](_0xd1eb1d(0x1ab)),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1ec)),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1ff)),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x170)),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1a0)),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1f3)),0x1;if(_0x286482&&_0x3058f3)return console['error'](a38_0x1b27b4[_0xd1eb1d(0x1d0)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x28cca5;if(_0x3058f3)_0x28cca5=await this[_0xd1eb1d(0x1dc)](_0x3058f3,_0x1b7e9e);else{if(isYamlFilePath(_0x286482))return console[_0xd1eb1d(0x1c9)](a38_0x1b27b4['red'](_0xd1eb1d(0x1be))),console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1ed)+_0x286482),0x1;else _0x28cca5=await this[_0xd1eb1d(0x1e2)](_0x286482,_0x1b7e9e);}return _0x4a81ee[_0xd1eb1d(0x1ef)]===_0xd1eb1d(0x1c0)||_0x4a81ee[_0xd1eb1d(0x1ef)]===_0xd1eb1d(0x1a6)?await handleSDKOutput([{'sql':_0x28cca5}],_0x4a81ee):console[_0xd1eb1d(0x18d)](_0x28cca5),0x0;}catch(_0x30d1d7){if(_0x30d1d7 instanceof SDKError)return console['error'](_0xd1eb1d(0x1eb)+_0x30d1d7['message']),_0x30d1d7[_0xd1eb1d(0x171)]&&console[_0xd1eb1d(0x1c9)](_0xd1eb1d(0x1d3)+_0x30d1d7[_0xd1eb1d(0x171)]),0x1;throw _0x30d1d7;}}async[a38_0x26d544(0x1dc)](_0x8cf772,_0x515522){const _0x428ffb=a38_0x26d544,{options:_0x5d64d6,tdx:_0x55e39f}=_0x515522;let _0x439cc9;try{_0x439cc9=await resolveYamlFilePath(_0x8cf772);}catch(_0x115fb4){throw new SDKError(ErrorCode[_0x428ffb(0x201)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x115fb4[_0x428ffb(0x1c3)]);}_0x5d64d6[_0x428ffb(0x1d7)]&&console[_0x428ffb(0x1c9)](_0x428ffb(0x200)+_0x439cc9[_0x428ffb(0x187)]+'/'+_0x439cc9[_0x428ffb(0x1ea)]);const _0x2c64ff=await withSpinner(_0x428ffb(0x190),()=>_0x55e39f[_0x428ffb(0x1a7)][_0x428ffb(0x1c2)](_0x439cc9[_0x428ffb(0x213)],_0x439cc9['parentSegment'],_0x439cc9[_0x428ffb(0x1ea)]),{'verbose':_0x5d64d6[_0x428ffb(0x1d7)]});return _0x2c64ff[_0x428ffb(0x20a)];}async[a38_0x26d544(0x1e2)](_0x148486,_0x5c5861){const _0x3e022c=a38_0x26d544,{options:_0x4da1cb,tdx:_0x32d8ad}=_0x5c5861,_0x2b7d84=_0x4da1cb[_0x3e022c(0x187)],_0x52d402=await resolveSegmentTarget(_0x148486,_0x2b7d84,_0x4da1cb[_0x3e022c(0x1d7)]);_0x4da1cb[_0x3e022c(0x1d7)]&&console[_0x3e022c(0x1c9)](_0x3e022c(0x1d4)+_0x52d402);const _0x2582cc=await withSpinner(_0x3e022c(0x1ca)+_0x148486+'\x27...',()=>_0x32d8ad[_0x3e022c(0x1a7)][_0x3e022c(0x194)](_0x52d402),{'verbose':_0x4da1cb[_0x3e022c(0x1d7)]}),_0xf67892=_0x2582cc[_0x3e022c(0x20a)];_0x4da1cb[_0x3e022c(0x1d7)]&&(console['error'](_0x3e022c(0x18e)+_0xf67892[_0x3e022c(0x184)]),console[_0x3e022c(0x1c9)](_0x3e022c(0x207)+_0xf67892[_0x3e022c(0x17e)]));if(_0xf67892['type']===_0x3e022c(0x1cf))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3e022c(0x177));if(_0xf67892[_0x3e022c(0x184)]==='parent')throw new SDKError(ErrorCode[_0x3e022c(0x201)],_0x3e022c(0x1f6));if(!_0xf67892[_0x3e022c(0x1c4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3e022c(0x202));const _0x5b1068=await withSpinner(_0x3e022c(0x1a9),()=>_0x32d8ad[_0x3e022c(0x1a7)][_0x3e022c(0x1f0)](_0xf67892[_0x3e022c(0x17e)],_0xf67892[_0x3e022c(0x1c4)]),{'verbose':_0x4da1cb[_0x3e022c(0x1d7)]});return _0x5b1068[_0x3e022c(0x20a)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x26d544(0x1f8)]=a38_0x26d544(0x186);[a38_0x26d544(0x18a)]=a38_0x26d544(0x1e9);async['execute'](_0x2c8f5a){const _0x3186ff=a38_0x26d544,{options:_0x39aeca,args:_0x32b6ed,tdx:_0x18e944}=_0x2c8f5a,_0x1f4073=_0x39aeca;if(_0x32b6ed['length']<0x2)return console[_0x3186ff(0x1c9)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x3186ff(0x1c9)](_0x3186ff(0x1bc)),0x1;const _0x1d285c=_0x32b6ed[0x0],_0x130d8b=_0x32b6ed[0x1];_0x1f4073['verbose']&&(console['error'](_0x3186ff(0x212)+_0x1f4073[_0x3186ff(0x1e1)]),console[_0x3186ff(0x1c9)](_0x3186ff(0x181)+_0x1d285c),console[_0x3186ff(0x1c9)](_0x3186ff(0x193)+_0x130d8b));let _0xeda6ca;if(_0x1f4073[_0x3186ff(0x17f)]){const _0x36f8ca=_0x1f4073[_0x3186ff(0x17f)],_0x2f9ed0=await withSpinner(_0x3186ff(0x1b3)+_0x1d285c+_0x3186ff(0x192),()=>_0x18e944[_0x3186ff(0x1a7)][_0x3186ff(0x1ee)](_0x1d285c),{'verbose':_0x1f4073['verbose']}),_0x52b726=_0x2f9ed0[_0x3186ff(0x20a)],_0x5cb280=await withSpinner(_0x3186ff(0x1a1)+_0x36f8ca+'\x27...',()=>_0x18e944[_0x3186ff(0x1a7)][_0x3186ff(0x19d)](_0x52b726,_0x36f8ca),{'verbose':_0x1f4073[_0x3186ff(0x1d7)]});_0xeda6ca=_0x5cb280['data'],_0x1f4073[_0x3186ff(0x1d7)]&&console[_0x3186ff(0x1c9)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0xeda6ca);}const _0x2e9051={'name':_0x130d8b,'description':_0x1f4073[_0x3186ff(0x18a)],'parentFolderId':_0xeda6ca},_0x582033=await withSpinner(_0x3186ff(0x174)+_0x130d8b+'\x27...',()=>_0x18e944[_0x3186ff(0x1a7)][_0x3186ff(0x1d1)](_0x1d285c,_0x2e9051),{'verbose':_0x1f4073[_0x3186ff(0x1d7)]}),_0x5d8065=_0x582033[_0x3186ff(0x20a)];return console[_0x3186ff(0x1c9)]('✔\x20Created\x20folder\x20\x27'+_0x5d8065[_0x3186ff(0x1f8)]+_0x3186ff(0x19e)+_0x5d8065['id']),await handleSDKOutput([_0x5d8065],_0x1f4073),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a38_0x26d544(0x209);[a38_0x26d544(0x18a)]=a38_0x26d544(0x19c);async[a38_0x26d544(0x1a8)](_0x2c2711){const _0x26cb3c=a38_0x26d544,{options:_0x33e03d,args:_0x1a3806,tdx:_0x59c2e0}=_0x2c2711,_0x3a4f9b=_0x1a3806[0x0];if(!_0x3a4f9b)return console['error'](_0x26cb3c(0x1e4)),console[_0x26cb3c(0x1c9)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1e0)),console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1b2)),console['error'](_0x26cb3c(0x197)),console['error'](_0x26cb3c(0x170)),console[_0x26cb3c(0x1c9)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1fd)),console[_0x26cb3c(0x1c9)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x26cb3c(0x1c9)](_0x26cb3c(0x198)),0x1;try{const _0x3d36e4=_0x33e03d[_0x26cb3c(0x187)],_0x19f5a3=await resolveSegmentTarget(_0x3a4f9b,_0x3d36e4,_0x33e03d[_0x26cb3c(0x1d7)]);_0x33e03d[_0x26cb3c(0x1d7)]&&console[_0x26cb3c(0x1c9)]('Target\x20path:\x20'+_0x19f5a3);const _0x509906=await withSpinner(_0x26cb3c(0x1ca)+_0x3a4f9b+'\x27...',()=>_0x59c2e0['segment'][_0x26cb3c(0x194)](_0x19f5a3),{'verbose':_0x33e03d['verbose']}),_0x183da5=_0x509906[_0x26cb3c(0x20a)];_0x33e03d[_0x26cb3c(0x1d7)]&&(console[_0x26cb3c(0x1c9)]('Resolved\x20type:\x20'+_0x183da5[_0x26cb3c(0x184)]),console[_0x26cb3c(0x1c9)](_0x26cb3c(0x207)+_0x183da5['parentId']),_0x183da5[_0x26cb3c(0x1d5)]&&console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1ae)+_0x183da5[_0x26cb3c(0x1d5)]),_0x183da5['segmentId']&&console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1f2)+_0x183da5[_0x26cb3c(0x1c4)]));if(_0x33e03d[_0x26cb3c(0x185)]){if(_0x183da5[_0x26cb3c(0x184)]===_0x26cb3c(0x1cf))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x183da5[_0x26cb3c(0x184)]===_0x26cb3c(0x1ad))return console[_0x26cb3c(0x1c9)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x26cb3c(0x1ba)),0x1;if(!_0x183da5[_0x26cb3c(0x1c4)])throw new SDKError(ErrorCode[_0x26cb3c(0x1dd)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x58b083=getConsoleNextUrl(_0x33e03d[_0x26cb3c(0x1e1)],'/app/ps/'+_0x183da5[_0x26cb3c(0x17e)]+_0x26cb3c(0x1de)+_0x183da5['segmentId']);return console[_0x26cb3c(0x1c9)](a38_0x1b27b4[_0x26cb3c(0x189)]('✔')+'\x20Opening\x20'+a38_0x1b27b4[_0x26cb3c(0x176)](_0x58b083)),openBrowser(_0x58b083),0x0;}if(_0x183da5[_0x26cb3c(0x184)]===_0x26cb3c(0x1cf)){if(!_0x183da5[_0x26cb3c(0x1d5)])throw new SDKError(ErrorCode[_0x26cb3c(0x208)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x476cfa=await withSpinner(_0x26cb3c(0x20b),()=>_0x59c2e0[_0x26cb3c(0x1a7)][_0x26cb3c(0x1b8)](_0x183da5[_0x26cb3c(0x1d5)]),{'verbose':_0x33e03d[_0x26cb3c(0x1d7)]});await handleSingleObjectOutput(_0x476cfa['data'],_0x33e03d);}else{if(_0x183da5[_0x26cb3c(0x184)]===_0x26cb3c(0x1a7)){if(!_0x183da5['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x26cb3c(0x202));const _0x3ff5f1=await withSpinner('Fetching\x20segment\x20details...',()=>_0x59c2e0[_0x26cb3c(0x1a7)]['getSegment'](_0x183da5[_0x26cb3c(0x17e)],_0x183da5['segmentId']),{'verbose':_0x33e03d[_0x26cb3c(0x1d7)]}),_0x230f81=getConsoleNextUrl(_0x33e03d[_0x26cb3c(0x1e1)],'/app/ps/'+_0x183da5['parentId']+'/e/'+_0x183da5['segmentId']),_0x10fee9=_0x3ff5f1['data'];_0x10fee9[_0x26cb3c(0x1f4)]=_0x230f81,await handleSingleObjectOutput(_0x10fee9,_0x33e03d);}else return console['error'](_0x26cb3c(0x20d)),console[_0x26cb3c(0x1c9)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x5ba6f4){if(_0x5ba6f4 instanceof SDKError)return console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1eb)+_0x5ba6f4[_0x26cb3c(0x1c3)]),_0x5ba6f4[_0x26cb3c(0x171)]&&console[_0x26cb3c(0x1c9)](_0x26cb3c(0x1d3)+_0x5ba6f4[_0x26cb3c(0x171)]),0x1;throw _0x5ba6f4;}}}function a38_0x4ffa(_0x3c50fe,_0x152036){_0x3c50fe=_0x3c50fe-0x170;const _0x3bc592=a38_0x3bc5();let _0x4ffa2a=_0x3bc592[_0x3c50fe];return _0x4ffa2a;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x26d544(0x1f8)]=a38_0x26d544(0x1f1);[a38_0x26d544(0x18a)]=a38_0x26d544(0x1bf);async[a38_0x26d544(0x1a8)](_0x21a117){const _0x57aef0=a38_0x26d544,{options:_0x3f75d5,args:_0x328d5e,tdx:_0x43dfe0}=_0x21a117,_0x399366=_0x328d5e[0x0];if(!_0x399366)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x57aef0(0x1c9)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x57aef0(0x1c9)](_0x57aef0(0x196)),console['error'](_0x57aef0(0x170)),console['error'](_0x57aef0(0x179)),console[_0x57aef0(0x1c9)](_0x57aef0(0x1d9)),0x1;try{const _0x11d7d5=_0x3f75d5['parentSegment'],_0x476e84=await resolveSegmentTarget(_0x399366,_0x11d7d5,_0x3f75d5['verbose']);_0x3f75d5['verbose']&&console[_0x57aef0(0x1c9)](_0x57aef0(0x1d4)+_0x476e84);const _0x129b29=await withSpinner(_0x57aef0(0x1ca)+_0x399366+'\x27...',()=>_0x43dfe0[_0x57aef0(0x1a7)]['resolvePathToResource'](_0x476e84),{'verbose':_0x3f75d5[_0x57aef0(0x1d7)]}),_0x1ff984=_0x129b29[_0x57aef0(0x20a)];_0x3f75d5[_0x57aef0(0x1d7)]&&(console[_0x57aef0(0x1c9)]('Resolved\x20type:\x20'+_0x1ff984[_0x57aef0(0x184)]),console[_0x57aef0(0x1c9)](_0x57aef0(0x207)+_0x1ff984[_0x57aef0(0x17e)]));if(_0x1ff984[_0x57aef0(0x184)]==='folder')return console[_0x57aef0(0x1c9)](_0x57aef0(0x1e7)),console[_0x57aef0(0x1c9)](_0x57aef0(0x1fa)),0x1;if(_0x1ff984[_0x57aef0(0x184)]==='parent')return console[_0x57aef0(0x1c9)](_0x57aef0(0x182)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x1ff984[_0x57aef0(0x1c4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x44b09d=await withSpinner(_0x57aef0(0x1a9),()=>_0x43dfe0[_0x57aef0(0x1a7)][_0x57aef0(0x1f0)](_0x1ff984['parentId'],_0x1ff984[_0x57aef0(0x1c4)]),{'verbose':_0x3f75d5['verbose']}),_0x9703b1=_0x44b09d['data'],_0x1065ae=await executeSchemaQuery(_0x9703b1,_0x43dfe0,_0x3f75d5);return await handleQueryOutput(_0x1065ae,_0x3f75d5),0x0;}catch(_0x49c148){if(_0x49c148 instanceof SDKError)return console['error']('Error:\x20'+_0x49c148['message']),_0x49c148[_0x57aef0(0x171)]&&console[_0x57aef0(0x1c9)](_0x57aef0(0x1d3)+_0x49c148['cause']),0x1;throw _0x49c148;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x294b19=a39_0x3590;(function(_0x37559a,_0x104da6){const _0x16abb6=a39_0x3590,_0x366cd9=_0x37559a();while(!![]){try{const _0x24776c=parseInt(_0x16abb6(0xea))/0x1+parseInt(_0x16abb6(0xe5))/0x2*(-parseInt(_0x16abb6(0x107))/0x3)+-parseInt(_0x16abb6(0x10a))/0x4+-parseInt(_0x16abb6(0xf1))/0x5+-parseInt(_0x16abb6(0xef))/0x6*(-parseInt(_0x16abb6(0xe7))/0x7)+parseInt(_0x16abb6(0xf8))/0x8*(-parseInt(_0x16abb6(0x109))/0x9)+parseInt(_0x16abb6(0x10f))/0xa;if(_0x24776c===_0x104da6)break;else _0x366cd9['push'](_0x366cd9['shift']());}catch(_0x13863a){_0x366cd9['push'](_0x366cd9['shift']());}}}(a39_0x48fd,0xb6bf2));import{BaseCommand}from'./command.js';function a39_0x3590(_0x29e660,_0x55f4bd){_0x29e660=_0x29e660-0xe2;const _0x48fdfd=a39_0x48fd();let _0x359026=_0x48fdfd[_0x29e660];return _0x359026;}import{handleSDKOutput}from'../core/command-output.js';function a39_0x48fd(){const _0xb867db=['type','verbose','Examples:','60kEHUVZ','Resolving\x20folder\x20path\x20\x27','4939587kryliw','3822424ORRKEB','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','12169690doCWwi','data','segments','rule','kind','folderId','Site:\x20','site','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveParentId','segment','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','126714rKFyTA','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','6275129qJXfOO','folder','Resolving\x20folder\x20\x27','1445552vwmjQV','Resolved\x20folder\x20ID:\x20','description','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','resolvePathToResource','6zqyKYp','parent','194245LLoZUk','Creating\x20segment\x20\x27','error','noCountPopulation','Resolving\x20parent\x20segment\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','length','8ztKOLs','Segment\x20name:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','yellow','segmentPath','✔\x20Created\x20segment\x20\x27','resolveFolderId','\x20\x20\x20Path:\x20','segment:create','invisible','ruleFile','includes'];a39_0x48fd=function(){return _0xb867db;};return a39_0x48fd();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x1761c7 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a39_0x294b19(0x100);[a39_0x294b19(0xec)]=a39_0x294b19(0xf6);async['execute'](_0x2a0646){const _0x452bc3=a39_0x294b19;console[_0x452bc3(0xf3)](a39_0x1761c7[_0x452bc3(0xfb)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x452bc3(0xf3)](a39_0x1761c7[_0x452bc3(0xfb)](_0x452bc3(0xe4)));const {options:_0xb216b4,args:_0x41bd29,tdx:_0x461c88}=_0x2a0646,_0x1c874e=_0xb216b4;if(_0x41bd29['length']===0x0)return console[_0x452bc3(0xf3)](_0x452bc3(0xfa)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error'](_0x452bc3(0x106)),console['error'](_0x452bc3(0x10e)),console[_0x452bc3(0xf3)](_0x452bc3(0x10c)),console['error'](_0x452bc3(0xed)),0x1;const _0x46dfd3=_0x41bd29[0x0],_0x8a9425=_0xb216b4[_0x452bc3(0xfc)];let _0x3896d3=_0x46dfd3;_0x8a9425&&!_0x46dfd3[_0x452bc3(0x103)]('/')&&(_0x3896d3=_0x8a9425+'/'+_0x46dfd3,_0x1c874e[_0x452bc3(0x105)]&&console[_0x452bc3(0xf3)](_0x452bc3(0x10b)+_0x3896d3));const _0x33aa85=parsePath(_0x3896d3);if(_0x33aa85[_0x452bc3(0x111)][_0x452bc3(0xf7)]<0x2)return console[_0x452bc3(0xf3)](_0x452bc3(0x117)),console[_0x452bc3(0xf3)](_0x452bc3(0xe6)),0x1;const _0xdeef04=_0x33aa85[_0x452bc3(0x111)][0x0],_0x23c18b=getBaseName(_0x3896d3),_0xfe9e27=getParentPath(_0x3896d3);_0x1c874e['verbose']&&(console[_0x452bc3(0xf3)](_0x452bc3(0x115)+_0x1c874e[_0x452bc3(0x116)]),console[_0x452bc3(0xf3)]('Target\x20path:\x20'+_0x3896d3),console[_0x452bc3(0xf3)]('Parent:\x20'+_0xdeef04),console[_0x452bc3(0xf3)](_0x452bc3(0xf9)+_0x23c18b),console[_0x452bc3(0xf3)]('Parent\x20path:\x20'+_0xfe9e27));const _0x38e7ea=await withSpinner(_0x452bc3(0xf5)+_0xdeef04+_0x452bc3(0x10d),()=>_0x461c88[_0x452bc3(0xe3)][_0x452bc3(0xe2)](_0xdeef04),{'verbose':_0x1c874e[_0x452bc3(0x105)]}),_0x1fc764=_0x38e7ea['data'];let _0x593f55;if(_0x33aa85[_0x452bc3(0x111)][_0x452bc3(0xf7)]>0x2){const _0x264e57=await withSpinner(_0x452bc3(0x108)+_0xfe9e27+'\x27...',()=>_0x461c88[_0x452bc3(0xe3)][_0x452bc3(0xee)](_0xfe9e27),{'verbose':_0x1c874e['verbose']}),_0x21e5af=_0x264e57[_0x452bc3(0x110)];if(_0x21e5af['type']!==_0x452bc3(0xe8)&&_0x21e5af[_0x452bc3(0x104)]!==_0x452bc3(0xf0))return console[_0x452bc3(0xf3)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x593f55=_0x21e5af[_0x452bc3(0x114)];}else{if(_0x1c874e[_0x452bc3(0xe8)]){const _0x543657=await withSpinner(_0x452bc3(0xe9)+_0x1c874e[_0x452bc3(0xe8)]+_0x452bc3(0x10d),()=>_0x461c88[_0x452bc3(0xe3)][_0x452bc3(0xfe)](_0x1fc764,_0x1c874e[_0x452bc3(0xe8)]),{'verbose':_0x1c874e[_0x452bc3(0x105)]});_0x593f55=_0x543657[_0x452bc3(0x110)];}}_0x1c874e[_0x452bc3(0x105)]&&_0x593f55&&console[_0x452bc3(0xf3)](_0x452bc3(0xeb)+_0x593f55);const _0x2e7733=await loadJSONFromOptions(_0x1c874e[_0x452bc3(0x112)],_0x1c874e[_0x452bc3(0x102)]),_0x91c2e9={'name':_0x23c18b,'description':_0x1c874e[_0x452bc3(0xec)],'rule':_0x2e7733,'kind':_0x1c874e[_0x452bc3(0x113)]!==undefined?parseInt(_0x1c874e[_0x452bc3(0x113)],0xa):undefined,'isVisible':_0x1c874e[_0x452bc3(0x101)]?![]:undefined,'segmentFolderId':_0x593f55,'countPopulation':_0x1c874e[_0x452bc3(0xf4)]?![]:undefined},_0x98fdf0=await withSpinner(_0x452bc3(0xf2)+_0x23c18b+_0x452bc3(0x10d),()=>_0x461c88['segment']['createSegment'](_0x1fc764,_0x91c2e9),{'verbose':_0x1c874e[_0x452bc3(0x105)]}),_0xc1d079=_0x98fdf0[_0x452bc3(0x110)];return console['error'](_0x452bc3(0xfd)+_0xc1d079['name']+'\x27\x20with\x20ID:\x20'+_0xc1d079['id']),_0x3896d3!==_0x46dfd3&&console[_0x452bc3(0xf3)](_0x452bc3(0xff)+_0x3896d3),await handleSDKOutput([_0xc1d079],_0x1c874e),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a40_0x3b01(){const _0x5b22c6=['5962944txIvhU','4GPeglW','name','270ZulUVh','length','site','9290iRKcBo','112kyxhlN','segment:fields','3896eiyIfj','213sxNZkv','error','2136684SpHktK','verbose','578WpsWKu','jsonl','segment','Listing\x20fields\x20for\x20\x27','parentSegment','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','313518XUpJuo','\x27...','Parent\x20segment:\x20','30QCLOem','json','✔\x20Found\x20','Site:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','186345ehlOwG'];a40_0x3b01=function(){return _0x5b22c6;};return a40_0x3b01();}const a40_0x53f078=a40_0x2ac2;(function(_0x4be899,_0x46c3e0){const _0x5ac96b=a40_0x2ac2,_0x5591c0=_0x4be899();while(!![]){try{const _0x31b527=-parseInt(_0x5ac96b(0x1e3))/0x1*(parseInt(_0x5ac96b(0x1e7))/0x2)+-parseInt(_0x5ac96b(0x1ed))/0x3*(parseInt(_0x5ac96b(0x1f7))/0x4)+-parseInt(_0x5ac96b(0x1df))/0x5*(parseInt(_0x5ac96b(0x1f9))/0x6)+-parseInt(_0x5ac96b(0x1e0))/0x7*(parseInt(_0x5ac96b(0x1e2))/0x8)+parseInt(_0x5ac96b(0x1f5))/0x9*(parseInt(_0x5ac96b(0x1f0))/0xa)+-parseInt(_0x5ac96b(0x1e5))/0xb+parseInt(_0x5ac96b(0x1f6))/0xc;if(_0x31b527===_0x46c3e0)break;else _0x5591c0['push'](_0x5591c0['shift']());}catch(_0x545cdb){_0x5591c0['push'](_0x5591c0['shift']());}}}(a40_0x3b01,0x1a336));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';function a40_0x2ac2(_0xd9453a,_0x20e11f){_0xd9453a=_0xd9453a-0x1de;const _0x3b01a4=a40_0x3b01();let _0x2ac2fb=_0x3b01a4[_0xd9453a];return _0x2ac2fb;}export class SegmentFieldsCommand extends BaseCommand{[a40_0x53f078(0x1f8)]=a40_0x53f078(0x1e1);['description']='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x142e4a){const _0x1f5b90=a40_0x53f078,{options:_0x43ef23,args:_0x465865,tdx:_0x5bd4e2}=_0x142e4a,_0x5b16c4=_0x465865[0x0]||_0x43ef23[_0x1f5b90(0x1eb)];if(!_0x5b16c4)return console[_0x1f5b90(0x1e4)](_0x1f5b90(0x1f4)),console[_0x1f5b90(0x1e4)](_0x1f5b90(0x1ec)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x43ef23[_0x1f5b90(0x1e6)]&&(console[_0x1f5b90(0x1e4)](_0x1f5b90(0x1f3)+_0x43ef23[_0x1f5b90(0x1de)]),console[_0x1f5b90(0x1e4)](_0x1f5b90(0x1ef)+_0x5b16c4));const _0x12f76d=await withSpinner(_0x1f5b90(0x1ea)+_0x5b16c4+_0x1f5b90(0x1ee),()=>_0x5bd4e2[_0x1f5b90(0x1e9)]['listFields'](_0x5b16c4),{'verbose':_0x43ef23['verbose']}),_0x361765=_0x12f76d['data'];console[_0x1f5b90(0x1e4)](_0x1f5b90(0x1f2)+_0x361765[_0x1f5b90(0x1fa)]+'\x20field'+(_0x361765[_0x1f5b90(0x1fa)]!==0x1?'s':''));if(_0x43ef23[_0x1f5b90(0x1f1)]||_0x43ef23[_0x1f5b90(0x1e8)])return await handleSDKOutput(_0x361765,_0x43ef23),0x0;return displayFieldsHumanReadable(_0x361765,_0x5b16c4),0x0;}}
|