@treasuredata/tdx 2026.3.19 → 2026.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/segment-validator.js.map +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x1cb568=a30_0x5c8f;(function(_0x35eade,_0xbfd5ec){const _0x3d845c=a30_0x5c8f,_0x3186ae=_0x35eade();while(!![]){try{const _0x55bd73=parseInt(_0x3d845c(0x2a1))/0x1*(parseInt(_0x3d845c(0x186))/0x2)+parseInt(_0x3d845c(0x14d))/0x3*(parseInt(_0x3d845c(0x20e))/0x4)+-parseInt(_0x3d845c(0x24e))/0x5+parseInt(_0x3d845c(0x1bf))/0x6*(parseInt(_0x3d845c(0x118))/0x7)+parseInt(_0x3d845c(0x1fb))/0x8+-parseInt(_0x3d845c(0x129))/0x9*(parseInt(_0x3d845c(0x161))/0xa)+parseInt(_0x3d845c(0x282))/0xb*(-parseInt(_0x3d845c(0x269))/0xc);if(_0x55bd73===_0xbfd5ec)break;else _0x3186ae['push'](_0x3186ae['shift']());}catch(_0x3b2594){_0x3186ae['push'](_0x3186ae['shift']());}}}(a30_0x466f,0x96898));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x58e066 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x134bc9 from'chalk';function a30_0x5c8f(_0x4ab819,_0x3db516){_0x4ab819=_0x4ab819-0x115;const _0x466f4b=a30_0x466f();let _0x5c8f2c=_0x466f4b[_0x4ab819];return _0x5c8f2c;}import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x1cb568(0x194),LEGACY_PARENT_SEGMENT_DIR=a30_0x1cb568(0x1cc);function openBrowser(_0x1db17e){const _0x3836dc=a30_0x1cb568,_0xe251ac=process[_0x3836dc(0x28f)],_0x3254e6=_0xe251ac===_0x3836dc(0x28c)?'open':_0xe251ac===_0x3836dc(0x29e)?_0x3836dc(0x185):_0x3836dc(0x237);spawn(_0x3254e6,[_0x1db17e],{'detached':!![],'stdio':_0x3836dc(0x1d1)})[_0x3836dc(0x188)]();}function migrateLegacyDirectory(){const _0xd3c13c=a30_0x1cb568;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x26cf63=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x26cf63[_0xd3c13c(0x12b)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xd3c13c(0x19a)](a30_0x134bc9['yellow'](_0xd3c13c(0x14a)+LEGACY_PARENT_SEGMENT_DIR+_0xd3c13c(0x264)+PARENT_SEGMENT_DIR+_0xd3c13c(0x222))),console[_0xd3c13c(0x19a)](a30_0x134bc9[_0xd3c13c(0x1d0)](_0xd3c13c(0x202)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0xd3c13c(0x19a)](a30_0x134bc9['yellow'](_0xd3c13c(0x1ce)+LEGACY_PARENT_SEGMENT_DIR+_0xd3c13c(0x256)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x134bc9[_0xd3c13c(0x1eb)](_0xd3c13c(0x2a0)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x379546){const _0x15d52f=_0x379546 instanceof Error?_0x379546['message']:String(_0x379546);return console['error'](a30_0x134bc9[_0xd3c13c(0x224)](_0xd3c13c(0x196)+_0x15d52f+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x57b186){const _0x41a1bd=a30_0x1cb568;return migrateLegacyDirectory(),super[_0x41a1bd(0x298)](_0x57b186);}}function resolveYamlFile(_0x56d314){const _0x9f73e1=a30_0x1cb568;if(_0x56d314['endsWith'](_0x9f73e1(0x117))||_0x56d314['endsWith'](_0x9f73e1(0x18b)))return _0x56d314;return a30_0x58e066['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x56d314)+_0x9f73e1(0x117));}function formatProgressMessage(_0x296d7b){const _0x50d42c=a30_0x1cb568,_0x21a6b2=_0x296d7b[_0x50d42c(0x18c)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x21a6b2){const [,_0x4b35a1,_0x376f47,_0x1622aa='']=_0x21a6b2;return a30_0x134bc9['dim'](_0x4b35a1+':')+'\x20'+_0x376f47+a30_0x134bc9[_0x50d42c(0x1d0)](_0x1622aa);}return a30_0x134bc9[_0x50d42c(0x1d0)](_0x296d7b);}function showFileNotFoundError(_0x393a44,_0x2f8e1e){const _0x1ccfc0=a30_0x1cb568;console[_0x1ccfc0(0x19a)](a30_0x134bc9[_0x1ccfc0(0x224)](_0x1ccfc0(0x25a)+_0x393a44+'\x0a')),console['error'](a30_0x134bc9[_0x1ccfc0(0x276)](_0x1ccfc0(0x1b8)+_0x2f8e1e+_0x1ccfc0(0x1a2)));}function displayRealtimeValidation(_0x3e04a1){const _0x1673d3=a30_0x1cb568;if(!_0x3e04a1[_0x1673d3(0x13a)])return;const _0x37125b=_0x3e04a1['realtime'],_0x110dc8=_0x37125b[_0x1673d3(0x1e0)]?a30_0x134bc9[_0x1673d3(0x1eb)]('⚡\x20Enabled'):a30_0x134bc9[_0x1673d3(0x155)](_0x1673d3(0x204));console[_0x1673d3(0x19a)]('\x0a'+a30_0x134bc9[_0x1673d3(0x1d0)](_0x1673d3(0x167))+'\x20'+_0x110dc8);if(_0x37125b[_0x1673d3(0x123)]&&_0x37125b['events'][_0x1673d3(0x23d)]>0x0){console[_0x1673d3(0x19a)]('\x20\x20'+a30_0x134bc9['dim'](_0x1673d3(0x1d4))+'\x20'+_0x37125b[_0x1673d3(0x123)][_0x1673d3(0x23d)]+_0x1673d3(0x253));for(const _0x2c9b3e of _0x37125b[_0x1673d3(0x123)]){const _0x429b10=_0x2c9b3e[_0x1673d3(0x258)]===![]?a30_0x134bc9['red']('✘'):a30_0x134bc9['green']('✔');console[_0x1673d3(0x19a)]('\x20\x20\x20\x20'+_0x429b10+'\x20'+_0x2c9b3e[_0x1673d3(0x1de)]),_0x2c9b3e[_0x1673d3(0x240)]&&console[_0x1673d3(0x19a)](_0x1673d3(0x145)+a30_0x134bc9[_0x1673d3(0x224)](_0x2c9b3e['sourceTableError']));}}if(_0x37125b[_0x1673d3(0x286)]&&_0x37125b[_0x1673d3(0x286)][_0x1673d3(0x23d)]>0x0){console['error']('\x20\x20'+a30_0x134bc9[_0x1673d3(0x1d0)](_0x1673d3(0x127))+'\x20'+_0x37125b[_0x1673d3(0x286)]['length']+_0x1673d3(0x253));for(const _0x484d29 of _0x37125b[_0x1673d3(0x286)]){const _0x13550a=_0x484d29[_0x1673d3(0x1a8)]?a30_0x134bc9[_0x1673d3(0x1eb)]('✔'):a30_0x134bc9['red']('✘');console[_0x1673d3(0x19a)](_0x1673d3(0x1fd)+_0x13550a+'\x20'+_0x484d29[_0x1673d3(0x1de)]+'\x20'+a30_0x134bc9['dim']('('+_0x484d29[_0x1673d3(0x11d)]+')'));}}if(_0x37125b[_0x1673d3(0x275)]){const _0x3f9ab4=_0x37125b[_0x1673d3(0x275)][_0x1673d3(0x1ef)]?.[_0x1673d3(0x23d)]?_0x1673d3(0x1fa)+_0x37125b[_0x1673d3(0x275)][_0x1673d3(0x1ef)]['join'](',\x20')+']':'';console[_0x1673d3(0x19a)]('\x20\x20'+a30_0x134bc9[_0x1673d3(0x1d0)](_0x1673d3(0x20f))+'\x20'+_0x37125b[_0x1673d3(0x275)][_0x1673d3(0x229)]+_0x3f9ab4);}if(_0x37125b[_0x1673d3(0x163)]&&_0x37125b[_0x1673d3(0x163)][_0x1673d3(0x23d)]>0x0){console[_0x1673d3(0x19a)]('\x20\x20'+a30_0x134bc9[_0x1673d3(0x1d0)](_0x1673d3(0x12d))+'\x20'+_0x37125b['personalizationServices'][_0x1673d3(0x23d)]+_0x1673d3(0x19f)+(_0x37125b['personalizationServices'][_0x1673d3(0x23d)]!==0x1?'s':''));for(const _0x52e91b of _0x37125b[_0x1673d3(0x163)]){console['error']('\x20\x20\x20\x20-\x20'+_0x52e91b[_0x1673d3(0x1de)]);}}}function showParentSegmentNotSetError(_0x119795){const _0x31d568=a30_0x1cb568;console[_0x31d568(0x19a)](a30_0x134bc9[_0x31d568(0x155)](_0x31d568(0x192))),console[_0x31d568(0x19a)](_0x119795);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x1cb568(0x1de)]='segment:parent:list';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x1f9);async['execute'](_0x38c7f3){const _0x3339b6=a30_0x1cb568,{options:_0x4fd9b5,args:_0x5588b9,tdx:_0x5288ab}=_0x38c7f3,_0x2fca97=_0x5588b9[0x0];_0x4fd9b5['verbose']&&(console[_0x3339b6(0x19a)](_0x3339b6(0x1ca)+_0x4fd9b5[_0x3339b6(0x29a)]),_0x2fca97&&console[_0x3339b6(0x19a)]('Pattern:\x20'+_0x2fca97));const _0x58e462=await withSpinner(_0x2fca97?_0x3339b6(0x128)+_0x2fca97+'\x27...':_0x3339b6(0x130),()=>_0x5288ab[_0x3339b6(0x1d6)][_0x3339b6(0x24a)](),{'verbose':_0x4fd9b5[_0x3339b6(0x218)]});let _0x20c6cd=_0x58e462[_0x3339b6(0x150)];if(_0x2fca97){const _0x565cac=_0x2fca97[_0x3339b6(0x1e3)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3339b6(0x1e3)](/\*/g,'.*')[_0x3339b6(0x1e3)](/\?/g,'.'),_0x239231=new RegExp('^'+_0x565cac+'$','i');_0x20c6cd=_0x20c6cd['filter'](_0x51431b=>_0x239231[_0x3339b6(0x23b)](_0x51431b[_0x3339b6(0x286)][_0x3339b6(0x1de)]));}_0x20c6cd[_0x3339b6(0x25c)]((_0xfc8711,_0x21d858)=>_0xfc8711[_0x3339b6(0x286)][_0x3339b6(0x1de)][_0x3339b6(0x1e1)](_0x21d858[_0x3339b6(0x286)][_0x3339b6(0x1de)])),console['error'](_0x3339b6(0x1c0)+_0x20c6cd[_0x3339b6(0x23d)]+_0x3339b6(0x1dc)+(_0x20c6cd[_0x3339b6(0x23d)]!==0x1?'s':''));const _0x41cd3a=_0x3ed01f=>{const _0x3e34f0=_0x3339b6;return getConsoleNextUrl(_0x4fd9b5[_0x3e34f0(0x29a)],_0x3e34f0(0x291)+_0x3ed01f);};if(_0x4fd9b5[_0x3339b6(0x20c)]===_0x3339b6(0x124)||_0x4fd9b5[_0x3339b6(0x20c)]===_0x3339b6(0x20b)){const _0x1f15ba=_0x20c6cd['map'](_0x39e88e=>({..._0x39e88e,'url':_0x41cd3a(_0x39e88e['id'])}));await handleSDKOutput(_0x1f15ba,_0x4fd9b5);}else{if(_0x20c6cd[_0x3339b6(0x23d)]===0x0)_0x2fca97?console[_0x3339b6(0x151)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2fca97):console[_0x3339b6(0x151)](_0x3339b6(0x14f));else for(const _0xee8be of _0x20c6cd){const _0x3263e2=_0xee8be[_0x3339b6(0x286)]['population']?a30_0x134bc9['dim']('\x20('+formatRows(_0xee8be['attributes'][_0x3339b6(0x1ec)])+')'):'',_0x3687d3=hyperlink(_0xee8be['attributes'][_0x3339b6(0x1de)],_0x41cd3a(_0xee8be['id']));console[_0x3339b6(0x151)](_0x3339b6(0x210)+_0x3687d3+_0x3263e2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x1cb568(0x1de)]=a30_0x1cb568(0x179);['description']=a30_0x1cb568(0x24d);async['execute'](_0x2aad24){const _0x2ad02f=a30_0x1cb568,{options:_0x5a39ab,args:_0x523c28,tdx:_0x5a96d7}=_0x2aad24;console[_0x2ad02f(0x19a)](_0x2ad02f(0x1dd)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2ad02f(0x23f));const _0x4264b6=_0x5a39ab;if(_0x523c28['length']===0x0)return console['error'](a30_0x134bc9[_0x2ad02f(0x224)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x2ad02f(0x19a)](_0x2ad02f(0x16d)),0x1;const _0x30205f=_0x523c28[0x0];if(!_0x4264b6[_0x2ad02f(0x260)]||!_0x4264b6['table'])return console[_0x2ad02f(0x19a)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x2ad02f(0x16d)),0x1;_0x4264b6[_0x2ad02f(0x218)]&&(console['error'](_0x2ad02f(0x1ca)+_0x4264b6[_0x2ad02f(0x29a)]),console['error']('Name:\x20'+_0x30205f),console[_0x2ad02f(0x19a)](_0x2ad02f(0x205)+_0x4264b6[_0x2ad02f(0x260)]),console[_0x2ad02f(0x19a)]('Table:\x20'+_0x4264b6[_0x2ad02f(0x13d)]));const _0x16aab6=await loadJSONFromOptions(_0x4264b6[_0x2ad02f(0x286)],_0x4264b6[_0x2ad02f(0x244)]),_0x5d19ad=await loadJSONFromOptions(_0x4264b6[_0x2ad02f(0x154)],_0x4264b6[_0x2ad02f(0x21f)]),_0x24a0e9=await loadJSONFromOptions(_0x4264b6[_0x2ad02f(0x197)],_0x4264b6[_0x2ad02f(0x137)]),_0x163dcc={'name':_0x30205f,'description':_0x4264b6[_0x2ad02f(0x1e6)],'scheduleType':_0x4264b6['scheduleType'],'scheduleOption':_0x4264b6[_0x2ad02f(0x279)],'timezone':_0x4264b6[_0x2ad02f(0x28b)],'master':{'parentDatabaseName':_0x4264b6['database'],'parentTableName':_0x4264b6[_0x2ad02f(0x13d)]},'attributes':_0x16aab6,'behaviors':_0x5d19ad,'customerGroup':_0x24a0e9},_0x2b5acd=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x30205f+_0x2ad02f(0x190),()=>_0x5a96d7[_0x2ad02f(0x1d6)]['createParent'](_0x163dcc),{'verbose':_0x5a39ab[_0x2ad02f(0x218)]}),_0x314f78=_0x2b5acd[_0x2ad02f(0x150)];return console[_0x2ad02f(0x19a)](_0x2ad02f(0x27b)+_0x314f78[_0x2ad02f(0x1de)]+_0x2ad02f(0x148)+_0x314f78['id']),await handleSDKOutput([_0x314f78],_0x5a39ab),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x1cb568(0x171);[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x1f6);async[a30_0x1cb568(0x1a1)](_0x4b8ce9){const _0x3c8a93=a30_0x1cb568,{options:_0x38b224,args:_0x4fa1dc,tdx:_0x305487}=_0x4b8ce9;console[_0x3c8a93(0x19a)](_0x3c8a93(0x15e)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x3c8a93(0x23f));const _0x403ffa=_0x38b224;if(_0x4fa1dc[_0x3c8a93(0x23d)]===0x0)return console[_0x3c8a93(0x19a)](a30_0x134bc9[_0x3c8a93(0x224)](_0x3c8a93(0x1b4))),console[_0x3c8a93(0x19a)](_0x3c8a93(0x14e)),0x1;const _0x372c36=_0x4fa1dc[0x0];_0x403ffa[_0x3c8a93(0x218)]&&(console[_0x3c8a93(0x19a)](_0x3c8a93(0x1ca)+_0x403ffa[_0x3c8a93(0x29a)]),console[_0x3c8a93(0x19a)]('Parent\x20segment:\x20'+_0x372c36));const _0x3c4189=await withSpinner(_0x3c8a93(0x172)+_0x372c36+'\x27...',()=>_0x305487['segment'][_0x3c8a93(0x17d)](_0x372c36),{'verbose':_0x403ffa['verbose']}),_0x49dbc0=_0x3c4189[_0x3c8a93(0x150)],_0x39c1c2=await loadJSONFromOptions(_0x403ffa[_0x3c8a93(0x1cf)],_0x403ffa['addAttributesFile']),_0x3396eb=await loadJSONFromOptions(_0x403ffa[_0x3c8a93(0x230)],_0x403ffa['addBehaviorsFile']),_0x37f6f4={'name':_0x49dbc0[_0x3c8a93(0x1de)],'description':_0x403ffa[_0x3c8a93(0x1e6)]!==undefined?_0x403ffa[_0x3c8a93(0x1e6)]:_0x49dbc0[_0x3c8a93(0x1e6)],'scheduleType':_0x403ffa[_0x3c8a93(0x24c)]!==undefined?_0x403ffa['scheduleType']:_0x49dbc0[_0x3c8a93(0x24c)],'scheduleOption':_0x403ffa[_0x3c8a93(0x279)]!==undefined?_0x403ffa[_0x3c8a93(0x279)]:_0x49dbc0[_0x3c8a93(0x279)],'timezone':_0x403ffa[_0x3c8a93(0x28b)]!==undefined?_0x403ffa[_0x3c8a93(0x28b)]:_0x49dbc0['timezone'],'master':_0x49dbc0['master'],'attributes':_0x39c1c2?[..._0x49dbc0[_0x3c8a93(0x286)]||[],..._0x39c1c2]:_0x49dbc0[_0x3c8a93(0x286)],'behaviors':_0x3396eb?[..._0x49dbc0[_0x3c8a93(0x154)]||[],..._0x3396eb]:_0x49dbc0[_0x3c8a93(0x154)],'customerGroup':_0x49dbc0['customerGroup']},_0x981912=await withSpinner(_0x3c8a93(0x24b)+_0x372c36+_0x3c8a93(0x190),()=>_0x305487[_0x3c8a93(0x1d6)]['updateParent'](_0x372c36,_0x37f6f4),{'verbose':_0x403ffa[_0x3c8a93(0x218)]}),_0x13e605=_0x981912['data'];return console[_0x3c8a93(0x19a)](_0x3c8a93(0x14c)+_0x13e605[_0x3c8a93(0x1de)]+'\x27'),await handleSDKOutput([_0x13e605],_0x403ffa),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]='segment:parent:pull';['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a30_0x1cb568(0x1a1)](_0xd22673){const _0x50cc41=a30_0x1cb568,{options:_0x24c737,args:_0x543f82,tdx:_0x5d4fb8}=_0xd22673,_0x4d6bf=_0x24c737,_0x291cf7=_0x543f82[0x0]||_0x24c737[_0x50cc41(0x169)];if(!_0x291cf7)return showParentSegmentNotSetError(_0x50cc41(0x158)+_0x50cc41(0x1c3)),0x1;if(_0x4d6bf[_0x50cc41(0x1af)]&&_0x4d6bf[_0x50cc41(0x295)])return console['error'](a30_0x134bc9['red'](_0x50cc41(0x1b3))),console[_0x50cc41(0x19a)](a30_0x134bc9['dim'](_0x50cc41(0x23a))),console['error'](a30_0x134bc9[_0x50cc41(0x1d0)](_0x50cc41(0x11b)+PARENT_SEGMENT_DIR+_0x50cc41(0x15c))),console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x276)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x2b9d50=_0x4d6bf['output']||a30_0x58e066[_0x50cc41(0x257)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x291cf7)+_0x50cc41(0x117));_0x4d6bf['verbose']&&(console[_0x50cc41(0x19a)](_0x50cc41(0x1ca)+_0x4d6bf[_0x50cc41(0x29a)]),console[_0x50cc41(0x19a)]('Parent\x20segment:\x20'+_0x291cf7),console[_0x50cc41(0x19a)](_0x50cc41(0x1e5)+_0x2b9d50));const _0x4bc454=await withSpinner(_0x50cc41(0x132)+_0x291cf7+_0x50cc41(0x190),()=>_0x5d4fb8[_0x50cc41(0x1d6)]['pullParentYaml'](_0x291cf7),{'verbose':_0x4d6bf[_0x50cc41(0x218)]}),_0x222b63=_0x4bc454[_0x50cc41(0x150)];if(existsSync(_0x2b9d50)){const _0x236248=readFileSync(_0x2b9d50,_0x50cc41(0x24f)),_0x102ab0=generateDiff(_0x236248,_0x222b63);if(!hasChanges(_0x102ab0))console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x1eb)]('✔')+_0x50cc41(0x139)+a30_0x134bc9['cyan'](_0x2b9d50)+_0x50cc41(0x226));else{console[_0x50cc41(0x19a)](_0x50cc41(0x277)+_0x2b9d50+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x50cc41(0x19a)](formatDiffWithColors(_0x102ab0)),console[_0x50cc41(0x19a)]('─'[_0x50cc41(0x259)](0x3c));if(!_0x4d6bf[_0x50cc41(0x136)]){if(!isInteractive())return console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x224)](_0x50cc41(0x17e)),_0x50cc41(0x289)),console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x1d0)](_0x50cc41(0x126))),0x1;const _0x1bfd5d=await confirmKey(_0x50cc41(0x19b)+_0x2b9d50+'\x27?');if(!_0x1bfd5d)return console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x155)](_0x50cc41(0x162))),0x1;}writeFileSync(_0x2b9d50,_0x222b63,_0x50cc41(0x24f)),console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x1eb)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x134bc9['cyan'](_0x2b9d50));}}else{const _0xc3ed81=a30_0x58e066[_0x50cc41(0x208)](_0x2b9d50);!existsSync(_0xc3ed81)&&mkdirSync(_0xc3ed81,{'recursive':!![]}),writeFileSync(_0x2b9d50,_0x222b63,_0x50cc41(0x24f)),console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x1eb)]('✔')+_0x50cc41(0x1e4)+a30_0x134bc9[_0x50cc41(0x276)](_0x2b9d50));}return saveSessionContext({'parent_segment':_0x291cf7},_0x4d6bf[_0x50cc41(0x13b)]),console[_0x50cc41(0x19a)](a30_0x134bc9[_0x50cc41(0x1eb)]('✔')+_0x50cc41(0x236)+a30_0x134bc9['dim']('parent_segment')+_0x50cc41(0x12c)+a30_0x134bc9['cyan'](_0x291cf7)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]='segment:parent:push';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x125);async['execute'](_0x39e146){const _0xf024c4=a30_0x1cb568,{options:_0x3165b3,args:_0x1d23ba,tdx:_0x6ff201}=_0x39e146,_0x30eb68=_0x3165b3,_0x4d4488=_0x1d23ba[0x0]||_0x3165b3[_0xf024c4(0x169)];if(!_0x4d4488)return showParentSegmentNotSetError(_0xf024c4(0x1b6)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x5e6e3e=resolveYamlFile(_0x4d4488);if(!existsSync(_0x5e6e3e))return showFileNotFoundError(_0x5e6e3e,_0x4d4488),0x1;_0x30eb68[_0xf024c4(0x218)]&&(console['error']('Site:\x20'+_0x30eb68['site']),console[_0xf024c4(0x19a)](_0xf024c4(0x176)+_0x5e6e3e));let _0x4f941d;try{_0x4f941d=readFileSync(_0x5e6e3e,_0xf024c4(0x24f));}catch(_0x15192a){const _0xed4fa0=_0x15192a instanceof Error?_0x15192a[_0xf024c4(0x22e)]:String(_0x15192a);return console['error'](_0xf024c4(0x11f)+_0xed4fa0),0x1;}const _0x16b2f8=await withSpinner(_0xf024c4(0x23e),()=>_0x6ff201[_0xf024c4(0x1d6)][_0xf024c4(0x177)](_0x4f941d),{'verbose':_0x30eb68[_0xf024c4(0x218)]}),_0x3d107d=_0x16b2f8[_0xf024c4(0x150)],{isNew:_0x55c869,name:_0xf56fe1,hasChanges:_0x1adc77,diffFormatted:_0x12fc4e}=_0x3d107d;if(!_0x1adc77)return console[_0xf024c4(0x19a)]('✔\x20No\x20changes\x20-\x20\x27'+_0xf56fe1+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x55c869?console[_0xf024c4(0x19a)](_0xf024c4(0x26e)+_0xf56fe1+'\x27:'):console[_0xf024c4(0x19a)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xf56fe1+'\x27:');console[_0xf024c4(0x19a)]('─'[_0xf024c4(0x259)](0x3c)),console[_0xf024c4(0x19a)](_0x12fc4e),console[_0xf024c4(0x19a)]('─'[_0xf024c4(0x259)](0x3c));const _0x456452=_0x55c869?_0xf024c4(0x272)+_0xf56fe1+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xf56fe1+'\x27?';if(!_0x30eb68[_0xf024c4(0x136)]){if(!isInteractive())return console[_0xf024c4(0x19a)](a30_0x134bc9[_0xf024c4(0x224)]('\x0aError:'),_0xf024c4(0x289)),console['error'](a30_0x134bc9['dim'](_0xf024c4(0x126))),0x1;const _0x308551=await confirmKey(_0x456452);if(!_0x308551)return console['error'](a30_0x134bc9[_0xf024c4(0x155)](_0xf024c4(0x162))),0x1;}const _0x55acb6=_0x55c869?_0xf024c4(0x288):_0xf024c4(0x241),_0x46e193=await withSpinner(_0x55acb6+_0xf024c4(0x203)+_0xf56fe1+_0xf024c4(0x190),()=>_0x3d107d[_0xf024c4(0x228)](),{'verbose':_0x30eb68[_0xf024c4(0x218)]}),_0x2d9210=_0x46e193['data'],_0x28d9d1=getConsoleNextUrl(_0x30eb68[_0xf024c4(0x29a)],'/app/dw/parentSegments/'+_0x2d9210['id']),_0x4c1468=_0x55c869?_0xf024c4(0x12f):_0xf024c4(0x1c7);return console[_0xf024c4(0x19a)]('✔\x20'+_0x4c1468+_0xf024c4(0x203)+_0x2d9210['name']+'\x27'),console['error']('\x20\x20'+_0x28d9d1),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]=a30_0x1cb568(0x247);[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x268);async['execute'](_0x495471){const _0x4d2c64=a30_0x1cb568,{options:_0xf01b3b,args:_0x55e066,tdx:_0xba60ff}=_0x495471,_0x319ebf=_0xf01b3b,_0x137972=_0x55e066[0x0]||_0xf01b3b['parentSegment'];if(!_0x137972)return showParentSegmentNotSetError(_0x4d2c64(0x27c)+_0x4d2c64(0x187)+'Options:\x0a'+_0x4d2c64(0x1b0)+_0x4d2c64(0x13e)+_0x4d2c64(0x209)),0x1;const _0x3dfef7=resolveYamlFile(_0x137972);if(!existsSync(_0x3dfef7))return showFileNotFoundError(_0x3dfef7,_0x137972),0x1;_0x319ebf[_0x4d2c64(0x218)]&&(console[_0x4d2c64(0x19a)]('Site:\x20'+_0x319ebf[_0x4d2c64(0x29a)]),console['error']('YAML\x20file:\x20'+_0x3dfef7));let _0x2a339b;try{_0x2a339b=readFileSync(_0x3dfef7,'utf-8');}catch(_0x103324){const _0x1937ca=_0x103324 instanceof Error?_0x103324[_0x4d2c64(0x22e)]:String(_0x103324);return console[_0x4d2c64(0x19a)](_0x4d2c64(0x11f)+_0x1937ca),0x1;}const _0x4869cd=createCommandSpinner(a30_0x134bc9['dim'](_0x4d2c64(0x22f)),{'verbose':_0x319ebf['verbose']});_0x4869cd[_0x4d2c64(0x185)]();const _0x5da1b9={'onProgress':_0x1e24d1=>{const _0x21d181=_0x4d2c64;_0x4869cd[_0x21d181(0x16b)]=formatProgressMessage(_0x1e24d1);}};if(_0x319ebf[_0x4d2c64(0x1be)])_0x5da1b9[_0x4d2c64(0x1be)]=!![];if(_0x319ebf['enriched'])_0x5da1b9[_0x4d2c64(0x1ac)]=!![];_0x319ebf[_0x4d2c64(0x239)]&&(_0x5da1b9[_0x4d2c64(0x239)]=_0x319ebf[_0x4d2c64(0x239)]);_0x319ebf[_0x4d2c64(0x214)]&&(_0x5da1b9[_0x4d2c64(0x214)]=_0x319ebf[_0x4d2c64(0x214)]);if(_0x319ebf['interval'])_0x5da1b9['interval']=_0x319ebf[_0x4d2c64(0x183)];let _0x52c41f;try{_0x52c41f=await _0xba60ff[_0x4d2c64(0x1d6)]['validateParentYaml'](_0x2a339b,_0x5da1b9),_0x4869cd[_0x4d2c64(0x251)]();}catch(_0x512c47){_0x4869cd[_0x4d2c64(0x251)]();throw _0x512c47;}const _0x885e04=_0x319ebf[_0x4d2c64(0x183)]||_0x4d2c64(0x211);return this[_0x4d2c64(0x181)](_0x52c41f,_0x5da1b9,_0x3dfef7,_0x885e04),_0x52c41f[_0x4d2c64(0x267)]?0x0:0x1;}[a30_0x1cb568(0x181)](_0x163d0f,_0x4af8d3,_0x4058ab,_0x1435bd){const _0x227cba=a30_0x1cb568;console[_0x227cba(0x19a)]('\x0a'+a30_0x134bc9[_0x227cba(0x144)](_0x227cba(0x1f3))+'\x20'+_0x163d0f[_0x227cba(0x1de)]),console[_0x227cba(0x19a)]('═'[_0x227cba(0x259)](0x3c)),this[_0x227cba(0x1e7)](_0x163d0f);if(typeof _0x4af8d3['attribute']==='string'){this[_0x227cba(0x263)](_0x163d0f),this['displaySummary'](_0x163d0f),this[_0x227cba(0x266)](_0x4058ab,_0x1435bd,_0x227cba(0x239),_0x4af8d3[_0x227cba(0x239)]);return;}if(_0x4af8d3[_0x227cba(0x239)]===!![]){this[_0x227cba(0x263)](_0x163d0f),this['displaySummary'](_0x163d0f),this['displayPreviewHints'](_0x4058ab,_0x1435bd,_0x227cba(0x286));return;}if(typeof _0x4af8d3['behavior']===_0x227cba(0x200)){this[_0x227cba(0x1a7)](_0x163d0f,_0x1435bd),this['displaySummary'](_0x163d0f),this[_0x227cba(0x266)](_0x4058ab,_0x1435bd,_0x227cba(0x214),_0x4af8d3[_0x227cba(0x214)]);return;}if(_0x4af8d3[_0x227cba(0x214)]===!![]){this[_0x227cba(0x1a7)](_0x163d0f,_0x1435bd),this['displaySummary'](_0x163d0f),this[_0x227cba(0x266)](_0x4058ab,_0x1435bd,_0x227cba(0x154));return;}this[_0x227cba(0x263)](_0x163d0f),this[_0x227cba(0x1a7)](_0x163d0f,_0x1435bd),this[_0x227cba(0x1b2)](_0x163d0f),this[_0x227cba(0x147)](_0x163d0f),this[_0x227cba(0x266)](_0x4058ab,_0x1435bd,'all');}[a30_0x1cb568(0x1b2)](_0x3fc94a){displayRealtimeValidation(_0x3fc94a);}[a30_0x1cb568(0x266)](_0x5a2cea,_0x10a680,_0x5795d5,_0x31c508){const _0x32c021=a30_0x1cb568;console[_0x32c021(0x19a)]('\x0a'+a30_0x134bc9['dim'](_0x32c021(0x29c)));const _0x3e7e66=_0x10a680!==_0x32c021(0x211)?_0x32c021(0x1aa)+_0x10a680:'';if(_0x5795d5===_0x32c021(0x239)&&_0x31c508)console[_0x32c021(0x19a)]('\x20\x20'+a30_0x134bc9[_0x32c021(0x1d0)](_0x32c021(0x168)+_0x5a2cea+_0x32c021(0x195)+_0x31c508+'\x22'+_0x3e7e66));else{if(_0x5795d5===_0x32c021(0x214)&&_0x31c508)console[_0x32c021(0x19a)]('\x20\x20'+a30_0x134bc9[_0x32c021(0x1d0)](_0x32c021(0x168)+_0x5a2cea+_0x32c021(0x250)+_0x31c508+'\x22'+_0x3e7e66));else(_0x5795d5==='attributes'||_0x5795d5===_0x32c021(0x27f))&&console[_0x32c021(0x19a)]('\x20\x20'+a30_0x134bc9[_0x32c021(0x1d0)](_0x32c021(0x168)+_0x5a2cea+_0x32c021(0x206)+_0x3e7e66));}(_0x5795d5==='behaviors'||_0x5795d5==='all')&&console[_0x32c021(0x19a)]('\x20\x20'+a30_0x134bc9[_0x32c021(0x1d0)](_0x32c021(0x168)+_0x5a2cea+_0x32c021(0x21b)+_0x3e7e66)),_0x5795d5==='all'&&console[_0x32c021(0x19a)]('\x20\x20'+a30_0x134bc9[_0x32c021(0x1d0)](_0x32c021(0x168)+_0x5a2cea+_0x32c021(0x184)+_0x3e7e66));}['displayMasterInfo'](_0x376744){const _0x165b2c=a30_0x1cb568,{master:_0x41436c}=_0x376744,_0x1ee9e0=_0x41436c[_0x165b2c(0x281)]?a30_0x134bc9[_0x165b2c(0x1eb)]('✔'):a30_0x134bc9[_0x165b2c(0x224)]('✘');console[_0x165b2c(0x19a)]('\x0a'+a30_0x134bc9['dim'](_0x165b2c(0x1ee))),console[_0x165b2c(0x19a)](_0x1ee9e0+'\x20'+a30_0x134bc9[_0x165b2c(0x144)](_0x41436c[_0x165b2c(0x260)]+'.'+_0x41436c['table'])),_0x41436c[_0x165b2c(0x281)]?_0x41436c['rowCount']!==undefined&&console[_0x165b2c(0x19a)]('\x20\x20'+a30_0x134bc9[_0x165b2c(0x1d0)](_0x165b2c(0x297))+'\x20'+a30_0x134bc9[_0x165b2c(0x276)](formatRows(_0x41436c['rowCount']))):console[_0x165b2c(0x19a)]('\x20\x20'+a30_0x134bc9[_0x165b2c(0x224)](_0x165b2c(0x16f))+'\x20'+_0x41436c[_0x165b2c(0x180)]);}[a30_0x1cb568(0x263)](_0x339949){const _0x5cfbbf=a30_0x1cb568;if(_0x339949[_0x5cfbbf(0x286)][_0x5cfbbf(0x23d)]===0x0)return;console[_0x5cfbbf(0x19a)]('\x0a'+a30_0x134bc9[_0x5cfbbf(0x1d0)](_0x5cfbbf(0x16c)));for(const _0x429ab1 of _0x339949[_0x5cfbbf(0x286)]){const _0x3fe8fc=_0x429ab1['schemaValid']?a30_0x134bc9['green']('✔'):a30_0x134bc9['red']('✘');let _0x4c61b9='';if(_0x429ab1[_0x5cfbbf(0x281)]&&_0x429ab1['matchedCount']!==undefined&&_0x429ab1[_0x5cfbbf(0x292)]!==undefined){const _0x5d42bc=_0x429ab1['coveragePercent'][_0x5cfbbf(0x296)](0x1),_0xcc71ba=_0x429ab1[_0x5cfbbf(0x292)]>=0x50?a30_0x134bc9['green']:_0x429ab1['coveragePercent']>=0x32?a30_0x134bc9[_0x5cfbbf(0x155)]:a30_0x134bc9['red'];_0x4c61b9='\x20'+a30_0x134bc9['dim'](_0x5cfbbf(0x26b))+'\x20'+_0xcc71ba(_0x5d42bc+'%')+'\x20('+formatRows(_0x429ab1[_0x5cfbbf(0x1df)])+_0x5cfbbf(0x140);}console[_0x5cfbbf(0x19a)](_0x3fe8fc+'\x20'+a30_0x134bc9[_0x5cfbbf(0x144)](_0x429ab1[_0x5cfbbf(0x1de)])+_0x4c61b9),console[_0x5cfbbf(0x19a)]('\x20\x20'+a30_0x134bc9[_0x5cfbbf(0x1d0)]('Source:')+'\x20'+a30_0x134bc9['bold'](_0x429ab1[_0x5cfbbf(0x260)]+'.'+_0x429ab1['table']));const _0x20924c=_0x429ab1[_0x5cfbbf(0x23c)]===_0x429ab1[_0x5cfbbf(0x17a)]?a30_0x134bc9['dim'](_0x5cfbbf(0x25f))+'\x20'+_0x429ab1[_0x5cfbbf(0x23c)]:a30_0x134bc9[_0x5cfbbf(0x1d0)](_0x5cfbbf(0x22d))+'\x20'+_0x429ab1[_0x5cfbbf(0x23c)]+'\x20=\x20'+_0x429ab1['foreignKey'];console[_0x5cfbbf(0x19a)]('\x20\x20'+_0x20924c),console[_0x5cfbbf(0x19a)]('\x20\x20'+a30_0x134bc9[_0x5cfbbf(0x1d0)](_0x5cfbbf(0x1bb))),this[_0x5cfbbf(0x1f0)](_0x429ab1[_0x5cfbbf(0x198)]),!_0x429ab1[_0x5cfbbf(0x281)]&&console['error']('\x20\x20'+a30_0x134bc9[_0x5cfbbf(0x224)](_0x5cfbbf(0x16f))+'\x20'+_0x429ab1[_0x5cfbbf(0x180)]);}}[a30_0x1cb568(0x1a7)](_0x12431a,_0x42c975){const _0x47e1c3=a30_0x1cb568;if(_0x12431a['behaviors']['length']===0x0)return;console[_0x47e1c3(0x19a)]('\x0a'+a30_0x134bc9['dim'](_0x47e1c3(0x1cd))+'\x20'+a30_0x134bc9[_0x47e1c3(0x1d0)]('('+_0x42c975+')'));for(const _0x12edbe of _0x12431a[_0x47e1c3(0x154)]){const _0x3b8193=_0x12edbe[_0x47e1c3(0x281)]?a30_0x134bc9[_0x47e1c3(0x1eb)]('✔'):a30_0x134bc9[_0x47e1c3(0x224)]('✘');let _0x2bf19c='';if(_0x12edbe[_0x47e1c3(0x281)]&&_0x12edbe[_0x47e1c3(0x1da)]!==undefined&&_0x12edbe[_0x47e1c3(0x26a)]!==undefined){const _0x239c3c=_0x12edbe[_0x47e1c3(0x119)]?.[_0x47e1c3(0x296)](0x1)||'?',_0x1476a2=(_0x12edbe[_0x47e1c3(0x119)]??0x0)>=0x32?a30_0x134bc9[_0x47e1c3(0x1eb)]:(_0x12edbe[_0x47e1c3(0x119)]??0x0)>=0x14?a30_0x134bc9[_0x47e1c3(0x155)]:a30_0x134bc9['red'];_0x2bf19c='\x20'+a30_0x134bc9[_0x47e1c3(0x1d0)](_0x47e1c3(0x1a4))+'\x20'+_0x1476a2(formatRows(_0x12edbe[_0x47e1c3(0x1da)]))+'\x20('+_0x239c3c+_0x47e1c3(0x143)+a30_0x134bc9['dim'](_0x47e1c3(0x1d4))+'\x20'+a30_0x134bc9['cyan'](formatRows(_0x12edbe[_0x47e1c3(0x26a)]));}console[_0x47e1c3(0x19a)](_0x3b8193+'\x20'+a30_0x134bc9['bold'](_0x12edbe['name'])+_0x2bf19c),console[_0x47e1c3(0x19a)]('\x20\x20'+a30_0x134bc9[_0x47e1c3(0x1d0)]('Source:')+'\x20'+a30_0x134bc9[_0x47e1c3(0x144)](_0x12edbe['database']+'.'+_0x12edbe['table']));const _0x46cc04=_0x12edbe[_0x47e1c3(0x23c)]===_0x12edbe[_0x47e1c3(0x17a)]?a30_0x134bc9['dim'](_0x47e1c3(0x25f))+'\x20'+_0x12edbe['joinKey']:a30_0x134bc9['dim'](_0x47e1c3(0x22d))+'\x20'+_0x12edbe[_0x47e1c3(0x23c)]+_0x47e1c3(0x12c)+_0x12edbe['foreignKey'];console[_0x47e1c3(0x19a)]('\x20\x20'+_0x46cc04),console['error']('\x20\x20'+a30_0x134bc9[_0x47e1c3(0x1d0)]('Columns:')),this[_0x47e1c3(0x1f0)](_0x12edbe['columns']),!_0x12edbe[_0x47e1c3(0x281)]&&console['error']('\x20\x20'+a30_0x134bc9[_0x47e1c3(0x224)]('Error:')+'\x20'+_0x12edbe[_0x47e1c3(0x180)]);}}[a30_0x1cb568(0x1f0)](_0x4e3274){const _0xc7d834=a30_0x1cb568;for(const _0x2ff10c of _0x4e3274){_0x2ff10c['label']===_0x2ff10c['column']||_0x2ff10c['column']==='*'?console[_0xc7d834(0x19a)](_0xc7d834(0x157)+_0x2ff10c[_0xc7d834(0x261)]):console[_0xc7d834(0x19a)](_0xc7d834(0x157)+_0x2ff10c[_0xc7d834(0x261)]+'\x20'+a30_0x134bc9['dim']('('+_0x2ff10c[_0xc7d834(0x213)]+')'));}}['displaySummary'](_0x201e67){const _0x40032f=a30_0x1cb568;console[_0x40032f(0x19a)]('─'['repeat'](0x3c));if(_0x201e67['errors']['length']>0x0){console[_0x40032f(0x19a)]('\x0a'+a30_0x134bc9[_0x40032f(0x224)](_0x40032f(0x1f8)));for(const _0x15a069 of _0x201e67[_0x40032f(0x28d)]){console[_0x40032f(0x19a)]('\x20\x20'+a30_0x134bc9[_0x40032f(0x224)]('•')+'\x20'+_0x15a069);}}_0x201e67[_0x40032f(0x267)]&&console[_0x40032f(0x19a)]('\x0a'+a30_0x134bc9['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]='segment:parent:preview';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x19c);async[a30_0x1cb568(0x1a1)](_0x4f933c){const _0x39eec8=a30_0x1cb568,{options:_0x1d11cc,args:_0x149f13,tdx:_0x337351}=_0x4f933c,_0x280e5e=_0x1d11cc,_0x4ca939=_0x149f13[0x0]||_0x1d11cc['parentSegment'];if(!_0x4ca939)return showParentSegmentNotSetError(_0x39eec8(0x249)+_0x39eec8(0x1f4)+'Options\x20(one\x20required):\x0a'+_0x39eec8(0x193)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x39eec8(0x133)+_0x39eec8(0x15b)+_0x39eec8(0x209)),0x1;if(!_0x280e5e[_0x39eec8(0x1be)]&&!_0x280e5e['attribute']&&!_0x280e5e[_0x39eec8(0x214)]&&!_0x280e5e[_0x39eec8(0x1ac)])return console['error'](a30_0x134bc9[_0x39eec8(0x224)](_0x39eec8(0x1fc))),console[_0x39eec8(0x19a)](_0x39eec8(0x11a)),console[_0x39eec8(0x19a)](_0x39eec8(0x12a)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x39eec8(0x19a)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x39eec8(0x19a)](_0x39eec8(0x20a)),console[_0x39eec8(0x19a)](_0x39eec8(0x116)),0x1;const _0x42b45c=resolveYamlFile(_0x4ca939);if(!existsSync(_0x42b45c))return showFileNotFoundError(_0x42b45c,_0x4ca939),0x1;_0x280e5e[_0x39eec8(0x218)]&&(console['error'](_0x39eec8(0x1ca)+_0x280e5e['site']),console[_0x39eec8(0x19a)](_0x39eec8(0x176)+_0x42b45c));let _0x9d0391;try{_0x9d0391=readFileSync(_0x42b45c,_0x39eec8(0x24f));}catch(_0x51470a){const _0x3d58a0=_0x51470a instanceof Error?_0x51470a[_0x39eec8(0x22e)]:String(_0x51470a);return console[_0x39eec8(0x19a)](_0x39eec8(0x11f)+_0x3d58a0),0x1;}let _0x40c516;try{_0x40c516=parseDef(_0x9d0391);}catch(_0x5e53d5){const _0xb407bd=_0x5e53d5 instanceof Error?_0x5e53d5[_0x39eec8(0x22e)]:String(_0x5e53d5);return console[_0x39eec8(0x19a)](a30_0x134bc9[_0x39eec8(0x224)](_0x39eec8(0x141)+_0xb407bd)),0x1;}if(_0x280e5e[_0x39eec8(0x239)]===!![]||_0x280e5e['attribute']===''){const _0x194fe5=_0x40c516[_0x39eec8(0x286)]?.['map'](_0x4e67f5=>_0x4e67f5['name'])||[];if(_0x194fe5[_0x39eec8(0x23d)]===0x0)console[_0x39eec8(0x19a)](a30_0x134bc9[_0x39eec8(0x224)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x39eec8(0x19a)](a30_0x134bc9[_0x39eec8(0x224)](_0x39eec8(0x21c))),console[_0x39eec8(0x19a)]('Available\x20attributes:');for(const _0x1cbfb5 of _0x194fe5){console[_0x39eec8(0x19a)]('\x20\x20'+a30_0x134bc9[_0x39eec8(0x276)](_0x1cbfb5));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x4ca939+_0x39eec8(0x195)+_0x194fe5[0x0]+'\x22');}return 0x1;}if(_0x280e5e[_0x39eec8(0x214)]===!![]||_0x280e5e[_0x39eec8(0x214)]===''){const _0x3c5ef3=_0x40c516[_0x39eec8(0x154)]?.['map'](_0x76a99a=>_0x76a99a[_0x39eec8(0x1de)])||[];if(_0x3c5ef3[_0x39eec8(0x23d)]===0x0)console[_0x39eec8(0x19a)](a30_0x134bc9[_0x39eec8(0x224)](_0x39eec8(0x22a)));else{console[_0x39eec8(0x19a)](a30_0x134bc9[_0x39eec8(0x224)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x39eec8(0x19a)]('Available\x20behaviors:');for(const _0x20af28 of _0x3c5ef3){console[_0x39eec8(0x19a)]('\x20\x20'+a30_0x134bc9[_0x39eec8(0x276)](_0x20af28));}console[_0x39eec8(0x19a)](_0x39eec8(0x16a)+_0x4ca939+'\x20--behavior\x20\x22'+_0x3c5ef3[0x0]+'\x22');}return 0x1;}const _0x10e1c6=createCommandSpinner(a30_0x134bc9[_0x39eec8(0x1d0)](_0x39eec8(0x1d9)),{'verbose':_0x280e5e['verbose']});_0x10e1c6[_0x39eec8(0x185)]();const _0x2b4a81={'onProgress':_0x209e6c=>{_0x10e1c6['text']=formatProgressMessage(_0x209e6c);}};if(_0x280e5e[_0x39eec8(0x1be)])_0x2b4a81[_0x39eec8(0x1be)]=!![];if(_0x280e5e[_0x39eec8(0x239)]&&typeof _0x280e5e[_0x39eec8(0x239)]===_0x39eec8(0x200))_0x2b4a81[_0x39eec8(0x239)]=_0x280e5e[_0x39eec8(0x239)];if(_0x280e5e[_0x39eec8(0x214)]&&typeof _0x280e5e[_0x39eec8(0x214)]===_0x39eec8(0x200))_0x2b4a81[_0x39eec8(0x214)]=_0x280e5e[_0x39eec8(0x214)];if(_0x280e5e[_0x39eec8(0x1ac)])_0x2b4a81[_0x39eec8(0x1ac)]=!![];if(_0x280e5e[_0x39eec8(0x183)])_0x2b4a81[_0x39eec8(0x183)]=_0x280e5e[_0x39eec8(0x183)];let _0x591530;try{_0x591530=await _0x337351['segment']['previewParentYaml'](_0x9d0391,_0x2b4a81),_0x10e1c6[_0x39eec8(0x251)]();}catch(_0x4bc0ae){_0x10e1c6[_0x39eec8(0x251)]();throw _0x4bc0ae;}return await this[_0x39eec8(0x178)](_0x591530,{'master':_0x280e5e[_0x39eec8(0x1be)],'attribute':typeof _0x280e5e[_0x39eec8(0x239)]===_0x39eec8(0x200)?_0x280e5e[_0x39eec8(0x239)]:undefined,'behavior':typeof _0x280e5e[_0x39eec8(0x214)]===_0x39eec8(0x200)?_0x280e5e['behavior']:undefined,'enriched':_0x280e5e[_0x39eec8(0x1ac)]}),_0x591530[_0x39eec8(0x267)]?0x0:0x1;}async[a30_0x1cb568(0x178)](_0x1104fe,_0x34d0b9){const _0x540e55=a30_0x1cb568;console['error']('\x0a'+a30_0x134bc9[_0x540e55(0x144)](_0x540e55(0x221))+'\x20'+_0x1104fe['name']),console[_0x540e55(0x19a)]('═'[_0x540e55(0x259)](0x3c));if(_0x34d0b9[_0x540e55(0x1be)]&&_0x1104fe[_0x540e55(0x13f)]){const _0x35d396=a30_0x134bc9[_0x540e55(0x1d0)]('Master:')+'\x20'+a30_0x134bc9['bold'](_0x1104fe[_0x540e55(0x1be)][_0x540e55(0x260)]+'.'+_0x1104fe[_0x540e55(0x1be)][_0x540e55(0x13d)]);await this[_0x540e55(0x234)](_0x35d396,_0x1104fe[_0x540e55(0x13f)]);}else{if(_0x34d0b9[_0x540e55(0x239)]&&_0x1104fe[_0x540e55(0x13f)]){const _0x4b74ed=a30_0x134bc9[_0x540e55(0x1d0)](_0x540e55(0x21d))+'\x20'+a30_0x134bc9[_0x540e55(0x144)](_0x34d0b9['attribute']);await this['displaySampleData'](_0x4b74ed,_0x1104fe['sampleData']);}else{if(_0x34d0b9[_0x540e55(0x214)]&&_0x1104fe['sampleData']){const _0x3333d5=a30_0x134bc9[_0x540e55(0x1d0)](_0x540e55(0x1d7))+'\x20'+a30_0x134bc9[_0x540e55(0x144)](_0x34d0b9[_0x540e55(0x214)]);await this[_0x540e55(0x234)](_0x3333d5,_0x1104fe['sampleData']);}else{if(_0x34d0b9[_0x540e55(0x1ac)]&&_0x1104fe[_0x540e55(0x13f)]){const _0x329ecd=a30_0x134bc9[_0x540e55(0x1d0)](_0x540e55(0x18f))+'\x20'+a30_0x134bc9[_0x540e55(0x144)](_0x540e55(0x215));await this['displaySampleData'](_0x329ecd,_0x1104fe['sampleData']);}else!_0x1104fe[_0x540e55(0x13f)]&&console[_0x540e55(0x19a)](_0x540e55(0x1db));}}}if(_0x1104fe[_0x540e55(0x28d)][_0x540e55(0x23d)]>0x0){console['error']('─'[_0x540e55(0x259)](0x3c)),console[_0x540e55(0x19a)]('\x0a'+a30_0x134bc9[_0x540e55(0x224)](_0x540e55(0x1f8)));for(const _0x5dca6b of _0x1104fe['errors']){console[_0x540e55(0x19a)]('\x20\x20'+a30_0x134bc9[_0x540e55(0x224)]('•')+'\x20'+_0x5dca6b);}}}async['displaySampleData'](_0x560337,_0x5402ea){const _0x5e2485=a30_0x1cb568;if(_0x5402ea[_0x5e2485(0x23d)]===0x0){console[_0x5e2485(0x19a)]('\x0a'+_0x560337),console[_0x5e2485(0x19a)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x5e2485(0x19a)]('\x0a'+_0x560337);const _0x5bd31e=Object[_0x5e2485(0x238)](_0x5402ea[0x0])[_0x5e2485(0x191)](_0x29e9d5=>({'name':_0x29e9d5,'type':typeof _0x5402ea[0x0][_0x29e9d5]==='number'?_0x5e2485(0x1a6):'varchar'})),_0x2e49b8={'queryId':'preview','columns':_0x5bd31e,'data':_0x5402ea,'stats':{'state':_0x5e2485(0x1d8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5402ea[_0x5e2485(0x23d)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x19fc41=formatAsTable(_0x2e49b8,_0x5402ea[_0x5e2485(0x23d)],!![]);await writeOutput(_0x19fc41,undefined,_0x5e2485(0x13d));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]=a30_0x1cb568(0x245);['description']=a30_0x1cb568(0x29f);async[a30_0x1cb568(0x1a1)](_0x300a1b){const _0x50a38b=a30_0x1cb568,{options:_0xa52f19,args:_0x37d0ee,tdx:_0xee5715}=_0x300a1b,_0x4e6503=_0xa52f19,_0x48bc54=_0x37d0ee[0x0]||_0xa52f19[_0x50a38b(0x169)];if(!_0x48bc54)return showParentSegmentNotSetError(_0x50a38b(0x22b)+_0x50a38b(0x1ea)),0x1;const _0x4f4521=resolveYamlFile(_0x48bc54);if(existsSync(_0x4f4521)){_0x4e6503['verbose']&&console['error']('Found\x20YAML\x20file:\x20'+_0x4f4521);let _0x51120f;try{_0x51120f=readFileSync(_0x4f4521,_0x50a38b(0x24f));}catch(_0xca9a0b){const _0x4652eb=_0xca9a0b instanceof Error?_0xca9a0b[_0x50a38b(0x22e)]:String(_0xca9a0b);return console[_0x50a38b(0x19a)]('Error\x20reading\x20file:\x20'+_0x4652eb),0x1;}const _0x279b84=await withSpinner(_0x50a38b(0x23e),()=>_0xee5715[_0x50a38b(0x1d6)][_0x50a38b(0x177)](_0x51120f),{'verbose':_0x4e6503[_0x50a38b(0x218)]}),_0x3c622a=_0x279b84[_0x50a38b(0x150)],{isNew:_0x1d0c4f,name:_0x26ed92,hasChanges:_0x1e2573,diffFormatted:_0x87b690}=_0x3c622a;if(_0x1e2573){_0x1d0c4f?console[_0x50a38b(0x19a)](_0x50a38b(0x26e)+_0x26ed92+'\x27:'):console[_0x50a38b(0x19a)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x26ed92+'\x27:');console[_0x50a38b(0x19a)]('─'[_0x50a38b(0x259)](0x3c)),console[_0x50a38b(0x19a)](_0x87b690),console[_0x50a38b(0x19a)]('─'[_0x50a38b(0x259)](0x3c));const _0x40ab29=_0x1d0c4f?_0x50a38b(0x272)+_0x26ed92+_0x50a38b(0x227):_0x50a38b(0x28a)+_0x26ed92+_0x50a38b(0x227);if(!_0x4e6503['yes']){if(!isInteractive())return console[_0x50a38b(0x19a)](a30_0x134bc9[_0x50a38b(0x224)](_0x50a38b(0x17e)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x50a38b(0x19a)](a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x126))),0x1;const _0x551d1b=await confirmKey(_0x40ab29);if(!_0x551d1b)return console[_0x50a38b(0x19a)](a30_0x134bc9[_0x50a38b(0x155)](_0x50a38b(0x162))),0x1;}const _0x46d886=_0x1d0c4f?_0x50a38b(0x288):_0x50a38b(0x241);await withSpinner(_0x46d886+'\x20parent\x20segment\x20\x27'+_0x26ed92+_0x50a38b(0x190),()=>_0x3c622a[_0x50a38b(0x228)](),{'verbose':_0x4e6503[_0x50a38b(0x218)]});const _0x282d4e=_0x1d0c4f?'Created':_0x50a38b(0x1c7);console[_0x50a38b(0x19a)]('✔\x20'+_0x282d4e+_0x50a38b(0x203)+_0x26ed92+'\x27');}else console[_0x50a38b(0x19a)](_0x50a38b(0x29d)+_0x26ed92+_0x50a38b(0x1f5));}const _0x2d2cd0=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x48bc54+_0x50a38b(0x190),()=>_0xee5715[_0x50a38b(0x1d6)]['runParent'](_0x48bc54),{'verbose':_0x4e6503['verbose']}),_0x56da4d=_0x2d2cd0['data'],_0x541347=getConsoleUrl(_0x4e6503[_0x50a38b(0x29a)],'/app/workflows/'+_0x56da4d[_0x50a38b(0x1c6)]+_0x50a38b(0x26d)+_0x56da4d[_0x50a38b(0x160)]+_0x50a38b(0x15d)+_0x56da4d[_0x50a38b(0x15a)]);return console[_0x50a38b(0x19a)](_0x50a38b(0x299)),console['error']('\x20\x20'+a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x17b))+'\x20'+_0x56da4d['audienceId']),console[_0x50a38b(0x19a)]('\x20\x20'+a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x290))+'\x20'+_0x56da4d['status']),console[_0x50a38b(0x19a)]('\x20\x20'+a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x293))+'\x20'+_0x56da4d[_0x50a38b(0x160)]),console['error']('\x20\x20'+a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x26f))+'\x20'+_0x56da4d[_0x50a38b(0x15a)]),console[_0x50a38b(0x19a)]('\x20\x20'+_0x541347),console[_0x50a38b(0x19a)]('\x0a'+a30_0x134bc9[_0x50a38b(0x1d0)](_0x50a38b(0x11e))+_0x50a38b(0x207)+_0x56da4d['workflowAttemptId']+_0x50a38b(0x1fe)),0x0;}}function a30_0x466f(){const _0x1c8032=['Error\x20parsing\x20YAML:\x20','ps:rt:list','%)\x20','bold','\x20\x20\x20\x20\x20\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','displaySummary','\x27\x20with\x20ID:\x20','<database>.<table>','\x0a⚠️\x20\x20Both\x20','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','9fEbmuB','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','No\x20parent\x20segments\x20found','data','log','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','behavior_','behaviors','yellow','No\x20personalization\x20services\x20configured','\x20\x20\x20\x20-\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','workflowAttemptId','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','/{name}.yml\x0a','/attempt/','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','user_id','workflowSessionId','10yrFkdS','Aborted.','personalizationServices','Executing\x20parent\x20segment\x20query...','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20to\x20push\x20the\x20configuration','RT\x202.0:','tdx\x20ps\x20preview\x20','parentSegment','\x0aUsage:\x20tdx\x20ps\x20preview\x20','text','Attributes','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','last_page_viewed','Error:','collectSchema','segment:parent:update','Fetching\x20current\x20configuration\x20for\x20\x27','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','ps:pz:init','YAML\x20file:\x20','pushParentYaml','displayPreviewResults','segment:parent:create','foreignKey','Audience\x20ID:','Fetching\x20behavior\x20list...','getParentFull','\x0aError:','segment:parent:sql','schemaError','displayValidateResults','\x20field','interval','\x20--enriched','start','4KcBhZd','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','unref','RT\x202.0\x20Validate:','list','.yaml','match','✔\x20Query\x20completed:\x20Processed\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Enriched:','\x27...','map','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','parent_segments','\x20--attribute\x20\x22','✘\x20Failed\x20to\x20rename\x20directory:\x20','customerGroup','columns','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','error','Overwrite\x20\x27','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','stats','My\x20Service','\x20service','sections','execute','`\x20to\x20download\x20the\x20configuration\x20first','List\x20available\x20fields\x20for\x20segmentation','Customers:','\x20\x20\x20','double','displayBehaviorsStats','valid','indexOf','\x20--interval\x20','limit','enriched','\x5c$&','Listing\x20personalization\x20services\x20for\x20\x27','use','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20service(s)\x20configured','displayRealtimeInfo','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Options:\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','page_view','SQL\x20query:\x0a','Columns:','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Listing\x20RT-enabled\x20parent\x20segments...','master','13998EScLsY','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','ps:pz:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20rows\x20','trim','workflowId','Updated','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','true','Site:\x20','parent_id','parent_segment','Behaviors','\x0a⚠️\x20\x20Migrating:\x20','addAttributes','dim','ignore','\x0a\x20\x20\x20\x20}','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Events:','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','segment','Behavior:','FINISHED','Fetching\x20sample\x20data...','customersWithEvents','\x0aNo\x20sample\x20data\x20available','\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','name','matchedCount','enabled','localeCompare','\x20\x20Note:\x20','replace','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Output\x20file:\x20','description','displayMasterInfo','ps:rt:validate','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','green','population','Fetching\x20customers\x20schema...','Master\x20Table','stitchingKeys','displayColumns','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20Added\x20RT\x202.0\x20template\x20section','Validate:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x27\x20is\x20up\x20to\x20date','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0a\x20\x20]\x0a}\x0a','Errors:','List\x20parent\x20segments','\x20+\x20[','5308672yQrPJP','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20\x20\x20\x20','\x20kill','query','string','personalization','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20parent\x20segment\x20\x27','⚡\x20Not\x20enabled','Database:\x20','\x20--attribute\x20\x22<name>\x22','\x20tdx\x20wf\x20attempt\x20','dirname','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','jsonl','format','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','769948jVEytm','ID\x20Stitching:','👥\x20','-1d','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','column','behavior','Master\x20+\x20Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','\x20\x202.\x20Run\x20','verbose','setJobId','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20--behavior\x20\x22<name>\x22','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Attribute:','processedRows','behaviorsFile','getParentSQL','Preview:','/\x20directories\x20exist.','{\x0a\x20\x20\x22database\x22:\x20\x22','red','tdx\x20ps\x20push\x20','\x20is\x20already\x20up\x20to\x20date','\x27\x20and\x20run\x20workflow?','apply','primaryKey','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20\x20Columns:\x20','Join:','message','Validating\x20configuration...','addBehaviors','personalization_services','customers','Fetching\x20SQL\x20for\x20\x27','displaySampleData','column_name','\x20Context\x20set:\x20','xdg-open','keys','attribute','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','test','joinKey','length','Analyzing\x20changes...','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','sourceTableError','Updating','SELECT\x20*\x20FROM\x20(\x0a','SELECT\x20*\x20FROM\x20','attributesFile','segment:parent:run','\x20\x20Database:\x20','segment:parent:validate','Default','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','listParents','Updating\x20parent\x20segment\x20\x27','scheduleType','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','2298020giHdYI','utf-8','\x20--behavior\x20\x22','stop','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20configured','\x20section','trigger_event','/\x20→\x20','join','sourceTableValid','repeat','Error:\x20File\x20not\x20found:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','sort','\x20[Job\x20ID:\x20','toLocaleString','Join\x20on:','database','label','.customers)','displayAttributesStats','/\x20and\x20','resolveParentId','displayPreviewHints','allValid','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','19256844gKMFPh','totalEvents','Coverage:','getBehaviorNames','/sessions/','\x0aNew\x20parent\x20segment\x20\x27','Attempt:','Output\x20Database:','\x20trigger=','Create\x20parent\x20segment\x20\x27','push','information_schema','idStitching','cyan','\x0aChanges\x20to\x20\x27','Personalization\x20service\x20description','scheduleOption','Parent\x20segment:\x20','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','realtime_enabled','Show\x20parent\x20segment\x20schema\x20(column\x20types)','all','getOutputDatabaseName','schemaValid','11eQfRXu','td_client_id','formatSchemaJson','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','attributes','\x20RT\x20configuration\x20is\x20valid','Creating','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Apply\x20changes\x20to\x20\x27','timezone','darwin','errors','single','platform','Status:','/app/dw/parentSegments/','coveragePercent','Session:','\x20to\x20configure\x20your\x20personalization\x20service','output','toFixed','Rows:','run','\x0a✔\x20Workflow\x20started','site','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','To\x20view\x20sample\x20data:','✔\x20No\x20changes\x20-\x20\x27','win32','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','✔\x20Renamed\x20directory\x20to\x20','331678EFiGyU','reduce','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','.yml','2681ENVxiE','customerPercent','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','using\x20the\x20default\x20path:\x20','validateParentYaml','type','To\x20cancel:','Error\x20reading\x20file:\x20','web','Next\x20steps:','\x20RT-enabled\x20parent\x20segment','events','json','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Attributes:','Listing\x20parent\x20segments\x20matching\x20\x27','1052991DJAXcK','Options:','isDirectory','\x20=\x20','Personalization:','elapsedTimeMillis','Created','Listing\x20parent\x20segments...','filter','Fetching\x20parent\x20segment\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','No\x20RT-enabled\x20parent\x20segments\x20found','Validating\x20RT\x20configuration...','yes','customerGroupFile','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20No\x20changes\x20-\x20','realtime','session','column_type','table','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','sampleData','\x20rows)'];a30_0x466f=function(){return _0x1c8032;};return a30_0x466f();}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x1a3);async[a30_0x1cb568(0x1a1)](_0x38e720){const _0x2e0d1e=a30_0x1cb568,{options:_0x5b7e50,args:_0x5b99d4,tdx:_0x3600d6}=_0x38e720,_0x1d7410=_0x5b99d4[0x0]||_0x5b7e50[_0x2e0d1e(0x169)];if(!_0x1d7410)return showParentSegmentNotSetError(_0x2e0d1e(0x1d5)+'\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;_0x5b7e50[_0x2e0d1e(0x218)]&&(console[_0x2e0d1e(0x19a)](_0x2e0d1e(0x1ca)+_0x5b7e50[_0x2e0d1e(0x29a)]),console['error'](_0x2e0d1e(0x27a)+_0x1d7410));const _0x284bbf=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1d7410+_0x2e0d1e(0x190),()=>_0x3600d6[_0x2e0d1e(0x1d6)]['listFields'](_0x1d7410),{'verbose':_0x5b7e50[_0x2e0d1e(0x218)]}),_0x4f6584=_0x284bbf[_0x2e0d1e(0x150)];console[_0x2e0d1e(0x19a)]('✔\x20Found\x20'+_0x4f6584['length']+_0x2e0d1e(0x182)+(_0x4f6584[_0x2e0d1e(0x23d)]!==0x1?'s':''));if(_0x5b7e50[_0x2e0d1e(0x124)]||_0x5b7e50[_0x2e0d1e(0x20b)])return await handleSDKOutput(_0x4f6584,_0x5b7e50),0x0;return displayFieldsHumanReadable(_0x4f6584,_0x1d7410),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x1cb568(0x1de)]='segment:parent:view';[a30_0x1cb568(0x1e6)]='Show\x20parent\x20segment\x20details';async[a30_0x1cb568(0x1a1)](_0x14904d){const _0x457c18=a30_0x1cb568,{options:_0x57ea71,args:_0x80a6a2,tdx:_0x9d0e60}=_0x14904d,_0x1a49ac=_0x57ea71,_0x5c5fd0=_0x80a6a2[0x0]||_0x57ea71[_0x457c18(0x169)];if(!_0x5c5fd0)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x457c18(0x1b7)+_0x457c18(0x1b5)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x57ea71[_0x457c18(0x218)]&&(console['error'](_0x457c18(0x1ca)+_0x57ea71[_0x457c18(0x29a)]),console[_0x457c18(0x19a)](_0x457c18(0x27a)+_0x5c5fd0));const _0x2fc173=await withSpinner(_0x457c18(0x132)+_0x5c5fd0+_0x457c18(0x190),()=>_0x9d0e60[_0x457c18(0x1d6)][_0x457c18(0x17d)](_0x5c5fd0),{'verbose':_0x57ea71[_0x457c18(0x218)]}),_0x13ab22=_0x2fc173[_0x457c18(0x150)];if(_0x1a49ac[_0x457c18(0x120)]){const _0x3c88aa=getConsoleNextUrl(_0x1a49ac[_0x457c18(0x29a)],'/app/dw/parentSegments/'+_0x13ab22['id']);return console[_0x457c18(0x19a)](a30_0x134bc9[_0x457c18(0x1eb)]('✔')+'\x20Opening\x20'+a30_0x134bc9[_0x457c18(0x276)](_0x3c88aa)),openBrowser(_0x3c88aa),0x0;}return await handleSingleObjectOutput(_0x13ab22,_0x57ea71),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x1cb568(0x1de)]='segment:parent:desc';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x27e);async[a30_0x1cb568(0x1a1)](_0x2a3ebe){const _0xcfe4c0=a30_0x1cb568,{options:_0x5cb43c,args:_0x5d129d,tdx:_0x250887}=_0x2a3ebe,_0xc8abf2=_0x5cb43c,_0x255263=_0x5d129d[0x0]||_0x5cb43c[_0xcfe4c0(0x169)];if(!_0x255263)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+_0xcfe4c0(0x1c1)+_0xcfe4c0(0x1b5)+_0xcfe4c0(0x285)),0x1;_0x5cb43c[_0xcfe4c0(0x218)]&&(console[_0xcfe4c0(0x19a)]('Site:\x20'+_0x5cb43c[_0xcfe4c0(0x29a)]),console['error'](_0xcfe4c0(0x27a)+_0x255263));const _0x272c27=await withSpinner(_0xcfe4c0(0x173)+_0x255263+_0xcfe4c0(0x190),()=>_0x250887[_0xcfe4c0(0x1d6)][_0xcfe4c0(0x265)](_0x255263),{'verbose':_0x5cb43c[_0xcfe4c0(0x218)]}),_0x22a6a5=_0x272c27[_0xcfe4c0(0x150)],_0xe33727=_0x250887[_0xcfe4c0(0x1d6)][_0xcfe4c0(0x280)](_0x22a6a5);if(_0xc8abf2[_0xcfe4c0(0x295)]){const _0x4cbb79=await this[_0xcfe4c0(0x170)](_0x2a3ebe,_0x255263,_0x22a6a5,_0xe33727),_0x20c146=this[_0xcfe4c0(0x284)](_0x4cbb79);writeFileSync(_0xc8abf2[_0xcfe4c0(0x295)],_0x20c146);const _0x3adf0e=_0x4cbb79['customers'][_0xcfe4c0(0x198)][_0xcfe4c0(0x23d)]+_0x4cbb79['behaviors'][_0xcfe4c0(0x115)]((_0x2a2874,_0x213aaa)=>_0x2a2874+_0x213aaa[_0xcfe4c0(0x198)][_0xcfe4c0(0x23d)],0x0),_0x12e305=_0x4cbb79['behaviors'][_0xcfe4c0(0x131)](_0x1014b1=>_0x1014b1[_0xcfe4c0(0x198)][_0xcfe4c0(0x23d)]===0x0)['length'];return console[_0xcfe4c0(0x151)]('Schema\x20saved\x20to\x20'+_0xc8abf2['output']),console[_0xcfe4c0(0x151)](_0xcfe4c0(0x246)+_0xe33727),console[_0xcfe4c0(0x151)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x4cbb79[_0xcfe4c0(0x154)][_0xcfe4c0(0x23d)]+'\x20behaviors'),console[_0xcfe4c0(0x151)](_0xcfe4c0(0x22c)+_0x3adf0e+'\x20total'),_0x12e305>0x0&&console[_0xcfe4c0(0x151)](_0xcfe4c0(0x1e2)+_0x12e305+_0xcfe4c0(0x165)),0x0;}console[_0xcfe4c0(0x19a)]('\x0a'+a30_0x134bc9[_0xcfe4c0(0x144)](_0xcfe4c0(0x270))+'\x20'+a30_0x134bc9['cyan'](_0xe33727));const _0x3ce615=await withSpinner(_0xcfe4c0(0x1ed),()=>_0x250887[_0xcfe4c0(0x1d6)][_0xcfe4c0(0x220)](_0x22a6a5),{'verbose':_0x5cb43c[_0xcfe4c0(0x218)]});console['error']('\x0a'+a30_0x134bc9[_0xcfe4c0(0x144)](_0xcfe4c0(0x232))+'\x20'+a30_0x134bc9[_0xcfe4c0(0x1d0)]('('+_0xe33727+_0xcfe4c0(0x262)));const _0x51c7f4=await executeSchemaQuery(_0x3ce615[_0xcfe4c0(0x150)],_0x250887,_0x5cb43c);await handleQueryOutput(_0x51c7f4,_0x5cb43c);const _0x216a85=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x250887[_0xcfe4c0(0x1d6)][_0xcfe4c0(0x26c)](_0x22a6a5),{'verbose':_0x5cb43c['verbose']});for(const _0x19afc5 of _0x216a85['data']){const _0x141cfc='behavior_'+_0x19afc5['toLowerCase']()[_0xcfe4c0(0x1e3)](/\s+/g,'_'),_0x28157d=_0xcfe4c0(0x243)+_0xe33727+'.'+_0x141cfc;console[_0xcfe4c0(0x19a)]('\x0a'+a30_0x134bc9[_0xcfe4c0(0x144)](_0x19afc5)+'\x20'+a30_0x134bc9[_0xcfe4c0(0x1d0)]('('+_0xe33727+'.'+_0x141cfc+')'));try{const _0x3e924b=await executeSchemaQuery(_0x28157d,_0x250887,_0x5cb43c);await handleQueryOutput(_0x3e924b,_0x5cb43c);}catch{console[_0xcfe4c0(0x19a)](a30_0x134bc9[_0xcfe4c0(0x155)](_0xcfe4c0(0x152)));}}return 0x0;}async[a30_0x1cb568(0x170)](_0x38191a,_0x186413,_0x4ad438,_0x1559e3){const _0x4bc42=a30_0x1cb568,{options:_0x34cc04,tdx:_0x5a13a7}=_0x38191a,_0x304ee8=await withSpinner(_0x4bc42(0x1ed),()=>_0x5a13a7[_0x4bc42(0x1d6)][_0x4bc42(0x220)](_0x4ad438),{'verbose':_0x34cc04['verbose']}),_0x3c5dff=await executeSchemaQuery(_0x304ee8['data'],_0x5a13a7,_0x34cc04),_0x55518b=_0x3c5dff[_0x4bc42(0x150)]['map'](_0x105d2c=>({'name':_0x105d2c[_0x4bc42(0x235)],'type':_0x105d2c[_0x4bc42(0x13c)]})),_0x195340=await withSpinner(_0x4bc42(0x17c),()=>_0x5a13a7[_0x4bc42(0x1d6)][_0x4bc42(0x26c)](_0x4ad438),{'verbose':_0x34cc04['verbose']}),_0xe2d0d8=[];for(const _0x13a0b5 of _0x195340[_0x4bc42(0x150)]){const _0x46f4ab=_0x4bc42(0x153)+_0x13a0b5['toLowerCase']()[_0x4bc42(0x1e3)](/\s+/g,'_'),_0x21cc98=_0x4bc42(0x243)+_0x1559e3+'.'+_0x46f4ab;let _0x17f94e=[];try{const _0x571456=await executeSchemaQuery(_0x21cc98,_0x5a13a7,_0x34cc04);_0x17f94e=_0x571456['data'][_0x4bc42(0x191)](_0x50cb6a=>({'name':_0x50cb6a[_0x4bc42(0x235)],'type':_0x50cb6a[_0x4bc42(0x13c)]}));}catch{}_0xe2d0d8[_0x4bc42(0x273)]({'table':_0x46f4ab,'columns':_0x17f94e});}return{'database':_0x1559e3,'parent_segment':_0x186413,'parent_id':_0x4ad438,'customers':{'table':_0x4bc42(0x232),'columns':_0x55518b},'behaviors':_0xe2d0d8};}[a30_0x1cb568(0x284)](_0x5e34ea){const _0x3ce811=a30_0x1cb568,_0x919a44=_0x44f29e=>{const _0x4ebb3d=a30_0x5c8f;if(_0x44f29e[_0x4ebb3d(0x23d)]===0x0)return'[]';const _0x58d806=_0x44f29e[_0x4ebb3d(0x191)](_0x27b039=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x27b039[_0x4ebb3d(0x1de)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x27b039[_0x4ebb3d(0x11d)]+'\x22\x20}');return'[\x0a'+_0x58d806[_0x4ebb3d(0x257)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x7900d1=_0x5e34ea[_0x3ce811(0x154)][_0x3ce811(0x191)](_0x3afb65=>{const _0x218b55=_0x3ce811;return _0x218b55(0x138)+_0x3afb65[_0x218b55(0x13d)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x919a44(_0x3afb65[_0x218b55(0x198)])[_0x218b55(0x1e3)](/^/gm,'\x20\x20')[_0x218b55(0x1c5)]()+_0x218b55(0x1d2);})[_0x3ce811(0x257)](',\x0a');return _0x3ce811(0x223)+_0x5e34ea['database']+_0x3ce811(0x20d)+_0x5e34ea[_0x3ce811(0x1cc)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x5e34ea[_0x3ce811(0x1cb)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x5e34ea[_0x3ce811(0x232)][_0x3ce811(0x13d)]+_0x3ce811(0x252)+_0x919a44(_0x5e34ea[_0x3ce811(0x232)][_0x3ce811(0x198)])[_0x3ce811(0x1e3)](/^/gm,'\x20\x20')[_0x3ce811(0x1c5)]()+_0x3ce811(0x1c8)+_0x7900d1+_0x3ce811(0x1f7);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x1cb568(0x17f);[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x159);async[a30_0x1cb568(0x1a1)](_0x1f4738){const _0x345284=a30_0x1cb568,{options:_0xcea5cf,args:_0x45885d,tdx:_0xdff03c}=_0x1f4738,_0xddea02=_0x45885d[0x0]||_0xcea5cf[_0x345284(0x169)];if(!_0xddea02)return showParentSegmentNotSetError(_0x345284(0x18e)+_0x345284(0x1d3)),0x1;_0xcea5cf[_0x345284(0x218)]&&(console[_0x345284(0x19a)](_0x345284(0x1ca)+_0xcea5cf[_0x345284(0x29a)]),console[_0x345284(0x19a)](_0x345284(0x27a)+_0xddea02));const _0x482475=await withSpinner(_0x345284(0x173)+_0xddea02+_0x345284(0x190),()=>_0xdff03c[_0x345284(0x1d6)][_0x345284(0x265)](_0xddea02),{'verbose':_0xcea5cf[_0x345284(0x218)]}),_0x38c735=_0x482475['data'],_0x55fe77=await withSpinner(_0x345284(0x233)+_0xddea02+_0x345284(0x190),()=>_0xdff03c[_0x345284(0x1d6)][_0x345284(0x220)](_0x38c735),{'verbose':_0xcea5cf['verbose']}),_0x43909e=_0x55fe77[_0x345284(0x150)];return _0xcea5cf[_0x345284(0x20c)]===_0x345284(0x124)||_0xcea5cf[_0x345284(0x20c)]===_0x345284(0x20b)?await handleSDKOutput([{'sql':_0x43909e}],_0xcea5cf):console[_0x345284(0x151)](_0x43909e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x1cb568(0x1de)]='segment:parent:show';[a30_0x1cb568(0x1e6)]=a30_0x1cb568(0x21a);async[a30_0x1cb568(0x1a1)](_0x1b098d){const _0x22ac90=a30_0x1cb568,{options:_0x1670d0,args:_0x30c291,tdx:_0x211514}=_0x1b098d,_0x5435b4=_0x30c291[0x0]||_0x1670d0[_0x22ac90(0x169)];if(!_0x5435b4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x22ac90(0x25b)),0x1;_0x1670d0[_0x22ac90(0x218)]&&(console[_0x22ac90(0x19a)](_0x22ac90(0x1ca)+_0x1670d0[_0x22ac90(0x29a)]),console['error'](_0x22ac90(0x27a)+_0x5435b4));const _0x44995f=await withSpinner(_0x22ac90(0x173)+_0x5435b4+'\x27...',()=>_0x211514[_0x22ac90(0x1d6)][_0x22ac90(0x265)](_0x5435b4),{'verbose':_0x1670d0[_0x22ac90(0x218)]}),_0x51759f=_0x44995f[_0x22ac90(0x150)],_0x7984ef=await withSpinner(_0x22ac90(0x233)+_0x5435b4+'\x27...',()=>_0x211514[_0x22ac90(0x1d6)][_0x22ac90(0x220)](_0x51759f),{'verbose':_0x1670d0[_0x22ac90(0x218)]});let _0x171676=_0x7984ef[_0x22ac90(0x150)];const _0x406f49=resolveLimit(_0x1670d0[_0x22ac90(0x1ab)],DEFAULT_DISPLAY_LIMIT),_0x28da92=/\bLIMIT\s+\d+/i[_0x22ac90(0x23b)](_0x171676);!_0x28da92&&(_0x171676=_0x171676[_0x22ac90(0x1c5)]()[_0x22ac90(0x1e3)](/;+$/,''),_0x171676=_0x22ac90(0x242)+_0x171676+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x406f49);_0x1670d0[_0x22ac90(0x218)]&&console[_0x22ac90(0x19a)](_0x22ac90(0x1ba)+_0x171676);const _0x2faf95=await withProgressSpinner(_0x22ac90(0x164),async _0x2997f3=>{const _0x5e1965=_0x22ac90,_0x53c003=await _0x211514[_0x5e1965(0x1ff)][_0x5e1965(0x1a1)](_0x171676,{'catalog':'td','schema':_0x5e1965(0x274),'onJobId':_0x3510ad=>{const _0x58c7d2=_0x5e1965;_0x2997f3[_0x58c7d2(0x219)](_0x3510ad);}});return _0x53c003;},{'verbose':_0x1670d0[_0x22ac90(0x218)]}),_0x1ffb8d=_0x2faf95['data'],_0x124b25=_0x1ffb8d[_0x22ac90(0x14b)]?_0x22ac90(0x25d)+_0x1ffb8d[_0x22ac90(0x14b)]+']':'';return console[_0x22ac90(0x19a)](_0x22ac90(0x18d)+_0x1ffb8d['stats'][_0x22ac90(0x21e)][_0x22ac90(0x25e)]()+_0x22ac90(0x1c4)+('in\x20'+formatElapsed(_0x1ffb8d[_0x22ac90(0x19d)][_0x22ac90(0x12e)])+_0x124b25)),await handleQueryOutput(_0x1ffb8d,_0x1670d0),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x1cb568(0x142);['description']=a30_0x1cb568(0x1e9);async[a30_0x1cb568(0x1a1)](_0x523a6c){const _0x228bb2=a30_0x1cb568,{options:_0x19d672,args:_0x35f6a3,tdx:_0x16b281}=_0x523a6c,_0x3474f9=_0x35f6a3[0x0],_0x2f9941=await withSpinner(_0x3474f9?_0x228bb2(0x1bc)+_0x3474f9+_0x228bb2(0x190):_0x228bb2(0x1bd),()=>_0x16b281['realtime']['list'](),{'verbose':_0x19d672[_0x228bb2(0x218)]});let _0x3a61a9=_0x2f9941[_0x228bb2(0x150)][_0x228bb2(0x131)](_0x5879a1=>_0x5879a1[_0x228bb2(0x27d)]);if(_0x3474f9){const _0x1efed5=_0x3474f9[_0x228bb2(0x1e3)](/[.+^${}()|[\]\\]/g,_0x228bb2(0x1ad))[_0x228bb2(0x1e3)](/\*/g,'.*')[_0x228bb2(0x1e3)](/\?/g,'.'),_0x125152=new RegExp('^'+_0x1efed5+'$','i');_0x3a61a9=_0x3a61a9['filter'](_0x55249d=>_0x125152[_0x228bb2(0x23b)](_0x55249d[_0x228bb2(0x1de)]));}_0x3a61a9[_0x228bb2(0x25c)]((_0x3d7a64,_0x571ce6)=>_0x3d7a64['name'][_0x228bb2(0x1e1)](_0x571ce6[_0x228bb2(0x1de)])),console['error']('✔\x20Found\x20'+_0x3a61a9[_0x228bb2(0x23d)]+_0x228bb2(0x122)+(_0x3a61a9[_0x228bb2(0x23d)]!==0x1?'s':''));const _0x3e7d03=_0x356085=>{const _0x14c17b=_0x228bb2;return getConsoleNextUrl(_0x19d672[_0x14c17b(0x29a)],'/app/dw/parentSegments/'+_0x356085);};if(_0x19d672['format']===_0x228bb2(0x124)||_0x19d672[_0x228bb2(0x20c)]==='jsonl'){const _0x11cb4a=_0x3a61a9[_0x228bb2(0x191)](_0x2867fb=>({..._0x2867fb,'url':_0x3e7d03(_0x2867fb['id'])}));await handleSDKOutput(_0x11cb4a,_0x19d672);}else{if(_0x3a61a9[_0x228bb2(0x23d)]===0x0)console[_0x228bb2(0x151)](_0x228bb2(0x134));else for(const _0x2c63e1 of _0x3a61a9){const _0x4dbf72=_0x2c63e1[_0x228bb2(0x1ec)]?a30_0x134bc9[_0x228bb2(0x1d0)]('\x20('+formatRows(_0x2c63e1[_0x228bb2(0x1ec)])+')'):'',_0x5ec475=hyperlink(_0x2c63e1[_0x228bb2(0x1de)],_0x3e7d03(_0x2c63e1['id']));console['log']('⚡\x20'+_0x5ec475+_0x4dbf72);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]=a30_0x1cb568(0x1e8);[a30_0x1cb568(0x1e6)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a30_0x1cb568(0x1a1)](_0x16dcb7){const _0x5fd7bb=a30_0x1cb568,{options:_0x5c4e29,args:_0x53995c,tdx:_0x4bc0b7}=_0x16dcb7,_0x5db9a6=_0x53995c[0x0]||_0x5c4e29[_0x5fd7bb(0x169)];if(!_0x5db9a6)return showParentSegmentNotSetError(_0x5fd7bb(0x212)+_0x5fd7bb(0x174)),0x1;const _0x43228a=resolveYamlFile(_0x5db9a6);if(!existsSync(_0x43228a))return showFileNotFoundError(_0x43228a,_0x5db9a6),0x1;let _0x276fa1;try{_0x276fa1=readFileSync(_0x43228a,'utf-8');}catch(_0x3e0d4f){const _0x2fd404=_0x3e0d4f instanceof Error?_0x3e0d4f[_0x5fd7bb(0x22e)]:String(_0x3e0d4f);return console[_0x5fd7bb(0x19a)](_0x5fd7bb(0x11f)+_0x2fd404),0x1;}const _0x1cf076=createCommandSpinner(a30_0x134bc9['dim'](_0x5fd7bb(0x135)),{'verbose':_0x5c4e29[_0x5fd7bb(0x218)]});_0x1cf076[_0x5fd7bb(0x185)]();const _0x3dbbaf={'realtime':!![],'onProgress':_0x47d7b1=>{const _0x121f47=_0x5fd7bb;_0x1cf076[_0x121f47(0x16b)]=formatProgressMessage(_0x47d7b1);}};let _0x2dc41d;try{_0x2dc41d=await _0x4bc0b7[_0x5fd7bb(0x1d6)][_0x5fd7bb(0x11c)](_0x276fa1,_0x3dbbaf),_0x1cf076[_0x5fd7bb(0x251)]();}catch(_0x52c7c4){_0x1cf076[_0x5fd7bb(0x251)]();throw _0x52c7c4;}console['error']('\x0a'+a30_0x134bc9[_0x5fd7bb(0x144)](_0x5fd7bb(0x189))+'\x20'+_0x2dc41d[_0x5fd7bb(0x1de)]),console['error']('═'['repeat'](0x3c)),displayRealtimeValidation(_0x2dc41d),console[_0x5fd7bb(0x19a)]('─'[_0x5fd7bb(0x259)](0x3c));if(_0x2dc41d[_0x5fd7bb(0x28d)]['length']>0x0){console[_0x5fd7bb(0x19a)]('\x0a'+a30_0x134bc9[_0x5fd7bb(0x224)](_0x5fd7bb(0x1f8)));for(const _0x3b59c6 of _0x2dc41d[_0x5fd7bb(0x28d)]){console['error']('\x20\x20'+a30_0x134bc9[_0x5fd7bb(0x224)]('•')+'\x20'+_0x3b59c6);}}return _0x2dc41d['allValid']&&console[_0x5fd7bb(0x19a)]('\x0a'+a30_0x134bc9['green']('✔')+_0x5fd7bb(0x287)),_0x2dc41d[_0x5fd7bb(0x267)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a30_0x1cb568(0x1c2);['description']=a30_0x1cb568(0x29b);async[a30_0x1cb568(0x1a1)](_0x4b9979){const _0x3842ab=a30_0x1cb568,{options:_0x56b573,args:_0x193659,tdx:_0x5419d5}=_0x4b9979,_0x594ace=_0x193659[0x0]||_0x56b573[_0x3842ab(0x169)];if(!_0x594ace)return showParentSegmentNotSetError(_0x3842ab(0x199)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x1c8588=await withSpinner(_0x3842ab(0x173)+_0x594ace+_0x3842ab(0x190),()=>_0x5419d5[_0x3842ab(0x1d6)][_0x3842ab(0x265)](_0x594ace),{'verbose':_0x56b573[_0x3842ab(0x218)]}),_0x19d594=_0x1c8588['data'],_0x5b47fd=await withSpinner(_0x3842ab(0x1ae)+_0x594ace+_0x3842ab(0x190),()=>_0x5419d5[_0x3842ab(0x201)][_0x3842ab(0x18a)](_0x19d594),{'verbose':_0x56b573[_0x3842ab(0x218)]}),_0x21f400=_0x5b47fd['data'];console[_0x3842ab(0x19a)](_0x3842ab(0x1c0)+_0x21f400[_0x3842ab(0x23d)]+'\x20personalization\x20service'+(_0x21f400[_0x3842ab(0x23d)]!==0x1?'s':''));if(_0x56b573['format']===_0x3842ab(0x124)||_0x56b573[_0x3842ab(0x20c)]===_0x3842ab(0x20b))await handleSDKOutput(_0x21f400,_0x56b573);else{if(_0x21f400[_0x3842ab(0x23d)]===0x0)console[_0x3842ab(0x151)](_0x3842ab(0x156)),console[_0x3842ab(0x19a)](a30_0x134bc9[_0x3842ab(0x276)](_0x3842ab(0x1f1)));else for(const _0x6a1079 of _0x21f400){const _0x39c34d=_0x6a1079[_0x3842ab(0x1a0)]?.['length']||0x0,_0x5dfcb0=_0x6a1079[_0x3842ab(0x255)]?a30_0x134bc9[_0x3842ab(0x1d0)](_0x3842ab(0x271)+_0x6a1079[_0x3842ab(0x255)]):'',_0x89b0e5=a30_0x134bc9[_0x3842ab(0x1d0)]('\x20('+_0x39c34d+_0x3842ab(0x254)+(_0x39c34d!==0x1?'s':'')+')');console[_0x3842ab(0x151)]('\x20\x20'+_0x6a1079['name']+_0x5dfcb0+_0x89b0e5),_0x6a1079['description']&&console[_0x3842ab(0x151)](_0x3842ab(0x1fd)+a30_0x134bc9[_0x3842ab(0x1d0)](_0x6a1079[_0x3842ab(0x1e6)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x1cb568(0x1de)]=a30_0x1cb568(0x175);[a30_0x1cb568(0x1e6)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a30_0x1cb568(0x1a1)](_0x412c78){const _0x22bf25=a30_0x1cb568,{options:_0x58e91c,args:_0x5301fb}=_0x412c78,_0x39616d=_0x5301fb[0x0]||_0x58e91c[_0x22bf25(0x169)];if(!_0x39616d)return showParentSegmentNotSetError(_0x22bf25(0x146)+_0x22bf25(0x216)),0x1;const _0x45970e=resolveYamlFile(_0x39616d);if(!existsSync(_0x45970e))return showFileNotFoundError(_0x45970e,_0x39616d),0x1;let _0x4baef5;try{_0x4baef5=readFileSync(_0x45970e,'utf-8');}catch(_0x593d38){const _0x49b29c=_0x593d38 instanceof Error?_0x593d38[_0x22bf25(0x22e)]:String(_0x593d38);return console['error'](_0x22bf25(0x11f)+_0x49b29c),0x1;}let _0x3649de;try{_0x3649de=parseDef(_0x4baef5);}catch(_0x2ce6e9){const _0x244c5c=_0x2ce6e9 instanceof Error?_0x2ce6e9[_0x22bf25(0x22e)]:String(_0x2ce6e9);return console['error'](a30_0x134bc9['red'](_0x22bf25(0x141)+_0x244c5c)),0x1;}if(_0x3649de[_0x22bf25(0x231)]&&_0x3649de[_0x22bf25(0x231)]['length']>0x0)return console[_0x22bf25(0x19a)](a30_0x134bc9[_0x22bf25(0x155)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x45970e)),console[_0x22bf25(0x19a)](a30_0x134bc9[_0x22bf25(0x1d0)](_0x22bf25(0x1a5)+_0x3649de[_0x22bf25(0x231)][_0x22bf25(0x23d)]+_0x22bf25(0x1b1))),0x1;!_0x3649de['realtime']&&(_0x3649de[_0x22bf25(0x13a)]={'events':[{'name':'page_view','source_table':_0x22bf25(0x149)}],'attributes':[{'name':_0x22bf25(0x16e),'type':_0x22bf25(0x28e)}],'id_stitching':{'primary_key':_0x3649de[_0x22bf25(0x1be)][_0x22bf25(0x13d)]===_0x22bf25(0x232)?_0x22bf25(0x283):_0x22bf25(0x15f)}});_0x3649de[_0x22bf25(0x231)]=[{'name':_0x22bf25(0x19e),'description':_0x22bf25(0x278),'trigger_event':_0x22bf25(0x1b9),'sections':[{'name':_0x22bf25(0x248),'criteria':_0x22bf25(0x1c9),'attributes':[_0x22bf25(0x16e)]}]}];const _0x510482=serializeDef(_0x3649de);return writeFileSync(_0x45970e,_0x510482,_0x22bf25(0x24f)),console[_0x22bf25(0x19a)](a30_0x134bc9[_0x22bf25(0x1eb)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x134bc9['cyan'](_0x45970e)),(!_0x3649de[_0x22bf25(0x13a)]||_0x4baef5[_0x22bf25(0x1a9)]('realtime:')===-0x1)&&console['error'](a30_0x134bc9['green']('✔')+_0x22bf25(0x1f2)),console['error']('\x0a'+a30_0x134bc9['dim'](_0x22bf25(0x121))),console[_0x22bf25(0x19a)]('\x20\x201.\x20Edit\x20'+_0x45970e+_0x22bf25(0x294)),console[_0x22bf25(0x19a)](_0x22bf25(0x217)+a30_0x134bc9[_0x22bf25(0x1d0)](_0x22bf25(0x225)+_0x39616d)+_0x22bf25(0x166)),0x0;}}
|
|
1
|
+
const a30_0xd91a26=a30_0x4886;(function(_0x4ab9c1,_0x3bf7fc){const _0x1d32ab=a30_0x4886,_0x197b00=_0x4ab9c1();while(!![]){try{const _0x2ec00b=parseInt(_0x1d32ab(0x22c))/0x1*(parseInt(_0x1d32ab(0x16f))/0x2)+-parseInt(_0x1d32ab(0x1b5))/0x3*(parseInt(_0x1d32ab(0x100))/0x4)+-parseInt(_0x1d32ab(0x150))/0x5+-parseInt(_0x1d32ab(0x113))/0x6*(-parseInt(_0x1d32ab(0x126))/0x7)+-parseInt(_0x1d32ab(0x11e))/0x8*(-parseInt(_0x1d32ab(0x14b))/0x9)+-parseInt(_0x1d32ab(0x1be))/0xa+-parseInt(_0x1d32ab(0xc8))/0xb*(-parseInt(_0x1d32ab(0x229))/0xc);if(_0x2ec00b===_0x3bf7fc)break;else _0x197b00['push'](_0x197b00['shift']());}catch(_0xe87a4){_0x197b00['push'](_0x197b00['shift']());}}}(a30_0x3888,0xb5397));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x2e0dc0 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';function a30_0x4886(_0x3becc7,_0x3c0314){_0x3becc7=_0x3becc7-0xab;const _0x3888b8=a30_0x3888();let _0x488659=_0x3888b8[_0x3becc7];return _0x488659;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x53e4e0 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0xd91a26(0x1db),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x1950b7){const _0x143b45=a30_0xd91a26,_0x2afb29=process['platform'],_0x247ac0=_0x2afb29===_0x143b45(0xe8)?'open':_0x2afb29==='win32'?_0x143b45(0x20f):_0x143b45(0x10d);spawn(_0x247ac0,[_0x1950b7],{'detached':!![],'stdio':_0x143b45(0x1ba)})[_0x143b45(0x1f3)]();}function migrateLegacyDirectory(){const _0x1e0392=a30_0xd91a26;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0xf5c388=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0xf5c388[_0x1e0392(0x210)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1e0392(0x104)](a30_0x53e4e0['yellow'](_0x1e0392(0x205)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x1e0392(0xc2))),console['error'](a30_0x53e4e0[_0x1e0392(0xbe)](_0x1e0392(0x203)+LEGACY_PARENT_SEGMENT_DIR+_0x1e0392(0xdd))),![];console[_0x1e0392(0x104)](a30_0x53e4e0[_0x1e0392(0x163)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x1e0392(0x1b4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x53e4e0['green'](_0x1e0392(0x15a)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x50ba2c){const _0x5d7e9c=_0x50ba2c instanceof Error?_0x50ba2c[_0x1e0392(0x180)]:String(_0x50ba2c);return console[_0x1e0392(0x104)](a30_0x53e4e0['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x5d7e9c+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x443dac){const _0x3ba192=a30_0xd91a26;return migrateLegacyDirectory(),super[_0x3ba192(0x197)](_0x443dac);}}function resolveYamlFile(_0x70761f){const _0xfa1d53=a30_0xd91a26;if(_0x70761f['endsWith'](_0xfa1d53(0x121))||_0x70761f[_0xfa1d53(0x22d)](_0xfa1d53(0x14e)))return _0x70761f;return a30_0x2e0dc0[_0xfa1d53(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x70761f)+'.yml');}function formatProgressMessage(_0x3fb27b){const _0x982b3f=a30_0xd91a26,_0x4ca249=_0x3fb27b['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4ca249){const [,_0x4445ff,_0x245a3b,_0x18ab5c='']=_0x4ca249;return a30_0x53e4e0[_0x982b3f(0xbe)](_0x4445ff+':')+'\x20'+_0x245a3b+a30_0x53e4e0['dim'](_0x18ab5c);}return a30_0x53e4e0[_0x982b3f(0xbe)](_0x3fb27b);}function showFileNotFoundError(_0x49f1be,_0x5c02ad){const _0x4721d7=a30_0xd91a26;console[_0x4721d7(0x104)](a30_0x53e4e0[_0x4721d7(0x1f5)]('Error:\x20File\x20not\x20found:\x20'+_0x49f1be+'\x0a')),console[_0x4721d7(0x104)](a30_0x53e4e0[_0x4721d7(0x1c3)](_0x4721d7(0x194)+_0x5c02ad+_0x4721d7(0x18c)));}function a30_0x3888(){const _0x4bbcab=['Error\x20parsing\x20YAML:\x20','143HohfhV','Available\x20attributes:','name','✔\x20Query\x20completed:\x20Processed\x20','.customers)','displayMasterInfo','foreignKey','displaySummary','realtime','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Found\x20YAML\x20file:\x20','\x20\x20\x20\x20-\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','jsonl','\x20configured','column','sections','\x5c$&','database','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20total','/\x20directory.\x0a','addBehaviorsFile','processedRows','resolveParentId','replace','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20rows\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','SELECT\x20*\x20FROM\x20','darwin','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','Fetching\x20SQL\x20for\x20\x27','Status:','workflowAttemptId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','master','Options:','/sessions/','ps:rt:list','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','schemaError','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','customers','Fetching\x20parent\x20segment\x20\x27','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20Added\x20RT\x202.0\x20template\x20section','verbose','log','\x20\x20\x20','✔\x20No\x20changes\x20-\x20\x27','all','1241220EWHBZl','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','addAttributesFile','\x20Added\x20personalization\x20template\x20to\x20','error','repeat','stop','displayPreviewResults','Executing\x20parent\x20segment\x20query...','trigger_event','\x20--enriched','Analyzing\x20changes...','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','xdg-open','Site:\x20','listFields','✔\x20Created\x20parent\x20segment\x20\x27','Error:\x20--database\x20and\x20--table\x20are\x20required','Aborted.','2187642YpyHlw','displayColumns','listParents','utf-8','joinKey','Overwrite\x20\x27','segment:parent:list','personalizationServices','Audience\x20ID:','\x20to\x20configure\x20your\x20personalization\x20service','Default','16vhtOTP','Fetching\x20behavior\x20list...','Attributes:','.yml','stitchingKeys','totalEvents','\x27\x20is\x20already\x20up\x20to\x20date','\x22,\x20\x22type\x22:\x20\x22','7cLIaMS','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20field','Validating\x20configuration...','varchar','bold','last_page_viewed','displaySampleData','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','segment:parent:run','Create\x20parent\x20segment\x20\x27','reduce','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20--behavior\x20\x22<name>\x22','use','ps:pz:list','Listing\x20personalization\x20services\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Fetching\x20sample\x20data...','Errors:','scheduleType','attribute','valid','\x20personalization\x20service','green','\x20--interval\x20','Error:','events','updateParent','\x20No\x20changes\x20-\x20','Available\x20behaviors:','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0aChanges\x20to\x20\x27','sampleData','1712376KEhYYH','Updating\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','.yaml','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','6642260SCyAFD','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','segment:parent:preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','getOutputDatabaseName','localeCompare','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','/{name}.yml\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Get\x20SQL\x20query\x20for\x20parent\x20segment','✔\x20Renamed\x20directory\x20to\x20','\x0aError:','ID\x20Stitching:','enabled','\x20RT-enabled\x20parent\x20segment','\x0aNew\x20parent\x20segment\x20\x27','\x27\x20and\x20run\x20workflow?','\x20\x20Columns:\x20','\x20parent\x20segment\x20\x27','yellow','primaryKey','status','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Events:','pullParentYaml','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','text','format','information_schema','Schema\x20saved\x20to\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','40748FwirzQ','\x20behaviors','json','customersWithEvents','displayBehaviorsStats','\x20\x20\x20\x20','string','description','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','in\x20','web','attributes','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20rows)','Error\x20reading\x20file:\x20','trim','test','message','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','matchedCount','errors','displayRealtimeInfo','\x27\x20is\x20up\x20to\x20date','\x20trigger=','jobId','Source:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Updated','Session:','`\x20to\x20download\x20the\x20configuration\x20first','tdx\x20ps\x20preview\x20','previewParentYaml','\x20service','displayAttributesStats','Creating\x20parent\x20segment\x20\x27','getParentSQL','\x20\x20Database:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','No\x20personalization\x20services\x20configured','Master\x20Table','run','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Behaviors','Creating','displayValidateResults','Fetching\x20customers\x20schema...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Parent\x20segment:\x20','No\x20parent\x20segments\x20found','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Personalization:','\x0a\x20\x20\x20\x20]','column_type','Show\x20parent\x20segment\x20details','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','type','FINISHED','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Created','elapsedTimeMillis','\x20Context\x20set:\x20','workflowSessionId','collectSchema','map','execute','page_view','segment:parent:view','scheduleOption','\x0aNo\x20sample\x20data\x20available','/\x20→\x20','6wjsBnq','formatSchemaJson','Name:\x20','Columns:','ps:pz:init','ignore','segment:parent:push','\x20=\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','14482500pOWzfZ','Rows:','column_name','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20Note:\x20','cyan','\x0a✔\x20Workflow\x20started','coveragePercent','rowCount','Enriched:','Master:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','addBehaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','join','stats','Fetching\x20current\x20configuration\x20for\x20\x27','toFixed','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','RT\x202.0:','SELECT\x20*\x20FROM\x20(\x0a','YAML\x20file:\x20','idStitching','attributesFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20is\x20required','realtime_enabled','parent_segments','Output\x20Database:','behavior','columns','Join:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Table:\x20','segment:parent:desc','label','schemaValid','\x20\x20\x20\x20\x20\x20','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','Join\x20on:','\x27\x20with\x20ID:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','List\x20available\x20fields\x20for\x20segmentation','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20RT\x20configuration\x20is\x20valid','sourceTableValid','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Listing\x20parent\x20segments...','data','preview','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','unref','yes','red','Behavior:','Coverage:','\x22\x20}','population','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','true','Apply\x20changes\x20to\x20\x27','parent_segment','Master\x20+\x20Attributes','\x20section','sourceTableError','To\x20view\x20sample\x20data:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','segment','\x0a⚠️\x20\x20Both\x20','timezone','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','apply','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','customerGroupFile','session','parent_id','behavior_','enriched','start','isDirectory','segment:parent:pull','output','Validating\x20RT\x20configuration...','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20parent\x20segment','personalization_services','Pattern:\x20','toLowerCase','/app/dw/parentSegments/','tdx\x20ps\x20push\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','pushParentYaml','Listing\x20fields\x20for\x20\x27','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Updating','behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','audienceId','realtime:','-1d','workflowId','Personalization\x20service\x20description','\x20--attribute\x20\x22','2870064ONQcKq','/attempt/','list','14EWIdtB','endsWith','site','Database:\x20','Attempt:','segment:parent:create','allValid','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x20\x201.\x20Edit\x20','Options:\x0a','getParentFull','segment:parent:validate','\x27...','\x20Opening\x20','length','Preview:','👥\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','dirname','using\x20the\x20default\x20path:\x20','customerPercent','td_client_id','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','<database>.<table>','validateParentYaml','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','filter','parentSegment','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','getBehaviorNames','dim','\x20--behavior\x20\x22','customerGroup','interval','/\x20directories\x20exist.','table','displayPreviewHints','%)\x20','indexOf'];a30_0x3888=function(){return _0x4bbcab;};return a30_0x3888();}function displayRealtimeValidation(_0x59b9f1){const _0x2bf647=a30_0xd91a26;if(!_0x59b9f1[_0x2bf647(0xd0)])return;const _0x193fcb=_0x59b9f1[_0x2bf647(0xd0)],_0x484507=_0x193fcb[_0x2bf647(0x15d)]?a30_0x53e4e0[_0x2bf647(0x13f)]('⚡\x20Enabled'):a30_0x53e4e0[_0x2bf647(0x163)]('⚡\x20Not\x20enabled');console[_0x2bf647(0x104)]('\x0a'+a30_0x53e4e0['dim'](_0x2bf647(0x1d2))+'\x20'+_0x484507);if(_0x193fcb[_0x2bf647(0x142)]&&_0x193fcb[_0x2bf647(0x142)]['length']>0x0){console[_0x2bf647(0x104)]('\x20\x20'+a30_0x53e4e0[_0x2bf647(0xbe)](_0x2bf647(0x167))+'\x20'+_0x193fcb['events'][_0x2bf647(0xae)]+_0x2bf647(0xd6));for(const _0x294d2f of _0x193fcb[_0x2bf647(0x142)]){const _0x3a710c=_0x294d2f[_0x2bf647(0x1ed)]===![]?a30_0x53e4e0[_0x2bf647(0x1f5)]('✘'):a30_0x53e4e0[_0x2bf647(0x13f)]('✔');console[_0x2bf647(0x104)](_0x2bf647(0x174)+_0x3a710c+'\x20'+_0x294d2f[_0x2bf647(0xca)]),_0x294d2f['sourceTableError']&&console[_0x2bf647(0x104)](_0x2bf647(0x1e5)+a30_0x53e4e0[_0x2bf647(0x1f5)](_0x294d2f[_0x2bf647(0x201)]));}}if(_0x193fcb[_0x2bf647(0x17a)]&&_0x193fcb[_0x2bf647(0x17a)][_0x2bf647(0xae)]>0x0){console[_0x2bf647(0x104)]('\x20\x20'+a30_0x53e4e0[_0x2bf647(0xbe)](_0x2bf647(0x120))+'\x20'+_0x193fcb['attributes']['length']+_0x2bf647(0xd6));for(const _0x51880a of _0x193fcb['attributes']){const _0x3109f9=_0x51880a[_0x2bf647(0x13d)]?a30_0x53e4e0[_0x2bf647(0x13f)]('✔'):a30_0x53e4e0[_0x2bf647(0x1f5)]('✘');console[_0x2bf647(0x104)]('\x20\x20\x20\x20'+_0x3109f9+'\x20'+_0x51880a[_0x2bf647(0xca)]+'\x20'+a30_0x53e4e0['dim']('('+_0x51880a['type']+')'));}}if(_0x193fcb[_0x2bf647(0x1d5)]){const _0x301155=_0x193fcb['idStitching'][_0x2bf647(0x122)]?.['length']?'\x20+\x20['+_0x193fcb[_0x2bf647(0x1d5)][_0x2bf647(0x122)][_0x2bf647(0x1cd)](',\x20')+']':'';console[_0x2bf647(0x104)]('\x20\x20'+a30_0x53e4e0[_0x2bf647(0xbe)](_0x2bf647(0x15c))+'\x20'+_0x193fcb[_0x2bf647(0x1d5)][_0x2bf647(0x164)]+_0x301155);}if(_0x193fcb[_0x2bf647(0x11a)]&&_0x193fcb[_0x2bf647(0x11a)][_0x2bf647(0xae)]>0x0){console[_0x2bf647(0x104)]('\x20\x20'+a30_0x53e4e0[_0x2bf647(0xbe)](_0x2bf647(0x1a1))+'\x20'+_0x193fcb['personalizationServices']['length']+_0x2bf647(0x18f)+(_0x193fcb['personalizationServices'][_0x2bf647(0xae)]!==0x1?'s':''));for(const _0x53ba36 of _0x193fcb['personalizationServices']){console[_0x2bf647(0x104)](_0x2bf647(0xd3)+_0x53ba36[_0x2bf647(0xca)]);}}}function showParentSegmentNotSetError(_0x745b1f){const _0x53505d=a30_0xd91a26;console[_0x53505d(0x104)](a30_0x53e4e0[_0x53505d(0x163)](_0x53505d(0x1a8))),console[_0x53505d(0x104)](_0x745b1f);}export class ParentSegmentListCommand extends BaseCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x119);[a30_0xd91a26(0x176)]='List\x20parent\x20segments';async[a30_0xd91a26(0x1af)](_0x149d47){const _0x37ca76=a30_0xd91a26,{options:_0x5ea511,args:_0x5a343c,tdx:_0x5d9d94}=_0x149d47,_0x184381=_0x5a343c[0x0];_0x5ea511['verbose']&&(console[_0x37ca76(0x104)]('Site:\x20'+_0x5ea511['site']),_0x184381&&console[_0x37ca76(0x104)](_0x37ca76(0x218)+_0x184381));const _0x1e0538=await withSpinner(_0x184381?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x184381+_0x37ca76(0xac):_0x37ca76(0x1ef),()=>_0x5d9d94[_0x37ca76(0x204)][_0x37ca76(0x115)](),{'verbose':_0x5ea511[_0x37ca76(0xfb)]});let _0xbbd340=_0x1e0538[_0x37ca76(0x1f0)];if(_0x184381){const _0x25477b=_0x184381[_0x37ca76(0xe1)](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x53ed8b=new RegExp('^'+_0x25477b+'$','i');_0xbbd340=_0xbbd340[_0x37ca76(0xba)](_0x16287e=>_0x53ed8b[_0x37ca76(0x17f)](_0x16287e[_0x37ca76(0x17a)][_0x37ca76(0xca)]));}_0xbbd340['sort']((_0x5dfe35,_0x4958c4)=>_0x5dfe35[_0x37ca76(0x17a)]['name'][_0x37ca76(0x155)](_0x4958c4[_0x37ca76(0x17a)][_0x37ca76(0xca)])),console['error'](_0x37ca76(0xf5)+_0xbbd340[_0x37ca76(0xae)]+_0x37ca76(0x216)+(_0xbbd340[_0x37ca76(0xae)]!==0x1?'s':''));const _0x1ff70d=_0x5b9b0f=>{const _0x2eb08c=_0x37ca76;return getConsoleNextUrl(_0x5ea511['site'],_0x2eb08c(0x21a)+_0x5b9b0f);};if(_0x5ea511[_0x37ca76(0x16b)]===_0x37ca76(0x171)||_0x5ea511[_0x37ca76(0x16b)]===_0x37ca76(0xd5)){const _0x44239d=_0xbbd340[_0x37ca76(0x1ae)](_0x4f5070=>({..._0x4f5070,'url':_0x1ff70d(_0x4f5070['id'])}));await handleSDKOutput(_0x44239d,_0x5ea511);}else{if(_0xbbd340[_0x37ca76(0xae)]===0x0)_0x184381?console[_0x37ca76(0xfc)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x184381):console['log'](_0x37ca76(0x19f));else for(const _0xdd4376 of _0xbbd340){const _0x312e42=_0xdd4376[_0x37ca76(0x17a)][_0x37ca76(0x1f9)]?a30_0x53e4e0['dim']('\x20('+formatRows(_0xdd4376['attributes'][_0x37ca76(0x1f9)])+')'):'',_0x5076f4=hyperlink(_0xdd4376[_0x37ca76(0x17a)][_0x37ca76(0xca)],_0x1ff70d(_0xdd4376['id']));console[_0x37ca76(0xfc)](_0x37ca76(0xb0)+_0x5076f4+_0x312e42);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x231);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x132);async['execute'](_0x18111f){const _0x3ae06b=a30_0xd91a26,{options:_0x42a0ae,args:_0x10a0c3,tdx:_0x77e1c2}=_0x18111f;console[_0x3ae06b(0x104)](_0x3ae06b(0x1a5)+_0x3ae06b(0xdb)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x3f0f64=_0x42a0ae;if(_0x10a0c3[_0x3ae06b(0xae)]===0x0)return console['error'](a30_0x53e4e0[_0x3ae06b(0x1f5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3ae06b(0x104)](_0x3ae06b(0xd1)),0x1;const _0x2370b9=_0x10a0c3[0x0];if(!_0x3f0f64[_0x3ae06b(0xda)]||!_0x3f0f64[_0x3ae06b(0xc3)])return console[_0x3ae06b(0x104)](_0x3ae06b(0x111)),console[_0x3ae06b(0x104)](_0x3ae06b(0xd1)),0x1;_0x3f0f64[_0x3ae06b(0xfb)]&&(console[_0x3ae06b(0x104)]('Site:\x20'+_0x3f0f64[_0x3ae06b(0x22e)]),console[_0x3ae06b(0x104)](_0x3ae06b(0x1b7)+_0x2370b9),console[_0x3ae06b(0x104)](_0x3ae06b(0x22f)+_0x3f0f64[_0x3ae06b(0xda)]),console[_0x3ae06b(0x104)](_0x3ae06b(0x1e1)+_0x3f0f64[_0x3ae06b(0xc3)]));const _0x1e8dd8=await loadJSONFromOptions(_0x3f0f64[_0x3ae06b(0x17a)],_0x3f0f64[_0x3ae06b(0x1d6)]),_0x389813=await loadJSONFromOptions(_0x3f0f64['behaviors'],_0x3f0f64['behaviorsFile']),_0x3ed5ee=await loadJSONFromOptions(_0x3f0f64[_0x3ae06b(0xc0)],_0x3f0f64[_0x3ae06b(0x20a)]),_0x2cf265={'name':_0x2370b9,'description':_0x3f0f64[_0x3ae06b(0x176)],'scheduleType':_0x3f0f64[_0x3ae06b(0x13b)],'scheduleOption':_0x3f0f64[_0x3ae06b(0x1b2)],'timezone':_0x3f0f64[_0x3ae06b(0x206)],'master':{'parentDatabaseName':_0x3f0f64[_0x3ae06b(0xda)],'parentTableName':_0x3f0f64['table']},'attributes':_0x1e8dd8,'behaviors':_0x389813,'customerGroup':_0x3ed5ee},_0x10b821=await withSpinner(_0x3ae06b(0x191)+_0x2370b9+'\x27...',()=>_0x77e1c2['segment']['createParent'](_0x2cf265),{'verbose':_0x42a0ae[_0x3ae06b(0xfb)]}),_0x5819f2=_0x10b821[_0x3ae06b(0x1f0)];return console[_0x3ae06b(0x104)](_0x3ae06b(0x110)+_0x5819f2[_0x3ae06b(0xca)]+_0x3ae06b(0x1e8)+_0x5819f2['id']),await handleSDKOutput([_0x5819f2],_0x42a0ae),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0xd91a26(0xca)]='segment:parent:update';[a30_0xd91a26(0x176)]=a30_0xd91a26(0xd4);async[a30_0xd91a26(0x1af)](_0x542de3){const _0x240380=a30_0xd91a26,{options:_0x3bb530,args:_0x5d3046,tdx:_0x307a6b}=_0x542de3;console['error'](_0x240380(0x1eb)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x240380(0x147));const _0xaf5ae7=_0x3bb530;if(_0x5d3046[_0x240380(0xae)]===0x0)return console[_0x240380(0x104)](a30_0x53e4e0[_0x240380(0x1f5)](_0x240380(0x1d9))),console[_0x240380(0x104)](_0x240380(0x215)),0x1;const _0x1c09fa=_0x5d3046[0x0];_0xaf5ae7[_0x240380(0xfb)]&&(console[_0x240380(0x104)]('Site:\x20'+_0xaf5ae7[_0x240380(0x22e)]),console[_0x240380(0x104)](_0x240380(0x19e)+_0x1c09fa));const _0x45d563=await withSpinner(_0x240380(0x1cf)+_0x1c09fa+'\x27...',()=>_0x307a6b[_0x240380(0x204)][_0x240380(0x237)](_0x1c09fa),{'verbose':_0xaf5ae7['verbose']}),_0x50d00=_0x45d563[_0x240380(0x1f0)],_0x4939b8=await loadJSONFromOptions(_0xaf5ae7['addAttributes'],_0xaf5ae7[_0x240380(0x102)]),_0x56d703=await loadJSONFromOptions(_0xaf5ae7[_0x240380(0x1ca)],_0xaf5ae7[_0x240380(0xde)]),_0x4f707a={'name':_0x50d00[_0x240380(0xca)],'description':_0xaf5ae7['description']!==undefined?_0xaf5ae7[_0x240380(0x176)]:_0x50d00[_0x240380(0x176)],'scheduleType':_0xaf5ae7[_0x240380(0x13b)]!==undefined?_0xaf5ae7[_0x240380(0x13b)]:_0x50d00[_0x240380(0x13b)],'scheduleOption':_0xaf5ae7['scheduleOption']!==undefined?_0xaf5ae7[_0x240380(0x1b2)]:_0x50d00['scheduleOption'],'timezone':_0xaf5ae7[_0x240380(0x206)]!==undefined?_0xaf5ae7[_0x240380(0x206)]:_0x50d00[_0x240380(0x206)],'master':_0x50d00[_0x240380(0xee)],'attributes':_0x4939b8?[..._0x50d00[_0x240380(0x17a)]||[],..._0x4939b8]:_0x50d00[_0x240380(0x17a)],'behaviors':_0x56d703?[..._0x50d00['behaviors']||[],..._0x56d703]:_0x50d00[_0x240380(0x221)],'customerGroup':_0x50d00['customerGroup']},_0xcc9853=await withSpinner(_0x240380(0x14c)+_0x1c09fa+'\x27...',()=>_0x307a6b['segment'][_0x240380(0x143)](_0x1c09fa,_0x4f707a),{'verbose':_0xaf5ae7[_0x240380(0xfb)]}),_0x2a15b0=_0xcc9853[_0x240380(0x1f0)];return console[_0x240380(0x104)](_0x240380(0x1cc)+_0x2a15b0[_0x240380(0xca)]+'\x27'),await handleSDKOutput([_0x2a15b0],_0xaf5ae7),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x211);['description']=a30_0xd91a26(0x16e);async[a30_0xd91a26(0x1af)](_0x47cef2){const _0x160a72=a30_0xd91a26,{options:_0x506cc3,args:_0x53cc41,tdx:_0x4ddcf7}=_0x47cef2,_0x273201=_0x506cc3,_0x153b36=_0x53cc41[0x0]||_0x506cc3[_0x160a72(0xbb)];if(!_0x153b36)return showParentSegmentNotSetError(_0x160a72(0x19d)+_0x160a72(0x14d)),0x1;if(_0x273201[_0x160a72(0x134)]&&_0x273201[_0x160a72(0x212)])return console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0x1f5)](_0x160a72(0x189))),console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0xbe)](_0x160a72(0x21f))),console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0xbe)](_0x160a72(0xb3)+PARENT_SEGMENT_DIR+_0x160a72(0x157))),console[_0x160a72(0x104)](a30_0x53e4e0['cyan'](_0x160a72(0xe2))),0x1;const _0x418a63=_0x273201[_0x160a72(0x212)]||a30_0x2e0dc0[_0x160a72(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x153b36)+_0x160a72(0x121));_0x273201[_0x160a72(0xfb)]&&(console['error'](_0x160a72(0x10e)+_0x273201[_0x160a72(0x22e)]),console[_0x160a72(0x104)](_0x160a72(0x19e)+_0x153b36),console[_0x160a72(0x104)]('Output\x20file:\x20'+_0x418a63));const _0x155623=await withSpinner(_0x160a72(0xf8)+_0x153b36+_0x160a72(0xac),()=>_0x4ddcf7['segment'][_0x160a72(0x168)](_0x153b36),{'verbose':_0x273201[_0x160a72(0xfb)]}),_0x13fff0=_0x155623[_0x160a72(0x1f0)];if(existsSync(_0x418a63)){const _0x5a2041=readFileSync(_0x418a63,_0x160a72(0x116)),_0x26e71b=generateDiff(_0x5a2041,_0x13fff0);if(!hasChanges(_0x26e71b))console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0x13f)]('✔')+_0x160a72(0x144)+a30_0x53e4e0[_0x160a72(0x1c3)](_0x418a63)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x160a72(0x104)](_0x160a72(0x149)+_0x418a63+'\x27:'),console[_0x160a72(0x104)]('─'['repeat'](0x3c)),console[_0x160a72(0x104)](formatDiffWithColors(_0x26e71b)),console[_0x160a72(0x104)]('─'[_0x160a72(0x105)](0x3c));if(!_0x273201['yes']){if(!isInteractive())return console[_0x160a72(0x104)](a30_0x53e4e0['red'](_0x160a72(0x15b)),_0x160a72(0xbc)),console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0xbe)](_0x160a72(0x1c9))),0x1;const _0x327e8c=await confirmKey(_0x160a72(0x118)+_0x418a63+'\x27?');if(!_0x327e8c)return console['error'](a30_0x53e4e0[_0x160a72(0x163)](_0x160a72(0x112))),0x1;}writeFileSync(_0x418a63,_0x13fff0,_0x160a72(0x116)),console[_0x160a72(0x104)](a30_0x53e4e0[_0x160a72(0x13f)]('✔')+_0x160a72(0x222)+a30_0x53e4e0[_0x160a72(0x1c3)](_0x418a63));}}else{const _0x152380=a30_0x2e0dc0[_0x160a72(0xb2)](_0x418a63);!existsSync(_0x152380)&&mkdirSync(_0x152380,{'recursive':!![]}),writeFileSync(_0x418a63,_0x13fff0,_0x160a72(0x116)),console['error'](a30_0x53e4e0['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x53e4e0['cyan'](_0x418a63));}return saveSessionContext({'parent_segment':_0x153b36},_0x273201[_0x160a72(0x20b)]),console['error'](a30_0x53e4e0[_0x160a72(0x13f)]('✔')+_0x160a72(0x1ab)+a30_0x53e4e0[_0x160a72(0xbe)](_0x160a72(0x1fe))+_0x160a72(0x1bc)+a30_0x53e4e0[_0x160a72(0x1c3)](_0x153b36)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x1bb);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x158);async[a30_0xd91a26(0x1af)](_0x5eafdc){const _0x12b6a7=a30_0xd91a26,{options:_0x4fba57,args:_0x52d8dc,tdx:_0x1bcb91}=_0x5eafdc,_0x253c1d=_0x4fba57,_0x265d30=_0x52d8dc[0x0]||_0x4fba57[_0x12b6a7(0xbb)];if(!_0x265d30)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x12b6a7(0x153)),0x1;const _0x305ab6=resolveYamlFile(_0x265d30);if(!existsSync(_0x305ab6))return showFileNotFoundError(_0x305ab6,_0x265d30),0x1;_0x253c1d[_0x12b6a7(0xfb)]&&(console[_0x12b6a7(0x104)](_0x12b6a7(0x10e)+_0x253c1d[_0x12b6a7(0x22e)]),console['error'](_0x12b6a7(0x1d4)+_0x305ab6));let _0xeae75d;try{_0xeae75d=readFileSync(_0x305ab6,_0x12b6a7(0x116));}catch(_0x3e4fa1){const _0x4fe616=_0x3e4fa1 instanceof Error?_0x3e4fa1[_0x12b6a7(0x180)]:String(_0x3e4fa1);return console[_0x12b6a7(0x104)](_0x12b6a7(0x17d)+_0x4fe616),0x1;}const _0x1587f1=await withSpinner(_0x12b6a7(0x10b),()=>_0x1bcb91[_0x12b6a7(0x204)][_0x12b6a7(0x21d)](_0xeae75d),{'verbose':_0x253c1d[_0x12b6a7(0xfb)]}),_0xb52f8f=_0x1587f1['data'],{isNew:_0x3beb75,name:_0x4d6179,hasChanges:_0x587ba9,diffFormatted:_0x584589}=_0xb52f8f;if(!_0x587ba9)return console[_0x12b6a7(0x104)](_0x12b6a7(0xfe)+_0x4d6179+_0x12b6a7(0x124)),0x0;_0x3beb75?console[_0x12b6a7(0x104)](_0x12b6a7(0x15f)+_0x4d6179+'\x27:'):console[_0x12b6a7(0x104)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x4d6179+'\x27:');console[_0x12b6a7(0x104)]('─'[_0x12b6a7(0x105)](0x3c)),console[_0x12b6a7(0x104)](_0x584589),console['error']('─'[_0x12b6a7(0x105)](0x3c));const _0x1d1826=_0x3beb75?_0x12b6a7(0x130)+_0x4d6179+'\x27?':_0x12b6a7(0x1fd)+_0x4d6179+'\x27?';if(!_0x253c1d[_0x12b6a7(0x1f4)]){if(!isInteractive())return console[_0x12b6a7(0x104)](a30_0x53e4e0[_0x12b6a7(0x1f5)](_0x12b6a7(0x15b)),_0x12b6a7(0xbc)),console[_0x12b6a7(0x104)](a30_0x53e4e0[_0x12b6a7(0xbe)](_0x12b6a7(0x1c9))),0x1;const _0xa4ba06=await confirmKey(_0x1d1826);if(!_0xa4ba06)return console[_0x12b6a7(0x104)](a30_0x53e4e0[_0x12b6a7(0x163)](_0x12b6a7(0x112))),0x1;}const _0x506e28=_0x3beb75?'Creating':'Updating',_0x2691be=await withSpinner(_0x506e28+_0x12b6a7(0x162)+_0x4d6179+_0x12b6a7(0xac),()=>_0xb52f8f[_0x12b6a7(0x208)](),{'verbose':_0x253c1d[_0x12b6a7(0xfb)]}),_0x534056=_0x2691be[_0x12b6a7(0x1f0)],_0x1d5ee1=getConsoleNextUrl(_0x253c1d['site'],_0x12b6a7(0x21a)+_0x534056['id']),_0x5d3653=_0x3beb75?_0x12b6a7(0x1a9):_0x12b6a7(0x18a);return console['error']('✔\x20'+_0x5d3653+_0x12b6a7(0x162)+_0x534056[_0x12b6a7(0xca)]+'\x27'),console[_0x12b6a7(0x104)]('\x20\x20'+_0x1d5ee1),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0xd91a26(0xab);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x1f2);async[a30_0xd91a26(0x1af)](_0x3bc99d){const _0x2f475c=a30_0xd91a26,{options:_0xd33948,args:_0x17525c,tdx:_0x49b14b}=_0x3bc99d,_0x3b6950=_0xd33948,_0x20f71f=_0x17525c[0x0]||_0xd33948[_0x2f475c(0xbb)];if(!_0x20f71f)return showParentSegmentNotSetError(_0x2f475c(0x21c)+'\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'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x2f475c(0x101)),0x1;const _0x35731f=resolveYamlFile(_0x20f71f);if(!existsSync(_0x35731f))return showFileNotFoundError(_0x35731f,_0x20f71f),0x1;_0x3b6950[_0x2f475c(0xfb)]&&(console[_0x2f475c(0x104)]('Site:\x20'+_0x3b6950['site']),console[_0x2f475c(0x104)](_0x2f475c(0x1d4)+_0x35731f));let _0x18f96e;try{_0x18f96e=readFileSync(_0x35731f,_0x2f475c(0x116));}catch(_0x331bb5){const _0x1d22d4=_0x331bb5 instanceof Error?_0x331bb5[_0x2f475c(0x180)]:String(_0x331bb5);return console[_0x2f475c(0x104)](_0x2f475c(0x17d)+_0x1d22d4),0x1;}const _0x9a26f=createCommandSpinner(a30_0x53e4e0[_0x2f475c(0xbe)](_0x2f475c(0x129)),{'verbose':_0x3b6950[_0x2f475c(0xfb)]});_0x9a26f[_0x2f475c(0x20f)]();const _0x32d55b={'onProgress':_0x450e6c=>{const _0x35cb6b=_0x2f475c;_0x9a26f[_0x35cb6b(0x16a)]=formatProgressMessage(_0x450e6c);}};if(_0x3b6950[_0x2f475c(0xee)])_0x32d55b[_0x2f475c(0xee)]=!![];if(_0x3b6950[_0x2f475c(0x20e)])_0x32d55b['enriched']=!![];_0x3b6950['attribute']&&(_0x32d55b['attribute']=_0x3b6950[_0x2f475c(0x13c)]);_0x3b6950['behavior']&&(_0x32d55b['behavior']=_0x3b6950[_0x2f475c(0x1dd)]);if(_0x3b6950[_0x2f475c(0xc1)])_0x32d55b[_0x2f475c(0xc1)]=_0x3b6950[_0x2f475c(0xc1)];let _0x3f4dc2;try{_0x3f4dc2=await _0x49b14b[_0x2f475c(0x204)][_0x2f475c(0xb8)](_0x18f96e,_0x32d55b),_0x9a26f[_0x2f475c(0x106)]();}catch(_0x29b22e){_0x9a26f[_0x2f475c(0x106)]();throw _0x29b22e;}const _0x3a34a6=_0x3b6950['interval']||_0x2f475c(0x225);return this['displayValidateResults'](_0x3f4dc2,_0x32d55b,_0x35731f,_0x3a34a6),_0x3f4dc2[_0x2f475c(0x232)]?0x0:0x1;}[a30_0xd91a26(0x19b)](_0x80ec6a,_0x1b00d5,_0x2efb6c,_0x18b37a){const _0x5a61c4=a30_0xd91a26;console[_0x5a61c4(0x104)]('\x0a'+a30_0x53e4e0[_0x5a61c4(0x12b)]('Validate:')+'\x20'+_0x80ec6a[_0x5a61c4(0xca)]),console[_0x5a61c4(0x104)]('═'[_0x5a61c4(0x105)](0x3c)),this['displayMasterInfo'](_0x80ec6a);if(typeof _0x1b00d5[_0x5a61c4(0x13c)]==='string'){this['displayAttributesStats'](_0x80ec6a),this['displaySummary'](_0x80ec6a),this['displayPreviewHints'](_0x2efb6c,_0x18b37a,'attribute',_0x1b00d5[_0x5a61c4(0x13c)]);return;}if(_0x1b00d5[_0x5a61c4(0x13c)]===!![]){this[_0x5a61c4(0x190)](_0x80ec6a),this['displaySummary'](_0x80ec6a),this[_0x5a61c4(0xc4)](_0x2efb6c,_0x18b37a,_0x5a61c4(0x17a));return;}if(typeof _0x1b00d5[_0x5a61c4(0x1dd)]===_0x5a61c4(0x175)){this['displayBehaviorsStats'](_0x80ec6a,_0x18b37a),this[_0x5a61c4(0xcf)](_0x80ec6a),this[_0x5a61c4(0xc4)](_0x2efb6c,_0x18b37a,_0x5a61c4(0x1dd),_0x1b00d5[_0x5a61c4(0x1dd)]);return;}if(_0x1b00d5[_0x5a61c4(0x1dd)]===!![]){this[_0x5a61c4(0x173)](_0x80ec6a,_0x18b37a),this['displaySummary'](_0x80ec6a),this['displayPreviewHints'](_0x2efb6c,_0x18b37a,_0x5a61c4(0x221));return;}this[_0x5a61c4(0x190)](_0x80ec6a),this[_0x5a61c4(0x173)](_0x80ec6a,_0x18b37a),this[_0x5a61c4(0x184)](_0x80ec6a),this[_0x5a61c4(0xcf)](_0x80ec6a),this[_0x5a61c4(0xc4)](_0x2efb6c,_0x18b37a,_0x5a61c4(0xff));}[a30_0xd91a26(0x184)](_0xfaf70a){displayRealtimeValidation(_0xfaf70a);}[a30_0xd91a26(0xc4)](_0x237060,_0x3c5b92,_0x3fe4a2,_0x58f8f6){const _0xe96f9f=a30_0xd91a26;console[_0xe96f9f(0x104)]('\x0a'+a30_0x53e4e0['dim'](_0xe96f9f(0x202)));const _0x3b6302=_0x3c5b92!==_0xe96f9f(0x225)?_0xe96f9f(0x140)+_0x3c5b92:'';if(_0x3fe4a2===_0xe96f9f(0x13c)&&_0x58f8f6)console[_0xe96f9f(0x104)]('\x20\x20'+a30_0x53e4e0[_0xe96f9f(0xbe)](_0xe96f9f(0x18d)+_0x237060+_0xe96f9f(0x228)+_0x58f8f6+'\x22'+_0x3b6302));else{if(_0x3fe4a2===_0xe96f9f(0x1dd)&&_0x58f8f6)console[_0xe96f9f(0x104)]('\x20\x20'+a30_0x53e4e0[_0xe96f9f(0xbe)]('tdx\x20ps\x20preview\x20'+_0x237060+_0xe96f9f(0xbf)+_0x58f8f6+'\x22'+_0x3b6302));else(_0x3fe4a2==='attributes'||_0x3fe4a2==='all')&&console[_0xe96f9f(0x104)]('\x20\x20'+a30_0x53e4e0[_0xe96f9f(0xbe)](_0xe96f9f(0x18d)+_0x237060+'\x20--attribute\x20\x22<name>\x22'+_0x3b6302));}(_0x3fe4a2===_0xe96f9f(0x221)||_0x3fe4a2===_0xe96f9f(0xff))&&console[_0xe96f9f(0x104)]('\x20\x20'+a30_0x53e4e0['dim']('tdx\x20ps\x20preview\x20'+_0x237060+_0xe96f9f(0x133)+_0x3b6302)),_0x3fe4a2===_0xe96f9f(0xff)&&console['error']('\x20\x20'+a30_0x53e4e0['dim']('tdx\x20ps\x20preview\x20'+_0x237060+_0xe96f9f(0x10a)+_0x3b6302));}[a30_0xd91a26(0xcd)](_0x5e8c0e){const _0x34cc5d=a30_0xd91a26,{master:_0x4c4d3d}=_0x5e8c0e,_0x15f39=_0x4c4d3d[_0x34cc5d(0x1e4)]?a30_0x53e4e0[_0x34cc5d(0x13f)]('✔'):a30_0x53e4e0[_0x34cc5d(0x1f5)]('✘');console[_0x34cc5d(0x104)]('\x0a'+a30_0x53e4e0[_0x34cc5d(0xbe)](_0x34cc5d(0x196))),console[_0x34cc5d(0x104)](_0x15f39+'\x20'+a30_0x53e4e0[_0x34cc5d(0x12b)](_0x4c4d3d[_0x34cc5d(0xda)]+'.'+_0x4c4d3d['table'])),_0x4c4d3d[_0x34cc5d(0x1e4)]?_0x4c4d3d['rowCount']!==undefined&&console[_0x34cc5d(0x104)]('\x20\x20'+a30_0x53e4e0[_0x34cc5d(0xbe)](_0x34cc5d(0x1bf))+'\x20'+a30_0x53e4e0[_0x34cc5d(0x1c3)](formatRows(_0x4c4d3d[_0x34cc5d(0x1c6)]))):console[_0x34cc5d(0x104)]('\x20\x20'+a30_0x53e4e0[_0x34cc5d(0x1f5)](_0x34cc5d(0x141))+'\x20'+_0x4c4d3d['schemaError']);}['displayAttributesStats'](_0x2bede0){const _0x121938=a30_0xd91a26;if(_0x2bede0[_0x121938(0x17a)][_0x121938(0xae)]===0x0)return;console[_0x121938(0x104)]('\x0a'+a30_0x53e4e0[_0x121938(0xbe)]('Attributes'));for(const _0x2e3a34 of _0x2bede0[_0x121938(0x17a)]){const _0x1f8f91=_0x2e3a34[_0x121938(0x1e4)]?a30_0x53e4e0[_0x121938(0x13f)]('✔'):a30_0x53e4e0['red']('✘');let _0x541738='';if(_0x2e3a34[_0x121938(0x1e4)]&&_0x2e3a34[_0x121938(0x182)]!==undefined&&_0x2e3a34[_0x121938(0x1c5)]!==undefined){const _0x5e9d1f=_0x2e3a34['coveragePercent'][_0x121938(0x1d0)](0x1),_0x432c54=_0x2e3a34['coveragePercent']>=0x50?a30_0x53e4e0['green']:_0x2e3a34[_0x121938(0x1c5)]>=0x32?a30_0x53e4e0[_0x121938(0x163)]:a30_0x53e4e0[_0x121938(0x1f5)];_0x541738='\x20'+a30_0x53e4e0['dim'](_0x121938(0x1f7))+'\x20'+_0x432c54(_0x5e9d1f+'%')+'\x20('+formatRows(_0x2e3a34['matchedCount'])+_0x121938(0x17c);}console['error'](_0x1f8f91+'\x20'+a30_0x53e4e0['bold'](_0x2e3a34[_0x121938(0xca)])+_0x541738),console[_0x121938(0x104)]('\x20\x20'+a30_0x53e4e0[_0x121938(0xbe)](_0x121938(0x188))+'\x20'+a30_0x53e4e0['bold'](_0x2e3a34[_0x121938(0xda)]+'.'+_0x2e3a34[_0x121938(0xc3)]));const _0xabaf4f=_0x2e3a34['joinKey']===_0x2e3a34[_0x121938(0xce)]?a30_0x53e4e0[_0x121938(0xbe)]('Join\x20on:')+'\x20'+_0x2e3a34[_0x121938(0x117)]:a30_0x53e4e0['dim']('Join:')+'\x20'+_0x2e3a34[_0x121938(0x117)]+_0x121938(0x1bc)+_0x2e3a34[_0x121938(0xce)];console[_0x121938(0x104)]('\x20\x20'+_0xabaf4f),console[_0x121938(0x104)]('\x20\x20'+a30_0x53e4e0[_0x121938(0xbe)](_0x121938(0x1b8))),this['displayColumns'](_0x2e3a34['columns']),!_0x2e3a34['schemaValid']&&console[_0x121938(0x104)]('\x20\x20'+a30_0x53e4e0[_0x121938(0x1f5)](_0x121938(0x141))+'\x20'+_0x2e3a34[_0x121938(0xf4)]);}}[a30_0xd91a26(0x173)](_0x2f8ceb,_0x4575f5){const _0x211993=a30_0xd91a26;if(_0x2f8ceb['behaviors'][_0x211993(0xae)]===0x0)return;console[_0x211993(0x104)]('\x0a'+a30_0x53e4e0[_0x211993(0xbe)](_0x211993(0x199))+'\x20'+a30_0x53e4e0[_0x211993(0xbe)]('('+_0x4575f5+')'));for(const _0x203b5d of _0x2f8ceb[_0x211993(0x221)]){const _0x5f4856=_0x203b5d[_0x211993(0x1e4)]?a30_0x53e4e0[_0x211993(0x13f)]('✔'):a30_0x53e4e0[_0x211993(0x1f5)]('✘');let _0x48bc6c='';if(_0x203b5d['schemaValid']&&_0x203b5d['customersWithEvents']!==undefined&&_0x203b5d[_0x211993(0x123)]!==undefined){const _0x29ac09=_0x203b5d[_0x211993(0xb4)]?.['toFixed'](0x1)||'?',_0x362828=(_0x203b5d[_0x211993(0xb4)]??0x0)>=0x32?a30_0x53e4e0[_0x211993(0x13f)]:(_0x203b5d[_0x211993(0xb4)]??0x0)>=0x14?a30_0x53e4e0[_0x211993(0x163)]:a30_0x53e4e0[_0x211993(0x1f5)];_0x48bc6c='\x20'+a30_0x53e4e0['dim']('Customers:')+'\x20'+_0x362828(formatRows(_0x203b5d[_0x211993(0x172)]))+'\x20('+_0x29ac09+_0x211993(0xc5)+a30_0x53e4e0[_0x211993(0xbe)]('Events:')+'\x20'+a30_0x53e4e0[_0x211993(0x1c3)](formatRows(_0x203b5d[_0x211993(0x123)]));}console[_0x211993(0x104)](_0x5f4856+'\x20'+a30_0x53e4e0[_0x211993(0x12b)](_0x203b5d['name'])+_0x48bc6c),console['error']('\x20\x20'+a30_0x53e4e0['dim'](_0x211993(0x188))+'\x20'+a30_0x53e4e0['bold'](_0x203b5d[_0x211993(0xda)]+'.'+_0x203b5d['table']));const _0x26b20a=_0x203b5d[_0x211993(0x117)]===_0x203b5d[_0x211993(0xce)]?a30_0x53e4e0[_0x211993(0xbe)](_0x211993(0x1e7))+'\x20'+_0x203b5d[_0x211993(0x117)]:a30_0x53e4e0['dim'](_0x211993(0x1df))+'\x20'+_0x203b5d['joinKey']+'\x20=\x20'+_0x203b5d['foreignKey'];console[_0x211993(0x104)]('\x20\x20'+_0x26b20a),console['error']('\x20\x20'+a30_0x53e4e0[_0x211993(0xbe)](_0x211993(0x1b8))),this[_0x211993(0x114)](_0x203b5d[_0x211993(0x1de)]),!_0x203b5d['schemaValid']&&console[_0x211993(0x104)]('\x20\x20'+a30_0x53e4e0[_0x211993(0x1f5)](_0x211993(0x141))+'\x20'+_0x203b5d[_0x211993(0xf4)]);}}[a30_0xd91a26(0x114)](_0x5a8f8a){const _0x7f25fb=a30_0xd91a26;for(const _0x92cfbb of _0x5a8f8a){_0x92cfbb[_0x7f25fb(0x1e3)]===_0x92cfbb[_0x7f25fb(0xd7)]||_0x92cfbb[_0x7f25fb(0xd7)]==='*'?console['error'](_0x7f25fb(0xd3)+_0x92cfbb[_0x7f25fb(0x1e3)]):console[_0x7f25fb(0x104)](_0x7f25fb(0xd3)+_0x92cfbb[_0x7f25fb(0x1e3)]+'\x20'+a30_0x53e4e0[_0x7f25fb(0xbe)]('('+_0x92cfbb[_0x7f25fb(0xd7)]+')'));}}['displaySummary'](_0x2a96cc){const _0x39988f=a30_0xd91a26;console[_0x39988f(0x104)]('─'[_0x39988f(0x105)](0x3c));if(_0x2a96cc[_0x39988f(0x183)][_0x39988f(0xae)]>0x0){console[_0x39988f(0x104)]('\x0a'+a30_0x53e4e0['red']('Errors:'));for(const _0xe0fe67 of _0x2a96cc[_0x39988f(0x183)]){console[_0x39988f(0x104)]('\x20\x20'+a30_0x53e4e0[_0x39988f(0x1f5)]('•')+'\x20'+_0xe0fe67);}}_0x2a96cc[_0x39988f(0x232)]&&console[_0x39988f(0x104)]('\x0a'+a30_0x53e4e0['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x152);[a30_0xd91a26(0x176)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a30_0xd91a26(0x1af)](_0x14a2a5){const _0x39d8a1=a30_0xd91a26,{options:_0x3067fb,args:_0xb26934,tdx:_0x10bd28}=_0x14a2a5,_0x36e613=_0x3067fb,_0x35e479=_0xb26934[0x0]||_0x3067fb[_0x39d8a1(0xbb)];if(!_0x35e479)return showParentSegmentNotSetError(_0x39d8a1(0x12e)+_0x39d8a1(0x156)+'Options\x20(one\x20required):\x0a'+_0x39d8a1(0x138)+_0x39d8a1(0x177)+_0x39d8a1(0x10c)+_0x39d8a1(0xf2)+_0x39d8a1(0x101)),0x1;if(!_0x36e613[_0x39d8a1(0xee)]&&!_0x36e613['attribute']&&!_0x36e613['behavior']&&!_0x36e613[_0x39d8a1(0x20e)])return console[_0x39d8a1(0x104)](a30_0x53e4e0[_0x39d8a1(0x1f5)](_0x39d8a1(0x1fb))),console[_0x39d8a1(0x104)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x39d8a1(0x104)](_0x39d8a1(0xef)),console[_0x39d8a1(0x104)](_0x39d8a1(0xf3)),console[_0x39d8a1(0x104)](_0x39d8a1(0x209)),console[_0x39d8a1(0x104)](_0x39d8a1(0xb6)),console[_0x39d8a1(0x104)](_0x39d8a1(0x1d1)),0x1;const _0x112fbe=resolveYamlFile(_0x35e479);if(!existsSync(_0x112fbe))return showFileNotFoundError(_0x112fbe,_0x35e479),0x1;_0x36e613[_0x39d8a1(0xfb)]&&(console['error'](_0x39d8a1(0x10e)+_0x36e613[_0x39d8a1(0x22e)]),console[_0x39d8a1(0x104)](_0x39d8a1(0x1d4)+_0x112fbe));let _0x4743a3;try{_0x4743a3=readFileSync(_0x112fbe,'utf-8');}catch(_0x14ee4e){const _0x49fc48=_0x14ee4e instanceof Error?_0x14ee4e[_0x39d8a1(0x180)]:String(_0x14ee4e);return console['error'](_0x39d8a1(0x17d)+_0x49fc48),0x1;}let _0x2c108a;try{_0x2c108a=parseDef(_0x4743a3);}catch(_0x43739c){const _0x415558=_0x43739c instanceof Error?_0x43739c['message']:String(_0x43739c);return console['error'](a30_0x53e4e0[_0x39d8a1(0x1f5)](_0x39d8a1(0xc7)+_0x415558)),0x1;}if(_0x36e613['attribute']===!![]||_0x36e613['attribute']===''){const _0x391c22=_0x2c108a['attributes']?.[_0x39d8a1(0x1ae)](_0x545484=>_0x545484[_0x39d8a1(0xca)])||[];if(_0x391c22[_0x39d8a1(0xae)]===0x0)console[_0x39d8a1(0x104)](a30_0x53e4e0[_0x39d8a1(0x1f5)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a30_0x53e4e0[_0x39d8a1(0x1f5)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x39d8a1(0xc9));for(const _0x5edfee of _0x391c22){console[_0x39d8a1(0x104)]('\x20\x20'+a30_0x53e4e0[_0x39d8a1(0x1c3)](_0x5edfee));}console['error'](_0x39d8a1(0xe6)+_0x35e479+'\x20--attribute\x20\x22'+_0x391c22[0x0]+'\x22');}return 0x1;}if(_0x36e613['behavior']===!![]||_0x36e613[_0x39d8a1(0x1dd)]===''){const _0x1520ff=_0x2c108a[_0x39d8a1(0x221)]?.[_0x39d8a1(0x1ae)](_0x2cc695=>_0x2cc695[_0x39d8a1(0xca)])||[];if(_0x1520ff[_0x39d8a1(0xae)]===0x0)console[_0x39d8a1(0x104)](a30_0x53e4e0[_0x39d8a1(0x1f5)](_0x39d8a1(0xb9)));else{console[_0x39d8a1(0x104)](a30_0x53e4e0[_0x39d8a1(0x1f5)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x39d8a1(0x104)](_0x39d8a1(0x145));for(const _0x16b467 of _0x1520ff){console['error']('\x20\x20'+a30_0x53e4e0[_0x39d8a1(0x1c3)](_0x16b467));}console[_0x39d8a1(0x104)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x35e479+_0x39d8a1(0xbf)+_0x1520ff[0x0]+'\x22');}return 0x1;}const _0xa93ac8=createCommandSpinner(a30_0x53e4e0['dim'](_0x39d8a1(0x139)),{'verbose':_0x36e613[_0x39d8a1(0xfb)]});_0xa93ac8['start']();const _0x358c04={'onProgress':_0x2d6aa8=>{const _0x38734d=_0x39d8a1;_0xa93ac8[_0x38734d(0x16a)]=formatProgressMessage(_0x2d6aa8);}};if(_0x36e613[_0x39d8a1(0xee)])_0x358c04[_0x39d8a1(0xee)]=!![];if(_0x36e613[_0x39d8a1(0x13c)]&&typeof _0x36e613[_0x39d8a1(0x13c)]==='string')_0x358c04[_0x39d8a1(0x13c)]=_0x36e613[_0x39d8a1(0x13c)];if(_0x36e613[_0x39d8a1(0x1dd)]&&typeof _0x36e613[_0x39d8a1(0x1dd)]===_0x39d8a1(0x175))_0x358c04[_0x39d8a1(0x1dd)]=_0x36e613[_0x39d8a1(0x1dd)];if(_0x36e613[_0x39d8a1(0x20e)])_0x358c04[_0x39d8a1(0x20e)]=!![];if(_0x36e613['interval'])_0x358c04[_0x39d8a1(0xc1)]=_0x36e613[_0x39d8a1(0xc1)];let _0x3c2c64;try{_0x3c2c64=await _0x10bd28[_0x39d8a1(0x204)][_0x39d8a1(0x18e)](_0x4743a3,_0x358c04),_0xa93ac8[_0x39d8a1(0x106)]();}catch(_0x2b0ba1){_0xa93ac8[_0x39d8a1(0x106)]();throw _0x2b0ba1;}return await this[_0x39d8a1(0x107)](_0x3c2c64,{'master':_0x36e613[_0x39d8a1(0xee)],'attribute':typeof _0x36e613['attribute']===_0x39d8a1(0x175)?_0x36e613[_0x39d8a1(0x13c)]:undefined,'behavior':typeof _0x36e613[_0x39d8a1(0x1dd)]==='string'?_0x36e613[_0x39d8a1(0x1dd)]:undefined,'enriched':_0x36e613[_0x39d8a1(0x20e)]}),_0x3c2c64['allValid']?0x0:0x1;}async[a30_0xd91a26(0x107)](_0x22aada,_0x1939de){const _0x42200f=a30_0xd91a26;console[_0x42200f(0x104)]('\x0a'+a30_0x53e4e0[_0x42200f(0x12b)](_0x42200f(0xaf))+'\x20'+_0x22aada[_0x42200f(0xca)]),console['error']('═'[_0x42200f(0x105)](0x3c));if(_0x1939de[_0x42200f(0xee)]&&_0x22aada[_0x42200f(0x14a)]){const _0x5d3911=a30_0x53e4e0[_0x42200f(0xbe)](_0x42200f(0x1c8))+'\x20'+a30_0x53e4e0[_0x42200f(0x12b)](_0x22aada['master'][_0x42200f(0xda)]+'.'+_0x22aada['master'][_0x42200f(0xc3)]);await this['displaySampleData'](_0x5d3911,_0x22aada[_0x42200f(0x14a)]);}else{if(_0x1939de[_0x42200f(0x13c)]&&_0x22aada[_0x42200f(0x14a)]){const _0x4b6017=a30_0x53e4e0[_0x42200f(0xbe)]('Attribute:')+'\x20'+a30_0x53e4e0[_0x42200f(0x12b)](_0x1939de['attribute']);await this[_0x42200f(0x12d)](_0x4b6017,_0x22aada[_0x42200f(0x14a)]);}else{if(_0x1939de['behavior']&&_0x22aada[_0x42200f(0x14a)]){const _0x3bbf84=a30_0x53e4e0['dim'](_0x42200f(0x1f6))+'\x20'+a30_0x53e4e0['bold'](_0x1939de[_0x42200f(0x1dd)]);await this[_0x42200f(0x12d)](_0x3bbf84,_0x22aada[_0x42200f(0x14a)]);}else{if(_0x1939de['enriched']&&_0x22aada[_0x42200f(0x14a)]){const _0x7b75fd=a30_0x53e4e0[_0x42200f(0xbe)](_0x42200f(0x1c7))+'\x20'+a30_0x53e4e0[_0x42200f(0x12b)](_0x42200f(0x1ff));await this[_0x42200f(0x12d)](_0x7b75fd,_0x22aada['sampleData']);}else!_0x22aada[_0x42200f(0x14a)]&&console['error'](_0x42200f(0x1b3));}}}if(_0x22aada[_0x42200f(0x183)][_0x42200f(0xae)]>0x0){console[_0x42200f(0x104)]('─'[_0x42200f(0x105)](0x3c)),console[_0x42200f(0x104)]('\x0a'+a30_0x53e4e0[_0x42200f(0x1f5)](_0x42200f(0x13a)));for(const _0x254200 of _0x22aada[_0x42200f(0x183)]){console[_0x42200f(0x104)]('\x20\x20'+a30_0x53e4e0[_0x42200f(0x1f5)]('•')+'\x20'+_0x254200);}}}async[a30_0xd91a26(0x12d)](_0x2e3229,_0x41a4ed){const _0x3d8051=a30_0xd91a26;if(_0x41a4ed['length']===0x0){console[_0x3d8051(0x104)]('\x0a'+_0x2e3229),console[_0x3d8051(0x104)]('\x20\x20No\x20sample\x20data\x20available');return;}console['error']('\x0a'+_0x2e3229);const _0x75a326=Object['keys'](_0x41a4ed[0x0])['map'](_0x35eb39=>({'name':_0x35eb39,'type':typeof _0x41a4ed[0x0][_0x35eb39]==='number'?'double':_0x3d8051(0x12a)})),_0x4ef141={'queryId':_0x3d8051(0x1f1),'columns':_0x75a326,'data':_0x41a4ed,'stats':{'state':_0x3d8051(0x1a7),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x41a4ed['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3727b2=formatAsTable(_0x4ef141,_0x41a4ed[_0x3d8051(0xae)],!![]);await writeOutput(_0x3727b2,undefined,_0x3d8051(0xc3));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x12f);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x1e9);async['execute'](_0x2abd64){const _0x44cd63=a30_0xd91a26,{options:_0x5bb23c,args:_0x563467,tdx:_0x1adc9a}=_0x2abd64,_0x2b3b24=_0x5bb23c,_0x286a2d=_0x563467[0x0]||_0x5bb23c['parentSegment'];if(!_0x286a2d)return showParentSegmentNotSetError(_0x44cd63(0x148)+_0x44cd63(0x137)),0x1;const _0x239adc=resolveYamlFile(_0x286a2d);if(existsSync(_0x239adc)){_0x2b3b24[_0x44cd63(0xfb)]&&console['error'](_0x44cd63(0xd2)+_0x239adc);let _0x1ddfca;try{_0x1ddfca=readFileSync(_0x239adc,'utf-8');}catch(_0x4b06b6){const _0x59b99f=_0x4b06b6 instanceof Error?_0x4b06b6['message']:String(_0x4b06b6);return console[_0x44cd63(0x104)](_0x44cd63(0x17d)+_0x59b99f),0x1;}const _0x1422af=await withSpinner(_0x44cd63(0x10b),()=>_0x1adc9a[_0x44cd63(0x204)]['pushParentYaml'](_0x1ddfca),{'verbose':_0x2b3b24[_0x44cd63(0xfb)]}),_0x3dbf80=_0x1422af[_0x44cd63(0x1f0)],{isNew:_0x5c880b,name:_0x2f1563,hasChanges:_0xfa4b36,diffFormatted:_0x41411a}=_0x3dbf80;if(_0xfa4b36){_0x5c880b?console['error'](_0x44cd63(0x15f)+_0x2f1563+'\x27:'):console[_0x44cd63(0x104)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x2f1563+'\x27:');console[_0x44cd63(0x104)]('─'['repeat'](0x3c)),console[_0x44cd63(0x104)](_0x41411a),console[_0x44cd63(0x104)]('─'[_0x44cd63(0x105)](0x3c));const _0x31cddf=_0x5c880b?_0x44cd63(0x130)+_0x2f1563+_0x44cd63(0x160):'Apply\x20changes\x20to\x20\x27'+_0x2f1563+_0x44cd63(0x160);if(!_0x2b3b24[_0x44cd63(0x1f4)]){if(!isInteractive())return console[_0x44cd63(0x104)](a30_0x53e4e0[_0x44cd63(0x1f5)](_0x44cd63(0x15b)),_0x44cd63(0xbc)),console['error'](a30_0x53e4e0[_0x44cd63(0xbe)](_0x44cd63(0x1c9))),0x1;const _0x9444ac=await confirmKey(_0x31cddf);if(!_0x9444ac)return console[_0x44cd63(0x104)](a30_0x53e4e0[_0x44cd63(0x163)](_0x44cd63(0x112))),0x1;}const _0x1d2b31=_0x5c880b?_0x44cd63(0x19a):_0x44cd63(0x220);await withSpinner(_0x1d2b31+'\x20parent\x20segment\x20\x27'+_0x2f1563+'\x27...',()=>_0x3dbf80[_0x44cd63(0x208)](),{'verbose':_0x2b3b24[_0x44cd63(0xfb)]});const _0x393ccd=_0x5c880b?_0x44cd63(0x1a9):'Updated';console[_0x44cd63(0x104)]('✔\x20'+_0x393ccd+'\x20parent\x20segment\x20\x27'+_0x2f1563+'\x27');}else console['error'](_0x44cd63(0xfe)+_0x2f1563+_0x44cd63(0x185));}const _0x63f7d3=await withSpinner(_0x44cd63(0xe4)+_0x286a2d+'\x27...',()=>_0x1adc9a[_0x44cd63(0x204)]['runParent'](_0x286a2d),{'verbose':_0x2b3b24[_0x44cd63(0xfb)]}),_0x2e1dea=_0x63f7d3[_0x44cd63(0x1f0)],_0x25c36d=getConsoleUrl(_0x2b3b24['site'],'/app/workflows/'+_0x2e1dea[_0x44cd63(0x226)]+_0x44cd63(0xf0)+_0x2e1dea[_0x44cd63(0x1ac)]+_0x44cd63(0x22a)+_0x2e1dea[_0x44cd63(0xec)]);return console['error'](_0x44cd63(0x1c4)),console[_0x44cd63(0x104)]('\x20\x20'+a30_0x53e4e0[_0x44cd63(0xbe)](_0x44cd63(0x11b))+'\x20'+_0x2e1dea[_0x44cd63(0x223)]),console[_0x44cd63(0x104)]('\x20\x20'+a30_0x53e4e0[_0x44cd63(0xbe)](_0x44cd63(0xeb))+'\x20'+_0x2e1dea[_0x44cd63(0x165)]),console[_0x44cd63(0x104)]('\x20\x20'+a30_0x53e4e0[_0x44cd63(0xbe)](_0x44cd63(0x18b))+'\x20'+_0x2e1dea[_0x44cd63(0x1ac)]),console['error']('\x20\x20'+a30_0x53e4e0[_0x44cd63(0xbe)](_0x44cd63(0x230))+'\x20'+_0x2e1dea[_0x44cd63(0xec)]),console[_0x44cd63(0x104)]('\x20\x20'+_0x25c36d),console[_0x44cd63(0x104)]('\x0a'+a30_0x53e4e0[_0x44cd63(0xbe)]('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0x2e1dea[_0x44cd63(0xec)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0xd91a26(0xca)]='segment:parent:fields';['description']=a30_0xd91a26(0x1ea);async[a30_0xd91a26(0x1af)](_0xc53be2){const _0x9e581a=a30_0xd91a26,{options:_0x2f3d18,args:_0x21a0cd,tdx:_0x553c10}=_0xc53be2,_0x5addc5=_0x21a0cd[0x0]||_0x2f3d18[_0x9e581a(0xbb)];if(!_0x5addc5)return showParentSegmentNotSetError(_0x9e581a(0x166)+_0x9e581a(0x1e0)),0x1;_0x2f3d18['verbose']&&(console[_0x9e581a(0x104)](_0x9e581a(0x10e)+_0x2f3d18[_0x9e581a(0x22e)]),console['error'](_0x9e581a(0x19e)+_0x5addc5));const _0x52ee06=await withSpinner(_0x9e581a(0x21e)+_0x5addc5+_0x9e581a(0xac),()=>_0x553c10[_0x9e581a(0x204)][_0x9e581a(0x10f)](_0x5addc5),{'verbose':_0x2f3d18[_0x9e581a(0xfb)]}),_0x19b6b4=_0x52ee06[_0x9e581a(0x1f0)];console[_0x9e581a(0x104)](_0x9e581a(0xf5)+_0x19b6b4[_0x9e581a(0xae)]+_0x9e581a(0x128)+(_0x19b6b4[_0x9e581a(0xae)]!==0x1?'s':''));if(_0x2f3d18['json']||_0x2f3d18['jsonl'])return await handleSDKOutput(_0x19b6b4,_0x2f3d18),0x0;return displayFieldsHumanReadable(_0x19b6b4,_0x5addc5),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x1b1);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x1a4);async[a30_0xd91a26(0x1af)](_0x23e0e5){const _0x310b9b=a30_0xd91a26,{options:_0x4b83d7,args:_0x1e326e,tdx:_0x87e00d}=_0x23e0e5,_0x52b82e=_0x4b83d7,_0x4ad47e=_0x1e326e[0x0]||_0x4b83d7['parentSegment'];if(!_0x4ad47e)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x310b9b(0x1cb)+'Options:\x0a'+_0x310b9b(0x17b)),0x1;_0x4b83d7[_0x310b9b(0xfb)]&&(console['error'](_0x310b9b(0x10e)+_0x4b83d7[_0x310b9b(0x22e)]),console[_0x310b9b(0x104)](_0x310b9b(0x19e)+_0x4ad47e));const _0x3d243f=await withSpinner(_0x310b9b(0xf8)+_0x4ad47e+_0x310b9b(0xac),()=>_0x87e00d[_0x310b9b(0x204)][_0x310b9b(0x237)](_0x4ad47e),{'verbose':_0x4b83d7['verbose']}),_0x2605ae=_0x3d243f[_0x310b9b(0x1f0)];if(_0x52b82e[_0x310b9b(0x179)]){const _0x32e5a2=getConsoleNextUrl(_0x52b82e[_0x310b9b(0x22e)],_0x310b9b(0x21a)+_0x2605ae['id']);return console['error'](a30_0x53e4e0[_0x310b9b(0x13f)]('✔')+_0x310b9b(0xad)+a30_0x53e4e0[_0x310b9b(0x1c3)](_0x32e5a2)),openBrowser(_0x32e5a2),0x0;}return await handleSingleObjectOutput(_0x2605ae,_0x4b83d7),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x1e2);['description']=a30_0xd91a26(0x198);async['execute'](_0x4197ee){const _0x5ea1ca=a30_0xd91a26,{options:_0x3daa63,args:_0x3cffd,tdx:_0x42a5bf}=_0x4197ee,_0x3ab3c9=_0x3daa63,_0x1f4ea8=_0x3cffd[0x0]||_0x3daa63[_0x5ea1ca(0xbb)];if(!_0x1f4ea8)return showParentSegmentNotSetError(_0x5ea1ca(0x214)+_0x5ea1ca(0x207)+_0x5ea1ca(0x236)+_0x5ea1ca(0x233)),0x1;_0x3daa63[_0x5ea1ca(0xfb)]&&(console[_0x5ea1ca(0x104)](_0x5ea1ca(0x10e)+_0x3daa63[_0x5ea1ca(0x22e)]),console['error']('Parent\x20segment:\x20'+_0x1f4ea8));const _0x475f5a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1f4ea8+_0x5ea1ca(0xac),()=>_0x42a5bf['segment']['resolveParentId'](_0x1f4ea8),{'verbose':_0x3daa63[_0x5ea1ca(0xfb)]}),_0x2d1ad9=_0x475f5a['data'],_0x4eb16e=_0x42a5bf[_0x5ea1ca(0x204)][_0x5ea1ca(0x154)](_0x2d1ad9);if(_0x3ab3c9[_0x5ea1ca(0x212)]){const _0x98ca3=await this[_0x5ea1ca(0x1ad)](_0x4197ee,_0x1f4ea8,_0x2d1ad9,_0x4eb16e),_0x899e63=this['formatSchemaJson'](_0x98ca3);writeFileSync(_0x3ab3c9['output'],_0x899e63);const _0x146f6a=_0x98ca3[_0x5ea1ca(0xf7)]['columns'][_0x5ea1ca(0xae)]+_0x98ca3[_0x5ea1ca(0x221)][_0x5ea1ca(0x131)]((_0x44e298,_0x1a2a09)=>_0x44e298+_0x1a2a09[_0x5ea1ca(0x1de)][_0x5ea1ca(0xae)],0x0),_0x595df3=_0x98ca3[_0x5ea1ca(0x221)][_0x5ea1ca(0xba)](_0x2c5240=>_0x2c5240[_0x5ea1ca(0x1de)][_0x5ea1ca(0xae)]===0x0)[_0x5ea1ca(0xae)];return console[_0x5ea1ca(0xfc)](_0x5ea1ca(0x16d)+_0x3ab3c9[_0x5ea1ca(0x212)]),console[_0x5ea1ca(0xfc)](_0x5ea1ca(0x193)+_0x4eb16e),console[_0x5ea1ca(0xfc)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x98ca3['behaviors'][_0x5ea1ca(0xae)]+_0x5ea1ca(0x170)),console[_0x5ea1ca(0xfc)](_0x5ea1ca(0x161)+_0x146f6a+_0x5ea1ca(0xdc)),_0x595df3>0x0&&console['log'](_0x5ea1ca(0x1c2)+_0x595df3+_0x5ea1ca(0xf9)),0x0;}console['error']('\x0a'+a30_0x53e4e0['bold'](_0x5ea1ca(0x1dc))+'\x20'+a30_0x53e4e0[_0x5ea1ca(0x1c3)](_0x4eb16e));const _0x1a454a=await withSpinner(_0x5ea1ca(0x19c),()=>_0x42a5bf[_0x5ea1ca(0x204)]['getParentSQL'](_0x2d1ad9),{'verbose':_0x3daa63[_0x5ea1ca(0xfb)]});console['error']('\x0a'+a30_0x53e4e0['bold'](_0x5ea1ca(0xf7))+'\x20'+a30_0x53e4e0['dim']('('+_0x4eb16e+_0x5ea1ca(0xcc)));const _0x3ffe19=await executeSchemaQuery(_0x1a454a[_0x5ea1ca(0x1f0)],_0x42a5bf,_0x3daa63);await handleQueryOutput(_0x3ffe19,_0x3daa63);const _0x40eaea=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x42a5bf['segment'][_0x5ea1ca(0xbd)](_0x2d1ad9),{'verbose':_0x3daa63[_0x5ea1ca(0xfb)]});for(const _0x158a90 of _0x40eaea[_0x5ea1ca(0x1f0)]){const _0x52fbcc=_0x5ea1ca(0x20d)+_0x158a90[_0x5ea1ca(0x219)]()[_0x5ea1ca(0xe1)](/\s+/g,'_'),_0x5c7b19=_0x5ea1ca(0xe7)+_0x4eb16e+'.'+_0x52fbcc;console[_0x5ea1ca(0x104)]('\x0a'+a30_0x53e4e0['bold'](_0x158a90)+'\x20'+a30_0x53e4e0[_0x5ea1ca(0xbe)]('('+_0x4eb16e+'.'+_0x52fbcc+')'));try{const _0x3c0159=await executeSchemaQuery(_0x5c7b19,_0x42a5bf,_0x3daa63);await handleQueryOutput(_0x3c0159,_0x3daa63);}catch{console[_0x5ea1ca(0x104)](a30_0x53e4e0[_0x5ea1ca(0x163)](_0x5ea1ca(0xe5)));}}return 0x0;}async[a30_0xd91a26(0x1ad)](_0x8a20b5,_0x10789d,_0x35d1e9,_0x4bee2a){const _0x1a0b08=a30_0xd91a26,{options:_0x1dffa1,tdx:_0x21295d}=_0x8a20b5,_0x4243ba=await withSpinner(_0x1a0b08(0x19c),()=>_0x21295d[_0x1a0b08(0x204)][_0x1a0b08(0x192)](_0x35d1e9),{'verbose':_0x1dffa1[_0x1a0b08(0xfb)]}),_0x7c56a=await executeSchemaQuery(_0x4243ba[_0x1a0b08(0x1f0)],_0x21295d,_0x1dffa1),_0x532151=_0x7c56a[_0x1a0b08(0x1f0)][_0x1a0b08(0x1ae)](_0x162d5d=>({'name':_0x162d5d[_0x1a0b08(0x1c0)],'type':_0x162d5d[_0x1a0b08(0x1a3)]})),_0x19ce2e=await withSpinner(_0x1a0b08(0x11f),()=>_0x21295d[_0x1a0b08(0x204)][_0x1a0b08(0xbd)](_0x35d1e9),{'verbose':_0x1dffa1['verbose']}),_0x5c507c=[];for(const _0x1640dd of _0x19ce2e[_0x1a0b08(0x1f0)]){const _0x1c44b9=_0x1a0b08(0x20d)+_0x1640dd[_0x1a0b08(0x219)]()[_0x1a0b08(0xe1)](/\s+/g,'_'),_0x5f324f=_0x1a0b08(0xe7)+_0x4bee2a+'.'+_0x1c44b9;let _0x4637de=[];try{const _0x3240f0=await executeSchemaQuery(_0x5f324f,_0x21295d,_0x1dffa1);_0x4637de=_0x3240f0[_0x1a0b08(0x1f0)][_0x1a0b08(0x1ae)](_0x516399=>({'name':_0x516399['column_name'],'type':_0x516399[_0x1a0b08(0x1a3)]}));}catch{}_0x5c507c['push']({'table':_0x1c44b9,'columns':_0x4637de});}return{'database':_0x4bee2a,'parent_segment':_0x10789d,'parent_id':_0x35d1e9,'customers':{'table':_0x1a0b08(0xf7),'columns':_0x532151},'behaviors':_0x5c507c};}[a30_0xd91a26(0x1b6)](_0x274e41){const _0xa64a51=a30_0xd91a26,_0xbb4298=_0x266bd5=>{const _0x56707c=a30_0x4886;if(_0x266bd5[_0x56707c(0xae)]===0x0)return'[]';const _0x19bf68=_0x266bd5['map'](_0x5dd314=>_0x56707c(0xf6)+_0x5dd314['name']+_0x56707c(0x125)+_0x5dd314[_0x56707c(0x1a6)]+_0x56707c(0x1f8));return'[\x0a'+_0x19bf68['join'](',\x0a')+_0x56707c(0x1a2);},_0x3288a0=_0x274e41['behaviors'][_0xa64a51(0x1ae)](_0x4a9dc6=>{const _0x3d9b89=_0xa64a51;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x4a9dc6[_0x3d9b89(0xc3)]+_0x3d9b89(0x127)+_0xbb4298(_0x4a9dc6[_0x3d9b89(0x1de)])['replace'](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20\x20\x20}';})['join'](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x274e41['database']+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x274e41[_0xa64a51(0x1fe)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x274e41[_0xa64a51(0x20c)]+_0xa64a51(0x1c1)+_0x274e41['customers']['table']+_0xa64a51(0x1ee)+_0xbb4298(_0x274e41[_0xa64a51(0xf7)][_0xa64a51(0x1de)])[_0xa64a51(0xe1)](/^/gm,'\x20\x20')[_0xa64a51(0x17e)]()+_0xa64a51(0x1bd)+_0x3288a0+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0xd91a26(0xca)]='segment:parent:sql';['description']=a30_0xd91a26(0x159);async[a30_0xd91a26(0x1af)](_0x174687){const _0x358a23=a30_0xd91a26,{options:_0x2075d3,args:_0x3f3962,tdx:_0x187c52}=_0x174687,_0x4a26da=_0x3f3962[0x0]||_0x2075d3[_0x358a23(0xbb)];if(!_0x4a26da)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\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;_0x2075d3[_0x358a23(0xfb)]&&(console[_0x358a23(0x104)](_0x358a23(0x10e)+_0x2075d3[_0x358a23(0x22e)]),console['error'](_0x358a23(0x19e)+_0x4a26da));const _0x4963c4=await withSpinner(_0x358a23(0x146)+_0x4a26da+_0x358a23(0xac),()=>_0x187c52['segment']['resolveParentId'](_0x4a26da),{'verbose':_0x2075d3['verbose']}),_0x5530f5=_0x4963c4[_0x358a23(0x1f0)],_0x47b5fb=await withSpinner(_0x358a23(0xea)+_0x4a26da+_0x358a23(0xac),()=>_0x187c52[_0x358a23(0x204)]['getParentSQL'](_0x5530f5),{'verbose':_0x2075d3[_0x358a23(0xfb)]}),_0x4896de=_0x47b5fb[_0x358a23(0x1f0)];return _0x2075d3[_0x358a23(0x16b)]===_0x358a23(0x171)||_0x2075d3['format']===_0x358a23(0xd5)?await handleSDKOutput([{'sql':_0x4896de}],_0x2075d3):console[_0x358a23(0xfc)](_0x4896de),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']='segment:parent:show';['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a30_0xd91a26(0x1af)](_0x2e3abd){const _0x58cb04=a30_0xd91a26,{options:_0x11f781,args:_0x1869f9,tdx:_0x289e75}=_0x2e3abd,_0x4d13c2=_0x1869f9[0x0]||_0x11f781['parentSegment'];if(!_0x4d13c2)return showParentSegmentNotSetError(_0x58cb04(0x1fa)+_0x58cb04(0x1d8)),0x1;_0x11f781['verbose']&&(console[_0x58cb04(0x104)](_0x58cb04(0x10e)+_0x11f781[_0x58cb04(0x22e)]),console['error']('Parent\x20segment:\x20'+_0x4d13c2));const _0x5d8a44=await withSpinner(_0x58cb04(0x146)+_0x4d13c2+_0x58cb04(0xac),()=>_0x289e75['segment']['resolveParentId'](_0x4d13c2),{'verbose':_0x11f781['verbose']}),_0x5a9c5b=_0x5d8a44[_0x58cb04(0x1f0)],_0x40a51b=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4d13c2+_0x58cb04(0xac),()=>_0x289e75[_0x58cb04(0x204)][_0x58cb04(0x192)](_0x5a9c5b),{'verbose':_0x11f781[_0x58cb04(0xfb)]});let _0x1eb0e0=_0x40a51b['data'];const _0x573eae=resolveLimit(_0x11f781['limit'],DEFAULT_DISPLAY_LIMIT),_0x21c73c=/\bLIMIT\s+\d+/i[_0x58cb04(0x17f)](_0x1eb0e0);!_0x21c73c&&(_0x1eb0e0=_0x1eb0e0['trim']()[_0x58cb04(0xe1)](/;+$/,''),_0x1eb0e0=_0x58cb04(0x1d3)+_0x1eb0e0+_0x58cb04(0xed)+_0x573eae);_0x11f781[_0x58cb04(0xfb)]&&console[_0x58cb04(0x104)]('SQL\x20query:\x0a'+_0x1eb0e0);const _0x945900=await withProgressSpinner(_0x58cb04(0x108),async _0x3f4051=>{const _0x2b44e1=_0x58cb04,_0x33a5dd=await _0x289e75['query'][_0x2b44e1(0x1af)](_0x1eb0e0,{'catalog':'td','schema':_0x2b44e1(0x16c),'onJobId':_0x5433c3=>{_0x3f4051['setJobId'](_0x5433c3);}});return _0x33a5dd;},{'verbose':_0x11f781[_0x58cb04(0xfb)]}),_0x22783a=_0x945900[_0x58cb04(0x1f0)],_0x372748=_0x22783a[_0x58cb04(0x187)]?'\x20[Job\x20ID:\x20'+_0x22783a[_0x58cb04(0x187)]+']':'';return console[_0x58cb04(0x104)](_0x58cb04(0xcb)+_0x22783a['stats'][_0x58cb04(0xdf)]['toLocaleString']()+_0x58cb04(0xe3)+(_0x58cb04(0x178)+formatElapsed(_0x22783a[_0x58cb04(0x1ce)][_0x58cb04(0x1aa)])+_0x372748)),await handleQueryOutput(_0x22783a,_0x11f781),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0xd91a26(0xf1);[a30_0xd91a26(0x176)]=a30_0xd91a26(0x234);async[a30_0xd91a26(0x1af)](_0x262273){const _0x5828d4=a30_0xd91a26,{options:_0xe9767a,args:_0xca6c2c,tdx:_0x509580}=_0x262273,_0x518551=_0xca6c2c[0x0],_0x44259a=await withSpinner(_0x518551?_0x5828d4(0x181)+_0x518551+'\x27...':'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x509580[_0x5828d4(0xd0)][_0x5828d4(0x22b)](),{'verbose':_0xe9767a['verbose']});let _0x13e13e=_0x44259a[_0x5828d4(0x1f0)]['filter'](_0x72a145=>_0x72a145[_0x5828d4(0x1da)]);if(_0x518551){const _0x56d9d8=_0x518551[_0x5828d4(0xe1)](/[.+^${}()|[\]\\]/g,_0x5828d4(0xd9))[_0x5828d4(0xe1)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x393681=new RegExp('^'+_0x56d9d8+'$','i');_0x13e13e=_0x13e13e[_0x5828d4(0xba)](_0x2cad4f=>_0x393681[_0x5828d4(0x17f)](_0x2cad4f[_0x5828d4(0xca)]));}_0x13e13e['sort']((_0x1f89e7,_0x2bc46c)=>_0x1f89e7[_0x5828d4(0xca)][_0x5828d4(0x155)](_0x2bc46c['name'])),console[_0x5828d4(0x104)](_0x5828d4(0xf5)+_0x13e13e[_0x5828d4(0xae)]+_0x5828d4(0x15e)+(_0x13e13e[_0x5828d4(0xae)]!==0x1?'s':''));const _0x3d75b4=_0x5abafd=>{const _0x3a9044=_0x5828d4;return getConsoleNextUrl(_0xe9767a['site'],_0x3a9044(0x21a)+_0x5abafd);};if(_0xe9767a[_0x5828d4(0x16b)]===_0x5828d4(0x171)||_0xe9767a[_0x5828d4(0x16b)]===_0x5828d4(0xd5)){const _0x5eb8f5=_0x13e13e[_0x5828d4(0x1ae)](_0x1c2c5a=>({..._0x1c2c5a,'url':_0x3d75b4(_0x1c2c5a['id'])}));await handleSDKOutput(_0x5eb8f5,_0xe9767a);}else{if(_0x13e13e[_0x5828d4(0xae)]===0x0)console[_0x5828d4(0xfc)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x28db1d of _0x13e13e){const _0x246724=_0x28db1d['population']?a30_0x53e4e0[_0x5828d4(0xbe)]('\x20('+formatRows(_0x28db1d[_0x5828d4(0x1f9)])+')'):'',_0x41489a=hyperlink(_0x28db1d[_0x5828d4(0xca)],_0x3d75b4(_0x28db1d['id']));console[_0x5828d4(0xfc)]('⚡\x20'+_0x41489a+_0x246724);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]='ps:rt:validate';[a30_0xd91a26(0x176)]=a30_0xd91a26(0x169);async[a30_0xd91a26(0x1af)](_0x42e9d0){const _0xfb9b1a=a30_0xd91a26,{options:_0x3607d5,args:_0x263a3f,tdx:_0x5b4a03}=_0x42e9d0,_0x4474cb=_0x263a3f[0x0]||_0x3607d5[_0xfb9b1a(0xbb)];if(!_0x4474cb)return showParentSegmentNotSetError(_0xfb9b1a(0x1e6)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x199f95=resolveYamlFile(_0x4474cb);if(!existsSync(_0x199f95))return showFileNotFoundError(_0x199f95,_0x4474cb),0x1;let _0x355271;try{_0x355271=readFileSync(_0x199f95,'utf-8');}catch(_0x2c2077){const _0x5a5063=_0x2c2077 instanceof Error?_0x2c2077[_0xfb9b1a(0x180)]:String(_0x2c2077);return console[_0xfb9b1a(0x104)](_0xfb9b1a(0x17d)+_0x5a5063),0x1;}const _0x59749c=createCommandSpinner(a30_0x53e4e0[_0xfb9b1a(0xbe)](_0xfb9b1a(0x213)),{'verbose':_0x3607d5['verbose']});_0x59749c[_0xfb9b1a(0x20f)]();const _0x428c5a={'realtime':!![],'onProgress':_0x520c62=>{_0x59749c['text']=formatProgressMessage(_0x520c62);}};let _0x25142f;try{_0x25142f=await _0x5b4a03[_0xfb9b1a(0x204)]['validateParentYaml'](_0x355271,_0x428c5a),_0x59749c[_0xfb9b1a(0x106)]();}catch(_0x218b96){_0x59749c[_0xfb9b1a(0x106)]();throw _0x218b96;}console[_0xfb9b1a(0x104)]('\x0a'+a30_0x53e4e0[_0xfb9b1a(0x12b)]('RT\x202.0\x20Validate:')+'\x20'+_0x25142f[_0xfb9b1a(0xca)]),console[_0xfb9b1a(0x104)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x25142f),console[_0xfb9b1a(0x104)]('─'[_0xfb9b1a(0x105)](0x3c));if(_0x25142f[_0xfb9b1a(0x183)]['length']>0x0){console[_0xfb9b1a(0x104)]('\x0a'+a30_0x53e4e0['red'](_0xfb9b1a(0x13a)));for(const _0x3ce904 of _0x25142f[_0xfb9b1a(0x183)]){console['error']('\x20\x20'+a30_0x53e4e0['red']('•')+'\x20'+_0x3ce904);}}return _0x25142f['allValid']&&console[_0xfb9b1a(0x104)]('\x0a'+a30_0x53e4e0[_0xfb9b1a(0x13f)]('✔')+_0xfb9b1a(0x1ec)),_0x25142f[_0xfb9b1a(0x232)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x135);[a30_0xd91a26(0x176)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a30_0xd91a26(0x1af)](_0x37ded9){const _0x26d842=a30_0xd91a26,{options:_0x52426c,args:_0x66344f,tdx:_0x522140}=_0x37ded9,_0x31810b=_0x66344f[0x0]||_0x52426c[_0x26d842(0xbb)];if(!_0x31810b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+_0x26d842(0xe9)),0x1;const _0x2393b7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31810b+_0x26d842(0xac),()=>_0x522140[_0x26d842(0x204)][_0x26d842(0xe0)](_0x31810b),{'verbose':_0x52426c[_0x26d842(0xfb)]}),_0x5f2157=_0x2393b7['data'],_0x2726cf=await withSpinner(_0x26d842(0x136)+_0x31810b+_0x26d842(0xac),()=>_0x522140['personalization'][_0x26d842(0x22b)](_0x5f2157),{'verbose':_0x52426c[_0x26d842(0xfb)]}),_0x233355=_0x2726cf[_0x26d842(0x1f0)];console['error']('✔\x20Found\x20'+_0x233355[_0x26d842(0xae)]+_0x26d842(0x13e)+(_0x233355[_0x26d842(0xae)]!==0x1?'s':''));if(_0x52426c[_0x26d842(0x16b)]===_0x26d842(0x171)||_0x52426c[_0x26d842(0x16b)]===_0x26d842(0xd5))await handleSDKOutput(_0x233355,_0x52426c);else{if(_0x233355[_0x26d842(0xae)]===0x0)console[_0x26d842(0xfc)](_0x26d842(0x195)),console[_0x26d842(0x104)](a30_0x53e4e0['cyan'](_0x26d842(0xb1)));else for(const _0x26039a of _0x233355){const _0x10c07c=_0x26039a[_0x26d842(0xd8)]?.[_0x26d842(0xae)]||0x0,_0x5ca79e=_0x26039a[_0x26d842(0x109)]?a30_0x53e4e0[_0x26d842(0xbe)](_0x26d842(0x186)+_0x26039a[_0x26d842(0x109)]):'',_0xec8411=a30_0x53e4e0['dim']('\x20('+_0x10c07c+_0x26d842(0x200)+(_0x10c07c!==0x1?'s':'')+')');console[_0x26d842(0xfc)]('\x20\x20'+_0x26039a[_0x26d842(0xca)]+_0x5ca79e+_0xec8411),_0x26039a[_0x26d842(0x176)]&&console[_0x26d842(0xfc)](_0x26d842(0x174)+a30_0x53e4e0['dim'](_0x26039a[_0x26d842(0x176)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0xd91a26(0xca)]=a30_0xd91a26(0x1b9);['description']=a30_0xd91a26(0x1a0);async['execute'](_0x485584){const _0xe44fe7=a30_0xd91a26,{options:_0x32c98e,args:_0x46755b}=_0x485584,_0x1a7fe8=_0x46755b[0x0]||_0x32c98e[_0xe44fe7(0xbb)];if(!_0x1a7fe8)return showParentSegmentNotSetError(_0xe44fe7(0x14f)+_0xe44fe7(0x1d7)),0x1;const _0x218d26=resolveYamlFile(_0x1a7fe8);if(!existsSync(_0x218d26))return showFileNotFoundError(_0x218d26,_0x1a7fe8),0x1;let _0x1a3ea1;try{_0x1a3ea1=readFileSync(_0x218d26,_0xe44fe7(0x116));}catch(_0x4fa748){const _0x3573ce=_0x4fa748 instanceof Error?_0x4fa748[_0xe44fe7(0x180)]:String(_0x4fa748);return console[_0xe44fe7(0x104)](_0xe44fe7(0x17d)+_0x3573ce),0x1;}let _0x142259;try{_0x142259=parseDef(_0x1a3ea1);}catch(_0x117d2f){const _0x12dfa6=_0x117d2f instanceof Error?_0x117d2f[_0xe44fe7(0x180)]:String(_0x117d2f);return console['error'](a30_0x53e4e0[_0xe44fe7(0x1f5)]('Error\x20parsing\x20YAML:\x20'+_0x12dfa6)),0x1;}if(_0x142259[_0xe44fe7(0x217)]&&_0x142259[_0xe44fe7(0x217)][_0xe44fe7(0xae)]>0x0)return console['error'](a30_0x53e4e0[_0xe44fe7(0x163)](_0xe44fe7(0x151)+_0x218d26)),console[_0xe44fe7(0x104)](a30_0x53e4e0[_0xe44fe7(0xbe)](_0xe44fe7(0xfd)+_0x142259['personalization_services'][_0xe44fe7(0xae)]+'\x20service(s)\x20configured')),0x1;!_0x142259['realtime']&&(_0x142259[_0xe44fe7(0xd0)]={'events':[{'name':'page_view','source_table':_0xe44fe7(0xb7)}],'attributes':[{'name':_0xe44fe7(0x12c),'type':'single'}],'id_stitching':{'primary_key':_0x142259['master'][_0xe44fe7(0xc3)]==='customers'?_0xe44fe7(0xb5):'user_id'}});_0x142259['personalization_services']=[{'name':'My\x20Service','description':_0xe44fe7(0x227),'trigger_event':_0xe44fe7(0x1b0),'sections':[{'name':_0xe44fe7(0x11d),'criteria':_0xe44fe7(0x1fc),'attributes':['last_page_viewed']}]}];const _0x58b5eb=serializeDef(_0x142259);return writeFileSync(_0x218d26,_0x58b5eb,'utf-8'),console[_0xe44fe7(0x104)](a30_0x53e4e0['green']('✔')+_0xe44fe7(0x103)+a30_0x53e4e0[_0xe44fe7(0x1c3)](_0x218d26)),(!_0x142259['realtime']||_0x1a3ea1[_0xe44fe7(0xc6)](_0xe44fe7(0x224))===-0x1)&&console[_0xe44fe7(0x104)](a30_0x53e4e0[_0xe44fe7(0x13f)]('✔')+_0xe44fe7(0xfa)),console['error']('\x0a'+a30_0x53e4e0[_0xe44fe7(0xbe)]('Next\x20steps:')),console[_0xe44fe7(0x104)](_0xe44fe7(0x235)+_0x218d26+_0xe44fe7(0x11c)),console[_0xe44fe7(0x104)]('\x20\x202.\x20Run\x20'+a30_0x53e4e0[_0xe44fe7(0xbe)](_0xe44fe7(0x21b)+_0x1a7fe8)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1afa80=a31_0x549d;function a31_0x549d(_0x104f49,_0x47fddf){_0x104f49=_0x104f49-0x179;const _0x2843cf=a31_0x2843();let _0x549d6d=_0x2843cf[_0x104f49];return _0x549d6d;}(function(_0x262fbd,_0x2f15b7){const _0x937dfe=a31_0x549d,_0x3557f2=_0x262fbd();while(!![]){try{const _0x2c4b6a=-parseInt(_0x937dfe(0x1a4))/0x1*(-parseInt(_0x937dfe(0x192))/0x2)+-parseInt(_0x937dfe(0x1da))/0x3*(parseInt(_0x937dfe(0x182))/0x4)+-parseInt(_0x937dfe(0x1a7))/0x5+parseInt(_0x937dfe(0x1e6))/0x6*(parseInt(_0x937dfe(0x1c5))/0x7)+-parseInt(_0x937dfe(0x17c))/0x8+parseInt(_0x937dfe(0x18f))/0x9*(parseInt(_0x937dfe(0x18a))/0xa)+parseInt(_0x937dfe(0x1c2))/0xb;if(_0x2c4b6a===_0x2f15b7)break;else _0x3557f2['push'](_0x3557f2['shift']());}catch(_0x3be6b5){_0x3557f2['push'](_0x3557f2['shift']());}}}(a31_0x2843,0xb974d));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x460357 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';function a31_0x2843(){const _0x27ca7c=['apikey','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key:','\x20\x20-\x20','create','logLevel','profile','6720758NJimHa','\x27\x20created','\x27\x20does\x20not\x20exist.','21pUEicQ','red','VALID_KEYS','llm_project','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','tdx:\x20profile\x20create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile:create','config','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','API\x20Key','oauth','length','Set\x20a\x20profile\x20configuration\x20value','name','getUserInfo','3VUVHkj','message','select','Set\x20session\x20profile','llm_agent','error','yellow','green','\x20API\x20key\x20removed\x20from\x20system\x20keychain','log','\x20\x20tdx\x20--profile\x20','\x0aSetup\x20cancelled','1892322hDHgPM','\x27\x20requires\x20API\x20key\x20validation.','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','trim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','apiKey','706112XDUQFm','session','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20cannot\x20be\x20empty','(session:\x20','OAuth\x20(browser\x20login)','5869144qXjLgF','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','ERROR','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','text','Session\x20profile\x20set\x20to:\x20','✗\x20Validation\x20failed:\x20','1070yvzQgs','warn','Validating\x20API\x20key...','\x0aAvailable\x20profiles:','status','49221WpksFq','Default\x20profile\x20set\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','1282342gfyPqz','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20--default\x27\x20to\x20save\x20permanently','site','includes','jobs','Enter\x20profile\x20name:','email','tdx:\x20profile\x20set','profile:remove','Profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','test','us01','(cleared)','tdx.json','execute','Failed\x20to\x20remove\x20profile:\x20','1PvkdQH','Site\x20was\x20not\x20changed.','\x20Profile\x20\x27','2341570TRyYUq','confirm','default','dim','method','API\x20key\x20cannot\x20be\x20empty','Operation\x20cancelled','\x0aSaved\x20to:\x20','password','\x27\x20does\x20not\x20exist.\x20Create\x20it?','parent_segment','Unknown\x20key\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profileName','validate','description','join','Setup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain'];a31_0x2843=function(){return _0x27ca7c;};return a31_0x2843();}import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x2a910c from'prompts';import a31_0x4ea699 from'chalk';function validateProfileName(_0x2ce396){const _0x3b4d08=a31_0x549d;if(!_0x2ce396||!_0x2ce396['trim']())return _0x3b4d08(0x17f);const _0x129711=_0x2ce396[_0x3b4d08(0x179)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3b4d08(0x19e)](_0x129711))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x129711))return _0x3b4d08(0x19c)+_0x129711+_0x3b4d08(0x186);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a31_0x1afa80(0x1d1);[a31_0x1afa80(0x1b7)]='Create\x20a\x20new\x20profile';async[a31_0x1afa80(0x1a2)](_0x47e3db){const _0x4a37e0=a31_0x1afa80,{options:_0x5d849d,args:_0x5235b5}=_0x47e3db;console[_0x4a37e0(0x1e3)](a31_0x4ea699[_0x4a37e0(0x1e8)](_0x4a37e0(0x1ce)));let _0x39358b;if(_0x5235b5[_0x4a37e0(0x1d6)]>0x0&&_0x5235b5[0x0]){const _0xeb3123=_0x5235b5[0x0]['trim'](),_0x113d78=validateProfileName(_0xeb3123);if(_0x113d78!==!![])return console['error'](a31_0x4ea699['red'](_0x113d78)),0x1;_0x39358b=_0xeb3123;}else{const _0x986828=await a31_0x2a910c({'type':_0x4a37e0(0x187),'name':_0x4a37e0(0x1b5),'message':_0x4a37e0(0x198),'validate':validateProfileName});if(!_0x986828[_0x4a37e0(0x1b5)])return console['log'](_0x4a37e0(0x1e5)),0x1;_0x39358b=_0x986828[_0x4a37e0(0x1b5)][_0x4a37e0(0x179)]();}const _0x210dc1=await a31_0x2a910c({'type':_0x4a37e0(0x187),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x5020e2=_0x210dc1[_0x4a37e0(0x1b7)]?.[_0x4a37e0(0x179)]()||undefined,_0x414240=_0x5d849d[_0x4a37e0(0x195)]||_0x4a37e0(0x19f),_0x3ad4f8=await promptSiteSelection(_0x414240,_0x39358b,_0x4a37e0(0x1b9));if(!_0x3ad4f8)return 0x1;const _0x1aa38f=resolveSite(_0x3ad4f8);if(isOAuthSupported(_0x1aa38f)){const _0x33ca02=await a31_0x2a910c({'type':_0x4a37e0(0x1dc),'name':_0x4a37e0(0x1ab),'message':'Choose\x20authentication\x20method:','choices':[{'title':_0x4a37e0(0x181),'value':'oauth'},{'title':_0x4a37e0(0x1d4),'value':_0x4a37e0(0x1bb)}]});if(!_0x33ca02[_0x4a37e0(0x1ab)])return console[_0x4a37e0(0x1e3)]('\x0aSetup\x20cancelled'),0x1;if(_0x33ca02[_0x4a37e0(0x1ab)]===_0x4a37e0(0x1d5)){if(_0x5020e2){const _0x1353ff={'site':_0x1aa38f,'description':_0x5020e2};saveProfileToUserConfig(_0x39358b,_0x1353ff);}return await runOAuthLoginFlow(_0x1aa38f,_0x39358b,_0x5d849d[_0x4a37e0(0x1c0)]??LogLevel[_0x4a37e0(0x184)]),0x0;}}console[_0x4a37e0(0x1e3)](_0x4a37e0(0x183)+_0x1aa38f),console[_0x4a37e0(0x1e3)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4a37e0(0x1e3)]('\x20\x20'+getConsoleUrl(_0x1aa38f,'/app/mp/ak'));const _0x5d629c=await a31_0x2a910c({'type':_0x4a37e0(0x1af),'name':_0x4a37e0(0x17b),'message':_0x4a37e0(0x1bd),'validate':_0x4489b2=>{const _0x3c0a4c=_0x4a37e0;if(!_0x4489b2||!_0x4489b2['trim']())return _0x3c0a4c(0x1ac);return!![];}});if(!_0x5d629c['apiKey'])return console[_0x4a37e0(0x1e3)]('\x0aSetup\x20cancelled'),0x1;const _0x3a72fd=_0x5d629c[_0x4a37e0(0x17b)];console[_0x4a37e0(0x1e3)](_0x4a37e0(0x18c));try{const _0x44d553=TDX[_0x4a37e0(0x1bf)]({'site':_0x1aa38f,'apiKey':_0x3a72fd[_0x4a37e0(0x179)](),'logLevel':_0x5d849d[_0x4a37e0(0x1c0)]??LogLevel[_0x4a37e0(0x184)]}),_0x261e47=await _0x44d553['jobs'][_0x4a37e0(0x1d9)]();console[_0x4a37e0(0x1e3)](a31_0x4ea699[_0x4a37e0(0x1e1)]('✓')+_0x4a37e0(0x185)+_0x261e47['email']+')');const _0x54a845=await isKeychainAvailable();_0x54a845?(await saveAPIKeyAsync(_0x3a72fd['trim'](),_0x1aa38f,_0x39358b),console[_0x4a37e0(0x1e3)](a31_0x4ea699['green']('✓')+_0x4a37e0(0x1cd)+_0x39358b+')')):(console[_0x4a37e0(0x18b)](a31_0x4ea699[_0x4a37e0(0x1e0)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a31_0x4ea699['yellow'](_0x4a37e0(0x1cc))));const _0x5b92f1={'site':_0x1aa38f,..._0x5020e2&&{'description':_0x5020e2}};return saveProfileToUserConfig(_0x39358b,_0x5b92f1),console[_0x4a37e0(0x1e3)](a31_0x4ea699[_0x4a37e0(0x1e1)]('✓')+_0x4a37e0(0x1a6)+_0x39358b+_0x4a37e0(0x1c3)),console[_0x4a37e0(0x1e3)](),console['log'](_0x4a37e0(0x1c9)),console[_0x4a37e0(0x1e3)](_0x4a37e0(0x1e4)+_0x39358b+_0x4a37e0(0x1d3)),console[_0x4a37e0(0x1e3)]('\x20\x20tdx\x20--profile\x20'+_0x39358b+_0x4a37e0(0x1d0)),0x0;}catch(_0x4a0ce7){if(_0x4a0ce7 instanceof HTTPClientError&&_0x4a0ce7[_0x4a37e0(0x18e)]===0x191)return printAuthError(_0x4a0ce7),0x1;return console[_0x4a37e0(0x1df)](a31_0x4ea699[_0x4a37e0(0x1c6)](_0x4a37e0(0x189)+(_0x4a0ce7 instanceof Error?_0x4a0ce7[_0x4a37e0(0x1db)]:String(_0x4a0ce7)))),console['error'](_0x4a37e0(0x17a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x1afa80(0x1d8)]=a31_0x1afa80(0x19b);['description']='Remove\x20a\x20profile';[a31_0x1afa80(0x1b6)](_0x366036){const _0x431594=a31_0x1afa80,{args:_0x313c6a}=_0x366036;if(_0x313c6a['length']===0x0)return _0x431594(0x1e9);return undefined;}async[a31_0x1afa80(0x1a2)](_0x119d62){const _0x34ffc2=a31_0x1afa80,{args:_0x18db5c}=_0x119d62,_0x58534e=_0x18db5c[0x0];console['log'](a31_0x4ea699[_0x34ffc2(0x1e8)](_0x34ffc2(0x1ca)));if(!profileExists(_0x58534e)){console[_0x34ffc2(0x1df)](a31_0x4ea699[_0x34ffc2(0x1c6)](_0x34ffc2(0x19c)+_0x58534e+_0x34ffc2(0x1c4))),console[_0x34ffc2(0x1e3)](_0x34ffc2(0x18d));const _0x38328f=listProfiles();if(_0x38328f[_0x34ffc2(0x1d6)]===0x0)console[_0x34ffc2(0x1e3)](_0x34ffc2(0x1cb));else for(const _0x12950c of _0x38328f){console['log']('\x20\x20-\x20'+_0x12950c['name']);}return 0x1;}const _0xb5c589=await a31_0x2a910c({'type':_0x34ffc2(0x1a8),'name':_0x34ffc2(0x1a8),'message':_0x34ffc2(0x191)+_0x58534e+'\x27?','initial':![]});if(!_0xb5c589[_0x34ffc2(0x1a8)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x58534e),console[_0x34ffc2(0x1e3)](a31_0x4ea699[_0x34ffc2(0x1e1)]('✓')+_0x34ffc2(0x1a6)+_0x58534e+'\x27\x20removed\x20from\x20configuration');}catch(_0x21bd1f){return console[_0x34ffc2(0x1df)](a31_0x4ea699[_0x34ffc2(0x1c6)](_0x34ffc2(0x1a3)+(_0x21bd1f instanceof Error?_0x21bd1f['message']:String(_0x21bd1f)))),0x1;}const _0x1edb4e=await isKeychainAvailable();if(_0x1edb4e){const _0x128ba7=await deleteKeychainAPIKey(_0x58534e);_0x128ba7&&console['log'](a31_0x4ea699['green']('✓')+_0x34ffc2(0x1e2));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']=a31_0x1afa80(0x1d7);static [a31_0x1afa80(0x1c7)]=['site','database',a31_0x1afa80(0x1b1),a31_0x1afa80(0x1c8),a31_0x1afa80(0x1de),a31_0x1afa80(0x1b7)];[a31_0x1afa80(0x1b6)](_0x5f2545){const _0x884d00=a31_0x1afa80,{args:_0xb56908,options:_0x4122ab}=_0x5f2545,_0x3aa4f6=_0x4122ab[_0x884d00(0x1c1)]||getActiveProfile();if(!_0x3aa4f6)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0xb56908['length']===0x0)return _0x884d00(0x17e)+ProfileSetCommand[_0x884d00(0x1c7)][_0x884d00(0x1b8)](',\x20');const _0x59e906=_0xb56908[0x0];if(!_0x59e906[_0x884d00(0x196)]('='))return _0x884d00(0x193)+ProfileSetCommand[_0x884d00(0x1c7)][_0x884d00(0x1b8)](',\x20');const [_0x3fac11]=_0x59e906['split']('=',0x2);if(!ProfileSetCommand[_0x884d00(0x1c7)][_0x884d00(0x196)](_0x3fac11))return _0x884d00(0x1b2)+_0x3fac11+_0x884d00(0x1b3)+ProfileSetCommand[_0x884d00(0x1c7)]['join'](',\x20');return undefined;}async[a31_0x1afa80(0x1a2)](_0x2ed6dc){const _0x3c4738=a31_0x1afa80,{args:_0x2c032d,options:_0x1be0cc}=_0x2ed6dc,_0x462cac=_0x1be0cc[_0x3c4738(0x1c1)]||getActiveProfile(),[_0x4d015f,..._0x4dbb6e]=_0x2c032d[0x0]['split']('='),_0x3fd442=_0x4dbb6e['join']('=');console[_0x3c4738(0x1e3)](a31_0x4ea699['bold'](_0x3c4738(0x19a)));if(!profileExists(_0x462cac)){const _0x5f4194=await a31_0x2a910c({'type':_0x3c4738(0x1a8),'name':_0x3c4738(0x1bf),'message':'Profile\x20\x27'+_0x462cac+_0x3c4738(0x1b0),'initial':!![]});if(!_0x5f4194[_0x3c4738(0x1bf)])return console['log'](_0x3c4738(0x1ad)),0x1;}const _0x236210=loadProfile(_0x462cac),_0x3bb152=_0x236210?.[_0x3c4738(0x1d2)]||{};if(_0x4d015f==='site'){const _0x5df017=resolveSite(_0x3fd442);console[_0x3c4738(0x1e3)]('Changing\x20site\x20to\x20\x27'+_0x5df017+_0x3c4738(0x1e7)),console[_0x3c4738(0x1e3)](_0x3c4738(0x1b4)),console[_0x3c4738(0x1e3)]('\x20\x20'+getConsoleUrl(_0x5df017,_0x3c4738(0x1bc)));const _0x4a60a8=await a31_0x2a910c({'type':_0x3c4738(0x1af),'name':_0x3c4738(0x17b),'message':_0x3c4738(0x19d),'validate':_0x39033f=>{const _0x5a1279=_0x3c4738;if(!_0x39033f||!_0x39033f['trim']())return _0x5a1279(0x1ac);return!![];}});if(!_0x4a60a8[_0x3c4738(0x17b)])return console[_0x3c4738(0x1e3)]('\x0aOperation\x20cancelled'),0x1;console[_0x3c4738(0x1e3)](_0x3c4738(0x18c));try{const _0x4423ba=TDX[_0x3c4738(0x1bf)]({'site':_0x5df017,'apiKey':_0x4a60a8['apiKey'][_0x3c4738(0x179)](),'logLevel':_0x1be0cc[_0x3c4738(0x1c0)]??LogLevel[_0x3c4738(0x184)]}),_0x5416e3=await _0x4423ba[_0x3c4738(0x197)][_0x3c4738(0x1d9)]();console[_0x3c4738(0x1e3)](a31_0x4ea699[_0x3c4738(0x1e1)]('✓')+_0x3c4738(0x185)+_0x5416e3[_0x3c4738(0x199)]+')');const _0x443db4=await isKeychainAvailable();_0x443db4?(await saveAPIKeyAsync(_0x4a60a8[_0x3c4738(0x17b)][_0x3c4738(0x179)](),_0x5df017,_0x462cac),console[_0x3c4738(0x1e3)](a31_0x4ea699[_0x3c4738(0x1e1)]('✓')+_0x3c4738(0x1ba))):console[_0x3c4738(0x18b)](a31_0x4ea699[_0x3c4738(0x1e0)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3bb152['site']=_0x5df017;}catch(_0x27f401){if(_0x27f401 instanceof HTTPClientError&&_0x27f401[_0x3c4738(0x18e)]===0x191)return printAuthError(_0x27f401),0x1;return console[_0x3c4738(0x1df)](a31_0x4ea699[_0x3c4738(0x1c6)]('✗\x20Validation\x20failed:\x20'+(_0x27f401 instanceof Error?_0x27f401[_0x3c4738(0x1db)]:String(_0x27f401)))),console[_0x3c4738(0x1df)](_0x3c4738(0x1a5)),0x1;}}else _0x3bb152[_0x4d015f]=_0x3fd442||undefined;return saveProfileToUserConfig(_0x462cac,_0x3bb152),console[_0x3c4738(0x1e3)](a31_0x4ea699[_0x3c4738(0x1e1)]('✓')+'\x20Profile\x20\x27'+_0x462cac+'\x27\x20updated:\x20'+_0x4d015f+'='+(_0x3fd442||_0x3c4738(0x1a0))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x1afa80(0x1d8)]='profile:use';['description']=a31_0x1afa80(0x1dd);[a31_0x1afa80(0x1b6)](_0x28e518){const _0x4f3df5=a31_0x1afa80,{args:_0x3a3964}=_0x28e518;if(_0x3a3964[_0x4f3df5(0x1d6)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x1fb511){const _0x1df42a=a31_0x1afa80,{args:_0xede106,options:_0x3d270f}=_0x1fb511,_0x4722a3=_0xede106[0x0],_0x2315ed=_0x3d270f[_0x1df42a(0x1a9)];cleanExpiredSessions();if(!profileExists(_0x4722a3)){console[_0x1df42a(0x1df)](a31_0x4ea699['red'](_0x1df42a(0x19c)+_0x4722a3+'\x27\x20does\x20not\x20exist.')),console[_0x1df42a(0x1e3)](_0x1df42a(0x18d));const _0x39f65b=listProfiles();if(_0x39f65b[_0x1df42a(0x1d6)]===0x0)console[_0x1df42a(0x1e3)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2fee11 of _0x39f65b){console[_0x1df42a(0x1e3)](_0x1df42a(0x1be)+_0x2fee11[_0x1df42a(0x1d8)]);}return 0x1;}if(_0x2315ed){const _0x55d391=a31_0x460357[_0x1df42a(0x1b8)](getConfigDir(),_0x1df42a(0x1a1));return saveActiveProfileToUserConfig(_0x4722a3),console[_0x1df42a(0x1e3)](_0x1df42a(0x190)+a31_0x4ea699[_0x1df42a(0x1e1)](_0x4722a3)),console['log'](a31_0x4ea699[_0x1df42a(0x1aa)](_0x1df42a(0x1ae)+_0x55d391)),0x0;}const _0x57f0f6=getSessionID(_0x3d270f[_0x1df42a(0x17d)]);return saveSessionContext({'profile':_0x4722a3},_0x3d270f[_0x1df42a(0x17d)]),console[_0x1df42a(0x1e3)](_0x1df42a(0x188)+a31_0x4ea699['green'](_0x4722a3)+'\x20'+a31_0x4ea699[_0x1df42a(0x1aa)](_0x1df42a(0x180)+_0x57f0f6+')')),console['log'](a31_0x4ea699[_0x1df42a(0x1aa)](_0x1df42a(0x1cf)+_0x4722a3+_0x1df42a(0x194))),0x0;}}
|
|
1
|
+
const a31_0x45f6b3=a31_0x54f3;(function(_0x51a7a7,_0x13e89f){const _0x10f234=a31_0x54f3,_0x41d01e=_0x51a7a7();while(!![]){try{const _0x3704b8=parseInt(_0x10f234(0xaf))/0x1+parseInt(_0x10f234(0x77))/0x2*(parseInt(_0x10f234(0xba))/0x3)+parseInt(_0x10f234(0xa7))/0x4+-parseInt(_0x10f234(0x9b))/0x5+parseInt(_0x10f234(0xa9))/0x6*(parseInt(_0x10f234(0x69))/0x7)+parseInt(_0x10f234(0xc6))/0x8*(parseInt(_0x10f234(0xb0))/0x9)+parseInt(_0x10f234(0xc9))/0xa*(-parseInt(_0x10f234(0x68))/0xb);if(_0x3704b8===_0x13e89f)break;else _0x41d01e['push'](_0x41d01e['shift']());}catch(_0x486f2b){_0x41d01e['push'](_0x41d01e['shift']());}}}(a31_0x2175,0xc7e3d));import{BaseCommand,printAuthError}from'./command.js';function a31_0x2175(){const _0x1d0f72=['4342725pnGDoW','profile','\x20\x20(no\x20profiles\x20found)','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','\x0aOperation\x20cancelled','Choose\x20authentication\x20method:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20does\x20not\x20exist.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','3crZTPb','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aSaved\x20to:\x20','email','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','config','\x20\x20tdx\x20--profile\x20','name','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','API\x20Key','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx.json','8mfNBqS','ERROR','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','230ccCHxg','split','status','profileName','length','tdx:\x20profile\x20remove','\x0aAvailable\x20profiles:','profile:remove','parent_segment','execute','error','Create\x20a\x20new\x20profile','text','OAuth\x20(browser\x20login)','1953886FvdcHd','3122OTnxxm','dim','\x0aSetup\x20cancelled','Failed\x20to\x20remove\x20profile:\x20','Enter\x20profile\x20name:','log','database','tdx:\x20profile\x20create','validate','Changing\x20site\x20to\x20\x27','/app/mp/ak','warn','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','logLevel','1704342qmsBNt','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20was\x20not\x20changed.','Set\x20session\x20profile','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','confirm','green','Enter\x20description\x20(optional):','\x27\x20requires\x20API\x20key\x20validation.','Validating\x20API\x20key...','test','description','✗\x20Validation\x20failed:\x20','llm_project','trim','profile:use','red','\x27.\x0a\x0aValid\x20keys:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','site','Enter\x20your\x20TD\x20API\x20key:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20name\x20cannot\x20be\x20empty','apikey','create','Removal\x20cancelled','(session:\x20','VALID_KEYS','Profile\x20\x27','\x27\x20removed\x20from\x20configuration','\x20API\x20key\x20is\x20valid\x20(User:\x20','oauth','Remove\x20a\x20profile','method','message','profile:set','4043695yqBeih','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Default\x20profile\x20set\x20to:\x20','jobs','Set\x20a\x20profile\x20configuration\x20value','session','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20-\x20','apiKey','includes','Session\x20profile\x20set\x20to:\x20','API\x20key\x20cannot\x20be\x20empty','5875444lQdLgh','us01','21678uZkLWD','default','yellow','join','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','bold','1297931AfmvNf'];a31_0x2175=function(){return _0x1d0f72;};return a31_0x2175();}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x17383c from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a31_0x54f3(_0xae274e,_0x429163){_0xae274e=_0xae274e-0x65;const _0x217513=a31_0x2175();let _0x54f314=_0x217513[_0xae274e];return _0x54f314;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x411efe from'prompts';import a31_0x4245e7 from'chalk';function validateProfileName(_0x1fc4e0){const _0x3fbec9=a31_0x54f3;if(!_0x1fc4e0||!_0x1fc4e0[_0x3fbec9(0x85)]())return _0x3fbec9(0x8d);const _0x5a5b8c=_0x1fc4e0[_0x3fbec9(0x85)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3fbec9(0x81)](_0x5a5b8c))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x5a5b8c))return _0x3fbec9(0x93)+_0x5a5b8c+_0x3fbec9(0x7b);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x45f6b3(0xc1)]='profile:create';[a31_0x45f6b3(0x82)]=a31_0x45f6b3(0x65);async[a31_0x45f6b3(0xd2)](_0x97ddc){const _0x591254=a31_0x45f6b3,{options:_0x8e439,args:_0x44c730}=_0x97ddc;console[_0x591254(0x6e)](a31_0x4245e7[_0x591254(0xae)](_0x591254(0x70)));let _0x4968b9;if(_0x44c730['length']>0x0&&_0x44c730[0x0]){const _0x391895=_0x44c730[0x0][_0x591254(0x85)](),_0x552b11=validateProfileName(_0x391895);if(_0x552b11!==!![])return console[_0x591254(0xd3)](a31_0x4245e7[_0x591254(0x87)](_0x552b11)),0x1;_0x4968b9=_0x391895;}else{const _0x46f62e=await a31_0x411efe({'type':_0x591254(0x66),'name':'profileName','message':_0x591254(0x6d),'validate':validateProfileName});if(!_0x46f62e[_0x591254(0xcc)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x4968b9=_0x46f62e[_0x591254(0xcc)][_0x591254(0x85)]();}const _0x5ca26f=await a31_0x411efe({'type':'text','name':'description','message':_0x591254(0x7e)}),_0x3948d6=_0x5ca26f[_0x591254(0x82)]?.['trim']()||undefined,_0x197701=_0x8e439[_0x591254(0x8a)]||_0x591254(0xa8),_0x578bc5=await promptSiteSelection(_0x197701,_0x4968b9,'Setup\x20cancelled');if(!_0x578bc5)return 0x1;const _0x5524f8=resolveSite(_0x578bc5);if(isOAuthSupported(_0x5524f8)){const _0x53566f=await a31_0x411efe({'type':'select','name':_0x591254(0x98),'message':_0x591254(0xb6),'choices':[{'title':_0x591254(0x67),'value':_0x591254(0x96)},{'title':_0x591254(0xc3),'value':_0x591254(0x8e)}]});if(!_0x53566f[_0x591254(0x98)])return console[_0x591254(0x6e)](_0x591254(0x6b)),0x1;if(_0x53566f[_0x591254(0x98)]===_0x591254(0x96)){if(_0x3948d6){const _0x344539={'site':_0x5524f8,'description':_0x3948d6};saveProfileToUserConfig(_0x4968b9,_0x344539);}return await runOAuthLoginFlow(_0x5524f8,_0x4968b9,_0x8e439[_0x591254(0x76)]??LogLevel['ERROR']),0x0;}}console[_0x591254(0x6e)](_0x591254(0xbe)+_0x5524f8),console[_0x591254(0x6e)](_0x591254(0xc4)),console[_0x591254(0x6e)]('\x20\x20'+getConsoleUrl(_0x5524f8,_0x591254(0x73)));const _0x1d3df1=await a31_0x411efe({'type':'password','name':_0x591254(0xa3),'message':_0x591254(0x8b),'validate':_0x5567ac=>{const _0x13c17a=_0x591254;if(!_0x5567ac||!_0x5567ac[_0x13c17a(0x85)]())return _0x13c17a(0xa6);return!![];}});if(!_0x1d3df1['apiKey'])return console[_0x591254(0x6e)](_0x591254(0x6b)),0x1;const _0x3a3823=_0x1d3df1[_0x591254(0xa3)];console['log'](_0x591254(0x80));try{const _0xa7eb83=TDX[_0x591254(0x8f)]({'site':_0x5524f8,'apiKey':_0x3a3823[_0x591254(0x85)](),'logLevel':_0x8e439[_0x591254(0x76)]??LogLevel[_0x591254(0xc7)]}),_0x2f5e48=await _0xa7eb83[_0x591254(0x9e)]['getUserInfo']();console[_0x591254(0x6e)](a31_0x4245e7['green']('✓')+_0x591254(0x95)+_0x2f5e48[_0x591254(0xbd)]+')');const _0x36df86=await isKeychainAvailable();_0x36df86?(await saveAPIKeyAsync(_0x3a3823[_0x591254(0x85)](),_0x5524f8,_0x4968b9),console[_0x591254(0x6e)](a31_0x4245e7[_0x591254(0x7d)]('✓')+_0x591254(0xb7)+_0x4968b9+')')):(console[_0x591254(0x74)](a31_0x4245e7[_0x591254(0xab)](_0x591254(0xad))),console[_0x591254(0x74)](a31_0x4245e7[_0x591254(0xab)](_0x591254(0x8c))));const _0x147f14={'site':_0x5524f8,..._0x3948d6&&{'description':_0x3948d6}};return saveProfileToUserConfig(_0x4968b9,_0x147f14),console[_0x591254(0x6e)](a31_0x4245e7[_0x591254(0x7d)]('✓')+'\x20Profile\x20\x27'+_0x4968b9+'\x27\x20created'),console[_0x591254(0x6e)](),console[_0x591254(0x6e)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x591254(0x6e)](_0x591254(0xc0)+_0x4968b9+_0x591254(0x78)),console[_0x591254(0x6e)](_0x591254(0xc0)+_0x4968b9+_0x591254(0x89)),0x0;}catch(_0x174815){if(_0x174815 instanceof HTTPClientError&&_0x174815[_0x591254(0xcb)]===0x191)return printAuthError(_0x174815),0x1;return console[_0x591254(0xd3)](a31_0x4245e7['red'](_0x591254(0x83)+(_0x174815 instanceof Error?_0x174815['message']:String(_0x174815)))),console[_0x591254(0xd3)](_0x591254(0x9c)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x45f6b3(0xc1)]=a31_0x45f6b3(0xd0);[a31_0x45f6b3(0x82)]=a31_0x45f6b3(0x97);['validate'](_0x5cbb0d){const _0x4ea2b1=a31_0x45f6b3,{args:_0x4f4a16}=_0x5cbb0d;if(_0x4f4a16[_0x4ea2b1(0xcd)]===0x0)return _0x4ea2b1(0xc8);return undefined;}async[a31_0x45f6b3(0xd2)](_0xdbb383){const _0x5b12c4=a31_0x45f6b3,{args:_0x4e1446}=_0xdbb383,_0x1073df=_0x4e1446[0x0];console[_0x5b12c4(0x6e)](a31_0x4245e7[_0x5b12c4(0xae)](_0x5b12c4(0xce)));if(!profileExists(_0x1073df)){console[_0x5b12c4(0xd3)](a31_0x4245e7['red'](_0x5b12c4(0x93)+_0x1073df+_0x5b12c4(0xb8))),console['log']('\x0aAvailable\x20profiles:');const _0x2ddd68=listProfiles();if(_0x2ddd68[_0x5b12c4(0xcd)]===0x0)console[_0x5b12c4(0x6e)](_0x5b12c4(0xb2));else for(const _0x4f8f14 of _0x2ddd68){console[_0x5b12c4(0x6e)](_0x5b12c4(0xa2)+_0x4f8f14['name']);}return 0x1;}const _0x4778c0=await a31_0x411efe({'type':_0x5b12c4(0x7c),'name':_0x5b12c4(0x7c),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x1073df+'\x27?','initial':![]});if(!_0x4778c0[_0x5b12c4(0x7c)])return console['log'](_0x5b12c4(0x90)),0x0;try{removeProfileFromUserConfig(_0x1073df),console[_0x5b12c4(0x6e)](a31_0x4245e7[_0x5b12c4(0x7d)]('✓')+'\x20Profile\x20\x27'+_0x1073df+_0x5b12c4(0x94));}catch(_0x398b21){return console[_0x5b12c4(0xd3)](a31_0x4245e7[_0x5b12c4(0x87)](_0x5b12c4(0x6c)+(_0x398b21 instanceof Error?_0x398b21['message']:String(_0x398b21)))),0x1;}const _0x229cf6=await isKeychainAvailable();if(_0x229cf6){const _0x193b40=await deleteKeychainAPIKey(_0x1073df);_0x193b40&&console[_0x5b12c4(0x6e)](a31_0x4245e7[_0x5b12c4(0x7d)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a31_0x45f6b3(0x9a);[a31_0x45f6b3(0x82)]=a31_0x45f6b3(0x9f);static [a31_0x45f6b3(0x92)]=[a31_0x45f6b3(0x8a),a31_0x45f6b3(0x6f),a31_0x45f6b3(0xd1),a31_0x45f6b3(0x84),'llm_agent',a31_0x45f6b3(0x82)];[a31_0x45f6b3(0x71)](_0x3fe823){const _0x1dd70e=a31_0x45f6b3,{args:_0x488a2a,options:_0x298852}=_0x3fe823,_0x551a18=_0x298852[_0x1dd70e(0xb1)]||getActiveProfile();if(!_0x551a18)return _0x1dd70e(0xb4);if(_0x488a2a[_0x1dd70e(0xcd)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1dd70e(0x92)]['join'](',\x20');const _0x4ec102=_0x488a2a[0x0];if(!_0x4ec102[_0x1dd70e(0xa4)]('='))return _0x1dd70e(0xc2)+ProfileSetCommand[_0x1dd70e(0x92)][_0x1dd70e(0xac)](',\x20');const [_0x2932f0]=_0x4ec102[_0x1dd70e(0xca)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x2932f0))return'Unknown\x20key\x20\x27'+_0x2932f0+_0x1dd70e(0x88)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async['execute'](_0x33b42b){const _0x3cc39e=a31_0x45f6b3,{args:_0x5c7ac3,options:_0x4936b8}=_0x33b42b,_0x179050=_0x4936b8[_0x3cc39e(0xb1)]||getActiveProfile(),[_0xb8fc2a,..._0xf72d58]=_0x5c7ac3[0x0][_0x3cc39e(0xca)]('='),_0x7c876=_0xf72d58['join']('=');console[_0x3cc39e(0x6e)](a31_0x4245e7[_0x3cc39e(0xae)]('tdx:\x20profile\x20set'));if(!profileExists(_0x179050)){const _0x279aac=await a31_0x411efe({'type':_0x3cc39e(0x7c),'name':'create','message':'Profile\x20\x27'+_0x179050+_0x3cc39e(0xbb),'initial':!![]});if(!_0x279aac[_0x3cc39e(0x8f)])return console[_0x3cc39e(0x6e)]('Operation\x20cancelled'),0x1;}const _0x87b7b5=loadProfile(_0x179050),_0x543678=_0x87b7b5?.[_0x3cc39e(0xbf)]||{};if(_0xb8fc2a===_0x3cc39e(0x8a)){const _0x13a468=resolveSite(_0x7c876);console[_0x3cc39e(0x6e)](_0x3cc39e(0x72)+_0x13a468+_0x3cc39e(0x7f)),console[_0x3cc39e(0x6e)](_0x3cc39e(0xb3)),console['log']('\x20\x20'+getConsoleUrl(_0x13a468,_0x3cc39e(0x73)));const _0x14b4ab=await a31_0x411efe({'type':'password','name':_0x3cc39e(0xa3),'message':_0x3cc39e(0xa1),'validate':_0x28d507=>{const _0x20b0e9=_0x3cc39e;if(!_0x28d507||!_0x28d507[_0x20b0e9(0x85)]())return _0x20b0e9(0xa6);return!![];}});if(!_0x14b4ab[_0x3cc39e(0xa3)])return console[_0x3cc39e(0x6e)](_0x3cc39e(0xb5)),0x1;console[_0x3cc39e(0x6e)](_0x3cc39e(0x80));try{const _0x2fbe5b=TDX[_0x3cc39e(0x8f)]({'site':_0x13a468,'apiKey':_0x14b4ab['apiKey'][_0x3cc39e(0x85)](),'logLevel':_0x4936b8[_0x3cc39e(0x76)]??LogLevel[_0x3cc39e(0xc7)]}),_0x5c9fee=await _0x2fbe5b['jobs']['getUserInfo']();console[_0x3cc39e(0x6e)](a31_0x4245e7[_0x3cc39e(0x7d)]('✓')+_0x3cc39e(0x95)+_0x5c9fee[_0x3cc39e(0xbd)]+')');const _0x360628=await isKeychainAvailable();_0x360628?(await saveAPIKeyAsync(_0x14b4ab[_0x3cc39e(0xa3)][_0x3cc39e(0x85)](),_0x13a468,_0x179050),console['log'](a31_0x4245e7[_0x3cc39e(0x7d)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x3cc39e(0x74)](a31_0x4245e7[_0x3cc39e(0xab)](_0x3cc39e(0xad))),_0x543678['site']=_0x13a468;}catch(_0x42dd5b){if(_0x42dd5b instanceof HTTPClientError&&_0x42dd5b['status']===0x191)return printAuthError(_0x42dd5b),0x1;return console['error'](a31_0x4245e7[_0x3cc39e(0x87)]('✗\x20Validation\x20failed:\x20'+(_0x42dd5b instanceof Error?_0x42dd5b[_0x3cc39e(0x99)]:String(_0x42dd5b)))),console[_0x3cc39e(0xd3)](_0x3cc39e(0x79)),0x1;}}else _0x543678[_0xb8fc2a]=_0x7c876||undefined;return saveProfileToUserConfig(_0x179050,_0x543678),console[_0x3cc39e(0x6e)](a31_0x4245e7[_0x3cc39e(0x7d)]('✓')+'\x20Profile\x20\x27'+_0x179050+'\x27\x20updated:\x20'+_0xb8fc2a+'='+(_0x7c876||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a31_0x45f6b3(0x86);[a31_0x45f6b3(0x82)]=a31_0x45f6b3(0x7a);[a31_0x45f6b3(0x71)](_0x21132c){const _0x293dae=a31_0x45f6b3,{args:_0x4c05b3}=_0x21132c;if(_0x4c05b3[_0x293dae(0xcd)]===0x0)return _0x293dae(0xb9);return undefined;}async[a31_0x45f6b3(0xd2)](_0x322964){const _0x41d2c5=a31_0x45f6b3,{args:_0x1f500,options:_0x1c0c84}=_0x322964,_0x2a0c29=_0x1f500[0x0],_0xcbfa2f=_0x1c0c84[_0x41d2c5(0xaa)];cleanExpiredSessions();if(!profileExists(_0x2a0c29)){console['error'](a31_0x4245e7['red'](_0x41d2c5(0x93)+_0x2a0c29+_0x41d2c5(0xb8))),console['log'](_0x41d2c5(0xcf));const _0x294ca2=listProfiles();if(_0x294ca2['length']===0x0)console[_0x41d2c5(0x6e)](_0x41d2c5(0xb2));else for(const _0x49e68 of _0x294ca2){console[_0x41d2c5(0x6e)]('\x20\x20-\x20'+_0x49e68[_0x41d2c5(0xc1)]);}return 0x1;}if(_0xcbfa2f){const _0xea621f=a31_0x17383c['join'](getConfigDir(),_0x41d2c5(0xc5));return saveActiveProfileToUserConfig(_0x2a0c29),console[_0x41d2c5(0x6e)](_0x41d2c5(0x9d)+a31_0x4245e7['green'](_0x2a0c29)),console[_0x41d2c5(0x6e)](a31_0x4245e7['dim'](_0x41d2c5(0xbc)+_0xea621f)),0x0;}const _0x50a946=getSessionID(_0x1c0c84[_0x41d2c5(0xa0)]);return saveSessionContext({'profile':_0x2a0c29},_0x1c0c84[_0x41d2c5(0xa0)]),console['log'](_0x41d2c5(0xa5)+a31_0x4245e7['green'](_0x2a0c29)+'\x20'+a31_0x4245e7[_0x41d2c5(0x6a)](_0x41d2c5(0x91)+_0x50a946+')')),console[_0x41d2c5(0x6e)](a31_0x4245e7[_0x41d2c5(0x6a)](_0x41d2c5(0x75)+_0x2a0c29+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a32_0x39f7(_0x309f98,_0x5a28db){_0x309f98=_0x309f98-0x64;const _0x2f0fe8=a32_0x2f0f();let _0x39f74b=_0x2f0fe8[_0x309f98];return _0x39f74b;}const a32_0x1448e0=a32_0x39f7;(function(_0x268288,_0x5822ab){const _0x12b8f8=a32_0x39f7,_0x49f92b=_0x268288();while(!![]){try{const _0x5ccd97=-parseInt(_0x12b8f8(0x7b))/0x1*(parseInt(_0x12b8f8(0x64))/0x2)+parseInt(_0x12b8f8(0x6e))/0x3*(-parseInt(_0x12b8f8(0x6d))/0x4)+-parseInt(_0x12b8f8(0x69))/0x5+-parseInt(_0x12b8f8(0x75))/0x6+-parseInt(_0x12b8f8(0x7c))/0x7*(parseInt(_0x12b8f8(0x6b))/0x8)+-parseInt(_0x12b8f8(0x76))/0x9+parseInt(_0x12b8f8(0x67))/0xa*(parseInt(_0x12b8f8(0x78))/0xb);if(_0x5ccd97===_0x5822ab)break;else _0x49f92b['push'](_0x49f92b['shift']());}catch(_0x4ddf02){_0x49f92b['push'](_0x49f92b['shift']());}}}(a32_0x2f0f,0x9605f));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a32_0x2f0f(){const _0x2adbd8=['site','1350275GwKGxX','\x20\x20Global:\x20~/.config/tdx/tdx.json','1837040COMdUn','config','1225512xttGza','9SCtEkj','map','error','dim','log','execute','description','789186VkeNcw','3484863UNbVMO','scope','21449494OOctgT','name','message','389OVdRWv','28IHlrho','length','3388tDUzMN','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','👤\x20','20StPdOq'];a32_0x2f0f=function(){return _0x2adbd8;};return a32_0x2f0f();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x763015 from'chalk';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a32_0x1448e0(0x74)]='List\x20all\x20available\x20profiles';async[a32_0x1448e0(0x73)](_0x3f8ae4){const _0x4e1ae7=a32_0x1448e0,{options:_0xadc4e4}=_0x3f8ae4;try{const _0x59feaf=listProfiles(),_0x4d4a47=getActiveProfile();if(_0x59feaf[_0x4e1ae7(0x7d)]===0x0)return console[_0x4e1ae7(0x72)](_0x4e1ae7(0x65)),console[_0x4e1ae7(0x72)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x4e1ae7(0x72)](_0x4e1ae7(0x6a)),0x0;const _0x5039d3=_0x59feaf[_0x4e1ae7(0x6f)](_0x15a87c=>{const _0x315810=_0x4e1ae7,_0x4e156e=_0x15a87c[_0x315810(0x79)]===_0x4d4a47,_0x58acaa=getProfileParams(_0x15a87c[_0x315810(0x6c)]);return{'name':_0x15a87c[_0x315810(0x79)],'active':_0x4e156e,'scope':_0x15a87c[_0x315810(0x77)],'description':_0x15a87c[_0x315810(0x6c)][_0x315810(0x74)]||'','params':_0x58acaa};});if(isStructuredFormat(_0xadc4e4))await handleSDKOutput(_0x5039d3,_0xadc4e4);else for(const _0x433ca2 of _0x59feaf){const _0x38f483=_0x433ca2[_0x4e1ae7(0x79)]===_0x4d4a47?a32_0x763015['green']('\x20✓'):'',_0x1cbd70=_0x433ca2[_0x4e1ae7(0x6c)][_0x4e1ae7(0x68)]?a32_0x763015[_0x4e1ae7(0x71)]('\x20'+_0x433ca2['config']['site']):'',_0x15acbd=_0x433ca2[_0x4e1ae7(0x6c)]['description']?a32_0x763015['dim']('\x20\x20'+_0x433ca2['config'][_0x4e1ae7(0x74)]):'';console[_0x4e1ae7(0x72)](_0x4e1ae7(0x66)+_0x433ca2['name']+_0x38f483+_0x1cbd70+_0x15acbd);}return 0x0;}catch(_0x43cc5c){return _0x43cc5c instanceof Error&&console[_0x4e1ae7(0x70)]('Error:\x20'+_0x43cc5c[_0x4e1ae7(0x7a)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x49afb9=a33_0xf527;(function(_0x5f45d0,_0x54b7a3){const _0x2008f6=a33_0xf527,_0x4c2db3=_0x5f45d0();while(!![]){try{const _0x3bac8b=parseInt(_0x2008f6(0x84))/0x1+-parseInt(_0x2008f6(0x91))/0x2+parseInt(_0x2008f6(0x7a))/0x3+-parseInt(_0x2008f6(0x96))/0x4+parseInt(_0x2008f6(0xa6))/0x5+-parseInt(_0x2008f6(0x83))/0x6+-parseInt(_0x2008f6(0xa4))/0x7;if(_0x3bac8b===_0x54b7a3)break;else _0x4c2db3['push'](_0x4c2db3['shift']());}catch(_0xf745a){_0x4c2db3['push'](_0x4c2db3['shift']());}}}(a33_0x5b78,0xb1fa3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x5b78(){const _0x11ac38=['elapsedTimeMillis','processedRows','\x0aAll\x20results\x20saved\x20to\x20','state','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','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','Statement\x20','validate','database','SQL:\x20','site','description','335629IhHLJG','originalMessage','3581670JiiknJ','Catalog:\x20','setJobId','Query\x20completed:\x20Processed\x20','query','2396346QaGyRl','execute','\x20splits','Schema:\x20','\x20rows\x20','Executing\x20query...','information_schema','file','\x20[Job\x20ID:\x20','7483638euCrro','928791bThAHc','length','Executing\x20query\x20[','No\x20SQL\x20provided','data','setPhase','catalog','...','completedSplits','join','options','totalSplits','error','355042gpGNmK','message','args','verbose','output','968684fqbjEq','push'];a33_0x5b78=function(){return _0x11ac38;};return a33_0x5b78();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a33_0xf527(_0x2d6ba0,_0x3fb4c1){_0x2d6ba0=_0x2d6ba0-0x76;const _0x5b78fd=a33_0x5b78();let _0xf5277f=_0x5b78fd[_0x2d6ba0];return _0xf5277f;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a33_0x49afb9(0x79);[a33_0x49afb9(0xa3)]='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x49afb9(0x7b)](_0x5b3dc7){const _0x38c416=a33_0x49afb9,{options:_0x11c8da,args:_0x23fa5f,tdx:_0x4a3f40}=_0x5b3dc7,_0x2d3638={..._0x11c8da,'limitStructuredFormats':!![]},_0x103a12=_0x23fa5f[0x0],_0xd98356=_0x11c8da[_0x38c416(0x81)];let _0x363316;try{if(_0xd98356)_0x363316=readSqlStatementsFromFile(_0xd98356);else{if(_0x103a12==='-')_0x363316=await readSqlStatementsFromStdin();else{if(_0x103a12&&isSqlFilePath(_0x103a12))_0x363316=readSqlStatementsFromFile(_0x103a12);else{if(_0x103a12)_0x363316=splitSqlStatements(_0x103a12);else throw new Error(_0x38c416(0x87));}}}}catch(_0x32e10e){return console['error']('Error:\x20'+_0x32e10e['message']),0x1;}const _0x21b7c0=_0x11c8da[_0x38c416(0xa0)]||_0x38c416(0x80),_0x4c4a16=_0x11c8da[_0x38c416(0x8a)];try{const _0x9e68f=[],_0x10bf19=!!_0x11c8da['output'];for(let _0x5616cc=0x0;_0x5616cc<_0x363316[_0x38c416(0x85)];_0x5616cc++){const _0x1fec73=_0x363316[_0x5616cc],_0x2b2f8c=_0x5616cc+0x1,_0x1010b2=_0x363316[_0x38c416(0x85)],_0x29c682=_0x1010b2>0x1;_0x11c8da[_0x38c416(0x94)]&&(console[_0x38c416(0x90)]('\x0a'+(_0x29c682?_0x38c416(0x9e)+_0x2b2f8c+'/'+_0x1010b2+':':'')),console[_0x38c416(0x90)]('Site:\x20'+_0x11c8da[_0x38c416(0xa2)]),console[_0x38c416(0x90)](_0x38c416(0x76)+(_0x4c4a16||'td')),console['error'](_0x38c416(0x7d)+_0x21b7c0),console[_0x38c416(0x90)](_0x38c416(0xa1)+_0x1fec73));const _0x489a3b=_0x29c682?'Executing\x20statement\x20'+_0x2b2f8c+'/'+_0x1010b2+_0x38c416(0x8b):_0x38c416(0x7f);try{const _0xae56c8=await withProgressSpinner(_0x489a3b,async _0x3e519c=>{const _0x532644=_0x38c416,_0x3a8f5f=await _0x4a3f40[_0x532644(0x79)][_0x532644(0x7b)](_0x1fec73,{'catalog':_0x4c4a16,'schema':_0x21b7c0,'onJobId':_0x37d777=>{const _0x425bac=_0x532644;_0x3e519c[_0x425bac(0x77)](_0x37d777);},'onProgress':_0x22c713=>{const _0x317fb3=_0x532644;_0x3e519c[_0x317fb3(0x89)](_0x317fb3(0x86)+_0x22c713[_0x317fb3(0x9b)]+']'),_0x3e519c['setExtra'](formatRows(_0x22c713[_0x317fb3(0x99)])+_0x317fb3(0x7e)+_0x22c713[_0x317fb3(0x8c)]+'/'+_0x22c713[_0x317fb3(0x8f)]+_0x317fb3(0x7c));}});return _0x3a8f5f;},{'verbose':_0x11c8da[_0x38c416(0x94)]}),_0xf4de78=_0xae56c8[_0x38c416(0x88)],_0x189db6=_0xf4de78['jobId']?_0x38c416(0x82)+_0xf4de78['jobId']+']':'',_0x47c6f8=_0x29c682?_0x38c416(0x9e)+_0x2b2f8c+'/'+_0x1010b2+'\x20-\x20':'';console['error']('✔\x20'+_0x47c6f8+_0x38c416(0x78)+formatRows(_0xf4de78['stats'][_0x38c416(0x99)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0xf4de78['stats'][_0x38c416(0x98)])+_0x189db6));if(_0x29c682&&_0x10bf19){const _0x1e9e68=resolveOutputOptions(_0x2d3638),_0x1d2a7f=await formatQueryOutput(_0xf4de78,_0x1e9e68);_0x9e68f[_0x38c416(0x97)](_0x1d2a7f);}else await handleQueryOutput(_0xf4de78,_0x2d3638);}catch(_0x98e127){const _0x5d9e49=_0x29c682?'Statement\x20'+_0x2b2f8c+'/'+_0x1010b2+':\x0a':'',_0xb33dcb=_0x98e127 instanceof SDKError?_0x98e127[_0x38c416(0xa5)]:_0x98e127[_0x38c416(0x92)];return console['error'](''+_0x5d9e49+_0xb33dcb),0x1;}}if(_0x363316[_0x38c416(0x85)]>0x1&&_0x10bf19&&_0x9e68f[_0x38c416(0x85)]>0x0){const _0x5b2151=_0x9e68f[_0x38c416(0x8d)]('\x0a');writeFileSync(_0x11c8da[_0x38c416(0x95)],_0x5b2151),console[_0x38c416(0x90)](_0x38c416(0x9a)+_0x11c8da[_0x38c416(0x95)]);}return 0x0;}catch(_0x2dc6f9){throw _0x2dc6f9;}}[a33_0x49afb9(0x9f)](_0x324e44){const _0x3b3afc=a33_0x49afb9,_0x8b7f0b=_0x324e44[_0x3b3afc(0x93)][0x0],_0x2d4d7f=_0x324e44[_0x3b3afc(0x8e)][_0x3b3afc(0x81)];if(!_0x8b7f0b&&!_0x2d4d7f)return _0x3b3afc(0x9d);if(_0x8b7f0b&&_0x2d4d7f)return _0x3b3afc(0x9c);return undefined;}}
|