@treasuredata/tdx 2026.3.50 → 2026.3.51
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.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-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.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.d.ts +1 -0
- package/dist/core/oauth.d.ts.map +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/oauth.js.map +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.d.ts +21 -4
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0xfb112d=a32_0x4a85;(function(_0x5ac181,_0x2b49f3){const _0x8dc780=a32_0x4a85,_0x4a9846=_0x5ac181();while(!![]){try{const _0x2a3a2c=-parseInt(_0x8dc780(0xf3))/0x1+parseInt(_0x8dc780(0xf0))/0x2*(-parseInt(_0x8dc780(0xef))/0x3)+-parseInt(_0x8dc780(0x117))/0x4*(parseInt(_0x8dc780(0x114))/0x5)+-parseInt(_0x8dc780(0x10e))/0x6+parseInt(_0x8dc780(0xed))/0x7+-parseInt(_0x8dc780(0xfe))/0x8+parseInt(_0x8dc780(0x100))/0x9;if(_0x2a3a2c===_0x2b49f3)break;else _0x4a9846['push'](_0x4a9846['shift']());}catch(_0x1ad5b7){_0x4a9846['push'](_0x4a9846['shift']());}}}(a32_0x77f6,0xb6d8a));function a32_0x77f6(){const _0x5e7783=['dim','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','Administrator','Account\x20Owner','data','1480864raIenP','error','29583360gxQBLg','\x20\x20•\x20','Listing\x20policies...','entries','join','verbose','(ID:\x20','listPolicies','administrator','all','ies','bold','policy','getPolicyUsers','1386852nePvmD','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','permissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Fetching\x20permissions...','getCurrent','30beNLas','\x20user','args','498972KTCzEu','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20policy...','email','context','👥\x20Assigned\x20Users','execute','\x20\x20\x20','getPolicy','📋\x20Assigned\x20Policies','name','description',',\x20user_id:','validate','operation','✔\x20Found\x20','8940085FCfOor','length','879JliwUF','8404vxjoIw','\x20—\x20','getMyPermissions','1419363ErAlNc','\x20\x20No\x20permissions','site','log','map','\x20assigned'];a32_0x77f6=function(){return _0x5e7783;};return a32_0x77f6();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x294e9f from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xfb112d(0x121)]=a32_0xfb112d(0x10c);['description']=a32_0xfb112d(0x111);async[a32_0xfb112d(0x11d)](_0x28b5be){const _0x271ebb=a32_0xfb112d,{options:_0x3c13f5,tdx:_0x213300}=_0x28b5be,_0x1b953b=await withSpinner(_0x271ebb(0x112),async()=>{const _0x5210df=_0x271ebb,[_0x10b9ab,_0x46a029]=await Promise[_0x5210df(0x109)]([_0x213300['user'][_0x5210df(0x113)](),_0x213300['policy'][_0x5210df(0xf2)]()]);return{'userInfo':_0x10b9ab,'permissions':_0x46a029};},{'verbose':_0x3c13f5[_0x271ebb(0x105)]}),{userInfo:_0x48fefd,permissions:_0x5ef867}=_0x1b953b[_0x271ebb(0xfd)];if(isStructuredFormat(_0x3c13f5))return await handleSingleObjectOutput(_0x5ef867,_0x3c13f5),0x0;const _0x56bf18=_0x48fefd['account_owner']?_0x271ebb(0xfc):_0x48fefd[_0x271ebb(0x108)]?_0x271ebb(0xfb):'Member';console[_0x271ebb(0xf6)]('\x0a'+a32_0x294e9f[_0x271ebb(0x10b)]('👤')+'\x20'+a32_0x294e9f[_0x271ebb(0x10b)](_0x48fefd['name'])+'\x20'+a32_0x294e9f[_0x271ebb(0xf9)]('('+_0x48fefd[_0x271ebb(0x11a)]+')')+'\x20—\x20'+_0x56bf18),console[_0x271ebb(0xf6)](a32_0x294e9f[_0x271ebb(0xf9)](_0x271ebb(0x11e)+_0x213300[_0x271ebb(0x11b)][_0x271ebb(0xf5)]+':'+_0x48fefd['account_id']+_0x271ebb(0xe9)+_0x48fefd['id']));const _0x4a142d=_0x5ef867['policies'];console[_0x271ebb(0xf6)]('\x0a'+a32_0x294e9f[_0x271ebb(0x10b)](_0x271ebb(0x120))+'\x20('+_0x4a142d['length']+'):');if(_0x4a142d[_0x271ebb(0xee)]===0x0)console[_0x271ebb(0xf6)](a32_0x294e9f['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x1f69d9 of _0x4a142d){console[_0x271ebb(0xf6)]('\x20\x20•\x20'+_0x1f69d9[_0x271ebb(0x121)]);}return printPermissionsMap(_0x5ef867[_0x271ebb(0x110)]),console[_0x271ebb(0xf6)](),0x0;}}function a32_0x4a85(_0x46ad37,_0x25711c){_0x46ad37=_0x46ad37-0xe9;const _0x77f617=a32_0x77f6();let _0x4a8581=_0x77f617[_0x46ad37];return _0x4a8581;}export class PolicyListCommand extends BaseCommand{[a32_0xfb112d(0x121)]='policy\x20list';[a32_0xfb112d(0x122)]=a32_0xfb112d(0x10f);async[a32_0xfb112d(0x11d)](_0x515058){const _0x25eb8c=a32_0xfb112d,{options:_0x4a58fe,tdx:_0x35fe07}=_0x515058,_0xdec5f=await withSpinner(_0x25eb8c(0x102),()=>_0x35fe07[_0x25eb8c(0x10c)][_0x25eb8c(0x107)](),{'verbose':_0x4a58fe[_0x25eb8c(0x105)]}),_0xb948b4=_0xdec5f[_0x25eb8c(0xfd)];console[_0x25eb8c(0xff)](_0x25eb8c(0xec)+_0xb948b4['length']+'\x20polic'+(_0xb948b4[_0x25eb8c(0xee)]!==0x1?_0x25eb8c(0x10a):'y'));if(isStructuredFormat(_0x4a58fe))return await handleSDKOutput(_0xb948b4,_0x4a58fe),0x0;if(_0xb948b4[_0x25eb8c(0xee)]===0x0)console[_0x25eb8c(0xf6)](a32_0x294e9f[_0x25eb8c(0xf9)]('No\x20policies\x20found'));else for(const _0x189d2d of _0xb948b4){const _0x28c3cb=_0x189d2d['description']?a32_0x294e9f['dim'](_0x25eb8c(0xf1)+_0x189d2d['description']):'';console['log'](_0x25eb8c(0x101)+_0x189d2d['name']+_0x28c3cb);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0xfb112d(0x121)]='policy\x20show';[a32_0xfb112d(0x122)]=a32_0xfb112d(0x118);[a32_0xfb112d(0xea)](_0x633bab){const _0xcaaf98=a32_0xfb112d;if(_0x633bab[_0xcaaf98(0x116)][_0xcaaf98(0xee)]===0x0)return _0xcaaf98(0xfa);return undefined;}async[a32_0xfb112d(0x11d)](_0x4c5792){const _0x241088=a32_0xfb112d,{options:_0x23e4cb,tdx:_0xb954a0}=_0x4c5792,_0x25483b=_0x4c5792['args'][0x0],_0xd0e1f1=await withSpinner(_0x241088(0x119),async()=>{const _0x308c78=_0x241088,_0x482bd1=await _0xb954a0[_0x308c78(0x10c)][_0x308c78(0x11f)](_0x25483b),[_0x5a351d,_0x207d45]=await Promise['all']([_0xb954a0['policy']['getPolicyPermissions'](_0x482bd1['id']),_0xb954a0[_0x308c78(0x10c)][_0x308c78(0x10d)](_0x482bd1['id'])]);return{'policy':_0x482bd1,'perms':_0x5a351d,'users':_0x207d45};},{'verbose':_0x23e4cb['verbose']}),{policy:_0x132287,perms:_0x23e7f4,users:_0x3da12b}=_0xd0e1f1[_0x241088(0xfd)];if(isStructuredFormat(_0x23e4cb))return await handleSingleObjectOutput({..._0x132287,'permissions':_0x23e7f4['permissions'],'users':_0x3da12b},_0x23e4cb),0x0;console[_0x241088(0xf6)]('\x0a'+a32_0x294e9f['bold']('📋')+'\x20'+a32_0x294e9f[_0x241088(0x10b)](_0x132287[_0x241088(0x121)])+'\x20'+a32_0x294e9f['dim'](_0x241088(0x106)+_0x132287['id']+')'));_0x132287[_0x241088(0x122)]&&console[_0x241088(0xf6)]('\x20\x20\x20'+a32_0x294e9f[_0x241088(0xf9)](_0x132287[_0x241088(0x122)]));console['log']('\x20\x20\x20'+_0x3da12b['length']+_0x241088(0x115)+(_0x3da12b[_0x241088(0xee)]!==0x1?'s':'')+_0x241088(0xf8)),printPermissionsMap(_0x23e7f4[_0x241088(0x110)]);if(_0x3da12b['length']>0x0){console[_0x241088(0xf6)]('\x0a'+a32_0x294e9f[_0x241088(0x10b)](_0x241088(0x11c))+':');for(const _0x38b9d6 of _0x3da12b){const _0x2442b1=_0x38b9d6['email']&&_0x38b9d6[_0x241088(0x11a)]!==_0x38b9d6['name']?a32_0x294e9f[_0x241088(0xf9)]('\x20<'+_0x38b9d6[_0x241088(0x11a)]+'>'):'';console[_0x241088(0xf6)]('\x20\x20•\x20'+_0x38b9d6[_0x241088(0x121)]+_0x2442b1);}}return console[_0x241088(0xf6)](),0x0;}}function printPermissionsMap(_0x149625){const _0xefc60=a32_0xfb112d,_0x43a77a=Object[_0xefc60(0x103)](_0x149625);console[_0xefc60(0xf6)]('\x0a'+a32_0x294e9f['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x43a77a[_0xefc60(0xee)]===0x0){console[_0xefc60(0xf6)](a32_0x294e9f[_0xefc60(0xf9)](_0xefc60(0xf4)));return;}const _0x16f2d6=Math['max'](..._0x43a77a[_0xefc60(0xf7)](([_0x5bba3b])=>_0x5bba3b[_0xefc60(0xee)]));for(const [_0x5383b5,_0x3acd7f]of _0x43a77a){const _0x3c1793=formatOperations(_0x3acd7f);console[_0xefc60(0xf6)]('\x20\x20'+_0x5383b5['padEnd'](_0x16f2d6+0x2)+_0x3c1793);}}function formatOperations(_0x4448c1){const _0x3d30d1=a32_0xfb112d,_0x36f293=[...new Set(_0x4448c1['map'](_0x222b04=>_0x222b04[_0x3d30d1(0xeb)]))];return _0x36f293[_0x3d30d1(0x104)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x3ca79c=a33_0x407e;(function(_0x263fea,_0x5af226){const _0x3800a0=a33_0x407e,_0x4d487b=_0x263fea();while(!![]){try{const _0x377048=parseInt(_0x3800a0(0x1d8))/0x1*(-parseInt(_0x3800a0(0x194))/0x2)+-parseInt(_0x3800a0(0x1d2))/0x3*(-parseInt(_0x3800a0(0x1b6))/0x4)+-parseInt(_0x3800a0(0x190))/0x5*(-parseInt(_0x3800a0(0x1c2))/0x6)+-parseInt(_0x3800a0(0x1c5))/0x7+parseInt(_0x3800a0(0x1c3))/0x8*(-parseInt(_0x3800a0(0x186))/0x9)+-parseInt(_0x3800a0(0x1a3))/0xa*(parseInt(_0x3800a0(0x16d))/0xb)+-parseInt(_0x3800a0(0x16f))/0xc*(-parseInt(_0x3800a0(0x18b))/0xd);if(_0x377048===_0x5af226)break;else _0x4d487b['push'](_0x4d487b['shift']());}catch(_0x30275b){_0x4d487b['push'](_0x4d487b['shift']());}}}(a33_0x5057,0xad309));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_0x5399d3 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a33_0x5057(){const _0x4d31cd=['Delete\x20a\x20profile','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','name','7190QLSNor','trim','create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','11014OIDWKn','green','execute','test','Removal\x20cancelled','red','validate','confirm','profile:create','\x20\x20-\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','profile:use','length','yellow','90NJrcCJ','\x0aOperation\x20cancelled','dim','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','text','\x27\x20deleted','Failed\x20to\x20delete\x20profile:\x20','includes','Create\x20a\x20new\x20profile','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','API\x20key\x20cannot\x20be\x20empty','parent_segment','\x20Profile\x20\x27','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','VALID_KEYS','password','Setup\x20cancelled','tdx.json','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','4JgUDCC','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Changing\x20site\x20to\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20does\x20not\x20exist.','apiKey','\x0aSetup\x20cancelled','message','jobs','description','Operation\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','3780AMKxpA','65984SxKyjH','tdx:\x20profile\x20delete','8903482bQXDVr','profile:set','session','\x27\x20created','getUserInfo','error','split','(session:\x20','status','profile:delete','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Site\x20was\x20not\x20changed.','log','400647IVSXlH','Removed\x20existing\x20profile\x20\x27','/app/mp/ak','profile','site','\x20\x20tdx\x20--profile\x20','113KJHWHI','\x27\x20requires\x20API\x20key\x20validation.','Set\x20a\x20profile\x20configuration\x20value','\x0aAvailable\x20profiles:','\x0aSaved\x20to:\x20','457336AVoelS','Validating\x20API\x20key...','132660xCDUhh','✗\x20Validation\x20failed:\x20','force','ERROR','logLevel','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','database','Profile\x20\x27','llm_project','us01','profileName','config','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','warn','Profile\x20name\x20cannot\x20be\x20empty','email','bold','join','oauth','Enter\x20your\x20TD\x20API\x20key:','\x27.\x0a\x0aValid\x20keys:\x20','skipExistsCheck','189mUMvYV','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','(cleared)','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','2483LpZvdd'];a33_0x5057=function(){return _0x4d31cd;};return a33_0x5057();}import{LogLevel}from'../utils/tdx-logger.js';import a33_0x49fba3 from'prompts';import a33_0xe36052 from'chalk';function validateProfileName(_0x23ded0,_0x160432){const _0x382296=a33_0x407e;if(!_0x23ded0||!_0x23ded0[_0x382296(0x191)]())return _0x382296(0x17e);const _0xf2cff9=_0x23ded0[_0x382296(0x191)]();if(!/^[a-zA-Z0-9_-]+$/[_0x382296(0x197)](_0xf2cff9))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x160432?.[_0x382296(0x185)]&&profileExists(_0xf2cff9))return'Profile\x20\x27'+_0xf2cff9+_0x382296(0x19f)+_0xf2cff9+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x311865){removeProfileFromUserConfig(_0x311865);const _0xf24f8e=await isKeychainAvailable();_0xf24f8e&&await Promise['all']([deleteKeychainAPIKey(_0x311865),deleteOAuthTokens(_0x311865)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x19c);['description']=a33_0x3ca79c(0x1ab);async[a33_0x3ca79c(0x196)](_0x271664){const _0x36e484=a33_0x3ca79c,{options:_0xf931b3,args:_0x37732d}=_0x271664,_0x246ae4=!!_0xf931b3[_0x36e484(0x171)];console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x180)]('tdx:\x20profile\x20create'));let _0x5c64b9;if(_0x37732d[_0x36e484(0x1a1)]>0x0&&_0x37732d[0x0]){const _0x51e4c9=_0x37732d[0x0][_0x36e484(0x191)]();_0x246ae4&&profileExists(_0x51e4c9)&&(await deleteProfileAndCredentials(_0x51e4c9),console[_0x36e484(0x1d1)](_0x36e484(0x1d3)+_0x51e4c9+'\x27'));const _0x1bb2fd=validateProfileName(_0x51e4c9);if(_0x1bb2fd!==!![])return console['error'](a33_0xe36052[_0x36e484(0x199)](_0x1bb2fd)),0x1;_0x5c64b9=_0x51e4c9;}else{const _0x2a0857=await a33_0x49fba3({'type':_0x36e484(0x1a7),'name':_0x36e484(0x17a),'message':'Enter\x20profile\x20name:','validate':_0x1ad5f3=>validateProfileName(_0x1ad5f3,{'skipExistsCheck':_0x246ae4})});if(!_0x2a0857[_0x36e484(0x17a)])return console[_0x36e484(0x1d1)]('\x0aSetup\x20cancelled'),0x1;_0x5c64b9=_0x2a0857['profileName'][_0x36e484(0x191)](),_0x246ae4&&profileExists(_0x5c64b9)&&(await deleteProfileAndCredentials(_0x5c64b9),console[_0x36e484(0x1d1)](_0x36e484(0x1d3)+_0x5c64b9+'\x27'));}const _0x40e3e5=await a33_0x49fba3({'type':_0x36e484(0x1a7),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x3443ae=_0x40e3e5['description']?.[_0x36e484(0x191)]()||undefined,_0x441ce7=_0xf931b3[_0x36e484(0x1d6)]||_0x36e484(0x179),_0x4cab47=await promptSiteSelection(_0x441ce7,_0x5c64b9,_0x36e484(0x1b3));if(!_0x4cab47)return 0x1;const _0x39b057=resolveSite(_0x4cab47),_0x45622a=await promptAuthMethod();if(!_0x45622a)return console[_0x36e484(0x1d1)](_0x36e484(0x1bc)),0x1;if(_0x45622a===_0x36e484(0x182)){if(_0x3443ae){const _0x4fcc3a={'site':_0x39b057,'description':_0x3443ae};saveProfileToUserConfig(_0x5c64b9,_0x4fcc3a);}const {accountName:_0x37056c}=_0xf931b3;return await runOAuthLoginFlow(_0x39b057,_0x5c64b9,_0xf931b3[_0x36e484(0x173)]??LogLevel[_0x36e484(0x172)],{'accountName':_0x37056c}),0x0;}console['log'](_0x36e484(0x188)+_0x39b057),console[_0x36e484(0x1d1)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x36e484(0x1d1)]('\x20\x20'+getConsoleUrl(_0x39b057,_0x36e484(0x1d4)));const _0x1a0d74=await a33_0x49fba3({'type':_0x36e484(0x1b2),'name':'apiKey','message':_0x36e484(0x183),'validate':_0x9662c3=>{const _0x590a5b=_0x36e484;if(!_0x9662c3||!_0x9662c3[_0x590a5b(0x191)]())return _0x590a5b(0x1ad);return!![];}});if(!_0x1a0d74['apiKey'])return console[_0x36e484(0x1d1)](_0x36e484(0x1bc)),0x1;const _0x3a342d=_0x1a0d74[_0x36e484(0x1bb)];console[_0x36e484(0x1d1)](_0x36e484(0x16e));try{const _0x14d538=TDX[_0x36e484(0x192)]({'site':_0x39b057,'apiKey':_0x3a342d[_0x36e484(0x191)](),'logLevel':_0xf931b3['logLevel']??LogLevel[_0x36e484(0x172)]}),_0xbfdd1e=await _0x14d538['jobs'][_0x36e484(0x1c9)]();console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+_0x36e484(0x175)+_0xbfdd1e[_0x36e484(0x17f)]+')');const _0x21f6bf=await isKeychainAvailable();_0x21f6bf?(await saveAPIKeyAsync(_0x3a342d[_0x36e484(0x191)](),_0x39b057,_0x5c64b9),console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+_0x36e484(0x1b9)+_0x5c64b9+')')):(console[_0x36e484(0x17d)](a33_0xe36052[_0x36e484(0x1a2)](_0x36e484(0x1ac))),console[_0x36e484(0x17d)](a33_0xe36052[_0x36e484(0x1a2)](_0x36e484(0x19e))));const _0x58918a={'site':_0x39b057,..._0x3443ae&&{'description':_0x3443ae}};return saveProfileToUserConfig(_0x5c64b9,_0x58918a),console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+'\x20Profile\x20\x27'+_0x5c64b9+_0x36e484(0x1c8)),console['log'](),console[_0x36e484(0x1d1)](_0x36e484(0x18a)),console[_0x36e484(0x1d1)](_0x36e484(0x1d7)+_0x5c64b9+_0x36e484(0x1b7)),console['log'](_0x36e484(0x1d7)+_0x5c64b9+_0x36e484(0x1b0)),0x0;}catch(_0x51d34c){if(_0x51d34c instanceof HTTPClientError&&_0x51d34c[_0x36e484(0x1cd)]===0x191)return printAuthError(_0x51d34c),0x1;return console['error'](a33_0xe36052['red'](_0x36e484(0x170)+(_0x51d34c instanceof Error?_0x51d34c[_0x36e484(0x1bd)]:String(_0x51d34c)))),console['error'](_0x36e484(0x17c)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1ce);[a33_0x3ca79c(0x1bf)]=a33_0x3ca79c(0x18c);[a33_0x3ca79c(0x19a)](_0xfae954){const _0x4c6d7e=a33_0x3ca79c,{args:_0x5207a4}=_0xfae954;if(_0x5207a4[_0x4c6d7e(0x1a1)]===0x0)return _0x4c6d7e(0x193);return undefined;}async[a33_0x3ca79c(0x196)](_0x2f097b){const _0x4474f3=a33_0x3ca79c,{args:_0x434efe}=_0x2f097b,_0x14702b=_0x434efe[0x0];console[_0x4474f3(0x1d1)](a33_0xe36052[_0x4474f3(0x180)](_0x4474f3(0x1c4)));if(!profileExists(_0x14702b)){console[_0x4474f3(0x1ca)](a33_0xe36052['red']('Profile\x20\x27'+_0x14702b+_0x4474f3(0x1ba))),console[_0x4474f3(0x1d1)](_0x4474f3(0x16b));const _0x3ffbd9=listProfiles();if(_0x3ffbd9[_0x4474f3(0x1a1)]===0x0)console[_0x4474f3(0x1d1)](_0x4474f3(0x18e));else for(const _0x167170 of _0x3ffbd9){console[_0x4474f3(0x1d1)](_0x4474f3(0x19d)+_0x167170['name']);}return 0x1;}const _0x1bafa0=await a33_0x49fba3({'type':_0x4474f3(0x19b),'name':_0x4474f3(0x19b),'message':_0x4474f3(0x1c1)+_0x14702b+'\x27?','initial':![]});if(!_0x1bafa0[_0x4474f3(0x19b)])return console['log'](_0x4474f3(0x198)),0x0;try{await deleteProfileAndCredentials(_0x14702b),console[_0x4474f3(0x1d1)](a33_0xe36052[_0x4474f3(0x195)]('✓')+'\x20Profile\x20\x27'+_0x14702b+_0x4474f3(0x1a8));}catch(_0x280a34){return console[_0x4474f3(0x1ca)](a33_0xe36052['red'](_0x4474f3(0x1a9)+(_0x280a34 instanceof Error?_0x280a34[_0x4474f3(0x1bd)]:String(_0x280a34)))),0x1;}return 0x0;}}function a33_0x407e(_0x195acb,_0x37e22e){_0x195acb=_0x195acb-0x16a;const _0x505765=a33_0x5057();let _0x407e6e=_0x505765[_0x195acb];return _0x407e6e;}export class ProfileSetCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1c6);['description']=a33_0x3ca79c(0x16a);static ['VALID_KEYS']=['site',a33_0x3ca79c(0x176),a33_0x3ca79c(0x1ae),a33_0x3ca79c(0x178),'llm_agent',a33_0x3ca79c(0x1bf)];['validate'](_0x513462){const _0x1f4ee3=a33_0x3ca79c,{args:_0x2e2384,options:_0x416011}=_0x513462,_0x15c79a=_0x416011[_0x1f4ee3(0x1d5)]||getActiveProfile();if(!_0x15c79a)return _0x1f4ee3(0x1a6);if(_0x2e2384[_0x1f4ee3(0x1a1)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1f4ee3(0x1b1)][_0x1f4ee3(0x181)](',\x20');const _0x5c79a3=_0x2e2384[0x0];if(!_0x5c79a3[_0x1f4ee3(0x1aa)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1f4ee3(0x181)](',\x20');const [_0x3d58ec]=_0x5c79a3[_0x1f4ee3(0x1cb)]('=',0x2);if(!ProfileSetCommand[_0x1f4ee3(0x1b1)][_0x1f4ee3(0x1aa)](_0x3d58ec))return'Unknown\x20key\x20\x27'+_0x3d58ec+_0x1f4ee3(0x184)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async['execute'](_0x321ea0){const _0x251bb5=a33_0x3ca79c,{args:_0x1c8227,options:_0x511ca8}=_0x321ea0,_0x55b491=_0x511ca8[_0x251bb5(0x1d5)]||getActiveProfile(),[_0x503ba5,..._0x57019f]=_0x1c8227[0x0]['split']('='),_0x155dc8=_0x57019f[_0x251bb5(0x181)]('=');console[_0x251bb5(0x1d1)](a33_0xe36052['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x55b491)){const _0x271e39=await a33_0x49fba3({'type':_0x251bb5(0x19b),'name':'create','message':_0x251bb5(0x177)+_0x55b491+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x271e39[_0x251bb5(0x192)])return console[_0x251bb5(0x1d1)](_0x251bb5(0x1c0)),0x1;}const _0x2542a6=loadProfile(_0x55b491),_0x39a661=_0x2542a6?.[_0x251bb5(0x17b)]||{};if(_0x503ba5==='site'){const _0x357c7d=resolveSite(_0x155dc8);console[_0x251bb5(0x1d1)](_0x251bb5(0x1b8)+_0x357c7d+_0x251bb5(0x1d9)),console[_0x251bb5(0x1d1)](_0x251bb5(0x18d)),console[_0x251bb5(0x1d1)]('\x20\x20'+getConsoleUrl(_0x357c7d,_0x251bb5(0x1d4)));const _0x13a35a=await a33_0x49fba3({'type':_0x251bb5(0x1b2),'name':_0x251bb5(0x1bb),'message':_0x251bb5(0x1b5),'validate':_0x384134=>{const _0x59837f=_0x251bb5;if(!_0x384134||!_0x384134[_0x59837f(0x191)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x13a35a['apiKey'])return console[_0x251bb5(0x1d1)](_0x251bb5(0x1a4)),0x1;console['log'](_0x251bb5(0x16e));try{const _0x2530b2=TDX[_0x251bb5(0x192)]({'site':_0x357c7d,'apiKey':_0x13a35a[_0x251bb5(0x1bb)][_0x251bb5(0x191)](),'logLevel':_0x511ca8[_0x251bb5(0x173)]??LogLevel[_0x251bb5(0x172)]}),_0x18e5fe=await _0x2530b2[_0x251bb5(0x1be)][_0x251bb5(0x1c9)]();console[_0x251bb5(0x1d1)](a33_0xe36052[_0x251bb5(0x195)]('✓')+_0x251bb5(0x175)+_0x18e5fe[_0x251bb5(0x17f)]+')');const _0x3118f2=await isKeychainAvailable();_0x3118f2?(await saveAPIKeyAsync(_0x13a35a[_0x251bb5(0x1bb)][_0x251bb5(0x191)](),_0x357c7d,_0x55b491),console[_0x251bb5(0x1d1)](a33_0xe36052[_0x251bb5(0x195)]('✓')+_0x251bb5(0x1cf))):console[_0x251bb5(0x17d)](a33_0xe36052[_0x251bb5(0x1a2)](_0x251bb5(0x1ac))),_0x39a661['site']=_0x357c7d;}catch(_0x2d2c72){if(_0x2d2c72 instanceof HTTPClientError&&_0x2d2c72[_0x251bb5(0x1cd)]===0x191)return printAuthError(_0x2d2c72),0x1;return console['error'](a33_0xe36052[_0x251bb5(0x199)](_0x251bb5(0x170)+(_0x2d2c72 instanceof Error?_0x2d2c72[_0x251bb5(0x1bd)]:String(_0x2d2c72)))),console[_0x251bb5(0x1ca)](_0x251bb5(0x1d0)),0x1;}}else _0x39a661[_0x503ba5]=_0x155dc8||undefined;return saveProfileToUserConfig(_0x55b491,_0x39a661),console['log'](a33_0xe36052['green']('✓')+_0x251bb5(0x1af)+_0x55b491+'\x27\x20updated:\x20'+_0x503ba5+'='+(_0x155dc8||_0x251bb5(0x189))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1a0);[a33_0x3ca79c(0x1bf)]='Set\x20session\x20profile';['validate'](_0x8dcaf){const _0x1e6291=a33_0x3ca79c,{args:_0x36d5f1}=_0x8dcaf;if(_0x36d5f1[_0x1e6291(0x1a1)]===0x0)return _0x1e6291(0x187);return undefined;}async[a33_0x3ca79c(0x196)](_0x273f2c){const _0x23fcb1=a33_0x3ca79c,{args:_0x223a51,options:_0x164621}=_0x273f2c,_0x52c40d=_0x223a51[0x0],_0x33c071=_0x164621['default'];cleanExpiredSessions();if(!profileExists(_0x52c40d)){console[_0x23fcb1(0x1ca)](a33_0xe36052[_0x23fcb1(0x199)](_0x23fcb1(0x177)+_0x52c40d+_0x23fcb1(0x1ba))),console['log']('\x0aAvailable\x20profiles:');const _0x253eba=listProfiles();if(_0x253eba[_0x23fcb1(0x1a1)]===0x0)console[_0x23fcb1(0x1d1)](_0x23fcb1(0x18e));else for(const _0x14ebdb of _0x253eba){console[_0x23fcb1(0x1d1)](_0x23fcb1(0x19d)+_0x14ebdb[_0x23fcb1(0x18f)]);}return 0x1;}if(_0x33c071){const _0x548703=a33_0x5399d3[_0x23fcb1(0x181)](getConfigDir(),_0x23fcb1(0x1b4));return saveActiveProfileToUserConfig(_0x52c40d),console[_0x23fcb1(0x1d1)]('Default\x20profile\x20set\x20to:\x20'+a33_0xe36052[_0x23fcb1(0x195)](_0x52c40d)),console[_0x23fcb1(0x1d1)](a33_0xe36052['dim'](_0x23fcb1(0x16c)+_0x548703)),0x0;}const _0x3f5d62=getSessionID(_0x164621[_0x23fcb1(0x1c7)]);return saveSessionContext({'profile':_0x52c40d},_0x164621[_0x23fcb1(0x1c7)]),console[_0x23fcb1(0x1d1)](_0x23fcb1(0x174)+a33_0xe36052[_0x23fcb1(0x195)](_0x52c40d)+'\x20'+a33_0xe36052[_0x23fcb1(0x1a5)](_0x23fcb1(0x1cc)+_0x3f5d62+')')),console[_0x23fcb1(0x1d1)](a33_0xe36052['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x52c40d+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
1
|
+
const a33_0x49df6b=a33_0x543e;(function(_0x3774de,_0x473539){const _0x4367a1=a33_0x543e,_0x164e55=_0x3774de();while(!![]){try{const _0xc7d011=parseInt(_0x4367a1(0x1de))/0x1*(-parseInt(_0x4367a1(0x1ef))/0x2)+-parseInt(_0x4367a1(0x1b5))/0x3*(parseInt(_0x4367a1(0x1d2))/0x4)+parseInt(_0x4367a1(0x1d7))/0x5+parseInt(_0x4367a1(0x1e8))/0x6+-parseInt(_0x4367a1(0x1dd))/0x7*(parseInt(_0x4367a1(0x1bd))/0x8)+parseInt(_0x4367a1(0x1eb))/0x9*(parseInt(_0x4367a1(0x1d3))/0xa)+-parseInt(_0x4367a1(0x1b1))/0xb;if(_0xc7d011===_0x473539)break;else _0x164e55['push'](_0x164e55['shift']());}catch(_0x3baa6c){_0x164e55['push'](_0x164e55['shift']());}}}(a33_0x604e,0x19281));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x49908d from'node:path';function a33_0x604e(){const _0x433e9c=['apiKey','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','Removal\x20cancelled','Unknown\x20key\x20\x27','/app/mp/ak','yellow','tdx.json','Enter\x20your\x20TD\x20API\x20key:','VALID_KEYS','Site\x20was\x20not\x20changed.','name','Removed\x20existing\x20profile\x20\x27','Setup\x20cancelled','Profile\x20\x27','414645KjunkA','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','483021RnjaTw','warn','profile:set','(session:\x20','database','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','parent_segment','8jDjIyT','validate','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','includes','site','Validating\x20API\x20key...','session','You\x20can\x20find\x20your\x20API\x20key\x20at:','error','ERROR','jobs','✗\x20Validation\x20failed:\x20','bold','create','profile','Set\x20session\x20profile','status','red','\x0aSetup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','4FkSVef','1605670zFMbGd','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','626110PBsSWl','us01','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','log','password','347739YzyAfA','76889wIRkvy','\x0aAvailable\x20profiles:','profile:create','Delete\x20a\x20profile','profile:delete','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','green','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','logLevel','execute','855120kZXpSd','\x27\x20created','(cleared)','9hGKpDq','split','description','config','2NJLfQE','profileName','confirm','email','\x27\x20deleted','\x20\x20-\x20','message','test','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Failed\x20to\x20delete\x20profile:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20profile\x20name:','\x0aOperation\x20cancelled','length','trim','llm_agent','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','join','Operation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','default','Set\x20a\x20profile\x20configuration\x20value','skipExistsCheck'];a33_0x604e=function(){return _0x433e9c;};return a33_0x604e();}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x1b514e from'prompts';import a33_0x5d2c3c from'chalk';function validateProfileName(_0x333fd6,_0x1c6235){const _0x3cbbe4=a33_0x543e;if(!_0x333fd6||!_0x333fd6['trim']())return _0x3cbbe4(0x1b3);const _0x45edb4=_0x333fd6[_0x3cbbe4(0x1fe)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3cbbe4(0x1f6)](_0x45edb4))return _0x3cbbe4(0x1d5);if(!_0x1c6235?.[_0x3cbbe4(0x1a1)]&&profileExists(_0x45edb4))return _0x3cbbe4(0x1b0)+_0x45edb4+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x45edb4+_0x3cbbe4(0x1e3);return!![];}async function deleteProfileAndCredentials(_0x3e4880){removeProfileFromUserConfig(_0x3e4880);const _0x54cddc=await isKeychainAvailable();_0x54cddc&&await Promise['all']([deleteKeychainAPIKey(_0x3e4880),deleteOAuthTokens(_0x3e4880)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x49df6b(0x1e0);['description']='Create\x20a\x20new\x20profile';async[a33_0x49df6b(0x1e7)](_0x29ef0e){const _0xacc9f9=a33_0x49df6b,{options:_0xd2184d,args:_0x2f28d4}=_0x29ef0e,_0x31b863=!!_0xd2184d['force'];console['log'](a33_0x5d2c3c[_0xacc9f9(0x1ca)](_0xacc9f9(0x1bf)));let _0x2adae0;if(_0x2f28d4[_0xacc9f9(0x1fd)]>0x0&&_0x2f28d4[0x0]){const _0x51d721=_0x2f28d4[0x0]['trim']();_0x31b863&&profileExists(_0x51d721)&&(await deleteProfileAndCredentials(_0x51d721),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1ae)+_0x51d721+'\x27'));const _0x3a8d1e=validateProfileName(_0x51d721);if(_0x3a8d1e!==!![])return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)](_0x3a8d1e)),0x1;_0x2adae0=_0x51d721;}else{const _0x2bb1ab=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1f0),'message':_0xacc9f9(0x1fb),'validate':_0x2d0f9d=>validateProfileName(_0x2d0f9d,{'skipExistsCheck':_0x31b863})});if(!_0x2bb1ab[_0xacc9f9(0x1f0)])return console[_0xacc9f9(0x1db)]('\x0aSetup\x20cancelled'),0x1;_0x2adae0=_0x2bb1ab[_0xacc9f9(0x1f0)]['trim'](),_0x31b863&&profileExists(_0x2adae0)&&(await deleteProfileAndCredentials(_0x2adae0),console['log'](_0xacc9f9(0x1ae)+_0x2adae0+'\x27'));}const _0x2cf222=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1ed),'message':'Enter\x20description\x20(optional):'}),_0x3642ea=_0x2cf222[_0xacc9f9(0x1ed)]?.[_0xacc9f9(0x1fe)]()||undefined,_0x22d1e4=_0xd2184d[_0xacc9f9(0x1c2)]||_0xacc9f9(0x1d8),_0x23ef16=await promptSiteSelection(_0x22d1e4,_0x2adae0,_0xacc9f9(0x1af));if(!_0x23ef16)return 0x1;const _0x119ef9=resolveSite(_0x23ef16),_0x46f2aa=await promptAuthMethod();if(!_0x46f2aa)return console['log'](_0xacc9f9(0x1d0)),0x1;if(_0x46f2aa==='oauth'){if(_0x3642ea){const _0x3dac6a={'site':_0x119ef9,'description':_0x3642ea};saveProfileToUserConfig(_0x2adae0,_0x3dac6a);}const {accountName:_0x5d8c35}=_0xd2184d;return await runOAuthLoginFlow(_0x119ef9,_0x2adae0,_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)],{'accountName':_0x5d8c35}),0x0;}console[_0xacc9f9(0x1db)](_0xacc9f9(0x1f7)+_0x119ef9),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1c5)),console[_0xacc9f9(0x1db)]('\x20\x20'+getConsoleUrl(_0x119ef9,_0xacc9f9(0x1a7)));const _0xbe6a5a=await a33_0x1b514e({'type':_0xacc9f9(0x1dc),'name':_0xacc9f9(0x1a2),'message':_0xacc9f9(0x1aa),'validate':_0x561327=>{const _0x1a74f3=_0xacc9f9;if(!_0x561327||!_0x561327[_0x1a74f3(0x1fe)]())return _0x1a74f3(0x19d);return!![];}});if(!_0xbe6a5a[_0xacc9f9(0x1a2)])return console[_0xacc9f9(0x1db)](_0xacc9f9(0x1d0)),0x1;const _0x130c6e=_0xbe6a5a[_0xacc9f9(0x1a2)];console[_0xacc9f9(0x1db)]('Validating\x20API\x20key...');try{const _0x2688ad=TDX['create']({'site':_0x119ef9,'apiKey':_0x130c6e[_0xacc9f9(0x1fe)](),'logLevel':_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)]}),_0x28d8c2=await _0x2688ad[_0xacc9f9(0x1c8)][_0xacc9f9(0x1d6)]();console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1d4)+_0x28d8c2[_0xacc9f9(0x1f2)]+')');const _0x5104d2=await isKeychainAvailable();_0x5104d2?(await saveAPIKeyAsync(_0x130c6e[_0xacc9f9(0x1fe)](),_0x119ef9,_0x2adae0),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2adae0+')')):(console['warn'](a33_0x5d2c3c[_0xacc9f9(0x1a8)](_0xacc9f9(0x1b2))),console[_0xacc9f9(0x1b6)](a33_0x5d2c3c['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xbc1e={'site':_0x119ef9,..._0x3642ea&&{'description':_0x3642ea}};return saveProfileToUserConfig(_0x2adae0,_0xbc1e),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1bb)+_0x2adae0+_0xacc9f9(0x1e9)),console[_0xacc9f9(0x1db)](),console[_0xacc9f9(0x1db)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0xacc9f9(0x203)+_0x2adae0+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xacc9f9(0x1db)]('\x20\x20tdx\x20--profile\x20'+_0x2adae0+_0xacc9f9(0x1e5)),0x0;}catch(_0x5d8750){if(_0x5d8750 instanceof HTTPClientError&&_0x5d8750['status']===0x191)return printAuthError(_0x5d8750),0x1;return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)]('✗\x20Validation\x20failed:\x20'+(_0x5d8750 instanceof Error?_0x5d8750[_0xacc9f9(0x1f5)]:String(_0x5d8750)))),console[_0xacc9f9(0x1c6)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a33_0x543e(_0x2d03ec,_0x3254f3){_0x2d03ec=_0x2d03ec-0x19d;const _0x604e5d=a33_0x604e();let _0x543e5f=_0x604e5d[_0x2d03ec];return _0x543e5f;}export class ProfileDeleteCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1e2);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1e1);[a33_0x49df6b(0x1be)](_0x11bf82){const _0x274b92=a33_0x49df6b,{args:_0x4173be}=_0x11bf82;if(_0x4173be[_0x274b92(0x1fd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x49df6b(0x1e7)](_0x10c5dc){const _0x594c4c=a33_0x49df6b,{args:_0x2594be}=_0x10c5dc,_0x5420f5=_0x2594be[0x0];console[_0x594c4c(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20delete'));if(!profileExists(_0x5420f5)){console[_0x594c4c(0x1c6)](a33_0x5d2c3c[_0x594c4c(0x1cf)]('Profile\x20\x27'+_0x5420f5+'\x27\x20does\x20not\x20exist.')),console[_0x594c4c(0x1db)]('\x0aAvailable\x20profiles:');const _0x1fbcbf=listProfiles();if(_0x1fbcbf[_0x594c4c(0x1fd)]===0x0)console[_0x594c4c(0x1db)](_0x594c4c(0x1c0));else for(const _0x2e61ec of _0x1fbcbf){console['log'](_0x594c4c(0x1f4)+_0x2e61ec['name']);}return 0x1;}const _0x1ecea2=await a33_0x1b514e({'type':'confirm','name':_0x594c4c(0x1f1),'message':_0x594c4c(0x19e)+_0x5420f5+'\x27?','initial':![]});if(!_0x1ecea2[_0x594c4c(0x1f1)])return console[_0x594c4c(0x1db)](_0x594c4c(0x1a5)),0x0;try{await deleteProfileAndCredentials(_0x5420f5),console[_0x594c4c(0x1db)](a33_0x5d2c3c[_0x594c4c(0x1e4)]('✓')+_0x594c4c(0x1bb)+_0x5420f5+_0x594c4c(0x1f3));}catch(_0x4ad5e5){return console[_0x594c4c(0x1c6)](a33_0x5d2c3c['red'](_0x594c4c(0x1f8)+(_0x4ad5e5 instanceof Error?_0x4ad5e5[_0x594c4c(0x1f5)]:String(_0x4ad5e5)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1b7);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1a0);static [a33_0x49df6b(0x1ab)]=[a33_0x49df6b(0x1c2),a33_0x49df6b(0x1b9),a33_0x49df6b(0x1bc),a33_0x49df6b(0x1a4),a33_0x49df6b(0x1ff),a33_0x49df6b(0x1ed)];[a33_0x49df6b(0x1be)](_0x46bf9f){const _0x41ef33=a33_0x49df6b,{args:_0x2e046f,options:_0x8ab80a}=_0x46bf9f,_0x109282=_0x8ab80a['profile']||getActiveProfile();if(!_0x109282)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2e046f['length']===0x0)return _0x41ef33(0x1a3)+ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x204)](',\x20');const _0x69af0d=_0x2e046f[0x0];if(!_0x69af0d[_0x41ef33(0x1c1)]('='))return _0x41ef33(0x1b4)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');const [_0x5de66d]=_0x69af0d[_0x41ef33(0x1ec)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x1c1)](_0x5de66d))return _0x41ef33(0x1a6)+_0x5de66d+_0x41ef33(0x1f9)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');return undefined;}async['execute'](_0x59f96f){const _0x35c0fd=a33_0x49df6b,{args:_0x2ce5b3,options:_0x50ca72}=_0x59f96f,_0x48f393=_0x50ca72[_0x35c0fd(0x1cc)]||getActiveProfile(),[_0x16bb69,..._0x306420]=_0x2ce5b3[0x0][_0x35c0fd(0x1ec)]('='),_0x2e44e3=_0x306420[_0x35c0fd(0x204)]('=');console[_0x35c0fd(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x48f393)){const _0x134c09=await a33_0x1b514e({'type':'confirm','name':_0x35c0fd(0x1cb),'message':_0x35c0fd(0x1b0)+_0x48f393+_0x35c0fd(0x1fa),'initial':!![]});if(!_0x134c09['create'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x205)),0x1;}const _0x54b984=loadProfile(_0x48f393),_0x5affe3=_0x54b984?.[_0x35c0fd(0x1ee)]||{};if(_0x16bb69===_0x35c0fd(0x1c2)){const _0x24b994=resolveSite(_0x2e44e3);console[_0x35c0fd(0x1db)](_0x35c0fd(0x1ba)+_0x24b994+_0x35c0fd(0x200)),console[_0x35c0fd(0x1db)](_0x35c0fd(0x202)),console[_0x35c0fd(0x1db)]('\x20\x20'+getConsoleUrl(_0x24b994,_0x35c0fd(0x1a7)));const _0xedb120=await a33_0x1b514e({'type':_0x35c0fd(0x1dc),'name':_0x35c0fd(0x1a2),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x2a2ccb=>{const _0x12ee87=_0x35c0fd;if(!_0x2a2ccb||!_0x2a2ccb['trim']())return _0x12ee87(0x19d);return!![];}});if(!_0xedb120['apiKey'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x1fc)),0x1;console[_0x35c0fd(0x1db)](_0x35c0fd(0x1c3));try{const _0x5d686c=TDX['create']({'site':_0x24b994,'apiKey':_0xedb120[_0x35c0fd(0x1a2)][_0x35c0fd(0x1fe)](),'logLevel':_0x50ca72[_0x35c0fd(0x1e6)]??LogLevel[_0x35c0fd(0x1c7)]}),_0x4dd1b4=await _0x5d686c[_0x35c0fd(0x1c8)][_0x35c0fd(0x1d6)]();console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1d4)+_0x4dd1b4[_0x35c0fd(0x1f2)]+')');const _0x5d0f93=await isKeychainAvailable();_0x5d0f93?(await saveAPIKeyAsync(_0xedb120['apiKey'][_0x35c0fd(0x1fe)](),_0x24b994,_0x48f393),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1da))):console[_0x35c0fd(0x1b6)](a33_0x5d2c3c[_0x35c0fd(0x1a8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5affe3['site']=_0x24b994;}catch(_0x217698){if(_0x217698 instanceof HTTPClientError&&_0x217698[_0x35c0fd(0x1ce)]===0x191)return printAuthError(_0x217698),0x1;return console[_0x35c0fd(0x1c6)](a33_0x5d2c3c['red'](_0x35c0fd(0x1c9)+(_0x217698 instanceof Error?_0x217698[_0x35c0fd(0x1f5)]:String(_0x217698)))),console['error'](_0x35c0fd(0x1ac)),0x1;}}else _0x5affe3[_0x16bb69]=_0x2e44e3||undefined;return saveProfileToUserConfig(_0x48f393,_0x5affe3),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+'\x20Profile\x20\x27'+_0x48f393+'\x27\x20updated:\x20'+_0x16bb69+'='+(_0x2e44e3||_0x35c0fd(0x1ea))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]='profile:use';[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1cd);[a33_0x49df6b(0x1be)](_0x2d90f4){const _0x3aa99f=a33_0x49df6b,{args:_0x536682}=_0x2d90f4;if(_0x536682[_0x3aa99f(0x1fd)]===0x0)return _0x3aa99f(0x201);return undefined;}async['execute'](_0x34977d){const _0xc4cf74=a33_0x49df6b,{args:_0x241738,options:_0x26b4f6}=_0x34977d,_0x410d68=_0x241738[0x0],_0xdc69ad=_0x26b4f6[_0xc4cf74(0x19f)];cleanExpiredSessions();if(!profileExists(_0x410d68)){console['error'](a33_0x5d2c3c[_0xc4cf74(0x1cf)]('Profile\x20\x27'+_0x410d68+'\x27\x20does\x20not\x20exist.')),console[_0xc4cf74(0x1db)](_0xc4cf74(0x1df));const _0x353e29=listProfiles();if(_0x353e29['length']===0x0)console[_0xc4cf74(0x1db)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x15f4ea of _0x353e29){console['log'](_0xc4cf74(0x1f4)+_0x15f4ea[_0xc4cf74(0x1ad)]);}return 0x1;}if(_0xdc69ad){const _0x329062=a33_0x49908d['join'](getConfigDir(),_0xc4cf74(0x1a9));return saveActiveProfileToUserConfig(_0x410d68),console[_0xc4cf74(0x1db)]('Default\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)),console['log'](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aSaved\x20to:\x20'+_0x329062)),0x0;}const _0x31bb0b=getSessionID(_0x26b4f6[_0xc4cf74(0x1c4)]);return saveSessionContext({'profile':_0x410d68},_0x26b4f6[_0xc4cf74(0x1c4)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)+'\x20'+a33_0x5d2c3c['dim'](_0xc4cf74(0x1b8)+_0x31bb0b+')')),console[_0xc4cf74(0x1db)](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x410d68+_0xc4cf74(0x1d1))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0x102f89=a34_0x2ab8;(function(_0x380640,_0x5bfb08){const _0x1d0b2b=a34_0x2ab8,_0x5b55c3=_0x380640();while(!![]){try{const _0x2845c5=parseInt(_0x1d0b2b(0x99))/0x1*(-parseInt(_0x1d0b2b(0x9e))/0x2)+parseInt(_0x1d0b2b(0xaf))/0x3+-parseInt(_0x1d0b2b(0xa5))/0x4+-parseInt(_0x1d0b2b(0xad))/0x5+parseInt(_0x1d0b2b(0x9b))/0x6*(parseInt(_0x1d0b2b(0x9a))/0x7)+parseInt(_0x1d0b2b(0xa0))/0x8+parseInt(_0x1d0b2b(0xa4))/0x9;if(_0x2845c5===_0x5bfb08)break;else _0x5b55c3['push'](_0x5b55c3['shift']());}catch(_0x1efa40){_0x5b55c3['push'](_0x5b55c3['shift']());}}}(a34_0x2277,0x280b0));import{BaseCommand}from'./command.js';function a34_0x2ab8(_0x39a861,_0x26b23f){_0x39a861=_0x39a861-0x98;const _0x2277ca=a34_0x2277();let _0x2ab846=_0x2277ca[_0x39a861];return _0x2ab846;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2277(){const _0x278ec8=['Error:\x20','message','log','5376096kIskcd','1081128qkCCZs','List\x20all\x20available\x20profiles','name','length','profiles','dim','site','\x20\x20Global:\x20~/.config/tdx/tdx.json','1623385bDYNJx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','282585ZceMHZ','config','1sDLuqv','7483DKeLMM','684AxJgxh','description','👤\x20','654496rCOJQn','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2182544hdCVtf'];a34_0x2277=function(){return _0x278ec8;};return a34_0x2277();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0xf16d07 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x102f89(0xa7)]=a34_0x102f89(0xa9);[a34_0x102f89(0x9c)]=a34_0x102f89(0xa6);async['execute'](_0x1b6ee9){const _0x3f13ad=a34_0x102f89,{options:_0x494a90}=_0x1b6ee9;try{const _0x7de633=listProfiles(),_0x1cece9=getActiveProfile();if(_0x7de633[_0x3f13ad(0xa8)]===0x0)return console[_0x3f13ad(0xa3)](_0x3f13ad(0xae)),console[_0x3f13ad(0xa3)](_0x3f13ad(0x9f)),console['log'](_0x3f13ad(0xac)),0x0;const _0x3e51e7=_0x7de633['map'](_0x5402a6=>{const _0x4642e6=_0x3f13ad,_0x4a5cbc=_0x5402a6[_0x4642e6(0xa7)]===_0x1cece9,_0x50b179=getProfileParams(_0x5402a6[_0x4642e6(0x98)]);return{'name':_0x5402a6['name'],'active':_0x4a5cbc,'scope':_0x5402a6['scope'],'description':_0x5402a6['config'][_0x4642e6(0x9c)]||'','params':_0x50b179};});if(isStructuredFormat(_0x494a90))await handleSDKOutput(_0x3e51e7,_0x494a90);else for(const _0x2d3060 of _0x7de633){const _0x15664d=_0x2d3060[_0x3f13ad(0xa7)]===_0x1cece9?a34_0xf16d07['green']('\x20✓'):'',_0x5d268d=_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0xab)]?a34_0xf16d07[_0x3f13ad(0xaa)]('\x20'+_0x2d3060['config'][_0x3f13ad(0xab)]):'',_0x5bd673=_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0x9c)]?a34_0xf16d07[_0x3f13ad(0xaa)]('\x20\x20'+_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0x9c)]):'';console[_0x3f13ad(0xa3)](_0x3f13ad(0x9d)+_0x2d3060[_0x3f13ad(0xa7)]+_0x15664d+_0x5d268d+_0x5bd673);}return 0x0;}catch(_0x468b5e){return _0x468b5e instanceof Error&&console['error'](_0x3f13ad(0xa1)+_0x468b5e[_0x3f13ad(0xa2)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x1509df=a35_0x49ef;(function(_0x2e678b,_0x986a62){const _0x5171ab=a35_0x49ef,_0x491702=_0x2e678b();while(!![]){try{const _0x9458f2=parseInt(_0x5171ab(0x13f))/0x1*(-parseInt(_0x5171ab(0x12e))/0x2)+parseInt(_0x5171ab(0x148))/0x3*(-parseInt(_0x5171ab(0x140))/0x4)+parseInt(_0x5171ab(0x13b))/0x5+parseInt(_0x5171ab(0x14c))/0x6+-parseInt(_0x5171ab(0x151))/0x7+parseInt(_0x5171ab(0x14d))/0x8*(-parseInt(_0x5171ab(0x131))/0x9)+parseInt(_0x5171ab(0x123))/0xa*(parseInt(_0x5171ab(0x13d))/0xb);if(_0x9458f2===_0x986a62)break;else _0x491702['push'](_0x491702['shift']());}catch(_0x257622){_0x491702['push'](_0x491702['shift']());}}}(a35_0x1185,0xd03d8));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x49ef(_0x367d7a,_0x3aad96){_0x367d7a=_0x367d7a-0x11f;const _0x1185c2=a35_0x1185();let _0x49efb1=_0x1185c2[_0x367d7a];return _0x49efb1;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1509df(0x14a)]='query';[a35_0x1509df(0x134)]=a35_0x1509df(0x14f);async[a35_0x1509df(0x126)](_0x3eca3c){const _0x4c9b1e=a35_0x1509df,{options:_0xfe087d,args:_0x118d76,tdx:_0x226471}=_0x3eca3c,_0x555dd8={..._0xfe087d,'limitStructuredFormats':!![]},_0x477b1f=_0x118d76[0x0],_0x299de0=_0xfe087d['file'];let _0x5760fa;try{if(_0x299de0)_0x5760fa=readSqlStatementsFromFile(_0x299de0);else{if(_0x477b1f==='-')_0x5760fa=await readSqlStatementsFromStdin();else{if(_0x477b1f&&isSqlFilePath(_0x477b1f))_0x5760fa=readSqlStatementsFromFile(_0x477b1f);else{if(_0x477b1f)_0x5760fa=splitSqlStatements(_0x477b1f);else throw new Error(_0x4c9b1e(0x13c));}}}}catch(_0x12cca6){return console[_0x4c9b1e(0x137)](_0x4c9b1e(0x146)+_0x12cca6[_0x4c9b1e(0x141)]),0x1;}const _0x451bf0=_0xfe087d[_0x4c9b1e(0x129)]||'information_schema',_0x58d15b=_0xfe087d['catalog'];try{const _0x4c0ba1=[],_0x42bd01=!!_0xfe087d['output'];for(let _0x52ca99=0x0;_0x52ca99<_0x5760fa['length'];_0x52ca99++){const _0x2bb10d=_0x5760fa[_0x52ca99],_0x54fff4=_0x52ca99+0x1,_0x3114da=_0x5760fa[_0x4c9b1e(0x136)],_0x4b3925=_0x3114da>0x1;_0xfe087d[_0x4c9b1e(0x143)]&&(console[_0x4c9b1e(0x137)]('\x0a'+(_0x4b3925?_0x4c9b1e(0x13a)+_0x54fff4+'/'+_0x3114da+':':'')),console[_0x4c9b1e(0x137)](_0x4c9b1e(0x133)+_0xfe087d[_0x4c9b1e(0x138)]),console[_0x4c9b1e(0x137)]('Catalog:\x20'+(_0x58d15b||'td')),console[_0x4c9b1e(0x137)]('Schema:\x20'+_0x451bf0),console[_0x4c9b1e(0x137)](_0x4c9b1e(0x12a)+_0x2bb10d));const _0x53a04a=_0x4b3925?_0x4c9b1e(0x121)+_0x54fff4+'/'+_0x3114da+_0x4c9b1e(0x12f):_0x4c9b1e(0x149);try{const _0x436114=await withProgressSpinner(_0x53a04a,async _0x2bdac6=>{const _0x333cfd=_0x4c9b1e,_0x24002a=await _0x226471['query'][_0x333cfd(0x126)](_0x2bb10d,{'catalog':_0x58d15b,'schema':_0x451bf0,'onJobId':_0x236a2d=>{const _0x1b6300=_0x333cfd;_0x2bdac6[_0x1b6300(0x145)](_0x236a2d);},'onProgress':_0xd559a0=>{const _0x48eb7b=_0x333cfd;_0x2bdac6['setPhase'](_0x48eb7b(0x12c)+_0xd559a0[_0x48eb7b(0x12b)]+']'),_0x2bdac6[_0x48eb7b(0x14b)](formatRows(_0xd559a0[_0x48eb7b(0x14e)])+'\x20rows\x20'+_0xd559a0[_0x48eb7b(0x150)]+'/'+_0xd559a0['totalSplits']+_0x48eb7b(0x120));}});return _0x24002a;},{'verbose':_0xfe087d[_0x4c9b1e(0x143)]}),_0x1df6af=_0x436114['data'],_0x171126=_0x1df6af[_0x4c9b1e(0x128)]?_0x4c9b1e(0x124)+_0x1df6af[_0x4c9b1e(0x128)]+']':'',_0xc34f9b=_0x4b3925?_0x4c9b1e(0x13a)+_0x54fff4+'/'+_0x3114da+'\x20-\x20':'';console['error']('✔\x20'+_0xc34f9b+_0x4c9b1e(0x13e)+formatRows(_0x1df6af[_0x4c9b1e(0x122)]['processedRows'])+_0x4c9b1e(0x125)+(_0x4c9b1e(0x132)+formatElapsed(_0x1df6af[_0x4c9b1e(0x122)][_0x4c9b1e(0x11f)])+_0x171126));if(_0x4b3925&&_0x42bd01){const _0x478e8f=resolveOutputOptions(_0x555dd8),_0x27d2f7=await formatQueryOutput(_0x1df6af,_0x478e8f);_0x4c0ba1[_0x4c9b1e(0x127)](_0x27d2f7);}else await handleQueryOutput(_0x1df6af,_0x555dd8);}catch(_0x43f85b){const _0x5dea3d=_0x4b3925?'Statement\x20'+_0x54fff4+'/'+_0x3114da+':\x0a':'',_0x50a43e=_0x43f85b instanceof SDKError?_0x43f85b[_0x4c9b1e(0x144)]:_0x43f85b[_0x4c9b1e(0x141)];return console[_0x4c9b1e(0x137)](''+_0x5dea3d+_0x50a43e),0x1;}}if(_0x5760fa[_0x4c9b1e(0x136)]>0x1&&_0x42bd01&&_0x4c0ba1['length']>0x0){const _0x1b6134=_0x4c0ba1[_0x4c9b1e(0x12d)]('\x0a');writeFileSync(_0xfe087d[_0x4c9b1e(0x139)],_0x1b6134),console['error'](_0x4c9b1e(0x147)+_0xfe087d[_0x4c9b1e(0x139)]);}return 0x0;}catch(_0x36ba27){throw _0x36ba27;}}[a35_0x1509df(0x142)](_0x3c5ccd){const _0x1c50ab=a35_0x1509df,_0x42fbd8=_0x3c5ccd['args'][0x0],_0x4029a7=_0x3c5ccd[_0x1c50ab(0x130)][_0x1c50ab(0x135)];if(!_0x42fbd8&&!_0x4029a7)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(_0x42fbd8&&_0x4029a7)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}function a35_0x1185(){const _0x5b281b=['length','error','site','output','Statement\x20','2291055iSFzhy','No\x20SQL\x20provided','6017gFZNzi','Query\x20completed:\x20Processed\x20','17927FgYNil','4088VxJEXF','message','validate','verbose','originalMessage','setJobId','Error:\x20','\x0aAll\x20results\x20saved\x20to\x20','1383cbckhW','Executing\x20query...','name','setExtra','1566210iqyGDh','424nHTTvr','processedRows','Run\x20Trino\x20queries\x20(streaming)','completedSplits','10467576FFuLrk','elapsedTimeMillis','\x20splits','Executing\x20statement\x20','stats','50870PjpGHt','\x20[Job\x20ID:\x20','\x20rows\x20','execute','push','jobId','database','SQL:\x20','state','Executing\x20query\x20[','join','16zwGpFl','...','options','91521uFCRuh','in\x20','Site:\x20','description','file'];a35_0x1185=function(){return _0x5b281b;};return a35_0x1185();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x448907=a36_0x3e96;(function(_0x5e6f03,_0x2fd85e){const _0x111f80=a36_0x3e96,_0x32c646=_0x5e6f03();while(!![]){try{const _0x5459e6=parseInt(_0x111f80(0x182))/0x1*(-parseInt(_0x111f80(0x18e))/0x2)+-parseInt(_0x111f80(0x1c2))/0x3*(parseInt(_0x111f80(0x180))/0x4)+parseInt(_0x111f80(0x1b5))/0x5+parseInt(_0x111f80(0x175))/0x6+parseInt(_0x111f80(0x1f9))/0x7+-parseInt(_0x111f80(0x1d6))/0x8*(parseInt(_0x111f80(0x1db))/0x9)+parseInt(_0x111f80(0x1a9))/0xa;if(_0x5459e6===_0x2fd85e)break;else _0x32c646['push'](_0x32c646['shift']());}catch(_0xc4a96a){_0x32c646['push'](_0x32c646['shift']());}}}(a36_0x57c7,0x9d2ea));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x57c7(){const _0x364c87=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','/app/queries/editor?queryId=','max','end_at','soon','count','Failed\x20to\x20read\x20file:\x20','Getting\x20schedule\x20details...','round','data','entries','success','in\x20','delete','scheduled_at','delay','updated_at','Listing\x20scheduled\x20queries...','dim','description','15810570jnIbKH','time','list','substring','name','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20created:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:run','\x20\x20Cron:\x20','\x20\x20Num:\x20','m\x20ago','1386755dNkfZV','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','retry_limit','toLocaleDateString','Cancelled','schedule:show','(unnamed)','INVALID_ARGUMENT','📅\x20','padEnd','cyan','Searching\x20scheduled\x20queries\x20matching\x20\x22','ended_at','69ednChv','history','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','start_at','verbose','green','log','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','type','Running\x20schedule:\x20','repeat','queryUrl','engine_version','Delete\x20a\x20scheduled\x20query','last_job','next_run_at','execute','database','7426256sesTAu','has_next_page','validate','status','executing_user_id','9afEKnX','\x20created','queries','\x20execution','abs','No\x20scheduled\x20queries\x20found','\x20\x20Job\x20ID:\x20','lastRun','priority','time_zone','schedule:delete','from','Update\x20a\x20scheduled\x20query','Running\x20schedule...','just\x20now','...','red','trim','Schedule\x20run\x20submitted:\x20','engineVersion','Updating\x20schedule...','map','show','user','listQueries','user_name','\x20matching\x20\x22','result','statusIcon','jsonl','1469762QURIOO','num','nextRun','format','created_at','getTime','Found\x20','options','cron','2222412KdgLTz','Show\x20schedule\x20execution\x20history','Showing\x20first\x20','Create\x20a\x20scheduled\x20query','table','timezone','args','query','schedule:create','run','json','142860lbxyaU','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','3TMmSes','schedule:update','\x20\x20Type:\x20','jobs','tsv','Schedule\x20deleted:\x20','utf-8','limit','Getting\x20schedule\x20history...','length','join','retryLimit','30154aqaORI','\x20schedules','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedules','file','Deleting\x20schedule...'];a36_0x57c7=function(){return _0x364c87;};return a36_0x57c7();}function a36_0x3e96(_0x35d951,_0x4d9d6c){_0x35d951=_0x35d951-0x174;const _0x57c7bf=a36_0x57c7();let _0x3e966f=_0x57c7bf[_0x35d951];return _0x3e966f;}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_0x248afb from'chalk';function formatRelativeTime(_0x4748f8){const _0x2e5e4f=a36_0x3e96,_0x2a7f45=new Date(_0x4748f8),_0x416805=new Date(),_0x1f27a6=_0x2a7f45[_0x2e5e4f(0x1fe)]()-_0x416805['getTime'](),_0x3cdb25=Math[_0x2e5e4f(0x1df)](_0x1f27a6)/0x3e8,_0x361a48=_0x1f27a6<0x0;if(_0x3cdb25<0x3c)return _0x361a48?_0x2e5e4f(0x1e9):_0x2e5e4f(0x199);else{if(_0x3cdb25<0xe10){const _0x54b57b=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0x3c);return _0x361a48?_0x54b57b+_0x2e5e4f(0x1b4):'in\x20'+_0x54b57b+'m';}else{if(_0x3cdb25<0x15180){const _0x15d0a9=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0xe10);return _0x361a48?_0x15d0a9+'h\x20ago':'in\x20'+_0x15d0a9+'h';}else{if(_0x3cdb25<0x93a80){const _0x251d30=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0x15180);return _0x361a48?_0x251d30+'d\x20ago':_0x2e5e4f(0x1a1)+_0x251d30+'d';}else return _0x2a7f45[_0x2e5e4f(0x1b8)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x448907(0x1ad)]='schedule:list';[a36_0x448907(0x1a8)]='List\x20scheduled\x20queries';async[a36_0x448907(0x1d4)](_0x1893e2){const _0x1b0e90=a36_0x448907,{options:_0x2709c7,args:_0x12efb9,tdx:_0x1f17d2}=_0x1893e2,_0x46f5b1=resolveLimit(_0x2709c7[_0x1b0e90(0x189)],DEFAULT_DISPLAY_LIMIT),_0x5e0579=_0x12efb9[0x0],_0x2ebbc9=_0x5e0579?_0x1b0e90(0x1c0)+_0x5e0579+'\x22...':_0x1b0e90(0x1a6),_0xc191b1=await withSpinner(_0x2ebbc9,()=>_0x1f17d2[_0x1b0e90(0x192)][_0x1b0e90(0x1f3)]({'limit':_0x46f5b1,'scheduled':!![],'pattern':_0x5e0579}),{'verbose':_0x2709c7[_0x1b0e90(0x1c8)]}),_0x1ea89f=_0xc191b1['data'][_0x1b0e90(0x1dd)],_0x345520=_0xc191b1[_0x1b0e90(0x19e)]['pagination'][_0x1b0e90(0x1d7)],_0x34a3ab=_0x5e0579?_0x1b0e90(0x1f5)+_0x5e0579+'\x22':'';_0x345520?console[_0x1b0e90(0x190)](_0x1b0e90(0x177)+_0x1ea89f[_0x1b0e90(0x18b)]+_0x1b0e90(0x18f)+_0x34a3ab+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x1b0e90(0x190)](_0x1b0e90(0x1ff)+_0x1ea89f[_0x1b0e90(0x18b)]+'\x20scheduled\x20quer'+(_0x1ea89f[_0x1b0e90(0x18b)]!==0x1?'ies':'y')+_0x34a3ab);if(_0x2709c7[_0x1b0e90(0x1fc)]===_0x1b0e90(0x17f)||_0x2709c7['format']===_0x1b0e90(0x1f8)||_0x2709c7['format']===_0x1b0e90(0x179)||_0x2709c7[_0x1b0e90(0x1fc)]===_0x1b0e90(0x186)){const _0x475eda=_0x1ea89f[_0x1b0e90(0x1f0)](_0xb2d4de=>({'id':_0xb2d4de['id'],'name':_0xb2d4de[_0x1b0e90(0x1ad)],'cron':_0xb2d4de[_0x1b0e90(0x174)],'database':_0xb2d4de[_0x1b0e90(0x1d5)]?.[_0x1b0e90(0x1ad)],'type':_0xb2d4de['type'],'timezone':_0xb2d4de[_0x1b0e90(0x1e4)],'user_name':_0xb2d4de[_0x1b0e90(0x1f2)]?.[_0x1b0e90(0x1ad)],'updated_at':_0xb2d4de[_0x1b0e90(0x1a5)],'next_run_at':_0xb2d4de[_0x1b0e90(0x1d3)],'last_job_status':_0xb2d4de[_0x1b0e90(0x1d2)]?.['status']}));await handleSDKOutput(_0x475eda,_0x2709c7);}else{if(_0x1ea89f[_0x1b0e90(0x18b)]===0x0)console[_0x1b0e90(0x1ca)](_0x1b0e90(0x1e0));else{const _0x3cfd63=_0x2709c7['site'],_0x2ab94b=_0x1ea89f[_0x1b0e90(0x1f0)](_0x569415=>{const _0x1255e0=_0x1b0e90,_0x494af3=_0x569415[_0x1255e0(0x1d2)]?.[_0x1255e0(0x1d9)]?_0x569415[_0x1255e0(0x1d2)][_0x1255e0(0x1d9)]==='success'?'✓':'✗':'-',_0x126e13=_0x569415['last_job']?.[_0x1255e0(0x1c1)]?formatRelativeTime(_0x569415[_0x1255e0(0x1d2)][_0x1255e0(0x1c1)]):'never',_0x1269c6=_0x569415['next_run_at']?formatRelativeTime(_0x569415[_0x1255e0(0x1d3)]):'-',_0x366336=_0x569415[_0x1255e0(0x174)]||'',_0x4d49bc=_0x569415['name']||_0x1255e0(0x1bb),_0x510be5=getConsoleUrl(_0x3cfd63,_0x1255e0(0x196)+_0x569415['id']);return{'statusIcon':_0x494af3,'lastRun':_0x126e13,'nextRun':_0x1269c6,'cron':_0x366336,'name':_0x4d49bc,'queryUrl':_0x510be5,'status':_0x569415[_0x1255e0(0x1d2)]?.[_0x1255e0(0x1d9)]};}),_0x4f9439=Math[_0x1b0e90(0x197)](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x319f80=>_0x319f80['lastRun'][_0x1b0e90(0x18b)])),_0xa6b077=Math['max'](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x485037=>_0x485037[_0x1b0e90(0x1fb)]['length'])),_0xacfcc8=Math[_0x1b0e90(0x197)](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x5b503=>_0x5b503[_0x1b0e90(0x174)][_0x1b0e90(0x18b)])),_0x1d2587=_0x2ab94b[_0x1b0e90(0x1f0)](_0x2bd835=>{const _0x127d88=_0x1b0e90,_0x2009c9=_0x2bd835['status']===_0x127d88(0x1a0)?a36_0x248afb[_0x127d88(0x1c9)](_0x2bd835[_0x127d88(0x1f7)]):_0x2bd835[_0x127d88(0x1d9)]==='error'?a36_0x248afb[_0x127d88(0x1eb)](_0x2bd835[_0x127d88(0x1f7)]):a36_0x248afb[_0x127d88(0x1a7)](_0x2bd835[_0x127d88(0x1f7)]),_0x585d9f=_0x2bd835[_0x127d88(0x1e2)]['padEnd'](_0x4f9439),_0x53e369=_0x2bd835[_0x127d88(0x1fb)][_0x127d88(0x1be)](_0xa6b077),_0x2575b1=_0x2bd835[_0x127d88(0x174)]?a36_0x248afb[_0x127d88(0x1bf)](_0x2bd835['cron']['padEnd'](_0xacfcc8)):'\x20'[_0x127d88(0x1ce)](_0xacfcc8),_0xcf10f3=hyperlink(_0x2bd835[_0x127d88(0x1ad)],_0x2bd835[_0x127d88(0x1cf)]);return _0x127d88(0x1bd)+_0x2009c9+'\x20'+_0x585d9f+'\x20\x20→\x20'+_0x53e369+'\x20\x20'+_0x2575b1+'\x20\x20'+_0xcf10f3;});await writeOutput(_0x1d2587[_0x1b0e90(0x18c)]('\x0a'),_0x2709c7['output'],_0x1b0e90(0x1ab));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x448907(0x1ba);[a36_0x448907(0x1a8)]='Show\x20schedule\x20details';[a36_0x448907(0x1d8)](_0x21f39d){const _0x23906a=a36_0x448907,_0x440566=_0x21f39d[_0x23906a(0x17b)][0x0];if(!_0x440566)return _0x23906a(0x1c6);return undefined;}async[a36_0x448907(0x1d4)](_0x547148){const _0xe1ec5d=a36_0x448907,{options:_0x515aff,args:_0x336f0f,tdx:_0xdea53c}=_0x547148,_0x103582=_0x336f0f[0x0],_0x149cbe=await withSpinner(_0xe1ec5d(0x19c),()=>_0xdea53c['schedules'][_0xe1ec5d(0x1f1)](_0x103582),{'verbose':_0x515aff[_0xe1ec5d(0x1c8)]}),_0xe2d237=_0x149cbe[_0xe1ec5d(0x19e)],_0x13f9e0={'name':_0xe2d237[_0xe1ec5d(0x1ad)],'cron':_0xe2d237[_0xe1ec5d(0x174)],'database':_0xe2d237[_0xe1ec5d(0x1d5)],'type':_0xe2d237[_0xe1ec5d(0x1cc)],'timezone':_0xe2d237[_0xe1ec5d(0x17a)],'user_name':_0xe2d237[_0xe1ec5d(0x1f4)],'created_at':_0xe2d237[_0xe1ec5d(0x1fd)],'engine_version':_0xe2d237[_0xe1ec5d(0x1d0)],'executing_user_id':_0xe2d237[_0xe1ec5d(0x1da)],'query':_0xe2d237[_0xe1ec5d(0x17c)],'delay':_0xe2d237[_0xe1ec5d(0x1a4)],'priority':_0xe2d237['priority'],'retry_limit':_0xe2d237['retry_limit'],..._0xe2d237[_0xe1ec5d(0x1f6)]&&{'result':_0xe2d237['result']}};return await handleSingleObjectOutput(_0x13f9e0,_0x515aff),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x17d);[a36_0x448907(0x1a8)]=a36_0x448907(0x178);['validate'](_0x1f49f7){const _0x38c1e5=a36_0x448907,_0x22f5da=_0x1f49f7[_0x38c1e5(0x17b)][0x0];if(!_0x22f5da)return _0x38c1e5(0x1b0);const _0x17e891=_0x1f49f7[_0x38c1e5(0x200)];if(!_0x17e891[_0x38c1e5(0x1d5)])return _0x38c1e5(0x1ae);return undefined;}async[a36_0x448907(0x1d4)](_0x4b6de2){const _0x14489c=a36_0x448907,{options:_0x4f17e9,args:_0x420680,tdx:_0x3e7d97}=_0x4b6de2,_0x2e85b1=_0x420680[0x0],_0x5bdd12=_0x4f17e9,_0x4851ee=_0x5bdd12[_0x14489c(0x1d5)],_0x4ecf2b=_0x5bdd12['file'],_0x2ecd91=_0x5bdd12[_0x14489c(0x1cc)]||'trino';let _0x922d8a;try{_0x922d8a=readFileSync(_0x4ecf2b,_0x14489c(0x188))[_0x14489c(0x1ec)]();}catch(_0x3fa4e5){throw new SDKError(ErrorCode[_0x14489c(0x1bc)],'Failed\x20to\x20read\x20file:\x20'+_0x4ecf2b,_0x3fa4e5 instanceof Error?_0x3fa4e5:undefined);}if(!_0x922d8a)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x14cd67={'database':_0x4851ee,'query':_0x922d8a,'type':_0x2ecd91};if(_0x5bdd12[_0x14489c(0x174)])_0x14cd67[_0x14489c(0x174)]=_0x5bdd12['cron'];if(_0x5bdd12[_0x14489c(0x17a)])_0x14cd67['timezone']=_0x5bdd12['timezone'];if(_0x5bdd12[_0x14489c(0x1a4)]!==undefined)_0x14cd67['delay']=Number(_0x5bdd12[_0x14489c(0x1a4)]);if(_0x5bdd12[_0x14489c(0x1e3)]!==undefined)_0x14cd67[_0x14489c(0x1e3)]=Number(_0x5bdd12['priority']);if(_0x5bdd12[_0x14489c(0x18d)]!==undefined)_0x14cd67[_0x14489c(0x1b7)]=Number(_0x5bdd12[_0x14489c(0x18d)]);if(_0x5bdd12[_0x14489c(0x1ee)])_0x14cd67[_0x14489c(0x1d0)]=_0x5bdd12[_0x14489c(0x1ee)];if(_0x5bdd12['result'])_0x14cd67[_0x14489c(0x1f6)]=_0x5bdd12[_0x14489c(0x1f6)];if(_0x4f17e9[_0x14489c(0x1c8)]){console[_0x14489c(0x190)]('Creating\x20schedule:\x20'+_0x2e85b1),console['error']('\x20\x20Database:\x20'+_0x4851ee),console[_0x14489c(0x190)](_0x14489c(0x184)+_0x2ecd91);if(_0x14cd67[_0x14489c(0x174)])console[_0x14489c(0x190)](_0x14489c(0x1b2)+_0x14cd67[_0x14489c(0x174)]);if(_0x14cd67['timezone'])console['error'](_0x14489c(0x1c5)+_0x14cd67[_0x14489c(0x17a)]);}const _0x52fce4=await withSpinner('Creating\x20schedule...',()=>_0x3e7d97['schedules']['create'](_0x2e85b1,_0x14cd67),{'verbose':_0x4f17e9[_0x14489c(0x1c8)]});return console[_0x14489c(0x190)](_0x14489c(0x1af)+_0x52fce4['data'][_0x14489c(0x1ad)]),await handleSingleObjectOutput(_0x52fce4[_0x14489c(0x19e)],_0x4f17e9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x183);[a36_0x448907(0x1a8)]=a36_0x448907(0x1e7);[a36_0x448907(0x1d8)](_0x3d482e){const _0x3f2c87=a36_0x448907,_0x2a9dcf=_0x3d482e[_0x3f2c87(0x17b)][0x0];if(!_0x2a9dcf)return _0x3f2c87(0x1b6);return undefined;}async[a36_0x448907(0x1d4)](_0x406e6f){const _0x27f8ff=a36_0x448907,{options:_0x5b7386,args:_0x4c7a0f,tdx:_0x143c6d}=_0x406e6f,_0xe423ba=_0x4c7a0f[0x0],_0x2300cb=_0x5b7386,_0x36cdf9={};if(_0x2300cb['database'])_0x36cdf9[_0x27f8ff(0x1d5)]=_0x2300cb[_0x27f8ff(0x1d5)];if(_0x2300cb['type'])_0x36cdf9[_0x27f8ff(0x1cc)]=_0x2300cb[_0x27f8ff(0x1cc)];if(_0x2300cb['cron'])_0x36cdf9[_0x27f8ff(0x174)]=_0x2300cb[_0x27f8ff(0x174)];if(_0x2300cb[_0x27f8ff(0x17a)])_0x36cdf9['timezone']=_0x2300cb[_0x27f8ff(0x17a)];if(_0x2300cb['delay']!==undefined)_0x36cdf9['delay']=Number(_0x2300cb[_0x27f8ff(0x1a4)]);if(_0x2300cb['priority']!==undefined)_0x36cdf9[_0x27f8ff(0x1e3)]=Number(_0x2300cb['priority']);if(_0x2300cb[_0x27f8ff(0x18d)]!==undefined)_0x36cdf9[_0x27f8ff(0x1b7)]=Number(_0x2300cb['retryLimit']);if(_0x2300cb['engineVersion'])_0x36cdf9[_0x27f8ff(0x1d0)]=_0x2300cb[_0x27f8ff(0x1ee)];if(_0x2300cb['result'])_0x36cdf9[_0x27f8ff(0x1f6)]=_0x2300cb['result'];if(_0x2300cb[_0x27f8ff(0x193)])try{_0x36cdf9[_0x27f8ff(0x17c)]=readFileSync(_0x2300cb[_0x27f8ff(0x193)],'utf-8')[_0x27f8ff(0x1ec)]();}catch(_0x65a920){throw new SDKError(ErrorCode[_0x27f8ff(0x1bc)],_0x27f8ff(0x19b)+_0x2300cb[_0x27f8ff(0x193)],_0x65a920 instanceof Error?_0x65a920:undefined);}if(Object['keys'](_0x36cdf9)[_0x27f8ff(0x18b)]===0x0)throw new SDKError(ErrorCode[_0x27f8ff(0x1bc)],_0x27f8ff(0x181));if(_0x5b7386[_0x27f8ff(0x1c8)]){console['error'](_0x27f8ff(0x1c4)+_0xe423ba);for(const [_0x5da440,_0x9a032c]of Object[_0x27f8ff(0x19f)](_0x36cdf9)){_0x5da440===_0x27f8ff(0x17c)?console[_0x27f8ff(0x190)]('\x20\x20'+_0x5da440+':\x20'+_0x9a032c[_0x27f8ff(0x1ac)](0x0,0x32)+_0x27f8ff(0x1ea)):console[_0x27f8ff(0x190)]('\x20\x20'+_0x5da440+':\x20'+_0x9a032c);}}const _0x364645=await withSpinner(_0x27f8ff(0x1ef),()=>_0x143c6d['schedules']['update'](_0xe423ba,_0x36cdf9),{'verbose':_0x5b7386['verbose']});return console[_0x27f8ff(0x190)]('Schedule\x20updated:\x20'+_0x364645[_0x27f8ff(0x19e)][_0x27f8ff(0x1ad)]),await handleSingleObjectOutput(_0x364645[_0x27f8ff(0x19e)],_0x5b7386),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x448907(0x1e5);['description']=a36_0x448907(0x1d1);[a36_0x448907(0x1d8)](_0x2038e9){const _0x4b7b66=a36_0x448907,_0xfef3a6=_0x2038e9[_0x4b7b66(0x17b)][0x0];if(!_0xfef3a6)return _0x4b7b66(0x191);return undefined;}async['execute'](_0x487edb){const _0x5e98c3=a36_0x448907,{options:_0x1f8403,args:_0x2a6712,tdx:_0x4a0c6c}=_0x487edb,_0x548c7d=_0x2a6712[0x0];if(!_0x1f8403['yes']){const _0xa6375b=await confirm(_0x5e98c3(0x1cb)+_0x548c7d+'\x22?');if(!_0xa6375b)return console[_0x5e98c3(0x190)](_0x5e98c3(0x1b9)),0x0;}const _0x413d47=await withSpinner(_0x5e98c3(0x194),()=>_0x4a0c6c[_0x5e98c3(0x192)][_0x5e98c3(0x1a2)](_0x548c7d),{'verbose':_0x1f8403['verbose']});return console[_0x5e98c3(0x190)](_0x5e98c3(0x187)+_0x413d47[_0x5e98c3(0x19e)][_0x5e98c3(0x1ad)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x1b1);[a36_0x448907(0x1a8)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0xe91074){const _0x298fef=_0xe91074['args'][0x0];if(!_0x298fef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0xd14748){const _0x5eb592=a36_0x448907,{options:_0x18a958,args:_0x4aa750,tdx:_0x249f50}=_0xd14748,_0x36f319=_0x4aa750[0x0],_0xc1b882=_0x18a958,_0x2faeaf=_0xc1b882[_0x5eb592(0x1aa)],_0x19deb7=_0xc1b882[_0x5eb592(0x1fa)]!==undefined?Number(_0xc1b882[_0x5eb592(0x1fa)]):undefined;if(_0x18a958['verbose']){console[_0x5eb592(0x190)](_0x5eb592(0x1cd)+_0x36f319);if(_0x2faeaf)console['error']('\x20\x20Time:\x20'+_0x2faeaf);if(_0x19deb7)console[_0x5eb592(0x190)](_0x5eb592(0x1b3)+_0x19deb7);}const _0x2a8f8c=await withSpinner(_0x5eb592(0x1e8),()=>_0x249f50[_0x5eb592(0x192)][_0x5eb592(0x17e)](_0x36f319,{'time':_0x2faeaf,'num':_0x19deb7}),{'verbose':_0x18a958[_0x5eb592(0x1c8)]}),_0x52f4ee=_0x2a8f8c[_0x5eb592(0x19e)][_0x5eb592(0x185)];console[_0x5eb592(0x190)](_0x5eb592(0x1ed)+_0x52f4ee['length']+'\x20job'+(_0x52f4ee[_0x5eb592(0x18b)]!==0x1?'s':'')+_0x5eb592(0x1dc));for(const _0x499704 of _0x52f4ee){console[_0x5eb592(0x190)](_0x5eb592(0x1e1)+_0x499704['job_id']);}return await handleSDKOutput(_0x52f4ee,_0x18a958),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x448907(0x1ad)]='schedule:history';[a36_0x448907(0x1a8)]=a36_0x448907(0x176);['validate'](_0x469388){const _0x1dda28=a36_0x448907,_0x1b8325=_0x469388[_0x1dda28(0x17b)][0x0];if(!_0x1b8325)return _0x1dda28(0x195);return undefined;}async[a36_0x448907(0x1d4)](_0x341cb1){const _0x53bd81=a36_0x448907,{options:_0x20275a,args:_0x52fbdf,tdx:_0x5cdf32}=_0x341cb1,_0x20366c=_0x52fbdf[0x0],_0x2dbf7a=_0x20275a,_0x585451=_0x2dbf7a[_0x53bd81(0x1e6)]!==undefined?Number(_0x2dbf7a['from']):undefined,_0x2f4064=_0x2dbf7a['to']!==undefined?Number(_0x2dbf7a['to']):undefined,_0x358791=await withSpinner(_0x53bd81(0x18a),()=>_0x5cdf32['schedules'][_0x53bd81(0x1c3)](_0x20366c,{'from':_0x585451,'to':_0x2f4064}),{'verbose':_0x20275a['verbose']}),_0x456b72=_0x358791[_0x53bd81(0x19e)];console[_0x53bd81(0x190)](_0x53bd81(0x1ff)+_0x456b72[_0x53bd81(0x19a)]+_0x53bd81(0x1de)+(_0x456b72[_0x53bd81(0x19a)]!==0x1?'s':'')+'\x20(showing\x20'+_0x456b72['from']+'-'+_0x456b72['to']+')');const _0xca252a=_0x456b72['history'][_0x53bd81(0x1f0)](_0x510416=>({'job_id':_0x510416['job_id'],'type':_0x510416[_0x53bd81(0x1cc)],'status':_0x510416['status'],'scheduled_at':_0x510416[_0x53bd81(0x1a3)],'created_at':_0x510416['created_at'],'start_at':_0x510416[_0x53bd81(0x1c7)],'end_at':_0x510416[_0x53bd81(0x198)]}));return await handleSDKOutput(_0xca252a,_0x20275a),0x0;}}
|
|
1
|
+
const a36_0x4c0eaa=a36_0x394e;(function(_0xe1d235,_0x1d28a5){const _0x520788=a36_0x394e,_0x448afc=_0xe1d235();while(!![]){try{const _0x53f19d=-parseInt(_0x520788(0xf5))/0x1*(-parseInt(_0x520788(0x104))/0x2)+parseInt(_0x520788(0x9d))/0x3+-parseInt(_0x520788(0xfa))/0x4+parseInt(_0x520788(0xe7))/0x5+parseInt(_0x520788(0xa7))/0x6*(parseInt(_0x520788(0xd9))/0x7)+-parseInt(_0x520788(0xf7))/0x8*(parseInt(_0x520788(0xba))/0x9)+parseInt(_0x520788(0xa1))/0xa*(-parseInt(_0x520788(0xd1))/0xb);if(_0x53f19d===_0x1d28a5)break;else _0x448afc['push'](_0x448afc['shift']());}catch(_0x1c76b8){_0x448afc['push'](_0x448afc['shift']());}}}(a36_0x2a0d,0x2e366));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x1afb02 from'chalk';function a36_0x2a0d(){const _0xba9108=['pagination','keys','from','/app/queries/editor?queryId=','retryLimit','\x20\x20Job\x20ID:\x20','engineVersion','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','h\x20ago','join','INVALID_ARGUMENT','result','cron','Query\x20file\x20is\x20empty','cyan','Delete\x20a\x20scheduled\x20query','schedule:run','execute','Show\x20schedule\x20execution\x20history','args','m\x20ago','Failed\x20to\x20read\x20file:\x20','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','lastRun','list','jsonl','num','Found\x20','\x20schedules','repeat','statusIcon','count','validate','Running\x20schedule...','format','\x20job','schedule:delete','443052JkXRyW','name','(unnamed)','substring','7430cTWlpn','start_at','update','schedule:history','data','error','18JdSUqe','Listing\x20scheduled\x20queries...','scheduled_at','Getting\x20schedule\x20history...','status','end_at','d\x20ago','\x20(use\x20--limit\x20to\x20see\x20more)','limit','Schedule\x20created:\x20','ies','file','\x20\x20Database:\x20','delay','\x20\x20Num:\x20','\x20execution','verbose','history','Showing\x20first\x20','18RCYDSz','table','Show\x20schedule\x20details','schedule:update','schedule:show','Schedule\x20updated:\x20','max','show','executing_user_id','Schedule\x20deleted:\x20','in\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Getting\x20schedule\x20details...','description','abs','\x20\x20→\x20','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','database','queryUrl','padEnd','log','\x20\x20Cron:\x20','2981AKXnUF','Searching\x20scheduled\x20queries\x20matching\x20\x22','priority','job_id','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','never','query','Run\x20a\x20scheduled\x20query\x20immediately','166033gtVZCT','green','Create\x20a\x20scheduled\x20query','tsv','json','time_zone','trim','timezone','success','📅\x20','yes','getTime','round','Updating\x20schedule...','1467415zujAAJ','dim','\x22...','...','ended_at','type','user_name','listQueries','schedules','toLocaleDateString','Creating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','last_job','schedule:list','32077IUJTcW','time','55400EANPyP','engine_version','options','687956CEQWTm','Creating\x20schedule:\x20','run','utf-8','delete','nextRun','retry_limit','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','length','4rZnhmG','Running\x20schedule:\x20'];a36_0x2a0d=function(){return _0xba9108;};return a36_0x2a0d();}function formatRelativeTime(_0x122f16){const _0xfd520c=a36_0x394e,_0x200ba0=new Date(_0x122f16),_0x42f2eb=new Date(),_0x5b9304=_0x200ba0[_0xfd520c(0xe4)]()-_0x42f2eb[_0xfd520c(0xe4)](),_0x2dadbe=Math[_0xfd520c(0xc8)](_0x5b9304)/0x3e8,_0x42d76a=_0x5b9304<0x0;if(_0x2dadbe<0x3c)return _0x42d76a?'just\x20now':'soon';else{if(_0x2dadbe<0xe10){const _0x2e2119=Math[_0xfd520c(0xe5)](_0x2dadbe/0x3c);return _0x42d76a?_0x2e2119+_0xfd520c(0x8b):_0xfd520c(0xc4)+_0x2e2119+'m';}else{if(_0x2dadbe<0x15180){const _0x404e2c=Math['round'](_0x2dadbe/0xe10);return _0x42d76a?_0x404e2c+_0xfd520c(0x7f):_0xfd520c(0xc4)+_0x404e2c+'h';}else{if(_0x2dadbe<0x93a80){const _0x5cb020=Math['round'](_0x2dadbe/0x15180);return _0x42d76a?_0x5cb020+_0xfd520c(0xad):_0xfd520c(0xc4)+_0x5cb020+'d';}else return _0x200ba0[_0xfd520c(0xf0)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xf4);[a36_0x4c0eaa(0xc7)]='List\x20scheduled\x20queries';async[a36_0x4c0eaa(0x88)](_0x246772){const _0x57833a=a36_0x4c0eaa,{options:_0x8c59bb,args:_0x4ee55c,tdx:_0x3d7c3a}=_0x246772,_0x10121d=resolveLimit(_0x8c59bb[_0x57833a(0xaf)],DEFAULT_DISPLAY_LIMIT),_0x2f497a=_0x4ee55c[0x0],_0x462812=_0x2f497a?_0x57833a(0xd2)+_0x2f497a+_0x57833a(0xe9):_0x57833a(0xa8),_0x46fb1b=await withSpinner(_0x462812,()=>_0x3d7c3a[_0x57833a(0xef)][_0x57833a(0xee)]({'limit':_0x10121d,'scheduled':!![],'pattern':_0x2f497a}),{'verbose':_0x8c59bb[_0x57833a(0xb7)]}),_0xe2318e=_0x46fb1b[_0x57833a(0xa5)]['queries'],_0x579d42=_0x46fb1b['data'][_0x57833a(0x106)]['has_next_page'],_0xaee835=_0x2f497a?'\x20matching\x20\x22'+_0x2f497a+'\x22':'';_0x579d42?console['error'](_0x57833a(0xb9)+_0xe2318e[_0x57833a(0x103)]+_0x57833a(0x94)+_0xaee835+_0x57833a(0xae)):console['error'](_0x57833a(0x93)+_0xe2318e[_0x57833a(0x103)]+'\x20scheduled\x20quer'+(_0xe2318e['length']!==0x1?_0x57833a(0xb1):'y')+_0xaee835);if(_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdd)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0x91)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xbb)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdc)){const _0x4ccb32=_0xe2318e[_0x57833a(0xca)](_0x3f1989=>({'id':_0x3f1989['id'],'name':_0x3f1989[_0x57833a(0x9e)],'cron':_0x3f1989['cron'],'database':_0x3f1989[_0x57833a(0xcc)]?.[_0x57833a(0x9e)],'type':_0x3f1989[_0x57833a(0xec)],'timezone':_0x3f1989[_0x57833a(0xde)],'user_name':_0x3f1989[_0x57833a(0x8d)]?.[_0x57833a(0x9e)],'updated_at':_0x3f1989['updated_at'],'next_run_at':_0x3f1989['next_run_at'],'last_job_status':_0x3f1989[_0x57833a(0xf3)]?.[_0x57833a(0xab)]}));await handleSDKOutput(_0x4ccb32,_0x8c59bb);}else{if(_0xe2318e['length']===0x0)console[_0x57833a(0xcf)]('No\x20scheduled\x20queries\x20found');else{const _0x210e3b=_0x8c59bb['site'],_0x105823=_0xe2318e[_0x57833a(0xca)](_0x31504b=>{const _0x5dd128=_0x57833a,_0x33f677=_0x31504b[_0x5dd128(0xf3)]?.[_0x5dd128(0xab)]?_0x31504b[_0x5dd128(0xf3)]['status']===_0x5dd128(0xe1)?'✓':'✗':'-',_0x41849d=_0x31504b[_0x5dd128(0xf3)]?.['ended_at']?formatRelativeTime(_0x31504b[_0x5dd128(0xf3)][_0x5dd128(0xeb)]):_0x5dd128(0xd6),_0x27f941=_0x31504b['next_run_at']?formatRelativeTime(_0x31504b['next_run_at']):'-',_0x545ade=_0x31504b[_0x5dd128(0x83)]||'',_0xd3fd58=_0x31504b[_0x5dd128(0x9e)]||_0x5dd128(0x9f),_0x201b9d=getConsoleUrl(_0x210e3b,_0x5dd128(0x109)+_0x31504b['id']);return{'statusIcon':_0x33f677,'lastRun':_0x41849d,'nextRun':_0x27f941,'cron':_0x545ade,'name':_0xd3fd58,'queryUrl':_0x201b9d,'status':_0x31504b['last_job']?.[_0x5dd128(0xab)]};}),_0x43ea53=Math[_0x57833a(0xc0)](..._0x105823['map'](_0x9ed8d6=>_0x9ed8d6[_0x57833a(0x8f)]['length'])),_0x4dbb84=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x46d084=>_0x46d084[_0x57833a(0xff)]['length'])),_0x7704c7=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x5c6e22=>_0x5c6e22[_0x57833a(0x83)]['length'])),_0x8dae04=_0x105823[_0x57833a(0xca)](_0x53eb44=>{const _0x522aec=_0x57833a,_0x48684f=_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xe1)?a36_0x1afb02[_0x522aec(0xda)](_0x53eb44[_0x522aec(0x96)]):_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xa6)?a36_0x1afb02['red'](_0x53eb44[_0x522aec(0x96)]):a36_0x1afb02[_0x522aec(0xe8)](_0x53eb44[_0x522aec(0x96)]),_0x3a2524=_0x53eb44[_0x522aec(0x8f)]['padEnd'](_0x43ea53),_0x3758d3=_0x53eb44['nextRun']['padEnd'](_0x4dbb84),_0x427331=_0x53eb44[_0x522aec(0x83)]?a36_0x1afb02[_0x522aec(0x85)](_0x53eb44[_0x522aec(0x83)][_0x522aec(0xce)](_0x7704c7)):'\x20'[_0x522aec(0x95)](_0x7704c7),_0x5a279d=hyperlink(_0x53eb44[_0x522aec(0x9e)],_0x53eb44[_0x522aec(0xcd)]);return _0x522aec(0xe2)+_0x48684f+'\x20'+_0x3a2524+_0x522aec(0xc9)+_0x3758d3+'\x20\x20'+_0x427331+'\x20\x20'+_0x5a279d;});await writeOutput(_0x8dae04[_0x57833a(0x80)]('\x0a'),_0x8c59bb['output'],_0x57833a(0x90));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x4c0eaa(0xbe);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xbc);[a36_0x4c0eaa(0x98)](_0x4158ef){const _0x336018=a36_0x4c0eaa,_0x6ed448=_0x4158ef['args'][0x0];if(!_0x6ed448)return _0x336018(0x8e);return undefined;}async[a36_0x4c0eaa(0x88)](_0x467b26){const _0x436651=a36_0x4c0eaa,{options:_0xaf7670,args:_0x286432,tdx:_0x4ba0aa}=_0x467b26,_0x211d6d=_0x286432[0x0],_0x3d6eaa=await withSpinner(_0x436651(0xc6),()=>_0x4ba0aa[_0x436651(0xef)][_0x436651(0xc1)](_0x211d6d),{'verbose':_0xaf7670[_0x436651(0xb7)]}),_0x125b53=_0x3d6eaa['data'],_0x192e5d={'name':_0x125b53[_0x436651(0x9e)],'cron':_0x125b53[_0x436651(0x83)],'database':_0x125b53[_0x436651(0xcc)],'type':_0x125b53['type'],'timezone':_0x125b53[_0x436651(0xe0)],'user_name':_0x125b53[_0x436651(0xed)],'created_at':_0x125b53['created_at'],'engine_version':_0x125b53[_0x436651(0xf8)],'executing_user_id':_0x125b53[_0x436651(0xc2)],'query':_0x125b53[_0x436651(0xd7)],'delay':_0x125b53[_0x436651(0xb4)],'priority':_0x125b53[_0x436651(0xd3)],'retry_limit':_0x125b53[_0x436651(0x100)],..._0x125b53[_0x436651(0x82)]&&{'result':_0x125b53['result']}};return await handleSingleObjectOutput(_0x192e5d,_0xaf7670),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]='schedule:create';[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xdb);[a36_0x4c0eaa(0x98)](_0x3eea2c){const _0x58e582=a36_0x4c0eaa,_0x24e1dc=_0x3eea2c[_0x58e582(0x8a)][0x0];if(!_0x24e1dc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x1e10f5=_0x3eea2c[_0x58e582(0xf9)];if(!_0x1e10f5[_0x58e582(0xcc)])return _0x58e582(0xd5);return undefined;}async['execute'](_0x389343){const _0x45d85a=a36_0x4c0eaa,{options:_0x5595c0,args:_0x36a77d,tdx:_0x52c625}=_0x389343,_0x405049=_0x36a77d[0x0],_0x14f0bc=_0x5595c0,_0x55c2ae=_0x14f0bc['database'],_0x4a5037=_0x14f0bc['file'],_0x3496f4=_0x14f0bc[_0x45d85a(0xec)]||'trino';let _0x55cba8;try{_0x55cba8=readFileSync(_0x4a5037,'utf-8')[_0x45d85a(0xdf)]();}catch(_0x4b8308){throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x8c)+_0x4a5037,_0x4b8308 instanceof Error?_0x4b8308:undefined);}if(!_0x55cba8)throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x84));const _0x3cc138={'database':_0x55c2ae,'query':_0x55cba8,'type':_0x3496f4};if(_0x14f0bc[_0x45d85a(0x83)])_0x3cc138['cron']=_0x14f0bc['cron'];if(_0x14f0bc[_0x45d85a(0xe0)])_0x3cc138[_0x45d85a(0xe0)]=_0x14f0bc[_0x45d85a(0xe0)];if(_0x14f0bc[_0x45d85a(0xb4)]!==undefined)_0x3cc138[_0x45d85a(0xb4)]=Number(_0x14f0bc['delay']);if(_0x14f0bc[_0x45d85a(0xd3)]!==undefined)_0x3cc138[_0x45d85a(0xd3)]=Number(_0x14f0bc[_0x45d85a(0xd3)]);if(_0x14f0bc[_0x45d85a(0x10a)]!==undefined)_0x3cc138['retry_limit']=Number(_0x14f0bc[_0x45d85a(0x10a)]);if(_0x14f0bc['engineVersion'])_0x3cc138[_0x45d85a(0xf8)]=_0x14f0bc['engineVersion'];if(_0x14f0bc[_0x45d85a(0x82)])_0x3cc138[_0x45d85a(0x82)]=_0x14f0bc[_0x45d85a(0x82)];if(_0x5595c0['verbose']){console['error'](_0x45d85a(0xfb)+_0x405049),console[_0x45d85a(0xa6)](_0x45d85a(0xb3)+_0x55c2ae),console[_0x45d85a(0xa6)]('\x20\x20Type:\x20'+_0x3496f4);if(_0x3cc138[_0x45d85a(0x83)])console[_0x45d85a(0xa6)](_0x45d85a(0xd0)+_0x3cc138['cron']);if(_0x3cc138['timezone'])console[_0x45d85a(0xa6)](_0x45d85a(0x102)+_0x3cc138['timezone']);}const _0x290bdd=await withSpinner(_0x45d85a(0xf1),()=>_0x52c625[_0x45d85a(0xef)]['create'](_0x405049,_0x3cc138),{'verbose':_0x5595c0[_0x45d85a(0xb7)]});return console['error'](_0x45d85a(0xb0)+_0x290bdd[_0x45d85a(0xa5)][_0x45d85a(0x9e)]),await handleSingleObjectOutput(_0x290bdd[_0x45d85a(0xa5)],_0x5595c0),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xbd);[a36_0x4c0eaa(0xc7)]='Update\x20a\x20scheduled\x20query';[a36_0x4c0eaa(0x98)](_0x2b8478){const _0x592cf2=a36_0x4c0eaa,_0x27cc0a=_0x2b8478[_0x592cf2(0x8a)][0x0];if(!_0x27cc0a)return _0x592cf2(0xf2);return undefined;}async['execute'](_0x33aa93){const _0x35c022=a36_0x4c0eaa,{options:_0x433ad6,args:_0x5bd373,tdx:_0x563b46}=_0x33aa93,_0x5beaa1=_0x5bd373[0x0],_0x5c3a8d=_0x433ad6,_0xe7e5a8={};if(_0x5c3a8d[_0x35c022(0xcc)])_0xe7e5a8[_0x35c022(0xcc)]=_0x5c3a8d[_0x35c022(0xcc)];if(_0x5c3a8d[_0x35c022(0xec)])_0xe7e5a8[_0x35c022(0xec)]=_0x5c3a8d[_0x35c022(0xec)];if(_0x5c3a8d[_0x35c022(0x83)])_0xe7e5a8[_0x35c022(0x83)]=_0x5c3a8d[_0x35c022(0x83)];if(_0x5c3a8d[_0x35c022(0xe0)])_0xe7e5a8[_0x35c022(0xe0)]=_0x5c3a8d['timezone'];if(_0x5c3a8d[_0x35c022(0xb4)]!==undefined)_0xe7e5a8[_0x35c022(0xb4)]=Number(_0x5c3a8d[_0x35c022(0xb4)]);if(_0x5c3a8d[_0x35c022(0xd3)]!==undefined)_0xe7e5a8[_0x35c022(0xd3)]=Number(_0x5c3a8d[_0x35c022(0xd3)]);if(_0x5c3a8d[_0x35c022(0x10a)]!==undefined)_0xe7e5a8[_0x35c022(0x100)]=Number(_0x5c3a8d[_0x35c022(0x10a)]);if(_0x5c3a8d[_0x35c022(0x7d)])_0xe7e5a8[_0x35c022(0xf8)]=_0x5c3a8d[_0x35c022(0x7d)];if(_0x5c3a8d['result'])_0xe7e5a8[_0x35c022(0x82)]=_0x5c3a8d[_0x35c022(0x82)];if(_0x5c3a8d['file'])try{_0xe7e5a8[_0x35c022(0xd7)]=readFileSync(_0x5c3a8d[_0x35c022(0xb2)],_0x35c022(0xfd))[_0x35c022(0xdf)]();}catch(_0x3d3e81){throw new SDKError(ErrorCode[_0x35c022(0x81)],_0x35c022(0x8c)+_0x5c3a8d['file'],_0x3d3e81 instanceof Error?_0x3d3e81:undefined);}if(Object[_0x35c022(0x107)](_0xe7e5a8)['length']===0x0)throw new SDKError(ErrorCode[_0x35c022(0x81)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x433ad6[_0x35c022(0xb7)]){console[_0x35c022(0xa6)](_0x35c022(0x101)+_0x5beaa1);for(const [_0x3b4bbd,_0x1857ef]of Object['entries'](_0xe7e5a8)){_0x3b4bbd===_0x35c022(0xd7)?console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef[_0x35c022(0xa0)](0x0,0x32)+_0x35c022(0xea)):console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef);}}const _0x181990=await withSpinner(_0x35c022(0xe6),()=>_0x563b46[_0x35c022(0xef)][_0x35c022(0xa3)](_0x5beaa1,_0xe7e5a8),{'verbose':_0x433ad6['verbose']});return console['error'](_0x35c022(0xbf)+_0x181990['data'][_0x35c022(0x9e)]),await handleSingleObjectOutput(_0x181990['data'],_0x433ad6),0x0;}}function a36_0x394e(_0x2b96f3,_0x1f9e87){_0x2b96f3=_0x2b96f3-0x7d;const _0x2a0d5f=a36_0x2a0d();let _0x394ebf=_0x2a0d5f[_0x2b96f3];return _0x394ebf;}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x4c0eaa(0x9c);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x86);[a36_0x4c0eaa(0x98)](_0x511b86){const _0x5c021a=a36_0x4c0eaa,_0x10cb31=_0x511b86[_0x5c021a(0x8a)][0x0];if(!_0x10cb31)return _0x5c021a(0xc5);return undefined;}async[a36_0x4c0eaa(0x88)](_0x56878b){const _0x4e87fa=a36_0x4c0eaa,{options:_0x218907,args:_0x42a623,tdx:_0x1dda51}=_0x56878b,_0x22f150=_0x42a623[0x0];if(!_0x218907[_0x4e87fa(0xe3)]){const _0x6b4dcf=await confirm(_0x4e87fa(0x7e)+_0x22f150+'\x22?');if(!_0x6b4dcf)return console[_0x4e87fa(0xa6)]('Cancelled'),0x0;}const _0x4c2af8=await withSpinner('Deleting\x20schedule...',()=>_0x1dda51[_0x4e87fa(0xef)][_0x4e87fa(0xfe)](_0x22f150),{'verbose':_0x218907[_0x4e87fa(0xb7)]});return console[_0x4e87fa(0xa6)](_0x4e87fa(0xc3)+_0x4c2af8['data'][_0x4e87fa(0x9e)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0x87);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xd8);[a36_0x4c0eaa(0x98)](_0x18737c){const _0x1ec081=a36_0x4c0eaa,_0x3dddcd=_0x18737c[_0x1ec081(0x8a)][0x0];if(!_0x3dddcd)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x4fc1a3){const _0x27a8dd=a36_0x4c0eaa,{options:_0x27835f,args:_0x237b60,tdx:_0xb2c5c9}=_0x4fc1a3,_0x26949a=_0x237b60[0x0],_0x428386=_0x27835f,_0x5c68b6=_0x428386[_0x27a8dd(0xf6)],_0x405c3b=_0x428386[_0x27a8dd(0x92)]!==undefined?Number(_0x428386[_0x27a8dd(0x92)]):undefined;if(_0x27835f[_0x27a8dd(0xb7)]){console[_0x27a8dd(0xa6)](_0x27a8dd(0x105)+_0x26949a);if(_0x5c68b6)console[_0x27a8dd(0xa6)]('\x20\x20Time:\x20'+_0x5c68b6);if(_0x405c3b)console[_0x27a8dd(0xa6)](_0x27a8dd(0xb5)+_0x405c3b);}const _0xd45592=await withSpinner(_0x27a8dd(0x99),()=>_0xb2c5c9[_0x27a8dd(0xef)][_0x27a8dd(0xfc)](_0x26949a,{'time':_0x5c68b6,'num':_0x405c3b}),{'verbose':_0x27835f['verbose']}),_0x1456c5=_0xd45592[_0x27a8dd(0xa5)]['jobs'];console[_0x27a8dd(0xa6)]('Schedule\x20run\x20submitted:\x20'+_0x1456c5[_0x27a8dd(0x103)]+_0x27a8dd(0x9b)+(_0x1456c5[_0x27a8dd(0x103)]!==0x1?'s':'')+'\x20created');for(const _0x29ebbd of _0x1456c5){console[_0x27a8dd(0xa6)](_0x27a8dd(0x10b)+_0x29ebbd[_0x27a8dd(0xd4)]);}return await handleSDKOutput(_0x1456c5,_0x27835f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xa4);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x89);[a36_0x4c0eaa(0x98)](_0x261155){const _0x4690b2=a36_0x4c0eaa,_0x39e152=_0x261155[_0x4690b2(0x8a)][0x0];if(!_0x39e152)return _0x4690b2(0xcb);return undefined;}async['execute'](_0x2940ab){const _0x1d6d33=a36_0x4c0eaa,{options:_0x1f0920,args:_0x95d364,tdx:_0x518687}=_0x2940ab,_0x4bede2=_0x95d364[0x0],_0x2350b1=_0x1f0920,_0x390e05=_0x2350b1[_0x1d6d33(0x108)]!==undefined?Number(_0x2350b1[_0x1d6d33(0x108)]):undefined,_0x290c0e=_0x2350b1['to']!==undefined?Number(_0x2350b1['to']):undefined,_0x157586=await withSpinner(_0x1d6d33(0xaa),()=>_0x518687[_0x1d6d33(0xef)][_0x1d6d33(0xb8)](_0x4bede2,{'from':_0x390e05,'to':_0x290c0e}),{'verbose':_0x1f0920[_0x1d6d33(0xb7)]}),_0x9643d1=_0x157586[_0x1d6d33(0xa5)];console['error'](_0x1d6d33(0x93)+_0x9643d1[_0x1d6d33(0x97)]+_0x1d6d33(0xb6)+(_0x9643d1[_0x1d6d33(0x97)]!==0x1?'s':'')+'\x20(showing\x20'+_0x9643d1[_0x1d6d33(0x108)]+'-'+_0x9643d1['to']+')');const _0x46d4dd=_0x9643d1[_0x1d6d33(0xb8)][_0x1d6d33(0xca)](_0x4c0706=>({'job_id':_0x4c0706[_0x1d6d33(0xd4)],'type':_0x4c0706['type'],'status':_0x4c0706['status'],'scheduled_at':_0x4c0706[_0x1d6d33(0xa9)],'created_at':_0x4c0706['created_at'],'start_at':_0x4c0706[_0x1d6d33(0xa2)],'end_at':_0x4c0706[_0x1d6d33(0xac)]}));return await handleSDKOutput(_0x46d4dd,_0x1f0920),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x21b2dc=a37_0x3e70;(function(_0x403a4a,_0x2e1e54){const _0x326db8=a37_0x3e70,_0x210127=_0x403a4a();while(!![]){try{const _0x52f280=-parseInt(_0x326db8(0x18c))/0x1*(-parseInt(_0x326db8(0x1e7))/0x2)+-parseInt(_0x326db8(0x1e2))/0x3+parseInt(_0x326db8(0x174))/0x4+parseInt(_0x326db8(0x184))/0x5+parseInt(_0x326db8(0x199))/0x6+-parseInt(_0x326db8(0x172))/0x7+-parseInt(_0x326db8(0x16a))/0x8*(parseInt(_0x326db8(0x1ce))/0x9);if(_0x52f280===_0x2e1e54)break;else _0x210127['push'](_0x210127['shift']());}catch(_0x19d2b9){_0x210127['push'](_0x210127['shift']());}}}(a37_0x153a,0xc604b));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x5e0d32 from'chalk';async function resolveSegmentTarget(_0x1088fd,_0x12da83,_0x4b68bf){const _0x4aa283=a37_0x3e70;if(isYamlFilePath(_0x1088fd))try{const _0x4c29fd=await resolveYamlFilePath(_0x1088fd);return _0x4b68bf&&(console[_0x4aa283(0x19a)](_0x4aa283(0x1c3)+_0x1088fd),console['error'](_0x4aa283(0x1ea)+_0x4c29fd['parentSegment']),console[_0x4aa283(0x19a)](_0x4aa283(0x15f)+_0x4c29fd['segmentName']),console['error'](_0x4aa283(0x1e6)+(_0x4c29fd[_0x4aa283(0x17d)]||_0x4aa283(0x159))),console[_0x4aa283(0x19a)](_0x4aa283(0x19f)+_0x4c29fd[_0x4aa283(0x188)])),_0x4c29fd[_0x4aa283(0x188)];}catch(_0x173915){throw new SDKError(ErrorCode[_0x4aa283(0x1fb)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x173915['message']);}if(!_0x12da83)throw new SDKError(ErrorCode[_0x4aa283(0x1fb)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x12da83+'/'+_0x1088fd;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1b3);[a37_0x21b2dc(0x185)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x21b2dc(0x176)](_0x230cb0){const _0x2ed816=a37_0x21b2dc,{options:_0x2f319a,args:_0x364e1d,tdx:_0x1a23fb}=_0x230cb0,_0x4b905e=_0x364e1d[0x0],_0x3d8f22=!_0x4b905e&&!!_0x2f319a[_0x2ed816(0x196)],_0x333504=_0x4b905e||_0x2f319a[_0x2ed816(0x196)];if(!_0x333504)return console[_0x2ed816(0x19a)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x2ed816(0x19a)](_0x2ed816(0x161)),console['error'](_0x2ed816(0x17b)),console[_0x2ed816(0x19a)](_0x2ed816(0x1c0)),console[_0x2ed816(0x19a)](_0x2ed816(0x1bb)),console[_0x2ed816(0x19a)](_0x2ed816(0x1e4)),console[_0x2ed816(0x19a)](_0x2ed816(0x1a7)),0x1;try{const _0x15e6fa=_0x2f319a[_0x2ed816(0x200)];let _0x417bc7=_0x333504;!_0x3d8f22&&_0x15e6fa&&!_0x333504[_0x2ed816(0x1b6)]('/')&&(_0x417bc7=_0x15e6fa+'/'+_0x333504,_0x2f319a['verbose']&&console[_0x2ed816(0x19a)](_0x2ed816(0x16b)+_0x417bc7));const _0x1367a2=await withSpinner(_0x2ed816(0x1f0)+_0x417bc7+_0x2ed816(0x1f5),()=>_0x1a23fb[_0x2ed816(0x1ef)][_0x2ed816(0x1eb)](_0x417bc7),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]}),_0x11fdf8=_0x1367a2['data'];_0x2f319a[_0x2ed816(0x1bd)]&&(console[_0x2ed816(0x19a)](_0x2ed816(0x1d0)+_0x11fdf8['type']),console[_0x2ed816(0x19a)](_0x2ed816(0x1b2)+_0x11fdf8['parentId']),_0x11fdf8[_0x2ed816(0x15c)]&&console['error'](_0x2ed816(0x1ed)+_0x11fdf8[_0x2ed816(0x15c)]),_0x11fdf8['segmentId']&&console[_0x2ed816(0x19a)](_0x2ed816(0x1d1)+_0x11fdf8[_0x2ed816(0x183)]));if(_0x11fdf8[_0x2ed816(0x163)]==='parent'){const _0x3306cf=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x1a23fb['segment'][_0x2ed816(0x1ae)](_0x11fdf8[_0x2ed816(0x1ab)]),{'verbose':_0x2f319a['verbose']});await handleSingleObjectOutput(_0x3306cf[_0x2ed816(0x16c)],_0x2f319a);}else{if(_0x11fdf8[_0x2ed816(0x163)]===_0x2ed816(0x1c2)){if(!_0x11fdf8[_0x2ed816(0x15c)])throw new SDKError(ErrorCode[_0x2ed816(0x1ff)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5ac3ab=await withSpinner(_0x2ed816(0x17f),()=>_0x1a23fb[_0x2ed816(0x1ef)][_0x2ed816(0x1a8)](_0x11fdf8[_0x2ed816(0x15c)]),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]});await handleSingleObjectOutput(_0x5ac3ab[_0x2ed816(0x16c)],_0x2f319a);}else{if(_0x11fdf8[_0x2ed816(0x163)]===_0x2ed816(0x1ef)){if(!_0x11fdf8[_0x2ed816(0x183)])throw new SDKError(ErrorCode[_0x2ed816(0x1de)],_0x2ed816(0x1fa));const _0x31d373=await withSpinner(_0x2ed816(0x16f),()=>_0x1a23fb[_0x2ed816(0x1ef)]['getSegment'](_0x11fdf8[_0x2ed816(0x1ab)],_0x11fdf8[_0x2ed816(0x183)]),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]});await handleSingleObjectOutput(_0x31d373['data'],_0x2f319a);}}}return 0x0;}catch(_0x4dde9c){if(_0x4dde9c instanceof SDKError)return console[_0x2ed816(0x19a)](_0x2ed816(0x1e8)+_0x4dde9c[_0x2ed816(0x164)]),_0x4dde9c[_0x2ed816(0x168)]&&console[_0x2ed816(0x19a)](_0x2ed816(0x1ca)+_0x4dde9c[_0x2ed816(0x168)]),0x1;throw _0x4dde9c;}}}function a37_0x3e70(_0x4c4a68,_0x1fca3e){_0x4c4a68=_0x4c4a68-0x159;const _0x153a0c=a37_0x153a();let _0x3e701d=_0x153a0c[_0x4c4a68];return _0x3e701d;}export class SegmentShowCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1db);[a37_0x21b2dc(0x185)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x5b67b5){const _0x4a5763=a37_0x21b2dc,{options:_0xc15026,args:_0x3390ff,tdx:_0x51dfa6}=_0x5b67b5,_0x5d14aa=_0x3390ff[0x0];if(!_0x5d14aa)return console[_0x4a5763(0x19a)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4a5763(0x19a)](_0x4a5763(0x169)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x4a5763(0x19a)]('Examples:'),console[_0x4a5763(0x19a)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x4a5763(0x19a)](_0x4a5763(0x1fd)),0x1;try{const _0x48a993=_0xc15026[_0x4a5763(0x196)],_0x5b9b50=await resolveSegmentTarget(_0x5d14aa,_0x48a993,_0xc15026['verbose']);_0xc15026[_0x4a5763(0x1bd)]&&console[_0x4a5763(0x19a)](_0x4a5763(0x1f7)+_0x5b9b50);const _0x53111f=await withSpinner('Resolving\x20\x27'+_0x5d14aa+'\x27...',()=>_0x51dfa6[_0x4a5763(0x1ef)]['resolvePathToResource'](_0x5b9b50),{'verbose':_0xc15026['verbose']}),_0x382b1c=_0x53111f[_0x4a5763(0x16c)];_0xc15026[_0x4a5763(0x1bd)]&&(console[_0x4a5763(0x19a)](_0x4a5763(0x1d0)+_0x382b1c[_0x4a5763(0x163)]),console['error']('Parent\x20ID:\x20'+_0x382b1c[_0x4a5763(0x1ab)]));if(_0x382b1c['type']===_0x4a5763(0x1c2))return console[_0x4a5763(0x19a)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x4a5763(0x19a)](_0x4a5763(0x1f8)),0x1;if(_0x382b1c[_0x4a5763(0x163)]===_0x4a5763(0x197))return console[_0x4a5763(0x19a)](_0x4a5763(0x171)),console['error'](_0x4a5763(0x189)),0x1;if(!_0x382b1c[_0x4a5763(0x183)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d563a=await withSpinner(_0x4a5763(0x170),()=>_0x51dfa6[_0x4a5763(0x1ef)]['getSegmentSQL'](_0x382b1c[_0x4a5763(0x1ab)],_0x382b1c[_0x4a5763(0x183)]),{'verbose':_0xc15026['verbose']});let _0x4aeb92=_0x4d563a['data'];const _0x3b3661=resolveLimit(_0xc15026[_0x4a5763(0x1d9)],DEFAULT_DISPLAY_LIMIT),_0x154655=/\bLIMIT\s+\d+/i[_0x4a5763(0x1cc)](_0x4aeb92);!_0x154655&&(_0x4aeb92=_0x4aeb92[_0x4a5763(0x19e)]()[_0x4a5763(0x182)](/;+$/,''),_0x4aeb92=_0x4a5763(0x1d4)+_0x4aeb92+_0x4a5763(0x19c)+_0x3b3661);_0xc15026[_0x4a5763(0x1bd)]&&console['error'](_0x4a5763(0x15a)+_0x4aeb92);const _0x129ca5=await withProgressSpinner(_0x4a5763(0x1e3),async _0x20b646=>{const _0x6e2d4e=_0x4a5763,_0x28727f=await _0x51dfa6[_0x6e2d4e(0x1bc)]['execute'](_0x4aeb92,{'catalog':'td','schema':_0x6e2d4e(0x162),'onJobId':_0x6cb1c7=>{const _0x364821=_0x6e2d4e;_0x20b646[_0x364821(0x1fe)](_0x6cb1c7);}});return _0x28727f;},{'verbose':_0xc15026[_0x4a5763(0x1bd)]}),_0x5a8740=_0x129ca5[_0x4a5763(0x16c)],_0x1e67bf=_0x5a8740[_0x4a5763(0x1df)]?_0x4a5763(0x1f2)+_0x5a8740['jobId']+']':'';return console[_0x4a5763(0x19a)](_0x4a5763(0x191)+_0x5a8740[_0x4a5763(0x15b)]['processedRows'][_0x4a5763(0x18f)]()+_0x4a5763(0x1e0)+(_0x4a5763(0x1c1)+formatElapsed(_0x5a8740[_0x4a5763(0x15b)][_0x4a5763(0x201)])+_0x1e67bf)),await handleQueryOutput(_0x5a8740,_0xc15026),0x0;}catch(_0x4b14ab){if(_0x4b14ab instanceof SDKError)return console['error'](_0x4a5763(0x1b0)+_0x4b14ab[_0x4a5763(0x180)]+']'),console[_0x4a5763(0x19a)]('\x0a'+_0x4b14ab[_0x4a5763(0x164)]),0x1;throw _0x4b14ab;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1d2);[a37_0x21b2dc(0x185)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x21b2dc(0x176)](_0x5c0398){const _0x2d5468=a37_0x21b2dc,{options:_0x450b26,args:_0x62f1b2,tdx:_0x204abc}=_0x5c0398;if(_0x62f1b2[_0x2d5468(0x1c9)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x56d8e8=_0x62f1b2[0x0];try{_0x450b26[_0x2d5468(0x1bd)]&&(console[_0x2d5468(0x19a)](_0x2d5468(0x1a2)+_0x450b26[_0x2d5468(0x192)]),console['error'](_0x2d5468(0x19d)+_0x56d8e8));const _0x51551e=await withSpinner(_0x2d5468(0x1aa)+_0x56d8e8+_0x2d5468(0x1f5),()=>_0x204abc[_0x2d5468(0x1ef)][_0x2d5468(0x186)](_0x56d8e8),{'verbose':_0x450b26[_0x2d5468(0x1bd)]}),_0x5b18ad=_0x51551e[_0x2d5468(0x16c)];_0x450b26['verbose']&&console[_0x2d5468(0x19a)](_0x2d5468(0x190)+_0x5b18ad);const _0x5d83ed=await withSpinner(_0x2d5468(0x165)+_0x56d8e8+_0x2d5468(0x1f5),()=>_0x204abc[_0x2d5468(0x1ef)][_0x2d5468(0x1c5)](_0x5b18ad),{'verbose':_0x450b26[_0x2d5468(0x1bd)]}),_0x3e63ab=_0x5d83ed['data'];return console['error'](_0x2d5468(0x16e)+_0x3e63ab[_0x2d5468(0x1c9)]+_0x2d5468(0x1b9)+(_0x3e63ab[_0x2d5468(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x3e63ab,_0x450b26),0x0;}catch(_0x1b49fb){if(_0x1b49fb instanceof SDKError)return console[_0x2d5468(0x19a)](_0x2d5468(0x1e8)+_0x1b49fb[_0x2d5468(0x164)]),_0x1b49fb[_0x2d5468(0x168)]&&console[_0x2d5468(0x19a)]('\x20\x20Cause:\x20'+_0x1b49fb[_0x2d5468(0x168)]),0x1;throw _0x1b49fb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1f9);[a37_0x21b2dc(0x185)]=a37_0x21b2dc(0x193);async[a37_0x21b2dc(0x176)](_0x33f3e1){const _0x2add3e=a37_0x21b2dc,{options:_0x5a13fb,args:_0x257edc,tdx:_0x164438}=_0x33f3e1;if(_0x257edc['length']===0x0)return console[_0x2add3e(0x19a)](_0x2add3e(0x1f4)),console['error'](_0x2add3e(0x1cd)),0x1;try{const {parentId:_0x2657ea,childId:_0x2a21de}=parseSegmentRef(_0x257edc[0x0]);_0x5a13fb[_0x2add3e(0x1bd)]&&(console[_0x2add3e(0x19a)](_0x2add3e(0x1a2)+_0x5a13fb['site']),console[_0x2add3e(0x19a)](_0x2add3e(0x19d)+_0x2657ea),_0x2a21de&&console['error']('Folder\x20name:\x20'+_0x2a21de));if(!_0x2a21de)return console['error'](_0x2add3e(0x1c6)),0x1;const _0x121e6e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2657ea+_0x2add3e(0x1f5),()=>_0x164438[_0x2add3e(0x1ef)][_0x2add3e(0x186)](_0x2657ea),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]}),_0x440811=_0x121e6e['data'];_0x5a13fb['verbose']&&console[_0x2add3e(0x19a)](_0x2add3e(0x190)+_0x440811);const _0x163984=await withSpinner(_0x2add3e(0x179)+_0x2a21de+_0x2add3e(0x1f5),()=>_0x164438['segment'][_0x2add3e(0x1a1)](_0x440811,_0x2a21de),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]}),_0x5195f8=_0x163984[_0x2add3e(0x16c)];_0x5a13fb[_0x2add3e(0x1bd)]&&console[_0x2add3e(0x19a)]('Resolved\x20folder\x20ID:\x20'+_0x5195f8);const _0x5caae9=await withSpinner(_0x2add3e(0x1d7)+_0x2a21de+_0x2add3e(0x1f5),()=>_0x164438[_0x2add3e(0x1ef)]['getFolder'](_0x5195f8),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]});return await handleSDKOutput([_0x5caae9[_0x2add3e(0x16c)]],_0x5a13fb),0x0;}catch(_0x1533f6){if(_0x1533f6 instanceof SDKError)return console[_0x2add3e(0x19a)](_0x2add3e(0x1e8)+_0x1533f6[_0x2add3e(0x164)]),_0x1533f6[_0x2add3e(0x168)]&&console[_0x2add3e(0x19a)](_0x2add3e(0x1ca)+_0x1533f6[_0x2add3e(0x168)]),0x1;throw _0x1533f6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x21b2dc(0x187);['description']=a37_0x21b2dc(0x1ba);async[a37_0x21b2dc(0x176)](_0x3eb250){const _0x3cfe40=a37_0x21b2dc,{options:_0x50af30,args:_0x53eb6d}=_0x3eb250,_0x530cf6=_0x50af30,_0x2f7cec=_0x530cf6['path'],_0x23917b=_0x53eb6d[0x0];if(!_0x23917b&&!_0x2f7cec)return console[_0x3cfe40(0x19a)](a37_0x5e0d32[_0x3cfe40(0x1a5)](_0x3cfe40(0x1da))),console[_0x3cfe40(0x19a)](_0x3cfe40(0x181)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x167)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x3cfe40(0x19a)](_0x3cfe40(0x17b)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x15d)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x17e)),0x1;if(_0x23917b&&_0x2f7cec)return console[_0x3cfe40(0x19a)](a37_0x5e0d32['red'](_0x3cfe40(0x160))),0x1;try{let _0x2f4ac2;if(_0x2f7cec)_0x2f4ac2=await this[_0x3cfe40(0x1fc)](_0x2f7cec,_0x3eb250);else{if(isYamlFilePath(_0x23917b))return console[_0x3cfe40(0x19a)](a37_0x5e0d32[_0x3cfe40(0x1a5)](_0x3cfe40(0x1f6))),console['error'](_0x3cfe40(0x177)+_0x23917b),0x1;else _0x2f4ac2=await this[_0x3cfe40(0x1a3)](_0x23917b,_0x3eb250);}return _0x50af30[_0x3cfe40(0x1af)]===_0x3cfe40(0x1cf)||_0x50af30[_0x3cfe40(0x1af)]==='jsonl'?await handleSDKOutput([{'sql':_0x2f4ac2}],_0x50af30):console[_0x3cfe40(0x18a)](_0x2f4ac2),0x0;}catch(_0x1661a3){if(_0x1661a3 instanceof SDKError)return console['error'](_0x3cfe40(0x1e8)+_0x1661a3[_0x3cfe40(0x164)]),_0x1661a3['cause']&&console[_0x3cfe40(0x19a)]('\x20\x20Cause:\x20'+_0x1661a3[_0x3cfe40(0x168)]),0x1;throw _0x1661a3;}}async[a37_0x21b2dc(0x1fc)](_0x48ffe1,_0x827fbe){const _0x12af37=a37_0x21b2dc,{options:_0x170931,tdx:_0x52be96}=_0x827fbe;let _0x172091;try{_0x172091=await resolveYamlFilePath(_0x48ffe1);}catch(_0x5cedd3){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x12af37(0x18d)+_0x5cedd3[_0x12af37(0x164)]);}_0x170931[_0x12af37(0x1bd)]&&console[_0x12af37(0x19a)](_0x12af37(0x1cb)+_0x172091['parentSegment']+'/'+_0x172091[_0x12af37(0x1a6)]);const _0x5e70a2=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x52be96[_0x12af37(0x1ef)][_0x12af37(0x1ad)](_0x172091['content'],_0x172091[_0x12af37(0x196)],_0x172091[_0x12af37(0x1a6)]),{'verbose':_0x170931[_0x12af37(0x1bd)]});return _0x5e70a2[_0x12af37(0x16c)];}async['getSQLFromServerSegment'](_0x2a4c51,_0x56a2b9){const _0x424212=a37_0x21b2dc,{options:_0x1e48b3,tdx:_0xd3371b}=_0x56a2b9,_0x5f84a=_0x1e48b3['parentSegment'],_0x45d5cd=await resolveSegmentTarget(_0x2a4c51,_0x5f84a,_0x1e48b3[_0x424212(0x1bd)]);_0x1e48b3['verbose']&&console['error'](_0x424212(0x1f7)+_0x45d5cd);const _0x45447c=await withSpinner(_0x424212(0x16d)+_0x2a4c51+_0x424212(0x1f5),()=>_0xd3371b[_0x424212(0x1ef)][_0x424212(0x1eb)](_0x45d5cd),{'verbose':_0x1e48b3[_0x424212(0x1bd)]}),_0x525067=_0x45447c[_0x424212(0x16c)];_0x1e48b3[_0x424212(0x1bd)]&&(console[_0x424212(0x19a)](_0x424212(0x1d0)+_0x525067['type']),console[_0x424212(0x19a)](_0x424212(0x1b2)+_0x525067['parentId']));if(_0x525067[_0x424212(0x163)]===_0x424212(0x1c2))throw new SDKError(ErrorCode[_0x424212(0x1fb)],_0x424212(0x1c7));if(_0x525067[_0x424212(0x163)]===_0x424212(0x197))throw new SDKError(ErrorCode[_0x424212(0x1fb)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x525067['segmentId'])throw new SDKError(ErrorCode[_0x424212(0x1de)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x39f246=await withSpinner(_0x424212(0x170),()=>_0xd3371b[_0x424212(0x1ef)][_0x424212(0x1a4)](_0x525067[_0x424212(0x1ab)],_0x525067['segmentId']),{'verbose':_0x1e48b3[_0x424212(0x1bd)]});return _0x39f246['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x195);['description']=a37_0x21b2dc(0x1d6);async[a37_0x21b2dc(0x176)](_0x4ede91){const _0x348bf8=a37_0x21b2dc,{options:_0x52562a,args:_0x3db5c3,tdx:_0x45cf4e}=_0x4ede91,_0x155d5f=_0x52562a;if(_0x3db5c3[_0x348bf8(0x1c9)]<0x2)return console[_0x348bf8(0x19a)](_0x348bf8(0x17a)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x179fff=_0x3db5c3[0x0],_0xdec9b=_0x3db5c3[0x1];_0x155d5f[_0x348bf8(0x1bd)]&&(console['error'](_0x348bf8(0x1a2)+_0x155d5f['site']),console['error'](_0x348bf8(0x19b)+_0x179fff),console[_0x348bf8(0x19a)](_0x348bf8(0x175)+_0xdec9b));let _0x288a86;if(_0x155d5f['parentFolder']){const _0x30650a=_0x155d5f[_0x348bf8(0x1a0)],_0x20fb4f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x179fff+_0x348bf8(0x1f5),()=>_0x45cf4e['segment']['resolveParentId'](_0x179fff),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]}),_0xb3383=_0x20fb4f[_0x348bf8(0x16c)],_0x172d8a=await withSpinner(_0x348bf8(0x1a9)+_0x30650a+_0x348bf8(0x1f5),()=>_0x45cf4e[_0x348bf8(0x1ef)]['resolveFolderId'](_0xb3383,_0x30650a),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]});_0x288a86=_0x172d8a[_0x348bf8(0x16c)],_0x155d5f[_0x348bf8(0x1bd)]&&console[_0x348bf8(0x19a)](_0x348bf8(0x1dd)+_0x288a86);}const _0x2a77a0={'name':_0xdec9b,'description':_0x155d5f[_0x348bf8(0x185)],'parentFolderId':_0x288a86},_0x208748=await withSpinner(_0x348bf8(0x15e)+_0xdec9b+_0x348bf8(0x1f5),()=>_0x45cf4e[_0x348bf8(0x1ef)]['createFolder'](_0x179fff,_0x2a77a0),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]}),_0x5828ea=_0x208748[_0x348bf8(0x16c)];return console[_0x348bf8(0x19a)]('✔\x20Created\x20folder\x20\x27'+_0x5828ea[_0x348bf8(0x173)]+_0x348bf8(0x1e9)+_0x5828ea['id']),await handleSDKOutput([_0x5828ea],_0x155d5f),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1f1);[a37_0x21b2dc(0x185)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x143f77){const _0x1a1f22=a37_0x21b2dc,{options:_0xaa8aa5,args:_0xd757b3,tdx:_0x1801a5}=_0x143f77,_0x22757a=_0xd757b3[0x0];if(!_0x22757a)return console[_0x1a1f22(0x19a)](_0x1a1f22(0x17c)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ee)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1dc)),console['error'](_0x1a1f22(0x194)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1b8)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x17b)),console[_0x1a1f22(0x19a)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1bf)),console['error'](_0x1a1f22(0x18b)),console[_0x1a1f22(0x19a)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2509e2=_0xaa8aa5[_0x1a1f22(0x196)],_0x1dda1f=await resolveSegmentTarget(_0x22757a,_0x2509e2,_0xaa8aa5[_0x1a1f22(0x1bd)]);_0xaa8aa5[_0x1a1f22(0x1bd)]&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1f7)+_0x1dda1f);const _0x15c031=await withSpinner(_0x1a1f22(0x16d)+_0x22757a+_0x1a1f22(0x1f5),()=>_0x1801a5['segment'][_0x1a1f22(0x1eb)](_0x1dda1f),{'verbose':_0xaa8aa5[_0x1a1f22(0x1bd)]}),_0x2ecb9e=_0x15c031[_0x1a1f22(0x16c)];_0xaa8aa5[_0x1a1f22(0x1bd)]&&(console['error']('Resolved\x20type:\x20'+_0x2ecb9e[_0x1a1f22(0x163)]),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1b2)+_0x2ecb9e['parentId']),_0x2ecb9e['folderId']&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ed)+_0x2ecb9e[_0x1a1f22(0x15c)]),_0x2ecb9e[_0x1a1f22(0x183)]&&console[_0x1a1f22(0x19a)]('Segment\x20ID:\x20'+_0x2ecb9e[_0x1a1f22(0x183)]));if(_0xaa8aa5[_0x1a1f22(0x1b7)]){if(_0x2ecb9e[_0x1a1f22(0x163)]==='folder')return console['error'](_0x1a1f22(0x1c4)),0x1;if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x197))return console[_0x1a1f22(0x19a)](_0x1a1f22(0x1f3)),console['error'](_0x1a1f22(0x1d5)),0x1;if(!_0x2ecb9e['segmentId'])throw new SDKError(ErrorCode[_0x1a1f22(0x1de)],_0x1a1f22(0x1fa));const _0x5ecc7c=getConsoleNextUrl(_0xaa8aa5[_0x1a1f22(0x192)],_0x1a1f22(0x1ac)+_0x2ecb9e[_0x1a1f22(0x1ab)]+_0x1a1f22(0x1d3)+_0x2ecb9e[_0x1a1f22(0x183)]);return console[_0x1a1f22(0x19a)](a37_0x5e0d32['green']('✔')+_0x1a1f22(0x18e)+a37_0x5e0d32['cyan'](_0x5ecc7c)),openBrowser(_0x5ecc7c),0x0;}if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x1c2)){if(!_0x2ecb9e[_0x1a1f22(0x15c)])throw new SDKError(ErrorCode[_0x1a1f22(0x1ff)],_0x1a1f22(0x1d8));const _0xa0dac2=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1801a5['segment'][_0x1a1f22(0x1a8)](_0x2ecb9e[_0x1a1f22(0x15c)]),{'verbose':_0xaa8aa5['verbose']});await handleSingleObjectOutput(_0xa0dac2[_0x1a1f22(0x16c)],_0xaa8aa5);}else{if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x1ef)){if(!_0x2ecb9e[_0x1a1f22(0x183)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1a1f22(0x1fa));const _0x407ef5=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1801a5[_0x1a1f22(0x1ef)][_0x1a1f22(0x1b1)](_0x2ecb9e[_0x1a1f22(0x1ab)],_0x2ecb9e['segmentId']),{'verbose':_0xaa8aa5[_0x1a1f22(0x1bd)]}),_0x451630=getConsoleNextUrl(_0xaa8aa5[_0x1a1f22(0x192)],_0x1a1f22(0x1ac)+_0x2ecb9e[_0x1a1f22(0x1ab)]+'/e/'+_0x2ecb9e[_0x1a1f22(0x183)]),_0x2098bb=_0x407ef5[_0x1a1f22(0x16c)];_0x2098bb[_0x1a1f22(0x178)]=_0x451630,await handleSingleObjectOutput(_0x2098bb,_0xaa8aa5);}else return console[_0x1a1f22(0x19a)](_0x1a1f22(0x198)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x166)),0x1;}return 0x0;}catch(_0xf2cb20){if(_0xf2cb20 instanceof SDKError)return console['error']('Error:\x20'+_0xf2cb20[_0x1a1f22(0x164)]),_0xf2cb20['cause']&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ca)+_0xf2cb20['cause']),0x1;throw _0xf2cb20;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1be);['description']=a37_0x21b2dc(0x1ec);async[a37_0x21b2dc(0x176)](_0x1f773e){const _0x589686=a37_0x21b2dc,{options:_0x138f9f,args:_0x4af93d,tdx:_0x2ff124}=_0x1f773e,_0x582488=_0x4af93d[0x0];if(!_0x582488)return console['error'](_0x589686(0x1b4)),console[_0x589686(0x19a)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x589686(0x1e1)),console['error']('Examples:'),console[_0x589686(0x19a)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x589686(0x19a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5d7aa8=_0x138f9f['parentSegment'],_0x57507a=await resolveSegmentTarget(_0x582488,_0x5d7aa8,_0x138f9f[_0x589686(0x1bd)]);_0x138f9f['verbose']&&console['error'](_0x589686(0x1f7)+_0x57507a);const _0x5b59b0=await withSpinner(_0x589686(0x16d)+_0x582488+'\x27...',()=>_0x2ff124[_0x589686(0x1ef)][_0x589686(0x1eb)](_0x57507a),{'verbose':_0x138f9f[_0x589686(0x1bd)]}),_0x4c2230=_0x5b59b0['data'];_0x138f9f[_0x589686(0x1bd)]&&(console[_0x589686(0x19a)](_0x589686(0x1d0)+_0x4c2230['type']),console[_0x589686(0x19a)]('Parent\x20ID:\x20'+_0x4c2230[_0x589686(0x1ab)]));if(_0x4c2230['type']===_0x589686(0x1c2))return console['error'](_0x589686(0x1c8)),console[_0x589686(0x19a)](_0x589686(0x1b5)),0x1;if(_0x4c2230[_0x589686(0x163)]===_0x589686(0x197))return console[_0x589686(0x19a)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x589686(0x19a)](_0x589686(0x1e5)),0x1;if(!_0x4c2230[_0x589686(0x183)])throw new SDKError(ErrorCode[_0x589686(0x1de)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a8015=await withSpinner(_0x589686(0x170),()=>_0x2ff124[_0x589686(0x1ef)]['getSegmentSQL'](_0x4c2230['parentId'],_0x4c2230['segmentId']),{'verbose':_0x138f9f['verbose']}),_0x53e96b=_0x1a8015[_0x589686(0x16c)],_0x39bfe5=await executeSchemaQuery(_0x53e96b,_0x2ff124,_0x138f9f);return await handleQueryOutput(_0x39bfe5,_0x138f9f),0x0;}catch(_0x1a0c70){if(_0x1a0c70 instanceof SDKError)return console[_0x589686(0x19a)](_0x589686(0x1e8)+_0x1a0c70[_0x589686(0x164)]),_0x1a0c70['cause']&&console[_0x589686(0x19a)](_0x589686(0x1ca)+_0x1a0c70[_0x589686(0x168)]),0x1;throw _0x1a0c70;}}}function a37_0x153a(){const _0x214fe9=['/e/','SELECT\x20*\x20FROM\x20(\x0a','Use:\x20tdx\x20ps\x20view\x20-w','Create\x20segment\x20folder\x20for\x20organization','Fetching\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','limit','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segment:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20parent\x20folder\x20ID:\x20','SEGMENT_NOT_FOUND','jobId','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','2180757aSCbQP','Executing\x20segment\x20query...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Use:\x20tdx\x20ps\x20desc','\x20\x20Folder\x20path:\x20','12968NKdCTa','Error:\x20','\x27\x20with\x20ID:\x20','\x20\x20Parent\x20segment:\x20','resolvePathToResource','Show\x20child\x20segment\x20schema\x20(column\x20types)','Folder\x20ID:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment','Resolving\x20path\x20\x27','segment:view','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20reference\x20is\x20required','\x27...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Target\x20path:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment:folder:show','Segment\x20ID\x20missing\x20from\x20resolved\x20path','INVALID_ARGUMENT','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','setJobId','SEGMENT_FOLDER_NOT_FOUND','segmentPath','elapsedTimeMillis','(root)','SQL\x20query:\x0a','stats','folderId','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Creating\x20folder\x20\x27','\x20\x20Segment\x20name:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20segment\x20describe\x20<path>','information_schema','type','message','Listing\x20folders\x20for\x20parent\x20\x27','Use:\x20tdx\x20ps\x20view','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','cause','Usage:\x20tdx\x20sg\x20show\x20<name>','8lVjQXj','Resolved\x20relative\x20path\x20to:\x20','data','Resolving\x20\x27','✔\x20Found\x20','Fetching\x20segment\x20details...','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','4058488wiZCpv','name','3507504Okzams','Folder\x20name:\x20','execute','\x20\x20tdx\x20sg\x20sql\x20--path\x20','url','Resolving\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Examples:','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','folderPath','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','code','Usage:','replace','segmentId','4508755nTGBKu','description','resolveParentId','segment:sql','fullPath','Use:\x20tdx\x20ps\x20show','log','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','226sdvSqF','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20Opening\x20','toLocaleString','Resolved\x20parent\x20ID:\x20','✔\x20Query\x20completed:\x20Processed\x20','site','Show\x20segment\x20folder\x20details','Options:','segment:folder:create','parentSegment','parent','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','8339868vPJIyv','error','Parent\x20segment:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20name:\x20','trim','\x20\x20Full\x20path:\x20','parentFolder','resolveFolderId','Site:\x20','getSQLFromServerSegment','getSegmentSQL','red','segmentName','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','getFolder','Resolving\x20parent\x20folder\x20\x27','Resolving\x20parent\x20segment\x20\x27','parentId','/app/ps/','getSegmentSQLFromYaml','getParent','format','✖\x20Query\x20failed\x20[','getSegment','Parent\x20ID:\x20','segment:describe','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','includes','web','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20folder','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','query','verbose','segment:desc','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','in\x20','folder','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','listFolders','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','length','\x20\x20Cause:\x20','Resolved:\x20','test','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','22645827tCqNMY','json','Resolved\x20type:\x20','Segment\x20ID:\x20','segment:folder:list'];a37_0x153a=function(){return _0x214fe9;};return a37_0x153a();}
|
|
1
|
+
const a37_0x1b5047=a37_0x5184;(function(_0x1a75d2,_0x56f07d){const _0x59af54=a37_0x5184,_0x25859f=_0x1a75d2();while(!![]){try{const _0x413a7c=-parseInt(_0x59af54(0x1d1))/0x1+-parseInt(_0x59af54(0x1d3))/0x2*(-parseInt(_0x59af54(0x1f7))/0x3)+-parseInt(_0x59af54(0x1d9))/0x4+-parseInt(_0x59af54(0x1cb))/0x5+-parseInt(_0x59af54(0x207))/0x6*(-parseInt(_0x59af54(0x17f))/0x7)+parseInt(_0x59af54(0x1d2))/0x8+parseInt(_0x59af54(0x17d))/0x9*(parseInt(_0x59af54(0x16e))/0xa);if(_0x413a7c===_0x56f07d)break;else _0x25859f['push'](_0x25859f['shift']());}catch(_0x524e77){_0x25859f['push'](_0x25859f['shift']());}}}(a37_0x4dab,0x8dd25));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x4dab(){const _0x5a93f2=['resolveParentId','Resolved\x20parent\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','getSegmentSQLFromYaml','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x27...','verbose','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20path\x20\x27','test','SEGMENT_NOT_FOUND','Resolved\x20YAML\x20file:\x20','Site:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parentSegment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20folder\x20\x27','/app/ps/','segment:sql','processedRows','SEGMENT_FOLDER_NOT_FOUND','trim','Resolving\x20folder\x20\x27','cyan','\x20[Job\x20ID:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','5082685gJbpHV','Resolving\x20parent\x20folder\x20\x27','/e/','description','Fetching\x20SQL\x20from\x20rule...','segment:show','88375pnlFFG','3433568GFrjAE','534278JLrsJY','segmentName','message','Parent\x20name:\x20','Resolving\x20\x27','query','3925024yQxMdC','resolveFolderId','segmentId','parentId','getSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','type','(root)','fullPath','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','red','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','limit','format','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','error','name','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20','segmentPath','Resolved\x20type:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20segment:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','6wHEUuD','Creating\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','✖\x20Query\x20failed\x20[','information_schema','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20ID:\x20','\x20\x20Folder\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Usage:\x20tdx\x20sg\x20show\x20<name>','elapsedTimeMillis','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:desc','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','execute','Segment\x20ID:\x20','12uCDEVx','toLocaleString','INVALID_ARGUMENT','getFolder','segment:folder:list','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','Use:\x20tdx\x20ps\x20show','web','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x27\x20with\x20ID:\x20','Target\x20path:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Folder\x20ID:\x20','resolvePathToResource','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','90zbOUht','Resolved\x20folder\x20ID:\x20','folderId','Get\x20SQL\x20query\x20for\x20child\x20segment','Fetching\x20folder\x20details...','data','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment','Fetching\x20SQL\x20for\x20segment...','segment:folder:show','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Folder\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','1147437EWqSii','✔\x20Found\x20','1946553hZeZnz','jsonl','✔\x20Query\x20completed:\x20Processed\x20','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Resolved\x20relative\x20path\x20to:\x20','Examples:','cause','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolved:\x20','parent','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','jobId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20desc','\x20\x20Cause:\x20','folder','setJobId','path','createFolder','\x20\x20Segment\x20name:\x20','code','includes','getSegmentSQL','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20Full\x20path:\x20','url','\x20folder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Executing\x20segment\x20query...','getSQLFromYamlFile','segment:folder:create','segment:describe','stats','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','listFolders','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Show\x20segment\x20or\x20folder\x20details','parentFolder','length','Options:','site','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','log'];a37_0x4dab=function(){return _0x5a93f2;};return a37_0x4dab();}import a37_0x16ec09 from'chalk';async function resolveSegmentTarget(_0x1e2953,_0x2d3ba5,_0x549d61){const _0x596ea9=a37_0x5184;if(isYamlFilePath(_0x1e2953))try{const _0x95790=await resolveYamlFilePath(_0x1e2953);return _0x549d61&&(console[_0x596ea9(0x1ed)](_0x596ea9(0x1bb)+_0x1e2953),console[_0x596ea9(0x1ed)](_0x596ea9(0x1b2)+_0x95790[_0x596ea9(0x1be)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x195)+_0x95790[_0x596ea9(0x1d4)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x1fe)+(_0x95790['folderPath']||_0x596ea9(0x1e0))),console[_0x596ea9(0x1ed)](_0x596ea9(0x19a)+_0x95790['fullPath'])),_0x95790[_0x596ea9(0x1e1)];}catch(_0x3b89c1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x596ea9(0x1ef)+_0x3b89c1['message']);}if(!_0x2d3ba5)throw new SDKError(ErrorCode[_0x596ea9(0x209)],_0x596ea9(0x1bf));return _0x2d3ba5+'/'+_0x1e2953;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a1);['description']=a37_0x1b5047(0x1a6);async['execute'](_0xce5bad){const _0x518585=a37_0x1b5047,{options:_0x31b95e,args:_0x5d4665,tdx:_0x767d6a}=_0xce5bad,_0x180106=_0x5d4665[0x0],_0x58d3fc=!_0x180106&&!!_0x31b95e[_0x518585(0x1be)],_0x4746b9=_0x180106||_0x31b95e[_0x518585(0x1be)];if(!_0x4746b9)return console[_0x518585(0x1ed)](_0x518585(0x16b)),console[_0x518585(0x1ed)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x518585(0x1ed)]('Examples:'),console[_0x518585(0x1ed)](_0x518585(0x17c)),console[_0x518585(0x1ed)](_0x518585(0x1e4)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x518585(0x1ed)](_0x518585(0x1e2)),0x1;try{const _0x556ff4=_0x31b95e[_0x518585(0x1f1)];let _0x4fb2ea=_0x4746b9;!_0x58d3fc&&_0x556ff4&&!_0x4746b9[_0x518585(0x197)]('/')&&(_0x4fb2ea=_0x556ff4+'/'+_0x4746b9,_0x31b95e[_0x518585(0x1b6)]&&console[_0x518585(0x1ed)](_0x518585(0x185)+_0x4fb2ea));const _0x3048b2=await withSpinner(_0x518585(0x1b8)+_0x4fb2ea+_0x518585(0x1b5),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x16a)](_0x4fb2ea),{'verbose':_0x31b95e[_0x518585(0x1b6)]}),_0xdb0917=_0x3048b2[_0x518585(0x173)];_0x31b95e[_0x518585(0x1b6)]&&(console[_0x518585(0x1ed)](_0x518585(0x1f2)+_0xdb0917['type']),console[_0x518585(0x1ed)](_0x518585(0x1fd)+_0xdb0917[_0x518585(0x1dc)]),_0xdb0917[_0x518585(0x170)]&&console['error'](_0x518585(0x169)+_0xdb0917[_0x518585(0x170)]),_0xdb0917[_0x518585(0x1db)]&&console[_0x518585(0x1ed)](_0x518585(0x206)+_0xdb0917['segmentId']));if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x18a)){const _0x542af6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x767d6a[_0x518585(0x175)]['getParent'](_0xdb0917[_0x518585(0x1dc)]),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x542af6[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x191)){if(!_0xdb0917[_0x518585(0x170)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x518585(0x178));const _0x2725e4=await withSpinner('Fetching\x20folder\x20details...',()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x20a)](_0xdb0917['folderId']),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x2725e4[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x175)){if(!_0xdb0917[_0x518585(0x1db)])throw new SDKError(ErrorCode[_0x518585(0x1ba)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xb9c1c0=await withSpinner(_0x518585(0x16d),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x1dd)](_0xdb0917[_0x518585(0x1dc)],_0xdb0917[_0x518585(0x1db)]),{'verbose':_0x31b95e[_0x518585(0x1b6)]});await handleSingleObjectOutput(_0xb9c1c0[_0x518585(0x173)],_0x31b95e);}}}return 0x0;}catch(_0x5d4ac6){if(_0x5d4ac6 instanceof SDKError)return console[_0x518585(0x1ed)](_0x518585(0x1f0)+_0x5d4ac6['message']),_0x5d4ac6[_0x518585(0x187)]&&console['error'](_0x518585(0x190)+_0x5d4ac6[_0x518585(0x187)]),0x1;throw _0x5d4ac6;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x1d0);[a37_0x1b5047(0x1ce)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1b5047(0x205)](_0x508a07){const _0x35aea8=a37_0x1b5047,{options:_0x886faf,args:_0x2a75ff,tdx:_0x54e25c}=_0x508a07,_0x4a639f=_0x2a75ff[0x0];if(!_0x4a639f)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x35aea8(0x200)),console[_0x35aea8(0x1ed)](_0x35aea8(0x1c0)),console[_0x35aea8(0x1ed)](_0x35aea8(0x186)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x35aea8(0x1ec)),0x1;try{const _0x5b1448=_0x886faf[_0x35aea8(0x1be)],_0x688a9=await resolveSegmentTarget(_0x4a639f,_0x5b1448,_0x886faf[_0x35aea8(0x1b6)]);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)](_0x35aea8(0x167)+_0x688a9);const _0x22ee28=await withSpinner('Resolving\x20\x27'+_0x4a639f+'\x27...',()=>_0x54e25c[_0x35aea8(0x175)]['resolvePathToResource'](_0x688a9),{'verbose':_0x886faf[_0x35aea8(0x1b6)]}),_0x372087=_0x22ee28[_0x35aea8(0x173)];_0x886faf[_0x35aea8(0x1b6)]&&(console[_0x35aea8(0x1ed)](_0x35aea8(0x1f2)+_0x372087[_0x35aea8(0x1df)]),console[_0x35aea8(0x1ed)](_0x35aea8(0x1fd)+_0x372087[_0x35aea8(0x1dc)]));if(_0x372087['type']===_0x35aea8(0x191))return console[_0x35aea8(0x1ed)](_0x35aea8(0x1ab)),console[_0x35aea8(0x1ed)](_0x35aea8(0x199)),0x1;if(_0x372087['type']===_0x35aea8(0x18a))return console[_0x35aea8(0x1ed)](_0x35aea8(0x18e)),console[_0x35aea8(0x1ed)](_0x35aea8(0x162)),0x1;if(!_0x372087[_0x35aea8(0x1db)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x35aea8(0x1f3));const _0x3c3e34=await withSpinner(_0x35aea8(0x176),()=>_0x54e25c['segment'][_0x35aea8(0x198)](_0x372087[_0x35aea8(0x1dc)],_0x372087[_0x35aea8(0x1db)]),{'verbose':_0x886faf[_0x35aea8(0x1b6)]});let _0x313d13=_0x3c3e34[_0x35aea8(0x173)];const _0x14c9a7=resolveLimit(_0x886faf[_0x35aea8(0x1e9)],DEFAULT_DISPLAY_LIMIT),_0x4f7453=/\bLIMIT\s+\d+/i[_0x35aea8(0x1b9)](_0x313d13);!_0x4f7453&&(_0x313d13=_0x313d13[_0x35aea8(0x1c6)]()['replace'](/;+$/,''),_0x313d13=_0x35aea8(0x182)+_0x313d13+_0x35aea8(0x188)+_0x14c9a7);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)]('SQL\x20query:\x0a'+_0x313d13);const _0xf9e07a=await withProgressSpinner(_0x35aea8(0x19e),async _0x2f68b3=>{const _0x20fd21=_0x35aea8,_0x671226=await _0x54e25c[_0x20fd21(0x1d8)][_0x20fd21(0x205)](_0x313d13,{'catalog':'td','schema':_0x20fd21(0x1fb),'onJobId':_0x2d3df4=>{const _0xddc2d7=_0x20fd21;_0x2f68b3[_0xddc2d7(0x192)](_0x2d3df4);}});return _0x671226;},{'verbose':_0x886faf['verbose']}),_0x1562fa=_0xf9e07a['data'],_0x45dd0b=_0x1562fa['jobId']?_0x35aea8(0x1c9)+_0x1562fa[_0x35aea8(0x18d)]+']':'';return console['error'](_0x35aea8(0x181)+_0x1562fa[_0x35aea8(0x1a2)][_0x35aea8(0x1c4)][_0x35aea8(0x208)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x1562fa['stats'][_0x35aea8(0x201)])+_0x45dd0b)),await handleQueryOutput(_0x1562fa,_0x886faf),0x0;}catch(_0x3782c0){if(_0x3782c0 instanceof SDKError)return console[_0x35aea8(0x1ed)](_0x35aea8(0x1fa)+_0x3782c0[_0x35aea8(0x196)]+']'),console['error']('\x0a'+_0x3782c0['message']),0x1;throw _0x3782c0;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x20b);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1fc);async[a37_0x1b5047(0x205)](_0x8dc2d3){const _0x3fe86f=a37_0x1b5047,{options:_0x1d0134,args:_0x334f63,tdx:_0x281f27}=_0x8dc2d3;if(_0x334f63[_0x3fe86f(0x1a8)]===0x0)return console['error'](_0x3fe86f(0x1e7)),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f9)),0x1;const _0x1b8052=_0x334f63[0x0];try{_0x1d0134[_0x3fe86f(0x1b6)]&&(console['error'](_0x3fe86f(0x1bc)+_0x1d0134[_0x3fe86f(0x1aa)]),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1d6)+_0x1b8052));const _0x4be698=await withSpinner(_0x3fe86f(0x161)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1ad)](_0x1b8052),{'verbose':_0x1d0134['verbose']}),_0x493597=_0x4be698[_0x3fe86f(0x173)];_0x1d0134[_0x3fe86f(0x1b6)]&&console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1ae)+_0x493597);const _0x2c709e=await withSpinner(_0x3fe86f(0x1ff)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1a4)](_0x493597),{'verbose':_0x1d0134['verbose']}),_0x199586=_0x2c709e[_0x3fe86f(0x173)];return console['error'](_0x3fe86f(0x17e)+_0x199586['length']+_0x3fe86f(0x19c)+(_0x199586[_0x3fe86f(0x1a8)]!==0x1?'s':'')),await handleSDKOutput(_0x199586,_0x1d0134),0x0;}catch(_0x206b35){if(_0x206b35 instanceof SDKError)return console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f0)+_0x206b35[_0x3fe86f(0x1d5)]),_0x206b35[_0x3fe86f(0x187)]&&console['error'](_0x3fe86f(0x190)+_0x206b35['cause']),0x1;throw _0x206b35;}}}function a37_0x5184(_0x2d643b,_0x95fa64){_0x2d643b=_0x2d643b-0x160;const _0x4dabfb=a37_0x4dab();let _0x518424=_0x4dabfb[_0x2d643b];return _0x518424;}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x177);[a37_0x1b5047(0x1ce)]='Show\x20segment\x20folder\x20details';async[a37_0x1b5047(0x205)](_0x1b098d){const _0x1b7be0=a37_0x1b5047,{options:_0x25d8cf,args:_0x582e76,tdx:_0x15556e}=_0x1b098d;if(_0x582e76[_0x1b7be0(0x1a8)]===0x0)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e6)),console[_0x1b7be0(0x1ed)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x58c91d,childId:_0x3fef5d}=parseSegmentRef(_0x582e76[0x0]);_0x25d8cf[_0x1b7be0(0x1b6)]&&(console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1bc)+_0x25d8cf['site']),console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1d6)+_0x58c91d),_0x3fef5d&&console['error'](_0x1b7be0(0x17b)+_0x3fef5d));if(!_0x3fef5d)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e8)),0x1;const _0x237545=await withSpinner(_0x1b7be0(0x161)+_0x58c91d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)][_0x1b7be0(0x1ad)](_0x58c91d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x3ae7b0=_0x237545[_0x1b7be0(0x173)];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1ae)+_0x3ae7b0);const _0x434de5=await withSpinner(_0x1b7be0(0x1c7)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['resolveFolderId'](_0x3ae7b0,_0x3fef5d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x46c0e4=_0x434de5['data'];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x16f)+_0x46c0e4);const _0x225f97=await withSpinner(_0x1b7be0(0x1c1)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['getFolder'](_0x46c0e4),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]});return await handleSDKOutput([_0x225f97[_0x1b7be0(0x173)]],_0x25d8cf),0x0;}catch(_0x5007bd){if(_0x5007bd instanceof SDKError)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1f0)+_0x5007bd[_0x1b7be0(0x1d5)]),_0x5007bd[_0x1b7be0(0x187)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x190)+_0x5007bd['cause']),0x1;throw _0x5007bd;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1c3);['description']=a37_0x1b5047(0x171);async[a37_0x1b5047(0x205)](_0x885402){const _0x35b3b9=a37_0x1b5047,{options:_0xc86802,args:_0x48af8c}=_0x885402,_0x6c062e=_0xc86802,_0x4a4972=_0x6c062e[_0x35b3b9(0x193)],_0x58e1dd=_0x48af8c[0x0];if(!_0x58e1dd&&!_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x19d))),console[_0x35b3b9(0x1ed)]('Usage:'),console['error'](_0x35b3b9(0x1a5)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1a3)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x186)),console['error'](_0x35b3b9(0x1b3)),console[_0x35b3b9(0x1ed)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x58e1dd&&_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x165))),0x1;try{let _0x515b13;if(_0x4a4972)_0x515b13=await this['getSQLFromYamlFile'](_0x4a4972,_0x885402);else{if(isYamlFilePath(_0x58e1dd))return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x1bd))),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1af)+_0x58e1dd),0x1;else _0x515b13=await this['getSQLFromServerSegment'](_0x58e1dd,_0x885402);}return _0xc86802['format']==='json'||_0xc86802[_0x35b3b9(0x1ea)]===_0x35b3b9(0x180)?await handleSDKOutput([{'sql':_0x515b13}],_0xc86802):console[_0x35b3b9(0x1ac)](_0x515b13),0x0;}catch(_0x2890ab){if(_0x2890ab instanceof SDKError)return console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1f0)+_0x2890ab[_0x35b3b9(0x1d5)]),_0x2890ab[_0x35b3b9(0x187)]&&console['error'](_0x35b3b9(0x190)+_0x2890ab[_0x35b3b9(0x187)]),0x1;throw _0x2890ab;}}async[a37_0x1b5047(0x19f)](_0x415032,_0x115058){const _0x54ce95=a37_0x1b5047,{options:_0x5e12e7,tdx:_0x3a22e0}=_0x115058;let _0xd37ca1;try{_0xd37ca1=await resolveYamlFilePath(_0x415032);}catch(_0x418e18){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x418e18[_0x54ce95(0x1d5)]);}_0x5e12e7[_0x54ce95(0x1b6)]&&console[_0x54ce95(0x1ed)](_0x54ce95(0x189)+_0xd37ca1[_0x54ce95(0x1be)]+'/'+_0xd37ca1[_0x54ce95(0x1d4)]);const _0x525054=await withSpinner(_0x54ce95(0x1cf),()=>_0x3a22e0[_0x54ce95(0x175)][_0x54ce95(0x1b0)](_0xd37ca1['content'],_0xd37ca1[_0x54ce95(0x1be)],_0xd37ca1[_0x54ce95(0x1d4)]),{'verbose':_0x5e12e7[_0x54ce95(0x1b6)]});return _0x525054[_0x54ce95(0x173)];}async['getSQLFromServerSegment'](_0x245d5f,_0x14e201){const _0x5bc2f0=a37_0x1b5047,{options:_0x2e3188,tdx:_0x514dc0}=_0x14e201,_0x1bc52d=_0x2e3188[_0x5bc2f0(0x1be)],_0x3a71c2=await resolveSegmentTarget(_0x245d5f,_0x1bc52d,_0x2e3188[_0x5bc2f0(0x1b6)]);_0x2e3188['verbose']&&console[_0x5bc2f0(0x1ed)](_0x5bc2f0(0x167)+_0x3a71c2);const _0x22cfa8=await withSpinner(_0x5bc2f0(0x1d7)+_0x245d5f+_0x5bc2f0(0x1b5),()=>_0x514dc0['segment']['resolvePathToResource'](_0x3a71c2),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]}),_0x5114d2=_0x22cfa8[_0x5bc2f0(0x173)];_0x2e3188[_0x5bc2f0(0x1b6)]&&(console['error']('Resolved\x20type:\x20'+_0x5114d2[_0x5bc2f0(0x1df)]),console[_0x5bc2f0(0x1ed)]('Parent\x20ID:\x20'+_0x5114d2[_0x5bc2f0(0x1dc)]));if(_0x5114d2['type']===_0x5bc2f0(0x191))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5bc2f0(0x1b7));if(_0x5114d2[_0x5bc2f0(0x1df)]===_0x5bc2f0(0x18a))throw new SDKError(ErrorCode[_0x5bc2f0(0x209)],_0x5bc2f0(0x204));if(!_0x5114d2['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5bc2f0(0x1f3));const _0x2afe99=await withSpinner(_0x5bc2f0(0x176),()=>_0x514dc0[_0x5bc2f0(0x175)][_0x5bc2f0(0x198)](_0x5114d2[_0x5bc2f0(0x1dc)],_0x5114d2['segmentId']),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]});return _0x2afe99[_0x5bc2f0(0x173)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a0);[a37_0x1b5047(0x1ce)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x1b5047(0x205)](_0x240da2){const _0x563507=a37_0x1b5047,{options:_0x377a88,args:_0x46d2b7,tdx:_0x35cea2}=_0x240da2,_0x1f8da0=_0x377a88;if(_0x46d2b7[_0x563507(0x1a8)]<0x2)return console[_0x563507(0x1ed)](_0x563507(0x17a)),console['error'](_0x563507(0x1b1)),0x1;const _0x3c7c48=_0x46d2b7[0x0],_0x2b891b=_0x46d2b7[0x1];_0x1f8da0[_0x563507(0x1b6)]&&(console['error']('Site:\x20'+_0x1f8da0[_0x563507(0x1aa)]),console['error'](_0x563507(0x1f4)+_0x3c7c48),console[_0x563507(0x1ed)](_0x563507(0x17b)+_0x2b891b));let _0x182e5a;if(_0x1f8da0[_0x563507(0x1a7)]){const _0x4b99cc=_0x1f8da0[_0x563507(0x1a7)],_0x5902d7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3c7c48+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1ad)](_0x3c7c48),{'verbose':_0x1f8da0['verbose']}),_0x310bc2=_0x5902d7['data'],_0x453ec2=await withSpinner(_0x563507(0x1cc)+_0x4b99cc+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1da)](_0x310bc2,_0x4b99cc),{'verbose':_0x1f8da0[_0x563507(0x1b6)]});_0x182e5a=_0x453ec2[_0x563507(0x173)],_0x1f8da0[_0x563507(0x1b6)]&&console[_0x563507(0x1ed)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x182e5a);}const _0x2e2d87={'name':_0x2b891b,'description':_0x1f8da0[_0x563507(0x1ce)],'parentFolderId':_0x182e5a},_0x49edd2=await withSpinner(_0x563507(0x1f8)+_0x2b891b+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x194)](_0x3c7c48,_0x2e2d87),{'verbose':_0x1f8da0['verbose']}),_0x68f04e=_0x49edd2[_0x563507(0x173)];return console[_0x563507(0x1ed)]('✔\x20Created\x20folder\x20\x27'+_0x68f04e[_0x563507(0x1ee)]+_0x563507(0x166)+_0x68f04e['id']),await handleSDKOutput([_0x68f04e],_0x1f8da0),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]='segment:view';[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1f5);async[a37_0x1b5047(0x205)](_0x520850){const _0x7cdf3f=a37_0x1b5047,{options:_0x663d48,args:_0x4e431,tdx:_0xbeac4f}=_0x520850,_0x1b0a12=_0x4e431[0x0];if(!_0x1b0a12)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x202)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x174)),console[_0x7cdf3f(0x1ed)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x7cdf3f(0x1a9)),console[_0x7cdf3f(0x1ed)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x7cdf3f(0x186)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1de)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x18c)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x16c)),0x1;try{const _0xd544a8=_0x663d48['parentSegment'],_0x2c5646=await resolveSegmentTarget(_0x1b0a12,_0xd544a8,_0x663d48[_0x7cdf3f(0x1b6)]);_0x663d48[_0x7cdf3f(0x1b6)]&&console['error'](_0x7cdf3f(0x167)+_0x2c5646);const _0x207ff0=await withSpinner(_0x7cdf3f(0x1d7)+_0x1b0a12+_0x7cdf3f(0x1b5),()=>_0xbeac4f['segment'][_0x7cdf3f(0x16a)](_0x2c5646),{'verbose':_0x663d48['verbose']}),_0x9af4e7=_0x207ff0[_0x7cdf3f(0x173)];_0x663d48['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x9af4e7[_0x7cdf3f(0x1df)]),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1fd)+_0x9af4e7['parentId']),_0x9af4e7['folderId']&&console[_0x7cdf3f(0x1ed)]('Folder\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x170)]),_0x9af4e7[_0x7cdf3f(0x1db)]&&console[_0x7cdf3f(0x1ed)]('Segment\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x1db)]));if(_0x663d48[_0x7cdf3f(0x163)]){if(_0x9af4e7['type']===_0x7cdf3f(0x191))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1b4)),0x1;if(_0x9af4e7['type']===_0x7cdf3f(0x18a))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x168)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x164)),0x1;if(!_0x9af4e7[_0x7cdf3f(0x1db)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x4323b9=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+_0x7cdf3f(0x1cd)+_0x9af4e7[_0x7cdf3f(0x1db)]);return console['error'](a37_0x16ec09['green']('✔')+_0x7cdf3f(0x184)+a37_0x16ec09[_0x7cdf3f(0x1c8)](_0x4323b9)),openBrowser(_0x4323b9),0x0;}if(_0x9af4e7[_0x7cdf3f(0x1df)]==='folder'){if(!_0x9af4e7[_0x7cdf3f(0x170)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1c5)],_0x7cdf3f(0x178));const _0x575898=await withSpinner(_0x7cdf3f(0x172),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x20a)](_0x9af4e7[_0x7cdf3f(0x170)]),{'verbose':_0x663d48[_0x7cdf3f(0x1b6)]});await handleSingleObjectOutput(_0x575898[_0x7cdf3f(0x173)],_0x663d48);}else{if(_0x9af4e7['type']===_0x7cdf3f(0x175)){if(!_0x9af4e7['segmentId'])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x57cc5f=await withSpinner(_0x7cdf3f(0x16d),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x1dd)](_0x9af4e7[_0x7cdf3f(0x1dc)],_0x9af4e7[_0x7cdf3f(0x1db)]),{'verbose':_0x663d48['verbose']}),_0x566672=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+'/e/'+_0x9af4e7[_0x7cdf3f(0x1db)]),_0xf1197a=_0x57cc5f[_0x7cdf3f(0x173)];_0xf1197a[_0x7cdf3f(0x19b)]=_0x566672,await handleSingleObjectOutput(_0xf1197a,_0x663d48);}else return console['error'](_0x7cdf3f(0x179)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1e3)),0x1;}return 0x0;}catch(_0xc5542e){if(_0xc5542e instanceof SDKError)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1f0)+_0xc5542e[_0x7cdf3f(0x1d5)]),_0xc5542e['cause']&&console[_0x7cdf3f(0x1ed)]('\x20\x20Cause:\x20'+_0xc5542e['cause']),0x1;throw _0xc5542e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x203);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1eb);async[a37_0x1b5047(0x205)](_0x546eb2){const _0x4cf6f0=a37_0x1b5047,{options:_0x9c4ed2,args:_0x4264d1,tdx:_0x5e0fec}=_0x546eb2,_0x246475=_0x4264d1[0x0];if(!_0x246475)return console[_0x4cf6f0(0x1ed)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4cf6f0(0x1ed)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f6)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x186)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18b)),console[_0x4cf6f0(0x1ed)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3c2c84=_0x9c4ed2[_0x4cf6f0(0x1be)],_0x11ef49=await resolveSegmentTarget(_0x246475,_0x3c2c84,_0x9c4ed2[_0x4cf6f0(0x1b6)]);_0x9c4ed2['verbose']&&console['error'](_0x4cf6f0(0x167)+_0x11ef49);const _0x2c671d=await withSpinner(_0x4cf6f0(0x1d7)+_0x246475+'\x27...',()=>_0x5e0fec[_0x4cf6f0(0x175)][_0x4cf6f0(0x16a)](_0x11ef49),{'verbose':_0x9c4ed2[_0x4cf6f0(0x1b6)]}),_0x393ce5=_0x2c671d[_0x4cf6f0(0x173)];_0x9c4ed2['verbose']&&(console['error'](_0x4cf6f0(0x1f2)+_0x393ce5[_0x4cf6f0(0x1df)]),console['error']('Parent\x20ID:\x20'+_0x393ce5['parentId']));if(_0x393ce5['type']==='folder')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x160)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1ca)),0x1;if(_0x393ce5[_0x4cf6f0(0x1df)]==='parent')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x183)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18f)),0x1;if(!_0x393ce5['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4cf6f0(0x1f3));const _0x2fb47a=await withSpinner(_0x4cf6f0(0x176),()=>_0x5e0fec[_0x4cf6f0(0x175)]['getSegmentSQL'](_0x393ce5[_0x4cf6f0(0x1dc)],_0x393ce5[_0x4cf6f0(0x1db)]),{'verbose':_0x9c4ed2['verbose']}),_0x2097dd=_0x2fb47a[_0x4cf6f0(0x173)],_0x5e1093=await executeSchemaQuery(_0x2097dd,_0x5e0fec,_0x9c4ed2);return await handleQueryOutput(_0x5e1093,_0x9c4ed2),0x0;}catch(_0x32c5ee){if(_0x32c5ee instanceof SDKError)return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f0)+_0x32c5ee[_0x4cf6f0(0x1d5)]),_0x32c5ee[_0x4cf6f0(0x187)]&&console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x190)+_0x32c5ee['cause']),0x1;throw _0x32c5ee;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x1260f2=a38_0x5e15;(function(_0x4c10f5,_0x4a5895){const _0x442132=a38_0x5e15,_0xb6b530=_0x4c10f5();while(!![]){try{const _0x42fbe5=parseInt(_0x442132(0x16c))/0x1+parseInt(_0x442132(0x15a))/0x2+parseInt(_0x442132(0x177))/0x3+-parseInt(_0x442132(0x181))/0x4+parseInt(_0x442132(0x174))/0x5+parseInt(_0x442132(0x166))/0x6*(parseInt(_0x442132(0x180))/0x7)+parseInt(_0x442132(0x16a))/0x8*(-parseInt(_0x442132(0x182))/0x9);if(_0x42fbe5===_0x4a5895)break;else _0xb6b530['push'](_0xb6b530['shift']());}catch(_0x3d02b3){_0xb6b530['push'](_0xb6b530['shift']());}}}(a38_0x4627,0xd6348));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x5e15(_0x196d1b,_0x50753f){_0x196d1b=_0x196d1b-0x150;const _0x462753=a38_0x4627();let _0x5e154=_0x462753[_0x196d1b];return _0x5e154;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x3d33dc from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x1260f2(0x159);[a38_0x1260f2(0x168)]=a38_0x1260f2(0x17b);async[a38_0x1260f2(0x16b)](_0x4561e8){const _0x446d8a=a38_0x1260f2;console[_0x446d8a(0x151)](a38_0x3d33dc[_0x446d8a(0x155)](_0x446d8a(0x150))),console[_0x446d8a(0x151)](a38_0x3d33dc['yellow'](_0x446d8a(0x164)));const {options:_0x263033,args:_0x262546,tdx:_0x2303c5}=_0x4561e8,_0x1275cb=_0x263033;if(_0x262546['length']===0x0)return console[_0x446d8a(0x151)](_0x446d8a(0x16e)),console[_0x446d8a(0x151)](_0x446d8a(0x156)),console['error'](_0x446d8a(0x184)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x446d8a(0x151)](_0x446d8a(0x183)),console['error'](_0x446d8a(0x162)),0x1;const _0xa9a1db=_0x262546[0x0],_0x5e7d5c=_0x263033[_0x446d8a(0x17c)];let _0x5e6f28=_0xa9a1db;_0x5e7d5c&&!_0xa9a1db[_0x446d8a(0x152)]('/')&&(_0x5e6f28=_0x5e7d5c+'/'+_0xa9a1db,_0x1275cb['verbose']&&console[_0x446d8a(0x151)](_0x446d8a(0x171)+_0x5e6f28));const _0x12add6=parsePath(_0x5e6f28);if(_0x12add6[_0x446d8a(0x153)][_0x446d8a(0x178)]<0x2)return console[_0x446d8a(0x151)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error'](_0x446d8a(0x173)),0x1;const _0x149daa=_0x12add6[_0x446d8a(0x153)][0x0],_0x1942fd=getBaseName(_0x5e6f28),_0x3a9eae=getParentPath(_0x5e6f28);_0x1275cb[_0x446d8a(0x176)]&&(console[_0x446d8a(0x151)]('Site:\x20'+_0x1275cb[_0x446d8a(0x17a)]),console[_0x446d8a(0x151)](_0x446d8a(0x170)+_0x5e6f28),console[_0x446d8a(0x151)](_0x446d8a(0x158)+_0x149daa),console[_0x446d8a(0x151)](_0x446d8a(0x179)+_0x1942fd),console[_0x446d8a(0x151)](_0x446d8a(0x160)+_0x3a9eae));const _0x491ed5=await withSpinner(_0x446d8a(0x165)+_0x149daa+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)][_0x446d8a(0x16d)](_0x149daa),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0x2a863d=_0x491ed5['data'];let _0x41bf2f;if(_0x12add6[_0x446d8a(0x153)]['length']>0x2){const _0x3ede04=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x3a9eae+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)]['resolvePathToResource'](_0x3a9eae),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0xc612d=_0x3ede04['data'];if(_0xc612d['type']!==_0x446d8a(0x161)&&_0xc612d['type']!==_0x446d8a(0x172))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x41bf2f=_0xc612d[_0x446d8a(0x163)];}else{if(_0x1275cb[_0x446d8a(0x161)]){const _0x516614=await withSpinner(_0x446d8a(0x157)+_0x1275cb[_0x446d8a(0x161)]+_0x446d8a(0x17d),()=>_0x2303c5['segment'][_0x446d8a(0x17f)](_0x2a863d,_0x1275cb[_0x446d8a(0x161)]),{'verbose':_0x1275cb[_0x446d8a(0x176)]});_0x41bf2f=_0x516614[_0x446d8a(0x15d)];}}_0x1275cb[_0x446d8a(0x176)]&&_0x41bf2f&&console[_0x446d8a(0x151)](_0x446d8a(0x16f)+_0x41bf2f);const _0x2c900b=await loadJSONFromOptions(_0x1275cb[_0x446d8a(0x15f)],_0x1275cb[_0x446d8a(0x15c)]),_0x4dacc3={'name':_0x1942fd,'description':_0x1275cb[_0x446d8a(0x168)],'rule':_0x2c900b,'kind':_0x1275cb[_0x446d8a(0x17e)]!==undefined?parseInt(_0x1275cb[_0x446d8a(0x17e)],0xa):undefined,'isVisible':_0x1275cb['invisible']?![]:undefined,'segmentFolderId':_0x41bf2f,'countPopulation':_0x1275cb['noCountPopulation']?![]:undefined},_0x249e6b=await withSpinner('Creating\x20segment\x20\x27'+_0x1942fd+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)][_0x446d8a(0x15b)](_0x2a863d,_0x4dacc3),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0x247eb2=_0x249e6b[_0x446d8a(0x15d)];return console['error'](_0x446d8a(0x175)+_0x247eb2[_0x446d8a(0x15e)]+_0x446d8a(0x154)+_0x247eb2['id']),_0x5e6f28!==_0xa9a1db&&console[_0x446d8a(0x151)](_0x446d8a(0x167)+_0x5e6f28),await handleSDKOutput([_0x247eb2],_0x1275cb),0x0;}}function a38_0x4627(){const _0x2117f0=['Segment\x20name:\x20','site','Create\x20child\x20segment\x20with\x20filtering\x20rules','segmentPath','\x27...','kind','resolveFolderId','3451623EXfKIY','6125552THvqbl','15129LHEhbn','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Examples:','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','error','includes','segments','\x27\x20with\x20ID:\x20','yellow','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20\x27','Parent:\x20','segment:create','3445010NIYOeL','createSegment','ruleFile','data','name','rule','Parent\x20path:\x20','folder','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folderId','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20parent\x20segment\x20\x27','6SDyHnU','\x20\x20\x20Path:\x20','description','segment','16928foRhiu','execute','973399kyKZDd','resolveParentId','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','parent','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','6613990pCIfXI','✔\x20Created\x20segment\x20\x27','verbose','4361931WGAIRg','length'];a38_0x4627=function(){return _0x2117f0;};return a38_0x4627();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a39_0x5454(_0x22a6c6,_0x55d739){_0x22a6c6=_0x22a6c6-0x122;const _0x411dcc=a39_0x411d();let _0x545414=_0x411dcc[_0x22a6c6];return _0x545414;}const a39_0x5c75d2=a39_0x5454;(function(_0x30bb6b,_0xe3ba82){const _0x10b6c1=a39_0x5454,_0x2c3373=_0x30bb6b();while(!![]){try{const _0x11fd5d=parseInt(_0x10b6c1(0x130))/0x1*(-parseInt(_0x10b6c1(0x128))/0x2)+parseInt(_0x10b6c1(0x136))/0x3*(parseInt(_0x10b6c1(0x124))/0x4)+-parseInt(_0x10b6c1(0x12c))/0x5+-parseInt(_0x10b6c1(0x133))/0x6+parseInt(_0x10b6c1(0x127))/0x7+parseInt(_0x10b6c1(0x122))/0x8+parseInt(_0x10b6c1(0x132))/0x9;if(_0x11fd5d===_0xe3ba82)break;else _0x2c3373['push'](_0x2c3373['shift']());}catch(_0x3f6273){_0x2c3373['push'](_0x2c3373['shift']());}}}(a39_0x411d,0x9069c));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';function a39_0x411d(){const _0x196bc1=['name','listFields','6229352TubleE','Error:\x20Parent\x20segment\x20name\x20is\x20required','4OcTZFQ','List\x20available\x20fields\x20for\x20segmentation','parentSegment','6662215haKcFx','393652Ergseb','\x20field','Site:\x20','error','3877470gPYxFW','\x27...','jsonl','site','1DVhTLJ','verbose','6576786yQpqzM','6560820VGzKLV','segment','data','588414Fcysex','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','description','length'];a39_0x411d=function(){return _0x196bc1;};return a39_0x411d();}export class SegmentFieldsCommand extends BaseCommand{[a39_0x5c75d2(0x13b)]='segment:fields';[a39_0x5c75d2(0x139)]=a39_0x5c75d2(0x125);async['execute'](_0x1ae150){const _0x4f5e27=a39_0x5c75d2,{options:_0x2d0fb7,args:_0x2879b4,tdx:_0x318af8}=_0x1ae150,_0x311443=_0x2879b4[0x0]||_0x2d0fb7[_0x4f5e27(0x126)];if(!_0x311443)return console['error'](_0x4f5e27(0x123)),console['error'](_0x4f5e27(0x138)),console['error'](_0x4f5e27(0x137)),0x1;_0x2d0fb7[_0x4f5e27(0x131)]&&(console[_0x4f5e27(0x12b)](_0x4f5e27(0x12a)+_0x2d0fb7[_0x4f5e27(0x12f)]),console[_0x4f5e27(0x12b)]('Parent\x20segment:\x20'+_0x311443));const _0x4ffc5a=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x311443+_0x4f5e27(0x12d),()=>_0x318af8[_0x4f5e27(0x134)][_0x4f5e27(0x13c)](_0x311443),{'verbose':_0x2d0fb7[_0x4f5e27(0x131)]}),_0x4aff69=_0x4ffc5a[_0x4f5e27(0x135)];console[_0x4f5e27(0x12b)]('✔\x20Found\x20'+_0x4aff69['length']+_0x4f5e27(0x129)+(_0x4aff69[_0x4f5e27(0x13a)]!==0x1?'s':''));if(_0x2d0fb7['json']||_0x2d0fb7[_0x4f5e27(0x12e)])return await handleSDKOutput(_0x4aff69,_0x2d0fb7),0x0;return displayFieldsHumanReadable(_0x4aff69,_0x311443),0x0;}}
|