@treasuredata/tdx 0.25.3 → 0.25.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/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x4aa0a8=a22_0x2432;(function(_0x208ea6,_0x1b4b66){const _0x44c8b4=a22_0x2432,_0x2b36de=_0x208ea6();while(!![]){try{const _0x369599=-parseInt(_0x44c8b4(0x303))/0x1+-parseInt(_0x44c8b4(0x296))/0x2+parseInt(_0x44c8b4(0x332))/0x3+parseInt(_0x44c8b4(0x288))/0x4+-parseInt(_0x44c8b4(0x23f))/0x5+parseInt(_0x44c8b4(0x2a9))/0x6+parseInt(_0x44c8b4(0x228))/0x7;if(_0x369599===_0x1b4b66)break;else _0x2b36de['push'](_0x2b36de['shift']());}catch(_0x41bf43){_0x2b36de['push'](_0x2b36de['shift']());}}}(a22_0xb1cf,0xd5362));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x2dd425 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a22_0x2432(_0x31a408,_0x9aa78e){_0x31a408=_0x31a408-0x1eb;const _0xb1cf8a=a22_0xb1cf();let _0x243220=_0xb1cf8a[_0x31a408];return _0x243220;}import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x47d034 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_0x4aa0a8(0x2b4),LEGACY_PARENT_SEGMENT_DIR=a22_0x4aa0a8(0x311);function openBrowser(_0x40af98){const _0x34c736=a22_0x4aa0a8,_0x1e5f72=process[_0x34c736(0x2f3)],_0x522cd7=_0x1e5f72==='darwin'?_0x34c736(0x329):_0x1e5f72===_0x34c736(0x32c)?'start':_0x34c736(0x26d);spawn(_0x522cd7,[_0x40af98],{'detached':!![],'stdio':_0x34c736(0x32d)})[_0x34c736(0x2f8)]();}function a22_0xb1cf(){const _0x514fbc=['customers','\x0aChanges\x20to\x20apply\x20to\x20\x27','/attempt/','addBehaviors','totalEvents','segment:parent:show','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Created','Available\x20attributes:','parentSegment','replace','SQL\x20query:\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','-1d','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','createParent','✔\x20Updated\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','table','\x0a\x20\x20]\x0a}\x0a','Updating\x20parent\x20segment\x20\x27','\x27\x20and\x20run\x20workflow?','\x20parent\x20segment\x20\x27','\x22,\x20\x22type\x22:\x20\x22','\x0aNew\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','sort','Customers:','platform','database','output','processedRows','pushParentYaml','unref','segment:parent:view','red','displayValidateResults','/{name}.yml\x0a','map','query','To\x20cancel:','\x20rows)','Rows:','attribute','638313aFLmJt','sampleData','listFields','joinKey','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','length','yes','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','scheduleOption','start','\x0a⚠️\x20\x20Migrating:\x20','Source:','parent_segment','status','/\x20directories\x20exist.','toLocaleString','attributes','endsWith','text','stats','FINISHED','Preview:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Schema\x20saved\x20to\x20','Audience\x20ID:','Show\x20parent\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','toFixed','displayPreviewResults','/app/dw/parentSegments/','column','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','message','Attributes','Error\x20parsing\x20YAML:\x20','open','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x27\x20with\x20ID:\x20','win32','ignore','utf-8','\x20Opening\x20','jsonl','List\x20parent\x20segments','2399523rAyoyZ','displaySummary','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','audienceId','schemaValid','columns','verbose','site','customersWithEvents','tdx\x20segment\x20parent\x20preview\x20','workflowSessionId','segment:parent:push','Found\x20YAML\x20file:\x20','Parent\x20segment:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','.customers)','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','SELECT\x20*\x20FROM\x20(\x0a','all','formatSchemaJson','Aborted.','\x20behaviors','session','getOutputDatabaseName','workflowAttemptId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x27\x20is\x20already\x20up\x20to\x20date','error','cyan','.yml','filter','\x20\x20Tables:\x201\x20customers\x20+\x20','getParentSQL','Options:','web','Overwrite\x20\x27','\x0a⚠️\x20\x20Both\x20','master','displayColumns','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','displaySampleData','Events:','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','segment:parent:preview','displayPreviewHints','\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:\x0a','errors','displayAttributesStats','segment:parent:pull','yellow','varchar','Behaviors','Master\x20Table','Errors:','behavior','test','updateParent','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','jobId','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20--interval\x20','Options\x20(one\x20required):\x0a','green','\x20parent\x20segment','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Join\x20on:','getBehaviorNames','Pattern:\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Updated','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','format','/\x20→\x20','3134005msIegY','\x20kill','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','customerGroupFile','\x20\x20Columns:\x20','addAttributes','number','using\x20the\x20default\x20path:\x20','collectSchema','join','\x20\x20\x20\x20-\x20','interval','segment:parent:run','\x0a\x20\x20\x20\x20]','setJobId','YAML\x20file:\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','description','To\x20view\x20sample\x20data:','type','bold','/sessions/','attributesFile','4776900RGUPLN','`\x20to\x20download\x20the\x20configuration\x20first','customerPercent','trim','Error:','SELECT\x20*\x20FROM\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Coverage:','{\x0a\x20\x20\x22database\x22:\x20\x22','\x27\x20is\x20up\x20to\x20date','addBehaviorsFile','Available\x20behaviors:','push','segment','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20=\x20','column_type','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Analyzing\x20changes...','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','foreignKey','behaviors','resolveParentId','\x20[Job\x20ID:\x20','Fetching\x20customers\x20schema...','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','column_name','Listing\x20fields\x20for\x20\x27','Create\x20parent\x20segment\x20\x27','Output\x20file:\x20','Executing\x20parent\x20segment\x20query...','Status:','Database:\x20','matchedCount','\x5c$&','Apply\x20changes\x20to\x20\x27','execute','segment:parent:desc','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','enriched','xdg-open','✔\x20No\x20changes\x20-\x20\x27','scheduleType','Name:\x20','\x20--attribute\x20\x22','previewParentYaml','Table:\x20','json','parent_id','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20field','validateParentYaml','log','\x22\x20}','addAttributesFile','\x20\x20No\x20sample\x20data\x20available','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','segment:parent:create','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','customerGroup','Error:\x20--behavior\x20requires\x20a\x20name\x0a','pullParentYaml','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Behavior:','localeCompare','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','2510388luvCQx','\x0aError:','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','displayMasterInfo','data','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20--behavior\x20\x22','\x0a✔\x20Workflow\x20started','dim','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','✔\x20Found\x20','use','635270UiPyxi','Enriched:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','timezone','rowCount','Error\x20reading\x20file:\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Context\x20set:\x20','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Master:','Updating','No\x20parent\x20segments\x20found','stop','✔\x20Renamed\x20directory\x20to\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','workflowId','\x0a\x20\x20\x20\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','5456934UhYKNK','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','label','repeat','👥\x20','behavior_','✔\x20Created\x20parent\x20segment\x20\x27','listParents','string','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20Configuration\x20is\x20valid','parent_segments','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Session:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Attribute:','population','\x0aChanges\x20to\x20\x27','Columns:','\x27...','Creating','schemaError','/app/workflows/','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','reduce','allValid','displayBehaviorsStats','\x20\x20Database:\x20','coveragePercent','\x20No\x20changes\x20-\x20','Fetching\x20parent\x20segment\x20\x27','double','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','name','segment:parent:validate','apply','toLowerCase','runParent','Join:','Error:\x20File\x20not\x20found:\x20','\x0aNo\x20sample\x20data\x20available','run','No\x20parent\x20segments\x20match\x20pattern:\x20','getParentFull'];a22_0xb1cf=function(){return _0x514fbc;};return a22_0xb1cf();}function migrateLegacyDirectory(){const _0x579e7b=a22_0x4aa0a8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x126dc7=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x126dc7['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x579e7b(0x1f7)](a22_0x47d034[_0x579e7b(0x20f)](_0x579e7b(0x200)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x579e7b(0x313))),console[_0x579e7b(0x1f7)](a22_0x47d034['dim'](_0x579e7b(0x31c)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x579e7b(0x1f7)](a22_0x47d034[_0x579e7b(0x20f)](_0x579e7b(0x30f)+LEGACY_PARENT_SEGMENT_DIR+_0x579e7b(0x227)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x579e7b(0x1f7)](a22_0x47d034['green'](_0x579e7b(0x2a3)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x556889){const _0x10c42d=_0x556889 instanceof Error?_0x556889[_0x579e7b(0x326)]:String(_0x556889);return console[_0x579e7b(0x1f7)](a22_0x47d034['red'](_0x579e7b(0x307)+_0x10c42d+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x4aa0a8(0x2d2)](_0xa4e689){const _0x27f624=a22_0x4aa0a8;return migrateLegacyDirectory(),super[_0x27f624(0x2d2)](_0xa4e689);}}function resolveYamlFile(_0x288475){const _0x17bf09=a22_0x4aa0a8;if(_0x288475[_0x17bf09(0x316)](_0x17bf09(0x1f9))||_0x288475[_0x17bf09(0x316)]('.yaml'))return _0x288475;return a22_0x2dd425[_0x17bf09(0x231)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x288475)+_0x17bf09(0x1f9));}function formatProgressMessage(_0x19d0a1){const _0x298dd2=a22_0x4aa0a8,_0x24d2f0=_0x19d0a1['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x24d2f0){const [,_0x575f4c,_0x6bb927,_0x4ec763='']=_0x24d2f0;return a22_0x47d034['dim'](_0x575f4c+':')+'\x20'+_0x6bb927+a22_0x47d034[_0x298dd2(0x290)](_0x4ec763);}return a22_0x47d034['dim'](_0x19d0a1);}function showFileNotFoundError(_0xe75aa6,_0x598906){const _0x254fe1=a22_0x4aa0a8;console[_0x254fe1(0x1f7)](a22_0x47d034['red'](_0x254fe1(0x2d0)+_0xe75aa6+'\x0a')),console['error'](a22_0x47d034[_0x254fe1(0x1f8)](_0x254fe1(0x2e3)+_0x598906+_0x254fe1(0x240)));}function showParentSegmentNotSetError(_0x62aedd){const _0x381e5e=a22_0x4aa0a8;console[_0x381e5e(0x1f7)](a22_0x47d034['yellow'](_0x381e5e(0x207))),console['error'](_0x62aedd);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x4aa0a8(0x2ca)]='segment:parent:list';['description']=a22_0x4aa0a8(0x331);async[a22_0x4aa0a8(0x269)](_0x46dc9c){const _0x5cc333=a22_0x4aa0a8,{options:_0x4a1eb9,args:_0x3f7784,tdx:_0x2c2e7b}=_0x46dc9c,_0x1b9732=_0x3f7784[0x0];_0x4a1eb9[_0x5cc333(0x338)]&&(console[_0x5cc333(0x1f7)](_0x5cc333(0x254)+_0x4a1eb9[_0x5cc333(0x339)]),_0x1b9732&&console[_0x5cc333(0x1f7)](_0x5cc333(0x222)+_0x1b9732));const _0x349b52=await withSpinner(_0x1b9732?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x1b9732+_0x5cc333(0x2bc):'Listing\x20parent\x20segments...',()=>_0x2c2e7b[_0x5cc333(0x24c)][_0x5cc333(0x2b0)](),{'verbose':_0x4a1eb9[_0x5cc333(0x338)]});let _0x25ed1c=_0x349b52[_0x5cc333(0x28c)];if(_0x1b9732){const _0x245c23=_0x1b9732[_0x5cc333(0x2df)](/[.+^${}()|[\]\\]/g,_0x5cc333(0x267))[_0x5cc333(0x2df)](/\*/g,'.*')[_0x5cc333(0x2df)](/\?/g,'.'),_0x5c0e0a=new RegExp('^'+_0x245c23+'$','i');_0x25ed1c=_0x25ed1c[_0x5cc333(0x1fa)](_0x530f3f=>_0x5c0e0a[_0x5cc333(0x215)](_0x530f3f['attributes'][_0x5cc333(0x2ca)]));}_0x25ed1c[_0x5cc333(0x2f1)]((_0x37c28c,_0x119fcb)=>_0x37c28c[_0x5cc333(0x315)][_0x5cc333(0x2ca)][_0x5cc333(0x285)](_0x119fcb[_0x5cc333(0x315)]['name'])),console[_0x5cc333(0x1f7)](_0x5cc333(0x294)+_0x25ed1c[_0x5cc333(0x309)]+_0x5cc333(0x21e)+(_0x25ed1c[_0x5cc333(0x309)]!==0x1?'s':''));const _0x2cafa3=_0x1fbc39=>{const _0xaab4b6=_0x5cc333;return getConsoleNextUrl(_0x4a1eb9[_0xaab4b6(0x339)],_0xaab4b6(0x323)+_0x1fbc39);};if(_0x4a1eb9[_0x5cc333(0x226)]===_0x5cc333(0x274)||_0x4a1eb9[_0x5cc333(0x226)]===_0x5cc333(0x330)){const _0x4d9954=_0x25ed1c[_0x5cc333(0x2fd)](_0x3f2dfd=>({..._0x3f2dfd,'url':_0x2cafa3(_0x3f2dfd['id'])}));await handleSDKOutput(_0x4d9954,_0x4a1eb9);}else{if(_0x25ed1c['length']===0x0)_0x1b9732?console[_0x5cc333(0x279)](_0x5cc333(0x2d3)+_0x1b9732):console[_0x5cc333(0x279)](_0x5cc333(0x2a1));else for(const _0x286aeb of _0x25ed1c){const _0x22e8fa=_0x286aeb[_0x5cc333(0x315)]['population']?a22_0x47d034[_0x5cc333(0x290)]('\x20('+formatRows(_0x286aeb[_0x5cc333(0x315)][_0x5cc333(0x2b9)])+')'):'',_0x2ee630=hyperlink(_0x286aeb[_0x5cc333(0x315)][_0x5cc333(0x2ca)],_0x2cafa3(_0x286aeb['id']));console[_0x5cc333(0x279)](_0x5cc333(0x2ad)+_0x2ee630+_0x22e8fa);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x4aa0a8(0x27e);[a22_0x4aa0a8(0x239)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x4aa0a8(0x269)](_0x4b2709){const _0x38cf67=a22_0x4aa0a8,{options:_0x2ee94a,args:_0x4e5503,tdx:_0x14fc4a}=_0x4b2709;console[_0x38cf67(0x1f7)](_0x38cf67(0x293)+_0x38cf67(0x21a)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x43d585=_0x2ee94a;if(_0x4e5503[_0x38cf67(0x309)]===0x0)return console[_0x38cf67(0x1f7)](a22_0x47d034[_0x38cf67(0x2fa)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x38cf67(0x1f7)](_0x38cf67(0x2f0)),0x1;const _0x103d66=_0x4e5503[0x0];if(!_0x43d585[_0x38cf67(0x2f4)]||!_0x43d585[_0x38cf67(0x2e9)])return console['error'](_0x38cf67(0x340)),console['error'](_0x38cf67(0x2f0)),0x1;_0x43d585['verbose']&&(console['error'](_0x38cf67(0x254)+_0x43d585[_0x38cf67(0x339)]),console[_0x38cf67(0x1f7)](_0x38cf67(0x270)+_0x103d66),console[_0x38cf67(0x1f7)](_0x38cf67(0x265)+_0x43d585[_0x38cf67(0x2f4)]),console[_0x38cf67(0x1f7)](_0x38cf67(0x273)+_0x43d585[_0x38cf67(0x2e9)]));const _0x1a5669=await loadJSONFromOptions(_0x43d585['attributes'],_0x43d585[_0x38cf67(0x23e)]),_0x55a10c=await loadJSONFromOptions(_0x43d585[_0x38cf67(0x258)],_0x43d585['behaviorsFile']),_0x10b13e=await loadJSONFromOptions(_0x43d585[_0x38cf67(0x280)],_0x43d585[_0x38cf67(0x22b)]),_0x4d1374={'name':_0x103d66,'description':_0x43d585[_0x38cf67(0x239)],'scheduleType':_0x43d585['scheduleType'],'scheduleOption':_0x43d585[_0x38cf67(0x30d)],'timezone':_0x43d585[_0x38cf67(0x299)],'master':{'parentDatabaseName':_0x43d585[_0x38cf67(0x2f4)],'parentTableName':_0x43d585[_0x38cf67(0x2e9)]},'attributes':_0x1a5669,'behaviors':_0x55a10c,'customerGroup':_0x10b13e},_0x2f3fa3=await withSpinner(_0x38cf67(0x2e6)+_0x103d66+_0x38cf67(0x2bc),()=>_0x14fc4a[_0x38cf67(0x24c)][_0x38cf67(0x2e4)](_0x4d1374),{'verbose':_0x2ee94a['verbose']}),_0x236c11=_0x2f3fa3['data'];return console[_0x38cf67(0x1f7)](_0x38cf67(0x2af)+_0x236c11[_0x38cf67(0x2ca)]+_0x38cf67(0x32b)+_0x236c11['id']),await handleSDKOutput([_0x236c11],_0x2ee94a),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x334);async['execute'](_0x4b2029){const _0x4886e8=a22_0x4aa0a8,{options:_0x508cb7,args:_0x3fc4b4,tdx:_0x4fe354}=_0x4b2029;console['error'](_0x4886e8(0x2aa)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4886e8(0x292));const _0x2f9d49=_0x508cb7;if(_0x3fc4b4['length']===0x0)return console[_0x4886e8(0x1f7)](a22_0x47d034[_0x4886e8(0x2fa)](_0x4886e8(0x2e8))),console['error'](_0x4886e8(0x29c)),0x1;const _0x2f082b=_0x3fc4b4[0x0];_0x2f9d49[_0x4886e8(0x338)]&&(console[_0x4886e8(0x1f7)]('Site:\x20'+_0x2f9d49[_0x4886e8(0x339)]),console[_0x4886e8(0x1f7)]('Parent\x20segment:\x20'+_0x2f082b));const _0x3b9df0=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x2f082b+_0x4886e8(0x2bc),()=>_0x4fe354[_0x4886e8(0x24c)][_0x4886e8(0x2d4)](_0x2f082b),{'verbose':_0x2f9d49[_0x4886e8(0x338)]}),_0x4e2794=_0x3b9df0[_0x4886e8(0x28c)],_0x2d1c6f=await loadJSONFromOptions(_0x2f9d49[_0x4886e8(0x22d)],_0x2f9d49[_0x4886e8(0x27b)]),_0x3ae00c=await loadJSONFromOptions(_0x2f9d49[_0x4886e8(0x2d8)],_0x2f9d49[_0x4886e8(0x249)]),_0x3c44a4={'name':_0x4e2794[_0x4886e8(0x2ca)],'description':_0x2f9d49['description']!==undefined?_0x2f9d49[_0x4886e8(0x239)]:_0x4e2794[_0x4886e8(0x239)],'scheduleType':_0x2f9d49[_0x4886e8(0x26f)]!==undefined?_0x2f9d49[_0x4886e8(0x26f)]:_0x4e2794[_0x4886e8(0x26f)],'scheduleOption':_0x2f9d49['scheduleOption']!==undefined?_0x2f9d49[_0x4886e8(0x30d)]:_0x4e2794[_0x4886e8(0x30d)],'timezone':_0x2f9d49[_0x4886e8(0x299)]!==undefined?_0x2f9d49[_0x4886e8(0x299)]:_0x4e2794[_0x4886e8(0x299)],'master':_0x4e2794['master'],'attributes':_0x2d1c6f?[..._0x4e2794[_0x4886e8(0x315)]||[],..._0x2d1c6f]:_0x4e2794[_0x4886e8(0x315)],'behaviors':_0x3ae00c?[..._0x4e2794[_0x4886e8(0x258)]||[],..._0x3ae00c]:_0x4e2794['behaviors'],'customerGroup':_0x4e2794[_0x4886e8(0x280)]},_0x3247a7=await withSpinner(_0x4886e8(0x2eb)+_0x2f082b+_0x4886e8(0x2bc),()=>_0x4fe354[_0x4886e8(0x24c)][_0x4886e8(0x216)](_0x2f082b,_0x3c44a4),{'verbose':_0x2f9d49[_0x4886e8(0x338)]}),_0x484fae=_0x3247a7[_0x4886e8(0x28c)];return console[_0x4886e8(0x1f7)](_0x4886e8(0x2e5)+_0x484fae[_0x4886e8(0x2ca)]+'\x27'),await handleSDKOutput([_0x484fae],_0x2f9d49),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x20e);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x238);async['execute'](_0x3c4738){const _0x3ee9d5=a22_0x4aa0a8,{options:_0x5a8528,args:_0xefa834,tdx:_0x35d722}=_0x3c4738,_0x153458=_0x5a8528,_0x52bf61=_0xefa834[0x0]||_0x5a8528[_0x3ee9d5(0x2de)];if(!_0x52bf61)return showParentSegmentNotSetError(_0x3ee9d5(0x2a5)+_0x3ee9d5(0x320)),0x1;if(_0x153458[_0x3ee9d5(0x295)]&&_0x153458[_0x3ee9d5(0x2f5)])return console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x2fa)](_0x3ee9d5(0x225))),console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x290)](_0x3ee9d5(0x245))),console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x290)](_0x3ee9d5(0x22f)+PARENT_SEGMENT_DIR+_0x3ee9d5(0x2fc))),console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x1f8)](_0x3ee9d5(0x2e1))),0x1;const _0x3c8eef=_0x153458[_0x3ee9d5(0x2f5)]||a22_0x2dd425[_0x3ee9d5(0x231)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x52bf61)+_0x3ee9d5(0x1f9));_0x153458['verbose']&&(console[_0x3ee9d5(0x1f7)](_0x3ee9d5(0x254)+_0x153458[_0x3ee9d5(0x339)]),console[_0x3ee9d5(0x1f7)](_0x3ee9d5(0x33f)+_0x52bf61),console['error'](_0x3ee9d5(0x262)+_0x3c8eef));const _0x1200b7=await withSpinner(_0x3ee9d5(0x2c7)+_0x52bf61+_0x3ee9d5(0x2bc),()=>_0x35d722[_0x3ee9d5(0x24c)][_0x3ee9d5(0x282)](_0x52bf61),{'verbose':_0x153458[_0x3ee9d5(0x338)]}),_0x31718b=_0x1200b7['data'];if(existsSync(_0x3c8eef)){const _0x2041c5=readFileSync(_0x3c8eef,_0x3ee9d5(0x32e)),_0x4f7e67=generateDiff(_0x2041c5,_0x31718b);if(!hasChanges(_0x4f7e67))console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x21d)]('✔')+_0x3ee9d5(0x2c6)+a22_0x47d034[_0x3ee9d5(0x1f8)](_0x3c8eef)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x3ee9d5(0x1f7)](_0x3ee9d5(0x2ba)+_0x3c8eef+'\x27:'),console[_0x3ee9d5(0x1f7)]('─'[_0x3ee9d5(0x2ac)](0x3c)),console[_0x3ee9d5(0x1f7)](formatDiffWithColors(_0x4f7e67)),console[_0x3ee9d5(0x1f7)]('─'[_0x3ee9d5(0x2ac)](0x3c));if(!_0x153458[_0x3ee9d5(0x30a)]){if(!isInteractive())return console['error'](a22_0x47d034[_0x3ee9d5(0x2fa)](_0x3ee9d5(0x289)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a22_0x47d034[_0x3ee9d5(0x290)](_0x3ee9d5(0x27d))),0x1;const _0x430833=await confirmKey(_0x3ee9d5(0x1ff)+_0x3c8eef+'\x27?');if(!_0x430833)return console['error'](a22_0x47d034['yellow'](_0x3ee9d5(0x1f0))),0x1;}writeFileSync(_0x3c8eef,_0x31718b,'utf-8'),console['error'](a22_0x47d034[_0x3ee9d5(0x21d)]('✔')+_0x3ee9d5(0x2c0)+a22_0x47d034['cyan'](_0x3c8eef));}}else{const _0x1edc94=a22_0x2dd425['dirname'](_0x3c8eef);!existsSync(_0x1edc94)&&mkdirSync(_0x1edc94,{'recursive':!![]}),writeFileSync(_0x3c8eef,_0x31718b,_0x3ee9d5(0x32e)),console[_0x3ee9d5(0x1f7)](a22_0x47d034[_0x3ee9d5(0x21d)]('✔')+_0x3ee9d5(0x2c0)+a22_0x47d034['cyan'](_0x3c8eef));}return saveSessionContext({'parent_segment':_0x52bf61},_0x153458[_0x3ee9d5(0x1f2)]),console['error'](a22_0x47d034[_0x3ee9d5(0x21d)]('✔')+_0x3ee9d5(0x29d)+a22_0x47d034[_0x3ee9d5(0x290)](_0x3ee9d5(0x311))+_0x3ee9d5(0x24e)+a22_0x47d034[_0x3ee9d5(0x1f8)](_0x52bf61)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x33d);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x250);async[a22_0x4aa0a8(0x269)](_0x354dea){const _0xfb76b9=a22_0x4aa0a8,{options:_0x39da89,args:_0x5708b2,tdx:_0x16eaf9}=_0x354dea,_0x1a6f11=_0x39da89,_0x183967=_0x5708b2[0x0]||_0x39da89['parentSegment'];if(!_0x183967)return showParentSegmentNotSetError(_0xfb76b9(0x217)+_0xfb76b9(0x255)),0x1;const _0x29152a=resolveYamlFile(_0x183967);if(!existsSync(_0x29152a))return showFileNotFoundError(_0x29152a,_0x183967),0x1;_0x1a6f11['verbose']&&(console[_0xfb76b9(0x1f7)]('Site:\x20'+_0x1a6f11[_0xfb76b9(0x339)]),console[_0xfb76b9(0x1f7)](_0xfb76b9(0x237)+_0x29152a));let _0x12b75f;try{_0x12b75f=readFileSync(_0x29152a,_0xfb76b9(0x32e));}catch(_0x7bfab){const _0x384f90=_0x7bfab instanceof Error?_0x7bfab['message']:String(_0x7bfab);return console[_0xfb76b9(0x1f7)](_0xfb76b9(0x29b)+_0x384f90),0x1;}const _0x4b0239=await withSpinner('Analyzing\x20changes...',()=>_0x16eaf9[_0xfb76b9(0x24c)][_0xfb76b9(0x2f7)](_0x12b75f),{'verbose':_0x1a6f11[_0xfb76b9(0x338)]}),_0x5c4dfc=_0x4b0239['data'],{isNew:_0x49cc73,name:_0x4cec2c,hasChanges:_0x4a390c,diffFormatted:_0x1f5c70}=_0x5c4dfc;if(!_0x4a390c)return console[_0xfb76b9(0x1f7)](_0xfb76b9(0x26e)+_0x4cec2c+_0xfb76b9(0x1f6)),0x0;_0x49cc73?console[_0xfb76b9(0x1f7)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x4cec2c+'\x27:'):console[_0xfb76b9(0x1f7)](_0xfb76b9(0x2d6)+_0x4cec2c+'\x27:');console[_0xfb76b9(0x1f7)]('─'[_0xfb76b9(0x2ac)](0x3c)),console[_0xfb76b9(0x1f7)](_0x1f5c70),console['error']('─'[_0xfb76b9(0x2ac)](0x3c));const _0x3daeeb=_0x49cc73?_0xfb76b9(0x261)+_0x4cec2c+'\x27?':_0xfb76b9(0x268)+_0x4cec2c+'\x27?';if(!_0x1a6f11[_0xfb76b9(0x30a)]){if(!isInteractive())return console[_0xfb76b9(0x1f7)](a22_0x47d034[_0xfb76b9(0x2fa)](_0xfb76b9(0x289)),_0xfb76b9(0x2b7)),console['error'](a22_0x47d034[_0xfb76b9(0x290)](_0xfb76b9(0x27d))),0x1;const _0x2964f4=await confirmKey(_0x3daeeb);if(!_0x2964f4)return console[_0xfb76b9(0x1f7)](a22_0x47d034[_0xfb76b9(0x20f)]('Aborted.')),0x1;}const _0x1ccd2b=_0x49cc73?_0xfb76b9(0x2bd):'Updating',_0x5e9aee=await withSpinner(_0x1ccd2b+_0xfb76b9(0x2ed)+_0x4cec2c+_0xfb76b9(0x2bc),()=>_0x5c4dfc[_0xfb76b9(0x2cc)](),{'verbose':_0x1a6f11[_0xfb76b9(0x338)]}),_0x380f8b=_0x5e9aee[_0xfb76b9(0x28c)],_0x288e36=getConsoleNextUrl(_0x1a6f11[_0xfb76b9(0x339)],'/app/dw/parentSegments/'+_0x380f8b['id']),_0x5ae0e4=_0x49cc73?_0xfb76b9(0x2dc):'Updated';return console['error']('✔\x20'+_0x5ae0e4+_0xfb76b9(0x2ed)+_0x380f8b['name']+'\x27'),console[_0xfb76b9(0x1f7)]('\x20\x20'+_0x288e36),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x2cb);['description']=a22_0x4aa0a8(0x206);async['execute'](_0x116832){const _0x48f013=a22_0x4aa0a8,{options:_0x2bd719,args:_0x953598,tdx:_0x4f144c}=_0x116832,_0x215207=_0x2bd719,_0x5777f8=_0x953598[0x0]||_0x2bd719[_0x48f013(0x2de)];if(!_0x5777f8)return showParentSegmentNotSetError(_0x48f013(0x2e7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x48f013(0x20b)+_0x48f013(0x256)+_0x48f013(0x203)+_0x48f013(0x276)),0x1;const _0x4730bd=resolveYamlFile(_0x5777f8);if(!existsSync(_0x4730bd))return showFileNotFoundError(_0x4730bd,_0x5777f8),0x1;_0x215207[_0x48f013(0x338)]&&(console[_0x48f013(0x1f7)](_0x48f013(0x254)+_0x215207['site']),console[_0x48f013(0x1f7)]('YAML\x20file:\x20'+_0x4730bd));let _0x475b50;try{_0x475b50=readFileSync(_0x4730bd,_0x48f013(0x32e));}catch(_0x1b31e7){const _0x325914=_0x1b31e7 instanceof Error?_0x1b31e7[_0x48f013(0x326)]:String(_0x1b31e7);return console['error']('Error\x20reading\x20file:\x20'+_0x325914),0x1;}const _0x13499b=createCommandSpinner(a22_0x47d034[_0x48f013(0x290)]('Validating\x20configuration...'),{'verbose':_0x215207[_0x48f013(0x338)]});_0x13499b[_0x48f013(0x30e)]();const _0x30e6a7={'onProgress':_0x7d9e11=>{const _0x1e7fe9=_0x48f013;_0x13499b[_0x1e7fe9(0x317)]=formatProgressMessage(_0x7d9e11);}};if(_0x215207[_0x48f013(0x201)])_0x30e6a7[_0x48f013(0x201)]=!![];if(_0x215207[_0x48f013(0x26c)])_0x30e6a7[_0x48f013(0x26c)]=!![];_0x215207['attribute']&&(_0x30e6a7[_0x48f013(0x302)]=_0x215207[_0x48f013(0x302)]);_0x215207[_0x48f013(0x214)]&&(_0x30e6a7[_0x48f013(0x214)]=_0x215207[_0x48f013(0x214)]);if(_0x215207[_0x48f013(0x233)])_0x30e6a7[_0x48f013(0x233)]=_0x215207[_0x48f013(0x233)];let _0x15e4a7;try{_0x15e4a7=await _0x4f144c['segment'][_0x48f013(0x278)](_0x475b50,_0x30e6a7),_0x13499b['stop']();}catch(_0x1edb6b){_0x13499b['stop']();throw _0x1edb6b;}const _0x4cff47=_0x215207[_0x48f013(0x233)]||_0x48f013(0x2e2);return this[_0x48f013(0x2fb)](_0x15e4a7,_0x30e6a7,_0x4730bd,_0x4cff47),_0x15e4a7['allValid']?0x0:0x1;}['displayValidateResults'](_0x5d2012,_0x1485d7,_0x130612,_0x26a659){const _0x223ee6=a22_0x4aa0a8;console['error']('\x0a'+a22_0x47d034[_0x223ee6(0x23c)]('Validate:')+'\x20'+_0x5d2012[_0x223ee6(0x2ca)]),console[_0x223ee6(0x1f7)]('═'[_0x223ee6(0x2ac)](0x3c)),this[_0x223ee6(0x28b)](_0x5d2012);if(typeof _0x1485d7['attribute']===_0x223ee6(0x2b1)){this[_0x223ee6(0x20d)](_0x5d2012),this[_0x223ee6(0x333)](_0x5d2012),this['displayPreviewHints'](_0x130612,_0x26a659,_0x223ee6(0x302),_0x1485d7[_0x223ee6(0x302)]);return;}if(_0x1485d7[_0x223ee6(0x302)]===!![]){this['displayAttributesStats'](_0x5d2012),this['displaySummary'](_0x5d2012),this['displayPreviewHints'](_0x130612,_0x26a659,'attributes');return;}if(typeof _0x1485d7[_0x223ee6(0x214)]===_0x223ee6(0x2b1)){this[_0x223ee6(0x2c3)](_0x5d2012,_0x26a659),this['displaySummary'](_0x5d2012),this[_0x223ee6(0x209)](_0x130612,_0x26a659,_0x223ee6(0x214),_0x1485d7[_0x223ee6(0x214)]);return;}if(_0x1485d7[_0x223ee6(0x214)]===!![]){this[_0x223ee6(0x2c3)](_0x5d2012,_0x26a659),this[_0x223ee6(0x333)](_0x5d2012),this['displayPreviewHints'](_0x130612,_0x26a659,_0x223ee6(0x258));return;}this[_0x223ee6(0x20d)](_0x5d2012),this[_0x223ee6(0x2c3)](_0x5d2012,_0x26a659),this[_0x223ee6(0x333)](_0x5d2012),this[_0x223ee6(0x209)](_0x130612,_0x26a659,_0x223ee6(0x1ee));}['displayPreviewHints'](_0xc5c852,_0x4ae7cb,_0x152a0f,_0x2cf764){const _0xe132e9=a22_0x4aa0a8;console['error']('\x0a'+a22_0x47d034[_0xe132e9(0x290)](_0xe132e9(0x23a)));const _0x2c32e7=_0x4ae7cb!=='-1d'?_0xe132e9(0x21b)+_0x4ae7cb:'';if(_0x152a0f===_0xe132e9(0x302)&&_0x2cf764)console[_0xe132e9(0x1f7)]('\x20\x20'+a22_0x47d034[_0xe132e9(0x290)](_0xe132e9(0x33b)+_0xc5c852+'\x20--attribute\x20\x22'+_0x2cf764+'\x22'+_0x2c32e7));else{if(_0x152a0f===_0xe132e9(0x214)&&_0x2cf764)console[_0xe132e9(0x1f7)]('\x20\x20'+a22_0x47d034[_0xe132e9(0x290)](_0xe132e9(0x33b)+_0xc5c852+_0xe132e9(0x28e)+_0x2cf764+'\x22'+_0x2c32e7));else(_0x152a0f===_0xe132e9(0x315)||_0x152a0f===_0xe132e9(0x1ee))&&console[_0xe132e9(0x1f7)]('\x20\x20'+a22_0x47d034[_0xe132e9(0x290)](_0xe132e9(0x33b)+_0xc5c852+'\x20--attribute\x20\x22<name>\x22'+_0x2c32e7));}(_0x152a0f===_0xe132e9(0x258)||_0x152a0f===_0xe132e9(0x1ee))&&console[_0xe132e9(0x1f7)]('\x20\x20'+a22_0x47d034['dim'](_0xe132e9(0x33b)+_0xc5c852+'\x20--behavior\x20\x22<name>\x22'+_0x2c32e7)),_0x152a0f===_0xe132e9(0x1ee)&&console[_0xe132e9(0x1f7)]('\x20\x20'+a22_0x47d034[_0xe132e9(0x290)](_0xe132e9(0x33b)+_0xc5c852+'\x20--enriched'+_0x2c32e7));}[a22_0x4aa0a8(0x28b)](_0x3b36b2){const _0x5cc434=a22_0x4aa0a8,{master:_0x113247}=_0x3b36b2,_0x3d51f3=_0x113247[_0x5cc434(0x336)]?a22_0x47d034[_0x5cc434(0x21d)]('✔'):a22_0x47d034[_0x5cc434(0x2fa)]('✘');console[_0x5cc434(0x1f7)]('\x0a'+a22_0x47d034[_0x5cc434(0x290)](_0x5cc434(0x212))),console[_0x5cc434(0x1f7)](_0x3d51f3+'\x20'+a22_0x47d034[_0x5cc434(0x23c)](_0x113247[_0x5cc434(0x2f4)]+'.'+_0x113247[_0x5cc434(0x2e9)])),_0x113247['schemaValid']?_0x113247[_0x5cc434(0x29a)]!==undefined&&console[_0x5cc434(0x1f7)]('\x20\x20'+a22_0x47d034[_0x5cc434(0x290)](_0x5cc434(0x301))+'\x20'+a22_0x47d034[_0x5cc434(0x1f8)](formatRows(_0x113247[_0x5cc434(0x29a)]))):console[_0x5cc434(0x1f7)]('\x20\x20'+a22_0x47d034[_0x5cc434(0x2fa)](_0x5cc434(0x243))+'\x20'+_0x113247[_0x5cc434(0x2be)]);}[a22_0x4aa0a8(0x20d)](_0x28fa51){const _0x14f190=a22_0x4aa0a8;if(_0x28fa51[_0x14f190(0x315)][_0x14f190(0x309)]===0x0)return;console[_0x14f190(0x1f7)]('\x0a'+a22_0x47d034['dim'](_0x14f190(0x327)));for(const _0x16eb67 of _0x28fa51['attributes']){const _0x40fff2=_0x16eb67[_0x14f190(0x336)]?a22_0x47d034[_0x14f190(0x21d)]('✔'):a22_0x47d034['red']('✘');let _0x4b5de2='';if(_0x16eb67[_0x14f190(0x336)]&&_0x16eb67['matchedCount']!==undefined&&_0x16eb67[_0x14f190(0x2c5)]!==undefined){const _0x43e948=_0x16eb67[_0x14f190(0x2c5)]['toFixed'](0x1),_0xa53e2f=_0x16eb67[_0x14f190(0x2c5)]>=0x50?a22_0x47d034[_0x14f190(0x21d)]:_0x16eb67[_0x14f190(0x2c5)]>=0x32?a22_0x47d034[_0x14f190(0x20f)]:a22_0x47d034[_0x14f190(0x2fa)];_0x4b5de2='\x20'+a22_0x47d034[_0x14f190(0x290)](_0x14f190(0x246))+'\x20'+_0xa53e2f(_0x43e948+'%')+'\x20('+formatRows(_0x16eb67[_0x14f190(0x266)])+_0x14f190(0x300);}console[_0x14f190(0x1f7)](_0x40fff2+'\x20'+a22_0x47d034['bold'](_0x16eb67[_0x14f190(0x2ca)])+_0x4b5de2),console['error']('\x20\x20'+a22_0x47d034[_0x14f190(0x290)](_0x14f190(0x310))+'\x20'+a22_0x47d034[_0x14f190(0x23c)](_0x16eb67[_0x14f190(0x2f4)]+'.'+_0x16eb67[_0x14f190(0x2e9)]));const _0x494f04=_0x16eb67[_0x14f190(0x306)]===_0x16eb67['foreignKey']?a22_0x47d034['dim']('Join\x20on:')+'\x20'+_0x16eb67[_0x14f190(0x306)]:a22_0x47d034[_0x14f190(0x290)]('Join:')+'\x20'+_0x16eb67[_0x14f190(0x306)]+'\x20=\x20'+_0x16eb67[_0x14f190(0x257)];console[_0x14f190(0x1f7)]('\x20\x20'+_0x494f04),console[_0x14f190(0x1f7)]('\x20\x20'+a22_0x47d034[_0x14f190(0x290)](_0x14f190(0x2bb))),this[_0x14f190(0x202)](_0x16eb67['columns']),!_0x16eb67['schemaValid']&&console[_0x14f190(0x1f7)]('\x20\x20'+a22_0x47d034[_0x14f190(0x2fa)](_0x14f190(0x243))+'\x20'+_0x16eb67[_0x14f190(0x2be)]);}}[a22_0x4aa0a8(0x2c3)](_0x3723ae,_0x4a519d){const _0x4374c1=a22_0x4aa0a8;if(_0x3723ae[_0x4374c1(0x258)][_0x4374c1(0x309)]===0x0)return;console['error']('\x0a'+a22_0x47d034['dim'](_0x4374c1(0x211))+'\x20'+a22_0x47d034[_0x4374c1(0x290)]('('+_0x4a519d+')'));for(const _0x133a9a of _0x3723ae[_0x4374c1(0x258)]){const _0x577edd=_0x133a9a[_0x4374c1(0x336)]?a22_0x47d034[_0x4374c1(0x21d)]('✔'):a22_0x47d034[_0x4374c1(0x2fa)]('✘');let _0x29b49f='';if(_0x133a9a['schemaValid']&&_0x133a9a[_0x4374c1(0x33a)]!==undefined&&_0x133a9a['totalEvents']!==undefined){const _0x4e8626=_0x133a9a[_0x4374c1(0x241)]?.[_0x4374c1(0x321)](0x1)||'?',_0x17fae5=(_0x133a9a['customerPercent']??0x0)>=0x32?a22_0x47d034[_0x4374c1(0x21d)]:(_0x133a9a[_0x4374c1(0x241)]??0x0)>=0x14?a22_0x47d034[_0x4374c1(0x20f)]:a22_0x47d034['red'];_0x29b49f='\x20'+a22_0x47d034[_0x4374c1(0x290)](_0x4374c1(0x2f2))+'\x20'+_0x17fae5(formatRows(_0x133a9a[_0x4374c1(0x33a)]))+'\x20('+_0x4e8626+'%)\x20'+a22_0x47d034['dim'](_0x4374c1(0x205))+'\x20'+a22_0x47d034[_0x4374c1(0x1f8)](formatRows(_0x133a9a[_0x4374c1(0x2d9)]));}console['error'](_0x577edd+'\x20'+a22_0x47d034[_0x4374c1(0x23c)](_0x133a9a[_0x4374c1(0x2ca)])+_0x29b49f),console['error']('\x20\x20'+a22_0x47d034[_0x4374c1(0x290)](_0x4374c1(0x310))+'\x20'+a22_0x47d034['bold'](_0x133a9a['database']+'.'+_0x133a9a['table']));const _0x2039ad=_0x133a9a[_0x4374c1(0x306)]===_0x133a9a[_0x4374c1(0x257)]?a22_0x47d034['dim'](_0x4374c1(0x220))+'\x20'+_0x133a9a[_0x4374c1(0x306)]:a22_0x47d034[_0x4374c1(0x290)](_0x4374c1(0x2cf))+'\x20'+_0x133a9a['joinKey']+_0x4374c1(0x24e)+_0x133a9a['foreignKey'];console[_0x4374c1(0x1f7)]('\x20\x20'+_0x2039ad),console[_0x4374c1(0x1f7)]('\x20\x20'+a22_0x47d034[_0x4374c1(0x290)](_0x4374c1(0x2bb))),this['displayColumns'](_0x133a9a[_0x4374c1(0x337)]),!_0x133a9a[_0x4374c1(0x336)]&&console['error']('\x20\x20'+a22_0x47d034[_0x4374c1(0x2fa)](_0x4374c1(0x243))+'\x20'+_0x133a9a['schemaError']);}}[a22_0x4aa0a8(0x202)](_0x570b0f){const _0x409d7d=a22_0x4aa0a8;for(const _0x5e444a of _0x570b0f){_0x5e444a[_0x409d7d(0x2ab)]===_0x5e444a[_0x409d7d(0x324)]||_0x5e444a[_0x409d7d(0x324)]==='*'?console[_0x409d7d(0x1f7)]('\x20\x20\x20\x20-\x20'+_0x5e444a['label']):console[_0x409d7d(0x1f7)](_0x409d7d(0x232)+_0x5e444a[_0x409d7d(0x2ab)]+'\x20'+a22_0x47d034[_0x409d7d(0x290)]('('+_0x5e444a['column']+')'));}}[a22_0x4aa0a8(0x333)](_0x12cc67){const _0x41d845=a22_0x4aa0a8;console['error']('─'[_0x41d845(0x2ac)](0x3c));if(_0x12cc67['errors']['length']>0x0){console[_0x41d845(0x1f7)]('\x0a'+a22_0x47d034[_0x41d845(0x2fa)]('Errors:'));for(const _0x188180 of _0x12cc67['errors']){console[_0x41d845(0x1f7)]('\x20\x20'+a22_0x47d034[_0x41d845(0x2fa)]('•')+'\x20'+_0x188180);}}_0x12cc67[_0x41d845(0x2c2)]&&console['error']('\x0a'+a22_0x47d034['green']('✔')+_0x41d845(0x2b3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x208);['description']=a22_0x4aa0a8(0x2c9);async[a22_0x4aa0a8(0x269)](_0x1c730e){const _0x371a53=a22_0x4aa0a8,{options:_0x2c1dee,args:_0x22dc2e,tdx:_0x56fe26}=_0x1c730e,_0x489ca=_0x2c1dee,_0x27078d=_0x22dc2e[0x0]||_0x2c1dee[_0x371a53(0x2de)];if(!_0x27078d)return showParentSegmentNotSetError(_0x371a53(0x28d)+_0x371a53(0x20a)+_0x371a53(0x21c)+_0x371a53(0x32a)+_0x371a53(0x2db)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x371a53(0x308)+_0x371a53(0x276)),0x1;if(!_0x489ca[_0x371a53(0x201)]&&!_0x489ca[_0x371a53(0x302)]&&!_0x489ca[_0x371a53(0x214)]&&!_0x489ca[_0x371a53(0x26c)])return console[_0x371a53(0x1f7)](a22_0x47d034['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x371a53(0x1f7)](_0x371a53(0x25d)),console[_0x371a53(0x1f7)](_0x371a53(0x1fd)),console[_0x371a53(0x1f7)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x371a53(0x1f7)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x371a53(0x1f7)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x371a53(0x1f7)](_0x371a53(0x22a)),0x1;const _0x421354=resolveYamlFile(_0x27078d);if(!existsSync(_0x421354))return showFileNotFoundError(_0x421354,_0x27078d),0x1;_0x489ca[_0x371a53(0x338)]&&(console[_0x371a53(0x1f7)]('Site:\x20'+_0x489ca[_0x371a53(0x339)]),console[_0x371a53(0x1f7)]('YAML\x20file:\x20'+_0x421354));let _0x2abbdd;try{_0x2abbdd=readFileSync(_0x421354,_0x371a53(0x32e));}catch(_0x2e7211){const _0x4b0dfd=_0x2e7211 instanceof Error?_0x2e7211['message']:String(_0x2e7211);return console[_0x371a53(0x1f7)](_0x371a53(0x29b)+_0x4b0dfd),0x1;}let _0x56e138;try{_0x56e138=parseDef(_0x2abbdd);}catch(_0x10aacb){const _0x15c6e5=_0x10aacb instanceof Error?_0x10aacb[_0x371a53(0x326)]:String(_0x10aacb);return console[_0x371a53(0x1f7)](a22_0x47d034[_0x371a53(0x2fa)](_0x371a53(0x328)+_0x15c6e5)),0x1;}if(_0x489ca['attribute']===!![]||_0x489ca[_0x371a53(0x302)]===''){const _0x3a2edf=_0x56e138[_0x371a53(0x315)]?.[_0x371a53(0x2fd)](_0x1938cf=>_0x1938cf[_0x371a53(0x2ca)])||[];if(_0x3a2edf[_0x371a53(0x309)]===0x0)console['error'](a22_0x47d034[_0x371a53(0x2fa)](_0x371a53(0x283)));else{console[_0x371a53(0x1f7)](a22_0x47d034[_0x371a53(0x2fa)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x371a53(0x1f7)](_0x371a53(0x2dd));for(const _0x37e4dd of _0x3a2edf){console['error']('\x20\x20'+a22_0x47d034[_0x371a53(0x1f8)](_0x37e4dd));}console[_0x371a53(0x1f7)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x27078d+_0x371a53(0x271)+_0x3a2edf[0x0]+'\x22');}return 0x1;}if(_0x489ca[_0x371a53(0x214)]===!![]||_0x489ca[_0x371a53(0x214)]===''){const _0x36daf2=_0x56e138[_0x371a53(0x258)]?.['map'](_0x20b7c9=>_0x20b7c9[_0x371a53(0x2ca)])||[];if(_0x36daf2['length']===0x0)console[_0x371a53(0x1f7)](a22_0x47d034[_0x371a53(0x2fa)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x371a53(0x1f7)](a22_0x47d034[_0x371a53(0x2fa)](_0x371a53(0x281))),console[_0x371a53(0x1f7)](_0x371a53(0x24a));for(const _0x4d0d69 of _0x36daf2){console[_0x371a53(0x1f7)]('\x20\x20'+a22_0x47d034[_0x371a53(0x1f8)](_0x4d0d69));}console[_0x371a53(0x1f7)](_0x371a53(0x2a4)+_0x27078d+_0x371a53(0x28e)+_0x36daf2[0x0]+'\x22');}return 0x1;}const _0x380329=createCommandSpinner(a22_0x47d034[_0x371a53(0x290)]('Fetching\x20sample\x20data...'),{'verbose':_0x489ca['verbose']});_0x380329[_0x371a53(0x30e)]();const _0x37a847={'onProgress':_0x2c8e26=>{_0x380329['text']=formatProgressMessage(_0x2c8e26);}};if(_0x489ca[_0x371a53(0x201)])_0x37a847[_0x371a53(0x201)]=!![];if(_0x489ca[_0x371a53(0x302)]&&typeof _0x489ca['attribute']===_0x371a53(0x2b1))_0x37a847[_0x371a53(0x302)]=_0x489ca['attribute'];if(_0x489ca[_0x371a53(0x214)]&&typeof _0x489ca[_0x371a53(0x214)]===_0x371a53(0x2b1))_0x37a847[_0x371a53(0x214)]=_0x489ca[_0x371a53(0x214)];if(_0x489ca['enriched'])_0x37a847['enriched']=!![];if(_0x489ca[_0x371a53(0x233)])_0x37a847[_0x371a53(0x233)]=_0x489ca[_0x371a53(0x233)];let _0x72b406;try{_0x72b406=await _0x56fe26[_0x371a53(0x24c)][_0x371a53(0x272)](_0x2abbdd,_0x37a847),_0x380329['stop']();}catch(_0x272cea){_0x380329[_0x371a53(0x2a2)]();throw _0x272cea;}return await this[_0x371a53(0x322)](_0x72b406,{'master':_0x489ca[_0x371a53(0x201)],'attribute':typeof _0x489ca[_0x371a53(0x302)]==='string'?_0x489ca[_0x371a53(0x302)]:undefined,'behavior':typeof _0x489ca[_0x371a53(0x214)]==='string'?_0x489ca['behavior']:undefined,'enriched':_0x489ca[_0x371a53(0x26c)]}),_0x72b406[_0x371a53(0x2c2)]?0x0:0x1;}async[a22_0x4aa0a8(0x322)](_0x174de0,_0x5cda53){const _0x38a090=a22_0x4aa0a8;console[_0x38a090(0x1f7)]('\x0a'+a22_0x47d034[_0x38a090(0x23c)](_0x38a090(0x31a))+'\x20'+_0x174de0[_0x38a090(0x2ca)]),console['error']('═'[_0x38a090(0x2ac)](0x3c));if(_0x5cda53[_0x38a090(0x201)]&&_0x174de0[_0x38a090(0x304)]){const _0x42c7f4=a22_0x47d034['dim'](_0x38a090(0x29f))+'\x20'+a22_0x47d034[_0x38a090(0x23c)](_0x174de0[_0x38a090(0x201)][_0x38a090(0x2f4)]+'.'+_0x174de0[_0x38a090(0x201)][_0x38a090(0x2e9)]);await this[_0x38a090(0x204)](_0x42c7f4,_0x174de0[_0x38a090(0x304)]);}else{if(_0x5cda53[_0x38a090(0x302)]&&_0x174de0[_0x38a090(0x304)]){const _0x5724a9=a22_0x47d034['dim'](_0x38a090(0x2b8))+'\x20'+a22_0x47d034[_0x38a090(0x23c)](_0x5cda53[_0x38a090(0x302)]);await this[_0x38a090(0x204)](_0x5724a9,_0x174de0[_0x38a090(0x304)]);}else{if(_0x5cda53[_0x38a090(0x214)]&&_0x174de0[_0x38a090(0x304)]){const _0x43f2ad=a22_0x47d034['dim'](_0x38a090(0x284))+'\x20'+a22_0x47d034[_0x38a090(0x23c)](_0x5cda53[_0x38a090(0x214)]);await this[_0x38a090(0x204)](_0x43f2ad,_0x174de0[_0x38a090(0x304)]);}else{if(_0x5cda53[_0x38a090(0x26c)]&&_0x174de0['sampleData']){const _0x590b3b=a22_0x47d034[_0x38a090(0x290)](_0x38a090(0x297))+'\x20'+a22_0x47d034[_0x38a090(0x23c)]('Master\x20+\x20Attributes');await this[_0x38a090(0x204)](_0x590b3b,_0x174de0['sampleData']);}else!_0x174de0[_0x38a090(0x304)]&&console['error'](_0x38a090(0x2d1));}}}if(_0x174de0[_0x38a090(0x20c)][_0x38a090(0x309)]>0x0){console[_0x38a090(0x1f7)]('─'[_0x38a090(0x2ac)](0x3c)),console[_0x38a090(0x1f7)]('\x0a'+a22_0x47d034[_0x38a090(0x2fa)](_0x38a090(0x213)));for(const _0x3758c9 of _0x174de0['errors']){console[_0x38a090(0x1f7)]('\x20\x20'+a22_0x47d034[_0x38a090(0x2fa)]('•')+'\x20'+_0x3758c9);}}}async[a22_0x4aa0a8(0x204)](_0x2c49a0,_0x23c86c){const _0x456bfe=a22_0x4aa0a8;if(_0x23c86c['length']===0x0){console['error']('\x0a'+_0x2c49a0),console[_0x456bfe(0x1f7)](_0x456bfe(0x27c));return;}console[_0x456bfe(0x1f7)]('\x0a'+_0x2c49a0);const _0x4359db=Object['keys'](_0x23c86c[0x0])[_0x456bfe(0x2fd)](_0x199293=>({'name':_0x199293,'type':typeof _0x23c86c[0x0][_0x199293]===_0x456bfe(0x22e)?_0x456bfe(0x2c8):_0x456bfe(0x210)})),_0x43dd25={'queryId':'preview','columns':_0x4359db,'data':_0x23c86c,'stats':{'state':_0x456bfe(0x319),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x23c86c[_0x456bfe(0x309)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4adc1e=formatAsTable(_0x43dd25,_0x23c86c[_0x456bfe(0x309)],!![]);await writeOutput(_0x4adc1e,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x234);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x1ec);async[a22_0x4aa0a8(0x269)](_0x266580){const _0x528644=a22_0x4aa0a8,{options:_0x5275d8,args:_0x43aedf,tdx:_0x473dec}=_0x266580,_0x29112c=_0x5275d8,_0x5771d0=_0x43aedf[0x0]||_0x5275d8[_0x528644(0x2de)];if(!_0x5771d0)return showParentSegmentNotSetError(_0x528644(0x223)+_0x528644(0x1f5)),0x1;const _0x4ceb33=resolveYamlFile(_0x5771d0);if(existsSync(_0x4ceb33)){_0x29112c[_0x528644(0x338)]&&console[_0x528644(0x1f7)](_0x528644(0x33e)+_0x4ceb33);let _0x3764a5;try{_0x3764a5=readFileSync(_0x4ceb33,_0x528644(0x32e));}catch(_0x510aaa){const _0x4afe49=_0x510aaa instanceof Error?_0x510aaa[_0x528644(0x326)]:String(_0x510aaa);return console[_0x528644(0x1f7)](_0x528644(0x29b)+_0x4afe49),0x1;}const _0x4296fb=await withSpinner(_0x528644(0x252),()=>_0x473dec[_0x528644(0x24c)][_0x528644(0x2f7)](_0x3764a5),{'verbose':_0x29112c[_0x528644(0x338)]}),_0x4b48c0=_0x4296fb[_0x528644(0x28c)],{isNew:_0x9cee5f,name:_0x7061a3,hasChanges:_0x18c7a7,diffFormatted:_0x4ee384}=_0x4b48c0;if(_0x18c7a7){_0x9cee5f?console['error'](_0x528644(0x2ef)+_0x7061a3+'\x27:'):console[_0x528644(0x1f7)](_0x528644(0x2d6)+_0x7061a3+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x4ee384),console[_0x528644(0x1f7)]('─'['repeat'](0x3c));const _0x2c7549=_0x9cee5f?_0x528644(0x261)+_0x7061a3+_0x528644(0x2ec):_0x528644(0x268)+_0x7061a3+_0x528644(0x2ec);if(!_0x29112c['yes']){if(!isInteractive())return console[_0x528644(0x1f7)](a22_0x47d034['red'](_0x528644(0x289)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x528644(0x1f7)](a22_0x47d034[_0x528644(0x290)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x450e5f=await confirmKey(_0x2c7549);if(!_0x450e5f)return console[_0x528644(0x1f7)](a22_0x47d034[_0x528644(0x20f)](_0x528644(0x1f0))),0x1;}const _0xdc7d6b=_0x9cee5f?_0x528644(0x2bd):_0x528644(0x2a0);await withSpinner(_0xdc7d6b+_0x528644(0x2ed)+_0x7061a3+_0x528644(0x2bc),()=>_0x4b48c0[_0x528644(0x2cc)](),{'verbose':_0x29112c[_0x528644(0x338)]});const _0x1d6bf1=_0x9cee5f?_0x528644(0x2dc):_0x528644(0x224);console[_0x528644(0x1f7)]('✔\x20'+_0x1d6bf1+'\x20parent\x20segment\x20\x27'+_0x7061a3+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x7061a3+_0x528644(0x248));}const _0x476383=await withSpinner(_0x528644(0x286)+_0x5771d0+_0x528644(0x2bc),()=>_0x473dec[_0x528644(0x24c)][_0x528644(0x2ce)](_0x5771d0),{'verbose':_0x29112c[_0x528644(0x338)]}),_0x111901=_0x476383[_0x528644(0x28c)],_0x9c6ade=getConsoleUrl(_0x29112c[_0x528644(0x339)],_0x528644(0x2bf)+_0x111901[_0x528644(0x2a6)]+_0x528644(0x23d)+_0x111901[_0x528644(0x33c)]+_0x528644(0x2d7)+_0x111901[_0x528644(0x1f4)]);return console['error'](_0x528644(0x28f)),console[_0x528644(0x1f7)]('\x20\x20'+a22_0x47d034[_0x528644(0x290)](_0x528644(0x31e))+'\x20'+_0x111901[_0x528644(0x335)]),console[_0x528644(0x1f7)]('\x20\x20'+a22_0x47d034[_0x528644(0x290)](_0x528644(0x264))+'\x20'+_0x111901[_0x528644(0x312)]),console[_0x528644(0x1f7)]('\x20\x20'+a22_0x47d034[_0x528644(0x290)](_0x528644(0x2b6))+'\x20'+_0x111901[_0x528644(0x33c)]),console[_0x528644(0x1f7)]('\x20\x20'+a22_0x47d034[_0x528644(0x290)]('Attempt:')+'\x20'+_0x111901[_0x528644(0x1f4)]),console[_0x528644(0x1f7)]('\x20\x20'+_0x9c6ade),console[_0x528644(0x1f7)]('\x0a'+a22_0x47d034[_0x528644(0x290)](_0x528644(0x2ff))+'\x20tdx\x20wf\x20attempt\x20'+_0x111901[_0x528644(0x1f4)]+_0x528644(0x229)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a22_0x4aa0a8(0x239)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x1bb412){const _0x15fd5e=a22_0x4aa0a8,{options:_0x447930,args:_0x59192e,tdx:_0x19b084}=_0x1bb412,_0x418d25=_0x59192e[0x0]||_0x447930[_0x15fd5e(0x2de)];if(!_0x418d25)return showParentSegmentNotSetError(_0x15fd5e(0x2b2)+'\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;_0x447930[_0x15fd5e(0x338)]&&(console[_0x15fd5e(0x1f7)]('Site:\x20'+_0x447930[_0x15fd5e(0x339)]),console[_0x15fd5e(0x1f7)](_0x15fd5e(0x33f)+_0x418d25));const _0x272532=await withSpinner(_0x15fd5e(0x260)+_0x418d25+_0x15fd5e(0x2bc),()=>_0x19b084[_0x15fd5e(0x24c)][_0x15fd5e(0x305)](_0x418d25),{'verbose':_0x447930['verbose']}),_0x19aac0=_0x272532[_0x15fd5e(0x28c)];console['error']('✔\x20Found\x20'+_0x19aac0['length']+_0x15fd5e(0x277)+(_0x19aac0[_0x15fd5e(0x309)]!==0x1?'s':''));if(_0x447930[_0x15fd5e(0x274)]||_0x447930[_0x15fd5e(0x330)])return await handleSDKOutput(_0x19aac0,_0x447930),0x0;return displayFieldsHumanReadable(_0x19aac0,_0x418d25),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x2f9);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x31f);async[a22_0x4aa0a8(0x269)](_0x38d52f){const _0x35a275=a22_0x4aa0a8,{options:_0x3c5582,args:_0x40631f,tdx:_0xc2d65f}=_0x38d52f,_0x5a92d6=_0x3c5582,_0x523f6e=_0x40631f[0x0]||_0x3c5582['parentSegment'];if(!_0x523f6e)return showParentSegmentNotSetError(_0x35a275(0x253)+_0x35a275(0x27f)+_0x35a275(0x20b)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x3c5582[_0x35a275(0x338)]&&(console[_0x35a275(0x1f7)](_0x35a275(0x254)+_0x3c5582['site']),console['error']('Parent\x20segment:\x20'+_0x523f6e));const _0x3a0bd6=await withSpinner(_0x35a275(0x2c7)+_0x523f6e+_0x35a275(0x2bc),()=>_0xc2d65f[_0x35a275(0x24c)][_0x35a275(0x2d4)](_0x523f6e),{'verbose':_0x3c5582[_0x35a275(0x338)]}),_0x3d3f5b=_0x3a0bd6[_0x35a275(0x28c)];if(_0x5a92d6[_0x35a275(0x1fe)]){const _0x9891fe=getConsoleNextUrl(_0x5a92d6[_0x35a275(0x339)],'/app/dw/parentSegments/'+_0x3d3f5b['id']);return console['error'](a22_0x47d034[_0x35a275(0x21d)]('✔')+_0x35a275(0x32f)+a22_0x47d034['cyan'](_0x9891fe)),openBrowser(_0x9891fe),0x0;}return await handleSingleObjectOutput(_0x3d3f5b,_0x3c5582),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x4aa0a8(0x2ca)]=a22_0x4aa0a8(0x26a);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x298);async[a22_0x4aa0a8(0x269)](_0x2e773e){const _0xa81a9a=a22_0x4aa0a8,{options:_0x27dd53,args:_0x314576,tdx:_0x43ad7a}=_0x2e773e,_0x2a355f=_0x27dd53,_0x73289b=_0x314576[0x0]||_0x27dd53['parentSegment'];if(!_0x73289b)return showParentSegmentNotSetError(_0xa81a9a(0x2a8)+'\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'+_0xa81a9a(0x20b)+_0xa81a9a(0x325)),0x1;_0x27dd53[_0xa81a9a(0x338)]&&(console[_0xa81a9a(0x1f7)](_0xa81a9a(0x254)+_0x27dd53[_0xa81a9a(0x339)]),console['error'](_0xa81a9a(0x33f)+_0x73289b));const _0x5252a6=await withSpinner(_0xa81a9a(0x30c)+_0x73289b+'\x27...',()=>_0x43ad7a[_0xa81a9a(0x24c)][_0xa81a9a(0x259)](_0x73289b),{'verbose':_0x27dd53['verbose']}),_0x5623f5=_0x5252a6['data'],_0x52f0da=_0x43ad7a[_0xa81a9a(0x24c)][_0xa81a9a(0x1f3)](_0x5623f5);if(_0x2a355f[_0xa81a9a(0x2f5)]){const _0x3b0abe=await this['collectSchema'](_0x2e773e,_0x73289b,_0x5623f5,_0x52f0da),_0x4820bb=this[_0xa81a9a(0x1ef)](_0x3b0abe);writeFileSync(_0x2a355f['output'],_0x4820bb);const _0x1fd62d=_0x3b0abe[_0xa81a9a(0x2d5)][_0xa81a9a(0x337)]['length']+_0x3b0abe[_0xa81a9a(0x258)][_0xa81a9a(0x2c1)]((_0x473a0e,_0x1080ed)=>_0x473a0e+_0x1080ed['columns']['length'],0x0),_0x575b1d=_0x3b0abe['behaviors'][_0xa81a9a(0x1fa)](_0x1677f6=>_0x1677f6[_0xa81a9a(0x337)][_0xa81a9a(0x309)]===0x0)[_0xa81a9a(0x309)];return console['log'](_0xa81a9a(0x31d)+_0x2a355f[_0xa81a9a(0x2f5)]),console['log'](_0xa81a9a(0x2c4)+_0x52f0da),console['log'](_0xa81a9a(0x1fb)+_0x3b0abe[_0xa81a9a(0x258)][_0xa81a9a(0x309)]+_0xa81a9a(0x1f1)),console[_0xa81a9a(0x279)](_0xa81a9a(0x22c)+_0x1fd62d+'\x20total'),_0x575b1d>0x0&&console['log']('\x20\x20Note:\x20'+_0x575b1d+_0xa81a9a(0x28a)),0x0;}console[_0xa81a9a(0x1f7)]('\x0a'+a22_0x47d034['bold']('Output\x20Database:')+'\x20'+a22_0x47d034[_0xa81a9a(0x1f8)](_0x52f0da));const _0x1d2893=await withSpinner(_0xa81a9a(0x25b),()=>_0x43ad7a[_0xa81a9a(0x24c)][_0xa81a9a(0x1fc)](_0x5623f5),{'verbose':_0x27dd53[_0xa81a9a(0x338)]});console['error']('\x0a'+a22_0x47d034[_0xa81a9a(0x23c)](_0xa81a9a(0x2d5))+'\x20'+a22_0x47d034[_0xa81a9a(0x290)]('('+_0x52f0da+_0xa81a9a(0x1eb)));const _0xc6b96=await executeSchemaQuery(_0x1d2893[_0xa81a9a(0x28c)],_0x43ad7a,_0x27dd53);await handleQueryOutput(_0xc6b96,_0x27dd53);const _0x2b81df=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x43ad7a[_0xa81a9a(0x24c)][_0xa81a9a(0x221)](_0x5623f5),{'verbose':_0x27dd53[_0xa81a9a(0x338)]});for(const _0x219339 of _0x2b81df['data']){const _0x3633ce='behavior_'+_0x219339[_0xa81a9a(0x2cd)]()[_0xa81a9a(0x2df)](/\s+/g,'_'),_0x22ec57=_0xa81a9a(0x244)+_0x52f0da+'.'+_0x3633ce;console[_0xa81a9a(0x1f7)]('\x0a'+a22_0x47d034[_0xa81a9a(0x23c)](_0x219339)+'\x20'+a22_0x47d034[_0xa81a9a(0x290)]('('+_0x52f0da+'.'+_0x3633ce+')'));try{const _0x139413=await executeSchemaQuery(_0x22ec57,_0x43ad7a,_0x27dd53);await handleQueryOutput(_0x139413,_0x27dd53);}catch{console[_0xa81a9a(0x1f7)](a22_0x47d034['yellow'](_0xa81a9a(0x29e)));}}return 0x0;}async[a22_0x4aa0a8(0x230)](_0x1c3607,_0x545082,_0x539a5f,_0x5d9af3){const _0x9dd6e1=a22_0x4aa0a8,{options:_0x31714e,tdx:_0xc1a57b}=_0x1c3607,_0x5270a6=await withSpinner(_0x9dd6e1(0x25b),()=>_0xc1a57b[_0x9dd6e1(0x24c)][_0x9dd6e1(0x1fc)](_0x539a5f),{'verbose':_0x31714e['verbose']}),_0x1dd640=await executeSchemaQuery(_0x5270a6[_0x9dd6e1(0x28c)],_0xc1a57b,_0x31714e),_0x54c47d=_0x1dd640[_0x9dd6e1(0x28c)][_0x9dd6e1(0x2fd)](_0x4ca7c7=>({'name':_0x4ca7c7[_0x9dd6e1(0x25f)],'type':_0x4ca7c7[_0x9dd6e1(0x24f)]})),_0x47654b=await withSpinner('Fetching\x20behavior\x20list...',()=>_0xc1a57b[_0x9dd6e1(0x24c)][_0x9dd6e1(0x221)](_0x539a5f),{'verbose':_0x31714e[_0x9dd6e1(0x338)]}),_0x41dc51=[];for(const _0x30ecb1 of _0x47654b[_0x9dd6e1(0x28c)]){const _0x242a29=_0x9dd6e1(0x2ae)+_0x30ecb1['toLowerCase']()['replace'](/\s+/g,'_'),_0x2bd88b=_0x9dd6e1(0x244)+_0x5d9af3+'.'+_0x242a29;let _0x49040b=[];try{const _0x2ec76e=await executeSchemaQuery(_0x2bd88b,_0xc1a57b,_0x31714e);_0x49040b=_0x2ec76e[_0x9dd6e1(0x28c)][_0x9dd6e1(0x2fd)](_0x47baa=>({'name':_0x47baa[_0x9dd6e1(0x25f)],'type':_0x47baa[_0x9dd6e1(0x24f)]}));}catch{}_0x41dc51[_0x9dd6e1(0x24b)]({'table':_0x242a29,'columns':_0x49040b});}return{'database':_0x5d9af3,'parent_segment':_0x545082,'parent_id':_0x539a5f,'customers':{'table':_0x9dd6e1(0x2d5),'columns':_0x54c47d},'behaviors':_0x41dc51};}['formatSchemaJson'](_0x124cb2){const _0x499fff=a22_0x4aa0a8,_0x1a6894=_0x236be1=>{const _0x33c46d=a22_0x2432;if(_0x236be1[_0x33c46d(0x309)]===0x0)return'[]';const _0x1ed2ca=_0x236be1[_0x33c46d(0x2fd)](_0x2fcf79=>_0x33c46d(0x251)+_0x2fcf79['name']+_0x33c46d(0x2ee)+_0x2fcf79[_0x33c46d(0x23b)]+_0x33c46d(0x27a));return'[\x0a'+_0x1ed2ca[_0x33c46d(0x231)](',\x0a')+_0x33c46d(0x235);},_0xb80a5c=_0x124cb2[_0x499fff(0x258)]['map'](_0x1caecf=>{const _0x383a9d=_0x499fff;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1caecf[_0x383a9d(0x2e9)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1a6894(_0x1caecf[_0x383a9d(0x337)])['replace'](/^/gm,'\x20\x20')[_0x383a9d(0x242)]()+_0x383a9d(0x2a7);})[_0x499fff(0x231)](',\x0a');return _0x499fff(0x247)+_0x124cb2[_0x499fff(0x2f4)]+_0x499fff(0x291)+_0x124cb2[_0x499fff(0x311)]+_0x499fff(0x218)+_0x124cb2[_0x499fff(0x275)]+_0x499fff(0x25e)+_0x124cb2[_0x499fff(0x2d5)]['table']+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x1a6894(_0x124cb2[_0x499fff(0x2d5)][_0x499fff(0x337)])['replace'](/^/gm,'\x20\x20')[_0x499fff(0x242)]()+_0x499fff(0x25c)+_0xb80a5c+_0x499fff(0x2ea);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x4aa0a8(0x2ca)]='segment:parent:sql';[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x24d);async['execute'](_0xc9f15e){const _0x53594a=a22_0x4aa0a8,{options:_0x9db857,args:_0x221fdd,tdx:_0x559261}=_0xc9f15e,_0x4c8c3c=_0x221fdd[0x0]||_0x9db857['parentSegment'];if(!_0x4c8c3c)return showParentSegmentNotSetError(_0x53594a(0x21f)+_0x53594a(0x2b5)),0x1;_0x9db857[_0x53594a(0x338)]&&(console['error'](_0x53594a(0x254)+_0x9db857[_0x53594a(0x339)]),console[_0x53594a(0x1f7)](_0x53594a(0x33f)+_0x4c8c3c));const _0x2408c4=await withSpinner(_0x53594a(0x30c)+_0x4c8c3c+_0x53594a(0x2bc),()=>_0x559261[_0x53594a(0x24c)][_0x53594a(0x259)](_0x4c8c3c),{'verbose':_0x9db857[_0x53594a(0x338)]}),_0x2ca94d=_0x2408c4['data'],_0x5be7ce=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4c8c3c+_0x53594a(0x2bc),()=>_0x559261[_0x53594a(0x24c)]['getParentSQL'](_0x2ca94d),{'verbose':_0x9db857[_0x53594a(0x338)]}),_0x16a454=_0x5be7ce[_0x53594a(0x28c)];return _0x9db857[_0x53594a(0x226)]===_0x53594a(0x274)||_0x9db857[_0x53594a(0x226)]===_0x53594a(0x330)?await handleSDKOutput([{'sql':_0x16a454}],_0x9db857):console[_0x53594a(0x279)](_0x16a454),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a22_0x4aa0a8(0x2da);[a22_0x4aa0a8(0x239)]=a22_0x4aa0a8(0x31b);async['execute'](_0x4cb419){const _0x2162a8=a22_0x4aa0a8,{options:_0x6c3d22,args:_0x4ad564,tdx:_0x5b8066}=_0x4cb419,_0x3427d7=_0x4ad564[0x0]||_0x6c3d22[_0x2162a8(0x2de)];if(!_0x3427d7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x2162a8(0x287)),0x1;_0x6c3d22['verbose']&&(console['error'](_0x2162a8(0x254)+_0x6c3d22[_0x2162a8(0x339)]),console[_0x2162a8(0x1f7)](_0x2162a8(0x33f)+_0x3427d7));const _0x3880b2=await withSpinner(_0x2162a8(0x30c)+_0x3427d7+_0x2162a8(0x2bc),()=>_0x5b8066[_0x2162a8(0x24c)][_0x2162a8(0x259)](_0x3427d7),{'verbose':_0x6c3d22[_0x2162a8(0x338)]}),_0x2fca12=_0x3880b2['data'],_0xd6cd9=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3427d7+_0x2162a8(0x2bc),()=>_0x5b8066[_0x2162a8(0x24c)]['getParentSQL'](_0x2fca12),{'verbose':_0x6c3d22[_0x2162a8(0x338)]});let _0x54a5cc=_0xd6cd9[_0x2162a8(0x28c)];const _0x1820a3=resolveLimit(_0x6c3d22['limit'],DEFAULT_DISPLAY_LIMIT),_0x5a7c7c=/\bLIMIT\s+\d+/i[_0x2162a8(0x215)](_0x54a5cc);!_0x5a7c7c&&(_0x54a5cc=_0x54a5cc[_0x2162a8(0x242)]()[_0x2162a8(0x2df)](/;+$/,''),_0x54a5cc=_0x2162a8(0x1ed)+_0x54a5cc+_0x2162a8(0x26b)+_0x1820a3);_0x6c3d22['verbose']&&console[_0x2162a8(0x1f7)](_0x2162a8(0x2e0)+_0x54a5cc);const _0x547a35=await withProgressSpinner(_0x2162a8(0x263),async _0x2298d1=>{const _0x18b672=_0x2162a8,_0x911134=await _0x5b8066[_0x18b672(0x2fe)][_0x18b672(0x269)](_0x54a5cc,{'catalog':'td','schema':'information_schema','onJobId':_0x49c018=>{const _0x4ec5c8=_0x18b672;_0x2298d1[_0x4ec5c8(0x236)](_0x49c018);}});return _0x911134;},{'verbose':_0x6c3d22[_0x2162a8(0x338)]}),_0x5afce0=_0x547a35[_0x2162a8(0x28c)],_0x13c546=_0x5afce0[_0x2162a8(0x219)]?_0x2162a8(0x25a)+_0x5afce0['jobId']+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x5afce0[_0x2162a8(0x318)][_0x2162a8(0x2f6)][_0x2162a8(0x314)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x5afce0[_0x2162a8(0x318)][_0x2162a8(0x30b)])+_0x13c546)),await handleQueryOutput(_0x5afce0,_0x6c3d22),0x0;}}
|
|
1
|
+
const a22_0x39bd62=a22_0x107b;(function(_0x2fff1a,_0x517891){const _0x4cef45=a22_0x107b,_0x248f5d=_0x2fff1a();while(!![]){try{const _0x3df1aa=-parseInt(_0x4cef45(0xb9))/0x1+parseInt(_0x4cef45(0x13d))/0x2*(-parseInt(_0x4cef45(0x1ab))/0x3)+parseInt(_0x4cef45(0xb8))/0x4+-parseInt(_0x4cef45(0x8c))/0x5+-parseInt(_0x4cef45(0x164))/0x6+-parseInt(_0x4cef45(0xe9))/0x7*(-parseInt(_0x4cef45(0x150))/0x8)+-parseInt(_0x4cef45(0x176))/0x9*(-parseInt(_0x4cef45(0xca))/0xa);if(_0x3df1aa===_0x517891)break;else _0x248f5d['push'](_0x248f5d['shift']());}catch(_0x67242a){_0x248f5d['push'](_0x248f5d['shift']());}}}(a22_0x36d3,0x377cf));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x2f9c49 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x22a4da 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_0x39bd62(0xe1),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x16f282){const _0x319af2=a22_0x39bd62,_0x8597ec=process[_0x319af2(0x114)],_0x225b93=_0x8597ec===_0x319af2(0x132)?_0x319af2(0x1af):_0x8597ec===_0x319af2(0x182)?_0x319af2(0x160):'xdg-open';spawn(_0x225b93,[_0x16f282],{'detached':!![],'stdio':_0x319af2(0x131)})[_0x319af2(0x172)]();}function migrateLegacyDirectory(){const _0x3764ca=a22_0x39bd62;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5d0fda=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5d0fda[_0x3764ca(0xd2)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3764ca(0x98)](a22_0x22a4da[_0x3764ca(0xfc)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3764ca(0x9c)+PARENT_SEGMENT_DIR+_0x3764ca(0x188))),console['error'](a22_0x22a4da[_0x3764ca(0x8e)](_0x3764ca(0x1aa)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x22a4da[_0x3764ca(0xfc)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3764ca(0x7e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3764ca(0x98)](a22_0x22a4da[_0x3764ca(0x153)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x40bb6f){const _0x114cd3=_0x40bb6f instanceof Error?_0x40bb6f[_0x3764ca(0x96)]:String(_0x40bb6f);return console[_0x3764ca(0x98)](a22_0x22a4da['red'](_0x3764ca(0x11f)+_0x114cd3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x544f21){const _0x284449=a22_0x39bd62;return migrateLegacyDirectory(),super[_0x284449(0x168)](_0x544f21);}}function resolveYamlFile(_0x501a9a){const _0x1558e9=a22_0x39bd62;if(_0x501a9a[_0x1558e9(0xc6)]('.yml')||_0x501a9a['endsWith'](_0x1558e9(0x151)))return _0x501a9a;return a22_0x2f9c49[_0x1558e9(0x183)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x501a9a)+_0x1558e9(0x1b1));}function formatProgressMessage(_0x2d9e94){const _0x18be6a=a22_0x39bd62,_0x22a28e=_0x2d9e94[_0x18be6a(0xac)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x22a28e){const [,_0x8756e4,_0x480284,_0xff565f='']=_0x22a28e;return a22_0x22a4da[_0x18be6a(0x8e)](_0x8756e4+':')+'\x20'+_0x480284+a22_0x22a4da[_0x18be6a(0x8e)](_0xff565f);}return a22_0x22a4da[_0x18be6a(0x8e)](_0x2d9e94);}function showFileNotFoundError(_0x2b5faa,_0x46770a){const _0x12c3e2=a22_0x39bd62;console[_0x12c3e2(0x98)](a22_0x22a4da[_0x12c3e2(0x10a)](_0x12c3e2(0xcc)+_0x2b5faa+'\x0a')),console[_0x12c3e2(0x98)](a22_0x22a4da[_0x12c3e2(0x17a)](_0x12c3e2(0x178)+_0x46770a+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x50aa7a){const _0x54732b=a22_0x39bd62;console[_0x54732b(0x98)](a22_0x22a4da[_0x54732b(0xfc)](_0x54732b(0xf4))),console[_0x54732b(0x98)](_0x50aa7a);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xff);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xe3);async[a22_0x39bd62(0xf6)](_0x447a6b){const _0x26a1fc=a22_0x39bd62,{options:_0x4c0c0f,args:_0x5b5ac1,tdx:_0x2a1b8a}=_0x447a6b,_0x196b70=_0x5b5ac1[0x0];_0x4c0c0f[_0x26a1fc(0x144)]&&(console[_0x26a1fc(0x98)](_0x26a1fc(0xf9)+_0x4c0c0f['site']),_0x196b70&&console[_0x26a1fc(0x98)]('Pattern:\x20'+_0x196b70));const _0x545e3b=await withSpinner(_0x196b70?_0x26a1fc(0x106)+_0x196b70+_0x26a1fc(0x1bd):_0x26a1fc(0xfa),()=>_0x2a1b8a[_0x26a1fc(0x136)][_0x26a1fc(0x1a2)](),{'verbose':_0x4c0c0f['verbose']});let _0x5223c7=_0x545e3b[_0x26a1fc(0x193)];if(_0x196b70){const _0x34d006=_0x196b70[_0x26a1fc(0x155)](/[.+^${}()|[\]\\]/g,_0x26a1fc(0xbe))[_0x26a1fc(0x155)](/\*/g,'.*')[_0x26a1fc(0x155)](/\?/g,'.'),_0x4a3a78=new RegExp('^'+_0x34d006+'$','i');_0x5223c7=_0x5223c7[_0x26a1fc(0xef)](_0x4f9d11=>_0x4a3a78[_0x26a1fc(0x108)](_0x4f9d11[_0x26a1fc(0x1a4)][_0x26a1fc(0x116)]));}_0x5223c7[_0x26a1fc(0x13f)]((_0xc0a619,_0x1b06e1)=>_0xc0a619['attributes']['name']['localeCompare'](_0x1b06e1[_0x26a1fc(0x1a4)][_0x26a1fc(0x116)])),console['error'](_0x26a1fc(0x194)+_0x5223c7[_0x26a1fc(0x117)]+_0x26a1fc(0xd1)+(_0x5223c7['length']!==0x1?'s':''));const _0x4ac94d=_0x5ed6d2=>{const _0x154b6f=_0x26a1fc;return getConsoleNextUrl(_0x4c0c0f[_0x154b6f(0xf3)],_0x154b6f(0x15f)+_0x5ed6d2);};if(_0x4c0c0f[_0x26a1fc(0xc7)]===_0x26a1fc(0x161)||_0x4c0c0f[_0x26a1fc(0xc7)]==='jsonl'){const _0x20732b=_0x5223c7[_0x26a1fc(0x1a0)](_0x5182c7=>({..._0x5182c7,'url':_0x4ac94d(_0x5182c7['id'])}));await handleSDKOutput(_0x20732b,_0x4c0c0f);}else{if(_0x5223c7[_0x26a1fc(0x117)]===0x0)_0x196b70?console[_0x26a1fc(0xae)](_0x26a1fc(0xb3)+_0x196b70):console[_0x26a1fc(0xae)](_0x26a1fc(0x165));else for(const _0x3cbf7f of _0x5223c7){const _0x53f059=_0x3cbf7f['attributes'][_0x26a1fc(0x14a)]?a22_0x22a4da[_0x26a1fc(0x8e)]('\x20('+formatRows(_0x3cbf7f[_0x26a1fc(0x1a4)][_0x26a1fc(0x14a)])+')'):'',_0x2cc9eb=hyperlink(_0x3cbf7f['attributes'][_0x26a1fc(0x116)],_0x4ac94d(_0x3cbf7f['id']));console['log']('👥\x20'+_0x2cc9eb+_0x53f059);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x125);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x39bd62(0xf6)](_0xe1a0c9){const _0x3f6924=a22_0x39bd62,{options:_0x439606,args:_0x241fa7,tdx:_0x47e0e9}=_0xe1a0c9;console[_0x3f6924(0x98)](_0x3f6924(0x92)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x3f6924(0x107));const _0x3d844d=_0x439606;if(_0x241fa7[_0x3f6924(0x117)]===0x0)return console['error'](a22_0x22a4da[_0x3f6924(0x10a)](_0x3f6924(0x10f))),console[_0x3f6924(0x98)](_0x3f6924(0x142)),0x1;const _0x7375e2=_0x241fa7[0x0];if(!_0x3d844d[_0x3f6924(0x100)]||!_0x3d844d[_0x3f6924(0xc9)])return console[_0x3f6924(0x98)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x3f6924(0x98)](_0x3f6924(0x142)),0x1;_0x3d844d[_0x3f6924(0x144)]&&(console[_0x3f6924(0x98)]('Site:\x20'+_0x3d844d[_0x3f6924(0xf3)]),console[_0x3f6924(0x98)](_0x3f6924(0xdf)+_0x7375e2),console[_0x3f6924(0x98)]('Database:\x20'+_0x3d844d['database']),console['error']('Table:\x20'+_0x3d844d[_0x3f6924(0xc9)]));const _0x5088b5=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0x1a4)],_0x3d844d[_0x3f6924(0x19c)]),_0x4d0c7c=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0xc5)],_0x3d844d['behaviorsFile']),_0x55df76=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0x10d)],_0x3d844d[_0x3f6924(0x81)]),_0x3f661b={'name':_0x7375e2,'description':_0x3d844d[_0x3f6924(0x14e)],'scheduleType':_0x3d844d['scheduleType'],'scheduleOption':_0x3d844d[_0x3f6924(0x171)],'timezone':_0x3d844d[_0x3f6924(0x181)],'master':{'parentDatabaseName':_0x3d844d[_0x3f6924(0x100)],'parentTableName':_0x3d844d[_0x3f6924(0xc9)]},'attributes':_0x5088b5,'behaviors':_0x4d0c7c,'customerGroup':_0x55df76},_0x1f398e=await withSpinner(_0x3f6924(0xb5)+_0x7375e2+_0x3f6924(0x1bd),()=>_0x47e0e9['segment'][_0x3f6924(0x198)](_0x3f661b),{'verbose':_0x439606[_0x3f6924(0x144)]}),_0x3c8dcf=_0x1f398e['data'];return console[_0x3f6924(0x98)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x3c8dcf[_0x3f6924(0x116)]+_0x3f6924(0x1b3)+_0x3c8dcf['id']),await handleSDKOutput([_0x3c8dcf],_0x439606),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a22_0x39bd62(0xd6);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xb2);async[a22_0x39bd62(0xf6)](_0x54c449){const _0x5e66cc=a22_0x39bd62,{options:_0x2e10f3,args:_0x558d92,tdx:_0x4616b2}=_0x54c449;console[_0x5e66cc(0x98)](_0x5e66cc(0x179)+_0x5e66cc(0x140)+_0x5e66cc(0x107));const _0x127093=_0x2e10f3;if(_0x558d92[_0x5e66cc(0x117)]===0x0)return console[_0x5e66cc(0x98)](a22_0x22a4da[_0x5e66cc(0x10a)](_0x5e66cc(0x10f))),console[_0x5e66cc(0x98)](_0x5e66cc(0x1c0)),0x1;const _0xa8e042=_0x558d92[0x0];_0x127093[_0x5e66cc(0x144)]&&(console[_0x5e66cc(0x98)](_0x5e66cc(0xf9)+_0x127093['site']),console[_0x5e66cc(0x98)](_0x5e66cc(0xc1)+_0xa8e042));const _0x130784=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0xa8e042+_0x5e66cc(0x1bd),()=>_0x4616b2[_0x5e66cc(0x136)][_0x5e66cc(0x18e)](_0xa8e042),{'verbose':_0x127093[_0x5e66cc(0x144)]}),_0x55e64d=_0x130784[_0x5e66cc(0x193)],_0x245d8e=await loadJSONFromOptions(_0x127093[_0x5e66cc(0x146)],_0x127093[_0x5e66cc(0x154)]),_0x5ddcf0=await loadJSONFromOptions(_0x127093[_0x5e66cc(0x177)],_0x127093[_0x5e66cc(0x13b)]),_0x7179a4={'name':_0x55e64d['name'],'description':_0x127093[_0x5e66cc(0x14e)]!==undefined?_0x127093[_0x5e66cc(0x14e)]:_0x55e64d['description'],'scheduleType':_0x127093['scheduleType']!==undefined?_0x127093['scheduleType']:_0x55e64d[_0x5e66cc(0xe8)],'scheduleOption':_0x127093[_0x5e66cc(0x171)]!==undefined?_0x127093['scheduleOption']:_0x55e64d[_0x5e66cc(0x171)],'timezone':_0x127093[_0x5e66cc(0x181)]!==undefined?_0x127093['timezone']:_0x55e64d[_0x5e66cc(0x181)],'master':_0x55e64d['master'],'attributes':_0x245d8e?[..._0x55e64d[_0x5e66cc(0x1a4)]||[],..._0x245d8e]:_0x55e64d[_0x5e66cc(0x1a4)],'behaviors':_0x5ddcf0?[..._0x55e64d[_0x5e66cc(0xc5)]||[],..._0x5ddcf0]:_0x55e64d[_0x5e66cc(0xc5)],'customerGroup':_0x55e64d[_0x5e66cc(0x10d)]},_0x3ce050=await withSpinner(_0x5e66cc(0xab)+_0xa8e042+'\x27...',()=>_0x4616b2[_0x5e66cc(0x136)][_0x5e66cc(0x18c)](_0xa8e042,_0x7179a4),{'verbose':_0x127093[_0x5e66cc(0x144)]}),_0x33168f=_0x3ce050[_0x5e66cc(0x193)];return console[_0x5e66cc(0x98)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x33168f[_0x5e66cc(0x116)]+'\x27'),await handleSDKOutput([_0x33168f],_0x127093),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x19a);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x1b6);async['execute'](_0x3ac9db){const _0x2889c2=a22_0x39bd62,{options:_0x1b54d1,args:_0x1e734c,tdx:_0x232305}=_0x3ac9db,_0xdf3e59=_0x1b54d1,_0x43b38c=_0x1e734c[0x0]||_0x1b54d1[_0x2889c2(0xcd)];if(!_0x43b38c)return showParentSegmentNotSetError(_0x2889c2(0xa7)+_0x2889c2(0x103)),0x1;if(_0xdf3e59['use']&&_0xdf3e59[_0x2889c2(0x1a5)])return console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x10a)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x8e)](_0x2889c2(0xdc))),console[_0x2889c2(0x98)](a22_0x22a4da['dim'](_0x2889c2(0x141)+PARENT_SEGMENT_DIR+_0x2889c2(0x9e))),console['error'](a22_0x22a4da[_0x2889c2(0x17a)](_0x2889c2(0x163))),0x1;const _0x831a1b=_0xdf3e59[_0x2889c2(0x1a5)]||a22_0x2f9c49[_0x2889c2(0x183)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x43b38c)+_0x2889c2(0x1b1));_0xdf3e59[_0x2889c2(0x144)]&&(console[_0x2889c2(0x98)](_0x2889c2(0xf9)+_0xdf3e59['site']),console[_0x2889c2(0x98)]('Parent\x20segment:\x20'+_0x43b38c),console[_0x2889c2(0x98)]('Output\x20file:\x20'+_0x831a1b));const _0x4125e9=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x43b38c+_0x2889c2(0x1bd),()=>_0x232305['segment'][_0x2889c2(0x112)](_0x43b38c),{'verbose':_0xdf3e59['verbose']}),_0x516b3e=_0x4125e9['data'];if(existsSync(_0x831a1b)){const _0x35e168=readFileSync(_0x831a1b,_0x2889c2(0xad)),_0x49f5cc=generateDiff(_0x35e168,_0x516b3e);if(!hasChanges(_0x49f5cc))console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+_0x2889c2(0xb1)+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b)+_0x2889c2(0x19e));else{console[_0x2889c2(0x98)](_0x2889c2(0xe4)+_0x831a1b+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x2889c2(0x98)](formatDiffWithColors(_0x49f5cc)),console[_0x2889c2(0x98)]('─'[_0x2889c2(0x17e)](0x3c));if(!_0xdf3e59[_0x2889c2(0xa3)]){if(!isInteractive())return console['error'](a22_0x22a4da[_0x2889c2(0x10a)](_0x2889c2(0xda)),_0x2889c2(0xea)),console['error'](a22_0x22a4da['dim'](_0x2889c2(0x1c2))),0x1;const _0x3494e3=await confirmKey(_0x2889c2(0x91)+_0x831a1b+'\x27?');if(!_0x3494e3)return console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0xfc)](_0x2889c2(0x12f))),0x1;}writeFileSync(_0x831a1b,_0x516b3e,_0x2889c2(0xad)),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b));}}else{const _0x1718b8=a22_0x2f9c49[_0x2889c2(0x16d)](_0x831a1b);!existsSync(_0x1718b8)&&mkdirSync(_0x1718b8,{'recursive':!![]}),writeFileSync(_0x831a1b,_0x516b3e,_0x2889c2(0xad)),console[_0x2889c2(0x98)](a22_0x22a4da['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b));}return saveSessionContext({'parent_segment':_0x43b38c},_0xdf3e59[_0x2889c2(0xe5)]),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+_0x2889c2(0xf8)+a22_0x22a4da['dim'](_0x2889c2(0xf5))+_0x2889c2(0x180)+a22_0x22a4da[_0x2889c2(0x17a)](_0x43b38c)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xb7);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xeb);async[a22_0x39bd62(0xf6)](_0x5b5c78){const _0x1da8f3=a22_0x39bd62,{options:_0x117531,args:_0x29bbe3,tdx:_0x52587a}=_0x5b5c78,_0x527a42=_0x117531,_0x2d7d0d=_0x29bbe3[0x0]||_0x117531['parentSegment'];if(!_0x2d7d0d)return showParentSegmentNotSetError(_0x1da8f3(0xa6)+_0x1da8f3(0xdd)),0x1;const _0x3517db=resolveYamlFile(_0x2d7d0d);if(!existsSync(_0x3517db))return showFileNotFoundError(_0x3517db,_0x2d7d0d),0x1;_0x527a42[_0x1da8f3(0x144)]&&(console[_0x1da8f3(0x98)](_0x1da8f3(0xf9)+_0x527a42[_0x1da8f3(0xf3)]),console[_0x1da8f3(0x98)]('YAML\x20file:\x20'+_0x3517db));let _0x1a5d8f;try{_0x1a5d8f=readFileSync(_0x3517db,_0x1da8f3(0xad));}catch(_0x141a43){const _0x436911=_0x141a43 instanceof Error?_0x141a43[_0x1da8f3(0x96)]:String(_0x141a43);return console[_0x1da8f3(0x98)]('Error\x20reading\x20file:\x20'+_0x436911),0x1;}const _0x3cb723=await withSpinner('Analyzing\x20changes...',()=>_0x52587a[_0x1da8f3(0x136)]['pushParentYaml'](_0x1a5d8f),{'verbose':_0x527a42[_0x1da8f3(0x144)]}),_0x31d9cd=_0x3cb723[_0x1da8f3(0x193)],{isNew:_0x28a707,name:_0x107255,hasChanges:_0x51fb4d,diffFormatted:_0x5ed6dd}=_0x31d9cd;if(!_0x51fb4d)return console[_0x1da8f3(0x98)](_0x1da8f3(0xf7)+_0x107255+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x28a707?console[_0x1da8f3(0x98)](_0x1da8f3(0x15a)+_0x107255+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x107255+'\x27:');console[_0x1da8f3(0x98)]('─'[_0x1da8f3(0x17e)](0x3c)),console[_0x1da8f3(0x98)](_0x5ed6dd),console[_0x1da8f3(0x98)]('─'[_0x1da8f3(0x17e)](0x3c));const _0x48c1e4=_0x28a707?_0x1da8f3(0x85)+_0x107255+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x107255+'\x27?';if(!_0x527a42[_0x1da8f3(0xa3)]){if(!isInteractive())return console['error'](a22_0x22a4da[_0x1da8f3(0x10a)]('\x0aError:'),_0x1da8f3(0xea)),console['error'](a22_0x22a4da[_0x1da8f3(0x8e)](_0x1da8f3(0x1c2))),0x1;const _0x538999=await confirmKey(_0x48c1e4);if(!_0x538999)return console[_0x1da8f3(0x98)](a22_0x22a4da[_0x1da8f3(0xfc)](_0x1da8f3(0x12f))),0x1;}const _0xd8c7ce=_0x28a707?'Creating':_0x1da8f3(0x166),_0xc05b9=await withSpinner(_0xd8c7ce+_0x1da8f3(0x1b0)+_0x107255+_0x1da8f3(0x1bd),()=>_0x31d9cd[_0x1da8f3(0xbd)](),{'verbose':_0x527a42[_0x1da8f3(0x144)]}),_0x62b8b9=_0xc05b9[_0x1da8f3(0x193)],_0x5a5a4d=getConsoleNextUrl(_0x527a42[_0x1da8f3(0xf3)],_0x1da8f3(0x15f)+_0x62b8b9['id']),_0x2afcb0=_0x28a707?_0x1da8f3(0x8b):_0x1da8f3(0x189);return console[_0x1da8f3(0x98)]('✔\x20'+_0x2afcb0+_0x1da8f3(0x1b0)+_0x62b8b9[_0x1da8f3(0x116)]+'\x27'),console[_0x1da8f3(0x98)]('\x20\x20'+_0x5a5a4d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x39bd62(0x12a);[a22_0x39bd62(0x14e)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a22_0x39bd62(0xf6)](_0x15000e){const _0x268802=a22_0x39bd62,{options:_0x16ae90,args:_0x5f4b29,tdx:_0x274a7d}=_0x15000e,_0x155dea=_0x16ae90,_0x1e6b27=_0x5f4b29[0x0]||_0x16ae90[_0x268802(0xcd)];if(!_0x1e6b27)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'+_0x268802(0xa5)+'Options:\x0a'+_0x268802(0xa1)+_0x268802(0x1a6)+_0x268802(0x14d)),0x1;const _0x2feb78=resolveYamlFile(_0x1e6b27);if(!existsSync(_0x2feb78))return showFileNotFoundError(_0x2feb78,_0x1e6b27),0x1;_0x155dea[_0x268802(0x144)]&&(console[_0x268802(0x98)]('Site:\x20'+_0x155dea[_0x268802(0xf3)]),console[_0x268802(0x98)](_0x268802(0x7f)+_0x2feb78));let _0x5b524d;try{_0x5b524d=readFileSync(_0x2feb78,_0x268802(0xad));}catch(_0x9ba2a9){const _0x3cadfc=_0x9ba2a9 instanceof Error?_0x9ba2a9['message']:String(_0x9ba2a9);return console[_0x268802(0x98)](_0x268802(0x111)+_0x3cadfc),0x1;}const _0x13ba05=createCommandSpinner(a22_0x22a4da[_0x268802(0x8e)]('Validating\x20configuration...'),{'verbose':_0x155dea[_0x268802(0x144)]});_0x13ba05['start']();const _0x32eb7e={'onProgress':_0x2f5a87=>{_0x13ba05['text']=formatProgressMessage(_0x2f5a87);}};if(_0x155dea['master'])_0x32eb7e['master']=!![];if(_0x155dea[_0x268802(0x12b)])_0x32eb7e[_0x268802(0x12b)]=!![];_0x155dea[_0x268802(0x1a9)]&&(_0x32eb7e[_0x268802(0x1a9)]=_0x155dea['attribute']);_0x155dea[_0x268802(0x123)]&&(_0x32eb7e[_0x268802(0x123)]=_0x155dea[_0x268802(0x123)]);if(_0x155dea['interval'])_0x32eb7e[_0x268802(0xec)]=_0x155dea[_0x268802(0xec)];let _0x4987ad;try{_0x4987ad=await _0x274a7d[_0x268802(0x136)]['validateParentYaml'](_0x5b524d,_0x32eb7e),_0x13ba05['stop']();}catch(_0x153ff1){_0x13ba05['stop']();throw _0x153ff1;}const _0x32345d=_0x155dea[_0x268802(0xec)]||_0x268802(0xc0);return this[_0x268802(0x11e)](_0x4987ad,_0x32eb7e,_0x2feb78,_0x32345d),_0x4987ad[_0x268802(0x185)]?0x0:0x1;}[a22_0x39bd62(0x11e)](_0x288cca,_0x1bfff0,_0x3173fb,_0x9ce697){const _0x4054f4=a22_0x39bd62;console['error']('\x0a'+a22_0x22a4da[_0x4054f4(0xe0)](_0x4054f4(0x158))+'\x20'+_0x288cca['name']),console[_0x4054f4(0x98)]('═'[_0x4054f4(0x17e)](0x3c)),this[_0x4054f4(0x1bc)](_0x288cca);if(typeof _0x1bfff0[_0x4054f4(0x1a9)]==='string'){this[_0x4054f4(0x9a)](_0x288cca),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,'attribute',_0x1bfff0[_0x4054f4(0x1a9)]);return;}if(_0x1bfff0[_0x4054f4(0x1a9)]===!![]){this[_0x4054f4(0x9a)](_0x288cca),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0x1a4));return;}if(typeof _0x1bfff0['behavior']===_0x4054f4(0x9b)){this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this['displaySummary'](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0x123),_0x1bfff0[_0x4054f4(0x123)]);return;}if(_0x1bfff0[_0x4054f4(0x123)]===!![]){this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0xc5));return;}this['displayAttributesStats'](_0x288cca),this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this[_0x4054f4(0xfd)](_0x288cca),this['displayPreviewHints'](_0x3173fb,_0x9ce697,'all');}[a22_0x39bd62(0xf2)](_0x48d787,_0x52618d,_0x2f8ead,_0x5b889d){const _0x2c4e31=a22_0x39bd62;console[_0x2c4e31(0x98)]('\x0a'+a22_0x22a4da[_0x2c4e31(0x8e)]('To\x20view\x20sample\x20data:'));const _0x1bc761=_0x52618d!==_0x2c4e31(0xc0)?_0x2c4e31(0xbf)+_0x52618d:'';if(_0x2f8ead===_0x2c4e31(0x1a9)&&_0x5b889d)console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x2c4e31(0xcb)+_0x48d787+'\x20--attribute\x20\x22'+_0x5b889d+'\x22'+_0x1bc761));else{if(_0x2f8ead===_0x2c4e31(0x123)&&_0x5b889d)console['error']('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)]('tdx\x20segment\x20parent\x20preview\x20'+_0x48d787+_0x2c4e31(0x199)+_0x5b889d+'\x22'+_0x1bc761));else(_0x2f8ead===_0x2c4e31(0x1a4)||_0x2f8ead===_0x2c4e31(0x19f))&&console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)]('tdx\x20segment\x20parent\x20preview\x20'+_0x48d787+'\x20--attribute\x20\x22<name>\x22'+_0x1bc761));}(_0x2f8ead==='behaviors'||_0x2f8ead===_0x2c4e31(0x19f))&&console['error']('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)](_0x2c4e31(0xcb)+_0x48d787+'\x20--behavior\x20\x22<name>\x22'+_0x1bc761)),_0x2f8ead===_0x2c4e31(0x19f)&&console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)](_0x2c4e31(0xcb)+_0x48d787+_0x2c4e31(0x8f)+_0x1bc761));}[a22_0x39bd62(0x1bc)](_0x203aab){const _0x156897=a22_0x39bd62,{master:_0x30484c}=_0x203aab,_0x54836e=_0x30484c['schemaValid']?a22_0x22a4da[_0x156897(0x153)]('✔'):a22_0x22a4da[_0x156897(0x10a)]('✘');console[_0x156897(0x98)]('\x0a'+a22_0x22a4da['dim'](_0x156897(0xb0))),console[_0x156897(0x98)](_0x54836e+'\x20'+a22_0x22a4da['bold'](_0x30484c[_0x156897(0x100)]+'.'+_0x30484c[_0x156897(0xc9)])),_0x30484c[_0x156897(0x16a)]?_0x30484c[_0x156897(0x135)]!==undefined&&console[_0x156897(0x98)]('\x20\x20'+a22_0x22a4da[_0x156897(0x8e)](_0x156897(0x101))+'\x20'+a22_0x22a4da[_0x156897(0x17a)](formatRows(_0x30484c[_0x156897(0x135)]))):console[_0x156897(0x98)]('\x20\x20'+a22_0x22a4da[_0x156897(0x10a)]('Error:')+'\x20'+_0x30484c[_0x156897(0xf0)]);}['displayAttributesStats'](_0x23b1fa){const _0x22739b=a22_0x39bd62;if(_0x23b1fa[_0x22739b(0x1a4)]['length']===0x0)return;console[_0x22739b(0x98)]('\x0a'+a22_0x22a4da[_0x22739b(0x8e)](_0x22739b(0x120)));for(const _0x4d857f of _0x23b1fa['attributes']){const _0x5c83f3=_0x4d857f[_0x22739b(0x16a)]?a22_0x22a4da[_0x22739b(0x153)]('✔'):a22_0x22a4da[_0x22739b(0x10a)]('✘');let _0x3bd74='';if(_0x4d857f[_0x22739b(0x16a)]&&_0x4d857f[_0x22739b(0x12c)]!==undefined&&_0x4d857f[_0x22739b(0xfe)]!==undefined){const _0x4f6a7e=_0x4d857f[_0x22739b(0xfe)][_0x22739b(0x11c)](0x1),_0x2cbf51=_0x4d857f[_0x22739b(0xfe)]>=0x50?a22_0x22a4da[_0x22739b(0x153)]:_0x4d857f['coveragePercent']>=0x32?a22_0x22a4da['yellow']:a22_0x22a4da['red'];_0x3bd74='\x20'+a22_0x22a4da[_0x22739b(0x8e)]('Coverage:')+'\x20'+_0x2cbf51(_0x4f6a7e+'%')+'\x20('+formatRows(_0x4d857f[_0x22739b(0x12c)])+'\x20rows)';}console[_0x22739b(0x98)](_0x5c83f3+'\x20'+a22_0x22a4da[_0x22739b(0xe0)](_0x4d857f[_0x22739b(0x116)])+_0x3bd74),console[_0x22739b(0x98)]('\x20\x20'+a22_0x22a4da['dim']('Source:')+'\x20'+a22_0x22a4da[_0x22739b(0xe0)](_0x4d857f[_0x22739b(0x100)]+'.'+_0x4d857f[_0x22739b(0xc9)]));const _0x5edbae=_0x4d857f[_0x22739b(0x195)]===_0x4d857f[_0x22739b(0x82)]?a22_0x22a4da[_0x22739b(0x8e)]('Join\x20on:')+'\x20'+_0x4d857f[_0x22739b(0x195)]:a22_0x22a4da['dim'](_0x22739b(0x139))+'\x20'+_0x4d857f['joinKey']+_0x22739b(0x180)+_0x4d857f[_0x22739b(0x82)];console[_0x22739b(0x98)]('\x20\x20'+_0x5edbae),console[_0x22739b(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x22739b(0xde))),this[_0x22739b(0x89)](_0x4d857f[_0x22739b(0x13a)]),!_0x4d857f['schemaValid']&&console['error']('\x20\x20'+a22_0x22a4da['red'](_0x22739b(0xa8))+'\x20'+_0x4d857f['schemaError']);}}[a22_0x39bd62(0x88)](_0x52c2c4,_0x1c525f){const _0x30778f=a22_0x39bd62;if(_0x52c2c4[_0x30778f(0xc5)][_0x30778f(0x117)]===0x0)return;console['error']('\x0a'+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xc8))+'\x20'+a22_0x22a4da[_0x30778f(0x8e)]('('+_0x1c525f+')'));for(const _0x335f5a of _0x52c2c4['behaviors']){const _0x277cee=_0x335f5a[_0x30778f(0x16a)]?a22_0x22a4da[_0x30778f(0x153)]('✔'):a22_0x22a4da[_0x30778f(0x10a)]('✘');let _0xd57846='';if(_0x335f5a[_0x30778f(0x16a)]&&_0x335f5a['customersWithEvents']!==undefined&&_0x335f5a[_0x30778f(0x169)]!==undefined){const _0x4b09db=_0x335f5a[_0x30778f(0x1ba)]?.[_0x30778f(0x11c)](0x1)||'?',_0x1458ad=(_0x335f5a[_0x30778f(0x1ba)]??0x0)>=0x32?a22_0x22a4da['green']:(_0x335f5a[_0x30778f(0x1ba)]??0x0)>=0x14?a22_0x22a4da[_0x30778f(0xfc)]:a22_0x22a4da[_0x30778f(0x10a)];_0xd57846='\x20'+a22_0x22a4da['dim'](_0x30778f(0xb6))+'\x20'+_0x1458ad(formatRows(_0x335f5a[_0x30778f(0x1a3)]))+'\x20('+_0x4b09db+_0x30778f(0x122)+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xf1))+'\x20'+a22_0x22a4da[_0x30778f(0x17a)](formatRows(_0x335f5a[_0x30778f(0x169)]));}console[_0x30778f(0x98)](_0x277cee+'\x20'+a22_0x22a4da['bold'](_0x335f5a[_0x30778f(0x116)])+_0xd57846),console[_0x30778f(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x30778f(0x157))+'\x20'+a22_0x22a4da[_0x30778f(0xe0)](_0x335f5a[_0x30778f(0x100)]+'.'+_0x335f5a[_0x30778f(0xc9)]));const _0x165b8b=_0x335f5a['joinKey']===_0x335f5a['foreignKey']?a22_0x22a4da['dim'](_0x30778f(0x152))+'\x20'+_0x335f5a[_0x30778f(0x195)]:a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0x139))+'\x20'+_0x335f5a[_0x30778f(0x195)]+_0x30778f(0x180)+_0x335f5a[_0x30778f(0x82)];console[_0x30778f(0x98)]('\x20\x20'+_0x165b8b),console['error']('\x20\x20'+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xde))),this[_0x30778f(0x89)](_0x335f5a[_0x30778f(0x13a)]),!_0x335f5a['schemaValid']&&console[_0x30778f(0x98)]('\x20\x20'+a22_0x22a4da[_0x30778f(0x10a)](_0x30778f(0xa8))+'\x20'+_0x335f5a['schemaError']);}}[a22_0x39bd62(0x89)](_0x51f53c){const _0x20c5b9=a22_0x39bd62;for(const _0x1dce89 of _0x51f53c){_0x1dce89[_0x20c5b9(0x1b2)]===_0x1dce89[_0x20c5b9(0x147)]||_0x1dce89[_0x20c5b9(0x147)]==='*'?console[_0x20c5b9(0x98)](_0x20c5b9(0xba)+_0x1dce89[_0x20c5b9(0x1b2)]):console[_0x20c5b9(0x98)](_0x20c5b9(0xba)+_0x1dce89[_0x20c5b9(0x1b2)]+'\x20'+a22_0x22a4da[_0x20c5b9(0x8e)]('('+_0x1dce89[_0x20c5b9(0x147)]+')'));}}['displaySummary'](_0x52e998){const _0x5d1aa8=a22_0x39bd62;console['error']('─'[_0x5d1aa8(0x17e)](0x3c));if(_0x52e998['errors'][_0x5d1aa8(0x117)]>0x0){console[_0x5d1aa8(0x98)]('\x0a'+a22_0x22a4da[_0x5d1aa8(0x10a)](_0x5d1aa8(0x10c)));for(const _0x2890f3 of _0x52e998[_0x5d1aa8(0x12e)]){console[_0x5d1aa8(0x98)]('\x20\x20'+a22_0x22a4da[_0x5d1aa8(0x10a)]('•')+'\x20'+_0x2890f3);}}_0x52e998[_0x5d1aa8(0x185)]&&console[_0x5d1aa8(0x98)]('\x0a'+a22_0x22a4da[_0x5d1aa8(0x153)]('✔')+_0x5d1aa8(0xd8));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]='segment:parent:preview';[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xd9);async[a22_0x39bd62(0xf6)](_0x4a12ca){const _0x9d6b26=a22_0x39bd62,{options:_0x1d7048,args:_0x2787a9,tdx:_0x15f147}=_0x4a12ca,_0x1e013d=_0x1d7048,_0x43b483=_0x2787a9[0x0]||_0x1d7048[_0x9d6b26(0xcd)];if(!_0x43b483)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x9d6b26(0x1b4)+_0x9d6b26(0x126)+_0x9d6b26(0x162)+_0x9d6b26(0xe7)+_0x9d6b26(0x14d)),0x1;if(!_0x1e013d[_0x9d6b26(0x197)]&&!_0x1e013d['attribute']&&!_0x1e013d['behavior']&&!_0x1e013d['enriched'])return console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xe2))),console[_0x9d6b26(0x98)](_0x9d6b26(0xd7)),console['error'](_0x9d6b26(0xd4)),console[_0x9d6b26(0x98)](_0x9d6b26(0x134)),console[_0x9d6b26(0x98)](_0x9d6b26(0x1bf)),console[_0x9d6b26(0x98)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x9d6b26(0x98)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x237970=resolveYamlFile(_0x43b483);if(!existsSync(_0x237970))return showFileNotFoundError(_0x237970,_0x43b483),0x1;_0x1e013d[_0x9d6b26(0x144)]&&(console[_0x9d6b26(0x98)]('Site:\x20'+_0x1e013d[_0x9d6b26(0xf3)]),console[_0x9d6b26(0x98)](_0x9d6b26(0x7f)+_0x237970));let _0x185132;try{_0x185132=readFileSync(_0x237970,_0x9d6b26(0xad));}catch(_0x1234a2){const _0x11372f=_0x1234a2 instanceof Error?_0x1234a2['message']:String(_0x1234a2);return console[_0x9d6b26(0x98)](_0x9d6b26(0x111)+_0x11372f),0x1;}let _0x315d3e;try{_0x315d3e=parseDef(_0x185132);}catch(_0x1e9171){const _0x5ec8ef=_0x1e9171 instanceof Error?_0x1e9171[_0x9d6b26(0x96)]:String(_0x1e9171);return console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xdb)+_0x5ec8ef)),0x1;}if(_0x1e013d[_0x9d6b26(0x1a9)]===!![]||_0x1e013d['attribute']===''){const _0x11243e=_0x315d3e['attributes']?.['map'](_0x427221=>_0x427221[_0x9d6b26(0x116)])||[];if(_0x11243e[_0x9d6b26(0x117)]===0x0)console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0x159)));else{console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0x173))),console[_0x9d6b26(0x98)](_0x9d6b26(0x15e));for(const _0x129953 of _0x11243e){console[_0x9d6b26(0x98)]('\x20\x20'+a22_0x22a4da[_0x9d6b26(0x17a)](_0x129953));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x43b483+_0x9d6b26(0xcf)+_0x11243e[0x0]+'\x22');}return 0x1;}if(_0x1e013d['behavior']===!![]||_0x1e013d[_0x9d6b26(0x123)]===''){const _0x3a9bcd=_0x315d3e[_0x9d6b26(0xc5)]?.['map'](_0x92233=>_0x92233['name'])||[];if(_0x3a9bcd[_0x9d6b26(0x117)]===0x0)console[_0x9d6b26(0x98)](a22_0x22a4da['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xa2))),console['error']('Available\x20behaviors:');for(const _0x7375fc of _0x3a9bcd){console[_0x9d6b26(0x98)]('\x20\x20'+a22_0x22a4da[_0x9d6b26(0x17a)](_0x7375fc));}console[_0x9d6b26(0x98)](_0x9d6b26(0x17f)+_0x43b483+_0x9d6b26(0x199)+_0x3a9bcd[0x0]+'\x22');}return 0x1;}const _0x2f244d=createCommandSpinner(a22_0x22a4da[_0x9d6b26(0x8e)](_0x9d6b26(0x87)),{'verbose':_0x1e013d[_0x9d6b26(0x144)]});_0x2f244d[_0x9d6b26(0x160)]();const _0x85e07d={'onProgress':_0x36c8c2=>{const _0x5a9881=_0x9d6b26;_0x2f244d[_0x5a9881(0x187)]=formatProgressMessage(_0x36c8c2);}};if(_0x1e013d[_0x9d6b26(0x197)])_0x85e07d['master']=!![];if(_0x1e013d[_0x9d6b26(0x1a9)]&&typeof _0x1e013d[_0x9d6b26(0x1a9)]==='string')_0x85e07d[_0x9d6b26(0x1a9)]=_0x1e013d['attribute'];if(_0x1e013d['behavior']&&typeof _0x1e013d[_0x9d6b26(0x123)]==='string')_0x85e07d[_0x9d6b26(0x123)]=_0x1e013d[_0x9d6b26(0x123)];if(_0x1e013d['enriched'])_0x85e07d[_0x9d6b26(0x12b)]=!![];if(_0x1e013d['interval'])_0x85e07d['interval']=_0x1e013d['interval'];let _0x2b61fa;try{_0x2b61fa=await _0x15f147[_0x9d6b26(0x136)][_0x9d6b26(0x19d)](_0x185132,_0x85e07d),_0x2f244d[_0x9d6b26(0x18a)]();}catch(_0x1218f2){_0x2f244d['stop']();throw _0x1218f2;}return await this[_0x9d6b26(0x119)](_0x2b61fa,{'master':_0x1e013d[_0x9d6b26(0x197)],'attribute':typeof _0x1e013d[_0x9d6b26(0x1a9)]===_0x9d6b26(0x9b)?_0x1e013d['attribute']:undefined,'behavior':typeof _0x1e013d[_0x9d6b26(0x123)]===_0x9d6b26(0x9b)?_0x1e013d[_0x9d6b26(0x123)]:undefined,'enriched':_0x1e013d[_0x9d6b26(0x12b)]}),_0x2b61fa[_0x9d6b26(0x185)]?0x0:0x1;}async['displayPreviewResults'](_0x322548,_0xca50fb){const _0x166098=a22_0x39bd62;console[_0x166098(0x98)]('\x0a'+a22_0x22a4da[_0x166098(0xe0)](_0x166098(0x15c))+'\x20'+_0x322548['name']),console[_0x166098(0x98)]('═'[_0x166098(0x17e)](0x3c));if(_0xca50fb[_0x166098(0x197)]&&_0x322548[_0x166098(0x130)]){const _0x3447af=a22_0x22a4da['dim'](_0x166098(0x18f))+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0x322548[_0x166098(0x197)][_0x166098(0x100)]+'.'+_0x322548[_0x166098(0x197)][_0x166098(0xc9)]);await this[_0x166098(0x170)](_0x3447af,_0x322548[_0x166098(0x130)]);}else{if(_0xca50fb[_0x166098(0x1a9)]&&_0x322548['sampleData']){const _0x5c0f9a=a22_0x22a4da[_0x166098(0x8e)]('Attribute:')+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0xca50fb['attribute']);await this[_0x166098(0x170)](_0x5c0f9a,_0x322548[_0x166098(0x130)]);}else{if(_0xca50fb[_0x166098(0x123)]&&_0x322548[_0x166098(0x130)]){const _0x201cac=a22_0x22a4da[_0x166098(0x8e)]('Behavior:')+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0xca50fb[_0x166098(0x123)]);await this[_0x166098(0x170)](_0x201cac,_0x322548['sampleData']);}else{if(_0xca50fb[_0x166098(0x12b)]&&_0x322548[_0x166098(0x130)]){const _0x3e1f67=a22_0x22a4da[_0x166098(0x8e)](_0x166098(0x94))+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0x166098(0x102));await this['displaySampleData'](_0x3e1f67,_0x322548['sampleData']);}else!_0x322548[_0x166098(0x130)]&&console[_0x166098(0x98)](_0x166098(0x196));}}}if(_0x322548[_0x166098(0x12e)][_0x166098(0x117)]>0x0){console[_0x166098(0x98)]('─'[_0x166098(0x17e)](0x3c)),console[_0x166098(0x98)]('\x0a'+a22_0x22a4da['red'](_0x166098(0x10c)));for(const _0x32fc57 of _0x322548['errors']){console[_0x166098(0x98)]('\x20\x20'+a22_0x22a4da[_0x166098(0x10a)]('•')+'\x20'+_0x32fc57);}}}async[a22_0x39bd62(0x170)](_0x159661,_0xac5d6){const _0x4e4122=a22_0x39bd62;if(_0xac5d6[_0x4e4122(0x117)]===0x0){console[_0x4e4122(0x98)]('\x0a'+_0x159661),console[_0x4e4122(0x98)](_0x4e4122(0x18b));return;}console[_0x4e4122(0x98)]('\x0a'+_0x159661);const _0x385d68=Object[_0x4e4122(0xce)](_0xac5d6[0x0])['map'](_0x4a3a3d=>({'name':_0x4a3a3d,'type':typeof _0xac5d6[0x0][_0x4a3a3d]===_0x4e4122(0xb4)?_0x4e4122(0x115):_0x4e4122(0xfb)})),_0x4aae73={'queryId':_0x4e4122(0x14c),'columns':_0x385d68,'data':_0xac5d6,'stats':{'state':_0x4e4122(0x8a),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xac5d6[_0x4e4122(0x117)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5a8923=formatAsTable(_0x4aae73,_0xac5d6[_0x4e4122(0x117)],!![]);await writeOutput(_0x5a8923,undefined,_0x4e4122(0xc9));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x113);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x1a7);async[a22_0x39bd62(0xf6)](_0x559b0f){const _0x5d6221=a22_0x39bd62,{options:_0x5d7db8,args:_0xffdbf1,tdx:_0x4648ef}=_0x559b0f,_0x331c9a=_0x5d7db8,_0x29a339=_0xffdbf1[0x0]||_0x5d7db8['parentSegment'];if(!_0x29a339)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x5d6221(0x149)),0x1;const _0x50ba2c=resolveYamlFile(_0x29a339);if(existsSync(_0x50ba2c)){_0x331c9a[_0x5d6221(0x144)]&&console['error'](_0x5d6221(0x93)+_0x50ba2c);let _0x23adbf;try{_0x23adbf=readFileSync(_0x50ba2c,_0x5d6221(0xad));}catch(_0x37430e){const _0x259a66=_0x37430e instanceof Error?_0x37430e[_0x5d6221(0x96)]:String(_0x37430e);return console[_0x5d6221(0x98)]('Error\x20reading\x20file:\x20'+_0x259a66),0x1;}const _0x4221b2=await withSpinner(_0x5d6221(0x137),()=>_0x4648ef[_0x5d6221(0x136)][_0x5d6221(0x16e)](_0x23adbf),{'verbose':_0x331c9a['verbose']}),_0x55381e=_0x4221b2[_0x5d6221(0x193)],{isNew:_0x5c9695,name:_0x219a92,hasChanges:_0x2eb111,diffFormatted:_0x3f7610}=_0x55381e;if(_0x2eb111){_0x5c9695?console[_0x5d6221(0x98)](_0x5d6221(0x15a)+_0x219a92+'\x27:'):console[_0x5d6221(0x98)](_0x5d6221(0x124)+_0x219a92+'\x27:');console[_0x5d6221(0x98)]('─'[_0x5d6221(0x17e)](0x3c)),console[_0x5d6221(0x98)](_0x3f7610),console[_0x5d6221(0x98)]('─'[_0x5d6221(0x17e)](0x3c));const _0x5254b5=_0x5c9695?'Create\x20parent\x20segment\x20\x27'+_0x219a92+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x219a92+_0x5d6221(0x156);if(!_0x331c9a[_0x5d6221(0xa3)]){if(!isInteractive())return console[_0x5d6221(0x98)](a22_0x22a4da[_0x5d6221(0x10a)](_0x5d6221(0xda)),_0x5d6221(0xea)),console['error'](a22_0x22a4da['dim'](_0x5d6221(0x1c2))),0x1;const _0x254917=await confirmKey(_0x5254b5);if(!_0x254917)return console['error'](a22_0x22a4da[_0x5d6221(0xfc)]('Aborted.')),0x1;}const _0x13cb53=_0x5c9695?_0x5d6221(0x133):_0x5d6221(0x166);await withSpinner(_0x13cb53+_0x5d6221(0x1b0)+_0x219a92+_0x5d6221(0x1bd),()=>_0x55381e['apply'](),{'verbose':_0x331c9a[_0x5d6221(0x144)]});const _0x334d2d=_0x5c9695?_0x5d6221(0x8b):_0x5d6221(0x189);console[_0x5d6221(0x98)]('✔\x20'+_0x334d2d+_0x5d6221(0x1b0)+_0x219a92+'\x27');}else console[_0x5d6221(0x98)]('✔\x20No\x20changes\x20-\x20\x27'+_0x219a92+_0x5d6221(0x1bb));}const _0x5da4a2=await withSpinner(_0x5d6221(0x16c)+_0x29a339+_0x5d6221(0x1bd),()=>_0x4648ef[_0x5d6221(0x136)][_0x5d6221(0x174)](_0x29a339),{'verbose':_0x331c9a[_0x5d6221(0x144)]}),_0x3b9a3e=_0x5da4a2[_0x5d6221(0x193)],_0xd8950e=getConsoleUrl(_0x331c9a[_0x5d6221(0xf3)],_0x5d6221(0xa9)+_0x3b9a3e[_0x5d6221(0x1b9)]+'/sessions/'+_0x3b9a3e['workflowSessionId']+'/attempt/'+_0x3b9a3e['workflowAttemptId']);return console[_0x5d6221(0x98)](_0x5d6221(0x17d)),console['error']('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0xc3))+'\x20'+_0x3b9a3e[_0x5d6221(0xa4)]),console[_0x5d6221(0x98)]('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0x192))+'\x20'+_0x3b9a3e[_0x5d6221(0x104)]),console['error']('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0x15d))+'\x20'+_0x3b9a3e['workflowSessionId']),console[_0x5d6221(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x5d6221(0x16f))+'\x20'+_0x3b9a3e[_0x5d6221(0x143)]),console[_0x5d6221(0x98)]('\x20\x20'+_0xd8950e),console[_0x5d6221(0x98)]('\x0a'+a22_0x22a4da[_0x5d6221(0x8e)]('To\x20cancel:')+_0x5d6221(0x128)+_0x3b9a3e[_0x5d6221(0x143)]+_0x5d6221(0x109)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x39bd62(0x116)]='segment:parent:fields';[a22_0x39bd62(0x14e)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x27faf1){const _0x14c8e3=a22_0x39bd62,{options:_0x87b85d,args:_0x4b1a39,tdx:_0xf74eb1}=_0x27faf1,_0x186d54=_0x4b1a39[0x0]||_0x87b85d[_0x14c8e3(0xcd)];if(!_0x186d54)return showParentSegmentNotSetError(_0x14c8e3(0x110)+_0x14c8e3(0x14f)),0x1;_0x87b85d[_0x14c8e3(0x144)]&&(console[_0x14c8e3(0x98)]('Site:\x20'+_0x87b85d[_0x14c8e3(0xf3)]),console[_0x14c8e3(0x98)]('Parent\x20segment:\x20'+_0x186d54));const _0x572bcb=await withSpinner(_0x14c8e3(0x1b8)+_0x186d54+_0x14c8e3(0x1bd),()=>_0xf74eb1[_0x14c8e3(0x136)]['listFields'](_0x186d54),{'verbose':_0x87b85d[_0x14c8e3(0x144)]}),_0x10227e=_0x572bcb[_0x14c8e3(0x193)];console[_0x14c8e3(0x98)]('✔\x20Found\x20'+_0x10227e[_0x14c8e3(0x117)]+_0x14c8e3(0x16b)+(_0x10227e[_0x14c8e3(0x117)]!==0x1?'s':''));if(_0x87b85d['json']||_0x87b85d[_0x14c8e3(0x167)])return await handleSDKOutput(_0x10227e,_0x87b85d),0x0;return displayFieldsHumanReadable(_0x10227e,_0x186d54),0x0;}}function a22_0x36d3(){const _0x11a5f3=['filter','schemaError','Events:','displayPreviewHints','site','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','parent_segment','execute','✔\x20No\x20changes\x20-\x20\x27','\x20Context\x20set:\x20','Site:\x20','Listing\x20parent\x20segments...','varchar','yellow','displaySummary','coveragePercent','segment:parent:list','database','Rows:','Master\x20+\x20Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','status','column_type','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','test','\x20kill','red','push','Errors:','customerGroup','\x22,\x20\x22type\x22:\x20\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Error\x20reading\x20file:\x20','pullParentYaml','segment:parent:run','platform','double','name','length','\x20[Job\x20ID:\x20','displayPreviewResults','\x22\x20}','resolveParentId','toFixed','toLowerCase','displayValidateResults','✘\x20Failed\x20to\x20rename\x20directory:\x20','Attributes','web','%)\x20','behavior','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:create','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','customers','\x20tdx\x20wf\x20attempt\x20','parent_id','segment:parent:validate','enriched','matchedCount','information_schema','errors','Aborted.','sampleData','ignore','darwin','Creating','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','rowCount','segment','Analyzing\x20changes...','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Join:','columns','addBehaviorsFile','\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','3822XkfEBg','SQL\x20query:\x0a','sort','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','using\x20the\x20default\x20path:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','workflowAttemptId','verbose','\x20behaviors','addAttributes','column','Show\x20parent\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','population','\x0a\x20\x20\x20\x20}','preview','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','8SGAaHj','.yaml','Join\x20on:','green','addAttributesFile','replace','\x27\x20and\x20run\x20workflow?','Source:','Validate:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x0aNew\x20parent\x20segment\x20\x27','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Preview:','Session:','Available\x20attributes:','/app/dw/parentSegments/','start','json','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','1181346fGKzVd','No\x20parent\x20segments\x20found','Updating','jsonl','run','totalEvents','schemaValid','\x20field','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','dirname','pushParentYaml','Attempt:','displaySampleData','scheduleOption','unref','Error:\x20--attribute\x20requires\x20a\x20name\x0a','runParent','{\x0a\x20\x20\x22database\x22:\x20\x22','5774787ZpuOhT','addBehaviors','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','cyan','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','processedRows','\x0a✔\x20Workflow\x20started','repeat','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20=\x20','timezone','win32','join','Options:\x0a','allValid','Schema\x20saved\x20to\x20','text','/\x20directories\x20exist.','Updated','stop','\x20\x20No\x20sample\x20data\x20available','updateParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','getParentFull','Master:','\x0a\x20\x20]\x0a}\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Status:','data','✔\x20Found\x20','joinKey','\x0aNo\x20sample\x20data\x20available','master','createParent','\x20--behavior\x20\x22','segment:parent:pull','Fetching\x20SQL\x20for\x20\x27','attributesFile','previewParentYaml','\x20is\x20already\x20up\x20to\x20date','all','map','column_name','listParents','customersWithEvents','attributes','output','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','.customers)','attribute','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','282KkAuQQ','formatSchemaJson','\x0a\x20\x20\x20\x20]','setJobId','open','\x20parent\x20segment\x20\x27','.yml','label','\x27\x20with\x20ID:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','reduce','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','toLocaleString','Listing\x20fields\x20for\x20\x27','workflowId','customerPercent','\x27\x20is\x20up\x20to\x20date','displayMasterInfo','\x27...','\x20Opening\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','trim','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','/\x20→\x20','YAML\x20file:\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','customerGroupFile','foreignKey','SELECT\x20*\x20FROM\x20(\x0a','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Create\x20parent\x20segment\x20\x27','segment:parent:view','Fetching\x20sample\x20data...','displayBehaviorsStats','displayColumns','FINISHED','Created','800670AKpHnE','Fetching\x20behavior\x20list...','dim','\x20--enriched','Fetching\x20parent\x20segment\x20\x27','Overwrite\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Found\x20YAML\x20file:\x20','Enriched:','Resolving\x20parent\x20segment\x20\x27','message','Show\x20parent\x20segment\x20schema\x20(column\x20types)','error','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displayAttributesStats','string','/\x20and\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','/{name}.yml\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','collectSchema','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','yes','audienceId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Error:','/app/workflows/','jobId','Updating\x20parent\x20segment\x20\x27','match','utf-8','log','stats','Master\x20Table','\x20No\x20changes\x20-\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','No\x20parent\x20segments\x20match\x20pattern:\x20','number','Creating\x20parent\x20segment\x20\x27','Customers:','segment:parent:push','1262612OZFIyS','446616KGpoTN','\x20\x20\x20\x20-\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','getParentSQL','apply','\x5c$&','\x20--interval\x20','-1d','Parent\x20segment:\x20','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Audience\x20ID:','segment:parent:sql','behaviors','endsWith','format','Behaviors','table','10LMJASt','tdx\x20segment\x20parent\x20preview\x20','Error:\x20File\x20not\x20found:\x20','parentSegment','keys','\x20--attribute\x20\x22','\x20\x20Columns:\x20','\x20parent\x20segment','isDirectory','SELECT\x20*\x20FROM\x20','Options:','segment:parent:show','segment:parent:update','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20Configuration\x20is\x20valid','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0aError:','Error\x20parsing\x20YAML:\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Columns:','Name:\x20','bold','parent_segments','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','List\x20parent\x20segments','\x0aChanges\x20to\x20\x27','session','behavior_','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','scheduleType','1772806kZYmNn','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','interval','getBehaviorNames','\x20\x20Tables:\x201\x20customers\x20+\x20'];a22_0x36d3=function(){return _0x11a5f3;};return a22_0x36d3();}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x86);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x148);async[a22_0x39bd62(0xf6)](_0x59ddc3){const _0x343a0d=a22_0x39bd62,{options:_0x1ec973,args:_0x5c7d1d,tdx:_0x552845}=_0x59ddc3,_0x59c6f2=_0x1ec973,_0x50080b=_0x5c7d1d[0x0]||_0x1ec973[_0x343a0d(0xcd)];if(!_0x50080b)return showParentSegmentNotSetError(_0x343a0d(0x9d)+_0x343a0d(0x9f)+_0x343a0d(0x184)+_0x343a0d(0x17b)),0x1;_0x1ec973[_0x343a0d(0x144)]&&(console[_0x343a0d(0x98)](_0x343a0d(0xf9)+_0x1ec973['site']),console[_0x343a0d(0x98)](_0x343a0d(0xc1)+_0x50080b));const _0x3520bd=await withSpinner(_0x343a0d(0x90)+_0x50080b+_0x343a0d(0x1bd),()=>_0x552845[_0x343a0d(0x136)]['getParentFull'](_0x50080b),{'verbose':_0x1ec973[_0x343a0d(0x144)]}),_0x36c436=_0x3520bd[_0x343a0d(0x193)];if(_0x59c6f2[_0x343a0d(0x121)]){const _0x4b3027=getConsoleNextUrl(_0x59c6f2[_0x343a0d(0xf3)],_0x343a0d(0x15f)+_0x36c436['id']);return console['error'](a22_0x22a4da[_0x343a0d(0x153)]('✔')+_0x343a0d(0x1be)+a22_0x22a4da['cyan'](_0x4b3027)),openBrowser(_0x4b3027),0x0;}return await handleSingleObjectOutput(_0x36c436,_0x1ec973),0x0;}}function a22_0x107b(_0x1d6bb4,_0x1654d9){_0x1d6bb4=_0x1d6bb4-0x7e;const _0x36d3ba=a22_0x36d3();let _0x107bf5=_0x36d3ba[_0x1d6bb4];return _0x107bf5;}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x39bd62(0x116)]='segment:parent:desc';[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x97);async[a22_0x39bd62(0xf6)](_0x5ed639){const _0x4c9ed8=a22_0x39bd62,{options:_0xecbb2b,args:_0x483e61,tdx:_0x5c6b6f}=_0x5ed639,_0x4c5acc=_0xecbb2b,_0x3a4914=_0x483e61[0x0]||_0xecbb2b[_0x4c9ed8(0xcd)];if(!_0x3a4914)return showParentSegmentNotSetError(_0x4c9ed8(0x80)+_0x4c9ed8(0x13c)+_0x4c9ed8(0x184)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0xecbb2b['verbose']&&(console[_0x4c9ed8(0x98)](_0x4c9ed8(0xf9)+_0xecbb2b['site']),console[_0x4c9ed8(0x98)](_0x4c9ed8(0xc1)+_0x3a4914));const _0x3ca501=await withSpinner(_0x4c9ed8(0x95)+_0x3a4914+_0x4c9ed8(0x1bd),()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0x11b)](_0x3a4914),{'verbose':_0xecbb2b[_0x4c9ed8(0x144)]}),_0x23795b=_0x3ca501[_0x4c9ed8(0x193)],_0x22a990=_0x5c6b6f['segment']['getOutputDatabaseName'](_0x23795b);if(_0x4c5acc[_0x4c9ed8(0x1a5)]){const _0x31bc25=await this[_0x4c9ed8(0xa0)](_0x5ed639,_0x3a4914,_0x23795b,_0x22a990),_0xf08301=this[_0x4c9ed8(0x1ac)](_0x31bc25);writeFileSync(_0x4c5acc[_0x4c9ed8(0x1a5)],_0xf08301);const _0x255994=_0x31bc25[_0x4c9ed8(0x127)][_0x4c9ed8(0x13a)][_0x4c9ed8(0x117)]+_0x31bc25[_0x4c9ed8(0xc5)][_0x4c9ed8(0x1b5)]((_0x4b392c,_0x33bcc4)=>_0x4b392c+_0x33bcc4[_0x4c9ed8(0x13a)]['length'],0x0),_0x6506f2=_0x31bc25[_0x4c9ed8(0xc5)][_0x4c9ed8(0xef)](_0xde5806=>_0xde5806[_0x4c9ed8(0x13a)][_0x4c9ed8(0x117)]===0x0)['length'];return console[_0x4c9ed8(0xae)](_0x4c9ed8(0x186)+_0x4c5acc['output']),console[_0x4c9ed8(0xae)]('\x20\x20Database:\x20'+_0x22a990),console[_0x4c9ed8(0xae)](_0x4c9ed8(0xee)+_0x31bc25[_0x4c9ed8(0xc5)]['length']+_0x4c9ed8(0x145)),console[_0x4c9ed8(0xae)](_0x4c9ed8(0xd0)+_0x255994+'\x20total'),_0x6506f2>0x0&&console[_0x4c9ed8(0xae)]('\x20\x20Note:\x20'+_0x6506f2+_0x4c9ed8(0x84)),0x0;}console[_0x4c9ed8(0x98)]('\x0a'+a22_0x22a4da['bold']('Output\x20Database:')+'\x20'+a22_0x22a4da[_0x4c9ed8(0x17a)](_0x22a990));const _0x2c34c9=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0xbc)](_0x23795b),{'verbose':_0xecbb2b['verbose']});console['error']('\x0a'+a22_0x22a4da[_0x4c9ed8(0xe0)]('customers')+'\x20'+a22_0x22a4da[_0x4c9ed8(0x8e)]('('+_0x22a990+_0x4c9ed8(0x1a8)));const _0x37521d=await executeSchemaQuery(_0x2c34c9['data'],_0x5c6b6f,_0xecbb2b);await handleQueryOutput(_0x37521d,_0xecbb2b);const _0x21aa43=await withSpinner(_0x4c9ed8(0x8d),()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0xed)](_0x23795b),{'verbose':_0xecbb2b[_0x4c9ed8(0x144)]});for(const _0x5d47c2 of _0x21aa43[_0x4c9ed8(0x193)]){const _0x5e7f30='behavior_'+_0x5d47c2[_0x4c9ed8(0x11d)]()['replace'](/\s+/g,'_'),_0x396f53=_0x4c9ed8(0xd3)+_0x22a990+'.'+_0x5e7f30;console['error']('\x0a'+a22_0x22a4da[_0x4c9ed8(0xe0)](_0x5d47c2)+'\x20'+a22_0x22a4da['dim']('('+_0x22a990+'.'+_0x5e7f30+')'));try{const _0x4ef127=await executeSchemaQuery(_0x396f53,_0x5c6b6f,_0xecbb2b);await handleQueryOutput(_0x4ef127,_0xecbb2b);}catch{console[_0x4c9ed8(0x98)](a22_0x22a4da['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x39bd62(0xa0)](_0x206c66,_0xf1510f,_0x507a72,_0x261a29){const _0x413c38=a22_0x39bd62,{options:_0x29f28d,tdx:_0x1b9e9f}=_0x206c66,_0x21599e=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x1b9e9f['segment'][_0x413c38(0xbc)](_0x507a72),{'verbose':_0x29f28d['verbose']}),_0x46d291=await executeSchemaQuery(_0x21599e[_0x413c38(0x193)],_0x1b9e9f,_0x29f28d),_0x58b4e4=_0x46d291[_0x413c38(0x193)][_0x413c38(0x1a0)](_0x36ca73=>({'name':_0x36ca73[_0x413c38(0x1a1)],'type':_0x36ca73[_0x413c38(0x105)]})),_0x1e2d73=await withSpinner(_0x413c38(0x8d),()=>_0x1b9e9f[_0x413c38(0x136)]['getBehaviorNames'](_0x507a72),{'verbose':_0x29f28d[_0x413c38(0x144)]}),_0x45b236=[];for(const _0x1e7d6c of _0x1e2d73['data']){const _0x5594e3=_0x413c38(0xe6)+_0x1e7d6c[_0x413c38(0x11d)]()[_0x413c38(0x155)](/\s+/g,'_'),_0x6a069f='SELECT\x20*\x20FROM\x20'+_0x261a29+'.'+_0x5594e3;let _0x4aaa28=[];try{const _0x1f90a4=await executeSchemaQuery(_0x6a069f,_0x1b9e9f,_0x29f28d);_0x4aaa28=_0x1f90a4[_0x413c38(0x193)][_0x413c38(0x1a0)](_0x40d0c7=>({'name':_0x40d0c7['column_name'],'type':_0x40d0c7[_0x413c38(0x105)]}));}catch{}_0x45b236[_0x413c38(0x10b)]({'table':_0x5594e3,'columns':_0x4aaa28});}return{'database':_0x261a29,'parent_segment':_0xf1510f,'parent_id':_0x507a72,'customers':{'table':_0x413c38(0x127),'columns':_0x58b4e4},'behaviors':_0x45b236};}['formatSchemaJson'](_0x1711b7){const _0x16ac88=a22_0x39bd62,_0x5a7544=_0x5624b5=>{const _0x29e77b=a22_0x107b;if(_0x5624b5[_0x29e77b(0x117)]===0x0)return'[]';const _0x341c16=_0x5624b5[_0x29e77b(0x1a0)](_0x825e54=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x825e54['name']+_0x29e77b(0x10e)+_0x825e54['type']+_0x29e77b(0x11a));return'[\x0a'+_0x341c16[_0x29e77b(0x183)](',\x0a')+_0x29e77b(0x1ad);},_0x1c1592=_0x1711b7[_0x16ac88(0xc5)][_0x16ac88(0x1a0)](_0x312139=>{const _0x39304f=_0x16ac88;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x312139[_0x39304f(0xc9)]+_0x39304f(0x138)+_0x5a7544(_0x312139[_0x39304f(0x13a)])[_0x39304f(0x155)](/^/gm,'\x20\x20')[_0x39304f(0x1c1)]()+_0x39304f(0x14b);})[_0x16ac88(0x183)](',\x0a');return _0x16ac88(0x175)+_0x1711b7[_0x16ac88(0x100)]+_0x16ac88(0xc2)+_0x1711b7[_0x16ac88(0xf5)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x1711b7[_0x16ac88(0x129)]+_0x16ac88(0x191)+_0x1711b7[_0x16ac88(0x127)]['table']+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x5a7544(_0x1711b7['customers']['columns'])['replace'](/^/gm,'\x20\x20')[_0x16ac88(0x1c1)]()+_0x16ac88(0xbb)+_0x1c1592+_0x16ac88(0x190);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xc4);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x5939f2){const _0x31e10b=a22_0x39bd62,{options:_0x5679c6,args:_0xaa25b1,tdx:_0xa685df}=_0x5939f2,_0x5d5df8=_0xaa25b1[0x0]||_0x5679c6[_0x31e10b(0xcd)];if(!_0x5d5df8)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'+_0x31e10b(0x18d)),0x1;_0x5679c6['verbose']&&(console['error'](_0x31e10b(0xf9)+_0x5679c6[_0x31e10b(0xf3)]),console['error'](_0x31e10b(0xc1)+_0x5d5df8));const _0x23dff4=await withSpinner(_0x31e10b(0x95)+_0x5d5df8+_0x31e10b(0x1bd),()=>_0xa685df[_0x31e10b(0x136)][_0x31e10b(0x11b)](_0x5d5df8),{'verbose':_0x5679c6[_0x31e10b(0x144)]}),_0x2777d1=_0x23dff4['data'],_0x8dfc9f=await withSpinner(_0x31e10b(0x19b)+_0x5d5df8+'\x27...',()=>_0xa685df[_0x31e10b(0x136)]['getParentSQL'](_0x2777d1),{'verbose':_0x5679c6[_0x31e10b(0x144)]}),_0x472dc5=_0x8dfc9f[_0x31e10b(0x193)];return _0x5679c6[_0x31e10b(0xc7)]==='json'||_0x5679c6['format']===_0x31e10b(0x167)?await handleSDKOutput([{'sql':_0x472dc5}],_0x5679c6):console[_0x31e10b(0xae)](_0x472dc5),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xd5);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x15b);async[a22_0x39bd62(0xf6)](_0xaa53f5){const _0x254198=a22_0x39bd62,{options:_0x10a8a3,args:_0x27eca2,tdx:_0x30371c}=_0xaa53f5,_0x47c30b=_0x27eca2[0x0]||_0x10a8a3[_0x254198(0xcd)];if(!_0x47c30b)return showParentSegmentNotSetError(_0x254198(0x99)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x10a8a3[_0x254198(0x144)]&&(console[_0x254198(0x98)](_0x254198(0xf9)+_0x10a8a3[_0x254198(0xf3)]),console[_0x254198(0x98)](_0x254198(0xc1)+_0x47c30b));const _0x5cc18b=await withSpinner(_0x254198(0x95)+_0x47c30b+'\x27...',()=>_0x30371c[_0x254198(0x136)]['resolveParentId'](_0x47c30b),{'verbose':_0x10a8a3[_0x254198(0x144)]}),_0x229980=_0x5cc18b[_0x254198(0x193)],_0xa3480d=await withSpinner(_0x254198(0x19b)+_0x47c30b+_0x254198(0x1bd),()=>_0x30371c['segment'][_0x254198(0xbc)](_0x229980),{'verbose':_0x10a8a3['verbose']});let _0x1698c5=_0xa3480d[_0x254198(0x193)];const _0x331dda=resolveLimit(_0x10a8a3['limit'],DEFAULT_DISPLAY_LIMIT),_0x5060bf=/\bLIMIT\s+\d+/i[_0x254198(0x108)](_0x1698c5);!_0x5060bf&&(_0x1698c5=_0x1698c5[_0x254198(0x1c1)]()[_0x254198(0x155)](/;+$/,''),_0x1698c5=_0x254198(0x83)+_0x1698c5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x331dda);_0x10a8a3[_0x254198(0x144)]&&console[_0x254198(0x98)](_0x254198(0x13e)+_0x1698c5);const _0x159226=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x25b4ec=>{const _0x41cd94=_0x254198,_0xc187bf=await _0x30371c['query'][_0x41cd94(0xf6)](_0x1698c5,{'catalog':'td','schema':_0x41cd94(0x12d),'onJobId':_0x4f3383=>{const _0x3a1141=_0x41cd94;_0x25b4ec[_0x3a1141(0x1ae)](_0x4f3383);}});return _0xc187bf;},{'verbose':_0x10a8a3[_0x254198(0x144)]}),_0x4973c9=_0x159226[_0x254198(0x193)],_0x128cd3=_0x4973c9['jobId']?_0x254198(0x118)+_0x4973c9[_0x254198(0xaa)]+']':'';return console[_0x254198(0x98)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x4973c9['stats'][_0x254198(0x17c)][_0x254198(0x1b7)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4973c9[_0x254198(0xaf)]['elapsedTimeMillis'])+_0x128cd3)),await handleQueryOutput(_0x4973c9,_0x10a8a3),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x170e36=a23_0x5cb7;(function(_0x552478,_0x49c554){const _0x5ca5db=a23_0x5cb7,_0xfa4789=_0x552478();while(!![]){try{const _0x463624=parseInt(_0x5ca5db(0x1b1))/0x1+parseInt(_0x5ca5db(0x1b8))/0x2*(-parseInt(_0x5ca5db(0x203))/0x3)+-parseInt(_0x5ca5db(0x200))/0x4*(-parseInt(_0x5ca5db(0x201))/0x5)+parseInt(_0x5ca5db(0x1d8))/0x6*(-parseInt(_0x5ca5db(0x1c3))/0x7)+-parseInt(_0x5ca5db(0x20a))/0x8+-parseInt(_0x5ca5db(0x208))/0x9*(parseInt(_0x5ca5db(0x1c2))/0xa)+parseInt(_0x5ca5db(0x1bd))/0xb;if(_0x463624===_0x49c554)break;else _0xfa4789['push'](_0xfa4789['shift']());}catch(_0xf208f1){_0xfa4789['push'](_0xfa4789['shift']());}}}(a23_0x4617,0x5fe45));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_0x69395c 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';function a23_0x4617(){const _0x2bc693=['639sKPMuL','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','4603120vdmXTk','name','profileName','logLevel','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20Profile\x20\x27','Enter\x20site\x20name:','create','profile:use','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:remove','Enter\x20profile\x20name:','Site\x20name\x20cannot\x20be\x20empty','green','split','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:create','us01','default','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','597653rChiSX','database','Failed\x20to\x20remove\x20profile:\x20','Validating\x20API\x20key...','password','log','\x27\x20does\x20not\x20exist.','712184ZkbGza','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','confirm','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','15050255iEOzMa','\x20\x20(no\x20profiles\x20found)','/app/mp/ak','message','\x20\x20-\x20','17970OVsagS','7vAwiwS','(session:\x20','(cleared)','\x27\x20does\x20not\x20exist.\x20Create\x20it?','test','parent_segment','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aAvailable\x20profiles:','length','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20created','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','yellow','tdx:\x20profile\x20remove','bold','Removal\x20cancelled','description','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','customSite','2486994nJkqbr','\x20--default\x27\x20to\x20save\x20permanently','status','Profile\x20name\x20cannot\x20be\x20empty','You\x20can\x20find\x20your\x20API\x20key\x20at:','Set\x20session\x20profile','red','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20\x20tdx\x20--profile\x20','select','site','\x27.\x0a\x0aValid\x20keys:\x20','\x0aOperation\x20cancelled','\x0aSetup\x20cancelled','VALID_KEYS','tdx:\x20profile\x20set','tdx.json','session','validate','text','✗\x20Validation\x20failed:\x20','execute','llm_agent','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','includes','dim','Unknown\x20key\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx:\x20profile\x20create','email','apiKey','Session\x20profile\x20set\x20to:\x20','trim','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20updated:\x20','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','Set\x20a\x20profile\x20configuration\x20value','Profile\x20\x27','13684LhhePY','375vOhWQA','Default\x20profile\x20set\x20to:\x20','6GNGzCP','config','warn','ERROR','join'];a23_0x4617=function(){return _0x2bc693;};return a23_0x4617();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';function a23_0x5cb7(_0x2d5811,_0x167491){_0x2d5811=_0x2d5811-0x1a6;const _0x4617b6=a23_0x4617();let _0x5cb7c3=_0x4617b6[_0x2d5811];return _0x5cb7c3;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x6247f5 from'prompts';import a23_0x1ab027 from'chalk';function validateProfileName(_0xf545c7){const _0x2de21d=a23_0x5cb7;if(!_0xf545c7||!_0xf545c7[_0x2de21d(0x1f9)]())return _0x2de21d(0x1db);const _0x52b7c3=_0xf545c7[_0x2de21d(0x1f9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x2de21d(0x1c7)](_0x52b7c3))return _0x2de21d(0x213);if(profileExists(_0x52b7c3))return _0x2de21d(0x1ff)+_0x52b7c3+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x1ac);[a23_0x170e36(0x1d3)]='Create\x20a\x20new\x20profile';async[a23_0x170e36(0x1ed)](_0x2c45dd){const _0x12d4fb=a23_0x170e36,{options:_0x24873b,args:_0x2b4855}=_0x2c45dd;console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1d1)](_0x12d4fb(0x1f5)));let _0x2e867b;if(_0x2b4855['length']>0x0&&_0x2b4855[0x0]){const _0x1c59c3=_0x2b4855[0x0][_0x12d4fb(0x1f9)](),_0x2b367f=validateProfileName(_0x1c59c3);if(_0x2b367f!==!![])return console[_0x12d4fb(0x1aa)](a23_0x1ab027[_0x12d4fb(0x1de)](_0x2b367f)),0x1;_0x2e867b=_0x1c59c3;}else{const _0x5d9a44=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x20c),'message':_0x12d4fb(0x215),'validate':validateProfileName});if(!_0x5d9a44[_0x12d4fb(0x20c)])return console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e5)),0x1;_0x2e867b=_0x5d9a44[_0x12d4fb(0x20c)][_0x12d4fb(0x1f9)]();}const _0x4edb45=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x1d3),'message':_0x12d4fb(0x1fc)}),_0x1804f1=_0x4edb45['description']?.[_0x12d4fb(0x1f9)]()||undefined,_0x2f440b=_0x24873b[_0x12d4fb(0x1e2)]||_0x12d4fb(0x1ad),{choices:_0x3d20d2,initialIndex:_0x3d2add}=buildSiteChoices(_0x2f440b),_0xd6e67f=await a23_0x6247f5({'type':_0x12d4fb(0x1e1),'name':_0x12d4fb(0x1e2),'message':_0x12d4fb(0x209)+_0x2e867b+'\x27:','choices':_0x3d20d2,'initial':_0x3d2add});if(!_0xd6e67f['site'])return console['log'](_0x12d4fb(0x1e5)),0x1;let _0x1ae216;if(_0xd6e67f['site']==='other'){const _0x151722=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x1d7),'message':_0x12d4fb(0x210),'initial':'us01','validate':_0x5d9eb6=>{const _0x1a7153=_0x12d4fb;if(!_0x5d9eb6||!_0x5d9eb6[_0x1a7153(0x1f9)]())return _0x1a7153(0x1a6);if(!/^[a-z0-9-]+$/[_0x1a7153(0x1c7)](_0x5d9eb6[_0x1a7153(0x1f9)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x151722[_0x12d4fb(0x1d7)])return console[_0x12d4fb(0x1b6)]('\x0aSetup\x20cancelled'),0x1;_0x1ae216=_0x151722[_0x12d4fb(0x1d7)];}else _0x1ae216=_0xd6e67f[_0x12d4fb(0x1e2)];const _0x2d9116=resolveSite(_0x1ae216);console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1bc)+_0x2d9116),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1dc)),console[_0x12d4fb(0x1b6)]('\x20\x20'+getConsoleUrl(_0x2d9116,_0x12d4fb(0x1bf)));const _0x2188c5=await a23_0x6247f5({'type':_0x12d4fb(0x1b5),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x24bbba=>{const _0x502dbe=_0x12d4fb;if(!_0x24bbba||!_0x24bbba[_0x502dbe(0x1f9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2188c5[_0x12d4fb(0x1f7)])return console['log'](_0x12d4fb(0x1e5)),0x1;const _0x4085c9=_0x2188c5[_0x12d4fb(0x1f7)];console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1b4));try{const _0x156618=TDX[_0x12d4fb(0x211)]({'site':_0x2d9116,'apiKey':_0x4085c9[_0x12d4fb(0x1f9)](),'logLevel':_0x24873b['logLevel']??LogLevel['ERROR']}),_0xd3f4f5=await _0x156618['jobs']['getUserInfo']();console['log'](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x1d4)+_0xd3f4f5[_0x12d4fb(0x1f6)]+')');const _0x1e509d=await isKeychainAvailable();_0x1e509d?(await saveAPIKeyAsync(_0x4085c9['trim'](),_0x2d9116,_0x2e867b),console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x1f0)+_0x2e867b+')')):(console[_0x12d4fb(0x205)](a23_0x1ab027[_0x12d4fb(0x1cf)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x12d4fb(0x205)](a23_0x1ab027[_0x12d4fb(0x1cf)](_0x12d4fb(0x1d6))));const _0x3eefb0={'site':_0x2d9116,..._0x1804f1&&{'description':_0x1804f1}};return saveProfileToUserConfig(_0x2e867b,_0x3eefb0),console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x20f)+_0x2e867b+_0x12d4fb(0x1cd)),console[_0x12d4fb(0x1b6)](),console[_0x12d4fb(0x1b6)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e0)+_0x2e867b+_0x12d4fb(0x1b0)),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e0)+_0x2e867b+_0x12d4fb(0x1df)),0x0;}catch(_0x43f07b){if(_0x43f07b instanceof HTTPClientError&&_0x43f07b[_0x12d4fb(0x1da)]===0x191)return printAuthError(_0x43f07b),0x1;return console[_0x12d4fb(0x1aa)](a23_0x1ab027[_0x12d4fb(0x1de)](_0x12d4fb(0x1ec)+(_0x43f07b instanceof Error?_0x43f07b['message']:String(_0x43f07b)))),console[_0x12d4fb(0x1aa)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x214);[a23_0x170e36(0x1d3)]='Remove\x20a\x20profile';['validate'](_0x211f87){const _0x39023a=a23_0x170e36,{args:_0x1a7cc3}=_0x211f87;if(_0x1a7cc3[_0x39023a(0x1cb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x170e36(0x1ed)](_0x1135a6){const _0x4a3d6a=a23_0x170e36,{args:_0x392a61}=_0x1135a6,_0xf639cc=_0x392a61[0x0];console['log'](a23_0x1ab027['bold'](_0x4a3d6a(0x1d0)));if(!profileExists(_0xf639cc)){console[_0x4a3d6a(0x1aa)](a23_0x1ab027[_0x4a3d6a(0x1de)](_0x4a3d6a(0x1ff)+_0xf639cc+_0x4a3d6a(0x1b7))),console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1ca));const _0x1dc0c0=listProfiles();if(_0x1dc0c0[_0x4a3d6a(0x1cb)]===0x0)console[_0x4a3d6a(0x1b6)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1ac28d of _0x1dc0c0){console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1c1)+_0x1ac28d[_0x4a3d6a(0x20b)]);}return 0x1;}const _0x297ab5=await a23_0x6247f5({'type':_0x4a3d6a(0x1bb),'name':'confirm','message':_0x4a3d6a(0x1c9)+_0xf639cc+'\x27?','initial':![]});if(!_0x297ab5[_0x4a3d6a(0x1bb)])return console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1d2)),0x0;try{removeProfileFromUserConfig(_0xf639cc),console['log'](a23_0x1ab027[_0x4a3d6a(0x1a7)]('✓')+_0x4a3d6a(0x20f)+_0xf639cc+'\x27\x20removed\x20from\x20configuration');}catch(_0x3be4a4){return console[_0x4a3d6a(0x1aa)](a23_0x1ab027[_0x4a3d6a(0x1de)](_0x4a3d6a(0x1b3)+(_0x3be4a4 instanceof Error?_0x3be4a4[_0x4a3d6a(0x1c0)]:String(_0x3be4a4)))),0x1;}const _0x7180ab=await isKeychainAvailable();if(_0x7180ab){const _0x42971a=await deleteKeychainAPIKey(_0xf639cc);_0x42971a&&console[_0x4a3d6a(0x1b6)](a23_0x1ab027[_0x4a3d6a(0x1a7)]('✓')+_0x4a3d6a(0x1b9));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x170e36(0x20b)]='profile:set';[a23_0x170e36(0x1d3)]=a23_0x170e36(0x1fe);static [a23_0x170e36(0x1e6)]=[a23_0x170e36(0x1e2),a23_0x170e36(0x1b2),a23_0x170e36(0x1c8),'llm_project',a23_0x170e36(0x1ee),a23_0x170e36(0x1d3)];[a23_0x170e36(0x1ea)](_0x2d7ac5){const _0xead38f=a23_0x170e36,{args:_0x303173,options:_0x285a78}=_0x2d7ac5,_0x397381=_0x285a78['profile']||getActiveProfile();if(!_0x397381)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x303173['length']===0x0)return _0xead38f(0x1a9)+ProfileSetCommand[_0xead38f(0x1e6)]['join'](',\x20');const _0x2fd98d=_0x303173[0x0];if(!_0x2fd98d['includes']('='))return _0xead38f(0x1ba)+ProfileSetCommand[_0xead38f(0x1e6)][_0xead38f(0x207)](',\x20');const [_0x3a82c1]=_0x2fd98d['split']('=',0x2);if(!ProfileSetCommand[_0xead38f(0x1e6)][_0xead38f(0x1f1)](_0x3a82c1))return _0xead38f(0x1f3)+_0x3a82c1+_0xead38f(0x1e3)+ProfileSetCommand['VALID_KEYS'][_0xead38f(0x207)](',\x20');return undefined;}async[a23_0x170e36(0x1ed)](_0x29cfae){const _0x5b2659=a23_0x170e36,{args:_0x34d4dd,options:_0x53ff01}=_0x29cfae,_0x31c2e0=_0x53ff01[_0x5b2659(0x1d5)]||getActiveProfile(),[_0xc03933,..._0x1f8004]=_0x34d4dd[0x0][_0x5b2659(0x1a8)]('='),_0xe17770=_0x1f8004['join']('=');console[_0x5b2659(0x1b6)](a23_0x1ab027['bold'](_0x5b2659(0x1e7)));if(!profileExists(_0x31c2e0)){const _0xb50271=await a23_0x6247f5({'type':_0x5b2659(0x1bb),'name':_0x5b2659(0x211),'message':'Profile\x20\x27'+_0x31c2e0+_0x5b2659(0x1c6),'initial':!![]});if(!_0xb50271[_0x5b2659(0x211)])return console[_0x5b2659(0x1b6)]('Operation\x20cancelled'),0x1;}const _0x23e5d0=loadProfile(_0x31c2e0),_0x4e5d24=_0x23e5d0?.[_0x5b2659(0x204)]||{};if(_0xc03933===_0x5b2659(0x1e2)){const _0x59e590=resolveSite(_0xe17770);console[_0x5b2659(0x1b6)](_0x5b2659(0x1fd)+_0x59e590+_0x5b2659(0x1fa)),console[_0x5b2659(0x1b6)](_0x5b2659(0x20e)),console[_0x5b2659(0x1b6)]('\x20\x20'+getConsoleUrl(_0x59e590,_0x5b2659(0x1bf)));const _0xd689a2=await a23_0x6247f5({'type':_0x5b2659(0x1b5),'name':_0x5b2659(0x1f7),'message':_0x5b2659(0x1ab),'validate':_0x261939=>{const _0x1935ba=_0x5b2659;if(!_0x261939||!_0x261939[_0x1935ba(0x1f9)]())return _0x1935ba(0x1ef);return!![];}});if(!_0xd689a2[_0x5b2659(0x1f7)])return console['log'](_0x5b2659(0x1e4)),0x1;console[_0x5b2659(0x1b6)](_0x5b2659(0x1b4));try{const _0x398376=TDX['create']({'site':_0x59e590,'apiKey':_0xd689a2['apiKey'][_0x5b2659(0x1f9)](),'logLevel':_0x53ff01[_0x5b2659(0x20d)]??LogLevel[_0x5b2659(0x206)]}),_0x50e9ef=await _0x398376['jobs']['getUserInfo']();console[_0x5b2659(0x1b6)](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x50e9ef['email']+')');const _0x138718=await isKeychainAvailable();_0x138718?(await saveAPIKeyAsync(_0xd689a2[_0x5b2659(0x1f7)][_0x5b2659(0x1f9)](),_0x59e590,_0x31c2e0),console['log'](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+_0x5b2659(0x1af))):console[_0x5b2659(0x205)](a23_0x1ab027[_0x5b2659(0x1cf)](_0x5b2659(0x1cc))),_0x4e5d24[_0x5b2659(0x1e2)]=_0x59e590;}catch(_0x1ded52){if(_0x1ded52 instanceof HTTPClientError&&_0x1ded52[_0x5b2659(0x1da)]===0x191)return printAuthError(_0x1ded52),0x1;return console['error'](a23_0x1ab027[_0x5b2659(0x1de)](_0x5b2659(0x1ec)+(_0x1ded52 instanceof Error?_0x1ded52[_0x5b2659(0x1c0)]:String(_0x1ded52)))),console[_0x5b2659(0x1aa)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4e5d24[_0xc03933]=_0xe17770||undefined;return saveProfileToUserConfig(_0x31c2e0,_0x4e5d24),console[_0x5b2659(0x1b6)](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+_0x5b2659(0x20f)+_0x31c2e0+_0x5b2659(0x1fb)+_0xc03933+'='+(_0xe17770||_0x5b2659(0x1c5))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x212);['description']=a23_0x170e36(0x1dd);['validate'](_0x368186){const _0x1710bc=a23_0x170e36,{args:_0x2487b5}=_0x368186;if(_0x2487b5[_0x1710bc(0x1cb)]===0x0)return _0x1710bc(0x1ce);return undefined;}async[a23_0x170e36(0x1ed)](_0x1686ce){const _0x5a8d92=a23_0x170e36,{args:_0x2cf97d,options:_0x50bd37}=_0x1686ce,_0x5b95bb=_0x2cf97d[0x0],_0x5abc3a=_0x50bd37[_0x5a8d92(0x1ae)];cleanExpiredSessions();if(!profileExists(_0x5b95bb)){console['error'](a23_0x1ab027['red'](_0x5a8d92(0x1ff)+_0x5b95bb+_0x5a8d92(0x1b7))),console['log'](_0x5a8d92(0x1ca));const _0x37e6aa=listProfiles();if(_0x37e6aa[_0x5a8d92(0x1cb)]===0x0)console[_0x5a8d92(0x1b6)](_0x5a8d92(0x1be));else for(const _0x19b78c of _0x37e6aa){console[_0x5a8d92(0x1b6)](_0x5a8d92(0x1c1)+_0x19b78c['name']);}return 0x1;}if(_0x5abc3a){const _0x4b3a1c=a23_0x69395c[_0x5a8d92(0x207)](getConfigDir(),_0x5a8d92(0x1e8));return saveActiveProfileToUserConfig(_0x5b95bb),console[_0x5a8d92(0x1b6)](_0x5a8d92(0x202)+a23_0x1ab027[_0x5a8d92(0x1a7)](_0x5b95bb)),console['log'](a23_0x1ab027[_0x5a8d92(0x1f2)]('\x0aSaved\x20to:\x20'+_0x4b3a1c)),0x0;}const _0x3269b7=getSessionID(_0x50bd37[_0x5a8d92(0x1e9)]);return saveSessionContext({'profile':_0x5b95bb},_0x50bd37['session']),console['log'](_0x5a8d92(0x1f8)+a23_0x1ab027[_0x5a8d92(0x1a7)](_0x5b95bb)+'\x20'+a23_0x1ab027[_0x5a8d92(0x1f2)](_0x5a8d92(0x1c4)+_0x3269b7+')')),console['log'](a23_0x1ab027[_0x5a8d92(0x1f2)](_0x5a8d92(0x1f4)+_0x5b95bb+_0x5a8d92(0x1d9))),0x0;}}
|
|
1
|
+
function a23_0x1702(){const _0x239320=['warn','name','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','apiKey','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','customSite','✗\x20Validation\x20failed:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:use','database','Enter\x20description\x20(optional):','status','\x0aSaved\x20to:\x20','confirm','config','default','tdx:\x20profile\x20create','Enter\x20your\x20TD\x20API\x20key:','230866LrtDux','tdx.json','\x27\x20created','join','other','profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','green','You\x20can\x20find\x20your\x20API\x20key\x20at:','Remove\x20a\x20profile','API\x20key\x20cannot\x20be\x20empty','\x27\x20requires\x20API\x20key\x20validation.','length','tdx:\x20profile\x20remove','VALID_KEYS','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20tdx\x20--profile\x20','\x20--default\x27\x20to\x20save\x20permanently','76vJLMVQ','\x0aOperation\x20cancelled','text','logLevel','\x20API\x20key\x20removed\x20from\x20system\x20keychain','includes','Site\x20was\x20not\x20changed.','email','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Create\x20a\x20new\x20profile','password','(cleared)','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profileName','Default\x20profile\x20set\x20to:\x20','site','8owcosS','jobs','2367477CotAWG','Profile\x20name\x20cannot\x20be\x20empty','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSetup\x20cancelled','log','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','884219vgcglq','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','split','6KYZgyL','\x20\x20-\x20','validate','/app/mp/ak','execute','description','tdx:\x20profile\x20set','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Enter\x20profile\x20name:','34266iRJeJc','Set\x20a\x20profile\x20configuration\x20value','\x0aAvailable\x20profiles:','(session:\x20','red','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20\x27','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','test','message','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20\x20(no\x20profiles\x20found)','Validating\x20API\x20key...','\x27\x20removed\x20from\x20configuration','Failed\x20to\x20remove\x20profile:\x20','\x20Profile\x20\x27','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','session','bold','Operation\x20cancelled','llm_agent','1188InCEcQ','217180GUyZzW','Site\x20name\x20cannot\x20be\x20empty','yellow','trim','Changing\x20site\x20to\x20\x27','95780SUXjEZ','\x27\x20does\x20not\x20exist.','getUserInfo','us01','profile:create','error','17960xCjXco','\x27\x20updated:\x20','Removal\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'];a23_0x1702=function(){return _0x239320;};return a23_0x1702();}const a23_0x1ae9b2=a23_0x8a9c;(function(_0x42ba05,_0x1e0af1){const _0x44022f=a23_0x8a9c,_0x1c43f7=_0x42ba05();while(!![]){try{const _0x3f2ad0=-parseInt(_0x44022f(0x15f))/0x1+parseInt(_0x44022f(0x1b2))/0x2+-parseInt(_0x44022f(0x195))/0x3*(-parseInt(_0x44022f(0x171))/0x4)+parseInt(_0x44022f(0x1ad))/0x5*(-parseInt(_0x44022f(0x18c))/0x6)+parseInt(_0x44022f(0x189))/0x7+parseInt(_0x44022f(0x181))/0x8*(parseInt(_0x44022f(0x183))/0x9)+-parseInt(_0x44022f(0x145))/0xa*(parseInt(_0x44022f(0x1ac))/0xb);if(_0x3f2ad0===_0x1e0af1)break;else _0x1c43f7['push'](_0x1c43f7['shift']());}catch(_0x17f584){_0x1c43f7['push'](_0x1c43f7['shift']());}}}(a23_0x1702,0x2d698));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_0x429941 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';function a23_0x8a9c(_0xaf09ff,_0x460e27){_0xaf09ff=_0xaf09ff-0x145;const _0x170289=a23_0x1702();let _0x8a9cbe=_0x170289[_0xaf09ff];return _0x8a9cbe;}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x281952 from'prompts';import a23_0x55073e from'chalk';function validateProfileName(_0x1c714e){const _0x5ee105=a23_0x8a9c;if(!_0x1c714e||!_0x1c714e[_0x5ee105(0x1b0)]())return _0x5ee105(0x184);const _0x24e214=_0x1c714e[_0x5ee105(0x1b0)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5ee105(0x19e)](_0x24e214))return _0x5ee105(0x179);if(profileExists(_0x24e214))return _0x5ee105(0x19b)+_0x24e214+_0x5ee105(0x188);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]=a23_0x1ae9b2(0x1b6);[a23_0x1ae9b2(0x191)]=a23_0x1ae9b2(0x17a);async[a23_0x1ae9b2(0x190)](_0xb433e6){const _0x20f5ce=a23_0x1ae9b2,{options:_0x30a280,args:_0x220470}=_0xb433e6;console[_0x20f5ce(0x187)](a23_0x55073e[_0x20f5ce(0x1a9)](_0x20f5ce(0x15d)));let _0x11db46;if(_0x220470[_0x20f5ce(0x16b)]>0x0&&_0x220470[0x0]){const _0x3d9fd4=_0x220470[0x0]['trim'](),_0x5359a4=validateProfileName(_0x3d9fd4);if(_0x5359a4!==!![])return console[_0x20f5ce(0x1b7)](a23_0x55073e['red'](_0x5359a4)),0x1;_0x11db46=_0x3d9fd4;}else{const _0x41d0ca=await a23_0x281952({'type':_0x20f5ce(0x173),'name':_0x20f5ce(0x17e),'message':_0x20f5ce(0x194),'validate':validateProfileName});if(!_0x41d0ca[_0x20f5ce(0x17e)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;_0x11db46=_0x41d0ca[_0x20f5ce(0x17e)][_0x20f5ce(0x1b0)]();}const _0x52666d=await a23_0x281952({'type':_0x20f5ce(0x173),'name':'description','message':_0x20f5ce(0x157)}),_0x1c6d94=_0x52666d[_0x20f5ce(0x191)]?.[_0x20f5ce(0x1b0)]()||undefined,_0x1eaf2e=_0x30a280[_0x20f5ce(0x180)]||_0x20f5ce(0x1b5),{choices:_0xc17a45,initialIndex:_0x38936c}=buildSiteChoices(_0x1eaf2e),_0x561931=await a23_0x281952({'type':'select','name':_0x20f5ce(0x180),'message':_0x20f5ce(0x1a7)+_0x11db46+'\x27:','choices':_0xc17a45,'initial':_0x38936c});if(!_0x561931[_0x20f5ce(0x180)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;let _0x51aec2;if(_0x561931[_0x20f5ce(0x180)]===_0x20f5ce(0x163)){const _0x2b4d67=await a23_0x281952({'type':'text','name':_0x20f5ce(0x150),'message':'Enter\x20site\x20name:','initial':_0x20f5ce(0x1b5),'validate':_0x122611=>{const _0x5de063=_0x20f5ce;if(!_0x122611||!_0x122611[_0x5de063(0x1b0)]())return _0x5de063(0x1ae);if(!/^[a-z0-9-]+$/[_0x5de063(0x19e)](_0x122611[_0x5de063(0x1b0)]()))return _0x5de063(0x14f);return!![];}});if(!_0x2b4d67[_0x20f5ce(0x150)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;_0x51aec2=_0x2b4d67['customSite'];}else _0x51aec2=_0x561931[_0x20f5ce(0x180)];const _0x330cc9=resolveSite(_0x51aec2);console[_0x20f5ce(0x187)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x330cc9),console[_0x20f5ce(0x187)](_0x20f5ce(0x167)),console[_0x20f5ce(0x187)]('\x20\x20'+getConsoleUrl(_0x330cc9,_0x20f5ce(0x18f)));const _0x3a5d99=await a23_0x281952({'type':_0x20f5ce(0x17b),'name':_0x20f5ce(0x14e),'message':_0x20f5ce(0x15e),'validate':_0x3e7dd3=>{const _0x36ea7b=_0x20f5ce;if(!_0x3e7dd3||!_0x3e7dd3[_0x36ea7b(0x1b0)]())return _0x36ea7b(0x169);return!![];}});if(!_0x3a5d99[_0x20f5ce(0x14e)])return console['log'](_0x20f5ce(0x186)),0x1;const _0x3352ff=_0x3a5d99['apiKey'];console['log'](_0x20f5ce(0x1a3));try{const _0x2ec4f3=TDX[_0x20f5ce(0x14b)]({'site':_0x330cc9,'apiKey':_0x3352ff[_0x20f5ce(0x1b0)](),'logLevel':_0x30a280['logLevel']??LogLevel['ERROR']}),_0x50660f=await _0x2ec4f3[_0x20f5ce(0x182)][_0x20f5ce(0x1b4)]();console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x50660f[_0x20f5ce(0x178)]+')');const _0xb2605e=await isKeychainAvailable();_0xb2605e?(await saveAPIKeyAsync(_0x3352ff[_0x20f5ce(0x1b0)](),_0x330cc9,_0x11db46),console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+_0x20f5ce(0x148)+_0x11db46+')')):(console['warn'](a23_0x55073e[_0x20f5ce(0x1af)](_0x20f5ce(0x16e))),console[_0x20f5ce(0x149)](a23_0x55073e[_0x20f5ce(0x1af)](_0x20f5ce(0x18a))));const _0x33daf4={'site':_0x330cc9,..._0x1c6d94&&{'description':_0x1c6d94}};return saveProfileToUserConfig(_0x11db46,_0x33daf4),console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+'\x20Profile\x20\x27'+_0x11db46+_0x20f5ce(0x161)),console[_0x20f5ce(0x187)](),console[_0x20f5ce(0x187)](_0x20f5ce(0x154)),console[_0x20f5ce(0x187)](_0x20f5ce(0x16f)+_0x11db46+_0x20f5ce(0x19a)),console[_0x20f5ce(0x187)](_0x20f5ce(0x16f)+_0x11db46+_0x20f5ce(0x1a0)),0x0;}catch(_0x4c1c6b){if(_0x4c1c6b instanceof HTTPClientError&&_0x4c1c6b[_0x20f5ce(0x158)]===0x191)return printAuthError(_0x4c1c6b),0x1;return console[_0x20f5ce(0x1b7)](a23_0x55073e[_0x20f5ce(0x199)](_0x20f5ce(0x151)+(_0x4c1c6b instanceof Error?_0x4c1c6b[_0x20f5ce(0x19f)]:String(_0x4c1c6b)))),console[_0x20f5ce(0x1b7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]='profile:remove';['description']=a23_0x1ae9b2(0x168);['validate'](_0x337249){const _0x4fae73=a23_0x1ae9b2,{args:_0x531763}=_0x337249;if(_0x531763[_0x4fae73(0x16b)]===0x0)return _0x4fae73(0x1a1);return undefined;}async[a23_0x1ae9b2(0x190)](_0x320876){const _0x89a5f6=a23_0x1ae9b2,{args:_0x2bf664}=_0x320876,_0x226c1f=_0x2bf664[0x0];console[_0x89a5f6(0x187)](a23_0x55073e['bold'](_0x89a5f6(0x16c)));if(!profileExists(_0x226c1f)){console[_0x89a5f6(0x1b7)](a23_0x55073e[_0x89a5f6(0x199)](_0x89a5f6(0x19b)+_0x226c1f+_0x89a5f6(0x1b3))),console['log'](_0x89a5f6(0x197));const _0x41b5ae=listProfiles();if(_0x41b5ae[_0x89a5f6(0x16b)]===0x0)console[_0x89a5f6(0x187)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xf5e95f of _0x41b5ae){console[_0x89a5f6(0x187)](_0x89a5f6(0x18d)+_0xf5e95f[_0x89a5f6(0x14a)]);}return 0x1;}const _0x1c34cc=await a23_0x281952({'type':_0x89a5f6(0x15a),'name':'confirm','message':_0x89a5f6(0x14d)+_0x226c1f+'\x27?','initial':![]});if(!_0x1c34cc['confirm'])return console[_0x89a5f6(0x187)](_0x89a5f6(0x147)),0x0;try{removeProfileFromUserConfig(_0x226c1f),console['log'](a23_0x55073e[_0x89a5f6(0x166)]('✓')+_0x89a5f6(0x1a6)+_0x226c1f+_0x89a5f6(0x1a4));}catch(_0x2cd75b){return console[_0x89a5f6(0x1b7)](a23_0x55073e[_0x89a5f6(0x199)](_0x89a5f6(0x1a5)+(_0x2cd75b instanceof Error?_0x2cd75b[_0x89a5f6(0x19f)]:String(_0x2cd75b)))),0x1;}const _0xd81106=await isKeychainAvailable();if(_0xd81106){const _0x5207ea=await deleteKeychainAPIKey(_0x226c1f);_0x5207ea&&console['log'](a23_0x55073e[_0x89a5f6(0x166)]('✓')+_0x89a5f6(0x175));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]='profile:set';[a23_0x1ae9b2(0x191)]=a23_0x1ae9b2(0x196);static [a23_0x1ae9b2(0x16d)]=[a23_0x1ae9b2(0x180),a23_0x1ae9b2(0x156),'parent_segment','llm_project',a23_0x1ae9b2(0x1ab),a23_0x1ae9b2(0x191)];[a23_0x1ae9b2(0x18e)](_0x19e02c){const _0x1008fb=a23_0x1ae9b2,{args:_0x319770,options:_0x29bbe8}=_0x19e02c,_0x41cea7=_0x29bbe8[_0x1008fb(0x164)]||getActiveProfile();if(!_0x41cea7)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x319770[_0x1008fb(0x16b)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1008fb(0x16d)]['join'](',\x20');const _0x19a03d=_0x319770[0x0];if(!_0x19a03d[_0x1008fb(0x176)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1008fb(0x162)](',\x20');const [_0x5b981c]=_0x19a03d[_0x1008fb(0x18b)]('=',0x2);if(!ProfileSetCommand[_0x1008fb(0x16d)]['includes'](_0x5b981c))return'Unknown\x20key\x20\x27'+_0x5b981c+_0x1008fb(0x185)+ProfileSetCommand[_0x1008fb(0x16d)][_0x1008fb(0x162)](',\x20');return undefined;}async[a23_0x1ae9b2(0x190)](_0x3d0c4c){const _0xa10240=a23_0x1ae9b2,{args:_0x2588e1,options:_0x32cbe1}=_0x3d0c4c,_0xa2a08d=_0x32cbe1[_0xa10240(0x164)]||getActiveProfile(),[_0x11da57,..._0x203358]=_0x2588e1[0x0]['split']('='),_0x289aea=_0x203358[_0xa10240(0x162)]('=');console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x1a9)](_0xa10240(0x192)));if(!profileExists(_0xa2a08d)){const _0x1bfffd=await a23_0x281952({'type':_0xa10240(0x15a),'name':'create','message':_0xa10240(0x19b)+_0xa2a08d+_0xa10240(0x17d),'initial':!![]});if(!_0x1bfffd[_0xa10240(0x14b)])return console[_0xa10240(0x187)](_0xa10240(0x1aa)),0x1;}const _0x525bf8=loadProfile(_0xa2a08d),_0x2231a2=_0x525bf8?.[_0xa10240(0x15b)]||{};if(_0x11da57===_0xa10240(0x180)){const _0x46a73c=resolveSite(_0x289aea);console[_0xa10240(0x187)](_0xa10240(0x1b1)+_0x46a73c+_0xa10240(0x16a)),console['log'](_0xa10240(0x152)),console[_0xa10240(0x187)]('\x20\x20'+getConsoleUrl(_0x46a73c,_0xa10240(0x18f)));const _0x14fb87=await a23_0x281952({'type':'password','name':'apiKey','message':_0xa10240(0x193),'validate':_0xf3173=>{const _0x145b50=_0xa10240;if(!_0xf3173||!_0xf3173[_0x145b50(0x1b0)]())return _0x145b50(0x169);return!![];}});if(!_0x14fb87['apiKey'])return console['log'](_0xa10240(0x172)),0x1;console[_0xa10240(0x187)](_0xa10240(0x1a3));try{const _0xa9354f=TDX['create']({'site':_0x46a73c,'apiKey':_0x14fb87['apiKey'][_0xa10240(0x1b0)](),'logLevel':_0x32cbe1[_0xa10240(0x174)]??LogLevel['ERROR']}),_0x3802f9=await _0xa9354f['jobs'][_0xa10240(0x1b4)]();console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x166)]('✓')+_0xa10240(0x165)+_0x3802f9[_0xa10240(0x178)]+')');const _0x29835f=await isKeychainAvailable();_0x29835f?(await saveAPIKeyAsync(_0x14fb87[_0xa10240(0x14e)][_0xa10240(0x1b0)](),_0x46a73c,_0xa2a08d),console[_0xa10240(0x187)](a23_0x55073e['green']('✓')+_0xa10240(0x19d))):console[_0xa10240(0x149)](a23_0x55073e[_0xa10240(0x1af)](_0xa10240(0x16e))),_0x2231a2[_0xa10240(0x180)]=_0x46a73c;}catch(_0x336f45){if(_0x336f45 instanceof HTTPClientError&&_0x336f45[_0xa10240(0x158)]===0x191)return printAuthError(_0x336f45),0x1;return console[_0xa10240(0x1b7)](a23_0x55073e['red']('✗\x20Validation\x20failed:\x20'+(_0x336f45 instanceof Error?_0x336f45[_0xa10240(0x19f)]:String(_0x336f45)))),console[_0xa10240(0x1b7)](_0xa10240(0x177)),0x1;}}else _0x2231a2[_0x11da57]=_0x289aea||undefined;return saveProfileToUserConfig(_0xa2a08d,_0x2231a2),console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x166)]('✓')+_0xa10240(0x1a6)+_0xa2a08d+_0xa10240(0x146)+_0x11da57+'='+(_0x289aea||_0xa10240(0x17c))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x1ae9b2(0x155);[a23_0x1ae9b2(0x191)]='Set\x20session\x20profile';['validate'](_0x212489){const _0x429df5=a23_0x1ae9b2,{args:_0xd79c30}=_0x212489;if(_0xd79c30[_0x429df5(0x16b)]===0x0)return _0x429df5(0x153);return undefined;}async[a23_0x1ae9b2(0x190)](_0x4fee9a){const _0x1e7847=a23_0x1ae9b2,{args:_0x326e52,options:_0x4ea541}=_0x4fee9a,_0x22edfb=_0x326e52[0x0],_0x3a002c=_0x4ea541[_0x1e7847(0x15c)];cleanExpiredSessions();if(!profileExists(_0x22edfb)){console['error'](a23_0x55073e[_0x1e7847(0x199)](_0x1e7847(0x19b)+_0x22edfb+_0x1e7847(0x1b3))),console[_0x1e7847(0x187)](_0x1e7847(0x197));const _0xb51d3a=listProfiles();if(_0xb51d3a[_0x1e7847(0x16b)]===0x0)console[_0x1e7847(0x187)](_0x1e7847(0x1a2));else for(const _0x52e9f2 of _0xb51d3a){console[_0x1e7847(0x187)]('\x20\x20-\x20'+_0x52e9f2['name']);}return 0x1;}if(_0x3a002c){const _0x43d6e6=a23_0x429941['join'](getConfigDir(),_0x1e7847(0x160));return saveActiveProfileToUserConfig(_0x22edfb),console[_0x1e7847(0x187)](_0x1e7847(0x17f)+a23_0x55073e['green'](_0x22edfb)),console[_0x1e7847(0x187)](a23_0x55073e[_0x1e7847(0x19c)](_0x1e7847(0x159)+_0x43d6e6)),0x0;}const _0x48bd75=getSessionID(_0x4ea541[_0x1e7847(0x1a8)]);return saveSessionContext({'profile':_0x22edfb},_0x4ea541[_0x1e7847(0x1a8)]),console[_0x1e7847(0x187)]('Session\x20profile\x20set\x20to:\x20'+a23_0x55073e['green'](_0x22edfb)+'\x20'+a23_0x55073e['dim'](_0x1e7847(0x198)+_0x48bd75+')')),console[_0x1e7847(0x187)](a23_0x55073e[_0x1e7847(0x19c)](_0x1e7847(0x14c)+_0x22edfb+_0x1e7847(0x170))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x2948a1=a24_0x5213;function a24_0x5213(_0x2388a0,_0x423ec8){_0x2388a0=_0x2388a0-0xe9;const _0x110e77=a24_0x110e();let _0x521354=_0x110e77[_0x2388a0];return _0x521354;}(function(_0xc9dd57,_0x4d8994){const _0x4f124f=a24_0x5213,_0x2d426a=_0xc9dd57();while(!![]){try{const _0x4a4a63=parseInt(_0x4f124f(0xfa))/0x1*(parseInt(_0x4f124f(0xfe))/0x2)+-parseInt(_0x4f124f(0xf0))/0x3+-parseInt(_0x4f124f(0xf5))/0x4+parseInt(_0x4f124f(0xf7))/0x5*(-parseInt(_0x4f124f(0xfc))/0x6)+parseInt(_0x4f124f(0xed))/0x7+parseInt(_0x4f124f(0xef))/0x8*(-parseInt(_0x4f124f(0xee))/0x9)+parseInt(_0x4f124f(0xea))/0xa;if(_0x4a4a63===_0x4d8994)break;else _0x2d426a['push'](_0x2d426a['shift']());}catch(_0x3c4b5d){_0x2d426a['push'](_0x2d426a['shift']());}}}(a24_0x110e,0xcd04d));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a24_0x110e(){const _0x48b6cb=['127200iWAiDn','config','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','Error:\x20','4042580xLcdrZ','description','80JbAich','List\x20all\x20available\x20profiles','length','131vFpnfE','execute','493182fIBxHJ','name','6952WTPfbC','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','36895470byzJeA','error','log','3468129BPxuVR','460413CEcYzn','224Eiexib'];a24_0x110e=function(){return _0x48b6cb;};return a24_0x110e();}export class ProfilesCommand extends BaseCommand{[a24_0x2948a1(0xfd)]='profiles';['description']=a24_0x2948a1(0xf8);async[a24_0x2948a1(0xfb)](_0x46c3d2){const _0x519b82=a24_0x2948a1,{options:_0x1c7127}=_0x46c3d2;try{const _0x5ecce7=listProfiles(),_0x25fdd6=getActiveProfile();if(_0x5ecce7[_0x519b82(0xf9)]===0x0)return console[_0x519b82(0xec)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x519b82(0xec)](_0x519b82(0xe9)),console[_0x519b82(0xec)](_0x519b82(0xf3)),0x0;const _0xcffe14=_0x5ecce7[_0x519b82(0xf2)](_0x4f6c9f=>{const _0x36b603=_0x519b82,_0x1c7e6b=_0x4f6c9f[_0x36b603(0xfd)]===_0x25fdd6,_0x4e880d=getProfileParams(_0x4f6c9f['config']);return{'name':_0x4f6c9f[_0x36b603(0xfd)],'active':_0x1c7e6b,'scope':_0x4f6c9f['scope'],'description':_0x4f6c9f[_0x36b603(0xf1)][_0x36b603(0xf6)]||'','params':_0x4e880d};});return await handleSDKOutput(_0xcffe14,_0x1c7127),0x0;}catch(_0x3e5ed4){return _0x3e5ed4 instanceof Error&&console[_0x519b82(0xeb)](_0x519b82(0xf4)+_0x3e5ed4['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x5edaac=a25_0x1f61;(function(_0x245008,_0x510b8f){const _0x3e6bd1=a25_0x1f61,_0x283485=_0x245008();while(!![]){try{const _0x1a3c08=-parseInt(_0x3e6bd1(0x1fe))/0x1+parseInt(_0x3e6bd1(0x1e3))/0x2+parseInt(_0x3e6bd1(0x1de))/0x3*(parseInt(_0x3e6bd1(0x1e8))/0x4)+-parseInt(_0x3e6bd1(0x1d9))/0x5+-parseInt(_0x3e6bd1(0x1e9))/0x6+parseInt(_0x3e6bd1(0x1f7))/0x7*(parseInt(_0x3e6bd1(0x1fc))/0x8)+parseInt(_0x3e6bd1(0x1f9))/0x9*(parseInt(_0x3e6bd1(0x1d6))/0xa);if(_0x1a3c08===_0x510b8f)break;else _0x283485['push'](_0x283485['shift']());}catch(_0x155c0c){_0x283485['push'](_0x283485['shift']());}}}(a25_0x5594,0xa79f9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x5594(){const _0x2a3e1c=['description','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','4227350XzeoGu','processedRows','file','1394020FFrFbo','Executing\x20query...','SQL:\x20','execute','error','814659nIurCg','length','totalSplits','Statement\x20','verbose','1665130gpzhJt','join','query','\x20rows\x20','\x20-\x20','20aiIyya','7365504mWPiGa','information_schema','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Run\x20Trino\x20queries\x20(streaming)','No\x20SQL\x20provided','\x20splits','name','site','data','state','message','Site:\x20','push','...','14WOFwNf','jobId','9PVXtuk','completedSplits','catalog','2393824OqOdJm','output','1018548tIVnCJ','Query\x20completed:\x20Processed\x20','Schema:\x20','elapsedTimeMillis','Executing\x20query\x20['];a25_0x5594=function(){return _0x2a3e1c;};return a25_0x5594();}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_0x1f61(_0x1ad920,_0x3232d7){_0x1ad920=_0x1ad920-0x1d0;const _0x5594d4=a25_0x5594();let _0x1f616a=_0x5594d4[_0x1ad920];return _0x1f616a;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x5edaac(0x1ef)]=a25_0x5edaac(0x1e5);[a25_0x5edaac(0x1d4)]=a25_0x5edaac(0x1ec);async[a25_0x5edaac(0x1dc)](_0x20f06d){const _0x1a2f21=a25_0x5edaac,{options:_0x217a5f,args:_0x326043,tdx:_0x52b770}=_0x20f06d,_0x4882db=_0x326043[0x0],_0x3d0845=_0x217a5f[_0x1a2f21(0x1d8)];let _0x33d8bd;try{if(_0x3d0845)_0x33d8bd=readSqlStatementsFromFile(_0x3d0845);else{if(_0x4882db==='-')_0x33d8bd=await readSqlStatementsFromStdin();else{if(_0x4882db&&isSqlFilePath(_0x4882db))_0x33d8bd=readSqlStatementsFromFile(_0x4882db);else{if(_0x4882db)_0x33d8bd=splitSqlStatements(_0x4882db);else throw new Error(_0x1a2f21(0x1ed));}}}}catch(_0x5a8e53){return console[_0x1a2f21(0x1dd)]('Error:\x20'+_0x5a8e53[_0x1a2f21(0x1f3)]),0x1;}const _0x35c405=_0x217a5f['database']||_0x1a2f21(0x1ea),_0x20a8c0=_0x217a5f[_0x1a2f21(0x1fb)];try{const _0x983bc4=[],_0x528a61=!!_0x217a5f[_0x1a2f21(0x1fd)];for(let _0x5ba02e=0x0;_0x5ba02e<_0x33d8bd[_0x1a2f21(0x1df)];_0x5ba02e++){const _0x38ed5c=_0x33d8bd[_0x5ba02e],_0x53a37e=_0x5ba02e+0x1,_0xb407e3=_0x33d8bd[_0x1a2f21(0x1df)],_0x29c3a5=_0xb407e3>0x1;_0x217a5f[_0x1a2f21(0x1e2)]&&(console[_0x1a2f21(0x1dd)]('\x0a'+(_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+':':'')),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1f4)+_0x217a5f[_0x1a2f21(0x1f0)]),console['error']('Catalog:\x20'+(_0x20a8c0||'td')),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1d1)+_0x35c405),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1db)+_0x38ed5c));const _0x459503=_0x29c3a5?'Executing\x20statement\x20'+_0x53a37e+'/'+_0xb407e3+_0x1a2f21(0x1f6):_0x1a2f21(0x1da);try{const _0x16b88e=await withProgressSpinner(_0x459503,async _0x133057=>{const _0x44fb8a=_0x1a2f21,_0x33a45b=await _0x52b770[_0x44fb8a(0x1e5)][_0x44fb8a(0x1dc)](_0x38ed5c,{'catalog':_0x20a8c0,'schema':_0x35c405,'onJobId':_0x17fbe0=>{_0x133057['setJobId'](_0x17fbe0);},'onProgress':_0x6aab54=>{const _0x29d8c8=_0x44fb8a;_0x133057['setPhase'](_0x29d8c8(0x1d3)+_0x6aab54[_0x29d8c8(0x1f2)]+']'),_0x133057['setExtra'](formatRows(_0x6aab54[_0x29d8c8(0x1d7)])+_0x29d8c8(0x1e6)+_0x6aab54[_0x29d8c8(0x1fa)]+'/'+_0x6aab54[_0x29d8c8(0x1e0)]+_0x29d8c8(0x1ee));}});return _0x33a45b;},{'verbose':_0x217a5f[_0x1a2f21(0x1e2)]}),_0x996d5=_0x16b88e[_0x1a2f21(0x1f1)],_0x39b165=_0x996d5[_0x1a2f21(0x1f8)]?'\x20[Job\x20ID:\x20'+_0x996d5['jobId']+']':'',_0x17ad64=_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+_0x1a2f21(0x1e7):'';console[_0x1a2f21(0x1dd)]('✔\x20'+_0x17ad64+_0x1a2f21(0x1d0)+formatRows(_0x996d5['stats'][_0x1a2f21(0x1d7)])+_0x1a2f21(0x1e6)+('in\x20'+formatElapsed(_0x996d5['stats'][_0x1a2f21(0x1d2)])+_0x39b165));if(_0x29c3a5&&_0x528a61){const _0x4c677f=resolveOutputOptions(_0x217a5f),_0x56e05c=await formatQueryOutput(_0x996d5,_0x4c677f);_0x983bc4[_0x1a2f21(0x1f5)](_0x56e05c);}else await handleQueryOutput(_0x996d5,_0x217a5f);}catch(_0x48696e){const _0x28c251=_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+':\x0a':'',_0x107e67=_0x48696e instanceof SDKError?_0x48696e['originalMessage']:_0x48696e[_0x1a2f21(0x1f3)];return console[_0x1a2f21(0x1dd)](''+_0x28c251+_0x107e67),0x1;}}if(_0x33d8bd['length']>0x1&&_0x528a61&&_0x983bc4[_0x1a2f21(0x1df)]>0x0){const _0x22d9e7=_0x983bc4[_0x1a2f21(0x1e4)]('\x0a');writeFileSync(_0x217a5f[_0x1a2f21(0x1fd)],_0x22d9e7),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x217a5f['output']);}return 0x0;}catch(_0x5c4428){throw _0x5c4428;}}['validate'](_0x3405a3){const _0x375ec0=a25_0x5edaac,_0x3f167c=_0x3405a3['args'][0x0],_0x38bd72=_0x3405a3['options'][_0x375ec0(0x1d8)];if(!_0x3f167c&&!_0x38bd72)return _0x375ec0(0x1d5);if(_0x3f167c&&_0x38bd72)return _0x375ec0(0x1eb);return undefined;}}
|