@treasuredata/tdx 0.19.1 → 0.19.2
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/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-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/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-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/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/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/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-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/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/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-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.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-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-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/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.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/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/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/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/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/port.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 a21_0x29e2f9=a21_0x2c95;function a21_0x2c95(_0x5c9d3c,_0x312366){_0x5c9d3c=_0x5c9d3c-0x197;const _0x1a0286=a21_0x1a02();let _0x2c95bb=_0x1a0286[_0x5c9d3c];return _0x2c95bb;}function a21_0x1a02(){const _0x108265=['llm:proxy','close','\x20\x20Agents:','1269532uMZsZM','429027GSwCaH','init','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','green','\x20\x20}','SIGTERM','\x0aTesting\x20with\x20Agent\x20SDK:','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','cyan','llmProject','yellow','getOrCreateDefaultProject','llm','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','logger','dim','28609vdzlCu','3295580nocnXN','find','\x20\x20{','\x20\x20\x20\x20}','execute','Starting\x20proxy\x20server...','bold','Server\x20Configuration:','342lYfoJM','\x20is\x20unavailable,\x20using\x20port\x20','465143fBgBNa','white','name','NOT_FOUND','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','site','SIGINT','\x20\x20Project:','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','Port\x20','16RpAbGW','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x0aClaude\x20Code\x20Configuration:','\x20\x20Address:','9705978oPfJOB','server','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','5116640Ocbhtw','Project\x20\x27','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','Resolving\x20project...','attributes','description','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','logLevel','\x20\x20Site:','stop','log'];a21_0x1a02=function(){return _0x108265;};return a21_0x1a02();}(function(_0x26bc9d,_0xedeedc){const _0xd40da6=a21_0x2c95,_0x27e57a=_0x26bc9d();while(!![]){try{const _0x31ca76=parseInt(_0xd40da6(0x19b))/0x1+-parseInt(_0xd40da6(0x1ba))/0x2+-parseInt(_0xd40da6(0x1bb))/0x3*(-parseInt(_0xd40da6(0x1a5))/0x4)+-parseInt(_0xd40da6(0x1cd))/0x5+-parseInt(_0xd40da6(0x199))/0x6*(-parseInt(_0xd40da6(0x1cc))/0x7)+-parseInt(_0xd40da6(0x1ac))/0x8+parseInt(_0xd40da6(0x1a9))/0x9;if(_0x31ca76===_0xedeedc)break;else _0x27e57a['push'](_0x27e57a['shift']());}catch(_0x50df8a){_0x27e57a['push'](_0x27e57a['shift']());}}}(a21_0x1a02,0x6558e));import a21_0x4ee90e from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x12e77e,_0x2e4b41){const _0xcf2daf=a21_0x2c95,{tdx:_0x333914,options:_0x47c41f}=_0x12e77e,_0x464dd2=_0x2e4b41||_0x47c41f[_0xcf2daf(0x1c5)];if(_0x464dd2){const _0x26cda4=await _0x333914[_0xcf2daf(0x1c8)]['projects'](),_0x20b097=_0x26cda4[_0xcf2daf(0x1ce)](_0xc4f80=>_0xc4f80[_0xcf2daf(0x1b0)][_0xcf2daf(0x19d)]===_0x464dd2);if(!_0x20b097)throw new SDKError(ErrorCode[_0xcf2daf(0x19e)],_0xcf2daf(0x1ad)+_0x464dd2+'\x27\x20not\x20found',undefined,{'helpText':_0xcf2daf(0x1bd)});return _0x20b097['id'];}const _0x41bdf2=await _0x333914[_0xcf2daf(0x1c8)][_0xcf2daf(0x1c7)]();return _0x41bdf2['id'];}export class LLMProxyCommand extends BaseCommand{[a21_0x29e2f9(0x19d)]=a21_0x29e2f9(0x1b7);[a21_0x29e2f9(0x1b1)]=a21_0x29e2f9(0x1a3);[a21_0x29e2f9(0x1aa)];[a21_0x29e2f9(0x1ca)];async[a21_0x29e2f9(0x1d1)](_0x3161b5){const _0x58b78c=a21_0x29e2f9,{tdx:_0x243f3a,options:_0x5b61a5}=_0x3161b5;try{const _0x38c322=_0x5b61a5,_0x38fc2f=_0x38c322['port']||0xfa0,_0x2a8ea3=_0x38c322['project'],_0x29c697=await findAvailablePort(_0x38fc2f);console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)](_0x58b78c(0x1af)));const _0x13f3cb=await getProjectIdOrDefault(_0x3161b5,_0x2a8ea3),_0xbab173=await _0x243f3a[_0x58b78c(0x1c8)]['projects'](),_0xe24d23=_0xbab173['find'](_0x2e5b20=>_0x2e5b20['id']===_0x13f3cb);this['logger']=new TDXLogger(_0x5b61a5[_0x58b78c(0x1b3)]),await this[_0x58b78c(0x1ca)][_0x58b78c(0x1bc)](),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)](_0x58b78c(0x1d2)));_0x29c697!==_0x38fc2f&&console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1c6)](_0x58b78c(0x1a4)+_0x38fc2f+_0x58b78c(0x19a)+_0x29c697));this['server']=new ProxyServer({'port':_0x29c697,'projectId':_0x13f3cb,'tdx':_0x243f3a,'logger':this[_0x58b78c(0x1ca)],'site':_0x5b61a5[_0x58b78c(0x1a0)]}),await this[_0x58b78c(0x1aa)]['start'](),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1c6)][_0x58b78c(0x197)](_0x58b78c(0x19f))),console[_0x58b78c(0x1b6)](a21_0x4ee90e['yellow'](_0x58b78c(0x1b2))),console['log'](a21_0x4ee90e[_0x58b78c(0x1c6)](_0x58b78c(0x1ab))),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1bf)]['bold'](_0x58b78c(0x1ae))),console['log'](a21_0x4ee90e[_0x58b78c(0x1c4)](_0x58b78c(0x198))),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)](_0x58b78c(0x1a8)),a21_0x4ee90e['white']('http://0.0.0.0:'+_0x29c697)),console[_0x58b78c(0x1b6)](a21_0x4ee90e['dim'](_0x58b78c(0x1a2)),a21_0x4ee90e['white'](_0xe24d23?.[_0x58b78c(0x1b0)][_0x58b78c(0x19d)]||_0x13f3cb)),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)](_0x58b78c(0x1b9)),a21_0x4ee90e[_0x58b78c(0x19c)]('created\x20on-demand\x20per\x20model')),console[_0x58b78c(0x1b6)](a21_0x4ee90e['dim'](_0x58b78c(0x1b4)),a21_0x4ee90e[_0x58b78c(0x19c)](_0x5b61a5[_0x58b78c(0x1a0)])),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1c4)](_0x58b78c(0x1a7))),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)]('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console['log'](a21_0x4ee90e[_0x58b78c(0x19c)](_0x58b78c(0x1cf))),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x19c)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x19c)](_0x58b78c(0x1c9)+_0x29c697+'\x22,')),console['log'](a21_0x4ee90e['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x19c)](_0x58b78c(0x1a6))),console['log'](a21_0x4ee90e[_0x58b78c(0x19c)](_0x58b78c(0x1d0))),console['log'](a21_0x4ee90e[_0x58b78c(0x19c)](_0x58b78c(0x1c0))),console[_0x58b78c(0x1b6)](a21_0x4ee90e['cyan'](_0x58b78c(0x1c2))),console[_0x58b78c(0x1b6)](a21_0x4ee90e['dim'](_0x58b78c(0x1be))),console['log'](a21_0x4ee90e['dim']('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x58b78c(0x1b6)](a21_0x4ee90e[_0x58b78c(0x1cb)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x58b78c(0x1b6)](a21_0x4ee90e['yellow'](_0x58b78c(0x1c3)));const _0x5472df=async()=>{const _0x2bfa96=_0x58b78c;console[_0x2bfa96(0x1b6)](a21_0x4ee90e['dim']('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x2bfa96(0x1aa)]&&await this[_0x2bfa96(0x1aa)][_0x2bfa96(0x1b5)](),this[_0x2bfa96(0x1ca)]&&await this[_0x2bfa96(0x1ca)][_0x2bfa96(0x1b8)](),console['log'](a21_0x4ee90e[_0x2bfa96(0x1bf)]('✓\x20Proxy\x20server\x20stopped')),process['exit'](0x0);};return process['on'](_0x58b78c(0x1a1),_0x5472df),process['on'](_0x58b78c(0x1c1),_0x5472df),await new Promise(()=>{}),0x0;}catch(_0x4bb24d){this[_0x58b78c(0x1aa)]&&await this['server']['stop']();this['logger']&&await this['logger']['close']();throw _0x4bb24d;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a22_0x555204=a22_0x17e1;function a22_0x5a9f(){const _0x26de76=['message','167070TxNPwE','6Uamagf','278959qBmPXL','apiKey','1200102cEHFlu','3736173ibMTmW','TDX_SITE','12ZhSMlV','profile','TDX_PROFILE','MCP\x20server\x20error:\x20','execute','TDX_API_KEY','627428RLoBqt','context','mcp','3880624iZWxxW','name','15988914xdPtVF','site'];a22_0x5a9f=function(){return _0x26de76;};return a22_0x5a9f();}(function(_0x1f449a,_0x73d2ae){const _0x544905=a22_0x17e1,_0x247e07=_0x1f449a();while(!![]){try{const _0x7711d1=-parseInt(_0x544905(0x169))/0x1*(parseInt(_0x544905(0x168))/0x2)+-parseInt(_0x544905(0x16b))/0x3+-parseInt(_0x544905(0x174))/0x4+parseInt(_0x544905(0x167))/0x5*(parseInt(_0x544905(0x16e))/0x6)+parseInt(_0x544905(0x16c))/0x7+-parseInt(_0x544905(0x162))/0x8+parseInt(_0x544905(0x164))/0x9;if(_0x7711d1===_0x73d2ae)break;else _0x247e07['push'](_0x247e07['shift']());}catch(_0x24a3ce){_0x247e07['push'](_0x247e07['shift']());}}}(a22_0x5a9f,0x79a5b));import{BaseCommand}from'./command.js';function a22_0x17e1(_0x441ad4,_0x131684){_0x441ad4=_0x441ad4-0x162;const _0x5a9fd0=a22_0x5a9f();let _0x17e13c=_0x5a9fd0[_0x441ad4];return _0x17e13c;}export class MCPCommand extends BaseCommand{[a22_0x555204(0x163)]=a22_0x555204(0x176);['description']='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async[a22_0x555204(0x172)](_0x14b971){const _0x58e9ff=a22_0x555204,{tdx:_0x59b100}=_0x14b971,_0x2de888={};if(process.env.TDX_PROFILE)_0x2de888[_0x58e9ff(0x170)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x2de888[_0x58e9ff(0x173)]=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x2de888['TDX_SITE']=process.env.TDX_SITE);else _0x59b100[_0x58e9ff(0x175)][_0x58e9ff(0x16a)]&&(_0x2de888[_0x58e9ff(0x173)]=_0x59b100[_0x58e9ff(0x175)][_0x58e9ff(0x16a)],_0x2de888[_0x58e9ff(0x16d)]=_0x59b100['context'][_0x58e9ff(0x165)]);}_0x59b100['context'][_0x58e9ff(0x16f)]&&(_0x2de888[_0x58e9ff(0x170)]=_0x59b100[_0x58e9ff(0x175)][_0x58e9ff(0x16f)]);try{const {startMCPServer:_0x5178a5}=await import('../mcp/server.js');return await _0x5178a5({'env':_0x2de888}),0x0;}catch(_0x5784fe){const _0x17d2d8=_0x5784fe instanceof Error?_0x5784fe[_0x58e9ff(0x166)]:String(_0x5784fe);return console['error'](_0x58e9ff(0x171)+_0x17d2d8),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x220d5c=a23_0xb082;(function(_0x2412bc,_0xc867c5){const _0xdf07d9=a23_0xb082,_0x127428=_0x2412bc();while(!![]){try{const _0x2fd629=parseInt(_0xdf07d9(0x27c))/0x1*(-parseInt(_0xdf07d9(0x229))/0x2)+-parseInt(_0xdf07d9(0x209))/0x3*(-parseInt(_0xdf07d9(0x25a))/0x4)+-parseInt(_0xdf07d9(0x285))/0x5*(-parseInt(_0xdf07d9(0x196))/0x6)+-parseInt(_0xdf07d9(0x1c0))/0x7*(-parseInt(_0xdf07d9(0x240))/0x8)+parseInt(_0xdf07d9(0x25d))/0x9*(-parseInt(_0xdf07d9(0x26f))/0xa)+parseInt(_0xdf07d9(0x1e0))/0xb+-parseInt(_0xdf07d9(0x292))/0xc*(-parseInt(_0xdf07d9(0x1ae))/0xd);if(_0x2fd629===_0xc867c5)break;else _0x127428['push'](_0x127428['shift']());}catch(_0x299754){_0x127428['push'](_0x127428['shift']());}}}(a23_0x1fc3,0x5a301));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x2682db from'path';import{BaseCommand}from'./command.js';function a23_0xb082(_0x249731,_0x4edbfc){_0x249731=_0x249731-0x181;const _0x1fc3cd=a23_0x1fc3();let _0xb082b6=_0x1fc3cd[_0x249731];return _0xb082b6;}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a23_0x1fc3(){const _0x35be3b=['workflowAttemptId','workflowSessionId','segment:parent:push','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','ignore','segment:parent:preview','\x27...','name','segment:parent:fields','execute','data','processedRows','Join\x20on:','addBehaviorsFile','3027080KRkqIN','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','match','elapsedTimeMillis','Join:','tdx\x20segment\x20parent\x20preview\x20','No\x20parent\x20segments\x20found','displayPreviewResults','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','dim','trim','SQL\x20query:\x0a','Master\x20Table','Options:','\x0a⚠️\x20\x20Both\x20','displaySampleData','columns','apply','in\x20','displayPreviewHints','message','Validating\x20configuration...','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','-1d','Coverage:','2236fADCQR','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20parent\x20segment\x20\x27','252jTSxxl','segment:parent:run','yes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20--enriched','log','\x20\x20\x20\x20-\x20','Creating\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Name:\x20','\x27\x20and\x20run\x20workflow?','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Updated','column','coveragePercent','previewParentYaml','Get\x20SQL\x20query\x20for\x20parent\x20segment','stop','187990eJNEeh','description','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Source:','session','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x0aNew\x20parent\x20segment\x20\x27','query','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','unref','Listing\x20parent\x20segments\x20matching\x20\x27','population','.yml','298pAWdRb','addBehaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','double','No\x20parent\x20segments\x20match\x20pattern:\x20','all','getParentSQL','/{name}.yml\x0a','Options:\x0a','10HFHfsI','Fetching\x20SQL\x20for\x20\x27','totalEvents','foreignKey','localeCompare','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x27\x20is\x20already\x20up\x20to\x20date','displaySummary','\x20--attribute\x20\x22<name>\x22','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','setJobId','segment:parent:create','Preview:','312468igLbZd','\x20tdx\x20wf\x20attempt\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','schemaValid','\x20parent\x20segment\x20\x27','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','attributes','schemaError','Fetching\x20current\x20configuration\x20for\x20\x27','`\x20to\x20download\x20the\x20configuration\x20first','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20No\x20sample\x20data\x20available','Error\x20parsing\x20YAML:\x20','createParent','sampleData','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','audienceId','segment:parent:sql','Master:','YAML\x20file:\x20','customerPercent','.yaml','join','segment:parent:view','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Parent\x20segment:\x20','errors','\x20No\x20changes\x20-\x20','✔\x20Found\x20','\x20kill','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Overwrite\x20\x27','Site:\x20','enriched','✔\x20Query\x20completed:\x20Processed\x20','bold','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','database','addAttributesFile','format','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','scheduleType','table','Updating','Show\x20parent\x20segment\x20details','1529784nNEKpR','jobId','cyan','Aborted.','parent_segment','Available\x20attributes:','segment','pullParentYaml','Error\x20reading\x20file:\x20','segment:parent:desc','getParentFull','verbose','Available\x20behaviors:','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x0aError:','varchar','segment:parent:show','sort','stats','resolveParentId','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20Opening\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','customerGroup','143fFLCZf','green','Attempt:','SELECT\x20*\x20FROM\x20(\x0a','behavior','test','segment:parent:pull','Listing\x20fields\x20for\x20\x27','validateParentYaml','segment:parent:update','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20Configuration\x20is\x20valid','\x20field','Master\x20+\x20Attributes','/\x20and\x20','✔\x20Created\x20parent\x20segment\x20\x27','matchedCount','7BvjTbg','\x20=\x20','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Executing\x20parent\x20segment\x20query...','endsWith','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','displayColumns','updateParent','attribute','label','\x0aChanges\x20to\x20\x27','To\x20cancel:','information_schema','jsonl','Columns:','displayBehaviorsStats','error','isDirectory','workflowId','Analyzing\x20changes...','scheduleOption','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','platform','interval','List\x20parent\x20segments','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Attributes','toFixed','1560977tiJUFV','Creating','Errors:','/\x20directory.\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','replace','/app/workflows/','\x20--behavior\x20\x22','✔\x20No\x20changes\x20-\x20\x27','text','toLocaleString','yellow','site','addAttributes','Rows:','customersWithEvents','\x20is\x20already\x20up\x20to\x20date','length','\x0a✔\x20Workflow\x20started','\x20rows\x20','%)\x20','Resolving\x20parent\x20segment\x20\x27','filter','web','displayAttributesStats','allValid','behaviors','Session:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Pattern:\x20','Updating\x20parent\x20segment\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','joinKey','Apply\x20changes\x20to\x20\x27','open','Error:','\x0aNo\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Audience\x20ID:','utf-8','1578KaWGGG','keys','dirname','Customers:','segment:parent:list','string','displayValidateResults','run','Error:\x20File\x20not\x20found:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','xdg-open','repeat','Options\x20(one\x20required):\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','Created','\x5c$&','timezone','Show\x20parent\x20segment\x20schema\x20(column\x20types)','start','using\x20the\x20default\x20path:\x20','✔\x20Renamed\x20directory\x20to\x20','Validate:','Events:','json','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','parentSegment','map','/app/dw/parentSegments/','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','/\x20→\x20','\x20Context\x20set:\x20','master','4798qBMTQn','pushParentYaml','\x20--attribute\x20\x22','output','/attempt/','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','behaviorsFile','rowCount'];a23_0x1fc3=function(){return _0x35be3b;};return a23_0x1fc3();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x5e4570 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x220d5c(0x19a);function openBrowser(_0x11056c){const _0x27aa44=a23_0x220d5c,_0x48bf2a=process[_0x27aa44(0x1d7)],_0x2564d3=_0x48bf2a==='darwin'?_0x27aa44(0x203):_0x48bf2a==='win32'?'start':_0x27aa44(0x213);spawn(_0x2564d3,[_0x11056c],{'detached':!![],'stdio':_0x27aa44(0x236)})[_0x27aa44(0x278)]();}function migrateLegacyDirectory(){const _0x132a7e=a23_0x220d5c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2fe04e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2fe04e[_0x132a7e(0x1d1)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x132a7e(0x1d0)](a23_0x5e4570[_0x132a7e(0x1eb)](_0x132a7e(0x24e)+LEGACY_PARENT_SEGMENT_DIR+_0x132a7e(0x1bd)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x132a7e(0x1d0)](a23_0x5e4570[_0x132a7e(0x249)](_0x132a7e(0x1fc)+LEGACY_PARENT_SEGMENT_DIR+_0x132a7e(0x1e3))),![];console[_0x132a7e(0x1d0)](a23_0x5e4570[_0x132a7e(0x1eb)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x132a7e(0x226)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x132a7e(0x1d0)](a23_0x5e4570[_0x132a7e(0x1af)](_0x132a7e(0x21d)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x21c133){const _0xb26106=_0x21c133 instanceof Error?_0x21c133['message']:String(_0x21c133);return console['error'](a23_0x5e4570['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0xb26106+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x220d5c(0x210)](_0x2dbb61){const _0x347239=a23_0x220d5c;return migrateLegacyDirectory(),super[_0x347239(0x210)](_0x2dbb61);}}function resolveYamlFile(_0x4a8747){const _0x30210c=a23_0x220d5c;if(_0x4a8747[_0x30210c(0x1c4)]('.yml')||_0x4a8747[_0x30210c(0x1c4)](_0x30210c(0x2a8)))return _0x4a8747;return a23_0x2682db[_0x30210c(0x2a9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4a8747)+_0x30210c(0x27b));}function formatProgressMessage(_0x2318b6){const _0x6e22bf=a23_0x220d5c,_0x5446e8=_0x2318b6[_0x6e22bf(0x242)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5446e8){const [,_0x40c20b,_0x185253,_0x386d8b='']=_0x5446e8;return a23_0x5e4570['dim'](_0x40c20b+':')+'\x20'+_0x185253+a23_0x5e4570[_0x6e22bf(0x249)](_0x386d8b);}return a23_0x5e4570[_0x6e22bf(0x249)](_0x2318b6);}function showFileNotFoundError(_0x1df3a2,_0x4a0262){const _0xed102a=a23_0x220d5c;console[_0xed102a(0x1d0)](a23_0x5e4570['red'](_0xed102a(0x211)+_0x1df3a2+'\x0a')),console[_0xed102a(0x1d0)](a23_0x5e4570[_0xed102a(0x198)](_0xed102a(0x29d)+_0x4a0262+_0xed102a(0x29c)));}function showParentSegmentNotSetError(_0x5589ec){const _0xf3d298=a23_0x220d5c;console[_0xf3d298(0x1d0)](a23_0x5e4570[_0xf3d298(0x1eb)](_0xf3d298(0x1b8))),console[_0xf3d298(0x1d0)](_0x5589ec);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x20d);['description']=a23_0x220d5c(0x1d9);async[a23_0x220d5c(0x23b)](_0x278104){const _0x3ed881=a23_0x220d5c,{options:_0x58f39d,args:_0x4b55d4,tdx:_0x472268}=_0x278104,_0x5b683e=_0x4b55d4[0x0];_0x58f39d['verbose']&&(console[_0x3ed881(0x1d0)](_0x3ed881(0x189)+_0x58f39d[_0x3ed881(0x1ec)]),_0x5b683e&&console[_0x3ed881(0x1d0)](_0x3ed881(0x1fd)+_0x5b683e));const _0x733cbf=await withSpinner(_0x5b683e?_0x3ed881(0x279)+_0x5b683e+_0x3ed881(0x238):'Listing\x20parent\x20segments...',()=>_0x472268[_0x3ed881(0x19c)]['listParents'](),{'verbose':_0x58f39d[_0x3ed881(0x1a1)]});let _0x40a3cf=_0x733cbf['data'];if(_0x5b683e){const _0x402878=_0x5b683e[_0x3ed881(0x1e5)](/[.+^${}()|[\]\\]/g,_0x3ed881(0x218))[_0x3ed881(0x1e5)](/\*/g,'.*')[_0x3ed881(0x1e5)](/\?/g,'.'),_0x465524=new RegExp('^'+_0x402878+'$','i');_0x40a3cf=_0x40a3cf[_0x3ed881(0x1f6)](_0x1f4000=>_0x465524[_0x3ed881(0x1b3)](_0x1f4000[_0x3ed881(0x299)][_0x3ed881(0x239)]));}_0x40a3cf[_0x3ed881(0x1a7)]((_0x4c7bd6,_0x3f8903)=>_0x4c7bd6['attributes']['name'][_0x3ed881(0x289)](_0x3f8903[_0x3ed881(0x299)][_0x3ed881(0x239)])),console[_0x3ed881(0x1d0)](_0x3ed881(0x185)+_0x40a3cf['length']+'\x20parent\x20segment'+(_0x40a3cf[_0x3ed881(0x1f1)]!==0x1?'s':''));const _0x17ba98=_0x49f313=>{const _0x4266ae=_0x3ed881;return getConsoleNextUrl(_0x58f39d[_0x4266ae(0x1ec)],'/app/dw/parentSegments/'+_0x49f313);};if(_0x58f39d[_0x3ed881(0x190)]==='json'||_0x58f39d[_0x3ed881(0x190)]===_0x3ed881(0x1cd)){const _0x8ae5b=_0x40a3cf[_0x3ed881(0x223)](_0x22200d=>({..._0x22200d,'url':_0x17ba98(_0x22200d['id'])}));await handleSDKOutput(_0x8ae5b,_0x58f39d);}else{if(_0x40a3cf[_0x3ed881(0x1f1)]===0x0)_0x5b683e?console['log'](_0x3ed881(0x280)+_0x5b683e):console[_0x3ed881(0x262)](_0x3ed881(0x246));else for(const _0x225086 of _0x40a3cf){const _0x3efccd=_0x225086[_0x3ed881(0x299)][_0x3ed881(0x27a)]?a23_0x5e4570[_0x3ed881(0x249)]('\x20('+formatRows(_0x225086[_0x3ed881(0x299)]['population'])+')'):'',_0xcbd909=hyperlink(_0x225086['attributes'][_0x3ed881(0x239)],_0x17ba98(_0x225086['id']));console['log']('👥\x20'+_0xcbd909+_0x3efccd);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x220d5c(0x290);[a23_0x220d5c(0x270)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x220d5c(0x23b)](_0x184601){const _0x8f73d5=a23_0x220d5c,{options:_0x3a4f6d,args:_0x52548c,tdx:_0x57ec5e}=_0x184601;console['error'](_0x8f73d5(0x234)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x8f73d5(0x1a3));const _0x5ce1c9=_0x3a4f6d;if(_0x52548c[_0x8f73d5(0x1f1)]===0x0)return console[_0x8f73d5(0x1d0)](a23_0x5e4570[_0x8f73d5(0x1da)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x8f73d5(0x1d0)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x3472f8=_0x52548c[0x0];if(!_0x5ce1c9[_0x8f73d5(0x18e)]||!_0x5ce1c9['table'])return console[_0x8f73d5(0x1d0)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x8f73d5(0x1d0)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5ce1c9['verbose']&&(console[_0x8f73d5(0x1d0)](_0x8f73d5(0x189)+_0x5ce1c9[_0x8f73d5(0x1ec)]),console[_0x8f73d5(0x1d0)](_0x8f73d5(0x266)+_0x3472f8),console[_0x8f73d5(0x1d0)]('Database:\x20'+_0x5ce1c9[_0x8f73d5(0x18e)]),console[_0x8f73d5(0x1d0)]('Table:\x20'+_0x5ce1c9[_0x8f73d5(0x193)]));const _0x4a9342=await loadJSONFromOptions(_0x5ce1c9['attributes'],_0x5ce1c9['attributesFile']),_0x268697=await loadJSONFromOptions(_0x5ce1c9['behaviors'],_0x5ce1c9[_0x8f73d5(0x22f)]),_0x15fc82=await loadJSONFromOptions(_0x5ce1c9[_0x8f73d5(0x1ad)],_0x5ce1c9['customerGroupFile']),_0x234a67={'name':_0x3472f8,'description':_0x5ce1c9[_0x8f73d5(0x270)],'scheduleType':_0x5ce1c9[_0x8f73d5(0x192)],'scheduleOption':_0x5ce1c9[_0x8f73d5(0x1d4)],'timezone':_0x5ce1c9['timezone'],'master':{'parentDatabaseName':_0x5ce1c9['database'],'parentTableName':_0x5ce1c9[_0x8f73d5(0x193)]},'attributes':_0x4a9342,'behaviors':_0x268697,'customerGroup':_0x15fc82},_0x56db24=await withSpinner(_0x8f73d5(0x264)+_0x3472f8+_0x8f73d5(0x238),()=>_0x57ec5e[_0x8f73d5(0x19c)][_0x8f73d5(0x2a0)](_0x234a67),{'verbose':_0x3a4f6d[_0x8f73d5(0x1a1)]}),_0x293977=_0x56db24[_0x8f73d5(0x23c)];return console['error'](_0x8f73d5(0x1be)+_0x293977[_0x8f73d5(0x239)]+'\x27\x20with\x20ID:\x20'+_0x293977['id']),await handleSDKOutput([_0x293977],_0x3a4f6d),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0x220d5c(0x1b7);[a23_0x220d5c(0x270)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x216297){const _0x4ea28d=a23_0x220d5c,{options:_0x1e0b04,args:_0x1b8ba5,tdx:_0x4050ba}=_0x216297;console[_0x4ea28d(0x1d0)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4ea28d(0x1a3));const _0x4c7dd9=_0x1e0b04;if(_0x1b8ba5['length']===0x0)return console[_0x4ea28d(0x1d0)](a23_0x5e4570[_0x4ea28d(0x1da)](_0x4ea28d(0x25b))),console[_0x4ea28d(0x1d0)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x1adf1b=_0x1b8ba5[0x0];_0x4c7dd9[_0x4ea28d(0x1a1)]&&(console['error'](_0x4ea28d(0x189)+_0x4c7dd9[_0x4ea28d(0x1ec)]),console[_0x4ea28d(0x1d0)](_0x4ea28d(0x182)+_0x1adf1b));const _0xd4778e=await withSpinner(_0x4ea28d(0x29b)+_0x1adf1b+'\x27...',()=>_0x4050ba[_0x4ea28d(0x19c)]['getParentFull'](_0x1adf1b),{'verbose':_0x4c7dd9[_0x4ea28d(0x1a1)]}),_0x1364b0=_0xd4778e['data'],_0x2d9249=await loadJSONFromOptions(_0x4c7dd9[_0x4ea28d(0x1ed)],_0x4c7dd9[_0x4ea28d(0x18f)]),_0x2a5d7c=await loadJSONFromOptions(_0x4c7dd9[_0x4ea28d(0x27d)],_0x4c7dd9[_0x4ea28d(0x23f)]),_0xe64537={'name':_0x1364b0[_0x4ea28d(0x239)],'description':_0x4c7dd9[_0x4ea28d(0x270)]!==undefined?_0x4c7dd9[_0x4ea28d(0x270)]:_0x1364b0[_0x4ea28d(0x270)],'scheduleType':_0x4c7dd9[_0x4ea28d(0x192)]!==undefined?_0x4c7dd9[_0x4ea28d(0x192)]:_0x1364b0[_0x4ea28d(0x192)],'scheduleOption':_0x4c7dd9[_0x4ea28d(0x1d4)]!==undefined?_0x4c7dd9[_0x4ea28d(0x1d4)]:_0x1364b0['scheduleOption'],'timezone':_0x4c7dd9['timezone']!==undefined?_0x4c7dd9[_0x4ea28d(0x219)]:_0x1364b0[_0x4ea28d(0x219)],'master':_0x1364b0[_0x4ea28d(0x228)],'attributes':_0x2d9249?[..._0x1364b0[_0x4ea28d(0x299)]||[],..._0x2d9249]:_0x1364b0['attributes'],'behaviors':_0x2a5d7c?[..._0x1364b0['behaviors']||[],..._0x2a5d7c]:_0x1364b0['behaviors'],'customerGroup':_0x1364b0[_0x4ea28d(0x1ad)]},_0x473ac3=await withSpinner(_0x4ea28d(0x1fe)+_0x1adf1b+_0x4ea28d(0x238),()=>_0x4050ba[_0x4ea28d(0x19c)][_0x4ea28d(0x1c7)](_0x1adf1b,_0xe64537),{'verbose':_0x4c7dd9[_0x4ea28d(0x1a1)]}),_0x34a4e9=_0x473ac3[_0x4ea28d(0x23c)];return console[_0x4ea28d(0x1d0)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x34a4e9[_0x4ea28d(0x239)]+'\x27'),await handleSDKOutput([_0x34a4e9],_0x4c7dd9),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x1b4);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a23_0x220d5c(0x23b)](_0x20968f){const _0x5b6311=a23_0x220d5c,{options:_0x15cb90,args:_0x591a21,tdx:_0x52a00a}=_0x20968f,_0x15fa48=_0x15cb90,_0x2cc971=_0x591a21[0x0]||_0x15cb90[_0x5b6311(0x222)];if(!_0x2cc971)return showParentSegmentNotSetError(_0x5b6311(0x1aa)+_0x5b6311(0x260)),0x1;if(_0x15fa48['use']&&_0x15fa48[_0x5b6311(0x22c)])return console[_0x5b6311(0x1d0)](a23_0x5e4570['red'](_0x5b6311(0x277))),console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x249)](_0x5b6311(0x298))),console['error'](a23_0x5e4570['dim'](_0x5b6311(0x21c)+PARENT_SEGMENT_DIR+_0x5b6311(0x283))),console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x198)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x41e639=_0x15fa48[_0x5b6311(0x22c)]||a23_0x2682db[_0x5b6311(0x2a9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2cc971)+_0x5b6311(0x27b));_0x15fa48[_0x5b6311(0x1a1)]&&(console[_0x5b6311(0x1d0)](_0x5b6311(0x189)+_0x15fa48[_0x5b6311(0x1ec)]),console[_0x5b6311(0x1d0)](_0x5b6311(0x182)+_0x2cc971),console['error']('Output\x20file:\x20'+_0x41e639));const _0x1565b9=await withSpinner(_0x5b6311(0x25c)+_0x2cc971+'\x27...',()=>_0x52a00a[_0x5b6311(0x19c)][_0x5b6311(0x19d)](_0x2cc971),{'verbose':_0x15fa48[_0x5b6311(0x1a1)]}),_0x2a5022=_0x1565b9[_0x5b6311(0x23c)];if(existsSync(_0x41e639)){const _0x5415bd=readFileSync(_0x41e639,_0x5b6311(0x208)),_0x1399c8=generateDiff(_0x5415bd,_0x2a5022);if(!hasChanges(_0x1399c8))console[_0x5b6311(0x1d0)](a23_0x5e4570['green']('✔')+_0x5b6311(0x184)+a23_0x5e4570[_0x5b6311(0x198)](_0x41e639)+_0x5b6311(0x1f0));else{console[_0x5b6311(0x1d0)](_0x5b6311(0x1ca)+_0x41e639+'\x27:'),console[_0x5b6311(0x1d0)]('─'[_0x5b6311(0x214)](0x3c)),console[_0x5b6311(0x1d0)](formatDiffWithColors(_0x1399c8)),console[_0x5b6311(0x1d0)]('─'[_0x5b6311(0x214)](0x3c));if(!_0x15fa48[_0x5b6311(0x25f)]){if(!isInteractive())return console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x1da)](_0x5b6311(0x1a4)),_0x5b6311(0x1ff)),console[_0x5b6311(0x1d0)](a23_0x5e4570['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x5b8ebd=await confirmKey(_0x5b6311(0x188)+_0x41e639+'\x27?');if(!_0x5b8ebd)return console['error'](a23_0x5e4570[_0x5b6311(0x1eb)](_0x5b6311(0x199))),0x1;}writeFileSync(_0x41e639,_0x2a5022,_0x5b6311(0x208)),console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x1af)]('✔')+_0x5b6311(0x2a2)+a23_0x5e4570['cyan'](_0x41e639));}}else{const _0x537aa7=a23_0x2682db[_0x5b6311(0x20b)](_0x41e639);!existsSync(_0x537aa7)&&mkdirSync(_0x537aa7,{'recursive':!![]}),writeFileSync(_0x41e639,_0x2a5022,_0x5b6311(0x208)),console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x1af)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x5e4570[_0x5b6311(0x198)](_0x41e639));}return saveSessionContext({'parent_segment':_0x2cc971},_0x15fa48[_0x5b6311(0x273)]),console[_0x5b6311(0x1d0)](a23_0x5e4570[_0x5b6311(0x1af)]('✔')+_0x5b6311(0x227)+a23_0x5e4570[_0x5b6311(0x249)](_0x5b6311(0x19a))+_0x5b6311(0x1c1)+a23_0x5e4570[_0x5b6311(0x198)](_0x2cc971)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x233);['description']=a23_0x220d5c(0x225);async[a23_0x220d5c(0x23b)](_0x36e952){const _0x28b7a7=a23_0x220d5c,{options:_0x4ec95d,args:_0xdad7b7,tdx:_0x43fac4}=_0x36e952,_0x1d2e7a=_0x4ec95d,_0x3fa45f=_0xdad7b7[0x0]||_0x4ec95d[_0x28b7a7(0x222)];if(!_0x3fa45f)return showParentSegmentNotSetError(_0x28b7a7(0x1c5)+_0x28b7a7(0x1db)),0x1;const _0x4d165=resolveYamlFile(_0x3fa45f);if(!existsSync(_0x4d165))return showFileNotFoundError(_0x4d165,_0x3fa45f),0x1;_0x1d2e7a[_0x28b7a7(0x1a1)]&&(console[_0x28b7a7(0x1d0)](_0x28b7a7(0x189)+_0x1d2e7a[_0x28b7a7(0x1ec)]),console[_0x28b7a7(0x1d0)](_0x28b7a7(0x2a6)+_0x4d165));let _0x450f30;try{_0x450f30=readFileSync(_0x4d165,_0x28b7a7(0x208));}catch(_0x3f07c8){const _0x134830=_0x3f07c8 instanceof Error?_0x3f07c8[_0x28b7a7(0x254)]:String(_0x3f07c8);return console[_0x28b7a7(0x1d0)](_0x28b7a7(0x19e)+_0x134830),0x1;}const _0xb0c939=await withSpinner(_0x28b7a7(0x1d3),()=>_0x43fac4[_0x28b7a7(0x19c)][_0x28b7a7(0x22a)](_0x450f30),{'verbose':_0x1d2e7a[_0x28b7a7(0x1a1)]}),_0x6e6948=_0xb0c939[_0x28b7a7(0x23c)],{isNew:_0x4fe05d,name:_0x35bf5c,hasChanges:_0x3f1065,diffFormatted:_0x35afb0}=_0x6e6948;if(!_0x3f1065)return console[_0x28b7a7(0x1d0)](_0x28b7a7(0x1e8)+_0x35bf5c+_0x28b7a7(0x28b)),0x0;_0x4fe05d?console[_0x28b7a7(0x1d0)](_0x28b7a7(0x275)+_0x35bf5c+'\x27:'):console[_0x28b7a7(0x1d0)](_0x28b7a7(0x216)+_0x35bf5c+'\x27:');console[_0x28b7a7(0x1d0)]('─'[_0x28b7a7(0x214)](0x3c)),console['error'](_0x35afb0),console['error']('─'[_0x28b7a7(0x214)](0x3c));const _0xde295e=_0x4fe05d?'Create\x20parent\x20segment\x20\x27'+_0x35bf5c+'\x27?':_0x28b7a7(0x202)+_0x35bf5c+'\x27?';if(!_0x1d2e7a[_0x28b7a7(0x25f)]){if(!isInteractive())return console['error'](a23_0x5e4570[_0x28b7a7(0x1da)](_0x28b7a7(0x1a4)),_0x28b7a7(0x1ff)),console[_0x28b7a7(0x1d0)](a23_0x5e4570['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x561cc8=await confirmKey(_0xde295e);if(!_0x561cc8)return console[_0x28b7a7(0x1d0)](a23_0x5e4570[_0x28b7a7(0x1eb)](_0x28b7a7(0x199))),0x1;}const _0x594ea2=_0x4fe05d?_0x28b7a7(0x1e1):'Updating',_0x471337=await withSpinner(_0x594ea2+_0x28b7a7(0x297)+_0x35bf5c+_0x28b7a7(0x238),()=>_0x6e6948[_0x28b7a7(0x251)](),{'verbose':_0x1d2e7a[_0x28b7a7(0x1a1)]}),_0x428281=_0x471337[_0x28b7a7(0x23c)],_0x51c0b2=getConsoleNextUrl(_0x1d2e7a[_0x28b7a7(0x1ec)],_0x28b7a7(0x224)+_0x428281['id']),_0x1ededc=_0x4fe05d?'Created':_0x28b7a7(0x269);return console['error']('✔\x20'+_0x1ededc+_0x28b7a7(0x297)+_0x428281[_0x28b7a7(0x239)]+'\x27'),console[_0x28b7a7(0x1d0)]('\x20\x20'+_0x51c0b2),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x220d5c(0x239)]='segment:parent:validate';[a23_0x220d5c(0x270)]=a23_0x220d5c(0x268);async[a23_0x220d5c(0x23b)](_0x5bdfa7){const _0xdcd96e=a23_0x220d5c,{options:_0xae890e,args:_0x44caeb,tdx:_0x9bd557}=_0x5bdfa7,_0x1e0012=_0xae890e,_0x388d10=_0x44caeb[0x0]||_0xae890e[_0xdcd96e(0x222)];if(!_0x388d10)return showParentSegmentNotSetError(_0xdcd96e(0x28a)+_0xdcd96e(0x221)+_0xdcd96e(0x284)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0xdcd96e(0x18d)),0x1;const _0x388709=resolveYamlFile(_0x388d10);if(!existsSync(_0x388709))return showFileNotFoundError(_0x388709,_0x388d10),0x1;_0x1e0012[_0xdcd96e(0x1a1)]&&(console[_0xdcd96e(0x1d0)](_0xdcd96e(0x189)+_0x1e0012[_0xdcd96e(0x1ec)]),console[_0xdcd96e(0x1d0)](_0xdcd96e(0x2a6)+_0x388709));let _0x24ca6a;try{_0x24ca6a=readFileSync(_0x388709,_0xdcd96e(0x208));}catch(_0x511e8c){const _0x8772e7=_0x511e8c instanceof Error?_0x511e8c[_0xdcd96e(0x254)]:String(_0x511e8c);return console[_0xdcd96e(0x1d0)](_0xdcd96e(0x19e)+_0x8772e7),0x1;}const _0x2d8603=createCommandSpinner(a23_0x5e4570['dim'](_0xdcd96e(0x255)),{'verbose':_0x1e0012[_0xdcd96e(0x1a1)]});_0x2d8603[_0xdcd96e(0x21b)]();const _0x5d45af={'onProgress':_0x29f3dc=>{const _0x5440a5=_0xdcd96e;_0x2d8603[_0x5440a5(0x1e9)]=formatProgressMessage(_0x29f3dc);}};if(_0x1e0012['master'])_0x5d45af['master']=!![];if(_0x1e0012[_0xdcd96e(0x18a)])_0x5d45af[_0xdcd96e(0x18a)]=!![];_0x1e0012[_0xdcd96e(0x1c8)]&&(_0x5d45af[_0xdcd96e(0x1c8)]=_0x1e0012[_0xdcd96e(0x1c8)]);_0x1e0012['behavior']&&(_0x5d45af[_0xdcd96e(0x1b2)]=_0x1e0012[_0xdcd96e(0x1b2)]);if(_0x1e0012['interval'])_0x5d45af['interval']=_0x1e0012[_0xdcd96e(0x1d8)];let _0x18411a;try{_0x18411a=await _0x9bd557[_0xdcd96e(0x19c)][_0xdcd96e(0x1b6)](_0x24ca6a,_0x5d45af),_0x2d8603['stop']();}catch(_0x15795f){_0x2d8603[_0xdcd96e(0x26e)]();throw _0x15795f;}const _0x35d289=_0x1e0012[_0xdcd96e(0x1d8)]||_0xdcd96e(0x258);return this[_0xdcd96e(0x20f)](_0x18411a,_0x5d45af,_0x388709,_0x35d289),_0x18411a[_0xdcd96e(0x1f9)]?0x0:0x1;}[a23_0x220d5c(0x20f)](_0x542ca5,_0x521c5a,_0x24c00c,_0x402824){const _0x218247=a23_0x220d5c;console['error']('\x0a'+a23_0x5e4570['bold'](_0x218247(0x21e))+'\x20'+_0x542ca5[_0x218247(0x239)]),console['error']('═'['repeat'](0x3c)),this['displayMasterInfo'](_0x542ca5);if(typeof _0x521c5a[_0x218247(0x1c8)]===_0x218247(0x20e)){this[_0x218247(0x1f8)](_0x542ca5),this[_0x218247(0x28c)](_0x542ca5),this[_0x218247(0x253)](_0x24c00c,_0x402824,_0x218247(0x1c8),_0x521c5a[_0x218247(0x1c8)]);return;}if(_0x521c5a[_0x218247(0x1c8)]===!![]){this['displayAttributesStats'](_0x542ca5),this[_0x218247(0x28c)](_0x542ca5),this['displayPreviewHints'](_0x24c00c,_0x402824,'attributes');return;}if(typeof _0x521c5a[_0x218247(0x1b2)]===_0x218247(0x20e)){this[_0x218247(0x1cf)](_0x542ca5,_0x402824),this[_0x218247(0x28c)](_0x542ca5),this[_0x218247(0x253)](_0x24c00c,_0x402824,'behavior',_0x521c5a[_0x218247(0x1b2)]);return;}if(_0x521c5a['behavior']===!![]){this[_0x218247(0x1cf)](_0x542ca5,_0x402824),this[_0x218247(0x28c)](_0x542ca5),this[_0x218247(0x253)](_0x24c00c,_0x402824,_0x218247(0x1fa));return;}this['displayAttributesStats'](_0x542ca5),this['displayBehaviorsStats'](_0x542ca5,_0x402824),this['displaySummary'](_0x542ca5),this[_0x218247(0x253)](_0x24c00c,_0x402824,'all');}[a23_0x220d5c(0x253)](_0x1e45d4,_0x4b70f1,_0x4944d4,_0x3f0c32){const _0xd06c63=a23_0x220d5c;console[_0xd06c63(0x1d0)]('\x0a'+a23_0x5e4570[_0xd06c63(0x249)]('To\x20view\x20sample\x20data:'));const _0x3a162f=_0x4b70f1!==_0xd06c63(0x258)?'\x20--interval\x20'+_0x4b70f1:'';if(_0x4944d4===_0xd06c63(0x1c8)&&_0x3f0c32)console['error']('\x20\x20'+a23_0x5e4570[_0xd06c63(0x249)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1e45d4+_0xd06c63(0x22b)+_0x3f0c32+'\x22'+_0x3a162f));else{if(_0x4944d4===_0xd06c63(0x1b2)&&_0x3f0c32)console['error']('\x20\x20'+a23_0x5e4570['dim'](_0xd06c63(0x245)+_0x1e45d4+'\x20--behavior\x20\x22'+_0x3f0c32+'\x22'+_0x3a162f));else(_0x4944d4===_0xd06c63(0x299)||_0x4944d4===_0xd06c63(0x281))&&console[_0xd06c63(0x1d0)]('\x20\x20'+a23_0x5e4570['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x1e45d4+_0xd06c63(0x28d)+_0x3a162f));}(_0x4944d4===_0xd06c63(0x1fa)||_0x4944d4===_0xd06c63(0x281))&&console[_0xd06c63(0x1d0)]('\x20\x20'+a23_0x5e4570[_0xd06c63(0x249)](_0xd06c63(0x245)+_0x1e45d4+'\x20--behavior\x20\x22<name>\x22'+_0x3a162f)),_0x4944d4===_0xd06c63(0x281)&&console[_0xd06c63(0x1d0)]('\x20\x20'+a23_0x5e4570['dim'](_0xd06c63(0x245)+_0x1e45d4+_0xd06c63(0x261)+_0x3a162f));}['displayMasterInfo'](_0x2895da){const _0x61041f=a23_0x220d5c,{master:_0x3af7dc}=_0x2895da,_0x2c7690=_0x3af7dc['schemaValid']?a23_0x5e4570[_0x61041f(0x1af)]('✔'):a23_0x5e4570[_0x61041f(0x1da)]('✘');console[_0x61041f(0x1d0)]('\x0a'+a23_0x5e4570[_0x61041f(0x249)](_0x61041f(0x24c))),console[_0x61041f(0x1d0)](_0x2c7690+'\x20'+a23_0x5e4570[_0x61041f(0x18c)](_0x3af7dc['database']+'.'+_0x3af7dc['table'])),_0x3af7dc[_0x61041f(0x296)]?_0x3af7dc[_0x61041f(0x230)]!==undefined&&console[_0x61041f(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x61041f(0x249)](_0x61041f(0x1ee))+'\x20'+a23_0x5e4570[_0x61041f(0x198)](formatRows(_0x3af7dc[_0x61041f(0x230)]))):console[_0x61041f(0x1d0)]('\x20\x20'+a23_0x5e4570['red'](_0x61041f(0x204))+'\x20'+_0x3af7dc[_0x61041f(0x29a)]);}['displayAttributesStats'](_0x2e49e9){const _0x18d903=a23_0x220d5c;if(_0x2e49e9[_0x18d903(0x299)][_0x18d903(0x1f1)]===0x0)return;console['error']('\x0a'+a23_0x5e4570[_0x18d903(0x249)](_0x18d903(0x1de)));for(const _0x415a80 of _0x2e49e9['attributes']){const _0x42e67f=_0x415a80[_0x18d903(0x296)]?a23_0x5e4570[_0x18d903(0x1af)]('✔'):a23_0x5e4570[_0x18d903(0x1da)]('✘');let _0x2a16e4='';if(_0x415a80[_0x18d903(0x296)]&&_0x415a80[_0x18d903(0x1bf)]!==undefined&&_0x415a80[_0x18d903(0x26b)]!==undefined){const _0x1ab35a=_0x415a80[_0x18d903(0x26b)]['toFixed'](0x1),_0x59318f=_0x415a80[_0x18d903(0x26b)]>=0x50?a23_0x5e4570[_0x18d903(0x1af)]:_0x415a80[_0x18d903(0x26b)]>=0x32?a23_0x5e4570['yellow']:a23_0x5e4570[_0x18d903(0x1da)];_0x2a16e4='\x20'+a23_0x5e4570[_0x18d903(0x249)](_0x18d903(0x259))+'\x20'+_0x59318f(_0x1ab35a+'%')+'\x20('+formatRows(_0x415a80[_0x18d903(0x1bf)])+'\x20rows)';}console[_0x18d903(0x1d0)](_0x42e67f+'\x20'+a23_0x5e4570['bold'](_0x415a80[_0x18d903(0x239)])+_0x2a16e4),console[_0x18d903(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x18d903(0x249)](_0x18d903(0x272))+'\x20'+a23_0x5e4570[_0x18d903(0x18c)](_0x415a80[_0x18d903(0x18e)]+'.'+_0x415a80[_0x18d903(0x193)]));const _0x792ef9=_0x415a80[_0x18d903(0x201)]===_0x415a80[_0x18d903(0x288)]?a23_0x5e4570['dim'](_0x18d903(0x23e))+'\x20'+_0x415a80[_0x18d903(0x201)]:a23_0x5e4570[_0x18d903(0x249)](_0x18d903(0x244))+'\x20'+_0x415a80[_0x18d903(0x201)]+_0x18d903(0x1c1)+_0x415a80[_0x18d903(0x288)];console[_0x18d903(0x1d0)]('\x20\x20'+_0x792ef9),console[_0x18d903(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x18d903(0x249)](_0x18d903(0x1ce))),this[_0x18d903(0x1c6)](_0x415a80[_0x18d903(0x250)]),!_0x415a80['schemaValid']&&console[_0x18d903(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x18d903(0x1da)](_0x18d903(0x204))+'\x20'+_0x415a80[_0x18d903(0x29a)]);}}[a23_0x220d5c(0x1cf)](_0x30d3a2,_0x1dc79d){const _0x204013=a23_0x220d5c;if(_0x30d3a2[_0x204013(0x1fa)][_0x204013(0x1f1)]===0x0)return;console[_0x204013(0x1d0)]('\x0a'+a23_0x5e4570[_0x204013(0x249)]('Behaviors')+'\x20'+a23_0x5e4570[_0x204013(0x249)]('('+_0x1dc79d+')'));for(const _0x47d7f1 of _0x30d3a2[_0x204013(0x1fa)]){const _0x4f9a8b=_0x47d7f1[_0x204013(0x296)]?a23_0x5e4570[_0x204013(0x1af)]('✔'):a23_0x5e4570['red']('✘');let _0x22c92a='';if(_0x47d7f1[_0x204013(0x296)]&&_0x47d7f1[_0x204013(0x1ef)]!==undefined&&_0x47d7f1['totalEvents']!==undefined){const _0x1e578c=_0x47d7f1[_0x204013(0x2a7)]?.[_0x204013(0x1df)](0x1)||'?',_0x4d7cb3=(_0x47d7f1['customerPercent']??0x0)>=0x32?a23_0x5e4570[_0x204013(0x1af)]:(_0x47d7f1[_0x204013(0x2a7)]??0x0)>=0x14?a23_0x5e4570[_0x204013(0x1eb)]:a23_0x5e4570[_0x204013(0x1da)];_0x22c92a='\x20'+a23_0x5e4570[_0x204013(0x249)](_0x204013(0x20c))+'\x20'+_0x4d7cb3(formatRows(_0x47d7f1[_0x204013(0x1ef)]))+'\x20('+_0x1e578c+_0x204013(0x1f4)+a23_0x5e4570[_0x204013(0x249)](_0x204013(0x21f))+'\x20'+a23_0x5e4570[_0x204013(0x198)](formatRows(_0x47d7f1[_0x204013(0x287)]));}console[_0x204013(0x1d0)](_0x4f9a8b+'\x20'+a23_0x5e4570[_0x204013(0x18c)](_0x47d7f1[_0x204013(0x239)])+_0x22c92a),console[_0x204013(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x204013(0x249)](_0x204013(0x272))+'\x20'+a23_0x5e4570[_0x204013(0x18c)](_0x47d7f1[_0x204013(0x18e)]+'.'+_0x47d7f1['table']));const _0xdd5777=_0x47d7f1[_0x204013(0x201)]===_0x47d7f1[_0x204013(0x288)]?a23_0x5e4570[_0x204013(0x249)](_0x204013(0x23e))+'\x20'+_0x47d7f1[_0x204013(0x201)]:a23_0x5e4570[_0x204013(0x249)](_0x204013(0x244))+'\x20'+_0x47d7f1[_0x204013(0x201)]+'\x20=\x20'+_0x47d7f1['foreignKey'];console['error']('\x20\x20'+_0xdd5777),console[_0x204013(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x204013(0x249)](_0x204013(0x1ce))),this[_0x204013(0x1c6)](_0x47d7f1[_0x204013(0x250)]),!_0x47d7f1['schemaValid']&&console[_0x204013(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x204013(0x1da)](_0x204013(0x204))+'\x20'+_0x47d7f1[_0x204013(0x29a)]);}}[a23_0x220d5c(0x1c6)](_0x187a51){const _0x3f38f8=a23_0x220d5c;for(const _0x765762 of _0x187a51){_0x765762[_0x3f38f8(0x1c9)]===_0x765762[_0x3f38f8(0x26a)]||_0x765762['column']==='*'?console['error'](_0x3f38f8(0x263)+_0x765762[_0x3f38f8(0x1c9)]):console['error'](_0x3f38f8(0x263)+_0x765762[_0x3f38f8(0x1c9)]+'\x20'+a23_0x5e4570[_0x3f38f8(0x249)]('('+_0x765762[_0x3f38f8(0x26a)]+')'));}}[a23_0x220d5c(0x28c)](_0x2a6f90){const _0x300e59=a23_0x220d5c;console[_0x300e59(0x1d0)]('─'[_0x300e59(0x214)](0x3c));if(_0x2a6f90[_0x300e59(0x183)][_0x300e59(0x1f1)]>0x0){console[_0x300e59(0x1d0)]('\x0a'+a23_0x5e4570['red'](_0x300e59(0x1e2)));for(const _0x41fdbb of _0x2a6f90['errors']){console[_0x300e59(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x300e59(0x1da)]('•')+'\x20'+_0x41fdbb);}}_0x2a6f90[_0x300e59(0x1f9)]&&console[_0x300e59(0x1d0)]('\x0a'+a23_0x5e4570[_0x300e59(0x1af)]('✔')+_0x300e59(0x1ba));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x237);['description']=a23_0x220d5c(0x271);async['execute'](_0x5d1415){const _0x54d191=a23_0x220d5c,{options:_0x33504d,args:_0x4abf86,tdx:_0x7b5488}=_0x5d1415,_0x24c78a=_0x33504d,_0x5a835c=_0x4abf86[0x0]||_0x33504d[_0x54d191(0x222)];if(!_0x5a835c)return showParentSegmentNotSetError(_0x54d191(0x22e)+_0x54d191(0x206)+_0x54d191(0x215)+_0x54d191(0x1d5)+_0x54d191(0x256)+_0x54d191(0x191)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x54d191(0x18d)),0x1;if(!_0x24c78a[_0x54d191(0x228)]&&!_0x24c78a[_0x54d191(0x1c8)]&&!_0x24c78a['behavior']&&!_0x24c78a[_0x54d191(0x18a)])return console[_0x54d191(0x1d0)](a23_0x5e4570['red'](_0x54d191(0x294))),console[_0x54d191(0x1d0)](_0x54d191(0x1e4)),console[_0x54d191(0x1d0)](_0x54d191(0x24d)),console['error'](_0x54d191(0x1dd)),console[_0x54d191(0x1d0)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x54d191(0x1d0)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x54d191(0x1d0)](_0x54d191(0x1ac)),0x1;const _0x3f9340=resolveYamlFile(_0x5a835c);if(!existsSync(_0x3f9340))return showFileNotFoundError(_0x3f9340,_0x5a835c),0x1;_0x24c78a[_0x54d191(0x1a1)]&&(console[_0x54d191(0x1d0)](_0x54d191(0x189)+_0x24c78a[_0x54d191(0x1ec)]),console[_0x54d191(0x1d0)](_0x54d191(0x2a6)+_0x3f9340));let _0x30d542;try{_0x30d542=readFileSync(_0x3f9340,_0x54d191(0x208));}catch(_0x2129ac){const _0x5e8f85=_0x2129ac instanceof Error?_0x2129ac[_0x54d191(0x254)]:String(_0x2129ac);return console[_0x54d191(0x1d0)](_0x54d191(0x19e)+_0x5e8f85),0x1;}let _0x4b2b70;try{_0x4b2b70=parseDef(_0x30d542);}catch(_0x16fdec){const _0x150aca=_0x16fdec instanceof Error?_0x16fdec['message']:String(_0x16fdec);return console['error'](a23_0x5e4570[_0x54d191(0x1da)](_0x54d191(0x29f)+_0x150aca)),0x1;}if(_0x24c78a[_0x54d191(0x1c8)]===!![]||_0x24c78a[_0x54d191(0x1c8)]===''){const _0x852ded=_0x4b2b70[_0x54d191(0x299)]?.[_0x54d191(0x223)](_0x3a5855=>_0x3a5855['name'])||[];if(_0x852ded[_0x54d191(0x1f1)]===0x0)console['error'](a23_0x5e4570[_0x54d191(0x1da)](_0x54d191(0x1d6)));else{console[_0x54d191(0x1d0)](a23_0x5e4570[_0x54d191(0x1da)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x54d191(0x19b));for(const _0x4e43ed of _0x852ded){console['error']('\x20\x20'+a23_0x5e4570[_0x54d191(0x198)](_0x4e43ed));}console[_0x54d191(0x1d0)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5a835c+_0x54d191(0x22b)+_0x852ded[0x0]+'\x22');}return 0x1;}if(_0x24c78a['behavior']===!![]||_0x24c78a[_0x54d191(0x1b2)]===''){const _0x14b294=_0x4b2b70[_0x54d191(0x1fa)]?.[_0x54d191(0x223)](_0x820803=>_0x820803['name'])||[];if(_0x14b294[_0x54d191(0x1f1)]===0x0)console[_0x54d191(0x1d0)](a23_0x5e4570[_0x54d191(0x1da)](_0x54d191(0x1c2)));else{console[_0x54d191(0x1d0)](a23_0x5e4570[_0x54d191(0x1da)](_0x54d191(0x257))),console[_0x54d191(0x1d0)](_0x54d191(0x1a2));for(const _0x18b4cc of _0x14b294){console['error']('\x20\x20'+a23_0x5e4570['cyan'](_0x18b4cc));}console[_0x54d191(0x1d0)](_0x54d191(0x187)+_0x5a835c+_0x54d191(0x1e7)+_0x14b294[0x0]+'\x22');}return 0x1;}const _0x1be7b6=createCommandSpinner(a23_0x5e4570[_0x54d191(0x249)]('Fetching\x20sample\x20data...'),{'verbose':_0x24c78a[_0x54d191(0x1a1)]});_0x1be7b6[_0x54d191(0x21b)]();const _0x2aa16c={'onProgress':_0x228800=>{const _0x4942a4=_0x54d191;_0x1be7b6[_0x4942a4(0x1e9)]=formatProgressMessage(_0x228800);}};if(_0x24c78a[_0x54d191(0x228)])_0x2aa16c[_0x54d191(0x228)]=!![];if(_0x24c78a[_0x54d191(0x1c8)]&&typeof _0x24c78a[_0x54d191(0x1c8)]===_0x54d191(0x20e))_0x2aa16c[_0x54d191(0x1c8)]=_0x24c78a[_0x54d191(0x1c8)];if(_0x24c78a[_0x54d191(0x1b2)]&&typeof _0x24c78a[_0x54d191(0x1b2)]==='string')_0x2aa16c[_0x54d191(0x1b2)]=_0x24c78a[_0x54d191(0x1b2)];if(_0x24c78a[_0x54d191(0x18a)])_0x2aa16c[_0x54d191(0x18a)]=!![];if(_0x24c78a['interval'])_0x2aa16c[_0x54d191(0x1d8)]=_0x24c78a['interval'];let _0x47892e;try{_0x47892e=await _0x7b5488[_0x54d191(0x19c)][_0x54d191(0x26c)](_0x30d542,_0x2aa16c),_0x1be7b6[_0x54d191(0x26e)]();}catch(_0x490ccf){_0x1be7b6['stop']();throw _0x490ccf;}return await this[_0x54d191(0x247)](_0x47892e,{'master':_0x24c78a[_0x54d191(0x228)],'attribute':typeof _0x24c78a[_0x54d191(0x1c8)]===_0x54d191(0x20e)?_0x24c78a['attribute']:undefined,'behavior':typeof _0x24c78a[_0x54d191(0x1b2)]===_0x54d191(0x20e)?_0x24c78a[_0x54d191(0x1b2)]:undefined,'enriched':_0x24c78a['enriched']}),_0x47892e[_0x54d191(0x1f9)]?0x0:0x1;}async[a23_0x220d5c(0x247)](_0x2dd502,_0x13891a){const _0x4edf08=a23_0x220d5c;console[_0x4edf08(0x1d0)]('\x0a'+a23_0x5e4570[_0x4edf08(0x18c)](_0x4edf08(0x291))+'\x20'+_0x2dd502['name']),console['error']('═'['repeat'](0x3c));if(_0x13891a['master']&&_0x2dd502[_0x4edf08(0x2a1)]){const _0x144584=a23_0x5e4570[_0x4edf08(0x249)](_0x4edf08(0x2a5))+'\x20'+a23_0x5e4570[_0x4edf08(0x18c)](_0x2dd502[_0x4edf08(0x228)]['database']+'.'+_0x2dd502['master'][_0x4edf08(0x193)]);await this['displaySampleData'](_0x144584,_0x2dd502[_0x4edf08(0x2a1)]);}else{if(_0x13891a['attribute']&&_0x2dd502['sampleData']){const _0x48d5e8=a23_0x5e4570[_0x4edf08(0x249)]('Attribute:')+'\x20'+a23_0x5e4570[_0x4edf08(0x18c)](_0x13891a[_0x4edf08(0x1c8)]);await this[_0x4edf08(0x24f)](_0x48d5e8,_0x2dd502[_0x4edf08(0x2a1)]);}else{if(_0x13891a[_0x4edf08(0x1b2)]&&_0x2dd502['sampleData']){const _0x1d789a=a23_0x5e4570['dim']('Behavior:')+'\x20'+a23_0x5e4570[_0x4edf08(0x18c)](_0x13891a[_0x4edf08(0x1b2)]);await this['displaySampleData'](_0x1d789a,_0x2dd502[_0x4edf08(0x2a1)]);}else{if(_0x13891a[_0x4edf08(0x18a)]&&_0x2dd502[_0x4edf08(0x2a1)]){const _0xb147a3=a23_0x5e4570['dim']('Enriched:')+'\x20'+a23_0x5e4570[_0x4edf08(0x18c)](_0x4edf08(0x1bc));await this[_0x4edf08(0x24f)](_0xb147a3,_0x2dd502[_0x4edf08(0x2a1)]);}else!_0x2dd502[_0x4edf08(0x2a1)]&&console[_0x4edf08(0x1d0)](_0x4edf08(0x205));}}}if(_0x2dd502[_0x4edf08(0x183)]['length']>0x0){console[_0x4edf08(0x1d0)]('─'[_0x4edf08(0x214)](0x3c)),console[_0x4edf08(0x1d0)]('\x0a'+a23_0x5e4570['red']('Errors:'));for(const _0x486406 of _0x2dd502['errors']){console[_0x4edf08(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x4edf08(0x1da)]('•')+'\x20'+_0x486406);}}}async[a23_0x220d5c(0x24f)](_0x1ffd4c,_0x4d1929){const _0x296f0b=a23_0x220d5c;if(_0x4d1929['length']===0x0){console[_0x296f0b(0x1d0)]('\x0a'+_0x1ffd4c),console[_0x296f0b(0x1d0)](_0x296f0b(0x29e));return;}console['error']('\x0a'+_0x1ffd4c);const _0x20374d=Object[_0x296f0b(0x20a)](_0x4d1929[0x0])[_0x296f0b(0x223)](_0x34b739=>({'name':_0x34b739,'type':typeof _0x4d1929[0x0][_0x34b739]==='number'?_0x296f0b(0x27f):_0x296f0b(0x1a5)})),_0x5352a9={'queryId':'preview','columns':_0x20374d,'data':_0x4d1929,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4d1929[_0x296f0b(0x1f1)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4d8ff5=formatAsTable(_0x5352a9,_0x4d1929[_0x296f0b(0x1f1)],!![]);await writeOutput(_0x4d8ff5,undefined,_0x296f0b(0x193));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x25e);[a23_0x220d5c(0x270)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a23_0x220d5c(0x23b)](_0x3e5e4f){const _0x367784=a23_0x220d5c,{options:_0x5ddf82,args:_0x2cd8a9,tdx:_0x2dec62}=_0x3e5e4f,_0x52832c=_0x5ddf82,_0x2b3ed3=_0x2cd8a9[0x0]||_0x5ddf82['parentSegment'];if(!_0x2b3ed3)return showParentSegmentNotSetError(_0x367784(0x200)+_0x367784(0x212)),0x1;const _0x3a296f=resolveYamlFile(_0x2b3ed3);if(existsSync(_0x3a296f)){_0x52832c[_0x367784(0x1a1)]&&console['error']('Found\x20YAML\x20file:\x20'+_0x3a296f);let _0x285b0f;try{_0x285b0f=readFileSync(_0x3a296f,_0x367784(0x208));}catch(_0x42a826){const _0x18d1de=_0x42a826 instanceof Error?_0x42a826[_0x367784(0x254)]:String(_0x42a826);return console[_0x367784(0x1d0)](_0x367784(0x19e)+_0x18d1de),0x1;}const _0xe1b3da=await withSpinner(_0x367784(0x1d3),()=>_0x2dec62[_0x367784(0x19c)]['pushParentYaml'](_0x285b0f),{'verbose':_0x52832c[_0x367784(0x1a1)]}),_0x160cb3=_0xe1b3da['data'],{isNew:_0x8b33d0,name:_0x34132c,hasChanges:_0x33bdd5,diffFormatted:_0x581cd9}=_0x160cb3;if(_0x33bdd5){_0x8b33d0?console[_0x367784(0x1d0)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x34132c+'\x27:'):console[_0x367784(0x1d0)](_0x367784(0x216)+_0x34132c+'\x27:');console[_0x367784(0x1d0)]('─'[_0x367784(0x214)](0x3c)),console[_0x367784(0x1d0)](_0x581cd9),console[_0x367784(0x1d0)]('─'[_0x367784(0x214)](0x3c));const _0x169468=_0x8b33d0?'Create\x20parent\x20segment\x20\x27'+_0x34132c+'\x27\x20and\x20run\x20workflow?':_0x367784(0x202)+_0x34132c+_0x367784(0x267);if(!_0x52832c['yes']){if(!isInteractive())return console[_0x367784(0x1d0)](a23_0x5e4570['red']('\x0aError:'),_0x367784(0x1ff)),console[_0x367784(0x1d0)](a23_0x5e4570['dim'](_0x367784(0x28e))),0x1;const _0x47f85c=await confirmKey(_0x169468);if(!_0x47f85c)return console[_0x367784(0x1d0)](a23_0x5e4570[_0x367784(0x1eb)](_0x367784(0x199))),0x1;}const _0xcabf8d=_0x8b33d0?_0x367784(0x1e1):_0x367784(0x194);await withSpinner(_0xcabf8d+_0x367784(0x297)+_0x34132c+'\x27...',()=>_0x160cb3[_0x367784(0x251)](),{'verbose':_0x52832c[_0x367784(0x1a1)]});const _0x423a4e=_0x8b33d0?_0x367784(0x217):_0x367784(0x269);console[_0x367784(0x1d0)]('✔\x20'+_0x423a4e+_0x367784(0x297)+_0x34132c+'\x27');}else console[_0x367784(0x1d0)](_0x367784(0x1e8)+_0x34132c+'\x27\x20is\x20up\x20to\x20date');}const _0x1be40b=await withSpinner(_0x367784(0x241)+_0x2b3ed3+'\x27...',()=>_0x2dec62[_0x367784(0x19c)]['runParent'](_0x2b3ed3),{'verbose':_0x52832c['verbose']}),_0x3bb422=_0x1be40b[_0x367784(0x23c)],_0x5c5526=getConsoleUrl(_0x52832c[_0x367784(0x1ec)],_0x367784(0x1e6)+_0x3bb422[_0x367784(0x1d2)]+'/sessions/'+_0x3bb422[_0x367784(0x232)]+_0x367784(0x22d)+_0x3bb422[_0x367784(0x231)]);return console[_0x367784(0x1d0)](_0x367784(0x1f2)),console['error']('\x20\x20'+a23_0x5e4570[_0x367784(0x249)](_0x367784(0x207))+'\x20'+_0x3bb422[_0x367784(0x2a3)]),console[_0x367784(0x1d0)]('\x20\x20'+a23_0x5e4570[_0x367784(0x249)]('Status:')+'\x20'+_0x3bb422['status']),console[_0x367784(0x1d0)]('\x20\x20'+a23_0x5e4570['dim'](_0x367784(0x1fb))+'\x20'+_0x3bb422['workflowSessionId']),console[_0x367784(0x1d0)]('\x20\x20'+a23_0x5e4570['dim'](_0x367784(0x1b0))+'\x20'+_0x3bb422['workflowAttemptId']),console[_0x367784(0x1d0)]('\x20\x20'+_0x5c5526),console[_0x367784(0x1d0)]('\x0a'+a23_0x5e4570[_0x367784(0x249)](_0x367784(0x1cb))+_0x367784(0x293)+_0x3bb422[_0x367784(0x231)]+_0x367784(0x186)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x23a);[a23_0x220d5c(0x270)]='List\x20available\x20fields\x20for\x20segmentation';async[a23_0x220d5c(0x23b)](_0x1672e5){const _0x4bc0bb=a23_0x220d5c,{options:_0x354b03,args:_0x984d58,tdx:_0x4d6879}=_0x1672e5,_0xb35712=_0x984d58[0x0]||_0x354b03['parentSegment'];if(!_0xb35712)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x354b03[_0x4bc0bb(0x1a1)]&&(console[_0x4bc0bb(0x1d0)](_0x4bc0bb(0x189)+_0x354b03[_0x4bc0bb(0x1ec)]),console['error'](_0x4bc0bb(0x182)+_0xb35712));const _0x1754cc=await withSpinner(_0x4bc0bb(0x1b5)+_0xb35712+_0x4bc0bb(0x238),()=>_0x4d6879['segment']['listFields'](_0xb35712),{'verbose':_0x354b03[_0x4bc0bb(0x1a1)]}),_0x38c1e8=_0x1754cc[_0x4bc0bb(0x23c)];console[_0x4bc0bb(0x1d0)](_0x4bc0bb(0x185)+_0x38c1e8[_0x4bc0bb(0x1f1)]+_0x4bc0bb(0x1bb)+(_0x38c1e8[_0x4bc0bb(0x1f1)]!==0x1?'s':''));if(_0x354b03[_0x4bc0bb(0x220)]||_0x354b03[_0x4bc0bb(0x1cd)])return await handleSDKOutput(_0x38c1e8,_0x354b03),0x0;return displayFieldsHumanReadable(_0x38c1e8,_0xb35712),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x2aa);[a23_0x220d5c(0x270)]=a23_0x220d5c(0x195);async[a23_0x220d5c(0x23b)](_0x2c8e46){const _0x135d50=a23_0x220d5c,{options:_0x2b64b8,args:_0x3657c4,tdx:_0x46f0f1}=_0x2c8e46,_0x3cd62d=_0x2b64b8,_0xd605da=_0x3657c4[0x0]||_0x2b64b8['parentSegment'];if(!_0xd605da)return showParentSegmentNotSetError(_0x135d50(0x248)+_0x135d50(0x1b9)+'Options:\x0a'+_0x135d50(0x274)),0x1;_0x2b64b8[_0x135d50(0x1a1)]&&(console[_0x135d50(0x1d0)](_0x135d50(0x189)+_0x2b64b8[_0x135d50(0x1ec)]),console[_0x135d50(0x1d0)](_0x135d50(0x182)+_0xd605da));const _0x5d49c9=await withSpinner(_0x135d50(0x25c)+_0xd605da+'\x27...',()=>_0x46f0f1['segment'][_0x135d50(0x1a0)](_0xd605da),{'verbose':_0x2b64b8[_0x135d50(0x1a1)]}),_0x26e76a=_0x5d49c9[_0x135d50(0x23c)];if(_0x3cd62d[_0x135d50(0x1f7)]){const _0x5be4d9=getConsoleNextUrl(_0x3cd62d[_0x135d50(0x1ec)],'/app/dw/parentSegments/'+_0x26e76a['id']);return console[_0x135d50(0x1d0)](a23_0x5e4570[_0x135d50(0x1af)]('✔')+_0x135d50(0x1ab)+a23_0x5e4570[_0x135d50(0x198)](_0x5be4d9)),openBrowser(_0x5be4d9),0x0;}return await handleSingleObjectOutput(_0x26e76a,_0x2b64b8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x19f);['description']=a23_0x220d5c(0x21a);async[a23_0x220d5c(0x23b)](_0x56ada1){const _0x4c0188=a23_0x220d5c,{options:_0x4bd107,args:_0x23077d,tdx:_0x378222}=_0x56ada1,_0x4a169d=_0x23077d[0x0]||_0x4bd107[_0x4c0188(0x222)];if(!_0x4a169d)return showParentSegmentNotSetError(_0x4c0188(0x235)+_0x4c0188(0x27e)),0x1;_0x4bd107[_0x4c0188(0x1a1)]&&(console[_0x4c0188(0x1d0)](_0x4c0188(0x189)+_0x4bd107[_0x4c0188(0x1ec)]),console[_0x4c0188(0x1d0)](_0x4c0188(0x182)+_0x4a169d));const _0xb03195=await withSpinner(_0x4c0188(0x1f5)+_0x4a169d+_0x4c0188(0x238),()=>_0x378222[_0x4c0188(0x19c)][_0x4c0188(0x1a9)](_0x4a169d),{'verbose':_0x4bd107[_0x4c0188(0x1a1)]}),_0x519862=_0xb03195[_0x4c0188(0x23c)],_0x4006a4=await withSpinner(_0x4c0188(0x286)+_0x4a169d+_0x4c0188(0x238),()=>_0x378222[_0x4c0188(0x19c)][_0x4c0188(0x282)](_0x519862),{'verbose':_0x4bd107[_0x4c0188(0x1a1)]}),_0x45b608=await executeSchemaQuery(_0x4006a4[_0x4c0188(0x23c)],_0x378222,_0x4bd107);return await handleQueryOutput(_0x45b608,_0x4bd107),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0x220d5c(0x2a4);[a23_0x220d5c(0x270)]=a23_0x220d5c(0x26d);async['execute'](_0x1417c4){const _0x159c1f=a23_0x220d5c,{options:_0x42fdda,args:_0x30ff1c,tdx:_0x5c90aa}=_0x1417c4,_0x2c94b1=_0x30ff1c[0x0]||_0x42fdda[_0x159c1f(0x222)];if(!_0x2c94b1)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x159c1f(0x1dc)),0x1;_0x42fdda['verbose']&&(console[_0x159c1f(0x1d0)](_0x159c1f(0x189)+_0x42fdda[_0x159c1f(0x1ec)]),console[_0x159c1f(0x1d0)]('Parent\x20segment:\x20'+_0x2c94b1));const _0x37c96b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2c94b1+'\x27...',()=>_0x5c90aa[_0x159c1f(0x19c)]['resolveParentId'](_0x2c94b1),{'verbose':_0x42fdda[_0x159c1f(0x1a1)]}),_0x113fff=_0x37c96b[_0x159c1f(0x23c)],_0x103fc6=await withSpinner(_0x159c1f(0x286)+_0x2c94b1+_0x159c1f(0x238),()=>_0x5c90aa['segment'][_0x159c1f(0x282)](_0x113fff),{'verbose':_0x42fdda[_0x159c1f(0x1a1)]}),_0x56f517=_0x103fc6[_0x159c1f(0x23c)];return _0x42fdda[_0x159c1f(0x190)]===_0x159c1f(0x220)||_0x42fdda[_0x159c1f(0x190)]===_0x159c1f(0x1cd)?await handleSDKOutput([{'sql':_0x56f517}],_0x42fdda):console[_0x159c1f(0x262)](_0x56f517),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x220d5c(0x239)]=a23_0x220d5c(0x1a6);[a23_0x220d5c(0x270)]=a23_0x220d5c(0x181);async[a23_0x220d5c(0x23b)](_0x5d66c3){const _0x4ba79c=a23_0x220d5c,{options:_0x29a843,args:_0x88e98c,tdx:_0x5e7484}=_0x5d66c3,_0x16698e=_0x88e98c[0x0]||_0x29a843[_0x4ba79c(0x222)];if(!_0x16698e)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x4ba79c(0x265)),0x1;_0x29a843[_0x4ba79c(0x1a1)]&&(console[_0x4ba79c(0x1d0)](_0x4ba79c(0x189)+_0x29a843[_0x4ba79c(0x1ec)]),console[_0x4ba79c(0x1d0)](_0x4ba79c(0x182)+_0x16698e));const _0x2dcbfb=await withSpinner(_0x4ba79c(0x1f5)+_0x16698e+_0x4ba79c(0x238),()=>_0x5e7484[_0x4ba79c(0x19c)][_0x4ba79c(0x1a9)](_0x16698e),{'verbose':_0x29a843[_0x4ba79c(0x1a1)]}),_0x2ffe7b=_0x2dcbfb[_0x4ba79c(0x23c)],_0xe5d27c=await withSpinner(_0x4ba79c(0x286)+_0x16698e+_0x4ba79c(0x238),()=>_0x5e7484[_0x4ba79c(0x19c)][_0x4ba79c(0x282)](_0x2ffe7b),{'verbose':_0x29a843[_0x4ba79c(0x1a1)]});let _0x4cd258=_0xe5d27c[_0x4ba79c(0x23c)];const _0x97d94f=resolveLimit(_0x29a843['limit'],DEFAULT_DISPLAY_LIMIT),_0x31c638=/\bLIMIT\s+\d+/i[_0x4ba79c(0x1b3)](_0x4cd258);!_0x31c638&&(_0x4cd258=_0x4cd258[_0x4ba79c(0x24a)]()['replace'](/;+$/,''),_0x4cd258=_0x4ba79c(0x1b1)+_0x4cd258+_0x4ba79c(0x295)+_0x97d94f);_0x29a843[_0x4ba79c(0x1a1)]&&console['error'](_0x4ba79c(0x24b)+_0x4cd258);const _0x377b2a=await withProgressSpinner(_0x4ba79c(0x1c3),async _0x500173=>{const _0x30ed06=_0x4ba79c,_0x399ad4=await _0x5e7484[_0x30ed06(0x276)]['execute'](_0x4cd258,{'catalog':'td','schema':_0x30ed06(0x1cc),'onJobId':_0x7805a5=>{const _0x1fc16f=_0x30ed06;_0x500173[_0x1fc16f(0x28f)](_0x7805a5);}});return _0x399ad4;},{'verbose':_0x29a843[_0x4ba79c(0x1a1)]}),_0x14dc46=_0x377b2a['data'],_0x9f160d=_0x14dc46[_0x4ba79c(0x197)]?'\x20[Job\x20ID:\x20'+_0x14dc46[_0x4ba79c(0x197)]+']':'';return console[_0x4ba79c(0x1d0)](_0x4ba79c(0x18b)+_0x14dc46['stats'][_0x4ba79c(0x23d)][_0x4ba79c(0x1ea)]()+_0x4ba79c(0x1f3)+(_0x4ba79c(0x252)+formatElapsed(_0x14dc46[_0x4ba79c(0x1a8)][_0x4ba79c(0x243)])+_0x9f160d)),await handleQueryOutput(_0x14dc46,_0x29a843),0x0;}}
|
|
1
|
+
const a23_0x265e8e=a23_0x594a;(function(_0x503360,_0x53c224){const _0x413425=a23_0x594a,_0x293e41=_0x503360();while(!![]){try{const _0x1236b4=parseInt(_0x413425(0x29c))/0x1+parseInt(_0x413425(0x2bd))/0x2+-parseInt(_0x413425(0x283))/0x3+parseInt(_0x413425(0x208))/0x4+parseInt(_0x413425(0x2a1))/0x5*(-parseInt(_0x413425(0x295))/0x6)+parseInt(_0x413425(0x2e7))/0x7*(parseInt(_0x413425(0x218))/0x8)+-parseInt(_0x413425(0x2e5))/0x9;if(_0x1236b4===_0x53c224)break;else _0x293e41['push'](_0x293e41['shift']());}catch(_0x279f4d){_0x293e41['push'](_0x293e41['shift']());}}}(a23_0x37c0,0x8dc4e));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0xaee0c2 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x26e9fc from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x265e8e(0x2c1),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x4e6578){const _0x3c713e=a23_0x265e8e,_0x5e0b25=process[_0x3c713e(0x200)],_0x4fa0ae=_0x5e0b25===_0x3c713e(0x20d)?_0x3c713e(0x28c):_0x5e0b25===_0x3c713e(0x258)?'start':'xdg-open';spawn(_0x4fa0ae,[_0x4e6578],{'detached':!![],'stdio':'ignore'})[_0x3c713e(0x1e7)]();}function migrateLegacyDirectory(){const _0x46ae26=a23_0x265e8e;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x11ceb5=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x11ceb5[_0x46ae26(0x2a4)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x46ae26(0x2bc)](a23_0x26e9fc[_0x46ae26(0x2f5)](_0x46ae26(0x2e2)+LEGACY_PARENT_SEGMENT_DIR+_0x46ae26(0x226)+PARENT_SEGMENT_DIR+_0x46ae26(0x2f9))),console[_0x46ae26(0x2bc)](a23_0x26e9fc[_0x46ae26(0x27a)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a23_0x26e9fc[_0x46ae26(0x2f5)](_0x46ae26(0x264)+LEGACY_PARENT_SEGMENT_DIR+_0x46ae26(0x274)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x26e9fc[_0x46ae26(0x22d)](_0x46ae26(0x1f5)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4dab26){const _0x4c3624=_0x4dab26 instanceof Error?_0x4dab26[_0x46ae26(0x1fc)]:String(_0x4dab26);return console['error'](a23_0x26e9fc[_0x46ae26(0x2d1)](_0x46ae26(0x1da)+_0x4c3624+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x265e8e(0x228)](_0x220dc6){const _0xd0a321=a23_0x265e8e;return migrateLegacyDirectory(),super[_0xd0a321(0x228)](_0x220dc6);}}function resolveYamlFile(_0x387670){const _0x4b5f93=a23_0x265e8e;if(_0x387670[_0x4b5f93(0x1db)](_0x4b5f93(0x1fb))||_0x387670[_0x4b5f93(0x1db)](_0x4b5f93(0x1fe)))return _0x387670;return a23_0xaee0c2['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x387670)+_0x4b5f93(0x1fb));}function formatProgressMessage(_0x24bdca){const _0x454209=a23_0x265e8e,_0x5450a9=_0x24bdca['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5450a9){const [,_0x465c8a,_0x4ec6d6,_0x3a8d29='']=_0x5450a9;return a23_0x26e9fc[_0x454209(0x27a)](_0x465c8a+':')+'\x20'+_0x4ec6d6+a23_0x26e9fc['dim'](_0x3a8d29);}return a23_0x26e9fc[_0x454209(0x27a)](_0x24bdca);}function showFileNotFoundError(_0x3ae154,_0x16f5ab){const _0x376fa7=a23_0x265e8e;console[_0x376fa7(0x2bc)](a23_0x26e9fc[_0x376fa7(0x2d1)](_0x376fa7(0x219)+_0x3ae154+'\x0a')),console[_0x376fa7(0x2bc)](a23_0x26e9fc[_0x376fa7(0x238)](_0x376fa7(0x20e)+_0x16f5ab+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0xafc0a1){const _0x9dbcea=a23_0x265e8e;console['error'](a23_0x26e9fc['yellow'](_0x9dbcea(0x243))),console[_0x9dbcea(0x2bc)](_0xafc0a1);}export class ParentSegmentListCommand extends BaseCommand{['name']=a23_0x265e8e(0x2b6);['description']=a23_0x265e8e(0x250);async[a23_0x265e8e(0x1fa)](_0x10be94){const _0x2b1dd6=a23_0x265e8e,{options:_0x2a55eb,args:_0x26656b,tdx:_0x4cb7e2}=_0x10be94,_0x5068aa=_0x26656b[0x0];_0x2a55eb[_0x2b1dd6(0x29e)]&&(console[_0x2b1dd6(0x2bc)](_0x2b1dd6(0x225)+_0x2a55eb[_0x2b1dd6(0x20f)]),_0x5068aa&&console['error'](_0x2b1dd6(0x212)+_0x5068aa));const _0x1b78e4=await withSpinner(_0x5068aa?_0x2b1dd6(0x2af)+_0x5068aa+_0x2b1dd6(0x2be):_0x2b1dd6(0x23e),()=>_0x4cb7e2[_0x2b1dd6(0x2c5)][_0x2b1dd6(0x2d6)](),{'verbose':_0x2a55eb[_0x2b1dd6(0x29e)]});let _0x31be40=_0x1b78e4['data'];if(_0x5068aa){const _0x52625f=_0x5068aa[_0x2b1dd6(0x1eb)](/[.+^${}()|[\]\\]/g,_0x2b1dd6(0x22f))[_0x2b1dd6(0x1eb)](/\*/g,'.*')[_0x2b1dd6(0x1eb)](/\?/g,'.'),_0x33994b=new RegExp('^'+_0x52625f+'$','i');_0x31be40=_0x31be40[_0x2b1dd6(0x214)](_0x390033=>_0x33994b[_0x2b1dd6(0x298)](_0x390033[_0x2b1dd6(0x271)]['name']));}_0x31be40[_0x2b1dd6(0x1d6)]((_0x530201,_0xa5f2a9)=>_0x530201[_0x2b1dd6(0x271)][_0x2b1dd6(0x203)][_0x2b1dd6(0x1dc)](_0xa5f2a9['attributes']['name'])),console[_0x2b1dd6(0x2bc)](_0x2b1dd6(0x2c8)+_0x31be40['length']+'\x20parent\x20segment'+(_0x31be40[_0x2b1dd6(0x252)]!==0x1?'s':''));const _0x4649ed=_0x2c72be=>{const _0x27f4c6=_0x2b1dd6;return getConsoleNextUrl(_0x2a55eb[_0x27f4c6(0x20f)],_0x27f4c6(0x24d)+_0x2c72be);};if(_0x2a55eb[_0x2b1dd6(0x26a)]==='json'||_0x2a55eb[_0x2b1dd6(0x26a)]===_0x2b1dd6(0x1d8)){const _0x4952ae=_0x31be40['map'](_0x1ec503=>({..._0x1ec503,'url':_0x4649ed(_0x1ec503['id'])}));await handleSDKOutput(_0x4952ae,_0x2a55eb);}else{if(_0x31be40[_0x2b1dd6(0x252)]===0x0)_0x5068aa?console[_0x2b1dd6(0x1e1)](_0x2b1dd6(0x2b2)+_0x5068aa):console[_0x2b1dd6(0x1e1)](_0x2b1dd6(0x255));else for(const _0x226d0b of _0x31be40){const _0x56ac5e=_0x226d0b[_0x2b1dd6(0x271)][_0x2b1dd6(0x2f6)]?a23_0x26e9fc[_0x2b1dd6(0x27a)]('\x20('+formatRows(_0x226d0b['attributes'][_0x2b1dd6(0x2f6)])+')'):'',_0x5c1cd4=hyperlink(_0x226d0b[_0x2b1dd6(0x271)][_0x2b1dd6(0x203)],_0x4649ed(_0x226d0b['id']));console[_0x2b1dd6(0x1e1)]('👥\x20'+_0x5c1cd4+_0x56ac5e);}}return 0x0;}}function a23_0x37c0(){const _0x5eaf30=['description','-1d','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','jobId','\x20No\x20changes\x20-\x20','Fetching\x20current\x20configuration\x20for\x20\x27','behavior','bold','Attribute:','/app/dw/parentSegments/','joinKey','scheduleType','List\x20parent\x20segments','Table:\x20','length','start','\x0aChanges\x20to\x20\x27','No\x20parent\x20segments\x20found','Create\x20parent\x20segment\x20\x27','dirname','win32','columns','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Executing\x20parent\x20segment\x20query...','addBehaviors','addAttributesFile','displayMasterInfo','Overwrite\x20\x27','Analyzing\x20changes...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayPreviewHints','behaviors','\x0a⚠️\x20\x20Migrating:\x20','audienceId','yes','FINISHED','Coverage:','Master:','format','Attempt:','segment:parent:desc','enriched','trim','errors','\x20rows)','attributes','updateParent','schemaValid','/\x20→\x20','totalEvents','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x0aNo\x20sample\x20data\x20available','dim','foreignKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x0aError:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displayValidateResults','pullParentYaml','3146691MQkPGM','displaySampleData','Behaviors','Join:','customerGroup','displayAttributesStats','\x27\x20with\x20ID:\x20','displayPreviewResults','Validating\x20configuration...','open','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Error:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','number','all','status','List\x20available\x20fields\x20for\x20segmentation','displayColumns','965364hvfYaz','Available\x20behaviors:','\x0aNew\x20parent\x20segment\x20\x27','test','\x20--enriched','Get\x20SQL\x20query\x20for\x20parent\x20segment','workflowId','58160DRvpWg','segment:parent:show','verbose','attributesFile','tdx\x20segment\x20parent\x20preview\x20','10TXwkJh','coveragePercent','repeat','isDirectory','Options:\x0a','/attempt/','parentSegment','displaySummary','parent_segment','segment:parent:update','displayBehaviorsStats','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','workflowAttemptId','Listing\x20parent\x20segments\x20matching\x20\x27','data','web','No\x20parent\x20segments\x20match\x20pattern:\x20','Status:','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Error\x20reading\x20file:\x20','segment:parent:list','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','To\x20view\x20sample\x20data:','string','getParentSQL','Show\x20parent\x20segment\x20schema\x20(column\x20types)','error','1929682HHdLYp','\x27...','Aborted.','attribute','parent_segments','in\x20','Creating','Join\x20on:','segment','Listing\x20fields\x20for\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','✔\x20Found\x20','Name:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Source:','Fetching\x20parent\x20segment\x20\x27','session','createParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Error:\x20--attribute\x20requires\x20a\x20name\x0a','red','Creating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Created','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','listParents','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:pull','setJobId','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20No\x20sample\x20data\x20available','getParentFull','/app/workflows/','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20Both\x20','interval','Session:','8636031iPcxTW','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','63rFQTlf','matchedCount','varchar','timezone','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Found\x20YAML\x20file:\x20','\x20=\x20','\x20field','\x20Configuration\x20is\x20valid','apply','label','YAML\x20file:\x20','resolveParentId','yellow','population','Fetching\x20sample\x20data...','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','/\x20directories\x20exist.','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Database:\x20','Preview:','Master\x20Table','segment:parent:create','stats','Columns:','query','Updating\x20parent\x20segment\x20\x27','sort','/sessions/','jsonl','Updated','✘\x20Failed\x20to\x20rename\x20directory:\x20','endsWith','localeCompare','\x20--behavior\x20\x22','table','scheduleOption','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','log','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','previewParentYaml','customersWithEvents','toFixed','join','unref','Errors:','segment:parent:view','Validate:','replace','SQL\x20query:\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','customerPercent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Behavior:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','✔\x20Renamed\x20directory\x20to\x20','\x27\x20and\x20run\x20workflow?','rowCount','use','Parent\x20segment:\x20','execute','.yml','message','Resolving\x20parent\x20segment\x20\x27','.yaml','output','platform','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','✔\x20No\x20changes\x20-\x20\x27','name','Enriched:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Options\x20(one\x20required):\x0a','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','3975944poKDjJ','utf-8','Customers:','preview','Events:','darwin','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','site','\x20is\x20already\x20up\x20to\x20date','elapsedTimeMillis','Pattern:\x20','schemaError','filter','\x20rows\x20','\x20tdx\x20wf\x20attempt\x20','map','794616GOxXkB','Error:\x20File\x20not\x20found:\x20','\x20--interval\x20','\x20Context\x20set:\x20','json','sampleData','keys','segment:parent:push','pushParentYaml','column','database','Apply\x20changes\x20to\x20\x27','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Site:\x20','/\x20and\x20','master','run','toLocaleString','Show\x20parent\x20segment\x20details','\x0aChanges\x20to\x20apply\x20to\x20\x27','Audience\x20ID:','green','stop','\x5c$&','allValid','\x20parent\x20segment\x20\x27','\x20kill','Error:\x20--database\x20and\x20--table\x20are\x20required','To\x20cancel:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Output\x20file:\x20','Fetching\x20SQL\x20for\x20\x27','cyan','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','information_schema','segment:parent:sql','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Listing\x20parent\x20segments...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20--attribute\x20\x22','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','runParent','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a'];a23_0x37c0=function(){return _0x5eaf30;};return a23_0x37c0();}function a23_0x594a(_0x271964,_0x2532a1){_0x271964=_0x271964-0x1d4;const _0x37c073=a23_0x37c0();let _0x594a34=_0x37c073[_0x271964];return _0x594a34;}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x265e8e(0x203)]=a23_0x265e8e(0x2fe);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x2d7);async['execute'](_0x1a2a79){const _0x54cf83=a23_0x265e8e,{options:_0x47eb36,args:_0x3e1c09,tdx:_0xe3a20}=_0x1a2a79;console[_0x54cf83(0x2bc)](_0x54cf83(0x239)+_0x54cf83(0x2ca)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1c2dc7=_0x47eb36;if(_0x3e1c09[_0x54cf83(0x252)]===0x0)return console[_0x54cf83(0x2bc)](a23_0x26e9fc[_0x54cf83(0x2d1)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x54cf83(0x2bc)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x3bfa3a=_0x3e1c09[0x0];if(!_0x1c2dc7['database']||!_0x1c2dc7['table'])return console[_0x54cf83(0x2bc)](_0x54cf83(0x233)),console[_0x54cf83(0x2bc)](_0x54cf83(0x241)),0x1;_0x1c2dc7[_0x54cf83(0x29e)]&&(console[_0x54cf83(0x2bc)](_0x54cf83(0x225)+_0x1c2dc7[_0x54cf83(0x20f)]),console[_0x54cf83(0x2bc)](_0x54cf83(0x2c9)+_0x3bfa3a),console[_0x54cf83(0x2bc)](_0x54cf83(0x2fb)+_0x1c2dc7[_0x54cf83(0x222)]),console[_0x54cf83(0x2bc)](_0x54cf83(0x251)+_0x1c2dc7[_0x54cf83(0x1de)]));const _0x433229=await loadJSONFromOptions(_0x1c2dc7[_0x54cf83(0x271)],_0x1c2dc7[_0x54cf83(0x29f)]),_0x51d29c=await loadJSONFromOptions(_0x1c2dc7['behaviors'],_0x1c2dc7['behaviorsFile']),_0x3b7a51=await loadJSONFromOptions(_0x1c2dc7[_0x54cf83(0x287)],_0x1c2dc7['customerGroupFile']),_0x1663de={'name':_0x3bfa3a,'description':_0x1c2dc7[_0x54cf83(0x244)],'scheduleType':_0x1c2dc7['scheduleType'],'scheduleOption':_0x1c2dc7[_0x54cf83(0x1df)],'timezone':_0x1c2dc7[_0x54cf83(0x2ea)],'master':{'parentDatabaseName':_0x1c2dc7[_0x54cf83(0x222)],'parentTableName':_0x1c2dc7['table']},'attributes':_0x433229,'behaviors':_0x51d29c,'customerGroup':_0x3b7a51},_0x2cd561=await withSpinner(_0x54cf83(0x2d2)+_0x3bfa3a+_0x54cf83(0x2be),()=>_0xe3a20[_0x54cf83(0x2c5)][_0x54cf83(0x2ce)](_0x1663de),{'verbose':_0x47eb36[_0x54cf83(0x29e)]}),_0x5d04e1=_0x2cd561['data'];return console[_0x54cf83(0x2bc)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x5d04e1['name']+_0x54cf83(0x289)+_0x5d04e1['id']),await handleSDKOutput([_0x5d04e1],_0x47eb36),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0x265e8e(0x2aa);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x2fa);async['execute'](_0x25583e){const _0x4f8bfd=a23_0x265e8e,{options:_0x3c2a9b,args:_0x5e8915,tdx:_0x208808}=_0x25583e;console[_0x4f8bfd(0x2bc)](_0x4f8bfd(0x23f)+_0x4f8bfd(0x2ca)+_0x4f8bfd(0x25a));const _0x170046=_0x3c2a9b;if(_0x5e8915[_0x4f8bfd(0x252)]===0x0)return console[_0x4f8bfd(0x2bc)](a23_0x26e9fc[_0x4f8bfd(0x2d1)](_0x4f8bfd(0x1ef))),console[_0x4f8bfd(0x2bc)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0xd0cd6d=_0x5e8915[0x0];_0x170046['verbose']&&(console['error'](_0x4f8bfd(0x225)+_0x170046[_0x4f8bfd(0x20f)]),console[_0x4f8bfd(0x2bc)]('Parent\x20segment:\x20'+_0xd0cd6d));const _0x4b804a=await withSpinner(_0x4f8bfd(0x249)+_0xd0cd6d+_0x4f8bfd(0x2be),()=>_0x208808[_0x4f8bfd(0x2c5)]['getParentFull'](_0xd0cd6d),{'verbose':_0x170046[_0x4f8bfd(0x29e)]}),_0x1a97f6=_0x4b804a['data'],_0x1585b2=await loadJSONFromOptions(_0x170046['addAttributes'],_0x170046[_0x4f8bfd(0x25d)]),_0x1b2411=await loadJSONFromOptions(_0x170046[_0x4f8bfd(0x25c)],_0x170046['addBehaviorsFile']),_0x260892={'name':_0x1a97f6[_0x4f8bfd(0x203)],'description':_0x170046['description']!==undefined?_0x170046['description']:_0x1a97f6['description'],'scheduleType':_0x170046[_0x4f8bfd(0x24f)]!==undefined?_0x170046['scheduleType']:_0x1a97f6['scheduleType'],'scheduleOption':_0x170046[_0x4f8bfd(0x1df)]!==undefined?_0x170046[_0x4f8bfd(0x1df)]:_0x1a97f6[_0x4f8bfd(0x1df)],'timezone':_0x170046[_0x4f8bfd(0x2ea)]!==undefined?_0x170046[_0x4f8bfd(0x2ea)]:_0x1a97f6[_0x4f8bfd(0x2ea)],'master':_0x1a97f6[_0x4f8bfd(0x227)],'attributes':_0x1585b2?[..._0x1a97f6[_0x4f8bfd(0x271)]||[],..._0x1585b2]:_0x1a97f6[_0x4f8bfd(0x271)],'behaviors':_0x1b2411?[..._0x1a97f6[_0x4f8bfd(0x263)]||[],..._0x1b2411]:_0x1a97f6['behaviors'],'customerGroup':_0x1a97f6[_0x4f8bfd(0x287)]},_0x24fe4d=await withSpinner(_0x4f8bfd(0x1d5)+_0xd0cd6d+_0x4f8bfd(0x2be),()=>_0x208808[_0x4f8bfd(0x2c5)][_0x4f8bfd(0x272)](_0xd0cd6d,_0x260892),{'verbose':_0x170046[_0x4f8bfd(0x29e)]}),_0x1d8933=_0x24fe4d[_0x4f8bfd(0x2b0)];return console['error'](_0x4f8bfd(0x2e1)+_0x1d8933['name']+'\x27'),await handleSDKOutput([_0x1d8933],_0x170046),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x265e8e(0x203)]=a23_0x265e8e(0x2d9);['description']=a23_0x265e8e(0x2eb);async[a23_0x265e8e(0x1fa)](_0x54793b){const _0x219ccf=a23_0x265e8e,{options:_0x504bc0,args:_0x5ae5c8,tdx:_0x263ceb}=_0x54793b,_0x134fce=_0x504bc0,_0x148465=_0x5ae5c8[0x0]||_0x504bc0[_0x219ccf(0x2a7)];if(!_0x148465)return showParentSegmentNotSetError(_0x219ccf(0x27d)+_0x219ccf(0x2ad)),0x1;if(_0x134fce[_0x219ccf(0x1f8)]&&_0x134fce[_0x219ccf(0x1ff)])return console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x2d1)](_0x219ccf(0x2d5))),console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x27a)](_0x219ccf(0x277))),console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x27a)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x219ccf(0x2bc)](a23_0x26e9fc['cyan'](_0x219ccf(0x27e))),0x1;const _0x29cc8a=_0x134fce[_0x219ccf(0x1ff)]||a23_0xaee0c2[_0x219ccf(0x1e6)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x148465)+_0x219ccf(0x1fb));_0x134fce[_0x219ccf(0x29e)]&&(console[_0x219ccf(0x2bc)]('Site:\x20'+_0x134fce[_0x219ccf(0x20f)]),console['error']('Parent\x20segment:\x20'+_0x148465),console[_0x219ccf(0x2bc)](_0x219ccf(0x236)+_0x29cc8a));const _0x353c5d=await withSpinner(_0x219ccf(0x2cc)+_0x148465+_0x219ccf(0x2be),()=>_0x263ceb[_0x219ccf(0x2c5)][_0x219ccf(0x282)](_0x148465),{'verbose':_0x134fce[_0x219ccf(0x29e)]}),_0x2b0ad3=_0x353c5d[_0x219ccf(0x2b0)];if(existsSync(_0x29cc8a)){const _0x31b0da=readFileSync(_0x29cc8a,_0x219ccf(0x209)),_0x33a8db=generateDiff(_0x31b0da,_0x2b0ad3);if(!hasChanges(_0x33a8db))console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x22d)]('✔')+_0x219ccf(0x248)+a23_0x26e9fc[_0x219ccf(0x238)](_0x29cc8a)+_0x219ccf(0x210));else{console[_0x219ccf(0x2bc)](_0x219ccf(0x254)+_0x29cc8a+'\x27:'),console[_0x219ccf(0x2bc)]('─'[_0x219ccf(0x2a3)](0x3c)),console[_0x219ccf(0x2bc)](formatDiffWithColors(_0x33a8db)),console['error']('─'[_0x219ccf(0x2a3)](0x3c));if(!_0x134fce['yes']){if(!isInteractive())return console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x2d1)](_0x219ccf(0x27f)),_0x219ccf(0x2c7)),console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x27a)](_0x219ccf(0x205))),0x1;const _0x35bfca=await confirmKey(_0x219ccf(0x25f)+_0x29cc8a+'\x27?');if(!_0x35bfca)return console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x2f5)](_0x219ccf(0x2bf))),0x1;}writeFileSync(_0x29cc8a,_0x2b0ad3,_0x219ccf(0x209)),console[_0x219ccf(0x2bc)](a23_0x26e9fc['green']('✔')+_0x219ccf(0x276)+a23_0x26e9fc[_0x219ccf(0x238)](_0x29cc8a));}}else{const _0xef22e4=a23_0xaee0c2[_0x219ccf(0x257)](_0x29cc8a);!existsSync(_0xef22e4)&&mkdirSync(_0xef22e4,{'recursive':!![]}),writeFileSync(_0x29cc8a,_0x2b0ad3,_0x219ccf(0x209)),console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x22d)]('✔')+_0x219ccf(0x276)+a23_0x26e9fc[_0x219ccf(0x238)](_0x29cc8a));}return saveSessionContext({'parent_segment':_0x148465},_0x134fce[_0x219ccf(0x2cd)]),console[_0x219ccf(0x2bc)](a23_0x26e9fc[_0x219ccf(0x22d)]('✔')+_0x219ccf(0x21b)+a23_0x26e9fc[_0x219ccf(0x27a)](_0x219ccf(0x2a9))+'\x20=\x20'+a23_0x26e9fc['cyan'](_0x148465)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x265e8e(0x203)]=a23_0x265e8e(0x21f);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x1e0);async[a23_0x265e8e(0x1fa)](_0x40bae0){const _0x590af3=a23_0x265e8e,{options:_0x18f1f5,args:_0x446e2f,tdx:_0x4541e5}=_0x40bae0,_0x18ab97=_0x18f1f5,_0x413840=_0x446e2f[0x0]||_0x18f1f5[_0x590af3(0x2a7)];if(!_0x413840)return showParentSegmentNotSetError(_0x590af3(0x2db)+_0x590af3(0x261)),0x1;const _0x4831cf=resolveYamlFile(_0x413840);if(!existsSync(_0x4831cf))return showFileNotFoundError(_0x4831cf,_0x413840),0x1;_0x18ab97[_0x590af3(0x29e)]&&(console[_0x590af3(0x2bc)](_0x590af3(0x225)+_0x18ab97[_0x590af3(0x20f)]),console[_0x590af3(0x2bc)](_0x590af3(0x2f3)+_0x4831cf));let _0x1ee45d;try{_0x1ee45d=readFileSync(_0x4831cf,_0x590af3(0x209));}catch(_0x2f03e4){const _0x5690eb=_0x2f03e4 instanceof Error?_0x2f03e4['message']:String(_0x2f03e4);return console[_0x590af3(0x2bc)]('Error\x20reading\x20file:\x20'+_0x5690eb),0x1;}const _0x1ca272=await withSpinner('Analyzing\x20changes...',()=>_0x4541e5[_0x590af3(0x2c5)]['pushParentYaml'](_0x1ee45d),{'verbose':_0x18ab97[_0x590af3(0x29e)]}),_0x4323e8=_0x1ca272['data'],{isNew:_0x52c068,name:_0x5afbfd,hasChanges:_0x5cce87,diffFormatted:_0x36881e}=_0x4323e8;if(!_0x5cce87)return console[_0x590af3(0x2bc)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5afbfd+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x52c068?console[_0x590af3(0x2bc)](_0x590af3(0x297)+_0x5afbfd+'\x27:'):console[_0x590af3(0x2bc)](_0x590af3(0x22b)+_0x5afbfd+'\x27:');console[_0x590af3(0x2bc)]('─'[_0x590af3(0x2a3)](0x3c)),console[_0x590af3(0x2bc)](_0x36881e),console[_0x590af3(0x2bc)]('─'['repeat'](0x3c));const _0x1b4e33=_0x52c068?_0x590af3(0x256)+_0x5afbfd+'\x27?':_0x590af3(0x223)+_0x5afbfd+'\x27?';if(!_0x18ab97[_0x590af3(0x266)]){if(!isInteractive())return console[_0x590af3(0x2bc)](a23_0x26e9fc[_0x590af3(0x2d1)](_0x590af3(0x27f)),_0x590af3(0x2c7)),console['error'](a23_0x26e9fc[_0x590af3(0x27a)](_0x590af3(0x205))),0x1;const _0x587c68=await confirmKey(_0x1b4e33);if(!_0x587c68)return console[_0x590af3(0x2bc)](a23_0x26e9fc[_0x590af3(0x2f5)]('Aborted.')),0x1;}const _0x5c74f6=_0x52c068?_0x590af3(0x2c3):'Updating',_0x5580e6=await withSpinner(_0x5c74f6+'\x20parent\x20segment\x20\x27'+_0x5afbfd+'\x27...',()=>_0x4323e8[_0x590af3(0x2f1)](),{'verbose':_0x18ab97['verbose']}),_0x300dfc=_0x5580e6[_0x590af3(0x2b0)],_0x3dee83=getConsoleNextUrl(_0x18ab97[_0x590af3(0x20f)],_0x590af3(0x24d)+_0x300dfc['id']),_0x3e566b=_0x52c068?'Created':_0x590af3(0x1d9);return console[_0x590af3(0x2bc)]('✔\x20'+_0x3e566b+_0x590af3(0x231)+_0x300dfc[_0x590af3(0x203)]+'\x27'),console[_0x590af3(0x2bc)]('\x20\x20'+_0x3dee83),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']='segment:parent:validate';[a23_0x265e8e(0x244)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x265e8e(0x1fa)](_0x3ade8c){const _0x57c113=a23_0x265e8e,{options:_0x3e6dc1,args:_0x1f274e,tdx:_0x537160}=_0x3ade8c,_0x4256d8=_0x3e6dc1,_0xf38750=_0x1f274e[0x0]||_0x3e6dc1[_0x57c113(0x2a7)];if(!_0xf38750)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x57c113(0x27c)+'Options:\x0a'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x2c42e5=resolveYamlFile(_0xf38750);if(!existsSync(_0x2c42e5))return showFileNotFoundError(_0x2c42e5,_0xf38750),0x1;_0x4256d8[_0x57c113(0x29e)]&&(console[_0x57c113(0x2bc)](_0x57c113(0x225)+_0x4256d8[_0x57c113(0x20f)]),console[_0x57c113(0x2bc)](_0x57c113(0x2f3)+_0x2c42e5));let _0x11e542;try{_0x11e542=readFileSync(_0x2c42e5,_0x57c113(0x209));}catch(_0x3cdbbe){const _0xa5c060=_0x3cdbbe instanceof Error?_0x3cdbbe[_0x57c113(0x1fc)]:String(_0x3cdbbe);return console[_0x57c113(0x2bc)](_0x57c113(0x2b5)+_0xa5c060),0x1;}const _0x3e37f1=createCommandSpinner(a23_0x26e9fc[_0x57c113(0x27a)](_0x57c113(0x28b)),{'verbose':_0x4256d8['verbose']});_0x3e37f1[_0x57c113(0x253)]();const _0xcc5ec0={'onProgress':_0x31d991=>{_0x3e37f1['text']=formatProgressMessage(_0x31d991);}};if(_0x4256d8[_0x57c113(0x227)])_0xcc5ec0['master']=!![];if(_0x4256d8[_0x57c113(0x26d)])_0xcc5ec0[_0x57c113(0x26d)]=!![];_0x4256d8[_0x57c113(0x2c0)]&&(_0xcc5ec0[_0x57c113(0x2c0)]=_0x4256d8['attribute']);_0x4256d8[_0x57c113(0x24a)]&&(_0xcc5ec0[_0x57c113(0x24a)]=_0x4256d8[_0x57c113(0x24a)]);if(_0x4256d8[_0x57c113(0x2e3)])_0xcc5ec0[_0x57c113(0x2e3)]=_0x4256d8[_0x57c113(0x2e3)];let _0x5a5d21;try{_0x5a5d21=await _0x537160[_0x57c113(0x2c5)]['validateParentYaml'](_0x11e542,_0xcc5ec0),_0x3e37f1[_0x57c113(0x22e)]();}catch(_0x251e1e){_0x3e37f1[_0x57c113(0x22e)]();throw _0x251e1e;}const _0x2da5c8=_0x4256d8[_0x57c113(0x2e3)]||_0x57c113(0x245);return this[_0x57c113(0x281)](_0x5a5d21,_0xcc5ec0,_0x2c42e5,_0x2da5c8),_0x5a5d21[_0x57c113(0x230)]?0x0:0x1;}['displayValidateResults'](_0x283648,_0x4fd375,_0x4b4b93,_0x5aabab){const _0x15096b=a23_0x265e8e;console[_0x15096b(0x2bc)]('\x0a'+a23_0x26e9fc[_0x15096b(0x24b)](_0x15096b(0x1ea))+'\x20'+_0x283648[_0x15096b(0x203)]),console['error']('═'['repeat'](0x3c)),this[_0x15096b(0x25e)](_0x283648);if(typeof _0x4fd375[_0x15096b(0x2c0)]==='string'){this[_0x15096b(0x288)](_0x283648),this['displaySummary'](_0x283648),this[_0x15096b(0x262)](_0x4b4b93,_0x5aabab,_0x15096b(0x2c0),_0x4fd375[_0x15096b(0x2c0)]);return;}if(_0x4fd375[_0x15096b(0x2c0)]===!![]){this['displayAttributesStats'](_0x283648),this[_0x15096b(0x2a8)](_0x283648),this[_0x15096b(0x262)](_0x4b4b93,_0x5aabab,_0x15096b(0x271));return;}if(typeof _0x4fd375[_0x15096b(0x24a)]===_0x15096b(0x2b9)){this[_0x15096b(0x2ab)](_0x283648,_0x5aabab),this[_0x15096b(0x2a8)](_0x283648),this[_0x15096b(0x262)](_0x4b4b93,_0x5aabab,_0x15096b(0x24a),_0x4fd375[_0x15096b(0x24a)]);return;}if(_0x4fd375[_0x15096b(0x24a)]===!![]){this[_0x15096b(0x2ab)](_0x283648,_0x5aabab),this[_0x15096b(0x2a8)](_0x283648),this[_0x15096b(0x262)](_0x4b4b93,_0x5aabab,_0x15096b(0x263));return;}this[_0x15096b(0x288)](_0x283648),this[_0x15096b(0x2ab)](_0x283648,_0x5aabab),this[_0x15096b(0x2a8)](_0x283648),this[_0x15096b(0x262)](_0x4b4b93,_0x5aabab,'all');}[a23_0x265e8e(0x262)](_0xf04d41,_0x16d164,_0x4a7fa6,_0x5801ce){const _0x54d803=a23_0x265e8e;console[_0x54d803(0x2bc)]('\x0a'+a23_0x26e9fc['dim'](_0x54d803(0x2b8)));const _0x2ae3f2=_0x16d164!==_0x54d803(0x245)?_0x54d803(0x21a)+_0x16d164:'';if(_0x4a7fa6==='attribute'&&_0x5801ce)console[_0x54d803(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x54d803(0x27a)]('tdx\x20segment\x20parent\x20preview\x20'+_0xf04d41+_0x54d803(0x240)+_0x5801ce+'\x22'+_0x2ae3f2));else{if(_0x4a7fa6===_0x54d803(0x24a)&&_0x5801ce)console[_0x54d803(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x54d803(0x27a)]('tdx\x20segment\x20parent\x20preview\x20'+_0xf04d41+_0x54d803(0x1dd)+_0x5801ce+'\x22'+_0x2ae3f2));else(_0x4a7fa6==='attributes'||_0x4a7fa6===_0x54d803(0x291))&&console['error']('\x20\x20'+a23_0x26e9fc[_0x54d803(0x27a)](_0x54d803(0x2a0)+_0xf04d41+'\x20--attribute\x20\x22<name>\x22'+_0x2ae3f2));}(_0x4a7fa6===_0x54d803(0x263)||_0x4a7fa6===_0x54d803(0x291))&&console[_0x54d803(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x54d803(0x27a)](_0x54d803(0x2a0)+_0xf04d41+'\x20--behavior\x20\x22<name>\x22'+_0x2ae3f2)),_0x4a7fa6===_0x54d803(0x291)&&console[_0x54d803(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x54d803(0x27a)]('tdx\x20segment\x20parent\x20preview\x20'+_0xf04d41+_0x54d803(0x299)+_0x2ae3f2));}[a23_0x265e8e(0x25e)](_0x242b6c){const _0x4ddd3c=a23_0x265e8e,{master:_0x2e16c9}=_0x242b6c,_0x5be4b2=_0x2e16c9[_0x4ddd3c(0x273)]?a23_0x26e9fc['green']('✔'):a23_0x26e9fc[_0x4ddd3c(0x2d1)]('✘');console[_0x4ddd3c(0x2bc)]('\x0a'+a23_0x26e9fc[_0x4ddd3c(0x27a)](_0x4ddd3c(0x2fd))),console['error'](_0x5be4b2+'\x20'+a23_0x26e9fc[_0x4ddd3c(0x24b)](_0x2e16c9[_0x4ddd3c(0x222)]+'.'+_0x2e16c9[_0x4ddd3c(0x1de)])),_0x2e16c9[_0x4ddd3c(0x273)]?_0x2e16c9['rowCount']!==undefined&&console[_0x4ddd3c(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x4ddd3c(0x27a)]('Rows:')+'\x20'+a23_0x26e9fc[_0x4ddd3c(0x238)](formatRows(_0x2e16c9[_0x4ddd3c(0x1f7)]))):console[_0x4ddd3c(0x2bc)]('\x20\x20'+a23_0x26e9fc['red'](_0x4ddd3c(0x28e))+'\x20'+_0x2e16c9['schemaError']);}[a23_0x265e8e(0x288)](_0x2ab75b){const _0x403355=a23_0x265e8e;if(_0x2ab75b['attributes'][_0x403355(0x252)]===0x0)return;console[_0x403355(0x2bc)]('\x0a'+a23_0x26e9fc[_0x403355(0x27a)]('Attributes'));for(const _0x30d57d of _0x2ab75b[_0x403355(0x271)]){const _0x1a0e8d=_0x30d57d['schemaValid']?a23_0x26e9fc['green']('✔'):a23_0x26e9fc[_0x403355(0x2d1)]('✘');let _0x2e712c='';if(_0x30d57d[_0x403355(0x273)]&&_0x30d57d['matchedCount']!==undefined&&_0x30d57d[_0x403355(0x2a2)]!==undefined){const _0x260460=_0x30d57d[_0x403355(0x2a2)][_0x403355(0x1e5)](0x1),_0xbab261=_0x30d57d[_0x403355(0x2a2)]>=0x50?a23_0x26e9fc[_0x403355(0x22d)]:_0x30d57d['coveragePercent']>=0x32?a23_0x26e9fc[_0x403355(0x2f5)]:a23_0x26e9fc[_0x403355(0x2d1)];_0x2e712c='\x20'+a23_0x26e9fc[_0x403355(0x27a)](_0x403355(0x268))+'\x20'+_0xbab261(_0x260460+'%')+'\x20('+formatRows(_0x30d57d[_0x403355(0x2e8)])+_0x403355(0x270);}console['error'](_0x1a0e8d+'\x20'+a23_0x26e9fc[_0x403355(0x24b)](_0x30d57d[_0x403355(0x203)])+_0x2e712c),console[_0x403355(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x403355(0x27a)]('Source:')+'\x20'+a23_0x26e9fc['bold'](_0x30d57d[_0x403355(0x222)]+'.'+_0x30d57d['table']));const _0x2cb0f1=_0x30d57d[_0x403355(0x24e)]===_0x30d57d[_0x403355(0x27b)]?a23_0x26e9fc[_0x403355(0x27a)]('Join\x20on:')+'\x20'+_0x30d57d[_0x403355(0x24e)]:a23_0x26e9fc[_0x403355(0x27a)](_0x403355(0x286))+'\x20'+_0x30d57d[_0x403355(0x24e)]+_0x403355(0x2ee)+_0x30d57d['foreignKey'];console[_0x403355(0x2bc)]('\x20\x20'+_0x2cb0f1),console[_0x403355(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x403355(0x27a)](_0x403355(0x300))),this[_0x403355(0x294)](_0x30d57d[_0x403355(0x259)]),!_0x30d57d['schemaValid']&&console['error']('\x20\x20'+a23_0x26e9fc['red']('Error:')+'\x20'+_0x30d57d[_0x403355(0x213)]);}}[a23_0x265e8e(0x2ab)](_0x46cc1f,_0x1fbf12){const _0x3cdfa5=a23_0x265e8e;if(_0x46cc1f[_0x3cdfa5(0x263)][_0x3cdfa5(0x252)]===0x0)return;console['error']('\x0a'+a23_0x26e9fc[_0x3cdfa5(0x27a)](_0x3cdfa5(0x285))+'\x20'+a23_0x26e9fc[_0x3cdfa5(0x27a)]('('+_0x1fbf12+')'));for(const _0x2957fd of _0x46cc1f[_0x3cdfa5(0x263)]){const _0x66b054=_0x2957fd[_0x3cdfa5(0x273)]?a23_0x26e9fc[_0x3cdfa5(0x22d)]('✔'):a23_0x26e9fc[_0x3cdfa5(0x2d1)]('✘');let _0x3865fc='';if(_0x2957fd[_0x3cdfa5(0x273)]&&_0x2957fd[_0x3cdfa5(0x1e4)]!==undefined&&_0x2957fd[_0x3cdfa5(0x275)]!==undefined){const _0x28c1a9=_0x2957fd['customerPercent']?.[_0x3cdfa5(0x1e5)](0x1)||'?',_0x1841f4=(_0x2957fd[_0x3cdfa5(0x1f0)]??0x0)>=0x32?a23_0x26e9fc[_0x3cdfa5(0x22d)]:(_0x2957fd['customerPercent']??0x0)>=0x14?a23_0x26e9fc[_0x3cdfa5(0x2f5)]:a23_0x26e9fc[_0x3cdfa5(0x2d1)];_0x3865fc='\x20'+a23_0x26e9fc[_0x3cdfa5(0x27a)](_0x3cdfa5(0x20a))+'\x20'+_0x1841f4(formatRows(_0x2957fd[_0x3cdfa5(0x1e4)]))+'\x20('+_0x28c1a9+'%)\x20'+a23_0x26e9fc['dim'](_0x3cdfa5(0x20c))+'\x20'+a23_0x26e9fc[_0x3cdfa5(0x238)](formatRows(_0x2957fd[_0x3cdfa5(0x275)]));}console[_0x3cdfa5(0x2bc)](_0x66b054+'\x20'+a23_0x26e9fc[_0x3cdfa5(0x24b)](_0x2957fd['name'])+_0x3865fc),console['error']('\x20\x20'+a23_0x26e9fc['dim'](_0x3cdfa5(0x2cb))+'\x20'+a23_0x26e9fc[_0x3cdfa5(0x24b)](_0x2957fd[_0x3cdfa5(0x222)]+'.'+_0x2957fd['table']));const _0x3eaaf4=_0x2957fd[_0x3cdfa5(0x24e)]===_0x2957fd[_0x3cdfa5(0x27b)]?a23_0x26e9fc[_0x3cdfa5(0x27a)](_0x3cdfa5(0x2c4))+'\x20'+_0x2957fd[_0x3cdfa5(0x24e)]:a23_0x26e9fc[_0x3cdfa5(0x27a)](_0x3cdfa5(0x286))+'\x20'+_0x2957fd['joinKey']+_0x3cdfa5(0x2ee)+_0x2957fd[_0x3cdfa5(0x27b)];console[_0x3cdfa5(0x2bc)]('\x20\x20'+_0x3eaaf4),console[_0x3cdfa5(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x3cdfa5(0x27a)](_0x3cdfa5(0x300))),this[_0x3cdfa5(0x294)](_0x2957fd[_0x3cdfa5(0x259)]),!_0x2957fd[_0x3cdfa5(0x273)]&&console['error']('\x20\x20'+a23_0x26e9fc[_0x3cdfa5(0x2d1)](_0x3cdfa5(0x28e))+'\x20'+_0x2957fd[_0x3cdfa5(0x213)]);}}[a23_0x265e8e(0x294)](_0x496b42){const _0x3173e7=a23_0x265e8e;for(const _0x59b6e2 of _0x496b42){_0x59b6e2[_0x3173e7(0x2f2)]===_0x59b6e2[_0x3173e7(0x221)]||_0x59b6e2[_0x3173e7(0x221)]==='*'?console[_0x3173e7(0x2bc)]('\x20\x20\x20\x20-\x20'+_0x59b6e2[_0x3173e7(0x2f2)]):console['error']('\x20\x20\x20\x20-\x20'+_0x59b6e2[_0x3173e7(0x2f2)]+'\x20'+a23_0x26e9fc[_0x3173e7(0x27a)]('('+_0x59b6e2[_0x3173e7(0x221)]+')'));}}[a23_0x265e8e(0x2a8)](_0x427bd8){const _0x19a356=a23_0x265e8e;console[_0x19a356(0x2bc)]('─'[_0x19a356(0x2a3)](0x3c));if(_0x427bd8[_0x19a356(0x26f)][_0x19a356(0x252)]>0x0){console[_0x19a356(0x2bc)]('\x0a'+a23_0x26e9fc[_0x19a356(0x2d1)](_0x19a356(0x1e8)));for(const _0x1f97ef of _0x427bd8[_0x19a356(0x26f)]){console[_0x19a356(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x19a356(0x2d1)]('•')+'\x20'+_0x1f97ef);}}_0x427bd8[_0x19a356(0x230)]&&console[_0x19a356(0x2bc)]('\x0a'+a23_0x26e9fc[_0x19a356(0x22d)]('✔')+_0x19a356(0x2f0));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x265e8e(0x203)]='segment:parent:preview';[a23_0x265e8e(0x244)]=a23_0x265e8e(0x201);async['execute'](_0x3d1680){const _0x22e45d=a23_0x265e8e,{options:_0x5b8a6b,args:_0x1aa834,tdx:_0x42ef7c}=_0x3d1680,_0x2f5d0f=_0x5b8a6b,_0x57756c=_0x1aa834[0x0]||_0x5b8a6b[_0x22e45d(0x2a7)];if(!_0x57756c)return showParentSegmentNotSetError(_0x22e45d(0x23a)+_0x22e45d(0x1e2)+_0x22e45d(0x206)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x22e45d(0x2b7)+_0x22e45d(0x207)+_0x22e45d(0x28f)),0x1;if(!_0x2f5d0f[_0x22e45d(0x227)]&&!_0x2f5d0f[_0x22e45d(0x2c0)]&&!_0x2f5d0f[_0x22e45d(0x24a)]&&!_0x2f5d0f[_0x22e45d(0x26d)])return console[_0x22e45d(0x2bc)](a23_0x26e9fc['red'](_0x22e45d(0x235))),console[_0x22e45d(0x2bc)](_0x22e45d(0x246)),console[_0x22e45d(0x2bc)]('Options:'),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x22e45d(0x2e6)),console[_0x22e45d(0x2bc)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x22e45d(0x2bc)](_0x22e45d(0x1f4)),0x1;const _0x111dd7=resolveYamlFile(_0x57756c);if(!existsSync(_0x111dd7))return showFileNotFoundError(_0x111dd7,_0x57756c),0x1;_0x2f5d0f['verbose']&&(console[_0x22e45d(0x2bc)]('Site:\x20'+_0x2f5d0f[_0x22e45d(0x20f)]),console['error']('YAML\x20file:\x20'+_0x111dd7));let _0x3fa387;try{_0x3fa387=readFileSync(_0x111dd7,_0x22e45d(0x209));}catch(_0xf6e5df){const _0xb15f23=_0xf6e5df instanceof Error?_0xf6e5df[_0x22e45d(0x1fc)]:String(_0xf6e5df);return console[_0x22e45d(0x2bc)](_0x22e45d(0x2b5)+_0xb15f23),0x1;}let _0x52c13b;try{_0x52c13b=parseDef(_0x3fa387);}catch(_0x42b933){const _0x3c8cee=_0x42b933 instanceof Error?_0x42b933[_0x22e45d(0x1fc)]:String(_0x42b933);return console['error'](a23_0x26e9fc[_0x22e45d(0x2d1)]('Error\x20parsing\x20YAML:\x20'+_0x3c8cee)),0x1;}if(_0x2f5d0f[_0x22e45d(0x2c0)]===!![]||_0x2f5d0f[_0x22e45d(0x2c0)]===''){const _0x3dd185=_0x52c13b[_0x22e45d(0x271)]?.[_0x22e45d(0x217)](_0x20a5fa=>_0x20a5fa[_0x22e45d(0x203)])||[];if(_0x3dd185['length']===0x0)console[_0x22e45d(0x2bc)](a23_0x26e9fc[_0x22e45d(0x2d1)](_0x22e45d(0x280)));else{console['error'](a23_0x26e9fc['red'](_0x22e45d(0x2d0))),console['error']('Available\x20attributes:');for(const _0x477b04 of _0x3dd185){console[_0x22e45d(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x22e45d(0x238)](_0x477b04));}console[_0x22e45d(0x2bc)](_0x22e45d(0x278)+_0x57756c+_0x22e45d(0x240)+_0x3dd185[0x0]+'\x22');}return 0x1;}if(_0x2f5d0f[_0x22e45d(0x24a)]===!![]||_0x2f5d0f[_0x22e45d(0x24a)]===''){const _0x36df6c=_0x52c13b[_0x22e45d(0x263)]?.['map'](_0x389f21=>_0x389f21[_0x22e45d(0x203)])||[];if(_0x36df6c['length']===0x0)console[_0x22e45d(0x2bc)](a23_0x26e9fc['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x22e45d(0x2bc)](a23_0x26e9fc[_0x22e45d(0x2d1)](_0x22e45d(0x224))),console[_0x22e45d(0x2bc)](_0x22e45d(0x296));for(const _0x40b8a1 of _0x36df6c){console[_0x22e45d(0x2bc)]('\x20\x20'+a23_0x26e9fc['cyan'](_0x40b8a1));}console[_0x22e45d(0x2bc)](_0x22e45d(0x278)+_0x57756c+_0x22e45d(0x1dd)+_0x36df6c[0x0]+'\x22');}return 0x1;}const _0x268681=createCommandSpinner(a23_0x26e9fc[_0x22e45d(0x27a)](_0x22e45d(0x2f7)),{'verbose':_0x2f5d0f['verbose']});_0x268681[_0x22e45d(0x253)]();const _0x23aecf={'onProgress':_0x3d0f58=>{_0x268681['text']=formatProgressMessage(_0x3d0f58);}};if(_0x2f5d0f[_0x22e45d(0x227)])_0x23aecf[_0x22e45d(0x227)]=!![];if(_0x2f5d0f[_0x22e45d(0x2c0)]&&typeof _0x2f5d0f['attribute']===_0x22e45d(0x2b9))_0x23aecf[_0x22e45d(0x2c0)]=_0x2f5d0f[_0x22e45d(0x2c0)];if(_0x2f5d0f[_0x22e45d(0x24a)]&&typeof _0x2f5d0f[_0x22e45d(0x24a)]==='string')_0x23aecf[_0x22e45d(0x24a)]=_0x2f5d0f['behavior'];if(_0x2f5d0f[_0x22e45d(0x26d)])_0x23aecf[_0x22e45d(0x26d)]=!![];if(_0x2f5d0f[_0x22e45d(0x2e3)])_0x23aecf[_0x22e45d(0x2e3)]=_0x2f5d0f['interval'];let _0x542629;try{_0x542629=await _0x42ef7c[_0x22e45d(0x2c5)][_0x22e45d(0x1e3)](_0x3fa387,_0x23aecf),_0x268681['stop']();}catch(_0x554bbb){_0x268681[_0x22e45d(0x22e)]();throw _0x554bbb;}return await this[_0x22e45d(0x28a)](_0x542629,{'master':_0x2f5d0f[_0x22e45d(0x227)],'attribute':typeof _0x2f5d0f[_0x22e45d(0x2c0)]===_0x22e45d(0x2b9)?_0x2f5d0f['attribute']:undefined,'behavior':typeof _0x2f5d0f[_0x22e45d(0x24a)]===_0x22e45d(0x2b9)?_0x2f5d0f[_0x22e45d(0x24a)]:undefined,'enriched':_0x2f5d0f[_0x22e45d(0x26d)]}),_0x542629[_0x22e45d(0x230)]?0x0:0x1;}async[a23_0x265e8e(0x28a)](_0x388397,_0x342c96){const _0x4d9b67=a23_0x265e8e;console[_0x4d9b67(0x2bc)]('\x0a'+a23_0x26e9fc[_0x4d9b67(0x24b)](_0x4d9b67(0x2fc))+'\x20'+_0x388397[_0x4d9b67(0x203)]),console[_0x4d9b67(0x2bc)]('═'[_0x4d9b67(0x2a3)](0x3c));if(_0x342c96[_0x4d9b67(0x227)]&&_0x388397[_0x4d9b67(0x21d)]){const _0x37aad4=a23_0x26e9fc[_0x4d9b67(0x27a)](_0x4d9b67(0x269))+'\x20'+a23_0x26e9fc[_0x4d9b67(0x24b)](_0x388397[_0x4d9b67(0x227)]['database']+'.'+_0x388397[_0x4d9b67(0x227)]['table']);await this[_0x4d9b67(0x284)](_0x37aad4,_0x388397['sampleData']);}else{if(_0x342c96[_0x4d9b67(0x2c0)]&&_0x388397[_0x4d9b67(0x21d)]){const _0x23bd33=a23_0x26e9fc[_0x4d9b67(0x27a)](_0x4d9b67(0x24c))+'\x20'+a23_0x26e9fc[_0x4d9b67(0x24b)](_0x342c96[_0x4d9b67(0x2c0)]);await this[_0x4d9b67(0x284)](_0x23bd33,_0x388397['sampleData']);}else{if(_0x342c96['behavior']&&_0x388397['sampleData']){const _0x1641bc=a23_0x26e9fc[_0x4d9b67(0x27a)](_0x4d9b67(0x1f2))+'\x20'+a23_0x26e9fc[_0x4d9b67(0x24b)](_0x342c96[_0x4d9b67(0x24a)]);await this[_0x4d9b67(0x284)](_0x1641bc,_0x388397[_0x4d9b67(0x21d)]);}else{if(_0x342c96[_0x4d9b67(0x26d)]&&_0x388397[_0x4d9b67(0x21d)]){const _0x566783=a23_0x26e9fc[_0x4d9b67(0x27a)](_0x4d9b67(0x204))+'\x20'+a23_0x26e9fc[_0x4d9b67(0x24b)]('Master\x20+\x20Attributes');await this[_0x4d9b67(0x284)](_0x566783,_0x388397[_0x4d9b67(0x21d)]);}else!_0x388397[_0x4d9b67(0x21d)]&&console[_0x4d9b67(0x2bc)](_0x4d9b67(0x279));}}}if(_0x388397['errors']['length']>0x0){console[_0x4d9b67(0x2bc)]('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x26e9fc[_0x4d9b67(0x2d1)](_0x4d9b67(0x1e8)));for(const _0x257621 of _0x388397['errors']){console[_0x4d9b67(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0x4d9b67(0x2d1)]('•')+'\x20'+_0x257621);}}}async[a23_0x265e8e(0x284)](_0x32dcfc,_0x1db13e){const _0x3397ca=a23_0x265e8e;if(_0x1db13e['length']===0x0){console[_0x3397ca(0x2bc)]('\x0a'+_0x32dcfc),console[_0x3397ca(0x2bc)](_0x3397ca(0x2dc));return;}console['error']('\x0a'+_0x32dcfc);const _0x252fc8=Object[_0x3397ca(0x21e)](_0x1db13e[0x0])['map'](_0x457920=>({'name':_0x457920,'type':typeof _0x1db13e[0x0][_0x457920]===_0x3397ca(0x290)?'double':_0x3397ca(0x2e9)})),_0x24fa43={'queryId':_0x3397ca(0x20b),'columns':_0x252fc8,'data':_0x1db13e,'stats':{'state':_0x3397ca(0x267),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1db13e['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x596e35=formatAsTable(_0x24fa43,_0x1db13e['length'],!![]);await writeOutput(_0x596e35,undefined,_0x3397ca(0x1de));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a23_0x265e8e(0x244)]=a23_0x265e8e(0x23d);async[a23_0x265e8e(0x1fa)](_0x131fc6){const _0xd0d864=a23_0x265e8e,{options:_0x122e47,args:_0x758d0c,tdx:_0x10a2dc}=_0x131fc6,_0x1f8488=_0x122e47,_0x1026a3=_0x758d0c[0x0]||_0x122e47[_0xd0d864(0x2a7)];if(!_0x1026a3)return showParentSegmentNotSetError(_0xd0d864(0x2ec)+_0xd0d864(0x1f1)),0x1;const _0x190013=resolveYamlFile(_0x1026a3);if(existsSync(_0x190013)){_0x1f8488[_0xd0d864(0x29e)]&&console[_0xd0d864(0x2bc)](_0xd0d864(0x2ed)+_0x190013);let _0x497814;try{_0x497814=readFileSync(_0x190013,'utf-8');}catch(_0x1c6af2){const _0x55f40b=_0x1c6af2 instanceof Error?_0x1c6af2[_0xd0d864(0x1fc)]:String(_0x1c6af2);return console[_0xd0d864(0x2bc)](_0xd0d864(0x2b5)+_0x55f40b),0x1;}const _0xf926f3=await withSpinner(_0xd0d864(0x260),()=>_0x10a2dc[_0xd0d864(0x2c5)][_0xd0d864(0x220)](_0x497814),{'verbose':_0x1f8488[_0xd0d864(0x29e)]}),_0x2c9fe2=_0xf926f3['data'],{isNew:_0x5ed6e5,name:_0x4ba806,hasChanges:_0x506a4f,diffFormatted:_0x3da3e9}=_0x2c9fe2;if(_0x506a4f){_0x5ed6e5?console[_0xd0d864(0x2bc)](_0xd0d864(0x297)+_0x4ba806+'\x27:'):console[_0xd0d864(0x2bc)](_0xd0d864(0x22b)+_0x4ba806+'\x27:');console[_0xd0d864(0x2bc)]('─'[_0xd0d864(0x2a3)](0x3c)),console[_0xd0d864(0x2bc)](_0x3da3e9),console[_0xd0d864(0x2bc)]('─'[_0xd0d864(0x2a3)](0x3c));const _0x5e830c=_0x5ed6e5?_0xd0d864(0x256)+_0x4ba806+_0xd0d864(0x1f6):_0xd0d864(0x223)+_0x4ba806+'\x27\x20and\x20run\x20workflow?';if(!_0x1f8488['yes']){if(!isInteractive())return console[_0xd0d864(0x2bc)](a23_0x26e9fc['red'](_0xd0d864(0x27f)),_0xd0d864(0x2c7)),console['error'](a23_0x26e9fc['dim'](_0xd0d864(0x205))),0x1;const _0x184a28=await confirmKey(_0x5e830c);if(!_0x184a28)return console[_0xd0d864(0x2bc)](a23_0x26e9fc[_0xd0d864(0x2f5)](_0xd0d864(0x2bf))),0x1;}const _0x20876a=_0x5ed6e5?_0xd0d864(0x2c3):'Updating';await withSpinner(_0x20876a+_0xd0d864(0x231)+_0x4ba806+'\x27...',()=>_0x2c9fe2[_0xd0d864(0x2f1)](),{'verbose':_0x1f8488[_0xd0d864(0x29e)]});const _0x23ed8e=_0x5ed6e5?_0xd0d864(0x2d4):_0xd0d864(0x1d9);console[_0xd0d864(0x2bc)]('✔\x20'+_0x23ed8e+'\x20parent\x20segment\x20\x27'+_0x4ba806+'\x27');}else console[_0xd0d864(0x2bc)](_0xd0d864(0x202)+_0x4ba806+'\x27\x20is\x20up\x20to\x20date');}const _0x28ce4f=await withSpinner(_0xd0d864(0x2b4)+_0x1026a3+'\x27...',()=>_0x10a2dc[_0xd0d864(0x2c5)][_0xd0d864(0x242)](_0x1026a3),{'verbose':_0x1f8488[_0xd0d864(0x29e)]}),_0x4792f8=_0x28ce4f['data'],_0x4687f0=getConsoleUrl(_0x1f8488[_0xd0d864(0x20f)],_0xd0d864(0x2de)+_0x4792f8[_0xd0d864(0x29b)]+_0xd0d864(0x1d7)+_0x4792f8['workflowSessionId']+_0xd0d864(0x2a6)+_0x4792f8[_0xd0d864(0x2ae)]);return console[_0xd0d864(0x2bc)]('\x0a✔\x20Workflow\x20started'),console[_0xd0d864(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0xd0d864(0x27a)](_0xd0d864(0x22c))+'\x20'+_0x4792f8[_0xd0d864(0x265)]),console[_0xd0d864(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0xd0d864(0x27a)](_0xd0d864(0x2b3))+'\x20'+_0x4792f8[_0xd0d864(0x292)]),console[_0xd0d864(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0xd0d864(0x27a)](_0xd0d864(0x2e4))+'\x20'+_0x4792f8['workflowSessionId']),console[_0xd0d864(0x2bc)]('\x20\x20'+a23_0x26e9fc[_0xd0d864(0x27a)](_0xd0d864(0x26b))+'\x20'+_0x4792f8['workflowAttemptId']),console[_0xd0d864(0x2bc)]('\x20\x20'+_0x4687f0),console[_0xd0d864(0x2bc)]('\x0a'+a23_0x26e9fc[_0xd0d864(0x27a)](_0xd0d864(0x234))+_0xd0d864(0x216)+_0x4792f8['workflowAttemptId']+_0xd0d864(0x232)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x265e8e(0x203)]='segment:parent:fields';[a23_0x265e8e(0x244)]=a23_0x265e8e(0x293);async['execute'](_0x6e61d9){const _0x29140f=a23_0x265e8e,{options:_0x13cf9d,args:_0x626600,tdx:_0x2f1615}=_0x6e61d9,_0x51fa98=_0x626600[0x0]||_0x13cf9d[_0x29140f(0x2a7)];if(!_0x51fa98)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x13cf9d[_0x29140f(0x29e)]&&(console[_0x29140f(0x2bc)]('Site:\x20'+_0x13cf9d[_0x29140f(0x20f)]),console['error'](_0x29140f(0x1f9)+_0x51fa98));const _0x5612f7=await withSpinner(_0x29140f(0x2c6)+_0x51fa98+_0x29140f(0x2be),()=>_0x2f1615[_0x29140f(0x2c5)]['listFields'](_0x51fa98),{'verbose':_0x13cf9d[_0x29140f(0x29e)]}),_0x4d2367=_0x5612f7['data'];console[_0x29140f(0x2bc)](_0x29140f(0x2c8)+_0x4d2367['length']+_0x29140f(0x2ef)+(_0x4d2367[_0x29140f(0x252)]!==0x1?'s':''));if(_0x13cf9d[_0x29140f(0x21c)]||_0x13cf9d[_0x29140f(0x1d8)])return await handleSDKOutput(_0x4d2367,_0x13cf9d),0x0;return displayFieldsHumanReadable(_0x4d2367,_0x51fa98),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x265e8e(0x203)]=a23_0x265e8e(0x1e9);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x22a);async[a23_0x265e8e(0x1fa)](_0xd796be){const _0x3da916=a23_0x265e8e,{options:_0x59c41d,args:_0x49a4b6,tdx:_0x2fb519}=_0xd796be,_0x30db07=_0x59c41d,_0x4d5ebd=_0x49a4b6[0x0]||_0x59c41d[_0x3da916(0x2a7)];if(!_0x4d5ebd)return showParentSegmentNotSetError(_0x3da916(0x2d3)+_0x3da916(0x1ed)+_0x3da916(0x2a5)+_0x3da916(0x2f8)),0x1;_0x59c41d[_0x3da916(0x29e)]&&(console[_0x3da916(0x2bc)](_0x3da916(0x225)+_0x59c41d[_0x3da916(0x20f)]),console[_0x3da916(0x2bc)](_0x3da916(0x1f9)+_0x4d5ebd));const _0x1cef39=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x4d5ebd+'\x27...',()=>_0x2fb519['segment'][_0x3da916(0x2dd)](_0x4d5ebd),{'verbose':_0x59c41d[_0x3da916(0x29e)]}),_0x557cc2=_0x1cef39[_0x3da916(0x2b0)];if(_0x30db07[_0x3da916(0x2b1)]){const _0x51afdc=getConsoleNextUrl(_0x30db07[_0x3da916(0x20f)],_0x3da916(0x24d)+_0x557cc2['id']);return console[_0x3da916(0x2bc)](a23_0x26e9fc[_0x3da916(0x22d)]('✔')+'\x20Opening\x20'+a23_0x26e9fc[_0x3da916(0x238)](_0x51afdc)),openBrowser(_0x51afdc),0x0;}return await handleSingleObjectOutput(_0x557cc2,_0x59c41d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a23_0x265e8e(0x26c);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x2bb);async['execute'](_0x257e15){const _0x562f48=a23_0x265e8e,{options:_0x576da2,args:_0x20c92b,tdx:_0x47b6db}=_0x257e15,_0x57b8db=_0x20c92b[0x0]||_0x576da2[_0x562f48(0x2a7)];if(!_0x57b8db)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x562f48(0x28d)),0x1;_0x576da2[_0x562f48(0x29e)]&&(console[_0x562f48(0x2bc)](_0x562f48(0x225)+_0x576da2['site']),console[_0x562f48(0x2bc)](_0x562f48(0x1f9)+_0x57b8db));const _0x1d323b=await withSpinner(_0x562f48(0x1fd)+_0x57b8db+_0x562f48(0x2be),()=>_0x47b6db[_0x562f48(0x2c5)][_0x562f48(0x2f4)](_0x57b8db),{'verbose':_0x576da2['verbose']}),_0x5be919=_0x1d323b[_0x562f48(0x2b0)],_0x1fea6b=await withSpinner(_0x562f48(0x237)+_0x57b8db+'\x27...',()=>_0x47b6db[_0x562f48(0x2c5)][_0x562f48(0x2ba)](_0x5be919),{'verbose':_0x576da2[_0x562f48(0x29e)]}),_0x36401d=await executeSchemaQuery(_0x1fea6b[_0x562f48(0x2b0)],_0x47b6db,_0x576da2);return await handleQueryOutput(_0x36401d,_0x576da2),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x265e8e(0x203)]=a23_0x265e8e(0x23c);[a23_0x265e8e(0x244)]=a23_0x265e8e(0x29a);async['execute'](_0x126241){const _0x439754=a23_0x265e8e,{options:_0x2c01a5,args:_0x449b73,tdx:_0x501d84}=_0x126241,_0x45a212=_0x449b73[0x0]||_0x2c01a5[_0x439754(0x2a7)];if(!_0x45a212)return showParentSegmentNotSetError(_0x439754(0x2e0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x2c01a5[_0x439754(0x29e)]&&(console['error'](_0x439754(0x225)+_0x2c01a5[_0x439754(0x20f)]),console[_0x439754(0x2bc)](_0x439754(0x1f9)+_0x45a212));const _0x3adc3b=await withSpinner(_0x439754(0x1fd)+_0x45a212+_0x439754(0x2be),()=>_0x501d84[_0x439754(0x2c5)][_0x439754(0x2f4)](_0x45a212),{'verbose':_0x2c01a5['verbose']}),_0x3e8146=_0x3adc3b['data'],_0xf276fe=await withSpinner(_0x439754(0x237)+_0x45a212+_0x439754(0x2be),()=>_0x501d84[_0x439754(0x2c5)][_0x439754(0x2ba)](_0x3e8146),{'verbose':_0x2c01a5['verbose']}),_0x296a76=_0xf276fe[_0x439754(0x2b0)];return _0x2c01a5[_0x439754(0x26a)]==='json'||_0x2c01a5[_0x439754(0x26a)]===_0x439754(0x1d8)?await handleSDKOutput([{'sql':_0x296a76}],_0x2c01a5):console[_0x439754(0x1e1)](_0x296a76),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a23_0x265e8e(0x29d);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a23_0x265e8e(0x1fa)](_0xdc673f){const _0x33de48=a23_0x265e8e,{options:_0x5d5df9,args:_0x150546,tdx:_0x273470}=_0xdc673f,_0x33eced=_0x150546[0x0]||_0x5d5df9[_0x33de48(0x2a7)];if(!_0x33eced)return showParentSegmentNotSetError(_0x33de48(0x2ac)+_0x33de48(0x2cf)),0x1;_0x5d5df9[_0x33de48(0x29e)]&&(console[_0x33de48(0x2bc)](_0x33de48(0x225)+_0x5d5df9['site']),console[_0x33de48(0x2bc)]('Parent\x20segment:\x20'+_0x33eced));const _0x1194a4=await withSpinner(_0x33de48(0x1fd)+_0x33eced+_0x33de48(0x2be),()=>_0x273470[_0x33de48(0x2c5)][_0x33de48(0x2f4)](_0x33eced),{'verbose':_0x5d5df9[_0x33de48(0x29e)]}),_0x1b28e1=_0x1194a4[_0x33de48(0x2b0)],_0x3e0d6c=await withSpinner(_0x33de48(0x237)+_0x33eced+'\x27...',()=>_0x273470['segment']['getParentSQL'](_0x1b28e1),{'verbose':_0x5d5df9[_0x33de48(0x29e)]});let _0x1888f9=_0x3e0d6c[_0x33de48(0x2b0)];const _0x4406e1=resolveLimit(_0x5d5df9['limit'],DEFAULT_DISPLAY_LIMIT),_0x3856e6=/\bLIMIT\s+\d+/i[_0x33de48(0x298)](_0x1888f9);!_0x3856e6&&(_0x1888f9=_0x1888f9[_0x33de48(0x26e)]()[_0x33de48(0x1eb)](/;+$/,''),_0x1888f9=_0x33de48(0x2d8)+_0x1888f9+_0x33de48(0x1f3)+_0x4406e1);_0x5d5df9[_0x33de48(0x29e)]&&console['error'](_0x33de48(0x1ec)+_0x1888f9);const _0x1575c2=await withProgressSpinner(_0x33de48(0x25b),async _0x151b2c=>{const _0x4e8757=_0x33de48,_0x381a10=await _0x273470[_0x4e8757(0x1d4)][_0x4e8757(0x1fa)](_0x1888f9,{'catalog':'td','schema':_0x4e8757(0x23b),'onJobId':_0x4f4bfc=>{const _0x202ca9=_0x4e8757;_0x151b2c[_0x202ca9(0x2da)](_0x4f4bfc);}});return _0x381a10;},{'verbose':_0x5d5df9['verbose']}),_0x38af88=_0x1575c2[_0x33de48(0x2b0)],_0x50da52=_0x38af88[_0x33de48(0x247)]?_0x33de48(0x2df)+_0x38af88['jobId']+']':'';return console['error'](_0x33de48(0x1ee)+_0x38af88['stats']['processedRows'][_0x33de48(0x229)]()+_0x33de48(0x215)+(_0x33de48(0x2c2)+formatElapsed(_0x38af88[_0x33de48(0x2ff)][_0x33de48(0x211)])+_0x50da52)),await handleQueryOutput(_0x38af88,_0x5d5df9),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x15f38c=a24_0x370c;(function(_0x27a871,_0x4de853){const _0x309e59=a24_0x370c,_0x1c1f6c=_0x27a871();while(!![]){try{const _0x51ef4e=-parseInt(_0x309e59(0x13b))/0x1*(-parseInt(_0x309e59(0x106))/0x2)+-parseInt(_0x309e59(0xd7))/0x3*(-parseInt(_0x309e59(0xe2))/0x4)+-parseInt(_0x309e59(0xf5))/0x5*(parseInt(_0x309e59(0xef))/0x6)+parseInt(_0x309e59(0xde))/0x7+-parseInt(_0x309e59(0xf8))/0x8+parseInt(_0x309e59(0x133))/0x9+-parseInt(_0x309e59(0x129))/0xa*(parseInt(_0x309e59(0xdc))/0xb);if(_0x51ef4e===_0x4de853)break;else _0x1c1f6c['push'](_0x1c1f6c['shift']());}catch(_0x2fb69d){_0x1c1f6c['push'](_0x1c1f6c['shift']());}}}(a24_0x4f7c,0xdb405));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 a24_0x41c9dc from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a24_0x4f7c(){const _0x46056b=['bold','10442736WGstwL','/app/mp/ak','\x0aOperation\x20cancelled','profile:remove','us01','toString','getUserInfo','Failed\x20to\x20remove\x20profile:\x20','1541567ywRFJi','profile:use','jobs','password','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','test','Set\x20a\x20profile\x20configuration\x20value','Removal\x20cancelled','profileName','tdx:\x20profile\x20create','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','51RHBHqS','Site\x20name\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20\x20(no\x20profiles\x20found)','2524412VCFiXB','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','9056397jIVCrT','Validating\x20API\x20key...','split','\x27.\x0a\x0aValid\x20keys:\x20','80396ZPSPCZ','Profile\x20\x27','Changing\x20site\x20to\x20\x27','includes','status','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','email','red','logLevel','log','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','✗\x20Validation\x20failed:\x20','150504BLjAfw','confirm','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','345xRDtmK','ERROR','llm_project','6324064EZdRtH','description','(cleared)','API\x20key\x20cannot\x20be\x20empty','customSite','\x27\x20does\x20not\x20exist.','create','text','(session:\x20','tdx.json','message','tdx:\x20profile\x20remove','\x27\x20created','profile','2tbTphU','Session\x20profile\x20set\x20to:\x20','select','\x0aSaved\x20to:\x20','\x20--default\x27\x20to\x20save\x20permanently','Profile\x20name\x20cannot\x20be\x20empty','session','validate','dim','name','trim','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Unknown\x20key\x20\x27','execute','VALID_KEYS','\x20Profile\x20\x27','\x0aAvailable\x20profiles:','\x20\x20tdx\x20--profile\x20','parent_segment','other','warn','\x20API\x20key\x20is\x20valid\x20(User:\x20','green','tdx:\x20profile\x20set','length','\x20\x20-\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Remove\x20a\x20profile','Enter\x20your\x20TD\x20API\x20key:','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>','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','yellow','site','join','Set\x20session\x20profile','40cNJNNL','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:set','Enter\x20description\x20(optional):','apiKey','Default\x20profile\x20set\x20to:\x20','config','\x0aSetup\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'];a24_0x4f7c=function(){return _0x46056b;};return a24_0x4f7c();}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}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 a24_0x7d6644 from'prompts';import a24_0x58d085 from'chalk';function a24_0x370c(_0x215faf,_0x54b2eb){_0x215faf=_0x215faf-0xd2;const _0x4f7cc9=a24_0x4f7c();let _0x370c40=_0x4f7cc9[_0x215faf];return _0x370c40;}function validateProfileName(_0x433e8f){const _0x2ca240=a24_0x370c;if(!_0x433e8f||!_0x433e8f[_0x2ca240(0x110)]())return _0x2ca240(0x10b);const _0x342b7d=_0x433e8f['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x342b7d))return _0x2ca240(0x12a);if(profileExists(_0x342b7d))return _0x2ca240(0xe3)+_0x342b7d+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x15f38c(0xf9)]='Create\x20a\x20new\x20profile';async['execute'](_0x39c458){const _0x4b2cb0=a24_0x15f38c,{options:_0x1091c1,args:_0x5e4f08}=_0x39c458;console[_0x4b2cb0(0xeb)](a24_0x58d085[_0x4b2cb0(0x132)](_0x4b2cb0(0xd5)));let _0x8a9652;if(_0x5e4f08[_0x4b2cb0(0x11e)]>0x0&&_0x5e4f08[0x0]){const _0x4b3aed=_0x5e4f08[0x0][_0x4b2cb0(0x110)](),_0x1d4f22=validateProfileName(_0x4b3aed);if(_0x1d4f22!==!![])return console['error'](a24_0x58d085[_0x4b2cb0(0xe9)](_0x1d4f22)),0x1;_0x8a9652=_0x4b3aed;}else{const _0x2b7535=await a24_0x7d6644({'type':'text','name':_0x4b2cb0(0xd4),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x2b7535['profileName'])return console[_0x4b2cb0(0xeb)](_0x4b2cb0(0x130)),0x1;_0x8a9652=_0x2b7535['profileName'][_0x4b2cb0(0x110)]();}const _0x32b8da=await a24_0x7d6644({'type':_0x4b2cb0(0xff),'name':_0x4b2cb0(0xf9),'message':_0x4b2cb0(0x12c)}),_0x18d91a=_0x32b8da[_0x4b2cb0(0xf9)]?.['trim']()||undefined,_0x1ac2d3=_0x1091c1[_0x4b2cb0(0x126)]||_0x4b2cb0(0x137),{choices:_0x2a35f2,initialIndex:_0x89823e}=buildSiteChoices(_0x1ac2d3),_0x352820=await a24_0x7d6644({'type':_0x4b2cb0(0x108),'name':_0x4b2cb0(0x126),'message':_0x4b2cb0(0xda)+_0x8a9652+'\x27:','choices':_0x2a35f2,'initial':_0x89823e});if(!_0x352820[_0x4b2cb0(0x126)])return console[_0x4b2cb0(0xeb)](_0x4b2cb0(0x130)),0x1;let _0x1c1f0d;if(_0x352820[_0x4b2cb0(0x126)]===_0x4b2cb0(0x119)){const _0x52989a=await a24_0x7d6644({'type':_0x4b2cb0(0xff),'name':_0x4b2cb0(0xfc),'message':'Enter\x20site\x20name:','initial':_0x4b2cb0(0x137),'validate':_0x5d21ec=>{const _0xc3927=_0x4b2cb0;if(!_0x5d21ec||!_0x5d21ec[_0xc3927(0x110)]())return _0xc3927(0xd8);if(!/^[a-z0-9-]+$/[_0xc3927(0x140)](_0x5d21ec[_0xc3927(0x110)]()))return _0xc3927(0xd6);return!![];}});if(!_0x52989a[_0x4b2cb0(0xfc)])return console[_0x4b2cb0(0xeb)](_0x4b2cb0(0x130)),0x1;_0x1c1f0d=_0x52989a[_0x4b2cb0(0xfc)];}else _0x1c1f0d=_0x352820[_0x4b2cb0(0x126)];const _0x11b153=resolveSite(_0x1c1f0d);console[_0x4b2cb0(0xeb)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x11b153),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4b2cb0(0xeb)]('\x20\x20'+getConsoleUrl(_0x11b153,_0x4b2cb0(0x134)));const _0x2e881e=await a24_0x7d6644({'type':_0x4b2cb0(0x13e),'name':_0x4b2cb0(0x12d),'message':_0x4b2cb0(0x122),'validate':_0x469a21=>{const _0x9ee2d3=_0x4b2cb0;if(!_0x469a21||!_0x469a21[_0x9ee2d3(0x110)]())return _0x9ee2d3(0xfb);return!![];}});if(!_0x2e881e['apiKey'])return console['log'](_0x4b2cb0(0x130)),0x1;const _0x1265c6=_0x2e881e['apiKey'];console[_0x4b2cb0(0xeb)](_0x4b2cb0(0xdf));try{const _0x19fc26=TDX[_0x4b2cb0(0xfe)]({'site':_0x11b153,'apiKey':_0x1265c6[_0x4b2cb0(0x110)](),'logLevel':_0x1091c1[_0x4b2cb0(0xea)]??LogLevel[_0x4b2cb0(0xf6)]}),_0x476be4=await _0x19fc26[_0x4b2cb0(0x13d)][_0x4b2cb0(0x139)]();console[_0x4b2cb0(0xeb)](a24_0x58d085[_0x4b2cb0(0x11c)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x476be4[_0x4b2cb0(0xe8)]+')');const _0x62e7b3=await isKeychainAvailable();_0x62e7b3?(await saveAPIKeyAsync(_0x1265c6[_0x4b2cb0(0x110)](),_0x11b153,_0x8a9652),console['log'](a24_0x58d085[_0x4b2cb0(0x11c)]('✓')+_0x4b2cb0(0xdd)+_0x8a9652+')')):(console['warn'](a24_0x58d085[_0x4b2cb0(0x125)](_0x4b2cb0(0x124))),console[_0x4b2cb0(0x11a)](a24_0x58d085['yellow'](_0x4b2cb0(0x120))));const _0x151094={'site':_0x11b153,..._0x18d91a&&{'description':_0x18d91a}};return saveProfileToUserConfig(_0x8a9652,_0x151094),console['log'](a24_0x58d085[_0x4b2cb0(0x11c)]('✓')+_0x4b2cb0(0x115)+_0x8a9652+_0x4b2cb0(0x104)),console[_0x4b2cb0(0xeb)](),console[_0x4b2cb0(0xeb)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4b2cb0(0xeb)](_0x4b2cb0(0x117)+_0x8a9652+_0x4b2cb0(0x111)),console['log'](_0x4b2cb0(0x117)+_0x8a9652+_0x4b2cb0(0x131)),0x0;}catch(_0x1cca25){if(_0x1cca25 instanceof HTTPClientError&&_0x1cca25[_0x4b2cb0(0xe6)]===0x191)return printAuthError(_0x1cca25),0x1;return console[_0x4b2cb0(0xed)](a24_0x58d085[_0x4b2cb0(0xe9)]('✗\x20Validation\x20failed:\x20'+(_0x1cca25 instanceof Error?_0x1cca25['message']:String(_0x1cca25)))),console[_0x4b2cb0(0xed)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x15f38c(0x10f)]=a24_0x15f38c(0x136);[a24_0x15f38c(0xf9)]=a24_0x15f38c(0x121);[a24_0x15f38c(0x10d)](_0xbf9c75){const _0x2cf67e=a24_0x15f38c,{args:_0x4ea96b}=_0xbf9c75;if(_0x4ea96b[_0x2cf67e(0x11e)]===0x0)return _0x2cf67e(0xf2);return undefined;}async[a24_0x15f38c(0x113)](_0x2d2957){const _0x5e671a=a24_0x15f38c,{args:_0x537d51}=_0x2d2957,_0x18b14c=_0x537d51[0x0];console[_0x5e671a(0xeb)](a24_0x58d085['bold'](_0x5e671a(0x103)));if(!profileExists(_0x18b14c)){console['error'](a24_0x58d085[_0x5e671a(0xe9)](_0x5e671a(0xe3)+_0x18b14c+_0x5e671a(0xfd))),console[_0x5e671a(0xeb)]('\x0aAvailable\x20profiles:');const _0x3ab475=listProfiles();if(_0x3ab475[_0x5e671a(0x11e)]===0x0)console[_0x5e671a(0xeb)](_0x5e671a(0xdb));else for(const _0x2b7b0c of _0x3ab475){console[_0x5e671a(0xeb)](_0x5e671a(0x11f)+_0x2b7b0c[_0x5e671a(0x10f)]);}return 0x1;}const _0x2a5658=await a24_0x7d6644({'type':_0x5e671a(0xf0),'name':_0x5e671a(0xf0),'message':_0x5e671a(0x13f)+_0x18b14c+'\x27?','initial':![]});if(!_0x2a5658[_0x5e671a(0xf0)])return console[_0x5e671a(0xeb)](_0x5e671a(0xd3)),0x0;try{removeProfileFromUserConfig(_0x18b14c),console[_0x5e671a(0xeb)](a24_0x58d085['green']('✓')+_0x5e671a(0x115)+_0x18b14c+'\x27\x20removed\x20from\x20configuration');}catch(_0x3b3a8c){return console[_0x5e671a(0xed)](a24_0x58d085[_0x5e671a(0xe9)](_0x5e671a(0x13a)+(_0x3b3a8c instanceof Error?_0x3b3a8c[_0x5e671a(0x102)]:String(_0x3b3a8c)))),0x1;}const _0x3a6e50=await isKeychainAvailable();if(_0x3a6e50){const _0x4ebcf1=await deleteKeychainAPIKey(_0x18b14c);_0x4ebcf1&&console[_0x5e671a(0xeb)](a24_0x58d085[_0x5e671a(0x11c)]('✓')+_0x5e671a(0xf3));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x15f38c(0x10f)]=a24_0x15f38c(0x12b);[a24_0x15f38c(0xf9)]=a24_0x15f38c(0xd2);static ['VALID_KEYS']=[a24_0x15f38c(0x126),'database',a24_0x15f38c(0x118),a24_0x15f38c(0xf7),'llm_agent',a24_0x15f38c(0xf9)];[a24_0x15f38c(0x10d)](_0x1d4498){const _0x4483b7=a24_0x15f38c,{args:_0x5078d4,options:_0x3bd555}=_0x1d4498,_0x15bc5b=_0x3bd555[_0x4483b7(0x105)]||getActiveProfile();if(!_0x15bc5b)return _0x4483b7(0x123);if(_0x5078d4[_0x4483b7(0x11e)]===0x0)return _0x4483b7(0xec)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x19087f=_0x5078d4[0x0];if(!_0x19087f[_0x4483b7(0xe5)]('='))return _0x4483b7(0xd9)+ProfileSetCommand[_0x4483b7(0x114)][_0x4483b7(0x127)](',\x20');const [_0x364a7a]=_0x19087f[_0x4483b7(0xe0)]('=',0x2);if(!ProfileSetCommand[_0x4483b7(0x114)]['includes'](_0x364a7a))return _0x4483b7(0x112)+_0x364a7a+_0x4483b7(0xe1)+ProfileSetCommand[_0x4483b7(0x114)][_0x4483b7(0x127)](',\x20');return undefined;}async['execute'](_0x5ed838){const _0x24e2b5=a24_0x15f38c,{args:_0x293d15,options:_0xf4f2bc}=_0x5ed838,_0x59f83c=_0xf4f2bc[_0x24e2b5(0x105)]||getActiveProfile(),[_0x1e1771,..._0x209101]=_0x293d15[0x0][_0x24e2b5(0xe0)]('='),_0x4bbfad=_0x209101['join']('=');console[_0x24e2b5(0xeb)](a24_0x58d085[_0x24e2b5(0x132)](_0x24e2b5(0x11d)));if(!profileExists(_0x59f83c)){const _0xd18573=await a24_0x7d6644({'type':'confirm','name':_0x24e2b5(0xfe),'message':_0x24e2b5(0xe3)+_0x59f83c+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0xd18573[_0x24e2b5(0xfe)])return console[_0x24e2b5(0xeb)]('Operation\x20cancelled'),0x1;}const _0x21d85d=loadProfile(_0x59f83c),_0x3733a2=_0x21d85d?.[_0x24e2b5(0x12f)]||{};if(_0x1e1771==='site'){const _0x4e0c6e=resolveSite(_0x4bbfad);console['log'](_0x24e2b5(0xe4)+_0x4e0c6e+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x24e2b5(0xeb)](_0x24e2b5(0xe7)),console[_0x24e2b5(0xeb)]('\x20\x20'+getConsoleUrl(_0x4e0c6e,_0x24e2b5(0x134)));const _0x377d06=await a24_0x7d6644({'type':_0x24e2b5(0x13e),'name':_0x24e2b5(0x12d),'message':_0x24e2b5(0xf1),'validate':_0x308f09=>{const _0x33982f=_0x24e2b5;if(!_0x308f09||!_0x308f09['trim']())return _0x33982f(0xfb);return!![];}});if(!_0x377d06[_0x24e2b5(0x12d)])return console[_0x24e2b5(0xeb)](_0x24e2b5(0x135)),0x1;console[_0x24e2b5(0xeb)](_0x24e2b5(0xdf));try{const _0xd7f3af=TDX[_0x24e2b5(0xfe)]({'site':_0x4e0c6e,'apiKey':_0x377d06[_0x24e2b5(0x12d)][_0x24e2b5(0x110)](),'logLevel':_0xf4f2bc['logLevel']??LogLevel[_0x24e2b5(0xf6)]}),_0x5662a9=await _0xd7f3af[_0x24e2b5(0x13d)]['getUserInfo']();console[_0x24e2b5(0xeb)](a24_0x58d085[_0x24e2b5(0x11c)]('✓')+_0x24e2b5(0x11b)+_0x5662a9[_0x24e2b5(0xe8)]+')');const _0x2b92e8=await isKeychainAvailable();_0x2b92e8?(await saveAPIKeyAsync(_0x377d06['apiKey'][_0x24e2b5(0x110)](),_0x4e0c6e,_0x59f83c),console['log'](a24_0x58d085['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x24e2b5(0x11a)](a24_0x58d085[_0x24e2b5(0x125)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3733a2['site']=_0x4e0c6e;}catch(_0xaeb0e9){if(_0xaeb0e9 instanceof HTTPClientError&&_0xaeb0e9[_0x24e2b5(0xe6)]===0x191)return printAuthError(_0xaeb0e9),0x1;return console[_0x24e2b5(0xed)](a24_0x58d085[_0x24e2b5(0xe9)](_0x24e2b5(0xee)+(_0xaeb0e9 instanceof Error?_0xaeb0e9['message']:String(_0xaeb0e9)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x3733a2[_0x1e1771]=_0x4bbfad||undefined;return saveProfileToUserConfig(_0x59f83c,_0x3733a2),console['log'](a24_0x58d085[_0x24e2b5(0x11c)]('✓')+_0x24e2b5(0x115)+_0x59f83c+'\x27\x20updated:\x20'+_0x1e1771+'='+(_0x4bbfad||_0x24e2b5(0xfa))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a24_0x15f38c(0x13c);[a24_0x15f38c(0xf9)]=a24_0x15f38c(0x128);[a24_0x15f38c(0x10d)](_0x37d2d7){const _0x4c5f9a=a24_0x15f38c,{args:_0x464009}=_0x37d2d7;if(_0x464009[_0x4c5f9a(0x11e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x1c89c3){const _0x4cffda=a24_0x15f38c,{args:_0x1957ab,options:_0x26f467}=_0x1c89c3,_0x5e4f0c=_0x1957ab[0x0],_0x3a15ba=_0x26f467['default'];cleanExpiredSessions();if(!profileExists(_0x5e4f0c)){console[_0x4cffda(0xed)](a24_0x58d085[_0x4cffda(0xe9)](_0x4cffda(0xe3)+_0x5e4f0c+_0x4cffda(0xfd))),console['log'](_0x4cffda(0x116));const _0x545f08=listProfiles();if(_0x545f08[_0x4cffda(0x11e)]===0x0)console[_0x4cffda(0xeb)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2edd4 of _0x545f08){console['log'](_0x4cffda(0x11f)+_0x2edd4[_0x4cffda(0x10f)]);}return 0x1;}if(_0x3a15ba){const _0x50bc8e=a24_0x41c9dc[_0x4cffda(0x127)](getConfigDir(),_0x4cffda(0x101));return saveActiveProfileToUserConfig(_0x5e4f0c),console[_0x4cffda(0xeb)](_0x4cffda(0x12e)+a24_0x58d085[_0x4cffda(0x11c)](_0x5e4f0c)),console[_0x4cffda(0xeb)](a24_0x58d085['dim'](_0x4cffda(0x109)+_0x50bc8e)),0x0;}const _0x4ae072=_0x26f467[_0x4cffda(0x10c)]||getCurrentSessionPID()[_0x4cffda(0x138)]();return saveSessionContext({'profile':_0x5e4f0c},_0x26f467[_0x4cffda(0x10c)]),console['log'](_0x4cffda(0x107)+a24_0x58d085['green'](_0x5e4f0c)+'\x20'+a24_0x58d085[_0x4cffda(0x10e)](_0x4cffda(0x100)+_0x4ae072+')')),console[_0x4cffda(0xeb)](a24_0x58d085[_0x4cffda(0x10e)](_0x4cffda(0xf4)+_0x5e4f0c+_0x4cffda(0x10a))),0x0;}}
|
|
1
|
+
const a24_0x37ddaf=a24_0xe478;(function(_0xadb5b7,_0x517284){const _0x46ff77=a24_0xe478,_0x36de53=_0xadb5b7();while(!![]){try{const _0x3c9143=parseInt(_0x46ff77(0x144))/0x1+parseInt(_0x46ff77(0x123))/0x2+-parseInt(_0x46ff77(0x138))/0x3+parseInt(_0x46ff77(0x145))/0x4+parseInt(_0x46ff77(0x10a))/0x5*(parseInt(_0x46ff77(0x11d))/0x6)+-parseInt(_0x46ff77(0x166))/0x7+parseInt(_0x46ff77(0x10b))/0x8*(-parseInt(_0x46ff77(0x143))/0x9);if(_0x3c9143===_0x517284)break;else _0x36de53['push'](_0x36de53['shift']());}catch(_0x47bfa5){_0x36de53['push'](_0x36de53['shift']());}}}(a24_0x261d,0xe91d8));import{BaseCommand,printAuthError}from'./command.js';function a24_0x261d(){const _0x27caf9=['confirm','database','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','select','\x27.\x0a\x0aValid\x20keys:\x20','Enter\x20profile\x20name:','customSite','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','You\x20can\x20find\x20your\x20API\x20key\x20at:','site','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>','execute','✗\x20Validation\x20failed:\x20','red','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','1854865vTOUkT','5121976wYGNqM','profile:use','\x27\x20does\x20not\x20exist.','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','length','(cleared)','status','getUserInfo','llm_project','Set\x20session\x20profile','Operation\x20cancelled','bold','join','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Changing\x20site\x20to\x20\x27','warn','12EAikXL','profile:remove','Removal\x20cancelled','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','us01','1379676EYwWyN','\x0aOperation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','profileName','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20API\x20key\x20is\x20valid\x20(User:\x20','session','\x0aSetup\x20cancelled','\x27\x20removed\x20from\x20configuration','includes','log','Site\x20name\x20cannot\x20be\x20empty','create','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20(no\x20profiles\x20found)','\x27\x20created','\x27\x20updated:\x20','\x20\x20-\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20\x27','ERROR','2251422hSEsJB','email','message','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','green','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','validate','/app/mp/ak','trim','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','9isRriq','1178848OZIZGR','5618884LogHEd','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20your\x20TD\x20API\x20key:','parent_segment','Failed\x20to\x20remove\x20profile:\x20','error','\x0aAvailable\x20profiles:','yellow','logLevel','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx.json','tdx:\x20profile\x20create','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profile','profile:set','default','VALID_KEYS','apiKey','password','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','config','Remove\x20a\x20profile','dim','\x20Profile\x20\x27','Enter\x20description\x20(optional):','name','toString','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','split','text','11688544DSPrAN','profile:create'];a24_0x261d=function(){return _0x27caf9;};return a24_0x261d();}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a24_0xc7054f from'node:path';import{saveSessionContext,getCurrentSessionPID,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{buildSiteChoices}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 a24_0x1386e7 from'prompts';import a24_0x5e02c1 from'chalk';function validateProfileName(_0x41786e){const _0xb934c5=a24_0xe478;if(!_0x41786e||!_0x41786e[_0xb934c5(0x141)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x10d4c7=_0x41786e[_0xb934c5(0x141)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x10d4c7))return _0xb934c5(0x142);if(profileExists(_0x10d4c7))return'Profile\x20\x27'+_0x10d4c7+_0xb934c5(0x152);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x37ddaf(0x15f)]=a24_0x37ddaf(0xfa);['description']='Create\x20a\x20new\x20profile';async[a24_0x37ddaf(0x106)](_0x973f66){const _0x50a386=a24_0x37ddaf,{options:_0x189eca,args:_0x3a19bf}=_0x973f66;console[_0x50a386(0x12d)](a24_0x5e02c1[_0x50a386(0x118)](_0x50a386(0x150)));let _0x3cc3f2;if(_0x3a19bf[_0x50a386(0x111)]>0x0&&_0x3a19bf[0x0]){const _0x7d6478=_0x3a19bf[0x0][_0x50a386(0x141)](),_0x3a3483=validateProfileName(_0x7d6478);if(_0x3a3483!==!![])return console[_0x50a386(0x14a)](a24_0x5e02c1[_0x50a386(0x108)](_0x3a3483)),0x1;_0x3cc3f2=_0x7d6478;}else{const _0x36e627=await a24_0x1386e7({'type':_0x50a386(0x165),'name':_0x50a386(0x126),'message':_0x50a386(0x100),'validate':validateProfileName});if(!_0x36e627[_0x50a386(0x126)])return console[_0x50a386(0x12d)](_0x50a386(0x12a)),0x1;_0x3cc3f2=_0x36e627[_0x50a386(0x126)][_0x50a386(0x141)]();}const _0x186733=await a24_0x1386e7({'type':'text','name':'description','message':_0x50a386(0x15e)}),_0xb8e029=_0x186733['description']?.[_0x50a386(0x141)]()||undefined,_0xd664a9=_0x189eca[_0x50a386(0x104)]||_0x50a386(0x122),{choices:_0x26f1b1,initialIndex:_0x2880f4}=buildSiteChoices(_0xd664a9),_0x4cf20a=await a24_0x1386e7({'type':_0x50a386(0xfe),'name':'site','message':_0x50a386(0x159)+_0x3cc3f2+'\x27:','choices':_0x26f1b1,'initial':_0x2880f4});if(!_0x4cf20a[_0x50a386(0x104)])return console[_0x50a386(0x12d)](_0x50a386(0x12a)),0x1;let _0x3bc517;if(_0x4cf20a['site']==='other'){const _0x225d23=await a24_0x1386e7({'type':'text','name':_0x50a386(0x101),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x292e39=>{const _0x2393b4=_0x50a386;if(!_0x292e39||!_0x292e39['trim']())return _0x2393b4(0x12e);if(!/^[a-z0-9-]+$/['test'](_0x292e39[_0x2393b4(0x141)]()))return _0x2393b4(0x11a);return!![];}});if(!_0x225d23[_0x50a386(0x101)])return console[_0x50a386(0x12d)]('\x0aSetup\x20cancelled'),0x1;_0x3bc517=_0x225d23[_0x50a386(0x101)];}else _0x3bc517=_0x4cf20a['site'];const _0x30ffae=resolveSite(_0x3bc517);console[_0x50a386(0x12d)](_0x50a386(0x13e)+_0x30ffae),console[_0x50a386(0x12d)](_0x50a386(0x103)),console[_0x50a386(0x12d)]('\x20\x20'+getConsoleUrl(_0x30ffae,_0x50a386(0x140)));const _0x50d442=await a24_0x1386e7({'type':_0x50a386(0x158),'name':'apiKey','message':_0x50a386(0x147),'validate':_0x1366f7=>{const _0x252c11=_0x50a386;if(!_0x1366f7||!_0x1366f7[_0x252c11(0x141)]())return _0x252c11(0x125);return!![];}});if(!_0x50d442[_0x50a386(0x157)])return console[_0x50a386(0x12d)](_0x50a386(0x12a)),0x1;const _0x1177ba=_0x50d442['apiKey'];console[_0x50a386(0x12d)](_0x50a386(0x10f));try{const _0x4ac92a=TDX[_0x50a386(0x12f)]({'site':_0x30ffae,'apiKey':_0x1177ba[_0x50a386(0x141)](),'logLevel':_0x189eca['logLevel']??LogLevel['ERROR']}),_0x3d3696=await _0x4ac92a['jobs'][_0x50a386(0x114)]();console[_0x50a386(0x12d)](a24_0x5e02c1[_0x50a386(0x13d)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d3696[_0x50a386(0x139)]+')');const _0xd622e4=await isKeychainAvailable();_0xd622e4?(await saveAPIKeyAsync(_0x1177ba['trim'](),_0x30ffae,_0x3cc3f2),console['log'](a24_0x5e02c1[_0x50a386(0x13d)]('✓')+_0x50a386(0x151)+_0x3cc3f2+')')):(console[_0x50a386(0x11c)](a24_0x5e02c1[_0x50a386(0x14c)](_0x50a386(0x13c))),console[_0x50a386(0x11c)](a24_0x5e02c1[_0x50a386(0x14c)](_0x50a386(0x110))));const _0x1025dd={'site':_0x30ffae,..._0xb8e029&&{'description':_0xb8e029}};return saveProfileToUserConfig(_0x3cc3f2,_0x1025dd),console[_0x50a386(0x12d)](a24_0x5e02c1['green']('✓')+'\x20Profile\x20\x27'+_0x3cc3f2+_0x50a386(0x132)),console['log'](),console[_0x50a386(0x12d)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x50a386(0x12d)](_0x50a386(0x120)+_0x3cc3f2+_0x50a386(0x109)),console[_0x50a386(0x12d)](_0x50a386(0x120)+_0x3cc3f2+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x3b1b33){if(_0x3b1b33 instanceof HTTPClientError&&_0x3b1b33['status']===0x191)return printAuthError(_0x3b1b33),0x1;return console[_0x50a386(0x14a)](a24_0x5e02c1[_0x50a386(0x108)](_0x50a386(0x107)+(_0x3b1b33 instanceof Error?_0x3b1b33[_0x50a386(0x13a)]:String(_0x3b1b33)))),console[_0x50a386(0x14a)](_0x50a386(0x102)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x37ddaf(0x11e);[a24_0x37ddaf(0x13b)]=a24_0x37ddaf(0x15b);['validate'](_0x4d8eb7){const _0x1799cf=a24_0x37ddaf,{args:_0x5936c2}=_0x4d8eb7;if(_0x5936c2[_0x1799cf(0x111)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0x13cad2){const _0x9e53f2=a24_0x37ddaf,{args:_0x4a1db4}=_0x13cad2,_0x332b95=_0x4a1db4[0x0];console['log'](a24_0x5e02c1[_0x9e53f2(0x118)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x332b95)){console[_0x9e53f2(0x14a)](a24_0x5e02c1['red']('Profile\x20\x27'+_0x332b95+_0x9e53f2(0x10d))),console[_0x9e53f2(0x12d)](_0x9e53f2(0x14b));const _0x5bb08c=listProfiles();if(_0x5bb08c['length']===0x0)console[_0x9e53f2(0x12d)](_0x9e53f2(0x131));else for(const _0x54fb1c of _0x5bb08c){console[_0x9e53f2(0x12d)]('\x20\x20-\x20'+_0x54fb1c[_0x9e53f2(0x15f)]);}return 0x1;}const _0xb7e81e=await a24_0x1386e7({'type':_0x9e53f2(0xfb),'name':'confirm','message':_0x9e53f2(0x135)+_0x332b95+'\x27?','initial':![]});if(!_0xb7e81e[_0x9e53f2(0xfb)])return console[_0x9e53f2(0x12d)](_0x9e53f2(0x11f)),0x0;try{removeProfileFromUserConfig(_0x332b95),console['log'](a24_0x5e02c1['green']('✓')+_0x9e53f2(0x15d)+_0x332b95+_0x9e53f2(0x12b));}catch(_0xaaa8ea){return console[_0x9e53f2(0x14a)](a24_0x5e02c1[_0x9e53f2(0x108)](_0x9e53f2(0x149)+(_0xaaa8ea instanceof Error?_0xaaa8ea[_0x9e53f2(0x13a)]:String(_0xaaa8ea)))),0x1;}const _0xd66a1=await isKeychainAvailable();if(_0xd66a1){const _0x1f81d8=await deleteKeychainAPIKey(_0x332b95);_0x1f81d8&&console['log'](a24_0x5e02c1[_0x9e53f2(0x13d)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a24_0x37ddaf(0x154);[a24_0x37ddaf(0x13b)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x37ddaf(0x156)]=[a24_0x37ddaf(0x104),a24_0x37ddaf(0xfc),a24_0x37ddaf(0x148),a24_0x37ddaf(0x115),'llm_agent',a24_0x37ddaf(0x13b)];[a24_0x37ddaf(0x13f)](_0x529b5d){const _0xf9c022=a24_0x37ddaf,{args:_0x1a587c,options:_0x49e133}=_0x529b5d,_0x3b1fac=_0x49e133[_0xf9c022(0x153)]||getActiveProfile();if(!_0x3b1fac)return _0xf9c022(0x105);if(_0x1a587c[_0xf9c022(0x111)]===0x0)return _0xf9c022(0x14e)+ProfileSetCommand[_0xf9c022(0x156)][_0xf9c022(0x119)](',\x20');const _0x3d504a=_0x1a587c[0x0];if(!_0x3d504a[_0xf9c022(0x12c)]('='))return _0xf9c022(0x161)+ProfileSetCommand[_0xf9c022(0x156)][_0xf9c022(0x119)](',\x20');const [_0x23cfd5]=_0x3d504a[_0xf9c022(0x164)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0xf9c022(0x12c)](_0x23cfd5))return'Unknown\x20key\x20\x27'+_0x23cfd5+_0xf9c022(0xff)+ProfileSetCommand[_0xf9c022(0x156)][_0xf9c022(0x119)](',\x20');return undefined;}async[a24_0x37ddaf(0x106)](_0x158b45){const _0xa524ab=a24_0x37ddaf,{args:_0x20e83b,options:_0x1f3c62}=_0x158b45,_0x5794fe=_0x1f3c62[_0xa524ab(0x153)]||getActiveProfile(),[_0x19237b,..._0x7629c4]=_0x20e83b[0x0][_0xa524ab(0x164)]('='),_0x555297=_0x7629c4[_0xa524ab(0x119)]('=');console['log'](a24_0x5e02c1[_0xa524ab(0x118)]('tdx:\x20profile\x20set'));if(!profileExists(_0x5794fe)){const _0x2754e4=await a24_0x1386e7({'type':_0xa524ab(0xfb),'name':'create','message':_0xa524ab(0x136)+_0x5794fe+_0xa524ab(0x130),'initial':!![]});if(!_0x2754e4['create'])return console[_0xa524ab(0x12d)](_0xa524ab(0x117)),0x1;}const _0x126606=loadProfile(_0x5794fe),_0x126e49=_0x126606?.[_0xa524ab(0x15a)]||{};if(_0x19237b===_0xa524ab(0x104)){const _0x29fc19=resolveSite(_0x555297);console[_0xa524ab(0x12d)](_0xa524ab(0x11b)+_0x29fc19+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0xa524ab(0x127)),console[_0xa524ab(0x12d)]('\x20\x20'+getConsoleUrl(_0x29fc19,_0xa524ab(0x140)));const _0x3ce91e=await a24_0x1386e7({'type':_0xa524ab(0x158),'name':_0xa524ab(0x157),'message':_0xa524ab(0x121),'validate':_0x5d9eba=>{const _0x2369c7=_0xa524ab;if(!_0x5d9eba||!_0x5d9eba[_0x2369c7(0x141)]())return _0x2369c7(0x125);return!![];}});if(!_0x3ce91e[_0xa524ab(0x157)])return console[_0xa524ab(0x12d)](_0xa524ab(0x124)),0x1;console['log'](_0xa524ab(0x10f));try{const _0x10e41e=TDX[_0xa524ab(0x12f)]({'site':_0x29fc19,'apiKey':_0x3ce91e['apiKey']['trim'](),'logLevel':_0x1f3c62[_0xa524ab(0x14d)]??LogLevel[_0xa524ab(0x137)]}),_0x515bca=await _0x10e41e['jobs'][_0xa524ab(0x114)]();console[_0xa524ab(0x12d)](a24_0x5e02c1['green']('✓')+_0xa524ab(0x128)+_0x515bca[_0xa524ab(0x139)]+')');const _0x521ce8=await isKeychainAvailable();_0x521ce8?(await saveAPIKeyAsync(_0x3ce91e[_0xa524ab(0x157)][_0xa524ab(0x141)](),_0x29fc19,_0x5794fe),console['log'](a24_0x5e02c1[_0xa524ab(0x13d)]('✓')+_0xa524ab(0x163))):console[_0xa524ab(0x11c)](a24_0x5e02c1[_0xa524ab(0x14c)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x126e49[_0xa524ab(0x104)]=_0x29fc19;}catch(_0x285570){if(_0x285570 instanceof HTTPClientError&&_0x285570[_0xa524ab(0x113)]===0x191)return printAuthError(_0x285570),0x1;return console[_0xa524ab(0x14a)](a24_0x5e02c1[_0xa524ab(0x108)](_0xa524ab(0x107)+(_0x285570 instanceof Error?_0x285570[_0xa524ab(0x13a)]:String(_0x285570)))),console['error'](_0xa524ab(0x162)),0x1;}}else _0x126e49[_0x19237b]=_0x555297||undefined;return saveProfileToUserConfig(_0x5794fe,_0x126e49),console[_0xa524ab(0x12d)](a24_0x5e02c1[_0xa524ab(0x13d)]('✓')+_0xa524ab(0x15d)+_0x5794fe+_0xa524ab(0x133)+_0x19237b+'='+(_0x555297||_0xa524ab(0x112))),0x0;}}function a24_0xe478(_0x3b52c1,_0x845f6){_0x3b52c1=_0x3b52c1-0xfa;const _0x261d07=a24_0x261d();let _0xe478fd=_0x261d07[_0x3b52c1];return _0xe478fd;}export class ProfileUseCommand extends BaseCommand{[a24_0x37ddaf(0x15f)]=a24_0x37ddaf(0x10c);['description']=a24_0x37ddaf(0x116);[a24_0x37ddaf(0x13f)](_0x5ca32a){const _0x8cf876=a24_0x37ddaf,{args:_0x2dd6fe}=_0x5ca32a;if(_0x2dd6fe['length']===0x0)return _0x8cf876(0x146);return undefined;}async[a24_0x37ddaf(0x106)](_0x118182){const _0x345177=a24_0x37ddaf,{args:_0x120c38,options:_0x10c28d}=_0x118182,_0x5493fa=_0x120c38[0x0],_0xee2e95=_0x10c28d[_0x345177(0x155)];cleanExpiredSessions();if(!profileExists(_0x5493fa)){console[_0x345177(0x14a)](a24_0x5e02c1[_0x345177(0x108)](_0x345177(0x136)+_0x5493fa+_0x345177(0x10d))),console['log']('\x0aAvailable\x20profiles:');const _0x307d67=listProfiles();if(_0x307d67[_0x345177(0x111)]===0x0)console[_0x345177(0x12d)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x35597b of _0x307d67){console['log'](_0x345177(0x134)+_0x35597b[_0x345177(0x15f)]);}return 0x1;}if(_0xee2e95){const _0x555b4f=a24_0xc7054f[_0x345177(0x119)](getConfigDir(),_0x345177(0x14f));return saveActiveProfileToUserConfig(_0x5493fa),console[_0x345177(0x12d)](_0x345177(0x10e)+a24_0x5e02c1[_0x345177(0x13d)](_0x5493fa)),console[_0x345177(0x12d)](a24_0x5e02c1[_0x345177(0x15c)]('\x0aSaved\x20to:\x20'+_0x555b4f)),0x0;}const _0x50fa14=_0x10c28d[_0x345177(0x129)]||getCurrentSessionPID()[_0x345177(0x160)]();return saveSessionContext({'profile':_0x5493fa},_0x10c28d['session']),console[_0x345177(0x12d)]('Session\x20profile\x20set\x20to:\x20'+a24_0x5e02c1[_0x345177(0x13d)](_0x5493fa)+'\x20'+a24_0x5e02c1['dim']('(session:\x20'+_0x50fa14+')')),console[_0x345177(0x12d)](a24_0x5e02c1[_0x345177(0x15c)](_0x345177(0xfd)+_0x5493fa+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x572719=a25_0x5caf;function a25_0x5caf(_0x1aee2a,_0xa1a18d){_0x1aee2a=_0x1aee2a-0x190;const _0x4b62e3=a25_0x4b62();let _0x5caf2a=_0x4b62e3[_0x1aee2a];return _0x5caf2a;}(function(_0x41323d,_0x1faf8b){const _0x5e76f2=a25_0x5caf,_0x570779=_0x41323d();while(!![]){try{const _0x26fd9e=parseInt(_0x5e76f2(0x198))/0x1+parseInt(_0x5e76f2(0x193))/0x2*(parseInt(_0x5e76f2(0x19e))/0x3)+-parseInt(_0x5e76f2(0x190))/0x4+parseInt(_0x5e76f2(0x19b))/0x5*(-parseInt(_0x5e76f2(0x194))/0x6)+parseInt(_0x5e76f2(0x197))/0x7*(-parseInt(_0x5e76f2(0x1a4))/0x8)+-parseInt(_0x5e76f2(0x19a))/0x9*(-parseInt(_0x5e76f2(0x19d))/0xa)+parseInt(_0x5e76f2(0x1a8))/0xb;if(_0x26fd9e===_0x1faf8b)break;else _0x570779['push'](_0x570779['shift']());}catch(_0x1dccc0){_0x570779['push'](_0x570779['shift']());}}}(a25_0x4b62,0xc968b));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x4b62(){const _0x3e9669=['scope','7800DbeaQi','execute','map','description','2555201xQVZGl','4668672QTZjeG','length','message','15574fGGAGK','242922ShxQog','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','5509ntZWXJ','1215029vYspFW','Error:\x20','9EmGFFQ','75VvsKib','error','5722980NVsxvE','519FgWnhm','\x20\x20Global:\x20~/.config/tdx/tdx.json','List\x20all\x20available\x20profiles','log','config'];a25_0x4b62=function(){return _0x3e9669;};return a25_0x4b62();}export class ProfilesCommand extends BaseCommand{[a25_0x572719(0x196)]='profiles';['description']=a25_0x572719(0x1a0);async[a25_0x572719(0x1a5)](_0x125be6){const _0x98a00=a25_0x572719,{options:_0x38b3c7}=_0x125be6;try{const _0x3f3526=listProfiles(),_0x22c7eb=getActiveProfile();if(_0x3f3526[_0x98a00(0x191)]===0x0)return console[_0x98a00(0x1a1)](_0x98a00(0x195)),console[_0x98a00(0x1a1)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x98a00(0x1a1)](_0x98a00(0x19f)),0x0;const _0x3666af=_0x3f3526[_0x98a00(0x1a6)](_0x578081=>{const _0x2c3406=_0x98a00,_0x58bec6=_0x578081[_0x2c3406(0x196)]===_0x22c7eb,_0x4e4660=getProfileParams(_0x578081[_0x2c3406(0x1a2)]);return{'name':_0x578081[_0x2c3406(0x196)],'active':_0x58bec6,'scope':_0x578081[_0x2c3406(0x1a3)],'description':_0x578081[_0x2c3406(0x1a2)][_0x2c3406(0x1a7)]||'','params':_0x4e4660};});return await handleSDKOutput(_0x3666af,_0x38b3c7),0x0;}catch(_0x34a346){return _0x34a346 instanceof Error&&console[_0x98a00(0x19c)](_0x98a00(0x199)+_0x34a346[_0x98a00(0x192)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a26_0x194c02=a26_0x6a16;(function(_0x37a668,_0x2c2d81){const _0x69c576=a26_0x6a16,_0x164895=_0x37a668();while(!![]){try{const _0x9d351d=parseInt(_0x69c576(0x175))/0x1*(-parseInt(_0x69c576(0x178))/0x2)+parseInt(_0x69c576(0x17d))/0x3*(parseInt(_0x69c576(0x16d))/0x4)+parseInt(_0x69c576(0x162))/0x5*(-parseInt(_0x69c576(0x16b))/0x6)+-parseInt(_0x69c576(0x16e))/0x7+parseInt(_0x69c576(0x16a))/0x8+parseInt(_0x69c576(0x15f))/0x9+parseInt(_0x69c576(0x16f))/0xa;if(_0x9d351d===_0x2c2d81)break;else _0x164895['push'](_0x164895['shift']());}catch(_0xa829fa){_0x164895['push'](_0x164895['shift']());}}}(a26_0xe8fe,0x2e5df));function a26_0xe8fe(){const _0x5068ed=['Site:\x20','Statement\x20','1564136qWXFXn','12114AkYfaT','message','52DGDDup','2240882SYqYQC','1245560sunUKq','SQL:\x20','state','error','No\x20SQL\x20provided','\x20rows\x20','383YsgHFw','output','data','1398ytLxQy','Executing\x20query\x20[','database','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','completedSplits','53001ZAyjTC','\x20-\x20','\x20[Job\x20ID:\x20','setPhase','execute','originalMessage','Catalog:\x20','\x0aAll\x20results\x20saved\x20to\x20','Error:\x20','totalSplits','verbose','file','jobId','\x20splits','processedRows','query','Schema:\x20','...','name','3396816BoYyzA','Executing\x20query...','elapsedTimeMillis','370jCfaan','stats','args','Executing\x20statement\x20','validate','length'];a26_0xe8fe=function(){return _0x5068ed;};return a26_0xe8fe();}function a26_0x6a16(_0x1e4dd0,_0x501193){_0x1e4dd0=_0x1e4dd0-0x14e;const _0xe8fe81=a26_0xe8fe();let _0x6a167c=_0xe8fe81[_0x1e4dd0];return _0x6a167c;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a26_0x194c02(0x15e)]=a26_0x194c02(0x15b);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a26_0x194c02(0x150)](_0x81325){const _0xa8773a=a26_0x194c02,{options:_0x439ad2,args:_0x556c65,tdx:_0x24685b}=_0x81325,_0x21311a=_0x556c65[0x0],_0x531202=_0x439ad2[_0xa8773a(0x157)];let _0x5604f6;try{if(_0x531202)_0x5604f6=readSqlStatementsFromFile(_0x531202);else{if(_0x21311a==='-')_0x5604f6=await readSqlStatementsFromStdin();else{if(_0x21311a&&isSqlFilePath(_0x21311a))_0x5604f6=readSqlStatementsFromFile(_0x21311a);else{if(_0x21311a)_0x5604f6=splitSqlStatements(_0x21311a);else throw new Error(_0xa8773a(0x173));}}}}catch(_0x2decc8){return console[_0xa8773a(0x172)](_0xa8773a(0x154)+_0x2decc8[_0xa8773a(0x16c)]),0x1;}const _0x197ef0=_0x439ad2[_0xa8773a(0x17a)]||'information_schema',_0x68b7a=_0x439ad2['catalog'];try{const _0x34c904=[],_0x5c78c3=!!_0x439ad2[_0xa8773a(0x176)];for(let _0x3ba9f5=0x0;_0x3ba9f5<_0x5604f6[_0xa8773a(0x167)];_0x3ba9f5++){const _0x24022d=_0x5604f6[_0x3ba9f5],_0x117bb2=_0x3ba9f5+0x1,_0x549dee=_0x5604f6[_0xa8773a(0x167)],_0x19db61=_0x549dee>0x1;_0x439ad2[_0xa8773a(0x156)]&&(console['error']('\x0a'+(_0x19db61?_0xa8773a(0x169)+_0x117bb2+'/'+_0x549dee+':':'')),console[_0xa8773a(0x172)](_0xa8773a(0x168)+_0x439ad2['site']),console[_0xa8773a(0x172)](_0xa8773a(0x152)+(_0x68b7a||'td')),console[_0xa8773a(0x172)](_0xa8773a(0x15c)+_0x197ef0),console[_0xa8773a(0x172)](_0xa8773a(0x170)+_0x24022d));const _0x5e50bf=_0x19db61?_0xa8773a(0x165)+_0x117bb2+'/'+_0x549dee+_0xa8773a(0x15d):_0xa8773a(0x160);try{const _0x6ef3b3=await withProgressSpinner(_0x5e50bf,async _0x1f8fbc=>{const _0x55aa52=_0xa8773a,_0x3b2241=await _0x24685b['query'][_0x55aa52(0x150)](_0x24022d,{'catalog':_0x68b7a,'schema':_0x197ef0,'onJobId':_0x1c9471=>{_0x1f8fbc['setJobId'](_0x1c9471);},'onProgress':_0x3c5264=>{const _0x523da0=_0x55aa52;_0x1f8fbc[_0x523da0(0x14f)](_0x523da0(0x179)+_0x3c5264[_0x523da0(0x171)]+']'),_0x1f8fbc['setExtra'](formatRows(_0x3c5264[_0x523da0(0x15a)])+_0x523da0(0x174)+_0x3c5264[_0x523da0(0x17c)]+'/'+_0x3c5264[_0x523da0(0x155)]+_0x523da0(0x159));}});return _0x3b2241;},{'verbose':_0x439ad2['verbose']}),_0x37d0cb=_0x6ef3b3[_0xa8773a(0x177)],_0x4febbc=_0x37d0cb['jobId']?_0xa8773a(0x14e)+_0x37d0cb[_0xa8773a(0x158)]+']':'',_0x5c4336=_0x19db61?_0xa8773a(0x169)+_0x117bb2+'/'+_0x549dee+_0xa8773a(0x17e):'';console[_0xa8773a(0x172)]('✔\x20'+_0x5c4336+'Query\x20completed:\x20Processed\x20'+formatRows(_0x37d0cb[_0xa8773a(0x163)]['processedRows'])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x37d0cb['stats'][_0xa8773a(0x161)])+_0x4febbc));if(_0x19db61&&_0x5c78c3){const _0x57c47=resolveOutputOptions(_0x439ad2),_0x35e53c=await formatQueryOutput(_0x37d0cb,_0x57c47);_0x34c904['push'](_0x35e53c);}else await handleQueryOutput(_0x37d0cb,_0x439ad2);}catch(_0x4ecd09){const _0x35a345=_0x19db61?'Statement\x20'+_0x117bb2+'/'+_0x549dee+':\x0a':'',_0x2e2a5d=_0x4ecd09 instanceof SDKError?_0x4ecd09[_0xa8773a(0x151)]:_0x4ecd09[_0xa8773a(0x16c)];return console[_0xa8773a(0x172)](''+_0x35a345+_0x2e2a5d),0x1;}}if(_0x5604f6[_0xa8773a(0x167)]>0x1&&_0x5c78c3&&_0x34c904[_0xa8773a(0x167)]>0x0){const _0x56d07d=_0x34c904['join']('\x0a');writeFileSync(_0x439ad2[_0xa8773a(0x176)],_0x56d07d),console[_0xa8773a(0x172)](_0xa8773a(0x153)+_0x439ad2[_0xa8773a(0x176)]);}return 0x0;}catch(_0x310d62){throw _0x310d62;}}[a26_0x194c02(0x166)](_0x127fa6){const _0x273b07=a26_0x194c02,_0xd7c87a=_0x127fa6[_0x273b07(0x164)][0x0],_0x12c97f=_0x127fa6['options'][_0x273b07(0x157)];if(!_0xd7c87a&&!_0x12c97f)return _0x273b07(0x17b);if(_0xd7c87a&&_0x12c97f)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|