@treasuredata/tdx 0.8.12 → 0.9.0
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
|
-
const
|
|
1
|
+
const a28_0x256e25=a28_0x4434;function a28_0x191f(){const _0xc2cdf3=['stop','logger','SIGTERM','execute','529683OuBWCE','\x20\x20}','http://0.0.0.0:','init','5729640taJJrM','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','green','bold','close','project','white','description','34549191QdQjWy','cyan','llm:proxy','Project\x20\x27','log','\x0aTesting\x20with\x20Agent\x20SDK:','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','1290ioXghi','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','server','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','start','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','logLevel','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','exit','\x20\x20Address:','Server\x20Configuration:','\x20\x20Site:','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20}','Port\x20','Starting\x20proxy\x20server...','yellow','\x20\x20Agents:','11377289qTmIKI','4AABRPV','find','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','name','llm','2838232swKsSx','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20Project:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','getOrCreateDefaultProject','dim','195955WlNcJV','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x0aClaude\x20Code\x20Configuration:','\x20\x20{','projects','\x27\x20not\x20found','attributes','17928qkjnvO'];a28_0x191f=function(){return _0xc2cdf3;};return a28_0x191f();}(function(_0x37e63a,_0x4c19e1){const _0x4a33bf=a28_0x4434,_0x39983c=_0x37e63a();while(!![]){try{const _0x14ee60=parseInt(_0x4a33bf(0x191))/0x1+-parseInt(_0x4a33bf(0x18b))/0x2+-parseInt(_0x4a33bf(0x19e))/0x3*(parseInt(_0x4a33bf(0x186))/0x4)+-parseInt(_0x4a33bf(0x172))/0x5*(-parseInt(_0x4a33bf(0x199))/0x6)+-parseInt(_0x4a33bf(0x185))/0x7+-parseInt(_0x4a33bf(0x1a2))/0x8+parseInt(_0x4a33bf(0x1aa))/0x9;if(_0x14ee60===_0x4c19e1)break;else _0x39983c['push'](_0x39983c['shift']());}catch(_0x5301c8){_0x39983c['push'](_0x39983c['shift']());}}}(a28_0x191f,0xd4061));function a28_0x4434(_0x54853c,_0x25ef79){_0x54853c=_0x54853c-0x171;const _0x191ffb=a28_0x191f();let _0x4434c0=_0x191ffb[_0x54853c];return _0x4434c0;}import a28_0x4d7189 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x225455,_0x3ddefb){const _0x8a6dd7=a28_0x4434,{tdx:_0x101ba8,options:_0xa16f1e}=_0x225455,_0x2b7bcc=_0x3ddefb||_0xa16f1e['llmProject'];if(_0x2b7bcc){const _0xd79c3=await _0x101ba8[_0x8a6dd7(0x18a)][_0x8a6dd7(0x196)](),_0x4e831f=_0xd79c3[_0x8a6dd7(0x187)](_0x479095=>_0x479095[_0x8a6dd7(0x198)][_0x8a6dd7(0x189)]===_0x2b7bcc);if(!_0x4e831f)throw new SDKError(ErrorCode['NOT_FOUND'],_0x8a6dd7(0x1ad)+_0x2b7bcc+_0x8a6dd7(0x197),undefined,{'helpText':_0x8a6dd7(0x173)});return _0x4e831f['id'];}const _0x1e55d0=await _0x101ba8[_0x8a6dd7(0x18a)][_0x8a6dd7(0x18f)]();return _0x1e55d0['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x256e25(0x189)]=a28_0x256e25(0x1ac);[a28_0x256e25(0x1a9)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';['server'];[a28_0x256e25(0x19b)];async[a28_0x256e25(0x19d)](_0xaa63f4){const _0x5014b3=a28_0x256e25,{tdx:_0x151fec,options:_0x4ce806}=_0xaa63f4;try{const _0x7fb253=_0x4ce806,_0x41341d=_0x7fb253['port']||0xfa0,_0x320802=_0x7fb253[_0x5014b3(0x1a7)],_0x347ec3=await findAvailablePort(_0x41341d);console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)]('Resolving\x20project...'));const _0xdbe0a=await getProjectIdOrDefault(_0xaa63f4,_0x320802),_0x2f5d09=await _0x151fec[_0x5014b3(0x18a)][_0x5014b3(0x196)](),_0x19d0eb=_0x2f5d09['find'](_0x517251=>_0x517251['id']===_0xdbe0a);this[_0x5014b3(0x19b)]=new TDXLogger(_0x4ce806[_0x5014b3(0x179)]),await this[_0x5014b3(0x19b)][_0x5014b3(0x1a1)](),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x182)));_0x347ec3!==_0x41341d&&console['log'](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x181)+_0x41341d+_0x5014b3(0x18c)+_0x347ec3));this[_0x5014b3(0x174)]=new ProxyServer({'port':_0x347ec3,'projectId':_0xdbe0a,'tdx':_0x151fec,'logger':this[_0x5014b3(0x19b)],'site':_0x4ce806['site']}),await this['server'][_0x5014b3(0x176)](),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x183)][_0x5014b3(0x1a5)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console['log'](a28_0x4d7189['yellow'](_0x5014b3(0x178))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x17a))),console[_0x5014b3(0x1ae)](a28_0x4d7189['green'][_0x5014b3(0x1a5)](_0x5014b3(0x175))),console['log'](a28_0x4d7189['cyan'](_0x5014b3(0x17d))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x17c)),a28_0x4d7189['white'](_0x5014b3(0x1a0)+_0x347ec3)),console['log'](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x18d)),a28_0x4d7189['white'](_0x19d0eb?.[_0x5014b3(0x198)][_0x5014b3(0x189)]||_0xdbe0a)),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x184)),a28_0x4d7189[_0x5014b3(0x1a8)]('created\x20on-demand\x20per\x20model')),console['log'](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x17e)),a28_0x4d7189[_0x5014b3(0x1a8)](_0x4ce806['site'])),console['log'](a28_0x4d7189['cyan'](_0x5014b3(0x194))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x18e))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x195))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x17f))),console['log'](a28_0x4d7189['white'](_0x5014b3(0x192)+_0x347ec3+'\x22,')),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x188))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x177))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x180))),console['log'](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x19f))),console['log'](a28_0x4d7189[_0x5014b3(0x1ab)](_0x5014b3(0x1af))),console[_0x5014b3(0x1ae)](a28_0x4d7189['dim'](_0x5014b3(0x1a3))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x5014b3(0x1ae)](a28_0x4d7189['dim']('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console['log'](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x171)));const _0x1b8439=async()=>{const _0x2f62ed=_0x5014b3;console[_0x2f62ed(0x1ae)](a28_0x4d7189[_0x2f62ed(0x190)](_0x2f62ed(0x193))),this[_0x2f62ed(0x174)]&&await this['server'][_0x2f62ed(0x19a)](),this['logger']&&await this[_0x2f62ed(0x19b)]['close'](),console['log'](a28_0x4d7189[_0x2f62ed(0x1a4)]('✓\x20Proxy\x20server\x20stopped')),process[_0x2f62ed(0x17b)](0x0);};return process['on']('SIGINT',_0x1b8439),process['on'](_0x5014b3(0x19c),_0x1b8439),await new Promise(()=>{}),0x0;}catch(_0xb5713d){this['server']&&await this[_0x5014b3(0x174)][_0x5014b3(0x19a)]();this['logger']&&await this[_0x5014b3(0x19b)][_0x5014b3(0x1a6)]();throw _0xb5713d;}}}
|
|
@@ -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_0x3f507c=a29_0x3897;(function(_0x59c5a3,_0x378e39){const _0x3eb1bc=a29_0x3897,_0x2f14c3=_0x59c5a3();while(!![]){try{const _0x36ee62=-parseInt(_0x3eb1bc(0x1d8))/0x1*(parseInt(_0x3eb1bc(0x1fe))/0x2)+-parseInt(_0x3eb1bc(0x21d))/0x3+-parseInt(_0x3eb1bc(0x1e5))/0x4*(parseInt(_0x3eb1bc(0x183))/0x5)+parseInt(_0x3eb1bc(0x1ac))/0x6+parseInt(_0x3eb1bc(0x1aa))/0x7*(parseInt(_0x3eb1bc(0x229))/0x8)+parseInt(_0x3eb1bc(0x1d1))/0x9*(-parseInt(_0x3eb1bc(0x17e))/0xa)+-parseInt(_0x3eb1bc(0x20b))/0xb*(-parseInt(_0x3eb1bc(0x1bb))/0xc);if(_0x36ee62===_0x378e39)break;else _0x2f14c3['push'](_0x2f14c3['shift']());}catch(_0x161064){_0x2f14c3['push'](_0x2f14c3['shift']());}}}(a29_0x1555,0xe96a6));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x367ebb from'path';import{BaseCommand}from'./command.js';function a29_0x1555(){const _0x4432dc=['parentSegment','.yaml','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','/{name}.yml\x0a','run','displayPreviewHints','SQL\x20query:\x0a','✔\x20No\x20changes\x20-\x20\x27','getParentFull','Get\x20SQL\x20query\x20for\x20parent\x20segment','displaySampleData','rowCount','31404dmzncP','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Events:','\x20--behavior\x20\x22<name>\x22','darwin','green','segment:parent:view','\x20=\x20','database','Apply\x20changes\x20to\x20\x27','pullParentYaml','toLocaleString','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','double','Listing\x20fields\x20for\x20\x27','Session:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','addBehaviors','\x5c$&','scheduleOption','Options:','1244331mCWJsZ','dim','attributesFile','Preview:','customersWithEvents','Join\x20on:','json','2680EBvaRE','matchedCount','format','yes','/\x20and\x20','column','web','%)\x20','segment:parent:sql','Resolving\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','site','-1d','49372gqhpmx','jobId','\x0a⚠️\x20\x20Both\x20','behaviors','Errors:','sampleData','Validate:','error','Options:\x0a','segment:parent:validate','Validating\x20configuration...','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0aNo\x20sample\x20data\x20available','Updated','Available\x20attributes:','Updating\x20parent\x20segment\x20\x27','match','red','schemaError','start','resolveParentId','List\x20available\x20fields\x20for\x20segmentation','dirname','\x20is\x20already\x20up\x20to\x20date','\x20parent\x20segment','644ppFonO','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Source:','createParent','replace','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Enriched:','master','Attribute:','✔\x20Query\x20completed:\x20Processed\x20','Create\x20parent\x20segment\x20\x27','stop','11561rxfNBZ','foreignKey','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','message','Show\x20parent\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Attempt:','listParents','✘\x20Failed\x20to\x20rename\x20directory:\x20','test','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Updating','xdg-open','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22','validateParentYaml','elapsedTimeMillis','verbose','4036176vFvqka','data','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Created','\x20Context\x20set:\x20','segment:parent:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','To\x20view\x20sample\x20data:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','displayMasterInfo','\x20kill','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','61192OrAldU','Columns:','runParent','stats','\x20--attribute\x20\x22','all','/app/dw/parentSegments/','Output\x20file:\x20','addBehaviorsFile','Behavior:','string','apply','Executing\x20parent\x20segment\x20query...','Table:\x20','log','Creating','number','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','YAML\x20file:\x20','FINISHED','processedRows','segment:parent:create','getParentSQL','\x20\x20\x20\x20-\x20','✔\x20Renamed\x20directory\x20to\x20','isDirectory','displayColumns','utf-8','segment','localeCompare','cyan','workflowId','bold','\x20Opening\x20','addAttributesFile','\x27\x20and\x20run\x20workflow?','segment:parent:preview','segment:parent:desc','yellow','join','attribute','customerGroupFile','\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','totalEvents','Fetching\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','/attempt/','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','customerPercent','\x20--interval\x20','addAttributes','No\x20parent\x20segments\x20found','coveragePercent','\x20rows)','Error\x20parsing\x20YAML:\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','in\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','enriched','name','displaySummary','behavior','label','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','session','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','schemaValid','.yml','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','parent_segment','\x27...','Error:\x20File\x20not\x20found:\x20','/sessions/','To\x20cancel:','map','workflowAttemptId','scheduleType','varchar','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x0aChanges\x20to\x20apply\x20to\x20\x27','Found\x20YAML\x20file:\x20','Attributes','tdx\x20segment\x20parent\x20preview\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','columns','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','trim','query','description','Fetching\x20current\x20configuration\x20for\x20\x27','execute','listFields','use','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','behaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x0aNew\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','/\x20→\x20','Database:\x20','Fetching\x20sample\x20data...','segment:parent:update','interval','status','/\x20directory.\x0a','`\x20to\x20download\x20the\x20configuration\x20first','Rows:','timezone','repeat','displayBehaviorsStats','endsWith','table','Master:','allValid','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','pushParentYaml','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','110ShlOoD','text','Aborted.','List\x20parent\x20segments','unref','230JbzlCc','length','sort','platform','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','👥\x20','Master\x20+\x20Attributes','Pattern:\x20','Customers:','\x20Configuration\x20is\x20valid','Fetching\x20SQL\x20for\x20\x27','toFixed','Error\x20reading\x20file:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','keys','output','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:fields','Creating\x20parent\x20segment\x20\x27','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','Master\x20Table','preview','Parent\x20segment:\x20','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','population','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20is\x20required','attributes','Error:','displayAttributesStats','\x20parent\x20segment\x20\x27','jsonl','\x20No\x20changes\x20-\x20','Site:\x20','win32','1673FtIKds','customerGroup','4046826xAVSGK','joinKey','\x20field'];a29_0x1555=function(){return _0x4432dc;};return a29_0x1555();}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_0x3897(_0x4adeba,_0x300fe8){_0x4adeba=_0x4adeba-0x14d;const _0x155532=a29_0x1555();let _0x3897be=_0x155532[_0x4adeba];return _0x3897be;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x3b8643 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=a29_0x3f507c(0x272);function openBrowser(_0x4897f0){const _0x27e8ca=a29_0x3f507c,_0x4544e7=process[_0x27e8ca(0x186)],_0x177faf=_0x4544e7===_0x27e8ca(0x1c0)?'open':_0x4544e7===_0x27e8ca(0x1a9)?_0x27e8ca(0x1f8):_0x27e8ca(0x217);spawn(_0x177faf,[_0x4897f0],{'detached':!![],'stdio':'ignore'})[_0x27e8ca(0x182)]();}function migrateLegacyDirectory(){const _0x2a5072=a29_0x3f507c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x38b25a=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x38b25a[_0x2a5072(0x242)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2a5072(0x1ec)](a29_0x3b8643['yellow'](_0x2a5072(0x1e7)+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x1dc)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x2a5072(0x1ec)](a29_0x3b8643['dim'](_0x2a5072(0x1bd)+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x170))),![];console['error'](a29_0x3b8643[_0x2a5072(0x24f)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x16a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2a5072(0x1ec)](a29_0x3b8643[_0x2a5072(0x1c1)](_0x2a5072(0x241)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x289887){const _0x45ccfb=_0x289887 instanceof Error?_0x289887['message']:String(_0x289887);return console['error'](a29_0x3b8643[_0x2a5072(0x1f6)](_0x2a5072(0x213)+_0x45ccfb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x3f507c(0x1b3)](_0x32f831){const _0x5f53d2=a29_0x3f507c;return migrateLegacyDirectory(),super[_0x5f53d2(0x1b3)](_0x32f831);}}function resolveYamlFile(_0x3bfd57){const _0x5f56a5=a29_0x3f507c;if(_0x3bfd57['endsWith'](_0x5f56a5(0x270))||_0x3bfd57[_0x5f56a5(0x176)](_0x5f56a5(0x1b0)))return _0x3bfd57;return a29_0x367ebb[_0x5f56a5(0x250)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3bfd57)+_0x5f56a5(0x270));}function formatProgressMessage(_0x1727b7){const _0x4b3600=a29_0x3f507c,_0x47fd7c=_0x1727b7[_0x4b3600(0x1f5)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x47fd7c){const [,_0x1edc0c,_0x3d5534,_0x1d683c='']=_0x47fd7c;return a29_0x3b8643['dim'](_0x1edc0c+':')+'\x20'+_0x3d5534+a29_0x3b8643[_0x4b3600(0x1d2)](_0x1d683c);}return a29_0x3b8643['dim'](_0x1727b7);}function showFileNotFoundError(_0x5e3aff,_0xbf0e92){const _0x222008=a29_0x3f507c;console[_0x222008(0x1ec)](a29_0x3b8643['red'](_0x222008(0x274)+_0x5e3aff+'\x0a')),console[_0x222008(0x1ec)](a29_0x3b8643['cyan'](_0x222008(0x26b)+_0xbf0e92+_0x222008(0x171)));}function showParentSegmentNotSetError(_0x1ae883){const _0x390093=a29_0x3f507c;console[_0x390093(0x1ec)](a29_0x3b8643['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x390093(0x1ec)](_0x1ae883);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x3f507c(0x222);['description']=a29_0x3f507c(0x181);async[a29_0x3f507c(0x15f)](_0x56cca3){const _0x4110cb=a29_0x3f507c,{options:_0x4ab75b,args:_0x362c29,tdx:_0x18ff29}=_0x56cca3,_0x2dcb40=_0x362c29[0x0];_0x4ab75b[_0x4110cb(0x21c)]&&(console[_0x4110cb(0x1ec)](_0x4110cb(0x1a8)+_0x4ab75b[_0x4110cb(0x1e3)]),_0x2dcb40&&console[_0x4110cb(0x1ec)](_0x4110cb(0x18c)+_0x2dcb40));const _0x3a6149=await withSpinner(_0x2dcb40?_0x4110cb(0x199)+_0x2dcb40+_0x4110cb(0x273):'Listing\x20parent\x20segments...',()=>_0x18ff29[_0x4110cb(0x245)][_0x4110cb(0x212)](),{'verbose':_0x4ab75b[_0x4110cb(0x21c)]});let _0x15b403=_0x3a6149[_0x4110cb(0x21e)];if(_0x2dcb40){const _0x49bc03=_0x2dcb40[_0x4110cb(0x202)](/[.+^${}()|[\]\\]/g,_0x4110cb(0x1ce))[_0x4110cb(0x202)](/\*/g,'.*')[_0x4110cb(0x202)](/\?/g,'.'),_0x1b7570=new RegExp('^'+_0x49bc03+'$','i');_0x15b403=_0x15b403['filter'](_0x5158d4=>_0x1b7570[_0x4110cb(0x214)](_0x5158d4[_0x4110cb(0x1a2)][_0x4110cb(0x267)]));}_0x15b403[_0x4110cb(0x185)]((_0x19e37a,_0x1ddd38)=>_0x19e37a['attributes'][_0x4110cb(0x267)][_0x4110cb(0x246)](_0x1ddd38['attributes'][_0x4110cb(0x267)])),console['error']('✔\x20Found\x20'+_0x15b403[_0x4110cb(0x184)]+_0x4110cb(0x1fd)+(_0x15b403[_0x4110cb(0x184)]!==0x1?'s':''));if(_0x4ab75b[_0x4110cb(0x1da)]===_0x4110cb(0x1d7)||_0x4ab75b[_0x4110cb(0x1da)]==='jsonl')await handleSDKOutput(_0x15b403,_0x4ab75b);else{if(_0x15b403['length']===0x0)_0x2dcb40?console[_0x4110cb(0x237)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2dcb40):console[_0x4110cb(0x237)](_0x4110cb(0x25d));else for(const _0x44b46d of _0x15b403){const _0x1d29a2=_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x19f)]?a29_0x3b8643[_0x4110cb(0x1d2)]('\x20('+formatRows(_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x19f)])+')'):'';console[_0x4110cb(0x237)](_0x4110cb(0x18a)+_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x267)]+_0x1d29a2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x23e);[a29_0x3f507c(0x15d)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x3fdcad){const _0x2c71ca=a29_0x3f507c,{options:_0x585da6,args:_0x1537d2,tdx:_0x561542}=_0x3fdcad;console[_0x2c71ca(0x1ec)](_0x2c71ca(0x169)+_0x2c71ca(0x253)+_0x2c71ca(0x254));const _0x4e71c7=_0x585da6;if(_0x1537d2['length']===0x0)return console[_0x2c71ca(0x1ec)](a29_0x3b8643[_0x2c71ca(0x1f6)](_0x2c71ca(0x1a1))),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x257)),0x1;const _0x326057=_0x1537d2[0x0];if(!_0x4e71c7[_0x2c71ca(0x1c4)]||!_0x4e71c7['table'])return console[_0x2c71ca(0x1ec)](_0x2c71ca(0x1bc)),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x257)),0x1;_0x4e71c7[_0x2c71ca(0x21c)]&&(console['error']('Site:\x20'+_0x4e71c7['site']),console[_0x2c71ca(0x1ec)]('Name:\x20'+_0x326057),console['error'](_0x2c71ca(0x16b)+_0x4e71c7[_0x2c71ca(0x1c4)]),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x236)+_0x4e71c7[_0x2c71ca(0x177)]));const _0x56651b=await loadJSONFromOptions(_0x4e71c7['attributes'],_0x4e71c7[_0x2c71ca(0x1d3)]),_0x3cff11=await loadJSONFromOptions(_0x4e71c7[_0x2c71ca(0x1e8)],_0x4e71c7[_0x2c71ca(0x163)]),_0x1e01da=await loadJSONFromOptions(_0x4e71c7['customerGroup'],_0x4e71c7[_0x2c71ca(0x252)]),_0x5803f5={'name':_0x326057,'description':_0x4e71c7[_0x2c71ca(0x15d)],'scheduleType':_0x4e71c7[_0x2c71ca(0x14f)],'scheduleOption':_0x4e71c7['scheduleOption'],'timezone':_0x4e71c7[_0x2c71ca(0x173)],'master':{'parentDatabaseName':_0x4e71c7[_0x2c71ca(0x1c4)],'parentTableName':_0x4e71c7[_0x2c71ca(0x177)]},'attributes':_0x56651b,'behaviors':_0x3cff11,'customerGroup':_0x1e01da},_0x39c60c=await withSpinner(_0x2c71ca(0x197)+_0x326057+_0x2c71ca(0x273),()=>_0x561542[_0x2c71ca(0x245)][_0x2c71ca(0x201)](_0x5803f5),{'verbose':_0x585da6['verbose']}),_0x22973e=_0x39c60c['data'];return console[_0x2c71ca(0x1ec)](_0x2c71ca(0x19d)+_0x22973e[_0x2c71ca(0x267)]+'\x27\x20with\x20ID:\x20'+_0x22973e['id']),await handleSDKOutput([_0x22973e],_0x585da6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x16d);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x156);async[a29_0x3f507c(0x15f)](_0x3c788e){const _0x22cfa4=a29_0x3f507c,{options:_0x475d3b,args:_0x33652d,tdx:_0x20f032}=_0x3c788e;console['error'](_0x22cfa4(0x26d)+_0x22cfa4(0x253)+_0x22cfa4(0x254));const _0x4324c0=_0x475d3b;if(_0x33652d[_0x22cfa4(0x184)]===0x0)return console[_0x22cfa4(0x1ec)](a29_0x3b8643['red'](_0x22cfa4(0x1a1))),console[_0x22cfa4(0x1ec)](_0x22cfa4(0x215)),0x1;const _0x49730a=_0x33652d[0x0];_0x4324c0[_0x22cfa4(0x21c)]&&(console['error']('Site:\x20'+_0x4324c0[_0x22cfa4(0x1e3)]),console[_0x22cfa4(0x1ec)](_0x22cfa4(0x19c)+_0x49730a));const _0x298792=await withSpinner(_0x22cfa4(0x15e)+_0x49730a+_0x22cfa4(0x273),()=>_0x20f032['segment'][_0x22cfa4(0x1b7)](_0x49730a),{'verbose':_0x4324c0[_0x22cfa4(0x21c)]}),_0x230150=_0x298792[_0x22cfa4(0x21e)],_0x41c457=await loadJSONFromOptions(_0x4324c0[_0x22cfa4(0x25c)],_0x4324c0[_0x22cfa4(0x24b)]),_0x1cb62c=await loadJSONFromOptions(_0x4324c0[_0x22cfa4(0x1cd)],_0x4324c0[_0x22cfa4(0x231)]),_0x19997d={'name':_0x230150['name'],'description':_0x4324c0[_0x22cfa4(0x15d)]!==undefined?_0x4324c0[_0x22cfa4(0x15d)]:_0x230150[_0x22cfa4(0x15d)],'scheduleType':_0x4324c0[_0x22cfa4(0x14f)]!==undefined?_0x4324c0[_0x22cfa4(0x14f)]:_0x230150[_0x22cfa4(0x14f)],'scheduleOption':_0x4324c0['scheduleOption']!==undefined?_0x4324c0[_0x22cfa4(0x1cf)]:_0x230150['scheduleOption'],'timezone':_0x4324c0[_0x22cfa4(0x173)]!==undefined?_0x4324c0[_0x22cfa4(0x173)]:_0x230150[_0x22cfa4(0x173)],'master':_0x230150[_0x22cfa4(0x206)],'attributes':_0x41c457?[..._0x230150['attributes']||[],..._0x41c457]:_0x230150['attributes'],'behaviors':_0x1cb62c?[..._0x230150[_0x22cfa4(0x1e8)]||[],..._0x1cb62c]:_0x230150[_0x22cfa4(0x1e8)],'customerGroup':_0x230150[_0x22cfa4(0x1ab)]},_0x4c2367=await withSpinner(_0x22cfa4(0x1f4)+_0x49730a+_0x22cfa4(0x273),()=>_0x20f032[_0x22cfa4(0x245)]['updateParent'](_0x49730a,_0x19997d),{'verbose':_0x4324c0['verbose']}),_0x545bf3=_0x4c2367[_0x22cfa4(0x21e)];return console[_0x22cfa4(0x1ec)](_0x22cfa4(0x188)+_0x545bf3[_0x22cfa4(0x267)]+'\x27'),await handleSDKOutput([_0x545bf3],_0x4324c0),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x3f507c(0x267)]='segment:parent:pull';['description']=a29_0x3f507c(0x1ff);async[a29_0x3f507c(0x15f)](_0x25bc8a){const _0x38369c=a29_0x3f507c,{options:_0x55ce1a,args:_0x5df63b,tdx:_0x4870ac}=_0x25bc8a,_0x134889=_0x55ce1a,_0x3b08b8=_0x5df63b[0x0]||_0x55ce1a['parentSegment'];if(!_0x3b08b8)return showParentSegmentNotSetError(_0x38369c(0x187)+_0x38369c(0x1a0)),0x1;if(_0x134889[_0x38369c(0x161)]&&_0x134889[_0x38369c(0x194)])return console[_0x38369c(0x1ec)](a29_0x3b8643['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x38369c(0x1ec)](a29_0x3b8643['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x1d2)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x38369c(0x1b2))),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x247)](_0x38369c(0x151))),0x1;const _0x1b6249=_0x134889['output']||a29_0x367ebb['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3b08b8)+'.yml');_0x134889[_0x38369c(0x21c)]&&(console[_0x38369c(0x1ec)]('Site:\x20'+_0x134889[_0x38369c(0x1e3)]),console['error'](_0x38369c(0x19c)+_0x3b08b8),console[_0x38369c(0x1ec)](_0x38369c(0x230)+_0x1b6249));const _0x43eca8=await withSpinner(_0x38369c(0x256)+_0x3b08b8+_0x38369c(0x273),()=>_0x4870ac[_0x38369c(0x245)][_0x38369c(0x1c6)](_0x3b08b8),{'verbose':_0x134889[_0x38369c(0x21c)]}),_0x5c369f=_0x43eca8[_0x38369c(0x21e)];if(existsSync(_0x1b6249)){const _0x3924dd=readFileSync(_0x1b6249,_0x38369c(0x244)),_0x39ef2c=generateDiff(_0x3924dd,_0x5c369f);if(!hasChanges(_0x39ef2c))console[_0x38369c(0x1ec)](a29_0x3b8643['green']('✔')+_0x38369c(0x1a7)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249)+_0x38369c(0x1fc));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x1b6249+'\x27:'),console[_0x38369c(0x1ec)]('─'[_0x38369c(0x174)](0x3c)),console['error'](formatDiffWithColors(_0x39ef2c)),console[_0x38369c(0x1ec)]('─'['repeat'](0x3c));if(!_0x134889[_0x38369c(0x1db)]){const _0x47f70b=await confirmKey('Overwrite\x20\x27'+_0x1b6249+'\x27?');if(!_0x47f70b)return console[_0x38369c(0x1ec)](_0x38369c(0x180)),0x1;}writeFileSync(_0x1b6249,_0x5c369f,_0x38369c(0x244)),console[_0x38369c(0x1ec)](a29_0x3b8643['green']('✔')+_0x38369c(0x1f0)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249));}}else{const _0x1794ee=a29_0x367ebb[_0x38369c(0x1fb)](_0x1b6249);!existsSync(_0x1794ee)&&mkdirSync(_0x1794ee,{'recursive':!![]}),writeFileSync(_0x1b6249,_0x5c369f,_0x38369c(0x244)),console['error'](a29_0x3b8643[_0x38369c(0x1c1)]('✔')+_0x38369c(0x1f0)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249));}return saveSessionContext({'parent_segment':_0x3b08b8},_0x134889[_0x38369c(0x26c)]),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x1c1)]('✔')+_0x38369c(0x221)+a29_0x3b8643[_0x38369c(0x1d2)](_0x38369c(0x272))+_0x38369c(0x1c3)+a29_0x3b8643[_0x38369c(0x247)](_0x3b08b8)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']='segment:parent:push';[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1b1);async[a29_0x3f507c(0x15f)](_0xdb9768){const _0x3e3709=a29_0x3f507c,{options:_0x22f0d9,args:_0x43cf59,tdx:_0x3c602a}=_0xdb9768,_0x335862=_0x22f0d9,_0x327ba2=_0x43cf59[0x0]||_0x22f0d9[_0x3e3709(0x1af)];if(!_0x327ba2)return showParentSegmentNotSetError(_0x3e3709(0x264)+_0x3e3709(0x223)),0x1;const _0x3c26e1=resolveYamlFile(_0x327ba2);if(!existsSync(_0x3c26e1))return showFileNotFoundError(_0x3c26e1,_0x327ba2),0x1;_0x335862[_0x3e3709(0x21c)]&&(console[_0x3e3709(0x1ec)](_0x3e3709(0x1a8)+_0x335862[_0x3e3709(0x1e3)]),console[_0x3e3709(0x1ec)](_0x3e3709(0x23b)+_0x3c26e1));let _0x4bb8f0;try{_0x4bb8f0=readFileSync(_0x3c26e1,_0x3e3709(0x244));}catch(_0x210ddb){const _0x5159ed=_0x210ddb instanceof Error?_0x210ddb[_0x3e3709(0x20e)]:String(_0x210ddb);return console[_0x3e3709(0x1ec)]('Error\x20reading\x20file:\x20'+_0x5159ed),0x1;}const _0x4e38df=await withSpinner('Analyzing\x20changes...',()=>_0x3c602a[_0x3e3709(0x245)]['pushParentYaml'](_0x4bb8f0),{'verbose':_0x335862['verbose']}),_0x1439a8=_0x4e38df[_0x3e3709(0x21e)],{isNew:_0x197dfe,name:_0x20958a,hasChanges:_0x5d3587,diffFormatted:_0x3147ee}=_0x1439a8;if(!_0x5d3587)return console[_0x3e3709(0x1ec)]('✔\x20No\x20changes\x20-\x20\x27'+_0x20958a+_0x3e3709(0x19e)),0x0;_0x197dfe?console[_0x3e3709(0x1ec)](_0x3e3709(0x168)+_0x20958a+'\x27:'):console[_0x3e3709(0x1ec)](_0x3e3709(0x152)+_0x20958a+'\x27:');console[_0x3e3709(0x1ec)]('─'[_0x3e3709(0x174)](0x3c)),console[_0x3e3709(0x1ec)](_0x3147ee),console[_0x3e3709(0x1ec)]('─'['repeat'](0x3c));const _0x44fbe5=_0x197dfe?'Create\x20parent\x20segment\x20\x27'+_0x20958a+'\x27?':_0x3e3709(0x1c5)+_0x20958a+'\x27?';if(!_0x335862[_0x3e3709(0x1db)]){const _0x2d3f22=await confirmKey(_0x44fbe5);if(!_0x2d3f22)return console[_0x3e3709(0x1ec)](_0x3e3709(0x180)),0x1;}const _0xceb8bd=_0x197dfe?_0x3e3709(0x238):_0x3e3709(0x216),_0x2b34fc=await withSpinner(_0xceb8bd+_0x3e3709(0x1a5)+_0x20958a+_0x3e3709(0x273),()=>_0x1439a8[_0x3e3709(0x234)](),{'verbose':_0x335862[_0x3e3709(0x21c)]}),_0x4c5617=_0x2b34fc[_0x3e3709(0x21e)],_0x25facf=getConsoleNextUrl(_0x335862[_0x3e3709(0x1e3)],_0x3e3709(0x22f)+_0x4c5617['id']),_0x267159=_0x197dfe?_0x3e3709(0x220):_0x3e3709(0x1f2);return console[_0x3e3709(0x1ec)]('✔\x20'+_0x267159+_0x3e3709(0x1a5)+_0x4c5617['name']+'\x27'),console['error']('\x20\x20'+_0x25facf),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a29_0x3f507c(0x1ee);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x17a);async[a29_0x3f507c(0x15f)](_0x557cdc){const _0x1bd1ed=a29_0x3f507c,{options:_0x1ba551,args:_0x117ec0,tdx:_0x3d6996}=_0x557cdc,_0x2764c9=_0x1ba551,_0x1a6177=_0x117ec0[0x0]||_0x1ba551[_0x1bd1ed(0x1af)];if(!_0x1a6177)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x1bd1ed(0x228)+_0x1bd1ed(0x1ed)+_0x1bd1ed(0x157)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x24deb6=resolveYamlFile(_0x1a6177);if(!existsSync(_0x24deb6))return showFileNotFoundError(_0x24deb6,_0x1a6177),0x1;_0x2764c9[_0x1bd1ed(0x21c)]&&(console['error'](_0x1bd1ed(0x1a8)+_0x2764c9[_0x1bd1ed(0x1e3)]),console[_0x1bd1ed(0x1ec)](_0x1bd1ed(0x23b)+_0x24deb6));let _0x134c29;try{_0x134c29=readFileSync(_0x24deb6,_0x1bd1ed(0x244));}catch(_0x2e9b29){const _0x196e0e=_0x2e9b29 instanceof Error?_0x2e9b29[_0x1bd1ed(0x20e)]:String(_0x2e9b29);return console[_0x1bd1ed(0x1ec)](_0x1bd1ed(0x191)+_0x196e0e),0x1;}const _0x280dd4=createCommandSpinner(a29_0x3b8643[_0x1bd1ed(0x1d2)](_0x1bd1ed(0x1ef)),{'verbose':_0x2764c9[_0x1bd1ed(0x21c)]});_0x280dd4[_0x1bd1ed(0x1f8)]();const _0x31b447={'onProgress':_0x43898e=>{_0x280dd4['text']=formatProgressMessage(_0x43898e);}};if(_0x2764c9[_0x1bd1ed(0x206)])_0x31b447[_0x1bd1ed(0x206)]=!![];if(_0x2764c9[_0x1bd1ed(0x266)])_0x31b447['enriched']=!![];_0x2764c9[_0x1bd1ed(0x251)]&&(_0x31b447[_0x1bd1ed(0x251)]=_0x2764c9['attribute']);_0x2764c9[_0x1bd1ed(0x269)]&&(_0x31b447[_0x1bd1ed(0x269)]=_0x2764c9[_0x1bd1ed(0x269)]);if(_0x2764c9[_0x1bd1ed(0x16e)])_0x31b447['interval']=_0x2764c9[_0x1bd1ed(0x16e)];let _0x502e80;try{_0x502e80=await _0x3d6996[_0x1bd1ed(0x245)][_0x1bd1ed(0x21a)](_0x134c29,_0x31b447),_0x280dd4['stop']();}catch(_0x3bd757){_0x280dd4[_0x1bd1ed(0x20a)]();throw _0x3bd757;}const _0x34c197=_0x2764c9[_0x1bd1ed(0x16e)]||_0x1bd1ed(0x1e4);return this['displayValidateResults'](_0x502e80,_0x31b447,_0x24deb6,_0x34c197),_0x502e80[_0x1bd1ed(0x179)]?0x0:0x1;}['displayValidateResults'](_0x1e66c6,_0x9f8f06,_0x20a58b,_0x2141c7){const _0x24dd6a=a29_0x3f507c;console[_0x24dd6a(0x1ec)]('\x0a'+a29_0x3b8643[_0x24dd6a(0x249)](_0x24dd6a(0x1eb))+'\x20'+_0x1e66c6['name']),console['error']('═'[_0x24dd6a(0x174)](0x3c)),this['displayMasterInfo'](_0x1e66c6);if(typeof _0x9f8f06['attribute']===_0x24dd6a(0x233)){this[_0x24dd6a(0x1a4)](_0x1e66c6),this['displaySummary'](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x251),_0x9f8f06['attribute']);return;}if(_0x9f8f06[_0x24dd6a(0x251)]===!![]){this[_0x24dd6a(0x1a4)](_0x1e66c6),this[_0x24dd6a(0x268)](_0x1e66c6),this['displayPreviewHints'](_0x20a58b,_0x2141c7,_0x24dd6a(0x1a2));return;}if(typeof _0x9f8f06[_0x24dd6a(0x269)]===_0x24dd6a(0x233)){this[_0x24dd6a(0x175)](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x269),_0x9f8f06[_0x24dd6a(0x269)]);return;}if(_0x9f8f06[_0x24dd6a(0x269)]===!![]){this['displayBehaviorsStats'](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x1e8));return;}this[_0x24dd6a(0x1a4)](_0x1e66c6),this['displayBehaviorsStats'](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x22e));}['displayPreviewHints'](_0x29a27c,_0x333916,_0x3cadfa,_0x569773){const _0x1bb374=a29_0x3f507c;console[_0x1bb374(0x1ec)]('\x0a'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x224)));const _0x5ae5af=_0x333916!=='-1d'?_0x1bb374(0x25b)+_0x333916:'';if(_0x3cadfa===_0x1bb374(0x251)&&_0x569773)console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+_0x1bb374(0x22d)+_0x569773+'\x22'+_0x5ae5af));else{if(_0x3cadfa===_0x1bb374(0x269)&&_0x569773)console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+'\x20--behavior\x20\x22'+_0x569773+'\x22'+_0x5ae5af));else(_0x3cadfa===_0x1bb374(0x1a2)||_0x3cadfa===_0x1bb374(0x22e))&&console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)]('tdx\x20segment\x20parent\x20preview\x20'+_0x29a27c+'\x20--attribute\x20\x22<name>\x22'+_0x5ae5af));}(_0x3cadfa===_0x1bb374(0x1e8)||_0x3cadfa===_0x1bb374(0x22e))&&console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+_0x1bb374(0x1bf)+_0x5ae5af)),_0x3cadfa==='all'&&console['error']('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+'\x20--enriched'+_0x5ae5af));}[a29_0x3f507c(0x226)](_0xd20de9){const _0x20f621=a29_0x3f507c,{master:_0x2e0096}=_0xd20de9,_0x265173=_0x2e0096[_0x20f621(0x26f)]?a29_0x3b8643['green']('✔'):a29_0x3b8643['red']('✘');console[_0x20f621(0x1ec)]('\x0a'+a29_0x3b8643[_0x20f621(0x1d2)](_0x20f621(0x19a))),console['error'](_0x265173+'\x20'+a29_0x3b8643[_0x20f621(0x249)](_0x2e0096[_0x20f621(0x1c4)]+'.'+_0x2e0096[_0x20f621(0x177)])),_0x2e0096['schemaValid']?_0x2e0096[_0x20f621(0x1ba)]!==undefined&&console[_0x20f621(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x20f621(0x1d2)](_0x20f621(0x172))+'\x20'+a29_0x3b8643[_0x20f621(0x247)](formatRows(_0x2e0096['rowCount']))):console[_0x20f621(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x20f621(0x1f6)]('Error:')+'\x20'+_0x2e0096[_0x20f621(0x1f7)]);}[a29_0x3f507c(0x1a4)](_0x5bb34f){const _0x1e9f02=a29_0x3f507c;if(_0x5bb34f['attributes']['length']===0x0)return;console[_0x1e9f02(0x1ec)]('\x0a'+a29_0x3b8643['dim'](_0x1e9f02(0x154)));for(const _0x3a4971 of _0x5bb34f[_0x1e9f02(0x1a2)]){const _0x6b869f=_0x3a4971['schemaValid']?a29_0x3b8643[_0x1e9f02(0x1c1)]('✔'):a29_0x3b8643[_0x1e9f02(0x1f6)]('✘');let _0x11eb80='';if(_0x3a4971[_0x1e9f02(0x26f)]&&_0x3a4971['matchedCount']!==undefined&&_0x3a4971[_0x1e9f02(0x25e)]!==undefined){const _0x2f988f=_0x3a4971[_0x1e9f02(0x25e)]['toFixed'](0x1),_0x5c35f2=_0x3a4971[_0x1e9f02(0x25e)]>=0x50?a29_0x3b8643['green']:_0x3a4971[_0x1e9f02(0x25e)]>=0x32?a29_0x3b8643[_0x1e9f02(0x24f)]:a29_0x3b8643[_0x1e9f02(0x1f6)];_0x11eb80='\x20'+a29_0x3b8643[_0x1e9f02(0x1d2)]('Coverage:')+'\x20'+_0x5c35f2(_0x2f988f+'%')+'\x20('+formatRows(_0x3a4971[_0x1e9f02(0x1d9)])+_0x1e9f02(0x25f);}console[_0x1e9f02(0x1ec)](_0x6b869f+'\x20'+a29_0x3b8643['bold'](_0x3a4971[_0x1e9f02(0x267)])+_0x11eb80),console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643['dim'](_0x1e9f02(0x200))+'\x20'+a29_0x3b8643[_0x1e9f02(0x249)](_0x3a4971[_0x1e9f02(0x1c4)]+'.'+_0x3a4971[_0x1e9f02(0x177)]));const _0x7217c8=_0x3a4971[_0x1e9f02(0x1ad)]===_0x3a4971[_0x1e9f02(0x20c)]?a29_0x3b8643[_0x1e9f02(0x1d2)](_0x1e9f02(0x1d6))+'\x20'+_0x3a4971[_0x1e9f02(0x1ad)]:a29_0x3b8643[_0x1e9f02(0x1d2)]('Join:')+'\x20'+_0x3a4971[_0x1e9f02(0x1ad)]+'\x20=\x20'+_0x3a4971[_0x1e9f02(0x20c)];console[_0x1e9f02(0x1ec)]('\x20\x20'+_0x7217c8),console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643['dim'](_0x1e9f02(0x22a))),this['displayColumns'](_0x3a4971[_0x1e9f02(0x159)]),!_0x3a4971[_0x1e9f02(0x26f)]&&console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1e9f02(0x1f6)](_0x1e9f02(0x1a3))+'\x20'+_0x3a4971[_0x1e9f02(0x1f7)]);}}['displayBehaviorsStats'](_0x5234d9,_0x1c8b6b){const _0x57611=a29_0x3f507c;if(_0x5234d9[_0x57611(0x1e8)][_0x57611(0x184)]===0x0)return;console['error']('\x0a'+a29_0x3b8643[_0x57611(0x1d2)]('Behaviors')+'\x20'+a29_0x3b8643[_0x57611(0x1d2)]('('+_0x1c8b6b+')'));for(const _0x4cdc9c of _0x5234d9['behaviors']){const _0x16eb19=_0x4cdc9c[_0x57611(0x26f)]?a29_0x3b8643[_0x57611(0x1c1)]('✔'):a29_0x3b8643['red']('✘');let _0x5320bc='';if(_0x4cdc9c['schemaValid']&&_0x4cdc9c[_0x57611(0x1d5)]!==undefined&&_0x4cdc9c['totalEvents']!==undefined){const _0x11a26d=_0x4cdc9c[_0x57611(0x25a)]?.[_0x57611(0x190)](0x1)||'?',_0x3afeaa=(_0x4cdc9c['customerPercent']??0x0)>=0x32?a29_0x3b8643[_0x57611(0x1c1)]:(_0x4cdc9c[_0x57611(0x25a)]??0x0)>=0x14?a29_0x3b8643[_0x57611(0x24f)]:a29_0x3b8643[_0x57611(0x1f6)];_0x5320bc='\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x18d))+'\x20'+_0x3afeaa(formatRows(_0x4cdc9c[_0x57611(0x1d5)]))+'\x20('+_0x11a26d+_0x57611(0x1df)+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x1be))+'\x20'+a29_0x3b8643[_0x57611(0x247)](formatRows(_0x4cdc9c[_0x57611(0x255)]));}console['error'](_0x16eb19+'\x20'+a29_0x3b8643[_0x57611(0x249)](_0x4cdc9c[_0x57611(0x267)])+_0x5320bc),console[_0x57611(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x200))+'\x20'+a29_0x3b8643[_0x57611(0x249)](_0x4cdc9c[_0x57611(0x1c4)]+'.'+_0x4cdc9c[_0x57611(0x177)]));const _0x40a83f=_0x4cdc9c[_0x57611(0x1ad)]===_0x4cdc9c['foreignKey']?a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x1d6))+'\x20'+_0x4cdc9c[_0x57611(0x1ad)]:a29_0x3b8643[_0x57611(0x1d2)]('Join:')+'\x20'+_0x4cdc9c[_0x57611(0x1ad)]+_0x57611(0x1c3)+_0x4cdc9c[_0x57611(0x20c)];console[_0x57611(0x1ec)]('\x20\x20'+_0x40a83f),console[_0x57611(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x22a))),this[_0x57611(0x243)](_0x4cdc9c[_0x57611(0x159)]),!_0x4cdc9c['schemaValid']&&console['error']('\x20\x20'+a29_0x3b8643['red'](_0x57611(0x1a3))+'\x20'+_0x4cdc9c['schemaError']);}}[a29_0x3f507c(0x243)](_0x164afc){const _0x590880=a29_0x3f507c;for(const _0x16425d of _0x164afc){_0x16425d[_0x590880(0x26a)]===_0x16425d[_0x590880(0x1dd)]||_0x16425d[_0x590880(0x1dd)]==='*'?console['error'](_0x590880(0x240)+_0x16425d[_0x590880(0x26a)]):console[_0x590880(0x1ec)]('\x20\x20\x20\x20-\x20'+_0x16425d['label']+'\x20'+a29_0x3b8643['dim']('('+_0x16425d[_0x590880(0x1dd)]+')'));}}[a29_0x3f507c(0x268)](_0x41b1e5){const _0x3e9e89=a29_0x3f507c;console[_0x3e9e89(0x1ec)]('─'[_0x3e9e89(0x174)](0x3c));if(_0x41b1e5[_0x3e9e89(0x165)][_0x3e9e89(0x184)]>0x0){console[_0x3e9e89(0x1ec)]('\x0a'+a29_0x3b8643['red'](_0x3e9e89(0x1e9)));for(const _0x423457 of _0x41b1e5['errors']){console[_0x3e9e89(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x3e9e89(0x1f6)]('•')+'\x20'+_0x423457);}}_0x41b1e5[_0x3e9e89(0x179)]&&console[_0x3e9e89(0x1ec)]('\x0a'+a29_0x3b8643[_0x3e9e89(0x1c1)]('✔')+_0x3e9e89(0x18e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x24d);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x26e);async[a29_0x3f507c(0x15f)](_0xa0bb46){const _0x974768=a29_0x3f507c,{options:_0x5ad6b4,args:_0x5fbb1b,tdx:_0x11b927}=_0xa0bb46,_0x5e2d81=_0x5ad6b4,_0x3f4855=_0x5fbb1b[0x0]||_0x5ad6b4['parentSegment'];if(!_0x3f4855)return showParentSegmentNotSetError(_0x974768(0x204)+_0x974768(0x164)+'Options\x20(one\x20required):\x0a'+'\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'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x974768(0x158)),0x1;if(!_0x5e2d81[_0x974768(0x206)]&&!_0x5e2d81['attribute']&&!_0x5e2d81[_0x974768(0x269)]&&!_0x5e2d81[_0x974768(0x266)])return console[_0x974768(0x1ec)](a29_0x3b8643['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x974768(0x21f)),console[_0x974768(0x1ec)](_0x974768(0x1d0)),console[_0x974768(0x1ec)](_0x974768(0x263)),console[_0x974768(0x1ec)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x974768(0x1ec)](_0x974768(0x271)),console[_0x974768(0x1ec)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3af7bc=resolveYamlFile(_0x3f4855);if(!existsSync(_0x3af7bc))return showFileNotFoundError(_0x3af7bc,_0x3f4855),0x1;_0x5e2d81['verbose']&&(console['error'](_0x974768(0x1a8)+_0x5e2d81[_0x974768(0x1e3)]),console[_0x974768(0x1ec)](_0x974768(0x23b)+_0x3af7bc));let _0x277a7b;try{_0x277a7b=readFileSync(_0x3af7bc,_0x974768(0x244));}catch(_0x339f14){const _0x4272bd=_0x339f14 instanceof Error?_0x339f14[_0x974768(0x20e)]:String(_0x339f14);return console[_0x974768(0x1ec)](_0x974768(0x191)+_0x4272bd),0x1;}let _0x25831d;try{_0x25831d=parseYamlString(_0x277a7b);}catch(_0x15d328){const _0x4f63cd=_0x15d328 instanceof Error?_0x15d328[_0x974768(0x20e)]:String(_0x15d328);return console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)](_0x974768(0x260)+_0x4f63cd)),0x1;}if(_0x5e2d81['attribute']===!![]||_0x5e2d81['attribute']===''){const _0x43381d=_0x25831d[_0x974768(0x1a2)]?.[_0x974768(0x14d)](_0x23ef6d=>_0x23ef6d['name'])||[];if(_0x43381d[_0x974768(0x184)]===0x0)console['error'](a29_0x3b8643['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)](_0x974768(0x198))),console['error'](_0x974768(0x1f3));for(const _0x494cc5 of _0x43381d){console[_0x974768(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x974768(0x247)](_0x494cc5));}console[_0x974768(0x1ec)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3f4855+_0x974768(0x22d)+_0x43381d[0x0]+'\x22');}return 0x1;}if(_0x5e2d81[_0x974768(0x269)]===!![]||_0x5e2d81[_0x974768(0x269)]===''){const _0x44bd58=_0x25831d[_0x974768(0x1e8)]?.['map'](_0x45313b=>_0x45313b[_0x974768(0x267)])||[];if(_0x44bd58[_0x974768(0x184)]===0x0)console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x974768(0x1ec)](a29_0x3b8643['red'](_0x974768(0x167))),console[_0x974768(0x1ec)]('Available\x20behaviors:');for(const _0x358d8b of _0x44bd58){console[_0x974768(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x974768(0x247)](_0x358d8b));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3f4855+_0x974768(0x219)+_0x44bd58[0x0]+'\x22');}return 0x1;}const _0x27ffec=createCommandSpinner(a29_0x3b8643['dim'](_0x974768(0x16c)),{'verbose':_0x5e2d81['verbose']});_0x27ffec[_0x974768(0x1f8)]();const _0x2d00d2={'onProgress':_0x50d12a=>{const _0x4ff55b=_0x974768;_0x27ffec[_0x4ff55b(0x17f)]=formatProgressMessage(_0x50d12a);}};if(_0x5e2d81[_0x974768(0x206)])_0x2d00d2[_0x974768(0x206)]=!![];if(_0x5e2d81[_0x974768(0x251)]&&typeof _0x5e2d81[_0x974768(0x251)]===_0x974768(0x233))_0x2d00d2[_0x974768(0x251)]=_0x5e2d81[_0x974768(0x251)];if(_0x5e2d81['behavior']&&typeof _0x5e2d81[_0x974768(0x269)]==='string')_0x2d00d2[_0x974768(0x269)]=_0x5e2d81['behavior'];if(_0x5e2d81[_0x974768(0x266)])_0x2d00d2[_0x974768(0x266)]=!![];if(_0x5e2d81['interval'])_0x2d00d2[_0x974768(0x16e)]=_0x5e2d81['interval'];let _0x306e49;try{_0x306e49=await _0x11b927[_0x974768(0x245)]['previewParentYaml'](_0x277a7b,_0x2d00d2),_0x27ffec[_0x974768(0x20a)]();}catch(_0x2f077b){_0x27ffec[_0x974768(0x20a)]();throw _0x2f077b;}return await this['displayPreviewResults'](_0x306e49,{'master':_0x5e2d81[_0x974768(0x206)],'attribute':typeof _0x5e2d81[_0x974768(0x251)]===_0x974768(0x233)?_0x5e2d81[_0x974768(0x251)]:undefined,'behavior':typeof _0x5e2d81[_0x974768(0x269)]==='string'?_0x5e2d81[_0x974768(0x269)]:undefined,'enriched':_0x5e2d81['enriched']}),_0x306e49['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x53ddda,_0x2ce83c){const _0x293b4f=a29_0x3f507c;console[_0x293b4f(0x1ec)]('\x0a'+a29_0x3b8643[_0x293b4f(0x249)](_0x293b4f(0x1d4))+'\x20'+_0x53ddda[_0x293b4f(0x267)]),console[_0x293b4f(0x1ec)]('═'[_0x293b4f(0x174)](0x3c));if(_0x2ce83c[_0x293b4f(0x206)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x3f1a0b=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x178))+'\x20'+a29_0x3b8643[_0x293b4f(0x249)](_0x53ddda[_0x293b4f(0x206)]['database']+'.'+_0x53ddda[_0x293b4f(0x206)][_0x293b4f(0x177)]);await this[_0x293b4f(0x1b9)](_0x3f1a0b,_0x53ddda[_0x293b4f(0x1ea)]);}else{if(_0x2ce83c[_0x293b4f(0x251)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x18d30=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x207))+'\x20'+a29_0x3b8643['bold'](_0x2ce83c['attribute']);await this['displaySampleData'](_0x18d30,_0x53ddda['sampleData']);}else{if(_0x2ce83c['behavior']&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x3888f8=a29_0x3b8643['dim'](_0x293b4f(0x232))+'\x20'+a29_0x3b8643['bold'](_0x2ce83c[_0x293b4f(0x269)]);await this[_0x293b4f(0x1b9)](_0x3888f8,_0x53ddda[_0x293b4f(0x1ea)]);}else{if(_0x2ce83c[_0x293b4f(0x266)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x422936=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x205))+'\x20'+a29_0x3b8643['bold'](_0x293b4f(0x18b));await this[_0x293b4f(0x1b9)](_0x422936,_0x53ddda[_0x293b4f(0x1ea)]);}else!_0x53ddda[_0x293b4f(0x1ea)]&&console[_0x293b4f(0x1ec)](_0x293b4f(0x1f1));}}}if(_0x53ddda[_0x293b4f(0x165)]['length']>0x0){console[_0x293b4f(0x1ec)]('─'[_0x293b4f(0x174)](0x3c)),console[_0x293b4f(0x1ec)]('\x0a'+a29_0x3b8643[_0x293b4f(0x1f6)](_0x293b4f(0x1e9)));for(const _0x1c4864 of _0x53ddda[_0x293b4f(0x165)]){console[_0x293b4f(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x293b4f(0x1f6)]('•')+'\x20'+_0x1c4864);}}}async[a29_0x3f507c(0x1b9)](_0x403954,_0x2a1966){const _0x2b3317=a29_0x3f507c;if(_0x2a1966[_0x2b3317(0x184)]===0x0){console['error']('\x0a'+_0x403954),console[_0x2b3317(0x1ec)](_0x2b3317(0x189));return;}console['error']('\x0a'+_0x403954);const _0x3eb5e0=Object[_0x2b3317(0x193)](_0x2a1966[0x0])[_0x2b3317(0x14d)](_0x55d157=>({'name':_0x55d157,'type':typeof _0x2a1966[0x0][_0x55d157]===_0x2b3317(0x239)?_0x2b3317(0x1c9):_0x2b3317(0x150)})),_0x24ab2b={'queryId':_0x2b3317(0x19b),'columns':_0x3eb5e0,'data':_0x2a1966,'stats':{'state':_0x2b3317(0x23c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2a1966['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x12ab2d=formatAsTable(_0x24ab2b,_0x2a1966[_0x2b3317(0x184)],!![]);await writeOutput(_0x12ab2d,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x192);async['execute'](_0x353853){const _0x104a57=a29_0x3f507c,{options:_0x544bdf,args:_0x27fa23,tdx:_0x18f93c}=_0x353853,_0xcaaed3=_0x544bdf,_0x222813=_0x27fa23[0x0]||_0x544bdf[_0x104a57(0x1af)];if(!_0x222813)return showParentSegmentNotSetError(_0x104a57(0x162)+_0x104a57(0x23a)),0x1;const _0x5c5ebc=resolveYamlFile(_0x222813);if(existsSync(_0x5c5ebc)){_0xcaaed3[_0x104a57(0x21c)]&&console[_0x104a57(0x1ec)](_0x104a57(0x153)+_0x5c5ebc);let _0x1f86f2;try{_0x1f86f2=readFileSync(_0x5c5ebc,'utf-8');}catch(_0x143b02){const _0x2434de=_0x143b02 instanceof Error?_0x143b02[_0x104a57(0x20e)]:String(_0x143b02);return console[_0x104a57(0x1ec)](_0x104a57(0x191)+_0x2434de),0x1;}const _0x4c83f6=await withSpinner('Analyzing\x20changes...',()=>_0x18f93c[_0x104a57(0x245)][_0x104a57(0x17b)](_0x1f86f2),{'verbose':_0xcaaed3[_0x104a57(0x21c)]}),_0x35e9dc=_0x4c83f6[_0x104a57(0x21e)],{isNew:_0x1fdece,name:_0x3ab03c,hasChanges:_0x166487,diffFormatted:_0x1a07e4}=_0x35e9dc;if(_0x166487){_0x1fdece?console[_0x104a57(0x1ec)](_0x104a57(0x168)+_0x3ab03c+'\x27:'):console[_0x104a57(0x1ec)](_0x104a57(0x152)+_0x3ab03c+'\x27:');console[_0x104a57(0x1ec)]('─'[_0x104a57(0x174)](0x3c)),console[_0x104a57(0x1ec)](_0x1a07e4),console['error']('─'[_0x104a57(0x174)](0x3c));const _0xf0b73c=_0x1fdece?_0x104a57(0x209)+_0x3ab03c+_0x104a57(0x24c):_0x104a57(0x1c5)+_0x3ab03c+'\x27\x20and\x20run\x20workflow?';if(!_0xcaaed3[_0x104a57(0x1db)]){const _0x51ba21=await confirmKey(_0xf0b73c);if(!_0x51ba21)return console[_0x104a57(0x1ec)]('Aborted.'),0x1;}const _0x483413=_0x1fdece?_0x104a57(0x238):_0x104a57(0x216);await withSpinner(_0x483413+_0x104a57(0x1a5)+_0x3ab03c+_0x104a57(0x273),()=>_0x35e9dc['apply'](),{'verbose':_0xcaaed3['verbose']});const _0x54a341=_0x1fdece?_0x104a57(0x220):_0x104a57(0x1f2);console[_0x104a57(0x1ec)]('✔\x20'+_0x54a341+_0x104a57(0x1a5)+_0x3ab03c+'\x27');}else console['error'](_0x104a57(0x1b6)+_0x3ab03c+_0x104a57(0x265));}const _0x4af8ca=await withSpinner(_0x104a57(0x15a)+_0x222813+_0x104a57(0x273),()=>_0x18f93c['segment'][_0x104a57(0x22b)](_0x222813),{'verbose':_0xcaaed3['verbose']}),_0x3cb2c1=_0x4af8ca['data'],_0x47f961=getConsoleUrl(_0xcaaed3[_0x104a57(0x1e3)],'/app/workflows/'+_0x3cb2c1[_0x104a57(0x248)]+_0x104a57(0x275)+_0x3cb2c1['workflowSessionId']+_0x104a57(0x258)+_0x3cb2c1['workflowAttemptId']);return console[_0x104a57(0x1ec)](_0x104a57(0x203)),console[_0x104a57(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x17c))+'\x20'+_0x3cb2c1['audienceId']),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)]('Status:')+'\x20'+_0x3cb2c1[_0x104a57(0x16f)]),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x1cb))+'\x20'+_0x3cb2c1['workflowSessionId']),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x211))+'\x20'+_0x3cb2c1[_0x104a57(0x14e)]),console[_0x104a57(0x1ec)]('\x20\x20'+_0x47f961),console[_0x104a57(0x1ec)]('\x0a'+a29_0x3b8643['dim'](_0x104a57(0x276))+'\x20tdx\x20wf\x20attempt\x20'+_0x3cb2c1[_0x104a57(0x14e)]+_0x104a57(0x227)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a29_0x3f507c(0x196);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1fa);async[a29_0x3f507c(0x15f)](_0xb3751b){const _0x5da9a6=a29_0x3f507c,{options:_0x2f1ec3,args:_0x14240f,tdx:_0x3788ba}=_0xb3751b,_0x5c7d97=_0x14240f[0x0]||_0x2f1ec3[_0x5da9a6(0x1af)];if(!_0x5c7d97)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x5da9a6(0x1c8)),0x1;_0x2f1ec3['verbose']&&(console[_0x5da9a6(0x1ec)](_0x5da9a6(0x1a8)+_0x2f1ec3['site']),console[_0x5da9a6(0x1ec)](_0x5da9a6(0x19c)+_0x5c7d97));const _0x5bc697=await withSpinner(_0x5da9a6(0x1ca)+_0x5c7d97+'\x27...',()=>_0x3788ba[_0x5da9a6(0x245)][_0x5da9a6(0x160)](_0x5c7d97),{'verbose':_0x2f1ec3[_0x5da9a6(0x21c)]}),_0x57eb63=_0x5bc697[_0x5da9a6(0x21e)];console[_0x5da9a6(0x1ec)]('✔\x20Found\x20'+_0x57eb63['length']+_0x5da9a6(0x1ae)+(_0x57eb63[_0x5da9a6(0x184)]!==0x1?'s':''));if(_0x2f1ec3[_0x5da9a6(0x1d7)]||_0x2f1ec3[_0x5da9a6(0x1a6)])return await handleSDKOutput(_0x57eb63,_0x2f1ec3),0x0;return displayFieldsHumanReadable(_0x57eb63,_0x5c7d97),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x3f507c(0x1c2);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x20f);async[a29_0x3f507c(0x15f)](_0x1aeb0a){const _0x434f15=a29_0x3f507c,{options:_0x35ad05,args:_0x2aa193,tdx:_0x2dadbc}=_0x1aeb0a,_0x3e31ee=_0x35ad05,_0x2e1601=_0x2aa193[0x0]||_0x35ad05['parentSegment'];if(!_0x2e1601)return showParentSegmentNotSetError(_0x434f15(0x225)+_0x434f15(0x17d)+_0x434f15(0x1ed)+_0x434f15(0x195)),0x1;_0x35ad05['verbose']&&(console[_0x434f15(0x1ec)](_0x434f15(0x1a8)+_0x35ad05[_0x434f15(0x1e3)]),console['error']('Parent\x20segment:\x20'+_0x2e1601));const _0x335c5=await withSpinner(_0x434f15(0x256)+_0x2e1601+'\x27...',()=>_0x2dadbc[_0x434f15(0x245)]['getParentFull'](_0x2e1601),{'verbose':_0x35ad05[_0x434f15(0x21c)]}),_0x1e51b6=_0x335c5[_0x434f15(0x21e)];if(_0x3e31ee[_0x434f15(0x1de)]){const _0x432c18=getConsoleNextUrl(_0x3e31ee[_0x434f15(0x1e3)],_0x434f15(0x22f)+_0x1e51b6['id']);return console['error'](a29_0x3b8643['green']('✔')+_0x434f15(0x24a)+a29_0x3b8643['cyan'](_0x432c18)),openBrowser(_0x432c18),0x0;}return await handleSingleObjectOutput(_0x1e51b6,_0x35ad05),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x24e);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1e2);async[a29_0x3f507c(0x15f)](_0x55edfd){const _0x27269a=a29_0x3f507c,{options:_0x11bf89,args:_0x24de5e,tdx:_0xc8365c}=_0x55edfd,_0x4f2f26=_0x24de5e[0x0]||_0x11bf89[_0x27269a(0x1af)];if(!_0x4f2f26)return showParentSegmentNotSetError(_0x27269a(0x218)+_0x27269a(0x166)),0x1;_0x11bf89[_0x27269a(0x21c)]&&(console[_0x27269a(0x1ec)](_0x27269a(0x1a8)+_0x11bf89['site']),console[_0x27269a(0x1ec)](_0x27269a(0x19c)+_0x4f2f26));const _0x42e474=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4f2f26+_0x27269a(0x273),()=>_0xc8365c[_0x27269a(0x245)][_0x27269a(0x1f9)](_0x4f2f26),{'verbose':_0x11bf89[_0x27269a(0x21c)]}),_0x1a99ed=_0x42e474['data'],_0x5b337e=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4f2f26+_0x27269a(0x273),()=>_0xc8365c[_0x27269a(0x245)]['getParentSQL'](_0x1a99ed),{'verbose':_0x11bf89['verbose']}),_0x57673a=await executeSchemaQuery(_0x5b337e[_0x27269a(0x21e)],_0xc8365c,_0x11bf89);return await handleQueryOutput(_0x57673a,_0x11bf89),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a29_0x3f507c(0x1e0);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1b8);async[a29_0x3f507c(0x15f)](_0x1eb2f9){const _0x3b3b78=a29_0x3f507c,{options:_0x3cafed,args:_0x4bf3cd,tdx:_0x46e019}=_0x1eb2f9,_0x9c9f2c=_0x4bf3cd[0x0]||_0x3cafed[_0x3b3b78(0x1af)];if(!_0x9c9f2c)return showParentSegmentNotSetError(_0x3b3b78(0x259)+_0x3b3b78(0x210)),0x1;_0x3cafed[_0x3b3b78(0x21c)]&&(console['error'](_0x3b3b78(0x1a8)+_0x3cafed[_0x3b3b78(0x1e3)]),console[_0x3b3b78(0x1ec)](_0x3b3b78(0x19c)+_0x9c9f2c));const _0xa5dd9b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x9c9f2c+_0x3b3b78(0x273),()=>_0x46e019[_0x3b3b78(0x245)][_0x3b3b78(0x1f9)](_0x9c9f2c),{'verbose':_0x3cafed[_0x3b3b78(0x21c)]}),_0xc3e843=_0xa5dd9b['data'],_0x1ed49d=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x9c9f2c+_0x3b3b78(0x273),()=>_0x46e019[_0x3b3b78(0x245)][_0x3b3b78(0x23f)](_0xc3e843),{'verbose':_0x3cafed[_0x3b3b78(0x21c)]}),_0x5f3fbb=_0x1ed49d[_0x3b3b78(0x21e)];return _0x3cafed[_0x3b3b78(0x1da)]===_0x3b3b78(0x1d7)||_0x3cafed['format']==='jsonl'?await handleSDKOutput([{'sql':_0x5f3fbb}],_0x3cafed):console[_0x3b3b78(0x237)](_0x5f3fbb),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']='segment:parent:show';['description']=a29_0x3f507c(0x20d);async['execute'](_0xd488b1){const _0x37f422=a29_0x3f507c,{options:_0x5cd969,args:_0x97f371,tdx:_0xd7ed0b}=_0xd488b1,_0x3d8abd=_0x97f371[0x0]||_0x5cd969['parentSegment'];if(!_0x3d8abd)return showParentSegmentNotSetError(_0x37f422(0x261)+_0x37f422(0x1cc)),0x1;_0x5cd969['verbose']&&(console[_0x37f422(0x1ec)]('Site:\x20'+_0x5cd969[_0x37f422(0x1e3)]),console['error']('Parent\x20segment:\x20'+_0x3d8abd));const _0x515ee3=await withSpinner(_0x37f422(0x1e1)+_0x3d8abd+_0x37f422(0x273),()=>_0xd7ed0b[_0x37f422(0x245)][_0x37f422(0x1f9)](_0x3d8abd),{'verbose':_0x5cd969[_0x37f422(0x21c)]}),_0x13e435=_0x515ee3[_0x37f422(0x21e)],_0x3c40d4=await withSpinner(_0x37f422(0x18f)+_0x3d8abd+_0x37f422(0x273),()=>_0xd7ed0b[_0x37f422(0x245)][_0x37f422(0x23f)](_0x13e435),{'verbose':_0x5cd969[_0x37f422(0x21c)]});let _0x5ddce5=_0x3c40d4[_0x37f422(0x21e)];const _0x147a92=resolveLimit(_0x5cd969['limit'],DEFAULT_DISPLAY_LIMIT),_0x54dd9a=/\bLIMIT\s+\d+/i['test'](_0x5ddce5);!_0x54dd9a&&(_0x5ddce5=_0x5ddce5[_0x37f422(0x15b)]()['replace'](/;+$/,''),_0x5ddce5='SELECT\x20*\x20FROM\x20(\x0a'+_0x5ddce5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x147a92);_0x5cd969[_0x37f422(0x21c)]&&console[_0x37f422(0x1ec)](_0x37f422(0x1b5)+_0x5ddce5);const _0x53ec54=await withQuerySpinner(_0x37f422(0x235),async _0xa1c70a=>{const _0x3a7d0c=_0x37f422,_0x1f8795=await _0xd7ed0b[_0x3a7d0c(0x15c)][_0x3a7d0c(0x15f)](_0x5ddce5,{'catalog':'td','schema':'information_schema','onJobId':_0x421652=>{_0xa1c70a['setJobId'](_0x421652);}});return _0x1f8795;},{'verbose':_0x5cd969['verbose']}),_0x42b13e=_0x53ec54[_0x37f422(0x21e)],_0x3c9756=_0x42b13e[_0x37f422(0x1e6)]?'\x20[Job\x20ID:\x20'+_0x42b13e[_0x37f422(0x1e6)]+']':'';return console[_0x37f422(0x1ec)](_0x37f422(0x208)+_0x42b13e[_0x37f422(0x22c)][_0x37f422(0x23d)][_0x37f422(0x1c7)]()+'\x20rows\x20'+(_0x37f422(0x262)+formatElapsed(_0x42b13e[_0x37f422(0x22c)][_0x37f422(0x21b)])+_0x3c9756)),await handleQueryOutput(_0x42b13e,_0x5cd969),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a30_0x58f054=a30_0x5b58;(function(_0x3e4b6a,_0x30ea6d){const _0x23efa8=a30_0x5b58,_0x28fbb0=_0x3e4b6a();while(!![]){try{const _0x4b1d3e=-parseInt(_0x23efa8(0x188))/0x1+parseInt(_0x23efa8(0x193))/0x2*(-parseInt(_0x23efa8(0x19b))/0x3)+parseInt(_0x23efa8(0x189))/0x4+parseInt(_0x23efa8(0x18b))/0x5*(-parseInt(_0x23efa8(0x186))/0x6)+-parseInt(_0x23efa8(0x199))/0x7+parseInt(_0x23efa8(0x18f))/0x8+-parseInt(_0x23efa8(0x18c))/0x9*(-parseInt(_0x23efa8(0x18a))/0xa);if(_0x4b1d3e===_0x30ea6d)break;else _0x28fbb0['push'](_0x28fbb0['shift']());}catch(_0x5dee30){_0x28fbb0['push'](_0x28fbb0['shift']());}}}(a30_0x2012,0x6449b));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';function a30_0x5b58(_0x57375d,_0x16536a){_0x57375d=_0x57375d-0x185;const _0x2012ca=a30_0x2012();let _0x5b585a=_0x2012ca[_0x57375d];return _0x5b585a;}export class ProfilesCommand extends BaseCommand{['name']=a30_0x58f054(0x194);['description']=a30_0x58f054(0x18e);async[a30_0x58f054(0x185)](_0x2cdb99){const _0x5ec2b7=a30_0x58f054,{options:_0x5d03ae}=_0x2cdb99;try{const _0x432973=listProfiles(),_0x136924=getActiveProfile();if(_0x432973['length']===0x0)return console[_0x5ec2b7(0x190)](_0x5ec2b7(0x187)),console[_0x5ec2b7(0x190)](_0x5ec2b7(0x19a)),console['log'](_0x5ec2b7(0x191)),0x0;const _0x5085c7=_0x432973['map'](_0x28b300=>{const _0x44d433=_0x5ec2b7,_0x4cac16=_0x28b300['name']===_0x136924,_0x2278a=getProfileParams(_0x28b300[_0x44d433(0x196)]);return{'name':_0x28b300[_0x44d433(0x18d)],'active':_0x4cac16,'scope':_0x28b300[_0x44d433(0x195)],'description':_0x28b300[_0x44d433(0x196)][_0x44d433(0x19c)]||'','params':_0x2278a};});return await handleSDKOutput(_0x5085c7,_0x5d03ae),0x0;}catch(_0x46b530){return _0x46b530 instanceof Error&&console[_0x5ec2b7(0x198)](_0x5ec2b7(0x197)+_0x46b530[_0x5ec2b7(0x192)]),0x1;}}}function a30_0x2012(){const _0x2281c7=['6mHZvxi','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','231364mAgldT','1790884Ziqvwz','10FzcsKq','1924355MIFVhK','7652259mKlELl','name','List\x20all\x20available\x20profiles','5434104KdhkLA','log','\x20\x20Global:\x20~/.config/tdx/tdx.json','message','1876JOVLcM','profiles','scope','config','Error:\x20','error','4333749DdqJSm','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1059RPBLSU','description','execute'];a30_0x2012=function(){return _0x2281c7;};return a30_0x2012();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x2e2ab0=a31_0x309c;(function(_0x1776a1,_0x2eb371){const _0x1085c9=a31_0x309c,_0x22e9a1=_0x1776a1();while(!![]){try{const _0x402bdb=parseInt(_0x1085c9(0x1a4))/0x1*(parseInt(_0x1085c9(0x1b2))/0x2)+parseInt(_0x1085c9(0x1a8))/0x3*(-parseInt(_0x1085c9(0x193))/0x4)+-parseInt(_0x1085c9(0x1a0))/0x5+-parseInt(_0x1085c9(0x1b7))/0x6+-parseInt(_0x1085c9(0x1b3))/0x7+-parseInt(_0x1085c9(0x1a2))/0x8*(-parseInt(_0x1085c9(0x19f))/0x9)+parseInt(_0x1085c9(0x1a9))/0xa;if(_0x402bdb===_0x2eb371)break;else _0x22e9a1['push'](_0x22e9a1['shift']());}catch(_0xd4a4b2){_0x22e9a1['push'](_0x22e9a1['shift']());}}}(a31_0xa5e1,0xc1a96));import{BaseCommand}from'./command.js';function a31_0x309c(_0x4fba17,_0x277a8c){_0x4fba17=_0x4fba17-0x192;const _0xa5e163=a31_0xa5e1();let _0x309c53=_0xa5e163[_0x4fba17];return _0x309c53;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';function a31_0xa5e1(){const _0x5ed53d=['4853555rSDURa','Query\x20completed:\x20Processed\x20','56PJJEMq','processedRows','1teLCEO','in\x20','\x0aAll\x20results\x20saved\x20to\x20','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','15eNBbep','33556060duLqeX','state','verbose','length','Schema:\x20','Catalog:\x20','...','options','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','779512ZQbOMe','9489396OEBrya','query','data','information_schema','4269666NtiUtp','Executing\x20query\x20[','\x20rows\x20','\x20splits','setExtra','message','Executing\x20statement\x20','Statement\x20','completedSplits','setPhase','name','catalog','execute','543940nDnpcB','error','\x20-\x20','push','output','SQL:\x20','Run\x20Trino\x20queries\x20(streaming)','file','site','description','Executing\x20query...','jobId','984537Nttflz'];a31_0xa5e1=function(){return _0x5ed53d;};return a31_0xa5e1();}import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a31_0x2e2ab0(0x1c1)]=a31_0x2e2ab0(0x1b4);[a31_0x2e2ab0(0x19c)]=a31_0x2e2ab0(0x199);async[a31_0x2e2ab0(0x192)](_0x34f3cd){const _0x2e6720=a31_0x2e2ab0,{options:_0x5727b3,args:_0x3a73f6,tdx:_0x572689}=_0x34f3cd,_0xd0d114=_0x3a73f6[0x0],_0x368af2=_0x5727b3['file'];let _0x125ca1;try{if(_0x368af2)_0x125ca1=readSqlStatementsFromFile(_0x368af2);else{if(_0xd0d114==='-')_0x125ca1=await readSqlStatementsFromStdin();else{if(_0xd0d114&&isSqlFilePath(_0xd0d114))_0x125ca1=readSqlStatementsFromFile(_0xd0d114);else{if(_0xd0d114)_0x125ca1=splitSqlStatements(_0xd0d114);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x1ddd99){return console['error']('Error:\x20'+_0x1ddd99[_0x2e6720(0x1bc)]),0x1;}const _0x3175e9=_0x5727b3['database']||_0x2e6720(0x1b6),_0x13e7ad=_0x5727b3[_0x2e6720(0x1c2)];try{const _0x339d26=[],_0x4c7747=!!_0x5727b3[_0x2e6720(0x197)];for(let _0x1a2381=0x0;_0x1a2381<_0x125ca1[_0x2e6720(0x1ac)];_0x1a2381++){const _0x586c5f=_0x125ca1[_0x1a2381],_0x1f5b3c=_0x1a2381+0x1,_0x22be80=_0x125ca1[_0x2e6720(0x1ac)],_0x580c99=_0x22be80>0x1;_0x5727b3[_0x2e6720(0x1ab)]&&(console[_0x2e6720(0x194)]('\x0a'+(_0x580c99?_0x2e6720(0x1be)+_0x1f5b3c+'/'+_0x22be80+':':'')),console[_0x2e6720(0x194)]('Site:\x20'+_0x5727b3[_0x2e6720(0x19b)]),console[_0x2e6720(0x194)](_0x2e6720(0x1ae)+(_0x13e7ad||'td')),console[_0x2e6720(0x194)](_0x2e6720(0x1ad)+_0x3175e9),console[_0x2e6720(0x194)](_0x2e6720(0x198)+_0x586c5f));const _0x584ee1=_0x580c99?_0x2e6720(0x1bd)+_0x1f5b3c+'/'+_0x22be80+_0x2e6720(0x1af):_0x2e6720(0x19d);try{const _0x5082dd=await withQuerySpinner(_0x584ee1,async _0x49dc35=>{const _0x10e67e=_0x2e6720,_0x4e9e12=await _0x572689[_0x10e67e(0x1b4)][_0x10e67e(0x192)](_0x586c5f,{'catalog':_0x13e7ad,'schema':_0x3175e9,'onJobId':_0x1364e7=>{_0x49dc35['setJobId'](_0x1364e7);},'onProgress':_0x2bd351=>{const _0x418a06=_0x10e67e;_0x49dc35[_0x418a06(0x1c0)](_0x418a06(0x1b8)+_0x2bd351[_0x418a06(0x1aa)]+']'),_0x49dc35[_0x418a06(0x1bb)](formatRows(_0x2bd351[_0x418a06(0x1a3)])+_0x418a06(0x1b9)+_0x2bd351[_0x418a06(0x1bf)]+'/'+_0x2bd351['totalSplits']+_0x418a06(0x1ba));}});return _0x4e9e12;},{'verbose':_0x5727b3[_0x2e6720(0x1ab)]}),_0x22eff3=_0x5082dd[_0x2e6720(0x1b5)],_0x4a20ff=_0x22eff3[_0x2e6720(0x19e)]?'\x20[Job\x20ID:\x20'+_0x22eff3[_0x2e6720(0x19e)]+']':'',_0x35d0c1=_0x580c99?_0x2e6720(0x1be)+_0x1f5b3c+'/'+_0x22be80+_0x2e6720(0x195):'';console['error']('✔\x20'+_0x35d0c1+_0x2e6720(0x1a1)+formatRows(_0x22eff3['stats'][_0x2e6720(0x1a3)])+_0x2e6720(0x1b9)+(_0x2e6720(0x1a5)+formatElapsed(_0x22eff3['stats']['elapsedTimeMillis'])+_0x4a20ff));if(_0x580c99&&_0x4c7747){const _0x1849f3=resolveOutputOptions(_0x5727b3),_0x4e8e2c=await formatQueryOutput(_0x22eff3,_0x1849f3);_0x339d26[_0x2e6720(0x196)](_0x4e8e2c);}else await handleQueryOutput(_0x22eff3,_0x5727b3);}catch(_0x1c852c){const _0x47cafd=_0x580c99?_0x2e6720(0x1be)+_0x1f5b3c+'/'+_0x22be80+':\x0a':'',_0x51c71f=_0x1c852c instanceof SDKError?_0x1c852c['originalMessage']:_0x1c852c[_0x2e6720(0x1bc)];return console[_0x2e6720(0x194)](''+_0x47cafd+_0x51c71f),0x1;}}if(_0x125ca1[_0x2e6720(0x1ac)]>0x1&&_0x4c7747&&_0x339d26['length']>0x0){const _0x2081f4=_0x339d26['join']('\x0a');writeFileSync(_0x5727b3[_0x2e6720(0x197)],_0x2081f4),console[_0x2e6720(0x194)](_0x2e6720(0x1a6)+_0x5727b3[_0x2e6720(0x197)]);}return 0x0;}catch(_0x531b8e){throw _0x531b8e;}}['validate'](_0x3b8dff){const _0x2fb761=a31_0x2e2ab0,_0x55fcc8=_0x3b8dff['args'][0x0],_0xbcd74a=_0x3b8dff[_0x2fb761(0x1b0)][_0x2fb761(0x19a)];if(!_0x55fcc8&&!_0xbcd74a)return _0x2fb761(0x1a7);if(_0x55fcc8&&_0xbcd74a)return _0x2fb761(0x1b1);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_0x2461d7=a32_0x3e09;(function(_0x134d69,_0x1a9542){const _0x3d25eb=a32_0x3e09,_0xe1506c=_0x134d69();while(!![]){try{const _0x3bba6e=parseInt(_0x3d25eb(0x223))/0x1+parseInt(_0x3d25eb(0x1d3))/0x2*(-parseInt(_0x3d25eb(0x230))/0x3)+parseInt(_0x3d25eb(0x1cd))/0x4+parseInt(_0x3d25eb(0x1c3))/0x5*(parseInt(_0x3d25eb(0x1d7))/0x6)+parseInt(_0x3d25eb(0x1cc))/0x7*(-parseInt(_0x3d25eb(0x226))/0x8)+-parseInt(_0x3d25eb(0x20a))/0x9+-parseInt(_0x3d25eb(0x248))/0xa*(-parseInt(_0x3d25eb(0x229))/0xb);if(_0x3bba6e===_0x1a9542)break;else _0xe1506c['push'](_0xe1506c['shift']());}catch(_0x236fbd){_0xe1506c['push'](_0xe1506c['shift']());}}}(a32_0x385c,0x98e58));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a32_0x385c(){const _0x71a3f3=['Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','url','getFolder','parent','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Executing\x20segment\x20query...','toLocaleString','includes','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segmentPath','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20folder\x20\x27','710QoutLc','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segmentId','data','json','Parent\x20segment:\x20','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','site','✔\x20Created\x20folder\x20\x27','/app/ps/','Folder\x20ID:\x20','trim','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Parent\x20segment\x20name\x20is\x20required','folderId','Resolving\x20parent\x20segment\x20\x27','SEGMENT_FOLDER_NOT_FOUND','setJobId','66535hTOPrx','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20or\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','cause','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','folderPath','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','101857LTrDYk','3117260jUATFn','Resolved\x20parent\x20ID:\x20','length','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolved\x20type:\x20','web','30bASSdU','\x20\x20Cause:\x20','Site:\x20','segment:folder:list','198DJBbSC','replace','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','jobId','description','segment:describe','Options:','\x27\x20with\x20ID:\x20','information_schema','parentSegment','Error:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','createFolder','\x20[Job\x20ID:\x20','parentFolder','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','in\x20','Creating\x20folder\x20\x27','Fetching\x20segment\x20details...','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','resolveParentId','resolvePathToResource','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20sql','stats','/e/','(root)','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','log','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20sql\x20<name>','cyan','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','processedRows','execute','code','segment:folder:show','Resolving\x20path\x20\x27','green','Fetching\x20folder\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','folder','6510204jZbolH','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSegment','\x20\x20Parent\x20segment:\x20','segmentName','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\x20list\x20<parent_name>','Examples:','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20reference\x20is\x20required','listFolders','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Show\x20segment\x20folder\x20details','INVALID_ARGUMENT','error','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27...','Resolving\x20\x27','\x20Opening\x20','segment:view','SQL\x20query:\x0a','697808oQQYcD','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Use:\x20tdx\x20ps\x20show','440xygxtC','limit','jsonl','128326XyPpzs','Parent\x20ID:\x20','segment:show','Target\x20path:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20name:\x20','118923BURcDL','Resolved\x20relative\x20path\x20to:\x20','\x20folder','type','message','name','segment:folder:create','segment','resolveFolderId','Error:\x20Path\x20or\x20name\x20is\x20required','verbose','SEGMENT_NOT_FOUND'];a32_0x385c=function(){return _0x71a3f3;};return a32_0x385c();}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a32_0x3e09(_0x1c26fc,_0x13758c){_0x1c26fc=_0x1c26fc-0x1be;const _0x385c58=a32_0x385c();let _0x3e0971=_0x385c58[_0x1c26fc];return _0x3e0971;}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_0x19be70 from'chalk';function resolveSegmentTarget(_0xfc7c3,_0x171b5d,_0x5191b9){const _0x187504=a32_0x3e09;if(isYamlFilePath(_0xfc7c3))try{const _0x1e1a89=resolveYamlFilePath(_0xfc7c3);return _0x5191b9&&(console[_0x187504(0x21c)]('Resolved\x20YAML\x20file:\x20'+_0xfc7c3),console['error'](_0x187504(0x20e)+_0x1e1a89['parentSegment']),console['error'](_0x187504(0x20b)+_0x1e1a89[_0x187504(0x20f)]),console[_0x187504(0x21c)](_0x187504(0x213)+(_0x1e1a89[_0x187504(0x1ca)]||_0x187504(0x1f3))),console[_0x187504(0x21c)]('\x20\x20Full\x20path:\x20'+_0x1e1a89['fullPath'])),_0x1e1a89['fullPath'];}catch(_0x53a25b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x187504(0x1f4)+_0x53a25b[_0x187504(0x234)]);}if(!_0x171b5d)throw new SDKError(ErrorCode[_0x187504(0x21b)],_0x187504(0x210));return _0x171b5d+'/'+_0xfc7c3;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x1dc);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1c6);async[a32_0x2461d7(0x202)](_0x55e982){const _0x2ea0b2=a32_0x2461d7,{options:_0x3a2878,args:_0x3e9e35,tdx:_0x54822d}=_0x55e982,_0x2099c7=_0x3e9e35[0x0],_0x106a8f=!_0x2099c7&&!!_0x3a2878['parentSegment'],_0x216e58=_0x2099c7||_0x3a2878[_0x2ea0b2(0x1e0)];if(!_0x216e58)return console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x239)),console[_0x2ea0b2(0x21c)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x212)),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x200)),console['error'](_0x2ea0b2(0x255)),console[_0x2ea0b2(0x21c)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x2ea0b2(0x1d9)),0x1;try{const _0x4f5542=_0x3a2878[_0x2ea0b2(0x245)];let _0x345cb1=_0x216e58;!_0x106a8f&&_0x4f5542&&!_0x216e58[_0x2ea0b2(0x243)]('/')&&(_0x345cb1=_0x4f5542+'/'+_0x216e58,_0x3a2878['verbose']&&console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x231)+_0x345cb1));const _0x5a4103=await withSpinner(_0x2ea0b2(0x205)+_0x345cb1+_0x2ea0b2(0x21e),()=>_0x54822d[_0x2ea0b2(0x237)][_0x2ea0b2(0x1ed)](_0x345cb1),{'verbose':_0x3a2878['verbose']}),_0x1fa4f3=_0x5a4103[_0x2ea0b2(0x24b)];_0x3a2878[_0x2ea0b2(0x23a)]&&(console[_0x2ea0b2(0x21c)]('Resolved\x20type:\x20'+_0x1fa4f3[_0x2ea0b2(0x233)]),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x22a)+_0x1fa4f3[_0x2ea0b2(0x1ff)]),_0x1fa4f3[_0x2ea0b2(0x1bf)]&&console['error'](_0x2ea0b2(0x253)+_0x1fa4f3[_0x2ea0b2(0x1bf)]),_0x1fa4f3[_0x2ea0b2(0x24a)]&&console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x24e)+_0x1fa4f3[_0x2ea0b2(0x24a)]));if(_0x1fa4f3[_0x2ea0b2(0x233)]===_0x2ea0b2(0x23f)){const _0x592056=await withSpinner(_0x2ea0b2(0x1c5),()=>_0x54822d['segment']['getParent'](_0x1fa4f3[_0x2ea0b2(0x1ff)]),{'verbose':_0x3a2878['verbose']});await handleSingleObjectOutput(_0x592056[_0x2ea0b2(0x24b)],_0x3a2878);}else{if(_0x1fa4f3[_0x2ea0b2(0x233)]==='folder'){if(!_0x1fa4f3[_0x2ea0b2(0x1bf)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x45d846=await withSpinner(_0x2ea0b2(0x207),()=>_0x54822d[_0x2ea0b2(0x237)][_0x2ea0b2(0x23e)](_0x1fa4f3[_0x2ea0b2(0x1bf)]),{'verbose':_0x3a2878[_0x2ea0b2(0x23a)]});await handleSingleObjectOutput(_0x45d846['data'],_0x3a2878);}else{if(_0x1fa4f3[_0x2ea0b2(0x233)]===_0x2ea0b2(0x237)){if(!_0x1fa4f3['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2ea0b2(0x258));const _0x5ec3c0=await withSpinner(_0x2ea0b2(0x1e9),()=>_0x54822d['segment'][_0x2ea0b2(0x20d)](_0x1fa4f3[_0x2ea0b2(0x1ff)],_0x1fa4f3[_0x2ea0b2(0x24a)]),{'verbose':_0x3a2878[_0x2ea0b2(0x23a)]});await handleSingleObjectOutput(_0x5ec3c0['data'],_0x3a2878);}}}return 0x0;}catch(_0x44ff4a){if(_0x44ff4a instanceof SDKError)return console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x1e1)+_0x44ff4a[_0x2ea0b2(0x234)]),_0x44ff4a[_0x2ea0b2(0x1c8)]&&console['error']('\x20\x20Cause:\x20'+_0x44ff4a[_0x2ea0b2(0x1c8)]),0x1;throw _0x44ff4a;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x22b);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1e6);async[a32_0x2461d7(0x202)](_0x3db622){const _0x607e03=a32_0x2461d7,{options:_0x8b5b25,args:_0x35b8ae,tdx:_0x7c21e1}=_0x3db622,_0x24c669=_0x35b8ae[0x0];if(!_0x24c669)return console[_0x607e03(0x21c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x607e03(0x21c)](_0x607e03(0x22d)),console[_0x607e03(0x21c)](_0x607e03(0x1eb)),console[_0x607e03(0x21c)](_0x607e03(0x212)),console[_0x607e03(0x21c)](_0x607e03(0x216)),console['error'](_0x607e03(0x1fe)),0x1;try{const _0x3e9516=_0x8b5b25[_0x607e03(0x1e0)],_0x4123c1=resolveSegmentTarget(_0x24c669,_0x3e9516,_0x8b5b25[_0x607e03(0x23a)]);_0x8b5b25[_0x607e03(0x23a)]&&console[_0x607e03(0x21c)](_0x607e03(0x22c)+_0x4123c1);const _0x5d45dc=await withSpinner('Resolving\x20\x27'+_0x24c669+'\x27...',()=>_0x7c21e1[_0x607e03(0x237)][_0x607e03(0x1ed)](_0x4123c1),{'verbose':_0x8b5b25[_0x607e03(0x23a)]}),_0xcb3bdd=_0x5d45dc['data'];_0x8b5b25[_0x607e03(0x23a)]&&(console[_0x607e03(0x21c)](_0x607e03(0x1d1)+_0xcb3bdd[_0x607e03(0x233)]),console[_0x607e03(0x21c)](_0x607e03(0x22a)+_0xcb3bdd[_0x607e03(0x1ff)]));if(_0xcb3bdd[_0x607e03(0x233)]===_0x607e03(0x209))return console[_0x607e03(0x21c)](_0x607e03(0x1cb)),console[_0x607e03(0x21c)](_0x607e03(0x1f7)),0x1;if(_0xcb3bdd[_0x607e03(0x233)]===_0x607e03(0x23f))return console[_0x607e03(0x21c)](_0x607e03(0x20c)),console[_0x607e03(0x21c)](_0x607e03(0x225)),0x1;if(!_0xcb3bdd[_0x607e03(0x24a)])throw new SDKError(ErrorCode[_0x607e03(0x23b)],_0x607e03(0x258));const _0x1ae8ed=await withSpinner(_0x607e03(0x215),()=>_0x7c21e1['segment'][_0x607e03(0x1ea)](_0xcb3bdd['parentId'],_0xcb3bdd[_0x607e03(0x24a)]),{'verbose':_0x8b5b25['verbose']});let _0x2e7b5a=_0x1ae8ed['data'];const _0x1af1d2=resolveLimit(_0x8b5b25[_0x607e03(0x227)],DEFAULT_DISPLAY_LIMIT),_0x1f9c75=/\bLIMIT\s+\d+/i['test'](_0x2e7b5a);!_0x1f9c75&&(_0x2e7b5a=_0x2e7b5a[_0x607e03(0x254)]()[_0x607e03(0x1d8)](/;+$/,''),_0x2e7b5a='SELECT\x20*\x20FROM\x20(\x0a'+_0x2e7b5a+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1af1d2);_0x8b5b25[_0x607e03(0x23a)]&&console[_0x607e03(0x21c)](_0x607e03(0x222)+_0x2e7b5a);const _0x12e31b=await withQuerySpinner(_0x607e03(0x241),async _0x3448ac=>{const _0x2a6fe8=_0x607e03,_0x5af798=await _0x7c21e1['query']['execute'](_0x2e7b5a,{'catalog':'td','schema':_0x2a6fe8(0x1df),'onJobId':_0x499f3a=>{const _0xfef212=_0x2a6fe8;_0x3448ac[_0xfef212(0x1c2)](_0x499f3a);}});return _0x5af798;},{'verbose':_0x8b5b25[_0x607e03(0x23a)]}),_0x5aa724=_0x12e31b[_0x607e03(0x24b)],_0x578aa7=_0x5aa724[_0x607e03(0x1da)]?_0x607e03(0x1e4)+_0x5aa724['jobId']+']':'';return console[_0x607e03(0x21c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x5aa724[_0x607e03(0x1f1)][_0x607e03(0x201)][_0x607e03(0x242)]()+'\x20rows\x20'+(_0x607e03(0x1e7)+formatElapsed(_0x5aa724[_0x607e03(0x1f1)]['elapsedTimeMillis'])+_0x578aa7)),await handleQueryOutput(_0x5aa724,_0x8b5b25),0x0;}catch(_0x5cac10){if(_0x5cac10 instanceof SDKError)return console[_0x607e03(0x21c)]('✖\x20Query\x20failed\x20['+_0x5cac10[_0x607e03(0x203)]+']'),console[_0x607e03(0x21c)]('\x0a'+_0x5cac10['message']),0x1;throw _0x5cac10;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x1d6);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x22e);async[a32_0x2461d7(0x202)](_0x56b476){const _0x18d300=a32_0x2461d7,{options:_0x1f42c5,args:_0x2231be,tdx:_0x52fbb1}=_0x56b476;if(_0x2231be[_0x18d300(0x1cf)]===0x0)return console[_0x18d300(0x21c)](_0x18d300(0x1be)),console[_0x18d300(0x21c)](_0x18d300(0x211)),0x1;const _0x3003f4=_0x2231be[0x0];try{_0x1f42c5[_0x18d300(0x23a)]&&(console['error'](_0x18d300(0x1d5)+_0x1f42c5[_0x18d300(0x250)]),console['error'](_0x18d300(0x22f)+_0x3003f4));const _0x5c058e=await withSpinner(_0x18d300(0x1c0)+_0x3003f4+_0x18d300(0x21e),()=>_0x52fbb1[_0x18d300(0x237)][_0x18d300(0x1ec)](_0x3003f4),{'verbose':_0x1f42c5['verbose']}),_0x401700=_0x5c058e[_0x18d300(0x24b)];_0x1f42c5[_0x18d300(0x23a)]&&console['error'](_0x18d300(0x1ce)+_0x401700);const _0x154c8f=await withSpinner(_0x18d300(0x1f5)+_0x3003f4+_0x18d300(0x21e),()=>_0x52fbb1[_0x18d300(0x237)][_0x18d300(0x218)](_0x401700),{'verbose':_0x1f42c5[_0x18d300(0x23a)]}),_0x224bae=_0x154c8f['data'];return console['error']('✔\x20Found\x20'+_0x224bae[_0x18d300(0x1cf)]+_0x18d300(0x232)+(_0x224bae[_0x18d300(0x1cf)]!==0x1?'s':'')),await handleSDKOutput(_0x224bae,_0x1f42c5),0x0;}catch(_0xcd0124){if(_0xcd0124 instanceof SDKError)return console[_0x18d300(0x21c)](_0x18d300(0x1e1)+_0xcd0124[_0x18d300(0x234)]),_0xcd0124['cause']&&console[_0x18d300(0x21c)]('\x20\x20Cause:\x20'+_0xcd0124['cause']),0x1;throw _0xcd0124;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a32_0x2461d7(0x204);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x21a);async[a32_0x2461d7(0x202)](_0x37d294){const _0x5641ff=a32_0x2461d7,{options:_0x58a289,args:_0x1d454e,tdx:_0x2601dc}=_0x37d294;if(_0x1d454e['length']===0x0)return console[_0x5641ff(0x21c)](_0x5641ff(0x217)),console['error'](_0x5641ff(0x224)),0x1;try{const {parentId:_0x56ef34,childId:_0x42747b}=parseSegmentRef(_0x1d454e[0x0]);_0x58a289[_0x5641ff(0x23a)]&&(console[_0x5641ff(0x21c)](_0x5641ff(0x1d5)+_0x58a289[_0x5641ff(0x250)]),console[_0x5641ff(0x21c)](_0x5641ff(0x22f)+_0x56ef34),_0x42747b&&console['error']('Folder\x20name:\x20'+_0x42747b));if(!_0x42747b)return console[_0x5641ff(0x21c)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x539ff5=await withSpinner(_0x5641ff(0x1c0)+_0x56ef34+_0x5641ff(0x21e),()=>_0x2601dc['segment']['resolveParentId'](_0x56ef34),{'verbose':_0x58a289[_0x5641ff(0x23a)]}),_0x36b92e=_0x539ff5[_0x5641ff(0x24b)];_0x58a289[_0x5641ff(0x23a)]&&console[_0x5641ff(0x21c)]('Resolved\x20parent\x20ID:\x20'+_0x36b92e);const _0x38c809=await withSpinner('Resolving\x20folder\x20\x27'+_0x42747b+_0x5641ff(0x21e),()=>_0x2601dc['segment'][_0x5641ff(0x238)](_0x36b92e,_0x42747b),{'verbose':_0x58a289[_0x5641ff(0x23a)]}),_0x471aab=_0x38c809[_0x5641ff(0x24b)];_0x58a289[_0x5641ff(0x23a)]&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x471aab);const _0x26ce28=await withSpinner(_0x5641ff(0x247)+_0x42747b+_0x5641ff(0x21e),()=>_0x2601dc['segment'][_0x5641ff(0x23e)](_0x471aab),{'verbose':_0x58a289['verbose']});return await handleSDKOutput([_0x26ce28[_0x5641ff(0x24b)]],_0x58a289),0x0;}catch(_0x16544a){if(_0x16544a instanceof SDKError)return console[_0x5641ff(0x21c)]('Error:\x20'+_0x16544a[_0x5641ff(0x234)]),_0x16544a['cause']&&console[_0x5641ff(0x21c)](_0x5641ff(0x1d4)+_0x16544a[_0x5641ff(0x1c8)]),0x1;throw _0x16544a;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x2461d7(0x235)]='segment:sql';[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x208);async[a32_0x2461d7(0x202)](_0xb6ea47){const _0x1d93b7=a32_0x2461d7,{options:_0x64920e,args:_0x17eea3,tdx:_0x4a65f3}=_0xb6ea47,_0x5025e4=_0x17eea3[0x0];if(!_0x5025e4)return console[_0x1d93b7(0x21c)](_0x1d93b7(0x1e2)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1fa)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x244)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x212)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x249)),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x53abb2=_0x64920e[_0x1d93b7(0x1e0)],_0x3682b0=resolveSegmentTarget(_0x5025e4,_0x53abb2,_0x64920e[_0x1d93b7(0x23a)]);_0x64920e[_0x1d93b7(0x23a)]&&console['error']('Target\x20path:\x20'+_0x3682b0);const _0x3e200d=await withSpinner(_0x1d93b7(0x21f)+_0x5025e4+'\x27...',()=>_0x4a65f3[_0x1d93b7(0x237)][_0x1d93b7(0x1ed)](_0x3682b0),{'verbose':_0x64920e[_0x1d93b7(0x23a)]}),_0x160e52=_0x3e200d[_0x1d93b7(0x24b)];_0x64920e[_0x1d93b7(0x23a)]&&(console[_0x1d93b7(0x21c)](_0x1d93b7(0x1d1)+_0x160e52['type']),console[_0x1d93b7(0x21c)](_0x1d93b7(0x22a)+_0x160e52[_0x1d93b7(0x1ff)]));if(_0x160e52[_0x1d93b7(0x233)]===_0x1d93b7(0x209))return console[_0x1d93b7(0x21c)](_0x1d93b7(0x23c)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1f9)),0x1;if(_0x160e52[_0x1d93b7(0x233)]===_0x1d93b7(0x23f))return console[_0x1d93b7(0x21c)](_0x1d93b7(0x214)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1f0)),0x1;if(!_0x160e52[_0x1d93b7(0x24a)])throw new SDKError(ErrorCode[_0x1d93b7(0x23b)],_0x1d93b7(0x258));const _0x33e262=await withSpinner(_0x1d93b7(0x215),()=>_0x4a65f3[_0x1d93b7(0x237)][_0x1d93b7(0x1ea)](_0x160e52[_0x1d93b7(0x1ff)],_0x160e52[_0x1d93b7(0x24a)]),{'verbose':_0x64920e[_0x1d93b7(0x23a)]}),_0x26636d=_0x33e262[_0x1d93b7(0x24b)];return _0x64920e['format']===_0x1d93b7(0x24c)||_0x64920e['format']===_0x1d93b7(0x228)?await handleSDKOutput([{'sql':_0x26636d}],_0x64920e):console[_0x1d93b7(0x1f6)](_0x26636d),0x0;}catch(_0x1f7392){if(_0x1f7392 instanceof SDKError)return console[_0x1d93b7(0x21c)](_0x1d93b7(0x1e1)+_0x1f7392[_0x1d93b7(0x234)]),_0x1f7392[_0x1d93b7(0x1c8)]&&console[_0x1d93b7(0x21c)](_0x1d93b7(0x1d4)+_0x1f7392[_0x1d93b7(0x1c8)]),0x1;throw _0x1f7392;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x236);[a32_0x2461d7(0x1db)]='Create\x20segment\x20folder\x20for\x20organization';async[a32_0x2461d7(0x202)](_0x5b010e){const _0x1df6b8=a32_0x2461d7,{options:_0x36c2ef,args:_0x51ad60,tdx:_0x21604e}=_0x5b010e,_0x36a6a6=_0x36c2ef;if(_0x51ad60['length']<0x2)return console[_0x1df6b8(0x21c)](_0x1df6b8(0x1d0)),console['error'](_0x1df6b8(0x246)),0x1;const _0x3f4cc5=_0x51ad60[0x0],_0x78f5df=_0x51ad60[0x1];_0x36a6a6[_0x1df6b8(0x23a)]&&(console[_0x1df6b8(0x21c)](_0x1df6b8(0x1d5)+_0x36a6a6[_0x1df6b8(0x250)]),console[_0x1df6b8(0x21c)](_0x1df6b8(0x24d)+_0x3f4cc5),console[_0x1df6b8(0x21c)]('Folder\x20name:\x20'+_0x78f5df));let _0x4e91bc;if(_0x36a6a6[_0x1df6b8(0x1e5)]){const _0x23e9e3=_0x36a6a6[_0x1df6b8(0x1e5)],_0x37ee05=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3f4cc5+_0x1df6b8(0x21e),()=>_0x21604e['segment'][_0x1df6b8(0x1ec)](_0x3f4cc5),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]}),_0xba3f2d=_0x37ee05[_0x1df6b8(0x24b)],_0x59de66=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x23e9e3+_0x1df6b8(0x21e),()=>_0x21604e[_0x1df6b8(0x237)][_0x1df6b8(0x238)](_0xba3f2d,_0x23e9e3),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]});_0x4e91bc=_0x59de66[_0x1df6b8(0x24b)],_0x36a6a6[_0x1df6b8(0x23a)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4e91bc);}const _0x2ac50d={'name':_0x78f5df,'description':_0x36a6a6[_0x1df6b8(0x1db)],'parentFolderId':_0x4e91bc},_0x49a600=await withSpinner(_0x1df6b8(0x1e8)+_0x78f5df+_0x1df6b8(0x21e),()=>_0x21604e['segment'][_0x1df6b8(0x1e3)](_0x3f4cc5,_0x2ac50d),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]}),_0x1b0c4b=_0x49a600['data'];return console[_0x1df6b8(0x21c)](_0x1df6b8(0x251)+_0x1b0c4b[_0x1df6b8(0x235)]+_0x1df6b8(0x1de)+_0x1b0c4b['id']),await handleSDKOutput([_0x1b0c4b],_0x36a6a6),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x221);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1f8);async[a32_0x2461d7(0x202)](_0x1cf5da){const _0x2f4946=a32_0x2461d7,{options:_0x4d1a63,args:_0x36a8a2,tdx:_0x5eaccf}=_0x1cf5da,_0x2d7817=_0x36a8a2[0x0];if(!_0x2d7817)return console[_0x2f4946(0x21c)](_0x2f4946(0x1fd)),console[_0x2f4946(0x21c)](_0x2f4946(0x1c9)),console['error'](_0x2f4946(0x257)),console[_0x2f4946(0x21c)](_0x2f4946(0x1dd)),console[_0x2f4946(0x21c)](_0x2f4946(0x219)),console[_0x2f4946(0x21c)](_0x2f4946(0x212)),console[_0x2f4946(0x21c)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x2f4946(0x21c)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2f4946(0x21c)](_0x2f4946(0x1c4)),console[_0x2f4946(0x21c)](_0x2f4946(0x24f)),0x1;try{const _0x43ba69=_0x4d1a63[_0x2f4946(0x1e0)],_0x3c86a8=resolveSegmentTarget(_0x2d7817,_0x43ba69,_0x4d1a63[_0x2f4946(0x23a)]);_0x4d1a63[_0x2f4946(0x23a)]&&console[_0x2f4946(0x21c)]('Target\x20path:\x20'+_0x3c86a8);const _0x273aee=await withSpinner(_0x2f4946(0x21f)+_0x2d7817+_0x2f4946(0x21e),()=>_0x5eaccf[_0x2f4946(0x237)][_0x2f4946(0x1ed)](_0x3c86a8),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]}),_0x5f51f8=_0x273aee[_0x2f4946(0x24b)];_0x4d1a63[_0x2f4946(0x23a)]&&(console['error'](_0x2f4946(0x1d1)+_0x5f51f8[_0x2f4946(0x233)]),console['error'](_0x2f4946(0x22a)+_0x5f51f8[_0x2f4946(0x1ff)]),_0x5f51f8[_0x2f4946(0x1bf)]&&console['error'](_0x2f4946(0x253)+_0x5f51f8[_0x2f4946(0x1bf)]),_0x5f51f8[_0x2f4946(0x24a)]&&console[_0x2f4946(0x21c)](_0x2f4946(0x24e)+_0x5f51f8[_0x2f4946(0x24a)]));if(_0x4d1a63[_0x2f4946(0x1d2)]){if(_0x5f51f8['type']===_0x2f4946(0x209))return console[_0x2f4946(0x21c)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x5f51f8['type']===_0x2f4946(0x23f))return console[_0x2f4946(0x21c)](_0x2f4946(0x1ef)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x5f51f8[_0x2f4946(0x24a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2f4946(0x258));const _0x20c7ec=getConsoleNextUrl(_0x4d1a63[_0x2f4946(0x250)],_0x2f4946(0x252)+_0x5f51f8[_0x2f4946(0x1ff)]+_0x2f4946(0x1f2)+_0x5f51f8[_0x2f4946(0x24a)]);return console['error'](a32_0x19be70[_0x2f4946(0x206)]('✔')+_0x2f4946(0x220)+a32_0x19be70[_0x2f4946(0x1fb)](_0x20c7ec)),openBrowser(_0x20c7ec),0x0;}if(_0x5f51f8[_0x2f4946(0x233)]==='folder'){if(!_0x5f51f8['folderId'])throw new SDKError(ErrorCode[_0x2f4946(0x1c1)],_0x2f4946(0x1ee));const _0xf6ebbb=await withSpinner(_0x2f4946(0x207),()=>_0x5eaccf['segment'][_0x2f4946(0x23e)](_0x5f51f8[_0x2f4946(0x1bf)]),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]});await handleSingleObjectOutput(_0xf6ebbb[_0x2f4946(0x24b)],_0x4d1a63);}else{if(_0x5f51f8[_0x2f4946(0x233)]===_0x2f4946(0x237)){if(!_0x5f51f8[_0x2f4946(0x24a)])throw new SDKError(ErrorCode[_0x2f4946(0x23b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x59da13=await withSpinner(_0x2f4946(0x1e9),()=>_0x5eaccf[_0x2f4946(0x237)]['getSegment'](_0x5f51f8[_0x2f4946(0x1ff)],_0x5f51f8[_0x2f4946(0x24a)]),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]}),_0x3d0d14=getConsoleNextUrl(_0x4d1a63[_0x2f4946(0x250)],_0x2f4946(0x252)+_0x5f51f8[_0x2f4946(0x1ff)]+_0x2f4946(0x1f2)+_0x5f51f8[_0x2f4946(0x24a)]),_0x5208e3=_0x59da13[_0x2f4946(0x24b)];_0x5208e3[_0x2f4946(0x23d)]=_0x3d0d14,await handleSingleObjectOutput(_0x5208e3,_0x4d1a63);}else return console[_0x2f4946(0x21c)](_0x2f4946(0x21d)),console[_0x2f4946(0x21c)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x169aeb){if(_0x169aeb instanceof SDKError)return console[_0x2f4946(0x21c)]('Error:\x20'+_0x169aeb[_0x2f4946(0x234)]),_0x169aeb[_0x2f4946(0x1c8)]&&console['error'](_0x2f4946(0x1d4)+_0x169aeb[_0x2f4946(0x1c8)]),0x1;throw _0x169aeb;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x2461d7(0x235)]='segment:desc';[a32_0x2461d7(0x1db)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a32_0x2461d7(0x202)](_0x420c32){const _0x56bb6d=a32_0x2461d7,{options:_0x2cc237,args:_0x322ea6,tdx:_0x13611f}=_0x420c32,_0x3b6828=_0x322ea6[0x0];if(!_0x3b6828)return console['error'](_0x56bb6d(0x1e2)),console[_0x56bb6d(0x21c)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x56bb6d(0x1c7)),console[_0x56bb6d(0x21c)]('Examples:'),console[_0x56bb6d(0x21c)](_0x56bb6d(0x240)),console[_0x56bb6d(0x21c)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1801a5=_0x2cc237[_0x56bb6d(0x1e0)],_0x39cb5e=resolveSegmentTarget(_0x3b6828,_0x1801a5,_0x2cc237['verbose']);_0x2cc237[_0x56bb6d(0x23a)]&&console[_0x56bb6d(0x21c)](_0x56bb6d(0x22c)+_0x39cb5e);const _0x31f428=await withSpinner(_0x56bb6d(0x21f)+_0x3b6828+_0x56bb6d(0x21e),()=>_0x13611f[_0x56bb6d(0x237)][_0x56bb6d(0x1ed)](_0x39cb5e),{'verbose':_0x2cc237[_0x56bb6d(0x23a)]}),_0x232d15=_0x31f428[_0x56bb6d(0x24b)];_0x2cc237['verbose']&&(console[_0x56bb6d(0x21c)](_0x56bb6d(0x1d1)+_0x232d15[_0x56bb6d(0x233)]),console[_0x56bb6d(0x21c)](_0x56bb6d(0x22a)+_0x232d15[_0x56bb6d(0x1ff)]));if(_0x232d15[_0x56bb6d(0x233)]===_0x56bb6d(0x209))return console[_0x56bb6d(0x21c)](_0x56bb6d(0x256)),console['error'](_0x56bb6d(0x1f9)),0x1;if(_0x232d15[_0x56bb6d(0x233)]===_0x56bb6d(0x23f))return console[_0x56bb6d(0x21c)](_0x56bb6d(0x1fc)),console[_0x56bb6d(0x21c)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x232d15[_0x56bb6d(0x24a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56bb6d(0x258));const _0x53952a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x13611f[_0x56bb6d(0x237)][_0x56bb6d(0x1ea)](_0x232d15[_0x56bb6d(0x1ff)],_0x232d15['segmentId']),{'verbose':_0x2cc237['verbose']}),_0x25c45e=_0x53952a[_0x56bb6d(0x24b)],_0x3cce8d=await executeSchemaQuery(_0x25c45e,_0x13611f,_0x2cc237);return await handleQueryOutput(_0x3cce8d,_0x2cc237),0x0;}catch(_0x5f1dc3){if(_0x5f1dc3 instanceof SDKError)return console[_0x56bb6d(0x21c)](_0x56bb6d(0x1e1)+_0x5f1dc3[_0x56bb6d(0x234)]),_0x5f1dc3[_0x56bb6d(0x1c8)]&&console['error']('\x20\x20Cause:\x20'+_0x5f1dc3[_0x56bb6d(0x1c8)]),0x1;throw _0x5f1dc3;}}}
|