@treasuredata/tdx 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/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.js +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/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x17f4b1=a23_0x4d86;(function(_0xc5bb8b,_0x50c6ea){const _0x3b6eb6=a23_0x4d86,_0x2cd636=_0xc5bb8b();while(!![]){try{const _0x3a1c6a=-parseInt(_0x3b6eb6(0xfa))/0x1+parseInt(_0x3b6eb6(0xc6))/0x2*(parseInt(_0x3b6eb6(0xcb))/0x3)+parseInt(_0x3b6eb6(0xa0))/0x4*(-parseInt(_0x3b6eb6(0x11b))/0x5)+parseInt(_0x3b6eb6(0x106))/0x6*(parseInt(_0x3b6eb6(0xf0))/0x7)+-parseInt(_0x3b6eb6(0xf2))/0x8+parseInt(_0x3b6eb6(0x13b))/0x9*(-parseInt(_0x3b6eb6(0xdb))/0xa)+-parseInt(_0x3b6eb6(0xce))/0xb*(-parseInt(_0x3b6eb6(0x128))/0xc);if(_0x3a1c6a===_0x50c6ea)break;else _0x2cd636['push'](_0x2cd636['shift']());}catch(_0x1d811e){_0x2cd636['push'](_0x2cd636['shift']());}}}(a23_0x2982,0x3182f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x589933 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_0x514346 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x2982(){const _0x416f2e=['platform','run','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','allValid','✔\x20No\x20changes\x20-\x20\x27','\x20--attribute\x20\x22<name>\x22','List\x20parent\x20segments','Fetching\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','jobId','parent_segment','getParentFull','/{name}.yml\x0a','List\x20available\x20fields\x20for\x20segmentation','foreignKey','json','addAttributesFile','\x20rows\x20','Create\x20parent\x20segment\x20\x27','match','Updating','customersWithEvents','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','data','verbose','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','To\x20view\x20sample\x20data:','length','table','/app/workflows/','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','join','\x20field','✔\x20Renamed\x20directory\x20to\x20','listFields','Enriched:','Behaviors','Join\x20on:','sampleData','segment','\x20--enriched','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20=\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Name:\x20','\x27\x20with\x20ID:\x20','totalEvents','joinKey','bold','Status:','Available\x20behaviors:','elapsedTimeMillis','Customers:','interval','Database:\x20','Events:','Fetching\x20sample\x20data...','/attempt/','segment:parent:show','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','processedRows','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Updating\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','`\x20to\x20download\x20the\x20configuration\x20first','SELECT\x20*\x20FROM\x20(\x0a','updateParent','Session:','schemaError','Apply\x20changes\x20to\x20\x27','Error\x20reading\x20file:\x20','all','\x20[Job\x20ID:\x20','isDirectory','sort','\x5c$&','Validating\x20configuration...','text','columns','Fetching\x20SQL\x20for\x20\x27','parentSegment','cyan','Options:\x0a','getParentSQL','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:','stats','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Behavior:','label','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','string','Show\x20parent\x20segment\x20schema\x20(column\x20types)','displayColumns','displayPreviewResults','customerGroupFile','\x0aNo\x20sample\x20data\x20available','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20No\x20changes\x20-\x20','Preview:','\x20parent\x20segment\x20\x27','session','segment:parent:sql','description','limit','-1d','Error:\x20--behavior\x20requires\x20a\x20name\x0a','coveragePercent','\x20parent\x20segment','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','unref','✔\x20Query\x20completed:\x20Processed\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Updated','segment:parent:preview','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','dim','✔\x20Found\x20','repeat','yellow','segment:parent:create','message','validateParentYaml','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','segment:parent:update','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','endsWith','column','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Available\x20attributes:','addAttributes','filter','No\x20parent\x20segments\x20found','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','FINISHED','output','5196zWFEzr','test','runParent','segment:parent:view','using\x20the\x20default\x20path:\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','segment:parent:run','apply','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','workflowId','behaviors','parent_segments','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x27...','pushParentYaml','information_schema','pullParentYaml','toFixed','scheduleType','Join:','\x20Configuration\x20is\x20valid','\x20Opening\x20','darwin','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','attribute','Aborted.','✘\x20Failed\x20to\x20rename\x20directory:\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','attributes','use','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','customerPercent','\x20rows)','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','replace','4062uYYRMN','yes','displaySummary','listParents','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','414YdYDqa','green','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','22DSAhjE','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','red','matchedCount','Validate:','Audience\x20ID:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','query','error','Listing\x20parent\x20segments\x20matching\x20\x27','execute','population','30LZMAVl','\x20--attribute\x20\x22','workflowSessionId','errors','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Columns:','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x0a⚠️\x20\x20Both\x20','in\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','behaviorsFile','\x20--behavior\x20\x22','/\x20→\x20','rowCount','addBehaviors','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','segment:parent:validate','\x27\x20is\x20up\x20to\x20date','scheduleOption','segment:parent:pull','23877ozKYAG','Analyzing\x20changes...','1600200cWwKfh','\x27\x20and\x20run\x20workflow?','Creating','\x20tdx\x20wf\x20attempt\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','displayValidateResults','format','schemaValid','137382hGqNPx','Error\x20parsing\x20YAML:\x20','\x0a✔\x20Workflow\x20started','Errors:','timezone','Attempt:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Parent\x20segment:\x20','\x20\x20\x20\x20-\x20','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','tdx\x20segment\x20parent\x20preview\x20','site','468QAOmed','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Attribute:','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','varchar','segment:parent:fields','%)\x20','database','Source:','displayBehaviorsStats','open','start','Coverage:','Fetching\x20current\x20configuration\x20for\x20\x27','map','\x20Context\x20set:\x20','SQL\x20query:\x0a','resolveParentId','/app/dw/parentSegments/','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','1545NDROPj','attributesFile','preview','audienceId','segment:parent:desc','displayPreviewHints','Site:\x20','Found\x20YAML\x20file:\x20','customerGroup','displayAttributesStats','jsonl','master','Executing\x20parent\x20segment\x20query...','3007452pWIxey','stop','.yml','Creating\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','workflowAttemptId','Error:\x20--attribute\x20requires\x20a\x20name\x0a','enriched','web','Pattern:\x20','Options\x20(one\x20required):\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Created','\x20--behavior\x20\x22<name>\x22','utf-8','\x20kill','displaySampleData','log','\x20--interval\x20','317943PRAzFN','behavior','addBehaviorsFile','YAML\x20file:\x20'];a23_0x2982=function(){return _0x416f2e;};return a23_0x2982();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x17f4b1(0xab),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x9e161e){const _0x5abcbc=a23_0x17f4b1,_0x382e39=process[_0x5abcbc(0x13f)],_0x5d71ca=_0x382e39===_0x5abcbc(0xb7)?_0x5abcbc(0x110):_0x382e39==='win32'?_0x5abcbc(0x111):'xdg-open';spawn(_0x5d71ca,[_0x9e161e],{'detached':!![],'stdio':'ignore'})[_0x5abcbc(0x84)]();}function migrateLegacyDirectory(){const _0x147c37=a23_0x17f4b1;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1f1068=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1f1068[_0x147c37(0x18a)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a23_0x514346['yellow'](_0x147c37(0xe3)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x147c37(0xd7)](a23_0x514346[_0x147c37(0x8c)](_0x147c37(0x95)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x147c37(0xd7)](a23_0x514346[_0x147c37(0x8f)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x147c37(0xe8)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x147c37(0xd7)](a23_0x514346[_0x147c37(0xcc)](_0x147c37(0x161)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4417b4){const _0x38b1d0=_0x4417b4 instanceof Error?_0x4417b4[_0x147c37(0x91)]:String(_0x4417b4);return console[_0x147c37(0xd7)](a23_0x514346['red'](_0x147c37(0xbb)+_0x38b1d0+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x457441){const _0x49eb7c=a23_0x17f4b1;return migrateLegacyDirectory(),super[_0x49eb7c(0x140)](_0x457441);}}function resolveYamlFile(_0x1d481f){const _0x2892a7=a23_0x17f4b1;if(_0x1d481f['endsWith']('.yml')||_0x1d481f[_0x2892a7(0x96)]('.yaml'))return _0x1d481f;return a23_0x589933[_0x2892a7(0x15f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1d481f)+_0x2892a7(0x12a));}function formatProgressMessage(_0x27ae6d){const _0x3b561b=a23_0x17f4b1,_0x15ddbb=_0x27ae6d[_0x3b561b(0x153)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x15ddbb){const [,_0x4ce940,_0x254690,_0x1af576='']=_0x15ddbb;return a23_0x514346[_0x3b561b(0x8c)](_0x4ce940+':')+'\x20'+_0x254690+a23_0x514346[_0x3b561b(0x8c)](_0x1af576);}return a23_0x514346[_0x3b561b(0x8c)](_0x27ae6d);}function showFileNotFoundError(_0x19845a,_0x15ccde){const _0x156a0b=a23_0x17f4b1;console[_0x156a0b(0xd7)](a23_0x514346[_0x156a0b(0xd1)]('Error:\x20File\x20not\x20found:\x20'+_0x19845a+'\x0a')),console[_0x156a0b(0xd7)](a23_0x514346[_0x156a0b(0x192)](_0x156a0b(0x86)+_0x15ccde+_0x156a0b(0x181)));}function showParentSegmentNotSetError(_0xd81bb3){const _0x25f52e=a23_0x17f4b1;console[_0x25f52e(0xd7)](a23_0x514346['yellow'](_0x25f52e(0x17e))),console[_0x25f52e(0xd7)](_0xd81bb3);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x17f4b1(0x119)]='segment:parent:list';[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x145);async[a23_0x17f4b1(0xd9)](_0x3c72d8){const _0x4280f3=a23_0x17f4b1,{options:_0x41ad59,args:_0x3e4fc2,tdx:_0x4d5101}=_0x3c72d8,_0x486359=_0x3e4fc2[0x0];_0x41ad59['verbose']&&(console[_0x4280f3(0xd7)](_0x4280f3(0x121)+_0x41ad59[_0x4280f3(0x105)]),_0x486359&&console[_0x4280f3(0xd7)](_0x4280f3(0x131)+_0x486359));const _0x1e6479=await withSpinner(_0x486359?_0x4280f3(0xd8)+_0x486359+_0x4280f3(0xae):'Listing\x20parent\x20segments...',()=>_0x4d5101['segment'][_0x4280f3(0xc9)](),{'verbose':_0x41ad59[_0x4280f3(0x158)]});let _0x573e33=_0x1e6479['data'];if(_0x486359){const _0x14e43a=_0x486359['replace'](/[.+^${}()|[\]\\]/g,_0x4280f3(0x18c))[_0x4280f3(0xc5)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x57b70b=new RegExp('^'+_0x14e43a+'$','i');_0x573e33=_0x573e33[_0x4280f3(0x9b)](_0x13a525=>_0x57b70b[_0x4280f3(0xa1)](_0x13a525[_0x4280f3(0xbd)][_0x4280f3(0x119)]));}_0x573e33[_0x4280f3(0x18b)]((_0x16377f,_0x31091c)=>_0x16377f[_0x4280f3(0xbd)][_0x4280f3(0x119)]['localeCompare'](_0x31091c[_0x4280f3(0xbd)][_0x4280f3(0x119)])),console['error'](_0x4280f3(0x8d)+_0x573e33[_0x4280f3(0x15b)]+_0x4280f3(0x82)+(_0x573e33['length']!==0x1?'s':''));const _0x582a02=_0x281532=>{const _0x44896d=_0x4280f3;return getConsoleNextUrl(_0x41ad59[_0x44896d(0x105)],_0x44896d(0x118)+_0x281532);};if(_0x41ad59[_0x4280f3(0xf8)]===_0x4280f3(0x14f)||_0x41ad59['format']===_0x4280f3(0x125)){const _0x5a6b78=_0x573e33[_0x4280f3(0x114)](_0x57fe74=>({..._0x57fe74,'url':_0x582a02(_0x57fe74['id'])}));await handleSDKOutput(_0x5a6b78,_0x41ad59);}else{if(_0x573e33[_0x4280f3(0x15b)]===0x0)_0x486359?console[_0x4280f3(0x139)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x486359):console[_0x4280f3(0x139)](_0x4280f3(0x9c));else for(const _0x504a03 of _0x573e33){const _0x3d0bee=_0x504a03[_0x4280f3(0xbd)][_0x4280f3(0xda)]?a23_0x514346['dim']('\x20('+formatRows(_0x504a03[_0x4280f3(0xbd)][_0x4280f3(0xda)])+')'):'',_0x57673d=hyperlink(_0x504a03[_0x4280f3(0xbd)][_0x4280f3(0x119)],_0x582a02(_0x504a03['id']));console[_0x4280f3(0x139)]('👥\x20'+_0x57673d+_0x3d0bee);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0x90);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0xdf);async['execute'](_0xef4a8){const _0x513895=a23_0x17f4b1,{options:_0x57a23f,args:_0x3ac101,tdx:_0x4922e0}=_0xef4a8;console[_0x513895(0xd7)](_0x513895(0x9d)+_0x513895(0xc0)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5db0cd=_0x57a23f;if(_0x3ac101[_0x513895(0x15b)]===0x0)return console[_0x513895(0xd7)](a23_0x514346[_0x513895(0xd1)](_0x513895(0xe2))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x39db7e=_0x3ac101[0x0];if(!_0x5db0cd[_0x513895(0x10d)]||!_0x5db0cd[_0x513895(0x15c)])return console[_0x513895(0xd7)](_0x513895(0x16b)),console['error'](_0x513895(0xeb)),0x1;_0x5db0cd[_0x513895(0x158)]&&(console['error'](_0x513895(0x121)+_0x5db0cd[_0x513895(0x105)]),console['error'](_0x513895(0x16d)+_0x39db7e),console[_0x513895(0xd7)](_0x513895(0x177)+_0x5db0cd[_0x513895(0x10d)]),console[_0x513895(0xd7)]('Table:\x20'+_0x5db0cd[_0x513895(0x15c)]));const _0x443450=await loadJSONFromOptions(_0x5db0cd[_0x513895(0xbd)],_0x5db0cd[_0x513895(0x11c)]),_0x25d8b6=await loadJSONFromOptions(_0x5db0cd[_0x513895(0xaa)],_0x5db0cd[_0x513895(0xe6)]),_0x43608f=await loadJSONFromOptions(_0x5db0cd['customerGroup'],_0x5db0cd[_0x513895(0x75)]),_0x275c86={'name':_0x39db7e,'description':_0x5db0cd[_0x513895(0x7d)],'scheduleType':_0x5db0cd['scheduleType'],'scheduleOption':_0x5db0cd['scheduleOption'],'timezone':_0x5db0cd[_0x513895(0xfe)],'master':{'parentDatabaseName':_0x5db0cd[_0x513895(0x10d)],'parentTableName':_0x5db0cd[_0x513895(0x15c)]},'attributes':_0x443450,'behaviors':_0x25d8b6,'customerGroup':_0x43608f},_0x9fd91b=await withSpinner(_0x513895(0x12b)+_0x39db7e+_0x513895(0xae),()=>_0x4922e0['segment']['createParent'](_0x275c86),{'verbose':_0x57a23f[_0x513895(0x158)]}),_0x267904=_0x9fd91b[_0x513895(0x157)];return console[_0x513895(0xd7)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x267904['name']+_0x513895(0x16e)+_0x267904['id']),await handleSDKOutput([_0x267904],_0x57a23f),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a23_0x17f4b1(0x94);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0xb8);async['execute'](_0x1938bb){const _0x1802c6=a23_0x17f4b1,{options:_0x3266c4,args:_0x4fe462,tdx:_0x1cf7fe}=_0x1938bb;console[_0x1802c6(0xd7)](_0x1802c6(0x93)+_0x1802c6(0xc0)+_0x1802c6(0x198));const _0x46e2ee=_0x3266c4;if(_0x4fe462[_0x1802c6(0x15b)]===0x0)return console[_0x1802c6(0xd7)](a23_0x514346[_0x1802c6(0xd1)](_0x1802c6(0xe2))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x1a07e6=_0x4fe462[0x0];_0x46e2ee['verbose']&&(console[_0x1802c6(0xd7)](_0x1802c6(0x121)+_0x46e2ee['site']),console[_0x1802c6(0xd7)](_0x1802c6(0x101)+_0x1a07e6));const _0x552839=await withSpinner(_0x1802c6(0x113)+_0x1a07e6+_0x1802c6(0xae),()=>_0x1cf7fe['segment'][_0x1802c6(0x14b)](_0x1a07e6),{'verbose':_0x46e2ee[_0x1802c6(0x158)]}),_0xd6b70d=_0x552839['data'],_0x13de6e=await loadJSONFromOptions(_0x46e2ee[_0x1802c6(0x9a)],_0x46e2ee[_0x1802c6(0x150)]),_0x38feb9=await loadJSONFromOptions(_0x46e2ee[_0x1802c6(0xea)],_0x46e2ee[_0x1802c6(0x13d)]),_0x51ee9e={'name':_0xd6b70d[_0x1802c6(0x119)],'description':_0x46e2ee[_0x1802c6(0x7d)]!==undefined?_0x46e2ee[_0x1802c6(0x7d)]:_0xd6b70d[_0x1802c6(0x7d)],'scheduleType':_0x46e2ee[_0x1802c6(0xb3)]!==undefined?_0x46e2ee[_0x1802c6(0xb3)]:_0xd6b70d[_0x1802c6(0xb3)],'scheduleOption':_0x46e2ee[_0x1802c6(0xee)]!==undefined?_0x46e2ee['scheduleOption']:_0xd6b70d[_0x1802c6(0xee)],'timezone':_0x46e2ee[_0x1802c6(0xfe)]!==undefined?_0x46e2ee[_0x1802c6(0xfe)]:_0xd6b70d['timezone'],'master':_0xd6b70d[_0x1802c6(0x126)],'attributes':_0x13de6e?[..._0xd6b70d[_0x1802c6(0xbd)]||[],..._0x13de6e]:_0xd6b70d['attributes'],'behaviors':_0x38feb9?[..._0xd6b70d[_0x1802c6(0xaa)]||[],..._0x38feb9]:_0xd6b70d['behaviors'],'customerGroup':_0xd6b70d[_0x1802c6(0x123)]},_0x2d315b=await withSpinner(_0x1802c6(0x17f)+_0x1a07e6+'\x27...',()=>_0x1cf7fe[_0x1802c6(0x167)][_0x1802c6(0x183)](_0x1a07e6,_0x51ee9e),{'verbose':_0x46e2ee[_0x1802c6(0x158)]}),_0x379ce2=_0x2d315b[_0x1802c6(0x157)];return console[_0x1802c6(0xd7)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x379ce2['name']+'\x27'),await handleSDKOutput([_0x379ce2],_0x46e2ee),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0xef);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x15e);async[a23_0x17f4b1(0xd9)](_0x649dd4){const _0x1ac9da=a23_0x17f4b1,{options:_0x19055f,args:_0x387eec,tdx:_0x4b61a2}=_0x649dd4,_0x16f8b7=_0x19055f,_0x30f2c3=_0x387eec[0x0]||_0x19055f[_0x1ac9da(0x191)];if(!_0x30f2c3)return showParentSegmentNotSetError(_0x1ac9da(0x100)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x16f8b7[_0x1ac9da(0xbe)]&&_0x16f8b7[_0x1ac9da(0x9f)])return console[_0x1ac9da(0xd7)](a23_0x514346[_0x1ac9da(0xd1)](_0x1ac9da(0x103))),console[_0x1ac9da(0xd7)](a23_0x514346[_0x1ac9da(0x8c)](_0x1ac9da(0x98))),console['error'](a23_0x514346['dim'](_0x1ac9da(0xa4)+PARENT_SEGMENT_DIR+_0x1ac9da(0x14c))),console[_0x1ac9da(0xd7)](a23_0x514346[_0x1ac9da(0x192)](_0x1ac9da(0x148))),0x1;const _0x580f39=_0x16f8b7['output']||a23_0x589933[_0x1ac9da(0x15f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x30f2c3)+_0x1ac9da(0x12a));_0x16f8b7['verbose']&&(console[_0x1ac9da(0xd7)](_0x1ac9da(0x121)+_0x16f8b7[_0x1ac9da(0x105)]),console['error'](_0x1ac9da(0x101)+_0x30f2c3),console['error']('Output\x20file:\x20'+_0x580f39));const _0xb61e54=await withSpinner(_0x1ac9da(0x146)+_0x30f2c3+'\x27...',()=>_0x4b61a2[_0x1ac9da(0x167)][_0x1ac9da(0xb1)](_0x30f2c3),{'verbose':_0x16f8b7[_0x1ac9da(0x158)]}),_0x19255f=_0xb61e54[_0x1ac9da(0x157)];if(existsSync(_0x580f39)){const _0x3a57a6=readFileSync(_0x580f39,_0x1ac9da(0x136)),_0x42e63b=generateDiff(_0x3a57a6,_0x19255f);if(!hasChanges(_0x42e63b))console[_0x1ac9da(0xd7)](a23_0x514346[_0x1ac9da(0xcc)]('✔')+_0x1ac9da(0x78)+a23_0x514346[_0x1ac9da(0x192)](_0x580f39)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x1ac9da(0xd7)]('\x0aChanges\x20to\x20\x27'+_0x580f39+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x1ac9da(0xd7)](formatDiffWithColors(_0x42e63b)),console[_0x1ac9da(0xd7)]('─'['repeat'](0x3c));if(!_0x16f8b7['yes']){const _0x1c93e8=await confirmKey('Overwrite\x20\x27'+_0x580f39+'\x27?');if(!_0x1c93e8)return console[_0x1ac9da(0xd7)]('Aborted.'),0x1;}writeFileSync(_0x580f39,_0x19255f,_0x1ac9da(0x136)),console['error'](a23_0x514346['green']('✔')+_0x1ac9da(0x87)+a23_0x514346[_0x1ac9da(0x192)](_0x580f39));}}else{const _0x2681cd=a23_0x589933['dirname'](_0x580f39);!existsSync(_0x2681cd)&&mkdirSync(_0x2681cd,{'recursive':!![]}),writeFileSync(_0x580f39,_0x19255f,_0x1ac9da(0x136)),console[_0x1ac9da(0xd7)](a23_0x514346[_0x1ac9da(0xcc)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0x514346[_0x1ac9da(0x192)](_0x580f39));}return saveSessionContext({'parent_segment':_0x30f2c3},_0x16f8b7[_0x1ac9da(0x7b)]),console[_0x1ac9da(0xd7)](a23_0x514346['green']('✔')+_0x1ac9da(0x115)+a23_0x514346[_0x1ac9da(0x8c)](_0x1ac9da(0x14a))+_0x1ac9da(0x16a)+a23_0x514346[_0x1ac9da(0x192)](_0x30f2c3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x17f4b1(0x119)]='segment:parent:push';[a23_0x17f4b1(0x7d)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a23_0x17f4b1(0xd9)](_0x53c965){const _0x5be2c4=a23_0x17f4b1,{options:_0x19cf35,args:_0x20b61d,tdx:_0x5c9606}=_0x53c965,_0x2492f3=_0x19cf35,_0x1b102f=_0x20b61d[0x0]||_0x19cf35[_0x5be2c4(0x191)];if(!_0x1b102f)return showParentSegmentNotSetError(_0x5be2c4(0x83)+_0x5be2c4(0x11a)),0x1;const _0x3bc974=resolveYamlFile(_0x1b102f);if(!existsSync(_0x3bc974))return showFileNotFoundError(_0x3bc974,_0x1b102f),0x1;_0x2492f3[_0x5be2c4(0x158)]&&(console[_0x5be2c4(0xd7)](_0x5be2c4(0x121)+_0x2492f3[_0x5be2c4(0x105)]),console[_0x5be2c4(0xd7)](_0x5be2c4(0x13e)+_0x3bc974));let _0x4db86e;try{_0x4db86e=readFileSync(_0x3bc974,_0x5be2c4(0x136));}catch(_0x3b3270){const _0x644430=_0x3b3270 instanceof Error?_0x3b3270[_0x5be2c4(0x91)]:String(_0x3b3270);return console[_0x5be2c4(0xd7)](_0x5be2c4(0x187)+_0x644430),0x1;}const _0x409b68=await withSpinner(_0x5be2c4(0xf1),()=>_0x5c9606[_0x5be2c4(0x167)]['pushParentYaml'](_0x4db86e),{'verbose':_0x2492f3[_0x5be2c4(0x158)]}),_0x2d308c=_0x409b68[_0x5be2c4(0x157)],{isNew:_0x1b8b1c,name:_0x55ea14,hasChanges:_0x5d09f4,diffFormatted:_0x949c72}=_0x2d308c;if(!_0x5d09f4)return console[_0x5be2c4(0xd7)](_0x5be2c4(0x143)+_0x55ea14+_0x5be2c4(0x180)),0x0;_0x1b8b1c?console['error'](_0x5be2c4(0xc4)+_0x55ea14+'\x27:'):console['error'](_0x5be2c4(0xc3)+_0x55ea14+'\x27:');console[_0x5be2c4(0xd7)]('─'[_0x5be2c4(0x8e)](0x3c)),console[_0x5be2c4(0xd7)](_0x949c72),console[_0x5be2c4(0xd7)]('─'[_0x5be2c4(0x8e)](0x3c));const _0x220e1a=_0x1b8b1c?'Create\x20parent\x20segment\x20\x27'+_0x55ea14+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x55ea14+'\x27?';if(!_0x2492f3[_0x5be2c4(0xc7)]){const _0x383348=await confirmKey(_0x220e1a);if(!_0x383348)return console[_0x5be2c4(0xd7)](_0x5be2c4(0xba)),0x1;}const _0x5f382d=_0x1b8b1c?_0x5be2c4(0xf4):_0x5be2c4(0x154),_0x1fb666=await withSpinner(_0x5f382d+_0x5be2c4(0x7a)+_0x55ea14+_0x5be2c4(0xae),()=>_0x2d308c[_0x5be2c4(0xa7)](),{'verbose':_0x2492f3[_0x5be2c4(0x158)]}),_0x260078=_0x1fb666[_0x5be2c4(0x157)],_0x592c18=getConsoleNextUrl(_0x2492f3[_0x5be2c4(0x105)],_0x5be2c4(0x118)+_0x260078['id']),_0x312f43=_0x1b8b1c?'Created':_0x5be2c4(0x88);return console[_0x5be2c4(0xd7)]('✔\x20'+_0x312f43+_0x5be2c4(0x7a)+_0x260078[_0x5be2c4(0x119)]+'\x27'),console[_0x5be2c4(0xd7)]('\x20\x20'+_0x592c18),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x17f4b1(0xec);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x17c);async[a23_0x17f4b1(0xd9)](_0x9b7fa){const _0x3c7f65=a23_0x17f4b1,{options:_0x59575d,args:_0x19dbe3,tdx:_0x5258fb}=_0x9b7fa,_0xaad5ac=_0x59575d,_0x59cd54=_0x19dbe3[0x0]||_0x59575d['parentSegment'];if(!_0x59cd54)return showParentSegmentNotSetError(_0x3c7f65(0xad)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x3c7f65(0x19b)+_0x3c7f65(0xcd)+_0x3c7f65(0xd5)),0x1;const _0x6e90ac=resolveYamlFile(_0x59cd54);if(!existsSync(_0x6e90ac))return showFileNotFoundError(_0x6e90ac,_0x59cd54),0x1;_0xaad5ac['verbose']&&(console[_0x3c7f65(0xd7)](_0x3c7f65(0x121)+_0xaad5ac[_0x3c7f65(0x105)]),console[_0x3c7f65(0xd7)](_0x3c7f65(0x13e)+_0x6e90ac));let _0x1b5338;try{_0x1b5338=readFileSync(_0x6e90ac,_0x3c7f65(0x136));}catch(_0x5bf576){const _0x45e62c=_0x5bf576 instanceof Error?_0x5bf576[_0x3c7f65(0x91)]:String(_0x5bf576);return console['error'](_0x3c7f65(0x187)+_0x45e62c),0x1;}const _0x35296d=createCommandSpinner(a23_0x514346[_0x3c7f65(0x8c)](_0x3c7f65(0x18d)),{'verbose':_0xaad5ac['verbose']});_0x35296d[_0x3c7f65(0x111)]();const _0x2c6ee8={'onProgress':_0x414b3d=>{const _0x54e681=_0x3c7f65;_0x35296d[_0x54e681(0x18e)]=formatProgressMessage(_0x414b3d);}};if(_0xaad5ac['master'])_0x2c6ee8[_0x3c7f65(0x126)]=!![];if(_0xaad5ac[_0x3c7f65(0x12f)])_0x2c6ee8[_0x3c7f65(0x12f)]=!![];_0xaad5ac[_0x3c7f65(0xb9)]&&(_0x2c6ee8[_0x3c7f65(0xb9)]=_0xaad5ac['attribute']);_0xaad5ac[_0x3c7f65(0x13c)]&&(_0x2c6ee8[_0x3c7f65(0x13c)]=_0xaad5ac[_0x3c7f65(0x13c)]);if(_0xaad5ac[_0x3c7f65(0x176)])_0x2c6ee8['interval']=_0xaad5ac[_0x3c7f65(0x176)];let _0x19d521;try{_0x19d521=await _0x5258fb['segment'][_0x3c7f65(0x92)](_0x1b5338,_0x2c6ee8),_0x35296d['stop']();}catch(_0x27137f){_0x35296d['stop']();throw _0x27137f;}const _0x396890=_0xaad5ac[_0x3c7f65(0x176)]||_0x3c7f65(0x7f);return this[_0x3c7f65(0xf7)](_0x19d521,_0x2c6ee8,_0x6e90ac,_0x396890),_0x19d521[_0x3c7f65(0x142)]?0x0:0x1;}['displayValidateResults'](_0x44de0e,_0x29f403,_0x3d9e82,_0x5c7ad6){const _0x55746f=a23_0x17f4b1;console[_0x55746f(0xd7)]('\x0a'+a23_0x514346[_0x55746f(0x171)](_0x55746f(0xd3))+'\x20'+_0x44de0e[_0x55746f(0x119)]),console[_0x55746f(0xd7)]('═'[_0x55746f(0x8e)](0x3c)),this['displayMasterInfo'](_0x44de0e);if(typeof _0x29f403[_0x55746f(0xb9)]==='string'){this['displayAttributesStats'](_0x44de0e),this[_0x55746f(0xc8)](_0x44de0e),this[_0x55746f(0x120)](_0x3d9e82,_0x5c7ad6,_0x55746f(0xb9),_0x29f403[_0x55746f(0xb9)]);return;}if(_0x29f403['attribute']===!![]){this[_0x55746f(0x124)](_0x44de0e),this[_0x55746f(0xc8)](_0x44de0e),this[_0x55746f(0x120)](_0x3d9e82,_0x5c7ad6,_0x55746f(0xbd));return;}if(typeof _0x29f403[_0x55746f(0x13c)]===_0x55746f(0x19c)){this[_0x55746f(0x10f)](_0x44de0e,_0x5c7ad6),this[_0x55746f(0xc8)](_0x44de0e),this[_0x55746f(0x120)](_0x3d9e82,_0x5c7ad6,_0x55746f(0x13c),_0x29f403[_0x55746f(0x13c)]);return;}if(_0x29f403[_0x55746f(0x13c)]===!![]){this['displayBehaviorsStats'](_0x44de0e,_0x5c7ad6),this[_0x55746f(0xc8)](_0x44de0e),this['displayPreviewHints'](_0x3d9e82,_0x5c7ad6,_0x55746f(0xaa));return;}this[_0x55746f(0x124)](_0x44de0e),this[_0x55746f(0x10f)](_0x44de0e,_0x5c7ad6),this[_0x55746f(0xc8)](_0x44de0e),this[_0x55746f(0x120)](_0x3d9e82,_0x5c7ad6,_0x55746f(0x188));}[a23_0x17f4b1(0x120)](_0x1bfeea,_0xb0a99,_0x352b40,_0x3effb7){const _0x308ae9=a23_0x17f4b1;console[_0x308ae9(0xd7)]('\x0a'+a23_0x514346[_0x308ae9(0x8c)](_0x308ae9(0x15a)));const _0x33f102=_0xb0a99!=='-1d'?_0x308ae9(0x13a)+_0xb0a99:'';if(_0x352b40===_0x308ae9(0xb9)&&_0x3effb7)console['error']('\x20\x20'+a23_0x514346[_0x308ae9(0x8c)](_0x308ae9(0x104)+_0x1bfeea+_0x308ae9(0xdc)+_0x3effb7+'\x22'+_0x33f102));else{if(_0x352b40===_0x308ae9(0x13c)&&_0x3effb7)console['error']('\x20\x20'+a23_0x514346['dim'](_0x308ae9(0x104)+_0x1bfeea+'\x20--behavior\x20\x22'+_0x3effb7+'\x22'+_0x33f102));else(_0x352b40===_0x308ae9(0xbd)||_0x352b40===_0x308ae9(0x188))&&console[_0x308ae9(0xd7)]('\x20\x20'+a23_0x514346[_0x308ae9(0x8c)](_0x308ae9(0x104)+_0x1bfeea+_0x308ae9(0x144)+_0x33f102));}(_0x352b40===_0x308ae9(0xaa)||_0x352b40===_0x308ae9(0x188))&&console[_0x308ae9(0xd7)]('\x20\x20'+a23_0x514346['dim'](_0x308ae9(0x104)+_0x1bfeea+_0x308ae9(0x135)+_0x33f102)),_0x352b40===_0x308ae9(0x188)&&console['error']('\x20\x20'+a23_0x514346['dim'](_0x308ae9(0x104)+_0x1bfeea+_0x308ae9(0x168)+_0x33f102));}['displayMasterInfo'](_0x555b30){const _0x4e00bf=a23_0x17f4b1,{master:_0x1c8c0e}=_0x555b30,_0x5cbdaa=_0x1c8c0e[_0x4e00bf(0xf9)]?a23_0x514346[_0x4e00bf(0xcc)]('✔'):a23_0x514346[_0x4e00bf(0xd1)]('✘');console[_0x4e00bf(0xd7)]('\x0a'+a23_0x514346[_0x4e00bf(0x8c)]('Master\x20Table')),console[_0x4e00bf(0xd7)](_0x5cbdaa+'\x20'+a23_0x514346[_0x4e00bf(0x171)](_0x1c8c0e[_0x4e00bf(0x10d)]+'.'+_0x1c8c0e[_0x4e00bf(0x15c)])),_0x1c8c0e[_0x4e00bf(0xf9)]?_0x1c8c0e[_0x4e00bf(0xe9)]!==undefined&&console[_0x4e00bf(0xd7)]('\x20\x20'+a23_0x514346[_0x4e00bf(0x8c)]('Rows:')+'\x20'+a23_0x514346[_0x4e00bf(0x192)](formatRows(_0x1c8c0e[_0x4e00bf(0xe9)]))):console[_0x4e00bf(0xd7)]('\x20\x20'+a23_0x514346[_0x4e00bf(0xd1)](_0x4e00bf(0x196))+'\x20'+_0x1c8c0e[_0x4e00bf(0x185)]);}[a23_0x17f4b1(0x124)](_0x3ed738){const _0x59d28d=a23_0x17f4b1;if(_0x3ed738[_0x59d28d(0xbd)][_0x59d28d(0x15b)]===0x0)return;console[_0x59d28d(0xd7)]('\x0a'+a23_0x514346[_0x59d28d(0x8c)]('Attributes'));for(const _0x175195 of _0x3ed738[_0x59d28d(0xbd)]){const _0x2876e4=_0x175195[_0x59d28d(0xf9)]?a23_0x514346[_0x59d28d(0xcc)]('✔'):a23_0x514346['red']('✘');let _0x5dfb2f='';if(_0x175195['schemaValid']&&_0x175195[_0x59d28d(0xd2)]!==undefined&&_0x175195[_0x59d28d(0x81)]!==undefined){const _0x29cb4c=_0x175195[_0x59d28d(0x81)][_0x59d28d(0xb2)](0x1),_0x5ea697=_0x175195[_0x59d28d(0x81)]>=0x50?a23_0x514346[_0x59d28d(0xcc)]:_0x175195[_0x59d28d(0x81)]>=0x32?a23_0x514346[_0x59d28d(0x8f)]:a23_0x514346[_0x59d28d(0xd1)];_0x5dfb2f='\x20'+a23_0x514346[_0x59d28d(0x8c)](_0x59d28d(0x112))+'\x20'+_0x5ea697(_0x29cb4c+'%')+'\x20('+formatRows(_0x175195['matchedCount'])+_0x59d28d(0xc2);}console[_0x59d28d(0xd7)](_0x2876e4+'\x20'+a23_0x514346[_0x59d28d(0x171)](_0x175195[_0x59d28d(0x119)])+_0x5dfb2f),console['error']('\x20\x20'+a23_0x514346['dim'](_0x59d28d(0x10e))+'\x20'+a23_0x514346[_0x59d28d(0x171)](_0x175195[_0x59d28d(0x10d)]+'.'+_0x175195[_0x59d28d(0x15c)]));const _0x30215a=_0x175195[_0x59d28d(0x170)]===_0x175195[_0x59d28d(0x14e)]?a23_0x514346['dim'](_0x59d28d(0x165))+'\x20'+_0x175195[_0x59d28d(0x170)]:a23_0x514346['dim']('Join:')+'\x20'+_0x175195[_0x59d28d(0x170)]+_0x59d28d(0x16a)+_0x175195[_0x59d28d(0x14e)];console[_0x59d28d(0xd7)]('\x20\x20'+_0x30215a),console['error']('\x20\x20'+a23_0x514346[_0x59d28d(0x8c)](_0x59d28d(0xe1))),this[_0x59d28d(0x19e)](_0x175195[_0x59d28d(0x18f)]),!_0x175195[_0x59d28d(0xf9)]&&console[_0x59d28d(0xd7)]('\x20\x20'+a23_0x514346['red'](_0x59d28d(0x196))+'\x20'+_0x175195['schemaError']);}}['displayBehaviorsStats'](_0x54ddf7,_0x38643e){const _0x2fed06=a23_0x17f4b1;if(_0x54ddf7[_0x2fed06(0xaa)][_0x2fed06(0x15b)]===0x0)return;console['error']('\x0a'+a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0x164))+'\x20'+a23_0x514346[_0x2fed06(0x8c)]('('+_0x38643e+')'));for(const _0x39f57f of _0x54ddf7[_0x2fed06(0xaa)]){const _0x3bca7d=_0x39f57f['schemaValid']?a23_0x514346[_0x2fed06(0xcc)]('✔'):a23_0x514346[_0x2fed06(0xd1)]('✘');let _0x1e2ada='';if(_0x39f57f[_0x2fed06(0xf9)]&&_0x39f57f[_0x2fed06(0x155)]!==undefined&&_0x39f57f[_0x2fed06(0x16f)]!==undefined){const _0x1ed96c=_0x39f57f['customerPercent']?.[_0x2fed06(0xb2)](0x1)||'?',_0x1f1ef3=(_0x39f57f['customerPercent']??0x0)>=0x32?a23_0x514346[_0x2fed06(0xcc)]:(_0x39f57f[_0x2fed06(0xc1)]??0x0)>=0x14?a23_0x514346['yellow']:a23_0x514346[_0x2fed06(0xd1)];_0x1e2ada='\x20'+a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0x175))+'\x20'+_0x1f1ef3(formatRows(_0x39f57f[_0x2fed06(0x155)]))+'\x20('+_0x1ed96c+_0x2fed06(0x10c)+a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0x178))+'\x20'+a23_0x514346['cyan'](formatRows(_0x39f57f['totalEvents']));}console[_0x2fed06(0xd7)](_0x3bca7d+'\x20'+a23_0x514346[_0x2fed06(0x171)](_0x39f57f[_0x2fed06(0x119)])+_0x1e2ada),console[_0x2fed06(0xd7)]('\x20\x20'+a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0x10e))+'\x20'+a23_0x514346[_0x2fed06(0x171)](_0x39f57f[_0x2fed06(0x10d)]+'.'+_0x39f57f[_0x2fed06(0x15c)]));const _0x223a23=_0x39f57f['joinKey']===_0x39f57f[_0x2fed06(0x14e)]?a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0x165))+'\x20'+_0x39f57f['joinKey']:a23_0x514346[_0x2fed06(0x8c)](_0x2fed06(0xb4))+'\x20'+_0x39f57f['joinKey']+_0x2fed06(0x16a)+_0x39f57f[_0x2fed06(0x14e)];console['error']('\x20\x20'+_0x223a23),console['error']('\x20\x20'+a23_0x514346['dim'](_0x2fed06(0xe1))),this[_0x2fed06(0x19e)](_0x39f57f[_0x2fed06(0x18f)]),!_0x39f57f[_0x2fed06(0xf9)]&&console[_0x2fed06(0xd7)]('\x20\x20'+a23_0x514346[_0x2fed06(0xd1)]('Error:')+'\x20'+_0x39f57f[_0x2fed06(0x185)]);}}[a23_0x17f4b1(0x19e)](_0x58f974){const _0x527207=a23_0x17f4b1;for(const _0x204451 of _0x58f974){_0x204451[_0x527207(0x19a)]===_0x204451['column']||_0x204451[_0x527207(0x97)]==='*'?console[_0x527207(0xd7)](_0x527207(0x102)+_0x204451['label']):console[_0x527207(0xd7)]('\x20\x20\x20\x20-\x20'+_0x204451[_0x527207(0x19a)]+'\x20'+a23_0x514346[_0x527207(0x8c)]('('+_0x204451[_0x527207(0x97)]+')'));}}['displaySummary'](_0x545cde){const _0x5500b5=a23_0x17f4b1;console[_0x5500b5(0xd7)]('─'[_0x5500b5(0x8e)](0x3c));if(_0x545cde[_0x5500b5(0xde)][_0x5500b5(0x15b)]>0x0){console[_0x5500b5(0xd7)]('\x0a'+a23_0x514346[_0x5500b5(0xd1)](_0x5500b5(0xfd)));for(const _0x583140 of _0x545cde[_0x5500b5(0xde)]){console[_0x5500b5(0xd7)]('\x20\x20'+a23_0x514346[_0x5500b5(0xd1)]('•')+'\x20'+_0x583140);}}_0x545cde['allValid']&&console['error']('\x0a'+a23_0x514346[_0x5500b5(0xcc)]('✔')+_0x5500b5(0xb5));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0x89);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0xbc);async[a23_0x17f4b1(0xd9)](_0xefeb6a){const _0x3a839f=a23_0x17f4b1,{options:_0x13a6e9,args:_0x243797,tdx:_0x214539}=_0xefeb6a,_0x3c8d7d=_0x13a6e9,_0x2c46cf=_0x243797[0x0]||_0x13a6e9[_0x3a839f(0x191)];if(!_0x2c46cf)return showParentSegmentNotSetError(_0x3a839f(0xe5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x3a839f(0x132)+_0x3a839f(0x109)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x3a839f(0xa8)+_0x3a839f(0x8b)+_0x3a839f(0xd5)),0x1;if(!_0x3c8d7d['master']&&!_0x3c8d7d[_0x3a839f(0xb9)]&&!_0x3c8d7d[_0x3a839f(0x13c)]&&!_0x3c8d7d[_0x3a839f(0x12f)])return console[_0x3a839f(0xd7)](a23_0x514346[_0x3a839f(0xd1)](_0x3a839f(0x133))),console['error'](_0x3a839f(0xcf)),console[_0x3a839f(0xd7)]('Options:'),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x3a839f(0xd7)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console['error'](_0x3a839f(0xd0)),console[_0x3a839f(0xd7)](_0x3a839f(0x169)),0x1;const _0x439399=resolveYamlFile(_0x2c46cf);if(!existsSync(_0x439399))return showFileNotFoundError(_0x439399,_0x2c46cf),0x1;_0x3c8d7d['verbose']&&(console[_0x3a839f(0xd7)]('Site:\x20'+_0x3c8d7d[_0x3a839f(0x105)]),console['error'](_0x3a839f(0x13e)+_0x439399));let _0x251a87;try{_0x251a87=readFileSync(_0x439399,'utf-8');}catch(_0x526d91){const _0x15dfed=_0x526d91 instanceof Error?_0x526d91[_0x3a839f(0x91)]:String(_0x526d91);return console[_0x3a839f(0xd7)](_0x3a839f(0x187)+_0x15dfed),0x1;}let _0x346485;try{_0x346485=parseDef(_0x251a87);}catch(_0x1794db){const _0x1ff2bc=_0x1794db instanceof Error?_0x1794db[_0x3a839f(0x91)]:String(_0x1794db);return console[_0x3a839f(0xd7)](a23_0x514346[_0x3a839f(0xd1)](_0x3a839f(0xfb)+_0x1ff2bc)),0x1;}if(_0x3c8d7d[_0x3a839f(0xb9)]===!![]||_0x3c8d7d[_0x3a839f(0xb9)]===''){const _0x56d94b=_0x346485[_0x3a839f(0xbd)]?.[_0x3a839f(0x114)](_0x2e9433=>_0x2e9433['name'])||[];if(_0x56d94b[_0x3a839f(0x15b)]===0x0)console[_0x3a839f(0xd7)](a23_0x514346[_0x3a839f(0xd1)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x3a839f(0xd7)](a23_0x514346[_0x3a839f(0xd1)](_0x3a839f(0x12e))),console[_0x3a839f(0xd7)](_0x3a839f(0x99));for(const _0x783a8f of _0x56d94b){console[_0x3a839f(0xd7)]('\x20\x20'+a23_0x514346[_0x3a839f(0x192)](_0x783a8f));}console[_0x3a839f(0xd7)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2c46cf+_0x3a839f(0xdc)+_0x56d94b[0x0]+'\x22');}return 0x1;}if(_0x3c8d7d['behavior']===!![]||_0x3c8d7d[_0x3a839f(0x13c)]===''){const _0x34c4d5=_0x346485[_0x3a839f(0xaa)]?.[_0x3a839f(0x114)](_0x5415f8=>_0x5415f8[_0x3a839f(0x119)])||[];if(_0x34c4d5[_0x3a839f(0x15b)]===0x0)console['error'](a23_0x514346['red'](_0x3a839f(0x8a)));else{console[_0x3a839f(0xd7)](a23_0x514346[_0x3a839f(0xd1)](_0x3a839f(0x80))),console[_0x3a839f(0xd7)](_0x3a839f(0x173));for(const _0x22bd90 of _0x34c4d5){console[_0x3a839f(0xd7)]('\x20\x20'+a23_0x514346['cyan'](_0x22bd90));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2c46cf+_0x3a839f(0xe7)+_0x34c4d5[0x0]+'\x22');}return 0x1;}const _0x1b4ea4=createCommandSpinner(a23_0x514346[_0x3a839f(0x8c)](_0x3a839f(0x179)),{'verbose':_0x3c8d7d[_0x3a839f(0x158)]});_0x1b4ea4[_0x3a839f(0x111)]();const _0xb0d749={'onProgress':_0x251d96=>{_0x1b4ea4['text']=formatProgressMessage(_0x251d96);}};if(_0x3c8d7d[_0x3a839f(0x126)])_0xb0d749[_0x3a839f(0x126)]=!![];if(_0x3c8d7d[_0x3a839f(0xb9)]&&typeof _0x3c8d7d[_0x3a839f(0xb9)]===_0x3a839f(0x19c))_0xb0d749['attribute']=_0x3c8d7d[_0x3a839f(0xb9)];if(_0x3c8d7d['behavior']&&typeof _0x3c8d7d[_0x3a839f(0x13c)]===_0x3a839f(0x19c))_0xb0d749[_0x3a839f(0x13c)]=_0x3c8d7d[_0x3a839f(0x13c)];if(_0x3c8d7d[_0x3a839f(0x12f)])_0xb0d749[_0x3a839f(0x12f)]=!![];if(_0x3c8d7d[_0x3a839f(0x176)])_0xb0d749[_0x3a839f(0x176)]=_0x3c8d7d[_0x3a839f(0x176)];let _0x2b6980;try{_0x2b6980=await _0x214539['segment']['previewParentYaml'](_0x251a87,_0xb0d749),_0x1b4ea4[_0x3a839f(0x129)]();}catch(_0xbef07e){_0x1b4ea4[_0x3a839f(0x129)]();throw _0xbef07e;}return await this[_0x3a839f(0x19f)](_0x2b6980,{'master':_0x3c8d7d['master'],'attribute':typeof _0x3c8d7d['attribute']===_0x3a839f(0x19c)?_0x3c8d7d['attribute']:undefined,'behavior':typeof _0x3c8d7d['behavior']===_0x3a839f(0x19c)?_0x3c8d7d[_0x3a839f(0x13c)]:undefined,'enriched':_0x3c8d7d[_0x3a839f(0x12f)]}),_0x2b6980[_0x3a839f(0x142)]?0x0:0x1;}async[a23_0x17f4b1(0x19f)](_0x388811,_0x1fea95){const _0x562433=a23_0x17f4b1;console[_0x562433(0xd7)]('\x0a'+a23_0x514346[_0x562433(0x171)](_0x562433(0x79))+'\x20'+_0x388811[_0x562433(0x119)]),console[_0x562433(0xd7)]('═'[_0x562433(0x8e)](0x3c));if(_0x1fea95['master']&&_0x388811['sampleData']){const _0x3ef96c=a23_0x514346[_0x562433(0x8c)]('Master:')+'\x20'+a23_0x514346[_0x562433(0x171)](_0x388811[_0x562433(0x126)][_0x562433(0x10d)]+'.'+_0x388811['master'][_0x562433(0x15c)]);await this['displaySampleData'](_0x3ef96c,_0x388811[_0x562433(0x166)]);}else{if(_0x1fea95[_0x562433(0xb9)]&&_0x388811[_0x562433(0x166)]){const _0x18ce90=a23_0x514346[_0x562433(0x8c)](_0x562433(0x108))+'\x20'+a23_0x514346['bold'](_0x1fea95[_0x562433(0xb9)]);await this[_0x562433(0x138)](_0x18ce90,_0x388811['sampleData']);}else{if(_0x1fea95[_0x562433(0x13c)]&&_0x388811[_0x562433(0x166)]){const _0x57141d=a23_0x514346[_0x562433(0x8c)](_0x562433(0x199))+'\x20'+a23_0x514346[_0x562433(0x171)](_0x1fea95[_0x562433(0x13c)]);await this[_0x562433(0x138)](_0x57141d,_0x388811[_0x562433(0x166)]);}else{if(_0x1fea95[_0x562433(0x12f)]&&_0x388811['sampleData']){const _0x36e99a=a23_0x514346[_0x562433(0x8c)](_0x562433(0x163))+'\x20'+a23_0x514346['bold']('Master\x20+\x20Attributes');await this[_0x562433(0x138)](_0x36e99a,_0x388811['sampleData']);}else!_0x388811['sampleData']&&console[_0x562433(0xd7)](_0x562433(0x76));}}}if(_0x388811['errors']['length']>0x0){console[_0x562433(0xd7)]('─'[_0x562433(0x8e)](0x3c)),console[_0x562433(0xd7)]('\x0a'+a23_0x514346[_0x562433(0xd1)](_0x562433(0xfd)));for(const _0x44e11b of _0x388811[_0x562433(0xde)]){console[_0x562433(0xd7)]('\x20\x20'+a23_0x514346['red']('•')+'\x20'+_0x44e11b);}}}async['displaySampleData'](_0x2e516a,_0x55b73a){const _0x442a7f=a23_0x17f4b1;if(_0x55b73a[_0x442a7f(0x15b)]===0x0){console[_0x442a7f(0xd7)]('\x0a'+_0x2e516a),console['error'](_0x442a7f(0x12c));return;}console[_0x442a7f(0xd7)]('\x0a'+_0x2e516a);const _0x40fc6a=Object['keys'](_0x55b73a[0x0])[_0x442a7f(0x114)](_0x2e2e9e=>({'name':_0x2e2e9e,'type':typeof _0x55b73a[0x0][_0x2e2e9e]==='number'?'double':_0x442a7f(0x10a)})),_0x307994={'queryId':_0x442a7f(0x11d),'columns':_0x40fc6a,'data':_0x55b73a,'stats':{'state':_0x442a7f(0x9e),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x55b73a[_0x442a7f(0x15b)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1dea46=formatAsTable(_0x307994,_0x55b73a['length'],!![]);await writeOutput(_0x1dea46,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0xa6);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x156);async[a23_0x17f4b1(0xd9)](_0x4e661b){const _0x16d9e2=a23_0x17f4b1,{options:_0x247853,args:_0x56c2d9,tdx:_0x1b0668}=_0x4e661b,_0x49fda6=_0x247853,_0x224414=_0x56c2d9[0x0]||_0x247853[_0x16d9e2(0x191)];if(!_0x224414)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x16d9e2(0x107)),0x1;const _0xf3f213=resolveYamlFile(_0x224414);if(existsSync(_0xf3f213)){_0x49fda6[_0x16d9e2(0x158)]&&console[_0x16d9e2(0xd7)](_0x16d9e2(0x122)+_0xf3f213);let _0x7a2f43;try{_0x7a2f43=readFileSync(_0xf3f213,_0x16d9e2(0x136));}catch(_0x223ef3){const _0x200b00=_0x223ef3 instanceof Error?_0x223ef3[_0x16d9e2(0x91)]:String(_0x223ef3);return console['error'](_0x16d9e2(0x187)+_0x200b00),0x1;}const _0x327200=await withSpinner(_0x16d9e2(0xf1),()=>_0x1b0668[_0x16d9e2(0x167)][_0x16d9e2(0xaf)](_0x7a2f43),{'verbose':_0x49fda6[_0x16d9e2(0x158)]}),_0xea304f=_0x327200[_0x16d9e2(0x157)],{isNew:_0x3dbb99,name:_0x4c229d,hasChanges:_0x1e7490,diffFormatted:_0x348258}=_0xea304f;if(_0x1e7490){_0x3dbb99?console[_0x16d9e2(0xd7)](_0x16d9e2(0xc4)+_0x4c229d+'\x27:'):console[_0x16d9e2(0xd7)](_0x16d9e2(0xc3)+_0x4c229d+'\x27:');console[_0x16d9e2(0xd7)]('─'[_0x16d9e2(0x8e)](0x3c)),console[_0x16d9e2(0xd7)](_0x348258),console[_0x16d9e2(0xd7)]('─'[_0x16d9e2(0x8e)](0x3c));const _0x26c604=_0x3dbb99?_0x16d9e2(0x152)+_0x4c229d+_0x16d9e2(0xf3):_0x16d9e2(0x186)+_0x4c229d+_0x16d9e2(0xf3);if(!_0x49fda6[_0x16d9e2(0xc7)]){const _0xf61e29=await confirmKey(_0x26c604);if(!_0xf61e29)return console[_0x16d9e2(0xd7)](_0x16d9e2(0xba)),0x1;}const _0x121163=_0x3dbb99?_0x16d9e2(0xf4):_0x16d9e2(0x154);await withSpinner(_0x121163+_0x16d9e2(0x7a)+_0x4c229d+'\x27...',()=>_0xea304f[_0x16d9e2(0xa7)](),{'verbose':_0x49fda6[_0x16d9e2(0x158)]});const _0x4db98a=_0x3dbb99?_0x16d9e2(0x134):'Updated';console[_0x16d9e2(0xd7)]('✔\x20'+_0x4db98a+'\x20parent\x20segment\x20\x27'+_0x4c229d+'\x27');}else console['error'](_0x16d9e2(0x143)+_0x4c229d+_0x16d9e2(0xed));}const _0x2f34a0=await withSpinner(_0x16d9e2(0xca)+_0x224414+_0x16d9e2(0xae),()=>_0x1b0668[_0x16d9e2(0x167)][_0x16d9e2(0xa2)](_0x224414),{'verbose':_0x49fda6[_0x16d9e2(0x158)]}),_0x355154=_0x2f34a0['data'],_0xca6f34=getConsoleUrl(_0x49fda6[_0x16d9e2(0x105)],_0x16d9e2(0x15d)+_0x355154[_0x16d9e2(0xa9)]+'/sessions/'+_0x355154[_0x16d9e2(0xdd)]+_0x16d9e2(0x17a)+_0x355154[_0x16d9e2(0x12d)]);return console[_0x16d9e2(0xd7)](_0x16d9e2(0xfc)),console[_0x16d9e2(0xd7)]('\x20\x20'+a23_0x514346[_0x16d9e2(0x8c)](_0x16d9e2(0xd4))+'\x20'+_0x355154[_0x16d9e2(0x11e)]),console['error']('\x20\x20'+a23_0x514346[_0x16d9e2(0x8c)](_0x16d9e2(0x172))+'\x20'+_0x355154['status']),console[_0x16d9e2(0xd7)]('\x20\x20'+a23_0x514346[_0x16d9e2(0x8c)](_0x16d9e2(0x184))+'\x20'+_0x355154[_0x16d9e2(0xdd)]),console['error']('\x20\x20'+a23_0x514346[_0x16d9e2(0x8c)](_0x16d9e2(0xff))+'\x20'+_0x355154[_0x16d9e2(0x12d)]),console[_0x16d9e2(0xd7)]('\x20\x20'+_0xca6f34),console[_0x16d9e2(0xd7)]('\x0a'+a23_0x514346['dim']('To\x20cancel:')+_0x16d9e2(0xf5)+_0x355154[_0x16d9e2(0x12d)]+_0x16d9e2(0x137)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0x10b);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x14d);async[a23_0x17f4b1(0xd9)](_0x12d148){const _0x3bcf7b=a23_0x17f4b1,{options:_0x97a31f,args:_0x16e990,tdx:_0x1a3e6c}=_0x12d148,_0x12e3ad=_0x16e990[0x0]||_0x97a31f[_0x3bcf7b(0x191)];if(!_0x12e3ad)return showParentSegmentNotSetError(_0x3bcf7b(0xa5)+'\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;_0x97a31f[_0x3bcf7b(0x158)]&&(console['error'](_0x3bcf7b(0x121)+_0x97a31f[_0x3bcf7b(0x105)]),console['error'](_0x3bcf7b(0x101)+_0x12e3ad));const _0x4b5925=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x12e3ad+_0x3bcf7b(0xae),()=>_0x1a3e6c[_0x3bcf7b(0x167)][_0x3bcf7b(0x162)](_0x12e3ad),{'verbose':_0x97a31f[_0x3bcf7b(0x158)]}),_0x4b38d1=_0x4b5925['data'];console['error'](_0x3bcf7b(0x8d)+_0x4b38d1['length']+_0x3bcf7b(0x160)+(_0x4b38d1[_0x3bcf7b(0x15b)]!==0x1?'s':''));if(_0x97a31f[_0x3bcf7b(0x14f)]||_0x97a31f[_0x3bcf7b(0x125)])return await handleSDKOutput(_0x4b38d1,_0x97a31f),0x0;return displayFieldsHumanReadable(_0x4b38d1,_0x12e3ad),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0xa3);[a23_0x17f4b1(0x7d)]='Show\x20parent\x20segment\x20details';async[a23_0x17f4b1(0xd9)](_0x1fa342){const _0x4f5e6f=a23_0x17f4b1,{options:_0x5db397,args:_0x2f7250,tdx:_0x505257}=_0x1fa342,_0x231af2=_0x5db397,_0xb2efe8=_0x2f7250[0x0]||_0x5db397[_0x4f5e6f(0x191)];if(!_0xb2efe8)return showParentSegmentNotSetError(_0x4f5e6f(0xe0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x4f5e6f(0x193)+_0x4f5e6f(0x159)),0x1;_0x5db397[_0x4f5e6f(0x158)]&&(console[_0x4f5e6f(0xd7)](_0x4f5e6f(0x121)+_0x5db397[_0x4f5e6f(0x105)]),console[_0x4f5e6f(0xd7)](_0x4f5e6f(0x101)+_0xb2efe8));const _0x1e4131=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xb2efe8+_0x4f5e6f(0xae),()=>_0x505257[_0x4f5e6f(0x167)][_0x4f5e6f(0x14b)](_0xb2efe8),{'verbose':_0x5db397[_0x4f5e6f(0x158)]}),_0x5e90f1=_0x1e4131['data'];if(_0x231af2[_0x4f5e6f(0x130)]){const _0x4cd20d=getConsoleNextUrl(_0x231af2[_0x4f5e6f(0x105)],_0x4f5e6f(0x118)+_0x5e90f1['id']);return console[_0x4f5e6f(0xd7)](a23_0x514346[_0x4f5e6f(0xcc)]('✔')+_0x4f5e6f(0xb6)+a23_0x514346[_0x4f5e6f(0x192)](_0x4cd20d)),openBrowser(_0x4cd20d),0x0;}return await handleSingleObjectOutput(_0x5e90f1,_0x5db397),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a23_0x17f4b1(0x11f);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x19d);async[a23_0x17f4b1(0xd9)](_0x86f076){const _0x3f0737=a23_0x17f4b1,{options:_0x25e66f,args:_0x241618,tdx:_0x5226a3}=_0x86f076,_0xc9b0de=_0x241618[0x0]||_0x25e66f[_0x3f0737(0x191)];if(!_0xc9b0de)return showParentSegmentNotSetError(_0x3f0737(0x141)+_0x3f0737(0xbf)),0x1;_0x25e66f[_0x3f0737(0x158)]&&(console[_0x3f0737(0xd7)]('Site:\x20'+_0x25e66f[_0x3f0737(0x105)]),console[_0x3f0737(0xd7)](_0x3f0737(0x101)+_0xc9b0de));const _0x517c54=await withSpinner(_0x3f0737(0xac)+_0xc9b0de+_0x3f0737(0xae),()=>_0x5226a3['segment']['resolveParentId'](_0xc9b0de),{'verbose':_0x25e66f['verbose']}),_0x2f65e0=_0x517c54[_0x3f0737(0x157)],_0x2ec4d3=await withSpinner(_0x3f0737(0x190)+_0xc9b0de+_0x3f0737(0xae),()=>_0x5226a3[_0x3f0737(0x167)][_0x3f0737(0x194)](_0x2f65e0),{'verbose':_0x25e66f['verbose']}),_0x2b5bb3=await executeSchemaQuery(_0x2ec4d3[_0x3f0737(0x157)],_0x5226a3,_0x25e66f);return await handleQueryOutput(_0x2b5bb3,_0x25e66f),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0x7c);[a23_0x17f4b1(0x7d)]=a23_0x17f4b1(0x77);async[a23_0x17f4b1(0xd9)](_0x1d92d2){const _0x452164=a23_0x17f4b1,{options:_0x57e9aa,args:_0x5f0f92,tdx:_0x5e1e54}=_0x1d92d2,_0x599a23=_0x5f0f92[0x0]||_0x57e9aa[_0x452164(0x191)];if(!_0x599a23)return showParentSegmentNotSetError(_0x452164(0xf6)+_0x452164(0x16c)),0x1;_0x57e9aa[_0x452164(0x158)]&&(console[_0x452164(0xd7)](_0x452164(0x121)+_0x57e9aa[_0x452164(0x105)]),console['error'](_0x452164(0x101)+_0x599a23));const _0x13ad42=await withSpinner(_0x452164(0xac)+_0x599a23+_0x452164(0xae),()=>_0x5e1e54[_0x452164(0x167)][_0x452164(0x117)](_0x599a23),{'verbose':_0x57e9aa[_0x452164(0x158)]}),_0x7a7e1e=_0x13ad42[_0x452164(0x157)],_0x4a952d=await withSpinner(_0x452164(0x190)+_0x599a23+_0x452164(0xae),()=>_0x5e1e54['segment'][_0x452164(0x194)](_0x7a7e1e),{'verbose':_0x57e9aa['verbose']}),_0x2ea91f=_0x4a952d[_0x452164(0x157)];return _0x57e9aa[_0x452164(0xf8)]===_0x452164(0x14f)||_0x57e9aa[_0x452164(0xf8)]===_0x452164(0x125)?await handleSDKOutput([{'sql':_0x2ea91f}],_0x57e9aa):console[_0x452164(0x139)](_0x2ea91f),0x0;}}function a23_0x4d86(_0x3149fe,_0x43c1e2){_0x3149fe=_0x3149fe-0x75;const _0x2982d2=a23_0x2982();let _0x4d8683=_0x2982d2[_0x3149fe];return _0x4d8683;}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x17f4b1(0x119)]=a23_0x17f4b1(0x17b);[a23_0x17f4b1(0x7d)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a23_0x17f4b1(0xd9)](_0x3f3a2f){const _0x23e1d3=a23_0x17f4b1,{options:_0x29903d,args:_0xb6fe7c,tdx:_0x374d64}=_0x3f3a2f,_0x21b88f=_0xb6fe7c[0x0]||_0x29903d[_0x23e1d3(0x191)];if(!_0x21b88f)return showParentSegmentNotSetError(_0x23e1d3(0x147)+'\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;_0x29903d[_0x23e1d3(0x158)]&&(console[_0x23e1d3(0xd7)]('Site:\x20'+_0x29903d[_0x23e1d3(0x105)]),console['error'](_0x23e1d3(0x101)+_0x21b88f));const _0x4d3fd5=await withSpinner(_0x23e1d3(0xac)+_0x21b88f+_0x23e1d3(0xae),()=>_0x374d64[_0x23e1d3(0x167)][_0x23e1d3(0x117)](_0x21b88f),{'verbose':_0x29903d[_0x23e1d3(0x158)]}),_0x25736d=_0x4d3fd5[_0x23e1d3(0x157)],_0x23d0b6=await withSpinner(_0x23e1d3(0x190)+_0x21b88f+_0x23e1d3(0xae),()=>_0x374d64[_0x23e1d3(0x167)][_0x23e1d3(0x194)](_0x25736d),{'verbose':_0x29903d[_0x23e1d3(0x158)]});let _0x1db2a3=_0x23d0b6['data'];const _0x532629=resolveLimit(_0x29903d[_0x23e1d3(0x7e)],DEFAULT_DISPLAY_LIMIT),_0x3bebbf=/\bLIMIT\s+\d+/i[_0x23e1d3(0xa1)](_0x1db2a3);!_0x3bebbf&&(_0x1db2a3=_0x1db2a3['trim']()[_0x23e1d3(0xc5)](/;+$/,''),_0x1db2a3=_0x23e1d3(0x182)+_0x1db2a3+_0x23e1d3(0x195)+_0x532629);_0x29903d['verbose']&&console[_0x23e1d3(0xd7)](_0x23e1d3(0x116)+_0x1db2a3);const _0x1e4e30=await withProgressSpinner(_0x23e1d3(0x127),async _0x1eaa44=>{const _0x2e72a4=_0x23e1d3,_0x13cc4f=await _0x374d64[_0x2e72a4(0xd6)][_0x2e72a4(0xd9)](_0x1db2a3,{'catalog':'td','schema':_0x2e72a4(0xb0),'onJobId':_0x4d3103=>{_0x1eaa44['setJobId'](_0x4d3103);}});return _0x13cc4f;},{'verbose':_0x29903d[_0x23e1d3(0x158)]}),_0x243853=_0x1e4e30[_0x23e1d3(0x157)],_0x545413=_0x243853[_0x23e1d3(0x149)]?_0x23e1d3(0x189)+_0x243853[_0x23e1d3(0x149)]+']':'';return console[_0x23e1d3(0xd7)](_0x23e1d3(0x85)+_0x243853[_0x23e1d3(0x197)][_0x23e1d3(0x17d)]['toLocaleString']()+_0x23e1d3(0x151)+(_0x23e1d3(0xe4)+formatElapsed(_0x243853[_0x23e1d3(0x197)][_0x23e1d3(0x174)])+_0x545413)),await handleQueryOutput(_0x243853,_0x29903d),0x0;}}
|
|
1
|
+
const a23_0x139023=a23_0x1de8;(function(_0x766c72,_0xe0e8cc){const _0x40e3e6=a23_0x1de8,_0x14c7b9=_0x766c72();while(!![]){try{const _0x55df3c=-parseInt(_0x40e3e6(0x279))/0x1*(parseInt(_0x40e3e6(0x1e1))/0x2)+-parseInt(_0x40e3e6(0x2c2))/0x3*(parseInt(_0x40e3e6(0x276))/0x4)+parseInt(_0x40e3e6(0x28a))/0x5+parseInt(_0x40e3e6(0x2d7))/0x6+parseInt(_0x40e3e6(0x2e1))/0x7+parseInt(_0x40e3e6(0x278))/0x8*(parseInt(_0x40e3e6(0x2f4))/0x9)+-parseInt(_0x40e3e6(0x29e))/0xa;if(_0x55df3c===_0xe0e8cc)break;else _0x14c7b9['push'](_0x14c7b9['shift']());}catch(_0x38aebb){_0x14c7b9['push'](_0x14c7b9['shift']());}}}(a23_0x10e2,0xdacba));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x37e68e 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_0x223cba from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x139023(0x2ed);function openBrowser(_0x578eb0){const _0x163dae=a23_0x139023,_0x74806e=process[_0x163dae(0x250)],_0xe6b4de=_0x74806e==='darwin'?'open':_0x74806e===_0x163dae(0x254)?_0x163dae(0x308):_0x163dae(0x1f1);spawn(_0xe6b4de,[_0x578eb0],{'detached':!![],'stdio':_0x163dae(0x232)})[_0x163dae(0x307)]();}function migrateLegacyDirectory(){const _0x95f7fe=a23_0x139023;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1dcb6f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1dcb6f[_0x95f7fe(0x2cd)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x95f7fe(0x2db)](a23_0x223cba[_0x95f7fe(0x20f)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x25e)+PARENT_SEGMENT_DIR+_0x95f7fe(0x227))),console[_0x95f7fe(0x2db)](a23_0x223cba['dim'](_0x95f7fe(0x288)+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x2a7))),![];console[_0x95f7fe(0x2db)](a23_0x223cba['yellow'](_0x95f7fe(0x267)+LEGACY_PARENT_SEGMENT_DIR+_0x95f7fe(0x25f)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x95f7fe(0x2db)](a23_0x223cba[_0x95f7fe(0x23b)](_0x95f7fe(0x25d)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3a078f){const _0x315651=_0x3a078f instanceof Error?_0x3a078f[_0x95f7fe(0x2a2)]:String(_0x3a078f);return console[_0x95f7fe(0x2db)](a23_0x223cba['red'](_0x95f7fe(0x2b1)+_0x315651+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x429fb6){return migrateLegacyDirectory(),super['run'](_0x429fb6);}}function resolveYamlFile(_0x372304){const _0x173873=a23_0x139023;if(_0x372304['endsWith'](_0x173873(0x2e4))||_0x372304[_0x173873(0x211)](_0x173873(0x209)))return _0x372304;return a23_0x37e68e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x372304)+_0x173873(0x2e4));}function formatProgressMessage(_0x13ecab){const _0x5d85b4=a23_0x139023,_0x14162b=_0x13ecab[_0x5d85b4(0x229)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x14162b){const [,_0x3c17ef,_0x44d0cb,_0x1379a5='']=_0x14162b;return a23_0x223cba[_0x5d85b4(0x2ba)](_0x3c17ef+':')+'\x20'+_0x44d0cb+a23_0x223cba[_0x5d85b4(0x2ba)](_0x1379a5);}return a23_0x223cba[_0x5d85b4(0x2ba)](_0x13ecab);}function showFileNotFoundError(_0x39ddae,_0x52164c){const _0x3a0707=a23_0x139023;console[_0x3a0707(0x2db)](a23_0x223cba[_0x3a0707(0x2ac)](_0x3a0707(0x2fb)+_0x39ddae+'\x0a')),console[_0x3a0707(0x2db)](a23_0x223cba['cyan'](_0x3a0707(0x2fc)+_0x52164c+_0x3a0707(0x21a)));}function showParentSegmentNotSetError(_0x4aaccd){const _0x89f95c=a23_0x139023;console[_0x89f95c(0x2db)](a23_0x223cba[_0x89f95c(0x20f)](_0x89f95c(0x2b7))),console['error'](_0x4aaccd);}function a23_0x1de8(_0x282f98,_0x1757ac){_0x282f98=_0x282f98-0x1df;const _0x10e2a3=a23_0x10e2();let _0x1de891=_0x10e2a3[_0x282f98];return _0x1de891;}export class ParentSegmentListCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x24d);[a23_0x139023(0x304)]=a23_0x139023(0x25a);async[a23_0x139023(0x262)](_0x2fae81){const _0x532906=a23_0x139023,{options:_0x223f97,args:_0x2dbb74,tdx:_0x2caec2}=_0x2fae81,_0x1393e5=_0x2dbb74[0x0];_0x223f97[_0x532906(0x2c0)]&&(console['error'](_0x532906(0x22b)+_0x223f97[_0x532906(0x205)]),_0x1393e5&&console[_0x532906(0x2db)](_0x532906(0x1f3)+_0x1393e5));const _0x37b872=await withSpinner(_0x1393e5?_0x532906(0x1e3)+_0x1393e5+_0x532906(0x294):_0x532906(0x2a5),()=>_0x2caec2[_0x532906(0x27a)]['listParents'](),{'verbose':_0x223f97['verbose']});let _0x197be9=_0x37b872[_0x532906(0x259)];if(_0x1393e5){const _0x2d133b=_0x1393e5['replace'](/[.+^${}()|[\]\\]/g,_0x532906(0x2fa))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x27c365=new RegExp('^'+_0x2d133b+'$','i');_0x197be9=_0x197be9[_0x532906(0x221)](_0x26c838=>_0x27c365['test'](_0x26c838['attributes'][_0x532906(0x28c)]));}_0x197be9[_0x532906(0x26f)]((_0x506403,_0x3c6eed)=>_0x506403[_0x532906(0x24a)]['name'][_0x532906(0x2a9)](_0x3c6eed[_0x532906(0x24a)]['name'])),console[_0x532906(0x2db)](_0x532906(0x2bc)+_0x197be9['length']+'\x20parent\x20segment'+(_0x197be9[_0x532906(0x1ef)]!==0x1?'s':''));const _0x2b89ba=_0x3e52e0=>{const _0x5993d4=_0x532906;return getConsoleNextUrl(_0x223f97[_0x5993d4(0x205)],_0x5993d4(0x23c)+_0x3e52e0);};if(_0x223f97[_0x532906(0x22f)]===_0x532906(0x24b)||_0x223f97[_0x532906(0x22f)]===_0x532906(0x222)){const _0x54f6a7=_0x197be9[_0x532906(0x23a)](_0x9163e9=>({..._0x9163e9,'url':_0x2b89ba(_0x9163e9['id'])}));await handleSDKOutput(_0x54f6a7,_0x223f97);}else{if(_0x197be9[_0x532906(0x1ef)]===0x0)_0x1393e5?console[_0x532906(0x216)](_0x532906(0x2d1)+_0x1393e5):console['log']('No\x20parent\x20segments\x20found');else for(const _0x48f1fe of _0x197be9){const _0x5d25d0=_0x48f1fe[_0x532906(0x24a)]['population']?a23_0x223cba[_0x532906(0x2ba)]('\x20('+formatRows(_0x48f1fe[_0x532906(0x24a)][_0x532906(0x29d)])+')'):'',_0x31fe49=hyperlink(_0x48f1fe[_0x532906(0x24a)]['name'],_0x2b89ba(_0x48f1fe['id']));console[_0x532906(0x216)]('👥\x20'+_0x31fe49+_0x5d25d0);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x2e0);[a23_0x139023(0x304)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x3eb400){const _0x35fbc9=a23_0x139023,{options:_0x223aab,args:_0x219550,tdx:_0x51cf97}=_0x3eb400;console[_0x35fbc9(0x2db)](_0x35fbc9(0x1eb)+_0x35fbc9(0x2c7)+_0x35fbc9(0x272));const _0x4b6ff3=_0x223aab;if(_0x219550[_0x35fbc9(0x1ef)]===0x0)return console['error'](a23_0x223cba[_0x35fbc9(0x2ac)](_0x35fbc9(0x218))),console[_0x35fbc9(0x2db)](_0x35fbc9(0x2cb)),0x1;const _0x2b6ae0=_0x219550[0x0];if(!_0x4b6ff3[_0x35fbc9(0x235)]||!_0x4b6ff3[_0x35fbc9(0x2ee)])return console[_0x35fbc9(0x2db)](_0x35fbc9(0x27b)),console[_0x35fbc9(0x2db)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x4b6ff3[_0x35fbc9(0x2c0)]&&(console[_0x35fbc9(0x2db)](_0x35fbc9(0x22b)+_0x4b6ff3[_0x35fbc9(0x205)]),console[_0x35fbc9(0x2db)]('Name:\x20'+_0x2b6ae0),console[_0x35fbc9(0x2db)](_0x35fbc9(0x28b)+_0x4b6ff3[_0x35fbc9(0x235)]),console[_0x35fbc9(0x2db)](_0x35fbc9(0x1e2)+_0x4b6ff3['table']));const _0x3b5d30=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x24a)],_0x4b6ff3['attributesFile']),_0x34841d=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x2d0)],_0x4b6ff3[_0x35fbc9(0x2e8)]),_0xce16c6=await loadJSONFromOptions(_0x4b6ff3[_0x35fbc9(0x256)],_0x4b6ff3[_0x35fbc9(0x255)]),_0x5f5b43={'name':_0x2b6ae0,'description':_0x4b6ff3[_0x35fbc9(0x304)],'scheduleType':_0x4b6ff3[_0x35fbc9(0x228)],'scheduleOption':_0x4b6ff3[_0x35fbc9(0x2c8)],'timezone':_0x4b6ff3[_0x35fbc9(0x233)],'master':{'parentDatabaseName':_0x4b6ff3[_0x35fbc9(0x235)],'parentTableName':_0x4b6ff3[_0x35fbc9(0x2ee)]},'attributes':_0x3b5d30,'behaviors':_0x34841d,'customerGroup':_0xce16c6},_0x30c621=await withSpinner(_0x35fbc9(0x257)+_0x2b6ae0+_0x35fbc9(0x294),()=>_0x51cf97['segment'][_0x35fbc9(0x2dd)](_0x5f5b43),{'verbose':_0x223aab['verbose']}),_0x13c8bb=_0x30c621['data'];return console[_0x35fbc9(0x2db)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x13c8bb['name']+'\x27\x20with\x20ID:\x20'+_0x13c8bb['id']),await handleSDKOutput([_0x13c8bb],_0x223aab),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x139023(0x28c)]='segment:parent:update';[a23_0x139023(0x304)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x139023(0x262)](_0x298c6f){const _0x205ea3=a23_0x139023,{options:_0x473c10,args:_0x4ba128,tdx:_0x4ef0cd}=_0x298c6f;console[_0x205ea3(0x2db)](_0x205ea3(0x25c)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x205ea3(0x272));const _0x21dec2=_0x473c10;if(_0x4ba128[_0x205ea3(0x1ef)]===0x0)return console[_0x205ea3(0x2db)](a23_0x223cba[_0x205ea3(0x2ac)](_0x205ea3(0x218))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x47de17=_0x4ba128[0x0];_0x21dec2[_0x205ea3(0x2c0)]&&(console[_0x205ea3(0x2db)](_0x205ea3(0x22b)+_0x21dec2[_0x205ea3(0x205)]),console[_0x205ea3(0x2db)](_0x205ea3(0x28f)+_0x47de17));const _0xb33fed=await withSpinner(_0x205ea3(0x231)+_0x47de17+_0x205ea3(0x294),()=>_0x4ef0cd[_0x205ea3(0x27a)]['getParentFull'](_0x47de17),{'verbose':_0x21dec2['verbose']}),_0x45ffd7=_0xb33fed[_0x205ea3(0x259)],_0x4ef70f=await loadJSONFromOptions(_0x21dec2[_0x205ea3(0x1f2)],_0x21dec2[_0x205ea3(0x1e5)]),_0x975c3f=await loadJSONFromOptions(_0x21dec2[_0x205ea3(0x264)],_0x21dec2[_0x205ea3(0x2e9)]),_0x38d590={'name':_0x45ffd7['name'],'description':_0x21dec2[_0x205ea3(0x304)]!==undefined?_0x21dec2[_0x205ea3(0x304)]:_0x45ffd7[_0x205ea3(0x304)],'scheduleType':_0x21dec2['scheduleType']!==undefined?_0x21dec2[_0x205ea3(0x228)]:_0x45ffd7[_0x205ea3(0x228)],'scheduleOption':_0x21dec2[_0x205ea3(0x2c8)]!==undefined?_0x21dec2['scheduleOption']:_0x45ffd7[_0x205ea3(0x2c8)],'timezone':_0x21dec2[_0x205ea3(0x233)]!==undefined?_0x21dec2['timezone']:_0x45ffd7['timezone'],'master':_0x45ffd7[_0x205ea3(0x2dc)],'attributes':_0x4ef70f?[..._0x45ffd7['attributes']||[],..._0x4ef70f]:_0x45ffd7['attributes'],'behaviors':_0x975c3f?[..._0x45ffd7[_0x205ea3(0x2d0)]||[],..._0x975c3f]:_0x45ffd7[_0x205ea3(0x2d0)],'customerGroup':_0x45ffd7[_0x205ea3(0x256)]},_0xd0f872=await withSpinner(_0x205ea3(0x29a)+_0x47de17+'\x27...',()=>_0x4ef0cd[_0x205ea3(0x27a)][_0x205ea3(0x24e)](_0x47de17,_0x38d590),{'verbose':_0x21dec2[_0x205ea3(0x2c0)]}),_0x3b7479=_0xd0f872['data'];return console['error']('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3b7479[_0x205ea3(0x28c)]+'\x27'),await handleSDKOutput([_0x3b7479],_0x21dec2),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x305);[a23_0x139023(0x304)]=a23_0x139023(0x2b6);async[a23_0x139023(0x262)](_0x54bf6b){const _0x1ea696=a23_0x139023,{options:_0x2497df,args:_0x35ac12,tdx:_0x38a7ec}=_0x54bf6b,_0x4cb2cd=_0x2497df,_0x24fb22=_0x35ac12[0x0]||_0x2497df['parentSegment'];if(!_0x24fb22)return showParentSegmentNotSetError(_0x1ea696(0x2e2)+_0x1ea696(0x21f)),0x1;if(_0x4cb2cd[_0x1ea696(0x2f6)]&&_0x4cb2cd[_0x1ea696(0x23d)])return console['error'](a23_0x223cba['red'](_0x1ea696(0x284))),console[_0x1ea696(0x2db)](a23_0x223cba['dim'](_0x1ea696(0x270))),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x2ba)](_0x1ea696(0x249)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a23_0x223cba[_0x1ea696(0x252)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x252f0c=_0x4cb2cd[_0x1ea696(0x23d)]||a23_0x37e68e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x24fb22)+_0x1ea696(0x2e4));_0x4cb2cd[_0x1ea696(0x2c0)]&&(console[_0x1ea696(0x2db)](_0x1ea696(0x22b)+_0x4cb2cd[_0x1ea696(0x205)]),console[_0x1ea696(0x2db)](_0x1ea696(0x28f)+_0x24fb22),console[_0x1ea696(0x2db)](_0x1ea696(0x2d3)+_0x252f0c));const _0xd2ba80=await withSpinner(_0x1ea696(0x1ec)+_0x24fb22+_0x1ea696(0x294),()=>_0x38a7ec[_0x1ea696(0x27a)][_0x1ea696(0x300)](_0x24fb22),{'verbose':_0x4cb2cd[_0x1ea696(0x2c0)]}),_0x1f946e=_0xd2ba80['data'];if(existsSync(_0x252f0c)){const _0x33879f=readFileSync(_0x252f0c,'utf-8'),_0x2d733d=generateDiff(_0x33879f,_0x1f946e);if(!hasChanges(_0x2d733d))console['error'](a23_0x223cba[_0x1ea696(0x23b)]('✔')+'\x20No\x20changes\x20-\x20'+a23_0x223cba[_0x1ea696(0x252)](_0x252f0c)+_0x1ea696(0x21b));else{console[_0x1ea696(0x2db)](_0x1ea696(0x274)+_0x252f0c+'\x27:'),console['error']('─'[_0x1ea696(0x29b)](0x3c)),console['error'](formatDiffWithColors(_0x2d733d)),console[_0x1ea696(0x2db)]('─'['repeat'](0x3c));if(!_0x4cb2cd[_0x1ea696(0x251)]){const _0x48dd87=await confirmKey('Overwrite\x20\x27'+_0x252f0c+'\x27?');if(!_0x48dd87)return console[_0x1ea696(0x2db)](_0x1ea696(0x281)),0x1;}writeFileSync(_0x252f0c,_0x1f946e,_0x1ea696(0x269)),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x2c6)+a23_0x223cba['cyan'](_0x252f0c));}}else{const _0x23287c=a23_0x37e68e[_0x1ea696(0x2b0)](_0x252f0c);!existsSync(_0x23287c)&&mkdirSync(_0x23287c,{'recursive':!![]}),writeFileSync(_0x252f0c,_0x1f946e,'utf-8'),console[_0x1ea696(0x2db)](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x2c6)+a23_0x223cba[_0x1ea696(0x252)](_0x252f0c));}return saveSessionContext({'parent_segment':_0x24fb22},_0x4cb2cd['session']),console['error'](a23_0x223cba[_0x1ea696(0x23b)]('✔')+_0x1ea696(0x1fb)+a23_0x223cba[_0x1ea696(0x2ba)](_0x1ea696(0x2ed))+'\x20=\x20'+a23_0x223cba[_0x1ea696(0x252)](_0x24fb22)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x20c);[a23_0x139023(0x304)]=a23_0x139023(0x2e6);async[a23_0x139023(0x262)](_0x215209){const _0x2b64a9=a23_0x139023,{options:_0xceed99,args:_0x1beaa6,tdx:_0x1c954a}=_0x215209,_0x2bc24f=_0xceed99,_0x4f1b11=_0x1beaa6[0x0]||_0xceed99[_0x2b64a9(0x301)];if(!_0x4f1b11)return showParentSegmentNotSetError(_0x2b64a9(0x2af)+_0x2b64a9(0x2be)),0x1;const _0x111523=resolveYamlFile(_0x4f1b11);if(!existsSync(_0x111523))return showFileNotFoundError(_0x111523,_0x4f1b11),0x1;_0x2bc24f['verbose']&&(console[_0x2b64a9(0x2db)](_0x2b64a9(0x22b)+_0x2bc24f[_0x2b64a9(0x205)]),console['error'](_0x2b64a9(0x21c)+_0x111523));let _0x30d266;try{_0x30d266=readFileSync(_0x111523,'utf-8');}catch(_0x15b545){const _0x48cd87=_0x15b545 instanceof Error?_0x15b545[_0x2b64a9(0x2a2)]:String(_0x15b545);return console[_0x2b64a9(0x2db)]('Error\x20reading\x20file:\x20'+_0x48cd87),0x1;}const _0x3234fb=await withSpinner('Analyzing\x20changes...',()=>_0x1c954a['segment'][_0x2b64a9(0x1f8)](_0x30d266),{'verbose':_0x2bc24f['verbose']}),_0x14cccc=_0x3234fb[_0x2b64a9(0x259)],{isNew:_0x3046a0,name:_0x43628d,hasChanges:_0x3117c9,diffFormatted:_0x5e449f}=_0x14cccc;if(!_0x3117c9)return console['error'](_0x2b64a9(0x22d)+_0x43628d+_0x2b64a9(0x220)),0x0;_0x3046a0?console[_0x2b64a9(0x2db)](_0x2b64a9(0x230)+_0x43628d+'\x27:'):console[_0x2b64a9(0x2db)](_0x2b64a9(0x204)+_0x43628d+'\x27:');console['error']('─'[_0x2b64a9(0x29b)](0x3c)),console['error'](_0x5e449f),console[_0x2b64a9(0x2db)]('─'['repeat'](0x3c));const _0xbcef9e=_0x3046a0?'Create\x20parent\x20segment\x20\x27'+_0x43628d+'\x27?':_0x2b64a9(0x2f0)+_0x43628d+'\x27?';if(!_0x2bc24f['yes']){const _0x20f858=await confirmKey(_0xbcef9e);if(!_0x20f858)return console['error'](_0x2b64a9(0x281)),0x1;}const _0x62a6ce=_0x3046a0?_0x2b64a9(0x2cf):_0x2b64a9(0x1ee),_0x5819fa=await withSpinner(_0x62a6ce+_0x2b64a9(0x299)+_0x43628d+_0x2b64a9(0x294),()=>_0x14cccc[_0x2b64a9(0x291)](),{'verbose':_0x2bc24f[_0x2b64a9(0x2c0)]}),_0x339aaf=_0x5819fa[_0x2b64a9(0x259)],_0x424370=getConsoleNextUrl(_0x2bc24f[_0x2b64a9(0x205)],_0x2b64a9(0x23c)+_0x339aaf['id']),_0x1eb5a7=_0x3046a0?_0x2b64a9(0x2c3):_0x2b64a9(0x247);return console[_0x2b64a9(0x2db)]('✔\x20'+_0x1eb5a7+_0x2b64a9(0x299)+_0x339aaf[_0x2b64a9(0x28c)]+'\x27'),console[_0x2b64a9(0x2db)]('\x20\x20'+_0x424370),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x139023(0x2d9);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x139023(0x262)](_0x44f1f3){const _0x6e1739=a23_0x139023,{options:_0x559877,args:_0x3479d6,tdx:_0x1e2869}=_0x44f1f3,_0x5197d6=_0x559877,_0x2253e9=_0x3479d6[0x0]||_0x559877[_0x6e1739(0x301)];if(!_0x2253e9)return showParentSegmentNotSetError(_0x6e1739(0x213)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x6e1739(0x248)+'\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 _0x3c8477=resolveYamlFile(_0x2253e9);if(!existsSync(_0x3c8477))return showFileNotFoundError(_0x3c8477,_0x2253e9),0x1;_0x5197d6[_0x6e1739(0x2c0)]&&(console[_0x6e1739(0x2db)](_0x6e1739(0x22b)+_0x5197d6[_0x6e1739(0x205)]),console[_0x6e1739(0x2db)]('YAML\x20file:\x20'+_0x3c8477));let _0x5d61b5;try{_0x5d61b5=readFileSync(_0x3c8477,_0x6e1739(0x269));}catch(_0x28ded2){const _0x1fc92a=_0x28ded2 instanceof Error?_0x28ded2[_0x6e1739(0x2a2)]:String(_0x28ded2);return console[_0x6e1739(0x2db)]('Error\x20reading\x20file:\x20'+_0x1fc92a),0x1;}const _0x4266e7=createCommandSpinner(a23_0x223cba['dim']('Validating\x20configuration...'),{'verbose':_0x5197d6[_0x6e1739(0x2c0)]});_0x4266e7[_0x6e1739(0x308)]();const _0x44576a={'onProgress':_0x5dc6d6=>{_0x4266e7['text']=formatProgressMessage(_0x5dc6d6);}};if(_0x5197d6[_0x6e1739(0x2dc)])_0x44576a[_0x6e1739(0x2dc)]=!![];if(_0x5197d6['enriched'])_0x44576a['enriched']=!![];_0x5197d6[_0x6e1739(0x29c)]&&(_0x44576a[_0x6e1739(0x29c)]=_0x5197d6[_0x6e1739(0x29c)]);_0x5197d6[_0x6e1739(0x2a8)]&&(_0x44576a[_0x6e1739(0x2a8)]=_0x5197d6['behavior']);if(_0x5197d6[_0x6e1739(0x2de)])_0x44576a[_0x6e1739(0x2de)]=_0x5197d6[_0x6e1739(0x2de)];let _0x15db8e;try{_0x15db8e=await _0x1e2869['segment'][_0x6e1739(0x290)](_0x5d61b5,_0x44576a),_0x4266e7[_0x6e1739(0x212)]();}catch(_0x4f1908){_0x4266e7[_0x6e1739(0x212)]();throw _0x4f1908;}const _0x2ed9c4=_0x5197d6[_0x6e1739(0x2de)]||_0x6e1739(0x1ff);return this[_0x6e1739(0x2ea)](_0x15db8e,_0x44576a,_0x3c8477,_0x2ed9c4),_0x15db8e[_0x6e1739(0x2ad)]?0x0:0x1;}[a23_0x139023(0x2ea)](_0xff90cb,_0x13f8d2,_0x102dda,_0x33820a){const _0x50b51a=a23_0x139023;console['error']('\x0a'+a23_0x223cba[_0x50b51a(0x282)](_0x50b51a(0x200))+'\x20'+_0xff90cb[_0x50b51a(0x28c)]),console[_0x50b51a(0x2db)]('═'['repeat'](0x3c)),this[_0x50b51a(0x214)](_0xff90cb);if(typeof _0x13f8d2['attribute']===_0x50b51a(0x27d)){this['displayAttributesStats'](_0xff90cb),this['displaySummary'](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,_0x50b51a(0x29c),_0x13f8d2[_0x50b51a(0x29c)]);return;}if(_0x13f8d2[_0x50b51a(0x29c)]===!![]){this[_0x50b51a(0x1f9)](_0xff90cb),this[_0x50b51a(0x246)](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,'attributes');return;}if(typeof _0x13f8d2[_0x50b51a(0x2a8)]==='string'){this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this['displaySummary'](_0xff90cb),this['displayPreviewHints'](_0x102dda,_0x33820a,_0x50b51a(0x2a8),_0x13f8d2[_0x50b51a(0x2a8)]);return;}if(_0x13f8d2[_0x50b51a(0x2a8)]===!![]){this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this['displaySummary'](_0xff90cb),this[_0x50b51a(0x2e3)](_0x102dda,_0x33820a,_0x50b51a(0x2d0));return;}this[_0x50b51a(0x1f9)](_0xff90cb),this[_0x50b51a(0x302)](_0xff90cb,_0x33820a),this[_0x50b51a(0x246)](_0xff90cb),this[_0x50b51a(0x2e3)](_0x102dda,_0x33820a,_0x50b51a(0x2bf));}[a23_0x139023(0x2e3)](_0x36bafb,_0x88d6d5,_0x284c78,_0x441045){const _0x26eda4=a23_0x139023;console[_0x26eda4(0x2db)]('\x0a'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x2aa)));const _0x1b6541=_0x88d6d5!==_0x26eda4(0x1ff)?_0x26eda4(0x238)+_0x88d6d5:'';if(_0x284c78===_0x26eda4(0x29c)&&_0x441045)console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+'\x20--attribute\x20\x22'+_0x441045+'\x22'+_0x1b6541));else{if(_0x284c78===_0x26eda4(0x2a8)&&_0x441045)console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x36bafb+_0x26eda4(0x2a6)+_0x441045+'\x22'+_0x1b6541));else(_0x284c78==='attributes'||_0x284c78===_0x26eda4(0x2bf))&&console['error']('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+_0x26eda4(0x26b)+_0x1b6541));}(_0x284c78===_0x26eda4(0x2d0)||_0x284c78===_0x26eda4(0x2bf))&&console['error']('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)](_0x26eda4(0x20a)+_0x36bafb+_0x26eda4(0x29f)+_0x1b6541)),_0x284c78===_0x26eda4(0x2bf)&&console[_0x26eda4(0x2db)]('\x20\x20'+a23_0x223cba[_0x26eda4(0x2ba)]('tdx\x20segment\x20parent\x20preview\x20'+_0x36bafb+_0x26eda4(0x27c)+_0x1b6541));}[a23_0x139023(0x214)](_0x58e18a){const _0x4139ec=a23_0x139023,{master:_0x5cfae3}=_0x58e18a,_0x481332=_0x5cfae3['schemaValid']?a23_0x223cba[_0x4139ec(0x23b)]('✔'):a23_0x223cba['red']('✘');console[_0x4139ec(0x2db)]('\x0a'+a23_0x223cba[_0x4139ec(0x2ba)](_0x4139ec(0x2bb))),console['error'](_0x481332+'\x20'+a23_0x223cba[_0x4139ec(0x282)](_0x5cfae3[_0x4139ec(0x235)]+'.'+_0x5cfae3[_0x4139ec(0x2ee)])),_0x5cfae3[_0x4139ec(0x2f2)]?_0x5cfae3[_0x4139ec(0x293)]!==undefined&&console['error']('\x20\x20'+a23_0x223cba[_0x4139ec(0x2ba)](_0x4139ec(0x275))+'\x20'+a23_0x223cba[_0x4139ec(0x252)](formatRows(_0x5cfae3['rowCount']))):console[_0x4139ec(0x2db)]('\x20\x20'+a23_0x223cba[_0x4139ec(0x2ac)]('Error:')+'\x20'+_0x5cfae3['schemaError']);}['displayAttributesStats'](_0x3f2675){const _0x28674a=a23_0x139023;if(_0x3f2675[_0x28674a(0x24a)][_0x28674a(0x1ef)]===0x0)return;console[_0x28674a(0x2db)]('\x0a'+a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x22a)));for(const _0xeee223 of _0x3f2675[_0x28674a(0x24a)]){const _0x2fd933=_0xeee223[_0x28674a(0x2f2)]?a23_0x223cba[_0x28674a(0x23b)]('✔'):a23_0x223cba[_0x28674a(0x2ac)]('✘');let _0x5ccd0c='';if(_0xeee223[_0x28674a(0x2f2)]&&_0xeee223[_0x28674a(0x1f0)]!==undefined&&_0xeee223[_0x28674a(0x2b8)]!==undefined){const _0x4bfd90=_0xeee223[_0x28674a(0x2b8)][_0x28674a(0x2a1)](0x1),_0x4225e5=_0xeee223[_0x28674a(0x2b8)]>=0x50?a23_0x223cba[_0x28674a(0x23b)]:_0xeee223[_0x28674a(0x2b8)]>=0x32?a23_0x223cba['yellow']:a23_0x223cba[_0x28674a(0x2ac)];_0x5ccd0c='\x20'+a23_0x223cba[_0x28674a(0x2ba)]('Coverage:')+'\x20'+_0x4225e5(_0x4bfd90+'%')+'\x20('+formatRows(_0xeee223[_0x28674a(0x1f0)])+_0x28674a(0x2f7);}console[_0x28674a(0x2db)](_0x2fd933+'\x20'+a23_0x223cba['bold'](_0xeee223[_0x28674a(0x28c)])+_0x5ccd0c),console['error']('\x20\x20'+a23_0x223cba[_0x28674a(0x2ba)]('Source:')+'\x20'+a23_0x223cba[_0x28674a(0x282)](_0xeee223[_0x28674a(0x235)]+'.'+_0xeee223['table']));const _0x6dd073=_0xeee223[_0x28674a(0x2f1)]===_0xeee223[_0x28674a(0x253)]?a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x283))+'\x20'+_0xeee223[_0x28674a(0x2f1)]:a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x26a))+'\x20'+_0xeee223[_0x28674a(0x2f1)]+_0x28674a(0x2e7)+_0xeee223[_0x28674a(0x253)];console['error']('\x20\x20'+_0x6dd073),console[_0x28674a(0x2db)]('\x20\x20'+a23_0x223cba[_0x28674a(0x2ba)](_0x28674a(0x24f))),this[_0x28674a(0x1e7)](_0xeee223['columns']),!_0xeee223[_0x28674a(0x2f2)]&&console[_0x28674a(0x2db)]('\x20\x20'+a23_0x223cba[_0x28674a(0x2ac)]('Error:')+'\x20'+_0xeee223[_0x28674a(0x268)]);}}[a23_0x139023(0x302)](_0x32e609,_0x37bbf1){const _0x281cb6=a23_0x139023;if(_0x32e609[_0x281cb6(0x2d0)][_0x281cb6(0x1ef)]===0x0)return;console[_0x281cb6(0x2db)]('\x0a'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x26d))+'\x20'+a23_0x223cba[_0x281cb6(0x2ba)]('('+_0x37bbf1+')'));for(const _0x2f72eb of _0x32e609[_0x281cb6(0x2d0)]){const _0x182829=_0x2f72eb[_0x281cb6(0x2f2)]?a23_0x223cba[_0x281cb6(0x23b)]('✔'):a23_0x223cba[_0x281cb6(0x2ac)]('✘');let _0x108a43='';if(_0x2f72eb[_0x281cb6(0x2f2)]&&_0x2f72eb['customersWithEvents']!==undefined&&_0x2f72eb[_0x281cb6(0x1e4)]!==undefined){const _0x247fd8=_0x2f72eb[_0x281cb6(0x2b3)]?.['toFixed'](0x1)||'?',_0x4b34cd=(_0x2f72eb[_0x281cb6(0x2b3)]??0x0)>=0x32?a23_0x223cba[_0x281cb6(0x23b)]:(_0x2f72eb[_0x281cb6(0x2b3)]??0x0)>=0x14?a23_0x223cba['yellow']:a23_0x223cba[_0x281cb6(0x2ac)];_0x108a43='\x20'+a23_0x223cba['dim'](_0x281cb6(0x20b))+'\x20'+_0x4b34cd(formatRows(_0x2f72eb[_0x281cb6(0x2bd)]))+'\x20('+_0x247fd8+_0x281cb6(0x258)+a23_0x223cba['dim'](_0x281cb6(0x2ab))+'\x20'+a23_0x223cba[_0x281cb6(0x252)](formatRows(_0x2f72eb[_0x281cb6(0x1e4)]));}console[_0x281cb6(0x2db)](_0x182829+'\x20'+a23_0x223cba[_0x281cb6(0x282)](_0x2f72eb[_0x281cb6(0x28c)])+_0x108a43),console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x239))+'\x20'+a23_0x223cba[_0x281cb6(0x282)](_0x2f72eb[_0x281cb6(0x235)]+'.'+_0x2f72eb['table']));const _0x511833=_0x2f72eb[_0x281cb6(0x2f1)]===_0x2f72eb[_0x281cb6(0x253)]?a23_0x223cba['dim'](_0x281cb6(0x283))+'\x20'+_0x2f72eb['joinKey']:a23_0x223cba[_0x281cb6(0x2ba)]('Join:')+'\x20'+_0x2f72eb[_0x281cb6(0x2f1)]+_0x281cb6(0x2e7)+_0x2f72eb[_0x281cb6(0x253)];console[_0x281cb6(0x2db)]('\x20\x20'+_0x511833),console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ba)](_0x281cb6(0x24f))),this[_0x281cb6(0x1e7)](_0x2f72eb[_0x281cb6(0x2cc)]),!_0x2f72eb['schemaValid']&&console[_0x281cb6(0x2db)]('\x20\x20'+a23_0x223cba[_0x281cb6(0x2ac)]('Error:')+'\x20'+_0x2f72eb[_0x281cb6(0x268)]);}}[a23_0x139023(0x1e7)](_0x187186){const _0x5b95e0=a23_0x139023;for(const _0x5424f8 of _0x187186){_0x5424f8[_0x5b95e0(0x206)]===_0x5424f8[_0x5b95e0(0x2b9)]||_0x5424f8[_0x5b95e0(0x2b9)]==='*'?console[_0x5b95e0(0x2db)](_0x5b95e0(0x27e)+_0x5424f8[_0x5b95e0(0x206)]):console[_0x5b95e0(0x2db)]('\x20\x20\x20\x20-\x20'+_0x5424f8['label']+'\x20'+a23_0x223cba[_0x5b95e0(0x2ba)]('('+_0x5424f8[_0x5b95e0(0x2b9)]+')'));}}[a23_0x139023(0x246)](_0x1c3d96){const _0x54f9e3=a23_0x139023;console[_0x54f9e3(0x2db)]('─'[_0x54f9e3(0x29b)](0x3c));if(_0x1c3d96[_0x54f9e3(0x1fe)][_0x54f9e3(0x1ef)]>0x0){console[_0x54f9e3(0x2db)]('\x0a'+a23_0x223cba['red']('Errors:'));for(const _0x13c2c3 of _0x1c3d96[_0x54f9e3(0x1fe)]){console[_0x54f9e3(0x2db)]('\x20\x20'+a23_0x223cba[_0x54f9e3(0x2ac)]('•')+'\x20'+_0x13c2c3);}}_0x1c3d96[_0x54f9e3(0x2ad)]&&console['error']('\x0a'+a23_0x223cba[_0x54f9e3(0x23b)]('✔')+_0x54f9e3(0x28e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x139023(0x28c)]='segment:parent:preview';[a23_0x139023(0x304)]=a23_0x139023(0x217);async[a23_0x139023(0x262)](_0x3c4758){const _0x21a33a=a23_0x139023,{options:_0x40d09e,args:_0x10abff,tdx:_0x5e6b40}=_0x3c4758,_0xcc32e5=_0x40d09e,_0x28ec63=_0x10abff[0x0]||_0x40d09e['parentSegment'];if(!_0x28ec63)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x21a33a(0x2da)+_0x21a33a(0x202)+_0x21a33a(0x306)+_0x21a33a(0x2b4)+_0x21a33a(0x261)+_0x21a33a(0x2a3)+_0x21a33a(0x271)),0x1;if(!_0xcc32e5['master']&&!_0xcc32e5[_0x21a33a(0x29c)]&&!_0xcc32e5[_0x21a33a(0x2a8)]&&!_0xcc32e5[_0x21a33a(0x2d5)])return console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x298))),console[_0x21a33a(0x2db)](_0x21a33a(0x234)),console['error'](_0x21a33a(0x2df)),console[_0x21a33a(0x2db)](_0x21a33a(0x26c)),console['error'](_0x21a33a(0x219)),console[_0x21a33a(0x2db)](_0x21a33a(0x2fd)),console[_0x21a33a(0x2db)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3f3d09=resolveYamlFile(_0x28ec63);if(!existsSync(_0x3f3d09))return showFileNotFoundError(_0x3f3d09,_0x28ec63),0x1;_0xcc32e5[_0x21a33a(0x2c0)]&&(console[_0x21a33a(0x2db)](_0x21a33a(0x22b)+_0xcc32e5[_0x21a33a(0x205)]),console[_0x21a33a(0x2db)]('YAML\x20file:\x20'+_0x3f3d09));let _0xc9c7d7;try{_0xc9c7d7=readFileSync(_0x3f3d09,_0x21a33a(0x269));}catch(_0x1a9bdc){const _0x46ab8d=_0x1a9bdc instanceof Error?_0x1a9bdc[_0x21a33a(0x2a2)]:String(_0x1a9bdc);return console['error'](_0x21a33a(0x20e)+_0x46ab8d),0x1;}let _0x515f96;try{_0x515f96=parseDef(_0xc9c7d7);}catch(_0x1d83c7){const _0x40f3e8=_0x1d83c7 instanceof Error?_0x1d83c7[_0x21a33a(0x2a2)]:String(_0x1d83c7);return console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x243)+_0x40f3e8)),0x1;}if(_0xcc32e5[_0x21a33a(0x29c)]===!![]||_0xcc32e5[_0x21a33a(0x29c)]===''){const _0xd9d1ad=_0x515f96['attributes']?.[_0x21a33a(0x23a)](_0x43f8f9=>_0x43f8f9[_0x21a33a(0x28c)])||[];if(_0xd9d1ad['length']===0x0)console['error'](a23_0x223cba[_0x21a33a(0x2ac)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x297))),console[_0x21a33a(0x2db)]('Available\x20attributes:');for(const _0x4abf4c of _0xd9d1ad){console[_0x21a33a(0x2db)]('\x20\x20'+a23_0x223cba['cyan'](_0x4abf4c));}console['error'](_0x21a33a(0x237)+_0x28ec63+_0x21a33a(0x22c)+_0xd9d1ad[0x0]+'\x22');}return 0x1;}if(_0xcc32e5[_0x21a33a(0x2a8)]===!![]||_0xcc32e5['behavior']===''){const _0x1dd57b=_0x515f96[_0x21a33a(0x2d0)]?.[_0x21a33a(0x23a)](_0x1cc1f0=>_0x1cc1f0[_0x21a33a(0x28c)])||[];if(_0x1dd57b[_0x21a33a(0x1ef)]===0x0)console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x309)));else{console[_0x21a33a(0x2db)](a23_0x223cba[_0x21a33a(0x2ac)](_0x21a33a(0x265))),console[_0x21a33a(0x2db)](_0x21a33a(0x1f6));for(const _0x3588f5 of _0x1dd57b){console[_0x21a33a(0x2db)]('\x20\x20'+a23_0x223cba['cyan'](_0x3588f5));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x28ec63+_0x21a33a(0x2a6)+_0x1dd57b[0x0]+'\x22');}return 0x1;}const _0x43e96b=createCommandSpinner(a23_0x223cba[_0x21a33a(0x2ba)](_0x21a33a(0x277)),{'verbose':_0xcc32e5[_0x21a33a(0x2c0)]});_0x43e96b[_0x21a33a(0x308)]();const _0x9a1b84={'onProgress':_0x4b3fcb=>{const _0x47381b=_0x21a33a;_0x43e96b[_0x47381b(0x2d8)]=formatProgressMessage(_0x4b3fcb);}};if(_0xcc32e5[_0x21a33a(0x2dc)])_0x9a1b84['master']=!![];if(_0xcc32e5['attribute']&&typeof _0xcc32e5[_0x21a33a(0x29c)]===_0x21a33a(0x27d))_0x9a1b84[_0x21a33a(0x29c)]=_0xcc32e5[_0x21a33a(0x29c)];if(_0xcc32e5[_0x21a33a(0x2a8)]&&typeof _0xcc32e5[_0x21a33a(0x2a8)]===_0x21a33a(0x27d))_0x9a1b84[_0x21a33a(0x2a8)]=_0xcc32e5[_0x21a33a(0x2a8)];if(_0xcc32e5[_0x21a33a(0x2d5)])_0x9a1b84[_0x21a33a(0x2d5)]=!![];if(_0xcc32e5['interval'])_0x9a1b84[_0x21a33a(0x2de)]=_0xcc32e5['interval'];let _0x70f5c8;try{_0x70f5c8=await _0x5e6b40[_0x21a33a(0x27a)][_0x21a33a(0x2ff)](_0xc9c7d7,_0x9a1b84),_0x43e96b[_0x21a33a(0x212)]();}catch(_0x1be3de){_0x43e96b['stop']();throw _0x1be3de;}return await this[_0x21a33a(0x27f)](_0x70f5c8,{'master':_0xcc32e5[_0x21a33a(0x2dc)],'attribute':typeof _0xcc32e5[_0x21a33a(0x29c)]===_0x21a33a(0x27d)?_0xcc32e5[_0x21a33a(0x29c)]:undefined,'behavior':typeof _0xcc32e5[_0x21a33a(0x2a8)]===_0x21a33a(0x27d)?_0xcc32e5[_0x21a33a(0x2a8)]:undefined,'enriched':_0xcc32e5['enriched']}),_0x70f5c8[_0x21a33a(0x2ad)]?0x0:0x1;}async[a23_0x139023(0x27f)](_0x2bf62d,_0x8e79a1){const _0x2b86dd=a23_0x139023;console[_0x2b86dd(0x2db)]('\x0a'+a23_0x223cba['bold']('Preview:')+'\x20'+_0x2bf62d[_0x2b86dd(0x28c)]),console[_0x2b86dd(0x2db)]('═'[_0x2b86dd(0x29b)](0x3c));if(_0x8e79a1['master']&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0x35a6cb=a23_0x223cba[_0x2b86dd(0x2ba)]('Master:')+'\x20'+a23_0x223cba['bold'](_0x2bf62d[_0x2b86dd(0x2dc)][_0x2b86dd(0x235)]+'.'+_0x2bf62d[_0x2b86dd(0x2dc)][_0x2b86dd(0x2ee)]);await this[_0x2b86dd(0x2fe)](_0x35a6cb,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1[_0x2b86dd(0x29c)]&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0xb36c39=a23_0x223cba[_0x2b86dd(0x2ba)](_0x2b86dd(0x2c5))+'\x20'+a23_0x223cba[_0x2b86dd(0x282)](_0x8e79a1[_0x2b86dd(0x29c)]);await this['displaySampleData'](_0xb36c39,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1['behavior']&&_0x2bf62d[_0x2b86dd(0x28d)]){const _0x5616cf=a23_0x223cba[_0x2b86dd(0x2ba)](_0x2b86dd(0x286))+'\x20'+a23_0x223cba['bold'](_0x8e79a1['behavior']);await this[_0x2b86dd(0x2fe)](_0x5616cf,_0x2bf62d[_0x2b86dd(0x28d)]);}else{if(_0x8e79a1[_0x2b86dd(0x2d5)]&&_0x2bf62d['sampleData']){const _0x59c11e=a23_0x223cba[_0x2b86dd(0x2ba)]('Enriched:')+'\x20'+a23_0x223cba[_0x2b86dd(0x282)](_0x2b86dd(0x24c));await this[_0x2b86dd(0x2fe)](_0x59c11e,_0x2bf62d[_0x2b86dd(0x28d)]);}else!_0x2bf62d[_0x2b86dd(0x28d)]&&console[_0x2b86dd(0x2db)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x2bf62d[_0x2b86dd(0x1fe)][_0x2b86dd(0x1ef)]>0x0){console[_0x2b86dd(0x2db)]('─'[_0x2b86dd(0x29b)](0x3c)),console[_0x2b86dd(0x2db)]('\x0a'+a23_0x223cba['red'](_0x2b86dd(0x2f5)));for(const _0xd499d3 of _0x2bf62d[_0x2b86dd(0x1fe)]){console[_0x2b86dd(0x2db)]('\x20\x20'+a23_0x223cba[_0x2b86dd(0x2ac)]('•')+'\x20'+_0xd499d3);}}}async[a23_0x139023(0x2fe)](_0xd61247,_0x37b901){const _0x34f003=a23_0x139023;if(_0x37b901[_0x34f003(0x1ef)]===0x0){console[_0x34f003(0x2db)]('\x0a'+_0xd61247),console[_0x34f003(0x2db)](_0x34f003(0x1e8));return;}console[_0x34f003(0x2db)]('\x0a'+_0xd61247);const _0x41e913=Object['keys'](_0x37b901[0x0])[_0x34f003(0x23a)](_0x9c7584=>({'name':_0x9c7584,'type':typeof _0x37b901[0x0][_0x9c7584]===_0x34f003(0x241)?_0x34f003(0x26e):_0x34f003(0x21e)})),_0xb2931={'queryId':'preview','columns':_0x41e913,'data':_0x37b901,'stats':{'state':_0x34f003(0x223),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x37b901[_0x34f003(0x1ef)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1f0e5b=formatAsTable(_0xb2931,_0x37b901[_0x34f003(0x1ef)],!![]);await writeOutput(_0x1f0e5b,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a23_0x139023(0x23e);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a23_0x139023(0x262)](_0x561ea2){const _0x455ad5=a23_0x139023,{options:_0x123127,args:_0x576852,tdx:_0x26e95b}=_0x561ea2,_0x509df9=_0x123127,_0x4aa76a=_0x576852[0x0]||_0x123127['parentSegment'];if(!_0x4aa76a)return showParentSegmentNotSetError(_0x455ad5(0x303)+_0x455ad5(0x2f3)),0x1;const _0x3c29b4=resolveYamlFile(_0x4aa76a);if(existsSync(_0x3c29b4)){_0x509df9[_0x455ad5(0x2c0)]&&console[_0x455ad5(0x2db)](_0x455ad5(0x295)+_0x3c29b4);let _0x510ee4;try{_0x510ee4=readFileSync(_0x3c29b4,_0x455ad5(0x269));}catch(_0x2581bc){const _0x15d533=_0x2581bc instanceof Error?_0x2581bc['message']:String(_0x2581bc);return console[_0x455ad5(0x2db)]('Error\x20reading\x20file:\x20'+_0x15d533),0x1;}const _0x244313=await withSpinner(_0x455ad5(0x23f),()=>_0x26e95b[_0x455ad5(0x27a)][_0x455ad5(0x1f8)](_0x510ee4),{'verbose':_0x509df9[_0x455ad5(0x2c0)]}),_0x5dc556=_0x244313[_0x455ad5(0x259)],{isNew:_0x4eaa65,name:_0x5e1306,hasChanges:_0x3f3eb5,diffFormatted:_0x43768c}=_0x5dc556;if(_0x3f3eb5){_0x4eaa65?console[_0x455ad5(0x2db)](_0x455ad5(0x230)+_0x5e1306+'\x27:'):console[_0x455ad5(0x2db)](_0x455ad5(0x204)+_0x5e1306+'\x27:');console[_0x455ad5(0x2db)]('─'['repeat'](0x3c)),console['error'](_0x43768c),console['error']('─'['repeat'](0x3c));const _0x34365a=_0x4eaa65?_0x455ad5(0x2ca)+_0x5e1306+_0x455ad5(0x1fc):'Apply\x20changes\x20to\x20\x27'+_0x5e1306+'\x27\x20and\x20run\x20workflow?';if(!_0x509df9['yes']){const _0xa5a0ec=await confirmKey(_0x34365a);if(!_0xa5a0ec)return console[_0x455ad5(0x2db)]('Aborted.'),0x1;}const _0x491ea4=_0x4eaa65?_0x455ad5(0x2cf):_0x455ad5(0x1ee);await withSpinner(_0x491ea4+_0x455ad5(0x299)+_0x5e1306+'\x27...',()=>_0x5dc556[_0x455ad5(0x291)](),{'verbose':_0x509df9[_0x455ad5(0x2c0)]});const _0x58ae5e=_0x4eaa65?_0x455ad5(0x2c3):_0x455ad5(0x247);console[_0x455ad5(0x2db)]('✔\x20'+_0x58ae5e+'\x20parent\x20segment\x20\x27'+_0x5e1306+'\x27');}else console['error'](_0x455ad5(0x22d)+_0x5e1306+'\x27\x20is\x20up\x20to\x20date');}const _0x5e1726=await withSpinner(_0x455ad5(0x2f8)+_0x4aa76a+'\x27...',()=>_0x26e95b[_0x455ad5(0x27a)][_0x455ad5(0x201)](_0x4aa76a),{'verbose':_0x509df9[_0x455ad5(0x2c0)]}),_0x311ba1=_0x5e1726[_0x455ad5(0x259)],_0x427c66=getConsoleUrl(_0x509df9[_0x455ad5(0x205)],'/app/workflows/'+_0x311ba1[_0x455ad5(0x2ce)]+'/sessions/'+_0x311ba1[_0x455ad5(0x215)]+_0x455ad5(0x273)+_0x311ba1[_0x455ad5(0x1ed)]);return console[_0x455ad5(0x2db)](_0x455ad5(0x2ec)),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2ae))+'\x20'+_0x311ba1[_0x455ad5(0x1e6)]),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2d2))+'\x20'+_0x311ba1[_0x455ad5(0x2b5)]),console[_0x455ad5(0x2db)]('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2b2))+'\x20'+_0x311ba1[_0x455ad5(0x215)]),console['error']('\x20\x20'+a23_0x223cba[_0x455ad5(0x2ba)]('Attempt:')+'\x20'+_0x311ba1[_0x455ad5(0x1ed)]),console[_0x455ad5(0x2db)]('\x20\x20'+_0x427c66),console['error']('\x0a'+a23_0x223cba[_0x455ad5(0x2ba)](_0x455ad5(0x2a4))+_0x455ad5(0x236)+_0x311ba1[_0x455ad5(0x1ed)]+_0x455ad5(0x263)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x266);['description']=a23_0x139023(0x292);async[a23_0x139023(0x262)](_0x3749a8){const _0x2ad144=a23_0x139023,{options:_0x3a0463,args:_0x17108c,tdx:_0xb7be93}=_0x3749a8,_0x3a8a59=_0x17108c[0x0]||_0x3a0463['parentSegment'];if(!_0x3a8a59)return showParentSegmentNotSetError(_0x2ad144(0x289)+_0x2ad144(0x224)),0x1;_0x3a0463[_0x2ad144(0x2c0)]&&(console[_0x2ad144(0x2db)](_0x2ad144(0x22b)+_0x3a0463[_0x2ad144(0x205)]),console[_0x2ad144(0x2db)](_0x2ad144(0x28f)+_0x3a8a59));const _0x398558=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3a8a59+_0x2ad144(0x294),()=>_0xb7be93[_0x2ad144(0x27a)]['listFields'](_0x3a8a59),{'verbose':_0x3a0463[_0x2ad144(0x2c0)]}),_0x4cfba3=_0x398558[_0x2ad144(0x259)];console['error'](_0x2ad144(0x2bc)+_0x4cfba3[_0x2ad144(0x1ef)]+'\x20field'+(_0x4cfba3[_0x2ad144(0x1ef)]!==0x1?'s':''));if(_0x3a0463[_0x2ad144(0x24b)]||_0x3a0463[_0x2ad144(0x222)])return await handleSDKOutput(_0x4cfba3,_0x3a0463),0x0;return displayFieldsHumanReadable(_0x4cfba3,_0x3a8a59),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a23_0x139023(0x2eb);[a23_0x139023(0x304)]=a23_0x139023(0x1df);async[a23_0x139023(0x262)](_0xe262d4){const _0x43c19d=a23_0x139023,{options:_0x59e35e,args:_0x9c3c2e,tdx:_0x45fcd6}=_0xe262d4,_0x559620=_0x59e35e,_0x114c4b=_0x9c3c2e[0x0]||_0x59e35e['parentSegment'];if(!_0x114c4b)return showParentSegmentNotSetError(_0x43c19d(0x20d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x43c19d(0x296)+_0x43c19d(0x1e9)),0x1;_0x59e35e['verbose']&&(console[_0x43c19d(0x2db)](_0x43c19d(0x22b)+_0x59e35e[_0x43c19d(0x205)]),console['error'](_0x43c19d(0x28f)+_0x114c4b));const _0x5d3dbc=await withSpinner(_0x43c19d(0x1ec)+_0x114c4b+_0x43c19d(0x294),()=>_0x45fcd6[_0x43c19d(0x27a)][_0x43c19d(0x207)](_0x114c4b),{'verbose':_0x59e35e[_0x43c19d(0x2c0)]}),_0x4e2f9e=_0x5d3dbc[_0x43c19d(0x259)];if(_0x559620[_0x43c19d(0x287)]){const _0x1c76fd=getConsoleNextUrl(_0x559620['site'],'/app/dw/parentSegments/'+_0x4e2f9e['id']);return console['error'](a23_0x223cba[_0x43c19d(0x23b)]('✔')+_0x43c19d(0x260)+a23_0x223cba[_0x43c19d(0x252)](_0x1c76fd)),openBrowser(_0x1c76fd),0x0;}return await handleSingleObjectOutput(_0x4e2f9e,_0x59e35e),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x139023(0x28c)]=a23_0x139023(0x244);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x5e974d){const _0x1e96ea=a23_0x139023,{options:_0x30e4f1,args:_0x8bb19d,tdx:_0x7cd522}=_0x5e974d,_0x298e5b=_0x8bb19d[0x0]||_0x30e4f1[_0x1e96ea(0x301)];if(!_0x298e5b)return showParentSegmentNotSetError(_0x1e96ea(0x2d6)+_0x1e96ea(0x21d)),0x1;_0x30e4f1[_0x1e96ea(0x2c0)]&&(console[_0x1e96ea(0x2db)](_0x1e96ea(0x22b)+_0x30e4f1[_0x1e96ea(0x205)]),console['error'](_0x1e96ea(0x28f)+_0x298e5b));const _0x42fb5b=await withSpinner(_0x1e96ea(0x1ea)+_0x298e5b+_0x1e96ea(0x294),()=>_0x7cd522['segment'][_0x1e96ea(0x225)](_0x298e5b),{'verbose':_0x30e4f1[_0x1e96ea(0x2c0)]}),_0x5e4b58=_0x42fb5b['data'],_0x447759=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x298e5b+_0x1e96ea(0x294),()=>_0x7cd522['segment'][_0x1e96ea(0x2a0)](_0x5e4b58),{'verbose':_0x30e4f1[_0x1e96ea(0x2c0)]}),_0x382e4d=await executeSchemaQuery(_0x447759['data'],_0x7cd522,_0x30e4f1);return await handleQueryOutput(_0x382e4d,_0x30e4f1),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0x139023(0x22e);[a23_0x139023(0x304)]=a23_0x139023(0x1fa);async[a23_0x139023(0x262)](_0x5e80d7){const _0x21b5cf=a23_0x139023,{options:_0x250dcf,args:_0x447c21,tdx:_0x388f5f}=_0x5e80d7,_0x217311=_0x447c21[0x0]||_0x250dcf[_0x21b5cf(0x301)];if(!_0x217311)return showParentSegmentNotSetError(_0x21b5cf(0x285)+_0x21b5cf(0x2c9)),0x1;_0x250dcf['verbose']&&(console[_0x21b5cf(0x2db)]('Site:\x20'+_0x250dcf[_0x21b5cf(0x205)]),console[_0x21b5cf(0x2db)](_0x21b5cf(0x28f)+_0x217311));const _0x39fe74=await withSpinner(_0x21b5cf(0x1ea)+_0x217311+_0x21b5cf(0x294),()=>_0x388f5f[_0x21b5cf(0x27a)]['resolveParentId'](_0x217311),{'verbose':_0x250dcf['verbose']}),_0x3f36d1=_0x39fe74[_0x21b5cf(0x259)],_0x5a06a8=await withSpinner(_0x21b5cf(0x2ef)+_0x217311+'\x27...',()=>_0x388f5f[_0x21b5cf(0x27a)][_0x21b5cf(0x2a0)](_0x3f36d1),{'verbose':_0x250dcf[_0x21b5cf(0x2c0)]}),_0x2ef1a3=_0x5a06a8[_0x21b5cf(0x259)];return _0x250dcf[_0x21b5cf(0x22f)]==='json'||_0x250dcf[_0x21b5cf(0x22f)]==='jsonl'?await handleSDKOutput([{'sql':_0x2ef1a3}],_0x250dcf):console[_0x21b5cf(0x216)](_0x2ef1a3),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x139023(0x28c)]='segment:parent:show';[a23_0x139023(0x304)]=a23_0x139023(0x203);async[a23_0x139023(0x262)](_0x40e36d){const _0x5475dc=a23_0x139023,{options:_0x349384,args:_0x2c86f4,tdx:_0x2566d7}=_0x40e36d,_0x323c8b=_0x2c86f4[0x0]||_0x349384[_0x5475dc(0x301)];if(!_0x323c8b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+'\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;_0x349384[_0x5475dc(0x2c0)]&&(console['error']('Site:\x20'+_0x349384['site']),console[_0x5475dc(0x2db)](_0x5475dc(0x28f)+_0x323c8b));const _0x185e7b=await withSpinner(_0x5475dc(0x1ea)+_0x323c8b+_0x5475dc(0x294),()=>_0x2566d7[_0x5475dc(0x27a)][_0x5475dc(0x225)](_0x323c8b),{'verbose':_0x349384['verbose']}),_0x587206=_0x185e7b['data'],_0x36fb43=await withSpinner(_0x5475dc(0x2ef)+_0x323c8b+_0x5475dc(0x294),()=>_0x2566d7[_0x5475dc(0x27a)][_0x5475dc(0x2a0)](_0x587206),{'verbose':_0x349384[_0x5475dc(0x2c0)]});let _0x50d310=_0x36fb43[_0x5475dc(0x259)];const _0x34735e=resolveLimit(_0x349384[_0x5475dc(0x1fd)],DEFAULT_DISPLAY_LIMIT),_0x44f6c9=/\bLIMIT\s+\d+/i[_0x5475dc(0x208)](_0x50d310);!_0x44f6c9&&(_0x50d310=_0x50d310[_0x5475dc(0x2c1)]()[_0x5475dc(0x2c4)](/;+$/,''),_0x50d310=_0x5475dc(0x25b)+_0x50d310+_0x5475dc(0x2f9)+_0x34735e);_0x349384[_0x5475dc(0x2c0)]&&console['error'](_0x5475dc(0x1f7)+_0x50d310);const _0x286387=await withProgressSpinner(_0x5475dc(0x1e0),async _0x1ec36a=>{const _0xb8a538=_0x5475dc,_0x41c37e=await _0x2566d7[_0xb8a538(0x280)][_0xb8a538(0x262)](_0x50d310,{'catalog':'td','schema':_0xb8a538(0x240),'onJobId':_0x4e993d=>{_0x1ec36a['setJobId'](_0x4e993d);}});return _0x41c37e;},{'verbose':_0x349384['verbose']}),_0x38a954=_0x286387[_0x5475dc(0x259)],_0x31f436=_0x38a954[_0x5475dc(0x1f4)]?_0x5475dc(0x2d4)+_0x38a954['jobId']+']':'';return console[_0x5475dc(0x2db)](_0x5475dc(0x210)+_0x38a954[_0x5475dc(0x226)]['processedRows'][_0x5475dc(0x245)]()+_0x5475dc(0x1f5)+(_0x5475dc(0x2e5)+formatElapsed(_0x38a954[_0x5475dc(0x226)][_0x5475dc(0x242)])+_0x31f436)),await handleQueryOutput(_0x38a954,_0x349384),0x0;}}function a23_0x10e2(){const _0x398ab5=['addAttributes','Pattern:\x20','jobId','\x20rows\x20','Available\x20behaviors:','SQL\x20query:\x0a','pushParentYaml','displayAttributesStats','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20Context\x20set:\x20','\x27\x20and\x20run\x20workflow?','limit','errors','-1d','Validate:','runParent','Options\x20(one\x20required):\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0aChanges\x20to\x20apply\x20to\x20\x27','site','label','getParentFull','test','.yaml','tdx\x20segment\x20parent\x20preview\x20','Customers:','segment:parent:push','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Error\x20reading\x20file:\x20','yellow','✔\x20Query\x20completed:\x20Processed\x20','endsWith','stop','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayMasterInfo','workflowSessionId','log','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','`\x20to\x20download\x20the\x20configuration\x20first','\x20is\x20already\x20up\x20to\x20date','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','varchar','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x27\x20is\x20already\x20up\x20to\x20date','filter','jsonl','FINISHED','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','resolveParentId','stats','/\x20directories\x20exist.','scheduleType','match','Attributes','Site:\x20','\x20--attribute\x20\x22','✔\x20No\x20changes\x20-\x20\x27','segment:parent:sql','format','\x0aNew\x20parent\x20segment\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','ignore','timezone','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','database','\x20tdx\x20wf\x20attempt\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--interval\x20','Source:','map','green','/app/dw/parentSegments/','output','segment:parent:run','Analyzing\x20changes...','information_schema','number','elapsedTimeMillis','Error\x20parsing\x20YAML:\x20','segment:parent:desc','toLocaleString','displaySummary','Updated','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','using\x20the\x20default\x20path:\x20','attributes','json','Master\x20+\x20Attributes','segment:parent:list','updateParent','Columns:','platform','yes','cyan','foreignKey','win32','customerGroupFile','customerGroup','Creating\x20parent\x20segment\x20\x27','%)\x20','data','List\x20parent\x20segments','SELECT\x20*\x20FROM\x20(\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','✔\x20Renamed\x20directory\x20to\x20','/\x20and\x20','/\x20→\x20','\x20Opening\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','execute','\x20kill','addBehaviors','Error:\x20--behavior\x20requires\x20a\x20name\x0a','segment:parent:fields','\x0a⚠️\x20\x20Migrating:\x20','schemaError','utf-8','Join:','\x20--attribute\x20\x22<name>\x22','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Behaviors','double','sort','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','\x0aChanges\x20to\x20\x27','Rows:','1691308QhMjvO','Fetching\x20sample\x20data...','191432QdCdiz','1VaMzej','segment','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20--enriched','string','\x20\x20\x20\x20-\x20','displayPreviewResults','query','Aborted.','bold','Join\x20on:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Behavior:','web','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','1619435gxzCWj','Database:\x20','name','sampleData','\x20Configuration\x20is\x20valid','Parent\x20segment:\x20','validateParentYaml','apply','List\x20available\x20fields\x20for\x20segmentation','rowCount','\x27...','Found\x20YAML\x20file:\x20','Options:\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20parent\x20segment\x20\x27','Updating\x20parent\x20segment\x20\x27','repeat','attribute','population','9857410IvnaSb','\x20--behavior\x20\x22<name>\x22','getParentSQL','toFixed','message','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','To\x20cancel:','Listing\x20parent\x20segments...','\x20--behavior\x20\x22','/\x20directory.\x0a','behavior','localeCompare','To\x20view\x20sample\x20data:','Events:','red','allValid','Audience\x20ID:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','dirname','✘\x20Failed\x20to\x20rename\x20directory:\x20','Session:','customerPercent','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','status','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','coveragePercent','column','dim','Master\x20Table','✔\x20Found\x20','customersWithEvents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','all','verbose','trim','3AjHgnL','Created','replace','Attribute:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','scheduleOption','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','columns','isDirectory','workflowId','Creating','behaviors','No\x20parent\x20segments\x20match\x20pattern:\x20','Status:','Output\x20file:\x20','\x20[Job\x20ID:\x20','enriched','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','2092434LeslPN','text','segment:parent:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','error','master','createParent','interval','Options:','segment:parent:create','11301234GnncSH','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','displayPreviewHints','.yml','in\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20=\x20','behaviorsFile','addBehaviorsFile','displayValidateResults','segment:parent:view','\x0a✔\x20Workflow\x20started','parent_segment','table','Fetching\x20SQL\x20for\x20\x27','Apply\x20changes\x20to\x20\x27','joinKey','schemaValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','9kzEhtK','Errors:','use','\x20rows)','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x5c$&','Error:\x20File\x20not\x20found:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','displaySampleData','previewParentYaml','pullParentYaml','parentSegment','displayBehaviorsStats','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','description','segment:parent:pull','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','unref','start','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Show\x20parent\x20segment\x20details','Executing\x20parent\x20segment\x20query...','12526fwcopG','Table:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','totalEvents','addAttributesFile','audienceId','displayColumns','\x20\x20No\x20sample\x20data\x20available','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Resolving\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Fetching\x20parent\x20segment\x20\x27','workflowAttemptId','Updating','length','matchedCount','xdg-open'];a23_0x10e2=function(){return _0x398ab5;};return a23_0x10e2();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x2dcbcb=a24_0x23f3;(function(_0x528963,_0x401c22){const _0x33f542=a24_0x23f3,_0x784a99=_0x528963();while(!![]){try{const _0xcdcf6c=-parseInt(_0x33f542(0x87))/0x1+parseInt(_0x33f542(0xbc))/0x2*(parseInt(_0x33f542(0xc8))/0x3)+parseInt(_0x33f542(0xd7))/0x4*(-parseInt(_0x33f542(0xe4))/0x5)+parseInt(_0x33f542(0xaa))/0x6*(-parseInt(_0x33f542(0xbb))/0x7)+-parseInt(_0x33f542(0xb8))/0x8*(-parseInt(_0x33f542(0x7b))/0x9)+parseInt(_0x33f542(0x80))/0xa+parseInt(_0x33f542(0xa0))/0xb;if(_0xcdcf6c===_0x401c22)break;else _0x784a99['push'](_0x784a99['shift']());}catch(_0x91a53){_0x784a99['push'](_0x784a99['shift']());}}}(a24_0x3a2b,0xdd449));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_0x1aa95a 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{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x4f2b85 from'prompts';import a24_0x3548d6 from'chalk';function validateProfileName(_0x53f77e){const _0x188c83=a24_0x23f3;if(!_0x53f77e||!_0x53f77e[_0x188c83(0x8d)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x204d59=_0x53f77e[_0x188c83(0x8d)]();if(!/^[a-zA-Z0-9_-]+$/[_0x188c83(0x79)](_0x204d59))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x204d59))return _0x188c83(0xa9)+_0x204d59+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}function a24_0x23f3(_0x305a06,_0x38e64e){_0x305a06=_0x305a06-0x74;const _0x3a2b52=a24_0x3a2b();let _0x23f316=_0x3a2b52[_0x305a06];return _0x23f316;}export class ProfileCreateCommand extends BaseCommand{[a24_0x2dcbcb(0xe5)]=a24_0x2dcbcb(0xe0);['description']=a24_0x2dcbcb(0x9f);async[a24_0x2dcbcb(0xc7)](_0x2222d2){const _0x4de62c=a24_0x2dcbcb,{options:_0x994dc4,args:_0x399bb6}=_0x2222d2;console[_0x4de62c(0x78)](a24_0x3548d6[_0x4de62c(0x93)](_0x4de62c(0xa5)));let _0x278440;if(_0x399bb6[_0x4de62c(0x7d)]>0x0&&_0x399bb6[0x0]){const _0xf2a2b7=_0x399bb6[0x0]['trim'](),_0x4834c5=validateProfileName(_0xf2a2b7);if(_0x4834c5!==!![])return console[_0x4de62c(0xa2)](a24_0x3548d6['red'](_0x4834c5)),0x1;_0x278440=_0xf2a2b7;}else{const _0x3a93e8=await a24_0x4f2b85({'type':_0x4de62c(0xc2),'name':_0x4de62c(0x89),'message':_0x4de62c(0x91),'validate':validateProfileName});if(!_0x3a93e8[_0x4de62c(0x89)])return console[_0x4de62c(0x78)](_0x4de62c(0xd3)),0x1;_0x278440=_0x3a93e8['profileName'][_0x4de62c(0x8d)]();}const _0x24ba49=await a24_0x4f2b85({'type':_0x4de62c(0xc2),'name':_0x4de62c(0xa6),'message':'Enter\x20description\x20(optional):'}),_0xfa853b=_0x24ba49[_0x4de62c(0xa6)]?.[_0x4de62c(0x8d)]()||undefined,_0xdd20d=_0x994dc4[_0x4de62c(0xa4)]||_0x4de62c(0xd1),_0x5cda3c=[{'title':_0x4de62c(0xd4),'value':'us01'},{'title':_0x4de62c(0xba),'value':_0x4de62c(0xc6)},{'title':_0x4de62c(0xac),'value':'eu01'},{'title':_0x4de62c(0x8a),'value':_0x4de62c(0xb2)}];let _0x20736c=_0x5cda3c['findIndex'](_0x4576e6=>_0x4576e6[_0x4de62c(0xb0)]===_0xdd20d);_0x20736c===-0x1&&_0xdd20d!==_0x4de62c(0xd1)&&(_0x5cda3c['push']({'title':_0xdd20d,'value':_0xdd20d}),_0x20736c=_0x5cda3c[_0x4de62c(0x7d)]-0x1);_0x5cda3c[_0x4de62c(0xc9)]({'title':_0x4de62c(0x84),'value':_0x4de62c(0x7e)});const _0x1582ad=await a24_0x4f2b85({'type':_0x4de62c(0xd2),'name':_0x4de62c(0xa4),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x278440+'\x27:','choices':_0x5cda3c,'initial':_0x20736c>=0x0?_0x20736c:0x0});if(!_0x1582ad[_0x4de62c(0xa4)])return console[_0x4de62c(0x78)](_0x4de62c(0xd3)),0x1;let _0x37867d;if(_0x1582ad[_0x4de62c(0xa4)]==='other'){const _0x59e72e=await a24_0x4f2b85({'type':_0x4de62c(0xc2),'name':_0x4de62c(0x74),'message':_0x4de62c(0xab),'initial':'us01','validate':_0x1d1dac=>{const _0x221b06=_0x4de62c;if(!_0x1d1dac||!_0x1d1dac['trim']())return _0x221b06(0x97);if(!/^[a-z0-9-]+$/['test'](_0x1d1dac[_0x221b06(0x8d)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x59e72e[_0x4de62c(0x74)])return console[_0x4de62c(0x78)]('\x0aSetup\x20cancelled'),0x1;_0x37867d=_0x59e72e[_0x4de62c(0x74)];}else _0x37867d=_0x1582ad[_0x4de62c(0xa4)];const _0x5b3350=resolveSite(_0x37867d);console[_0x4de62c(0x78)](_0x4de62c(0x98)+_0x5b3350),console[_0x4de62c(0x78)](_0x4de62c(0x8c)),console[_0x4de62c(0x78)]('\x20\x20'+getConsoleUrl(_0x5b3350,_0x4de62c(0xb3)));const _0x5a7bcb=await a24_0x4f2b85({'type':_0x4de62c(0xce),'name':_0x4de62c(0xb4),'message':_0x4de62c(0xe1),'validate':_0x2e7542=>{if(!_0x2e7542||!_0x2e7542['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5a7bcb[_0x4de62c(0xb4)])return console[_0x4de62c(0x78)]('\x0aSetup\x20cancelled'),0x1;const _0x32e740=_0x5a7bcb['apiKey'];console['log'](_0x4de62c(0xcf));try{const _0x350fc7=TDX[_0x4de62c(0xcd)]({'site':_0x5b3350,'apiKey':_0x32e740['trim'](),'logLevel':_0x994dc4[_0x4de62c(0x81)]??LogLevel[_0x4de62c(0x7c)]}),_0x54c0d2=await _0x350fc7[_0x4de62c(0xe3)][_0x4de62c(0xb7)]();console[_0x4de62c(0x78)](a24_0x3548d6[_0x4de62c(0xc5)]('✓')+_0x4de62c(0xa7)+_0x54c0d2[_0x4de62c(0xae)]+')');const _0x12b631=await isKeychainAvailable();_0x12b631?(await saveAPIKeyAsync(_0x32e740[_0x4de62c(0x8d)](),_0x5b3350,_0x278440),console[_0x4de62c(0x78)](a24_0x3548d6[_0x4de62c(0xc5)]('✓')+_0x4de62c(0x9a)+_0x278440+')')):(console[_0x4de62c(0xaf)](a24_0x3548d6[_0x4de62c(0xd6)](_0x4de62c(0xbe))),console[_0x4de62c(0xaf)](a24_0x3548d6['yellow'](_0x4de62c(0xc3))));const _0x471b29={'site':_0x5b3350,..._0xfa853b&&{'description':_0xfa853b}};return saveProfileToUserConfig(_0x278440,_0x471b29),console[_0x4de62c(0x78)](a24_0x3548d6['green']('✓')+_0x4de62c(0x9e)+_0x278440+'\x27\x20created'),console[_0x4de62c(0x78)](),console[_0x4de62c(0x78)](_0x4de62c(0xe7)),console[_0x4de62c(0x78)](_0x4de62c(0xd9)+_0x278440+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log']('\x20\x20tdx\x20--profile\x20'+_0x278440+_0x4de62c(0x88)),0x0;}catch(_0x19196b){if(_0x19196b instanceof HTTPClientError&&_0x19196b[_0x4de62c(0x76)]===0x191)return printAuthError(_0x19196b),0x1;return console[_0x4de62c(0xa2)](a24_0x3548d6['red'](_0x4de62c(0xda)+(_0x19196b instanceof Error?_0x19196b[_0x4de62c(0x96)]:String(_0x19196b)))),console[_0x4de62c(0xa2)](_0x4de62c(0xcc)),0x1;}}}function a24_0x3a2b(){const _0x6baccd=['Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','create','password','Validating\x20API\x20key...','\x0aOperation\x20cancelled','us01','select','\x0aSetup\x20cancelled','us\x20\x20\x20-\x20United\x20States','\x27\x20removed\x20from\x20configuration','yellow','164Kdbhrl','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20tdx\x20--profile\x20','✗\x20Validation\x20failed:\x20','VALID_KEYS','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x0aSaved\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','Enter\x20your\x20TD\x20API\x20key:','\x0aAvailable\x20profiles:','jobs','68210VLKlIe','name','config','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','customSite','profile:use','status','confirm','log','test','API\x20key\x20cannot\x20be\x20empty','296073Nhwwzk','ERROR','length','other','tdx:\x20profile\x20remove','9614600EAJtfI','logLevel','parent_segment','red','Enter\x20custom\x20site','\x27\x20requires\x20API\x20key\x20validation.','\x20--default\x27\x20to\x20save\x20permanently','880806HgoqZQ','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profileName','ap02\x20-\x20Korea','(session:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','trim','Site\x20was\x20not\x20changed.','database','Set\x20a\x20profile\x20configuration\x20value','Enter\x20profile\x20name:','\x27\x20does\x20not\x20exist.','bold','llm_agent','includes','message','Site\x20name\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','session','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','llm_project','toString','validate','\x20Profile\x20\x27','Create\x20a\x20new\x20profile','1661715ufngYX','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','error','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>','site','tdx:\x20profile\x20create','description','\x20API\x20key\x20is\x20valid\x20(User:\x20','Unknown\x20key\x20\x27','Profile\x20\x27','73986EIEBoB','Enter\x20site\x20name:','eu\x20\x20\x20-\x20Europe','tdx.json','email','warn','value','Remove\x20a\x20profile','ap02','/app/mp/ak','apiKey','profile','\x20\x20-\x20','getUserInfo','200LZkFtc','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','jp\x20\x20\x20-\x20Japan','210vcPwLQ','2mpJhyh','Operation\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:set','\x27\x20updated:\x20','join','text','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','green','jp01','execute','2344263ZnWVAE','push','Changing\x20site\x20to\x20\x27','dim'];a24_0x3a2b=function(){return _0x6baccd;};return a24_0x3a2b();}export class ProfileRemoveCommand extends BaseCommand{[a24_0x2dcbcb(0xe5)]='profile:remove';['description']=a24_0x2dcbcb(0xb1);[a24_0x2dcbcb(0x9d)](_0x35e2ea){const _0x579055=a24_0x2dcbcb,{args:_0x3fe1cf}=_0x35e2ea;if(_0x3fe1cf[_0x579055(0x7d)]===0x0)return _0x579055(0xdc);return undefined;}async['execute'](_0x11a0b6){const _0x5edddb=a24_0x2dcbcb,{args:_0x2c1a7f}=_0x11a0b6,_0x2cff5f=_0x2c1a7f[0x0];console['log'](a24_0x3548d6[_0x5edddb(0x93)](_0x5edddb(0x7f)));if(!profileExists(_0x2cff5f)){console[_0x5edddb(0xa2)](a24_0x3548d6[_0x5edddb(0x83)](_0x5edddb(0xa9)+_0x2cff5f+_0x5edddb(0x92))),console[_0x5edddb(0x78)](_0x5edddb(0xe2));const _0x260cd8=listProfiles();if(_0x260cd8[_0x5edddb(0x7d)]===0x0)console[_0x5edddb(0x78)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x7c7c52 of _0x260cd8){console['log'](_0x5edddb(0xb6)+_0x7c7c52[_0x5edddb(0xe5)]);}return 0x1;}const _0x303d82=await a24_0x4f2b85({'type':'confirm','name':_0x5edddb(0x77),'message':_0x5edddb(0xb9)+_0x2cff5f+'\x27?','initial':![]});if(!_0x303d82[_0x5edddb(0x77)])return console[_0x5edddb(0x78)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2cff5f),console['log'](a24_0x3548d6['green']('✓')+_0x5edddb(0x9e)+_0x2cff5f+_0x5edddb(0xd5));}catch(_0x64c54a){return console[_0x5edddb(0xa2)](a24_0x3548d6['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x64c54a instanceof Error?_0x64c54a[_0x5edddb(0x96)]:String(_0x64c54a)))),0x1;}const _0x48a8ab=await isKeychainAvailable();if(_0x48a8ab){const _0x38b78e=await deleteKeychainAPIKey(_0x2cff5f);_0x38b78e&&console['log'](a24_0x3548d6[_0x5edddb(0xc5)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x2dcbcb(0xe5)]=a24_0x2dcbcb(0xbf);['description']=a24_0x2dcbcb(0x90);static [a24_0x2dcbcb(0xdb)]=[a24_0x2dcbcb(0xa4),a24_0x2dcbcb(0x8f),a24_0x2dcbcb(0x82),a24_0x2dcbcb(0x9b),a24_0x2dcbcb(0x94),'description'];['validate'](_0x35fdb2){const _0x39bb25=a24_0x2dcbcb,{args:_0x3158d6,options:_0x10c48b}=_0x35fdb2,_0x29b897=_0x10c48b[_0x39bb25(0xb5)]||getActiveProfile();if(!_0x29b897)return _0x39bb25(0xa3);if(_0x3158d6[_0x39bb25(0x7d)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x39bb25(0xdb)]['join'](',\x20');const _0x28cad3=_0x3158d6[0x0];if(!_0x28cad3[_0x39bb25(0x95)]('='))return _0x39bb25(0xc4)+ProfileSetCommand[_0x39bb25(0xdb)][_0x39bb25(0xc1)](',\x20');const [_0x44d42c]=_0x28cad3['split']('=',0x2);if(!ProfileSetCommand[_0x39bb25(0xdb)]['includes'](_0x44d42c))return _0x39bb25(0xa8)+_0x44d42c+_0x39bb25(0xde)+ProfileSetCommand[_0x39bb25(0xdb)][_0x39bb25(0xc1)](',\x20');return undefined;}async['execute'](_0x148b0a){const _0x254749=a24_0x2dcbcb,{args:_0xcbca89,options:_0xd4212a}=_0x148b0a,_0x532cd6=_0xd4212a[_0x254749(0xb5)]||getActiveProfile(),[_0x50d651,..._0x234123]=_0xcbca89[0x0]['split']('='),_0x572cf8=_0x234123[_0x254749(0xc1)]('=');console['log'](a24_0x3548d6[_0x254749(0x93)]('tdx:\x20profile\x20set'));if(!profileExists(_0x532cd6)){const _0x1e9de6=await a24_0x4f2b85({'type':'confirm','name':'create','message':_0x254749(0xa9)+_0x532cd6+_0x254749(0xdf),'initial':!![]});if(!_0x1e9de6[_0x254749(0xcd)])return console[_0x254749(0x78)](_0x254749(0xbd)),0x1;}const _0x1958ee=loadProfile(_0x532cd6),_0x1f925c=_0x1958ee?.[_0x254749(0xe6)]||{};if(_0x50d651===_0x254749(0xa4)){const _0x250b9c=resolveSite(_0x572cf8);console['log'](_0x254749(0xca)+_0x250b9c+_0x254749(0x85)),console['log'](_0x254749(0xa1)),console['log']('\x20\x20'+getConsoleUrl(_0x250b9c,_0x254749(0xb3)));const _0x73e71f=await a24_0x4f2b85({'type':'password','name':'apiKey','message':_0x254749(0xd8),'validate':_0x77b333=>{const _0x3c38c6=_0x254749;if(!_0x77b333||!_0x77b333['trim']())return _0x3c38c6(0x7a);return!![];}});if(!_0x73e71f['apiKey'])return console['log'](_0x254749(0xd0)),0x1;console[_0x254749(0x78)](_0x254749(0xcf));try{const _0x59a159=TDX['create']({'site':_0x250b9c,'apiKey':_0x73e71f[_0x254749(0xb4)][_0x254749(0x8d)](),'logLevel':_0xd4212a[_0x254749(0x81)]??LogLevel[_0x254749(0x7c)]}),_0x1c4e9c=await _0x59a159[_0x254749(0xe3)][_0x254749(0xb7)]();console[_0x254749(0x78)](a24_0x3548d6[_0x254749(0xc5)]('✓')+_0x254749(0xa7)+_0x1c4e9c['email']+')');const _0xa82300=await isKeychainAvailable();_0xa82300?(await saveAPIKeyAsync(_0x73e71f['apiKey'][_0x254749(0x8d)](),_0x250b9c,_0x532cd6),console[_0x254749(0x78)](a24_0x3548d6[_0x254749(0xc5)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x254749(0xaf)](a24_0x3548d6[_0x254749(0xd6)](_0x254749(0xbe))),_0x1f925c[_0x254749(0xa4)]=_0x250b9c;}catch(_0x2ea3fa){if(_0x2ea3fa instanceof HTTPClientError&&_0x2ea3fa[_0x254749(0x76)]===0x191)return printAuthError(_0x2ea3fa),0x1;return console[_0x254749(0xa2)](a24_0x3548d6[_0x254749(0x83)](_0x254749(0xda)+(_0x2ea3fa instanceof Error?_0x2ea3fa[_0x254749(0x96)]:String(_0x2ea3fa)))),console['error'](_0x254749(0x8e)),0x1;}}else _0x1f925c[_0x50d651]=_0x572cf8||undefined;return saveProfileToUserConfig(_0x532cd6,_0x1f925c),console[_0x254749(0x78)](a24_0x3548d6[_0x254749(0xc5)]('✓')+_0x254749(0x9e)+_0x532cd6+_0x254749(0xc0)+_0x50d651+'='+(_0x572cf8||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x2dcbcb(0xe5)]=a24_0x2dcbcb(0x75);[a24_0x2dcbcb(0xa6)]='Set\x20session\x20profile';['validate'](_0x33ef51){const _0x1a8732=a24_0x2dcbcb,{args:_0x7a1909}=_0x33ef51;if(_0x7a1909[_0x1a8732(0x7d)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x4512ab){const _0x15cd1f=a24_0x2dcbcb,{args:_0x80b0b5,options:_0x5d8604}=_0x4512ab,_0x43a6b1=_0x80b0b5[0x0],_0x244eb2=_0x5d8604['default'];cleanExpiredSessions();if(!profileExists(_0x43a6b1)){console[_0x15cd1f(0xa2)](a24_0x3548d6[_0x15cd1f(0x83)](_0x15cd1f(0xa9)+_0x43a6b1+_0x15cd1f(0x92))),console[_0x15cd1f(0x78)]('\x0aAvailable\x20profiles:');const _0x1f0ee1=listProfiles();if(_0x1f0ee1[_0x15cd1f(0x7d)]===0x0)console[_0x15cd1f(0x78)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x411fe7 of _0x1f0ee1){console[_0x15cd1f(0x78)](_0x15cd1f(0xb6)+_0x411fe7[_0x15cd1f(0xe5)]);}return 0x1;}if(_0x244eb2){const _0x394edc=a24_0x1aa95a[_0x15cd1f(0xc1)](getConfigDir(),_0x15cd1f(0xad));return saveActiveProfileToUserConfig(_0x43a6b1),console[_0x15cd1f(0x78)]('Default\x20profile\x20set\x20to:\x20'+a24_0x3548d6['green'](_0x43a6b1)),console['log'](a24_0x3548d6[_0x15cd1f(0xcb)](_0x15cd1f(0xdd)+_0x394edc)),0x0;}const _0x33e378=_0x5d8604[_0x15cd1f(0x99)]||getCurrentSessionPID()[_0x15cd1f(0x9c)]();return saveSessionContext({'profile':_0x43a6b1},_0x5d8604['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x3548d6[_0x15cd1f(0xc5)](_0x43a6b1)+'\x20'+a24_0x3548d6['dim'](_0x15cd1f(0x8b)+_0x33e378+')')),console['log'](a24_0x3548d6['dim'](_0x15cd1f(0xe8)+_0x43a6b1+_0x15cd1f(0x86))),0x0;}}
|
|
1
|
+
const a24_0x5aa101=a24_0x4b8f;(function(_0x5497a1,_0x2bb0c3){const _0xd0befd=a24_0x4b8f,_0x335db2=_0x5497a1();while(!![]){try{const _0x7bc73d=-parseInt(_0xd0befd(0xf7))/0x1*(parseInt(_0xd0befd(0x116))/0x2)+-parseInt(_0xd0befd(0x108))/0x3+-parseInt(_0xd0befd(0xfd))/0x4+parseInt(_0xd0befd(0x129))/0x5*(parseInt(_0xd0befd(0x101))/0x6)+-parseInt(_0xd0befd(0x10e))/0x7*(-parseInt(_0xd0befd(0x118))/0x8)+-parseInt(_0xd0befd(0x149))/0x9+parseInt(_0xd0befd(0x143))/0xa;if(_0x7bc73d===_0x2bb0c3)break;else _0x335db2['push'](_0x335db2['shift']());}catch(_0x3e6738){_0x335db2['push'](_0x335db2['shift']());}}}(a24_0x58d3,0x34bcd));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_0x142e8f from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x58d3(){const _0x1fe2aa=['jobs','Enter\x20custom\x20site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile:remove','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','\x0aAvailable\x20profiles:','customSite','(cleared)','tdx.json','green','(session:\x20','validate','toString','default','profileName','404sPtmDt','ERROR','Removal\x20cancelled','Site\x20was\x20not\x20changed.','profile:use','confirm','1709448mUdcnR','warn','llm_project','✗\x20Validation\x20failed:\x20','2387322gjFJvO','Create\x20a\x20new\x20profile','error','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','test','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','871548TmPCIy','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','61355ZCNTCW','\x20Profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','VALID_KEYS','\x27\x20updated:\x20','1906yMAkaI','\x0aOperation\x20cancelled','8sCGqJt','Unknown\x20key\x20\x27','API\x20key\x20cannot\x20be\x20empty','red','\x20\x20-\x20','jp01','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','yellow','profile:set','select','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','message','email','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','value','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','5gzeXel','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20remove','bold','ap02\x20-\x20Korea','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20profile\x20name:','\x27\x20created','\x20API\x20key\x20is\x20valid\x20(User:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSetup\x20cancelled','tdx:\x20profile\x20create','text','name','profile','password','findIndex','Set\x20session\x20profile','us01','Enter\x20site\x20name:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','create','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','database','site','10893150OYdevK','getUserInfo','status','push','\x0aSaved\x20to:\x20','join','1593576aPforP','split','session','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Session\x20profile\x20set\x20to:\x20','includes','trim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','length','eu\x20\x20\x20-\x20Europe','log','apiKey','logLevel','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','other','Validating\x20API\x20key...'];a24_0x58d3=function(){return _0x1fe2aa;};return a24_0x58d3();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x3c204d from'prompts';import a24_0x2a13d2 from'chalk';function a24_0x4b8f(_0x4eb622,_0x38ec32){_0x4eb622=_0x4eb622-0xe8;const _0x58d37a=a24_0x58d3();let _0x4b8f6c=_0x58d37a[_0x4eb622];return _0x4b8f6c;}function validateProfileName(_0x11967c){const _0x4e5098=a24_0x4b8f;if(!_0x11967c||!_0x11967c[_0x4e5098(0x14f)]())return _0x4e5098(0x12f);const _0x305cf3=_0x11967c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x4e5098(0x106)](_0x305cf3))return _0x4e5098(0xe9);if(profileExists(_0x305cf3))return'Profile\x20\x27'+_0x305cf3+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a24_0x5aa101(0x126);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x102);async[a24_0x5aa101(0x112)](_0x23e958){const _0x57b087=a24_0x5aa101,{options:_0x5e70fa,args:_0x5f3514}=_0x23e958;console['log'](a24_0x2a13d2[_0x57b087(0x12c)](_0x57b087(0x135)));let _0x3a73b6;if(_0x5f3514[_0x57b087(0x151)]>0x0&&_0x5f3514[0x0]){const _0x4b6a07=_0x5f3514[0x0][_0x57b087(0x14f)](),_0xa66a2=validateProfileName(_0x4b6a07);if(_0xa66a2!==!![])return console[_0x57b087(0x103)](a24_0x2a13d2['red'](_0xa66a2)),0x1;_0x3a73b6=_0x4b6a07;}else{const _0x4ee62d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xf6),'message':_0x57b087(0x130),'validate':validateProfileName});if(!_0x4ee62d[_0x57b087(0xf6)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x3a73b6=_0x4ee62d[_0x57b087(0xf6)][_0x57b087(0x14f)]();}const _0x417d1d=await a24_0x3c204d({'type':_0x57b087(0x136),'name':_0x57b087(0xea),'message':'Enter\x20description\x20(optional):'}),_0x37db67=_0x417d1d['description']?.[_0x57b087(0x14f)]()||undefined,_0x1c2a73=_0x5e70fa[_0x57b087(0x142)]||_0x57b087(0x13c),_0x2120e8=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x57b087(0x13c)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x57b087(0x11d)},{'title':_0x57b087(0x152),'value':'eu01'},{'title':_0x57b087(0x12d),'value':'ap02'}];let _0x52fd9d=_0x2120e8[_0x57b087(0x13a)](_0x2b835c=>_0x2b835c[_0x57b087(0x127)]===_0x1c2a73);_0x52fd9d===-0x1&&_0x1c2a73!=='us01'&&(_0x2120e8[_0x57b087(0x146)]({'title':_0x1c2a73,'value':_0x1c2a73}),_0x52fd9d=_0x2120e8['length']-0x1);_0x2120e8[_0x57b087(0x146)]({'title':_0x57b087(0x15a),'value':_0x57b087(0x157)});const _0x5d9ff3=await a24_0x3c204d({'type':_0x57b087(0x121),'name':'site','message':_0x57b087(0x13e)+_0x3a73b6+'\x27:','choices':_0x2120e8,'initial':_0x52fd9d>=0x0?_0x52fd9d:0x0});if(!_0x5d9ff3[_0x57b087(0x142)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;let _0x53737a;if(_0x5d9ff3['site']===_0x57b087(0x157)){const _0x322092=await a24_0x3c204d({'type':_0x57b087(0x136),'name':'customSite','message':_0x57b087(0x13d),'initial':_0x57b087(0x13c),'validate':_0x5292d2=>{const _0x5c8d60=_0x57b087;if(!_0x5292d2||!_0x5292d2['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x5292d2[_0x5c8d60(0x14f)]()))return _0x5c8d60(0x15d);return!![];}});if(!_0x322092[_0x57b087(0xee)])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;_0x53737a=_0x322092[_0x57b087(0xee)];}else _0x53737a=_0x5d9ff3[_0x57b087(0x142)];const _0x1c5f85=resolveSite(_0x53737a);console[_0x57b087(0x153)](_0x57b087(0x128)+_0x1c5f85),console[_0x57b087(0x153)](_0x57b087(0x109)),console['log']('\x20\x20'+getConsoleUrl(_0x1c5f85,'/app/mp/ak'));const _0x53fb92=await a24_0x3c204d({'type':'password','name':_0x57b087(0x154),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x58d8e8=>{const _0x52f8c1=_0x57b087;if(!_0x58d8e8||!_0x58d8e8[_0x52f8c1(0x14f)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x53fb92['apiKey'])return console[_0x57b087(0x153)](_0x57b087(0x134)),0x1;const _0x30a5a3=_0x53fb92['apiKey'];console['log'](_0x57b087(0x158));try{const _0x3f9185=TDX['create']({'site':_0x1c5f85,'apiKey':_0x30a5a3[_0x57b087(0x14f)](),'logLevel':_0x5e70fa[_0x57b087(0x155)]??LogLevel[_0x57b087(0xf8)]}),_0xc5ccdf=await _0x3f9185['jobs'][_0x57b087(0x144)]();console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x132)+_0xc5ccdf[_0x57b087(0x124)]+')');const _0x299734=await isKeychainAvailable();_0x299734?(await saveAPIKeyAsync(_0x30a5a3[_0x57b087(0x14f)](),_0x1c5f85,_0x3a73b6),console['log'](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3a73b6+')')):(console[_0x57b087(0xfe)](a24_0x2a13d2['yellow'](_0x57b087(0x140))),console['warn'](a24_0x2a13d2[_0x57b087(0x11f)](_0x57b087(0x15b))));const _0x1f3a93={'site':_0x1c5f85,..._0x37db67&&{'description':_0x37db67}};return saveProfileToUserConfig(_0x3a73b6,_0x1f3a93),console[_0x57b087(0x153)](a24_0x2a13d2[_0x57b087(0xf1)]('✓')+_0x57b087(0x10f)+_0x3a73b6+_0x57b087(0x131)),console[_0x57b087(0x153)](),console[_0x57b087(0x153)](_0x57b087(0x122)),console[_0x57b087(0x153)](_0x57b087(0x110)+_0x3a73b6+_0x57b087(0x111)),console[_0x57b087(0x153)]('\x20\x20tdx\x20--profile\x20'+_0x3a73b6+_0x57b087(0x156)),0x0;}catch(_0xc4770){if(_0xc4770 instanceof HTTPClientError&&_0xc4770[_0x57b087(0x145)]===0x191)return printAuthError(_0xc4770),0x1;return console['error'](a24_0x2a13d2[_0x57b087(0x11b)](_0x57b087(0x100)+(_0xc4770 instanceof Error?_0xc4770[_0x57b087(0x123)]:String(_0xc4770)))),console[_0x57b087(0x103)](_0x57b087(0x113)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x5aa101(0xe8);['description']=a24_0x5aa101(0x105);['validate'](_0x107ecf){const _0x282e9e=a24_0x5aa101,{args:_0x1d6ff5}=_0x107ecf;if(_0x1d6ff5['length']===0x0)return _0x282e9e(0x15c);return undefined;}async[a24_0x5aa101(0x112)](_0x1d0f38){const _0x317156=a24_0x5aa101,{args:_0x3d10c3}=_0x1d0f38,_0xae82e9=_0x3d10c3[0x0];console['log'](a24_0x2a13d2[_0x317156(0x12c)](_0x317156(0x12b)));if(!profileExists(_0xae82e9)){console['error'](a24_0x2a13d2[_0x317156(0x11b)](_0x317156(0x10d)+_0xae82e9+'\x27\x20does\x20not\x20exist.')),console['log'](_0x317156(0xed));const _0x54ec68=listProfiles();if(_0x54ec68[_0x317156(0x151)]===0x0)console[_0x317156(0x153)](_0x317156(0x10a));else for(const _0x5c7a2a of _0x54ec68){console[_0x317156(0x153)](_0x317156(0x11c)+_0x5c7a2a[_0x317156(0x137)]);}return 0x1;}const _0x14e7a6=await a24_0x3c204d({'type':'confirm','name':_0x317156(0xfc),'message':_0x317156(0x11e)+_0xae82e9+'\x27?','initial':![]});if(!_0x14e7a6['confirm'])return console[_0x317156(0x153)](_0x317156(0xf9)),0x0;try{removeProfileFromUserConfig(_0xae82e9),console[_0x317156(0x153)](a24_0x2a13d2['green']('✓')+'\x20Profile\x20\x27'+_0xae82e9+'\x27\x20removed\x20from\x20configuration');}catch(_0x19881b){return console[_0x317156(0x103)](a24_0x2a13d2['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x19881b instanceof Error?_0x19881b[_0x317156(0x123)]:String(_0x19881b)))),0x1;}const _0x1f1487=await isKeychainAvailable();if(_0x1f1487){const _0x2406ee=await deleteKeychainAPIKey(_0xae82e9);_0x2406ee&&console[_0x317156(0x153)](a24_0x2a13d2[_0x317156(0xf1)]('✓')+_0x317156(0xeb));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a24_0x5aa101(0x120);[a24_0x5aa101(0xea)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a24_0x5aa101(0x142),a24_0x5aa101(0x141),'parent_segment',a24_0x5aa101(0xff),'llm_agent',a24_0x5aa101(0xea)];[a24_0x5aa101(0xf3)](_0x284cfd){const _0x956da7=a24_0x5aa101,{args:_0x51b3ee,options:_0x1018c5}=_0x284cfd,_0x5dae60=_0x1018c5['profile']||getActiveProfile();if(!_0x5dae60)return _0x956da7(0x14c);if(_0x51b3ee[_0x956da7(0x151)]===0x0)return _0x956da7(0x104)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const _0x13bb94=_0x51b3ee[0x0];if(!_0x13bb94[_0x956da7(0x14e)]('='))return _0x956da7(0x12a)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');const [_0xf4d4d1]=_0x13bb94[_0x956da7(0x14a)]('=',0x2);if(!ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x14e)](_0xf4d4d1))return _0x956da7(0x119)+_0xf4d4d1+_0x956da7(0x10b)+ProfileSetCommand[_0x956da7(0x114)][_0x956da7(0x148)](',\x20');return undefined;}async['execute'](_0x2fcb25){const _0x48870b=a24_0x5aa101,{args:_0x20ef05,options:_0x24e7f4}=_0x2fcb25,_0x1cbe69=_0x24e7f4[_0x48870b(0x138)]||getActiveProfile(),[_0x584c3e,..._0x425abc]=_0x20ef05[0x0][_0x48870b(0x14a)]('='),_0x5ceef4=_0x425abc[_0x48870b(0x148)]('=');console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0x12c)]('tdx:\x20profile\x20set'));if(!profileExists(_0x1cbe69)){const _0x25ac28=await a24_0x3c204d({'type':_0x48870b(0xfc),'name':_0x48870b(0x13f),'message':_0x48870b(0x10d)+_0x1cbe69+_0x48870b(0x125),'initial':!![]});if(!_0x25ac28[_0x48870b(0x13f)])return console[_0x48870b(0x153)]('Operation\x20cancelled'),0x1;}const _0x56816e=loadProfile(_0x1cbe69),_0x135875=_0x56816e?.['config']||{};if(_0x584c3e===_0x48870b(0x142)){const _0x453129=resolveSite(_0x5ceef4);console[_0x48870b(0x153)]('Changing\x20site\x20to\x20\x27'+_0x453129+_0x48870b(0x12e)),console['log'](_0x48870b(0x10c)),console[_0x48870b(0x153)]('\x20\x20'+getConsoleUrl(_0x453129,'/app/mp/ak'));const _0xa6097f=await a24_0x3c204d({'type':_0x48870b(0x139),'name':'apiKey','message':_0x48870b(0x133),'validate':_0x55842c=>{const _0x294f02=_0x48870b;if(!_0x55842c||!_0x55842c[_0x294f02(0x14f)]())return _0x294f02(0x11a);return!![];}});if(!_0xa6097f['apiKey'])return console['log'](_0x48870b(0x117)),0x1;console[_0x48870b(0x153)](_0x48870b(0x158));try{const _0x5ed27a=TDX[_0x48870b(0x13f)]({'site':_0x453129,'apiKey':_0xa6097f[_0x48870b(0x154)][_0x48870b(0x14f)](),'logLevel':_0x24e7f4[_0x48870b(0x155)]??LogLevel[_0x48870b(0xf8)]}),_0x4974fa=await _0x5ed27a[_0x48870b(0x159)][_0x48870b(0x144)]();console[_0x48870b(0x153)](a24_0x2a13d2['green']('✓')+_0x48870b(0x132)+_0x4974fa[_0x48870b(0x124)]+')');const _0x932b2e=await isKeychainAvailable();_0x932b2e?(await saveAPIKeyAsync(_0xa6097f['apiKey'][_0x48870b(0x14f)](),_0x453129,_0x1cbe69),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+_0x48870b(0x150))):console['warn'](a24_0x2a13d2['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x135875[_0x48870b(0x142)]=_0x453129;}catch(_0x58e249){if(_0x58e249 instanceof HTTPClientError&&_0x58e249[_0x48870b(0x145)]===0x191)return printAuthError(_0x58e249),0x1;return console[_0x48870b(0x103)](a24_0x2a13d2['red'](_0x48870b(0x100)+(_0x58e249 instanceof Error?_0x58e249[_0x48870b(0x123)]:String(_0x58e249)))),console[_0x48870b(0x103)](_0x48870b(0xfa)),0x1;}}else _0x135875[_0x584c3e]=_0x5ceef4||undefined;return saveProfileToUserConfig(_0x1cbe69,_0x135875),console[_0x48870b(0x153)](a24_0x2a13d2[_0x48870b(0xf1)]('✓')+'\x20Profile\x20\x27'+_0x1cbe69+_0x48870b(0x115)+_0x584c3e+'='+(_0x5ceef4||_0x48870b(0xef))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x5aa101(0x137)]=a24_0x5aa101(0xfb);[a24_0x5aa101(0xea)]=a24_0x5aa101(0x13b);[a24_0x5aa101(0xf3)](_0x21185c){const _0x579893=a24_0x5aa101,{args:_0x1b61b8}=_0x21185c;if(_0x1b61b8['length']===0x0)return _0x579893(0x107);return undefined;}async[a24_0x5aa101(0x112)](_0x4e345b){const _0x3ea510=a24_0x5aa101,{args:_0x95c4e3,options:_0xb779f6}=_0x4e345b,_0x1b3e6a=_0x95c4e3[0x0],_0x3e8937=_0xb779f6[_0x3ea510(0xf5)];cleanExpiredSessions();if(!profileExists(_0x1b3e6a)){console['error'](a24_0x2a13d2[_0x3ea510(0x11b)](_0x3ea510(0x10d)+_0x1b3e6a+'\x27\x20does\x20not\x20exist.')),console['log']('\x0aAvailable\x20profiles:');const _0x45c291=listProfiles();if(_0x45c291[_0x3ea510(0x151)]===0x0)console[_0x3ea510(0x153)](_0x3ea510(0x10a));else for(const _0x43b268 of _0x45c291){console['log'](_0x3ea510(0x11c)+_0x43b268[_0x3ea510(0x137)]);}return 0x1;}if(_0x3e8937){const _0x53eccd=a24_0x142e8f[_0x3ea510(0x148)](getConfigDir(),_0x3ea510(0xf0));return saveActiveProfileToUserConfig(_0x1b3e6a),console[_0x3ea510(0x153)](_0x3ea510(0xec)+a24_0x2a13d2['green'](_0x1b3e6a)),console['log'](a24_0x2a13d2['dim'](_0x3ea510(0x147)+_0x53eccd)),0x0;}const _0x42744a=_0xb779f6[_0x3ea510(0x14b)]||getCurrentSessionPID()[_0x3ea510(0xf4)]();return saveSessionContext({'profile':_0x1b3e6a},_0xb779f6[_0x3ea510(0x14b)]),console[_0x3ea510(0x153)](_0x3ea510(0x14d)+a24_0x2a13d2[_0x3ea510(0xf1)](_0x1b3e6a)+'\x20'+a24_0x2a13d2['dim'](_0x3ea510(0xf2)+_0x42744a+')')),console[_0x3ea510(0x153)](a24_0x2a13d2['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x1b3e6a+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a25_0x18aa(){const _0x858917=['error','843055DTtjJl','10717xUxepA','548408tysRsR','execute','description','302215HQgfEt','message','profiles','name','2006152RDopLT','2432kwrfaH','map','Error:\x20','449847GWkBVk','log','config','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2278794EIuzQP'];a25_0x18aa=function(){return _0x858917;};return a25_0x18aa();}const a25_0x16e5a5=a25_0x1129;(function(_0x45f223,_0x1f9d0b){const _0x875c76=a25_0x1129,_0x4eee92=_0x45f223();while(!![]){try{const _0x13184f=parseInt(_0x875c76(0x19e))/0x1+parseInt(_0x875c76(0x1ae))/0x2+-parseInt(_0x875c76(0x1a6))/0x3+parseInt(_0x875c76(0x1a2))/0x4+parseInt(_0x875c76(0x1ac))/0x5+-parseInt(_0x875c76(0x1aa))/0x6+parseInt(_0x875c76(0x1ad))/0x7*(-parseInt(_0x875c76(0x1a3))/0x8);if(_0x13184f===_0x1f9d0b)break;else _0x4eee92['push'](_0x4eee92['shift']());}catch(_0x1b90b7){_0x4eee92['push'](_0x4eee92['shift']());}}}(a25_0x18aa,0x3d604));function a25_0x1129(_0x133a56,_0x12cec8){_0x133a56=_0x133a56-0x19e;const _0x18aae1=a25_0x18aa();let _0x1129e9=_0x18aae1[_0x133a56];return _0x1129e9;}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_0x16e5a5(0x1a1)]=a25_0x16e5a5(0x1a0);[a25_0x16e5a5(0x1b0)]='List\x20all\x20available\x20profiles';async[a25_0x16e5a5(0x1af)](_0xf9a84d){const _0x115cb1=a25_0x16e5a5,{options:_0x50f0e9}=_0xf9a84d;try{const _0x44b2c9=listProfiles(),_0x392e8c=getActiveProfile();if(_0x44b2c9['length']===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x115cb1(0x1a7)](_0x115cb1(0x1a9)),console[_0x115cb1(0x1a7)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x3a2e49=_0x44b2c9[_0x115cb1(0x1a4)](_0x2b19fc=>{const _0x57a723=_0x115cb1,_0x5e5c97=_0x2b19fc[_0x57a723(0x1a1)]===_0x392e8c,_0x5cfd70=getProfileParams(_0x2b19fc['config']);return{'name':_0x2b19fc['name'],'active':_0x5e5c97,'scope':_0x2b19fc['scope'],'description':_0x2b19fc[_0x57a723(0x1a8)][_0x57a723(0x1b0)]||'','params':_0x5cfd70};});return await handleSDKOutput(_0x3a2e49,_0x50f0e9),0x0;}catch(_0x4ec6fa){return _0x4ec6fa instanceof Error&&console[_0x115cb1(0x1ab)](_0x115cb1(0x1a5)+_0x4ec6fa[_0x115cb1(0x19f)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a26_0x1b370e=a26_0x443d;(function(_0x35e0fc,_0x21cd85){const _0x507ed4=a26_0x443d,_0x362352=_0x35e0fc();while(!![]){try{const _0xea94de=parseInt(_0x507ed4(0x121))/0x1*(parseInt(_0x507ed4(0x128))/0x2)+-parseInt(_0x507ed4(0x132))/0x3+-parseInt(_0x507ed4(0x109))/0x4+-parseInt(_0x507ed4(0x123))/0x5*(parseInt(_0x507ed4(0x126))/0x6)+parseInt(_0x507ed4(0x101))/0x7*(parseInt(_0x507ed4(0x11f))/0x8)+parseInt(_0x507ed4(0x122))/0x9+-parseInt(_0x507ed4(0x115))/0xa*(-parseInt(_0x507ed4(0x130))/0xb);if(_0xea94de===_0x21cd85)break;else _0x362352['push'](_0x362352['shift']());}catch(_0x2bdbae){_0x362352['push'](_0x362352['shift']());}}}(a26_0x3c97,0xac3ce));import{BaseCommand}from'./command.js';function a26_0x3c97(){const _0x29d4fa=['validate','totalSplits','8634cfZalm','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','6hrgMIi','error','\x0aAll\x20results\x20saved\x20to\x20','information_schema','completedSplits','Executing\x20query\x20[','processedRows','SQL:\x20','16159XPFPqO','\x20rows\x20','3745950gkHQOC','stats','data','81893HozVMD','verbose','setExtra','database','output','join','originalMessage','message','2056196SNfGms','jobId','Site:\x20','options','\x20[Job\x20ID:\x20','setPhase','Error:\x20','Executing\x20statement\x20','Executing\x20query...','...','Statement\x20','site','12020dzUKGI','Run\x20Trino\x20queries\x20(streaming)','description','length','push','query','catalog','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20-\x20','execute','824SWKmuY','in\x20','127685elRMML','2118384kUWOEA','3895rYXulQ'];a26_0x3c97=function(){return _0x29d4fa;};return a26_0x3c97();}import{SDKError}from'../sdk/index.js';function a26_0x443d(_0x32db43,_0x5b3350){_0x32db43=_0x32db43-0xff;const _0x3c976d=a26_0x3c97();let _0x443d57=_0x3c976d[_0x32db43];return _0x443d57;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a26_0x1b370e(0x11a);[a26_0x1b370e(0x117)]=a26_0x1b370e(0x116);async['execute'](_0x39547d){const _0x4300db=a26_0x1b370e,{options:_0x1a6bef,args:_0x271577,tdx:_0x1166d2}=_0x39547d,_0x36420a=_0x271577[0x0],_0x581fb5=_0x1a6bef['file'];let _0x139ced;try{if(_0x581fb5)_0x139ced=readSqlStatementsFromFile(_0x581fb5);else{if(_0x36420a==='-')_0x139ced=await readSqlStatementsFromStdin();else{if(_0x36420a&&isSqlFilePath(_0x36420a))_0x139ced=readSqlStatementsFromFile(_0x36420a);else{if(_0x36420a)_0x139ced=splitSqlStatements(_0x36420a);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3594bf){return console[_0x4300db(0x129)](_0x4300db(0x10f)+_0x3594bf['message']),0x1;}const _0x564e00=_0x1a6bef[_0x4300db(0x104)]||_0x4300db(0x12b),_0x398c3d=_0x1a6bef[_0x4300db(0x11b)];try{const _0x1c64a4=[],_0x1ed2ea=!!_0x1a6bef[_0x4300db(0x105)];for(let _0x44d5c0=0x0;_0x44d5c0<_0x139ced[_0x4300db(0x118)];_0x44d5c0++){const _0x480e59=_0x139ced[_0x44d5c0],_0x5a6bdc=_0x44d5c0+0x1,_0x50bbd0=_0x139ced[_0x4300db(0x118)],_0x45f9a7=_0x50bbd0>0x1;_0x1a6bef[_0x4300db(0x102)]&&(console['error']('\x0a'+(_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':':'')),console[_0x4300db(0x129)](_0x4300db(0x10b)+_0x1a6bef[_0x4300db(0x114)]),console['error']('Catalog:\x20'+(_0x398c3d||'td')),console[_0x4300db(0x129)]('Schema:\x20'+_0x564e00),console[_0x4300db(0x129)](_0x4300db(0x12f)+_0x480e59));const _0x5e052c=_0x45f9a7?_0x4300db(0x110)+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x112):_0x4300db(0x111);try{const _0x54ce96=await withProgressSpinner(_0x5e052c,async _0x369e8e=>{const _0x5da0d7=_0x4300db,_0x39801e=await _0x1166d2['query'][_0x5da0d7(0x11e)](_0x480e59,{'catalog':_0x398c3d,'schema':_0x564e00,'onJobId':_0x871de1=>{_0x369e8e['setJobId'](_0x871de1);},'onProgress':_0x43c6e4=>{const _0x53543c=_0x5da0d7;_0x369e8e[_0x53543c(0x10e)](_0x53543c(0x12d)+_0x43c6e4['state']+']'),_0x369e8e[_0x53543c(0x103)](formatRows(_0x43c6e4[_0x53543c(0x12e)])+_0x53543c(0x131)+_0x43c6e4[_0x53543c(0x12c)]+'/'+_0x43c6e4[_0x53543c(0x125)]+'\x20splits');}});return _0x39801e;},{'verbose':_0x1a6bef[_0x4300db(0x102)]}),_0x42efdf=_0x54ce96[_0x4300db(0x100)],_0x2ca288=_0x42efdf[_0x4300db(0x10a)]?_0x4300db(0x10d)+_0x42efdf['jobId']+']':'',_0x68bda8=_0x45f9a7?'Statement\x20'+_0x5a6bdc+'/'+_0x50bbd0+_0x4300db(0x11d):'';console['error']('✔\x20'+_0x68bda8+'Query\x20completed:\x20Processed\x20'+formatRows(_0x42efdf[_0x4300db(0xff)]['processedRows'])+_0x4300db(0x131)+(_0x4300db(0x120)+formatElapsed(_0x42efdf[_0x4300db(0xff)]['elapsedTimeMillis'])+_0x2ca288));if(_0x45f9a7&&_0x1ed2ea){const _0x42fe49=resolveOutputOptions(_0x1a6bef),_0x4980e6=await formatQueryOutput(_0x42efdf,_0x42fe49);_0x1c64a4[_0x4300db(0x119)](_0x4980e6);}else await handleQueryOutput(_0x42efdf,_0x1a6bef);}catch(_0x425b2e){const _0x37330b=_0x45f9a7?_0x4300db(0x113)+_0x5a6bdc+'/'+_0x50bbd0+':\x0a':'',_0x5d71d0=_0x425b2e instanceof SDKError?_0x425b2e[_0x4300db(0x107)]:_0x425b2e[_0x4300db(0x108)];return console['error'](''+_0x37330b+_0x5d71d0),0x1;}}if(_0x139ced[_0x4300db(0x118)]>0x1&&_0x1ed2ea&&_0x1c64a4[_0x4300db(0x118)]>0x0){const _0x2f993b=_0x1c64a4[_0x4300db(0x106)]('\x0a');writeFileSync(_0x1a6bef[_0x4300db(0x105)],_0x2f993b),console[_0x4300db(0x129)](_0x4300db(0x12a)+_0x1a6bef[_0x4300db(0x105)]);}return 0x0;}catch(_0x3bffea){throw _0x3bffea;}}[a26_0x1b370e(0x124)](_0x5562a9){const _0xf5faa6=a26_0x1b370e,_0x2f320c=_0x5562a9['args'][0x0],_0x303f64=_0x5562a9[_0xf5faa6(0x10c)]['file'];if(!_0x2f320c&&!_0x303f64)return _0xf5faa6(0x127);if(_0x2f320c&&_0x303f64)return _0xf5faa6(0x11c);return undefined;}}
|