@treasuredata/tdx 2026.7.2 → 2026.7.3
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.d.ts.map +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-command.js.map +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.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +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-move-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/table-deleted.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.d.ts +11 -2
- package/dist/core/oauth.d.ts.map +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/oauth.js.map +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/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.d.ts +16 -0
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +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-schema.js +1 -1
- package/dist/sdk/cas/cas-audience-validator.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/cas/validate-files.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.d.ts +5 -1
- package/dist/sdk/client/oauth-refresh.d.ts.map +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/oauth-refresh.js.map +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/llm/user-settings.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/util/tree-search.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/proxy-fetch.d.ts +29 -0
- package/dist/utils/proxy-fetch.d.ts.map +1 -0
- package/dist/utils/proxy-fetch.js +1 -0
- package/dist/utils/proxy-fetch.js.map +1 -0
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x7489e7=a32_0x3496;(function(_0x23fdd6,_0x1b113a){const _0x442ea5=a32_0x3496,_0x3ca2cf=_0x23fdd6();while(!![]){try{const _0x3d65d3=-parseInt(_0x442ea5(0x15e))/0x1+parseInt(_0x442ea5(0x137))/0x2*(parseInt(_0x442ea5(0x152))/0x3)+parseInt(_0x442ea5(0x153))/0x4+parseInt(_0x442ea5(0x162))/0x5*(-parseInt(_0x442ea5(0x146))/0x6)+parseInt(_0x442ea5(0x164))/0x7*(-parseInt(_0x442ea5(0x169))/0x8)+parseInt(_0x442ea5(0x13a))/0x9*(parseInt(_0x442ea5(0x140))/0xa)+parseInt(_0x442ea5(0x12f))/0xb;if(_0x3d65d3===_0x1b113a)break;else _0x3ca2cf['push'](_0x3ca2cf['shift']());}catch(_0x41bd7f){_0x3ca2cf['push'](_0x3ca2cf['shift']());}}}(a32_0xaade,0xdb180));function a32_0x3496(_0x4bfb5d,_0x39b4e2){_0x4bfb5d=_0x4bfb5d-0x12f;const _0xaadef=a32_0xaade();let _0x34966f=_0xaadef[_0x4bfb5d];return _0x34966f;}function a32_0xaade(){const _0x34b62a=['✔\x20Found\x20','context','length','\x20\x20•\x20','policy','📋\x20Assigned\x20Policies','ies','data','1848351AhqISS','2459248GzkMVk','email','Fetching\x20permissions...','Fetching\x20policy...','\x20\x20\x20','👥\x20Assigned\x20Users','execute','\x20—\x20','description','\x20\x20No\x20permissions','permissions','137171kUPVkf','log','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','43735Ihicxx','max','553SLnjXU','\x20\x20No\x20policies\x20assigned','verbose','account_id','\x20user','112744Jbabwz','padEnd','(ID:\x20','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','17144435LBghNE','args','operation','name','policy\x20list','getPolicyPermissions','error','policy\x20show','2zgTHSC','user','🔑\x20Effective\x20Permissions','27xWiGIX','No\x20policies\x20found','getPolicy','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','validate','\x20assigned','164750nQHtie','join','getPolicyUsers','listPolicies','map','Listing\x20policies...','474PeGAbH','bold','getMyPermissions','dim'];a32_0xaade=function(){return _0x34b62a;};return a32_0xaade();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x21fab8 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x7489e7(0x132)]='policy';[a32_0x7489e7(0x15b)]=a32_0x7489e7(0x16c);async[a32_0x7489e7(0x159)](_0x474817){const _0x6634e=a32_0x7489e7,{options:_0x29f855,tdx:_0x3db368}=_0x474817,_0x43796f=await withSpinner(_0x6634e(0x155),async()=>{const _0x4ce0fc=_0x6634e,[_0x579b7b,_0x1e95b3]=await Promise['all']([_0x3db368[_0x4ce0fc(0x138)]['getCurrent'](),_0x3db368[_0x4ce0fc(0x14e)][_0x4ce0fc(0x148)]()]);return{'userInfo':_0x579b7b,'permissions':_0x1e95b3};},{'verbose':_0x29f855[_0x6634e(0x166)]}),{userInfo:_0x44a414,permissions:_0x383675}=_0x43796f[_0x6634e(0x151)];if(isStructuredFormat(_0x29f855))return await handleSingleObjectOutput(_0x383675,_0x29f855),0x0;const _0x3ab5fa=_0x44a414['account_owner']?'Account\x20Owner':_0x44a414['administrator']?'Administrator':'Member';console['log']('\x0a'+a32_0x21fab8[_0x6634e(0x147)]('👤')+'\x20'+a32_0x21fab8[_0x6634e(0x147)](_0x44a414[_0x6634e(0x132)])+'\x20'+a32_0x21fab8[_0x6634e(0x149)]('('+_0x44a414['email']+')')+_0x6634e(0x15a)+_0x3ab5fa),console[_0x6634e(0x15f)](a32_0x21fab8['dim']('\x20\x20\x20'+_0x3db368[_0x6634e(0x14b)]['site']+':'+_0x44a414[_0x6634e(0x167)]+',\x20user_id:'+_0x44a414['id']));const _0x48bf44=_0x383675['policies'];console[_0x6634e(0x15f)]('\x0a'+a32_0x21fab8[_0x6634e(0x147)](_0x6634e(0x14f))+'\x20('+_0x48bf44['length']+'):');if(_0x48bf44[_0x6634e(0x14c)]===0x0)console[_0x6634e(0x15f)](a32_0x21fab8[_0x6634e(0x149)](_0x6634e(0x165)));else for(const _0x194f0c of _0x48bf44){console[_0x6634e(0x15f)](_0x6634e(0x14d)+_0x194f0c[_0x6634e(0x132)]);}return printPermissionsMap(_0x383675[_0x6634e(0x15d)]),console[_0x6634e(0x15f)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x7489e7(0x132)]=a32_0x7489e7(0x133);[a32_0x7489e7(0x15b)]=a32_0x7489e7(0x161);async['execute'](_0x36bbb3){const _0x322043=a32_0x7489e7,{options:_0x3db750,tdx:_0x426dc0}=_0x36bbb3,_0x5d65d9=await withSpinner(_0x322043(0x145),()=>_0x426dc0[_0x322043(0x14e)][_0x322043(0x143)](),{'verbose':_0x3db750[_0x322043(0x166)]}),_0x5de090=_0x5d65d9[_0x322043(0x151)];console[_0x322043(0x135)](_0x322043(0x14a)+_0x5de090[_0x322043(0x14c)]+'\x20polic'+(_0x5de090[_0x322043(0x14c)]!==0x1?_0x322043(0x150):'y'));if(isStructuredFormat(_0x3db750))return await handleSDKOutput(_0x5de090,_0x3db750),0x0;if(_0x5de090[_0x322043(0x14c)]===0x0)console[_0x322043(0x15f)](a32_0x21fab8[_0x322043(0x149)](_0x322043(0x13b)));else for(const _0xff6811 of _0x5de090){const _0x46b388=_0xff6811[_0x322043(0x15b)]?a32_0x21fab8[_0x322043(0x149)](_0x322043(0x15a)+_0xff6811[_0x322043(0x15b)]):'';console[_0x322043(0x15f)](_0x322043(0x14d)+_0xff6811[_0x322043(0x132)]+_0x46b388);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x7489e7(0x132)]=a32_0x7489e7(0x136);['description']=a32_0x7489e7(0x13d);[a32_0x7489e7(0x13e)](_0x4df36c){const _0x4da3a7=a32_0x7489e7;if(_0x4df36c[_0x4da3a7(0x130)]['length']===0x0)return _0x4da3a7(0x160);return undefined;}async[a32_0x7489e7(0x159)](_0x391a60){const _0x2d17b3=a32_0x7489e7,{options:_0x229db0,tdx:_0x22fdee}=_0x391a60,_0x2e394c=_0x391a60['args'][0x0],_0x1bf8bd=await withSpinner(_0x2d17b3(0x156),async()=>{const _0x440ada=_0x2d17b3,_0x244175=await _0x22fdee['policy'][_0x440ada(0x13c)](_0x2e394c),[_0xc9bf2a,_0x422ff7]=await Promise['all']([_0x22fdee[_0x440ada(0x14e)][_0x440ada(0x134)](_0x244175['id']),_0x22fdee['policy'][_0x440ada(0x142)](_0x244175['id'])]);return{'policy':_0x244175,'perms':_0xc9bf2a,'users':_0x422ff7};},{'verbose':_0x229db0[_0x2d17b3(0x166)]}),{policy:_0x283934,perms:_0x43cce7,users:_0x2eb957}=_0x1bf8bd[_0x2d17b3(0x151)];if(isStructuredFormat(_0x229db0))return await handleSingleObjectOutput({..._0x283934,'permissions':_0x43cce7['permissions'],'users':_0x2eb957},_0x229db0),0x0;console[_0x2d17b3(0x15f)]('\x0a'+a32_0x21fab8['bold']('📋')+'\x20'+a32_0x21fab8[_0x2d17b3(0x147)](_0x283934[_0x2d17b3(0x132)])+'\x20'+a32_0x21fab8[_0x2d17b3(0x149)](_0x2d17b3(0x16b)+_0x283934['id']+')'));_0x283934['description']&&console[_0x2d17b3(0x15f)](_0x2d17b3(0x157)+a32_0x21fab8['dim'](_0x283934[_0x2d17b3(0x15b)]));console['log'](_0x2d17b3(0x157)+_0x2eb957[_0x2d17b3(0x14c)]+_0x2d17b3(0x168)+(_0x2eb957['length']!==0x1?'s':'')+_0x2d17b3(0x13f)),printPermissionsMap(_0x43cce7[_0x2d17b3(0x15d)]);if(_0x2eb957[_0x2d17b3(0x14c)]>0x0){console['log']('\x0a'+a32_0x21fab8[_0x2d17b3(0x147)](_0x2d17b3(0x158))+':');for(const _0x72fa9f of _0x2eb957){const _0x2cf99f=_0x72fa9f[_0x2d17b3(0x154)]&&_0x72fa9f[_0x2d17b3(0x154)]!==_0x72fa9f['name']?a32_0x21fab8[_0x2d17b3(0x149)]('\x20<'+_0x72fa9f['email']+'>'):'';console[_0x2d17b3(0x15f)]('\x20\x20•\x20'+_0x72fa9f[_0x2d17b3(0x132)]+_0x2cf99f);}}return console[_0x2d17b3(0x15f)](),0x0;}}function printPermissionsMap(_0x1da97e){const _0x3e5fbf=a32_0x7489e7,_0x57d5f7=Object['entries'](_0x1da97e);console[_0x3e5fbf(0x15f)]('\x0a'+a32_0x21fab8['bold'](_0x3e5fbf(0x139))+':');if(_0x57d5f7[_0x3e5fbf(0x14c)]===0x0){console[_0x3e5fbf(0x15f)](a32_0x21fab8['dim'](_0x3e5fbf(0x15c)));return;}const _0x543363=Math[_0x3e5fbf(0x163)](..._0x57d5f7[_0x3e5fbf(0x144)](([_0x25f4ef])=>_0x25f4ef[_0x3e5fbf(0x14c)]));for(const [_0x5a941d,_0x2b4d65]of _0x57d5f7){const _0xc7feb1=formatOperations(_0x2b4d65);console['log']('\x20\x20'+_0x5a941d[_0x3e5fbf(0x16a)](_0x543363+0x2)+_0xc7feb1);}}function formatOperations(_0x573398){const _0x58bd04=a32_0x7489e7,_0x5f463d=[...new Set(_0x573398['map'](_0x25d8ab=>_0x25d8ab[_0x58bd04(0x131)]))];return _0x5f463d[_0x58bd04(0x141)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x5dfb15=a33_0x4894;(function(_0x3daeea,_0x28f5c3){const _0x5c01ae=a33_0x4894,_0x4e647e=_0x3daeea();while(!![]){try{const _0x3e4b43=parseInt(_0x5c01ae(0x191))/0x1*(parseInt(_0x5c01ae(0x170))/0x2)+parseInt(_0x5c01ae(0x181))/0x3+parseInt(_0x5c01ae(0x1b8))/0x4*(parseInt(_0x5c01ae(0x199))/0x5)+-parseInt(_0x5c01ae(0x1a6))/0x6+parseInt(_0x5c01ae(0x19d))/0x7+parseInt(_0x5c01ae(0x19a))/0x8*(parseInt(_0x5c01ae(0x16b))/0x9)+-parseInt(_0x5c01ae(0x19b))/0xa;if(_0x3e4b43===_0x28f5c3)break;else _0x4e647e['push'](_0x4e647e['shift']());}catch(_0x55392f){_0x4e647e['push'](_0x4e647e['shift']());}}}(a33_0x4f59,0x41960));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x4f59(){const _0x36c57f=['9927400EmYmfV','Changing\x20site\x20to\x20\x27','2637950WOZIDS','profile:use','description','\x20\x20-\x20','confirm','\x27\x20requires\x20API\x20key\x20validation.','join','site','tdx.json','2011512ZbMwVy','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20\x27','Session\x20profile\x20set\x20to:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','length','includes','profileName','tdx:\x20profile\x20set','VALID_KEYS','error','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20(no\x20profiles\x20found)','\x27\x20created','(cleared)','8kPoGoP','jobs','\x27\x20deleted','Enter\x20profile\x20name:','warn','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Validating\x20API\x20key...','Enter\x20description\x20(optional):','\x0aAvailable\x20profiles:','name','\x20--default\x27\x20to\x20save\x20permanently','execute','\x20Profile\x20\x27','email','skipExistsCheck','Unknown\x20key\x20\x27','(session:\x20','status','create','red','llm_agent','trim','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','ERROR','9ouVpVr','\x0aSaved\x20to:\x20','validate','oauth','getUserInfo','4102qrvTlp','Set\x20a\x20profile\x20configuration\x20value','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20create','Removed\x20existing\x20profile\x20\x27','\x0aSetup\x20cancelled','session','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key:','\x27\x20updated:\x20','green','text','Delete\x20a\x20profile','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','349905iLEOQW','profile','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','logLevel','✗\x20Validation\x20failed:\x20','Profile\x20name\x20cannot\x20be\x20empty','\x20API\x20key\x20is\x20valid\x20(User:\x20','parent_segment','test','split','\x27\x20does\x20not\x20exist.','log','apiKey','API\x20key\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','245niXkTX','database','Set\x20session\x20profile','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','yellow','dim','default','password','1273605MBVXhc','729680ipaikQ'];a33_0x4f59=function(){return _0x36c57f;};return a33_0x4f59();}import*as a33_0x1498fd from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x4894(_0x44d740,_0xe0d0aa){_0x44d740=_0x44d740-0x163;const _0x4f5922=a33_0x4f59();let _0x4894ed=_0x4f5922[_0x44d740];return _0x4894ed;}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x53e4e0 from'prompts';import a33_0x415dc2 from'chalk';function validateProfileName(_0x23c80b,_0x5f5d8d){const _0x31bdcc=a33_0x4894;if(!_0x23c80b||!_0x23c80b[_0x31bdcc(0x168)]())return _0x31bdcc(0x187);const _0x430dab=_0x23c80b[_0x31bdcc(0x168)]();if(!/^[a-zA-Z0-9_-]+$/[_0x31bdcc(0x18a)](_0x430dab))return _0x31bdcc(0x169);if(!_0x5f5d8d?.[_0x31bdcc(0x1c7)]&&profileExists(_0x430dab))return'Profile\x20\x27'+_0x430dab+_0x31bdcc(0x1ac)+_0x430dab+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x2990ba){removeProfileFromUserConfig(_0x2990ba);const _0x176347=await isKeychainAvailable();_0x176347&&await Promise['all']([deleteKeychainAPIKey(_0x2990ba),deleteOAuthTokens(_0x2990ba)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x5dfb15(0x1c2)]='profile:create';['description']='Create\x20a\x20new\x20profile';async['execute'](_0x1020e6){const _0x1d0574=a33_0x5dfb15,{options:_0x384343,args:_0xe4196e}=_0x1020e6,_0x44c26e=!!_0x384343['force'];console[_0x1d0574(0x18d)](a33_0x415dc2['bold'](_0x1d0574(0x173)));let _0x4fbc8f;if(_0xe4196e['length']>0x0&&_0xe4196e[0x0]){const _0x377e0a=_0xe4196e[0x0][_0x1d0574(0x168)]();_0x44c26e&&profileExists(_0x377e0a)&&(await deleteProfileAndCredentials(_0x377e0a),console[_0x1d0574(0x18d)](_0x1d0574(0x174)+_0x377e0a+'\x27'));const _0x2c415f=validateProfileName(_0x377e0a);if(_0x2c415f!==!![])return console['error'](a33_0x415dc2['red'](_0x2c415f)),0x1;_0x4fbc8f=_0x377e0a;}else{const _0x4b95cb=await a33_0x53e4e0({'type':_0x1d0574(0x17e),'name':_0x1d0574(0x1af),'message':_0x1d0574(0x1bb),'validate':_0x43b652=>validateProfileName(_0x43b652,{'skipExistsCheck':_0x44c26e})});if(!_0x4b95cb[_0x1d0574(0x1af)])return console['log'](_0x1d0574(0x175)),0x1;_0x4fbc8f=_0x4b95cb[_0x1d0574(0x1af)][_0x1d0574(0x168)](),_0x44c26e&&profileExists(_0x4fbc8f)&&(await deleteProfileAndCredentials(_0x4fbc8f),console[_0x1d0574(0x18d)](_0x1d0574(0x174)+_0x4fbc8f+'\x27'));}const _0xc79fb0=await a33_0x53e4e0({'type':'text','name':_0x1d0574(0x19f),'message':_0x1d0574(0x1c0)}),_0x56f2cb=_0xc79fb0[_0x1d0574(0x19f)]?.[_0x1d0574(0x168)]()||undefined,_0xe902b1=_0x384343[_0x1d0574(0x1a4)]||'us01',_0x29a024=await promptSiteSelection(_0xe902b1,_0x4fbc8f,'Setup\x20cancelled');if(!_0x29a024)return 0x1;const _0x28d7f5=resolveSite(_0x29a024),_0x46470a=await promptAuthMethod();if(!_0x46470a)return console[_0x1d0574(0x18d)](_0x1d0574(0x175)),0x1;if(_0x46470a===_0x1d0574(0x16e)){if(_0x56f2cb){const _0x57ea0d={'site':_0x28d7f5,'description':_0x56f2cb};saveProfileToUserConfig(_0x4fbc8f,_0x57ea0d);}const {accountName:_0x5836c8}=_0x384343;return await runOAuthLoginFlow(_0x28d7f5,_0x4fbc8f,_0x384343[_0x1d0574(0x185)]??LogLevel[_0x1d0574(0x16a)],{'accountName':_0x5836c8}),0x0;}console['log'](_0x1d0574(0x190)+_0x28d7f5),console[_0x1d0574(0x18d)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1d0574(0x18d)]('\x20\x20'+getConsoleUrl(_0x28d7f5,'/app/mp/ak'));const _0x1090ef=await a33_0x53e4e0({'type':_0x1d0574(0x198),'name':_0x1d0574(0x18e),'message':_0x1d0574(0x17b),'validate':_0x42a90b=>{const _0x388ef2=_0x1d0574;if(!_0x42a90b||!_0x42a90b[_0x388ef2(0x168)]())return _0x388ef2(0x18f);return!![];}});if(!_0x1090ef[_0x1d0574(0x18e)])return console[_0x1d0574(0x18d)](_0x1d0574(0x175)),0x1;const _0x29debc=_0x1090ef['apiKey'];console[_0x1d0574(0x18d)](_0x1d0574(0x1bf));try{const _0x364975=TDX[_0x1d0574(0x165)]({'site':_0x28d7f5,'apiKey':_0x29debc[_0x1d0574(0x168)](),'logLevel':_0x384343[_0x1d0574(0x185)]??LogLevel[_0x1d0574(0x16a)]}),_0x3efbbc=await _0x364975[_0x1d0574(0x1b9)][_0x1d0574(0x16f)]();console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x188)+_0x3efbbc[_0x1d0574(0x1c6)]+')');const _0x5ad3a0=await isKeychainAvailable();_0x5ad3a0?(await saveAPIKeyAsync(_0x29debc[_0x1d0574(0x168)](),_0x28d7f5,_0x4fbc8f),console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x1be)+_0x4fbc8f+')')):(console[_0x1d0574(0x1bc)](a33_0x415dc2[_0x1d0574(0x195)](_0x1d0574(0x194))),console[_0x1d0574(0x1bc)](a33_0x415dc2[_0x1d0574(0x195)](_0x1d0574(0x1bd))));const _0x57f2a1={'site':_0x28d7f5,..._0x56f2cb&&{'description':_0x56f2cb}};return saveProfileToUserConfig(_0x4fbc8f,_0x57f2a1),console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x1c5)+_0x4fbc8f+_0x1d0574(0x1b6)),console[_0x1d0574(0x18d)](),console[_0x1d0574(0x18d)](_0x1d0574(0x172)),console[_0x1d0574(0x18d)]('\x20\x20tdx\x20--profile\x20'+_0x4fbc8f+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x1d0574(0x18d)](_0x1d0574(0x17a)+_0x4fbc8f+_0x1d0574(0x1b3)),0x0;}catch(_0x4d8914){if(_0x4d8914 instanceof HTTPClientError&&_0x4d8914[_0x1d0574(0x164)]===0x191)return printAuthError(_0x4d8914),0x1;return console[_0x1d0574(0x1b2)](a33_0x415dc2[_0x1d0574(0x166)](_0x1d0574(0x186)+(_0x4d8914 instanceof Error?_0x4d8914[_0x1d0574(0x177)]:String(_0x4d8914)))),console[_0x1d0574(0x1b2)](_0x1d0574(0x1a9)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';[a33_0x5dfb15(0x19f)]=a33_0x5dfb15(0x17f);[a33_0x5dfb15(0x16d)](_0x5c8c5f){const _0x6c83a4=a33_0x5dfb15,{args:_0x19a8fe}=_0x5c8c5f;if(_0x19a8fe[_0x6c83a4(0x1ad)]===0x0)return _0x6c83a4(0x184);return undefined;}async[a33_0x5dfb15(0x1c4)](_0x338421){const _0x3b4c85=a33_0x5dfb15,{args:_0x2e6664}=_0x338421,_0x1ed07e=_0x2e6664[0x0];console['log'](a33_0x415dc2[_0x3b4c85(0x183)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x1ed07e)){console[_0x3b4c85(0x1b2)](a33_0x415dc2['red'](_0x3b4c85(0x1aa)+_0x1ed07e+_0x3b4c85(0x18c))),console[_0x3b4c85(0x18d)](_0x3b4c85(0x1c1));const _0x203092=listProfiles();if(_0x203092[_0x3b4c85(0x1ad)]===0x0)console[_0x3b4c85(0x18d)](_0x3b4c85(0x1b5));else for(const _0x2608ac of _0x203092){console['log'](_0x3b4c85(0x1a0)+_0x2608ac[_0x3b4c85(0x1c2)]);}return 0x1;}const _0x5bb96e=await a33_0x53e4e0({'type':'confirm','name':_0x3b4c85(0x1a1),'message':_0x3b4c85(0x1b4)+_0x1ed07e+'\x27?','initial':![]});if(!_0x5bb96e[_0x3b4c85(0x1a1)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x1ed07e),console['log'](a33_0x415dc2[_0x3b4c85(0x17d)]('✓')+_0x3b4c85(0x1c5)+_0x1ed07e+_0x3b4c85(0x1ba));}catch(_0x46cb19){return console[_0x3b4c85(0x1b2)](a33_0x415dc2[_0x3b4c85(0x166)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x46cb19 instanceof Error?_0x46cb19['message']:String(_0x46cb19)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']=a33_0x5dfb15(0x171);static [a33_0x5dfb15(0x1b1)]=[a33_0x5dfb15(0x1a4),a33_0x5dfb15(0x192),a33_0x5dfb15(0x189),'llm_project',a33_0x5dfb15(0x167),a33_0x5dfb15(0x19f)];[a33_0x5dfb15(0x16d)](_0x81bb9){const _0x50abbd=a33_0x5dfb15,{args:_0x4a635c,options:_0x25e2e8}=_0x81bb9,_0x517f80=_0x25e2e8[_0x50abbd(0x182)]||getActiveProfile();if(!_0x517f80)return _0x50abbd(0x180);if(_0x4a635c[_0x50abbd(0x1ad)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');const _0x44c267=_0x4a635c[0x0];if(!_0x44c267['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');const [_0x31196a]=_0x44c267[_0x50abbd(0x18b)]('=',0x2);if(!ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1ae)](_0x31196a))return _0x50abbd(0x1c8)+_0x31196a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');return undefined;}async[a33_0x5dfb15(0x1c4)](_0x64d432){const _0x1c87d3=a33_0x5dfb15,{args:_0x813868,options:_0x19c173}=_0x64d432,_0x3af8dd=_0x19c173[_0x1c87d3(0x182)]||getActiveProfile(),[_0x568f99,..._0x26a87a]=_0x813868[0x0]['split']('='),_0x55faa3=_0x26a87a[_0x1c87d3(0x1a3)]('=');console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x183)](_0x1c87d3(0x1b0)));if(!profileExists(_0x3af8dd)){const _0x32ff48=await a33_0x53e4e0({'type':_0x1c87d3(0x1a1),'name':_0x1c87d3(0x165),'message':_0x1c87d3(0x1aa)+_0x3af8dd+_0x1c87d3(0x1a8),'initial':!![]});if(!_0x32ff48[_0x1c87d3(0x165)])return console[_0x1c87d3(0x18d)]('Operation\x20cancelled'),0x1;}const _0xc81e5f=loadProfile(_0x3af8dd),_0x42bb1f=_0xc81e5f?.['config']||{};if(_0x568f99==='site'){const _0x49f4c2=resolveSite(_0x55faa3);console['log'](_0x1c87d3(0x19c)+_0x49f4c2+_0x1c87d3(0x1a2)),console[_0x1c87d3(0x18d)](_0x1c87d3(0x1a7)),console[_0x1c87d3(0x18d)]('\x20\x20'+getConsoleUrl(_0x49f4c2,'/app/mp/ak'));const _0x40bc7d=await a33_0x53e4e0({'type':_0x1c87d3(0x198),'name':_0x1c87d3(0x18e),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3b61c6=>{const _0x29e705=_0x1c87d3;if(!_0x3b61c6||!_0x3b61c6[_0x29e705(0x168)]())return _0x29e705(0x18f);return!![];}});if(!_0x40bc7d[_0x1c87d3(0x18e)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x1c87d3(0x18d)]('Validating\x20API\x20key...');try{const _0x60166e=TDX[_0x1c87d3(0x165)]({'site':_0x49f4c2,'apiKey':_0x40bc7d[_0x1c87d3(0x18e)][_0x1c87d3(0x168)](),'logLevel':_0x19c173[_0x1c87d3(0x185)]??LogLevel['ERROR']}),_0x397307=await _0x60166e[_0x1c87d3(0x1b9)][_0x1c87d3(0x16f)]();console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x17d)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x397307['email']+')');const _0x5eb71e=await isKeychainAvailable();_0x5eb71e?(await saveAPIKeyAsync(_0x40bc7d['apiKey'][_0x1c87d3(0x168)](),_0x49f4c2,_0x3af8dd),console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x17d)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x1c87d3(0x1bc)](a33_0x415dc2[_0x1c87d3(0x195)](_0x1c87d3(0x194))),_0x42bb1f[_0x1c87d3(0x1a4)]=_0x49f4c2;}catch(_0x51c94b){if(_0x51c94b instanceof HTTPClientError&&_0x51c94b[_0x1c87d3(0x164)]===0x191)return printAuthError(_0x51c94b),0x1;return console[_0x1c87d3(0x1b2)](a33_0x415dc2['red'](_0x1c87d3(0x186)+(_0x51c94b instanceof Error?_0x51c94b[_0x1c87d3(0x177)]:String(_0x51c94b)))),console[_0x1c87d3(0x1b2)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x42bb1f[_0x568f99]=_0x55faa3||undefined;return saveProfileToUserConfig(_0x3af8dd,_0x42bb1f),console['log'](a33_0x415dc2['green']('✓')+_0x1c87d3(0x1c5)+_0x3af8dd+_0x1c87d3(0x17c)+_0x568f99+'='+(_0x55faa3||_0x1c87d3(0x1b7))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x5dfb15(0x1c2)]=a33_0x5dfb15(0x19e);[a33_0x5dfb15(0x19f)]=a33_0x5dfb15(0x193);[a33_0x5dfb15(0x16d)](_0x5a91ca){const _0x3f7339=a33_0x5dfb15,{args:_0x174ad2}=_0x5a91ca;if(_0x174ad2['length']===0x0)return _0x3f7339(0x178);return undefined;}async['execute'](_0x189032){const _0x3100c6=a33_0x5dfb15,{args:_0x320703,options:_0x27285c}=_0x189032,_0x2e194a=_0x320703[0x0],_0x5446b3=_0x27285c[_0x3100c6(0x197)];cleanExpiredSessions();if(!profileExists(_0x2e194a)){console[_0x3100c6(0x1b2)](a33_0x415dc2[_0x3100c6(0x166)]('Profile\x20\x27'+_0x2e194a+_0x3100c6(0x18c))),console[_0x3100c6(0x18d)](_0x3100c6(0x1c1));const _0x4114b5=listProfiles();if(_0x4114b5[_0x3100c6(0x1ad)]===0x0)console[_0x3100c6(0x18d)](_0x3100c6(0x1b5));else for(const _0x193ba1 of _0x4114b5){console[_0x3100c6(0x18d)]('\x20\x20-\x20'+_0x193ba1[_0x3100c6(0x1c2)]);}return 0x1;}if(_0x5446b3){const _0x48b880=a33_0x1498fd[_0x3100c6(0x1a3)](getConfigDir(),_0x3100c6(0x1a5));return saveActiveProfileToUserConfig(_0x2e194a),console[_0x3100c6(0x18d)]('Default\x20profile\x20set\x20to:\x20'+a33_0x415dc2[_0x3100c6(0x17d)](_0x2e194a)),console[_0x3100c6(0x18d)](a33_0x415dc2['dim'](_0x3100c6(0x16c)+_0x48b880)),0x0;}const _0x225e83=getSessionID(_0x27285c[_0x3100c6(0x176)]);return saveSessionContext({'profile':_0x2e194a},_0x27285c['session']),console[_0x3100c6(0x18d)](_0x3100c6(0x1ab)+a33_0x415dc2[_0x3100c6(0x17d)](_0x2e194a)+'\x20'+a33_0x415dc2['dim'](_0x3100c6(0x163)+_0x225e83+')')),console[_0x3100c6(0x18d)](a33_0x415dc2[_0x3100c6(0x196)](_0x3100c6(0x179)+_0x2e194a+_0x3100c6(0x1c3))),0x0;}}
|
|
1
|
+
const a33_0x41576a=a33_0x33c8;(function(_0x3b7631,_0x2804ed){const _0xf31e23=a33_0x33c8,_0x56e7d4=_0x3b7631();while(!![]){try{const _0x46aa62=parseInt(_0xf31e23(0xf7))/0x1*(-parseInt(_0xf31e23(0x102))/0x2)+parseInt(_0xf31e23(0xfe))/0x3*(parseInt(_0xf31e23(0x12a))/0x4)+-parseInt(_0xf31e23(0x151))/0x5+-parseInt(_0xf31e23(0x128))/0x6+parseInt(_0xf31e23(0xfc))/0x7*(-parseInt(_0xf31e23(0x126))/0x8)+-parseInt(_0xf31e23(0x117))/0x9*(parseInt(_0xf31e23(0x153))/0xa)+parseInt(_0xf31e23(0x12c))/0xb;if(_0x46aa62===_0x2804ed)break;else _0x56e7d4['push'](_0x56e7d4['shift']());}catch(_0x177f87){_0x56e7d4['push'](_0x56e7d4['shift']());}}}(a33_0x1ba1,0x974cd));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 a33_0x12fcd1 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{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x272f65 from'prompts';import a33_0x9f1103 from'chalk';function validateProfileName(_0x53d1b9,_0x16230b){const _0x5c3b91=a33_0x33c8;if(!_0x53d1b9||!_0x53d1b9[_0x5c3b91(0xf3)]())return _0x5c3b91(0x125);const _0x878525=_0x53d1b9['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x878525))return _0x5c3b91(0xfd);if(!_0x16230b?.[_0x5c3b91(0x118)]&&profileExists(_0x878525))return'Profile\x20\x27'+_0x878525+_0x5c3b91(0x14d)+_0x878525+_0x5c3b91(0x147);return!![];}function a33_0x33c8(_0x23ed00,_0xe5c5f9){_0x23ed00=_0x23ed00-0xf2;const _0x1ba15b=a33_0x1ba1();let _0x33c8ac=_0x1ba15b[_0x23ed00];return _0x33c8ac;}function a33_0x1ba1(){const _0x3b16a7=['tdx.json','VALID_KEYS','\x20API\x20key\x20saved\x20to\x20system\x20keychain','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Unknown\x20key\x20\x27','trim','text','Changing\x20site\x20to\x20\x27','Enter\x20description\x20(optional):','927ZJVArO','yellow','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','error','Operation\x20cancelled','102403nxTPQW','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','456501ejaiwS','profile','\x0aAvailable\x20profiles:','length','766AKzOgy','description','logLevel','API\x20key\x20cannot\x20be\x20empty','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','apiKey','profile:delete','Session\x20profile\x20set\x20to:\x20','status','\x27\x20deleted','llm_project','Enter\x20your\x20TD\x20API\x20key:','parent_segment','site','validate','log','create','join','Site\x20was\x20not\x20changed.','tdx:\x20profile\x20create','execute','1143JDfnrM','skipExistsCheck','\x20API\x20key\x20is\x20valid\x20(User:\x20','includes','(session:\x20','\x27.\x0a\x0aValid\x20keys:\x20','/app/mp/ak','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','✗\x20Validation\x20failed:\x20','jobs','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','You\x20can\x20find\x20your\x20API\x20key\x20at:','default','green','Profile\x20name\x20cannot\x20be\x20empty','448pVxyCi','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','486696hCsfCl','\x27\x20updated:\x20','24IXQeVN','message','29300348eyAsGV','\x20\x20(no\x20profiles\x20found)','profileName','Failed\x20to\x20delete\x20profile:\x20','Validating\x20API\x20key...','warn','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aSetup\x20cancelled','tdx:\x20profile\x20set','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20Profile\x20\x27','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>','(cleared)','us01','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','bold','profile:create','name','force','Setup\x20cancelled','Profile\x20\x27','email','getUserInfo','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','ERROR','session','confirm','all','split','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','profile:use','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20\x20tdx\x20--profile\x20','2361655AGxbcE','dim','96790SksiSx','Removed\x20existing\x20profile\x20\x27','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.','llm_agent','\x27\x20does\x20not\x20exist.\x20Create\x20it?','config','Delete\x20a\x20profile'];a33_0x1ba1=function(){return _0x3b16a7;};return a33_0x1ba1();}async function deleteProfileAndCredentials(_0x2b3e5b){const _0x223e2e=a33_0x33c8;removeProfileFromUserConfig(_0x2b3e5b);const _0x4fc3b7=await isKeychainAvailable();_0x4fc3b7&&await Promise[_0x223e2e(0x14b)]([deleteKeychainAPIKey(_0x2b3e5b),deleteOAuthTokens(_0x2b3e5b)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x41576a(0x13e);[a33_0x41576a(0x103)]=a33_0x41576a(0x156);async[a33_0x41576a(0x116)](_0x8658c){const _0xb8055=a33_0x41576a,{options:_0x216ed5,args:_0x53155c}=_0x8658c,_0xe48e36=!!_0x216ed5[_0xb8055(0x140)];console[_0xb8055(0x111)](a33_0x9f1103[_0xb8055(0x13d)](_0xb8055(0x115)));let _0x3aa9be;if(_0x53155c[_0xb8055(0x101)]>0x0&&_0x53155c[0x0]){const _0x5ba9ca=_0x53155c[0x0][_0xb8055(0xf3)]();_0xe48e36&&profileExists(_0x5ba9ca)&&(await deleteProfileAndCredentials(_0x5ba9ca),console[_0xb8055(0x111)]('Removed\x20existing\x20profile\x20\x27'+_0x5ba9ca+'\x27'));const _0x33704a=validateProfileName(_0x5ba9ca);if(_0x33704a!==!![])return console[_0xb8055(0xfa)](a33_0x9f1103[_0xb8055(0x13b)](_0x33704a)),0x1;_0x3aa9be=_0x5ba9ca;}else{const _0x45e67f=await a33_0x272f65({'type':_0xb8055(0xf4),'name':_0xb8055(0x12e),'message':'Enter\x20profile\x20name:','validate':_0x1faca3=>validateProfileName(_0x1faca3,{'skipExistsCheck':_0xe48e36})});if(!_0x45e67f[_0xb8055(0x12e)])return console['log'](_0xb8055(0x133)),0x1;_0x3aa9be=_0x45e67f[_0xb8055(0x12e)]['trim'](),_0xe48e36&&profileExists(_0x3aa9be)&&(await deleteProfileAndCredentials(_0x3aa9be),console[_0xb8055(0x111)](_0xb8055(0x154)+_0x3aa9be+'\x27'));}const _0x5b99f8=await a33_0x272f65({'type':_0xb8055(0xf4),'name':_0xb8055(0x103),'message':_0xb8055(0xf6)}),_0x5305fa=_0x5b99f8[_0xb8055(0x103)]?.[_0xb8055(0xf3)]()||undefined,_0x2da157=_0x216ed5[_0xb8055(0x10f)]||_0xb8055(0x139),_0x5576c3=await promptSiteSelection(_0x2da157,_0x3aa9be,_0xb8055(0x141));if(!_0x5576c3)return 0x1;const _0x127732=resolveSite(_0x5576c3),_0x57909b=await promptAuthMethod();if(!_0x57909b)return console[_0xb8055(0x111)](_0xb8055(0x133)),0x1;if(_0x57909b==='oauth'){if(_0x5305fa){const _0x4ebaca={'site':_0x127732,'description':_0x5305fa};saveProfileToUserConfig(_0x3aa9be,_0x4ebaca);}const {accountName:_0x316389}=_0x216ed5;return await runOAuthLoginFlow(_0x127732,_0x3aa9be,_0x216ed5[_0xb8055(0x104)]??LogLevel[_0xb8055(0x148)],{'accountName':_0x316389}),0x0;}console[_0xb8055(0x111)](_0xb8055(0x11e)+_0x127732),console[_0xb8055(0x111)](_0xb8055(0x122)),console[_0xb8055(0x111)]('\x20\x20'+getConsoleUrl(_0x127732,_0xb8055(0x11d)));const _0x226e16=await a33_0x272f65({'type':'password','name':_0xb8055(0x107),'message':_0xb8055(0x10d),'validate':_0x3fd416=>{const _0x38562a=_0xb8055;if(!_0x3fd416||!_0x3fd416[_0x38562a(0xf3)]())return _0x38562a(0x105);return!![];}});if(!_0x226e16[_0xb8055(0x107)])return console[_0xb8055(0x111)]('\x0aSetup\x20cancelled'),0x1;const _0x5b53ee=_0x226e16[_0xb8055(0x107)];console['log'](_0xb8055(0x130));try{const _0x85d434=TDX['create']({'site':_0x127732,'apiKey':_0x5b53ee[_0xb8055(0xf3)](),'logLevel':_0x216ed5[_0xb8055(0x104)]??LogLevel[_0xb8055(0x148)]}),_0x5cff39=await _0x85d434[_0xb8055(0x120)][_0xb8055(0x144)]();console[_0xb8055(0x111)](a33_0x9f1103[_0xb8055(0x124)]('✓')+_0xb8055(0x119)+_0x5cff39[_0xb8055(0x143)]+')');const _0x971ab2=await isKeychainAvailable();_0x971ab2?(await saveAPIKeyAsync(_0x5b53ee[_0xb8055(0xf3)](),_0x127732,_0x3aa9be),console[_0xb8055(0x111)](a33_0x9f1103[_0xb8055(0x124)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3aa9be+')')):(console['warn'](a33_0x9f1103[_0xb8055(0xf8)](_0xb8055(0x135))),console[_0xb8055(0x131)](a33_0x9f1103[_0xb8055(0xf8)](_0xb8055(0x14f))));const _0x208e73={'site':_0x127732,..._0x5305fa&&{'description':_0x5305fa}};return saveProfileToUserConfig(_0x3aa9be,_0x208e73),console[_0xb8055(0x111)](a33_0x9f1103['green']('✓')+_0xb8055(0x136)+_0x3aa9be+'\x27\x20created'),console['log'](),console['log'](_0xb8055(0x160)),console[_0xb8055(0x111)](_0xb8055(0x150)+_0x3aa9be+_0xb8055(0x132)),console[_0xb8055(0x111)](_0xb8055(0x150)+_0x3aa9be+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0xfa8af2){if(_0xfa8af2 instanceof HTTPClientError&&_0xfa8af2[_0xb8055(0x10a)]===0x191)return printAuthError(_0xfa8af2),0x1;return console['error'](a33_0x9f1103['red'](_0xb8055(0x11f)+(_0xfa8af2 instanceof Error?_0xfa8af2[_0xb8055(0x12b)]:String(_0xfa8af2)))),console[_0xb8055(0xfa)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x41576a(0x13f)]=a33_0x41576a(0x108);[a33_0x41576a(0x103)]=a33_0x41576a(0x15c);[a33_0x41576a(0x110)](_0xe6339){const _0xf2540=a33_0x41576a,{args:_0x2a90bd}=_0xe6339;if(_0x2a90bd[_0xf2540(0x101)]===0x0)return _0xf2540(0x121);return undefined;}async[a33_0x41576a(0x116)](_0x19f5cf){const _0xb7733d=a33_0x41576a,{args:_0x1bbd7f}=_0x19f5cf,_0x2e7f49=_0x1bbd7f[0x0];console[_0xb7733d(0x111)](a33_0x9f1103[_0xb7733d(0x13d)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x2e7f49)){console['error'](a33_0x9f1103[_0xb7733d(0x13b)](_0xb7733d(0x142)+_0x2e7f49+_0xb7733d(0x158))),console[_0xb7733d(0x111)](_0xb7733d(0x100));const _0x12bddd=listProfiles();if(_0x12bddd[_0xb7733d(0x101)]===0x0)console[_0xb7733d(0x111)](_0xb7733d(0x12d));else for(const _0x3bb97f of _0x12bddd){console[_0xb7733d(0x111)]('\x20\x20-\x20'+_0x3bb97f['name']);}return 0x1;}const _0x43daf3=await a33_0x272f65({'type':_0xb7733d(0x14a),'name':_0xb7733d(0x14a),'message':_0xb7733d(0x145)+_0x2e7f49+'\x27?','initial':![]});if(!_0x43daf3[_0xb7733d(0x14a)])return console[_0xb7733d(0x111)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x2e7f49),console['log'](a33_0x9f1103['green']('✓')+_0xb7733d(0x136)+_0x2e7f49+_0xb7733d(0x10b));}catch(_0x2b97fe){return console['error'](a33_0x9f1103['red'](_0xb7733d(0x12f)+(_0x2b97fe instanceof Error?_0x2b97fe['message']:String(_0x2b97fe)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a33_0x41576a(0x103)]=a33_0x41576a(0x155);static [a33_0x41576a(0x15e)]=[a33_0x41576a(0x10f),'database',a33_0x41576a(0x10e),a33_0x41576a(0x10c),a33_0x41576a(0x159),a33_0x41576a(0x103)];[a33_0x41576a(0x110)](_0x15b301){const _0x191acf=a33_0x41576a,{args:_0x4a4f91,options:_0x23e8d2}=_0x15b301,_0x23a3e0=_0x23e8d2['profile']||getActiveProfile();if(!_0x23a3e0)return _0x191acf(0x137);if(_0x4a4f91[_0x191acf(0x101)]===0x0)return _0x191acf(0x13a)+ProfileSetCommand[_0x191acf(0x15e)][_0x191acf(0x113)](',\x20');const _0x454068=_0x4a4f91[0x0];if(!_0x454068[_0x191acf(0x11a)]('='))return _0x191acf(0x146)+ProfileSetCommand['VALID_KEYS'][_0x191acf(0x113)](',\x20');const [_0x14c9dd]=_0x454068[_0x191acf(0x14c)]('=',0x2);if(!ProfileSetCommand[_0x191acf(0x15e)][_0x191acf(0x11a)](_0x14c9dd))return _0x191acf(0xf2)+_0x14c9dd+_0x191acf(0x11c)+ProfileSetCommand[_0x191acf(0x15e)]['join'](',\x20');return undefined;}async[a33_0x41576a(0x116)](_0x5a5a3f){const _0x3c5d0c=a33_0x41576a,{args:_0x3af508,options:_0x242cb3}=_0x5a5a3f,_0x68a4f2=_0x242cb3[_0x3c5d0c(0xff)]||getActiveProfile(),[_0x96d55f,..._0x28bab4]=_0x3af508[0x0][_0x3c5d0c(0x14c)]('='),_0x3421ba=_0x28bab4[_0x3c5d0c(0x113)]('=');console['log'](a33_0x9f1103[_0x3c5d0c(0x13d)](_0x3c5d0c(0x134)));if(!profileExists(_0x68a4f2)){const _0x14a0b5=await a33_0x272f65({'type':'confirm','name':'create','message':'Profile\x20\x27'+_0x68a4f2+_0x3c5d0c(0x15a),'initial':!![]});if(!_0x14a0b5[_0x3c5d0c(0x112)])return console['log'](_0x3c5d0c(0xfb)),0x1;}const _0x5152f6=loadProfile(_0x68a4f2),_0x19d078=_0x5152f6?.[_0x3c5d0c(0x15b)]||{};if(_0x96d55f===_0x3c5d0c(0x10f)){const _0x4f8a9f=resolveSite(_0x3421ba);console[_0x3c5d0c(0x111)](_0x3c5d0c(0xf5)+_0x4f8a9f+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3c5d0c(0x111)](_0x3c5d0c(0x127)),console[_0x3c5d0c(0x111)]('\x20\x20'+getConsoleUrl(_0x4f8a9f,_0x3c5d0c(0x11d)));const _0x550b43=await a33_0x272f65({'type':'password','name':_0x3c5d0c(0x107),'message':_0x3c5d0c(0x13c),'validate':_0x428288=>{const _0x4a04cf=_0x3c5d0c;if(!_0x428288||!_0x428288[_0x4a04cf(0xf3)]())return _0x4a04cf(0x105);return!![];}});if(!_0x550b43['apiKey'])return console[_0x3c5d0c(0x111)]('\x0aOperation\x20cancelled'),0x1;console[_0x3c5d0c(0x111)](_0x3c5d0c(0x130));try{const _0x14ee62=TDX['create']({'site':_0x4f8a9f,'apiKey':_0x550b43[_0x3c5d0c(0x107)]['trim'](),'logLevel':_0x242cb3[_0x3c5d0c(0x104)]??LogLevel[_0x3c5d0c(0x148)]}),_0x59265b=await _0x14ee62[_0x3c5d0c(0x120)]['getUserInfo']();console[_0x3c5d0c(0x111)](a33_0x9f1103['green']('✓')+_0x3c5d0c(0x119)+_0x59265b['email']+')');const _0x511179=await isKeychainAvailable();_0x511179?(await saveAPIKeyAsync(_0x550b43['apiKey']['trim'](),_0x4f8a9f,_0x68a4f2),console[_0x3c5d0c(0x111)](a33_0x9f1103['green']('✓')+_0x3c5d0c(0x15f))):console[_0x3c5d0c(0x131)](a33_0x9f1103[_0x3c5d0c(0xf8)](_0x3c5d0c(0x135))),_0x19d078[_0x3c5d0c(0x10f)]=_0x4f8a9f;}catch(_0x20da41){if(_0x20da41 instanceof HTTPClientError&&_0x20da41[_0x3c5d0c(0x10a)]===0x191)return printAuthError(_0x20da41),0x1;return console['error'](a33_0x9f1103[_0x3c5d0c(0x13b)]('✗\x20Validation\x20failed:\x20'+(_0x20da41 instanceof Error?_0x20da41[_0x3c5d0c(0x12b)]:String(_0x20da41)))),console[_0x3c5d0c(0xfa)](_0x3c5d0c(0x114)),0x1;}}else _0x19d078[_0x96d55f]=_0x3421ba||undefined;return saveProfileToUserConfig(_0x68a4f2,_0x19d078),console[_0x3c5d0c(0x111)](a33_0x9f1103[_0x3c5d0c(0x124)]('✓')+_0x3c5d0c(0x136)+_0x68a4f2+_0x3c5d0c(0x129)+_0x96d55f+'='+(_0x3421ba||_0x3c5d0c(0x138))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x41576a(0x13f)]=a33_0x41576a(0x14e);[a33_0x41576a(0x103)]=a33_0x41576a(0x157);['validate'](_0x5679bd){const _0x1a58e1=a33_0x41576a,{args:_0x41db71}=_0x5679bd;if(_0x41db71[_0x1a58e1(0x101)]===0x0)return _0x1a58e1(0x106);return undefined;}async[a33_0x41576a(0x116)](_0x4503ed){const _0x3e440b=a33_0x41576a,{args:_0x221a49,options:_0x496162}=_0x4503ed,_0x488e56=_0x221a49[0x0],_0x1b08a6=_0x496162[_0x3e440b(0x123)];cleanExpiredSessions();if(!profileExists(_0x488e56)){console[_0x3e440b(0xfa)](a33_0x9f1103['red'](_0x3e440b(0x142)+_0x488e56+_0x3e440b(0x158))),console['log'](_0x3e440b(0x100));const _0x3ec336=listProfiles();if(_0x3ec336[_0x3e440b(0x101)]===0x0)console[_0x3e440b(0x111)](_0x3e440b(0x12d));else for(const _0x2174bc of _0x3ec336){console[_0x3e440b(0x111)]('\x20\x20-\x20'+_0x2174bc[_0x3e440b(0x13f)]);}return 0x1;}if(_0x1b08a6){const _0x2cd0a6=a33_0x12fcd1['join'](getConfigDir(),_0x3e440b(0x15d));return saveActiveProfileToUserConfig(_0x488e56),console[_0x3e440b(0x111)]('Default\x20profile\x20set\x20to:\x20'+a33_0x9f1103[_0x3e440b(0x124)](_0x488e56)),console[_0x3e440b(0x111)](a33_0x9f1103[_0x3e440b(0x152)]('\x0aSaved\x20to:\x20'+_0x2cd0a6)),0x0;}const _0x5ba43e=getSessionID(_0x496162[_0x3e440b(0x149)]);return saveSessionContext({'profile':_0x488e56},_0x496162[_0x3e440b(0x149)]),console[_0x3e440b(0x111)](_0x3e440b(0x109)+a33_0x9f1103[_0x3e440b(0x124)](_0x488e56)+'\x20'+a33_0x9f1103[_0x3e440b(0x152)](_0x3e440b(0x11b)+_0x5ba43e+')')),console[_0x3e440b(0x111)](a33_0x9f1103[_0x3e440b(0x152)](_0x3e440b(0xf9)+_0x488e56+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a34_0x41d8(_0x36feef,_0x4a9873){_0x36feef=_0x36feef-0xa4;const _0x298691=a34_0x2986();let _0x41d835=_0x298691[_0x36feef];return _0x41d835;}const a34_0x267b2b=a34_0x41d8;(function(_0x2bcda6,_0x3eae85){const _0x2eb030=a34_0x41d8,_0x4692c1=_0x2bcda6();while(!![]){try{const _0x53131b=parseInt(_0x2eb030(0xa4))/0x1*(parseInt(_0x2eb030(0xa7))/0x2)+parseInt(_0x2eb030(0xa6))/0x3*(-parseInt(_0x2eb030(0xae))/0x4)+-parseInt(_0x2eb030(0xb6))/0x5+-parseInt(_0x2eb030(0xab))/0x6*(parseInt(_0x2eb030(0xb2))/0x7)+parseInt(_0x2eb030(0xaa))/0x8*(-parseInt(_0x2eb030(0xbf))/0x9)+parseInt(_0x2eb030(0xa5))/0xa*(-parseInt(_0x2eb030(0xa9))/0xb)+parseInt(_0x2eb030(0xba))/0xc;if(_0x53131b===_0x3eae85)break;else _0x4692c1['push'](_0x4692c1['shift']());}catch(_0x53ee8f){_0x4692c1['push'](_0x4692c1['shift']());}}}(a34_0x2986,0x59037));import{BaseCommand}from'./command.js';function a34_0x2986(){const _0x3cf084=['7FrCRBf','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','dim','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','2537640EnLkpq','site','log','👤\x20','21369264WRGbLx','description','Error:\x20','profiles','error','90ZoYoRE','map','green','\x20\x20Global:\x20~/.config/tdx/tdx.json','27505EJmrWk','40Rlvusi','2304GBGhjG','44iRGEIm','length','941039EfNhOh','308152eyorQJ','2796678fhwgTN','name','List\x20all\x20available\x20profiles','1668bSasbv','scope','message','config'];a34_0x2986=function(){return _0x3cf084;};return a34_0x2986();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x184548 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x267b2b(0xac)]=a34_0x267b2b(0xbd);[a34_0x267b2b(0xbb)]=a34_0x267b2b(0xad);async['execute'](_0x957f3a){const _0x34ecce=a34_0x267b2b,{options:_0x4519b1}=_0x957f3a;try{const _0x151be8=listProfiles(),_0x3e27fb=getActiveProfile();if(_0x151be8[_0x34ecce(0xa8)]===0x0)return console['log'](_0x34ecce(0xb5)),console[_0x34ecce(0xb8)](_0x34ecce(0xb3)),console[_0x34ecce(0xb8)](_0x34ecce(0xc2)),0x0;const _0x47de5e=_0x151be8[_0x34ecce(0xc0)](_0x3ea5cc=>{const _0x3aa648=_0x34ecce,_0x2bda1b=_0x3ea5cc[_0x3aa648(0xac)]===_0x3e27fb,_0x1c899d=getProfileParams(_0x3ea5cc[_0x3aa648(0xb1)]);return{'name':_0x3ea5cc['name'],'active':_0x2bda1b,'scope':_0x3ea5cc[_0x3aa648(0xaf)],'description':_0x3ea5cc[_0x3aa648(0xb1)]['description']||'','params':_0x1c899d};});if(isStructuredFormat(_0x4519b1))await handleSDKOutput(_0x47de5e,_0x4519b1);else for(const _0x55978c of _0x151be8){const _0x8373d4=_0x55978c[_0x34ecce(0xac)]===_0x3e27fb?a34_0x184548[_0x34ecce(0xc1)]('\x20✓'):'',_0x17ced8=_0x55978c[_0x34ecce(0xb1)][_0x34ecce(0xb7)]?a34_0x184548[_0x34ecce(0xb4)]('\x20'+_0x55978c[_0x34ecce(0xb1)][_0x34ecce(0xb7)]):'',_0x263ba8=_0x55978c[_0x34ecce(0xb1)][_0x34ecce(0xbb)]?a34_0x184548[_0x34ecce(0xb4)]('\x20\x20'+_0x55978c[_0x34ecce(0xb1)][_0x34ecce(0xbb)]):'';console[_0x34ecce(0xb8)](_0x34ecce(0xb9)+_0x55978c[_0x34ecce(0xac)]+_0x8373d4+_0x17ced8+_0x263ba8);}return 0x0;}catch(_0x52b435){return _0x52b435 instanceof Error&&console[_0x34ecce(0xbe)](_0x34ecce(0xbc)+_0x52b435[_0x34ecce(0xb0)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x565242=a35_0x2b1d;(function(_0x661e72,_0x36f34c){const _0x172c31=a35_0x2b1d,_0x4ce2c4=_0x661e72();while(!![]){try{const _0x42f281=-parseInt(_0x172c31(0x7e))/0x1+-parseInt(_0x172c31(0x79))/0x2+parseInt(_0x172c31(0x96))/0x3*(-parseInt(_0x172c31(0x84))/0x4)+-parseInt(_0x172c31(0x8a))/0x5+-parseInt(_0x172c31(0x86))/0x6+parseInt(_0x172c31(0x94))/0x7+parseInt(_0x172c31(0x90))/0x8;if(_0x42f281===_0x36f34c)break;else _0x4ce2c4['push'](_0x4ce2c4['shift']());}catch(_0x14eb27){_0x4ce2c4['push'](_0x4ce2c4['shift']());}}}(a35_0x1af2,0xed8d5));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x2b1d(_0x595572,_0x12fef3){_0x595572=_0x595572-0x6c;const _0x1af203=a35_0x1af2();let _0x2b1d2a=_0x1af203[_0x595572];return _0x2b1d2a;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x1af2(){const _0xd31357=['totalSplits','args','processedRows','39888456WHwYkF','site','error','Query\x20completed:\x20Processed\x20','11630549nwKXHk','execute','18ngJFVk','file','options','Statement\x20','information_schema','originalMessage','Site:\x20','Schema:\x20','\x20-\x20','in\x20','data','verbose','name','setJobId','\x20rows\x20','\x20[Job\x20ID:\x20','1362542vmMmff','No\x20SQL\x20provided','length','join','Run\x20Trino\x20queries\x20(streaming)','829366eCaIHz','jobId','query','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','output','342852dJBWCY','setExtra','11574624VMaYGz','\x20splits','elapsedTimeMillis','catalog','8602660facIFk','state','stats'];a35_0x1af2=function(){return _0xd31357;};return a35_0x1af2();}export class QueryCommand extends BaseCommand{[a35_0x565242(0x75)]=a35_0x565242(0x80);['description']=a35_0x565242(0x7d);async['execute'](_0x5d9d09){const _0xdd8ba1=a35_0x565242,{options:_0x3819b5,args:_0x2d1ec8,tdx:_0xbfac29}=_0x5d9d09,_0x4f1b6c={..._0x3819b5,'limitStructuredFormats':!![]},_0x4e163a=_0x2d1ec8[0x0],_0x8a2696=_0x3819b5[_0xdd8ba1(0x97)];let _0x47afb5;try{if(_0x8a2696)_0x47afb5=readSqlStatementsFromFile(_0x8a2696);else{if(_0x4e163a==='-')_0x47afb5=await readSqlStatementsFromStdin();else{if(_0x4e163a&&isSqlFilePath(_0x4e163a))_0x47afb5=readSqlStatementsFromFile(_0x4e163a);else{if(_0x4e163a)_0x47afb5=splitSqlStatements(_0x4e163a);else throw new Error(_0xdd8ba1(0x7a));}}}}catch(_0x532c78){return console[_0xdd8ba1(0x92)]('Error:\x20'+_0x532c78['message']),0x1;}const _0xd861df=_0x3819b5['database']||_0xdd8ba1(0x6d),_0x3c3e5b=_0x3819b5[_0xdd8ba1(0x89)];try{const _0x320a6d=[],_0x369b48=!!_0x3819b5[_0xdd8ba1(0x83)];for(let _0x7d07f7=0x0;_0x7d07f7<_0x47afb5[_0xdd8ba1(0x7b)];_0x7d07f7++){const _0x3a655d=_0x47afb5[_0x7d07f7],_0x287a01=_0x7d07f7+0x1,_0x521816=_0x47afb5[_0xdd8ba1(0x7b)],_0x4492da=_0x521816>0x1;_0x3819b5[_0xdd8ba1(0x74)]&&(console[_0xdd8ba1(0x92)]('\x0a'+(_0x4492da?_0xdd8ba1(0x6c)+_0x287a01+'/'+_0x521816+':':'')),console['error'](_0xdd8ba1(0x6f)+_0x3819b5[_0xdd8ba1(0x91)]),console['error']('Catalog:\x20'+(_0x3c3e5b||'td')),console[_0xdd8ba1(0x92)](_0xdd8ba1(0x70)+_0xd861df),console[_0xdd8ba1(0x92)]('SQL:\x20'+_0x3a655d));const _0x2c5a57=_0x4492da?'Executing\x20statement\x20'+_0x287a01+'/'+_0x521816+'...':'Executing\x20query...';try{const _0x29ebea=await withProgressSpinner(_0x2c5a57,async _0x314755=>{const _0x4e0e62=_0xdd8ba1,_0x5ecde1=await _0xbfac29[_0x4e0e62(0x80)][_0x4e0e62(0x95)](_0x3a655d,{'catalog':_0x3c3e5b,'schema':_0xd861df,'onJobId':_0x272ada=>{const _0x4c0615=_0x4e0e62;_0x314755[_0x4c0615(0x76)](_0x272ada);},'onProgress':_0x5738d9=>{const _0x46ffbb=_0x4e0e62;_0x314755['setPhase'](_0x46ffbb(0x81)+_0x5738d9[_0x46ffbb(0x8b)]+']'),_0x314755[_0x46ffbb(0x85)](formatRows(_0x5738d9[_0x46ffbb(0x8f)])+'\x20rows\x20'+_0x5738d9['completedSplits']+'/'+_0x5738d9[_0x46ffbb(0x8d)]+_0x46ffbb(0x87));}});return _0x5ecde1;},{'verbose':_0x3819b5[_0xdd8ba1(0x74)]}),_0x174643=_0x29ebea[_0xdd8ba1(0x73)],_0x539178=_0x174643[_0xdd8ba1(0x7f)]?_0xdd8ba1(0x78)+_0x174643[_0xdd8ba1(0x7f)]+']':'',_0x43ed6d=_0x4492da?_0xdd8ba1(0x6c)+_0x287a01+'/'+_0x521816+_0xdd8ba1(0x71):'';console[_0xdd8ba1(0x92)]('✔\x20'+_0x43ed6d+_0xdd8ba1(0x93)+formatRows(_0x174643[_0xdd8ba1(0x8c)][_0xdd8ba1(0x8f)])+_0xdd8ba1(0x77)+(_0xdd8ba1(0x72)+formatElapsed(_0x174643['stats'][_0xdd8ba1(0x88)])+_0x539178));if(_0x4492da&&_0x369b48){const _0x2f0628=resolveOutputOptions(_0x4f1b6c),_0x29e6f6=await formatQueryOutput(_0x174643,_0x2f0628);_0x320a6d['push'](_0x29e6f6);}else await handleQueryOutput(_0x174643,_0x4f1b6c);}catch(_0x410849){const _0x10dbae=_0x4492da?_0xdd8ba1(0x6c)+_0x287a01+'/'+_0x521816+':\x0a':'',_0x117e84=_0x410849 instanceof SDKError?_0x410849[_0xdd8ba1(0x6e)]:_0x410849['message'];return console[_0xdd8ba1(0x92)](''+_0x10dbae+_0x117e84),0x1;}}if(_0x47afb5[_0xdd8ba1(0x7b)]>0x1&&_0x369b48&&_0x320a6d['length']>0x0){const _0xf6b974=_0x320a6d[_0xdd8ba1(0x7c)]('\x0a');writeFileSync(_0x3819b5[_0xdd8ba1(0x83)],_0xf6b974),console['error'](_0xdd8ba1(0x82)+_0x3819b5[_0xdd8ba1(0x83)]);}return 0x0;}catch(_0x3fcdf3){throw _0x3fcdf3;}}['validate'](_0x459936){const _0x193092=a35_0x565242,_0x36286b=_0x459936[_0x193092(0x8e)][0x0],_0x1bcb16=_0x459936[_0x193092(0x98)]['file'];if(!_0x36286b&&!_0x1bcb16)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x36286b&&_0x1bcb16)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x5069d6=a36_0x3d08;(function(_0x152e16,_0x531b3a){const _0x5f430c=a36_0x3d08,_0x4c19b2=_0x152e16();while(!![]){try{const _0x57409c=parseInt(_0x5f430c(0x1c6))/0x1*(-parseInt(_0x5f430c(0x1f0))/0x2)+parseInt(_0x5f430c(0x1ae))/0x3*(-parseInt(_0x5f430c(0x1d8))/0x4)+parseInt(_0x5f430c(0x1e8))/0x5*(parseInt(_0x5f430c(0x1bf))/0x6)+parseInt(_0x5f430c(0x1e9))/0x7*(parseInt(_0x5f430c(0x1f6))/0x8)+parseInt(_0x5f430c(0x241))/0x9+parseInt(_0x5f430c(0x218))/0xa*(parseInt(_0x5f430c(0x213))/0xb)+-parseInt(_0x5f430c(0x1c8))/0xc;if(_0x57409c===_0x531b3a)break;else _0x4c19b2['push'](_0x4c19b2['shift']());}catch(_0x17fa05){_0x4c19b2['push'](_0x4c19b2['shift']());}}}(a36_0xbc4b,0xaaebf));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a36_0xbc4b(){const _0x25c1da=['\x20(showing\x20','10fSnLzZ','validate','red','No\x20scheduled\x20queries\x20found','listQueries','count','queryUrl','execute','scheduled_at','created_at','jobs','m\x20ago','status','lastRun','substring','Create\x20a\x20scheduled\x20query','schedule:run','description','priority','delete','dim','ended_at','Update\x20a\x20scheduled\x20query','round','user','Schedule\x20deleted:\x20','from','Delete\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedules','length','timezone','Query\x20file\x20is\x20empty','never','retryLimit','in\x20','json','cron','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','next_run_at','green','12233466QmzpaZ','\x20\x20Database:\x20','Show\x20schedule\x20execution\x20history','success','3KyUidr','delay','list','padEnd','output','keys','data','pagination','trino','history','schedule:show','cyan','trim','Running\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','time_zone','run','352602gNofOF','Cancelled','name','Failed\x20to\x20read\x20file:\x20','\x20\x20Cron:\x20','getTime','update','5nXYBUv','\x20\x20Timezone:\x20','32824020cTRHln','show','(unnamed)','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','Showing\x20first\x20','schedule:delete','nextRun','\x20matching\x20\x22','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','end_at','database','Creating\x20schedule...','\x20\x20→\x20','d\x20ago','max','507540nFAAfF','Getting\x20schedule\x20history...','error','last_job','log','engine_version','schedule:create','engineVersion','Found\x20','limit','retry_limit','\x20\x20Num:\x20','Running\x20schedule...','join','\x20schedules','Deleting\x20schedule...','85sHIaux','7LIwxQG','updated_at','Schedule\x20updated:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','user_name','type','query','8258SEjdbm','format','Run\x20a\x20scheduled\x20query\x20immediately','schedule:list','just\x20now','Schedule\x20created:\x20','1708448ftBiYr','\x20(use\x20--limit\x20to\x20see\x20more)','result','INVALID_ARGUMENT','soon','queries','Show\x20schedule\x20details','Getting\x20schedule\x20details...','args','toLocaleDateString','Schedule\x20run\x20submitted:\x20','entries','/app/queries/editor?queryId=','\x20\x20Type:\x20','ies','options','statusIcon','has_next_page','\x20\x20Time:\x20','tsv','file','yes','start_at','verbose','repeat','num','jsonl','table','\x20\x20Job\x20ID:\x20','11122001dfEpcc','Updating\x20schedule:\x20','\x20execution','map'];a36_0xbc4b=function(){return _0x25c1da;};return a36_0xbc4b();}import{confirm}from'../utils/prompt.js';function a36_0x3d08(_0xfb60fa,_0x301ea3){_0xfb60fa=_0xfb60fa-0x1ae;const _0xbc4bac=a36_0xbc4b();let _0x3d08a0=_0xbc4bac[_0xfb60fa];return _0x3d08a0;}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 a36_0x540575 from'chalk';function formatRelativeTime(_0x46f502){const _0x44f6eb=a36_0x3d08,_0x3354e9=new Date(_0x46f502),_0x55a919=new Date(),_0x2eb46b=_0x3354e9[_0x44f6eb(0x1c4)]()-_0x55a919['getTime'](),_0x188a77=Math['abs'](_0x2eb46b)/0x3e8,_0x9a7fcf=_0x2eb46b<0x0;if(_0x188a77<0x3c)return _0x9a7fcf?_0x44f6eb(0x1f4):_0x44f6eb(0x1fa);else{if(_0x188a77<0xe10){const _0x4e26cc=Math['round'](_0x188a77/0x3c);return _0x9a7fcf?_0x4e26cc+_0x44f6eb(0x223):'in\x20'+_0x4e26cc+'m';}else{if(_0x188a77<0x15180){const _0x57b6b1=Math[_0x44f6eb(0x22f)](_0x188a77/0xe10);return _0x9a7fcf?_0x57b6b1+'h\x20ago':_0x44f6eb(0x23b)+_0x57b6b1+'h';}else{if(_0x188a77<0x93a80){const _0x53f6c1=Math[_0x44f6eb(0x22f)](_0x188a77/0x15180);return _0x9a7fcf?_0x53f6c1+_0x44f6eb(0x1d6):_0x44f6eb(0x23b)+_0x53f6c1+'d';}else return _0x3354e9[_0x44f6eb(0x1ff)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x5069d6(0x1f3);['description']='List\x20scheduled\x20queries';async['execute'](_0x27e478){const _0x22ab88=a36_0x5069d6,{options:_0x235ae5,args:_0x5b5ea7,tdx:_0x1bb376}=_0x27e478,_0x32f172=resolveLimit(_0x235ae5[_0x22ab88(0x1e1)],DEFAULT_DISPLAY_LIMIT),_0x4965a9=_0x5b5ea7[0x0],_0x2aedbe=_0x4965a9?_0x22ab88(0x1cc)+_0x4965a9+'\x22...':'Listing\x20scheduled\x20queries...',_0x1dd4ec=await withSpinner(_0x2aedbe,()=>_0x1bb376[_0x22ab88(0x235)][_0x22ab88(0x21c)]({'limit':_0x32f172,'scheduled':!![],'pattern':_0x4965a9}),{'verbose':_0x235ae5[_0x22ab88(0x20d)]}),_0x5a8939=_0x1dd4ec['data'][_0x22ab88(0x1fb)],_0x120579=_0x1dd4ec[_0x22ab88(0x1b4)][_0x22ab88(0x1b5)][_0x22ab88(0x207)],_0x133a13=_0x4965a9?_0x22ab88(0x1d0)+_0x4965a9+'\x22':'';_0x120579?console['error'](_0x22ab88(0x1cd)+_0x5a8939['length']+_0x22ab88(0x1e6)+_0x133a13+_0x22ab88(0x1f7)):console[_0x22ab88(0x1da)](_0x22ab88(0x1e0)+_0x5a8939[_0x22ab88(0x236)]+'\x20scheduled\x20quer'+(_0x5a8939[_0x22ab88(0x236)]!==0x1?_0x22ab88(0x204):'y')+_0x133a13);if(_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x23c)||_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x210)||_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x211)||_0x235ae5['format']===_0x22ab88(0x209)){const _0x409fd5=_0x5a8939['map'](_0x29576b=>({'id':_0x29576b['id'],'name':_0x29576b['name'],'cron':_0x29576b['cron'],'database':_0x29576b[_0x22ab88(0x1d3)]?.[_0x22ab88(0x1c1)],'type':_0x29576b['type'],'timezone':_0x29576b[_0x22ab88(0x1bd)],'user_name':_0x29576b[_0x22ab88(0x230)]?.[_0x22ab88(0x1c1)],'updated_at':_0x29576b[_0x22ab88(0x1ea)],'next_run_at':_0x29576b[_0x22ab88(0x23f)],'last_job_status':_0x29576b[_0x22ab88(0x1db)]?.[_0x22ab88(0x224)]}));await handleSDKOutput(_0x409fd5,_0x235ae5);}else{if(_0x5a8939[_0x22ab88(0x236)]===0x0)console[_0x22ab88(0x1dc)](_0x22ab88(0x21b));else{const _0x39c1b3=_0x235ae5['site'],_0x462734=_0x5a8939[_0x22ab88(0x216)](_0x4b785f=>{const _0x561080=_0x22ab88,_0x62de67=_0x4b785f[_0x561080(0x1db)]?.['status']?_0x4b785f['last_job'][_0x561080(0x224)]==='success'?'✓':'✗':'-',_0x5a17a1=_0x4b785f[_0x561080(0x1db)]?.[_0x561080(0x22d)]?formatRelativeTime(_0x4b785f[_0x561080(0x1db)][_0x561080(0x22d)]):_0x561080(0x239),_0x2676e0=_0x4b785f[_0x561080(0x23f)]?formatRelativeTime(_0x4b785f[_0x561080(0x23f)]):'-',_0xf51ae4=_0x4b785f[_0x561080(0x23d)]||'',_0xf280fe=_0x4b785f[_0x561080(0x1c1)]||_0x561080(0x1ca),_0x2dd8e4=getConsoleUrl(_0x39c1b3,_0x561080(0x202)+_0x4b785f['id']);return{'statusIcon':_0x62de67,'lastRun':_0x5a17a1,'nextRun':_0x2676e0,'cron':_0xf51ae4,'name':_0xf280fe,'queryUrl':_0x2dd8e4,'status':_0x4b785f[_0x561080(0x1db)]?.[_0x561080(0x224)]};}),_0x2b1bca=Math[_0x22ab88(0x1d7)](..._0x462734[_0x22ab88(0x216)](_0x20134f=>_0x20134f[_0x22ab88(0x225)][_0x22ab88(0x236)])),_0x1ccf5a=Math['max'](..._0x462734['map'](_0xfa65be=>_0xfa65be[_0x22ab88(0x1cf)]['length'])),_0x350fc6=Math[_0x22ab88(0x1d7)](..._0x462734[_0x22ab88(0x216)](_0x2287f9=>_0x2287f9[_0x22ab88(0x23d)][_0x22ab88(0x236)])),_0x3b80d4=_0x462734['map'](_0x30cf79=>{const _0x249503=_0x22ab88,_0x3b5e6c=_0x30cf79[_0x249503(0x224)]===_0x249503(0x244)?a36_0x540575[_0x249503(0x240)](_0x30cf79[_0x249503(0x206)]):_0x30cf79[_0x249503(0x224)]==='error'?a36_0x540575[_0x249503(0x21a)](_0x30cf79[_0x249503(0x206)]):a36_0x540575[_0x249503(0x22c)](_0x30cf79[_0x249503(0x206)]),_0x3d21c3=_0x30cf79[_0x249503(0x225)][_0x249503(0x1b1)](_0x2b1bca),_0x4a9b0e=_0x30cf79[_0x249503(0x1cf)]['padEnd'](_0x1ccf5a),_0x29f9a1=_0x30cf79[_0x249503(0x23d)]?a36_0x540575[_0x249503(0x1b9)](_0x30cf79[_0x249503(0x23d)][_0x249503(0x1b1)](_0x350fc6)):'\x20'[_0x249503(0x20e)](_0x350fc6),_0x383430=hyperlink(_0x30cf79[_0x249503(0x1c1)],_0x30cf79[_0x249503(0x21e)]);return'📅\x20'+_0x3b5e6c+'\x20'+_0x3d21c3+_0x249503(0x1d5)+_0x4a9b0e+'\x20\x20'+_0x29f9a1+'\x20\x20'+_0x383430;});await writeOutput(_0x3b80d4[_0x22ab88(0x1e5)]('\x0a'),_0x235ae5[_0x22ab88(0x1b2)],_0x22ab88(0x1b0));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x1b8);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x1fc);[a36_0x5069d6(0x219)](_0x466167){const _0x4da909=a36_0x5069d6,_0x6aa3c6=_0x466167[_0x4da909(0x1fe)][0x0];if(!_0x6aa3c6)return _0x4da909(0x1bc);return undefined;}async['execute'](_0x491148){const _0x4d04f6=a36_0x5069d6,{options:_0x4105ad,args:_0x16061c,tdx:_0x4e1b61}=_0x491148,_0x183d33=_0x16061c[0x0],_0x4b03e2=await withSpinner(_0x4d04f6(0x1fd),()=>_0x4e1b61[_0x4d04f6(0x235)][_0x4d04f6(0x1c9)](_0x183d33),{'verbose':_0x4105ad[_0x4d04f6(0x20d)]}),_0x17ddb3=_0x4b03e2[_0x4d04f6(0x1b4)],_0x2c31fa={'name':_0x17ddb3[_0x4d04f6(0x1c1)],'cron':_0x17ddb3[_0x4d04f6(0x23d)],'database':_0x17ddb3[_0x4d04f6(0x1d3)],'type':_0x17ddb3[_0x4d04f6(0x1ee)],'timezone':_0x17ddb3[_0x4d04f6(0x237)],'user_name':_0x17ddb3[_0x4d04f6(0x1ed)],'created_at':_0x17ddb3['created_at'],'engine_version':_0x17ddb3[_0x4d04f6(0x1dd)],'executing_user_id':_0x17ddb3['executing_user_id'],'query':_0x17ddb3['query'],'delay':_0x17ddb3[_0x4d04f6(0x1af)],'priority':_0x17ddb3['priority'],'retry_limit':_0x17ddb3[_0x4d04f6(0x1e2)],..._0x17ddb3[_0x4d04f6(0x1f8)]&&{'result':_0x17ddb3[_0x4d04f6(0x1f8)]}};return await handleSingleObjectOutput(_0x2c31fa,_0x4105ad),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x5069d6(0x1de);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x227);[a36_0x5069d6(0x219)](_0x5de18e){const _0x29d18e=a36_0x5069d6,_0x32ecc9=_0x5de18e[_0x29d18e(0x1fe)][0x0];if(!_0x32ecc9)return _0x29d18e(0x234);const _0x4bb7e3=_0x5de18e[_0x29d18e(0x205)];if(!_0x4bb7e3[_0x29d18e(0x1d3)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a36_0x5069d6(0x21f)](_0x595c03){const _0x34824d=a36_0x5069d6,{options:_0x51e841,args:_0x45aef9,tdx:_0x2762af}=_0x595c03,_0x33134e=_0x45aef9[0x0],_0x30a5c7=_0x51e841,_0x39382c=_0x30a5c7[_0x34824d(0x1d3)],_0x82057e=_0x30a5c7['file'],_0x1e2651=_0x30a5c7[_0x34824d(0x1ee)]||_0x34824d(0x1b6);let _0x269927;try{_0x269927=readFileSync(_0x82057e,'utf-8')[_0x34824d(0x1ba)]();}catch(_0x4e5720){throw new SDKError(ErrorCode[_0x34824d(0x1f9)],_0x34824d(0x1c2)+_0x82057e,_0x4e5720 instanceof Error?_0x4e5720:undefined);}if(!_0x269927)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x34824d(0x238));const _0x4904f2={'database':_0x39382c,'query':_0x269927,'type':_0x1e2651};if(_0x30a5c7[_0x34824d(0x23d)])_0x4904f2[_0x34824d(0x23d)]=_0x30a5c7['cron'];if(_0x30a5c7[_0x34824d(0x237)])_0x4904f2[_0x34824d(0x237)]=_0x30a5c7[_0x34824d(0x237)];if(_0x30a5c7[_0x34824d(0x1af)]!==undefined)_0x4904f2[_0x34824d(0x1af)]=Number(_0x30a5c7[_0x34824d(0x1af)]);if(_0x30a5c7[_0x34824d(0x22a)]!==undefined)_0x4904f2[_0x34824d(0x22a)]=Number(_0x30a5c7[_0x34824d(0x22a)]);if(_0x30a5c7[_0x34824d(0x23a)]!==undefined)_0x4904f2[_0x34824d(0x1e2)]=Number(_0x30a5c7['retryLimit']);if(_0x30a5c7[_0x34824d(0x1df)])_0x4904f2[_0x34824d(0x1dd)]=_0x30a5c7[_0x34824d(0x1df)];if(_0x30a5c7[_0x34824d(0x1f8)])_0x4904f2[_0x34824d(0x1f8)]=_0x30a5c7['result'];if(_0x51e841[_0x34824d(0x20d)]){console[_0x34824d(0x1da)]('Creating\x20schedule:\x20'+_0x33134e),console[_0x34824d(0x1da)](_0x34824d(0x242)+_0x39382c),console[_0x34824d(0x1da)](_0x34824d(0x203)+_0x1e2651);if(_0x4904f2[_0x34824d(0x23d)])console[_0x34824d(0x1da)](_0x34824d(0x1c3)+_0x4904f2['cron']);if(_0x4904f2[_0x34824d(0x237)])console[_0x34824d(0x1da)](_0x34824d(0x1c7)+_0x4904f2['timezone']);}const _0x348b35=await withSpinner(_0x34824d(0x1d4),()=>_0x2762af[_0x34824d(0x235)]['create'](_0x33134e,_0x4904f2),{'verbose':_0x51e841['verbose']});return console[_0x34824d(0x1da)](_0x34824d(0x1f5)+_0x348b35[_0x34824d(0x1b4)][_0x34824d(0x1c1)]),await handleSingleObjectOutput(_0x348b35[_0x34824d(0x1b4)],_0x51e841),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a36_0x5069d6(0x229)]=a36_0x5069d6(0x22e);['validate'](_0x237596){const _0x3c3333=a36_0x5069d6,_0x5553bc=_0x237596[_0x3c3333(0x1fe)][0x0];if(!_0x5553bc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0x5069d6(0x21f)](_0x5e4886){const _0x19cb7f=a36_0x5069d6,{options:_0x1eef04,args:_0x3b3125,tdx:_0x11d011}=_0x5e4886,_0xe48fdf=_0x3b3125[0x0],_0x269b2f=_0x1eef04,_0x2efaf7={};if(_0x269b2f[_0x19cb7f(0x1d3)])_0x2efaf7['database']=_0x269b2f['database'];if(_0x269b2f[_0x19cb7f(0x1ee)])_0x2efaf7[_0x19cb7f(0x1ee)]=_0x269b2f[_0x19cb7f(0x1ee)];if(_0x269b2f[_0x19cb7f(0x23d)])_0x2efaf7[_0x19cb7f(0x23d)]=_0x269b2f[_0x19cb7f(0x23d)];if(_0x269b2f[_0x19cb7f(0x237)])_0x2efaf7[_0x19cb7f(0x237)]=_0x269b2f[_0x19cb7f(0x237)];if(_0x269b2f[_0x19cb7f(0x1af)]!==undefined)_0x2efaf7[_0x19cb7f(0x1af)]=Number(_0x269b2f[_0x19cb7f(0x1af)]);if(_0x269b2f[_0x19cb7f(0x22a)]!==undefined)_0x2efaf7[_0x19cb7f(0x22a)]=Number(_0x269b2f[_0x19cb7f(0x22a)]);if(_0x269b2f[_0x19cb7f(0x23a)]!==undefined)_0x2efaf7['retry_limit']=Number(_0x269b2f[_0x19cb7f(0x23a)]);if(_0x269b2f[_0x19cb7f(0x1df)])_0x2efaf7['engine_version']=_0x269b2f[_0x19cb7f(0x1df)];if(_0x269b2f[_0x19cb7f(0x1f8)])_0x2efaf7['result']=_0x269b2f[_0x19cb7f(0x1f8)];if(_0x269b2f[_0x19cb7f(0x20a)])try{_0x2efaf7[_0x19cb7f(0x1ef)]=readFileSync(_0x269b2f[_0x19cb7f(0x20a)],'utf-8')[_0x19cb7f(0x1ba)]();}catch(_0x5394d7){throw new SDKError(ErrorCode[_0x19cb7f(0x1f9)],_0x19cb7f(0x1c2)+_0x269b2f[_0x19cb7f(0x20a)],_0x5394d7 instanceof Error?_0x5394d7:undefined);}if(Object[_0x19cb7f(0x1b3)](_0x2efaf7)[_0x19cb7f(0x236)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x19cb7f(0x1d1));if(_0x1eef04[_0x19cb7f(0x20d)]){console['error'](_0x19cb7f(0x214)+_0xe48fdf);for(const [_0x2b6669,_0x5cac8d]of Object[_0x19cb7f(0x201)](_0x2efaf7)){_0x2b6669===_0x19cb7f(0x1ef)?console['error']('\x20\x20'+_0x2b6669+':\x20'+_0x5cac8d[_0x19cb7f(0x226)](0x0,0x32)+'...'):console['error']('\x20\x20'+_0x2b6669+':\x20'+_0x5cac8d);}}const _0x62d224=await withSpinner('Updating\x20schedule...',()=>_0x11d011['schedules'][_0x19cb7f(0x1c5)](_0xe48fdf,_0x2efaf7),{'verbose':_0x1eef04['verbose']});return console['error'](_0x19cb7f(0x1eb)+_0x62d224[_0x19cb7f(0x1b4)]['name']),await handleSingleObjectOutput(_0x62d224['data'],_0x1eef04),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x1ce);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x233);['validate'](_0x2f7dad){const _0x3c4c9f=_0x2f7dad['args'][0x0];if(!_0x3c4c9f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x4ff2dc){const _0x208a90=a36_0x5069d6,{options:_0x80d5e1,args:_0x3e517f,tdx:_0xce05f4}=_0x4ff2dc,_0x1718d3=_0x3e517f[0x0];if(!_0x80d5e1[_0x208a90(0x20b)]){const _0x296e9d=await confirm(_0x208a90(0x23e)+_0x1718d3+'\x22?');if(!_0x296e9d)return console['error'](_0x208a90(0x1c0)),0x0;}const _0x30d629=await withSpinner(_0x208a90(0x1e7),()=>_0xce05f4[_0x208a90(0x235)][_0x208a90(0x22b)](_0x1718d3),{'verbose':_0x80d5e1[_0x208a90(0x20d)]});return console['error'](_0x208a90(0x231)+_0x30d629[_0x208a90(0x1b4)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x228);['description']=a36_0x5069d6(0x1f2);[a36_0x5069d6(0x219)](_0x39d132){const _0x5ddf75=a36_0x5069d6,_0x18ac96=_0x39d132[_0x5ddf75(0x1fe)][0x0];if(!_0x18ac96)return _0x5ddf75(0x1ec);return undefined;}async['execute'](_0x1a933b){const _0x45bd17=a36_0x5069d6,{options:_0x1e95a2,args:_0x32580d,tdx:_0x2e6f3b}=_0x1a933b,_0x1f817b=_0x32580d[0x0],_0x55071a=_0x1e95a2,_0x2cb4ba=_0x55071a['time'],_0x243aac=_0x55071a['num']!==undefined?Number(_0x55071a[_0x45bd17(0x20f)]):undefined;if(_0x1e95a2[_0x45bd17(0x20d)]){console[_0x45bd17(0x1da)](_0x45bd17(0x1bb)+_0x1f817b);if(_0x2cb4ba)console['error'](_0x45bd17(0x208)+_0x2cb4ba);if(_0x243aac)console[_0x45bd17(0x1da)](_0x45bd17(0x1e3)+_0x243aac);}const _0xb01f10=await withSpinner(_0x45bd17(0x1e4),()=>_0x2e6f3b[_0x45bd17(0x235)][_0x45bd17(0x1be)](_0x1f817b,{'time':_0x2cb4ba,'num':_0x243aac}),{'verbose':_0x1e95a2['verbose']}),_0x59f3bc=_0xb01f10[_0x45bd17(0x1b4)][_0x45bd17(0x222)];console['error'](_0x45bd17(0x200)+_0x59f3bc[_0x45bd17(0x236)]+'\x20job'+(_0x59f3bc[_0x45bd17(0x236)]!==0x1?'s':'')+_0x45bd17(0x1cb));for(const _0xf73d53 of _0x59f3bc){console[_0x45bd17(0x1da)](_0x45bd17(0x212)+_0xf73d53['job_id']);}return await handleSDKOutput(_0x59f3bc,_0x1e95a2),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]='schedule:history';[a36_0x5069d6(0x229)]=a36_0x5069d6(0x243);[a36_0x5069d6(0x219)](_0x1fa6a3){const _0x1223c2=_0x1fa6a3['args'][0x0];if(!_0x1223c2)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async['execute'](_0x1fb854){const _0x329f87=a36_0x5069d6,{options:_0xa0d26d,args:_0x1e638d,tdx:_0x42bfd9}=_0x1fb854,_0x46dee0=_0x1e638d[0x0],_0x29cf30=_0xa0d26d,_0x34d7a5=_0x29cf30[_0x329f87(0x232)]!==undefined?Number(_0x29cf30[_0x329f87(0x232)]):undefined,_0x5300f5=_0x29cf30['to']!==undefined?Number(_0x29cf30['to']):undefined,_0x5bc2f9=await withSpinner(_0x329f87(0x1d9),()=>_0x42bfd9['schedules'][_0x329f87(0x1b7)](_0x46dee0,{'from':_0x34d7a5,'to':_0x5300f5}),{'verbose':_0xa0d26d[_0x329f87(0x20d)]}),_0x11530a=_0x5bc2f9[_0x329f87(0x1b4)];console[_0x329f87(0x1da)]('Found\x20'+_0x11530a[_0x329f87(0x21d)]+_0x329f87(0x215)+(_0x11530a['count']!==0x1?'s':'')+_0x329f87(0x217)+_0x11530a[_0x329f87(0x232)]+'-'+_0x11530a['to']+')');const _0x5b49f3=_0x11530a[_0x329f87(0x1b7)][_0x329f87(0x216)](_0x10d758=>({'job_id':_0x10d758['job_id'],'type':_0x10d758['type'],'status':_0x10d758[_0x329f87(0x224)],'scheduled_at':_0x10d758[_0x329f87(0x220)],'created_at':_0x10d758[_0x329f87(0x221)],'start_at':_0x10d758[_0x329f87(0x20c)],'end_at':_0x10d758[_0x329f87(0x1d2)]}));return await handleSDKOutput(_0x5b49f3,_0xa0d26d),0x0;}}
|
|
1
|
+
const a36_0x2362b5=a36_0x545b;function a36_0x545b(_0x3c68b2,_0x1e0764){_0x3c68b2=_0x3c68b2-0x14a;const _0x27658e=a36_0x2765();let _0x545b2d=_0x27658e[_0x3c68b2];return _0x545b2d;}(function(_0x350b18,_0x40a740){const _0x5c2a1b=a36_0x545b,_0x4f6e3e=_0x350b18();while(!![]){try{const _0x188cbe=-parseInt(_0x5c2a1b(0x1c7))/0x1+-parseInt(_0x5c2a1b(0x1be))/0x2+-parseInt(_0x5c2a1b(0x17a))/0x3+parseInt(_0x5c2a1b(0x166))/0x4*(parseInt(_0x5c2a1b(0x1b7))/0x5)+parseInt(_0x5c2a1b(0x16c))/0x6*(-parseInt(_0x5c2a1b(0x18c))/0x7)+-parseInt(_0x5c2a1b(0x1ce))/0x8*(parseInt(_0x5c2a1b(0x1c9))/0x9)+parseInt(_0x5c2a1b(0x15a))/0xa;if(_0x188cbe===_0x40a740)break;else _0x4f6e3e['push'](_0x4f6e3e['shift']());}catch(_0x31b6cd){_0x4f6e3e['push'](_0x4f6e3e['shift']());}}}(a36_0x2765,0x8850c));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';function a36_0x2765(){const _0x5f1252=['tsv','\x20job','\x20execution','Running\x20schedule:\x20','user','Getting\x20schedule\x20details...','Creating\x20schedule:\x20','padEnd','success','toLocaleDateString','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','schedule:update','dim','50ckzQGz','m\x20ago','schedules','table','time_zone','last_job','schedule:delete','1307796rCGBXS','args','Run\x20a\x20scheduled\x20query\x20immediately','listQueries','Schedule\x20created:\x20','Showing\x20first\x20','updated_at','Getting\x20schedule\x20history...','join','482278JkszGf','status','1797057PEQnEa','user_name','count','Running\x20schedule...','Deleting\x20schedule...','16XLTzKG','from','\x20\x20Database:\x20','type','queryUrl','Update\x20a\x20scheduled\x20query','update','Query\x20file\x20is\x20empty','/app/queries/editor?queryId=','Creating\x20schedule...','file','timezone','site','schedule:run','error','yes','end_at','jobs','database','retry_limit','result','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','map','options','Updating\x20schedule:\x20','max','description','data','(unnamed)','\x20\x20Timezone:\x20','24683530RzuwaP','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','utf-8','trim','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','red','green','jsonl','entries','in\x20','trino','validate','124444WCKeNK','Show\x20schedule\x20execution\x20history','Updating\x20schedule...','statusIcon','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','cron','6Rpryps','delete','Found\x20','\x22...','limit','scheduled_at','length','job_id','cyan','priority','schedule:history','start_at','execute','\x20\x20Job\x20ID:\x20','1745604ooLDbt','schedule:show','substring','\x20matching\x20\x22','Listing\x20scheduled\x20queries...','abs','lastRun','Create\x20a\x20scheduled\x20query','never','engineVersion','name','INVALID_ARGUMENT','Delete\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','format','nextRun','round','726075yZIDFN','next_run_at','retryLimit','Schedule\x20deleted:\x20','created_at','\x20(showing\x20','output','query','\x20(use\x20--limit\x20to\x20see\x20more)','delay','has_next_page','pagination','log','executing_user_id','h\x20ago','just\x20now','Failed\x20to\x20read\x20file:\x20','run','...','engine_version','verbose','Searching\x20scheduled\x20queries\x20matching\x20\x22','json','keys','📅\x20','show','ended_at','\x20\x20Cron:\x20','\x20\x20Type:\x20','\x20schedules'];a36_0x2765=function(){return _0x5f1252;};return a36_0x2765();}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 a36_0xb71f9e from'chalk';function formatRelativeTime(_0x562ce3){const _0x59b7b7=a36_0x545b,_0x50ae72=new Date(_0x562ce3),_0x264833=new Date(),_0x4ece2d=_0x50ae72['getTime']()-_0x264833['getTime'](),_0x4a268b=Math[_0x59b7b7(0x17f)](_0x4ece2d)/0x3e8,_0x764277=_0x4ece2d<0x0;if(_0x4a268b<0x3c)return _0x764277?_0x59b7b7(0x19b):'soon';else{if(_0x4a268b<0xe10){const _0x226255=Math[_0x59b7b7(0x18b)](_0x4a268b/0x3c);return _0x764277?_0x226255+_0x59b7b7(0x1b8):_0x59b7b7(0x163)+_0x226255+'m';}else{if(_0x4a268b<0x15180){const _0xd89a40=Math[_0x59b7b7(0x18b)](_0x4a268b/0xe10);return _0x764277?_0xd89a40+_0x59b7b7(0x19a):_0x59b7b7(0x163)+_0xd89a40+'h';}else{if(_0x4a268b<0x93a80){const _0x5f0f28=Math['round'](_0x4a268b/0x15180);return _0x764277?_0x5f0f28+'d\x20ago':'in\x20'+_0x5f0f28+'d';}else return _0x50ae72[_0x59b7b7(0x1b3)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x2362b5(0x184)]='schedule:list';[a36_0x2362b5(0x156)]='List\x20scheduled\x20queries';async['execute'](_0x396a3f){const _0x317519=a36_0x2362b5,{options:_0x4f744c,args:_0x3d0e12,tdx:_0x56f1b3}=_0x396a3f,_0x31a4d6=resolveLimit(_0x4f744c[_0x317519(0x170)],DEFAULT_DISPLAY_LIMIT),_0x26cb5d=_0x3d0e12[0x0],_0x590fc0=_0x26cb5d?_0x317519(0x1a1)+_0x26cb5d+_0x317519(0x16f):_0x317519(0x17e),_0x38fd2b=await withSpinner(_0x590fc0,()=>_0x56f1b3[_0x317519(0x1b9)][_0x317519(0x1c1)]({'limit':_0x31a4d6,'scheduled':!![],'pattern':_0x26cb5d}),{'verbose':_0x4f744c[_0x317519(0x1a0)]}),_0x5c636d=_0x38fd2b['data']['queries'],_0x40d93b=_0x38fd2b['data'][_0x317519(0x197)][_0x317519(0x196)],_0x18f5d0=_0x26cb5d?_0x317519(0x17d)+_0x26cb5d+'\x22':'';_0x40d93b?console[_0x317519(0x14a)](_0x317519(0x1c3)+_0x5c636d['length']+_0x317519(0x1a9)+_0x18f5d0+_0x317519(0x194)):console[_0x317519(0x14a)]('Found\x20'+_0x5c636d['length']+'\x20scheduled\x20quer'+(_0x5c636d['length']!==0x1?'ies':'y')+_0x18f5d0);if(_0x4f744c['format']===_0x317519(0x1a2)||_0x4f744c['format']===_0x317519(0x161)||_0x4f744c[_0x317519(0x189)]===_0x317519(0x1ba)||_0x4f744c['format']===_0x317519(0x1aa)){const _0x417f2e=_0x5c636d['map'](_0xb6cc73=>({'id':_0xb6cc73['id'],'name':_0xb6cc73[_0x317519(0x184)],'cron':_0xb6cc73[_0x317519(0x16b)],'database':_0xb6cc73[_0x317519(0x14e)]?.[_0x317519(0x184)],'type':_0xb6cc73['type'],'timezone':_0xb6cc73[_0x317519(0x1bb)],'user_name':_0xb6cc73[_0x317519(0x1ae)]?.[_0x317519(0x184)],'updated_at':_0xb6cc73[_0x317519(0x1c4)],'next_run_at':_0xb6cc73[_0x317519(0x18d)],'last_job_status':_0xb6cc73['last_job']?.[_0x317519(0x1c8)]}));await handleSDKOutput(_0x417f2e,_0x4f744c);}else{if(_0x5c636d['length']===0x0)console[_0x317519(0x198)]('No\x20scheduled\x20queries\x20found');else{const _0x2b1d9a=_0x4f744c[_0x317519(0x1da)],_0x5d03ae=_0x5c636d[_0x317519(0x152)](_0x5badbd=>{const _0x1ac907=_0x317519,_0x2e0f31=_0x5badbd[_0x1ac907(0x1bc)]?.['status']?_0x5badbd[_0x1ac907(0x1bc)]['status']===_0x1ac907(0x1b2)?'✓':'✗':'-',_0x3a7290=_0x5badbd[_0x1ac907(0x1bc)]?.['ended_at']?formatRelativeTime(_0x5badbd[_0x1ac907(0x1bc)][_0x1ac907(0x1a6)]):_0x1ac907(0x182),_0x2e7f54=_0x5badbd[_0x1ac907(0x18d)]?formatRelativeTime(_0x5badbd[_0x1ac907(0x18d)]):'-',_0x4f8bde=_0x5badbd['cron']||'',_0x23fefd=_0x5badbd[_0x1ac907(0x184)]||_0x1ac907(0x158),_0x3d17af=getConsoleUrl(_0x2b1d9a,_0x1ac907(0x1d6)+_0x5badbd['id']);return{'statusIcon':_0x2e0f31,'lastRun':_0x3a7290,'nextRun':_0x2e7f54,'cron':_0x4f8bde,'name':_0x23fefd,'queryUrl':_0x3d17af,'status':_0x5badbd[_0x1ac907(0x1bc)]?.['status']};}),_0x22d169=Math[_0x317519(0x155)](..._0x5d03ae[_0x317519(0x152)](_0xfa858a=>_0xfa858a[_0x317519(0x180)]['length'])),_0x2052eb=Math[_0x317519(0x155)](..._0x5d03ae['map'](_0x4bc01a=>_0x4bc01a['nextRun'][_0x317519(0x172)])),_0x20ede7=Math[_0x317519(0x155)](..._0x5d03ae[_0x317519(0x152)](_0x5131=>_0x5131[_0x317519(0x16b)]['length'])),_0x373085=_0x5d03ae['map'](_0x5a2882=>{const _0x5b9104=_0x317519,_0x40b545=_0x5a2882['status']===_0x5b9104(0x1b2)?a36_0xb71f9e[_0x5b9104(0x160)](_0x5a2882[_0x5b9104(0x169)]):_0x5a2882[_0x5b9104(0x1c8)]==='error'?a36_0xb71f9e[_0x5b9104(0x15f)](_0x5a2882[_0x5b9104(0x169)]):a36_0xb71f9e[_0x5b9104(0x1b6)](_0x5a2882[_0x5b9104(0x169)]),_0x397d25=_0x5a2882[_0x5b9104(0x180)][_0x5b9104(0x1b1)](_0x22d169),_0x23064b=_0x5a2882[_0x5b9104(0x18a)][_0x5b9104(0x1b1)](_0x2052eb),_0x46c1e8=_0x5a2882[_0x5b9104(0x16b)]?a36_0xb71f9e[_0x5b9104(0x174)](_0x5a2882[_0x5b9104(0x16b)]['padEnd'](_0x20ede7)):'\x20'['repeat'](_0x20ede7),_0x1fa0b8=hyperlink(_0x5a2882['name'],_0x5a2882[_0x5b9104(0x1d2)]);return _0x5b9104(0x1a4)+_0x40b545+'\x20'+_0x397d25+'\x20\x20→\x20'+_0x23064b+'\x20\x20'+_0x46c1e8+'\x20\x20'+_0x1fa0b8;});await writeOutput(_0x373085[_0x317519(0x1c6)]('\x0a'),_0x4f744c[_0x317519(0x192)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x2362b5(0x17b);[a36_0x2362b5(0x156)]='Show\x20schedule\x20details';[a36_0x2362b5(0x165)](_0x5d3e22){const _0x343b24=a36_0x2362b5,_0x1354ca=_0x5d3e22[_0x343b24(0x1bf)][0x0];if(!_0x1354ca)return _0x343b24(0x187);return undefined;}async['execute'](_0x265fd1){const _0x1af817=a36_0x2362b5,{options:_0x591fcf,args:_0x4a4e4d,tdx:_0x342c14}=_0x265fd1,_0x30c532=_0x4a4e4d[0x0],_0x461223=await withSpinner(_0x1af817(0x1af),()=>_0x342c14[_0x1af817(0x1b9)][_0x1af817(0x1a5)](_0x30c532),{'verbose':_0x591fcf[_0x1af817(0x1a0)]}),_0x1738dc=_0x461223['data'],_0x1b8e1c={'name':_0x1738dc[_0x1af817(0x184)],'cron':_0x1738dc['cron'],'database':_0x1738dc[_0x1af817(0x14e)],'type':_0x1738dc[_0x1af817(0x1d1)],'timezone':_0x1738dc['timezone'],'user_name':_0x1738dc[_0x1af817(0x1ca)],'created_at':_0x1738dc[_0x1af817(0x190)],'engine_version':_0x1738dc['engine_version'],'executing_user_id':_0x1738dc[_0x1af817(0x199)],'query':_0x1738dc[_0x1af817(0x193)],'delay':_0x1738dc[_0x1af817(0x195)],'priority':_0x1738dc['priority'],'retry_limit':_0x1738dc['retry_limit'],..._0x1738dc[_0x1af817(0x150)]&&{'result':_0x1738dc[_0x1af817(0x150)]}};return await handleSingleObjectOutput(_0x1b8e1c,_0x591fcf),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2362b5(0x184)]='schedule:create';[a36_0x2362b5(0x156)]=a36_0x2362b5(0x181);[a36_0x2362b5(0x165)](_0x36d94c){const _0x5bf041=a36_0x2362b5,_0x20eb07=_0x36d94c['args'][0x0];if(!_0x20eb07)return _0x5bf041(0x188);const _0x383753=_0x36d94c[_0x5bf041(0x153)];if(!_0x383753[_0x5bf041(0x14e)])return _0x5bf041(0x151);return undefined;}async[a36_0x2362b5(0x178)](_0x17b06d){const _0x44382c=a36_0x2362b5,{options:_0x5b7fd9,args:_0x54e0b5,tdx:_0x280b39}=_0x17b06d,_0x4e7f02=_0x54e0b5[0x0],_0x543763=_0x5b7fd9,_0x4348b1=_0x543763[_0x44382c(0x14e)],_0x15ef87=_0x543763[_0x44382c(0x1d8)],_0x3c75bc=_0x543763['type']||_0x44382c(0x164);let _0x5a09ff;try{_0x5a09ff=readFileSync(_0x15ef87,_0x44382c(0x15c))[_0x44382c(0x15d)]();}catch(_0x4825c2){throw new SDKError(ErrorCode[_0x44382c(0x185)],_0x44382c(0x19c)+_0x15ef87,_0x4825c2 instanceof Error?_0x4825c2:undefined);}if(!_0x5a09ff)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x44382c(0x1d5));const _0x140452={'database':_0x4348b1,'query':_0x5a09ff,'type':_0x3c75bc};if(_0x543763[_0x44382c(0x16b)])_0x140452['cron']=_0x543763[_0x44382c(0x16b)];if(_0x543763['timezone'])_0x140452['timezone']=_0x543763[_0x44382c(0x1d9)];if(_0x543763[_0x44382c(0x195)]!==undefined)_0x140452[_0x44382c(0x195)]=Number(_0x543763[_0x44382c(0x195)]);if(_0x543763['priority']!==undefined)_0x140452['priority']=Number(_0x543763['priority']);if(_0x543763[_0x44382c(0x18e)]!==undefined)_0x140452['retry_limit']=Number(_0x543763[_0x44382c(0x18e)]);if(_0x543763[_0x44382c(0x183)])_0x140452[_0x44382c(0x19f)]=_0x543763[_0x44382c(0x183)];if(_0x543763['result'])_0x140452[_0x44382c(0x150)]=_0x543763[_0x44382c(0x150)];if(_0x5b7fd9[_0x44382c(0x1a0)]){console[_0x44382c(0x14a)](_0x44382c(0x1b0)+_0x4e7f02),console[_0x44382c(0x14a)](_0x44382c(0x1d0)+_0x4348b1),console['error'](_0x44382c(0x1a8)+_0x3c75bc);if(_0x140452[_0x44382c(0x16b)])console['error'](_0x44382c(0x1a7)+_0x140452[_0x44382c(0x16b)]);if(_0x140452[_0x44382c(0x1d9)])console[_0x44382c(0x14a)](_0x44382c(0x159)+_0x140452[_0x44382c(0x1d9)]);}const _0x37ff6b=await withSpinner(_0x44382c(0x1d7),()=>_0x280b39['schedules']['create'](_0x4e7f02,_0x140452),{'verbose':_0x5b7fd9[_0x44382c(0x1a0)]});return console[_0x44382c(0x14a)](_0x44382c(0x1c2)+_0x37ff6b[_0x44382c(0x157)][_0x44382c(0x184)]),await handleSingleObjectOutput(_0x37ff6b[_0x44382c(0x157)],_0x5b7fd9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x2362b5(0x184)]=a36_0x2362b5(0x1b5);[a36_0x2362b5(0x156)]=a36_0x2362b5(0x1d3);[a36_0x2362b5(0x165)](_0x4d1f2d){const _0x3704d7=a36_0x2362b5,_0x370cfc=_0x4d1f2d[_0x3704d7(0x1bf)][0x0];if(!_0x370cfc)return _0x3704d7(0x16a);return undefined;}async[a36_0x2362b5(0x178)](_0x3d5208){const _0x4f7e73=a36_0x2362b5,{options:_0x3dc25e,args:_0xea14f2,tdx:_0x3696ea}=_0x3d5208,_0x1a0ef2=_0xea14f2[0x0],_0x22eec1=_0x3dc25e,_0x56bc34={};if(_0x22eec1[_0x4f7e73(0x14e)])_0x56bc34['database']=_0x22eec1[_0x4f7e73(0x14e)];if(_0x22eec1[_0x4f7e73(0x1d1)])_0x56bc34['type']=_0x22eec1[_0x4f7e73(0x1d1)];if(_0x22eec1[_0x4f7e73(0x16b)])_0x56bc34[_0x4f7e73(0x16b)]=_0x22eec1[_0x4f7e73(0x16b)];if(_0x22eec1['timezone'])_0x56bc34[_0x4f7e73(0x1d9)]=_0x22eec1[_0x4f7e73(0x1d9)];if(_0x22eec1['delay']!==undefined)_0x56bc34[_0x4f7e73(0x195)]=Number(_0x22eec1[_0x4f7e73(0x195)]);if(_0x22eec1[_0x4f7e73(0x175)]!==undefined)_0x56bc34[_0x4f7e73(0x175)]=Number(_0x22eec1[_0x4f7e73(0x175)]);if(_0x22eec1['retryLimit']!==undefined)_0x56bc34[_0x4f7e73(0x14f)]=Number(_0x22eec1[_0x4f7e73(0x18e)]);if(_0x22eec1[_0x4f7e73(0x183)])_0x56bc34[_0x4f7e73(0x19f)]=_0x22eec1['engineVersion'];if(_0x22eec1[_0x4f7e73(0x150)])_0x56bc34['result']=_0x22eec1[_0x4f7e73(0x150)];if(_0x22eec1[_0x4f7e73(0x1d8)])try{_0x56bc34[_0x4f7e73(0x193)]=readFileSync(_0x22eec1[_0x4f7e73(0x1d8)],_0x4f7e73(0x15c))[_0x4f7e73(0x15d)]();}catch(_0x452940){throw new SDKError(ErrorCode[_0x4f7e73(0x185)],'Failed\x20to\x20read\x20file:\x20'+_0x22eec1[_0x4f7e73(0x1d8)],_0x452940 instanceof Error?_0x452940:undefined);}if(Object[_0x4f7e73(0x1a3)](_0x56bc34)['length']===0x0)throw new SDKError(ErrorCode[_0x4f7e73(0x185)],_0x4f7e73(0x15e));if(_0x3dc25e[_0x4f7e73(0x1a0)]){console[_0x4f7e73(0x14a)](_0x4f7e73(0x154)+_0x1a0ef2);for(const [_0x5e54a0,_0x328d23]of Object[_0x4f7e73(0x162)](_0x56bc34)){_0x5e54a0===_0x4f7e73(0x193)?console[_0x4f7e73(0x14a)]('\x20\x20'+_0x5e54a0+':\x20'+_0x328d23[_0x4f7e73(0x17c)](0x0,0x32)+_0x4f7e73(0x19e)):console['error']('\x20\x20'+_0x5e54a0+':\x20'+_0x328d23);}}const _0x8bbe89=await withSpinner(_0x4f7e73(0x168),()=>_0x3696ea[_0x4f7e73(0x1b9)][_0x4f7e73(0x1d4)](_0x1a0ef2,_0x56bc34),{'verbose':_0x3dc25e['verbose']});return console[_0x4f7e73(0x14a)]('Schedule\x20updated:\x20'+_0x8bbe89[_0x4f7e73(0x157)][_0x4f7e73(0x184)]),await handleSingleObjectOutput(_0x8bbe89['data'],_0x3dc25e),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2362b5(0x184)]=a36_0x2362b5(0x1bd);['description']=a36_0x2362b5(0x186);['validate'](_0xf8b5d0){const _0x4c80fb=a36_0x2362b5,_0x4ffc42=_0xf8b5d0[_0x4c80fb(0x1bf)][0x0];if(!_0x4ffc42)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x52e5ec){const _0x89b841=a36_0x2362b5,{options:_0x3399ae,args:_0x50c52c,tdx:_0x5e87c0}=_0x52e5ec,_0x508e27=_0x50c52c[0x0];if(!_0x3399ae[_0x89b841(0x14b)]){const _0x57895a=await confirm(_0x89b841(0x15b)+_0x508e27+'\x22?');if(!_0x57895a)return console[_0x89b841(0x14a)]('Cancelled'),0x0;}const _0x35a90e=await withSpinner(_0x89b841(0x1cd),()=>_0x5e87c0[_0x89b841(0x1b9)][_0x89b841(0x16d)](_0x508e27),{'verbose':_0x3399ae['verbose']});return console[_0x89b841(0x14a)](_0x89b841(0x18f)+_0x35a90e['data'][_0x89b841(0x184)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x2362b5(0x1db);['description']=a36_0x2362b5(0x1c0);['validate'](_0x189e87){const _0x2edaa8=a36_0x2362b5,_0x4910f0=_0x189e87[_0x2edaa8(0x1bf)][0x0];if(!_0x4910f0)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x2362b5(0x178)](_0x23b4f5){const _0x3d5c51=a36_0x2362b5,{options:_0x16d6b4,args:_0x267bae,tdx:_0x10b076}=_0x23b4f5,_0x1b18c9=_0x267bae[0x0],_0x29f8ba=_0x16d6b4,_0x1781cb=_0x29f8ba['time'],_0x3c27d9=_0x29f8ba['num']!==undefined?Number(_0x29f8ba['num']):undefined;if(_0x16d6b4[_0x3d5c51(0x1a0)]){console[_0x3d5c51(0x14a)](_0x3d5c51(0x1ad)+_0x1b18c9);if(_0x1781cb)console['error']('\x20\x20Time:\x20'+_0x1781cb);if(_0x3c27d9)console['error']('\x20\x20Num:\x20'+_0x3c27d9);}const _0x9f5f8c=await withSpinner(_0x3d5c51(0x1cc),()=>_0x10b076[_0x3d5c51(0x1b9)][_0x3d5c51(0x19d)](_0x1b18c9,{'time':_0x1781cb,'num':_0x3c27d9}),{'verbose':_0x16d6b4[_0x3d5c51(0x1a0)]}),_0x220c8e=_0x9f5f8c[_0x3d5c51(0x157)][_0x3d5c51(0x14d)];console[_0x3d5c51(0x14a)]('Schedule\x20run\x20submitted:\x20'+_0x220c8e[_0x3d5c51(0x172)]+_0x3d5c51(0x1ab)+(_0x220c8e[_0x3d5c51(0x172)]!==0x1?'s':'')+'\x20created');for(const _0x450dee of _0x220c8e){console[_0x3d5c51(0x14a)](_0x3d5c51(0x179)+_0x450dee[_0x3d5c51(0x173)]);}return await handleSDKOutput(_0x220c8e,_0x16d6b4),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2362b5(0x184)]=a36_0x2362b5(0x176);['description']=a36_0x2362b5(0x167);['validate'](_0x16d2a7){const _0x24601e=a36_0x2362b5,_0x1fd20b=_0x16d2a7[_0x24601e(0x1bf)][0x0];if(!_0x1fd20b)return _0x24601e(0x1b4);return undefined;}async[a36_0x2362b5(0x178)](_0x4e500e){const _0x27f914=a36_0x2362b5,{options:_0x26fc04,args:_0x216cb5,tdx:_0x340f00}=_0x4e500e,_0x441cb3=_0x216cb5[0x0],_0x2fe407=_0x26fc04,_0x24bc91=_0x2fe407[_0x27f914(0x1cf)]!==undefined?Number(_0x2fe407[_0x27f914(0x1cf)]):undefined,_0x42e830=_0x2fe407['to']!==undefined?Number(_0x2fe407['to']):undefined,_0x480b53=await withSpinner(_0x27f914(0x1c5),()=>_0x340f00[_0x27f914(0x1b9)]['history'](_0x441cb3,{'from':_0x24bc91,'to':_0x42e830}),{'verbose':_0x26fc04[_0x27f914(0x1a0)]}),_0x31c199=_0x480b53['data'];console[_0x27f914(0x14a)](_0x27f914(0x16e)+_0x31c199[_0x27f914(0x1cb)]+_0x27f914(0x1ac)+(_0x31c199[_0x27f914(0x1cb)]!==0x1?'s':'')+_0x27f914(0x191)+_0x31c199[_0x27f914(0x1cf)]+'-'+_0x31c199['to']+')');const _0x5568d4=_0x31c199['history']['map'](_0x3b8f74=>({'job_id':_0x3b8f74[_0x27f914(0x173)],'type':_0x3b8f74['type'],'status':_0x3b8f74[_0x27f914(0x1c8)],'scheduled_at':_0x3b8f74[_0x27f914(0x171)],'created_at':_0x3b8f74[_0x27f914(0x190)],'start_at':_0x3b8f74[_0x27f914(0x177)],'end_at':_0x3b8f74[_0x27f914(0x14c)]}));return await handleSDKOutput(_0x5568d4,_0x26fc04),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x3584bc=a37_0xc9cf;(function(_0x10d3dd,_0x4bc1f5){const _0x4f5656=a37_0xc9cf,_0x39e3e8=_0x10d3dd();while(!![]){try{const _0x4e9fa3=parseInt(_0x4f5656(0x116))/0x1+-parseInt(_0x4f5656(0xfe))/0x2+-parseInt(_0x4f5656(0x189))/0x3+-parseInt(_0x4f5656(0x157))/0x4*(-parseInt(_0x4f5656(0x11c))/0x5)+-parseInt(_0x4f5656(0x12f))/0x6*(-parseInt(_0x4f5656(0x18e))/0x7)+-parseInt(_0x4f5656(0x14a))/0x8+parseInt(_0x4f5656(0x176))/0x9;if(_0x4e9fa3===_0x4bc1f5)break;else _0x39e3e8['push'](_0x39e3e8['shift']());}catch(_0x231b7f){_0x39e3e8['push'](_0x39e3e8['shift']());}}}(a37_0x7098,0xdb0a6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x7098(){const _0x13b366=['✔\x20Created\x20folder\x20\x27','elapsedTimeMillis','url','Resolving\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','execute','getFolder','\x20\x20Folder\x20path:\x20','parent','jobId','cause','folder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:show','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','toLocaleString','Segment\x20ID:\x20','Resolved:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','red','cyan','segment','16570314fYoCYE','jsonl','Resolving\x20folder\x20\x27','getParent','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','data','resolveFolderId','path','createFolder','Target\x20path:\x20','\x20\x20Cause:\x20','parentSegment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20[Job\x20ID:\x20','folderPath','✖\x20Query\x20failed\x20[','content','Show\x20segment\x20or\x20folder\x20details','2853771ubKOcI','Resolved\x20relative\x20path\x20to:\x20','/app/ps/','Folder\x20ID:\x20','includes','2127300AHYbLO','Fetching\x20SQL\x20for\x20segment...','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','SEGMENT_FOLDER_NOT_FOUND','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','fullPath','Use:\x20tdx\x20ps\x20view','Site:\x20','✔\x20Query\x20completed:\x20Processed\x20','SQL\x20query:\x0a','test','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','log','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','web','parentId','SEGMENT_NOT_FOUND','SELECT\x20*\x20FROM\x20(\x0a','2815784WbGBkj','listFolders','Examples:','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20show','resolveParentId','getSQLFromServerSegment','type','getSegment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','description','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segmentId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','length','Resolved\x20type:\x20','segment:view','Resolved\x20YAML\x20file:\x20','\x20\x20Segment\x20name:\x20','replace','Parent\x20segment:\x20','getSegmentSQLFromYaml','segment:folder:show','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','792516jCEeoC','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folder\x20name:\x20','trim','/e/','856355OimIlB','resolvePathToResource','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20folder\x20ID:\x20','limit','message','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','format','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Create\x20segment\x20folder\x20for\x20organization','Show\x20segment\x20folder\x20details','in\x20','Fetching\x20segment\x20details...','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','getSQLFromYamlFile','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','6UHQXnX','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20ID:\x20','Resolving\x20parent\x20folder\x20\x27','\x20\x20Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Creating\x20folder\x20\x27','error','\x27...','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','parentFolder','Resolving\x20parent\x20segment\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolving\x20path\x20\x27','Fetching\x20folder\x20details...','segmentName','site','Error:\x20','segment:describe','name','folderId','8411128WkOmHf','verbose','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20folder','INVALID_ARGUMENT','stats','segment:folder:create','\x20\x20tdx\x20sg\x20sql\x20--path\x20','green','json','getSegmentSQL','Executing\x20segment\x20query...','32mVzXNe','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment'];a37_0x7098=function(){return _0x13b366;};return a37_0x7098();}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 a37_0xc9cf(_0x5617d3,_0x1821dd){_0x5617d3=_0x5617d3-0xfb;const _0x7098b6=a37_0x7098();let _0xc9cf35=_0x7098b6[_0x5617d3];return _0xc9cf35;}import{openBrowser}from'../utils/process.js';import a37_0x349ff1 from'chalk';async function resolveSegmentTarget(_0x322450,_0x3f2101,_0x4f37f6){const _0xecdae2=a37_0xc9cf;if(isYamlFilePath(_0x322450))try{const _0x3bbec5=await resolveYamlFilePath(_0x322450);return _0x4f37f6&&(console[_0xecdae2(0x139)](_0xecdae2(0x10f)+_0x322450),console[_0xecdae2(0x139)](_0xecdae2(0x136)+_0x3bbec5[_0xecdae2(0x182)]),console[_0xecdae2(0x139)](_0xecdae2(0x110)+_0x3bbec5[_0xecdae2(0x144)]),console['error'](_0xecdae2(0x162)+(_0x3bbec5[_0xecdae2(0x185)]||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x3bbec5['fullPath'])),_0x3bbec5[_0xecdae2(0x193)];}catch(_0x3268ab){throw new SDKError(ErrorCode[_0xecdae2(0x14f)],_0xecdae2(0x109)+_0x3268ab[_0xecdae2(0x122)]);}if(!_0x3f2101)throw new SDKError(ErrorCode[_0xecdae2(0x14f)],_0xecdae2(0x107));return _0x3f2101+'/'+_0x322450;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x147);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x188);async['execute'](_0x340920){const _0x51dadf=a37_0x3584bc,{options:_0x5a3780,args:_0xab5117,tdx:_0x3a989c}=_0x340920,_0x849fc2=_0xab5117[0x0],_0x68a27a=!_0x849fc2&&!!_0x5a3780[_0x51dadf(0x182)],_0x2a70e8=_0x849fc2||_0x5a3780['parentSegment'];if(!_0x2a70e8)return console[_0x51dadf(0x139)](_0x51dadf(0x132)),console[_0x51dadf(0x139)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x51dadf(0x139)](_0x51dadf(0x100)),console[_0x51dadf(0x139)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x51dadf(0x139)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x51dadf(0x139)](_0x51dadf(0x131)),console[_0x51dadf(0x139)](_0x51dadf(0x167)),0x1;try{const _0xb04592=_0x5a3780['segmentPath'];let _0x3a1ea6=_0x2a70e8;!_0x68a27a&&_0xb04592&&!_0x2a70e8[_0x51dadf(0x18d)]('/')&&(_0x3a1ea6=_0xb04592+'/'+_0x2a70e8,_0x5a3780[_0x51dadf(0x14b)]&&console[_0x51dadf(0x139)](_0x51dadf(0x18a)+_0x3a1ea6));const _0x2e4772=await withSpinner(_0x51dadf(0x142)+_0x3a1ea6+_0x51dadf(0x13a),()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x11d)](_0x3a1ea6),{'verbose':_0x5a3780[_0x51dadf(0x14b)]}),_0x57eaa4=_0x2e4772[_0x51dadf(0x17c)];_0x5a3780[_0x51dadf(0x14b)]&&(console[_0x51dadf(0x139)](_0x51dadf(0x10d)+_0x57eaa4[_0x51dadf(0x105)]),console[_0x51dadf(0x139)](_0x51dadf(0x134)+_0x57eaa4[_0x51dadf(0xfb)]),_0x57eaa4[_0x51dadf(0x149)]&&console[_0x51dadf(0x139)](_0x51dadf(0x18c)+_0x57eaa4[_0x51dadf(0x149)]),_0x57eaa4[_0x51dadf(0x10a)]&&console[_0x51dadf(0x139)](_0x51dadf(0x170)+_0x57eaa4[_0x51dadf(0x10a)]));if(_0x57eaa4[_0x51dadf(0x105)]===_0x51dadf(0x163)){const _0x543cab=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x179)](_0x57eaa4[_0x51dadf(0xfb)]),{'verbose':_0x5a3780['verbose']});await handleSingleObjectOutput(_0x543cab[_0x51dadf(0x17c)],_0x5a3780);}else{if(_0x57eaa4[_0x51dadf(0x105)]==='folder'){if(!_0x57eaa4['folderId'])throw new SDKError(ErrorCode[_0x51dadf(0x191)],_0x51dadf(0x19b));const _0x2f10d1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x161)](_0x57eaa4[_0x51dadf(0x149)]),{'verbose':_0x5a3780['verbose']});await handleSingleObjectOutput(_0x2f10d1[_0x51dadf(0x17c)],_0x5a3780);}else{if(_0x57eaa4[_0x51dadf(0x105)]===_0x51dadf(0x175)){if(!_0x57eaa4['segmentId'])throw new SDKError(ErrorCode[_0x51dadf(0xfc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c546e=await withSpinner(_0x51dadf(0x129),()=>_0x3a989c[_0x51dadf(0x175)]['getSegment'](_0x57eaa4['parentId'],_0x57eaa4[_0x51dadf(0x10a)]),{'verbose':_0x5a3780[_0x51dadf(0x14b)]});await handleSingleObjectOutput(_0x5c546e[_0x51dadf(0x17c)],_0x5a3780);}}}return 0x0;}catch(_0x372d4f){if(_0x372d4f instanceof SDKError)return console[_0x51dadf(0x139)](_0x51dadf(0x146)+_0x372d4f['message']),_0x372d4f[_0x51dadf(0x165)]&&console[_0x51dadf(0x139)](_0x51dadf(0x181)+_0x372d4f[_0x51dadf(0x165)]),0x1;throw _0x372d4f;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x169);[a37_0x3584bc(0x108)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x3584bc(0x160)](_0x49a443){const _0x2f88ef=a37_0x3584bc,{options:_0x363605,args:_0x31d559,tdx:_0x4ace64}=_0x49a443,_0x3b3d15=_0x31d559[0x0];if(!_0x3b3d15)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2f88ef(0x139)](_0x2f88ef(0x130)),console[_0x2f88ef(0x139)](_0x2f88ef(0x15f)),console[_0x2f88ef(0x139)](_0x2f88ef(0x100)),console[_0x2f88ef(0x139)](_0x2f88ef(0x123)),console[_0x2f88ef(0x139)](_0x2f88ef(0x11e)),0x1;try{const _0x20b9a3=_0x363605[_0x2f88ef(0x182)],_0x5a2565=await resolveSegmentTarget(_0x3b3d15,_0x20b9a3,_0x363605[_0x2f88ef(0x14b)]);_0x363605[_0x2f88ef(0x14b)]&&console[_0x2f88ef(0x139)]('Target\x20path:\x20'+_0x5a2565);const _0x29a2f9=await withSpinner('Resolving\x20\x27'+_0x3b3d15+_0x2f88ef(0x13a),()=>_0x4ace64['segment'][_0x2f88ef(0x11d)](_0x5a2565),{'verbose':_0x363605[_0x2f88ef(0x14b)]}),_0xdbf8fc=_0x29a2f9[_0x2f88ef(0x17c)];_0x363605[_0x2f88ef(0x14b)]&&(console[_0x2f88ef(0x139)](_0x2f88ef(0x10d)+_0xdbf8fc[_0x2f88ef(0x105)]),console[_0x2f88ef(0x139)](_0x2f88ef(0x134)+_0xdbf8fc[_0x2f88ef(0xfb)]));if(_0xdbf8fc[_0x2f88ef(0x105)]===_0x2f88ef(0x166))return console[_0x2f88ef(0x139)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x2f88ef(0x139)](_0x2f88ef(0x183)),0x1;if(_0xdbf8fc[_0x2f88ef(0x105)]===_0x2f88ef(0x163))return console[_0x2f88ef(0x139)](_0x2f88ef(0x12e)),console['error'](_0x2f88ef(0x102)),0x1;if(!_0xdbf8fc[_0x2f88ef(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2f88ef(0x16e));const _0x280d0f=await withSpinner(_0x2f88ef(0x18f),()=>_0x4ace64['segment'][_0x2f88ef(0x155)](_0xdbf8fc['parentId'],_0xdbf8fc[_0x2f88ef(0x10a)]),{'verbose':_0x363605['verbose']});let _0x7b3421=_0x280d0f['data'];const _0x226e5f=resolveLimit(_0x363605[_0x2f88ef(0x121)],DEFAULT_DISPLAY_LIMIT),_0xef1546=/\bLIMIT\s+\d+/i[_0x2f88ef(0x198)](_0x7b3421);!_0xef1546&&(_0x7b3421=_0x7b3421[_0x2f88ef(0x11a)]()[_0x2f88ef(0x111)](/;+$/,''),_0x7b3421=_0x2f88ef(0xfd)+_0x7b3421+_0x2f88ef(0x15d)+_0x226e5f);_0x363605[_0x2f88ef(0x14b)]&&console[_0x2f88ef(0x139)](_0x2f88ef(0x197)+_0x7b3421);const _0x383a18=await withProgressSpinner(_0x2f88ef(0x156),async _0x4f647a=>{const _0x23c6b6=_0x2f88ef,_0x2eecc6=await _0x4ace64['query'][_0x23c6b6(0x160)](_0x7b3421,{'catalog':'td','schema':'information_schema','onJobId':_0x3b71cf=>{_0x4f647a['setJobId'](_0x3b71cf);}});return _0x2eecc6;},{'verbose':_0x363605[_0x2f88ef(0x14b)]}),_0x7bce28=_0x383a18[_0x2f88ef(0x17c)],_0x3db709=_0x7bce28[_0x2f88ef(0x164)]?_0x2f88ef(0x184)+_0x7bce28[_0x2f88ef(0x164)]+']':'';return console[_0x2f88ef(0x139)](_0x2f88ef(0x196)+_0x7bce28[_0x2f88ef(0x150)]['processedRows'][_0x2f88ef(0x16f)]()+'\x20rows\x20'+(_0x2f88ef(0x128)+formatElapsed(_0x7bce28[_0x2f88ef(0x150)][_0x2f88ef(0x15a)])+_0x3db709)),await handleQueryOutput(_0x7bce28,_0x363605),0x0;}catch(_0x3de825){if(_0x3de825 instanceof SDKError)return console[_0x2f88ef(0x139)](_0x2f88ef(0x186)+_0x3de825['code']+']'),console[_0x2f88ef(0x139)]('\x0a'+_0x3de825['message']),0x1;throw _0x3de825;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x3584bc(0x148)]='segment:folder:list';['description']=a37_0x3584bc(0x158);async[a37_0x3584bc(0x160)](_0x29889d){const _0x18cd2a=a37_0x3584bc,{options:_0x3e58a2,args:_0x16299b,tdx:_0x4a33c8}=_0x29889d;if(_0x16299b['length']===0x0)return console['error'](_0x18cd2a(0x141)),console[_0x18cd2a(0x139)](_0x18cd2a(0x168)),0x1;const _0xe8e0d0=_0x16299b[0x0];try{_0x3e58a2[_0x18cd2a(0x14b)]&&(console[_0x18cd2a(0x139)](_0x18cd2a(0x195)+_0x3e58a2[_0x18cd2a(0x145)]),console[_0x18cd2a(0x139)](_0x18cd2a(0x16a)+_0xe8e0d0));const _0x40f47d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xe8e0d0+_0x18cd2a(0x13a),()=>_0x4a33c8['segment'][_0x18cd2a(0x103)](_0xe8e0d0),{'verbose':_0x3e58a2[_0x18cd2a(0x14b)]}),_0x4d78ca=_0x40f47d[_0x18cd2a(0x17c)];_0x3e58a2['verbose']&&console[_0x18cd2a(0x139)](_0x18cd2a(0x101)+_0x4d78ca);const _0x408087=await withSpinner(_0x18cd2a(0x14c)+_0xe8e0d0+'\x27...',()=>_0x4a33c8[_0x18cd2a(0x175)][_0x18cd2a(0xff)](_0x4d78ca),{'verbose':_0x3e58a2[_0x18cd2a(0x14b)]}),_0x1da1a2=_0x408087[_0x18cd2a(0x17c)];return console['error']('✔\x20Found\x20'+_0x1da1a2[_0x18cd2a(0x10c)]+_0x18cd2a(0x14e)+(_0x1da1a2['length']!==0x1?'s':'')),await handleSDKOutput(_0x1da1a2,_0x3e58a2),0x0;}catch(_0xfb4088){if(_0xfb4088 instanceof SDKError)return console['error'](_0x18cd2a(0x146)+_0xfb4088[_0x18cd2a(0x122)]),_0xfb4088[_0x18cd2a(0x165)]&&console['error'](_0x18cd2a(0x181)+_0xfb4088[_0x18cd2a(0x165)]),0x1;throw _0xfb4088;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x114);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x127);async['execute'](_0x3c7a50){const _0x280ec6=a37_0x3584bc,{options:_0x44e30f,args:_0x476dba,tdx:_0xf312da}=_0x3c7a50;if(_0x476dba[_0x280ec6(0x10c)]===0x0)return console['error'](_0x280ec6(0x12a)),console[_0x280ec6(0x139)](_0x280ec6(0x172)),0x1;try{const {parentId:_0x3400d1,childId:_0x20c501}=parseSegmentRef(_0x476dba[0x0]);_0x44e30f[_0x280ec6(0x14b)]&&(console[_0x280ec6(0x139)](_0x280ec6(0x195)+_0x44e30f[_0x280ec6(0x145)]),console['error'](_0x280ec6(0x16a)+_0x3400d1),_0x20c501&&console[_0x280ec6(0x139)](_0x280ec6(0x119)+_0x20c501));if(!_0x20c501)return console['error'](_0x280ec6(0x190)),0x1;const _0x197b19=await withSpinner(_0x280ec6(0x140)+_0x3400d1+_0x280ec6(0x13a),()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x103)](_0x3400d1),{'verbose':_0x44e30f[_0x280ec6(0x14b)]}),_0x3407a3=_0x197b19['data'];_0x44e30f[_0x280ec6(0x14b)]&&console[_0x280ec6(0x139)](_0x280ec6(0x101)+_0x3407a3);const _0x3c9c1f=await withSpinner(_0x280ec6(0x178)+_0x20c501+'\x27...',()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x17d)](_0x3407a3,_0x20c501),{'verbose':_0x44e30f[_0x280ec6(0x14b)]}),_0x4a1082=_0x3c9c1f[_0x280ec6(0x17c)];_0x44e30f[_0x280ec6(0x14b)]&&console[_0x280ec6(0x139)](_0x280ec6(0x120)+_0x4a1082);const _0x9cdbcb=await withSpinner('Fetching\x20folder\x20\x27'+_0x20c501+_0x280ec6(0x13a),()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x161)](_0x4a1082),{'verbose':_0x44e30f['verbose']});return await handleSDKOutput([_0x9cdbcb[_0x280ec6(0x17c)]],_0x44e30f),0x0;}catch(_0x18de4c){if(_0x18de4c instanceof SDKError)return console[_0x280ec6(0x139)](_0x280ec6(0x146)+_0x18de4c[_0x280ec6(0x122)]),_0x18de4c[_0x280ec6(0x165)]&&console[_0x280ec6(0x139)](_0x280ec6(0x181)+_0x18de4c[_0x280ec6(0x165)]),0x1;throw _0x18de4c;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';[a37_0x3584bc(0x108)]=a37_0x3584bc(0x117);async[a37_0x3584bc(0x160)](_0x54e2ad){const _0x373767=a37_0x3584bc,{options:_0x182ce7,args:_0x556a9e}=_0x54e2ad,_0x1276ce=_0x182ce7,_0x7e3cf7=_0x1276ce[_0x373767(0x17e)],_0x21163a=_0x556a9e[0x0];if(!_0x21163a&&!_0x7e3cf7)return console[_0x373767(0x139)](a37_0x349ff1[_0x373767(0x173)](_0x373767(0x125))),console[_0x373767(0x139)]('Usage:'),console[_0x373767(0x139)](_0x373767(0x192)),console[_0x373767(0x139)](_0x373767(0x17b)),console['error'](_0x373767(0x100)),console[_0x373767(0x139)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x373767(0x139)](_0x373767(0x115)),0x1;if(_0x21163a&&_0x7e3cf7)return console[_0x373767(0x139)](a37_0x349ff1[_0x373767(0x173)](_0x373767(0x133))),0x1;try{let _0x17e4af;if(_0x7e3cf7)_0x17e4af=await this[_0x373767(0x12d)](_0x7e3cf7,_0x54e2ad);else{if(isYamlFilePath(_0x21163a))return console['error'](a37_0x349ff1['red'](_0x373767(0x13c))),console[_0x373767(0x139)](_0x373767(0x152)+_0x21163a),0x1;else _0x17e4af=await this['getSQLFromServerSegment'](_0x21163a,_0x54e2ad);}return _0x182ce7[_0x373767(0x124)]===_0x373767(0x154)||_0x182ce7[_0x373767(0x124)]===_0x373767(0x177)?await handleSDKOutput([{'sql':_0x17e4af}],_0x182ce7):console[_0x373767(0x19a)](_0x17e4af),0x0;}catch(_0x3b64d3){if(_0x3b64d3 instanceof SDKError)return console['error'](_0x373767(0x146)+_0x3b64d3[_0x373767(0x122)]),_0x3b64d3['cause']&&console['error'](_0x373767(0x181)+_0x3b64d3[_0x373767(0x165)]),0x1;throw _0x3b64d3;}}async[a37_0x3584bc(0x12d)](_0x39a082,_0x19b10d){const _0x5a0bbe=a37_0x3584bc,{options:_0xe326d5,tdx:_0x28b6bb}=_0x19b10d;let _0x18ca8c;try{_0x18ca8c=await resolveYamlFilePath(_0x39a082);}catch(_0x5b6064){throw new SDKError(ErrorCode[_0x5a0bbe(0x14f)],_0x5a0bbe(0x109)+_0x5b6064['message']);}_0xe326d5[_0x5a0bbe(0x14b)]&&console['error'](_0x5a0bbe(0x171)+_0x18ca8c['parentSegment']+'/'+_0x18ca8c[_0x5a0bbe(0x144)]);const _0x31aa71=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x28b6bb['segment'][_0x5a0bbe(0x113)](_0x18ca8c[_0x5a0bbe(0x187)],_0x18ca8c['parentSegment'],_0x18ca8c[_0x5a0bbe(0x144)]),{'verbose':_0xe326d5[_0x5a0bbe(0x14b)]});return _0x31aa71[_0x5a0bbe(0x17c)];}async[a37_0x3584bc(0x104)](_0x5f0086,_0x2b5095){const _0x5c6914=a37_0x3584bc,{options:_0x2e5383,tdx:_0x1a898c}=_0x2b5095,_0x5222b0=_0x2e5383[_0x5c6914(0x182)],_0xcda637=await resolveSegmentTarget(_0x5f0086,_0x5222b0,_0x2e5383[_0x5c6914(0x14b)]);_0x2e5383[_0x5c6914(0x14b)]&&console[_0x5c6914(0x139)](_0x5c6914(0x180)+_0xcda637);const _0x396d9c=await withSpinner(_0x5c6914(0x15c)+_0x5f0086+_0x5c6914(0x13a),()=>_0x1a898c[_0x5c6914(0x175)][_0x5c6914(0x11d)](_0xcda637),{'verbose':_0x2e5383[_0x5c6914(0x14b)]}),_0x14c7ca=_0x396d9c[_0x5c6914(0x17c)];_0x2e5383[_0x5c6914(0x14b)]&&(console[_0x5c6914(0x139)]('Resolved\x20type:\x20'+_0x14c7ca['type']),console[_0x5c6914(0x139)](_0x5c6914(0x134)+_0x14c7ca[_0x5c6914(0xfb)]));if(_0x14c7ca[_0x5c6914(0x105)]===_0x5c6914(0x166))throw new SDKError(ErrorCode[_0x5c6914(0x14f)],_0x5c6914(0x13d));if(_0x14c7ca[_0x5c6914(0x105)]===_0x5c6914(0x163))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5c6914(0x13e));if(!_0x14c7ca[_0x5c6914(0x10a)])throw new SDKError(ErrorCode[_0x5c6914(0xfc)],_0x5c6914(0x16e));const _0x3c6c4c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1a898c[_0x5c6914(0x175)]['getSegmentSQL'](_0x14c7ca[_0x5c6914(0xfb)],_0x14c7ca['segmentId']),{'verbose':_0x2e5383[_0x5c6914(0x14b)]});return _0x3c6c4c[_0x5c6914(0x17c)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a37_0x3584bc(0x151);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x126);async['execute'](_0x2cb4e5){const _0x34af0d=a37_0x3584bc,{options:_0x540dc2,args:_0x4c08a5,tdx:_0x3c99c9}=_0x2cb4e5,_0x1802c4=_0x540dc2;if(_0x4c08a5[_0x34af0d(0x10c)]<0x2)return console[_0x34af0d(0x139)](_0x34af0d(0x137)),console[_0x34af0d(0x139)](_0x34af0d(0x10b)),0x1;const _0x14cdcc=_0x4c08a5[0x0],_0x46e5b3=_0x4c08a5[0x1];_0x1802c4[_0x34af0d(0x14b)]&&(console[_0x34af0d(0x139)](_0x34af0d(0x195)+_0x1802c4[_0x34af0d(0x145)]),console[_0x34af0d(0x139)](_0x34af0d(0x112)+_0x14cdcc),console[_0x34af0d(0x139)](_0x34af0d(0x119)+_0x46e5b3));let _0x33fee9;if(_0x1802c4['parentFolder']){const _0x55098f=_0x1802c4[_0x34af0d(0x13f)],_0x13deac=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x14cdcc+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)]['resolveParentId'](_0x14cdcc),{'verbose':_0x1802c4[_0x34af0d(0x14b)]}),_0x18d341=_0x13deac[_0x34af0d(0x17c)],_0xf4a253=await withSpinner(_0x34af0d(0x135)+_0x55098f+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)][_0x34af0d(0x17d)](_0x18d341,_0x55098f),{'verbose':_0x1802c4[_0x34af0d(0x14b)]});_0x33fee9=_0xf4a253[_0x34af0d(0x17c)],_0x1802c4['verbose']&&console['error'](_0x34af0d(0x13b)+_0x33fee9);}const _0x495253={'name':_0x46e5b3,'description':_0x1802c4[_0x34af0d(0x108)],'parentFolderId':_0x33fee9},_0x189b97=await withSpinner(_0x34af0d(0x138)+_0x46e5b3+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)][_0x34af0d(0x17f)](_0x14cdcc,_0x495253),{'verbose':_0x1802c4[_0x34af0d(0x14b)]}),_0x1648ab=_0x189b97[_0x34af0d(0x17c)];return console['error'](_0x34af0d(0x159)+_0x1648ab['name']+'\x27\x20with\x20ID:\x20'+_0x1648ab['id']),await handleSDKOutput([_0x1648ab],_0x1802c4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x10e);[a37_0x3584bc(0x108)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x3584bc(0x160)](_0xf61763){const _0xcebfd3=a37_0x3584bc,{options:_0x590960,args:_0x53f32d,tdx:_0x26c698}=_0xf61763,_0x123405=_0x53f32d[0x0];if(!_0x123405)return console[_0xcebfd3(0x139)](_0xcebfd3(0x19d)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0xcebfd3(0x139)](_0xcebfd3(0x16d)),console[_0xcebfd3(0x139)]('Options:'),console['error'](_0xcebfd3(0x14d)),console[_0xcebfd3(0x139)](_0xcebfd3(0x100)),console[_0xcebfd3(0x139)](_0xcebfd3(0x12c)),console['error'](_0xcebfd3(0x16b)),console[_0xcebfd3(0x139)](_0xcebfd3(0x16c)),console[_0xcebfd3(0x139)](_0xcebfd3(0x11f)),0x1;try{const _0xeb153=_0x590960[_0xcebfd3(0x182)],_0x466549=await resolveSegmentTarget(_0x123405,_0xeb153,_0x590960[_0xcebfd3(0x14b)]);_0x590960['verbose']&&console['error']('Target\x20path:\x20'+_0x466549);const _0x42e000=await withSpinner(_0xcebfd3(0x15c)+_0x123405+_0xcebfd3(0x13a),()=>_0x26c698[_0xcebfd3(0x175)][_0xcebfd3(0x11d)](_0x466549),{'verbose':_0x590960[_0xcebfd3(0x14b)]}),_0x4ecace=_0x42e000['data'];_0x590960[_0xcebfd3(0x14b)]&&(console['error'](_0xcebfd3(0x10d)+_0x4ecace[_0xcebfd3(0x105)]),console[_0xcebfd3(0x139)](_0xcebfd3(0x134)+_0x4ecace[_0xcebfd3(0xfb)]),_0x4ecace['folderId']&&console[_0xcebfd3(0x139)](_0xcebfd3(0x18c)+_0x4ecace[_0xcebfd3(0x149)]),_0x4ecace[_0xcebfd3(0x10a)]&&console[_0xcebfd3(0x139)]('Segment\x20ID:\x20'+_0x4ecace[_0xcebfd3(0x10a)]));if(_0x590960[_0xcebfd3(0x19e)]){if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x166))return console[_0xcebfd3(0x139)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x4ecace['type']===_0xcebfd3(0x163))return console['error']('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x4ecace[_0xcebfd3(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xcebfd3(0x16e));const _0x4ff689=getConsoleNextUrl(_0x590960[_0xcebfd3(0x145)],_0xcebfd3(0x18b)+_0x4ecace[_0xcebfd3(0xfb)]+'/e/'+_0x4ecace['segmentId']);return console[_0xcebfd3(0x139)](a37_0x349ff1[_0xcebfd3(0x153)]('✔')+'\x20Opening\x20'+a37_0x349ff1[_0xcebfd3(0x174)](_0x4ff689)),openBrowser(_0x4ff689),0x0;}if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x166)){if(!_0x4ecace[_0xcebfd3(0x149)])throw new SDKError(ErrorCode[_0xcebfd3(0x191)],_0xcebfd3(0x19b));const _0x129f1d=await withSpinner(_0xcebfd3(0x143),()=>_0x26c698[_0xcebfd3(0x175)]['getFolder'](_0x4ecace['folderId']),{'verbose':_0x590960[_0xcebfd3(0x14b)]});await handleSingleObjectOutput(_0x129f1d[_0xcebfd3(0x17c)],_0x590960);}else{if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x175)){if(!_0x4ecace[_0xcebfd3(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xcebfd3(0x16e));const _0x581f30=await withSpinner(_0xcebfd3(0x129),()=>_0x26c698['segment'][_0xcebfd3(0x106)](_0x4ecace[_0xcebfd3(0xfb)],_0x4ecace[_0xcebfd3(0x10a)]),{'verbose':_0x590960[_0xcebfd3(0x14b)]}),_0x2733ec=getConsoleNextUrl(_0x590960[_0xcebfd3(0x145)],'/app/ps/'+_0x4ecace[_0xcebfd3(0xfb)]+_0xcebfd3(0x11b)+_0x4ecace[_0xcebfd3(0x10a)]),_0x55ef66=_0x581f30[_0xcebfd3(0x17c)];_0x55ef66[_0xcebfd3(0x15b)]=_0x2733ec,await handleSingleObjectOutput(_0x55ef66,_0x590960);}else return console[_0xcebfd3(0x139)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0xcebfd3(0x139)](_0xcebfd3(0x194)),0x1;}return 0x0;}catch(_0x3ee25b){if(_0x3ee25b instanceof SDKError)return console[_0xcebfd3(0x139)](_0xcebfd3(0x146)+_0x3ee25b[_0xcebfd3(0x122)]),_0x3ee25b[_0xcebfd3(0x165)]&&console[_0xcebfd3(0x139)](_0xcebfd3(0x181)+_0x3ee25b[_0xcebfd3(0x165)]),0x1;throw _0x3ee25b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x3584bc(0x148)]='segment:desc';[a37_0x3584bc(0x108)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x56fd2d){const _0x56a57b=a37_0x3584bc,{options:_0x5eec3e,args:_0x18760d,tdx:_0x4dc710}=_0x56fd2d,_0x125080=_0x18760d[0x0];if(!_0x125080)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x56a57b(0x139)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x56a57b(0x139)](_0x56a57b(0x199)),console[_0x56a57b(0x139)](_0x56a57b(0x100)),console['error'](_0x56a57b(0x12b)),console[_0x56a57b(0x139)](_0x56a57b(0x15e)),0x1;try{const _0x1f0112=_0x5eec3e['parentSegment'],_0x52bfe8=await resolveSegmentTarget(_0x125080,_0x1f0112,_0x5eec3e[_0x56a57b(0x14b)]);_0x5eec3e['verbose']&&console[_0x56a57b(0x139)](_0x56a57b(0x180)+_0x52bfe8);const _0x23cd53=await withSpinner(_0x56a57b(0x15c)+_0x125080+_0x56a57b(0x13a),()=>_0x4dc710[_0x56a57b(0x175)][_0x56a57b(0x11d)](_0x52bfe8),{'verbose':_0x5eec3e[_0x56a57b(0x14b)]}),_0x58a030=_0x23cd53[_0x56a57b(0x17c)];_0x5eec3e[_0x56a57b(0x14b)]&&(console['error']('Resolved\x20type:\x20'+_0x58a030[_0x56a57b(0x105)]),console[_0x56a57b(0x139)]('Parent\x20ID:\x20'+_0x58a030[_0x56a57b(0xfb)]));if(_0x58a030[_0x56a57b(0x105)]===_0x56a57b(0x166))return console[_0x56a57b(0x139)](_0x56a57b(0x118)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x58a030[_0x56a57b(0x105)]===_0x56a57b(0x163))return console['error'](_0x56a57b(0x17a)),console[_0x56a57b(0x139)](_0x56a57b(0x19c)),0x1;if(!_0x58a030['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56a57b(0x16e));const _0x5da231=await withSpinner(_0x56a57b(0x18f),()=>_0x4dc710['segment'][_0x56a57b(0x155)](_0x58a030[_0x56a57b(0xfb)],_0x58a030[_0x56a57b(0x10a)]),{'verbose':_0x5eec3e[_0x56a57b(0x14b)]}),_0xf51f13=_0x5da231[_0x56a57b(0x17c)],_0x421858=await executeSchemaQuery(_0xf51f13,_0x4dc710,_0x5eec3e);return await handleQueryOutput(_0x421858,_0x5eec3e),0x0;}catch(_0x3ace9f){if(_0x3ace9f instanceof SDKError)return console[_0x56a57b(0x139)](_0x56a57b(0x146)+_0x3ace9f[_0x56a57b(0x122)]),_0x3ace9f[_0x56a57b(0x165)]&&console[_0x56a57b(0x139)](_0x56a57b(0x181)+_0x3ace9f[_0x56a57b(0x165)]),0x1;throw _0x3ace9f;}}}
|
|
1
|
+
const a37_0x3c1f2e=a37_0x3df6;(function(_0x4e27ea,_0x4c0aa0){const _0x86adb7=a37_0x3df6,_0x50a327=_0x4e27ea();while(!![]){try{const _0x4bd3a3=parseInt(_0x86adb7(0x121))/0x1*(parseInt(_0x86adb7(0x14b))/0x2)+-parseInt(_0x86adb7(0x136))/0x3*(parseInt(_0x86adb7(0x13e))/0x4)+-parseInt(_0x86adb7(0x101))/0x5+-parseInt(_0x86adb7(0x13d))/0x6+-parseInt(_0x86adb7(0xec))/0x7*(-parseInt(_0x86adb7(0x134))/0x8)+-parseInt(_0x86adb7(0xdf))/0x9+parseInt(_0x86adb7(0xc8))/0xa;if(_0x4bd3a3===_0x4c0aa0)break;else _0x50a327['push'](_0x50a327['shift']());}catch(_0x933a9e){_0x50a327['push'](_0x50a327['shift']());}}}(a37_0x5d8e,0xcfb0c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x41467b from'chalk';function a37_0x5d8e(){const _0xcf28e9=['Parent\x20ID:\x20','5483760gTFHgs','471928TUQtXn','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Parent\x20segment:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','folder','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20rows\x20','Folder\x20ID:\x20','/e/','Options:','Site:\x20','INVALID_ARGUMENT','2hDpxiB','Resolved\x20folder\x20ID:\x20','fullPath','Show\x20child\x20segment\x20schema\x20(column\x20types)','Folder\x20ID\x20missing\x20from\x20resolved\x20path','parentFolder','parentSegment','Fetching\x20folder\x20\x27','Target\x20path:\x20','getSegmentSQL','stats','\x20folder','✖\x20Query\x20failed\x20[','Executing\x20segment\x20query...','verbose','url','Resolving\x20folder\x20\x27','\x20[Job\x20ID:\x20','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:sql','createFolder','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20Folder\x20path:\x20','setJobId','web','SEGMENT_FOLDER_NOT_FOUND','toLocaleString','Resolved\x20parent\x20ID:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolving\x20parent\x20folder\x20\x27','description','cyan','Resolving\x20\x27','segment:folder:list','Usage:\x20tdx\x20sg\x20show\x20<name>','Fetching\x20segment\x20details...','code','Error:\x20Parent\x20segment\x20name\x20is\x20required','message','32934910obIcMv','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','in\x20','getFolder','Segment\x20ID:\x20','\x27\x20with\x20ID:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','error','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','✔\x20Query\x20completed:\x20Processed\x20','Show\x20segment\x20or\x20folder\x20details','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentId','segmentName','Examples:','✔\x20Found\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','8008641IjouUo','segment','Parent\x20segment:\x20','segment:show','content','length','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:desc','\x20Opening\x20','execute','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segment:folder:show','getSegment','7sBsWIb','\x20\x20Segment\x20name:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20view\x20-w','resolvePathToResource','type','Resolving\x20path\x20\x27','query','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Usage:\x20tdx\x20sg\x20desc\x20<name>','folderId','site','getSQLFromServerSegment','Fetching\x20SQL\x20from\x20rule...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','name','Fetching\x20parent\x20segment\x20details...','Usage:','Fetching\x20SQL\x20for\x20segment...','green','test','4910260QqWJnK','SELECT\x20*\x20FROM\x20(\x0a','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','SEGMENT_NOT_FOUND','/app/ps/','replace','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','format','trim','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x27...','segment:folder:create','(root)','information_schema','Error:\x20','getSegmentSQLFromYaml','cause','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Folder\x20name:\x20','log','data','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','✔\x20Created\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','jobId','segment:describe','529687BiHyEA','includes','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Resolving\x20parent\x20segment\x20\x27','listFolders','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','SQL\x20query:\x0a','resolveFolderId','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20Cause:\x20','resolveParentId','segmentId','red','path','parent','Create\x20segment\x20folder\x20for\x20organization','\x20\x20Full\x20path:\x20','processedRows','segmentPath','394776XWjujm','Parent\x20name:\x20','6MEwJgn','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Creating\x20folder\x20\x27','jsonl','folderPath','limit'];a37_0x5d8e=function(){return _0xcf28e9;};return a37_0x5d8e();}async function resolveSegmentTarget(_0x560070,_0x301261,_0x176809){const _0x22ae74=a37_0x3df6;if(isYamlFilePath(_0x560070))try{const _0x3f9815=await resolveYamlFilePath(_0x560070);return _0x176809&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x560070),console[_0x22ae74(0xd1)](_0x22ae74(0x140)+_0x3f9815[_0x22ae74(0xa4)]),console[_0x22ae74(0xd1)](_0x22ae74(0xed)+_0x3f9815[_0x22ae74(0xda)]),console[_0x22ae74(0xd1)](_0x22ae74(0xb6)+(_0x3f9815[_0x22ae74(0x13a)]||_0x22ae74(0x10e))),console[_0x22ae74(0xd1)](_0x22ae74(0x131)+_0x3f9815[_0x22ae74(0x14d)])),_0x3f9815[_0x22ae74(0x14d)];}catch(_0x3b5010){throw new SDKError(ErrorCode[_0x22ae74(0x14a)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3b5010[_0x22ae74(0xc7)]);}if(!_0x301261)throw new SDKError(ErrorCode[_0x22ae74(0x14a)],_0x22ae74(0x144));return _0x301261+'/'+_0x560070;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]=a37_0x3c1f2e(0x120);['description']=a37_0x3c1f2e(0xd4);async[a37_0x3c1f2e(0xe8)](_0x50ccc4){const _0x54f8d8=a37_0x3c1f2e,{options:_0x57d39,args:_0x4e2ea4,tdx:_0x24ce48}=_0x50ccc4,_0x25edec=_0x4e2ea4[0x0],_0x1030dc=!_0x25edec&&!!_0x57d39[_0x54f8d8(0xa4)],_0x822f6a=_0x25edec||_0x57d39[_0x54f8d8(0xa4)];if(!_0x822f6a)return console[_0x54f8d8(0xd1)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x54f8d8(0xd1)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x54f8d8(0xdb)),console[_0x54f8d8(0xd1)](_0x54f8d8(0xf4)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x54f8d8(0xd1)](_0x54f8d8(0xde)),console[_0x54f8d8(0xd1)](_0x54f8d8(0x123)),0x1;try{const _0x5343be=_0x57d39[_0x54f8d8(0x133)];let _0x4ed603=_0x822f6a;!_0x1030dc&&_0x5343be&&!_0x822f6a[_0x54f8d8(0x122)]('/')&&(_0x4ed603=_0x5343be+'/'+_0x822f6a,_0x57d39['verbose']&&console[_0x54f8d8(0xd1)](_0x54f8d8(0xd6)+_0x4ed603));const _0x4910b=await withSpinner(_0x54f8d8(0xf2)+_0x4ed603+'\x27...',()=>_0x24ce48[_0x54f8d8(0xe0)][_0x54f8d8(0xf0)](_0x4ed603),{'verbose':_0x57d39[_0x54f8d8(0xac)]}),_0x349877=_0x4910b['data'];_0x57d39[_0x54f8d8(0xac)]&&(console[_0x54f8d8(0xd1)](_0x54f8d8(0x115)+_0x349877['type']),console[_0x54f8d8(0xd1)]('Parent\x20ID:\x20'+_0x349877[_0x54f8d8(0xd9)]),_0x349877[_0x54f8d8(0xf6)]&&console[_0x54f8d8(0xd1)]('Folder\x20ID:\x20'+_0x349877[_0x54f8d8(0xf6)]),_0x349877['segmentId']&&console[_0x54f8d8(0xd1)](_0x54f8d8(0xce)+_0x349877[_0x54f8d8(0x12c)]));if(_0x349877[_0x54f8d8(0xf1)]===_0x54f8d8(0x12f)){const _0xc6c161=await withSpinner(_0x54f8d8(0xfc),()=>_0x24ce48[_0x54f8d8(0xe0)]['getParent'](_0x349877[_0x54f8d8(0xd9)]),{'verbose':_0x57d39[_0x54f8d8(0xac)]});await handleSingleObjectOutput(_0xc6c161[_0x54f8d8(0x11a)],_0x57d39);}else{if(_0x349877['type']===_0x54f8d8(0x142)){if(!_0x349877[_0x54f8d8(0xf6)])throw new SDKError(ErrorCode[_0x54f8d8(0xb9)],_0x54f8d8(0xa2));const _0x17aa9d=await withSpinner('Fetching\x20folder\x20details...',()=>_0x24ce48[_0x54f8d8(0xe0)]['getFolder'](_0x349877['folderId']),{'verbose':_0x57d39[_0x54f8d8(0xac)]});await handleSingleObjectOutput(_0x17aa9d[_0x54f8d8(0x11a)],_0x57d39);}else{if(_0x349877[_0x54f8d8(0xf1)]===_0x54f8d8(0xe0)){if(!_0x349877['segmentId'])throw new SDKError(ErrorCode[_0x54f8d8(0x105)],_0x54f8d8(0xc9));const _0x4a4f74=await withSpinner(_0x54f8d8(0xc4),()=>_0x24ce48['segment'][_0x54f8d8(0xeb)](_0x349877[_0x54f8d8(0xd9)],_0x349877[_0x54f8d8(0x12c)]),{'verbose':_0x57d39[_0x54f8d8(0xac)]});await handleSingleObjectOutput(_0x4a4f74[_0x54f8d8(0x11a)],_0x57d39);}}}return 0x0;}catch(_0x44ffe5){if(_0x44ffe5 instanceof SDKError)return console[_0x54f8d8(0xd1)](_0x54f8d8(0x110)+_0x44ffe5[_0x54f8d8(0xc7)]),_0x44ffe5[_0x54f8d8(0x112)]&&console[_0x54f8d8(0xd1)](_0x54f8d8(0x12a)+_0x44ffe5[_0x54f8d8(0x112)]),0x1;throw _0x44ffe5;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]=a37_0x3c1f2e(0xe2);['description']=a37_0x3c1f2e(0x129);async['execute'](_0x554ef5){const _0x2226c5=a37_0x3c1f2e,{options:_0x268b3f,args:_0x209a9e,tdx:_0x1e2e21}=_0x554ef5,_0x3ceaa1=_0x209a9e[0x0];if(!_0x3ceaa1)return console[_0x2226c5(0xd1)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2226c5(0xd1)](_0x2226c5(0xc3)),console[_0x2226c5(0xd1)](_0x2226c5(0x137)),console[_0x2226c5(0xd1)](_0x2226c5(0xdb)),console[_0x2226c5(0xd1)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x2226c5(0xd8)),0x1;try{const _0x23fbb1=_0x268b3f['parentSegment'],_0x434639=await resolveSegmentTarget(_0x3ceaa1,_0x23fbb1,_0x268b3f[_0x2226c5(0xac)]);_0x268b3f[_0x2226c5(0xac)]&&console[_0x2226c5(0xd1)](_0x2226c5(0xa6)+_0x434639);const _0x183fb6=await withSpinner('Resolving\x20\x27'+_0x3ceaa1+_0x2226c5(0x10c),()=>_0x1e2e21[_0x2226c5(0xe0)][_0x2226c5(0xf0)](_0x434639),{'verbose':_0x268b3f[_0x2226c5(0xac)]}),_0x1e0bca=_0x183fb6['data'];_0x268b3f[_0x2226c5(0xac)]&&(console[_0x2226c5(0xd1)](_0x2226c5(0x115)+_0x1e0bca[_0x2226c5(0xf1)]),console[_0x2226c5(0xd1)](_0x2226c5(0x13c)+_0x1e0bca[_0x2226c5(0xd9)]));if(_0x1e0bca['type']===_0x2226c5(0x142))return console['error'](_0x2226c5(0xd7)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x1e0bca[_0x2226c5(0xf1)]===_0x2226c5(0x12f))return console['error'](_0x2226c5(0xd5)),console[_0x2226c5(0xd1)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x1e0bca[_0x2226c5(0x12c)])throw new SDKError(ErrorCode[_0x2226c5(0x105)],_0x2226c5(0xc9));const _0xdf59b2=await withSpinner(_0x2226c5(0xfe),()=>_0x1e2e21[_0x2226c5(0xe0)]['getSegmentSQL'](_0x1e0bca[_0x2226c5(0xd9)],_0x1e0bca['segmentId']),{'verbose':_0x268b3f[_0x2226c5(0xac)]});let _0x1bf69f=_0xdf59b2[_0x2226c5(0x11a)];const _0x563632=resolveLimit(_0x268b3f[_0x2226c5(0x13b)],DEFAULT_DISPLAY_LIMIT),_0x17091c=/\bLIMIT\s+\d+/i[_0x2226c5(0x100)](_0x1bf69f);!_0x17091c&&(_0x1bf69f=_0x1bf69f[_0x2226c5(0x10a)]()[_0x2226c5(0x107)](/;+$/,''),_0x1bf69f=_0x2226c5(0x102)+_0x1bf69f+_0x2226c5(0x108)+_0x563632);_0x268b3f['verbose']&&console[_0x2226c5(0xd1)](_0x2226c5(0x127)+_0x1bf69f);const _0x53e397=await withProgressSpinner(_0x2226c5(0xab),async _0x1781d7=>{const _0x4ac1be=_0x2226c5,_0x1ad6bf=await _0x1e2e21[_0x4ac1be(0xf3)][_0x4ac1be(0xe8)](_0x1bf69f,{'catalog':'td','schema':_0x4ac1be(0x10f),'onJobId':_0x39bfda=>{const _0x38b140=_0x4ac1be;_0x1781d7[_0x38b140(0xb7)](_0x39bfda);}});return _0x1ad6bf;},{'verbose':_0x268b3f['verbose']}),_0x4e08b0=_0x53e397[_0x2226c5(0x11a)],_0x28853d=_0x4e08b0['jobId']?_0x2226c5(0xaf)+_0x4e08b0[_0x2226c5(0x11f)]+']':'';return console[_0x2226c5(0xd1)](_0x2226c5(0xd3)+_0x4e08b0[_0x2226c5(0xa8)][_0x2226c5(0x132)][_0x2226c5(0xba)]()+_0x2226c5(0x145)+(_0x2226c5(0xcc)+formatElapsed(_0x4e08b0['stats']['elapsedTimeMillis'])+_0x28853d)),await handleQueryOutput(_0x4e08b0,_0x268b3f),0x0;}catch(_0x4276e7){if(_0x4276e7 instanceof SDKError)return console['error'](_0x2226c5(0xaa)+_0x4276e7[_0x2226c5(0xc5)]+']'),console['error']('\x0a'+_0x4276e7[_0x2226c5(0xc7)]),0x1;throw _0x4276e7;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]=a37_0x3c1f2e(0xc2);[a37_0x3c1f2e(0xbf)]=a37_0x3c1f2e(0xfa);async[a37_0x3c1f2e(0xe8)](_0x54854d){const _0x1ed637=a37_0x3c1f2e,{options:_0x561998,args:_0x79d9cb,tdx:_0x4990bc}=_0x54854d;if(_0x79d9cb[_0x1ed637(0xe4)]===0x0)return console[_0x1ed637(0xd1)](_0x1ed637(0xc6)),console['error'](_0x1ed637(0xdd)),0x1;const _0x5747da=_0x79d9cb[0x0];try{_0x561998[_0x1ed637(0xac)]&&(console['error'](_0x1ed637(0x149)+_0x561998[_0x1ed637(0xf7)]),console[_0x1ed637(0xd1)](_0x1ed637(0x135)+_0x5747da));const _0xbdd2e5=await withSpinner(_0x1ed637(0x124)+_0x5747da+_0x1ed637(0x10c),()=>_0x4990bc[_0x1ed637(0xe0)][_0x1ed637(0x12b)](_0x5747da),{'verbose':_0x561998[_0x1ed637(0xac)]}),_0x37e613=_0xbdd2e5[_0x1ed637(0x11a)];_0x561998[_0x1ed637(0xac)]&&console[_0x1ed637(0xd1)](_0x1ed637(0xbb)+_0x37e613);const _0x2ae046=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5747da+'\x27...',()=>_0x4990bc[_0x1ed637(0xe0)][_0x1ed637(0x125)](_0x37e613),{'verbose':_0x561998[_0x1ed637(0xac)]}),_0x2b0bbc=_0x2ae046[_0x1ed637(0x11a)];return console[_0x1ed637(0xd1)](_0x1ed637(0xdc)+_0x2b0bbc[_0x1ed637(0xe4)]+_0x1ed637(0xa9)+(_0x2b0bbc[_0x1ed637(0xe4)]!==0x1?'s':'')),await handleSDKOutput(_0x2b0bbc,_0x561998),0x0;}catch(_0x46eaca){if(_0x46eaca instanceof SDKError)return console['error'](_0x1ed637(0x110)+_0x46eaca[_0x1ed637(0xc7)]),_0x46eaca[_0x1ed637(0x112)]&&console[_0x1ed637(0xd1)](_0x1ed637(0x12a)+_0x46eaca[_0x1ed637(0x112)]),0x1;throw _0x46eaca;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x3c1f2e(0xea);[a37_0x3c1f2e(0xbf)]=a37_0x3c1f2e(0xb0);async['execute'](_0xc3a826){const _0x581c80=a37_0x3c1f2e,{options:_0x6b44e,args:_0x157efb,tdx:_0x1eaa2b}=_0xc3a826;if(_0x157efb[_0x581c80(0xe4)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x581c80(0x11b)),0x1;try{const {parentId:_0x392a96,childId:_0x1bdbc3}=parseSegmentRef(_0x157efb[0x0]);_0x6b44e[_0x581c80(0xac)]&&(console[_0x581c80(0xd1)](_0x581c80(0x149)+_0x6b44e[_0x581c80(0xf7)]),console[_0x581c80(0xd1)](_0x581c80(0x135)+_0x392a96),_0x1bdbc3&&console[_0x581c80(0xd1)](_0x581c80(0x118)+_0x1bdbc3));if(!_0x1bdbc3)return console[_0x581c80(0xd1)](_0x581c80(0x141)),0x1;const _0x2a5a05=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x392a96+_0x581c80(0x10c),()=>_0x1eaa2b[_0x581c80(0xe0)]['resolveParentId'](_0x392a96),{'verbose':_0x6b44e['verbose']}),_0x2f0bba=_0x2a5a05[_0x581c80(0x11a)];_0x6b44e[_0x581c80(0xac)]&&console[_0x581c80(0xd1)](_0x581c80(0xbb)+_0x2f0bba);const _0x28ee54=await withSpinner(_0x581c80(0xae)+_0x1bdbc3+_0x581c80(0x10c),()=>_0x1eaa2b[_0x581c80(0xe0)][_0x581c80(0x128)](_0x2f0bba,_0x1bdbc3),{'verbose':_0x6b44e[_0x581c80(0xac)]}),_0x18bc56=_0x28ee54[_0x581c80(0x11a)];_0x6b44e[_0x581c80(0xac)]&&console[_0x581c80(0xd1)](_0x581c80(0x14c)+_0x18bc56);const _0x13f2a0=await withSpinner(_0x581c80(0xa5)+_0x1bdbc3+_0x581c80(0x10c),()=>_0x1eaa2b[_0x581c80(0xe0)][_0x581c80(0xcd)](_0x18bc56),{'verbose':_0x6b44e['verbose']});return await handleSDKOutput([_0x13f2a0['data']],_0x6b44e),0x0;}catch(_0x1bda14){if(_0x1bda14 instanceof SDKError)return console[_0x581c80(0xd1)](_0x581c80(0x110)+_0x1bda14[_0x581c80(0xc7)]),_0x1bda14[_0x581c80(0x112)]&&console['error']('\x20\x20Cause:\x20'+_0x1bda14[_0x581c80(0x112)]),0x1;throw _0x1bda14;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]=a37_0x3c1f2e(0xb3);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x3c1f2e(0xe8)](_0x29678e){const _0x5d9195=a37_0x3c1f2e,{options:_0x4c1530,args:_0x1c7d29}=_0x29678e,_0x323719=_0x4c1530,_0xbbc71d=_0x323719[_0x5d9195(0x12e)],_0x145ce1=_0x1c7d29[0x0];if(!_0x145ce1&&!_0xbbc71d)return console['error'](a37_0x41467b[_0x5d9195(0x12d)](_0x5d9195(0x11e))),console['error'](_0x5d9195(0xfd)),console[_0x5d9195(0xd1)](_0x5d9195(0xbc)),console[_0x5d9195(0xd1)](_0x5d9195(0xcb)),console[_0x5d9195(0xd1)](_0x5d9195(0xdb)),console[_0x5d9195(0xd1)](_0x5d9195(0x113)),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x145ce1&&_0xbbc71d)return console['error'](a37_0x41467b[_0x5d9195(0x12d)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x78b0a9;if(_0xbbc71d)_0x78b0a9=await this['getSQLFromYamlFile'](_0xbbc71d,_0x29678e);else{if(isYamlFilePath(_0x145ce1))return console[_0x5d9195(0xd1)](a37_0x41467b['red']('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x5d9195(0xd1)](_0x5d9195(0xb1)+_0x145ce1),0x1;else _0x78b0a9=await this[_0x5d9195(0xf8)](_0x145ce1,_0x29678e);}return _0x4c1530[_0x5d9195(0x109)]==='json'||_0x4c1530[_0x5d9195(0x109)]===_0x5d9195(0x139)?await handleSDKOutput([{'sql':_0x78b0a9}],_0x4c1530):console[_0x5d9195(0x119)](_0x78b0a9),0x0;}catch(_0x475e6a){if(_0x475e6a instanceof SDKError)return console[_0x5d9195(0xd1)](_0x5d9195(0x110)+_0x475e6a[_0x5d9195(0xc7)]),_0x475e6a[_0x5d9195(0x112)]&&console[_0x5d9195(0xd1)]('\x20\x20Cause:\x20'+_0x475e6a[_0x5d9195(0x112)]),0x1;throw _0x475e6a;}}async['getSQLFromYamlFile'](_0x3bd9fd,_0x419890){const _0x43ff53=a37_0x3c1f2e,{options:_0x3551ec,tdx:_0x527109}=_0x419890;let _0x508d71;try{_0x508d71=await resolveYamlFilePath(_0x3bd9fd);}catch(_0x20a7e7){throw new SDKError(ErrorCode[_0x43ff53(0x14a)],_0x43ff53(0xca)+_0x20a7e7[_0x43ff53(0xc7)]);}_0x3551ec[_0x43ff53(0xac)]&&console['error']('Resolved:\x20'+_0x508d71[_0x43ff53(0xa4)]+'/'+_0x508d71[_0x43ff53(0xda)]);const _0xdb96ea=await withSpinner(_0x43ff53(0xf9),()=>_0x527109[_0x43ff53(0xe0)][_0x43ff53(0x111)](_0x508d71[_0x43ff53(0xe3)],_0x508d71['parentSegment'],_0x508d71[_0x43ff53(0xda)]),{'verbose':_0x3551ec[_0x43ff53(0xac)]});return _0xdb96ea[_0x43ff53(0x11a)];}async[a37_0x3c1f2e(0xf8)](_0x36eedf,_0xcc9ea7){const _0x16e1df=a37_0x3c1f2e,{options:_0x270921,tdx:_0x1a5245}=_0xcc9ea7,_0x30c4e4=_0x270921[_0x16e1df(0xa4)],_0x1e1645=await resolveSegmentTarget(_0x36eedf,_0x30c4e4,_0x270921[_0x16e1df(0xac)]);_0x270921[_0x16e1df(0xac)]&&console['error'](_0x16e1df(0xa6)+_0x1e1645);const _0x59a064=await withSpinner(_0x16e1df(0xc1)+_0x36eedf+_0x16e1df(0x10c),()=>_0x1a5245[_0x16e1df(0xe0)]['resolvePathToResource'](_0x1e1645),{'verbose':_0x270921[_0x16e1df(0xac)]}),_0x4076ef=_0x59a064[_0x16e1df(0x11a)];_0x270921[_0x16e1df(0xac)]&&(console['error'](_0x16e1df(0x115)+_0x4076ef[_0x16e1df(0xf1)]),console[_0x16e1df(0xd1)](_0x16e1df(0x13c)+_0x4076ef[_0x16e1df(0xd9)]));if(_0x4076ef[_0x16e1df(0xf1)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x4076ef[_0x16e1df(0xf1)]===_0x16e1df(0x12f))throw new SDKError(ErrorCode[_0x16e1df(0x14a)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x4076ef['segmentId'])throw new SDKError(ErrorCode[_0x16e1df(0x105)],_0x16e1df(0xc9));const _0x54f24e=await withSpinner(_0x16e1df(0xfe),()=>_0x1a5245[_0x16e1df(0xe0)][_0x16e1df(0xa7)](_0x4076ef['parentId'],_0x4076ef[_0x16e1df(0x12c)]),{'verbose':_0x270921[_0x16e1df(0xac)]});return _0x54f24e[_0x16e1df(0x11a)];}}function a37_0x3df6(_0x29cad3,_0x300419){_0x29cad3=_0x29cad3-0xa2;const _0x5d8ec0=a37_0x5d8e();let _0x3df6a0=_0x5d8ec0[_0x29cad3];return _0x3df6a0;}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a37_0x3c1f2e(0x10d);[a37_0x3c1f2e(0xbf)]=a37_0x3c1f2e(0x130);async[a37_0x3c1f2e(0xe8)](_0x1b3774){const _0x29ab34=a37_0x3c1f2e,{options:_0x4e413f,args:_0x1c37d9,tdx:_0x2b446b}=_0x1b3774,_0x44e274=_0x4e413f;if(_0x1c37d9[_0x29ab34(0xe4)]<0x2)return console['error'](_0x29ab34(0x11d)),console[_0x29ab34(0xd1)](_0x29ab34(0xe9)),0x1;const _0x31e60e=_0x1c37d9[0x0],_0x20ca1e=_0x1c37d9[0x1];_0x44e274['verbose']&&(console[_0x29ab34(0xd1)](_0x29ab34(0x149)+_0x44e274[_0x29ab34(0xf7)]),console[_0x29ab34(0xd1)](_0x29ab34(0xe1)+_0x31e60e),console[_0x29ab34(0xd1)](_0x29ab34(0x118)+_0x20ca1e));let _0x34789a;if(_0x44e274[_0x29ab34(0xa3)]){const _0xaaab70=_0x44e274[_0x29ab34(0xa3)],_0x43296f=await withSpinner(_0x29ab34(0x124)+_0x31e60e+'\x27...',()=>_0x2b446b[_0x29ab34(0xe0)]['resolveParentId'](_0x31e60e),{'verbose':_0x44e274[_0x29ab34(0xac)]}),_0x2938d8=_0x43296f[_0x29ab34(0x11a)],_0x5b33d7=await withSpinner(_0x29ab34(0xbe)+_0xaaab70+_0x29ab34(0x10c),()=>_0x2b446b[_0x29ab34(0xe0)]['resolveFolderId'](_0x2938d8,_0xaaab70),{'verbose':_0x44e274[_0x29ab34(0xac)]});_0x34789a=_0x5b33d7['data'],_0x44e274[_0x29ab34(0xac)]&&console[_0x29ab34(0xd1)](_0x29ab34(0xb5)+_0x34789a);}const _0xa27482={'name':_0x20ca1e,'description':_0x44e274[_0x29ab34(0xbf)],'parentFolderId':_0x34789a},_0x573f6a=await withSpinner(_0x29ab34(0x138)+_0x20ca1e+_0x29ab34(0x10c),()=>_0x2b446b['segment'][_0x29ab34(0xb4)](_0x31e60e,_0xa27482),{'verbose':_0x44e274[_0x29ab34(0xac)]}),_0x2636fa=_0x573f6a[_0x29ab34(0x11a)];return console['error'](_0x29ab34(0x11c)+_0x2636fa['name']+_0x29ab34(0xcf)+_0x2636fa['id']),await handleSDKOutput([_0x2636fa],_0x44e274),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]='segment:view';['description']=a37_0x3c1f2e(0xd0);async[a37_0x3c1f2e(0xe8)](_0x151b3e){const _0x15691a=a37_0x3c1f2e,{options:_0x10a5d5,args:_0x58c907,tdx:_0x3dbe1a}=_0x151b3e,_0x33d147=_0x58c907[0x0];if(!_0x33d147)return console[_0x15691a(0xd1)](_0x15691a(0xee)),console['error'](_0x15691a(0x117)),console[_0x15691a(0xd1)](_0x15691a(0x114)),console[_0x15691a(0xd1)](_0x15691a(0x148)),console['error'](_0x15691a(0x10b)),console[_0x15691a(0xd1)](_0x15691a(0xdb)),console[_0x15691a(0xd1)](_0x15691a(0x13f)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x15691a(0xd1)](_0x15691a(0xe5)),console[_0x15691a(0xd1)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1ad8cf=_0x10a5d5['parentSegment'],_0x5cc1f5=await resolveSegmentTarget(_0x33d147,_0x1ad8cf,_0x10a5d5['verbose']);_0x10a5d5[_0x15691a(0xac)]&&console['error'](_0x15691a(0xa6)+_0x5cc1f5);const _0x58277e=await withSpinner(_0x15691a(0xc1)+_0x33d147+_0x15691a(0x10c),()=>_0x3dbe1a[_0x15691a(0xe0)][_0x15691a(0xf0)](_0x5cc1f5),{'verbose':_0x10a5d5[_0x15691a(0xac)]}),_0x1221ec=_0x58277e[_0x15691a(0x11a)];_0x10a5d5[_0x15691a(0xac)]&&(console[_0x15691a(0xd1)](_0x15691a(0x115)+_0x1221ec[_0x15691a(0xf1)]),console[_0x15691a(0xd1)]('Parent\x20ID:\x20'+_0x1221ec[_0x15691a(0xd9)]),_0x1221ec[_0x15691a(0xf6)]&&console['error'](_0x15691a(0x146)+_0x1221ec['folderId']),_0x1221ec[_0x15691a(0x12c)]&&console[_0x15691a(0xd1)](_0x15691a(0xce)+_0x1221ec[_0x15691a(0x12c)]));if(_0x10a5d5[_0x15691a(0xb8)]){if(_0x1221ec[_0x15691a(0xf1)]==='folder')return console[_0x15691a(0xd1)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x1221ec[_0x15691a(0xf1)]==='parent')return console[_0x15691a(0xd1)](_0x15691a(0x104)),console[_0x15691a(0xd1)](_0x15691a(0xef)),0x1;if(!_0x1221ec[_0x15691a(0x12c)])throw new SDKError(ErrorCode[_0x15691a(0x105)],_0x15691a(0xc9));const _0x1a35da=getConsoleNextUrl(_0x10a5d5[_0x15691a(0xf7)],'/app/ps/'+_0x1221ec[_0x15691a(0xd9)]+_0x15691a(0x147)+_0x1221ec[_0x15691a(0x12c)]);return console[_0x15691a(0xd1)](a37_0x41467b[_0x15691a(0xff)]('✔')+_0x15691a(0xe7)+a37_0x41467b[_0x15691a(0xc0)](_0x1a35da)),openBrowser(_0x1a35da),0x0;}if(_0x1221ec[_0x15691a(0xf1)]===_0x15691a(0x142)){if(!_0x1221ec[_0x15691a(0xf6)])throw new SDKError(ErrorCode[_0x15691a(0xb9)],_0x15691a(0xa2));const _0x2dbd70=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3dbe1a['segment'][_0x15691a(0xcd)](_0x1221ec[_0x15691a(0xf6)]),{'verbose':_0x10a5d5[_0x15691a(0xac)]});await handleSingleObjectOutput(_0x2dbd70[_0x15691a(0x11a)],_0x10a5d5);}else{if(_0x1221ec[_0x15691a(0xf1)]===_0x15691a(0xe0)){if(!_0x1221ec['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x15691a(0xc9));const _0x41a6db=await withSpinner(_0x15691a(0xc4),()=>_0x3dbe1a[_0x15691a(0xe0)][_0x15691a(0xeb)](_0x1221ec['parentId'],_0x1221ec[_0x15691a(0x12c)]),{'verbose':_0x10a5d5[_0x15691a(0xac)]}),_0x364a14=getConsoleNextUrl(_0x10a5d5['site'],_0x15691a(0x106)+_0x1221ec[_0x15691a(0xd9)]+_0x15691a(0x147)+_0x1221ec['segmentId']),_0x3f2022=_0x41a6db[_0x15691a(0x11a)];_0x3f2022[_0x15691a(0xad)]=_0x364a14,await handleSingleObjectOutput(_0x3f2022,_0x10a5d5);}else return console['error'](_0x15691a(0xb2)),console[_0x15691a(0xd1)](_0x15691a(0x103)),0x1;}return 0x0;}catch(_0x1cd79f){if(_0x1cd79f instanceof SDKError)return console['error']('Error:\x20'+_0x1cd79f['message']),_0x1cd79f[_0x15691a(0x112)]&&console[_0x15691a(0xd1)]('\x20\x20Cause:\x20'+_0x1cd79f['cause']),0x1;throw _0x1cd79f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x3c1f2e(0xfb)]=a37_0x3c1f2e(0xe6);['description']=a37_0x3c1f2e(0x14e);async[a37_0x3c1f2e(0xe8)](_0x173549){const _0x433310=a37_0x3c1f2e,{options:_0x34722b,args:_0x133643,tdx:_0x468219}=_0x173549,_0x1a72d8=_0x133643[0x0];if(!_0x1a72d8)return console['error'](_0x433310(0xbd)),console[_0x433310(0xd1)](_0x433310(0xf5)),console[_0x433310(0xd1)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x433310(0xdb)),console[_0x433310(0xd1)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x433310(0xd1)](_0x433310(0x116)),0x1;try{const _0x276d05=_0x34722b['parentSegment'],_0x1b16df=await resolveSegmentTarget(_0x1a72d8,_0x276d05,_0x34722b[_0x433310(0xac)]);_0x34722b[_0x433310(0xac)]&&console['error'](_0x433310(0xa6)+_0x1b16df);const _0x1ba86d=await withSpinner(_0x433310(0xc1)+_0x1a72d8+_0x433310(0x10c),()=>_0x468219[_0x433310(0xe0)][_0x433310(0xf0)](_0x1b16df),{'verbose':_0x34722b[_0x433310(0xac)]}),_0x516820=_0x1ba86d['data'];_0x34722b[_0x433310(0xac)]&&(console[_0x433310(0xd1)](_0x433310(0x115)+_0x516820[_0x433310(0xf1)]),console['error'](_0x433310(0x13c)+_0x516820[_0x433310(0xd9)]));if(_0x516820[_0x433310(0xf1)]===_0x433310(0x142))return console[_0x433310(0xd1)](_0x433310(0x126)),console['error'](_0x433310(0x143)),0x1;if(_0x516820[_0x433310(0xf1)]==='parent')return console[_0x433310(0xd1)](_0x433310(0xd2)),console[_0x433310(0xd1)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x516820[_0x433310(0x12c)])throw new SDKError(ErrorCode[_0x433310(0x105)],_0x433310(0xc9));const _0x100e6c=await withSpinner(_0x433310(0xfe),()=>_0x468219[_0x433310(0xe0)][_0x433310(0xa7)](_0x516820[_0x433310(0xd9)],_0x516820[_0x433310(0x12c)]),{'verbose':_0x34722b[_0x433310(0xac)]}),_0x521106=_0x100e6c[_0x433310(0x11a)],_0x49a684=await executeSchemaQuery(_0x521106,_0x468219,_0x34722b);return await handleQueryOutput(_0x49a684,_0x34722b),0x0;}catch(_0x23bac3){if(_0x23bac3 instanceof SDKError)return console[_0x433310(0xd1)](_0x433310(0x110)+_0x23bac3[_0x433310(0xc7)]),_0x23bac3[_0x433310(0x112)]&&console[_0x433310(0xd1)]('\x20\x20Cause:\x20'+_0x23bac3[_0x433310(0x112)]),0x1;throw _0x23bac3;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x2b66d0=a38_0x2b55;(function(_0x4808e1,_0x2a0d92){const _0x556d48=a38_0x2b55,_0x43b72a=_0x4808e1();while(!![]){try{const _0x13f5d3=parseInt(_0x556d48(0x1c8))/0x1+parseInt(_0x556d48(0x1c4))/0x2*(parseInt(_0x556d48(0x1c0))/0x3)+-parseInt(_0x556d48(0x1af))/0x4*(parseInt(_0x556d48(0x1d2))/0x5)+-parseInt(_0x556d48(0x1b5))/0x6*(parseInt(_0x556d48(0x1c1))/0x7)+parseInt(_0x556d48(0x1d1))/0x8+parseInt(_0x556d48(0x1b8))/0x9+-parseInt(_0x556d48(0x1aa))/0xa*(-parseInt(_0x556d48(0x1ca))/0xb);if(_0x13f5d3===_0x2a0d92)break;else _0x43b72a['push'](_0x43b72a['shift']());}catch(_0x31cf94){_0x43b72a['push'](_0x43b72a['shift']());}}}(a38_0x47bc,0x34f14));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x47bc(){const _0x5aab78=['segmentPath','184288GegdGR','115HzsXIt','rule','Examples:','verbose','name','Resolving\x20folder\x20path\x20\x27','invisible','segment:create','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segments','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','includes','\x27...','5212170wVHcXB','site','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folder','\x27\x20with\x20ID:\x20','63788wSEawX','Parent\x20path:\x20','execute','Site:\x20','type','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','30TpLYja','length','Target\x20path:\x20','31248qaGNrc','\x20\x20\x20Path:\x20','error','ruleFile','createSegment','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','✔\x20Created\x20segment\x20\x27','folderId','19134aAFgaY','511945XrJTrS','segment','resolvePathToResource','102TlYkjz','yellow','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','76305KeiOKs','kind','11lyIicx','Parent:\x20','data','Resolved\x20folder\x20ID:\x20','parent','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'];a38_0x47bc=function(){return _0x5aab78;};return a38_0x47bc();}import a38_0x2e88e6 from'chalk';function a38_0x2b55(_0x567f9a,_0x3cdd22){_0x567f9a=_0x567f9a-0x1a6;const _0x47bc27=a38_0x47bc();let _0x2b550f=_0x47bc27[_0x567f9a];return _0x2b550f;}export class SegmentCreateCommand extends BaseCommand{[a38_0x2b66d0(0x1d6)]=a38_0x2b66d0(0x1d9);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x2b66d0(0x1b1)](_0x5c4a27){const _0x34381e=a38_0x2b66d0;console[_0x34381e(0x1ba)](a38_0x2e88e6[_0x34381e(0x1c5)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x34381e(0x1ba)](a38_0x2e88e6['yellow'](_0x34381e(0x1c7)));const {options:_0x52b252,args:_0x1993fe,tdx:_0x4d71fe}=_0x5c4a27,_0x4ccca1=_0x52b252;if(_0x1993fe['length']===0x0)return console['error'](_0x34381e(0x1b4)),console[_0x34381e(0x1ba)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error'](_0x34381e(0x1d4)),console[_0x34381e(0x1ba)](_0x34381e(0x1da)),console[_0x34381e(0x1ba)](_0x34381e(0x1c6)),console[_0x34381e(0x1ba)](_0x34381e(0x1ac)),0x1;const _0x2f56ff=_0x1993fe[0x0],_0x4c8e66=_0x52b252[_0x34381e(0x1d0)];let _0x135fce=_0x2f56ff;_0x4c8e66&&!_0x2f56ff[_0x34381e(0x1a8)]('/')&&(_0x135fce=_0x4c8e66+'/'+_0x2f56ff,_0x4ccca1[_0x34381e(0x1d5)]&&console[_0x34381e(0x1ba)]('Resolved\x20relative\x20path\x20to:\x20'+_0x135fce));const _0x3a864b=parsePath(_0x135fce);if(_0x3a864b[_0x34381e(0x1a6)][_0x34381e(0x1b6)]<0x2)return console[_0x34381e(0x1ba)](_0x34381e(0x1cf)),console[_0x34381e(0x1ba)](_0x34381e(0x1a7)),0x1;const _0x3d776b=_0x3a864b[_0x34381e(0x1a6)][0x0],_0x1130c8=getBaseName(_0x135fce),_0x2d0d55=getParentPath(_0x135fce);_0x4ccca1[_0x34381e(0x1d5)]&&(console['error'](_0x34381e(0x1b2)+_0x4ccca1[_0x34381e(0x1ab)]),console[_0x34381e(0x1ba)](_0x34381e(0x1b7)+_0x135fce),console[_0x34381e(0x1ba)](_0x34381e(0x1cb)+_0x3d776b),console['error']('Segment\x20name:\x20'+_0x1130c8),console[_0x34381e(0x1ba)](_0x34381e(0x1b0)+_0x2d0d55));const _0xfedfd=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3d776b+_0x34381e(0x1a9),()=>_0x4d71fe[_0x34381e(0x1c2)]['resolveParentId'](_0x3d776b),{'verbose':_0x4ccca1['verbose']}),_0x121d22=_0xfedfd[_0x34381e(0x1cc)];let _0xda0335;if(_0x3a864b[_0x34381e(0x1a6)][_0x34381e(0x1b6)]>0x2){const _0x4badbd=await withSpinner(_0x34381e(0x1d7)+_0x2d0d55+_0x34381e(0x1a9),()=>_0x4d71fe['segment'][_0x34381e(0x1c3)](_0x2d0d55),{'verbose':_0x4ccca1['verbose']}),_0x106742=_0x4badbd['data'];if(_0x106742[_0x34381e(0x1b3)]!=='folder'&&_0x106742[_0x34381e(0x1b3)]!==_0x34381e(0x1ce))return console['error'](_0x34381e(0x1bd)),0x1;_0xda0335=_0x106742[_0x34381e(0x1bf)];}else{if(_0x4ccca1[_0x34381e(0x1ad)]){const _0xda19d5=await withSpinner('Resolving\x20folder\x20\x27'+_0x4ccca1[_0x34381e(0x1ad)]+_0x34381e(0x1a9),()=>_0x4d71fe[_0x34381e(0x1c2)]['resolveFolderId'](_0x121d22,_0x4ccca1[_0x34381e(0x1ad)]),{'verbose':_0x4ccca1[_0x34381e(0x1d5)]});_0xda0335=_0xda19d5[_0x34381e(0x1cc)];}}_0x4ccca1['verbose']&&_0xda0335&&console[_0x34381e(0x1ba)](_0x34381e(0x1cd)+_0xda0335);const _0x3262c5=await loadJSONFromOptions(_0x4ccca1[_0x34381e(0x1d3)],_0x4ccca1[_0x34381e(0x1bb)]),_0x41f675={'name':_0x1130c8,'description':_0x4ccca1['description'],'rule':_0x3262c5,'kind':_0x4ccca1[_0x34381e(0x1c9)]!==undefined?parseInt(_0x4ccca1[_0x34381e(0x1c9)],0xa):undefined,'isVisible':_0x4ccca1[_0x34381e(0x1d8)]?![]:undefined,'segmentFolderId':_0xda0335,'countPopulation':_0x4ccca1['noCountPopulation']?![]:undefined},_0x28fa9f=await withSpinner('Creating\x20segment\x20\x27'+_0x1130c8+_0x34381e(0x1a9),()=>_0x4d71fe[_0x34381e(0x1c2)][_0x34381e(0x1bc)](_0x121d22,_0x41f675),{'verbose':_0x4ccca1[_0x34381e(0x1d5)]}),_0xc0ccb5=_0x28fa9f[_0x34381e(0x1cc)];return console[_0x34381e(0x1ba)](_0x34381e(0x1be)+_0xc0ccb5['name']+_0x34381e(0x1ae)+_0xc0ccb5['id']),_0x135fce!==_0x2f56ff&&console[_0x34381e(0x1ba)](_0x34381e(0x1b9)+_0x135fce),await handleSDKOutput([_0xc0ccb5],_0x4ccca1),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x47b075=a39_0x5f07;function a39_0x5751(){const _0x38be0f=['3061740wVFujz','data','266BhTLtO','error','Listing\x20fields\x20for\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','144828FeTkav','json','verbose','listFields','Error:\x20Parent\x20segment\x20name\x20is\x20required','description','parentSegment','423617lmGhOR','Parent\x20segment:\x20','segment','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','167880REIQNm','execute','\x20field','2616505RkjyFB','327000RbLknZ','903320EYrDKq','✔\x20Found\x20'];a39_0x5751=function(){return _0x38be0f;};return a39_0x5751();}(function(_0x1c5268,_0x32affe){const _0x1ad486=a39_0x5f07,_0x3454d8=_0x1c5268();while(!![]){try{const _0x1a77b2=-parseInt(_0x1ad486(0x1f5))/0x1+-parseInt(_0x1ad486(0x1e5))/0x2+-parseInt(_0x1ad486(0x1ee))/0x3+parseInt(_0x1ad486(0x1e6))/0x4+-parseInt(_0x1ad486(0x1e4))/0x5+parseInt(_0x1ad486(0x1e8))/0x6+-parseInt(_0x1ad486(0x1ea))/0x7*(-parseInt(_0x1ad486(0x1e1))/0x8);if(_0x1a77b2===_0x32affe)break;else _0x3454d8['push'](_0x3454d8['shift']());}catch(_0x5b12a0){_0x3454d8['push'](_0x3454d8['shift']());}}}(a39_0x5751,0x5b848));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x5f07(_0x21076d,_0x58a9cc){_0x21076d=_0x21076d-0x1df;const _0x575184=a39_0x5751();let _0x5f07e7=_0x575184[_0x21076d];return _0x5f07e7;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a39_0x47b075(0x1f3)]='List\x20available\x20fields\x20for\x20segmentation';async[a39_0x47b075(0x1e2)](_0x3c06a5){const _0x196361=a39_0x47b075,{options:_0x104e31,args:_0x246f19,tdx:_0x960a1c}=_0x3c06a5,_0x5323c1=_0x246f19[0x0]||_0x104e31[_0x196361(0x1f4)];if(!_0x5323c1)return console[_0x196361(0x1eb)](_0x196361(0x1f2)),console[_0x196361(0x1eb)](_0x196361(0x1e0)),console[_0x196361(0x1eb)](_0x196361(0x1ed)),0x1;_0x104e31[_0x196361(0x1f0)]&&(console[_0x196361(0x1eb)]('Site:\x20'+_0x104e31['site']),console[_0x196361(0x1eb)](_0x196361(0x1f6)+_0x5323c1));const _0x438af0=await withSpinner(_0x196361(0x1ec)+_0x5323c1+'\x27...',()=>_0x960a1c[_0x196361(0x1df)][_0x196361(0x1f1)](_0x5323c1),{'verbose':_0x104e31[_0x196361(0x1f0)]}),_0x5b6b21=_0x438af0[_0x196361(0x1e9)];console[_0x196361(0x1eb)](_0x196361(0x1e7)+_0x5b6b21['length']+_0x196361(0x1e3)+(_0x5b6b21['length']!==0x1?'s':''));if(_0x104e31[_0x196361(0x1ef)]||_0x104e31['jsonl'])return await handleSDKOutput(_0x5b6b21,_0x104e31),0x0;return displayFieldsHumanReadable(_0x5b6b21,_0x5323c1),0x0;}}
|