@treasuredata/tdx 0.16.5 → 0.16.6
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.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.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/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/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/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts +13 -0
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/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/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/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.d.ts +10 -0
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +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 a22_0x204e78=a22_0x41cd;function a22_0x41cd(_0x497dfc,_0x2eab0e){_0x497dfc=_0x497dfc-0x14b;const _0x5d62f5=a22_0x5d62();let _0x41cdf8=_0x5d62f5[_0x497dfc];return _0x41cdf8;}(function(_0x32d44f,_0x4cf39e){const _0x107683=a22_0x41cd,_0x34499e=_0x32d44f();while(!![]){try{const _0x4553dc=-parseInt(_0x107683(0x15c))/0x1*(-parseInt(_0x107683(0x15f))/0x2)+-parseInt(_0x107683(0x156))/0x3+parseInt(_0x107683(0x14c))/0x4+parseInt(_0x107683(0x150))/0x5+parseInt(_0x107683(0x15d))/0x6+parseInt(_0x107683(0x15b))/0x7*(parseInt(_0x107683(0x154))/0x8)+parseInt(_0x107683(0x14e))/0x9*(-parseInt(_0x107683(0x158))/0xa);if(_0x4553dc===_0x4cf39e)break;else _0x34499e['push'](_0x34499e['shift']());}catch(_0x88dd27){_0x34499e['push'](_0x34499e['shift']());}}}(a22_0x5d62,0xe0b9f));import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{['name']=a22_0x204e78(0x159);['description']='Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration';async['execute'](_0x5cab6a){const _0x5b5c60=a22_0x204e78,{tdx:_0x46c970}=_0x5cab6a,_0x306a89={};if(process[_0x5b5c60(0x14b)][_0x5b5c60(0x155)])_0x306a89[_0x5b5c60(0x155)]=process['env'][_0x5b5c60(0x155)];else{if(process[_0x5b5c60(0x14b)]['TDX_API_KEY'])_0x306a89['TDX_API_KEY']=process[_0x5b5c60(0x14b)][_0x5b5c60(0x15e)],process[_0x5b5c60(0x14b)][_0x5b5c60(0x153)]&&(_0x306a89['TDX_SITE']=process['env']['TDX_SITE']);else _0x46c970['context']['apiKey']&&(_0x306a89[_0x5b5c60(0x15e)]=_0x46c970[_0x5b5c60(0x14f)][_0x5b5c60(0x15a)],_0x306a89['TDX_SITE']=_0x46c970[_0x5b5c60(0x14f)][_0x5b5c60(0x14d)]);}_0x46c970[_0x5b5c60(0x14f)]['profile']&&(_0x306a89[_0x5b5c60(0x155)]=_0x46c970[_0x5b5c60(0x14f)][_0x5b5c60(0x157)]);try{const {startMCPServer:_0x4c099f}=await import(_0x5b5c60(0x152));return await _0x4c099f({'env':_0x306a89}),0x0;}catch(_0x5f297f){const _0x32279d=_0x5f297f instanceof Error?_0x5f297f[_0x5b5c60(0x151)]:String(_0x5f297f);return console[_0x5b5c60(0x160)]('MCP\x20server\x20error:\x20'+_0x32279d),0x1;}}}function a22_0x5d62(){const _0xbc6431=['apiKey','14UuRZkl','1248856FccGIo','7716402aDlkNV','TDX_API_KEY','2AFhgkU','error','env','1480340UmpvSc','site','37974627sqFmHV','context','7296495gHBAdg','message','../mcp/server.js','TDX_SITE','3403384YTVzzo','TDX_PROFILE','225813pTQfqP','profile','10zFgxZz','mcp'];a22_0x5d62=function(){return _0xbc6431;};return a22_0x5d62();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x250cc6=a23_0x3769;(function(_0xe63bb6,_0xb0423a){const _0x2dfa7a=a23_0x3769,_0x17a5f8=_0xe63bb6();while(!![]){try{const _0x5350a5=parseInt(_0x2dfa7a(0x1d5))/0x1+parseInt(_0x2dfa7a(0x156))/0x2+-parseInt(_0x2dfa7a(0x1e6))/0x3*(-parseInt(_0x2dfa7a(0x24f))/0x4)+-parseInt(_0x2dfa7a(0x1c1))/0x5*(parseInt(_0x2dfa7a(0x1e5))/0x6)+-parseInt(_0x2dfa7a(0x242))/0x7*(parseInt(_0x2dfa7a(0x232))/0x8)+-parseInt(_0x2dfa7a(0x23a))/0x9+parseInt(_0x2dfa7a(0x140))/0xa;if(_0x5350a5===_0xb0423a)break;else _0x17a5f8['push'](_0x17a5f8['shift']());}catch(_0x50201b){_0x17a5f8['push'](_0x17a5f8['shift']());}}}(a23_0x4814,0xb0254));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x3fb4f2 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0xda7a3c from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a23_0x4814(){const _0x1c8ec6=['\x0a✔\x20Workflow\x20started','1495qZtazR','YAML\x20file:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20--attribute\x20\x22','✔\x20No\x20changes\x20-\x20\x27','displayPreviewResults','customerGroup','Error\x20reading\x20file:\x20','apply','Errors:','parentSegment','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Behaviors','toLocaleString','toFixed','stop','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Columns:','filter','571139DuBgyu','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20--behavior\x20\x22<name>\x22','format','/app/dw/parentSegments/','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Created\x20parent\x20segment\x20\x27','site','pushParentYaml','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','interval','\x20tdx\x20wf\x20attempt\x20','behavior','Master\x20Table','16194EkxaXW','616263yohwIs','\x20field','win32','data','open','table','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0a⚠️\x20\x20Both\x20','segment:parent:create','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Options:\x0a','addAttributesFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','map','Events:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','log','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','SELECT\x20*\x20FROM\x20(\x0a','Join\x20on:','errors','Session:','addBehaviors','\x0aNo\x20sample\x20data\x20available','Attributes','Executing\x20parent\x20segment\x20query...','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','xdg-open','List\x20parent\x20segments','segment:parent:push','getParentSQL','Coverage:','/\x20directories\x20exist.','✔\x20Updated\x20parent\x20segment\x20\x27','repeat','Analyzing\x20changes...','Options\x20(one\x20required):\x0a','output','dim','displayMasterInfo','scheduleType','Enriched:','displayPreviewHints','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','join','/\x20and\x20','segment:parent:list','runParent','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20No\x20sample\x20data\x20available','\x20\x20\x20\x20-\x20','updateParent','Preview:','\x27\x20and\x20run\x20workflow?','/\x20→\x20','\x20Opening\x20','Join:','in\x20','displayBehaviorsStats','Attempt:','Created','run','Found\x20YAML\x20file:\x20','displayAttributesStats','Apply\x20changes\x20to\x20\x27','preview','Error:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','schemaError','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20Configuration\x20is\x20valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','unref','query','Status:','74056Bwslsq','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','matchedCount','Listing\x20fields\x20for\x20\x27','previewParentYaml','workflowSessionId','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Available\x20attributes:','8632953mSgvwh','name','label','segment','addAttributes','jsonl','column','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','357WWsMZI','Fetching\x20current\x20configuration\x20for\x20\x27','\x20=\x20','test','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Options:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','List\x20available\x20fields\x20for\x20segmentation','error','workflowAttemptId','bold','16NbnXIM','✔\x20Found\x20','To\x20cancel:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x27\x20is\x20already\x20up\x20to\x20date','createParent','schemaValid','To\x20view\x20sample\x20data:','sort','displayValidateResults','pullParentYaml','rowCount','limit','Updating\x20parent\x20segment\x20\x27','.yml','\x20--interval\x20','start','green','Error:\x20--behavior\x20requires\x20a\x20name\x0a','segment:parent:sql','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x0a⚠️\x20\x20Migrating:\x20','red','message','yes','\x0aChanges\x20to\x20\x27','utf-8','resolveParentId','audienceId','verbose','Updated','master','tdx\x20segment\x20parent\x20preview\x20','%)\x20','enriched','match','using\x20the\x20default\x20path:\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','6634100tlNocb','setJobId','\x0aChanges\x20to\x20apply\x20to\x20\x27','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','behaviorsFile','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','/sessions/','elapsedTimeMillis','totalEvents','attribute','attributes','listFields','segment:parent:desc','✘\x20Failed\x20to\x20rename\x20directory:\x20','timezone','\x0aNew\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Master\x20+\x20Attributes','string','Creating\x20parent\x20segment\x20\x27','\x27...','replace','1807168uYHHuU','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','✔\x20Query\x20completed:\x20Processed\x20','parent_segment','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','customerPercent','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','text','isDirectory','execute','Creating','jobId','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:parent:show','allValid','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Attribute:','localeCompare','Fetching\x20SQL\x20for\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','-1d','json','varchar','Parent\x20segment:\x20','processedRows','displayColumns','\x5c$&','customersWithEvents','Pattern:\x20','Updating','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','Site:\x20','\x20--attribute\x20\x22<name>\x22','database','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','darwin','description','\x27\x20with\x20ID:\x20','foreignKey','Output\x20file:\x20','behaviors','FINISHED','Resolving\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','Database:\x20','session','.yaml','joinKey','sampleData','✔\x20Renamed\x20directory\x20to\x20','all','status','👥\x20','double','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Create\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','use','Name:\x20','\x20rows)','columns','/app/workflows/','length','Master:','parent_segments','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','stats','Aborted.','coveragePercent','Error:\x20File\x20not\x20found:\x20','getParentFull','endsWith','\x20parent\x20segment\x20\x27','keys','Rows:','addBehaviorsFile','Validate:','customerGroupFile','yellow','Show\x20parent\x20segment\x20details','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','scheduleOption','Overwrite\x20\x27','Validating\x20configuration...','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Fetching\x20parent\x20segment\x20\x27','trim','displaySummary','\x20--behavior\x20\x22','cyan','displaySampleData','platform','segment:parent:fields'];a23_0x4814=function(){return _0x1c8ec6;};return a23_0x4814();}const PARENT_SEGMENT_DIR=a23_0x250cc6(0x19f),LEGACY_PARENT_SEGMENT_DIR=a23_0x250cc6(0x15a);function openBrowser(_0x16cdf3){const _0x5227a9=a23_0x250cc6,_0x42e9ae=process[_0x5227a9(0x1be)],_0x329488=_0x42e9ae===_0x5227a9(0x17f)?_0x5227a9(0x1ea):_0x42e9ae===_0x5227a9(0x1e8)?'start':_0x5227a9(0x202);spawn(_0x329488,[_0x16cdf3],{'detached':!![],'stdio':'ignore'})[_0x5227a9(0x22f)]();}function migrateLegacyDirectory(){const _0x2a1459=a23_0x250cc6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x440425=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x440425[_0x2a1459(0x162)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2a1459(0x24c)](a23_0xda7a3c[_0x2a1459(0x1b0)](_0x2a1459(0x1ed)+LEGACY_PARENT_SEGMENT_DIR+_0x2a1459(0x214)+PARENT_SEGMENT_DIR+_0x2a1459(0x207))),console[_0x2a1459(0x24c)](a23_0xda7a3c[_0x2a1459(0x20d)](_0x2a1459(0x1d2)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x2a1459(0x24c)](a23_0xda7a3c[_0x2a1459(0x1b0)](_0x2a1459(0x12f)+LEGACY_PARENT_SEGMENT_DIR+_0x2a1459(0x21d)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2a1459(0x24c)](a23_0xda7a3c[_0x2a1459(0x12b)](_0x2a1459(0x18e)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x10bf2c){const _0x54f4cd=_0x10bf2c instanceof Error?_0x10bf2c['message']:String(_0x10bf2c);return console[_0x2a1459(0x24c)](a23_0xda7a3c['red'](_0x2a1459(0x14d)+_0x54f4cd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x26c5bd){const _0xa9892e=a23_0x250cc6;return migrateLegacyDirectory(),super[_0xa9892e(0x224)](_0x26c5bd);}}function resolveYamlFile(_0x5a7be1){const _0x2f43c2=a23_0x250cc6;if(_0x5a7be1[_0x2f43c2(0x1a9)](_0x2f43c2(0x128))||_0x5a7be1['endsWith'](_0x2f43c2(0x18b)))return _0x5a7be1;return a23_0x3fb4f2[_0x2f43c2(0x213)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5a7be1)+_0x2f43c2(0x128));}function formatProgressMessage(_0xa59a2a){const _0x6b9133=a23_0x250cc6,_0x179ef5=_0xa59a2a[_0x6b9133(0x13d)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x179ef5){const [,_0x49eaab,_0x105285,_0x5a3157='']=_0x179ef5;return a23_0xda7a3c[_0x6b9133(0x20d)](_0x49eaab+':')+'\x20'+_0x105285+a23_0xda7a3c[_0x6b9133(0x20d)](_0x5a3157);}return a23_0xda7a3c['dim'](_0xa59a2a);}function showFileNotFoundError(_0x3726fb,_0xcd0671){const _0x11a8ea=a23_0x250cc6;console['error'](a23_0xda7a3c[_0x11a8ea(0x130)](_0x11a8ea(0x1a7)+_0x3726fb+'\x0a')),console['error'](a23_0xda7a3c['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0xcd0671+_0x11a8ea(0x15f)));}function showParentSegmentNotSetError(_0x4b85d0){const _0x4990e2=a23_0x250cc6;console[_0x4990e2(0x24c)](a23_0xda7a3c[_0x4990e2(0x1b0)](_0x4990e2(0x1df))),console[_0x4990e2(0x24c)](_0x4b85d0);}export class ParentSegmentListCommand extends BaseCommand{['name']=a23_0x250cc6(0x215);['description']=a23_0x250cc6(0x203);async[a23_0x250cc6(0x163)](_0x5c513f){const _0x5899bc=a23_0x250cc6,{options:_0x447b9c,args:_0x2d3bba,tdx:_0x7e6b56}=_0x5c513f,_0x487c39=_0x2d3bba[0x0];_0x447b9c[_0x5899bc(0x137)]&&(console['error'](_0x5899bc(0x17b)+_0x447b9c[_0x5899bc(0x1dc)]),_0x487c39&&console[_0x5899bc(0x24c)](_0x5899bc(0x176)+_0x487c39));const _0x447e57=await withSpinner(_0x487c39?_0x5899bc(0x246)+_0x487c39+_0x5899bc(0x154):'Listing\x20parent\x20segments...',()=>_0x7e6b56[_0x5899bc(0x23d)]['listParents'](),{'verbose':_0x447b9c['verbose']});let _0x30d066=_0x447e57[_0x5899bc(0x1e9)];if(_0x487c39){const _0x46b15e=_0x487c39[_0x5899bc(0x155)](/[.+^${}()|[\]\\]/g,_0x5899bc(0x174))[_0x5899bc(0x155)](/\*/g,'.*')[_0x5899bc(0x155)](/\?/g,'.'),_0x24ba0b=new RegExp('^'+_0x46b15e+'$','i');_0x30d066=_0x30d066[_0x5899bc(0x1d4)](_0x565f33=>_0x24ba0b[_0x5899bc(0x245)](_0x565f33['attributes']['name']));}_0x30d066[_0x5899bc(0x122)]((_0x30ae39,_0x1bfb6b)=>_0x30ae39['attributes'][_0x5899bc(0x23b)][_0x5899bc(0x16b)](_0x1bfb6b['attributes']['name'])),console[_0x5899bc(0x24c)](_0x5899bc(0x11b)+_0x30d066[_0x5899bc(0x19d)]+'\x20parent\x20segment'+(_0x30d066[_0x5899bc(0x19d)]!==0x1?'s':''));const _0x328d93=_0x1fdf91=>{const _0x51171a=_0x5899bc;return getConsoleNextUrl(_0x447b9c[_0x51171a(0x1dc)],_0x51171a(0x1d9)+_0x1fdf91);};if(_0x447b9c[_0x5899bc(0x1d8)]===_0x5899bc(0x16f)||_0x447b9c['format']===_0x5899bc(0x23f)){const _0x1c7f7e=_0x30d066[_0x5899bc(0x1f4)](_0x5ce3fe=>({..._0x5ce3fe,'url':_0x328d93(_0x5ce3fe['id'])}));await handleSDKOutput(_0x1c7f7e,_0x447b9c);}else{if(_0x30d066[_0x5899bc(0x19d)]===0x0)_0x487c39?console[_0x5899bc(0x1f7)](_0x5899bc(0x188)+_0x487c39):console[_0x5899bc(0x1f7)]('No\x20parent\x20segments\x20found');else for(const _0x52aa0 of _0x30d066){const _0x359554=_0x52aa0[_0x5899bc(0x14a)]['population']?a23_0xda7a3c[_0x5899bc(0x20d)]('\x20('+formatRows(_0x52aa0['attributes']['population'])+')'):'',_0x4bccda=hyperlink(_0x52aa0['attributes']['name'],_0x328d93(_0x52aa0['id']));console[_0x5899bc(0x1f7)](_0x5899bc(0x191)+_0x4bccda+_0x359554);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x250cc6(0x1ee);[a23_0x250cc6(0x180)]=a23_0x250cc6(0x212);async[a23_0x250cc6(0x163)](_0x28e6bb){const _0x8861a8=a23_0x250cc6,{options:_0x174bbf,args:_0xd187bc,tdx:_0x2844e8}=_0x28e6bb;console[_0x8861a8(0x24c)](_0x8861a8(0x178)+_0x8861a8(0x169)+_0x8861a8(0x12e));const _0x637b68=_0x174bbf;if(_0xd187bc[_0x8861a8(0x19d)]===0x0)return console[_0x8861a8(0x24c)](a23_0xda7a3c[_0x8861a8(0x130)](_0x8861a8(0x166))),console[_0x8861a8(0x24c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x24f305=_0xd187bc[0x0];if(!_0x637b68['database']||!_0x637b68['table'])return console[_0x8861a8(0x24c)](_0x8861a8(0x17a)),console['error'](_0x8861a8(0x22a)),0x1;_0x637b68[_0x8861a8(0x137)]&&(console['error'](_0x8861a8(0x17b)+_0x637b68[_0x8861a8(0x1dc)]),console['error'](_0x8861a8(0x199)+_0x24f305),console[_0x8861a8(0x24c)](_0x8861a8(0x189)+_0x637b68['database']),console[_0x8861a8(0x24c)]('Table:\x20'+_0x637b68[_0x8861a8(0x1eb)]));const _0x1af408=await loadJSONFromOptions(_0x637b68[_0x8861a8(0x14a)],_0x637b68['attributesFile']),_0x194182=await loadJSONFromOptions(_0x637b68[_0x8861a8(0x184)],_0x637b68[_0x8861a8(0x144)]),_0x263f82=await loadJSONFromOptions(_0x637b68[_0x8861a8(0x1c7)],_0x637b68[_0x8861a8(0x1af)]),_0x26f826={'name':_0x24f305,'description':_0x637b68[_0x8861a8(0x180)],'scheduleType':_0x637b68[_0x8861a8(0x20f)],'scheduleOption':_0x637b68['scheduleOption'],'timezone':_0x637b68['timezone'],'master':{'parentDatabaseName':_0x637b68[_0x8861a8(0x17d)],'parentTableName':_0x637b68['table']},'attributes':_0x1af408,'behaviors':_0x194182,'customerGroup':_0x263f82},_0x2cc615=await withSpinner(_0x8861a8(0x153)+_0x24f305+_0x8861a8(0x154),()=>_0x2844e8['segment'][_0x8861a8(0x11f)](_0x26f826),{'verbose':_0x174bbf['verbose']}),_0x59ac0d=_0x2cc615[_0x8861a8(0x1e9)];return console['error'](_0x8861a8(0x1db)+_0x59ac0d['name']+_0x8861a8(0x181)+_0x59ac0d['id']),await handleSDKOutput([_0x59ac0d],_0x174bbf),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x250cc6(0x23b)]='segment:parent:update';[a23_0x250cc6(0x180)]=a23_0x250cc6(0x143);async[a23_0x250cc6(0x163)](_0x47355a){const _0x39a26a=a23_0x250cc6,{options:_0xddd4b,args:_0x4d1acb,tdx:_0x4a6f2c}=_0x47355a;console[_0x39a26a(0x24c)](_0x39a26a(0x179)+_0x39a26a(0x169)+_0x39a26a(0x12e));const _0x20bcb8=_0xddd4b;if(_0x4d1acb[_0x39a26a(0x19d)]===0x0)return console['error'](a23_0xda7a3c[_0x39a26a(0x130)](_0x39a26a(0x166))),console[_0x39a26a(0x24c)](_0x39a26a(0x238)),0x1;const _0x5f0758=_0x4d1acb[0x0];_0x20bcb8[_0x39a26a(0x137)]&&(console['error'](_0x39a26a(0x17b)+_0x20bcb8[_0x39a26a(0x1dc)]),console[_0x39a26a(0x24c)](_0x39a26a(0x171)+_0x5f0758));const _0x1f5364=await withSpinner(_0x39a26a(0x243)+_0x5f0758+_0x39a26a(0x154),()=>_0x4a6f2c['segment']['getParentFull'](_0x5f0758),{'verbose':_0x20bcb8[_0x39a26a(0x137)]}),_0x299d1c=_0x1f5364['data'],_0x1ac66b=await loadJSONFromOptions(_0x20bcb8[_0x39a26a(0x23e)],_0x20bcb8[_0x39a26a(0x1f1)]),_0x3034ae=await loadJSONFromOptions(_0x20bcb8[_0x39a26a(0x1fd)],_0x20bcb8[_0x39a26a(0x1ad)]),_0xc84116={'name':_0x299d1c[_0x39a26a(0x23b)],'description':_0x20bcb8[_0x39a26a(0x180)]!==undefined?_0x20bcb8[_0x39a26a(0x180)]:_0x299d1c[_0x39a26a(0x180)],'scheduleType':_0x20bcb8['scheduleType']!==undefined?_0x20bcb8[_0x39a26a(0x20f)]:_0x299d1c[_0x39a26a(0x20f)],'scheduleOption':_0x20bcb8['scheduleOption']!==undefined?_0x20bcb8[_0x39a26a(0x1b4)]:_0x299d1c[_0x39a26a(0x1b4)],'timezone':_0x20bcb8[_0x39a26a(0x14e)]!==undefined?_0x20bcb8[_0x39a26a(0x14e)]:_0x299d1c[_0x39a26a(0x14e)],'master':_0x299d1c[_0x39a26a(0x139)],'attributes':_0x1ac66b?[..._0x299d1c['attributes']||[],..._0x1ac66b]:_0x299d1c[_0x39a26a(0x14a)],'behaviors':_0x3034ae?[..._0x299d1c['behaviors']||[],..._0x3034ae]:_0x299d1c['behaviors'],'customerGroup':_0x299d1c['customerGroup']},_0x3c3fae=await withSpinner(_0x39a26a(0x127)+_0x5f0758+'\x27...',()=>_0x4a6f2c[_0x39a26a(0x23d)][_0x39a26a(0x21a)](_0x5f0758,_0xc84116),{'verbose':_0x20bcb8[_0x39a26a(0x137)]}),_0x2fc61d=_0x3c3fae[_0x39a26a(0x1e9)];return console[_0x39a26a(0x24c)](_0x39a26a(0x208)+_0x2fc61d['name']+'\x27'),await handleSDKOutput([_0x2fc61d],_0x20bcb8),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x250cc6(0x23b)]='segment:parent:pull';['description']=a23_0x250cc6(0x1ec);async[a23_0x250cc6(0x163)](_0x1dced8){const _0x4d3668=a23_0x250cc6,{options:_0x321ba0,args:_0x355619,tdx:_0x33ecbb}=_0x1dced8,_0x193186=_0x321ba0,_0x2a9813=_0x355619[0x0]||_0x321ba0['parentSegment'];if(!_0x2a9813)return showParentSegmentNotSetError(_0x4d3668(0x1a2)+_0x4d3668(0x22e)),0x1;if(_0x193186[_0x4d3668(0x198)]&&_0x193186[_0x4d3668(0x20c)])return console[_0x4d3668(0x24c)](a23_0xda7a3c[_0x4d3668(0x130)](_0x4d3668(0x187))),console[_0x4d3668(0x24c)](a23_0xda7a3c[_0x4d3668(0x20d)](_0x4d3668(0x1de))),console[_0x4d3668(0x24c)](a23_0xda7a3c[_0x4d3668(0x20d)](_0x4d3668(0x13e)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x4d3668(0x24c)](a23_0xda7a3c['cyan'](_0x4d3668(0x1ef))),0x1;const _0x14788c=_0x193186['output']||a23_0x3fb4f2[_0x4d3668(0x213)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2a9813)+_0x4d3668(0x128));_0x193186[_0x4d3668(0x137)]&&(console[_0x4d3668(0x24c)](_0x4d3668(0x17b)+_0x193186['site']),console[_0x4d3668(0x24c)]('Parent\x20segment:\x20'+_0x2a9813),console[_0x4d3668(0x24c)](_0x4d3668(0x183)+_0x14788c));const _0xa0c691=await withSpinner(_0x4d3668(0x1b8)+_0x2a9813+_0x4d3668(0x154),()=>_0x33ecbb[_0x4d3668(0x23d)][_0x4d3668(0x124)](_0x2a9813),{'verbose':_0x193186['verbose']}),_0x46667f=_0xa0c691[_0x4d3668(0x1e9)];if(existsSync(_0x14788c)){const _0x1808ac=readFileSync(_0x14788c,_0x4d3668(0x134)),_0x31bb11=generateDiff(_0x1808ac,_0x46667f);if(!hasChanges(_0x31bb11))console[_0x4d3668(0x24c)](a23_0xda7a3c[_0x4d3668(0x12b)]('✔')+_0x4d3668(0x1b2)+a23_0xda7a3c[_0x4d3668(0x1bc)](_0x14788c)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x4d3668(0x24c)](_0x4d3668(0x133)+_0x14788c+'\x27:'),console['error']('─'[_0x4d3668(0x209)](0x3c)),console[_0x4d3668(0x24c)](formatDiffWithColors(_0x31bb11)),console['error']('─'[_0x4d3668(0x209)](0x3c));if(!_0x193186['yes']){const _0x534797=await confirmKey(_0x4d3668(0x1b5)+_0x14788c+'\x27?');if(!_0x534797)return console[_0x4d3668(0x24c)](_0x4d3668(0x1a5)),0x1;}writeFileSync(_0x14788c,_0x46667f,'utf-8'),console['error'](a23_0xda7a3c['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0xda7a3c['cyan'](_0x14788c));}}else{const _0x3f8484=a23_0x3fb4f2[_0x4d3668(0x15d)](_0x14788c);!existsSync(_0x3f8484)&&mkdirSync(_0x3f8484,{'recursive':!![]}),writeFileSync(_0x14788c,_0x46667f,_0x4d3668(0x134)),console[_0x4d3668(0x24c)](a23_0xda7a3c[_0x4d3668(0x12b)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0xda7a3c[_0x4d3668(0x1bc)](_0x14788c));}return saveSessionContext({'parent_segment':_0x2a9813},_0x193186[_0x4d3668(0x18a)]),console[_0x4d3668(0x24c)](a23_0xda7a3c['green']('✔')+_0x4d3668(0x195)+a23_0xda7a3c[_0x4d3668(0x20d)](_0x4d3668(0x15a))+'\x20=\x20'+a23_0xda7a3c[_0x4d3668(0x1bc)](_0x2a9813)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x250cc6(0x23b)]=a23_0x250cc6(0x204);[a23_0x250cc6(0x180)]=a23_0x250cc6(0x1a0);async[a23_0x250cc6(0x163)](_0x57075a){const _0x1d29b3=a23_0x250cc6,{options:_0x5d115e,args:_0x53e2ff,tdx:_0x40e890}=_0x57075a,_0x55bd06=_0x5d115e,_0x3ab184=_0x53e2ff[0x0]||_0x5d115e[_0x1d29b3(0x1cb)];if(!_0x3ab184)return showParentSegmentNotSetError(_0x1d29b3(0x1f6)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x4d9aaa=resolveYamlFile(_0x3ab184);if(!existsSync(_0x4d9aaa))return showFileNotFoundError(_0x4d9aaa,_0x3ab184),0x1;_0x55bd06[_0x1d29b3(0x137)]&&(console[_0x1d29b3(0x24c)](_0x1d29b3(0x17b)+_0x55bd06[_0x1d29b3(0x1dc)]),console['error'](_0x1d29b3(0x1c2)+_0x4d9aaa));let _0x12a127;try{_0x12a127=readFileSync(_0x4d9aaa,_0x1d29b3(0x134));}catch(_0x95df46){const _0x56b0e1=_0x95df46 instanceof Error?_0x95df46['message']:String(_0x95df46);return console['error']('Error\x20reading\x20file:\x20'+_0x56b0e1),0x1;}const _0x123ccd=await withSpinner(_0x1d29b3(0x20a),()=>_0x40e890['segment']['pushParentYaml'](_0x12a127),{'verbose':_0x55bd06['verbose']}),_0x24712e=_0x123ccd[_0x1d29b3(0x1e9)],{isNew:_0x2dc188,name:_0x3f750c,hasChanges:_0x53dd69,diffFormatted:_0x5f3987}=_0x24712e;if(!_0x53dd69)return console[_0x1d29b3(0x24c)](_0x1d29b3(0x1c5)+_0x3f750c+_0x1d29b3(0x11e)),0x0;_0x2dc188?console[_0x1d29b3(0x24c)](_0x1d29b3(0x14f)+_0x3f750c+'\x27:'):console[_0x1d29b3(0x24c)](_0x1d29b3(0x142)+_0x3f750c+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x5f3987),console[_0x1d29b3(0x24c)]('─'[_0x1d29b3(0x209)](0x3c));const _0x44edc8=_0x2dc188?_0x1d29b3(0x194)+_0x3f750c+'\x27?':_0x1d29b3(0x227)+_0x3f750c+'\x27?';if(!_0x55bd06[_0x1d29b3(0x132)]){const _0x22a67c=await confirmKey(_0x44edc8);if(!_0x22a67c)return console[_0x1d29b3(0x24c)]('Aborted.'),0x1;}const _0x189a6d=_0x2dc188?_0x1d29b3(0x164):_0x1d29b3(0x177),_0x172e57=await withSpinner(_0x189a6d+_0x1d29b3(0x1aa)+_0x3f750c+_0x1d29b3(0x154),()=>_0x24712e[_0x1d29b3(0x1c9)](),{'verbose':_0x55bd06[_0x1d29b3(0x137)]}),_0x55f687=_0x172e57[_0x1d29b3(0x1e9)],_0x4985c2=getConsoleNextUrl(_0x55bd06[_0x1d29b3(0x1dc)],_0x1d29b3(0x1d9)+_0x55f687['id']),_0x3edd49=_0x2dc188?_0x1d29b3(0x223):_0x1d29b3(0x138);return console[_0x1d29b3(0x24c)]('✔\x20'+_0x3edd49+_0x1d29b3(0x1aa)+_0x55f687[_0x1d29b3(0x23b)]+'\x27'),console['error']('\x20\x20'+_0x4985c2),0x0;}}function a23_0x3769(_0x416f21,_0x5aee5d){_0x416f21=_0x416f21-0x11b;const _0x481458=a23_0x4814();let _0x376910=_0x481458[_0x416f21];return _0x376910;}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x250cc6(0x23b)]='segment:parent:validate';['description']=a23_0x250cc6(0x16d);async[a23_0x250cc6(0x163)](_0x2a8a24){const _0x135dd5=a23_0x250cc6,{options:_0x3cdb95,args:_0x49ee04,tdx:_0x296269}=_0x2a8a24,_0x5e3672=_0x3cdb95,_0x349dc7=_0x49ee04[0x0]||_0x3cdb95['parentSegment'];if(!_0x349dc7)return showParentSegmentNotSetError(_0x135dd5(0x1b3)+_0x135dd5(0x247)+_0x135dd5(0x1f0)+_0x135dd5(0x1f3)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x560c43=resolveYamlFile(_0x349dc7);if(!existsSync(_0x560c43))return showFileNotFoundError(_0x560c43,_0x349dc7),0x1;_0x5e3672[_0x135dd5(0x137)]&&(console[_0x135dd5(0x24c)]('Site:\x20'+_0x5e3672[_0x135dd5(0x1dc)]),console[_0x135dd5(0x24c)](_0x135dd5(0x1c2)+_0x560c43));let _0x277907;try{_0x277907=readFileSync(_0x560c43,_0x135dd5(0x134));}catch(_0x396c4c){const _0x53d160=_0x396c4c instanceof Error?_0x396c4c[_0x135dd5(0x131)]:String(_0x396c4c);return console[_0x135dd5(0x24c)](_0x135dd5(0x1c8)+_0x53d160),0x1;}const _0x30ad63=createCommandSpinner(a23_0xda7a3c[_0x135dd5(0x20d)](_0x135dd5(0x1b6)),{'verbose':_0x5e3672[_0x135dd5(0x137)]});_0x30ad63[_0x135dd5(0x12a)]();const _0x17d2d9={'onProgress':_0x35b1f2=>{_0x30ad63['text']=formatProgressMessage(_0x35b1f2);}};if(_0x5e3672[_0x135dd5(0x139)])_0x17d2d9['master']=!![];if(_0x5e3672[_0x135dd5(0x13c)])_0x17d2d9[_0x135dd5(0x13c)]=!![];_0x5e3672[_0x135dd5(0x149)]&&(_0x17d2d9['attribute']=_0x5e3672[_0x135dd5(0x149)]);_0x5e3672['behavior']&&(_0x17d2d9[_0x135dd5(0x1e3)]=_0x5e3672[_0x135dd5(0x1e3)]);if(_0x5e3672['interval'])_0x17d2d9[_0x135dd5(0x1e1)]=_0x5e3672[_0x135dd5(0x1e1)];let _0xcc1532;try{_0xcc1532=await _0x296269[_0x135dd5(0x23d)]['validateParentYaml'](_0x277907,_0x17d2d9),_0x30ad63[_0x135dd5(0x1d0)]();}catch(_0x916680){_0x30ad63['stop']();throw _0x916680;}const _0x4d579d=_0x5e3672['interval']||_0x135dd5(0x16e);return this[_0x135dd5(0x123)](_0xcc1532,_0x17d2d9,_0x560c43,_0x4d579d),_0xcc1532[_0x135dd5(0x168)]?0x0:0x1;}[a23_0x250cc6(0x123)](_0x2e71ff,_0x34966d,_0x3263ed,_0x24fe56){const _0x24f3c0=a23_0x250cc6;console[_0x24f3c0(0x24c)]('\x0a'+a23_0xda7a3c['bold'](_0x24f3c0(0x1ae))+'\x20'+_0x2e71ff[_0x24f3c0(0x23b)]),console[_0x24f3c0(0x24c)]('═'[_0x24f3c0(0x209)](0x3c)),this[_0x24f3c0(0x20e)](_0x2e71ff);if(typeof _0x34966d['attribute']==='string'){this[_0x24f3c0(0x226)](_0x2e71ff),this[_0x24f3c0(0x1ba)](_0x2e71ff),this[_0x24f3c0(0x211)](_0x3263ed,_0x24fe56,'attribute',_0x34966d[_0x24f3c0(0x149)]);return;}if(_0x34966d[_0x24f3c0(0x149)]===!![]){this[_0x24f3c0(0x226)](_0x2e71ff),this[_0x24f3c0(0x1ba)](_0x2e71ff),this[_0x24f3c0(0x211)](_0x3263ed,_0x24fe56,'attributes');return;}if(typeof _0x34966d[_0x24f3c0(0x1e3)]===_0x24f3c0(0x152)){this['displayBehaviorsStats'](_0x2e71ff,_0x24fe56),this[_0x24f3c0(0x1ba)](_0x2e71ff),this['displayPreviewHints'](_0x3263ed,_0x24fe56,'behavior',_0x34966d[_0x24f3c0(0x1e3)]);return;}if(_0x34966d[_0x24f3c0(0x1e3)]===!![]){this['displayBehaviorsStats'](_0x2e71ff,_0x24fe56),this[_0x24f3c0(0x1ba)](_0x2e71ff),this[_0x24f3c0(0x211)](_0x3263ed,_0x24fe56,_0x24f3c0(0x184));return;}this[_0x24f3c0(0x226)](_0x2e71ff),this[_0x24f3c0(0x221)](_0x2e71ff,_0x24fe56),this[_0x24f3c0(0x1ba)](_0x2e71ff),this[_0x24f3c0(0x211)](_0x3263ed,_0x24fe56,_0x24f3c0(0x18f));}[a23_0x250cc6(0x211)](_0x5b6c2b,_0xfbeac9,_0xdb9504,_0x17989a){const _0x337205=a23_0x250cc6;console['error']('\x0a'+a23_0xda7a3c[_0x337205(0x20d)](_0x337205(0x121)));const _0x534b0f=_0xfbeac9!==_0x337205(0x16e)?_0x337205(0x129)+_0xfbeac9:'';if(_0xdb9504===_0x337205(0x149)&&_0x17989a)console['error']('\x20\x20'+a23_0xda7a3c[_0x337205(0x20d)](_0x337205(0x13a)+_0x5b6c2b+_0x337205(0x1c4)+_0x17989a+'\x22'+_0x534b0f));else{if(_0xdb9504===_0x337205(0x1e3)&&_0x17989a)console['error']('\x20\x20'+a23_0xda7a3c[_0x337205(0x20d)]('tdx\x20segment\x20parent\x20preview\x20'+_0x5b6c2b+_0x337205(0x1bb)+_0x17989a+'\x22'+_0x534b0f));else(_0xdb9504===_0x337205(0x14a)||_0xdb9504===_0x337205(0x18f))&&console[_0x337205(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x337205(0x20d)](_0x337205(0x13a)+_0x5b6c2b+_0x337205(0x17c)+_0x534b0f));}(_0xdb9504===_0x337205(0x184)||_0xdb9504==='all')&&console['error']('\x20\x20'+a23_0xda7a3c[_0x337205(0x20d)](_0x337205(0x13a)+_0x5b6c2b+_0x337205(0x1d7)+_0x534b0f)),_0xdb9504===_0x337205(0x18f)&&console['error']('\x20\x20'+a23_0xda7a3c[_0x337205(0x20d)](_0x337205(0x13a)+_0x5b6c2b+'\x20--enriched'+_0x534b0f));}['displayMasterInfo'](_0x89f1f9){const _0xed421d=a23_0x250cc6,{master:_0x3004d2}=_0x89f1f9,_0x1030dc=_0x3004d2[_0xed421d(0x120)]?a23_0xda7a3c[_0xed421d(0x12b)]('✔'):a23_0xda7a3c[_0xed421d(0x130)]('✘');console['error']('\x0a'+a23_0xda7a3c['dim'](_0xed421d(0x1e4))),console['error'](_0x1030dc+'\x20'+a23_0xda7a3c[_0xed421d(0x24e)](_0x3004d2['database']+'.'+_0x3004d2[_0xed421d(0x1eb)])),_0x3004d2[_0xed421d(0x120)]?_0x3004d2[_0xed421d(0x125)]!==undefined&&console['error']('\x20\x20'+a23_0xda7a3c[_0xed421d(0x20d)](_0xed421d(0x1ac))+'\x20'+a23_0xda7a3c['cyan'](formatRows(_0x3004d2[_0xed421d(0x125)]))):console[_0xed421d(0x24c)]('\x20\x20'+a23_0xda7a3c[_0xed421d(0x130)](_0xed421d(0x229))+'\x20'+_0x3004d2[_0xed421d(0x22b)]);}[a23_0x250cc6(0x226)](_0x19b20e){const _0x4cff94=a23_0x250cc6;if(_0x19b20e[_0x4cff94(0x14a)][_0x4cff94(0x19d)]===0x0)return;console[_0x4cff94(0x24c)]('\x0a'+a23_0xda7a3c[_0x4cff94(0x20d)](_0x4cff94(0x1ff)));for(const _0x58187a of _0x19b20e[_0x4cff94(0x14a)]){const _0x48fb81=_0x58187a[_0x4cff94(0x120)]?a23_0xda7a3c[_0x4cff94(0x12b)]('✔'):a23_0xda7a3c[_0x4cff94(0x130)]('✘');let _0x317c7d='';if(_0x58187a[_0x4cff94(0x120)]&&_0x58187a[_0x4cff94(0x234)]!==undefined&&_0x58187a[_0x4cff94(0x1a6)]!==undefined){const _0x163f7b=_0x58187a[_0x4cff94(0x1a6)][_0x4cff94(0x1cf)](0x1),_0x294538=_0x58187a[_0x4cff94(0x1a6)]>=0x50?a23_0xda7a3c['green']:_0x58187a[_0x4cff94(0x1a6)]>=0x32?a23_0xda7a3c[_0x4cff94(0x1b0)]:a23_0xda7a3c[_0x4cff94(0x130)];_0x317c7d='\x20'+a23_0xda7a3c[_0x4cff94(0x20d)](_0x4cff94(0x206))+'\x20'+_0x294538(_0x163f7b+'%')+'\x20('+formatRows(_0x58187a[_0x4cff94(0x234)])+_0x4cff94(0x19a);}console[_0x4cff94(0x24c)](_0x48fb81+'\x20'+a23_0xda7a3c['bold'](_0x58187a['name'])+_0x317c7d),console[_0x4cff94(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x4cff94(0x20d)]('Source:')+'\x20'+a23_0xda7a3c['bold'](_0x58187a[_0x4cff94(0x17d)]+'.'+_0x58187a[_0x4cff94(0x1eb)]));const _0x17fec9=_0x58187a[_0x4cff94(0x18c)]===_0x58187a[_0x4cff94(0x182)]?a23_0xda7a3c[_0x4cff94(0x20d)](_0x4cff94(0x1fa))+'\x20'+_0x58187a[_0x4cff94(0x18c)]:a23_0xda7a3c[_0x4cff94(0x20d)](_0x4cff94(0x21f))+'\x20'+_0x58187a['joinKey']+_0x4cff94(0x244)+_0x58187a[_0x4cff94(0x182)];console[_0x4cff94(0x24c)]('\x20\x20'+_0x17fec9),console[_0x4cff94(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x4cff94(0x20d)](_0x4cff94(0x1d3))),this['displayColumns'](_0x58187a[_0x4cff94(0x19b)]),!_0x58187a[_0x4cff94(0x120)]&&console['error']('\x20\x20'+a23_0xda7a3c[_0x4cff94(0x130)](_0x4cff94(0x229))+'\x20'+_0x58187a['schemaError']);}}[a23_0x250cc6(0x221)](_0x54d6fc,_0x4b785a){const _0x3fc0dc=a23_0x250cc6;if(_0x54d6fc['behaviors']['length']===0x0)return;console[_0x3fc0dc(0x24c)]('\x0a'+a23_0xda7a3c[_0x3fc0dc(0x20d)](_0x3fc0dc(0x1cd))+'\x20'+a23_0xda7a3c[_0x3fc0dc(0x20d)]('('+_0x4b785a+')'));for(const _0x3cc2f0 of _0x54d6fc[_0x3fc0dc(0x184)]){const _0x21fd35=_0x3cc2f0[_0x3fc0dc(0x120)]?a23_0xda7a3c['green']('✔'):a23_0xda7a3c[_0x3fc0dc(0x130)]('✘');let _0x4ba760='';if(_0x3cc2f0[_0x3fc0dc(0x120)]&&_0x3cc2f0[_0x3fc0dc(0x175)]!==undefined&&_0x3cc2f0[_0x3fc0dc(0x148)]!==undefined){const _0x36ac6d=_0x3cc2f0[_0x3fc0dc(0x15c)]?.['toFixed'](0x1)||'?',_0x4b77e9=(_0x3cc2f0[_0x3fc0dc(0x15c)]??0x0)>=0x32?a23_0xda7a3c[_0x3fc0dc(0x12b)]:(_0x3cc2f0[_0x3fc0dc(0x15c)]??0x0)>=0x14?a23_0xda7a3c[_0x3fc0dc(0x1b0)]:a23_0xda7a3c['red'];_0x4ba760='\x20'+a23_0xda7a3c[_0x3fc0dc(0x20d)]('Customers:')+'\x20'+_0x4b77e9(formatRows(_0x3cc2f0[_0x3fc0dc(0x175)]))+'\x20('+_0x36ac6d+_0x3fc0dc(0x13b)+a23_0xda7a3c['dim'](_0x3fc0dc(0x1f5))+'\x20'+a23_0xda7a3c[_0x3fc0dc(0x1bc)](formatRows(_0x3cc2f0[_0x3fc0dc(0x148)]));}console[_0x3fc0dc(0x24c)](_0x21fd35+'\x20'+a23_0xda7a3c['bold'](_0x3cc2f0['name'])+_0x4ba760),console[_0x3fc0dc(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x3fc0dc(0x20d)]('Source:')+'\x20'+a23_0xda7a3c[_0x3fc0dc(0x24e)](_0x3cc2f0[_0x3fc0dc(0x17d)]+'.'+_0x3cc2f0[_0x3fc0dc(0x1eb)]));const _0x1802ba=_0x3cc2f0[_0x3fc0dc(0x18c)]===_0x3cc2f0[_0x3fc0dc(0x182)]?a23_0xda7a3c[_0x3fc0dc(0x20d)](_0x3fc0dc(0x1fa))+'\x20'+_0x3cc2f0[_0x3fc0dc(0x18c)]:a23_0xda7a3c[_0x3fc0dc(0x20d)](_0x3fc0dc(0x21f))+'\x20'+_0x3cc2f0[_0x3fc0dc(0x18c)]+_0x3fc0dc(0x244)+_0x3cc2f0[_0x3fc0dc(0x182)];console[_0x3fc0dc(0x24c)]('\x20\x20'+_0x1802ba),console['error']('\x20\x20'+a23_0xda7a3c[_0x3fc0dc(0x20d)]('Columns:')),this['displayColumns'](_0x3cc2f0['columns']),!_0x3cc2f0[_0x3fc0dc(0x120)]&&console[_0x3fc0dc(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x3fc0dc(0x130)]('Error:')+'\x20'+_0x3cc2f0[_0x3fc0dc(0x22b)]);}}[a23_0x250cc6(0x173)](_0x39b95e){const _0x4cfe97=a23_0x250cc6;for(const _0x1d50de of _0x39b95e){_0x1d50de['label']===_0x1d50de['column']||_0x1d50de[_0x4cfe97(0x240)]==='*'?console[_0x4cfe97(0x24c)](_0x4cfe97(0x219)+_0x1d50de[_0x4cfe97(0x23c)]):console[_0x4cfe97(0x24c)](_0x4cfe97(0x219)+_0x1d50de[_0x4cfe97(0x23c)]+'\x20'+a23_0xda7a3c['dim']('('+_0x1d50de[_0x4cfe97(0x240)]+')'));}}[a23_0x250cc6(0x1ba)](_0x353017){const _0x40958a=a23_0x250cc6;console[_0x40958a(0x24c)]('─'['repeat'](0x3c));if(_0x353017['errors'][_0x40958a(0x19d)]>0x0){console[_0x40958a(0x24c)]('\x0a'+a23_0xda7a3c[_0x40958a(0x130)](_0x40958a(0x1ca)));for(const _0x30f7f5 of _0x353017['errors']){console[_0x40958a(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x40958a(0x130)]('•')+'\x20'+_0x30f7f5);}}_0x353017[_0x40958a(0x168)]&&console[_0x40958a(0x24c)]('\x0a'+a23_0xda7a3c[_0x40958a(0x12b)]('✔')+_0x40958a(0x22d));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x250cc6(0x23b)]='segment:parent:preview';[a23_0x250cc6(0x180)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a23_0x250cc6(0x163)](_0x3a6f4d){const _0x4efc13=a23_0x250cc6,{options:_0x24bb9b,args:_0x41fca8,tdx:_0x4f0550}=_0x3a6f4d,_0x3a19ae=_0x24bb9b,_0x2154ac=_0x41fca8[0x0]||_0x24bb9b[_0x4efc13(0x1cb)];if(!_0x2154ac)return showParentSegmentNotSetError(_0x4efc13(0x1d6)+_0x4efc13(0x158)+_0x4efc13(0x20b)+_0x4efc13(0x1da)+_0x4efc13(0x15b)+_0x4efc13(0x193)+_0x4efc13(0x1c3)+_0x4efc13(0x160)),0x1;if(!_0x3a19ae[_0x4efc13(0x139)]&&!_0x3a19ae['attribute']&&!_0x3a19ae[_0x4efc13(0x1e3)]&&!_0x3a19ae[_0x4efc13(0x13c)])return console[_0x4efc13(0x24c)](a23_0xda7a3c[_0x4efc13(0x130)](_0x4efc13(0x1b7))),console[_0x4efc13(0x24c)](_0x4efc13(0x1a1)),console[_0x4efc13(0x24c)](_0x4efc13(0x249)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x4efc13(0x24c)](_0x4efc13(0x13f)),console[_0x4efc13(0x24c)](_0x4efc13(0x1f8)),console[_0x4efc13(0x24c)](_0x4efc13(0x241)),0x1;const _0x2e6b57=resolveYamlFile(_0x2154ac);if(!existsSync(_0x2e6b57))return showFileNotFoundError(_0x2e6b57,_0x2154ac),0x1;_0x3a19ae['verbose']&&(console['error'](_0x4efc13(0x17b)+_0x3a19ae[_0x4efc13(0x1dc)]),console[_0x4efc13(0x24c)]('YAML\x20file:\x20'+_0x2e6b57));let _0x4c6300;try{_0x4c6300=readFileSync(_0x2e6b57,'utf-8');}catch(_0x1dfb67){const _0x4da5af=_0x1dfb67 instanceof Error?_0x1dfb67['message']:String(_0x1dfb67);return console[_0x4efc13(0x24c)]('Error\x20reading\x20file:\x20'+_0x4da5af),0x1;}let _0x4c76d5;try{_0x4c76d5=parseDef(_0x4c6300);}catch(_0x3aef43){const _0xc373f0=_0x3aef43 instanceof Error?_0x3aef43[_0x4efc13(0x131)]:String(_0x3aef43);return console[_0x4efc13(0x24c)](a23_0xda7a3c[_0x4efc13(0x130)]('Error\x20parsing\x20YAML:\x20'+_0xc373f0)),0x1;}if(_0x3a19ae[_0x4efc13(0x149)]===!![]||_0x3a19ae[_0x4efc13(0x149)]===''){const _0x3195ca=_0x4c76d5[_0x4efc13(0x14a)]?.[_0x4efc13(0x1f4)](_0x20b090=>_0x20b090[_0x4efc13(0x23b)])||[];if(_0x3195ca[_0x4efc13(0x19d)]===0x0)console['error'](a23_0xda7a3c[_0x4efc13(0x130)](_0x4efc13(0x1e0)));else{console[_0x4efc13(0x24c)](a23_0xda7a3c[_0x4efc13(0x130)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x4efc13(0x24c)](_0x4efc13(0x239));for(const _0x118008 of _0x3195ca){console[_0x4efc13(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x4efc13(0x1bc)](_0x118008));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2154ac+_0x4efc13(0x1c4)+_0x3195ca[0x0]+'\x22');}return 0x1;}if(_0x3a19ae[_0x4efc13(0x1e3)]===!![]||_0x3a19ae[_0x4efc13(0x1e3)]===''){const _0x3f462f=_0x4c76d5[_0x4efc13(0x184)]?.[_0x4efc13(0x1f4)](_0x28c8a8=>_0x28c8a8[_0x4efc13(0x23b)])||[];if(_0x3f462f[_0x4efc13(0x19d)]===0x0)console[_0x4efc13(0x24c)](a23_0xda7a3c[_0x4efc13(0x130)](_0x4efc13(0x1cc)));else{console[_0x4efc13(0x24c)](a23_0xda7a3c['red'](_0x4efc13(0x12c))),console[_0x4efc13(0x24c)]('Available\x20behaviors:');for(const _0x1ff561 of _0x3f462f){console[_0x4efc13(0x24c)]('\x20\x20'+a23_0xda7a3c['cyan'](_0x1ff561));}console['error'](_0x4efc13(0x248)+_0x2154ac+_0x4efc13(0x1bb)+_0x3f462f[0x0]+'\x22');}return 0x1;}const _0x1a72eb=createCommandSpinner(a23_0xda7a3c[_0x4efc13(0x20d)]('Fetching\x20sample\x20data...'),{'verbose':_0x3a19ae[_0x4efc13(0x137)]});_0x1a72eb[_0x4efc13(0x12a)]();const _0x22cead={'onProgress':_0x41ca89=>{const _0x7b4d02=_0x4efc13;_0x1a72eb[_0x7b4d02(0x161)]=formatProgressMessage(_0x41ca89);}};if(_0x3a19ae['master'])_0x22cead['master']=!![];if(_0x3a19ae[_0x4efc13(0x149)]&&typeof _0x3a19ae['attribute']===_0x4efc13(0x152))_0x22cead['attribute']=_0x3a19ae[_0x4efc13(0x149)];if(_0x3a19ae[_0x4efc13(0x1e3)]&&typeof _0x3a19ae[_0x4efc13(0x1e3)]===_0x4efc13(0x152))_0x22cead[_0x4efc13(0x1e3)]=_0x3a19ae[_0x4efc13(0x1e3)];if(_0x3a19ae['enriched'])_0x22cead[_0x4efc13(0x13c)]=!![];if(_0x3a19ae[_0x4efc13(0x1e1)])_0x22cead[_0x4efc13(0x1e1)]=_0x3a19ae['interval'];let _0x59c27a;try{_0x59c27a=await _0x4f0550[_0x4efc13(0x23d)][_0x4efc13(0x236)](_0x4c6300,_0x22cead),_0x1a72eb['stop']();}catch(_0x5c4d0f){_0x1a72eb['stop']();throw _0x5c4d0f;}return await this['displayPreviewResults'](_0x59c27a,{'master':_0x3a19ae['master'],'attribute':typeof _0x3a19ae['attribute']==='string'?_0x3a19ae[_0x4efc13(0x149)]:undefined,'behavior':typeof _0x3a19ae[_0x4efc13(0x1e3)]===_0x4efc13(0x152)?_0x3a19ae[_0x4efc13(0x1e3)]:undefined,'enriched':_0x3a19ae[_0x4efc13(0x13c)]}),_0x59c27a[_0x4efc13(0x168)]?0x0:0x1;}async[a23_0x250cc6(0x1c6)](_0x4b716a,_0x5a5a25){const _0x4bb900=a23_0x250cc6;console[_0x4bb900(0x24c)]('\x0a'+a23_0xda7a3c['bold'](_0x4bb900(0x21b))+'\x20'+_0x4b716a['name']),console[_0x4bb900(0x24c)]('═'[_0x4bb900(0x209)](0x3c));if(_0x5a5a25[_0x4bb900(0x139)]&&_0x4b716a[_0x4bb900(0x18d)]){const _0x1d3b90=a23_0xda7a3c[_0x4bb900(0x20d)](_0x4bb900(0x19e))+'\x20'+a23_0xda7a3c[_0x4bb900(0x24e)](_0x4b716a[_0x4bb900(0x139)][_0x4bb900(0x17d)]+'.'+_0x4b716a[_0x4bb900(0x139)][_0x4bb900(0x1eb)]);await this[_0x4bb900(0x1bd)](_0x1d3b90,_0x4b716a[_0x4bb900(0x18d)]);}else{if(_0x5a5a25[_0x4bb900(0x149)]&&_0x4b716a['sampleData']){const _0x5c44e2=a23_0xda7a3c[_0x4bb900(0x20d)](_0x4bb900(0x16a))+'\x20'+a23_0xda7a3c[_0x4bb900(0x24e)](_0x5a5a25[_0x4bb900(0x149)]);await this[_0x4bb900(0x1bd)](_0x5c44e2,_0x4b716a[_0x4bb900(0x18d)]);}else{if(_0x5a5a25[_0x4bb900(0x1e3)]&&_0x4b716a[_0x4bb900(0x18d)]){const _0x2195e8=a23_0xda7a3c[_0x4bb900(0x20d)]('Behavior:')+'\x20'+a23_0xda7a3c[_0x4bb900(0x24e)](_0x5a5a25[_0x4bb900(0x1e3)]);await this[_0x4bb900(0x1bd)](_0x2195e8,_0x4b716a[_0x4bb900(0x18d)]);}else{if(_0x5a5a25[_0x4bb900(0x13c)]&&_0x4b716a['sampleData']){const _0x473306=a23_0xda7a3c[_0x4bb900(0x20d)](_0x4bb900(0x210))+'\x20'+a23_0xda7a3c['bold'](_0x4bb900(0x151));await this['displaySampleData'](_0x473306,_0x4b716a['sampleData']);}else!_0x4b716a[_0x4bb900(0x18d)]&&console[_0x4bb900(0x24c)](_0x4bb900(0x1fe));}}}if(_0x4b716a['errors']['length']>0x0){console['error']('─'[_0x4bb900(0x209)](0x3c)),console[_0x4bb900(0x24c)]('\x0a'+a23_0xda7a3c[_0x4bb900(0x130)](_0x4bb900(0x1ca)));for(const _0x41acfd of _0x4b716a[_0x4bb900(0x1fb)]){console[_0x4bb900(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x4bb900(0x130)]('•')+'\x20'+_0x41acfd);}}}async['displaySampleData'](_0xfc7138,_0x1899d5){const _0x16bfe5=a23_0x250cc6;if(_0x1899d5[_0x16bfe5(0x19d)]===0x0){console[_0x16bfe5(0x24c)]('\x0a'+_0xfc7138),console[_0x16bfe5(0x24c)](_0x16bfe5(0x218));return;}console[_0x16bfe5(0x24c)]('\x0a'+_0xfc7138);const _0x5dff05=Object[_0x16bfe5(0x1ab)](_0x1899d5[0x0])[_0x16bfe5(0x1f4)](_0x46f0a5=>({'name':_0x46f0a5,'type':typeof _0x1899d5[0x0][_0x46f0a5]==='number'?_0x16bfe5(0x192):_0x16bfe5(0x170)})),_0x3bc057={'queryId':_0x16bfe5(0x228),'columns':_0x5dff05,'data':_0x1899d5,'stats':{'state':_0x16bfe5(0x185),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1899d5[_0x16bfe5(0x19d)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1116c5=formatAsTable(_0x3bc057,_0x1899d5['length'],!![]);await writeOutput(_0x1116c5,undefined,_0x16bfe5(0x1eb));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x250cc6(0x23b)]='segment:parent:run';['description']=a23_0x250cc6(0x145);async['execute'](_0x5f4fbf){const _0x36604f=a23_0x250cc6,{options:_0x4f98f7,args:_0x1cf94f,tdx:_0x348269}=_0x5f4fbf,_0x5d0fb6=_0x4f98f7,_0x8e6637=_0x1cf94f[0x0]||_0x4f98f7[_0x36604f(0x1cb)];if(!_0x8e6637)return showParentSegmentNotSetError(_0x36604f(0x17e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x697f04=resolveYamlFile(_0x8e6637);if(existsSync(_0x697f04)){_0x5d0fb6[_0x36604f(0x137)]&&console[_0x36604f(0x24c)](_0x36604f(0x225)+_0x697f04);let _0x55a10f;try{_0x55a10f=readFileSync(_0x697f04,_0x36604f(0x134));}catch(_0x2feb1c){const _0x5bc03b=_0x2feb1c instanceof Error?_0x2feb1c['message']:String(_0x2feb1c);return console[_0x36604f(0x24c)](_0x36604f(0x1c8)+_0x5bc03b),0x1;}const _0x39e9d4=await withSpinner(_0x36604f(0x20a),()=>_0x348269[_0x36604f(0x23d)][_0x36604f(0x1dd)](_0x55a10f),{'verbose':_0x5d0fb6[_0x36604f(0x137)]}),_0x452888=_0x39e9d4[_0x36604f(0x1e9)],{isNew:_0x978097,name:_0x3547aa,hasChanges:_0x565115,diffFormatted:_0x1b5ae2}=_0x452888;if(_0x565115){_0x978097?console[_0x36604f(0x24c)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3547aa+'\x27:'):console['error'](_0x36604f(0x142)+_0x3547aa+'\x27:');console[_0x36604f(0x24c)]('─'['repeat'](0x3c)),console[_0x36604f(0x24c)](_0x1b5ae2),console[_0x36604f(0x24c)]('─'[_0x36604f(0x209)](0x3c));const _0x48989a=_0x978097?_0x36604f(0x194)+_0x3547aa+_0x36604f(0x21c):_0x36604f(0x227)+_0x3547aa+_0x36604f(0x21c);if(!_0x5d0fb6[_0x36604f(0x132)]){const _0x3a415d=await confirmKey(_0x48989a);if(!_0x3a415d)return console['error'](_0x36604f(0x1a5)),0x1;}const _0x548661=_0x978097?_0x36604f(0x164):_0x36604f(0x177);await withSpinner(_0x548661+_0x36604f(0x1aa)+_0x3547aa+_0x36604f(0x154),()=>_0x452888[_0x36604f(0x1c9)](),{'verbose':_0x5d0fb6[_0x36604f(0x137)]});const _0x1491f9=_0x978097?_0x36604f(0x223):_0x36604f(0x138);console[_0x36604f(0x24c)]('✔\x20'+_0x1491f9+'\x20parent\x20segment\x20\x27'+_0x3547aa+'\x27');}else console[_0x36604f(0x24c)](_0x36604f(0x1c5)+_0x3547aa+_0x36604f(0x196));}const _0x569f2a=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x8e6637+'\x27...',()=>_0x348269[_0x36604f(0x23d)][_0x36604f(0x216)](_0x8e6637),{'verbose':_0x5d0fb6[_0x36604f(0x137)]}),_0x52fda8=_0x569f2a['data'],_0x41bff9=getConsoleUrl(_0x5d0fb6[_0x36604f(0x1dc)],_0x36604f(0x19c)+_0x52fda8['workflowId']+_0x36604f(0x146)+_0x52fda8[_0x36604f(0x237)]+'/attempt/'+_0x52fda8[_0x36604f(0x24d)]);return console['error'](_0x36604f(0x1c0)),console[_0x36604f(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x36604f(0x20d)](_0x36604f(0x157))+'\x20'+_0x52fda8[_0x36604f(0x136)]),console[_0x36604f(0x24c)]('\x20\x20'+a23_0xda7a3c['dim'](_0x36604f(0x231))+'\x20'+_0x52fda8[_0x36604f(0x190)]),console[_0x36604f(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x36604f(0x20d)](_0x36604f(0x1fc))+'\x20'+_0x52fda8['workflowSessionId']),console[_0x36604f(0x24c)]('\x20\x20'+a23_0xda7a3c[_0x36604f(0x20d)](_0x36604f(0x222))+'\x20'+_0x52fda8[_0x36604f(0x24d)]),console[_0x36604f(0x24c)]('\x20\x20'+_0x41bff9),console[_0x36604f(0x24c)]('\x0a'+a23_0xda7a3c[_0x36604f(0x20d)](_0x36604f(0x11c))+_0x36604f(0x1e2)+_0x52fda8[_0x36604f(0x24d)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x250cc6(0x1bf);[a23_0x250cc6(0x180)]=a23_0x250cc6(0x24b);async[a23_0x250cc6(0x163)](_0x165b06){const _0x4ec541=a23_0x250cc6,{options:_0x5dbabe,args:_0x5a8e83,tdx:_0x1b804b}=_0x165b06,_0x42a753=_0x5a8e83[0x0]||_0x5dbabe[_0x4ec541(0x1cb)];if(!_0x42a753)return showParentSegmentNotSetError(_0x4ec541(0x1a3)+_0x4ec541(0x15e)),0x1;_0x5dbabe['verbose']&&(console['error'](_0x4ec541(0x17b)+_0x5dbabe[_0x4ec541(0x1dc)]),console[_0x4ec541(0x24c)]('Parent\x20segment:\x20'+_0x42a753));const _0x562817=await withSpinner(_0x4ec541(0x235)+_0x42a753+_0x4ec541(0x154),()=>_0x1b804b['segment'][_0x4ec541(0x14b)](_0x42a753),{'verbose':_0x5dbabe[_0x4ec541(0x137)]}),_0x425f36=_0x562817[_0x4ec541(0x1e9)];console['error'](_0x4ec541(0x11b)+_0x425f36[_0x4ec541(0x19d)]+_0x4ec541(0x1e7)+(_0x425f36[_0x4ec541(0x19d)]!==0x1?'s':''));if(_0x5dbabe[_0x4ec541(0x16f)]||_0x5dbabe['jsonl'])return await handleSDKOutput(_0x425f36,_0x5dbabe),0x0;return displayFieldsHumanReadable(_0x425f36,_0x42a753),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x250cc6(0x23b)]='segment:parent:view';[a23_0x250cc6(0x180)]=a23_0x250cc6(0x1b1);async[a23_0x250cc6(0x163)](_0x13afe9){const _0x305bd7=a23_0x250cc6,{options:_0x162141,args:_0x1927dd,tdx:_0x1e1924}=_0x13afe9,_0x216e74=_0x162141,_0xb6badb=_0x1927dd[0x0]||_0x162141[_0x305bd7(0x1cb)];if(!_0xb6badb)return showParentSegmentNotSetError(_0x305bd7(0x197)+_0x305bd7(0x233)+'Options:\x0a'+_0x305bd7(0x217)),0x1;_0x162141[_0x305bd7(0x137)]&&(console[_0x305bd7(0x24c)](_0x305bd7(0x17b)+_0x162141[_0x305bd7(0x1dc)]),console[_0x305bd7(0x24c)]('Parent\x20segment:\x20'+_0xb6badb));const _0x282e53=await withSpinner(_0x305bd7(0x1b8)+_0xb6badb+_0x305bd7(0x154),()=>_0x1e1924[_0x305bd7(0x23d)][_0x305bd7(0x1a8)](_0xb6badb),{'verbose':_0x162141[_0x305bd7(0x137)]}),_0x3168f1=_0x282e53['data'];if(_0x216e74['web']){const _0xafd317=getConsoleNextUrl(_0x216e74[_0x305bd7(0x1dc)],_0x305bd7(0x1d9)+_0x3168f1['id']);return console[_0x305bd7(0x24c)](a23_0xda7a3c['green']('✔')+_0x305bd7(0x21e)+a23_0xda7a3c[_0x305bd7(0x1bc)](_0xafd317)),openBrowser(_0xafd317),0x0;}return await handleSingleObjectOutput(_0x3168f1,_0x162141),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a23_0x250cc6(0x14c);[a23_0x250cc6(0x180)]=a23_0x250cc6(0x1d1);async['execute'](_0x5a8946){const _0xc534c1=a23_0x250cc6,{options:_0xae8650,args:_0x6f5bad,tdx:_0x48ce76}=_0x5a8946,_0x2d6bcf=_0x6f5bad[0x0]||_0xae8650[_0xc534c1(0x1cb)];if(!_0x2d6bcf)return showParentSegmentNotSetError(_0xc534c1(0x150)+_0xc534c1(0x1f2)),0x1;_0xae8650[_0xc534c1(0x137)]&&(console['error'](_0xc534c1(0x17b)+_0xae8650[_0xc534c1(0x1dc)]),console[_0xc534c1(0x24c)](_0xc534c1(0x171)+_0x2d6bcf));const _0x105736=await withSpinner(_0xc534c1(0x186)+_0x2d6bcf+_0xc534c1(0x154),()=>_0x48ce76[_0xc534c1(0x23d)]['resolveParentId'](_0x2d6bcf),{'verbose':_0xae8650[_0xc534c1(0x137)]}),_0x528b9c=_0x105736[_0xc534c1(0x1e9)],_0x24e440=await withSpinner(_0xc534c1(0x16c)+_0x2d6bcf+'\x27...',()=>_0x48ce76[_0xc534c1(0x23d)][_0xc534c1(0x205)](_0x528b9c),{'verbose':_0xae8650[_0xc534c1(0x137)]}),_0x3f56bc=await executeSchemaQuery(_0x24e440[_0xc534c1(0x1e9)],_0x48ce76,_0xae8650);return await handleQueryOutput(_0x3f56bc,_0xae8650),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x250cc6(0x23b)]=a23_0x250cc6(0x12d);[a23_0x250cc6(0x180)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a23_0x250cc6(0x163)](_0x5ee3b2){const _0x2e149c=a23_0x250cc6,{options:_0x22bf57,args:_0x128cea,tdx:_0x194fd9}=_0x5ee3b2,_0x8077a9=_0x128cea[0x0]||_0x22bf57[_0x2e149c(0x1cb)];if(!_0x8077a9)return showParentSegmentNotSetError(_0x2e149c(0x201)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x22bf57[_0x2e149c(0x137)]&&(console[_0x2e149c(0x24c)](_0x2e149c(0x17b)+_0x22bf57[_0x2e149c(0x1dc)]),console[_0x2e149c(0x24c)](_0x2e149c(0x171)+_0x8077a9));const _0x9eaafd=await withSpinner(_0x2e149c(0x186)+_0x8077a9+_0x2e149c(0x154),()=>_0x194fd9[_0x2e149c(0x23d)][_0x2e149c(0x135)](_0x8077a9),{'verbose':_0x22bf57['verbose']}),_0x769814=_0x9eaafd[_0x2e149c(0x1e9)],_0x2dd69e=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x8077a9+'\x27...',()=>_0x194fd9[_0x2e149c(0x23d)]['getParentSQL'](_0x769814),{'verbose':_0x22bf57[_0x2e149c(0x137)]}),_0x309e28=_0x2dd69e[_0x2e149c(0x1e9)];return _0x22bf57[_0x2e149c(0x1d8)]===_0x2e149c(0x16f)||_0x22bf57['format']===_0x2e149c(0x23f)?await handleSDKOutput([{'sql':_0x309e28}],_0x22bf57):console['log'](_0x309e28),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x250cc6(0x23b)]=a23_0x250cc6(0x167);['description']=a23_0x250cc6(0x22c);async[a23_0x250cc6(0x163)](_0x44998d){const _0x391b30=a23_0x250cc6,{options:_0xe93306,args:_0x140c38,tdx:_0x19cba9}=_0x44998d,_0xe56e3=_0x140c38[0x0]||_0xe93306['parentSegment'];if(!_0xe56e3)return showParentSegmentNotSetError(_0x391b30(0x24a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0xe93306[_0x391b30(0x137)]&&(console[_0x391b30(0x24c)](_0x391b30(0x17b)+_0xe93306['site']),console['error'](_0x391b30(0x171)+_0xe56e3));const _0x334fef=await withSpinner(_0x391b30(0x186)+_0xe56e3+_0x391b30(0x154),()=>_0x19cba9['segment'][_0x391b30(0x135)](_0xe56e3),{'verbose':_0xe93306['verbose']}),_0x9718ec=_0x334fef['data'],_0x1eee7f=await withSpinner(_0x391b30(0x16c)+_0xe56e3+_0x391b30(0x154),()=>_0x19cba9[_0x391b30(0x23d)][_0x391b30(0x205)](_0x9718ec),{'verbose':_0xe93306['verbose']});let _0x3847f8=_0x1eee7f[_0x391b30(0x1e9)];const _0x54b5bf=resolveLimit(_0xe93306[_0x391b30(0x126)],DEFAULT_DISPLAY_LIMIT),_0x45803d=/\bLIMIT\s+\d+/i[_0x391b30(0x245)](_0x3847f8);!_0x45803d&&(_0x3847f8=_0x3847f8[_0x391b30(0x1b9)]()[_0x391b30(0x155)](/;+$/,''),_0x3847f8=_0x391b30(0x1f9)+_0x3847f8+_0x391b30(0x11d)+_0x54b5bf);_0xe93306['verbose']&&console['error']('SQL\x20query:\x0a'+_0x3847f8);const _0x14d46=await withProgressSpinner(_0x391b30(0x200),async _0x5a4495=>{const _0xbf4cf0=_0x391b30,_0xd629b4=await _0x19cba9[_0xbf4cf0(0x230)][_0xbf4cf0(0x163)](_0x3847f8,{'catalog':'td','schema':'information_schema','onJobId':_0x65572a=>{const _0x1c9abe=_0xbf4cf0;_0x5a4495[_0x1c9abe(0x141)](_0x65572a);}});return _0xd629b4;},{'verbose':_0xe93306[_0x391b30(0x137)]}),_0x251f63=_0x14d46[_0x391b30(0x1e9)],_0xe79615=_0x251f63[_0x391b30(0x165)]?'\x20[Job\x20ID:\x20'+_0x251f63[_0x391b30(0x165)]+']':'';return console[_0x391b30(0x24c)](_0x391b30(0x159)+_0x251f63[_0x391b30(0x1a4)][_0x391b30(0x172)][_0x391b30(0x1ce)]()+'\x20rows\x20'+(_0x391b30(0x220)+formatElapsed(_0x251f63['stats'][_0x391b30(0x147)])+_0xe79615)),await handleQueryOutput(_0x251f63,_0xe93306),0x0;}}
|
|
1
|
+
const a23_0xc01503=a23_0x2e63;(function(_0x42b548,_0x35f531){const _0x94e770=a23_0x2e63,_0x460c7d=_0x42b548();while(!![]){try{const _0x307912=parseInt(_0x94e770(0x19a))/0x1*(-parseInt(_0x94e770(0x187))/0x2)+-parseInt(_0x94e770(0x160))/0x3*(-parseInt(_0x94e770(0x138))/0x4)+parseInt(_0x94e770(0xf4))/0x5*(-parseInt(_0x94e770(0x129))/0x6)+parseInt(_0x94e770(0x11d))/0x7*(parseInt(_0x94e770(0x18c))/0x8)+parseInt(_0x94e770(0x1f4))/0x9*(parseInt(_0x94e770(0x18d))/0xa)+-parseInt(_0x94e770(0xf7))/0xb*(-parseInt(_0x94e770(0x1ed))/0xc)+-parseInt(_0x94e770(0x161))/0xd*(parseInt(_0x94e770(0x192))/0xe);if(_0x307912===_0x35f531)break;else _0x460c7d['push'](_0x460c7d['shift']());}catch(_0x2d0b39){_0x460c7d['push'](_0x460c7d['shift']());}}}(a23_0x2528,0xc168f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a23_0x2e63(_0x45d6e1,_0x35921b){_0x45d6e1=_0x45d6e1-0xd3;const _0x2528f4=a23_0x2528();let _0x2e63af=_0x2528f4[_0x45d6e1];return _0x2e63af;}import a23_0x2dac7b 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';function a23_0x2528(){const _0x5d343d=['Fetching\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Available\x20attributes:','setJobId','pullParentYaml','Updated','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','column','\x0a⚠️\x20\x20Both\x20','format','stop','workflowId','scheduleType','displayValidateResults','Error\x20parsing\x20YAML:\x20','parent_segments','\x27\x20with\x20ID:\x20','bold','\x0aNew\x20parent\x20segment\x20\x27','\x20--interval\x20','pushParentYaml','customerGroupFile','\x0aChanges\x20to\x20\x27','addAttributes','3PBWRDE','22077133dogmgt','apply','Join\x20on:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Fetching\x20SQL\x20for\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20--attribute\x20\x22<name>\x22','execute','population','Join:','string','segment:parent:validate','sort','Created','-1d','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','sampleData','Behavior:','attributesFile','/\x20directories\x20exist.','\x20parent\x20segment\x20\x27','isDirectory','\x20kill','schemaError','\x20rows)','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Pattern:\x20','\x0a⚠️\x20\x20Migrating:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','description','Coverage:','Database:\x20','.yaml','Errors:','using\x20the\x20default\x20path:\x20','coveragePercent','👥\x20','updateParent','2EezPuJ','foreignKey','parentSegment','✔\x20No\x20changes\x20-\x20\x27','\x0aNo\x20sample\x20data\x20available','936hBzmTx','47510QsoiQI','verbose','filter','log','addAttributesFile','28aAftEO','Error:\x20File\x20not\x20found:\x20','\x20No\x20changes\x20-\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Options:\x0a','red','Error\x20reading\x20file:\x20','rowCount','299375nsRJYK','behaviors','test','json','Available\x20behaviors:','/attempt/','name','Master\x20Table','totalEvents','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayBehaviorsStats','utf-8','YAML\x20file:\x20','open','\x27\x20is\x20up\x20to\x20date','limit','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','database','jobId','Preview:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','table','behavior','message','Output\x20file:\x20','elapsedTimeMillis','matchedCount','scheduleOption','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','error','join','ignore','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Source:','✘\x20Failed\x20to\x20rename\x20directory:\x20','interval','FINISHED','Status:','✔\x20Query\x20completed:\x20Processed\x20','number','\x27\x20and\x20run\x20workflow?','/\x20→\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','displayPreviewHints','Options:','/{name}.yml\x0a','getParentFull','✔\x20Created\x20parent\x20segment\x20\x27','listParents','segment:parent:run','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Analyzing\x20changes...','yellow','site','Customers:','getParentSQL','\x20[Job\x20ID:\x20','\x20tdx\x20wf\x20attempt\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20rows\x20','displaySampleData','endsWith','resolveParentId','columns','data','Audience\x20ID:','customersWithEvents','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment','\x5c$&','schemaValid','attributes','\x20Opening\x20','errors','Behaviors','green','\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--behavior\x20requires\x20a\x20name\x0a','behaviorsFile','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','11892MjIhrj','segment:parent:create','\x20=\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','List\x20parent\x20segments','displayMasterInfo','Validate:','2961ZvVWEN','toLocaleString','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','map','segment:parent:preview','repeat','No\x20parent\x20segments\x20found','Fetching\x20sample\x20data...','SELECT\x20*\x20FROM\x20(\x0a','run','displayColumns','\x20--enriched','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','segment:parent:view','displayAttributesStats','workflowAttemptId','\x0aUsage:\x20tdx\x20ps\x20preview\x20','✔\x20Updated\x20parent\x20segment\x20\x27','Aborted.','unref','\x20field','jsonl','Updating','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','information_schema','Apply\x20changes\x20to\x20\x27','customerPercent','Error:\x20Parent\x20segment\x20name\x20is\x20required','label','timezone','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','/app/dw/parentSegments/','stats','all','4690175LkMWWm','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','allValid','15818nGGSOY','master','Error:','toFixed','segment:parent:desc','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20parent\x20segment','Columns:','tdx\x20segment\x20parent\x20preview\x20','SQL\x20query:\x0a','segment:parent:push','addBehaviorsFile','segment:parent:pull','\x27...','xdg-open','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','parent_segment','dim','win32','Events:','\x20--behavior\x20\x22<name>\x22','Resolving\x20parent\x20segment\x20\x27','enriched','previewParentYaml','Listing\x20fields\x20for\x20\x27','workflowSessionId','cyan','segment:parent:sql','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Parent\x20segment:\x20','output','Show\x20parent\x20segment\x20details','Listing\x20parent\x20segments...','length','yes','/app/workflows/','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','87451FSPlwz','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','replace','Site:\x20','\x20Configuration\x20is\x20valid','segment:parent:update','Master:','Validating\x20configuration...','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0a✔\x20Workflow\x20started','Create\x20parent\x20segment\x20\x27','displayPreviewResults','6jbELwe','start','customerGroup','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Session:','Executing\x20parent\x20segment\x20query...','match','✔\x20Found\x20','joinKey','processedRows','validateParentYaml','\x27\x20is\x20already\x20up\x20to\x20date','darwin','.yml','attribute','3905124bQHYCd','localeCompare','addBehaviors','Options\x20(one\x20required):\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','displaySummary','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','preview','\x20\x20\x20\x20-\x20','Name:\x20','use','\x20--behavior\x20\x22'];a23_0x2528=function(){return _0x5d343d;};return a23_0x2528();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x5642ef 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=a23_0xc01503(0x157),LEGACY_PARENT_SEGMENT_DIR=a23_0xc01503(0x107);function openBrowser(_0x3ab9f0){const _0x2c09f7=a23_0xc01503,_0xb03ebc=process['platform'],_0x1613d2=_0xb03ebc===_0x2c09f7(0x135)?_0x2c09f7(0x1a7):_0xb03ebc===_0x2c09f7(0x109)?_0x2c09f7(0x12a):_0x2c09f7(0x105);spawn(_0x1613d2,[_0x3ab9f0],{'detached':!![],'stdio':_0x2c09f7(0x1bc)})[_0x2c09f7(0xe5)]();}function migrateLegacyDirectory(){const _0x16a072=a23_0xc01503;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x36dfdd=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x36dfdd[_0x16a072(0x176)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x16a072(0x1ba)](a23_0x5642ef[_0x16a072(0x1d1)](_0x16a072(0x150)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x16a072(0x174))),console['error'](a23_0x5642ef['dim'](_0x16a072(0xf5)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x16a072(0x1ba)](a23_0x5642ef[_0x16a072(0x1d1)](_0x16a072(0x17c)+LEGACY_PARENT_SEGMENT_DIR+_0x16a072(0x1c6)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x16a072(0x1ba)](a23_0x5642ef[_0x16a072(0x1e8)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4b96bc){const _0x5bb036=_0x4b96bc instanceof Error?_0x4b96bc[_0x16a072(0x1b4)]:String(_0x4b96bc);return console[_0x16a072(0x1ba)](a23_0x5642ef[_0x16a072(0x197)](_0x16a072(0x1bf)+_0x5bb036+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0xc01503(0xda)](_0x1cc4ef){return migrateLegacyDirectory(),super['run'](_0x1cc4ef);}}function resolveYamlFile(_0x61fac9){const _0x44aed5=a23_0xc01503;if(_0x61fac9['endsWith'](_0x44aed5(0x136))||_0x61fac9[_0x44aed5(0x1da)](_0x44aed5(0x181)))return _0x61fac9;return a23_0x2dac7b[_0x44aed5(0x1bb)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x61fac9)+_0x44aed5(0x136));}function formatProgressMessage(_0x455576){const _0x34ce4a=a23_0xc01503,_0x1b9ba0=_0x455576[_0x34ce4a(0x12f)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1b9ba0){const [,_0x21ef2c,_0x3bdd7a,_0x124667='']=_0x1b9ba0;return a23_0x5642ef[_0x34ce4a(0x108)](_0x21ef2c+':')+'\x20'+_0x3bdd7a+a23_0x5642ef[_0x34ce4a(0x108)](_0x124667);}return a23_0x5642ef['dim'](_0x455576);}function showFileNotFoundError(_0x3dd545,_0x1adde0){const _0x2919a5=a23_0xc01503;console['error'](a23_0x5642ef['red'](_0x2919a5(0x193)+_0x3dd545+'\x0a')),console[_0x2919a5(0x1ba)](a23_0x5642ef[_0x2919a5(0x111)](_0x2919a5(0x1c7)+_0x1adde0+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x4e1f6f){const _0x3114df=a23_0xc01503;console[_0x3114df(0x1ba)](a23_0x5642ef['yellow'](_0x3114df(0x1bd))),console[_0x3114df(0x1ba)](_0x4e1f6f);}export class ParentSegmentListCommand extends BaseCommand{[a23_0xc01503(0x1a0)]='segment:parent:list';[a23_0xc01503(0x17e)]=a23_0xc01503(0x1f1);async[a23_0xc01503(0x168)](_0x3f23c0){const _0x1220bc=a23_0xc01503,{options:_0x245bed,args:_0xaa7aec,tdx:_0x13aa15}=_0x3f23c0,_0x4b64ed=_0xaa7aec[0x0];_0x245bed[_0x1220bc(0x18e)]&&(console[_0x1220bc(0x1ba)](_0x1220bc(0x120)+_0x245bed[_0x1220bc(0x1d2)]),_0x4b64ed&&console['error'](_0x1220bc(0x17b)+_0x4b64ed));const _0x2701c2=await withSpinner(_0x4b64ed?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x4b64ed+_0x1220bc(0x104):_0x1220bc(0x117),()=>_0x13aa15[_0x1220bc(0x1e1)][_0x1220bc(0x1cd)](),{'verbose':_0x245bed[_0x1220bc(0x18e)]});let _0x55af0f=_0x2701c2[_0x1220bc(0x1dd)];if(_0x4b64ed){const _0x2003f4=_0x4b64ed[_0x1220bc(0x11f)](/[.+^${}()|[\]\\]/g,_0x1220bc(0x1e2))[_0x1220bc(0x11f)](/\*/g,'.*')['replace'](/\?/g,'.'),_0xbceab9=new RegExp('^'+_0x2003f4+'$','i');_0x55af0f=_0x55af0f[_0x1220bc(0x18f)](_0x3c8434=>_0xbceab9[_0x1220bc(0x19c)](_0x3c8434['attributes']['name']));}_0x55af0f[_0x1220bc(0x16d)]((_0x36b189,_0x508e14)=>_0x36b189[_0x1220bc(0x1e4)][_0x1220bc(0x1a0)][_0x1220bc(0x139)](_0x508e14['attributes'][_0x1220bc(0x1a0)])),console['error'](_0x1220bc(0x130)+_0x55af0f[_0x1220bc(0x118)]+_0x1220bc(0xfd)+(_0x55af0f[_0x1220bc(0x118)]!==0x1?'s':''));const _0x26c60a=_0xb857c8=>{const _0x651671=_0x1220bc;return getConsoleNextUrl(_0x245bed[_0x651671(0x1d2)],_0x651671(0xf1)+_0xb857c8);};if(_0x245bed['format']===_0x1220bc(0x19d)||_0x245bed[_0x1220bc(0x151)]===_0x1220bc(0xe7)){const _0x407ab1=_0x55af0f[_0x1220bc(0xd4)](_0x1f672d=>({..._0x1f672d,'url':_0x26c60a(_0x1f672d['id'])}));await handleSDKOutput(_0x407ab1,_0x245bed);}else{if(_0x55af0f[_0x1220bc(0x118)]===0x0)_0x4b64ed?console[_0x1220bc(0x190)](_0x1220bc(0xdd)+_0x4b64ed):console['log'](_0x1220bc(0xd7));else for(const _0x217207 of _0x55af0f){const _0x326c3d=_0x217207[_0x1220bc(0x1e4)][_0x1220bc(0x169)]?a23_0x5642ef[_0x1220bc(0x108)]('\x20('+formatRows(_0x217207['attributes'][_0x1220bc(0x169)])+')'):'',_0x82671f=hyperlink(_0x217207['attributes']['name'],_0x26c60a(_0x217207['id']));console[_0x1220bc(0x190)](_0x1220bc(0x185)+_0x82671f+_0x326c3d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0x1ee);[a23_0xc01503(0x17e)]=a23_0xc01503(0xf0);async['execute'](_0x48bf07){const _0xd54a6=a23_0xc01503,{options:_0xa36ced,args:_0x3d6fb3,tdx:_0x147496}=_0x48bf07;console['error'](_0xd54a6(0x1b9)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xd54a6(0x11e));const _0x1fb5ca=_0xa36ced;if(_0x3d6fb3[_0xd54a6(0x118)]===0x0)return console[_0xd54a6(0x1ba)](a23_0x5642ef[_0xd54a6(0x197)](_0xd54a6(0xed))),console[_0xd54a6(0x1ba)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x3e9174=_0x3d6fb3[0x0];if(!_0x1fb5ca['database']||!_0x1fb5ca[_0xd54a6(0x1b2)])return console[_0xd54a6(0x1ba)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0xd54a6(0x1cf)),0x1;_0x1fb5ca[_0xd54a6(0x18e)]&&(console['error']('Site:\x20'+_0x1fb5ca[_0xd54a6(0x1d2)]),console['error'](_0xd54a6(0x143)+_0x3e9174),console[_0xd54a6(0x1ba)](_0xd54a6(0x180)+_0x1fb5ca['database']),console[_0xd54a6(0x1ba)]('Table:\x20'+_0x1fb5ca[_0xd54a6(0x1b2)]));const _0x402b74=await loadJSONFromOptions(_0x1fb5ca['attributes'],_0x1fb5ca[_0xd54a6(0x173)]),_0xd0d781=await loadJSONFromOptions(_0x1fb5ca[_0xd54a6(0x19b)],_0x1fb5ca[_0xd54a6(0x1eb)]),_0x4113bd=await loadJSONFromOptions(_0x1fb5ca[_0xd54a6(0x12b)],_0x1fb5ca[_0xd54a6(0x15d)]),_0x20c458={'name':_0x3e9174,'description':_0x1fb5ca[_0xd54a6(0x17e)],'scheduleType':_0x1fb5ca[_0xd54a6(0x154)],'scheduleOption':_0x1fb5ca['scheduleOption'],'timezone':_0x1fb5ca[_0xd54a6(0xef)],'master':{'parentDatabaseName':_0x1fb5ca[_0xd54a6(0x1ab)],'parentTableName':_0x1fb5ca['table']},'attributes':_0x402b74,'behaviors':_0xd0d781,'customerGroup':_0x4113bd},_0x445b79=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x3e9174+'\x27...',()=>_0x147496['segment']['createParent'](_0x20c458),{'verbose':_0xa36ced[_0xd54a6(0x18e)]}),_0x24c170=_0x445b79['data'];return console[_0xd54a6(0x1ba)](_0xd54a6(0x1cc)+_0x24c170[_0xd54a6(0x1a0)]+_0xd54a6(0x158)+_0x24c170['id']),await handleSDKOutput([_0x24c170],_0xa36ced),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0xc01503(0x122);[a23_0xc01503(0x17e)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x290884){const _0x11ccd7=a23_0xc01503,{options:_0x3154c5,args:_0x4707a2,tdx:_0x2b55db}=_0x290884;console[_0x11ccd7(0x1ba)](_0x11ccd7(0x1d7)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x11ccd7(0x11e));const _0x238ea0=_0x3154c5;if(_0x4707a2[_0x11ccd7(0x118)]===0x0)return console['error'](a23_0x5642ef[_0x11ccd7(0x197)](_0x11ccd7(0xed))),console['error'](_0x11ccd7(0xe9)),0x1;const _0x2d6808=_0x4707a2[0x0];_0x238ea0[_0x11ccd7(0x18e)]&&(console[_0x11ccd7(0x1ba)](_0x11ccd7(0x120)+_0x238ea0[_0x11ccd7(0x1d2)]),console[_0x11ccd7(0x1ba)]('Parent\x20segment:\x20'+_0x2d6808));const _0x80798e=await withSpinner(_0x11ccd7(0x140)+_0x2d6808+_0x11ccd7(0x104),()=>_0x2b55db[_0x11ccd7(0x1e1)]['getParentFull'](_0x2d6808),{'verbose':_0x238ea0['verbose']}),_0x237eb6=_0x80798e[_0x11ccd7(0x1dd)],_0x299fd8=await loadJSONFromOptions(_0x238ea0[_0x11ccd7(0x15f)],_0x238ea0[_0x11ccd7(0x191)]),_0x528a4c=await loadJSONFromOptions(_0x238ea0[_0x11ccd7(0x13a)],_0x238ea0[_0x11ccd7(0x102)]),_0x1494ea={'name':_0x237eb6[_0x11ccd7(0x1a0)],'description':_0x238ea0[_0x11ccd7(0x17e)]!==undefined?_0x238ea0[_0x11ccd7(0x17e)]:_0x237eb6[_0x11ccd7(0x17e)],'scheduleType':_0x238ea0[_0x11ccd7(0x154)]!==undefined?_0x238ea0[_0x11ccd7(0x154)]:_0x237eb6[_0x11ccd7(0x154)],'scheduleOption':_0x238ea0[_0x11ccd7(0x1b8)]!==undefined?_0x238ea0[_0x11ccd7(0x1b8)]:_0x237eb6[_0x11ccd7(0x1b8)],'timezone':_0x238ea0[_0x11ccd7(0xef)]!==undefined?_0x238ea0[_0x11ccd7(0xef)]:_0x237eb6[_0x11ccd7(0xef)],'master':_0x237eb6[_0x11ccd7(0xf8)],'attributes':_0x299fd8?[..._0x237eb6[_0x11ccd7(0x1e4)]||[],..._0x299fd8]:_0x237eb6[_0x11ccd7(0x1e4)],'behaviors':_0x528a4c?[..._0x237eb6['behaviors']||[],..._0x528a4c]:_0x237eb6['behaviors'],'customerGroup':_0x237eb6[_0x11ccd7(0x12b)]},_0x5a034a=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x2d6808+'\x27...',()=>_0x2b55db[_0x11ccd7(0x1e1)][_0x11ccd7(0x186)](_0x2d6808,_0x1494ea),{'verbose':_0x238ea0[_0x11ccd7(0x18e)]}),_0x362841=_0x5a034a[_0x11ccd7(0x1dd)];return console[_0x11ccd7(0x1ba)](_0x11ccd7(0xe3)+_0x362841[_0x11ccd7(0x1a0)]+'\x27'),await handleSDKOutput([_0x362841],_0x238ea0),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0x103);[a23_0xc01503(0x17e)]=a23_0xc01503(0x1af);async['execute'](_0x14ee50){const _0x240150=a23_0xc01503,{options:_0x27500c,args:_0x5d4d8f,tdx:_0x11197e}=_0x14ee50,_0x1132ac=_0x27500c,_0x132489=_0x5d4d8f[0x0]||_0x27500c[_0x240150(0x189)];if(!_0x132489)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'+_0x240150(0x1aa)),0x1;if(_0x1132ac[_0x240150(0x144)]&&_0x1132ac['output'])return console[_0x240150(0x1ba)](a23_0x5642ef[_0x240150(0x197)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x240150(0x1ba)](a23_0x5642ef[_0x240150(0x108)](_0x240150(0x14e))),console[_0x240150(0x1ba)](a23_0x5642ef['dim'](_0x240150(0x183)+PARENT_SEGMENT_DIR+_0x240150(0x1ca))),console[_0x240150(0x1ba)](a23_0x5642ef[_0x240150(0x111)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x5d3a9c=_0x1132ac[_0x240150(0x115)]||a23_0x2dac7b[_0x240150(0x1bb)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x132489)+_0x240150(0x136));_0x1132ac[_0x240150(0x18e)]&&(console[_0x240150(0x1ba)]('Site:\x20'+_0x1132ac['site']),console[_0x240150(0x1ba)](_0x240150(0x114)+_0x132489),console[_0x240150(0x1ba)](_0x240150(0x1b5)+_0x5d3a9c));const _0xebd1b1=await withSpinner(_0x240150(0x146)+_0x132489+_0x240150(0x104),()=>_0x11197e[_0x240150(0x1e1)][_0x240150(0x14c)](_0x132489),{'verbose':_0x1132ac[_0x240150(0x18e)]}),_0x300cdc=_0xebd1b1[_0x240150(0x1dd)];if(existsSync(_0x5d3a9c)){const _0x586bec=readFileSync(_0x5d3a9c,_0x240150(0x1a5)),_0x469db9=generateDiff(_0x586bec,_0x300cdc);if(!hasChanges(_0x469db9))console[_0x240150(0x1ba)](a23_0x5642ef['green']('✔')+_0x240150(0x194)+a23_0x5642ef[_0x240150(0x111)](_0x5d3a9c)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x240150(0x1ba)](_0x240150(0x15e)+_0x5d3a9c+'\x27:'),console[_0x240150(0x1ba)]('─'[_0x240150(0xd6)](0x3c)),console[_0x240150(0x1ba)](formatDiffWithColors(_0x469db9)),console[_0x240150(0x1ba)]('─'[_0x240150(0xd6)](0x3c));if(!_0x1132ac[_0x240150(0x119)]){const _0x57d5c5=await confirmKey('Overwrite\x20\x27'+_0x5d3a9c+'\x27?');if(!_0x57d5c5)return console[_0x240150(0x1ba)](_0x240150(0xe4)),0x1;}writeFileSync(_0x5d3a9c,_0x300cdc,_0x240150(0x1a5)),console['error'](a23_0x5642ef[_0x240150(0x1e8)]('✔')+_0x240150(0xd3)+a23_0x5642ef[_0x240150(0x111)](_0x5d3a9c));}}else{const _0x1df8d6=a23_0x2dac7b['dirname'](_0x5d3a9c);!existsSync(_0x1df8d6)&&mkdirSync(_0x1df8d6,{'recursive':!![]}),writeFileSync(_0x5d3a9c,_0x300cdc,'utf-8'),console[_0x240150(0x1ba)](a23_0x5642ef['green']('✔')+_0x240150(0xd3)+a23_0x5642ef[_0x240150(0x111)](_0x5d3a9c));}return saveSessionContext({'parent_segment':_0x132489},_0x1132ac['session']),console[_0x240150(0x1ba)](a23_0x5642ef[_0x240150(0x1e8)]('✔')+'\x20Context\x20set:\x20'+a23_0x5642ef[_0x240150(0x108)](_0x240150(0x107))+_0x240150(0x1ef)+a23_0x5642ef['cyan'](_0x132489)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0xc01503(0x101);['description']=a23_0xc01503(0x1b1);async[a23_0xc01503(0x168)](_0x2fa100){const _0x343c6b=a23_0xc01503,{options:_0x1c9667,args:_0x9ef787,tdx:_0x23ed84}=_0x2fa100,_0x48a35c=_0x1c9667,_0x2c6d65=_0x9ef787[0x0]||_0x1c9667[_0x343c6b(0x189)];if(!_0x2c6d65)return showParentSegmentNotSetError(_0x343c6b(0x1b0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x54d900=resolveYamlFile(_0x2c6d65);if(!existsSync(_0x54d900))return showFileNotFoundError(_0x54d900,_0x2c6d65),0x1;_0x48a35c[_0x343c6b(0x18e)]&&(console[_0x343c6b(0x1ba)](_0x343c6b(0x120)+_0x48a35c['site']),console['error']('YAML\x20file:\x20'+_0x54d900));let _0x29d9f5;try{_0x29d9f5=readFileSync(_0x54d900,_0x343c6b(0x1a5));}catch(_0x1845d8){const _0x1f135e=_0x1845d8 instanceof Error?_0x1845d8[_0x343c6b(0x1b4)]:String(_0x1845d8);return console[_0x343c6b(0x1ba)](_0x343c6b(0x198)+_0x1f135e),0x1;}const _0x4dbff7=await withSpinner(_0x343c6b(0x1d0),()=>_0x23ed84['segment']['pushParentYaml'](_0x29d9f5),{'verbose':_0x48a35c[_0x343c6b(0x18e)]}),_0x41d006=_0x4dbff7[_0x343c6b(0x1dd)],{isNew:_0x1ae398,name:_0x3981c0,hasChanges:_0x42607c,diffFormatted:_0x1b2358}=_0x41d006;if(!_0x42607c)return console['error'](_0x343c6b(0x18a)+_0x3981c0+_0x343c6b(0x134)),0x0;_0x1ae398?console['error'](_0x343c6b(0x15a)+_0x3981c0+'\x27:'):console['error'](_0x343c6b(0xfc)+_0x3981c0+'\x27:');console[_0x343c6b(0x1ba)]('─'[_0x343c6b(0xd6)](0x3c)),console['error'](_0x1b2358),console['error']('─'[_0x343c6b(0xd6)](0x3c));const _0x442e88=_0x1ae398?_0x343c6b(0x127)+_0x3981c0+'\x27?':_0x343c6b(0xeb)+_0x3981c0+'\x27?';if(!_0x48a35c[_0x343c6b(0x119)]){const _0x45e660=await confirmKey(_0x442e88);if(!_0x45e660)return console[_0x343c6b(0x1ba)]('Aborted.'),0x1;}const _0x2695db=_0x1ae398?'Creating':_0x343c6b(0xe8),_0x19dfb2=await withSpinner(_0x2695db+_0x343c6b(0x175)+_0x3981c0+_0x343c6b(0x104),()=>_0x41d006[_0x343c6b(0x162)](),{'verbose':_0x48a35c['verbose']}),_0x43fbec=_0x19dfb2[_0x343c6b(0x1dd)],_0xcb69d5=getConsoleNextUrl(_0x48a35c[_0x343c6b(0x1d2)],'/app/dw/parentSegments/'+_0x43fbec['id']),_0x14d843=_0x1ae398?'Created':_0x343c6b(0x14d);return console['error']('✔\x20'+_0x14d843+_0x343c6b(0x175)+_0x43fbec[_0x343c6b(0x1a0)]+'\x27'),console[_0x343c6b(0x1ba)]('\x20\x20'+_0xcb69d5),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0x16c);[a23_0xc01503(0x17e)]=a23_0xc01503(0x166);async[a23_0xc01503(0x168)](_0x355c7f){const _0x128217=a23_0xc01503,{options:_0x3bf812,args:_0x80b8b7,tdx:_0x2df2e5}=_0x355c7f,_0x1512c7=_0x3bf812,_0x2eadd7=_0x80b8b7[0x0]||_0x3bf812[_0x128217(0x189)];if(!_0x2eadd7)return showParentSegmentNotSetError(_0x128217(0x13f)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x128217(0x196)+'\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'+_0x128217(0x1a3)),0x1;const _0x447b7b=resolveYamlFile(_0x2eadd7);if(!existsSync(_0x447b7b))return showFileNotFoundError(_0x447b7b,_0x2eadd7),0x1;_0x1512c7[_0x128217(0x18e)]&&(console[_0x128217(0x1ba)]('Site:\x20'+_0x1512c7[_0x128217(0x1d2)]),console[_0x128217(0x1ba)](_0x128217(0x1a6)+_0x447b7b));let _0x40dc21;try{_0x40dc21=readFileSync(_0x447b7b,_0x128217(0x1a5));}catch(_0x551984){const _0x29614b=_0x551984 instanceof Error?_0x551984[_0x128217(0x1b4)]:String(_0x551984);return console[_0x128217(0x1ba)](_0x128217(0x198)+_0x29614b),0x1;}const _0x4f7006=createCommandSpinner(a23_0x5642ef[_0x128217(0x108)](_0x128217(0x124)),{'verbose':_0x1512c7[_0x128217(0x18e)]});_0x4f7006['start']();const _0xed40ce={'onProgress':_0x3c0acc=>{_0x4f7006['text']=formatProgressMessage(_0x3c0acc);}};if(_0x1512c7[_0x128217(0xf8)])_0xed40ce['master']=!![];if(_0x1512c7[_0x128217(0x10d)])_0xed40ce['enriched']=!![];_0x1512c7['attribute']&&(_0xed40ce['attribute']=_0x1512c7[_0x128217(0x137)]);_0x1512c7['behavior']&&(_0xed40ce['behavior']=_0x1512c7[_0x128217(0x1b3)]);if(_0x1512c7['interval'])_0xed40ce[_0x128217(0x1c0)]=_0x1512c7[_0x128217(0x1c0)];let _0x47b15e;try{_0x47b15e=await _0x2df2e5['segment'][_0x128217(0x133)](_0x40dc21,_0xed40ce),_0x4f7006['stop']();}catch(_0x4c8a7e){_0x4f7006[_0x128217(0x152)]();throw _0x4c8a7e;}const _0x3d49ef=_0x1512c7[_0x128217(0x1c0)]||_0x128217(0x16f);return this[_0x128217(0x155)](_0x47b15e,_0xed40ce,_0x447b7b,_0x3d49ef),_0x47b15e[_0x128217(0xf6)]?0x0:0x1;}['displayValidateResults'](_0x5e7ff8,_0x421e03,_0x2ba7f5,_0x9c5b7){const _0x25151f=a23_0xc01503;console[_0x25151f(0x1ba)]('\x0a'+a23_0x5642ef['bold'](_0x25151f(0x1f3))+'\x20'+_0x5e7ff8['name']),console[_0x25151f(0x1ba)]('═'[_0x25151f(0xd6)](0x3c)),this['displayMasterInfo'](_0x5e7ff8);if(typeof _0x421e03[_0x25151f(0x137)]===_0x25151f(0x16b)){this[_0x25151f(0xe0)](_0x5e7ff8),this['displaySummary'](_0x5e7ff8),this[_0x25151f(0x1c8)](_0x2ba7f5,_0x9c5b7,_0x25151f(0x137),_0x421e03[_0x25151f(0x137)]);return;}if(_0x421e03[_0x25151f(0x137)]===!![]){this['displayAttributesStats'](_0x5e7ff8),this['displaySummary'](_0x5e7ff8),this[_0x25151f(0x1c8)](_0x2ba7f5,_0x9c5b7,'attributes');return;}if(typeof _0x421e03[_0x25151f(0x1b3)]===_0x25151f(0x16b)){this[_0x25151f(0x1a4)](_0x5e7ff8,_0x9c5b7),this['displaySummary'](_0x5e7ff8),this[_0x25151f(0x1c8)](_0x2ba7f5,_0x9c5b7,_0x25151f(0x1b3),_0x421e03[_0x25151f(0x1b3)]);return;}if(_0x421e03[_0x25151f(0x1b3)]===!![]){this[_0x25151f(0x1a4)](_0x5e7ff8,_0x9c5b7),this[_0x25151f(0x13e)](_0x5e7ff8),this['displayPreviewHints'](_0x2ba7f5,_0x9c5b7,_0x25151f(0x19b));return;}this['displayAttributesStats'](_0x5e7ff8),this[_0x25151f(0x1a4)](_0x5e7ff8,_0x9c5b7),this['displaySummary'](_0x5e7ff8),this[_0x25151f(0x1c8)](_0x2ba7f5,_0x9c5b7,_0x25151f(0xf3));}['displayPreviewHints'](_0x42d8b4,_0x2ad76b,_0x5d6b4f,_0x52ef17){const _0x1d3f7c=a23_0xc01503;console[_0x1d3f7c(0x1ba)]('\x0a'+a23_0x5642ef[_0x1d3f7c(0x108)]('To\x20view\x20sample\x20data:'));const _0x2d722f=_0x2ad76b!==_0x1d3f7c(0x16f)?_0x1d3f7c(0x15b)+_0x2ad76b:'';if(_0x5d6b4f===_0x1d3f7c(0x137)&&_0x52ef17)console[_0x1d3f7c(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x1d3f7c(0x108)](_0x1d3f7c(0xff)+_0x42d8b4+'\x20--attribute\x20\x22'+_0x52ef17+'\x22'+_0x2d722f));else{if(_0x5d6b4f===_0x1d3f7c(0x1b3)&&_0x52ef17)console[_0x1d3f7c(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x1d3f7c(0x108)](_0x1d3f7c(0xff)+_0x42d8b4+_0x1d3f7c(0x145)+_0x52ef17+'\x22'+_0x2d722f));else(_0x5d6b4f==='attributes'||_0x5d6b4f===_0x1d3f7c(0xf3))&&console[_0x1d3f7c(0x1ba)]('\x20\x20'+a23_0x5642ef['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x42d8b4+_0x1d3f7c(0x167)+_0x2d722f));}(_0x5d6b4f===_0x1d3f7c(0x19b)||_0x5d6b4f==='all')&&console[_0x1d3f7c(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x1d3f7c(0x108)](_0x1d3f7c(0xff)+_0x42d8b4+_0x1d3f7c(0x10b)+_0x2d722f)),_0x5d6b4f===_0x1d3f7c(0xf3)&&console['error']('\x20\x20'+a23_0x5642ef[_0x1d3f7c(0x108)](_0x1d3f7c(0xff)+_0x42d8b4+_0x1d3f7c(0xdc)+_0x2d722f));}[a23_0xc01503(0x1f2)](_0x8e300c){const _0xff21ff=a23_0xc01503,{master:_0x28f5dc}=_0x8e300c,_0x46e14e=_0x28f5dc['schemaValid']?a23_0x5642ef['green']('✔'):a23_0x5642ef['red']('✘');console['error']('\x0a'+a23_0x5642ef[_0xff21ff(0x108)](_0xff21ff(0x1a1))),console[_0xff21ff(0x1ba)](_0x46e14e+'\x20'+a23_0x5642ef[_0xff21ff(0x159)](_0x28f5dc[_0xff21ff(0x1ab)]+'.'+_0x28f5dc[_0xff21ff(0x1b2)])),_0x28f5dc['schemaValid']?_0x28f5dc[_0xff21ff(0x199)]!==undefined&&console[_0xff21ff(0x1ba)]('\x20\x20'+a23_0x5642ef[_0xff21ff(0x108)]('Rows:')+'\x20'+a23_0x5642ef[_0xff21ff(0x111)](formatRows(_0x28f5dc[_0xff21ff(0x199)]))):console[_0xff21ff(0x1ba)]('\x20\x20'+a23_0x5642ef[_0xff21ff(0x197)](_0xff21ff(0xf9))+'\x20'+_0x28f5dc[_0xff21ff(0x178)]);}[a23_0xc01503(0xe0)](_0x40e66c){const _0x1c419a=a23_0xc01503;if(_0x40e66c[_0x1c419a(0x1e4)][_0x1c419a(0x118)]===0x0)return;console['error']('\x0a'+a23_0x5642ef['dim']('Attributes'));for(const _0x28376f of _0x40e66c[_0x1c419a(0x1e4)]){const _0x59a8ee=_0x28376f['schemaValid']?a23_0x5642ef[_0x1c419a(0x1e8)]('✔'):a23_0x5642ef[_0x1c419a(0x197)]('✘');let _0x157c95='';if(_0x28376f[_0x1c419a(0x1e3)]&&_0x28376f[_0x1c419a(0x1b7)]!==undefined&&_0x28376f[_0x1c419a(0x184)]!==undefined){const _0x19ef63=_0x28376f['coveragePercent'][_0x1c419a(0xfa)](0x1),_0x7de718=_0x28376f[_0x1c419a(0x184)]>=0x50?a23_0x5642ef['green']:_0x28376f['coveragePercent']>=0x32?a23_0x5642ef['yellow']:a23_0x5642ef['red'];_0x157c95='\x20'+a23_0x5642ef[_0x1c419a(0x108)](_0x1c419a(0x17f))+'\x20'+_0x7de718(_0x19ef63+'%')+'\x20('+formatRows(_0x28376f[_0x1c419a(0x1b7)])+_0x1c419a(0x179);}console[_0x1c419a(0x1ba)](_0x59a8ee+'\x20'+a23_0x5642ef['bold'](_0x28376f[_0x1c419a(0x1a0)])+_0x157c95),console[_0x1c419a(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x1c419a(0x108)](_0x1c419a(0x1be))+'\x20'+a23_0x5642ef[_0x1c419a(0x159)](_0x28376f[_0x1c419a(0x1ab)]+'.'+_0x28376f[_0x1c419a(0x1b2)]));const _0x41d57d=_0x28376f[_0x1c419a(0x131)]===_0x28376f[_0x1c419a(0x188)]?a23_0x5642ef[_0x1c419a(0x108)](_0x1c419a(0x163))+'\x20'+_0x28376f['joinKey']:a23_0x5642ef[_0x1c419a(0x108)](_0x1c419a(0x16a))+'\x20'+_0x28376f['joinKey']+_0x1c419a(0x1ef)+_0x28376f['foreignKey'];console[_0x1c419a(0x1ba)]('\x20\x20'+_0x41d57d),console[_0x1c419a(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x1c419a(0x108)](_0x1c419a(0xfe))),this[_0x1c419a(0xdb)](_0x28376f[_0x1c419a(0x1dc)]),!_0x28376f[_0x1c419a(0x1e3)]&&console[_0x1c419a(0x1ba)]('\x20\x20'+a23_0x5642ef['red']('Error:')+'\x20'+_0x28376f[_0x1c419a(0x178)]);}}[a23_0xc01503(0x1a4)](_0x4e6559,_0x3174b0){const _0x52ceb5=a23_0xc01503;if(_0x4e6559['behaviors'][_0x52ceb5(0x118)]===0x0)return;console['error']('\x0a'+a23_0x5642ef['dim'](_0x52ceb5(0x1e7))+'\x20'+a23_0x5642ef[_0x52ceb5(0x108)]('('+_0x3174b0+')'));for(const _0x5cad86 of _0x4e6559[_0x52ceb5(0x19b)]){const _0x3ecaf7=_0x5cad86['schemaValid']?a23_0x5642ef['green']('✔'):a23_0x5642ef[_0x52ceb5(0x197)]('✘');let _0x92715d='';if(_0x5cad86[_0x52ceb5(0x1e3)]&&_0x5cad86[_0x52ceb5(0x1df)]!==undefined&&_0x5cad86[_0x52ceb5(0x1a2)]!==undefined){const _0x77db4=_0x5cad86[_0x52ceb5(0xec)]?.['toFixed'](0x1)||'?',_0x221b73=(_0x5cad86[_0x52ceb5(0xec)]??0x0)>=0x32?a23_0x5642ef[_0x52ceb5(0x1e8)]:(_0x5cad86[_0x52ceb5(0xec)]??0x0)>=0x14?a23_0x5642ef[_0x52ceb5(0x1d1)]:a23_0x5642ef[_0x52ceb5(0x197)];_0x92715d='\x20'+a23_0x5642ef['dim'](_0x52ceb5(0x1d3))+'\x20'+_0x221b73(formatRows(_0x5cad86[_0x52ceb5(0x1df)]))+'\x20('+_0x77db4+'%)\x20'+a23_0x5642ef[_0x52ceb5(0x108)](_0x52ceb5(0x10a))+'\x20'+a23_0x5642ef[_0x52ceb5(0x111)](formatRows(_0x5cad86[_0x52ceb5(0x1a2)]));}console[_0x52ceb5(0x1ba)](_0x3ecaf7+'\x20'+a23_0x5642ef[_0x52ceb5(0x159)](_0x5cad86[_0x52ceb5(0x1a0)])+_0x92715d),console['error']('\x20\x20'+a23_0x5642ef[_0x52ceb5(0x108)]('Source:')+'\x20'+a23_0x5642ef[_0x52ceb5(0x159)](_0x5cad86[_0x52ceb5(0x1ab)]+'.'+_0x5cad86[_0x52ceb5(0x1b2)]));const _0x116a80=_0x5cad86[_0x52ceb5(0x131)]===_0x5cad86['foreignKey']?a23_0x5642ef[_0x52ceb5(0x108)](_0x52ceb5(0x163))+'\x20'+_0x5cad86[_0x52ceb5(0x131)]:a23_0x5642ef[_0x52ceb5(0x108)]('Join:')+'\x20'+_0x5cad86[_0x52ceb5(0x131)]+_0x52ceb5(0x1ef)+_0x5cad86['foreignKey'];console[_0x52ceb5(0x1ba)]('\x20\x20'+_0x116a80),console[_0x52ceb5(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x52ceb5(0x108)]('Columns:')),this[_0x52ceb5(0xdb)](_0x5cad86[_0x52ceb5(0x1dc)]),!_0x5cad86['schemaValid']&&console[_0x52ceb5(0x1ba)]('\x20\x20'+a23_0x5642ef['red'](_0x52ceb5(0xf9))+'\x20'+_0x5cad86['schemaError']);}}[a23_0xc01503(0xdb)](_0x4d2a00){const _0x2e9ae0=a23_0xc01503;for(const _0x212c7e of _0x4d2a00){_0x212c7e['label']===_0x212c7e[_0x2e9ae0(0x14f)]||_0x212c7e[_0x2e9ae0(0x14f)]==='*'?console['error'](_0x2e9ae0(0x142)+_0x212c7e[_0x2e9ae0(0xee)]):console['error'](_0x2e9ae0(0x142)+_0x212c7e[_0x2e9ae0(0xee)]+'\x20'+a23_0x5642ef[_0x2e9ae0(0x108)]('('+_0x212c7e[_0x2e9ae0(0x14f)]+')'));}}[a23_0xc01503(0x13e)](_0x1508e4){const _0x9466b1=a23_0xc01503;console[_0x9466b1(0x1ba)]('─'[_0x9466b1(0xd6)](0x3c));if(_0x1508e4[_0x9466b1(0x1e6)][_0x9466b1(0x118)]>0x0){console[_0x9466b1(0x1ba)]('\x0a'+a23_0x5642ef['red'](_0x9466b1(0x182)));for(const _0x256279 of _0x1508e4[_0x9466b1(0x1e6)]){console['error']('\x20\x20'+a23_0x5642ef['red']('•')+'\x20'+_0x256279);}}_0x1508e4[_0x9466b1(0xf6)]&&console['error']('\x0a'+a23_0x5642ef['green']('✔')+_0x9466b1(0x121));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0xd5);[a23_0xc01503(0x17e)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x159e0e){const _0xa15a21=a23_0xc01503,{options:_0x31950e,args:_0x521448,tdx:_0x39d4b9}=_0x159e0e,_0x412a23=_0x31950e,_0x5f1c55=_0x521448[0x0]||_0x31950e[_0xa15a21(0x189)];if(!_0x5f1c55)return showParentSegmentNotSetError(_0xa15a21(0x13c)+_0xa15a21(0x148)+_0xa15a21(0x13b)+_0xa15a21(0xde)+_0xa15a21(0x13d)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0xa15a21(0x1ae)+_0xa15a21(0x1a3)),0x1;if(!_0x412a23[_0xa15a21(0xf8)]&&!_0x412a23[_0xa15a21(0x137)]&&!_0x412a23[_0xa15a21(0x1b3)]&&!_0x412a23[_0xa15a21(0x10d)])return console[_0xa15a21(0x1ba)](a23_0x5642ef[_0xa15a21(0x197)](_0xa15a21(0x11c))),console[_0xa15a21(0x1ba)](_0xa15a21(0x106)),console[_0xa15a21(0x1ba)](_0xa15a21(0x1c9)),console[_0xa15a21(0x1ba)](_0xa15a21(0x1f0)),console[_0xa15a21(0x1ba)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console['error']('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0xa15a21(0x1ba)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x5abe45=resolveYamlFile(_0x5f1c55);if(!existsSync(_0x5abe45))return showFileNotFoundError(_0x5abe45,_0x5f1c55),0x1;_0x412a23[_0xa15a21(0x18e)]&&(console[_0xa15a21(0x1ba)](_0xa15a21(0x120)+_0x412a23['site']),console[_0xa15a21(0x1ba)](_0xa15a21(0x1a6)+_0x5abe45));let _0x52e7a4;try{_0x52e7a4=readFileSync(_0x5abe45,_0xa15a21(0x1a5));}catch(_0x25e880){const _0x485acf=_0x25e880 instanceof Error?_0x25e880[_0xa15a21(0x1b4)]:String(_0x25e880);return console[_0xa15a21(0x1ba)](_0xa15a21(0x198)+_0x485acf),0x1;}let _0xf7a686;try{_0xf7a686=parseDef(_0x52e7a4);}catch(_0x8f0197){const _0x487fbe=_0x8f0197 instanceof Error?_0x8f0197[_0xa15a21(0x1b4)]:String(_0x8f0197);return console[_0xa15a21(0x1ba)](a23_0x5642ef[_0xa15a21(0x197)](_0xa15a21(0x156)+_0x487fbe)),0x1;}if(_0x412a23['attribute']===!![]||_0x412a23[_0xa15a21(0x137)]===''){const _0x183536=_0xf7a686[_0xa15a21(0x1e4)]?.[_0xa15a21(0xd4)](_0x4d1346=>_0x4d1346[_0xa15a21(0x1a0)])||[];if(_0x183536[_0xa15a21(0x118)]===0x0)console[_0xa15a21(0x1ba)](a23_0x5642ef['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a23_0x5642ef[_0xa15a21(0x197)](_0xa15a21(0x11b))),console[_0xa15a21(0x1ba)](_0xa15a21(0x14a));for(const _0x108776 of _0x183536){console[_0xa15a21(0x1ba)]('\x20\x20'+a23_0x5642ef['cyan'](_0x108776));}console[_0xa15a21(0x1ba)](_0xa15a21(0xe2)+_0x5f1c55+'\x20--attribute\x20\x22'+_0x183536[0x0]+'\x22');}return 0x1;}if(_0x412a23['behavior']===!![]||_0x412a23[_0xa15a21(0x1b3)]===''){const _0x597488=_0xf7a686[_0xa15a21(0x19b)]?.[_0xa15a21(0xd4)](_0x255082=>_0x255082['name'])||[];if(_0x597488['length']===0x0)console['error'](a23_0x5642ef[_0xa15a21(0x197)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0xa15a21(0x1ba)](a23_0x5642ef[_0xa15a21(0x197)](_0xa15a21(0x1ea))),console[_0xa15a21(0x1ba)](_0xa15a21(0x19e));for(const _0x49d607 of _0x597488){console['error']('\x20\x20'+a23_0x5642ef[_0xa15a21(0x111)](_0x49d607));}console['error'](_0xa15a21(0xe2)+_0x5f1c55+_0xa15a21(0x145)+_0x597488[0x0]+'\x22');}return 0x1;}const _0x58dd3b=createCommandSpinner(a23_0x5642ef[_0xa15a21(0x108)](_0xa15a21(0xd8)),{'verbose':_0x412a23['verbose']});_0x58dd3b['start']();const _0x33c23c={'onProgress':_0x5a61fd=>{_0x58dd3b['text']=formatProgressMessage(_0x5a61fd);}};if(_0x412a23[_0xa15a21(0xf8)])_0x33c23c['master']=!![];if(_0x412a23[_0xa15a21(0x137)]&&typeof _0x412a23[_0xa15a21(0x137)]===_0xa15a21(0x16b))_0x33c23c[_0xa15a21(0x137)]=_0x412a23['attribute'];if(_0x412a23[_0xa15a21(0x1b3)]&&typeof _0x412a23['behavior']===_0xa15a21(0x16b))_0x33c23c[_0xa15a21(0x1b3)]=_0x412a23[_0xa15a21(0x1b3)];if(_0x412a23[_0xa15a21(0x10d)])_0x33c23c['enriched']=!![];if(_0x412a23[_0xa15a21(0x1c0)])_0x33c23c['interval']=_0x412a23[_0xa15a21(0x1c0)];let _0x13a0da;try{_0x13a0da=await _0x39d4b9[_0xa15a21(0x1e1)][_0xa15a21(0x10e)](_0x52e7a4,_0x33c23c),_0x58dd3b[_0xa15a21(0x152)]();}catch(_0x5aaa16){_0x58dd3b[_0xa15a21(0x152)]();throw _0x5aaa16;}return await this[_0xa15a21(0x128)](_0x13a0da,{'master':_0x412a23[_0xa15a21(0xf8)],'attribute':typeof _0x412a23[_0xa15a21(0x137)]===_0xa15a21(0x16b)?_0x412a23[_0xa15a21(0x137)]:undefined,'behavior':typeof _0x412a23[_0xa15a21(0x1b3)]===_0xa15a21(0x16b)?_0x412a23[_0xa15a21(0x1b3)]:undefined,'enriched':_0x412a23[_0xa15a21(0x10d)]}),_0x13a0da[_0xa15a21(0xf6)]?0x0:0x1;}async[a23_0xc01503(0x128)](_0x52be21,_0xfc9c6f){const _0x19da54=a23_0xc01503;console[_0x19da54(0x1ba)]('\x0a'+a23_0x5642ef[_0x19da54(0x159)](_0x19da54(0x1ad))+'\x20'+_0x52be21[_0x19da54(0x1a0)]),console['error']('═'[_0x19da54(0xd6)](0x3c));if(_0xfc9c6f[_0x19da54(0xf8)]&&_0x52be21[_0x19da54(0x171)]){const _0x2b55cd=a23_0x5642ef['dim'](_0x19da54(0x123))+'\x20'+a23_0x5642ef[_0x19da54(0x159)](_0x52be21[_0x19da54(0xf8)]['database']+'.'+_0x52be21[_0x19da54(0xf8)][_0x19da54(0x1b2)]);await this['displaySampleData'](_0x2b55cd,_0x52be21[_0x19da54(0x171)]);}else{if(_0xfc9c6f[_0x19da54(0x137)]&&_0x52be21[_0x19da54(0x171)]){const _0x556fa5=a23_0x5642ef[_0x19da54(0x108)]('Attribute:')+'\x20'+a23_0x5642ef[_0x19da54(0x159)](_0xfc9c6f[_0x19da54(0x137)]);await this[_0x19da54(0x1d9)](_0x556fa5,_0x52be21[_0x19da54(0x171)]);}else{if(_0xfc9c6f[_0x19da54(0x1b3)]&&_0x52be21[_0x19da54(0x171)]){const _0x40d26b=a23_0x5642ef[_0x19da54(0x108)](_0x19da54(0x172))+'\x20'+a23_0x5642ef[_0x19da54(0x159)](_0xfc9c6f[_0x19da54(0x1b3)]);await this[_0x19da54(0x1d9)](_0x40d26b,_0x52be21[_0x19da54(0x171)]);}else{if(_0xfc9c6f[_0x19da54(0x10d)]&&_0x52be21[_0x19da54(0x171)]){const _0x413b40=a23_0x5642ef[_0x19da54(0x108)]('Enriched:')+'\x20'+a23_0x5642ef[_0x19da54(0x159)]('Master\x20+\x20Attributes');await this[_0x19da54(0x1d9)](_0x413b40,_0x52be21[_0x19da54(0x171)]);}else!_0x52be21['sampleData']&&console[_0x19da54(0x1ba)](_0x19da54(0x18b));}}}if(_0x52be21['errors']['length']>0x0){console['error']('─'[_0x19da54(0xd6)](0x3c)),console[_0x19da54(0x1ba)]('\x0a'+a23_0x5642ef[_0x19da54(0x197)](_0x19da54(0x182)));for(const _0x38b799 of _0x52be21[_0x19da54(0x1e6)]){console['error']('\x20\x20'+a23_0x5642ef[_0x19da54(0x197)]('•')+'\x20'+_0x38b799);}}}async['displaySampleData'](_0x5c4b6f,_0x19fb92){const _0x1b19fe=a23_0xc01503;if(_0x19fb92[_0x1b19fe(0x118)]===0x0){console[_0x1b19fe(0x1ba)]('\x0a'+_0x5c4b6f),console[_0x1b19fe(0x1ba)](_0x1b19fe(0x147));return;}console[_0x1b19fe(0x1ba)]('\x0a'+_0x5c4b6f);const _0x4f6aa4=Object['keys'](_0x19fb92[0x0])[_0x1b19fe(0xd4)](_0x46f3bb=>({'name':_0x46f3bb,'type':typeof _0x19fb92[0x0][_0x46f3bb]===_0x1b19fe(0x1c4)?'double':'varchar'})),_0x2e8f16={'queryId':_0x1b19fe(0x141),'columns':_0x4f6aa4,'data':_0x19fb92,'stats':{'state':_0x1b19fe(0x1c1),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x19fb92['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x507cd7=formatAsTable(_0x2e8f16,_0x19fb92[_0x1b19fe(0x118)],!![]);await writeOutput(_0x507cd7,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0x1ce);[a23_0xc01503(0x17e)]=a23_0xc01503(0x17a);async[a23_0xc01503(0x168)](_0xad936c){const _0x5624ba=a23_0xc01503,{options:_0x5bd774,args:_0x840733,tdx:_0x2d7c91}=_0xad936c,_0x28fc85=_0x5bd774,_0x270f66=_0x840733[0x0]||_0x5bd774[_0x5624ba(0x189)];if(!_0x270f66)return showParentSegmentNotSetError(_0x5624ba(0x125)+_0x5624ba(0x195)),0x1;const _0x211373=resolveYamlFile(_0x270f66);if(existsSync(_0x211373)){_0x28fc85[_0x5624ba(0x18e)]&&console[_0x5624ba(0x1ba)]('Found\x20YAML\x20file:\x20'+_0x211373);let _0x2c10f7;try{_0x2c10f7=readFileSync(_0x211373,_0x5624ba(0x1a5));}catch(_0x2f5741){const _0x1574f8=_0x2f5741 instanceof Error?_0x2f5741[_0x5624ba(0x1b4)]:String(_0x2f5741);return console[_0x5624ba(0x1ba)](_0x5624ba(0x198)+_0x1574f8),0x1;}const _0x27bee6=await withSpinner(_0x5624ba(0x1d0),()=>_0x2d7c91[_0x5624ba(0x1e1)][_0x5624ba(0x15c)](_0x2c10f7),{'verbose':_0x28fc85['verbose']}),_0x1341aa=_0x27bee6[_0x5624ba(0x1dd)],{isNew:_0x41c107,name:_0x3ebe42,hasChanges:_0xe47b1b,diffFormatted:_0x5a2e60}=_0x1341aa;if(_0xe47b1b){_0x41c107?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x3ebe42+'\x27:'):console[_0x5624ba(0x1ba)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x3ebe42+'\x27:');console['error']('─'[_0x5624ba(0xd6)](0x3c)),console[_0x5624ba(0x1ba)](_0x5a2e60),console[_0x5624ba(0x1ba)]('─'[_0x5624ba(0xd6)](0x3c));const _0x2d0c4a=_0x41c107?'Create\x20parent\x20segment\x20\x27'+_0x3ebe42+_0x5624ba(0x1c5):_0x5624ba(0xeb)+_0x3ebe42+_0x5624ba(0x1c5);if(!_0x28fc85[_0x5624ba(0x119)]){const _0x44bd71=await confirmKey(_0x2d0c4a);if(!_0x44bd71)return console['error'](_0x5624ba(0xe4)),0x1;}const _0x46bb25=_0x41c107?'Creating':_0x5624ba(0xe8);await withSpinner(_0x46bb25+_0x5624ba(0x175)+_0x3ebe42+_0x5624ba(0x104),()=>_0x1341aa[_0x5624ba(0x162)](),{'verbose':_0x28fc85['verbose']});const _0xc6a29c=_0x41c107?_0x5624ba(0x16e):_0x5624ba(0x14d);console[_0x5624ba(0x1ba)]('✔\x20'+_0xc6a29c+_0x5624ba(0x175)+_0x3ebe42+'\x27');}else console['error'](_0x5624ba(0x18a)+_0x3ebe42+_0x5624ba(0x1a8));}const _0x193f1d=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x270f66+'\x27...',()=>_0x2d7c91[_0x5624ba(0x1e1)]['runParent'](_0x270f66),{'verbose':_0x28fc85[_0x5624ba(0x18e)]}),_0xd797e3=_0x193f1d['data'],_0x20734e=getConsoleUrl(_0x28fc85[_0x5624ba(0x1d2)],_0x5624ba(0x11a)+_0xd797e3[_0x5624ba(0x153)]+'/sessions/'+_0xd797e3[_0x5624ba(0x110)]+_0x5624ba(0x19f)+_0xd797e3['workflowAttemptId']);return console[_0x5624ba(0x1ba)](_0x5624ba(0x126)),console[_0x5624ba(0x1ba)]('\x20\x20'+a23_0x5642ef[_0x5624ba(0x108)](_0x5624ba(0x1de))+'\x20'+_0xd797e3['audienceId']),console[_0x5624ba(0x1ba)]('\x20\x20'+a23_0x5642ef['dim'](_0x5624ba(0x1c2))+'\x20'+_0xd797e3['status']),console[_0x5624ba(0x1ba)]('\x20\x20'+a23_0x5642ef['dim'](_0x5624ba(0x12d))+'\x20'+_0xd797e3['workflowSessionId']),console['error']('\x20\x20'+a23_0x5642ef['dim']('Attempt:')+'\x20'+_0xd797e3[_0x5624ba(0xe1)]),console[_0x5624ba(0x1ba)]('\x20\x20'+_0x20734e),console[_0x5624ba(0x1ba)]('\x0a'+a23_0x5642ef[_0x5624ba(0x108)]('To\x20cancel:')+_0x5624ba(0x1d6)+_0xd797e3[_0x5624ba(0xe1)]+_0x5624ba(0x177)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a23_0xc01503(0x17e)]='List\x20available\x20fields\x20for\x20segmentation';async[a23_0xc01503(0x168)](_0x221c18){const _0x45a8c7=a23_0xc01503,{options:_0x35bed9,args:_0x2bce11,tdx:_0x4ade8c}=_0x221c18,_0x1a564f=_0x2bce11[0x0]||_0x35bed9[_0x45a8c7(0x189)];if(!_0x1a564f)return showParentSegmentNotSetError(_0x45a8c7(0x1ec)+'\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;_0x35bed9['verbose']&&(console[_0x45a8c7(0x1ba)](_0x45a8c7(0x120)+_0x35bed9[_0x45a8c7(0x1d2)]),console[_0x45a8c7(0x1ba)](_0x45a8c7(0x114)+_0x1a564f));const _0x5d1b48=await withSpinner(_0x45a8c7(0x10f)+_0x1a564f+_0x45a8c7(0x104),()=>_0x4ade8c[_0x45a8c7(0x1e1)]['listFields'](_0x1a564f),{'verbose':_0x35bed9['verbose']}),_0x3527ea=_0x5d1b48[_0x45a8c7(0x1dd)];console[_0x45a8c7(0x1ba)](_0x45a8c7(0x130)+_0x3527ea['length']+_0x45a8c7(0xe6)+(_0x3527ea[_0x45a8c7(0x118)]!==0x1?'s':''));if(_0x35bed9['json']||_0x35bed9[_0x45a8c7(0xe7)])return await handleSDKOutput(_0x3527ea,_0x35bed9),0x0;return displayFieldsHumanReadable(_0x3527ea,_0x1a564f),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0xdf);['description']=a23_0xc01503(0x116);async[a23_0xc01503(0x168)](_0xd8fc78){const _0x2f1b98=a23_0xc01503,{options:_0x45d5bd,args:_0x19a73f,tdx:_0x46bb21}=_0xd8fc78,_0xca8e04=_0x45d5bd,_0x5ec5d4=_0x19a73f[0x0]||_0x45d5bd[_0x2f1b98(0x189)];if(!_0x5ec5d4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x2f1b98(0x164)+_0x2f1b98(0x196)+_0x2f1b98(0x170)),0x1;_0x45d5bd[_0x2f1b98(0x18e)]&&(console[_0x2f1b98(0x1ba)](_0x2f1b98(0x120)+_0x45d5bd['site']),console[_0x2f1b98(0x1ba)](_0x2f1b98(0x114)+_0x5ec5d4));const _0x9a56c1=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x5ec5d4+_0x2f1b98(0x104),()=>_0x46bb21['segment'][_0x2f1b98(0x1cb)](_0x5ec5d4),{'verbose':_0x45d5bd[_0x2f1b98(0x18e)]}),_0x12a2fe=_0x9a56c1[_0x2f1b98(0x1dd)];if(_0xca8e04['web']){const _0x4a664d=getConsoleNextUrl(_0xca8e04['site'],'/app/dw/parentSegments/'+_0x12a2fe['id']);return console[_0x2f1b98(0x1ba)](a23_0x5642ef['green']('✔')+_0x2f1b98(0x1e5)+a23_0x5642ef[_0x2f1b98(0x111)](_0x4a664d)),openBrowser(_0x4a664d),0x0;}return await handleSingleObjectOutput(_0x12a2fe,_0x45d5bd),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0xfb);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a23_0xc01503(0x168)](_0x146e7e){const _0x4ae2e3=a23_0xc01503,{options:_0x1f5c8b,args:_0x11e498,tdx:_0x4ad353}=_0x146e7e,_0x145c48=_0x11e498[0x0]||_0x1f5c8b[_0x4ae2e3(0x189)];if(!_0x145c48)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x1f5c8b[_0x4ae2e3(0x18e)]&&(console[_0x4ae2e3(0x1ba)](_0x4ae2e3(0x120)+_0x1f5c8b[_0x4ae2e3(0x1d2)]),console[_0x4ae2e3(0x1ba)](_0x4ae2e3(0x114)+_0x145c48));const _0xd1cdd5=await withSpinner(_0x4ae2e3(0x10c)+_0x145c48+_0x4ae2e3(0x104),()=>_0x4ad353[_0x4ae2e3(0x1e1)][_0x4ae2e3(0x1db)](_0x145c48),{'verbose':_0x1f5c8b[_0x4ae2e3(0x18e)]}),_0x66cfe8=_0xd1cdd5[_0x4ae2e3(0x1dd)],_0xa08ce1=await withSpinner(_0x4ae2e3(0x165)+_0x145c48+_0x4ae2e3(0x104),()=>_0x4ad353[_0x4ae2e3(0x1e1)]['getParentSQL'](_0x66cfe8),{'verbose':_0x1f5c8b[_0x4ae2e3(0x18e)]}),_0x14a872=await executeSchemaQuery(_0xa08ce1[_0x4ae2e3(0x1dd)],_0x4ad353,_0x1f5c8b);return await handleQueryOutput(_0x14a872,_0x1f5c8b),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0xc01503(0x1a0)]=a23_0xc01503(0x112);[a23_0xc01503(0x17e)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x353195){const _0x125199=a23_0xc01503,{options:_0x5526eb,args:_0x20ea85,tdx:_0x812522}=_0x353195,_0x4336a2=_0x20ea85[0x0]||_0x5526eb[_0x125199(0x189)];if(!_0x4336a2)return showParentSegmentNotSetError(_0x125199(0x113)+_0x125199(0x149)),0x1;_0x5526eb[_0x125199(0x18e)]&&(console[_0x125199(0x1ba)](_0x125199(0x120)+_0x5526eb[_0x125199(0x1d2)]),console['error'](_0x125199(0x114)+_0x4336a2));const _0x3174de=await withSpinner(_0x125199(0x10c)+_0x4336a2+'\x27...',()=>_0x812522[_0x125199(0x1e1)][_0x125199(0x1db)](_0x4336a2),{'verbose':_0x5526eb[_0x125199(0x18e)]}),_0x2e276f=_0x3174de[_0x125199(0x1dd)],_0x4fdc8b=await withSpinner(_0x125199(0x165)+_0x4336a2+_0x125199(0x104),()=>_0x812522[_0x125199(0x1e1)][_0x125199(0x1d4)](_0x2e276f),{'verbose':_0x5526eb[_0x125199(0x18e)]}),_0x143359=_0x4fdc8b[_0x125199(0x1dd)];return _0x5526eb[_0x125199(0x151)]===_0x125199(0x19d)||_0x5526eb['format']===_0x125199(0xe7)?await handleSDKOutput([{'sql':_0x143359}],_0x5526eb):console[_0x125199(0x190)](_0x143359),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0xc01503(0x1a0)]='segment:parent:show';[a23_0xc01503(0x17e)]=a23_0xc01503(0x12c);async[a23_0xc01503(0x168)](_0x55d882){const _0x3e594e=a23_0xc01503,{options:_0x2a1606,args:_0x48f344,tdx:_0x439a72}=_0x55d882,_0x23e55b=_0x48f344[0x0]||_0x2a1606[_0x3e594e(0x189)];if(!_0x23e55b)return showParentSegmentNotSetError(_0x3e594e(0x17d)+_0x3e594e(0x1e9)),0x1;_0x2a1606[_0x3e594e(0x18e)]&&(console[_0x3e594e(0x1ba)]('Site:\x20'+_0x2a1606['site']),console[_0x3e594e(0x1ba)](_0x3e594e(0x114)+_0x23e55b));const _0x3f902b=await withSpinner(_0x3e594e(0x10c)+_0x23e55b+'\x27...',()=>_0x439a72[_0x3e594e(0x1e1)][_0x3e594e(0x1db)](_0x23e55b),{'verbose':_0x2a1606[_0x3e594e(0x18e)]}),_0x424366=_0x3f902b[_0x3e594e(0x1dd)],_0x4adc64=await withSpinner(_0x3e594e(0x165)+_0x23e55b+'\x27...',()=>_0x439a72[_0x3e594e(0x1e1)][_0x3e594e(0x1d4)](_0x424366),{'verbose':_0x2a1606['verbose']});let _0x3760db=_0x4adc64[_0x3e594e(0x1dd)];const _0x7f5e41=resolveLimit(_0x2a1606[_0x3e594e(0x1a9)],DEFAULT_DISPLAY_LIMIT),_0xffc700=/\bLIMIT\s+\d+/i['test'](_0x3760db);!_0xffc700&&(_0x3760db=_0x3760db['trim']()[_0x3e594e(0x11f)](/;+$/,''),_0x3760db=_0x3e594e(0xd9)+_0x3760db+_0x3e594e(0x1e0)+_0x7f5e41);_0x2a1606[_0x3e594e(0x18e)]&&console['error'](_0x3e594e(0x100)+_0x3760db);const _0x1a2657=await withProgressSpinner(_0x3e594e(0x12e),async _0x578e8d=>{const _0x351edd=_0x3e594e,_0x482192=await _0x439a72['query']['execute'](_0x3760db,{'catalog':'td','schema':_0x351edd(0xea),'onJobId':_0xe3929c=>{const _0x31ccd4=_0x351edd;_0x578e8d[_0x31ccd4(0x14b)](_0xe3929c);}});return _0x482192;},{'verbose':_0x2a1606['verbose']}),_0x261af8=_0x1a2657[_0x3e594e(0x1dd)],_0x4f9c4d=_0x261af8[_0x3e594e(0x1ac)]?_0x3e594e(0x1d5)+_0x261af8[_0x3e594e(0x1ac)]+']':'';return console[_0x3e594e(0x1ba)](_0x3e594e(0x1c3)+_0x261af8['stats'][_0x3e594e(0x132)][_0x3e594e(0x1f5)]()+_0x3e594e(0x1d8)+('in\x20'+formatElapsed(_0x261af8[_0x3e594e(0xf2)][_0x3e594e(0x1b6)])+_0x4f9c4d)),await handleQueryOutput(_0x261af8,_0x2a1606),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x47deda=a24_0xdca9;(function(_0x1b35c6,_0x4b7551){const _0xb11ab0=a24_0xdca9,_0x3c98f6=_0x1b35c6();while(!![]){try{const _0x5ea348=parseInt(_0xb11ab0(0xf5))/0x1+-parseInt(_0xb11ab0(0xe0))/0x2*(-parseInt(_0xb11ab0(0x96))/0x3)+-parseInt(_0xb11ab0(0xb3))/0x4+-parseInt(_0xb11ab0(0xf8))/0x5*(parseInt(_0xb11ab0(0xf0))/0x6)+-parseInt(_0xb11ab0(0xf2))/0x7+-parseInt(_0xb11ab0(0xde))/0x8*(-parseInt(_0xb11ab0(0xa1))/0x9)+-parseInt(_0xb11ab0(0xd8))/0xa;if(_0x5ea348===_0x4b7551)break;else _0x3c98f6['push'](_0x3c98f6['shift']());}catch(_0x177a50){_0x3c98f6['push'](_0x3c98f6['shift']());}}}(a24_0x1149,0xb3dc5));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 a24_0x1b7011 from'node:path';import{saveSessionContext,getCurrentSessionPID,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 a24_0x54d2ef from'prompts';import a24_0xb78665 from'chalk';function validateProfileName(_0x597d5a){const _0x1351e9=a24_0xdca9;if(!_0x597d5a||!_0x597d5a[_0x1351e9(0xae)]())return _0x1351e9(0xab);const _0x573a80=_0x597d5a[_0x1351e9(0xae)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1351e9(0x9a)](_0x573a80))return _0x1351e9(0x99);if(profileExists(_0x573a80))return _0x1351e9(0xc3)+_0x573a80+_0x1351e9(0xd1);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0x47deda(0xac);[a24_0x47deda(0x9b)]='Create\x20a\x20new\x20profile';async[a24_0x47deda(0x90)](_0x5c1984){const _0x9b0dfc=a24_0x47deda,{options:_0x3a275d,args:_0x4db33b}=_0x5c1984;console[_0x9b0dfc(0xcc)](a24_0xb78665[_0x9b0dfc(0xf4)](_0x9b0dfc(0xa5)));let _0x3eca4b;if(_0x4db33b[_0x9b0dfc(0xb4)]>0x0&&_0x4db33b[0x0]){const _0x111632=_0x4db33b[0x0][_0x9b0dfc(0xae)](),_0x1e1625=validateProfileName(_0x111632);if(_0x1e1625!==!![])return console[_0x9b0dfc(0xca)](a24_0xb78665[_0x9b0dfc(0xc6)](_0x1e1625)),0x1;_0x3eca4b=_0x111632;}else{const _0x161569=await a24_0x54d2ef({'type':_0x9b0dfc(0xe6),'name':_0x9b0dfc(0xe9),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x161569[_0x9b0dfc(0xe9)])return console[_0x9b0dfc(0xcc)](_0x9b0dfc(0xa2)),0x1;_0x3eca4b=_0x161569[_0x9b0dfc(0xe9)]['trim']();}const _0x4e1ce3=await a24_0x54d2ef({'type':_0x9b0dfc(0xe6),'name':_0x9b0dfc(0x9b),'message':_0x9b0dfc(0xe3)}),_0x533095=_0x4e1ce3['description']?.['trim']()||undefined,_0x11f17b=_0x3a275d[_0x9b0dfc(0xe1)]||'us01',{choices:_0x25e17d,initialIndex:_0x7ee743}=buildSiteChoices(_0x11f17b),_0x224805=await a24_0x54d2ef({'type':_0x9b0dfc(0xb6),'name':_0x9b0dfc(0xe1),'message':_0x9b0dfc(0xdc)+_0x3eca4b+'\x27:','choices':_0x25e17d,'initial':_0x7ee743});if(!_0x224805[_0x9b0dfc(0xe1)])return console[_0x9b0dfc(0xcc)](_0x9b0dfc(0xa2)),0x1;let _0x2dbeb7;if(_0x224805['site']===_0x9b0dfc(0xef)){const _0x428232=await a24_0x54d2ef({'type':_0x9b0dfc(0xe6),'name':_0x9b0dfc(0xa8),'message':_0x9b0dfc(0xb8),'initial':_0x9b0dfc(0xa7),'validate':_0x33baf6=>{const _0x55a44b=_0x9b0dfc;if(!_0x33baf6||!_0x33baf6[_0x55a44b(0xae)]())return _0x55a44b(0xa9);if(!/^[a-z0-9-]+$/[_0x55a44b(0x9a)](_0x33baf6['trim']()))return _0x55a44b(0xd6);return!![];}});if(!_0x428232[_0x9b0dfc(0xa8)])return console[_0x9b0dfc(0xcc)](_0x9b0dfc(0xa2)),0x1;_0x2dbeb7=_0x428232[_0x9b0dfc(0xa8)];}else _0x2dbeb7=_0x224805[_0x9b0dfc(0xe1)];const _0x26ff4b=resolveSite(_0x2dbeb7);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x26ff4b),console['log'](_0x9b0dfc(0x92)),console[_0x9b0dfc(0xcc)]('\x20\x20'+getConsoleUrl(_0x26ff4b,_0x9b0dfc(0xeb)));const _0x10aee8=await a24_0x54d2ef({'type':_0x9b0dfc(0xd7),'name':_0x9b0dfc(0xad),'message':_0x9b0dfc(0xfb),'validate':_0x500d92=>{const _0x592e94=_0x9b0dfc;if(!_0x500d92||!_0x500d92[_0x592e94(0xae)]())return _0x592e94(0xdd);return!![];}});if(!_0x10aee8[_0x9b0dfc(0xad)])return console[_0x9b0dfc(0xcc)]('\x0aSetup\x20cancelled'),0x1;const _0x7a59ed=_0x10aee8[_0x9b0dfc(0xad)];console[_0x9b0dfc(0xcc)](_0x9b0dfc(0xc4));try{const _0x527da1=TDX[_0x9b0dfc(0xed)]({'site':_0x26ff4b,'apiKey':_0x7a59ed[_0x9b0dfc(0xae)](),'logLevel':_0x3a275d[_0x9b0dfc(0x8f)]??LogLevel[_0x9b0dfc(0xda)]}),_0x4ced7c=await _0x527da1[_0x9b0dfc(0xbe)]['getUserInfo']();console[_0x9b0dfc(0xcc)](a24_0xb78665[_0x9b0dfc(0xd4)]('✓')+_0x9b0dfc(0xbc)+_0x4ced7c[_0x9b0dfc(0x9e)]+')');const _0x567ab0=await isKeychainAvailable();_0x567ab0?(await saveAPIKeyAsync(_0x7a59ed[_0x9b0dfc(0xae)](),_0x26ff4b,_0x3eca4b),console['log'](a24_0xb78665['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3eca4b+')')):(console['warn'](a24_0xb78665[_0x9b0dfc(0x97)](_0x9b0dfc(0xe4))),console[_0x9b0dfc(0xc2)](a24_0xb78665[_0x9b0dfc(0x97)](_0x9b0dfc(0x91))));const _0x3b8e7a={'site':_0x26ff4b,..._0x533095&&{'description':_0x533095}};return saveProfileToUserConfig(_0x3eca4b,_0x3b8e7a),console[_0x9b0dfc(0xcc)](a24_0xb78665['green']('✓')+_0x9b0dfc(0xb0)+_0x3eca4b+_0x9b0dfc(0x94)),console[_0x9b0dfc(0xcc)](),console[_0x9b0dfc(0xcc)](_0x9b0dfc(0xcf)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x3eca4b+_0x9b0dfc(0xbd)),console[_0x9b0dfc(0xcc)]('\x20\x20tdx\x20--profile\x20'+_0x3eca4b+_0x9b0dfc(0xc8)),0x0;}catch(_0x4f8c65){if(_0x4f8c65 instanceof HTTPClientError&&_0x4f8c65[_0x9b0dfc(0xb9)]===0x191)return printAuthError(_0x4f8c65),0x1;return console[_0x9b0dfc(0xca)](a24_0xb78665[_0x9b0dfc(0xc6)]('✗\x20Validation\x20failed:\x20'+(_0x4f8c65 instanceof Error?_0x4f8c65['message']:String(_0x4f8c65)))),console[_0x9b0dfc(0xca)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x47deda(0xd5)]=a24_0x47deda(0xb5);[a24_0x47deda(0x9b)]=a24_0x47deda(0xe7);[a24_0x47deda(0xb7)](_0x48b7bc){const _0xce2c8b=a24_0x47deda,{args:_0x2880c7}=_0x48b7bc;if(_0x2880c7[_0xce2c8b(0xb4)]===0x0)return _0xce2c8b(0xc5);return undefined;}async['execute'](_0x163cdf){const _0x8158c8=a24_0x47deda,{args:_0xda75cd}=_0x163cdf,_0x22386b=_0xda75cd[0x0];console['log'](a24_0xb78665[_0x8158c8(0xf4)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x22386b)){console[_0x8158c8(0xca)](a24_0xb78665[_0x8158c8(0xc6)](_0x8158c8(0xc3)+_0x22386b+_0x8158c8(0xe2))),console[_0x8158c8(0xcc)](_0x8158c8(0xf3));const _0x5a461b=listProfiles();if(_0x5a461b['length']===0x0)console[_0x8158c8(0xcc)](_0x8158c8(0xba));else for(const _0x463f21 of _0x5a461b){console[_0x8158c8(0xcc)](_0x8158c8(0xc7)+_0x463f21[_0x8158c8(0xd5)]);}return 0x1;}const _0x205844=await a24_0x54d2ef({'type':_0x8158c8(0xfa),'name':_0x8158c8(0xfa),'message':_0x8158c8(0xee)+_0x22386b+'\x27?','initial':![]});if(!_0x205844['confirm'])return console[_0x8158c8(0xcc)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x22386b),console[_0x8158c8(0xcc)](a24_0xb78665['green']('✓')+_0x8158c8(0xb0)+_0x22386b+_0x8158c8(0xe8));}catch(_0x482fdf){return console['error'](a24_0xb78665[_0x8158c8(0xc6)](_0x8158c8(0xe5)+(_0x482fdf instanceof Error?_0x482fdf['message']:String(_0x482fdf)))),0x1;}const _0xe5edc6=await isKeychainAvailable();if(_0xe5edc6){const _0x3a593c=await deleteKeychainAPIKey(_0x22386b);_0x3a593c&&console[_0x8158c8(0xcc)](a24_0xb78665[_0x8158c8(0xd4)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x47deda(0xd5)]=a24_0x47deda(0x9c);[a24_0x47deda(0x9b)]=a24_0x47deda(0xa0);static [a24_0x47deda(0xf9)]=[a24_0x47deda(0xe1),a24_0x47deda(0x9d),a24_0x47deda(0xec),a24_0x47deda(0xa4),a24_0x47deda(0xbb),a24_0x47deda(0x9b)];[a24_0x47deda(0xb7)](_0x5340c8){const _0x488daf=a24_0x47deda,{args:_0x3f99a3,options:_0x3e2b9d}=_0x5340c8,_0x4ac138=_0x3e2b9d['profile']||getActiveProfile();if(!_0x4ac138)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(_0x3f99a3[_0x488daf(0xb4)]===0x0)return _0x488daf(0xd3)+ProfileSetCommand[_0x488daf(0xf9)][_0x488daf(0xc9)](',\x20');const _0x5817a6=_0x3f99a3[0x0];if(!_0x5817a6[_0x488daf(0x8e)]('='))return _0x488daf(0xa6)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x48ac64]=_0x5817a6[_0x488daf(0xd0)]('=',0x2);if(!ProfileSetCommand[_0x488daf(0xf9)][_0x488daf(0x8e)](_0x48ac64))return'Unknown\x20key\x20\x27'+_0x48ac64+_0x488daf(0x95)+ProfileSetCommand[_0x488daf(0xf9)][_0x488daf(0xc9)](',\x20');return undefined;}async[a24_0x47deda(0x90)](_0x24084e){const _0x2ae79b=a24_0x47deda,{args:_0xd5a53f,options:_0x29c6b7}=_0x24084e,_0x450644=_0x29c6b7['profile']||getActiveProfile(),[_0x29be59,..._0x14a886]=_0xd5a53f[0x0][_0x2ae79b(0xd0)]('='),_0x121533=_0x14a886['join']('=');console['log'](a24_0xb78665['bold'](_0x2ae79b(0xaf)));if(!profileExists(_0x450644)){const _0x705196=await a24_0x54d2ef({'type':_0x2ae79b(0xfa),'name':_0x2ae79b(0xed),'message':'Profile\x20\x27'+_0x450644+_0x2ae79b(0xce),'initial':!![]});if(!_0x705196['create'])return console[_0x2ae79b(0xcc)]('Operation\x20cancelled'),0x1;}const _0x3d3620=loadProfile(_0x450644),_0x3244d1=_0x3d3620?.['config']||{};if(_0x29be59===_0x2ae79b(0xe1)){const _0x482e20=resolveSite(_0x121533);console[_0x2ae79b(0xcc)](_0x2ae79b(0xb1)+_0x482e20+_0x2ae79b(0xcd)),console[_0x2ae79b(0xcc)](_0x2ae79b(0xd2)),console[_0x2ae79b(0xcc)]('\x20\x20'+getConsoleUrl(_0x482e20,'/app/mp/ak'));const _0xd80397=await a24_0x54d2ef({'type':_0x2ae79b(0xd7),'name':'apiKey','message':_0x2ae79b(0xcb),'validate':_0x1a86f9=>{const _0x5c265f=_0x2ae79b;if(!_0x1a86f9||!_0x1a86f9[_0x5c265f(0xae)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xd80397[_0x2ae79b(0xad)])return console['log'](_0x2ae79b(0xf7)),0x1;console['log']('Validating\x20API\x20key...');try{const _0xb2da17=TDX[_0x2ae79b(0xed)]({'site':_0x482e20,'apiKey':_0xd80397['apiKey'][_0x2ae79b(0xae)](),'logLevel':_0x29c6b7[_0x2ae79b(0x8f)]??LogLevel[_0x2ae79b(0xda)]}),_0x118c35=await _0xb2da17['jobs'][_0x2ae79b(0x93)]();console['log'](a24_0xb78665[_0x2ae79b(0xd4)]('✓')+_0x2ae79b(0xbc)+_0x118c35[_0x2ae79b(0x9e)]+')');const _0x178a16=await isKeychainAvailable();_0x178a16?(await saveAPIKeyAsync(_0xd80397[_0x2ae79b(0xad)][_0x2ae79b(0xae)](),_0x482e20,_0x450644),console[_0x2ae79b(0xcc)](a24_0xb78665[_0x2ae79b(0xd4)]('✓')+_0x2ae79b(0xa3))):console['warn'](a24_0xb78665[_0x2ae79b(0x97)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3244d1[_0x2ae79b(0xe1)]=_0x482e20;}catch(_0x5a06fb){if(_0x5a06fb instanceof HTTPClientError&&_0x5a06fb[_0x2ae79b(0xb9)]===0x191)return printAuthError(_0x5a06fb),0x1;return console[_0x2ae79b(0xca)](a24_0xb78665[_0x2ae79b(0xc6)](_0x2ae79b(0xb2)+(_0x5a06fb instanceof Error?_0x5a06fb[_0x2ae79b(0xdb)]:String(_0x5a06fb)))),console['error'](_0x2ae79b(0x9f)),0x1;}}else _0x3244d1[_0x29be59]=_0x121533||undefined;return saveProfileToUserConfig(_0x450644,_0x3244d1),console['log'](a24_0xb78665['green']('✓')+_0x2ae79b(0xb0)+_0x450644+_0x2ae79b(0xf1)+_0x29be59+'='+(_0x121533||_0x2ae79b(0xf6))),0x0;}}function a24_0xdca9(_0x55dc0c,_0x3b1cea){_0x55dc0c=_0x55dc0c-0x8e;const _0x11498a=a24_0x1149();let _0xdca945=_0x11498a[_0x55dc0c];return _0xdca945;}function a24_0x1149(){const _0x1d5051=['\x20\x20-\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','join','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','log','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','split','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','green','name','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','password','944010FgChkE','\x20--default\x27\x20to\x20save\x20permanently','ERROR','message','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','API\x20key\x20cannot\x20be\x20empty','256XZVJOK','Default\x20profile\x20set\x20to:\x20','1352gYHIEM','site','\x27\x20does\x20not\x20exist.','Enter\x20description\x20(optional):','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Failed\x20to\x20remove\x20profile:\x20','text','Remove\x20a\x20profile','\x27\x20removed\x20from\x20configuration','profileName','toString','/app/mp/ak','parent_segment','create','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','other','9714XFrWoG','\x27\x20updated:\x20','2030553UIWjvM','\x0aAvailable\x20profiles:','bold','1411420mwutyC','(cleared)','\x0aOperation\x20cancelled','3490mmCUlm','VALID_KEYS','confirm','Enter\x20your\x20TD\x20API\x20key:','includes','logLevel','execute','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','You\x20can\x20find\x20your\x20API\x20key\x20at:','getUserInfo','\x27\x20created','\x27.\x0a\x0aValid\x20keys:\x20','4827wsVdPu','yellow','tdx.json','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','test','description','profile:set','database','email','Site\x20was\x20not\x20changed.','Set\x20a\x20profile\x20configuration\x20value','132336tsnNoR','\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_project','tdx:\x20profile\x20create','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us01','customSite','Site\x20name\x20cannot\x20be\x20empty','session','Profile\x20name\x20cannot\x20be\x20empty','profile:create','apiKey','trim','tdx:\x20profile\x20set','\x20Profile\x20\x27','Changing\x20site\x20to\x20\x27','✗\x20Validation\x20failed:\x20','2873524eWNZIY','length','profile:remove','select','validate','Enter\x20site\x20name:','status','\x20\x20(no\x20profiles\x20found)','llm_agent','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','jobs','(session:\x20','dim','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','warn','Profile\x20\x27','Validating\x20API\x20key...','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','red'];a24_0x1149=function(){return _0x1d5051;};return a24_0x1149();}export class ProfileUseCommand extends BaseCommand{[a24_0x47deda(0xd5)]='profile:use';[a24_0x47deda(0x9b)]='Set\x20session\x20profile';[a24_0x47deda(0xb7)](_0x34ce49){const _0x3eeb37=a24_0x47deda,{args:_0x431d49}=_0x34ce49;if(_0x431d49[_0x3eeb37(0xb4)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x47deda(0x90)](_0x27f89d){const _0x3b2e50=a24_0x47deda,{args:_0x419615,options:_0x4389f9}=_0x27f89d,_0x2b9bdf=_0x419615[0x0],_0x598013=_0x4389f9['default'];cleanExpiredSessions();if(!profileExists(_0x2b9bdf)){console[_0x3b2e50(0xca)](a24_0xb78665['red'](_0x3b2e50(0xc3)+_0x2b9bdf+_0x3b2e50(0xe2))),console[_0x3b2e50(0xcc)]('\x0aAvailable\x20profiles:');const _0x120022=listProfiles();if(_0x120022[_0x3b2e50(0xb4)]===0x0)console[_0x3b2e50(0xcc)](_0x3b2e50(0xba));else for(const _0xf1d704 of _0x120022){console[_0x3b2e50(0xcc)](_0x3b2e50(0xc7)+_0xf1d704[_0x3b2e50(0xd5)]);}return 0x1;}if(_0x598013){const _0x571e56=a24_0x1b7011[_0x3b2e50(0xc9)](getConfigDir(),_0x3b2e50(0x98));return saveActiveProfileToUserConfig(_0x2b9bdf),console[_0x3b2e50(0xcc)](_0x3b2e50(0xdf)+a24_0xb78665[_0x3b2e50(0xd4)](_0x2b9bdf)),console[_0x3b2e50(0xcc)](a24_0xb78665[_0x3b2e50(0xc0)]('\x0aSaved\x20to:\x20'+_0x571e56)),0x0;}const _0x57c209=_0x4389f9[_0x3b2e50(0xaa)]||getCurrentSessionPID()[_0x3b2e50(0xea)]();return saveSessionContext({'profile':_0x2b9bdf},_0x4389f9[_0x3b2e50(0xaa)]),console[_0x3b2e50(0xcc)]('Session\x20profile\x20set\x20to:\x20'+a24_0xb78665[_0x3b2e50(0xd4)](_0x2b9bdf)+'\x20'+a24_0xb78665[_0x3b2e50(0xc0)](_0x3b2e50(0xbf)+_0x57c209+')')),console[_0x3b2e50(0xcc)](a24_0xb78665[_0x3b2e50(0xc0)](_0x3b2e50(0xc1)+_0x2b9bdf+_0x3b2e50(0xd9))),0x0;}}
|
|
1
|
+
const a24_0x463361=a24_0x7be1;(function(_0x20e80a,_0x283080){const _0x993852=a24_0x7be1,_0xbcaa6e=_0x20e80a();while(!![]){try{const _0x38f2d5=-parseInt(_0x993852(0x193))/0x1*(-parseInt(_0x993852(0x1a6))/0x2)+-parseInt(_0x993852(0x191))/0x3+-parseInt(_0x993852(0x197))/0x4+-parseInt(_0x993852(0x1ce))/0x5+parseInt(_0x993852(0x1db))/0x6*(parseInt(_0x993852(0x187))/0x7)+-parseInt(_0x993852(0x196))/0x8+parseInt(_0x993852(0x1b1))/0x9;if(_0x38f2d5===_0x283080)break;else _0xbcaa6e['push'](_0xbcaa6e['shift']());}catch(_0x4f8eb5){_0xbcaa6e['push'](_0xbcaa6e['shift']());}}}(a24_0x1c9e,0x6a788));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 a24_0x28d7ed from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x1c9e(){const _0x3a7555=['validate','description','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','password','Enter\x20site\x20name:','Enter\x20description\x20(optional):','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','tdx:\x20profile\x20create','tdx:\x20profile\x20remove','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','5663PIyDbD','\x0aSaved\x20to:\x20','tdx:\x20profile\x20set','logLevel','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','parent_segment','(cleared)','\x20Profile\x20\x27','length','test','704997mwgwZz','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>','429116JixVyx','getUserInfo','bold','881720cvsUGj','2869168szRQcz','create','Changing\x20site\x20to\x20\x27','/app/mp/ak','session','Enter\x20your\x20TD\x20API\x20key:','\x20\x20-\x20','ERROR','Validating\x20API\x20key...','Session\x20profile\x20set\x20to:\x20','other','profile','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','yellow','2DtxXdF','\x0aSetup\x20cancelled','status','red','config','Failed\x20to\x20remove\x20profile:\x20','✗\x20Validation\x20failed:\x20','warn','customSite','profile:create','dim','9736623EQpBwk','jobs','\x27\x20does\x20not\x20exist.\x20Create\x20it?','confirm','\x27\x20does\x20not\x20exist.','email','profile:use','text','Profile\x20\x27','log','execute','apiKey','\x20\x20(no\x20profiles\x20found)','error','select','join','\x20API\x20key\x20removed\x20from\x20system\x20keychain','profileName','Enter\x20profile\x20name:','includes','llm_project','You\x20can\x20find\x20your\x20API\x20key\x20at:','site','trim','\x27\x20updated:\x20','default','API\x20key\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27.\x0a\x0aValid\x20keys:\x20','4013730XknMMb','green','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Default\x20profile\x20set\x20to:\x20','Set\x20session\x20profile','VALID_KEYS','llm_agent','name','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x0aAvailable\x20profiles:','message','5862kfRxbf','Removal\x20cancelled','split','profile:set','database','\x20\x20tdx\x20--profile\x20','Create\x20a\x20new\x20profile'];a24_0x1c9e=function(){return _0x3a7555;};return a24_0x1c9e();}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 a24_0x1f3ac9 from'prompts';import a24_0x322d0f from'chalk';function validateProfileName(_0x476930){const _0x32f6c4=a24_0x7be1;if(!_0x476930||!_0x476930[_0x32f6c4(0x1c8)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x578ac0=_0x476930['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x32f6c4(0x190)](_0x578ac0))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x578ac0))return _0x32f6c4(0x1b9)+_0x578ac0+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x463361(0x1d6)]=a24_0x463361(0x1af);[a24_0x463361(0x17e)]=a24_0x463361(0x17c);async[a24_0x463361(0x1bb)](_0x4b22a1){const _0x12c7be=a24_0x463361,{options:_0x2abf48,args:_0x5c23d9}=_0x4b22a1;console[_0x12c7be(0x1ba)](a24_0x322d0f['bold'](_0x12c7be(0x184)));let _0x1c1b3a;if(_0x5c23d9['length']>0x0&&_0x5c23d9[0x0]){const _0x26b1be=_0x5c23d9[0x0][_0x12c7be(0x1c8)](),_0x1cc4d7=validateProfileName(_0x26b1be);if(_0x1cc4d7!==!![])return console[_0x12c7be(0x1be)](a24_0x322d0f[_0x12c7be(0x1a9)](_0x1cc4d7)),0x1;_0x1c1b3a=_0x26b1be;}else{const _0x132436=await a24_0x1f3ac9({'type':'text','name':_0x12c7be(0x1c2),'message':_0x12c7be(0x1c3),'validate':validateProfileName});if(!_0x132436['profileName'])return console['log'](_0x12c7be(0x1a7)),0x1;_0x1c1b3a=_0x132436[_0x12c7be(0x1c2)][_0x12c7be(0x1c8)]();}const _0x41f377=await a24_0x1f3ac9({'type':_0x12c7be(0x1b8),'name':_0x12c7be(0x17e),'message':_0x12c7be(0x182)}),_0x2cd314=_0x41f377[_0x12c7be(0x17e)]?.[_0x12c7be(0x1c8)]()||undefined,_0x473068=_0x2abf48['site']||'us01',{choices:_0x52aaf2,initialIndex:_0x5b9560}=buildSiteChoices(_0x473068),_0x34f032=await a24_0x1f3ac9({'type':_0x12c7be(0x1bf),'name':_0x12c7be(0x1c7),'message':_0x12c7be(0x1a3)+_0x1c1b3a+'\x27:','choices':_0x52aaf2,'initial':_0x5b9560});if(!_0x34f032[_0x12c7be(0x1c7)])return console[_0x12c7be(0x1ba)](_0x12c7be(0x1a7)),0x1;let _0x22af0b;if(_0x34f032[_0x12c7be(0x1c7)]===_0x12c7be(0x1a1)){const _0x1b07ac=await a24_0x1f3ac9({'type':_0x12c7be(0x1b8),'name':'customSite','message':_0x12c7be(0x181),'initial':'us01','validate':_0x34fb1d=>{const _0x3896db=_0x12c7be;if(!_0x34fb1d||!_0x34fb1d[_0x3896db(0x1c8)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x3896db(0x190)](_0x34fb1d['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x1b07ac[_0x12c7be(0x1ae)])return console[_0x12c7be(0x1ba)](_0x12c7be(0x1a7)),0x1;_0x22af0b=_0x1b07ac[_0x12c7be(0x1ae)];}else _0x22af0b=_0x34f032['site'];const _0x63a7f9=resolveSite(_0x22af0b);console[_0x12c7be(0x1ba)](_0x12c7be(0x1d1)+_0x63a7f9),console[_0x12c7be(0x1ba)](_0x12c7be(0x1c6)),console[_0x12c7be(0x1ba)]('\x20\x20'+getConsoleUrl(_0x63a7f9,_0x12c7be(0x19a)));const _0x350e36=await a24_0x1f3ac9({'type':_0x12c7be(0x180),'name':_0x12c7be(0x1bc),'message':_0x12c7be(0x19c),'validate':_0x1b3b48=>{const _0x3bcffb=_0x12c7be;if(!_0x1b3b48||!_0x1b3b48[_0x3bcffb(0x1c8)]())return _0x3bcffb(0x1cb);return!![];}});if(!_0x350e36[_0x12c7be(0x1bc)])return console[_0x12c7be(0x1ba)](_0x12c7be(0x1a7)),0x1;const _0xab4446=_0x350e36[_0x12c7be(0x1bc)];console[_0x12c7be(0x1ba)](_0x12c7be(0x19f));try{const _0x31a79e=TDX['create']({'site':_0x63a7f9,'apiKey':_0xab4446['trim'](),'logLevel':_0x2abf48[_0x12c7be(0x18a)]??LogLevel[_0x12c7be(0x19e)]}),_0x50e1f0=await _0x31a79e[_0x12c7be(0x1b2)][_0x12c7be(0x194)]();console[_0x12c7be(0x1ba)](a24_0x322d0f[_0x12c7be(0x1cf)]('✓')+_0x12c7be(0x1a4)+_0x50e1f0[_0x12c7be(0x1b6)]+')');const _0x5b63fb=await isKeychainAvailable();_0x5b63fb?(await saveAPIKeyAsync(_0xab4446[_0x12c7be(0x1c8)](),_0x63a7f9,_0x1c1b3a),console[_0x12c7be(0x1ba)](a24_0x322d0f[_0x12c7be(0x1cf)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1c1b3a+')')):(console['warn'](a24_0x322d0f['yellow'](_0x12c7be(0x1cc))),console['warn'](a24_0x322d0f[_0x12c7be(0x1a5)](_0x12c7be(0x1d0))));const _0x52e5b7={'site':_0x63a7f9,..._0x2cd314&&{'description':_0x2cd314}};return saveProfileToUserConfig(_0x1c1b3a,_0x52e5b7),console[_0x12c7be(0x1ba)](a24_0x322d0f[_0x12c7be(0x1cf)]('✓')+_0x12c7be(0x18e)+_0x1c1b3a+'\x27\x20created'),console[_0x12c7be(0x1ba)](),console[_0x12c7be(0x1ba)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x12c7be(0x1ba)](_0x12c7be(0x17b)+_0x1c1b3a+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x12c7be(0x1ba)](_0x12c7be(0x17b)+_0x1c1b3a+_0x12c7be(0x1d8)),0x0;}catch(_0x51e314){if(_0x51e314 instanceof HTTPClientError&&_0x51e314[_0x12c7be(0x1a8)]===0x191)return printAuthError(_0x51e314),0x1;return console[_0x12c7be(0x1be)](a24_0x322d0f[_0x12c7be(0x1a9)](_0x12c7be(0x1ac)+(_0x51e314 instanceof Error?_0x51e314['message']:String(_0x51e314)))),console[_0x12c7be(0x1be)](_0x12c7be(0x183)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']='profile:remove';['description']='Remove\x20a\x20profile';[a24_0x463361(0x17d)](_0x6442b6){const _0x175288=a24_0x463361,{args:_0x2631a7}=_0x6442b6;if(_0x2631a7[_0x175288(0x18f)]===0x0)return _0x175288(0x186);return undefined;}async[a24_0x463361(0x1bb)](_0x116c1b){const _0x3a78d2=a24_0x463361,{args:_0x2a3db7}=_0x116c1b,_0x2812c9=_0x2a3db7[0x0];console[_0x3a78d2(0x1ba)](a24_0x322d0f[_0x3a78d2(0x195)](_0x3a78d2(0x185)));if(!profileExists(_0x2812c9)){console[_0x3a78d2(0x1be)](a24_0x322d0f[_0x3a78d2(0x1a9)](_0x3a78d2(0x1b9)+_0x2812c9+_0x3a78d2(0x1b5))),console['log'](_0x3a78d2(0x1d9));const _0x57b09d=listProfiles();if(_0x57b09d[_0x3a78d2(0x18f)]===0x0)console[_0x3a78d2(0x1ba)](_0x3a78d2(0x1bd));else for(const _0x4ebcf9 of _0x57b09d){console[_0x3a78d2(0x1ba)](_0x3a78d2(0x19d)+_0x4ebcf9[_0x3a78d2(0x1d6)]);}return 0x1;}const _0x52add1=await a24_0x1f3ac9({'type':_0x3a78d2(0x1b4),'name':_0x3a78d2(0x1b4),'message':_0x3a78d2(0x18b)+_0x2812c9+'\x27?','initial':![]});if(!_0x52add1[_0x3a78d2(0x1b4)])return console['log'](_0x3a78d2(0x1dc)),0x0;try{removeProfileFromUserConfig(_0x2812c9),console[_0x3a78d2(0x1ba)](a24_0x322d0f[_0x3a78d2(0x1cf)]('✓')+_0x3a78d2(0x18e)+_0x2812c9+'\x27\x20removed\x20from\x20configuration');}catch(_0x4969a0){return console['error'](a24_0x322d0f[_0x3a78d2(0x1a9)](_0x3a78d2(0x1ab)+(_0x4969a0 instanceof Error?_0x4969a0['message']:String(_0x4969a0)))),0x1;}const _0x2e1701=await isKeychainAvailable();if(_0x2e1701){const _0x36c465=await deleteKeychainAPIKey(_0x2812c9);_0x36c465&&console['log'](a24_0x322d0f[_0x3a78d2(0x1cf)]('✓')+_0x3a78d2(0x1c1));}return 0x0;}}function a24_0x7be1(_0x4a55ca,_0x483e7a){_0x4a55ca=_0x4a55ca-0x178;const _0x1c9e90=a24_0x1c9e();let _0x7be1bd=_0x1c9e90[_0x4a55ca];return _0x7be1bd;}export class ProfileSetCommand extends BaseCommand{[a24_0x463361(0x1d6)]=a24_0x463361(0x179);[a24_0x463361(0x17e)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x463361(0x1d4)]=[a24_0x463361(0x1c7),a24_0x463361(0x17a),a24_0x463361(0x18c),a24_0x463361(0x1c5),a24_0x463361(0x1d5),a24_0x463361(0x17e)];[a24_0x463361(0x17d)](_0x2a6ddd){const _0x4b7bde=a24_0x463361,{args:_0x58484e,options:_0x2164aa}=_0x2a6ddd,_0x5d657d=_0x2164aa[_0x4b7bde(0x1a2)]||getActiveProfile();if(!_0x5d657d)return _0x4b7bde(0x192);if(_0x58484e[_0x4b7bde(0x18f)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4b7bde(0x1d4)]['join'](',\x20');const _0x287df4=_0x58484e[0x0];if(!_0x287df4['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4b7bde(0x1d4)][_0x4b7bde(0x1c0)](',\x20');const [_0x4628b3]=_0x287df4['split']('=',0x2);if(!ProfileSetCommand[_0x4b7bde(0x1d4)][_0x4b7bde(0x1c4)](_0x4628b3))return'Unknown\x20key\x20\x27'+_0x4628b3+_0x4b7bde(0x1cd)+ProfileSetCommand['VALID_KEYS'][_0x4b7bde(0x1c0)](',\x20');return undefined;}async['execute'](_0x2e3fed){const _0x3a9265=a24_0x463361,{args:_0x228409,options:_0x494b06}=_0x2e3fed,_0x182185=_0x494b06['profile']||getActiveProfile(),[_0x439452,..._0x3f5437]=_0x228409[0x0][_0x3a9265(0x178)]('='),_0xe81885=_0x3f5437['join']('=');console[_0x3a9265(0x1ba)](a24_0x322d0f[_0x3a9265(0x195)](_0x3a9265(0x189)));if(!profileExists(_0x182185)){const _0x47e360=await a24_0x1f3ac9({'type':_0x3a9265(0x1b4),'name':'create','message':_0x3a9265(0x1b9)+_0x182185+_0x3a9265(0x1b3),'initial':!![]});if(!_0x47e360[_0x3a9265(0x198)])return console[_0x3a9265(0x1ba)]('Operation\x20cancelled'),0x1;}const _0x557325=loadProfile(_0x182185),_0x5f018a=_0x557325?.[_0x3a9265(0x1aa)]||{};if(_0x439452===_0x3a9265(0x1c7)){const _0x64a117=resolveSite(_0xe81885);console[_0x3a9265(0x1ba)](_0x3a9265(0x199)+_0x64a117+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3a9265(0x1ba)](_0x3a9265(0x17f)),console['log']('\x20\x20'+getConsoleUrl(_0x64a117,_0x3a9265(0x19a)));const _0x173a36=await a24_0x1f3ac9({'type':_0x3a9265(0x180),'name':_0x3a9265(0x1bc),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x156a11=>{const _0x115bf7=_0x3a9265;if(!_0x156a11||!_0x156a11[_0x115bf7(0x1c8)]())return _0x115bf7(0x1cb);return!![];}});if(!_0x173a36[_0x3a9265(0x1bc)])return console[_0x3a9265(0x1ba)]('\x0aOperation\x20cancelled'),0x1;console['log'](_0x3a9265(0x19f));try{const _0x3ce06c=TDX[_0x3a9265(0x198)]({'site':_0x64a117,'apiKey':_0x173a36[_0x3a9265(0x1bc)]['trim'](),'logLevel':_0x494b06[_0x3a9265(0x18a)]??LogLevel[_0x3a9265(0x19e)]}),_0x51dbbc=await _0x3ce06c['jobs'][_0x3a9265(0x194)]();console[_0x3a9265(0x1ba)](a24_0x322d0f[_0x3a9265(0x1cf)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x51dbbc[_0x3a9265(0x1b6)]+')');const _0x50ef30=await isKeychainAvailable();_0x50ef30?(await saveAPIKeyAsync(_0x173a36[_0x3a9265(0x1bc)][_0x3a9265(0x1c8)](),_0x64a117,_0x182185),console[_0x3a9265(0x1ba)](a24_0x322d0f[_0x3a9265(0x1cf)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x3a9265(0x1ad)](a24_0x322d0f['yellow'](_0x3a9265(0x1cc))),_0x5f018a[_0x3a9265(0x1c7)]=_0x64a117;}catch(_0x1a0f61){if(_0x1a0f61 instanceof HTTPClientError&&_0x1a0f61[_0x3a9265(0x1a8)]===0x191)return printAuthError(_0x1a0f61),0x1;return console[_0x3a9265(0x1be)](a24_0x322d0f['red'](_0x3a9265(0x1ac)+(_0x1a0f61 instanceof Error?_0x1a0f61[_0x3a9265(0x1da)]:String(_0x1a0f61)))),console[_0x3a9265(0x1be)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x5f018a[_0x439452]=_0xe81885||undefined;return saveProfileToUserConfig(_0x182185,_0x5f018a),console[_0x3a9265(0x1ba)](a24_0x322d0f[_0x3a9265(0x1cf)]('✓')+_0x3a9265(0x18e)+_0x182185+_0x3a9265(0x1c9)+_0x439452+'='+(_0xe81885||_0x3a9265(0x18d))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x463361(0x1d6)]=a24_0x463361(0x1b7);[a24_0x463361(0x17e)]=a24_0x463361(0x1d3);[a24_0x463361(0x17d)](_0x18661c){const _0x26bea5=a24_0x463361,{args:_0x543ef8}=_0x18661c;if(_0x543ef8[_0x26bea5(0x18f)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0xb842af){const _0x701a0f=a24_0x463361,{args:_0xd49d97,options:_0xbf6d86}=_0xb842af,_0x5620a4=_0xd49d97[0x0],_0x5bdf54=_0xbf6d86[_0x701a0f(0x1ca)];cleanExpiredSessions();if(!profileExists(_0x5620a4)){console['error'](a24_0x322d0f[_0x701a0f(0x1a9)]('Profile\x20\x27'+_0x5620a4+_0x701a0f(0x1b5))),console[_0x701a0f(0x1ba)](_0x701a0f(0x1d9));const _0x2bfaf4=listProfiles();if(_0x2bfaf4[_0x701a0f(0x18f)]===0x0)console[_0x701a0f(0x1ba)](_0x701a0f(0x1bd));else for(const _0x539689 of _0x2bfaf4){console[_0x701a0f(0x1ba)](_0x701a0f(0x19d)+_0x539689[_0x701a0f(0x1d6)]);}return 0x1;}if(_0x5bdf54){const _0x2d4ca9=a24_0x28d7ed[_0x701a0f(0x1c0)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x5620a4),console[_0x701a0f(0x1ba)](_0x701a0f(0x1d2)+a24_0x322d0f['green'](_0x5620a4)),console[_0x701a0f(0x1ba)](a24_0x322d0f[_0x701a0f(0x1b0)](_0x701a0f(0x188)+_0x2d4ca9)),0x0;}const _0x5ec929=_0xbf6d86[_0x701a0f(0x19b)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x5620a4},_0xbf6d86[_0x701a0f(0x19b)]),console[_0x701a0f(0x1ba)](_0x701a0f(0x1a0)+a24_0x322d0f[_0x701a0f(0x1cf)](_0x5620a4)+'\x20'+a24_0x322d0f['dim']('(session:\x20'+_0x5ec929+')')),console[_0x701a0f(0x1ba)](a24_0x322d0f[_0x701a0f(0x1b0)](_0x701a0f(0x1d7)+_0x5620a4+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x676736=a25_0x5cd1;(function(_0x17c3ce,_0x52400f){const _0x16d703=a25_0x5cd1,_0x59e150=_0x17c3ce();while(!![]){try{const _0x3ac20f=parseInt(_0x16d703(0xf5))/0x1+-parseInt(_0x16d703(0x105))/0x2+parseInt(_0x16d703(0x101))/0x3*(-parseInt(_0x16d703(0xef))/0x4)+parseInt(_0x16d703(0xf2))/0x5+-parseInt(_0x16d703(0x103))/0x6*(-parseInt(_0x16d703(0xfa))/0x7)+parseInt(_0x16d703(0xf8))/0x8*(-parseInt(_0x16d703(0xf0))/0x9)+parseInt(_0x16d703(0xf7))/0xa*(parseInt(_0x16d703(0xf1))/0xb);if(_0x3ac20f===_0x52400f)break;else _0x59e150['push'](_0x59e150['shift']());}catch(_0x495bed){_0x59e150['push'](_0x59e150['shift']());}}}(a25_0x34a0,0x29c27));function a25_0x5cd1(_0x31ad6f,_0x1ad660){_0x31ad6f=_0x31ad6f-0xee;const _0x34a0b9=a25_0x34a0();let _0x5cd102=_0x34a0b9[_0x31ad6f];return _0x5cd102;}function a25_0x34a0(){const _0x67c990=['description','38227WHUtng','message','scope','Error:\x20','profiles','error','log','933pTqfhZ','length','174EFVzVE','config','515736hOEEPV','List\x20all\x20available\x20profiles','1788VaaCdn','108JMdpFA','33WkMCjI','530120jbSxau','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','317921MzgBRY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','109460nNFrjz','31480gFzZCs'];a25_0x34a0=function(){return _0x67c990;};return a25_0x34a0();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a25_0x676736(0xf4)]=a25_0x676736(0xfe);['description']=a25_0x676736(0xee);async['execute'](_0x17729d){const _0x8e5a34=a25_0x676736,{options:_0x4b27a4}=_0x17729d;try{const _0x114fa0=listProfiles(),_0x3416d5=getActiveProfile();if(_0x114fa0[_0x8e5a34(0x102)]===0x0)return console['log'](_0x8e5a34(0xf6)),console[_0x8e5a34(0x100)](_0x8e5a34(0xf3)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x82e9f3=_0x114fa0['map'](_0x243de2=>{const _0x5bec0b=_0x8e5a34,_0x3f827c=_0x243de2[_0x5bec0b(0xf4)]===_0x3416d5,_0x5be7bd=getProfileParams(_0x243de2[_0x5bec0b(0x104)]);return{'name':_0x243de2[_0x5bec0b(0xf4)],'active':_0x3f827c,'scope':_0x243de2[_0x5bec0b(0xfc)],'description':_0x243de2[_0x5bec0b(0x104)][_0x5bec0b(0xf9)]||'','params':_0x5be7bd};});return await handleSDKOutput(_0x82e9f3,_0x4b27a4),0x0;}catch(_0x3b444e){return _0x3b444e instanceof Error&&console[_0x8e5a34(0xff)](_0x8e5a34(0xfd)+_0x3b444e[_0x8e5a34(0xfb)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a26_0x5ba670=a26_0x40b5;(function(_0x3e858f,_0x197018){const _0x2b8788=a26_0x40b5,_0x13a96f=_0x3e858f();while(!![]){try{const _0x2316e3=-parseInt(_0x2b8788(0x12e))/0x1*(parseInt(_0x2b8788(0x153))/0x2)+-parseInt(_0x2b8788(0x13e))/0x3+-parseInt(_0x2b8788(0x138))/0x4+-parseInt(_0x2b8788(0x13f))/0x5+parseInt(_0x2b8788(0x130))/0x6*(-parseInt(_0x2b8788(0x144))/0x7)+parseInt(_0x2b8788(0x146))/0x8+parseInt(_0x2b8788(0x142))/0x9;if(_0x2316e3===_0x197018)break;else _0x13a96f['push'](_0x13a96f['shift']());}catch(_0x5816db){_0x13a96f['push'](_0x13a96f['shift']());}}}(a26_0x5cbe,0xc23e8));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x40b5(_0x2c0849,_0xf2dab1){_0x2c0849=_0x2c0849-0x12a;const _0x5cbe25=a26_0x5cbe();let _0x40b584=_0x5cbe25[_0x2c0849];return _0x40b584;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a26_0x5cbe(){const _0x529cad=['setExtra','Error:\x20','catalog','verbose','elapsedTimeMillis','Run\x20Trino\x20queries\x20(streaming)','output','totalSplits','2XRIOry','query','\x20rows\x20','\x20[Job\x20ID:\x20','length','1489259deEOOi','Catalog:\x20','48wYrjwP','Site:\x20','join','validate','message','file','data','args','3715552UPwVyt','originalMessage','stats','execute','\x20splits','Statement\x20','4734342vwZUVh','89755VeCNpR','description','jobId','46535328cDjyHY','error','473648mNcTTG','completedSplits','1444448YJZOjo','Executing\x20statement\x20','processedRows','setJobId','push'];a26_0x5cbe=function(){return _0x529cad;};return a26_0x5cbe();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x5ba670(0x12a);[a26_0x5ba670(0x140)]=a26_0x5ba670(0x150);async[a26_0x5ba670(0x13b)](_0x3a8330){const _0x3d1dd0=a26_0x5ba670,{options:_0x5de977,args:_0x47a7e8,tdx:_0x4be973}=_0x3a8330,_0x3283fa=_0x47a7e8[0x0],_0x5c3668=_0x5de977[_0x3d1dd0(0x135)];let _0x23d8ce;try{if(_0x5c3668)_0x23d8ce=readSqlStatementsFromFile(_0x5c3668);else{if(_0x3283fa==='-')_0x23d8ce=await readSqlStatementsFromStdin();else{if(_0x3283fa&&isSqlFilePath(_0x3283fa))_0x23d8ce=readSqlStatementsFromFile(_0x3283fa);else{if(_0x3283fa)_0x23d8ce=splitSqlStatements(_0x3283fa);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x1d1dd2){return console[_0x3d1dd0(0x143)](_0x3d1dd0(0x14c)+_0x1d1dd2[_0x3d1dd0(0x134)]),0x1;}const _0x1790cd=_0x5de977['database']||'information_schema',_0x21546d=_0x5de977[_0x3d1dd0(0x14d)];try{const _0x3433f9=[],_0x3458fc=!!_0x5de977[_0x3d1dd0(0x151)];for(let _0x1b24e2=0x0;_0x1b24e2<_0x23d8ce[_0x3d1dd0(0x12d)];_0x1b24e2++){const _0x27c367=_0x23d8ce[_0x1b24e2],_0x2fe4ef=_0x1b24e2+0x1,_0x102573=_0x23d8ce[_0x3d1dd0(0x12d)],_0x467d1d=_0x102573>0x1;_0x5de977[_0x3d1dd0(0x14e)]&&(console['error']('\x0a'+(_0x467d1d?'Statement\x20'+_0x2fe4ef+'/'+_0x102573+':':'')),console[_0x3d1dd0(0x143)](_0x3d1dd0(0x131)+_0x5de977['site']),console[_0x3d1dd0(0x143)](_0x3d1dd0(0x12f)+(_0x21546d||'td')),console['error']('Schema:\x20'+_0x1790cd),console['error']('SQL:\x20'+_0x27c367));const _0xda91a8=_0x467d1d?_0x3d1dd0(0x147)+_0x2fe4ef+'/'+_0x102573+'...':'Executing\x20query...';try{const _0x2ff122=await withProgressSpinner(_0xda91a8,async _0x5aa695=>{const _0x20ed45=_0x3d1dd0,_0x17d727=await _0x4be973[_0x20ed45(0x12a)][_0x20ed45(0x13b)](_0x27c367,{'catalog':_0x21546d,'schema':_0x1790cd,'onJobId':_0x290c63=>{const _0xd16456=_0x20ed45;_0x5aa695[_0xd16456(0x149)](_0x290c63);},'onProgress':_0x54517d=>{const _0x1828b4=_0x20ed45;_0x5aa695['setPhase']('Executing\x20query\x20['+_0x54517d['state']+']'),_0x5aa695[_0x1828b4(0x14b)](formatRows(_0x54517d[_0x1828b4(0x148)])+_0x1828b4(0x12b)+_0x54517d[_0x1828b4(0x145)]+'/'+_0x54517d[_0x1828b4(0x152)]+_0x1828b4(0x13c));}});return _0x17d727;},{'verbose':_0x5de977[_0x3d1dd0(0x14e)]}),_0x4acbec=_0x2ff122[_0x3d1dd0(0x136)],_0x12d4cf=_0x4acbec['jobId']?_0x3d1dd0(0x12c)+_0x4acbec[_0x3d1dd0(0x141)]+']':'',_0x230204=_0x467d1d?_0x3d1dd0(0x13d)+_0x2fe4ef+'/'+_0x102573+'\x20-\x20':'';console[_0x3d1dd0(0x143)]('✔\x20'+_0x230204+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4acbec['stats']['processedRows'])+_0x3d1dd0(0x12b)+('in\x20'+formatElapsed(_0x4acbec[_0x3d1dd0(0x13a)][_0x3d1dd0(0x14f)])+_0x12d4cf));if(_0x467d1d&&_0x3458fc){const _0x8ebcf0=resolveOutputOptions(_0x5de977),_0x312b17=await formatQueryOutput(_0x4acbec,_0x8ebcf0);_0x3433f9[_0x3d1dd0(0x14a)](_0x312b17);}else await handleQueryOutput(_0x4acbec,_0x5de977);}catch(_0x26b926){const _0x4a6640=_0x467d1d?_0x3d1dd0(0x13d)+_0x2fe4ef+'/'+_0x102573+':\x0a':'',_0x22b30b=_0x26b926 instanceof SDKError?_0x26b926[_0x3d1dd0(0x139)]:_0x26b926[_0x3d1dd0(0x134)];return console[_0x3d1dd0(0x143)](''+_0x4a6640+_0x22b30b),0x1;}}if(_0x23d8ce[_0x3d1dd0(0x12d)]>0x1&&_0x3458fc&&_0x3433f9[_0x3d1dd0(0x12d)]>0x0){const _0x47a9f3=_0x3433f9[_0x3d1dd0(0x132)]('\x0a');writeFileSync(_0x5de977[_0x3d1dd0(0x151)],_0x47a9f3),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x5de977[_0x3d1dd0(0x151)]);}return 0x0;}catch(_0x5a981a){throw _0x5a981a;}}[a26_0x5ba670(0x133)](_0x5a62f1){const _0x2394c1=a26_0x5ba670,_0x1fbee2=_0x5a62f1[_0x2394c1(0x137)][0x0],_0x4125eb=_0x5a62f1['options'][_0x2394c1(0x135)];if(!_0x1fbee2&&!_0x4125eb)return'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';if(_0x1fbee2&&_0x4125eb)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|