@treasuredata/tdx 2026.4.10 → 2026.4.11
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/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/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/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/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_0x468bc9=a32_0x343d;(function(_0x152c5b,_0x15f868){const _0x42e7e0=a32_0x343d,_0x151ccb=_0x152c5b();while(!![]){try{const _0x281747=-parseInt(_0x42e7e0(0xeb))/0x1*(parseInt(_0x42e7e0(0xf5))/0x2)+-parseInt(_0x42e7e0(0xf3))/0x3*(parseInt(_0x42e7e0(0xea))/0x4)+-parseInt(_0x42e7e0(0xc6))/0x5*(-parseInt(_0x42e7e0(0xe5))/0x6)+-parseInt(_0x42e7e0(0xd4))/0x7+-parseInt(_0x42e7e0(0xe8))/0x8+-parseInt(_0x42e7e0(0xfe))/0x9+-parseInt(_0x42e7e0(0xf2))/0xa*(-parseInt(_0x42e7e0(0xce))/0xb);if(_0x281747===_0x15f868)break;else _0x151ccb['push'](_0x151ccb['shift']());}catch(_0x2a6e3d){_0x151ccb['push'](_0x151ccb['shift']());}}}(a32_0x2844,0x19ed2));function a32_0x2844(){const _0x2e85ec=['Listing\x20policies...','name','join','getCurrent','permissions','22vDlIWF','dim',',\x20user_id:','policy','account_owner','description','402080Cpzwye','error','\x20assigned','\x20—\x20','email','all','(ID:\x20','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20No\x20policies\x20assigned','bold','execute','\x20user','\x20\x20•\x20','operation','map','Fetching\x20permissions...','🔑\x20Effective\x20Permissions','30XqhXMc','data','listPolicies','1520528SwMBsU','length','224aKUZsr','1LOOysf','\x20\x20No\x20permissions','policy\x20list','account_id','getPolicyUsers','👥\x20Assigned\x20Users','Administrator','3181530jqTzfi','8961ZXjvpB','site','167662wucVKm','Member','Account\x20Owner','log','getPolicy','entries','ies','\x20\x20\x20','padEnd','485307mcRpqH','22420ELUHWJ','📋\x20Assigned\x20Policies','verbose'];a32_0x2844=function(){return _0x2e85ec;};return a32_0x2844();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a32_0x343d(_0x221267,_0x1ee33d){_0x221267=_0x221267-0xc6;const _0x2844e0=a32_0x2844();let _0x343d60=_0x2844e0[_0x221267];return _0x343d60;}import a32_0x14bd6d from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x468bc9(0xca)]='policy';[a32_0x468bc9(0xd3)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x468bc9(0xde)](_0x244b1c){const _0x25d3ef=a32_0x468bc9,{options:_0x5f563a,tdx:_0x46006f}=_0x244b1c,_0x1ea524=await withSpinner(_0x25d3ef(0xe3),async()=>{const _0x158ab1=_0x25d3ef,[_0x28c9dd,_0x2a4819]=await Promise[_0x158ab1(0xd9)]([_0x46006f['user'][_0x158ab1(0xcc)](),_0x46006f['policy']['getMyPermissions']()]);return{'userInfo':_0x28c9dd,'permissions':_0x2a4819};},{'verbose':_0x5f563a['verbose']}),{userInfo:_0x4754ae,permissions:_0x21d572}=_0x1ea524[_0x25d3ef(0xe6)];if(isStructuredFormat(_0x5f563a))return await handleSingleObjectOutput(_0x21d572,_0x5f563a),0x0;const _0x58d47f=_0x4754ae[_0x25d3ef(0xd2)]?_0x25d3ef(0xf7):_0x4754ae['administrator']?_0x25d3ef(0xf1):_0x25d3ef(0xf6);console[_0x25d3ef(0xf8)]('\x0a'+a32_0x14bd6d['bold']('👤')+'\x20'+a32_0x14bd6d[_0x25d3ef(0xdd)](_0x4754ae[_0x25d3ef(0xca)])+'\x20'+a32_0x14bd6d[_0x25d3ef(0xcf)]('('+_0x4754ae['email']+')')+_0x25d3ef(0xd7)+_0x58d47f),console[_0x25d3ef(0xf8)](a32_0x14bd6d['dim'](_0x25d3ef(0xfc)+_0x46006f['context'][_0x25d3ef(0xf4)]+':'+_0x4754ae[_0x25d3ef(0xee)]+_0x25d3ef(0xd0)+_0x4754ae['id']));const _0xc340d8=_0x21d572['policies'];console['log']('\x0a'+a32_0x14bd6d[_0x25d3ef(0xdd)](_0x25d3ef(0xc7))+'\x20('+_0xc340d8[_0x25d3ef(0xe9)]+'):');if(_0xc340d8['length']===0x0)console[_0x25d3ef(0xf8)](a32_0x14bd6d[_0x25d3ef(0xcf)](_0x25d3ef(0xdc)));else for(const _0x10294d of _0xc340d8){console[_0x25d3ef(0xf8)](_0x25d3ef(0xe0)+_0x10294d['name']);}return printPermissionsMap(_0x21d572['permissions']),console[_0x25d3ef(0xf8)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x468bc9(0xca)]=a32_0x468bc9(0xed);[a32_0x468bc9(0xd3)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x468bc9(0xde)](_0x4295a7){const _0x3fe340=a32_0x468bc9,{options:_0x5d4461,tdx:_0x11f7f1}=_0x4295a7,_0x4c8f73=await withSpinner(_0x3fe340(0xc9),()=>_0x11f7f1['policy'][_0x3fe340(0xe7)](),{'verbose':_0x5d4461[_0x3fe340(0xc8)]}),_0x598b20=_0x4c8f73[_0x3fe340(0xe6)];console[_0x3fe340(0xd5)]('✔\x20Found\x20'+_0x598b20['length']+'\x20polic'+(_0x598b20[_0x3fe340(0xe9)]!==0x1?_0x3fe340(0xfb):'y'));if(isStructuredFormat(_0x5d4461))return await handleSDKOutput(_0x598b20,_0x5d4461),0x0;if(_0x598b20[_0x3fe340(0xe9)]===0x0)console[_0x3fe340(0xf8)](a32_0x14bd6d[_0x3fe340(0xcf)]('No\x20policies\x20found'));else for(const _0x3fb555 of _0x598b20){const _0x345a48=_0x3fb555['description']?a32_0x14bd6d['dim'](_0x3fe340(0xd7)+_0x3fb555[_0x3fe340(0xd3)]):'';console[_0x3fe340(0xf8)]('\x20\x20•\x20'+_0x3fb555['name']+_0x345a48);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x468bc9(0xca)]='policy\x20show';['description']='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';['validate'](_0x46c5be){const _0x36f5f2=a32_0x468bc9;if(_0x46c5be['args'][_0x36f5f2(0xe9)]===0x0)return _0x36f5f2(0xdb);return undefined;}async['execute'](_0x5e8ec0){const _0x532fe3=a32_0x468bc9,{options:_0xafc7e3,tdx:_0x5e65cd}=_0x5e8ec0,_0x2eb9dd=_0x5e8ec0['args'][0x0],_0x14cd40=await withSpinner('Fetching\x20policy...',async()=>{const _0x5a5b4d=a32_0x343d,_0x2cc199=await _0x5e65cd[_0x5a5b4d(0xd1)][_0x5a5b4d(0xf9)](_0x2eb9dd),[_0x592fb8,_0x288f2a]=await Promise[_0x5a5b4d(0xd9)]([_0x5e65cd[_0x5a5b4d(0xd1)]['getPolicyPermissions'](_0x2cc199['id']),_0x5e65cd['policy'][_0x5a5b4d(0xef)](_0x2cc199['id'])]);return{'policy':_0x2cc199,'perms':_0x592fb8,'users':_0x288f2a};},{'verbose':_0xafc7e3[_0x532fe3(0xc8)]}),{policy:_0x3c3803,perms:_0x4099ad,users:_0x4bf8eb}=_0x14cd40['data'];if(isStructuredFormat(_0xafc7e3))return await handleSingleObjectOutput({..._0x3c3803,'permissions':_0x4099ad[_0x532fe3(0xcd)],'users':_0x4bf8eb},_0xafc7e3),0x0;console[_0x532fe3(0xf8)]('\x0a'+a32_0x14bd6d['bold']('📋')+'\x20'+a32_0x14bd6d[_0x532fe3(0xdd)](_0x3c3803[_0x532fe3(0xca)])+'\x20'+a32_0x14bd6d[_0x532fe3(0xcf)](_0x532fe3(0xda)+_0x3c3803['id']+')'));_0x3c3803[_0x532fe3(0xd3)]&&console['log']('\x20\x20\x20'+a32_0x14bd6d[_0x532fe3(0xcf)](_0x3c3803[_0x532fe3(0xd3)]));console[_0x532fe3(0xf8)](_0x532fe3(0xfc)+_0x4bf8eb[_0x532fe3(0xe9)]+_0x532fe3(0xdf)+(_0x4bf8eb['length']!==0x1?'s':'')+_0x532fe3(0xd6)),printPermissionsMap(_0x4099ad['permissions']);if(_0x4bf8eb['length']>0x0){console[_0x532fe3(0xf8)]('\x0a'+a32_0x14bd6d[_0x532fe3(0xdd)](_0x532fe3(0xf0))+':');for(const _0x31fc94 of _0x4bf8eb){const _0x45e7da=_0x31fc94['email']&&_0x31fc94['email']!==_0x31fc94[_0x532fe3(0xca)]?a32_0x14bd6d[_0x532fe3(0xcf)]('\x20<'+_0x31fc94[_0x532fe3(0xd8)]+'>'):'';console['log'](_0x532fe3(0xe0)+_0x31fc94[_0x532fe3(0xca)]+_0x45e7da);}}return console[_0x532fe3(0xf8)](),0x0;}}function printPermissionsMap(_0x116a6f){const _0x2c2bc2=a32_0x468bc9,_0x1dd303=Object[_0x2c2bc2(0xfa)](_0x116a6f);console[_0x2c2bc2(0xf8)]('\x0a'+a32_0x14bd6d[_0x2c2bc2(0xdd)](_0x2c2bc2(0xe4))+':');if(_0x1dd303[_0x2c2bc2(0xe9)]===0x0){console['log'](a32_0x14bd6d[_0x2c2bc2(0xcf)](_0x2c2bc2(0xec)));return;}const _0x34b342=Math['max'](..._0x1dd303[_0x2c2bc2(0xe2)](([_0x3d6848])=>_0x3d6848[_0x2c2bc2(0xe9)]));for(const [_0x5e48f8,_0x524265]of _0x1dd303){const _0x4a089a=formatOperations(_0x524265);console[_0x2c2bc2(0xf8)]('\x20\x20'+_0x5e48f8[_0x2c2bc2(0xfd)](_0x34b342+0x2)+_0x4a089a);}}function formatOperations(_0x444122){const _0x3a43bb=a32_0x468bc9,_0x16daa3=[...new Set(_0x444122[_0x3a43bb(0xe2)](_0xca1587=>_0xca1587[_0x3a43bb(0xe1)]))];return _0x16daa3[_0x3a43bb(0xcb)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x1fc065=a33_0x3eb6;(function(_0x4e64e3,_0xae3739){const _0x54018d=a33_0x3eb6,_0x5c0a68=_0x4e64e3();while(!![]){try{const _0x13960e=-parseInt(_0x54018d(0x197))/0x1+-parseInt(_0x54018d(0x1c0))/0x2+parseInt(_0x54018d(0x1e0))/0x3*(-parseInt(_0x54018d(0x1b2))/0x4)+-parseInt(_0x54018d(0x1c3))/0x5*(parseInt(_0x54018d(0x1e9))/0x6)+-parseInt(_0x54018d(0x1e3))/0x7+parseInt(_0x54018d(0x1dd))/0x8+parseInt(_0x54018d(0x1cd))/0x9;if(_0x13960e===_0xae3739)break;else _0x5c0a68['push'](_0x5c0a68['shift']());}catch(_0x943ec9){_0x5c0a68['push'](_0x5c0a68['shift']());}}}(a33_0x364c,0xa877a));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_0x4d8687 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a33_0x3eb6(_0x44bad2,_0x26dbf5){_0x44bad2=_0x44bad2-0x196;const _0x364c8c=a33_0x364c();let _0x3eb6e4=_0x364c8c[_0x44bad2];return _0x3eb6e4;}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_0x2d5d7a from'prompts';import a33_0x283110 from'chalk';function validateProfileName(_0x358c31,_0x25e548){const _0x8b6f9d=a33_0x3eb6;if(!_0x358c31||!_0x358c31[_0x8b6f9d(0x1b7)]())return _0x8b6f9d(0x1a7);const _0x5708ff=_0x358c31[_0x8b6f9d(0x1b7)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5708ff))return _0x8b6f9d(0x1f8);if(!_0x25e548?.[_0x8b6f9d(0x1c2)]&&profileExists(_0x5708ff))return _0x8b6f9d(0x1bf)+_0x5708ff+_0x8b6f9d(0x1df)+_0x5708ff+_0x8b6f9d(0x1bd);return!![];}function a33_0x364c(){const _0x4b0c59=['profile:set','✗\x20Validation\x20failed:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','597872HcxzkX','Enter\x20description\x20(optional):','\x27\x20requires\x20API\x20key\x20validation.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Site\x20was\x20not\x20changed.','ERROR','database','\x20\x20(no\x20profiles\x20found)','password','logLevel','(session:\x20','profile:use','Enter\x20your\x20TD\x20API\x20key:','\x0aSaved\x20to:\x20','session','\x27.\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20cannot\x20be\x20empty','llm_agent','validate','\x20API\x20key\x20is\x20valid\x20(User:\x20','execute','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Set\x20a\x20profile\x20configuration\x20value','includes','You\x20can\x20find\x20your\x20API\x20key\x20at:','force','\x20Profile\x20\x27','3242472isWIYn','error','site','Removed\x20existing\x20profile\x20\x27','green','trim','Validating\x20API\x20key...','\x0aOperation\x20cancelled','confirm','description','\x27\x20updated:\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','join','Profile\x20\x27','1767254hKFLsK','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','skipExistsCheck','75SXsJIg','tdx:\x20profile\x20set','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','length','tdx:\x20profile\x20create','split','profileName','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','(cleared)','38600478gpWaqP','Unknown\x20key\x20\x27','Set\x20session\x20profile','email','profile:delete','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','llm_project','bold','\x20--default\x27\x20to\x20save\x20permanently','Enter\x20profile\x20name:','\x27\x20does\x20not\x20exist.','parent_segment','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Changing\x20site\x20to\x20\x27','\x0aAvailable\x20profiles:','create','3323616vubvBU','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','3JQutXw','oauth','Delete\x20a\x20profile','8938090DzxIMa','\x0aSetup\x20cancelled','apiKey','warn','name','yellow','178146aOpqVq','getUserInfo','message','profile','dim','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>','text','log','VALID_KEYS','/app/mp/ak','Operation\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','us01','API\x20key\x20cannot\x20be\x20empty','config','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Session\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','status','Default\x20profile\x20set\x20to:\x20','all'];a33_0x364c=function(){return _0x4b0c59;};return a33_0x364c();}async function deleteProfileAndCredentials(_0xaad341){const _0x111701=a33_0x3eb6;removeProfileFromUserConfig(_0xaad341);const _0x493a4a=await isKeychainAvailable();_0x493a4a&&await Promise[_0x111701(0x1fe)]([deleteKeychainAPIKey(_0xaad341),deleteOAuthTokens(_0xaad341)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]='profile:create';['description']='Create\x20a\x20new\x20profile';async['execute'](_0x816bba){const _0x22567c=a33_0x1fc065,{options:_0x41faee,args:_0x342d29}=_0x816bba,_0x35d2cc=!!_0x41faee[_0x22567c(0x1b0)];console['log'](a33_0x283110[_0x22567c(0x1d4)](_0x22567c(0x1c7)));let _0x48db37;if(_0x342d29[_0x22567c(0x1c6)]>0x0&&_0x342d29[0x0]){const _0x94585c=_0x342d29[0x0][_0x22567c(0x1b7)]();_0x35d2cc&&profileExists(_0x94585c)&&(await deleteProfileAndCredentials(_0x94585c),console[_0x22567c(0x1f0)](_0x22567c(0x1b5)+_0x94585c+'\x27'));const _0x3bc914=validateProfileName(_0x94585c);if(_0x3bc914!==!![])return console[_0x22567c(0x1b3)](a33_0x283110[_0x22567c(0x1cb)](_0x3bc914)),0x1;_0x48db37=_0x94585c;}else{const _0x2618aa=await a33_0x2d5d7a({'type':_0x22567c(0x1ef),'name':_0x22567c(0x1c9),'message':_0x22567c(0x1d6),'validate':_0x18cbbe=>validateProfileName(_0x18cbbe,{'skipExistsCheck':_0x35d2cc})});if(!_0x2618aa[_0x22567c(0x1c9)])return console[_0x22567c(0x1f0)](_0x22567c(0x1e4)),0x1;_0x48db37=_0x2618aa['profileName']['trim'](),_0x35d2cc&&profileExists(_0x48db37)&&(await deleteProfileAndCredentials(_0x48db37),console[_0x22567c(0x1f0)](_0x22567c(0x1b5)+_0x48db37+'\x27'));}const _0x1bbcb6=await a33_0x2d5d7a({'type':'text','name':_0x22567c(0x1bb),'message':_0x22567c(0x198)}),_0x60258d=_0x1bbcb6['description']?.[_0x22567c(0x1b7)]()||undefined,_0x4bbcf5=_0x41faee['site']||_0x22567c(0x1f5),_0x57ca69=await promptSiteSelection(_0x4bbcf5,_0x48db37,'Setup\x20cancelled');if(!_0x57ca69)return 0x1;const _0x1264a0=resolveSite(_0x57ca69),_0x44dbfc=await promptAuthMethod();if(!_0x44dbfc)return console[_0x22567c(0x1f0)](_0x22567c(0x1e4)),0x1;if(_0x44dbfc===_0x22567c(0x1e1)){if(_0x60258d){const _0x1609fb={'site':_0x1264a0,'description':_0x60258d};saveProfileToUserConfig(_0x48db37,_0x1609fb);}const {accountName:_0x56e590}=_0x41faee;return await runOAuthLoginFlow(_0x1264a0,_0x48db37,_0x41faee['logLevel']??LogLevel[_0x22567c(0x19c)],{'accountName':_0x56e590}),0x0;}console['log'](_0x22567c(0x1f9)+_0x1264a0),console['log'](_0x22567c(0x1af)),console['log']('\x20\x20'+getConsoleUrl(_0x1264a0,_0x22567c(0x1f2)));const _0x495af5=await a33_0x2d5d7a({'type':_0x22567c(0x19f),'name':_0x22567c(0x1e5),'message':_0x22567c(0x1a3),'validate':_0x256132=>{const _0x6c5b91=_0x22567c;if(!_0x256132||!_0x256132[_0x6c5b91(0x1b7)]())return _0x6c5b91(0x1f6);return!![];}});if(!_0x495af5[_0x22567c(0x1e5)])return console['log'](_0x22567c(0x1e4)),0x1;const _0x2af1c6=_0x495af5['apiKey'];console[_0x22567c(0x1f0)]('Validating\x20API\x20key...');try{const _0x1e1005=TDX[_0x22567c(0x1dc)]({'site':_0x1264a0,'apiKey':_0x2af1c6[_0x22567c(0x1b7)](),'logLevel':_0x41faee['logLevel']??LogLevel[_0x22567c(0x19c)]}),_0x55fe84=await _0x1e1005['jobs'][_0x22567c(0x1ea)]();console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x55fe84[_0x22567c(0x1d0)]+')');const _0x110fc8=await isKeychainAvailable();_0x110fc8?(await saveAPIKeyAsync(_0x2af1c6[_0x22567c(0x1b7)](),_0x1264a0,_0x48db37),console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+_0x22567c(0x1ac)+_0x48db37+')')):(console[_0x22567c(0x1e6)](a33_0x283110[_0x22567c(0x1e8)](_0x22567c(0x1c5))),console[_0x22567c(0x1e6)](a33_0x283110['yellow'](_0x22567c(0x19a))));const _0x90c994={'site':_0x1264a0,..._0x60258d&&{'description':_0x60258d}};return saveProfileToUserConfig(_0x48db37,_0x90c994),console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+_0x22567c(0x1b1)+_0x48db37+'\x27\x20created'),console[_0x22567c(0x1f0)](),console[_0x22567c(0x1f0)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x22567c(0x1fb)+_0x48db37+_0x22567c(0x1f4)),console['log'](_0x22567c(0x1fb)+_0x48db37+_0x22567c(0x1d9)),0x0;}catch(_0x407575){if(_0x407575 instanceof HTTPClientError&&_0x407575[_0x22567c(0x1fc)]===0x191)return printAuthError(_0x407575),0x1;return console[_0x22567c(0x1b3)](a33_0x283110[_0x22567c(0x1cb)](_0x22567c(0x200)+(_0x407575 instanceof Error?_0x407575[_0x22567c(0x1eb)]:String(_0x407575)))),console[_0x22567c(0x1b3)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1d1);['description']=a33_0x1fc065(0x1e2);[a33_0x1fc065(0x1a9)](_0x4c9ca4){const _0x57b9e6=a33_0x1fc065,{args:_0x23555b}=_0x4c9ca4;if(_0x23555b[_0x57b9e6(0x1c6)]===0x0)return _0x57b9e6(0x196);return undefined;}async[a33_0x1fc065(0x1ab)](_0x45a7fe){const _0x533951=a33_0x1fc065,{args:_0x14cd29}=_0x45a7fe,_0x5989a5=_0x14cd29[0x0];console[_0x533951(0x1f0)](a33_0x283110[_0x533951(0x1d4)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x5989a5)){console[_0x533951(0x1b3)](a33_0x283110[_0x533951(0x1cb)](_0x533951(0x1bf)+_0x5989a5+_0x533951(0x1d7))),console['log']('\x0aAvailable\x20profiles:');const _0x5e925a=listProfiles();if(_0x5e925a[_0x533951(0x1c6)]===0x0)console['log'](_0x533951(0x19e));else for(const _0x22eadf of _0x5e925a){console[_0x533951(0x1f0)]('\x20\x20-\x20'+_0x22eadf[_0x533951(0x1e7)]);}return 0x1;}const _0x23e2f2=await a33_0x2d5d7a({'type':'confirm','name':_0x533951(0x1ba),'message':_0x533951(0x1c1)+_0x5989a5+'\x27?','initial':![]});if(!_0x23e2f2[_0x533951(0x1ba)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x5989a5),console['log'](a33_0x283110[_0x533951(0x1b6)]('✓')+_0x533951(0x1b1)+_0x5989a5+'\x27\x20deleted');}catch(_0xf2baeb){return console[_0x533951(0x1b3)](a33_0x283110[_0x533951(0x1cb)]('Failed\x20to\x20delete\x20profile:\x20'+(_0xf2baeb instanceof Error?_0xf2baeb[_0x533951(0x1eb)]:String(_0xf2baeb)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1ff);[a33_0x1fc065(0x1bb)]=a33_0x1fc065(0x1ad);static [a33_0x1fc065(0x1f1)]=['site',a33_0x1fc065(0x19d),a33_0x1fc065(0x1d8),a33_0x1fc065(0x1d3),a33_0x1fc065(0x1a8),a33_0x1fc065(0x1bb)];[a33_0x1fc065(0x1a9)](_0x3621e4){const _0x4e9802=a33_0x1fc065,{args:_0x4807c5,options:_0x36eac7}=_0x3621e4,_0x1339b7=_0x36eac7[_0x4e9802(0x1ec)]||getActiveProfile();if(!_0x1339b7)return _0x4e9802(0x1ee);if(_0x4807c5[_0x4e9802(0x1c6)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');const _0x33b9fe=_0x4807c5[0x0];if(!_0x33b9fe[_0x4e9802(0x1ae)]('='))return _0x4e9802(0x1ca)+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');const [_0x34659b]=_0x33b9fe[_0x4e9802(0x1c8)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x4e9802(0x1ae)](_0x34659b))return _0x4e9802(0x1ce)+_0x34659b+_0x4e9802(0x1a6)+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');return undefined;}async[a33_0x1fc065(0x1ab)](_0x595d55){const _0x418091=a33_0x1fc065,{args:_0x35d864,options:_0x43b4ec}=_0x595d55,_0x498242=_0x43b4ec[_0x418091(0x1ec)]||getActiveProfile(),[_0x353e7f,..._0x3c6232]=_0x35d864[0x0]['split']('='),_0x290bdf=_0x3c6232[_0x418091(0x1be)]('=');console[_0x418091(0x1f0)](a33_0x283110[_0x418091(0x1d4)](_0x418091(0x1c4)));if(!profileExists(_0x498242)){const _0x2379f1=await a33_0x2d5d7a({'type':'confirm','name':_0x418091(0x1dc),'message':_0x418091(0x1bf)+_0x498242+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x2379f1[_0x418091(0x1dc)])return console[_0x418091(0x1f0)](_0x418091(0x1f3)),0x1;}const _0x455321=loadProfile(_0x498242),_0x16261f=_0x455321?.[_0x418091(0x1f7)]||{};if(_0x353e7f===_0x418091(0x1b4)){const _0x5d0166=resolveSite(_0x290bdf);console[_0x418091(0x1f0)](_0x418091(0x1da)+_0x5d0166+_0x418091(0x199)),console[_0x418091(0x1f0)](_0x418091(0x1d2)),console[_0x418091(0x1f0)]('\x20\x20'+getConsoleUrl(_0x5d0166,_0x418091(0x1f2)));const _0x2f9604=await a33_0x2d5d7a({'type':_0x418091(0x19f),'name':_0x418091(0x1e5),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x490bbf=>{const _0x114aed=_0x418091;if(!_0x490bbf||!_0x490bbf[_0x114aed(0x1b7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2f9604[_0x418091(0x1e5)])return console[_0x418091(0x1f0)](_0x418091(0x1b9)),0x1;console[_0x418091(0x1f0)](_0x418091(0x1b8));try{const _0x27f31d=TDX[_0x418091(0x1dc)]({'site':_0x5d0166,'apiKey':_0x2f9604[_0x418091(0x1e5)][_0x418091(0x1b7)](),'logLevel':_0x43b4ec[_0x418091(0x1a0)]??LogLevel[_0x418091(0x19c)]}),_0x402086=await _0x27f31d['jobs']['getUserInfo']();console['log'](a33_0x283110[_0x418091(0x1b6)]('✓')+_0x418091(0x1aa)+_0x402086['email']+')');const _0x1b2238=await isKeychainAvailable();_0x1b2238?(await saveAPIKeyAsync(_0x2f9604['apiKey'][_0x418091(0x1b7)](),_0x5d0166,_0x498242),console['log'](a33_0x283110[_0x418091(0x1b6)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x418091(0x1e6)](a33_0x283110[_0x418091(0x1e8)](_0x418091(0x1c5))),_0x16261f[_0x418091(0x1b4)]=_0x5d0166;}catch(_0x132df7){if(_0x132df7 instanceof HTTPClientError&&_0x132df7['status']===0x191)return printAuthError(_0x132df7),0x1;return console[_0x418091(0x1b3)](a33_0x283110[_0x418091(0x1cb)]('✗\x20Validation\x20failed:\x20'+(_0x132df7 instanceof Error?_0x132df7[_0x418091(0x1eb)]:String(_0x132df7)))),console[_0x418091(0x1b3)](_0x418091(0x19b)),0x1;}}else _0x16261f[_0x353e7f]=_0x290bdf||undefined;return saveProfileToUserConfig(_0x498242,_0x16261f),console[_0x418091(0x1f0)](a33_0x283110[_0x418091(0x1b6)]('✓')+_0x418091(0x1b1)+_0x498242+_0x418091(0x1bc)+_0x353e7f+'='+(_0x290bdf||_0x418091(0x1cc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1a2);['description']=a33_0x1fc065(0x1cf);[a33_0x1fc065(0x1a9)](_0xd9385b){const _0x135f3a=a33_0x1fc065,{args:_0x1d8c0d}=_0xd9385b;if(_0x1d8c0d[_0x135f3a(0x1c6)]===0x0)return _0x135f3a(0x1de);return undefined;}async[a33_0x1fc065(0x1ab)](_0x3f6640){const _0xf2045f=a33_0x1fc065,{args:_0xb303f3,options:_0x142377}=_0x3f6640,_0xd28e78=_0xb303f3[0x0],_0x56e4a0=_0x142377['default'];cleanExpiredSessions();if(!profileExists(_0xd28e78)){console['error'](a33_0x283110[_0xf2045f(0x1cb)](_0xf2045f(0x1bf)+_0xd28e78+_0xf2045f(0x1d7))),console[_0xf2045f(0x1f0)](_0xf2045f(0x1db));const _0x12a2f0=listProfiles();if(_0x12a2f0[_0xf2045f(0x1c6)]===0x0)console[_0xf2045f(0x1f0)](_0xf2045f(0x19e));else for(const _0x2175a9 of _0x12a2f0){console[_0xf2045f(0x1f0)]('\x20\x20-\x20'+_0x2175a9['name']);}return 0x1;}if(_0x56e4a0){const _0x5c4a8b=a33_0x4d8687[_0xf2045f(0x1be)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0xd28e78),console[_0xf2045f(0x1f0)](_0xf2045f(0x1fd)+a33_0x283110['green'](_0xd28e78)),console['log'](a33_0x283110[_0xf2045f(0x1ed)](_0xf2045f(0x1a4)+_0x5c4a8b)),0x0;}const _0x2275a=getSessionID(_0x142377[_0xf2045f(0x1a5)]);return saveSessionContext({'profile':_0xd28e78},_0x142377[_0xf2045f(0x1a5)]),console['log'](_0xf2045f(0x1fa)+a33_0x283110['green'](_0xd28e78)+'\x20'+a33_0x283110[_0xf2045f(0x1ed)](_0xf2045f(0x1a1)+_0x2275a+')')),console[_0xf2045f(0x1f0)](a33_0x283110['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xd28e78+_0xf2045f(0x1d5))),0x0;}}
|
|
1
|
+
const a33_0x11f175=a33_0x369e;(function(_0x458883,_0x48c428){const _0x1e7c85=a33_0x369e,_0x3b1184=_0x458883();while(!![]){try{const _0x2a567f=parseInt(_0x1e7c85(0x174))/0x1+-parseInt(_0x1e7c85(0x187))/0x2+parseInt(_0x1e7c85(0x13c))/0x3+-parseInt(_0x1e7c85(0x14c))/0x4+-parseInt(_0x1e7c85(0x144))/0x5*(-parseInt(_0x1e7c85(0x18c))/0x6)+-parseInt(_0x1e7c85(0x18a))/0x7*(-parseInt(_0x1e7c85(0x180))/0x8)+parseInt(_0x1e7c85(0x184))/0x9*(-parseInt(_0x1e7c85(0x146))/0xa);if(_0x2a567f===_0x48c428)break;else _0x3b1184['push'](_0x3b1184['shift']());}catch(_0x47903a){_0x3b1184['push'](_0x3b1184['shift']());}}}(a33_0x42d4,0x3b24b));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_0x231209 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x42d4(){const _0x58c103=['create','78248pNObPj','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','bold','dim','9NxoJVJ','password','ERROR','148448wnjkHB','all','\x20--default\x27\x20to\x20save\x20permanently','287RQqWNS','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','18ODnSpM','tdx.json','\x27\x20does\x20not\x20exist.','/app/mp/ak','\x20\x20tdx\x20--profile\x20','\x0aOperation\x20cancelled','Enter\x20description\x20(optional):','yellow','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27.\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Delete\x20a\x20profile','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x27\x20created','\x27\x20deleted','trim','Setup\x20cancelled','Set\x20session\x20profile','email','profile:use','(session:\x20','Enter\x20your\x20TD\x20API\x20key:','log','886686NHndof','logLevel','Validating\x20API\x20key...','llm_project','config','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profile','green','548425pLuYDb','\x20\x20-\x20','6199280RDsnyf','\x20\x20(no\x20profiles\x20found)','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','apiKey','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','text','1597088dFMcfS','\x20Profile\x20\x27','includes','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','validate','length','Operation\x20cancelled','skipExistsCheck','jobs','red','✗\x20Validation\x20failed:\x20','execute','name','Create\x20a\x20new\x20profile','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','message','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSetup\x20cancelled','Unknown\x20key\x20\x27','parent_segment','Profile\x20\x27','tdx:\x20profile\x20create','Session\x20profile\x20set\x20to:\x20','profile:create','\x27\x20requires\x20API\x20key\x20validation.','join','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','profileName','Set\x20a\x20profile\x20configuration\x20value','error','session','Default\x20profile\x20set\x20to:\x20','Site\x20was\x20not\x20changed.','tdx:\x20profile\x20set','confirm','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','description','\x0aAvailable\x20profiles:','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>','310037MHWMRM','site','Removal\x20cancelled','llm_agent','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Changing\x20site\x20to\x20\x27','status','us01','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profile:set','VALID_KEYS'];a33_0x42d4=function(){return _0x58c103;};return a33_0x42d4();}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_0x111673 from'prompts';import a33_0x1d36b9 from'chalk';function validateProfileName(_0x46c09d,_0x18e22b){const _0x3ba2e7=a33_0x369e;if(!_0x46c09d||!_0x46c09d[_0x3ba2e7(0x19b)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x3ea4ea=_0x46c09d[_0x3ba2e7(0x19b)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x3ea4ea))return _0x3ba2e7(0x181);if(!_0x18e22b?.[_0x3ba2e7(0x154)]&&profileExists(_0x3ea4ea))return _0x3ba2e7(0x161)+_0x3ea4ea+_0x3ba2e7(0x170)+_0x3ea4ea+_0x3ba2e7(0x198);return!![];}async function deleteProfileAndCredentials(_0x496865){const _0x5385a4=a33_0x369e;removeProfileFromUserConfig(_0x496865);const _0x2c30b8=await isKeychainAvailable();_0x2c30b8&&await Promise[_0x5385a4(0x188)]([deleteKeychainAPIKey(_0x496865),deleteOAuthTokens(_0x496865)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x11f175(0x159)]=a33_0x11f175(0x164);[a33_0x11f175(0x171)]=a33_0x11f175(0x15a);async[a33_0x11f175(0x158)](_0x217ef0){const _0x466fc8=a33_0x11f175,{options:_0x554b3b,args:_0x45a099}=_0x217ef0,_0x3f8637=!!_0x554b3b['force'];console['log'](a33_0x1d36b9[_0x466fc8(0x182)](_0x466fc8(0x162)));let _0xae8cfb;if(_0x45a099['length']>0x0&&_0x45a099[0x0]){const _0x4bdfe2=_0x45a099[0x0][_0x466fc8(0x19b)]();_0x3f8637&&profileExists(_0x4bdfe2)&&(await deleteProfileAndCredentials(_0x4bdfe2),console[_0x466fc8(0x13b)]('Removed\x20existing\x20profile\x20\x27'+_0x4bdfe2+'\x27'));const _0x2b22a3=validateProfileName(_0x4bdfe2);if(_0x2b22a3!==!![])return console[_0x466fc8(0x16a)](a33_0x1d36b9['red'](_0x2b22a3)),0x1;_0xae8cfb=_0x4bdfe2;}else{const _0x1c0f4f=await a33_0x111673({'type':_0x466fc8(0x14b),'name':_0x466fc8(0x168),'message':'Enter\x20profile\x20name:','validate':_0x2823cf=>validateProfileName(_0x2823cf,{'skipExistsCheck':_0x3f8637})});if(!_0x1c0f4f[_0x466fc8(0x168)])return console[_0x466fc8(0x13b)]('\x0aSetup\x20cancelled'),0x1;_0xae8cfb=_0x1c0f4f['profileName'][_0x466fc8(0x19b)](),_0x3f8637&&profileExists(_0xae8cfb)&&(await deleteProfileAndCredentials(_0xae8cfb),console[_0x466fc8(0x13b)]('Removed\x20existing\x20profile\x20\x27'+_0xae8cfb+'\x27'));}const _0x1f27d2=await a33_0x111673({'type':_0x466fc8(0x14b),'name':_0x466fc8(0x171),'message':_0x466fc8(0x192)}),_0x3dcc25=_0x1f27d2['description']?.[_0x466fc8(0x19b)]()||undefined,_0x38acee=_0x554b3b[_0x466fc8(0x175)]||_0x466fc8(0x17b),_0x437ba1=await promptSiteSelection(_0x38acee,_0xae8cfb,_0x466fc8(0x19c));if(!_0x437ba1)return 0x1;const _0x75fd1a=resolveSite(_0x437ba1),_0x57a5f8=await promptAuthMethod();if(!_0x57a5f8)return console[_0x466fc8(0x13b)](_0x466fc8(0x15e)),0x1;if(_0x57a5f8==='oauth'){if(_0x3dcc25){const _0x52675a={'site':_0x75fd1a,'description':_0x3dcc25};saveProfileToUserConfig(_0xae8cfb,_0x52675a);}const {accountName:_0xefbd95}=_0x554b3b;return await runOAuthLoginFlow(_0x75fd1a,_0xae8cfb,_0x554b3b['logLevel']??LogLevel[_0x466fc8(0x186)],{'accountName':_0xefbd95}),0x0;}console['log'](_0x466fc8(0x141)+_0x75fd1a),console[_0x466fc8(0x13b)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x466fc8(0x13b)]('\x20\x20'+getConsoleUrl(_0x75fd1a,_0x466fc8(0x18f)));const _0x130769=await a33_0x111673({'type':_0x466fc8(0x185),'name':_0x466fc8(0x149),'message':_0x466fc8(0x13a),'validate':_0x4c15c9=>{const _0x438a63=_0x466fc8;if(!_0x4c15c9||!_0x4c15c9[_0x438a63(0x19b)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x130769[_0x466fc8(0x149)])return console[_0x466fc8(0x13b)](_0x466fc8(0x15e)),0x1;const _0xcc8b7f=_0x130769[_0x466fc8(0x149)];console['log']('Validating\x20API\x20key...');try{const _0x37ca94=TDX['create']({'site':_0x75fd1a,'apiKey':_0xcc8b7f[_0x466fc8(0x19b)](),'logLevel':_0x554b3b['logLevel']??LogLevel[_0x466fc8(0x186)]}),_0xc9d2b2=await _0x37ca94[_0x466fc8(0x155)]['getUserInfo']();console[_0x466fc8(0x13b)](a33_0x1d36b9[_0x466fc8(0x143)]('✓')+_0x466fc8(0x15d)+_0xc9d2b2[_0x466fc8(0x19e)]+')');const _0x43eb73=await isKeychainAvailable();_0x43eb73?(await saveAPIKeyAsync(_0xcc8b7f[_0x466fc8(0x19b)](),_0x75fd1a,_0xae8cfb),console[_0x466fc8(0x13b)](a33_0x1d36b9[_0x466fc8(0x143)]('✓')+_0x466fc8(0x14a)+_0xae8cfb+')')):(console[_0x466fc8(0x14f)](a33_0x1d36b9[_0x466fc8(0x193)](_0x466fc8(0x150))),console[_0x466fc8(0x14f)](a33_0x1d36b9[_0x466fc8(0x193)](_0x466fc8(0x15b))));const _0x347693={'site':_0x75fd1a,..._0x3dcc25&&{'description':_0x3dcc25}};return saveProfileToUserConfig(_0xae8cfb,_0x347693),console[_0x466fc8(0x13b)](a33_0x1d36b9[_0x466fc8(0x143)]('✓')+_0x466fc8(0x14d)+_0xae8cfb+_0x466fc8(0x199)),console[_0x466fc8(0x13b)](),console[_0x466fc8(0x13b)](_0x466fc8(0x194)),console[_0x466fc8(0x13b)](_0x466fc8(0x190)+_0xae8cfb+_0x466fc8(0x18b)),console[_0x466fc8(0x13b)](_0x466fc8(0x190)+_0xae8cfb+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x41bc04){if(_0x41bc04 instanceof HTTPClientError&&_0x41bc04[_0x466fc8(0x17a)]===0x191)return printAuthError(_0x41bc04),0x1;return console[_0x466fc8(0x16a)](a33_0x1d36b9[_0x466fc8(0x156)](_0x466fc8(0x157)+(_0x41bc04 instanceof Error?_0x41bc04[_0x466fc8(0x15c)]:String(_0x41bc04)))),console[_0x466fc8(0x16a)](_0x466fc8(0x148)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';[a33_0x11f175(0x171)]=a33_0x11f175(0x197);[a33_0x11f175(0x151)](_0x16f2db){const {args:_0x41cadc}=_0x16f2db;if(_0x41cadc['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x11f175(0x158)](_0x1f50bf){const _0x1ba5eb=a33_0x11f175,{args:_0x1acff4}=_0x1f50bf,_0x3b1214=_0x1acff4[0x0];console[_0x1ba5eb(0x13b)](a33_0x1d36b9[_0x1ba5eb(0x182)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x3b1214)){console[_0x1ba5eb(0x16a)](a33_0x1d36b9['red']('Profile\x20\x27'+_0x3b1214+_0x1ba5eb(0x18e))),console[_0x1ba5eb(0x13b)](_0x1ba5eb(0x172));const _0x146e8d=listProfiles();if(_0x146e8d[_0x1ba5eb(0x152)]===0x0)console[_0x1ba5eb(0x13b)](_0x1ba5eb(0x147));else for(const _0x453230 of _0x146e8d){console['log'](_0x1ba5eb(0x145)+_0x453230[_0x1ba5eb(0x159)]);}return 0x1;}const _0x16b786=await a33_0x111673({'type':_0x1ba5eb(0x16f),'name':_0x1ba5eb(0x16f),'message':_0x1ba5eb(0x17c)+_0x3b1214+'\x27?','initial':![]});if(!_0x16b786[_0x1ba5eb(0x16f)])return console[_0x1ba5eb(0x13b)](_0x1ba5eb(0x176)),0x0;try{await deleteProfileAndCredentials(_0x3b1214),console['log'](a33_0x1d36b9[_0x1ba5eb(0x143)]('✓')+_0x1ba5eb(0x14d)+_0x3b1214+_0x1ba5eb(0x19a));}catch(_0x3ee7a1){return console[_0x1ba5eb(0x16a)](a33_0x1d36b9[_0x1ba5eb(0x156)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x3ee7a1 instanceof Error?_0x3ee7a1['message']:String(_0x3ee7a1)))),0x1;}return 0x0;}}function a33_0x369e(_0x58eaf6,_0x55811b){_0x58eaf6=_0x58eaf6-0x139;const _0x42d4c4=a33_0x42d4();let _0x369ef8=_0x42d4c4[_0x58eaf6];return _0x369ef8;}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x11f175(0x17d);[a33_0x11f175(0x171)]=a33_0x11f175(0x169);static [a33_0x11f175(0x17e)]=[a33_0x11f175(0x175),'database',a33_0x11f175(0x160),a33_0x11f175(0x13f),a33_0x11f175(0x177),a33_0x11f175(0x171)];['validate'](_0x198ab9){const _0x53fae2=a33_0x11f175,{args:_0x41002d,options:_0x56120e}=_0x198ab9,_0x419de8=_0x56120e['profile']||getActiveProfile();if(!_0x419de8)return _0x53fae2(0x173);if(_0x41002d[_0x53fae2(0x152)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x53fae2(0x17e)][_0x53fae2(0x166)](',\x20');const _0x233c50=_0x41002d[0x0];if(!_0x233c50[_0x53fae2(0x14e)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x53fae2(0x17e)][_0x53fae2(0x166)](',\x20');const [_0x419c50]=_0x233c50['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x419c50))return _0x53fae2(0x15f)+_0x419c50+_0x53fae2(0x195)+ProfileSetCommand[_0x53fae2(0x17e)][_0x53fae2(0x166)](',\x20');return undefined;}async[a33_0x11f175(0x158)](_0x300f33){const _0x5e39f8=a33_0x11f175,{args:_0x32b969,options:_0x3b15c5}=_0x300f33,_0x4fa528=_0x3b15c5[_0x5e39f8(0x142)]||getActiveProfile(),[_0x2b8701,..._0x3d86a3]=_0x32b969[0x0]['split']('='),_0x4734ed=_0x3d86a3['join']('=');console[_0x5e39f8(0x13b)](a33_0x1d36b9[_0x5e39f8(0x182)](_0x5e39f8(0x16e)));if(!profileExists(_0x4fa528)){const _0x2a788f=await a33_0x111673({'type':'confirm','name':_0x5e39f8(0x17f),'message':_0x5e39f8(0x161)+_0x4fa528+_0x5e39f8(0x178),'initial':!![]});if(!_0x2a788f[_0x5e39f8(0x17f)])return console[_0x5e39f8(0x13b)](_0x5e39f8(0x153)),0x1;}const _0x18ada6=loadProfile(_0x4fa528),_0x4dcf12=_0x18ada6?.[_0x5e39f8(0x140)]||{};if(_0x2b8701==='site'){const _0xdfed3f=resolveSite(_0x4734ed);console['log'](_0x5e39f8(0x179)+_0xdfed3f+_0x5e39f8(0x165)),console[_0x5e39f8(0x13b)](_0x5e39f8(0x196)),console['log']('\x20\x20'+getConsoleUrl(_0xdfed3f,'/app/mp/ak'));const _0x53dd86=await a33_0x111673({'type':_0x5e39f8(0x185),'name':_0x5e39f8(0x149),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x10208e=>{if(!_0x10208e||!_0x10208e['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x53dd86['apiKey'])return console[_0x5e39f8(0x13b)](_0x5e39f8(0x191)),0x1;console['log'](_0x5e39f8(0x13e));try{const _0x3f64a4=TDX[_0x5e39f8(0x17f)]({'site':_0xdfed3f,'apiKey':_0x53dd86['apiKey']['trim'](),'logLevel':_0x3b15c5[_0x5e39f8(0x13d)]??LogLevel[_0x5e39f8(0x186)]}),_0x3b86eb=await _0x3f64a4['jobs']['getUserInfo']();console[_0x5e39f8(0x13b)](a33_0x1d36b9[_0x5e39f8(0x143)]('✓')+_0x5e39f8(0x15d)+_0x3b86eb[_0x5e39f8(0x19e)]+')');const _0x169987=await isKeychainAvailable();_0x169987?(await saveAPIKeyAsync(_0x53dd86[_0x5e39f8(0x149)][_0x5e39f8(0x19b)](),_0xdfed3f,_0x4fa528),console[_0x5e39f8(0x13b)](a33_0x1d36b9['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x5e39f8(0x14f)](a33_0x1d36b9[_0x5e39f8(0x193)](_0x5e39f8(0x150))),_0x4dcf12[_0x5e39f8(0x175)]=_0xdfed3f;}catch(_0x2d4563){if(_0x2d4563 instanceof HTTPClientError&&_0x2d4563['status']===0x191)return printAuthError(_0x2d4563),0x1;return console[_0x5e39f8(0x16a)](a33_0x1d36b9['red']('✗\x20Validation\x20failed:\x20'+(_0x2d4563 instanceof Error?_0x2d4563[_0x5e39f8(0x15c)]:String(_0x2d4563)))),console['error'](_0x5e39f8(0x16d)),0x1;}}else _0x4dcf12[_0x2b8701]=_0x4734ed||undefined;return saveProfileToUserConfig(_0x4fa528,_0x4dcf12),console[_0x5e39f8(0x13b)](a33_0x1d36b9[_0x5e39f8(0x143)]('✓')+_0x5e39f8(0x14d)+_0x4fa528+'\x27\x20updated:\x20'+_0x2b8701+'='+(_0x4734ed||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x11f175(0x159)]=a33_0x11f175(0x19f);[a33_0x11f175(0x171)]=a33_0x11f175(0x19d);[a33_0x11f175(0x151)](_0x23e224){const _0x53f72f=a33_0x11f175,{args:_0x46650c}=_0x23e224;if(_0x46650c['length']===0x0)return _0x53f72f(0x167);return undefined;}async[a33_0x11f175(0x158)](_0x1b709f){const _0x4d3142=a33_0x11f175,{args:_0x5dbd56,options:_0x398ee3}=_0x1b709f,_0x21c442=_0x5dbd56[0x0],_0x202ad8=_0x398ee3['default'];cleanExpiredSessions();if(!profileExists(_0x21c442)){console[_0x4d3142(0x16a)](a33_0x1d36b9[_0x4d3142(0x156)](_0x4d3142(0x161)+_0x21c442+'\x27\x20does\x20not\x20exist.')),console['log'](_0x4d3142(0x172));const _0x531ae8=listProfiles();if(_0x531ae8[_0x4d3142(0x152)]===0x0)console['log'](_0x4d3142(0x147));else for(const _0xdf6c67 of _0x531ae8){console['log']('\x20\x20-\x20'+_0xdf6c67['name']);}return 0x1;}if(_0x202ad8){const _0x3b5366=a33_0x231209['join'](getConfigDir(),_0x4d3142(0x18d));return saveActiveProfileToUserConfig(_0x21c442),console[_0x4d3142(0x13b)](_0x4d3142(0x16c)+a33_0x1d36b9['green'](_0x21c442)),console['log'](a33_0x1d36b9[_0x4d3142(0x183)]('\x0aSaved\x20to:\x20'+_0x3b5366)),0x0;}const _0x3e5966=getSessionID(_0x398ee3[_0x4d3142(0x16b)]);return saveSessionContext({'profile':_0x21c442},_0x398ee3['session']),console[_0x4d3142(0x13b)](_0x4d3142(0x163)+a33_0x1d36b9[_0x4d3142(0x143)](_0x21c442)+'\x20'+a33_0x1d36b9[_0x4d3142(0x183)](_0x4d3142(0x139)+_0x3e5966+')')),console[_0x4d3142(0x13b)](a33_0x1d36b9[_0x4d3142(0x183)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x21c442+_0x4d3142(0x189))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a34_0x1d05(){const _0xeaec8d=['Error:\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','9EKZYpj','\x20\x20Global:\x20~/.config/tdx/tdx.json','6LwUeEN','2532999aJaEra','👤\x20','dim','scope','name','config','profiles','log','14860112adWXUg','site','message','825686OdvSJh','List\x20all\x20available\x20profiles','3835284pdXTnP','map','2476246jvkbqY','1340585EXmXdn','execute','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','4270146zvOQQF','green','length','description'];a34_0x1d05=function(){return _0xeaec8d;};return a34_0x1d05();}const a34_0x32e76=a34_0x3e5a;function a34_0x3e5a(_0x423e32,_0x3aaa68){_0x423e32=_0x423e32-0x66;const _0x1d0599=a34_0x1d05();let _0x3e5a26=_0x1d0599[_0x423e32];return _0x3e5a26;}(function(_0x19c622,_0x1d4e46){const _0xfce570=a34_0x3e5a,_0x2f401a=_0x19c622();while(!![]){try{const _0x1fc05b=parseInt(_0xfce570(0x7b))/0x1+parseInt(_0xfce570(0x7f))/0x2+parseInt(_0xfce570(0x67))/0x3+-parseInt(_0xfce570(0x7d))/0x4+-parseInt(_0xfce570(0x80))/0x5*(parseInt(_0xfce570(0x6f))/0x6)+parseInt(_0xfce570(0x70))/0x7+-parseInt(_0xfce570(0x78))/0x8*(parseInt(_0xfce570(0x6d))/0x9);if(_0x1fc05b===_0x1d4e46)break;else _0x2f401a['push'](_0x2f401a['shift']());}catch(_0x360eba){_0x2f401a['push'](_0x2f401a['shift']());}}}(a34_0x1d05,0xbaab4));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x4b2e73 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x32e76(0x74)]=a34_0x32e76(0x76);[a34_0x32e76(0x6a)]=a34_0x32e76(0x7c);async[a34_0x32e76(0x81)](_0x381eb7){const _0x14c623=a34_0x32e76,{options:_0x590236}=_0x381eb7;try{const _0x5e0543=listProfiles(),_0x2aff97=getActiveProfile();if(_0x5e0543[_0x14c623(0x69)]===0x0)return console[_0x14c623(0x77)](_0x14c623(0x6c)),console[_0x14c623(0x77)](_0x14c623(0x66)),console[_0x14c623(0x77)](_0x14c623(0x6e)),0x0;const _0x320f2b=_0x5e0543[_0x14c623(0x7e)](_0x117df6=>{const _0x23b7dd=_0x14c623,_0x562276=_0x117df6[_0x23b7dd(0x74)]===_0x2aff97,_0x536a6a=getProfileParams(_0x117df6[_0x23b7dd(0x75)]);return{'name':_0x117df6[_0x23b7dd(0x74)],'active':_0x562276,'scope':_0x117df6[_0x23b7dd(0x73)],'description':_0x117df6[_0x23b7dd(0x75)][_0x23b7dd(0x6a)]||'','params':_0x536a6a};});if(isStructuredFormat(_0x590236))await handleSDKOutput(_0x320f2b,_0x590236);else for(const _0x33d1cf of _0x5e0543){const _0x1e8e53=_0x33d1cf[_0x14c623(0x74)]===_0x2aff97?a34_0x4b2e73[_0x14c623(0x68)]('\x20✓'):'',_0x5f5df7=_0x33d1cf[_0x14c623(0x75)][_0x14c623(0x79)]?a34_0x4b2e73[_0x14c623(0x72)]('\x20'+_0x33d1cf[_0x14c623(0x75)][_0x14c623(0x79)]):'',_0xff1cb5=_0x33d1cf['config'][_0x14c623(0x6a)]?a34_0x4b2e73[_0x14c623(0x72)]('\x20\x20'+_0x33d1cf[_0x14c623(0x75)][_0x14c623(0x6a)]):'';console[_0x14c623(0x77)](_0x14c623(0x71)+_0x33d1cf[_0x14c623(0x74)]+_0x1e8e53+_0x5f5df7+_0xff1cb5);}return 0x0;}catch(_0x144dc1){return _0x144dc1 instanceof Error&&console['error'](_0x14c623(0x6b)+_0x144dc1[_0x14c623(0x7a)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x53f7ba=a35_0x4a27;function a35_0x4a27(_0xfc2700,_0x5eeb5b){_0xfc2700=_0xfc2700-0x197;const _0x2809af=a35_0x2809();let _0x4a27f8=_0x2809af[_0xfc2700];return _0x4a27f8;}(function(_0x42fccf,_0x448b37){const _0x1b31c7=a35_0x4a27,_0x1ddb40=_0x42fccf();while(!![]){try{const _0x228ce2=-parseInt(_0x1b31c7(0x1c9))/0x1*(parseInt(_0x1b31c7(0x1b8))/0x2)+-parseInt(_0x1b31c7(0x198))/0x3*(parseInt(_0x1b31c7(0x1ab))/0x4)+parseInt(_0x1b31c7(0x1a6))/0x5*(-parseInt(_0x1b31c7(0x1ca))/0x6)+-parseInt(_0x1b31c7(0x1c1))/0x7+-parseInt(_0x1b31c7(0x1c6))/0x8*(parseInt(_0x1b31c7(0x1ad))/0x9)+-parseInt(_0x1b31c7(0x1bd))/0xa+parseInt(_0x1b31c7(0x1cd))/0xb;if(_0x228ce2===_0x448b37)break;else _0x1ddb40['push'](_0x1ddb40['shift']());}catch(_0x16b2b5){_0x1ddb40['push'](_0x1ddb40['shift']());}}}(a35_0x2809,0x8c667));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x2809(){const _0x1f9ec0=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','8PCFzkq','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','\x20rows\x20','234ToufFE','12vKTURk','processedRows','Schema:\x20','28233458cMONrv','\x0aAll\x20results\x20saved\x20to\x20','jobId','15EEVnoZ','validate','\x20[Job\x20ID:\x20','...','information_schema','execute','completedSplits','output','database','length','Catalog:\x20','description','elapsedTimeMillis','message','1213420UTbHhp','\x20splits','state','options','totalSplits','344180KAYCQw','No\x20SQL\x20provided','7300287tzLixI','data','catalog','Executing\x20query...','stats','site','join','Run\x20Trino\x20queries\x20(streaming)','setJobId','name','file','600evmoNj','query','Executing\x20query\x20[','originalMessage','verbose','828330kDFwsb','in\x20','error','setPhase','782810ldWnCp','args','Statement\x20','push'];a35_0x2809=function(){return _0x1f9ec0;};return a35_0x2809();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x53f7ba(0x1b6)]=a35_0x53f7ba(0x1b9);[a35_0x53f7ba(0x1a3)]=a35_0x53f7ba(0x1b4);async['execute'](_0x280b09){const _0x26ce4a=a35_0x53f7ba,{options:_0x3ff1fc,args:_0x35be13,tdx:_0x3b4290}=_0x280b09,_0x34e7e6={..._0x3ff1fc,'limitStructuredFormats':!![]},_0x40d737=_0x35be13[0x0],_0xee055e=_0x3ff1fc[_0x26ce4a(0x1b7)];let _0x2e809f;try{if(_0xee055e)_0x2e809f=readSqlStatementsFromFile(_0xee055e);else{if(_0x40d737==='-')_0x2e809f=await readSqlStatementsFromStdin();else{if(_0x40d737&&isSqlFilePath(_0x40d737))_0x2e809f=readSqlStatementsFromFile(_0x40d737);else{if(_0x40d737)_0x2e809f=splitSqlStatements(_0x40d737);else throw new Error(_0x26ce4a(0x1ac));}}}}catch(_0x5346de){return console[_0x26ce4a(0x1bf)]('Error:\x20'+_0x5346de[_0x26ce4a(0x1a5)]),0x1;}const _0x55010c=_0x3ff1fc[_0x26ce4a(0x1a0)]||_0x26ce4a(0x19c),_0x89576f=_0x3ff1fc[_0x26ce4a(0x1af)];try{const _0x382922=[],_0x189495=!!_0x3ff1fc[_0x26ce4a(0x19f)];for(let _0x39729e=0x0;_0x39729e<_0x2e809f['length'];_0x39729e++){const _0x50cf58=_0x2e809f[_0x39729e],_0x1ca243=_0x39729e+0x1,_0x4193a6=_0x2e809f[_0x26ce4a(0x1a1)],_0x1fd0fa=_0x4193a6>0x1;_0x3ff1fc[_0x26ce4a(0x1bc)]&&(console[_0x26ce4a(0x1bf)]('\x0a'+(_0x1fd0fa?_0x26ce4a(0x1c3)+_0x1ca243+'/'+_0x4193a6+':':'')),console[_0x26ce4a(0x1bf)]('Site:\x20'+_0x3ff1fc[_0x26ce4a(0x1b2)]),console[_0x26ce4a(0x1bf)](_0x26ce4a(0x1a2)+(_0x89576f||'td')),console[_0x26ce4a(0x1bf)](_0x26ce4a(0x1cc)+_0x55010c),console[_0x26ce4a(0x1bf)]('SQL:\x20'+_0x50cf58));const _0x3cf53e=_0x1fd0fa?'Executing\x20statement\x20'+_0x1ca243+'/'+_0x4193a6+_0x26ce4a(0x19b):_0x26ce4a(0x1b0);try{const _0x51a772=await withProgressSpinner(_0x3cf53e,async _0x5f3bf0=>{const _0x5247cb=_0x26ce4a,_0x4c9541=await _0x3b4290[_0x5247cb(0x1b9)][_0x5247cb(0x19d)](_0x50cf58,{'catalog':_0x89576f,'schema':_0x55010c,'onJobId':_0x2f77f8=>{const _0x47b24e=_0x5247cb;_0x5f3bf0[_0x47b24e(0x1b5)](_0x2f77f8);},'onProgress':_0x358c69=>{const _0x313626=_0x5247cb;_0x5f3bf0[_0x313626(0x1c0)](_0x313626(0x1ba)+_0x358c69[_0x313626(0x1a8)]+']'),_0x5f3bf0['setExtra'](formatRows(_0x358c69[_0x313626(0x1cb)])+_0x313626(0x1c8)+_0x358c69[_0x313626(0x19e)]+'/'+_0x358c69[_0x313626(0x1aa)]+_0x313626(0x1a7));}});return _0x4c9541;},{'verbose':_0x3ff1fc['verbose']}),_0x284395=_0x51a772[_0x26ce4a(0x1ae)],_0x2fb9f2=_0x284395[_0x26ce4a(0x197)]?_0x26ce4a(0x19a)+_0x284395[_0x26ce4a(0x197)]+']':'',_0x5bee8e=_0x1fd0fa?_0x26ce4a(0x1c3)+_0x1ca243+'/'+_0x4193a6+'\x20-\x20':'';console[_0x26ce4a(0x1bf)]('✔\x20'+_0x5bee8e+'Query\x20completed:\x20Processed\x20'+formatRows(_0x284395[_0x26ce4a(0x1b1)][_0x26ce4a(0x1cb)])+_0x26ce4a(0x1c8)+(_0x26ce4a(0x1be)+formatElapsed(_0x284395[_0x26ce4a(0x1b1)][_0x26ce4a(0x1a4)])+_0x2fb9f2));if(_0x1fd0fa&&_0x189495){const _0x422c30=resolveOutputOptions(_0x34e7e6),_0x3ddd90=await formatQueryOutput(_0x284395,_0x422c30);_0x382922[_0x26ce4a(0x1c4)](_0x3ddd90);}else await handleQueryOutput(_0x284395,_0x34e7e6);}catch(_0x4a59b3){const _0x5898d6=_0x1fd0fa?_0x26ce4a(0x1c3)+_0x1ca243+'/'+_0x4193a6+':\x0a':'',_0x1869ef=_0x4a59b3 instanceof SDKError?_0x4a59b3[_0x26ce4a(0x1bb)]:_0x4a59b3[_0x26ce4a(0x1a5)];return console[_0x26ce4a(0x1bf)](''+_0x5898d6+_0x1869ef),0x1;}}if(_0x2e809f[_0x26ce4a(0x1a1)]>0x1&&_0x189495&&_0x382922['length']>0x0){const _0x17dda4=_0x382922[_0x26ce4a(0x1b3)]('\x0a');writeFileSync(_0x3ff1fc[_0x26ce4a(0x19f)],_0x17dda4),console[_0x26ce4a(0x1bf)](_0x26ce4a(0x1ce)+_0x3ff1fc[_0x26ce4a(0x19f)]);}return 0x0;}catch(_0x16b595){throw _0x16b595;}}[a35_0x53f7ba(0x199)](_0x490f28){const _0x623886=a35_0x53f7ba,_0x4b30ad=_0x490f28[_0x623886(0x1c2)][0x0],_0x5a90aa=_0x490f28[_0x623886(0x1a9)][_0x623886(0x1b7)];if(!_0x4b30ad&&!_0x5a90aa)return _0x623886(0x1c7);if(_0x4b30ad&&_0x5a90aa)return _0x623886(0x1c5);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x572012=a36_0x240b;(function(_0x2d4442,_0x1d04b6){const _0x354017=a36_0x240b,_0x1112d2=_0x2d4442();while(!![]){try{const _0x455686=-parseInt(_0x354017(0x203))/0x1+parseInt(_0x354017(0x1b3))/0x2+-parseInt(_0x354017(0x220))/0x3+parseInt(_0x354017(0x211))/0x4+-parseInt(_0x354017(0x1ca))/0x5*(-parseInt(_0x354017(0x1f5))/0x6)+-parseInt(_0x354017(0x1b9))/0x7*(-parseInt(_0x354017(0x1ed))/0x8)+-parseInt(_0x354017(0x229))/0x9*(parseInt(_0x354017(0x1ac))/0xa);if(_0x455686===_0x1d04b6)break;else _0x1112d2['push'](_0x1112d2['shift']());}catch(_0x1b97f5){_0x1112d2['push'](_0x1112d2['shift']());}}}(a36_0x577f,0x517d2));function a36_0x577f(){const _0x432cc8=['Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','schedules','padEnd','Updating\x20schedule:\x20','\x20\x20Num:\x20','Deleting\x20schedule...','abs','49745mUDrwx','data','retryLimit','schedule:run','length','user','name','\x20\x20Database:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','num','\x20\x20Time:\x20','\x20\x20Type:\x20','Listing\x20scheduled\x20queries...','Show\x20schedule\x20details','args','query','Schedule\x20run\x20submitted:\x20','jobs','max','utf-8','updated_at','Schedule\x20updated:\x20','list','\x20\x20Cron:\x20','Schedule\x20deleted:\x20','Showing\x20first\x20','\x22...','pagination','substring','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','repeat','format','json','m\x20ago','delay','990904kItsfc','Getting\x20schedule\x20details...','yes','Creating\x20schedule:\x20','\x20matching\x20\x22','map','error','getTime','204WbDKCL','\x20execution','nextRun','delete','listQueries','history','never','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','trino','\x20(showing\x20','Cancelled','schedule:list','schedule:update','655416GHuWuB','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','success','ended_at','created_at','\x20\x20→\x20','cron','soon','status','last_job','schedule:history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','next_run_at','Show\x20schedule\x20execution\x20history','1569228GiHoaf','description','green','engineVersion','retry_limit','No\x20scheduled\x20queries\x20found','has_next_page','queries','priority','INVALID_ARGUMENT','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','timezone','round','user_name','List\x20scheduled\x20queries','1761015RsBPDQ','📅\x20','Running\x20schedule...','run','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','red','toLocaleDateString','in\x20','verbose','27FxfRso','Searching\x20scheduled\x20queries\x20matching\x20\x22','end_at','table','options','keys','count','engine_version','execute','...','result','queryUrl','Found\x20','type','site','Running\x20schedule:\x20','just\x20now','Delete\x20a\x20scheduled\x20query','1433340nbnrTu','\x20\x20Job\x20ID:\x20','job_id','\x20created','(unnamed)','entries','Schedule\x20created:\x20','1312626OjgzHf','schedule:show','tsv','\x20job','from','Updating\x20schedule...','35XxWPMz','schedule:delete','lastRun','create','output','limit','file','validate','schedule:create'];a36_0x577f=function(){return _0x432cc8;};return a36_0x577f();}import{BaseCommand}from'./command.js';function a36_0x240b(_0x42efe7,_0x3c18c8){_0x42efe7=_0x42efe7-0x1a1;const _0x577f85=a36_0x577f();let _0x240bef=_0x577f85[_0x42efe7];return _0x240bef;}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_0x597a27 from'chalk';function formatRelativeTime(_0x2f092f){const _0xd87909=a36_0x240b,_0x37571b=new Date(_0x2f092f),_0x3139b5=new Date(),_0x4c25c3=_0x37571b[_0xd87909(0x1f4)]()-_0x3139b5['getTime'](),_0x480341=Math[_0xd87909(0x1c9)](_0x4c25c3)/0x3e8,_0x24c899=_0x4c25c3<0x0;if(_0x480341<0x3c)return _0x24c899?_0xd87909(0x1aa):_0xd87909(0x20a);else{if(_0x480341<0xe10){const _0x1535fd=Math[_0xd87909(0x21d)](_0x480341/0x3c);return _0x24c899?_0x1535fd+_0xd87909(0x1eb):_0xd87909(0x227)+_0x1535fd+'m';}else{if(_0x480341<0x15180){const _0x52378c=Math[_0xd87909(0x21d)](_0x480341/0xe10);return _0x24c899?_0x52378c+'h\x20ago':_0xd87909(0x227)+_0x52378c+'h';}else{if(_0x480341<0x93a80){const _0x5ee1d8=Math[_0xd87909(0x21d)](_0x480341/0x15180);return _0x24c899?_0x5ee1d8+'d\x20ago':_0xd87909(0x227)+_0x5ee1d8+'d';}else return _0x37571b[_0xd87909(0x226)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x201);[a36_0x572012(0x212)]=a36_0x572012(0x21f);async[a36_0x572012(0x1a2)](_0x26bd0b){const _0x2bad48=a36_0x572012,{options:_0x4c5486,args:_0xe834a9,tdx:_0x353a6a}=_0x26bd0b,_0x4f488d=resolveLimit(_0x4c5486[_0x2bad48(0x1be)],DEFAULT_DISPLAY_LIMIT),_0x2b03dd=_0xe834a9[0x0],_0xe22fd6=_0x2b03dd?_0x2bad48(0x22a)+_0x2b03dd+_0x2bad48(0x1e4):_0x2bad48(0x1d6),_0x4a427f=await withSpinner(_0xe22fd6,()=>_0x353a6a['schedules'][_0x2bad48(0x1f9)]({'limit':_0x4f488d,'scheduled':!![],'pattern':_0x2b03dd}),{'verbose':_0x4c5486[_0x2bad48(0x228)]}),_0x3d5a5c=_0x4a427f[_0x2bad48(0x1cb)][_0x2bad48(0x218)],_0x48a65d=_0x4a427f[_0x2bad48(0x1cb)][_0x2bad48(0x1e5)][_0x2bad48(0x217)],_0x264bef=_0x2b03dd?_0x2bad48(0x1f1)+_0x2b03dd+'\x22':'';_0x48a65d?console[_0x2bad48(0x1f3)](_0x2bad48(0x1e3)+_0x3d5a5c[_0x2bad48(0x1ce)]+'\x20schedules'+_0x264bef+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x2bad48(0x1f3)](_0x2bad48(0x1a6)+_0x3d5a5c[_0x2bad48(0x1ce)]+'\x20scheduled\x20quer'+(_0x3d5a5c[_0x2bad48(0x1ce)]!==0x1?'ies':'y')+_0x264bef);if(_0x4c5486[_0x2bad48(0x1e9)]===_0x2bad48(0x1ea)||_0x4c5486[_0x2bad48(0x1e9)]==='jsonl'||_0x4c5486['format']===_0x2bad48(0x22c)||_0x4c5486['format']===_0x2bad48(0x1b5)){const _0x2fbc8f=_0x3d5a5c['map'](_0x4c2ee9=>({'id':_0x4c2ee9['id'],'name':_0x4c2ee9['name'],'cron':_0x4c2ee9[_0x2bad48(0x209)],'database':_0x4c2ee9[_0x2bad48(0x1fc)]?.[_0x2bad48(0x1d0)],'type':_0x4c2ee9[_0x2bad48(0x1a7)],'timezone':_0x4c2ee9['time_zone'],'user_name':_0x4c2ee9[_0x2bad48(0x1cf)]?.['name'],'updated_at':_0x4c2ee9[_0x2bad48(0x1de)],'next_run_at':_0x4c2ee9[_0x2bad48(0x20f)],'last_job_status':_0x4c2ee9['last_job']?.[_0x2bad48(0x20b)]}));await handleSDKOutput(_0x2fbc8f,_0x4c5486);}else{if(_0x3d5a5c[_0x2bad48(0x1ce)]===0x0)console['log'](_0x2bad48(0x216));else{const _0x2b249a=_0x4c5486[_0x2bad48(0x1a8)],_0x4b42b7=_0x3d5a5c[_0x2bad48(0x1f2)](_0x78c053=>{const _0x14a264=_0x2bad48,_0x2a2b0b=_0x78c053[_0x14a264(0x20c)]?.['status']?_0x78c053[_0x14a264(0x20c)][_0x14a264(0x20b)]==='success'?'✓':'✗':'-',_0x5c4844=_0x78c053[_0x14a264(0x20c)]?.[_0x14a264(0x206)]?formatRelativeTime(_0x78c053[_0x14a264(0x20c)][_0x14a264(0x206)]):_0x14a264(0x1fb),_0x457377=_0x78c053[_0x14a264(0x20f)]?formatRelativeTime(_0x78c053[_0x14a264(0x20f)]):'-',_0x8549d7=_0x78c053['cron']||'',_0x1e8d47=_0x78c053['name']||_0x14a264(0x1b0),_0x4771fe=getConsoleUrl(_0x2b249a,'/app/queries/editor?queryId='+_0x78c053['id']);return{'statusIcon':_0x2a2b0b,'lastRun':_0x5c4844,'nextRun':_0x457377,'cron':_0x8549d7,'name':_0x1e8d47,'queryUrl':_0x4771fe,'status':_0x78c053[_0x14a264(0x20c)]?.['status']};}),_0x15affb=Math[_0x2bad48(0x1dc)](..._0x4b42b7[_0x2bad48(0x1f2)](_0x1621e1=>_0x1621e1[_0x2bad48(0x1bb)][_0x2bad48(0x1ce)])),_0x13cab5=Math[_0x2bad48(0x1dc)](..._0x4b42b7[_0x2bad48(0x1f2)](_0x40649f=>_0x40649f[_0x2bad48(0x1f7)][_0x2bad48(0x1ce)])),_0x29952f=Math['max'](..._0x4b42b7[_0x2bad48(0x1f2)](_0x565feb=>_0x565feb[_0x2bad48(0x209)][_0x2bad48(0x1ce)])),_0x5849c5=_0x4b42b7[_0x2bad48(0x1f2)](_0x51cd50=>{const _0x54d347=_0x2bad48,_0x42e5d4=_0x51cd50[_0x54d347(0x20b)]===_0x54d347(0x205)?a36_0x597a27[_0x54d347(0x213)](_0x51cd50['statusIcon']):_0x51cd50[_0x54d347(0x20b)]===_0x54d347(0x1f3)?a36_0x597a27[_0x54d347(0x225)](_0x51cd50['statusIcon']):a36_0x597a27['dim'](_0x51cd50['statusIcon']),_0x20b6e4=_0x51cd50[_0x54d347(0x1bb)]['padEnd'](_0x15affb),_0x28307c=_0x51cd50[_0x54d347(0x1f7)][_0x54d347(0x1c5)](_0x13cab5),_0x489a75=_0x51cd50[_0x54d347(0x209)]?a36_0x597a27['cyan'](_0x51cd50[_0x54d347(0x209)][_0x54d347(0x1c5)](_0x29952f)):'\x20'[_0x54d347(0x1e8)](_0x29952f),_0x51051c=hyperlink(_0x51cd50[_0x54d347(0x1d0)],_0x51cd50[_0x54d347(0x1a5)]);return _0x54d347(0x221)+_0x42e5d4+'\x20'+_0x20b6e4+_0x54d347(0x208)+_0x28307c+'\x20\x20'+_0x489a75+'\x20\x20'+_0x51051c;});await writeOutput(_0x5849c5['join']('\x0a'),_0x4c5486[_0x2bad48(0x1bd)],_0x2bad48(0x1e0));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1b4);[a36_0x572012(0x212)]=a36_0x572012(0x1d7);[a36_0x572012(0x1c0)](_0x33e8ba){const _0x1db3f6=a36_0x572012,_0x36a8be=_0x33e8ba[_0x1db3f6(0x1d8)][0x0];if(!_0x36a8be)return _0x1db3f6(0x1c3);return undefined;}async[a36_0x572012(0x1a2)](_0x3b7a36){const _0x3a1e2a=a36_0x572012,{options:_0x5f0959,args:_0x5dbea8,tdx:_0x1cbd48}=_0x3b7a36,_0x52473f=_0x5dbea8[0x0],_0x4a4eb7=await withSpinner(_0x3a1e2a(0x1ee),()=>_0x1cbd48[_0x3a1e2a(0x1c4)]['show'](_0x52473f),{'verbose':_0x5f0959[_0x3a1e2a(0x228)]}),_0x2d9564=_0x4a4eb7[_0x3a1e2a(0x1cb)],_0x3741d5={'name':_0x2d9564[_0x3a1e2a(0x1d0)],'cron':_0x2d9564[_0x3a1e2a(0x209)],'database':_0x2d9564[_0x3a1e2a(0x1fc)],'type':_0x2d9564[_0x3a1e2a(0x1a7)],'timezone':_0x2d9564[_0x3a1e2a(0x21c)],'user_name':_0x2d9564[_0x3a1e2a(0x21e)],'created_at':_0x2d9564['created_at'],'engine_version':_0x2d9564['engine_version'],'executing_user_id':_0x2d9564['executing_user_id'],'query':_0x2d9564[_0x3a1e2a(0x1d9)],'delay':_0x2d9564[_0x3a1e2a(0x1ec)],'priority':_0x2d9564['priority'],'retry_limit':_0x2d9564[_0x3a1e2a(0x215)],..._0x2d9564[_0x3a1e2a(0x1a4)]&&{'result':_0x2d9564[_0x3a1e2a(0x1a4)]}};return await handleSingleObjectOutput(_0x3741d5,_0x5f0959),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1c1);[a36_0x572012(0x212)]='Create\x20a\x20scheduled\x20query';[a36_0x572012(0x1c0)](_0x2022bd){const _0x384981=a36_0x572012,_0x6d05f2=_0x2022bd[_0x384981(0x1d8)][0x0];if(!_0x6d05f2)return _0x384981(0x20e);const _0x5a9957=_0x2022bd[_0x384981(0x22d)];if(!_0x5a9957['database'])return _0x384981(0x224);return undefined;}async[a36_0x572012(0x1a2)](_0x59c8b0){const _0xe4ef7d=a36_0x572012,{options:_0x59ccce,args:_0x18e9ea,tdx:_0x245fc1}=_0x59c8b0,_0x58db83=_0x18e9ea[0x0],_0x1716dd=_0x59ccce,_0x58c971=_0x1716dd['database'],_0x48d1b8=_0x1716dd['file'],_0x3a0d2d=_0x1716dd[_0xe4ef7d(0x1a7)]||_0xe4ef7d(0x1fe);let _0x1a81ef;try{_0x1a81ef=readFileSync(_0x48d1b8,_0xe4ef7d(0x1dd))['trim']();}catch(_0x4bf1be){throw new SDKError(ErrorCode[_0xe4ef7d(0x21a)],'Failed\x20to\x20read\x20file:\x20'+_0x48d1b8,_0x4bf1be instanceof Error?_0x4bf1be:undefined);}if(!_0x1a81ef)throw new SDKError(ErrorCode[_0xe4ef7d(0x21a)],'Query\x20file\x20is\x20empty');const _0x5148f9={'database':_0x58c971,'query':_0x1a81ef,'type':_0x3a0d2d};if(_0x1716dd[_0xe4ef7d(0x209)])_0x5148f9[_0xe4ef7d(0x209)]=_0x1716dd[_0xe4ef7d(0x209)];if(_0x1716dd['timezone'])_0x5148f9[_0xe4ef7d(0x21c)]=_0x1716dd['timezone'];if(_0x1716dd[_0xe4ef7d(0x1ec)]!==undefined)_0x5148f9[_0xe4ef7d(0x1ec)]=Number(_0x1716dd[_0xe4ef7d(0x1ec)]);if(_0x1716dd[_0xe4ef7d(0x219)]!==undefined)_0x5148f9[_0xe4ef7d(0x219)]=Number(_0x1716dd[_0xe4ef7d(0x219)]);if(_0x1716dd['retryLimit']!==undefined)_0x5148f9[_0xe4ef7d(0x215)]=Number(_0x1716dd[_0xe4ef7d(0x1cc)]);if(_0x1716dd[_0xe4ef7d(0x214)])_0x5148f9[_0xe4ef7d(0x1a1)]=_0x1716dd[_0xe4ef7d(0x214)];if(_0x1716dd[_0xe4ef7d(0x1a4)])_0x5148f9[_0xe4ef7d(0x1a4)]=_0x1716dd[_0xe4ef7d(0x1a4)];if(_0x59ccce[_0xe4ef7d(0x228)]){console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1f0)+_0x58db83),console['error'](_0xe4ef7d(0x1d1)+_0x58c971),console['error'](_0xe4ef7d(0x1d5)+_0x3a0d2d);if(_0x5148f9[_0xe4ef7d(0x209)])console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1e1)+_0x5148f9[_0xe4ef7d(0x209)]);if(_0x5148f9[_0xe4ef7d(0x21c)])console[_0xe4ef7d(0x1f3)]('\x20\x20Timezone:\x20'+_0x5148f9[_0xe4ef7d(0x21c)]);}const _0x7a2afb=await withSpinner('Creating\x20schedule...',()=>_0x245fc1[_0xe4ef7d(0x1c4)][_0xe4ef7d(0x1bc)](_0x58db83,_0x5148f9),{'verbose':_0x59ccce[_0xe4ef7d(0x228)]});return console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1b2)+_0x7a2afb['data'][_0xe4ef7d(0x1d0)]),await handleSingleObjectOutput(_0x7a2afb[_0xe4ef7d(0x1cb)],_0x59ccce),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x202);[a36_0x572012(0x212)]=a36_0x572012(0x1c2);['validate'](_0x2e3dc4){const _0x2e0e87=a36_0x572012,_0x586394=_0x2e3dc4['args'][0x0];if(!_0x586394)return _0x2e0e87(0x204);return undefined;}async['execute'](_0x2570e4){const _0x56cf67=a36_0x572012,{options:_0x144cfd,args:_0x3a48d4,tdx:_0x12efa0}=_0x2570e4,_0x76085d=_0x3a48d4[0x0],_0x252460=_0x144cfd,_0x303d70={};if(_0x252460['database'])_0x303d70[_0x56cf67(0x1fc)]=_0x252460['database'];if(_0x252460['type'])_0x303d70['type']=_0x252460[_0x56cf67(0x1a7)];if(_0x252460[_0x56cf67(0x209)])_0x303d70[_0x56cf67(0x209)]=_0x252460[_0x56cf67(0x209)];if(_0x252460[_0x56cf67(0x21c)])_0x303d70[_0x56cf67(0x21c)]=_0x252460['timezone'];if(_0x252460[_0x56cf67(0x1ec)]!==undefined)_0x303d70[_0x56cf67(0x1ec)]=Number(_0x252460[_0x56cf67(0x1ec)]);if(_0x252460[_0x56cf67(0x219)]!==undefined)_0x303d70['priority']=Number(_0x252460[_0x56cf67(0x219)]);if(_0x252460['retryLimit']!==undefined)_0x303d70[_0x56cf67(0x215)]=Number(_0x252460[_0x56cf67(0x1cc)]);if(_0x252460[_0x56cf67(0x214)])_0x303d70[_0x56cf67(0x1a1)]=_0x252460['engineVersion'];if(_0x252460[_0x56cf67(0x1a4)])_0x303d70[_0x56cf67(0x1a4)]=_0x252460[_0x56cf67(0x1a4)];if(_0x252460[_0x56cf67(0x1bf)])try{_0x303d70[_0x56cf67(0x1d9)]=readFileSync(_0x252460[_0x56cf67(0x1bf)],_0x56cf67(0x1dd))['trim']();}catch(_0x2db897){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x252460[_0x56cf67(0x1bf)],_0x2db897 instanceof Error?_0x2db897:undefined);}if(Object[_0x56cf67(0x22e)](_0x303d70)[_0x56cf67(0x1ce)]===0x0)throw new SDKError(ErrorCode[_0x56cf67(0x21a)],_0x56cf67(0x1d2));if(_0x144cfd[_0x56cf67(0x228)]){console[_0x56cf67(0x1f3)](_0x56cf67(0x1c6)+_0x76085d);for(const [_0x11695c,_0x2bedbb]of Object[_0x56cf67(0x1b1)](_0x303d70)){_0x11695c==='query'?console[_0x56cf67(0x1f3)]('\x20\x20'+_0x11695c+':\x20'+_0x2bedbb[_0x56cf67(0x1e6)](0x0,0x32)+_0x56cf67(0x1a3)):console['error']('\x20\x20'+_0x11695c+':\x20'+_0x2bedbb);}}const _0x1aedfa=await withSpinner(_0x56cf67(0x1b8),()=>_0x12efa0['schedules']['update'](_0x76085d,_0x303d70),{'verbose':_0x144cfd['verbose']});return console['error'](_0x56cf67(0x1df)+_0x1aedfa[_0x56cf67(0x1cb)]['name']),await handleSingleObjectOutput(_0x1aedfa[_0x56cf67(0x1cb)],_0x144cfd),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1ba);[a36_0x572012(0x212)]=a36_0x572012(0x1ab);[a36_0x572012(0x1c0)](_0x588d38){const _0x3cb87b=a36_0x572012,_0x2fa3b4=_0x588d38[_0x3cb87b(0x1d8)][0x0];if(!_0x2fa3b4)return _0x3cb87b(0x1e7);return undefined;}async[a36_0x572012(0x1a2)](_0x26bc98){const _0x4b5732=a36_0x572012,{options:_0x37ff53,args:_0x57c444,tdx:_0x1b4d0d}=_0x26bc98,_0x4a43c9=_0x57c444[0x0];if(!_0x37ff53[_0x4b5732(0x1ef)]){const _0x5f1812=await confirm(_0x4b5732(0x21b)+_0x4a43c9+'\x22?');if(!_0x5f1812)return console['error'](_0x4b5732(0x200)),0x0;}const _0x4ef3eb=await withSpinner(_0x4b5732(0x1c8),()=>_0x1b4d0d[_0x4b5732(0x1c4)][_0x4b5732(0x1f8)](_0x4a43c9),{'verbose':_0x37ff53[_0x4b5732(0x228)]});return console[_0x4b5732(0x1f3)](_0x4b5732(0x1e2)+_0x4ef3eb[_0x4b5732(0x1cb)][_0x4b5732(0x1d0)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1cd);[a36_0x572012(0x212)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x572012(0x1c0)](_0x8e7b97){const _0x17face=a36_0x572012,_0x3c6ef3=_0x8e7b97['args'][0x0];if(!_0x3c6ef3)return _0x17face(0x1fd);return undefined;}async[a36_0x572012(0x1a2)](_0x4bdcc3){const _0xdfae1b=a36_0x572012,{options:_0x196e19,args:_0x4efc49,tdx:_0x32d021}=_0x4bdcc3,_0x2d6cf7=_0x4efc49[0x0],_0x2d1710=_0x196e19,_0x300acb=_0x2d1710['time'],_0x3c30a4=_0x2d1710[_0xdfae1b(0x1d3)]!==undefined?Number(_0x2d1710[_0xdfae1b(0x1d3)]):undefined;if(_0x196e19[_0xdfae1b(0x228)]){console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1a9)+_0x2d6cf7);if(_0x300acb)console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1d4)+_0x300acb);if(_0x3c30a4)console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1c7)+_0x3c30a4);}const _0x5c6b84=await withSpinner(_0xdfae1b(0x222),()=>_0x32d021[_0xdfae1b(0x1c4)][_0xdfae1b(0x223)](_0x2d6cf7,{'time':_0x300acb,'num':_0x3c30a4}),{'verbose':_0x196e19[_0xdfae1b(0x228)]}),_0x3cacf3=_0x5c6b84[_0xdfae1b(0x1cb)][_0xdfae1b(0x1db)];console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1da)+_0x3cacf3['length']+_0xdfae1b(0x1b6)+(_0x3cacf3[_0xdfae1b(0x1ce)]!==0x1?'s':'')+_0xdfae1b(0x1af));for(const _0x451e99 of _0x3cacf3){console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1ad)+_0x451e99[_0xdfae1b(0x1ae)]);}return await handleSDKOutput(_0x3cacf3,_0x196e19),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x20d);['description']=a36_0x572012(0x210);['validate'](_0x1eb19b){const _0x4d2545=_0x1eb19b['args'][0x0];if(!_0x4d2545)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x572012(0x1a2)](_0x74d4c3){const _0x377354=a36_0x572012,{options:_0x18b607,args:_0x1dcde2,tdx:_0x564e12}=_0x74d4c3,_0x46c8cf=_0x1dcde2[0x0],_0x121faa=_0x18b607,_0x417fb0=_0x121faa[_0x377354(0x1b7)]!==undefined?Number(_0x121faa[_0x377354(0x1b7)]):undefined,_0x49fab5=_0x121faa['to']!==undefined?Number(_0x121faa['to']):undefined,_0x2546ed=await withSpinner('Getting\x20schedule\x20history...',()=>_0x564e12['schedules'][_0x377354(0x1fa)](_0x46c8cf,{'from':_0x417fb0,'to':_0x49fab5}),{'verbose':_0x18b607[_0x377354(0x228)]}),_0x15b3ad=_0x2546ed[_0x377354(0x1cb)];console['error'](_0x377354(0x1a6)+_0x15b3ad[_0x377354(0x22f)]+_0x377354(0x1f6)+(_0x15b3ad['count']!==0x1?'s':'')+_0x377354(0x1ff)+_0x15b3ad['from']+'-'+_0x15b3ad['to']+')');const _0x3bb4a3=_0x15b3ad[_0x377354(0x1fa)]['map'](_0x164b6a=>({'job_id':_0x164b6a[_0x377354(0x1ae)],'type':_0x164b6a[_0x377354(0x1a7)],'status':_0x164b6a[_0x377354(0x20b)],'scheduled_at':_0x164b6a['scheduled_at'],'created_at':_0x164b6a[_0x377354(0x207)],'start_at':_0x164b6a['start_at'],'end_at':_0x164b6a[_0x377354(0x22b)]}));return await handleSDKOutput(_0x3bb4a3,_0x18b607),0x0;}}
|
|
1
|
+
function a36_0x1660(_0x3f0c13,_0x1f1f58){_0x3f0c13=_0x3f0c13-0x1d1;const _0x2b52c8=a36_0x2b52();let _0x166014=_0x2b52c8[_0x3f0c13];return _0x166014;}const a36_0x2c0b12=a36_0x1660;(function(_0x5eae8b,_0x4eefff){const _0x2cbad0=a36_0x1660,_0x7f449c=_0x5eae8b();while(!![]){try{const _0x423cca=-parseInt(_0x2cbad0(0x207))/0x1+parseInt(_0x2cbad0(0x22e))/0x2*(-parseInt(_0x2cbad0(0x23a))/0x3)+-parseInt(_0x2cbad0(0x238))/0x4*(parseInt(_0x2cbad0(0x22b))/0x5)+-parseInt(_0x2cbad0(0x239))/0x6+parseInt(_0x2cbad0(0x20e))/0x7*(-parseInt(_0x2cbad0(0x1d2))/0x8)+parseInt(_0x2cbad0(0x208))/0x9+parseInt(_0x2cbad0(0x22d))/0xa;if(_0x423cca===_0x4eefff)break;else _0x7f449c['push'](_0x7f449c['shift']());}catch(_0xb8786e){_0x7f449c['push'](_0x7f449c['shift']());}}}(a36_0x2b52,0xe4d5d));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_0x259253 from'chalk';function formatRelativeTime(_0x3859af){const _0x1b2466=a36_0x1660,_0x3cef50=new Date(_0x3859af),_0x325b0e=new Date(),_0x4d7ec1=_0x3cef50[_0x1b2466(0x24b)]()-_0x325b0e[_0x1b2466(0x24b)](),_0x279839=Math[_0x1b2466(0x1ff)](_0x4d7ec1)/0x3e8,_0x509546=_0x4d7ec1<0x0;if(_0x279839<0x3c)return _0x509546?_0x1b2466(0x20f):_0x1b2466(0x226);else{if(_0x279839<0xe10){const _0x46c60a=Math[_0x1b2466(0x1d5)](_0x279839/0x3c);return _0x509546?_0x46c60a+_0x1b2466(0x21d):_0x1b2466(0x1dc)+_0x46c60a+'m';}else{if(_0x279839<0x15180){const _0x461340=Math[_0x1b2466(0x1d5)](_0x279839/0xe10);return _0x509546?_0x461340+_0x1b2466(0x1fa):'in\x20'+_0x461340+'h';}else{if(_0x279839<0x93a80){const _0x5a9ef9=Math[_0x1b2466(0x1d5)](_0x279839/0x15180);return _0x509546?_0x5a9ef9+_0x1b2466(0x240):_0x1b2466(0x1dc)+_0x5a9ef9+'d';}else return _0x3cef50[_0x1b2466(0x21e)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x2c0b12(0x242);[a36_0x2c0b12(0x241)]='List\x20scheduled\x20queries';async[a36_0x2c0b12(0x1d3)](_0x3555b3){const _0x5c8976=a36_0x2c0b12,{options:_0x576d40,args:_0x508bde,tdx:_0x11f0bc}=_0x3555b3,_0x5c49ab=resolveLimit(_0x576d40[_0x5c8976(0x1ec)],DEFAULT_DISPLAY_LIMIT),_0x1a8a58=_0x508bde[0x0],_0xedc996=_0x1a8a58?_0x5c8976(0x256)+_0x1a8a58+_0x5c8976(0x23f):_0x5c8976(0x232),_0x454d7a=await withSpinner(_0xedc996,()=>_0x11f0bc[_0x5c8976(0x200)][_0x5c8976(0x21a)]({'limit':_0x5c49ab,'scheduled':!![],'pattern':_0x1a8a58}),{'verbose':_0x576d40[_0x5c8976(0x1dd)]}),_0x1dd89d=_0x454d7a[_0x5c8976(0x20d)]['queries'],_0x393f1c=_0x454d7a['data'][_0x5c8976(0x203)][_0x5c8976(0x1fd)],_0x27e3d1=_0x1a8a58?_0x5c8976(0x1fb)+_0x1a8a58+'\x22':'';_0x393f1c?console[_0x5c8976(0x25b)](_0x5c8976(0x258)+_0x1dd89d[_0x5c8976(0x21c)]+_0x5c8976(0x222)+_0x27e3d1+_0x5c8976(0x237)):console[_0x5c8976(0x25b)](_0x5c8976(0x216)+_0x1dd89d['length']+_0x5c8976(0x244)+(_0x1dd89d[_0x5c8976(0x21c)]!==0x1?_0x5c8976(0x1d6):'y')+_0x27e3d1);if(_0x576d40[_0x5c8976(0x23e)]===_0x5c8976(0x263)||_0x576d40['format']==='jsonl'||_0x576d40[_0x5c8976(0x23e)]===_0x5c8976(0x1ef)||_0x576d40[_0x5c8976(0x23e)]===_0x5c8976(0x1e4)){const _0x4404bb=_0x1dd89d['map'](_0x33105f=>({'id':_0x33105f['id'],'name':_0x33105f['name'],'cron':_0x33105f[_0x5c8976(0x1f3)],'database':_0x33105f[_0x5c8976(0x1f8)]?.['name'],'type':_0x33105f['type'],'timezone':_0x33105f[_0x5c8976(0x224)],'user_name':_0x33105f[_0x5c8976(0x1db)]?.[_0x5c8976(0x1ea)],'updated_at':_0x33105f[_0x5c8976(0x1fc)],'next_run_at':_0x33105f[_0x5c8976(0x228)],'last_job_status':_0x33105f['last_job']?.[_0x5c8976(0x206)]}));await handleSDKOutput(_0x4404bb,_0x576d40);}else{if(_0x1dd89d[_0x5c8976(0x21c)]===0x0)console[_0x5c8976(0x234)](_0x5c8976(0x223));else{const _0x24e9b2=_0x576d40['site'],_0x5b5f3b=_0x1dd89d['map'](_0x28b440=>{const _0x1e2e4b=_0x5c8976,_0x17937e=_0x28b440[_0x1e2e4b(0x211)]?.[_0x1e2e4b(0x206)]?_0x28b440['last_job'][_0x1e2e4b(0x206)]===_0x1e2e4b(0x1d7)?'✓':'✗':'-',_0x305ab9=_0x28b440['last_job']?.['ended_at']?formatRelativeTime(_0x28b440['last_job']['ended_at']):_0x1e2e4b(0x1f1),_0x57a224=_0x28b440[_0x1e2e4b(0x228)]?formatRelativeTime(_0x28b440['next_run_at']):'-',_0x4c0e5a=_0x28b440[_0x1e2e4b(0x1f3)]||'',_0x54a623=_0x28b440['name']||_0x1e2e4b(0x24d),_0x42bda9=getConsoleUrl(_0x24e9b2,_0x1e2e4b(0x1df)+_0x28b440['id']);return{'statusIcon':_0x17937e,'lastRun':_0x305ab9,'nextRun':_0x57a224,'cron':_0x4c0e5a,'name':_0x54a623,'queryUrl':_0x42bda9,'status':_0x28b440[_0x1e2e4b(0x211)]?.[_0x1e2e4b(0x206)]};}),_0x54c8c6=Math[_0x5c8976(0x1f0)](..._0x5b5f3b[_0x5c8976(0x25d)](_0x1bcc4a=>_0x1bcc4a['lastRun'][_0x5c8976(0x21c)])),_0x15985f=Math[_0x5c8976(0x1f0)](..._0x5b5f3b['map'](_0xb86b64=>_0xb86b64[_0x5c8976(0x20b)][_0x5c8976(0x21c)])),_0x4a0826=Math[_0x5c8976(0x1f0)](..._0x5b5f3b[_0x5c8976(0x25d)](_0x5d2fe1=>_0x5d2fe1[_0x5c8976(0x1f3)][_0x5c8976(0x21c)])),_0x2e4f9f=_0x5b5f3b[_0x5c8976(0x25d)](_0x36dce7=>{const _0x5e6128=_0x5c8976,_0x14fd2d=_0x36dce7[_0x5e6128(0x206)]===_0x5e6128(0x1d7)?a36_0x259253['green'](_0x36dce7[_0x5e6128(0x1d9)]):_0x36dce7[_0x5e6128(0x206)]==='error'?a36_0x259253[_0x5e6128(0x252)](_0x36dce7['statusIcon']):a36_0x259253[_0x5e6128(0x249)](_0x36dce7[_0x5e6128(0x1d9)]),_0xc059da=_0x36dce7['lastRun'][_0x5e6128(0x23b)](_0x54c8c6),_0x51d831=_0x36dce7[_0x5e6128(0x20b)][_0x5e6128(0x23b)](_0x15985f),_0x207a2c=_0x36dce7[_0x5e6128(0x1f3)]?a36_0x259253[_0x5e6128(0x1e3)](_0x36dce7[_0x5e6128(0x1f3)][_0x5e6128(0x23b)](_0x4a0826)):'\x20'[_0x5e6128(0x254)](_0x4a0826),_0x42d0ed=hyperlink(_0x36dce7[_0x5e6128(0x1ea)],_0x36dce7[_0x5e6128(0x217)]);return _0x5e6128(0x210)+_0x14fd2d+'\x20'+_0xc059da+_0x5e6128(0x214)+_0x51d831+'\x20\x20'+_0x207a2c+'\x20\x20'+_0x42d0ed;});await writeOutput(_0x2e4f9f[_0x5c8976(0x251)]('\x0a'),_0x576d40[_0x5c8976(0x218)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a36_0x2c0b12(0x241)]='Show\x20schedule\x20details';[a36_0x2c0b12(0x212)](_0x1392a2){const _0x1319b7=a36_0x2c0b12,_0x5f3161=_0x1392a2[_0x1319b7(0x213)][0x0];if(!_0x5f3161)return _0x1319b7(0x229);return undefined;}async['execute'](_0x25d129){const _0x20c51e=a36_0x2c0b12,{options:_0x25f6dc,args:_0x1b21c9,tdx:_0xc85710}=_0x25d129,_0xb67138=_0x1b21c9[0x0],_0x28520b=await withSpinner(_0x20c51e(0x1d4),()=>_0xc85710[_0x20c51e(0x200)]['show'](_0xb67138),{'verbose':_0x25f6dc[_0x20c51e(0x1dd)]}),_0x123044=_0x28520b[_0x20c51e(0x20d)],_0x1e70d8={'name':_0x123044[_0x20c51e(0x1ea)],'cron':_0x123044[_0x20c51e(0x1f3)],'database':_0x123044[_0x20c51e(0x1f8)],'type':_0x123044[_0x20c51e(0x24a)],'timezone':_0x123044[_0x20c51e(0x1f2)],'user_name':_0x123044[_0x20c51e(0x25e)],'created_at':_0x123044[_0x20c51e(0x1e6)],'engine_version':_0x123044[_0x20c51e(0x1ee)],'executing_user_id':_0x123044[_0x20c51e(0x21f)],'query':_0x123044[_0x20c51e(0x264)],'delay':_0x123044[_0x20c51e(0x1eb)],'priority':_0x123044[_0x20c51e(0x230)],'retry_limit':_0x123044[_0x20c51e(0x22f)],..._0x123044[_0x20c51e(0x236)]&&{'result':_0x123044[_0x20c51e(0x236)]}};return await handleSingleObjectOutput(_0x1e70d8,_0x25f6dc),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2c0b12(0x1ea)]=a36_0x2c0b12(0x23c);[a36_0x2c0b12(0x241)]='Create\x20a\x20scheduled\x20query';[a36_0x2c0b12(0x212)](_0x3e080a){const _0x47c120=a36_0x2c0b12,_0x347524=_0x3e080a[_0x47c120(0x213)][0x0];if(!_0x347524)return _0x47c120(0x24c);const _0x2bac2f=_0x3e080a['options'];if(!_0x2bac2f[_0x47c120(0x1f8)])return _0x47c120(0x1e1);return undefined;}async[a36_0x2c0b12(0x1d3)](_0x390263){const _0xe61b5e=a36_0x2c0b12,{options:_0x8b691,args:_0x4e9582,tdx:_0x25193b}=_0x390263,_0x4e625e=_0x4e9582[0x0],_0x410c58=_0x8b691,_0x28605e=_0x410c58[_0xe61b5e(0x1f8)],_0x57c59f=_0x410c58['file'],_0x3f499b=_0x410c58[_0xe61b5e(0x24a)]||_0xe61b5e(0x261);let _0x2a44b8;try{_0x2a44b8=readFileSync(_0x57c59f,_0xe61b5e(0x219))[_0xe61b5e(0x255)]();}catch(_0x2b4315){throw new SDKError(ErrorCode[_0xe61b5e(0x250)],'Failed\x20to\x20read\x20file:\x20'+_0x57c59f,_0x2b4315 instanceof Error?_0x2b4315:undefined);}if(!_0x2a44b8)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xe61b5e(0x1f7));const _0x32e1d9={'database':_0x28605e,'query':_0x2a44b8,'type':_0x3f499b};if(_0x410c58[_0xe61b5e(0x1f3)])_0x32e1d9[_0xe61b5e(0x1f3)]=_0x410c58['cron'];if(_0x410c58[_0xe61b5e(0x1f2)])_0x32e1d9[_0xe61b5e(0x1f2)]=_0x410c58[_0xe61b5e(0x1f2)];if(_0x410c58[_0xe61b5e(0x1eb)]!==undefined)_0x32e1d9[_0xe61b5e(0x1eb)]=Number(_0x410c58[_0xe61b5e(0x1eb)]);if(_0x410c58[_0xe61b5e(0x230)]!==undefined)_0x32e1d9['priority']=Number(_0x410c58[_0xe61b5e(0x230)]);if(_0x410c58[_0xe61b5e(0x202)]!==undefined)_0x32e1d9[_0xe61b5e(0x22f)]=Number(_0x410c58[_0xe61b5e(0x202)]);if(_0x410c58['engineVersion'])_0x32e1d9[_0xe61b5e(0x1ee)]=_0x410c58['engineVersion'];if(_0x410c58[_0xe61b5e(0x236)])_0x32e1d9['result']=_0x410c58[_0xe61b5e(0x236)];if(_0x8b691[_0xe61b5e(0x1dd)]){console[_0xe61b5e(0x25b)](_0xe61b5e(0x1da)+_0x4e625e),console['error'](_0xe61b5e(0x1fe)+_0x28605e),console[_0xe61b5e(0x25b)](_0xe61b5e(0x205)+_0x3f499b);if(_0x32e1d9[_0xe61b5e(0x1f3)])console[_0xe61b5e(0x25b)](_0xe61b5e(0x1e2)+_0x32e1d9[_0xe61b5e(0x1f3)]);if(_0x32e1d9[_0xe61b5e(0x1f2)])console[_0xe61b5e(0x25b)](_0xe61b5e(0x253)+_0x32e1d9[_0xe61b5e(0x1f2)]);}const _0x4efaea=await withSpinner(_0xe61b5e(0x225),()=>_0x25193b[_0xe61b5e(0x200)][_0xe61b5e(0x1d1)](_0x4e625e,_0x32e1d9),{'verbose':_0x8b691[_0xe61b5e(0x1dd)]});return console[_0xe61b5e(0x25b)](_0xe61b5e(0x25c)+_0x4efaea['data'][_0xe61b5e(0x1ea)]),await handleSingleObjectOutput(_0x4efaea[_0xe61b5e(0x20d)],_0x8b691),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x2c0b12(0x1ea)]=a36_0x2c0b12(0x1e8);[a36_0x2c0b12(0x241)]='Update\x20a\x20scheduled\x20query';[a36_0x2c0b12(0x212)](_0x1e14a6){const _0x86967c=a36_0x2c0b12,_0x435161=_0x1e14a6[_0x86967c(0x213)][0x0];if(!_0x435161)return _0x86967c(0x24e);return undefined;}async[a36_0x2c0b12(0x1d3)](_0x3f0f6e){const _0x21f0ea=a36_0x2c0b12,{options:_0x34233a,args:_0x4f75d3,tdx:_0x44f9e0}=_0x3f0f6e,_0x174707=_0x4f75d3[0x0],_0x8d5496=_0x34233a,_0x3c9a5e={};if(_0x8d5496[_0x21f0ea(0x1f8)])_0x3c9a5e[_0x21f0ea(0x1f8)]=_0x8d5496[_0x21f0ea(0x1f8)];if(_0x8d5496[_0x21f0ea(0x24a)])_0x3c9a5e[_0x21f0ea(0x24a)]=_0x8d5496[_0x21f0ea(0x24a)];if(_0x8d5496[_0x21f0ea(0x1f3)])_0x3c9a5e[_0x21f0ea(0x1f3)]=_0x8d5496[_0x21f0ea(0x1f3)];if(_0x8d5496[_0x21f0ea(0x1f2)])_0x3c9a5e['timezone']=_0x8d5496[_0x21f0ea(0x1f2)];if(_0x8d5496[_0x21f0ea(0x1eb)]!==undefined)_0x3c9a5e[_0x21f0ea(0x1eb)]=Number(_0x8d5496[_0x21f0ea(0x1eb)]);if(_0x8d5496[_0x21f0ea(0x230)]!==undefined)_0x3c9a5e['priority']=Number(_0x8d5496['priority']);if(_0x8d5496['retryLimit']!==undefined)_0x3c9a5e[_0x21f0ea(0x22f)]=Number(_0x8d5496['retryLimit']);if(_0x8d5496[_0x21f0ea(0x233)])_0x3c9a5e[_0x21f0ea(0x1ee)]=_0x8d5496[_0x21f0ea(0x233)];if(_0x8d5496[_0x21f0ea(0x236)])_0x3c9a5e[_0x21f0ea(0x236)]=_0x8d5496['result'];if(_0x8d5496[_0x21f0ea(0x1ed)])try{_0x3c9a5e['query']=readFileSync(_0x8d5496['file'],'utf-8')[_0x21f0ea(0x255)]();}catch(_0x41ac37){throw new SDKError(ErrorCode[_0x21f0ea(0x250)],_0x21f0ea(0x25f)+_0x8d5496['file'],_0x41ac37 instanceof Error?_0x41ac37:undefined);}if(Object['keys'](_0x3c9a5e)[_0x21f0ea(0x21c)]===0x0)throw new SDKError(ErrorCode[_0x21f0ea(0x250)],_0x21f0ea(0x257));if(_0x34233a['verbose']){console[_0x21f0ea(0x25b)](_0x21f0ea(0x235)+_0x174707);for(const [_0x1a7298,_0x14f6d6]of Object[_0x21f0ea(0x248)](_0x3c9a5e)){_0x1a7298===_0x21f0ea(0x264)?console[_0x21f0ea(0x25b)]('\x20\x20'+_0x1a7298+':\x20'+_0x14f6d6[_0x21f0ea(0x1de)](0x0,0x32)+'...'):console[_0x21f0ea(0x25b)]('\x20\x20'+_0x1a7298+':\x20'+_0x14f6d6);}}const _0x4256e9=await withSpinner(_0x21f0ea(0x20a),()=>_0x44f9e0['schedules'][_0x21f0ea(0x1e9)](_0x174707,_0x3c9a5e),{'verbose':_0x34233a[_0x21f0ea(0x1dd)]});return console[_0x21f0ea(0x25b)](_0x21f0ea(0x260)+_0x4256e9[_0x21f0ea(0x20d)][_0x21f0ea(0x1ea)]),await handleSingleObjectOutput(_0x4256e9[_0x21f0ea(0x20d)],_0x34233a),0x0;}}function a36_0x2b52(){const _0x16980e=['Creating\x20schedule:\x20','user','in\x20','verbose','substring','/app/queries/editor?queryId=','job_id','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Cron:\x20','cyan','tsv','end_at','created_at','scheduled_at','schedule:update','update','name','delay','limit','file','engine_version','table','max','never','timezone','cron','Cancelled','history','Getting\x20schedule\x20history...','Query\x20file\x20is\x20empty','database','jobs','h\x20ago','\x20matching\x20\x22','updated_at','has_next_page','\x20\x20Database:\x20','abs','schedules','Deleting\x20schedule...','retryLimit','pagination','Schedule\x20deleted:\x20','\x20\x20Type:\x20','status','1003907lnjTsr','14151357drAoqk','num','Updating\x20schedule...','nextRun','Delete\x20a\x20scheduled\x20query','data','309911PQGVRj','just\x20now','📅\x20','last_job','validate','args','\x20\x20→\x20','Running\x20schedule:\x20','Found\x20','queryUrl','output','utf-8','listQueries','yes','length','m\x20ago','toLocaleDateString','executing_user_id','\x20created','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20schedules','No\x20scheduled\x20queries\x20found','time_zone','Creating\x20schedule...','soon','from','next_run_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Show\x20schedule\x20execution\x20history','10sRkowb','Running\x20schedule...','22643820rUqyXm','2OFVyMw','retry_limit','priority','schedule:delete','Listing\x20scheduled\x20queries...','engineVersion','log','Updating\x20schedule:\x20','result','\x20(use\x20--limit\x20to\x20see\x20more)','1587148ciOVHi','838194YhuoSB','2222703LmIsAy','padEnd','schedule:create','Run\x20a\x20scheduled\x20query\x20immediately','format','\x22...','d\x20ago','description','schedule:list','Schedule\x20run\x20submitted:\x20','\x20scheduled\x20quer','\x20\x20Time:\x20','delete','\x20\x20Num:\x20','entries','dim','type','getTime','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','(unnamed)','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','count','INVALID_ARGUMENT','join','red','\x20\x20Timezone:\x20','repeat','trim','Searching\x20scheduled\x20queries\x20matching\x20\x22','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Showing\x20first\x20','schedule:history','\x20execution','error','Schedule\x20created:\x20','map','user_name','Failed\x20to\x20read\x20file:\x20','Schedule\x20updated:\x20','trino','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','json','query','create','40bfZfHH','execute','Getting\x20schedule\x20details...','round','ies','success','schedule:run','statusIcon'];a36_0x2b52=function(){return _0x16980e;};return a36_0x2b52();}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2c0b12(0x1ea)]=a36_0x2c0b12(0x231);[a36_0x2c0b12(0x241)]=a36_0x2c0b12(0x20c);[a36_0x2c0b12(0x212)](_0x4f4476){const _0x45e9f2=a36_0x2c0b12,_0x231d23=_0x4f4476[_0x45e9f2(0x213)][0x0];if(!_0x231d23)return _0x45e9f2(0x262);return undefined;}async['execute'](_0x3ecb9a){const _0x37bc9e=a36_0x2c0b12,{options:_0x12de27,args:_0x229635,tdx:_0x22b7f3}=_0x3ecb9a,_0x255042=_0x229635[0x0];if(!_0x12de27[_0x37bc9e(0x21b)]){const _0x31e19a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x255042+'\x22?');if(!_0x31e19a)return console[_0x37bc9e(0x25b)](_0x37bc9e(0x1f4)),0x0;}const _0x438210=await withSpinner(_0x37bc9e(0x201),()=>_0x22b7f3['schedules'][_0x37bc9e(0x246)](_0x255042),{'verbose':_0x12de27[_0x37bc9e(0x1dd)]});return console[_0x37bc9e(0x25b)](_0x37bc9e(0x204)+_0x438210[_0x37bc9e(0x20d)][_0x37bc9e(0x1ea)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2c0b12(0x1ea)]=a36_0x2c0b12(0x1d8);['description']=a36_0x2c0b12(0x23d);[a36_0x2c0b12(0x212)](_0xa4baca){const _0x2223ca=a36_0x2c0b12,_0x319f96=_0xa4baca[_0x2223ca(0x213)][0x0];if(!_0x319f96)return _0x2223ca(0x221);return undefined;}async[a36_0x2c0b12(0x1d3)](_0x3cc604){const _0x43608e=a36_0x2c0b12,{options:_0x5f06a9,args:_0x57e336,tdx:_0x1a1a31}=_0x3cc604,_0x33c723=_0x57e336[0x0],_0x1109cc=_0x5f06a9,_0x196a5b=_0x1109cc['time'],_0x157006=_0x1109cc['num']!==undefined?Number(_0x1109cc[_0x43608e(0x209)]):undefined;if(_0x5f06a9[_0x43608e(0x1dd)]){console['error'](_0x43608e(0x215)+_0x33c723);if(_0x196a5b)console[_0x43608e(0x25b)](_0x43608e(0x245)+_0x196a5b);if(_0x157006)console[_0x43608e(0x25b)](_0x43608e(0x247)+_0x157006);}const _0x352e67=await withSpinner(_0x43608e(0x22c),()=>_0x1a1a31[_0x43608e(0x200)]['run'](_0x33c723,{'time':_0x196a5b,'num':_0x157006}),{'verbose':_0x5f06a9[_0x43608e(0x1dd)]}),_0x3aa2b0=_0x352e67[_0x43608e(0x20d)][_0x43608e(0x1f9)];console[_0x43608e(0x25b)](_0x43608e(0x243)+_0x3aa2b0[_0x43608e(0x21c)]+'\x20job'+(_0x3aa2b0[_0x43608e(0x21c)]!==0x1?'s':'')+_0x43608e(0x220));for(const _0x2b8627 of _0x3aa2b0){console[_0x43608e(0x25b)]('\x20\x20Job\x20ID:\x20'+_0x2b8627[_0x43608e(0x1e0)]);}return await handleSDKOutput(_0x3aa2b0,_0x5f06a9),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2c0b12(0x1ea)]=a36_0x2c0b12(0x259);[a36_0x2c0b12(0x241)]=a36_0x2c0b12(0x22a);[a36_0x2c0b12(0x212)](_0x9104ac){const _0x213689=_0x9104ac['args'][0x0];if(!_0x213689)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x2c0b12(0x1d3)](_0x45dffd){const _0x88affe=a36_0x2c0b12,{options:_0x2c18b0,args:_0x5183cd,tdx:_0x2869e4}=_0x45dffd,_0x4d0082=_0x5183cd[0x0],_0x5ecad8=_0x2c18b0,_0x11a42c=_0x5ecad8[_0x88affe(0x227)]!==undefined?Number(_0x5ecad8[_0x88affe(0x227)]):undefined,_0x3d972f=_0x5ecad8['to']!==undefined?Number(_0x5ecad8['to']):undefined,_0x302dc0=await withSpinner(_0x88affe(0x1f6),()=>_0x2869e4[_0x88affe(0x200)][_0x88affe(0x1f5)](_0x4d0082,{'from':_0x11a42c,'to':_0x3d972f}),{'verbose':_0x2c18b0[_0x88affe(0x1dd)]}),_0x442bc9=_0x302dc0[_0x88affe(0x20d)];console[_0x88affe(0x25b)]('Found\x20'+_0x442bc9[_0x88affe(0x24f)]+_0x88affe(0x25a)+(_0x442bc9[_0x88affe(0x24f)]!==0x1?'s':'')+'\x20(showing\x20'+_0x442bc9['from']+'-'+_0x442bc9['to']+')');const _0x22d7e1=_0x442bc9[_0x88affe(0x1f5)]['map'](_0xef4b94=>({'job_id':_0xef4b94['job_id'],'type':_0xef4b94[_0x88affe(0x24a)],'status':_0xef4b94[_0x88affe(0x206)],'scheduled_at':_0xef4b94[_0x88affe(0x1e7)],'created_at':_0xef4b94[_0x88affe(0x1e6)],'start_at':_0xef4b94['start_at'],'end_at':_0xef4b94[_0x88affe(0x1e5)]}));return await handleSDKOutput(_0x22d7e1,_0x2c18b0),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x3edfaf=a37_0x421c;(function(_0x2115b6,_0x4f95f7){const _0x608324=a37_0x421c,_0x183c78=_0x2115b6();while(!![]){try{const _0x3309df=-parseInt(_0x608324(0x168))/0x1+-parseInt(_0x608324(0x173))/0x2+-parseInt(_0x608324(0x167))/0x3+-parseInt(_0x608324(0x16f))/0x4*(parseInt(_0x608324(0x107))/0x5)+parseInt(_0x608324(0x139))/0x6+-parseInt(_0x608324(0x106))/0x7+parseInt(_0x608324(0xe1))/0x8;if(_0x3309df===_0x4f95f7)break;else _0x183c78['push'](_0x183c78['shift']());}catch(_0x5b59b3){_0x183c78['push'](_0x183c78['shift']());}}}(a37_0x1f3a,0x2ff88));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';function a37_0x1f3a(){const _0xfc064d=['216527nrnVec','stats','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','✔\x20Query\x20completed:\x20Processed\x20','Use:\x20tdx\x20ps\x20view\x20-w','description','getSegmentSQL','8vSqAwd','folderPath','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','363496wYFVeH','segment','url','query','parentId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolvePathToResource','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Folder\x20ID:\x20','log','Folder\x20ID\x20missing\x20from\x20resolved\x20path','cyan','Segment\x20ID:\x20','path','jobId','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Executing\x20segment\x20query...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','parentFolder','Resolved\x20type:\x20','resolveParentId','9421192MICQcZ','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Show\x20segment\x20folder\x20details','\x20\x20Folder\x20path:\x20','Resolved\x20parent\x20ID:\x20','Usage:','includes','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20folder\x20details...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20\x27','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Site:\x20','SEGMENT_FOLDER_NOT_FOUND','Folder\x20name:\x20','Creating\x20folder\x20\x27','Error:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segmentName','listFolders','Parent\x20ID:\x20','site','json','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolved\x20YAML\x20file:\x20','fullPath','segmentPath','\x20\x20Full\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','data','parent','Show\x20segment\x20or\x20folder\x20details','SEGMENT_NOT_FOUND','Use:\x20tdx\x20ps\x20desc','format','segment:desc','1708847krQfEw','575765SbvXst','message','trim','segment:sql','Resolved:\x20','length','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Target\x20path:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','/app/ps/','Fetching\x20segment\x20details...','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Examples:','parentSegment','execute','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segmentId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Path\x20or\x20name\x20is\x20required','SQL\x20query:\x0a','resolveFolderId','replace','web','Parent\x20segment:\x20','setJobId','Use:\x20tdx\x20ps\x20show','green','test','\x27\x20with\x20ID:\x20','toLocaleString','verbose','processedRows','getSQLFromServerSegment','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','red','getSegmentSQLFromYaml','Create\x20segment\x20folder\x20for\x20organization','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:show','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','name','type','getFolder','1120692xAmJpS','\x20Opening\x20','Resolving\x20parent\x20folder\x20\x27','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','/e/','limit','elapsedTimeMillis','folder','Resolving\x20parent\x20segment\x20\x27','(root)','segment:view','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20SQL\x20from\x20rule...','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','createFolder','Parent\x20name:\x20','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Created\x20folder\x20\x27','Show\x20child\x20segment\x20schema\x20(column\x20types)','Get\x20SQL\x20query\x20for\x20child\x20segment','cause','segment:describe','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolving\x20path\x20\x27','getSegment','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','jsonl','INVALID_ARGUMENT','getSQLFromYamlFile','Resolving\x20folder\x20\x27','\x27...','\x20folder','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','folderId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','885723BoxIBf'];a37_0x1f3a=function(){return _0xfc064d;};return a37_0x1f3a();}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_0x4debc4 from'chalk';async function resolveSegmentTarget(_0x3f8c1f,_0x147a90,_0xd3b5c9){const _0x2f81d6=a37_0x421c;if(isYamlFilePath(_0x3f8c1f))try{const _0x201cf2=await resolveYamlFilePath(_0x3f8c1f);return _0xd3b5c9&&(console[_0x2f81d6(0x146)](_0x2f81d6(0xfa)+_0x3f8c1f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x201cf2['parentSegment']),console[_0x2f81d6(0x146)]('\x20\x20Segment\x20name:\x20'+_0x201cf2['segmentName']),console[_0x2f81d6(0x146)](_0x2f81d6(0xe4)+(_0x201cf2[_0x2f81d6(0x170)]||_0x2f81d6(0x142))),console[_0x2f81d6(0x146)](_0x2f81d6(0xfd)+_0x201cf2[_0x2f81d6(0xfb)])),_0x201cf2[_0x2f81d6(0xfb)];}catch(_0x2692d7){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2f81d6(0x133)+_0x2692d7[_0x2f81d6(0x108)]);}if(!_0x147a90)throw new SDKError(ErrorCode[_0x2f81d6(0x15b)],_0x2f81d6(0x172));return _0x147a90+'/'+_0x3f8c1f;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x152);[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x101);async[a37_0x3edfaf(0x119)](_0x83bf19){const _0x1729e5=a37_0x3edfaf,{options:_0x6cc6a2,args:_0x3e5060,tdx:_0x1c6bf7}=_0x83bf19,_0x4a8d60=_0x3e5060[0x0],_0x2327a4=!_0x4a8d60&&!!_0x6cc6a2[_0x1729e5(0x118)],_0x463ff1=_0x4a8d60||_0x6cc6a2[_0x1729e5(0x118)];if(!_0x463ff1)return console['error'](_0x1729e5(0x11d)),console[_0x1729e5(0x146)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1729e5(0x146)](_0x1729e5(0x117)),console[_0x1729e5(0x146)](_0x1729e5(0x159)),console[_0x1729e5(0x146)](_0x1729e5(0x149)),console[_0x1729e5(0x146)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x1729e5(0x146)](_0x1729e5(0x147)),0x1;try{const _0xbf0a29=_0x6cc6a2[_0x1729e5(0xfc)];let _0x2d0e9c=_0x463ff1;!_0x2327a4&&_0xbf0a29&&!_0x463ff1[_0x1729e5(0xe7)]('/')&&(_0x2d0e9c=_0xbf0a29+'/'+_0x463ff1,_0x6cc6a2[_0x1729e5(0x129)]&&console[_0x1729e5(0x146)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2d0e9c));const _0x31a926=await withSpinner(_0x1729e5(0x156)+_0x2d0e9c+'\x27...',()=>_0x1c6bf7[_0x1729e5(0x174)][_0x1729e5(0x179)](_0x2d0e9c),{'verbose':_0x6cc6a2['verbose']}),_0x1b61fc=_0x31a926[_0x1729e5(0xff)];_0x6cc6a2[_0x1729e5(0x129)]&&(console[_0x1729e5(0x146)](_0x1729e5(0xdf)+_0x1b61fc[_0x1729e5(0x137)]),console[_0x1729e5(0x146)](_0x1729e5(0xf5)+_0x1b61fc['parentId']),_0x1b61fc[_0x1729e5(0x163)]&&console[_0x1729e5(0x146)]('Folder\x20ID:\x20'+_0x1b61fc['folderId']),_0x1b61fc[_0x1729e5(0x11b)]&&console[_0x1729e5(0x146)]('Segment\x20ID:\x20'+_0x1b61fc[_0x1729e5(0x11b)]));if(_0x1b61fc['type']===_0x1729e5(0x100)){const _0x5c0f00=await withSpinner(_0x1729e5(0x111),()=>_0x1c6bf7[_0x1729e5(0x174)]['getParent'](_0x1b61fc[_0x1729e5(0x177)]),{'verbose':_0x6cc6a2[_0x1729e5(0x129)]});await handleSingleObjectOutput(_0x5c0f00[_0x1729e5(0xff)],_0x6cc6a2);}else{if(_0x1b61fc[_0x1729e5(0x137)]===_0x1729e5(0x140)){if(!_0x1b61fc[_0x1729e5(0x163)])throw new SDKError(ErrorCode[_0x1729e5(0xee)],_0x1729e5(0x17f));const _0x4af76f=await withSpinner(_0x1729e5(0xe9),()=>_0x1c6bf7['segment']['getFolder'](_0x1b61fc['folderId']),{'verbose':_0x6cc6a2[_0x1729e5(0x129)]});await handleSingleObjectOutput(_0x4af76f[_0x1729e5(0xff)],_0x6cc6a2);}else{if(_0x1b61fc[_0x1729e5(0x137)]===_0x1729e5(0x174)){if(!_0x1b61fc[_0x1729e5(0x11b)])throw new SDKError(ErrorCode[_0x1729e5(0x102)],_0x1729e5(0x10e));const _0x1aef24=await withSpinner(_0x1729e5(0x113),()=>_0x1c6bf7['segment'][_0x1729e5(0x157)](_0x1b61fc[_0x1729e5(0x177)],_0x1b61fc[_0x1729e5(0x11b)]),{'verbose':_0x6cc6a2['verbose']});await handleSingleObjectOutput(_0x1aef24[_0x1729e5(0xff)],_0x6cc6a2);}}}return 0x0;}catch(_0xe6e49c){if(_0xe6e49c instanceof SDKError)return console[_0x1729e5(0x146)](_0x1729e5(0xf1)+_0xe6e49c['message']),_0xe6e49c['cause']&&console[_0x1729e5(0x146)]('\x20\x20Cause:\x20'+_0xe6e49c[_0x1729e5(0x151)]),0x1;throw _0xe6e49c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3edfaf(0x136)]='segment:show';[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x13c);async[a37_0x3edfaf(0x119)](_0x4d7a7a){const _0x26ae5a=a37_0x3edfaf,{options:_0x270f3a,args:_0x1e95d7,tdx:_0x4bb257}=_0x4d7a7a,_0x11e0fe=_0x1e95d7[0x0];if(!_0x11e0fe)return console['error'](_0x26ae5a(0x11c)),console[_0x26ae5a(0x146)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x26ae5a(0x146)](_0x26ae5a(0x135)),console[_0x26ae5a(0x146)](_0x26ae5a(0x117)),console[_0x26ae5a(0x146)](_0x26ae5a(0x144)),console[_0x26ae5a(0x146)](_0x26ae5a(0xe2)),0x1;try{const _0x4b6ec9=_0x270f3a[_0x26ae5a(0x118)],_0x1b66b3=await resolveSegmentTarget(_0x11e0fe,_0x4b6ec9,_0x270f3a[_0x26ae5a(0x129)]);_0x270f3a[_0x26ae5a(0x129)]&&console[_0x26ae5a(0x146)](_0x26ae5a(0x10f)+_0x1b66b3);const _0x376aed=await withSpinner(_0x26ae5a(0xeb)+_0x11e0fe+_0x26ae5a(0x15e),()=>_0x4bb257[_0x26ae5a(0x174)]['resolvePathToResource'](_0x1b66b3),{'verbose':_0x270f3a[_0x26ae5a(0x129)]}),_0xd2a41=_0x376aed['data'];_0x270f3a[_0x26ae5a(0x129)]&&(console[_0x26ae5a(0x146)](_0x26ae5a(0xdf)+_0xd2a41[_0x26ae5a(0x137)]),console[_0x26ae5a(0x146)](_0x26ae5a(0xf5)+_0xd2a41['parentId']));if(_0xd2a41['type']===_0x26ae5a(0x140))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x26ae5a(0x16a)),0x1;if(_0xd2a41[_0x26ae5a(0x137)]==='parent')return console[_0x26ae5a(0x146)](_0x26ae5a(0x178)),console[_0x26ae5a(0x146)](_0x26ae5a(0x124)),0x1;if(!_0xd2a41[_0x26ae5a(0x11b)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x26ae5a(0x10e));const _0x4eaa44=await withSpinner(_0x26ae5a(0x161),()=>_0x4bb257[_0x26ae5a(0x174)][_0x26ae5a(0x16e)](_0xd2a41['parentId'],_0xd2a41[_0x26ae5a(0x11b)]),{'verbose':_0x270f3a[_0x26ae5a(0x129)]});let _0x44fbca=_0x4eaa44[_0x26ae5a(0xff)];const _0x25e2a4=resolveLimit(_0x270f3a[_0x26ae5a(0x13e)],DEFAULT_DISPLAY_LIMIT),_0x4fd8ac=/\bLIMIT\s+\d+/i[_0x26ae5a(0x126)](_0x44fbca);!_0x4fd8ac&&(_0x44fbca=_0x44fbca[_0x26ae5a(0x109)]()[_0x26ae5a(0x120)](/;+$/,''),_0x44fbca=_0x26ae5a(0xf8)+_0x44fbca+_0x26ae5a(0xea)+_0x25e2a4);_0x270f3a[_0x26ae5a(0x129)]&&console[_0x26ae5a(0x146)](_0x26ae5a(0x11e)+_0x44fbca);const _0x2df66a=await withProgressSpinner(_0x26ae5a(0x186),async _0x32009b=>{const _0x345578=_0x26ae5a,_0x255944=await _0x4bb257[_0x345578(0x176)][_0x345578(0x119)](_0x44fbca,{'catalog':'td','schema':'information_schema','onJobId':_0xd0fa31=>{const _0x5bb617=_0x345578;_0x32009b[_0x5bb617(0x123)](_0xd0fa31);}});return _0x255944;},{'verbose':_0x270f3a[_0x26ae5a(0x129)]}),_0x4dd197=_0x2df66a[_0x26ae5a(0xff)],_0x579939=_0x4dd197[_0x26ae5a(0x183)]?'\x20[Job\x20ID:\x20'+_0x4dd197['jobId']+']':'';return console[_0x26ae5a(0x146)](_0x26ae5a(0x16b)+_0x4dd197['stats'][_0x26ae5a(0x12a)][_0x26ae5a(0x128)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4dd197[_0x26ae5a(0x169)][_0x26ae5a(0x13f)])+_0x579939)),await handleQueryOutput(_0x4dd197,_0x270f3a),0x0;}catch(_0x461139){if(_0x461139 instanceof SDKError)return console[_0x26ae5a(0x146)](_0x26ae5a(0x158)+_0x461139['code']+']'),console[_0x26ae5a(0x146)]('\x0a'+_0x461139[_0x26ae5a(0x108)]),0x1;throw _0x461139;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x3edfaf(0x136)]='segment:folder:list';[a37_0x3edfaf(0x16d)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x3edfaf(0x119)](_0x3387de){const _0x240e35=a37_0x3edfaf,{options:_0x5276ed,args:_0xdd734b,tdx:_0x1b26b5}=_0x3387de;if(_0xdd734b[_0x240e35(0x10c)]===0x0)return console[_0x240e35(0x146)](_0x240e35(0x160)),console[_0x240e35(0x146)](_0x240e35(0x10d)),0x1;const _0x2bb74a=_0xdd734b[0x0];try{_0x5276ed[_0x240e35(0x129)]&&(console[_0x240e35(0x146)]('Site:\x20'+_0x5276ed[_0x240e35(0xf6)]),console[_0x240e35(0x146)]('Parent\x20name:\x20'+_0x2bb74a));const _0x2a4bee=await withSpinner(_0x240e35(0x141)+_0x2bb74a+_0x240e35(0x15e),()=>_0x1b26b5['segment'][_0x240e35(0xe0)](_0x2bb74a),{'verbose':_0x5276ed[_0x240e35(0x129)]}),_0x2e4ae3=_0x2a4bee[_0x240e35(0xff)];_0x5276ed[_0x240e35(0x129)]&&console['error'](_0x240e35(0xe5)+_0x2e4ae3);const _0x42d6ce=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x2bb74a+_0x240e35(0x15e),()=>_0x1b26b5[_0x240e35(0x174)][_0x240e35(0xf4)](_0x2e4ae3),{'verbose':_0x5276ed['verbose']}),_0x1a52bc=_0x42d6ce[_0x240e35(0xff)];return console['error']('✔\x20Found\x20'+_0x1a52bc[_0x240e35(0x10c)]+_0x240e35(0x15f)+(_0x1a52bc[_0x240e35(0x10c)]!==0x1?'s':'')),await handleSDKOutput(_0x1a52bc,_0x5276ed),0x0;}catch(_0x4c0009){if(_0x4c0009 instanceof SDKError)return console[_0x240e35(0x146)](_0x240e35(0xf1)+_0x4c0009[_0x240e35(0x108)]),_0x4c0009[_0x240e35(0x151)]&&console[_0x240e35(0x146)](_0x240e35(0x12c)+_0x4c0009[_0x240e35(0x151)]),0x1;throw _0x4c0009;}}}function a37_0x421c(_0x4d94a4,_0x1f575f){_0x4d94a4=_0x4d94a4-0xde;const _0x1f3a3d=a37_0x1f3a();let _0x421c96=_0x1f3a3d[_0x4d94a4];return _0x421c96;}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x132);['description']=a37_0x3edfaf(0xe3);async['execute'](_0x4c09f2){const _0x31612d=a37_0x3edfaf,{options:_0x342002,args:_0x1b8b3a,tdx:_0x2e7abf}=_0x4c09f2;if(_0x1b8b3a[_0x31612d(0x10c)]===0x0)return console['error'](_0x31612d(0x184)),console[_0x31612d(0x146)](_0x31612d(0x17b)),0x1;try{const {parentId:_0x5333e5,childId:_0x9be028}=parseSegmentRef(_0x1b8b3a[0x0]);_0x342002['verbose']&&(console[_0x31612d(0x146)](_0x31612d(0xed)+_0x342002[_0x31612d(0xf6)]),console[_0x31612d(0x146)](_0x31612d(0x14b)+_0x5333e5),_0x9be028&&console[_0x31612d(0x146)](_0x31612d(0xef)+_0x9be028));if(!_0x9be028)return console[_0x31612d(0x146)](_0x31612d(0x153)),0x1;const _0x1b9035=await withSpinner(_0x31612d(0x141)+_0x5333e5+_0x31612d(0x15e),()=>_0x2e7abf[_0x31612d(0x174)][_0x31612d(0xe0)](_0x5333e5),{'verbose':_0x342002[_0x31612d(0x129)]}),_0x368a11=_0x1b9035[_0x31612d(0xff)];_0x342002['verbose']&&console[_0x31612d(0x146)]('Resolved\x20parent\x20ID:\x20'+_0x368a11);const _0x33cfd1=await withSpinner(_0x31612d(0x15d)+_0x9be028+_0x31612d(0x15e),()=>_0x2e7abf[_0x31612d(0x174)][_0x31612d(0x11f)](_0x368a11,_0x9be028),{'verbose':_0x342002['verbose']}),_0x28f298=_0x33cfd1[_0x31612d(0xff)];_0x342002[_0x31612d(0x129)]&&console[_0x31612d(0x146)]('Resolved\x20folder\x20ID:\x20'+_0x28f298);const _0xb076fb=await withSpinner(_0x31612d(0x14c)+_0x9be028+'\x27...',()=>_0x2e7abf['segment'][_0x31612d(0x138)](_0x28f298),{'verbose':_0x342002['verbose']});return await handleSDKOutput([_0xb076fb[_0x31612d(0xff)]],_0x342002),0x0;}catch(_0x5b721a){if(_0x5b721a instanceof SDKError)return console[_0x31612d(0x146)](_0x31612d(0xf1)+_0x5b721a[_0x31612d(0x108)]),_0x5b721a[_0x31612d(0x151)]&&console[_0x31612d(0x146)](_0x31612d(0x12c)+_0x5b721a[_0x31612d(0x151)]),0x1;throw _0x5b721a;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x10a);['description']=a37_0x3edfaf(0x150);async['execute'](_0x547076){const _0x17e9c7=a37_0x3edfaf,{options:_0x36d8bd,args:_0x1dac4d}=_0x547076,_0x3d2ec2=_0x36d8bd,_0x298791=_0x3d2ec2[_0x17e9c7(0x182)],_0x2880b5=_0x1dac4d[0x0];if(!_0x2880b5&&!_0x298791)return console[_0x17e9c7(0x146)](a37_0x4debc4[_0x17e9c7(0x12e)](_0x17e9c7(0x116))),console[_0x17e9c7(0x146)](_0x17e9c7(0xe6)),console[_0x17e9c7(0x146)](_0x17e9c7(0xe8)),console['error'](_0x17e9c7(0x17c)),console[_0x17e9c7(0x146)]('Examples:'),console['error'](_0x17e9c7(0x166)),console[_0x17e9c7(0x146)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x2880b5&&_0x298791)return console[_0x17e9c7(0x146)](a37_0x4debc4[_0x17e9c7(0x12e)](_0x17e9c7(0x187))),0x1;try{let _0x49cfcb;if(_0x298791)_0x49cfcb=await this[_0x17e9c7(0x15c)](_0x298791,_0x547076);else{if(isYamlFilePath(_0x2880b5))return console[_0x17e9c7(0x146)](a37_0x4debc4['red'](_0x17e9c7(0x11a))),console[_0x17e9c7(0x146)](_0x17e9c7(0x17a)+_0x2880b5),0x1;else _0x49cfcb=await this['getSQLFromServerSegment'](_0x2880b5,_0x547076);}return _0x36d8bd[_0x17e9c7(0x104)]===_0x17e9c7(0xf7)||_0x36d8bd['format']===_0x17e9c7(0x15a)?await handleSDKOutput([{'sql':_0x49cfcb}],_0x36d8bd):console[_0x17e9c7(0x17e)](_0x49cfcb),0x0;}catch(_0x5e7c2d){if(_0x5e7c2d instanceof SDKError)return console[_0x17e9c7(0x146)](_0x17e9c7(0xf1)+_0x5e7c2d[_0x17e9c7(0x108)]),_0x5e7c2d[_0x17e9c7(0x151)]&&console['error']('\x20\x20Cause:\x20'+_0x5e7c2d[_0x17e9c7(0x151)]),0x1;throw _0x5e7c2d;}}async[a37_0x3edfaf(0x15c)](_0x3dea99,_0xd68854){const _0x572a7f=a37_0x3edfaf,{options:_0x3e124d,tdx:_0x3de24a}=_0xd68854;let _0x5d8026;try{_0x5d8026=await resolveYamlFilePath(_0x3dea99);}catch(_0x21b4ab){throw new SDKError(ErrorCode[_0x572a7f(0x15b)],_0x572a7f(0x133)+_0x21b4ab[_0x572a7f(0x108)]);}_0x3e124d[_0x572a7f(0x129)]&&console[_0x572a7f(0x146)](_0x572a7f(0x10b)+_0x5d8026['parentSegment']+'/'+_0x5d8026[_0x572a7f(0xf3)]);const _0x201343=await withSpinner(_0x572a7f(0x145),()=>_0x3de24a['segment'][_0x572a7f(0x12f)](_0x5d8026['content'],_0x5d8026[_0x572a7f(0x118)],_0x5d8026[_0x572a7f(0xf3)]),{'verbose':_0x3e124d[_0x572a7f(0x129)]});return _0x201343[_0x572a7f(0xff)];}async[a37_0x3edfaf(0x12b)](_0x58cf85,_0x44eed9){const _0x1d9c15=a37_0x3edfaf,{options:_0x2afb36,tdx:_0xc8f434}=_0x44eed9,_0x2a69bf=_0x2afb36[_0x1d9c15(0x118)],_0x2d00c2=await resolveSegmentTarget(_0x58cf85,_0x2a69bf,_0x2afb36[_0x1d9c15(0x129)]);_0x2afb36['verbose']&&console[_0x1d9c15(0x146)](_0x1d9c15(0x10f)+_0x2d00c2);const _0x22793d=await withSpinner(_0x1d9c15(0xeb)+_0x58cf85+'\x27...',()=>_0xc8f434[_0x1d9c15(0x174)][_0x1d9c15(0x179)](_0x2d00c2),{'verbose':_0x2afb36[_0x1d9c15(0x129)]}),_0x1dcc2b=_0x22793d['data'];_0x2afb36[_0x1d9c15(0x129)]&&(console[_0x1d9c15(0x146)](_0x1d9c15(0xdf)+_0x1dcc2b[_0x1d9c15(0x137)]),console[_0x1d9c15(0x146)](_0x1d9c15(0xf5)+_0x1dcc2b[_0x1d9c15(0x177)]));if(_0x1dcc2b[_0x1d9c15(0x137)]===_0x1d9c15(0x140))throw new SDKError(ErrorCode[_0x1d9c15(0x15b)],_0x1d9c15(0xec));if(_0x1dcc2b['type']===_0x1d9c15(0x100))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x1dcc2b['segmentId'])throw new SDKError(ErrorCode[_0x1d9c15(0x102)],_0x1d9c15(0x10e));const _0x56b506=await withSpinner(_0x1d9c15(0x161),()=>_0xc8f434[_0x1d9c15(0x174)][_0x1d9c15(0x16e)](_0x1dcc2b[_0x1d9c15(0x177)],_0x1dcc2b[_0x1d9c15(0x11b)]),{'verbose':_0x2afb36[_0x1d9c15(0x129)]});return _0x56b506['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';['description']=a37_0x3edfaf(0x130);async[a37_0x3edfaf(0x119)](_0x380ffd){const _0x191d99=a37_0x3edfaf,{options:_0x6944e7,args:_0x170fef,tdx:_0x3b57d9}=_0x380ffd,_0x186e39=_0x6944e7;if(_0x170fef[_0x191d99(0x10c)]<0x2)return console[_0x191d99(0x146)](_0x191d99(0x154)),console[_0x191d99(0x146)](_0x191d99(0x14d)),0x1;const _0x2de7f6=_0x170fef[0x0],_0x267530=_0x170fef[0x1];_0x186e39[_0x191d99(0x129)]&&(console[_0x191d99(0x146)](_0x191d99(0xed)+_0x186e39[_0x191d99(0xf6)]),console['error'](_0x191d99(0x122)+_0x2de7f6),console[_0x191d99(0x146)](_0x191d99(0xef)+_0x267530));let _0xe27a03;if(_0x186e39[_0x191d99(0xde)]){const _0x24bac6=_0x186e39[_0x191d99(0xde)],_0x55edc1=await withSpinner(_0x191d99(0x141)+_0x2de7f6+'\x27...',()=>_0x3b57d9[_0x191d99(0x174)]['resolveParentId'](_0x2de7f6),{'verbose':_0x186e39[_0x191d99(0x129)]}),_0x5cfbbe=_0x55edc1['data'],_0x5c0da6=await withSpinner(_0x191d99(0x13b)+_0x24bac6+_0x191d99(0x15e),()=>_0x3b57d9[_0x191d99(0x174)][_0x191d99(0x11f)](_0x5cfbbe,_0x24bac6),{'verbose':_0x186e39['verbose']});_0xe27a03=_0x5c0da6[_0x191d99(0xff)],_0x186e39['verbose']&&console['error'](_0x191d99(0x110)+_0xe27a03);}const _0x3990ce={'name':_0x267530,'description':_0x186e39['description'],'parentFolderId':_0xe27a03},_0x29fe6a=await withSpinner(_0x191d99(0xf0)+_0x267530+_0x191d99(0x15e),()=>_0x3b57d9[_0x191d99(0x174)][_0x191d99(0x14a)](_0x2de7f6,_0x3990ce),{'verbose':_0x186e39[_0x191d99(0x129)]}),_0x230724=_0x29fe6a[_0x191d99(0xff)];return console[_0x191d99(0x146)](_0x191d99(0x14e)+_0x230724[_0x191d99(0x136)]+_0x191d99(0x127)+_0x230724['id']),await handleSDKOutput([_0x230724],_0x186e39),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x143);[a37_0x3edfaf(0x16d)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x3edfaf(0x119)](_0x1bc66e){const _0x3150b8=a37_0x3edfaf,{options:_0x1823b6,args:_0x2b96b4,tdx:_0xe78ce3}=_0x1bc66e,_0x55bd2b=_0x2b96b4[0x0];if(!_0x55bd2b)return console[_0x3150b8(0x146)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3150b8(0x146)](_0x3150b8(0x134)),console[_0x3150b8(0x146)](_0x3150b8(0xfe)),console[_0x3150b8(0x146)]('Options:'),console[_0x3150b8(0x146)](_0x3150b8(0x131)),console[_0x3150b8(0x146)]('Examples:'),console[_0x3150b8(0x146)](_0x3150b8(0xf2)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3150b8(0x146)](_0x3150b8(0x12d)),0x1;try{const _0x4d596a=_0x1823b6[_0x3150b8(0x118)],_0x5e8ed1=await resolveSegmentTarget(_0x55bd2b,_0x4d596a,_0x1823b6[_0x3150b8(0x129)]);_0x1823b6[_0x3150b8(0x129)]&&console[_0x3150b8(0x146)](_0x3150b8(0x10f)+_0x5e8ed1);const _0x54f634=await withSpinner(_0x3150b8(0xeb)+_0x55bd2b+_0x3150b8(0x15e),()=>_0xe78ce3[_0x3150b8(0x174)][_0x3150b8(0x179)](_0x5e8ed1),{'verbose':_0x1823b6[_0x3150b8(0x129)]}),_0x18e6e6=_0x54f634[_0x3150b8(0xff)];_0x1823b6[_0x3150b8(0x129)]&&(console[_0x3150b8(0x146)](_0x3150b8(0xdf)+_0x18e6e6['type']),console[_0x3150b8(0x146)](_0x3150b8(0xf5)+_0x18e6e6[_0x3150b8(0x177)]),_0x18e6e6[_0x3150b8(0x163)]&&console[_0x3150b8(0x146)](_0x3150b8(0x17d)+_0x18e6e6[_0x3150b8(0x163)]),_0x18e6e6[_0x3150b8(0x11b)]&&console[_0x3150b8(0x146)](_0x3150b8(0x181)+_0x18e6e6['segmentId']));if(_0x1823b6[_0x3150b8(0x121)]){if(_0x18e6e6[_0x3150b8(0x137)]===_0x3150b8(0x140))return console[_0x3150b8(0x146)](_0x3150b8(0x171)),0x1;if(_0x18e6e6[_0x3150b8(0x137)]==='parent')return console[_0x3150b8(0x146)](_0x3150b8(0x185)),console[_0x3150b8(0x146)](_0x3150b8(0x16c)),0x1;if(!_0x18e6e6[_0x3150b8(0x11b)])throw new SDKError(ErrorCode[_0x3150b8(0x102)],_0x3150b8(0x10e));const _0x5eb6f4=getConsoleNextUrl(_0x1823b6[_0x3150b8(0xf6)],_0x3150b8(0x112)+_0x18e6e6['parentId']+'/e/'+_0x18e6e6[_0x3150b8(0x11b)]);return console[_0x3150b8(0x146)](a37_0x4debc4[_0x3150b8(0x125)]('✔')+_0x3150b8(0x13a)+a37_0x4debc4[_0x3150b8(0x180)](_0x5eb6f4)),openBrowser(_0x5eb6f4),0x0;}if(_0x18e6e6['type']===_0x3150b8(0x140)){if(!_0x18e6e6[_0x3150b8(0x163)])throw new SDKError(ErrorCode[_0x3150b8(0xee)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xa21445=await withSpinner(_0x3150b8(0xe9),()=>_0xe78ce3[_0x3150b8(0x174)]['getFolder'](_0x18e6e6['folderId']),{'verbose':_0x1823b6['verbose']});await handleSingleObjectOutput(_0xa21445[_0x3150b8(0xff)],_0x1823b6);}else{if(_0x18e6e6['type']==='segment'){if(!_0x18e6e6[_0x3150b8(0x11b)])throw new SDKError(ErrorCode[_0x3150b8(0x102)],_0x3150b8(0x10e));const _0x233a13=await withSpinner('Fetching\x20segment\x20details...',()=>_0xe78ce3['segment']['getSegment'](_0x18e6e6[_0x3150b8(0x177)],_0x18e6e6['segmentId']),{'verbose':_0x1823b6[_0x3150b8(0x129)]}),_0x2c11c8=getConsoleNextUrl(_0x1823b6[_0x3150b8(0xf6)],'/app/ps/'+_0x18e6e6[_0x3150b8(0x177)]+_0x3150b8(0x13d)+_0x18e6e6[_0x3150b8(0x11b)]),_0xdf82ce=_0x233a13[_0x3150b8(0xff)];_0xdf82ce[_0x3150b8(0x175)]=_0x2c11c8,await handleSingleObjectOutput(_0xdf82ce,_0x1823b6);}else return console[_0x3150b8(0x146)](_0x3150b8(0x155)),console[_0x3150b8(0x146)](_0x3150b8(0x114)),0x1;}return 0x0;}catch(_0x14b864){if(_0x14b864 instanceof SDKError)return console['error'](_0x3150b8(0xf1)+_0x14b864[_0x3150b8(0x108)]),_0x14b864[_0x3150b8(0x151)]&&console[_0x3150b8(0x146)](_0x3150b8(0x12c)+_0x14b864['cause']),0x1;throw _0x14b864;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x3edfaf(0x105);[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x14f);async[a37_0x3edfaf(0x119)](_0x15119d){const _0x2ccf22=a37_0x3edfaf,{options:_0x5e7609,args:_0x4f138e,tdx:_0x6e0df3}=_0x15119d,_0x259151=_0x4f138e[0x0];if(!_0x259151)return console[_0x2ccf22(0x146)](_0x2ccf22(0x11c)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2ccf22(0x146)](_0x2ccf22(0x148)),console[_0x2ccf22(0x146)](_0x2ccf22(0x117)),console['error'](_0x2ccf22(0xf9)),console['error'](_0x2ccf22(0x162)),0x1;try{const _0x379280=_0x5e7609[_0x2ccf22(0x118)],_0x31866a=await resolveSegmentTarget(_0x259151,_0x379280,_0x5e7609[_0x2ccf22(0x129)]);_0x5e7609[_0x2ccf22(0x129)]&&console[_0x2ccf22(0x146)](_0x2ccf22(0x10f)+_0x31866a);const _0x49c2af=await withSpinner(_0x2ccf22(0xeb)+_0x259151+'\x27...',()=>_0x6e0df3['segment'][_0x2ccf22(0x179)](_0x31866a),{'verbose':_0x5e7609[_0x2ccf22(0x129)]}),_0x2d6af3=_0x49c2af[_0x2ccf22(0xff)];_0x5e7609[_0x2ccf22(0x129)]&&(console[_0x2ccf22(0x146)](_0x2ccf22(0xdf)+_0x2d6af3[_0x2ccf22(0x137)]),console[_0x2ccf22(0x146)]('Parent\x20ID:\x20'+_0x2d6af3[_0x2ccf22(0x177)]));if(_0x2d6af3[_0x2ccf22(0x137)]===_0x2ccf22(0x140))return console['error'](_0x2ccf22(0x164)),console[_0x2ccf22(0x146)](_0x2ccf22(0x165)),0x1;if(_0x2d6af3['type']===_0x2ccf22(0x100))return console[_0x2ccf22(0x146)](_0x2ccf22(0x115)),console[_0x2ccf22(0x146)](_0x2ccf22(0x103)),0x1;if(!_0x2d6af3[_0x2ccf22(0x11b)])throw new SDKError(ErrorCode[_0x2ccf22(0x102)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4ff66a=await withSpinner(_0x2ccf22(0x161),()=>_0x6e0df3[_0x2ccf22(0x174)][_0x2ccf22(0x16e)](_0x2d6af3[_0x2ccf22(0x177)],_0x2d6af3[_0x2ccf22(0x11b)]),{'verbose':_0x5e7609[_0x2ccf22(0x129)]}),_0x1855f9=_0x4ff66a[_0x2ccf22(0xff)],_0x6f0c6=await executeSchemaQuery(_0x1855f9,_0x6e0df3,_0x5e7609);return await handleQueryOutput(_0x6f0c6,_0x5e7609),0x0;}catch(_0x5ae65c){if(_0x5ae65c instanceof SDKError)return console['error'](_0x2ccf22(0xf1)+_0x5ae65c[_0x2ccf22(0x108)]),_0x5ae65c[_0x2ccf22(0x151)]&&console[_0x2ccf22(0x146)](_0x2ccf22(0x12c)+_0x5ae65c[_0x2ccf22(0x151)]),0x1;throw _0x5ae65c;}}}
|
|
1
|
+
const a37_0x504d81=a37_0x1e35;(function(_0x5b711b,_0x58b2be){const _0x4e9280=a37_0x1e35,_0x44ed55=_0x5b711b();while(!![]){try{const _0x59c361=parseInt(_0x4e9280(0x11c))/0x1+parseInt(_0x4e9280(0xd4))/0x2+parseInt(_0x4e9280(0x111))/0x3+-parseInt(_0x4e9280(0x10e))/0x4*(-parseInt(_0x4e9280(0xd5))/0x5)+parseInt(_0x4e9280(0x11f))/0x6*(-parseInt(_0x4e9280(0xc9))/0x7)+-parseInt(_0x4e9280(0xf1))/0x8+-parseInt(_0x4e9280(0x127))/0x9*(parseInt(_0x4e9280(0x10b))/0xa);if(_0x59c361===_0x58b2be)break;else _0x44ed55['push'](_0x44ed55['shift']());}catch(_0x22cc2b){_0x44ed55['push'](_0x44ed55['shift']());}}}(a37_0x4c62,0x1c217));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';function a37_0x1e35(_0x5c8560,_0x43cd07){_0x5c8560=_0x5c8560-0xa8;const _0x4c62a6=a37_0x4c62();let _0x1e353b=_0x4c62a6[_0x5c8560];return _0x1e353b;}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_0x565e01 from'chalk';async function resolveSegmentTarget(_0xb7e7cd,_0x4a9769,_0x1321ae){const _0x7c49c4=a37_0x1e35;if(isYamlFilePath(_0xb7e7cd))try{const _0x1be5bd=await resolveYamlFilePath(_0xb7e7cd);return _0x1321ae&&(console[_0x7c49c4(0x14d)](_0x7c49c4(0x10f)+_0xb7e7cd),console[_0x7c49c4(0x14d)](_0x7c49c4(0x136)+_0x1be5bd[_0x7c49c4(0xd8)]),console[_0x7c49c4(0x14d)](_0x7c49c4(0x141)+_0x1be5bd[_0x7c49c4(0xbd)]),console[_0x7c49c4(0x14d)](_0x7c49c4(0xed)+(_0x1be5bd[_0x7c49c4(0xfc)]||'(root)')),console[_0x7c49c4(0x14d)](_0x7c49c4(0x147)+_0x1be5bd[_0x7c49c4(0x13b)])),_0x1be5bd[_0x7c49c4(0x13b)];}catch(_0x8d5a6a){throw new SDKError(ErrorCode[_0x7c49c4(0x139)],_0x7c49c4(0x130)+_0x8d5a6a['message']);}if(!_0x4a9769)throw new SDKError(ErrorCode[_0x7c49c4(0x139)],_0x7c49c4(0xb3));return _0x4a9769+'/'+_0xb7e7cd;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x504d81(0xfb)]=a37_0x504d81(0x11a);[a37_0x504d81(0x149)]=a37_0x504d81(0xd9);async['execute'](_0x2f304b){const _0x3042f0=a37_0x504d81,{options:_0x35caf7,args:_0x2e171c,tdx:_0x5a0ea4}=_0x2f304b,_0x2697c8=_0x2e171c[0x0],_0x6313f1=!_0x2697c8&&!!_0x35caf7[_0x3042f0(0xd8)],_0x3c84af=_0x2697c8||_0x35caf7[_0x3042f0(0xd8)];if(!_0x3c84af)return console[_0x3042f0(0x14d)](_0x3042f0(0xb0)),console['error'](_0x3042f0(0x108)),console['error'](_0x3042f0(0xe8)),console[_0x3042f0(0x14d)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x3042f0(0x14d)](_0x3042f0(0x12c)),console[_0x3042f0(0x14d)](_0x3042f0(0x11d)),console[_0x3042f0(0x14d)](_0x3042f0(0xac)),0x1;try{const _0x2e1083=_0x35caf7[_0x3042f0(0xeb)];let _0x3348ea=_0x3c84af;!_0x6313f1&&_0x2e1083&&!_0x3c84af[_0x3042f0(0x117)]('/')&&(_0x3348ea=_0x2e1083+'/'+_0x3c84af,_0x35caf7[_0x3042f0(0xc5)]&&console['error'](_0x3042f0(0xf2)+_0x3348ea));const _0x33fac6=await withSpinner('Resolving\x20path\x20\x27'+_0x3348ea+_0x3042f0(0xf8),()=>_0x5a0ea4[_0x3042f0(0xbe)]['resolvePathToResource'](_0x3348ea),{'verbose':_0x35caf7[_0x3042f0(0xc5)]}),_0x2d3f78=_0x33fac6['data'];_0x35caf7[_0x3042f0(0xc5)]&&(console['error'](_0x3042f0(0x10a)+_0x2d3f78['type']),console['error'](_0x3042f0(0xea)+_0x2d3f78[_0x3042f0(0xd1)]),_0x2d3f78[_0x3042f0(0x105)]&&console['error'](_0x3042f0(0xf7)+_0x2d3f78[_0x3042f0(0x105)]),_0x2d3f78[_0x3042f0(0x114)]&&console[_0x3042f0(0x14d)](_0x3042f0(0xb6)+_0x2d3f78['segmentId']));if(_0x2d3f78['type']===_0x3042f0(0xde)){const _0x3ee230=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5a0ea4[_0x3042f0(0xbe)][_0x3042f0(0xca)](_0x2d3f78[_0x3042f0(0xd1)]),{'verbose':_0x35caf7[_0x3042f0(0xc5)]});await handleSingleObjectOutput(_0x3ee230[_0x3042f0(0x123)],_0x35caf7);}else{if(_0x2d3f78[_0x3042f0(0xf0)]===_0x3042f0(0xe2)){if(!_0x2d3f78[_0x3042f0(0x105)])throw new SDKError(ErrorCode[_0x3042f0(0xb8)],_0x3042f0(0x11e));const _0x8699c=await withSpinner(_0x3042f0(0x104),()=>_0x5a0ea4[_0x3042f0(0xbe)]['getFolder'](_0x2d3f78['folderId']),{'verbose':_0x35caf7[_0x3042f0(0xc5)]});await handleSingleObjectOutput(_0x8699c[_0x3042f0(0x123)],_0x35caf7);}else{if(_0x2d3f78[_0x3042f0(0xf0)]==='segment'){if(!_0x2d3f78[_0x3042f0(0x114)])throw new SDKError(ErrorCode[_0x3042f0(0xef)],_0x3042f0(0xc1));const _0x3708c7=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5a0ea4[_0x3042f0(0xbe)][_0x3042f0(0x133)](_0x2d3f78[_0x3042f0(0xd1)],_0x2d3f78['segmentId']),{'verbose':_0x35caf7['verbose']});await handleSingleObjectOutput(_0x3708c7['data'],_0x35caf7);}}}return 0x0;}catch(_0x4b5208){if(_0x4b5208 instanceof SDKError)return console[_0x3042f0(0x14d)](_0x3042f0(0x148)+_0x4b5208[_0x3042f0(0x10c)]),_0x4b5208[_0x3042f0(0xd0)]&&console[_0x3042f0(0x14d)](_0x3042f0(0xf3)+_0x4b5208[_0x3042f0(0xd0)]),0x1;throw _0x4b5208;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x504d81(0xfb)]=a37_0x504d81(0xa9);[a37_0x504d81(0x149)]=a37_0x504d81(0xcb);async[a37_0x504d81(0x134)](_0x5372a6){const _0x5ee796=a37_0x504d81,{options:_0x23437a,args:_0x51b7f5,tdx:_0x4d430e}=_0x5372a6,_0x5145bb=_0x51b7f5[0x0];if(!_0x5145bb)return console[_0x5ee796(0x14d)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5ee796(0x14d)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x5ee796(0xfd)),console[_0x5ee796(0x14d)](_0x5ee796(0xe8)),console[_0x5ee796(0x14d)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x5ee796(0x14d)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4e79ce=_0x23437a['parentSegment'],_0x48d3f4=await resolveSegmentTarget(_0x5145bb,_0x4e79ce,_0x23437a['verbose']);_0x23437a[_0x5ee796(0xc5)]&&console[_0x5ee796(0x14d)]('Target\x20path:\x20'+_0x48d3f4);const _0x3e8d1b=await withSpinner(_0x5ee796(0xd3)+_0x5145bb+_0x5ee796(0xf8),()=>_0x4d430e[_0x5ee796(0xbe)][_0x5ee796(0x116)](_0x48d3f4),{'verbose':_0x23437a[_0x5ee796(0xc5)]}),_0x4848a9=_0x3e8d1b[_0x5ee796(0x123)];_0x23437a[_0x5ee796(0xc5)]&&(console[_0x5ee796(0x14d)](_0x5ee796(0x10a)+_0x4848a9[_0x5ee796(0xf0)]),console[_0x5ee796(0x14d)](_0x5ee796(0xea)+_0x4848a9[_0x5ee796(0xd1)]));if(_0x4848a9[_0x5ee796(0xf0)]===_0x5ee796(0xe2))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x5ee796(0x14d)](_0x5ee796(0xe7)),0x1;if(_0x4848a9[_0x5ee796(0xf0)]===_0x5ee796(0xde))return console[_0x5ee796(0x14d)](_0x5ee796(0x110)),console[_0x5ee796(0x14d)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x4848a9[_0x5ee796(0x114)])throw new SDKError(ErrorCode[_0x5ee796(0xef)],_0x5ee796(0xc1));const _0x293108=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4d430e[_0x5ee796(0xbe)][_0x5ee796(0xe9)](_0x4848a9[_0x5ee796(0xd1)],_0x4848a9[_0x5ee796(0x114)]),{'verbose':_0x23437a[_0x5ee796(0xc5)]});let _0x56c8e4=_0x293108[_0x5ee796(0x123)];const _0x5eea35=resolveLimit(_0x23437a[_0x5ee796(0xc2)],DEFAULT_DISPLAY_LIMIT),_0x46ec8d=/\bLIMIT\s+\d+/i['test'](_0x56c8e4);!_0x46ec8d&&(_0x56c8e4=_0x56c8e4[_0x5ee796(0x109)]()['replace'](/;+$/,''),_0x56c8e4=_0x5ee796(0xdb)+_0x56c8e4+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x5eea35);_0x23437a[_0x5ee796(0xc5)]&&console[_0x5ee796(0x14d)]('SQL\x20query:\x0a'+_0x56c8e4);const _0x3d9dfd=await withProgressSpinner(_0x5ee796(0x14a),async _0xe68c5c=>{const _0x35faef=_0x5ee796,_0x2e42d4=await _0x4d430e['query'][_0x35faef(0x134)](_0x56c8e4,{'catalog':'td','schema':'information_schema','onJobId':_0x34d33f=>{const _0x141c7e=_0x35faef;_0xe68c5c[_0x141c7e(0xc0)](_0x34d33f);}});return _0x2e42d4;},{'verbose':_0x23437a[_0x5ee796(0xc5)]}),_0x42bcef=_0x3d9dfd[_0x5ee796(0x123)],_0x115c11=_0x42bcef['jobId']?'\x20[Job\x20ID:\x20'+_0x42bcef[_0x5ee796(0x12a)]+']':'';return console[_0x5ee796(0x14d)](_0x5ee796(0x100)+_0x42bcef[_0x5ee796(0xe4)][_0x5ee796(0xad)]['toLocaleString']()+_0x5ee796(0x120)+(_0x5ee796(0xfa)+formatElapsed(_0x42bcef['stats']['elapsedTimeMillis'])+_0x115c11)),await handleQueryOutput(_0x42bcef,_0x23437a),0x0;}catch(_0x2f718a){if(_0x2f718a instanceof SDKError)return console['error'](_0x5ee796(0xcc)+_0x2f718a[_0x5ee796(0xaf)]+']'),console['error']('\x0a'+_0x2f718a['message']),0x1;throw _0x2f718a;}}}function a37_0x4c62(){const _0x17cea4=['Parent\x20ID:\x20','segmentPath','Fetching\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','length','SEGMENT_NOT_FOUND','type','1294336bXjfPp','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Cause:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20desc\x20<name>','Get\x20SQL\x20query\x20for\x20child\x20segment','Folder\x20ID:\x20','\x27...','\x20folder','in\x20','name','folderPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','/e/','✔\x20Query\x20completed:\x20Processed\x20','segment:folder:list','\x27\x20with\x20ID:\x20','json','Fetching\x20folder\x20details...','folderId','Error:\x20Folder\x20reference\x20is\x20required','getFolder','Usage:\x20tdx\x20segment\x20describe\x20<path>','trim','Resolved\x20type:\x20','167910FEdSTg','message','web','4aZggZN','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','38958XqFhNn','Site:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','segmentId','segment:view','resolvePathToResource','includes','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:describe','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','149415XrHIDy','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Folder\x20ID\x20missing\x20from\x20resolved\x20path','9852izzijc','\x20rows\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','data','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Create\x20segment\x20folder\x20for\x20organization','72pidIJK','site','Show\x20folder\x20or\x20child\x20segment\x20details','jobId','cyan','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolving\x20parent\x20segment\x20\x27','Resolving\x20folder\x20\x27','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20segment\x20details...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','getSegment','execute','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20Parent\x20segment:\x20','Folder\x20name:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','fullPath','Show\x20segment\x20folder\x20details','Parent\x20segment:\x20','format','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Segment\x20name:\x20','segment:sql','Use:\x20tdx\x20ps\x20desc','Resolved\x20parent\x20ID:\x20','\x20Opening\x20','path','\x20\x20Full\x20path:\x20','Error:\x20','description','Executing\x20segment\x20query...','Resolved\x20parent\x20folder\x20ID:\x20','Resolving\x20parent\x20folder\x20\x27','error','resolveFolderId','segment:show','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','content','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','processedRows','Fetching\x20SQL\x20from\x20rule...','code','Error:\x20Path\x20or\x20name\x20is\x20required','Show\x20child\x20segment\x20schema\x20(column\x20types)','Target\x20path:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','getSQLFromServerSegment','parentFolder','Segment\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','SEGMENT_FOLDER_NOT_FOUND','Resolved:\x20','getSQLFromYamlFile','Usage:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segmentName','segment','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','setJobId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','limit','Parent\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','verbose','resolveParentId','segment:desc','Use:\x20tdx\x20ps\x20view\x20-w','406FWbhqh','getParent','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','✖\x20Query\x20failed\x20[','log','/app/ps/','jsonl','cause','parentId','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolving\x20\x27','238954vIsHth','1123505lNVccU','url','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','parentSegment','Show\x20segment\x20or\x20folder\x20details','green','SELECT\x20*\x20FROM\x20(\x0a','segment:folder:show','✔\x20Found\x20','parent','Use:\x20tdx\x20ps\x20view','red','Resolved\x20folder\x20ID:\x20','folder','Fetching\x20SQL\x20for\x20segment...','stats','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','getSegmentSQLFromYaml','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Examples:','getSegmentSQL'];a37_0x4c62=function(){return _0x17cea4;};return a37_0x4c62();}export class SegmentFolderListCommand extends BaseCommand{[a37_0x504d81(0xfb)]=a37_0x504d81(0x101);[a37_0x504d81(0x149)]=a37_0x504d81(0x132);async[a37_0x504d81(0x134)](_0x21f4c2){const _0x2f4724=a37_0x504d81,{options:_0x4b0f5b,args:_0x38e780,tdx:_0x25f40f}=_0x21f4c2;if(_0x38e780[_0x2f4724(0xee)]===0x0)return console[_0x2f4724(0x14d)](_0x2f4724(0x119)),console[_0x2f4724(0x14d)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x3188a5=_0x38e780[0x0];try{_0x4b0f5b[_0x2f4724(0xc5)]&&(console[_0x2f4724(0x14d)](_0x2f4724(0x112)+_0x4b0f5b[_0x2f4724(0x128)]),console['error'](_0x2f4724(0xc3)+_0x3188a5));const _0x54b237=await withSpinner(_0x2f4724(0x12e)+_0x3188a5+_0x2f4724(0xf8),()=>_0x25f40f[_0x2f4724(0xbe)]['resolveParentId'](_0x3188a5),{'verbose':_0x4b0f5b['verbose']}),_0x1114b6=_0x54b237[_0x2f4724(0x123)];_0x4b0f5b[_0x2f4724(0xc5)]&&console[_0x2f4724(0x14d)](_0x2f4724(0x144)+_0x1114b6);const _0x362d96=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x3188a5+_0x2f4724(0xf8),()=>_0x25f40f[_0x2f4724(0xbe)]['listFolders'](_0x1114b6),{'verbose':_0x4b0f5b['verbose']}),_0x3d67ec=_0x362d96['data'];return console[_0x2f4724(0x14d)](_0x2f4724(0xdd)+_0x3d67ec[_0x2f4724(0xee)]+_0x2f4724(0xf9)+(_0x3d67ec[_0x2f4724(0xee)]!==0x1?'s':'')),await handleSDKOutput(_0x3d67ec,_0x4b0f5b),0x0;}catch(_0x45cef6){if(_0x45cef6 instanceof SDKError)return console[_0x2f4724(0x14d)](_0x2f4724(0x148)+_0x45cef6[_0x2f4724(0x10c)]),_0x45cef6[_0x2f4724(0xd0)]&&console[_0x2f4724(0x14d)](_0x2f4724(0xf3)+_0x45cef6[_0x2f4724(0xd0)]),0x1;throw _0x45cef6;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x504d81(0xdc);['description']=a37_0x504d81(0x13c);async[a37_0x504d81(0x134)](_0x544fb0){const _0xf8ae4d=a37_0x504d81,{options:_0x5c2631,args:_0x5f54c1,tdx:_0x591d18}=_0x544fb0;if(_0x5f54c1[_0xf8ae4d(0xee)]===0x0)return console[_0xf8ae4d(0x14d)](_0xf8ae4d(0x106)),console[_0xf8ae4d(0x14d)](_0xf8ae4d(0xb7)),0x1;try{const {parentId:_0x31f8b4,childId:_0x546dec}=parseSegmentRef(_0x5f54c1[0x0]);_0x5c2631[_0xf8ae4d(0xc5)]&&(console[_0xf8ae4d(0x14d)](_0xf8ae4d(0x112)+_0x5c2631[_0xf8ae4d(0x128)]),console[_0xf8ae4d(0x14d)](_0xf8ae4d(0xc3)+_0x31f8b4),_0x546dec&&console['error'](_0xf8ae4d(0x137)+_0x546dec));if(!_0x546dec)return console[_0xf8ae4d(0x14d)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x553dbb=await withSpinner(_0xf8ae4d(0x12e)+_0x31f8b4+_0xf8ae4d(0xf8),()=>_0x591d18[_0xf8ae4d(0xbe)]['resolveParentId'](_0x31f8b4),{'verbose':_0x5c2631[_0xf8ae4d(0xc5)]}),_0x417d56=_0x553dbb[_0xf8ae4d(0x123)];_0x5c2631[_0xf8ae4d(0xc5)]&&console[_0xf8ae4d(0x14d)](_0xf8ae4d(0x144)+_0x417d56);const _0x1476ae=await withSpinner(_0xf8ae4d(0x12f)+_0x546dec+_0xf8ae4d(0xf8),()=>_0x591d18['segment'][_0xf8ae4d(0xa8)](_0x417d56,_0x546dec),{'verbose':_0x5c2631[_0xf8ae4d(0xc5)]}),_0x147672=_0x1476ae['data'];_0x5c2631['verbose']&&console[_0xf8ae4d(0x14d)](_0xf8ae4d(0xe1)+_0x147672);const _0x382555=await withSpinner(_0xf8ae4d(0xec)+_0x546dec+_0xf8ae4d(0xf8),()=>_0x591d18[_0xf8ae4d(0xbe)][_0xf8ae4d(0x107)](_0x147672),{'verbose':_0x5c2631[_0xf8ae4d(0xc5)]});return await handleSDKOutput([_0x382555[_0xf8ae4d(0x123)]],_0x5c2631),0x0;}catch(_0x49f339){if(_0x49f339 instanceof SDKError)return console[_0xf8ae4d(0x14d)](_0xf8ae4d(0x148)+_0x49f339[_0xf8ae4d(0x10c)]),_0x49f339[_0xf8ae4d(0xd0)]&&console['error'](_0xf8ae4d(0xf3)+_0x49f339[_0xf8ae4d(0xd0)]),0x1;throw _0x49f339;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x504d81(0xfb)]=a37_0x504d81(0x142);['description']=a37_0x504d81(0xf6);async['execute'](_0x232d31){const _0x4820df=a37_0x504d81,{options:_0x48ed98,args:_0x17a03e}=_0x232d31,_0x398e09=_0x48ed98,_0x40eba2=_0x398e09[_0x4820df(0x146)],_0x442578=_0x17a03e[0x0];if(!_0x442578&&!_0x40eba2)return console[_0x4820df(0x14d)](a37_0x565e01[_0x4820df(0xe0)](_0x4820df(0x13f))),console[_0x4820df(0x14d)](_0x4820df(0xbb)),console['error'](_0x4820df(0x138)),console[_0x4820df(0x14d)](_0x4820df(0x135)),console[_0x4820df(0x14d)](_0x4820df(0xe8)),console[_0x4820df(0x14d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console['error'](_0x4820df(0x122)),0x1;if(_0x442578&&_0x40eba2)return console[_0x4820df(0x14d)](a37_0x565e01[_0x4820df(0xe0)](_0x4820df(0xe5))),0x1;try{let _0x454454;if(_0x40eba2)_0x454454=await this[_0x4820df(0xba)](_0x40eba2,_0x232d31);else{if(isYamlFilePath(_0x442578))return console['error'](a37_0x565e01[_0x4820df(0xe0)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x4820df(0x14d)](_0x4820df(0x118)+_0x442578),0x1;else _0x454454=await this[_0x4820df(0xb4)](_0x442578,_0x232d31);}return _0x48ed98['format']===_0x4820df(0x103)||_0x48ed98[_0x4820df(0x13e)]===_0x4820df(0xcf)?await handleSDKOutput([{'sql':_0x454454}],_0x48ed98):console[_0x4820df(0xcd)](_0x454454),0x0;}catch(_0x4e66f4){if(_0x4e66f4 instanceof SDKError)return console['error'](_0x4820df(0x148)+_0x4e66f4[_0x4820df(0x10c)]),_0x4e66f4['cause']&&console[_0x4820df(0x14d)](_0x4820df(0xf3)+_0x4e66f4[_0x4820df(0xd0)]),0x1;throw _0x4e66f4;}}async[a37_0x504d81(0xba)](_0x342bd2,_0x125f25){const _0x5e70e6=a37_0x504d81,{options:_0x383fab,tdx:_0x169686}=_0x125f25;let _0x4272dd;try{_0x4272dd=await resolveYamlFilePath(_0x342bd2);}catch(_0x585d68){throw new SDKError(ErrorCode[_0x5e70e6(0x139)],_0x5e70e6(0x130)+_0x585d68[_0x5e70e6(0x10c)]);}_0x383fab[_0x5e70e6(0xc5)]&&console[_0x5e70e6(0x14d)](_0x5e70e6(0xb9)+_0x4272dd[_0x5e70e6(0xd8)]+'/'+_0x4272dd[_0x5e70e6(0xbd)]);const _0x400432=await withSpinner(_0x5e70e6(0xae),()=>_0x169686['segment'][_0x5e70e6(0xe6)](_0x4272dd[_0x5e70e6(0xab)],_0x4272dd[_0x5e70e6(0xd8)],_0x4272dd['segmentName']),{'verbose':_0x383fab[_0x5e70e6(0xc5)]});return _0x400432['data'];}async[a37_0x504d81(0xb4)](_0x18334c,_0x388b78){const _0x395c06=a37_0x504d81,{options:_0x204880,tdx:_0x3f9190}=_0x388b78,_0x48feeb=_0x204880[_0x395c06(0xd8)],_0x24e7aa=await resolveSegmentTarget(_0x18334c,_0x48feeb,_0x204880['verbose']);_0x204880[_0x395c06(0xc5)]&&console[_0x395c06(0x14d)](_0x395c06(0xb2)+_0x24e7aa);const _0x11b777=await withSpinner(_0x395c06(0xd3)+_0x18334c+_0x395c06(0xf8),()=>_0x3f9190[_0x395c06(0xbe)][_0x395c06(0x116)](_0x24e7aa),{'verbose':_0x204880[_0x395c06(0xc5)]}),_0xc1ee93=_0x11b777[_0x395c06(0x123)];_0x204880['verbose']&&(console[_0x395c06(0x14d)](_0x395c06(0x10a)+_0xc1ee93[_0x395c06(0xf0)]),console[_0x395c06(0x14d)](_0x395c06(0xea)+_0xc1ee93[_0x395c06(0xd1)]));if(_0xc1ee93[_0x395c06(0xf0)]===_0x395c06(0xe2))throw new SDKError(ErrorCode[_0x395c06(0x139)],_0x395c06(0xaa));if(_0xc1ee93[_0x395c06(0xf0)]===_0x395c06(0xde))throw new SDKError(ErrorCode[_0x395c06(0x139)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0xc1ee93[_0x395c06(0x114)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x395c06(0xc1));const _0x22f3b1=await withSpinner(_0x395c06(0xe3),()=>_0x3f9190[_0x395c06(0xbe)][_0x395c06(0xe9)](_0xc1ee93['parentId'],_0xc1ee93[_0x395c06(0x114)]),{'verbose':_0x204880['verbose']});return _0x22f3b1[_0x395c06(0x123)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';['description']=a37_0x504d81(0x126);async[a37_0x504d81(0x134)](_0x542c01){const _0xe4b3b2=a37_0x504d81,{options:_0x1f01be,args:_0x5a8779,tdx:_0x412384}=_0x542c01,_0x34f0d4=_0x1f01be;if(_0x5a8779['length']<0x2)return console[_0xe4b3b2(0x14d)](_0xe4b3b2(0xc4)),console['error'](_0xe4b3b2(0x124)),0x1;const _0x1318e6=_0x5a8779[0x0],_0x49bced=_0x5a8779[0x1];_0x34f0d4[_0xe4b3b2(0xc5)]&&(console['error'](_0xe4b3b2(0x112)+_0x34f0d4[_0xe4b3b2(0x128)]),console['error'](_0xe4b3b2(0x13d)+_0x1318e6),console[_0xe4b3b2(0x14d)](_0xe4b3b2(0x137)+_0x49bced));let _0x599828;if(_0x34f0d4[_0xe4b3b2(0xb5)]){const _0x113953=_0x34f0d4['parentFolder'],_0x3cd220=await withSpinner(_0xe4b3b2(0x12e)+_0x1318e6+_0xe4b3b2(0xf8),()=>_0x412384['segment'][_0xe4b3b2(0xc6)](_0x1318e6),{'verbose':_0x34f0d4[_0xe4b3b2(0xc5)]}),_0x2b0995=_0x3cd220[_0xe4b3b2(0x123)],_0xc046d0=await withSpinner(_0xe4b3b2(0x14c)+_0x113953+_0xe4b3b2(0xf8),()=>_0x412384[_0xe4b3b2(0xbe)][_0xe4b3b2(0xa8)](_0x2b0995,_0x113953),{'verbose':_0x34f0d4['verbose']});_0x599828=_0xc046d0[_0xe4b3b2(0x123)],_0x34f0d4[_0xe4b3b2(0xc5)]&&console['error'](_0xe4b3b2(0x14b)+_0x599828);}const _0xa1d4fb={'name':_0x49bced,'description':_0x34f0d4[_0xe4b3b2(0x149)],'parentFolderId':_0x599828},_0x55cc52=await withSpinner('Creating\x20folder\x20\x27'+_0x49bced+_0xe4b3b2(0xf8),()=>_0x412384[_0xe4b3b2(0xbe)]['createFolder'](_0x1318e6,_0xa1d4fb),{'verbose':_0x34f0d4['verbose']}),_0x2990d0=_0x55cc52[_0xe4b3b2(0x123)];return console[_0xe4b3b2(0x14d)]('✔\x20Created\x20folder\x20\x27'+_0x2990d0[_0xe4b3b2(0xfb)]+_0xe4b3b2(0x102)+_0x2990d0['id']),await handleSDKOutput([_0x2990d0],_0x34f0d4),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x504d81(0x115);['description']=a37_0x504d81(0x129);async[a37_0x504d81(0x134)](_0x2c24d5){const _0x225a09=a37_0x504d81,{options:_0x5005c3,args:_0x4ce782,tdx:_0x50c0ac}=_0x2c24d5,_0x58118f=_0x4ce782[0x0];if(!_0x58118f)return console[_0x225a09(0x14d)](_0x225a09(0xd2)),console[_0x225a09(0x14d)](_0x225a09(0xbf)),console['error'](_0x225a09(0x12d)),console[_0x225a09(0x14d)]('Options:'),console[_0x225a09(0x14d)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x225a09(0x14d)]('Examples:'),console['error'](_0x225a09(0x140)),console[_0x225a09(0x14d)](_0x225a09(0x113)),console[_0x225a09(0x14d)](_0x225a09(0xbc)),console[_0x225a09(0x14d)](_0x225a09(0x121)),0x1;try{const _0x3399da=_0x5005c3[_0x225a09(0xd8)],_0x346b60=await resolveSegmentTarget(_0x58118f,_0x3399da,_0x5005c3['verbose']);_0x5005c3[_0x225a09(0xc5)]&&console['error'](_0x225a09(0xb2)+_0x346b60);const _0x2c6e14=await withSpinner(_0x225a09(0xd3)+_0x58118f+_0x225a09(0xf8),()=>_0x50c0ac['segment'][_0x225a09(0x116)](_0x346b60),{'verbose':_0x5005c3[_0x225a09(0xc5)]}),_0xb95b42=_0x2c6e14[_0x225a09(0x123)];_0x5005c3[_0x225a09(0xc5)]&&(console['error']('Resolved\x20type:\x20'+_0xb95b42['type']),console[_0x225a09(0x14d)](_0x225a09(0xea)+_0xb95b42[_0x225a09(0xd1)]),_0xb95b42[_0x225a09(0x105)]&&console[_0x225a09(0x14d)](_0x225a09(0xf7)+_0xb95b42[_0x225a09(0x105)]),_0xb95b42[_0x225a09(0x114)]&&console[_0x225a09(0x14d)](_0x225a09(0xb6)+_0xb95b42['segmentId']));if(_0x5005c3[_0x225a09(0x10d)]){if(_0xb95b42[_0x225a09(0xf0)]==='folder')return console[_0x225a09(0x14d)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xb95b42['type']===_0x225a09(0xde))return console[_0x225a09(0x14d)](_0x225a09(0xf4)),console[_0x225a09(0x14d)](_0x225a09(0xc8)),0x1;if(!_0xb95b42[_0x225a09(0x114)])throw new SDKError(ErrorCode[_0x225a09(0xef)],_0x225a09(0xc1));const _0x32e3ef=getConsoleNextUrl(_0x5005c3[_0x225a09(0x128)],_0x225a09(0xce)+_0xb95b42[_0x225a09(0xd1)]+_0x225a09(0xff)+_0xb95b42[_0x225a09(0x114)]);return console[_0x225a09(0x14d)](a37_0x565e01[_0x225a09(0xda)]('✔')+_0x225a09(0x145)+a37_0x565e01[_0x225a09(0x12b)](_0x32e3ef)),openBrowser(_0x32e3ef),0x0;}if(_0xb95b42[_0x225a09(0xf0)]===_0x225a09(0xe2)){if(!_0xb95b42['folderId'])throw new SDKError(ErrorCode[_0x225a09(0xb8)],_0x225a09(0x11e));const _0x1203dd=await withSpinner(_0x225a09(0x104),()=>_0x50c0ac[_0x225a09(0xbe)]['getFolder'](_0xb95b42[_0x225a09(0x105)]),{'verbose':_0x5005c3[_0x225a09(0xc5)]});await handleSingleObjectOutput(_0x1203dd[_0x225a09(0x123)],_0x5005c3);}else{if(_0xb95b42[_0x225a09(0xf0)]==='segment'){if(!_0xb95b42['segmentId'])throw new SDKError(ErrorCode[_0x225a09(0xef)],_0x225a09(0xc1));const _0x331261=await withSpinner(_0x225a09(0x131),()=>_0x50c0ac[_0x225a09(0xbe)][_0x225a09(0x133)](_0xb95b42[_0x225a09(0xd1)],_0xb95b42[_0x225a09(0x114)]),{'verbose':_0x5005c3[_0x225a09(0xc5)]}),_0x49d0eb=getConsoleNextUrl(_0x5005c3[_0x225a09(0x128)],'/app/ps/'+_0xb95b42['parentId']+_0x225a09(0xff)+_0xb95b42['segmentId']),_0x560a70=_0x331261['data'];_0x560a70[_0x225a09(0xd6)]=_0x49d0eb,await handleSingleObjectOutput(_0x560a70,_0x5005c3);}else return console[_0x225a09(0x14d)](_0x225a09(0xd7)),console[_0x225a09(0x14d)](_0x225a09(0xdf)),0x1;}return 0x0;}catch(_0x3ee0f8){if(_0x3ee0f8 instanceof SDKError)return console[_0x225a09(0x14d)](_0x225a09(0x148)+_0x3ee0f8[_0x225a09(0x10c)]),_0x3ee0f8[_0x225a09(0xd0)]&&console[_0x225a09(0x14d)](_0x225a09(0xf3)+_0x3ee0f8[_0x225a09(0xd0)]),0x1;throw _0x3ee0f8;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x504d81(0xfb)]=a37_0x504d81(0xc7);[a37_0x504d81(0x149)]=a37_0x504d81(0xb1);async[a37_0x504d81(0x134)](_0x573ae8){const _0x17da0f=a37_0x504d81,{options:_0x788588,args:_0x557dd0,tdx:_0x3b5931}=_0x573ae8,_0x203cca=_0x557dd0[0x0];if(!_0x203cca)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x17da0f(0x14d)](_0x17da0f(0xf5)),console[_0x17da0f(0x14d)](_0x17da0f(0x125)),console[_0x17da0f(0x14d)](_0x17da0f(0xe8)),console[_0x17da0f(0x14d)](_0x17da0f(0xfe)),console[_0x17da0f(0x14d)](_0x17da0f(0x13a)),0x1;try{const _0x120341=_0x788588['parentSegment'],_0x86d01f=await resolveSegmentTarget(_0x203cca,_0x120341,_0x788588['verbose']);_0x788588[_0x17da0f(0xc5)]&&console[_0x17da0f(0x14d)](_0x17da0f(0xb2)+_0x86d01f);const _0x343ea5=await withSpinner(_0x17da0f(0xd3)+_0x203cca+_0x17da0f(0xf8),()=>_0x3b5931[_0x17da0f(0xbe)]['resolvePathToResource'](_0x86d01f),{'verbose':_0x788588[_0x17da0f(0xc5)]}),_0xb0253d=_0x343ea5[_0x17da0f(0x123)];_0x788588[_0x17da0f(0xc5)]&&(console[_0x17da0f(0x14d)](_0x17da0f(0x10a)+_0xb0253d['type']),console[_0x17da0f(0x14d)](_0x17da0f(0xea)+_0xb0253d['parentId']));if(_0xb0253d['type']===_0x17da0f(0xe2))return console[_0x17da0f(0x14d)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xb0253d[_0x17da0f(0xf0)]==='parent')return console[_0x17da0f(0x14d)](_0x17da0f(0x11b)),console[_0x17da0f(0x14d)](_0x17da0f(0x143)),0x1;if(!_0xb0253d['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x13058e=await withSpinner(_0x17da0f(0xe3),()=>_0x3b5931[_0x17da0f(0xbe)]['getSegmentSQL'](_0xb0253d[_0x17da0f(0xd1)],_0xb0253d[_0x17da0f(0x114)]),{'verbose':_0x788588[_0x17da0f(0xc5)]}),_0x55531e=_0x13058e[_0x17da0f(0x123)],_0xce2cdb=await executeSchemaQuery(_0x55531e,_0x3b5931,_0x788588);return await handleQueryOutput(_0xce2cdb,_0x788588),0x0;}catch(_0x15b019){if(_0x15b019 instanceof SDKError)return console[_0x17da0f(0x14d)]('Error:\x20'+_0x15b019[_0x17da0f(0x10c)]),_0x15b019[_0x17da0f(0xd0)]&&console['error'](_0x17da0f(0xf3)+_0x15b019[_0x17da0f(0xd0)]),0x1;throw _0x15b019;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x590f74=a38_0x209b;(function(_0x3bfc7c,_0xf407ca){const _0x5cb430=a38_0x209b,_0x12fa2a=_0x3bfc7c();while(!![]){try{const _0x184e66=parseInt(_0x5cb430(0x1f6))/0x1*(parseInt(_0x5cb430(0x1e0))/0x2)+parseInt(_0x5cb430(0x20d))/0x3+parseInt(_0x5cb430(0x216))/0x4*(-parseInt(_0x5cb430(0x1ee))/0x5)+parseInt(_0x5cb430(0x1e9))/0x6*(parseInt(_0x5cb430(0x1f2))/0x7)+parseInt(_0x5cb430(0x212))/0x8+-parseInt(_0x5cb430(0x213))/0x9*(-parseInt(_0x5cb430(0x1f7))/0xa)+parseInt(_0x5cb430(0x1f8))/0xb*(-parseInt(_0x5cb430(0x1eb))/0xc);if(_0x184e66===_0xf407ca)break;else _0x12fa2a['push'](_0x12fa2a['shift']());}catch(_0x483282){_0x12fa2a['push'](_0x12fa2a['shift']());}}}(a38_0x5c32,0xba973));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x5c32(){const _0x136928=['resolvePathToResource','6RRGKTX','createSegment','132VwPjmx','verbose','Target\x20path:\x20','3273055aEKFSR','Resolving\x20folder\x20path\x20\x27','rule','folderId','8961764twGXCf','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','resolveParentId','\x20\x20\x20Path:\x20','14503vplczG','199530CQGFZD','2235981xoyZut','execute','folder','invisible','Resolving\x20folder\x20\x27','type','kind','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','noCountPopulation','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','parent','\x27...','data','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','length','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','ruleFile','Site:\x20','name','2688507tKKjkk','Parent\x20path:\x20','Creating\x20segment\x20\x27','includes','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','9711344zeZkMS','9QOomdi','segment:create','\x27\x20with\x20ID:\x20','8GenbPm','124yNolZP','Create\x20child\x20segment\x20with\x20filtering\x20rules','✔\x20Created\x20segment\x20\x27','segments','error','Segment\x20name:\x20','description','yellow'];a38_0x5c32=function(){return _0x136928;};return a38_0x5c32();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0xcd4127 from'chalk';function a38_0x209b(_0x58b2ac,_0x363324){_0x58b2ac=_0x58b2ac-0x1e0;const _0x5c32d8=a38_0x5c32();let _0x209ba7=_0x5c32d8[_0x58b2ac];return _0x209ba7;}export class SegmentCreateCommand extends BaseCommand{[a38_0x590f74(0x20c)]=a38_0x590f74(0x214);[a38_0x590f74(0x1e6)]=a38_0x590f74(0x1e1);async[a38_0x590f74(0x1f9)](_0x104e6a){const _0x45d07b=a38_0x590f74;console[_0x45d07b(0x1e4)](a38_0xcd4127[_0x45d07b(0x1e7)](_0x45d07b(0x200))),console['error'](a38_0xcd4127[_0x45d07b(0x1e7)](_0x45d07b(0x211)));const {options:_0x1714f0,args:_0x517d78,tdx:_0x2a3286}=_0x104e6a,_0x52b818=_0x1714f0;if(_0x517d78[_0x45d07b(0x208)]===0x0)return console[_0x45d07b(0x1e4)](_0x45d07b(0x1ff)),console[_0x45d07b(0x1e4)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x45d07b(0x1e4)]('Examples:'),console[_0x45d07b(0x1e4)](_0x45d07b(0x202)),console[_0x45d07b(0x1e4)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x45d07b(0x1e4)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x4480b2=_0x517d78[0x0],_0x398d7b=_0x1714f0['segmentPath'];let _0x450ecf=_0x4480b2;_0x398d7b&&!_0x4480b2[_0x45d07b(0x210)]('/')&&(_0x450ecf=_0x398d7b+'/'+_0x4480b2,_0x52b818['verbose']&&console[_0x45d07b(0x1e4)]('Resolved\x20relative\x20path\x20to:\x20'+_0x450ecf));const _0x6bb335=parsePath(_0x450ecf);if(_0x6bb335[_0x45d07b(0x1e3)][_0x45d07b(0x208)]<0x2)return console[_0x45d07b(0x1e4)](_0x45d07b(0x207)),console['error'](_0x45d07b(0x209)),0x1;const _0x228dec=_0x6bb335['segments'][0x0],_0x145ab1=getBaseName(_0x450ecf),_0x3e49ac=getParentPath(_0x450ecf);_0x52b818['verbose']&&(console['error'](_0x45d07b(0x20b)+_0x52b818['site']),console[_0x45d07b(0x1e4)](_0x45d07b(0x1ed)+_0x450ecf),console[_0x45d07b(0x1e4)]('Parent:\x20'+_0x228dec),console[_0x45d07b(0x1e4)](_0x45d07b(0x1e5)+_0x145ab1),console[_0x45d07b(0x1e4)](_0x45d07b(0x20e)+_0x3e49ac));const _0x189da9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x228dec+_0x45d07b(0x205),()=>_0x2a3286[_0x45d07b(0x203)][_0x45d07b(0x1f4)](_0x228dec),{'verbose':_0x52b818[_0x45d07b(0x1ec)]}),_0x2b8d83=_0x189da9[_0x45d07b(0x206)];let _0x1d8b52;if(_0x6bb335[_0x45d07b(0x1e3)][_0x45d07b(0x208)]>0x2){const _0x1428c1=await withSpinner(_0x45d07b(0x1ef)+_0x3e49ac+'\x27...',()=>_0x2a3286[_0x45d07b(0x203)][_0x45d07b(0x1e8)](_0x3e49ac),{'verbose':_0x52b818[_0x45d07b(0x1ec)]}),_0x49fd5e=_0x1428c1[_0x45d07b(0x206)];if(_0x49fd5e[_0x45d07b(0x1fd)]!==_0x45d07b(0x1fa)&&_0x49fd5e[_0x45d07b(0x1fd)]!==_0x45d07b(0x204))return console[_0x45d07b(0x1e4)](_0x45d07b(0x1f3)),0x1;_0x1d8b52=_0x49fd5e[_0x45d07b(0x1f1)];}else{if(_0x52b818[_0x45d07b(0x1fa)]){const _0x5a9e4f=await withSpinner(_0x45d07b(0x1fc)+_0x52b818[_0x45d07b(0x1fa)]+_0x45d07b(0x205),()=>_0x2a3286[_0x45d07b(0x203)]['resolveFolderId'](_0x2b8d83,_0x52b818[_0x45d07b(0x1fa)]),{'verbose':_0x52b818['verbose']});_0x1d8b52=_0x5a9e4f[_0x45d07b(0x206)];}}_0x52b818['verbose']&&_0x1d8b52&&console[_0x45d07b(0x1e4)]('Resolved\x20folder\x20ID:\x20'+_0x1d8b52);const _0x244f1a=await loadJSONFromOptions(_0x52b818[_0x45d07b(0x1f0)],_0x52b818[_0x45d07b(0x20a)]),_0x3323c4={'name':_0x145ab1,'description':_0x52b818[_0x45d07b(0x1e6)],'rule':_0x244f1a,'kind':_0x52b818[_0x45d07b(0x1fe)]!==undefined?parseInt(_0x52b818[_0x45d07b(0x1fe)],0xa):undefined,'isVisible':_0x52b818[_0x45d07b(0x1fb)]?![]:undefined,'segmentFolderId':_0x1d8b52,'countPopulation':_0x52b818[_0x45d07b(0x201)]?![]:undefined},_0x3b330a=await withSpinner(_0x45d07b(0x20f)+_0x145ab1+_0x45d07b(0x205),()=>_0x2a3286['segment'][_0x45d07b(0x1ea)](_0x2b8d83,_0x3323c4),{'verbose':_0x52b818['verbose']}),_0x37e96a=_0x3b330a[_0x45d07b(0x206)];return console['error'](_0x45d07b(0x1e2)+_0x37e96a['name']+_0x45d07b(0x215)+_0x37e96a['id']),_0x450ecf!==_0x4480b2&&console['error'](_0x45d07b(0x1f5)+_0x450ecf),await handleSDKOutput([_0x37e96a],_0x52b818),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x212cd8=a39_0x20f7;function a39_0x20f7(_0x3aaa06,_0x1add1b){_0x3aaa06=_0x3aaa06-0x81;const _0x2e9d29=a39_0x2e9d();let _0x20f736=_0x2e9d29[_0x3aaa06];return _0x20f736;}(function(_0x1db9ca,_0x375453){const _0x5c7000=a39_0x20f7,_0x3011af=_0x1db9ca();while(!![]){try{const _0x1535bc=-parseInt(_0x5c7000(0x82))/0x1+-parseInt(_0x5c7000(0x83))/0x2*(-parseInt(_0x5c7000(0x8e))/0x3)+parseInt(_0x5c7000(0x8a))/0x4+parseInt(_0x5c7000(0x92))/0x5*(parseInt(_0x5c7000(0x9b))/0x6)+-parseInt(_0x5c7000(0x9a))/0x7+parseInt(_0x5c7000(0x94))/0x8*(-parseInt(_0x5c7000(0x85))/0x9)+-parseInt(_0x5c7000(0x89))/0xa;if(_0x1535bc===_0x375453)break;else _0x3011af['push'](_0x3011af['shift']());}catch(_0x1392ff){_0x3011af['push'](_0x3011af['shift']());}}}(a39_0x2e9d,0x50c6e));function a39_0x2e9d(){const _0x528b0f=['\x27...','11428iqxJWt','41606YsnsSj','✔\x20Found\x20','9afALmg','jsonl','length','description','4004450ThfFVM','2644980ViBDxC','segment:fields','Parent\x20segment:\x20','segment','33VWFgJJ','data','parentSegment','name','25RaEyAw','verbose','1681904KbbuMf','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Listing\x20fields\x20for\x20\x27','Site:\x20','error','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','2356130qEWXsi','479382LldCBO','\x20field'];a39_0x2e9d=function(){return _0x528b0f;};return a39_0x2e9d();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x212cd8(0x91)]=a39_0x212cd8(0x8b);[a39_0x212cd8(0x88)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x110539){const _0x412f77=a39_0x212cd8,{options:_0x37cda3,args:_0x1d423c,tdx:_0x4c014a}=_0x110539,_0x523aff=_0x1d423c[0x0]||_0x37cda3[_0x412f77(0x90)];if(!_0x523aff)return console[_0x412f77(0x98)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error'](_0x412f77(0x99)),console[_0x412f77(0x98)](_0x412f77(0x95)),0x1;_0x37cda3['verbose']&&(console[_0x412f77(0x98)](_0x412f77(0x97)+_0x37cda3['site']),console['error'](_0x412f77(0x8c)+_0x523aff));const _0x446adb=await withSpinner(_0x412f77(0x96)+_0x523aff+_0x412f77(0x81),()=>_0x4c014a[_0x412f77(0x8d)]['listFields'](_0x523aff),{'verbose':_0x37cda3[_0x412f77(0x93)]}),_0x50655d=_0x446adb[_0x412f77(0x8f)];console[_0x412f77(0x98)](_0x412f77(0x84)+_0x50655d[_0x412f77(0x87)]+_0x412f77(0x9c)+(_0x50655d['length']!==0x1?'s':''));if(_0x37cda3['json']||_0x37cda3[_0x412f77(0x86)])return await handleSDKOutput(_0x50655d,_0x37cda3),0x0;return displayFieldsHumanReadable(_0x50655d,_0x523aff),0x0;}}
|