@treasuredata/tdx 2026.3.42 → 2026.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a33_0x107f(_0x3addd9,_0x4736b0){_0x3addd9=_0x3addd9-0x173;const _0x2e1743=a33_0x2e17();let _0x107f8b=_0x2e1743[_0x3addd9];return _0x107f8b;}const a33_0x1fb440=a33_0x107f;(function(_0x54927f,_0x137a42){const _0x50aef4=a33_0x107f,_0x4f3dbc=_0x54927f();while(!![]){try{const _0x25871d=-parseInt(_0x50aef4(0x181))/0x1+parseInt(_0x50aef4(0x1aa))/0x2*(-parseInt(_0x50aef4(0x173))/0x3)+parseInt(_0x50aef4(0x193))/0x4*(parseInt(_0x50aef4(0x190))/0x5)+-parseInt(_0x50aef4(0x1af))/0x6*(-parseInt(_0x50aef4(0x1a6))/0x7)+parseInt(_0x50aef4(0x176))/0x8*(-parseInt(_0x50aef4(0x1a3))/0x9)+parseInt(_0x50aef4(0x17f))/0xa*(-parseInt(_0x50aef4(0x1b2))/0xb)+parseInt(_0x50aef4(0x19b))/0xc;if(_0x25871d===_0x137a42)break;else _0x4f3dbc['push'](_0x4f3dbc['shift']());}catch(_0x596aea){_0x4f3dbc['push'](_0x4f3dbc['shift']());}}}(a33_0x2e17,0x4b87f));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x64c7af from'chalk';function a33_0x2e17(){const _0x5a5692=['data','administrator','operation','policy\x20list','25305MYtMAT','log','email','284uWghjq','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','account_id','listPolicies','getMyPermissions','\x20polic','Member','site','12934020FrzSYy','getPolicy','description','\x20user','length','📋\x20Assigned\x20Policies','user','No\x20policies\x20found','3547683ZtHwpm','verbose','execute','7EecadT','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20No\x20permissions',',\x20user_id:','4996GTkHcF','\x20assigned','name','(ID:\x20','👥\x20Assigned\x20Users','1422192YPAxts','bold','all','11781XaIQGK','231CmYBDG','getCurrent','Fetching\x20permissions...','8HoyouX','ies','context','validate','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','permissions','\x20\x20•\x20','getPolicyPermissions','policy\x20show','5210EDmVfP','error','220299DgQUky','max','\x20\x20No\x20policies\x20assigned','Account\x20Owner','\x20\x20\x20','dim','map','padEnd','policy','join','args'];a33_0x2e17=function(){return _0x5a5692;};return a33_0x2e17();}export class PolicyCommand extends BaseCommand{[a33_0x1fb440(0x1ac)]=a33_0x1fb440(0x189);[a33_0x1fb440(0x19d)]=a33_0x1fb440(0x17a);async[a33_0x1fb440(0x1a5)](_0x23c91f){const _0x3a3730=a33_0x1fb440,{options:_0x3bcf9c,tdx:_0x1de6a3}=_0x23c91f,_0x5532ad=await withSpinner(_0x3a3730(0x175),async()=>{const _0x38a72f=_0x3a3730,[_0x1ffcce,_0x2e3c4c]=await Promise[_0x38a72f(0x1b1)]([_0x1de6a3[_0x38a72f(0x1a1)][_0x38a72f(0x174)](),_0x1de6a3[_0x38a72f(0x189)][_0x38a72f(0x197)]()]);return{'userInfo':_0x1ffcce,'permissions':_0x2e3c4c};},{'verbose':_0x3bcf9c[_0x3a3730(0x1a4)]}),{userInfo:_0x3dcec0,permissions:_0x4604a2}=_0x5532ad[_0x3a3730(0x18c)];if(isStructuredFormat(_0x3bcf9c))return await handleSingleObjectOutput(_0x4604a2,_0x3bcf9c),0x0;const _0x4236dd=_0x3dcec0['account_owner']?_0x3a3730(0x184):_0x3dcec0[_0x3a3730(0x18d)]?'Administrator':_0x3a3730(0x199);console[_0x3a3730(0x191)]('\x0a'+a33_0x64c7af[_0x3a3730(0x1b0)]('👤')+'\x20'+a33_0x64c7af['bold'](_0x3dcec0[_0x3a3730(0x1ac)])+'\x20'+a33_0x64c7af[_0x3a3730(0x186)]('('+_0x3dcec0['email']+')')+'\x20—\x20'+_0x4236dd),console['log'](a33_0x64c7af[_0x3a3730(0x186)]('\x20\x20\x20'+_0x1de6a3[_0x3a3730(0x178)][_0x3a3730(0x19a)]+':'+_0x3dcec0[_0x3a3730(0x195)]+_0x3a3730(0x1a9)+_0x3dcec0['id']));const _0x5ee7df=_0x4604a2['policies'];console[_0x3a3730(0x191)]('\x0a'+a33_0x64c7af[_0x3a3730(0x1b0)](_0x3a3730(0x1a0))+'\x20('+_0x5ee7df[_0x3a3730(0x19f)]+'):');if(_0x5ee7df['length']===0x0)console[_0x3a3730(0x191)](a33_0x64c7af[_0x3a3730(0x186)](_0x3a3730(0x183)));else for(const _0x418a67 of _0x5ee7df){console[_0x3a3730(0x191)](_0x3a3730(0x17c)+_0x418a67['name']);}return printPermissionsMap(_0x4604a2[_0x3a3730(0x17b)]),console[_0x3a3730(0x191)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a33_0x1fb440(0x18f);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x1fb440(0x1a5)](_0x1550fe){const _0x4f57b0=a33_0x1fb440,{options:_0xb4982f,tdx:_0x5d8304}=_0x1550fe,_0x4b7658=await withSpinner('Listing\x20policies...',()=>_0x5d8304[_0x4f57b0(0x189)][_0x4f57b0(0x196)](),{'verbose':_0xb4982f[_0x4f57b0(0x1a4)]}),_0x2a97c7=_0x4b7658[_0x4f57b0(0x18c)];console[_0x4f57b0(0x180)]('✔\x20Found\x20'+_0x2a97c7['length']+_0x4f57b0(0x198)+(_0x2a97c7[_0x4f57b0(0x19f)]!==0x1?_0x4f57b0(0x177):'y'));if(isStructuredFormat(_0xb4982f))return await handleSDKOutput(_0x2a97c7,_0xb4982f),0x0;if(_0x2a97c7[_0x4f57b0(0x19f)]===0x0)console[_0x4f57b0(0x191)](a33_0x64c7af[_0x4f57b0(0x186)](_0x4f57b0(0x1a2)));else for(const _0x4bb7ff of _0x2a97c7){const _0x127751=_0x4bb7ff[_0x4f57b0(0x19d)]?a33_0x64c7af[_0x4f57b0(0x186)]('\x20—\x20'+_0x4bb7ff['description']):'';console[_0x4f57b0(0x191)](_0x4f57b0(0x17c)+_0x4bb7ff[_0x4f57b0(0x1ac)]+_0x127751);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x1fb440(0x1ac)]=a33_0x1fb440(0x17e);[a33_0x1fb440(0x19d)]=a33_0x1fb440(0x194);[a33_0x1fb440(0x179)](_0xeddc2d){const _0x38c909=a33_0x1fb440;if(_0xeddc2d[_0x38c909(0x18b)][_0x38c909(0x19f)]===0x0)return _0x38c909(0x1a7);return undefined;}async[a33_0x1fb440(0x1a5)](_0x5ee831){const _0x281db9=a33_0x1fb440,{options:_0x57fbda,tdx:_0x2287c8}=_0x5ee831,_0x298f74=_0x5ee831['args'][0x0],_0x666a64=await withSpinner('Fetching\x20policy...',async()=>{const _0x43dae2=a33_0x107f,_0x2280e1=await _0x2287c8[_0x43dae2(0x189)][_0x43dae2(0x19c)](_0x298f74),[_0x41c258,_0x158e1c]=await Promise[_0x43dae2(0x1b1)]([_0x2287c8['policy'][_0x43dae2(0x17d)](_0x2280e1['id']),_0x2287c8[_0x43dae2(0x189)]['getPolicyUsers'](_0x2280e1['id'])]);return{'policy':_0x2280e1,'perms':_0x41c258,'users':_0x158e1c};},{'verbose':_0x57fbda[_0x281db9(0x1a4)]}),{policy:_0x47e61e,perms:_0x32cc73,users:_0x355582}=_0x666a64[_0x281db9(0x18c)];if(isStructuredFormat(_0x57fbda))return await handleSingleObjectOutput({..._0x47e61e,'permissions':_0x32cc73[_0x281db9(0x17b)],'users':_0x355582},_0x57fbda),0x0;console['log']('\x0a'+a33_0x64c7af[_0x281db9(0x1b0)]('📋')+'\x20'+a33_0x64c7af[_0x281db9(0x1b0)](_0x47e61e[_0x281db9(0x1ac)])+'\x20'+a33_0x64c7af[_0x281db9(0x186)](_0x281db9(0x1ad)+_0x47e61e['id']+')'));_0x47e61e[_0x281db9(0x19d)]&&console['log'](_0x281db9(0x185)+a33_0x64c7af[_0x281db9(0x186)](_0x47e61e[_0x281db9(0x19d)]));console['log'](_0x281db9(0x185)+_0x355582[_0x281db9(0x19f)]+_0x281db9(0x19e)+(_0x355582['length']!==0x1?'s':'')+_0x281db9(0x1ab)),printPermissionsMap(_0x32cc73[_0x281db9(0x17b)]);if(_0x355582[_0x281db9(0x19f)]>0x0){console[_0x281db9(0x191)]('\x0a'+a33_0x64c7af[_0x281db9(0x1b0)](_0x281db9(0x1ae))+':');for(const _0x56493e of _0x355582){const _0x3c65da=_0x56493e['email']&&_0x56493e[_0x281db9(0x192)]!==_0x56493e[_0x281db9(0x1ac)]?a33_0x64c7af['dim']('\x20<'+_0x56493e[_0x281db9(0x192)]+'>'):'';console[_0x281db9(0x191)](_0x281db9(0x17c)+_0x56493e[_0x281db9(0x1ac)]+_0x3c65da);}}return console['log'](),0x0;}}function printPermissionsMap(_0x187dcb){const _0x172b56=a33_0x1fb440,_0x43d958=Object['entries'](_0x187dcb);console[_0x172b56(0x191)]('\x0a'+a33_0x64c7af['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x43d958[_0x172b56(0x19f)]===0x0){console[_0x172b56(0x191)](a33_0x64c7af['dim'](_0x172b56(0x1a8)));return;}const _0xda628c=Math[_0x172b56(0x182)](..._0x43d958[_0x172b56(0x187)](([_0x1ab471])=>_0x1ab471[_0x172b56(0x19f)]));for(const [_0x48dbe5,_0x476d22]of _0x43d958){const _0x26d409=formatOperations(_0x476d22);console[_0x172b56(0x191)]('\x20\x20'+_0x48dbe5[_0x172b56(0x188)](_0xda628c+0x2)+_0x26d409);}}function formatOperations(_0x2ffeda){const _0x3f641a=a33_0x1fb440,_0x5c5362=[...new Set(_0x2ffeda['map'](_0x4d60ce=>_0x4d60ce[_0x3f641a(0x18e)]))];return _0x5c5362[_0x3f641a(0x18a)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a34_0x38dded=a34_0x343b;(function(_0x2a9d6f,_0x592699){const _0x51ce92=a34_0x343b,_0x3675e1=_0x2a9d6f();while(!![]){try{const _0x387472=-parseInt(_0x51ce92(0x134))/0x1*(-parseInt(_0x51ce92(0x11c))/0x2)+-parseInt(_0x51ce92(0x14c))/0x3+parseInt(_0x51ce92(0x109))/0x4*(-parseInt(_0x51ce92(0x11d))/0x5)+-parseInt(_0x51ce92(0x15e))/0x6+parseInt(_0x51ce92(0x162))/0x7+parseInt(_0x51ce92(0x118))/0x8+parseInt(_0x51ce92(0x14b))/0x9;if(_0x387472===_0x592699)break;else _0x3675e1['push'](_0x3675e1['shift']());}catch(_0x426586){_0x3675e1['push'](_0x3675e1['shift']());}}}(a34_0x285d,0x4c4c2));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a34_0x343b(_0x11f417,_0x188c99){_0x11f417=_0x11f417-0xfa;const _0x285d46=a34_0x285d();let _0x343b3b=_0x285d46[_0x11f417];return _0x343b3b;}import{getConfigDir}from'../core/config.js';import*as a34_0x43e14c from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';function a34_0x285d(){const _0xd568d1=['\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSaved\x20to:\x20','default','llm_agent','tdx:\x20profile\x20create','221931NmRMsN','641169VibGcf','\x20Profile\x20\x27','VALID_KEYS','bold','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20set','Default\x20profile\x20set\x20to:\x20','apiKey','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','us01','join','description','✗\x20Validation\x20failed:\x20','create','confirm','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','2971254bPXRTp','length','text','status','2670521TAbaHP','(cleared)','execute','yellow','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','API\x20key\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','name','dim','Failed\x20to\x20remove\x20profile:\x20','log','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profile:use','Site\x20was\x20not\x20changed.','Operation\x20cancelled','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','getUserInfo','\x0aAvailable\x20profiles:','\x27\x20created','610560lgWNLg','green','warn','includes','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','session','tdx:\x20profile\x20remove','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profileName','Enter\x20profile\x20name:','\x20--default\x27\x20to\x20save\x20permanently','message','jobs','Validating\x20API\x20key...','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','4444032YZkjNx','Profile\x20\x27','Choose\x20authentication\x20method:','\x27\x20requires\x20API\x20key\x20validation.','36506LwUAxa','10VooYTb','tdx.json','trim','Create\x20a\x20new\x20profile','ERROR','apikey','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Remove\x20a\x20profile','logLevel','Unknown\x20key\x20\x27','llm_project','profile:remove','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20-\x20','parent_segment','\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','error','Setup\x20cancelled','profile','oauth','Profile\x20name\x20cannot\x20be\x20empty','password','20XmrxBz','validate','site','Changing\x20site\x20to\x20\x27','\x20\x20tdx\x20--profile\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','API\x20Key','profile:set','method','red','\x27\x20does\x20not\x20exist.','OAuth\x20(browser\x20login)','test','(session:\x20'];a34_0x285d=function(){return _0xd568d1;};return a34_0x285d();}import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0x402816 from'prompts';import a34_0x596778 from'chalk';function validateProfileName(_0x301cf1){const _0x40442c=a34_0x343b;if(!_0x301cf1||!_0x301cf1[_0x40442c(0x11f)]())return _0x40442c(0x132);const _0x130927=_0x301cf1[_0x40442c(0x11f)]();if(!/^[a-zA-Z0-9_-]+$/[_0x40442c(0x141)](_0x130927))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x130927))return'Profile\x20\x27'+_0x130927+_0x40442c(0x123);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a34_0x38dded(0x120);async['execute'](_0x5dfad1){const _0x1db27c=a34_0x38dded,{options:_0x85ea04,args:_0x560cbb}=_0x5dfad1;console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x14f)](_0x1db27c(0x14a)));let _0x14f08e;if(_0x560cbb[_0x1db27c(0x15f)]>0x0&&_0x560cbb[0x0]){const _0x3fa066=_0x560cbb[0x0][_0x1db27c(0x11f)](),_0x26eaf8=validateProfileName(_0x3fa066);if(_0x26eaf8!==!![])return console[_0x1db27c(0x12e)](a34_0x596778[_0x1db27c(0x13e)](_0x26eaf8)),0x1;_0x14f08e=_0x3fa066;}else{const _0x50435a=await a34_0x402816({'type':_0x1db27c(0x160),'name':_0x1db27c(0x111),'message':_0x1db27c(0x112),'validate':validateProfileName});if(!_0x50435a[_0x1db27c(0x111)])return console[_0x1db27c(0xff)]('\x0aSetup\x20cancelled'),0x1;_0x14f08e=_0x50435a[_0x1db27c(0x111)][_0x1db27c(0x11f)]();}const _0x6336d0=await a34_0x402816({'type':_0x1db27c(0x160),'name':_0x1db27c(0x157),'message':'Enter\x20description\x20(optional):'}),_0x31a8b2=_0x6336d0['description']?.[_0x1db27c(0x11f)]()||undefined,_0x22c973=_0x85ea04[_0x1db27c(0x136)]||_0x1db27c(0x155),_0x95ad0d=await promptSiteSelection(_0x22c973,_0x14f08e,_0x1db27c(0x12f));if(!_0x95ad0d)return 0x1;const _0x2811c0=resolveSite(_0x95ad0d);if(isOAuthSupported(_0x2811c0)){const _0x336e6b=await a34_0x402816({'type':'select','name':_0x1db27c(0x13d),'message':_0x1db27c(0x11a),'choices':[{'title':_0x1db27c(0x140),'value':'oauth'},{'title':_0x1db27c(0x13b),'value':_0x1db27c(0x122)}]});if(!_0x336e6b[_0x1db27c(0x13d)])return console[_0x1db27c(0xff)](_0x1db27c(0x12c)),0x1;if(_0x336e6b['method']===_0x1db27c(0x131)){if(_0x31a8b2){const _0x58b3d1={'site':_0x2811c0,'description':_0x31a8b2};saveProfileToUserConfig(_0x14f08e,_0x58b3d1);}return await runOAuthLoginFlow(_0x2811c0,_0x14f08e,_0x85ea04[_0x1db27c(0x125)]??LogLevel[_0x1db27c(0x121)]),0x0;}}console['log'](_0x1db27c(0x15d)+_0x2811c0),console[_0x1db27c(0xff)](_0x1db27c(0x139)),console['log']('\x20\x20'+getConsoleUrl(_0x2811c0,'/app/mp/ak'));const _0x4671ee=await a34_0x402816({'type':_0x1db27c(0x133),'name':_0x1db27c(0x153),'message':_0x1db27c(0x145),'validate':_0x3143ed=>{const _0x52aeed=_0x1db27c;if(!_0x3143ed||!_0x3143ed['trim']())return _0x52aeed(0xfa);return!![];}});if(!_0x4671ee[_0x1db27c(0x153)])return console[_0x1db27c(0xff)]('\x0aSetup\x20cancelled'),0x1;const _0x5130f1=_0x4671ee[_0x1db27c(0x153)];console[_0x1db27c(0xff)]('Validating\x20API\x20key...');try{const _0x3b90ba=TDX[_0x1db27c(0x159)]({'site':_0x2811c0,'apiKey':_0x5130f1[_0x1db27c(0x11f)](),'logLevel':_0x85ea04[_0x1db27c(0x125)]??LogLevel[_0x1db27c(0x121)]}),_0x2944fb=await _0x3b90ba[_0x1db27c(0x115)]['getUserInfo']();console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x10a)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2944fb['email']+')');const _0x48fe46=await isKeychainAvailable();_0x48fe46?(await saveAPIKeyAsync(_0x5130f1['trim'](),_0x2811c0,_0x14f08e),console[_0x1db27c(0xff)](a34_0x596778[_0x1db27c(0x10a)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x14f08e+')')):(console[_0x1db27c(0x10b)](a34_0x596778[_0x1db27c(0x165)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x1db27c(0x10b)](a34_0x596778['yellow'](_0x1db27c(0x117))));const _0x3e0a2f={'site':_0x2811c0,..._0x31a8b2&&{'description':_0x31a8b2}};return saveProfileToUserConfig(_0x14f08e,_0x3e0a2f),console[_0x1db27c(0xff)](a34_0x596778['green']('✓')+_0x1db27c(0x14d)+_0x14f08e+_0x1db27c(0x108)),console[_0x1db27c(0xff)](),console[_0x1db27c(0xff)](_0x1db27c(0x150)),console['log'](_0x1db27c(0x138)+_0x14f08e+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x1db27c(0x138)+_0x14f08e+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x25e1c3){if(_0x25e1c3 instanceof HTTPClientError&&_0x25e1c3[_0x1db27c(0x161)]===0x191)return printAuthError(_0x25e1c3),0x1;return console[_0x1db27c(0x12e)](a34_0x596778[_0x1db27c(0x13e)](_0x1db27c(0x158)+(_0x25e1c3 instanceof Error?_0x25e1c3[_0x1db27c(0x114)]:String(_0x25e1c3)))),console[_0x1db27c(0x12e)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a34_0x38dded(0x128);[a34_0x38dded(0x157)]=a34_0x38dded(0x124);[a34_0x38dded(0x135)](_0x18ffd2){const _0x123a79=a34_0x38dded,{args:_0x457f4a}=_0x18ffd2;if(_0x457f4a[_0x123a79(0x15f)]===0x0)return _0x123a79(0x13a);return undefined;}async[a34_0x38dded(0x164)](_0xaaee14){const _0x9589bf=a34_0x38dded,{args:_0x368118}=_0xaaee14,_0x162d43=_0x368118[0x0];console['log'](a34_0x596778[_0x9589bf(0x14f)](_0x9589bf(0x10f)));if(!profileExists(_0x162d43)){console['error'](a34_0x596778[_0x9589bf(0x13e)]('Profile\x20\x27'+_0x162d43+_0x9589bf(0x13f))),console[_0x9589bf(0xff)]('\x0aAvailable\x20profiles:');const _0x51a149=listProfiles();if(_0x51a149['length']===0x0)console['log'](_0x9589bf(0x143));else for(const _0x3289e9 of _0x51a149){console[_0x9589bf(0xff)](_0x9589bf(0x12a)+_0x3289e9[_0x9589bf(0xfc)]);}return 0x1;}const _0x550b34=await a34_0x402816({'type':_0x9589bf(0x15a),'name':'confirm','message':_0x9589bf(0x110)+_0x162d43+'\x27?','initial':![]});if(!_0x550b34['confirm'])return console[_0x9589bf(0xff)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x162d43),console['log'](a34_0x596778[_0x9589bf(0x10a)]('✓')+_0x9589bf(0x14d)+_0x162d43+'\x27\x20removed\x20from\x20configuration');}catch(_0x4e1382){return console[_0x9589bf(0x12e)](a34_0x596778[_0x9589bf(0x13e)](_0x9589bf(0xfe)+(_0x4e1382 instanceof Error?_0x4e1382[_0x9589bf(0x114)]:String(_0x4e1382)))),0x1;}const _0x311c5f=await isKeychainAvailable();if(_0x311c5f){const _0x2f0b41=await deleteKeychainAPIKey(_0x162d43);_0x2f0b41&&console[_0x9589bf(0xff)](a34_0x596778[_0x9589bf(0x10a)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x38dded(0xfc)]=a34_0x38dded(0x13c);['description']='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=['site',a34_0x38dded(0x105),a34_0x38dded(0x12b),a34_0x38dded(0x127),a34_0x38dded(0x149),a34_0x38dded(0x157)];[a34_0x38dded(0x135)](_0xf9a61b){const _0x4437ef=a34_0x38dded,{args:_0x190ad1,options:_0x343725}=_0xf9a61b,_0x170008=_0x343725[_0x4437ef(0x130)]||getActiveProfile();if(!_0x170008)return _0x4437ef(0x154);if(_0x190ad1['length']===0x0)return _0x4437ef(0x104)+ProfileSetCommand[_0x4437ef(0x14e)][_0x4437ef(0x156)](',\x20');const _0x383e21=_0x190ad1[0x0];if(!_0x383e21['includes']('='))return _0x4437ef(0xfb)+ProfileSetCommand['VALID_KEYS'][_0x4437ef(0x156)](',\x20');const [_0x1bbe94]=_0x383e21['split']('=',0x2);if(!ProfileSetCommand[_0x4437ef(0x14e)][_0x4437ef(0x10c)](_0x1bbe94))return _0x4437ef(0x126)+_0x1bbe94+_0x4437ef(0x144)+ProfileSetCommand[_0x4437ef(0x14e)]['join'](',\x20');return undefined;}async['execute'](_0x374896){const _0x5983ac=a34_0x38dded,{args:_0x13508a,options:_0xe27ca}=_0x374896,_0x2b6c79=_0xe27ca['profile']||getActiveProfile(),[_0x55761f,..._0x23452c]=_0x13508a[0x0][_0x5983ac(0x167)]('='),_0xcf76a5=_0x23452c[_0x5983ac(0x156)]('=');console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x14f)](_0x5983ac(0x151)));if(!profileExists(_0x2b6c79)){const _0x133d9a=await a34_0x402816({'type':'confirm','name':_0x5983ac(0x159),'message':'Profile\x20\x27'+_0x2b6c79+_0x5983ac(0x166),'initial':!![]});if(!_0x133d9a['create'])return console['log'](_0x5983ac(0x103)),0x1;}const _0x36eed4=loadProfile(_0x2b6c79),_0x2fc007=_0x36eed4?.['config']||{};if(_0x55761f===_0x5983ac(0x136)){const _0xb5b0cd=resolveSite(_0xcf76a5);console[_0x5983ac(0xff)](_0x5983ac(0x137)+_0xb5b0cd+_0x5983ac(0x11b)),console['log'](_0x5983ac(0x100)),console['log']('\x20\x20'+getConsoleUrl(_0xb5b0cd,_0x5983ac(0x15b)));const _0x196f3f=await a34_0x402816({'type':_0x5983ac(0x133),'name':_0x5983ac(0x153),'message':_0x5983ac(0x15c),'validate':_0x237049=>{const _0x3ae6f6=_0x5983ac;if(!_0x237049||!_0x237049[_0x3ae6f6(0x11f)]())return _0x3ae6f6(0xfa);return!![];}});if(!_0x196f3f[_0x5983ac(0x153)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x5983ac(0xff)](_0x5983ac(0x116));try{const _0x4ed23a=TDX[_0x5983ac(0x159)]({'site':_0xb5b0cd,'apiKey':_0x196f3f[_0x5983ac(0x153)][_0x5983ac(0x11f)](),'logLevel':_0xe27ca[_0x5983ac(0x125)]??LogLevel[_0x5983ac(0x121)]}),_0x31972f=await _0x4ed23a['jobs'][_0x5983ac(0x106)]();console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x146)+_0x31972f['email']+')');const _0x5caed6=await isKeychainAvailable();_0x5caed6?(await saveAPIKeyAsync(_0x196f3f[_0x5983ac(0x153)][_0x5983ac(0x11f)](),_0xb5b0cd,_0x2b6c79),console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x12d))):console[_0x5983ac(0x10b)](a34_0x596778['yellow'](_0x5983ac(0x129))),_0x2fc007[_0x5983ac(0x136)]=_0xb5b0cd;}catch(_0x1b1c46){if(_0x1b1c46 instanceof HTTPClientError&&_0x1b1c46['status']===0x191)return printAuthError(_0x1b1c46),0x1;return console[_0x5983ac(0x12e)](a34_0x596778[_0x5983ac(0x13e)](_0x5983ac(0x158)+(_0x1b1c46 instanceof Error?_0x1b1c46[_0x5983ac(0x114)]:String(_0x1b1c46)))),console[_0x5983ac(0x12e)](_0x5983ac(0x102)),0x1;}}else _0x2fc007[_0x55761f]=_0xcf76a5||undefined;return saveProfileToUserConfig(_0x2b6c79,_0x2fc007),console[_0x5983ac(0xff)](a34_0x596778[_0x5983ac(0x10a)]('✓')+_0x5983ac(0x14d)+_0x2b6c79+'\x27\x20updated:\x20'+_0x55761f+'='+(_0xcf76a5||_0x5983ac(0x163))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x38dded(0xfc)]=a34_0x38dded(0x101);[a34_0x38dded(0x157)]='Set\x20session\x20profile';[a34_0x38dded(0x135)](_0x6a766f){const _0x40c9cc=a34_0x38dded,{args:_0x102a72}=_0x6a766f;if(_0x102a72[_0x40c9cc(0x15f)]===0x0)return _0x40c9cc(0x10d);return undefined;}async[a34_0x38dded(0x164)](_0x4dc541){const _0x2cba78=a34_0x38dded,{args:_0x1f0b57,options:_0x3d11bd}=_0x4dc541,_0x2b77e1=_0x1f0b57[0x0],_0x247502=_0x3d11bd[_0x2cba78(0x148)];cleanExpiredSessions();if(!profileExists(_0x2b77e1)){console[_0x2cba78(0x12e)](a34_0x596778['red'](_0x2cba78(0x119)+_0x2b77e1+_0x2cba78(0x13f))),console[_0x2cba78(0xff)](_0x2cba78(0x107));const _0x4b5547=listProfiles();if(_0x4b5547[_0x2cba78(0x15f)]===0x0)console['log'](_0x2cba78(0x143));else for(const _0x55289e of _0x4b5547){console[_0x2cba78(0xff)](_0x2cba78(0x12a)+_0x55289e[_0x2cba78(0xfc)]);}return 0x1;}if(_0x247502){const _0x305373=a34_0x43e14c[_0x2cba78(0x156)](getConfigDir(),_0x2cba78(0x11e));return saveActiveProfileToUserConfig(_0x2b77e1),console['log'](_0x2cba78(0x152)+a34_0x596778[_0x2cba78(0x10a)](_0x2b77e1)),console[_0x2cba78(0xff)](a34_0x596778[_0x2cba78(0xfd)](_0x2cba78(0x147)+_0x305373)),0x0;}const _0x325cf5=getSessionID(_0x3d11bd[_0x2cba78(0x10e)]);return saveSessionContext({'profile':_0x2b77e1},_0x3d11bd[_0x2cba78(0x10e)]),console[_0x2cba78(0xff)]('Session\x20profile\x20set\x20to:\x20'+a34_0x596778[_0x2cba78(0x10a)](_0x2b77e1)+'\x20'+a34_0x596778[_0x2cba78(0xfd)](_0x2cba78(0x142)+_0x325cf5+')')),console['log'](a34_0x596778[_0x2cba78(0xfd)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2b77e1+_0x2cba78(0x113))),0x0;}}
|
|
1
|
+
const a34_0xe1bbbd=a34_0x1b43;(function(_0x2e894b,_0x40065f){const _0x57ccf9=a34_0x1b43,_0x159533=_0x2e894b();while(!![]){try{const _0x53cc82=parseInt(_0x57ccf9(0xf7))/0x1+-parseInt(_0x57ccf9(0x101))/0x2+-parseInt(_0x57ccf9(0x128))/0x3*(parseInt(_0x57ccf9(0x134))/0x4)+parseInt(_0x57ccf9(0x122))/0x5+-parseInt(_0x57ccf9(0xff))/0x6+parseInt(_0x57ccf9(0xef))/0x7+parseInt(_0x57ccf9(0xfb))/0x8*(parseInt(_0x57ccf9(0x13c))/0x9);if(_0x53cc82===_0x40065f)break;else _0x159533['push'](_0x159533['shift']());}catch(_0x14638a){_0x159533['push'](_0x159533['shift']());}}}(a34_0x3a80,0xf2262));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_0x2edced 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';function a34_0x1b43(_0x165687,_0x1f45b1){_0x165687=_0x165687-0xe7;const _0x3a80af=a34_0x3a80();let _0x1b4302=_0x3a80af[_0x165687];return _0x1b4302;}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';function a34_0x3a80(){const _0x58a634=['1895148qQkuXu','Changing\x20site\x20to\x20\x27','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','/app/mp/ak','default','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','getUserInfo','profile','us01','\x20\x20tdx\x20--profile\x20','llm_agent','\x27.\x0a\x0aValid\x20keys:\x20','profile:create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','bold','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','log','split','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','Create\x20a\x20new\x20profile','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','API\x20key\x20cannot\x20be\x20empty','validate','ERROR','config','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','name','1790475UKHduP','\x20Profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','message','oauth','session','6246TQYdGy','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>','Set\x20session\x20profile','Enter\x20your\x20TD\x20API\x20key:','includes','apiKey','\x0aAvailable\x20profiles:','join','\x27\x20requires\x20API\x20key\x20validation.','dim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','status','3596AfXPzS','Removal\x20cancelled','Choose\x20authentication\x20method:','\x0aOperation\x20cancelled','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','✗\x20Validation\x20failed:\x20','database','logLevel','7083qYufPx','warn','(cleared)','test','VALID_KEYS','method','tdx.json','trim','text','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20description\x20(optional):','Profile\x20\x27','site','tdx:\x20profile\x20remove','password','\x27\x20removed\x20from\x20configuration','description','Remove\x20a\x20profile','profile:set','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20set','(session:\x20','Operation\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','error','Validating\x20API\x20key...','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20-\x20','\x20--default\x27\x20to\x20save\x20permanently','parent_segment','confirm','execute','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x0aSetup\x20cancelled','Enter\x20profile\x20name:','green','9319324iKxDSk','Set\x20a\x20profile\x20configuration\x20value','\x20\x20(no\x20profiles\x20found)','Failed\x20to\x20remove\x20profile:\x20','jobs','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Setup\x20cancelled','271428qnQOCL','tdx:\x20profile\x20create','profile:use','Site\x20was\x20not\x20changed.','27304jddeXt','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profileName','5014512LAgjAg','yellow'];a34_0x3a80=function(){return _0x58a634;};return a34_0x3a80();}import a34_0x737734 from'prompts';import a34_0x1907ae from'chalk';function validateProfileName(_0x1171ec){const _0x74810=a34_0x1b43;if(!_0x1171ec||!_0x1171ec[_0x74810(0x143)]())return _0x74810(0x156);const _0x4cfd31=_0x1171ec['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x74810(0x13f)](_0x4cfd31))return _0x74810(0x11f);if(profileExists(_0x4cfd31))return _0x74810(0x147)+_0x4cfd31+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a34_0xe1bbbd(0x10e);[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x119);async[a34_0xe1bbbd(0xe9)](_0xa4e4b5){const _0xfde55d=a34_0xe1bbbd,{options:_0x6b516,args:_0xc633f0}=_0xa4e4b5;console[_0xfde55d(0x115)](a34_0x1907ae['bold'](_0xfde55d(0xf8)));let _0x59a555;if(_0xc633f0[_0xfde55d(0x118)]>0x0&&_0xc633f0[0x0]){const _0x21f8ec=_0xc633f0[0x0][_0xfde55d(0x143)](),_0x3039d5=validateProfileName(_0x21f8ec);if(_0x3039d5!==!![])return console[_0xfde55d(0x154)](a34_0x1907ae['red'](_0x3039d5)),0x1;_0x59a555=_0x21f8ec;}else{const _0x1e0b1b=await a34_0x737734({'type':_0xfde55d(0x144),'name':_0xfde55d(0xfe),'message':_0xfde55d(0xed),'validate':validateProfileName});if(!_0x1e0b1b[_0xfde55d(0xfe)])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;_0x59a555=_0x1e0b1b[_0xfde55d(0xfe)][_0xfde55d(0x143)]();}const _0x87f3f7=await a34_0x737734({'type':_0xfde55d(0x144),'name':_0xfde55d(0x14c),'message':_0xfde55d(0x146)}),_0xcda8e8=_0x87f3f7['description']?.[_0xfde55d(0x143)]()||undefined,_0xbffbd5=_0x6b516['site']||_0xfde55d(0x10a),_0x495da8=await promptSiteSelection(_0xbffbd5,_0x59a555,_0xfde55d(0xf6));if(!_0x495da8)return 0x1;const _0x59161a=resolveSite(_0x495da8);if(isOAuthSupported(_0x59161a)){const _0x4655f5=await a34_0x737734({'type':'select','name':_0xfde55d(0x141),'message':_0xfde55d(0x136),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':'API\x20Key','value':'apikey'}]});if(!_0x4655f5['method'])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;if(_0x4655f5[_0xfde55d(0x141)]===_0xfde55d(0x126)){if(_0xcda8e8){const _0x24aa1e={'site':_0x59161a,'description':_0xcda8e8};saveProfileToUserConfig(_0x59a555,_0x24aa1e);}return await runOAuthLoginFlow(_0x59161a,_0x59a555,_0x6b516['logLevel']??LogLevel['ERROR']),0x0;}}console[_0xfde55d(0x115)](_0xfde55d(0x117)+_0x59161a),console[_0xfde55d(0x115)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xfde55d(0x115)]('\x20\x20'+getConsoleUrl(_0x59161a,'/app/mp/ak'));const _0x410f5b=await a34_0x737734({'type':'password','name':_0xfde55d(0x12d),'message':_0xfde55d(0x12b),'validate':_0x3f8fa2=>{const _0xbcc669=_0xfde55d;if(!_0x3f8fa2||!_0x3f8fa2[_0xbcc669(0x143)]())return _0xbcc669(0x11b);return!![];}});if(!_0x410f5b['apiKey'])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;const _0x137531=_0x410f5b[_0xfde55d(0x12d)];console['log'](_0xfde55d(0x155));try{const _0x2a55ac=TDX[_0xfde55d(0x111)]({'site':_0x59161a,'apiKey':_0x137531[_0xfde55d(0x143)](),'logLevel':_0x6b516[_0xfde55d(0x13b)]??LogLevel[_0xfde55d(0x11d)]}),_0x599837=await _0x2a55ac['jobs'][_0xfde55d(0x108)]();console[_0xfde55d(0x115)](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x124)+_0x599837[_0xfde55d(0xfc)]+')');const _0x2603e0=await isKeychainAvailable();_0x2603e0?(await saveAPIKeyAsync(_0x137531['trim'](),_0x59161a,_0x59a555),console['log'](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x104)+_0x59a555+')')):(console['warn'](a34_0x1907ae[_0xfde55d(0x100)](_0xfde55d(0x120))),console[_0xfde55d(0x13d)](a34_0x1907ae[_0xfde55d(0x100)](_0xfde55d(0x138))));const _0x3c9f20={'site':_0x59161a,..._0xcda8e8&&{'description':_0xcda8e8}};return saveProfileToUserConfig(_0x59a555,_0x3c9f20),console[_0xfde55d(0x115)](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x123)+_0x59a555+'\x27\x20created'),console[_0xfde55d(0x115)](),console[_0xfde55d(0x115)](_0xfde55d(0x107)),console[_0xfde55d(0x115)](_0xfde55d(0x10b)+_0x59a555+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0xfde55d(0x10b)+_0x59a555+_0xfde55d(0x153)),0x0;}catch(_0x557659){if(_0x557659 instanceof HTTPClientError&&_0x557659[_0xfde55d(0x133)]===0x191)return printAuthError(_0x557659),0x1;return console[_0xfde55d(0x154)](a34_0x1907ae[_0xfde55d(0xea)](_0xfde55d(0x139)+(_0x557659 instanceof Error?_0x557659['message']:String(_0x557659)))),console[_0xfde55d(0x154)](_0xfde55d(0x132)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]='profile:remove';[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x14d);[a34_0xe1bbbd(0x11c)](_0x1169d0){const _0x185e99=a34_0xe1bbbd,{args:_0x4c0b90}=_0x1169d0;if(_0x4c0b90['length']===0x0)return _0x185e99(0xeb);return undefined;}async[a34_0xe1bbbd(0xe9)](_0x28e3fc){const _0x3ec2e6=a34_0xe1bbbd,{args:_0x175a5d}=_0x28e3fc,_0x18dace=_0x175a5d[0x0];console[_0x3ec2e6(0x115)](a34_0x1907ae[_0x3ec2e6(0x110)](_0x3ec2e6(0x149)));if(!profileExists(_0x18dace)){console[_0x3ec2e6(0x154)](a34_0x1907ae['red'](_0x3ec2e6(0x147)+_0x18dace+_0x3ec2e6(0x114))),console[_0x3ec2e6(0x115)](_0x3ec2e6(0x12e));const _0x4c8941=listProfiles();if(_0x4c8941[_0x3ec2e6(0x118)]===0x0)console['log'](_0x3ec2e6(0xf1));else for(const _0xc1b841 of _0x4c8941){console[_0x3ec2e6(0x115)](_0x3ec2e6(0x157)+_0xc1b841['name']);}return 0x1;}const _0x4038a3=await a34_0x737734({'type':_0x3ec2e6(0xe8),'name':_0x3ec2e6(0xe8),'message':_0x3ec2e6(0xf5)+_0x18dace+'\x27?','initial':![]});if(!_0x4038a3[_0x3ec2e6(0xe8)])return console['log'](_0x3ec2e6(0x135)),0x0;try{removeProfileFromUserConfig(_0x18dace),console['log'](a34_0x1907ae[_0x3ec2e6(0xee)]('✓')+_0x3ec2e6(0x123)+_0x18dace+_0x3ec2e6(0x14b));}catch(_0x5da1be){return console[_0x3ec2e6(0x154)](a34_0x1907ae['red'](_0x3ec2e6(0xf2)+(_0x5da1be instanceof Error?_0x5da1be[_0x3ec2e6(0x125)]:String(_0x5da1be)))),0x1;}const _0x137a07=await isKeychainAvailable();if(_0x137a07){const _0x35c18f=await deleteKeychainAPIKey(_0x18dace);_0x35c18f&&console['log'](a34_0x1907ae[_0x3ec2e6(0xee)]('✓')+_0x3ec2e6(0x10f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]=a34_0xe1bbbd(0x14e);['description']=a34_0xe1bbbd(0xf0);static [a34_0xe1bbbd(0x140)]=[a34_0xe1bbbd(0x148),a34_0xe1bbbd(0x13a),a34_0xe1bbbd(0xe7),'llm_project',a34_0xe1bbbd(0x10c),a34_0xe1bbbd(0x14c)];[a34_0xe1bbbd(0x11c)](_0x3b5a23){const _0x357fe1=a34_0xe1bbbd,{args:_0x399629,options:_0x3a3751}=_0x3b5a23,_0x5caf31=_0x3a3751['profile']||getActiveProfile();if(!_0x5caf31)return _0x357fe1(0x129);if(_0x399629[_0x357fe1(0x118)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x357fe1(0x140)]['join'](',\x20');const _0xabc06d=_0x399629[0x0];if(!_0xabc06d[_0x357fe1(0x12c)]('='))return _0x357fe1(0xf4)+ProfileSetCommand[_0x357fe1(0x140)]['join'](',\x20');const [_0x4ff376]=_0xabc06d[_0x357fe1(0x116)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x4ff376))return'Unknown\x20key\x20\x27'+_0x4ff376+_0x357fe1(0x10d)+ProfileSetCommand[_0x357fe1(0x140)][_0x357fe1(0x12f)](',\x20');return undefined;}async['execute'](_0x1db378){const _0x50f8f1=a34_0xe1bbbd,{args:_0x4eeabd,options:_0xd846f2}=_0x1db378,_0x38f829=_0xd846f2[_0x50f8f1(0x109)]||getActiveProfile(),[_0x41d230,..._0x2c529b]=_0x4eeabd[0x0]['split']('='),_0x5ebb2d=_0x2c529b['join']('=');console['log'](a34_0x1907ae[_0x50f8f1(0x110)](_0x50f8f1(0x150)));if(!profileExists(_0x38f829)){const _0x2423a9=await a34_0x737734({'type':'confirm','name':'create','message':_0x50f8f1(0x147)+_0x38f829+_0x50f8f1(0x103),'initial':!![]});if(!_0x2423a9[_0x50f8f1(0x111)])return console[_0x50f8f1(0x115)](_0x50f8f1(0x152)),0x1;}const _0x17e59d=loadProfile(_0x38f829),_0x591570=_0x17e59d?.[_0x50f8f1(0x11e)]||{};if(_0x41d230===_0x50f8f1(0x148)){const _0x5b6338=resolveSite(_0x5ebb2d);console['log'](_0x50f8f1(0x102)+_0x5b6338+_0x50f8f1(0x130)),console[_0x50f8f1(0x115)](_0x50f8f1(0x145)),console[_0x50f8f1(0x115)]('\x20\x20'+getConsoleUrl(_0x5b6338,_0x50f8f1(0x105)));const _0x33775c=await a34_0x737734({'type':_0x50f8f1(0x14a),'name':_0x50f8f1(0x12d),'message':_0x50f8f1(0xfd),'validate':_0x4e11d9=>{const _0x5177b5=_0x50f8f1;if(!_0x4e11d9||!_0x4e11d9[_0x5177b5(0x143)]())return _0x5177b5(0x11b);return!![];}});if(!_0x33775c[_0x50f8f1(0x12d)])return console['log'](_0x50f8f1(0x137)),0x1;console['log'](_0x50f8f1(0x155));try{const _0x492ed8=TDX['create']({'site':_0x5b6338,'apiKey':_0x33775c[_0x50f8f1(0x12d)][_0x50f8f1(0x143)](),'logLevel':_0xd846f2[_0x50f8f1(0x13b)]??LogLevel[_0x50f8f1(0x11d)]}),_0xf7f3cb=await _0x492ed8[_0x50f8f1(0xf3)]['getUserInfo']();console['log'](a34_0x1907ae['green']('✓')+_0x50f8f1(0x124)+_0xf7f3cb[_0x50f8f1(0xfc)]+')');const _0x270403=await isKeychainAvailable();_0x270403?(await saveAPIKeyAsync(_0x33775c['apiKey'][_0x50f8f1(0x143)](),_0x5b6338,_0x38f829),console['log'](a34_0x1907ae[_0x50f8f1(0xee)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x50f8f1(0x13d)](a34_0x1907ae[_0x50f8f1(0x100)](_0x50f8f1(0x120))),_0x591570[_0x50f8f1(0x148)]=_0x5b6338;}catch(_0x7d6fc5){if(_0x7d6fc5 instanceof HTTPClientError&&_0x7d6fc5[_0x50f8f1(0x133)]===0x191)return printAuthError(_0x7d6fc5),0x1;return console[_0x50f8f1(0x154)](a34_0x1907ae['red']('✗\x20Validation\x20failed:\x20'+(_0x7d6fc5 instanceof Error?_0x7d6fc5[_0x50f8f1(0x125)]:String(_0x7d6fc5)))),console[_0x50f8f1(0x154)](_0x50f8f1(0xfa)),0x1;}}else _0x591570[_0x41d230]=_0x5ebb2d||undefined;return saveProfileToUserConfig(_0x38f829,_0x591570),console[_0x50f8f1(0x115)](a34_0x1907ae[_0x50f8f1(0xee)]('✓')+_0x50f8f1(0x123)+_0x38f829+_0x50f8f1(0x113)+_0x41d230+'='+(_0x5ebb2d||_0x50f8f1(0x13e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]=a34_0xe1bbbd(0xf9);[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x12a);[a34_0xe1bbbd(0x11c)](_0x18865c){const _0x593302=a34_0xe1bbbd,{args:_0x22ab7b}=_0x18865c;if(_0x22ab7b[_0x593302(0x118)]===0x0)return _0x593302(0x11a);return undefined;}async[a34_0xe1bbbd(0xe9)](_0x4c64b2){const _0x26b63b=a34_0xe1bbbd,{args:_0x1b9bb9,options:_0x40950f}=_0x4c64b2,_0x5d6f61=_0x1b9bb9[0x0],_0x19a73e=_0x40950f[_0x26b63b(0x106)];cleanExpiredSessions();if(!profileExists(_0x5d6f61)){console[_0x26b63b(0x154)](a34_0x1907ae['red'](_0x26b63b(0x147)+_0x5d6f61+_0x26b63b(0x114))),console[_0x26b63b(0x115)](_0x26b63b(0x12e));const _0x3dc767=listProfiles();if(_0x3dc767['length']===0x0)console[_0x26b63b(0x115)](_0x26b63b(0xf1));else for(const _0x277f75 of _0x3dc767){console[_0x26b63b(0x115)](_0x26b63b(0x157)+_0x277f75[_0x26b63b(0x121)]);}return 0x1;}if(_0x19a73e){const _0x33aa4f=a34_0x2edced[_0x26b63b(0x12f)](getConfigDir(),_0x26b63b(0x142));return saveActiveProfileToUserConfig(_0x5d6f61),console[_0x26b63b(0x115)](_0x26b63b(0x14f)+a34_0x1907ae[_0x26b63b(0xee)](_0x5d6f61)),console[_0x26b63b(0x115)](a34_0x1907ae[_0x26b63b(0x131)]('\x0aSaved\x20to:\x20'+_0x33aa4f)),0x0;}const _0xc6878d=getSessionID(_0x40950f['session']);return saveSessionContext({'profile':_0x5d6f61},_0x40950f[_0x26b63b(0x127)]),console[_0x26b63b(0x115)]('Session\x20profile\x20set\x20to:\x20'+a34_0x1907ae['green'](_0x5d6f61)+'\x20'+a34_0x1907ae[_0x26b63b(0x131)](_0x26b63b(0x151)+_0xc6878d+')')),console['log'](a34_0x1907ae['dim'](_0x26b63b(0x112)+_0x5d6f61+_0x26b63b(0x158))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x4a4914=a35_0x2677;function a35_0x4a30(){const _0x516c7f=['map','description','97302oNndum','159894QxAGha','green','profiles','site','Error:\x20','dim','execute','name','276nEkvsO','2830554eVqZjp','28TlVsOT','log','config','👤\x20','819159jMjLQY','scope','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','56XVPQTI','145kxVVZe','269223khQJSt','\x20\x20Global:\x20~/.config/tdx/tdx.json','error','20eRMrWk','574847RFkfRX','798343Dxwemn','List\x20all\x20available\x20profiles'];a35_0x4a30=function(){return _0x516c7f;};return a35_0x4a30();}(function(_0x4c5a0f,_0x1aa476){const _0x1925a7=a35_0x2677,_0x269ee3=_0x4c5a0f();while(!![]){try{const _0x3216e7=-parseInt(_0x1925a7(0xdd))/0x1+-parseInt(_0x1925a7(0xe2))/0x2+-parseInt(_0x1925a7(0xd8))/0x3*(-parseInt(_0x1925a7(0xcf))/0x4)+-parseInt(_0x1925a7(0xd7))/0x5*(parseInt(_0x1925a7(0xe1))/0x6)+parseInt(_0x1925a7(0xdc))/0x7*(parseInt(_0x1925a7(0xd6))/0x8)+-parseInt(_0x1925a7(0xce))/0x9*(parseInt(_0x1925a7(0xdb))/0xa)+parseInt(_0x1925a7(0xd3))/0xb*(parseInt(_0x1925a7(0xcd))/0xc);if(_0x3216e7===_0x1aa476)break;else _0x269ee3['push'](_0x269ee3['shift']());}catch(_0x52d228){_0x269ee3['push'](_0x269ee3['shift']());}}}(a35_0x4a30,0xe50f2));function a35_0x2677(_0x7cea6c,_0x341600){_0x7cea6c=_0x7cea6c-0xcb;const _0x4a30d4=a35_0x4a30();let _0x26773e=_0x4a30d4[_0x7cea6c];return _0x26773e;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x149bcc from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x4a4914(0xcc)]=a35_0x4a4914(0xe4);[a35_0x4a4914(0xe0)]=a35_0x4a4914(0xde);async[a35_0x4a4914(0xcb)](_0xaaf4bf){const _0x54c5f6=a35_0x4a4914,{options:_0xe32e8b}=_0xaaf4bf;try{const _0x5ab329=listProfiles(),_0x249b62=getActiveProfile();if(_0x5ab329['length']===0x0)return console[_0x54c5f6(0xd0)](_0x54c5f6(0xd5)),console[_0x54c5f6(0xd0)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x54c5f6(0xd0)](_0x54c5f6(0xd9)),0x0;const _0x5127e7=_0x5ab329[_0x54c5f6(0xdf)](_0x50c79c=>{const _0x230261=_0x54c5f6,_0x42ba29=_0x50c79c[_0x230261(0xcc)]===_0x249b62,_0xc25314=getProfileParams(_0x50c79c[_0x230261(0xd1)]);return{'name':_0x50c79c[_0x230261(0xcc)],'active':_0x42ba29,'scope':_0x50c79c[_0x230261(0xd4)],'description':_0x50c79c[_0x230261(0xd1)][_0x230261(0xe0)]||'','params':_0xc25314};});if(isStructuredFormat(_0xe32e8b))await handleSDKOutput(_0x5127e7,_0xe32e8b);else for(const _0x285975 of _0x5ab329){const _0x25698f=_0x285975['name']===_0x249b62?a35_0x149bcc[_0x54c5f6(0xe3)]('\x20✓'):'',_0x4101cf=_0x285975[_0x54c5f6(0xd1)][_0x54c5f6(0xe5)]?a35_0x149bcc['dim']('\x20'+_0x285975[_0x54c5f6(0xd1)]['site']):'',_0x2f479c=_0x285975[_0x54c5f6(0xd1)]['description']?a35_0x149bcc[_0x54c5f6(0xe7)]('\x20\x20'+_0x285975[_0x54c5f6(0xd1)][_0x54c5f6(0xe0)]):'';console[_0x54c5f6(0xd0)](_0x54c5f6(0xd2)+_0x285975[_0x54c5f6(0xcc)]+_0x25698f+_0x4101cf+_0x2f479c);}return 0x0;}catch(_0x2de343){return _0x2de343 instanceof Error&&console[_0x54c5f6(0xda)](_0x54c5f6(0xe6)+_0x2de343['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x56fa18=a36_0x352a;function a36_0x352a(_0x317d56,_0x40c168){_0x317d56=_0x317d56-0xef;const _0x5fc5f0=a36_0x5fc5();let _0x352a43=_0x5fc5f0[_0x317d56];return _0x352a43;}(function(_0xd5e62c,_0x52cdfa){const _0x8cd1a2=a36_0x352a,_0x4d448f=_0xd5e62c();while(!![]){try{const _0x39c5e2=-parseInt(_0x8cd1a2(0x104))/0x1*(-parseInt(_0x8cd1a2(0x11e))/0x2)+parseInt(_0x8cd1a2(0xef))/0x3+parseInt(_0x8cd1a2(0x11d))/0x4+-parseInt(_0x8cd1a2(0xf3))/0x5+-parseInt(_0x8cd1a2(0xf6))/0x6+parseInt(_0x8cd1a2(0x105))/0x7+-parseInt(_0x8cd1a2(0x11c))/0x8;if(_0x39c5e2===_0x52cdfa)break;else _0x4d448f['push'](_0x4d448f['shift']());}catch(_0x375bb6){_0x4d448f['push'](_0x4d448f['shift']());}}}(a36_0x5fc5,0x94af4));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a36_0x5fc5(){const _0x19da2d=['elapsedTimeMillis','Query\x20completed:\x20Processed\x20','catalog','jobId','state','verbose','join','query','push','options','Schema:\x20','No\x20SQL\x20provided','15231992gsZrGG','3765456xtFmQt','2085422PgRMii','Executing\x20statement\x20','error','2161707DpqViA','information_schema','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','setPhase','2908200FCfHtm','output','site','2104962QTKnnD','validate','description','SQL:\x20','in\x20','name','args','Statement\x20','\x20rows\x20','stats','data','Catalog:\x20','processedRows','file','1GtLGxZ','5185838nVauYt','length','execute','message','originalMessage','setJobId','database','...','completedSplits','totalSplits','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'];a36_0x5fc5=function(){return _0x19da2d;};return a36_0x5fc5();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x56fa18(0xfb)]=a36_0x56fa18(0x117);[a36_0x56fa18(0xf8)]='Run\x20Trino\x20queries\x20(streaming)';async[a36_0x56fa18(0x107)](_0x1f68a3){const _0x45a5f8=a36_0x56fa18,{options:_0x34cfdf,args:_0x2d9a8b,tdx:_0x3e2a30}=_0x1f68a3,_0x1f6d9e={..._0x34cfdf,'limitStructuredFormats':!![]},_0x128729=_0x2d9a8b[0x0],_0x47edeb=_0x34cfdf[_0x45a5f8(0x103)];let _0x256011;try{if(_0x47edeb)_0x256011=readSqlStatementsFromFile(_0x47edeb);else{if(_0x128729==='-')_0x256011=await readSqlStatementsFromStdin();else{if(_0x128729&&isSqlFilePath(_0x128729))_0x256011=readSqlStatementsFromFile(_0x128729);else{if(_0x128729)_0x256011=splitSqlStatements(_0x128729);else throw new Error(_0x45a5f8(0x11b));}}}}catch(_0x512fd2){return console[_0x45a5f8(0x120)]('Error:\x20'+_0x512fd2[_0x45a5f8(0x108)]),0x1;}const _0x2184ea=_0x34cfdf[_0x45a5f8(0x10b)]||_0x45a5f8(0xf0),_0x2b0d4c=_0x34cfdf[_0x45a5f8(0x112)];try{const _0x3dd8e5=[],_0x3873dc=!!_0x34cfdf[_0x45a5f8(0xf4)];for(let _0x11839f=0x0;_0x11839f<_0x256011[_0x45a5f8(0x106)];_0x11839f++){const _0x319297=_0x256011[_0x11839f],_0x92c51e=_0x11839f+0x1,_0x27f099=_0x256011[_0x45a5f8(0x106)],_0x1832d1=_0x27f099>0x1;_0x34cfdf[_0x45a5f8(0x115)]&&(console[_0x45a5f8(0x120)]('\x0a'+(_0x1832d1?'Statement\x20'+_0x92c51e+'/'+_0x27f099+':':'')),console[_0x45a5f8(0x120)]('Site:\x20'+_0x34cfdf[_0x45a5f8(0xf5)]),console[_0x45a5f8(0x120)](_0x45a5f8(0x101)+(_0x2b0d4c||'td')),console[_0x45a5f8(0x120)](_0x45a5f8(0x11a)+_0x2184ea),console[_0x45a5f8(0x120)](_0x45a5f8(0xf9)+_0x319297));const _0xe57d01=_0x1832d1?_0x45a5f8(0x11f)+_0x92c51e+'/'+_0x27f099+_0x45a5f8(0x10c):'Executing\x20query...';try{const _0x182230=await withProgressSpinner(_0xe57d01,async _0x27e290=>{const _0x36c07f=_0x45a5f8,_0x1f54a0=await _0x3e2a30[_0x36c07f(0x117)][_0x36c07f(0x107)](_0x319297,{'catalog':_0x2b0d4c,'schema':_0x2184ea,'onJobId':_0x3d52bc=>{const _0x4a5439=_0x36c07f;_0x27e290[_0x4a5439(0x10a)](_0x3d52bc);},'onProgress':_0x27b820=>{const _0x5a096d=_0x36c07f;_0x27e290[_0x5a096d(0xf2)]('Executing\x20query\x20['+_0x27b820[_0x5a096d(0x114)]+']'),_0x27e290['setExtra'](formatRows(_0x27b820[_0x5a096d(0x102)])+'\x20rows\x20'+_0x27b820[_0x5a096d(0x10d)]+'/'+_0x27b820[_0x5a096d(0x10e)]+'\x20splits');}});return _0x1f54a0;},{'verbose':_0x34cfdf[_0x45a5f8(0x115)]}),_0x3d7bfc=_0x182230[_0x45a5f8(0x100)],_0x253bcd=_0x3d7bfc[_0x45a5f8(0x113)]?'\x20[Job\x20ID:\x20'+_0x3d7bfc[_0x45a5f8(0x113)]+']':'',_0x4f6006=_0x1832d1?'Statement\x20'+_0x92c51e+'/'+_0x27f099+'\x20-\x20':'';console['error']('✔\x20'+_0x4f6006+_0x45a5f8(0x111)+formatRows(_0x3d7bfc[_0x45a5f8(0xff)][_0x45a5f8(0x102)])+_0x45a5f8(0xfe)+(_0x45a5f8(0xfa)+formatElapsed(_0x3d7bfc[_0x45a5f8(0xff)][_0x45a5f8(0x110)])+_0x253bcd));if(_0x1832d1&&_0x3873dc){const _0x44732c=resolveOutputOptions(_0x1f6d9e),_0x53d095=await formatQueryOutput(_0x3d7bfc,_0x44732c);_0x3dd8e5[_0x45a5f8(0x118)](_0x53d095);}else await handleQueryOutput(_0x3d7bfc,_0x1f6d9e);}catch(_0x45af75){const _0x3684fc=_0x1832d1?_0x45a5f8(0xfd)+_0x92c51e+'/'+_0x27f099+':\x0a':'',_0x179b9b=_0x45af75 instanceof SDKError?_0x45af75[_0x45a5f8(0x109)]:_0x45af75[_0x45a5f8(0x108)];return console[_0x45a5f8(0x120)](''+_0x3684fc+_0x179b9b),0x1;}}if(_0x256011[_0x45a5f8(0x106)]>0x1&&_0x3873dc&&_0x3dd8e5[_0x45a5f8(0x106)]>0x0){const _0x2065ff=_0x3dd8e5[_0x45a5f8(0x116)]('\x0a');writeFileSync(_0x34cfdf['output'],_0x2065ff),console[_0x45a5f8(0x120)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x34cfdf[_0x45a5f8(0xf4)]);}return 0x0;}catch(_0xdf0fb4){throw _0xdf0fb4;}}[a36_0x56fa18(0xf7)](_0x4cafa3){const _0x475ec9=a36_0x56fa18,_0x265e96=_0x4cafa3[_0x475ec9(0xfc)][0x0],_0x4faf87=_0x4cafa3[_0x475ec9(0x119)]['file'];if(!_0x265e96&&!_0x4faf87)return _0x475ec9(0x10f);if(_0x265e96&&_0x4faf87)return _0x475ec9(0xf1);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x46ec0e=a37_0x4484;(function(_0x2c1b32,_0x2d03b0){const _0x405bf9=a37_0x4484,_0x1eaf28=_0x2c1b32();while(!![]){try{const _0x5b97de=parseInt(_0x405bf9(0x1ca))/0x1+parseInt(_0x405bf9(0x18d))/0x2+-parseInt(_0x405bf9(0x1aa))/0x3*(parseInt(_0x405bf9(0x1d7))/0x4)+-parseInt(_0x405bf9(0x164))/0x5+parseInt(_0x405bf9(0x1c0))/0x6*(-parseInt(_0x405bf9(0x1ad))/0x7)+parseInt(_0x405bf9(0x173))/0x8+parseInt(_0x405bf9(0x157))/0x9;if(_0x5b97de===_0x2d03b0)break;else _0x1eaf28['push'](_0x1eaf28['shift']());}catch(_0x12ccb9){_0x1eaf28['push'](_0x1eaf28['shift']());}}}(a37_0x3889,0xc8515));function a37_0x4484(_0x3c88e8,_0x430a18){_0x3c88e8=_0x3c88e8-0x146;const _0x38895f=a37_0x3889();let _0x4484fb=_0x38895f[_0x3c88e8];return _0x4484fb;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x2f87b1 from'chalk';function formatRelativeTime(_0x3744ae){const _0x4f35d3=a37_0x4484,_0x582397=new Date(_0x3744ae),_0x429217=new Date(),_0x35b402=_0x582397[_0x4f35d3(0x1b0)]()-_0x429217[_0x4f35d3(0x1b0)](),_0x17c702=Math[_0x4f35d3(0x19b)](_0x35b402)/0x3e8,_0x58e119=_0x35b402<0x0;if(_0x17c702<0x3c)return _0x58e119?'just\x20now':'soon';else{if(_0x17c702<0xe10){const _0x3cea00=Math[_0x4f35d3(0x17a)](_0x17c702/0x3c);return _0x58e119?_0x3cea00+_0x4f35d3(0x1c2):_0x4f35d3(0x181)+_0x3cea00+'m';}else{if(_0x17c702<0x15180){const _0x4f5a65=Math[_0x4f35d3(0x17a)](_0x17c702/0xe10);return _0x58e119?_0x4f5a65+_0x4f35d3(0x189):_0x4f35d3(0x181)+_0x4f5a65+'h';}else{if(_0x17c702<0x93a80){const _0xc836fd=Math[_0x4f35d3(0x17a)](_0x17c702/0x15180);return _0x58e119?_0xc836fd+_0x4f35d3(0x18c):_0x4f35d3(0x181)+_0xc836fd+'d';}else return _0x582397[_0x4f35d3(0x194)]();}}}}function a37_0x3889(){const _0x2b4be8=['656910hNuDTI','utf-8','log','\x20\x20→\x20','engineVersion','query','start_at','schedule:delete','green','\x20(showing\x20','Creating\x20schedule...','history','jsonl','5324eVCnbm','Running\x20schedule:\x20','trim','\x20\x20Time:\x20','\x20scheduled\x20quer','run','args','ended_at','never','success','\x20job','keys','show','limit','delay','cron','status','Listing\x20scheduled\x20queries...','options','3061242ItwUSz','created_at','statusIcon','delete','execute','Show\x20schedule\x20execution\x20history','pagination','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','site','output','schedule:create','\x22...','engine_version','1639420xUmdRH','Cancelled','listQueries','No\x20scheduled\x20queries\x20found','Updating\x20schedule...','\x20\x20Type:\x20','\x20execution','user','padEnd','Failed\x20to\x20read\x20file:\x20','from','lastRun','\x20schedules','schedule:list','retry_limit','4364176cFELqQ','...','data','last_job','queryUrl','format','\x20matching\x20\x22','round','\x20\x20Database:\x20','priority','Getting\x20schedule\x20history...','error','validate','Running\x20schedule...','in\x20','schedule:history','max','dim','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','trino','Query\x20file\x20is\x20empty','h\x20ago','verbose','repeat','d\x20ago','2190298HKjsAJ','type','json','time_zone','num','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','ies','toLocaleDateString','jobs','schedules','Found\x20','timezone','Schedule\x20updated:\x20','\x20(use\x20--limit\x20to\x20see\x20more)','abs','Run\x20a\x20scheduled\x20query\x20immediately','(unnamed)','update','file','nextRun','name','Updating\x20schedule:\x20','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','length','Showing\x20first\x20','substring','Schedule\x20created:\x20','retryLimit','2166EOMfjV','Update\x20a\x20scheduled\x20query','/app/queries/editor?queryId=','2926OooCSX','Show\x20schedule\x20details','INVALID_ARGUMENT','getTime','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','description','Deleting\x20schedule...','Creating\x20schedule:\x20','entries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','red','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','map','result','Schedule\x20deleted:\x20','create','scheduled_at','next_run_at','join','7584WJkOEL','database','m\x20ago','cyan','schedule:run','executing_user_id','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','user_name','schedule:update'];a37_0x3889=function(){return _0x2b4be8;};return a37_0x3889();}export class ScheduleListCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x171);[a37_0x46ec0e(0x1b2)]='List\x20scheduled\x20queries';async[a37_0x46ec0e(0x15b)](_0x9442c3){const _0x1c2c89=a37_0x46ec0e,{options:_0x16d341,args:_0x17eaea,tdx:_0x578778}=_0x9442c3,_0x3830ad=resolveLimit(_0x16d341[_0x1c2c89(0x151)],DEFAULT_DISPLAY_LIMIT),_0x172381=_0x17eaea[0x0],_0x312366=_0x172381?_0x1c2c89(0x1a4)+_0x172381+_0x1c2c89(0x162):_0x1c2c89(0x155),_0x781079=await withSpinner(_0x312366,()=>_0x578778[_0x1c2c89(0x196)][_0x1c2c89(0x166)]({'limit':_0x3830ad,'scheduled':!![],'pattern':_0x172381}),{'verbose':_0x16d341[_0x1c2c89(0x18a)]}),_0x569949=_0x781079['data']['queries'],_0x37ba39=_0x781079[_0x1c2c89(0x175)][_0x1c2c89(0x15d)]['has_next_page'],_0x868081=_0x172381?_0x1c2c89(0x179)+_0x172381+'\x22':'';_0x37ba39?console['error'](_0x1c2c89(0x1a6)+_0x569949[_0x1c2c89(0x1a5)]+_0x1c2c89(0x170)+_0x868081+_0x1c2c89(0x19a)):console[_0x1c2c89(0x17e)]('Found\x20'+_0x569949[_0x1c2c89(0x1a5)]+_0x1c2c89(0x148)+(_0x569949['length']!==0x1?_0x1c2c89(0x193):'y')+_0x868081);if(_0x16d341[_0x1c2c89(0x178)]===_0x1c2c89(0x18f)||_0x16d341[_0x1c2c89(0x178)]===_0x1c2c89(0x1d6)||_0x16d341[_0x1c2c89(0x178)]==='table'||_0x16d341[_0x1c2c89(0x178)]==='tsv'){const _0x15a503=_0x569949['map'](_0x4c76e9=>({'id':_0x4c76e9['id'],'name':_0x4c76e9[_0x1c2c89(0x1a1)],'cron':_0x4c76e9[_0x1c2c89(0x153)],'database':_0x4c76e9[_0x1c2c89(0x1c1)]?.[_0x1c2c89(0x1a1)],'type':_0x4c76e9['type'],'timezone':_0x4c76e9[_0x1c2c89(0x190)],'user_name':_0x4c76e9[_0x1c2c89(0x16b)]?.[_0x1c2c89(0x1a1)],'updated_at':_0x4c76e9['updated_at'],'next_run_at':_0x4c76e9[_0x1c2c89(0x1be)],'last_job_status':_0x4c76e9[_0x1c2c89(0x176)]?.[_0x1c2c89(0x154)]}));await handleSDKOutput(_0x15a503,_0x16d341);}else{if(_0x569949[_0x1c2c89(0x1a5)]===0x0)console[_0x1c2c89(0x1cc)](_0x1c2c89(0x167));else{const _0xd032fd=_0x16d341[_0x1c2c89(0x15f)],_0x4d067c=_0x569949['map'](_0x128bdf=>{const _0x4c0b5b=_0x1c2c89,_0x42790b=_0x128bdf[_0x4c0b5b(0x176)]?.[_0x4c0b5b(0x154)]?_0x128bdf[_0x4c0b5b(0x176)][_0x4c0b5b(0x154)]===_0x4c0b5b(0x14d)?'✓':'✗':'-',_0x5e1f1c=_0x128bdf[_0x4c0b5b(0x176)]?.[_0x4c0b5b(0x14b)]?formatRelativeTime(_0x128bdf['last_job'][_0x4c0b5b(0x14b)]):_0x4c0b5b(0x14c),_0x1230c8=_0x128bdf[_0x4c0b5b(0x1be)]?formatRelativeTime(_0x128bdf[_0x4c0b5b(0x1be)]):'-',_0x36df1c=_0x128bdf['cron']||'',_0x5b53aa=_0x128bdf[_0x4c0b5b(0x1a1)]||_0x4c0b5b(0x19d),_0x5baf4d=getConsoleUrl(_0xd032fd,_0x4c0b5b(0x1ac)+_0x128bdf['id']);return{'statusIcon':_0x42790b,'lastRun':_0x5e1f1c,'nextRun':_0x1230c8,'cron':_0x36df1c,'name':_0x5b53aa,'queryUrl':_0x5baf4d,'status':_0x128bdf['last_job']?.['status']};}),_0x4abf61=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x56ee79=>_0x56ee79[_0x1c2c89(0x16f)][_0x1c2c89(0x1a5)])),_0x1b21e4=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x37d4ac=>_0x37d4ac[_0x1c2c89(0x1a0)][_0x1c2c89(0x1a5)])),_0x4618cd=Math[_0x1c2c89(0x183)](..._0x4d067c[_0x1c2c89(0x1b9)](_0x288213=>_0x288213[_0x1c2c89(0x153)][_0x1c2c89(0x1a5)])),_0x4b5844=_0x4d067c[_0x1c2c89(0x1b9)](_0xb23bf9=>{const _0x408e3d=_0x1c2c89,_0x46c6c=_0xb23bf9['status']===_0x408e3d(0x14d)?a37_0x2f87b1[_0x408e3d(0x1d2)](_0xb23bf9[_0x408e3d(0x159)]):_0xb23bf9[_0x408e3d(0x154)]==='error'?a37_0x2f87b1[_0x408e3d(0x1b7)](_0xb23bf9['statusIcon']):a37_0x2f87b1[_0x408e3d(0x184)](_0xb23bf9['statusIcon']),_0x205b02=_0xb23bf9['lastRun'][_0x408e3d(0x16c)](_0x4abf61),_0x42eeda=_0xb23bf9['nextRun'][_0x408e3d(0x16c)](_0x1b21e4),_0xb36d70=_0xb23bf9[_0x408e3d(0x153)]?a37_0x2f87b1[_0x408e3d(0x1c3)](_0xb23bf9[_0x408e3d(0x153)]['padEnd'](_0x4618cd)):'\x20'[_0x408e3d(0x18b)](_0x4618cd),_0x1bca3e=hyperlink(_0xb23bf9[_0x408e3d(0x1a1)],_0xb23bf9[_0x408e3d(0x177)]);return _0x408e3d(0x185)+_0x46c6c+'\x20'+_0x205b02+_0x408e3d(0x1cd)+_0x42eeda+'\x20\x20'+_0xb36d70+'\x20\x20'+_0x1bca3e;});await writeOutput(_0x4b5844[_0x1c2c89(0x1bf)]('\x0a'),_0x16d341[_0x1c2c89(0x160)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x1ae);[a37_0x46ec0e(0x17f)](_0x29f9e7){const _0x4ea7d=a37_0x46ec0e,_0x5a6728=_0x29f9e7[_0x4ea7d(0x14a)][0x0];if(!_0x5a6728)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a37_0x46ec0e(0x15b)](_0x212c5f){const _0x3b147e=a37_0x46ec0e,{options:_0x307499,args:_0xa9eed5,tdx:_0x369a5c}=_0x212c5f,_0xc57994=_0xa9eed5[0x0],_0xd445d3=await withSpinner('Getting\x20schedule\x20details...',()=>_0x369a5c['schedules'][_0x3b147e(0x150)](_0xc57994),{'verbose':_0x307499[_0x3b147e(0x18a)]}),_0x2e6720=_0xd445d3[_0x3b147e(0x175)],_0x5efbb5={'name':_0x2e6720[_0x3b147e(0x1a1)],'cron':_0x2e6720[_0x3b147e(0x153)],'database':_0x2e6720[_0x3b147e(0x1c1)],'type':_0x2e6720[_0x3b147e(0x18e)],'timezone':_0x2e6720[_0x3b147e(0x198)],'user_name':_0x2e6720[_0x3b147e(0x1c8)],'created_at':_0x2e6720[_0x3b147e(0x158)],'engine_version':_0x2e6720[_0x3b147e(0x163)],'executing_user_id':_0x2e6720[_0x3b147e(0x1c5)],'query':_0x2e6720[_0x3b147e(0x1cf)],'delay':_0x2e6720[_0x3b147e(0x152)],'priority':_0x2e6720[_0x3b147e(0x17c)],'retry_limit':_0x2e6720[_0x3b147e(0x172)],..._0x2e6720['result']&&{'result':_0x2e6720[_0x3b147e(0x1ba)]}};return await handleSingleObjectOutput(_0x5efbb5,_0x307499),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x161);[a37_0x46ec0e(0x1b2)]='Create\x20a\x20scheduled\x20query';['validate'](_0x279565){const _0x2a8301=a37_0x46ec0e,_0x1f094c=_0x279565[_0x2a8301(0x14a)][0x0];if(!_0x1f094c)return _0x2a8301(0x1c7);const _0x53b698=_0x279565[_0x2a8301(0x156)];if(!_0x53b698[_0x2a8301(0x1c1)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x311691){const _0x41fd79=a37_0x46ec0e,{options:_0x326bf6,args:_0x536f6d,tdx:_0xf47cba}=_0x311691,_0x449e14=_0x536f6d[0x0],_0x542b61=_0x326bf6,_0x13a1dc=_0x542b61['database'],_0x2fba22=_0x542b61['file'],_0x31c135=_0x542b61[_0x41fd79(0x18e)]||_0x41fd79(0x187);let _0x3de8f3;try{_0x3de8f3=readFileSync(_0x2fba22,_0x41fd79(0x1cb))['trim']();}catch(_0x24a117){throw new SDKError(ErrorCode[_0x41fd79(0x1af)],_0x41fd79(0x16d)+_0x2fba22,_0x24a117 instanceof Error?_0x24a117:undefined);}if(!_0x3de8f3)throw new SDKError(ErrorCode[_0x41fd79(0x1af)],_0x41fd79(0x188));const _0x215d33={'database':_0x13a1dc,'query':_0x3de8f3,'type':_0x31c135};if(_0x542b61[_0x41fd79(0x153)])_0x215d33[_0x41fd79(0x153)]=_0x542b61['cron'];if(_0x542b61[_0x41fd79(0x198)])_0x215d33[_0x41fd79(0x198)]=_0x542b61[_0x41fd79(0x198)];if(_0x542b61['delay']!==undefined)_0x215d33[_0x41fd79(0x152)]=Number(_0x542b61[_0x41fd79(0x152)]);if(_0x542b61[_0x41fd79(0x17c)]!==undefined)_0x215d33[_0x41fd79(0x17c)]=Number(_0x542b61[_0x41fd79(0x17c)]);if(_0x542b61['retryLimit']!==undefined)_0x215d33[_0x41fd79(0x172)]=Number(_0x542b61[_0x41fd79(0x1a9)]);if(_0x542b61[_0x41fd79(0x1ce)])_0x215d33[_0x41fd79(0x163)]=_0x542b61[_0x41fd79(0x1ce)];if(_0x542b61[_0x41fd79(0x1ba)])_0x215d33[_0x41fd79(0x1ba)]=_0x542b61[_0x41fd79(0x1ba)];if(_0x326bf6[_0x41fd79(0x18a)]){console[_0x41fd79(0x17e)](_0x41fd79(0x1b4)+_0x449e14),console[_0x41fd79(0x17e)](_0x41fd79(0x17b)+_0x13a1dc),console[_0x41fd79(0x17e)](_0x41fd79(0x169)+_0x31c135);if(_0x215d33['cron'])console[_0x41fd79(0x17e)]('\x20\x20Cron:\x20'+_0x215d33[_0x41fd79(0x153)]);if(_0x215d33[_0x41fd79(0x198)])console[_0x41fd79(0x17e)]('\x20\x20Timezone:\x20'+_0x215d33[_0x41fd79(0x198)]);}const _0x3a65e5=await withSpinner(_0x41fd79(0x1d4),()=>_0xf47cba[_0x41fd79(0x196)][_0x41fd79(0x1bc)](_0x449e14,_0x215d33),{'verbose':_0x326bf6[_0x41fd79(0x18a)]});return console['error'](_0x41fd79(0x1a8)+_0x3a65e5['data'][_0x41fd79(0x1a1)]),await handleSingleObjectOutput(_0x3a65e5['data'],_0x326bf6),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1c9);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x1ab);[a37_0x46ec0e(0x17f)](_0x418761){const _0x1a39ed=a37_0x46ec0e,_0x31501a=_0x418761[_0x1a39ed(0x14a)][0x0];if(!_0x31501a)return _0x1a39ed(0x1b8);return undefined;}async['execute'](_0x5f28e6){const _0x14c338=a37_0x46ec0e,{options:_0x441f61,args:_0x4ef376,tdx:_0x57f94c}=_0x5f28e6,_0x44fe19=_0x4ef376[0x0],_0x5e9c2e=_0x441f61,_0x533e5d={};if(_0x5e9c2e['database'])_0x533e5d['database']=_0x5e9c2e['database'];if(_0x5e9c2e['type'])_0x533e5d[_0x14c338(0x18e)]=_0x5e9c2e['type'];if(_0x5e9c2e[_0x14c338(0x153)])_0x533e5d[_0x14c338(0x153)]=_0x5e9c2e[_0x14c338(0x153)];if(_0x5e9c2e[_0x14c338(0x198)])_0x533e5d['timezone']=_0x5e9c2e['timezone'];if(_0x5e9c2e[_0x14c338(0x152)]!==undefined)_0x533e5d[_0x14c338(0x152)]=Number(_0x5e9c2e['delay']);if(_0x5e9c2e['priority']!==undefined)_0x533e5d[_0x14c338(0x17c)]=Number(_0x5e9c2e[_0x14c338(0x17c)]);if(_0x5e9c2e[_0x14c338(0x1a9)]!==undefined)_0x533e5d[_0x14c338(0x172)]=Number(_0x5e9c2e['retryLimit']);if(_0x5e9c2e[_0x14c338(0x1ce)])_0x533e5d[_0x14c338(0x163)]=_0x5e9c2e[_0x14c338(0x1ce)];if(_0x5e9c2e['result'])_0x533e5d[_0x14c338(0x1ba)]=_0x5e9c2e[_0x14c338(0x1ba)];if(_0x5e9c2e[_0x14c338(0x19f)])try{_0x533e5d[_0x14c338(0x1cf)]=readFileSync(_0x5e9c2e[_0x14c338(0x19f)],_0x14c338(0x1cb))[_0x14c338(0x146)]();}catch(_0x45e41f){throw new SDKError(ErrorCode[_0x14c338(0x1af)],_0x14c338(0x16d)+_0x5e9c2e['file'],_0x45e41f instanceof Error?_0x45e41f:undefined);}if(Object[_0x14c338(0x14f)](_0x533e5d)[_0x14c338(0x1a5)]===0x0)throw new SDKError(ErrorCode[_0x14c338(0x1af)],_0x14c338(0x192));if(_0x441f61['verbose']){console['error'](_0x14c338(0x1a2)+_0x44fe19);for(const [_0x8ec899,_0x5d852f]of Object[_0x14c338(0x1b5)](_0x533e5d)){_0x8ec899==='query'?console[_0x14c338(0x17e)]('\x20\x20'+_0x8ec899+':\x20'+_0x5d852f[_0x14c338(0x1a7)](0x0,0x32)+_0x14c338(0x174)):console['error']('\x20\x20'+_0x8ec899+':\x20'+_0x5d852f);}}const _0x3aa91e=await withSpinner(_0x14c338(0x168),()=>_0x57f94c['schedules'][_0x14c338(0x19e)](_0x44fe19,_0x533e5d),{'verbose':_0x441f61[_0x14c338(0x18a)]});return console['error'](_0x14c338(0x199)+_0x3aa91e['data'][_0x14c338(0x1a1)]),await handleSingleObjectOutput(_0x3aa91e[_0x14c338(0x175)],_0x441f61),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1d1);['description']='Delete\x20a\x20scheduled\x20query';[a37_0x46ec0e(0x17f)](_0x1ef7e5){const _0x5e6972=a37_0x46ec0e,_0x15d576=_0x1ef7e5[_0x5e6972(0x14a)][0x0];if(!_0x15d576)return _0x5e6972(0x186);return undefined;}async[a37_0x46ec0e(0x15b)](_0x2481dc){const _0x35cc82=a37_0x46ec0e,{options:_0x1c333b,args:_0x54de57,tdx:_0x5527f6}=_0x2481dc,_0x33210f=_0x54de57[0x0];if(!_0x1c333b['yes']){const _0x33a29f=await confirm(_0x35cc82(0x15e)+_0x33210f+'\x22?');if(!_0x33a29f)return console[_0x35cc82(0x17e)](_0x35cc82(0x165)),0x0;}const _0x15d4f6=await withSpinner(_0x35cc82(0x1b3),()=>_0x5527f6['schedules'][_0x35cc82(0x15a)](_0x33210f),{'verbose':_0x1c333b[_0x35cc82(0x18a)]});return console[_0x35cc82(0x17e)](_0x35cc82(0x1bb)+_0x15d4f6[_0x35cc82(0x175)][_0x35cc82(0x1a1)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x1c4);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x19c);['validate'](_0x460e31){const _0x1ced06=a37_0x46ec0e,_0x322a46=_0x460e31[_0x1ced06(0x14a)][0x0];if(!_0x322a46)return _0x1ced06(0x1b1);return undefined;}async[a37_0x46ec0e(0x15b)](_0x438237){const _0x29f52a=a37_0x46ec0e,{options:_0x3cc767,args:_0x264dc5,tdx:_0x323911}=_0x438237,_0x19d780=_0x264dc5[0x0],_0x54d1f1=_0x3cc767,_0x2988a6=_0x54d1f1['time'],_0x29364d=_0x54d1f1[_0x29f52a(0x191)]!==undefined?Number(_0x54d1f1['num']):undefined;if(_0x3cc767[_0x29f52a(0x18a)]){console['error'](_0x29f52a(0x1d8)+_0x19d780);if(_0x2988a6)console[_0x29f52a(0x17e)](_0x29f52a(0x147)+_0x2988a6);if(_0x29364d)console['error']('\x20\x20Num:\x20'+_0x29364d);}const _0x32929d=await withSpinner(_0x29f52a(0x180),()=>_0x323911[_0x29f52a(0x196)][_0x29f52a(0x149)](_0x19d780,{'time':_0x2988a6,'num':_0x29364d}),{'verbose':_0x3cc767[_0x29f52a(0x18a)]}),_0x5dca4b=_0x32929d['data'][_0x29f52a(0x195)];console[_0x29f52a(0x17e)]('Schedule\x20run\x20submitted:\x20'+_0x5dca4b[_0x29f52a(0x1a5)]+_0x29f52a(0x14e)+(_0x5dca4b[_0x29f52a(0x1a5)]!==0x1?'s':'')+_0x29f52a(0x1a3));for(const _0x3d0e41 of _0x5dca4b){console['error']('\x20\x20Job\x20ID:\x20'+_0x3d0e41['job_id']);}return await handleSDKOutput(_0x5dca4b,_0x3cc767),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x46ec0e(0x1a1)]=a37_0x46ec0e(0x182);[a37_0x46ec0e(0x1b2)]=a37_0x46ec0e(0x15c);['validate'](_0x1851e5){const _0x4d7537=a37_0x46ec0e,_0x435da9=_0x1851e5[_0x4d7537(0x14a)][0x0];if(!_0x435da9)return _0x4d7537(0x1b6);return undefined;}async[a37_0x46ec0e(0x15b)](_0x1eeb46){const _0x48fcda=a37_0x46ec0e,{options:_0x44873c,args:_0x268fe0,tdx:_0x13a820}=_0x1eeb46,_0x72f7d2=_0x268fe0[0x0],_0x1f4b3e=_0x44873c,_0x2f08b0=_0x1f4b3e[_0x48fcda(0x16e)]!==undefined?Number(_0x1f4b3e[_0x48fcda(0x16e)]):undefined,_0x5de5e1=_0x1f4b3e['to']!==undefined?Number(_0x1f4b3e['to']):undefined,_0x4580ae=await withSpinner(_0x48fcda(0x17d),()=>_0x13a820['schedules'][_0x48fcda(0x1d5)](_0x72f7d2,{'from':_0x2f08b0,'to':_0x5de5e1}),{'verbose':_0x44873c['verbose']}),_0xe49fe9=_0x4580ae[_0x48fcda(0x175)];console[_0x48fcda(0x17e)](_0x48fcda(0x197)+_0xe49fe9['count']+_0x48fcda(0x16a)+(_0xe49fe9[_0x48fcda(0x1c6)]!==0x1?'s':'')+_0x48fcda(0x1d3)+_0xe49fe9[_0x48fcda(0x16e)]+'-'+_0xe49fe9['to']+')');const _0x196efd=_0xe49fe9[_0x48fcda(0x1d5)]['map'](_0x173d61=>({'job_id':_0x173d61['job_id'],'type':_0x173d61[_0x48fcda(0x18e)],'status':_0x173d61[_0x48fcda(0x154)],'scheduled_at':_0x173d61[_0x48fcda(0x1bd)],'created_at':_0x173d61[_0x48fcda(0x158)],'start_at':_0x173d61[_0x48fcda(0x1d0)],'end_at':_0x173d61['end_at']}));return await handleSDKOutput(_0x196efd,_0x44873c),0x0;}}
|
|
1
|
+
const a37_0x59b560=a37_0x2da3;(function(_0x3e99b3,_0x21fa57){const _0x400c00=a37_0x2da3,_0x244dca=_0x3e99b3();while(!![]){try{const _0x1d39bb=-parseInt(_0x400c00(0x1b4))/0x1+-parseInt(_0x400c00(0x191))/0x2+-parseInt(_0x400c00(0x1ab))/0x3*(parseInt(_0x400c00(0x166))/0x4)+-parseInt(_0x400c00(0x17e))/0x5+-parseInt(_0x400c00(0x1d8))/0x6+parseInt(_0x400c00(0x1af))/0x7+parseInt(_0x400c00(0x173))/0x8*(parseInt(_0x400c00(0x165))/0x9);if(_0x1d39bb===_0x21fa57)break;else _0x244dca['push'](_0x244dca['shift']());}catch(_0x53e3dd){_0x244dca['push'](_0x244dca['shift']());}}}(a37_0x1109,0xd6903));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x477677 from'chalk';function a37_0x2da3(_0x5b788d,_0x555ed1){_0x5b788d=_0x5b788d-0x15a;const _0x11090d=a37_0x1109();let _0x2da34d=_0x11090d[_0x5b788d];return _0x2da34d;}function formatRelativeTime(_0xd30f21){const _0x5dcdd3=a37_0x2da3,_0xd9b017=new Date(_0xd30f21),_0x5a06d6=new Date(),_0x5dcf48=_0xd9b017[_0x5dcdd3(0x189)]()-_0x5a06d6[_0x5dcdd3(0x189)](),_0x1570f0=Math[_0x5dcdd3(0x184)](_0x5dcf48)/0x3e8,_0x256a5b=_0x5dcf48<0x0;if(_0x1570f0<0x3c)return _0x256a5b?_0x5dcdd3(0x1d0):'soon';else{if(_0x1570f0<0xe10){const _0x3c15e8=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0x3c);return _0x256a5b?_0x3c15e8+'m\x20ago':_0x5dcdd3(0x180)+_0x3c15e8+'m';}else{if(_0x1570f0<0x15180){const _0x2316e3=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0xe10);return _0x256a5b?_0x2316e3+'h\x20ago':'in\x20'+_0x2316e3+'h';}else{if(_0x1570f0<0x93a80){const _0x575b1e=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0x15180);return _0x256a5b?_0x575b1e+'d\x20ago':_0x5dcdd3(0x180)+_0x575b1e+'d';}else return _0xd9b017[_0x5dcdd3(0x18c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x185);[a37_0x59b560(0x1a8)]='List\x20scheduled\x20queries';async[a37_0x59b560(0x1b5)](_0x1991a8){const _0x1350dd=a37_0x59b560,{options:_0x516f95,args:_0x587188,tdx:_0x40f8fd}=_0x1991a8,_0x47fef9=resolveLimit(_0x516f95[_0x1350dd(0x183)],DEFAULT_DISPLAY_LIMIT),_0x4e2255=_0x587188[0x0],_0x1e2d91=_0x4e2255?_0x1350dd(0x1e0)+_0x4e2255+'\x22...':'Listing\x20scheduled\x20queries...',_0x1769b6=await withSpinner(_0x1e2d91,()=>_0x40f8fd[_0x1350dd(0x196)][_0x1350dd(0x1cb)]({'limit':_0x47fef9,'scheduled':!![],'pattern':_0x4e2255}),{'verbose':_0x516f95[_0x1350dd(0x177)]}),_0x38070b=_0x1769b6[_0x1350dd(0x1c8)][_0x1350dd(0x174)],_0x4fc879=_0x1769b6[_0x1350dd(0x1c8)][_0x1350dd(0x181)][_0x1350dd(0x1a4)],_0x132d21=_0x4e2255?_0x1350dd(0x1c6)+_0x4e2255+'\x22':'';_0x4fc879?console[_0x1350dd(0x16e)](_0x1350dd(0x15f)+_0x38070b['length']+'\x20schedules'+_0x132d21+_0x1350dd(0x1d4)):console['error']('Found\x20'+_0x38070b[_0x1350dd(0x1a3)]+_0x1350dd(0x1ba)+(_0x38070b['length']!==0x1?'ies':'y')+_0x132d21);if(_0x516f95['format']===_0x1350dd(0x16d)||_0x516f95[_0x1350dd(0x1be)]===_0x1350dd(0x1b6)||_0x516f95[_0x1350dd(0x1be)]===_0x1350dd(0x188)||_0x516f95[_0x1350dd(0x1be)]==='tsv'){const _0x5d0975=_0x38070b[_0x1350dd(0x162)](_0x5c06d8=>({'id':_0x5c06d8['id'],'name':_0x5c06d8[_0x1350dd(0x19c)],'cron':_0x5c06d8[_0x1350dd(0x187)],'database':_0x5c06d8[_0x1350dd(0x182)]?.['name'],'type':_0x5c06d8['type'],'timezone':_0x5c06d8[_0x1350dd(0x1c4)],'user_name':_0x5c06d8[_0x1350dd(0x1d3)]?.[_0x1350dd(0x19c)],'updated_at':_0x5c06d8[_0x1350dd(0x1c5)],'next_run_at':_0x5c06d8[_0x1350dd(0x168)],'last_job_status':_0x5c06d8['last_job']?.['status']}));await handleSDKOutput(_0x5d0975,_0x516f95);}else{if(_0x38070b[_0x1350dd(0x1a3)]===0x0)console[_0x1350dd(0x1cc)](_0x1350dd(0x1ce));else{const _0x4e8c03=_0x516f95[_0x1350dd(0x1cf)],_0x2df98d=_0x38070b[_0x1350dd(0x162)](_0x2a6558=>{const _0x43e7b6=_0x1350dd,_0x16bc73=_0x2a6558['last_job']?.['status']?_0x2a6558['last_job']['status']==='success'?'✓':'✗':'-',_0x14e3a7=_0x2a6558['last_job']?.[_0x43e7b6(0x1a2)]?formatRelativeTime(_0x2a6558[_0x43e7b6(0x171)][_0x43e7b6(0x1a2)]):'never',_0x25d28b=_0x2a6558[_0x43e7b6(0x168)]?formatRelativeTime(_0x2a6558[_0x43e7b6(0x168)]):'-',_0xd4d4c1=_0x2a6558[_0x43e7b6(0x187)]||'',_0x38fe9a=_0x2a6558[_0x43e7b6(0x19c)]||_0x43e7b6(0x1bc),_0x37ab4e=getConsoleUrl(_0x4e8c03,_0x43e7b6(0x16f)+_0x2a6558['id']);return{'statusIcon':_0x16bc73,'lastRun':_0x14e3a7,'nextRun':_0x25d28b,'cron':_0xd4d4c1,'name':_0x38fe9a,'queryUrl':_0x37ab4e,'status':_0x2a6558[_0x43e7b6(0x171)]?.['status']};}),_0x18b84b=Math[_0x1350dd(0x1d2)](..._0x2df98d[_0x1350dd(0x162)](_0x41525c=>_0x41525c[_0x1350dd(0x18d)][_0x1350dd(0x1a3)])),_0x5dbfd8=Math['max'](..._0x2df98d['map'](_0x2855fd=>_0x2855fd[_0x1350dd(0x1d6)][_0x1350dd(0x1a3)])),_0x31d812=Math['max'](..._0x2df98d[_0x1350dd(0x162)](_0xbf7159=>_0xbf7159[_0x1350dd(0x187)]['length'])),_0x446749=_0x2df98d[_0x1350dd(0x162)](_0x262f6f=>{const _0x110019=_0x1350dd,_0x2be93d=_0x262f6f[_0x110019(0x164)]===_0x110019(0x1db)?a37_0x477677[_0x110019(0x19b)](_0x262f6f[_0x110019(0x1df)]):_0x262f6f['status']===_0x110019(0x16e)?a37_0x477677['red'](_0x262f6f[_0x110019(0x1df)]):a37_0x477677[_0x110019(0x18b)](_0x262f6f[_0x110019(0x1df)]),_0x267ff7=_0x262f6f[_0x110019(0x18d)][_0x110019(0x160)](_0x18b84b),_0x52930a=_0x262f6f[_0x110019(0x1d6)][_0x110019(0x160)](_0x5dbfd8),_0x3b22a7=_0x262f6f[_0x110019(0x187)]?a37_0x477677[_0x110019(0x161)](_0x262f6f[_0x110019(0x187)][_0x110019(0x160)](_0x31d812)):'\x20'[_0x110019(0x198)](_0x31d812),_0x2bc5f6=hyperlink(_0x262f6f[_0x110019(0x19c)],_0x262f6f['queryUrl']);return'📅\x20'+_0x2be93d+'\x20'+_0x267ff7+'\x20\x20→\x20'+_0x52930a+'\x20\x20'+_0x3b22a7+'\x20\x20'+_0x2bc5f6;});await writeOutput(_0x446749['join']('\x0a'),_0x516f95['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:show';[a37_0x59b560(0x1a8)]=a37_0x59b560(0x1dd);[a37_0x59b560(0x1b3)](_0x30bad8){const _0x2b7b71=a37_0x59b560,_0x1aa5d3=_0x30bad8[_0x2b7b71(0x1d5)][0x0];if(!_0x1aa5d3)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x2d1421){const _0x147dcf=a37_0x59b560,{options:_0x34ea2a,args:_0x1961d6,tdx:_0x5d2134}=_0x2d1421,_0x39c0e4=_0x1961d6[0x0],_0x3e7edb=await withSpinner(_0x147dcf(0x15b),()=>_0x5d2134[_0x147dcf(0x196)][_0x147dcf(0x190)](_0x39c0e4),{'verbose':_0x34ea2a['verbose']}),_0x1904d0=_0x3e7edb[_0x147dcf(0x1c8)],_0x47ff23={'name':_0x1904d0['name'],'cron':_0x1904d0[_0x147dcf(0x187)],'database':_0x1904d0[_0x147dcf(0x182)],'type':_0x1904d0[_0x147dcf(0x1c1)],'timezone':_0x1904d0[_0x147dcf(0x1e1)],'user_name':_0x1904d0[_0x147dcf(0x170)],'created_at':_0x1904d0[_0x147dcf(0x17f)],'engine_version':_0x1904d0[_0x147dcf(0x175)],'executing_user_id':_0x1904d0['executing_user_id'],'query':_0x1904d0[_0x147dcf(0x1b7)],'delay':_0x1904d0[_0x147dcf(0x17d)],'priority':_0x1904d0['priority'],'retry_limit':_0x1904d0[_0x147dcf(0x15e)],..._0x1904d0['result']&&{'result':_0x1904d0[_0x147dcf(0x16b)]}};return await handleSingleObjectOutput(_0x47ff23,_0x34ea2a),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a37_0x59b560(0x1da);[a37_0x59b560(0x1a8)]=a37_0x59b560(0x15a);[a37_0x59b560(0x1b3)](_0x5d9ab3){const _0x4f8947=a37_0x59b560,_0x135d83=_0x5d9ab3['args'][0x0];if(!_0x135d83)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x22b871=_0x5d9ab3[_0x4f8947(0x167)];if(!_0x22b871['database'])return _0x4f8947(0x179);return undefined;}async[a37_0x59b560(0x1b5)](_0x361f17){const _0x53e2a3=a37_0x59b560,{options:_0xb51b69,args:_0x6d96e3,tdx:_0x561c33}=_0x361f17,_0x392c27=_0x6d96e3[0x0],_0x2dffd6=_0xb51b69,_0x6625c5=_0x2dffd6['database'],_0x26d7fa=_0x2dffd6[_0x53e2a3(0x1b2)],_0x144725=_0x2dffd6[_0x53e2a3(0x1c1)]||_0x53e2a3(0x178);let _0x2913fe;try{_0x2913fe=readFileSync(_0x26d7fa,_0x53e2a3(0x19e))['trim']();}catch(_0x541c3b){throw new SDKError(ErrorCode[_0x53e2a3(0x17c)],_0x53e2a3(0x15d)+_0x26d7fa,_0x541c3b instanceof Error?_0x541c3b:undefined);}if(!_0x2913fe)throw new SDKError(ErrorCode[_0x53e2a3(0x17c)],_0x53e2a3(0x195));const _0x47f11b={'database':_0x6625c5,'query':_0x2913fe,'type':_0x144725};if(_0x2dffd6['cron'])_0x47f11b[_0x53e2a3(0x187)]=_0x2dffd6[_0x53e2a3(0x187)];if(_0x2dffd6[_0x53e2a3(0x1e1)])_0x47f11b[_0x53e2a3(0x1e1)]=_0x2dffd6['timezone'];if(_0x2dffd6[_0x53e2a3(0x17d)]!==undefined)_0x47f11b['delay']=Number(_0x2dffd6[_0x53e2a3(0x17d)]);if(_0x2dffd6['priority']!==undefined)_0x47f11b['priority']=Number(_0x2dffd6['priority']);if(_0x2dffd6['retryLimit']!==undefined)_0x47f11b['retry_limit']=Number(_0x2dffd6[_0x53e2a3(0x1a5)]);if(_0x2dffd6[_0x53e2a3(0x1c7)])_0x47f11b[_0x53e2a3(0x175)]=_0x2dffd6[_0x53e2a3(0x1c7)];if(_0x2dffd6[_0x53e2a3(0x16b)])_0x47f11b[_0x53e2a3(0x16b)]=_0x2dffd6[_0x53e2a3(0x16b)];if(_0xb51b69[_0x53e2a3(0x177)]){console['error'](_0x53e2a3(0x1ac)+_0x392c27),console['error']('\x20\x20Database:\x20'+_0x6625c5),console[_0x53e2a3(0x16e)]('\x20\x20Type:\x20'+_0x144725);if(_0x47f11b['cron'])console[_0x53e2a3(0x16e)]('\x20\x20Cron:\x20'+_0x47f11b[_0x53e2a3(0x187)]);if(_0x47f11b[_0x53e2a3(0x1e1)])console['error'](_0x53e2a3(0x193)+_0x47f11b[_0x53e2a3(0x1e1)]);}const _0x2dcb2c=await withSpinner(_0x53e2a3(0x1e2),()=>_0x561c33[_0x53e2a3(0x196)][_0x53e2a3(0x1de)](_0x392c27,_0x47f11b),{'verbose':_0xb51b69['verbose']});return console[_0x53e2a3(0x16e)](_0x53e2a3(0x1c0)+_0x2dcb2c['data'][_0x53e2a3(0x19c)]),await handleSingleObjectOutput(_0x2dcb2c[_0x53e2a3(0x1c8)],_0xb51b69),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:update';[a37_0x59b560(0x1a8)]=a37_0x59b560(0x19d);[a37_0x59b560(0x1b3)](_0x1f3460){const _0x4844fb=a37_0x59b560,_0x1687ca=_0x1f3460[_0x4844fb(0x1d5)][0x0];if(!_0x1687ca)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a37_0x59b560(0x1b5)](_0x175d5f){const _0x29520f=a37_0x59b560,{options:_0x5bfd31,args:_0x1a37ef,tdx:_0x31e5a7}=_0x175d5f,_0x5366d1=_0x1a37ef[0x0],_0x531c32=_0x5bfd31,_0x247e01={};if(_0x531c32['database'])_0x247e01[_0x29520f(0x182)]=_0x531c32[_0x29520f(0x182)];if(_0x531c32[_0x29520f(0x1c1)])_0x247e01[_0x29520f(0x1c1)]=_0x531c32[_0x29520f(0x1c1)];if(_0x531c32[_0x29520f(0x187)])_0x247e01[_0x29520f(0x187)]=_0x531c32[_0x29520f(0x187)];if(_0x531c32[_0x29520f(0x1e1)])_0x247e01[_0x29520f(0x1e1)]=_0x531c32[_0x29520f(0x1e1)];if(_0x531c32[_0x29520f(0x17d)]!==undefined)_0x247e01[_0x29520f(0x17d)]=Number(_0x531c32[_0x29520f(0x17d)]);if(_0x531c32['priority']!==undefined)_0x247e01['priority']=Number(_0x531c32[_0x29520f(0x1c9)]);if(_0x531c32[_0x29520f(0x1a5)]!==undefined)_0x247e01[_0x29520f(0x15e)]=Number(_0x531c32[_0x29520f(0x1a5)]);if(_0x531c32[_0x29520f(0x1c7)])_0x247e01['engine_version']=_0x531c32[_0x29520f(0x1c7)];if(_0x531c32[_0x29520f(0x16b)])_0x247e01[_0x29520f(0x16b)]=_0x531c32[_0x29520f(0x16b)];if(_0x531c32[_0x29520f(0x1b2)])try{_0x247e01[_0x29520f(0x1b7)]=readFileSync(_0x531c32['file'],_0x29520f(0x19e))['trim']();}catch(_0x360370){throw new SDKError(ErrorCode[_0x29520f(0x17c)],_0x29520f(0x15d)+_0x531c32[_0x29520f(0x1b2)],_0x360370 instanceof Error?_0x360370:undefined);}if(Object[_0x29520f(0x1bb)](_0x247e01)[_0x29520f(0x1a3)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x29520f(0x1dc));if(_0x5bfd31['verbose']){console['error'](_0x29520f(0x17b)+_0x5366d1);for(const [_0x43d501,_0x49ba94]of Object[_0x29520f(0x18a)](_0x247e01)){_0x43d501===_0x29520f(0x1b7)?console[_0x29520f(0x16e)]('\x20\x20'+_0x43d501+':\x20'+_0x49ba94[_0x29520f(0x1b9)](0x0,0x32)+_0x29520f(0x199)):console['error']('\x20\x20'+_0x43d501+':\x20'+_0x49ba94);}}const _0xa502ad=await withSpinner(_0x29520f(0x17a),()=>_0x31e5a7['schedules'][_0x29520f(0x1b1)](_0x5366d1,_0x247e01),{'verbose':_0x5bfd31[_0x29520f(0x177)]});return console[_0x29520f(0x16e)](_0x29520f(0x1cd)+_0xa502ad[_0x29520f(0x1c8)]['name']),await handleSingleObjectOutput(_0xa502ad[_0x29520f(0x1c8)],_0x5bfd31),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x18f);[a37_0x59b560(0x1a8)]='Delete\x20a\x20scheduled\x20query';[a37_0x59b560(0x1b3)](_0x17d49c){const _0x216c79=a37_0x59b560,_0x1e879b=_0x17d49c[_0x216c79(0x1d5)][0x0];if(!_0x1e879b)return _0x216c79(0x1d1);return undefined;}async[a37_0x59b560(0x1b5)](_0x383449){const _0x26a6ae=a37_0x59b560,{options:_0xefb48c,args:_0x48f2aa,tdx:_0x38cc0f}=_0x383449,_0x83a461=_0x48f2aa[0x0];if(!_0xefb48c[_0x26a6ae(0x1d7)]){const _0xb89a84=await confirm(_0x26a6ae(0x1ae)+_0x83a461+'\x22?');if(!_0xb89a84)return console[_0x26a6ae(0x16e)](_0x26a6ae(0x1a7)),0x0;}const _0x3bdc0c=await withSpinner(_0x26a6ae(0x1ad),()=>_0x38cc0f[_0x26a6ae(0x196)]['delete'](_0x83a461),{'verbose':_0xefb48c[_0x26a6ae(0x177)]});return console[_0x26a6ae(0x16e)](_0x26a6ae(0x16a)+_0x3bdc0c[_0x26a6ae(0x1c8)][_0x26a6ae(0x19c)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:run';['description']=a37_0x59b560(0x192);[a37_0x59b560(0x1b3)](_0x4bb456){const _0x1df101=a37_0x59b560,_0x5ebc1a=_0x4bb456[_0x1df101(0x1d5)][0x0];if(!_0x5ebc1a)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a37_0x59b560(0x1b5)](_0x5945e9){const _0x1e4e8e=a37_0x59b560,{options:_0x52516f,args:_0x1cc159,tdx:_0x44d376}=_0x5945e9,_0x572968=_0x1cc159[0x0],_0x58adb5=_0x52516f,_0x42964b=_0x58adb5[_0x1e4e8e(0x197)],_0x35ad12=_0x58adb5[_0x1e4e8e(0x186)]!==undefined?Number(_0x58adb5[_0x1e4e8e(0x186)]):undefined;if(_0x52516f[_0x1e4e8e(0x177)]){console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1c2)+_0x572968);if(_0x42964b)console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1a0)+_0x42964b);if(_0x35ad12)console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x169)+_0x35ad12);}const _0x169043=await withSpinner(_0x1e4e8e(0x1aa),()=>_0x44d376[_0x1e4e8e(0x196)][_0x1e4e8e(0x16c)](_0x572968,{'time':_0x42964b,'num':_0x35ad12}),{'verbose':_0x52516f[_0x1e4e8e(0x177)]}),_0x528b3a=_0x169043['data'][_0x1e4e8e(0x1e3)];console['error'](_0x1e4e8e(0x19a)+_0x528b3a[_0x1e4e8e(0x1a3)]+_0x1e4e8e(0x1a1)+(_0x528b3a[_0x1e4e8e(0x1a3)]!==0x1?'s':'')+_0x1e4e8e(0x1a6));for(const _0x296ce7 of _0x528b3a){console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1ca)+_0x296ce7[_0x1e4e8e(0x1bd)]);}return await handleSDKOutput(_0x528b3a,_0x52516f),0x0;}}function a37_0x1109(){const _0x4bac89=['map','from','status','36ravQvd','4YQFhzu','options','next_run_at','\x20\x20Num:\x20','Schedule\x20deleted:\x20','result','run','json','error','/app/queries/editor?queryId=','user_name','last_job','count','6644328dQQqlb','queries','engine_version','start_at','verbose','trino','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Updating\x20schedule...','Updating\x20schedule:\x20','INVALID_ARGUMENT','delay','1689465BAsUHh','created_at','in\x20','pagination','database','limit','abs','schedule:list','num','cron','table','getTime','entries','dim','toLocaleDateString','lastRun','scheduled_at','schedule:delete','show','1383554DPdWXF','Run\x20a\x20scheduled\x20query\x20immediately','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Query\x20file\x20is\x20empty','schedules','time','repeat','...','Schedule\x20run\x20submitted:\x20','green','name','Update\x20a\x20scheduled\x20query','utf-8','Show\x20schedule\x20execution\x20history','\x20\x20Time:\x20','\x20job','ended_at','length','has_next_page','retryLimit','\x20created','Cancelled','description','Found\x20','Running\x20schedule...','854205fpHaYl','Creating\x20schedule:\x20','Deleting\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','9931726IWRepx','round','update','file','validate','941846OMcZIo','execute','jsonl','query','schedule:history','substring','\x20scheduled\x20quer','keys','(unnamed)','job_id','format','history','Schedule\x20created:\x20','type','Running\x20schedule:\x20','\x20(showing\x20','time_zone','updated_at','\x20matching\x20\x22','engineVersion','data','priority','\x20\x20Job\x20ID:\x20','listQueries','log','Schedule\x20updated:\x20','No\x20scheduled\x20queries\x20found','site','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','max','user','\x20(use\x20--limit\x20to\x20see\x20more)','args','nextRun','yes','9635280mvvyYn','\x20execution','schedule:create','success','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Show\x20schedule\x20details','create','statusIcon','Searching\x20scheduled\x20queries\x20matching\x20\x22','timezone','Creating\x20schedule...','jobs','Create\x20a\x20scheduled\x20query','Getting\x20schedule\x20details...','Getting\x20schedule\x20history...','Failed\x20to\x20read\x20file:\x20','retry_limit','Showing\x20first\x20','padEnd','cyan'];a37_0x1109=function(){return _0x4bac89;};return a37_0x1109();}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x1b8);['description']=a37_0x59b560(0x19f);[a37_0x59b560(0x1b3)](_0x41c38e){const _0x4d9b71=a37_0x59b560,_0x541280=_0x41c38e['args'][0x0];if(!_0x541280)return _0x4d9b71(0x194);return undefined;}async[a37_0x59b560(0x1b5)](_0x4efba3){const _0x8b71b=a37_0x59b560,{options:_0xf93699,args:_0x56c8bd,tdx:_0x23e2cb}=_0x4efba3,_0x3b1b6d=_0x56c8bd[0x0],_0x4eb9ba=_0xf93699,_0x41c9d5=_0x4eb9ba[_0x8b71b(0x163)]!==undefined?Number(_0x4eb9ba[_0x8b71b(0x163)]):undefined,_0x22f1c5=_0x4eb9ba['to']!==undefined?Number(_0x4eb9ba['to']):undefined,_0x419e60=await withSpinner(_0x8b71b(0x15c),()=>_0x23e2cb[_0x8b71b(0x196)][_0x8b71b(0x1bf)](_0x3b1b6d,{'from':_0x41c9d5,'to':_0x22f1c5}),{'verbose':_0xf93699[_0x8b71b(0x177)]}),_0x119e81=_0x419e60[_0x8b71b(0x1c8)];console['error'](_0x8b71b(0x1a9)+_0x119e81[_0x8b71b(0x172)]+_0x8b71b(0x1d9)+(_0x119e81[_0x8b71b(0x172)]!==0x1?'s':'')+_0x8b71b(0x1c3)+_0x119e81[_0x8b71b(0x163)]+'-'+_0x119e81['to']+')');const _0x294a15=_0x119e81[_0x8b71b(0x1bf)][_0x8b71b(0x162)](_0x25bb51=>({'job_id':_0x25bb51[_0x8b71b(0x1bd)],'type':_0x25bb51[_0x8b71b(0x1c1)],'status':_0x25bb51['status'],'scheduled_at':_0x25bb51[_0x8b71b(0x18e)],'created_at':_0x25bb51[_0x8b71b(0x17f)],'start_at':_0x25bb51[_0x8b71b(0x176)],'end_at':_0x25bb51['end_at']}));return await handleSDKOutput(_0x294a15,_0xf93699),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a38_0x51a13b=a38_0x383b;(function(_0x10d410,_0x4bfe61){const _0x3a0439=a38_0x383b,_0x4f43fb=_0x10d410();while(!![]){try{const _0x5c683b=parseInt(_0x3a0439(0xdf))/0x1*(-parseInt(_0x3a0439(0x140))/0x2)+-parseInt(_0x3a0439(0x12e))/0x3+parseInt(_0x3a0439(0x10c))/0x4*(parseInt(_0x3a0439(0xbf))/0x5)+parseInt(_0x3a0439(0xfe))/0x6*(-parseInt(_0x3a0439(0x126))/0x7)+parseInt(_0x3a0439(0xc1))/0x8*(-parseInt(_0x3a0439(0xd9))/0x9)+parseInt(_0x3a0439(0xf7))/0xa+parseInt(_0x3a0439(0xe7))/0xb;if(_0x5c683b===_0x4bfe61)break;else _0x4f43fb['push'](_0x4f43fb['shift']());}catch(_0x2fd216){_0x4f43fb['push'](_0x4f43fb['shift']());}}}(a38_0x4863,0x823d1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a38_0x383b(_0x3075d7,_0x191b6f){_0x3075d7=_0x3075d7-0xae;const _0x4863b8=a38_0x4863();let _0x383be3=_0x4863b8[_0x3075d7];return _0x383be3;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x138c10 from'chalk';async function resolveSegmentTarget(_0x2c5fca,_0x18b936,_0x1178ed){const _0xaad752=a38_0x383b;if(isYamlFilePath(_0x2c5fca))try{const _0x24bdd6=await resolveYamlFilePath(_0x2c5fca);return _0x1178ed&&(console[_0xaad752(0x12f)](_0xaad752(0x145)+_0x2c5fca),console[_0xaad752(0x12f)](_0xaad752(0x130)+_0x24bdd6[_0xaad752(0xc6)]),console['error'](_0xaad752(0x12c)+_0x24bdd6[_0xaad752(0xc4)]),console['error'](_0xaad752(0xdd)+(_0x24bdd6[_0xaad752(0xd7)]||'(root)')),console[_0xaad752(0x12f)](_0xaad752(0x112)+_0x24bdd6[_0xaad752(0xd8)])),_0x24bdd6[_0xaad752(0xd8)];}catch(_0x5173ce){throw new SDKError(ErrorCode[_0xaad752(0xd4)],_0xaad752(0xae)+_0x5173ce[_0xaad752(0xc3)]);}if(!_0x18b936)throw new SDKError(ErrorCode[_0xaad752(0xd4)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x18b936+'/'+_0x2c5fca;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x51a13b(0x12b);['description']=a38_0x51a13b(0xc2);async['execute'](_0x952fb8){const _0x3bb768=a38_0x51a13b,{options:_0x1a3e48,args:_0x5ac029,tdx:_0x4de324}=_0x952fb8,_0x1921dd=_0x5ac029[0x0],_0x2ec782=!_0x1921dd&&!!_0x1a3e48[_0x3bb768(0xc6)],_0x3c0df8=_0x1921dd||_0x1a3e48['parentSegment'];if(!_0x3c0df8)return console['error'](_0x3bb768(0xf5)),console['error'](_0x3bb768(0xde)),console[_0x3bb768(0x12f)]('Examples:'),console[_0x3bb768(0x12f)](_0x3bb768(0xeb)),console['error'](_0x3bb768(0xdc)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x153a82=_0x1a3e48[_0x3bb768(0xb1)];let _0x1ff66d=_0x3c0df8;!_0x2ec782&&_0x153a82&&!_0x3c0df8[_0x3bb768(0x128)]('/')&&(_0x1ff66d=_0x153a82+'/'+_0x3c0df8,_0x1a3e48[_0x3bb768(0xdb)]&&console[_0x3bb768(0x12f)](_0x3bb768(0xc9)+_0x1ff66d));const _0xbd0a68=await withSpinner('Resolving\x20path\x20\x27'+_0x1ff66d+_0x3bb768(0x14c),()=>_0x4de324['segment'][_0x3bb768(0xd2)](_0x1ff66d),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]}),_0xd7b46b=_0xbd0a68['data'];_0x1a3e48[_0x3bb768(0xdb)]&&(console[_0x3bb768(0x12f)]('Resolved\x20type:\x20'+_0xd7b46b['type']),console[_0x3bb768(0x12f)](_0x3bb768(0xc0)+_0xd7b46b['parentId']),_0xd7b46b[_0x3bb768(0x13f)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x14f)+_0xd7b46b[_0x3bb768(0x13f)]),_0xd7b46b[_0x3bb768(0x10d)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x109)+_0xd7b46b[_0x3bb768(0x10d)]));if(_0xd7b46b['type']==='parent'){const _0x2a82ec=await withSpinner(_0x3bb768(0xec),()=>_0x4de324['segment'][_0x3bb768(0xed)](_0xd7b46b[_0x3bb768(0x150)]),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]});await handleSingleObjectOutput(_0x2a82ec[_0x3bb768(0x100)],_0x1a3e48);}else{if(_0xd7b46b['type']===_0x3bb768(0x14e)){if(!_0xd7b46b[_0x3bb768(0x13f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3bb768(0x117));const _0x1975c3=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4de324[_0x3bb768(0x144)][_0x3bb768(0xea)](_0xd7b46b[_0x3bb768(0x13f)]),{'verbose':_0x1a3e48[_0x3bb768(0xdb)]});await handleSingleObjectOutput(_0x1975c3[_0x3bb768(0x100)],_0x1a3e48);}else{if(_0xd7b46b['type']===_0x3bb768(0x144)){if(!_0xd7b46b[_0x3bb768(0x10d)])throw new SDKError(ErrorCode[_0x3bb768(0xb5)],_0x3bb768(0x11c));const _0xd14d5a=await withSpinner(_0x3bb768(0x138),()=>_0x4de324[_0x3bb768(0x144)][_0x3bb768(0xe1)](_0xd7b46b['parentId'],_0xd7b46b['segmentId']),{'verbose':_0x1a3e48['verbose']});await handleSingleObjectOutput(_0xd14d5a['data'],_0x1a3e48);}}}return 0x0;}catch(_0x2a2a23){if(_0x2a2a23 instanceof SDKError)return console['error'](_0x3bb768(0xb6)+_0x2a2a23[_0x3bb768(0xc3)]),_0x2a2a23[_0x3bb768(0x104)]&&console[_0x3bb768(0x12f)](_0x3bb768(0x11e)+_0x2a2a23[_0x3bb768(0x104)]),0x1;throw _0x2a2a23;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x13e);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xb7);async['execute'](_0x52ef75){const _0x7290ff=a38_0x51a13b,{options:_0x3f8300,args:_0x55ee73,tdx:_0x48a355}=_0x52ef75,_0x40e29c=_0x55ee73[0x0];if(!_0x40e29c)return console[_0x7290ff(0x12f)](_0x7290ff(0xca)),console['error'](_0x7290ff(0xd0)),console[_0x7290ff(0x12f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x7290ff(0x12f)](_0x7290ff(0x106)),console[_0x7290ff(0x12f)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x7290ff(0x12f)](_0x7290ff(0x14b)),0x1;try{const _0x1ff7c1=_0x3f8300[_0x7290ff(0xc6)],_0x5e14c8=await resolveSegmentTarget(_0x40e29c,_0x1ff7c1,_0x3f8300['verbose']);_0x3f8300['verbose']&&console[_0x7290ff(0x12f)]('Target\x20path:\x20'+_0x5e14c8);const _0x2721bb=await withSpinner(_0x7290ff(0x13c)+_0x40e29c+_0x7290ff(0x14c),()=>_0x48a355[_0x7290ff(0x144)][_0x7290ff(0xd2)](_0x5e14c8),{'verbose':_0x3f8300[_0x7290ff(0xdb)]}),_0x59ebdd=_0x2721bb[_0x7290ff(0x100)];_0x3f8300[_0x7290ff(0xdb)]&&(console[_0x7290ff(0x12f)]('Resolved\x20type:\x20'+_0x59ebdd['type']),console[_0x7290ff(0x12f)]('Parent\x20ID:\x20'+_0x59ebdd['parentId']));if(_0x59ebdd[_0x7290ff(0xf6)]===_0x7290ff(0x14e))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x59ebdd[_0x7290ff(0xf6)]===_0x7290ff(0x107))return console[_0x7290ff(0x12f)](_0x7290ff(0x122)),console[_0x7290ff(0x12f)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x59ebdd[_0x7290ff(0x10d)])throw new SDKError(ErrorCode[_0x7290ff(0xb5)],_0x7290ff(0x11c));const _0x4bbfe1=await withSpinner(_0x7290ff(0xee),()=>_0x48a355[_0x7290ff(0x144)][_0x7290ff(0xce)](_0x59ebdd['parentId'],_0x59ebdd[_0x7290ff(0x10d)]),{'verbose':_0x3f8300[_0x7290ff(0xdb)]});let _0x53b981=_0x4bbfe1[_0x7290ff(0x100)];const _0x4f8175=resolveLimit(_0x3f8300[_0x7290ff(0xba)],DEFAULT_DISPLAY_LIMIT),_0x2657cf=/\bLIMIT\s+\d+/i[_0x7290ff(0xf3)](_0x53b981);!_0x2657cf&&(_0x53b981=_0x53b981[_0x7290ff(0x132)]()[_0x7290ff(0x105)](/;+$/,''),_0x53b981='SELECT\x20*\x20FROM\x20(\x0a'+_0x53b981+_0x7290ff(0x11f)+_0x4f8175);_0x3f8300[_0x7290ff(0xdb)]&&console[_0x7290ff(0x12f)](_0x7290ff(0xe3)+_0x53b981);const _0x32ab4b=await withProgressSpinner('Executing\x20segment\x20query...',async _0x357d55=>{const _0x14d8d4=_0x7290ff,_0x5b22a3=await _0x48a355[_0x14d8d4(0x11b)][_0x14d8d4(0xe2)](_0x53b981,{'catalog':'td','schema':_0x14d8d4(0xe6),'onJobId':_0x5d63a6=>{_0x357d55['setJobId'](_0x5d63a6);}});return _0x5b22a3;},{'verbose':_0x3f8300[_0x7290ff(0xdb)]}),_0x23b4ae=_0x32ab4b['data'],_0x408f34=_0x23b4ae[_0x7290ff(0x131)]?'\x20[Job\x20ID:\x20'+_0x23b4ae[_0x7290ff(0x131)]+']':'';return console[_0x7290ff(0x12f)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x23b4ae[_0x7290ff(0xf0)][_0x7290ff(0x142)][_0x7290ff(0x115)]()+'\x20rows\x20'+(_0x7290ff(0x111)+formatElapsed(_0x23b4ae[_0x7290ff(0xf0)][_0x7290ff(0xef)])+_0x408f34)),await handleQueryOutput(_0x23b4ae,_0x3f8300),0x0;}catch(_0xc54510){if(_0xc54510 instanceof SDKError)return console['error'](_0x7290ff(0x146)+_0xc54510[_0x7290ff(0xff)]+']'),console[_0x7290ff(0x12f)]('\x0a'+_0xc54510[_0x7290ff(0xc3)]),0x1;throw _0xc54510;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x51a13b(0xfa)]='segment:folder:list';[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xbc);async[a38_0x51a13b(0xe2)](_0x5d9545){const _0x5c4e51=a38_0x51a13b,{options:_0x2526ab,args:_0x1c5d70,tdx:_0x34a6f8}=_0x5d9545;if(_0x1c5d70[_0x5c4e51(0x110)]===0x0)return console[_0x5c4e51(0x12f)](_0x5c4e51(0x12a)),console[_0x5c4e51(0x12f)](_0x5c4e51(0xcd)),0x1;const _0xce8d3=_0x1c5d70[0x0];try{_0x2526ab[_0x5c4e51(0xdb)]&&(console[_0x5c4e51(0x12f)](_0x5c4e51(0x101)+_0x2526ab[_0x5c4e51(0x119)]),console[_0x5c4e51(0x12f)]('Parent\x20name:\x20'+_0xce8d3));const _0x514d0a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xce8d3+_0x5c4e51(0x14c),()=>_0x34a6f8['segment'][_0x5c4e51(0x136)](_0xce8d3),{'verbose':_0x2526ab[_0x5c4e51(0xdb)]}),_0x1857ff=_0x514d0a[_0x5c4e51(0x100)];_0x2526ab[_0x5c4e51(0xdb)]&&console[_0x5c4e51(0x12f)]('Resolved\x20parent\x20ID:\x20'+_0x1857ff);const _0x132b74=await withSpinner(_0x5c4e51(0xc7)+_0xce8d3+_0x5c4e51(0x14c),()=>_0x34a6f8[_0x5c4e51(0x144)][_0x5c4e51(0x152)](_0x1857ff),{'verbose':_0x2526ab[_0x5c4e51(0xdb)]}),_0x4af379=_0x132b74[_0x5c4e51(0x100)];return console[_0x5c4e51(0x12f)](_0x5c4e51(0x125)+_0x4af379['length']+'\x20folder'+(_0x4af379['length']!==0x1?'s':'')),await handleSDKOutput(_0x4af379,_0x2526ab),0x0;}catch(_0x5b8aef){if(_0x5b8aef instanceof SDKError)return console['error'](_0x5c4e51(0xb6)+_0x5b8aef[_0x5c4e51(0xc3)]),_0x5b8aef[_0x5c4e51(0x104)]&&console[_0x5c4e51(0x12f)]('\x20\x20Cause:\x20'+_0x5b8aef[_0x5c4e51(0x104)]),0x1;throw _0x5b8aef;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x10b);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0xf2);async['execute'](_0x3f351f){const _0x37481=a38_0x51a13b,{options:_0x4c181d,args:_0x55c03f,tdx:_0x1ccc20}=_0x3f351f;if(_0x55c03f['length']===0x0)return console[_0x37481(0x12f)](_0x37481(0xb8)),console[_0x37481(0x12f)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x5f0762,childId:_0x393482}=parseSegmentRef(_0x55c03f[0x0]);_0x4c181d['verbose']&&(console[_0x37481(0x12f)]('Site:\x20'+_0x4c181d['site']),console[_0x37481(0x12f)](_0x37481(0xaf)+_0x5f0762),_0x393482&&console['error'](_0x37481(0x116)+_0x393482));if(!_0x393482)return console[_0x37481(0x12f)](_0x37481(0x121)),0x1;const _0x49da91=await withSpinner(_0x37481(0xe4)+_0x5f0762+_0x37481(0x14c),()=>_0x1ccc20[_0x37481(0x144)]['resolveParentId'](_0x5f0762),{'verbose':_0x4c181d[_0x37481(0xdb)]}),_0x239072=_0x49da91['data'];_0x4c181d[_0x37481(0xdb)]&&console[_0x37481(0x12f)]('Resolved\x20parent\x20ID:\x20'+_0x239072);const _0x133dd2=await withSpinner(_0x37481(0x120)+_0x393482+_0x37481(0x14c),()=>_0x1ccc20['segment'][_0x37481(0x133)](_0x239072,_0x393482),{'verbose':_0x4c181d[_0x37481(0xdb)]}),_0x464a3a=_0x133dd2[_0x37481(0x100)];_0x4c181d[_0x37481(0xdb)]&&console[_0x37481(0x12f)](_0x37481(0x123)+_0x464a3a);const _0x406a4f=await withSpinner(_0x37481(0xfd)+_0x393482+_0x37481(0x14c),()=>_0x1ccc20[_0x37481(0x144)]['getFolder'](_0x464a3a),{'verbose':_0x4c181d[_0x37481(0xdb)]});return await handleSDKOutput([_0x406a4f['data']],_0x4c181d),0x0;}catch(_0x3bb6e0){if(_0x3bb6e0 instanceof SDKError)return console[_0x37481(0x12f)](_0x37481(0xb6)+_0x3bb6e0[_0x37481(0xc3)]),_0x3bb6e0[_0x37481(0x104)]&&console['error'](_0x37481(0x11e)+_0x3bb6e0[_0x37481(0x104)]),0x1;throw _0x3bb6e0;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a38_0x51a13b(0x143);['description']=a38_0x51a13b(0xb3);async[a38_0x51a13b(0xe2)](_0x2c6446){const _0x38dc1b=a38_0x51a13b,{options:_0x2bd79a,args:_0x41bfb0}=_0x2c6446,_0x291664=_0x2bd79a,_0xa7b8c2=_0x291664[_0x38dc1b(0xe8)],_0x2c0173=_0x41bfb0[0x0];if(!_0x2c0173&&!_0xa7b8c2)return console['error'](a38_0x138c10[_0x38dc1b(0x137)](_0x38dc1b(0xd1))),console[_0x38dc1b(0x12f)](_0x38dc1b(0x108)),console['error'](_0x38dc1b(0xe0)),console[_0x38dc1b(0x12f)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x38dc1b(0x106)),console['error'](_0x38dc1b(0x135)),console[_0x38dc1b(0x12f)](_0x38dc1b(0x10e)),0x1;if(_0x2c0173&&_0xa7b8c2)return console['error'](a38_0x138c10['red'](_0x38dc1b(0x134))),0x1;try{let _0x47d49e;if(_0xa7b8c2)_0x47d49e=await this[_0x38dc1b(0xbd)](_0xa7b8c2,_0x2c6446);else{if(isYamlFilePath(_0x2c0173))return console[_0x38dc1b(0x12f)](a38_0x138c10[_0x38dc1b(0x137)](_0x38dc1b(0x10a))),console[_0x38dc1b(0x12f)](_0x38dc1b(0xcb)+_0x2c0173),0x1;else _0x47d49e=await this['getSQLFromServerSegment'](_0x2c0173,_0x2c6446);}return _0x2bd79a['format']===_0x38dc1b(0x102)||_0x2bd79a[_0x38dc1b(0xf1)]===_0x38dc1b(0xf9)?await handleSDKOutput([{'sql':_0x47d49e}],_0x2bd79a):console['log'](_0x47d49e),0x0;}catch(_0x259b28){if(_0x259b28 instanceof SDKError)return console[_0x38dc1b(0x12f)](_0x38dc1b(0xb6)+_0x259b28['message']),_0x259b28[_0x38dc1b(0x104)]&&console[_0x38dc1b(0x12f)](_0x38dc1b(0x11e)+_0x259b28[_0x38dc1b(0x104)]),0x1;throw _0x259b28;}}async[a38_0x51a13b(0xbd)](_0x662625,_0x17ad67){const _0x1d994c=a38_0x51a13b,{options:_0x19db42,tdx:_0x587533}=_0x17ad67;let _0x2f82f5;try{_0x2f82f5=await resolveYamlFilePath(_0x662625);}catch(_0x5d96e5){throw new SDKError(ErrorCode[_0x1d994c(0xd4)],_0x1d994c(0xae)+_0x5d96e5[_0x1d994c(0xc3)]);}_0x19db42[_0x1d994c(0xdb)]&&console[_0x1d994c(0x12f)](_0x1d994c(0xc8)+_0x2f82f5[_0x1d994c(0xc6)]+'/'+_0x2f82f5[_0x1d994c(0xc4)]);const _0x3ad959=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x587533[_0x1d994c(0x144)]['getSegmentSQLFromYaml'](_0x2f82f5[_0x1d994c(0x11a)],_0x2f82f5[_0x1d994c(0xc6)],_0x2f82f5[_0x1d994c(0xc4)]),{'verbose':_0x19db42[_0x1d994c(0xdb)]});return _0x3ad959[_0x1d994c(0x100)];}async['getSQLFromServerSegment'](_0x558038,_0x1ffd68){const _0x26465a=a38_0x51a13b,{options:_0x5f1ee2,tdx:_0xe59c7c}=_0x1ffd68,_0x71bbcc=_0x5f1ee2[_0x26465a(0xc6)],_0x27b325=await resolveSegmentTarget(_0x558038,_0x71bbcc,_0x5f1ee2['verbose']);_0x5f1ee2[_0x26465a(0xdb)]&&console['error']('Target\x20path:\x20'+_0x27b325);const _0x471c8f=await withSpinner(_0x26465a(0x13c)+_0x558038+'\x27...',()=>_0xe59c7c[_0x26465a(0x144)][_0x26465a(0xd2)](_0x27b325),{'verbose':_0x5f1ee2[_0x26465a(0xdb)]}),_0x46a2a5=_0x471c8f[_0x26465a(0x100)];_0x5f1ee2[_0x26465a(0xdb)]&&(console['error'](_0x26465a(0x139)+_0x46a2a5[_0x26465a(0xf6)]),console['error'](_0x26465a(0xc0)+_0x46a2a5[_0x26465a(0x150)]));if(_0x46a2a5[_0x26465a(0xf6)]===_0x26465a(0x14e))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x26465a(0xcc));if(_0x46a2a5[_0x26465a(0xf6)]===_0x26465a(0x107))throw new SDKError(ErrorCode[_0x26465a(0xd4)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x46a2a5[_0x26465a(0x10d)])throw new SDKError(ErrorCode[_0x26465a(0xb5)],_0x26465a(0x11c));const _0x302ab9=await withSpinner(_0x26465a(0xee),()=>_0xe59c7c['segment'][_0x26465a(0xce)](_0x46a2a5[_0x26465a(0x150)],_0x46a2a5[_0x26465a(0x10d)]),{'verbose':_0x5f1ee2['verbose']});return _0x302ab9[_0x26465a(0x100)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a38_0x51a13b(0x14d);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0x149);async[a38_0x51a13b(0xe2)](_0x4e9004){const _0x5c2148=a38_0x51a13b,{options:_0x3e6365,args:_0xf443f5,tdx:_0x56a986}=_0x4e9004,_0x1b10cd=_0x3e6365;if(_0xf443f5[_0x5c2148(0x110)]<0x2)return console[_0x5c2148(0x12f)](_0x5c2148(0x10f)),console[_0x5c2148(0x12f)](_0x5c2148(0x124)),0x1;const _0x152251=_0xf443f5[0x0],_0x21c613=_0xf443f5[0x1];_0x1b10cd[_0x5c2148(0xdb)]&&(console['error'](_0x5c2148(0x101)+_0x1b10cd[_0x5c2148(0x119)]),console[_0x5c2148(0x12f)](_0x5c2148(0xb9)+_0x152251),console[_0x5c2148(0x12f)](_0x5c2148(0x116)+_0x21c613));let _0xb08e2d;if(_0x1b10cd[_0x5c2148(0x151)]){const _0x33b468=_0x1b10cd[_0x5c2148(0x151)],_0x4d8959=await withSpinner(_0x5c2148(0xe4)+_0x152251+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0x136)](_0x152251),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]}),_0x4ad45f=_0x4d8959[_0x5c2148(0x100)],_0x3a61cc=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x33b468+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0x133)](_0x4ad45f,_0x33b468),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]});_0xb08e2d=_0x3a61cc[_0x5c2148(0x100)],_0x1b10cd[_0x5c2148(0xdb)]&&console[_0x5c2148(0x12f)](_0x5c2148(0xbb)+_0xb08e2d);}const _0x4fe86c={'name':_0x21c613,'description':_0x1b10cd[_0x5c2148(0xbe)],'parentFolderId':_0xb08e2d},_0x21f302=await withSpinner(_0x5c2148(0xf8)+_0x21c613+_0x5c2148(0x14c),()=>_0x56a986[_0x5c2148(0x144)][_0x5c2148(0xc5)](_0x152251,_0x4fe86c),{'verbose':_0x1b10cd[_0x5c2148(0xdb)]}),_0x3478f7=_0x21f302[_0x5c2148(0x100)];return console[_0x5c2148(0x12f)](_0x5c2148(0x13d)+_0x3478f7[_0x5c2148(0xfa)]+'\x27\x20with\x20ID:\x20'+_0x3478f7['id']),await handleSDKOutput([_0x3478f7],_0x1b10cd),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x51a13b(0xfa)]=a38_0x51a13b(0x113);[a38_0x51a13b(0xbe)]=a38_0x51a13b(0x147);async[a38_0x51a13b(0xe2)](_0x13d531){const _0x48ed18=a38_0x51a13b,{options:_0x1a998e,args:_0x41fedb,tdx:_0x187555}=_0x13d531,_0x4ab0f2=_0x41fedb[0x0];if(!_0x4ab0f2)return console[_0x48ed18(0x12f)](_0x48ed18(0x141)),console[_0x48ed18(0x12f)](_0x48ed18(0xb4)),console[_0x48ed18(0x12f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x48ed18(0x12f)](_0x48ed18(0x12d)),console[_0x48ed18(0x12f)](_0x48ed18(0xe5)),console[_0x48ed18(0x12f)](_0x48ed18(0x106)),console['error'](_0x48ed18(0x11d)),console['error'](_0x48ed18(0x14a)),console[_0x48ed18(0x12f)](_0x48ed18(0xd6)),console[_0x48ed18(0x12f)](_0x48ed18(0x129)),0x1;try{const _0x79303e=_0x1a998e[_0x48ed18(0xc6)],_0x53bf13=await resolveSegmentTarget(_0x4ab0f2,_0x79303e,_0x1a998e['verbose']);_0x1a998e[_0x48ed18(0xdb)]&&console['error'](_0x48ed18(0x127)+_0x53bf13);const _0x15ec83=await withSpinner('Resolving\x20\x27'+_0x4ab0f2+_0x48ed18(0x14c),()=>_0x187555[_0x48ed18(0x144)]['resolvePathToResource'](_0x53bf13),{'verbose':_0x1a998e['verbose']}),_0x10d309=_0x15ec83[_0x48ed18(0x100)];_0x1a998e[_0x48ed18(0xdb)]&&(console[_0x48ed18(0x12f)](_0x48ed18(0x139)+_0x10d309[_0x48ed18(0xf6)]),console[_0x48ed18(0x12f)](_0x48ed18(0xc0)+_0x10d309[_0x48ed18(0x150)]),_0x10d309[_0x48ed18(0x13f)]&&console[_0x48ed18(0x12f)]('Folder\x20ID:\x20'+_0x10d309[_0x48ed18(0x13f)]),_0x10d309[_0x48ed18(0x10d)]&&console[_0x48ed18(0x12f)](_0x48ed18(0x109)+_0x10d309[_0x48ed18(0x10d)]));if(_0x1a998e['web']){if(_0x10d309[_0x48ed18(0xf6)]===_0x48ed18(0x14e))return console[_0x48ed18(0x12f)](_0x48ed18(0xd5)),0x1;if(_0x10d309[_0x48ed18(0xf6)]===_0x48ed18(0x107))return console[_0x48ed18(0x12f)](_0x48ed18(0x114)),console[_0x48ed18(0x12f)](_0x48ed18(0x103)),0x1;if(!_0x10d309[_0x48ed18(0x10d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x48ed18(0x11c));const _0x53458b=getConsoleNextUrl(_0x1a998e['site'],_0x48ed18(0xfc)+_0x10d309[_0x48ed18(0x150)]+_0x48ed18(0xda)+_0x10d309[_0x48ed18(0x10d)]);return console[_0x48ed18(0x12f)](a38_0x138c10[_0x48ed18(0xf4)]('✔')+_0x48ed18(0xfb)+a38_0x138c10[_0x48ed18(0x148)](_0x53458b)),openBrowser(_0x53458b),0x0;}if(_0x10d309['type']===_0x48ed18(0x14e)){if(!_0x10d309[_0x48ed18(0x13f)])throw new SDKError(ErrorCode[_0x48ed18(0x13b)],_0x48ed18(0x117));const _0x4f0fdf=await withSpinner('Fetching\x20folder\x20details...',()=>_0x187555[_0x48ed18(0x144)][_0x48ed18(0xea)](_0x10d309['folderId']),{'verbose':_0x1a998e[_0x48ed18(0xdb)]});await handleSingleObjectOutput(_0x4f0fdf[_0x48ed18(0x100)],_0x1a998e);}else{if(_0x10d309['type']==='segment'){if(!_0x10d309[_0x48ed18(0x10d)])throw new SDKError(ErrorCode[_0x48ed18(0xb5)],_0x48ed18(0x11c));const _0xbdb155=await withSpinner(_0x48ed18(0x138),()=>_0x187555['segment']['getSegment'](_0x10d309[_0x48ed18(0x150)],_0x10d309['segmentId']),{'verbose':_0x1a998e[_0x48ed18(0xdb)]}),_0x447e1c=getConsoleNextUrl(_0x1a998e['site'],_0x48ed18(0xfc)+_0x10d309[_0x48ed18(0x150)]+_0x48ed18(0xda)+_0x10d309['segmentId']),_0x49a727=_0xbdb155[_0x48ed18(0x100)];_0x49a727[_0x48ed18(0xb2)]=_0x447e1c,await handleSingleObjectOutput(_0x49a727,_0x1a998e);}else return console['error'](_0x48ed18(0xd3)),console[_0x48ed18(0x12f)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x1219b0){if(_0x1219b0 instanceof SDKError)return console['error'](_0x48ed18(0xb6)+_0x1219b0[_0x48ed18(0xc3)]),_0x1219b0[_0x48ed18(0x104)]&&console[_0x48ed18(0x12f)](_0x48ed18(0x11e)+_0x1219b0[_0x48ed18(0x104)]),0x1;throw _0x1219b0;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x51a13b(0xfa)]='segment:desc';[a38_0x51a13b(0xbe)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x540ea8){const _0x149a5b=a38_0x51a13b,{options:_0x45426e,args:_0x108887,tdx:_0x3dc178}=_0x540ea8,_0x369f3c=_0x108887[0x0];if(!_0x369f3c)return console[_0x149a5b(0x12f)](_0x149a5b(0xca)),console[_0x149a5b(0x12f)](_0x149a5b(0x118)),console[_0x149a5b(0x12f)](_0x149a5b(0xcf)),console[_0x149a5b(0x12f)](_0x149a5b(0x106)),console[_0x149a5b(0x12f)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error'](_0x149a5b(0xb0)),0x1;try{const _0x2b22d2=_0x45426e[_0x149a5b(0xc6)],_0x10dce9=await resolveSegmentTarget(_0x369f3c,_0x2b22d2,_0x45426e[_0x149a5b(0xdb)]);_0x45426e[_0x149a5b(0xdb)]&&console[_0x149a5b(0x12f)]('Target\x20path:\x20'+_0x10dce9);const _0x19378f=await withSpinner(_0x149a5b(0x13c)+_0x369f3c+_0x149a5b(0x14c),()=>_0x3dc178[_0x149a5b(0x144)][_0x149a5b(0xd2)](_0x10dce9),{'verbose':_0x45426e[_0x149a5b(0xdb)]}),_0x14ddd2=_0x19378f[_0x149a5b(0x100)];_0x45426e[_0x149a5b(0xdb)]&&(console['error'](_0x149a5b(0x139)+_0x14ddd2[_0x149a5b(0xf6)]),console[_0x149a5b(0x12f)](_0x149a5b(0xc0)+_0x14ddd2['parentId']));if(_0x14ddd2[_0x149a5b(0xf6)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x149a5b(0x12f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x14ddd2['type']===_0x149a5b(0x107))return console[_0x149a5b(0x12f)](_0x149a5b(0xe9)),console[_0x149a5b(0x12f)](_0x149a5b(0x13a)),0x1;if(!_0x14ddd2[_0x149a5b(0x10d)])throw new SDKError(ErrorCode[_0x149a5b(0xb5)],_0x149a5b(0x11c));const _0x113c1c=await withSpinner(_0x149a5b(0xee),()=>_0x3dc178[_0x149a5b(0x144)]['getSegmentSQL'](_0x14ddd2[_0x149a5b(0x150)],_0x14ddd2[_0x149a5b(0x10d)]),{'verbose':_0x45426e[_0x149a5b(0xdb)]}),_0x3bab10=_0x113c1c[_0x149a5b(0x100)],_0x359d83=await executeSchemaQuery(_0x3bab10,_0x3dc178,_0x45426e);return await handleQueryOutput(_0x359d83,_0x45426e),0x0;}catch(_0x131af3){if(_0x131af3 instanceof SDKError)return console[_0x149a5b(0x12f)](_0x149a5b(0xb6)+_0x131af3[_0x149a5b(0xc3)]),_0x131af3[_0x149a5b(0x104)]&&console[_0x149a5b(0x12f)]('\x20\x20Cause:\x20'+_0x131af3[_0x149a5b(0x104)]),0x1;throw _0x131af3;}}}function a38_0x4863(){const _0xe66675=['\x20\x20Segment\x20name:\x20','Options:','1781616QrQgJs','error','\x20\x20Parent\x20segment:\x20','jobId','trim','resolveFolderId','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','resolveParentId','red','Fetching\x20segment\x20details...','Resolved\x20type:\x20','Use:\x20tdx\x20ps\x20desc','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20\x27','✔\x20Created\x20folder\x20\x27','segment:show','folderId','14eYKQZn','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','processedRows','segment:sql','segment','Resolved\x20YAML\x20file:\x20','✖\x20Query\x20failed\x20[','Show\x20folder\x20or\x20child\x20segment\x20details','cyan','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x27...','segment:folder:create','folder','Folder\x20ID:\x20','parentId','parentFolder','listFolders','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segmentPath','url','Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','SEGMENT_NOT_FOUND','Error:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Folder\x20reference\x20is\x20required','Parent\x20segment:\x20','limit','Resolved\x20parent\x20folder\x20ID:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','getSQLFromYamlFile','description','4486355QteLxf','Parent\x20ID:\x20','466040YJsoJO','Show\x20segment\x20or\x20folder\x20details','message','segmentName','createFolder','parentSegment','Listing\x20folders\x20for\x20parent\x20\x27','Resolved:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','resolvePathToResource','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','INVALID_ARGUMENT','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','folderPath','fullPath','153CDgGvM','/e/','verbose','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Folder\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','131266ggEoPA','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','getSegment','execute','SQL\x20query:\x0a','Resolving\x20parent\x20segment\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','information_schema','21665644dchjKQ','path','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getFolder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Fetching\x20parent\x20segment\x20details...','getParent','Fetching\x20SQL\x20for\x20segment...','elapsedTimeMillis','stats','format','Show\x20segment\x20folder\x20details','test','green','Error:\x20Path\x20or\x20name\x20is\x20required','type','10396890oTaGiC','Creating\x20folder\x20\x27','jsonl','name','\x20Opening\x20','/app/ps/','Fetching\x20folder\x20\x27','3684cbwiCA','code','data','Site:\x20','json','Use:\x20tdx\x20ps\x20view\x20-w','cause','replace','Examples:','parent','Usage:','Segment\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segment:folder:show','4jwYaAI','segmentId','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','length','in\x20','\x20\x20Full\x20path:\x20','segment:view','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','Folder\x20name:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20desc\x20<name>','site','content','query','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Cause:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20folder\x20\x27','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Found\x20','9919GwEgcm','Target\x20path:\x20','includes','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:describe'];a38_0x4863=function(){return _0xe66675;};return a38_0x4863();}
|
|
1
|
+
const a38_0x3d8182=a38_0x8d41;(function(_0x487843,_0x21c8a7){const _0x5b165e=a38_0x8d41,_0x269501=_0x487843();while(!![]){try{const _0x410387=parseInt(_0x5b165e(0x11f))/0x1*(-parseInt(_0x5b165e(0x10f))/0x2)+parseInt(_0x5b165e(0x108))/0x3*(parseInt(_0x5b165e(0x13d))/0x4)+parseInt(_0x5b165e(0x149))/0x5*(-parseInt(_0x5b165e(0x1a4))/0x6)+-parseInt(_0x5b165e(0x192))/0x7*(parseInt(_0x5b165e(0x144))/0x8)+-parseInt(_0x5b165e(0x13e))/0x9*(-parseInt(_0x5b165e(0x10a))/0xa)+parseInt(_0x5b165e(0x175))/0xb+-parseInt(_0x5b165e(0x17b))/0xc;if(_0x410387===_0x21c8a7)break;else _0x269501['push'](_0x269501['shift']());}catch(_0x37741b){_0x269501['push'](_0x269501['shift']());}}}(a38_0x1fb2,0xe0923));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a38_0x8d41(_0xb3bdd2,_0x239151){_0xb3bdd2=_0xb3bdd2-0xfc;const _0x1fb2fa=a38_0x1fb2();let _0x8d4174=_0x1fb2fa[_0xb3bdd2];return _0x8d4174;}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';function a38_0x1fb2(){const _0x19dc04=['resolveParentId','Target\x20path:\x20','site','getParent','parentFolder','web','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolved\x20parent\x20folder\x20ID:\x20','parentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Path\x20or\x20name\x20is\x20required','processedRows','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segmentId','createFolder','data','getSegment','parentSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','red','format','24404VWCWJN','20664jRMGGO','Resolved\x20type:\x20','Examples:','content','segment:folder:create','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','3896IzhIBb','/app/ps/','Fetching\x20SQL\x20from\x20rule...','Show\x20folder\x20or\x20child\x20segment\x20details','Folder\x20ID\x20missing\x20from\x20resolved\x20path','332670MWAZBD','\x20\x20Segment\x20name:\x20','log','segment','/e/','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','SEGMENT_FOLDER_NOT_FOUND','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20Parent\x20segment:\x20','json','Folder\x20name:\x20','description','stats','cyan','\x20\x20Full\x20path:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20folder\x20ID:\x20','resolveFolderId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','message','Error:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','(root)','path','getSegmentSQLFromYaml','url','execute','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20path\x20\x27','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','green','limit','Site:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','11141482iecrpM','segment:folder:show','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Executing\x20segment\x20query...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Get\x20SQL\x20query\x20for\x20child\x20segment','13937880SvGDij','segmentPath','replace','parent','type','includes','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SELECT\x20*\x20FROM\x20(\x0a','segment:describe','Creating\x20folder\x20\x27','jsonl','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:sql','SQL\x20query:\x0a','Resolving\x20parent\x20folder\x20\x27','jobId','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','1897gtuiMR','information_schema','SEGMENT_NOT_FOUND','getSegmentSQL','segment:show','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Resolving\x20\x27','Resolved\x20parent\x20ID:\x20','segmentName','error','segment:desc','\x20[Job\x20ID:\x20','fullPath','\x20folder','Segment\x20ID:\x20','Fetching\x20folder\x20\x27','66GsgWoc','listFolders','Show\x20segment\x20folder\x20details','code','getSQLFromYamlFile','verbose','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','setJobId','Resolving\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','folder','INVALID_ARGUMENT','885pKkkyf','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','2390efkzvo','folderId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Create\x20segment\x20folder\x20for\x20organization','2QSsIff','resolvePathToResource','Resolved:\x20','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x27...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','cause','length','\x27\x20with\x20ID:\x20','name','\x20\x20Cause:\x20','getFolder','416217bjbcHt','segment:folder:list','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20parent\x20segment\x20details...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both'];a38_0x1fb2=function(){return _0x19dc04;};return a38_0x1fb2();}import{openBrowser}from'../utils/process.js';import a38_0x2e9d84 from'chalk';async function resolveSegmentTarget(_0x5023b1,_0x4d75da,_0x2e7e59){const _0x418e53=a38_0x8d41;if(isYamlFilePath(_0x5023b1))try{const _0x14df5e=await resolveYamlFilePath(_0x5023b1);return _0x2e7e59&&(console[_0x418e53(0x19d)]('Resolved\x20YAML\x20file:\x20'+_0x5023b1),console['error'](_0x418e53(0x155)+_0x14df5e[_0x418e53(0x138)]),console[_0x418e53(0x19d)](_0x418e53(0x14a)+_0x14df5e[_0x418e53(0x19c)]),console[_0x418e53(0x19d)]('\x20\x20Folder\x20path:\x20'+(_0x14df5e['folderPath']||_0x418e53(0x164))),console[_0x418e53(0x19d)](_0x418e53(0x15b)+_0x14df5e[_0x418e53(0x1a0)])),_0x14df5e[_0x418e53(0x1a0)];}catch(_0x3e5cf9){throw new SDKError(ErrorCode[_0x418e53(0x107)],_0x418e53(0x123)+_0x3e5cf9[_0x418e53(0x161)]);}if(!_0x4d75da)throw new SDKError(ErrorCode[_0x418e53(0x107)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4d75da+'/'+_0x5023b1;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x183);['description']='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x40a09a){const _0x1f8e8e=a38_0x3d8182,{options:_0x1a930f,args:_0x576bf7,tdx:_0x4812cd}=_0x40a09a,_0xc698a3=_0x576bf7[0x0],_0xf5ad68=!_0xc698a3&&!!_0x1a930f['parentSegment'],_0x739df=_0xc698a3||_0x1a930f['parentSegment'];if(!_0x739df)return console['error'](_0x1f8e8e(0x131)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1f8e8e(0x19d)]('Examples:'),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x16c)),console['error'](_0x1f8e8e(0x179)),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x15f)),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x13a)),0x1;try{const _0x1a2aab=_0x1a930f[_0x1f8e8e(0x17c)];let _0x583968=_0x739df;!_0xf5ad68&&_0x1a2aab&&!_0x739df[_0x1f8e8e(0x180)]('/')&&(_0x583968=_0x1a2aab+'/'+_0x739df,_0x1a930f['verbose']&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x151)+_0x583968));const _0x176877=await withSpinner(_0x1f8e8e(0x16d)+_0x583968+'\x27...',()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x110)](_0x583968),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]}),_0x49d9b8=_0x176877['data'];_0x1a930f['verbose']&&(console[_0x1f8e8e(0x19d)]('Resolved\x20type:\x20'+_0x49d9b8[_0x1f8e8e(0x17f)]),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x153)+_0x49d9b8[_0x1f8e8e(0x12f)]),_0x49d9b8[_0x1f8e8e(0x10b)]&&console['error'](_0x1f8e8e(0x187)+_0x49d9b8[_0x1f8e8e(0x10b)]),_0x49d9b8[_0x1f8e8e(0x134)]&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x1a2)+_0x49d9b8[_0x1f8e8e(0x134)]));if(_0x49d9b8[_0x1f8e8e(0x17f)]===_0x1f8e8e(0x17e)){const _0x44c0f0=await withSpinner(_0x1f8e8e(0x124),()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x129)](_0x49d9b8[_0x1f8e8e(0x12f)]),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]});await handleSingleObjectOutput(_0x44c0f0[_0x1f8e8e(0x136)],_0x1a930f);}else{if(_0x49d9b8[_0x1f8e8e(0x17f)]===_0x1f8e8e(0x106)){if(!_0x49d9b8[_0x1f8e8e(0x10b)])throw new SDKError(ErrorCode[_0x1f8e8e(0x152)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x44f008=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x11e)](_0x49d9b8['folderId']),{'verbose':_0x1a930f['verbose']});await handleSingleObjectOutput(_0x44f008[_0x1f8e8e(0x136)],_0x1a930f);}else{if(_0x49d9b8['type']==='segment'){if(!_0x49d9b8['segmentId'])throw new SDKError(ErrorCode[_0x1f8e8e(0x194)],_0x1f8e8e(0x150));const _0x32a63f=await withSpinner(_0x1f8e8e(0x105),()=>_0x4812cd['segment'][_0x1f8e8e(0x137)](_0x49d9b8[_0x1f8e8e(0x12f)],_0x49d9b8[_0x1f8e8e(0x134)]),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]});await handleSingleObjectOutput(_0x32a63f[_0x1f8e8e(0x136)],_0x1a930f);}}}return 0x0;}catch(_0x2f6525){if(_0x2f6525 instanceof SDKError)return console['error']('Error:\x20'+_0x2f6525['message']),_0x2f6525['cause']&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x11d)+_0x2f6525['cause']),0x1;throw _0x2f6525;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x196);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x177);async[a38_0x3d8182(0x168)](_0x28c8eb){const _0x120964=a38_0x3d8182,{options:_0x3ec2d3,args:_0x423966,tdx:_0x4b08ff}=_0x28c8eb,_0x327e4e=_0x423966[0x0];if(!_0x327e4e)return console[_0x120964(0x19d)](_0x120964(0x10c)),console[_0x120964(0x19d)](_0x120964(0x139)),console[_0x120964(0x19d)](_0x120964(0x118)),console[_0x120964(0x19d)](_0x120964(0x140)),console[_0x120964(0x19d)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x120964(0x19d)](_0x120964(0x189)),0x1;try{const _0x3bffb5=_0x3ec2d3['parentSegment'],_0x4116c6=await resolveSegmentTarget(_0x327e4e,_0x3bffb5,_0x3ec2d3['verbose']);_0x3ec2d3['verbose']&&console[_0x120964(0x19d)]('Target\x20path:\x20'+_0x4116c6);const _0x57f37e=await withSpinner(_0x120964(0x19a)+_0x327e4e+_0x120964(0x115),()=>_0x4b08ff[_0x120964(0x14c)][_0x120964(0x110)](_0x4116c6),{'verbose':_0x3ec2d3[_0x120964(0x100)]}),_0x50766e=_0x57f37e['data'];_0x3ec2d3[_0x120964(0x100)]&&(console[_0x120964(0x19d)](_0x120964(0x13f)+_0x50766e['type']),console['error']('Parent\x20ID:\x20'+_0x50766e[_0x120964(0x12f)]));if(_0x50766e[_0x120964(0x17f)]===_0x120964(0x106))return console[_0x120964(0x19d)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x120964(0x19d)](_0x120964(0x109)),0x1;if(_0x50766e[_0x120964(0x17f)]==='parent')return console[_0x120964(0x19d)](_0x120964(0x197)),console[_0x120964(0x19d)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x50766e[_0x120964(0x134)])throw new SDKError(ErrorCode[_0x120964(0x194)],_0x120964(0x150));const _0x2654a7=await withSpinner(_0x120964(0x113),()=>_0x4b08ff[_0x120964(0x14c)][_0x120964(0x195)](_0x50766e[_0x120964(0x12f)],_0x50766e['segmentId']),{'verbose':_0x3ec2d3[_0x120964(0x100)]});let _0x405761=_0x2654a7[_0x120964(0x136)];const _0x13dae1=resolveLimit(_0x3ec2d3[_0x120964(0x172)],DEFAULT_DISPLAY_LIMIT),_0x271f23=/\bLIMIT\s+\d+/i['test'](_0x405761);!_0x271f23&&(_0x405761=_0x405761['trim']()[_0x120964(0x17d)](/;+$/,''),_0x405761=_0x120964(0x182)+_0x405761+_0x120964(0x12d)+_0x13dae1);_0x3ec2d3[_0x120964(0x100)]&&console[_0x120964(0x19d)](_0x120964(0x18b)+_0x405761);const _0x5e8e52=await withProgressSpinner(_0x120964(0x178),async _0x3ab730=>{const _0x146efd=_0x120964,_0x4e151a=await _0x4b08ff['query'][_0x146efd(0x168)](_0x405761,{'catalog':'td','schema':_0x146efd(0x193),'onJobId':_0x17b6f1=>{const _0x57e0d1=_0x146efd;_0x3ab730[_0x57e0d1(0x102)](_0x17b6f1);}});return _0x4e151a;},{'verbose':_0x3ec2d3[_0x120964(0x100)]}),_0x36ba2b=_0x5e8e52[_0x120964(0x136)],_0x44eb4c=_0x36ba2b[_0x120964(0x18d)]?_0x120964(0x19f)+_0x36ba2b[_0x120964(0x18d)]+']':'';return console['error'](_0x120964(0x104)+_0x36ba2b[_0x120964(0x159)][_0x120964(0x132)]['toLocaleString']()+_0x120964(0x117)+('in\x20'+formatElapsed(_0x36ba2b[_0x120964(0x159)][_0x120964(0x16e)])+_0x44eb4c)),await handleQueryOutput(_0x36ba2b,_0x3ec2d3),0x0;}catch(_0x47d9ca){if(_0x47d9ca instanceof SDKError)return console[_0x120964(0x19d)]('✖\x20Query\x20failed\x20['+_0x47d9ca[_0x120964(0xfe)]+']'),console['error']('\x0a'+_0x47d9ca[_0x120964(0x161)]),0x1;throw _0x47d9ca;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x120);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x130);async[a38_0x3d8182(0x168)](_0x433b17){const _0x5a0063=a38_0x3d8182,{options:_0x425495,args:_0xa8d82e,tdx:_0x1d38ca}=_0x433b17;if(_0xa8d82e[_0x5a0063(0x11a)]===0x0)return console[_0x5a0063(0x19d)](_0x5a0063(0x14f)),console[_0x5a0063(0x19d)](_0x5a0063(0x181)),0x1;const _0x45892e=_0xa8d82e[0x0];try{_0x425495['verbose']&&(console[_0x5a0063(0x19d)]('Site:\x20'+_0x425495[_0x5a0063(0x128)]),console[_0x5a0063(0x19d)]('Parent\x20name:\x20'+_0x45892e));const _0x3fe689=await withSpinner(_0x5a0063(0x103)+_0x45892e+_0x5a0063(0x115),()=>_0x1d38ca[_0x5a0063(0x14c)][_0x5a0063(0x126)](_0x45892e),{'verbose':_0x425495[_0x5a0063(0x100)]}),_0x367ee0=_0x3fe689[_0x5a0063(0x136)];_0x425495[_0x5a0063(0x100)]&&console[_0x5a0063(0x19d)](_0x5a0063(0x19b)+_0x367ee0);const _0x5e91bf=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x45892e+'\x27...',()=>_0x1d38ca['segment'][_0x5a0063(0xfc)](_0x367ee0),{'verbose':_0x425495[_0x5a0063(0x100)]}),_0x1476f9=_0x5e91bf[_0x5a0063(0x136)];return console[_0x5a0063(0x19d)]('✔\x20Found\x20'+_0x1476f9['length']+_0x5a0063(0x1a1)+(_0x1476f9['length']!==0x1?'s':'')),await handleSDKOutput(_0x1476f9,_0x425495),0x0;}catch(_0x1c2215){if(_0x1c2215 instanceof SDKError)return console[_0x5a0063(0x19d)](_0x5a0063(0x162)+_0x1c2215[_0x5a0063(0x161)]),_0x1c2215['cause']&&console[_0x5a0063(0x19d)]('\x20\x20Cause:\x20'+_0x1c2215[_0x5a0063(0x119)]),0x1;throw _0x1c2215;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a38_0x3d8182(0x176);[a38_0x3d8182(0x158)]=a38_0x3d8182(0xfd);async[a38_0x3d8182(0x168)](_0x778fcc){const _0x33b351=a38_0x3d8182,{options:_0x4296aa,args:_0x1a0717,tdx:_0x227b22}=_0x778fcc;if(_0x1a0717['length']===0x0)return console[_0x33b351(0x19d)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x33b351(0x19d)](_0x33b351(0x188)),0x1;try{const {parentId:_0x10b119,childId:_0x1e0fcf}=parseSegmentRef(_0x1a0717[0x0]);_0x4296aa[_0x33b351(0x100)]&&(console[_0x33b351(0x19d)](_0x33b351(0x173)+_0x4296aa[_0x33b351(0x128)]),console[_0x33b351(0x19d)]('Parent\x20name:\x20'+_0x10b119),_0x1e0fcf&&console['error'](_0x33b351(0x157)+_0x1e0fcf));if(!_0x1e0fcf)return console[_0x33b351(0x19d)](_0x33b351(0x101)),0x1;const _0x4f06ec=await withSpinner(_0x33b351(0x103)+_0x10b119+_0x33b351(0x115),()=>_0x227b22[_0x33b351(0x14c)]['resolveParentId'](_0x10b119),{'verbose':_0x4296aa[_0x33b351(0x100)]}),_0x8eab9b=_0x4f06ec['data'];_0x4296aa['verbose']&&console[_0x33b351(0x19d)](_0x33b351(0x19b)+_0x8eab9b);const _0x2c96fd=await withSpinner(_0x33b351(0x121)+_0x1e0fcf+_0x33b351(0x115),()=>_0x227b22[_0x33b351(0x14c)][_0x33b351(0x15e)](_0x8eab9b,_0x1e0fcf),{'verbose':_0x4296aa['verbose']}),_0x3f3e89=_0x2c96fd[_0x33b351(0x136)];_0x4296aa[_0x33b351(0x100)]&&console['error'](_0x33b351(0x15d)+_0x3f3e89);const _0x2cb34d=await withSpinner(_0x33b351(0x1a3)+_0x1e0fcf+'\x27...',()=>_0x227b22[_0x33b351(0x14c)][_0x33b351(0x11e)](_0x3f3e89),{'verbose':_0x4296aa[_0x33b351(0x100)]});return await handleSDKOutput([_0x2cb34d[_0x33b351(0x136)]],_0x4296aa),0x0;}catch(_0x375947){if(_0x375947 instanceof SDKError)return console[_0x33b351(0x19d)](_0x33b351(0x162)+_0x375947['message']),_0x375947[_0x33b351(0x119)]&&console[_0x33b351(0x19d)](_0x33b351(0x11d)+_0x375947[_0x33b351(0x119)]),0x1;throw _0x375947;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x18a);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x17a);async[a38_0x3d8182(0x168)](_0x174d35){const _0x38121f=a38_0x3d8182,{options:_0x4fdd73,args:_0xa8a0cf}=_0x174d35,_0x5b40a2=_0x4fdd73,_0xf09389=_0x5b40a2[_0x38121f(0x165)],_0xbd97a3=_0xa8a0cf[0x0];if(!_0xbd97a3&&!_0xf09389)return console[_0x38121f(0x19d)](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x133))),console[_0x38121f(0x19d)]('Usage:'),console[_0x38121f(0x19d)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x38121f(0x19d)](_0x38121f(0x199)),console[_0x38121f(0x19d)](_0x38121f(0x140)),console[_0x38121f(0x19d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x38121f(0x19d)](_0x38121f(0x122)),0x1;if(_0xbd97a3&&_0xf09389)return console[_0x38121f(0x19d)](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x125))),0x1;try{let _0x2bf6da;if(_0xf09389)_0x2bf6da=await this[_0x38121f(0xff)](_0xf09389,_0x174d35);else{if(isYamlFilePath(_0xbd97a3))return console['error'](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x143))),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0xbd97a3),0x1;else _0x2bf6da=await this['getSQLFromServerSegment'](_0xbd97a3,_0x174d35);}return _0x4fdd73[_0x38121f(0x13c)]===_0x38121f(0x156)||_0x4fdd73[_0x38121f(0x13c)]===_0x38121f(0x185)?await handleSDKOutput([{'sql':_0x2bf6da}],_0x4fdd73):console[_0x38121f(0x14b)](_0x2bf6da),0x0;}catch(_0x1e1205){if(_0x1e1205 instanceof SDKError)return console['error']('Error:\x20'+_0x1e1205[_0x38121f(0x161)]),_0x1e1205[_0x38121f(0x119)]&&console['error']('\x20\x20Cause:\x20'+_0x1e1205[_0x38121f(0x119)]),0x1;throw _0x1e1205;}}async[a38_0x3d8182(0xff)](_0x4ec826,_0x766fb0){const _0x2649ce=a38_0x3d8182,{options:_0x3095be,tdx:_0x262d64}=_0x766fb0;let _0x617730;try{_0x617730=await resolveYamlFilePath(_0x4ec826);}catch(_0x529edc){throw new SDKError(ErrorCode[_0x2649ce(0x107)],_0x2649ce(0x123)+_0x529edc[_0x2649ce(0x161)]);}_0x3095be[_0x2649ce(0x100)]&&console['error'](_0x2649ce(0x111)+_0x617730['parentSegment']+'/'+_0x617730['segmentName']);const _0x377472=await withSpinner(_0x2649ce(0x146),()=>_0x262d64['segment'][_0x2649ce(0x166)](_0x617730[_0x2649ce(0x141)],_0x617730[_0x2649ce(0x138)],_0x617730['segmentName']),{'verbose':_0x3095be[_0x2649ce(0x100)]});return _0x377472[_0x2649ce(0x136)];}async['getSQLFromServerSegment'](_0x3fcee5,_0xa9f855){const _0x31316f=a38_0x3d8182,{options:_0x49d408,tdx:_0x1550bc}=_0xa9f855,_0x1cc909=_0x49d408['parentSegment'],_0x2404fe=await resolveSegmentTarget(_0x3fcee5,_0x1cc909,_0x49d408[_0x31316f(0x100)]);_0x49d408[_0x31316f(0x100)]&&console[_0x31316f(0x19d)](_0x31316f(0x127)+_0x2404fe);const _0x12d189=await withSpinner(_0x31316f(0x19a)+_0x3fcee5+_0x31316f(0x115),()=>_0x1550bc[_0x31316f(0x14c)][_0x31316f(0x110)](_0x2404fe),{'verbose':_0x49d408[_0x31316f(0x100)]}),_0x28a529=_0x12d189[_0x31316f(0x136)];_0x49d408[_0x31316f(0x100)]&&(console['error'](_0x31316f(0x13f)+_0x28a529[_0x31316f(0x17f)]),console[_0x31316f(0x19d)](_0x31316f(0x153)+_0x28a529[_0x31316f(0x12f)]));if(_0x28a529[_0x31316f(0x17f)]==='folder')throw new SDKError(ErrorCode[_0x31316f(0x107)],_0x31316f(0x160));if(_0x28a529[_0x31316f(0x17f)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x31316f(0x191));if(!_0x28a529[_0x31316f(0x134)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x31316f(0x150));const _0x576798=await withSpinner(_0x31316f(0x113),()=>_0x1550bc['segment']['getSegmentSQL'](_0x28a529['parentId'],_0x28a529[_0x31316f(0x134)]),{'verbose':_0x49d408['verbose']});return _0x576798[_0x31316f(0x136)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x142);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x10e);async[a38_0x3d8182(0x168)](_0x225d35){const _0x288d9d=a38_0x3d8182,{options:_0x4cbd57,args:_0x52ac16,tdx:_0x10adfd}=_0x225d35,_0x42462=_0x4cbd57;if(_0x52ac16[_0x288d9d(0x11a)]<0x2)return console['error'](_0x288d9d(0x16f)),console[_0x288d9d(0x19d)](_0x288d9d(0x174)),0x1;const _0x1f4af7=_0x52ac16[0x0],_0x4524ef=_0x52ac16[0x1];_0x42462[_0x288d9d(0x100)]&&(console['error'](_0x288d9d(0x173)+_0x42462[_0x288d9d(0x128)]),console[_0x288d9d(0x19d)](_0x288d9d(0x14e)+_0x1f4af7),console[_0x288d9d(0x19d)](_0x288d9d(0x157)+_0x4524ef));let _0x789f8f;if(_0x42462['parentFolder']){const _0x12c22c=_0x42462[_0x288d9d(0x12a)],_0x19a94=await withSpinner(_0x288d9d(0x103)+_0x1f4af7+_0x288d9d(0x115),()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x126)](_0x1f4af7),{'verbose':_0x42462['verbose']}),_0x384071=_0x19a94['data'],_0x167f98=await withSpinner(_0x288d9d(0x18c)+_0x12c22c+'\x27...',()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x15e)](_0x384071,_0x12c22c),{'verbose':_0x42462[_0x288d9d(0x100)]});_0x789f8f=_0x167f98[_0x288d9d(0x136)],_0x42462[_0x288d9d(0x100)]&&console['error'](_0x288d9d(0x12e)+_0x789f8f);}const _0x131ba5={'name':_0x4524ef,'description':_0x42462[_0x288d9d(0x158)],'parentFolderId':_0x789f8f},_0x560a23=await withSpinner(_0x288d9d(0x184)+_0x4524ef+'\x27...',()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x135)](_0x1f4af7,_0x131ba5),{'verbose':_0x42462[_0x288d9d(0x100)]}),_0x5c4729=_0x560a23[_0x288d9d(0x136)];return console[_0x288d9d(0x19d)]('✔\x20Created\x20folder\x20\x27'+_0x5c4729['name']+_0x288d9d(0x11b)+_0x5c4729['id']),await handleSDKOutput([_0x5c4729],_0x42462),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x3d8182(0x11c)]='segment:view';[a38_0x3d8182(0x158)]=a38_0x3d8182(0x147);async['execute'](_0x5e0486){const _0x18c60b=a38_0x3d8182,{options:_0x36afd0,args:_0x1df92e,tdx:_0x5de38a}=_0x5e0486,_0x3705dc=_0x1df92e[0x0];if(!_0x3705dc)return console[_0x18c60b(0x19d)](_0x18c60b(0x12c)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x18c60b(0x16b)),console['error']('Options:'),console[_0x18c60b(0x19d)](_0x18c60b(0x190)),console['error'](_0x18c60b(0x140)),console[_0x18c60b(0x19d)](_0x18c60b(0x16a)),console['error'](_0x18c60b(0x198)),console['error'](_0x18c60b(0x116)),console[_0x18c60b(0x19d)](_0x18c60b(0x18e)),0x1;try{const _0x25d593=_0x36afd0[_0x18c60b(0x138)],_0x49b638=await resolveSegmentTarget(_0x3705dc,_0x25d593,_0x36afd0[_0x18c60b(0x100)]);_0x36afd0[_0x18c60b(0x100)]&&console['error'](_0x18c60b(0x127)+_0x49b638);const _0x1a3e0b=await withSpinner(_0x18c60b(0x19a)+_0x3705dc+_0x18c60b(0x115),()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x110)](_0x49b638),{'verbose':_0x36afd0[_0x18c60b(0x100)]}),_0x3c34c7=_0x1a3e0b['data'];_0x36afd0[_0x18c60b(0x100)]&&(console[_0x18c60b(0x19d)]('Resolved\x20type:\x20'+_0x3c34c7[_0x18c60b(0x17f)]),console[_0x18c60b(0x19d)]('Parent\x20ID:\x20'+_0x3c34c7[_0x18c60b(0x12f)]),_0x3c34c7['folderId']&&console['error'](_0x18c60b(0x187)+_0x3c34c7[_0x18c60b(0x10b)]),_0x3c34c7[_0x18c60b(0x134)]&&console[_0x18c60b(0x19d)]('Segment\x20ID:\x20'+_0x3c34c7[_0x18c60b(0x134)]));if(_0x36afd0[_0x18c60b(0x12b)]){if(_0x3c34c7[_0x18c60b(0x17f)]==='folder')return console[_0x18c60b(0x19d)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x17e))return console[_0x18c60b(0x19d)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x18c60b(0x19d)](_0x18c60b(0x169)),0x1;if(!_0x3c34c7[_0x18c60b(0x134)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x18c60b(0x150));const _0x1d22b1=getConsoleNextUrl(_0x36afd0[_0x18c60b(0x128)],'/app/ps/'+_0x3c34c7[_0x18c60b(0x12f)]+_0x18c60b(0x14d)+_0x3c34c7[_0x18c60b(0x134)]);return console['error'](a38_0x2e9d84[_0x18c60b(0x171)]('✔')+'\x20Opening\x20'+a38_0x2e9d84[_0x18c60b(0x15a)](_0x1d22b1)),openBrowser(_0x1d22b1),0x0;}if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x106)){if(!_0x3c34c7['folderId'])throw new SDKError(ErrorCode[_0x18c60b(0x152)],_0x18c60b(0x148));const _0x19f78b=await withSpinner('Fetching\x20folder\x20details...',()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x11e)](_0x3c34c7[_0x18c60b(0x10b)]),{'verbose':_0x36afd0['verbose']});await handleSingleObjectOutput(_0x19f78b[_0x18c60b(0x136)],_0x36afd0);}else{if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x14c)){if(!_0x3c34c7[_0x18c60b(0x134)])throw new SDKError(ErrorCode[_0x18c60b(0x194)],_0x18c60b(0x150));const _0xdc042b=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x137)](_0x3c34c7[_0x18c60b(0x12f)],_0x3c34c7[_0x18c60b(0x134)]),{'verbose':_0x36afd0[_0x18c60b(0x100)]}),_0x11723d=getConsoleNextUrl(_0x36afd0[_0x18c60b(0x128)],_0x18c60b(0x145)+_0x3c34c7['parentId']+'/e/'+_0x3c34c7[_0x18c60b(0x134)]),_0x20cc9d=_0xdc042b[_0x18c60b(0x136)];_0x20cc9d[_0x18c60b(0x167)]=_0x11723d,await handleSingleObjectOutput(_0x20cc9d,_0x36afd0);}else return console[_0x18c60b(0x19d)](_0x18c60b(0x170)),console[_0x18c60b(0x19d)](_0x18c60b(0x18f)),0x1;}return 0x0;}catch(_0x3ed7e9){if(_0x3ed7e9 instanceof SDKError)return console['error'](_0x18c60b(0x162)+_0x3ed7e9[_0x18c60b(0x161)]),_0x3ed7e9[_0x18c60b(0x119)]&&console[_0x18c60b(0x19d)](_0x18c60b(0x11d)+_0x3ed7e9[_0x18c60b(0x119)]),0x1;throw _0x3ed7e9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x19e);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x114);async[a38_0x3d8182(0x168)](_0x5da467){const _0x1b639e=a38_0x3d8182,{options:_0x3cba44,args:_0x214cb2,tdx:_0x1f268e}=_0x5da467,_0xa31263=_0x214cb2[0x0];if(!_0xa31263)return console[_0x1b639e(0x19d)](_0x1b639e(0x10c)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x1b639e(0x19d)](_0x1b639e(0x154)),console['error'](_0x1b639e(0x140)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1b639e(0x19d)](_0x1b639e(0x10d)),0x1;try{const _0x1cfd34=_0x3cba44['parentSegment'],_0x330049=await resolveSegmentTarget(_0xa31263,_0x1cfd34,_0x3cba44[_0x1b639e(0x100)]);_0x3cba44['verbose']&&console['error'](_0x1b639e(0x127)+_0x330049);const _0x268a9e=await withSpinner(_0x1b639e(0x19a)+_0xa31263+_0x1b639e(0x115),()=>_0x1f268e['segment'][_0x1b639e(0x110)](_0x330049),{'verbose':_0x3cba44[_0x1b639e(0x100)]}),_0x7b26ae=_0x268a9e[_0x1b639e(0x136)];_0x3cba44[_0x1b639e(0x100)]&&(console['error']('Resolved\x20type:\x20'+_0x7b26ae[_0x1b639e(0x17f)]),console[_0x1b639e(0x19d)]('Parent\x20ID:\x20'+_0x7b26ae[_0x1b639e(0x12f)]));if(_0x7b26ae['type']==='folder')return console[_0x1b639e(0x19d)](_0x1b639e(0x163)),console[_0x1b639e(0x19d)](_0x1b639e(0x15c)),0x1;if(_0x7b26ae[_0x1b639e(0x17f)]==='parent')return console[_0x1b639e(0x19d)](_0x1b639e(0x186)),console[_0x1b639e(0x19d)](_0x1b639e(0x112)),0x1;if(!_0x7b26ae[_0x1b639e(0x134)])throw new SDKError(ErrorCode[_0x1b639e(0x194)],_0x1b639e(0x150));const _0x5bfbeb=await withSpinner(_0x1b639e(0x113),()=>_0x1f268e[_0x1b639e(0x14c)][_0x1b639e(0x195)](_0x7b26ae[_0x1b639e(0x12f)],_0x7b26ae[_0x1b639e(0x134)]),{'verbose':_0x3cba44['verbose']}),_0xf33627=_0x5bfbeb[_0x1b639e(0x136)],_0x51ad8e=await executeSchemaQuery(_0xf33627,_0x1f268e,_0x3cba44);return await handleQueryOutput(_0x51ad8e,_0x3cba44),0x0;}catch(_0x242558){if(_0x242558 instanceof SDKError)return console[_0x1b639e(0x19d)]('Error:\x20'+_0x242558[_0x1b639e(0x161)]),_0x242558['cause']&&console['error']('\x20\x20Cause:\x20'+_0x242558[_0x1b639e(0x119)]),0x1;throw _0x242558;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0xacfbdc=a39_0x3216;(function(_0x2d8e52,_0x1192f5){const _0x188048=a39_0x3216,_0xa232d3=_0x2d8e52();while(!![]){try{const _0x4fba82=parseInt(_0x188048(0xe2))/0x1+parseInt(_0x188048(0xcb))/0x2*(-parseInt(_0x188048(0xd1))/0x3)+-parseInt(_0x188048(0xef))/0x4+-parseInt(_0x188048(0xed))/0x5+parseInt(_0x188048(0xeb))/0x6*(-parseInt(_0x188048(0xd4))/0x7)+parseInt(_0x188048(0xd5))/0x8*(parseInt(_0x188048(0xc9))/0x9)+parseInt(_0x188048(0xe9))/0xa;if(_0x4fba82===_0x1192f5)break;else _0xa232d3['push'](_0xa232d3['shift']());}catch(_0x3f176b){_0xa232d3['push'](_0xa232d3['shift']());}}}(a39_0x50a9,0x2a95a));function a39_0x50a9(){const _0x2708cd=['segmentPath','execute','segments','name','1134650aWIOwS','segment:create','3168QEZOXA','includes','881635siMNFA','noCountPopulation','82164EKCaPW','Segment\x20name:\x20','yellow','Resolving\x20folder\x20path\x20\x27','verbose','resolveFolderId','Resolving\x20folder\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','\x27...','Site:\x20','length','\x27\x20with\x20ID:\x20','createSegment','1519056CZMPiE','parent','72220aEfKse','site','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20relative\x20path\x20to:\x20','resolveParentId','12xpvifo','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','119qFntTi','8aWITfg','error','Creating\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Examples:','resolvePathToResource','kind','Parent\x20path:\x20','type','segment','description','invisible','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','242461tEmUpA','Parent:\x20','folder'];a39_0x50a9=function(){return _0x2708cd;};return a39_0x50a9();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x3216(_0x319e77,_0x2d2d20){_0x319e77=_0x319e77-0xbd;const _0x50a930=a39_0x50a9();let _0x321650=_0x50a930[_0x319e77];return _0x321650;}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_0x1a1af0 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0xacfbdc(0xe8)]=a39_0xacfbdc(0xea);[a39_0xacfbdc(0xdf)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0xacfbdc(0xe6)](_0xa85490){const _0x1d579f=a39_0xacfbdc;console[_0x1d579f(0xd6)](a39_0x1a1af0['yellow'](_0x1d579f(0xc2))),console[_0x1d579f(0xd6)](a39_0x1a1af0[_0x1d579f(0xbd)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x3fea11,args:_0x3e1633,tdx:_0x2f95fd}=_0xa85490,_0x39762f=_0x3fea11;if(_0x3e1633[_0x1d579f(0xc6)]===0x0)return console[_0x1d579f(0xd6)](_0x1d579f(0xd2)),console[_0x1d579f(0xd6)](_0x1d579f(0xe1)),console[_0x1d579f(0xd6)](_0x1d579f(0xd9)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console['error'](_0x1d579f(0xce)),console[_0x1d579f(0xd6)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x509d1c=_0x3e1633[0x0],_0x523409=_0x3fea11[_0x1d579f(0xe5)];let _0xff9e28=_0x509d1c;_0x523409&&!_0x509d1c[_0x1d579f(0xec)]('/')&&(_0xff9e28=_0x523409+'/'+_0x509d1c,_0x39762f['verbose']&&console[_0x1d579f(0xd6)](_0x1d579f(0xcf)+_0xff9e28));const _0x3b3f30=parsePath(_0xff9e28);if(_0x3b3f30[_0x1d579f(0xe7)][_0x1d579f(0xc6)]<0x2)return console[_0x1d579f(0xd6)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x1d579f(0xd6)](_0x1d579f(0xd8)),0x1;const _0x2f7d34=_0x3b3f30[_0x1d579f(0xe7)][0x0],_0x5373de=getBaseName(_0xff9e28),_0x36f185=getParentPath(_0xff9e28);_0x39762f[_0x1d579f(0xbf)]&&(console[_0x1d579f(0xd6)](_0x1d579f(0xc5)+_0x39762f[_0x1d579f(0xcc)]),console[_0x1d579f(0xd6)]('Target\x20path:\x20'+_0xff9e28),console[_0x1d579f(0xd6)](_0x1d579f(0xe3)+_0x2f7d34),console[_0x1d579f(0xd6)](_0x1d579f(0xf0)+_0x5373de),console[_0x1d579f(0xd6)](_0x1d579f(0xdc)+_0x36f185));const _0x4e1932=await withSpinner(_0x1d579f(0xcd)+_0x2f7d34+_0x1d579f(0xc4),()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xd0)](_0x2f7d34),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x394526=_0x4e1932['data'];let _0x271074;if(_0x3b3f30[_0x1d579f(0xe7)]['length']>0x2){const _0x383072=await withSpinner(_0x1d579f(0xbe)+_0x36f185+_0x1d579f(0xc4),()=>_0x2f95fd['segment'][_0x1d579f(0xda)](_0x36f185),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x50c05c=_0x383072[_0x1d579f(0xc3)];if(_0x50c05c[_0x1d579f(0xdd)]!==_0x1d579f(0xe4)&&_0x50c05c[_0x1d579f(0xdd)]!==_0x1d579f(0xca))return console[_0x1d579f(0xd6)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x271074=_0x50c05c[_0x1d579f(0xd3)];}else{if(_0x39762f[_0x1d579f(0xe4)]){const _0x4ff9dd=await withSpinner(_0x1d579f(0xc1)+_0x39762f[_0x1d579f(0xe4)]+'\x27...',()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xc0)](_0x394526,_0x39762f[_0x1d579f(0xe4)]),{'verbose':_0x39762f[_0x1d579f(0xbf)]});_0x271074=_0x4ff9dd[_0x1d579f(0xc3)];}}_0x39762f[_0x1d579f(0xbf)]&&_0x271074&&console[_0x1d579f(0xd6)]('Resolved\x20folder\x20ID:\x20'+_0x271074);const _0x46f65b=await loadJSONFromOptions(_0x39762f['rule'],_0x39762f['ruleFile']),_0x4563ba={'name':_0x5373de,'description':_0x39762f['description'],'rule':_0x46f65b,'kind':_0x39762f[_0x1d579f(0xdb)]!==undefined?parseInt(_0x39762f['kind'],0xa):undefined,'isVisible':_0x39762f[_0x1d579f(0xe0)]?![]:undefined,'segmentFolderId':_0x271074,'countPopulation':_0x39762f[_0x1d579f(0xee)]?![]:undefined},_0x4edb03=await withSpinner(_0x1d579f(0xd7)+_0x5373de+'\x27...',()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xc8)](_0x394526,_0x4563ba),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x19a770=_0x4edb03[_0x1d579f(0xc3)];return console['error']('✔\x20Created\x20segment\x20\x27'+_0x19a770[_0x1d579f(0xe8)]+_0x1d579f(0xc7)+_0x19a770['id']),_0xff9e28!==_0x509d1c&&console[_0x1d579f(0xd6)]('\x20\x20\x20Path:\x20'+_0xff9e28),await handleSDKOutput([_0x19a770],_0x39762f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a40_0x20f680=a40_0x3a54;(function(_0x3b18ce,_0x569401){const _0x245bab=a40_0x3a54,_0xaf5580=_0x3b18ce();while(!![]){try{const _0x5bb635=-parseInt(_0x245bab(0xee))/0x1+parseInt(_0x245bab(0xf8))/0x2+-parseInt(_0x245bab(0x100))/0x3*(-parseInt(_0x245bab(0xf3))/0x4)+parseInt(_0x245bab(0xfb))/0x5+-parseInt(_0x245bab(0xe4))/0x6*(parseInt(_0x245bab(0xe8))/0x7)+parseInt(_0x245bab(0xf4))/0x8+-parseInt(_0x245bab(0xff))/0x9;if(_0x5bb635===_0x569401)break;else _0xaf5580['push'](_0xaf5580['shift']());}catch(_0x44fd3b){_0xaf5580['push'](_0xaf5580['shift']());}}}(a40_0xb0e3,0x34009));function a40_0xb0e3(){const _0x243370=['3261544pesYsF','execute','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','541780QGUtOm','data','segment:fields','1010140mdovMd','error','site','segment','5397183fPEkOT','51hEyVBL','760728PeqWsg','Listing\x20fields\x20for\x20\x27','jsonl','verbose','14mwdNlF','✔\x20Found\x20','\x20field','parentSegment','listFields','length','148125QqSYQm','json','Parent\x20segment:\x20','Site:\x20','description','78536kWjMWF'];a40_0xb0e3=function(){return _0x243370;};return a40_0xb0e3();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a40_0x3a54(_0x4cf5c0,_0x524fd4){_0x4cf5c0=_0x4cf5c0-0xe4;const _0xb0e34b=a40_0xb0e3();let _0x3a5409=_0xb0e34b[_0x4cf5c0];return _0x3a5409;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a40_0x20f680(0xfa);[a40_0x20f680(0xf2)]=a40_0x20f680(0xf6);async[a40_0x20f680(0xf5)](_0x2e410b){const _0x15ca94=a40_0x20f680,{options:_0xe15c7c,args:_0x395ac5,tdx:_0x4161cd}=_0x2e410b,_0x4e769e=_0x395ac5[0x0]||_0xe15c7c[_0x15ca94(0xeb)];if(!_0x4e769e)return console[_0x15ca94(0xfc)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x15ca94(0xfc)](_0x15ca94(0xf7)),console[_0x15ca94(0xfc)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0xe15c7c[_0x15ca94(0xe7)]&&(console[_0x15ca94(0xfc)](_0x15ca94(0xf1)+_0xe15c7c[_0x15ca94(0xfd)]),console['error'](_0x15ca94(0xf0)+_0x4e769e));const _0x4afa2e=await withSpinner(_0x15ca94(0xe5)+_0x4e769e+'\x27...',()=>_0x4161cd[_0x15ca94(0xfe)][_0x15ca94(0xec)](_0x4e769e),{'verbose':_0xe15c7c[_0x15ca94(0xe7)]}),_0x49277d=_0x4afa2e[_0x15ca94(0xf9)];console['error'](_0x15ca94(0xe9)+_0x49277d[_0x15ca94(0xed)]+_0x15ca94(0xea)+(_0x49277d[_0x15ca94(0xed)]!==0x1?'s':''));if(_0xe15c7c[_0x15ca94(0xef)]||_0xe15c7c[_0x15ca94(0xe6)])return await handleSDKOutput(_0x49277d,_0xe15c7c),0x0;return displayFieldsHumanReadable(_0x49277d,_0x4e769e),0x0;}}
|