@treasuredata/tdx 0.8.12 → 0.9.1
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 +2 -2
- package/dist/cli-categories.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.d.ts +88 -0
- package/dist/client/llm-api-client.d.ts.map +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/llm-api-client.js.map +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts +32 -0
- package/dist/commands/agent-command.d.ts.map +1 -0
- package/dist/commands/agent-command.js +1 -0
- package/dist/commands/agent-command.js.map +1 -0
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.d.ts +3 -2
- package/dist/commands/chat-command.d.ts.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/chat-command.js.map +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/context-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/llm-command.d.ts +8 -4
- package/dist/commands/llm-command.d.ts.map +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-command.js.map +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-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/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.d.ts +1 -0
- package/dist/commands/use-command.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +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/config.d.ts +32 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.d.ts +1 -0
- package/dist/core/global-context.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.d.ts +1 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/session.js.map +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.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/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +386 -0
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -0
- package/dist/sdk/agent/agent-yaml.js +1 -0
- package/dist/sdk/agent/agent-yaml.js.map +1 -0
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.d.ts +4 -0
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.d.ts +114 -0
- package/dist/sdk/llm.d.ts.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/llm.js.map +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.d.ts +17 -0
- package/dist/types/endpoints.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/endpoints.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/llm.d.ts +203 -0
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/utils/agent-config.d.ts +124 -0
- package/dist/utils/agent-config.d.ts.map +1 -0
- package/dist/utils/agent-config.js +1 -0
- package/dist/utils/agent-config.js.map +1 -0
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.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/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.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-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a28_0x1588(){const _0x385464=['created\x20on-demand\x20per\x20model','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','8DhTEaY','625828kyvXGF','description','2997444ORVIKp','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','log','http://0.0.0.0:','projects','12UAMrZz','llmProject','\x20\x20Site:','8641791IykauK','find','stop','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','llm:proxy','start','exit','yellow','green','SIGINT','white','\x20\x20Agents:','Server\x20Configuration:','58782Lvuxxz','\x20is\x20unavailable,\x20using\x20port\x20','name','NOT_FOUND','server','\x0aClaude\x20Code\x20Configuration:','dim','4307670SFvBeY','logger','site','execute','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','Resolving\x20project...','Starting\x20proxy\x20server...','llm','3882oqECRP','cyan','bold','close','468000jHJQVO','project','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','logLevel','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','✓\x20Proxy\x20server\x20stopped','Project\x20\x27','\x20\x20\x20\x20}','\x20\x20Project:','\x20\x20}','3682mWUVYK','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','attributes','Port\x20','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x0a\x0aShutting\x20down\x20proxy\x20server...'];a28_0x1588=function(){return _0x385464;};return a28_0x1588();}const a28_0x4c5f0e=a28_0x509f;(function(_0x133bbc,_0x994bf6){const _0x428ffe=a28_0x509f,_0x25fee4=_0x133bbc();while(!![]){try{const _0x1d7a48=-parseInt(_0x428ffe(0xe2))/0x1+parseInt(_0x428ffe(0xf9))/0x2*(-parseInt(_0x428ffe(0xe9))/0x3)+parseInt(_0x428ffe(0xe4))/0x4+-parseInt(_0x428ffe(0x100))/0x5+-parseInt(_0x428ffe(0xcb))/0x6*(-parseInt(_0x428ffe(0xd9))/0x7)+parseInt(_0x428ffe(0xe1))/0x8*(parseInt(_0x428ffe(0xec))/0x9)+parseInt(_0x428ffe(0xcf))/0xa;if(_0x1d7a48===_0x994bf6)break;else _0x25fee4['push'](_0x25fee4['shift']());}catch(_0x3df871){_0x25fee4['push'](_0x25fee4['shift']());}}}(a28_0x1588,0x780ec));import a28_0x5e9362 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';function a28_0x509f(_0x4c2bd4,_0x27d686){_0x4c2bd4=_0x4c2bd4-0xca;const _0x1588cc=a28_0x1588();let _0x509f08=_0x1588cc[_0x4c2bd4];return _0x509f08;}import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1c0abd,_0x50904f){const _0x56568a=a28_0x509f,{tdx:_0x495d82,options:_0x530f41}=_0x1c0abd,_0x3c163d=_0x50904f||_0x530f41[_0x56568a(0xea)];if(_0x3c163d){const _0x16b940=await _0x495d82[_0x56568a(0xca)][_0x56568a(0xe8)](),_0x1cfe49=_0x16b940['find'](_0x2aacc9=>_0x2aacc9[_0x56568a(0xdb)][_0x56568a(0xfb)]===_0x3c163d);if(!_0x1cfe49)throw new SDKError(ErrorCode[_0x56568a(0xfc)],_0x56568a(0xd5)+_0x3c163d+'\x27\x20not\x20found',undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x1cfe49['id'];}const _0x8f0548=await _0x495d82[_0x56568a(0xca)]['getOrCreateDefaultProject']();return _0x8f0548['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x4c5f0e(0xfb)]=a28_0x4c5f0e(0xf0);[a28_0x4c5f0e(0xe3)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a28_0x4c5f0e(0xfd)];['logger'];async[a28_0x4c5f0e(0x103)](_0x2a4608){const _0x257d1e=a28_0x4c5f0e,{tdx:_0x496572,options:_0x3dd490}=_0x2a4608;try{const _0x3129b9=_0x3dd490,_0x38efd0=_0x3129b9['port']||0xfa0,_0x1ecc7a=_0x3129b9[_0x257d1e(0xd0)],_0xa1bb17=await findAvailablePort(_0x38efd0);console['log'](a28_0x5e9362['dim'](_0x257d1e(0x105)));const _0xcab8a7=await getProjectIdOrDefault(_0x2a4608,_0x1ecc7a),_0x257488=await _0x496572['llm'][_0x257d1e(0xe8)](),_0x17c654=_0x257488[_0x257d1e(0xed)](_0x1775cf=>_0x1775cf['id']===_0xcab8a7);this[_0x257d1e(0x101)]=new TDXLogger(_0x3dd490[_0x257d1e(0xd2)]),await this[_0x257d1e(0x101)]['init'](),console[_0x257d1e(0xe6)](a28_0x5e9362['dim'](_0x257d1e(0x106)));_0xa1bb17!==_0x38efd0&&console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)](_0x257d1e(0xdc)+_0x38efd0+_0x257d1e(0xfa)+_0xa1bb17));this['server']=new ProxyServer({'port':_0xa1bb17,'projectId':_0xcab8a7,'tdx':_0x496572,'logger':this[_0x257d1e(0x101)],'site':_0x3dd490[_0x257d1e(0x102)]}),await this[_0x257d1e(0xfd)][_0x257d1e(0xf1)](),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)][_0x257d1e(0xcd)](_0x257d1e(0xe0))),console['log'](a28_0x5e9362['yellow'](_0x257d1e(0xda))),console['log'](a28_0x5e9362['yellow']('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf4)]['bold'](_0x257d1e(0xd1))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xcc)](_0x257d1e(0xf8))),console[_0x257d1e(0xe6)](a28_0x5e9362['dim']('\x20\x20Address:'),a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xe7)+_0xa1bb17)),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xd7)),a28_0x5e9362['white'](_0x17c654?.[_0x257d1e(0xdb)][_0x257d1e(0xfb)]||_0xcab8a7)),console['log'](a28_0x5e9362['dim'](_0x257d1e(0xf7)),a28_0x5e9362['white'](_0x257d1e(0xdf))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xeb)),a28_0x5e9362[_0x257d1e(0xf6)](_0x3dd490['site'])),console['log'](a28_0x5e9362[_0x257d1e(0xcc)](_0x257d1e(0xfe))),console[_0x257d1e(0xe6)](a28_0x5e9362['dim'](_0x257d1e(0xd3))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)]('\x20\x20{')),console[_0x257d1e(0xe6)](a28_0x5e9362['white']('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xe5)+_0xa1bb17+'\x22,')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xdd))),console[_0x257d1e(0xe6)](a28_0x5e9362['white'](_0x257d1e(0x104))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xd6))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xd8))),console['log'](a28_0x5e9362['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xef))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x257d1e(0xe6)](a28_0x5e9362['dim']('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x1af664=async()=>{const _0x29f965=_0x257d1e;console[_0x29f965(0xe6)](a28_0x5e9362[_0x29f965(0xff)](_0x29f965(0xde))),this[_0x29f965(0xfd)]&&await this[_0x29f965(0xfd)][_0x29f965(0xee)](),this[_0x29f965(0x101)]&&await this[_0x29f965(0x101)][_0x29f965(0xce)](),console['log'](a28_0x5e9362[_0x29f965(0xf4)](_0x29f965(0xd4))),process[_0x29f965(0xf2)](0x0);};return process['on'](_0x257d1e(0xf5),_0x1af664),process['on']('SIGTERM',_0x1af664),await new Promise(()=>{}),0x0;}catch(_0xd3ccc){this[_0x257d1e(0xfd)]&&await this[_0x257d1e(0xfd)][_0x257d1e(0xee)]();this['logger']&&await this[_0x257d1e(0x101)][_0x257d1e(0xce)]();throw _0xd3ccc;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a28_0x1ef526=a28_0x3711;(function(_0x1c4a9e,_0x57262f){const _0x33d447=a28_0x3711,_0x39e76b=_0x1c4a9e();while(!![]){try{const _0xd52d42=parseInt(_0x33d447(0xa4))/0x1+parseInt(_0x33d447(0xe8))/0x2*(parseInt(_0x33d447(0xff))/0x3)+-parseInt(_0x33d447(0xcb))/0x4*(-parseInt(_0x33d447(0xc8))/0x5)+-parseInt(_0x33d447(0xe0))/0x6+parseInt(_0x33d447(0x10c))/0x7+-parseInt(_0x33d447(0x12f))/0x8+-parseInt(_0x33d447(0x11b))/0x9;if(_0xd52d42===_0x57262f)break;else _0x39e76b['push'](_0x39e76b['shift']());}catch(_0x565cd7){_0x39e76b['push'](_0x39e76b['shift']());}}}(a28_0x2fd5,0x87c4a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a28_0x5b63fd from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a28_0x57be94 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a28_0x1ef526(0x14b),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x129624){const _0x5ab9a7=a28_0x1ef526,_0x219903=process[_0x5ab9a7(0x15d)],_0x568462=_0x219903===_0x5ab9a7(0x163)?_0x5ab9a7(0x91):_0x219903===_0x5ab9a7(0x19c)?_0x5ab9a7(0x17d):_0x5ab9a7(0xd3);spawn(_0x568462,[_0x129624],{'detached':!![],'stdio':_0x5ab9a7(0xfb)})['unref']();}function migrateLegacyDirectory(){const _0x45381a=a28_0x1ef526;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x33e354=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x33e354[_0x45381a(0x1a3)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x45381a(0xc2)](a28_0x57be94[_0x45381a(0xe7)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x45381a(0x19e)+PARENT_SEGMENT_DIR+_0x45381a(0x19d))),console[_0x45381a(0xc2)](a28_0x57be94[_0x45381a(0x173)](_0x45381a(0xf5)+LEGACY_PARENT_SEGMENT_DIR+_0x45381a(0xaf))),![];console[_0x45381a(0xc2)](a28_0x57be94[_0x45381a(0xe7)](_0x45381a(0xe9)+LEGACY_PARENT_SEGMENT_DIR+_0x45381a(0x154)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x45381a(0xc2)](a28_0x57be94['green'](_0x45381a(0x9c)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x34bee7){const _0x2334fd=_0x34bee7 instanceof Error?_0x34bee7[_0x45381a(0x16f)]:String(_0x34bee7);return console[_0x45381a(0xc2)](a28_0x57be94[_0x45381a(0x17a)](_0x45381a(0x185)+_0x2334fd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x4b00ab){return migrateLegacyDirectory(),super['run'](_0x4b00ab);}}function resolveYamlFile(_0x24c47a){const _0x467ca7=a28_0x1ef526;if(_0x24c47a['endsWith']('.yml')||_0x24c47a[_0x467ca7(0x102)](_0x467ca7(0x9e)))return _0x24c47a;return a28_0x5b63fd[_0x467ca7(0xea)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x24c47a)+_0x467ca7(0x128));}function formatProgressMessage(_0x44edc4){const _0x555081=a28_0x1ef526,_0x396f43=_0x44edc4[_0x555081(0xb6)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x396f43){const [,_0x50d054,_0x5606d5,_0x186bec='']=_0x396f43;return a28_0x57be94[_0x555081(0x173)](_0x50d054+':')+'\x20'+_0x5606d5+a28_0x57be94[_0x555081(0x173)](_0x186bec);}return a28_0x57be94[_0x555081(0x173)](_0x44edc4);}function showFileNotFoundError(_0x53feb7,_0x1485dd){const _0x545531=a28_0x1ef526;console[_0x545531(0xc2)](a28_0x57be94[_0x545531(0x17a)](_0x545531(0x179)+_0x53feb7+'\x0a')),console[_0x545531(0xc2)](a28_0x57be94[_0x545531(0xce)](_0x545531(0x15a)+_0x1485dd+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x1f14d7){const _0x31b058=a28_0x1ef526;console['error'](a28_0x57be94[_0x31b058(0xe7)](_0x31b058(0x14c))),console[_0x31b058(0xc2)](_0x1f14d7);}export class ParentSegmentListCommand extends BaseCommand{[a28_0x1ef526(0x16b)]=a28_0x1ef526(0x152);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x189);async[a28_0x1ef526(0x190)](_0x2b6b2e){const _0x15eb0b=a28_0x1ef526,{options:_0x5003b4,args:_0x4a80dc,tdx:_0x128fd1}=_0x2b6b2e,_0x17fa3f=_0x4a80dc[0x0];_0x5003b4[_0x15eb0b(0x180)]&&(console[_0x15eb0b(0xc2)](_0x15eb0b(0x140)+_0x5003b4[_0x15eb0b(0x12d)]),_0x17fa3f&&console['error'](_0x15eb0b(0xd8)+_0x17fa3f));const _0x4d2121=await withSpinner(_0x17fa3f?_0x15eb0b(0x15f)+_0x17fa3f+_0x15eb0b(0x164):_0x15eb0b(0x1a0),()=>_0x128fd1[_0x15eb0b(0x123)]['listParents'](),{'verbose':_0x5003b4[_0x15eb0b(0x180)]});let _0x75743=_0x4d2121[_0x15eb0b(0x178)];if(_0x17fa3f){const _0x2fad78=_0x17fa3f[_0x15eb0b(0x153)](/[.+^${}()|[\]\\]/g,_0x15eb0b(0x191))['replace'](/\*/g,'.*')[_0x15eb0b(0x153)](/\?/g,'.'),_0x7888c0=new RegExp('^'+_0x2fad78+'$','i');_0x75743=_0x75743[_0x15eb0b(0x13d)](_0x583288=>_0x7888c0[_0x15eb0b(0xc3)](_0x583288[_0x15eb0b(0x113)][_0x15eb0b(0x16b)]));}_0x75743['sort']((_0x33368d,_0x593e3e)=>_0x33368d[_0x15eb0b(0x113)]['name'][_0x15eb0b(0xf1)](_0x593e3e[_0x15eb0b(0x113)][_0x15eb0b(0x16b)])),console[_0x15eb0b(0xc2)](_0x15eb0b(0x165)+_0x75743[_0x15eb0b(0xdf)]+'\x20parent\x20segment'+(_0x75743[_0x15eb0b(0xdf)]!==0x1?'s':''));if(_0x5003b4[_0x15eb0b(0x133)]===_0x15eb0b(0x132)||_0x5003b4[_0x15eb0b(0x133)]==='jsonl')await handleSDKOutput(_0x75743,_0x5003b4);else{if(_0x75743['length']===0x0)_0x17fa3f?console[_0x15eb0b(0xbf)](_0x15eb0b(0x8c)+_0x17fa3f):console[_0x15eb0b(0xbf)]('No\x20parent\x20segments\x20found');else for(const _0x1754e8 of _0x75743){const _0x2eeda3=_0x1754e8[_0x15eb0b(0x113)]['population']?a28_0x57be94[_0x15eb0b(0x173)]('\x20('+formatRows(_0x1754e8[_0x15eb0b(0x113)][_0x15eb0b(0x18e)])+')'):'';console[_0x15eb0b(0xbf)](_0x15eb0b(0x188)+_0x1754e8[_0x15eb0b(0x113)][_0x15eb0b(0x16b)]+_0x2eeda3);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a28_0x1ef526(0x16b)]=a28_0x1ef526(0x105);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x106);async[a28_0x1ef526(0x190)](_0x4d51d4){const _0x4c736c=a28_0x1ef526,{options:_0x1406b2,args:_0x4a8c71,tdx:_0x2e898e}=_0x4d51d4;console[_0x4c736c(0xc2)](_0x4c736c(0x15b)+_0x4c736c(0x12e)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x42e792=_0x1406b2;if(_0x4a8c71[_0x4c736c(0xdf)]===0x0)return console[_0x4c736c(0xc2)](a28_0x57be94[_0x4c736c(0x17a)](_0x4c736c(0x10b))),console[_0x4c736c(0xc2)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x505828=_0x4a8c71[0x0];if(!_0x42e792[_0x4c736c(0x15c)]||!_0x42e792[_0x4c736c(0xa7)])return console[_0x4c736c(0xc2)](_0x4c736c(0x129)),console[_0x4c736c(0xc2)](_0x4c736c(0x195)),0x1;_0x42e792[_0x4c736c(0x180)]&&(console[_0x4c736c(0xc2)](_0x4c736c(0x140)+_0x42e792[_0x4c736c(0x12d)]),console[_0x4c736c(0xc2)](_0x4c736c(0xb0)+_0x505828),console[_0x4c736c(0xc2)](_0x4c736c(0x11f)+_0x42e792[_0x4c736c(0x15c)]),console[_0x4c736c(0xc2)](_0x4c736c(0x103)+_0x42e792[_0x4c736c(0xa7)]));const _0x4c2c38=await loadJSONFromOptions(_0x42e792[_0x4c736c(0x113)],_0x42e792['attributesFile']),_0x403738=await loadJSONFromOptions(_0x42e792['behaviors'],_0x42e792[_0x4c736c(0x174)]),_0x33a3ac=await loadJSONFromOptions(_0x42e792[_0x4c736c(0x93)],_0x42e792[_0x4c736c(0xe2)]),_0x1b0654={'name':_0x505828,'description':_0x42e792[_0x4c736c(0x10e)],'scheduleType':_0x42e792[_0x4c736c(0x14f)],'scheduleOption':_0x42e792[_0x4c736c(0xe4)],'timezone':_0x42e792['timezone'],'master':{'parentDatabaseName':_0x42e792[_0x4c736c(0x15c)],'parentTableName':_0x42e792['table']},'attributes':_0x4c2c38,'behaviors':_0x403738,'customerGroup':_0x33a3ac},_0x221761=await withSpinner(_0x4c736c(0xef)+_0x505828+_0x4c736c(0x164),()=>_0x2e898e[_0x4c736c(0x123)]['createParent'](_0x1b0654),{'verbose':_0x1406b2[_0x4c736c(0x180)]}),_0xd67118=_0x221761[_0x4c736c(0x178)];return console[_0x4c736c(0xc2)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0xd67118[_0x4c736c(0x16b)]+_0x4c736c(0x14d)+_0xd67118['id']),await handleSDKOutput([_0xd67118],_0x1406b2),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a28_0x1ef526(0x16b)]=a28_0x1ef526(0x17f);['description']=a28_0x1ef526(0xc6);async[a28_0x1ef526(0x190)](_0x4e0562){const _0x14399c=a28_0x1ef526,{options:_0x42d430,args:_0x22294d,tdx:_0x4abe4a}=_0x4e0562;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x14399c(0x12e)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x2eeeb3=_0x42d430;if(_0x22294d[_0x14399c(0xdf)]===0x0)return console['error'](a28_0x57be94[_0x14399c(0x17a)](_0x14399c(0x10b))),console[_0x14399c(0xc2)](_0x14399c(0xdc)),0x1;const _0x30c1d2=_0x22294d[0x0];_0x2eeeb3[_0x14399c(0x180)]&&(console['error'](_0x14399c(0x140)+_0x2eeeb3['site']),console[_0x14399c(0xc2)](_0x14399c(0x172)+_0x30c1d2));const _0x39af14=await withSpinner(_0x14399c(0x17c)+_0x30c1d2+_0x14399c(0x164),()=>_0x4abe4a[_0x14399c(0x123)][_0x14399c(0xd2)](_0x30c1d2),{'verbose':_0x2eeeb3[_0x14399c(0x180)]}),_0x3d262b=_0x39af14[_0x14399c(0x178)],_0xafb03c=await loadJSONFromOptions(_0x2eeeb3['addAttributes'],_0x2eeeb3[_0x14399c(0x127)]),_0x47766c=await loadJSONFromOptions(_0x2eeeb3[_0x14399c(0x107)],_0x2eeeb3['addBehaviorsFile']),_0x389756={'name':_0x3d262b[_0x14399c(0x16b)],'description':_0x2eeeb3[_0x14399c(0x10e)]!==undefined?_0x2eeeb3['description']:_0x3d262b['description'],'scheduleType':_0x2eeeb3[_0x14399c(0x14f)]!==undefined?_0x2eeeb3[_0x14399c(0x14f)]:_0x3d262b[_0x14399c(0x14f)],'scheduleOption':_0x2eeeb3[_0x14399c(0xe4)]!==undefined?_0x2eeeb3[_0x14399c(0xe4)]:_0x3d262b[_0x14399c(0xe4)],'timezone':_0x2eeeb3['timezone']!==undefined?_0x2eeeb3[_0x14399c(0x17e)]:_0x3d262b['timezone'],'master':_0x3d262b['master'],'attributes':_0xafb03c?[..._0x3d262b[_0x14399c(0x113)]||[],..._0xafb03c]:_0x3d262b[_0x14399c(0x113)],'behaviors':_0x47766c?[..._0x3d262b['behaviors']||[],..._0x47766c]:_0x3d262b[_0x14399c(0x95)],'customerGroup':_0x3d262b[_0x14399c(0x93)]},_0x4e1af5=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x30c1d2+_0x14399c(0x164),()=>_0x4abe4a[_0x14399c(0x123)][_0x14399c(0x121)](_0x30c1d2,_0x389756),{'verbose':_0x2eeeb3[_0x14399c(0x180)]}),_0xc72f73=_0x4e1af5['data'];return console[_0x14399c(0xc2)](_0x14399c(0x183)+_0xc72f73[_0x14399c(0x16b)]+'\x27'),await handleSDKOutput([_0xc72f73],_0x2eeeb3),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';[a28_0x1ef526(0x10e)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a28_0x1ef526(0x190)](_0x4ccfcb){const _0x5becb3=a28_0x1ef526,{options:_0x1aad01,args:_0xda891d,tdx:_0x10b7f2}=_0x4ccfcb,_0x1f1829=_0x1aad01,_0x3cd26c=_0xda891d[0x0]||_0x1aad01['parentSegment'];if(!_0x3cd26c)return showParentSegmentNotSetError(_0x5becb3(0x142)+_0x5becb3(0x101)),0x1;if(_0x1f1829[_0x5becb3(0xee)]&&_0x1f1829[_0x5becb3(0x169)])return console[_0x5becb3(0xc2)](a28_0x57be94[_0x5becb3(0x17a)](_0x5becb3(0x198))),console['error'](a28_0x57be94['dim'](_0x5becb3(0x193))),console[_0x5becb3(0xc2)](a28_0x57be94[_0x5becb3(0x173)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x5becb3(0x1a1))),console['error'](a28_0x57be94[_0x5becb3(0xce)](_0x5becb3(0x10f))),0x1;const _0x4d8ce2=_0x1f1829[_0x5becb3(0x169)]||a28_0x5b63fd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3cd26c)+_0x5becb3(0x128));_0x1f1829[_0x5becb3(0x180)]&&(console[_0x5becb3(0xc2)](_0x5becb3(0x140)+_0x1f1829[_0x5becb3(0x12d)]),console[_0x5becb3(0xc2)]('Parent\x20segment:\x20'+_0x3cd26c),console[_0x5becb3(0xc2)](_0x5becb3(0x150)+_0x4d8ce2));const _0x403927=await withSpinner(_0x5becb3(0xbe)+_0x3cd26c+_0x5becb3(0x164),()=>_0x10b7f2[_0x5becb3(0x123)][_0x5becb3(0x181)](_0x3cd26c),{'verbose':_0x1f1829[_0x5becb3(0x180)]}),_0x3080a8=_0x403927[_0x5becb3(0x178)];if(existsSync(_0x4d8ce2)){const _0x2454e6=readFileSync(_0x4d8ce2,_0x5becb3(0x115)),_0x109408=generateDiff(_0x2454e6,_0x3080a8);if(!hasChanges(_0x109408))console[_0x5becb3(0xc2)](a28_0x57be94[_0x5becb3(0x162)]('✔')+_0x5becb3(0x19f)+a28_0x57be94[_0x5becb3(0xce)](_0x4d8ce2)+_0x5becb3(0xc7));else{console[_0x5becb3(0xc2)](_0x5becb3(0x16e)+_0x4d8ce2+'\x27:'),console[_0x5becb3(0xc2)]('─'[_0x5becb3(0xb8)](0x3c)),console[_0x5becb3(0xc2)](formatDiffWithColors(_0x109408)),console[_0x5becb3(0xc2)]('─'[_0x5becb3(0xb8)](0x3c));if(!_0x1f1829['yes']){const _0x1cdf0f=await confirmKey('Overwrite\x20\x27'+_0x4d8ce2+'\x27?');if(!_0x1cdf0f)return console[_0x5becb3(0xc2)](_0x5becb3(0x99)),0x1;}writeFileSync(_0x4d8ce2,_0x3080a8,_0x5becb3(0x115)),console[_0x5becb3(0xc2)](a28_0x57be94[_0x5becb3(0x162)]('✔')+_0x5becb3(0xc5)+a28_0x57be94['cyan'](_0x4d8ce2));}}else{const _0x59a23f=a28_0x5b63fd['dirname'](_0x4d8ce2);!existsSync(_0x59a23f)&&mkdirSync(_0x59a23f,{'recursive':!![]}),writeFileSync(_0x4d8ce2,_0x3080a8,_0x5becb3(0x115)),console[_0x5becb3(0xc2)](a28_0x57be94['green']('✔')+_0x5becb3(0xc5)+a28_0x57be94[_0x5becb3(0xce)](_0x4d8ce2));}return saveSessionContext({'parent_segment':_0x3cd26c},_0x1f1829[_0x5becb3(0x15e)]),console[_0x5becb3(0xc2)](a28_0x57be94[_0x5becb3(0x162)]('✔')+_0x5becb3(0x117)+a28_0x57be94[_0x5becb3(0x173)](_0x5becb3(0x18d))+_0x5becb3(0xda)+a28_0x57be94['cyan'](_0x3cd26c)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a28_0x1ef526(0x16b)]='segment:parent:push';['description']=a28_0x1ef526(0xde);async[a28_0x1ef526(0x190)](_0x87aa3d){const _0xa8967=a28_0x1ef526,{options:_0x6e7abc,args:_0x1504ca,tdx:_0x3a257b}=_0x87aa3d,_0x583bbf=_0x6e7abc,_0x52588a=_0x1504ca[0x0]||_0x6e7abc[_0xa8967(0xf9)];if(!_0x52588a)return showParentSegmentNotSetError(_0xa8967(0x1a2)+_0xa8967(0x18f)),0x1;const _0x3525c5=resolveYamlFile(_0x52588a);if(!existsSync(_0x3525c5))return showFileNotFoundError(_0x3525c5,_0x52588a),0x1;_0x583bbf['verbose']&&(console[_0xa8967(0xc2)]('Site:\x20'+_0x583bbf[_0xa8967(0x12d)]),console['error'](_0xa8967(0xc9)+_0x3525c5));let _0x3130e8;try{_0x3130e8=readFileSync(_0x3525c5,'utf-8');}catch(_0x5da6ff){const _0x27836c=_0x5da6ff instanceof Error?_0x5da6ff[_0xa8967(0x16f)]:String(_0x5da6ff);return console[_0xa8967(0xc2)]('Error\x20reading\x20file:\x20'+_0x27836c),0x1;}const _0x3d1a44=await withSpinner(_0xa8967(0x92),()=>_0x3a257b['segment'][_0xa8967(0xe6)](_0x3130e8),{'verbose':_0x583bbf[_0xa8967(0x180)]}),_0x4772d5=_0x3d1a44[_0xa8967(0x178)],{isNew:_0x4b1ebc,name:_0x11371b,hasChanges:_0x4d6d7c,diffFormatted:_0x272f45}=_0x4772d5;if(!_0x4d6d7c)return console[_0xa8967(0xc2)](_0xa8967(0x199)+_0x11371b+_0xa8967(0xb2)),0x0;_0x4b1ebc?console[_0xa8967(0xc2)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x11371b+'\x27:'):console[_0xa8967(0xc2)](_0xa8967(0x161)+_0x11371b+'\x27:');console['error']('─'[_0xa8967(0xb8)](0x3c)),console[_0xa8967(0xc2)](_0x272f45),console[_0xa8967(0xc2)]('─'[_0xa8967(0xb8)](0x3c));const _0x4f57d5=_0x4b1ebc?'Create\x20parent\x20segment\x20\x27'+_0x11371b+'\x27?':_0xa8967(0x175)+_0x11371b+'\x27?';if(!_0x583bbf[_0xa8967(0x100)]){const _0x44a275=await confirmKey(_0x4f57d5);if(!_0x44a275)return console[_0xa8967(0xc2)](_0xa8967(0x99)),0x1;}const _0x59bd57=_0x4b1ebc?'Creating':_0xa8967(0x149),_0xe97555=await withSpinner(_0x59bd57+_0xa8967(0xd1)+_0x11371b+'\x27...',()=>_0x4772d5[_0xa8967(0xcc)](),{'verbose':_0x583bbf[_0xa8967(0x180)]}),_0x5f2e16=_0xe97555['data'],_0xbf1f25=getConsoleNextUrl(_0x583bbf[_0xa8967(0x12d)],_0xa8967(0x94)+_0x5f2e16['id']),_0x3e445a=_0x4b1ebc?_0xa8967(0xa0):_0xa8967(0xe5);return console[_0xa8967(0xc2)]('✔\x20'+_0x3e445a+_0xa8967(0xd1)+_0x5f2e16[_0xa8967(0x16b)]+'\x27'),console['error']('\x20\x20'+_0xbf1f25),0x0;}}function a28_0x3711(_0x3acb1d,_0x458620){_0x3acb1d=_0x3acb1d-0x8b;const _0x2fd5f5=a28_0x2fd5();let _0x3711d7=_0x2fd5f5[_0x3acb1d];return _0x3711d7;}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a28_0x1ef526(0xa9);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x159);async[a28_0x1ef526(0x190)](_0x1ccbec){const _0xae1983=a28_0x1ef526,{options:_0x51ebb0,args:_0x2602f5,tdx:_0x3dcf83}=_0x1ccbec,_0x358422=_0x51ebb0,_0x456468=_0x2602f5[0x0]||_0x51ebb0['parentSegment'];if(!_0x456468)return showParentSegmentNotSetError(_0xae1983(0x111)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0xae1983(0x13a)+_0xae1983(0x12c)+_0xae1983(0x13c)),0x1;const _0x4a342d=resolveYamlFile(_0x456468);if(!existsSync(_0x4a342d))return showFileNotFoundError(_0x4a342d,_0x456468),0x1;_0x358422[_0xae1983(0x180)]&&(console[_0xae1983(0xc2)](_0xae1983(0x140)+_0x358422[_0xae1983(0x12d)]),console[_0xae1983(0xc2)](_0xae1983(0xc9)+_0x4a342d));let _0x3de2f1;try{_0x3de2f1=readFileSync(_0x4a342d,_0xae1983(0x115));}catch(_0xd2c80f){const _0x53eb70=_0xd2c80f instanceof Error?_0xd2c80f[_0xae1983(0x16f)]:String(_0xd2c80f);return console['error']('Error\x20reading\x20file:\x20'+_0x53eb70),0x1;}const _0x201108=createCommandSpinner(a28_0x57be94[_0xae1983(0x173)](_0xae1983(0x147)),{'verbose':_0x358422['verbose']});_0x201108[_0xae1983(0x17d)]();const _0x3df96b={'onProgress':_0x1516e5=>{const _0x28d4dd=_0xae1983;_0x201108[_0x28d4dd(0x18a)]=formatProgressMessage(_0x1516e5);}};if(_0x358422['master'])_0x3df96b[_0xae1983(0xeb)]=!![];if(_0x358422[_0xae1983(0xfd)])_0x3df96b['enriched']=!![];_0x358422['attribute']&&(_0x3df96b[_0xae1983(0xd9)]=_0x358422[_0xae1983(0xd9)]);_0x358422[_0xae1983(0x1a5)]&&(_0x3df96b[_0xae1983(0x1a5)]=_0x358422[_0xae1983(0x1a5)]);if(_0x358422[_0xae1983(0xfa)])_0x3df96b[_0xae1983(0xfa)]=_0x358422[_0xae1983(0xfa)];let _0x7e5dcd;try{_0x7e5dcd=await _0x3dcf83[_0xae1983(0x123)][_0xae1983(0x108)](_0x3de2f1,_0x3df96b),_0x201108[_0xae1983(0x184)]();}catch(_0x2be405){_0x201108[_0xae1983(0x184)]();throw _0x2be405;}const _0xc3f22=_0x358422[_0xae1983(0xfa)]||_0xae1983(0x114);return this[_0xae1983(0x187)](_0x7e5dcd,_0x3df96b,_0x4a342d,_0xc3f22),_0x7e5dcd[_0xae1983(0x13e)]?0x0:0x1;}[a28_0x1ef526(0x187)](_0x4ebc07,_0x2bed5e,_0x42049b,_0x342380){const _0x5cec9d=a28_0x1ef526;console[_0x5cec9d(0xc2)]('\x0a'+a28_0x57be94[_0x5cec9d(0x144)]('Validate:')+'\x20'+_0x4ebc07[_0x5cec9d(0x16b)]),console['error']('═'[_0x5cec9d(0xb8)](0x3c)),this[_0x5cec9d(0x11c)](_0x4ebc07);if(typeof _0x2bed5e[_0x5cec9d(0xd9)]===_0x5cec9d(0xfc)){this[_0x5cec9d(0x196)](_0x4ebc07),this['displaySummary'](_0x4ebc07),this[_0x5cec9d(0x156)](_0x42049b,_0x342380,_0x5cec9d(0xd9),_0x2bed5e[_0x5cec9d(0xd9)]);return;}if(_0x2bed5e['attribute']===!![]){this[_0x5cec9d(0x196)](_0x4ebc07),this[_0x5cec9d(0xaa)](_0x4ebc07),this[_0x5cec9d(0x156)](_0x42049b,_0x342380,_0x5cec9d(0x113));return;}if(typeof _0x2bed5e['behavior']===_0x5cec9d(0xfc)){this[_0x5cec9d(0xcf)](_0x4ebc07,_0x342380),this[_0x5cec9d(0xaa)](_0x4ebc07),this[_0x5cec9d(0x156)](_0x42049b,_0x342380,'behavior',_0x2bed5e[_0x5cec9d(0x1a5)]);return;}if(_0x2bed5e[_0x5cec9d(0x1a5)]===!![]){this[_0x5cec9d(0xcf)](_0x4ebc07,_0x342380),this[_0x5cec9d(0xaa)](_0x4ebc07),this[_0x5cec9d(0x156)](_0x42049b,_0x342380,_0x5cec9d(0x95));return;}this[_0x5cec9d(0x196)](_0x4ebc07),this[_0x5cec9d(0xcf)](_0x4ebc07,_0x342380),this[_0x5cec9d(0xaa)](_0x4ebc07),this['displayPreviewHints'](_0x42049b,_0x342380,_0x5cec9d(0xf2));}[a28_0x1ef526(0x156)](_0x128e87,_0x2ae9f6,_0x5b0e05,_0x32f88d){const _0x143109=a28_0x1ef526;console[_0x143109(0xc2)]('\x0a'+a28_0x57be94[_0x143109(0x173)](_0x143109(0x134)));const _0x424a86=_0x2ae9f6!==_0x143109(0x114)?'\x20--interval\x20'+_0x2ae9f6:'';if(_0x5b0e05===_0x143109(0xd9)&&_0x32f88d)console['error']('\x20\x20'+a28_0x57be94[_0x143109(0x173)](_0x143109(0x186)+_0x128e87+_0x143109(0xc4)+_0x32f88d+'\x22'+_0x424a86));else{if(_0x5b0e05==='behavior'&&_0x32f88d)console[_0x143109(0xc2)]('\x20\x20'+a28_0x57be94[_0x143109(0x173)](_0x143109(0x186)+_0x128e87+_0x143109(0x9f)+_0x32f88d+'\x22'+_0x424a86));else(_0x5b0e05===_0x143109(0x113)||_0x5b0e05===_0x143109(0xf2))&&console['error']('\x20\x20'+a28_0x57be94[_0x143109(0x173)]('tdx\x20segment\x20parent\x20preview\x20'+_0x128e87+_0x143109(0x18c)+_0x424a86));}(_0x5b0e05===_0x143109(0x95)||_0x5b0e05===_0x143109(0xf2))&&console[_0x143109(0xc2)]('\x20\x20'+a28_0x57be94['dim'](_0x143109(0x186)+_0x128e87+_0x143109(0xb5)+_0x424a86)),_0x5b0e05===_0x143109(0xf2)&&console[_0x143109(0xc2)]('\x20\x20'+a28_0x57be94[_0x143109(0x173)](_0x143109(0x186)+_0x128e87+_0x143109(0x125)+_0x424a86));}[a28_0x1ef526(0x11c)](_0x9dd097){const _0x2d6846=a28_0x1ef526,{master:_0x400c77}=_0x9dd097,_0x45188f=_0x400c77[_0x2d6846(0xf0)]?a28_0x57be94[_0x2d6846(0x162)]('✔'):a28_0x57be94['red']('✘');console[_0x2d6846(0xc2)]('\x0a'+a28_0x57be94[_0x2d6846(0x173)](_0x2d6846(0x1a4))),console[_0x2d6846(0xc2)](_0x45188f+'\x20'+a28_0x57be94['bold'](_0x400c77[_0x2d6846(0x15c)]+'.'+_0x400c77[_0x2d6846(0xa7)])),_0x400c77[_0x2d6846(0xf0)]?_0x400c77[_0x2d6846(0x160)]!==undefined&&console['error']('\x20\x20'+a28_0x57be94[_0x2d6846(0x173)](_0x2d6846(0x157))+'\x20'+a28_0x57be94[_0x2d6846(0xce)](formatRows(_0x400c77[_0x2d6846(0x160)]))):console[_0x2d6846(0xc2)]('\x20\x20'+a28_0x57be94[_0x2d6846(0x17a)]('Error:')+'\x20'+_0x400c77[_0x2d6846(0x96)]);}['displayAttributesStats'](_0x1cbb60){const _0x2c59ad=a28_0x1ef526;if(_0x1cbb60['attributes'][_0x2c59ad(0xdf)]===0x0)return;console[_0x2c59ad(0xc2)]('\x0a'+a28_0x57be94[_0x2c59ad(0x173)](_0x2c59ad(0x158)));for(const _0x396229 of _0x1cbb60['attributes']){const _0x137ff6=_0x396229[_0x2c59ad(0xf0)]?a28_0x57be94['green']('✔'):a28_0x57be94[_0x2c59ad(0x17a)]('✘');let _0x375877='';if(_0x396229['schemaValid']&&_0x396229[_0x2c59ad(0x136)]!==undefined&&_0x396229[_0x2c59ad(0x138)]!==undefined){const _0x41d62f=_0x396229[_0x2c59ad(0x138)][_0x2c59ad(0x151)](0x1),_0x2fe227=_0x396229[_0x2c59ad(0x138)]>=0x50?a28_0x57be94[_0x2c59ad(0x162)]:_0x396229[_0x2c59ad(0x138)]>=0x32?a28_0x57be94[_0x2c59ad(0xe7)]:a28_0x57be94[_0x2c59ad(0x17a)];_0x375877='\x20'+a28_0x57be94['dim'](_0x2c59ad(0x18b))+'\x20'+_0x2fe227(_0x41d62f+'%')+'\x20('+formatRows(_0x396229[_0x2c59ad(0x136)])+_0x2c59ad(0x166);}console[_0x2c59ad(0xc2)](_0x137ff6+'\x20'+a28_0x57be94['bold'](_0x396229['name'])+_0x375877),console['error']('\x20\x20'+a28_0x57be94['dim']('Source:')+'\x20'+a28_0x57be94[_0x2c59ad(0x144)](_0x396229[_0x2c59ad(0x15c)]+'.'+_0x396229[_0x2c59ad(0xa7)]));const _0x404ee6=_0x396229[_0x2c59ad(0xbb)]===_0x396229['foreignKey']?a28_0x57be94['dim'](_0x2c59ad(0x126))+'\x20'+_0x396229[_0x2c59ad(0xbb)]:a28_0x57be94['dim'](_0x2c59ad(0x139))+'\x20'+_0x396229[_0x2c59ad(0xbb)]+'\x20=\x20'+_0x396229[_0x2c59ad(0xf4)];console[_0x2c59ad(0xc2)]('\x20\x20'+_0x404ee6),console[_0x2c59ad(0xc2)]('\x20\x20'+a28_0x57be94[_0x2c59ad(0x173)](_0x2c59ad(0x10a))),this[_0x2c59ad(0x116)](_0x396229[_0x2c59ad(0xdd)]),!_0x396229[_0x2c59ad(0xf0)]&&console[_0x2c59ad(0xc2)]('\x20\x20'+a28_0x57be94['red'](_0x2c59ad(0x137))+'\x20'+_0x396229['schemaError']);}}[a28_0x1ef526(0xcf)](_0x5b6479,_0x13d493){const _0x44adbe=a28_0x1ef526;if(_0x5b6479['behaviors'][_0x44adbe(0xdf)]===0x0)return;console[_0x44adbe(0xc2)]('\x0a'+a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x90))+'\x20'+a28_0x57be94[_0x44adbe(0x173)]('('+_0x13d493+')'));for(const _0x9c97cc of _0x5b6479['behaviors']){const _0x21f240=_0x9c97cc[_0x44adbe(0xf0)]?a28_0x57be94[_0x44adbe(0x162)]('✔'):a28_0x57be94[_0x44adbe(0x17a)]('✘');let _0x12ba15='';if(_0x9c97cc[_0x44adbe(0xf0)]&&_0x9c97cc[_0x44adbe(0x104)]!==undefined&&_0x9c97cc[_0x44adbe(0x168)]!==undefined){const _0x29536c=_0x9c97cc[_0x44adbe(0x97)]?.['toFixed'](0x1)||'?',_0x2724cd=(_0x9c97cc[_0x44adbe(0x97)]??0x0)>=0x32?a28_0x57be94[_0x44adbe(0x162)]:(_0x9c97cc['customerPercent']??0x0)>=0x14?a28_0x57be94[_0x44adbe(0xe7)]:a28_0x57be94[_0x44adbe(0x17a)];_0x12ba15='\x20'+a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0xd4))+'\x20'+_0x2724cd(formatRows(_0x9c97cc['customersWithEvents']))+'\x20('+_0x29536c+_0x44adbe(0x145)+a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x16d))+'\x20'+a28_0x57be94['cyan'](formatRows(_0x9c97cc['totalEvents']));}console[_0x44adbe(0xc2)](_0x21f240+'\x20'+a28_0x57be94[_0x44adbe(0x144)](_0x9c97cc[_0x44adbe(0x16b)])+_0x12ba15),console[_0x44adbe(0xc2)]('\x20\x20'+a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x182))+'\x20'+a28_0x57be94[_0x44adbe(0x144)](_0x9c97cc['database']+'.'+_0x9c97cc['table']));const _0xdee74=_0x9c97cc[_0x44adbe(0xbb)]===_0x9c97cc['foreignKey']?a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x126))+'\x20'+_0x9c97cc['joinKey']:a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x139))+'\x20'+_0x9c97cc[_0x44adbe(0xbb)]+'\x20=\x20'+_0x9c97cc[_0x44adbe(0xf4)];console[_0x44adbe(0xc2)]('\x20\x20'+_0xdee74),console[_0x44adbe(0xc2)]('\x20\x20'+a28_0x57be94[_0x44adbe(0x173)](_0x44adbe(0x10a))),this[_0x44adbe(0x116)](_0x9c97cc[_0x44adbe(0xdd)]),!_0x9c97cc['schemaValid']&&console['error']('\x20\x20'+a28_0x57be94['red'](_0x44adbe(0x137))+'\x20'+_0x9c97cc[_0x44adbe(0x96)]);}}[a28_0x1ef526(0x116)](_0x253d4b){const _0x3b485d=a28_0x1ef526;for(const _0x2ff504 of _0x253d4b){_0x2ff504['label']===_0x2ff504[_0x3b485d(0x143)]||_0x2ff504[_0x3b485d(0x143)]==='*'?console[_0x3b485d(0xc2)](_0x3b485d(0xd5)+_0x2ff504[_0x3b485d(0xf7)]):console[_0x3b485d(0xc2)]('\x20\x20\x20\x20-\x20'+_0x2ff504[_0x3b485d(0xf7)]+'\x20'+a28_0x57be94['dim']('('+_0x2ff504[_0x3b485d(0x143)]+')'));}}[a28_0x1ef526(0xaa)](_0x2015da){const _0x1c1c72=a28_0x1ef526;console[_0x1c1c72(0xc2)]('─'[_0x1c1c72(0xb8)](0x3c));if(_0x2015da[_0x1c1c72(0x120)]['length']>0x0){console[_0x1c1c72(0xc2)]('\x0a'+a28_0x57be94['red'](_0x1c1c72(0x148)));for(const _0x322a91 of _0x2015da[_0x1c1c72(0x120)]){console[_0x1c1c72(0xc2)]('\x20\x20'+a28_0x57be94[_0x1c1c72(0x17a)]('•')+'\x20'+_0x322a91);}}_0x2015da[_0x1c1c72(0x13e)]&&console[_0x1c1c72(0xc2)]('\x0a'+a28_0x57be94[_0x1c1c72(0x162)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a28_0x1ef526(0x8e);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x118);async['execute'](_0x12ded0){const _0x27df80=a28_0x1ef526,{options:_0x2fa10b,args:_0x285f95,tdx:_0x522190}=_0x12ded0,_0xb89c08=_0x2fa10b,_0x534a47=_0x285f95[0x0]||_0x2fa10b[_0x27df80(0xf9)];if(!_0x534a47)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x27df80(0x16a)+'\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'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x27df80(0xb9)+_0x27df80(0x13c)),0x1;if(!_0xb89c08['master']&&!_0xb89c08[_0x27df80(0xd9)]&&!_0xb89c08[_0x27df80(0x1a5)]&&!_0xb89c08['enriched'])return console[_0x27df80(0xc2)](a28_0x57be94[_0x27df80(0x17a)](_0x27df80(0x112))),console[_0x27df80(0xc2)](_0x27df80(0xae)),console[_0x27df80(0xc2)]('Options:'),console[_0x27df80(0xc2)](_0x27df80(0xd6)),console[_0x27df80(0xc2)](_0x27df80(0x8b)),console['error'](_0x27df80(0xba)),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x14bcc7=resolveYamlFile(_0x534a47);if(!existsSync(_0x14bcc7))return showFileNotFoundError(_0x14bcc7,_0x534a47),0x1;_0xb89c08[_0x27df80(0x180)]&&(console[_0x27df80(0xc2)](_0x27df80(0x140)+_0xb89c08[_0x27df80(0x12d)]),console[_0x27df80(0xc2)](_0x27df80(0xc9)+_0x14bcc7));let _0x1acbc2;try{_0x1acbc2=readFileSync(_0x14bcc7,'utf-8');}catch(_0x40f684){const _0x5959b4=_0x40f684 instanceof Error?_0x40f684[_0x27df80(0x16f)]:String(_0x40f684);return console[_0x27df80(0xc2)](_0x27df80(0x131)+_0x5959b4),0x1;}let _0x1c4c19;try{_0x1c4c19=parseYamlString(_0x1acbc2);}catch(_0x3a3a8f){const _0x296c95=_0x3a3a8f instanceof Error?_0x3a3a8f[_0x27df80(0x16f)]:String(_0x3a3a8f);return console[_0x27df80(0xc2)](a28_0x57be94[_0x27df80(0x17a)](_0x27df80(0x9a)+_0x296c95)),0x1;}if(_0xb89c08[_0x27df80(0xd9)]===!![]||_0xb89c08['attribute']===''){const _0x2ea7ad=_0x1c4c19[_0x27df80(0x113)]?.[_0x27df80(0x9d)](_0x2399b1=>_0x2399b1[_0x27df80(0x16b)])||[];if(_0x2ea7ad[_0x27df80(0xdf)]===0x0)console[_0x27df80(0xc2)](a28_0x57be94[_0x27df80(0x17a)](_0x27df80(0xb7)));else{console[_0x27df80(0xc2)](a28_0x57be94['red'](_0x27df80(0x12a))),console[_0x27df80(0xc2)]('Available\x20attributes:');for(const _0x1c2f62 of _0x2ea7ad){console[_0x27df80(0xc2)]('\x20\x20'+a28_0x57be94[_0x27df80(0xce)](_0x1c2f62));}console[_0x27df80(0xc2)](_0x27df80(0xca)+_0x534a47+_0x27df80(0xc4)+_0x2ea7ad[0x0]+'\x22');}return 0x1;}if(_0xb89c08[_0x27df80(0x1a5)]===!![]||_0xb89c08[_0x27df80(0x1a5)]===''){const _0x4db374=_0x1c4c19[_0x27df80(0x95)]?.[_0x27df80(0x9d)](_0x2683fb=>_0x2683fb['name'])||[];if(_0x4db374[_0x27df80(0xdf)]===0x0)console[_0x27df80(0xc2)](a28_0x57be94[_0x27df80(0x17a)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x27df80(0xc2)](a28_0x57be94['red'](_0x27df80(0x130))),console[_0x27df80(0xc2)]('Available\x20behaviors:');for(const _0x5966b1 of _0x4db374){console[_0x27df80(0xc2)]('\x20\x20'+a28_0x57be94[_0x27df80(0xce)](_0x5966b1));}console['error'](_0x27df80(0xca)+_0x534a47+_0x27df80(0x9f)+_0x4db374[0x0]+'\x22');}return 0x1;}const _0x1bfebd=createCommandSpinner(a28_0x57be94['dim']('Fetching\x20sample\x20data...'),{'verbose':_0xb89c08[_0x27df80(0x180)]});_0x1bfebd[_0x27df80(0x17d)]();const _0x2ef10a={'onProgress':_0xca751e=>{const _0x57264a=_0x27df80;_0x1bfebd[_0x57264a(0x18a)]=formatProgressMessage(_0xca751e);}};if(_0xb89c08['master'])_0x2ef10a[_0x27df80(0xeb)]=!![];if(_0xb89c08[_0x27df80(0xd9)]&&typeof _0xb89c08[_0x27df80(0xd9)]===_0x27df80(0xfc))_0x2ef10a['attribute']=_0xb89c08['attribute'];if(_0xb89c08[_0x27df80(0x1a5)]&&typeof _0xb89c08[_0x27df80(0x1a5)]==='string')_0x2ef10a[_0x27df80(0x1a5)]=_0xb89c08[_0x27df80(0x1a5)];if(_0xb89c08[_0x27df80(0xfd)])_0x2ef10a[_0x27df80(0xfd)]=!![];if(_0xb89c08[_0x27df80(0xfa)])_0x2ef10a[_0x27df80(0xfa)]=_0xb89c08[_0x27df80(0xfa)];let _0x13a70e;try{_0x13a70e=await _0x522190[_0x27df80(0x123)]['previewParentYaml'](_0x1acbc2,_0x2ef10a),_0x1bfebd['stop']();}catch(_0x5dd32d){_0x1bfebd[_0x27df80(0x184)]();throw _0x5dd32d;}return await this['displayPreviewResults'](_0x13a70e,{'master':_0xb89c08[_0x27df80(0xeb)],'attribute':typeof _0xb89c08[_0x27df80(0xd9)]===_0x27df80(0xfc)?_0xb89c08[_0x27df80(0xd9)]:undefined,'behavior':typeof _0xb89c08[_0x27df80(0x1a5)]==='string'?_0xb89c08[_0x27df80(0x1a5)]:undefined,'enriched':_0xb89c08[_0x27df80(0xfd)]}),_0x13a70e[_0x27df80(0x13e)]?0x0:0x1;}async['displayPreviewResults'](_0x51bc3c,_0x21cf01){const _0x1f6a8e=a28_0x1ef526;console[_0x1f6a8e(0xc2)]('\x0a'+a28_0x57be94[_0x1f6a8e(0x144)]('Preview:')+'\x20'+_0x51bc3c['name']),console[_0x1f6a8e(0xc2)]('═'[_0x1f6a8e(0xb8)](0x3c));if(_0x21cf01[_0x1f6a8e(0xeb)]&&_0x51bc3c[_0x1f6a8e(0xcd)]){const _0x5562dd=a28_0x57be94['dim'](_0x1f6a8e(0x124))+'\x20'+a28_0x57be94[_0x1f6a8e(0x144)](_0x51bc3c[_0x1f6a8e(0xeb)][_0x1f6a8e(0x15c)]+'.'+_0x51bc3c[_0x1f6a8e(0xeb)]['table']);await this[_0x1f6a8e(0x13b)](_0x5562dd,_0x51bc3c['sampleData']);}else{if(_0x21cf01[_0x1f6a8e(0xd9)]&&_0x51bc3c[_0x1f6a8e(0xcd)]){const _0x5521c5=a28_0x57be94[_0x1f6a8e(0x173)](_0x1f6a8e(0x16c))+'\x20'+a28_0x57be94['bold'](_0x21cf01[_0x1f6a8e(0xd9)]);await this[_0x1f6a8e(0x13b)](_0x5521c5,_0x51bc3c[_0x1f6a8e(0xcd)]);}else{if(_0x21cf01['behavior']&&_0x51bc3c[_0x1f6a8e(0xcd)]){const _0x14b9e6=a28_0x57be94['dim'](_0x1f6a8e(0x146))+'\x20'+a28_0x57be94['bold'](_0x21cf01['behavior']);await this[_0x1f6a8e(0x13b)](_0x14b9e6,_0x51bc3c[_0x1f6a8e(0xcd)]);}else{if(_0x21cf01[_0x1f6a8e(0xfd)]&&_0x51bc3c[_0x1f6a8e(0xcd)]){const _0x5b48e7=a28_0x57be94[_0x1f6a8e(0x173)]('Enriched:')+'\x20'+a28_0x57be94[_0x1f6a8e(0x144)](_0x1f6a8e(0xed));await this[_0x1f6a8e(0x13b)](_0x5b48e7,_0x51bc3c[_0x1f6a8e(0xcd)]);}else!_0x51bc3c[_0x1f6a8e(0xcd)]&&console[_0x1f6a8e(0xc2)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x51bc3c[_0x1f6a8e(0x120)][_0x1f6a8e(0xdf)]>0x0){console[_0x1f6a8e(0xc2)]('─'[_0x1f6a8e(0xb8)](0x3c)),console[_0x1f6a8e(0xc2)]('\x0a'+a28_0x57be94[_0x1f6a8e(0x17a)]('Errors:'));for(const _0xe1cb29 of _0x51bc3c[_0x1f6a8e(0x120)]){console[_0x1f6a8e(0xc2)]('\x20\x20'+a28_0x57be94[_0x1f6a8e(0x17a)]('•')+'\x20'+_0xe1cb29);}}}async[a28_0x1ef526(0x13b)](_0xb0f223,_0x5ab721){const _0x10b558=a28_0x1ef526;if(_0x5ab721[_0x10b558(0xdf)]===0x0){console[_0x10b558(0xc2)]('\x0a'+_0xb0f223),console[_0x10b558(0xc2)](_0x10b558(0x8d));return;}console[_0x10b558(0xc2)]('\x0a'+_0xb0f223);const _0x34cde5=Object['keys'](_0x5ab721[0x0])[_0x10b558(0x9d)](_0x5b1e68=>({'name':_0x5b1e68,'type':typeof _0x5ab721[0x0][_0x5b1e68]===_0x10b558(0x98)?'double':'varchar'})),_0x14497b={'queryId':'preview','columns':_0x34cde5,'data':_0x5ab721,'stats':{'state':_0x10b558(0xab),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5ab721[_0x10b558(0xdf)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x145fd0=formatAsTable(_0x14497b,_0x5ab721['length'],!![]);await writeOutput(_0x145fd0,undefined,'table');}}function a28_0x2fd5(){const _0x51aa9b=['/app/dw/parentSegments/','behaviors','schemaError','customerPercent','number','Aborted.','Error\x20parsing\x20YAML:\x20','jsonl','✔\x20Renamed\x20directory\x20to\x20','map','.yaml','\x20--behavior\x20\x22','Created','listFields','To\x20cancel:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','291601RMXPiM','Fetching\x20SQL\x20for\x20\x27','Options:\x0a','table','segment:parent:run','segment:parent:validate','displaySummary','FINISHED','audienceId','status','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','/\x20directory.\x0a','Name:\x20','in\x20','\x27\x20is\x20already\x20up\x20to\x20date','segment:parent:desc','workflowAttemptId','\x20--behavior\x20\x22<name>\x22','match','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','repeat','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','joinKey','getParentSQL','segment:parent:view','Fetching\x20parent\x20segment\x20\x27','log','Attempt:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','error','test','\x20--attribute\x20\x22','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20is\x20already\x20up\x20to\x20date','50JjbXyr','YAML\x20file:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','356772VMZHcn','apply','sampleData','cyan','displayBehaviorsStats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20parent\x20segment\x20\x27','getParentFull','xdg-open','Customers:','\x20\x20\x20\x20-\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','runParent','Pattern:\x20','attribute','\x20=\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','columns','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','length','3043842MTDDyb','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','customerGroupFile','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','scheduleOption','Updated','pushParentYaml','yellow','272vgDGye','\x0a⚠️\x20\x20Migrating:\x20','join','master','\x20Opening\x20','Master\x20+\x20Attributes','use','Creating\x20parent\x20segment\x20\x27','schemaValid','localeCompare','all','SQL\x20query:\x0a','foreignKey','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','resolveParentId','label','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','parentSegment','interval','ignore','string','enriched','/sessions/','18609AjaxGS','yes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','endsWith','Table:\x20','customersWithEvents','segment:parent:create','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','addBehaviors','validateParentYaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Columns:','Error:\x20Parent\x20segment\x20name\x20is\x20required','6922377QEvHvL','query','description','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','attributes','-1d','utf-8','displayColumns','\x20Context\x20set:\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','jobId','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','15502437stwwVw','displayMasterInfo','\x0a✔\x20Workflow\x20started','Session:','Database:\x20','errors','updateParent','Get\x20SQL\x20query\x20for\x20parent\x20segment','segment','Master:','\x20--enriched','Join\x20on:','addAttributesFile','.yml','Error:\x20--database\x20and\x20--table\x20are\x20required','Error:\x20--attribute\x20requires\x20a\x20name\x0a','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--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','site','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','1841152NFJkzj','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Error\x20reading\x20file:\x20','json','format','To\x20view\x20sample\x20data:','stats','matchedCount','Error:','coveragePercent','Join:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','displaySampleData','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','filter','allValid','\x20field','Site:\x20','setJobId','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','column','bold','%)\x20','Behavior:','Validating\x20configuration...','Errors:','Updating','✔\x20Query\x20completed:\x20Processed\x20','parent_segments','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x27\x20with\x20ID:\x20','Create\x20parent\x20segment\x20\x27','scheduleType','Output\x20file:\x20','toFixed','segment:parent:list','replace','/\x20→\x20','segment:parent:show','displayPreviewHints','Rows:','Attributes','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','database','platform','session','Listing\x20parent\x20segments\x20matching\x20\x27','rowCount','\x0aChanges\x20to\x20apply\x20to\x20\x27','green','darwin','\x27...','✔\x20Found\x20','\x20rows)','\x0aNew\x20parent\x20segment\x20\x27','totalEvents','output','Options\x20(one\x20required):\x0a','name','Attribute:','Events:','\x0aChanges\x20to\x20\x27','message','trim','\x27\x20is\x20up\x20to\x20date','Parent\x20segment:\x20','dim','behaviorsFile','Apply\x20changes\x20to\x20\x27','information_schema','Resolving\x20parent\x20segment\x20\x27','data','Error:\x20File\x20not\x20found:\x20','red','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','start','timezone','segment:parent:update','verbose','pullParentYaml','Source:','✔\x20Updated\x20parent\x20segment\x20\x27','stop','✘\x20Failed\x20to\x20rename\x20directory:\x20','tdx\x20segment\x20parent\x20preview\x20','displayValidateResults','👥\x20','List\x20parent\x20segments','text','Coverage:','\x20--attribute\x20\x22<name>\x22','parent_segment','population','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','execute','\x5c$&','workflowSessionId','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','limit','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','displayAttributesStats','Listing\x20fields\x20for\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','✔\x20No\x20changes\x20-\x20\x27','Show\x20parent\x20segment\x20details','\x27\x20and\x20run\x20workflow?','win32','/\x20directories\x20exist.','/\x20and\x20','\x20No\x20changes\x20-\x20','Listing\x20parent\x20segments...','/{name}.yml\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','isDirectory','Master\x20Table','behavior','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20No\x20sample\x20data\x20available','segment:parent:preview','\x20rows\x20','Behaviors','open','Analyzing\x20changes...','customerGroup'];a28_0x2fd5=function(){return _0x51aa9b;};return a28_0x2fd5();}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a28_0x1ef526(0xa8);[a28_0x1ef526(0x10e)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a28_0x1ef526(0x190)](_0x19c79f){const _0x226c9e=a28_0x1ef526,{options:_0x221fe8,args:_0x17e3df,tdx:_0x2bc869}=_0x19c79f,_0x117213=_0x221fe8,_0x52952f=_0x17e3df[0x0]||_0x221fe8[_0x226c9e(0xf9)];if(!_0x52952f)return showParentSegmentNotSetError(_0x226c9e(0x110)+_0x226c9e(0xe1)),0x1;const _0x28fb16=resolveYamlFile(_0x52952f);if(existsSync(_0x28fb16)){_0x117213['verbose']&&console['error']('Found\x20YAML\x20file:\x20'+_0x28fb16);let _0xf7bf7b;try{_0xf7bf7b=readFileSync(_0x28fb16,_0x226c9e(0x115));}catch(_0x5c208c){const _0x457cb2=_0x5c208c instanceof Error?_0x5c208c[_0x226c9e(0x16f)]:String(_0x5c208c);return console[_0x226c9e(0xc2)](_0x226c9e(0x131)+_0x457cb2),0x1;}const _0x33a0ce=await withSpinner('Analyzing\x20changes...',()=>_0x2bc869['segment']['pushParentYaml'](_0xf7bf7b),{'verbose':_0x117213[_0x226c9e(0x180)]}),_0xbc7263=_0x33a0ce[_0x226c9e(0x178)],{isNew:_0x24ed76,name:_0xcf9be,hasChanges:_0x2d7af1,diffFormatted:_0x210f93}=_0xbc7263;if(_0x2d7af1){_0x24ed76?console[_0x226c9e(0xc2)](_0x226c9e(0x167)+_0xcf9be+'\x27:'):console[_0x226c9e(0xc2)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xcf9be+'\x27:');console[_0x226c9e(0xc2)]('─'[_0x226c9e(0xb8)](0x3c)),console[_0x226c9e(0xc2)](_0x210f93),console[_0x226c9e(0xc2)]('─'['repeat'](0x3c));const _0x47d7e3=_0x24ed76?_0x226c9e(0x14e)+_0xcf9be+_0x226c9e(0x19b):_0x226c9e(0x175)+_0xcf9be+_0x226c9e(0x19b);if(!_0x117213[_0x226c9e(0x100)]){const _0x53b406=await confirmKey(_0x47d7e3);if(!_0x53b406)return console['error'](_0x226c9e(0x99)),0x1;}const _0x4516b1=_0x24ed76?'Creating':_0x226c9e(0x149);await withSpinner(_0x4516b1+_0x226c9e(0xd1)+_0xcf9be+_0x226c9e(0x164),()=>_0xbc7263[_0x226c9e(0xcc)](),{'verbose':_0x117213[_0x226c9e(0x180)]});const _0x5a99c5=_0x24ed76?_0x226c9e(0xa0):_0x226c9e(0xe5);console['error']('✔\x20'+_0x5a99c5+_0x226c9e(0xd1)+_0xcf9be+'\x27');}else console[_0x226c9e(0xc2)]('✔\x20No\x20changes\x20-\x20\x27'+_0xcf9be+_0x226c9e(0x171));}const _0x4a0f8a=await withSpinner(_0x226c9e(0x17b)+_0x52952f+_0x226c9e(0x164),()=>_0x2bc869[_0x226c9e(0x123)][_0x226c9e(0xd7)](_0x52952f),{'verbose':_0x117213[_0x226c9e(0x180)]}),_0x5411c4=_0x4a0f8a[_0x226c9e(0x178)],_0x25df99=getConsoleUrl(_0x117213['site'],'/app/workflows/'+_0x5411c4['workflowId']+_0x226c9e(0xfe)+_0x5411c4[_0x226c9e(0x192)]+'/attempt/'+_0x5411c4[_0x226c9e(0xb4)]);return console[_0x226c9e(0xc2)](_0x226c9e(0x11d)),console[_0x226c9e(0xc2)]('\x20\x20'+a28_0x57be94[_0x226c9e(0x173)]('Audience\x20ID:')+'\x20'+_0x5411c4[_0x226c9e(0xac)]),console['error']('\x20\x20'+a28_0x57be94[_0x226c9e(0x173)]('Status:')+'\x20'+_0x5411c4[_0x226c9e(0xad)]),console[_0x226c9e(0xc2)]('\x20\x20'+a28_0x57be94[_0x226c9e(0x173)](_0x226c9e(0x11e))+'\x20'+_0x5411c4[_0x226c9e(0x192)]),console[_0x226c9e(0xc2)]('\x20\x20'+a28_0x57be94[_0x226c9e(0x173)](_0x226c9e(0xc0))+'\x20'+_0x5411c4[_0x226c9e(0xb4)]),console[_0x226c9e(0xc2)]('\x20\x20'+_0x25df99),console[_0x226c9e(0xc2)]('\x0a'+a28_0x57be94[_0x226c9e(0x173)](_0x226c9e(0xa2))+'\x20tdx\x20wf\x20attempt\x20'+_0x5411c4[_0x226c9e(0xb4)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a28_0x1ef526(0x16b)]='segment:parent:fields';[a28_0x1ef526(0x10e)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x35904d){const _0x4c1288=a28_0x1ef526,{options:_0x40f680,args:_0x824100,tdx:_0x262daf}=_0x35904d,_0x4a7abf=_0x824100[0x0]||_0x40f680['parentSegment'];if(!_0x4a7abf)return showParentSegmentNotSetError(_0x4c1288(0x12b)+'\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;_0x40f680[_0x4c1288(0x180)]&&(console[_0x4c1288(0xc2)](_0x4c1288(0x140)+_0x40f680[_0x4c1288(0x12d)]),console[_0x4c1288(0xc2)]('Parent\x20segment:\x20'+_0x4a7abf));const _0x16a4eb=await withSpinner(_0x4c1288(0x197)+_0x4a7abf+_0x4c1288(0x164),()=>_0x262daf['segment'][_0x4c1288(0xa1)](_0x4a7abf),{'verbose':_0x40f680[_0x4c1288(0x180)]}),_0x43812b=_0x16a4eb[_0x4c1288(0x178)];console['error'](_0x4c1288(0x165)+_0x43812b[_0x4c1288(0xdf)]+_0x4c1288(0x13f)+(_0x43812b[_0x4c1288(0xdf)]!==0x1?'s':''));if(_0x40f680['json']||_0x40f680['jsonl'])return await handleSDKOutput(_0x43812b,_0x40f680),0x0;return displayFieldsHumanReadable(_0x43812b,_0x4a7abf),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a28_0x1ef526(0x16b)]=a28_0x1ef526(0xbd);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x19a);async[a28_0x1ef526(0x190)](_0x32b0ea){const _0x143847=a28_0x1ef526,{options:_0xf146e8,args:_0x5b1441,tdx:_0x327b2b}=_0x32b0ea,_0x8d5f0d=_0xf146e8,_0x578560=_0x5b1441[0x0]||_0xf146e8[_0x143847(0xf9)];if(!_0x578560)return showParentSegmentNotSetError(_0x143847(0xf8)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x143847(0xa6)+_0x143847(0xc1)),0x1;_0xf146e8[_0x143847(0x180)]&&(console[_0x143847(0xc2)](_0x143847(0x140)+_0xf146e8[_0x143847(0x12d)]),console[_0x143847(0xc2)](_0x143847(0x172)+_0x578560));const _0x561b7e=await withSpinner(_0x143847(0xbe)+_0x578560+'\x27...',()=>_0x327b2b['segment'][_0x143847(0xd2)](_0x578560),{'verbose':_0xf146e8['verbose']}),_0x312d33=_0x561b7e['data'];if(_0x8d5f0d['web']){const _0x4295ec=getConsoleNextUrl(_0x8d5f0d[_0x143847(0x12d)],_0x143847(0x94)+_0x312d33['id']);return console[_0x143847(0xc2)](a28_0x57be94[_0x143847(0x162)]('✔')+_0x143847(0xec)+a28_0x57be94[_0x143847(0xce)](_0x4295ec)),openBrowser(_0x4295ec),0x0;}return await handleSingleObjectOutput(_0x312d33,_0xf146e8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a28_0x1ef526(0x16b)]=a28_0x1ef526(0xb3);[a28_0x1ef526(0x10e)]=a28_0x1ef526(0xa3);async[a28_0x1ef526(0x190)](_0x20408a){const _0x38126f=a28_0x1ef526,{options:_0x12d553,args:_0x5babe0,tdx:_0x3280a9}=_0x20408a,_0x164ac4=_0x5babe0[0x0]||_0x12d553[_0x38126f(0xf9)];if(!_0x164ac4)return showParentSegmentNotSetError(_0x38126f(0xe3)+_0x38126f(0xd0)),0x1;_0x12d553['verbose']&&(console[_0x38126f(0xc2)](_0x38126f(0x140)+_0x12d553[_0x38126f(0x12d)]),console[_0x38126f(0xc2)](_0x38126f(0x172)+_0x164ac4));const _0x243071=await withSpinner(_0x38126f(0x177)+_0x164ac4+'\x27...',()=>_0x3280a9[_0x38126f(0x123)]['resolveParentId'](_0x164ac4),{'verbose':_0x12d553[_0x38126f(0x180)]}),_0x3566c7=_0x243071[_0x38126f(0x178)],_0x53e964=await withSpinner(_0x38126f(0xa5)+_0x164ac4+_0x38126f(0x164),()=>_0x3280a9[_0x38126f(0x123)]['getParentSQL'](_0x3566c7),{'verbose':_0x12d553[_0x38126f(0x180)]}),_0x36590c=await executeSchemaQuery(_0x53e964[_0x38126f(0x178)],_0x3280a9,_0x12d553);return await handleQueryOutput(_0x36590c,_0x12d553),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a28_0x1ef526(0x16b)]='segment:parent:sql';[a28_0x1ef526(0x10e)]=a28_0x1ef526(0x122);async[a28_0x1ef526(0x190)](_0x47d08c){const _0x4ec068=a28_0x1ef526,{options:_0x42f70a,args:_0x3e209c,tdx:_0x190395}=_0x47d08c,_0x15e1ef=_0x3e209c[0x0]||_0x42f70a[_0x4ec068(0xf9)];if(!_0x15e1ef)return showParentSegmentNotSetError(_0x4ec068(0x11a)+'\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;_0x42f70a[_0x4ec068(0x180)]&&(console[_0x4ec068(0xc2)](_0x4ec068(0x140)+_0x42f70a[_0x4ec068(0x12d)]),console[_0x4ec068(0xc2)](_0x4ec068(0x172)+_0x15e1ef));const _0x2b2b26=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x15e1ef+_0x4ec068(0x164),()=>_0x190395[_0x4ec068(0x123)][_0x4ec068(0xf6)](_0x15e1ef),{'verbose':_0x42f70a[_0x4ec068(0x180)]}),_0x32dd76=_0x2b2b26[_0x4ec068(0x178)],_0x2285bc=await withSpinner(_0x4ec068(0xa5)+_0x15e1ef+'\x27...',()=>_0x190395[_0x4ec068(0x123)][_0x4ec068(0xbc)](_0x32dd76),{'verbose':_0x42f70a['verbose']}),_0x3a36fe=_0x2285bc[_0x4ec068(0x178)];return _0x42f70a[_0x4ec068(0x133)]==='json'||_0x42f70a[_0x4ec068(0x133)]===_0x4ec068(0x9b)?await handleSDKOutput([{'sql':_0x3a36fe}],_0x42f70a):console[_0x4ec068(0xbf)](_0x3a36fe),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a28_0x1ef526(0x155);[a28_0x1ef526(0x10e)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x1ef526(0x190)](_0x17dcfc){const _0x67e914=a28_0x1ef526,{options:_0x18c048,args:_0x3b2d15,tdx:_0x1b737f}=_0x17dcfc,_0x2bee0a=_0x3b2d15[0x0]||_0x18c048[_0x67e914(0xf9)];if(!_0x2bee0a)return showParentSegmentNotSetError(_0x67e914(0xdb)+_0x67e914(0x109)),0x1;_0x18c048['verbose']&&(console[_0x67e914(0xc2)](_0x67e914(0x140)+_0x18c048['site']),console[_0x67e914(0xc2)](_0x67e914(0x172)+_0x2bee0a));const _0x28357b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2bee0a+_0x67e914(0x164),()=>_0x1b737f[_0x67e914(0x123)][_0x67e914(0xf6)](_0x2bee0a),{'verbose':_0x18c048[_0x67e914(0x180)]}),_0x1ecab2=_0x28357b[_0x67e914(0x178)],_0x8e28fb=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2bee0a+_0x67e914(0x164),()=>_0x1b737f['segment'][_0x67e914(0xbc)](_0x1ecab2),{'verbose':_0x18c048[_0x67e914(0x180)]});let _0x20e2fa=_0x8e28fb[_0x67e914(0x178)];const _0x26e0bd=resolveLimit(_0x18c048[_0x67e914(0x194)],DEFAULT_DISPLAY_LIMIT),_0x1b5a1f=/\bLIMIT\s+\d+/i[_0x67e914(0xc3)](_0x20e2fa);!_0x1b5a1f&&(_0x20e2fa=_0x20e2fa[_0x67e914(0x170)]()['replace'](/;+$/,''),_0x20e2fa='SELECT\x20*\x20FROM\x20(\x0a'+_0x20e2fa+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x26e0bd);_0x18c048[_0x67e914(0x180)]&&console[_0x67e914(0xc2)](_0x67e914(0xf3)+_0x20e2fa);const _0x371f65=await withQuerySpinner('Executing\x20parent\x20segment\x20query...',async _0x29fe59=>{const _0x21d434=_0x67e914,_0xced438=await _0x1b737f[_0x21d434(0x10d)][_0x21d434(0x190)](_0x20e2fa,{'catalog':'td','schema':_0x21d434(0x176),'onJobId':_0x14856d=>{const _0x52da4c=_0x21d434;_0x29fe59[_0x52da4c(0x141)](_0x14856d);}});return _0xced438;},{'verbose':_0x18c048[_0x67e914(0x180)]}),_0x515716=_0x371f65[_0x67e914(0x178)],_0x3b7993=_0x515716[_0x67e914(0x119)]?'\x20[Job\x20ID:\x20'+_0x515716[_0x67e914(0x119)]+']':'';return console[_0x67e914(0xc2)](_0x67e914(0x14a)+_0x515716[_0x67e914(0x135)]['processedRows']['toLocaleString']()+_0x67e914(0x8f)+(_0x67e914(0xb1)+formatElapsed(_0x515716[_0x67e914(0x135)]['elapsedTimeMillis'])+_0x3b7993)),await handleQueryOutput(_0x515716,_0x18c048),0x0;}}
|
|
1
|
+
const a29_0x192174=a29_0x193b;(function(_0x443d3d,_0x47e923){const _0x40d020=a29_0x193b,_0x5441ad=_0x443d3d();while(!![]){try{const _0x3542bc=parseInt(_0x40d020(0x29e))/0x1+parseInt(_0x40d020(0x1cc))/0x2+parseInt(_0x40d020(0x2c6))/0x3+-parseInt(_0x40d020(0x1be))/0x4+-parseInt(_0x40d020(0x25f))/0x5+-parseInt(_0x40d020(0x215))/0x6*(-parseInt(_0x40d020(0x281))/0x7)+-parseInt(_0x40d020(0x1dd))/0x8;if(_0x3542bc===_0x47e923)break;else _0x5441ad['push'](_0x5441ad['shift']());}catch(_0x5674db){_0x5441ad['push'](_0x5441ad['shift']());}}}(a29_0x20ad,0x30e6b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a29_0x20ad(){const _0x1b377a=['displaySampleData','stats','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayColumns','all','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','resolveParentId','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','schemaValid','allValid','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20--behavior\x20\x22','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','customerPercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','963660mrmxEt','Fetching\x20parent\x20segment\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','database','\x0aUsage:\x20tdx\x20ps\x20preview\x20','number','query','Session:','Analyzing\x20changes...','Master\x20Table','isDirectory','tdx\x20segment\x20parent\x20preview\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','550324wtFHuL','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20field','\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','getParentSQL','Created','yes','Resolving\x20parent\x20segment\x20\x27','open','sampleData','List\x20available\x20fields\x20for\x20segmentation','customersWithEvents','map','\x27\x20is\x20up\x20to\x20date','Rows:','toLocaleString','4320136rHJeNX','segment:parent:validate','joinKey','Listing\x20fields\x20for\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','name','match','Aborted.','.yml','behavior','YAML\x20file:\x20','parent_segment','\x20--enriched','red','elapsedTimeMillis','/{name}.yml\x0a','start','\x0aChanges\x20to\x20\x27','✔\x20No\x20changes\x20-\x20\x27','data','\x20=\x20','Attribute:','output','\x20--behavior\x20\x22<name>\x22','\x27...','✔\x20Query\x20completed:\x20Processed\x20','pushParentYaml','Status:','darwin','table','Source:','platform','jobId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','format','dim','scheduleType','foreignKey','displayPreviewHints','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20--interval\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','listFields','attributes','yellow','Columns:','bold','\x27\x20is\x20already\x20up\x20to\x20date','\x20--attribute\x20\x22<name>\x22','Creating','Listing\x20parent\x20segments\x20matching\x20\x27','✔\x20Updated\x20parent\x20segment\x20\x27','displayBehaviorsStats','timezone','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','6Guutyr','\x5c$&','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','sort','addAttributes','Error:','displayValidateResults','Output\x20file:\x20','Database:\x20','\x20[Job\x20ID:\x20','segment:parent:fields','segment:parent:list','using\x20the\x20default\x20path:\x20','displayMasterInfo','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','To\x20view\x20sample\x20data:','List\x20parent\x20segments','customerGroup','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','workflowAttemptId','Fetching\x20current\x20configuration\x20for\x20\x27','segment:parent:show','Error:\x20File\x20not\x20found:\x20','log','totalEvents','scheduleOption','join','✔\x20Found\x20','Options\x20(one\x20required):\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Listing\x20parent\x20segments...','`\x20to\x20download\x20the\x20configuration\x20first','displayAttributesStats','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','segment:parent:pull','green','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','string','FINISHED','/\x20directories\x20exist.','Name:\x20','\x0aNew\x20parent\x20segment\x20\x27','apply','ignore','displaySummary','coveragePercent','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','master','/\x20directory.\x0a','Updating\x20parent\x20segment\x20\x27','Master\x20+\x20Attributes','/\x20→\x20','Master:','Options:\x0a','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','description','runParent','\x27\x20and\x20run\x20workflow?','schemaError','Preview:','Behaviors','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Behavior:','utf-8','✔\x20Created\x20parent\x20segment\x20\x27','.yaml','No\x20parent\x20segments\x20found','interval','parentSegment','segment:parent:desc','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','867455YmODfE','session','createParent','endsWith','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20kill','\x0aChanges\x20to\x20apply\x20to\x20\x27','run','addAttributesFile','column','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Available\x20behaviors:','test','workflowId','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Validating\x20configuration...','\x0a⚠️\x20\x20Migrating:\x20','/sessions/','Fetching\x20SQL\x20for\x20\x27','workflowSessionId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','jsonl','\x20\x20\x20\x20-\x20','previewParentYaml','Found\x20YAML\x20file:\x20','SQL\x20query:\x0a','/app/workflows/','Site:\x20','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','/attempt/','segment:parent:push','addBehaviors','2323454VIuMGC','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Apply\x20changes\x20to\x20\x27','\x27\x20with\x20ID:\x20','setJobId','\x20parent\x20segment','Errors:','cyan','👥\x20','segment','site','length','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','population','Error\x20reading\x20file:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Error:\x20Parent\x20segment\x20name\x20is\x20required','trim','toFixed','text','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','columns','Join\x20on:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','in\x20','Parent\x20segment:\x20','listParents','enriched','201153RKjfDm','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','json','varchar','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','attributesFile','/app/dw/parentSegments/','error','pullParentYaml','Coverage:','stop','\x20rows)','double','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','rowCount','customerGroupFile','displayPreviewResults','message','attribute','Customers:','matchedCount','Error\x20parsing\x20YAML:\x20','keys','execute','filter','replace','verbose','addBehaviorsFile','getParentFull','xdg-open','✔\x20Renamed\x20directory\x20to\x20','updateParent','Join:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20No\x20sample\x20data\x20available','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','errors','Pattern:\x20','repeat','1039455BqUfqJ','Validate:','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','label','behaviors','preview','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Create\x20parent\x20segment\x20\x27','segment:parent:run','Updating'];a29_0x20ad=function(){return _0x1b377a;};return a29_0x20ad();}import a29_0x46e08e from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';function a29_0x193b(_0x44c409,_0x43ebbf){_0x44c409=_0x44c409-0x1b4;const _0x20adc4=a29_0x20ad();let _0x193ba8=_0x20adc4[_0x44c409];return _0x193ba8;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x4cd30e from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/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='parent_segment';function openBrowser(_0xcd05af){const _0x18542e=a29_0x193b,_0x209be4=process[_0x18542e(0x1fc)],_0x87378e=_0x209be4===_0x18542e(0x1f9)?_0x18542e(0x1d5):_0x209be4==='win32'?_0x18542e(0x1ed):_0x18542e(0x2bc);spawn(_0x87378e,[_0xcd05af],{'detached':!![],'stdio':_0x18542e(0x242)})['unref']();}function migrateLegacyDirectory(){const _0x1242f7=a29_0x193b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x48b660=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x48b660[_0x1242f7(0x1c8)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1242f7(0x2a6)](a29_0x4cd30e[_0x1242f7(0x20a)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x1242f7(0x23e))),console[_0x1242f7(0x2a6)](a29_0x4cd30e['dim'](_0x1242f7(0x25e)+LEGACY_PARENT_SEGMENT_DIR+_0x1242f7(0x247))),![];console[_0x1242f7(0x2a6)](a29_0x4cd30e[_0x1242f7(0x20a)](_0x1242f7(0x270)+LEGACY_PARENT_SEGMENT_DIR+_0x1242f7(0x24a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x4cd30e[_0x1242f7(0x239)](_0x1242f7(0x2bd)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x22fd34){const _0x543522=_0x22fd34 instanceof Error?_0x22fd34[_0x1242f7(0x2b0)]:String(_0x22fd34);return console['error'](a29_0x4cd30e['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x543522+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x192174(0x267)](_0x1f18a6){const _0x5ffa0d=a29_0x192174;return migrateLegacyDirectory(),super[_0x5ffa0d(0x267)](_0x1f18a6);}}function resolveYamlFile(_0x4ff979){const _0x51f9c8=a29_0x192174;if(_0x4ff979[_0x51f9c8(0x262)](_0x51f9c8(0x1e5))||_0x4ff979[_0x51f9c8(0x262)](_0x51f9c8(0x258)))return _0x4ff979;return a29_0x46e08e[_0x51f9c8(0x22f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4ff979)+_0x51f9c8(0x1e5));}function formatProgressMessage(_0x5302a0){const _0x8299de=a29_0x192174,_0x20aba1=_0x5302a0[_0x8299de(0x1e3)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x20aba1){const [,_0x8388c9,_0x1d34a5,_0x29d37e='']=_0x20aba1;return a29_0x4cd30e[_0x8299de(0x201)](_0x8388c9+':')+'\x20'+_0x1d34a5+a29_0x4cd30e[_0x8299de(0x201)](_0x29d37e);}return a29_0x4cd30e[_0x8299de(0x201)](_0x5302a0);}function showFileNotFoundError(_0x5c6c39,_0x10e0f8){const _0x220ef6=a29_0x192174;console[_0x220ef6(0x2a6)](a29_0x4cd30e[_0x220ef6(0x1ea)](_0x220ef6(0x22b)+_0x5c6c39+'\x0a')),console[_0x220ef6(0x2a6)](a29_0x4cd30e['cyan'](_0x220ef6(0x26a)+_0x10e0f8+_0x220ef6(0x234)));}function showParentSegmentNotSetError(_0x4edbcc){const _0x2a390a=a29_0x192174;console[_0x2a390a(0x2a6)](a29_0x4cd30e[_0x2a390a(0x20a)](_0x2a390a(0x207))),console[_0x2a390a(0x2a6)](_0x4edbcc);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x220);[a29_0x192174(0x24e)]=a29_0x192174(0x225);async[a29_0x192174(0x2b6)](_0x4e56bc){const _0x1a159f=a29_0x192174,{options:_0x12d0a3,args:_0x57819b,tdx:_0x1dad05}=_0x4e56bc,_0x161021=_0x57819b[0x0];_0x12d0a3[_0x1a159f(0x2b9)]&&(console[_0x1a159f(0x2a6)](_0x1a159f(0x27b)+_0x12d0a3[_0x1a159f(0x28b)]),_0x161021&&console[_0x1a159f(0x2a6)](_0x1a159f(0x2c4)+_0x161021));const _0x11c498=await withSpinner(_0x161021?_0x1a159f(0x210)+_0x161021+_0x1a159f(0x1f5):_0x1a159f(0x233),()=>_0x1dad05['segment'][_0x1a159f(0x29c)](),{'verbose':_0x12d0a3[_0x1a159f(0x2b9)]});let _0x209410=_0x11c498['data'];if(_0x161021){const _0x62884a=_0x161021[_0x1a159f(0x2b8)](/[.+^${}()|[\]\\]/g,_0x1a159f(0x216))[_0x1a159f(0x2b8)](/\*/g,'.*')[_0x1a159f(0x2b8)](/\?/g,'.'),_0x42b4b2=new RegExp('^'+_0x62884a+'$','i');_0x209410=_0x209410[_0x1a159f(0x2b7)](_0x20a669=>_0x42b4b2[_0x1a159f(0x26c)](_0x20a669['attributes'][_0x1a159f(0x1e2)]));}_0x209410[_0x1a159f(0x218)]((_0xc09054,_0x347ecd)=>_0xc09054[_0x1a159f(0x209)][_0x1a159f(0x1e2)]['localeCompare'](_0x347ecd[_0x1a159f(0x209)][_0x1a159f(0x1e2)])),console['error']('✔\x20Found\x20'+_0x209410[_0x1a159f(0x28c)]+_0x1a159f(0x286)+(_0x209410[_0x1a159f(0x28c)]!==0x1?'s':''));if(_0x12d0a3[_0x1a159f(0x200)]===_0x1a159f(0x2a0)||_0x12d0a3[_0x1a159f(0x200)]===_0x1a159f(0x275))await handleSDKOutput(_0x209410,_0x12d0a3);else{if(_0x209410[_0x1a159f(0x28c)]===0x0)_0x161021?console['log']('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x161021):console['log'](_0x1a159f(0x259));else for(const _0x2fb2f9 of _0x209410){const _0x55a714=_0x2fb2f9[_0x1a159f(0x209)][_0x1a159f(0x28e)]?a29_0x4cd30e[_0x1a159f(0x201)]('\x20('+formatRows(_0x2fb2f9['attributes']['population'])+')'):'';console[_0x1a159f(0x22c)](_0x1a159f(0x289)+_0x2fb2f9['attributes']['name']+_0x55a714);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']='segment:parent:create';[a29_0x192174(0x24e)]=a29_0x192174(0x23b);async[a29_0x192174(0x2b6)](_0x264ef2){const _0x37d869=a29_0x192174,{options:_0x20fd97,args:_0x3360a6,tdx:_0x518c2e}=_0x264ef2;console[_0x37d869(0x2a6)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xd2f34f=_0x20fd97;if(_0x3360a6[_0x37d869(0x28c)]===0x0)return console['error'](a29_0x4cd30e['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x37d869(0x2a6)](_0x37d869(0x296)),0x1;const _0x1ca10e=_0x3360a6[0x0];if(!_0xd2f34f['database']||!_0xd2f34f[_0x37d869(0x1fa)])return console['error'](_0x37d869(0x290)),console[_0x37d869(0x2a6)](_0x37d869(0x296)),0x1;_0xd2f34f[_0x37d869(0x2b9)]&&(console[_0x37d869(0x2a6)](_0x37d869(0x27b)+_0xd2f34f[_0x37d869(0x28b)]),console[_0x37d869(0x2a6)](_0x37d869(0x23f)+_0x1ca10e),console[_0x37d869(0x2a6)](_0x37d869(0x21d)+_0xd2f34f['database']),console[_0x37d869(0x2a6)]('Table:\x20'+_0xd2f34f[_0x37d869(0x1fa)]));const _0x455d8d=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x209)],_0xd2f34f[_0x37d869(0x2a4)]),_0x36c080=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x2cb)],_0xd2f34f['behaviorsFile']),_0x55fcae=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x226)],_0xd2f34f[_0x37d869(0x2ae)]),_0xbc87f={'name':_0x1ca10e,'description':_0xd2f34f[_0x37d869(0x24e)],'scheduleType':_0xd2f34f['scheduleType'],'scheduleOption':_0xd2f34f[_0x37d869(0x22e)],'timezone':_0xd2f34f[_0x37d869(0x213)],'master':{'parentDatabaseName':_0xd2f34f[_0x37d869(0x1c1)],'parentTableName':_0xd2f34f['table']},'attributes':_0x455d8d,'behaviors':_0x36c080,'customerGroup':_0x55fcae},_0x4e98dc=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x1ca10e+_0x37d869(0x1f5),()=>_0x518c2e[_0x37d869(0x28a)][_0x37d869(0x261)](_0xbc87f),{'verbose':_0x20fd97[_0x37d869(0x2b9)]}),_0x23acde=_0x4e98dc[_0x37d869(0x1f0)];return console[_0x37d869(0x2a6)](_0x37d869(0x257)+_0x23acde[_0x37d869(0x1e2)]+_0x37d869(0x284)+_0x23acde['id']),await handleSDKOutput([_0x23acde],_0x20fd97),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:update';[a29_0x192174(0x24e)]=a29_0x192174(0x291);async[a29_0x192174(0x2b6)](_0x1fbd45){const _0x573eb1=a29_0x192174,{options:_0x2f2c18,args:_0x281f06,tdx:_0x533bcf}=_0x1fbd45;console[_0x573eb1(0x2a6)]('\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'+_0x573eb1(0x232));const _0x52812e=_0x2f2c18;if(_0x281f06[_0x573eb1(0x28c)]===0x0)return console[_0x573eb1(0x2a6)](a29_0x4cd30e['red'](_0x573eb1(0x292))),console['error'](_0x573eb1(0x254)),0x1;const _0x23bd34=_0x281f06[0x0];_0x52812e[_0x573eb1(0x2b9)]&&(console[_0x573eb1(0x2a6)](_0x573eb1(0x27b)+_0x52812e[_0x573eb1(0x28b)]),console[_0x573eb1(0x2a6)](_0x573eb1(0x29b)+_0x23bd34));const _0x4d75e8=await withSpinner(_0x573eb1(0x229)+_0x23bd34+'\x27...',()=>_0x533bcf[_0x573eb1(0x28a)][_0x573eb1(0x2bb)](_0x23bd34),{'verbose':_0x52812e[_0x573eb1(0x2b9)]}),_0x532aa3=_0x4d75e8[_0x573eb1(0x1f0)],_0x2f10e0=await loadJSONFromOptions(_0x52812e[_0x573eb1(0x219)],_0x52812e[_0x573eb1(0x268)]),_0x43c7f2=await loadJSONFromOptions(_0x52812e[_0x573eb1(0x280)],_0x52812e[_0x573eb1(0x2ba)]),_0x551a5d={'name':_0x532aa3[_0x573eb1(0x1e2)],'description':_0x52812e[_0x573eb1(0x24e)]!==undefined?_0x52812e[_0x573eb1(0x24e)]:_0x532aa3[_0x573eb1(0x24e)],'scheduleType':_0x52812e[_0x573eb1(0x202)]!==undefined?_0x52812e['scheduleType']:_0x532aa3[_0x573eb1(0x202)],'scheduleOption':_0x52812e[_0x573eb1(0x22e)]!==undefined?_0x52812e[_0x573eb1(0x22e)]:_0x532aa3[_0x573eb1(0x22e)],'timezone':_0x52812e['timezone']!==undefined?_0x52812e[_0x573eb1(0x213)]:_0x532aa3[_0x573eb1(0x213)],'master':_0x532aa3[_0x573eb1(0x246)],'attributes':_0x2f10e0?[..._0x532aa3[_0x573eb1(0x209)]||[],..._0x2f10e0]:_0x532aa3['attributes'],'behaviors':_0x43c7f2?[..._0x532aa3['behaviors']||[],..._0x43c7f2]:_0x532aa3[_0x573eb1(0x2cb)],'customerGroup':_0x532aa3[_0x573eb1(0x226)]},_0x485301=await withSpinner(_0x573eb1(0x248)+_0x23bd34+_0x573eb1(0x1f5),()=>_0x533bcf[_0x573eb1(0x28a)][_0x573eb1(0x2be)](_0x23bd34,_0x551a5d),{'verbose':_0x52812e[_0x573eb1(0x2b9)]}),_0x5e23e5=_0x485301[_0x573eb1(0x1f0)];return console[_0x573eb1(0x2a6)](_0x573eb1(0x211)+_0x5e23e5[_0x573eb1(0x1e2)]+'\x27'),await handleSDKOutput([_0x5e23e5],_0x52812e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x238);[a29_0x192174(0x24e)]=a29_0x192174(0x1cd);async[a29_0x192174(0x2b6)](_0x5b62b3){const _0x471990=a29_0x192174,{options:_0x24881b,args:_0x972473,tdx:_0x51f1cd}=_0x5b62b3,_0x42881c=_0x24881b,_0x4e5554=_0x972473[0x0]||_0x24881b[_0x471990(0x25b)];if(!_0x4e5554)return showParentSegmentNotSetError(_0x471990(0x1cb)+_0x471990(0x2a2)),0x1;if(_0x42881c['use']&&_0x42881c['output'])return console['error'](a29_0x4cd30e[_0x471990(0x1ea)](_0x471990(0x2d4))),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x1ca))),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x221)+PARENT_SEGMENT_DIR+_0x471990(0x1ec))),console['error'](a29_0x4cd30e[_0x471990(0x288)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x154816=_0x42881c[_0x471990(0x1f3)]||a29_0x46e08e[_0x471990(0x22f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4e5554)+_0x471990(0x1e5));_0x42881c[_0x471990(0x2b9)]&&(console['error'](_0x471990(0x27b)+_0x42881c[_0x471990(0x28b)]),console[_0x471990(0x2a6)]('Parent\x20segment:\x20'+_0x4e5554),console[_0x471990(0x2a6)](_0x471990(0x21c)+_0x154816));const _0x207896=await withSpinner(_0x471990(0x1bf)+_0x4e5554+_0x471990(0x1f5),()=>_0x51f1cd[_0x471990(0x28a)][_0x471990(0x2a7)](_0x4e5554),{'verbose':_0x42881c[_0x471990(0x2b9)]}),_0x2d289b=_0x207896['data'];if(existsSync(_0x154816)){const _0x46dd99=readFileSync(_0x154816,_0x471990(0x256)),_0xa13606=generateDiff(_0x46dd99,_0x2d289b);if(!hasChanges(_0xa13606))console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+'\x20No\x20changes\x20-\x20'+a29_0x4cd30e[_0x471990(0x288)](_0x154816)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x471990(0x1ee)+_0x154816+'\x27:'),console[_0x471990(0x2a6)]('─'[_0x471990(0x2c5)](0x3c)),console[_0x471990(0x2a6)](formatDiffWithColors(_0xa13606)),console[_0x471990(0x2a6)]('─'[_0x471990(0x2c5)](0x3c));if(!_0x42881c['yes']){const _0x3b42e4=await confirmKey('Overwrite\x20\x27'+_0x154816+'\x27?');if(!_0x3b42e4)return console[_0x471990(0x2a6)]('Aborted.'),0x1;}writeFileSync(_0x154816,_0x2d289b,_0x471990(0x256)),console[_0x471990(0x2a6)](a29_0x4cd30e['green']('✔')+_0x471990(0x26e)+a29_0x4cd30e[_0x471990(0x288)](_0x154816));}}else{const _0x1f90fb=a29_0x46e08e['dirname'](_0x154816);!existsSync(_0x1f90fb)&&mkdirSync(_0x1f90fb,{'recursive':!![]}),writeFileSync(_0x154816,_0x2d289b,_0x471990(0x256)),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+_0x471990(0x26e)+a29_0x4cd30e[_0x471990(0x288)](_0x154816));}return saveSessionContext({'parent_segment':_0x4e5554},_0x42881c[_0x471990(0x260)]),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+'\x20Context\x20set:\x20'+a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x1e8))+_0x471990(0x1f1)+a29_0x4cd30e[_0x471990(0x288)](_0x4e5554)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x27f);[a29_0x192174(0x24e)]=a29_0x192174(0x1ff);async[a29_0x192174(0x2b6)](_0x5b61a7){const _0x79d5d8=a29_0x192174,{options:_0x484730,args:_0x142f21,tdx:_0x1fd95}=_0x5b61a7,_0x52282d=_0x484730,_0x258d4b=_0x142f21[0x0]||_0x484730[_0x79d5d8(0x25b)];if(!_0x258d4b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x79d5d8(0x2d5)),0x1;const _0x44782d=resolveYamlFile(_0x258d4b);if(!existsSync(_0x44782d))return showFileNotFoundError(_0x44782d,_0x258d4b),0x1;_0x52282d[_0x79d5d8(0x2b9)]&&(console[_0x79d5d8(0x2a6)](_0x79d5d8(0x27b)+_0x52282d['site']),console[_0x79d5d8(0x2a6)](_0x79d5d8(0x1e7)+_0x44782d));let _0x13887f;try{_0x13887f=readFileSync(_0x44782d,'utf-8');}catch(_0x391209){const _0x58086d=_0x391209 instanceof Error?_0x391209[_0x79d5d8(0x2b0)]:String(_0x391209);return console[_0x79d5d8(0x2a6)]('Error\x20reading\x20file:\x20'+_0x58086d),0x1;}const _0x4cf654=await withSpinner(_0x79d5d8(0x1c6),()=>_0x1fd95[_0x79d5d8(0x28a)][_0x79d5d8(0x1f7)](_0x13887f),{'verbose':_0x52282d[_0x79d5d8(0x2b9)]}),_0x9689e6=_0x4cf654[_0x79d5d8(0x1f0)],{isNew:_0x358b2c,name:_0x18d017,hasChanges:_0x4be11a,diffFormatted:_0x1f5d5b}=_0x9689e6;if(!_0x4be11a)return console['error'](_0x79d5d8(0x1ef)+_0x18d017+_0x79d5d8(0x20d)),0x0;_0x358b2c?console[_0x79d5d8(0x2a6)](_0x79d5d8(0x240)+_0x18d017+'\x27:'):console[_0x79d5d8(0x2a6)](_0x79d5d8(0x266)+_0x18d017+'\x27:');console[_0x79d5d8(0x2a6)]('─'[_0x79d5d8(0x2c5)](0x3c)),console[_0x79d5d8(0x2a6)](_0x1f5d5b),console[_0x79d5d8(0x2a6)]('─'['repeat'](0x3c));const _0x3f797a=_0x358b2c?_0x79d5d8(0x2ce)+_0x18d017+'\x27?':_0x79d5d8(0x283)+_0x18d017+'\x27?';if(!_0x52282d[_0x79d5d8(0x1d3)]){const _0x3b185f=await confirmKey(_0x3f797a);if(!_0x3b185f)return console[_0x79d5d8(0x2a6)](_0x79d5d8(0x1e4)),0x1;}const _0x42bafd=_0x358b2c?_0x79d5d8(0x20f):_0x79d5d8(0x2d0),_0x58c31c=await withSpinner(_0x42bafd+_0x79d5d8(0x1cf)+_0x18d017+_0x79d5d8(0x1f5),()=>_0x9689e6[_0x79d5d8(0x241)](),{'verbose':_0x52282d[_0x79d5d8(0x2b9)]}),_0x36f2f1=_0x58c31c[_0x79d5d8(0x1f0)],_0x474117=getConsoleNextUrl(_0x52282d['site'],'/app/dw/parentSegments/'+_0x36f2f1['id']),_0x1b8e78=_0x358b2c?_0x79d5d8(0x1d2):'Updated';return console[_0x79d5d8(0x2a6)]('✔\x20'+_0x1b8e78+_0x79d5d8(0x1cf)+_0x36f2f1[_0x79d5d8(0x1e2)]+'\x27'),console[_0x79d5d8(0x2a6)]('\x20\x20'+_0x474117),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x1de);[a29_0x192174(0x24e)]=a29_0x192174(0x25d);async[a29_0x192174(0x2b6)](_0x39df52){const _0x50adf2=a29_0x192174,{options:_0x316094,args:_0x27222a,tdx:_0x5025ee}=_0x39df52,_0x4107fe=_0x316094,_0xb240b0=_0x27222a[0x0]||_0x316094[_0x50adf2(0x25b)];if(!_0xb240b0)return showParentSegmentNotSetError(_0x50adf2(0x2c2)+_0x50adf2(0x282)+_0x50adf2(0x24c)+_0x50adf2(0x2d3)+_0x50adf2(0x1fe)+_0x50adf2(0x1e1)),0x1;const _0x5428ae=resolveYamlFile(_0xb240b0);if(!existsSync(_0x5428ae))return showFileNotFoundError(_0x5428ae,_0xb240b0),0x1;_0x4107fe[_0x50adf2(0x2b9)]&&(console[_0x50adf2(0x2a6)](_0x50adf2(0x27b)+_0x4107fe[_0x50adf2(0x28b)]),console[_0x50adf2(0x2a6)]('YAML\x20file:\x20'+_0x5428ae));let _0x18ebac;try{_0x18ebac=readFileSync(_0x5428ae,_0x50adf2(0x256));}catch(_0x314c7f){const _0x3e198a=_0x314c7f instanceof Error?_0x314c7f['message']:String(_0x314c7f);return console[_0x50adf2(0x2a6)](_0x50adf2(0x28f)+_0x3e198a),0x1;}const _0x2ce437=createCommandSpinner(a29_0x4cd30e[_0x50adf2(0x201)](_0x50adf2(0x26f)),{'verbose':_0x4107fe[_0x50adf2(0x2b9)]});_0x2ce437[_0x50adf2(0x1ed)]();const _0x288c50={'onProgress':_0xfb62d8=>{const _0xedb851=_0x50adf2;_0x2ce437[_0xedb851(0x295)]=formatProgressMessage(_0xfb62d8);}};if(_0x4107fe[_0x50adf2(0x246)])_0x288c50[_0x50adf2(0x246)]=!![];if(_0x4107fe[_0x50adf2(0x29d)])_0x288c50[_0x50adf2(0x29d)]=!![];_0x4107fe[_0x50adf2(0x2b1)]&&(_0x288c50['attribute']=_0x4107fe['attribute']);_0x4107fe[_0x50adf2(0x1e6)]&&(_0x288c50['behavior']=_0x4107fe[_0x50adf2(0x1e6)]);if(_0x4107fe[_0x50adf2(0x25a)])_0x288c50[_0x50adf2(0x25a)]=_0x4107fe[_0x50adf2(0x25a)];let _0x123e62;try{_0x123e62=await _0x5025ee[_0x50adf2(0x28a)]['validateParentYaml'](_0x18ebac,_0x288c50),_0x2ce437[_0x50adf2(0x2a9)]();}catch(_0x47aee7){_0x2ce437[_0x50adf2(0x2a9)]();throw _0x47aee7;}const _0x92fdec=_0x4107fe[_0x50adf2(0x25a)]||'-1d';return this['displayValidateResults'](_0x123e62,_0x288c50,_0x5428ae,_0x92fdec),_0x123e62['allValid']?0x0:0x1;}[a29_0x192174(0x21b)](_0x4a10eb,_0x11dcca,_0x3e58b2,_0x2e32ec){const _0x423d9e=a29_0x192174;console['error']('\x0a'+a29_0x4cd30e[_0x423d9e(0x20c)](_0x423d9e(0x2c7))+'\x20'+_0x4a10eb[_0x423d9e(0x1e2)]),console[_0x423d9e(0x2a6)]('═'[_0x423d9e(0x2c5)](0x3c)),this[_0x423d9e(0x222)](_0x4a10eb);if(typeof _0x11dcca[_0x423d9e(0x2b1)]==='string'){this['displayAttributesStats'](_0x4a10eb),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2b1),_0x11dcca[_0x423d9e(0x2b1)]);return;}if(_0x11dcca[_0x423d9e(0x2b1)]===!![]){this[_0x423d9e(0x235)](_0x4a10eb),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x209));return;}if(typeof _0x11dcca['behavior']===_0x423d9e(0x23c)){this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x1e6),_0x11dcca[_0x423d9e(0x1e6)]);return;}if(_0x11dcca[_0x423d9e(0x1e6)]===!![]){this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this['displayPreviewHints'](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2cb));return;}this[_0x423d9e(0x235)](_0x4a10eb),this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this['displayPreviewHints'](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2d7));}[a29_0x192174(0x204)](_0x2e9287,_0x33e220,_0xe43cdb,_0x296cd2){const _0x44f6a8=a29_0x192174;console[_0x44f6a8(0x2a6)]('\x0a'+a29_0x4cd30e[_0x44f6a8(0x201)](_0x44f6a8(0x224)));const _0x501a75=_0x33e220!=='-1d'?_0x44f6a8(0x206)+_0x33e220:'';if(_0xe43cdb===_0x44f6a8(0x2b1)&&_0x296cd2)console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2e9287+_0x44f6a8(0x1d0)+_0x296cd2+'\x22'+_0x501a75));else{if(_0xe43cdb==='behavior'&&_0x296cd2)console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x1ba)+_0x296cd2+'\x22'+_0x501a75));else(_0xe43cdb===_0x44f6a8(0x209)||_0xe43cdb===_0x44f6a8(0x2d7))&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x20e)+_0x501a75));}(_0xe43cdb===_0x44f6a8(0x2cb)||_0xe43cdb===_0x44f6a8(0x2d7))&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x1f4)+_0x501a75)),_0xe43cdb===_0x44f6a8(0x2d7)&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2e9287+_0x44f6a8(0x1e9)+_0x501a75));}[a29_0x192174(0x222)](_0x56f01e){const _0x18cc72=a29_0x192174,{master:_0x449c63}=_0x56f01e,_0x27fa28=_0x449c63[_0x18cc72(0x1b7)]?a29_0x4cd30e[_0x18cc72(0x239)]('✔'):a29_0x4cd30e[_0x18cc72(0x1ea)]('✘');console[_0x18cc72(0x2a6)]('\x0a'+a29_0x4cd30e['dim'](_0x18cc72(0x1c7))),console['error'](_0x27fa28+'\x20'+a29_0x4cd30e[_0x18cc72(0x20c)](_0x449c63[_0x18cc72(0x1c1)]+'.'+_0x449c63['table'])),_0x449c63[_0x18cc72(0x1b7)]?_0x449c63[_0x18cc72(0x2ad)]!==undefined&&console[_0x18cc72(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x18cc72(0x201)](_0x18cc72(0x1db))+'\x20'+a29_0x4cd30e[_0x18cc72(0x288)](formatRows(_0x449c63['rowCount']))):console[_0x18cc72(0x2a6)]('\x20\x20'+a29_0x4cd30e['red'](_0x18cc72(0x21a))+'\x20'+_0x449c63['schemaError']);}[a29_0x192174(0x235)](_0x249ca8){const _0x1dad13=a29_0x192174;if(_0x249ca8[_0x1dad13(0x209)][_0x1dad13(0x28c)]===0x0)return;console['error']('\x0a'+a29_0x4cd30e[_0x1dad13(0x201)]('Attributes'));for(const _0x97efc0 of _0x249ca8[_0x1dad13(0x209)]){const _0x17867b=_0x97efc0[_0x1dad13(0x1b7)]?a29_0x4cd30e[_0x1dad13(0x239)]('✔'):a29_0x4cd30e['red']('✘');let _0x3328dd='';if(_0x97efc0[_0x1dad13(0x1b7)]&&_0x97efc0[_0x1dad13(0x2b3)]!==undefined&&_0x97efc0[_0x1dad13(0x244)]!==undefined){const _0x5f41c4=_0x97efc0[_0x1dad13(0x244)]['toFixed'](0x1),_0xc9d6f=_0x97efc0[_0x1dad13(0x244)]>=0x50?a29_0x4cd30e[_0x1dad13(0x239)]:_0x97efc0['coveragePercent']>=0x32?a29_0x4cd30e[_0x1dad13(0x20a)]:a29_0x4cd30e[_0x1dad13(0x1ea)];_0x3328dd='\x20'+a29_0x4cd30e[_0x1dad13(0x201)](_0x1dad13(0x2a8))+'\x20'+_0xc9d6f(_0x5f41c4+'%')+'\x20('+formatRows(_0x97efc0[_0x1dad13(0x2b3)])+_0x1dad13(0x2aa);}console[_0x1dad13(0x2a6)](_0x17867b+'\x20'+a29_0x4cd30e[_0x1dad13(0x20c)](_0x97efc0[_0x1dad13(0x1e2)])+_0x3328dd),console['error']('\x20\x20'+a29_0x4cd30e['dim']('Source:')+'\x20'+a29_0x4cd30e[_0x1dad13(0x20c)](_0x97efc0[_0x1dad13(0x1c1)]+'.'+_0x97efc0[_0x1dad13(0x1fa)]));const _0x187480=_0x97efc0[_0x1dad13(0x1df)]===_0x97efc0['foreignKey']?a29_0x4cd30e['dim'](_0x1dad13(0x298))+'\x20'+_0x97efc0[_0x1dad13(0x1df)]:a29_0x4cd30e[_0x1dad13(0x201)]('Join:')+'\x20'+_0x97efc0['joinKey']+_0x1dad13(0x1f1)+_0x97efc0[_0x1dad13(0x203)];console['error']('\x20\x20'+_0x187480),console[_0x1dad13(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x1dad13(0x201)](_0x1dad13(0x20b))),this[_0x1dad13(0x2d6)](_0x97efc0['columns']),!_0x97efc0[_0x1dad13(0x1b7)]&&console[_0x1dad13(0x2a6)]('\x20\x20'+a29_0x4cd30e['red'](_0x1dad13(0x21a))+'\x20'+_0x97efc0['schemaError']);}}[a29_0x192174(0x212)](_0x196f15,_0x26a7b0){const _0x5c3dc6=a29_0x192174;if(_0x196f15[_0x5c3dc6(0x2cb)][_0x5c3dc6(0x28c)]===0x0)return;console[_0x5c3dc6(0x2a6)]('\x0a'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x253))+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)]('('+_0x26a7b0+')'));for(const _0x2af336 of _0x196f15[_0x5c3dc6(0x2cb)]){const _0xc334ef=_0x2af336[_0x5c3dc6(0x1b7)]?a29_0x4cd30e[_0x5c3dc6(0x239)]('✔'):a29_0x4cd30e['red']('✘');let _0x3eb9cc='';if(_0x2af336[_0x5c3dc6(0x1b7)]&&_0x2af336['customersWithEvents']!==undefined&&_0x2af336[_0x5c3dc6(0x22d)]!==undefined){const _0x3222c2=_0x2af336['customerPercent']?.[_0x5c3dc6(0x294)](0x1)||'?',_0x5acfce=(_0x2af336[_0x5c3dc6(0x1bc)]??0x0)>=0x32?a29_0x4cd30e['green']:(_0x2af336[_0x5c3dc6(0x1bc)]??0x0)>=0x14?a29_0x4cd30e[_0x5c3dc6(0x20a)]:a29_0x4cd30e['red'];_0x3eb9cc='\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x2b2))+'\x20'+_0x5acfce(formatRows(_0x2af336[_0x5c3dc6(0x1d8)]))+'\x20('+_0x3222c2+'%)\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)]('Events:')+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x288)](formatRows(_0x2af336[_0x5c3dc6(0x22d)]));}console['error'](_0xc334ef+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x20c)](_0x2af336['name'])+_0x3eb9cc),console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x1fb))+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x20c)](_0x2af336[_0x5c3dc6(0x1c1)]+'.'+_0x2af336[_0x5c3dc6(0x1fa)]));const _0x4c2015=_0x2af336[_0x5c3dc6(0x1df)]===_0x2af336[_0x5c3dc6(0x203)]?a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x298))+'\x20'+_0x2af336[_0x5c3dc6(0x1df)]:a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x2bf))+'\x20'+_0x2af336[_0x5c3dc6(0x1df)]+_0x5c3dc6(0x1f1)+_0x2af336[_0x5c3dc6(0x203)];console['error']('\x20\x20'+_0x4c2015),console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x5c3dc6(0x20b))),this[_0x5c3dc6(0x2d6)](_0x2af336[_0x5c3dc6(0x297)]),!_0x2af336['schemaValid']&&console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x5c3dc6(0x1ea)](_0x5c3dc6(0x21a))+'\x20'+_0x2af336[_0x5c3dc6(0x251)]);}}[a29_0x192174(0x2d6)](_0x4c00a3){const _0x3c0cf3=a29_0x192174;for(const _0x163add of _0x4c00a3){_0x163add[_0x3c0cf3(0x2ca)]===_0x163add[_0x3c0cf3(0x269)]||_0x163add[_0x3c0cf3(0x269)]==='*'?console['error'](_0x3c0cf3(0x276)+_0x163add[_0x3c0cf3(0x2ca)]):console[_0x3c0cf3(0x2a6)](_0x3c0cf3(0x276)+_0x163add[_0x3c0cf3(0x2ca)]+'\x20'+a29_0x4cd30e[_0x3c0cf3(0x201)]('('+_0x163add[_0x3c0cf3(0x269)]+')'));}}[a29_0x192174(0x243)](_0x3f8732){const _0x95da38=a29_0x192174;console[_0x95da38(0x2a6)]('─'[_0x95da38(0x2c5)](0x3c));if(_0x3f8732[_0x95da38(0x2c3)][_0x95da38(0x28c)]>0x0){console[_0x95da38(0x2a6)]('\x0a'+a29_0x4cd30e[_0x95da38(0x1ea)]('Errors:'));for(const _0x193845 of _0x3f8732[_0x95da38(0x2c3)]){console[_0x95da38(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x95da38(0x1ea)]('•')+'\x20'+_0x193845);}}_0x3f8732[_0x95da38(0x1b8)]&&console[_0x95da38(0x2a6)]('\x0a'+a29_0x4cd30e[_0x95da38(0x239)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]='segment:parent:preview';['description']=a29_0x192174(0x227);async['execute'](_0x4e19af){const _0x2709dc=a29_0x192174,{options:_0x4c33d3,args:_0x3d688e,tdx:_0x30f06e}=_0x4e19af,_0x550a40=_0x4c33d3,_0x266893=_0x3d688e[0x0]||_0x4c33d3[_0x2709dc(0x25b)];if(!_0x266893)return showParentSegmentNotSetError(_0x2709dc(0x214)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x2709dc(0x231)+_0x2709dc(0x1bd)+_0x2709dc(0x223)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2709dc(0x1e1)),0x1;if(!_0x550a40[_0x2709dc(0x246)]&&!_0x550a40[_0x2709dc(0x2b1)]&&!_0x550a40[_0x2709dc(0x1e6)]&&!_0x550a40[_0x2709dc(0x29d)])return console['error'](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x23a))),console[_0x2709dc(0x2a6)](_0x2709dc(0x1b5)),console[_0x2709dc(0x2a6)]('Options:'),console[_0x2709dc(0x2a6)](_0x2709dc(0x2d8)),console[_0x2709dc(0x2a6)](_0x2709dc(0x299)),console[_0x2709dc(0x2a6)](_0x2709dc(0x28d)),console['error'](_0x2709dc(0x1b9)),0x1;const _0x2b1167=resolveYamlFile(_0x266893);if(!existsSync(_0x2b1167))return showFileNotFoundError(_0x2b1167,_0x266893),0x1;_0x550a40['verbose']&&(console['error'](_0x2709dc(0x27b)+_0x550a40[_0x2709dc(0x28b)]),console[_0x2709dc(0x2a6)]('YAML\x20file:\x20'+_0x2b1167));let _0x3c9d0d;try{_0x3c9d0d=readFileSync(_0x2b1167,_0x2709dc(0x256));}catch(_0x5905ea){const _0x4b8fe6=_0x5905ea instanceof Error?_0x5905ea[_0x2709dc(0x2b0)]:String(_0x5905ea);return console[_0x2709dc(0x2a6)](_0x2709dc(0x28f)+_0x4b8fe6),0x1;}let _0x533c13;try{_0x533c13=parseYamlString(_0x3c9d0d);}catch(_0x15e719){const _0x2ae555=_0x15e719 instanceof Error?_0x15e719['message']:String(_0x15e719);return console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x2b4)+_0x2ae555)),0x1;}if(_0x550a40[_0x2709dc(0x2b1)]===!![]||_0x550a40['attribute']===''){const _0x392e6c=_0x533c13[_0x2709dc(0x209)]?.[_0x2709dc(0x1d9)](_0x55bd3d=>_0x55bd3d[_0x2709dc(0x1e2)])||[];if(_0x392e6c['length']===0x0)console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x1bb)));else{console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x2c0))),console[_0x2709dc(0x2a6)]('Available\x20attributes:');for(const _0x22c28e of _0x392e6c){console[_0x2709dc(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x2709dc(0x288)](_0x22c28e));}console[_0x2709dc(0x2a6)](_0x2709dc(0x1c2)+_0x266893+_0x2709dc(0x1d0)+_0x392e6c[0x0]+'\x22');}return 0x1;}if(_0x550a40[_0x2709dc(0x1e6)]===!![]||_0x550a40['behavior']===''){const _0x646e0b=_0x533c13[_0x2709dc(0x2cb)]?.[_0x2709dc(0x1d9)](_0x406255=>_0x406255[_0x2709dc(0x1e2)])||[];if(_0x646e0b[_0x2709dc(0x28c)]===0x0)console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a29_0x4cd30e['red'](_0x2709dc(0x2c9))),console[_0x2709dc(0x2a6)](_0x2709dc(0x26b));for(const _0x2620c3 of _0x646e0b){console[_0x2709dc(0x2a6)]('\x20\x20'+a29_0x4cd30e['cyan'](_0x2620c3));}console[_0x2709dc(0x2a6)](_0x2709dc(0x1c2)+_0x266893+_0x2709dc(0x1ba)+_0x646e0b[0x0]+'\x22');}return 0x1;}const _0x27ee08=createCommandSpinner(a29_0x4cd30e['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x550a40['verbose']});_0x27ee08[_0x2709dc(0x1ed)]();const _0x2c2318={'onProgress':_0x1aeee5=>{_0x27ee08['text']=formatProgressMessage(_0x1aeee5);}};if(_0x550a40[_0x2709dc(0x246)])_0x2c2318['master']=!![];if(_0x550a40['attribute']&&typeof _0x550a40[_0x2709dc(0x2b1)]===_0x2709dc(0x23c))_0x2c2318[_0x2709dc(0x2b1)]=_0x550a40[_0x2709dc(0x2b1)];if(_0x550a40['behavior']&&typeof _0x550a40[_0x2709dc(0x1e6)]===_0x2709dc(0x23c))_0x2c2318['behavior']=_0x550a40['behavior'];if(_0x550a40[_0x2709dc(0x29d)])_0x2c2318[_0x2709dc(0x29d)]=!![];if(_0x550a40['interval'])_0x2c2318[_0x2709dc(0x25a)]=_0x550a40['interval'];let _0x400a24;try{_0x400a24=await _0x30f06e[_0x2709dc(0x28a)][_0x2709dc(0x277)](_0x3c9d0d,_0x2c2318),_0x27ee08[_0x2709dc(0x2a9)]();}catch(_0x288e58){_0x27ee08['stop']();throw _0x288e58;}return await this['displayPreviewResults'](_0x400a24,{'master':_0x550a40[_0x2709dc(0x246)],'attribute':typeof _0x550a40[_0x2709dc(0x2b1)]===_0x2709dc(0x23c)?_0x550a40[_0x2709dc(0x2b1)]:undefined,'behavior':typeof _0x550a40[_0x2709dc(0x1e6)]===_0x2709dc(0x23c)?_0x550a40[_0x2709dc(0x1e6)]:undefined,'enriched':_0x550a40[_0x2709dc(0x29d)]}),_0x400a24['allValid']?0x0:0x1;}async[a29_0x192174(0x2af)](_0x17b0da,_0xbfc97b){const _0x4c9ca6=a29_0x192174;console['error']('\x0a'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0x4c9ca6(0x252))+'\x20'+_0x17b0da[_0x4c9ca6(0x1e2)]),console[_0x4c9ca6(0x2a6)]('═'['repeat'](0x3c));if(_0xbfc97b['master']&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x43ed2f=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x24b))+'\x20'+a29_0x4cd30e['bold'](_0x17b0da['master'][_0x4c9ca6(0x1c1)]+'.'+_0x17b0da[_0x4c9ca6(0x246)][_0x4c9ca6(0x1fa)]);await this[_0x4c9ca6(0x2d1)](_0x43ed2f,_0x17b0da['sampleData']);}else{if(_0xbfc97b[_0x4c9ca6(0x2b1)]&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0xd660a1=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x1f2))+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0xbfc97b['attribute']);await this['displaySampleData'](_0xd660a1,_0x17b0da[_0x4c9ca6(0x1d6)]);}else{if(_0xbfc97b[_0x4c9ca6(0x1e6)]&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x13b003=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x255))+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0xbfc97b[_0x4c9ca6(0x1e6)]);await this[_0x4c9ca6(0x2d1)](_0x13b003,_0x17b0da[_0x4c9ca6(0x1d6)]);}else{if(_0xbfc97b['enriched']&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x1aa849=a29_0x4cd30e['dim']('Enriched:')+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0x4c9ca6(0x249));await this['displaySampleData'](_0x1aa849,_0x17b0da[_0x4c9ca6(0x1d6)]);}else!_0x17b0da['sampleData']&&console[_0x4c9ca6(0x2a6)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x17b0da[_0x4c9ca6(0x2c3)][_0x4c9ca6(0x28c)]>0x0){console[_0x4c9ca6(0x2a6)]('─'['repeat'](0x3c)),console[_0x4c9ca6(0x2a6)]('\x0a'+a29_0x4cd30e[_0x4c9ca6(0x1ea)](_0x4c9ca6(0x287)));for(const _0x30f4ba of _0x17b0da[_0x4c9ca6(0x2c3)]){console[_0x4c9ca6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x4c9ca6(0x1ea)]('•')+'\x20'+_0x30f4ba);}}}async[a29_0x192174(0x2d1)](_0x307152,_0x5f23e1){const _0x329fea=a29_0x192174;if(_0x5f23e1[_0x329fea(0x28c)]===0x0){console[_0x329fea(0x2a6)]('\x0a'+_0x307152),console[_0x329fea(0x2a6)](_0x329fea(0x2c1));return;}console['error']('\x0a'+_0x307152);const _0x2c80fb=Object[_0x329fea(0x2b5)](_0x5f23e1[0x0])['map'](_0x56c67c=>({'name':_0x56c67c,'type':typeof _0x5f23e1[0x0][_0x56c67c]===_0x329fea(0x1c3)?_0x329fea(0x2ab):_0x329fea(0x2a1)})),_0x1bf3a7={'queryId':_0x329fea(0x2cc),'columns':_0x2c80fb,'data':_0x5f23e1,'stats':{'state':_0x329fea(0x23d),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5f23e1[_0x329fea(0x28c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x58d84a=formatAsTable(_0x1bf3a7,_0x5f23e1[_0x329fea(0x28c)],!![]);await writeOutput(_0x58d84a,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x2cf);[a29_0x192174(0x24e)]=a29_0x192174(0x29f);async['execute'](_0x2ab6fb){const _0x3cd705=a29_0x192174,{options:_0x36df98,args:_0x1fde6e,tdx:_0x1d4a41}=_0x2ab6fb,_0x1c58a5=_0x36df98,_0xaf3cc=_0x1fde6e[0x0]||_0x36df98[_0x3cd705(0x25b)];if(!_0xaf3cc)return showParentSegmentNotSetError(_0x3cd705(0x27d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x2f8c7b=resolveYamlFile(_0xaf3cc);if(existsSync(_0x2f8c7b)){_0x1c58a5[_0x3cd705(0x2b9)]&&console[_0x3cd705(0x2a6)](_0x3cd705(0x278)+_0x2f8c7b);let _0x3b6644;try{_0x3b6644=readFileSync(_0x2f8c7b,_0x3cd705(0x256));}catch(_0x596ef8){const _0x5347f6=_0x596ef8 instanceof Error?_0x596ef8[_0x3cd705(0x2b0)]:String(_0x596ef8);return console[_0x3cd705(0x2a6)](_0x3cd705(0x28f)+_0x5347f6),0x1;}const _0x2ce902=await withSpinner(_0x3cd705(0x1c6),()=>_0x1d4a41['segment']['pushParentYaml'](_0x3b6644),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]}),_0x34247d=_0x2ce902[_0x3cd705(0x1f0)],{isNew:_0x3c3035,name:_0x29207b,hasChanges:_0x47534d,diffFormatted:_0x152cd9}=_0x34247d;if(_0x47534d){_0x3c3035?console['error'](_0x3cd705(0x240)+_0x29207b+'\x27:'):console[_0x3cd705(0x2a6)](_0x3cd705(0x266)+_0x29207b+'\x27:');console[_0x3cd705(0x2a6)]('─'[_0x3cd705(0x2c5)](0x3c)),console[_0x3cd705(0x2a6)](_0x152cd9),console[_0x3cd705(0x2a6)]('─'['repeat'](0x3c));const _0x27568d=_0x3c3035?_0x3cd705(0x2ce)+_0x29207b+_0x3cd705(0x250):_0x3cd705(0x283)+_0x29207b+'\x27\x20and\x20run\x20workflow?';if(!_0x1c58a5[_0x3cd705(0x1d3)]){const _0x2c743=await confirmKey(_0x27568d);if(!_0x2c743)return console[_0x3cd705(0x2a6)](_0x3cd705(0x1e4)),0x1;}const _0x4fdd32=_0x3c3035?_0x3cd705(0x20f):_0x3cd705(0x2d0);await withSpinner(_0x4fdd32+_0x3cd705(0x1cf)+_0x29207b+_0x3cd705(0x1f5),()=>_0x34247d[_0x3cd705(0x241)](),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]});const _0x4f9356=_0x3c3035?'Created':'Updated';console[_0x3cd705(0x2a6)]('✔\x20'+_0x4f9356+_0x3cd705(0x1cf)+_0x29207b+'\x27');}else console[_0x3cd705(0x2a6)](_0x3cd705(0x1ef)+_0x29207b+_0x3cd705(0x1da));}const _0x482e71=await withSpinner(_0x3cd705(0x1c0)+_0xaf3cc+_0x3cd705(0x1f5),()=>_0x1d4a41[_0x3cd705(0x28a)][_0x3cd705(0x24f)](_0xaf3cc),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]}),_0x2c8065=_0x482e71['data'],_0x3d9e2d=getConsoleUrl(_0x1c58a5[_0x3cd705(0x28b)],_0x3cd705(0x27a)+_0x2c8065[_0x3cd705(0x26d)]+_0x3cd705(0x271)+_0x2c8065[_0x3cd705(0x273)]+_0x3cd705(0x27e)+_0x2c8065['workflowAttemptId']);return console[_0x3cd705(0x2a6)](_0x3cd705(0x27c)),console['error']('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)]('Audience\x20ID:')+'\x20'+_0x2c8065['audienceId']),console[_0x3cd705(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)](_0x3cd705(0x1f8))+'\x20'+_0x2c8065['status']),console[_0x3cd705(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)](_0x3cd705(0x1c5))+'\x20'+_0x2c8065[_0x3cd705(0x273)]),console['error']('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)]('Attempt:')+'\x20'+_0x2c8065['workflowAttemptId']),console['error']('\x20\x20'+_0x3d9e2d),console['error']('\x0a'+a29_0x4cd30e[_0x3cd705(0x201)]('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0x2c8065[_0x3cd705(0x228)]+_0x3cd705(0x265)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x21f);['description']=a29_0x192174(0x1d7);async[a29_0x192174(0x2b6)](_0x439040){const _0x4f8ecd=a29_0x192174,{options:_0x52da37,args:_0x44754c,tdx:_0x16f2ab}=_0x439040,_0x45f9e3=_0x44754c[0x0]||_0x52da37[_0x4f8ecd(0x25b)];if(!_0x45f9e3)return showParentSegmentNotSetError(_0x4f8ecd(0x245)+_0x4f8ecd(0x2ac)),0x1;_0x52da37[_0x4f8ecd(0x2b9)]&&(console[_0x4f8ecd(0x2a6)](_0x4f8ecd(0x27b)+_0x52da37['site']),console[_0x4f8ecd(0x2a6)](_0x4f8ecd(0x29b)+_0x45f9e3));const _0x4ecf98=await withSpinner(_0x4f8ecd(0x1e0)+_0x45f9e3+_0x4f8ecd(0x1f5),()=>_0x16f2ab[_0x4f8ecd(0x28a)][_0x4f8ecd(0x208)](_0x45f9e3),{'verbose':_0x52da37[_0x4f8ecd(0x2b9)]}),_0x2775ed=_0x4ecf98[_0x4f8ecd(0x1f0)];console['error'](_0x4f8ecd(0x230)+_0x2775ed[_0x4f8ecd(0x28c)]+_0x4f8ecd(0x1ce)+(_0x2775ed[_0x4f8ecd(0x28c)]!==0x1?'s':''));if(_0x52da37[_0x4f8ecd(0x2a0)]||_0x52da37[_0x4f8ecd(0x275)])return await handleSDKOutput(_0x2775ed,_0x52da37),0x0;return displayFieldsHumanReadable(_0x2775ed,_0x45f9e3),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:view';['description']='Show\x20parent\x20segment\x20details';async[a29_0x192174(0x2b6)](_0x1d4f1d){const _0x36b53f=a29_0x192174,{options:_0x39068e,args:_0x57d93d,tdx:_0xaf877e}=_0x1d4f1d,_0x445a00=_0x39068e,_0x4d006d=_0x57d93d[0x0]||_0x39068e['parentSegment'];if(!_0x4d006d)return showParentSegmentNotSetError(_0x36b53f(0x1b6)+_0x36b53f(0x274)+_0x36b53f(0x24c)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x39068e['verbose']&&(console[_0x36b53f(0x2a6)](_0x36b53f(0x27b)+_0x39068e['site']),console[_0x36b53f(0x2a6)]('Parent\x20segment:\x20'+_0x4d006d));const _0x5e87b2=await withSpinner(_0x36b53f(0x1bf)+_0x4d006d+'\x27...',()=>_0xaf877e[_0x36b53f(0x28a)][_0x36b53f(0x2bb)](_0x4d006d),{'verbose':_0x39068e[_0x36b53f(0x2b9)]}),_0xd64bc7=_0x5e87b2[_0x36b53f(0x1f0)];if(_0x445a00['web']){const _0x12f04f=getConsoleNextUrl(_0x445a00[_0x36b53f(0x28b)],_0x36b53f(0x2a5)+_0xd64bc7['id']);return console[_0x36b53f(0x2a6)](a29_0x4cd30e[_0x36b53f(0x239)]('✔')+'\x20Opening\x20'+a29_0x4cd30e[_0x36b53f(0x288)](_0x12f04f)),openBrowser(_0x12f04f),0x0;}return await handleSingleObjectOutput(_0xd64bc7,_0x39068e),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x25c);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x192174(0x2b6)](_0x5db736){const _0xefd6d=a29_0x192174,{options:_0x439712,args:_0x4175af,tdx:_0x4d884c}=_0x5db736,_0x291ea5=_0x4175af[0x0]||_0x439712[_0xefd6d(0x25b)];if(!_0x291ea5)return showParentSegmentNotSetError(_0xefd6d(0x2c8)+_0xefd6d(0x264)),0x1;_0x439712[_0xefd6d(0x2b9)]&&(console[_0xefd6d(0x2a6)](_0xefd6d(0x27b)+_0x439712[_0xefd6d(0x28b)]),console[_0xefd6d(0x2a6)]('Parent\x20segment:\x20'+_0x291ea5));const _0x1039b9=await withSpinner(_0xefd6d(0x1d4)+_0x291ea5+_0xefd6d(0x1f5),()=>_0x4d884c[_0xefd6d(0x28a)]['resolveParentId'](_0x291ea5),{'verbose':_0x439712['verbose']}),_0x4f8e0c=_0x1039b9[_0xefd6d(0x1f0)],_0x5b31a2=await withSpinner(_0xefd6d(0x272)+_0x291ea5+_0xefd6d(0x1f5),()=>_0x4d884c['segment']['getParentSQL'](_0x4f8e0c),{'verbose':_0x439712[_0xefd6d(0x2b9)]}),_0x3749ea=await executeSchemaQuery(_0x5b31a2[_0xefd6d(0x1f0)],_0x4d884c,_0x439712);return await handleQueryOutput(_0x3749ea,_0x439712),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:sql';[a29_0x192174(0x24e)]=a29_0x192174(0x205);async[a29_0x192174(0x2b6)](_0x65818a){const _0x2f9c8b=a29_0x192174,{options:_0x33216c,args:_0x78ae3,tdx:_0x72c597}=_0x65818a,_0x2f4e0d=_0x78ae3[0x0]||_0x33216c[_0x2f9c8b(0x25b)];if(!_0x2f4e0d)return showParentSegmentNotSetError(_0x2f9c8b(0x217)+_0x2f9c8b(0x237)),0x1;_0x33216c['verbose']&&(console[_0x2f9c8b(0x2a6)]('Site:\x20'+_0x33216c[_0x2f9c8b(0x28b)]),console[_0x2f9c8b(0x2a6)]('Parent\x20segment:\x20'+_0x2f4e0d));const _0x413f34=await withSpinner(_0x2f9c8b(0x1d4)+_0x2f4e0d+_0x2f9c8b(0x1f5),()=>_0x72c597[_0x2f9c8b(0x28a)][_0x2f9c8b(0x1b4)](_0x2f4e0d),{'verbose':_0x33216c['verbose']}),_0x11dca1=_0x413f34[_0x2f9c8b(0x1f0)],_0x7c118c=await withSpinner(_0x2f9c8b(0x272)+_0x2f4e0d+_0x2f9c8b(0x1f5),()=>_0x72c597[_0x2f9c8b(0x28a)][_0x2f9c8b(0x1d1)](_0x11dca1),{'verbose':_0x33216c[_0x2f9c8b(0x2b9)]}),_0x1d49b7=_0x7c118c[_0x2f9c8b(0x1f0)];return _0x33216c[_0x2f9c8b(0x200)]===_0x2f9c8b(0x2a0)||_0x33216c[_0x2f9c8b(0x200)]===_0x2f9c8b(0x275)?await handleSDKOutput([{'sql':_0x1d49b7}],_0x33216c):console[_0x2f9c8b(0x22c)](_0x1d49b7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x22a);[a29_0x192174(0x24e)]=a29_0x192174(0x2cd);async['execute'](_0x373da3){const _0xea21d3=a29_0x192174,{options:_0x110ae5,args:_0x39c004,tdx:_0xf90b32}=_0x373da3,_0x2969aa=_0x39c004[0x0]||_0x110ae5['parentSegment'];if(!_0x2969aa)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'+_0xea21d3(0x2a3)),0x1;_0x110ae5[_0xea21d3(0x2b9)]&&(console[_0xea21d3(0x2a6)](_0xea21d3(0x27b)+_0x110ae5[_0xea21d3(0x28b)]),console[_0xea21d3(0x2a6)](_0xea21d3(0x29b)+_0x2969aa));const _0x56e72c=await withSpinner(_0xea21d3(0x1d4)+_0x2969aa+_0xea21d3(0x1f5),()=>_0xf90b32[_0xea21d3(0x28a)][_0xea21d3(0x1b4)](_0x2969aa),{'verbose':_0x110ae5['verbose']}),_0x5eb46c=_0x56e72c[_0xea21d3(0x1f0)],_0x413898=await withSpinner(_0xea21d3(0x272)+_0x2969aa+_0xea21d3(0x1f5),()=>_0xf90b32['segment'][_0xea21d3(0x1d1)](_0x5eb46c),{'verbose':_0x110ae5[_0xea21d3(0x2b9)]});let _0x3fea7d=_0x413898[_0xea21d3(0x1f0)];const _0x69f07a=resolveLimit(_0x110ae5['limit'],DEFAULT_DISPLAY_LIMIT),_0x16fdfd=/\bLIMIT\s+\d+/i[_0xea21d3(0x26c)](_0x3fea7d);!_0x16fdfd&&(_0x3fea7d=_0x3fea7d[_0xea21d3(0x293)]()[_0xea21d3(0x2b8)](/;+$/,''),_0x3fea7d=_0xea21d3(0x236)+_0x3fea7d+_0xea21d3(0x24d)+_0x69f07a);_0x110ae5['verbose']&&console[_0xea21d3(0x2a6)](_0xea21d3(0x279)+_0x3fea7d);const _0x2af38b=await withQuerySpinner(_0xea21d3(0x263),async _0x3aadd4=>{const _0x56ca7e=_0xea21d3,_0x22a8c4=await _0xf90b32[_0x56ca7e(0x1c4)][_0x56ca7e(0x2b6)](_0x3fea7d,{'catalog':'td','schema':'information_schema','onJobId':_0x442c55=>{const _0x2fb30c=_0x56ca7e;_0x3aadd4[_0x2fb30c(0x285)](_0x442c55);}});return _0x22a8c4;},{'verbose':_0x110ae5['verbose']}),_0x2ca5a9=_0x2af38b['data'],_0x489c48=_0x2ca5a9[_0xea21d3(0x1fd)]?_0xea21d3(0x21e)+_0x2ca5a9['jobId']+']':'';return console['error'](_0xea21d3(0x1f6)+_0x2ca5a9['stats']['processedRows'][_0xea21d3(0x1dc)]()+'\x20rows\x20'+(_0xea21d3(0x29a)+formatElapsed(_0x2ca5a9[_0xea21d3(0x2d2)][_0xea21d3(0x1eb)])+_0x489c48)),await handleQueryOutput(_0x2ca5a9,_0x110ae5),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a30_0x20ebe7=a30_0x1802;(function(_0x4ce1e9,_0x4e3daf){const _0x1290a6=a30_0x1802,_0x1d489e=_0x4ce1e9();while(!![]){try{const _0x2535e9=parseInt(_0x1290a6(0x1eb))/0x1+parseInt(_0x1290a6(0x1f1))/0x2*(parseInt(_0x1290a6(0x1f8))/0x3)+parseInt(_0x1290a6(0x1f9))/0x4+parseInt(_0x1290a6(0x1f4))/0x5*(-parseInt(_0x1290a6(0x1ed))/0x6)+-parseInt(_0x1290a6(0x200))/0x7*(-parseInt(_0x1290a6(0x1f6))/0x8)+-parseInt(_0x1290a6(0x1ec))/0x9+parseInt(_0x1290a6(0x1f3))/0xa;if(_0x2535e9===_0x4e3daf)break;else _0x1d489e['push'](_0x1d489e['shift']());}catch(_0x128286){_0x1d489e['push'](_0x1d489e['shift']());}}}(a30_0x7ecb,0x74d91));import{BaseCommand}from'./command.js';function a30_0x1802(_0x5778fb,_0x381c59){_0x5778fb=_0x5778fb-0x1ea;const _0x7ecbae=a30_0x7ecb();let _0x1802d2=_0x7ecbae[_0x5778fb];return _0x1802d2;}function a30_0x7ecb(){const _0x673c95=['log','description','config','7irQBUo','length','message','546793YUrNPf','5930073pdKEYB','1278JbaqfQ','Error:\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','8734MrxNrQ','name','3809880lWjVdc','20905IqqQPT','\x20\x20Global:\x20~/.config/tdx/tdx.json','580664zGjhvU','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','627xECgof','459968seGiSM','map','scope','List\x20all\x20available\x20profiles'];a30_0x7ecb=function(){return _0x673c95;};return a30_0x7ecb();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x20ebe7(0x1f2)]=a30_0x20ebe7(0x1f0);[a30_0x20ebe7(0x1fe)]=a30_0x20ebe7(0x1fc);async['execute'](_0x5d3f9c){const _0x39caa5=a30_0x20ebe7,{options:_0x2b9ce1}=_0x5d3f9c;try{const _0x5aea8b=listProfiles(),_0xa56161=getActiveProfile();if(_0x5aea8b[_0x39caa5(0x201)]===0x0)return console[_0x39caa5(0x1fd)](_0x39caa5(0x1ef)),console[_0x39caa5(0x1fd)](_0x39caa5(0x1f7)),console[_0x39caa5(0x1fd)](_0x39caa5(0x1f5)),0x0;const _0x175861=_0x5aea8b[_0x39caa5(0x1fa)](_0x321412=>{const _0x440fa8=_0x39caa5,_0x1a648f=_0x321412[_0x440fa8(0x1f2)]===_0xa56161,_0x5ee529=getProfileParams(_0x321412[_0x440fa8(0x1ff)]);return{'name':_0x321412[_0x440fa8(0x1f2)],'active':_0x1a648f,'scope':_0x321412[_0x440fa8(0x1fb)],'description':_0x321412[_0x440fa8(0x1ff)]['description']||'','params':_0x5ee529};});return await handleSDKOutput(_0x175861,_0x2b9ce1),0x0;}catch(_0x355f25){return _0x355f25 instanceof Error&&console['error'](_0x39caa5(0x1ee)+_0x355f25[_0x39caa5(0x1ea)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x15dba6=a31_0x41ff;(function(_0x347c11,_0x1cfe46){const _0x4b0603=a31_0x41ff,_0x255362=_0x347c11();while(!![]){try{const _0xbff04b=parseInt(_0x4b0603(0x96))/0x1+parseInt(_0x4b0603(0xb2))/0x2*(parseInt(_0x4b0603(0xb0))/0x3)+parseInt(_0x4b0603(0xad))/0x4*(parseInt(_0x4b0603(0xc5))/0x5)+parseInt(_0x4b0603(0x9f))/0x6*(parseInt(_0x4b0603(0xc3))/0x7)+-parseInt(_0x4b0603(0xc4))/0x8+-parseInt(_0x4b0603(0x9c))/0x9+-parseInt(_0x4b0603(0xbb))/0xa*(parseInt(_0x4b0603(0xb3))/0xb);if(_0xbff04b===_0x1cfe46)break;else _0x255362['push'](_0x255362['shift']());}catch(_0x68d4e5){_0x255362['push'](_0x255362['shift']());}}}(a31_0x2714,0xd7eb0));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a31_0x41ff(_0x4d3f37,_0x1ccac9){_0x4d3f37=_0x4d3f37-0x96;const _0x27142e=a31_0x2714();let _0x271436=_0x27142e[_0x4d3f37];return _0x271436;}function a31_0x2714(){const _0x1e0400=['validate','Executing\x20query\x20[','Run\x20Trino\x20queries\x20(streaming)','originalMessage','1687090rUScdn','Statement\x20','setJobId','data','in\x20','execute','\x20splits','join','11675125ogqtUR','4085432IWCuga','5mdATzY','setPhase','jobId','verbose','message','setExtra','catalog','416451eaUAFU','query','database','...','\x20[Job\x20ID:\x20','\x20rows\x20','9190773TNAjtY','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Executing\x20query...','6IYPeaC','site','Schema:\x20','length','information_schema','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','push','name','No\x20SQL\x20provided','processedRows','error','Executing\x20statement\x20','totalSplits','elapsedTimeMillis','6947044twLYXY','stats','description','34464qiFzON','Site:\x20','196XmUkuo','165aRlfpG','Catalog:\x20','output','file'];a31_0x2714=function(){return _0x1e0400;};return a31_0x2714();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a31_0x15dba6(0xa6)]=a31_0x15dba6(0x97);[a31_0x15dba6(0xaf)]=a31_0x15dba6(0xb9);async[a31_0x15dba6(0xc0)](_0xd3565){const _0x44b467=a31_0x15dba6,{options:_0x57bc13,args:_0x468413,tdx:_0x56c865}=_0xd3565,_0x6d3321=_0x468413[0x0],_0x371454=_0x57bc13[_0x44b467(0xb6)];let _0x548f14;try{if(_0x371454)_0x548f14=readSqlStatementsFromFile(_0x371454);else{if(_0x6d3321==='-')_0x548f14=await readSqlStatementsFromStdin();else{if(_0x6d3321&&isSqlFilePath(_0x6d3321))_0x548f14=readSqlStatementsFromFile(_0x6d3321);else{if(_0x6d3321)_0x548f14=splitSqlStatements(_0x6d3321);else throw new Error(_0x44b467(0xa7));}}}}catch(_0x310493){return console['error']('Error:\x20'+_0x310493['message']),0x1;}const _0xec2c8f=_0x57bc13[_0x44b467(0x98)]||_0x44b467(0xa3),_0x22fe1c=_0x57bc13[_0x44b467(0xcb)];try{const _0x4913d9=[],_0x1d2e64=!!_0x57bc13[_0x44b467(0xb5)];for(let _0x2f404a=0x0;_0x2f404a<_0x548f14[_0x44b467(0xa2)];_0x2f404a++){const _0x5ed786=_0x548f14[_0x2f404a],_0x35cfc6=_0x2f404a+0x1,_0xb011d2=_0x548f14[_0x44b467(0xa2)],_0x284828=_0xb011d2>0x1;_0x57bc13[_0x44b467(0xc8)]&&(console[_0x44b467(0xa9)]('\x0a'+(_0x284828?_0x44b467(0xbc)+_0x35cfc6+'/'+_0xb011d2+':':'')),console[_0x44b467(0xa9)](_0x44b467(0xb1)+_0x57bc13[_0x44b467(0xa0)]),console[_0x44b467(0xa9)](_0x44b467(0xb4)+(_0x22fe1c||'td')),console[_0x44b467(0xa9)](_0x44b467(0xa1)+_0xec2c8f),console[_0x44b467(0xa9)]('SQL:\x20'+_0x5ed786));const _0x3872ef=_0x284828?_0x44b467(0xaa)+_0x35cfc6+'/'+_0xb011d2+_0x44b467(0x99):_0x44b467(0x9e);try{const _0x3f6010=await withQuerySpinner(_0x3872ef,async _0x34325b=>{const _0x55602a=_0x44b467,_0x340178=await _0x56c865[_0x55602a(0x97)][_0x55602a(0xc0)](_0x5ed786,{'catalog':_0x22fe1c,'schema':_0xec2c8f,'onJobId':_0x58cb0a=>{const _0x2e52ef=_0x55602a;_0x34325b[_0x2e52ef(0xbd)](_0x58cb0a);},'onProgress':_0x1cea36=>{const _0x3d901d=_0x55602a;_0x34325b[_0x3d901d(0xc6)](_0x3d901d(0xb8)+_0x1cea36['state']+']'),_0x34325b[_0x3d901d(0xca)](formatRows(_0x1cea36['processedRows'])+_0x3d901d(0x9b)+_0x1cea36['completedSplits']+'/'+_0x1cea36[_0x3d901d(0xab)]+_0x3d901d(0xc1));}});return _0x340178;},{'verbose':_0x57bc13[_0x44b467(0xc8)]}),_0x183486=_0x3f6010[_0x44b467(0xbe)],_0x2f9712=_0x183486[_0x44b467(0xc7)]?_0x44b467(0x9a)+_0x183486['jobId']+']':'',_0x21b5e6=_0x284828?_0x44b467(0xbc)+_0x35cfc6+'/'+_0xb011d2+'\x20-\x20':'';console[_0x44b467(0xa9)]('✔\x20'+_0x21b5e6+'Query\x20completed:\x20Processed\x20'+formatRows(_0x183486[_0x44b467(0xae)][_0x44b467(0xa8)])+_0x44b467(0x9b)+(_0x44b467(0xbf)+formatElapsed(_0x183486[_0x44b467(0xae)][_0x44b467(0xac)])+_0x2f9712));if(_0x284828&&_0x1d2e64){const _0x215af0=resolveOutputOptions(_0x57bc13),_0x30af44=await formatQueryOutput(_0x183486,_0x215af0);_0x4913d9[_0x44b467(0xa5)](_0x30af44);}else await handleQueryOutput(_0x183486,_0x57bc13);}catch(_0x5cd33f){const _0x36eff0=_0x284828?'Statement\x20'+_0x35cfc6+'/'+_0xb011d2+':\x0a':'',_0x37789a=_0x5cd33f instanceof SDKError?_0x5cd33f[_0x44b467(0xba)]:_0x5cd33f[_0x44b467(0xc9)];return console[_0x44b467(0xa9)](''+_0x36eff0+_0x37789a),0x1;}}if(_0x548f14[_0x44b467(0xa2)]>0x1&&_0x1d2e64&&_0x4913d9['length']>0x0){const _0xd807c4=_0x4913d9[_0x44b467(0xc2)]('\x0a');writeFileSync(_0x57bc13[_0x44b467(0xb5)],_0xd807c4),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x57bc13[_0x44b467(0xb5)]);}return 0x0;}catch(_0x52db44){throw _0x52db44;}}[a31_0x15dba6(0xb7)](_0x2bdb90){const _0x3a6ed9=a31_0x15dba6,_0x26c15c=_0x2bdb90['args'][0x0],_0x5222b6=_0x2bdb90['options'][_0x3a6ed9(0xb6)];if(!_0x26c15c&&!_0x5222b6)return _0x3a6ed9(0xa4);if(_0x26c15c&&_0x5222b6)return _0x3a6ed9(0x9d);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1ce6fc=a31_0x3138;(function(_0x4d289a,_0x525011){const _0x510476=a31_0x3138,_0xa9bc7f=_0x4d289a();while(!![]){try{const _0x653cf=parseInt(_0x510476(0x1ea))/0x1+-parseInt(_0x510476(0x177))/0x2*(-parseInt(_0x510476(0x1bc))/0x3)+parseInt(_0x510476(0x1a3))/0x4*(parseInt(_0x510476(0x1c3))/0x5)+-parseInt(_0x510476(0x1be))/0x6+parseInt(_0x510476(0x1da))/0x7*(parseInt(_0x510476(0x197))/0x8)+parseInt(_0x510476(0x189))/0x9*(-parseInt(_0x510476(0x1c2))/0xa)+-parseInt(_0x510476(0x1a7))/0xb*(-parseInt(_0x510476(0x1de))/0xc);if(_0x653cf===_0x525011)break;else _0xa9bc7f['push'](_0xa9bc7f['shift']());}catch(_0x527d2c){_0xa9bc7f['push'](_0xa9bc7f['shift']());}}}(a31_0xf0a3,0xa9c8f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a31_0x3138(_0x2bdefd,_0xe99c40){_0x2bdefd=_0x2bdefd-0x174;const _0xf0a323=a31_0xf0a3();let _0x3138f0=_0xf0a323[_0x2bdefd];return _0x3138f0;}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0x23b0c0 from'chalk';function resolveSegmentTarget(_0x3ee50c,_0x16f2e8,_0x4ef3b8){const _0x24da0a=a31_0x3138;if(isYamlFilePath(_0x3ee50c))try{const _0x55d308=resolveYamlFilePath(_0x3ee50c);return _0x4ef3b8&&(console[_0x24da0a(0x1d9)]('Resolved\x20YAML\x20file:\x20'+_0x3ee50c),console[_0x24da0a(0x1d9)]('\x20\x20Parent\x20segment:\x20'+_0x55d308['parentSegment']),console['error'](_0x24da0a(0x190)+_0x55d308['segmentName']),console[_0x24da0a(0x1d9)](_0x24da0a(0x1ee)+(_0x55d308[_0x24da0a(0x1b7)]||_0x24da0a(0x206))),console[_0x24da0a(0x1d9)]('\x20\x20Full\x20path:\x20'+_0x55d308[_0x24da0a(0x179)])),_0x55d308[_0x24da0a(0x179)];}catch(_0x23ffeb){throw new SDKError(ErrorCode[_0x24da0a(0x1fb)],_0x24da0a(0x1d7)+_0x23ffeb[_0x24da0a(0x1c5)]);}if(!_0x16f2e8)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x24da0a(0x193));return _0x16f2e8+'/'+_0x3ee50c;}export class SegmentDescribeCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]=a31_0x1ce6fc(0x1e0);['description']='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x4c77e8){const _0x49e05e=a31_0x1ce6fc,{options:_0x565c2e,args:_0x3e8a24,tdx:_0x21d9e1}=_0x4c77e8,_0x1c87fa=_0x3e8a24[0x0],_0x19c301=!_0x1c87fa&&!!_0x565c2e[_0x49e05e(0x1cb)],_0x2cd45e=_0x1c87fa||_0x565c2e[_0x49e05e(0x1cb)];if(!_0x2cd45e)return console[_0x49e05e(0x1d9)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x49e05e(0x1d9)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error']('Examples:'),console[_0x49e05e(0x1d9)](_0x49e05e(0x17e)),console[_0x49e05e(0x1d9)](_0x49e05e(0x1d6)),console[_0x49e05e(0x1d9)](_0x49e05e(0x200)),console[_0x49e05e(0x1d9)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x3ccaed=_0x565c2e[_0x49e05e(0x203)];let _0x43a818=_0x2cd45e;!_0x19c301&&_0x3ccaed&&!_0x2cd45e[_0x49e05e(0x207)]('/')&&(_0x43a818=_0x3ccaed+'/'+_0x2cd45e,_0x565c2e['verbose']&&console[_0x49e05e(0x1d9)](_0x49e05e(0x183)+_0x43a818));const _0x1ec5f5=await withSpinner(_0x49e05e(0x1b0)+_0x43a818+_0x49e05e(0x199),()=>_0x21d9e1[_0x49e05e(0x180)]['resolvePathToResource'](_0x43a818),{'verbose':_0x565c2e[_0x49e05e(0x1f0)]}),_0x29b1e3=_0x1ec5f5[_0x49e05e(0x1fd)];_0x565c2e[_0x49e05e(0x1f0)]&&(console[_0x49e05e(0x1d9)](_0x49e05e(0x1c0)+_0x29b1e3['type']),console['error'](_0x49e05e(0x1c9)+_0x29b1e3[_0x49e05e(0x1c7)]),_0x29b1e3[_0x49e05e(0x1dc)]&&console['error'](_0x49e05e(0x1a0)+_0x29b1e3['folderId']),_0x29b1e3[_0x49e05e(0x1bb)]&&console[_0x49e05e(0x1d9)]('Segment\x20ID:\x20'+_0x29b1e3['segmentId']));if(_0x29b1e3[_0x49e05e(0x1b1)]===_0x49e05e(0x19b)){const _0x4ffbf1=await withSpinner(_0x49e05e(0x176),()=>_0x21d9e1[_0x49e05e(0x180)][_0x49e05e(0x1a8)](_0x29b1e3[_0x49e05e(0x1c7)]),{'verbose':_0x565c2e[_0x49e05e(0x1f0)]});await handleSingleObjectOutput(_0x4ffbf1[_0x49e05e(0x1fd)],_0x565c2e);}else{if(_0x29b1e3['type']===_0x49e05e(0x17f)){if(!_0x29b1e3[_0x49e05e(0x1dc)])throw new SDKError(ErrorCode[_0x49e05e(0x188)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x149a71=await withSpinner(_0x49e05e(0x181),()=>_0x21d9e1[_0x49e05e(0x180)][_0x49e05e(0x18e)](_0x29b1e3[_0x49e05e(0x1dc)]),{'verbose':_0x565c2e['verbose']});await handleSingleObjectOutput(_0x149a71['data'],_0x565c2e);}else{if(_0x29b1e3[_0x49e05e(0x1b1)]===_0x49e05e(0x180)){if(!_0x29b1e3[_0x49e05e(0x1bb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x49e05e(0x187));const _0x4d37d7=await withSpinner(_0x49e05e(0x1c8),()=>_0x21d9e1[_0x49e05e(0x180)][_0x49e05e(0x1a2)](_0x29b1e3['parentId'],_0x29b1e3['segmentId']),{'verbose':_0x565c2e[_0x49e05e(0x1f0)]});await handleSingleObjectOutput(_0x4d37d7['data'],_0x565c2e);}}}return 0x0;}catch(_0x542f9a){if(_0x542f9a instanceof SDKError)return console['error'](_0x49e05e(0x1f7)+_0x542f9a[_0x49e05e(0x1c5)]),_0x542f9a[_0x49e05e(0x1b5)]&&console[_0x49e05e(0x1d9)]('\x20\x20Cause:\x20'+_0x542f9a['cause']),0x1;throw _0x542f9a;}}}export class SegmentShowCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]='segment:show';[a31_0x1ce6fc(0x1a9)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a31_0x1ce6fc(0x1b4)](_0x107216){const _0x1f7cbf=a31_0x1ce6fc,{options:_0xa43fb7,args:_0xf6dbfe,tdx:_0x2b2c89}=_0x107216,_0x5016dd=_0xf6dbfe[0x0];if(!_0x5016dd)return console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1d2)),console[_0x1f7cbf(0x1d9)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1e3)),console['error'](_0x1f7cbf(0x19a)),console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x18c)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x39636f=_0xa43fb7[_0x1f7cbf(0x1cb)],_0x4988d1=resolveSegmentTarget(_0x5016dd,_0x39636f,_0xa43fb7['verbose']);_0xa43fb7[_0x1f7cbf(0x1f0)]&&console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x20d)+_0x4988d1);const _0x27f41d=await withSpinner(_0x1f7cbf(0x185)+_0x5016dd+_0x1f7cbf(0x199),()=>_0x2b2c89[_0x1f7cbf(0x180)]['resolvePathToResource'](_0x4988d1),{'verbose':_0xa43fb7['verbose']}),_0x9fa90d=_0x27f41d[_0x1f7cbf(0x1fd)];_0xa43fb7[_0x1f7cbf(0x1f0)]&&(console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1c0)+_0x9fa90d[_0x1f7cbf(0x1b1)]),console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1c9)+_0x9fa90d[_0x1f7cbf(0x1c7)]));if(_0x9fa90d['type']===_0x1f7cbf(0x17f))return console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1c6)),console['error'](_0x1f7cbf(0x1ae)),0x1;if(_0x9fa90d[_0x1f7cbf(0x1b1)]===_0x1f7cbf(0x19b))return console['error'](_0x1f7cbf(0x1af)),console[_0x1f7cbf(0x1d9)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x9fa90d[_0x1f7cbf(0x1bb)])throw new SDKError(ErrorCode[_0x1f7cbf(0x1d1)],_0x1f7cbf(0x187));const _0x55a91d=await withSpinner(_0x1f7cbf(0x175),()=>_0x2b2c89[_0x1f7cbf(0x180)][_0x1f7cbf(0x196)](_0x9fa90d[_0x1f7cbf(0x1c7)],_0x9fa90d[_0x1f7cbf(0x1bb)]),{'verbose':_0xa43fb7['verbose']});let _0x456df7=_0x55a91d[_0x1f7cbf(0x1fd)];const _0x490642=resolveLimit(_0xa43fb7['limit'],DEFAULT_DISPLAY_LIMIT),_0x5064b4=/\bLIMIT\s+\d+/i[_0x1f7cbf(0x1ef)](_0x456df7);!_0x5064b4&&(_0x456df7=_0x456df7[_0x1f7cbf(0x1ba)]()[_0x1f7cbf(0x1d3)](/;+$/,''),_0x456df7=_0x1f7cbf(0x1c1)+_0x456df7+_0x1f7cbf(0x20e)+_0x490642);_0xa43fb7[_0x1f7cbf(0x1f0)]&&console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x192)+_0x456df7);const _0x5b1e3e=await withQuerySpinner(_0x1f7cbf(0x1b8),async _0x27fa48=>{const _0x30eb93=_0x1f7cbf,_0x1ec475=await _0x2b2c89[_0x30eb93(0x19c)][_0x30eb93(0x1b4)](_0x456df7,{'catalog':'td','schema':'information_schema','onJobId':_0x3fcc32=>{_0x27fa48['setJobId'](_0x3fcc32);}});return _0x1ec475;},{'verbose':_0xa43fb7[_0x1f7cbf(0x1f0)]}),_0x51760e=_0x5b1e3e[_0x1f7cbf(0x1fd)],_0x21ee45=_0x51760e[_0x1f7cbf(0x1db)]?'\x20[Job\x20ID:\x20'+_0x51760e['jobId']+']':'';return console[_0x1f7cbf(0x1d9)](_0x1f7cbf(0x1c4)+_0x51760e[_0x1f7cbf(0x1b6)][_0x1f7cbf(0x20b)][_0x1f7cbf(0x1e7)]()+_0x1f7cbf(0x1eb)+(_0x1f7cbf(0x19f)+formatElapsed(_0x51760e['stats'][_0x1f7cbf(0x1e6)])+_0x21ee45)),await handleQueryOutput(_0x51760e,_0xa43fb7),0x0;}catch(_0x3aa550){if(_0x3aa550 instanceof SDKError)return console[_0x1f7cbf(0x1d9)]('✖\x20Query\x20failed\x20['+_0x3aa550[_0x1f7cbf(0x18d)]+']'),console[_0x1f7cbf(0x1d9)]('\x0a'+_0x3aa550[_0x1f7cbf(0x1c5)]),0x1;throw _0x3aa550;}}}function a31_0xf0a3(){const _0x4232b3=['Segment\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','folder','segment','Fetching\x20folder\x20details...','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','/app/ps/','Resolving\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Segment\x20ID\x20missing\x20from\x20resolved\x20path','SEGMENT_FOLDER_NOT_FOUND','45DwGRlC','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','code','getFolder','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20Segment\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SQL\x20query:\x0a','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20parent\x20folder\x20\x27','getSegmentSQL','666216Gasyvu','Show\x20segment\x20folder\x20details','\x27...','Examples:','parent','query','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','in\x20','Folder\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','getSegment','1739308YilJAp','resolveFolderId','segment:folder:create','\x20Opening\x20','273647GlIVih','getParent','description','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','parentFolder','segment:sql','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20path\x20\x27','type','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20view','execute','cause','stats','folderPath','Executing\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','trim','segmentId','27mRIEJE','Get\x20SQL\x20query\x20for\x20child\x20segment','5823804OClrtB','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Resolved\x20type:\x20','SELECT\x20*\x20FROM\x20(\x0a','1677400vEppWd','15DdKfmd','✔\x20Query\x20completed:\x20Processed\x20','message','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','parentId','Fetching\x20segment\x20details...','Parent\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','parentSegment','Listing\x20folders\x20for\x20parent\x20\x27','resolvePathToResource','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20folder\x20or\x20child\x20segment\x20details','SEGMENT_NOT_FOUND','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','replace','Folder\x20name:\x20','url','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segment:folder:list','error','21sKdqrj','jobId','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','96uSqYwO','jsonl','segment:describe','segment:view','✔\x20Created\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','/e/','Use:\x20tdx\x20ps\x20sql','elapsedTimeMillis','toLocaleString','createFolder','segment:folder:show','287486iYiEUS','\x20rows\x20','resolveParentId','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20Folder\x20path:\x20','test','verbose','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','listFolders','Parent\x20name:\x20','Creating\x20folder\x20\x27','\x20\x20Cause:\x20','Error:\x20','Options:','Parent\x20segment:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','INVALID_ARGUMENT','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','data','Resolved\x20parent\x20ID:\x20','length','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolving\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segmentPath','Fetching\x20folder\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','(root)','includes','site','\x20folder','web','processedRows','name','Target\x20path:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20SQL\x20for\x20segment...','Fetching\x20parent\x20segment\x20details...','103102RibOii','format','fullPath','Resolved\x20parent\x20folder\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','green'];a31_0xf0a3=function(){return _0x4232b3;};return a31_0xf0a3();}export class SegmentFolderListCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]=a31_0x1ce6fc(0x1d8);[a31_0x1ce6fc(0x1a9)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a31_0x1ce6fc(0x1b4)](_0x4c8448){const _0x40e744=a31_0x1ce6fc,{options:_0x57804b,args:_0x4db3f8,tdx:_0x23b08d}=_0x4c8448;if(_0x4db3f8[_0x40e744(0x1ff)]===0x0)return console[_0x40e744(0x1d9)](_0x40e744(0x18a)),console[_0x40e744(0x1d9)](_0x40e744(0x191)),0x1;const _0x46c08f=_0x4db3f8[0x0];try{_0x57804b['verbose']&&(console[_0x40e744(0x1d9)](_0x40e744(0x182)+_0x57804b['site']),console[_0x40e744(0x1d9)](_0x40e744(0x1f4)+_0x46c08f));const _0x4ce852=await withSpinner(_0x40e744(0x1ce)+_0x46c08f+_0x40e744(0x199),()=>_0x23b08d[_0x40e744(0x180)]['resolveParentId'](_0x46c08f),{'verbose':_0x57804b[_0x40e744(0x1f0)]}),_0x5181f2=_0x4ce852[_0x40e744(0x1fd)];_0x57804b[_0x40e744(0x1f0)]&&console[_0x40e744(0x1d9)](_0x40e744(0x1fe)+_0x5181f2);const _0x4789cc=await withSpinner(_0x40e744(0x1cc)+_0x46c08f+_0x40e744(0x199),()=>_0x23b08d[_0x40e744(0x180)][_0x40e744(0x1f3)](_0x5181f2),{'verbose':_0x57804b[_0x40e744(0x1f0)]}),_0x3bb279=_0x4789cc[_0x40e744(0x1fd)];return console[_0x40e744(0x1d9)]('✔\x20Found\x20'+_0x3bb279[_0x40e744(0x1ff)]+_0x40e744(0x209)+(_0x3bb279[_0x40e744(0x1ff)]!==0x1?'s':'')),await handleSDKOutput(_0x3bb279,_0x57804b),0x0;}catch(_0xcf9f09){if(_0xcf9f09 instanceof SDKError)return console[_0x40e744(0x1d9)](_0x40e744(0x1f7)+_0xcf9f09[_0x40e744(0x1c5)]),_0xcf9f09[_0x40e744(0x1b5)]&&console[_0x40e744(0x1d9)](_0x40e744(0x1f6)+_0xcf9f09[_0x40e744(0x1b5)]),0x1;throw _0xcf9f09;}}}export class SegmentFolderShowCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]=a31_0x1ce6fc(0x1e9);[a31_0x1ce6fc(0x1a9)]=a31_0x1ce6fc(0x198);async[a31_0x1ce6fc(0x1b4)](_0x5bc845){const _0x51d4db=a31_0x1ce6fc,{options:_0x1e29d2,args:_0x483764,tdx:_0x50c89d}=_0x5bc845;if(_0x483764['length']===0x0)return console[_0x51d4db(0x1d9)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x51d4db(0x194)),0x1;try{const {parentId:_0x4591fa,childId:_0x11305b}=parseSegmentRef(_0x483764[0x0]);_0x1e29d2[_0x51d4db(0x1f0)]&&(console[_0x51d4db(0x1d9)](_0x51d4db(0x182)+_0x1e29d2[_0x51d4db(0x208)]),console[_0x51d4db(0x1d9)](_0x51d4db(0x1f4)+_0x4591fa),_0x11305b&&console[_0x51d4db(0x1d9)](_0x51d4db(0x1d4)+_0x11305b));if(!_0x11305b)return console[_0x51d4db(0x1d9)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x1a9b28=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4591fa+_0x51d4db(0x199),()=>_0x50c89d['segment'][_0x51d4db(0x1ec)](_0x4591fa),{'verbose':_0x1e29d2['verbose']}),_0x429e11=_0x1a9b28[_0x51d4db(0x1fd)];_0x1e29d2[_0x51d4db(0x1f0)]&&console[_0x51d4db(0x1d9)](_0x51d4db(0x1fe)+_0x429e11);const _0x3ac3ff=await withSpinner(_0x51d4db(0x201)+_0x11305b+_0x51d4db(0x199),()=>_0x50c89d[_0x51d4db(0x180)][_0x51d4db(0x1a4)](_0x429e11,_0x11305b),{'verbose':_0x1e29d2[_0x51d4db(0x1f0)]}),_0x3493d1=_0x3ac3ff[_0x51d4db(0x1fd)];_0x1e29d2[_0x51d4db(0x1f0)]&&console[_0x51d4db(0x1d9)]('Resolved\x20folder\x20ID:\x20'+_0x3493d1);const _0x2ed92b=await withSpinner(_0x51d4db(0x204)+_0x11305b+_0x51d4db(0x199),()=>_0x50c89d[_0x51d4db(0x180)][_0x51d4db(0x18e)](_0x3493d1),{'verbose':_0x1e29d2[_0x51d4db(0x1f0)]});return await handleSDKOutput([_0x2ed92b[_0x51d4db(0x1fd)]],_0x1e29d2),0x0;}catch(_0x37c3eb){if(_0x37c3eb instanceof SDKError)return console['error'](_0x51d4db(0x1f7)+_0x37c3eb[_0x51d4db(0x1c5)]),_0x37c3eb['cause']&&console[_0x51d4db(0x1d9)](_0x51d4db(0x1f6)+_0x37c3eb[_0x51d4db(0x1b5)]),0x1;throw _0x37c3eb;}}}export class SegmentSQLCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]=a31_0x1ce6fc(0x1ac);[a31_0x1ce6fc(0x1a9)]=a31_0x1ce6fc(0x1bd);async[a31_0x1ce6fc(0x1b4)](_0xcefd3b){const _0x34be5a=a31_0x1ce6fc,{options:_0x2b0c56,args:_0x49cd19,tdx:_0x3f379d}=_0xcefd3b,_0x48bfd2=_0x49cd19[0x0];if(!_0x48bfd2)return console['error'](_0x34be5a(0x1d2)),console[_0x34be5a(0x1d9)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x34be5a(0x1b9)),console[_0x34be5a(0x1d9)](_0x34be5a(0x19a)),console[_0x34be5a(0x1d9)](_0x34be5a(0x1f1)),console[_0x34be5a(0x1d9)](_0x34be5a(0x1bf)),0x1;try{const _0x2dd8b3=_0x2b0c56[_0x34be5a(0x1cb)],_0x7ba27a=resolveSegmentTarget(_0x48bfd2,_0x2dd8b3,_0x2b0c56[_0x34be5a(0x1f0)]);_0x2b0c56[_0x34be5a(0x1f0)]&&console[_0x34be5a(0x1d9)](_0x34be5a(0x20d)+_0x7ba27a);const _0x6cba52=await withSpinner(_0x34be5a(0x185)+_0x48bfd2+_0x34be5a(0x199),()=>_0x3f379d[_0x34be5a(0x180)][_0x34be5a(0x1cd)](_0x7ba27a),{'verbose':_0x2b0c56['verbose']}),_0x30fe87=_0x6cba52[_0x34be5a(0x1fd)];_0x2b0c56['verbose']&&(console[_0x34be5a(0x1d9)](_0x34be5a(0x1c0)+_0x30fe87[_0x34be5a(0x1b1)]),console[_0x34be5a(0x1d9)](_0x34be5a(0x1c9)+_0x30fe87['parentId']));if(_0x30fe87['type']===_0x34be5a(0x17f))return console['error'](_0x34be5a(0x1ed)),console[_0x34be5a(0x1d9)](_0x34be5a(0x18f)),0x1;if(_0x30fe87[_0x34be5a(0x1b1)]===_0x34be5a(0x19b))return console['error'](_0x34be5a(0x1b2)),console[_0x34be5a(0x1d9)](_0x34be5a(0x1e5)),0x1;if(!_0x30fe87[_0x34be5a(0x1bb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x34be5a(0x187));const _0x3be628=await withSpinner(_0x34be5a(0x175),()=>_0x3f379d['segment'][_0x34be5a(0x196)](_0x30fe87[_0x34be5a(0x1c7)],_0x30fe87['segmentId']),{'verbose':_0x2b0c56[_0x34be5a(0x1f0)]}),_0x250b37=_0x3be628[_0x34be5a(0x1fd)];return _0x2b0c56['format']==='json'||_0x2b0c56[_0x34be5a(0x178)]===_0x34be5a(0x1df)?await handleSDKOutput([{'sql':_0x250b37}],_0x2b0c56):console['log'](_0x250b37),0x0;}catch(_0x41d945){if(_0x41d945 instanceof SDKError)return console[_0x34be5a(0x1d9)](_0x34be5a(0x1f7)+_0x41d945[_0x34be5a(0x1c5)]),_0x41d945[_0x34be5a(0x1b5)]&&console[_0x34be5a(0x1d9)](_0x34be5a(0x1f6)+_0x41d945['cause']),0x1;throw _0x41d945;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a31_0x1ce6fc(0x1a5);[a31_0x1ce6fc(0x1a9)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x266e8b){const _0x35f5be=a31_0x1ce6fc,{options:_0x5d2791,args:_0x2521ef,tdx:_0x5d5dbd}=_0x266e8b,_0x38b6d3=_0x5d2791;if(_0x2521ef[_0x35f5be(0x1ff)]<0x2)return console['error'](_0x35f5be(0x1ad)),console[_0x35f5be(0x1d9)](_0x35f5be(0x1cf)),0x1;const _0x14c745=_0x2521ef[0x0],_0x3939ae=_0x2521ef[0x1];_0x38b6d3[_0x35f5be(0x1f0)]&&(console[_0x35f5be(0x1d9)](_0x35f5be(0x182)+_0x38b6d3[_0x35f5be(0x208)]),console[_0x35f5be(0x1d9)](_0x35f5be(0x1f9)+_0x14c745),console[_0x35f5be(0x1d9)](_0x35f5be(0x1d4)+_0x3939ae));let _0x59bb62;if(_0x38b6d3['parentFolder']){const _0x4b327d=_0x38b6d3[_0x35f5be(0x1ab)],_0x211e82=await withSpinner(_0x35f5be(0x1ce)+_0x14c745+_0x35f5be(0x199),()=>_0x5d5dbd[_0x35f5be(0x180)]['resolveParentId'](_0x14c745),{'verbose':_0x38b6d3['verbose']}),_0x2be987=_0x211e82[_0x35f5be(0x1fd)],_0x25afc6=await withSpinner(_0x35f5be(0x195)+_0x4b327d+'\x27...',()=>_0x5d5dbd[_0x35f5be(0x180)][_0x35f5be(0x1a4)](_0x2be987,_0x4b327d),{'verbose':_0x38b6d3[_0x35f5be(0x1f0)]});_0x59bb62=_0x25afc6['data'],_0x38b6d3[_0x35f5be(0x1f0)]&&console[_0x35f5be(0x1d9)](_0x35f5be(0x17a)+_0x59bb62);}const _0x3187a={'name':_0x3939ae,'description':_0x38b6d3[_0x35f5be(0x1a9)],'parentFolderId':_0x59bb62},_0x60a214=await withSpinner(_0x35f5be(0x1f5)+_0x3939ae+_0x35f5be(0x199),()=>_0x5d5dbd[_0x35f5be(0x180)][_0x35f5be(0x1e8)](_0x14c745,_0x3187a),{'verbose':_0x38b6d3[_0x35f5be(0x1f0)]}),_0x26ba2c=_0x60a214[_0x35f5be(0x1fd)];return console[_0x35f5be(0x1d9)](_0x35f5be(0x1e2)+_0x26ba2c[_0x35f5be(0x20c)]+'\x27\x20with\x20ID:\x20'+_0x26ba2c['id']),await handleSDKOutput([_0x26ba2c],_0x38b6d3),0x0;}}export class SegmentViewCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]=a31_0x1ce6fc(0x1e1);[a31_0x1ce6fc(0x1a9)]=a31_0x1ce6fc(0x1d0);async['execute'](_0x35d789){const _0x6f12fa=a31_0x1ce6fc,{options:_0x4c05c8,args:_0x4339e2,tdx:_0x788753}=_0x35d789,_0x434952=_0x4339e2[0x0];if(!_0x434952)return console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1ca)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x19d)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1dd)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1f8)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1fc)),console['error'](_0x6f12fa(0x19a)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1aa)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1a1)),console[_0x6f12fa(0x1d9)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0xf40634=_0x4c05c8[_0x6f12fa(0x1cb)],_0x3be735=resolveSegmentTarget(_0x434952,_0xf40634,_0x4c05c8[_0x6f12fa(0x1f0)]);_0x4c05c8[_0x6f12fa(0x1f0)]&&console[_0x6f12fa(0x1d9)](_0x6f12fa(0x20d)+_0x3be735);const _0x38c5d9=await withSpinner(_0x6f12fa(0x185)+_0x434952+_0x6f12fa(0x199),()=>_0x788753[_0x6f12fa(0x180)]['resolvePathToResource'](_0x3be735),{'verbose':_0x4c05c8[_0x6f12fa(0x1f0)]}),_0x3fd2a9=_0x38c5d9['data'];_0x4c05c8[_0x6f12fa(0x1f0)]&&(console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1c0)+_0x3fd2a9[_0x6f12fa(0x1b1)]),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1c9)+_0x3fd2a9[_0x6f12fa(0x1c7)]),_0x3fd2a9[_0x6f12fa(0x1dc)]&&console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1a0)+_0x3fd2a9[_0x6f12fa(0x1dc)]),_0x3fd2a9['segmentId']&&console['error'](_0x6f12fa(0x17d)+_0x3fd2a9[_0x6f12fa(0x1bb)]));if(_0x4c05c8[_0x6f12fa(0x20a)]){if(_0x3fd2a9[_0x6f12fa(0x1b1)]===_0x6f12fa(0x17f))return console[_0x6f12fa(0x1d9)](_0x6f12fa(0x174)),0x1;if(_0x3fd2a9['type']==='parent')return console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1fa)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x205)),0x1;if(!_0x3fd2a9[_0x6f12fa(0x1bb)])throw new SDKError(ErrorCode[_0x6f12fa(0x1d1)],_0x6f12fa(0x187));const _0x5bb62a=getConsoleNextUrl(_0x4c05c8[_0x6f12fa(0x208)],'/app/ps/'+_0x3fd2a9['parentId']+_0x6f12fa(0x1e4)+_0x3fd2a9['segmentId']);return console[_0x6f12fa(0x1d9)](a31_0x23b0c0[_0x6f12fa(0x17c)]('✔')+_0x6f12fa(0x1a6)+a31_0x23b0c0['cyan'](_0x5bb62a)),openBrowser(_0x5bb62a),0x0;}if(_0x3fd2a9[_0x6f12fa(0x1b1)]===_0x6f12fa(0x17f)){if(!_0x3fd2a9[_0x6f12fa(0x1dc)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x6f12fa(0x202));const _0x47eb3b=await withSpinner(_0x6f12fa(0x181),()=>_0x788753[_0x6f12fa(0x180)][_0x6f12fa(0x18e)](_0x3fd2a9['folderId']),{'verbose':_0x4c05c8[_0x6f12fa(0x1f0)]});await handleSingleObjectOutput(_0x47eb3b[_0x6f12fa(0x1fd)],_0x4c05c8);}else{if(_0x3fd2a9['type']==='segment'){if(!_0x3fd2a9[_0x6f12fa(0x1bb)])throw new SDKError(ErrorCode[_0x6f12fa(0x1d1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x78289=await withSpinner('Fetching\x20segment\x20details...',()=>_0x788753['segment']['getSegment'](_0x3fd2a9[_0x6f12fa(0x1c7)],_0x3fd2a9[_0x6f12fa(0x1bb)]),{'verbose':_0x4c05c8[_0x6f12fa(0x1f0)]}),_0x590010=getConsoleNextUrl(_0x4c05c8[_0x6f12fa(0x208)],_0x6f12fa(0x184)+_0x3fd2a9[_0x6f12fa(0x1c7)]+_0x6f12fa(0x1e4)+_0x3fd2a9[_0x6f12fa(0x1bb)]),_0x463aef=_0x78289[_0x6f12fa(0x1fd)];_0x463aef[_0x6f12fa(0x1d5)]=_0x590010,await handleSingleObjectOutput(_0x463aef,_0x4c05c8);}else return console[_0x6f12fa(0x1d9)](_0x6f12fa(0x19e)),console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1b3)),0x1;}return 0x0;}catch(_0x3fb02d){if(_0x3fb02d instanceof SDKError)return console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1f7)+_0x3fb02d[_0x6f12fa(0x1c5)]),_0x3fb02d[_0x6f12fa(0x1b5)]&&console[_0x6f12fa(0x1d9)](_0x6f12fa(0x1f6)+_0x3fb02d['cause']),0x1;throw _0x3fb02d;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0x1ce6fc(0x20c)]='segment:desc';[a31_0x1ce6fc(0x1a9)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a31_0x1ce6fc(0x1b4)](_0x31058b){const _0x8110ac=a31_0x1ce6fc,{options:_0x43040e,args:_0x9ac3e,tdx:_0x520e8f}=_0x31058b,_0x2c6c16=_0x9ac3e[0x0];if(!_0x2c6c16)return console[_0x8110ac(0x1d9)](_0x8110ac(0x1d2)),console['error'](_0x8110ac(0x17b)),console[_0x8110ac(0x1d9)](_0x8110ac(0x18b)),console[_0x8110ac(0x1d9)](_0x8110ac(0x19a)),console[_0x8110ac(0x1d9)](_0x8110ac(0x186)),console[_0x8110ac(0x1d9)](_0x8110ac(0x1f2)),0x1;try{const _0x189497=_0x43040e['parentSegment'],_0x4380db=resolveSegmentTarget(_0x2c6c16,_0x189497,_0x43040e[_0x8110ac(0x1f0)]);_0x43040e[_0x8110ac(0x1f0)]&&console[_0x8110ac(0x1d9)](_0x8110ac(0x20d)+_0x4380db);const _0xa34ea6=await withSpinner(_0x8110ac(0x185)+_0x2c6c16+_0x8110ac(0x199),()=>_0x520e8f[_0x8110ac(0x180)][_0x8110ac(0x1cd)](_0x4380db),{'verbose':_0x43040e['verbose']}),_0x5294ef=_0xa34ea6[_0x8110ac(0x1fd)];_0x43040e[_0x8110ac(0x1f0)]&&(console[_0x8110ac(0x1d9)]('Resolved\x20type:\x20'+_0x5294ef['type']),console[_0x8110ac(0x1d9)]('Parent\x20ID:\x20'+_0x5294ef['parentId']));if(_0x5294ef[_0x8110ac(0x1b1)]===_0x8110ac(0x17f))return console[_0x8110ac(0x1d9)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x8110ac(0x1d9)](_0x8110ac(0x18f)),0x1;if(_0x5294ef[_0x8110ac(0x1b1)]==='parent')return console[_0x8110ac(0x1d9)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x5294ef['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x8110ac(0x187));const _0x58b377=await withSpinner(_0x8110ac(0x175),()=>_0x520e8f[_0x8110ac(0x180)][_0x8110ac(0x196)](_0x5294ef[_0x8110ac(0x1c7)],_0x5294ef[_0x8110ac(0x1bb)]),{'verbose':_0x43040e[_0x8110ac(0x1f0)]}),_0x7c08a8=_0x58b377[_0x8110ac(0x1fd)],_0x46a099=await executeSchemaQuery(_0x7c08a8,_0x520e8f,_0x43040e);return await handleQueryOutput(_0x46a099,_0x43040e),0x0;}catch(_0x1fa3e9){if(_0x1fa3e9 instanceof SDKError)return console[_0x8110ac(0x1d9)](_0x8110ac(0x1f7)+_0x1fa3e9[_0x8110ac(0x1c5)]),_0x1fa3e9['cause']&&console['error'](_0x8110ac(0x1f6)+_0x1fa3e9[_0x8110ac(0x1b5)]),0x1;throw _0x1fa3e9;}}}
|
|
1
|
+
const a32_0x413ad9=a32_0x50f8;(function(_0x317f71,_0x5c72d6){const _0x5a2e16=a32_0x50f8,_0x309fd6=_0x317f71();while(!![]){try{const _0x593d8a=parseInt(_0x5a2e16(0x136))/0x1*(-parseInt(_0x5a2e16(0x107))/0x2)+-parseInt(_0x5a2e16(0x104))/0x3+-parseInt(_0x5a2e16(0x15c))/0x4*(parseInt(_0x5a2e16(0x133))/0x5)+parseInt(_0x5a2e16(0x110))/0x6*(-parseInt(_0x5a2e16(0xca))/0x7)+parseInt(_0x5a2e16(0xde))/0x8*(-parseInt(_0x5a2e16(0x103))/0x9)+-parseInt(_0x5a2e16(0xcf))/0xa*(-parseInt(_0x5a2e16(0x153))/0xb)+parseInt(_0x5a2e16(0x11b))/0xc;if(_0x593d8a===_0x5c72d6)break;else _0x309fd6['push'](_0x309fd6['shift']());}catch(_0xa8d2e3){_0x309fd6['push'](_0x309fd6['shift']());}}}(a32_0x8792,0x60613));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a32_0x56ea1f from'chalk';function a32_0x50f8(_0x390fc2,_0x3b5b92){_0x390fc2=_0x390fc2-0xc9;const _0x87924a=a32_0x8792();let _0x50f85c=_0x87924a[_0x390fc2];return _0x50f85c;}function resolveSegmentTarget(_0x2299b7,_0x4f787,_0x789469){const _0x187501=a32_0x50f8;if(isYamlFilePath(_0x2299b7))try{const _0x12153c=resolveYamlFilePath(_0x2299b7);return _0x789469&&(console[_0x187501(0x12c)](_0x187501(0x137)+_0x2299b7),console[_0x187501(0x12c)](_0x187501(0x146)+_0x12153c[_0x187501(0x164)]),console[_0x187501(0x12c)](_0x187501(0xd5)+_0x12153c['segmentName']),console[_0x187501(0x12c)](_0x187501(0x135)+(_0x12153c[_0x187501(0xf2)]||_0x187501(0xcd))),console['error']('\x20\x20Full\x20path:\x20'+_0x12153c[_0x187501(0xd9)])),_0x12153c['fullPath'];}catch(_0xd7aa34){throw new SDKError(ErrorCode[_0x187501(0x112)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xd7aa34[_0x187501(0x147)]);}if(!_0x4f787)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x187501(0x15d));return _0x4f787+'/'+_0x2299b7;}function a32_0x8792(){const _0x4198f0=['Site:\x20','data','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','site','folderPath','stats','✔\x20Found\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Use:\x20tdx\x20ps\x20show','length','Create\x20segment\x20folder\x20for\x20organization','log','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','parentFolder','SELECT\x20*\x20FROM\x20(\x0a','Show\x20segment\x20or\x20folder\x20details','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segment:describe','Use:\x20tdx\x20ps\x20view\x20-w','7461ECjbIC','1636002VjBaNW','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','8486QOjhnU','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folder\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','6fVjtbB','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','INVALID_ARGUMENT','SEGMENT_NOT_FOUND','Options:','limit','web','Use:\x20tdx\x20ps\x20sql','Parent\x20ID:\x20','/app/ps/','url','33563340HntlDw','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','elapsedTimeMillis','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','verbose','Fetching\x20segment\x20details...','Fetching\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','\x20rows\x20','Resolved\x20parent\x20folder\x20ID:\x20','Segment\x20ID:\x20','format','segment:folder:show','\x27...','Show\x20child\x20segment\x20schema\x20(column\x20types)','execute','error','Resolved\x20folder\x20ID:\x20','Listing\x20folders\x20for\x20parent\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','query','type','includes','1355xdHHxa','name','\x20\x20Folder\x20path:\x20','93rtpxuL','Resolved\x20YAML\x20file:\x20','Show\x20segment\x20folder\x20details','Use:\x20tdx\x20ps\x20desc','segmentId','description','Parent\x20segment:\x20','jsonl','Resolved\x20parent\x20ID:\x20','segment:desc','Error:\x20Folder\x20reference\x20is\x20required','segment','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','listFolders','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getSegmentSQL','\x20\x20Parent\x20segment:\x20','message','Target\x20path:\x20','cyan','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved\x20relative\x20path\x20to:\x20','green','cause','SEGMENT_FOLDER_NOT_FOUND','processedRows','json','segment:sql','resolveFolderId','3729pkVVXk','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','parentId','Creating\x20folder\x20\x27','folderId','Folder\x20name:\x20','/e/','segment:view','7628dPYLBu','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getParent','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','resolveParentId','SQL\x20query:\x0a','parentSegment','resolvePathToResource','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','5221328LpurPq','segment:folder:list','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','(root)','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','6610DxFhON','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','replace','folder','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Segment\x20name:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20[Job\x20ID:\x20','parent','fullPath','getSegment','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','Show\x20folder\x20or\x20child\x20segment\x20details','4088UnVBzh','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Fetching\x20SQL\x20for\x20segment...','✔\x20Query\x20completed:\x20Processed\x20','jobId','Examples:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20Opening\x20','Resolved\x20type:\x20','\x20\x20Cause:\x20','in\x20','getFolder','segment:folder:create','Segment\x20ID\x20missing\x20from\x20resolved\x20path'];a32_0x8792=function(){return _0x4198f0;};return a32_0x8792();}export class SegmentDescribeCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0x101);[a32_0x413ad9(0x13b)]=a32_0x413ad9(0xfe);async[a32_0x413ad9(0x12b)](_0x2cab24){const _0x458ecd=a32_0x413ad9,{options:_0x597858,args:_0x207b03,tdx:_0x280b2a}=_0x2cab24,_0x112d62=_0x207b03[0x0],_0x2ab8c1=!_0x112d62&&!!_0x597858[_0x458ecd(0x164)],_0x578c99=_0x112d62||_0x597858[_0x458ecd(0x164)];if(!_0x578c99)return console[_0x458ecd(0x12c)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x458ecd(0x12c)](_0x458ecd(0xdc)),console[_0x458ecd(0x12c)](_0x458ecd(0xe3)),console['error'](_0x458ecd(0xd1)),console[_0x458ecd(0x12c)](_0x458ecd(0x100)),console[_0x458ecd(0x12c)](_0x458ecd(0xf5)),console[_0x458ecd(0x12c)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x21ed39=_0x597858['segmentPath'];let _0x22a917=_0x578c99;!_0x2ab8c1&&_0x21ed39&&!_0x578c99[_0x458ecd(0x132)]('/')&&(_0x22a917=_0x21ed39+'/'+_0x578c99,_0x597858[_0x458ecd(0x120)]&&console['error'](_0x458ecd(0x14b)+_0x22a917));const _0x4ad6bd=await withSpinner('Resolving\x20path\x20\x27'+_0x22a917+'\x27...',()=>_0x280b2a[_0x458ecd(0x141)][_0x458ecd(0x165)](_0x22a917),{'verbose':_0x597858['verbose']}),_0x3dc0dc=_0x4ad6bd[_0x458ecd(0xee)];_0x597858[_0x458ecd(0x120)]&&(console['error'](_0x458ecd(0xe7)+_0x3dc0dc[_0x458ecd(0x131)]),console[_0x458ecd(0x12c)]('Parent\x20ID:\x20'+_0x3dc0dc['parentId']),_0x3dc0dc['folderId']&&console[_0x458ecd(0x12c)](_0x458ecd(0x10e)+_0x3dc0dc[_0x458ecd(0x158)]),_0x3dc0dc[_0x458ecd(0x13a)]&&console[_0x458ecd(0x12c)](_0x458ecd(0x126)+_0x3dc0dc[_0x458ecd(0x13a)]));if(_0x3dc0dc[_0x458ecd(0x131)]===_0x458ecd(0xd8)){const _0x1d5298=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x280b2a['segment'][_0x458ecd(0x160)](_0x3dc0dc[_0x458ecd(0x156)]),{'verbose':_0x597858[_0x458ecd(0x120)]});await handleSingleObjectOutput(_0x1d5298[_0x458ecd(0xee)],_0x597858);}else{if(_0x3dc0dc[_0x458ecd(0x131)]===_0x458ecd(0xd3)){if(!_0x3dc0dc[_0x458ecd(0x158)])throw new SDKError(ErrorCode[_0x458ecd(0x14e)],_0x458ecd(0x108));const _0x2e3747=await withSpinner(_0x458ecd(0x105),()=>_0x280b2a[_0x458ecd(0x141)][_0x458ecd(0xea)](_0x3dc0dc[_0x458ecd(0x158)]),{'verbose':_0x597858[_0x458ecd(0x120)]});await handleSingleObjectOutput(_0x2e3747[_0x458ecd(0xee)],_0x597858);}else{if(_0x3dc0dc['type']===_0x458ecd(0x141)){if(!_0x3dc0dc['segmentId'])throw new SDKError(ErrorCode[_0x458ecd(0x113)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x125152=await withSpinner('Fetching\x20segment\x20details...',()=>_0x280b2a['segment']['getSegment'](_0x3dc0dc[_0x458ecd(0x156)],_0x3dc0dc[_0x458ecd(0x13a)]),{'verbose':_0x597858['verbose']});await handleSingleObjectOutput(_0x125152[_0x458ecd(0xee)],_0x597858);}}}return 0x0;}catch(_0x229f71){if(_0x229f71 instanceof SDKError)return console['error'](_0x458ecd(0x10a)+_0x229f71['message']),_0x229f71[_0x458ecd(0x14d)]&&console[_0x458ecd(0x12c)](_0x458ecd(0xe8)+_0x229f71['cause']),0x1;throw _0x229f71;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x413ad9(0x134)]='segment:show';[a32_0x413ad9(0x13b)]=a32_0x413ad9(0x14a);async['execute'](_0x16b212){const _0x159e89=a32_0x413ad9,{options:_0x340e96,args:_0x1d1d6b,tdx:_0x4bcd28}=_0x16b212,_0x1db9c1=_0x1d1d6b[0x0];if(!_0x1db9c1)return console['error'](_0x159e89(0x155)),console[_0x159e89(0x12c)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x159e89(0x12c)](_0x159e89(0xf0)),console['error'](_0x159e89(0xe3)),console['error'](_0x159e89(0x11c)),console[_0x159e89(0x12c)](_0x159e89(0x10c)),0x1;try{const _0x482fa1=_0x340e96[_0x159e89(0x164)],_0x5da0fc=resolveSegmentTarget(_0x1db9c1,_0x482fa1,_0x340e96[_0x159e89(0x120)]);_0x340e96[_0x159e89(0x120)]&&console[_0x159e89(0x12c)](_0x159e89(0x148)+_0x5da0fc);const _0x4b4c89=await withSpinner(_0x159e89(0x15e)+_0x1db9c1+_0x159e89(0x129),()=>_0x4bcd28[_0x159e89(0x141)]['resolvePathToResource'](_0x5da0fc),{'verbose':_0x340e96[_0x159e89(0x120)]}),_0x1f9ba5=_0x4b4c89[_0x159e89(0xee)];_0x340e96[_0x159e89(0x120)]&&(console[_0x159e89(0x12c)](_0x159e89(0xe7)+_0x1f9ba5[_0x159e89(0x131)]),console[_0x159e89(0x12c)](_0x159e89(0x118)+_0x1f9ba5['parentId']));if(_0x1f9ba5[_0x159e89(0x131)]===_0x159e89(0xd3))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x159e89(0x12c)](_0x159e89(0xd0)),0x1;if(_0x1f9ba5[_0x159e89(0x131)]===_0x159e89(0xd8))return console[_0x159e89(0x12c)](_0x159e89(0x11f)),console[_0x159e89(0x12c)](_0x159e89(0xf6)),0x1;if(!_0x1f9ba5['segmentId'])throw new SDKError(ErrorCode[_0x159e89(0x113)],_0x159e89(0xec));const _0x114a73=await withSpinner(_0x159e89(0xe0),()=>_0x4bcd28[_0x159e89(0x141)][_0x159e89(0x145)](_0x1f9ba5[_0x159e89(0x156)],_0x1f9ba5['segmentId']),{'verbose':_0x340e96[_0x159e89(0x120)]});let _0x413afc=_0x114a73[_0x159e89(0xee)];const _0x3b2461=resolveLimit(_0x340e96[_0x159e89(0x115)],DEFAULT_DISPLAY_LIMIT),_0x12efd7=/\bLIMIT\s+\d+/i['test'](_0x413afc);!_0x12efd7&&(_0x413afc=_0x413afc['trim']()[_0x159e89(0xd2)](/;+$/,''),_0x413afc=_0x159e89(0xfd)+_0x413afc+_0x159e89(0x109)+_0x3b2461);_0x340e96[_0x159e89(0x120)]&&console[_0x159e89(0x12c)](_0x159e89(0x163)+_0x413afc);const _0x4f246e=await withQuerySpinner('Executing\x20segment\x20query...',async _0x481693=>{const _0x246156=_0x159e89,_0x97f4f1=await _0x4bcd28[_0x246156(0x130)][_0x246156(0x12b)](_0x413afc,{'catalog':'td','schema':'information_schema','onJobId':_0x2b60b1=>{_0x481693['setJobId'](_0x2b60b1);}});return _0x97f4f1;},{'verbose':_0x340e96[_0x159e89(0x120)]}),_0x3f8a35=_0x4f246e[_0x159e89(0xee)],_0x5d88b9=_0x3f8a35['jobId']?_0x159e89(0xd7)+_0x3f8a35[_0x159e89(0xe2)]+']':'';return console[_0x159e89(0x12c)](_0x159e89(0xe1)+_0x3f8a35['stats'][_0x159e89(0x14f)]['toLocaleString']()+_0x159e89(0x124)+(_0x159e89(0xe9)+formatElapsed(_0x3f8a35[_0x159e89(0xf3)][_0x159e89(0x11d)])+_0x5d88b9)),await handleQueryOutput(_0x3f8a35,_0x340e96),0x0;}catch(_0x3c8912){if(_0x3c8912 instanceof SDKError)return console[_0x159e89(0x12c)]('✖\x20Query\x20failed\x20['+_0x3c8912['code']+']'),console[_0x159e89(0x12c)]('\x0a'+_0x3c8912[_0x159e89(0x147)]),0x1;throw _0x3c8912;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0xcb);[a32_0x413ad9(0x13b)]=a32_0x413ad9(0x12f);async[a32_0x413ad9(0x12b)](_0x537c92){const _0x235a51=a32_0x413ad9,{options:_0x3fc3ba,args:_0x49dd29,tdx:_0x52f9f6}=_0x537c92;if(_0x49dd29[_0x235a51(0xf7)]===0x0)return console[_0x235a51(0x12c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x235a51(0x12c)](_0x235a51(0x15f)),0x1;const _0x5dd55e=_0x49dd29[0x0];try{_0x3fc3ba[_0x235a51(0x120)]&&(console[_0x235a51(0x12c)](_0x235a51(0xed)+_0x3fc3ba['site']),console[_0x235a51(0x12c)](_0x235a51(0x10b)+_0x5dd55e));const _0x52670a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5dd55e+_0x235a51(0x129),()=>_0x52f9f6[_0x235a51(0x141)][_0x235a51(0x162)](_0x5dd55e),{'verbose':_0x3fc3ba[_0x235a51(0x120)]}),_0x23eaad=_0x52670a['data'];_0x3fc3ba[_0x235a51(0x120)]&&console[_0x235a51(0x12c)](_0x235a51(0x13e)+_0x23eaad);const _0x3721c2=await withSpinner(_0x235a51(0x12e)+_0x5dd55e+_0x235a51(0x129),()=>_0x52f9f6[_0x235a51(0x141)][_0x235a51(0x143)](_0x23eaad),{'verbose':_0x3fc3ba[_0x235a51(0x120)]}),_0x105f1c=_0x3721c2[_0x235a51(0xee)];return console[_0x235a51(0x12c)](_0x235a51(0xf4)+_0x105f1c['length']+'\x20folder'+(_0x105f1c[_0x235a51(0xf7)]!==0x1?'s':'')),await handleSDKOutput(_0x105f1c,_0x3fc3ba),0x0;}catch(_0x19c4c3){if(_0x19c4c3 instanceof SDKError)return console[_0x235a51(0x12c)](_0x235a51(0x10a)+_0x19c4c3['message']),_0x19c4c3[_0x235a51(0x14d)]&&console[_0x235a51(0x12c)](_0x235a51(0xe8)+_0x19c4c3['cause']),0x1;throw _0x19c4c3;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0x128);[a32_0x413ad9(0x13b)]=a32_0x413ad9(0x138);async[a32_0x413ad9(0x12b)](_0x155163){const _0x372608=a32_0x413ad9,{options:_0x110f5e,args:_0x26b145,tdx:_0x3aac45}=_0x155163;if(_0x26b145[_0x372608(0xf7)]===0x0)return console[_0x372608(0x12c)](_0x372608(0x140)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x7b522e,childId:_0x521c33}=parseSegmentRef(_0x26b145[0x0]);_0x110f5e[_0x372608(0x120)]&&(console[_0x372608(0x12c)](_0x372608(0xed)+_0x110f5e[_0x372608(0xf1)]),console[_0x372608(0x12c)](_0x372608(0x10b)+_0x7b522e),_0x521c33&&console['error'](_0x372608(0x159)+_0x521c33));if(!_0x521c33)return console[_0x372608(0x12c)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5c7af3=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7b522e+_0x372608(0x129),()=>_0x3aac45[_0x372608(0x141)][_0x372608(0x162)](_0x7b522e),{'verbose':_0x110f5e[_0x372608(0x120)]}),_0x57dfeb=_0x5c7af3['data'];_0x110f5e[_0x372608(0x120)]&&console[_0x372608(0x12c)](_0x372608(0x13e)+_0x57dfeb);const _0x4c7e58=await withSpinner('Resolving\x20folder\x20\x27'+_0x521c33+_0x372608(0x129),()=>_0x3aac45[_0x372608(0x141)][_0x372608(0x152)](_0x57dfeb,_0x521c33),{'verbose':_0x110f5e[_0x372608(0x120)]}),_0x78a3da=_0x4c7e58['data'];_0x110f5e[_0x372608(0x120)]&&console[_0x372608(0x12c)](_0x372608(0x12d)+_0x78a3da);const _0x9e74e8=await withSpinner(_0x372608(0x122)+_0x521c33+_0x372608(0x129),()=>_0x3aac45[_0x372608(0x141)][_0x372608(0xea)](_0x78a3da),{'verbose':_0x110f5e['verbose']});return await handleSDKOutput([_0x9e74e8[_0x372608(0xee)]],_0x110f5e),0x0;}catch(_0x10f100){if(_0x10f100 instanceof SDKError)return console['error'](_0x372608(0x10a)+_0x10f100[_0x372608(0x147)]),_0x10f100[_0x372608(0x14d)]&&console[_0x372608(0x12c)](_0x372608(0xe8)+_0x10f100[_0x372608(0x14d)]),0x1;throw _0x10f100;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0x151);['description']=a32_0x413ad9(0xd6);async[a32_0x413ad9(0x12b)](_0x3a235c){const _0x477fc4=a32_0x413ad9,{options:_0x2a7599,args:_0x1449b7,tdx:_0x13094f}=_0x3a235c,_0x2be35d=_0x1449b7[0x0];if(!_0x2be35d)return console[_0x477fc4(0x12c)](_0x477fc4(0x155)),console[_0x477fc4(0x12c)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x477fc4(0xfb)),console['error'](_0x477fc4(0xe3)),console['error'](_0x477fc4(0x144)),console['error'](_0x477fc4(0x161)),0x1;try{const _0x4f306f=_0x2a7599[_0x477fc4(0x164)],_0x19369b=resolveSegmentTarget(_0x2be35d,_0x4f306f,_0x2a7599[_0x477fc4(0x120)]);_0x2a7599[_0x477fc4(0x120)]&&console[_0x477fc4(0x12c)](_0x477fc4(0x148)+_0x19369b);const _0x564710=await withSpinner(_0x477fc4(0x15e)+_0x2be35d+_0x477fc4(0x129),()=>_0x13094f[_0x477fc4(0x141)][_0x477fc4(0x165)](_0x19369b),{'verbose':_0x2a7599[_0x477fc4(0x120)]}),_0xb3f3ef=_0x564710['data'];_0x2a7599[_0x477fc4(0x120)]&&(console[_0x477fc4(0x12c)]('Resolved\x20type:\x20'+_0xb3f3ef[_0x477fc4(0x131)]),console[_0x477fc4(0x12c)](_0x477fc4(0x118)+_0xb3f3ef[_0x477fc4(0x156)]));if(_0xb3f3ef[_0x477fc4(0x131)]===_0x477fc4(0xd3))return console[_0x477fc4(0x12c)](_0x477fc4(0xfa)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xb3f3ef['type']===_0x477fc4(0xd8))return console[_0x477fc4(0x12c)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x477fc4(0x117)),0x1;if(!_0xb3f3ef['segmentId'])throw new SDKError(ErrorCode[_0x477fc4(0x113)],_0x477fc4(0xec));const _0x170fb7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x13094f[_0x477fc4(0x141)][_0x477fc4(0x145)](_0xb3f3ef[_0x477fc4(0x156)],_0xb3f3ef[_0x477fc4(0x13a)]),{'verbose':_0x2a7599[_0x477fc4(0x120)]}),_0x1a057b=_0x170fb7['data'];return _0x2a7599[_0x477fc4(0x127)]===_0x477fc4(0x150)||_0x2a7599[_0x477fc4(0x127)]===_0x477fc4(0x13d)?await handleSDKOutput([{'sql':_0x1a057b}],_0x2a7599):console[_0x477fc4(0xf9)](_0x1a057b),0x0;}catch(_0x2c35d3){if(_0x2c35d3 instanceof SDKError)return console[_0x477fc4(0x12c)](_0x477fc4(0x10a)+_0x2c35d3[_0x477fc4(0x147)]),_0x2c35d3[_0x477fc4(0x14d)]&&console[_0x477fc4(0x12c)](_0x477fc4(0xe8)+_0x2c35d3[_0x477fc4(0x14d)]),0x1;throw _0x2c35d3;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a32_0x413ad9(0xeb);['description']=a32_0x413ad9(0xf8);async[a32_0x413ad9(0x12b)](_0x450f2c){const _0x56b22d=a32_0x413ad9,{options:_0x4d9a7a,args:_0x3533f1,tdx:_0x169fc7}=_0x450f2c,_0x353073=_0x4d9a7a;if(_0x3533f1[_0x56b22d(0xf7)]<0x2)return console[_0x56b22d(0x12c)](_0x56b22d(0xd4)),console[_0x56b22d(0x12c)](_0x56b22d(0xcc)),0x1;const _0x3e8fb4=_0x3533f1[0x0],_0x4b157f=_0x3533f1[0x1];_0x353073[_0x56b22d(0x120)]&&(console[_0x56b22d(0x12c)](_0x56b22d(0xed)+_0x353073[_0x56b22d(0xf1)]),console[_0x56b22d(0x12c)](_0x56b22d(0x13c)+_0x3e8fb4),console[_0x56b22d(0x12c)](_0x56b22d(0x159)+_0x4b157f));let _0x27c4fc;if(_0x353073[_0x56b22d(0xfc)]){const _0x1bc503=_0x353073[_0x56b22d(0xfc)],_0x32f42a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3e8fb4+'\x27...',()=>_0x169fc7[_0x56b22d(0x141)][_0x56b22d(0x162)](_0x3e8fb4),{'verbose':_0x353073[_0x56b22d(0x120)]}),_0x4a0ba1=_0x32f42a[_0x56b22d(0xee)],_0x45119a=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1bc503+'\x27...',()=>_0x169fc7[_0x56b22d(0x141)][_0x56b22d(0x152)](_0x4a0ba1,_0x1bc503),{'verbose':_0x353073[_0x56b22d(0x120)]});_0x27c4fc=_0x45119a[_0x56b22d(0xee)],_0x353073['verbose']&&console[_0x56b22d(0x12c)](_0x56b22d(0x125)+_0x27c4fc);}const _0x11bba1={'name':_0x4b157f,'description':_0x353073[_0x56b22d(0x13b)],'parentFolderId':_0x27c4fc},_0x3bfd7f=await withSpinner(_0x56b22d(0x157)+_0x4b157f+_0x56b22d(0x129),()=>_0x169fc7[_0x56b22d(0x141)]['createFolder'](_0x3e8fb4,_0x11bba1),{'verbose':_0x353073[_0x56b22d(0x120)]}),_0x8b7d0b=_0x3bfd7f[_0x56b22d(0xee)];return console['error'](_0x56b22d(0x123)+_0x8b7d0b[_0x56b22d(0x134)]+_0x56b22d(0xdb)+_0x8b7d0b['id']),await handleSDKOutput([_0x8b7d0b],_0x353073),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0x15b);[a32_0x413ad9(0x13b)]=a32_0x413ad9(0xdd);async[a32_0x413ad9(0x12b)](_0x476b59){const _0x523f69=a32_0x413ad9,{options:_0xe2305d,args:_0xe1e5a2,tdx:_0x21f838}=_0x476b59,_0x50e2d7=_0xe1e5a2[0x0];if(!_0x50e2d7)return console[_0x523f69(0x12c)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x523f69(0x12c)](_0x523f69(0xce)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x523f69(0x12c)](_0x523f69(0x114)),console[_0x523f69(0x12c)](_0x523f69(0x111)),console[_0x523f69(0x12c)]('Examples:'),console[_0x523f69(0x12c)](_0x523f69(0x10f)),console['error'](_0x523f69(0x11e)),console[_0x523f69(0x12c)](_0x523f69(0xe4)),console[_0x523f69(0x12c)](_0x523f69(0x154)),0x1;try{const _0x1b2a46=_0xe2305d[_0x523f69(0x164)],_0x4020a4=resolveSegmentTarget(_0x50e2d7,_0x1b2a46,_0xe2305d['verbose']);_0xe2305d['verbose']&&console[_0x523f69(0x12c)](_0x523f69(0x148)+_0x4020a4);const _0x5532d4=await withSpinner(_0x523f69(0x15e)+_0x50e2d7+_0x523f69(0x129),()=>_0x21f838[_0x523f69(0x141)][_0x523f69(0x165)](_0x4020a4),{'verbose':_0xe2305d[_0x523f69(0x120)]}),_0x27816e=_0x5532d4['data'];_0xe2305d[_0x523f69(0x120)]&&(console[_0x523f69(0x12c)]('Resolved\x20type:\x20'+_0x27816e['type']),console[_0x523f69(0x12c)]('Parent\x20ID:\x20'+_0x27816e['parentId']),_0x27816e['folderId']&&console[_0x523f69(0x12c)](_0x523f69(0x10e)+_0x27816e[_0x523f69(0x158)]),_0x27816e[_0x523f69(0x13a)]&&console[_0x523f69(0x12c)](_0x523f69(0x126)+_0x27816e[_0x523f69(0x13a)]));if(_0xe2305d[_0x523f69(0x116)]){if(_0x27816e[_0x523f69(0x131)]===_0x523f69(0xd3))return console[_0x523f69(0x12c)](_0x523f69(0xe5)),0x1;if(_0x27816e['type']===_0x523f69(0xd8))return console[_0x523f69(0x12c)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x523f69(0x12c)](_0x523f69(0x102)),0x1;if(!_0x27816e[_0x523f69(0x13a)])throw new SDKError(ErrorCode[_0x523f69(0x113)],_0x523f69(0xec));const _0x28131a=getConsoleNextUrl(_0xe2305d['site'],_0x523f69(0x119)+_0x27816e['parentId']+_0x523f69(0x15a)+_0x27816e['segmentId']);return console[_0x523f69(0x12c)](a32_0x56ea1f[_0x523f69(0x14c)]('✔')+_0x523f69(0xe6)+a32_0x56ea1f[_0x523f69(0x149)](_0x28131a)),openBrowser(_0x28131a),0x0;}if(_0x27816e[_0x523f69(0x131)]===_0x523f69(0xd3)){if(!_0x27816e[_0x523f69(0x158)])throw new SDKError(ErrorCode[_0x523f69(0x14e)],_0x523f69(0x108));const _0x3fffcc=await withSpinner(_0x523f69(0x105),()=>_0x21f838[_0x523f69(0x141)][_0x523f69(0xea)](_0x27816e[_0x523f69(0x158)]),{'verbose':_0xe2305d[_0x523f69(0x120)]});await handleSingleObjectOutput(_0x3fffcc[_0x523f69(0xee)],_0xe2305d);}else{if(_0x27816e[_0x523f69(0x131)]===_0x523f69(0x141)){if(!_0x27816e[_0x523f69(0x13a)])throw new SDKError(ErrorCode[_0x523f69(0x113)],_0x523f69(0xec));const _0x113bf0=await withSpinner(_0x523f69(0x121),()=>_0x21f838[_0x523f69(0x141)][_0x523f69(0xda)](_0x27816e[_0x523f69(0x156)],_0x27816e[_0x523f69(0x13a)]),{'verbose':_0xe2305d[_0x523f69(0x120)]}),_0x1bb621=getConsoleNextUrl(_0xe2305d['site'],'/app/ps/'+_0x27816e[_0x523f69(0x156)]+_0x523f69(0x15a)+_0x27816e['segmentId']),_0x26b93b=_0x113bf0['data'];_0x26b93b[_0x523f69(0x11a)]=_0x1bb621,await handleSingleObjectOutput(_0x26b93b,_0xe2305d);}else return console[_0x523f69(0x12c)](_0x523f69(0x142)),console[_0x523f69(0x12c)](_0x523f69(0xff)),0x1;}return 0x0;}catch(_0x10bd59){if(_0x10bd59 instanceof SDKError)return console['error'](_0x523f69(0x10a)+_0x10bd59[_0x523f69(0x147)]),_0x10bd59[_0x523f69(0x14d)]&&console[_0x523f69(0x12c)](_0x523f69(0xe8)+_0x10bd59['cause']),0x1;throw _0x10bd59;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x413ad9(0x134)]=a32_0x413ad9(0x13f);[a32_0x413ad9(0x13b)]=a32_0x413ad9(0x12a);async[a32_0x413ad9(0x12b)](_0x471d09){const _0x52ac8f=a32_0x413ad9,{options:_0x486773,args:_0x366784,tdx:_0x37cdda}=_0x471d09,_0x25ea26=_0x366784[0x0];if(!_0x25ea26)return console[_0x52ac8f(0x12c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x52ac8f(0xdf)),console['error'](_0x52ac8f(0xe3)),console[_0x52ac8f(0x12c)](_0x52ac8f(0xc9)),console[_0x52ac8f(0x12c)](_0x52ac8f(0x106)),0x1;try{const _0x117b67=_0x486773['parentSegment'],_0x7ea73c=resolveSegmentTarget(_0x25ea26,_0x117b67,_0x486773[_0x52ac8f(0x120)]);_0x486773[_0x52ac8f(0x120)]&&console[_0x52ac8f(0x12c)](_0x52ac8f(0x148)+_0x7ea73c);const _0x9d0082=await withSpinner(_0x52ac8f(0x15e)+_0x25ea26+'\x27...',()=>_0x37cdda[_0x52ac8f(0x141)][_0x52ac8f(0x165)](_0x7ea73c),{'verbose':_0x486773[_0x52ac8f(0x120)]}),_0x5f03f8=_0x9d0082[_0x52ac8f(0xee)];_0x486773[_0x52ac8f(0x120)]&&(console[_0x52ac8f(0x12c)](_0x52ac8f(0xe7)+_0x5f03f8[_0x52ac8f(0x131)]),console[_0x52ac8f(0x12c)](_0x52ac8f(0x118)+_0x5f03f8['parentId']));if(_0x5f03f8[_0x52ac8f(0x131)]===_0x52ac8f(0xd3))return console[_0x52ac8f(0x12c)](_0x52ac8f(0x10d)),console['error'](_0x52ac8f(0xef)),0x1;if(_0x5f03f8[_0x52ac8f(0x131)]===_0x52ac8f(0xd8))return console[_0x52ac8f(0x12c)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x52ac8f(0x139)),0x1;if(!_0x5f03f8[_0x52ac8f(0x13a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x52ac8f(0xec));const _0x550b59=await withSpinner(_0x52ac8f(0xe0),()=>_0x37cdda['segment'][_0x52ac8f(0x145)](_0x5f03f8[_0x52ac8f(0x156)],_0x5f03f8[_0x52ac8f(0x13a)]),{'verbose':_0x486773['verbose']}),_0x3e1156=_0x550b59['data'],_0x4df6b5=await executeSchemaQuery(_0x3e1156,_0x37cdda,_0x486773);return await handleQueryOutput(_0x4df6b5,_0x486773),0x0;}catch(_0x3b38c3){if(_0x3b38c3 instanceof SDKError)return console[_0x52ac8f(0x12c)](_0x52ac8f(0x10a)+_0x3b38c3[_0x52ac8f(0x147)]),_0x3b38c3[_0x52ac8f(0x14d)]&&console[_0x52ac8f(0x12c)]('\x20\x20Cause:\x20'+_0x3b38c3[_0x52ac8f(0x14d)]),0x1;throw _0x3b38c3;}}}
|