@treasuredata/tdx 0.26.6 → 0.26.7
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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.d.ts.map +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/job-command.js.map +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.d.ts +14 -37
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.d.ts +82 -0
- package/dist/sdk/agent/tool-target-registry.d.ts.map +1 -0
- package/dist/sdk/agent/tool-target-registry.js +1 -0
- package/dist/sdk/agent/tool-target-registry.js.map +1 -0
- package/dist/sdk/agent/types/agent-def.d.ts +3 -2
- package/dist/sdk/agent/types/agent-def.d.ts.map +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.d.ts +20 -0
- package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js.map +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.d.ts +2 -2
- package/dist/sdk/client/td-api-client.d.ts.map +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/td-api-client.js.map +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.d.ts +1 -1
- package/dist/sdk/job.d.ts.map +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/job.js.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.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
|
|
1
|
+
const a21_0xb9ad27=a21_0x342c;(function(_0x25e520,_0x292f05){const _0x9c5109=a21_0x342c,_0x5beeb0=_0x25e520();while(!![]){try{const _0x360ddc=-parseInt(_0x9c5109(0x10f))/0x1+-parseInt(_0x9c5109(0x111))/0x2+-parseInt(_0x9c5109(0xff))/0x3*(parseInt(_0x9c5109(0x106))/0x4)+parseInt(_0x9c5109(0x102))/0x5+parseInt(_0x9c5109(0x104))/0x6+-parseInt(_0x9c5109(0x100))/0x7+parseInt(_0x9c5109(0x109))/0x8;if(_0x360ddc===_0x292f05)break;else _0x5beeb0['push'](_0x5beeb0['shift']());}catch(_0x4dd57a){_0x5beeb0['push'](_0x5beeb0['shift']());}}}(a21_0x3c94,0x43a02));import{BaseCommand}from'./command.js';function a21_0x342c(_0x3cd9c8,_0xdd692b){_0x3cd9c8=_0x3cd9c8-0xfd;const _0x3c943e=a21_0x3c94();let _0x342ccc=_0x3c943e[_0x3cd9c8];return _0x342ccc;}export class MCPCommand extends BaseCommand{['name']=a21_0xb9ad27(0xfd);[a21_0xb9ad27(0x10e)]='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async[a21_0xb9ad27(0x10a)](_0x3dab39){const _0x1a49aa=a21_0xb9ad27,{tdx:_0x48dc5d}=_0x3dab39,_0x29fd80={};if(process.env.TDX_PROFILE)_0x29fd80[_0x1a49aa(0x10d)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x29fd80[_0x1a49aa(0x103)]=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x29fd80[_0x1a49aa(0xfe)]=process.env.TDX_SITE);else _0x48dc5d['context']['apiKey']&&(_0x29fd80[_0x1a49aa(0x103)]=_0x48dc5d[_0x1a49aa(0x10c)][_0x1a49aa(0x101)],_0x29fd80['TDX_SITE']=_0x48dc5d['context'][_0x1a49aa(0x108)]);}_0x48dc5d[_0x1a49aa(0x10c)][_0x1a49aa(0x107)]&&(_0x29fd80[_0x1a49aa(0x10d)]=_0x48dc5d[_0x1a49aa(0x10c)][_0x1a49aa(0x107)]);try{const {startMCPServer:_0x101e58}=await import(_0x1a49aa(0x105));return await _0x101e58({'env':_0x29fd80}),0x0;}catch(_0x27b58e){const _0x3bda7f=_0x27b58e instanceof Error?_0x27b58e[_0x1a49aa(0x10b)]:String(_0x27b58e);return console[_0x1a49aa(0x110)]('MCP\x20server\x20error:\x20'+_0x3bda7f),0x1;}}}function a21_0x3c94(){const _0x25abb7=['5740224NfTttZ','execute','message','context','TDX_PROFILE','description','447834lBKsGd','error','800458ULgQsO','mcp','TDX_SITE','391047uUQDLi','375424BSoJoA','apiKey','2247195vBvVpc','TDX_API_KEY','1634520aJwzYM','../mcp/server.js','8ycXtfK','profile','site'];a21_0x3c94=function(){return _0x25abb7;};return a21_0x3c94();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x105c40=a22_0x35d2;(function(_0x2bfe63,_0x29010b){const _0x200de4=a22_0x35d2,_0x551ea5=_0x2bfe63();while(!![]){try{const _0x55c256=parseInt(_0x200de4(0x105))/0x1+-parseInt(_0x200de4(0x167))/0x2*(parseInt(_0x200de4(0x1fe))/0x3)+-parseInt(_0x200de4(0x10d))/0x4*(parseInt(_0x200de4(0x212))/0x5)+parseInt(_0x200de4(0x139))/0x6*(parseInt(_0x200de4(0xf6))/0x7)+-parseInt(_0x200de4(0x1e1))/0x8+parseInt(_0x200de4(0x204))/0x9+parseInt(_0x200de4(0xfd))/0xa;if(_0x55c256===_0x29010b)break;else _0x551ea5['push'](_0x551ea5['shift']());}catch(_0x1b5f4b){_0x551ea5['push'](_0x551ea5['shift']());}}}(a22_0x19ed,0x2d53e));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x34b791 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x8803e3 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a22_0x35d2(_0x3cfe01,_0x105103){_0x3cfe01=_0x3cfe01-0xdf;const _0x19ed96=a22_0x19ed();let _0x35d28f=_0x19ed96[_0x3cfe01];return _0x35d28f;}function a22_0x19ed(){const _0x1a5403=['\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x0aError:','customerGroup','Fetching\x20parent\x20segment\x20\x27','RT\x202.0:','5MEiFhA','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Schema\x20saved\x20to\x20','Default','✔\x20Found\x20','Columns:','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','personalizationServices','segment','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','stop','ps:rt:validate','valid','To\x20view\x20sample\x20data:','\x0a\x20\x20\x20\x20}','master','getBehaviorNames','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Updating','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','stitchingKeys','resolveParentId','reduce','✘\x20Failed\x20to\x20rename\x20directory:\x20','customers','workflowSessionId','\x20\x20\x20','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Error:\x20--database\x20and\x20--table\x20are\x20required','No\x20personalization\x20services\x20configured','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20to\x20configure\x20your\x20personalization\x20service','localeCompare','.yml','enabled','open','segment:parent:pull','Attempt:','ps:pz:init','log','List\x20available\x20fields\x20for\x20segmentation','behavior_','No\x20parent\x20segments\x20match\x20pattern:\x20','Aborted.','site','segment:parent:preview','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20--attribute\x20\x22','✔\x20Updated\x20parent\x20segment\x20\x27','segment:parent:push','Name:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','td_client_id','\x0a⚠️\x20\x20Both\x20','trigger_event','Status:','query','Listing\x20RT-enabled\x20parent\x20segments...','`\x20to\x20download\x20the\x20configuration\x20first','\x0aChanges\x20to\x20\x27','attributes','\x5c$&','Fetching\x20customers\x20schema...','Listing\x20parent\x20segments\x20matching\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','run','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x20trigger=','format','Coverage:','Session:','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','text','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Executing\x20parent\x20segment\x20query...','\x20Added\x20personalization\x20template\x20to\x20','/sessions/','number','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','%)\x20','errors','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Behaviors','events','addAttributes','scheduleType','type','Error\x20reading\x20file:\x20','Overwrite\x20\x27','\x20--behavior\x20\x22','toLowerCase','\x20=\x20','getParentSQL','using\x20the\x20default\x20path:\x20','label','parent_segment','Next\x20steps:','FINISHED','⚡\x20Not\x20enabled','Output\x20Database:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','replace','7xCrLHv','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','double','win32','column_name','displayValidateResults','getOutputDatabaseName','3508750tsmHwm','\x20\x20\x20\x20-\x20','\x20service(s)\x20configured','columns','customerGroupFile','ID\x20Stitching:','Listing\x20fields\x20for\x20\x27','\x20Context\x20set:\x20','161820eqpmyI','parent_id','Attributes:','customerPercent','sort','\x20--attribute\x20\x22<name>\x22','column_type','displaySummary','1401760lYSVbQ','allValid','addBehaviors','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x0a✔\x20Workflow\x20started','in\x20','foreignKey','\x20total','.yaml','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','join','displayAttributesStats','Updated','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','idStitching','unref','\x0aNew\x20parent\x20segment\x20\x27','keys','Available\x20behaviors:','\x20field','behaviors','stats','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Master\x20+\x20Attributes','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Validate:','\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','behavior','scheduleOption','yes','jobId','schemaValid','personalization_services','Show\x20parent\x20segment\x20schema\x20(column\x20types)','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','enriched','session','description','json','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Updating\x20parent\x20segment\x20\x27','934938mrGFbH','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Pattern:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20Database:\x20','Error\x20parsing\x20YAML:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','List\x20parent\x20segments','darwin','data','ignore','\x20service','Rows:','workflowId','Options:\x0a','parent_segments','Site:\x20','map','Listing\x20parent\x20segments...','error','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','RT\x202.0\x20Validate:','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','string','length','yellow','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','name','toLocaleString','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20parent\x20segment\x20\x27','segment:parent:create','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','Fetching\x20behavior\x20list...','parentSegment','\x20tdx\x20wf\x20attempt\x20','Fetching\x20SQL\x20for\x20\x27','coveragePercent','✔\x20Renamed\x20directory\x20to\x20','Attributes','bold','displayBehaviorsStats','74ETcrKV','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','SQL\x20query:\x0a','\x20\x20\x20\x20','verbose','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Database:\x20','joinKey','output','behaviorsFile','audienceId','realtime','segment:parent:sql','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27...','Creating','validateParentYaml','test','tdx\x20ps\x20preview\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','ps:rt:list','displayRealtimeInfo','dim','Source:','Attribute:','jsonl','preview','Analyzing\x20changes...','schemaError','\x27\x20with\x20ID:\x20','page_view','Error:\x20File\x20not\x20found:\x20','execute','all','utf-8','\x20+\x20[','Options\x20(one\x20required):\x0a','limit','\x20No\x20changes\x20-\x20','/\x20and\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20parent\x20segment','list','red','/app/workflows/','Master:','push','Error:','segment:parent:desc','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Personalization\x20service\x20description','/\x20→\x20','workflowAttemptId','database','segment:parent:update','displayPreviewHints','trim','interval','My\x20Service','\x20configured','use','attribute','getParentFull','Errors:','\x20Added\x20RT\x202.0\x20template\x20section','displaySampleData','✔\x20Query\x20completed:\x20Processed\x20','realtime_enabled','YAML\x20file:\x20','customersWithEvents','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','apply','\x20\x202.\x20Run\x20','/\x20directories\x20exist.','filter','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Configuration\x20is\x20valid','.customers)','\x0aNo\x20sample\x20data\x20available','attributesFile','Listing\x20personalization\x20services\x20for\x20\x27','isDirectory','Apply\x20changes\x20to\x20\x27','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displayPreviewResults','To\x20cancel:','repeat','\x20\x20Note:\x20','Found\x20YAML\x20file:\x20','\x20\x20No\x20sample\x20data\x20available','displayMasterInfo','displayColumns','web','population','<database>.<table>','green','table','Join:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Created','Customers:','sourceTableError','start','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','message','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','-1d','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','👥\x20','user_id','segment:parent:run','\x22\x20}','segment:parent:fields','dirname','realtime:','information_schema','true','toFixed','\x27\x20and\x20run\x20workflow?','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','2650872sQfOkx','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','elapsedTimeMillis','Show\x20parent\x20segment\x20details','Available\x20attributes:','\x20behaviors','✔\x20No\x20changes\x20-\x20\x27','varchar','No\x20RT-enabled\x20parent\x20segments\x20found','\x27\x20is\x20already\x20up\x20to\x20date','endsWith','Resolving\x20parent\x20segment\x20\x27','pushParentYaml','totalEvents','\x0aUsage:\x20tdx\x20ps\x20preview\x20','timezone','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Behavior:','⚡\x20Enabled','/app/dw/parentSegments/','collectSchema','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','segment:parent:validate','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','listFields','\x20personalization\x20service','5835hiDmCW','addBehaviorsFile','\x20--interval\x20','\x20to\x20push\x20the\x20configuration','Events:','column','2438172ThXuSN','previewParentYaml','\x20is\x20already\x20up\x20to\x20date','last_page_viewed','sampleData','tdx\x20ps\x20push\x20','indexOf','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20rows\x20'];a22_0x19ed=function(){return _0x1a5403;};return a22_0x19ed();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x105c40(0x149),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x3c5af7){const _0x3f75cf=a22_0x105c40,_0x199c6b=process['platform'],_0x59857d=_0x199c6b===_0x3f75cf(0x142)?_0x3f75cf(0x238):_0x199c6b===_0x3f75cf(0xf9)?_0x3f75cf(0x1cf):'xdg-open';spawn(_0x59857d,[_0x3c5af7],{'detached':!![],'stdio':_0x3f75cf(0x144)})[_0x3f75cf(0x11d)]();}function migrateLegacyDirectory(){const _0x1f99bc=a22_0x105c40;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5f0e28=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5f0e28[_0x1f99bc(0x1ba)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1f99bc(0x14d)](a22_0x8803e3['yellow'](_0x1f99bc(0x24a)+LEGACY_PARENT_SEGMENT_DIR+_0x1f99bc(0x18e)+PARENT_SEGMENT_DIR+_0x1f99bc(0x1b1))),console[_0x1f99bc(0x14d)](a22_0x8803e3['dim'](_0x1f99bc(0x20b)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x1f99bc(0x14d)](a22_0x8803e3[_0x1f99bc(0x154)](_0x1f99bc(0x116)+LEGACY_PARENT_SEGMENT_DIR+_0x1f99bc(0x19a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1f99bc(0x14d)](a22_0x8803e3[_0x1f99bc(0x1c8)](_0x1f99bc(0x163)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x530e61){const _0x50bfc5=_0x530e61 instanceof Error?_0x530e61['message']:String(_0x530e61);return console[_0x1f99bc(0x14d)](a22_0x8803e3[_0x1f99bc(0x192)](_0x1f99bc(0x22b)+_0x50bfc5+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x105c40(0x256)](_0x18ea4b){const _0x35fae0=a22_0x105c40;return migrateLegacyDirectory(),super[_0x35fae0(0x256)](_0x18ea4b);}}function resolveYamlFile(_0x3af11c){const _0x10587f=a22_0x105c40;if(_0x3af11c[_0x10587f(0x1ec)](_0x10587f(0x236))||_0x3af11c['endsWith'](_0x10587f(0x115)))return _0x3af11c;return a22_0x34b791[_0x10587f(0x118)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3af11c)+_0x10587f(0x236));}function formatProgressMessage(_0x447bd0){const _0x66454b=a22_0x105c40,_0x25ba9a=_0x447bd0['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x25ba9a){const [,_0xa1d6a6,_0x310851,_0x15f8e6='']=_0x25ba9a;return a22_0x8803e3[_0x66454b(0x17d)](_0xa1d6a6+':')+'\x20'+_0x310851+a22_0x8803e3['dim'](_0x15f8e6);}return a22_0x8803e3[_0x66454b(0x17d)](_0x447bd0);}function showFileNotFoundError(_0x2f040f,_0x29b61d){const _0x25ba58=a22_0x105c40;console[_0x25ba58(0x14d)](a22_0x8803e3[_0x25ba58(0x192)](_0x25ba58(0x186)+_0x2f040f+'\x0a')),console[_0x25ba58(0x14d)](a22_0x8803e3['cyan'](_0x25ba58(0x264)+_0x29b61d+_0x25ba58(0x24f)));}function displayRealtimeValidation(_0x1fd8b5){const _0x1bec7d=a22_0x105c40;if(!_0x1fd8b5[_0x1bec7d(0x172)])return;const _0x31eb72=_0x1fd8b5[_0x1bec7d(0x172)],_0x1754a0=_0x31eb72[_0x1bec7d(0x237)]?a22_0x8803e3[_0x1bec7d(0x1c8)](_0x1bec7d(0x1f5)):a22_0x8803e3['yellow'](_0x1bec7d(0xf1));console['error']('\x0a'+a22_0x8803e3['dim'](_0x1bec7d(0x211))+'\x20'+_0x1754a0);if(_0x31eb72[_0x1bec7d(0xe2)]&&_0x31eb72['events'][_0x1bec7d(0x153)]>0x0){console[_0x1bec7d(0x14d)]('\x20\x20'+a22_0x8803e3['dim'](_0x1bec7d(0x202))+'\x20'+_0x31eb72[_0x1bec7d(0xe2)][_0x1bec7d(0x153)]+_0x1bec7d(0x1a2));for(const _0x4781ec of _0x31eb72['events']){const _0x1d691a=_0x4781ec['sourceTableValid']===![]?a22_0x8803e3['red']('✘'):a22_0x8803e3[_0x1bec7d(0x1c8)]('✔');console[_0x1bec7d(0x14d)](_0x1bec7d(0x16a)+_0x1d691a+'\x20'+_0x4781ec[_0x1bec7d(0x158)]),_0x4781ec[_0x1bec7d(0x1ce)]&&console[_0x1bec7d(0x14d)]('\x20\x20\x20\x20\x20\x20'+a22_0x8803e3['red'](_0x4781ec[_0x1bec7d(0x1ce)]));}}if(_0x31eb72[_0x1bec7d(0x251)]&&_0x31eb72[_0x1bec7d(0x251)][_0x1bec7d(0x153)]>0x0){console[_0x1bec7d(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1bec7d(0x17d)](_0x1bec7d(0x107))+'\x20'+_0x31eb72[_0x1bec7d(0x251)][_0x1bec7d(0x153)]+'\x20configured');for(const _0x26cfd1 of _0x31eb72[_0x1bec7d(0x251)]){const _0x4a862f=_0x26cfd1[_0x1bec7d(0x21f)]?a22_0x8803e3[_0x1bec7d(0x1c8)]('✔'):a22_0x8803e3[_0x1bec7d(0x192)]('✘');console[_0x1bec7d(0x14d)]('\x20\x20\x20\x20'+_0x4a862f+'\x20'+_0x26cfd1[_0x1bec7d(0x158)]+'\x20'+a22_0x8803e3[_0x1bec7d(0x17d)]('('+_0x26cfd1[_0x1bec7d(0xe5)]+')'));}}if(_0x31eb72['idStitching']){const _0x4ce61f=_0x31eb72[_0x1bec7d(0x11c)][_0x1bec7d(0x228)]?.[_0x1bec7d(0x153)]?_0x1bec7d(0x18a)+_0x31eb72[_0x1bec7d(0x11c)][_0x1bec7d(0x228)][_0x1bec7d(0x118)](',\x20')+']':'';console[_0x1bec7d(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1bec7d(0x17d)](_0x1bec7d(0x102))+'\x20'+_0x31eb72[_0x1bec7d(0x11c)]['primaryKey']+_0x4ce61f);}if(_0x31eb72['personalizationServices']&&_0x31eb72[_0x1bec7d(0x21a)]['length']>0x0){console[_0x1bec7d(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1bec7d(0x17d)]('Personalization:')+'\x20'+_0x31eb72[_0x1bec7d(0x21a)][_0x1bec7d(0x153)]+_0x1bec7d(0x145)+(_0x31eb72[_0x1bec7d(0x21a)][_0x1bec7d(0x153)]!==0x1?'s':''));for(const _0x1462ff of _0x31eb72['personalizationServices']){console['error'](_0x1bec7d(0xfe)+_0x1462ff[_0x1bec7d(0x158)]);}}}function showParentSegmentNotSetError(_0x31d652){const _0x324e7d=a22_0x105c40;console[_0x324e7d(0x14d)](a22_0x8803e3[_0x324e7d(0x154)](_0x324e7d(0x13c))),console[_0x324e7d(0x14d)](_0x31d652);}export class ParentSegmentListCommand extends BaseCommand{['name']='segment:parent:list';[a22_0x105c40(0x135)]=a22_0x105c40(0x141);async['execute'](_0x1d95a9){const _0x270ce2=a22_0x105c40,{options:_0x1c1dca,args:_0x56fe44,tdx:_0x3c58ec}=_0x1d95a9,_0x13fbc8=_0x56fe44[0x0];_0x1c1dca[_0x270ce2(0x16b)]&&(console[_0x270ce2(0x14d)](_0x270ce2(0x14a)+_0x1c1dca[_0x270ce2(0x241)]),_0x13fbc8&&console[_0x270ce2(0x14d)](_0x270ce2(0x13b)+_0x13fbc8));const _0x48bbc5=await withSpinner(_0x13fbc8?_0x270ce2(0x254)+_0x13fbc8+'\x27...':_0x270ce2(0x14c),()=>_0x3c58ec['segment']['listParents'](),{'verbose':_0x1c1dca[_0x270ce2(0x16b)]});let _0x32d89a=_0x48bbc5[_0x270ce2(0x143)];if(_0x13fbc8){const _0x3d1eea=_0x13fbc8[_0x270ce2(0xf5)](/[.+^${}()|[\]\\]/g,_0x270ce2(0x252))[_0x270ce2(0xf5)](/\*/g,'.*')[_0x270ce2(0xf5)](/\?/g,'.'),_0x2da9e5=new RegExp('^'+_0x3d1eea+'$','i');_0x32d89a=_0x32d89a[_0x270ce2(0x1b2)](_0x177176=>_0x2da9e5[_0x270ce2(0x178)](_0x177176['attributes']['name']));}_0x32d89a[_0x270ce2(0x109)]((_0xaa3cef,_0x477eab)=>_0xaa3cef[_0x270ce2(0x251)][_0x270ce2(0x158)][_0x270ce2(0x235)](_0x477eab[_0x270ce2(0x251)][_0x270ce2(0x158)])),console[_0x270ce2(0x14d)](_0x270ce2(0x217)+_0x32d89a[_0x270ce2(0x153)]+_0x270ce2(0x190)+(_0x32d89a[_0x270ce2(0x153)]!==0x1?'s':''));const _0x253296=_0x967cbb=>{const _0xa91ee7=_0x270ce2;return getConsoleNextUrl(_0x1c1dca[_0xa91ee7(0x241)],_0xa91ee7(0x1f6)+_0x967cbb);};if(_0x1c1dca[_0x270ce2(0x259)]===_0x270ce2(0x136)||_0x1c1dca[_0x270ce2(0x259)]==='jsonl'){const _0x3624d8=_0x32d89a[_0x270ce2(0x14b)](_0x23c645=>({..._0x23c645,'url':_0x253296(_0x23c645['id'])}));await handleSDKOutput(_0x3624d8,_0x1c1dca);}else{if(_0x32d89a[_0x270ce2(0x153)]===0x0)_0x13fbc8?console['log'](_0x270ce2(0x23f)+_0x13fbc8):console[_0x270ce2(0x23c)]('No\x20parent\x20segments\x20found');else for(const _0x5300ea of _0x32d89a){const _0x551908=_0x5300ea['attributes'][_0x270ce2(0x1c6)]?a22_0x8803e3[_0x270ce2(0x17d)]('\x20('+formatRows(_0x5300ea['attributes']['population'])+')'):'',_0x51dd49=hyperlink(_0x5300ea[_0x270ce2(0x251)][_0x270ce2(0x158)],_0x253296(_0x5300ea['id']));console[_0x270ce2(0x23c)](_0x270ce2(0x1d5)+_0x51dd49+_0x551908);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x105c40(0x15c);[a22_0x105c40(0x135)]=a22_0x105c40(0x174);async[a22_0x105c40(0x187)](_0x1cc21e){const _0x2acc45=a22_0x105c40,{options:_0x3b4d78,args:_0x3e237c,tdx:_0x583aa5}=_0x1cc21e;console[_0x2acc45(0x14d)](_0x2acc45(0xf4)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2acc45(0x16c));const _0xb61331=_0x3b4d78;if(_0x3e237c[_0x2acc45(0x153)]===0x0)return console[_0x2acc45(0x14d)](a22_0x8803e3['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x2acc45(0x14d)](_0x2acc45(0x1d2)),0x1;const _0x118107=_0x3e237c[0x0];if(!_0xb61331['database']||!_0xb61331[_0x2acc45(0x1c9)])return console[_0x2acc45(0x14d)](_0x2acc45(0x231)),console[_0x2acc45(0x14d)](_0x2acc45(0x1d2)),0x1;_0xb61331[_0x2acc45(0x16b)]&&(console[_0x2acc45(0x14d)](_0x2acc45(0x14a)+_0xb61331[_0x2acc45(0x241)]),console[_0x2acc45(0x14d)](_0x2acc45(0x247)+_0x118107),console[_0x2acc45(0x14d)](_0x2acc45(0x16d)+_0xb61331['database']),console[_0x2acc45(0x14d)]('Table:\x20'+_0xb61331['table']));const _0x5b2e63=await loadJSONFromOptions(_0xb61331[_0x2acc45(0x251)],_0xb61331[_0x2acc45(0x1b8)]),_0x2f2b63=await loadJSONFromOptions(_0xb61331[_0x2acc45(0x122)],_0xb61331[_0x2acc45(0x170)]),_0x58416a=await loadJSONFromOptions(_0xb61331['customerGroup'],_0xb61331[_0x2acc45(0x101)]),_0x40d1c3={'name':_0x118107,'description':_0xb61331[_0x2acc45(0x135)],'scheduleType':_0xb61331['scheduleType'],'scheduleOption':_0xb61331[_0x2acc45(0x12b)],'timezone':_0xb61331[_0x2acc45(0x1f1)],'master':{'parentDatabaseName':_0xb61331[_0x2acc45(0x19c)],'parentTableName':_0xb61331['table']},'attributes':_0x5b2e63,'behaviors':_0x2f2b63,'customerGroup':_0x58416a},_0x392dfa=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x118107+_0x2acc45(0x175),()=>_0x583aa5[_0x2acc45(0x21b)]['createParent'](_0x40d1c3),{'verbose':_0x3b4d78[_0x2acc45(0x16b)]}),_0x47ce2d=_0x392dfa['data'];return console[_0x2acc45(0x14d)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x47ce2d[_0x2acc45(0x158)]+_0x2acc45(0x184)+_0x47ce2d['id']),await handleSDKOutput([_0x47ce2d],_0x3b4d78),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x19d);[a22_0x105c40(0x135)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x105c40(0x187)](_0x4c1a90){const _0x4bf2a8=a22_0x105c40,{options:_0xb7ffc6,args:_0x308d08,tdx:_0x227ebc}=_0x4c1a90;console[_0x4bf2a8(0x14d)](_0x4bf2a8(0x168)+_0x4bf2a8(0x248)+_0x4bf2a8(0x16c));const _0x3335bc=_0xb7ffc6;if(_0x308d08[_0x4bf2a8(0x153)]===0x0)return console[_0x4bf2a8(0x14d)](a22_0x8803e3[_0x4bf2a8(0x192)](_0x4bf2a8(0x213))),console['error'](_0x4bf2a8(0x155)),0x1;const _0x1b9e93=_0x308d08[0x0];_0x3335bc['verbose']&&(console['error'](_0x4bf2a8(0x14a)+_0x3335bc['site']),console['error'](_0x4bf2a8(0x150)+_0x1b9e93));const _0x1518ac=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x1b9e93+'\x27...',()=>_0x227ebc[_0x4bf2a8(0x21b)][_0x4bf2a8(0x1a5)](_0x1b9e93),{'verbose':_0x3335bc['verbose']}),_0xd3ff0e=_0x1518ac[_0x4bf2a8(0x143)],_0x1cf77c=await loadJSONFromOptions(_0x3335bc[_0x4bf2a8(0xe3)],_0x3335bc['addAttributesFile']),_0x10a7d1=await loadJSONFromOptions(_0x3335bc[_0x4bf2a8(0x10f)],_0x3335bc[_0x4bf2a8(0x1ff)]),_0x13c0a3={'name':_0xd3ff0e[_0x4bf2a8(0x158)],'description':_0x3335bc[_0x4bf2a8(0x135)]!==undefined?_0x3335bc[_0x4bf2a8(0x135)]:_0xd3ff0e[_0x4bf2a8(0x135)],'scheduleType':_0x3335bc['scheduleType']!==undefined?_0x3335bc[_0x4bf2a8(0xe4)]:_0xd3ff0e[_0x4bf2a8(0xe4)],'scheduleOption':_0x3335bc[_0x4bf2a8(0x12b)]!==undefined?_0x3335bc['scheduleOption']:_0xd3ff0e[_0x4bf2a8(0x12b)],'timezone':_0x3335bc['timezone']!==undefined?_0x3335bc[_0x4bf2a8(0x1f1)]:_0xd3ff0e[_0x4bf2a8(0x1f1)],'master':_0xd3ff0e['master'],'attributes':_0x1cf77c?[..._0xd3ff0e['attributes']||[],..._0x1cf77c]:_0xd3ff0e[_0x4bf2a8(0x251)],'behaviors':_0x10a7d1?[..._0xd3ff0e[_0x4bf2a8(0x122)]||[],..._0x10a7d1]:_0xd3ff0e[_0x4bf2a8(0x122)],'customerGroup':_0xd3ff0e[_0x4bf2a8(0x20f)]},_0x1065f4=await withSpinner(_0x4bf2a8(0x138)+_0x1b9e93+'\x27...',()=>_0x227ebc[_0x4bf2a8(0x21b)]['updateParent'](_0x1b9e93,_0x13c0a3),{'verbose':_0x3335bc[_0x4bf2a8(0x16b)]}),_0x24c2d3=_0x1065f4[_0x4bf2a8(0x143)];return console[_0x4bf2a8(0x14d)](_0x4bf2a8(0x245)+_0x24c2d3['name']+'\x27'),await handleSDKOutput([_0x24c2d3],_0x3335bc),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x239);[a22_0x105c40(0x135)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x105c40(0x187)](_0x3acd71){const _0x1f9dd6=a22_0x105c40,{options:_0x53252c,args:_0x487fc4,tdx:_0x17fde3}=_0x3acd71,_0x3a31a9=_0x53252c,_0x126551=_0x487fc4[0x0]||_0x53252c[_0x1f9dd6(0x15f)];if(!_0x126551)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x3a31a9[_0x1f9dd6(0x1a3)]&&_0x3a31a9[_0x1f9dd6(0x16f)])return console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x192)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console['error'](a22_0x8803e3[_0x1f9dd6(0x17d)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x17d)](_0x1f9dd6(0xec)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x22f)](_0x1f9dd6(0x137))),0x1;const _0x2801fd=_0x3a31a9[_0x1f9dd6(0x16f)]||a22_0x34b791[_0x1f9dd6(0x118)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x126551)+_0x1f9dd6(0x236));_0x3a31a9[_0x1f9dd6(0x16b)]&&(console[_0x1f9dd6(0x14d)](_0x1f9dd6(0x14a)+_0x3a31a9[_0x1f9dd6(0x241)]),console[_0x1f9dd6(0x14d)](_0x1f9dd6(0x150)+_0x126551),console[_0x1f9dd6(0x14d)]('Output\x20file:\x20'+_0x2801fd));const _0x5b9d42=await withSpinner(_0x1f9dd6(0x210)+_0x126551+_0x1f9dd6(0x175),()=>_0x17fde3[_0x1f9dd6(0x21b)]['pullParentYaml'](_0x126551),{'verbose':_0x3a31a9[_0x1f9dd6(0x16b)]}),_0x22e4ca=_0x5b9d42['data'];if(existsSync(_0x2801fd)){const _0x2dc87f=readFileSync(_0x2801fd,_0x1f9dd6(0x189)),_0x14e3d9=generateDiff(_0x2dc87f,_0x22e4ca);if(!hasChanges(_0x14e3d9))console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x1c8)]('✔')+_0x1f9dd6(0x18d)+a22_0x8803e3[_0x1f9dd6(0x22f)](_0x2801fd)+_0x1f9dd6(0x206));else{console[_0x1f9dd6(0x14d)](_0x1f9dd6(0x250)+_0x2801fd+'\x27:'),console[_0x1f9dd6(0x14d)]('─'['repeat'](0x3c)),console[_0x1f9dd6(0x14d)](formatDiffWithColors(_0x14e3d9)),console[_0x1f9dd6(0x14d)]('─'['repeat'](0x3c));if(!_0x3a31a9[_0x1f9dd6(0x12c)]){if(!isInteractive())return console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x192)]('\x0aError:'),_0x1f9dd6(0x25f)),console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x17d)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xb4dbfd=await confirmKey(_0x1f9dd6(0xe7)+_0x2801fd+'\x27?');if(!_0xb4dbfd)return console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x154)]('Aborted.')),0x1;}writeFileSync(_0x2801fd,_0x22e4ca,'utf-8'),console[_0x1f9dd6(0x14d)](a22_0x8803e3[_0x1f9dd6(0x1c8)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x8803e3['cyan'](_0x2801fd));}}else{const _0x1c005a=a22_0x34b791[_0x1f9dd6(0x1da)](_0x2801fd);!existsSync(_0x1c005a)&&mkdirSync(_0x1c005a,{'recursive':!![]}),writeFileSync(_0x2801fd,_0x22e4ca,_0x1f9dd6(0x189)),console[_0x1f9dd6(0x14d)](a22_0x8803e3['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x8803e3[_0x1f9dd6(0x22f)](_0x2801fd));}return saveSessionContext({'parent_segment':_0x126551},_0x3a31a9[_0x1f9dd6(0x134)]),console['error'](a22_0x8803e3[_0x1f9dd6(0x1c8)]('✔')+_0x1f9dd6(0x104)+a22_0x8803e3[_0x1f9dd6(0x17d)](_0x1f9dd6(0xee))+_0x1f9dd6(0xea)+a22_0x8803e3[_0x1f9dd6(0x22f)](_0x126551)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x246);['description']=a22_0x105c40(0x1cb);async[a22_0x105c40(0x187)](_0x3d925b){const _0xa787fe=a22_0x105c40,{options:_0x3846f7,args:_0x387b06,tdx:_0xcce30b}=_0x3d925b,_0x2f1462=_0x3846f7,_0x26aac6=_0x387b06[0x0]||_0x3846f7[_0xa787fe(0x15f)];if(!_0x26aac6)return showParentSegmentNotSetError(_0xa787fe(0x233)+_0xa787fe(0x18f)),0x1;const _0x3fc28f=resolveYamlFile(_0x26aac6);if(!existsSync(_0x3fc28f))return showFileNotFoundError(_0x3fc28f,_0x26aac6),0x1;_0x2f1462[_0xa787fe(0x16b)]&&(console['error']('Site:\x20'+_0x2f1462['site']),console[_0xa787fe(0x14d)](_0xa787fe(0x1ab)+_0x3fc28f));let _0x176ce7;try{_0x176ce7=readFileSync(_0x3fc28f,_0xa787fe(0x189));}catch(_0xb6c7ee){const _0x588265=_0xb6c7ee instanceof Error?_0xb6c7ee[_0xa787fe(0x1d1)]:String(_0xb6c7ee);return console[_0xa787fe(0x14d)](_0xa787fe(0xe6)+_0x588265),0x1;}const _0x1d0e9e=await withSpinner(_0xa787fe(0x182),()=>_0xcce30b[_0xa787fe(0x21b)][_0xa787fe(0x1ee)](_0x176ce7),{'verbose':_0x2f1462['verbose']}),_0x2f6f77=_0x1d0e9e[_0xa787fe(0x143)],{isNew:_0x48e0fe,name:_0x252869,hasChanges:_0x598c46,diffFormatted:_0x5416c4}=_0x2f6f77;if(!_0x598c46)return console['error'](_0xa787fe(0x1e8)+_0x252869+_0xa787fe(0x1eb)),0x0;_0x48e0fe?console['error'](_0xa787fe(0x11e)+_0x252869+'\x27:'):console[_0xa787fe(0x14d)](_0xa787fe(0x226)+_0x252869+'\x27:');console[_0xa787fe(0x14d)]('─'[_0xa787fe(0x1bf)](0x3c)),console[_0xa787fe(0x14d)](_0x5416c4),console[_0xa787fe(0x14d)]('─'[_0xa787fe(0x1bf)](0x3c));const _0x3c96cb=_0x48e0fe?'Create\x20parent\x20segment\x20\x27'+_0x252869+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x252869+'\x27?';if(!_0x2f1462['yes']){if(!isInteractive())return console[_0xa787fe(0x14d)](a22_0x8803e3[_0xa787fe(0x192)]('\x0aError:'),_0xa787fe(0x25f)),console['error'](a22_0x8803e3[_0xa787fe(0x17d)](_0xa787fe(0x1e2))),0x1;const _0x5ce5c4=await confirmKey(_0x3c96cb);if(!_0x5ce5c4)return console['error'](a22_0x8803e3[_0xa787fe(0x154)](_0xa787fe(0x240))),0x1;}const _0x2ca845=_0x48e0fe?_0xa787fe(0x176):'Updating',_0x385726=await withSpinner(_0x2ca845+_0xa787fe(0x15b)+_0x252869+_0xa787fe(0x175),()=>_0x2f6f77[_0xa787fe(0x1af)](),{'verbose':_0x2f1462[_0xa787fe(0x16b)]}),_0x50a838=_0x385726[_0xa787fe(0x143)],_0x46de37=getConsoleNextUrl(_0x2f1462[_0xa787fe(0x241)],_0xa787fe(0x1f6)+_0x50a838['id']),_0xdbc9f4=_0x48e0fe?'Created':_0xa787fe(0x11a);return console['error']('✔\x20'+_0xdbc9f4+_0xa787fe(0x15b)+_0x50a838[_0xa787fe(0x158)]+'\x27'),console[_0xa787fe(0x14d)]('\x20\x20'+_0x46de37),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x1f9);['description']=a22_0x105c40(0x1fa);async['execute'](_0x14da75){const _0xe5dbeb=a22_0x105c40,{options:_0x23a225,args:_0xbb2842,tdx:_0x538e98}=_0x14da75,_0xf4ef8d=_0x23a225,_0x13a76b=_0xbb2842[0x0]||_0x23a225['parentSegment'];if(!_0x13a76b)return showParentSegmentNotSetError(_0xe5dbeb(0x1e0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0xe5dbeb(0x148)+_0xe5dbeb(0x157)+_0xe5dbeb(0x117)+_0xe5dbeb(0x125)),0x1;const _0xbe0c99=resolveYamlFile(_0x13a76b);if(!existsSync(_0xbe0c99))return showFileNotFoundError(_0xbe0c99,_0x13a76b),0x1;_0xf4ef8d[_0xe5dbeb(0x16b)]&&(console[_0xe5dbeb(0x14d)](_0xe5dbeb(0x14a)+_0xf4ef8d['site']),console[_0xe5dbeb(0x14d)]('YAML\x20file:\x20'+_0xbe0c99));let _0x55f375;try{_0x55f375=readFileSync(_0xbe0c99,_0xe5dbeb(0x189));}catch(_0x35732b){const _0x16f97b=_0x35732b instanceof Error?_0x35732b[_0xe5dbeb(0x1d1)]:String(_0x35732b);return console[_0xe5dbeb(0x14d)](_0xe5dbeb(0xe6)+_0x16f97b),0x1;}const _0x418420=createCommandSpinner(a22_0x8803e3[_0xe5dbeb(0x17d)]('Validating\x20configuration...'),{'verbose':_0xf4ef8d[_0xe5dbeb(0x16b)]});_0x418420[_0xe5dbeb(0x1cf)]();const _0x1ded81={'onProgress':_0x322506=>{const _0x28abb2=_0xe5dbeb;_0x418420[_0x28abb2(0x25e)]=formatProgressMessage(_0x322506);}};if(_0xf4ef8d[_0xe5dbeb(0x222)])_0x1ded81[_0xe5dbeb(0x222)]=!![];if(_0xf4ef8d[_0xe5dbeb(0x133)])_0x1ded81['enriched']=!![];_0xf4ef8d[_0xe5dbeb(0x1a4)]&&(_0x1ded81[_0xe5dbeb(0x1a4)]=_0xf4ef8d['attribute']);_0xf4ef8d['behavior']&&(_0x1ded81['behavior']=_0xf4ef8d['behavior']);if(_0xf4ef8d[_0xe5dbeb(0x1a0)])_0x1ded81[_0xe5dbeb(0x1a0)]=_0xf4ef8d[_0xe5dbeb(0x1a0)];let _0x5afb40;try{_0x5afb40=await _0x538e98[_0xe5dbeb(0x21b)][_0xe5dbeb(0x177)](_0x55f375,_0x1ded81),_0x418420[_0xe5dbeb(0x21d)]();}catch(_0x7221f9){_0x418420[_0xe5dbeb(0x21d)]();throw _0x7221f9;}const _0x1b8dbe=_0xf4ef8d[_0xe5dbeb(0x1a0)]||_0xe5dbeb(0x1d3);return this[_0xe5dbeb(0xfb)](_0x5afb40,_0x1ded81,_0xbe0c99,_0x1b8dbe),_0x5afb40['allValid']?0x0:0x1;}[a22_0x105c40(0xfb)](_0x47aa62,_0xa8ee1e,_0x222d1e,_0x1713f2){const _0x4708af=a22_0x105c40;console['error']('\x0a'+a22_0x8803e3[_0x4708af(0x165)](_0x4708af(0x128))+'\x20'+_0x47aa62[_0x4708af(0x158)]),console['error']('═'[_0x4708af(0x1bf)](0x3c)),this[_0x4708af(0x1c3)](_0x47aa62);if(typeof _0xa8ee1e['attribute']===_0x4708af(0x152)){this[_0x4708af(0x119)](_0x47aa62),this[_0x4708af(0x10c)](_0x47aa62),this['displayPreviewHints'](_0x222d1e,_0x1713f2,'attribute',_0xa8ee1e[_0x4708af(0x1a4)]);return;}if(_0xa8ee1e[_0x4708af(0x1a4)]===!![]){this[_0x4708af(0x119)](_0x47aa62),this[_0x4708af(0x10c)](_0x47aa62),this[_0x4708af(0x19e)](_0x222d1e,_0x1713f2,_0x4708af(0x251));return;}if(typeof _0xa8ee1e[_0x4708af(0x12a)]===_0x4708af(0x152)){this[_0x4708af(0x166)](_0x47aa62,_0x1713f2),this['displaySummary'](_0x47aa62),this['displayPreviewHints'](_0x222d1e,_0x1713f2,_0x4708af(0x12a),_0xa8ee1e[_0x4708af(0x12a)]);return;}if(_0xa8ee1e[_0x4708af(0x12a)]===!![]){this[_0x4708af(0x166)](_0x47aa62,_0x1713f2),this[_0x4708af(0x10c)](_0x47aa62),this['displayPreviewHints'](_0x222d1e,_0x1713f2,_0x4708af(0x122));return;}this[_0x4708af(0x119)](_0x47aa62),this[_0x4708af(0x166)](_0x47aa62,_0x1713f2),this[_0x4708af(0x17c)](_0x47aa62),this['displaySummary'](_0x47aa62),this[_0x4708af(0x19e)](_0x222d1e,_0x1713f2,_0x4708af(0x188));}[a22_0x105c40(0x17c)](_0x16ed22){displayRealtimeValidation(_0x16ed22);}[a22_0x105c40(0x19e)](_0x12e11a,_0x404e11,_0x23dc0a,_0x3663e3){const _0x447263=a22_0x105c40;console['error']('\x0a'+a22_0x8803e3['dim'](_0x447263(0x220)));const _0x4fdc29=_0x404e11!==_0x447263(0x1d3)?_0x447263(0x200)+_0x404e11:'';if(_0x23dc0a===_0x447263(0x1a4)&&_0x3663e3)console[_0x447263(0x14d)]('\x20\x20'+a22_0x8803e3['dim'](_0x447263(0x179)+_0x12e11a+_0x447263(0x244)+_0x3663e3+'\x22'+_0x4fdc29));else{if(_0x23dc0a==='behavior'&&_0x3663e3)console[_0x447263(0x14d)]('\x20\x20'+a22_0x8803e3['dim'](_0x447263(0x179)+_0x12e11a+_0x447263(0xe8)+_0x3663e3+'\x22'+_0x4fdc29));else(_0x23dc0a===_0x447263(0x251)||_0x23dc0a===_0x447263(0x188))&&console[_0x447263(0x14d)]('\x20\x20'+a22_0x8803e3['dim'](_0x447263(0x179)+_0x12e11a+_0x447263(0x10a)+_0x4fdc29));}(_0x23dc0a===_0x447263(0x122)||_0x23dc0a===_0x447263(0x188))&&console[_0x447263(0x14d)]('\x20\x20'+a22_0x8803e3[_0x447263(0x17d)]('tdx\x20ps\x20preview\x20'+_0x12e11a+'\x20--behavior\x20\x22<name>\x22'+_0x4fdc29)),_0x23dc0a===_0x447263(0x188)&&console['error']('\x20\x20'+a22_0x8803e3['dim']('tdx\x20ps\x20preview\x20'+_0x12e11a+'\x20--enriched'+_0x4fdc29));}['displayMasterInfo'](_0x3f2b5b){const _0x5f0e37=a22_0x105c40,{master:_0x2ec837}=_0x3f2b5b,_0x1fcbd6=_0x2ec837[_0x5f0e37(0x12e)]?a22_0x8803e3[_0x5f0e37(0x1c8)]('✔'):a22_0x8803e3[_0x5f0e37(0x192)]('✘');console[_0x5f0e37(0x14d)]('\x0a'+a22_0x8803e3[_0x5f0e37(0x17d)]('Master\x20Table')),console[_0x5f0e37(0x14d)](_0x1fcbd6+'\x20'+a22_0x8803e3['bold'](_0x2ec837[_0x5f0e37(0x19c)]+'.'+_0x2ec837[_0x5f0e37(0x1c9)])),_0x2ec837['schemaValid']?_0x2ec837['rowCount']!==undefined&&console['error']('\x20\x20'+a22_0x8803e3[_0x5f0e37(0x17d)](_0x5f0e37(0x146))+'\x20'+a22_0x8803e3[_0x5f0e37(0x22f)](formatRows(_0x2ec837['rowCount']))):console[_0x5f0e37(0x14d)]('\x20\x20'+a22_0x8803e3[_0x5f0e37(0x192)]('Error:')+'\x20'+_0x2ec837[_0x5f0e37(0x183)]);}[a22_0x105c40(0x119)](_0x32bba4){const _0x4bf5e3=a22_0x105c40;if(_0x32bba4[_0x4bf5e3(0x251)][_0x4bf5e3(0x153)]===0x0)return;console[_0x4bf5e3(0x14d)]('\x0a'+a22_0x8803e3[_0x4bf5e3(0x17d)](_0x4bf5e3(0x164)));for(const _0x4af376 of _0x32bba4[_0x4bf5e3(0x251)]){const _0x11ba4f=_0x4af376['schemaValid']?a22_0x8803e3[_0x4bf5e3(0x1c8)]('✔'):a22_0x8803e3[_0x4bf5e3(0x192)]('✘');let _0xc9fe5f='';if(_0x4af376[_0x4bf5e3(0x12e)]&&_0x4af376['matchedCount']!==undefined&&_0x4af376[_0x4bf5e3(0x162)]!==undefined){const _0x3184f1=_0x4af376['coveragePercent'][_0x4bf5e3(0x1de)](0x1),_0x3952bf=_0x4af376[_0x4bf5e3(0x162)]>=0x50?a22_0x8803e3['green']:_0x4af376[_0x4bf5e3(0x162)]>=0x32?a22_0x8803e3['yellow']:a22_0x8803e3[_0x4bf5e3(0x192)];_0xc9fe5f='\x20'+a22_0x8803e3[_0x4bf5e3(0x17d)](_0x4bf5e3(0x25a))+'\x20'+_0x3952bf(_0x3184f1+'%')+'\x20('+formatRows(_0x4af376['matchedCount'])+'\x20rows)';}console[_0x4bf5e3(0x14d)](_0x11ba4f+'\x20'+a22_0x8803e3[_0x4bf5e3(0x165)](_0x4af376[_0x4bf5e3(0x158)])+_0xc9fe5f),console[_0x4bf5e3(0x14d)]('\x20\x20'+a22_0x8803e3[_0x4bf5e3(0x17d)](_0x4bf5e3(0x17e))+'\x20'+a22_0x8803e3[_0x4bf5e3(0x165)](_0x4af376[_0x4bf5e3(0x19c)]+'.'+_0x4af376[_0x4bf5e3(0x1c9)]));const _0x39c0e5=_0x4af376[_0x4bf5e3(0x16e)]===_0x4af376['foreignKey']?a22_0x8803e3[_0x4bf5e3(0x17d)]('Join\x20on:')+'\x20'+_0x4af376[_0x4bf5e3(0x16e)]:a22_0x8803e3[_0x4bf5e3(0x17d)](_0x4bf5e3(0x1ca))+'\x20'+_0x4af376[_0x4bf5e3(0x16e)]+_0x4bf5e3(0xea)+_0x4af376[_0x4bf5e3(0x113)];console[_0x4bf5e3(0x14d)]('\x20\x20'+_0x39c0e5),console[_0x4bf5e3(0x14d)]('\x20\x20'+a22_0x8803e3[_0x4bf5e3(0x17d)](_0x4bf5e3(0x218))),this[_0x4bf5e3(0x1c4)](_0x4af376[_0x4bf5e3(0x100)]),!_0x4af376[_0x4bf5e3(0x12e)]&&console[_0x4bf5e3(0x14d)]('\x20\x20'+a22_0x8803e3[_0x4bf5e3(0x192)](_0x4bf5e3(0x196))+'\x20'+_0x4af376['schemaError']);}}[a22_0x105c40(0x166)](_0x44ba5d,_0x33c13f){const _0x1a45fd=a22_0x105c40;if(_0x44ba5d['behaviors'][_0x1a45fd(0x153)]===0x0)return;console['error']('\x0a'+a22_0x8803e3[_0x1a45fd(0x17d)](_0x1a45fd(0xe1))+'\x20'+a22_0x8803e3['dim']('('+_0x33c13f+')'));for(const _0x13c915 of _0x44ba5d[_0x1a45fd(0x122)]){const _0x3469aa=_0x13c915['schemaValid']?a22_0x8803e3['green']('✔'):a22_0x8803e3[_0x1a45fd(0x192)]('✘');let _0x11f59f='';if(_0x13c915['schemaValid']&&_0x13c915[_0x1a45fd(0x1ac)]!==undefined&&_0x13c915[_0x1a45fd(0x1ef)]!==undefined){const _0x5686c9=_0x13c915['customerPercent']?.[_0x1a45fd(0x1de)](0x1)||'?',_0x3f6a54=(_0x13c915[_0x1a45fd(0x108)]??0x0)>=0x32?a22_0x8803e3[_0x1a45fd(0x1c8)]:(_0x13c915['customerPercent']??0x0)>=0x14?a22_0x8803e3[_0x1a45fd(0x154)]:a22_0x8803e3[_0x1a45fd(0x192)];_0x11f59f='\x20'+a22_0x8803e3[_0x1a45fd(0x17d)](_0x1a45fd(0x1cd))+'\x20'+_0x3f6a54(formatRows(_0x13c915[_0x1a45fd(0x1ac)]))+'\x20('+_0x5686c9+_0x1a45fd(0x266)+a22_0x8803e3[_0x1a45fd(0x17d)](_0x1a45fd(0x202))+'\x20'+a22_0x8803e3['cyan'](formatRows(_0x13c915['totalEvents']));}console[_0x1a45fd(0x14d)](_0x3469aa+'\x20'+a22_0x8803e3[_0x1a45fd(0x165)](_0x13c915[_0x1a45fd(0x158)])+_0x11f59f),console[_0x1a45fd(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1a45fd(0x17d)](_0x1a45fd(0x17e))+'\x20'+a22_0x8803e3[_0x1a45fd(0x165)](_0x13c915[_0x1a45fd(0x19c)]+'.'+_0x13c915[_0x1a45fd(0x1c9)]));const _0x2e21db=_0x13c915[_0x1a45fd(0x16e)]===_0x13c915[_0x1a45fd(0x113)]?a22_0x8803e3[_0x1a45fd(0x17d)]('Join\x20on:')+'\x20'+_0x13c915[_0x1a45fd(0x16e)]:a22_0x8803e3[_0x1a45fd(0x17d)]('Join:')+'\x20'+_0x13c915[_0x1a45fd(0x16e)]+'\x20=\x20'+_0x13c915['foreignKey'];console[_0x1a45fd(0x14d)]('\x20\x20'+_0x2e21db),console['error']('\x20\x20'+a22_0x8803e3[_0x1a45fd(0x17d)](_0x1a45fd(0x218))),this[_0x1a45fd(0x1c4)](_0x13c915[_0x1a45fd(0x100)]),!_0x13c915[_0x1a45fd(0x12e)]&&console[_0x1a45fd(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1a45fd(0x192)]('Error:')+'\x20'+_0x13c915[_0x1a45fd(0x183)]);}}[a22_0x105c40(0x1c4)](_0x49f93b){const _0x37135c=a22_0x105c40;for(const _0x14bb66 of _0x49f93b){_0x14bb66[_0x37135c(0xed)]===_0x14bb66[_0x37135c(0x203)]||_0x14bb66[_0x37135c(0x203)]==='*'?console[_0x37135c(0x14d)](_0x37135c(0xfe)+_0x14bb66[_0x37135c(0xed)]):console['error']('\x20\x20\x20\x20-\x20'+_0x14bb66['label']+'\x20'+a22_0x8803e3[_0x37135c(0x17d)]('('+_0x14bb66[_0x37135c(0x203)]+')'));}}[a22_0x105c40(0x10c)](_0x415495){const _0xfa1520=a22_0x105c40;console[_0xfa1520(0x14d)]('─'[_0xfa1520(0x1bf)](0x3c));if(_0x415495[_0xfa1520(0xdf)]['length']>0x0){console[_0xfa1520(0x14d)]('\x0a'+a22_0x8803e3['red'](_0xfa1520(0x1a6)));for(const _0x591853 of _0x415495[_0xfa1520(0xdf)]){console[_0xfa1520(0x14d)]('\x20\x20'+a22_0x8803e3[_0xfa1520(0x192)]('•')+'\x20'+_0x591853);}}_0x415495[_0xfa1520(0x10e)]&&console[_0xfa1520(0x14d)]('\x0a'+a22_0x8803e3['green']('✔')+_0xfa1520(0x1b5));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x242);[a22_0x105c40(0x135)]=a22_0x105c40(0xe0);async[a22_0x105c40(0x187)](_0x18cee2){const _0x1e59f2=a22_0x105c40,{options:_0x16e040,args:_0x5d461c,tdx:_0x54c9ff}=_0x18cee2,_0x2ad7a3=_0x16e040,_0xfffe83=_0x5d461c[0x0]||_0x16e040['parentSegment'];if(!_0xfffe83)return showParentSegmentNotSetError(_0x1e59f2(0x25c)+_0x1e59f2(0x214)+_0x1e59f2(0x18b)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1e59f2(0x1d4)+_0x1e59f2(0xf3)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x1e59f2(0x125)),0x1;if(!_0x2ad7a3['master']&&!_0x2ad7a3['attribute']&&!_0x2ad7a3[_0x1e59f2(0x12a)]&&!_0x2ad7a3[_0x1e59f2(0x133)])return console['error'](a22_0x8803e3[_0x1e59f2(0x192)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x1e59f2(0x14d)](_0x1e59f2(0x110)),console['error']('Options:'),console[_0x1e59f2(0x14d)](_0x1e59f2(0x227)),console[_0x1e59f2(0x14d)](_0x1e59f2(0x11b)),console[_0x1e59f2(0x14d)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x1e59f2(0x14d)](_0x1e59f2(0x124)),0x1;const _0x82f3b0=resolveYamlFile(_0xfffe83);if(!existsSync(_0x82f3b0))return showFileNotFoundError(_0x82f3b0,_0xfffe83),0x1;_0x2ad7a3[_0x1e59f2(0x16b)]&&(console[_0x1e59f2(0x14d)]('Site:\x20'+_0x2ad7a3[_0x1e59f2(0x241)]),console[_0x1e59f2(0x14d)](_0x1e59f2(0x1ab)+_0x82f3b0));let _0x2c0521;try{_0x2c0521=readFileSync(_0x82f3b0,_0x1e59f2(0x189));}catch(_0x532d32){const _0xda35d=_0x532d32 instanceof Error?_0x532d32[_0x1e59f2(0x1d1)]:String(_0x532d32);return console[_0x1e59f2(0x14d)](_0x1e59f2(0xe6)+_0xda35d),0x1;}let _0x4d8ee6;try{_0x4d8ee6=parseDef(_0x2c0521);}catch(_0x26fb47){const _0x5365bc=_0x26fb47 instanceof Error?_0x26fb47[_0x1e59f2(0x1d1)]:String(_0x26fb47);return console[_0x1e59f2(0x14d)](a22_0x8803e3[_0x1e59f2(0x192)](_0x1e59f2(0x13e)+_0x5365bc)),0x1;}if(_0x2ad7a3['attribute']===!![]||_0x2ad7a3[_0x1e59f2(0x1a4)]===''){const _0x2418a1=_0x4d8ee6[_0x1e59f2(0x251)]?.[_0x1e59f2(0x14b)](_0x6c598c=>_0x6c598c[_0x1e59f2(0x158)])||[];if(_0x2418a1[_0x1e59f2(0x153)]===0x0)console['error'](a22_0x8803e3[_0x1e59f2(0x192)](_0x1e59f2(0x1bc)));else{console[_0x1e59f2(0x14d)](a22_0x8803e3[_0x1e59f2(0x192)](_0x1e59f2(0x25d))),console['error'](_0x1e59f2(0x1e6));for(const _0x783343 of _0x2418a1){console[_0x1e59f2(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1e59f2(0x22f)](_0x783343));}console[_0x1e59f2(0x14d)](_0x1e59f2(0x1f0)+_0xfffe83+_0x1e59f2(0x244)+_0x2418a1[0x0]+'\x22');}return 0x1;}if(_0x2ad7a3[_0x1e59f2(0x12a)]===!![]||_0x2ad7a3['behavior']===''){const _0x3dbf51=_0x4d8ee6[_0x1e59f2(0x122)]?.[_0x1e59f2(0x14b)](_0x3c66cc=>_0x3c66cc[_0x1e59f2(0x158)])||[];if(_0x3dbf51[_0x1e59f2(0x153)]===0x0)console[_0x1e59f2(0x14d)](a22_0x8803e3[_0x1e59f2(0x192)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x1e59f2(0x14d)](a22_0x8803e3[_0x1e59f2(0x192)](_0x1e59f2(0x17a))),console['error'](_0x1e59f2(0x120));for(const _0x5d5bb1 of _0x3dbf51){console[_0x1e59f2(0x14d)]('\x20\x20'+a22_0x8803e3[_0x1e59f2(0x22f)](_0x5d5bb1));}console[_0x1e59f2(0x14d)](_0x1e59f2(0x1f0)+_0xfffe83+_0x1e59f2(0xe8)+_0x3dbf51[0x0]+'\x22');}return 0x1;}const _0x3e8d27=createCommandSpinner(a22_0x8803e3[_0x1e59f2(0x17d)]('Fetching\x20sample\x20data...'),{'verbose':_0x2ad7a3['verbose']});_0x3e8d27[_0x1e59f2(0x1cf)]();const _0x2d1fdd={'onProgress':_0x5f426d=>{_0x3e8d27['text']=formatProgressMessage(_0x5f426d);}};if(_0x2ad7a3[_0x1e59f2(0x222)])_0x2d1fdd[_0x1e59f2(0x222)]=!![];if(_0x2ad7a3[_0x1e59f2(0x1a4)]&&typeof _0x2ad7a3['attribute']===_0x1e59f2(0x152))_0x2d1fdd[_0x1e59f2(0x1a4)]=_0x2ad7a3[_0x1e59f2(0x1a4)];if(_0x2ad7a3[_0x1e59f2(0x12a)]&&typeof _0x2ad7a3['behavior']===_0x1e59f2(0x152))_0x2d1fdd[_0x1e59f2(0x12a)]=_0x2ad7a3[_0x1e59f2(0x12a)];if(_0x2ad7a3[_0x1e59f2(0x133)])_0x2d1fdd[_0x1e59f2(0x133)]=!![];if(_0x2ad7a3['interval'])_0x2d1fdd[_0x1e59f2(0x1a0)]=_0x2ad7a3['interval'];let _0x42593c;try{_0x42593c=await _0x54c9ff['segment'][_0x1e59f2(0x205)](_0x2c0521,_0x2d1fdd),_0x3e8d27[_0x1e59f2(0x21d)]();}catch(_0x50cd9f){_0x3e8d27[_0x1e59f2(0x21d)]();throw _0x50cd9f;}return await this[_0x1e59f2(0x1bd)](_0x42593c,{'master':_0x2ad7a3[_0x1e59f2(0x222)],'attribute':typeof _0x2ad7a3[_0x1e59f2(0x1a4)]===_0x1e59f2(0x152)?_0x2ad7a3[_0x1e59f2(0x1a4)]:undefined,'behavior':typeof _0x2ad7a3[_0x1e59f2(0x12a)]===_0x1e59f2(0x152)?_0x2ad7a3['behavior']:undefined,'enriched':_0x2ad7a3['enriched']}),_0x42593c[_0x1e59f2(0x10e)]?0x0:0x1;}async['displayPreviewResults'](_0x528ec6,_0x42c726){const _0x5533ed=a22_0x105c40;console[_0x5533ed(0x14d)]('\x0a'+a22_0x8803e3[_0x5533ed(0x165)]('Preview:')+'\x20'+_0x528ec6[_0x5533ed(0x158)]),console['error']('═'['repeat'](0x3c));if(_0x42c726[_0x5533ed(0x222)]&&_0x528ec6[_0x5533ed(0x208)]){const _0x44575f=a22_0x8803e3['dim'](_0x5533ed(0x194))+'\x20'+a22_0x8803e3[_0x5533ed(0x165)](_0x528ec6[_0x5533ed(0x222)][_0x5533ed(0x19c)]+'.'+_0x528ec6[_0x5533ed(0x222)]['table']);await this[_0x5533ed(0x1a8)](_0x44575f,_0x528ec6['sampleData']);}else{if(_0x42c726[_0x5533ed(0x1a4)]&&_0x528ec6['sampleData']){const _0x3a5410=a22_0x8803e3['dim'](_0x5533ed(0x17f))+'\x20'+a22_0x8803e3[_0x5533ed(0x165)](_0x42c726[_0x5533ed(0x1a4)]);await this['displaySampleData'](_0x3a5410,_0x528ec6[_0x5533ed(0x208)]);}else{if(_0x42c726[_0x5533ed(0x12a)]&&_0x528ec6[_0x5533ed(0x208)]){const _0x539d81=a22_0x8803e3[_0x5533ed(0x17d)](_0x5533ed(0x1f4))+'\x20'+a22_0x8803e3[_0x5533ed(0x165)](_0x42c726[_0x5533ed(0x12a)]);await this[_0x5533ed(0x1a8)](_0x539d81,_0x528ec6['sampleData']);}else{if(_0x42c726['enriched']&&_0x528ec6[_0x5533ed(0x208)]){const _0x1a494d=a22_0x8803e3['dim']('Enriched:')+'\x20'+a22_0x8803e3[_0x5533ed(0x165)](_0x5533ed(0x126));await this[_0x5533ed(0x1a8)](_0x1a494d,_0x528ec6['sampleData']);}else!_0x528ec6[_0x5533ed(0x208)]&&console['error'](_0x5533ed(0x1b7));}}}if(_0x528ec6[_0x5533ed(0xdf)]['length']>0x0){console['error']('─'[_0x5533ed(0x1bf)](0x3c)),console[_0x5533ed(0x14d)]('\x0a'+a22_0x8803e3[_0x5533ed(0x192)](_0x5533ed(0x1a6)));for(const _0x5af34a of _0x528ec6[_0x5533ed(0xdf)]){console[_0x5533ed(0x14d)]('\x20\x20'+a22_0x8803e3[_0x5533ed(0x192)]('•')+'\x20'+_0x5af34a);}}}async['displaySampleData'](_0x40b5e9,_0x591eee){const _0x2b1a0a=a22_0x105c40;if(_0x591eee[_0x2b1a0a(0x153)]===0x0){console[_0x2b1a0a(0x14d)]('\x0a'+_0x40b5e9),console[_0x2b1a0a(0x14d)](_0x2b1a0a(0x1c2));return;}console['error']('\x0a'+_0x40b5e9);const _0x1e39c8=Object[_0x2b1a0a(0x11f)](_0x591eee[0x0])[_0x2b1a0a(0x14b)](_0x17046c=>({'name':_0x17046c,'type':typeof _0x591eee[0x0][_0x17046c]===_0x2b1a0a(0x263)?_0x2b1a0a(0xf8):_0x2b1a0a(0x1e9)})),_0x9f2b77={'queryId':_0x2b1a0a(0x181),'columns':_0x1e39c8,'data':_0x591eee,'stats':{'state':_0x2b1a0a(0xf0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x591eee['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2a68a1=formatAsTable(_0x9f2b77,_0x591eee[_0x2b1a0a(0x153)],!![]);await writeOutput(_0x2a68a1,undefined,_0x2b1a0a(0x1c9));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x1d7);[a22_0x105c40(0x135)]=a22_0x105c40(0x15a);async['execute'](_0x1a46de){const _0x42ca9b=a22_0x105c40,{options:_0x19cd93,args:_0x31c95e,tdx:_0x590c4f}=_0x1a46de,_0x5b8793=_0x19cd93,_0x30b613=_0x31c95e[0x0]||_0x19cd93[_0x42ca9b(0x15f)];if(!_0x30b613)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'+_0x42ca9b(0x151)),0x1;const _0x294708=resolveYamlFile(_0x30b613);if(existsSync(_0x294708)){_0x5b8793[_0x42ca9b(0x16b)]&&console[_0x42ca9b(0x14d)](_0x42ca9b(0x1c1)+_0x294708);let _0x4a2e6b;try{_0x4a2e6b=readFileSync(_0x294708,'utf-8');}catch(_0x13deb5){const _0x5cb4a1=_0x13deb5 instanceof Error?_0x13deb5[_0x42ca9b(0x1d1)]:String(_0x13deb5);return console[_0x42ca9b(0x14d)](_0x42ca9b(0xe6)+_0x5cb4a1),0x1;}const _0x5516e5=await withSpinner(_0x42ca9b(0x182),()=>_0x590c4f[_0x42ca9b(0x21b)]['pushParentYaml'](_0x4a2e6b),{'verbose':_0x5b8793[_0x42ca9b(0x16b)]}),_0x89fa0=_0x5516e5[_0x42ca9b(0x143)],{isNew:_0x43fff1,name:_0x1b5a6a,hasChanges:_0x2dc77a,diffFormatted:_0x29b2d7}=_0x89fa0;if(_0x2dc77a){_0x43fff1?console[_0x42ca9b(0x14d)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1b5a6a+'\x27:'):console['error'](_0x42ca9b(0x226)+_0x1b5a6a+'\x27:');console[_0x42ca9b(0x14d)]('─'[_0x42ca9b(0x1bf)](0x3c)),console[_0x42ca9b(0x14d)](_0x29b2d7),console['error']('─'[_0x42ca9b(0x1bf)](0x3c));const _0x514c8e=_0x43fff1?'Create\x20parent\x20segment\x20\x27'+_0x1b5a6a+_0x42ca9b(0x1df):_0x42ca9b(0x1bb)+_0x1b5a6a+_0x42ca9b(0x1df);if(!_0x5b8793[_0x42ca9b(0x12c)]){if(!isInteractive())return console['error'](a22_0x8803e3[_0x42ca9b(0x192)](_0x42ca9b(0x20e)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x42ca9b(0x14d)](a22_0x8803e3[_0x42ca9b(0x17d)](_0x42ca9b(0x1e2))),0x1;const _0x36ada4=await confirmKey(_0x514c8e);if(!_0x36ada4)return console[_0x42ca9b(0x14d)](a22_0x8803e3['yellow']('Aborted.')),0x1;}const _0x5e2321=_0x43fff1?_0x42ca9b(0x176):_0x42ca9b(0x225);await withSpinner(_0x5e2321+_0x42ca9b(0x15b)+_0x1b5a6a+'\x27...',()=>_0x89fa0['apply'](),{'verbose':_0x5b8793[_0x42ca9b(0x16b)]});const _0x59e309=_0x43fff1?_0x42ca9b(0x1cc):'Updated';console['error']('✔\x20'+_0x59e309+_0x42ca9b(0x15b)+_0x1b5a6a+'\x27');}else console[_0x42ca9b(0x14d)](_0x42ca9b(0x1e8)+_0x1b5a6a+'\x27\x20is\x20up\x20to\x20date');}const _0x1ec02e=await withSpinner(_0x42ca9b(0x140)+_0x30b613+'\x27...',()=>_0x590c4f[_0x42ca9b(0x21b)]['runParent'](_0x30b613),{'verbose':_0x5b8793[_0x42ca9b(0x16b)]}),_0x382987=_0x1ec02e['data'],_0x3662db=getConsoleUrl(_0x5b8793[_0x42ca9b(0x241)],_0x42ca9b(0x193)+_0x382987[_0x42ca9b(0x147)]+_0x42ca9b(0x262)+_0x382987['workflowSessionId']+'/attempt/'+_0x382987[_0x42ca9b(0x19b)]);return console[_0x42ca9b(0x14d)](_0x42ca9b(0x111)),console[_0x42ca9b(0x14d)]('\x20\x20'+a22_0x8803e3[_0x42ca9b(0x17d)]('Audience\x20ID:')+'\x20'+_0x382987[_0x42ca9b(0x171)]),console['error']('\x20\x20'+a22_0x8803e3[_0x42ca9b(0x17d)](_0x42ca9b(0x24c))+'\x20'+_0x382987['status']),console[_0x42ca9b(0x14d)]('\x20\x20'+a22_0x8803e3['dim'](_0x42ca9b(0x25b))+'\x20'+_0x382987[_0x42ca9b(0x22d)]),console[_0x42ca9b(0x14d)]('\x20\x20'+a22_0x8803e3[_0x42ca9b(0x17d)](_0x42ca9b(0x23a))+'\x20'+_0x382987[_0x42ca9b(0x19b)]),console[_0x42ca9b(0x14d)]('\x20\x20'+_0x3662db),console[_0x42ca9b(0x14d)]('\x0a'+a22_0x8803e3[_0x42ca9b(0x17d)](_0x42ca9b(0x1be))+_0x42ca9b(0x160)+_0x382987['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x1d9);[a22_0x105c40(0x135)]=a22_0x105c40(0x23d);async[a22_0x105c40(0x187)](_0xd605d7){const _0xcd008c=a22_0x105c40,{options:_0x11183a,args:_0x2de36b,tdx:_0x9696f4}=_0xd605d7,_0x3e75f2=_0x2de36b[0x0]||_0x11183a[_0xcd008c(0x15f)];if(!_0x3e75f2)return showParentSegmentNotSetError(_0xcd008c(0x21c)+_0xcd008c(0x132)),0x1;_0x11183a['verbose']&&(console[_0xcd008c(0x14d)](_0xcd008c(0x14a)+_0x11183a[_0xcd008c(0x241)]),console[_0xcd008c(0x14d)](_0xcd008c(0x150)+_0x3e75f2));const _0x2c8f46=await withSpinner(_0xcd008c(0x103)+_0x3e75f2+_0xcd008c(0x175),()=>_0x9696f4[_0xcd008c(0x21b)][_0xcd008c(0x1fc)](_0x3e75f2),{'verbose':_0x11183a['verbose']}),_0x101a01=_0x2c8f46[_0xcd008c(0x143)];console[_0xcd008c(0x14d)](_0xcd008c(0x217)+_0x101a01[_0xcd008c(0x153)]+_0xcd008c(0x121)+(_0x101a01['length']!==0x1?'s':''));if(_0x11183a['json']||_0x11183a[_0xcd008c(0x180)])return await handleSDKOutput(_0x101a01,_0x11183a),0x0;return displayFieldsHumanReadable(_0x101a01,_0x3e75f2),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x105c40(0x158)]='segment:parent:view';[a22_0x105c40(0x135)]=a22_0x105c40(0x1e5);async[a22_0x105c40(0x187)](_0x34d333){const _0xf597cb=a22_0x105c40,{options:_0x1b9cb6,args:_0x14d5ff,tdx:_0x3b1e58}=_0x34d333,_0x3c36c0=_0x1b9cb6,_0x3c3901=_0x14d5ff[0x0]||_0x1b9cb6[_0xf597cb(0x15f)];if(!_0x3c3901)return showParentSegmentNotSetError(_0xf597cb(0x1ae)+_0xf597cb(0x13a)+_0xf597cb(0x148)+_0xf597cb(0x224)),0x1;_0x1b9cb6[_0xf597cb(0x16b)]&&(console[_0xf597cb(0x14d)](_0xf597cb(0x14a)+_0x1b9cb6[_0xf597cb(0x241)]),console[_0xf597cb(0x14d)](_0xf597cb(0x150)+_0x3c3901));const _0x443e75=await withSpinner(_0xf597cb(0x210)+_0x3c3901+_0xf597cb(0x175),()=>_0x3b1e58[_0xf597cb(0x21b)][_0xf597cb(0x1a5)](_0x3c3901),{'verbose':_0x1b9cb6[_0xf597cb(0x16b)]}),_0x44c236=_0x443e75[_0xf597cb(0x143)];if(_0x3c36c0[_0xf597cb(0x1c5)]){const _0x36b915=getConsoleNextUrl(_0x3c36c0['site'],_0xf597cb(0x1f6)+_0x44c236['id']);return console[_0xf597cb(0x14d)](a22_0x8803e3[_0xf597cb(0x1c8)]('✔')+'\x20Opening\x20'+a22_0x8803e3[_0xf597cb(0x22f)](_0x36b915)),openBrowser(_0x36b915),0x0;}return await handleSingleObjectOutput(_0x44c236,_0x1b9cb6),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x197);[a22_0x105c40(0x135)]=a22_0x105c40(0x130);async[a22_0x105c40(0x187)](_0x265880){const _0x54dc30=a22_0x105c40,{options:_0x58f327,args:_0x235bbf,tdx:_0x1b9f55}=_0x265880,_0x2d75b8=_0x58f327,_0x1a306f=_0x235bbf[0x0]||_0x58f327[_0x54dc30(0x15f)];if(!_0x1a306f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+_0x54dc30(0x129)+'Options:\x0a'+_0x54dc30(0x198)),0x1;_0x58f327[_0x54dc30(0x16b)]&&(console[_0x54dc30(0x14d)](_0x54dc30(0x14a)+_0x58f327[_0x54dc30(0x241)]),console[_0x54dc30(0x14d)]('Parent\x20segment:\x20'+_0x1a306f));const _0x5fec68=await withSpinner(_0x54dc30(0x1ed)+_0x1a306f+_0x54dc30(0x175),()=>_0x1b9f55[_0x54dc30(0x21b)][_0x54dc30(0x229)](_0x1a306f),{'verbose':_0x58f327[_0x54dc30(0x16b)]}),_0x1fce01=_0x5fec68[_0x54dc30(0x143)],_0x3238d1=_0x1b9f55[_0x54dc30(0x21b)][_0x54dc30(0xfc)](_0x1fce01);if(_0x2d75b8[_0x54dc30(0x16f)]){const _0x49911d=await this[_0x54dc30(0x1f7)](_0x265880,_0x1a306f,_0x1fce01,_0x3238d1),_0x198740=this[_0x54dc30(0x131)](_0x49911d);writeFileSync(_0x2d75b8[_0x54dc30(0x16f)],_0x198740);const _0xe9b4de=_0x49911d[_0x54dc30(0x22c)][_0x54dc30(0x100)][_0x54dc30(0x153)]+_0x49911d[_0x54dc30(0x122)][_0x54dc30(0x22a)]((_0x22be80,_0x728bcc)=>_0x22be80+_0x728bcc['columns'][_0x54dc30(0x153)],0x0),_0x70c42e=_0x49911d[_0x54dc30(0x122)][_0x54dc30(0x1b2)](_0x4f33ce=>_0x4f33ce[_0x54dc30(0x100)][_0x54dc30(0x153)]===0x0)[_0x54dc30(0x153)];return console[_0x54dc30(0x23c)](_0x54dc30(0x215)+_0x2d75b8[_0x54dc30(0x16f)]),console[_0x54dc30(0x23c)](_0x54dc30(0x13d)+_0x3238d1),console[_0x54dc30(0x23c)](_0x54dc30(0x243)+_0x49911d[_0x54dc30(0x122)][_0x54dc30(0x153)]+_0x54dc30(0x1e7)),console['log']('\x20\x20Columns:\x20'+_0xe9b4de+_0x54dc30(0x114)),_0x70c42e>0x0&&console[_0x54dc30(0x23c)](_0x54dc30(0x1c0)+_0x70c42e+_0x54dc30(0x1f8)),0x0;}console[_0x54dc30(0x14d)]('\x0a'+a22_0x8803e3[_0x54dc30(0x165)](_0x54dc30(0xf2))+'\x20'+a22_0x8803e3[_0x54dc30(0x22f)](_0x3238d1));const _0x4c799c=await withSpinner(_0x54dc30(0x253),()=>_0x1b9f55[_0x54dc30(0x21b)][_0x54dc30(0xeb)](_0x1fce01),{'verbose':_0x58f327[_0x54dc30(0x16b)]});console[_0x54dc30(0x14d)]('\x0a'+a22_0x8803e3[_0x54dc30(0x165)](_0x54dc30(0x22c))+'\x20'+a22_0x8803e3[_0x54dc30(0x17d)]('('+_0x3238d1+_0x54dc30(0x1b6)));const _0x4e25b7=await executeSchemaQuery(_0x4c799c['data'],_0x1b9f55,_0x58f327);await handleQueryOutput(_0x4e25b7,_0x58f327);const _0x5434f2=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x1b9f55[_0x54dc30(0x21b)][_0x54dc30(0x223)](_0x1fce01),{'verbose':_0x58f327['verbose']});for(const _0x282404 of _0x5434f2[_0x54dc30(0x143)]){const _0x5cbbf5=_0x54dc30(0x23e)+_0x282404[_0x54dc30(0xe9)]()[_0x54dc30(0xf5)](/\s+/g,'_'),_0x117f5b='SELECT\x20*\x20FROM\x20'+_0x3238d1+'.'+_0x5cbbf5;console[_0x54dc30(0x14d)]('\x0a'+a22_0x8803e3[_0x54dc30(0x165)](_0x282404)+'\x20'+a22_0x8803e3[_0x54dc30(0x17d)]('('+_0x3238d1+'.'+_0x5cbbf5+')'));try{const _0x1b80fd=await executeSchemaQuery(_0x117f5b,_0x1b9f55,_0x58f327);await handleQueryOutput(_0x1b80fd,_0x58f327);}catch{console['error'](a22_0x8803e3['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x105c40(0x1f7)](_0x10d9da,_0xb76b37,_0x59a044,_0xdb5c8d){const _0x2dc37c=a22_0x105c40,{options:_0x111233,tdx:_0x5a5c89}=_0x10d9da,_0x51777=await withSpinner(_0x2dc37c(0x253),()=>_0x5a5c89[_0x2dc37c(0x21b)]['getParentSQL'](_0x59a044),{'verbose':_0x111233[_0x2dc37c(0x16b)]}),_0x521a74=await executeSchemaQuery(_0x51777['data'],_0x5a5c89,_0x111233),_0x2bff6b=_0x521a74['data'][_0x2dc37c(0x14b)](_0x26e135=>({'name':_0x26e135[_0x2dc37c(0xfa)],'type':_0x26e135[_0x2dc37c(0x10b)]})),_0x4aeaf1=await withSpinner(_0x2dc37c(0x15e),()=>_0x5a5c89[_0x2dc37c(0x21b)][_0x2dc37c(0x223)](_0x59a044),{'verbose':_0x111233[_0x2dc37c(0x16b)]}),_0x555ec6=[];for(const _0x2741c8 of _0x4aeaf1[_0x2dc37c(0x143)]){const _0x3dbbc9=_0x2dc37c(0x23e)+_0x2741c8[_0x2dc37c(0xe9)]()[_0x2dc37c(0xf5)](/\s+/g,'_'),_0x5e2c3f='SELECT\x20*\x20FROM\x20'+_0xdb5c8d+'.'+_0x3dbbc9;let _0x1e624d=[];try{const _0x56fee4=await executeSchemaQuery(_0x5e2c3f,_0x5a5c89,_0x111233);_0x1e624d=_0x56fee4[_0x2dc37c(0x143)][_0x2dc37c(0x14b)](_0x1e0c6e=>({'name':_0x1e0c6e[_0x2dc37c(0xfa)],'type':_0x1e0c6e[_0x2dc37c(0x10b)]}));}catch{}_0x555ec6[_0x2dc37c(0x195)]({'table':_0x3dbbc9,'columns':_0x1e624d});}return{'database':_0xdb5c8d,'parent_segment':_0xb76b37,'parent_id':_0x59a044,'customers':{'table':_0x2dc37c(0x22c),'columns':_0x2bff6b},'behaviors':_0x555ec6};}[a22_0x105c40(0x131)](_0x53ef8c){const _0xa9ca4b=a22_0x105c40,_0x27d4da=_0xf03d69=>{const _0x1828e1=a22_0x35d2;if(_0xf03d69[_0x1828e1(0x153)]===0x0)return'[]';const _0x5f4a89=_0xf03d69[_0x1828e1(0x14b)](_0x45fc0f=>_0x1828e1(0x1f2)+_0x45fc0f['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x45fc0f['type']+_0x1828e1(0x1d8));return'[\x0a'+_0x5f4a89[_0x1828e1(0x118)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x1c52e0=_0x53ef8c[_0xa9ca4b(0x122)]['map'](_0xe6f4e4=>{const _0x323911=_0xa9ca4b;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0xe6f4e4[_0x323911(0x1c9)]+_0x323911(0x20d)+_0x27d4da(_0xe6f4e4[_0x323911(0x100)])['replace'](/^/gm,'\x20\x20')[_0x323911(0x19f)]()+_0x323911(0x221);})['join'](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x53ef8c['database']+_0xa9ca4b(0x219)+_0x53ef8c[_0xa9ca4b(0xee)]+_0xa9ca4b(0x257)+_0x53ef8c[_0xa9ca4b(0x106)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x53ef8c['customers'][_0xa9ca4b(0x1c9)]+_0xa9ca4b(0x14e)+_0x27d4da(_0x53ef8c[_0xa9ca4b(0x22c)][_0xa9ca4b(0x100)])[_0xa9ca4b(0xf5)](/^/gm,'\x20\x20')[_0xa9ca4b(0x19f)]()+_0xa9ca4b(0x1fb)+_0x1c52e0+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x173);[a22_0x105c40(0x135)]=a22_0x105c40(0x156);async['execute'](_0x54ef94){const _0x3f35ff=a22_0x105c40,{options:_0x408dd0,args:_0x2a06f5,tdx:_0x5c4e63}=_0x54ef94,_0x5862af=_0x2a06f5[0x0]||_0x408dd0[_0x3f35ff(0x15f)];if(!_0x5862af)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'+_0x3f35ff(0x1b4)),0x1;_0x408dd0[_0x3f35ff(0x16b)]&&(console[_0x3f35ff(0x14d)](_0x3f35ff(0x14a)+_0x408dd0[_0x3f35ff(0x241)]),console[_0x3f35ff(0x14d)](_0x3f35ff(0x150)+_0x5862af));const _0x46f6c9=await withSpinner(_0x3f35ff(0x1ed)+_0x5862af+'\x27...',()=>_0x5c4e63[_0x3f35ff(0x21b)]['resolveParentId'](_0x5862af),{'verbose':_0x408dd0[_0x3f35ff(0x16b)]}),_0xdbab83=_0x46f6c9['data'],_0x2467f6=await withSpinner(_0x3f35ff(0x161)+_0x5862af+_0x3f35ff(0x175),()=>_0x5c4e63[_0x3f35ff(0x21b)]['getParentSQL'](_0xdbab83),{'verbose':_0x408dd0[_0x3f35ff(0x16b)]}),_0xf99e63=_0x2467f6['data'];return _0x408dd0[_0x3f35ff(0x259)]===_0x3f35ff(0x136)||_0x408dd0[_0x3f35ff(0x259)]===_0x3f35ff(0x180)?await handleSDKOutput([{'sql':_0xf99e63}],_0x408dd0):console['log'](_0xf99e63),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x105c40(0x158)]='segment:parent:show';[a22_0x105c40(0x135)]=a22_0x105c40(0x1e3);async['execute'](_0x418363){const _0x3720c4=a22_0x105c40,{options:_0xb3a6c7,args:_0x3d77a0,tdx:_0x1b4911}=_0x418363,_0x50d81e=_0x3d77a0[0x0]||_0xb3a6c7[_0x3720c4(0x15f)];if(!_0x50d81e)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'+_0x3720c4(0x230)),0x1;_0xb3a6c7[_0x3720c4(0x16b)]&&(console[_0x3720c4(0x14d)]('Site:\x20'+_0xb3a6c7[_0x3720c4(0x241)]),console['error']('Parent\x20segment:\x20'+_0x50d81e));const _0x4c8e00=await withSpinner(_0x3720c4(0x1ed)+_0x50d81e+_0x3720c4(0x175),()=>_0x1b4911[_0x3720c4(0x21b)][_0x3720c4(0x229)](_0x50d81e),{'verbose':_0xb3a6c7['verbose']}),_0x90e20c=_0x4c8e00['data'],_0x8556ee=await withSpinner(_0x3720c4(0x161)+_0x50d81e+_0x3720c4(0x175),()=>_0x1b4911[_0x3720c4(0x21b)][_0x3720c4(0xeb)](_0x90e20c),{'verbose':_0xb3a6c7['verbose']});let _0x5381ab=_0x8556ee[_0x3720c4(0x143)];const _0x2b636a=resolveLimit(_0xb3a6c7[_0x3720c4(0x18c)],DEFAULT_DISPLAY_LIMIT),_0x363ecf=/\bLIMIT\s+\d+/i[_0x3720c4(0x178)](_0x5381ab);!_0x363ecf&&(_0x5381ab=_0x5381ab[_0x3720c4(0x19f)]()[_0x3720c4(0xf5)](/;+$/,''),_0x5381ab='SELECT\x20*\x20FROM\x20(\x0a'+_0x5381ab+_0x3720c4(0x255)+_0x2b636a);_0xb3a6c7['verbose']&&console[_0x3720c4(0x14d)](_0x3720c4(0x169)+_0x5381ab);const _0x2cdfb2=await withProgressSpinner(_0x3720c4(0x260),async _0x3547b3=>{const _0x2fbadb=_0x3720c4,_0x2e5186=await _0x1b4911[_0x2fbadb(0x24d)]['execute'](_0x5381ab,{'catalog':'td','schema':_0x2fbadb(0x1dc),'onJobId':_0x6b24b7=>{_0x3547b3['setJobId'](_0x6b24b7);}});return _0x2e5186;},{'verbose':_0xb3a6c7[_0x3720c4(0x16b)]}),_0xba31=_0x2cdfb2[_0x3720c4(0x143)],_0xdca338=_0xba31[_0x3720c4(0x12d)]?'\x20[Job\x20ID:\x20'+_0xba31['jobId']+']':'';return console[_0x3720c4(0x14d)](_0x3720c4(0x1a9)+_0xba31['stats']['processedRows'][_0x3720c4(0x159)]()+_0x3720c4(0x20c)+(_0x3720c4(0x112)+formatElapsed(_0xba31[_0x3720c4(0x123)][_0x3720c4(0x1e4)])+_0xdca338)),await handleQueryOutput(_0xba31,_0xb3a6c7),0x0;}}export class PSRtListCommand extends BaseCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x17b);[a22_0x105c40(0x135)]=a22_0x105c40(0x1f3);async['execute'](_0xf7433e){const _0x4da230=a22_0x105c40,{options:_0x183b6d,args:_0x16e432,tdx:_0x29d20b}=_0xf7433e,_0x3908b6=_0x16e432[0x0],_0x261b82=await withSpinner(_0x3908b6?_0x4da230(0x1d0)+_0x3908b6+_0x4da230(0x175):_0x4da230(0x24e),()=>_0x29d20b[_0x4da230(0x172)][_0x4da230(0x191)](),{'verbose':_0x183b6d[_0x4da230(0x16b)]});let _0x2f25e7=_0x261b82['data'][_0x4da230(0x1b2)](_0x173299=>_0x173299[_0x4da230(0x1aa)]);if(_0x3908b6){const _0x237464=_0x3908b6['replace'](/[.+^${}()|[\]\\]/g,_0x4da230(0x252))[_0x4da230(0xf5)](/\*/g,'.*')[_0x4da230(0xf5)](/\?/g,'.'),_0x4e1b8f=new RegExp('^'+_0x237464+'$','i');_0x2f25e7=_0x2f25e7['filter'](_0x44dec9=>_0x4e1b8f['test'](_0x44dec9[_0x4da230(0x158)]));}_0x2f25e7[_0x4da230(0x109)]((_0x5aa429,_0x10c98c)=>_0x5aa429[_0x4da230(0x158)][_0x4da230(0x235)](_0x10c98c[_0x4da230(0x158)])),console[_0x4da230(0x14d)](_0x4da230(0x217)+_0x2f25e7[_0x4da230(0x153)]+'\x20RT-enabled\x20parent\x20segment'+(_0x2f25e7[_0x4da230(0x153)]!==0x1?'s':''));const _0x557b0a=_0x26f9bd=>{const _0x496a55=_0x4da230;return getConsoleNextUrl(_0x183b6d[_0x496a55(0x241)],_0x496a55(0x1f6)+_0x26f9bd);};if(_0x183b6d[_0x4da230(0x259)]==='json'||_0x183b6d[_0x4da230(0x259)]===_0x4da230(0x180)){const _0xc98a93=_0x2f25e7[_0x4da230(0x14b)](_0x20fcb9=>({..._0x20fcb9,'url':_0x557b0a(_0x20fcb9['id'])}));await handleSDKOutput(_0xc98a93,_0x183b6d);}else{if(_0x2f25e7['length']===0x0)console[_0x4da230(0x23c)](_0x4da230(0x1ea));else for(const _0x4d389f of _0x2f25e7){const _0x2a55d9=_0x4d389f[_0x4da230(0x1c6)]?a22_0x8803e3[_0x4da230(0x17d)]('\x20('+formatRows(_0x4d389f[_0x4da230(0x1c6)])+')'):'',_0x154f03=hyperlink(_0x4d389f['name'],_0x557b0a(_0x4d389f['id']));console[_0x4da230(0x23c)]('⚡\x20'+_0x154f03+_0x2a55d9);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x21e);[a22_0x105c40(0x135)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async['execute'](_0x314cf9){const _0x49abf1=a22_0x105c40,{options:_0x34e046,args:_0x888ae9,tdx:_0x480e48}=_0x314cf9,_0x37cb8c=_0x888ae9[0x0]||_0x34e046[_0x49abf1(0x15f)];if(!_0x37cb8c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+_0x49abf1(0x15d)),0x1;const _0x41752e=resolveYamlFile(_0x37cb8c);if(!existsSync(_0x41752e))return showFileNotFoundError(_0x41752e,_0x37cb8c),0x1;let _0x372e01;try{_0x372e01=readFileSync(_0x41752e,_0x49abf1(0x189));}catch(_0x19ec6b){const _0x231224=_0x19ec6b instanceof Error?_0x19ec6b[_0x49abf1(0x1d1)]:String(_0x19ec6b);return console[_0x49abf1(0x14d)](_0x49abf1(0xe6)+_0x231224),0x1;}const _0x2a30cf=createCommandSpinner(a22_0x8803e3['dim']('Validating\x20RT\x20configuration...'),{'verbose':_0x34e046[_0x49abf1(0x16b)]});_0x2a30cf[_0x49abf1(0x1cf)]();const _0xdf43d={'realtime':!![],'onProgress':_0x50aaff=>{const _0x34494c=_0x49abf1;_0x2a30cf[_0x34494c(0x25e)]=formatProgressMessage(_0x50aaff);}};let _0x20b19b;try{_0x20b19b=await _0x480e48[_0x49abf1(0x21b)][_0x49abf1(0x177)](_0x372e01,_0xdf43d),_0x2a30cf['stop']();}catch(_0x4d1db3){_0x2a30cf[_0x49abf1(0x21d)]();throw _0x4d1db3;}console[_0x49abf1(0x14d)]('\x0a'+a22_0x8803e3['bold'](_0x49abf1(0x14f))+'\x20'+_0x20b19b[_0x49abf1(0x158)]),console[_0x49abf1(0x14d)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x20b19b),console['error']('─'[_0x49abf1(0x1bf)](0x3c));if(_0x20b19b['errors']['length']>0x0){console['error']('\x0a'+a22_0x8803e3[_0x49abf1(0x192)](_0x49abf1(0x1a6)));for(const _0x378cad of _0x20b19b[_0x49abf1(0xdf)]){console['error']('\x20\x20'+a22_0x8803e3[_0x49abf1(0x192)]('•')+'\x20'+_0x378cad);}}return _0x20b19b[_0x49abf1(0x10e)]&&console['error']('\x0a'+a22_0x8803e3[_0x49abf1(0x1c8)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x20b19b[_0x49abf1(0x10e)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x105c40(0x158)]='ps:pz:list';['description']=a22_0x105c40(0x1b3);async[a22_0x105c40(0x187)](_0x3ae7aa){const _0x26c1dc=a22_0x105c40,{options:_0x3fa9a5,args:_0x3c9263,tdx:_0x2836b9}=_0x3ae7aa,_0x2b8254=_0x3c9263[0x0]||_0x3fa9a5[_0x26c1dc(0x15f)];if(!_0x2b8254)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x4c4479=await withSpinner(_0x26c1dc(0x1ed)+_0x2b8254+_0x26c1dc(0x175),()=>_0x2836b9['segment'][_0x26c1dc(0x229)](_0x2b8254),{'verbose':_0x3fa9a5[_0x26c1dc(0x16b)]}),_0x56284d=_0x4c4479[_0x26c1dc(0x143)],_0x59a7aa=await withSpinner(_0x26c1dc(0x1b9)+_0x2b8254+_0x26c1dc(0x175),()=>_0x2836b9['personalization'][_0x26c1dc(0x191)](_0x56284d),{'verbose':_0x3fa9a5[_0x26c1dc(0x16b)]}),_0x48fe8b=_0x59a7aa[_0x26c1dc(0x143)];console[_0x26c1dc(0x14d)](_0x26c1dc(0x217)+_0x48fe8b[_0x26c1dc(0x153)]+_0x26c1dc(0x1fd)+(_0x48fe8b['length']!==0x1?'s':''));if(_0x3fa9a5[_0x26c1dc(0x259)]===_0x26c1dc(0x136)||_0x3fa9a5[_0x26c1dc(0x259)]===_0x26c1dc(0x180))await handleSDKOutput(_0x48fe8b,_0x3fa9a5);else{if(_0x48fe8b['length']===0x0)console['log'](_0x26c1dc(0x232)),console[_0x26c1dc(0x14d)](a22_0x8803e3[_0x26c1dc(0x22f)](_0x26c1dc(0x1ad)));else for(const _0x4f9319 of _0x48fe8b){const _0xd9c82a=_0x4f9319['sections']?.[_0x26c1dc(0x153)]||0x0,_0x49f13e=_0x4f9319[_0x26c1dc(0x24b)]?a22_0x8803e3[_0x26c1dc(0x17d)](_0x26c1dc(0x258)+_0x4f9319[_0x26c1dc(0x24b)]):'',_0x18bbc1=a22_0x8803e3[_0x26c1dc(0x17d)]('\x20('+_0xd9c82a+'\x20section'+(_0xd9c82a!==0x1?'s':'')+')');console[_0x26c1dc(0x23c)]('\x20\x20'+_0x4f9319['name']+_0x49f13e+_0x18bbc1),_0x4f9319[_0x26c1dc(0x135)]&&console['log'](_0x26c1dc(0x16a)+a22_0x8803e3['dim'](_0x4f9319['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x105c40(0x158)]=a22_0x105c40(0x23b);[a22_0x105c40(0x135)]=a22_0x105c40(0x13f);async[a22_0x105c40(0x187)](_0x9cd133){const _0x54b9d7=a22_0x105c40,{options:_0x3303d3,args:_0x2bd5fe}=_0x9cd133,_0x38b78a=_0x2bd5fe[0x0]||_0x3303d3[_0x54b9d7(0x15f)];if(!_0x38b78a)return showParentSegmentNotSetError(_0x54b9d7(0x127)+_0x54b9d7(0xf7)),0x1;const _0x5eb2af=resolveYamlFile(_0x38b78a);if(!existsSync(_0x5eb2af))return showFileNotFoundError(_0x5eb2af,_0x38b78a),0x1;let _0x456eb0;try{_0x456eb0=readFileSync(_0x5eb2af,_0x54b9d7(0x189));}catch(_0x4d6aea){const _0x258380=_0x4d6aea instanceof Error?_0x4d6aea['message']:String(_0x4d6aea);return console[_0x54b9d7(0x14d)](_0x54b9d7(0xe6)+_0x258380),0x1;}let _0x5a0b42;try{_0x5a0b42=parseDef(_0x456eb0);}catch(_0x57b718){const _0x1e7c76=_0x57b718 instanceof Error?_0x57b718[_0x54b9d7(0x1d1)]:String(_0x57b718);return console[_0x54b9d7(0x14d)](a22_0x8803e3[_0x54b9d7(0x192)](_0x54b9d7(0x13e)+_0x1e7c76)),0x1;}if(_0x5a0b42['personalization_services']&&_0x5a0b42[_0x54b9d7(0x12f)]['length']>0x0)return console[_0x54b9d7(0x14d)](a22_0x8803e3['yellow'](_0x54b9d7(0x265)+_0x5eb2af)),console[_0x54b9d7(0x14d)](a22_0x8803e3[_0x54b9d7(0x17d)](_0x54b9d7(0x22e)+_0x5a0b42['personalization_services'][_0x54b9d7(0x153)]+_0x54b9d7(0xff))),0x1;!_0x5a0b42[_0x54b9d7(0x172)]&&(_0x5a0b42['realtime']={'events':[{'name':_0x54b9d7(0x185),'source_table':_0x54b9d7(0x1c7)}],'attributes':[{'name':_0x54b9d7(0x207),'type':'single'}],'id_stitching':{'primary_key':_0x5a0b42[_0x54b9d7(0x222)]['table']==='customers'?_0x54b9d7(0x249):_0x54b9d7(0x1d6)}});_0x5a0b42['personalization_services']=[{'name':_0x54b9d7(0x1a1),'description':_0x54b9d7(0x199),'trigger_event':_0x54b9d7(0x185),'sections':[{'name':_0x54b9d7(0x216),'criteria':_0x54b9d7(0x1dd),'attributes':['last_page_viewed']}]}];const _0x2caa58=serializeDef(_0x5a0b42);return writeFileSync(_0x5eb2af,_0x2caa58,_0x54b9d7(0x189)),console[_0x54b9d7(0x14d)](a22_0x8803e3['green']('✔')+_0x54b9d7(0x261)+a22_0x8803e3[_0x54b9d7(0x22f)](_0x5eb2af)),(!_0x5a0b42[_0x54b9d7(0x172)]||_0x456eb0[_0x54b9d7(0x20a)](_0x54b9d7(0x1db))===-0x1)&&console[_0x54b9d7(0x14d)](a22_0x8803e3['green']('✔')+_0x54b9d7(0x1a7)),console[_0x54b9d7(0x14d)]('\x0a'+a22_0x8803e3[_0x54b9d7(0x17d)](_0x54b9d7(0xef))),console['error']('\x20\x201.\x20Edit\x20'+_0x5eb2af+_0x54b9d7(0x234)),console['error'](_0x54b9d7(0x1b0)+a22_0x8803e3['dim'](_0x54b9d7(0x209)+_0x38b78a)+_0x54b9d7(0x201)),0x0;}}
|
|
1
|
+
const a22_0x1bd28d=a22_0x212e;(function(_0x57c7ee,_0x5558cf){const _0x191a5e=a22_0x212e,_0x3074c7=_0x57c7ee();while(!![]){try{const _0x315566=-parseInt(_0x191a5e(0x33b))/0x1+parseInt(_0x191a5e(0x270))/0x2*(parseInt(_0x191a5e(0x24d))/0x3)+-parseInt(_0x191a5e(0x2c3))/0x4+-parseInt(_0x191a5e(0x254))/0x5+parseInt(_0x191a5e(0x2e5))/0x6+-parseInt(_0x191a5e(0x2b4))/0x7+parseInt(_0x191a5e(0x258))/0x8;if(_0x315566===_0x5558cf)break;else _0x3074c7['push'](_0x3074c7['shift']());}catch(_0x281cf9){_0x3074c7['push'](_0x3074c7['shift']());}}}(a22_0xcabe,0x6fd7b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x3399d5 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a22_0xcabe(){const _0x5206ab=['Error\x20reading\x20file:\x20','varchar','createParent','\x20section','page_view','apply','totalEvents','\x0aChanges\x20to\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20configured','customerPercent','Resolving\x20parent\x20segment\x20\x27','.yml','-1d','jobId','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','number','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','toLocaleString','/{name}.yml\x0a','To\x20cancel:','\x20=\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20-\x20','segment:parent:desc','scheduleType','Errors:','segment:parent:show','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','verbose','darwin','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','segment:parent:run','Error:\x20File\x20not\x20found:\x20','/\x20and\x20','true','pullParentYaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20tdx\x20wf\x20attempt\x20','double','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20Configuration\x20is\x20valid','parentSegment','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','matchedCount','Fetching\x20SQL\x20for\x20\x27','Available\x20behaviors:','To\x20view\x20sample\x20data:','yellow','✘\x20Failed\x20to\x20rename\x20directory:\x20','Attempt:','behaviors','getBehaviorNames','utf-8','Coverage:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','workflowSessionId','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20Opening\x20','Validating\x20RT\x20configuration...','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','localeCompare','sort','test','validateParentYaml','realtime:','last_page_viewed','\x20\x201.\x20Edit\x20','Creating\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22','realtime_enabled','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','segment:parent:create','status','Listing\x20parent\x20segments\x20matching\x20\x27','enriched','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','dim','RT\x202.0\x20Validate:','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','join','Listing\x20RT-enabled\x20parent\x20segments...','sections','displaySampleData','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x27\x20and\x20run\x20workflow?','displayPreviewHints','json','Listing\x20parent\x20segments...','\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','repeat','Enriched:','\x5c$&','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Fetching\x20customers\x20schema...','\x20Added\x20personalization\x20template\x20to\x20','xdg-open','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','/sessions/','dirname','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','/app/dw/parentSegments/','segment:parent:view','scheduleOption','Validate:','\x20personalization\x20service','coveragePercent','master','ID\x20Stitching:','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','replace','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','.yaml','No\x20personalization\x20services\x20configured','\x20\x20Columns:\x20','audienceId','Show\x20parent\x20segment\x20details','customerGroupFile','\x20service(s)\x20configured','stats','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','information_schema','resolveParentId','tdx\x20ps\x20push\x20','Options:\x0a','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','stop','behaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Join:','Error:','behavior_','displayRealtimeInfo','sourceTableError','{\x0a\x20\x20\x22database\x22:\x20\x22','FINISHED','displayColumns','\x20field','/\x20directories\x20exist.','Listing\x20personalization\x20services\x20for\x20\x27','td_client_id','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','push','Join\x20on:','toFixed','getParentFull','text','formatSchemaJson','foreignKey','trigger_event','Behaviors','web','personalization','Updating','string','open','personalization_services','jsonl','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','list','9591ZnuBEZ','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Preview:','attributesFile','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20service','4151010wHHAXS','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:validate','yes','14902448IpLjeo','List\x20available\x20fields\x20for\x20segmentation','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Updating\x20parent\x20segment\x20\x27','parent_id','Updated','displayBehaviorsStats','Fetching\x20parent\x20segment\x20\x27','addBehaviorsFile','column_type','all','Listing\x20fields\x20for\x20\x27','database','Parent\x20segment:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Audience\x20ID:','error','✔\x20Updated\x20parent\x20segment\x20\x27','site','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','format','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Status:','34hqqlNN','schemaValid','isDirectory','allValid','bold','\x20behaviors','listParents','in\x20','output','start','length','\x27\x20is\x20already\x20up\x20to\x20date','filter','YAML\x20file:\x20','No\x20RT-enabled\x20parent\x20segments\x20found','\x20to\x20configure\x20your\x20personalization\x20service','session','Error:\x20--behavior\x20requires\x20a\x20name\x0a','platform','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','/app/workflows/','red','Analyzing\x20changes...','endsWith','errors','addAttributesFile','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Database:\x20','timezone','/\x20→\x20','behavior','pushParentYaml','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','data','\x0a\x20\x20\x20\x20}','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20--enriched','Name:\x20','joinKey','stitchingKeys','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Personalization\x20service\x20description','`\x20to\x20download\x20the\x20configuration\x20first','Pattern:\x20','unref','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Fetching\x20behavior\x20list...','attributes','population','getParentSQL','Events:','Master\x20+\x20Attributes','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','\x20\x20No\x20sample\x20data\x20available','segment:parent:sql','personalizationServices','run','elapsedTimeMillis','column_name','user_id','\x20\x20\x20','\x20--attribute\x20\x22','Validating\x20configuration...','single','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20RT-enabled\x20parent\x20segment','events','\x20total','5243707DkTFKp','keys','\x20Added\x20RT\x202.0\x20template\x20section','\x20parent\x20segment\x20\x27','Available\x20attributes:','Error\x20parsing\x20YAML:\x20','\x20[Job\x20ID:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','limit','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Output\x20file:\x20','Executing\x20parent\x20segment\x20query...','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','SQL\x20query:\x0a','2709368mJRcar','parent_segments','\x27\x20is\x20up\x20to\x20date','SELECT\x20*\x20FROM\x20','ps:rt:list','\x20is\x20already\x20up\x20to\x20date','Attribute:','\x22\x20}','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Aborted.','rowCount','query','match','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','Creating','name','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20Note:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Output\x20Database:','ignore','cyan','\x20\x20\x20\x20','green','segment:parent:fields','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','RT\x202.0:','\x0aError:','\x27...','\x0aNew\x20parent\x20segment\x20\x27','Columns:','5451138efVKVr','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Overwrite\x20\x27','👥\x20','interval','getOutputDatabaseName','setJobId','displayPreviewResults','Table:\x20','Create\x20parent\x20segment\x20\x27','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','ps:pz:list','\x0a✔\x20Workflow\x20started','label','realtime','Next\x20steps:','enabled','collectSchema','<database>.<table>','attribute','List\x20parent\x20segments','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','tdx\x20ps\x20preview\x20','table','idStitching','\x20\x202.\x20Run\x20','description','log','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment','Master:','processedRows','trim','displaySummary','Rows:','/attempt/','displayMasterInfo','addBehaviors','segment:parent:update','✔\x20Created\x20parent\x20segment\x20\x27','indexOf','Source:','use','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','type','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20to\x20push\x20the\x20configuration','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','customerGroup','\x20rows\x20','using\x20the\x20default\x20path:\x20','updateParent','displayValidateResults','message','✔\x20Query\x20completed:\x20Processed\x20','\x0a⚠️\x20\x20Migrating:\x20','runParent','Created','\x20rows)','\x0a\x20\x20\x20\x20]','Schema\x20saved\x20to\x20','execute','Customers:','My\x20Service','customersWithEvents','Attributes','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','segment:parent:push','Session:','map','displayAttributesStats','Found\x20YAML\x20file:\x20','columns','✔\x20Found\x20','\x20\x20Database:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','column','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x27\x20with\x20ID:\x20','\x20No\x20changes\x20-\x20','parent_segment','ps:pz:init','Site:\x20','customers','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','110926moHkMC','Error:\x20Parent\x20segment\x20name\x20is\x20required','Attributes:','Apply\x20changes\x20to\x20\x27','workflowAttemptId','\x20\x20\x20\x20\x20\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','toLowerCase','schemaError'];a22_0xcabe=function(){return _0x5206ab;};return a22_0xcabe();}import a22_0x2af8d7 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_0x1bd28d(0x2c4),LEGACY_PARENT_SEGMENT_DIR=a22_0x1bd28d(0x336);function openBrowser(_0x429ef1){const _0x2dcfca=a22_0x1bd28d,_0x8429aa=process[_0x2dcfca(0x282)],_0x2aa373=_0x8429aa===_0x2dcfca(0x362)?_0x2dcfca(0x247):_0x8429aa==='win32'?_0x2dcfca(0x279):_0x2dcfca(0x209);spawn(_0x2aa373,[_0x429ef1],{'detached':!![],'stdio':_0x2dcfca(0x2da)})[_0x2dcfca(0x29c)]();}function migrateLegacyDirectory(){const _0xb76fd3=a22_0x1bd28d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x27f588=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x27f588[_0xb76fd3(0x272)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xb76fd3(0x268)](a22_0x2af8d7[_0xb76fd3(0x374)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0xb76fd3(0x366)+PARENT_SEGMENT_DIR+_0xb76fd3(0x235))),console[_0xb76fd3(0x268)](a22_0x2af8d7['dim'](_0xb76fd3(0x2d8)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0xb76fd3(0x268)](a22_0x2af8d7[_0xb76fd3(0x374)](_0xb76fd3(0x31d)+LEGACY_PARENT_SEGMENT_DIR+_0xb76fd3(0x28d)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0xb76fd3(0x268)](a22_0x2af8d7[_0xb76fd3(0x2dd)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2961d4){const _0x39f8c3=_0x2961d4 instanceof Error?_0x2961d4['message']:String(_0x2961d4);return console[_0xb76fd3(0x268)](a22_0x2af8d7[_0xb76fd3(0x285)](_0xb76fd3(0x375)+_0x39f8c3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x1bd28d(0x2a8)](_0x525f98){const _0x5ebb6e=a22_0x1bd28d;return migrateLegacyDirectory(),super[_0x5ebb6e(0x2a8)](_0x525f98);}}function resolveYamlFile(_0x1a0cff){const _0x46d8c5=a22_0x1bd28d;if(_0x1a0cff[_0x46d8c5(0x287)](_0x46d8c5(0x350))||_0x1a0cff[_0x46d8c5(0x287)](_0x46d8c5(0x21b)))return _0x1a0cff;return a22_0x3399d5[_0x46d8c5(0x1f9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a0cff)+_0x46d8c5(0x350));}function formatProgressMessage(_0x4ad302){const _0x369e1b=a22_0x1bd28d,_0x86e45=_0x4ad302[_0x369e1b(0x2d0)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x86e45){const [,_0x1589ab,_0x2f6dbd,_0x462287='']=_0x86e45;return a22_0x2af8d7[_0x369e1b(0x1f6)](_0x1589ab+':')+'\x20'+_0x2f6dbd+a22_0x2af8d7[_0x369e1b(0x1f6)](_0x462287);}return a22_0x2af8d7['dim'](_0x4ad302);}function showFileNotFoundError(_0x46327a,_0x57a943){const _0x47d5f4=a22_0x1bd28d;console[_0x47d5f4(0x268)](a22_0x2af8d7[_0x47d5f4(0x285)](_0x47d5f4(0x365)+_0x46327a+'\x0a')),console[_0x47d5f4(0x268)](a22_0x2af8d7['cyan'](_0x47d5f4(0x206)+_0x57a943+_0x47d5f4(0x29a)));}function displayRealtimeValidation(_0x4e76ef){const _0x505a41=a22_0x1bd28d;if(!_0x4e76ef[_0x505a41(0x2f4)])return;const _0x1357b0=_0x4e76ef[_0x505a41(0x2f4)],_0x27b267=_0x1357b0[_0x505a41(0x2f6)]?a22_0x2af8d7['green']('⚡\x20Enabled'):a22_0x2af8d7[_0x505a41(0x374)]('⚡\x20Not\x20enabled');console[_0x505a41(0x268)]('\x0a'+a22_0x2af8d7[_0x505a41(0x1f6)](_0x505a41(0x2e0))+'\x20'+_0x27b267);if(_0x1357b0[_0x505a41(0x2b2)]&&_0x1357b0[_0x505a41(0x2b2)][_0x505a41(0x27a)]>0x0){console['error']('\x20\x20'+a22_0x2af8d7[_0x505a41(0x1f6)](_0x505a41(0x2a2))+'\x20'+_0x1357b0[_0x505a41(0x2b2)][_0x505a41(0x27a)]+'\x20configured');for(const _0x41e9a5 of _0x1357b0['events']){const _0xd2919c=_0x41e9a5['sourceTableValid']===![]?a22_0x2af8d7[_0x505a41(0x285)]('✘'):a22_0x2af8d7[_0x505a41(0x2dd)]('✔');console[_0x505a41(0x268)](_0x505a41(0x2dc)+_0xd2919c+'\x20'+_0x41e9a5[_0x505a41(0x2d4)]),_0x41e9a5['sourceTableError']&&console[_0x505a41(0x268)](_0x505a41(0x340)+a22_0x2af8d7['red'](_0x41e9a5[_0x505a41(0x230)]));}}if(_0x1357b0[_0x505a41(0x29f)]&&_0x1357b0[_0x505a41(0x29f)]['length']>0x0){console[_0x505a41(0x268)]('\x20\x20'+a22_0x2af8d7[_0x505a41(0x1f6)](_0x505a41(0x33d))+'\x20'+_0x1357b0[_0x505a41(0x29f)][_0x505a41(0x27a)]+_0x505a41(0x34d));for(const _0x3ec63b of _0x1357b0[_0x505a41(0x29f)]){const _0x24cd8f=_0x3ec63b['valid']?a22_0x2af8d7[_0x505a41(0x2dd)]('✔'):a22_0x2af8d7[_0x505a41(0x285)]('✘');console[_0x505a41(0x268)](_0x505a41(0x2dc)+_0x24cd8f+'\x20'+_0x3ec63b[_0x505a41(0x2d4)]+'\x20'+a22_0x2af8d7[_0x505a41(0x1f6)]('('+_0x3ec63b[_0x505a41(0x312)]+')'));}}if(_0x1357b0[_0x505a41(0x2fe)]){const _0x5a95ab=_0x1357b0['idStitching'][_0x505a41(0x297)]?.[_0x505a41(0x27a)]?'\x20+\x20['+_0x1357b0[_0x505a41(0x2fe)]['stitchingKeys'][_0x505a41(0x1f9)](',\x20')+']':'';console['error']('\x20\x20'+a22_0x2af8d7[_0x505a41(0x1f6)](_0x505a41(0x216))+'\x20'+_0x1357b0['idStitching']['primaryKey']+_0x5a95ab);}if(_0x1357b0[_0x505a41(0x2a7)]&&_0x1357b0['personalizationServices'][_0x505a41(0x27a)]>0x0){console[_0x505a41(0x268)]('\x20\x20'+a22_0x2af8d7[_0x505a41(0x1f6)]('Personalization:')+'\x20'+_0x1357b0[_0x505a41(0x2a7)][_0x505a41(0x27a)]+_0x505a41(0x253)+(_0x1357b0[_0x505a41(0x2a7)][_0x505a41(0x27a)]!==0x1?'s':''));for(const _0x1a8cae of _0x1357b0[_0x505a41(0x2a7)]){console[_0x505a41(0x268)]('\x20\x20\x20\x20-\x20'+_0x1a8cae[_0x505a41(0x2d4)]);}}}function showParentSegmentNotSetError(_0x5ea818){const _0x406a99=a22_0x1bd28d;console['error'](a22_0x2af8d7[_0x406a99(0x374)](_0x406a99(0x2d5))),console[_0x406a99(0x268)](_0x5ea818);}export class ParentSegmentListCommand extends BaseCommand{['name']='segment:parent:list';[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x2fa);async[a22_0x1bd28d(0x323)](_0x12ac07){const _0xf5e6e2=a22_0x1bd28d,{options:_0x1019f7,args:_0x48652b,tdx:_0x25aab4}=_0x12ac07,_0x1c4e69=_0x48652b[0x0];_0x1019f7[_0xf5e6e2(0x361)]&&(console[_0xf5e6e2(0x268)](_0xf5e6e2(0x338)+_0x1019f7[_0xf5e6e2(0x26a)]),_0x1c4e69&&console[_0xf5e6e2(0x268)](_0xf5e6e2(0x29b)+_0x1c4e69));const _0x1faea6=await withSpinner(_0x1c4e69?_0xf5e6e2(0x1f3)+_0x1c4e69+_0xf5e6e2(0x2e2):_0xf5e6e2(0x201),()=>_0x25aab4[_0xf5e6e2(0x303)][_0xf5e6e2(0x276)](),{'verbose':_0x1019f7[_0xf5e6e2(0x361)]});let _0x3f9630=_0x1faea6[_0xf5e6e2(0x291)];if(_0x1c4e69){const _0x4d386a=_0x1c4e69[_0xf5e6e2(0x218)](/[.+^${}()|[\]\\]/g,_0xf5e6e2(0x205))[_0xf5e6e2(0x218)](/\*/g,'.*')[_0xf5e6e2(0x218)](/\?/g,'.'),_0x4ff66f=new RegExp('^'+_0x4d386a+'$','i');_0x3f9630=_0x3f9630['filter'](_0x1cf98e=>_0x4ff66f['test'](_0x1cf98e[_0xf5e6e2(0x29f)][_0xf5e6e2(0x2d4)]));}_0x3f9630['sort']((_0x5baf64,_0x5d7d80)=>_0x5baf64['attributes'][_0xf5e6e2(0x2d4)][_0xf5e6e2(0x1e6)](_0x5d7d80[_0xf5e6e2(0x29f)][_0xf5e6e2(0x2d4)])),console['error'](_0xf5e6e2(0x32f)+_0x3f9630['length']+'\x20parent\x20segment'+(_0x3f9630['length']!==0x1?'s':''));const _0x39f037=_0x20f38c=>{const _0x33f7f9=_0xf5e6e2;return getConsoleNextUrl(_0x1019f7[_0x33f7f9(0x26a)],_0x33f7f9(0x20f)+_0x20f38c);};if(_0x1019f7[_0xf5e6e2(0x26d)]===_0xf5e6e2(0x200)||_0x1019f7['format']==='jsonl'){const _0x3380a8=_0x3f9630[_0xf5e6e2(0x32b)](_0xf36259=>({..._0xf36259,'url':_0x39f037(_0xf36259['id'])}));await handleSDKOutput(_0x3380a8,_0x1019f7);}else{if(_0x3f9630[_0xf5e6e2(0x27a)]===0x0)_0x1c4e69?console[_0xf5e6e2(0x301)](_0xf5e6e2(0x1df)+_0x1c4e69):console[_0xf5e6e2(0x301)]('No\x20parent\x20segments\x20found');else for(const _0x4f2209 of _0x3f9630){const _0x393bf3=_0x4f2209['attributes']['population']?a22_0x2af8d7['dim']('\x20('+formatRows(_0x4f2209[_0xf5e6e2(0x29f)]['population'])+')'):'',_0x3ebe93=hyperlink(_0x4f2209[_0xf5e6e2(0x29f)][_0xf5e6e2(0x2d4)],_0x39f037(_0x4f2209['id']));console[_0xf5e6e2(0x301)](_0xf5e6e2(0x2e8)+_0x3ebe93+_0x393bf3);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x1f1);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x36f);async[a22_0x1bd28d(0x323)](_0x32a63e){const _0x2a190f=a22_0x1bd28d,{options:_0x35baa2,args:_0x13a930,tdx:_0x1a1ad9}=_0x32a63e;console[_0x2a190f(0x268)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x2a190f(0x315)+_0x2a190f(0x2c1));const _0x2cef3a=_0x35baa2;if(_0x13a930['length']===0x0)return console['error'](a22_0x2af8d7[_0x2a190f(0x285)](_0x2a190f(0x33c))),console[_0x2a190f(0x268)](_0x2a190f(0x360)),0x1;const _0x3cec9f=_0x13a930[0x0];if(!_0x2cef3a[_0x2a190f(0x264)]||!_0x2cef3a[_0x2a190f(0x2fd)])return console['error'](_0x2a190f(0x2f0)),console[_0x2a190f(0x268)](_0x2a190f(0x360)),0x1;_0x2cef3a[_0x2a190f(0x361)]&&(console['error'](_0x2a190f(0x338)+_0x2cef3a['site']),console[_0x2a190f(0x268)](_0x2a190f(0x295)+_0x3cec9f),console['error'](_0x2a190f(0x28b)+_0x2cef3a[_0x2a190f(0x264)]),console[_0x2a190f(0x268)](_0x2a190f(0x2ed)+_0x2cef3a[_0x2a190f(0x2fd)]));const _0x205e44=await loadJSONFromOptions(_0x2cef3a[_0x2a190f(0x29f)],_0x2cef3a[_0x2a190f(0x251)]),_0x1d7b2f=await loadJSONFromOptions(_0x2cef3a['behaviors'],_0x2cef3a[_0x2a190f(0x22a)]),_0x3fa3b5=await loadJSONFromOptions(_0x2cef3a[_0x2a190f(0x316)],_0x2cef3a[_0x2a190f(0x220)]),_0x1825f1={'name':_0x3cec9f,'description':_0x2cef3a[_0x2a190f(0x300)],'scheduleType':_0x2cef3a[_0x2a190f(0x35d)],'scheduleOption':_0x2cef3a[_0x2a190f(0x211)],'timezone':_0x2cef3a['timezone'],'master':{'parentDatabaseName':_0x2cef3a['database'],'parentTableName':_0x2cef3a[_0x2a190f(0x2fd)]},'attributes':_0x205e44,'behaviors':_0x1d7b2f,'customerGroup':_0x3fa3b5},_0x4cdaa2=await withSpinner(_0x2a190f(0x1ed)+_0x3cec9f+'\x27...',()=>_0x1a1ad9[_0x2a190f(0x303)][_0x2a190f(0x346)](_0x1825f1),{'verbose':_0x35baa2[_0x2a190f(0x361)]}),_0x42fbda=_0x4cdaa2['data'];return console[_0x2a190f(0x268)](_0x2a190f(0x30d)+_0x42fbda[_0x2a190f(0x2d4)]+_0x2a190f(0x334)+_0x42fbda['id']),await handleSDKOutput([_0x42fbda],_0x35baa2),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x30c);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x26c);async['execute'](_0x2c5ec8){const _0x260d8a=a22_0x1bd28d,{options:_0x50085e,args:_0x28f5bf,tdx:_0x5a2c17}=_0x2c5ec8;console[_0x260d8a(0x268)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x260d8a(0x315)+_0x260d8a(0x2c1));const _0x2582b1=_0x50085e;if(_0x28f5bf[_0x260d8a(0x27a)]===0x0)return console[_0x260d8a(0x268)](a22_0x2af8d7[_0x260d8a(0x285)](_0x260d8a(0x33c))),console[_0x260d8a(0x268)](_0x260d8a(0x2df)),0x1;const _0x113dac=_0x28f5bf[0x0];_0x2582b1[_0x260d8a(0x361)]&&(console[_0x260d8a(0x268)](_0x260d8a(0x338)+_0x2582b1[_0x260d8a(0x26a)]),console[_0x260d8a(0x268)]('Parent\x20segment:\x20'+_0x113dac));const _0x262798=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x113dac+_0x260d8a(0x2e2),()=>_0x5a2c17[_0x260d8a(0x303)][_0x260d8a(0x23d)](_0x113dac),{'verbose':_0x2582b1[_0x260d8a(0x361)]}),_0x9fe6ce=_0x262798[_0x260d8a(0x291)],_0x11bf5b=await loadJSONFromOptions(_0x2582b1['addAttributes'],_0x2582b1[_0x260d8a(0x289)]),_0x1e8485=await loadJSONFromOptions(_0x2582b1[_0x260d8a(0x30b)],_0x2582b1[_0x260d8a(0x260)]),_0x544f73={'name':_0x9fe6ce['name'],'description':_0x2582b1[_0x260d8a(0x300)]!==undefined?_0x2582b1[_0x260d8a(0x300)]:_0x9fe6ce[_0x260d8a(0x300)],'scheduleType':_0x2582b1[_0x260d8a(0x35d)]!==undefined?_0x2582b1['scheduleType']:_0x9fe6ce[_0x260d8a(0x35d)],'scheduleOption':_0x2582b1[_0x260d8a(0x211)]!==undefined?_0x2582b1[_0x260d8a(0x211)]:_0x9fe6ce['scheduleOption'],'timezone':_0x2582b1[_0x260d8a(0x28c)]!==undefined?_0x2582b1[_0x260d8a(0x28c)]:_0x9fe6ce[_0x260d8a(0x28c)],'master':_0x9fe6ce[_0x260d8a(0x215)],'attributes':_0x11bf5b?[..._0x9fe6ce[_0x260d8a(0x29f)]||[],..._0x11bf5b]:_0x9fe6ce['attributes'],'behaviors':_0x1e8485?[..._0x9fe6ce['behaviors']||[],..._0x1e8485]:_0x9fe6ce[_0x260d8a(0x377)],'customerGroup':_0x9fe6ce['customerGroup']},_0x30a9ec=await withSpinner(_0x260d8a(0x25b)+_0x113dac+_0x260d8a(0x2e2),()=>_0x5a2c17[_0x260d8a(0x303)][_0x260d8a(0x319)](_0x113dac,_0x544f73),{'verbose':_0x2582b1['verbose']}),_0x157723=_0x30a9ec[_0x260d8a(0x291)];return console['error'](_0x260d8a(0x269)+_0x157723[_0x260d8a(0x2d4)]+'\x27'),await handleSDKOutput([_0x157723],_0x2582b1),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x24f);async[a22_0x1bd28d(0x323)](_0x511b6a){const _0x171ac6=a22_0x1bd28d,{options:_0x22a173,args:_0x23bebe,tdx:_0x96f2ed}=_0x511b6a,_0x27d60f=_0x22a173,_0x13977c=_0x23bebe[0x0]||_0x22a173['parentSegment'];if(!_0x13977c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x27d60f[_0x171ac6(0x310)]&&_0x27d60f['output'])return console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x285)](_0x171ac6(0x1f5))),console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x1f6)](_0x171ac6(0x20b))),console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x1f6)](_0x171ac6(0x318)+PARENT_SEGMENT_DIR+_0x171ac6(0x357))),console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x2db)](_0x171ac6(0x266))),0x1;const _0x5327d9=_0x27d60f['output']||a22_0x3399d5[_0x171ac6(0x1f9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x13977c)+_0x171ac6(0x350));_0x27d60f[_0x171ac6(0x361)]&&(console['error'](_0x171ac6(0x338)+_0x27d60f['site']),console[_0x171ac6(0x268)](_0x171ac6(0x265)+_0x13977c),console[_0x171ac6(0x268)](_0x171ac6(0x2be)+_0x5327d9));const _0x23a494=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x13977c+'\x27...',()=>_0x96f2ed[_0x171ac6(0x303)][_0x171ac6(0x368)](_0x13977c),{'verbose':_0x27d60f['verbose']}),_0x4f7cc1=_0x23a494[_0x171ac6(0x291)];if(existsSync(_0x5327d9)){const _0x54acdd=readFileSync(_0x5327d9,'utf-8'),_0x4f7235=generateDiff(_0x54acdd,_0x4f7cc1);if(!hasChanges(_0x4f7235))console[_0x171ac6(0x268)](a22_0x2af8d7['green']('✔')+_0x171ac6(0x335)+a22_0x2af8d7[_0x171ac6(0x2db)](_0x5327d9)+_0x171ac6(0x2c8));else{console[_0x171ac6(0x268)](_0x171ac6(0x34b)+_0x5327d9+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x171ac6(0x268)](formatDiffWithColors(_0x4f7235)),console['error']('─'[_0x171ac6(0x203)](0x3c));if(!_0x27d60f['yes']){if(!isInteractive())return console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x285)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x171ac6(0x268)](a22_0x2af8d7['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x55e447=await confirmKey(_0x171ac6(0x2e7)+_0x5327d9+'\x27?');if(!_0x55e447)return console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x374)](_0x171ac6(0x2cd))),0x1;}writeFileSync(_0x5327d9,_0x4f7cc1,_0x171ac6(0x379)),console[_0x171ac6(0x268)](a22_0x2af8d7['green']('✔')+_0x171ac6(0x2ef)+a22_0x2af8d7[_0x171ac6(0x2db)](_0x5327d9));}}else{const _0x55bc85=a22_0x3399d5[_0x171ac6(0x20d)](_0x5327d9);!existsSync(_0x55bc85)&&mkdirSync(_0x55bc85,{'recursive':!![]}),writeFileSync(_0x5327d9,_0x4f7cc1,_0x171ac6(0x379)),console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x2dd)]('✔')+_0x171ac6(0x2ef)+a22_0x2af8d7[_0x171ac6(0x2db)](_0x5327d9));}return saveSessionContext({'parent_segment':_0x13977c},_0x27d60f[_0x171ac6(0x280)]),console[_0x171ac6(0x268)](a22_0x2af8d7[_0x171ac6(0x2dd)]('✔')+'\x20Context\x20set:\x20'+a22_0x2af8d7[_0x171ac6(0x1f6)]('parent_segment')+_0x171ac6(0x359)+a22_0x2af8d7[_0x171ac6(0x2db)](_0x13977c)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a22_0x1bd28d(0x329);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x223);async['execute'](_0x1d9049){const _0x454778=a22_0x1bd28d,{options:_0x449210,args:_0x322641,tdx:_0x5814a5}=_0x1d9049,_0x8ffb7d=_0x449210,_0x547cd0=_0x322641[0x0]||_0x449210[_0x454778(0x36e)];if(!_0x547cd0)return showParentSegmentNotSetError(_0x454778(0x1fd)+_0x454778(0x24b)),0x1;const _0x5bf4ee=resolveYamlFile(_0x547cd0);if(!existsSync(_0x5bf4ee))return showFileNotFoundError(_0x5bf4ee,_0x547cd0),0x1;_0x8ffb7d['verbose']&&(console['error'](_0x454778(0x338)+_0x8ffb7d[_0x454778(0x26a)]),console[_0x454778(0x268)]('YAML\x20file:\x20'+_0x5bf4ee));let _0x5e9cf4;try{_0x5e9cf4=readFileSync(_0x5bf4ee,_0x454778(0x379));}catch(_0x1eb554){const _0x97584a=_0x1eb554 instanceof Error?_0x1eb554[_0x454778(0x31b)]:String(_0x1eb554);return console[_0x454778(0x268)]('Error\x20reading\x20file:\x20'+_0x97584a),0x1;}const _0x502f0e=await withSpinner('Analyzing\x20changes...',()=>_0x5814a5[_0x454778(0x303)]['pushParentYaml'](_0x5e9cf4),{'verbose':_0x8ffb7d[_0x454778(0x361)]}),_0x992333=_0x502f0e[_0x454778(0x291)],{isNew:_0xccfc7f,name:_0x55988f,hasChanges:_0x366bf2,diffFormatted:_0x2de0fb}=_0x992333;if(!_0x366bf2)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x55988f+_0x454778(0x27b)),0x0;_0xccfc7f?console[_0x454778(0x268)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x55988f+'\x27:'):console['error'](_0x454778(0x2b0)+_0x55988f+'\x27:');console['error']('─'[_0x454778(0x203)](0x3c)),console[_0x454778(0x268)](_0x2de0fb),console[_0x454778(0x268)]('─'[_0x454778(0x203)](0x3c));const _0x5564ee=_0xccfc7f?_0x454778(0x2ee)+_0x55988f+'\x27?':_0x454778(0x33e)+_0x55988f+'\x27?';if(!_0x8ffb7d[_0x454778(0x257)]){if(!isInteractive())return console[_0x454778(0x268)](a22_0x2af8d7['red'](_0x454778(0x2e1)),_0x454778(0x2c0)),console['error'](a22_0x2af8d7[_0x454778(0x1f6)](_0x454778(0x1e0))),0x1;const _0xe274e3=await confirmKey(_0x5564ee);if(!_0xe274e3)return console[_0x454778(0x268)](a22_0x2af8d7[_0x454778(0x374)](_0x454778(0x2cd))),0x1;}const _0x4d1369=_0xccfc7f?_0x454778(0x2d3):_0x454778(0x245),_0x801cf1=await withSpinner(_0x4d1369+_0x454778(0x2b7)+_0x55988f+_0x454778(0x2e2),()=>_0x992333[_0x454778(0x349)](),{'verbose':_0x8ffb7d['verbose']}),_0x1402ae=_0x801cf1[_0x454778(0x291)],_0x5b9eb5=getConsoleNextUrl(_0x8ffb7d[_0x454778(0x26a)],_0x454778(0x20f)+_0x1402ae['id']),_0x478469=_0xccfc7f?_0x454778(0x31f):'Updated';return console[_0x454778(0x268)]('✔\x20'+_0x478469+'\x20parent\x20segment\x20\x27'+_0x1402ae[_0x454778(0x2d4)]+'\x27'),console[_0x454778(0x268)]('\x20\x20'+_0x5b9eb5),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x1bd28d(0x256);[a22_0x1bd28d(0x300)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a22_0x1bd28d(0x323)](_0x59a8b1){const _0x23ce93=a22_0x1bd28d,{options:_0x686525,args:_0x28caaa,tdx:_0x5e1ee8}=_0x59a8b1,_0x43b5bc=_0x686525,_0x3b30e7=_0x28caaa[0x0]||_0x686525[_0x23ce93(0x36e)];if(!_0x3b30e7)return showParentSegmentNotSetError(_0x23ce93(0x252)+_0x23ce93(0x238)+_0x23ce93(0x227)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x23ce93(0x26b)),0x1;const _0x1dfb64=resolveYamlFile(_0x3b30e7);if(!existsSync(_0x1dfb64))return showFileNotFoundError(_0x1dfb64,_0x3b30e7),0x1;_0x43b5bc['verbose']&&(console[_0x23ce93(0x268)](_0x23ce93(0x338)+_0x43b5bc[_0x23ce93(0x26a)]),console[_0x23ce93(0x268)](_0x23ce93(0x27d)+_0x1dfb64));let _0x811d4d;try{_0x811d4d=readFileSync(_0x1dfb64,'utf-8');}catch(_0x288baa){const _0xbd20e3=_0x288baa instanceof Error?_0x288baa['message']:String(_0x288baa);return console[_0x23ce93(0x268)]('Error\x20reading\x20file:\x20'+_0xbd20e3),0x1;}const _0x3b02af=createCommandSpinner(a22_0x2af8d7['dim'](_0x23ce93(0x2ae)),{'verbose':_0x43b5bc[_0x23ce93(0x361)]});_0x3b02af[_0x23ce93(0x279)]();const _0x356179={'onProgress':_0x2998a8=>{const _0x488c85=_0x23ce93;_0x3b02af[_0x488c85(0x23e)]=formatProgressMessage(_0x2998a8);}};if(_0x43b5bc['master'])_0x356179[_0x23ce93(0x215)]=!![];if(_0x43b5bc['enriched'])_0x356179[_0x23ce93(0x1f4)]=!![];_0x43b5bc[_0x23ce93(0x2f9)]&&(_0x356179[_0x23ce93(0x2f9)]=_0x43b5bc[_0x23ce93(0x2f9)]);_0x43b5bc['behavior']&&(_0x356179[_0x23ce93(0x28e)]=_0x43b5bc['behavior']);if(_0x43b5bc[_0x23ce93(0x2e9)])_0x356179[_0x23ce93(0x2e9)]=_0x43b5bc[_0x23ce93(0x2e9)];let _0x4f64c7;try{_0x4f64c7=await _0x5e1ee8[_0x23ce93(0x303)][_0x23ce93(0x1e9)](_0x811d4d,_0x356179),_0x3b02af[_0x23ce93(0x229)]();}catch(_0x4f5789){_0x3b02af[_0x23ce93(0x229)]();throw _0x4f5789;}const _0x1e49f5=_0x43b5bc[_0x23ce93(0x2e9)]||_0x23ce93(0x351);return this[_0x23ce93(0x31a)](_0x4f64c7,_0x356179,_0x1dfb64,_0x1e49f5),_0x4f64c7[_0x23ce93(0x273)]?0x0:0x1;}[a22_0x1bd28d(0x31a)](_0x50f99b,_0x5e733e,_0x1914ed,_0x11c785){const _0x486e0d=a22_0x1bd28d;console[_0x486e0d(0x268)]('\x0a'+a22_0x2af8d7[_0x486e0d(0x274)](_0x486e0d(0x212))+'\x20'+_0x50f99b[_0x486e0d(0x2d4)]),console['error']('═'[_0x486e0d(0x203)](0x3c)),this[_0x486e0d(0x30a)](_0x50f99b);if(typeof _0x5e733e[_0x486e0d(0x2f9)]===_0x486e0d(0x246)){this[_0x486e0d(0x32c)](_0x50f99b),this[_0x486e0d(0x307)](_0x50f99b),this[_0x486e0d(0x1ff)](_0x1914ed,_0x11c785,_0x486e0d(0x2f9),_0x5e733e[_0x486e0d(0x2f9)]);return;}if(_0x5e733e[_0x486e0d(0x2f9)]===!![]){this[_0x486e0d(0x32c)](_0x50f99b),this[_0x486e0d(0x307)](_0x50f99b),this[_0x486e0d(0x1ff)](_0x1914ed,_0x11c785,'attributes');return;}if(typeof _0x5e733e['behavior']===_0x486e0d(0x246)){this[_0x486e0d(0x25e)](_0x50f99b,_0x11c785),this[_0x486e0d(0x307)](_0x50f99b),this[_0x486e0d(0x1ff)](_0x1914ed,_0x11c785,'behavior',_0x5e733e['behavior']);return;}if(_0x5e733e[_0x486e0d(0x28e)]===!![]){this['displayBehaviorsStats'](_0x50f99b,_0x11c785),this[_0x486e0d(0x307)](_0x50f99b),this[_0x486e0d(0x1ff)](_0x1914ed,_0x11c785,_0x486e0d(0x377));return;}this['displayAttributesStats'](_0x50f99b),this['displayBehaviorsStats'](_0x50f99b,_0x11c785),this[_0x486e0d(0x22f)](_0x50f99b),this[_0x486e0d(0x307)](_0x50f99b),this['displayPreviewHints'](_0x1914ed,_0x11c785,_0x486e0d(0x262));}[a22_0x1bd28d(0x22f)](_0x13bb86){displayRealtimeValidation(_0x13bb86);}[a22_0x1bd28d(0x1ff)](_0x58cc43,_0x392eaa,_0x38b23a,_0x2a6c30){const _0x3ee872=a22_0x1bd28d;console[_0x3ee872(0x268)]('\x0a'+a22_0x2af8d7[_0x3ee872(0x1f6)](_0x3ee872(0x373)));const _0x11a615=_0x392eaa!==_0x3ee872(0x351)?'\x20--interval\x20'+_0x392eaa:'';if(_0x38b23a==='attribute'&&_0x2a6c30)console[_0x3ee872(0x268)]('\x20\x20'+a22_0x2af8d7[_0x3ee872(0x1f6)](_0x3ee872(0x2fc)+_0x58cc43+_0x3ee872(0x2ad)+_0x2a6c30+'\x22'+_0x11a615));else{if(_0x38b23a===_0x3ee872(0x28e)&&_0x2a6c30)console[_0x3ee872(0x268)]('\x20\x20'+a22_0x2af8d7[_0x3ee872(0x1f6)]('tdx\x20ps\x20preview\x20'+_0x58cc43+_0x3ee872(0x1ee)+_0x2a6c30+'\x22'+_0x11a615));else(_0x38b23a===_0x3ee872(0x29f)||_0x38b23a===_0x3ee872(0x262))&&console[_0x3ee872(0x268)]('\x20\x20'+a22_0x2af8d7[_0x3ee872(0x1f6)](_0x3ee872(0x2fc)+_0x58cc43+'\x20--attribute\x20\x22<name>\x22'+_0x11a615));}(_0x38b23a===_0x3ee872(0x377)||_0x38b23a==='all')&&console[_0x3ee872(0x268)]('\x20\x20'+a22_0x2af8d7[_0x3ee872(0x1f6)](_0x3ee872(0x2fc)+_0x58cc43+'\x20--behavior\x20\x22<name>\x22'+_0x11a615)),_0x38b23a===_0x3ee872(0x262)&&console['error']('\x20\x20'+a22_0x2af8d7[_0x3ee872(0x1f6)](_0x3ee872(0x2fc)+_0x58cc43+_0x3ee872(0x294)+_0x11a615));}['displayMasterInfo'](_0x59a395){const _0x36336b=a22_0x1bd28d,{master:_0x588b00}=_0x59a395,_0x2db2b5=_0x588b00['schemaValid']?a22_0x2af8d7[_0x36336b(0x2dd)]('✔'):a22_0x2af8d7[_0x36336b(0x285)]('✘');console[_0x36336b(0x268)]('\x0a'+a22_0x2af8d7[_0x36336b(0x1f6)]('Master\x20Table')),console['error'](_0x2db2b5+'\x20'+a22_0x2af8d7['bold'](_0x588b00[_0x36336b(0x264)]+'.'+_0x588b00[_0x36336b(0x2fd)])),_0x588b00[_0x36336b(0x271)]?_0x588b00[_0x36336b(0x2ce)]!==undefined&&console[_0x36336b(0x268)]('\x20\x20'+a22_0x2af8d7[_0x36336b(0x1f6)](_0x36336b(0x308))+'\x20'+a22_0x2af8d7[_0x36336b(0x2db)](formatRows(_0x588b00['rowCount']))):console[_0x36336b(0x268)]('\x20\x20'+a22_0x2af8d7[_0x36336b(0x285)]('Error:')+'\x20'+_0x588b00[_0x36336b(0x343)]);}[a22_0x1bd28d(0x32c)](_0x288bf5){const _0x3df97e=a22_0x1bd28d;if(_0x288bf5[_0x3df97e(0x29f)][_0x3df97e(0x27a)]===0x0)return;console[_0x3df97e(0x268)]('\x0a'+a22_0x2af8d7['dim'](_0x3df97e(0x327)));for(const _0x42e96f of _0x288bf5[_0x3df97e(0x29f)]){const _0x3ca3d5=_0x42e96f[_0x3df97e(0x271)]?a22_0x2af8d7[_0x3df97e(0x2dd)]('✔'):a22_0x2af8d7[_0x3df97e(0x285)]('✘');let _0xaaf223='';if(_0x42e96f[_0x3df97e(0x271)]&&_0x42e96f[_0x3df97e(0x370)]!==undefined&&_0x42e96f[_0x3df97e(0x214)]!==undefined){const _0x3d4e8b=_0x42e96f[_0x3df97e(0x214)][_0x3df97e(0x23c)](0x1),_0x2242b9=_0x42e96f['coveragePercent']>=0x50?a22_0x2af8d7[_0x3df97e(0x2dd)]:_0x42e96f[_0x3df97e(0x214)]>=0x32?a22_0x2af8d7[_0x3df97e(0x374)]:a22_0x2af8d7[_0x3df97e(0x285)];_0xaaf223='\x20'+a22_0x2af8d7['dim'](_0x3df97e(0x1dd))+'\x20'+_0x2242b9(_0x3d4e8b+'%')+'\x20('+formatRows(_0x42e96f['matchedCount'])+_0x3df97e(0x320);}console['error'](_0x3ca3d5+'\x20'+a22_0x2af8d7[_0x3df97e(0x274)](_0x42e96f[_0x3df97e(0x2d4)])+_0xaaf223),console['error']('\x20\x20'+a22_0x2af8d7['dim'](_0x3df97e(0x30f))+'\x20'+a22_0x2af8d7[_0x3df97e(0x274)](_0x42e96f[_0x3df97e(0x264)]+'.'+_0x42e96f['table']));const _0xc0e96f=_0x42e96f[_0x3df97e(0x296)]===_0x42e96f['foreignKey']?a22_0x2af8d7[_0x3df97e(0x1f6)](_0x3df97e(0x23b))+'\x20'+_0x42e96f[_0x3df97e(0x296)]:a22_0x2af8d7[_0x3df97e(0x1f6)](_0x3df97e(0x22c))+'\x20'+_0x42e96f['joinKey']+_0x3df97e(0x359)+_0x42e96f[_0x3df97e(0x240)];console[_0x3df97e(0x268)]('\x20\x20'+_0xc0e96f),console[_0x3df97e(0x268)]('\x20\x20'+a22_0x2af8d7[_0x3df97e(0x1f6)](_0x3df97e(0x2e4))),this[_0x3df97e(0x233)](_0x42e96f[_0x3df97e(0x32e)]),!_0x42e96f['schemaValid']&&console[_0x3df97e(0x268)]('\x20\x20'+a22_0x2af8d7['red']('Error:')+'\x20'+_0x42e96f[_0x3df97e(0x343)]);}}['displayBehaviorsStats'](_0x40e1d2,_0x5bb82c){const _0x300ab6=a22_0x1bd28d;if(_0x40e1d2[_0x300ab6(0x377)][_0x300ab6(0x27a)]===0x0)return;console[_0x300ab6(0x268)]('\x0a'+a22_0x2af8d7[_0x300ab6(0x1f6)](_0x300ab6(0x242))+'\x20'+a22_0x2af8d7['dim']('('+_0x5bb82c+')'));for(const _0x53d023 of _0x40e1d2[_0x300ab6(0x377)]){const _0x3d871f=_0x53d023[_0x300ab6(0x271)]?a22_0x2af8d7[_0x300ab6(0x2dd)]('✔'):a22_0x2af8d7['red']('✘');let _0x37e457='';if(_0x53d023['schemaValid']&&_0x53d023['customersWithEvents']!==undefined&&_0x53d023[_0x300ab6(0x34a)]!==undefined){const _0x4bbe77=_0x53d023[_0x300ab6(0x34e)]?.[_0x300ab6(0x23c)](0x1)||'?',_0x3b3be4=(_0x53d023[_0x300ab6(0x34e)]??0x0)>=0x32?a22_0x2af8d7['green']:(_0x53d023['customerPercent']??0x0)>=0x14?a22_0x2af8d7['yellow']:a22_0x2af8d7[_0x300ab6(0x285)];_0x37e457='\x20'+a22_0x2af8d7['dim'](_0x300ab6(0x324))+'\x20'+_0x3b3be4(formatRows(_0x53d023[_0x300ab6(0x326)]))+'\x20('+_0x4bbe77+'%)\x20'+a22_0x2af8d7[_0x300ab6(0x1f6)](_0x300ab6(0x2a2))+'\x20'+a22_0x2af8d7['cyan'](formatRows(_0x53d023[_0x300ab6(0x34a)]));}console[_0x300ab6(0x268)](_0x3d871f+'\x20'+a22_0x2af8d7[_0x300ab6(0x274)](_0x53d023['name'])+_0x37e457),console[_0x300ab6(0x268)]('\x20\x20'+a22_0x2af8d7[_0x300ab6(0x1f6)](_0x300ab6(0x30f))+'\x20'+a22_0x2af8d7[_0x300ab6(0x274)](_0x53d023[_0x300ab6(0x264)]+'.'+_0x53d023[_0x300ab6(0x2fd)]));const _0x10a448=_0x53d023['joinKey']===_0x53d023['foreignKey']?a22_0x2af8d7['dim'](_0x300ab6(0x23b))+'\x20'+_0x53d023[_0x300ab6(0x296)]:a22_0x2af8d7[_0x300ab6(0x1f6)](_0x300ab6(0x22c))+'\x20'+_0x53d023[_0x300ab6(0x296)]+'\x20=\x20'+_0x53d023['foreignKey'];console[_0x300ab6(0x268)]('\x20\x20'+_0x10a448),console['error']('\x20\x20'+a22_0x2af8d7[_0x300ab6(0x1f6)]('Columns:')),this[_0x300ab6(0x233)](_0x53d023[_0x300ab6(0x32e)]),!_0x53d023[_0x300ab6(0x271)]&&console[_0x300ab6(0x268)]('\x20\x20'+a22_0x2af8d7['red'](_0x300ab6(0x22d))+'\x20'+_0x53d023[_0x300ab6(0x343)]);}}[a22_0x1bd28d(0x233)](_0x436316){const _0x5f24d1=a22_0x1bd28d;for(const _0x58dd86 of _0x436316){_0x58dd86[_0x5f24d1(0x2f3)]===_0x58dd86[_0x5f24d1(0x332)]||_0x58dd86[_0x5f24d1(0x332)]==='*'?console[_0x5f24d1(0x268)](_0x5f24d1(0x35b)+_0x58dd86['label']):console['error'](_0x5f24d1(0x35b)+_0x58dd86['label']+'\x20'+a22_0x2af8d7['dim']('('+_0x58dd86[_0x5f24d1(0x332)]+')'));}}[a22_0x1bd28d(0x307)](_0x41d14a){const _0x222dbf=a22_0x1bd28d;console['error']('─'['repeat'](0x3c));if(_0x41d14a['errors']['length']>0x0){console['error']('\x0a'+a22_0x2af8d7[_0x222dbf(0x285)](_0x222dbf(0x35e)));for(const _0x6a79a5 of _0x41d14a[_0x222dbf(0x288)]){console[_0x222dbf(0x268)]('\x20\x20'+a22_0x2af8d7['red']('•')+'\x20'+_0x6a79a5);}}_0x41d14a['allValid']&&console[_0x222dbf(0x268)]('\x0a'+a22_0x2af8d7['green']('✔')+_0x222dbf(0x36d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']='segment:parent:preview';[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x2bd);async[a22_0x1bd28d(0x323)](_0x50d6e1){const _0x104ccf=a22_0x1bd28d,{options:_0x1d9cc1,args:_0x262828,tdx:_0x2105f9}=_0x50d6e1,_0x19bea1=_0x1d9cc1,_0x44c037=_0x262828[0x0]||_0x1d9cc1[_0x104ccf(0x36e)];if(!_0x44c037)return showParentSegmentNotSetError(_0x104ccf(0x290)+_0x104ccf(0x22b)+'Options\x20(one\x20required):\x0a'+_0x104ccf(0x36c)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x104ccf(0x1de)+_0x104ccf(0x2bb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x19bea1[_0x104ccf(0x215)]&&!_0x19bea1['attribute']&&!_0x19bea1[_0x104ccf(0x28e)]&&!_0x19bea1[_0x104ccf(0x1f4)])return console[_0x104ccf(0x268)](a22_0x2af8d7['red'](_0x104ccf(0x2fb))),console[_0x104ccf(0x268)](_0x104ccf(0x217)),console[_0x104ccf(0x268)]('Options:'),console['error'](_0x104ccf(0x33a)),console[_0x104ccf(0x268)](_0x104ccf(0x2e6)),console[_0x104ccf(0x268)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x104ccf(0x268)](_0x104ccf(0x20a)),0x1;const _0x2121e7=resolveYamlFile(_0x44c037);if(!existsSync(_0x2121e7))return showFileNotFoundError(_0x2121e7,_0x44c037),0x1;_0x19bea1[_0x104ccf(0x361)]&&(console['error'](_0x104ccf(0x338)+_0x19bea1[_0x104ccf(0x26a)]),console['error'](_0x104ccf(0x27d)+_0x2121e7));let _0x4e5085;try{_0x4e5085=readFileSync(_0x2121e7,_0x104ccf(0x379));}catch(_0x917753){const _0x105e28=_0x917753 instanceof Error?_0x917753[_0x104ccf(0x31b)]:String(_0x917753);return console[_0x104ccf(0x268)]('Error\x20reading\x20file:\x20'+_0x105e28),0x1;}let _0x44fc92;try{_0x44fc92=parseDef(_0x4e5085);}catch(_0x5166e0){const _0x20ae77=_0x5166e0 instanceof Error?_0x5166e0[_0x104ccf(0x31b)]:String(_0x5166e0);return console[_0x104ccf(0x268)](a22_0x2af8d7[_0x104ccf(0x285)]('Error\x20parsing\x20YAML:\x20'+_0x20ae77)),0x1;}if(_0x19bea1[_0x104ccf(0x2f9)]===!![]||_0x19bea1[_0x104ccf(0x2f9)]===''){const _0x3cd4e3=_0x44fc92['attributes']?.[_0x104ccf(0x32b)](_0x52d008=>_0x52d008['name'])||[];if(_0x3cd4e3['length']===0x0)console[_0x104ccf(0x268)](a22_0x2af8d7[_0x104ccf(0x285)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x104ccf(0x268)](a22_0x2af8d7[_0x104ccf(0x285)](_0x104ccf(0x35a))),console[_0x104ccf(0x268)](_0x104ccf(0x2b8));for(const _0x2cfc65 of _0x3cd4e3){console[_0x104ccf(0x268)]('\x20\x20'+a22_0x2af8d7[_0x104ccf(0x2db)](_0x2cfc65));}console['error'](_0x104ccf(0x298)+_0x44c037+'\x20--attribute\x20\x22'+_0x3cd4e3[0x0]+'\x22');}return 0x1;}if(_0x19bea1[_0x104ccf(0x28e)]===!![]||_0x19bea1[_0x104ccf(0x28e)]===''){const _0x830e4b=_0x44fc92[_0x104ccf(0x377)]?.[_0x104ccf(0x32b)](_0x30a872=>_0x30a872[_0x104ccf(0x2d4)])||[];if(_0x830e4b[_0x104ccf(0x27a)]===0x0)console[_0x104ccf(0x268)](a22_0x2af8d7['red'](_0x104ccf(0x219)));else{console[_0x104ccf(0x268)](a22_0x2af8d7['red'](_0x104ccf(0x281))),console[_0x104ccf(0x268)](_0x104ccf(0x372));for(const _0x2227e4 of _0x830e4b){console[_0x104ccf(0x268)]('\x20\x20'+a22_0x2af8d7[_0x104ccf(0x2db)](_0x2227e4));}console[_0x104ccf(0x268)](_0x104ccf(0x298)+_0x44c037+_0x104ccf(0x1ee)+_0x830e4b[0x0]+'\x22');}return 0x1;}const _0x31c7f0=createCommandSpinner(a22_0x2af8d7[_0x104ccf(0x1f6)]('Fetching\x20sample\x20data...'),{'verbose':_0x19bea1['verbose']});_0x31c7f0[_0x104ccf(0x279)]();const _0x1ece83={'onProgress':_0x5da833=>{const _0x19ce15=_0x104ccf;_0x31c7f0[_0x19ce15(0x23e)]=formatProgressMessage(_0x5da833);}};if(_0x19bea1[_0x104ccf(0x215)])_0x1ece83[_0x104ccf(0x215)]=!![];if(_0x19bea1[_0x104ccf(0x2f9)]&&typeof _0x19bea1[_0x104ccf(0x2f9)]===_0x104ccf(0x246))_0x1ece83[_0x104ccf(0x2f9)]=_0x19bea1[_0x104ccf(0x2f9)];if(_0x19bea1['behavior']&&typeof _0x19bea1['behavior']===_0x104ccf(0x246))_0x1ece83[_0x104ccf(0x28e)]=_0x19bea1[_0x104ccf(0x28e)];if(_0x19bea1['enriched'])_0x1ece83[_0x104ccf(0x1f4)]=!![];if(_0x19bea1['interval'])_0x1ece83['interval']=_0x19bea1['interval'];let _0x35f971;try{_0x35f971=await _0x2105f9[_0x104ccf(0x303)]['previewParentYaml'](_0x4e5085,_0x1ece83),_0x31c7f0[_0x104ccf(0x229)]();}catch(_0x1b23fa){_0x31c7f0[_0x104ccf(0x229)]();throw _0x1b23fa;}return await this[_0x104ccf(0x2ec)](_0x35f971,{'master':_0x19bea1[_0x104ccf(0x215)],'attribute':typeof _0x19bea1['attribute']===_0x104ccf(0x246)?_0x19bea1[_0x104ccf(0x2f9)]:undefined,'behavior':typeof _0x19bea1[_0x104ccf(0x28e)]==='string'?_0x19bea1['behavior']:undefined,'enriched':_0x19bea1['enriched']}),_0x35f971[_0x104ccf(0x273)]?0x0:0x1;}async[a22_0x1bd28d(0x2ec)](_0x6dcbeb,_0x1762c9){const _0xd56eb0=a22_0x1bd28d;console[_0xd56eb0(0x268)]('\x0a'+a22_0x2af8d7[_0xd56eb0(0x274)](_0xd56eb0(0x250))+'\x20'+_0x6dcbeb[_0xd56eb0(0x2d4)]),console[_0xd56eb0(0x268)]('═'[_0xd56eb0(0x203)](0x3c));if(_0x1762c9[_0xd56eb0(0x215)]&&_0x6dcbeb[_0xd56eb0(0x24a)]){const _0x59bf4d=a22_0x2af8d7[_0xd56eb0(0x1f6)](_0xd56eb0(0x304))+'\x20'+a22_0x2af8d7[_0xd56eb0(0x274)](_0x6dcbeb[_0xd56eb0(0x215)][_0xd56eb0(0x264)]+'.'+_0x6dcbeb['master'][_0xd56eb0(0x2fd)]);await this[_0xd56eb0(0x1fc)](_0x59bf4d,_0x6dcbeb[_0xd56eb0(0x24a)]);}else{if(_0x1762c9['attribute']&&_0x6dcbeb[_0xd56eb0(0x24a)]){const _0x2a88e8=a22_0x2af8d7[_0xd56eb0(0x1f6)](_0xd56eb0(0x2c9))+'\x20'+a22_0x2af8d7['bold'](_0x1762c9[_0xd56eb0(0x2f9)]);await this['displaySampleData'](_0x2a88e8,_0x6dcbeb[_0xd56eb0(0x24a)]);}else{if(_0x1762c9[_0xd56eb0(0x28e)]&&_0x6dcbeb['sampleData']){const _0x40ac00=a22_0x2af8d7[_0xd56eb0(0x1f6)]('Behavior:')+'\x20'+a22_0x2af8d7[_0xd56eb0(0x274)](_0x1762c9[_0xd56eb0(0x28e)]);await this[_0xd56eb0(0x1fc)](_0x40ac00,_0x6dcbeb[_0xd56eb0(0x24a)]);}else{if(_0x1762c9['enriched']&&_0x6dcbeb['sampleData']){const _0x6aa730=a22_0x2af8d7['dim'](_0xd56eb0(0x204))+'\x20'+a22_0x2af8d7[_0xd56eb0(0x274)](_0xd56eb0(0x2a3));await this[_0xd56eb0(0x1fc)](_0x6aa730,_0x6dcbeb[_0xd56eb0(0x24a)]);}else!_0x6dcbeb[_0xd56eb0(0x24a)]&&console[_0xd56eb0(0x268)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x6dcbeb['errors']['length']>0x0){console[_0xd56eb0(0x268)]('─'['repeat'](0x3c)),console[_0xd56eb0(0x268)]('\x0a'+a22_0x2af8d7[_0xd56eb0(0x285)]('Errors:'));for(const _0x2ba9e8 of _0x6dcbeb[_0xd56eb0(0x288)]){console[_0xd56eb0(0x268)]('\x20\x20'+a22_0x2af8d7[_0xd56eb0(0x285)]('•')+'\x20'+_0x2ba9e8);}}}async[a22_0x1bd28d(0x1fc)](_0x5451e5,_0x77bd6a){const _0x550b75=a22_0x1bd28d;if(_0x77bd6a[_0x550b75(0x27a)]===0x0){console['error']('\x0a'+_0x5451e5),console[_0x550b75(0x268)](_0x550b75(0x2a5));return;}console[_0x550b75(0x268)]('\x0a'+_0x5451e5);const _0x5735e5=Object[_0x550b75(0x2b5)](_0x77bd6a[0x0])['map'](_0x4c80ee=>({'name':_0x4c80ee,'type':typeof _0x77bd6a[0x0][_0x4c80ee]===_0x550b75(0x354)?_0x550b75(0x36b):_0x550b75(0x345)})),_0x2ed861={'queryId':'preview','columns':_0x5735e5,'data':_0x77bd6a,'stats':{'state':_0x550b75(0x232),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x77bd6a['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x159062=formatAsTable(_0x2ed861,_0x77bd6a[_0x550b75(0x27a)],!![]);await writeOutput(_0x159062,undefined,_0x550b75(0x2fd));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x364);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a22_0x1bd28d(0x323)](_0x593b82){const _0x2e7117=a22_0x1bd28d,{options:_0x38f833,args:_0x4fc3c1,tdx:_0x5f3213}=_0x593b82,_0x2b9c68=_0x38f833,_0xf8895d=_0x4fc3c1[0x0]||_0x38f833[_0x2e7117(0x36e)];if(!_0xf8895d)return showParentSegmentNotSetError(_0x2e7117(0x34c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4c581a=resolveYamlFile(_0xf8895d);if(existsSync(_0x4c581a)){_0x2b9c68[_0x2e7117(0x361)]&&console[_0x2e7117(0x268)](_0x2e7117(0x32d)+_0x4c581a);let _0xce6b09;try{_0xce6b09=readFileSync(_0x4c581a,'utf-8');}catch(_0x53ba96){const _0x3334d1=_0x53ba96 instanceof Error?_0x53ba96[_0x2e7117(0x31b)]:String(_0x53ba96);return console['error'](_0x2e7117(0x344)+_0x3334d1),0x1;}const _0x243db7=await withSpinner(_0x2e7117(0x286),()=>_0x5f3213['segment'][_0x2e7117(0x28f)](_0xce6b09),{'verbose':_0x2b9c68[_0x2e7117(0x361)]}),_0x48bde2=_0x243db7['data'],{isNew:_0x1236a4,name:_0x4930db,hasChanges:_0x1e9e7d,diffFormatted:_0x4d8add}=_0x48bde2;if(_0x1e9e7d){_0x1236a4?console['error'](_0x2e7117(0x2e3)+_0x4930db+'\x27:'):console['error'](_0x2e7117(0x2b0)+_0x4930db+'\x27:');console[_0x2e7117(0x268)]('─'[_0x2e7117(0x203)](0x3c)),console[_0x2e7117(0x268)](_0x4d8add),console[_0x2e7117(0x268)]('─'[_0x2e7117(0x203)](0x3c));const _0x712efc=_0x1236a4?'Create\x20parent\x20segment\x20\x27'+_0x4930db+'\x27\x20and\x20run\x20workflow?':_0x2e7117(0x33e)+_0x4930db+_0x2e7117(0x1fe);if(!_0x2b9c68[_0x2e7117(0x257)]){if(!isInteractive())return console[_0x2e7117(0x268)](a22_0x2af8d7['red'](_0x2e7117(0x2e1)),_0x2e7117(0x2c0)),console[_0x2e7117(0x268)](a22_0x2af8d7['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2762fb=await confirmKey(_0x712efc);if(!_0x2762fb)return console[_0x2e7117(0x268)](a22_0x2af8d7[_0x2e7117(0x374)]('Aborted.')),0x1;}const _0x78855d=_0x1236a4?_0x2e7117(0x2d3):_0x2e7117(0x245);await withSpinner(_0x78855d+_0x2e7117(0x2b7)+_0x4930db+_0x2e7117(0x2e2),()=>_0x48bde2[_0x2e7117(0x349)](),{'verbose':_0x2b9c68[_0x2e7117(0x361)]});const _0x1b39d8=_0x1236a4?_0x2e7117(0x31f):_0x2e7117(0x25d);console[_0x2e7117(0x268)]('✔\x20'+_0x1b39d8+_0x2e7117(0x2b7)+_0x4930db+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x4930db+_0x2e7117(0x2c5));}const _0x3091ea=await withSpinner(_0x2e7117(0x353)+_0xf8895d+_0x2e7117(0x2e2),()=>_0x5f3213[_0x2e7117(0x303)][_0x2e7117(0x31e)](_0xf8895d),{'verbose':_0x2b9c68[_0x2e7117(0x361)]}),_0x464c96=_0x3091ea['data'],_0x181267=getConsoleUrl(_0x2b9c68[_0x2e7117(0x26a)],_0x2e7117(0x284)+_0x464c96['workflowId']+_0x2e7117(0x20c)+_0x464c96[_0x2e7117(0x1e1)]+_0x2e7117(0x309)+_0x464c96[_0x2e7117(0x33f)]);return console['error'](_0x2e7117(0x2f2)),console[_0x2e7117(0x268)]('\x20\x20'+a22_0x2af8d7[_0x2e7117(0x1f6)](_0x2e7117(0x267))+'\x20'+_0x464c96[_0x2e7117(0x21e)]),console['error']('\x20\x20'+a22_0x2af8d7['dim'](_0x2e7117(0x26f))+'\x20'+_0x464c96[_0x2e7117(0x1f2)]),console[_0x2e7117(0x268)]('\x20\x20'+a22_0x2af8d7[_0x2e7117(0x1f6)](_0x2e7117(0x32a))+'\x20'+_0x464c96['workflowSessionId']),console[_0x2e7117(0x268)]('\x20\x20'+a22_0x2af8d7[_0x2e7117(0x1f6)](_0x2e7117(0x376))+'\x20'+_0x464c96[_0x2e7117(0x33f)]),console[_0x2e7117(0x268)]('\x20\x20'+_0x181267),console[_0x2e7117(0x268)]('\x0a'+a22_0x2af8d7[_0x2e7117(0x1f6)](_0x2e7117(0x358))+_0x2e7117(0x36a)+_0x464c96[_0x2e7117(0x33f)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x2de);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x259);async[a22_0x1bd28d(0x323)](_0x3ac34f){const _0x12cbc7=a22_0x1bd28d,{options:_0x1220c3,args:_0x227b0c,tdx:_0x3bd8a1}=_0x3ac34f,_0x531a6f=_0x227b0c[0x0]||_0x1220c3['parentSegment'];if(!_0x531a6f)return showParentSegmentNotSetError(_0x12cbc7(0x311)+'\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;_0x1220c3[_0x12cbc7(0x361)]&&(console[_0x12cbc7(0x268)](_0x12cbc7(0x338)+_0x1220c3[_0x12cbc7(0x26a)]),console[_0x12cbc7(0x268)](_0x12cbc7(0x265)+_0x531a6f));const _0x7fa77f=await withSpinner(_0x12cbc7(0x263)+_0x531a6f+_0x12cbc7(0x2e2),()=>_0x3bd8a1[_0x12cbc7(0x303)]['listFields'](_0x531a6f),{'verbose':_0x1220c3['verbose']}),_0x27ec21=_0x7fa77f['data'];console['error'](_0x12cbc7(0x32f)+_0x27ec21[_0x12cbc7(0x27a)]+_0x12cbc7(0x234)+(_0x27ec21['length']!==0x1?'s':''));if(_0x1220c3['json']||_0x1220c3[_0x12cbc7(0x249)])return await handleSDKOutput(_0x27ec21,_0x1220c3),0x0;return displayFieldsHumanReadable(_0x27ec21,_0x531a6f),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x1bd28d(0x210);['description']=a22_0x1bd28d(0x21f);async['execute'](_0x1e4158){const _0x1d444b=a22_0x1bd28d,{options:_0x3fbada,args:_0x368540,tdx:_0x3b8321}=_0x1e4158,_0x2142bb=_0x3fbada,_0x5c492e=_0x368540[0x0]||_0x3fbada[_0x1d444b(0x36e)];if(!_0x5c492e)return showParentSegmentNotSetError(_0x1d444b(0x355)+_0x1d444b(0x369)+'Options:\x0a'+_0x1d444b(0x255)),0x1;_0x3fbada[_0x1d444b(0x361)]&&(console[_0x1d444b(0x268)](_0x1d444b(0x338)+_0x3fbada['site']),console['error'](_0x1d444b(0x265)+_0x5c492e));const _0x114921=await withSpinner(_0x1d444b(0x25f)+_0x5c492e+_0x1d444b(0x2e2),()=>_0x3b8321['segment'][_0x1d444b(0x23d)](_0x5c492e),{'verbose':_0x3fbada[_0x1d444b(0x361)]}),_0x391e04=_0x114921[_0x1d444b(0x291)];if(_0x2142bb[_0x1d444b(0x243)]){const _0x53556a=getConsoleNextUrl(_0x2142bb[_0x1d444b(0x26a)],'/app/dw/parentSegments/'+_0x391e04['id']);return console['error'](a22_0x2af8d7[_0x1d444b(0x2dd)]('✔')+_0x1d444b(0x1e3)+a22_0x2af8d7[_0x1d444b(0x2db)](_0x53556a)),openBrowser(_0x53556a),0x0;}return await handleSingleObjectOutput(_0x391e04,_0x3fbada),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x35c);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x2cb);async[a22_0x1bd28d(0x323)](_0x2643d6){const _0x332a09=a22_0x1bd28d,{options:_0xc91d00,args:_0x3110c5,tdx:_0x4143fb}=_0x2643d6,_0x225fbd=_0xc91d00,_0x4f3657=_0x3110c5[0x0]||_0xc91d00[_0x332a09(0x36e)];if(!_0x4f3657)return showParentSegmentNotSetError(_0x332a09(0x2a4)+_0x332a09(0x202)+_0x332a09(0x227)+_0x332a09(0x24e)),0x1;_0xc91d00['verbose']&&(console['error']('Site:\x20'+_0xc91d00[_0x332a09(0x26a)]),console['error']('Parent\x20segment:\x20'+_0x4f3657));const _0x5c5dcf=await withSpinner(_0x332a09(0x34f)+_0x4f3657+'\x27...',()=>_0x4143fb[_0x332a09(0x303)][_0x332a09(0x225)](_0x4f3657),{'verbose':_0xc91d00[_0x332a09(0x361)]}),_0x768019=_0x5c5dcf[_0x332a09(0x291)],_0x419aca=_0x4143fb['segment'][_0x332a09(0x2ea)](_0x768019);if(_0x225fbd[_0x332a09(0x278)]){const _0x11fb38=await this[_0x332a09(0x2f7)](_0x2643d6,_0x4f3657,_0x768019,_0x419aca),_0x5b5358=this[_0x332a09(0x23f)](_0x11fb38);writeFileSync(_0x225fbd[_0x332a09(0x278)],_0x5b5358);const _0x2cf0ec=_0x11fb38[_0x332a09(0x339)]['columns'][_0x332a09(0x27a)]+_0x11fb38[_0x332a09(0x377)]['reduce']((_0x221747,_0x32730a)=>_0x221747+_0x32730a[_0x332a09(0x32e)][_0x332a09(0x27a)],0x0),_0x32c2e0=_0x11fb38[_0x332a09(0x377)]['filter'](_0x456cc9=>_0x456cc9[_0x332a09(0x32e)][_0x332a09(0x27a)]===0x0)[_0x332a09(0x27a)];return console[_0x332a09(0x301)](_0x332a09(0x322)+_0x225fbd[_0x332a09(0x278)]),console[_0x332a09(0x301)](_0x332a09(0x330)+_0x419aca),console[_0x332a09(0x301)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x11fb38[_0x332a09(0x377)][_0x332a09(0x27a)]+_0x332a09(0x275)),console[_0x332a09(0x301)](_0x332a09(0x21d)+_0x2cf0ec+_0x332a09(0x2b3)),_0x32c2e0>0x0&&console[_0x332a09(0x301)](_0x332a09(0x2d7)+_0x32c2e0+_0x332a09(0x363)),0x0;}console[_0x332a09(0x268)]('\x0a'+a22_0x2af8d7[_0x332a09(0x274)](_0x332a09(0x2d9))+'\x20'+a22_0x2af8d7['cyan'](_0x419aca));const _0x1c89d8=await withSpinner(_0x332a09(0x207),()=>_0x4143fb[_0x332a09(0x303)]['getParentSQL'](_0x768019),{'verbose':_0xc91d00[_0x332a09(0x361)]});console['error']('\x0a'+a22_0x2af8d7[_0x332a09(0x274)](_0x332a09(0x339))+'\x20'+a22_0x2af8d7[_0x332a09(0x1f6)]('('+_0x419aca+'.customers)'));const _0x86dc29=await executeSchemaQuery(_0x1c89d8['data'],_0x4143fb,_0xc91d00);await handleQueryOutput(_0x86dc29,_0xc91d00);const _0x1ff48a=await withSpinner(_0x332a09(0x29e),()=>_0x4143fb[_0x332a09(0x303)][_0x332a09(0x378)](_0x768019),{'verbose':_0xc91d00[_0x332a09(0x361)]});for(const _0x29ee80 of _0x1ff48a[_0x332a09(0x291)]){const _0x244c40=_0x332a09(0x22e)+_0x29ee80[_0x332a09(0x342)]()['replace'](/\s+/g,'_'),_0x4a1101='SELECT\x20*\x20FROM\x20'+_0x419aca+'.'+_0x244c40;console[_0x332a09(0x268)]('\x0a'+a22_0x2af8d7[_0x332a09(0x274)](_0x29ee80)+'\x20'+a22_0x2af8d7[_0x332a09(0x1f6)]('('+_0x419aca+'.'+_0x244c40+')'));try{const _0x588139=await executeSchemaQuery(_0x4a1101,_0x4143fb,_0xc91d00);await handleQueryOutput(_0x588139,_0xc91d00);}catch{console['error'](a22_0x2af8d7[_0x332a09(0x374)](_0x332a09(0x26e)));}}return 0x0;}async[a22_0x1bd28d(0x2f7)](_0x38cedd,_0x124f6a,_0x3be670,_0x2f117c){const _0x732e31=a22_0x1bd28d,{options:_0x496b30,tdx:_0x2c222c}=_0x38cedd,_0x4a5dac=await withSpinner(_0x732e31(0x207),()=>_0x2c222c[_0x732e31(0x303)][_0x732e31(0x2a1)](_0x3be670),{'verbose':_0x496b30[_0x732e31(0x361)]}),_0xa2b6f5=await executeSchemaQuery(_0x4a5dac[_0x732e31(0x291)],_0x2c222c,_0x496b30),_0x42a6b5=_0xa2b6f5[_0x732e31(0x291)][_0x732e31(0x32b)](_0x39fe8a=>({'name':_0x39fe8a[_0x732e31(0x2aa)],'type':_0x39fe8a[_0x732e31(0x261)]})),_0x287a0c=await withSpinner(_0x732e31(0x29e),()=>_0x2c222c[_0x732e31(0x303)][_0x732e31(0x378)](_0x3be670),{'verbose':_0x496b30[_0x732e31(0x361)]}),_0x4c5e9b=[];for(const _0xf79275 of _0x287a0c[_0x732e31(0x291)]){const _0x304db2='behavior_'+_0xf79275[_0x732e31(0x342)]()[_0x732e31(0x218)](/\s+/g,'_'),_0x166f33=_0x732e31(0x2c6)+_0x2f117c+'.'+_0x304db2;let _0x327058=[];try{const _0x4f2293=await executeSchemaQuery(_0x166f33,_0x2c222c,_0x496b30);_0x327058=_0x4f2293[_0x732e31(0x291)][_0x732e31(0x32b)](_0x5c8290=>({'name':_0x5c8290[_0x732e31(0x2aa)],'type':_0x5c8290[_0x732e31(0x261)]}));}catch{}_0x4c5e9b[_0x732e31(0x23a)]({'table':_0x304db2,'columns':_0x327058});}return{'database':_0x2f117c,'parent_segment':_0x124f6a,'parent_id':_0x3be670,'customers':{'table':_0x732e31(0x339),'columns':_0x42a6b5},'behaviors':_0x4c5e9b};}['formatSchemaJson'](_0x33af4f){const _0x497f80=a22_0x1bd28d,_0x2fcb8d=_0x33abd4=>{const _0x21f6a4=a22_0x212e;if(_0x33abd4[_0x21f6a4(0x27a)]===0x0)return'[]';const _0x36585c=_0x33abd4[_0x21f6a4(0x32b)](_0x361170=>_0x21f6a4(0x2d1)+_0x361170[_0x21f6a4(0x2d4)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x361170['type']+_0x21f6a4(0x2ca));return'[\x0a'+_0x36585c['join'](',\x0a')+_0x21f6a4(0x321);},_0x17f406=_0x33af4f['behaviors'][_0x497f80(0x32b)](_0x1289dc=>{const _0xb6fc00=_0x497f80;return _0xb6fc00(0x1e2)+_0x1289dc[_0xb6fc00(0x2fd)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x2fcb8d(_0x1289dc[_0xb6fc00(0x32e)])[_0xb6fc00(0x218)](/^/gm,'\x20\x20')[_0xb6fc00(0x306)]()+_0xb6fc00(0x292);})[_0x497f80(0x1f9)](',\x0a');return _0x497f80(0x231)+_0x33af4f['database']+_0x497f80(0x333)+_0x33af4f['parent_segment']+_0x497f80(0x1f8)+_0x33af4f[_0x497f80(0x25c)]+_0x497f80(0x239)+_0x33af4f['customers']['table']+_0x497f80(0x25a)+_0x2fcb8d(_0x33af4f['customers']['columns'])[_0x497f80(0x218)](/^/gm,'\x20\x20')[_0x497f80(0x306)]()+_0x497f80(0x313)+_0x17f406+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x1bd28d(0x2a6);[a22_0x1bd28d(0x300)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x32b8ab){const _0x59a823=a22_0x1bd28d,{options:_0x5ca81f,args:_0x420fa6,tdx:_0x2ed820}=_0x32b8ab,_0x4df8cd=_0x420fa6[0x0]||_0x5ca81f[_0x59a823(0x36e)];if(!_0x4df8cd)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'+_0x59a823(0x293)),0x1;_0x5ca81f[_0x59a823(0x361)]&&(console[_0x59a823(0x268)]('Site:\x20'+_0x5ca81f[_0x59a823(0x26a)]),console['error'](_0x59a823(0x265)+_0x4df8cd));const _0x141b16=await withSpinner(_0x59a823(0x34f)+_0x4df8cd+_0x59a823(0x2e2),()=>_0x2ed820['segment'][_0x59a823(0x225)](_0x4df8cd),{'verbose':_0x5ca81f['verbose']}),_0x2f4061=_0x141b16[_0x59a823(0x291)],_0x43294f=await withSpinner(_0x59a823(0x371)+_0x4df8cd+'\x27...',()=>_0x2ed820['segment'][_0x59a823(0x2a1)](_0x2f4061),{'verbose':_0x5ca81f['verbose']}),_0x57042b=_0x43294f[_0x59a823(0x291)];return _0x5ca81f[_0x59a823(0x26d)]===_0x59a823(0x200)||_0x5ca81f['format']===_0x59a823(0x249)?await handleSDKOutput([{'sql':_0x57042b}],_0x5ca81f):console[_0x59a823(0x301)](_0x57042b),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x35f);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x302);async['execute'](_0x4c1ad6){const _0x26dfd5=a22_0x1bd28d,{options:_0x1d27e0,args:_0x16ec48,tdx:_0x39cfe0}=_0x4c1ad6,_0x5cd2bf=_0x16ec48[0x0]||_0x1d27e0[_0x26dfd5(0x36e)];if(!_0x5cd2bf)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'+_0x26dfd5(0x2d6)),0x1;_0x1d27e0[_0x26dfd5(0x361)]&&(console[_0x26dfd5(0x268)](_0x26dfd5(0x338)+_0x1d27e0['site']),console['error'](_0x26dfd5(0x265)+_0x5cd2bf));const _0x13b84d=await withSpinner(_0x26dfd5(0x34f)+_0x5cd2bf+'\x27...',()=>_0x39cfe0['segment'][_0x26dfd5(0x225)](_0x5cd2bf),{'verbose':_0x1d27e0[_0x26dfd5(0x361)]}),_0x2f6bbc=_0x13b84d['data'],_0xb819e0=await withSpinner(_0x26dfd5(0x371)+_0x5cd2bf+'\x27...',()=>_0x39cfe0['segment'][_0x26dfd5(0x2a1)](_0x2f6bbc),{'verbose':_0x1d27e0['verbose']});let _0x3dda98=_0xb819e0[_0x26dfd5(0x291)];const _0x1d0da7=resolveLimit(_0x1d27e0[_0x26dfd5(0x2bc)],DEFAULT_DISPLAY_LIMIT),_0x27e72a=/\bLIMIT\s+\d+/i[_0x26dfd5(0x1e8)](_0x3dda98);!_0x27e72a&&(_0x3dda98=_0x3dda98[_0x26dfd5(0x306)]()[_0x26dfd5(0x218)](/;+$/,''),_0x3dda98='SELECT\x20*\x20FROM\x20(\x0a'+_0x3dda98+_0x26dfd5(0x331)+_0x1d0da7);_0x1d27e0[_0x26dfd5(0x361)]&&console['error'](_0x26dfd5(0x2c2)+_0x3dda98);const _0x40007e=await withProgressSpinner(_0x26dfd5(0x2bf),async _0xad31dc=>{const _0x5907f3=_0x26dfd5,_0x2903db=await _0x39cfe0[_0x5907f3(0x2cf)][_0x5907f3(0x323)](_0x3dda98,{'catalog':'td','schema':_0x5907f3(0x224),'onJobId':_0x1fbba5=>{const _0x322642=_0x5907f3;_0xad31dc[_0x322642(0x2eb)](_0x1fbba5);}});return _0x2903db;},{'verbose':_0x1d27e0['verbose']}),_0x1641d2=_0x40007e[_0x26dfd5(0x291)],_0x2f00b5=_0x1641d2['jobId']?_0x26dfd5(0x2ba)+_0x1641d2[_0x26dfd5(0x352)]+']':'';return console['error'](_0x26dfd5(0x31c)+_0x1641d2[_0x26dfd5(0x222)][_0x26dfd5(0x305)][_0x26dfd5(0x356)]()+_0x26dfd5(0x317)+(_0x26dfd5(0x277)+formatElapsed(_0x1641d2[_0x26dfd5(0x222)][_0x26dfd5(0x2a9)])+_0x2f00b5)),await handleQueryOutput(_0x1641d2,_0x1d27e0),0x0;}}function a22_0x212e(_0x35071d,_0x50be9d){_0x35071d=_0x35071d-0x1dd;const _0xcabe50=a22_0xcabe();let _0x212ee2=_0xcabe50[_0x35071d];return _0x212ee2;}export class PSRtListCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x2c7);['description']=a22_0x1bd28d(0x29d);async[a22_0x1bd28d(0x323)](_0x533fad){const _0x50a1c2=a22_0x1bd28d,{options:_0x265049,args:_0x36278b,tdx:_0x424f53}=_0x533fad,_0x50f75b=_0x36278b[0x0],_0x546caa=await withSpinner(_0x50f75b?_0x50a1c2(0x28a)+_0x50f75b+_0x50a1c2(0x2e2):_0x50a1c2(0x1fa),()=>_0x424f53['realtime'][_0x50a1c2(0x24c)](),{'verbose':_0x265049['verbose']});let _0x1eec55=_0x546caa[_0x50a1c2(0x291)][_0x50a1c2(0x27c)](_0xdc062a=>_0xdc062a[_0x50a1c2(0x1ef)]);if(_0x50f75b){const _0x1ca7bd=_0x50f75b[_0x50a1c2(0x218)](/[.+^${}()|[\]\\]/g,_0x50a1c2(0x205))[_0x50a1c2(0x218)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x482a9e=new RegExp('^'+_0x1ca7bd+'$','i');_0x1eec55=_0x1eec55[_0x50a1c2(0x27c)](_0x2cd73e=>_0x482a9e['test'](_0x2cd73e[_0x50a1c2(0x2d4)]));}_0x1eec55[_0x50a1c2(0x1e7)]((_0x117a6c,_0x4c2140)=>_0x117a6c[_0x50a1c2(0x2d4)][_0x50a1c2(0x1e6)](_0x4c2140[_0x50a1c2(0x2d4)])),console[_0x50a1c2(0x268)](_0x50a1c2(0x32f)+_0x1eec55[_0x50a1c2(0x27a)]+_0x50a1c2(0x2b1)+(_0x1eec55[_0x50a1c2(0x27a)]!==0x1?'s':''));const _0x43ebd2=_0xa715b5=>{const _0x4759c3=_0x50a1c2;return getConsoleNextUrl(_0x265049[_0x4759c3(0x26a)],_0x4759c3(0x20f)+_0xa715b5);};if(_0x265049[_0x50a1c2(0x26d)]===_0x50a1c2(0x200)||_0x265049[_0x50a1c2(0x26d)]==='jsonl'){const _0x2aaa5e=_0x1eec55['map'](_0x683a30=>({..._0x683a30,'url':_0x43ebd2(_0x683a30['id'])}));await handleSDKOutput(_0x2aaa5e,_0x265049);}else{if(_0x1eec55[_0x50a1c2(0x27a)]===0x0)console['log'](_0x50a1c2(0x27e));else for(const _0x14ad0a of _0x1eec55){const _0x2eb0c4=_0x14ad0a[_0x50a1c2(0x2a0)]?a22_0x2af8d7[_0x50a1c2(0x1f6)]('\x20('+formatRows(_0x14ad0a[_0x50a1c2(0x2a0)])+')'):'',_0x469873=hyperlink(_0x14ad0a[_0x50a1c2(0x2d4)],_0x43ebd2(_0x14ad0a['id']));console[_0x50a1c2(0x301)]('⚡\x20'+_0x469873+_0x2eb0c4);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x1bd28d(0x2d4)]='ps:rt:validate';[a22_0x1bd28d(0x300)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async['execute'](_0x5e45e0){const _0x458dde=a22_0x1bd28d,{options:_0x39e5d5,args:_0x2220b0,tdx:_0x292c8b}=_0x5e45e0,_0x1356bc=_0x2220b0[0x0]||_0x39e5d5['parentSegment'];if(!_0x1356bc)return showParentSegmentNotSetError(_0x458dde(0x1e5)+_0x458dde(0x341)),0x1;const _0xb6fd92=resolveYamlFile(_0x1356bc);if(!existsSync(_0xb6fd92))return showFileNotFoundError(_0xb6fd92,_0x1356bc),0x1;let _0x181664;try{_0x181664=readFileSync(_0xb6fd92,_0x458dde(0x379));}catch(_0x14d05c){const _0xa5494b=_0x14d05c instanceof Error?_0x14d05c['message']:String(_0x14d05c);return console['error'](_0x458dde(0x344)+_0xa5494b),0x1;}const _0x74fc32=createCommandSpinner(a22_0x2af8d7['dim'](_0x458dde(0x1e4)),{'verbose':_0x39e5d5[_0x458dde(0x361)]});_0x74fc32[_0x458dde(0x279)]();const _0x111268={'realtime':!![],'onProgress':_0xc6e655=>{const _0x2035b8=_0x458dde;_0x74fc32[_0x2035b8(0x23e)]=formatProgressMessage(_0xc6e655);}};let _0x29f43e;try{_0x29f43e=await _0x292c8b[_0x458dde(0x303)]['validateParentYaml'](_0x181664,_0x111268),_0x74fc32[_0x458dde(0x229)]();}catch(_0x3f56af){_0x74fc32['stop']();throw _0x3f56af;}console[_0x458dde(0x268)]('\x0a'+a22_0x2af8d7[_0x458dde(0x274)](_0x458dde(0x1f7))+'\x20'+_0x29f43e['name']),console[_0x458dde(0x268)]('═'[_0x458dde(0x203)](0x3c)),displayRealtimeValidation(_0x29f43e),console['error']('─'[_0x458dde(0x203)](0x3c));if(_0x29f43e[_0x458dde(0x288)][_0x458dde(0x27a)]>0x0){console[_0x458dde(0x268)]('\x0a'+a22_0x2af8d7[_0x458dde(0x285)](_0x458dde(0x35e)));for(const _0x540bac of _0x29f43e[_0x458dde(0x288)]){console['error']('\x20\x20'+a22_0x2af8d7[_0x458dde(0x285)]('•')+'\x20'+_0x540bac);}}return _0x29f43e[_0x458dde(0x273)]&&console[_0x458dde(0x268)]('\x0a'+a22_0x2af8d7[_0x458dde(0x2dd)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x29f43e[_0x458dde(0x273)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x2f1);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x283);async['execute'](_0x4f8ccd){const _0x3c87da=a22_0x1bd28d,{options:_0x2a5963,args:_0x5ddb55,tdx:_0x15a9b1}=_0x4f8ccd,_0x1aeecc=_0x5ddb55[0x0]||_0x2a5963[_0x3c87da(0x36e)];if(!_0x1aeecc)return showParentSegmentNotSetError(_0x3c87da(0x328)+_0x3c87da(0x2d2)),0x1;const _0x30e9ae=await withSpinner(_0x3c87da(0x34f)+_0x1aeecc+'\x27...',()=>_0x15a9b1[_0x3c87da(0x303)][_0x3c87da(0x225)](_0x1aeecc),{'verbose':_0x2a5963['verbose']}),_0x23e177=_0x30e9ae[_0x3c87da(0x291)],_0x314fe9=await withSpinner(_0x3c87da(0x236)+_0x1aeecc+_0x3c87da(0x2e2),()=>_0x15a9b1[_0x3c87da(0x244)]['list'](_0x23e177),{'verbose':_0x2a5963['verbose']}),_0x4be1b2=_0x314fe9[_0x3c87da(0x291)];console['error']('✔\x20Found\x20'+_0x4be1b2[_0x3c87da(0x27a)]+_0x3c87da(0x213)+(_0x4be1b2[_0x3c87da(0x27a)]!==0x1?'s':''));if(_0x2a5963[_0x3c87da(0x26d)]==='json'||_0x2a5963[_0x3c87da(0x26d)]===_0x3c87da(0x249))await handleSDKOutput(_0x4be1b2,_0x2a5963);else{if(_0x4be1b2['length']===0x0)console[_0x3c87da(0x301)](_0x3c87da(0x21c)),console[_0x3c87da(0x268)](a22_0x2af8d7['cyan'](_0x3c87da(0x2cc)));else for(const _0x1886f9 of _0x4be1b2){const _0x33e72e=_0x1886f9[_0x3c87da(0x1fb)]?.[_0x3c87da(0x27a)]||0x0,_0x1f2c1a=_0x1886f9['trigger_event']?a22_0x2af8d7[_0x3c87da(0x1f6)]('\x20trigger='+_0x1886f9[_0x3c87da(0x241)]):'',_0x550724=a22_0x2af8d7[_0x3c87da(0x1f6)]('\x20('+_0x33e72e+_0x3c87da(0x347)+(_0x33e72e!==0x1?'s':'')+')');console[_0x3c87da(0x301)]('\x20\x20'+_0x1886f9[_0x3c87da(0x2d4)]+_0x1f2c1a+_0x550724),_0x1886f9[_0x3c87da(0x300)]&&console['log'](_0x3c87da(0x2dc)+a22_0x2af8d7[_0x3c87da(0x1f6)](_0x1886f9['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x1bd28d(0x2d4)]=a22_0x1bd28d(0x337);[a22_0x1bd28d(0x300)]=a22_0x1bd28d(0x20e);async['execute'](_0x4427db){const _0x289bd5=a22_0x1bd28d,{options:_0x40d194,args:_0x3c5a4d}=_0x4427db,_0x819a25=_0x3c5a4d[0x0]||_0x40d194[_0x289bd5(0x36e)];if(!_0x819a25)return showParentSegmentNotSetError(_0x289bd5(0x228)+_0x289bd5(0x21a)),0x1;const _0x4c0503=resolveYamlFile(_0x819a25);if(!existsSync(_0x4c0503))return showFileNotFoundError(_0x4c0503,_0x819a25),0x1;let _0x339b9c;try{_0x339b9c=readFileSync(_0x4c0503,_0x289bd5(0x379));}catch(_0x183245){const _0x562087=_0x183245 instanceof Error?_0x183245[_0x289bd5(0x31b)]:String(_0x183245);return console['error']('Error\x20reading\x20file:\x20'+_0x562087),0x1;}let _0x508797;try{_0x508797=parseDef(_0x339b9c);}catch(_0xf6dd0e){const _0x23e160=_0xf6dd0e instanceof Error?_0xf6dd0e[_0x289bd5(0x31b)]:String(_0xf6dd0e);return console[_0x289bd5(0x268)](a22_0x2af8d7[_0x289bd5(0x285)](_0x289bd5(0x2b9)+_0x23e160)),0x1;}if(_0x508797[_0x289bd5(0x248)]&&_0x508797[_0x289bd5(0x248)][_0x289bd5(0x27a)]>0x0)return console[_0x289bd5(0x268)](a22_0x2af8d7[_0x289bd5(0x374)](_0x289bd5(0x1f0)+_0x4c0503)),console[_0x289bd5(0x268)](a22_0x2af8d7[_0x289bd5(0x1f6)](_0x289bd5(0x2ac)+_0x508797['personalization_services'][_0x289bd5(0x27a)]+_0x289bd5(0x221))),0x1;!_0x508797[_0x289bd5(0x2f4)]&&(_0x508797[_0x289bd5(0x2f4)]={'events':[{'name':_0x289bd5(0x348),'source_table':_0x289bd5(0x2f8)}],'attributes':[{'name':_0x289bd5(0x1eb),'type':_0x289bd5(0x2af)}],'id_stitching':{'primary_key':_0x508797[_0x289bd5(0x215)][_0x289bd5(0x2fd)]==='customers'?_0x289bd5(0x237):_0x289bd5(0x2ab)}});_0x508797[_0x289bd5(0x248)]=[{'name':_0x289bd5(0x325),'description':_0x289bd5(0x299),'trigger_event':'page_view','sections':[{'name':'Default','criteria':_0x289bd5(0x367),'attributes':[_0x289bd5(0x1eb)]}]}];const _0x3f1788=serializeDef(_0x508797);return writeFileSync(_0x4c0503,_0x3f1788,_0x289bd5(0x379)),console[_0x289bd5(0x268)](a22_0x2af8d7[_0x289bd5(0x2dd)]('✔')+_0x289bd5(0x208)+a22_0x2af8d7[_0x289bd5(0x2db)](_0x4c0503)),(!_0x508797[_0x289bd5(0x2f4)]||_0x339b9c[_0x289bd5(0x30e)](_0x289bd5(0x1ea))===-0x1)&&console[_0x289bd5(0x268)](a22_0x2af8d7['green']('✔')+_0x289bd5(0x2b6)),console[_0x289bd5(0x268)]('\x0a'+a22_0x2af8d7[_0x289bd5(0x1f6)](_0x289bd5(0x2f5))),console[_0x289bd5(0x268)](_0x289bd5(0x1ec)+_0x4c0503+_0x289bd5(0x27f)),console[_0x289bd5(0x268)](_0x289bd5(0x2ff)+a22_0x2af8d7[_0x289bd5(0x1f6)](_0x289bd5(0x226)+_0x819a25)+_0x289bd5(0x314)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x692e58=a23_0x40fb;(function(_0x311085,_0x485aa4){const _0x3d8fd7=a23_0x40fb,_0x23b48c=_0x311085();while(!![]){try{const _0x1edc66=parseInt(_0x3d8fd7(0x1ae))/0x1+parseInt(_0x3d8fd7(0x1d9))/0x2*(parseInt(_0x3d8fd7(0x1de))/0x3)+parseInt(_0x3d8fd7(0x181))/0x4*(parseInt(_0x3d8fd7(0x18b))/0x5)+-parseInt(_0x3d8fd7(0x1d2))/0x6+-parseInt(_0x3d8fd7(0x1ba))/0x7+parseInt(_0x3d8fd7(0x1cf))/0x8*(-parseInt(_0x3d8fd7(0x1c9))/0x9)+-parseInt(_0x3d8fd7(0x186))/0xa;if(_0x1edc66===_0x485aa4)break;else _0x23b48c['push'](_0x23b48c['shift']());}catch(_0x33d2a7){_0x23b48c['push'](_0x23b48c['shift']());}}}(a23_0x52e2,0x23105));function a23_0x40fb(_0x114849,_0x50caaa){_0x114849=_0x114849-0x16e;const _0x52e296=a23_0x52e2();let _0x40fb7f=_0x52e296[_0x114849];return _0x40fb7f;}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_0x275efd from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x353397 from'prompts';import a23_0x5ed705 from'chalk';function validateProfileName(_0x139401){const _0x1e8733=a23_0x40fb;if(!_0x139401||!_0x139401['trim']())return _0x1e8733(0x1a9);const _0x242376=_0x139401[_0x1e8733(0x1d3)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1e8733(0x192)](_0x242376))return _0x1e8733(0x1aa);if(profileExists(_0x242376))return _0x1e8733(0x1b4)+_0x242376+_0x1e8733(0x178);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x692e58(0x19e)]=a23_0x692e58(0x1da);[a23_0x692e58(0x17b)]='Create\x20a\x20new\x20profile';async['execute'](_0x41c7cf){const _0x8732d5=a23_0x692e58,{options:_0x39d240,args:_0x83e217}=_0x41c7cf;console[_0x8732d5(0x179)](a23_0x5ed705[_0x8732d5(0x1b3)](_0x8732d5(0x1a7)));let _0x21bc7e;if(_0x83e217[_0x8732d5(0x1a3)]>0x0&&_0x83e217[0x0]){const _0x43b9a5=_0x83e217[0x0][_0x8732d5(0x1d3)](),_0x21b9b9=validateProfileName(_0x43b9a5);if(_0x21b9b9!==!![])return console[_0x8732d5(0x195)](a23_0x5ed705[_0x8732d5(0x1c7)](_0x21b9b9)),0x1;_0x21bc7e=_0x43b9a5;}else{const _0x3adbf3=await a23_0x353397({'type':_0x8732d5(0x18e),'name':_0x8732d5(0x180),'message':_0x8732d5(0x189),'validate':validateProfileName});if(!_0x3adbf3[_0x8732d5(0x180)])return console[_0x8732d5(0x179)]('\x0aSetup\x20cancelled'),0x1;_0x21bc7e=_0x3adbf3[_0x8732d5(0x180)]['trim']();}const _0x1a7d01=await a23_0x353397({'type':'text','name':_0x8732d5(0x17b),'message':'Enter\x20description\x20(optional):'}),_0x13d52d=_0x1a7d01[_0x8732d5(0x17b)]?.[_0x8732d5(0x1d3)]()||undefined,_0x4164f2=_0x39d240['site']||_0x8732d5(0x18c),{choices:_0x43937a,initialIndex:_0x53628e}=buildSiteChoices(_0x4164f2),_0xc95554=await a23_0x353397({'type':_0x8732d5(0x173),'name':_0x8732d5(0x1bd),'message':_0x8732d5(0x197)+_0x21bc7e+'\x27:','choices':_0x43937a,'initial':_0x53628e});if(!_0xc95554[_0x8732d5(0x1bd)])return console[_0x8732d5(0x179)]('\x0aSetup\x20cancelled'),0x1;let _0x234ea5;if(_0xc95554[_0x8732d5(0x1bd)]===_0x8732d5(0x1cd)){const _0x18cc8a=await a23_0x353397({'type':'text','name':_0x8732d5(0x1bc),'message':_0x8732d5(0x19c),'initial':_0x8732d5(0x18c),'validate':_0x830ca6=>{const _0x421ce1=_0x8732d5;if(!_0x830ca6||!_0x830ca6[_0x421ce1(0x1d3)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x421ce1(0x192)](_0x830ca6[_0x421ce1(0x1d3)]()))return _0x421ce1(0x16e);return!![];}});if(!_0x18cc8a['customSite'])return console[_0x8732d5(0x179)](_0x8732d5(0x194)),0x1;_0x234ea5=_0x18cc8a['customSite'];}else _0x234ea5=_0xc95554[_0x8732d5(0x1bd)];const _0x56aa40=resolveSite(_0x234ea5);console[_0x8732d5(0x179)](_0x8732d5(0x1c2)+_0x56aa40),console['log'](_0x8732d5(0x176)),console[_0x8732d5(0x179)]('\x20\x20'+getConsoleUrl(_0x56aa40,_0x8732d5(0x1be)));const _0x1b7bc3=await a23_0x353397({'type':_0x8732d5(0x1c5),'name':_0x8732d5(0x1cc),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5546de=>{const _0x3b7da1=_0x8732d5;if(!_0x5546de||!_0x5546de['trim']())return _0x3b7da1(0x1c6);return!![];}});if(!_0x1b7bc3[_0x8732d5(0x1cc)])return console['log'](_0x8732d5(0x194)),0x1;const _0x4c125f=_0x1b7bc3['apiKey'];console[_0x8732d5(0x179)](_0x8732d5(0x18d));try{const _0x114750=TDX[_0x8732d5(0x19b)]({'site':_0x56aa40,'apiKey':_0x4c125f['trim'](),'logLevel':_0x39d240[_0x8732d5(0x1d0)]??LogLevel[_0x8732d5(0x18f)]}),_0x596ebb=await _0x114750[_0x8732d5(0x182)][_0x8732d5(0x17a)]();console[_0x8732d5(0x179)](a23_0x5ed705[_0x8732d5(0x170)]('✓')+_0x8732d5(0x171)+_0x596ebb['email']+')');const _0x10a2c5=await isKeychainAvailable();_0x10a2c5?(await saveAPIKeyAsync(_0x4c125f['trim'](),_0x56aa40,_0x21bc7e),console['log'](a23_0x5ed705[_0x8732d5(0x170)]('✓')+_0x8732d5(0x1ad)+_0x21bc7e+')')):(console[_0x8732d5(0x19a)](a23_0x5ed705[_0x8732d5(0x1d8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x8732d5(0x19a)](a23_0x5ed705[_0x8732d5(0x1d8)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2f8a24={'site':_0x56aa40,..._0x13d52d&&{'description':_0x13d52d}};return saveProfileToUserConfig(_0x21bc7e,_0x2f8a24),console[_0x8732d5(0x179)](a23_0x5ed705[_0x8732d5(0x170)]('✓')+_0x8732d5(0x1a0)+_0x21bc7e+_0x8732d5(0x1c8)),console[_0x8732d5(0x179)](),console[_0x8732d5(0x179)](_0x8732d5(0x174)),console[_0x8732d5(0x179)]('\x20\x20tdx\x20--profile\x20'+_0x21bc7e+_0x8732d5(0x1d1)),console[_0x8732d5(0x179)](_0x8732d5(0x188)+_0x21bc7e+_0x8732d5(0x175)),0x0;}catch(_0x225b5b){if(_0x225b5b instanceof HTTPClientError&&_0x225b5b[_0x8732d5(0x1b2)]===0x191)return printAuthError(_0x225b5b),0x1;return console['error'](a23_0x5ed705[_0x8732d5(0x1c7)]('✗\x20Validation\x20failed:\x20'+(_0x225b5b instanceof Error?_0x225b5b[_0x8732d5(0x1c1)]:String(_0x225b5b)))),console[_0x8732d5(0x195)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a23_0x52e2(){const _0x1b2ac8=['\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','179249NTXQCm','\x27\x20updated:\x20','join','default','status','bold','Profile\x20\x27','confirm','\x0aSaved\x20to:\x20','llm_agent','Default\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','1393469mkqpZf','profile:remove','customSite','site','/app/mp/ak','session','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','message','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','tdx.json','\x27\x20removed\x20from\x20configuration','password','API\x20key\x20cannot\x20be\x20empty','red','\x27\x20created','1316898QRXIyL','config','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','apiKey','other','\x20--default\x27\x20to\x20save\x20permanently','8cuWXHZ','logLevel','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','607050mumnvS','trim','validate','Remove\x20a\x20profile','\x20\x20-\x20','\x0aAvailable\x20profiles:','yellow','6368lPqmNI','profile:create','\x27.\x0a\x0aValid\x20keys:\x20','Session\x20profile\x20set\x20to:\x20','VALID_KEYS','270RjRblv','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','green','\x20API\x20key\x20is\x20valid\x20(User:\x20','Operation\x20cancelled','select','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','log','getUserInfo','description','email','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>','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20set','profileName','8fFJYIj','jobs','(session:\x20','execute','includes','401960jaTkbS','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20\x20tdx\x20--profile\x20','Enter\x20profile\x20name:','profile:use','411430OLPqgI','us01','Validating\x20API\x20key...','text','ERROR','(cleared)','Site\x20was\x20not\x20changed.','test','parent_segment','\x0aSetup\x20cancelled','error','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20\x20(no\x20profiles\x20found)','profile','warn','create','Enter\x20site\x20name:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','name','split','\x20Profile\x20\x27','\x0aOperation\x20cancelled','profile:set','length','Removal\x20cancelled','Set\x20a\x20profile\x20configuration\x20value','\x20API\x20key\x20removed\x20from\x20system\x20keychain','tdx:\x20profile\x20create','✗\x20Validation\x20failed:\x20','Profile\x20name\x20cannot\x20be\x20empty','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','database','Changing\x20site\x20to\x20\x27'];a23_0x52e2=function(){return _0x1b2ac8;};return a23_0x52e2();}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x692e58(0x1bb);['description']=a23_0x692e58(0x1d5);[a23_0x692e58(0x1d4)](_0x58d558){const _0x11a05c=a23_0x692e58,{args:_0x7ffcb4}=_0x58d558;if(_0x7ffcb4[_0x11a05c(0x1a3)]===0x0)return _0x11a05c(0x187);return undefined;}async[a23_0x692e58(0x184)](_0x550226){const _0x3d282f=a23_0x692e58,{args:_0x269813}=_0x550226,_0x2b5f46=_0x269813[0x0];console[_0x3d282f(0x179)](a23_0x5ed705['bold']('tdx:\x20profile\x20remove'));if(!profileExists(_0x2b5f46)){console[_0x3d282f(0x195)](a23_0x5ed705[_0x3d282f(0x1c7)]('Profile\x20\x27'+_0x2b5f46+_0x3d282f(0x1b9))),console[_0x3d282f(0x179)](_0x3d282f(0x1d7));const _0x18a63c=listProfiles();if(_0x18a63c[_0x3d282f(0x1a3)]===0x0)console[_0x3d282f(0x179)](_0x3d282f(0x198));else for(const _0x1129f2 of _0x18a63c){console[_0x3d282f(0x179)](_0x3d282f(0x1d6)+_0x1129f2[_0x3d282f(0x19e)]);}return 0x1;}const _0x2e1d42=await a23_0x353397({'type':_0x3d282f(0x1b5),'name':_0x3d282f(0x1b5),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x2b5f46+'\x27?','initial':![]});if(!_0x2e1d42[_0x3d282f(0x1b5)])return console[_0x3d282f(0x179)](_0x3d282f(0x1a4)),0x0;try{removeProfileFromUserConfig(_0x2b5f46),console[_0x3d282f(0x179)](a23_0x5ed705[_0x3d282f(0x170)]('✓')+_0x3d282f(0x1a0)+_0x2b5f46+_0x3d282f(0x1c4));}catch(_0x250bc2){return console[_0x3d282f(0x195)](a23_0x5ed705[_0x3d282f(0x1c7)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x250bc2 instanceof Error?_0x250bc2[_0x3d282f(0x1c1)]:String(_0x250bc2)))),0x1;}const _0x405850=await isKeychainAvailable();if(_0x405850){const _0x2c3bf2=await deleteKeychainAPIKey(_0x2b5f46);_0x2c3bf2&&console[_0x3d282f(0x179)](a23_0x5ed705[_0x3d282f(0x170)]('✓')+_0x3d282f(0x1a6));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a23_0x692e58(0x1a2);[a23_0x692e58(0x17b)]=a23_0x692e58(0x1a5);static [a23_0x692e58(0x1dd)]=['site',a23_0x692e58(0x1ab),a23_0x692e58(0x193),'llm_project',a23_0x692e58(0x1b7),a23_0x692e58(0x17b)];[a23_0x692e58(0x1d4)](_0xfff09a){const _0x2cf47b=a23_0x692e58,{args:_0x75c765,options:_0x1ce477}=_0xfff09a,_0x272d6a=_0x1ce477['profile']||getActiveProfile();if(!_0x272d6a)return _0x2cf47b(0x17d);if(_0x75c765[_0x2cf47b(0x1a3)]===0x0)return _0x2cf47b(0x1c0)+ProfileSetCommand['VALID_KEYS'][_0x2cf47b(0x1b0)](',\x20');const _0x58eebe=_0x75c765[0x0];if(!_0x58eebe['includes']('='))return _0x2cf47b(0x17e)+ProfileSetCommand[_0x2cf47b(0x1dd)][_0x2cf47b(0x1b0)](',\x20');const [_0x2ae129]=_0x58eebe[_0x2cf47b(0x19f)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x2cf47b(0x185)](_0x2ae129))return'Unknown\x20key\x20\x27'+_0x2ae129+_0x2cf47b(0x1db)+ProfileSetCommand[_0x2cf47b(0x1dd)]['join'](',\x20');return undefined;}async[a23_0x692e58(0x184)](_0x4a7c4a){const _0x3c459c=a23_0x692e58,{args:_0x1d3799,options:_0x5c349d}=_0x4a7c4a,_0x6b2a44=_0x5c349d[_0x3c459c(0x199)]||getActiveProfile(),[_0x26002e,..._0x2df3d3]=_0x1d3799[0x0][_0x3c459c(0x19f)]('='),_0x5802f9=_0x2df3d3[_0x3c459c(0x1b0)]('=');console['log'](a23_0x5ed705[_0x3c459c(0x1b3)](_0x3c459c(0x17f)));if(!profileExists(_0x6b2a44)){const _0x1b80f0=await a23_0x353397({'type':'confirm','name':_0x3c459c(0x19b),'message':_0x3c459c(0x1b4)+_0x6b2a44+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x1b80f0['create'])return console[_0x3c459c(0x179)](_0x3c459c(0x172)),0x1;}const _0x4a23b0=loadProfile(_0x6b2a44),_0x66b034=_0x4a23b0?.[_0x3c459c(0x1ca)]||{};if(_0x26002e===_0x3c459c(0x1bd)){const _0x186b5a=resolveSite(_0x5802f9);console[_0x3c459c(0x179)](_0x3c459c(0x1ac)+_0x186b5a+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x3c459c(0x16f)),console[_0x3c459c(0x179)]('\x20\x20'+getConsoleUrl(_0x186b5a,'/app/mp/ak'));const _0x38fbfb=await a23_0x353397({'type':_0x3c459c(0x1c5),'name':'apiKey','message':_0x3c459c(0x19d),'validate':_0x3b788f=>{if(!_0x3b788f||!_0x3b788f['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x38fbfb[_0x3c459c(0x1cc)])return console[_0x3c459c(0x179)](_0x3c459c(0x1a1)),0x1;console[_0x3c459c(0x179)](_0x3c459c(0x18d));try{const _0x1af34d=TDX['create']({'site':_0x186b5a,'apiKey':_0x38fbfb[_0x3c459c(0x1cc)]['trim'](),'logLevel':_0x5c349d['logLevel']??LogLevel[_0x3c459c(0x18f)]}),_0x1e542c=await _0x1af34d['jobs'][_0x3c459c(0x17a)]();console['log'](a23_0x5ed705[_0x3c459c(0x170)]('✓')+_0x3c459c(0x171)+_0x1e542c[_0x3c459c(0x17c)]+')');const _0x18681a=await isKeychainAvailable();_0x18681a?(await saveAPIKeyAsync(_0x38fbfb[_0x3c459c(0x1cc)][_0x3c459c(0x1d3)](),_0x186b5a,_0x6b2a44),console[_0x3c459c(0x179)](a23_0x5ed705[_0x3c459c(0x170)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x3c459c(0x19a)](a23_0x5ed705[_0x3c459c(0x1d8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x66b034[_0x3c459c(0x1bd)]=_0x186b5a;}catch(_0x5b0830){if(_0x5b0830 instanceof HTTPClientError&&_0x5b0830[_0x3c459c(0x1b2)]===0x191)return printAuthError(_0x5b0830),0x1;return console[_0x3c459c(0x195)](a23_0x5ed705['red'](_0x3c459c(0x1a8)+(_0x5b0830 instanceof Error?_0x5b0830['message']:String(_0x5b0830)))),console['error'](_0x3c459c(0x191)),0x1;}}else _0x66b034[_0x26002e]=_0x5802f9||undefined;return saveProfileToUserConfig(_0x6b2a44,_0x66b034),console[_0x3c459c(0x179)](a23_0x5ed705[_0x3c459c(0x170)]('✓')+_0x3c459c(0x1a0)+_0x6b2a44+_0x3c459c(0x1af)+_0x26002e+'='+(_0x5802f9||_0x3c459c(0x190))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x692e58(0x19e)]=a23_0x692e58(0x18a);[a23_0x692e58(0x17b)]='Set\x20session\x20profile';[a23_0x692e58(0x1d4)](_0x111bae){const _0x504b61=a23_0x692e58,{args:_0x2a0782}=_0x111bae;if(_0x2a0782[_0x504b61(0x1a3)]===0x0)return _0x504b61(0x1cb);return undefined;}async[a23_0x692e58(0x184)](_0x4698f5){const _0x15d1f1=a23_0x692e58,{args:_0x37af51,options:_0x1b5bc3}=_0x4698f5,_0x1b47b7=_0x37af51[0x0],_0x2896e7=_0x1b5bc3[_0x15d1f1(0x1b1)];cleanExpiredSessions();if(!profileExists(_0x1b47b7)){console['error'](a23_0x5ed705[_0x15d1f1(0x1c7)](_0x15d1f1(0x1b4)+_0x1b47b7+_0x15d1f1(0x1b9))),console['log'](_0x15d1f1(0x1d7));const _0x5f7b56=listProfiles();if(_0x5f7b56[_0x15d1f1(0x1a3)]===0x0)console[_0x15d1f1(0x179)](_0x15d1f1(0x198));else for(const _0x3a4361 of _0x5f7b56){console['log'](_0x15d1f1(0x1d6)+_0x3a4361[_0x15d1f1(0x19e)]);}return 0x1;}if(_0x2896e7){const _0x51432b=a23_0x275efd[_0x15d1f1(0x1b0)](getConfigDir(),_0x15d1f1(0x1c3));return saveActiveProfileToUserConfig(_0x1b47b7),console[_0x15d1f1(0x179)](_0x15d1f1(0x1b8)+a23_0x5ed705[_0x15d1f1(0x170)](_0x1b47b7)),console['log'](a23_0x5ed705['dim'](_0x15d1f1(0x1b6)+_0x51432b)),0x0;}const _0x1eb35b=getSessionID(_0x1b5bc3[_0x15d1f1(0x1bf)]);return saveSessionContext({'profile':_0x1b47b7},_0x1b5bc3[_0x15d1f1(0x1bf)]),console['log'](_0x15d1f1(0x1dc)+a23_0x5ed705[_0x15d1f1(0x170)](_0x1b47b7)+'\x20'+a23_0x5ed705[_0x15d1f1(0x177)](_0x15d1f1(0x183)+_0x1eb35b+')')),console[_0x15d1f1(0x179)](a23_0x5ed705[_0x15d1f1(0x177)](_0x15d1f1(0x196)+_0x1b47b7+_0x15d1f1(0x1ce))),0x0;}}
|
|
1
|
+
const a23_0x2177e5=a23_0x58cc;(function(_0x4173a1,_0xc252dc){const _0xaa3515=a23_0x58cc,_0xef9bab=_0x4173a1();while(!![]){try{const _0x1c194e=parseInt(_0xaa3515(0x182))/0x1*(parseInt(_0xaa3515(0x1ef))/0x2)+parseInt(_0xaa3515(0x1b1))/0x3*(-parseInt(_0xaa3515(0x1a3))/0x4)+parseInt(_0xaa3515(0x183))/0x5*(-parseInt(_0xaa3515(0x1bd))/0x6)+parseInt(_0xaa3515(0x19c))/0x7*(-parseInt(_0xaa3515(0x187))/0x8)+parseInt(_0xaa3515(0x1d2))/0x9*(-parseInt(_0xaa3515(0x1ec))/0xa)+parseInt(_0xaa3515(0x1c1))/0xb*(parseInt(_0xaa3515(0x1dc))/0xc)+parseInt(_0xaa3515(0x192))/0xd;if(_0x1c194e===_0xc252dc)break;else _0xef9bab['push'](_0xef9bab['shift']());}catch(_0x5ca846){_0xef9bab['push'](_0xef9bab['shift']());}}}(a23_0x26e5,0x3ee33));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_0x2fdafd from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x3336ce from'prompts';import a23_0x2d4229 from'chalk';function validateProfileName(_0x52d703){const _0x3a8509=a23_0x58cc;if(!_0x52d703||!_0x52d703[_0x3a8509(0x1ee)]())return _0x3a8509(0x1a1);const _0x532c42=_0x52d703[_0x3a8509(0x1ee)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3a8509(0x1ad)](_0x532c42))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x532c42))return _0x3a8509(0x1d9)+_0x532c42+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a23_0x2177e5(0x1a0);[a23_0x2177e5(0x1e5)]=a23_0x2177e5(0x1cd);async[a23_0x2177e5(0x1af)](_0x2b558d){const _0x3936c1=a23_0x2177e5,{options:_0x35e1d9,args:_0x304ac9}=_0x2b558d;console['log'](a23_0x2d4229[_0x3936c1(0x18c)](_0x3936c1(0x1aa)));let _0x31e123;if(_0x304ac9[_0x3936c1(0x185)]>0x0&&_0x304ac9[0x0]){const _0x4b4f6b=_0x304ac9[0x0]['trim'](),_0x5eba93=validateProfileName(_0x4b4f6b);if(_0x5eba93!==!![])return console[_0x3936c1(0x19b)](a23_0x2d4229[_0x3936c1(0x1c8)](_0x5eba93)),0x1;_0x31e123=_0x4b4f6b;}else{const _0x52d3ad=await a23_0x3336ce({'type':_0x3936c1(0x1c0),'name':_0x3936c1(0x1b0),'message':_0x3936c1(0x1eb),'validate':validateProfileName});if(!_0x52d3ad[_0x3936c1(0x1b0)])return console[_0x3936c1(0x1dd)]('\x0aSetup\x20cancelled'),0x1;_0x31e123=_0x52d3ad[_0x3936c1(0x1b0)][_0x3936c1(0x1ee)]();}const _0x330023=await a23_0x3336ce({'type':_0x3936c1(0x1c0),'name':_0x3936c1(0x1e5),'message':_0x3936c1(0x1a4)}),_0x3a1b34=_0x330023[_0x3936c1(0x1e5)]?.[_0x3936c1(0x1ee)]()||undefined,_0x4df6c3=_0x35e1d9[_0x3936c1(0x1e1)]||_0x3936c1(0x1e2),{choices:_0x1598fa,initialIndex:_0x3f5176}=buildSiteChoices(_0x4df6c3),_0x3865cf=await a23_0x3336ce({'type':_0x3936c1(0x1e4),'name':'site','message':_0x3936c1(0x190)+_0x31e123+'\x27:','choices':_0x1598fa,'initial':_0x3f5176});if(!_0x3865cf[_0x3936c1(0x1e1)])return console[_0x3936c1(0x1dd)](_0x3936c1(0x1b3)),0x1;let _0x2e6e3d;if(_0x3865cf[_0x3936c1(0x1e1)]===_0x3936c1(0x188)){const _0x28263e=await a23_0x3336ce({'type':'text','name':_0x3936c1(0x1e7),'message':_0x3936c1(0x18e),'initial':_0x3936c1(0x1e2),'validate':_0x393650=>{const _0x3ba7bf=_0x3936c1;if(!_0x393650||!_0x393650['trim']())return _0x3ba7bf(0x1d4);if(!/^[a-z0-9-]+$/['test'](_0x393650[_0x3ba7bf(0x1ee)]()))return _0x3ba7bf(0x1a8);return!![];}});if(!_0x28263e['customSite'])return console[_0x3936c1(0x1dd)](_0x3936c1(0x1b3)),0x1;_0x2e6e3d=_0x28263e[_0x3936c1(0x1e7)];}else _0x2e6e3d=_0x3865cf['site'];const _0x170ab7=resolveSite(_0x2e6e3d);console[_0x3936c1(0x1dd)](_0x3936c1(0x1ab)+_0x170ab7),console[_0x3936c1(0x1dd)](_0x3936c1(0x1b2)),console['log']('\x20\x20'+getConsoleUrl(_0x170ab7,_0x3936c1(0x1d8)));const _0x3753f3=await a23_0x3336ce({'type':_0x3936c1(0x181),'name':_0x3936c1(0x1a6),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x37df0f=>{const _0x17c9d8=_0x3936c1;if(!_0x37df0f||!_0x37df0f[_0x17c9d8(0x1ee)]())return _0x17c9d8(0x18a);return!![];}});if(!_0x3753f3['apiKey'])return console[_0x3936c1(0x1dd)](_0x3936c1(0x1b3)),0x1;const _0x4ce8b0=_0x3753f3['apiKey'];console[_0x3936c1(0x1dd)]('Validating\x20API\x20key...');try{const _0x52ea19=TDX['create']({'site':_0x170ab7,'apiKey':_0x4ce8b0[_0x3936c1(0x1ee)](),'logLevel':_0x35e1d9[_0x3936c1(0x1cb)]??LogLevel[_0x3936c1(0x1c4)]}),_0x435c56=await _0x52ea19[_0x3936c1(0x1da)][_0x3936c1(0x1bf)]();console[_0x3936c1(0x1dd)](a23_0x2d4229[_0x3936c1(0x199)]('✓')+_0x3936c1(0x1e8)+_0x435c56[_0x3936c1(0x193)]+')');const _0x235c1b=await isKeychainAvailable();_0x235c1b?(await saveAPIKeyAsync(_0x4ce8b0['trim'](),_0x170ab7,_0x31e123),console[_0x3936c1(0x1dd)](a23_0x2d4229[_0x3936c1(0x199)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x31e123+')')):(console['warn'](a23_0x2d4229[_0x3936c1(0x1c3)](_0x3936c1(0x1b6))),console[_0x3936c1(0x1d0)](a23_0x2d4229[_0x3936c1(0x1c3)](_0x3936c1(0x1c5))));const _0x9886b5={'site':_0x170ab7,..._0x3a1b34&&{'description':_0x3a1b34}};return saveProfileToUserConfig(_0x31e123,_0x9886b5),console[_0x3936c1(0x1dd)](a23_0x2d4229[_0x3936c1(0x199)]('✓')+_0x3936c1(0x1f0)+_0x31e123+'\x27\x20created'),console[_0x3936c1(0x1dd)](),console[_0x3936c1(0x1dd)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x3936c1(0x1dd)](_0x3936c1(0x1b9)+_0x31e123+_0x3936c1(0x1a7)),console['log'](_0x3936c1(0x1b9)+_0x31e123+_0x3936c1(0x186)),0x0;}catch(_0x1aa948){if(_0x1aa948 instanceof HTTPClientError&&_0x1aa948['status']===0x191)return printAuthError(_0x1aa948),0x1;return console[_0x3936c1(0x19b)](a23_0x2d4229['red'](_0x3936c1(0x1ba)+(_0x1aa948 instanceof Error?_0x1aa948[_0x3936c1(0x1d7)]:String(_0x1aa948)))),console[_0x3936c1(0x19b)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a23_0x58cc(_0x5161cf,_0x1aa226){_0x5161cf=_0x5161cf-0x181;const _0x26e5f4=a23_0x26e5();let _0x58ccd2=_0x26e5f4[_0x5161cf];return _0x58ccd2;}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x2177e5(0x18b);[a23_0x2177e5(0x1e5)]='Remove\x20a\x20profile';[a23_0x2177e5(0x191)](_0x40e4c1){const _0x222d1a=a23_0x2177e5,{args:_0x1a485a}=_0x40e4c1;if(_0x1a485a[_0x222d1a(0x185)]===0x0)return _0x222d1a(0x184);return undefined;}async['execute'](_0x264d27){const _0x56b1b6=a23_0x2177e5,{args:_0x4af1b1}=_0x264d27,_0x4a5351=_0x4af1b1[0x0];console[_0x56b1b6(0x1dd)](a23_0x2d4229[_0x56b1b6(0x18c)](_0x56b1b6(0x198)));if(!profileExists(_0x4a5351)){console[_0x56b1b6(0x19b)](a23_0x2d4229[_0x56b1b6(0x1c8)](_0x56b1b6(0x1d9)+_0x4a5351+_0x56b1b6(0x1b5))),console[_0x56b1b6(0x1dd)]('\x0aAvailable\x20profiles:');const _0x23369f=listProfiles();if(_0x23369f['length']===0x0)console[_0x56b1b6(0x1dd)](_0x56b1b6(0x1e9));else for(const _0x413e43 of _0x23369f){console[_0x56b1b6(0x1dd)](_0x56b1b6(0x1d5)+_0x413e43[_0x56b1b6(0x1db)]);}return 0x1;}const _0x1df4ba=await a23_0x3336ce({'type':_0x56b1b6(0x1d6),'name':_0x56b1b6(0x1d6),'message':_0x56b1b6(0x1bb)+_0x4a5351+'\x27?','initial':![]});if(!_0x1df4ba[_0x56b1b6(0x1d6)])return console[_0x56b1b6(0x1dd)](_0x56b1b6(0x1ca)),0x0;try{removeProfileFromUserConfig(_0x4a5351),console[_0x56b1b6(0x1dd)](a23_0x2d4229[_0x56b1b6(0x199)]('✓')+_0x56b1b6(0x1f0)+_0x4a5351+_0x56b1b6(0x18d));}catch(_0x211a73){return console[_0x56b1b6(0x19b)](a23_0x2d4229['red'](_0x56b1b6(0x1ea)+(_0x211a73 instanceof Error?_0x211a73[_0x56b1b6(0x1d7)]:String(_0x211a73)))),0x1;}const _0x105457=await isKeychainAvailable();if(_0x105457){const _0x32000c=await deleteKeychainAPIKey(_0x4a5351);_0x32000c&&console[_0x56b1b6(0x1dd)](a23_0x2d4229[_0x56b1b6(0x199)]('✓')+_0x56b1b6(0x19f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']=a23_0x2177e5(0x1e6);static ['VALID_KEYS']=[a23_0x2177e5(0x1e1),a23_0x2177e5(0x1c2),a23_0x2177e5(0x1d3),'llm_project',a23_0x2177e5(0x1b8),'description'];[a23_0x2177e5(0x191)](_0x3337f7){const _0x2aad48=a23_0x2177e5,{args:_0x25af0a,options:_0x290ac7}=_0x3337f7,_0x1e52fa=_0x290ac7[_0x2aad48(0x19d)]||getActiveProfile();if(!_0x1e52fa)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(_0x25af0a[_0x2aad48(0x185)]===0x0)return _0x2aad48(0x1ce)+ProfileSetCommand['VALID_KEYS'][_0x2aad48(0x1df)](',\x20');const _0x904c9a=_0x25af0a[0x0];if(!_0x904c9a['includes']('='))return _0x2aad48(0x1c9)+ProfileSetCommand[_0x2aad48(0x1d1)][_0x2aad48(0x1df)](',\x20');const [_0x25ece2]=_0x904c9a[_0x2aad48(0x1e0)]('=',0x2);if(!ProfileSetCommand[_0x2aad48(0x1d1)]['includes'](_0x25ece2))return _0x2aad48(0x196)+_0x25ece2+_0x2aad48(0x1c7)+ProfileSetCommand[_0x2aad48(0x1d1)][_0x2aad48(0x1df)](',\x20');return undefined;}async[a23_0x2177e5(0x1af)](_0x3fd3b6){const _0x2722b3=a23_0x2177e5,{args:_0x25e5b3,options:_0x28d576}=_0x3fd3b6,_0x42e9e7=_0x28d576[_0x2722b3(0x19d)]||getActiveProfile(),[_0x2527ac,..._0x17fda9]=_0x25e5b3[0x0][_0x2722b3(0x1e0)]('='),_0x3abf45=_0x17fda9[_0x2722b3(0x1df)]('=');console[_0x2722b3(0x1dd)](a23_0x2d4229[_0x2722b3(0x18c)](_0x2722b3(0x1f1)));if(!profileExists(_0x42e9e7)){const _0x158594=await a23_0x3336ce({'type':'confirm','name':_0x2722b3(0x1cc),'message':_0x2722b3(0x1d9)+_0x42e9e7+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x158594[_0x2722b3(0x1cc)])return console['log']('Operation\x20cancelled'),0x1;}const _0x296c9=loadProfile(_0x42e9e7),_0x459dce=_0x296c9?.['config']||{};if(_0x2527ac===_0x2722b3(0x1e1)){const _0x150bc6=resolveSite(_0x3abf45);console['log'](_0x2722b3(0x19e)+_0x150bc6+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x2722b3(0x1dd)](_0x2722b3(0x19a)),console[_0x2722b3(0x1dd)]('\x20\x20'+getConsoleUrl(_0x150bc6,_0x2722b3(0x1d8)));const _0x21ed8a=await a23_0x3336ce({'type':_0x2722b3(0x181),'name':'apiKey','message':_0x2722b3(0x1be),'validate':_0x4dc0b7=>{const _0x3580e7=_0x2722b3;if(!_0x4dc0b7||!_0x4dc0b7[_0x3580e7(0x1ee)]())return _0x3580e7(0x18a);return!![];}});if(!_0x21ed8a[_0x2722b3(0x1a6)])return console['log']('\x0aOperation\x20cancelled'),0x1;console['log'](_0x2722b3(0x195));try{const _0x39b2a7=TDX['create']({'site':_0x150bc6,'apiKey':_0x21ed8a['apiKey'][_0x2722b3(0x1ee)](),'logLevel':_0x28d576[_0x2722b3(0x1cb)]??LogLevel[_0x2722b3(0x1c4)]}),_0x22e951=await _0x39b2a7[_0x2722b3(0x1da)][_0x2722b3(0x1bf)]();console[_0x2722b3(0x1dd)](a23_0x2d4229[_0x2722b3(0x199)]('✓')+_0x2722b3(0x1e8)+_0x22e951['email']+')');const _0x28e879=await isKeychainAvailable();_0x28e879?(await saveAPIKeyAsync(_0x21ed8a['apiKey'][_0x2722b3(0x1ee)](),_0x150bc6,_0x42e9e7),console[_0x2722b3(0x1dd)](a23_0x2d4229[_0x2722b3(0x199)]('✓')+_0x2722b3(0x1a5))):console[_0x2722b3(0x1d0)](a23_0x2d4229[_0x2722b3(0x1c3)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x459dce[_0x2722b3(0x1e1)]=_0x150bc6;}catch(_0x46fbf8){if(_0x46fbf8 instanceof HTTPClientError&&_0x46fbf8[_0x2722b3(0x1de)]===0x191)return printAuthError(_0x46fbf8),0x1;return console[_0x2722b3(0x19b)](a23_0x2d4229[_0x2722b3(0x1c8)](_0x2722b3(0x1ba)+(_0x46fbf8 instanceof Error?_0x46fbf8['message']:String(_0x46fbf8)))),console['error'](_0x2722b3(0x1e3)),0x1;}}else _0x459dce[_0x2527ac]=_0x3abf45||undefined;return saveProfileToUserConfig(_0x42e9e7,_0x459dce),console['log'](a23_0x2d4229[_0x2722b3(0x199)]('✓')+'\x20Profile\x20\x27'+_0x42e9e7+_0x2722b3(0x1cf)+_0x2527ac+'='+(_0x3abf45||_0x2722b3(0x189))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x2177e5(0x1db)]=a23_0x2177e5(0x1ae);[a23_0x2177e5(0x1e5)]='Set\x20session\x20profile';[a23_0x2177e5(0x191)](_0x30306c){const _0x237b4f=a23_0x2177e5,{args:_0x54e512}=_0x30306c;if(_0x54e512['length']===0x0)return _0x237b4f(0x197);return undefined;}async[a23_0x2177e5(0x1af)](_0x34cacf){const _0x358575=a23_0x2177e5,{args:_0x2f99b5,options:_0x577762}=_0x34cacf,_0x394229=_0x2f99b5[0x0],_0x52f78e=_0x577762[_0x358575(0x194)];cleanExpiredSessions();if(!profileExists(_0x394229)){console[_0x358575(0x19b)](a23_0x2d4229[_0x358575(0x1c8)](_0x358575(0x1d9)+_0x394229+_0x358575(0x1b5))),console[_0x358575(0x1dd)](_0x358575(0x1ac));const _0x227912=listProfiles();if(_0x227912[_0x358575(0x185)]===0x0)console[_0x358575(0x1dd)](_0x358575(0x1e9));else for(const _0x3f48db of _0x227912){console[_0x358575(0x1dd)](_0x358575(0x1d5)+_0x3f48db[_0x358575(0x1db)]);}return 0x1;}if(_0x52f78e){const _0xfdc40e=a23_0x2fdafd[_0x358575(0x1df)](getConfigDir(),_0x358575(0x1a2));return saveActiveProfileToUserConfig(_0x394229),console[_0x358575(0x1dd)](_0x358575(0x1bc)+a23_0x2d4229[_0x358575(0x199)](_0x394229)),console[_0x358575(0x1dd)](a23_0x2d4229[_0x358575(0x1ed)](_0x358575(0x1a9)+_0xfdc40e)),0x0;}const _0x439cfc=getSessionID(_0x577762[_0x358575(0x18f)]);return saveSessionContext({'profile':_0x394229},_0x577762[_0x358575(0x18f)]),console[_0x358575(0x1dd)](_0x358575(0x1c6)+a23_0x2d4229[_0x358575(0x199)](_0x394229)+'\x20'+a23_0x2d4229[_0x358575(0x1ed)](_0x358575(0x1b4)+_0x439cfc+')')),console[_0x358575(0x1dd)](a23_0x2d4229[_0x358575(0x1ed)](_0x358575(0x1b7)+_0x394229+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}function a23_0x26e5(){const _0x2c2010=['Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Removal\x20cancelled','logLevel','create','Create\x20a\x20new\x20profile','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20updated:\x20','warn','VALID_KEYS','9aFdJkP','parent_segment','Site\x20name\x20cannot\x20be\x20empty','\x20\x20-\x20','confirm','message','/app/mp/ak','Profile\x20\x27','jobs','name','72VIjWfe','log','status','join','split','site','us01','Site\x20was\x20not\x20changed.','select','description','Set\x20a\x20profile\x20configuration\x20value','customSite','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20(no\x20profiles\x20found)','Failed\x20to\x20remove\x20profile:\x20','Enter\x20profile\x20name:','4336530dlAodU','dim','trim','22qgikcb','\x20Profile\x20\x27','tdx:\x20profile\x20set','password','28169pXJEQT','82105fYlrAI','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','length','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','187448QCHVqo','other','(cleared)','API\x20key\x20cannot\x20be\x20empty','profile:remove','bold','\x27\x20removed\x20from\x20configuration','Enter\x20site\x20name:','session','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','validate','11243830hzwjGc','email','default','Validating\x20API\x20key...','Unknown\x20key\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','tdx:\x20profile\x20remove','green','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','error','91vDbBKf','profile','Changing\x20site\x20to\x20\x27','\x20API\x20key\x20removed\x20from\x20system\x20keychain','profile:create','Profile\x20name\x20cannot\x20be\x20empty','tdx.json','4McmJPw','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain','apiKey','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x0aSaved\x20to:\x20','tdx:\x20profile\x20create','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x0aAvailable\x20profiles:','test','profile:use','execute','profileName','66435MclNSb','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetup\x20cancelled','(session:\x20','\x27\x20does\x20not\x20exist.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','llm_agent','\x20\x20tdx\x20--profile\x20','✗\x20Validation\x20failed:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Default\x20profile\x20set\x20to:\x20','66xHueTt','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','getUserInfo','text','43725DYwkpl','database','yellow','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Session\x20profile\x20set\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','red'];a23_0x26e5=function(){return _0x2c2010;};return a23_0x26e5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a24_0x573d(){const _0x1c32df=['Error:\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','7941816qEesPs','execute','map','3282186SnDbEY','2690380wHJyAI','1886920hxPxoD','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','message','6312756xFHsGl','\x20\x20Global:\x20~/.config/tdx/tdx.json','1400IiOYgH','log','6Tajgfc','List\x20all\x20available\x20profiles','config','55146lQUYlI','54stKWwD','description','481359qmQeNv'];a24_0x573d=function(){return _0x1c32df;};return a24_0x573d();}const a24_0x4de9c5=a24_0x124f;(function(_0x3717a4,_0x2ee993){const _0xc9b66c=a24_0x124f,_0x322321=_0x3717a4();while(!![]){try{const _0x5d68d2=-parseInt(_0xc9b66c(0x1b5))/0x1*(-parseInt(_0xc9b66c(0x1af))/0x2)+-parseInt(_0xc9b66c(0x1bb))/0x3+-parseInt(_0xc9b66c(0x1ab))/0x4+parseInt(_0xc9b66c(0x1a6))/0x5+-parseInt(_0xc9b66c(0x1b8))/0x6+parseInt(_0xc9b66c(0x1b2))/0x7*(parseInt(_0xc9b66c(0x1ad))/0x8)+-parseInt(_0xc9b66c(0x1b3))/0x9*(-parseInt(_0xc9b66c(0x1bc))/0xa);if(_0x5d68d2===_0x2ee993)break;else _0x322321['push'](_0x322321['shift']());}catch(_0x358449){_0x322321['push'](_0x322321['shift']());}}}(a24_0x573d,0xc7d14));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a24_0x124f(_0x4cc5d0,_0x176bcd){_0x4cc5d0=_0x4cc5d0-0x1a6;const _0x573df0=a24_0x573d();let _0x124fcd=_0x573df0[_0x4cc5d0];return _0x124fcd;}export class ProfilesCommand extends BaseCommand{[a24_0x4de9c5(0x1a7)]=a24_0x4de9c5(0x1a9);[a24_0x4de9c5(0x1b4)]=a24_0x4de9c5(0x1b0);async[a24_0x4de9c5(0x1b9)](_0x389a22){const _0x501f03=a24_0x4de9c5,{options:_0x3df617}=_0x389a22;try{const _0x3e0763=listProfiles(),_0x22f8dc=getActiveProfile();if(_0x3e0763['length']===0x0)return console['log'](_0x501f03(0x1a8)),console['log'](_0x501f03(0x1b7)),console[_0x501f03(0x1ae)](_0x501f03(0x1ac)),0x0;const _0x17d1c9=_0x3e0763[_0x501f03(0x1ba)](_0x5c2344=>{const _0x592407=_0x501f03,_0x21d82b=_0x5c2344['name']===_0x22f8dc,_0x52cfe0=getProfileParams(_0x5c2344[_0x592407(0x1b1)]);return{'name':_0x5c2344['name'],'active':_0x21d82b,'scope':_0x5c2344['scope'],'description':_0x5c2344[_0x592407(0x1b1)][_0x592407(0x1b4)]||'','params':_0x52cfe0};});return await handleSDKOutput(_0x17d1c9,_0x3df617),0x0;}catch(_0x32d166){return _0x32d166 instanceof Error&&console['error'](_0x501f03(0x1b6)+_0x32d166[_0x501f03(0x1aa)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a25_0x24be(){const _0x46e02b=['processedRows','site','message','options','Executing\x20query...','originalMessage','5FvANcZ','30704sTDtbO','length','database','4090377gCQvyW','\x20-\x20','900yeEkQK','setJobId','36938090hvCdTp','\x20rows\x20','output','2696700OkrcwX','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','completedSplits','\x0aAll\x20results\x20saved\x20to\x20','Query\x20completed:\x20Processed\x20','SQL:\x20','setPhase','7006568VMzBKq','jobId','5921232YFVGnp','query','args','name','Executing\x20statement\x20','error','description','No\x20SQL\x20provided','Error:\x20','setExtra','Schema:\x20','verbose','push','information_schema','Site:\x20','stats','catalog','153416OLZlSN','Statement\x20','14gujTzU','file','data','totalSplits'];a25_0x24be=function(){return _0x46e02b;};return a25_0x24be();}const a25_0x2946a7=a25_0x4722;(function(_0x30ef31,_0x7742c6){const _0x1c7fd9=a25_0x4722,_0x6a8741=_0x30ef31();while(!![]){try{const _0x5dd50a=-parseInt(_0x1c7fd9(0x71))/0x1+-parseInt(_0x1c7fd9(0x88))/0x2+-parseInt(_0x1c7fd9(0x81))/0x3+-parseInt(_0x1c7fd9(0x8f))/0x4*(-parseInt(_0x1c7fd9(0x7d))/0x5)+parseInt(_0x1c7fd9(0x91))/0x6*(-parseInt(_0x1c7fd9(0x73))/0x7)+-parseInt(_0x1c7fd9(0x7e))/0x8*(-parseInt(_0x1c7fd9(0x83))/0x9)+parseInt(_0x1c7fd9(0x85))/0xa;if(_0x5dd50a===_0x7742c6)break;else _0x6a8741['push'](_0x6a8741['shift']());}catch(_0x3bd8b0){_0x6a8741['push'](_0x6a8741['shift']());}}}(a25_0x24be,0xf1c4a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x4722(_0x22e400,_0x547e7f){_0x22e400=_0x22e400-0x64;const _0x24beab=a25_0x24be();let _0x472231=_0x24beab[_0x22e400];return _0x472231;}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';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x2946a7(0x94)]='query';[a25_0x2946a7(0x66)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x20d1fd){const _0x68121a=a25_0x2946a7,{options:_0x4d5b7c,args:_0x59b216,tdx:_0x25cf3b}=_0x20d1fd,_0x1488c3=_0x59b216[0x0],_0x1cac53=_0x4d5b7c[_0x68121a(0x74)];let _0x33786e;try{if(_0x1cac53)_0x33786e=readSqlStatementsFromFile(_0x1cac53);else{if(_0x1488c3==='-')_0x33786e=await readSqlStatementsFromStdin();else{if(_0x1488c3&&isSqlFilePath(_0x1488c3))_0x33786e=readSqlStatementsFromFile(_0x1488c3);else{if(_0x1488c3)_0x33786e=splitSqlStatements(_0x1488c3);else throw new Error(_0x68121a(0x67));}}}}catch(_0x105a48){return console['error'](_0x68121a(0x68)+_0x105a48[_0x68121a(0x79)]),0x1;}const _0x680e41=_0x4d5b7c[_0x68121a(0x80)]||_0x68121a(0x6d),_0x5dd3fe=_0x4d5b7c[_0x68121a(0x70)];try{const _0x2be700=[],_0x522f3a=!!_0x4d5b7c[_0x68121a(0x87)];for(let _0x2c50a6=0x0;_0x2c50a6<_0x33786e[_0x68121a(0x7f)];_0x2c50a6++){const _0x4b5acd=_0x33786e[_0x2c50a6],_0x426e45=_0x2c50a6+0x1,_0x236c50=_0x33786e[_0x68121a(0x7f)],_0x1a2636=_0x236c50>0x1;_0x4d5b7c[_0x68121a(0x6b)]&&(console[_0x68121a(0x65)]('\x0a'+(_0x1a2636?_0x68121a(0x72)+_0x426e45+'/'+_0x236c50+':':'')),console['error'](_0x68121a(0x6e)+_0x4d5b7c[_0x68121a(0x78)]),console[_0x68121a(0x65)]('Catalog:\x20'+(_0x5dd3fe||'td')),console[_0x68121a(0x65)](_0x68121a(0x6a)+_0x680e41),console['error'](_0x68121a(0x8d)+_0x4b5acd));const _0x203391=_0x1a2636?_0x68121a(0x64)+_0x426e45+'/'+_0x236c50+'...':_0x68121a(0x7b);try{const _0x2c19af=await withProgressSpinner(_0x203391,async _0x350a4=>{const _0x2f3e5a=_0x68121a,_0x102fb0=await _0x25cf3b[_0x2f3e5a(0x92)]['execute'](_0x4b5acd,{'catalog':_0x5dd3fe,'schema':_0x680e41,'onJobId':_0x1a9e70=>{const _0x2aa37f=_0x2f3e5a;_0x350a4[_0x2aa37f(0x84)](_0x1a9e70);},'onProgress':_0x35c4aa=>{const _0x2c21a4=_0x2f3e5a;_0x350a4[_0x2c21a4(0x8e)]('Executing\x20query\x20['+_0x35c4aa['state']+']'),_0x350a4[_0x2c21a4(0x69)](formatRows(_0x35c4aa[_0x2c21a4(0x77)])+_0x2c21a4(0x86)+_0x35c4aa[_0x2c21a4(0x8a)]+'/'+_0x35c4aa[_0x2c21a4(0x76)]+'\x20splits');}});return _0x102fb0;},{'verbose':_0x4d5b7c[_0x68121a(0x6b)]}),_0x39c44c=_0x2c19af[_0x68121a(0x75)],_0x4da028=_0x39c44c['jobId']?'\x20[Job\x20ID:\x20'+_0x39c44c[_0x68121a(0x90)]+']':'',_0x26edb6=_0x1a2636?_0x68121a(0x72)+_0x426e45+'/'+_0x236c50+_0x68121a(0x82):'';console[_0x68121a(0x65)]('✔\x20'+_0x26edb6+_0x68121a(0x8c)+formatRows(_0x39c44c[_0x68121a(0x6f)][_0x68121a(0x77)])+_0x68121a(0x86)+('in\x20'+formatElapsed(_0x39c44c[_0x68121a(0x6f)]['elapsedTimeMillis'])+_0x4da028));if(_0x1a2636&&_0x522f3a){const _0x2829f3=resolveOutputOptions(_0x4d5b7c),_0x870027=await formatQueryOutput(_0x39c44c,_0x2829f3);_0x2be700[_0x68121a(0x6c)](_0x870027);}else await handleQueryOutput(_0x39c44c,_0x4d5b7c);}catch(_0xdbfaba){const _0x1cafb4=_0x1a2636?_0x68121a(0x72)+_0x426e45+'/'+_0x236c50+':\x0a':'',_0x584529=_0xdbfaba instanceof SDKError?_0xdbfaba[_0x68121a(0x7c)]:_0xdbfaba[_0x68121a(0x79)];return console[_0x68121a(0x65)](''+_0x1cafb4+_0x584529),0x1;}}if(_0x33786e[_0x68121a(0x7f)]>0x1&&_0x522f3a&&_0x2be700['length']>0x0){const _0x3dbfd9=_0x2be700['join']('\x0a');writeFileSync(_0x4d5b7c[_0x68121a(0x87)],_0x3dbfd9),console[_0x68121a(0x65)](_0x68121a(0x8b)+_0x4d5b7c[_0x68121a(0x87)]);}return 0x0;}catch(_0x56b328){throw _0x56b328;}}['validate'](_0x327d40){const _0x3e7837=a25_0x2946a7,_0x1afd4e=_0x327d40[_0x3e7837(0x93)][0x0],_0x4086c6=_0x327d40[_0x3e7837(0x7a)][_0x3e7837(0x74)];if(!_0x1afd4e&&!_0x4086c6)return _0x3e7837(0x89);if(_0x1afd4e&&_0x4086c6)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|