@treasuredata/tdx 0.26.3 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/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/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-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.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0xb2ec14=a22_0x56bd;(function(_0x3f4f6f,_0x3acecf){const _0x530489=a22_0x56bd,_0xb0dbee=_0x3f4f6f();while(!![]){try{const _0x194ee8=parseInt(_0x530489(0x278))/0x1+parseInt(_0x530489(0x2ae))/0x2+parseInt(_0x530489(0x299))/0x3*(-parseInt(_0x530489(0x24c))/0x4)+parseInt(_0x530489(0x26b))/0x5*(parseInt(_0x530489(0x2ab))/0x6)+parseInt(_0x530489(0x2fc))/0x7*(parseInt(_0x530489(0x236))/0x8)+parseInt(_0x530489(0x226))/0x9+parseInt(_0x530489(0x241))/0xa*(-parseInt(_0x530489(0x20a))/0xb);if(_0x194ee8===_0x3acecf)break;else _0xb0dbee['push'](_0xb0dbee['shift']());}catch(_0x43340e){_0xb0dbee['push'](_0xb0dbee['shift']());}}}(a22_0x4638,0x56c10));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x1c8aec 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 a22_0x57ad1f from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a22_0xb2ec14(0x269);function openBrowser(_0x2e8cf6){const _0x5de5a6=a22_0xb2ec14,_0x3f68f4=process[_0x5de5a6(0x345)],_0x471d07=_0x3f68f4===_0x5de5a6(0x2ec)?_0x5de5a6(0x2b8):_0x3f68f4===_0x5de5a6(0x304)?_0x5de5a6(0x344):'xdg-open';spawn(_0x471d07,[_0x2e8cf6],{'detached':!![],'stdio':_0x5de5a6(0x2e6)})[_0x5de5a6(0x31d)]();}function migrateLegacyDirectory(){const _0x6f4e03=a22_0xb2ec14;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4c67e3=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4c67e3['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x6f4e03(0x238)](a22_0x57ad1f['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x6f4e03(0x29a)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x6f4e03(0x238)](a22_0x57ad1f[_0x6f4e03(0x2cb)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x6f4e03(0x238)](a22_0x57ad1f[_0x6f4e03(0x31c)](_0x6f4e03(0x2a8)+LEGACY_PARENT_SEGMENT_DIR+_0x6f4e03(0x2d7)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x6f4e03(0x238)](a22_0x57ad1f['green'](_0x6f4e03(0x1d0)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x1d1b5e){const _0x3ae2e1=_0x1d1b5e instanceof Error?_0x1d1b5e[_0x6f4e03(0x1e0)]:String(_0x1d1b5e);return console[_0x6f4e03(0x238)](a22_0x57ad1f[_0x6f4e03(0x20f)](_0x6f4e03(0x2ee)+_0x3ae2e1+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0xb2ec14(0x335)](_0xb2b4b7){const _0x4a9deb=a22_0xb2ec14;return migrateLegacyDirectory(),super[_0x4a9deb(0x335)](_0xb2b4b7);}}function resolveYamlFile(_0x3c5ee4){const _0x1e07f6=a22_0xb2ec14;if(_0x3c5ee4['endsWith']('.yml')||_0x3c5ee4['endsWith'](_0x1e07f6(0x302)))return _0x3c5ee4;return a22_0x1c8aec[_0x1e07f6(0x232)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3c5ee4)+_0x1e07f6(0x2a7));}function formatProgressMessage(_0x5c601b){const _0x2f86a2=a22_0xb2ec14,_0x55a1f3=_0x5c601b['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x55a1f3){const [,_0x534f59,_0x28df8f,_0x106f6c='']=_0x55a1f3;return a22_0x57ad1f[_0x2f86a2(0x2cb)](_0x534f59+':')+'\x20'+_0x28df8f+a22_0x57ad1f[_0x2f86a2(0x2cb)](_0x106f6c);}return a22_0x57ad1f['dim'](_0x5c601b);}function showFileNotFoundError(_0x4c613f,_0x1d898f){const _0x542077=a22_0xb2ec14;console[_0x542077(0x238)](a22_0x57ad1f[_0x542077(0x20f)]('Error:\x20File\x20not\x20found:\x20'+_0x4c613f+'\x0a')),console['error'](a22_0x57ad1f[_0x542077(0x2f1)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x1d898f+_0x542077(0x211)));}function a22_0x4638(){const _0x45355a=['Attempt:','\x20RT\x20configuration\x20is\x20valid','single','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','customerPercent','errors','json','Updating','Source:','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','allValid','stitchingKeys','433165AQbzAx','listParents','column_type','all','database','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','interval','\x20--behavior\x20\x22','text','personalization_services','Master:','audienceId','Resolving\x20parent\x20segment\x20\x27','stop','stats','ps:rt:validate','elapsedTimeMillis','Output\x20Database:','Validating\x20configuration...','attributesFile','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Apply\x20changes\x20to\x20\x27','Fetching\x20SQL\x20for\x20\x27','map','No\x20personalization\x20services\x20configured','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\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','Preview:','indexOf','9gaHwle','/\x20and\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','Created','/sessions/','valid','Output\x20file:\x20','\x20service(s)\x20configured','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Schema\x20saved\x20to\x20','displayValidateResults','.yml','\x0a⚠️\x20\x20Migrating:\x20','✔\x20Query\x20completed:\x20Processed\x20','previewParentYaml','5010xrHWdw','\x20\x202.\x20Run\x20','sourceTableError','1064506qQAnRp','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','td_client_id','Fetching\x20behavior\x20list...','foreignKey','Error:\x20--attribute\x20requires\x20a\x20name\x0a','limit','scheduleOption','enriched','open','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','⚡\x20Enabled','Creating\x20parent\x20segment\x20\x27','\x20rows)','To\x20view\x20sample\x20data:','collectSchema','Errors:','page_view','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20-\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Aborted.','Creating','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Validate:','last_page_viewed','/app/dw/parentSegments/','segment:parent:run','dim','-1d','\x20trigger=','displaySampleData','getParentFull','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20total','List\x20available\x20fields\x20for\x20segmentation','\x20=\x20','/\x20→\x20','jsonl','Site:\x20','Attribute:','attribute','customers','label','personalizationServices','displayMasterInfo','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','behavior_','displayPreviewResults','rowCount','\x27\x20is\x20already\x20up\x20to\x20date','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','ignore','segment:parent:show','table','\x20parent\x20segment\x20\x27','\x0a✔\x20Workflow\x20started','Status:','darwin','updateParent','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20to\x20configure\x20your\x20personalization\x20service','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Enriched:','✔\x20Found\x20','timezone','\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','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','getBehaviorNames','displayRealtimeInfo','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20parent\x20segment\x20\x27','21133AcwOiD','\x20service','resolveParentId','\x20\x20Tables:\x201\x20customers\x20+\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20--attribute\x20\x22','.yaml','Rows:','win32','\x20Context\x20set:\x20','getParentSQL','output','customerGroup','runParent','jobId','\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','displayAttributesStats','addBehaviorsFile','Error:','\x22,\x20\x22type\x22:\x20\x22','log','\x20\x20\x20','\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','\x20+\x20[','type','personalization','format','\x0aNo\x20sample\x20data\x20available','addAttributesFile','SELECT\x20*\x20FROM\x20(\x0a','behaviors','listFields','yellow','unref','localeCompare','\x20tdx\x20wf\x20attempt\x20','List\x20parent\x20segments','\x20Opening\x20','in\x20','segment','idStitching','user_id','Behaviors','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Coverage:','Available\x20behaviors:','Customers:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','apply','keys','workflowId','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','toLocaleString','Executing\x20parent\x20segment\x20query...','run','Options:','matchedCount','green','parent_id','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','population','Create\x20parent\x20segment\x20\x27','Pattern:\x20','description','true','verbose','segment:parent:validate','To\x20cancel:','start','platform','attributes','repeat','\x20[Job\x20ID:\x20','toFixed','No\x20parent\x20segments\x20match\x20pattern:\x20','test','\x5c$&','Updated','realtime','\x20\x20Database:\x20','number','scheduleType','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','tdx\x20ps\x20push\x20','\x20\x20Columns:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','⚡\x20Not\x20enabled','pullParentYaml','displaySummary','Attributes:','FINISHED','\x20--enriched','SQL\x20query:\x0a','\x20configured','workflowAttemptId','\x0a\x20\x20\x20\x20]','Get\x20SQL\x20query\x20for\x20parent\x20segment','✔\x20Renamed\x20directory\x20to\x20','column_name','\x0a\x20\x20\x20\x20}','Listing\x20parent\x20segments...','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','/app/workflows/','string','%)\x20','Error\x20reading\x20file:\x20','master','Options:\x0a','\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','segment:parent:fields','Session:','\x20No\x20changes\x20-\x20','addAttributes','message','\x0aUsage:\x20tdx\x20ps\x20preview\x20','site','joinKey','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','My\x20Service','RT\x202.0:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','validateParentYaml','session','Options\x20(one\x20required):\x0a','\x20kill','\x20\x201.\x20Edit\x20','ps:pz:list','events','tdx\x20ps\x20preview\x20','Name:\x20','Join:','enabled','schemaValid','\x20--attribute\x20\x22<name>\x22','\x20RT-enabled\x20parent\x20segment','sections','web','trim','segment:parent:list','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20behaviors','realtime_enabled','Personalization:','utf-8','<database>.<table>','\x22\x20}','behavior','segment:parent:pull','sampleData','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Fetching\x20sample\x20data...','\x20\x20No\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x0aError:','Join\x20on:','11zcHaWA','setJobId','\x20Added\x20RT\x202.0\x20template\x20section','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x0aChanges\x20to\x20apply\x20to\x20\x27','red','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','`\x20to\x20download\x20the\x20configuration\x20first','replace','{\x0a\x20\x20\x22database\x22:\x20\x22','Show\x20parent\x20segment\x20details','\x27...','segment:parent:create','coveragePercent','Personalization\x20service\x20description','Next\x20steps:','name','SELECT\x20*\x20FROM\x20','Listing\x20fields\x20for\x20\x27','displayColumns','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','list','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Error\x20parsing\x20YAML:\x20','data','Validating\x20RT\x20configuration...','workflowSessionId','Database:\x20','2475729cKBydW','\x27\x20is\x20up\x20to\x20date','preview','Listing\x20RT-enabled\x20parent\x20segments...','\x0a\x20\x20]\x0a}\x0a','\x27\x20and\x20run\x20workflow?','displayBehaviorsStats','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','RT\x202.0\x20Validate:','Master\x20+\x20Attributes','parentSegment','behaviorsFile','join','\x20--interval\x20','\x20to\x20push\x20the\x20configuration','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','1104ZvwKPe','double','error','ps:rt:list','yes','segment:parent:preview','👥\x20','varchar','segment:parent:sql','Events:','ps:pz:init','14729820htEEHU','Found\x20YAML\x20file:\x20','Listing\x20personalization\x20services\x20for\x20\x27','customerGroupFile','filter','\x20Configuration\x20is\x20valid','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','displayPreviewHints','\x20field','\x20\x20\x20\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','510980CAmmhS','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','column','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Behavior:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','✔\x20Updated\x20parent\x20segment\x20\x27','columns','trigger_event','query','schemaError','Parent\x20segment:\x20','customersWithEvents','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','✔\x20Created\x20parent\x20segment\x20\x27','toLowerCase','bold','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','length','\x20section','push','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','execute','totalEvents','Columns:','Analyzing\x20changes...','parent_segment','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','3320wNQvJA'];a22_0x4638=function(){return _0x45355a;};return a22_0x4638();}function displayRealtimeValidation(_0xecb28d){const _0x31c81a=a22_0xb2ec14;if(!_0xecb28d['realtime'])return;const _0x4b238f=_0xecb28d[_0x31c81a(0x34e)],_0x1f9c4f=_0x4b238f[_0x31c81a(0x1f2)]?a22_0x57ad1f[_0x31c81a(0x338)](_0x31c81a(0x2ba)):a22_0x57ad1f['yellow'](_0x31c81a(0x1c5));console[_0x31c81a(0x238)]('\x0a'+a22_0x57ad1f[_0x31c81a(0x2cb)](_0x31c81a(0x1e6))+'\x20'+_0x1f9c4f);if(_0x4b238f['events']&&_0x4b238f[_0x31c81a(0x1ee)][_0x31c81a(0x261)]>0x0){console['error']('\x20\x20'+a22_0x57ad1f[_0x31c81a(0x2cb)](_0x31c81a(0x23f))+'\x20'+_0x4b238f[_0x31c81a(0x1ee)][_0x31c81a(0x261)]+_0x31c81a(0x1cc));for(const _0x263815 of _0x4b238f[_0x31c81a(0x1ee)]){const _0x2c390b=_0x263815['sourceTableValid']===![]?a22_0x57ad1f['red']('✘'):a22_0x57ad1f[_0x31c81a(0x338)]('✔');console[_0x31c81a(0x238)](_0x31c81a(0x24a)+_0x2c390b+'\x20'+_0x263815[_0x31c81a(0x21a)]),_0x263815[_0x31c81a(0x2ad)]&&console[_0x31c81a(0x238)]('\x20\x20\x20\x20\x20\x20'+a22_0x57ad1f[_0x31c81a(0x20f)](_0x263815['sourceTableError']));}}if(_0x4b238f[_0x31c81a(0x346)]&&_0x4b238f['attributes'][_0x31c81a(0x261)]>0x0){console[_0x31c81a(0x238)]('\x20\x20'+a22_0x57ad1f[_0x31c81a(0x2cb)](_0x31c81a(0x1c8))+'\x20'+_0x4b238f[_0x31c81a(0x346)][_0x31c81a(0x261)]+_0x31c81a(0x1cc));for(const _0x31afb5 of _0x4b238f[_0x31c81a(0x346)]){const _0x95818d=_0x31afb5[_0x31c81a(0x29e)]?a22_0x57ad1f[_0x31c81a(0x338)]('✔'):a22_0x57ad1f[_0x31c81a(0x20f)]('✘');console['error'](_0x31c81a(0x24a)+_0x95818d+'\x20'+_0x31afb5[_0x31c81a(0x21a)]+'\x20'+a22_0x57ad1f['dim']('('+_0x31afb5['type']+')'));}}if(_0x4b238f['idStitching']){const _0x114b5d=_0x4b238f[_0x31c81a(0x324)][_0x31c81a(0x277)]?.[_0x31c81a(0x261)]?_0x31c81a(0x313)+_0x4b238f[_0x31c81a(0x324)][_0x31c81a(0x277)][_0x31c81a(0x232)](',\x20')+']':'';console[_0x31c81a(0x238)]('\x20\x20'+a22_0x57ad1f[_0x31c81a(0x2cb)]('ID\x20Stitching:')+'\x20'+_0x4b238f['idStitching']['primaryKey']+_0x114b5d);}if(_0x4b238f[_0x31c81a(0x2de)]&&_0x4b238f[_0x31c81a(0x2de)][_0x31c81a(0x261)]>0x0){console['error']('\x20\x20'+a22_0x57ad1f[_0x31c81a(0x2cb)](_0x31c81a(0x1fd))+'\x20'+_0x4b238f['personalizationServices'][_0x31c81a(0x261)]+_0x31c81a(0x2fd)+(_0x4b238f[_0x31c81a(0x2de)][_0x31c81a(0x261)]!==0x1?'s':''));for(const _0x4691d2 of _0x4b238f['personalizationServices']){console[_0x31c81a(0x238)](_0x31c81a(0x2c2)+_0x4691d2[_0x31c81a(0x21a)]);}}}function showParentSegmentNotSetError(_0x388da5){const _0x2e5c68=a22_0xb2ec14;console[_0x2e5c68(0x238)](a22_0x57ad1f['yellow'](_0x2e5c68(0x24b))),console[_0x2e5c68(0x238)](_0x388da5);}export class ParentSegmentListCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x1f9);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x320);async[a22_0xb2ec14(0x265)](_0x1a262d){const _0x436940=a22_0xb2ec14,{options:_0x251bd3,args:_0x70b507,tdx:_0x4c77e9}=_0x1a262d,_0x55b626=_0x70b507[0x0];_0x251bd3[_0x436940(0x341)]&&(console['error'](_0x436940(0x2d9)+_0x251bd3[_0x436940(0x1e2)]),_0x55b626&&console[_0x436940(0x238)](_0x436940(0x33e)+_0x55b626));const _0x151f31=await withSpinner(_0x55b626?_0x436940(0x2c1)+_0x55b626+_0x436940(0x215):_0x436940(0x1d3),()=>_0x4c77e9['segment'][_0x436940(0x279)](),{'verbose':_0x251bd3[_0x436940(0x341)]});let _0x4467dc=_0x151f31[_0x436940(0x222)];if(_0x55b626){const _0x2e0820=_0x55b626['replace'](/[.+^${}()|[\]\\]/g,_0x436940(0x34c))['replace'](/\*/g,'.*')[_0x436940(0x212)](/\?/g,'.'),_0x67f7b0=new RegExp('^'+_0x2e0820+'$','i');_0x4467dc=_0x4467dc[_0x436940(0x245)](_0x119b6d=>_0x67f7b0[_0x436940(0x34b)](_0x119b6d[_0x436940(0x346)]['name']));}_0x4467dc['sort']((_0x1de9c1,_0x379945)=>_0x1de9c1['attributes'][_0x436940(0x21a)][_0x436940(0x31e)](_0x379945[_0x436940(0x346)][_0x436940(0x21a)])),console['error'](_0x436940(0x2f4)+_0x4467dc[_0x436940(0x261)]+'\x20parent\x20segment'+(_0x4467dc[_0x436940(0x261)]!==0x1?'s':''));const _0x441cbe=_0x424e0b=>{const _0xff3767=_0x436940;return getConsoleNextUrl(_0x251bd3[_0xff3767(0x1e2)],'/app/dw/parentSegments/'+_0x424e0b);};if(_0x251bd3[_0x436940(0x316)]===_0x436940(0x272)||_0x251bd3['format']==='jsonl'){const _0x5b14ee=_0x4467dc['map'](_0x18a978=>({..._0x18a978,'url':_0x441cbe(_0x18a978['id'])}));await handleSDKOutput(_0x5b14ee,_0x251bd3);}else{if(_0x4467dc['length']===0x0)_0x55b626?console['log'](_0x436940(0x34a)+_0x55b626):console[_0x436940(0x310)]('No\x20parent\x20segments\x20found');else for(const _0x162d2b of _0x4467dc){const _0x8fec2=_0x162d2b[_0x436940(0x346)][_0x436940(0x33c)]?a22_0x57ad1f['dim']('\x20('+formatRows(_0x162d2b[_0x436940(0x346)][_0x436940(0x33c)])+')'):'',_0x27fe2d=hyperlink(_0x162d2b['attributes'][_0x436940(0x21a)],_0x441cbe(_0x162d2b['id']));console[_0x436940(0x310)](_0x436940(0x23c)+_0x27fe2d+_0x8fec2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x216);[a22_0xb2ec14(0x33f)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0xb2ec14(0x265)](_0x38f25b){const _0xc0a1e7=a22_0xb2ec14,{options:_0x211e76,args:_0x83675a,tdx:_0x5e3c81}=_0x38f25b;console[_0xc0a1e7(0x238)](_0xc0a1e7(0x250)+_0xc0a1e7(0x295)+_0xc0a1e7(0x1c1));const _0x3d79fb=_0x211e76;if(_0x83675a['length']===0x0)return console[_0xc0a1e7(0x238)](a22_0x57ad1f[_0xc0a1e7(0x20f)](_0xc0a1e7(0x2fa))),console[_0xc0a1e7(0x238)](_0xc0a1e7(0x26f)),0x1;const _0x254f2b=_0x83675a[0x0];if(!_0x3d79fb[_0xc0a1e7(0x27c)]||!_0x3d79fb[_0xc0a1e7(0x2e8)])return console[_0xc0a1e7(0x238)](_0xc0a1e7(0x32e)),console[_0xc0a1e7(0x238)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x3d79fb[_0xc0a1e7(0x341)]&&(console['error']('Site:\x20'+_0x3d79fb[_0xc0a1e7(0x1e2)]),console['error'](_0xc0a1e7(0x1f0)+_0x254f2b),console[_0xc0a1e7(0x238)](_0xc0a1e7(0x225)+_0x3d79fb[_0xc0a1e7(0x27c)]),console[_0xc0a1e7(0x238)]('Table:\x20'+_0x3d79fb[_0xc0a1e7(0x2e8)]));const _0x46c83e=await loadJSONFromOptions(_0x3d79fb[_0xc0a1e7(0x346)],_0x3d79fb[_0xc0a1e7(0x28f)]),_0xa83fbd=await loadJSONFromOptions(_0x3d79fb[_0xc0a1e7(0x31a)],_0x3d79fb[_0xc0a1e7(0x231)]),_0x41919b=await loadJSONFromOptions(_0x3d79fb[_0xc0a1e7(0x308)],_0x3d79fb[_0xc0a1e7(0x244)]),_0x306207={'name':_0x254f2b,'description':_0x3d79fb[_0xc0a1e7(0x33f)],'scheduleType':_0x3d79fb[_0xc0a1e7(0x351)],'scheduleOption':_0x3d79fb[_0xc0a1e7(0x2b6)],'timezone':_0x3d79fb[_0xc0a1e7(0x2f5)],'master':{'parentDatabaseName':_0x3d79fb['database'],'parentTableName':_0x3d79fb[_0xc0a1e7(0x2e8)]},'attributes':_0x46c83e,'behaviors':_0xa83fbd,'customerGroup':_0x41919b},_0xaebecf=await withSpinner(_0xc0a1e7(0x2bb)+_0x254f2b+_0xc0a1e7(0x215),()=>_0x5e3c81[_0xc0a1e7(0x323)]['createParent'](_0x306207),{'verbose':_0x211e76[_0xc0a1e7(0x341)]}),_0x2cac91=_0xaebecf[_0xc0a1e7(0x222)];return console[_0xc0a1e7(0x238)](_0xc0a1e7(0x25d)+_0x2cac91[_0xc0a1e7(0x21a)]+'\x27\x20with\x20ID:\x20'+_0x2cac91['id']),await handleSDKOutput([_0x2cac91],_0x211e76),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]='segment:parent:update';[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x24f);async[a22_0xb2ec14(0x265)](_0x1f21d8){const _0x237bd6=a22_0xb2ec14,{options:_0x5ab56e,args:_0x4c5728,tdx:_0x269897}=_0x1f21d8;console[_0x237bd6(0x238)](_0x237bd6(0x2b9)+_0x237bd6(0x295)+_0x237bd6(0x1c1));const _0x5a2ab6=_0x5ab56e;if(_0x4c5728[_0x237bd6(0x261)]===0x0)return console[_0x237bd6(0x238)](a22_0x57ad1f[_0x237bd6(0x20f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x237bd6(0x238)](_0x237bd6(0x33b)),0x1;const _0x33f268=_0x4c5728[0x0];_0x5a2ab6[_0x237bd6(0x341)]&&(console[_0x237bd6(0x238)](_0x237bd6(0x2d9)+_0x5a2ab6[_0x237bd6(0x1e2)]),console[_0x237bd6(0x238)]('Parent\x20segment:\x20'+_0x33f268));const _0x5d26e9=await withSpinner(_0x237bd6(0x2d2)+_0x33f268+_0x237bd6(0x215),()=>_0x269897[_0x237bd6(0x323)][_0x237bd6(0x2cf)](_0x33f268),{'verbose':_0x5a2ab6[_0x237bd6(0x341)]}),_0x50f767=_0x5d26e9['data'],_0x3b441d=await loadJSONFromOptions(_0x5a2ab6[_0x237bd6(0x1df)],_0x5a2ab6[_0x237bd6(0x318)]),_0x27b851=await loadJSONFromOptions(_0x5a2ab6['addBehaviors'],_0x5a2ab6[_0x237bd6(0x30d)]),_0x562082={'name':_0x50f767[_0x237bd6(0x21a)],'description':_0x5a2ab6[_0x237bd6(0x33f)]!==undefined?_0x5a2ab6[_0x237bd6(0x33f)]:_0x50f767[_0x237bd6(0x33f)],'scheduleType':_0x5a2ab6[_0x237bd6(0x351)]!==undefined?_0x5a2ab6[_0x237bd6(0x351)]:_0x50f767[_0x237bd6(0x351)],'scheduleOption':_0x5a2ab6[_0x237bd6(0x2b6)]!==undefined?_0x5a2ab6[_0x237bd6(0x2b6)]:_0x50f767[_0x237bd6(0x2b6)],'timezone':_0x5a2ab6['timezone']!==undefined?_0x5a2ab6['timezone']:_0x50f767['timezone'],'master':_0x50f767[_0x237bd6(0x1d9)],'attributes':_0x3b441d?[..._0x50f767[_0x237bd6(0x346)]||[],..._0x3b441d]:_0x50f767[_0x237bd6(0x346)],'behaviors':_0x27b851?[..._0x50f767[_0x237bd6(0x31a)]||[],..._0x27b851]:_0x50f767[_0x237bd6(0x31a)],'customerGroup':_0x50f767[_0x237bd6(0x308)]},_0x2b4c98=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x33f268+_0x237bd6(0x215),()=>_0x269897[_0x237bd6(0x323)][_0x237bd6(0x2ed)](_0x33f268,_0x562082),{'verbose':_0x5a2ab6[_0x237bd6(0x341)]}),_0x479c22=_0x2b4c98[_0x237bd6(0x222)];return console['error'](_0x237bd6(0x254)+_0x479c22[_0x237bd6(0x21a)]+'\x27'),await handleSDKOutput([_0x479c22],_0x5a2ab6),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x202);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x327);async[a22_0xb2ec14(0x265)](_0x1c6ed){const _0xb40aae=a22_0xb2ec14,{options:_0x2c3757,args:_0x1e93af,tdx:_0x45205d}=_0x1c6ed,_0x1d05ff=_0x2c3757,_0x47a576=_0x1e93af[0x0]||_0x2c3757['parentSegment'];if(!_0x47a576)return showParentSegmentNotSetError(_0xb40aae(0x1e7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x1d05ff['use']&&_0x1d05ff['output'])return console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x20f)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console['error'](a22_0x57ad1f[_0xb40aae(0x2cb)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0xb40aae(0x238)](a22_0x57ad1f['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a22_0x57ad1f['cyan'](_0xb40aae(0x1e4))),0x1;const _0x2b1c42=_0x1d05ff[_0xb40aae(0x307)]||a22_0x1c8aec[_0xb40aae(0x232)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x47a576)+_0xb40aae(0x2a7));_0x1d05ff['verbose']&&(console[_0xb40aae(0x238)](_0xb40aae(0x2d9)+_0x1d05ff[_0xb40aae(0x1e2)]),console[_0xb40aae(0x238)](_0xb40aae(0x259)+_0x47a576),console[_0xb40aae(0x238)](_0xb40aae(0x29f)+_0x2b1c42));const _0x2fc2aa=await withSpinner(_0xb40aae(0x2fb)+_0x47a576+'\x27...',()=>_0x45205d['segment'][_0xb40aae(0x1c6)](_0x47a576),{'verbose':_0x1d05ff[_0xb40aae(0x341)]}),_0x3214b6=_0x2fc2aa['data'];if(existsSync(_0x2b1c42)){const _0x1fa0f9=readFileSync(_0x2b1c42,_0xb40aae(0x1fe)),_0x5bd122=generateDiff(_0x1fa0f9,_0x3214b6);if(!hasChanges(_0x5bd122))console['error'](a22_0x57ad1f['green']('✔')+_0xb40aae(0x1de)+a22_0x57ad1f[_0xb40aae(0x2f1)](_0x2b1c42)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0xb40aae(0x238)]('\x0aChanges\x20to\x20\x27'+_0x2b1c42+'\x27:'),console['error']('─'[_0xb40aae(0x347)](0x3c)),console['error'](formatDiffWithColors(_0x5bd122)),console['error']('─'[_0xb40aae(0x347)](0x3c));if(!_0x1d05ff['yes']){if(!isInteractive())return console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x20f)](_0xb40aae(0x208)),_0xb40aae(0x2a2)),console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x2cb)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x19f493=await confirmKey('Overwrite\x20\x27'+_0x2b1c42+'\x27?');if(!_0x19f493)return console[_0xb40aae(0x238)](a22_0x57ad1f['yellow'](_0xb40aae(0x2c4))),0x1;}writeFileSync(_0x2b1c42,_0x3214b6,_0xb40aae(0x1fe)),console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x338)]('✔')+_0xb40aae(0x329)+a22_0x57ad1f['cyan'](_0x2b1c42));}}else{const _0x374cfe=a22_0x1c8aec['dirname'](_0x2b1c42);!existsSync(_0x374cfe)&&mkdirSync(_0x374cfe,{'recursive':!![]}),writeFileSync(_0x2b1c42,_0x3214b6,_0xb40aae(0x1fe)),console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x338)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x57ad1f['cyan'](_0x2b1c42));}return saveSessionContext({'parent_segment':_0x47a576},_0x1d05ff[_0xb40aae(0x1e9)]),console[_0xb40aae(0x238)](a22_0x57ad1f[_0xb40aae(0x338)]('✔')+_0xb40aae(0x305)+a22_0x57ad1f[_0xb40aae(0x2cb)](_0xb40aae(0x269))+_0xb40aae(0x2d6)+a22_0x57ad1f[_0xb40aae(0x2f1)](_0x47a576)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0xb2ec14(0x21a)]='segment:parent:push';[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x204);async['execute'](_0x4e80f8){const _0x3981f7=a22_0xb2ec14,{options:_0x58016f,args:_0x490bbd,tdx:_0x2d4682}=_0x4e80f8,_0x323617=_0x58016f,_0x2b3f11=_0x490bbd[0x0]||_0x58016f['parentSegment'];if(!_0x2b3f11)return showParentSegmentNotSetError(_0x3981f7(0x290)+_0x3981f7(0x281)),0x1;const _0xcb7419=resolveYamlFile(_0x2b3f11);if(!existsSync(_0xcb7419))return showFileNotFoundError(_0xcb7419,_0x2b3f11),0x1;_0x323617['verbose']&&(console[_0x3981f7(0x238)](_0x3981f7(0x2d9)+_0x323617['site']),console['error'](_0x3981f7(0x25b)+_0xcb7419));let _0x21c100;try{_0x21c100=readFileSync(_0xcb7419,_0x3981f7(0x1fe));}catch(_0x1563f1){const _0x48c4a0=_0x1563f1 instanceof Error?_0x1563f1[_0x3981f7(0x1e0)]:String(_0x1563f1);return console['error'](_0x3981f7(0x1d8)+_0x48c4a0),0x1;}const _0x2d3fd6=await withSpinner(_0x3981f7(0x268),()=>_0x2d4682[_0x3981f7(0x323)]['pushParentYaml'](_0x21c100),{'verbose':_0x323617[_0x3981f7(0x341)]}),_0x54c4ac=_0x2d3fd6[_0x3981f7(0x222)],{isNew:_0x4887cc,name:_0x415d0b,hasChanges:_0x5b6397,diffFormatted:_0x19ddf6}=_0x54c4ac;if(!_0x5b6397)return console[_0x3981f7(0x238)]('✔\x20No\x20changes\x20-\x20\x27'+_0x415d0b+_0x3981f7(0x2e4)),0x0;_0x4887cc?console[_0x3981f7(0x238)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x415d0b+'\x27:'):console[_0x3981f7(0x238)](_0x3981f7(0x20e)+_0x415d0b+'\x27:');console['error']('─'[_0x3981f7(0x347)](0x3c)),console[_0x3981f7(0x238)](_0x19ddf6),console[_0x3981f7(0x238)]('─'['repeat'](0x3c));const _0x5c687e=_0x4887cc?_0x3981f7(0x33d)+_0x415d0b+'\x27?':_0x3981f7(0x291)+_0x415d0b+'\x27?';if(!_0x323617['yes']){if(!isInteractive())return console[_0x3981f7(0x238)](a22_0x57ad1f['red'](_0x3981f7(0x208)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x3981f7(0x238)](a22_0x57ad1f[_0x3981f7(0x2cb)](_0x3981f7(0x300))),0x1;const _0x10a7ef=await confirmKey(_0x5c687e);if(!_0x10a7ef)return console[_0x3981f7(0x238)](a22_0x57ad1f['yellow'](_0x3981f7(0x2c4))),0x1;}const _0x1d036f=_0x4887cc?_0x3981f7(0x2c5):'Updating',_0x53c3f0=await withSpinner(_0x1d036f+_0x3981f7(0x2e9)+_0x415d0b+'\x27...',()=>_0x54c4ac[_0x3981f7(0x32f)](),{'verbose':_0x323617[_0x3981f7(0x341)]}),_0xf1d604=_0x53c3f0['data'],_0x2cda47=getConsoleNextUrl(_0x323617['site'],_0x3981f7(0x2c9)+_0xf1d604['id']),_0x4cc9a4=_0x4887cc?_0x3981f7(0x29c):'Updated';return console[_0x3981f7(0x238)]('✔\x20'+_0x4cc9a4+'\x20parent\x20segment\x20\x27'+_0xf1d604[_0x3981f7(0x21a)]+'\x27'),console[_0x3981f7(0x238)]('\x20\x20'+_0x2cda47),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x342);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x2e5);async[a22_0xb2ec14(0x265)](_0x1207f9){const _0x49f1cc=a22_0xb2ec14,{options:_0x4bd55c,args:_0x5dbd05,tdx:_0xede9d6}=_0x1207f9,_0x3383dd=_0x4bd55c,_0x535d0d=_0x5dbd05[0x0]||_0x4bd55c[_0x49f1cc(0x230)];if(!_0x535d0d)return showParentSegmentNotSetError(_0x49f1cc(0x2a1)+_0x49f1cc(0x27f)+_0x49f1cc(0x1da)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x49f1cc(0x2b0)+_0x49f1cc(0x2a3)),0x1;const _0x28941a=resolveYamlFile(_0x535d0d);if(!existsSync(_0x28941a))return showFileNotFoundError(_0x28941a,_0x535d0d),0x1;_0x3383dd['verbose']&&(console['error'](_0x49f1cc(0x2d9)+_0x3383dd[_0x49f1cc(0x1e2)]),console[_0x49f1cc(0x238)](_0x49f1cc(0x25b)+_0x28941a));let _0x15a7c7;try{_0x15a7c7=readFileSync(_0x28941a,'utf-8');}catch(_0x80ad07){const _0x1a849f=_0x80ad07 instanceof Error?_0x80ad07[_0x49f1cc(0x1e0)]:String(_0x80ad07);return console[_0x49f1cc(0x238)](_0x49f1cc(0x1d8)+_0x1a849f),0x1;}const _0x52d63d=createCommandSpinner(a22_0x57ad1f[_0x49f1cc(0x2cb)](_0x49f1cc(0x28e)),{'verbose':_0x3383dd[_0x49f1cc(0x341)]});_0x52d63d[_0x49f1cc(0x344)]();const _0x4effe7={'onProgress':_0x4ff849=>{const _0x26ab89=_0x49f1cc;_0x52d63d[_0x26ab89(0x284)]=formatProgressMessage(_0x4ff849);}};if(_0x3383dd[_0x49f1cc(0x1d9)])_0x4effe7[_0x49f1cc(0x1d9)]=!![];if(_0x3383dd[_0x49f1cc(0x2b7)])_0x4effe7[_0x49f1cc(0x2b7)]=!![];_0x3383dd[_0x49f1cc(0x2db)]&&(_0x4effe7[_0x49f1cc(0x2db)]=_0x3383dd['attribute']);_0x3383dd[_0x49f1cc(0x201)]&&(_0x4effe7[_0x49f1cc(0x201)]=_0x3383dd[_0x49f1cc(0x201)]);if(_0x3383dd[_0x49f1cc(0x282)])_0x4effe7[_0x49f1cc(0x282)]=_0x3383dd['interval'];let _0x3b43c0;try{_0x3b43c0=await _0xede9d6[_0x49f1cc(0x323)][_0x49f1cc(0x1e8)](_0x15a7c7,_0x4effe7),_0x52d63d['stop']();}catch(_0x6038d0){_0x52d63d['stop']();throw _0x6038d0;}const _0x4a1722=_0x3383dd[_0x49f1cc(0x282)]||_0x49f1cc(0x2cc);return this[_0x49f1cc(0x2a6)](_0x3b43c0,_0x4effe7,_0x28941a,_0x4a1722),_0x3b43c0[_0x49f1cc(0x276)]?0x0:0x1;}[a22_0xb2ec14(0x2a6)](_0x23ee1d,_0x48c6db,_0x2f7e70,_0x175191){const _0x12c7e1=a22_0xb2ec14;console[_0x12c7e1(0x238)]('\x0a'+a22_0x57ad1f[_0x12c7e1(0x25f)](_0x12c7e1(0x2c7))+'\x20'+_0x23ee1d[_0x12c7e1(0x21a)]),console[_0x12c7e1(0x238)]('═'['repeat'](0x3c)),this[_0x12c7e1(0x2df)](_0x23ee1d);if(typeof _0x48c6db[_0x12c7e1(0x2db)]===_0x12c7e1(0x1d6)){this[_0x12c7e1(0x30c)](_0x23ee1d),this['displaySummary'](_0x23ee1d),this[_0x12c7e1(0x248)](_0x2f7e70,_0x175191,_0x12c7e1(0x2db),_0x48c6db[_0x12c7e1(0x2db)]);return;}if(_0x48c6db['attribute']===!![]){this['displayAttributesStats'](_0x23ee1d),this[_0x12c7e1(0x1c7)](_0x23ee1d),this[_0x12c7e1(0x248)](_0x2f7e70,_0x175191,'attributes');return;}if(typeof _0x48c6db['behavior']===_0x12c7e1(0x1d6)){this[_0x12c7e1(0x22c)](_0x23ee1d,_0x175191),this['displaySummary'](_0x23ee1d),this[_0x12c7e1(0x248)](_0x2f7e70,_0x175191,_0x12c7e1(0x201),_0x48c6db[_0x12c7e1(0x201)]);return;}if(_0x48c6db[_0x12c7e1(0x201)]===!![]){this[_0x12c7e1(0x22c)](_0x23ee1d,_0x175191),this[_0x12c7e1(0x1c7)](_0x23ee1d),this[_0x12c7e1(0x248)](_0x2f7e70,_0x175191,_0x12c7e1(0x31a));return;}this[_0x12c7e1(0x30c)](_0x23ee1d),this[_0x12c7e1(0x22c)](_0x23ee1d,_0x175191),this[_0x12c7e1(0x2f9)](_0x23ee1d),this[_0x12c7e1(0x1c7)](_0x23ee1d),this['displayPreviewHints'](_0x2f7e70,_0x175191,'all');}['displayRealtimeInfo'](_0x31b30c){displayRealtimeValidation(_0x31b30c);}['displayPreviewHints'](_0x5a7e42,_0x4e4c7b,_0x583b3c,_0x5f2002){const _0x33a3ba=a22_0xb2ec14;console[_0x33a3ba(0x238)]('\x0a'+a22_0x57ad1f[_0x33a3ba(0x2cb)](_0x33a3ba(0x2bd)));const _0x2e4ca1=_0x4e4c7b!==_0x33a3ba(0x2cc)?_0x33a3ba(0x233)+_0x4e4c7b:'';if(_0x583b3c===_0x33a3ba(0x2db)&&_0x5f2002)console[_0x33a3ba(0x238)]('\x20\x20'+a22_0x57ad1f['dim']('tdx\x20ps\x20preview\x20'+_0x5a7e42+_0x33a3ba(0x301)+_0x5f2002+'\x22'+_0x2e4ca1));else{if(_0x583b3c===_0x33a3ba(0x201)&&_0x5f2002)console['error']('\x20\x20'+a22_0x57ad1f[_0x33a3ba(0x2cb)](_0x33a3ba(0x1ef)+_0x5a7e42+_0x33a3ba(0x283)+_0x5f2002+'\x22'+_0x2e4ca1));else(_0x583b3c===_0x33a3ba(0x346)||_0x583b3c===_0x33a3ba(0x27b))&&console[_0x33a3ba(0x238)]('\x20\x20'+a22_0x57ad1f[_0x33a3ba(0x2cb)](_0x33a3ba(0x1ef)+_0x5a7e42+_0x33a3ba(0x1f4)+_0x2e4ca1));}(_0x583b3c==='behaviors'||_0x583b3c===_0x33a3ba(0x27b))&&console[_0x33a3ba(0x238)]('\x20\x20'+a22_0x57ad1f['dim']('tdx\x20ps\x20preview\x20'+_0x5a7e42+'\x20--behavior\x20\x22<name>\x22'+_0x2e4ca1)),_0x583b3c===_0x33a3ba(0x27b)&&console[_0x33a3ba(0x238)]('\x20\x20'+a22_0x57ad1f[_0x33a3ba(0x2cb)](_0x33a3ba(0x1ef)+_0x5a7e42+_0x33a3ba(0x1ca)+_0x2e4ca1));}['displayMasterInfo'](_0x36b4f3){const _0x359b70=a22_0xb2ec14,{master:_0x4e4f77}=_0x36b4f3,_0x5c3d02=_0x4e4f77[_0x359b70(0x1f3)]?a22_0x57ad1f[_0x359b70(0x338)]('✔'):a22_0x57ad1f[_0x359b70(0x20f)]('✘');console['error']('\x0a'+a22_0x57ad1f['dim']('Master\x20Table')),console['error'](_0x5c3d02+'\x20'+a22_0x57ad1f['bold'](_0x4e4f77[_0x359b70(0x27c)]+'.'+_0x4e4f77[_0x359b70(0x2e8)])),_0x4e4f77[_0x359b70(0x1f3)]?_0x4e4f77['rowCount']!==undefined&&console[_0x359b70(0x238)]('\x20\x20'+a22_0x57ad1f[_0x359b70(0x2cb)](_0x359b70(0x303))+'\x20'+a22_0x57ad1f[_0x359b70(0x2f1)](formatRows(_0x4e4f77[_0x359b70(0x2e3)]))):console[_0x359b70(0x238)]('\x20\x20'+a22_0x57ad1f[_0x359b70(0x20f)](_0x359b70(0x30e))+'\x20'+_0x4e4f77[_0x359b70(0x258)]);}['displayAttributesStats'](_0x253625){const _0x328b18=a22_0xb2ec14;if(_0x253625[_0x328b18(0x346)][_0x328b18(0x261)]===0x0)return;console[_0x328b18(0x238)]('\x0a'+a22_0x57ad1f[_0x328b18(0x2cb)]('Attributes'));for(const _0x19f2ff of _0x253625[_0x328b18(0x346)]){const _0x3ae458=_0x19f2ff[_0x328b18(0x1f3)]?a22_0x57ad1f['green']('✔'):a22_0x57ad1f[_0x328b18(0x20f)]('✘');let _0x53e26f='';if(_0x19f2ff[_0x328b18(0x1f3)]&&_0x19f2ff[_0x328b18(0x337)]!==undefined&&_0x19f2ff['coveragePercent']!==undefined){const _0x54b8a4=_0x19f2ff[_0x328b18(0x217)][_0x328b18(0x349)](0x1),_0x58bb4d=_0x19f2ff['coveragePercent']>=0x50?a22_0x57ad1f[_0x328b18(0x338)]:_0x19f2ff[_0x328b18(0x217)]>=0x32?a22_0x57ad1f['yellow']:a22_0x57ad1f['red'];_0x53e26f='\x20'+a22_0x57ad1f['dim'](_0x328b18(0x32a))+'\x20'+_0x58bb4d(_0x54b8a4+'%')+'\x20('+formatRows(_0x19f2ff[_0x328b18(0x337)])+_0x328b18(0x2bc);}console[_0x328b18(0x238)](_0x3ae458+'\x20'+a22_0x57ad1f[_0x328b18(0x25f)](_0x19f2ff[_0x328b18(0x21a)])+_0x53e26f),console[_0x328b18(0x238)]('\x20\x20'+a22_0x57ad1f[_0x328b18(0x2cb)](_0x328b18(0x274))+'\x20'+a22_0x57ad1f[_0x328b18(0x25f)](_0x19f2ff['database']+'.'+_0x19f2ff[_0x328b18(0x2e8)]));const _0x16f948=_0x19f2ff[_0x328b18(0x1e3)]===_0x19f2ff['foreignKey']?a22_0x57ad1f['dim'](_0x328b18(0x209))+'\x20'+_0x19f2ff[_0x328b18(0x1e3)]:a22_0x57ad1f[_0x328b18(0x2cb)](_0x328b18(0x1f1))+'\x20'+_0x19f2ff[_0x328b18(0x1e3)]+_0x328b18(0x2d6)+_0x19f2ff[_0x328b18(0x2b3)];console['error']('\x20\x20'+_0x16f948),console[_0x328b18(0x238)]('\x20\x20'+a22_0x57ad1f[_0x328b18(0x2cb)]('Columns:')),this['displayColumns'](_0x19f2ff[_0x328b18(0x255)]),!_0x19f2ff['schemaValid']&&console[_0x328b18(0x238)]('\x20\x20'+a22_0x57ad1f[_0x328b18(0x20f)](_0x328b18(0x30e))+'\x20'+_0x19f2ff[_0x328b18(0x258)]);}}[a22_0xb2ec14(0x22c)](_0x56db17,_0x47a597){const _0x29c684=a22_0xb2ec14;if(_0x56db17[_0x29c684(0x31a)][_0x29c684(0x261)]===0x0)return;console[_0x29c684(0x238)]('\x0a'+a22_0x57ad1f[_0x29c684(0x2cb)](_0x29c684(0x326))+'\x20'+a22_0x57ad1f[_0x29c684(0x2cb)]('('+_0x47a597+')'));for(const _0x10ee90 of _0x56db17[_0x29c684(0x31a)]){const _0x121984=_0x10ee90[_0x29c684(0x1f3)]?a22_0x57ad1f[_0x29c684(0x338)]('✔'):a22_0x57ad1f['red']('✘');let _0x324f9b='';if(_0x10ee90['schemaValid']&&_0x10ee90['customersWithEvents']!==undefined&&_0x10ee90[_0x29c684(0x266)]!==undefined){const _0x4ed839=_0x10ee90[_0x29c684(0x270)]?.[_0x29c684(0x349)](0x1)||'?',_0x37f469=(_0x10ee90['customerPercent']??0x0)>=0x32?a22_0x57ad1f['green']:(_0x10ee90['customerPercent']??0x0)>=0x14?a22_0x57ad1f[_0x29c684(0x31c)]:a22_0x57ad1f[_0x29c684(0x20f)];_0x324f9b='\x20'+a22_0x57ad1f[_0x29c684(0x2cb)](_0x29c684(0x32c))+'\x20'+_0x37f469(formatRows(_0x10ee90[_0x29c684(0x25a)]))+'\x20('+_0x4ed839+_0x29c684(0x1d7)+a22_0x57ad1f[_0x29c684(0x2cb)](_0x29c684(0x23f))+'\x20'+a22_0x57ad1f[_0x29c684(0x2f1)](formatRows(_0x10ee90['totalEvents']));}console[_0x29c684(0x238)](_0x121984+'\x20'+a22_0x57ad1f[_0x29c684(0x25f)](_0x10ee90['name'])+_0x324f9b),console[_0x29c684(0x238)]('\x20\x20'+a22_0x57ad1f['dim'](_0x29c684(0x274))+'\x20'+a22_0x57ad1f[_0x29c684(0x25f)](_0x10ee90[_0x29c684(0x27c)]+'.'+_0x10ee90['table']));const _0x125403=_0x10ee90['joinKey']===_0x10ee90[_0x29c684(0x2b3)]?a22_0x57ad1f['dim']('Join\x20on:')+'\x20'+_0x10ee90['joinKey']:a22_0x57ad1f[_0x29c684(0x2cb)](_0x29c684(0x1f1))+'\x20'+_0x10ee90[_0x29c684(0x1e3)]+_0x29c684(0x2d6)+_0x10ee90[_0x29c684(0x2b3)];console['error']('\x20\x20'+_0x125403),console['error']('\x20\x20'+a22_0x57ad1f[_0x29c684(0x2cb)](_0x29c684(0x267))),this[_0x29c684(0x21d)](_0x10ee90[_0x29c684(0x255)]),!_0x10ee90[_0x29c684(0x1f3)]&&console['error']('\x20\x20'+a22_0x57ad1f[_0x29c684(0x20f)]('Error:')+'\x20'+_0x10ee90[_0x29c684(0x258)]);}}[a22_0xb2ec14(0x21d)](_0x15a632){const _0x454d51=a22_0xb2ec14;for(const _0x8e8264 of _0x15a632){_0x8e8264[_0x454d51(0x2dd)]===_0x8e8264[_0x454d51(0x24e)]||_0x8e8264[_0x454d51(0x24e)]==='*'?console[_0x454d51(0x238)]('\x20\x20\x20\x20-\x20'+_0x8e8264[_0x454d51(0x2dd)]):console['error'](_0x454d51(0x2c2)+_0x8e8264[_0x454d51(0x2dd)]+'\x20'+a22_0x57ad1f[_0x454d51(0x2cb)]('('+_0x8e8264[_0x454d51(0x24e)]+')'));}}['displaySummary'](_0x2a09e9){const _0x63853a=a22_0xb2ec14;console[_0x63853a(0x238)]('─'[_0x63853a(0x347)](0x3c));if(_0x2a09e9[_0x63853a(0x271)][_0x63853a(0x261)]>0x0){console[_0x63853a(0x238)]('\x0a'+a22_0x57ad1f[_0x63853a(0x20f)](_0x63853a(0x2bf)));for(const _0x33e66f of _0x2a09e9['errors']){console[_0x63853a(0x238)]('\x20\x20'+a22_0x57ad1f[_0x63853a(0x20f)]('•')+'\x20'+_0x33e66f);}}_0x2a09e9[_0x63853a(0x276)]&&console[_0x63853a(0x238)]('\x0a'+a22_0x57ad1f[_0x63853a(0x338)]('✔')+_0x63853a(0x246));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a22_0xb2ec14(0x23b);['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a22_0xb2ec14(0x265)](_0x17c68d){const _0x11f06c=a22_0xb2ec14,{options:_0x109606,args:_0x24733b,tdx:_0x9e911e}=_0x17c68d,_0x339002=_0x109606,_0x2276ee=_0x24733b[0x0]||_0x109606[_0x11f06c(0x230)];if(!_0x2276ee)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x11f06c(0x207)+_0x11f06c(0x1ea)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x11f06c(0x24d)+_0x11f06c(0x235)+_0x11f06c(0x32d)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x339002[_0x11f06c(0x1d9)]&&!_0x339002['attribute']&&!_0x339002[_0x11f06c(0x201)]&&!_0x339002[_0x11f06c(0x2b7)])return console[_0x11f06c(0x238)](a22_0x57ad1f[_0x11f06c(0x20f)](_0x11f06c(0x1fa))),console[_0x11f06c(0x238)](_0x11f06c(0x2a4)),console[_0x11f06c(0x238)](_0x11f06c(0x336)),console[_0x11f06c(0x238)](_0x11f06c(0x33a)),console['error'](_0x11f06c(0x1d4)),console[_0x11f06c(0x238)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x11f06c(0x2d3)),0x1;const _0x3b0b2c=resolveYamlFile(_0x2276ee);if(!existsSync(_0x3b0b2c))return showFileNotFoundError(_0x3b0b2c,_0x2276ee),0x1;_0x339002['verbose']&&(console[_0x11f06c(0x238)](_0x11f06c(0x2d9)+_0x339002[_0x11f06c(0x1e2)]),console[_0x11f06c(0x238)]('YAML\x20file:\x20'+_0x3b0b2c));let _0x896bcf;try{_0x896bcf=readFileSync(_0x3b0b2c,_0x11f06c(0x1fe));}catch(_0x4ecf5e){const _0x58f584=_0x4ecf5e instanceof Error?_0x4ecf5e[_0x11f06c(0x1e0)]:String(_0x4ecf5e);return console[_0x11f06c(0x238)](_0x11f06c(0x1d8)+_0x58f584),0x1;}let _0x5daaf8;try{_0x5daaf8=parseDef(_0x896bcf);}catch(_0x15c99c){const _0x2506e9=_0x15c99c instanceof Error?_0x15c99c[_0x11f06c(0x1e0)]:String(_0x15c99c);return console[_0x11f06c(0x238)](a22_0x57ad1f['red'](_0x11f06c(0x221)+_0x2506e9)),0x1;}if(_0x339002[_0x11f06c(0x2db)]===!![]||_0x339002[_0x11f06c(0x2db)]===''){const _0x226773=_0x5daaf8[_0x11f06c(0x346)]?.[_0x11f06c(0x293)](_0x585489=>_0x585489['name'])||[];if(_0x226773[_0x11f06c(0x261)]===0x0)console[_0x11f06c(0x238)](a22_0x57ad1f[_0x11f06c(0x20f)](_0x11f06c(0x26a)));else{console['error'](a22_0x57ad1f[_0x11f06c(0x20f)](_0x11f06c(0x2b4))),console[_0x11f06c(0x238)]('Available\x20attributes:');for(const _0x16b1b2 of _0x226773){console[_0x11f06c(0x238)]('\x20\x20'+a22_0x57ad1f['cyan'](_0x16b1b2));}console[_0x11f06c(0x238)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2276ee+'\x20--attribute\x20\x22'+_0x226773[0x0]+'\x22');}return 0x1;}if(_0x339002[_0x11f06c(0x201)]===!![]||_0x339002[_0x11f06c(0x201)]===''){const _0xeb0749=_0x5daaf8[_0x11f06c(0x31a)]?.[_0x11f06c(0x293)](_0x148695=>_0x148695['name'])||[];if(_0xeb0749['length']===0x0)console[_0x11f06c(0x238)](a22_0x57ad1f['red'](_0x11f06c(0x27d)));else{console['error'](a22_0x57ad1f['red'](_0x11f06c(0x328))),console[_0x11f06c(0x238)](_0x11f06c(0x32b));for(const _0x495943 of _0xeb0749){console[_0x11f06c(0x238)]('\x20\x20'+a22_0x57ad1f['cyan'](_0x495943));}console[_0x11f06c(0x238)](_0x11f06c(0x1e1)+_0x2276ee+_0x11f06c(0x283)+_0xeb0749[0x0]+'\x22');}return 0x1;}const _0x31a368=createCommandSpinner(a22_0x57ad1f['dim'](_0x11f06c(0x205)),{'verbose':_0x339002[_0x11f06c(0x341)]});_0x31a368[_0x11f06c(0x344)]();const _0x3cb9df={'onProgress':_0x2a628c=>{const _0x3c1042=_0x11f06c;_0x31a368[_0x3c1042(0x284)]=formatProgressMessage(_0x2a628c);}};if(_0x339002[_0x11f06c(0x1d9)])_0x3cb9df[_0x11f06c(0x1d9)]=!![];if(_0x339002['attribute']&&typeof _0x339002[_0x11f06c(0x2db)]==='string')_0x3cb9df[_0x11f06c(0x2db)]=_0x339002[_0x11f06c(0x2db)];if(_0x339002[_0x11f06c(0x201)]&&typeof _0x339002[_0x11f06c(0x201)]===_0x11f06c(0x1d6))_0x3cb9df[_0x11f06c(0x201)]=_0x339002['behavior'];if(_0x339002[_0x11f06c(0x2b7)])_0x3cb9df['enriched']=!![];if(_0x339002['interval'])_0x3cb9df[_0x11f06c(0x282)]=_0x339002[_0x11f06c(0x282)];let _0xda3ab0;try{_0xda3ab0=await _0x9e911e['segment'][_0x11f06c(0x2aa)](_0x896bcf,_0x3cb9df),_0x31a368[_0x11f06c(0x289)]();}catch(_0x1fd192){_0x31a368['stop']();throw _0x1fd192;}return await this[_0x11f06c(0x2e2)](_0xda3ab0,{'master':_0x339002['master'],'attribute':typeof _0x339002[_0x11f06c(0x2db)]===_0x11f06c(0x1d6)?_0x339002['attribute']:undefined,'behavior':typeof _0x339002['behavior']===_0x11f06c(0x1d6)?_0x339002[_0x11f06c(0x201)]:undefined,'enriched':_0x339002['enriched']}),_0xda3ab0[_0x11f06c(0x276)]?0x0:0x1;}async[a22_0xb2ec14(0x2e2)](_0x51dd2f,_0x168c30){const _0x3eb33a=a22_0xb2ec14;console[_0x3eb33a(0x238)]('\x0a'+a22_0x57ad1f[_0x3eb33a(0x25f)](_0x3eb33a(0x297))+'\x20'+_0x51dd2f[_0x3eb33a(0x21a)]),console[_0x3eb33a(0x238)]('═'[_0x3eb33a(0x347)](0x3c));if(_0x168c30[_0x3eb33a(0x1d9)]&&_0x51dd2f[_0x3eb33a(0x203)]){const _0x840a77=a22_0x57ad1f['dim'](_0x3eb33a(0x286))+'\x20'+a22_0x57ad1f[_0x3eb33a(0x25f)](_0x51dd2f[_0x3eb33a(0x1d9)][_0x3eb33a(0x27c)]+'.'+_0x51dd2f[_0x3eb33a(0x1d9)][_0x3eb33a(0x2e8)]);await this[_0x3eb33a(0x2ce)](_0x840a77,_0x51dd2f[_0x3eb33a(0x203)]);}else{if(_0x168c30[_0x3eb33a(0x2db)]&&_0x51dd2f[_0x3eb33a(0x203)]){const _0x5d6d5c=a22_0x57ad1f[_0x3eb33a(0x2cb)](_0x3eb33a(0x2da))+'\x20'+a22_0x57ad1f[_0x3eb33a(0x25f)](_0x168c30[_0x3eb33a(0x2db)]);await this[_0x3eb33a(0x2ce)](_0x5d6d5c,_0x51dd2f['sampleData']);}else{if(_0x168c30['behavior']&&_0x51dd2f[_0x3eb33a(0x203)]){const _0x1961c8=a22_0x57ad1f[_0x3eb33a(0x2cb)](_0x3eb33a(0x251))+'\x20'+a22_0x57ad1f[_0x3eb33a(0x25f)](_0x168c30['behavior']);await this[_0x3eb33a(0x2ce)](_0x1961c8,_0x51dd2f[_0x3eb33a(0x203)]);}else{if(_0x168c30[_0x3eb33a(0x2b7)]&&_0x51dd2f['sampleData']){const _0x484c43=a22_0x57ad1f['dim'](_0x3eb33a(0x2f3))+'\x20'+a22_0x57ad1f[_0x3eb33a(0x25f)](_0x3eb33a(0x22f));await this['displaySampleData'](_0x484c43,_0x51dd2f[_0x3eb33a(0x203)]);}else!_0x51dd2f[_0x3eb33a(0x203)]&&console[_0x3eb33a(0x238)](_0x3eb33a(0x317));}}}if(_0x51dd2f['errors'][_0x3eb33a(0x261)]>0x0){console['error']('─'[_0x3eb33a(0x347)](0x3c)),console[_0x3eb33a(0x238)]('\x0a'+a22_0x57ad1f[_0x3eb33a(0x20f)]('Errors:'));for(const _0x31dabe of _0x51dd2f[_0x3eb33a(0x271)]){console[_0x3eb33a(0x238)]('\x20\x20'+a22_0x57ad1f['red']('•')+'\x20'+_0x31dabe);}}}async[a22_0xb2ec14(0x2ce)](_0x1db14b,_0x7d8c21){const _0x11253e=a22_0xb2ec14;if(_0x7d8c21[_0x11253e(0x261)]===0x0){console['error']('\x0a'+_0x1db14b),console[_0x11253e(0x238)](_0x11253e(0x206));return;}console[_0x11253e(0x238)]('\x0a'+_0x1db14b);const _0x151c01=Object[_0x11253e(0x330)](_0x7d8c21[0x0])[_0x11253e(0x293)](_0x40713a=>({'name':_0x40713a,'type':typeof _0x7d8c21[0x0][_0x40713a]===_0x11253e(0x350)?_0x11253e(0x237):_0x11253e(0x23d)})),_0x40a086={'queryId':_0x11253e(0x228),'columns':_0x151c01,'data':_0x7d8c21,'stats':{'state':_0x11253e(0x1c9),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x7d8c21[_0x11253e(0x261)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x518136=formatAsTable(_0x40a086,_0x7d8c21[_0x11253e(0x261)],!![]);await writeOutput(_0x518136,undefined,'table');}}function a22_0x56bd(_0x5e1b02,_0x54f281){_0x5e1b02=_0x5e1b02-0x1c1;const _0x463849=a22_0x4638();let _0x56bdbd=_0x463849[_0x5e1b02];return _0x56bdbd;}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x2ca);[a22_0xb2ec14(0x33f)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async['execute'](_0x5ad94b){const _0x1fe156=a22_0xb2ec14,{options:_0x4f455f,args:_0x26a26b,tdx:_0x5673d5}=_0x5ad94b,_0x5d00cc=_0x4f455f,_0xc280d3=_0x26a26b[0x0]||_0x4f455f[_0x1fe156(0x230)];if(!_0xc280d3)return showParentSegmentNotSetError(_0x1fe156(0x210)+_0x1fe156(0x253)),0x1;const _0x1aaa2a=resolveYamlFile(_0xc280d3);if(existsSync(_0x1aaa2a)){_0x5d00cc[_0x1fe156(0x341)]&&console[_0x1fe156(0x238)](_0x1fe156(0x242)+_0x1aaa2a);let _0x95cc66;try{_0x95cc66=readFileSync(_0x1aaa2a,'utf-8');}catch(_0x1f6022){const _0x106012=_0x1f6022 instanceof Error?_0x1f6022[_0x1fe156(0x1e0)]:String(_0x1f6022);return console[_0x1fe156(0x238)]('Error\x20reading\x20file:\x20'+_0x106012),0x1;}const _0x17ff0b=await withSpinner(_0x1fe156(0x268),()=>_0x5673d5[_0x1fe156(0x323)]['pushParentYaml'](_0x95cc66),{'verbose':_0x5d00cc[_0x1fe156(0x341)]}),_0x14167b=_0x17ff0b[_0x1fe156(0x222)],{isNew:_0xd4aba,name:_0x421478,hasChanges:_0xc134ca,diffFormatted:_0x323489}=_0x14167b;if(_0xc134ca){_0xd4aba?console[_0x1fe156(0x238)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x421478+'\x27:'):console[_0x1fe156(0x238)](_0x1fe156(0x20e)+_0x421478+'\x27:');console[_0x1fe156(0x238)]('─'['repeat'](0x3c)),console[_0x1fe156(0x238)](_0x323489),console[_0x1fe156(0x238)]('─'[_0x1fe156(0x347)](0x3c));const _0x25a1d3=_0xd4aba?'Create\x20parent\x20segment\x20\x27'+_0x421478+_0x1fe156(0x22b):'Apply\x20changes\x20to\x20\x27'+_0x421478+_0x1fe156(0x22b);if(!_0x5d00cc[_0x1fe156(0x23a)]){if(!isInteractive())return console[_0x1fe156(0x238)](a22_0x57ad1f[_0x1fe156(0x20f)](_0x1fe156(0x208)),_0x1fe156(0x2a2)),console[_0x1fe156(0x238)](a22_0x57ad1f[_0x1fe156(0x2cb)](_0x1fe156(0x300))),0x1;const _0x43fd5d=await confirmKey(_0x25a1d3);if(!_0x43fd5d)return console['error'](a22_0x57ad1f[_0x1fe156(0x31c)]('Aborted.')),0x1;}const _0x8a8245=_0xd4aba?'Creating':_0x1fe156(0x273);await withSpinner(_0x8a8245+_0x1fe156(0x2e9)+_0x421478+'\x27...',()=>_0x14167b[_0x1fe156(0x32f)](),{'verbose':_0x5d00cc[_0x1fe156(0x341)]});const _0x271a3d=_0xd4aba?'Created':_0x1fe156(0x34d);console[_0x1fe156(0x238)]('✔\x20'+_0x271a3d+'\x20parent\x20segment\x20\x27'+_0x421478+'\x27');}else console[_0x1fe156(0x238)]('✔\x20No\x20changes\x20-\x20\x27'+_0x421478+_0x1fe156(0x227));}const _0x25c273=await withSpinner(_0x1fe156(0x2c3)+_0xc280d3+_0x1fe156(0x215),()=>_0x5673d5[_0x1fe156(0x323)][_0x1fe156(0x309)](_0xc280d3),{'verbose':_0x5d00cc['verbose']}),_0x492230=_0x25c273[_0x1fe156(0x222)],_0x4d2880=getConsoleUrl(_0x5d00cc[_0x1fe156(0x1e2)],_0x1fe156(0x1d5)+_0x492230[_0x1fe156(0x331)]+_0x1fe156(0x29d)+_0x492230[_0x1fe156(0x224)]+'/attempt/'+_0x492230[_0x1fe156(0x1cd)]);return console['error'](_0x1fe156(0x2ea)),console['error']('\x20\x20'+a22_0x57ad1f['dim']('Audience\x20ID:')+'\x20'+_0x492230[_0x1fe156(0x287)]),console[_0x1fe156(0x238)]('\x20\x20'+a22_0x57ad1f[_0x1fe156(0x2cb)](_0x1fe156(0x2eb))+'\x20'+_0x492230['status']),console[_0x1fe156(0x238)]('\x20\x20'+a22_0x57ad1f[_0x1fe156(0x2cb)](_0x1fe156(0x1dd))+'\x20'+_0x492230[_0x1fe156(0x224)]),console['error']('\x20\x20'+a22_0x57ad1f[_0x1fe156(0x2cb)](_0x1fe156(0x26c))+'\x20'+_0x492230[_0x1fe156(0x1cd)]),console[_0x1fe156(0x238)]('\x20\x20'+_0x4d2880),console['error']('\x0a'+a22_0x57ad1f[_0x1fe156(0x2cb)](_0x1fe156(0x343))+_0x1fe156(0x31f)+_0x492230['workflowAttemptId']+_0x1fe156(0x1eb)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a22_0xb2ec14(0x1dc);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x2d5);async[a22_0xb2ec14(0x265)](_0x2034f0){const _0x5a23ac=a22_0xb2ec14,{options:_0xf4df,args:_0xffb946,tdx:_0x5c1c50}=_0x2034f0,_0x16aeea=_0xffb946[0x0]||_0xf4df[_0x5a23ac(0x230)];if(!_0x16aeea)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0xf4df[_0x5a23ac(0x341)]&&(console['error'](_0x5a23ac(0x2d9)+_0xf4df[_0x5a23ac(0x1e2)]),console[_0x5a23ac(0x238)](_0x5a23ac(0x259)+_0x16aeea));const _0x4ae8d9=await withSpinner(_0x5a23ac(0x21c)+_0x16aeea+'\x27...',()=>_0x5c1c50['segment'][_0x5a23ac(0x31b)](_0x16aeea),{'verbose':_0xf4df[_0x5a23ac(0x341)]}),_0x33eeb6=_0x4ae8d9[_0x5a23ac(0x222)];console[_0x5a23ac(0x238)]('✔\x20Found\x20'+_0x33eeb6[_0x5a23ac(0x261)]+_0x5a23ac(0x249)+(_0x33eeb6['length']!==0x1?'s':''));if(_0xf4df[_0x5a23ac(0x272)]||_0xf4df[_0x5a23ac(0x2d8)])return await handleSDKOutput(_0x33eeb6,_0xf4df),0x0;return displayFieldsHumanReadable(_0x33eeb6,_0x16aeea),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]='segment:parent:view';['description']=a22_0xb2ec14(0x214);async[a22_0xb2ec14(0x265)](_0x2fa4de){const _0x542b77=a22_0xb2ec14,{options:_0x33f51f,args:_0x4e3f00,tdx:_0x4353ad}=_0x2fa4de,_0x5c472e=_0x33f51f,_0x325008=_0x4e3f00[0x0]||_0x33f51f['parentSegment'];if(!_0x325008)return showParentSegmentNotSetError(_0x542b77(0x260)+_0x542b77(0x296)+_0x542b77(0x1da)+_0x542b77(0x2e0)),0x1;_0x33f51f[_0x542b77(0x341)]&&(console[_0x542b77(0x238)](_0x542b77(0x2d9)+_0x33f51f[_0x542b77(0x1e2)]),console['error'](_0x542b77(0x259)+_0x325008));const _0x4ed4d4=await withSpinner(_0x542b77(0x2fb)+_0x325008+_0x542b77(0x215),()=>_0x4353ad[_0x542b77(0x323)]['getParentFull'](_0x325008),{'verbose':_0x33f51f['verbose']}),_0x2c457e=_0x4ed4d4[_0x542b77(0x222)];if(_0x5c472e[_0x542b77(0x1f7)]){const _0x3f2ea3=getConsoleNextUrl(_0x5c472e['site'],_0x542b77(0x2c9)+_0x2c457e['id']);return console[_0x542b77(0x238)](a22_0x57ad1f[_0x542b77(0x338)]('✔')+_0x542b77(0x321)+a22_0x57ad1f['cyan'](_0x3f2ea3)),openBrowser(_0x3f2ea3),0x0;}return await handleSingleObjectOutput(_0x2c457e,_0x33f51f),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]='segment:parent:desc';['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a22_0xb2ec14(0x265)](_0x1c4d7f){const _0x187625=a22_0xb2ec14,{options:_0x4a4028,args:_0x7d09e,tdx:_0x41885a}=_0x1c4d7f,_0x56cd73=_0x4a4028,_0x206dbd=_0x7d09e[0x0]||_0x4a4028['parentSegment'];if(!_0x206dbd)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'+_0x187625(0x30b)+'Options:\x0a'+_0x187625(0x22d)),0x1;_0x4a4028[_0x187625(0x341)]&&(console[_0x187625(0x238)](_0x187625(0x2d9)+_0x4a4028['site']),console['error'](_0x187625(0x259)+_0x206dbd));const _0x4cd20a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x206dbd+_0x187625(0x215),()=>_0x41885a[_0x187625(0x323)]['resolveParentId'](_0x206dbd),{'verbose':_0x4a4028['verbose']}),_0xfef0b6=_0x4cd20a[_0x187625(0x222)],_0x2bd429=_0x41885a[_0x187625(0x323)]['getOutputDatabaseName'](_0xfef0b6);if(_0x56cd73['output']){const _0x4e03ac=await this['collectSchema'](_0x1c4d7f,_0x206dbd,_0xfef0b6,_0x2bd429),_0x282bfa=this['formatSchemaJson'](_0x4e03ac);writeFileSync(_0x56cd73[_0x187625(0x307)],_0x282bfa);const _0x1167c5=_0x4e03ac['customers']['columns'][_0x187625(0x261)]+_0x4e03ac[_0x187625(0x31a)]['reduce']((_0x54f87c,_0x13f5ff)=>_0x54f87c+_0x13f5ff[_0x187625(0x255)][_0x187625(0x261)],0x0),_0x3850a5=_0x4e03ac[_0x187625(0x31a)]['filter'](_0x4807ac=>_0x4807ac['columns'][_0x187625(0x261)]===0x0)['length'];return console[_0x187625(0x310)](_0x187625(0x2a5)+_0x56cd73[_0x187625(0x307)]),console[_0x187625(0x310)](_0x187625(0x34f)+_0x2bd429),console[_0x187625(0x310)](_0x187625(0x2ff)+_0x4e03ac['behaviors']['length']+_0x187625(0x1fb)),console['log'](_0x187625(0x1c3)+_0x1167c5+_0x187625(0x2d4)),_0x3850a5>0x0&&console[_0x187625(0x310)]('\x20\x20Note:\x20'+_0x3850a5+_0x187625(0x2c6)),0x0;}console['error']('\x0a'+a22_0x57ad1f[_0x187625(0x25f)](_0x187625(0x28d))+'\x20'+a22_0x57ad1f[_0x187625(0x2f1)](_0x2bd429));const _0x3aa392=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x41885a[_0x187625(0x323)][_0x187625(0x306)](_0xfef0b6),{'verbose':_0x4a4028['verbose']});console[_0x187625(0x238)]('\x0a'+a22_0x57ad1f[_0x187625(0x25f)]('customers')+'\x20'+a22_0x57ad1f[_0x187625(0x2cb)]('('+_0x2bd429+'.customers)'));const _0x2c74e7=await executeSchemaQuery(_0x3aa392[_0x187625(0x222)],_0x41885a,_0x4a4028);await handleQueryOutput(_0x2c74e7,_0x4a4028);const _0x3c6847=await withSpinner(_0x187625(0x2b2),()=>_0x41885a[_0x187625(0x323)][_0x187625(0x2f8)](_0xfef0b6),{'verbose':_0x4a4028[_0x187625(0x341)]});for(const _0x295026 of _0x3c6847[_0x187625(0x222)]){const _0x429ac7=_0x187625(0x2e1)+_0x295026[_0x187625(0x25e)]()[_0x187625(0x212)](/\s+/g,'_'),_0x1b8d42=_0x187625(0x21b)+_0x2bd429+'.'+_0x429ac7;console[_0x187625(0x238)]('\x0a'+a22_0x57ad1f[_0x187625(0x25f)](_0x295026)+'\x20'+a22_0x57ad1f['dim']('('+_0x2bd429+'.'+_0x429ac7+')'));try{const _0x52b192=await executeSchemaQuery(_0x1b8d42,_0x41885a,_0x4a4028);await handleQueryOutput(_0x52b192,_0x4a4028);}catch{console[_0x187625(0x238)](a22_0x57ad1f[_0x187625(0x31c)](_0x187625(0x332)));}}return 0x0;}async[a22_0xb2ec14(0x2be)](_0x439b94,_0x2ff819,_0x475b20,_0x2090db){const _0x1f8abd=a22_0xb2ec14,{options:_0x17b5ce,tdx:_0x2e6706}=_0x439b94,_0x22ef13=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2e6706[_0x1f8abd(0x323)]['getParentSQL'](_0x475b20),{'verbose':_0x17b5ce[_0x1f8abd(0x341)]}),_0x31c722=await executeSchemaQuery(_0x22ef13[_0x1f8abd(0x222)],_0x2e6706,_0x17b5ce),_0x4198bd=_0x31c722[_0x1f8abd(0x222)][_0x1f8abd(0x293)](_0x4f81c6=>({'name':_0x4f81c6['column_name'],'type':_0x4f81c6[_0x1f8abd(0x27a)]})),_0x1a2a98=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x2e6706[_0x1f8abd(0x323)][_0x1f8abd(0x2f8)](_0x475b20),{'verbose':_0x17b5ce['verbose']}),_0x4b9fa4=[];for(const _0x9ae101 of _0x1a2a98[_0x1f8abd(0x222)]){const _0x5dbb65=_0x1f8abd(0x2e1)+_0x9ae101[_0x1f8abd(0x25e)]()['replace'](/\s+/g,'_'),_0x52c77f='SELECT\x20*\x20FROM\x20'+_0x2090db+'.'+_0x5dbb65;let _0x586946=[];try{const _0x2f61ff=await executeSchemaQuery(_0x52c77f,_0x2e6706,_0x17b5ce);_0x586946=_0x2f61ff[_0x1f8abd(0x222)]['map'](_0x256f64=>({'name':_0x256f64[_0x1f8abd(0x1d1)],'type':_0x256f64[_0x1f8abd(0x27a)]}));}catch{}_0x4b9fa4[_0x1f8abd(0x263)]({'table':_0x5dbb65,'columns':_0x586946});}return{'database':_0x2090db,'parent_segment':_0x2ff819,'parent_id':_0x475b20,'customers':{'table':_0x1f8abd(0x2dc),'columns':_0x4198bd},'behaviors':_0x4b9fa4};}['formatSchemaJson'](_0x50e42c){const _0x47d14d=a22_0xb2ec14,_0x4147b6=_0x132286=>{const _0x1cbec4=a22_0x56bd;if(_0x132286[_0x1cbec4(0x261)]===0x0)return'[]';const _0x579c4d=_0x132286[_0x1cbec4(0x293)](_0x182278=>_0x1cbec4(0x220)+_0x182278['name']+_0x1cbec4(0x30f)+_0x182278[_0x1cbec4(0x314)]+_0x1cbec4(0x200));return'[\x0a'+_0x579c4d[_0x1cbec4(0x232)](',\x0a')+_0x1cbec4(0x1ce);},_0x33a1aa=_0x50e42c[_0x47d14d(0x31a)][_0x47d14d(0x293)](_0x537486=>{const _0x1b8da1=_0x47d14d;return _0x1b8da1(0x247)+_0x537486['table']+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x4147b6(_0x537486['columns'])[_0x1b8da1(0x212)](/^/gm,'\x20\x20')[_0x1b8da1(0x1f8)]()+_0x1b8da1(0x1d2);})[_0x47d14d(0x232)](',\x0a');return _0x47d14d(0x213)+_0x50e42c[_0x47d14d(0x27c)]+_0x47d14d(0x275)+_0x50e42c[_0x47d14d(0x269)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x50e42c[_0x47d14d(0x339)]+_0x47d14d(0x2af)+_0x50e42c[_0x47d14d(0x2dc)][_0x47d14d(0x2e8)]+_0x47d14d(0x1c4)+_0x4147b6(_0x50e42c[_0x47d14d(0x2dc)][_0x47d14d(0x255)])[_0x47d14d(0x212)](/^/gm,'\x20\x20')[_0x47d14d(0x1f8)]()+_0x47d14d(0x2d1)+_0x33a1aa+_0x47d14d(0x22a);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0xb2ec14(0x23e);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x1cf);async[a22_0xb2ec14(0x265)](_0x17ce8a){const _0x4d9239=a22_0xb2ec14,{options:_0x461180,args:_0x2f8b02,tdx:_0xd1602f}=_0x17ce8a,_0x395b3d=_0x2f8b02[0x0]||_0x461180[_0x4d9239(0x230)];if(!_0x395b3d)return showParentSegmentNotSetError(_0x4d9239(0x2f0)+_0x4d9239(0x29b)),0x1;_0x461180[_0x4d9239(0x341)]&&(console['error'](_0x4d9239(0x2d9)+_0x461180[_0x4d9239(0x1e2)]),console[_0x4d9239(0x238)](_0x4d9239(0x259)+_0x395b3d));const _0x26bd3e=await withSpinner(_0x4d9239(0x288)+_0x395b3d+'\x27...',()=>_0xd1602f[_0x4d9239(0x323)][_0x4d9239(0x2fe)](_0x395b3d),{'verbose':_0x461180[_0x4d9239(0x341)]}),_0x68b58a=_0x26bd3e[_0x4d9239(0x222)],_0x47ae9a=await withSpinner(_0x4d9239(0x292)+_0x395b3d+_0x4d9239(0x215),()=>_0xd1602f[_0x4d9239(0x323)]['getParentSQL'](_0x68b58a),{'verbose':_0x461180[_0x4d9239(0x341)]}),_0x596d44=_0x47ae9a['data'];return _0x461180[_0x4d9239(0x316)]===_0x4d9239(0x272)||_0x461180[_0x4d9239(0x316)]===_0x4d9239(0x2d8)?await handleSDKOutput([{'sql':_0x596d44}],_0x461180):console[_0x4d9239(0x310)](_0x596d44),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x2e7);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x252);async[a22_0xb2ec14(0x265)](_0x246d82){const _0x3da1f1=a22_0xb2ec14,{options:_0x2bebb0,args:_0x268574,tdx:_0x2447a1}=_0x246d82,_0x20dd4f=_0x268574[0x0]||_0x2bebb0[_0x3da1f1(0x230)];if(!_0x20dd4f)return showParentSegmentNotSetError(_0x3da1f1(0x25c)+_0x3da1f1(0x2f2)),0x1;_0x2bebb0[_0x3da1f1(0x341)]&&(console[_0x3da1f1(0x238)](_0x3da1f1(0x2d9)+_0x2bebb0['site']),console['error'](_0x3da1f1(0x259)+_0x20dd4f));const _0x542b9b=await withSpinner(_0x3da1f1(0x288)+_0x20dd4f+_0x3da1f1(0x215),()=>_0x2447a1['segment'][_0x3da1f1(0x2fe)](_0x20dd4f),{'verbose':_0x2bebb0[_0x3da1f1(0x341)]}),_0xcdf604=_0x542b9b[_0x3da1f1(0x222)],_0x5219d5=await withSpinner(_0x3da1f1(0x292)+_0x20dd4f+_0x3da1f1(0x215),()=>_0x2447a1[_0x3da1f1(0x323)][_0x3da1f1(0x306)](_0xcdf604),{'verbose':_0x2bebb0[_0x3da1f1(0x341)]});let _0x25404a=_0x5219d5[_0x3da1f1(0x222)];const _0x1b2c6e=resolveLimit(_0x2bebb0[_0x3da1f1(0x2b5)],DEFAULT_DISPLAY_LIMIT),_0x26e648=/\bLIMIT\s+\d+/i['test'](_0x25404a);!_0x26e648&&(_0x25404a=_0x25404a[_0x3da1f1(0x1f8)]()[_0x3da1f1(0x212)](/;+$/,''),_0x25404a=_0x3da1f1(0x319)+_0x25404a+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1b2c6e);_0x2bebb0[_0x3da1f1(0x341)]&&console[_0x3da1f1(0x238)](_0x3da1f1(0x1cb)+_0x25404a);const _0x98e9cc=await withProgressSpinner(_0x3da1f1(0x334),async _0x413f24=>{const _0x266c48=_0x3da1f1,_0x148104=await _0x2447a1[_0x266c48(0x257)][_0x266c48(0x265)](_0x25404a,{'catalog':'td','schema':'information_schema','onJobId':_0x32da89=>{const _0x56f320=_0x266c48;_0x413f24[_0x56f320(0x20b)](_0x32da89);}});return _0x148104;},{'verbose':_0x2bebb0[_0x3da1f1(0x341)]}),_0x3b2fff=_0x98e9cc['data'],_0x242437=_0x3b2fff[_0x3da1f1(0x30a)]?_0x3da1f1(0x348)+_0x3b2fff[_0x3da1f1(0x30a)]+']':'';return console['error'](_0x3da1f1(0x2a9)+_0x3b2fff['stats']['processedRows'][_0x3da1f1(0x333)]()+'\x20rows\x20'+(_0x3da1f1(0x322)+formatElapsed(_0x3b2fff[_0x3da1f1(0x28a)][_0x3da1f1(0x28c)])+_0x242437)),await handleQueryOutput(_0x3b2fff,_0x2bebb0),0x0;}}export class PSRtListCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x239);[a22_0xb2ec14(0x33f)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a22_0xb2ec14(0x265)](_0x516435){const _0x1354d9=a22_0xb2ec14,{options:_0x47c235,args:_0x404d6f,tdx:_0x3ca892}=_0x516435,_0x1c9cf3=_0x404d6f[0x0],_0x44bb34=await withSpinner(_0x1c9cf3?_0x1354d9(0x2d0)+_0x1c9cf3+_0x1354d9(0x215):_0x1354d9(0x229),()=>_0x3ca892[_0x1354d9(0x34e)][_0x1354d9(0x21f)](),{'verbose':_0x47c235[_0x1354d9(0x341)]});let _0x1ace31=_0x44bb34[_0x1354d9(0x222)][_0x1354d9(0x245)](_0x252b83=>_0x252b83[_0x1354d9(0x1fc)]);if(_0x1c9cf3){const _0x1364a8=_0x1c9cf3[_0x1354d9(0x212)](/[.+^${}()|[\]\\]/g,_0x1354d9(0x34c))[_0x1354d9(0x212)](/\*/g,'.*')[_0x1354d9(0x212)](/\?/g,'.'),_0x54ac63=new RegExp('^'+_0x1364a8+'$','i');_0x1ace31=_0x1ace31[_0x1354d9(0x245)](_0x1bd1db=>_0x54ac63[_0x1354d9(0x34b)](_0x1bd1db[_0x1354d9(0x21a)]));}_0x1ace31['sort']((_0x1dfcda,_0x44d193)=>_0x1dfcda[_0x1354d9(0x21a)][_0x1354d9(0x31e)](_0x44d193['name'])),console[_0x1354d9(0x238)](_0x1354d9(0x2f4)+_0x1ace31['length']+_0x1354d9(0x1f5)+(_0x1ace31[_0x1354d9(0x261)]!==0x1?'s':''));const _0x1151d0=_0x58443f=>{const _0x9df7a0=_0x1354d9;return getConsoleNextUrl(_0x47c235[_0x9df7a0(0x1e2)],_0x9df7a0(0x2c9)+_0x58443f);};if(_0x47c235[_0x1354d9(0x316)]==='json'||_0x47c235[_0x1354d9(0x316)]===_0x1354d9(0x2d8)){const _0x298b6f=_0x1ace31['map'](_0x1ec69c=>({..._0x1ec69c,'url':_0x1151d0(_0x1ec69c['id'])}));await handleSDKOutput(_0x298b6f,_0x47c235);}else{if(_0x1ace31[_0x1354d9(0x261)]===0x0)console['log']('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x23082d of _0x1ace31){const _0x3eb85a=_0x23082d['population']?a22_0x57ad1f[_0x1354d9(0x2cb)]('\x20('+formatRows(_0x23082d[_0x1354d9(0x33c)])+')'):'',_0x27c586=hyperlink(_0x23082d[_0x1354d9(0x21a)],_0x1151d0(_0x23082d['id']));console['log']('⚡\x20'+_0x27c586+_0x3eb85a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a22_0xb2ec14(0x28b);[a22_0xb2ec14(0x33f)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async['execute'](_0x44bb31){const _0x574ac8=a22_0xb2ec14,{options:_0x1937a8,args:_0x202649,tdx:_0x555930}=_0x44bb31,_0x593b52=_0x202649[0x0]||_0x1937a8[_0x574ac8(0x230)];if(!_0x593b52)return showParentSegmentNotSetError(_0x574ac8(0x27e)+_0x574ac8(0x1db)),0x1;const _0x29554a=resolveYamlFile(_0x593b52);if(!existsSync(_0x29554a))return showFileNotFoundError(_0x29554a,_0x593b52),0x1;let _0x2795f1;try{_0x2795f1=readFileSync(_0x29554a,_0x574ac8(0x1fe));}catch(_0x3ea648){const _0x5657a8=_0x3ea648 instanceof Error?_0x3ea648[_0x574ac8(0x1e0)]:String(_0x3ea648);return console['error'](_0x574ac8(0x1d8)+_0x5657a8),0x1;}const _0x34af5e=createCommandSpinner(a22_0x57ad1f['dim'](_0x574ac8(0x223)),{'verbose':_0x1937a8[_0x574ac8(0x341)]});_0x34af5e[_0x574ac8(0x344)]();const _0x1b2eb4={'realtime':!![],'onProgress':_0x2892eb=>{const _0x5a4a0f=_0x574ac8;_0x34af5e[_0x5a4a0f(0x284)]=formatProgressMessage(_0x2892eb);}};let _0x882273;try{_0x882273=await _0x555930[_0x574ac8(0x323)][_0x574ac8(0x1e8)](_0x2795f1,_0x1b2eb4),_0x34af5e[_0x574ac8(0x289)]();}catch(_0x4b3291){_0x34af5e[_0x574ac8(0x289)]();throw _0x4b3291;}console['error']('\x0a'+a22_0x57ad1f[_0x574ac8(0x25f)](_0x574ac8(0x22e))+'\x20'+_0x882273['name']),console['error']('═'[_0x574ac8(0x347)](0x3c)),displayRealtimeValidation(_0x882273),console[_0x574ac8(0x238)]('─'[_0x574ac8(0x347)](0x3c));if(_0x882273[_0x574ac8(0x271)]['length']>0x0){console['error']('\x0a'+a22_0x57ad1f['red'](_0x574ac8(0x2bf)));for(const _0xe62808 of _0x882273['errors']){console[_0x574ac8(0x238)]('\x20\x20'+a22_0x57ad1f[_0x574ac8(0x20f)]('•')+'\x20'+_0xe62808);}}return _0x882273[_0x574ac8(0x276)]&&console[_0x574ac8(0x238)]('\x0a'+a22_0x57ad1f[_0x574ac8(0x338)]('✔')+_0x574ac8(0x26d)),_0x882273[_0x574ac8(0x276)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x1ed);[a22_0xb2ec14(0x33f)]=a22_0xb2ec14(0x20d);async[a22_0xb2ec14(0x265)](_0x3a536f){const _0x3f69a7=a22_0xb2ec14,{options:_0x406878,args:_0x342bfc,tdx:_0x4702d4}=_0x3a536f,_0x25d627=_0x342bfc[0x0]||_0x406878[_0x3f69a7(0x230)];if(!_0x25d627)return showParentSegmentNotSetError(_0x3f69a7(0x21e)+_0x3f69a7(0x312)),0x1;const _0x2fdab8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x25d627+_0x3f69a7(0x215),()=>_0x4702d4[_0x3f69a7(0x323)][_0x3f69a7(0x2fe)](_0x25d627),{'verbose':_0x406878[_0x3f69a7(0x341)]}),_0x5d574f=_0x2fdab8[_0x3f69a7(0x222)],_0x5b78df=await withSpinner(_0x3f69a7(0x243)+_0x25d627+_0x3f69a7(0x215),()=>_0x4702d4[_0x3f69a7(0x315)][_0x3f69a7(0x21f)](_0x5d574f),{'verbose':_0x406878[_0x3f69a7(0x341)]}),_0x48cda9=_0x5b78df[_0x3f69a7(0x222)];console['error']('✔\x20Found\x20'+_0x48cda9['length']+'\x20personalization\x20service'+(_0x48cda9[_0x3f69a7(0x261)]!==0x1?'s':''));if(_0x406878['format']===_0x3f69a7(0x272)||_0x406878[_0x3f69a7(0x316)]===_0x3f69a7(0x2d8))await handleSDKOutput(_0x48cda9,_0x406878);else{if(_0x48cda9[_0x3f69a7(0x261)]===0x0)console[_0x3f69a7(0x310)](_0x3f69a7(0x294)),console[_0x3f69a7(0x238)](a22_0x57ad1f[_0x3f69a7(0x2f1)](_0x3f69a7(0x2f7)));else for(const _0x38732c of _0x48cda9){const _0x5db5a9=_0x38732c[_0x3f69a7(0x1f6)]?.['length']||0x0,_0x389b87=_0x38732c[_0x3f69a7(0x256)]?a22_0x57ad1f[_0x3f69a7(0x2cb)](_0x3f69a7(0x2cd)+_0x38732c[_0x3f69a7(0x256)]):'',_0x428fc9=a22_0x57ad1f[_0x3f69a7(0x2cb)]('\x20('+_0x5db5a9+_0x3f69a7(0x262)+(_0x5db5a9!==0x1?'s':'')+')');console[_0x3f69a7(0x310)]('\x20\x20'+_0x38732c[_0x3f69a7(0x21a)]+_0x389b87+_0x428fc9),_0x38732c['description']&&console[_0x3f69a7(0x310)](_0x3f69a7(0x24a)+a22_0x57ad1f['dim'](_0x38732c[_0x3f69a7(0x33f)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0xb2ec14(0x21a)]=a22_0xb2ec14(0x240);['description']='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a22_0xb2ec14(0x265)](_0x3c30c4){const _0x540d2d=a22_0xb2ec14,{options:_0x42d135,args:_0x179044}=_0x3c30c4,_0x178f64=_0x179044[0x0]||_0x42d135[_0x540d2d(0x230)];if(!_0x178f64)return showParentSegmentNotSetError(_0x540d2d(0x264)+_0x540d2d(0x2f6)),0x1;const _0x5f01eb=resolveYamlFile(_0x178f64);if(!existsSync(_0x5f01eb))return showFileNotFoundError(_0x5f01eb,_0x178f64),0x1;let _0x804514;try{_0x804514=readFileSync(_0x5f01eb,_0x540d2d(0x1fe));}catch(_0x5b0909){const _0x29caa0=_0x5b0909 instanceof Error?_0x5b0909['message']:String(_0x5b0909);return console[_0x540d2d(0x238)](_0x540d2d(0x1d8)+_0x29caa0),0x1;}let _0x2c73ab;try{_0x2c73ab=parseDef(_0x804514);}catch(_0x25201b){const _0x318616=_0x25201b instanceof Error?_0x25201b[_0x540d2d(0x1e0)]:String(_0x25201b);return console[_0x540d2d(0x238)](a22_0x57ad1f[_0x540d2d(0x20f)]('Error\x20parsing\x20YAML:\x20'+_0x318616)),0x1;}if(_0x2c73ab[_0x540d2d(0x285)]&&_0x2c73ab[_0x540d2d(0x285)]['length']>0x0)return console[_0x540d2d(0x238)](a22_0x57ad1f['yellow'](_0x540d2d(0x280)+_0x5f01eb)),console['error'](a22_0x57ad1f[_0x540d2d(0x2cb)](_0x540d2d(0x311)+_0x2c73ab[_0x540d2d(0x285)][_0x540d2d(0x261)]+_0x540d2d(0x2a0))),0x1;!_0x2c73ab[_0x540d2d(0x34e)]&&(_0x2c73ab[_0x540d2d(0x34e)]={'events':[{'name':_0x540d2d(0x2c0),'source_table':_0x540d2d(0x1ff)}],'attributes':[{'name':'last_page_viewed','type':_0x540d2d(0x26e)}],'id_stitching':{'primary_key':_0x2c73ab[_0x540d2d(0x1d9)][_0x540d2d(0x2e8)]===_0x540d2d(0x2dc)?_0x540d2d(0x2b1):_0x540d2d(0x325)}});_0x2c73ab[_0x540d2d(0x285)]=[{'name':_0x540d2d(0x1e5),'description':_0x540d2d(0x218),'trigger_event':_0x540d2d(0x2c0),'sections':[{'name':'Default','criteria':_0x540d2d(0x340),'attributes':[_0x540d2d(0x2c8)]}]}];const _0x4f3d16=serializeDef(_0x2c73ab);return writeFileSync(_0x5f01eb,_0x4f3d16,_0x540d2d(0x1fe)),console['error'](a22_0x57ad1f[_0x540d2d(0x338)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a22_0x57ad1f[_0x540d2d(0x2f1)](_0x5f01eb)),(!_0x2c73ab['realtime']||_0x804514[_0x540d2d(0x298)]('realtime:')===-0x1)&&console[_0x540d2d(0x238)](a22_0x57ad1f[_0x540d2d(0x338)]('✔')+_0x540d2d(0x20c)),console[_0x540d2d(0x238)]('\x0a'+a22_0x57ad1f['dim'](_0x540d2d(0x219))),console['error'](_0x540d2d(0x1ec)+_0x5f01eb+_0x540d2d(0x2ef)),console[_0x540d2d(0x238)](_0x540d2d(0x2ac)+a22_0x57ad1f[_0x540d2d(0x2cb)](_0x540d2d(0x1c2)+_0x178f64)+_0x540d2d(0x234)),0x0;}}
|
|
1
|
+
const a22_0x8dcc7b=a22_0x4d07;(function(_0x29ce9c,_0x3ca694){const _0x10cadc=a22_0x4d07,_0x31121e=_0x29ce9c();while(!![]){try{const _0x3a2e0c=-parseInt(_0x10cadc(0x269))/0x1+parseInt(_0x10cadc(0x2bf))/0x2*(-parseInt(_0x10cadc(0x251))/0x3)+parseInt(_0x10cadc(0x303))/0x4+parseInt(_0x10cadc(0x1c8))/0x5*(parseInt(_0x10cadc(0x1f8))/0x6)+parseInt(_0x10cadc(0x2f5))/0x7*(-parseInt(_0x10cadc(0x2c6))/0x8)+-parseInt(_0x10cadc(0x1fb))/0x9*(-parseInt(_0x10cadc(0x29e))/0xa)+parseInt(_0x10cadc(0x2bd))/0xb;if(_0x3a2e0c===_0x3ca694)break;else _0x31121e['push'](_0x31121e['shift']());}catch(_0x5b49d0){_0x31121e['push'](_0x31121e['shift']());}}}(a22_0x4098,0x3a1c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x2fdb40 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 a22_0x43697b 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=a22_0x8dcc7b(0x248),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x75ea67){const _0x6e4614=a22_0x8dcc7b,_0x23bf52=process['platform'],_0x2a2017=_0x23bf52==='darwin'?_0x6e4614(0x2ed):_0x23bf52===_0x6e4614(0x235)?'start':_0x6e4614(0x18d);spawn(_0x2a2017,[_0x75ea67],{'detached':!![],'stdio':'ignore'})['unref']();}function migrateLegacyDirectory(){const _0x1505f1=a22_0x8dcc7b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x397eae=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x397eae[_0x1505f1(0x2b8)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1505f1(0x19c)](a22_0x43697b['yellow'](_0x1505f1(0x2ad)+LEGACY_PARENT_SEGMENT_DIR+_0x1505f1(0x26a)+PARENT_SEGMENT_DIR+_0x1505f1(0x23d))),console[_0x1505f1(0x19c)](a22_0x43697b[_0x1505f1(0x2af)](_0x1505f1(0x2f3)+LEGACY_PARENT_SEGMENT_DIR+_0x1505f1(0x2e1))),![];console[_0x1505f1(0x19c)](a22_0x43697b[_0x1505f1(0x250)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a22_0x43697b[_0x1505f1(0x1b3)](_0x1505f1(0x18c)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c6925){const _0x4f61f8=_0x2c6925 instanceof Error?_0x2c6925[_0x1505f1(0x186)]:String(_0x2c6925);return console[_0x1505f1(0x19c)](a22_0x43697b['red'](_0x1505f1(0x2f9)+_0x4f61f8+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x8dcc7b(0x28e)](_0x448b55){const _0x137099=a22_0x8dcc7b;return migrateLegacyDirectory(),super[_0x137099(0x28e)](_0x448b55);}}function resolveYamlFile(_0x5a43e1){const _0x142fde=a22_0x8dcc7b;if(_0x5a43e1[_0x142fde(0x18b)](_0x142fde(0x240))||_0x5a43e1[_0x142fde(0x18b)](_0x142fde(0x1b9)))return _0x5a43e1;return a22_0x2fdb40[_0x142fde(0x1c6)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5a43e1)+_0x142fde(0x240));}function formatProgressMessage(_0x257a57){const _0x1472b2=a22_0x8dcc7b,_0x54ebda=_0x257a57[_0x1472b2(0x1b5)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x54ebda){const [,_0x4d303d,_0x126844,_0x17c01d='']=_0x54ebda;return a22_0x43697b[_0x1472b2(0x2af)](_0x4d303d+':')+'\x20'+_0x126844+a22_0x43697b[_0x1472b2(0x2af)](_0x17c01d);}return a22_0x43697b[_0x1472b2(0x2af)](_0x257a57);}function showFileNotFoundError(_0x358c0c,_0x775688){const _0x280dc9=a22_0x8dcc7b;console[_0x280dc9(0x19c)](a22_0x43697b[_0x280dc9(0x2c5)](_0x280dc9(0x1c3)+_0x358c0c+'\x0a')),console['error'](a22_0x43697b[_0x280dc9(0x2b4)](_0x280dc9(0x2bb)+_0x775688+_0x280dc9(0x200)));}function displayRealtimeValidation(_0x392446){const _0x59397a=a22_0x8dcc7b;if(!_0x392446[_0x59397a(0x1b4)])return;const _0x3d4708=_0x392446[_0x59397a(0x1b4)],_0x4a3643=_0x3d4708['enabled']?a22_0x43697b[_0x59397a(0x1b3)](_0x59397a(0x1a6)):a22_0x43697b['yellow'](_0x59397a(0x204));console['error']('\x0a'+a22_0x43697b['dim'](_0x59397a(0x299))+'\x20'+_0x4a3643);if(_0x3d4708[_0x59397a(0x1e6)]&&_0x3d4708['events'][_0x59397a(0x28a)]>0x0){console['error']('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x1cf))+'\x20'+_0x3d4708[_0x59397a(0x1e6)]['length']+_0x59397a(0x21d));for(const _0x173faf of _0x3d4708[_0x59397a(0x1e6)]){const _0x2c838c=_0x173faf[_0x59397a(0x21c)]===![]?a22_0x43697b[_0x59397a(0x2c5)]('✘'):a22_0x43697b[_0x59397a(0x1b3)]('✔');console[_0x59397a(0x19c)](_0x59397a(0x1b7)+_0x2c838c+'\x20'+_0x173faf[_0x59397a(0x300)]),_0x173faf[_0x59397a(0x1f7)]&&console[_0x59397a(0x19c)](_0x59397a(0x253)+a22_0x43697b[_0x59397a(0x2c5)](_0x173faf[_0x59397a(0x1f7)]));}}if(_0x3d4708[_0x59397a(0x210)]&&_0x3d4708[_0x59397a(0x210)][_0x59397a(0x28a)]>0x0){console['error']('\x20\x20'+a22_0x43697b['dim']('Attributes:')+'\x20'+_0x3d4708[_0x59397a(0x210)]['length']+'\x20configured');for(const _0x2a844b of _0x3d4708[_0x59397a(0x210)]){const _0x116308=_0x2a844b[_0x59397a(0x1ec)]?a22_0x43697b['green']('✔'):a22_0x43697b[_0x59397a(0x2c5)]('✘');console['error'](_0x59397a(0x1b7)+_0x116308+'\x20'+_0x2a844b[_0x59397a(0x300)]+'\x20'+a22_0x43697b['dim']('('+_0x2a844b['type']+')'));}}if(_0x3d4708[_0x59397a(0x2d5)]){const _0x3fe0fe=_0x3d4708['idStitching'][_0x59397a(0x1a8)]?.[_0x59397a(0x28a)]?_0x59397a(0x1ee)+_0x3d4708['idStitching']['stitchingKeys'][_0x59397a(0x1c6)](',\x20')+']':'';console[_0x59397a(0x19c)]('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x2b0))+'\x20'+_0x3d4708[_0x59397a(0x2d5)][_0x59397a(0x22b)]+_0x3fe0fe);}if(_0x3d4708[_0x59397a(0x293)]&&_0x3d4708['personalizationServices']['length']>0x0){console[_0x59397a(0x19c)]('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x20c))+'\x20'+_0x3d4708['personalizationServices'][_0x59397a(0x28a)]+'\x20service'+(_0x3d4708['personalizationServices'][_0x59397a(0x28a)]!==0x1?'s':''));for(const _0x3f53f5 of _0x3d4708[_0x59397a(0x293)]){console[_0x59397a(0x19c)](_0x59397a(0x2aa)+_0x3f53f5[_0x59397a(0x300)]);}}}function showParentSegmentNotSetError(_0x21869d){const _0x5b0655=a22_0x8dcc7b;console[_0x5b0655(0x19c)](a22_0x43697b[_0x5b0655(0x250)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x5b0655(0x19c)](_0x21869d);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2fe);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x23f);async[a22_0x8dcc7b(0x20b)](_0x17370b){const _0x595d05=a22_0x8dcc7b,{options:_0x13fefd,args:_0x20e0b9,tdx:_0x502cba}=_0x17370b,_0x2f151e=_0x20e0b9[0x0];_0x13fefd['verbose']&&(console[_0x595d05(0x19c)](_0x595d05(0x24f)+_0x13fefd['site']),_0x2f151e&&console[_0x595d05(0x19c)]('Pattern:\x20'+_0x2f151e));const _0x5a1c53=await withSpinner(_0x2f151e?_0x595d05(0x294)+_0x2f151e+_0x595d05(0x291):'Listing\x20parent\x20segments...',()=>_0x502cba[_0x595d05(0x286)]['listParents'](),{'verbose':_0x13fefd[_0x595d05(0x270)]});let _0x83eda0=_0x5a1c53[_0x595d05(0x207)];if(_0x2f151e){const _0x3808af=_0x2f151e[_0x595d05(0x2a7)](/[.+^${}()|[\]\\]/g,_0x595d05(0x221))[_0x595d05(0x2a7)](/\*/g,'.*')[_0x595d05(0x2a7)](/\?/g,'.'),_0x2c6894=new RegExp('^'+_0x3808af+'$','i');_0x83eda0=_0x83eda0[_0x595d05(0x241)](_0x3176ff=>_0x2c6894[_0x595d05(0x246)](_0x3176ff['attributes'][_0x595d05(0x300)]));}_0x83eda0[_0x595d05(0x228)]((_0x53d07a,_0x4eb829)=>_0x53d07a[_0x595d05(0x210)]['name']['localeCompare'](_0x4eb829[_0x595d05(0x210)]['name'])),console[_0x595d05(0x19c)]('✔\x20Found\x20'+_0x83eda0[_0x595d05(0x28a)]+'\x20parent\x20segment'+(_0x83eda0[_0x595d05(0x28a)]!==0x1?'s':''));const _0x2fbfd5=_0x3e3209=>{const _0x5b8eff=_0x595d05;return getConsoleNextUrl(_0x13fefd[_0x5b8eff(0x1f5)],_0x5b8eff(0x220)+_0x3e3209);};if(_0x13fefd[_0x595d05(0x222)]===_0x595d05(0x2a0)||_0x13fefd[_0x595d05(0x222)]===_0x595d05(0x2f7)){const _0x394ca6=_0x83eda0[_0x595d05(0x20d)](_0x4dd12f=>({..._0x4dd12f,'url':_0x2fbfd5(_0x4dd12f['id'])}));await handleSDKOutput(_0x394ca6,_0x13fefd);}else{if(_0x83eda0[_0x595d05(0x28a)]===0x0)_0x2f151e?console['log'](_0x595d05(0x281)+_0x2f151e):console[_0x595d05(0x2dc)](_0x595d05(0x2a3));else for(const _0x8bac28 of _0x83eda0){const _0x1e2d1a=_0x8bac28['attributes']['population']?a22_0x43697b['dim']('\x20('+formatRows(_0x8bac28['attributes'][_0x595d05(0x287)])+')'):'',_0x532352=hyperlink(_0x8bac28[_0x595d05(0x210)][_0x595d05(0x300)],_0x2fbfd5(_0x8bac28['id']));console[_0x595d05(0x2dc)](_0x595d05(0x236)+_0x532352+_0x1e2d1a);}}return 0x0;}}function a22_0x4098(){const _0x1b84e6=['\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Personalization\x20service\x20description','displayMasterInfo','\x20is\x20already\x20up\x20to\x20date','Options:','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20field','Fetching\x20current\x20configuration\x20for\x20\x27','errors','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment','population','.customers)','displaySampleData','length','limit','interval','ps:rt:validate','run','query','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x27...','start','personalizationServices','Listing\x20parent\x20segments\x20matching\x20\x27','\x20Context\x20set:\x20','column_name','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','table','RT\x202.0:','trigger_event','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','behaviorsFile','customers','20aaDlmM','\x0aUsage:\x20tdx\x20ps\x20preview\x20','json','status','parentSegment','No\x20parent\x20segments\x20found','workflowAttemptId','totalEvents','✔\x20No\x20changes\x20-\x20\x27','replace','No\x20RT-enabled\x20parent\x20segments\x20found','segment:parent:pull','\x20\x20\x20\x20-\x20','workflowSessionId','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x0a⚠️\x20\x20Both\x20','Validating\x20configuration...','dim','ID\x20Stitching:','segment:parent:validate','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','cyan','\x20No\x20changes\x20-\x20','\x20Opening\x20','stats','isDirectory','Listing\x20RT-enabled\x20parent\x20segments...','\x20Added\x20personalization\x20template\x20to\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✔\x20Updated\x20parent\x20segment\x20\x27','2310396kQlyqr','list','8nmQhNz','Fetching\x20SQL\x20for\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','\x0aChanges\x20to\x20apply\x20to\x20\x27','behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','red','48HrTEMs','segment:parent:view','\x20=\x20','Fetching\x20parent\x20segment\x20\x27','My\x20Service','\x20\x20Tables:\x201\x20customers\x20+\x20','-1d','parent_segment','\x20[Job\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Options\x20(one\x20required):\x0a','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','Attribute:','\x20total','\x20\x20Note:\x20','idStitching','realtime_enabled','Listing\x20fields\x20for\x20\x27','pullParentYaml','text','Create\x20parent\x20segment\x20\x27','workflowId','log','preview','✔\x20Found\x20','ps:pz:init','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','/\x20directory.\x0a','Session:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','addBehaviors','<database>.<table>','Database:\x20','\x20\x20Database:\x20','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','indexOf','\x0a\x20\x20\x20\x20}','setJobId','enriched','open','\x20--attribute\x20\x22<name>\x22','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','resolveParentId','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','in\x20','420707hMGNtd','pushParentYaml','jsonl','\x20Configuration\x20is\x20valid','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20service(s)\x20configured','trim','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','FINISHED','segment:parent:list','Updating','name','schemaError','database','885892kXAGWm','Creating','\x20parent\x20segment\x20\x27','Behaviors','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Fetching\x20sample\x20data...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','sampleData','last_page_viewed','\x20RT\x20configuration\x20is\x20valid','segment:parent:push','message','Errors:','To\x20view\x20sample\x20data:','\x0a)\x20AS\x20segment_query\x0aLIMIT\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','endsWith','✔\x20Renamed\x20directory\x20to\x20','xdg-open','segment:parent:sql','collectSchema','toLowerCase','displayRealtimeInfo','single','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','columns','personalization','apply','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','varchar','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','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','error','\x27\x20and\x20run\x20workflow?','td_client_id','\x20personalization\x20service','\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','\x20--behavior\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Default','\x20\x20Columns:\x20','displayAttributesStats','⚡\x20Enabled','string','stitchingKeys','double','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Join:','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','column_type','previewParentYaml','Coverage:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20No\x20sample\x20data\x20available','listFields','green','realtime','match','processedRows','\x20\x20\x20\x20','Name:\x20','.yaml','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','allValid','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','master','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','✔\x20Query\x20completed:\x20Processed\x20','number','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Error:\x20File\x20not\x20found:\x20','\x20trigger=','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','join','behavior_','12275JXMzSe','schemaValid','\x20\x202.\x20Run\x20','Updated','rowCount','getParentFull','reduce','Events:','scheduleOption','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20rows\x20','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','type','Audience\x20ID:','Fetching\x20customers\x20schema...','Join\x20on:','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20behaviors','output','Show\x20parent\x20segment\x20details','Available\x20attributes:','repeat','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Master\x20+\x20Attributes','column','Updating\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','toLocaleString','foreignKey','events','\x20--enriched','realtime:','scheduleType','attribute','updateParent','valid','Validate:','\x20+\x20[','Table:\x20','customerGroup','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','coveragePercent','Error\x20parsing\x20YAML:\x20','site','\x0a✔\x20Workflow\x20started','sourceTableError','600vZBcDL','Error:\x20--behavior\x20requires\x20a\x20name\x0a','behavior','1318851hSKQiX','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:run','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parent_id','`\x20to\x20download\x20the\x20configuration\x20first','label','customerGroupFile','\x20rows)','⚡\x20Not\x20enabled','\x20Added\x20RT\x202.0\x20template\x20section','matchedCount','data','segment:parent:preview','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Fetching\x20behavior\x20list...','execute','Personalization:','map','getOutputDatabaseName','Apply\x20changes\x20to\x20\x27','attributes','Enriched:','\x0aChanges\x20to\x20\x27','Error\x20reading\x20file:\x20','displayPreviewHints','getBehaviorNames','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','use','\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','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Executing\x20parent\x20segment\x20query...','sourceTableValid','\x20configured','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Options:\x0a','/app/dw/parentSegments/','\x5c$&','format','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Customers:','Resolving\x20parent\x20segment\x20\x27','timezone','sort','yes','/{name}.yml\x0a','primaryKey','displayPreviewResults','segment:parent:fields','stop','\x20tdx\x20wf\x20attempt\x20','Source:','personalization_services','joinKey','\x20--attribute\x20\x22','elapsedTimeMillis','win32','👥\x20','\x0aNo\x20sample\x20data\x20available','segment:parent:create','Output\x20file:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20section','Analyzing\x20changes...','/\x20directories\x20exist.','user_id','List\x20parent\x20segments','.yml','filter','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','all','tdx\x20ps\x20preview\x20','getParentSQL','test','displayBehaviorsStats','parent_segments','segment:parent:update','bold','Columns:','Master:','toFixed','\x0aNew\x20parent\x20segment\x20\x27','Site:\x20','yellow','197307lyFjgX','displaySummary','\x20\x20\x20\x20\x20\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x27\x20with\x20ID:\x20','utf-8','customerPercent','\x20to\x20push\x20the\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Parent\x20segment:\x20','customersWithEvents','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','jobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','/app/workflows/','\x0aError:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','attributesFile','Aborted.','SELECT\x20*\x20FROM\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','push','description','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','108381afCoDG','/\x20and\x20','true','displayValidateResults','validateParentYaml','Error:','List\x20available\x20fields\x20for\x20segmentation','verbose','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Overwrite\x20\x27','segment:parent:show','displayColumns','ps:pz:list','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20--interval\x20','session','Schema\x20saved\x20to\x20','formatSchemaJson','Found\x20YAML\x20file:\x20'];a22_0x4098=function(){return _0x1b84e6;};return a22_0x4098();}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x238);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x8dcc7b(0x20b)](_0x147c9b){const _0x4a26f3=a22_0x8dcc7b,{options:_0x4277f0,args:_0x1f01be,tdx:_0x143948}=_0x147c9b;console['error'](_0x4a26f3(0x198)+_0x4a26f3(0x1bc)+_0x4a26f3(0x25c));const _0x146208=_0x4277f0;if(_0x1f01be[_0x4a26f3(0x28a)]===0x0)return console['error'](a22_0x43697b[_0x4a26f3(0x2c5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x4a26f3(0x268)),0x1;const _0x589201=_0x1f01be[0x0];if(!_0x146208[_0x4a26f3(0x302)]||!_0x146208[_0x4a26f3(0x298)])return console[_0x4a26f3(0x19c)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x4a26f3(0x268)),0x1;_0x146208['verbose']&&(console[_0x4a26f3(0x19c)](_0x4a26f3(0x24f)+_0x146208['site']),console[_0x4a26f3(0x19c)](_0x4a26f3(0x1b8)+_0x589201),console[_0x4a26f3(0x19c)](_0x4a26f3(0x2e6)+_0x146208[_0x4a26f3(0x302)]),console[_0x4a26f3(0x19c)](_0x4a26f3(0x1ef)+_0x146208[_0x4a26f3(0x298)]));const _0x50d91a=await loadJSONFromOptions(_0x146208['attributes'],_0x146208[_0x4a26f3(0x262)]),_0x25e0c4=await loadJSONFromOptions(_0x146208[_0x4a26f3(0x2c3)],_0x146208[_0x4a26f3(0x29c)]),_0x53b174=await loadJSONFromOptions(_0x146208[_0x4a26f3(0x1f0)],_0x146208[_0x4a26f3(0x202)]),_0x3cf800={'name':_0x589201,'description':_0x146208[_0x4a26f3(0x267)],'scheduleType':_0x146208[_0x4a26f3(0x1e9)],'scheduleOption':_0x146208['scheduleOption'],'timezone':_0x146208[_0x4a26f3(0x227)],'master':{'parentDatabaseName':_0x146208[_0x4a26f3(0x302)],'parentTableName':_0x146208[_0x4a26f3(0x298)]},'attributes':_0x50d91a,'behaviors':_0x25e0c4,'customerGroup':_0x53b174},_0x4c82f0=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x589201+_0x4a26f3(0x291),()=>_0x143948[_0x4a26f3(0x286)]['createParent'](_0x3cf800),{'verbose':_0x4277f0[_0x4a26f3(0x270)]}),_0x1a84f7=_0x4c82f0[_0x4a26f3(0x207)];return console[_0x4a26f3(0x19c)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x1a84f7['name']+_0x4a26f3(0x255)+_0x1a84f7['id']),await handleSDKOutput([_0x1a84f7],_0x4277f0),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x249);[a22_0x8dcc7b(0x267)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x350c0d){const _0x3f460f=a22_0x8dcc7b,{options:_0x24f0f1,args:_0x2a168b,tdx:_0x15432d}=_0x350c0d;console[_0x3f460f(0x19c)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x3f460f(0x1bc)+_0x3f460f(0x25c));const _0x318661=_0x24f0f1;if(_0x2a168b[_0x3f460f(0x28a)]===0x0)return console[_0x3f460f(0x19c)](a22_0x43697b[_0x3f460f(0x2c5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x3f460f(0x216)),0x1;const _0x3f1b4a=_0x2a168b[0x0];_0x318661[_0x3f460f(0x270)]&&(console[_0x3f460f(0x19c)](_0x3f460f(0x24f)+_0x318661[_0x3f460f(0x1f5)]),console[_0x3f460f(0x19c)](_0x3f460f(0x25a)+_0x3f1b4a));const _0x21c2d7=await withSpinner(_0x3f460f(0x283)+_0x3f1b4a+_0x3f460f(0x291),()=>_0x15432d[_0x3f460f(0x286)][_0x3f460f(0x1cd)](_0x3f1b4a),{'verbose':_0x318661[_0x3f460f(0x270)]}),_0x1790dc=_0x21c2d7[_0x3f460f(0x207)],_0x565394=await loadJSONFromOptions(_0x318661['addAttributes'],_0x318661['addAttributesFile']),_0x5919d0=await loadJSONFromOptions(_0x318661[_0x3f460f(0x2e4)],_0x318661['addBehaviorsFile']),_0x3aa780={'name':_0x1790dc[_0x3f460f(0x300)],'description':_0x318661['description']!==undefined?_0x318661[_0x3f460f(0x267)]:_0x1790dc['description'],'scheduleType':_0x318661[_0x3f460f(0x1e9)]!==undefined?_0x318661['scheduleType']:_0x1790dc[_0x3f460f(0x1e9)],'scheduleOption':_0x318661[_0x3f460f(0x1d0)]!==undefined?_0x318661[_0x3f460f(0x1d0)]:_0x1790dc[_0x3f460f(0x1d0)],'timezone':_0x318661[_0x3f460f(0x227)]!==undefined?_0x318661[_0x3f460f(0x227)]:_0x1790dc[_0x3f460f(0x227)],'master':_0x1790dc[_0x3f460f(0x1bd)],'attributes':_0x565394?[..._0x1790dc['attributes']||[],..._0x565394]:_0x1790dc[_0x3f460f(0x210)],'behaviors':_0x5919d0?[..._0x1790dc[_0x3f460f(0x2c3)]||[],..._0x5919d0]:_0x1790dc[_0x3f460f(0x2c3)],'customerGroup':_0x1790dc[_0x3f460f(0x1f0)]},_0x29fb82=await withSpinner(_0x3f460f(0x1e2)+_0x3f1b4a+_0x3f460f(0x291),()=>_0x15432d['segment'][_0x3f460f(0x1eb)](_0x3f1b4a,_0x3aa780),{'verbose':_0x318661[_0x3f460f(0x270)]}),_0x12dc89=_0x29fb82[_0x3f460f(0x207)];return console[_0x3f460f(0x19c)](_0x3f460f(0x2bc)+_0x12dc89[_0x3f460f(0x300)]+'\x27'),await handleSDKOutput([_0x12dc89],_0x318661),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x8dcc7b(0x2a9);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x1fe);async[a22_0x8dcc7b(0x20b)](_0x46e02f){const _0x31fe07=a22_0x8dcc7b,{options:_0x413916,args:_0x2630a9,tdx:_0x36f25e}=_0x46e02f,_0x358ae4=_0x413916,_0x461a43=_0x2630a9[0x0]||_0x413916['parentSegment'];if(!_0x461a43)return showParentSegmentNotSetError(_0x31fe07(0x309)+_0x31fe07(0x1be)),0x1;if(_0x358ae4[_0x31fe07(0x218)]&&_0x358ae4[_0x31fe07(0x1db)])return console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2c5)](_0x31fe07(0x1ba))),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x31fe07(0x22a))),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2b4)](_0x31fe07(0x25e))),0x1;const _0x78db00=_0x358ae4[_0x31fe07(0x1db)]||a22_0x2fdb40[_0x31fe07(0x1c6)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x461a43)+_0x31fe07(0x240));_0x358ae4[_0x31fe07(0x270)]&&(console[_0x31fe07(0x19c)]('Site:\x20'+_0x358ae4[_0x31fe07(0x1f5)]),console[_0x31fe07(0x19c)](_0x31fe07(0x25a)+_0x461a43),console['error'](_0x31fe07(0x239)+_0x78db00));const _0x4db05b=await withSpinner(_0x31fe07(0x2c9)+_0x461a43+_0x31fe07(0x291),()=>_0x36f25e[_0x31fe07(0x286)][_0x31fe07(0x2d8)](_0x461a43),{'verbose':_0x358ae4['verbose']}),_0xefbfd6=_0x4db05b[_0x31fe07(0x207)];if(existsSync(_0x78db00)){const _0x4cde5d=readFileSync(_0x78db00,_0x31fe07(0x256)),_0x4efecc=generateDiff(_0x4cde5d,_0xefbfd6);if(!hasChanges(_0x4efecc))console['error'](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2b5)+a22_0x43697b[_0x31fe07(0x2b4)](_0x78db00)+_0x31fe07(0x27f));else{console[_0x31fe07(0x19c)](_0x31fe07(0x212)+_0x78db00+'\x27:'),console[_0x31fe07(0x19c)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x4efecc)),console[_0x31fe07(0x19c)]('─'[_0x31fe07(0x1de)](0x3c));if(!_0x358ae4[_0x31fe07(0x229)]){if(!isInteractive())return console[_0x31fe07(0x19c)](a22_0x43697b['red'](_0x31fe07(0x260)),_0x31fe07(0x21e)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2cad30=await confirmKey(_0x31fe07(0x272)+_0x78db00+'\x27?');if(!_0x2cad30)return console[_0x31fe07(0x19c)](a22_0x43697b['yellow'](_0x31fe07(0x263))),0x1;}writeFileSync(_0x78db00,_0xefbfd6,_0x31fe07(0x256)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2c4)+a22_0x43697b[_0x31fe07(0x2b4)](_0x78db00));}}else{const _0x24733e=a22_0x2fdb40['dirname'](_0x78db00);!existsSync(_0x24733e)&&mkdirSync(_0x24733e,{'recursive':!![]}),writeFileSync(_0x78db00,_0xefbfd6,_0x31fe07(0x256)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2c4)+a22_0x43697b['cyan'](_0x78db00));}return saveSessionContext({'parent_segment':_0x461a43},_0x358ae4[_0x31fe07(0x278)]),console['error'](a22_0x43697b['green']('✔')+_0x31fe07(0x295)+a22_0x43697b[_0x31fe07(0x2af)](_0x31fe07(0x2cd))+'\x20=\x20'+a22_0x43697b[_0x31fe07(0x2b4)](_0x461a43)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x185);[a22_0x8dcc7b(0x267)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a22_0x8dcc7b(0x20b)](_0x44d000){const _0x1f55ba=a22_0x8dcc7b,{options:_0x69ad61,args:_0x11aa78,tdx:_0x433a98}=_0x44d000,_0x34d24d=_0x69ad61,_0x466b21=_0x11aa78[0x0]||_0x69ad61[_0x1f55ba(0x2a2)];if(!_0x466b21)return showParentSegmentNotSetError(_0x1f55ba(0x1f2)+_0x1f55ba(0x1a2)),0x1;const _0x16c6b7=resolveYamlFile(_0x466b21);if(!existsSync(_0x16c6b7))return showFileNotFoundError(_0x16c6b7,_0x466b21),0x1;_0x34d24d[_0x1f55ba(0x270)]&&(console[_0x1f55ba(0x19c)](_0x1f55ba(0x24f)+_0x34d24d[_0x1f55ba(0x1f5)]),console[_0x1f55ba(0x19c)]('YAML\x20file:\x20'+_0x16c6b7));let _0x1b4762;try{_0x1b4762=readFileSync(_0x16c6b7,_0x1f55ba(0x256));}catch(_0x1ebee8){const _0x427afa=_0x1ebee8 instanceof Error?_0x1ebee8[_0x1f55ba(0x186)]:String(_0x1ebee8);return console[_0x1f55ba(0x19c)](_0x1f55ba(0x213)+_0x427afa),0x1;}const _0x3f3146=await withSpinner('Analyzing\x20changes...',()=>_0x433a98['segment'][_0x1f55ba(0x2f6)](_0x1b4762),{'verbose':_0x34d24d['verbose']}),_0x400a76=_0x3f3146[_0x1f55ba(0x207)],{isNew:_0x11294c,name:_0xaeb72c,hasChanges:_0x5e7371,diffFormatted:_0x54308f}=_0x400a76;if(!_0x5e7371)return console[_0x1f55ba(0x19c)](_0x1f55ba(0x2a6)+_0xaeb72c+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x11294c?console[_0x1f55ba(0x19c)](_0x1f55ba(0x24e)+_0xaeb72c+'\x27:'):console[_0x1f55ba(0x19c)](_0x1f55ba(0x2c2)+_0xaeb72c+'\x27:');console[_0x1f55ba(0x19c)]('─'['repeat'](0x3c)),console[_0x1f55ba(0x19c)](_0x54308f),console['error']('─'['repeat'](0x3c));const _0x11677e=_0x11294c?'Create\x20parent\x20segment\x20\x27'+_0xaeb72c+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xaeb72c+'\x27?';if(!_0x34d24d[_0x1f55ba(0x229)]){if(!isInteractive())return console[_0x1f55ba(0x19c)](a22_0x43697b['red'](_0x1f55ba(0x260)),_0x1f55ba(0x21e)),console[_0x1f55ba(0x19c)](a22_0x43697b[_0x1f55ba(0x2af)](_0x1f55ba(0x261))),0x1;const _0x319326=await confirmKey(_0x11677e);if(!_0x319326)return console[_0x1f55ba(0x19c)](a22_0x43697b[_0x1f55ba(0x250)](_0x1f55ba(0x263))),0x1;}const _0x2760ff=_0x11294c?_0x1f55ba(0x304):_0x1f55ba(0x2ff),_0x242b24=await withSpinner(_0x2760ff+_0x1f55ba(0x305)+_0xaeb72c+_0x1f55ba(0x291),()=>_0x400a76[_0x1f55ba(0x197)](),{'verbose':_0x34d24d[_0x1f55ba(0x270)]}),_0x1a6598=_0x242b24[_0x1f55ba(0x207)],_0xcc2efc=getConsoleNextUrl(_0x34d24d['site'],_0x1f55ba(0x220)+_0x1a6598['id']),_0x22c7eb=_0x11294c?'Created':_0x1f55ba(0x1cb);return console[_0x1f55ba(0x19c)]('✔\x20'+_0x22c7eb+_0x1f55ba(0x305)+_0x1a6598['name']+'\x27'),console[_0x1f55ba(0x19c)]('\x20\x20'+_0xcc2efc),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2b1);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x1c2);async[a22_0x8dcc7b(0x20b)](_0x4ad277){const _0x11b0d0=a22_0x8dcc7b,{options:_0x14e5cd,args:_0x1c0663,tdx:_0x4cd54a}=_0x4ad277,_0x3c172d=_0x14e5cd,_0x13452a=_0x1c0663[0x0]||_0x14e5cd['parentSegment'];if(!_0x13452a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x11b0d0(0x1b0)+_0x11b0d0(0x21f)+_0x11b0d0(0x1df)+_0x11b0d0(0x1bf)+_0x11b0d0(0x297)),0x1;const _0x146705=resolveYamlFile(_0x13452a);if(!existsSync(_0x146705))return showFileNotFoundError(_0x146705,_0x13452a),0x1;_0x3c172d[_0x11b0d0(0x270)]&&(console[_0x11b0d0(0x19c)](_0x11b0d0(0x24f)+_0x3c172d[_0x11b0d0(0x1f5)]),console[_0x11b0d0(0x19c)]('YAML\x20file:\x20'+_0x146705));let _0x53558a;try{_0x53558a=readFileSync(_0x146705,'utf-8');}catch(_0x44747c){const _0x41412e=_0x44747c instanceof Error?_0x44747c[_0x11b0d0(0x186)]:String(_0x44747c);return console['error'](_0x11b0d0(0x213)+_0x41412e),0x1;}const _0x3d11af=createCommandSpinner(a22_0x43697b[_0x11b0d0(0x2af)](_0x11b0d0(0x2ae)),{'verbose':_0x3c172d['verbose']});_0x3d11af[_0x11b0d0(0x292)]();const _0x540c72={'onProgress':_0x3e53bb=>{const _0x49af01=_0x11b0d0;_0x3d11af[_0x49af01(0x2d9)]=formatProgressMessage(_0x3e53bb);}};if(_0x3c172d[_0x11b0d0(0x1bd)])_0x540c72[_0x11b0d0(0x1bd)]=!![];if(_0x3c172d['enriched'])_0x540c72['enriched']=!![];_0x3c172d[_0x11b0d0(0x1ea)]&&(_0x540c72[_0x11b0d0(0x1ea)]=_0x3c172d[_0x11b0d0(0x1ea)]);_0x3c172d[_0x11b0d0(0x1fa)]&&(_0x540c72['behavior']=_0x3c172d[_0x11b0d0(0x1fa)]);if(_0x3c172d[_0x11b0d0(0x28c)])_0x540c72['interval']=_0x3c172d['interval'];let _0x30450e;try{_0x30450e=await _0x4cd54a['segment'][_0x11b0d0(0x26d)](_0x53558a,_0x540c72),_0x3d11af['stop']();}catch(_0x1c51d2){_0x3d11af[_0x11b0d0(0x22e)]();throw _0x1c51d2;}const _0x21450b=_0x3c172d[_0x11b0d0(0x28c)]||_0x11b0d0(0x2cc);return this['displayValidateResults'](_0x30450e,_0x540c72,_0x146705,_0x21450b),_0x30450e[_0x11b0d0(0x1bb)]?0x0:0x1;}[a22_0x8dcc7b(0x26c)](_0x53a8d2,_0x487511,_0x1b89c4,_0x3325b3){const _0x6bb4c3=a22_0x8dcc7b;console[_0x6bb4c3(0x19c)]('\x0a'+a22_0x43697b[_0x6bb4c3(0x24a)](_0x6bb4c3(0x1ed))+'\x20'+_0x53a8d2[_0x6bb4c3(0x300)]),console[_0x6bb4c3(0x19c)]('═'[_0x6bb4c3(0x1de)](0x3c)),this['displayMasterInfo'](_0x53a8d2);if(typeof _0x487511[_0x6bb4c3(0x1ea)]===_0x6bb4c3(0x1a7)){this[_0x6bb4c3(0x1a5)](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x1ea),_0x487511[_0x6bb4c3(0x1ea)]);return;}if(_0x487511[_0x6bb4c3(0x1ea)]===!![]){this[_0x6bb4c3(0x1a5)](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,'attributes');return;}if(typeof _0x487511[_0x6bb4c3(0x1fa)]===_0x6bb4c3(0x1a7)){this['displayBehaviorsStats'](_0x53a8d2,_0x3325b3),this['displaySummary'](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x1fa),_0x487511[_0x6bb4c3(0x1fa)]);return;}if(_0x487511[_0x6bb4c3(0x1fa)]===!![]){this[_0x6bb4c3(0x247)](_0x53a8d2,_0x3325b3),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x2c3));return;}this[_0x6bb4c3(0x1a5)](_0x53a8d2),this['displayBehaviorsStats'](_0x53a8d2,_0x3325b3),this['displayRealtimeInfo'](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x243));}[a22_0x8dcc7b(0x191)](_0x5b17a2){displayRealtimeValidation(_0x5b17a2);}['displayPreviewHints'](_0x24d358,_0x4c02b5,_0x20134b,_0x3c7649){const _0xf75c7=a22_0x8dcc7b;console[_0xf75c7(0x19c)]('\x0a'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x188)));const _0x41bebd=_0x4c02b5!=='-1d'?_0xf75c7(0x277)+_0x4c02b5:'';if(_0x20134b==='attribute'&&_0x3c7649)console['error']('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x233)+_0x3c7649+'\x22'+_0x41bebd));else{if(_0x20134b===_0xf75c7(0x1fa)&&_0x3c7649)console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x1a1)+_0x3c7649+'\x22'+_0x41bebd));else(_0x20134b==='attributes'||_0x20134b===_0xf75c7(0x243))&&console['error']('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)]('tdx\x20ps\x20preview\x20'+_0x24d358+_0xf75c7(0x2ee)+_0x41bebd));}(_0x20134b===_0xf75c7(0x2c3)||_0x20134b==='all')&&console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+'\x20--behavior\x20\x22<name>\x22'+_0x41bebd)),_0x20134b===_0xf75c7(0x243)&&console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x1e7)+_0x41bebd));}[a22_0x8dcc7b(0x27e)](_0x427f72){const _0x53a426=a22_0x8dcc7b,{master:_0xab8e2f}=_0x427f72,_0x4b005d=_0xab8e2f[_0x53a426(0x1c9)]?a22_0x43697b['green']('✔'):a22_0x43697b[_0x53a426(0x2c5)]('✘');console[_0x53a426(0x19c)]('\x0a'+a22_0x43697b[_0x53a426(0x2af)]('Master\x20Table')),console[_0x53a426(0x19c)](_0x4b005d+'\x20'+a22_0x43697b[_0x53a426(0x24a)](_0xab8e2f[_0x53a426(0x302)]+'.'+_0xab8e2f[_0x53a426(0x298)])),_0xab8e2f['schemaValid']?_0xab8e2f['rowCount']!==undefined&&console['error']('\x20\x20'+a22_0x43697b['dim']('Rows:')+'\x20'+a22_0x43697b[_0x53a426(0x2b4)](formatRows(_0xab8e2f[_0x53a426(0x1cc)]))):console[_0x53a426(0x19c)]('\x20\x20'+a22_0x43697b[_0x53a426(0x2c5)]('Error:')+'\x20'+_0xab8e2f[_0x53a426(0x301)]);}[a22_0x8dcc7b(0x1a5)](_0xdfae){const _0x498a2f=a22_0x8dcc7b;if(_0xdfae['attributes'][_0x498a2f(0x28a)]===0x0)return;console[_0x498a2f(0x19c)]('\x0a'+a22_0x43697b['dim']('Attributes'));for(const _0xb4b5f1 of _0xdfae[_0x498a2f(0x210)]){const _0x5c5da7=_0xb4b5f1[_0x498a2f(0x1c9)]?a22_0x43697b[_0x498a2f(0x1b3)]('✔'):a22_0x43697b[_0x498a2f(0x2c5)]('✘');let _0x520843='';if(_0xb4b5f1[_0x498a2f(0x1c9)]&&_0xb4b5f1[_0x498a2f(0x206)]!==undefined&&_0xb4b5f1['coveragePercent']!==undefined){const _0x1f9e64=_0xb4b5f1[_0x498a2f(0x1f3)]['toFixed'](0x1),_0x433886=_0xb4b5f1[_0x498a2f(0x1f3)]>=0x50?a22_0x43697b[_0x498a2f(0x1b3)]:_0xb4b5f1[_0x498a2f(0x1f3)]>=0x32?a22_0x43697b[_0x498a2f(0x250)]:a22_0x43697b[_0x498a2f(0x2c5)];_0x520843='\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x1af))+'\x20'+_0x433886(_0x1f9e64+'%')+'\x20('+formatRows(_0xb4b5f1[_0x498a2f(0x206)])+_0x498a2f(0x203);}console[_0x498a2f(0x19c)](_0x5c5da7+'\x20'+a22_0x43697b[_0x498a2f(0x24a)](_0xb4b5f1[_0x498a2f(0x300)])+_0x520843),console[_0x498a2f(0x19c)]('\x20\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x230))+'\x20'+a22_0x43697b['bold'](_0xb4b5f1['database']+'.'+_0xb4b5f1[_0x498a2f(0x298)]));const _0x3eb380=_0xb4b5f1[_0x498a2f(0x232)]===_0xb4b5f1[_0x498a2f(0x1e5)]?a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x1d8))+'\x20'+_0xb4b5f1[_0x498a2f(0x232)]:a22_0x43697b['dim']('Join:')+'\x20'+_0xb4b5f1[_0x498a2f(0x232)]+_0x498a2f(0x2c8)+_0xb4b5f1[_0x498a2f(0x1e5)];console['error']('\x20\x20'+_0x3eb380),console['error']('\x20\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x24b))),this[_0x498a2f(0x274)](_0xb4b5f1[_0x498a2f(0x195)]),!_0xb4b5f1[_0x498a2f(0x1c9)]&&console['error']('\x20\x20'+a22_0x43697b[_0x498a2f(0x2c5)](_0x498a2f(0x26e))+'\x20'+_0xb4b5f1['schemaError']);}}[a22_0x8dcc7b(0x247)](_0x3c89e8,_0x3c98bf){const _0x2d5668=a22_0x8dcc7b;if(_0x3c89e8[_0x2d5668(0x2c3)][_0x2d5668(0x28a)]===0x0)return;console[_0x2d5668(0x19c)]('\x0a'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x306))+'\x20'+a22_0x43697b[_0x2d5668(0x2af)]('('+_0x3c98bf+')'));for(const _0x3699f6 of _0x3c89e8['behaviors']){const _0x3258af=_0x3699f6[_0x2d5668(0x1c9)]?a22_0x43697b[_0x2d5668(0x1b3)]('✔'):a22_0x43697b[_0x2d5668(0x2c5)]('✘');let _0x5e3367='';if(_0x3699f6['schemaValid']&&_0x3699f6[_0x2d5668(0x25b)]!==undefined&&_0x3699f6[_0x2d5668(0x2a5)]!==undefined){const _0x33d12e=_0x3699f6[_0x2d5668(0x257)]?.[_0x2d5668(0x24d)](0x1)||'?',_0x2cdb46=(_0x3699f6['customerPercent']??0x0)>=0x32?a22_0x43697b[_0x2d5668(0x1b3)]:(_0x3699f6[_0x2d5668(0x257)]??0x0)>=0x14?a22_0x43697b[_0x2d5668(0x250)]:a22_0x43697b[_0x2d5668(0x2c5)];_0x5e3367='\x20'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x225))+'\x20'+_0x2cdb46(formatRows(_0x3699f6[_0x2d5668(0x25b)]))+'\x20('+_0x33d12e+'%)\x20'+a22_0x43697b['dim'](_0x2d5668(0x1cf))+'\x20'+a22_0x43697b['cyan'](formatRows(_0x3699f6[_0x2d5668(0x2a5)]));}console['error'](_0x3258af+'\x20'+a22_0x43697b['bold'](_0x3699f6[_0x2d5668(0x300)])+_0x5e3367),console[_0x2d5668(0x19c)]('\x20\x20'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x230))+'\x20'+a22_0x43697b[_0x2d5668(0x24a)](_0x3699f6[_0x2d5668(0x302)]+'.'+_0x3699f6['table']));const _0x2b2db7=_0x3699f6['joinKey']===_0x3699f6[_0x2d5668(0x1e5)]?a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x1d8))+'\x20'+_0x3699f6[_0x2d5668(0x232)]:a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x1ab))+'\x20'+_0x3699f6['joinKey']+_0x2d5668(0x2c8)+_0x3699f6['foreignKey'];console['error']('\x20\x20'+_0x2b2db7),console['error']('\x20\x20'+a22_0x43697b[_0x2d5668(0x2af)]('Columns:')),this[_0x2d5668(0x274)](_0x3699f6[_0x2d5668(0x195)]),!_0x3699f6[_0x2d5668(0x1c9)]&&console[_0x2d5668(0x19c)]('\x20\x20'+a22_0x43697b[_0x2d5668(0x2c5)](_0x2d5668(0x26e))+'\x20'+_0x3699f6[_0x2d5668(0x301)]);}}[a22_0x8dcc7b(0x274)](_0x38e1f6){const _0x5b614b=a22_0x8dcc7b;for(const _0x591301 of _0x38e1f6){_0x591301[_0x5b614b(0x201)]===_0x591301[_0x5b614b(0x1e1)]||_0x591301[_0x5b614b(0x1e1)]==='*'?console[_0x5b614b(0x19c)](_0x5b614b(0x2aa)+_0x591301[_0x5b614b(0x201)]):console[_0x5b614b(0x19c)](_0x5b614b(0x2aa)+_0x591301[_0x5b614b(0x201)]+'\x20'+a22_0x43697b[_0x5b614b(0x2af)]('('+_0x591301[_0x5b614b(0x1e1)]+')'));}}[a22_0x8dcc7b(0x252)](_0x25b963){const _0x57c6e4=a22_0x8dcc7b;console[_0x57c6e4(0x19c)]('─'[_0x57c6e4(0x1de)](0x3c));if(_0x25b963[_0x57c6e4(0x284)][_0x57c6e4(0x28a)]>0x0){console[_0x57c6e4(0x19c)]('\x0a'+a22_0x43697b[_0x57c6e4(0x2c5)](_0x57c6e4(0x187)));for(const _0x3528b4 of _0x25b963[_0x57c6e4(0x284)]){console[_0x57c6e4(0x19c)]('\x20\x20'+a22_0x43697b[_0x57c6e4(0x2c5)]('•')+'\x20'+_0x3528b4);}}_0x25b963['allValid']&&console['error']('\x0a'+a22_0x43697b[_0x57c6e4(0x1b3)]('✔')+_0x57c6e4(0x2f8));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x208);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x193);async[a22_0x8dcc7b(0x20b)](_0x442a77){const _0x1787db=a22_0x8dcc7b,{options:_0x1f8048,args:_0x224e63,tdx:_0x457dbd}=_0x442a77,_0x2ac61f=_0x1f8048,_0x353216=_0x224e63[0x0]||_0x1f8048[_0x1787db(0x2a2)];if(!_0x353216)return showParentSegmentNotSetError(_0x1787db(0x1aa)+_0x1787db(0x2cf)+_0x1787db(0x2d0)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1787db(0x285)+_0x1787db(0x1d1)+_0x1787db(0x2e3)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2ac61f[_0x1787db(0x1bd)]&&!_0x2ac61f[_0x1787db(0x1ea)]&&!_0x2ac61f['behavior']&&!_0x2ac61f[_0x1787db(0x2ec)])return console[_0x1787db(0x19c)](a22_0x43697b['red'](_0x1787db(0x254))),console[_0x1787db(0x19c)](_0x1787db(0x307)),console[_0x1787db(0x19c)](_0x1787db(0x280)),console[_0x1787db(0x19c)](_0x1787db(0x1d2)),console[_0x1787db(0x19c)](_0x1787db(0x2ac)),console[_0x1787db(0x19c)](_0x1787db(0x2b2)),console[_0x1787db(0x19c)](_0x1787db(0x2b3)),0x1;const _0xc2872b=resolveYamlFile(_0x353216);if(!existsSync(_0xc2872b))return showFileNotFoundError(_0xc2872b,_0x353216),0x1;_0x2ac61f[_0x1787db(0x270)]&&(console['error']('Site:\x20'+_0x2ac61f[_0x1787db(0x1f5)]),console[_0x1787db(0x19c)]('YAML\x20file:\x20'+_0xc2872b));let _0x472bd0;try{_0x472bd0=readFileSync(_0xc2872b,_0x1787db(0x256));}catch(_0x381f05){const _0x621083=_0x381f05 instanceof Error?_0x381f05[_0x1787db(0x186)]:String(_0x381f05);return console['error'](_0x1787db(0x213)+_0x621083),0x1;}let _0x52f6a5;try{_0x52f6a5=parseDef(_0x472bd0);}catch(_0x2a9bb9){const _0x5ea1be=_0x2a9bb9 instanceof Error?_0x2a9bb9[_0x1787db(0x186)]:String(_0x2a9bb9);return console[_0x1787db(0x19c)](a22_0x43697b[_0x1787db(0x2c5)](_0x1787db(0x1f4)+_0x5ea1be)),0x1;}if(_0x2ac61f[_0x1787db(0x1ea)]===!![]||_0x2ac61f[_0x1787db(0x1ea)]===''){const _0x414547=_0x52f6a5[_0x1787db(0x210)]?.[_0x1787db(0x20d)](_0x237965=>_0x237965[_0x1787db(0x300)])||[];if(_0x414547[_0x1787db(0x28a)]===0x0)console[_0x1787db(0x19c)](a22_0x43697b[_0x1787db(0x2c5)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x1787db(0x19c)](a22_0x43697b['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x1787db(0x1dd));for(const _0x478a6b of _0x414547){console[_0x1787db(0x19c)]('\x20\x20'+a22_0x43697b[_0x1787db(0x2b4)](_0x478a6b));}console[_0x1787db(0x19c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x353216+_0x1787db(0x233)+_0x414547[0x0]+'\x22');}return 0x1;}if(_0x2ac61f[_0x1787db(0x1fa)]===!![]||_0x2ac61f[_0x1787db(0x1fa)]===''){const _0x3290e4=_0x52f6a5[_0x1787db(0x2c3)]?.[_0x1787db(0x20d)](_0x53775c=>_0x53775c['name'])||[];if(_0x3290e4[_0x1787db(0x28a)]===0x0)console['error'](a22_0x43697b[_0x1787db(0x2c5)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x1787db(0x19c)](a22_0x43697b['red'](_0x1787db(0x1f9))),console[_0x1787db(0x19c)]('Available\x20behaviors:');for(const _0x2af782 of _0x3290e4){console[_0x1787db(0x19c)]('\x20\x20'+a22_0x43697b[_0x1787db(0x2b4)](_0x2af782));}console[_0x1787db(0x19c)](_0x1787db(0x29f)+_0x353216+_0x1787db(0x1a1)+_0x3290e4[0x0]+'\x22');}return 0x1;}const _0x26e55d=createCommandSpinner(a22_0x43697b[_0x1787db(0x2af)](_0x1787db(0x308)),{'verbose':_0x2ac61f[_0x1787db(0x270)]});_0x26e55d[_0x1787db(0x292)]();const _0x4eed73={'onProgress':_0x12560f=>{_0x26e55d['text']=formatProgressMessage(_0x12560f);}};if(_0x2ac61f[_0x1787db(0x1bd)])_0x4eed73['master']=!![];if(_0x2ac61f[_0x1787db(0x1ea)]&&typeof _0x2ac61f['attribute']==='string')_0x4eed73[_0x1787db(0x1ea)]=_0x2ac61f[_0x1787db(0x1ea)];if(_0x2ac61f[_0x1787db(0x1fa)]&&typeof _0x2ac61f[_0x1787db(0x1fa)]===_0x1787db(0x1a7))_0x4eed73[_0x1787db(0x1fa)]=_0x2ac61f['behavior'];if(_0x2ac61f[_0x1787db(0x2ec)])_0x4eed73[_0x1787db(0x2ec)]=!![];if(_0x2ac61f['interval'])_0x4eed73[_0x1787db(0x28c)]=_0x2ac61f[_0x1787db(0x28c)];let _0x1778c9;try{_0x1778c9=await _0x457dbd[_0x1787db(0x286)][_0x1787db(0x1ae)](_0x472bd0,_0x4eed73),_0x26e55d[_0x1787db(0x22e)]();}catch(_0x36e910){_0x26e55d[_0x1787db(0x22e)]();throw _0x36e910;}return await this[_0x1787db(0x22c)](_0x1778c9,{'master':_0x2ac61f[_0x1787db(0x1bd)],'attribute':typeof _0x2ac61f[_0x1787db(0x1ea)]==='string'?_0x2ac61f[_0x1787db(0x1ea)]:undefined,'behavior':typeof _0x2ac61f[_0x1787db(0x1fa)]===_0x1787db(0x1a7)?_0x2ac61f['behavior']:undefined,'enriched':_0x2ac61f[_0x1787db(0x2ec)]}),_0x1778c9['allValid']?0x0:0x1;}async[a22_0x8dcc7b(0x22c)](_0x1487db,_0x368a15){const _0x7a39c8=a22_0x8dcc7b;console[_0x7a39c8(0x19c)]('\x0a'+a22_0x43697b[_0x7a39c8(0x24a)]('Preview:')+'\x20'+_0x1487db[_0x7a39c8(0x300)]),console['error']('═'[_0x7a39c8(0x1de)](0x3c));if(_0x368a15['master']&&_0x1487db[_0x7a39c8(0x30a)]){const _0x123455=a22_0x43697b[_0x7a39c8(0x2af)](_0x7a39c8(0x24c))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x1487db[_0x7a39c8(0x1bd)][_0x7a39c8(0x302)]+'.'+_0x1487db[_0x7a39c8(0x1bd)][_0x7a39c8(0x298)]);await this[_0x7a39c8(0x289)](_0x123455,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x1ea)]&&_0x1487db['sampleData']){const _0x4baa36=a22_0x43697b[_0x7a39c8(0x2af)](_0x7a39c8(0x2d2))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x368a15[_0x7a39c8(0x1ea)]);await this[_0x7a39c8(0x289)](_0x4baa36,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x1fa)]&&_0x1487db[_0x7a39c8(0x30a)]){const _0x54fb2a=a22_0x43697b[_0x7a39c8(0x2af)]('Behavior:')+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x368a15[_0x7a39c8(0x1fa)]);await this['displaySampleData'](_0x54fb2a,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x2ec)]&&_0x1487db[_0x7a39c8(0x30a)]){const _0x30bcb6=a22_0x43697b['dim'](_0x7a39c8(0x211))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x7a39c8(0x1e0));await this[_0x7a39c8(0x289)](_0x30bcb6,_0x1487db[_0x7a39c8(0x30a)]);}else!_0x1487db[_0x7a39c8(0x30a)]&&console['error'](_0x7a39c8(0x237));}}}if(_0x1487db[_0x7a39c8(0x284)][_0x7a39c8(0x28a)]>0x0){console[_0x7a39c8(0x19c)]('─'[_0x7a39c8(0x1de)](0x3c)),console[_0x7a39c8(0x19c)]('\x0a'+a22_0x43697b[_0x7a39c8(0x2c5)](_0x7a39c8(0x187)));for(const _0x16ff6a of _0x1487db[_0x7a39c8(0x284)]){console['error']('\x20\x20'+a22_0x43697b[_0x7a39c8(0x2c5)]('•')+'\x20'+_0x16ff6a);}}}async['displaySampleData'](_0x5a4438,_0x2d693d){const _0x316e6d=a22_0x8dcc7b;if(_0x2d693d[_0x316e6d(0x28a)]===0x0){console[_0x316e6d(0x19c)]('\x0a'+_0x5a4438),console[_0x316e6d(0x19c)](_0x316e6d(0x1b1));return;}console['error']('\x0a'+_0x5a4438);const _0x464c95=Object['keys'](_0x2d693d[0x0])[_0x316e6d(0x20d)](_0x4c8fac=>({'name':_0x4c8fac,'type':typeof _0x2d693d[0x0][_0x4c8fac]===_0x316e6d(0x1c1)?_0x316e6d(0x1a9):_0x316e6d(0x199)})),_0x1cf992={'queryId':_0x316e6d(0x2dd),'columns':_0x464c95,'data':_0x2d693d,'stats':{'state':_0x316e6d(0x2fd),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2d693d[_0x316e6d(0x28a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x53498e=formatAsTable(_0x1cf992,_0x2d693d[_0x316e6d(0x28a)],!![]);await writeOutput(_0x53498e,undefined,_0x316e6d(0x298));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x1fd);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x265);async[a22_0x8dcc7b(0x20b)](_0x383f0f){const _0x398bcd=a22_0x8dcc7b,{options:_0x1e70f6,args:_0xb3067d,tdx:_0x494999}=_0x383f0f,_0xf8944=_0x1e70f6,_0x29bd95=_0xb3067d[0x0]||_0x1e70f6[_0x398bcd(0x2a2)];if(!_0x29bd95)return showParentSegmentNotSetError(_0x398bcd(0x271)+_0x398bcd(0x259)),0x1;const _0x481308=resolveYamlFile(_0x29bd95);if(existsSync(_0x481308)){_0xf8944[_0x398bcd(0x270)]&&console[_0x398bcd(0x19c)](_0x398bcd(0x27b)+_0x481308);let _0x801483;try{_0x801483=readFileSync(_0x481308,'utf-8');}catch(_0x4ce5bb){const _0x219e76=_0x4ce5bb instanceof Error?_0x4ce5bb[_0x398bcd(0x186)]:String(_0x4ce5bb);return console[_0x398bcd(0x19c)](_0x398bcd(0x213)+_0x219e76),0x1;}const _0x354ace=await withSpinner(_0x398bcd(0x23c),()=>_0x494999[_0x398bcd(0x286)]['pushParentYaml'](_0x801483),{'verbose':_0xf8944['verbose']}),_0xb83b2d=_0x354ace['data'],{isNew:_0x268ad9,name:_0xde9dfc,hasChanges:_0x57bd26,diffFormatted:_0x454b37}=_0xb83b2d;if(_0x57bd26){_0x268ad9?console[_0x398bcd(0x19c)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xde9dfc+'\x27:'):console['error'](_0x398bcd(0x2c2)+_0xde9dfc+'\x27:');console[_0x398bcd(0x19c)]('─'[_0x398bcd(0x1de)](0x3c)),console[_0x398bcd(0x19c)](_0x454b37),console[_0x398bcd(0x19c)]('─'[_0x398bcd(0x1de)](0x3c));const _0x2a080c=_0x268ad9?_0x398bcd(0x2da)+_0xde9dfc+_0x398bcd(0x19d):_0x398bcd(0x20f)+_0xde9dfc+_0x398bcd(0x19d);if(!_0xf8944['yes']){if(!isInteractive())return console['error'](a22_0x43697b['red'](_0x398bcd(0x260)),_0x398bcd(0x21e)),console[_0x398bcd(0x19c)](a22_0x43697b[_0x398bcd(0x2af)](_0x398bcd(0x261))),0x1;const _0x4b7bcd=await confirmKey(_0x2a080c);if(!_0x4b7bcd)return console[_0x398bcd(0x19c)](a22_0x43697b[_0x398bcd(0x250)](_0x398bcd(0x263))),0x1;}const _0x347d10=_0x268ad9?_0x398bcd(0x304):_0x398bcd(0x2ff);await withSpinner(_0x347d10+_0x398bcd(0x305)+_0xde9dfc+_0x398bcd(0x291),()=>_0xb83b2d['apply'](),{'verbose':_0xf8944[_0x398bcd(0x270)]});const _0x5e49a9=_0x268ad9?'Created':_0x398bcd(0x1cb);console[_0x398bcd(0x19c)]('✔\x20'+_0x5e49a9+_0x398bcd(0x305)+_0xde9dfc+'\x27');}else console[_0x398bcd(0x19c)](_0x398bcd(0x2a6)+_0xde9dfc+_0x398bcd(0x1e3));}const _0x19e745=await withSpinner(_0x398bcd(0x21a)+_0x29bd95+_0x398bcd(0x291),()=>_0x494999[_0x398bcd(0x286)]['runParent'](_0x29bd95),{'verbose':_0xf8944[_0x398bcd(0x270)]}),_0x13ae8c=_0x19e745[_0x398bcd(0x207)],_0x5bc409=getConsoleUrl(_0xf8944[_0x398bcd(0x1f5)],_0x398bcd(0x25f)+_0x13ae8c[_0x398bcd(0x2db)]+'/sessions/'+_0x13ae8c[_0x398bcd(0x2ab)]+'/attempt/'+_0x13ae8c[_0x398bcd(0x2a4)]);return console[_0x398bcd(0x19c)](_0x398bcd(0x1f6)),console[_0x398bcd(0x19c)]('\x20\x20'+a22_0x43697b['dim'](_0x398bcd(0x1d6))+'\x20'+_0x13ae8c['audienceId']),console[_0x398bcd(0x19c)]('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)]('Status:')+'\x20'+_0x13ae8c[_0x398bcd(0x2a1)]),console['error']('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)](_0x398bcd(0x2e2))+'\x20'+_0x13ae8c[_0x398bcd(0x2ab)]),console['error']('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)]('Attempt:')+'\x20'+_0x13ae8c['workflowAttemptId']),console[_0x398bcd(0x19c)]('\x20\x20'+_0x5bc409),console['error']('\x0a'+a22_0x43697b[_0x398bcd(0x2af)]('To\x20cancel:')+_0x398bcd(0x22f)+_0x13ae8c[_0x398bcd(0x2a4)]+'\x20kill'),0x0;}}function a22_0x4d07(_0x908de4,_0x3adb1f){_0x908de4=_0x908de4-0x185;const _0x40984b=a22_0x4098();let _0x4d0770=_0x40984b[_0x908de4];return _0x4d0770;}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x22d);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x26f);async[a22_0x8dcc7b(0x20b)](_0x2145fb){const _0x413cbd=a22_0x8dcc7b,{options:_0xd507b9,args:_0x2ed9df,tdx:_0x512298}=_0x2145fb,_0x9f57bd=_0x2ed9df[0x0]||_0xd507b9[_0x413cbd(0x2a2)];if(!_0x9f57bd)return showParentSegmentNotSetError(_0x413cbd(0x224)+'\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;_0xd507b9[_0x413cbd(0x270)]&&(console[_0x413cbd(0x19c)](_0x413cbd(0x24f)+_0xd507b9['site']),console[_0x413cbd(0x19c)](_0x413cbd(0x25a)+_0x9f57bd));const _0x29f211=await withSpinner(_0x413cbd(0x2d7)+_0x9f57bd+_0x413cbd(0x291),()=>_0x512298[_0x413cbd(0x286)][_0x413cbd(0x1b2)](_0x9f57bd),{'verbose':_0xd507b9['verbose']}),_0x46e2fc=_0x29f211[_0x413cbd(0x207)];console[_0x413cbd(0x19c)](_0x413cbd(0x2de)+_0x46e2fc[_0x413cbd(0x28a)]+_0x413cbd(0x282)+(_0x46e2fc[_0x413cbd(0x28a)]!==0x1?'s':''));if(_0xd507b9[_0x413cbd(0x2a0)]||_0xd507b9[_0x413cbd(0x2f7)])return await handleSDKOutput(_0x46e2fc,_0xd507b9),0x0;return displayFieldsHumanReadable(_0x46e2fc,_0x9f57bd),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2c7);['description']=a22_0x8dcc7b(0x1dc);async[a22_0x8dcc7b(0x20b)](_0x1286f4){const _0x515496=a22_0x8dcc7b,{options:_0x3d422c,args:_0x1115a8,tdx:_0x28ca81}=_0x1286f4,_0x5577a6=_0x3d422c,_0x4ae31b=_0x1115a8[0x0]||_0x3d422c[_0x515496(0x2a2)];if(!_0x4ae31b)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'+_0x515496(0x1fc)+_0x515496(0x21f)+_0x515496(0x27c)),0x1;_0x3d422c[_0x515496(0x270)]&&(console[_0x515496(0x19c)]('Site:\x20'+_0x3d422c[_0x515496(0x1f5)]),console[_0x515496(0x19c)]('Parent\x20segment:\x20'+_0x4ae31b));const _0x4ba14b=await withSpinner(_0x515496(0x2c9)+_0x4ae31b+_0x515496(0x291),()=>_0x28ca81[_0x515496(0x286)][_0x515496(0x1cd)](_0x4ae31b),{'verbose':_0x3d422c[_0x515496(0x270)]}),_0x49e0ab=_0x4ba14b['data'];if(_0x5577a6['web']){const _0x1887b4=getConsoleNextUrl(_0x5577a6['site'],'/app/dw/parentSegments/'+_0x49e0ab['id']);return console['error'](a22_0x43697b[_0x515496(0x1b3)]('✔')+_0x515496(0x2b6)+a22_0x43697b[_0x515496(0x2b4)](_0x1887b4)),openBrowser(_0x1887b4),0x0;}return await handleSingleObjectOutput(_0x49e0ab,_0x3d422c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]='segment:parent:desc';[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x209);async[a22_0x8dcc7b(0x20b)](_0x29e1a5){const _0x494a4e=a22_0x8dcc7b,{options:_0x43dcf1,args:_0x254a9a,tdx:_0x5bc75c}=_0x29e1a5,_0x253608=_0x43dcf1,_0x55a821=_0x254a9a[0x0]||_0x43dcf1[_0x494a4e(0x2a2)];if(!_0x55a821)return showParentSegmentNotSetError(_0x494a4e(0x1d4)+'\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'+_0x494a4e(0x21f)+_0x494a4e(0x2fc)),0x1;_0x43dcf1[_0x494a4e(0x270)]&&(console['error']('Site:\x20'+_0x43dcf1[_0x494a4e(0x1f5)]),console[_0x494a4e(0x19c)](_0x494a4e(0x25a)+_0x55a821));const _0x56eed5=await withSpinner(_0x494a4e(0x226)+_0x55a821+_0x494a4e(0x291),()=>_0x5bc75c['segment'][_0x494a4e(0x2f2)](_0x55a821),{'verbose':_0x43dcf1[_0x494a4e(0x270)]}),_0x25b77f=_0x56eed5['data'],_0x858838=_0x5bc75c['segment'][_0x494a4e(0x20e)](_0x25b77f);if(_0x253608[_0x494a4e(0x1db)]){const _0x49a00c=await this[_0x494a4e(0x18f)](_0x29e1a5,_0x55a821,_0x25b77f,_0x858838),_0x325a10=this[_0x494a4e(0x27a)](_0x49a00c);writeFileSync(_0x253608[_0x494a4e(0x1db)],_0x325a10);const _0x4fe541=_0x49a00c['customers']['columns'][_0x494a4e(0x28a)]+_0x49a00c[_0x494a4e(0x2c3)][_0x494a4e(0x1ce)]((_0x3bacf8,_0x1eb086)=>_0x3bacf8+_0x1eb086[_0x494a4e(0x195)][_0x494a4e(0x28a)],0x0),_0x176b8e=_0x49a00c[_0x494a4e(0x2c3)][_0x494a4e(0x241)](_0x56d1e6=>_0x56d1e6['columns'][_0x494a4e(0x28a)]===0x0)[_0x494a4e(0x28a)];return console['log'](_0x494a4e(0x279)+_0x253608[_0x494a4e(0x1db)]),console[_0x494a4e(0x2dc)](_0x494a4e(0x2e7)+_0x858838),console[_0x494a4e(0x2dc)](_0x494a4e(0x2cb)+_0x49a00c['behaviors'][_0x494a4e(0x28a)]+_0x494a4e(0x1da)),console[_0x494a4e(0x2dc)](_0x494a4e(0x1a4)+_0x4fe541+_0x494a4e(0x2d3)),_0x176b8e>0x0&&console['log'](_0x494a4e(0x2d4)+_0x176b8e+_0x494a4e(0x1ac)),0x0;}console[_0x494a4e(0x19c)]('\x0a'+a22_0x43697b['bold']('Output\x20Database:')+'\x20'+a22_0x43697b[_0x494a4e(0x2b4)](_0x858838));const _0x453bed=await withSpinner(_0x494a4e(0x1d7),()=>_0x5bc75c[_0x494a4e(0x286)][_0x494a4e(0x245)](_0x25b77f),{'verbose':_0x43dcf1[_0x494a4e(0x270)]});console['error']('\x0a'+a22_0x43697b[_0x494a4e(0x24a)](_0x494a4e(0x29d))+'\x20'+a22_0x43697b[_0x494a4e(0x2af)]('('+_0x858838+_0x494a4e(0x288)));const _0x151c7f=await executeSchemaQuery(_0x453bed[_0x494a4e(0x207)],_0x5bc75c,_0x43dcf1);await handleQueryOutput(_0x151c7f,_0x43dcf1);const _0x52cf85=await withSpinner(_0x494a4e(0x20a),()=>_0x5bc75c[_0x494a4e(0x286)][_0x494a4e(0x215)](_0x25b77f),{'verbose':_0x43dcf1[_0x494a4e(0x270)]});for(const _0x165ef4 of _0x52cf85[_0x494a4e(0x207)]){const _0x307eb7=_0x494a4e(0x1c7)+_0x165ef4[_0x494a4e(0x190)]()[_0x494a4e(0x2a7)](/\s+/g,'_'),_0x1efc3a='SELECT\x20*\x20FROM\x20'+_0x858838+'.'+_0x307eb7;console['error']('\x0a'+a22_0x43697b[_0x494a4e(0x24a)](_0x165ef4)+'\x20'+a22_0x43697b[_0x494a4e(0x2af)]('('+_0x858838+'.'+_0x307eb7+')'));try{const _0x302492=await executeSchemaQuery(_0x1efc3a,_0x5bc75c,_0x43dcf1);await handleQueryOutput(_0x302492,_0x43dcf1);}catch{console[_0x494a4e(0x19c)](a22_0x43697b[_0x494a4e(0x250)](_0x494a4e(0x2f1)));}}return 0x0;}async[a22_0x8dcc7b(0x18f)](_0x36eee0,_0x9a49ad,_0x36ad13,_0x5ea9f3){const _0x2903ea=a22_0x8dcc7b,{options:_0x472309,tdx:_0x2fe135}=_0x36eee0,_0x7d79b1=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2fe135[_0x2903ea(0x286)][_0x2903ea(0x245)](_0x36ad13),{'verbose':_0x472309[_0x2903ea(0x270)]}),_0x37f543=await executeSchemaQuery(_0x7d79b1['data'],_0x2fe135,_0x472309),_0x2a1c1d=_0x37f543[_0x2903ea(0x207)][_0x2903ea(0x20d)](_0x51c30e=>({'name':_0x51c30e[_0x2903ea(0x296)],'type':_0x51c30e[_0x2903ea(0x1ad)]})),_0x4ac6c2=await withSpinner(_0x2903ea(0x20a),()=>_0x2fe135[_0x2903ea(0x286)]['getBehaviorNames'](_0x36ad13),{'verbose':_0x472309[_0x2903ea(0x270)]}),_0x3f2aa9=[];for(const _0x1aa9d2 of _0x4ac6c2[_0x2903ea(0x207)]){const _0x5697ea=_0x2903ea(0x1c7)+_0x1aa9d2['toLowerCase']()['replace'](/\s+/g,'_'),_0x3d41a0=_0x2903ea(0x264)+_0x5ea9f3+'.'+_0x5697ea;let _0x338c80=[];try{const _0x521cf0=await executeSchemaQuery(_0x3d41a0,_0x2fe135,_0x472309);_0x338c80=_0x521cf0['data'][_0x2903ea(0x20d)](_0x3988d5=>({'name':_0x3988d5[_0x2903ea(0x296)],'type':_0x3988d5[_0x2903ea(0x1ad)]}));}catch{}_0x3f2aa9[_0x2903ea(0x266)]({'table':_0x5697ea,'columns':_0x338c80});}return{'database':_0x5ea9f3,'parent_segment':_0x9a49ad,'parent_id':_0x36ad13,'customers':{'table':_0x2903ea(0x29d),'columns':_0x2a1c1d},'behaviors':_0x3f2aa9};}['formatSchemaJson'](_0x1ee494){const _0x52a350=a22_0x8dcc7b,_0x337694=_0x254e93=>{const _0x112167=a22_0x4d07;if(_0x254e93[_0x112167(0x28a)]===0x0)return'[]';const _0x1c9eea=_0x254e93['map'](_0x590590=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x590590['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x590590[_0x112167(0x1d5)]+'\x22\x20}');return'[\x0a'+_0x1c9eea[_0x112167(0x1c6)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x4473df=_0x1ee494[_0x52a350(0x2c3)][_0x52a350(0x20d)](_0x318be0=>{const _0x2ffb72=_0x52a350;return _0x2ffb72(0x1d9)+_0x318be0['table']+_0x2ffb72(0x223)+_0x337694(_0x318be0[_0x2ffb72(0x195)])[_0x2ffb72(0x2a7)](/^/gm,'\x20\x20')[_0x2ffb72(0x2fb)]()+_0x2ffb72(0x2ea);})[_0x52a350(0x1c6)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x1ee494['database']+_0x52a350(0x1c5)+_0x1ee494[_0x52a350(0x2cd)]+_0x52a350(0x2e8)+_0x1ee494[_0x52a350(0x1ff)]+_0x52a350(0x276)+_0x1ee494[_0x52a350(0x29d)]['table']+_0x52a350(0x194)+_0x337694(_0x1ee494[_0x52a350(0x29d)][_0x52a350(0x195)])['replace'](/^/gm,'\x20\x20')['trim']()+_0x52a350(0x2f0)+_0x4473df+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x18e);[a22_0x8dcc7b(0x267)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x4878f8){const _0x3b1252=a22_0x8dcc7b,{options:_0x989c6b,args:_0x1f5df2,tdx:_0x414f59}=_0x4878f8,_0x1370d5=_0x1f5df2[0x0]||_0x989c6b[_0x3b1252(0x2a2)];if(!_0x1370d5)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'+_0x3b1252(0x290)),0x1;_0x989c6b['verbose']&&(console[_0x3b1252(0x19c)](_0x3b1252(0x24f)+_0x989c6b['site']),console[_0x3b1252(0x19c)](_0x3b1252(0x25a)+_0x1370d5));const _0x24ac8f=await withSpinner(_0x3b1252(0x226)+_0x1370d5+_0x3b1252(0x291),()=>_0x414f59[_0x3b1252(0x286)]['resolveParentId'](_0x1370d5),{'verbose':_0x989c6b[_0x3b1252(0x270)]}),_0x59af27=_0x24ac8f[_0x3b1252(0x207)],_0x3ea1ef=await withSpinner(_0x3b1252(0x2c0)+_0x1370d5+_0x3b1252(0x291),()=>_0x414f59[_0x3b1252(0x286)][_0x3b1252(0x245)](_0x59af27),{'verbose':_0x989c6b[_0x3b1252(0x270)]}),_0x29d28d=_0x3ea1ef[_0x3b1252(0x207)];return _0x989c6b[_0x3b1252(0x222)]==='json'||_0x989c6b[_0x3b1252(0x222)]==='jsonl'?await handleSDKOutput([{'sql':_0x29d28d}],_0x989c6b):console[_0x3b1252(0x2dc)](_0x29d28d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x273);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x242);async[a22_0x8dcc7b(0x20b)](_0x176f5b){const _0x3ca176=a22_0x8dcc7b,{options:_0x227141,args:_0x54ff51,tdx:_0x17106b}=_0x176f5b,_0x533275=_0x54ff51[0x0]||_0x227141[_0x3ca176(0x2a2)];if(!_0x533275)return showParentSegmentNotSetError(_0x3ca176(0x2e0)+_0x3ca176(0x18a)),0x1;_0x227141[_0x3ca176(0x270)]&&(console[_0x3ca176(0x19c)]('Site:\x20'+_0x227141[_0x3ca176(0x1f5)]),console[_0x3ca176(0x19c)](_0x3ca176(0x25a)+_0x533275));const _0x26eb19=await withSpinner(_0x3ca176(0x226)+_0x533275+_0x3ca176(0x291),()=>_0x17106b[_0x3ca176(0x286)][_0x3ca176(0x2f2)](_0x533275),{'verbose':_0x227141['verbose']}),_0x561faf=_0x26eb19[_0x3ca176(0x207)],_0x2ae35b=await withSpinner(_0x3ca176(0x2c0)+_0x533275+_0x3ca176(0x291),()=>_0x17106b[_0x3ca176(0x286)][_0x3ca176(0x245)](_0x561faf),{'verbose':_0x227141[_0x3ca176(0x270)]});let _0x2a95fe=_0x2ae35b[_0x3ca176(0x207)];const _0x58184f=resolveLimit(_0x227141[_0x3ca176(0x28b)],DEFAULT_DISPLAY_LIMIT),_0x3af372=/\bLIMIT\s+\d+/i[_0x3ca176(0x246)](_0x2a95fe);!_0x3af372&&(_0x2a95fe=_0x2a95fe['trim']()['replace'](/;+$/,''),_0x2a95fe=_0x3ca176(0x1f1)+_0x2a95fe+_0x3ca176(0x189)+_0x58184f);_0x227141[_0x3ca176(0x270)]&&console[_0x3ca176(0x19c)]('SQL\x20query:\x0a'+_0x2a95fe);const _0x68ca12=await withProgressSpinner(_0x3ca176(0x21b),async _0x42fd97=>{const _0x40961c=_0x3ca176,_0x431724=await _0x17106b[_0x40961c(0x28f)][_0x40961c(0x20b)](_0x2a95fe,{'catalog':'td','schema':'information_schema','onJobId':_0x316e81=>{const _0x4e02b1=_0x40961c;_0x42fd97[_0x4e02b1(0x2eb)](_0x316e81);}});return _0x431724;},{'verbose':_0x227141[_0x3ca176(0x270)]}),_0xc17604=_0x68ca12[_0x3ca176(0x207)],_0x1e7f4e=_0xc17604[_0x3ca176(0x25d)]?_0x3ca176(0x2ce)+_0xc17604[_0x3ca176(0x25d)]+']':'';return console['error'](_0x3ca176(0x1c0)+_0xc17604[_0x3ca176(0x2b7)][_0x3ca176(0x1b6)][_0x3ca176(0x1e4)]()+_0x3ca176(0x1d3)+(_0x3ca176(0x2f4)+formatElapsed(_0xc17604[_0x3ca176(0x2b7)][_0x3ca176(0x234)])+_0x1e7f4e)),await handleQueryOutput(_0xc17604,_0x227141),0x0;}}export class PSRtListCommand extends BaseCommand{['name']='ps:rt:list';[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x2ef);async[a22_0x8dcc7b(0x20b)](_0x1a9308){const _0x1ac6da=a22_0x8dcc7b,{options:_0x22da4f,args:_0x51a412,tdx:_0x55b303}=_0x1a9308,_0x5249fd=_0x51a412[0x0],_0x703e1e=await withSpinner(_0x5249fd?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x5249fd+'\x27...':_0x1ac6da(0x2b9),()=>_0x55b303[_0x1ac6da(0x1b4)][_0x1ac6da(0x2be)](),{'verbose':_0x22da4f[_0x1ac6da(0x270)]});let _0x1af3db=_0x703e1e[_0x1ac6da(0x207)][_0x1ac6da(0x241)](_0x37dafc=>_0x37dafc[_0x1ac6da(0x2d6)]);if(_0x5249fd){const _0x4e6ed4=_0x5249fd[_0x1ac6da(0x2a7)](/[.+^${}()|[\]\\]/g,_0x1ac6da(0x221))['replace'](/\*/g,'.*')[_0x1ac6da(0x2a7)](/\?/g,'.'),_0x3a14b2=new RegExp('^'+_0x4e6ed4+'$','i');_0x1af3db=_0x1af3db[_0x1ac6da(0x241)](_0x25b44f=>_0x3a14b2[_0x1ac6da(0x246)](_0x25b44f[_0x1ac6da(0x300)]));}_0x1af3db[_0x1ac6da(0x228)]((_0x4b63e5,_0x8df185)=>_0x4b63e5[_0x1ac6da(0x300)]['localeCompare'](_0x8df185['name'])),console[_0x1ac6da(0x19c)](_0x1ac6da(0x2de)+_0x1af3db[_0x1ac6da(0x28a)]+'\x20RT-enabled\x20parent\x20segment'+(_0x1af3db[_0x1ac6da(0x28a)]!==0x1?'s':''));const _0x3b9548=_0x4e18f0=>{const _0x33bdc6=_0x1ac6da;return getConsoleNextUrl(_0x22da4f[_0x33bdc6(0x1f5)],'/app/dw/parentSegments/'+_0x4e18f0);};if(_0x22da4f[_0x1ac6da(0x222)]===_0x1ac6da(0x2a0)||_0x22da4f[_0x1ac6da(0x222)]==='jsonl'){const _0x1c9a40=_0x1af3db['map'](_0x25a036=>({..._0x25a036,'url':_0x3b9548(_0x25a036['id'])}));await handleSDKOutput(_0x1c9a40,_0x22da4f);}else{if(_0x1af3db[_0x1ac6da(0x28a)]===0x0)console[_0x1ac6da(0x2dc)](_0x1ac6da(0x2a8));else for(const _0x57d609 of _0x1af3db){const _0x181c2a=_0x57d609['population']?a22_0x43697b['dim']('\x20('+formatRows(_0x57d609['population'])+')'):'',_0x5dbd5e=hyperlink(_0x57d609[_0x1ac6da(0x300)],_0x3b9548(_0x57d609['id']));console[_0x1ac6da(0x2dc)]('⚡\x20'+_0x5dbd5e+_0x181c2a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x28d);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x19a);async[a22_0x8dcc7b(0x20b)](_0x54d00a){const _0x54c02c=a22_0x8dcc7b,{options:_0x4176c1,args:_0x4faac3,tdx:_0x5da382}=_0x54d00a,_0x281dc8=_0x4faac3[0x0]||_0x4176c1[_0x54c02c(0x2a2)];if(!_0x281dc8)return showParentSegmentNotSetError('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'+_0x54c02c(0x2c1)),0x1;const _0x1904a0=resolveYamlFile(_0x281dc8);if(!existsSync(_0x1904a0))return showFileNotFoundError(_0x1904a0,_0x281dc8),0x1;let _0x13a7cf;try{_0x13a7cf=readFileSync(_0x1904a0,_0x54c02c(0x256));}catch(_0x4e5338){const _0x4af227=_0x4e5338 instanceof Error?_0x4e5338[_0x54c02c(0x186)]:String(_0x4e5338);return console[_0x54c02c(0x19c)](_0x54c02c(0x213)+_0x4af227),0x1;}const _0x481713=createCommandSpinner(a22_0x43697b[_0x54c02c(0x2af)]('Validating\x20RT\x20configuration...'),{'verbose':_0x4176c1[_0x54c02c(0x270)]});_0x481713['start']();const _0x1251a1={'realtime':!![],'onProgress':_0x22effa=>{const _0x37edc5=_0x54c02c;_0x481713[_0x37edc5(0x2d9)]=formatProgressMessage(_0x22effa);}};let _0x3611dd;try{_0x3611dd=await _0x5da382['segment'][_0x54c02c(0x26d)](_0x13a7cf,_0x1251a1),_0x481713[_0x54c02c(0x22e)]();}catch(_0x2b0885){_0x481713[_0x54c02c(0x22e)]();throw _0x2b0885;}console[_0x54c02c(0x19c)]('\x0a'+a22_0x43697b[_0x54c02c(0x24a)]('RT\x202.0\x20Validate:')+'\x20'+_0x3611dd[_0x54c02c(0x300)]),console['error']('═'[_0x54c02c(0x1de)](0x3c)),displayRealtimeValidation(_0x3611dd),console[_0x54c02c(0x19c)]('─'[_0x54c02c(0x1de)](0x3c));if(_0x3611dd['errors']['length']>0x0){console['error']('\x0a'+a22_0x43697b[_0x54c02c(0x2c5)](_0x54c02c(0x187)));for(const _0x22443d of _0x3611dd[_0x54c02c(0x284)]){console[_0x54c02c(0x19c)]('\x20\x20'+a22_0x43697b[_0x54c02c(0x2c5)]('•')+'\x20'+_0x22443d);}}return _0x3611dd[_0x54c02c(0x1bb)]&&console['error']('\x0a'+a22_0x43697b[_0x54c02c(0x1b3)]('✔')+_0x54c02c(0x30c)),_0x3611dd['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x275);['description']=a22_0x8dcc7b(0x29b);async[a22_0x8dcc7b(0x20b)](_0x2fadf4){const _0x45108e=a22_0x8dcc7b,{options:_0x544d66,args:_0x22972e,tdx:_0x2f919a}=_0x2fadf4,_0x3a5221=_0x22972e[0x0]||_0x544d66['parentSegment'];if(!_0x3a5221)return showParentSegmentNotSetError(_0x45108e(0x2d1)+_0x45108e(0x1a0)),0x1;const _0x1dffc2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3a5221+_0x45108e(0x291),()=>_0x2f919a[_0x45108e(0x286)][_0x45108e(0x2f2)](_0x3a5221),{'verbose':_0x544d66[_0x45108e(0x270)]}),_0x15ff8f=_0x1dffc2[_0x45108e(0x207)],_0x2af5eb=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3a5221+_0x45108e(0x291),()=>_0x2f919a[_0x45108e(0x196)]['list'](_0x15ff8f),{'verbose':_0x544d66[_0x45108e(0x270)]}),_0x475643=_0x2af5eb[_0x45108e(0x207)];console['error'](_0x45108e(0x2de)+_0x475643[_0x45108e(0x28a)]+_0x45108e(0x19f)+(_0x475643['length']!==0x1?'s':''));if(_0x544d66[_0x45108e(0x222)]===_0x45108e(0x2a0)||_0x544d66['format']===_0x45108e(0x2f7))await handleSDKOutput(_0x475643,_0x544d66);else{if(_0x475643[_0x45108e(0x28a)]===0x0)console[_0x45108e(0x2dc)]('No\x20personalization\x20services\x20configured'),console['error'](a22_0x43697b['cyan']('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x2a96b5 of _0x475643){const _0x527eb3=_0x2a96b5['sections']?.[_0x45108e(0x28a)]||0x0,_0x4dd2a1=_0x2a96b5[_0x45108e(0x29a)]?a22_0x43697b[_0x45108e(0x2af)](_0x45108e(0x1c4)+_0x2a96b5[_0x45108e(0x29a)]):'',_0x30d883=a22_0x43697b[_0x45108e(0x2af)]('\x20('+_0x527eb3+_0x45108e(0x23b)+(_0x527eb3!==0x1?'s':'')+')');console[_0x45108e(0x2dc)]('\x20\x20'+_0x2a96b5[_0x45108e(0x300)]+_0x4dd2a1+_0x30d883),_0x2a96b5['description']&&console[_0x45108e(0x2dc)](_0x45108e(0x1b7)+a22_0x43697b[_0x45108e(0x2af)](_0x2a96b5[_0x45108e(0x267)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2df);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x23a);async[a22_0x8dcc7b(0x20b)](_0x49733c){const _0x30037e=a22_0x8dcc7b,{options:_0xf894b,args:_0x5d873e}=_0x49733c,_0x580a1e=_0x5d873e[0x0]||_0xf894b[_0x30037e(0x2a2)];if(!_0x580a1e)return showParentSegmentNotSetError(_0x30037e(0x19b)+_0x30037e(0x219)),0x1;const _0x1867ac=resolveYamlFile(_0x580a1e);if(!existsSync(_0x1867ac))return showFileNotFoundError(_0x1867ac,_0x580a1e),0x1;let _0x276458;try{_0x276458=readFileSync(_0x1867ac,_0x30037e(0x256));}catch(_0x5d7436){const _0x3a7683=_0x5d7436 instanceof Error?_0x5d7436[_0x30037e(0x186)]:String(_0x5d7436);return console['error'](_0x30037e(0x213)+_0x3a7683),0x1;}let _0x178d5a;try{_0x178d5a=parseDef(_0x276458);}catch(_0x4fb165){const _0xb332a=_0x4fb165 instanceof Error?_0x4fb165[_0x30037e(0x186)]:String(_0x4fb165);return console[_0x30037e(0x19c)](a22_0x43697b[_0x30037e(0x2c5)](_0x30037e(0x1f4)+_0xb332a)),0x1;}if(_0x178d5a[_0x30037e(0x231)]&&_0x178d5a[_0x30037e(0x231)][_0x30037e(0x28a)]>0x0)return console['error'](a22_0x43697b[_0x30037e(0x250)](_0x30037e(0x217)+_0x1867ac)),console['error'](a22_0x43697b['dim']('\x20\x20\x20'+_0x178d5a[_0x30037e(0x231)][_0x30037e(0x28a)]+_0x30037e(0x2fa))),0x1;!_0x178d5a['realtime']&&(_0x178d5a[_0x30037e(0x1b4)]={'events':[{'name':'page_view','source_table':_0x30037e(0x2e5)}],'attributes':[{'name':'last_page_viewed','type':_0x30037e(0x192)}],'id_stitching':{'primary_key':_0x178d5a[_0x30037e(0x1bd)][_0x30037e(0x298)]===_0x30037e(0x29d)?_0x30037e(0x19e):_0x30037e(0x23e)}});_0x178d5a['personalization_services']=[{'name':_0x30037e(0x2ca),'description':_0x30037e(0x27d),'trigger_event':'page_view','sections':[{'name':_0x30037e(0x1a3),'criteria':_0x30037e(0x26b),'attributes':[_0x30037e(0x30b)]}]}];const _0x484314=serializeDef(_0x178d5a);return writeFileSync(_0x1867ac,_0x484314,_0x30037e(0x256)),console[_0x30037e(0x19c)](a22_0x43697b[_0x30037e(0x1b3)]('✔')+_0x30037e(0x2ba)+a22_0x43697b['cyan'](_0x1867ac)),(!_0x178d5a[_0x30037e(0x1b4)]||_0x276458[_0x30037e(0x2e9)](_0x30037e(0x1e8))===-0x1)&&console[_0x30037e(0x19c)](a22_0x43697b['green']('✔')+_0x30037e(0x205)),console[_0x30037e(0x19c)]('\x0a'+a22_0x43697b['dim']('Next\x20steps:')),console[_0x30037e(0x19c)]('\x20\x201.\x20Edit\x20'+_0x1867ac+'\x20to\x20configure\x20your\x20personalization\x20service'),console['error'](_0x30037e(0x1ca)+a22_0x43697b[_0x30037e(0x2af)]('tdx\x20ps\x20push\x20'+_0x580a1e)+_0x30037e(0x258)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x14c52f=a23_0x2323;(function(_0x370012,_0xf90d6f){const _0xf8de27=a23_0x2323,_0x130f15=_0x370012();while(!![]){try{const _0x4af7dd=parseInt(_0xf8de27(0xf5))/0x1+parseInt(_0xf8de27(0x111))/0x2*(parseInt(_0xf8de27(0x10d))/0x3)+-parseInt(_0xf8de27(0xf0))/0x4*(parseInt(_0xf8de27(0xd7))/0x5)+parseInt(_0xf8de27(0xcf))/0x6+parseInt(_0xf8de27(0xe0))/0x7*(-parseInt(_0xf8de27(0x121))/0x8)+-parseInt(_0xf8de27(0x129))/0x9+-parseInt(_0xf8de27(0x10c))/0xa;if(_0x4af7dd===_0xf90d6f)break;else _0x130f15['push'](_0x130f15['shift']());}catch(_0x45b86b){_0x130f15['push'](_0x130f15['shift']());}}}(a23_0x1570,0x7e17b));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 a23_0x5dfc70 from'node:path';function a23_0x2323(_0x5f1136,_0x4f3269){_0x5f1136=_0x5f1136-0xcb;const _0x1570d2=a23_0x1570();let _0x2323f7=_0x1570d2[_0x5f1136];return _0x2323f7;}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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a23_0x1570(){const _0x785221=['profile:set','4146390CgtRLQ','profile:use','\x27\x20updated:\x20','\x27\x20created','\x20\x20-\x20','Removal\x20cancelled','Profile\x20\x27','Unknown\x20key\x20\x27','Validating\x20API\x20key...','test','(cleared)','us01','Remove\x20a\x20profile','\x20--default\x27\x20to\x20save\x20permanently','config','ERROR','description','Set\x20a\x20profile\x20configuration\x20value','jobs','customSite','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','validate','2421258VncmVa','Default\x20profile\x20set\x20to:\x20','Changing\x20site\x20to\x20\x27','text','profile','session','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20\x20(no\x20profiles\x20found)','24120QuztKO','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','VALID_KEYS','select','includes','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>','length','yellow','bold','7AEPTGX','(session:\x20','Enter\x20site\x20name:','tdx:\x20profile\x20create','profile:create','password','default','log','\x27.\x0a\x0aValid\x20keys:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','trim','create','green','confirm','\x20Profile\x20\x27','Enter\x20profile\x20name:','172SybVqv','profileName','site','tdx:\x20profile\x20set','other','959362RMdRWX','split','\x0aSetup\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20API\x20key\x20removed\x20from\x20system\x20keychain','error','Enter\x20description\x20(optional):','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x27\x20removed\x20from\x20configuration','warn','profile:remove','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx.json','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSaved\x20to:\x20','red','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Session\x20profile\x20set\x20to:\x20','Site\x20was\x20not\x20changed.','message','dim','\x0aAvailable\x20profiles:','9585380RLQoqK','1338057YaapbF','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','email','4hyCURZ','\x27\x20requires\x20API\x20key\x20validation.','join','Enter\x20your\x20TD\x20API\x20key:','Failed\x20to\x20remove\x20profile:\x20','/app/mp/ak','execute','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20tdx\x20--profile\x20','name','Create\x20a\x20new\x20profile','tdx:\x20profile\x20remove','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','apiKey','\x0aOperation\x20cancelled','getUserInfo','894304GHRXWf','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Operation\x20cancelled','✗\x20Validation\x20failed:\x20','Site\x20name\x20cannot\x20be\x20empty','API\x20key\x20cannot\x20be\x20empty'];a23_0x1570=function(){return _0x785221;};return a23_0x1570();}import{LogLevel}from'../utils/tdx-logger.js';import a23_0x5b1bbf from'prompts';import a23_0x579cc4 from'chalk';function validateProfileName(_0x3cd5ba){const _0x251228=a23_0x2323;if(!_0x3cd5ba||!_0x3cd5ba['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x2d1770=_0x3cd5ba[_0x251228(0xea)]();if(!/^[a-zA-Z0-9_-]+$/[_0x251228(0x132)](_0x2d1770))return _0x251228(0xd5);if(profileExists(_0x2d1770))return _0x251228(0x12f)+_0x2d1770+_0x251228(0xd8);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x14c52f(0x11a)]=a23_0x14c52f(0xe4);['description']=a23_0x14c52f(0x11b);async[a23_0x14c52f(0x117)](_0x36f537){const _0x1d78d8=a23_0x14c52f,{options:_0x1e2a1d,args:_0x4a5c3a}=_0x36f537;console['log'](a23_0x579cc4[_0x1d78d8(0xdf)](_0x1d78d8(0xe3)));let _0x167275;if(_0x4a5c3a[_0x1d78d8(0xdd)]>0x0&&_0x4a5c3a[0x0]){const _0x383799=_0x4a5c3a[0x0][_0x1d78d8(0xea)](),_0x312666=validateProfileName(_0x383799);if(_0x312666!==!![])return console[_0x1d78d8(0xfa)](a23_0x579cc4['red'](_0x312666)),0x1;_0x167275=_0x383799;}else{const _0x130171=await a23_0x5b1bbf({'type':'text','name':_0x1d78d8(0xf1),'message':_0x1d78d8(0xef),'validate':validateProfileName});if(!_0x130171[_0x1d78d8(0xf1)])return console[_0x1d78d8(0xe7)](_0x1d78d8(0xf7)),0x1;_0x167275=_0x130171[_0x1d78d8(0xf1)][_0x1d78d8(0xea)]();}const _0x6f4c45=await a23_0x5b1bbf({'type':_0x1d78d8(0xd2),'name':'description','message':_0x1d78d8(0xfb)}),_0x2b811f=_0x6f4c45[_0x1d78d8(0x139)]?.['trim']()||undefined,_0x1ca536=_0x1e2a1d['site']||_0x1d78d8(0x134),{choices:_0x2be247,initialIndex:_0x386d60}=buildSiteChoices(_0x1ca536),_0x4e5083=await a23_0x5b1bbf({'type':_0x1d78d8(0xda),'name':_0x1d78d8(0xf2),'message':_0x1d78d8(0xfc)+_0x167275+'\x27:','choices':_0x2be247,'initial':_0x386d60});if(!_0x4e5083[_0x1d78d8(0xf2)])return console[_0x1d78d8(0xe7)](_0x1d78d8(0xf7)),0x1;let _0x522eae;if(_0x4e5083[_0x1d78d8(0xf2)]===_0x1d78d8(0xf4)){const _0x2f52d1=await a23_0x5b1bbf({'type':_0x1d78d8(0xd2),'name':_0x1d78d8(0x13c),'message':_0x1d78d8(0xe2),'initial':'us01','validate':_0x7bb226=>{const _0x28d84f=_0x1d78d8;if(!_0x7bb226||!_0x7bb226['trim']())return _0x28d84f(0x126);if(!/^[a-z0-9-]+$/[_0x28d84f(0x132)](_0x7bb226[_0x28d84f(0xea)]()))return _0x28d84f(0x106);return!![];}});if(!_0x2f52d1['customSite'])return console[_0x1d78d8(0xe7)](_0x1d78d8(0xf7)),0x1;_0x522eae=_0x2f52d1['customSite'];}else _0x522eae=_0x4e5083[_0x1d78d8(0xf2)];const _0x385cd1=resolveSite(_0x522eae);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x385cd1),console[_0x1d78d8(0xe7)](_0x1d78d8(0x100)),console[_0x1d78d8(0xe7)]('\x20\x20'+getConsoleUrl(_0x385cd1,_0x1d78d8(0x116)));const _0xeb5bdd=await a23_0x5b1bbf({'type':_0x1d78d8(0xe5),'name':_0x1d78d8(0x11e),'message':_0x1d78d8(0x114),'validate':_0x12c52c=>{if(!_0x12c52c||!_0x12c52c['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xeb5bdd[_0x1d78d8(0x11e)])return console['log'](_0x1d78d8(0xf7)),0x1;const _0x445e11=_0xeb5bdd[_0x1d78d8(0x11e)];console[_0x1d78d8(0xe7)](_0x1d78d8(0x131));try{const _0x5e2dda=TDX['create']({'site':_0x385cd1,'apiKey':_0x445e11[_0x1d78d8(0xea)](),'logLevel':_0x1e2a1d['logLevel']??LogLevel[_0x1d78d8(0x138)]}),_0x386152=await _0x5e2dda[_0x1d78d8(0x13b)][_0x1d78d8(0x120)]();console[_0x1d78d8(0xe7)](a23_0x579cc4['green']('✓')+_0x1d78d8(0xe9)+_0x386152[_0x1d78d8(0x110)]+')');const _0x2d4022=await isKeychainAvailable();_0x2d4022?(await saveAPIKeyAsync(_0x445e11[_0x1d78d8(0xea)](),_0x385cd1,_0x167275),console[_0x1d78d8(0xe7)](a23_0x579cc4[_0x1d78d8(0xec)]('✓')+_0x1d78d8(0x105)+_0x167275+')')):(console[_0x1d78d8(0xfe)](a23_0x579cc4[_0x1d78d8(0xde)](_0x1d78d8(0xcb))),console['warn'](a23_0x579cc4[_0x1d78d8(0xde)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x75706e={'site':_0x385cd1,..._0x2b811f&&{'description':_0x2b811f}};return saveProfileToUserConfig(_0x167275,_0x75706e),console[_0x1d78d8(0xe7)](a23_0x579cc4['green']('✓')+_0x1d78d8(0xee)+_0x167275+_0x1d78d8(0x12c)),console[_0x1d78d8(0xe7)](),console[_0x1d78d8(0xe7)](_0x1d78d8(0xcc)),console['log'](_0x1d78d8(0x119)+_0x167275+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x1d78d8(0xe7)](_0x1d78d8(0x119)+_0x167275+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x59f69f){if(_0x59f69f instanceof HTTPClientError&&_0x59f69f[_0x1d78d8(0x10e)]===0x191)return printAuthError(_0x59f69f),0x1;return console[_0x1d78d8(0xfa)](a23_0x579cc4['red']('✗\x20Validation\x20failed:\x20'+(_0x59f69f instanceof Error?_0x59f69f[_0x1d78d8(0x109)]:String(_0x59f69f)))),console[_0x1d78d8(0xfa)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x14c52f(0x11a)]=a23_0x14c52f(0xff);[a23_0x14c52f(0x139)]=a23_0x14c52f(0x135);[a23_0x14c52f(0xce)](_0x2b17f5){const _0x1710d3=a23_0x14c52f,{args:_0x540f05}=_0x2b17f5;if(_0x540f05['length']===0x0)return _0x1710d3(0x123);return undefined;}async[a23_0x14c52f(0x117)](_0x23d4d8){const _0x441864=a23_0x14c52f,{args:_0x2684f3}=_0x23d4d8,_0x5ba6b5=_0x2684f3[0x0];console[_0x441864(0xe7)](a23_0x579cc4[_0x441864(0xdf)](_0x441864(0x11c)));if(!profileExists(_0x5ba6b5)){console[_0x441864(0xfa)](a23_0x579cc4[_0x441864(0x104)](_0x441864(0x12f)+_0x5ba6b5+'\x27\x20does\x20not\x20exist.')),console[_0x441864(0xe7)](_0x441864(0x10b));const _0x2e70ef=listProfiles();if(_0x2e70ef[_0x441864(0xdd)]===0x0)console[_0x441864(0xe7)](_0x441864(0xd6));else for(const _0xc01a36 of _0x2e70ef){console[_0x441864(0xe7)](_0x441864(0x12d)+_0xc01a36[_0x441864(0x11a)]);}return 0x1;}const _0x7288e2=await a23_0x5b1bbf({'type':'confirm','name':_0x441864(0xed),'message':_0x441864(0xf8)+_0x5ba6b5+'\x27?','initial':![]});if(!_0x7288e2['confirm'])return console[_0x441864(0xe7)](_0x441864(0x12e)),0x0;try{removeProfileFromUserConfig(_0x5ba6b5),console[_0x441864(0xe7)](a23_0x579cc4[_0x441864(0xec)]('✓')+_0x441864(0xee)+_0x5ba6b5+_0x441864(0xfd));}catch(_0xcbe24){return console[_0x441864(0xfa)](a23_0x579cc4[_0x441864(0x104)](_0x441864(0x115)+(_0xcbe24 instanceof Error?_0xcbe24['message']:String(_0xcbe24)))),0x1;}const _0x52a569=await isKeychainAvailable();if(_0x52a569){const _0x1b618d=await deleteKeychainAPIKey(_0x5ba6b5);_0x1b618d&&console[_0x441864(0xe7)](a23_0x579cc4[_0x441864(0xec)]('✓')+_0x441864(0xf9));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x14c52f(0x11a)]=a23_0x14c52f(0x128);[a23_0x14c52f(0x139)]=a23_0x14c52f(0x13a);static ['VALID_KEYS']=['site','database','parent_segment','llm_project','llm_agent',a23_0x14c52f(0x139)];['validate'](_0x38a9ad){const _0x4b2656=a23_0x14c52f,{args:_0x571677,options:_0x31f100}=_0x38a9ad,_0x29fa73=_0x31f100[_0x4b2656(0xd3)]||getActiveProfile();if(!_0x29fa73)return _0x4b2656(0xdc);if(_0x571677[_0x4b2656(0xdd)]===0x0)return _0x4b2656(0xcd)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0xccc6d8=_0x571677[0x0];if(!_0xccc6d8[_0x4b2656(0xdb)]('='))return _0x4b2656(0x11d)+ProfileSetCommand[_0x4b2656(0xd9)][_0x4b2656(0x113)](',\x20');const [_0x55840c]=_0xccc6d8[_0x4b2656(0xf6)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x55840c))return _0x4b2656(0x130)+_0x55840c+_0x4b2656(0xe8)+ProfileSetCommand[_0x4b2656(0xd9)]['join'](',\x20');return undefined;}async['execute'](_0x4cc653){const _0xae545d=a23_0x14c52f,{args:_0x591a52,options:_0x321a90}=_0x4cc653,_0x4c1a33=_0x321a90[_0xae545d(0xd3)]||getActiveProfile(),[_0x231490,..._0x1ec965]=_0x591a52[0x0][_0xae545d(0xf6)]('='),_0x48cae2=_0x1ec965[_0xae545d(0x113)]('=');console[_0xae545d(0xe7)](a23_0x579cc4[_0xae545d(0xdf)](_0xae545d(0xf3)));if(!profileExists(_0x4c1a33)){const _0x3a05de=await a23_0x5b1bbf({'type':_0xae545d(0xed),'name':_0xae545d(0xeb),'message':_0xae545d(0x12f)+_0x4c1a33+_0xae545d(0x118),'initial':!![]});if(!_0x3a05de[_0xae545d(0xeb)])return console[_0xae545d(0xe7)](_0xae545d(0x124)),0x1;}const _0xce3f0f=loadProfile(_0x4c1a33),_0x21b2cd=_0xce3f0f?.[_0xae545d(0x137)]||{};if(_0x231490==='site'){const _0x585b5f=resolveSite(_0x48cae2);console[_0xae545d(0xe7)](_0xae545d(0xd1)+_0x585b5f+_0xae545d(0x112)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xae545d(0xe7)]('\x20\x20'+getConsoleUrl(_0x585b5f,'/app/mp/ak'));const _0x43eebc=await a23_0x5b1bbf({'type':'password','name':'apiKey','message':_0xae545d(0x102),'validate':_0x2ae15a=>{const _0x6bcccd=_0xae545d;if(!_0x2ae15a||!_0x2ae15a[_0x6bcccd(0xea)]())return _0x6bcccd(0x127);return!![];}});if(!_0x43eebc[_0xae545d(0x11e)])return console['log'](_0xae545d(0x11f)),0x1;console[_0xae545d(0xe7)](_0xae545d(0x131));try{const _0x4eca9a=TDX[_0xae545d(0xeb)]({'site':_0x585b5f,'apiKey':_0x43eebc[_0xae545d(0x11e)]['trim'](),'logLevel':_0x321a90['logLevel']??LogLevel[_0xae545d(0x138)]}),_0x405621=await _0x4eca9a[_0xae545d(0x13b)][_0xae545d(0x120)]();console[_0xae545d(0xe7)](a23_0x579cc4[_0xae545d(0xec)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x405621[_0xae545d(0x110)]+')');const _0x13c7fd=await isKeychainAvailable();_0x13c7fd?(await saveAPIKeyAsync(_0x43eebc[_0xae545d(0x11e)][_0xae545d(0xea)](),_0x585b5f,_0x4c1a33),console[_0xae545d(0xe7)](a23_0x579cc4[_0xae545d(0xec)]('✓')+_0xae545d(0x10f))):console[_0xae545d(0xfe)](a23_0x579cc4['yellow'](_0xae545d(0xcb))),_0x21b2cd[_0xae545d(0xf2)]=_0x585b5f;}catch(_0x5de949){if(_0x5de949 instanceof HTTPClientError&&_0x5de949[_0xae545d(0x10e)]===0x191)return printAuthError(_0x5de949),0x1;return console[_0xae545d(0xfa)](a23_0x579cc4['red'](_0xae545d(0x125)+(_0x5de949 instanceof Error?_0x5de949[_0xae545d(0x109)]:String(_0x5de949)))),console['error'](_0xae545d(0x108)),0x1;}}else _0x21b2cd[_0x231490]=_0x48cae2||undefined;return saveProfileToUserConfig(_0x4c1a33,_0x21b2cd),console['log'](a23_0x579cc4[_0xae545d(0xec)]('✓')+_0xae545d(0xee)+_0x4c1a33+_0xae545d(0x12b)+_0x231490+'='+(_0x48cae2||_0xae545d(0x133))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x14c52f(0x12a);[a23_0x14c52f(0x139)]='Set\x20session\x20profile';[a23_0x14c52f(0xce)](_0xd79fc5){const _0x8f52bc=a23_0x14c52f,{args:_0x1612db}=_0xd79fc5;if(_0x1612db[_0x8f52bc(0xdd)]===0x0)return _0x8f52bc(0x122);return undefined;}async['execute'](_0x3c12c1){const _0x1ff838=a23_0x14c52f,{args:_0x43a804,options:_0x5edba9}=_0x3c12c1,_0x23aad3=_0x43a804[0x0],_0x5f58b2=_0x5edba9[_0x1ff838(0xe6)];cleanExpiredSessions();if(!profileExists(_0x23aad3)){console[_0x1ff838(0xfa)](a23_0x579cc4[_0x1ff838(0x104)](_0x1ff838(0x12f)+_0x23aad3+'\x27\x20does\x20not\x20exist.')),console[_0x1ff838(0xe7)](_0x1ff838(0x10b));const _0x1d7443=listProfiles();if(_0x1d7443[_0x1ff838(0xdd)]===0x0)console[_0x1ff838(0xe7)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2ba532 of _0x1d7443){console[_0x1ff838(0xe7)]('\x20\x20-\x20'+_0x2ba532[_0x1ff838(0x11a)]);}return 0x1;}if(_0x5f58b2){const _0x4d1e1e=a23_0x5dfc70[_0x1ff838(0x113)](getConfigDir(),_0x1ff838(0x101));return saveActiveProfileToUserConfig(_0x23aad3),console[_0x1ff838(0xe7)](_0x1ff838(0xd0)+a23_0x579cc4['green'](_0x23aad3)),console[_0x1ff838(0xe7)](a23_0x579cc4['dim'](_0x1ff838(0x103)+_0x4d1e1e)),0x0;}const _0x29e3b9=getSessionID(_0x5edba9[_0x1ff838(0xd4)]);return saveSessionContext({'profile':_0x23aad3},_0x5edba9['session']),console[_0x1ff838(0xe7)](_0x1ff838(0x107)+a23_0x579cc4[_0x1ff838(0xec)](_0x23aad3)+'\x20'+a23_0x579cc4[_0x1ff838(0x10a)](_0x1ff838(0xe1)+_0x29e3b9+')')),console['log'](a23_0x579cc4[_0x1ff838(0x10a)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x23aad3+_0x1ff838(0x136))),0x0;}}
|
|
1
|
+
const a23_0x1b2570=a23_0x4150;(function(_0x59c86c,_0xa40a4f){const _0x406f95=a23_0x4150,_0x80edcd=_0x59c86c();while(!![]){try{const _0x37edf9=parseInt(_0x406f95(0x1fb))/0x1+parseInt(_0x406f95(0x1d2))/0x2*(parseInt(_0x406f95(0x1e3))/0x3)+-parseInt(_0x406f95(0x1da))/0x4+parseInt(_0x406f95(0x205))/0x5+-parseInt(_0x406f95(0x1fe))/0x6*(parseInt(_0x406f95(0x1f5))/0x7)+parseInt(_0x406f95(0x1f3))/0x8*(parseInt(_0x406f95(0x1fd))/0x9)+-parseInt(_0x406f95(0x202))/0xa*(parseInt(_0x406f95(0x214))/0xb);if(_0x37edf9===_0xa40a4f)break;else _0x80edcd['push'](_0x80edcd['shift']());}catch(_0x3db79b){_0x80edcd['push'](_0x80edcd['shift']());}}}(a23_0x16f2,0xd98c0));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 a23_0x279074 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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a23_0x4150(_0xa468f9,_0x54a47e){_0xa468f9=_0xa468f9-0x1b0;const _0x16f278=a23_0x16f2();let _0x415054=_0x16f278[_0xa468f9];return _0x415054;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x329b36 from'prompts';import a23_0x14a500 from'chalk';function validateProfileName(_0x5b2ed5){const _0x1f8d1c=a23_0x4150;if(!_0x5b2ed5||!_0x5b2ed5[_0x1f8d1c(0x1ce)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x47d7c8=_0x5b2ed5[_0x1f8d1c(0x1ce)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1f8d1c(0x1db)](_0x47d7c8))return _0x1f8d1c(0x1e9);if(profileExists(_0x47d7c8))return _0x1f8d1c(0x1f8)+_0x47d7c8+_0x1f8d1c(0x1d1);return!![];}function a23_0x16f2(){const _0x51b9b3=['Enter\x20description\x20(optional):','us01','\x27\x20does\x20not\x20exist.','parent_segment','8OawwOP','create','2863eFQEoI','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20\x27','\x27\x20created','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','1463790ELiqOK','\x27.\x0a\x0aValid\x20keys:\x20','5555538AJgPAF','16962GTlokq','email','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20tdx\x20--profile\x20','2230kaTOqI','jobs','error','7611945tHnNNw','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','VALID_KEYS','profile','\x0aSaved\x20to:\x20','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>','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20Profile\x20\x27','session','name','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','green','Removal\x20cancelled','121528uDXCQN','\x27\x20updated:\x20','ERROR','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20removed\x20from\x20system\x20keychain','status','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Enter\x20profile\x20name:','config','description','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','message','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','confirm','execute','dim','\x27\x20removed\x20from\x20configuration','getUserInfo','Site\x20name\x20cannot\x20be\x20empty','\x0aOperation\x20cancelled','Create\x20a\x20new\x20profile','profileName','llm_agent','\x0aSetup\x20cancelled','red','tdx.json','site','customSite','Set\x20a\x20profile\x20configuration\x20value','/app/mp/ak','length','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','API\x20key\x20cannot\x20be\x20empty','Enter\x20site\x20name:','trim','yellow','bold','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','3365468kxtnvl','apiKey','\x20\x20-\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20API\x20key\x20saved\x20to\x20system\x20keychain','default','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','text','3100704nOCvSb','test','logLevel','Operation\x20cancelled','profile:use','llm_project','Set\x20session\x20profile','database','\x20--default\x27\x20to\x20save\x20permanently','3RvLFUs','warn','select','tdx:\x20profile\x20set','profile:set','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','✗\x20Validation\x20failed:\x20','validate','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','log','join'];a23_0x16f2=function(){return _0x51b9b3;};return a23_0x16f2();}export class ProfileCreateCommand extends BaseCommand{[a23_0x1b2570(0x210)]='profile:create';[a23_0x1b2570(0x1b2)]=a23_0x1b2570(0x1c0);async[a23_0x1b2570(0x1ba)](_0x5d6f05){const _0x3fe039=a23_0x1b2570,{options:_0x4eb08e,args:_0x1cda52}=_0x5d6f05;console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x1d0)](_0x3fe039(0x1b4)));let _0x298540;if(_0x1cda52[_0x3fe039(0x1ca)]>0x0&&_0x1cda52[0x0]){const _0x25c7ac=_0x1cda52[0x0][_0x3fe039(0x1ce)](),_0x54003=validateProfileName(_0x25c7ac);if(_0x54003!==!![])return console[_0x3fe039(0x204)](a23_0x14a500[_0x3fe039(0x1c4)](_0x54003)),0x1;_0x298540=_0x25c7ac;}else{const _0x34a8b1=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1c1),'message':_0x3fe039(0x1b0),'validate':validateProfileName});if(!_0x34a8b1[_0x3fe039(0x1c1)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;_0x298540=_0x34a8b1[_0x3fe039(0x1c1)][_0x3fe039(0x1ce)]();}const _0xd5eec9=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1b2),'message':_0x3fe039(0x1ef)}),_0xe98187=_0xd5eec9['description']?.[_0x3fe039(0x1ce)]()||undefined,_0x4f2580=_0x4eb08e['site']||_0x3fe039(0x1f0),{choices:_0x5f4122,initialIndex:_0x1f7440}=buildSiteChoices(_0x4f2580),_0x137a6e=await a23_0x329b36({'type':_0x3fe039(0x1e5),'name':'site','message':_0x3fe039(0x1fa)+_0x298540+'\x27:','choices':_0x5f4122,'initial':_0x1f7440});if(!_0x137a6e[_0x3fe039(0x1c6)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;let _0x2215ff;if(_0x137a6e[_0x3fe039(0x1c6)]==='other'){const _0x1c3c0a=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1c7),'message':_0x3fe039(0x1cd),'initial':_0x3fe039(0x1f0),'validate':_0xaab445=>{const _0xf72fb7=_0x3fe039;if(!_0xaab445||!_0xaab445[_0xf72fb7(0x1ce)]())return _0xf72fb7(0x1be);if(!/^[a-z0-9-]+$/[_0xf72fb7(0x1db)](_0xaab445['trim']()))return _0xf72fb7(0x1d8);return!![];}});if(!_0x1c3c0a[_0x3fe039(0x1c7)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;_0x2215ff=_0x1c3c0a[_0x3fe039(0x1c7)];}else _0x2215ff=_0x137a6e[_0x3fe039(0x1c6)];const _0x15ff53=resolveSite(_0x2215ff);console[_0x3fe039(0x1ed)](_0x3fe039(0x1f7)+_0x15ff53),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3fe039(0x1ed)]('\x20\x20'+getConsoleUrl(_0x15ff53,_0x3fe039(0x1c9)));const _0x1a7d09=await a23_0x329b36({'type':'password','name':_0x3fe039(0x1d3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5a7089=>{const _0x464a59=_0x3fe039;if(!_0x5a7089||!_0x5a7089[_0x464a59(0x1ce)]())return _0x464a59(0x1cc);return!![];}});if(!_0x1a7d09[_0x3fe039(0x1d3)])return console['log'](_0x3fe039(0x1c3)),0x1;const _0x173901=_0x1a7d09[_0x3fe039(0x1d3)];console[_0x3fe039(0x1ed)]('Validating\x20API\x20key...');try{const _0x26db5a=TDX[_0x3fe039(0x1f4)]({'site':_0x15ff53,'apiKey':_0x173901[_0x3fe039(0x1ce)](),'logLevel':_0x4eb08e[_0x3fe039(0x1dc)]??LogLevel[_0x3fe039(0x216)]}),_0x472f7b=await _0x26db5a[_0x3fe039(0x203)][_0x3fe039(0x1bd)]();console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x20d)+_0x472f7b[_0x3fe039(0x1ff)]+')');const _0x152f82=await isKeychainAvailable();_0x152f82?(await saveAPIKeyAsync(_0x173901[_0x3fe039(0x1ce)](),_0x15ff53,_0x298540),console['log'](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x1b3)+_0x298540+')')):(console[_0x3fe039(0x1e4)](a23_0x14a500[_0x3fe039(0x1cf)](_0x3fe039(0x217))),console[_0x3fe039(0x1e4)](a23_0x14a500[_0x3fe039(0x1cf)](_0x3fe039(0x1b6))));const _0x3d796f={'site':_0x15ff53,..._0xe98187&&{'description':_0xe98187}};return saveProfileToUserConfig(_0x298540,_0x3d796f),console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x20e)+_0x298540+_0x3fe039(0x1f9)),console['log'](),console[_0x3fe039(0x1ed)](_0x3fe039(0x21b)),console[_0x3fe039(0x1ed)](_0x3fe039(0x201)+_0x298540+_0x3fe039(0x207)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x298540+_0x3fe039(0x21a)),0x0;}catch(_0x3454b8){if(_0x3454b8 instanceof HTTPClientError&&_0x3454b8[_0x3fe039(0x219)]===0x191)return printAuthError(_0x3454b8),0x1;return console[_0x3fe039(0x204)](a23_0x14a500[_0x3fe039(0x1c4)]('✗\x20Validation\x20failed:\x20'+(_0x3454b8 instanceof Error?_0x3454b8['message']:String(_0x3454b8)))),console[_0x3fe039(0x204)](_0x3fe039(0x206)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1b2570(0x210)]='profile:remove';[a23_0x1b2570(0x1b2)]='Remove\x20a\x20profile';[a23_0x1b2570(0x1eb)](_0xeb3bd9){const {args:_0x4de96a}=_0xeb3bd9;if(_0x4de96a['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x1b2570(0x1ba)](_0x3b9402){const _0x5bf2e4=a23_0x1b2570,{args:_0x37e056}=_0x3b9402,_0x5a48bd=_0x37e056[0x0];console['log'](a23_0x14a500[_0x5bf2e4(0x1d0)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x5a48bd)){console['error'](a23_0x14a500['red'](_0x5bf2e4(0x1f8)+_0x5a48bd+_0x5bf2e4(0x1f1))),console[_0x5bf2e4(0x1ed)]('\x0aAvailable\x20profiles:');const _0x1e7417=listProfiles();if(_0x1e7417['length']===0x0)console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x1b5));else for(const _0x40ff8b of _0x1e7417){console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x1d4)+_0x40ff8b[_0x5bf2e4(0x210)]);}return 0x1;}const _0x1ec981=await a23_0x329b36({'type':'confirm','name':_0x5bf2e4(0x1b9),'message':_0x5bf2e4(0x200)+_0x5a48bd+'\x27?','initial':![]});if(!_0x1ec981[_0x5bf2e4(0x1b9)])return console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x213)),0x0;try{removeProfileFromUserConfig(_0x5a48bd),console[_0x5bf2e4(0x1ed)](a23_0x14a500[_0x5bf2e4(0x212)]('✓')+_0x5bf2e4(0x20e)+_0x5a48bd+_0x5bf2e4(0x1bc));}catch(_0x3f9e21){return console['error'](a23_0x14a500[_0x5bf2e4(0x1c4)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x3f9e21 instanceof Error?_0x3f9e21['message']:String(_0x3f9e21)))),0x1;}const _0x4f50ac=await isKeychainAvailable();if(_0x4f50ac){const _0x50e91c=await deleteKeychainAPIKey(_0x5a48bd);_0x50e91c&&console[_0x5bf2e4(0x1ed)](a23_0x14a500[_0x5bf2e4(0x212)]('✓')+_0x5bf2e4(0x218));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1b2570(0x210)]=a23_0x1b2570(0x1e7);['description']=a23_0x1b2570(0x1c8);static ['VALID_KEYS']=[a23_0x1b2570(0x1c6),a23_0x1b2570(0x1e1),a23_0x1b2570(0x1f2),a23_0x1b2570(0x1df),a23_0x1b2570(0x1c2),a23_0x1b2570(0x1b2)];[a23_0x1b2570(0x1eb)](_0x45790d){const _0x3767df=a23_0x1b2570,{args:_0x4b92c5,options:_0x3f2e9f}=_0x45790d,_0x17ca21=_0x3f2e9f['profile']||getActiveProfile();if(!_0x17ca21)return _0x3767df(0x20b);if(_0x4b92c5[_0x3767df(0x1ca)]===0x0)return _0x3767df(0x211)+ProfileSetCommand['VALID_KEYS'][_0x3767df(0x1ee)](',\x20');const _0x530d2c=_0x4b92c5[0x0];if(!_0x530d2c['includes']('='))return _0x3767df(0x1e8)+ProfileSetCommand['VALID_KEYS'][_0x3767df(0x1ee)](',\x20');const [_0x2e9c5c]=_0x530d2c['split']('=',0x2);if(!ProfileSetCommand[_0x3767df(0x208)]['includes'](_0x2e9c5c))return'Unknown\x20key\x20\x27'+_0x2e9c5c+_0x3767df(0x1fc)+ProfileSetCommand[_0x3767df(0x208)][_0x3767df(0x1ee)](',\x20');return undefined;}async[a23_0x1b2570(0x1ba)](_0x384bdc){const _0x30cf54=a23_0x1b2570,{args:_0x2d20b9,options:_0x43df88}=_0x384bdc,_0x33ce07=_0x43df88[_0x30cf54(0x209)]||getActiveProfile(),[_0x2777a4,..._0x5e7725]=_0x2d20b9[0x0]['split']('='),_0x1c0878=_0x5e7725['join']('=');console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x1d0)](_0x30cf54(0x1e6)));if(!profileExists(_0x33ce07)){const _0x4cc80e=await a23_0x329b36({'type':'confirm','name':_0x30cf54(0x1f4),'message':_0x30cf54(0x1f8)+_0x33ce07+_0x30cf54(0x1f6),'initial':!![]});if(!_0x4cc80e[_0x30cf54(0x1f4)])return console[_0x30cf54(0x1ed)](_0x30cf54(0x1dd)),0x1;}const _0x1a4ec0=loadProfile(_0x33ce07),_0x40e920=_0x1a4ec0?.[_0x30cf54(0x1b1)]||{};if(_0x2777a4===_0x30cf54(0x1c6)){const _0x5ed9c2=resolveSite(_0x1c0878);console[_0x30cf54(0x1ed)]('Changing\x20site\x20to\x20\x27'+_0x5ed9c2+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x30cf54(0x1ed)](_0x30cf54(0x1b8)),console[_0x30cf54(0x1ed)]('\x20\x20'+getConsoleUrl(_0x5ed9c2,_0x30cf54(0x1c9)));const _0x4150ef=await a23_0x329b36({'type':'password','name':_0x30cf54(0x1d3),'message':_0x30cf54(0x1d5),'validate':_0x57e9f3=>{const _0x138217=_0x30cf54;if(!_0x57e9f3||!_0x57e9f3[_0x138217(0x1ce)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4150ef['apiKey'])return console[_0x30cf54(0x1ed)](_0x30cf54(0x1bf)),0x1;console[_0x30cf54(0x1ed)]('Validating\x20API\x20key...');try{const _0x2858d7=TDX[_0x30cf54(0x1f4)]({'site':_0x5ed9c2,'apiKey':_0x4150ef[_0x30cf54(0x1d3)]['trim'](),'logLevel':_0x43df88[_0x30cf54(0x1dc)]??LogLevel[_0x30cf54(0x216)]}),_0x54e119=await _0x2858d7['jobs']['getUserInfo']();console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+_0x30cf54(0x20d)+_0x54e119[_0x30cf54(0x1ff)]+')');const _0x607e11=await isKeychainAvailable();_0x607e11?(await saveAPIKeyAsync(_0x4150ef[_0x30cf54(0x1d3)]['trim'](),_0x5ed9c2,_0x33ce07),console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+_0x30cf54(0x1d6))):console['warn'](a23_0x14a500['yellow'](_0x30cf54(0x217))),_0x40e920[_0x30cf54(0x1c6)]=_0x5ed9c2;}catch(_0x5ec8b4){if(_0x5ec8b4 instanceof HTTPClientError&&_0x5ec8b4['status']===0x191)return printAuthError(_0x5ec8b4),0x1;return console[_0x30cf54(0x204)](a23_0x14a500[_0x30cf54(0x1c4)](_0x30cf54(0x1ea)+(_0x5ec8b4 instanceof Error?_0x5ec8b4[_0x30cf54(0x1b7)]:String(_0x5ec8b4)))),console[_0x30cf54(0x204)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x40e920[_0x2777a4]=_0x1c0878||undefined;return saveProfileToUserConfig(_0x33ce07,_0x40e920),console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+'\x20Profile\x20\x27'+_0x33ce07+_0x30cf54(0x215)+_0x2777a4+'='+(_0x1c0878||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x1b2570(0x1de);[a23_0x1b2570(0x1b2)]=a23_0x1b2570(0x1e0);[a23_0x1b2570(0x1eb)](_0x1ce0fe){const _0x84b31e=a23_0x1b2570,{args:_0x4a9317}=_0x1ce0fe;if(_0x4a9317[_0x84b31e(0x1ca)]===0x0)return _0x84b31e(0x1ec);return undefined;}async[a23_0x1b2570(0x1ba)](_0x43e838){const _0x2947ce=a23_0x1b2570,{args:_0x579771,options:_0x48a6e8}=_0x43e838,_0x472241=_0x579771[0x0],_0xd4f8e1=_0x48a6e8[_0x2947ce(0x1d7)];cleanExpiredSessions();if(!profileExists(_0x472241)){console[_0x2947ce(0x204)](a23_0x14a500['red']('Profile\x20\x27'+_0x472241+_0x2947ce(0x1f1))),console['log']('\x0aAvailable\x20profiles:');const _0xbf90e2=listProfiles();if(_0xbf90e2[_0x2947ce(0x1ca)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x31eddb of _0xbf90e2){console['log'](_0x2947ce(0x1d4)+_0x31eddb[_0x2947ce(0x210)]);}return 0x1;}if(_0xd4f8e1){const _0x18b74b=a23_0x279074[_0x2947ce(0x1ee)](getConfigDir(),_0x2947ce(0x1c5));return saveActiveProfileToUserConfig(_0x472241),console[_0x2947ce(0x1ed)]('Default\x20profile\x20set\x20to:\x20'+a23_0x14a500[_0x2947ce(0x212)](_0x472241)),console[_0x2947ce(0x1ed)](a23_0x14a500['dim'](_0x2947ce(0x20a)+_0x18b74b)),0x0;}const _0x5aa3c8=getSessionID(_0x48a6e8[_0x2947ce(0x20f)]);return saveSessionContext({'profile':_0x472241},_0x48a6e8[_0x2947ce(0x20f)]),console['log'](_0x2947ce(0x20c)+a23_0x14a500[_0x2947ce(0x212)](_0x472241)+'\x20'+a23_0x14a500['dim']('(session:\x20'+_0x5aa3c8+')')),console['log'](a23_0x14a500[_0x2947ce(0x1bb)](_0x2947ce(0x1cb)+_0x472241+_0x2947ce(0x1e2))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x3611cd=a24_0x2765;(function(_0xbf08f8,_0x5e47ae){const _0xe54207=a24_0x2765,_0x2e754b=_0xbf08f8();while(!![]){try{const _0x20edde=parseInt(_0xe54207(0x14b))/0x1*(-parseInt(_0xe54207(0x140))/0x2)+-parseInt(_0xe54207(0x141))/0x3+parseInt(_0xe54207(0x147))/0x4*(-parseInt(_0xe54207(0x150))/0x5)+-parseInt(_0xe54207(0x145))/0x6+parseInt(_0xe54207(0x153))/0x7*(parseInt(_0xe54207(0x151))/0x8)+-parseInt(_0xe54207(0x14e))/0x9+parseInt(_0xe54207(0x142))/0xa*(parseInt(_0xe54207(0x144))/0xb);if(_0x20edde===_0x5e47ae)break;else _0x2e754b['push'](_0x2e754b['shift']());}catch(_0x350d67){_0x2e754b['push'](_0x2e754b['shift']());}}}(a24_0x30d7,0x28584));function a24_0x2765(_0x50abee,_0x535f0a){_0x50abee=_0x50abee-0x13e;const _0x30d7ae=a24_0x30d7();let _0x27653f=_0x30d7ae[_0x50abee];return _0x27653f;}import{BaseCommand}from'./command.js';function a24_0x30d7(){const _0x50727d=['length','message','116079CWmxcj','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','290142LhkTNf','config','3595szGFIu','8iLGdsx','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','299159LNhgZy','scope','Error:\x20','log','name','2bthseQ','91467uUcMcu','5394990lvkGlE','execute','11xpiDRV','18390ScLfRv','profiles','1308tDVBWb','map'];a24_0x30d7=function(){return _0x50727d;};return a24_0x30d7();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x3611cd(0x13f)]=a24_0x3611cd(0x146);['description']='List\x20all\x20available\x20profiles';async[a24_0x3611cd(0x143)](_0x216888){const _0x1baea1=a24_0x3611cd,{options:_0x5cdf28}=_0x216888;try{const _0x7acbfd=listProfiles(),_0x5b2b90=getActiveProfile();if(_0x7acbfd[_0x1baea1(0x149)]===0x0)return console[_0x1baea1(0x13e)](_0x1baea1(0x14c)),console[_0x1baea1(0x13e)](_0x1baea1(0x152)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x1f80bb=_0x7acbfd[_0x1baea1(0x148)](_0x874543=>{const _0x432ab3=_0x1baea1,_0x2602d2=_0x874543['name']===_0x5b2b90,_0x4e110f=getProfileParams(_0x874543[_0x432ab3(0x14f)]);return{'name':_0x874543['name'],'active':_0x2602d2,'scope':_0x874543[_0x432ab3(0x154)],'description':_0x874543[_0x432ab3(0x14f)][_0x432ab3(0x14d)]||'','params':_0x4e110f};});return await handleSDKOutput(_0x1f80bb,_0x5cdf28),0x0;}catch(_0x27657a){return _0x27657a instanceof Error&&console['error'](_0x1baea1(0x155)+_0x27657a[_0x1baea1(0x14a)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x4c1d61=a25_0xecc7;(function(_0x1140ba,_0x1e9f97){const _0x5ba216=a25_0xecc7,_0x27482a=_0x1140ba();while(!![]){try{const _0x5b83f9=-parseInt(_0x5ba216(0x1ba))/0x1+-parseInt(_0x5ba216(0x1b5))/0x2*(parseInt(_0x5ba216(0x1d1))/0x3)+parseInt(_0x5ba216(0x1c1))/0x4+-parseInt(_0x5ba216(0x1c8))/0x5*(parseInt(_0x5ba216(0x1d3))/0x6)+parseInt(_0x5ba216(0x1ce))/0x7+-parseInt(_0x5ba216(0x1c4))/0x8*(parseInt(_0x5ba216(0x1b0))/0x9)+parseInt(_0x5ba216(0x1c2))/0xa;if(_0x5b83f9===_0x1e9f97)break;else _0x27482a['push'](_0x27482a['shift']());}catch(_0x40c59c){_0x27482a['push'](_0x27482a['shift']());}}}(a25_0x5818,0x1b14a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a25_0xecc7(_0x2f0120,_0x777bb4){_0x2f0120=_0x2f0120-0x1a5;const _0x58181a=a25_0x5818();let _0xecc71d=_0x58181a[_0x2f0120];return _0xecc71d;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a25_0x4c1d61(0x1cd);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x4c1d61(0x1bf)](_0x121966){const _0x3bb110=a25_0x4c1d61,{options:_0x6e82ab,args:_0x190f41,tdx:_0x1fe78c}=_0x121966,_0x257f29=_0x190f41[0x0],_0x5a676e=_0x6e82ab[_0x3bb110(0x1be)];let _0x2e5275;try{if(_0x5a676e)_0x2e5275=readSqlStatementsFromFile(_0x5a676e);else{if(_0x257f29==='-')_0x2e5275=await readSqlStatementsFromStdin();else{if(_0x257f29&&isSqlFilePath(_0x257f29))_0x2e5275=readSqlStatementsFromFile(_0x257f29);else{if(_0x257f29)_0x2e5275=splitSqlStatements(_0x257f29);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x52798c){return console[_0x3bb110(0x1a5)](_0x3bb110(0x1b1)+_0x52798c[_0x3bb110(0x1ad)]),0x1;}const _0x42345f=_0x6e82ab[_0x3bb110(0x1b3)]||'information_schema',_0x30438d=_0x6e82ab[_0x3bb110(0x1d0)];try{const _0x2af10a=[],_0x56fa35=!!_0x6e82ab['output'];for(let _0xef170c=0x0;_0xef170c<_0x2e5275[_0x3bb110(0x1a7)];_0xef170c++){const _0x1154ad=_0x2e5275[_0xef170c],_0x3e0546=_0xef170c+0x1,_0x5b3549=_0x2e5275['length'],_0x3e1616=_0x5b3549>0x1;_0x6e82ab[_0x3bb110(0x1b2)]&&(console[_0x3bb110(0x1a5)]('\x0a'+(_0x3e1616?_0x3bb110(0x1b8)+_0x3e0546+'/'+_0x5b3549+':':'')),console['error'](_0x3bb110(0x1d6)+_0x6e82ab[_0x3bb110(0x1c5)]),console[_0x3bb110(0x1a5)](_0x3bb110(0x1a6)+(_0x30438d||'td')),console[_0x3bb110(0x1a5)](_0x3bb110(0x1cb)+_0x42345f),console[_0x3bb110(0x1a5)](_0x3bb110(0x1d7)+_0x1154ad));const _0x21ea73=_0x3e1616?_0x3bb110(0x1c9)+_0x3e0546+'/'+_0x5b3549+'...':_0x3bb110(0x1ca);try{const _0x196078=await withProgressSpinner(_0x21ea73,async _0xe08efd=>{const _0x1efc47=_0x3bb110,_0x3a99ff=await _0x1fe78c[_0x1efc47(0x1cd)][_0x1efc47(0x1bf)](_0x1154ad,{'catalog':_0x30438d,'schema':_0x42345f,'onJobId':_0xe43369=>{_0xe08efd['setJobId'](_0xe43369);},'onProgress':_0xdff390=>{const _0x5bf4ca=_0x1efc47;_0xe08efd[_0x5bf4ca(0x1b6)](_0x5bf4ca(0x1af)+_0xdff390[_0x5bf4ca(0x1b7)]+']'),_0xe08efd[_0x5bf4ca(0x1cc)](formatRows(_0xdff390[_0x5bf4ca(0x1aa)])+_0x5bf4ca(0x1d2)+_0xdff390[_0x5bf4ca(0x1bc)]+'/'+_0xdff390[_0x5bf4ca(0x1b4)]+_0x5bf4ca(0x1b9));}});return _0x3a99ff;},{'verbose':_0x6e82ab[_0x3bb110(0x1b2)]}),_0x3638ca=_0x196078[_0x3bb110(0x1c6)],_0x1d5aab=_0x3638ca['jobId']?_0x3bb110(0x1a8)+_0x3638ca[_0x3bb110(0x1c0)]+']':'',_0x317637=_0x3e1616?_0x3bb110(0x1b8)+_0x3e0546+'/'+_0x5b3549+_0x3bb110(0x1bd):'';console[_0x3bb110(0x1a5)]('✔\x20'+_0x317637+_0x3bb110(0x1d4)+formatRows(_0x3638ca[_0x3bb110(0x1bb)][_0x3bb110(0x1aa)])+_0x3bb110(0x1d2)+(_0x3bb110(0x1c7)+formatElapsed(_0x3638ca['stats']['elapsedTimeMillis'])+_0x1d5aab));if(_0x3e1616&&_0x56fa35){const _0x3384b0=resolveOutputOptions(_0x6e82ab),_0x385303=await formatQueryOutput(_0x3638ca,_0x3384b0);_0x2af10a[_0x3bb110(0x1ac)](_0x385303);}else await handleQueryOutput(_0x3638ca,_0x6e82ab);}catch(_0x206d85){const _0xc0e2b0=_0x3e1616?'Statement\x20'+_0x3e0546+'/'+_0x5b3549+':\x0a':'',_0x2f4e43=_0x206d85 instanceof SDKError?_0x206d85[_0x3bb110(0x1ae)]:_0x206d85[_0x3bb110(0x1ad)];return console[_0x3bb110(0x1a5)](''+_0xc0e2b0+_0x2f4e43),0x1;}}if(_0x2e5275[_0x3bb110(0x1a7)]>0x1&&_0x56fa35&&_0x2af10a['length']>0x0){const _0x25ac95=_0x2af10a['join']('\x0a');writeFileSync(_0x6e82ab[_0x3bb110(0x1cf)],_0x25ac95),console[_0x3bb110(0x1a5)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x6e82ab[_0x3bb110(0x1cf)]);}return 0x0;}catch(_0x1b8880){throw _0x1b8880;}}[a25_0x4c1d61(0x1c3)](_0x2bca62){const _0x2cb4e9=a25_0x4c1d61,_0x5b0dac=_0x2bca62[_0x2cb4e9(0x1ab)][0x0],_0x1bfb39=_0x2bca62['options'][_0x2cb4e9(0x1be)];if(!_0x5b0dac&&!_0x1bfb39)return _0x2cb4e9(0x1a9);if(_0x5b0dac&&_0x1bfb39)return _0x2cb4e9(0x1d5);return undefined;}}function a25_0x5818(){const _0x56dc1a=['\x20splits','108367NSzhKQ','stats','completedSplits','\x20-\x20','file','execute','jobId','658408wXckZX','4400370ZiNNmF','validate','2216tpfBYu','site','data','in\x20','52055kiIsKk','Executing\x20statement\x20','Executing\x20query...','Schema:\x20','setExtra','query','1197wTXgii','output','catalog','87snQqGU','\x20rows\x20','96wIxXMK','Query\x20completed:\x20Processed\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Site:\x20','SQL:\x20','error','Catalog:\x20','length','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','processedRows','args','push','message','originalMessage','Executing\x20query\x20[','666CBTpPw','Error:\x20','verbose','database','totalSplits','13686gyMWJe','setPhase','state','Statement\x20'];a25_0x5818=function(){return _0x56dc1a;};return a25_0x5818();}
|