@treasuredata/tdx 2026.3.52 → 2026.3.54
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.d.ts.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +2 -0
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/index.js.map +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.d.ts +50 -0
- package/dist/mcp/tools/work-create-item.d.ts.map +1 -0
- package/dist/mcp/tools/work-create-item.js +1 -0
- package/dist/mcp/tools/work-create-item.js.map +1 -0
- 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.d.ts +15 -0
- package/dist/sdk/types/workspace.d.ts.map +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.d.ts +14 -2
- package/dist/sdk/workspace/index.d.ts.map +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/index.js.map +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a32_0x10d1(){const _0x1206f6=['423477YJTEQO','1454409JYqnBM','Fetching\x20permissions...','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20\x20','execute','max','\x20—\x20','name','Administrator','description','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','join','data','dim','Member','verbose','account_owner','78klWolw','listPolicies','policy','Listing\x20policies...','getCurrent','permissions','8jbsKnv','length','getPolicyUsers','\x20polic','\x20user','context','administrator','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','operation','211015OulaET','email','bold','error','\x20assigned','444jIyCmK','map','📋\x20Assigned\x20Policies','entries','223270klPkoA','ies','log','policy\x20show','(ID:\x20','2653eSItFq','\x20\x20No\x20permissions','1306018iKHHar','✔\x20Found\x20','👥\x20Assigned\x20Users',',\x20user_id:','all','validate','getPolicy','policies','953504GRZiAx','args','33WrVPuu','Account\x20Owner'];a32_0x10d1=function(){return _0x1206f6;};return a32_0x10d1();}const a32_0x2a1f42=a32_0x346f;function a32_0x346f(_0x233471,_0x357291){_0x233471=_0x233471-0x6d;const _0x10d1b4=a32_0x10d1();let _0x346ff2=_0x10d1b4[_0x233471];return _0x346ff2;}(function(_0x28698c,_0x33627b){const _0x9e6c5b=a32_0x346f,_0x1d9bce=_0x28698c();while(!![]){try{const _0x42215f=parseInt(_0x9e6c5b(0xa7))/0x1*(-parseInt(_0x9e6c5b(0x9e))/0x2)+parseInt(_0x9e6c5b(0x77))/0x3+parseInt(_0x9e6c5b(0x73))/0x4+parseInt(_0x9e6c5b(0x99))/0x5*(parseInt(_0x9e6c5b(0x89))/0x6)+-parseInt(_0x9e6c5b(0xa9))/0x7*(-parseInt(_0x9e6c5b(0x8f))/0x8)+-parseInt(_0x9e6c5b(0x78))/0x9+parseInt(_0x9e6c5b(0xa2))/0xa*(-parseInt(_0x9e6c5b(0x75))/0xb);if(_0x42215f===_0x33627b)break;else _0x1d9bce['push'](_0x1d9bce['shift']());}catch(_0x17b4f5){_0x1d9bce['push'](_0x1d9bce['shift']());}}}(a32_0x10d1,0x488f0));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x29d516 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x2a1f42(0x8b);[a32_0x2a1f42(0x81)]=a32_0x2a1f42(0x82);async[a32_0x2a1f42(0x7c)](_0x3d7c07){const _0x3e2488=a32_0x2a1f42,{options:_0x57b8d4,tdx:_0x1b514c}=_0x3d7c07,_0x1f91b3=await withSpinner(_0x3e2488(0x79),async()=>{const _0xf5d964=_0x3e2488,[_0x37241c,_0x1a98f1]=await Promise[_0xf5d964(0x6f)]([_0x1b514c['user'][_0xf5d964(0x8d)](),_0x1b514c['policy']['getMyPermissions']()]);return{'userInfo':_0x37241c,'permissions':_0x1a98f1};},{'verbose':_0x57b8d4[_0x3e2488(0x87)]}),{userInfo:_0x400e48,permissions:_0xa49737}=_0x1f91b3[_0x3e2488(0x84)];if(isStructuredFormat(_0x57b8d4))return await handleSingleObjectOutput(_0xa49737,_0x57b8d4),0x0;const _0x462322=_0x400e48[_0x3e2488(0x88)]?_0x3e2488(0x76):_0x400e48[_0x3e2488(0x95)]?_0x3e2488(0x80):_0x3e2488(0x86);console[_0x3e2488(0xa4)]('\x0a'+a32_0x29d516[_0x3e2488(0x9b)]('👤')+'\x20'+a32_0x29d516['bold'](_0x400e48[_0x3e2488(0x7f)])+'\x20'+a32_0x29d516[_0x3e2488(0x85)]('('+_0x400e48[_0x3e2488(0x9a)]+')')+'\x20—\x20'+_0x462322),console[_0x3e2488(0xa4)](a32_0x29d516['dim'](_0x3e2488(0x7b)+_0x1b514c[_0x3e2488(0x94)]['site']+':'+_0x400e48['account_id']+_0x3e2488(0x6e)+_0x400e48['id']));const _0x20c2ca=_0xa49737[_0x3e2488(0x72)];console[_0x3e2488(0xa4)]('\x0a'+a32_0x29d516['bold'](_0x3e2488(0xa0))+'\x20('+_0x20c2ca[_0x3e2488(0x90)]+'):');if(_0x20c2ca['length']===0x0)console[_0x3e2488(0xa4)](a32_0x29d516[_0x3e2488(0x85)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x15101e of _0x20c2ca){console[_0x3e2488(0xa4)]('\x20\x20•\x20'+_0x15101e['name']);}return printPermissionsMap(_0xa49737[_0x3e2488(0x8e)]),console[_0x3e2488(0xa4)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x2a1f42(0x7f)]='policy\x20list';['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x2a1f42(0x7c)](_0x34cb8a){const _0x69f24a=a32_0x2a1f42,{options:_0x1fdc80,tdx:_0xa3ee40}=_0x34cb8a,_0x4dc049=await withSpinner(_0x69f24a(0x8c),()=>_0xa3ee40[_0x69f24a(0x8b)][_0x69f24a(0x8a)](),{'verbose':_0x1fdc80[_0x69f24a(0x87)]}),_0x42bb05=_0x4dc049[_0x69f24a(0x84)];console[_0x69f24a(0x9c)](_0x69f24a(0xaa)+_0x42bb05[_0x69f24a(0x90)]+_0x69f24a(0x92)+(_0x42bb05[_0x69f24a(0x90)]!==0x1?_0x69f24a(0xa3):'y'));if(isStructuredFormat(_0x1fdc80))return await handleSDKOutput(_0x42bb05,_0x1fdc80),0x0;if(_0x42bb05[_0x69f24a(0x90)]===0x0)console[_0x69f24a(0xa4)](a32_0x29d516['dim']('No\x20policies\x20found'));else for(const _0x208874 of _0x42bb05){const _0x178cc8=_0x208874[_0x69f24a(0x81)]?a32_0x29d516[_0x69f24a(0x85)](_0x69f24a(0x7e)+_0x208874[_0x69f24a(0x81)]):'';console['log'](_0x69f24a(0x97)+_0x208874[_0x69f24a(0x7f)]+_0x178cc8);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x2a1f42(0x7f)]=a32_0x2a1f42(0xa5);['description']=a32_0x2a1f42(0x7a);[a32_0x2a1f42(0x70)](_0x285154){const _0x2edad7=a32_0x2a1f42;if(_0x285154[_0x2edad7(0x74)]['length']===0x0)return _0x2edad7(0x96);return undefined;}async['execute'](_0x1f7cf2){const _0x4eea31=a32_0x2a1f42,{options:_0x30921a,tdx:_0x151919}=_0x1f7cf2,_0x1c007e=_0x1f7cf2[_0x4eea31(0x74)][0x0],_0x4494b3=await withSpinner('Fetching\x20policy...',async()=>{const _0x1ab1dd=_0x4eea31,_0x14c14e=await _0x151919['policy'][_0x1ab1dd(0x71)](_0x1c007e),[_0x1c7979,_0x3840ec]=await Promise[_0x1ab1dd(0x6f)]([_0x151919[_0x1ab1dd(0x8b)]['getPolicyPermissions'](_0x14c14e['id']),_0x151919[_0x1ab1dd(0x8b)][_0x1ab1dd(0x91)](_0x14c14e['id'])]);return{'policy':_0x14c14e,'perms':_0x1c7979,'users':_0x3840ec};},{'verbose':_0x30921a['verbose']}),{policy:_0x348e4a,perms:_0x338ec9,users:_0xdbf816}=_0x4494b3[_0x4eea31(0x84)];if(isStructuredFormat(_0x30921a))return await handleSingleObjectOutput({..._0x348e4a,'permissions':_0x338ec9['permissions'],'users':_0xdbf816},_0x30921a),0x0;console['log']('\x0a'+a32_0x29d516[_0x4eea31(0x9b)]('📋')+'\x20'+a32_0x29d516[_0x4eea31(0x9b)](_0x348e4a['name'])+'\x20'+a32_0x29d516[_0x4eea31(0x85)](_0x4eea31(0xa6)+_0x348e4a['id']+')'));_0x348e4a[_0x4eea31(0x81)]&&console[_0x4eea31(0xa4)](_0x4eea31(0x7b)+a32_0x29d516[_0x4eea31(0x85)](_0x348e4a[_0x4eea31(0x81)]));console[_0x4eea31(0xa4)]('\x20\x20\x20'+_0xdbf816[_0x4eea31(0x90)]+_0x4eea31(0x93)+(_0xdbf816['length']!==0x1?'s':'')+_0x4eea31(0x9d)),printPermissionsMap(_0x338ec9[_0x4eea31(0x8e)]);if(_0xdbf816[_0x4eea31(0x90)]>0x0){console[_0x4eea31(0xa4)]('\x0a'+a32_0x29d516['bold'](_0x4eea31(0x6d))+':');for(const _0x39b835 of _0xdbf816){const _0x21498b=_0x39b835[_0x4eea31(0x9a)]&&_0x39b835['email']!==_0x39b835[_0x4eea31(0x7f)]?a32_0x29d516[_0x4eea31(0x85)]('\x20<'+_0x39b835[_0x4eea31(0x9a)]+'>'):'';console['log'](_0x4eea31(0x97)+_0x39b835[_0x4eea31(0x7f)]+_0x21498b);}}return console[_0x4eea31(0xa4)](),0x0;}}function printPermissionsMap(_0x2f8132){const _0x1cece1=a32_0x2a1f42,_0xdbd71e=Object[_0x1cece1(0xa1)](_0x2f8132);console[_0x1cece1(0xa4)]('\x0a'+a32_0x29d516[_0x1cece1(0x9b)]('🔑\x20Effective\x20Permissions')+':');if(_0xdbd71e['length']===0x0){console[_0x1cece1(0xa4)](a32_0x29d516['dim'](_0x1cece1(0xa8)));return;}const _0x10565d=Math[_0x1cece1(0x7d)](..._0xdbd71e[_0x1cece1(0x9f)](([_0x2e698c])=>_0x2e698c[_0x1cece1(0x90)]));for(const [_0x58601d,_0xf3af58]of _0xdbd71e){const _0x520779=formatOperations(_0xf3af58);console[_0x1cece1(0xa4)]('\x20\x20'+_0x58601d['padEnd'](_0x10565d+0x2)+_0x520779);}}function formatOperations(_0x4c6312){const _0x385050=a32_0x2a1f42,_0x39b091=[...new Set(_0x4c6312[_0x385050(0x9f)](_0x460deb=>_0x460deb[_0x385050(0x98)]))];return _0x39b091[_0x385050(0x83)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x301160=a33_0x42be;(function(_0x128c8f,_0x471bb6){const _0x46bf9f=a33_0x42be,_0x51ec53=_0x128c8f();while(!![]){try{const _0x50b6ac=parseInt(_0x46bf9f(0x1db))/0x1+parseInt(_0x46bf9f(0x197))/0x2+parseInt(_0x46bf9f(0x1f6))/0x3+-parseInt(_0x46bf9f(0x1e8))/0x4*(-parseInt(_0x46bf9f(0x198))/0x5)+parseInt(_0x46bf9f(0x205))/0x6*(parseInt(_0x46bf9f(0x195))/0x7)+parseInt(_0x46bf9f(0x1c0))/0x8*(parseInt(_0x46bf9f(0x1d6))/0x9)+parseInt(_0x46bf9f(0x1a5))/0xa*(-parseInt(_0x46bf9f(0x1e4))/0xb);if(_0x50b6ac===_0x471bb6)break;else _0x51ec53['push'](_0x51ec53['shift']());}catch(_0x23f098){_0x51ec53['push'](_0x51ec53['shift']());}}}(a33_0xe687,0xc91e8));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x42be(_0x3d2456,_0x5c06dc){_0x3d2456=_0x3d2456-0x195;const _0xe68783=a33_0xe687();let _0x42bed3=_0xe68783[_0x3d2456];return _0x42bed3;}import*as a33_0x4cf3ae from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a33_0xe687(){const _0x276508=['\x20--default\x27\x20to\x20save\x20permanently','oauth','profile:delete','Site\x20was\x20not\x20changed.','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','4445127DBzvxx','create','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','llm_agent','tdx:\x20profile\x20create','338395hzkMYj','database','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','Set\x20session\x20profile','getUserInfo','test','Removed\x20existing\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','1045DIhdTO','yellow','\x27\x20deleted','trim','2356jKNiMS','join','(session:\x20','Default\x20profile\x20set\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','logLevel','profile:use','password','Setup\x20cancelled','4433796DIhELf','tdx:\x20profile\x20delete','\x20\x20-\x20','default','\x0aAvailable\x20profiles:','\x27\x20updated:\x20','(cleared)','length','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','warn','email','profile','includes','✗\x20Validation\x20failed:\x20','1419366MHeSyw','14KSwayK','validate','1617426eBLJAL','12755pfxUun','Profile\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','green','ERROR','red','\x20\x20tdx\x20--profile\x20','VALID_KEYS','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','session','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.\x20Create\x20it?','449560vAtCcE','text','llm_project','profile:set','\x20API\x20key\x20is\x20valid\x20(User:\x20','/app/mp/ak','message','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSaved\x20to:\x20','bold','all','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Unknown\x20key\x20\x27','Enter\x20profile\x20name:','site','tdx:\x20profile\x20set','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:create','jobs','confirm','\x20Profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aOperation\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aSetup\x20cancelled','8nnyYtQ','error','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','apiKey','Changing\x20site\x20to\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','\x27\x20does\x20not\x20exist.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','split','Set\x20a\x20profile\x20configuration\x20value','profileName','Validating\x20API\x20key...','name','\x27\x20created','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]'];a33_0xe687=function(){return _0x276508;};return a33_0xe687();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x21c6c5 from'prompts';import a33_0x58fcc0 from'chalk';function validateProfileName(_0x4e1c4b,_0x19e69c){const _0xb2475d=a33_0x42be;if(!_0x4e1c4b||!_0x4e1c4b[_0xb2475d(0x1e7)]())return _0xb2475d(0x1a3);const _0x1050ea=_0x4e1c4b[_0xb2475d(0x1e7)]();if(!/^[a-zA-Z0-9_-]+$/[_0xb2475d(0x1e1)](_0x1050ea))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x19e69c?.['skipExistsCheck']&&profileExists(_0x1050ea))return _0xb2475d(0x199)+_0x1050ea+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1050ea+_0xb2475d(0x1d8);return!![];}async function deleteProfileAndCredentials(_0x342bce){const _0x17427a=a33_0x42be;removeProfileFromUserConfig(_0x342bce);const _0x2a2148=await isKeychainAvailable();_0x2a2148&&await Promise[_0x17427a(0x1af)]([deleteKeychainAPIKey(_0x342bce),deleteOAuthTokens(_0x342bce)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1b7);[a33_0x301160(0x1fe)]=a33_0x301160(0x1de);async[a33_0x301160(0x1ed)](_0x43873e){const _0x333528=a33_0x301160,{options:_0x5260e7,args:_0x6d7971}=_0x43873e,_0x659892=!!_0x5260e7['force'];console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x1ae)](_0x333528(0x1da)));let _0x4a3d8a;if(_0x6d7971[_0x333528(0x1fd)]>0x0&&_0x6d7971[0x0]){const _0x312714=_0x6d7971[0x0][_0x333528(0x1e7)]();_0x659892&&profileExists(_0x312714)&&(await deleteProfileAndCredentials(_0x312714),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x312714+'\x27'));const _0x130186=validateProfileName(_0x312714);if(_0x130186!==!![])return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x130186)),0x1;_0x4a3d8a=_0x312714;}else{const _0x16e1bb=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1cb),'message':_0x333528(0x1b3),'validate':_0x53d8e2=>validateProfileName(_0x53d8e2,{'skipExistsCheck':_0x659892})});if(!_0x16e1bb[_0x333528(0x1cb)])return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;_0x4a3d8a=_0x16e1bb['profileName'][_0x333528(0x1e7)](),_0x659892&&profileExists(_0x4a3d8a)&&(await deleteProfileAndCredentials(_0x4a3d8a),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x4a3d8a+'\x27'));}const _0x3e66c3=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1fe),'message':'Enter\x20description\x20(optional):'}),_0x2f8edd=_0x3e66c3[_0x333528(0x1fe)]?.[_0x333528(0x1e7)]()||undefined,_0xc9c7d9=_0x5260e7[_0x333528(0x1b4)]||'us01',_0x2a7f91=await promptSiteSelection(_0xc9c7d9,_0x4a3d8a,_0x333528(0x1f5));if(!_0x2a7f91)return 0x1;const _0x55f193=resolveSite(_0x2a7f91),_0x462bbb=await promptAuthMethod();if(!_0x462bbb)return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;if(_0x462bbb===_0x333528(0x1d1)){if(_0x2f8edd){const _0x337f2d={'site':_0x55f193,'description':_0x2f8edd};saveProfileToUserConfig(_0x4a3d8a,_0x337f2d);}const {accountName:_0x378859}=_0x5260e7;return await runOAuthLoginFlow(_0x55f193,_0x4a3d8a,_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)],{'accountName':_0x378859}),0x0;}console[_0x333528(0x1a0)](_0x333528(0x19a)+_0x55f193),console['log'](_0x333528(0x1c5)),console[_0x333528(0x1a0)]('\x20\x20'+getConsoleUrl(_0x55f193,_0x333528(0x1aa)));const _0x1c7d60=await a33_0x21c6c5({'type':_0x333528(0x1f4),'name':_0x333528(0x1c3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0xaea545=>{const _0x3ffa73=_0x333528;if(!_0xaea545||!_0xaea545[_0x3ffa73(0x1e7)]())return _0x3ffa73(0x1dd);return!![];}});if(!_0x1c7d60[_0x333528(0x1c3)])return console['log'](_0x333528(0x1bf)),0x1;const _0x1c6010=_0x1c7d60['apiKey'];console[_0x333528(0x1a0)](_0x333528(0x1cc));try{const _0x57663a=TDX['create']({'site':_0x55f193,'apiKey':_0x1c6010[_0x333528(0x1e7)](),'logLevel':_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)]}),_0x4f26bd=await _0x57663a[_0x333528(0x1b8)][_0x333528(0x1e0)]();console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4f26bd[_0x333528(0x201)]+')');const _0x375e9d=await isKeychainAvailable();_0x375e9d?(await saveAPIKeyAsync(_0x1c6010[_0x333528(0x1e7)](),_0x55f193,_0x4a3d8a),console[_0x333528(0x1a0)](a33_0x58fcc0['green']('✓')+_0x333528(0x1b6)+_0x4a3d8a+')')):(console[_0x333528(0x200)](a33_0x58fcc0[_0x333528(0x1e5)](_0x333528(0x1ff))),console[_0x333528(0x200)](a33_0x58fcc0['yellow'](_0x333528(0x1ec))));const _0x233d91={'site':_0x55f193,..._0x2f8edd&&{'description':_0x2f8edd}};return saveProfileToUserConfig(_0x4a3d8a,_0x233d91),console['log'](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x4a3d8a+_0x333528(0x1ce)),console[_0x333528(0x1a0)](),console['log'](_0x333528(0x1c2)),console['log'](_0x333528(0x19e)+_0x4a3d8a+_0x333528(0x1a1)),console[_0x333528(0x1a0)]('\x20\x20tdx\x20--profile\x20'+_0x4a3d8a+_0x333528(0x1d4)),0x0;}catch(_0x26b69e){if(_0x26b69e instanceof HTTPClientError&&_0x26b69e[_0x333528(0x1ef)]===0x191)return printAuthError(_0x26b69e),0x1;return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x333528(0x204)+(_0x26b69e instanceof Error?_0x26b69e[_0x333528(0x1ab)]:String(_0x26b69e)))),console[_0x333528(0x1c1)](_0x333528(0x1ee)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1d2);[a33_0x301160(0x1fe)]='Delete\x20a\x20profile';[a33_0x301160(0x196)](_0x3638a9){const _0x944620=a33_0x301160,{args:_0x4ec25c}=_0x3638a9;if(_0x4ec25c[_0x944620(0x1fd)]===0x0)return _0x944620(0x1b0);return undefined;}async[a33_0x301160(0x1ed)](_0x1f9c28){const _0x2e2b1d=a33_0x301160,{args:_0x36ac7c}=_0x1f9c28,_0x28d7a2=_0x36ac7c[0x0];console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x1ae)](_0x2e2b1d(0x1f7)));if(!profileExists(_0x28d7a2)){console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)](_0x2e2b1d(0x199)+_0x28d7a2+_0x2e2b1d(0x1c7))),console[_0x2e2b1d(0x1a0)](_0x2e2b1d(0x1fa));const _0x12357f=listProfiles();if(_0x12357f[_0x2e2b1d(0x1fd)]===0x0)console[_0x2e2b1d(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x58a66f of _0x12357f){console[_0x2e2b1d(0x1a0)]('\x20\x20-\x20'+_0x58a66f[_0x2e2b1d(0x1cd)]);}return 0x1;}const _0x2f8b51=await a33_0x21c6c5({'type':_0x2e2b1d(0x1b9),'name':'confirm','message':_0x2e2b1d(0x1b1)+_0x28d7a2+'\x27?','initial':![]});if(!_0x2f8b51[_0x2e2b1d(0x1b9)])return console[_0x2e2b1d(0x1a0)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x28d7a2),console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x19b)]('✓')+_0x2e2b1d(0x1ba)+_0x28d7a2+_0x2e2b1d(0x1e6));}catch(_0x51ea14){return console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x51ea14 instanceof Error?_0x51ea14[_0x2e2b1d(0x1ab)]:String(_0x51ea14)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x301160(0x1a8);[a33_0x301160(0x1fe)]=a33_0x301160(0x1ca);static ['VALID_KEYS']=[a33_0x301160(0x1b4),a33_0x301160(0x1dc),'parent_segment',a33_0x301160(0x1a7),a33_0x301160(0x1d9),a33_0x301160(0x1fe)];[a33_0x301160(0x196)](_0x446fa2){const _0x246c0c=a33_0x301160,{args:_0x49cace,options:_0x3b9c72}=_0x446fa2,_0x5ecbfb=_0x3b9c72[_0x246c0c(0x202)]||getActiveProfile();if(!_0x5ecbfb)return _0x246c0c(0x1f1);if(_0x49cace[_0x246c0c(0x1fd)]===0x0)return _0x246c0c(0x1bb)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const _0x2b42f9=_0x49cace[0x0];if(!_0x2b42f9['includes']('='))return _0x246c0c(0x1c8)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const [_0x3af7b9]=_0x2b42f9[_0x246c0c(0x1c9)]('=',0x2);if(!ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x203)](_0x3af7b9))return _0x246c0c(0x1b2)+_0x3af7b9+_0x246c0c(0x1ac)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');return undefined;}async[a33_0x301160(0x1ed)](_0x4f8143){const _0x2687a6=a33_0x301160,{args:_0x36ea3b,options:_0x396141}=_0x4f8143,_0x36ccc0=_0x396141[_0x2687a6(0x202)]||getActiveProfile(),[_0x165080,..._0x3a1649]=_0x36ea3b[0x0][_0x2687a6(0x1c9)]('='),_0x44ee08=_0x3a1649[_0x2687a6(0x1e9)]('=');console[_0x2687a6(0x1a0)](a33_0x58fcc0['bold'](_0x2687a6(0x1b5)));if(!profileExists(_0x36ccc0)){const _0x22d9ac=await a33_0x21c6c5({'type':_0x2687a6(0x1b9),'name':_0x2687a6(0x1d7),'message':_0x2687a6(0x199)+_0x36ccc0+_0x2687a6(0x1a4),'initial':!![]});if(!_0x22d9ac[_0x2687a6(0x1d7)])return console[_0x2687a6(0x1a0)]('Operation\x20cancelled'),0x1;}const _0x2b9797=loadProfile(_0x36ccc0),_0x1ec176=_0x2b9797?.[_0x2687a6(0x1d5)]||{};if(_0x165080==='site'){const _0x36abba=resolveSite(_0x44ee08);console[_0x2687a6(0x1a0)](_0x2687a6(0x1c4)+_0x36abba+_0x2687a6(0x1bc)),console[_0x2687a6(0x1a0)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2687a6(0x1a0)]('\x20\x20'+getConsoleUrl(_0x36abba,_0x2687a6(0x1aa)));const _0x9832b7=await a33_0x21c6c5({'type':_0x2687a6(0x1f4),'name':_0x2687a6(0x1c3),'message':_0x2687a6(0x1e3),'validate':_0x13cfac=>{const _0x514f36=_0x2687a6;if(!_0x13cfac||!_0x13cfac[_0x514f36(0x1e7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x9832b7[_0x2687a6(0x1c3)])return console[_0x2687a6(0x1a0)](_0x2687a6(0x1bd)),0x1;console[_0x2687a6(0x1a0)](_0x2687a6(0x1cc));try{const _0x3d409f=TDX[_0x2687a6(0x1d7)]({'site':_0x36abba,'apiKey':_0x9832b7[_0x2687a6(0x1c3)][_0x2687a6(0x1e7)](),'logLevel':_0x396141['logLevel']??LogLevel[_0x2687a6(0x19c)]}),_0x16cb06=await _0x3d409f[_0x2687a6(0x1b8)]['getUserInfo']();console[_0x2687a6(0x1a0)](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1a9)+_0x16cb06[_0x2687a6(0x201)]+')');const _0x218e7d=await isKeychainAvailable();_0x218e7d?(await saveAPIKeyAsync(_0x9832b7['apiKey'][_0x2687a6(0x1e7)](),_0x36abba,_0x36ccc0),console['log'](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1f0))):console['warn'](a33_0x58fcc0['yellow'](_0x2687a6(0x1ff))),_0x1ec176[_0x2687a6(0x1b4)]=_0x36abba;}catch(_0x176cc6){if(_0x176cc6 instanceof HTTPClientError&&_0x176cc6[_0x2687a6(0x1ef)]===0x191)return printAuthError(_0x176cc6),0x1;return console[_0x2687a6(0x1c1)](a33_0x58fcc0['red'](_0x2687a6(0x204)+(_0x176cc6 instanceof Error?_0x176cc6['message']:String(_0x176cc6)))),console[_0x2687a6(0x1c1)](_0x2687a6(0x1d3)),0x1;}}else _0x1ec176[_0x165080]=_0x44ee08||undefined;return saveProfileToUserConfig(_0x36ccc0,_0x1ec176),console[_0x2687a6(0x1a0)](a33_0x58fcc0[_0x2687a6(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x36ccc0+_0x2687a6(0x1fb)+_0x165080+'='+(_0x44ee08||_0x2687a6(0x1fc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1f3);['description']=a33_0x301160(0x1df);[a33_0x301160(0x196)](_0x3af32f){const _0x59e2c9=a33_0x301160,{args:_0x221681}=_0x3af32f;if(_0x221681[_0x59e2c9(0x1fd)]===0x0)return _0x59e2c9(0x1cf);return undefined;}async[a33_0x301160(0x1ed)](_0x2fad7f){const _0x28de07=a33_0x301160,{args:_0x4cc8f6,options:_0x4b36a1}=_0x2fad7f,_0x354ae5=_0x4cc8f6[0x0],_0x539cd0=_0x4b36a1[_0x28de07(0x1f9)];cleanExpiredSessions();if(!profileExists(_0x354ae5)){console[_0x28de07(0x1c1)](a33_0x58fcc0[_0x28de07(0x19d)](_0x28de07(0x199)+_0x354ae5+_0x28de07(0x1c7))),console[_0x28de07(0x1a0)](_0x28de07(0x1fa));const _0x4c68cc=listProfiles();if(_0x4c68cc[_0x28de07(0x1fd)]===0x0)console[_0x28de07(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3ffe79 of _0x4c68cc){console['log'](_0x28de07(0x1f8)+_0x3ffe79[_0x28de07(0x1cd)]);}return 0x1;}if(_0x539cd0){const _0x2b8509=a33_0x4cf3ae[_0x28de07(0x1e9)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x354ae5),console['log'](_0x28de07(0x1eb)+a33_0x58fcc0['green'](_0x354ae5)),console['log'](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ad)+_0x2b8509)),0x0;}const _0x46f21b=getSessionID(_0x4b36a1[_0x28de07(0x1a2)]);return saveSessionContext({'profile':_0x354ae5},_0x4b36a1['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x58fcc0[_0x28de07(0x19b)](_0x354ae5)+'\x20'+a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ea)+_0x46f21b+')')),console[_0x28de07(0x1a0)](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1be)+_0x354ae5+_0x28de07(0x1d0))),0x0;}}
|
|
1
|
+
const a33_0x9e2146=a33_0x1074;(function(_0x14238d,_0x5e9197){const _0x176e6a=a33_0x1074,_0x14b4fa=_0x14238d();while(!![]){try{const _0x1ee73a=-parseInt(_0x176e6a(0xd1))/0x1+-parseInt(_0x176e6a(0xa8))/0x2*(-parseInt(_0x176e6a(0xba))/0x3)+parseInt(_0x176e6a(0xc8))/0x4+-parseInt(_0x176e6a(0xb2))/0x5*(parseInt(_0x176e6a(0xfa))/0x6)+-parseInt(_0x176e6a(0xb1))/0x7*(-parseInt(_0x176e6a(0xb3))/0x8)+-parseInt(_0x176e6a(0xe2))/0x9+parseInt(_0x176e6a(0xc7))/0xa*(-parseInt(_0x176e6a(0xc4))/0xb);if(_0x1ee73a===_0x5e9197)break;else _0x14b4fa['push'](_0x14b4fa['shift']());}catch(_0x1a306c){_0x14b4fa['push'](_0x14b4fa['shift']());}}}(a33_0x50d9,0xe07bd));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_0xe30f51 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';function a33_0x1074(_0x56944f,_0x218cd4){_0x56944f=_0x56944f-0x93;const _0x50d984=a33_0x50d9();let _0x107460=_0x50d984[_0x56944f];return _0x107460;}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_0x27e716 from'prompts';import a33_0x516786 from'chalk';function validateProfileName(_0xe6a0dc,_0x19241f){const _0x121eb2=a33_0x1074;if(!_0xe6a0dc||!_0xe6a0dc[_0x121eb2(0xd9)]())return _0x121eb2(0xdf);const _0x2951d1=_0xe6a0dc[_0x121eb2(0xd9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x121eb2(0xff)](_0x2951d1))return _0x121eb2(0x97);if(!_0x19241f?.[_0x121eb2(0xbc)]&&profileExists(_0x2951d1))return'Profile\x20\x27'+_0x2951d1+_0x121eb2(0xda)+_0x2951d1+_0x121eb2(0xcf);return!![];}async function deleteProfileAndCredentials(_0x3ec61b){const _0x10aff9=a33_0x1074;removeProfileFromUserConfig(_0x3ec61b);const _0x5671ba=await isKeychainAvailable();_0x5671ba&&await Promise[_0x10aff9(0xc2)]([deleteKeychainAPIKey(_0x3ec61b),deleteOAuthTokens(_0x3ec61b)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x9e2146(0xb6)]=a33_0x9e2146(0xbb);[a33_0x9e2146(0xd5)]=a33_0x9e2146(0xc3);async[a33_0x9e2146(0x94)](_0x4f93dc){const _0x59b560=a33_0x9e2146,{options:_0x196ad2,args:_0x5e417d}=_0x4f93dc,_0x276f5f=!!_0x196ad2['force'];console['log'](a33_0x516786[_0x59b560(0xa6)](_0x59b560(0xd4)));let _0x2e76d1;if(_0x5e417d[_0x59b560(0xe1)]>0x0&&_0x5e417d[0x0]){const _0x444a7c=_0x5e417d[0x0][_0x59b560(0xd9)]();_0x276f5f&&profileExists(_0x444a7c)&&(await deleteProfileAndCredentials(_0x444a7c),console['log'](_0x59b560(0xe9)+_0x444a7c+'\x27'));const _0x31ffe8=validateProfileName(_0x444a7c);if(_0x31ffe8!==!![])return console[_0x59b560(0xbd)](a33_0x516786[_0x59b560(0xaa)](_0x31ffe8)),0x1;_0x2e76d1=_0x444a7c;}else{const _0x106be9=await a33_0x27e716({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':_0xffda7=>validateProfileName(_0xffda7,{'skipExistsCheck':_0x276f5f})});if(!_0x106be9['profileName'])return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;_0x2e76d1=_0x106be9[_0x59b560(0xd6)][_0x59b560(0xd9)](),_0x276f5f&&profileExists(_0x2e76d1)&&(await deleteProfileAndCredentials(_0x2e76d1),console[_0x59b560(0xc6)](_0x59b560(0xe9)+_0x2e76d1+'\x27'));}const _0x4b457c=await a33_0x27e716({'type':_0x59b560(0xf2),'name':_0x59b560(0xd5),'message':_0x59b560(0xb8)}),_0x1ca06e=_0x4b457c[_0x59b560(0xd5)]?.['trim']()||undefined,_0x3d2d8f=_0x196ad2[_0x59b560(0xad)]||_0x59b560(0x9a),_0x469e07=await promptSiteSelection(_0x3d2d8f,_0x2e76d1,_0x59b560(0xa5));if(!_0x469e07)return 0x1;const _0x760e82=resolveSite(_0x469e07),_0x59d35b=await promptAuthMethod();if(!_0x59d35b)return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;if(_0x59d35b===_0x59b560(0xf5)){if(_0x1ca06e){const _0x4bea95={'site':_0x760e82,'description':_0x1ca06e};saveProfileToUserConfig(_0x2e76d1,_0x4bea95);}const {accountName:_0x378867}=_0x196ad2;return await runOAuthLoginFlow(_0x760e82,_0x2e76d1,_0x196ad2['logLevel']??LogLevel[_0x59b560(0xc5)],{'accountName':_0x378867}),0x0;}console[_0x59b560(0xc6)](_0x59b560(0xe0)+_0x760e82),console['log'](_0x59b560(0xcc)),console[_0x59b560(0xc6)]('\x20\x20'+getConsoleUrl(_0x760e82,_0x59b560(0xde)));const _0x5d130c=await a33_0x27e716({'type':_0x59b560(0xfe),'name':_0x59b560(0xa9),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5749f8=>{const _0x1b7f9e=_0x59b560;if(!_0x5749f8||!_0x5749f8[_0x1b7f9e(0xd9)]())return _0x1b7f9e(0xed);return!![];}});if(!_0x5d130c[_0x59b560(0xa9)])return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;const _0x2dd27e=_0x5d130c[_0x59b560(0xa9)];console[_0x59b560(0xc6)](_0x59b560(0xee));try{const _0x550043=TDX['create']({'site':_0x760e82,'apiKey':_0x2dd27e[_0x59b560(0xd9)](),'logLevel':_0x196ad2[_0x59b560(0xeb)]??LogLevel['ERROR']}),_0x2c3f69=await _0x550043[_0x59b560(0xd8)][_0x59b560(0xe7)]();console[_0x59b560(0xc6)](a33_0x516786[_0x59b560(0xb4)]('✓')+_0x59b560(0x93)+_0x2c3f69[_0x59b560(0xca)]+')');const _0x747d8=await isKeychainAvailable();_0x747d8?(await saveAPIKeyAsync(_0x2dd27e[_0x59b560(0xd9)](),_0x760e82,_0x2e76d1),console['log'](a33_0x516786[_0x59b560(0xb4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2e76d1+')')):(console['warn'](a33_0x516786[_0x59b560(0xa4)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x59b560(0xfd)](a33_0x516786[_0x59b560(0xa4)](_0x59b560(0xab))));const _0x58f271={'site':_0x760e82,..._0x1ca06e&&{'description':_0x1ca06e}};return saveProfileToUserConfig(_0x2e76d1,_0x58f271),console[_0x59b560(0xc6)](a33_0x516786[_0x59b560(0xb4)]('✓')+_0x59b560(0xbf)+_0x2e76d1+'\x27\x20created'),console[_0x59b560(0xc6)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x59b560(0xc6)](_0x59b560(0xf4)+_0x2e76d1+_0x59b560(0xdc)),console['log'](_0x59b560(0xf4)+_0x2e76d1+_0x59b560(0xe3)),0x0;}catch(_0x1b4b6e){if(_0x1b4b6e instanceof HTTPClientError&&_0x1b4b6e[_0x59b560(0xe8)]===0x191)return printAuthError(_0x1b4b6e),0x1;return console['error'](a33_0x516786[_0x59b560(0xaa)]('✗\x20Validation\x20failed:\x20'+(_0x1b4b6e instanceof Error?_0x1b4b6e[_0x59b560(0xf7)]:String(_0x1b4b6e)))),console[_0x59b560(0xbd)](_0x59b560(0xa3)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0x9e2146(0xcd);[a33_0x9e2146(0xd5)]='Delete\x20a\x20profile';['validate'](_0x25e736){const _0xabeba9=a33_0x9e2146,{args:_0x59b356}=_0x25e736;if(_0x59b356[_0xabeba9(0xe1)]===0x0)return _0xabeba9(0xaf);return undefined;}async[a33_0x9e2146(0x94)](_0x1c4d1a){const _0x451649=a33_0x9e2146,{args:_0x2c5f7f}=_0x1c4d1a,_0x28ee14=_0x2c5f7f[0x0];console['log'](a33_0x516786[_0x451649(0xa6)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x28ee14)){console[_0x451649(0xbd)](a33_0x516786[_0x451649(0xaa)](_0x451649(0xdb)+_0x28ee14+'\x27\x20does\x20not\x20exist.')),console['log'](_0x451649(0xa0));const _0x54a50b=listProfiles();if(_0x54a50b[_0x451649(0xe1)]===0x0)console['log'](_0x451649(0xd2));else for(const _0x25bcd2 of _0x54a50b){console[_0x451649(0xc6)](_0x451649(0xec)+_0x25bcd2[_0x451649(0xb6)]);}return 0x1;}const _0x561dc5=await a33_0x27e716({'type':_0x451649(0xf0),'name':'confirm','message':_0x451649(0xa2)+_0x28ee14+'\x27?','initial':![]});if(!_0x561dc5['confirm'])return console['log'](_0x451649(0xcb)),0x0;try{await deleteProfileAndCredentials(_0x28ee14),console['log'](a33_0x516786[_0x451649(0xb4)]('✓')+'\x20Profile\x20\x27'+_0x28ee14+_0x451649(0xd7));}catch(_0x285c0e){return console[_0x451649(0xbd)](a33_0x516786[_0x451649(0xaa)](_0x451649(0xa1)+(_0x285c0e instanceof Error?_0x285c0e['message']:String(_0x285c0e)))),0x1;}return 0x0;}}function a33_0x50d9(){const _0x289d9a=['\x27\x20does\x20not\x20exist.','split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Set\x20a\x20profile\x20configuration\x20value','us01','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aSetup\x20cancelled','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','tdx.json','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>','\x0aAvailable\x20profiles:','Failed\x20to\x20delete\x20profile:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','yellow','Setup\x20cancelled','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','2EnNuoj','apiKey','red','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','validate','site','Unknown\x20key\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','includes','9199309PkjIer','345OVpUQn','8QxyudS','green','\x20API\x20key\x20saved\x20to\x20system\x20keychain','name','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Enter\x20description\x20(optional):','llm_project','5506953gMerOF','profile:create','skipExistsCheck','error','\x27\x20requires\x20API\x20key\x20validation.','\x20Profile\x20\x27','(session:\x20','database','all','Create\x20a\x20new\x20profile','11BPMaQI','ERROR','log','2674430lYUmmj','5816864fDxuuj','\x27.\x0a\x0aValid\x20keys:\x20','email','Removal\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile:delete','join','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x0aOperation\x20cancelled','118456TMXxTk','\x20\x20(no\x20profiles\x20found)','default','tdx:\x20profile\x20create','description','profileName','\x27\x20deleted','jobs','trim','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profile','/app/mp/ak','Profile\x20name\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','15711183nTmSZN','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','VALID_KEYS','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','getUserInfo','status','Removed\x20existing\x20profile\x20\x27','session','logLevel','\x20\x20-\x20','API\x20key\x20cannot\x20be\x20empty','Validating\x20API\x20key...','create','confirm','tdx:\x20profile\x20set','text','llm_agent','\x20\x20tdx\x20--profile\x20','oauth','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','message','Changing\x20site\x20to\x20\x27','\x0aSaved\x20to:\x20','135042hracFC','✗\x20Validation\x20failed:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','password','test','dim','\x27\x20updated:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','execute'];a33_0x50d9=function(){return _0x289d9a;};return a33_0x50d9();}export class ProfileSetCommand extends BaseCommand{[a33_0x9e2146(0xb6)]='profile:set';['description']=a33_0x9e2146(0x99);static [a33_0x9e2146(0xe5)]=['site',a33_0x9e2146(0xc1),'parent_segment',a33_0x9e2146(0xb9),a33_0x9e2146(0xf3),a33_0x9e2146(0xd5)];[a33_0x9e2146(0xac)](_0x3b40fc){const _0x65c566=a33_0x9e2146,{args:_0x55c7df,options:_0x3d6c19}=_0x3b40fc,_0x5617da=_0x3d6c19[_0x65c566(0xdd)]||getActiveProfile();if(!_0x5617da)return _0x65c566(0x9f);if(_0x55c7df[_0x65c566(0xe1)]===0x0)return _0x65c566(0xb7)+ProfileSetCommand[_0x65c566(0xe5)][_0x65c566(0xce)](',\x20');const _0x4e65dd=_0x55c7df[0x0];if(!_0x4e65dd[_0x65c566(0xb0)]('='))return _0x65c566(0xfc)+ProfileSetCommand[_0x65c566(0xe5)]['join'](',\x20');const [_0x55276b]=_0x4e65dd[_0x65c566(0x96)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x65c566(0xb0)](_0x55276b))return _0x65c566(0xae)+_0x55276b+_0x65c566(0xc9)+ProfileSetCommand[_0x65c566(0xe5)][_0x65c566(0xce)](',\x20');return undefined;}async['execute'](_0x6954e2){const _0x15d604=a33_0x9e2146,{args:_0x4677a3,options:_0x58c9aa}=_0x6954e2,_0x228795=_0x58c9aa[_0x15d604(0xdd)]||getActiveProfile(),[_0x2dbdb1,..._0x278fea]=_0x4677a3[0x0][_0x15d604(0x96)]('='),_0x28340a=_0x278fea[_0x15d604(0xce)]('=');console[_0x15d604(0xc6)](a33_0x516786['bold'](_0x15d604(0xf1)));if(!profileExists(_0x228795)){const _0x377a50=await a33_0x27e716({'type':_0x15d604(0xf0),'name':_0x15d604(0xef),'message':_0x15d604(0xdb)+_0x228795+_0x15d604(0x98),'initial':!![]});if(!_0x377a50[_0x15d604(0xef)])return console['log']('Operation\x20cancelled'),0x1;}const _0x43c749=loadProfile(_0x228795),_0x566f26=_0x43c749?.[_0x15d604(0xe4)]||{};if(_0x2dbdb1===_0x15d604(0xad)){const _0x14d66d=resolveSite(_0x28340a);console[_0x15d604(0xc6)](_0x15d604(0xf8)+_0x14d66d+_0x15d604(0xbe)),console[_0x15d604(0xc6)](_0x15d604(0xf6)),console[_0x15d604(0xc6)]('\x20\x20'+getConsoleUrl(_0x14d66d,'/app/mp/ak'));const _0x106006=await a33_0x27e716({'type':_0x15d604(0xfe),'name':_0x15d604(0xa9),'message':_0x15d604(0x9d),'validate':_0x45b411=>{const _0x42b022=_0x15d604;if(!_0x45b411||!_0x45b411[_0x42b022(0xd9)]())return _0x42b022(0xed);return!![];}});if(!_0x106006['apiKey'])return console[_0x15d604(0xc6)](_0x15d604(0xd0)),0x1;console[_0x15d604(0xc6)](_0x15d604(0xee));try{const _0x2a3442=TDX[_0x15d604(0xef)]({'site':_0x14d66d,'apiKey':_0x106006[_0x15d604(0xa9)]['trim'](),'logLevel':_0x58c9aa[_0x15d604(0xeb)]??LogLevel[_0x15d604(0xc5)]}),_0x52e2ca=await _0x2a3442['jobs']['getUserInfo']();console[_0x15d604(0xc6)](a33_0x516786[_0x15d604(0xb4)]('✓')+_0x15d604(0x93)+_0x52e2ca[_0x15d604(0xca)]+')');const _0x36d40a=await isKeychainAvailable();_0x36d40a?(await saveAPIKeyAsync(_0x106006[_0x15d604(0xa9)][_0x15d604(0xd9)](),_0x14d66d,_0x228795),console[_0x15d604(0xc6)](a33_0x516786[_0x15d604(0xb4)]('✓')+_0x15d604(0xb5))):console['warn'](a33_0x516786[_0x15d604(0xa4)](_0x15d604(0x9b))),_0x566f26[_0x15d604(0xad)]=_0x14d66d;}catch(_0x264bc0){if(_0x264bc0 instanceof HTTPClientError&&_0x264bc0[_0x15d604(0xe8)]===0x191)return printAuthError(_0x264bc0),0x1;return console[_0x15d604(0xbd)](a33_0x516786[_0x15d604(0xaa)](_0x15d604(0xfb)+(_0x264bc0 instanceof Error?_0x264bc0[_0x15d604(0xf7)]:String(_0x264bc0)))),console[_0x15d604(0xbd)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x566f26[_0x2dbdb1]=_0x28340a||undefined;return saveProfileToUserConfig(_0x228795,_0x566f26),console[_0x15d604(0xc6)](a33_0x516786['green']('✓')+_0x15d604(0xbf)+_0x228795+_0x15d604(0x101)+_0x2dbdb1+'='+(_0x28340a||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x9e2146(0xb6)]='profile:use';[a33_0x9e2146(0xd5)]='Set\x20session\x20profile';[a33_0x9e2146(0xac)](_0x78a3e6){const _0x315b67=a33_0x9e2146,{args:_0x3e2691}=_0x78a3e6;if(_0x3e2691[_0x315b67(0xe1)]===0x0)return _0x315b67(0xa7);return undefined;}async[a33_0x9e2146(0x94)](_0x25d407){const _0x1f0a2f=a33_0x9e2146,{args:_0x3c3db0,options:_0x53a74c}=_0x25d407,_0x1d7b84=_0x3c3db0[0x0],_0x443ffa=_0x53a74c[_0x1f0a2f(0xd3)];cleanExpiredSessions();if(!profileExists(_0x1d7b84)){console[_0x1f0a2f(0xbd)](a33_0x516786[_0x1f0a2f(0xaa)](_0x1f0a2f(0xdb)+_0x1d7b84+_0x1f0a2f(0x95))),console[_0x1f0a2f(0xc6)](_0x1f0a2f(0xa0));const _0x404c62=listProfiles();if(_0x404c62[_0x1f0a2f(0xe1)]===0x0)console[_0x1f0a2f(0xc6)](_0x1f0a2f(0xd2));else for(const _0x31c961 of _0x404c62){console['log'](_0x1f0a2f(0xec)+_0x31c961[_0x1f0a2f(0xb6)]);}return 0x1;}if(_0x443ffa){const _0x40625a=a33_0xe30f51[_0x1f0a2f(0xce)](getConfigDir(),_0x1f0a2f(0x9e));return saveActiveProfileToUserConfig(_0x1d7b84),console['log']('Default\x20profile\x20set\x20to:\x20'+a33_0x516786['green'](_0x1d7b84)),console[_0x1f0a2f(0xc6)](a33_0x516786[_0x1f0a2f(0x100)](_0x1f0a2f(0xf9)+_0x40625a)),0x0;}const _0x23b43c=getSessionID(_0x53a74c[_0x1f0a2f(0xea)]);return saveSessionContext({'profile':_0x1d7b84},_0x53a74c['session']),console[_0x1f0a2f(0xc6)]('Session\x20profile\x20set\x20to:\x20'+a33_0x516786[_0x1f0a2f(0xb4)](_0x1d7b84)+'\x20'+a33_0x516786['dim'](_0x1f0a2f(0xc0)+_0x23b43c+')')),console[_0x1f0a2f(0xc6)](a33_0x516786[_0x1f0a2f(0x100)](_0x1f0a2f(0xe6)+_0x1d7b84+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x353b5b=a34_0x1f7a;(function(_0x3316de,_0x26415a){const _0x24a4a4=a34_0x1f7a,_0xf3699f=_0x3316de();while(!![]){try{const _0x25e6a6=parseInt(_0x24a4a4(0x1a3))/0x1+parseInt(_0x24a4a4(0x19c))/0x2+parseInt(_0x24a4a4(0x19b))/0x3*(-parseInt(_0x24a4a4(0x19f))/0x4)+-parseInt(_0x24a4a4(0x193))/0x5*(-parseInt(_0x24a4a4(0x192))/0x6)+parseInt(_0x24a4a4(0x19e))/0x7+parseInt(_0x24a4a4(0x1aa))/0x8+-parseInt(_0x24a4a4(0x194))/0x9;if(_0x25e6a6===_0x26415a)break;else _0xf3699f['push'](_0xf3699f['shift']());}catch(_0x24e7f8){_0xf3699f['push'](_0xf3699f['shift']());}}}(a34_0x2d3a,0xe2934));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2d3a(){const _0x4b99bd=['11106536bYczRI','788CVszBQ','message','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','2585gXpyRA','description','List\x20all\x20available\x20profiles','length','scope','name','profiles','12095552bPHqiV','101094CBuINv','145QDkGOc','13823739yVGZOf','👤\x20','dim','map','error','config','site','25656rqTQDf','1117938KEcAKf','log'];a34_0x2d3a=function(){return _0x4b99bd;};return a34_0x2d3a();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x4f69dc from'chalk';function a34_0x1f7a(_0x17a9f4,_0x3bf1ea){_0x17a9f4=_0x17a9f4-0x192;const _0x2d3a7d=a34_0x2d3a();let _0x1f7a26=_0x2d3a7d[_0x17a9f4];return _0x1f7a26;}export class ProfilesCommand extends BaseCommand{[a34_0x353b5b(0x1a8)]=a34_0x353b5b(0x1a9);[a34_0x353b5b(0x1a4)]=a34_0x353b5b(0x1a5);async['execute'](_0x3dc08c){const _0x361399=a34_0x353b5b,{options:_0x5918e3}=_0x3dc08c;try{const _0x2d97b7=listProfiles(),_0x24333e=getActiveProfile();if(_0x2d97b7[_0x361399(0x1a6)]===0x0)return console[_0x361399(0x19d)](_0x361399(0x1a2)),console[_0x361399(0x19d)](_0x361399(0x1a1)),console[_0x361399(0x19d)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0xefd879=_0x2d97b7[_0x361399(0x197)](_0x137e95=>{const _0x597b2a=_0x361399,_0x20ed76=_0x137e95[_0x597b2a(0x1a8)]===_0x24333e,_0xd1e13b=getProfileParams(_0x137e95[_0x597b2a(0x199)]);return{'name':_0x137e95[_0x597b2a(0x1a8)],'active':_0x20ed76,'scope':_0x137e95[_0x597b2a(0x1a7)],'description':_0x137e95[_0x597b2a(0x199)][_0x597b2a(0x1a4)]||'','params':_0xd1e13b};});if(isStructuredFormat(_0x5918e3))await handleSDKOutput(_0xefd879,_0x5918e3);else for(const _0xad5db5 of _0x2d97b7){const _0x3f2c37=_0xad5db5[_0x361399(0x1a8)]===_0x24333e?a34_0x4f69dc['green']('\x20✓'):'',_0x256776=_0xad5db5[_0x361399(0x199)][_0x361399(0x19a)]?a34_0x4f69dc[_0x361399(0x196)]('\x20'+_0xad5db5['config'][_0x361399(0x19a)]):'',_0x4db832=_0xad5db5[_0x361399(0x199)]['description']?a34_0x4f69dc[_0x361399(0x196)]('\x20\x20'+_0xad5db5[_0x361399(0x199)][_0x361399(0x1a4)]):'';console['log'](_0x361399(0x195)+_0xad5db5['name']+_0x3f2c37+_0x256776+_0x4db832);}return 0x0;}catch(_0x146002){return _0x146002 instanceof Error&&console[_0x361399(0x198)]('Error:\x20'+_0x146002[_0x361399(0x1a0)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x324720=a35_0x217a;(function(_0x41c31e,_0x1f35dc){const _0x1598bc=a35_0x217a,_0x1c72d8=_0x41c31e();while(!![]){try{const _0x5d82d8=-parseInt(_0x1598bc(0x8a))/0x1+parseInt(_0x1598bc(0xba))/0x2*(-parseInt(_0x1598bc(0xa6))/0x3)+parseInt(_0x1598bc(0xa7))/0x4+parseInt(_0x1598bc(0x9e))/0x5*(-parseInt(_0x1598bc(0x91))/0x6)+parseInt(_0x1598bc(0xa1))/0x7*(-parseInt(_0x1598bc(0x90))/0x8)+parseInt(_0x1598bc(0x93))/0x9+-parseInt(_0x1598bc(0x9a))/0xa*(-parseInt(_0x1598bc(0xa3))/0xb);if(_0x5d82d8===_0x1f35dc)break;else _0x1c72d8['push'](_0x1c72d8['shift']());}catch(_0x19eb92){_0x1c72d8['push'](_0x1c72d8['shift']());}}}(a35_0x424a,0xbc15d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x217a(_0x474c9e,_0x4316e3){_0x474c9e=_0x474c9e-0x88;const _0x424aa2=a35_0x424a();let _0x217ada=_0x424aa2[_0x474c9e];return _0x217ada;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x424a(){const _0x1cfe9e=['processedRows','1267SOPNQV','completedSplits','440YitWeG','in\x20','length','982911pAhLmu','3028952FWXuUj','Catalog:\x20','elapsedTimeMillis','push','Executing\x20query\x20[','setPhase','\x20splits','output','Error:\x20','\x20[Job\x20ID:\x20','...','execute','SQL:\x20','information_schema','verbose','validate','\x0aAll\x20results\x20saved\x20to\x20','Query\x20completed:\x20Processed\x20','setJobId','2OvsYxv','Statement\x20','Run\x20Trino\x20queries\x20(streaming)','data','stats','768594CsUfWY','\x20rows\x20','originalMessage','error','Site:\x20','Executing\x20statement\x20','29744QkXTvn','12zJONcp','Executing\x20query...','1396764WCfYbO','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','message','options','args','state','658250Fkrygt','query','join','jobId','2514620QgWhaj','\x20-\x20'];a35_0x424a=function(){return _0x1cfe9e;};return a35_0x424a();}export class QueryCommand extends BaseCommand{['name']=a35_0x324720(0x9b);['description']=a35_0x324720(0xbc);async['execute'](_0x3aaebd){const _0x317f19=a35_0x324720,{options:_0x5add05,args:_0x4ea931,tdx:_0x258d58}=_0x3aaebd,_0xc70340={..._0x5add05,'limitStructuredFormats':!![]},_0x723384=_0x4ea931[0x0],_0x40352b=_0x5add05['file'];let _0x2605ae;try{if(_0x40352b)_0x2605ae=readSqlStatementsFromFile(_0x40352b);else{if(_0x723384==='-')_0x2605ae=await readSqlStatementsFromStdin();else{if(_0x723384&&isSqlFilePath(_0x723384))_0x2605ae=readSqlStatementsFromFile(_0x723384);else{if(_0x723384)_0x2605ae=splitSqlStatements(_0x723384);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x5a5d7d){return console[_0x317f19(0x8d)](_0x317f19(0xaf)+_0x5a5d7d['message']),0x1;}const _0x50fb40=_0x5add05['database']||_0x317f19(0xb4),_0x5765ba=_0x5add05['catalog'];try{const _0x311ee7=[],_0x4bda39=!!_0x5add05[_0x317f19(0xae)];for(let _0x12df97=0x0;_0x12df97<_0x2605ae[_0x317f19(0xa5)];_0x12df97++){const _0x233952=_0x2605ae[_0x12df97],_0x35f1fe=_0x12df97+0x1,_0x1ae02e=_0x2605ae[_0x317f19(0xa5)],_0x25ccb6=_0x1ae02e>0x1;_0x5add05[_0x317f19(0xb5)]&&(console['error']('\x0a'+(_0x25ccb6?_0x317f19(0xbb)+_0x35f1fe+'/'+_0x1ae02e+':':'')),console[_0x317f19(0x8d)](_0x317f19(0x8e)+_0x5add05[_0x317f19(0x94)]),console[_0x317f19(0x8d)](_0x317f19(0xa8)+(_0x5765ba||'td')),console[_0x317f19(0x8d)]('Schema:\x20'+_0x50fb40),console[_0x317f19(0x8d)](_0x317f19(0xb3)+_0x233952));const _0x280208=_0x25ccb6?_0x317f19(0x8f)+_0x35f1fe+'/'+_0x1ae02e+_0x317f19(0xb1):_0x317f19(0x92);try{const _0x49b6a6=await withProgressSpinner(_0x280208,async _0x523d13=>{const _0x5b3599=_0x317f19,_0x564cbe=await _0x258d58[_0x5b3599(0x9b)][_0x5b3599(0xb2)](_0x233952,{'catalog':_0x5765ba,'schema':_0x50fb40,'onJobId':_0x24caf7=>{const _0x10b604=_0x5b3599;_0x523d13[_0x10b604(0xb9)](_0x24caf7);},'onProgress':_0x4edd54=>{const _0x1252a4=_0x5b3599;_0x523d13[_0x1252a4(0xac)](_0x1252a4(0xab)+_0x4edd54[_0x1252a4(0x99)]+']'),_0x523d13['setExtra'](formatRows(_0x4edd54[_0x1252a4(0xa0)])+'\x20rows\x20'+_0x4edd54[_0x1252a4(0xa2)]+'/'+_0x4edd54['totalSplits']+_0x1252a4(0xad));}});return _0x564cbe;},{'verbose':_0x5add05[_0x317f19(0xb5)]}),_0x36f266=_0x49b6a6[_0x317f19(0x88)],_0x3281d3=_0x36f266['jobId']?_0x317f19(0xb0)+_0x36f266[_0x317f19(0x9d)]+']':'',_0x5c779d=_0x25ccb6?'Statement\x20'+_0x35f1fe+'/'+_0x1ae02e+_0x317f19(0x9f):'';console[_0x317f19(0x8d)]('✔\x20'+_0x5c779d+_0x317f19(0xb8)+formatRows(_0x36f266[_0x317f19(0x89)][_0x317f19(0xa0)])+_0x317f19(0x8b)+(_0x317f19(0xa4)+formatElapsed(_0x36f266[_0x317f19(0x89)][_0x317f19(0xa9)])+_0x3281d3));if(_0x25ccb6&&_0x4bda39){const _0xcbf465=resolveOutputOptions(_0xc70340),_0x426818=await formatQueryOutput(_0x36f266,_0xcbf465);_0x311ee7[_0x317f19(0xaa)](_0x426818);}else await handleQueryOutput(_0x36f266,_0xc70340);}catch(_0x244d8e){const _0x2d1fbd=_0x25ccb6?_0x317f19(0xbb)+_0x35f1fe+'/'+_0x1ae02e+':\x0a':'',_0x4c0d9d=_0x244d8e instanceof SDKError?_0x244d8e[_0x317f19(0x8c)]:_0x244d8e[_0x317f19(0x96)];return console[_0x317f19(0x8d)](''+_0x2d1fbd+_0x4c0d9d),0x1;}}if(_0x2605ae[_0x317f19(0xa5)]>0x1&&_0x4bda39&&_0x311ee7[_0x317f19(0xa5)]>0x0){const _0x1429d3=_0x311ee7[_0x317f19(0x9c)]('\x0a');writeFileSync(_0x5add05['output'],_0x1429d3),console['error'](_0x317f19(0xb7)+_0x5add05['output']);}return 0x0;}catch(_0x25e4a1){throw _0x25e4a1;}}[a35_0x324720(0xb6)](_0x5dcfbc){const _0x50a7b6=a35_0x324720,_0x2ab2c6=_0x5dcfbc[_0x50a7b6(0x98)][0x0],_0x139f26=_0x5dcfbc[_0x50a7b6(0x97)]['file'];if(!_0x2ab2c6&&!_0x139f26)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x2ab2c6&&_0x139f26)return _0x50a7b6(0x95);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a36_0x5199(){const _0x4f20b9=['statusIcon','created_at','No\x20scheduled\x20queries\x20found','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','yes','Show\x20schedule\x20details','10061145ctcOZZ','\x20created','\x20job','toLocaleDateString','end_at','round','site','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','trim','Failed\x20to\x20read\x20file:\x20','job_id','Creating\x20schedule:\x20','options','red','\x20matching\x20\x22','schedule:update','execute','query','engineVersion','file','\x20scheduled\x20quer','551609QcwRNv','63736ucdcph','List\x20scheduled\x20queries','482450fLrOrE','ended_at','timezone','result','name','\x20\x20Job\x20ID:\x20','type','num','listQueries','json','has_next_page','scheduled_at','keys','format','table','10474446lsdjsi','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','padEnd','substring','schedule:show','INVALID_ARGUMENT','from','delay','Schedule\x20created:\x20','run','\x20\x20Database:\x20','\x20execution','lastRun','cyan','getTime','Updating\x20schedule:\x20','tsv','map','(unnamed)','abs','📅\x20','schedules','/app/queries/editor?queryId=','30201390KqteGQ','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','cron','soon','h\x20ago','9yxPZZa','schedule:history','11JypwkD','\x20(use\x20--limit\x20to\x20see\x20more)','m\x20ago','updated_at','Running\x20schedule...','length','350IZLDfp','queries','...','log','\x20\x20Type:\x20','start_at','args','entries','time','status','retry_limit','8ABjYTS','pagination','Update\x20a\x20scheduled\x20query','success','show','\x20schedules','\x20\x20Cron:\x20','Schedule\x20run\x20submitted:\x20','Found\x20','delete','output','verbose','jsonl','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','description','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','priority','schedule:create','retryLimit','last_job','create','682904gBvnhL','history','database','next_run_at','in\x20','join','\x22...','Deleting\x20schedule...','\x20\x20Num:\x20','data','nextRun','Schedule\x20deleted:\x20','green','trino','queryUrl','Getting\x20schedule\x20details...','validate','time_zone','utf-8','user','update','\x20\x20Time:\x20','limit','count','Cancelled','engine_version','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Showing\x20first\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','max','user_name','\x20\x20Timezone:\x20','error','Query\x20file\x20is\x20empty','\x20\x20→\x20'];a36_0x5199=function(){return _0x4f20b9;};return a36_0x5199();}const a36_0x24e2e5=a36_0x33ff;(function(_0x379990,_0x2d2148){const _0x19599e=a36_0x33ff,_0x208329=_0x379990();while(!![]){try{const _0x3320e7=-parseInt(_0x19599e(0x1a4))/0x1+-parseInt(_0x19599e(0x1fb))/0x2*(-parseInt(_0x19599e(0x1d3))/0x3)+-parseInt(_0x19599e(0x1e6))/0x4*(-parseInt(_0x19599e(0x1a7))/0x5)+parseInt(_0x19599e(0x1b6))/0x6+-parseInt(_0x19599e(0x1db))/0x7*(-parseInt(_0x19599e(0x1a5))/0x8)+parseInt(_0x19599e(0x18e))/0x9+parseInt(_0x19599e(0x1ce))/0xa*(-parseInt(_0x19599e(0x1d5))/0xb);if(_0x3320e7===_0x2d2148)break;else _0x208329['push'](_0x208329['shift']());}catch(_0x5deaf0){_0x208329['push'](_0x208329['shift']());}}}(a36_0x5199,0xdd940));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a36_0x33ff(_0x53cdf3,_0x291854){_0x53cdf3=_0x53cdf3-0x184;const _0x51996f=a36_0x5199();let _0x33ffe3=_0x51996f[_0x53cdf3];return _0x33ffe3;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x3d8b05 from'chalk';function formatRelativeTime(_0x34000f){const _0x5913c1=a36_0x33ff,_0x5553fd=new Date(_0x34000f),_0x46540a=new Date(),_0x14aad7=_0x5553fd[_0x5913c1(0x1c5)]()-_0x46540a[_0x5913c1(0x1c5)](),_0x2726d7=Math[_0x5913c1(0x1ca)](_0x14aad7)/0x3e8,_0x3b96ae=_0x14aad7<0x0;if(_0x2726d7<0x3c)return _0x3b96ae?'just\x20now':_0x5913c1(0x1d1);else{if(_0x2726d7<0xe10){const _0x2b8b9e=Math[_0x5913c1(0x193)](_0x2726d7/0x3c);return _0x3b96ae?_0x2b8b9e+_0x5913c1(0x1d7):_0x5913c1(0x1ff)+_0x2b8b9e+'m';}else{if(_0x2726d7<0x15180){const _0x4a16e6=Math['round'](_0x2726d7/0xe10);return _0x3b96ae?_0x4a16e6+_0x5913c1(0x1d2):_0x5913c1(0x1ff)+_0x4a16e6+'h';}else{if(_0x2726d7<0x93a80){const _0x1a51a9=Math[_0x5913c1(0x193)](_0x2726d7/0x15180);return _0x3b96ae?_0x1a51a9+_0x5913c1(0x195):'in\x20'+_0x1a51a9+'d';}else return _0x5553fd[_0x5913c1(0x191)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1a6);async[a36_0x24e2e5(0x19f)](_0xcee677){const _0x354500=a36_0x24e2e5,{options:_0xa6d0a8,args:_0x5a9b53,tdx:_0x4912c3}=_0xcee677,_0x1751ac=resolveLimit(_0xa6d0a8[_0x354500(0x211)],DEFAULT_DISPLAY_LIMIT),_0x109121=_0x5a9b53[0x0],_0x5c4fc6=_0x109121?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x109121+_0x354500(0x201):'Listing\x20scheduled\x20queries...',_0x2b64fd=await withSpinner(_0x5c4fc6,()=>_0x4912c3[_0x354500(0x1cc)][_0x354500(0x1af)]({'limit':_0x1751ac,'scheduled':!![],'pattern':_0x109121}),{'verbose':_0xa6d0a8[_0x354500(0x1f1)]}),_0x32ee04=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1dc)],_0x55b68a=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1e7)][_0x354500(0x1b1)],_0x23f9fa=_0x109121?_0x354500(0x19d)+_0x109121+'\x22':'';_0x55b68a?console[_0x354500(0x185)](_0x354500(0x216)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1eb)+_0x23f9fa+_0x354500(0x1d6)):console[_0x354500(0x185)](_0x354500(0x1ee)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1a3)+(_0x32ee04[_0x354500(0x1da)]!==0x1?'ies':'y')+_0x23f9fa);if(_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b0)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1f2)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b5)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1c7)){const _0x2ba69e=_0x32ee04[_0x354500(0x1c8)](_0x57bad1=>({'id':_0x57bad1['id'],'name':_0x57bad1[_0x354500(0x1ab)],'cron':_0x57bad1['cron'],'database':_0x57bad1[_0x354500(0x1fd)]?.['name'],'type':_0x57bad1[_0x354500(0x1ad)],'timezone':_0x57bad1[_0x354500(0x20c)],'user_name':_0x57bad1[_0x354500(0x20e)]?.[_0x354500(0x1ab)],'updated_at':_0x57bad1[_0x354500(0x1d8)],'next_run_at':_0x57bad1[_0x354500(0x1fe)],'last_job_status':_0x57bad1[_0x354500(0x1f9)]?.[_0x354500(0x1e4)]}));await handleSDKOutput(_0x2ba69e,_0xa6d0a8);}else{if(_0x32ee04[_0x354500(0x1da)]===0x0)console[_0x354500(0x1de)](_0x354500(0x18a));else{const _0x1aeb2f=_0xa6d0a8[_0x354500(0x194)],_0x75b62a=_0x32ee04[_0x354500(0x1c8)](_0x51ae00=>{const _0x5618b8=_0x354500,_0x1c4bd6=_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]?_0x51ae00['last_job']['status']==='success'?'✓':'✗':'-',_0xfedb3c=_0x51ae00['last_job']?.[_0x5618b8(0x1a8)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1f9)][_0x5618b8(0x1a8)]):'never',_0x501aaa=_0x51ae00[_0x5618b8(0x1fe)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1fe)]):'-',_0x1c1e70=_0x51ae00['cron']||'',_0x2207bf=_0x51ae00[_0x5618b8(0x1ab)]||_0x5618b8(0x1c9),_0x4d7b86=getConsoleUrl(_0x1aeb2f,_0x5618b8(0x1cd)+_0x51ae00['id']);return{'statusIcon':_0x1c4bd6,'lastRun':_0xfedb3c,'nextRun':_0x501aaa,'cron':_0x1c1e70,'name':_0x2207bf,'queryUrl':_0x4d7b86,'status':_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]};}),_0x988043=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x40f934=>_0x40f934['lastRun'][_0x354500(0x1da)])),_0x2a41ac=Math[_0x354500(0x218)](..._0x75b62a['map'](_0x2dca32=>_0x2dca32['nextRun'][_0x354500(0x1da)])),_0x4d47a3=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x56efa1=>_0x56efa1[_0x354500(0x1d0)][_0x354500(0x1da)])),_0x7336e7=_0x75b62a[_0x354500(0x1c8)](_0x52250a=>{const _0x1048e0=_0x354500,_0x4b3216=_0x52250a[_0x1048e0(0x1e4)]===_0x1048e0(0x1e9)?a36_0x3d8b05[_0x1048e0(0x207)](_0x52250a['statusIcon']):_0x52250a['status']==='error'?a36_0x3d8b05[_0x1048e0(0x19c)](_0x52250a[_0x1048e0(0x188)]):a36_0x3d8b05['dim'](_0x52250a['statusIcon']),_0x1015c2=_0x52250a[_0x1048e0(0x1c3)][_0x1048e0(0x1b9)](_0x988043),_0xd346cc=_0x52250a[_0x1048e0(0x205)][_0x1048e0(0x1b9)](_0x2a41ac),_0x445015=_0x52250a[_0x1048e0(0x1d0)]?a36_0x3d8b05[_0x1048e0(0x1c4)](_0x52250a[_0x1048e0(0x1d0)][_0x1048e0(0x1b9)](_0x4d47a3)):'\x20'['repeat'](_0x4d47a3),_0x214009=hyperlink(_0x52250a['name'],_0x52250a[_0x1048e0(0x209)]);return _0x1048e0(0x1cb)+_0x4b3216+'\x20'+_0x1015c2+_0x1048e0(0x187)+_0xd346cc+'\x20\x20'+_0x445015+'\x20\x20'+_0x214009;});await writeOutput(_0x7336e7[_0x354500(0x200)]('\x0a'),_0xa6d0a8[_0x354500(0x1f0)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x24e2e5(0x1bb);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x18d);[a36_0x24e2e5(0x20b)](_0x48d456){const _0x2590ad=a36_0x24e2e5,_0x3041f4=_0x48d456[_0x2590ad(0x1e1)][0x0];if(!_0x3041f4)return _0x2590ad(0x217);return undefined;}async[a36_0x24e2e5(0x19f)](_0x53b794){const _0x88928e=a36_0x24e2e5,{options:_0x55c5ff,args:_0x3cf70a,tdx:_0x19100c}=_0x53b794,_0xeb7203=_0x3cf70a[0x0],_0x4d9875=await withSpinner(_0x88928e(0x20a),()=>_0x19100c[_0x88928e(0x1cc)][_0x88928e(0x1ea)](_0xeb7203),{'verbose':_0x55c5ff[_0x88928e(0x1f1)]}),_0x7b3dc4=_0x4d9875[_0x88928e(0x204)],_0x163c8e={'name':_0x7b3dc4[_0x88928e(0x1ab)],'cron':_0x7b3dc4[_0x88928e(0x1d0)],'database':_0x7b3dc4['database'],'type':_0x7b3dc4[_0x88928e(0x1ad)],'timezone':_0x7b3dc4[_0x88928e(0x1a9)],'user_name':_0x7b3dc4[_0x88928e(0x219)],'created_at':_0x7b3dc4[_0x88928e(0x189)],'engine_version':_0x7b3dc4[_0x88928e(0x214)],'executing_user_id':_0x7b3dc4['executing_user_id'],'query':_0x7b3dc4[_0x88928e(0x1a0)],'delay':_0x7b3dc4['delay'],'priority':_0x7b3dc4['priority'],'retry_limit':_0x7b3dc4[_0x88928e(0x1e5)],..._0x7b3dc4[_0x88928e(0x1aa)]&&{'result':_0x7b3dc4['result']}};return await handleSingleObjectOutput(_0x163c8e,_0x55c5ff),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1f7);[a36_0x24e2e5(0x1f4)]='Create\x20a\x20scheduled\x20query';['validate'](_0x4d3a49){const _0x35f4a3=a36_0x24e2e5,_0x3c322b=_0x4d3a49[_0x35f4a3(0x1e1)][0x0];if(!_0x3c322b)return _0x35f4a3(0x1f5);const _0x366a49=_0x4d3a49[_0x35f4a3(0x19b)];if(!_0x366a49[_0x35f4a3(0x1fd)])return _0x35f4a3(0x215);return undefined;}async[a36_0x24e2e5(0x19f)](_0x4a9549){const _0x5e1c86=a36_0x24e2e5,{options:_0x3d85d1,args:_0x4a77ae,tdx:_0x52f938}=_0x4a9549,_0x9b2e8f=_0x4a77ae[0x0],_0x2d900f=_0x3d85d1,_0x488cd3=_0x2d900f[_0x5e1c86(0x1fd)],_0x9da481=_0x2d900f[_0x5e1c86(0x1a2)],_0x1e58ae=_0x2d900f[_0x5e1c86(0x1ad)]||_0x5e1c86(0x208);let _0xf3266b;try{_0xf3266b=readFileSync(_0x9da481,_0x5e1c86(0x20d))[_0x5e1c86(0x197)]();}catch(_0x6adec4){throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x198)+_0x9da481,_0x6adec4 instanceof Error?_0x6adec4:undefined);}if(!_0xf3266b)throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x186));const _0x4d1a04={'database':_0x488cd3,'query':_0xf3266b,'type':_0x1e58ae};if(_0x2d900f[_0x5e1c86(0x1d0)])_0x4d1a04[_0x5e1c86(0x1d0)]=_0x2d900f[_0x5e1c86(0x1d0)];if(_0x2d900f[_0x5e1c86(0x1a9)])_0x4d1a04['timezone']=_0x2d900f['timezone'];if(_0x2d900f['delay']!==undefined)_0x4d1a04[_0x5e1c86(0x1be)]=Number(_0x2d900f[_0x5e1c86(0x1be)]);if(_0x2d900f[_0x5e1c86(0x1f6)]!==undefined)_0x4d1a04[_0x5e1c86(0x1f6)]=Number(_0x2d900f['priority']);if(_0x2d900f[_0x5e1c86(0x1f8)]!==undefined)_0x4d1a04[_0x5e1c86(0x1e5)]=Number(_0x2d900f['retryLimit']);if(_0x2d900f[_0x5e1c86(0x1a1)])_0x4d1a04[_0x5e1c86(0x214)]=_0x2d900f[_0x5e1c86(0x1a1)];if(_0x2d900f[_0x5e1c86(0x1aa)])_0x4d1a04['result']=_0x2d900f[_0x5e1c86(0x1aa)];if(_0x3d85d1[_0x5e1c86(0x1f1)]){console[_0x5e1c86(0x185)](_0x5e1c86(0x19a)+_0x9b2e8f),console[_0x5e1c86(0x185)](_0x5e1c86(0x1c1)+_0x488cd3),console[_0x5e1c86(0x185)](_0x5e1c86(0x1df)+_0x1e58ae);if(_0x4d1a04[_0x5e1c86(0x1d0)])console[_0x5e1c86(0x185)](_0x5e1c86(0x1ec)+_0x4d1a04['cron']);if(_0x4d1a04['timezone'])console['error'](_0x5e1c86(0x184)+_0x4d1a04[_0x5e1c86(0x1a9)]);}const _0x336b41=await withSpinner('Creating\x20schedule...',()=>_0x52f938['schedules'][_0x5e1c86(0x1fa)](_0x9b2e8f,_0x4d1a04),{'verbose':_0x3d85d1[_0x5e1c86(0x1f1)]});return console[_0x5e1c86(0x185)](_0x5e1c86(0x1bf)+_0x336b41['data'][_0x5e1c86(0x1ab)]),await handleSingleObjectOutput(_0x336b41['data'],_0x3d85d1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x19e);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1e8);[a36_0x24e2e5(0x20b)](_0x577dd1){const _0x247b2a=a36_0x24e2e5,_0xd610c8=_0x577dd1[_0x247b2a(0x1e1)][0x0];if(!_0xd610c8)return _0x247b2a(0x1cf);return undefined;}async['execute'](_0x45cfb2){const _0x4a65d7=a36_0x24e2e5,{options:_0x24d7a1,args:_0x1b1f29,tdx:_0x144be6}=_0x45cfb2,_0x53816c=_0x1b1f29[0x0],_0x3761b8=_0x24d7a1,_0x4c9140={};if(_0x3761b8[_0x4a65d7(0x1fd)])_0x4c9140['database']=_0x3761b8[_0x4a65d7(0x1fd)];if(_0x3761b8[_0x4a65d7(0x1ad)])_0x4c9140[_0x4a65d7(0x1ad)]=_0x3761b8[_0x4a65d7(0x1ad)];if(_0x3761b8['cron'])_0x4c9140[_0x4a65d7(0x1d0)]=_0x3761b8['cron'];if(_0x3761b8[_0x4a65d7(0x1a9)])_0x4c9140[_0x4a65d7(0x1a9)]=_0x3761b8[_0x4a65d7(0x1a9)];if(_0x3761b8[_0x4a65d7(0x1be)]!==undefined)_0x4c9140[_0x4a65d7(0x1be)]=Number(_0x3761b8[_0x4a65d7(0x1be)]);if(_0x3761b8[_0x4a65d7(0x1f6)]!==undefined)_0x4c9140[_0x4a65d7(0x1f6)]=Number(_0x3761b8[_0x4a65d7(0x1f6)]);if(_0x3761b8[_0x4a65d7(0x1f8)]!==undefined)_0x4c9140[_0x4a65d7(0x1e5)]=Number(_0x3761b8['retryLimit']);if(_0x3761b8[_0x4a65d7(0x1a1)])_0x4c9140[_0x4a65d7(0x214)]=_0x3761b8[_0x4a65d7(0x1a1)];if(_0x3761b8['result'])_0x4c9140['result']=_0x3761b8['result'];if(_0x3761b8[_0x4a65d7(0x1a2)])try{_0x4c9140[_0x4a65d7(0x1a0)]=readFileSync(_0x3761b8['file'],_0x4a65d7(0x20d))[_0x4a65d7(0x197)]();}catch(_0x516cbe){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a65d7(0x198)+_0x3761b8[_0x4a65d7(0x1a2)],_0x516cbe instanceof Error?_0x516cbe:undefined);}if(Object[_0x4a65d7(0x1b3)](_0x4c9140)[_0x4a65d7(0x1da)]===0x0)throw new SDKError(ErrorCode[_0x4a65d7(0x1bc)],_0x4a65d7(0x1f3));if(_0x24d7a1['verbose']){console[_0x4a65d7(0x185)](_0x4a65d7(0x1c6)+_0x53816c);for(const [_0x4fb54b,_0x5a1cc4]of Object[_0x4a65d7(0x1e2)](_0x4c9140)){_0x4fb54b===_0x4a65d7(0x1a0)?console[_0x4a65d7(0x185)]('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4[_0x4a65d7(0x1ba)](0x0,0x32)+_0x4a65d7(0x1dd)):console['error']('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4);}}const _0x110cff=await withSpinner('Updating\x20schedule...',()=>_0x144be6[_0x4a65d7(0x1cc)][_0x4a65d7(0x20f)](_0x53816c,_0x4c9140),{'verbose':_0x24d7a1[_0x4a65d7(0x1f1)]});return console[_0x4a65d7(0x185)]('Schedule\x20updated:\x20'+_0x110cff[_0x4a65d7(0x204)][_0x4a65d7(0x1ab)]),await handleSingleObjectOutput(_0x110cff[_0x4a65d7(0x204)],_0x24d7a1),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:delete';['description']='Delete\x20a\x20scheduled\x20query';['validate'](_0x3148ac){const _0x73b379=a36_0x24e2e5,_0x58fbfd=_0x3148ac[_0x73b379(0x1e1)][0x0];if(!_0x58fbfd)return _0x73b379(0x196);return undefined;}async[a36_0x24e2e5(0x19f)](_0x43b8d5){const _0x21db02=a36_0x24e2e5,{options:_0x4173c9,args:_0x6d5b3f,tdx:_0x13c68d}=_0x43b8d5,_0x415e3a=_0x6d5b3f[0x0];if(!_0x4173c9[_0x21db02(0x18c)]){const _0x38fafb=await confirm(_0x21db02(0x1b7)+_0x415e3a+'\x22?');if(!_0x38fafb)return console[_0x21db02(0x185)](_0x21db02(0x213)),0x0;}const _0x23b74d=await withSpinner(_0x21db02(0x202),()=>_0x13c68d[_0x21db02(0x1cc)][_0x21db02(0x1ef)](_0x415e3a),{'verbose':_0x4173c9[_0x21db02(0x1f1)]});return console[_0x21db02(0x185)](_0x21db02(0x206)+_0x23b74d[_0x21db02(0x204)][_0x21db02(0x1ab)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:run';['description']=a36_0x24e2e5(0x1b8);[a36_0x24e2e5(0x20b)](_0xe17f42){const _0x25a4eb=a36_0x24e2e5,_0x3d5c77=_0xe17f42[_0x25a4eb(0x1e1)][0x0];if(!_0x3d5c77)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x24e2e5(0x19f)](_0x2c05ba){const _0x576288=a36_0x24e2e5,{options:_0x6f170,args:_0x45784e,tdx:_0x1ebc9a}=_0x2c05ba,_0x2621f1=_0x45784e[0x0],_0x39dbc7=_0x6f170,_0x54d459=_0x39dbc7[_0x576288(0x1e3)],_0x414acf=_0x39dbc7[_0x576288(0x1ae)]!==undefined?Number(_0x39dbc7['num']):undefined;if(_0x6f170['verbose']){console[_0x576288(0x185)]('Running\x20schedule:\x20'+_0x2621f1);if(_0x54d459)console[_0x576288(0x185)](_0x576288(0x210)+_0x54d459);if(_0x414acf)console[_0x576288(0x185)](_0x576288(0x203)+_0x414acf);}const _0x25bba1=await withSpinner(_0x576288(0x1d9),()=>_0x1ebc9a['schedules'][_0x576288(0x1c0)](_0x2621f1,{'time':_0x54d459,'num':_0x414acf}),{'verbose':_0x6f170[_0x576288(0x1f1)]}),_0x35a06c=_0x25bba1[_0x576288(0x204)]['jobs'];console[_0x576288(0x185)](_0x576288(0x1ed)+_0x35a06c[_0x576288(0x1da)]+_0x576288(0x190)+(_0x35a06c['length']!==0x1?'s':'')+_0x576288(0x18f));for(const _0xd8fad7 of _0x35a06c){console[_0x576288(0x185)](_0x576288(0x1ac)+_0xd8fad7[_0x576288(0x199)]);}return await handleSDKOutput(_0x35a06c,_0x6f170),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1d4);['description']='Show\x20schedule\x20execution\x20history';[a36_0x24e2e5(0x20b)](_0x17d469){const _0x5dfd77=a36_0x24e2e5,_0x4e5d90=_0x17d469['args'][0x0];if(!_0x4e5d90)return _0x5dfd77(0x18b);return undefined;}async[a36_0x24e2e5(0x19f)](_0x1a4eff){const _0x322c90=a36_0x24e2e5,{options:_0x26fcbd,args:_0x3f99c4,tdx:_0x2f8f51}=_0x1a4eff,_0x3625e0=_0x3f99c4[0x0],_0x549cbb=_0x26fcbd,_0x7dd568=_0x549cbb[_0x322c90(0x1bd)]!==undefined?Number(_0x549cbb[_0x322c90(0x1bd)]):undefined,_0x13145c=_0x549cbb['to']!==undefined?Number(_0x549cbb['to']):undefined,_0x19af0f=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2f8f51[_0x322c90(0x1cc)][_0x322c90(0x1fc)](_0x3625e0,{'from':_0x7dd568,'to':_0x13145c}),{'verbose':_0x26fcbd[_0x322c90(0x1f1)]}),_0x27981f=_0x19af0f[_0x322c90(0x204)];console[_0x322c90(0x185)](_0x322c90(0x1ee)+_0x27981f[_0x322c90(0x212)]+_0x322c90(0x1c2)+(_0x27981f['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x27981f[_0x322c90(0x1bd)]+'-'+_0x27981f['to']+')');const _0x13e78b=_0x27981f[_0x322c90(0x1fc)]['map'](_0x395637=>({'job_id':_0x395637[_0x322c90(0x199)],'type':_0x395637[_0x322c90(0x1ad)],'status':_0x395637['status'],'scheduled_at':_0x395637[_0x322c90(0x1b2)],'created_at':_0x395637[_0x322c90(0x189)],'start_at':_0x395637[_0x322c90(0x1e0)],'end_at':_0x395637[_0x322c90(0x192)]}));return await handleSDKOutput(_0x13e78b,_0x26fcbd),0x0;}}
|
|
1
|
+
const a36_0x476b5a=a36_0x335d;(function(_0x14c254,_0x4563ae){const _0xce6a16=a36_0x335d,_0x2d965a=_0x14c254();while(!![]){try{const _0xda38dc=-parseInt(_0xce6a16(0xf8))/0x1*(-parseInt(_0xce6a16(0x143))/0x2)+parseInt(_0xce6a16(0x124))/0x3+parseInt(_0xce6a16(0x119))/0x4+parseInt(_0xce6a16(0x137))/0x5*(-parseInt(_0xce6a16(0x122))/0x6)+parseInt(_0xce6a16(0x157))/0x7*(parseInt(_0xce6a16(0xe9))/0x8)+parseInt(_0xce6a16(0x134))/0x9*(-parseInt(_0xce6a16(0xf1))/0xa)+parseInt(_0xce6a16(0xe8))/0xb;if(_0xda38dc===_0x4563ae)break;else _0x2d965a['push'](_0x2d965a['shift']());}catch(_0x5e8efa){_0x2d965a['push'](_0x2d965a['shift']());}}}(a36_0x4c88,0xdb617));import{BaseCommand}from'./command.js';function a36_0x335d(_0x255ee5,_0x26bd34){_0x255ee5=_0x255ee5-0xe3;const _0x4c88b4=a36_0x4c88();let _0x335d0b=_0x4c88b4[_0x255ee5];return _0x335d0b;}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_0x171e14 from'chalk';function formatRelativeTime(_0x1571c3){const _0x89015d=a36_0x335d,_0x577ed3=new Date(_0x1571c3),_0x3bb061=new Date(),_0x52eec2=_0x577ed3['getTime']()-_0x3bb061['getTime'](),_0x1e0af2=Math[_0x89015d(0x14c)](_0x52eec2)/0x3e8,_0x42f7d2=_0x52eec2<0x0;if(_0x1e0af2<0x3c)return _0x42f7d2?_0x89015d(0x146):_0x89015d(0x13f);else{if(_0x1e0af2<0xe10){const _0x5c7f70=Math[_0x89015d(0x111)](_0x1e0af2/0x3c);return _0x42f7d2?_0x5c7f70+_0x89015d(0xfd):'in\x20'+_0x5c7f70+'m';}else{if(_0x1e0af2<0x15180){const _0x40a2a4=Math[_0x89015d(0x111)](_0x1e0af2/0xe10);return _0x42f7d2?_0x40a2a4+_0x89015d(0x11b):_0x89015d(0x127)+_0x40a2a4+'h';}else{if(_0x1e0af2<0x93a80){const _0x51ebc6=Math[_0x89015d(0x111)](_0x1e0af2/0x15180);return _0x42f7d2?_0x51ebc6+'d\x20ago':'in\x20'+_0x51ebc6+'d';}else return _0x577ed3['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x132);async[a36_0x476b5a(0xec)](_0x2226ba){const _0x51519d=a36_0x476b5a,{options:_0x5d61d9,args:_0x2994cf,tdx:_0x2fea0f}=_0x2226ba,_0x585a8e=resolveLimit(_0x5d61d9[_0x51519d(0x107)],DEFAULT_DISPLAY_LIMIT),_0x584b63=_0x2994cf[0x0],_0xa2b2ed=_0x584b63?_0x51519d(0x13a)+_0x584b63+_0x51519d(0xe4):_0x51519d(0x12b),_0x87fcc=await withSpinner(_0xa2b2ed,()=>_0x2fea0f[_0x51519d(0x115)]['listQueries']({'limit':_0x585a8e,'scheduled':!![],'pattern':_0x584b63}),{'verbose':_0x5d61d9[_0x51519d(0x104)]}),_0x5d4488=_0x87fcc[_0x51519d(0x112)][_0x51519d(0x110)],_0x4fdd21=_0x87fcc[_0x51519d(0x112)]['pagination'][_0x51519d(0x109)],_0x399527=_0x584b63?_0x51519d(0x147)+_0x584b63+'\x22':'';_0x4fdd21?console['error']('Showing\x20first\x20'+_0x5d4488[_0x51519d(0x139)]+'\x20schedules'+_0x399527+_0x51519d(0x12a)):console[_0x51519d(0x152)](_0x51519d(0x10a)+_0x5d4488[_0x51519d(0x139)]+'\x20scheduled\x20quer'+(_0x5d4488[_0x51519d(0x139)]!==0x1?_0x51519d(0x108):'y')+_0x399527);if(_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x11e)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x16c)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x116)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x11a)){const _0x1bab29=_0x5d4488[_0x51519d(0x173)](_0x390b3d=>({'id':_0x390b3d['id'],'name':_0x390b3d[_0x51519d(0x148)],'cron':_0x390b3d['cron'],'database':_0x390b3d[_0x51519d(0x138)]?.[_0x51519d(0x148)],'type':_0x390b3d['type'],'timezone':_0x390b3d[_0x51519d(0x16d)],'user_name':_0x390b3d[_0x51519d(0x163)]?.[_0x51519d(0x148)],'updated_at':_0x390b3d[_0x51519d(0x168)],'next_run_at':_0x390b3d[_0x51519d(0x126)],'last_job_status':_0x390b3d[_0x51519d(0x172)]?.[_0x51519d(0x105)]}));await handleSDKOutput(_0x1bab29,_0x5d61d9);}else{if(_0x5d4488[_0x51519d(0x139)]===0x0)console[_0x51519d(0x14e)](_0x51519d(0xee));else{const _0x250845=_0x5d61d9[_0x51519d(0xfe)],_0x1f43cd=_0x5d4488[_0x51519d(0x173)](_0x3e3330=>{const _0xaf6b18=_0x51519d,_0x310767=_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0x105)]?_0x3e3330[_0xaf6b18(0x172)][_0xaf6b18(0x105)]==='success'?'✓':'✗':'-',_0x5b8b32=_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0xed)]?formatRelativeTime(_0x3e3330[_0xaf6b18(0x172)][_0xaf6b18(0xed)]):_0xaf6b18(0x123),_0x4fe5a9=_0x3e3330[_0xaf6b18(0x126)]?formatRelativeTime(_0x3e3330[_0xaf6b18(0x126)]):'-',_0x2b57e5=_0x3e3330[_0xaf6b18(0x15c)]||'',_0x3ed17a=_0x3e3330[_0xaf6b18(0x148)]||_0xaf6b18(0x140),_0x2cf697=getConsoleUrl(_0x250845,_0xaf6b18(0x10b)+_0x3e3330['id']);return{'statusIcon':_0x310767,'lastRun':_0x5b8b32,'nextRun':_0x4fe5a9,'cron':_0x2b57e5,'name':_0x3ed17a,'queryUrl':_0x2cf697,'status':_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0x105)]};}),_0x3ac8c6=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x4ce91a=>_0x4ce91a['lastRun'][_0x51519d(0x139)])),_0x11f554=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x1d82c8=>_0x1d82c8['nextRun'][_0x51519d(0x139)])),_0x52dc14=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x258b95=>_0x258b95['cron'][_0x51519d(0x139)])),_0x4ae7f2=_0x1f43cd['map'](_0x1cf71b=>{const _0x10938c=_0x51519d,_0x50116a=_0x1cf71b[_0x10938c(0x105)]===_0x10938c(0x113)?a36_0x171e14[_0x10938c(0x14b)](_0x1cf71b[_0x10938c(0x120)]):_0x1cf71b[_0x10938c(0x105)]===_0x10938c(0x152)?a36_0x171e14['red'](_0x1cf71b['statusIcon']):a36_0x171e14['dim'](_0x1cf71b[_0x10938c(0x120)]),_0x48683=_0x1cf71b['lastRun']['padEnd'](_0x3ac8c6),_0x31c5e1=_0x1cf71b[_0x10938c(0x11f)][_0x10938c(0x151)](_0x11f554),_0xaa11af=_0x1cf71b[_0x10938c(0x15c)]?a36_0x171e14[_0x10938c(0xf6)](_0x1cf71b[_0x10938c(0x15c)]['padEnd'](_0x52dc14)):'\x20'['repeat'](_0x52dc14),_0x2fa27c=hyperlink(_0x1cf71b[_0x10938c(0x148)],_0x1cf71b[_0x10938c(0x16e)]);return _0x10938c(0x12e)+_0x50116a+'\x20'+_0x48683+_0x10938c(0x128)+_0x31c5e1+'\x20\x20'+_0xaa11af+'\x20\x20'+_0x2fa27c;});await writeOutput(_0x4ae7f2[_0x51519d(0x15a)]('\x0a'),_0x5d61d9[_0x51519d(0x165)],_0x51519d(0x136));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x476b5a(0x150);[a36_0x476b5a(0x141)]=a36_0x476b5a(0x15f);[a36_0x476b5a(0x129)](_0x50381d){const _0x2ed4dd=a36_0x476b5a,_0x4ff40d=_0x50381d[_0x2ed4dd(0x14f)][0x0];if(!_0x4ff40d)return _0x2ed4dd(0xf7);return undefined;}async[a36_0x476b5a(0xec)](_0x137346){const _0x29825a=a36_0x476b5a,{options:_0x3debae,args:_0x1c1d88,tdx:_0x2ab049}=_0x137346,_0x4fe5af=_0x1c1d88[0x0],_0x120f61=await withSpinner(_0x29825a(0x16f),()=>_0x2ab049[_0x29825a(0x115)]['show'](_0x4fe5af),{'verbose':_0x3debae[_0x29825a(0x104)]}),_0x308949=_0x120f61[_0x29825a(0x112)],_0x481d6c={'name':_0x308949[_0x29825a(0x148)],'cron':_0x308949['cron'],'database':_0x308949[_0x29825a(0x138)],'type':_0x308949['type'],'timezone':_0x308949[_0x29825a(0x153)],'user_name':_0x308949[_0x29825a(0x10d)],'created_at':_0x308949[_0x29825a(0xf2)],'engine_version':_0x308949[_0x29825a(0x131)],'executing_user_id':_0x308949['executing_user_id'],'query':_0x308949[_0x29825a(0xeb)],'delay':_0x308949[_0x29825a(0x135)],'priority':_0x308949[_0x29825a(0x121)],'retry_limit':_0x308949[_0x29825a(0x149)],..._0x308949['result']&&{'result':_0x308949['result']}};return await handleSingleObjectOutput(_0x481d6c,_0x3debae),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x476b5a(0x148)]=a36_0x476b5a(0x14d);['description']='Create\x20a\x20scheduled\x20query';['validate'](_0x357379){const _0x12579d=a36_0x476b5a,_0x16e785=_0x357379[_0x12579d(0x14f)][0x0];if(!_0x16e785)return _0x12579d(0x170);const _0x89432c=_0x357379[_0x12579d(0x16a)];if(!_0x89432c[_0x12579d(0x138)])return _0x12579d(0x103);return undefined;}async[a36_0x476b5a(0xec)](_0x1de887){const _0x5f0882=a36_0x476b5a,{options:_0x473ab4,args:_0x1c45e2,tdx:_0x296dd5}=_0x1de887,_0x123ba9=_0x1c45e2[0x0],_0x128a0e=_0x473ab4,_0x4ab3db=_0x128a0e[_0x5f0882(0x138)],_0x274bca=_0x128a0e[_0x5f0882(0x144)],_0x391859=_0x128a0e[_0x5f0882(0x16b)]||_0x5f0882(0x145);let _0x46917d;try{_0x46917d=readFileSync(_0x274bca,_0x5f0882(0xfc))['trim']();}catch(_0xb958e6){throw new SDKError(ErrorCode[_0x5f0882(0x13d)],_0x5f0882(0x133)+_0x274bca,_0xb958e6 instanceof Error?_0xb958e6:undefined);}if(!_0x46917d)throw new SDKError(ErrorCode[_0x5f0882(0x13d)],_0x5f0882(0x164));const _0x30cd88={'database':_0x4ab3db,'query':_0x46917d,'type':_0x391859};if(_0x128a0e[_0x5f0882(0x15c)])_0x30cd88[_0x5f0882(0x15c)]=_0x128a0e[_0x5f0882(0x15c)];if(_0x128a0e[_0x5f0882(0x153)])_0x30cd88['timezone']=_0x128a0e['timezone'];if(_0x128a0e[_0x5f0882(0x135)]!==undefined)_0x30cd88[_0x5f0882(0x135)]=Number(_0x128a0e[_0x5f0882(0x135)]);if(_0x128a0e[_0x5f0882(0x121)]!==undefined)_0x30cd88[_0x5f0882(0x121)]=Number(_0x128a0e[_0x5f0882(0x121)]);if(_0x128a0e['retryLimit']!==undefined)_0x30cd88[_0x5f0882(0x149)]=Number(_0x128a0e[_0x5f0882(0xf4)]);if(_0x128a0e['engineVersion'])_0x30cd88[_0x5f0882(0x131)]=_0x128a0e[_0x5f0882(0xf0)];if(_0x128a0e[_0x5f0882(0xe5)])_0x30cd88[_0x5f0882(0xe5)]=_0x128a0e[_0x5f0882(0xe5)];if(_0x473ab4['verbose']){console[_0x5f0882(0x152)](_0x5f0882(0xf9)+_0x123ba9),console[_0x5f0882(0x152)]('\x20\x20Database:\x20'+_0x4ab3db),console[_0x5f0882(0x152)](_0x5f0882(0x167)+_0x391859);if(_0x30cd88[_0x5f0882(0x15c)])console['error'](_0x5f0882(0x13b)+_0x30cd88[_0x5f0882(0x15c)]);if(_0x30cd88[_0x5f0882(0x153)])console['error'](_0x5f0882(0xf5)+_0x30cd88[_0x5f0882(0x153)]);}const _0x4bbc68=await withSpinner('Creating\x20schedule...',()=>_0x296dd5['schedules'][_0x5f0882(0xe7)](_0x123ba9,_0x30cd88),{'verbose':_0x473ab4[_0x5f0882(0x104)]});return console[_0x5f0882(0x152)](_0x5f0882(0x166)+_0x4bbc68[_0x5f0882(0x112)][_0x5f0882(0x148)]),await handleSingleObjectOutput(_0x4bbc68[_0x5f0882(0x112)],_0x473ab4),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:update';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x14a);[a36_0x476b5a(0x129)](_0x3ecd3b){const _0x247fbe=a36_0x476b5a,_0x4387a4=_0x3ecd3b[_0x247fbe(0x14f)][0x0];if(!_0x4387a4)return _0x247fbe(0x160);return undefined;}async['execute'](_0x58c5de){const _0x4c0379=a36_0x476b5a,{options:_0x21fa3c,args:_0x2d557a,tdx:_0x3167e3}=_0x58c5de,_0xc5d98=_0x2d557a[0x0],_0x9a183f=_0x21fa3c,_0x1e6697={};if(_0x9a183f[_0x4c0379(0x138)])_0x1e6697['database']=_0x9a183f[_0x4c0379(0x138)];if(_0x9a183f[_0x4c0379(0x16b)])_0x1e6697[_0x4c0379(0x16b)]=_0x9a183f['type'];if(_0x9a183f[_0x4c0379(0x15c)])_0x1e6697[_0x4c0379(0x15c)]=_0x9a183f[_0x4c0379(0x15c)];if(_0x9a183f[_0x4c0379(0x153)])_0x1e6697[_0x4c0379(0x153)]=_0x9a183f[_0x4c0379(0x153)];if(_0x9a183f[_0x4c0379(0x135)]!==undefined)_0x1e6697[_0x4c0379(0x135)]=Number(_0x9a183f[_0x4c0379(0x135)]);if(_0x9a183f[_0x4c0379(0x121)]!==undefined)_0x1e6697['priority']=Number(_0x9a183f[_0x4c0379(0x121)]);if(_0x9a183f[_0x4c0379(0xf4)]!==undefined)_0x1e6697[_0x4c0379(0x149)]=Number(_0x9a183f[_0x4c0379(0xf4)]);if(_0x9a183f['engineVersion'])_0x1e6697[_0x4c0379(0x131)]=_0x9a183f[_0x4c0379(0xf0)];if(_0x9a183f[_0x4c0379(0xe5)])_0x1e6697[_0x4c0379(0xe5)]=_0x9a183f['result'];if(_0x9a183f[_0x4c0379(0x144)])try{_0x1e6697['query']=readFileSync(_0x9a183f[_0x4c0379(0x144)],'utf-8')[_0x4c0379(0x159)]();}catch(_0x4a701b){throw new SDKError(ErrorCode[_0x4c0379(0x13d)],_0x4c0379(0x133)+_0x9a183f[_0x4c0379(0x144)],_0x4a701b instanceof Error?_0x4a701b:undefined);}if(Object[_0x4c0379(0x154)](_0x1e6697)[_0x4c0379(0x139)]===0x0)throw new SDKError(ErrorCode[_0x4c0379(0x13d)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x21fa3c[_0x4c0379(0x104)]){console[_0x4c0379(0x152)](_0x4c0379(0x171)+_0xc5d98);for(const [_0x4416a6,_0x2afbd4]of Object[_0x4c0379(0x13c)](_0x1e6697)){_0x4416a6===_0x4c0379(0xeb)?console[_0x4c0379(0x152)]('\x20\x20'+_0x4416a6+':\x20'+_0x2afbd4[_0x4c0379(0x10e)](0x0,0x32)+_0x4c0379(0x100)):console[_0x4c0379(0x152)]('\x20\x20'+_0x4416a6+':\x20'+_0x2afbd4);}}const _0x1f5743=await withSpinner('Updating\x20schedule...',()=>_0x3167e3['schedules'][_0x4c0379(0x114)](_0xc5d98,_0x1e6697),{'verbose':_0x21fa3c['verbose']});return console[_0x4c0379(0x152)](_0x4c0379(0x155)+_0x1f5743['data'][_0x4c0379(0x148)]),await handleSingleObjectOutput(_0x1f5743['data'],_0x21fa3c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:delete';[a36_0x476b5a(0x141)]='Delete\x20a\x20scheduled\x20query';[a36_0x476b5a(0x129)](_0x4407ef){const _0x521231=_0x4407ef['args'][0x0];if(!_0x521231)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x476b5a(0xec)](_0x278743){const _0x4ff159=a36_0x476b5a,{options:_0x21dae5,args:_0x1d4a30,tdx:_0x5d0cba}=_0x278743,_0x71040c=_0x1d4a30[0x0];if(!_0x21dae5[_0x4ff159(0x11c)]){const _0x2d6e1c=await confirm(_0x4ff159(0x106)+_0x71040c+'\x22?');if(!_0x2d6e1c)return console[_0x4ff159(0x152)](_0x4ff159(0xe6)),0x0;}const _0x404bf6=await withSpinner(_0x4ff159(0x15d),()=>_0x5d0cba[_0x4ff159(0x115)][_0x4ff159(0xf3)](_0x71040c),{'verbose':_0x21dae5[_0x4ff159(0x104)]});return console[_0x4ff159(0x152)](_0x4ff159(0x12d)+_0x404bf6[_0x4ff159(0x112)][_0x4ff159(0x148)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x476b5a(0x148)]=a36_0x476b5a(0x11d);[a36_0x476b5a(0x141)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x476b5a(0x129)](_0x2f8238){const _0x17d91d=a36_0x476b5a,_0x5d0285=_0x2f8238['args'][0x0];if(!_0x5d0285)return _0x17d91d(0xea);return undefined;}async[a36_0x476b5a(0xec)](_0x5964b8){const _0x2317bc=a36_0x476b5a,{options:_0x523ec5,args:_0x1e8bc3,tdx:_0x34a155}=_0x5964b8,_0x4bf86c=_0x1e8bc3[0x0],_0x557f1f=_0x523ec5,_0x39c811=_0x557f1f[_0x2317bc(0xfb)],_0x3543a8=_0x557f1f[_0x2317bc(0x125)]!==undefined?Number(_0x557f1f[_0x2317bc(0x125)]):undefined;if(_0x523ec5[_0x2317bc(0x104)]){console[_0x2317bc(0x152)](_0x2317bc(0x15b)+_0x4bf86c);if(_0x39c811)console['error'](_0x2317bc(0xff)+_0x39c811);if(_0x3543a8)console[_0x2317bc(0x152)]('\x20\x20Num:\x20'+_0x3543a8);}const _0x2a03ad=await withSpinner(_0x2317bc(0x12f),()=>_0x34a155[_0x2317bc(0x115)][_0x2317bc(0xef)](_0x4bf86c,{'time':_0x39c811,'num':_0x3543a8}),{'verbose':_0x523ec5[_0x2317bc(0x104)]}),_0x3a09ea=_0x2a03ad['data'][_0x2317bc(0x158)];console[_0x2317bc(0x152)](_0x2317bc(0x156)+_0x3a09ea[_0x2317bc(0x139)]+_0x2317bc(0x169)+(_0x3a09ea[_0x2317bc(0x139)]!==0x1?'s':'')+_0x2317bc(0x10f));for(const _0x211d77 of _0x3a09ea){console[_0x2317bc(0x152)](_0x2317bc(0x15e)+_0x211d77['job_id']);}return await handleSDKOutput(_0x3a09ea,_0x523ec5),0x0;}}function a36_0x4c88(){const _0x39dc38=['in\x20','\x20\x20→\x20','validate','\x20(use\x20--limit\x20to\x20see\x20more)','Listing\x20scheduled\x20queries...','format','Schedule\x20deleted:\x20','📅\x20','Running\x20schedule...','Show\x20schedule\x20execution\x20history','engine_version','List\x20scheduled\x20queries','Failed\x20to\x20read\x20file:\x20','63117fbuaEV','delay','list','1710rGPffa','database','length','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Cron:\x20','entries','INVALID_ARGUMENT','history','soon','(unnamed)','description','count','37550HkAluy','file','trino','just\x20now','\x20matching\x20\x22','name','retry_limit','Update\x20a\x20scheduled\x20query','green','abs','schedule:create','log','args','schedule:show','padEnd','error','timezone','keys','Schedule\x20updated:\x20','Schedule\x20run\x20submitted:\x20','3535gcvwYR','jobs','trim','join','Running\x20schedule:\x20','cron','Deleting\x20schedule...','\x20\x20Job\x20ID:\x20','Show\x20schedule\x20details','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','from','user','Query\x20file\x20is\x20empty','output','Schedule\x20created:\x20','\x20\x20Type:\x20','updated_at','\x20job','options','type','jsonl','time_zone','queryUrl','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Updating\x20schedule:\x20','last_job','map','\x20execution','\x22...','result','Cancelled','create','626450lKlAJS','18296GJhjXN','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','query','execute','ended_at','No\x20scheduled\x20queries\x20found','run','engineVersion','1910iyKcKQ','created_at','delete','retryLimit','\x20\x20Timezone:\x20','cyan','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','7WDlWYG','Creating\x20schedule:\x20','job_id','time','utf-8','m\x20ago','site','\x20\x20Time:\x20','...','scheduled_at','max','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','verbose','status','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','limit','ies','has_next_page','Found\x20','/app/queries/editor?queryId=','\x20(showing\x20','user_name','substring','\x20created','queries','round','data','success','update','schedules','table','end_at','Getting\x20schedule\x20history...','742288BVOuly','tsv','h\x20ago','yes','schedule:run','json','nextRun','statusIcon','priority','2622PYUSBL','never','2575914FoCHDw','num','next_run_at'];a36_0x4c88=function(){return _0x39dc38;};return a36_0x4c88();}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:history';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x130);[a36_0x476b5a(0x129)](_0x1ab10d){const _0x480323=a36_0x476b5a,_0x4a6634=_0x1ab10d[_0x480323(0x14f)][0x0];if(!_0x4a6634)return _0x480323(0x161);return undefined;}async[a36_0x476b5a(0xec)](_0x31013f){const _0x1e8266=a36_0x476b5a,{options:_0x4cfb08,args:_0x43fced,tdx:_0x4edb7d}=_0x31013f,_0xfa112=_0x43fced[0x0],_0x20daad=_0x4cfb08,_0x51b03c=_0x20daad[_0x1e8266(0x162)]!==undefined?Number(_0x20daad[_0x1e8266(0x162)]):undefined,_0xa09504=_0x20daad['to']!==undefined?Number(_0x20daad['to']):undefined,_0x2425e2=await withSpinner(_0x1e8266(0x118),()=>_0x4edb7d[_0x1e8266(0x115)][_0x1e8266(0x13e)](_0xfa112,{'from':_0x51b03c,'to':_0xa09504}),{'verbose':_0x4cfb08[_0x1e8266(0x104)]}),_0x496fae=_0x2425e2[_0x1e8266(0x112)];console[_0x1e8266(0x152)](_0x1e8266(0x10a)+_0x496fae[_0x1e8266(0x142)]+_0x1e8266(0xe3)+(_0x496fae[_0x1e8266(0x142)]!==0x1?'s':'')+_0x1e8266(0x10c)+_0x496fae[_0x1e8266(0x162)]+'-'+_0x496fae['to']+')');const _0x3b41c7=_0x496fae[_0x1e8266(0x13e)]['map'](_0x14dc1b=>({'job_id':_0x14dc1b[_0x1e8266(0xfa)],'type':_0x14dc1b['type'],'status':_0x14dc1b[_0x1e8266(0x105)],'scheduled_at':_0x14dc1b[_0x1e8266(0x101)],'created_at':_0x14dc1b['created_at'],'start_at':_0x14dc1b['start_at'],'end_at':_0x14dc1b[_0x1e8266(0x117)]}));return await handleSDKOutput(_0x3b41c7,_0x4cfb08),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x135c14=a37_0x3c28;(function(_0x512901,_0x247101){const _0x331bc7=a37_0x3c28,_0x10bae8=_0x512901();while(!![]){try{const _0x162a0d=-parseInt(_0x331bc7(0xa7))/0x1*(parseInt(_0x331bc7(0xdb))/0x2)+parseInt(_0x331bc7(0x133))/0x3+parseInt(_0x331bc7(0xff))/0x4+parseInt(_0x331bc7(0xe2))/0x5+parseInt(_0x331bc7(0xc9))/0x6*(parseInt(_0x331bc7(0xb8))/0x7)+-parseInt(_0x331bc7(0xe5))/0x8+parseInt(_0x331bc7(0xc4))/0x9;if(_0x162a0d===_0x247101)break;else _0x10bae8['push'](_0x10bae8['shift']());}catch(_0x58a4ce){_0x10bae8['push'](_0x10bae8['shift']());}}}(a37_0x4cbb,0xd31be));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a37_0x3c28(_0x3d19f4,_0x16fc2d){_0x3d19f4=_0x3d19f4-0x93;const _0x4cbb19=a37_0x4cbb();let _0x3c28fd=_0x4cbb19[_0x3d19f4];return _0x3c28fd;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x451b3d from'chalk';async function resolveSegmentTarget(_0x26b5b1,_0x58564c,_0x52cb01){const _0x3952e1=a37_0x3c28;if(isYamlFilePath(_0x26b5b1))try{const _0x378a21=await resolveYamlFilePath(_0x26b5b1);return _0x52cb01&&(console[_0x3952e1(0x95)]('Resolved\x20YAML\x20file:\x20'+_0x26b5b1),console[_0x3952e1(0x95)](_0x3952e1(0x125)+_0x378a21['parentSegment']),console[_0x3952e1(0x95)]('\x20\x20Segment\x20name:\x20'+_0x378a21['segmentName']),console[_0x3952e1(0x95)](_0x3952e1(0xb5)+(_0x378a21[_0x3952e1(0xf5)]||_0x3952e1(0xa0))),console[_0x3952e1(0x95)](_0x3952e1(0x120)+_0x378a21[_0x3952e1(0xdd)])),_0x378a21[_0x3952e1(0xdd)];}catch(_0x40859f){throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0xb4)+_0x40859f[_0x3952e1(0xf7)]);}if(!_0x58564c)throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0x10b));return _0x58564c+'/'+_0x26b5b1;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:describe';[a37_0x135c14(0x122)]=a37_0x135c14(0x12b);async[a37_0x135c14(0xa4)](_0xdd7331){const _0x19e609=a37_0x135c14,{options:_0x5b5bc4,args:_0x3f95a3,tdx:_0x527fe2}=_0xdd7331,_0x3f42e2=_0x3f95a3[0x0],_0x17177c=!_0x3f42e2&&!!_0x5b5bc4[_0x19e609(0x108)],_0x12b1a2=_0x3f42e2||_0x5b5bc4[_0x19e609(0x108)];if(!_0x12b1a2)return console[_0x19e609(0x95)](_0x19e609(0xbf)),console[_0x19e609(0x95)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x19e609(0x95)](_0x19e609(0xf0)),console['error'](_0x19e609(0xca)),console[_0x19e609(0x95)](_0x19e609(0xa2)),console[_0x19e609(0x95)](_0x19e609(0xd6)),console[_0x19e609(0x95)](_0x19e609(0xe9)),0x1;try{const _0xdf9a4=_0x5b5bc4[_0x19e609(0xba)];let _0x2e02d8=_0x12b1a2;!_0x17177c&&_0xdf9a4&&!_0x12b1a2['includes']('/')&&(_0x2e02d8=_0xdf9a4+'/'+_0x12b1a2,_0x5b5bc4['verbose']&&console[_0x19e609(0x95)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2e02d8));const _0x7e35e2=await withSpinner(_0x19e609(0xa8)+_0x2e02d8+_0x19e609(0xf4),()=>_0x527fe2[_0x19e609(0xde)]['resolvePathToResource'](_0x2e02d8),{'verbose':_0x5b5bc4[_0x19e609(0xab)]}),_0x5a6819=_0x7e35e2[_0x19e609(0x10c)];_0x5b5bc4['verbose']&&(console['error'](_0x19e609(0xc8)+_0x5a6819[_0x19e609(0xc5)]),console[_0x19e609(0x95)](_0x19e609(0xad)+_0x5a6819[_0x19e609(0xb2)]),_0x5a6819[_0x19e609(0xed)]&&console['error'](_0x19e609(0x9b)+_0x5a6819[_0x19e609(0xed)]),_0x5a6819[_0x19e609(0xeb)]&&console['error'](_0x19e609(0xcf)+_0x5a6819[_0x19e609(0xeb)]));if(_0x5a6819['type']==='parent'){const _0xd7bc8b=await withSpinner(_0x19e609(0x111),()=>_0x527fe2[_0x19e609(0xde)][_0x19e609(0x101)](_0x5a6819[_0x19e609(0xb2)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0xd7bc8b[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xbb)){if(!_0x5a6819[_0x19e609(0xed)])throw new SDKError(ErrorCode[_0x19e609(0xb9)],_0x19e609(0x103));const _0x194064=await withSpinner(_0x19e609(0x10e),()=>_0x527fe2[_0x19e609(0xde)]['getFolder'](_0x5a6819[_0x19e609(0xed)]),{'verbose':_0x5b5bc4[_0x19e609(0xab)]});await handleSingleObjectOutput(_0x194064[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xde)){if(!_0x5a6819[_0x19e609(0xeb)])throw new SDKError(ErrorCode[_0x19e609(0xd9)],_0x19e609(0xc6));const _0x1e0652=await withSpinner(_0x19e609(0x11d),()=>_0x527fe2['segment'][_0x19e609(0xa1)](_0x5a6819['parentId'],_0x5a6819[_0x19e609(0xeb)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0x1e0652['data'],_0x5b5bc4);}}}return 0x0;}catch(_0x246621){if(_0x246621 instanceof SDKError)return console[_0x19e609(0x95)]('Error:\x20'+_0x246621[_0x19e609(0xf7)]),_0x246621[_0x19e609(0x110)]&&console[_0x19e609(0x95)](_0x19e609(0x127)+_0x246621[_0x19e609(0x110)]),0x1;throw _0x246621;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xd3);[a37_0x135c14(0x122)]=a37_0x135c14(0xd1);async[a37_0x135c14(0xa4)](_0x347585){const _0x3ccce9=a37_0x135c14,{options:_0x3e2994,args:_0x5b3f53,tdx:_0x4625eb}=_0x347585,_0x92fbc3=_0x5b3f53[0x0];if(!_0x92fbc3)return console['error'](_0x3ccce9(0x102)),console['error'](_0x3ccce9(0xd0)),console[_0x3ccce9(0x95)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3ccce9(0x95)](_0x3ccce9(0xf0)),console[_0x3ccce9(0x95)](_0x3ccce9(0xef)),console[_0x3ccce9(0x95)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2e92d2=_0x3e2994[_0x3ccce9(0x108)],_0x5befcb=await resolveSegmentTarget(_0x92fbc3,_0x2e92d2,_0x3e2994[_0x3ccce9(0xab)]);_0x3e2994['verbose']&&console[_0x3ccce9(0x95)]('Target\x20path:\x20'+_0x5befcb);const _0x45282b=await withSpinner('Resolving\x20\x27'+_0x92fbc3+_0x3ccce9(0xf4),()=>_0x4625eb['segment'][_0x3ccce9(0xc2)](_0x5befcb),{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0xce14e3=_0x45282b[_0x3ccce9(0x10c)];_0x3e2994[_0x3ccce9(0xab)]&&(console[_0x3ccce9(0x95)](_0x3ccce9(0xc8)+_0xce14e3[_0x3ccce9(0xc5)]),console[_0x3ccce9(0x95)](_0x3ccce9(0xad)+_0xce14e3['parentId']));if(_0xce14e3[_0x3ccce9(0xc5)]==='folder')return console['error'](_0x3ccce9(0x126)),console['error'](_0x3ccce9(0xda)),0x1;if(_0xce14e3['type']===_0x3ccce9(0x104))return console['error'](_0x3ccce9(0x107)),console[_0x3ccce9(0x95)](_0x3ccce9(0x116)),0x1;if(!_0xce14e3[_0x3ccce9(0xeb)])throw new SDKError(ErrorCode[_0x3ccce9(0xd9)],_0x3ccce9(0xc6));const _0x413bc7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4625eb[_0x3ccce9(0xde)][_0x3ccce9(0x106)](_0xce14e3[_0x3ccce9(0xb2)],_0xce14e3[_0x3ccce9(0xeb)]),{'verbose':_0x3e2994[_0x3ccce9(0xab)]});let _0x2c5244=_0x413bc7[_0x3ccce9(0x10c)];const _0xf9ff34=resolveLimit(_0x3e2994[_0x3ccce9(0xfa)],DEFAULT_DISPLAY_LIMIT),_0x4e0a0e=/\bLIMIT\s+\d+/i[_0x3ccce9(0xc3)](_0x2c5244);!_0x4e0a0e&&(_0x2c5244=_0x2c5244['trim']()[_0x3ccce9(0x129)](/;+$/,''),_0x2c5244='SELECT\x20*\x20FROM\x20(\x0a'+_0x2c5244+_0x3ccce9(0x12d)+_0xf9ff34);_0x3e2994[_0x3ccce9(0xab)]&&console[_0x3ccce9(0x95)](_0x3ccce9(0xbc)+_0x2c5244);const _0x3b1bfa=await withProgressSpinner('Executing\x20segment\x20query...',async _0xae1626=>{const _0x5d4f30=_0x3ccce9,_0x4482bc=await _0x4625eb[_0x5d4f30(0xb3)]['execute'](_0x2c5244,{'catalog':'td','schema':_0x5d4f30(0x114),'onJobId':_0x510e5f=>{_0xae1626['setJobId'](_0x510e5f);}});return _0x4482bc;},{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0x1cdcf7=_0x3b1bfa[_0x3ccce9(0x10c)],_0x26e949=_0x1cdcf7[_0x3ccce9(0x12a)]?_0x3ccce9(0xd2)+_0x1cdcf7[_0x3ccce9(0x12a)]+']':'';return console['error'](_0x3ccce9(0xb6)+_0x1cdcf7[_0x3ccce9(0x100)][_0x3ccce9(0x131)][_0x3ccce9(0x94)]()+_0x3ccce9(0xa3)+(_0x3ccce9(0xe0)+formatElapsed(_0x1cdcf7['stats'][_0x3ccce9(0xe6)])+_0x26e949)),await handleQueryOutput(_0x1cdcf7,_0x3e2994),0x0;}catch(_0x6f545b){if(_0x6f545b instanceof SDKError)return console[_0x3ccce9(0x95)]('✖\x20Query\x20failed\x20['+_0x6f545b[_0x3ccce9(0xdf)]+']'),console[_0x3ccce9(0x95)]('\x0a'+_0x6f545b[_0x3ccce9(0xf7)]),0x1;throw _0x6f545b;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x135c14(0xbd);[a37_0x135c14(0x122)]=a37_0x135c14(0x112);async['execute'](_0x5060a0){const _0x4830bc=a37_0x135c14,{options:_0x2e1217,args:_0x2555fa,tdx:_0x363a23}=_0x5060a0;if(_0x2555fa[_0x4830bc(0x119)]===0x0)return console[_0x4830bc(0x95)](_0x4830bc(0xa9)),console[_0x4830bc(0x95)](_0x4830bc(0xfb)),0x1;const _0x5bc2cd=_0x2555fa[0x0];try{_0x2e1217[_0x4830bc(0xab)]&&(console[_0x4830bc(0x95)](_0x4830bc(0xb0)+_0x2e1217['site']),console[_0x4830bc(0x95)]('Parent\x20name:\x20'+_0x5bc2cd));const _0x520085=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5bc2cd+_0x4830bc(0xf4),()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x12c)](_0x5bc2cd),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0x82e30f=_0x520085['data'];_0x2e1217[_0x4830bc(0xab)]&&console[_0x4830bc(0x95)](_0x4830bc(0x123)+_0x82e30f);const _0x167f2f=await withSpinner(_0x4830bc(0xb1)+_0x5bc2cd+'\x27...',()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x11b)](_0x82e30f),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0xfba079=_0x167f2f[_0x4830bc(0x10c)];return console[_0x4830bc(0x95)]('✔\x20Found\x20'+_0xfba079['length']+_0x4830bc(0x113)+(_0xfba079['length']!==0x1?'s':'')),await handleSDKOutput(_0xfba079,_0x2e1217),0x0;}catch(_0x43fb11){if(_0x43fb11 instanceof SDKError)return console[_0x4830bc(0x95)](_0x4830bc(0x109)+_0x43fb11[_0x4830bc(0xf7)]),_0x43fb11[_0x4830bc(0x110)]&&console[_0x4830bc(0x95)](_0x4830bc(0x127)+_0x43fb11[_0x4830bc(0x110)]),0x1;throw _0x43fb11;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:show';[a37_0x135c14(0x122)]=a37_0x135c14(0xd5);async['execute'](_0x34db96){const _0x154608=a37_0x135c14,{options:_0x43908b,args:_0x326d87,tdx:_0x57f3f6}=_0x34db96;if(_0x326d87[_0x154608(0x119)]===0x0)return console[_0x154608(0x95)](_0x154608(0xea)),console[_0x154608(0x95)](_0x154608(0xc0)),0x1;try{const {parentId:_0xaacb3d,childId:_0x2fe575}=parseSegmentRef(_0x326d87[0x0]);_0x43908b['verbose']&&(console['error'](_0x154608(0xb0)+_0x43908b[_0x154608(0xe4)]),console['error'](_0x154608(0x128)+_0xaacb3d),_0x2fe575&&console[_0x154608(0x95)](_0x154608(0x11c)+_0x2fe575));if(!_0x2fe575)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x584b87=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xaacb3d+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x12c)](_0xaacb3d),{'verbose':_0x43908b[_0x154608(0xab)]}),_0x3432fd=_0x584b87[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console['error'](_0x154608(0x123)+_0x3432fd);const _0x545553=await withSpinner(_0x154608(0xcb)+_0x2fe575+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0xd8)](_0x3432fd,_0x2fe575),{'verbose':_0x43908b[_0x154608(0xab)]}),_0xf8804b=_0x545553[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console[_0x154608(0x95)](_0x154608(0xae)+_0xf8804b);const _0x21ed24=await withSpinner('Fetching\x20folder\x20\x27'+_0x2fe575+_0x154608(0xf4),()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x105)](_0xf8804b),{'verbose':_0x43908b['verbose']});return await handleSDKOutput([_0x21ed24[_0x154608(0x10c)]],_0x43908b),0x0;}catch(_0x593171){if(_0x593171 instanceof SDKError)return console[_0x154608(0x95)](_0x154608(0x109)+_0x593171['message']),_0x593171[_0x154608(0x110)]&&console[_0x154608(0x95)](_0x154608(0x127)+_0x593171[_0x154608(0x110)]),0x1;throw _0x593171;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x135c14(0xcd);[a37_0x135c14(0x122)]=a37_0x135c14(0xf9);async['execute'](_0x4c8e91){const _0x594cee=a37_0x135c14,{options:_0x1619f2,args:_0x36bd84}=_0x4c8e91,_0x262e19=_0x1619f2,_0x42932f=_0x262e19[_0x594cee(0x117)],_0x29aaf4=_0x36bd84[0x0];if(!_0x29aaf4&&!_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0xaa))),console['error'](_0x594cee(0x93)),console[_0x594cee(0x95)](_0x594cee(0x10d)),console[_0x594cee(0x95)](_0x594cee(0xb7)),console[_0x594cee(0x95)](_0x594cee(0xf0)),console[_0x594cee(0x95)](_0x594cee(0x130)),console[_0x594cee(0x95)](_0x594cee(0xf1)),0x1;if(_0x29aaf4&&_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0x12e))),0x1;try{let _0x34ff1a;if(_0x42932f)_0x34ff1a=await this[_0x594cee(0xac)](_0x42932f,_0x4c8e91);else{if(isYamlFilePath(_0x29aaf4))return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x594cee(0x95)](_0x594cee(0x121)+_0x29aaf4),0x1;else _0x34ff1a=await this['getSQLFromServerSegment'](_0x29aaf4,_0x4c8e91);}return _0x1619f2[_0x594cee(0x9c)]===_0x594cee(0x99)||_0x1619f2[_0x594cee(0x9c)]==='jsonl'?await handleSDKOutput([{'sql':_0x34ff1a}],_0x1619f2):console['log'](_0x34ff1a),0x0;}catch(_0x42c366){if(_0x42c366 instanceof SDKError)return console[_0x594cee(0x95)](_0x594cee(0x109)+_0x42c366[_0x594cee(0xf7)]),_0x42c366[_0x594cee(0x110)]&&console[_0x594cee(0x95)](_0x594cee(0x127)+_0x42c366[_0x594cee(0x110)]),0x1;throw _0x42c366;}}async[a37_0x135c14(0xac)](_0x3bf8ed,_0x4d7fd0){const _0x2d8bb9=a37_0x135c14,{options:_0x3a5153,tdx:_0x33b3fc}=_0x4d7fd0;let _0x4d6862;try{_0x4d6862=await resolveYamlFilePath(_0x3bf8ed);}catch(_0x130331){throw new SDKError(ErrorCode[_0x2d8bb9(0xcc)],_0x2d8bb9(0xb4)+_0x130331['message']);}_0x3a5153[_0x2d8bb9(0xab)]&&console[_0x2d8bb9(0x95)]('Resolved:\x20'+_0x4d6862['parentSegment']+'/'+_0x4d6862[_0x2d8bb9(0x9a)]);const _0x4b1657=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x33b3fc[_0x2d8bb9(0xde)][_0x2d8bb9(0xc1)](_0x4d6862[_0x2d8bb9(0xec)],_0x4d6862[_0x2d8bb9(0x108)],_0x4d6862[_0x2d8bb9(0x9a)]),{'verbose':_0x3a5153['verbose']});return _0x4b1657[_0x2d8bb9(0x10c)];}async[a37_0x135c14(0xfd)](_0x40a957,_0x5428e0){const _0x3dfb15=a37_0x135c14,{options:_0x24146e,tdx:_0x1b1a55}=_0x5428e0,_0x531169=_0x24146e['parentSegment'],_0x1d944e=await resolveSegmentTarget(_0x40a957,_0x531169,_0x24146e[_0x3dfb15(0xab)]);_0x24146e['verbose']&&console[_0x3dfb15(0x95)](_0x3dfb15(0x10a)+_0x1d944e);const _0x26135b=await withSpinner(_0x3dfb15(0x124)+_0x40a957+_0x3dfb15(0xf4),()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0xc2)](_0x1d944e),{'verbose':_0x24146e['verbose']}),_0x5f135f=_0x26135b['data'];_0x24146e['verbose']&&(console['error'](_0x3dfb15(0xc8)+_0x5f135f[_0x3dfb15(0xc5)]),console[_0x3dfb15(0x95)]('Parent\x20ID:\x20'+_0x5f135f[_0x3dfb15(0xb2)]));if(_0x5f135f[_0x3dfb15(0xc5)]===_0x3dfb15(0xbb))throw new SDKError(ErrorCode[_0x3dfb15(0xcc)],_0x3dfb15(0x9d));if(_0x5f135f[_0x3dfb15(0xc5)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x5f135f[_0x3dfb15(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3d232e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0x106)](_0x5f135f['parentId'],_0x5f135f[_0x3dfb15(0xeb)]),{'verbose':_0x24146e[_0x3dfb15(0xab)]});return _0x3d232e[_0x3dfb15(0x10c)];}}function a37_0x4cbb(){const _0x3373bd=['Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Cause:\x20','Parent\x20name:\x20','replace','jobId','Show\x20segment\x20or\x20folder\x20details','resolveParentId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','processedRows','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','652392DbYtbh','Usage:','toLocaleString','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','json','segmentName','Folder\x20ID:\x20','format','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','name','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','(root)','getSegment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20rows\x20','execute','Resolving\x20parent\x20segment\x20\x27','url','8HXtPum','Resolving\x20path\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','verbose','getSQLFromYamlFile','Parent\x20ID:\x20','Resolved\x20folder\x20ID:\x20','Creating\x20folder\x20\x27','Site:\x20','Listing\x20folders\x20for\x20parent\x20\x27','parentId','query','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Folder\x20path:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','14CDwLUx','SEGMENT_FOLDER_NOT_FOUND','segmentPath','folder','SQL\x20query:\x0a','segment:folder:list','\x27\x20with\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','getSegmentSQLFromYaml','resolvePathToResource','test','8942589EPXXpw','type','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20type:\x20','551802sbtYwm','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20folder\x20\x27','INVALID_ARGUMENT','segment:sql','/app/ps/','Segment\x20ID:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20[Job\x20ID:\x20','segment:show','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','createFolder','resolveFolderId','SEGMENT_NOT_FOUND','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','8902zgPILN','red','fullPath','segment','code','in\x20','cyan','318330sCkmLT','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','site','4467568hWTPcO','elapsedTimeMillis','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20reference\x20is\x20required','segmentId','content','folderId','green','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Examples:','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','\x27...','folderPath','Resolving\x20parent\x20folder\x20\x27','message','/e/','Get\x20SQL\x20query\x20for\x20child\x20segment','limit','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:desc','getSQLFromServerSegment','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','284ODEqWh','stats','getParent','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','parent','getFolder','getSegmentSQL','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentSegment','Error:\x20','Target\x20path:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','data','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20folder\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','cause','Fetching\x20parent\x20segment\x20details...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20folder','information_schema','Show\x20folder\x20or\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20show','path','Use:\x20tdx\x20ps\x20desc','length','segment:view','listFolders','Folder\x20name:\x20','Fetching\x20segment\x20details...','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','description','Resolved\x20parent\x20ID:\x20','Resolving\x20\x27','\x20\x20Parent\x20segment:\x20'];a37_0x4cbb=function(){return _0x3373bd;};return a37_0x4cbb();}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:create';[a37_0x135c14(0x122)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x135c14(0xa4)](_0x15fc5c){const _0x1e146b=a37_0x135c14,{options:_0x1e87a6,args:_0x5ad6e2,tdx:_0x5e290b}=_0x15fc5c,_0x3cb669=_0x1e87a6;if(_0x5ad6e2[_0x1e146b(0x119)]<0x2)return console['error'](_0x1e146b(0x11f)),console['error'](_0x1e146b(0x97)),0x1;const _0x44cdb6=_0x5ad6e2[0x0],_0xd9dc6c=_0x5ad6e2[0x1];_0x3cb669[_0x1e146b(0xab)]&&(console[_0x1e146b(0x95)](_0x1e146b(0xb0)+_0x3cb669['site']),console[_0x1e146b(0x95)](_0x1e146b(0x12f)+_0x44cdb6),console[_0x1e146b(0x95)]('Folder\x20name:\x20'+_0xd9dc6c));let _0x4554ee;if(_0x3cb669[_0x1e146b(0xe8)]){const _0x42fbef=_0x3cb669[_0x1e146b(0xe8)],_0x4a6319=await withSpinner(_0x1e146b(0xa5)+_0x44cdb6+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0x12c)](_0x44cdb6),{'verbose':_0x3cb669['verbose']}),_0x1119b5=_0x4a6319[_0x1e146b(0x10c)],_0x142cfb=await withSpinner(_0x1e146b(0xf6)+_0x42fbef+_0x1e146b(0xf4),()=>_0x5e290b['segment'][_0x1e146b(0xd8)](_0x1119b5,_0x42fbef),{'verbose':_0x3cb669[_0x1e146b(0xab)]});_0x4554ee=_0x142cfb['data'],_0x3cb669['verbose']&&console[_0x1e146b(0x95)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4554ee);}const _0xf1f2d0={'name':_0xd9dc6c,'description':_0x3cb669[_0x1e146b(0x122)],'parentFolderId':_0x4554ee},_0xbd8c86=await withSpinner(_0x1e146b(0xaf)+_0xd9dc6c+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0xd7)](_0x44cdb6,_0xf1f2d0),{'verbose':_0x3cb669[_0x1e146b(0xab)]}),_0x39ce70=_0xbd8c86[_0x1e146b(0x10c)];return console[_0x1e146b(0x95)]('✔\x20Created\x20folder\x20\x27'+_0x39ce70['name']+_0x1e146b(0xbe)+_0x39ce70['id']),await handleSDKOutput([_0x39ce70],_0x3cb669),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x135c14(0x11a);[a37_0x135c14(0x122)]=a37_0x135c14(0x115);async[a37_0x135c14(0xa4)](_0x1b6047){const _0x34091e=a37_0x135c14,{options:_0x2f4724,args:_0x32d6a3,tdx:_0x2a9a78}=_0x1b6047,_0x2f50d2=_0x32d6a3[0x0];if(!_0x2f50d2)return console['error'](_0x34091e(0x9f)),console[_0x34091e(0x95)](_0x34091e(0x132)),console[_0x34091e(0x95)](_0x34091e(0x96)),console[_0x34091e(0x95)]('Options:'),console[_0x34091e(0x95)](_0x34091e(0x10f)),console[_0x34091e(0x95)](_0x34091e(0xf0)),console[_0x34091e(0x95)](_0x34091e(0x98)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x34091e(0x95)](_0x34091e(0xe3)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2dd449=_0x2f4724[_0x34091e(0x108)],_0x4d2a0a=await resolveSegmentTarget(_0x2f50d2,_0x2dd449,_0x2f4724[_0x34091e(0xab)]);_0x2f4724[_0x34091e(0xab)]&&console['error'](_0x34091e(0x10a)+_0x4d2a0a);const _0x367076=await withSpinner(_0x34091e(0x124)+_0x2f50d2+_0x34091e(0xf4),()=>_0x2a9a78['segment'][_0x34091e(0xc2)](_0x4d2a0a),{'verbose':_0x2f4724[_0x34091e(0xab)]}),_0x1f341b=_0x367076[_0x34091e(0x10c)];_0x2f4724[_0x34091e(0xab)]&&(console[_0x34091e(0x95)](_0x34091e(0xc8)+_0x1f341b[_0x34091e(0xc5)]),console['error'](_0x34091e(0xad)+_0x1f341b['parentId']),_0x1f341b[_0x34091e(0xed)]&&console['error'](_0x34091e(0x9b)+_0x1f341b[_0x34091e(0xed)]),_0x1f341b[_0x34091e(0xeb)]&&console[_0x34091e(0x95)](_0x34091e(0xcf)+_0x1f341b[_0x34091e(0xeb)]));if(_0x2f4724['web']){if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb))return console[_0x34091e(0x95)](_0x34091e(0x11e)),0x1;if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0x104))return console[_0x34091e(0x95)](_0x34091e(0xf2)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x1f341b[_0x34091e(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1ed6cb=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]);return console['error'](a37_0x451b3d[_0x34091e(0xee)]('✔')+'\x20Opening\x20'+a37_0x451b3d[_0x34091e(0xe1)](_0x1ed6cb)),openBrowser(_0x1ed6cb),0x0;}if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb)){if(!_0x1f341b[_0x34091e(0xed)])throw new SDKError(ErrorCode[_0x34091e(0xb9)],_0x34091e(0x103));const _0x2c25a6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2a9a78[_0x34091e(0xde)][_0x34091e(0x105)](_0x1f341b[_0x34091e(0xed)]),{'verbose':_0x2f4724[_0x34091e(0xab)]});await handleSingleObjectOutput(_0x2c25a6[_0x34091e(0x10c)],_0x2f4724);}else{if(_0x1f341b['type']===_0x34091e(0xde)){if(!_0x1f341b['segmentId'])throw new SDKError(ErrorCode[_0x34091e(0xd9)],_0x34091e(0xc6));const _0x20f614=await withSpinner(_0x34091e(0x11d),()=>_0x2a9a78[_0x34091e(0xde)]['getSegment'](_0x1f341b['parentId'],_0x1f341b[_0x34091e(0xeb)]),{'verbose':_0x2f4724['verbose']}),_0x10a6ba=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]),_0x1517d0=_0x20f614[_0x34091e(0x10c)];_0x1517d0[_0x34091e(0xa6)]=_0x10a6ba,await handleSingleObjectOutput(_0x1517d0,_0x2f4724);}else return console[_0x34091e(0x95)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x34091e(0x95)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x3da509){if(_0x3da509 instanceof SDKError)return console['error'](_0x34091e(0x109)+_0x3da509['message']),_0x3da509[_0x34091e(0x110)]&&console[_0x34091e(0x95)](_0x34091e(0x127)+_0x3da509[_0x34091e(0x110)]),0x1;throw _0x3da509;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xfc);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x135c14(0xa4)](_0x430754){const _0x59a29b=a37_0x135c14,{options:_0x4d2ecf,args:_0x2cdaa0,tdx:_0x4f48e2}=_0x430754,_0x23850c=_0x2cdaa0[0x0];if(!_0x23850c)return console[_0x59a29b(0x95)](_0x59a29b(0x102)),console[_0x59a29b(0x95)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x59a29b(0x95)](_0x59a29b(0xe7)),console['error']('Examples:'),console[_0x59a29b(0x95)](_0x59a29b(0xfe)),console[_0x59a29b(0x95)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1ec146=_0x4d2ecf['parentSegment'],_0x10019c=await resolveSegmentTarget(_0x23850c,_0x1ec146,_0x4d2ecf[_0x59a29b(0xab)]);_0x4d2ecf['verbose']&&console[_0x59a29b(0x95)](_0x59a29b(0x10a)+_0x10019c);const _0x21f150=await withSpinner('Resolving\x20\x27'+_0x23850c+'\x27...',()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0xc2)](_0x10019c),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x595335=_0x21f150['data'];_0x4d2ecf[_0x59a29b(0xab)]&&(console['error'](_0x59a29b(0xc8)+_0x595335[_0x59a29b(0xc5)]),console['error']('Parent\x20ID:\x20'+_0x595335['parentId']));if(_0x595335[_0x59a29b(0xc5)]==='folder')return console[_0x59a29b(0x95)](_0x59a29b(0xc7)),console[_0x59a29b(0x95)](_0x59a29b(0xd4)),0x1;if(_0x595335[_0x59a29b(0xc5)]==='parent')return console[_0x59a29b(0x95)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x59a29b(0x95)](_0x59a29b(0x118)),0x1;if(!_0x595335[_0x59a29b(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x59a29b(0xc6));const _0xaeba9d=await withSpinner(_0x59a29b(0xf3),()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0x106)](_0x595335[_0x59a29b(0xb2)],_0x595335[_0x59a29b(0xeb)]),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x3b014d=_0xaeba9d[_0x59a29b(0x10c)],_0x5d1a79=await executeSchemaQuery(_0x3b014d,_0x4f48e2,_0x4d2ecf);return await handleQueryOutput(_0x5d1a79,_0x4d2ecf),0x0;}catch(_0x5f2929){if(_0x5f2929 instanceof SDKError)return console[_0x59a29b(0x95)](_0x59a29b(0x109)+_0x5f2929[_0x59a29b(0xf7)]),_0x5f2929[_0x59a29b(0x110)]&&console['error'](_0x59a29b(0x127)+_0x5f2929[_0x59a29b(0x110)]),0x1;throw _0x5f2929;}}}
|
|
1
|
+
const a37_0x1e4106=a37_0x2edb;(function(_0x598719,_0x1717be){const _0xff9d05=a37_0x2edb,_0x2907cb=_0x598719();while(!![]){try{const _0x3b6ee6=parseInt(_0xff9d05(0x13f))/0x1+parseInt(_0xff9d05(0xe0))/0x2*(-parseInt(_0xff9d05(0xf0))/0x3)+-parseInt(_0xff9d05(0xfa))/0x4*(-parseInt(_0xff9d05(0x110))/0x5)+-parseInt(_0xff9d05(0xcd))/0x6+parseInt(_0xff9d05(0xfb))/0x7+-parseInt(_0xff9d05(0xb8))/0x8*(-parseInt(_0xff9d05(0x11f))/0x9)+-parseInt(_0xff9d05(0x108))/0xa*(-parseInt(_0xff9d05(0x11b))/0xb);if(_0x3b6ee6===_0x1717be)break;else _0x2907cb['push'](_0x2907cb['shift']());}catch(_0xcab3a4){_0x2907cb['push'](_0x2907cb['shift']());}}}(a37_0x4473,0x2a670));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x2edb(_0x39ba8a,_0x1f22a2){_0x39ba8a=_0x39ba8a-0xa8;const _0x44736a=a37_0x4473();let _0x2edbbc=_0x44736a[_0x39ba8a];return _0x2edbbc;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x592c44 from'chalk';async function resolveSegmentTarget(_0x2fb4c1,_0x80571f,_0x4e7b30){const _0x4a89f7=a37_0x2edb;if(isYamlFilePath(_0x2fb4c1))try{const _0x3d22cd=await resolveYamlFilePath(_0x2fb4c1);return _0x4e7b30&&(console[_0x4a89f7(0x12b)]('Resolved\x20YAML\x20file:\x20'+_0x2fb4c1),console[_0x4a89f7(0x12b)](_0x4a89f7(0xe4)+_0x3d22cd['parentSegment']),console[_0x4a89f7(0x12b)](_0x4a89f7(0x125)+_0x3d22cd[_0x4a89f7(0x122)]),console[_0x4a89f7(0x12b)]('\x20\x20Folder\x20path:\x20'+(_0x3d22cd['folderPath']||'(root)')),console[_0x4a89f7(0x12b)]('\x20\x20Full\x20path:\x20'+_0x3d22cd[_0x4a89f7(0x10b)])),_0x3d22cd['fullPath'];}catch(_0x153643){throw new SDKError(ErrorCode[_0x4a89f7(0x115)],_0x4a89f7(0xe5)+_0x153643[_0x4a89f7(0x134)]);}if(!_0x80571f)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a89f7(0xed));return _0x80571f+'/'+_0x2fb4c1;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x1e4106(0xef);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0xda);async[a37_0x1e4106(0xb2)](_0xf679c9){const _0x110414=a37_0x1e4106,{options:_0x4ad30e,args:_0x1b7725,tdx:_0x4a31d1}=_0xf679c9,_0x53a68c=_0x1b7725[0x0],_0xb51322=!_0x53a68c&&!!_0x4ad30e[_0x110414(0xae)],_0x59d050=_0x53a68c||_0x4ad30e[_0x110414(0xae)];if(!_0x59d050)return console['error'](_0x110414(0xba)),console[_0x110414(0x12b)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x110414(0x12b)](_0x110414(0xc5)),console[_0x110414(0x12b)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x110414(0x12b)](_0x110414(0x116)),console[_0x110414(0x12b)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x18bc30=_0x4ad30e[_0x110414(0x106)];let _0x1421a6=_0x59d050;!_0xb51322&&_0x18bc30&&!_0x59d050[_0x110414(0xd9)]('/')&&(_0x1421a6=_0x18bc30+'/'+_0x59d050,_0x4ad30e[_0x110414(0xe9)]&&console[_0x110414(0x12b)](_0x110414(0x13e)+_0x1421a6));const _0x5e5a71=await withSpinner(_0x110414(0x120)+_0x1421a6+_0x110414(0x133),()=>_0x4a31d1['segment'][_0x110414(0xdb)](_0x1421a6),{'verbose':_0x4ad30e[_0x110414(0xe9)]}),_0xeec37e=_0x5e5a71[_0x110414(0xb1)];_0x4ad30e['verbose']&&(console['error'](_0x110414(0x13c)+_0xeec37e[_0x110414(0x138)]),console[_0x110414(0x12b)](_0x110414(0x11a)+_0xeec37e[_0x110414(0xac)]),_0xeec37e[_0x110414(0xfc)]&&console[_0x110414(0x12b)]('Folder\x20ID:\x20'+_0xeec37e[_0x110414(0xfc)]),_0xeec37e[_0x110414(0xff)]&&console[_0x110414(0x12b)](_0x110414(0x12a)+_0xeec37e[_0x110414(0xff)]));if(_0xeec37e[_0x110414(0x138)]===_0x110414(0x130)){const _0x3113e2=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x4a31d1['segment']['getParent'](_0xeec37e[_0x110414(0xac)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x3113e2['data'],_0x4ad30e);}else{if(_0xeec37e[_0x110414(0x138)]===_0x110414(0x11d)){if(!_0xeec37e['folderId'])throw new SDKError(ErrorCode[_0x110414(0xcf)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x165f99=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4a31d1['segment']['getFolder'](_0xeec37e[_0x110414(0xfc)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x165f99['data'],_0x4ad30e);}else{if(_0xeec37e[_0x110414(0x138)]===_0x110414(0xf1)){if(!_0xeec37e[_0x110414(0xff)])throw new SDKError(ErrorCode[_0x110414(0xbb)],_0x110414(0xe7));const _0x41a5b2=await withSpinner(_0x110414(0xe3),()=>_0x4a31d1[_0x110414(0xf1)][_0x110414(0xaf)](_0xeec37e[_0x110414(0xac)],_0xeec37e[_0x110414(0xff)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x41a5b2['data'],_0x4ad30e);}}}return 0x0;}catch(_0x4a1e3c){if(_0x4a1e3c instanceof SDKError)return console[_0x110414(0x12b)]('Error:\x20'+_0x4a1e3c[_0x110414(0x134)]),_0x4a1e3c[_0x110414(0xee)]&&console['error'](_0x110414(0xb9)+_0x4a1e3c[_0x110414(0xee)]),0x1;throw _0x4a1e3c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1e4106(0xb2)](_0x12a763){const _0x1c6b70=a37_0x1e4106,{options:_0x5c0ef3,args:_0x51fbe8,tdx:_0x3bae44}=_0x12a763,_0x174cc9=_0x51fbe8[0x0];if(!_0x174cc9)return console[_0x1c6b70(0x12b)](_0x1c6b70(0xb7)),console[_0x1c6b70(0x12b)](_0x1c6b70(0xc9)),console[_0x1c6b70(0x12b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x1c6b70(0x12b)](_0x1c6b70(0xc5)),console[_0x1c6b70(0x12b)](_0x1c6b70(0x11e)),console['error'](_0x1c6b70(0xbe)),0x1;try{const _0x959127=_0x5c0ef3[_0x1c6b70(0xae)],_0x5b25db=await resolveSegmentTarget(_0x174cc9,_0x959127,_0x5c0ef3[_0x1c6b70(0xe9)]);_0x5c0ef3[_0x1c6b70(0xe9)]&&console['error'](_0x1c6b70(0x113)+_0x5b25db);const _0x23f080=await withSpinner(_0x1c6b70(0xea)+_0x174cc9+_0x1c6b70(0x133),()=>_0x3bae44[_0x1c6b70(0xf1)][_0x1c6b70(0xdb)](_0x5b25db),{'verbose':_0x5c0ef3['verbose']}),_0x460b75=_0x23f080[_0x1c6b70(0xb1)];_0x5c0ef3[_0x1c6b70(0xe9)]&&(console[_0x1c6b70(0x12b)](_0x1c6b70(0x13c)+_0x460b75['type']),console['error'](_0x1c6b70(0x11a)+_0x460b75[_0x1c6b70(0xac)]));if(_0x460b75[_0x1c6b70(0x138)]===_0x1c6b70(0x11d))return console[_0x1c6b70(0x12b)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x1c6b70(0xbd)),0x1;if(_0x460b75[_0x1c6b70(0x138)]===_0x1c6b70(0x130))return console[_0x1c6b70(0x12b)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1c6b70(0x12b)](_0x1c6b70(0xd8)),0x1;if(!_0x460b75[_0x1c6b70(0xff)])throw new SDKError(ErrorCode[_0x1c6b70(0xbb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c1786=await withSpinner(_0x1c6b70(0xbf),()=>_0x3bae44[_0x1c6b70(0xf1)][_0x1c6b70(0x10f)](_0x460b75[_0x1c6b70(0xac)],_0x460b75[_0x1c6b70(0xff)]),{'verbose':_0x5c0ef3['verbose']});let _0x3a0072=_0x5c1786[_0x1c6b70(0xb1)];const _0x280ea9=resolveLimit(_0x5c0ef3['limit'],DEFAULT_DISPLAY_LIMIT),_0x51145a=/\bLIMIT\s+\d+/i[_0x1c6b70(0x10e)](_0x3a0072);!_0x51145a&&(_0x3a0072=_0x3a0072[_0x1c6b70(0xf8)]()['replace'](/;+$/,''),_0x3a0072=_0x1c6b70(0x11c)+_0x3a0072+_0x1c6b70(0xf7)+_0x280ea9);_0x5c0ef3[_0x1c6b70(0xe9)]&&console[_0x1c6b70(0x12b)](_0x1c6b70(0xb4)+_0x3a0072);const _0x31eb88=await withProgressSpinner('Executing\x20segment\x20query...',async _0x225b71=>{const _0x1c439e=_0x1c6b70,_0xa0040f=await _0x3bae44[_0x1c439e(0x107)]['execute'](_0x3a0072,{'catalog':'td','schema':'information_schema','onJobId':_0x55a4d0=>{_0x225b71['setJobId'](_0x55a4d0);}});return _0xa0040f;},{'verbose':_0x5c0ef3[_0x1c6b70(0xe9)]}),_0x14caec=_0x31eb88[_0x1c6b70(0xb1)],_0x62b59c=_0x14caec['jobId']?_0x1c6b70(0xce)+_0x14caec[_0x1c6b70(0x112)]+']':'';return console[_0x1c6b70(0x12b)](_0x1c6b70(0xa8)+_0x14caec['stats'][_0x1c6b70(0xd1)][_0x1c6b70(0x10d)]()+'\x20rows\x20'+(_0x1c6b70(0xab)+formatElapsed(_0x14caec[_0x1c6b70(0x13b)]['elapsedTimeMillis'])+_0x62b59c)),await handleQueryOutput(_0x14caec,_0x5c0ef3),0x0;}catch(_0x4cab19){if(_0x4cab19 instanceof SDKError)return console['error'](_0x1c6b70(0xc8)+_0x4cab19[_0x1c6b70(0xf4)]+']'),console[_0x1c6b70(0x12b)]('\x0a'+_0x4cab19['message']),0x1;throw _0x4cab19;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0x102);[a37_0x1e4106(0xd6)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x573f5e){const _0xcfbf0d=a37_0x1e4106,{options:_0x2a8516,args:_0x559e8c,tdx:_0x14550d}=_0x573f5e;if(_0x559e8c[_0xcfbf0d(0xe6)]===0x0)return console[_0xcfbf0d(0x12b)](_0xcfbf0d(0x137)),console['error'](_0xcfbf0d(0xe2)),0x1;const _0x2713bc=_0x559e8c[0x0];try{_0x2a8516[_0xcfbf0d(0xe9)]&&(console[_0xcfbf0d(0x12b)]('Site:\x20'+_0x2a8516[_0xcfbf0d(0xe8)]),console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xb6)+_0x2713bc));const _0x4e6930=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2713bc+'\x27...',()=>_0x14550d[_0xcfbf0d(0xf1)][_0xcfbf0d(0xc4)](_0x2713bc),{'verbose':_0x2a8516[_0xcfbf0d(0xe9)]}),_0xc846f1=_0x4e6930['data'];_0x2a8516[_0xcfbf0d(0xe9)]&&console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xdc)+_0xc846f1);const _0x3e1c64=await withSpinner(_0xcfbf0d(0x12c)+_0x2713bc+_0xcfbf0d(0x133),()=>_0x14550d[_0xcfbf0d(0xf1)][_0xcfbf0d(0xeb)](_0xc846f1),{'verbose':_0x2a8516[_0xcfbf0d(0xe9)]}),_0xc5e2c3=_0x3e1c64[_0xcfbf0d(0xb1)];return console['error'](_0xcfbf0d(0xb3)+_0xc5e2c3[_0xcfbf0d(0xe6)]+'\x20folder'+(_0xc5e2c3[_0xcfbf0d(0xe6)]!==0x1?'s':'')),await handleSDKOutput(_0xc5e2c3,_0x2a8516),0x0;}catch(_0x20e397){if(_0x20e397 instanceof SDKError)return console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xc2)+_0x20e397[_0xcfbf0d(0x134)]),_0x20e397[_0xcfbf0d(0xee)]&&console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xb9)+_0x20e397['cause']),0x1;throw _0x20e397;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:folder:show';['description']=a37_0x1e4106(0x118);async['execute'](_0x294b1d){const _0x5abe5a=a37_0x1e4106,{options:_0x2fa7cd,args:_0x5e0dd1,tdx:_0x46915d}=_0x294b1d;if(_0x5e0dd1[_0x5abe5a(0xe6)]===0x0)return console[_0x5abe5a(0x12b)](_0x5abe5a(0x114)),console[_0x5abe5a(0x12b)](_0x5abe5a(0xd5)),0x1;try{const {parentId:_0x554a28,childId:_0x339ed5}=parseSegmentRef(_0x5e0dd1[0x0]);_0x2fa7cd[_0x5abe5a(0xe9)]&&(console['error'](_0x5abe5a(0x13d)+_0x2fa7cd[_0x5abe5a(0xe8)]),console[_0x5abe5a(0x12b)](_0x5abe5a(0xb6)+_0x554a28),_0x339ed5&&console[_0x5abe5a(0x12b)](_0x5abe5a(0xd7)+_0x339ed5));if(!_0x339ed5)return console[_0x5abe5a(0x12b)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2ba5ab=await withSpinner(_0x5abe5a(0x109)+_0x554a28+_0x5abe5a(0x133),()=>_0x46915d[_0x5abe5a(0xf1)]['resolveParentId'](_0x554a28),{'verbose':_0x2fa7cd[_0x5abe5a(0xe9)]}),_0xc7c696=_0x2ba5ab[_0x5abe5a(0xb1)];_0x2fa7cd[_0x5abe5a(0xe9)]&&console[_0x5abe5a(0x12b)](_0x5abe5a(0xdc)+_0xc7c696);const _0x3f7cb4=await withSpinner(_0x5abe5a(0x12e)+_0x339ed5+_0x5abe5a(0x133),()=>_0x46915d['segment'][_0x5abe5a(0xf5)](_0xc7c696,_0x339ed5),{'verbose':_0x2fa7cd['verbose']}),_0x441509=_0x3f7cb4[_0x5abe5a(0xb1)];_0x2fa7cd[_0x5abe5a(0xe9)]&&console[_0x5abe5a(0x12b)]('Resolved\x20folder\x20ID:\x20'+_0x441509);const _0x1b8ec4=await withSpinner(_0x5abe5a(0x105)+_0x339ed5+_0x5abe5a(0x133),()=>_0x46915d['segment'][_0x5abe5a(0xdd)](_0x441509),{'verbose':_0x2fa7cd[_0x5abe5a(0xe9)]});return await handleSDKOutput([_0x1b8ec4['data']],_0x2fa7cd),0x0;}catch(_0x2fdb52){if(_0x2fdb52 instanceof SDKError)return console[_0x5abe5a(0x12b)](_0x5abe5a(0xc2)+_0x2fdb52[_0x5abe5a(0x134)]),_0x2fdb52[_0x5abe5a(0xee)]&&console['error'](_0x5abe5a(0xb9)+_0x2fdb52[_0x5abe5a(0xee)]),0x1;throw _0x2fdb52;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:sql';[a37_0x1e4106(0xd6)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x1e4106(0xb2)](_0x3b04eb){const _0x132991=a37_0x1e4106,{options:_0x5ecd96,args:_0x5a5fd1}=_0x3b04eb,_0x1372a0=_0x5ecd96,_0xa88ea3=_0x1372a0[_0x132991(0xc1)],_0x31acd4=_0x5a5fd1[0x0];if(!_0x31acd4&&!_0xa88ea3)return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)](_0x132991(0x10c))),console['error'](_0x132991(0xd3)),console[_0x132991(0x12b)](_0x132991(0x131)),console[_0x132991(0x12b)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error']('Examples:'),console[_0x132991(0x12b)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console['error'](_0x132991(0x139)),0x1;if(_0x31acd4&&_0xa88ea3)return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)](_0x132991(0xcb))),0x1;try{let _0x3cdd98;if(_0xa88ea3)_0x3cdd98=await this[_0x132991(0xa9)](_0xa88ea3,_0x3b04eb);else{if(isYamlFilePath(_0x31acd4))return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x132991(0x12b)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x31acd4),0x1;else _0x3cdd98=await this[_0x132991(0x121)](_0x31acd4,_0x3b04eb);}return _0x5ecd96[_0x132991(0xd0)]==='json'||_0x5ecd96[_0x132991(0xd0)]===_0x132991(0xc0)?await handleSDKOutput([{'sql':_0x3cdd98}],_0x5ecd96):console[_0x132991(0xc3)](_0x3cdd98),0x0;}catch(_0x3ab241){if(_0x3ab241 instanceof SDKError)return console[_0x132991(0x12b)](_0x132991(0xc2)+_0x3ab241[_0x132991(0x134)]),_0x3ab241['cause']&&console['error'](_0x132991(0xb9)+_0x3ab241[_0x132991(0xee)]),0x1;throw _0x3ab241;}}async[a37_0x1e4106(0xa9)](_0x264fe8,_0x4ca051){const _0x4c5e51=a37_0x1e4106,{options:_0x177cc7,tdx:_0x2af967}=_0x4ca051;let _0x657118;try{_0x657118=await resolveYamlFilePath(_0x264fe8);}catch(_0x4e78aa){throw new SDKError(ErrorCode[_0x4c5e51(0x115)],_0x4c5e51(0xe5)+_0x4e78aa[_0x4c5e51(0x134)]);}_0x177cc7['verbose']&&console[_0x4c5e51(0x12b)](_0x4c5e51(0x129)+_0x657118[_0x4c5e51(0xae)]+'/'+_0x657118['segmentName']);const _0xe46f22=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x2af967[_0x4c5e51(0xf1)][_0x4c5e51(0x12d)](_0x657118['content'],_0x657118[_0x4c5e51(0xae)],_0x657118[_0x4c5e51(0x122)]),{'verbose':_0x177cc7[_0x4c5e51(0xe9)]});return _0xe46f22[_0x4c5e51(0xb1)];}async[a37_0x1e4106(0x121)](_0x237ef9,_0x2fe93a){const _0x36ae80=a37_0x1e4106,{options:_0x1bcf04,tdx:_0x3e7846}=_0x2fe93a,_0x2fe2ed=_0x1bcf04[_0x36ae80(0xae)],_0x50e9c0=await resolveSegmentTarget(_0x237ef9,_0x2fe2ed,_0x1bcf04[_0x36ae80(0xe9)]);_0x1bcf04[_0x36ae80(0xe9)]&&console[_0x36ae80(0x12b)]('Target\x20path:\x20'+_0x50e9c0);const _0x132472=await withSpinner(_0x36ae80(0xea)+_0x237ef9+_0x36ae80(0x133),()=>_0x3e7846[_0x36ae80(0xf1)][_0x36ae80(0xdb)](_0x50e9c0),{'verbose':_0x1bcf04[_0x36ae80(0xe9)]}),_0x32fba8=_0x132472[_0x36ae80(0xb1)];_0x1bcf04[_0x36ae80(0xe9)]&&(console[_0x36ae80(0x12b)](_0x36ae80(0x13c)+_0x32fba8[_0x36ae80(0x138)]),console['error'](_0x36ae80(0x11a)+_0x32fba8['parentId']));if(_0x32fba8[_0x36ae80(0x138)]===_0x36ae80(0x11d))throw new SDKError(ErrorCode[_0x36ae80(0x115)],_0x36ae80(0xd2));if(_0x32fba8['type']===_0x36ae80(0x130))throw new SDKError(ErrorCode[_0x36ae80(0x115)],_0x36ae80(0x10a));if(!_0x32fba8[_0x36ae80(0xff)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x36ae80(0xe7));const _0x1276ee=await withSpinner(_0x36ae80(0xbf),()=>_0x3e7846[_0x36ae80(0xf1)][_0x36ae80(0x10f)](_0x32fba8[_0x36ae80(0xac)],_0x32fba8[_0x36ae80(0xff)]),{'verbose':_0x1bcf04['verbose']});return _0x1276ee['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0xfd);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0xc7);async['execute'](_0x698129){const _0x228e2b=a37_0x1e4106,{options:_0x5de197,args:_0x4e58a1,tdx:_0x26531d}=_0x698129,_0x322879=_0x5de197;if(_0x4e58a1[_0x228e2b(0xe6)]<0x2)return console[_0x228e2b(0x12b)](_0x228e2b(0x123)),console[_0x228e2b(0x12b)](_0x228e2b(0x135)),0x1;const _0xaef46f=_0x4e58a1[0x0],_0x3771e4=_0x4e58a1[0x1];_0x322879[_0x228e2b(0xe9)]&&(console[_0x228e2b(0x12b)](_0x228e2b(0x13d)+_0x322879[_0x228e2b(0xe8)]),console[_0x228e2b(0x12b)]('Parent\x20segment:\x20'+_0xaef46f),console[_0x228e2b(0x12b)]('Folder\x20name:\x20'+_0x3771e4));let _0x29bc08;if(_0x322879[_0x228e2b(0x119)]){const _0x4df6f1=_0x322879['parentFolder'],_0x55ff63=await withSpinner(_0x228e2b(0x109)+_0xaef46f+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xc4)](_0xaef46f),{'verbose':_0x322879[_0x228e2b(0xe9)]}),_0x18a441=_0x55ff63[_0x228e2b(0xb1)],_0x5a984a=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x4df6f1+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xf5)](_0x18a441,_0x4df6f1),{'verbose':_0x322879[_0x228e2b(0xe9)]});_0x29bc08=_0x5a984a['data'],_0x322879[_0x228e2b(0xe9)]&&console[_0x228e2b(0x12b)](_0x228e2b(0xb5)+_0x29bc08);}const _0xf009c9={'name':_0x3771e4,'description':_0x322879[_0x228e2b(0xd6)],'parentFolderId':_0x29bc08},_0x3a035a=await withSpinner(_0x228e2b(0xf9)+_0x3771e4+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xbc)](_0xaef46f,_0xf009c9),{'verbose':_0x322879[_0x228e2b(0xe9)]}),_0x6ae65a=_0x3a035a['data'];return console[_0x228e2b(0x12b)](_0x228e2b(0x128)+_0x6ae65a['name']+_0x228e2b(0xdf)+_0x6ae65a['id']),await handleSDKOutput([_0x6ae65a],_0x322879),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0xca);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0x101);async[a37_0x1e4106(0xb2)](_0x59e6b6){const _0x120822=a37_0x1e4106,{options:_0x52c484,args:_0x212f52,tdx:_0x1932c3}=_0x59e6b6,_0x59c79c=_0x212f52[0x0];if(!_0x59c79c)return console[_0x120822(0x12b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x120822(0x12b)](_0x120822(0xec)),console[_0x120822(0x12b)](_0x120822(0x13a)),console['error'](_0x120822(0xaa)),console['error'](_0x120822(0xc5)),console['error'](_0x120822(0x104)),console[_0x120822(0x12b)](_0x120822(0xd4)),console[_0x120822(0x12b)](_0x120822(0xfe)),console[_0x120822(0x12b)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x98e6e2=_0x52c484['parentSegment'],_0x347135=await resolveSegmentTarget(_0x59c79c,_0x98e6e2,_0x52c484[_0x120822(0xe9)]);_0x52c484[_0x120822(0xe9)]&&console[_0x120822(0x12b)](_0x120822(0x113)+_0x347135);const _0x39026e=await withSpinner('Resolving\x20\x27'+_0x59c79c+_0x120822(0x133),()=>_0x1932c3['segment'][_0x120822(0xdb)](_0x347135),{'verbose':_0x52c484[_0x120822(0xe9)]}),_0x65a473=_0x39026e[_0x120822(0xb1)];_0x52c484['verbose']&&(console[_0x120822(0x12b)]('Resolved\x20type:\x20'+_0x65a473[_0x120822(0x138)]),console[_0x120822(0x12b)](_0x120822(0x11a)+_0x65a473[_0x120822(0xac)]),_0x65a473[_0x120822(0xfc)]&&console[_0x120822(0x12b)](_0x120822(0xe1)+_0x65a473['folderId']),_0x65a473[_0x120822(0xff)]&&console[_0x120822(0x12b)](_0x120822(0x12a)+_0x65a473['segmentId']));if(_0x52c484[_0x120822(0x103)]){if(_0x65a473[_0x120822(0x138)]===_0x120822(0x11d))return console[_0x120822(0x12b)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x65a473[_0x120822(0x138)]===_0x120822(0x130))return console[_0x120822(0x12b)](_0x120822(0x126)),console[_0x120822(0x12b)](_0x120822(0xad)),0x1;if(!_0x65a473[_0x120822(0xff)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xd2b75f=getConsoleNextUrl(_0x52c484[_0x120822(0xe8)],_0x120822(0x132)+_0x65a473['parentId']+_0x120822(0x111)+_0x65a473['segmentId']);return console[_0x120822(0x12b)](a37_0x592c44['green']('✔')+'\x20Opening\x20'+a37_0x592c44[_0x120822(0xb0)](_0xd2b75f)),openBrowser(_0xd2b75f),0x0;}if(_0x65a473[_0x120822(0x138)]===_0x120822(0x11d)){if(!_0x65a473[_0x120822(0xfc)])throw new SDKError(ErrorCode[_0x120822(0xcf)],_0x120822(0xf3));const _0x11c69d=await withSpinner(_0x120822(0xc6),()=>_0x1932c3[_0x120822(0xf1)][_0x120822(0xdd)](_0x65a473[_0x120822(0xfc)]),{'verbose':_0x52c484[_0x120822(0xe9)]});await handleSingleObjectOutput(_0x11c69d[_0x120822(0xb1)],_0x52c484);}else{if(_0x65a473[_0x120822(0x138)]==='segment'){if(!_0x65a473['segmentId'])throw new SDKError(ErrorCode[_0x120822(0xbb)],_0x120822(0xe7));const _0x1ba407=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1932c3[_0x120822(0xf1)][_0x120822(0xaf)](_0x65a473[_0x120822(0xac)],_0x65a473[_0x120822(0xff)]),{'verbose':_0x52c484[_0x120822(0xe9)]}),_0x104499=getConsoleNextUrl(_0x52c484['site'],'/app/ps/'+_0x65a473[_0x120822(0xac)]+'/e/'+_0x65a473['segmentId']),_0x566eb8=_0x1ba407[_0x120822(0xb1)];_0x566eb8[_0x120822(0x124)]=_0x104499,await handleSingleObjectOutput(_0x566eb8,_0x52c484);}else return console[_0x120822(0x12b)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x120822(0x12b)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x35e0dc){if(_0x35e0dc instanceof SDKError)return console[_0x120822(0x12b)](_0x120822(0xc2)+_0x35e0dc[_0x120822(0x134)]),_0x35e0dc[_0x120822(0xee)]&&console[_0x120822(0x12b)]('\x20\x20Cause:\x20'+_0x35e0dc['cause']),0x1;throw _0x35e0dc;}}}function a37_0x4473(){const _0x301dcb=['cause','segment:describe','28311FWQDXr','segment','red','Folder\x20ID\x20missing\x20from\x20resolved\x20path','code','resolveFolderId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','trim','Creating\x20folder\x20\x27','1432qmcWcA','484540jeXdZO','folderId','segment:folder:create','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segmentId','segment:desc','Show\x20folder\x20or\x20child\x20segment\x20details','segment:folder:list','web','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20folder\x20\x27','segmentPath','query','10CFzXuw','Resolving\x20parent\x20segment\x20\x27','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','fullPath','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','toLocaleString','test','getSegmentSQL','650QctVQq','/e/','jobId','Target\x20path:\x20','Error:\x20Folder\x20reference\x20is\x20required','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','name','Show\x20segment\x20folder\x20details','parentFolder','Parent\x20ID:\x20','329142NFOdCp','SELECT\x20*\x20FROM\x20(\x0a','folder','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','66357ECiTgm','Resolving\x20path\x20\x27','getSQLFromServerSegment','segmentName','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','url','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','✔\x20Created\x20folder\x20\x27','Resolved:\x20','Segment\x20ID:\x20','error','Listing\x20folders\x20for\x20parent\x20\x27','getSegmentSQLFromYaml','Resolving\x20folder\x20\x27','Use:\x20tdx\x20ps\x20desc','parent','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','/app/ps/','\x27...','message','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>','Error:\x20Parent\x20segment\x20name\x20is\x20required','type','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Options:','stats','Resolved\x20type:\x20','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','239445mqhWuu','✔\x20Query\x20completed:\x20Processed\x20','getSQLFromYamlFile','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','in\x20','parentId','Use:\x20tdx\x20ps\x20view\x20-w','parentSegment','getSegment','cyan','data','execute','✔\x20Found\x20','SQL\x20query:\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20name:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','8ygCCLP','\x20\x20Cause:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','SEGMENT_NOT_FOUND','createFolder','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20SQL\x20for\x20segment...','jsonl','path','Error:\x20','log','resolveParentId','Examples:','Fetching\x20folder\x20details...','Create\x20segment\x20folder\x20for\x20organization','✖\x20Query\x20failed\x20[','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:view','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20sg\x20desc\x20<name>','746700qmxTZe','\x20[Job\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','format','processedRows','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','description','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20show','includes','Show\x20segment\x20or\x20folder\x20details','resolvePathToResource','Resolved\x20parent\x20ID:\x20','getFolder','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x27\x20with\x20ID:\x20','20sOuxAO','Folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Fetching\x20segment\x20details...','\x20\x20Parent\x20segment:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','length','Segment\x20ID\x20missing\x20from\x20resolved\x20path','site','verbose','Resolving\x20\x27','listFolders','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22'];a37_0x4473=function(){return _0x301dcb;};return a37_0x4473();}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0x100);[a37_0x1e4106(0xd6)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x1e4106(0xb2)](_0x1ace16){const _0x1a6928=a37_0x1e4106,{options:_0x382331,args:_0x518c05,tdx:_0x3d5b3c}=_0x1ace16,_0x192bc5=_0x518c05[0x0];if(!_0x192bc5)return console[_0x1a6928(0x12b)](_0x1a6928(0xb7)),console[_0x1a6928(0x12b)](_0x1a6928(0xcc)),console[_0x1a6928(0x12b)](_0x1a6928(0x136)),console[_0x1a6928(0x12b)](_0x1a6928(0xc5)),console[_0x1a6928(0x12b)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x8a9561=_0x382331[_0x1a6928(0xae)],_0x3590b7=await resolveSegmentTarget(_0x192bc5,_0x8a9561,_0x382331['verbose']);_0x382331[_0x1a6928(0xe9)]&&console[_0x1a6928(0x12b)](_0x1a6928(0x113)+_0x3590b7);const _0x5b528e=await withSpinner(_0x1a6928(0xea)+_0x192bc5+_0x1a6928(0x133),()=>_0x3d5b3c[_0x1a6928(0xf1)][_0x1a6928(0xdb)](_0x3590b7),{'verbose':_0x382331[_0x1a6928(0xe9)]}),_0x344406=_0x5b528e[_0x1a6928(0xb1)];_0x382331[_0x1a6928(0xe9)]&&(console[_0x1a6928(0x12b)](_0x1a6928(0x13c)+_0x344406[_0x1a6928(0x138)]),console[_0x1a6928(0x12b)]('Parent\x20ID:\x20'+_0x344406[_0x1a6928(0xac)]));if(_0x344406[_0x1a6928(0x138)]===_0x1a6928(0x11d))return console[_0x1a6928(0x12b)](_0x1a6928(0x127)),console[_0x1a6928(0x12b)](_0x1a6928(0xf6)),0x1;if(_0x344406[_0x1a6928(0x138)]==='parent')return console[_0x1a6928(0x12b)](_0x1a6928(0xde)),console[_0x1a6928(0x12b)](_0x1a6928(0x12f)),0x1;if(!_0x344406[_0x1a6928(0xff)])throw new SDKError(ErrorCode[_0x1a6928(0xbb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x368633=await withSpinner(_0x1a6928(0xbf),()=>_0x3d5b3c[_0x1a6928(0xf1)]['getSegmentSQL'](_0x344406[_0x1a6928(0xac)],_0x344406[_0x1a6928(0xff)]),{'verbose':_0x382331['verbose']}),_0x1f4acd=_0x368633['data'],_0x5ec388=await executeSchemaQuery(_0x1f4acd,_0x3d5b3c,_0x382331);return await handleQueryOutput(_0x5ec388,_0x382331),0x0;}catch(_0x3636f2){if(_0x3636f2 instanceof SDKError)return console[_0x1a6928(0x12b)](_0x1a6928(0xc2)+_0x3636f2[_0x1a6928(0x134)]),_0x3636f2['cause']&&console[_0x1a6928(0x12b)](_0x1a6928(0xb9)+_0x3636f2[_0x1a6928(0xee)]),0x1;throw _0x3636f2;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a38_0x5c09(){const _0x71d2bb=['384040SEgWXp','segments','4jCViyq','12rPTahT','resolvePathToResource','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Parent\x20path:\x20','execute','✔\x20Created\x20segment\x20\x27','rule','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','error','\x27...','2504964TpjYNR','verbose','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','yellow','description','469485RxQcQr','type','18LzWiMv','Create\x20child\x20segment\x20with\x20filtering\x20rules','147Ssuznm','length','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolved\x20relative\x20path\x20to:\x20','noCountPopulation','Segment\x20name:\x20','resolveFolderId','segment','includes','3917694BKXKDm','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','name','Resolving\x20folder\x20path\x20\x27','createSegment','467715WpnneV','Creating\x20segment\x20\x27','kind','Resolving\x20folder\x20\x27','774315pwcSrx','site','10fvtgDC','folder','Resolved\x20folder\x20ID:\x20','\x20\x20\x20Path:\x20','data','Resolving\x20parent\x20segment\x20\x27','Parent:\x20','13BPGcIP','1422567VVOHrk','Examples:'];a38_0x5c09=function(){return _0x71d2bb;};return a38_0x5c09();}const a38_0x5ac06b=a38_0x307a;(function(_0x4927ee,_0xfa3eb2){const _0x2fb663=a38_0x307a,_0x4d5574=_0x4927ee();while(!![]){try{const _0x4fb30a=-parseInt(_0x2fb663(0x182))/0x1*(parseInt(_0x2fb663(0x15e))/0x2)+parseInt(_0x2fb663(0x170))/0x3*(-parseInt(_0x2fb663(0x15f))/0x4)+parseInt(_0x2fb663(0x186))/0x5*(parseInt(_0x2fb663(0x172))/0x6)+parseInt(_0x2fb663(0x174))/0x7*(parseInt(_0x2fb663(0x15c))/0x8)+parseInt(_0x2fb663(0x15a))/0x9*(parseInt(_0x2fb663(0x188))/0xa)+parseInt(_0x2fb663(0x17d))/0xb+-parseInt(_0x2fb663(0x169))/0xc*(-parseInt(_0x2fb663(0x159))/0xd);if(_0x4fb30a===_0xfa3eb2)break;else _0x4d5574['push'](_0x4d5574['shift']());}catch(_0x3e34fd){_0x4d5574['push'](_0x4d5574['shift']());}}}(a38_0x5c09,0xc10d7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x307a(_0x4a763f,_0x46113b){_0x4a763f=_0x4a763f-0x156;const _0x5c093e=a38_0x5c09();let _0x307a9f=_0x5c093e[_0x4a763f];return _0x307a9f;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x322afe from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x5ac06b(0x17f)]='segment:create';[a38_0x5ac06b(0x16f)]=a38_0x5ac06b(0x173);async[a38_0x5ac06b(0x163)](_0x26167e){const _0x28bb75=a38_0x5ac06b;console[_0x28bb75(0x167)](a38_0x322afe['yellow'](_0x28bb75(0x166))),console[_0x28bb75(0x167)](a38_0x322afe[_0x28bb75(0x16e)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x415ba5,args:_0xc15f74,tdx:_0x339da9}=_0x26167e,_0x4c8902=_0x415ba5;if(_0xc15f74[_0x28bb75(0x175)]===0x0)return console[_0x28bb75(0x167)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x28bb75(0x167)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x28bb75(0x167)](_0x28bb75(0x15b)),console[_0x28bb75(0x167)](_0x28bb75(0x16d)),console[_0x28bb75(0x167)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x28bb75(0x167)](_0x28bb75(0x176)),0x1;const _0x29509c=_0xc15f74[0x0],_0x437eae=_0x415ba5['segmentPath'];let _0x96bb6a=_0x29509c;_0x437eae&&!_0x29509c[_0x28bb75(0x17c)]('/')&&(_0x96bb6a=_0x437eae+'/'+_0x29509c,_0x4c8902[_0x28bb75(0x16a)]&&console[_0x28bb75(0x167)](_0x28bb75(0x177)+_0x96bb6a));const _0x2c4a34=parsePath(_0x96bb6a);if(_0x2c4a34[_0x28bb75(0x15d)][_0x28bb75(0x175)]<0x2)return console[_0x28bb75(0x167)](_0x28bb75(0x17e)),console[_0x28bb75(0x167)](_0x28bb75(0x161)),0x1;const _0x47d76e=_0x2c4a34['segments'][0x0],_0x38d954=getBaseName(_0x96bb6a),_0x205cf0=getParentPath(_0x96bb6a);_0x4c8902['verbose']&&(console[_0x28bb75(0x167)]('Site:\x20'+_0x4c8902[_0x28bb75(0x187)]),console[_0x28bb75(0x167)]('Target\x20path:\x20'+_0x96bb6a),console['error'](_0x28bb75(0x158)+_0x47d76e),console[_0x28bb75(0x167)](_0x28bb75(0x179)+_0x38d954),console[_0x28bb75(0x167)](_0x28bb75(0x162)+_0x205cf0));const _0x507911=await withSpinner(_0x28bb75(0x157)+_0x47d76e+_0x28bb75(0x168),()=>_0x339da9['segment']['resolveParentId'](_0x47d76e),{'verbose':_0x4c8902[_0x28bb75(0x16a)]}),_0x489b81=_0x507911[_0x28bb75(0x156)];let _0x2d2a46;if(_0x2c4a34[_0x28bb75(0x15d)][_0x28bb75(0x175)]>0x2){const _0x557495=await withSpinner(_0x28bb75(0x180)+_0x205cf0+_0x28bb75(0x168),()=>_0x339da9[_0x28bb75(0x17b)][_0x28bb75(0x160)](_0x205cf0),{'verbose':_0x4c8902['verbose']}),_0x3fd49c=_0x557495[_0x28bb75(0x156)];if(_0x3fd49c[_0x28bb75(0x171)]!==_0x28bb75(0x189)&&_0x3fd49c[_0x28bb75(0x171)]!=='parent')return console[_0x28bb75(0x167)](_0x28bb75(0x16c)),0x1;_0x2d2a46=_0x3fd49c['folderId'];}else{if(_0x4c8902[_0x28bb75(0x189)]){const _0x2ee08a=await withSpinner(_0x28bb75(0x185)+_0x4c8902[_0x28bb75(0x189)]+_0x28bb75(0x168),()=>_0x339da9['segment'][_0x28bb75(0x17a)](_0x489b81,_0x4c8902[_0x28bb75(0x189)]),{'verbose':_0x4c8902[_0x28bb75(0x16a)]});_0x2d2a46=_0x2ee08a[_0x28bb75(0x156)];}}_0x4c8902[_0x28bb75(0x16a)]&&_0x2d2a46&&console[_0x28bb75(0x167)](_0x28bb75(0x18a)+_0x2d2a46);const _0x78e676=await loadJSONFromOptions(_0x4c8902[_0x28bb75(0x165)],_0x4c8902['ruleFile']),_0x4720dd={'name':_0x38d954,'description':_0x4c8902['description'],'rule':_0x78e676,'kind':_0x4c8902[_0x28bb75(0x184)]!==undefined?parseInt(_0x4c8902[_0x28bb75(0x184)],0xa):undefined,'isVisible':_0x4c8902['invisible']?![]:undefined,'segmentFolderId':_0x2d2a46,'countPopulation':_0x4c8902[_0x28bb75(0x178)]?![]:undefined},_0x36cbd7=await withSpinner(_0x28bb75(0x183)+_0x38d954+_0x28bb75(0x168),()=>_0x339da9['segment'][_0x28bb75(0x181)](_0x489b81,_0x4720dd),{'verbose':_0x4c8902['verbose']}),_0x27eb81=_0x36cbd7[_0x28bb75(0x156)];return console[_0x28bb75(0x167)](_0x28bb75(0x164)+_0x27eb81['name']+_0x28bb75(0x16b)+_0x27eb81['id']),_0x96bb6a!==_0x29509c&&console[_0x28bb75(0x167)](_0x28bb75(0x18b)+_0x96bb6a),await handleSDKOutput([_0x27eb81],_0x4c8902),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a39_0x68f9(_0xc19b5d,_0x378111){_0xc19b5d=_0xc19b5d-0x180;const _0x444f6b=a39_0x444f();let _0x68f91=_0x444f6b[_0xc19b5d];return _0x68f91;}function a39_0x444f(){const _0x2a771d=['verbose','\x27...','Listing\x20fields\x20for\x20\x27','4764950mIuyuz','description','parentSegment','132YsNAia','length','List\x20available\x20fields\x20for\x20segmentation','2DOEofE','execute','3129090jEodzR','6808srCKIq','site','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','46115nopcBb','listFields','Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','error','152187XWIdMd','738qEjTTN','Site:\x20','676448jqSnhO','json','2100366duzaku','segment','✔\x20Found\x20'];a39_0x444f=function(){return _0x2a771d;};return a39_0x444f();}const a39_0x5d0a6e=a39_0x68f9;(function(_0x5d1d36,_0x21ab74){const _0x278de0=a39_0x68f9,_0x13e4e9=_0x5d1d36();while(!![]){try{const _0x258079=parseInt(_0x278de0(0x194))/0x1*(parseInt(_0x278de0(0x18d))/0x2)+parseInt(_0x278de0(0x181))/0x3+-parseInt(_0x278de0(0x19c))/0x4+-parseInt(_0x278de0(0x187))/0x5+parseInt(_0x278de0(0x18a))/0x6*(parseInt(_0x278de0(0x199))/0x7)+-parseInt(_0x278de0(0x190))/0x8*(-parseInt(_0x278de0(0x19a))/0x9)+parseInt(_0x278de0(0x18f))/0xa;if(_0x258079===_0x21ab74)break;else _0x13e4e9['push'](_0x13e4e9['shift']());}catch(_0x42651c){_0x13e4e9['push'](_0x13e4e9['shift']());}}}(a39_0x444f,0x76708));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{['name']='segment:fields';[a39_0x5d0a6e(0x188)]=a39_0x5d0a6e(0x18c);async[a39_0x5d0a6e(0x18e)](_0x33dbdc){const _0x2ac323=a39_0x5d0a6e,{options:_0x39c6fe,args:_0xf7a17f,tdx:_0x3f6169}=_0x33dbdc,_0x289ca4=_0xf7a17f[0x0]||_0x39c6fe[_0x2ac323(0x189)];if(!_0x289ca4)return console[_0x2ac323(0x198)](_0x2ac323(0x192)),console[_0x2ac323(0x198)](_0x2ac323(0x197)),console[_0x2ac323(0x198)](_0x2ac323(0x193)),0x1;_0x39c6fe[_0x2ac323(0x184)]&&(console['error'](_0x2ac323(0x19b)+_0x39c6fe[_0x2ac323(0x191)]),console['error'](_0x2ac323(0x196)+_0x289ca4));const _0xf21f1a=await withSpinner(_0x2ac323(0x186)+_0x289ca4+_0x2ac323(0x185),()=>_0x3f6169[_0x2ac323(0x182)][_0x2ac323(0x195)](_0x289ca4),{'verbose':_0x39c6fe[_0x2ac323(0x184)]}),_0x4710b4=_0xf21f1a['data'];console[_0x2ac323(0x198)](_0x2ac323(0x183)+_0x4710b4[_0x2ac323(0x18b)]+'\x20field'+(_0x4710b4[_0x2ac323(0x18b)]!==0x1?'s':''));if(_0x39c6fe[_0x2ac323(0x180)]||_0x39c6fe['jsonl'])return await handleSDKOutput(_0x4710b4,_0x39c6fe),0x0;return displayFieldsHumanReadable(_0x4710b4,_0x289ca4),0x0;}}
|