@treasuredata/tdx 2026.3.51 → 2026.3.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x3b5513=a32_0x311b;(function(_0xc9a86b,_0x1d6dc7){const _0x2db1f9=a32_0x311b,_0x345c14=_0xc9a86b();while(!![]){try{const _0x3119c0=parseInt(_0x2db1f9(0x160))/0x1*(parseInt(_0x2db1f9(0x161))/0x2)+parseInt(_0x2db1f9(0x128))/0x3*(-parseInt(_0x2db1f9(0x13d))/0x4)+-parseInt(_0x2db1f9(0x12c))/0x5*(-parseInt(_0x2db1f9(0x144))/0x6)+parseInt(_0x2db1f9(0x14f))/0x7+-parseInt(_0x2db1f9(0x134))/0x8*(-parseInt(_0x2db1f9(0x135))/0x9)+-parseInt(_0x2db1f9(0x12b))/0xa*(parseInt(_0x2db1f9(0x145))/0xb)+-parseInt(_0x2db1f9(0x148))/0xc;if(_0x3119c0===_0x1d6dc7)break;else _0x345c14['push'](_0x345c14['shift']());}catch(_0x3d69f0){_0x345c14['push'](_0x345c14['shift']());}}}(a32_0x504e,0x85b6c));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x311b(_0x4d6e4c,_0x59a0d9){_0x4d6e4c=_0x4d6e4c-0x125;const _0x504ef7=a32_0x504e();let _0x311b13=_0x504ef7[_0x4d6e4c];return _0x311b13;}import{withSpinner}from'../utils/spinner.js';import a32_0x38394a from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x162);[a32_0x3b5513(0x159)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x3b5513(0x15d)](_0x36a9e5){const _0x93f57d=a32_0x3b5513,{options:_0xbac907,tdx:_0x25752f}=_0x36a9e5,_0x36795a=await withSpinner(_0x93f57d(0x147),async()=>{const _0xd8c14a=_0x93f57d,[_0x100e1b,_0x27a60a]=await Promise[_0xd8c14a(0x150)]([_0x25752f[_0xd8c14a(0x14d)][_0xd8c14a(0x146)](),_0x25752f[_0xd8c14a(0x162)]['getMyPermissions']()]);return{'userInfo':_0x100e1b,'permissions':_0x27a60a};},{'verbose':_0xbac907[_0x93f57d(0x14b)]}),{userInfo:_0x660402,permissions:_0x5f08dc}=_0x36795a['data'];if(isStructuredFormat(_0xbac907))return await handleSingleObjectOutput(_0x5f08dc,_0xbac907),0x0;const _0x1e6e89=_0x660402[_0x93f57d(0x155)]?_0x93f57d(0x137):_0x660402[_0x93f57d(0x13b)]?'Administrator':_0x93f57d(0x15f);console['log']('\x0a'+a32_0x38394a[_0x93f57d(0x151)]('👤')+'\x20'+a32_0x38394a[_0x93f57d(0x151)](_0x660402[_0x93f57d(0x136)])+'\x20'+a32_0x38394a[_0x93f57d(0x15e)]('('+_0x660402[_0x93f57d(0x15b)]+')')+_0x93f57d(0x143)+_0x1e6e89),console[_0x93f57d(0x138)](a32_0x38394a['dim'](_0x93f57d(0x133)+_0x25752f['context'][_0x93f57d(0x14e)]+':'+_0x660402[_0x93f57d(0x149)]+_0x93f57d(0x129)+_0x660402['id']));const _0x3c1f42=_0x5f08dc['policies'];console['log']('\x0a'+a32_0x38394a[_0x93f57d(0x151)]('📋\x20Assigned\x20Policies')+'\x20('+_0x3c1f42[_0x93f57d(0x132)]+'):');if(_0x3c1f42['length']===0x0)console[_0x93f57d(0x138)](a32_0x38394a['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x345994 of _0x3c1f42){console['log']('\x20\x20•\x20'+_0x345994[_0x93f57d(0x136)]);}return printPermissionsMap(_0x5f08dc['permissions']),console[_0x93f57d(0x138)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x12d);[a32_0x3b5513(0x159)]=a32_0x3b5513(0x156);async[a32_0x3b5513(0x15d)](_0x37107f){const _0x1ebbd3=a32_0x3b5513,{options:_0xc6973e,tdx:_0x54042f}=_0x37107f,_0x475495=await withSpinner(_0x1ebbd3(0x153),()=>_0x54042f[_0x1ebbd3(0x162)][_0x1ebbd3(0x154)](),{'verbose':_0xc6973e['verbose']}),_0x42595b=_0x475495[_0x1ebbd3(0x13a)];console[_0x1ebbd3(0x130)](_0x1ebbd3(0x140)+_0x42595b[_0x1ebbd3(0x132)]+_0x1ebbd3(0x13c)+(_0x42595b[_0x1ebbd3(0x132)]!==0x1?_0x1ebbd3(0x14a):'y'));if(isStructuredFormat(_0xc6973e))return await handleSDKOutput(_0x42595b,_0xc6973e),0x0;if(_0x42595b[_0x1ebbd3(0x132)]===0x0)console[_0x1ebbd3(0x138)](a32_0x38394a[_0x1ebbd3(0x15e)](_0x1ebbd3(0x15c)));else for(const _0x31abfa of _0x42595b){const _0x18b470=_0x31abfa[_0x1ebbd3(0x159)]?a32_0x38394a['dim'](_0x1ebbd3(0x143)+_0x31abfa['description']):'';console[_0x1ebbd3(0x138)](_0x1ebbd3(0x12e)+_0x31abfa['name']+_0x18b470);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x141);[a32_0x3b5513(0x159)]=a32_0x3b5513(0x126);[a32_0x3b5513(0x15a)](_0x10e5a2){const _0x213248=a32_0x3b5513;if(_0x10e5a2[_0x213248(0x13e)]['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x3b5513(0x15d)](_0x2f08b1){const _0x4ca253=a32_0x3b5513,{options:_0x47923f,tdx:_0x4d3497}=_0x2f08b1,_0x10b1d5=_0x2f08b1['args'][0x0],_0x57cd7c=await withSpinner(_0x4ca253(0x139),async()=>{const _0x7549b3=_0x4ca253,_0x3b8648=await _0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x152)](_0x10b1d5),[_0x354ae5,_0x34b4d4]=await Promise[_0x7549b3(0x150)]([_0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x14c)](_0x3b8648['id']),_0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x127)](_0x3b8648['id'])]);return{'policy':_0x3b8648,'perms':_0x354ae5,'users':_0x34b4d4};},{'verbose':_0x47923f[_0x4ca253(0x14b)]}),{policy:_0x14957f,perms:_0x5bd5f6,users:_0x384dc2}=_0x57cd7c[_0x4ca253(0x13a)];if(isStructuredFormat(_0x47923f))return await handleSingleObjectOutput({..._0x14957f,'permissions':_0x5bd5f6[_0x4ca253(0x13f)],'users':_0x384dc2},_0x47923f),0x0;console[_0x4ca253(0x138)]('\x0a'+a32_0x38394a[_0x4ca253(0x151)]('📋')+'\x20'+a32_0x38394a['bold'](_0x14957f[_0x4ca253(0x136)])+'\x20'+a32_0x38394a['dim'](_0x4ca253(0x158)+_0x14957f['id']+')'));_0x14957f[_0x4ca253(0x159)]&&console[_0x4ca253(0x138)]('\x20\x20\x20'+a32_0x38394a[_0x4ca253(0x15e)](_0x14957f[_0x4ca253(0x159)]));console[_0x4ca253(0x138)](_0x4ca253(0x133)+_0x384dc2[_0x4ca253(0x132)]+_0x4ca253(0x12f)+(_0x384dc2[_0x4ca253(0x132)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x5bd5f6['permissions']);if(_0x384dc2['length']>0x0){console[_0x4ca253(0x138)]('\x0a'+a32_0x38394a[_0x4ca253(0x151)]('👥\x20Assigned\x20Users')+':');for(const _0x11e710 of _0x384dc2){const _0x58edfa=_0x11e710['email']&&_0x11e710[_0x4ca253(0x15b)]!==_0x11e710[_0x4ca253(0x136)]?a32_0x38394a[_0x4ca253(0x15e)]('\x20<'+_0x11e710[_0x4ca253(0x15b)]+'>'):'';console[_0x4ca253(0x138)](_0x4ca253(0x12e)+_0x11e710[_0x4ca253(0x136)]+_0x58edfa);}}return console[_0x4ca253(0x138)](),0x0;}}function a32_0x504e(){const _0x4685f8=['args','permissions','✔\x20Found\x20','policy\x20show','padEnd','\x20—\x20','115944WzBHgP','19063YkASbt','getCurrent','Fetching\x20permissions...','7841304xFXMbl','account_id','ies','verbose','getPolicyPermissions','user','site','5421199HJidPr','all','bold','getPolicy','Listing\x20policies...','listPolicies','account_owner','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','entries','(ID:\x20','description','validate','email','No\x20policies\x20found','execute','dim','Member','9224LRNMtZ','26kEgcvM','policy','max','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','getPolicyUsers','252dWvFUJ',',\x20user_id:','map','1490DVLXmE','100zvMfst','policy\x20list','\x20\x20•\x20','\x20user','error','\x20\x20No\x20permissions','length','\x20\x20\x20','457432bvMOlY','90KmWiED','name','Account\x20Owner','log','Fetching\x20policy...','data','administrator','\x20polic','18728rsBgdz'];a32_0x504e=function(){return _0x4685f8;};return a32_0x504e();}function printPermissionsMap(_0x5d1f0e){const _0x32edf9=a32_0x3b5513,_0x4e2a24=Object[_0x32edf9(0x157)](_0x5d1f0e);console['log']('\x0a'+a32_0x38394a[_0x32edf9(0x151)]('🔑\x20Effective\x20Permissions')+':');if(_0x4e2a24[_0x32edf9(0x132)]===0x0){console['log'](a32_0x38394a[_0x32edf9(0x15e)](_0x32edf9(0x131)));return;}const _0x397206=Math[_0x32edf9(0x125)](..._0x4e2a24['map'](([_0x12d49a])=>_0x12d49a[_0x32edf9(0x132)]));for(const [_0x53657f,_0x55dc13]of _0x4e2a24){const _0x5a8ddf=formatOperations(_0x55dc13);console[_0x32edf9(0x138)]('\x20\x20'+_0x53657f[_0x32edf9(0x142)](_0x397206+0x2)+_0x5a8ddf);}}function formatOperations(_0x43bc1a){const _0x452f4c=a32_0x3b5513,_0x7a74af=[...new Set(_0x43bc1a[_0x452f4c(0x12a)](_0x14e88e=>_0x14e88e['operation']))];return _0x7a74af['join'](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x49df6b=a33_0x543e;(function(_0x3774de,_0x473539){const _0x4367a1=a33_0x543e,_0x164e55=_0x3774de();while(!![]){try{const _0xc7d011=parseInt(_0x4367a1(0x1de))/0x1*(-parseInt(_0x4367a1(0x1ef))/0x2)+-parseInt(_0x4367a1(0x1b5))/0x3*(parseInt(_0x4367a1(0x1d2))/0x4)+parseInt(_0x4367a1(0x1d7))/0x5+parseInt(_0x4367a1(0x1e8))/0x6+-parseInt(_0x4367a1(0x1dd))/0x7*(parseInt(_0x4367a1(0x1bd))/0x8)+parseInt(_0x4367a1(0x1eb))/0x9*(parseInt(_0x4367a1(0x1d3))/0xa)+-parseInt(_0x4367a1(0x1b1))/0xb;if(_0xc7d011===_0x473539)break;else _0x164e55['push'](_0x164e55['shift']());}catch(_0x3baa6c){_0x164e55['push'](_0x164e55['shift']());}}}(a33_0x604e,0x19281));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_0x49908d from'node:path';function a33_0x604e(){const _0x433e9c=['apiKey','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','Removal\x20cancelled','Unknown\x20key\x20\x27','/app/mp/ak','yellow','tdx.json','Enter\x20your\x20TD\x20API\x20key:','VALID_KEYS','Site\x20was\x20not\x20changed.','name','Removed\x20existing\x20profile\x20\x27','Setup\x20cancelled','Profile\x20\x27','414645KjunkA','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','483021RnjaTw','warn','profile:set','(session:\x20','database','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','parent_segment','8jDjIyT','validate','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','includes','site','Validating\x20API\x20key...','session','You\x20can\x20find\x20your\x20API\x20key\x20at:','error','ERROR','jobs','✗\x20Validation\x20failed:\x20','bold','create','profile','Set\x20session\x20profile','status','red','\x0aSetup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','4FkSVef','1605670zFMbGd','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','626110PBsSWl','us01','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','log','password','347739YzyAfA','76889wIRkvy','\x0aAvailable\x20profiles:','profile:create','Delete\x20a\x20profile','profile:delete','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','green','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','logLevel','execute','855120kZXpSd','\x27\x20created','(cleared)','9hGKpDq','split','description','config','2NJLfQE','profileName','confirm','email','\x27\x20deleted','\x20\x20-\x20','message','test','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Failed\x20to\x20delete\x20profile:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20profile\x20name:','\x0aOperation\x20cancelled','length','trim','llm_agent','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','join','Operation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','default','Set\x20a\x20profile\x20configuration\x20value','skipExistsCheck'];a33_0x604e=function(){return _0x433e9c;};return a33_0x604e();}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_0x1b514e from'prompts';import a33_0x5d2c3c from'chalk';function validateProfileName(_0x333fd6,_0x1c6235){const _0x3cbbe4=a33_0x543e;if(!_0x333fd6||!_0x333fd6['trim']())return _0x3cbbe4(0x1b3);const _0x45edb4=_0x333fd6[_0x3cbbe4(0x1fe)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3cbbe4(0x1f6)](_0x45edb4))return _0x3cbbe4(0x1d5);if(!_0x1c6235?.[_0x3cbbe4(0x1a1)]&&profileExists(_0x45edb4))return _0x3cbbe4(0x1b0)+_0x45edb4+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x45edb4+_0x3cbbe4(0x1e3);return!![];}async function deleteProfileAndCredentials(_0x3e4880){removeProfileFromUserConfig(_0x3e4880);const _0x54cddc=await isKeychainAvailable();_0x54cddc&&await Promise['all']([deleteKeychainAPIKey(_0x3e4880),deleteOAuthTokens(_0x3e4880)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x49df6b(0x1e0);['description']='Create\x20a\x20new\x20profile';async[a33_0x49df6b(0x1e7)](_0x29ef0e){const _0xacc9f9=a33_0x49df6b,{options:_0xd2184d,args:_0x2f28d4}=_0x29ef0e,_0x31b863=!!_0xd2184d['force'];console['log'](a33_0x5d2c3c[_0xacc9f9(0x1ca)](_0xacc9f9(0x1bf)));let _0x2adae0;if(_0x2f28d4[_0xacc9f9(0x1fd)]>0x0&&_0x2f28d4[0x0]){const _0x51d721=_0x2f28d4[0x0]['trim']();_0x31b863&&profileExists(_0x51d721)&&(await deleteProfileAndCredentials(_0x51d721),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1ae)+_0x51d721+'\x27'));const _0x3a8d1e=validateProfileName(_0x51d721);if(_0x3a8d1e!==!![])return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)](_0x3a8d1e)),0x1;_0x2adae0=_0x51d721;}else{const _0x2bb1ab=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1f0),'message':_0xacc9f9(0x1fb),'validate':_0x2d0f9d=>validateProfileName(_0x2d0f9d,{'skipExistsCheck':_0x31b863})});if(!_0x2bb1ab[_0xacc9f9(0x1f0)])return console[_0xacc9f9(0x1db)]('\x0aSetup\x20cancelled'),0x1;_0x2adae0=_0x2bb1ab[_0xacc9f9(0x1f0)]['trim'](),_0x31b863&&profileExists(_0x2adae0)&&(await deleteProfileAndCredentials(_0x2adae0),console['log'](_0xacc9f9(0x1ae)+_0x2adae0+'\x27'));}const _0x2cf222=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1ed),'message':'Enter\x20description\x20(optional):'}),_0x3642ea=_0x2cf222[_0xacc9f9(0x1ed)]?.[_0xacc9f9(0x1fe)]()||undefined,_0x22d1e4=_0xd2184d[_0xacc9f9(0x1c2)]||_0xacc9f9(0x1d8),_0x23ef16=await promptSiteSelection(_0x22d1e4,_0x2adae0,_0xacc9f9(0x1af));if(!_0x23ef16)return 0x1;const _0x119ef9=resolveSite(_0x23ef16),_0x46f2aa=await promptAuthMethod();if(!_0x46f2aa)return console['log'](_0xacc9f9(0x1d0)),0x1;if(_0x46f2aa==='oauth'){if(_0x3642ea){const _0x3dac6a={'site':_0x119ef9,'description':_0x3642ea};saveProfileToUserConfig(_0x2adae0,_0x3dac6a);}const {accountName:_0x5d8c35}=_0xd2184d;return await runOAuthLoginFlow(_0x119ef9,_0x2adae0,_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)],{'accountName':_0x5d8c35}),0x0;}console[_0xacc9f9(0x1db)](_0xacc9f9(0x1f7)+_0x119ef9),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1c5)),console[_0xacc9f9(0x1db)]('\x20\x20'+getConsoleUrl(_0x119ef9,_0xacc9f9(0x1a7)));const _0xbe6a5a=await a33_0x1b514e({'type':_0xacc9f9(0x1dc),'name':_0xacc9f9(0x1a2),'message':_0xacc9f9(0x1aa),'validate':_0x561327=>{const _0x1a74f3=_0xacc9f9;if(!_0x561327||!_0x561327[_0x1a74f3(0x1fe)]())return _0x1a74f3(0x19d);return!![];}});if(!_0xbe6a5a[_0xacc9f9(0x1a2)])return console[_0xacc9f9(0x1db)](_0xacc9f9(0x1d0)),0x1;const _0x130c6e=_0xbe6a5a[_0xacc9f9(0x1a2)];console[_0xacc9f9(0x1db)]('Validating\x20API\x20key...');try{const _0x2688ad=TDX['create']({'site':_0x119ef9,'apiKey':_0x130c6e[_0xacc9f9(0x1fe)](),'logLevel':_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)]}),_0x28d8c2=await _0x2688ad[_0xacc9f9(0x1c8)][_0xacc9f9(0x1d6)]();console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1d4)+_0x28d8c2[_0xacc9f9(0x1f2)]+')');const _0x5104d2=await isKeychainAvailable();_0x5104d2?(await saveAPIKeyAsync(_0x130c6e[_0xacc9f9(0x1fe)](),_0x119ef9,_0x2adae0),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2adae0+')')):(console['warn'](a33_0x5d2c3c[_0xacc9f9(0x1a8)](_0xacc9f9(0x1b2))),console[_0xacc9f9(0x1b6)](a33_0x5d2c3c['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xbc1e={'site':_0x119ef9,..._0x3642ea&&{'description':_0x3642ea}};return saveProfileToUserConfig(_0x2adae0,_0xbc1e),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1bb)+_0x2adae0+_0xacc9f9(0x1e9)),console[_0xacc9f9(0x1db)](),console[_0xacc9f9(0x1db)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0xacc9f9(0x203)+_0x2adae0+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xacc9f9(0x1db)]('\x20\x20tdx\x20--profile\x20'+_0x2adae0+_0xacc9f9(0x1e5)),0x0;}catch(_0x5d8750){if(_0x5d8750 instanceof HTTPClientError&&_0x5d8750['status']===0x191)return printAuthError(_0x5d8750),0x1;return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)]('✗\x20Validation\x20failed:\x20'+(_0x5d8750 instanceof Error?_0x5d8750[_0xacc9f9(0x1f5)]:String(_0x5d8750)))),console[_0xacc9f9(0x1c6)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a33_0x543e(_0x2d03ec,_0x3254f3){_0x2d03ec=_0x2d03ec-0x19d;const _0x604e5d=a33_0x604e();let _0x543e5f=_0x604e5d[_0x2d03ec];return _0x543e5f;}export class ProfileDeleteCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1e2);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1e1);[a33_0x49df6b(0x1be)](_0x11bf82){const _0x274b92=a33_0x49df6b,{args:_0x4173be}=_0x11bf82;if(_0x4173be[_0x274b92(0x1fd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x49df6b(0x1e7)](_0x10c5dc){const _0x594c4c=a33_0x49df6b,{args:_0x2594be}=_0x10c5dc,_0x5420f5=_0x2594be[0x0];console[_0x594c4c(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20delete'));if(!profileExists(_0x5420f5)){console[_0x594c4c(0x1c6)](a33_0x5d2c3c[_0x594c4c(0x1cf)]('Profile\x20\x27'+_0x5420f5+'\x27\x20does\x20not\x20exist.')),console[_0x594c4c(0x1db)]('\x0aAvailable\x20profiles:');const _0x1fbcbf=listProfiles();if(_0x1fbcbf[_0x594c4c(0x1fd)]===0x0)console[_0x594c4c(0x1db)](_0x594c4c(0x1c0));else for(const _0x2e61ec of _0x1fbcbf){console['log'](_0x594c4c(0x1f4)+_0x2e61ec['name']);}return 0x1;}const _0x1ecea2=await a33_0x1b514e({'type':'confirm','name':_0x594c4c(0x1f1),'message':_0x594c4c(0x19e)+_0x5420f5+'\x27?','initial':![]});if(!_0x1ecea2[_0x594c4c(0x1f1)])return console[_0x594c4c(0x1db)](_0x594c4c(0x1a5)),0x0;try{await deleteProfileAndCredentials(_0x5420f5),console[_0x594c4c(0x1db)](a33_0x5d2c3c[_0x594c4c(0x1e4)]('✓')+_0x594c4c(0x1bb)+_0x5420f5+_0x594c4c(0x1f3));}catch(_0x4ad5e5){return console[_0x594c4c(0x1c6)](a33_0x5d2c3c['red'](_0x594c4c(0x1f8)+(_0x4ad5e5 instanceof Error?_0x4ad5e5[_0x594c4c(0x1f5)]:String(_0x4ad5e5)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1b7);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1a0);static [a33_0x49df6b(0x1ab)]=[a33_0x49df6b(0x1c2),a33_0x49df6b(0x1b9),a33_0x49df6b(0x1bc),a33_0x49df6b(0x1a4),a33_0x49df6b(0x1ff),a33_0x49df6b(0x1ed)];[a33_0x49df6b(0x1be)](_0x46bf9f){const _0x41ef33=a33_0x49df6b,{args:_0x2e046f,options:_0x8ab80a}=_0x46bf9f,_0x109282=_0x8ab80a['profile']||getActiveProfile();if(!_0x109282)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2e046f['length']===0x0)return _0x41ef33(0x1a3)+ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x204)](',\x20');const _0x69af0d=_0x2e046f[0x0];if(!_0x69af0d[_0x41ef33(0x1c1)]('='))return _0x41ef33(0x1b4)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');const [_0x5de66d]=_0x69af0d[_0x41ef33(0x1ec)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x1c1)](_0x5de66d))return _0x41ef33(0x1a6)+_0x5de66d+_0x41ef33(0x1f9)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');return undefined;}async['execute'](_0x59f96f){const _0x35c0fd=a33_0x49df6b,{args:_0x2ce5b3,options:_0x50ca72}=_0x59f96f,_0x48f393=_0x50ca72[_0x35c0fd(0x1cc)]||getActiveProfile(),[_0x16bb69,..._0x306420]=_0x2ce5b3[0x0][_0x35c0fd(0x1ec)]('='),_0x2e44e3=_0x306420[_0x35c0fd(0x204)]('=');console[_0x35c0fd(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x48f393)){const _0x134c09=await a33_0x1b514e({'type':'confirm','name':_0x35c0fd(0x1cb),'message':_0x35c0fd(0x1b0)+_0x48f393+_0x35c0fd(0x1fa),'initial':!![]});if(!_0x134c09['create'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x205)),0x1;}const _0x54b984=loadProfile(_0x48f393),_0x5affe3=_0x54b984?.[_0x35c0fd(0x1ee)]||{};if(_0x16bb69===_0x35c0fd(0x1c2)){const _0x24b994=resolveSite(_0x2e44e3);console[_0x35c0fd(0x1db)](_0x35c0fd(0x1ba)+_0x24b994+_0x35c0fd(0x200)),console[_0x35c0fd(0x1db)](_0x35c0fd(0x202)),console[_0x35c0fd(0x1db)]('\x20\x20'+getConsoleUrl(_0x24b994,_0x35c0fd(0x1a7)));const _0xedb120=await a33_0x1b514e({'type':_0x35c0fd(0x1dc),'name':_0x35c0fd(0x1a2),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x2a2ccb=>{const _0x12ee87=_0x35c0fd;if(!_0x2a2ccb||!_0x2a2ccb['trim']())return _0x12ee87(0x19d);return!![];}});if(!_0xedb120['apiKey'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x1fc)),0x1;console[_0x35c0fd(0x1db)](_0x35c0fd(0x1c3));try{const _0x5d686c=TDX['create']({'site':_0x24b994,'apiKey':_0xedb120[_0x35c0fd(0x1a2)][_0x35c0fd(0x1fe)](),'logLevel':_0x50ca72[_0x35c0fd(0x1e6)]??LogLevel[_0x35c0fd(0x1c7)]}),_0x4dd1b4=await _0x5d686c[_0x35c0fd(0x1c8)][_0x35c0fd(0x1d6)]();console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1d4)+_0x4dd1b4[_0x35c0fd(0x1f2)]+')');const _0x5d0f93=await isKeychainAvailable();_0x5d0f93?(await saveAPIKeyAsync(_0xedb120['apiKey'][_0x35c0fd(0x1fe)](),_0x24b994,_0x48f393),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1da))):console[_0x35c0fd(0x1b6)](a33_0x5d2c3c[_0x35c0fd(0x1a8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5affe3['site']=_0x24b994;}catch(_0x217698){if(_0x217698 instanceof HTTPClientError&&_0x217698[_0x35c0fd(0x1ce)]===0x191)return printAuthError(_0x217698),0x1;return console[_0x35c0fd(0x1c6)](a33_0x5d2c3c['red'](_0x35c0fd(0x1c9)+(_0x217698 instanceof Error?_0x217698[_0x35c0fd(0x1f5)]:String(_0x217698)))),console['error'](_0x35c0fd(0x1ac)),0x1;}}else _0x5affe3[_0x16bb69]=_0x2e44e3||undefined;return saveProfileToUserConfig(_0x48f393,_0x5affe3),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+'\x20Profile\x20\x27'+_0x48f393+'\x27\x20updated:\x20'+_0x16bb69+'='+(_0x2e44e3||_0x35c0fd(0x1ea))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]='profile:use';[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1cd);[a33_0x49df6b(0x1be)](_0x2d90f4){const _0x3aa99f=a33_0x49df6b,{args:_0x536682}=_0x2d90f4;if(_0x536682[_0x3aa99f(0x1fd)]===0x0)return _0x3aa99f(0x201);return undefined;}async['execute'](_0x34977d){const _0xc4cf74=a33_0x49df6b,{args:_0x241738,options:_0x26b4f6}=_0x34977d,_0x410d68=_0x241738[0x0],_0xdc69ad=_0x26b4f6[_0xc4cf74(0x19f)];cleanExpiredSessions();if(!profileExists(_0x410d68)){console['error'](a33_0x5d2c3c[_0xc4cf74(0x1cf)]('Profile\x20\x27'+_0x410d68+'\x27\x20does\x20not\x20exist.')),console[_0xc4cf74(0x1db)](_0xc4cf74(0x1df));const _0x353e29=listProfiles();if(_0x353e29['length']===0x0)console[_0xc4cf74(0x1db)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x15f4ea of _0x353e29){console['log'](_0xc4cf74(0x1f4)+_0x15f4ea[_0xc4cf74(0x1ad)]);}return 0x1;}if(_0xdc69ad){const _0x329062=a33_0x49908d['join'](getConfigDir(),_0xc4cf74(0x1a9));return saveActiveProfileToUserConfig(_0x410d68),console[_0xc4cf74(0x1db)]('Default\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)),console['log'](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aSaved\x20to:\x20'+_0x329062)),0x0;}const _0x31bb0b=getSessionID(_0x26b4f6[_0xc4cf74(0x1c4)]);return saveSessionContext({'profile':_0x410d68},_0x26b4f6[_0xc4cf74(0x1c4)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)+'\x20'+a33_0x5d2c3c['dim'](_0xc4cf74(0x1b8)+_0x31bb0b+')')),console[_0xc4cf74(0x1db)](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x410d68+_0xc4cf74(0x1d1))),0x0;}}
|
|
1
|
+
const a33_0x301160=a33_0x42be;(function(_0x128c8f,_0x471bb6){const _0x46bf9f=a33_0x42be,_0x51ec53=_0x128c8f();while(!![]){try{const _0x50b6ac=parseInt(_0x46bf9f(0x1db))/0x1+parseInt(_0x46bf9f(0x197))/0x2+parseInt(_0x46bf9f(0x1f6))/0x3+-parseInt(_0x46bf9f(0x1e8))/0x4*(-parseInt(_0x46bf9f(0x198))/0x5)+parseInt(_0x46bf9f(0x205))/0x6*(parseInt(_0x46bf9f(0x195))/0x7)+parseInt(_0x46bf9f(0x1c0))/0x8*(parseInt(_0x46bf9f(0x1d6))/0x9)+parseInt(_0x46bf9f(0x1a5))/0xa*(-parseInt(_0x46bf9f(0x1e4))/0xb);if(_0x50b6ac===_0x471bb6)break;else _0x51ec53['push'](_0x51ec53['shift']());}catch(_0x23f098){_0x51ec53['push'](_0x51ec53['shift']());}}}(a33_0xe687,0xc91e8));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_0x42be(_0x3d2456,_0x5c06dc){_0x3d2456=_0x3d2456-0x195;const _0xe68783=a33_0xe687();let _0x42bed3=_0xe68783[_0x3d2456];return _0x42bed3;}import*as a33_0x4cf3ae 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';function a33_0xe687(){const _0x276508=['\x20--default\x27\x20to\x20save\x20permanently','oauth','profile:delete','Site\x20was\x20not\x20changed.','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','4445127DBzvxx','create','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','llm_agent','tdx:\x20profile\x20create','338395hzkMYj','database','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','Set\x20session\x20profile','getUserInfo','test','Removed\x20existing\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','1045DIhdTO','yellow','\x27\x20deleted','trim','2356jKNiMS','join','(session:\x20','Default\x20profile\x20set\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','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>','logLevel','profile:use','password','Setup\x20cancelled','4433796DIhELf','tdx:\x20profile\x20delete','\x20\x20-\x20','default','\x0aAvailable\x20profiles:','\x27\x20updated:\x20','(cleared)','length','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','warn','email','profile','includes','✗\x20Validation\x20failed:\x20','1419366MHeSyw','14KSwayK','validate','1617426eBLJAL','12755pfxUun','Profile\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','green','ERROR','red','\x20\x20tdx\x20--profile\x20','VALID_KEYS','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','session','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.\x20Create\x20it?','449560vAtCcE','text','llm_project','profile:set','\x20API\x20key\x20is\x20valid\x20(User:\x20','/app/mp/ak','message','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSaved\x20to:\x20','bold','all','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Unknown\x20key\x20\x27','Enter\x20profile\x20name:','site','tdx:\x20profile\x20set','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:create','jobs','confirm','\x20Profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aOperation\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aSetup\x20cancelled','8nnyYtQ','error','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','apiKey','Changing\x20site\x20to\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','\x27\x20does\x20not\x20exist.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','split','Set\x20a\x20profile\x20configuration\x20value','profileName','Validating\x20API\x20key...','name','\x27\x20created','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]'];a33_0xe687=function(){return _0x276508;};return a33_0xe687();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x21c6c5 from'prompts';import a33_0x58fcc0 from'chalk';function validateProfileName(_0x4e1c4b,_0x19e69c){const _0xb2475d=a33_0x42be;if(!_0x4e1c4b||!_0x4e1c4b[_0xb2475d(0x1e7)]())return _0xb2475d(0x1a3);const _0x1050ea=_0x4e1c4b[_0xb2475d(0x1e7)]();if(!/^[a-zA-Z0-9_-]+$/[_0xb2475d(0x1e1)](_0x1050ea))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x19e69c?.['skipExistsCheck']&&profileExists(_0x1050ea))return _0xb2475d(0x199)+_0x1050ea+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1050ea+_0xb2475d(0x1d8);return!![];}async function deleteProfileAndCredentials(_0x342bce){const _0x17427a=a33_0x42be;removeProfileFromUserConfig(_0x342bce);const _0x2a2148=await isKeychainAvailable();_0x2a2148&&await Promise[_0x17427a(0x1af)]([deleteKeychainAPIKey(_0x342bce),deleteOAuthTokens(_0x342bce)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1b7);[a33_0x301160(0x1fe)]=a33_0x301160(0x1de);async[a33_0x301160(0x1ed)](_0x43873e){const _0x333528=a33_0x301160,{options:_0x5260e7,args:_0x6d7971}=_0x43873e,_0x659892=!!_0x5260e7['force'];console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x1ae)](_0x333528(0x1da)));let _0x4a3d8a;if(_0x6d7971[_0x333528(0x1fd)]>0x0&&_0x6d7971[0x0]){const _0x312714=_0x6d7971[0x0][_0x333528(0x1e7)]();_0x659892&&profileExists(_0x312714)&&(await deleteProfileAndCredentials(_0x312714),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x312714+'\x27'));const _0x130186=validateProfileName(_0x312714);if(_0x130186!==!![])return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x130186)),0x1;_0x4a3d8a=_0x312714;}else{const _0x16e1bb=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1cb),'message':_0x333528(0x1b3),'validate':_0x53d8e2=>validateProfileName(_0x53d8e2,{'skipExistsCheck':_0x659892})});if(!_0x16e1bb[_0x333528(0x1cb)])return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;_0x4a3d8a=_0x16e1bb['profileName'][_0x333528(0x1e7)](),_0x659892&&profileExists(_0x4a3d8a)&&(await deleteProfileAndCredentials(_0x4a3d8a),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x4a3d8a+'\x27'));}const _0x3e66c3=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1fe),'message':'Enter\x20description\x20(optional):'}),_0x2f8edd=_0x3e66c3[_0x333528(0x1fe)]?.[_0x333528(0x1e7)]()||undefined,_0xc9c7d9=_0x5260e7[_0x333528(0x1b4)]||'us01',_0x2a7f91=await promptSiteSelection(_0xc9c7d9,_0x4a3d8a,_0x333528(0x1f5));if(!_0x2a7f91)return 0x1;const _0x55f193=resolveSite(_0x2a7f91),_0x462bbb=await promptAuthMethod();if(!_0x462bbb)return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;if(_0x462bbb===_0x333528(0x1d1)){if(_0x2f8edd){const _0x337f2d={'site':_0x55f193,'description':_0x2f8edd};saveProfileToUserConfig(_0x4a3d8a,_0x337f2d);}const {accountName:_0x378859}=_0x5260e7;return await runOAuthLoginFlow(_0x55f193,_0x4a3d8a,_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)],{'accountName':_0x378859}),0x0;}console[_0x333528(0x1a0)](_0x333528(0x19a)+_0x55f193),console['log'](_0x333528(0x1c5)),console[_0x333528(0x1a0)]('\x20\x20'+getConsoleUrl(_0x55f193,_0x333528(0x1aa)));const _0x1c7d60=await a33_0x21c6c5({'type':_0x333528(0x1f4),'name':_0x333528(0x1c3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0xaea545=>{const _0x3ffa73=_0x333528;if(!_0xaea545||!_0xaea545[_0x3ffa73(0x1e7)]())return _0x3ffa73(0x1dd);return!![];}});if(!_0x1c7d60[_0x333528(0x1c3)])return console['log'](_0x333528(0x1bf)),0x1;const _0x1c6010=_0x1c7d60['apiKey'];console[_0x333528(0x1a0)](_0x333528(0x1cc));try{const _0x57663a=TDX['create']({'site':_0x55f193,'apiKey':_0x1c6010[_0x333528(0x1e7)](),'logLevel':_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)]}),_0x4f26bd=await _0x57663a[_0x333528(0x1b8)][_0x333528(0x1e0)]();console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4f26bd[_0x333528(0x201)]+')');const _0x375e9d=await isKeychainAvailable();_0x375e9d?(await saveAPIKeyAsync(_0x1c6010[_0x333528(0x1e7)](),_0x55f193,_0x4a3d8a),console[_0x333528(0x1a0)](a33_0x58fcc0['green']('✓')+_0x333528(0x1b6)+_0x4a3d8a+')')):(console[_0x333528(0x200)](a33_0x58fcc0[_0x333528(0x1e5)](_0x333528(0x1ff))),console[_0x333528(0x200)](a33_0x58fcc0['yellow'](_0x333528(0x1ec))));const _0x233d91={'site':_0x55f193,..._0x2f8edd&&{'description':_0x2f8edd}};return saveProfileToUserConfig(_0x4a3d8a,_0x233d91),console['log'](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x4a3d8a+_0x333528(0x1ce)),console[_0x333528(0x1a0)](),console['log'](_0x333528(0x1c2)),console['log'](_0x333528(0x19e)+_0x4a3d8a+_0x333528(0x1a1)),console[_0x333528(0x1a0)]('\x20\x20tdx\x20--profile\x20'+_0x4a3d8a+_0x333528(0x1d4)),0x0;}catch(_0x26b69e){if(_0x26b69e instanceof HTTPClientError&&_0x26b69e[_0x333528(0x1ef)]===0x191)return printAuthError(_0x26b69e),0x1;return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x333528(0x204)+(_0x26b69e instanceof Error?_0x26b69e[_0x333528(0x1ab)]:String(_0x26b69e)))),console[_0x333528(0x1c1)](_0x333528(0x1ee)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1d2);[a33_0x301160(0x1fe)]='Delete\x20a\x20profile';[a33_0x301160(0x196)](_0x3638a9){const _0x944620=a33_0x301160,{args:_0x4ec25c}=_0x3638a9;if(_0x4ec25c[_0x944620(0x1fd)]===0x0)return _0x944620(0x1b0);return undefined;}async[a33_0x301160(0x1ed)](_0x1f9c28){const _0x2e2b1d=a33_0x301160,{args:_0x36ac7c}=_0x1f9c28,_0x28d7a2=_0x36ac7c[0x0];console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x1ae)](_0x2e2b1d(0x1f7)));if(!profileExists(_0x28d7a2)){console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)](_0x2e2b1d(0x199)+_0x28d7a2+_0x2e2b1d(0x1c7))),console[_0x2e2b1d(0x1a0)](_0x2e2b1d(0x1fa));const _0x12357f=listProfiles();if(_0x12357f[_0x2e2b1d(0x1fd)]===0x0)console[_0x2e2b1d(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x58a66f of _0x12357f){console[_0x2e2b1d(0x1a0)]('\x20\x20-\x20'+_0x58a66f[_0x2e2b1d(0x1cd)]);}return 0x1;}const _0x2f8b51=await a33_0x21c6c5({'type':_0x2e2b1d(0x1b9),'name':'confirm','message':_0x2e2b1d(0x1b1)+_0x28d7a2+'\x27?','initial':![]});if(!_0x2f8b51[_0x2e2b1d(0x1b9)])return console[_0x2e2b1d(0x1a0)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x28d7a2),console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x19b)]('✓')+_0x2e2b1d(0x1ba)+_0x28d7a2+_0x2e2b1d(0x1e6));}catch(_0x51ea14){return console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x51ea14 instanceof Error?_0x51ea14[_0x2e2b1d(0x1ab)]:String(_0x51ea14)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x301160(0x1a8);[a33_0x301160(0x1fe)]=a33_0x301160(0x1ca);static ['VALID_KEYS']=[a33_0x301160(0x1b4),a33_0x301160(0x1dc),'parent_segment',a33_0x301160(0x1a7),a33_0x301160(0x1d9),a33_0x301160(0x1fe)];[a33_0x301160(0x196)](_0x446fa2){const _0x246c0c=a33_0x301160,{args:_0x49cace,options:_0x3b9c72}=_0x446fa2,_0x5ecbfb=_0x3b9c72[_0x246c0c(0x202)]||getActiveProfile();if(!_0x5ecbfb)return _0x246c0c(0x1f1);if(_0x49cace[_0x246c0c(0x1fd)]===0x0)return _0x246c0c(0x1bb)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const _0x2b42f9=_0x49cace[0x0];if(!_0x2b42f9['includes']('='))return _0x246c0c(0x1c8)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const [_0x3af7b9]=_0x2b42f9[_0x246c0c(0x1c9)]('=',0x2);if(!ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x203)](_0x3af7b9))return _0x246c0c(0x1b2)+_0x3af7b9+_0x246c0c(0x1ac)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');return undefined;}async[a33_0x301160(0x1ed)](_0x4f8143){const _0x2687a6=a33_0x301160,{args:_0x36ea3b,options:_0x396141}=_0x4f8143,_0x36ccc0=_0x396141[_0x2687a6(0x202)]||getActiveProfile(),[_0x165080,..._0x3a1649]=_0x36ea3b[0x0][_0x2687a6(0x1c9)]('='),_0x44ee08=_0x3a1649[_0x2687a6(0x1e9)]('=');console[_0x2687a6(0x1a0)](a33_0x58fcc0['bold'](_0x2687a6(0x1b5)));if(!profileExists(_0x36ccc0)){const _0x22d9ac=await a33_0x21c6c5({'type':_0x2687a6(0x1b9),'name':_0x2687a6(0x1d7),'message':_0x2687a6(0x199)+_0x36ccc0+_0x2687a6(0x1a4),'initial':!![]});if(!_0x22d9ac[_0x2687a6(0x1d7)])return console[_0x2687a6(0x1a0)]('Operation\x20cancelled'),0x1;}const _0x2b9797=loadProfile(_0x36ccc0),_0x1ec176=_0x2b9797?.[_0x2687a6(0x1d5)]||{};if(_0x165080==='site'){const _0x36abba=resolveSite(_0x44ee08);console[_0x2687a6(0x1a0)](_0x2687a6(0x1c4)+_0x36abba+_0x2687a6(0x1bc)),console[_0x2687a6(0x1a0)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2687a6(0x1a0)]('\x20\x20'+getConsoleUrl(_0x36abba,_0x2687a6(0x1aa)));const _0x9832b7=await a33_0x21c6c5({'type':_0x2687a6(0x1f4),'name':_0x2687a6(0x1c3),'message':_0x2687a6(0x1e3),'validate':_0x13cfac=>{const _0x514f36=_0x2687a6;if(!_0x13cfac||!_0x13cfac[_0x514f36(0x1e7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x9832b7[_0x2687a6(0x1c3)])return console[_0x2687a6(0x1a0)](_0x2687a6(0x1bd)),0x1;console[_0x2687a6(0x1a0)](_0x2687a6(0x1cc));try{const _0x3d409f=TDX[_0x2687a6(0x1d7)]({'site':_0x36abba,'apiKey':_0x9832b7[_0x2687a6(0x1c3)][_0x2687a6(0x1e7)](),'logLevel':_0x396141['logLevel']??LogLevel[_0x2687a6(0x19c)]}),_0x16cb06=await _0x3d409f[_0x2687a6(0x1b8)]['getUserInfo']();console[_0x2687a6(0x1a0)](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1a9)+_0x16cb06[_0x2687a6(0x201)]+')');const _0x218e7d=await isKeychainAvailable();_0x218e7d?(await saveAPIKeyAsync(_0x9832b7['apiKey'][_0x2687a6(0x1e7)](),_0x36abba,_0x36ccc0),console['log'](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1f0))):console['warn'](a33_0x58fcc0['yellow'](_0x2687a6(0x1ff))),_0x1ec176[_0x2687a6(0x1b4)]=_0x36abba;}catch(_0x176cc6){if(_0x176cc6 instanceof HTTPClientError&&_0x176cc6[_0x2687a6(0x1ef)]===0x191)return printAuthError(_0x176cc6),0x1;return console[_0x2687a6(0x1c1)](a33_0x58fcc0['red'](_0x2687a6(0x204)+(_0x176cc6 instanceof Error?_0x176cc6['message']:String(_0x176cc6)))),console[_0x2687a6(0x1c1)](_0x2687a6(0x1d3)),0x1;}}else _0x1ec176[_0x165080]=_0x44ee08||undefined;return saveProfileToUserConfig(_0x36ccc0,_0x1ec176),console[_0x2687a6(0x1a0)](a33_0x58fcc0[_0x2687a6(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x36ccc0+_0x2687a6(0x1fb)+_0x165080+'='+(_0x44ee08||_0x2687a6(0x1fc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1f3);['description']=a33_0x301160(0x1df);[a33_0x301160(0x196)](_0x3af32f){const _0x59e2c9=a33_0x301160,{args:_0x221681}=_0x3af32f;if(_0x221681[_0x59e2c9(0x1fd)]===0x0)return _0x59e2c9(0x1cf);return undefined;}async[a33_0x301160(0x1ed)](_0x2fad7f){const _0x28de07=a33_0x301160,{args:_0x4cc8f6,options:_0x4b36a1}=_0x2fad7f,_0x354ae5=_0x4cc8f6[0x0],_0x539cd0=_0x4b36a1[_0x28de07(0x1f9)];cleanExpiredSessions();if(!profileExists(_0x354ae5)){console[_0x28de07(0x1c1)](a33_0x58fcc0[_0x28de07(0x19d)](_0x28de07(0x199)+_0x354ae5+_0x28de07(0x1c7))),console[_0x28de07(0x1a0)](_0x28de07(0x1fa));const _0x4c68cc=listProfiles();if(_0x4c68cc[_0x28de07(0x1fd)]===0x0)console[_0x28de07(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3ffe79 of _0x4c68cc){console['log'](_0x28de07(0x1f8)+_0x3ffe79[_0x28de07(0x1cd)]);}return 0x1;}if(_0x539cd0){const _0x2b8509=a33_0x4cf3ae[_0x28de07(0x1e9)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x354ae5),console['log'](_0x28de07(0x1eb)+a33_0x58fcc0['green'](_0x354ae5)),console['log'](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ad)+_0x2b8509)),0x0;}const _0x46f21b=getSessionID(_0x4b36a1[_0x28de07(0x1a2)]);return saveSessionContext({'profile':_0x354ae5},_0x4b36a1['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x58fcc0[_0x28de07(0x19b)](_0x354ae5)+'\x20'+a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ea)+_0x46f21b+')')),console[_0x28de07(0x1a0)](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1be)+_0x354ae5+_0x28de07(0x1d0))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x398238=a34_0x2a6b;(function(_0xfc805b,_0x47a1be){const _0x47162e=a34_0x2a6b,_0x108823=_0xfc805b();while(!![]){try{const _0x259a7c=parseInt(_0x47162e(0x7a))/0x1*(-parseInt(_0x47162e(0x85))/0x2)+-parseInt(_0x47162e(0x82))/0x3+parseInt(_0x47162e(0x7e))/0x4*(parseInt(_0x47162e(0x6e))/0x5)+-parseInt(_0x47162e(0x79))/0x6*(parseInt(_0x47162e(0x7b))/0x7)+parseInt(_0x47162e(0x71))/0x8*(-parseInt(_0x47162e(0x7c))/0x9)+-parseInt(_0x47162e(0x7f))/0xa*(-parseInt(_0x47162e(0x74))/0xb)+parseInt(_0x47162e(0x70))/0xc;if(_0x259a7c===_0x47a1be)break;else _0x108823['push'](_0x108823['shift']());}catch(_0x268136){_0x108823['push'](_0x108823['shift']());}}}(a34_0x3831,0x6261c));function a34_0x3831(){const _0x1c0f41=['message','17646060LwTKLb','16EQLDkx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','384263efKRSf','execute','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','config','6BYYilT','1LKORof','4131806WYpuhz','2200743UeZxIQ','👤\x20','4yfnjll','20kTAerv','dim','length','203082ZZqSYH','List\x20all\x20available\x20profiles','log','929078YCcpjZ','description','green','Error:\x20','site','2370730samxGq'];a34_0x3831=function(){return _0x1c0f41;};return a34_0x3831();}function a34_0x2a6b(_0xb03de6,_0x3a1266){_0xb03de6=_0xb03de6-0x6a;const _0x38314c=a34_0x3831();let _0x2a6b86=_0x38314c[_0xb03de6];return _0x2a6b86;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x296370 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x398238(0x73)]='profiles';[a34_0x398238(0x6a)]=a34_0x398238(0x83);async[a34_0x398238(0x75)](_0x303103){const _0x1468cb=a34_0x398238,{options:_0x285c20}=_0x303103;try{const _0x50beaa=listProfiles(),_0x410c1d=getActiveProfile();if(_0x50beaa[_0x1468cb(0x81)]===0x0)return console[_0x1468cb(0x84)](_0x1468cb(0x72)),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x1468cb(0x84)](_0x1468cb(0x77)),0x0;const _0x4a401e=_0x50beaa[_0x1468cb(0x76)](_0x5ab53a=>{const _0x36617f=_0x1468cb,_0x346dc1=_0x5ab53a[_0x36617f(0x73)]===_0x410c1d,_0x25b59d=getProfileParams(_0x5ab53a['config']);return{'name':_0x5ab53a['name'],'active':_0x346dc1,'scope':_0x5ab53a['scope'],'description':_0x5ab53a[_0x36617f(0x78)][_0x36617f(0x6a)]||'','params':_0x25b59d};});if(isStructuredFormat(_0x285c20))await handleSDKOutput(_0x4a401e,_0x285c20);else for(const _0x5da3f8 of _0x50beaa){const _0x2d8beb=_0x5da3f8['name']===_0x410c1d?a34_0x296370[_0x1468cb(0x6b)]('\x20✓'):'',_0x517ae3=_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6d)]?a34_0x296370[_0x1468cb(0x80)]('\x20'+_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6d)]):'',_0x55106f=_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6a)]?a34_0x296370[_0x1468cb(0x80)]('\x20\x20'+_0x5da3f8[_0x1468cb(0x78)]['description']):'';console[_0x1468cb(0x84)](_0x1468cb(0x7d)+_0x5da3f8[_0x1468cb(0x73)]+_0x2d8beb+_0x517ae3+_0x55106f);}return 0x0;}catch(_0x4ae48e){return _0x4ae48e instanceof Error&&console['error'](_0x1468cb(0x6c)+_0x4ae48e[_0x1468cb(0x6f)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x3d9ef7=a35_0x5453;(function(_0x1cb8a0,_0x126fdd){const _0x5cfd84=a35_0x5453,_0xe96c76=_0x1cb8a0();while(!![]){try{const _0x247c2d=-parseInt(_0x5cfd84(0x116))/0x1+parseInt(_0x5cfd84(0x12c))/0x2+parseInt(_0x5cfd84(0x11f))/0x3*(parseInt(_0x5cfd84(0x124))/0x4)+-parseInt(_0x5cfd84(0x135))/0x5*(-parseInt(_0x5cfd84(0x137))/0x6)+-parseInt(_0x5cfd84(0x123))/0x7+-parseInt(_0x5cfd84(0x132))/0x8*(-parseInt(_0x5cfd84(0x11c))/0x9)+-parseInt(_0x5cfd84(0x122))/0xa*(parseInt(_0x5cfd84(0x12e))/0xb);if(_0x247c2d===_0x126fdd)break;else _0xe96c76['push'](_0xe96c76['shift']());}catch(_0x206e04){_0xe96c76['push'](_0xe96c76['shift']());}}}(a35_0x495a,0x35ccd));import{BaseCommand}from'./command.js';function a35_0x495a(){const _0x210afa=['database','join','199461dDvEzn','Catalog:\x20','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','10loKTnM','2072168qiOLlp','20Qcupsr','setJobId','Schema:\x20','Error:\x20','elapsedTimeMillis','data','file','output','786494RUmJXJ','message','5678299QpWFFw','validate','Executing\x20query...','processedRows','3192072osjaCx','stats','information_schema','5090uVuaSL','Site:\x20','1242rKqqjx','execute','error','Statement\x20','Executing\x20statement\x20','originalMessage','args','jobId','length','totalSplits','\x20rows\x20','Query\x20completed:\x20Processed\x20','verbose','\x20[Job\x20ID:\x20','\x20-\x20','Executing\x20query\x20[','query','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','state','in\x20','Run\x20Trino\x20queries\x20(streaming)','302819lpKMgA','name','catalog','No\x20SQL\x20provided','...','completedSplits','9wCRYjI'];a35_0x495a=function(){return _0x210afa;};return a35_0x495a();}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x5453(_0x3f4464,_0x270660){_0x3f4464=_0x3f4464-0x107;const _0x495a95=a35_0x495a();let _0x5453d9=_0x495a95[_0x3f4464];return _0x5453d9;}export class QueryCommand extends BaseCommand{[a35_0x3d9ef7(0x117)]=a35_0x3d9ef7(0x111);['description']=a35_0x3d9ef7(0x115);async[a35_0x3d9ef7(0x138)](_0x351746){const _0x36167e=a35_0x3d9ef7,{options:_0x44fca3,args:_0x48a3f5,tdx:_0x1ffffb}=_0x351746,_0x23ebbe={..._0x44fca3,'limitStructuredFormats':!![]},_0x189104=_0x48a3f5[0x0],_0x569a90=_0x44fca3[_0x36167e(0x12a)];let _0x3fb488;try{if(_0x569a90)_0x3fb488=readSqlStatementsFromFile(_0x569a90);else{if(_0x189104==='-')_0x3fb488=await readSqlStatementsFromStdin();else{if(_0x189104&&isSqlFilePath(_0x189104))_0x3fb488=readSqlStatementsFromFile(_0x189104);else{if(_0x189104)_0x3fb488=splitSqlStatements(_0x189104);else throw new Error(_0x36167e(0x119));}}}}catch(_0x7a8c6c){return console[_0x36167e(0x139)](_0x36167e(0x127)+_0x7a8c6c[_0x36167e(0x12d)]),0x1;}const _0x1aceea=_0x44fca3[_0x36167e(0x11d)]||_0x36167e(0x134),_0x435247=_0x44fca3[_0x36167e(0x118)];try{const _0x13d626=[],_0x593c4e=!!_0x44fca3[_0x36167e(0x12b)];for(let _0x253c00=0x0;_0x253c00<_0x3fb488[_0x36167e(0x109)];_0x253c00++){const _0x34feee=_0x3fb488[_0x253c00],_0x23fe3c=_0x253c00+0x1,_0x403fe5=_0x3fb488[_0x36167e(0x109)],_0x4588ac=_0x403fe5>0x1;_0x44fca3['verbose']&&(console['error']('\x0a'+(_0x4588ac?'Statement\x20'+_0x23fe3c+'/'+_0x403fe5+':':'')),console[_0x36167e(0x139)](_0x36167e(0x136)+_0x44fca3['site']),console[_0x36167e(0x139)](_0x36167e(0x120)+(_0x435247||'td')),console[_0x36167e(0x139)](_0x36167e(0x126)+_0x1aceea),console[_0x36167e(0x139)]('SQL:\x20'+_0x34feee));const _0x59f367=_0x4588ac?_0x36167e(0x13b)+_0x23fe3c+'/'+_0x403fe5+_0x36167e(0x11a):_0x36167e(0x130);try{const _0x491bae=await withProgressSpinner(_0x59f367,async _0x1ea9b5=>{const _0x1b1179=_0x36167e,_0xaa4e84=await _0x1ffffb['query'][_0x1b1179(0x138)](_0x34feee,{'catalog':_0x435247,'schema':_0x1aceea,'onJobId':_0x1bee42=>{const _0x5a9636=_0x1b1179;_0x1ea9b5[_0x5a9636(0x125)](_0x1bee42);},'onProgress':_0x10112c=>{const _0x107503=_0x1b1179;_0x1ea9b5['setPhase'](_0x107503(0x110)+_0x10112c[_0x107503(0x113)]+']'),_0x1ea9b5['setExtra'](formatRows(_0x10112c[_0x107503(0x131)])+_0x107503(0x10b)+_0x10112c[_0x107503(0x11b)]+'/'+_0x10112c[_0x107503(0x10a)]+'\x20splits');}});return _0xaa4e84;},{'verbose':_0x44fca3[_0x36167e(0x10d)]}),_0x29f2fa=_0x491bae[_0x36167e(0x129)],_0x516410=_0x29f2fa[_0x36167e(0x108)]?_0x36167e(0x10e)+_0x29f2fa[_0x36167e(0x108)]+']':'',_0x440082=_0x4588ac?_0x36167e(0x13a)+_0x23fe3c+'/'+_0x403fe5+_0x36167e(0x10f):'';console[_0x36167e(0x139)]('✔\x20'+_0x440082+_0x36167e(0x10c)+formatRows(_0x29f2fa[_0x36167e(0x133)]['processedRows'])+'\x20rows\x20'+(_0x36167e(0x114)+formatElapsed(_0x29f2fa[_0x36167e(0x133)][_0x36167e(0x128)])+_0x516410));if(_0x4588ac&&_0x593c4e){const _0x30e351=resolveOutputOptions(_0x23ebbe),_0x4e2ee2=await formatQueryOutput(_0x29f2fa,_0x30e351);_0x13d626['push'](_0x4e2ee2);}else await handleQueryOutput(_0x29f2fa,_0x23ebbe);}catch(_0x56f02e){const _0x5934b9=_0x4588ac?'Statement\x20'+_0x23fe3c+'/'+_0x403fe5+':\x0a':'',_0x32e203=_0x56f02e instanceof SDKError?_0x56f02e[_0x36167e(0x13c)]:_0x56f02e['message'];return console[_0x36167e(0x139)](''+_0x5934b9+_0x32e203),0x1;}}if(_0x3fb488[_0x36167e(0x109)]>0x1&&_0x593c4e&&_0x13d626['length']>0x0){const _0x313671=_0x13d626[_0x36167e(0x11e)]('\x0a');writeFileSync(_0x44fca3[_0x36167e(0x12b)],_0x313671),console[_0x36167e(0x139)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x44fca3[_0x36167e(0x12b)]);}return 0x0;}catch(_0x486dc5){throw _0x486dc5;}}[a35_0x3d9ef7(0x12f)](_0x103fcd){const _0x9a21e5=a35_0x3d9ef7,_0x5d6f2c=_0x103fcd[_0x9a21e5(0x107)][0x0],_0x39ef8d=_0x103fcd['options'][_0x9a21e5(0x12a)];if(!_0x5d6f2c&&!_0x39ef8d)return _0x9a21e5(0x121);if(_0x5d6f2c&&_0x39ef8d)return _0x9a21e5(0x112);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x4c0eaa=a36_0x394e;(function(_0xe1d235,_0x1d28a5){const _0x520788=a36_0x394e,_0x448afc=_0xe1d235();while(!![]){try{const _0x53f19d=-parseInt(_0x520788(0xf5))/0x1*(-parseInt(_0x520788(0x104))/0x2)+parseInt(_0x520788(0x9d))/0x3+-parseInt(_0x520788(0xfa))/0x4+parseInt(_0x520788(0xe7))/0x5+parseInt(_0x520788(0xa7))/0x6*(parseInt(_0x520788(0xd9))/0x7)+-parseInt(_0x520788(0xf7))/0x8*(parseInt(_0x520788(0xba))/0x9)+parseInt(_0x520788(0xa1))/0xa*(-parseInt(_0x520788(0xd1))/0xb);if(_0x53f19d===_0x1d28a5)break;else _0x448afc['push'](_0x448afc['shift']());}catch(_0x1c76b8){_0x448afc['push'](_0x448afc['shift']());}}}(a36_0x2a0d,0x2e366));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x1afb02 from'chalk';function a36_0x2a0d(){const _0xba9108=['pagination','keys','from','/app/queries/editor?queryId=','retryLimit','\x20\x20Job\x20ID:\x20','engineVersion','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','h\x20ago','join','INVALID_ARGUMENT','result','cron','Query\x20file\x20is\x20empty','cyan','Delete\x20a\x20scheduled\x20query','schedule:run','execute','Show\x20schedule\x20execution\x20history','args','m\x20ago','Failed\x20to\x20read\x20file:\x20','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','lastRun','list','jsonl','num','Found\x20','\x20schedules','repeat','statusIcon','count','validate','Running\x20schedule...','format','\x20job','schedule:delete','443052JkXRyW','name','(unnamed)','substring','7430cTWlpn','start_at','update','schedule:history','data','error','18JdSUqe','Listing\x20scheduled\x20queries...','scheduled_at','Getting\x20schedule\x20history...','status','end_at','d\x20ago','\x20(use\x20--limit\x20to\x20see\x20more)','limit','Schedule\x20created:\x20','ies','file','\x20\x20Database:\x20','delay','\x20\x20Num:\x20','\x20execution','verbose','history','Showing\x20first\x20','18RCYDSz','table','Show\x20schedule\x20details','schedule:update','schedule:show','Schedule\x20updated:\x20','max','show','executing_user_id','Schedule\x20deleted:\x20','in\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Getting\x20schedule\x20details...','description','abs','\x20\x20→\x20','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','database','queryUrl','padEnd','log','\x20\x20Cron:\x20','2981AKXnUF','Searching\x20scheduled\x20queries\x20matching\x20\x22','priority','job_id','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','never','query','Run\x20a\x20scheduled\x20query\x20immediately','166033gtVZCT','green','Create\x20a\x20scheduled\x20query','tsv','json','time_zone','trim','timezone','success','📅\x20','yes','getTime','round','Updating\x20schedule...','1467415zujAAJ','dim','\x22...','...','ended_at','type','user_name','listQueries','schedules','toLocaleDateString','Creating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','last_job','schedule:list','32077IUJTcW','time','55400EANPyP','engine_version','options','687956CEQWTm','Creating\x20schedule:\x20','run','utf-8','delete','nextRun','retry_limit','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','length','4rZnhmG','Running\x20schedule:\x20'];a36_0x2a0d=function(){return _0xba9108;};return a36_0x2a0d();}function formatRelativeTime(_0x122f16){const _0xfd520c=a36_0x394e,_0x200ba0=new Date(_0x122f16),_0x42f2eb=new Date(),_0x5b9304=_0x200ba0[_0xfd520c(0xe4)]()-_0x42f2eb[_0xfd520c(0xe4)](),_0x2dadbe=Math[_0xfd520c(0xc8)](_0x5b9304)/0x3e8,_0x42d76a=_0x5b9304<0x0;if(_0x2dadbe<0x3c)return _0x42d76a?'just\x20now':'soon';else{if(_0x2dadbe<0xe10){const _0x2e2119=Math[_0xfd520c(0xe5)](_0x2dadbe/0x3c);return _0x42d76a?_0x2e2119+_0xfd520c(0x8b):_0xfd520c(0xc4)+_0x2e2119+'m';}else{if(_0x2dadbe<0x15180){const _0x404e2c=Math['round'](_0x2dadbe/0xe10);return _0x42d76a?_0x404e2c+_0xfd520c(0x7f):_0xfd520c(0xc4)+_0x404e2c+'h';}else{if(_0x2dadbe<0x93a80){const _0x5cb020=Math['round'](_0x2dadbe/0x15180);return _0x42d76a?_0x5cb020+_0xfd520c(0xad):_0xfd520c(0xc4)+_0x5cb020+'d';}else return _0x200ba0[_0xfd520c(0xf0)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xf4);[a36_0x4c0eaa(0xc7)]='List\x20scheduled\x20queries';async[a36_0x4c0eaa(0x88)](_0x246772){const _0x57833a=a36_0x4c0eaa,{options:_0x8c59bb,args:_0x4ee55c,tdx:_0x3d7c3a}=_0x246772,_0x10121d=resolveLimit(_0x8c59bb[_0x57833a(0xaf)],DEFAULT_DISPLAY_LIMIT),_0x2f497a=_0x4ee55c[0x0],_0x462812=_0x2f497a?_0x57833a(0xd2)+_0x2f497a+_0x57833a(0xe9):_0x57833a(0xa8),_0x46fb1b=await withSpinner(_0x462812,()=>_0x3d7c3a[_0x57833a(0xef)][_0x57833a(0xee)]({'limit':_0x10121d,'scheduled':!![],'pattern':_0x2f497a}),{'verbose':_0x8c59bb[_0x57833a(0xb7)]}),_0xe2318e=_0x46fb1b[_0x57833a(0xa5)]['queries'],_0x579d42=_0x46fb1b['data'][_0x57833a(0x106)]['has_next_page'],_0xaee835=_0x2f497a?'\x20matching\x20\x22'+_0x2f497a+'\x22':'';_0x579d42?console['error'](_0x57833a(0xb9)+_0xe2318e[_0x57833a(0x103)]+_0x57833a(0x94)+_0xaee835+_0x57833a(0xae)):console['error'](_0x57833a(0x93)+_0xe2318e[_0x57833a(0x103)]+'\x20scheduled\x20quer'+(_0xe2318e['length']!==0x1?_0x57833a(0xb1):'y')+_0xaee835);if(_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdd)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0x91)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xbb)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdc)){const _0x4ccb32=_0xe2318e[_0x57833a(0xca)](_0x3f1989=>({'id':_0x3f1989['id'],'name':_0x3f1989[_0x57833a(0x9e)],'cron':_0x3f1989['cron'],'database':_0x3f1989[_0x57833a(0xcc)]?.[_0x57833a(0x9e)],'type':_0x3f1989[_0x57833a(0xec)],'timezone':_0x3f1989[_0x57833a(0xde)],'user_name':_0x3f1989[_0x57833a(0x8d)]?.[_0x57833a(0x9e)],'updated_at':_0x3f1989['updated_at'],'next_run_at':_0x3f1989['next_run_at'],'last_job_status':_0x3f1989[_0x57833a(0xf3)]?.[_0x57833a(0xab)]}));await handleSDKOutput(_0x4ccb32,_0x8c59bb);}else{if(_0xe2318e['length']===0x0)console[_0x57833a(0xcf)]('No\x20scheduled\x20queries\x20found');else{const _0x210e3b=_0x8c59bb['site'],_0x105823=_0xe2318e[_0x57833a(0xca)](_0x31504b=>{const _0x5dd128=_0x57833a,_0x33f677=_0x31504b[_0x5dd128(0xf3)]?.[_0x5dd128(0xab)]?_0x31504b[_0x5dd128(0xf3)]['status']===_0x5dd128(0xe1)?'✓':'✗':'-',_0x41849d=_0x31504b[_0x5dd128(0xf3)]?.['ended_at']?formatRelativeTime(_0x31504b[_0x5dd128(0xf3)][_0x5dd128(0xeb)]):_0x5dd128(0xd6),_0x27f941=_0x31504b['next_run_at']?formatRelativeTime(_0x31504b['next_run_at']):'-',_0x545ade=_0x31504b[_0x5dd128(0x83)]||'',_0xd3fd58=_0x31504b[_0x5dd128(0x9e)]||_0x5dd128(0x9f),_0x201b9d=getConsoleUrl(_0x210e3b,_0x5dd128(0x109)+_0x31504b['id']);return{'statusIcon':_0x33f677,'lastRun':_0x41849d,'nextRun':_0x27f941,'cron':_0x545ade,'name':_0xd3fd58,'queryUrl':_0x201b9d,'status':_0x31504b['last_job']?.[_0x5dd128(0xab)]};}),_0x43ea53=Math[_0x57833a(0xc0)](..._0x105823['map'](_0x9ed8d6=>_0x9ed8d6[_0x57833a(0x8f)]['length'])),_0x4dbb84=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x46d084=>_0x46d084[_0x57833a(0xff)]['length'])),_0x7704c7=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x5c6e22=>_0x5c6e22[_0x57833a(0x83)]['length'])),_0x8dae04=_0x105823[_0x57833a(0xca)](_0x53eb44=>{const _0x522aec=_0x57833a,_0x48684f=_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xe1)?a36_0x1afb02[_0x522aec(0xda)](_0x53eb44[_0x522aec(0x96)]):_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xa6)?a36_0x1afb02['red'](_0x53eb44[_0x522aec(0x96)]):a36_0x1afb02[_0x522aec(0xe8)](_0x53eb44[_0x522aec(0x96)]),_0x3a2524=_0x53eb44[_0x522aec(0x8f)]['padEnd'](_0x43ea53),_0x3758d3=_0x53eb44['nextRun']['padEnd'](_0x4dbb84),_0x427331=_0x53eb44[_0x522aec(0x83)]?a36_0x1afb02[_0x522aec(0x85)](_0x53eb44[_0x522aec(0x83)][_0x522aec(0xce)](_0x7704c7)):'\x20'[_0x522aec(0x95)](_0x7704c7),_0x5a279d=hyperlink(_0x53eb44[_0x522aec(0x9e)],_0x53eb44[_0x522aec(0xcd)]);return _0x522aec(0xe2)+_0x48684f+'\x20'+_0x3a2524+_0x522aec(0xc9)+_0x3758d3+'\x20\x20'+_0x427331+'\x20\x20'+_0x5a279d;});await writeOutput(_0x8dae04[_0x57833a(0x80)]('\x0a'),_0x8c59bb['output'],_0x57833a(0x90));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x4c0eaa(0xbe);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xbc);[a36_0x4c0eaa(0x98)](_0x4158ef){const _0x336018=a36_0x4c0eaa,_0x6ed448=_0x4158ef['args'][0x0];if(!_0x6ed448)return _0x336018(0x8e);return undefined;}async[a36_0x4c0eaa(0x88)](_0x467b26){const _0x436651=a36_0x4c0eaa,{options:_0xaf7670,args:_0x286432,tdx:_0x4ba0aa}=_0x467b26,_0x211d6d=_0x286432[0x0],_0x3d6eaa=await withSpinner(_0x436651(0xc6),()=>_0x4ba0aa[_0x436651(0xef)][_0x436651(0xc1)](_0x211d6d),{'verbose':_0xaf7670[_0x436651(0xb7)]}),_0x125b53=_0x3d6eaa['data'],_0x192e5d={'name':_0x125b53[_0x436651(0x9e)],'cron':_0x125b53[_0x436651(0x83)],'database':_0x125b53[_0x436651(0xcc)],'type':_0x125b53['type'],'timezone':_0x125b53[_0x436651(0xe0)],'user_name':_0x125b53[_0x436651(0xed)],'created_at':_0x125b53['created_at'],'engine_version':_0x125b53[_0x436651(0xf8)],'executing_user_id':_0x125b53[_0x436651(0xc2)],'query':_0x125b53[_0x436651(0xd7)],'delay':_0x125b53[_0x436651(0xb4)],'priority':_0x125b53[_0x436651(0xd3)],'retry_limit':_0x125b53[_0x436651(0x100)],..._0x125b53[_0x436651(0x82)]&&{'result':_0x125b53['result']}};return await handleSingleObjectOutput(_0x192e5d,_0xaf7670),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]='schedule:create';[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xdb);[a36_0x4c0eaa(0x98)](_0x3eea2c){const _0x58e582=a36_0x4c0eaa,_0x24e1dc=_0x3eea2c[_0x58e582(0x8a)][0x0];if(!_0x24e1dc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x1e10f5=_0x3eea2c[_0x58e582(0xf9)];if(!_0x1e10f5[_0x58e582(0xcc)])return _0x58e582(0xd5);return undefined;}async['execute'](_0x389343){const _0x45d85a=a36_0x4c0eaa,{options:_0x5595c0,args:_0x36a77d,tdx:_0x52c625}=_0x389343,_0x405049=_0x36a77d[0x0],_0x14f0bc=_0x5595c0,_0x55c2ae=_0x14f0bc['database'],_0x4a5037=_0x14f0bc['file'],_0x3496f4=_0x14f0bc[_0x45d85a(0xec)]||'trino';let _0x55cba8;try{_0x55cba8=readFileSync(_0x4a5037,'utf-8')[_0x45d85a(0xdf)]();}catch(_0x4b8308){throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x8c)+_0x4a5037,_0x4b8308 instanceof Error?_0x4b8308:undefined);}if(!_0x55cba8)throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x84));const _0x3cc138={'database':_0x55c2ae,'query':_0x55cba8,'type':_0x3496f4};if(_0x14f0bc[_0x45d85a(0x83)])_0x3cc138['cron']=_0x14f0bc['cron'];if(_0x14f0bc[_0x45d85a(0xe0)])_0x3cc138[_0x45d85a(0xe0)]=_0x14f0bc[_0x45d85a(0xe0)];if(_0x14f0bc[_0x45d85a(0xb4)]!==undefined)_0x3cc138[_0x45d85a(0xb4)]=Number(_0x14f0bc['delay']);if(_0x14f0bc[_0x45d85a(0xd3)]!==undefined)_0x3cc138[_0x45d85a(0xd3)]=Number(_0x14f0bc[_0x45d85a(0xd3)]);if(_0x14f0bc[_0x45d85a(0x10a)]!==undefined)_0x3cc138['retry_limit']=Number(_0x14f0bc[_0x45d85a(0x10a)]);if(_0x14f0bc['engineVersion'])_0x3cc138[_0x45d85a(0xf8)]=_0x14f0bc['engineVersion'];if(_0x14f0bc[_0x45d85a(0x82)])_0x3cc138[_0x45d85a(0x82)]=_0x14f0bc[_0x45d85a(0x82)];if(_0x5595c0['verbose']){console['error'](_0x45d85a(0xfb)+_0x405049),console[_0x45d85a(0xa6)](_0x45d85a(0xb3)+_0x55c2ae),console[_0x45d85a(0xa6)]('\x20\x20Type:\x20'+_0x3496f4);if(_0x3cc138[_0x45d85a(0x83)])console[_0x45d85a(0xa6)](_0x45d85a(0xd0)+_0x3cc138['cron']);if(_0x3cc138['timezone'])console[_0x45d85a(0xa6)](_0x45d85a(0x102)+_0x3cc138['timezone']);}const _0x290bdd=await withSpinner(_0x45d85a(0xf1),()=>_0x52c625[_0x45d85a(0xef)]['create'](_0x405049,_0x3cc138),{'verbose':_0x5595c0[_0x45d85a(0xb7)]});return console['error'](_0x45d85a(0xb0)+_0x290bdd[_0x45d85a(0xa5)][_0x45d85a(0x9e)]),await handleSingleObjectOutput(_0x290bdd[_0x45d85a(0xa5)],_0x5595c0),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xbd);[a36_0x4c0eaa(0xc7)]='Update\x20a\x20scheduled\x20query';[a36_0x4c0eaa(0x98)](_0x2b8478){const _0x592cf2=a36_0x4c0eaa,_0x27cc0a=_0x2b8478[_0x592cf2(0x8a)][0x0];if(!_0x27cc0a)return _0x592cf2(0xf2);return undefined;}async['execute'](_0x33aa93){const _0x35c022=a36_0x4c0eaa,{options:_0x433ad6,args:_0x5bd373,tdx:_0x563b46}=_0x33aa93,_0x5beaa1=_0x5bd373[0x0],_0x5c3a8d=_0x433ad6,_0xe7e5a8={};if(_0x5c3a8d[_0x35c022(0xcc)])_0xe7e5a8[_0x35c022(0xcc)]=_0x5c3a8d[_0x35c022(0xcc)];if(_0x5c3a8d[_0x35c022(0xec)])_0xe7e5a8[_0x35c022(0xec)]=_0x5c3a8d[_0x35c022(0xec)];if(_0x5c3a8d[_0x35c022(0x83)])_0xe7e5a8[_0x35c022(0x83)]=_0x5c3a8d[_0x35c022(0x83)];if(_0x5c3a8d[_0x35c022(0xe0)])_0xe7e5a8[_0x35c022(0xe0)]=_0x5c3a8d['timezone'];if(_0x5c3a8d[_0x35c022(0xb4)]!==undefined)_0xe7e5a8[_0x35c022(0xb4)]=Number(_0x5c3a8d[_0x35c022(0xb4)]);if(_0x5c3a8d[_0x35c022(0xd3)]!==undefined)_0xe7e5a8[_0x35c022(0xd3)]=Number(_0x5c3a8d[_0x35c022(0xd3)]);if(_0x5c3a8d[_0x35c022(0x10a)]!==undefined)_0xe7e5a8[_0x35c022(0x100)]=Number(_0x5c3a8d[_0x35c022(0x10a)]);if(_0x5c3a8d[_0x35c022(0x7d)])_0xe7e5a8[_0x35c022(0xf8)]=_0x5c3a8d[_0x35c022(0x7d)];if(_0x5c3a8d['result'])_0xe7e5a8[_0x35c022(0x82)]=_0x5c3a8d[_0x35c022(0x82)];if(_0x5c3a8d['file'])try{_0xe7e5a8[_0x35c022(0xd7)]=readFileSync(_0x5c3a8d[_0x35c022(0xb2)],_0x35c022(0xfd))[_0x35c022(0xdf)]();}catch(_0x3d3e81){throw new SDKError(ErrorCode[_0x35c022(0x81)],_0x35c022(0x8c)+_0x5c3a8d['file'],_0x3d3e81 instanceof Error?_0x3d3e81:undefined);}if(Object[_0x35c022(0x107)](_0xe7e5a8)['length']===0x0)throw new SDKError(ErrorCode[_0x35c022(0x81)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x433ad6[_0x35c022(0xb7)]){console[_0x35c022(0xa6)](_0x35c022(0x101)+_0x5beaa1);for(const [_0x3b4bbd,_0x1857ef]of Object['entries'](_0xe7e5a8)){_0x3b4bbd===_0x35c022(0xd7)?console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef[_0x35c022(0xa0)](0x0,0x32)+_0x35c022(0xea)):console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef);}}const _0x181990=await withSpinner(_0x35c022(0xe6),()=>_0x563b46[_0x35c022(0xef)][_0x35c022(0xa3)](_0x5beaa1,_0xe7e5a8),{'verbose':_0x433ad6['verbose']});return console['error'](_0x35c022(0xbf)+_0x181990['data'][_0x35c022(0x9e)]),await handleSingleObjectOutput(_0x181990['data'],_0x433ad6),0x0;}}function a36_0x394e(_0x2b96f3,_0x1f9e87){_0x2b96f3=_0x2b96f3-0x7d;const _0x2a0d5f=a36_0x2a0d();let _0x394ebf=_0x2a0d5f[_0x2b96f3];return _0x394ebf;}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x4c0eaa(0x9c);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x86);[a36_0x4c0eaa(0x98)](_0x511b86){const _0x5c021a=a36_0x4c0eaa,_0x10cb31=_0x511b86[_0x5c021a(0x8a)][0x0];if(!_0x10cb31)return _0x5c021a(0xc5);return undefined;}async[a36_0x4c0eaa(0x88)](_0x56878b){const _0x4e87fa=a36_0x4c0eaa,{options:_0x218907,args:_0x42a623,tdx:_0x1dda51}=_0x56878b,_0x22f150=_0x42a623[0x0];if(!_0x218907[_0x4e87fa(0xe3)]){const _0x6b4dcf=await confirm(_0x4e87fa(0x7e)+_0x22f150+'\x22?');if(!_0x6b4dcf)return console[_0x4e87fa(0xa6)]('Cancelled'),0x0;}const _0x4c2af8=await withSpinner('Deleting\x20schedule...',()=>_0x1dda51[_0x4e87fa(0xef)][_0x4e87fa(0xfe)](_0x22f150),{'verbose':_0x218907[_0x4e87fa(0xb7)]});return console[_0x4e87fa(0xa6)](_0x4e87fa(0xc3)+_0x4c2af8['data'][_0x4e87fa(0x9e)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0x87);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xd8);[a36_0x4c0eaa(0x98)](_0x18737c){const _0x1ec081=a36_0x4c0eaa,_0x3dddcd=_0x18737c[_0x1ec081(0x8a)][0x0];if(!_0x3dddcd)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x4fc1a3){const _0x27a8dd=a36_0x4c0eaa,{options:_0x27835f,args:_0x237b60,tdx:_0xb2c5c9}=_0x4fc1a3,_0x26949a=_0x237b60[0x0],_0x428386=_0x27835f,_0x5c68b6=_0x428386[_0x27a8dd(0xf6)],_0x405c3b=_0x428386[_0x27a8dd(0x92)]!==undefined?Number(_0x428386[_0x27a8dd(0x92)]):undefined;if(_0x27835f[_0x27a8dd(0xb7)]){console[_0x27a8dd(0xa6)](_0x27a8dd(0x105)+_0x26949a);if(_0x5c68b6)console[_0x27a8dd(0xa6)]('\x20\x20Time:\x20'+_0x5c68b6);if(_0x405c3b)console[_0x27a8dd(0xa6)](_0x27a8dd(0xb5)+_0x405c3b);}const _0xd45592=await withSpinner(_0x27a8dd(0x99),()=>_0xb2c5c9[_0x27a8dd(0xef)][_0x27a8dd(0xfc)](_0x26949a,{'time':_0x5c68b6,'num':_0x405c3b}),{'verbose':_0x27835f['verbose']}),_0x1456c5=_0xd45592[_0x27a8dd(0xa5)]['jobs'];console[_0x27a8dd(0xa6)]('Schedule\x20run\x20submitted:\x20'+_0x1456c5[_0x27a8dd(0x103)]+_0x27a8dd(0x9b)+(_0x1456c5[_0x27a8dd(0x103)]!==0x1?'s':'')+'\x20created');for(const _0x29ebbd of _0x1456c5){console[_0x27a8dd(0xa6)](_0x27a8dd(0x10b)+_0x29ebbd[_0x27a8dd(0xd4)]);}return await handleSDKOutput(_0x1456c5,_0x27835f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xa4);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x89);[a36_0x4c0eaa(0x98)](_0x261155){const _0x4690b2=a36_0x4c0eaa,_0x39e152=_0x261155[_0x4690b2(0x8a)][0x0];if(!_0x39e152)return _0x4690b2(0xcb);return undefined;}async['execute'](_0x2940ab){const _0x1d6d33=a36_0x4c0eaa,{options:_0x1f0920,args:_0x95d364,tdx:_0x518687}=_0x2940ab,_0x4bede2=_0x95d364[0x0],_0x2350b1=_0x1f0920,_0x390e05=_0x2350b1[_0x1d6d33(0x108)]!==undefined?Number(_0x2350b1[_0x1d6d33(0x108)]):undefined,_0x290c0e=_0x2350b1['to']!==undefined?Number(_0x2350b1['to']):undefined,_0x157586=await withSpinner(_0x1d6d33(0xaa),()=>_0x518687[_0x1d6d33(0xef)][_0x1d6d33(0xb8)](_0x4bede2,{'from':_0x390e05,'to':_0x290c0e}),{'verbose':_0x1f0920[_0x1d6d33(0xb7)]}),_0x9643d1=_0x157586[_0x1d6d33(0xa5)];console['error'](_0x1d6d33(0x93)+_0x9643d1[_0x1d6d33(0x97)]+_0x1d6d33(0xb6)+(_0x9643d1[_0x1d6d33(0x97)]!==0x1?'s':'')+'\x20(showing\x20'+_0x9643d1[_0x1d6d33(0x108)]+'-'+_0x9643d1['to']+')');const _0x46d4dd=_0x9643d1[_0x1d6d33(0xb8)][_0x1d6d33(0xca)](_0x4c0706=>({'job_id':_0x4c0706[_0x1d6d33(0xd4)],'type':_0x4c0706['type'],'status':_0x4c0706['status'],'scheduled_at':_0x4c0706[_0x1d6d33(0xa9)],'created_at':_0x4c0706['created_at'],'start_at':_0x4c0706[_0x1d6d33(0xa2)],'end_at':_0x4c0706[_0x1d6d33(0xac)]}));return await handleSDKOutput(_0x46d4dd,_0x1f0920),0x0;}}
|
|
1
|
+
function a36_0x5199(){const _0x4f20b9=['statusIcon','created_at','No\x20scheduled\x20queries\x20found','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','yes','Show\x20schedule\x20details','10061145ctcOZZ','\x20created','\x20job','toLocaleDateString','end_at','round','site','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','trim','Failed\x20to\x20read\x20file:\x20','job_id','Creating\x20schedule:\x20','options','red','\x20matching\x20\x22','schedule:update','execute','query','engineVersion','file','\x20scheduled\x20quer','551609QcwRNv','63736ucdcph','List\x20scheduled\x20queries','482450fLrOrE','ended_at','timezone','result','name','\x20\x20Job\x20ID:\x20','type','num','listQueries','json','has_next_page','scheduled_at','keys','format','table','10474446lsdjsi','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','padEnd','substring','schedule:show','INVALID_ARGUMENT','from','delay','Schedule\x20created:\x20','run','\x20\x20Database:\x20','\x20execution','lastRun','cyan','getTime','Updating\x20schedule:\x20','tsv','map','(unnamed)','abs','📅\x20','schedules','/app/queries/editor?queryId=','30201390KqteGQ','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','cron','soon','h\x20ago','9yxPZZa','schedule:history','11JypwkD','\x20(use\x20--limit\x20to\x20see\x20more)','m\x20ago','updated_at','Running\x20schedule...','length','350IZLDfp','queries','...','log','\x20\x20Type:\x20','start_at','args','entries','time','status','retry_limit','8ABjYTS','pagination','Update\x20a\x20scheduled\x20query','success','show','\x20schedules','\x20\x20Cron:\x20','Schedule\x20run\x20submitted:\x20','Found\x20','delete','output','verbose','jsonl','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','description','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','priority','schedule:create','retryLimit','last_job','create','682904gBvnhL','history','database','next_run_at','in\x20','join','\x22...','Deleting\x20schedule...','\x20\x20Num:\x20','data','nextRun','Schedule\x20deleted:\x20','green','trino','queryUrl','Getting\x20schedule\x20details...','validate','time_zone','utf-8','user','update','\x20\x20Time:\x20','limit','count','Cancelled','engine_version','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Showing\x20first\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','max','user_name','\x20\x20Timezone:\x20','error','Query\x20file\x20is\x20empty','\x20\x20→\x20'];a36_0x5199=function(){return _0x4f20b9;};return a36_0x5199();}const a36_0x24e2e5=a36_0x33ff;(function(_0x379990,_0x2d2148){const _0x19599e=a36_0x33ff,_0x208329=_0x379990();while(!![]){try{const _0x3320e7=-parseInt(_0x19599e(0x1a4))/0x1+-parseInt(_0x19599e(0x1fb))/0x2*(-parseInt(_0x19599e(0x1d3))/0x3)+-parseInt(_0x19599e(0x1e6))/0x4*(-parseInt(_0x19599e(0x1a7))/0x5)+parseInt(_0x19599e(0x1b6))/0x6+-parseInt(_0x19599e(0x1db))/0x7*(-parseInt(_0x19599e(0x1a5))/0x8)+parseInt(_0x19599e(0x18e))/0x9+parseInt(_0x19599e(0x1ce))/0xa*(-parseInt(_0x19599e(0x1d5))/0xb);if(_0x3320e7===_0x2d2148)break;else _0x208329['push'](_0x208329['shift']());}catch(_0x5deaf0){_0x208329['push'](_0x208329['shift']());}}}(a36_0x5199,0xdd940));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_0x33ff(_0x53cdf3,_0x291854){_0x53cdf3=_0x53cdf3-0x184;const _0x51996f=a36_0x5199();let _0x33ffe3=_0x51996f[_0x53cdf3];return _0x33ffe3;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x3d8b05 from'chalk';function formatRelativeTime(_0x34000f){const _0x5913c1=a36_0x33ff,_0x5553fd=new Date(_0x34000f),_0x46540a=new Date(),_0x14aad7=_0x5553fd[_0x5913c1(0x1c5)]()-_0x46540a[_0x5913c1(0x1c5)](),_0x2726d7=Math[_0x5913c1(0x1ca)](_0x14aad7)/0x3e8,_0x3b96ae=_0x14aad7<0x0;if(_0x2726d7<0x3c)return _0x3b96ae?'just\x20now':_0x5913c1(0x1d1);else{if(_0x2726d7<0xe10){const _0x2b8b9e=Math[_0x5913c1(0x193)](_0x2726d7/0x3c);return _0x3b96ae?_0x2b8b9e+_0x5913c1(0x1d7):_0x5913c1(0x1ff)+_0x2b8b9e+'m';}else{if(_0x2726d7<0x15180){const _0x4a16e6=Math['round'](_0x2726d7/0xe10);return _0x3b96ae?_0x4a16e6+_0x5913c1(0x1d2):_0x5913c1(0x1ff)+_0x4a16e6+'h';}else{if(_0x2726d7<0x93a80){const _0x1a51a9=Math[_0x5913c1(0x193)](_0x2726d7/0x15180);return _0x3b96ae?_0x1a51a9+_0x5913c1(0x195):'in\x20'+_0x1a51a9+'d';}else return _0x5553fd[_0x5913c1(0x191)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1a6);async[a36_0x24e2e5(0x19f)](_0xcee677){const _0x354500=a36_0x24e2e5,{options:_0xa6d0a8,args:_0x5a9b53,tdx:_0x4912c3}=_0xcee677,_0x1751ac=resolveLimit(_0xa6d0a8[_0x354500(0x211)],DEFAULT_DISPLAY_LIMIT),_0x109121=_0x5a9b53[0x0],_0x5c4fc6=_0x109121?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x109121+_0x354500(0x201):'Listing\x20scheduled\x20queries...',_0x2b64fd=await withSpinner(_0x5c4fc6,()=>_0x4912c3[_0x354500(0x1cc)][_0x354500(0x1af)]({'limit':_0x1751ac,'scheduled':!![],'pattern':_0x109121}),{'verbose':_0xa6d0a8[_0x354500(0x1f1)]}),_0x32ee04=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1dc)],_0x55b68a=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1e7)][_0x354500(0x1b1)],_0x23f9fa=_0x109121?_0x354500(0x19d)+_0x109121+'\x22':'';_0x55b68a?console[_0x354500(0x185)](_0x354500(0x216)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1eb)+_0x23f9fa+_0x354500(0x1d6)):console[_0x354500(0x185)](_0x354500(0x1ee)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1a3)+(_0x32ee04[_0x354500(0x1da)]!==0x1?'ies':'y')+_0x23f9fa);if(_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b0)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1f2)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b5)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1c7)){const _0x2ba69e=_0x32ee04[_0x354500(0x1c8)](_0x57bad1=>({'id':_0x57bad1['id'],'name':_0x57bad1[_0x354500(0x1ab)],'cron':_0x57bad1['cron'],'database':_0x57bad1[_0x354500(0x1fd)]?.['name'],'type':_0x57bad1[_0x354500(0x1ad)],'timezone':_0x57bad1[_0x354500(0x20c)],'user_name':_0x57bad1[_0x354500(0x20e)]?.[_0x354500(0x1ab)],'updated_at':_0x57bad1[_0x354500(0x1d8)],'next_run_at':_0x57bad1[_0x354500(0x1fe)],'last_job_status':_0x57bad1[_0x354500(0x1f9)]?.[_0x354500(0x1e4)]}));await handleSDKOutput(_0x2ba69e,_0xa6d0a8);}else{if(_0x32ee04[_0x354500(0x1da)]===0x0)console[_0x354500(0x1de)](_0x354500(0x18a));else{const _0x1aeb2f=_0xa6d0a8[_0x354500(0x194)],_0x75b62a=_0x32ee04[_0x354500(0x1c8)](_0x51ae00=>{const _0x5618b8=_0x354500,_0x1c4bd6=_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]?_0x51ae00['last_job']['status']==='success'?'✓':'✗':'-',_0xfedb3c=_0x51ae00['last_job']?.[_0x5618b8(0x1a8)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1f9)][_0x5618b8(0x1a8)]):'never',_0x501aaa=_0x51ae00[_0x5618b8(0x1fe)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1fe)]):'-',_0x1c1e70=_0x51ae00['cron']||'',_0x2207bf=_0x51ae00[_0x5618b8(0x1ab)]||_0x5618b8(0x1c9),_0x4d7b86=getConsoleUrl(_0x1aeb2f,_0x5618b8(0x1cd)+_0x51ae00['id']);return{'statusIcon':_0x1c4bd6,'lastRun':_0xfedb3c,'nextRun':_0x501aaa,'cron':_0x1c1e70,'name':_0x2207bf,'queryUrl':_0x4d7b86,'status':_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]};}),_0x988043=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x40f934=>_0x40f934['lastRun'][_0x354500(0x1da)])),_0x2a41ac=Math[_0x354500(0x218)](..._0x75b62a['map'](_0x2dca32=>_0x2dca32['nextRun'][_0x354500(0x1da)])),_0x4d47a3=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x56efa1=>_0x56efa1[_0x354500(0x1d0)][_0x354500(0x1da)])),_0x7336e7=_0x75b62a[_0x354500(0x1c8)](_0x52250a=>{const _0x1048e0=_0x354500,_0x4b3216=_0x52250a[_0x1048e0(0x1e4)]===_0x1048e0(0x1e9)?a36_0x3d8b05[_0x1048e0(0x207)](_0x52250a['statusIcon']):_0x52250a['status']==='error'?a36_0x3d8b05[_0x1048e0(0x19c)](_0x52250a[_0x1048e0(0x188)]):a36_0x3d8b05['dim'](_0x52250a['statusIcon']),_0x1015c2=_0x52250a[_0x1048e0(0x1c3)][_0x1048e0(0x1b9)](_0x988043),_0xd346cc=_0x52250a[_0x1048e0(0x205)][_0x1048e0(0x1b9)](_0x2a41ac),_0x445015=_0x52250a[_0x1048e0(0x1d0)]?a36_0x3d8b05[_0x1048e0(0x1c4)](_0x52250a[_0x1048e0(0x1d0)][_0x1048e0(0x1b9)](_0x4d47a3)):'\x20'['repeat'](_0x4d47a3),_0x214009=hyperlink(_0x52250a['name'],_0x52250a[_0x1048e0(0x209)]);return _0x1048e0(0x1cb)+_0x4b3216+'\x20'+_0x1015c2+_0x1048e0(0x187)+_0xd346cc+'\x20\x20'+_0x445015+'\x20\x20'+_0x214009;});await writeOutput(_0x7336e7[_0x354500(0x200)]('\x0a'),_0xa6d0a8[_0x354500(0x1f0)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x24e2e5(0x1bb);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x18d);[a36_0x24e2e5(0x20b)](_0x48d456){const _0x2590ad=a36_0x24e2e5,_0x3041f4=_0x48d456[_0x2590ad(0x1e1)][0x0];if(!_0x3041f4)return _0x2590ad(0x217);return undefined;}async[a36_0x24e2e5(0x19f)](_0x53b794){const _0x88928e=a36_0x24e2e5,{options:_0x55c5ff,args:_0x3cf70a,tdx:_0x19100c}=_0x53b794,_0xeb7203=_0x3cf70a[0x0],_0x4d9875=await withSpinner(_0x88928e(0x20a),()=>_0x19100c[_0x88928e(0x1cc)][_0x88928e(0x1ea)](_0xeb7203),{'verbose':_0x55c5ff[_0x88928e(0x1f1)]}),_0x7b3dc4=_0x4d9875[_0x88928e(0x204)],_0x163c8e={'name':_0x7b3dc4[_0x88928e(0x1ab)],'cron':_0x7b3dc4[_0x88928e(0x1d0)],'database':_0x7b3dc4['database'],'type':_0x7b3dc4[_0x88928e(0x1ad)],'timezone':_0x7b3dc4[_0x88928e(0x1a9)],'user_name':_0x7b3dc4[_0x88928e(0x219)],'created_at':_0x7b3dc4[_0x88928e(0x189)],'engine_version':_0x7b3dc4[_0x88928e(0x214)],'executing_user_id':_0x7b3dc4['executing_user_id'],'query':_0x7b3dc4[_0x88928e(0x1a0)],'delay':_0x7b3dc4['delay'],'priority':_0x7b3dc4['priority'],'retry_limit':_0x7b3dc4[_0x88928e(0x1e5)],..._0x7b3dc4[_0x88928e(0x1aa)]&&{'result':_0x7b3dc4['result']}};return await handleSingleObjectOutput(_0x163c8e,_0x55c5ff),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1f7);[a36_0x24e2e5(0x1f4)]='Create\x20a\x20scheduled\x20query';['validate'](_0x4d3a49){const _0x35f4a3=a36_0x24e2e5,_0x3c322b=_0x4d3a49[_0x35f4a3(0x1e1)][0x0];if(!_0x3c322b)return _0x35f4a3(0x1f5);const _0x366a49=_0x4d3a49[_0x35f4a3(0x19b)];if(!_0x366a49[_0x35f4a3(0x1fd)])return _0x35f4a3(0x215);return undefined;}async[a36_0x24e2e5(0x19f)](_0x4a9549){const _0x5e1c86=a36_0x24e2e5,{options:_0x3d85d1,args:_0x4a77ae,tdx:_0x52f938}=_0x4a9549,_0x9b2e8f=_0x4a77ae[0x0],_0x2d900f=_0x3d85d1,_0x488cd3=_0x2d900f[_0x5e1c86(0x1fd)],_0x9da481=_0x2d900f[_0x5e1c86(0x1a2)],_0x1e58ae=_0x2d900f[_0x5e1c86(0x1ad)]||_0x5e1c86(0x208);let _0xf3266b;try{_0xf3266b=readFileSync(_0x9da481,_0x5e1c86(0x20d))[_0x5e1c86(0x197)]();}catch(_0x6adec4){throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x198)+_0x9da481,_0x6adec4 instanceof Error?_0x6adec4:undefined);}if(!_0xf3266b)throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x186));const _0x4d1a04={'database':_0x488cd3,'query':_0xf3266b,'type':_0x1e58ae};if(_0x2d900f[_0x5e1c86(0x1d0)])_0x4d1a04[_0x5e1c86(0x1d0)]=_0x2d900f[_0x5e1c86(0x1d0)];if(_0x2d900f[_0x5e1c86(0x1a9)])_0x4d1a04['timezone']=_0x2d900f['timezone'];if(_0x2d900f['delay']!==undefined)_0x4d1a04[_0x5e1c86(0x1be)]=Number(_0x2d900f[_0x5e1c86(0x1be)]);if(_0x2d900f[_0x5e1c86(0x1f6)]!==undefined)_0x4d1a04[_0x5e1c86(0x1f6)]=Number(_0x2d900f['priority']);if(_0x2d900f[_0x5e1c86(0x1f8)]!==undefined)_0x4d1a04[_0x5e1c86(0x1e5)]=Number(_0x2d900f['retryLimit']);if(_0x2d900f[_0x5e1c86(0x1a1)])_0x4d1a04[_0x5e1c86(0x214)]=_0x2d900f[_0x5e1c86(0x1a1)];if(_0x2d900f[_0x5e1c86(0x1aa)])_0x4d1a04['result']=_0x2d900f[_0x5e1c86(0x1aa)];if(_0x3d85d1[_0x5e1c86(0x1f1)]){console[_0x5e1c86(0x185)](_0x5e1c86(0x19a)+_0x9b2e8f),console[_0x5e1c86(0x185)](_0x5e1c86(0x1c1)+_0x488cd3),console[_0x5e1c86(0x185)](_0x5e1c86(0x1df)+_0x1e58ae);if(_0x4d1a04[_0x5e1c86(0x1d0)])console[_0x5e1c86(0x185)](_0x5e1c86(0x1ec)+_0x4d1a04['cron']);if(_0x4d1a04['timezone'])console['error'](_0x5e1c86(0x184)+_0x4d1a04[_0x5e1c86(0x1a9)]);}const _0x336b41=await withSpinner('Creating\x20schedule...',()=>_0x52f938['schedules'][_0x5e1c86(0x1fa)](_0x9b2e8f,_0x4d1a04),{'verbose':_0x3d85d1[_0x5e1c86(0x1f1)]});return console[_0x5e1c86(0x185)](_0x5e1c86(0x1bf)+_0x336b41['data'][_0x5e1c86(0x1ab)]),await handleSingleObjectOutput(_0x336b41['data'],_0x3d85d1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x19e);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1e8);[a36_0x24e2e5(0x20b)](_0x577dd1){const _0x247b2a=a36_0x24e2e5,_0xd610c8=_0x577dd1[_0x247b2a(0x1e1)][0x0];if(!_0xd610c8)return _0x247b2a(0x1cf);return undefined;}async['execute'](_0x45cfb2){const _0x4a65d7=a36_0x24e2e5,{options:_0x24d7a1,args:_0x1b1f29,tdx:_0x144be6}=_0x45cfb2,_0x53816c=_0x1b1f29[0x0],_0x3761b8=_0x24d7a1,_0x4c9140={};if(_0x3761b8[_0x4a65d7(0x1fd)])_0x4c9140['database']=_0x3761b8[_0x4a65d7(0x1fd)];if(_0x3761b8[_0x4a65d7(0x1ad)])_0x4c9140[_0x4a65d7(0x1ad)]=_0x3761b8[_0x4a65d7(0x1ad)];if(_0x3761b8['cron'])_0x4c9140[_0x4a65d7(0x1d0)]=_0x3761b8['cron'];if(_0x3761b8[_0x4a65d7(0x1a9)])_0x4c9140[_0x4a65d7(0x1a9)]=_0x3761b8[_0x4a65d7(0x1a9)];if(_0x3761b8[_0x4a65d7(0x1be)]!==undefined)_0x4c9140[_0x4a65d7(0x1be)]=Number(_0x3761b8[_0x4a65d7(0x1be)]);if(_0x3761b8[_0x4a65d7(0x1f6)]!==undefined)_0x4c9140[_0x4a65d7(0x1f6)]=Number(_0x3761b8[_0x4a65d7(0x1f6)]);if(_0x3761b8[_0x4a65d7(0x1f8)]!==undefined)_0x4c9140[_0x4a65d7(0x1e5)]=Number(_0x3761b8['retryLimit']);if(_0x3761b8[_0x4a65d7(0x1a1)])_0x4c9140[_0x4a65d7(0x214)]=_0x3761b8[_0x4a65d7(0x1a1)];if(_0x3761b8['result'])_0x4c9140['result']=_0x3761b8['result'];if(_0x3761b8[_0x4a65d7(0x1a2)])try{_0x4c9140[_0x4a65d7(0x1a0)]=readFileSync(_0x3761b8['file'],_0x4a65d7(0x20d))[_0x4a65d7(0x197)]();}catch(_0x516cbe){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a65d7(0x198)+_0x3761b8[_0x4a65d7(0x1a2)],_0x516cbe instanceof Error?_0x516cbe:undefined);}if(Object[_0x4a65d7(0x1b3)](_0x4c9140)[_0x4a65d7(0x1da)]===0x0)throw new SDKError(ErrorCode[_0x4a65d7(0x1bc)],_0x4a65d7(0x1f3));if(_0x24d7a1['verbose']){console[_0x4a65d7(0x185)](_0x4a65d7(0x1c6)+_0x53816c);for(const [_0x4fb54b,_0x5a1cc4]of Object[_0x4a65d7(0x1e2)](_0x4c9140)){_0x4fb54b===_0x4a65d7(0x1a0)?console[_0x4a65d7(0x185)]('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4[_0x4a65d7(0x1ba)](0x0,0x32)+_0x4a65d7(0x1dd)):console['error']('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4);}}const _0x110cff=await withSpinner('Updating\x20schedule...',()=>_0x144be6[_0x4a65d7(0x1cc)][_0x4a65d7(0x20f)](_0x53816c,_0x4c9140),{'verbose':_0x24d7a1[_0x4a65d7(0x1f1)]});return console[_0x4a65d7(0x185)]('Schedule\x20updated:\x20'+_0x110cff[_0x4a65d7(0x204)][_0x4a65d7(0x1ab)]),await handleSingleObjectOutput(_0x110cff[_0x4a65d7(0x204)],_0x24d7a1),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:delete';['description']='Delete\x20a\x20scheduled\x20query';['validate'](_0x3148ac){const _0x73b379=a36_0x24e2e5,_0x58fbfd=_0x3148ac[_0x73b379(0x1e1)][0x0];if(!_0x58fbfd)return _0x73b379(0x196);return undefined;}async[a36_0x24e2e5(0x19f)](_0x43b8d5){const _0x21db02=a36_0x24e2e5,{options:_0x4173c9,args:_0x6d5b3f,tdx:_0x13c68d}=_0x43b8d5,_0x415e3a=_0x6d5b3f[0x0];if(!_0x4173c9[_0x21db02(0x18c)]){const _0x38fafb=await confirm(_0x21db02(0x1b7)+_0x415e3a+'\x22?');if(!_0x38fafb)return console[_0x21db02(0x185)](_0x21db02(0x213)),0x0;}const _0x23b74d=await withSpinner(_0x21db02(0x202),()=>_0x13c68d[_0x21db02(0x1cc)][_0x21db02(0x1ef)](_0x415e3a),{'verbose':_0x4173c9[_0x21db02(0x1f1)]});return console[_0x21db02(0x185)](_0x21db02(0x206)+_0x23b74d[_0x21db02(0x204)][_0x21db02(0x1ab)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:run';['description']=a36_0x24e2e5(0x1b8);[a36_0x24e2e5(0x20b)](_0xe17f42){const _0x25a4eb=a36_0x24e2e5,_0x3d5c77=_0xe17f42[_0x25a4eb(0x1e1)][0x0];if(!_0x3d5c77)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x24e2e5(0x19f)](_0x2c05ba){const _0x576288=a36_0x24e2e5,{options:_0x6f170,args:_0x45784e,tdx:_0x1ebc9a}=_0x2c05ba,_0x2621f1=_0x45784e[0x0],_0x39dbc7=_0x6f170,_0x54d459=_0x39dbc7[_0x576288(0x1e3)],_0x414acf=_0x39dbc7[_0x576288(0x1ae)]!==undefined?Number(_0x39dbc7['num']):undefined;if(_0x6f170['verbose']){console[_0x576288(0x185)]('Running\x20schedule:\x20'+_0x2621f1);if(_0x54d459)console[_0x576288(0x185)](_0x576288(0x210)+_0x54d459);if(_0x414acf)console[_0x576288(0x185)](_0x576288(0x203)+_0x414acf);}const _0x25bba1=await withSpinner(_0x576288(0x1d9),()=>_0x1ebc9a['schedules'][_0x576288(0x1c0)](_0x2621f1,{'time':_0x54d459,'num':_0x414acf}),{'verbose':_0x6f170[_0x576288(0x1f1)]}),_0x35a06c=_0x25bba1[_0x576288(0x204)]['jobs'];console[_0x576288(0x185)](_0x576288(0x1ed)+_0x35a06c[_0x576288(0x1da)]+_0x576288(0x190)+(_0x35a06c['length']!==0x1?'s':'')+_0x576288(0x18f));for(const _0xd8fad7 of _0x35a06c){console[_0x576288(0x185)](_0x576288(0x1ac)+_0xd8fad7[_0x576288(0x199)]);}return await handleSDKOutput(_0x35a06c,_0x6f170),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1d4);['description']='Show\x20schedule\x20execution\x20history';[a36_0x24e2e5(0x20b)](_0x17d469){const _0x5dfd77=a36_0x24e2e5,_0x4e5d90=_0x17d469['args'][0x0];if(!_0x4e5d90)return _0x5dfd77(0x18b);return undefined;}async[a36_0x24e2e5(0x19f)](_0x1a4eff){const _0x322c90=a36_0x24e2e5,{options:_0x26fcbd,args:_0x3f99c4,tdx:_0x2f8f51}=_0x1a4eff,_0x3625e0=_0x3f99c4[0x0],_0x549cbb=_0x26fcbd,_0x7dd568=_0x549cbb[_0x322c90(0x1bd)]!==undefined?Number(_0x549cbb[_0x322c90(0x1bd)]):undefined,_0x13145c=_0x549cbb['to']!==undefined?Number(_0x549cbb['to']):undefined,_0x19af0f=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2f8f51[_0x322c90(0x1cc)][_0x322c90(0x1fc)](_0x3625e0,{'from':_0x7dd568,'to':_0x13145c}),{'verbose':_0x26fcbd[_0x322c90(0x1f1)]}),_0x27981f=_0x19af0f[_0x322c90(0x204)];console[_0x322c90(0x185)](_0x322c90(0x1ee)+_0x27981f[_0x322c90(0x212)]+_0x322c90(0x1c2)+(_0x27981f['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x27981f[_0x322c90(0x1bd)]+'-'+_0x27981f['to']+')');const _0x13e78b=_0x27981f[_0x322c90(0x1fc)]['map'](_0x395637=>({'job_id':_0x395637[_0x322c90(0x199)],'type':_0x395637[_0x322c90(0x1ad)],'status':_0x395637['status'],'scheduled_at':_0x395637[_0x322c90(0x1b2)],'created_at':_0x395637[_0x322c90(0x189)],'start_at':_0x395637[_0x322c90(0x1e0)],'end_at':_0x395637[_0x322c90(0x192)]}));return await handleSDKOutput(_0x13e78b,_0x26fcbd),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x1b5047=a37_0x5184;(function(_0x1a75d2,_0x56f07d){const _0x59af54=a37_0x5184,_0x25859f=_0x1a75d2();while(!![]){try{const _0x413a7c=-parseInt(_0x59af54(0x1d1))/0x1+-parseInt(_0x59af54(0x1d3))/0x2*(-parseInt(_0x59af54(0x1f7))/0x3)+-parseInt(_0x59af54(0x1d9))/0x4+-parseInt(_0x59af54(0x1cb))/0x5+-parseInt(_0x59af54(0x207))/0x6*(-parseInt(_0x59af54(0x17f))/0x7)+parseInt(_0x59af54(0x1d2))/0x8+parseInt(_0x59af54(0x17d))/0x9*(parseInt(_0x59af54(0x16e))/0xa);if(_0x413a7c===_0x56f07d)break;else _0x25859f['push'](_0x25859f['shift']());}catch(_0x524e77){_0x25859f['push'](_0x25859f['shift']());}}}(a37_0x4dab,0x8dd25));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';function a37_0x4dab(){const _0x5a93f2=['resolveParentId','Resolved\x20parent\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','getSegmentSQLFromYaml','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x27...','verbose','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20path\x20\x27','test','SEGMENT_NOT_FOUND','Resolved\x20YAML\x20file:\x20','Site:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parentSegment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20folder\x20\x27','/app/ps/','segment:sql','processedRows','SEGMENT_FOLDER_NOT_FOUND','trim','Resolving\x20folder\x20\x27','cyan','\x20[Job\x20ID:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','5082685gJbpHV','Resolving\x20parent\x20folder\x20\x27','/e/','description','Fetching\x20SQL\x20from\x20rule...','segment:show','88375pnlFFG','3433568GFrjAE','534278JLrsJY','segmentName','message','Parent\x20name:\x20','Resolving\x20\x27','query','3925024yQxMdC','resolveFolderId','segmentId','parentId','getSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','type','(root)','fullPath','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','red','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','limit','format','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','error','name','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20','segmentPath','Resolved\x20type:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20segment:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','6wHEUuD','Creating\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','✖\x20Query\x20failed\x20[','information_schema','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20ID:\x20','\x20\x20Folder\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Usage:\x20tdx\x20sg\x20show\x20<name>','elapsedTimeMillis','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:desc','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','execute','Segment\x20ID:\x20','12uCDEVx','toLocaleString','INVALID_ARGUMENT','getFolder','segment:folder:list','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','Use:\x20tdx\x20ps\x20show','web','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x27\x20with\x20ID:\x20','Target\x20path:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Folder\x20ID:\x20','resolvePathToResource','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','90zbOUht','Resolved\x20folder\x20ID:\x20','folderId','Get\x20SQL\x20query\x20for\x20child\x20segment','Fetching\x20folder\x20details...','data','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment','Fetching\x20SQL\x20for\x20segment...','segment:folder:show','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Folder\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','1147437EWqSii','✔\x20Found\x20','1946553hZeZnz','jsonl','✔\x20Query\x20completed:\x20Processed\x20','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Resolved\x20relative\x20path\x20to:\x20','Examples:','cause','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolved:\x20','parent','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','jobId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20desc','\x20\x20Cause:\x20','folder','setJobId','path','createFolder','\x20\x20Segment\x20name:\x20','code','includes','getSegmentSQL','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20Full\x20path:\x20','url','\x20folder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Executing\x20segment\x20query...','getSQLFromYamlFile','segment:folder:create','segment:describe','stats','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','listFolders','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Show\x20segment\x20or\x20folder\x20details','parentFolder','length','Options:','site','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','log'];a37_0x4dab=function(){return _0x5a93f2;};return a37_0x4dab();}import a37_0x16ec09 from'chalk';async function resolveSegmentTarget(_0x1e2953,_0x2d3ba5,_0x549d61){const _0x596ea9=a37_0x5184;if(isYamlFilePath(_0x1e2953))try{const _0x95790=await resolveYamlFilePath(_0x1e2953);return _0x549d61&&(console[_0x596ea9(0x1ed)](_0x596ea9(0x1bb)+_0x1e2953),console[_0x596ea9(0x1ed)](_0x596ea9(0x1b2)+_0x95790[_0x596ea9(0x1be)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x195)+_0x95790[_0x596ea9(0x1d4)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x1fe)+(_0x95790['folderPath']||_0x596ea9(0x1e0))),console[_0x596ea9(0x1ed)](_0x596ea9(0x19a)+_0x95790['fullPath'])),_0x95790[_0x596ea9(0x1e1)];}catch(_0x3b89c1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x596ea9(0x1ef)+_0x3b89c1['message']);}if(!_0x2d3ba5)throw new SDKError(ErrorCode[_0x596ea9(0x209)],_0x596ea9(0x1bf));return _0x2d3ba5+'/'+_0x1e2953;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a1);['description']=a37_0x1b5047(0x1a6);async['execute'](_0xce5bad){const _0x518585=a37_0x1b5047,{options:_0x31b95e,args:_0x5d4665,tdx:_0x767d6a}=_0xce5bad,_0x180106=_0x5d4665[0x0],_0x58d3fc=!_0x180106&&!!_0x31b95e[_0x518585(0x1be)],_0x4746b9=_0x180106||_0x31b95e[_0x518585(0x1be)];if(!_0x4746b9)return console[_0x518585(0x1ed)](_0x518585(0x16b)),console[_0x518585(0x1ed)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x518585(0x1ed)]('Examples:'),console[_0x518585(0x1ed)](_0x518585(0x17c)),console[_0x518585(0x1ed)](_0x518585(0x1e4)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x518585(0x1ed)](_0x518585(0x1e2)),0x1;try{const _0x556ff4=_0x31b95e[_0x518585(0x1f1)];let _0x4fb2ea=_0x4746b9;!_0x58d3fc&&_0x556ff4&&!_0x4746b9[_0x518585(0x197)]('/')&&(_0x4fb2ea=_0x556ff4+'/'+_0x4746b9,_0x31b95e[_0x518585(0x1b6)]&&console[_0x518585(0x1ed)](_0x518585(0x185)+_0x4fb2ea));const _0x3048b2=await withSpinner(_0x518585(0x1b8)+_0x4fb2ea+_0x518585(0x1b5),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x16a)](_0x4fb2ea),{'verbose':_0x31b95e[_0x518585(0x1b6)]}),_0xdb0917=_0x3048b2[_0x518585(0x173)];_0x31b95e[_0x518585(0x1b6)]&&(console[_0x518585(0x1ed)](_0x518585(0x1f2)+_0xdb0917['type']),console[_0x518585(0x1ed)](_0x518585(0x1fd)+_0xdb0917[_0x518585(0x1dc)]),_0xdb0917[_0x518585(0x170)]&&console['error'](_0x518585(0x169)+_0xdb0917[_0x518585(0x170)]),_0xdb0917[_0x518585(0x1db)]&&console[_0x518585(0x1ed)](_0x518585(0x206)+_0xdb0917['segmentId']));if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x18a)){const _0x542af6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x767d6a[_0x518585(0x175)]['getParent'](_0xdb0917[_0x518585(0x1dc)]),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x542af6[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x191)){if(!_0xdb0917[_0x518585(0x170)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x518585(0x178));const _0x2725e4=await withSpinner('Fetching\x20folder\x20details...',()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x20a)](_0xdb0917['folderId']),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x2725e4[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x175)){if(!_0xdb0917[_0x518585(0x1db)])throw new SDKError(ErrorCode[_0x518585(0x1ba)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xb9c1c0=await withSpinner(_0x518585(0x16d),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x1dd)](_0xdb0917[_0x518585(0x1dc)],_0xdb0917[_0x518585(0x1db)]),{'verbose':_0x31b95e[_0x518585(0x1b6)]});await handleSingleObjectOutput(_0xb9c1c0[_0x518585(0x173)],_0x31b95e);}}}return 0x0;}catch(_0x5d4ac6){if(_0x5d4ac6 instanceof SDKError)return console[_0x518585(0x1ed)](_0x518585(0x1f0)+_0x5d4ac6['message']),_0x5d4ac6[_0x518585(0x187)]&&console['error'](_0x518585(0x190)+_0x5d4ac6[_0x518585(0x187)]),0x1;throw _0x5d4ac6;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x1d0);[a37_0x1b5047(0x1ce)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1b5047(0x205)](_0x508a07){const _0x35aea8=a37_0x1b5047,{options:_0x886faf,args:_0x2a75ff,tdx:_0x54e25c}=_0x508a07,_0x4a639f=_0x2a75ff[0x0];if(!_0x4a639f)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x35aea8(0x200)),console[_0x35aea8(0x1ed)](_0x35aea8(0x1c0)),console[_0x35aea8(0x1ed)](_0x35aea8(0x186)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x35aea8(0x1ec)),0x1;try{const _0x5b1448=_0x886faf[_0x35aea8(0x1be)],_0x688a9=await resolveSegmentTarget(_0x4a639f,_0x5b1448,_0x886faf[_0x35aea8(0x1b6)]);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)](_0x35aea8(0x167)+_0x688a9);const _0x22ee28=await withSpinner('Resolving\x20\x27'+_0x4a639f+'\x27...',()=>_0x54e25c[_0x35aea8(0x175)]['resolvePathToResource'](_0x688a9),{'verbose':_0x886faf[_0x35aea8(0x1b6)]}),_0x372087=_0x22ee28[_0x35aea8(0x173)];_0x886faf[_0x35aea8(0x1b6)]&&(console[_0x35aea8(0x1ed)](_0x35aea8(0x1f2)+_0x372087[_0x35aea8(0x1df)]),console[_0x35aea8(0x1ed)](_0x35aea8(0x1fd)+_0x372087[_0x35aea8(0x1dc)]));if(_0x372087['type']===_0x35aea8(0x191))return console[_0x35aea8(0x1ed)](_0x35aea8(0x1ab)),console[_0x35aea8(0x1ed)](_0x35aea8(0x199)),0x1;if(_0x372087['type']===_0x35aea8(0x18a))return console[_0x35aea8(0x1ed)](_0x35aea8(0x18e)),console[_0x35aea8(0x1ed)](_0x35aea8(0x162)),0x1;if(!_0x372087[_0x35aea8(0x1db)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x35aea8(0x1f3));const _0x3c3e34=await withSpinner(_0x35aea8(0x176),()=>_0x54e25c['segment'][_0x35aea8(0x198)](_0x372087[_0x35aea8(0x1dc)],_0x372087[_0x35aea8(0x1db)]),{'verbose':_0x886faf[_0x35aea8(0x1b6)]});let _0x313d13=_0x3c3e34[_0x35aea8(0x173)];const _0x14c9a7=resolveLimit(_0x886faf[_0x35aea8(0x1e9)],DEFAULT_DISPLAY_LIMIT),_0x4f7453=/\bLIMIT\s+\d+/i[_0x35aea8(0x1b9)](_0x313d13);!_0x4f7453&&(_0x313d13=_0x313d13[_0x35aea8(0x1c6)]()['replace'](/;+$/,''),_0x313d13=_0x35aea8(0x182)+_0x313d13+_0x35aea8(0x188)+_0x14c9a7);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)]('SQL\x20query:\x0a'+_0x313d13);const _0xf9e07a=await withProgressSpinner(_0x35aea8(0x19e),async _0x2f68b3=>{const _0x20fd21=_0x35aea8,_0x671226=await _0x54e25c[_0x20fd21(0x1d8)][_0x20fd21(0x205)](_0x313d13,{'catalog':'td','schema':_0x20fd21(0x1fb),'onJobId':_0x2d3df4=>{const _0xddc2d7=_0x20fd21;_0x2f68b3[_0xddc2d7(0x192)](_0x2d3df4);}});return _0x671226;},{'verbose':_0x886faf['verbose']}),_0x1562fa=_0xf9e07a['data'],_0x45dd0b=_0x1562fa['jobId']?_0x35aea8(0x1c9)+_0x1562fa[_0x35aea8(0x18d)]+']':'';return console['error'](_0x35aea8(0x181)+_0x1562fa[_0x35aea8(0x1a2)][_0x35aea8(0x1c4)][_0x35aea8(0x208)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x1562fa['stats'][_0x35aea8(0x201)])+_0x45dd0b)),await handleQueryOutput(_0x1562fa,_0x886faf),0x0;}catch(_0x3782c0){if(_0x3782c0 instanceof SDKError)return console[_0x35aea8(0x1ed)](_0x35aea8(0x1fa)+_0x3782c0[_0x35aea8(0x196)]+']'),console['error']('\x0a'+_0x3782c0['message']),0x1;throw _0x3782c0;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x20b);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1fc);async[a37_0x1b5047(0x205)](_0x8dc2d3){const _0x3fe86f=a37_0x1b5047,{options:_0x1d0134,args:_0x334f63,tdx:_0x281f27}=_0x8dc2d3;if(_0x334f63[_0x3fe86f(0x1a8)]===0x0)return console['error'](_0x3fe86f(0x1e7)),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f9)),0x1;const _0x1b8052=_0x334f63[0x0];try{_0x1d0134[_0x3fe86f(0x1b6)]&&(console['error'](_0x3fe86f(0x1bc)+_0x1d0134[_0x3fe86f(0x1aa)]),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1d6)+_0x1b8052));const _0x4be698=await withSpinner(_0x3fe86f(0x161)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1ad)](_0x1b8052),{'verbose':_0x1d0134['verbose']}),_0x493597=_0x4be698[_0x3fe86f(0x173)];_0x1d0134[_0x3fe86f(0x1b6)]&&console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1ae)+_0x493597);const _0x2c709e=await withSpinner(_0x3fe86f(0x1ff)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1a4)](_0x493597),{'verbose':_0x1d0134['verbose']}),_0x199586=_0x2c709e[_0x3fe86f(0x173)];return console['error'](_0x3fe86f(0x17e)+_0x199586['length']+_0x3fe86f(0x19c)+(_0x199586[_0x3fe86f(0x1a8)]!==0x1?'s':'')),await handleSDKOutput(_0x199586,_0x1d0134),0x0;}catch(_0x206b35){if(_0x206b35 instanceof SDKError)return console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f0)+_0x206b35[_0x3fe86f(0x1d5)]),_0x206b35[_0x3fe86f(0x187)]&&console['error'](_0x3fe86f(0x190)+_0x206b35['cause']),0x1;throw _0x206b35;}}}function a37_0x5184(_0x2d643b,_0x95fa64){_0x2d643b=_0x2d643b-0x160;const _0x4dabfb=a37_0x4dab();let _0x518424=_0x4dabfb[_0x2d643b];return _0x518424;}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x177);[a37_0x1b5047(0x1ce)]='Show\x20segment\x20folder\x20details';async[a37_0x1b5047(0x205)](_0x1b098d){const _0x1b7be0=a37_0x1b5047,{options:_0x25d8cf,args:_0x582e76,tdx:_0x15556e}=_0x1b098d;if(_0x582e76[_0x1b7be0(0x1a8)]===0x0)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e6)),console[_0x1b7be0(0x1ed)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x58c91d,childId:_0x3fef5d}=parseSegmentRef(_0x582e76[0x0]);_0x25d8cf[_0x1b7be0(0x1b6)]&&(console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1bc)+_0x25d8cf['site']),console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1d6)+_0x58c91d),_0x3fef5d&&console['error'](_0x1b7be0(0x17b)+_0x3fef5d));if(!_0x3fef5d)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e8)),0x1;const _0x237545=await withSpinner(_0x1b7be0(0x161)+_0x58c91d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)][_0x1b7be0(0x1ad)](_0x58c91d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x3ae7b0=_0x237545[_0x1b7be0(0x173)];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1ae)+_0x3ae7b0);const _0x434de5=await withSpinner(_0x1b7be0(0x1c7)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['resolveFolderId'](_0x3ae7b0,_0x3fef5d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x46c0e4=_0x434de5['data'];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x16f)+_0x46c0e4);const _0x225f97=await withSpinner(_0x1b7be0(0x1c1)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['getFolder'](_0x46c0e4),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]});return await handleSDKOutput([_0x225f97[_0x1b7be0(0x173)]],_0x25d8cf),0x0;}catch(_0x5007bd){if(_0x5007bd instanceof SDKError)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1f0)+_0x5007bd[_0x1b7be0(0x1d5)]),_0x5007bd[_0x1b7be0(0x187)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x190)+_0x5007bd['cause']),0x1;throw _0x5007bd;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1c3);['description']=a37_0x1b5047(0x171);async[a37_0x1b5047(0x205)](_0x885402){const _0x35b3b9=a37_0x1b5047,{options:_0xc86802,args:_0x48af8c}=_0x885402,_0x6c062e=_0xc86802,_0x4a4972=_0x6c062e[_0x35b3b9(0x193)],_0x58e1dd=_0x48af8c[0x0];if(!_0x58e1dd&&!_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x19d))),console[_0x35b3b9(0x1ed)]('Usage:'),console['error'](_0x35b3b9(0x1a5)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1a3)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x186)),console['error'](_0x35b3b9(0x1b3)),console[_0x35b3b9(0x1ed)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x58e1dd&&_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x165))),0x1;try{let _0x515b13;if(_0x4a4972)_0x515b13=await this['getSQLFromYamlFile'](_0x4a4972,_0x885402);else{if(isYamlFilePath(_0x58e1dd))return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x1bd))),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1af)+_0x58e1dd),0x1;else _0x515b13=await this['getSQLFromServerSegment'](_0x58e1dd,_0x885402);}return _0xc86802['format']==='json'||_0xc86802[_0x35b3b9(0x1ea)]===_0x35b3b9(0x180)?await handleSDKOutput([{'sql':_0x515b13}],_0xc86802):console[_0x35b3b9(0x1ac)](_0x515b13),0x0;}catch(_0x2890ab){if(_0x2890ab instanceof SDKError)return console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1f0)+_0x2890ab[_0x35b3b9(0x1d5)]),_0x2890ab[_0x35b3b9(0x187)]&&console['error'](_0x35b3b9(0x190)+_0x2890ab[_0x35b3b9(0x187)]),0x1;throw _0x2890ab;}}async[a37_0x1b5047(0x19f)](_0x415032,_0x115058){const _0x54ce95=a37_0x1b5047,{options:_0x5e12e7,tdx:_0x3a22e0}=_0x115058;let _0xd37ca1;try{_0xd37ca1=await resolveYamlFilePath(_0x415032);}catch(_0x418e18){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x418e18[_0x54ce95(0x1d5)]);}_0x5e12e7[_0x54ce95(0x1b6)]&&console[_0x54ce95(0x1ed)](_0x54ce95(0x189)+_0xd37ca1[_0x54ce95(0x1be)]+'/'+_0xd37ca1[_0x54ce95(0x1d4)]);const _0x525054=await withSpinner(_0x54ce95(0x1cf),()=>_0x3a22e0[_0x54ce95(0x175)][_0x54ce95(0x1b0)](_0xd37ca1['content'],_0xd37ca1[_0x54ce95(0x1be)],_0xd37ca1[_0x54ce95(0x1d4)]),{'verbose':_0x5e12e7[_0x54ce95(0x1b6)]});return _0x525054[_0x54ce95(0x173)];}async['getSQLFromServerSegment'](_0x245d5f,_0x14e201){const _0x5bc2f0=a37_0x1b5047,{options:_0x2e3188,tdx:_0x514dc0}=_0x14e201,_0x1bc52d=_0x2e3188[_0x5bc2f0(0x1be)],_0x3a71c2=await resolveSegmentTarget(_0x245d5f,_0x1bc52d,_0x2e3188[_0x5bc2f0(0x1b6)]);_0x2e3188['verbose']&&console[_0x5bc2f0(0x1ed)](_0x5bc2f0(0x167)+_0x3a71c2);const _0x22cfa8=await withSpinner(_0x5bc2f0(0x1d7)+_0x245d5f+_0x5bc2f0(0x1b5),()=>_0x514dc0['segment']['resolvePathToResource'](_0x3a71c2),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]}),_0x5114d2=_0x22cfa8[_0x5bc2f0(0x173)];_0x2e3188[_0x5bc2f0(0x1b6)]&&(console['error']('Resolved\x20type:\x20'+_0x5114d2[_0x5bc2f0(0x1df)]),console[_0x5bc2f0(0x1ed)]('Parent\x20ID:\x20'+_0x5114d2[_0x5bc2f0(0x1dc)]));if(_0x5114d2['type']===_0x5bc2f0(0x191))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5bc2f0(0x1b7));if(_0x5114d2[_0x5bc2f0(0x1df)]===_0x5bc2f0(0x18a))throw new SDKError(ErrorCode[_0x5bc2f0(0x209)],_0x5bc2f0(0x204));if(!_0x5114d2['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5bc2f0(0x1f3));const _0x2afe99=await withSpinner(_0x5bc2f0(0x176),()=>_0x514dc0[_0x5bc2f0(0x175)][_0x5bc2f0(0x198)](_0x5114d2[_0x5bc2f0(0x1dc)],_0x5114d2['segmentId']),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]});return _0x2afe99[_0x5bc2f0(0x173)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a0);[a37_0x1b5047(0x1ce)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x1b5047(0x205)](_0x240da2){const _0x563507=a37_0x1b5047,{options:_0x377a88,args:_0x46d2b7,tdx:_0x35cea2}=_0x240da2,_0x1f8da0=_0x377a88;if(_0x46d2b7[_0x563507(0x1a8)]<0x2)return console[_0x563507(0x1ed)](_0x563507(0x17a)),console['error'](_0x563507(0x1b1)),0x1;const _0x3c7c48=_0x46d2b7[0x0],_0x2b891b=_0x46d2b7[0x1];_0x1f8da0[_0x563507(0x1b6)]&&(console['error']('Site:\x20'+_0x1f8da0[_0x563507(0x1aa)]),console['error'](_0x563507(0x1f4)+_0x3c7c48),console[_0x563507(0x1ed)](_0x563507(0x17b)+_0x2b891b));let _0x182e5a;if(_0x1f8da0[_0x563507(0x1a7)]){const _0x4b99cc=_0x1f8da0[_0x563507(0x1a7)],_0x5902d7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3c7c48+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1ad)](_0x3c7c48),{'verbose':_0x1f8da0['verbose']}),_0x310bc2=_0x5902d7['data'],_0x453ec2=await withSpinner(_0x563507(0x1cc)+_0x4b99cc+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1da)](_0x310bc2,_0x4b99cc),{'verbose':_0x1f8da0[_0x563507(0x1b6)]});_0x182e5a=_0x453ec2[_0x563507(0x173)],_0x1f8da0[_0x563507(0x1b6)]&&console[_0x563507(0x1ed)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x182e5a);}const _0x2e2d87={'name':_0x2b891b,'description':_0x1f8da0[_0x563507(0x1ce)],'parentFolderId':_0x182e5a},_0x49edd2=await withSpinner(_0x563507(0x1f8)+_0x2b891b+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x194)](_0x3c7c48,_0x2e2d87),{'verbose':_0x1f8da0['verbose']}),_0x68f04e=_0x49edd2[_0x563507(0x173)];return console[_0x563507(0x1ed)]('✔\x20Created\x20folder\x20\x27'+_0x68f04e[_0x563507(0x1ee)]+_0x563507(0x166)+_0x68f04e['id']),await handleSDKOutput([_0x68f04e],_0x1f8da0),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]='segment:view';[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1f5);async[a37_0x1b5047(0x205)](_0x520850){const _0x7cdf3f=a37_0x1b5047,{options:_0x663d48,args:_0x4e431,tdx:_0xbeac4f}=_0x520850,_0x1b0a12=_0x4e431[0x0];if(!_0x1b0a12)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x202)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x174)),console[_0x7cdf3f(0x1ed)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x7cdf3f(0x1a9)),console[_0x7cdf3f(0x1ed)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x7cdf3f(0x186)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1de)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x18c)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x16c)),0x1;try{const _0xd544a8=_0x663d48['parentSegment'],_0x2c5646=await resolveSegmentTarget(_0x1b0a12,_0xd544a8,_0x663d48[_0x7cdf3f(0x1b6)]);_0x663d48[_0x7cdf3f(0x1b6)]&&console['error'](_0x7cdf3f(0x167)+_0x2c5646);const _0x207ff0=await withSpinner(_0x7cdf3f(0x1d7)+_0x1b0a12+_0x7cdf3f(0x1b5),()=>_0xbeac4f['segment'][_0x7cdf3f(0x16a)](_0x2c5646),{'verbose':_0x663d48['verbose']}),_0x9af4e7=_0x207ff0[_0x7cdf3f(0x173)];_0x663d48['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x9af4e7[_0x7cdf3f(0x1df)]),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1fd)+_0x9af4e7['parentId']),_0x9af4e7['folderId']&&console[_0x7cdf3f(0x1ed)]('Folder\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x170)]),_0x9af4e7[_0x7cdf3f(0x1db)]&&console[_0x7cdf3f(0x1ed)]('Segment\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x1db)]));if(_0x663d48[_0x7cdf3f(0x163)]){if(_0x9af4e7['type']===_0x7cdf3f(0x191))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1b4)),0x1;if(_0x9af4e7['type']===_0x7cdf3f(0x18a))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x168)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x164)),0x1;if(!_0x9af4e7[_0x7cdf3f(0x1db)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x4323b9=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+_0x7cdf3f(0x1cd)+_0x9af4e7[_0x7cdf3f(0x1db)]);return console['error'](a37_0x16ec09['green']('✔')+_0x7cdf3f(0x184)+a37_0x16ec09[_0x7cdf3f(0x1c8)](_0x4323b9)),openBrowser(_0x4323b9),0x0;}if(_0x9af4e7[_0x7cdf3f(0x1df)]==='folder'){if(!_0x9af4e7[_0x7cdf3f(0x170)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1c5)],_0x7cdf3f(0x178));const _0x575898=await withSpinner(_0x7cdf3f(0x172),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x20a)](_0x9af4e7[_0x7cdf3f(0x170)]),{'verbose':_0x663d48[_0x7cdf3f(0x1b6)]});await handleSingleObjectOutput(_0x575898[_0x7cdf3f(0x173)],_0x663d48);}else{if(_0x9af4e7['type']===_0x7cdf3f(0x175)){if(!_0x9af4e7['segmentId'])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x57cc5f=await withSpinner(_0x7cdf3f(0x16d),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x1dd)](_0x9af4e7[_0x7cdf3f(0x1dc)],_0x9af4e7[_0x7cdf3f(0x1db)]),{'verbose':_0x663d48['verbose']}),_0x566672=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+'/e/'+_0x9af4e7[_0x7cdf3f(0x1db)]),_0xf1197a=_0x57cc5f[_0x7cdf3f(0x173)];_0xf1197a[_0x7cdf3f(0x19b)]=_0x566672,await handleSingleObjectOutput(_0xf1197a,_0x663d48);}else return console['error'](_0x7cdf3f(0x179)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1e3)),0x1;}return 0x0;}catch(_0xc5542e){if(_0xc5542e instanceof SDKError)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1f0)+_0xc5542e[_0x7cdf3f(0x1d5)]),_0xc5542e['cause']&&console[_0x7cdf3f(0x1ed)]('\x20\x20Cause:\x20'+_0xc5542e['cause']),0x1;throw _0xc5542e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x203);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1eb);async[a37_0x1b5047(0x205)](_0x546eb2){const _0x4cf6f0=a37_0x1b5047,{options:_0x9c4ed2,args:_0x4264d1,tdx:_0x5e0fec}=_0x546eb2,_0x246475=_0x4264d1[0x0];if(!_0x246475)return console[_0x4cf6f0(0x1ed)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4cf6f0(0x1ed)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f6)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x186)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18b)),console[_0x4cf6f0(0x1ed)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3c2c84=_0x9c4ed2[_0x4cf6f0(0x1be)],_0x11ef49=await resolveSegmentTarget(_0x246475,_0x3c2c84,_0x9c4ed2[_0x4cf6f0(0x1b6)]);_0x9c4ed2['verbose']&&console['error'](_0x4cf6f0(0x167)+_0x11ef49);const _0x2c671d=await withSpinner(_0x4cf6f0(0x1d7)+_0x246475+'\x27...',()=>_0x5e0fec[_0x4cf6f0(0x175)][_0x4cf6f0(0x16a)](_0x11ef49),{'verbose':_0x9c4ed2[_0x4cf6f0(0x1b6)]}),_0x393ce5=_0x2c671d[_0x4cf6f0(0x173)];_0x9c4ed2['verbose']&&(console['error'](_0x4cf6f0(0x1f2)+_0x393ce5[_0x4cf6f0(0x1df)]),console['error']('Parent\x20ID:\x20'+_0x393ce5['parentId']));if(_0x393ce5['type']==='folder')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x160)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1ca)),0x1;if(_0x393ce5[_0x4cf6f0(0x1df)]==='parent')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x183)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18f)),0x1;if(!_0x393ce5['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4cf6f0(0x1f3));const _0x2fb47a=await withSpinner(_0x4cf6f0(0x176),()=>_0x5e0fec[_0x4cf6f0(0x175)]['getSegmentSQL'](_0x393ce5[_0x4cf6f0(0x1dc)],_0x393ce5[_0x4cf6f0(0x1db)]),{'verbose':_0x9c4ed2['verbose']}),_0x2097dd=_0x2fb47a[_0x4cf6f0(0x173)],_0x5e1093=await executeSchemaQuery(_0x2097dd,_0x5e0fec,_0x9c4ed2);return await handleQueryOutput(_0x5e1093,_0x9c4ed2),0x0;}catch(_0x32c5ee){if(_0x32c5ee instanceof SDKError)return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f0)+_0x32c5ee[_0x4cf6f0(0x1d5)]),_0x32c5ee[_0x4cf6f0(0x187)]&&console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x190)+_0x32c5ee['cause']),0x1;throw _0x32c5ee;}}}
|
|
1
|
+
const a37_0x135c14=a37_0x3c28;(function(_0x512901,_0x247101){const _0x331bc7=a37_0x3c28,_0x10bae8=_0x512901();while(!![]){try{const _0x162a0d=-parseInt(_0x331bc7(0xa7))/0x1*(parseInt(_0x331bc7(0xdb))/0x2)+parseInt(_0x331bc7(0x133))/0x3+parseInt(_0x331bc7(0xff))/0x4+parseInt(_0x331bc7(0xe2))/0x5+parseInt(_0x331bc7(0xc9))/0x6*(parseInt(_0x331bc7(0xb8))/0x7)+-parseInt(_0x331bc7(0xe5))/0x8+parseInt(_0x331bc7(0xc4))/0x9;if(_0x162a0d===_0x247101)break;else _0x10bae8['push'](_0x10bae8['shift']());}catch(_0x58a4ce){_0x10bae8['push'](_0x10bae8['shift']());}}}(a37_0x4cbb,0xd31be));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';function a37_0x3c28(_0x3d19f4,_0x16fc2d){_0x3d19f4=_0x3d19f4-0x93;const _0x4cbb19=a37_0x4cbb();let _0x3c28fd=_0x4cbb19[_0x3d19f4];return _0x3c28fd;}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_0x451b3d from'chalk';async function resolveSegmentTarget(_0x26b5b1,_0x58564c,_0x52cb01){const _0x3952e1=a37_0x3c28;if(isYamlFilePath(_0x26b5b1))try{const _0x378a21=await resolveYamlFilePath(_0x26b5b1);return _0x52cb01&&(console[_0x3952e1(0x95)]('Resolved\x20YAML\x20file:\x20'+_0x26b5b1),console[_0x3952e1(0x95)](_0x3952e1(0x125)+_0x378a21['parentSegment']),console[_0x3952e1(0x95)]('\x20\x20Segment\x20name:\x20'+_0x378a21['segmentName']),console[_0x3952e1(0x95)](_0x3952e1(0xb5)+(_0x378a21[_0x3952e1(0xf5)]||_0x3952e1(0xa0))),console[_0x3952e1(0x95)](_0x3952e1(0x120)+_0x378a21[_0x3952e1(0xdd)])),_0x378a21[_0x3952e1(0xdd)];}catch(_0x40859f){throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0xb4)+_0x40859f[_0x3952e1(0xf7)]);}if(!_0x58564c)throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0x10b));return _0x58564c+'/'+_0x26b5b1;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:describe';[a37_0x135c14(0x122)]=a37_0x135c14(0x12b);async[a37_0x135c14(0xa4)](_0xdd7331){const _0x19e609=a37_0x135c14,{options:_0x5b5bc4,args:_0x3f95a3,tdx:_0x527fe2}=_0xdd7331,_0x3f42e2=_0x3f95a3[0x0],_0x17177c=!_0x3f42e2&&!!_0x5b5bc4[_0x19e609(0x108)],_0x12b1a2=_0x3f42e2||_0x5b5bc4[_0x19e609(0x108)];if(!_0x12b1a2)return console[_0x19e609(0x95)](_0x19e609(0xbf)),console[_0x19e609(0x95)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x19e609(0x95)](_0x19e609(0xf0)),console['error'](_0x19e609(0xca)),console[_0x19e609(0x95)](_0x19e609(0xa2)),console[_0x19e609(0x95)](_0x19e609(0xd6)),console[_0x19e609(0x95)](_0x19e609(0xe9)),0x1;try{const _0xdf9a4=_0x5b5bc4[_0x19e609(0xba)];let _0x2e02d8=_0x12b1a2;!_0x17177c&&_0xdf9a4&&!_0x12b1a2['includes']('/')&&(_0x2e02d8=_0xdf9a4+'/'+_0x12b1a2,_0x5b5bc4['verbose']&&console[_0x19e609(0x95)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2e02d8));const _0x7e35e2=await withSpinner(_0x19e609(0xa8)+_0x2e02d8+_0x19e609(0xf4),()=>_0x527fe2[_0x19e609(0xde)]['resolvePathToResource'](_0x2e02d8),{'verbose':_0x5b5bc4[_0x19e609(0xab)]}),_0x5a6819=_0x7e35e2[_0x19e609(0x10c)];_0x5b5bc4['verbose']&&(console['error'](_0x19e609(0xc8)+_0x5a6819[_0x19e609(0xc5)]),console[_0x19e609(0x95)](_0x19e609(0xad)+_0x5a6819[_0x19e609(0xb2)]),_0x5a6819[_0x19e609(0xed)]&&console['error'](_0x19e609(0x9b)+_0x5a6819[_0x19e609(0xed)]),_0x5a6819[_0x19e609(0xeb)]&&console['error'](_0x19e609(0xcf)+_0x5a6819[_0x19e609(0xeb)]));if(_0x5a6819['type']==='parent'){const _0xd7bc8b=await withSpinner(_0x19e609(0x111),()=>_0x527fe2[_0x19e609(0xde)][_0x19e609(0x101)](_0x5a6819[_0x19e609(0xb2)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0xd7bc8b[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xbb)){if(!_0x5a6819[_0x19e609(0xed)])throw new SDKError(ErrorCode[_0x19e609(0xb9)],_0x19e609(0x103));const _0x194064=await withSpinner(_0x19e609(0x10e),()=>_0x527fe2[_0x19e609(0xde)]['getFolder'](_0x5a6819[_0x19e609(0xed)]),{'verbose':_0x5b5bc4[_0x19e609(0xab)]});await handleSingleObjectOutput(_0x194064[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xde)){if(!_0x5a6819[_0x19e609(0xeb)])throw new SDKError(ErrorCode[_0x19e609(0xd9)],_0x19e609(0xc6));const _0x1e0652=await withSpinner(_0x19e609(0x11d),()=>_0x527fe2['segment'][_0x19e609(0xa1)](_0x5a6819['parentId'],_0x5a6819[_0x19e609(0xeb)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0x1e0652['data'],_0x5b5bc4);}}}return 0x0;}catch(_0x246621){if(_0x246621 instanceof SDKError)return console[_0x19e609(0x95)]('Error:\x20'+_0x246621[_0x19e609(0xf7)]),_0x246621[_0x19e609(0x110)]&&console[_0x19e609(0x95)](_0x19e609(0x127)+_0x246621[_0x19e609(0x110)]),0x1;throw _0x246621;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xd3);[a37_0x135c14(0x122)]=a37_0x135c14(0xd1);async[a37_0x135c14(0xa4)](_0x347585){const _0x3ccce9=a37_0x135c14,{options:_0x3e2994,args:_0x5b3f53,tdx:_0x4625eb}=_0x347585,_0x92fbc3=_0x5b3f53[0x0];if(!_0x92fbc3)return console['error'](_0x3ccce9(0x102)),console['error'](_0x3ccce9(0xd0)),console[_0x3ccce9(0x95)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3ccce9(0x95)](_0x3ccce9(0xf0)),console[_0x3ccce9(0x95)](_0x3ccce9(0xef)),console[_0x3ccce9(0x95)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2e92d2=_0x3e2994[_0x3ccce9(0x108)],_0x5befcb=await resolveSegmentTarget(_0x92fbc3,_0x2e92d2,_0x3e2994[_0x3ccce9(0xab)]);_0x3e2994['verbose']&&console[_0x3ccce9(0x95)]('Target\x20path:\x20'+_0x5befcb);const _0x45282b=await withSpinner('Resolving\x20\x27'+_0x92fbc3+_0x3ccce9(0xf4),()=>_0x4625eb['segment'][_0x3ccce9(0xc2)](_0x5befcb),{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0xce14e3=_0x45282b[_0x3ccce9(0x10c)];_0x3e2994[_0x3ccce9(0xab)]&&(console[_0x3ccce9(0x95)](_0x3ccce9(0xc8)+_0xce14e3[_0x3ccce9(0xc5)]),console[_0x3ccce9(0x95)](_0x3ccce9(0xad)+_0xce14e3['parentId']));if(_0xce14e3[_0x3ccce9(0xc5)]==='folder')return console['error'](_0x3ccce9(0x126)),console['error'](_0x3ccce9(0xda)),0x1;if(_0xce14e3['type']===_0x3ccce9(0x104))return console['error'](_0x3ccce9(0x107)),console[_0x3ccce9(0x95)](_0x3ccce9(0x116)),0x1;if(!_0xce14e3[_0x3ccce9(0xeb)])throw new SDKError(ErrorCode[_0x3ccce9(0xd9)],_0x3ccce9(0xc6));const _0x413bc7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4625eb[_0x3ccce9(0xde)][_0x3ccce9(0x106)](_0xce14e3[_0x3ccce9(0xb2)],_0xce14e3[_0x3ccce9(0xeb)]),{'verbose':_0x3e2994[_0x3ccce9(0xab)]});let _0x2c5244=_0x413bc7[_0x3ccce9(0x10c)];const _0xf9ff34=resolveLimit(_0x3e2994[_0x3ccce9(0xfa)],DEFAULT_DISPLAY_LIMIT),_0x4e0a0e=/\bLIMIT\s+\d+/i[_0x3ccce9(0xc3)](_0x2c5244);!_0x4e0a0e&&(_0x2c5244=_0x2c5244['trim']()[_0x3ccce9(0x129)](/;+$/,''),_0x2c5244='SELECT\x20*\x20FROM\x20(\x0a'+_0x2c5244+_0x3ccce9(0x12d)+_0xf9ff34);_0x3e2994[_0x3ccce9(0xab)]&&console[_0x3ccce9(0x95)](_0x3ccce9(0xbc)+_0x2c5244);const _0x3b1bfa=await withProgressSpinner('Executing\x20segment\x20query...',async _0xae1626=>{const _0x5d4f30=_0x3ccce9,_0x4482bc=await _0x4625eb[_0x5d4f30(0xb3)]['execute'](_0x2c5244,{'catalog':'td','schema':_0x5d4f30(0x114),'onJobId':_0x510e5f=>{_0xae1626['setJobId'](_0x510e5f);}});return _0x4482bc;},{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0x1cdcf7=_0x3b1bfa[_0x3ccce9(0x10c)],_0x26e949=_0x1cdcf7[_0x3ccce9(0x12a)]?_0x3ccce9(0xd2)+_0x1cdcf7[_0x3ccce9(0x12a)]+']':'';return console['error'](_0x3ccce9(0xb6)+_0x1cdcf7[_0x3ccce9(0x100)][_0x3ccce9(0x131)][_0x3ccce9(0x94)]()+_0x3ccce9(0xa3)+(_0x3ccce9(0xe0)+formatElapsed(_0x1cdcf7['stats'][_0x3ccce9(0xe6)])+_0x26e949)),await handleQueryOutput(_0x1cdcf7,_0x3e2994),0x0;}catch(_0x6f545b){if(_0x6f545b instanceof SDKError)return console[_0x3ccce9(0x95)]('✖\x20Query\x20failed\x20['+_0x6f545b[_0x3ccce9(0xdf)]+']'),console[_0x3ccce9(0x95)]('\x0a'+_0x6f545b[_0x3ccce9(0xf7)]),0x1;throw _0x6f545b;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x135c14(0xbd);[a37_0x135c14(0x122)]=a37_0x135c14(0x112);async['execute'](_0x5060a0){const _0x4830bc=a37_0x135c14,{options:_0x2e1217,args:_0x2555fa,tdx:_0x363a23}=_0x5060a0;if(_0x2555fa[_0x4830bc(0x119)]===0x0)return console[_0x4830bc(0x95)](_0x4830bc(0xa9)),console[_0x4830bc(0x95)](_0x4830bc(0xfb)),0x1;const _0x5bc2cd=_0x2555fa[0x0];try{_0x2e1217[_0x4830bc(0xab)]&&(console[_0x4830bc(0x95)](_0x4830bc(0xb0)+_0x2e1217['site']),console[_0x4830bc(0x95)]('Parent\x20name:\x20'+_0x5bc2cd));const _0x520085=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5bc2cd+_0x4830bc(0xf4),()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x12c)](_0x5bc2cd),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0x82e30f=_0x520085['data'];_0x2e1217[_0x4830bc(0xab)]&&console[_0x4830bc(0x95)](_0x4830bc(0x123)+_0x82e30f);const _0x167f2f=await withSpinner(_0x4830bc(0xb1)+_0x5bc2cd+'\x27...',()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x11b)](_0x82e30f),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0xfba079=_0x167f2f[_0x4830bc(0x10c)];return console[_0x4830bc(0x95)]('✔\x20Found\x20'+_0xfba079['length']+_0x4830bc(0x113)+(_0xfba079['length']!==0x1?'s':'')),await handleSDKOutput(_0xfba079,_0x2e1217),0x0;}catch(_0x43fb11){if(_0x43fb11 instanceof SDKError)return console[_0x4830bc(0x95)](_0x4830bc(0x109)+_0x43fb11[_0x4830bc(0xf7)]),_0x43fb11[_0x4830bc(0x110)]&&console[_0x4830bc(0x95)](_0x4830bc(0x127)+_0x43fb11[_0x4830bc(0x110)]),0x1;throw _0x43fb11;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:show';[a37_0x135c14(0x122)]=a37_0x135c14(0xd5);async['execute'](_0x34db96){const _0x154608=a37_0x135c14,{options:_0x43908b,args:_0x326d87,tdx:_0x57f3f6}=_0x34db96;if(_0x326d87[_0x154608(0x119)]===0x0)return console[_0x154608(0x95)](_0x154608(0xea)),console[_0x154608(0x95)](_0x154608(0xc0)),0x1;try{const {parentId:_0xaacb3d,childId:_0x2fe575}=parseSegmentRef(_0x326d87[0x0]);_0x43908b['verbose']&&(console['error'](_0x154608(0xb0)+_0x43908b[_0x154608(0xe4)]),console['error'](_0x154608(0x128)+_0xaacb3d),_0x2fe575&&console[_0x154608(0x95)](_0x154608(0x11c)+_0x2fe575));if(!_0x2fe575)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x584b87=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xaacb3d+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x12c)](_0xaacb3d),{'verbose':_0x43908b[_0x154608(0xab)]}),_0x3432fd=_0x584b87[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console['error'](_0x154608(0x123)+_0x3432fd);const _0x545553=await withSpinner(_0x154608(0xcb)+_0x2fe575+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0xd8)](_0x3432fd,_0x2fe575),{'verbose':_0x43908b[_0x154608(0xab)]}),_0xf8804b=_0x545553[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console[_0x154608(0x95)](_0x154608(0xae)+_0xf8804b);const _0x21ed24=await withSpinner('Fetching\x20folder\x20\x27'+_0x2fe575+_0x154608(0xf4),()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x105)](_0xf8804b),{'verbose':_0x43908b['verbose']});return await handleSDKOutput([_0x21ed24[_0x154608(0x10c)]],_0x43908b),0x0;}catch(_0x593171){if(_0x593171 instanceof SDKError)return console[_0x154608(0x95)](_0x154608(0x109)+_0x593171['message']),_0x593171[_0x154608(0x110)]&&console[_0x154608(0x95)](_0x154608(0x127)+_0x593171[_0x154608(0x110)]),0x1;throw _0x593171;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x135c14(0xcd);[a37_0x135c14(0x122)]=a37_0x135c14(0xf9);async['execute'](_0x4c8e91){const _0x594cee=a37_0x135c14,{options:_0x1619f2,args:_0x36bd84}=_0x4c8e91,_0x262e19=_0x1619f2,_0x42932f=_0x262e19[_0x594cee(0x117)],_0x29aaf4=_0x36bd84[0x0];if(!_0x29aaf4&&!_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0xaa))),console['error'](_0x594cee(0x93)),console[_0x594cee(0x95)](_0x594cee(0x10d)),console[_0x594cee(0x95)](_0x594cee(0xb7)),console[_0x594cee(0x95)](_0x594cee(0xf0)),console[_0x594cee(0x95)](_0x594cee(0x130)),console[_0x594cee(0x95)](_0x594cee(0xf1)),0x1;if(_0x29aaf4&&_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0x12e))),0x1;try{let _0x34ff1a;if(_0x42932f)_0x34ff1a=await this[_0x594cee(0xac)](_0x42932f,_0x4c8e91);else{if(isYamlFilePath(_0x29aaf4))return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x594cee(0x95)](_0x594cee(0x121)+_0x29aaf4),0x1;else _0x34ff1a=await this['getSQLFromServerSegment'](_0x29aaf4,_0x4c8e91);}return _0x1619f2[_0x594cee(0x9c)]===_0x594cee(0x99)||_0x1619f2[_0x594cee(0x9c)]==='jsonl'?await handleSDKOutput([{'sql':_0x34ff1a}],_0x1619f2):console['log'](_0x34ff1a),0x0;}catch(_0x42c366){if(_0x42c366 instanceof SDKError)return console[_0x594cee(0x95)](_0x594cee(0x109)+_0x42c366[_0x594cee(0xf7)]),_0x42c366[_0x594cee(0x110)]&&console[_0x594cee(0x95)](_0x594cee(0x127)+_0x42c366[_0x594cee(0x110)]),0x1;throw _0x42c366;}}async[a37_0x135c14(0xac)](_0x3bf8ed,_0x4d7fd0){const _0x2d8bb9=a37_0x135c14,{options:_0x3a5153,tdx:_0x33b3fc}=_0x4d7fd0;let _0x4d6862;try{_0x4d6862=await resolveYamlFilePath(_0x3bf8ed);}catch(_0x130331){throw new SDKError(ErrorCode[_0x2d8bb9(0xcc)],_0x2d8bb9(0xb4)+_0x130331['message']);}_0x3a5153[_0x2d8bb9(0xab)]&&console[_0x2d8bb9(0x95)]('Resolved:\x20'+_0x4d6862['parentSegment']+'/'+_0x4d6862[_0x2d8bb9(0x9a)]);const _0x4b1657=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x33b3fc[_0x2d8bb9(0xde)][_0x2d8bb9(0xc1)](_0x4d6862[_0x2d8bb9(0xec)],_0x4d6862[_0x2d8bb9(0x108)],_0x4d6862[_0x2d8bb9(0x9a)]),{'verbose':_0x3a5153['verbose']});return _0x4b1657[_0x2d8bb9(0x10c)];}async[a37_0x135c14(0xfd)](_0x40a957,_0x5428e0){const _0x3dfb15=a37_0x135c14,{options:_0x24146e,tdx:_0x1b1a55}=_0x5428e0,_0x531169=_0x24146e['parentSegment'],_0x1d944e=await resolveSegmentTarget(_0x40a957,_0x531169,_0x24146e[_0x3dfb15(0xab)]);_0x24146e['verbose']&&console[_0x3dfb15(0x95)](_0x3dfb15(0x10a)+_0x1d944e);const _0x26135b=await withSpinner(_0x3dfb15(0x124)+_0x40a957+_0x3dfb15(0xf4),()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0xc2)](_0x1d944e),{'verbose':_0x24146e['verbose']}),_0x5f135f=_0x26135b['data'];_0x24146e['verbose']&&(console['error'](_0x3dfb15(0xc8)+_0x5f135f[_0x3dfb15(0xc5)]),console[_0x3dfb15(0x95)]('Parent\x20ID:\x20'+_0x5f135f[_0x3dfb15(0xb2)]));if(_0x5f135f[_0x3dfb15(0xc5)]===_0x3dfb15(0xbb))throw new SDKError(ErrorCode[_0x3dfb15(0xcc)],_0x3dfb15(0x9d));if(_0x5f135f[_0x3dfb15(0xc5)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x5f135f[_0x3dfb15(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3d232e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0x106)](_0x5f135f['parentId'],_0x5f135f[_0x3dfb15(0xeb)]),{'verbose':_0x24146e[_0x3dfb15(0xab)]});return _0x3d232e[_0x3dfb15(0x10c)];}}function a37_0x4cbb(){const _0x3373bd=['Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Cause:\x20','Parent\x20name:\x20','replace','jobId','Show\x20segment\x20or\x20folder\x20details','resolveParentId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','processedRows','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','652392DbYtbh','Usage:','toLocaleString','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','json','segmentName','Folder\x20ID:\x20','format','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','name','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','(root)','getSegment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20rows\x20','execute','Resolving\x20parent\x20segment\x20\x27','url','8HXtPum','Resolving\x20path\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','verbose','getSQLFromYamlFile','Parent\x20ID:\x20','Resolved\x20folder\x20ID:\x20','Creating\x20folder\x20\x27','Site:\x20','Listing\x20folders\x20for\x20parent\x20\x27','parentId','query','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Folder\x20path:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','14CDwLUx','SEGMENT_FOLDER_NOT_FOUND','segmentPath','folder','SQL\x20query:\x0a','segment:folder:list','\x27\x20with\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','getSegmentSQLFromYaml','resolvePathToResource','test','8942589EPXXpw','type','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20type:\x20','551802sbtYwm','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20folder\x20\x27','INVALID_ARGUMENT','segment:sql','/app/ps/','Segment\x20ID:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20[Job\x20ID:\x20','segment:show','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','createFolder','resolveFolderId','SEGMENT_NOT_FOUND','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','8902zgPILN','red','fullPath','segment','code','in\x20','cyan','318330sCkmLT','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','site','4467568hWTPcO','elapsedTimeMillis','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20reference\x20is\x20required','segmentId','content','folderId','green','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Examples:','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','\x27...','folderPath','Resolving\x20parent\x20folder\x20\x27','message','/e/','Get\x20SQL\x20query\x20for\x20child\x20segment','limit','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:desc','getSQLFromServerSegment','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','284ODEqWh','stats','getParent','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','parent','getFolder','getSegmentSQL','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentSegment','Error:\x20','Target\x20path:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','data','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20folder\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','cause','Fetching\x20parent\x20segment\x20details...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20folder','information_schema','Show\x20folder\x20or\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20show','path','Use:\x20tdx\x20ps\x20desc','length','segment:view','listFolders','Folder\x20name:\x20','Fetching\x20segment\x20details...','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','description','Resolved\x20parent\x20ID:\x20','Resolving\x20\x27','\x20\x20Parent\x20segment:\x20'];a37_0x4cbb=function(){return _0x3373bd;};return a37_0x4cbb();}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:create';[a37_0x135c14(0x122)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x135c14(0xa4)](_0x15fc5c){const _0x1e146b=a37_0x135c14,{options:_0x1e87a6,args:_0x5ad6e2,tdx:_0x5e290b}=_0x15fc5c,_0x3cb669=_0x1e87a6;if(_0x5ad6e2[_0x1e146b(0x119)]<0x2)return console['error'](_0x1e146b(0x11f)),console['error'](_0x1e146b(0x97)),0x1;const _0x44cdb6=_0x5ad6e2[0x0],_0xd9dc6c=_0x5ad6e2[0x1];_0x3cb669[_0x1e146b(0xab)]&&(console[_0x1e146b(0x95)](_0x1e146b(0xb0)+_0x3cb669['site']),console[_0x1e146b(0x95)](_0x1e146b(0x12f)+_0x44cdb6),console[_0x1e146b(0x95)]('Folder\x20name:\x20'+_0xd9dc6c));let _0x4554ee;if(_0x3cb669[_0x1e146b(0xe8)]){const _0x42fbef=_0x3cb669[_0x1e146b(0xe8)],_0x4a6319=await withSpinner(_0x1e146b(0xa5)+_0x44cdb6+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0x12c)](_0x44cdb6),{'verbose':_0x3cb669['verbose']}),_0x1119b5=_0x4a6319[_0x1e146b(0x10c)],_0x142cfb=await withSpinner(_0x1e146b(0xf6)+_0x42fbef+_0x1e146b(0xf4),()=>_0x5e290b['segment'][_0x1e146b(0xd8)](_0x1119b5,_0x42fbef),{'verbose':_0x3cb669[_0x1e146b(0xab)]});_0x4554ee=_0x142cfb['data'],_0x3cb669['verbose']&&console[_0x1e146b(0x95)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4554ee);}const _0xf1f2d0={'name':_0xd9dc6c,'description':_0x3cb669[_0x1e146b(0x122)],'parentFolderId':_0x4554ee},_0xbd8c86=await withSpinner(_0x1e146b(0xaf)+_0xd9dc6c+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0xd7)](_0x44cdb6,_0xf1f2d0),{'verbose':_0x3cb669[_0x1e146b(0xab)]}),_0x39ce70=_0xbd8c86[_0x1e146b(0x10c)];return console[_0x1e146b(0x95)]('✔\x20Created\x20folder\x20\x27'+_0x39ce70['name']+_0x1e146b(0xbe)+_0x39ce70['id']),await handleSDKOutput([_0x39ce70],_0x3cb669),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x135c14(0x11a);[a37_0x135c14(0x122)]=a37_0x135c14(0x115);async[a37_0x135c14(0xa4)](_0x1b6047){const _0x34091e=a37_0x135c14,{options:_0x2f4724,args:_0x32d6a3,tdx:_0x2a9a78}=_0x1b6047,_0x2f50d2=_0x32d6a3[0x0];if(!_0x2f50d2)return console['error'](_0x34091e(0x9f)),console[_0x34091e(0x95)](_0x34091e(0x132)),console[_0x34091e(0x95)](_0x34091e(0x96)),console[_0x34091e(0x95)]('Options:'),console[_0x34091e(0x95)](_0x34091e(0x10f)),console[_0x34091e(0x95)](_0x34091e(0xf0)),console[_0x34091e(0x95)](_0x34091e(0x98)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x34091e(0x95)](_0x34091e(0xe3)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2dd449=_0x2f4724[_0x34091e(0x108)],_0x4d2a0a=await resolveSegmentTarget(_0x2f50d2,_0x2dd449,_0x2f4724[_0x34091e(0xab)]);_0x2f4724[_0x34091e(0xab)]&&console['error'](_0x34091e(0x10a)+_0x4d2a0a);const _0x367076=await withSpinner(_0x34091e(0x124)+_0x2f50d2+_0x34091e(0xf4),()=>_0x2a9a78['segment'][_0x34091e(0xc2)](_0x4d2a0a),{'verbose':_0x2f4724[_0x34091e(0xab)]}),_0x1f341b=_0x367076[_0x34091e(0x10c)];_0x2f4724[_0x34091e(0xab)]&&(console[_0x34091e(0x95)](_0x34091e(0xc8)+_0x1f341b[_0x34091e(0xc5)]),console['error'](_0x34091e(0xad)+_0x1f341b['parentId']),_0x1f341b[_0x34091e(0xed)]&&console['error'](_0x34091e(0x9b)+_0x1f341b[_0x34091e(0xed)]),_0x1f341b[_0x34091e(0xeb)]&&console[_0x34091e(0x95)](_0x34091e(0xcf)+_0x1f341b[_0x34091e(0xeb)]));if(_0x2f4724['web']){if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb))return console[_0x34091e(0x95)](_0x34091e(0x11e)),0x1;if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0x104))return console[_0x34091e(0x95)](_0x34091e(0xf2)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x1f341b[_0x34091e(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1ed6cb=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]);return console['error'](a37_0x451b3d[_0x34091e(0xee)]('✔')+'\x20Opening\x20'+a37_0x451b3d[_0x34091e(0xe1)](_0x1ed6cb)),openBrowser(_0x1ed6cb),0x0;}if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb)){if(!_0x1f341b[_0x34091e(0xed)])throw new SDKError(ErrorCode[_0x34091e(0xb9)],_0x34091e(0x103));const _0x2c25a6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2a9a78[_0x34091e(0xde)][_0x34091e(0x105)](_0x1f341b[_0x34091e(0xed)]),{'verbose':_0x2f4724[_0x34091e(0xab)]});await handleSingleObjectOutput(_0x2c25a6[_0x34091e(0x10c)],_0x2f4724);}else{if(_0x1f341b['type']===_0x34091e(0xde)){if(!_0x1f341b['segmentId'])throw new SDKError(ErrorCode[_0x34091e(0xd9)],_0x34091e(0xc6));const _0x20f614=await withSpinner(_0x34091e(0x11d),()=>_0x2a9a78[_0x34091e(0xde)]['getSegment'](_0x1f341b['parentId'],_0x1f341b[_0x34091e(0xeb)]),{'verbose':_0x2f4724['verbose']}),_0x10a6ba=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]),_0x1517d0=_0x20f614[_0x34091e(0x10c)];_0x1517d0[_0x34091e(0xa6)]=_0x10a6ba,await handleSingleObjectOutput(_0x1517d0,_0x2f4724);}else return console[_0x34091e(0x95)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x34091e(0x95)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x3da509){if(_0x3da509 instanceof SDKError)return console['error'](_0x34091e(0x109)+_0x3da509['message']),_0x3da509[_0x34091e(0x110)]&&console[_0x34091e(0x95)](_0x34091e(0x127)+_0x3da509[_0x34091e(0x110)]),0x1;throw _0x3da509;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xfc);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x135c14(0xa4)](_0x430754){const _0x59a29b=a37_0x135c14,{options:_0x4d2ecf,args:_0x2cdaa0,tdx:_0x4f48e2}=_0x430754,_0x23850c=_0x2cdaa0[0x0];if(!_0x23850c)return console[_0x59a29b(0x95)](_0x59a29b(0x102)),console[_0x59a29b(0x95)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x59a29b(0x95)](_0x59a29b(0xe7)),console['error']('Examples:'),console[_0x59a29b(0x95)](_0x59a29b(0xfe)),console[_0x59a29b(0x95)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1ec146=_0x4d2ecf['parentSegment'],_0x10019c=await resolveSegmentTarget(_0x23850c,_0x1ec146,_0x4d2ecf[_0x59a29b(0xab)]);_0x4d2ecf['verbose']&&console[_0x59a29b(0x95)](_0x59a29b(0x10a)+_0x10019c);const _0x21f150=await withSpinner('Resolving\x20\x27'+_0x23850c+'\x27...',()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0xc2)](_0x10019c),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x595335=_0x21f150['data'];_0x4d2ecf[_0x59a29b(0xab)]&&(console['error'](_0x59a29b(0xc8)+_0x595335[_0x59a29b(0xc5)]),console['error']('Parent\x20ID:\x20'+_0x595335['parentId']));if(_0x595335[_0x59a29b(0xc5)]==='folder')return console[_0x59a29b(0x95)](_0x59a29b(0xc7)),console[_0x59a29b(0x95)](_0x59a29b(0xd4)),0x1;if(_0x595335[_0x59a29b(0xc5)]==='parent')return console[_0x59a29b(0x95)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x59a29b(0x95)](_0x59a29b(0x118)),0x1;if(!_0x595335[_0x59a29b(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x59a29b(0xc6));const _0xaeba9d=await withSpinner(_0x59a29b(0xf3),()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0x106)](_0x595335[_0x59a29b(0xb2)],_0x595335[_0x59a29b(0xeb)]),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x3b014d=_0xaeba9d[_0x59a29b(0x10c)],_0x5d1a79=await executeSchemaQuery(_0x3b014d,_0x4f48e2,_0x4d2ecf);return await handleQueryOutput(_0x5d1a79,_0x4d2ecf),0x0;}catch(_0x5f2929){if(_0x5f2929 instanceof SDKError)return console[_0x59a29b(0x95)](_0x59a29b(0x109)+_0x5f2929[_0x59a29b(0xf7)]),_0x5f2929[_0x59a29b(0x110)]&&console['error'](_0x59a29b(0x127)+_0x5f2929[_0x59a29b(0x110)]),0x1;throw _0x5f2929;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x566440=a38_0x2054;(function(_0x598936,_0x5664d2){const _0x4a3d3b=a38_0x2054,_0x216a9c=_0x598936();while(!![]){try{const _0x5e9422=-parseInt(_0x4a3d3b(0x13f))/0x1+-parseInt(_0x4a3d3b(0x116))/0x2*(-parseInt(_0x4a3d3b(0x12c))/0x3)+parseInt(_0x4a3d3b(0x137))/0x4+parseInt(_0x4a3d3b(0x13c))/0x5+parseInt(_0x4a3d3b(0x11c))/0x6+parseInt(_0x4a3d3b(0x127))/0x7+-parseInt(_0x4a3d3b(0x13d))/0x8*(parseInt(_0x4a3d3b(0x134))/0x9);if(_0x5e9422===_0x5664d2)break;else _0x216a9c['push'](_0x216a9c['shift']());}catch(_0x86e377){_0x216a9c['push'](_0x216a9c['shift']());}}}(a38_0x5c11,0x365ce));function a38_0x2054(_0x2a6c0e,_0x4002b3){_0x2a6c0e=_0x2a6c0e-0x10f;const _0x5c11fa=a38_0x5c11();let _0x2054ec=_0x5c11fa[_0x2a6c0e];return _0x2054ec;}function a38_0x5c11(){const _0x572aa5=['68397AVMESN','\x27...','invisible','segment','Examples:','Create\x20child\x20segment\x20with\x20filtering\x20rules','type','resolvePathToResource','68067NDuCfu','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','verbose','98028CWDJeD','yellow','data','noCountPopulation','parent','1751550enfeOe','424NvQrdS','✔\x20Created\x20segment\x20\x27','260059LQJeID','error','length','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','description','kind','16HoMxfB','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segments','\x20\x20\x20Path:\x20','Resolving\x20folder\x20\x27','resolveFolderId','1946268ptPkvg','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','createSegment','resolveParentId','Target\x20path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentPath','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Parent:\x20','folderId','folder','13867ucwvdj','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','name','includes','Resolved\x20folder\x20ID:\x20'];a38_0x5c11=function(){return _0x572aa5;};return a38_0x5c11();}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';import a38_0x203bf5 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';[a38_0x566440(0x114)]=a38_0x566440(0x131);async['execute'](_0x31fcf2){const _0x5f2d63=a38_0x566440;console['error'](a38_0x203bf5[_0x5f2d63(0x138)](_0x5f2d63(0x128))),console[_0x5f2d63(0x10f)](a38_0x203bf5[_0x5f2d63(0x138)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x272d27,args:_0x46968c,tdx:_0x4a5fec}=_0x31fcf2,_0x19c2c3=_0x272d27;if(_0x46968c[_0x5f2d63(0x110)]===0x0)return console[_0x5f2d63(0x10f)](_0x5f2d63(0x121)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x123)),console['error'](_0x5f2d63(0x130)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x112)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x117)),console[_0x5f2d63(0x10f)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x1d7616=_0x46968c[0x0],_0x7be425=_0x272d27[_0x5f2d63(0x122)];let _0x4fbbd3=_0x1d7616;_0x7be425&&!_0x1d7616[_0x5f2d63(0x12a)]('/')&&(_0x4fbbd3=_0x7be425+'/'+_0x1d7616,_0x19c2c3[_0x5f2d63(0x136)]&&console[_0x5f2d63(0x10f)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4fbbd3));const _0x2c72cf=parsePath(_0x4fbbd3);if(_0x2c72cf[_0x5f2d63(0x118)]['length']<0x2)return console[_0x5f2d63(0x10f)](_0x5f2d63(0x135)),console['error'](_0x5f2d63(0x113)),0x1;const _0x1d384a=_0x2c72cf[_0x5f2d63(0x118)][0x0],_0x1b46cc=getBaseName(_0x4fbbd3),_0x18cbf5=getParentPath(_0x4fbbd3);_0x19c2c3['verbose']&&(console[_0x5f2d63(0x10f)]('Site:\x20'+_0x19c2c3['site']),console[_0x5f2d63(0x10f)](_0x5f2d63(0x120)+_0x4fbbd3),console[_0x5f2d63(0x10f)](_0x5f2d63(0x124)+_0x1d384a),console['error']('Segment\x20name:\x20'+_0x1b46cc),console[_0x5f2d63(0x10f)]('Parent\x20path:\x20'+_0x18cbf5));const _0x228bab=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1d384a+_0x5f2d63(0x12d),()=>_0x4a5fec['segment'][_0x5f2d63(0x11f)](_0x1d384a),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]}),_0x1b36c1=_0x228bab[_0x5f2d63(0x139)];let _0x509c9e;if(_0x2c72cf['segments'][_0x5f2d63(0x110)]>0x2){const _0xd3e0ba=await withSpinner(_0x5f2d63(0x111)+_0x18cbf5+_0x5f2d63(0x12d),()=>_0x4a5fec[_0x5f2d63(0x12f)][_0x5f2d63(0x133)](_0x18cbf5),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]}),_0x43a24f=_0xd3e0ba['data'];if(_0x43a24f[_0x5f2d63(0x132)]!==_0x5f2d63(0x126)&&_0x43a24f[_0x5f2d63(0x132)]!==_0x5f2d63(0x13b))return console[_0x5f2d63(0x10f)](_0x5f2d63(0x11d)),0x1;_0x509c9e=_0x43a24f[_0x5f2d63(0x125)];}else{if(_0x19c2c3[_0x5f2d63(0x126)]){const _0x1c4171=await withSpinner(_0x5f2d63(0x11a)+_0x19c2c3[_0x5f2d63(0x126)]+_0x5f2d63(0x12d),()=>_0x4a5fec[_0x5f2d63(0x12f)][_0x5f2d63(0x11b)](_0x1b36c1,_0x19c2c3['folder']),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]});_0x509c9e=_0x1c4171[_0x5f2d63(0x139)];}}_0x19c2c3['verbose']&&_0x509c9e&&console[_0x5f2d63(0x10f)](_0x5f2d63(0x12b)+_0x509c9e);const _0x49ddaa=await loadJSONFromOptions(_0x19c2c3['rule'],_0x19c2c3['ruleFile']),_0x27237b={'name':_0x1b46cc,'description':_0x19c2c3['description'],'rule':_0x49ddaa,'kind':_0x19c2c3['kind']!==undefined?parseInt(_0x19c2c3[_0x5f2d63(0x115)],0xa):undefined,'isVisible':_0x19c2c3[_0x5f2d63(0x12e)]?![]:undefined,'segmentFolderId':_0x509c9e,'countPopulation':_0x19c2c3[_0x5f2d63(0x13a)]?![]:undefined},_0x4b975f=await withSpinner('Creating\x20segment\x20\x27'+_0x1b46cc+_0x5f2d63(0x12d),()=>_0x4a5fec['segment'][_0x5f2d63(0x11e)](_0x1b36c1,_0x27237b),{'verbose':_0x19c2c3['verbose']}),_0x40903f=_0x4b975f[_0x5f2d63(0x139)];return console[_0x5f2d63(0x10f)](_0x5f2d63(0x13e)+_0x40903f[_0x5f2d63(0x129)]+'\x27\x20with\x20ID:\x20'+_0x40903f['id']),_0x4fbbd3!==_0x1d7616&&console[_0x5f2d63(0x10f)](_0x5f2d63(0x119)+_0x4fbbd3),await handleSDKOutput([_0x40903f],_0x19c2c3),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a39_0x11b3a3=a39_0x1d63;(function(_0x1a1e44,_0xa78db3){const _0x5f3ba4=a39_0x1d63,_0x539b60=_0x1a1e44();while(!![]){try{const _0x5cd202=-parseInt(_0x5f3ba4(0x18f))/0x1+-parseInt(_0x5f3ba4(0x19b))/0x2+-parseInt(_0x5f3ba4(0x193))/0x3*(-parseInt(_0x5f3ba4(0x1a0))/0x4)+parseInt(_0x5f3ba4(0x192))/0x5+parseInt(_0x5f3ba4(0x19d))/0x6+-parseInt(_0x5f3ba4(0x191))/0x7+parseInt(_0x5f3ba4(0x19a))/0x8;if(_0x5cd202===_0xa78db3)break;else _0x539b60['push'](_0x539b60['shift']());}catch(_0x569680){_0x539b60['push'](_0x539b60['shift']());}}}(a39_0x2d9d,0xb6269));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x1d63(_0x2e6a1d,_0x34e9d7){_0x2e6a1d=_0x2e6a1d-0x188;const _0x2d9daa=a39_0x2d9d();let _0x1d6385=_0x2d9daa[_0x2e6a1d];return _0x1d6385;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x2d9d(){const _0x15761=['List\x20available\x20fields\x20for\x20segmentation','Site:\x20','execute','error','730941jvIehK','jsonl','5536377rhPHHu','1230345VZbXmy','192vXoFuj','\x27...','parentSegment','verbose','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment:fields','20499696rZlVMe','1970406JvOXVd','json','1209630fqyTdX','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20field','15188vXFBuI','name','data','listFields','description'];a39_0x2d9d=function(){return _0x15761;};return a39_0x2d9d();}export class SegmentFieldsCommand extends BaseCommand{[a39_0x11b3a3(0x1a1)]=a39_0x11b3a3(0x199);[a39_0x11b3a3(0x18a)]=a39_0x11b3a3(0x18b);async[a39_0x11b3a3(0x18d)](_0x550a46){const _0x4c4f6b=a39_0x11b3a3,{options:_0x2bffb7,args:_0x4a1679,tdx:_0x2c691d}=_0x550a46,_0x1296a3=_0x4a1679[0x0]||_0x2bffb7[_0x4c4f6b(0x195)];if(!_0x1296a3)return console[_0x4c4f6b(0x18e)](_0x4c4f6b(0x19e)),console['error'](_0x4c4f6b(0x198)),console[_0x4c4f6b(0x18e)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x2bffb7[_0x4c4f6b(0x196)]&&(console[_0x4c4f6b(0x18e)](_0x4c4f6b(0x18c)+_0x2bffb7['site']),console[_0x4c4f6b(0x18e)]('Parent\x20segment:\x20'+_0x1296a3));const _0x56a999=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1296a3+_0x4c4f6b(0x194),()=>_0x2c691d['segment'][_0x4c4f6b(0x189)](_0x1296a3),{'verbose':_0x2bffb7[_0x4c4f6b(0x196)]}),_0x2ffc9e=_0x56a999[_0x4c4f6b(0x188)];console[_0x4c4f6b(0x18e)]('✔\x20Found\x20'+_0x2ffc9e[_0x4c4f6b(0x197)]+_0x4c4f6b(0x19f)+(_0x2ffc9e[_0x4c4f6b(0x197)]!==0x1?'s':''));if(_0x2bffb7[_0x4c4f6b(0x19c)]||_0x2bffb7[_0x4c4f6b(0x190)])return await handleSDKOutput(_0x2ffc9e,_0x2bffb7),0x0;return displayFieldsHumanReadable(_0x2ffc9e,_0x1296a3),0x0;}}
|