@treasuredata/tdx 0.16.0 → 0.16.2
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.d.ts +19 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/claude-agent/types.d.ts +26 -0
- package/dist/sdk/claude-agent/types.d.ts.map +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_0x277f3c=a23_0x31ab;(function(_0x4fe195,_0x496ce4){const _0x101050=a23_0x31ab,_0x17277e=_0x4fe195();while(!![]){try{const _0x566d80=-parseInt(_0x101050(0x1fe))/0x1+parseInt(_0x101050(0x1ec))/0x2*(-parseInt(_0x101050(0x259))/0x3)+parseInt(_0x101050(0x24e))/0x4*(-parseInt(_0x101050(0x1d1))/0x5)+parseInt(_0x101050(0x2c5))/0x6+-parseInt(_0x101050(0x2e1))/0x7*(parseInt(_0x101050(0x201))/0x8)+parseInt(_0x101050(0x2b5))/0x9*(-parseInt(_0x101050(0x29e))/0xa)+parseInt(_0x101050(0x2f5))/0xb;if(_0x566d80===_0x496ce4)break;else _0x17277e['push'](_0x17277e['shift']());}catch(_0x125bad){_0x17277e['push'](_0x17277e['shift']());}}}(a23_0x1c37,0x4c7c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x52e31e 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_0x3b54b8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x1c37(){const _0x11c654=['parent_segment','\x20\x20\x20\x20-\x20','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','message','✔\x20No\x20changes\x20-\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','web','displaySampleData','database','yes','scheduleType','18qGoCIp','darwin','\x20Opening\x20','data','localeCompare','resolveParentId','\x20\x20No\x20sample\x20data\x20available','varchar','getParentFull','stop','\x0aNo\x20sample\x20data\x20available','Enriched:','/\x20directories\x20exist.','red','parentSegment','schemaValid','3243426NLkJju','runParent','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','displayAttributesStats','unref','enriched','createParent','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','Source:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','apply','tdx\x20segment\x20parent\x20preview\x20','segment:parent:push','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','output','run','customerGroupFile','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','ignore','\x0aChanges\x20to\x20apply\x20to\x20\x27','customerGroup','segment:parent:validate','description','joinKey','119JFwqfy','name','\x0a⚠️\x20\x20Migrating:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','preview','Customers:','To\x20view\x20sample\x20data:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','addBehaviorsFile','text','table','/\x20directory.\x0a','Preview:','string','errors','all','pushParentYaml','10556139sLdBYG','segment:parent:show','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','displayPreviewResults','totalEvents','\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','toFixed','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0a✔\x20Workflow\x20started','workflowSessionId','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sampleData','attribute','👥\x20','allValid','behavior','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Query\x20completed:\x20Processed\x20','map','2255vRiDHT','Listing\x20parent\x20segments\x20matching\x20\x27','\x27...','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment','\x5c$&','log','verbose','`\x20to\x20download\x20the\x20configuration\x20first','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Join:','match','listFields','displayValidateResults','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20Configuration\x20is\x20valid','Executing\x20parent\x20segment\x20query...','Updating','cyan','Database:\x20','segment:parent:fields','customerPercent','start','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','29938SzLZQQ','Creating\x20parent\x20segment\x20\x27','\x20kill','displaySummary','FINISHED','session','Master\x20Table','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22<name>\x22','✔\x20Created\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','use','length','bold','\x0aNew\x20parent\x20segment\x20\x27','utf-8','\x20No\x20changes\x20-\x20','279201wtiPJN','Site:\x20','/app/workflows/','142744YSqDyj','Errors:','dirname','attributes','query','\x20rows\x20','displayMasterInfo','Error:','validateParentYaml','\x27\x20and\x20run\x20workflow?','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayBehaviorsStats','\x20tdx\x20wf\x20attempt\x20','columns','addAttributes','label','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','Resolving\x20parent\x20segment\x20\x27','Table:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20=\x20','Coverage:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20--interval\x20','Attributes','-1d','setJobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','execute','Updated','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','SQL\x20query:\x0a','Aborted.','\x20rows)','customersWithEvents','using\x20the\x20default\x20path:\x20','processedRows','win32','Analyzing\x20changes...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Apply\x20changes\x20to\x20\x27','stats','json','sort','error','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Fetching\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Fetching\x20SQL\x20for\x20\x27','\x20--enriched','schemaError','\x20--attribute\x20\x22','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Audience\x20ID:','coveragePercent','/\x20→\x20','displayPreviewHints','\x0a⚠️\x20\x20Both\x20','segment:parent:desc','Creating','Master\x20+\x20Attributes','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','listParents','behaviors','Columns:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error\x20reading\x20file:\x20','pullParentYaml','Listing\x20parent\x20segments...','1732CsSbjA','%)\x20','Validating\x20configuration...','Error:\x20Parent\x20segment\x20name\x20is\x20required','Events:','\x27\x20with\x20ID:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','.yml','To\x20cancel:','xdg-open','audienceId','45mzCsvS','\x20--behavior\x20\x22','\x20[Job\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','isDirectory','yellow','Found\x20YAML\x20file:\x20','status','Show\x20parent\x20segment\x20details','platform','foreignKey','green','attributesFile','segment:parent:sql','keys','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','jsonl','test','/app/dw/parentSegments/','Master:','workflowAttemptId','Fetching\x20sample\x20data...','segment:parent:preview','Get\x20SQL\x20query\x20for\x20parent\x20segment','List\x20parent\x20segments','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','timezone','\x0aChanges\x20to\x20\x27','updateParent','segment:parent:list','site','number','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','/sessions/','format','Error\x20parsing\x20YAML:\x20','elapsedTimeMillis','YAML\x20file:\x20','Listing\x20fields\x20for\x20\x27','in\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Options:\x0a','Error:\x20File\x20not\x20found:\x20','matchedCount','Attribute:','Pattern:\x20','displayColumns','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','segment:parent:pull','\x20field','addBehaviors','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20is\x20already\x20up\x20to\x20date','rowCount','Status:','endsWith','Behaviors','filter','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Rows:','Validate:','Join\x20on:','population','replace','column','922910hGnNxR','getParentSQL','segment:parent:create','Show\x20parent\x20segment\x20schema\x20(column\x20types)','interval','join','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','master','segment:parent:update','Error:\x20--behavior\x20requires\x20a\x20name\x0a','open'];a23_0x1c37=function(){return _0x11c654;};return a23_0x1c37();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x277f3c(0x2a9);function openBrowser(_0x414ff3){const _0x1309d9=a23_0x277f3c,_0xba7e14=process[_0x1309d9(0x262)],_0x43da76=_0xba7e14===_0x1309d9(0x2b6)?_0x1309d9(0x2a8):_0xba7e14===_0x1309d9(0x228)?_0x1309d9(0x1ea):_0x1309d9(0x257);spawn(_0x43da76,[_0x414ff3],{'detached':!![],'stdio':_0x1309d9(0x2db)})[_0x1309d9(0x2ca)]();}function migrateLegacyDirectory(){const _0x478c58=a23_0x277f3c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58b68e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58b68e[_0x478c58(0x25d)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x25e)](_0x478c58(0x23e)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x478c58(0x2c1))),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x1d6)](_0x478c58(0x254)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x2ef))),![];console['error'](a23_0x3b54b8['yellow'](_0x478c58(0x2e3)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x23c)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x264)](_0x478c58(0x242)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x640844){const _0x2dcb85=_0x640844 instanceof Error?_0x640844[_0x478c58(0x2ad)]:String(_0x640844);return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x2c2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x2dcb85+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x5981f8){const _0x4a63d4=a23_0x277f3c;return migrateLegacyDirectory(),super[_0x4a63d4(0x2d8)](_0x5981f8);}}function resolveYamlFile(_0x289d82){const _0x3334d7=a23_0x277f3c;if(_0x289d82[_0x3334d7(0x294)](_0x3334d7(0x255))||_0x289d82[_0x3334d7(0x294)]('.yaml'))return _0x289d82;return a23_0x52e31e[_0x3334d7(0x2a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x289d82)+_0x3334d7(0x255));}function formatProgressMessage(_0x27f356){const _0x132f8d=a23_0x277f3c,_0x37488c=_0x27f356[_0x132f8d(0x1df)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x37488c){const [,_0x4b7772,_0x577082,_0x36bb16='']=_0x37488c;return a23_0x3b54b8['dim'](_0x4b7772+':')+'\x20'+_0x577082+a23_0x3b54b8['dim'](_0x36bb16);}return a23_0x3b54b8[_0x132f8d(0x1d6)](_0x27f356);}function showFileNotFoundError(_0x2481e9,_0x1c908b){const _0x59aeea=a23_0x277f3c;console[_0x59aeea(0x22f)](a23_0x3b54b8['red'](_0x59aeea(0x286)+_0x2481e9+'\x0a')),console[_0x59aeea(0x22f)](a23_0x3b54b8[_0x59aeea(0x1e6)](_0x59aeea(0x221)+_0x1c908b+_0x59aeea(0x1dc)));}function showParentSegmentNotSetError(_0x10ac32){const _0x2a0080=a23_0x277f3c;console[_0x2a0080(0x22f)](a23_0x3b54b8['yellow'](_0x2a0080(0x219))),console[_0x2a0080(0x22f)](_0x10ac32);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x277);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x272);async[a23_0x277f3c(0x21f)](_0x1d4640){const _0xd62cf6=a23_0x277f3c,{options:_0x224229,args:_0x322358,tdx:_0xa65b7c}=_0x1d4640,_0x22d475=_0x322358[0x0];_0x224229[_0xd62cf6(0x1db)]&&(console[_0xd62cf6(0x22f)](_0xd62cf6(0x1ff)+_0x224229[_0xd62cf6(0x278)]),_0x22d475&&console[_0xd62cf6(0x22f)](_0xd62cf6(0x289)+_0x22d475));const _0x3e226f=await withSpinner(_0x22d475?_0xd62cf6(0x1d2)+_0x22d475+_0xd62cf6(0x1d3):_0xd62cf6(0x24d),()=>_0xa65b7c[_0xd62cf6(0x1d8)][_0xd62cf6(0x246)](),{'verbose':_0x224229[_0xd62cf6(0x1db)]});let _0x368362=_0x3e226f['data'];if(_0x22d475){const _0x4f31f5=_0x22d475[_0xd62cf6(0x29c)](/[.+^${}()|[\]\\]/g,_0xd62cf6(0x1d9))['replace'](/\*/g,'.*')[_0xd62cf6(0x29c)](/\?/g,'.'),_0x825b39=new RegExp('^'+_0x4f31f5+'$','i');_0x368362=_0x368362[_0xd62cf6(0x296)](_0x332084=>_0x825b39[_0xd62cf6(0x26b)](_0x332084['attributes'][_0xd62cf6(0x2e2)]));}_0x368362[_0xd62cf6(0x22e)]((_0x4938f2,_0x2bf406)=>_0x4938f2[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)][_0xd62cf6(0x2b9)](_0x2bf406[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)])),console[_0xd62cf6(0x22f)]('✔\x20Found\x20'+_0x368362[_0xd62cf6(0x1f9)]+_0xd62cf6(0x2fc)+(_0x368362['length']!==0x1?'s':''));const _0x57927d=_0x203f16=>{const _0x3f0a95=_0xd62cf6;return getConsoleNextUrl(_0x224229[_0x3f0a95(0x278)],'/app/dw/parentSegments/'+_0x203f16);};if(_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x22d)||_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x26a)){const _0x335c45=_0x368362[_0xd62cf6(0x1d0)](_0x37fd9c=>({..._0x37fd9c,'url':_0x57927d(_0x37fd9c['id'])}));await handleSDKOutput(_0x335c45,_0x224229);}else{if(_0x368362[_0xd62cf6(0x1f9)]===0x0)_0x22d475?console[_0xd62cf6(0x1da)](_0xd62cf6(0x284)+_0x22d475):console[_0xd62cf6(0x1da)](_0xd62cf6(0x238));else for(const _0x5a13ed of _0x368362){const _0x282f37=_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)]?a23_0x3b54b8[_0xd62cf6(0x1d6)]('\x20('+formatRows(_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)])+')'):'',_0x42a743=hyperlink(_0x5a13ed['attributes']['name'],_0x57927d(_0x5a13ed['id']));console[_0xd62cf6(0x1da)](_0xd62cf6(0x305)+_0x42a743+_0x282f37);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x277f3c(0x2a0);['description']=a23_0x277f3c(0x27a);async[a23_0x277f3c(0x21f)](_0x27f2b0){const _0x1e9f26=a23_0x277f3c,{options:_0x1e77bb,args:_0x42c79d,tdx:_0x37ac33}=_0x27f2b0;console[_0x1e9f26(0x22f)](_0x1e9f26(0x2f8)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x18b4c7=_0x1e77bb;if(_0x42c79d[_0x1e9f26(0x1f9)]===0x0)return console['error'](a23_0x3b54b8[_0x1e9f26(0x2c2)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x1e9f26(0x22f)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2825c1=_0x42c79d[0x0];if(!_0x18b4c7['database']||!_0x18b4c7[_0x1e9f26(0x2ee)])return console[_0x1e9f26(0x22f)](_0x1e9f26(0x290)),console[_0x1e9f26(0x22f)](_0x1e9f26(0x2e9)),0x1;_0x18b4c7['verbose']&&(console[_0x1e9f26(0x22f)]('Site:\x20'+_0x18b4c7[_0x1e9f26(0x278)]),console['error']('Name:\x20'+_0x2825c1),console['error'](_0x1e9f26(0x1e7)+_0x18b4c7[_0x1e9f26(0x2b2)]),console[_0x1e9f26(0x22f)](_0x1e9f26(0x214)+_0x18b4c7[_0x1e9f26(0x2ee)]));const _0x34a25a=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x204)],_0x18b4c7[_0x1e9f26(0x265)]),_0x15ecdf=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x247)],_0x18b4c7[_0x1e9f26(0x245)]),_0x3f39ae=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x2dd)],_0x18b4c7[_0x1e9f26(0x2d9)]),_0xd70850={'name':_0x2825c1,'description':_0x18b4c7[_0x1e9f26(0x2df)],'scheduleType':_0x18b4c7[_0x1e9f26(0x2b4)],'scheduleOption':_0x18b4c7[_0x1e9f26(0x230)],'timezone':_0x18b4c7[_0x1e9f26(0x274)],'master':{'parentDatabaseName':_0x18b4c7[_0x1e9f26(0x2b2)],'parentTableName':_0x18b4c7[_0x1e9f26(0x2ee)]},'attributes':_0x34a25a,'behaviors':_0x15ecdf,'customerGroup':_0x3f39ae},_0x3b69eb=await withSpinner(_0x1e9f26(0x1ed)+_0x2825c1+_0x1e9f26(0x1d3),()=>_0x37ac33['segment'][_0x1e9f26(0x2cc)](_0xd70850),{'verbose':_0x1e77bb[_0x1e9f26(0x1db)]}),_0x1615c8=_0x3b69eb[_0x1e9f26(0x2b8)];return console[_0x1e9f26(0x22f)](_0x1e9f26(0x1f5)+_0x1615c8[_0x1e9f26(0x2e2)]+_0x1e9f26(0x253)+_0x1615c8['id']),await handleSDKOutput([_0x1615c8],_0x1e77bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2a6);[a23_0x277f3c(0x2df)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x2a0716){const _0x21546e=a23_0x277f3c,{options:_0x3e9548,args:_0x14c809,tdx:_0x10d13c}=_0x2a0716;console[_0x21546e(0x22f)](_0x21546e(0x22a)+_0x21546e(0x1d7)+_0x21546e(0x28b));const _0x325916=_0x3e9548;if(_0x14c809[_0x21546e(0x1f9)]===0x0)return console[_0x21546e(0x22f)](a23_0x3b54b8[_0x21546e(0x2c2)](_0x21546e(0x251))),console['error'](_0x21546e(0x2fd)),0x1;const _0x39b2fc=_0x14c809[0x0];_0x325916['verbose']&&(console[_0x21546e(0x22f)](_0x21546e(0x1ff)+_0x325916[_0x21546e(0x278)]),console[_0x21546e(0x22f)](_0x21546e(0x2eb)+_0x39b2fc));const _0x52ddea=await withSpinner(_0x21546e(0x2e4)+_0x39b2fc+'\x27...',()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x2bd)](_0x39b2fc),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x5bbc25=_0x52ddea['data'],_0x313f86=await loadJSONFromOptions(_0x325916[_0x21546e(0x20f)],_0x325916['addAttributesFile']),_0x59d36c=await loadJSONFromOptions(_0x325916[_0x21546e(0x28f)],_0x325916[_0x21546e(0x2ec)]),_0x129343={'name':_0x5bbc25['name'],'description':_0x325916[_0x21546e(0x2df)]!==undefined?_0x325916[_0x21546e(0x2df)]:_0x5bbc25[_0x21546e(0x2df)],'scheduleType':_0x325916['scheduleType']!==undefined?_0x325916[_0x21546e(0x2b4)]:_0x5bbc25[_0x21546e(0x2b4)],'scheduleOption':_0x325916['scheduleOption']!==undefined?_0x325916[_0x21546e(0x230)]:_0x5bbc25[_0x21546e(0x230)],'timezone':_0x325916['timezone']!==undefined?_0x325916['timezone']:_0x5bbc25[_0x21546e(0x274)],'master':_0x5bbc25['master'],'attributes':_0x313f86?[..._0x5bbc25[_0x21546e(0x204)]||[],..._0x313f86]:_0x5bbc25[_0x21546e(0x204)],'behaviors':_0x59d36c?[..._0x5bbc25[_0x21546e(0x247)]||[],..._0x59d36c]:_0x5bbc25[_0x21546e(0x247)],'customerGroup':_0x5bbc25['customerGroup']},_0x89bdf6=await withSpinner(_0x21546e(0x2ab)+_0x39b2fc+_0x21546e(0x1d3),()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x276)](_0x39b2fc,_0x129343),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x26effa=_0x89bdf6[_0x21546e(0x2b8)];return console[_0x21546e(0x22f)](_0x21546e(0x212)+_0x26effa['name']+'\x27'),await handleSDKOutput([_0x26effa],_0x325916),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x28d);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a23_0x277f3c(0x21f)](_0x50d7ce){const _0x3fd43c=a23_0x277f3c,{options:_0x18bdaa,args:_0x358510,tdx:_0x5bcacf}=_0x50d7ce,_0x1a9d38=_0x18bdaa,_0x12ae17=_0x358510[0x0]||_0x18bdaa['parentSegment'];if(!_0x12ae17)return showParentSegmentNotSetError(_0x3fd43c(0x297)+_0x3fd43c(0x2ce)),0x1;if(_0x1a9d38[_0x3fd43c(0x1f8)]&&_0x1a9d38[_0x3fd43c(0x2d7)])return console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x2c2)](_0x3fd43c(0x2d5))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x1d4))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x226)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x3fd43c(0x21e))),0x1;const _0x2fd56b=_0x1a9d38['output']||a23_0x52e31e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x12ae17)+_0x3fd43c(0x255));_0x1a9d38[_0x3fd43c(0x1db)]&&(console['error'](_0x3fd43c(0x1ff)+_0x1a9d38[_0x3fd43c(0x278)]),console['error'](_0x3fd43c(0x2eb)+_0x12ae17),console[_0x3fd43c(0x22f)]('Output\x20file:\x20'+_0x2fd56b));const _0x284b66=await withSpinner(_0x3fd43c(0x232)+_0x12ae17+'\x27...',()=>_0x5bcacf['segment'][_0x3fd43c(0x24c)](_0x12ae17),{'verbose':_0x1a9d38[_0x3fd43c(0x1db)]}),_0x13fc2d=_0x284b66['data'];if(existsSync(_0x2fd56b)){const _0x5606a0=readFileSync(_0x2fd56b,_0x3fd43c(0x1fc)),_0x586a63=generateDiff(_0x5606a0,_0x13fc2d);if(!hasChanges(_0x586a63))console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x1fd)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b)+_0x3fd43c(0x291));else{console[_0x3fd43c(0x22f)](_0x3fd43c(0x275)+_0x2fd56b+'\x27:'),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c)),console[_0x3fd43c(0x22f)](formatDiffWithColors(_0x586a63)),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c));if(!_0x1a9d38['yes']){const _0x49f496=await confirmKey('Overwrite\x20\x27'+_0x2fd56b+'\x27?');if(!_0x49f496)return console['error'](_0x3fd43c(0x223)),0x1;}writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8['green']('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}}else{const _0x4d528e=a23_0x52e31e[_0x3fd43c(0x203)](_0x2fd56b);!existsSync(_0x4d528e)&&mkdirSync(_0x4d528e,{'recursive':!![]}),writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}return saveSessionContext({'parent_segment':_0x12ae17},_0x1a9d38[_0x3fd43c(0x1f1)]),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+'\x20Context\x20set:\x20'+a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x2a9))+_0x3fd43c(0x217)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x12ae17)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x2d4);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1d5);async[a23_0x277f3c(0x21f)](_0x4a9cff){const _0x200437=a23_0x277f3c,{options:_0x4e4636,args:_0x366f24,tdx:_0x4a2ac2}=_0x4a9cff,_0x2b1fdd=_0x4e4636,_0x25a964=_0x366f24[0x0]||_0x4e4636[_0x200437(0x2c3)];if(!_0x25a964)return showParentSegmentNotSetError(_0x200437(0x2f7)+_0x200437(0x243)),0x1;const _0x4cc23c=resolveYamlFile(_0x25a964);if(!existsSync(_0x4cc23c))return showFileNotFoundError(_0x4cc23c,_0x25a964),0x1;_0x2b1fdd[_0x200437(0x1db)]&&(console[_0x200437(0x22f)]('Site:\x20'+_0x2b1fdd['site']),console[_0x200437(0x22f)](_0x200437(0x281)+_0x4cc23c));let _0x230e43;try{_0x230e43=readFileSync(_0x4cc23c,'utf-8');}catch(_0x19667c){const _0x3c6840=_0x19667c instanceof Error?_0x19667c[_0x200437(0x2ad)]:String(_0x19667c);return console[_0x200437(0x22f)]('Error\x20reading\x20file:\x20'+_0x3c6840),0x1;}const _0x4b9080=await withSpinner(_0x200437(0x229),()=>_0x4a2ac2[_0x200437(0x1d8)]['pushParentYaml'](_0x230e43),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0xddb794=_0x4b9080['data'],{isNew:_0x23a8eb,name:_0x5b5818,hasChanges:_0x579c74,diffFormatted:_0x4a2261}=_0xddb794;if(!_0x579c74)return console[_0x200437(0x22f)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5b5818+_0x200437(0x308)),0x0;_0x23a8eb?console[_0x200437(0x22f)](_0x200437(0x1fb)+_0x5b5818+'\x27:'):console[_0x200437(0x22f)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x5b5818+'\x27:');console[_0x200437(0x22f)]('─'[_0x200437(0x2f9)](0x3c)),console[_0x200437(0x22f)](_0x4a2261),console['error']('─'[_0x200437(0x2f9)](0x3c));const _0x37c4c9=_0x23a8eb?'Create\x20parent\x20segment\x20\x27'+_0x5b5818+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x5b5818+'\x27?';if(!_0x2b1fdd[_0x200437(0x2b3)]){const _0x1ff5f6=await confirmKey(_0x37c4c9);if(!_0x1ff5f6)return console['error'](_0x200437(0x223)),0x1;}const _0x27d873=_0x23a8eb?'Creating':_0x200437(0x1e5),_0x5dd550=await withSpinner(_0x27d873+_0x200437(0x2cd)+_0x5b5818+_0x200437(0x1d3),()=>_0xddb794[_0x200437(0x2d2)](),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0x4283a6=_0x5dd550['data'],_0x349836=getConsoleNextUrl(_0x2b1fdd[_0x200437(0x278)],_0x200437(0x26c)+_0x4283a6['id']),_0x36fbd0=_0x23a8eb?'Created':_0x200437(0x220);return console[_0x200437(0x22f)]('✔\x20'+_0x36fbd0+'\x20parent\x20segment\x20\x27'+_0x4283a6[_0x200437(0x2e2)]+'\x27'),console[_0x200437(0x22f)]('\x20\x20'+_0x349836),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2de);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x233);async[a23_0x277f3c(0x21f)](_0x2ebe0a){const _0x1c402e=a23_0x277f3c,{options:_0x187c28,args:_0x21ad54,tdx:_0xc96090}=_0x2ebe0a,_0x1f3687=_0x187c28,_0xe076f9=_0x21ad54[0x0]||_0x187c28['parentSegment'];if(!_0xe076f9)return showParentSegmentNotSetError(_0x1c402e(0x2af)+'\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'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x1c402e(0x2da)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1fbef2=resolveYamlFile(_0xe076f9);if(!existsSync(_0x1fbef2))return showFileNotFoundError(_0x1fbef2,_0xe076f9),0x1;_0x1f3687[_0x1c402e(0x1db)]&&(console[_0x1c402e(0x22f)](_0x1c402e(0x1ff)+_0x1f3687[_0x1c402e(0x278)]),console[_0x1c402e(0x22f)](_0x1c402e(0x281)+_0x1fbef2));let _0xf13f0b;try{_0xf13f0b=readFileSync(_0x1fbef2,'utf-8');}catch(_0x4cbc49){const _0x26816b=_0x4cbc49 instanceof Error?_0x4cbc49[_0x1c402e(0x2ad)]:String(_0x4cbc49);return console[_0x1c402e(0x22f)]('Error\x20reading\x20file:\x20'+_0x26816b),0x1;}const _0xc3651c=createCommandSpinner(a23_0x3b54b8[_0x1c402e(0x1d6)](_0x1c402e(0x250)),{'verbose':_0x1f3687[_0x1c402e(0x1db)]});_0xc3651c[_0x1c402e(0x1ea)]();const _0x33dcf8={'onProgress':_0x2f5369=>{const _0x5e09e9=_0x1c402e;_0xc3651c[_0x5e09e9(0x2ed)]=formatProgressMessage(_0x2f5369);}};if(_0x1f3687[_0x1c402e(0x2a5)])_0x33dcf8[_0x1c402e(0x2a5)]=!![];if(_0x1f3687['enriched'])_0x33dcf8[_0x1c402e(0x2cb)]=!![];_0x1f3687[_0x1c402e(0x304)]&&(_0x33dcf8[_0x1c402e(0x304)]=_0x1f3687[_0x1c402e(0x304)]);_0x1f3687['behavior']&&(_0x33dcf8[_0x1c402e(0x307)]=_0x1f3687[_0x1c402e(0x307)]);if(_0x1f3687[_0x1c402e(0x2a2)])_0x33dcf8[_0x1c402e(0x2a2)]=_0x1f3687[_0x1c402e(0x2a2)];let _0x28dc86;try{_0x28dc86=await _0xc96090['segment'][_0x1c402e(0x209)](_0xf13f0b,_0x33dcf8),_0xc3651c['stop']();}catch(_0x5f01e0){_0xc3651c['stop']();throw _0x5f01e0;}const _0x47c733=_0x1f3687[_0x1c402e(0x2a2)]||_0x1c402e(0x21c);return this[_0x1c402e(0x1e1)](_0x28dc86,_0x33dcf8,_0x1fbef2,_0x47c733),_0x28dc86[_0x1c402e(0x306)]?0x0:0x1;}[a23_0x277f3c(0x1e1)](_0x264efe,_0x3fc4d1,_0x37e1d4,_0x702b80){const _0x2e7c13=a23_0x277f3c;console[_0x2e7c13(0x22f)]('\x0a'+a23_0x3b54b8[_0x2e7c13(0x1fa)](_0x2e7c13(0x299))+'\x20'+_0x264efe[_0x2e7c13(0x2e2)]),console['error']('═'[_0x2e7c13(0x2f9)](0x3c)),this[_0x2e7c13(0x207)](_0x264efe);if(typeof _0x3fc4d1[_0x2e7c13(0x304)]==='string'){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this['displayPreviewHints'](_0x37e1d4,_0x702b80,'attribute',_0x3fc4d1[_0x2e7c13(0x304)]);return;}if(_0x3fc4d1[_0x2e7c13(0x304)]===!![]){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'attributes');return;}if(typeof _0x3fc4d1[_0x2e7c13(0x307)]===_0x2e7c13(0x2f1)){this['displayBehaviorsStats'](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'behavior',_0x3fc4d1[_0x2e7c13(0x307)]);return;}if(_0x3fc4d1['behavior']===!![]){this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x247));return;}this[_0x2e7c13(0x2c9)](_0x264efe),this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x2f3));}[a23_0x277f3c(0x23d)](_0x43bdb8,_0x3934c4,_0x15ea74,_0x475367){const _0x285412=a23_0x277f3c;console[_0x285412(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x285412(0x2e7)));const _0x28bc99=_0x3934c4!==_0x285412(0x21c)?_0x285412(0x21a)+_0x3934c4:'';if(_0x15ea74===_0x285412(0x304)&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x237)+_0x475367+'\x22'+_0x28bc99));else{if(_0x15ea74==='behavior'&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x25a)+_0x475367+'\x22'+_0x28bc99));else(_0x15ea74===_0x285412(0x204)||_0x15ea74===_0x285412(0x2f3))&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x1f6)+_0x28bc99));}(_0x15ea74==='behaviors'||_0x15ea74==='all')&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x1f4)+_0x28bc99)),_0x15ea74===_0x285412(0x2f3)&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x235)+_0x28bc99));}[a23_0x277f3c(0x207)](_0x38a838){const _0xeca59c=a23_0x277f3c,{master:_0x371a11}=_0x38a838,_0x3ee99b=_0x371a11[_0xeca59c(0x2c4)]?a23_0x3b54b8[_0xeca59c(0x264)]('✔'):a23_0x3b54b8[_0xeca59c(0x2c2)]('✘');console[_0xeca59c(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0xeca59c(0x1f2))),console[_0xeca59c(0x22f)](_0x3ee99b+'\x20'+a23_0x3b54b8['bold'](_0x371a11['database']+'.'+_0x371a11[_0xeca59c(0x2ee)])),_0x371a11[_0xeca59c(0x2c4)]?_0x371a11['rowCount']!==undefined&&console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8[_0xeca59c(0x1d6)](_0xeca59c(0x298))+'\x20'+a23_0x3b54b8['cyan'](formatRows(_0x371a11[_0xeca59c(0x292)]))):console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8['red']('Error:')+'\x20'+_0x371a11['schemaError']);}[a23_0x277f3c(0x2c9)](_0x48e6c1){const _0x1e5927=a23_0x277f3c;if(_0x48e6c1[_0x1e5927(0x204)][_0x1e5927(0x1f9)]===0x0)return;console[_0x1e5927(0x22f)]('\x0a'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x21b)));for(const _0x1bed6e of _0x48e6c1['attributes']){const _0x3ef676=_0x1bed6e['schemaValid']?a23_0x3b54b8[_0x1e5927(0x264)]('✔'):a23_0x3b54b8[_0x1e5927(0x2c2)]('✘');let _0x575b1a='';if(_0x1bed6e[_0x1e5927(0x2c4)]&&_0x1bed6e[_0x1e5927(0x287)]!==undefined&&_0x1bed6e[_0x1e5927(0x23b)]!==undefined){const _0x200ab9=_0x1bed6e[_0x1e5927(0x23b)]['toFixed'](0x1),_0x9a359b=_0x1bed6e['coveragePercent']>=0x50?a23_0x3b54b8[_0x1e5927(0x264)]:_0x1bed6e[_0x1e5927(0x23b)]>=0x32?a23_0x3b54b8[_0x1e5927(0x25e)]:a23_0x3b54b8[_0x1e5927(0x2c2)];_0x575b1a='\x20'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x218))+'\x20'+_0x9a359b(_0x200ab9+'%')+'\x20('+formatRows(_0x1bed6e['matchedCount'])+_0x1e5927(0x224);}console[_0x1e5927(0x22f)](_0x3ef676+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e['name'])+_0x575b1a),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x2d0))+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e[_0x1e5927(0x2b2)]+'.'+_0x1bed6e[_0x1e5927(0x2ee)]));const _0x2ed294=_0x1bed6e[_0x1e5927(0x2e0)]===_0x1bed6e[_0x1e5927(0x263)]?a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x29a))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]:a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x1de))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]+_0x1e5927(0x217)+_0x1bed6e[_0x1e5927(0x263)];console['error']('\x20\x20'+_0x2ed294),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x248))),this[_0x1e5927(0x28a)](_0x1bed6e['columns']),!_0x1bed6e[_0x1e5927(0x2c4)]&&console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x1e5927(0x2c2)]('Error:')+'\x20'+_0x1bed6e[_0x1e5927(0x236)]);}}[a23_0x277f3c(0x20c)](_0x425190,_0x1c0406){const _0x5d38e8=a23_0x277f3c;if(_0x425190[_0x5d38e8(0x247)][_0x5d38e8(0x1f9)]===0x0)return;console[_0x5d38e8(0x22f)]('\x0a'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x295))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)]('('+_0x1c0406+')'));for(const _0x2d9791 of _0x425190[_0x5d38e8(0x247)]){const _0xb3007b=_0x2d9791[_0x5d38e8(0x2c4)]?a23_0x3b54b8[_0x5d38e8(0x264)]('✔'):a23_0x3b54b8[_0x5d38e8(0x2c2)]('✘');let _0x5b3ad7='';if(_0x2d9791[_0x5d38e8(0x2c4)]&&_0x2d9791[_0x5d38e8(0x225)]!==undefined&&_0x2d9791[_0x5d38e8(0x2fb)]!==undefined){const _0x2c2071=_0x2d9791['customerPercent']?.[_0x5d38e8(0x2fe)](0x1)||'?',_0x181639=(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x32?a23_0x3b54b8['green']:(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x14?a23_0x3b54b8[_0x5d38e8(0x25e)]:a23_0x3b54b8['red'];_0x5b3ad7='\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2e6))+'\x20'+_0x181639(formatRows(_0x2d9791[_0x5d38e8(0x225)]))+'\x20('+_0x2c2071+_0x5d38e8(0x24f)+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x252))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1e6)](formatRows(_0x2d9791[_0x5d38e8(0x2fb)]));}console[_0x5d38e8(0x22f)](_0xb3007b+'\x20'+a23_0x3b54b8['bold'](_0x2d9791[_0x5d38e8(0x2e2)])+_0x5b3ad7),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2d0))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1fa)](_0x2d9791['database']+'.'+_0x2d9791[_0x5d38e8(0x2ee)]));const _0x522c66=_0x2d9791[_0x5d38e8(0x2e0)]===_0x2d9791['foreignKey']?a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x29a))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]:a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x1de))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]+_0x5d38e8(0x217)+_0x2d9791[_0x5d38e8(0x263)];console[_0x5d38e8(0x22f)]('\x20\x20'+_0x522c66),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x248))),this[_0x5d38e8(0x28a)](_0x2d9791[_0x5d38e8(0x20e)]),!_0x2d9791[_0x5d38e8(0x2c4)]&&console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8['red'](_0x5d38e8(0x208))+'\x20'+_0x2d9791[_0x5d38e8(0x236)]);}}[a23_0x277f3c(0x28a)](_0x4c8728){const _0xe8889a=a23_0x277f3c;for(const _0x4971be of _0x4c8728){_0x4971be[_0xe8889a(0x210)]===_0x4971be[_0xe8889a(0x29d)]||_0x4971be['column']==='*'?console[_0xe8889a(0x22f)]('\x20\x20\x20\x20-\x20'+_0x4971be[_0xe8889a(0x210)]):console[_0xe8889a(0x22f)](_0xe8889a(0x2aa)+_0x4971be[_0xe8889a(0x210)]+'\x20'+a23_0x3b54b8[_0xe8889a(0x1d6)]('('+_0x4971be[_0xe8889a(0x29d)]+')'));}}[a23_0x277f3c(0x1ef)](_0x1905c7){const _0x3742f4=a23_0x277f3c;console[_0x3742f4(0x22f)]('─'[_0x3742f4(0x2f9)](0x3c));if(_0x1905c7[_0x3742f4(0x2f2)]['length']>0x0){console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x2c2)](_0x3742f4(0x202)));for(const _0x334761 of _0x1905c7[_0x3742f4(0x2f2)]){console[_0x3742f4(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x3742f4(0x2c2)]('•')+'\x20'+_0x334761);}}_0x1905c7['allValid']&&console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x264)]('✔')+_0x3742f4(0x1e3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x270);['description']=a23_0x277f3c(0x2c7);async['execute'](_0xbeabdf){const _0x4b6d18=a23_0x277f3c,{options:_0x3d9887,args:_0xe6830c,tdx:_0x3835dc}=_0xbeabdf,_0x398804=_0x3d9887,_0x590d04=_0xe6830c[0x0]||_0x3d9887[_0x4b6d18(0x2c3)];if(!_0x590d04)return showParentSegmentNotSetError(_0x4b6d18(0x2d6)+_0x4b6d18(0x244)+'Options\x20(one\x20required):\x0a'+_0x4b6d18(0x1ce)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4b6d18(0x2ff)+_0x4b6d18(0x231)+_0x4b6d18(0x2e8)),0x1;if(!_0x398804[_0x4b6d18(0x2a5)]&&!_0x398804[_0x4b6d18(0x304)]&&!_0x398804[_0x4b6d18(0x307)]&&!_0x398804[_0x4b6d18(0x2cb)])return console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2d1))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x216)),console['error']('Options:'),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2c8)),console['error'](_0x4b6d18(0x24a)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1e2)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1f7)),0x1;const _0x291d19=resolveYamlFile(_0x590d04);if(!existsSync(_0x291d19))return showFileNotFoundError(_0x291d19,_0x590d04),0x1;_0x398804['verbose']&&(console[_0x4b6d18(0x22f)](_0x4b6d18(0x1ff)+_0x398804[_0x4b6d18(0x278)]),console[_0x4b6d18(0x22f)]('YAML\x20file:\x20'+_0x291d19));let _0x24d62e;try{_0x24d62e=readFileSync(_0x291d19,'utf-8');}catch(_0x3f7e17){const _0x4679de=_0x3f7e17 instanceof Error?_0x3f7e17[_0x4b6d18(0x2ad)]:String(_0x3f7e17);return console['error'](_0x4b6d18(0x24b)+_0x4679de),0x1;}let _0x2b1820;try{_0x2b1820=parseDef(_0x24d62e);}catch(_0x4ac699){const _0x3868fb=_0x4ac699 instanceof Error?_0x4ac699[_0x4b6d18(0x2ad)]:String(_0x4ac699);return console[_0x4b6d18(0x22f)](a23_0x3b54b8['red'](_0x4b6d18(0x27f)+_0x3868fb)),0x1;}if(_0x398804[_0x4b6d18(0x304)]===!![]||_0x398804['attribute']===''){const _0x557b15=_0x2b1820[_0x4b6d18(0x204)]?.[_0x4b6d18(0x1d0)](_0x71f6f8=>_0x71f6f8[_0x4b6d18(0x2e2)])||[];if(_0x557b15['length']===0x0)console[_0x4b6d18(0x22f)](a23_0x3b54b8['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x20b))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2cf));for(const _0x5e7366 of _0x557b15){console['error']('\x20\x20'+a23_0x3b54b8['cyan'](_0x5e7366));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+_0x4b6d18(0x237)+_0x557b15[0x0]+'\x22');}return 0x1;}if(_0x398804['behavior']===!![]||_0x398804[_0x4b6d18(0x307)]===''){const _0x4476b1=_0x2b1820[_0x4b6d18(0x247)]?.[_0x4b6d18(0x1d0)](_0x4b3f68=>_0x4b3f68[_0x4b6d18(0x2e2)])||[];if(_0x4476b1['length']===0x0)console['error'](a23_0x3b54b8[_0x4b6d18(0x2c2)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2a7))),console[_0x4b6d18(0x22f)]('Available\x20behaviors:');for(const _0x534227 of _0x4476b1){console[_0x4b6d18(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x4b6d18(0x1e6)](_0x534227));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+'\x20--behavior\x20\x22'+_0x4476b1[0x0]+'\x22');}return 0x1;}const _0x47c4c4=createCommandSpinner(a23_0x3b54b8['dim'](_0x4b6d18(0x26f)),{'verbose':_0x398804['verbose']});_0x47c4c4[_0x4b6d18(0x1ea)]();const _0x1f1afc={'onProgress':_0x5e02bd=>{const _0x2e73f8=_0x4b6d18;_0x47c4c4[_0x2e73f8(0x2ed)]=formatProgressMessage(_0x5e02bd);}};if(_0x398804[_0x4b6d18(0x2a5)])_0x1f1afc['master']=!![];if(_0x398804['attribute']&&typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x304)]=_0x398804[_0x4b6d18(0x304)];if(_0x398804['behavior']&&typeof _0x398804[_0x4b6d18(0x307)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x307)]=_0x398804['behavior'];if(_0x398804['enriched'])_0x1f1afc[_0x4b6d18(0x2cb)]=!![];if(_0x398804[_0x4b6d18(0x2a2)])_0x1f1afc[_0x4b6d18(0x2a2)]=_0x398804[_0x4b6d18(0x2a2)];let _0x501333;try{_0x501333=await _0x3835dc[_0x4b6d18(0x1d8)]['previewParentYaml'](_0x24d62e,_0x1f1afc),_0x47c4c4[_0x4b6d18(0x2be)]();}catch(_0x432416){_0x47c4c4['stop']();throw _0x432416;}return await this[_0x4b6d18(0x2fa)](_0x501333,{'master':_0x398804[_0x4b6d18(0x2a5)],'attribute':typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1)?_0x398804['attribute']:undefined,'behavior':typeof _0x398804['behavior']===_0x4b6d18(0x2f1)?_0x398804['behavior']:undefined,'enriched':_0x398804['enriched']}),_0x501333['allValid']?0x0:0x1;}async[a23_0x277f3c(0x2fa)](_0x8515c0,_0x3805dd){const _0x124290=a23_0x277f3c;console['error']('\x0a'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x2f0))+'\x20'+_0x8515c0[_0x124290(0x2e2)]),console[_0x124290(0x22f)]('═'[_0x124290(0x2f9)](0x3c));if(_0x3805dd[_0x124290(0x2a5)]&&_0x8515c0[_0x124290(0x303)]){const _0x5e6337=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x26d))+'\x20'+a23_0x3b54b8['bold'](_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2b2)]+'.'+_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2ee)]);await this[_0x124290(0x2b1)](_0x5e6337,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x304)]&&_0x8515c0[_0x124290(0x303)]){const _0x862f70=a23_0x3b54b8['dim'](_0x124290(0x288))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd['attribute']);await this['displaySampleData'](_0x862f70,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x307)]&&_0x8515c0[_0x124290(0x303)]){const _0x131dd5=a23_0x3b54b8['dim']('Behavior:')+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd[_0x124290(0x307)]);await this[_0x124290(0x2b1)](_0x131dd5,_0x8515c0['sampleData']);}else{if(_0x3805dd[_0x124290(0x2cb)]&&_0x8515c0[_0x124290(0x303)]){const _0x27c49c=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x2c0))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x241));await this['displaySampleData'](_0x27c49c,_0x8515c0[_0x124290(0x303)]);}else!_0x8515c0[_0x124290(0x303)]&&console[_0x124290(0x22f)](_0x124290(0x2bf));}}}if(_0x8515c0[_0x124290(0x2f2)][_0x124290(0x1f9)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x3b54b8['red'](_0x124290(0x202)));for(const _0x1eb15f of _0x8515c0[_0x124290(0x2f2)]){console[_0x124290(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x124290(0x2c2)]('•')+'\x20'+_0x1eb15f);}}}async[a23_0x277f3c(0x2b1)](_0x533a2c,_0x419571){const _0x52d459=a23_0x277f3c;if(_0x419571[_0x52d459(0x1f9)]===0x0){console[_0x52d459(0x22f)]('\x0a'+_0x533a2c),console[_0x52d459(0x22f)](_0x52d459(0x2bb));return;}console[_0x52d459(0x22f)]('\x0a'+_0x533a2c);const _0x3e2b17=Object[_0x52d459(0x267)](_0x419571[0x0])['map'](_0x4f34f0=>({'name':_0x4f34f0,'type':typeof _0x419571[0x0][_0x4f34f0]===_0x52d459(0x279)?'double':_0x52d459(0x2bc)})),_0x7583fc={'queryId':_0x52d459(0x2e5),'columns':_0x3e2b17,'data':_0x419571,'stats':{'state':_0x52d459(0x1f0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x419571['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2d677c=formatAsTable(_0x7583fc,_0x419571[_0x52d459(0x1f9)],!![]);await writeOutput(_0x2d677c,undefined,_0x52d459(0x2ee));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]='segment:parent:run';[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1dd);async[a23_0x277f3c(0x21f)](_0xea5fcf){const _0x52ad0b=a23_0x277f3c,{options:_0x39e032,args:_0x4d92ed,tdx:_0x431850}=_0xea5fcf,_0x51f29e=_0x39e032,_0x5ab105=_0x4d92ed[0x0]||_0x39e032[_0x52ad0b(0x2c3)];if(!_0x5ab105)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'+_0x52ad0b(0x215)),0x1;const _0x2a1ea3=resolveYamlFile(_0x5ab105);if(existsSync(_0x2a1ea3)){_0x51f29e[_0x52ad0b(0x1db)]&&console[_0x52ad0b(0x22f)](_0x52ad0b(0x25f)+_0x2a1ea3);let _0x155efc;try{_0x155efc=readFileSync(_0x2a1ea3,_0x52ad0b(0x1fc));}catch(_0x5a4842){const _0x3aac89=_0x5a4842 instanceof Error?_0x5a4842[_0x52ad0b(0x2ad)]:String(_0x5a4842);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x24b)+_0x3aac89),0x1;}const _0x342bf0=await withSpinner(_0x52ad0b(0x229),()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2f4)](_0x155efc),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x25bd73=_0x342bf0['data'],{isNew:_0x19e178,name:_0x1758dc,hasChanges:_0x125ca3,diffFormatted:_0x57dc0b}=_0x25bd73;if(_0x125ca3){_0x19e178?console[_0x52ad0b(0x22f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1758dc+'\x27:'):console[_0x52ad0b(0x22f)](_0x52ad0b(0x2dc)+_0x1758dc+'\x27:');console['error']('─'[_0x52ad0b(0x2f9)](0x3c)),console[_0x52ad0b(0x22f)](_0x57dc0b),console['error']('─'[_0x52ad0b(0x2f9)](0x3c));const _0x2406e9=_0x19e178?'Create\x20parent\x20segment\x20\x27'+_0x1758dc+_0x52ad0b(0x20a):_0x52ad0b(0x22b)+_0x1758dc+'\x27\x20and\x20run\x20workflow?';if(!_0x51f29e[_0x52ad0b(0x2b3)]){const _0x13de14=await confirmKey(_0x2406e9);if(!_0x13de14)return console['error'](_0x52ad0b(0x223)),0x1;}const _0x52c765=_0x19e178?_0x52ad0b(0x240):_0x52ad0b(0x1e5);await withSpinner(_0x52c765+_0x52ad0b(0x2cd)+_0x1758dc+'\x27...',()=>_0x25bd73[_0x52ad0b(0x2d2)](),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]});const _0x34ba22=_0x19e178?'Created':_0x52ad0b(0x220);console[_0x52ad0b(0x22f)]('✔\x20'+_0x34ba22+_0x52ad0b(0x2cd)+_0x1758dc+'\x27');}else console['error'](_0x52ad0b(0x2ae)+_0x1758dc+_0x52ad0b(0x269));}const _0xf8e14d=await withSpinner(_0x52ad0b(0x273)+_0x5ab105+'\x27...',()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2c6)](_0x5ab105),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x1b7fb1=_0xf8e14d['data'],_0x122ed8=getConsoleUrl(_0x51f29e[_0x52ad0b(0x278)],_0x52ad0b(0x200)+_0x1b7fb1['workflowId']+_0x52ad0b(0x27d)+_0x1b7fb1[_0x52ad0b(0x301)]+_0x52ad0b(0x28c)+_0x1b7fb1[_0x52ad0b(0x26e)]);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x300)),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)](_0x52ad0b(0x23a))+'\x20'+_0x1b7fb1[_0x52ad0b(0x258)]),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x52ad0b(0x293))+'\x20'+_0x1b7fb1[_0x52ad0b(0x260)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Session:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x301)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Attempt:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x26e)]),console[_0x52ad0b(0x22f)]('\x20\x20'+_0x122ed8),console[_0x52ad0b(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x52ad0b(0x256))+_0x52ad0b(0x20d)+_0x1b7fb1[_0x52ad0b(0x26e)]+_0x52ad0b(0x1ee)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x277f3c(0x1e8);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2ea);async[a23_0x277f3c(0x21f)](_0x3daa06){const _0x54d191=a23_0x277f3c,{options:_0x278015,args:_0x1152b2,tdx:_0x1c5bd7}=_0x3daa06,_0x4e1bf4=_0x1152b2[0x0]||_0x278015[_0x54d191(0x2c3)];if(!_0x4e1bf4)return showParentSegmentNotSetError(_0x54d191(0x2ac)+'\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;_0x278015[_0x54d191(0x1db)]&&(console[_0x54d191(0x22f)](_0x54d191(0x1ff)+_0x278015['site']),console[_0x54d191(0x22f)]('Parent\x20segment:\x20'+_0x4e1bf4));const _0x41d0d2=await withSpinner(_0x54d191(0x282)+_0x4e1bf4+_0x54d191(0x1d3),()=>_0x1c5bd7['segment'][_0x54d191(0x1e0)](_0x4e1bf4),{'verbose':_0x278015[_0x54d191(0x1db)]}),_0x3247d4=_0x41d0d2[_0x54d191(0x2b8)];console[_0x54d191(0x22f)]('✔\x20Found\x20'+_0x3247d4[_0x54d191(0x1f9)]+_0x54d191(0x28e)+(_0x3247d4[_0x54d191(0x1f9)]!==0x1?'s':''));if(_0x278015['json']||_0x278015['jsonl'])return await handleSDKOutput(_0x3247d4,_0x278015),0x0;return displayFieldsHumanReadable(_0x3247d4,_0x4e1bf4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x27c);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x261);async[a23_0x277f3c(0x21f)](_0x341dd3){const _0xa70fde=a23_0x277f3c,{options:_0x39f364,args:_0x52f6ff,tdx:_0x4a335c}=_0x341dd3,_0x4eefc9=_0x39f364,_0x4bbf8f=_0x52f6ff[0x0]||_0x39f364[_0xa70fde(0x2c3)];if(!_0x4bbf8f)return showParentSegmentNotSetError(_0xa70fde(0x1eb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0xa70fde(0x285)+_0xa70fde(0x249)),0x1;_0x39f364['verbose']&&(console[_0xa70fde(0x22f)](_0xa70fde(0x1ff)+_0x39f364[_0xa70fde(0x278)]),console['error'](_0xa70fde(0x2eb)+_0x4bbf8f));const _0x2bbc05=await withSpinner(_0xa70fde(0x232)+_0x4bbf8f+'\x27...',()=>_0x4a335c[_0xa70fde(0x1d8)][_0xa70fde(0x2bd)](_0x4bbf8f),{'verbose':_0x39f364[_0xa70fde(0x1db)]}),_0x497869=_0x2bbc05[_0xa70fde(0x2b8)];if(_0x4eefc9[_0xa70fde(0x2b0)]){const _0x400641=getConsoleNextUrl(_0x4eefc9[_0xa70fde(0x278)],_0xa70fde(0x26c)+_0x497869['id']);return console[_0xa70fde(0x22f)](a23_0x3b54b8[_0xa70fde(0x264)]('✔')+_0xa70fde(0x2b7)+a23_0x3b54b8[_0xa70fde(0x1e6)](_0x400641)),openBrowser(_0x400641),0x0;}return await handleSingleObjectOutput(_0x497869,_0x39f364),0x0;}}function a23_0x31ab(_0x241fd4,_0x5cf95b){_0x241fd4=_0x241fd4-0x1ce;const _0x1c3770=a23_0x1c37();let _0x31ab54=_0x1c3770[_0x241fd4];return _0x31ab54;}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x23f);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2a1);async[a23_0x277f3c(0x21f)](_0x49e697){const _0x3a5ac9=a23_0x277f3c,{options:_0xbce695,args:_0x1833ac,tdx:_0x177ab6}=_0x49e697,_0x5c8981=_0x1833ac[0x0]||_0xbce695[_0x3a5ac9(0x2c3)];if(!_0x5c8981)return showParentSegmentNotSetError(_0x3a5ac9(0x1f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0xbce695['verbose']&&(console[_0x3a5ac9(0x22f)](_0x3a5ac9(0x1ff)+_0xbce695[_0x3a5ac9(0x278)]),console[_0x3a5ac9(0x22f)]('Parent\x20segment:\x20'+_0x5c8981));const _0x8d97f5=await withSpinner(_0x3a5ac9(0x213)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6['segment'][_0x3a5ac9(0x2ba)](_0x5c8981),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0xff61bd=_0x8d97f5['data'],_0x495d4c=await withSpinner(_0x3a5ac9(0x234)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6[_0x3a5ac9(0x1d8)]['getParentSQL'](_0xff61bd),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0x1e31f2=await executeSchemaQuery(_0x495d4c['data'],_0x177ab6,_0xbce695);return await handleQueryOutput(_0x1e31f2,_0xbce695),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x266);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x271);async['execute'](_0x5cd95c){const _0x1e9126=a23_0x277f3c,{options:_0x10bc91,args:_0x527a9f,tdx:_0xa18cbe}=_0x5cd95c,_0x2bf3c3=_0x527a9f[0x0]||_0x10bc91[_0x1e9126(0x2c3)];if(!_0x2bf3c3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x10bc91['verbose']&&(console[_0x1e9126(0x22f)](_0x1e9126(0x1ff)+_0x10bc91[_0x1e9126(0x278)]),console['error'](_0x1e9126(0x2eb)+_0x2bf3c3));const _0x35212f=await withSpinner(_0x1e9126(0x213)+_0x2bf3c3+_0x1e9126(0x1d3),()=>_0xa18cbe['segment'][_0x1e9126(0x2ba)](_0x2bf3c3),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x23ec4a=_0x35212f[_0x1e9126(0x2b8)],_0xa868b4=await withSpinner(_0x1e9126(0x234)+_0x2bf3c3+'\x27...',()=>_0xa18cbe[_0x1e9126(0x1d8)][_0x1e9126(0x29f)](_0x23ec4a),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x46cdf2=_0xa868b4[_0x1e9126(0x2b8)];return _0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x22d)||_0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x26a)?await handleSDKOutput([{'sql':_0x46cdf2}],_0x10bc91):console[_0x1e9126(0x1da)](_0x46cdf2),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2f6);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x239);async[a23_0x277f3c(0x21f)](_0xa6d296){const _0x27885f=a23_0x277f3c,{options:_0x1ca982,args:_0x376c8e,tdx:_0x42c33a}=_0xa6d296,_0x5c30be=_0x376c8e[0x0]||_0x1ca982['parentSegment'];if(!_0x5c30be)return showParentSegmentNotSetError(_0x27885f(0x268)+'\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;_0x1ca982[_0x27885f(0x1db)]&&(console['error'](_0x27885f(0x1ff)+_0x1ca982[_0x27885f(0x278)]),console[_0x27885f(0x22f)](_0x27885f(0x2eb)+_0x5c30be));const _0x47c22e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c30be+_0x27885f(0x1d3),()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x2ba)](_0x5c30be),{'verbose':_0x1ca982[_0x27885f(0x1db)]}),_0x52dca3=_0x47c22e['data'],_0x530267=await withSpinner(_0x27885f(0x234)+_0x5c30be+'\x27...',()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x29f)](_0x52dca3),{'verbose':_0x1ca982[_0x27885f(0x1db)]});let _0x3459d9=_0x530267['data'];const _0xe9946c=resolveLimit(_0x1ca982['limit'],DEFAULT_DISPLAY_LIMIT),_0x896dc1=/\bLIMIT\s+\d+/i[_0x27885f(0x26b)](_0x3459d9);!_0x896dc1&&(_0x3459d9=_0x3459d9['trim']()[_0x27885f(0x29c)](/;+$/,''),_0x3459d9=_0x27885f(0x27b)+_0x3459d9+_0x27885f(0x25c)+_0xe9946c);_0x1ca982[_0x27885f(0x1db)]&&console[_0x27885f(0x22f)](_0x27885f(0x222)+_0x3459d9);const _0x51bb1e=await withProgressSpinner(_0x27885f(0x1e4),async _0x321a57=>{const _0x5d5586=_0x27885f,_0x487dff=await _0x42c33a[_0x5d5586(0x205)][_0x5d5586(0x21f)](_0x3459d9,{'catalog':'td','schema':'information_schema','onJobId':_0x347d53=>{const _0x836db6=_0x5d5586;_0x321a57[_0x836db6(0x21d)](_0x347d53);}});return _0x487dff;},{'verbose':_0x1ca982['verbose']}),_0x4c7b1d=_0x51bb1e[_0x27885f(0x2b8)],_0x20c28c=_0x4c7b1d[_0x27885f(0x211)]?_0x27885f(0x25b)+_0x4c7b1d[_0x27885f(0x211)]+']':'';return console[_0x27885f(0x22f)](_0x27885f(0x1cf)+_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x227)]['toLocaleString']()+_0x27885f(0x206)+(_0x27885f(0x283)+formatElapsed(_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x280)])+_0x20c28c)),await handleQueryOutput(_0x4c7b1d,_0x1ca982),0x0;}}
|
|
@@ -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_0x205caa=a24_0x4d45;(function(_0x2ba375,_0xa86f72){const _0x3653be=a24_0x4d45,_0x50c2c4=_0x2ba375();while(!![]){try{const _0x35cf78=-parseInt(_0x3653be(0x205))/0x1+parseInt(_0x3653be(0x209))/0x2*(parseInt(_0x3653be(0x216))/0x3)+parseInt(_0x3653be(0x204))/0x4*(-parseInt(_0x3653be(0x201))/0x5)+parseInt(_0x3653be(0x21f))/0x6+-parseInt(_0x3653be(0x1e0))/0x7+-parseInt(_0x3653be(0x1ea))/0x8+parseInt(_0x3653be(0x228))/0x9;if(_0x35cf78===_0xa86f72)break;else _0x50c2c4['push'](_0x50c2c4['shift']());}catch(_0x1a41e0){_0x50c2c4['push'](_0x50c2c4['shift']());}}}(a24_0x50c7,0xdb0be));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_0x5f2b90 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_0x5bba62 from'prompts';function a24_0x50c7(){const _0x4716a0=['\x27\x20does\x20not\x20exist.','password','log','customSite','Create\x20a\x20new\x20profile','join','\x27\x20created','profile','tdx.json','Default\x20profile\x20set\x20to:\x20','\x20Profile\x20\x27','377607CMQzFe','push','us01','Enter\x20profile\x20name:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','value','\x27\x20requires\x20API\x20key\x20validation.','create','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3227910CLomOB','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','logLevel','apiKey','\x20\x20-\x20','parent_segment','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Remove\x20a\x20profile','29378223nSYExe','includes','llm_project','\x0aAvailable\x20profiles:','confirm','profile:set','Enter\x20your\x20TD\x20API\x20key:','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSetup\x20cancelled','Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','select','VALID_KEYS','getUserInfo','name','error','\x20\x20tdx\x20--profile\x20','text','Enter\x20site\x20name:','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','site','test','✗\x20Validation\x20failed:\x20','profile:use','Validating\x20API\x20key...','split','red','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>','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','session','Site\x20was\x20not\x20changed.','(cleared)','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','trim','eu01','bold','default','7697095yLrzKI','dim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us\x20\x20\x20-\x20United\x20States','ap02\x20-\x20Korea','/app/mp/ak','findIndex','jp\x20\x20\x20-\x20Japan','execute','yellow','6368600kEyZVR','tdx:\x20profile\x20set','jp01','Failed\x20to\x20remove\x20profile:\x20','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','other','(session:\x20','Site\x20name\x20cannot\x20be\x20empty','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','message','warn','validate','profileName','profile:remove','email','length','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20create','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','green','jobs','11635APTudu','toString','eu\x20\x20\x20-\x20Europe','796dIjnbK','672154xrBLle','Removal\x20cancelled','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','2zwtgCt','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.'];a24_0x50c7=function(){return _0x4716a0;};return a24_0x50c7();}import a24_0x5b98b0 from'chalk';function validateProfileName(_0x27d465){const _0xfc8579=a24_0x4d45;if(!_0x27d465||!_0x27d465[_0xfc8579(0x1dc)]())return _0xfc8579(0x1bd);const _0xee8c49=_0x27d465['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0xfc8579(0x1cc)](_0xee8c49))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0xee8c49))return _0xfc8579(0x1bc)+_0xee8c49+_0xfc8579(0x20a);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x205caa(0x220)]=a24_0x205caa(0x20f);async['execute'](_0x266516){const _0x2685bc=a24_0x205caa,{options:_0x2fb768,args:_0x5a74cb}=_0x266516;console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1de)](_0x2685bc(0x1fd)));let _0x5a7eeb;if(_0x5a74cb[_0x2685bc(0x1fb)]>0x0&&_0x5a74cb[0x0]){const _0x1bc143=_0x5a74cb[0x0][_0x2685bc(0x1dc)](),_0x55e10a=validateProfileName(_0x1bc143);if(_0x55e10a!==!![])return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x55e10a)),0x1;_0x5a7eeb=_0x1bc143;}else{const _0x8bd24=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x1f8),'message':_0x2685bc(0x219),'validate':validateProfileName});if(!_0x8bd24[_0x2685bc(0x1f8)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;_0x5a7eeb=_0x8bd24['profileName'][_0x2685bc(0x1dc)]();}const _0x5b694b=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x220),'message':_0x2685bc(0x1c6)}),_0xf28d44=_0x5b694b[_0x2685bc(0x220)]?.['trim']()||undefined,_0x20003b=_0x2fb768[_0x2685bc(0x1cb)]||_0x2685bc(0x218),_0x348e01=[{'title':_0x2685bc(0x1e3),'value':_0x2685bc(0x218)},{'title':_0x2685bc(0x1e7),'value':_0x2685bc(0x1ec)},{'title':_0x2685bc(0x203),'value':_0x2685bc(0x1dd)},{'title':_0x2685bc(0x1e4),'value':'ap02'}];let _0x891e62=_0x348e01[_0x2685bc(0x1e6)](_0x37adcb=>_0x37adcb[_0x2685bc(0x21b)]===_0x20003b);_0x891e62===-0x1&&_0x20003b!==_0x2685bc(0x218)&&(_0x348e01[_0x2685bc(0x217)]({'title':_0x20003b,'value':_0x20003b}),_0x891e62=_0x348e01[_0x2685bc(0x1fb)]-0x1);_0x348e01[_0x2685bc(0x217)]({'title':_0x2685bc(0x1b9),'value':_0x2685bc(0x1f0)});const _0x3f621a=await a24_0x5bba62({'type':_0x2685bc(0x1be),'name':'site','message':_0x2685bc(0x1fe)+_0x5a7eeb+'\x27:','choices':_0x348e01,'initial':_0x891e62>=0x0?_0x891e62:0x0});if(!_0x3f621a[_0x2685bc(0x1cb)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;let _0x3567b1;if(_0x3f621a[_0x2685bc(0x1cb)]===_0x2685bc(0x1f0)){const _0x1d261a=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':'customSite','message':_0x2685bc(0x1c5),'initial':_0x2685bc(0x218),'validate':_0xc5a508=>{const _0x28e780=_0x2685bc;if(!_0xc5a508||!_0xc5a508['trim']())return _0x28e780(0x1f2);if(!/^[a-z0-9-]+$/[_0x28e780(0x1cc)](_0xc5a508['trim']()))return _0x28e780(0x1c9);return!![];}});if(!_0x1d261a['customSite'])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;_0x3567b1=_0x1d261a[_0x2685bc(0x20e)];}else _0x3567b1=_0x3f621a['site'];const _0x13731f=resolveSite(_0x3567b1);console[_0x2685bc(0x20d)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x13731f),console[_0x2685bc(0x20d)](_0x2685bc(0x22f)),console[_0x2685bc(0x20d)]('\x20\x20'+getConsoleUrl(_0x13731f,_0x2685bc(0x1e5)));const _0x2ba9ad=await a24_0x5bba62({'type':_0x2685bc(0x20c),'name':_0x2685bc(0x223),'message':_0x2685bc(0x22e),'validate':_0x50b282=>{const _0x5e584b=_0x2685bc;if(!_0x50b282||!_0x50b282[_0x5e584b(0x1dc)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2ba9ad[_0x2685bc(0x223)])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;const _0x34eea9=_0x2ba9ad[_0x2685bc(0x223)];console[_0x2685bc(0x20d)](_0x2685bc(0x1cf));try{const _0x1ea621=TDX[_0x2685bc(0x21d)]({'site':_0x13731f,'apiKey':_0x34eea9['trim'](),'logLevel':_0x2fb768[_0x2685bc(0x222)]??LogLevel[_0x2685bc(0x1d3)]}),_0x3d3387=await _0x1ea621[_0x2685bc(0x200)]['getUserInfo']();console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d3387[_0x2685bc(0x1fa)]+')');const _0xc7d0b1=await isKeychainAvailable();_0xc7d0b1?(await saveAPIKeyAsync(_0x34eea9[_0x2685bc(0x1dc)](),_0x13731f,_0x5a7eeb),console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+_0x2685bc(0x1ef)+_0x5a7eeb+')')):(console['warn'](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1c8))),console[_0x2685bc(0x1f6)](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1d4))));const _0x38922e={'site':_0x13731f,..._0xf28d44&&{'description':_0xf28d44}};return saveProfileToUserConfig(_0x5a7eeb,_0x38922e),console['log'](a24_0x5b98b0['green']('✓')+'\x20Profile\x20\x27'+_0x5a7eeb+_0x2685bc(0x211)),console[_0x2685bc(0x20d)](),console['log'](_0x2685bc(0x1ca)),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+_0x2685bc(0x1da)),0x0;}catch(_0x2168f3){if(_0x2168f3 instanceof HTTPClientError&&_0x2168f3[_0x2685bc(0x207)]===0x191)return printAuthError(_0x2168f3),0x1;return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x2685bc(0x1cd)+(_0x2168f3 instanceof Error?_0x2168f3[_0x2685bc(0x1f5)]:String(_0x2168f3)))),console[_0x2685bc(0x1c2)](_0x2685bc(0x208)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1f9);[a24_0x205caa(0x220)]=a24_0x205caa(0x227);[a24_0x205caa(0x1f7)](_0x4ceb69){const _0x2c13bc=a24_0x205caa,{args:_0x59ca9f}=_0x4ceb69;if(_0x59ca9f[_0x2c13bc(0x1fb)]===0x0)return _0x2c13bc(0x1d6);return undefined;}async[a24_0x205caa(0x1e8)](_0x2a7928){const _0x334238=a24_0x205caa,{args:_0x341c0b}=_0x2a7928,_0xfda6c3=_0x341c0b[0x0];console['log'](a24_0x5b98b0['bold'](_0x334238(0x230)));if(!profileExists(_0xfda6c3)){console['error'](a24_0x5b98b0['red'](_0x334238(0x1bc)+_0xfda6c3+_0x334238(0x20b))),console[_0x334238(0x20d)](_0x334238(0x22b));const _0x2f80a7=listProfiles();if(_0x2f80a7[_0x334238(0x1fb)]===0x0)console[_0x334238(0x20d)](_0x334238(0x1b8));else for(const _0x10a981 of _0x2f80a7){console[_0x334238(0x20d)]('\x20\x20-\x20'+_0x10a981[_0x334238(0x1c1)]);}return 0x1;}const _0x21e342=await a24_0x5bba62({'type':_0x334238(0x22c),'name':_0x334238(0x22c),'message':_0x334238(0x1ba)+_0xfda6c3+'\x27?','initial':![]});if(!_0x21e342['confirm'])return console[_0x334238(0x20d)](_0x334238(0x206)),0x0;try{removeProfileFromUserConfig(_0xfda6c3),console[_0x334238(0x20d)](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x215)+_0xfda6c3+_0x334238(0x1fc));}catch(_0x407956){return console[_0x334238(0x1c2)](a24_0x5b98b0['red'](_0x334238(0x1ed)+(_0x407956 instanceof Error?_0x407956[_0x334238(0x1f5)]:String(_0x407956)))),0x1;}const _0x1db22d=await isKeychainAvailable();if(_0x1db22d){const _0x231490=await deleteKeychainAPIKey(_0xfda6c3);_0x231490&&console['log'](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x221));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x22d);[a24_0x205caa(0x220)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x205caa(0x1bf)]=['site',a24_0x205caa(0x1ee),a24_0x205caa(0x225),a24_0x205caa(0x22a),'llm_agent','description'];[a24_0x205caa(0x1f7)](_0x2d8ce0){const _0x491e4a=a24_0x205caa,{args:_0x32fb7f,options:_0x25e9ba}=_0x2d8ce0,_0x4b47cc=_0x25e9ba[_0x491e4a(0x212)]||getActiveProfile();if(!_0x4b47cc)return _0x491e4a(0x1d2);if(_0x32fb7f[_0x491e4a(0x1fb)]===0x0)return _0x491e4a(0x21e)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const _0x8e921=_0x32fb7f[0x0];if(!_0x8e921[_0x491e4a(0x229)]('='))return _0x491e4a(0x1e2)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const [_0x9a8212]=_0x8e921[_0x491e4a(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x491e4a(0x1bf)][_0x491e4a(0x229)](_0x9a8212))return'Unknown\x20key\x20\x27'+_0x9a8212+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');return undefined;}async[a24_0x205caa(0x1e8)](_0x3cc1e6){const _0x1f3339=a24_0x205caa,{args:_0x5870f1,options:_0x3f07d7}=_0x3cc1e6,_0x86ef11=_0x3f07d7[_0x1f3339(0x212)]||getActiveProfile(),[_0x6ad09f,..._0x2a3023]=_0x5870f1[0x0][_0x1f3339(0x1d0)]('='),_0x526f92=_0x2a3023[_0x1f3339(0x210)]('=');console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1de)](_0x1f3339(0x1eb)));if(!profileExists(_0x86ef11)){const _0x811cbb=await a24_0x5bba62({'type':_0x1f3339(0x22c),'name':'create','message':_0x1f3339(0x1bc)+_0x86ef11+_0x1f3339(0x1f4),'initial':!![]});if(!_0x811cbb[_0x1f3339(0x21d)])return console[_0x1f3339(0x20d)]('Operation\x20cancelled'),0x1;}const _0x580526=loadProfile(_0x86ef11),_0x27df9e=_0x580526?.[_0x1f3339(0x1db)]||{};if(_0x6ad09f===_0x1f3339(0x1cb)){const _0x57c9b2=resolveSite(_0x526f92);console[_0x1f3339(0x20d)](_0x1f3339(0x1c7)+_0x57c9b2+_0x1f3339(0x21c)),console[_0x1f3339(0x20d)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1f3339(0x20d)]('\x20\x20'+getConsoleUrl(_0x57c9b2,_0x1f3339(0x1e5)));const _0x5e3451=await a24_0x5bba62({'type':_0x1f3339(0x20c),'name':_0x1f3339(0x223),'message':_0x1f3339(0x21a),'validate':_0x20d0de=>{if(!_0x20d0de||!_0x20d0de['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5e3451[_0x1f3339(0x223)])return console[_0x1f3339(0x20d)]('\x0aOperation\x20cancelled'),0x1;console[_0x1f3339(0x20d)](_0x1f3339(0x1cf));try{const _0x32a455=TDX['create']({'site':_0x57c9b2,'apiKey':_0x5e3451['apiKey'][_0x1f3339(0x1dc)](),'logLevel':_0x3f07d7[_0x1f3339(0x222)]??LogLevel['ERROR']}),_0x3c8928=await _0x32a455[_0x1f3339(0x200)][_0x1f3339(0x1c0)]();console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x1d5)+_0x3c8928[_0x1f3339(0x1fa)]+')');const _0x9d7bac=await isKeychainAvailable();_0x9d7bac?(await saveAPIKeyAsync(_0x5e3451['apiKey']['trim'](),_0x57c9b2,_0x86ef11),console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x226))):console[_0x1f3339(0x1f6)](a24_0x5b98b0[_0x1f3339(0x1e9)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x27df9e[_0x1f3339(0x1cb)]=_0x57c9b2;}catch(_0x140676){if(_0x140676 instanceof HTTPClientError&&_0x140676['status']===0x191)return printAuthError(_0x140676),0x1;return console['error'](a24_0x5b98b0[_0x1f3339(0x1d1)](_0x1f3339(0x1cd)+(_0x140676 instanceof Error?_0x140676['message']:String(_0x140676)))),console[_0x1f3339(0x1c2)](_0x1f3339(0x1d8)),0x1;}}else _0x27df9e[_0x6ad09f]=_0x526f92||undefined;return saveProfileToUserConfig(_0x86ef11,_0x27df9e),console['log'](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+'\x20Profile\x20\x27'+_0x86ef11+'\x27\x20updated:\x20'+_0x6ad09f+'='+(_0x526f92||_0x1f3339(0x1d9))),0x0;}}function a24_0x4d45(_0x360aab,_0x51a32e){_0x360aab=_0x360aab-0x1b8;const _0x50c7fd=a24_0x50c7();let _0x4d458f=_0x50c7fd[_0x360aab];return _0x4d458f;}export class ProfileUseCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1ce);[a24_0x205caa(0x220)]=a24_0x205caa(0x1f3);['validate'](_0x5a909f){const _0xd81bac=a24_0x205caa,{args:_0x2c26e0}=_0x5a909f;if(_0x2c26e0[_0xd81bac(0x1fb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x205caa(0x1e8)](_0x2e301c){const _0x4972bc=a24_0x205caa,{args:_0x3980d1,options:_0xc9ebe9}=_0x2e301c,_0x3dc70b=_0x3980d1[0x0],_0x2aac15=_0xc9ebe9[_0x4972bc(0x1df)];cleanExpiredSessions();if(!profileExists(_0x3dc70b)){console[_0x4972bc(0x1c2)](a24_0x5b98b0[_0x4972bc(0x1d1)](_0x4972bc(0x1bc)+_0x3dc70b+_0x4972bc(0x20b))),console[_0x4972bc(0x20d)]('\x0aAvailable\x20profiles:');const _0x189dda=listProfiles();if(_0x189dda[_0x4972bc(0x1fb)]===0x0)console[_0x4972bc(0x20d)](_0x4972bc(0x1b8));else for(const _0x351b01 of _0x189dda){console['log'](_0x4972bc(0x224)+_0x351b01[_0x4972bc(0x1c1)]);}return 0x1;}if(_0x2aac15){const _0x725665=a24_0x5f2b90[_0x4972bc(0x210)](getConfigDir(),_0x4972bc(0x213));return saveActiveProfileToUserConfig(_0x3dc70b),console['log'](_0x4972bc(0x214)+a24_0x5b98b0[_0x4972bc(0x1ff)](_0x3dc70b)),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aSaved\x20to:\x20'+_0x725665)),0x0;}const _0x22a78a=_0xc9ebe9[_0x4972bc(0x1d7)]||getCurrentSessionPID()[_0x4972bc(0x202)]();return saveSessionContext({'profile':_0x3dc70b},_0xc9ebe9[_0x4972bc(0x1d7)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x5b98b0['green'](_0x3dc70b)+'\x20'+a24_0x5b98b0[_0x4972bc(0x1e1)](_0x4972bc(0x1f1)+_0x22a78a+')')),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3dc70b+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a25_0x216c0c=a25_0x3ba0;function a25_0x3ba0(_0x97c13b,_0x47f9a5){_0x97c13b=_0x97c13b-0xd8;const _0x1be61c=a25_0x1be6();let _0x3ba077=_0x1be61c[_0x97c13b];return _0x3ba077;}(function(_0x33c8c3,_0xe8fa97){const _0x49e5ad=a25_0x3ba0,_0x4a04dd=_0x33c8c3();while(!![]){try{const _0x333efa=-parseInt(_0x49e5ad(0xdd))/0x1*(parseInt(_0x49e5ad(0xd8))/0x2)+parseInt(_0x49e5ad(0xe2))/0x3+-parseInt(_0x49e5ad(0xe7))/0x4+parseInt(_0x49e5ad(0xe4))/0x5*(-parseInt(_0x49e5ad(0xe6))/0x6)+-parseInt(_0x49e5ad(0xdc))/0x7*(-parseInt(_0x49e5ad(0xe0))/0x8)+parseInt(_0x49e5ad(0xdb))/0x9+parseInt(_0x49e5ad(0xea))/0xa*(parseInt(_0x49e5ad(0xdf))/0xb);if(_0x333efa===_0xe8fa97)break;else _0x4a04dd['push'](_0x4a04dd['shift']());}catch(_0x329f42){_0x4a04dd['push'](_0x4a04dd['shift']());}}}(a25_0x1be6,0x676cb));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{['name']='profiles';[a25_0x216c0c(0xec)]=a25_0x216c0c(0xe5);async['execute'](_0x37b531){const _0x1a279e=a25_0x216c0c,{options:_0x52c0d9}=_0x37b531;try{const _0x56b46a=listProfiles(),_0x3eea7f=getActiveProfile();if(_0x56b46a[_0x1a279e(0xeb)]===0x0)return console[_0x1a279e(0xde)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x1a279e(0xed)),console['log'](_0x1a279e(0xe1)),0x0;const _0x2fea1a=_0x56b46a['map'](_0x124688=>{const _0x5b8a88=_0x1a279e,_0x1bbaea=_0x124688[_0x5b8a88(0xe3)]===_0x3eea7f,_0x4fc05a=getProfileParams(_0x124688[_0x5b8a88(0xe9)]);return{'name':_0x124688[_0x5b8a88(0xe3)],'active':_0x1bbaea,'scope':_0x124688[_0x5b8a88(0xe8)],'description':_0x124688[_0x5b8a88(0xe9)][_0x5b8a88(0xec)]||'','params':_0x4fc05a};});return await handleSDKOutput(_0x2fea1a,_0x52c0d9),0x0;}catch(_0x906d4d){return _0x906d4d instanceof Error&&console[_0x1a279e(0xda)]('Error:\x20'+_0x906d4d[_0x1a279e(0xd9)]),0x1;}}}function a25_0x1be6(){const _0x4d75e9=['config','152980jSDnNp','length','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','37010IldXiw','message','error','862983cgceKb','7KixLRh','45jWGOzG','log','1221UbILmI','848440xbgOLX','\x20\x20Global:\x20~/.config/tdx/tdx.json','663255CnYfKK','name','889135LvYCTi','List\x20all\x20available\x20profiles','12XkJsZV','2036396RbTdjY','scope'];a25_0x1be6=function(){return _0x4d75e9;};return a25_0x1be6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a26_0x4402e4=a26_0x2b6a;(function(_0x554d54,_0x3ff54e){const _0xfcd5c6=a26_0x2b6a,_0x1495a8=_0x554d54();while(!![]){try{const _0x99ba8a=parseInt(_0xfcd5c6(0xe6))/0x1+parseInt(_0xfcd5c6(0xdf))/0x2+-parseInt(_0xfcd5c6(0x101))/0x3*(-parseInt(_0xfcd5c6(0xe9))/0x4)+-parseInt(_0xfcd5c6(0xff))/0x5+parseInt(_0xfcd5c6(0xf2))/0x6+-parseInt(_0xfcd5c6(0xf8))/0x7*(parseInt(_0xfcd5c6(0xdc))/0x8)+parseInt(_0xfcd5c6(0x103))/0x9*(-parseInt(_0xfcd5c6(0xe5))/0xa);if(_0x99ba8a===_0x3ff54e)break;else _0x1495a8['push'](_0x1495a8['shift']());}catch(_0x4042be){_0x1495a8['push'](_0x1495a8['shift']());}}}(a26_0x2cb9,0xaa4f7));function a26_0x2b6a(_0x2504f1,_0x182040){_0x2504f1=_0x2504f1-0xda;const _0x2cb9de=a26_0x2cb9();let _0x2b6ac4=_0x2cb9de[_0x2504f1];return _0x2b6ac4;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a26_0x2cb9(){const _0x4d23ad=['15xPbbVp','\x20[Job\x20ID:\x20','88227PJHOiC','Executing\x20query...','processedRows','error','totalSplits','in\x20','catalog','Executing\x20statement\x20','options','length','jobId','setJobId','7408tmUzfq','Error:\x20','Site:\x20','922800hqupqH','database','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','data','file','1010RxtPQR','1057411xLgpQq','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','name','712688MLlEPq','elapsedTimeMillis','args','\x20rows\x20','Schema:\x20','query','Query\x20completed:\x20Processed\x20','Catalog:\x20','execute','4458978KYiIXg','verbose','No\x20SQL\x20provided','Statement\x20','completedSplits','site','7385gdtcTj','SQL:\x20','output','Run\x20Trino\x20queries\x20(streaming)','validate','\x20splits','stats','2441050LoLTuE','push'];a26_0x2cb9=function(){return _0x4d23ad;};return a26_0x2cb9();}export class QueryCommand extends BaseCommand{[a26_0x4402e4(0xe8)]=a26_0x4402e4(0xee);['description']=a26_0x4402e4(0xfb);async[a26_0x4402e4(0xf1)](_0x5073f0){const _0x259bd0=a26_0x4402e4,{options:_0x5e7855,args:_0x278ec9,tdx:_0x3d080d}=_0x5073f0,_0x23ab52=_0x278ec9[0x0],_0x16a31a=_0x5e7855[_0x259bd0(0xe4)];let _0x802af2;try{if(_0x16a31a)_0x802af2=readSqlStatementsFromFile(_0x16a31a);else{if(_0x23ab52==='-')_0x802af2=await readSqlStatementsFromStdin();else{if(_0x23ab52&&isSqlFilePath(_0x23ab52))_0x802af2=readSqlStatementsFromFile(_0x23ab52);else{if(_0x23ab52)_0x802af2=splitSqlStatements(_0x23ab52);else throw new Error(_0x259bd0(0xf4));}}}}catch(_0x4d9ffc){return console[_0x259bd0(0x106)](_0x259bd0(0xdd)+_0x4d9ffc['message']),0x1;}const _0x2dee46=_0x5e7855[_0x259bd0(0xe0)]||'information_schema',_0x2197d6=_0x5e7855[_0x259bd0(0x109)];try{const _0x457641=[],_0x4cd6fa=!!_0x5e7855[_0x259bd0(0xfa)];for(let _0x49d0a0=0x0;_0x49d0a0<_0x802af2[_0x259bd0(0x10c)];_0x49d0a0++){const _0x21d951=_0x802af2[_0x49d0a0],_0x85d2ff=_0x49d0a0+0x1,_0x19573e=_0x802af2[_0x259bd0(0x10c)],_0x6ff6cc=_0x19573e>0x1;_0x5e7855[_0x259bd0(0xf3)]&&(console[_0x259bd0(0x106)]('\x0a'+(_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+':':'')),console[_0x259bd0(0x106)](_0x259bd0(0xde)+_0x5e7855[_0x259bd0(0xf7)]),console[_0x259bd0(0x106)](_0x259bd0(0xf0)+(_0x2197d6||'td')),console['error'](_0x259bd0(0xed)+_0x2dee46),console['error'](_0x259bd0(0xf9)+_0x21d951));const _0x1e6f43=_0x6ff6cc?_0x259bd0(0x10a)+_0x85d2ff+'/'+_0x19573e+'...':_0x259bd0(0x104);try{const _0x4e93b8=await withProgressSpinner(_0x1e6f43,async _0x5d9dc6=>{const _0x4758d0=await _0x3d080d['query']['execute'](_0x21d951,{'catalog':_0x2197d6,'schema':_0x2dee46,'onJobId':_0x4c91bc=>{const _0x817481=a26_0x2b6a;_0x5d9dc6[_0x817481(0xdb)](_0x4c91bc);},'onProgress':_0x5b7a68=>{const _0x460a05=a26_0x2b6a;_0x5d9dc6['setPhase']('Executing\x20query\x20['+_0x5b7a68['state']+']'),_0x5d9dc6['setExtra'](formatRows(_0x5b7a68['processedRows'])+_0x460a05(0xec)+_0x5b7a68[_0x460a05(0xf6)]+'/'+_0x5b7a68[_0x460a05(0x107)]+_0x460a05(0xfd));}});return _0x4758d0;},{'verbose':_0x5e7855[_0x259bd0(0xf3)]}),_0x57eadc=_0x4e93b8[_0x259bd0(0xe3)],_0x52696d=_0x57eadc['jobId']?_0x259bd0(0x102)+_0x57eadc[_0x259bd0(0xda)]+']':'',_0x2fe8f3=_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+_0x259bd0(0xe2):'';console['error']('✔\x20'+_0x2fe8f3+_0x259bd0(0xef)+formatRows(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0x105)])+_0x259bd0(0xec)+(_0x259bd0(0x108)+formatElapsed(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0xea)])+_0x52696d));if(_0x6ff6cc&&_0x4cd6fa){const _0x53a5d6=resolveOutputOptions(_0x5e7855),_0x588a10=await formatQueryOutput(_0x57eadc,_0x53a5d6);_0x457641[_0x259bd0(0x100)](_0x588a10);}else await handleQueryOutput(_0x57eadc,_0x5e7855);}catch(_0x81ecb3){const _0x582818=_0x6ff6cc?'Statement\x20'+_0x85d2ff+'/'+_0x19573e+':\x0a':'',_0xa7cfb6=_0x81ecb3 instanceof SDKError?_0x81ecb3['originalMessage']:_0x81ecb3['message'];return console[_0x259bd0(0x106)](''+_0x582818+_0xa7cfb6),0x1;}}if(_0x802af2[_0x259bd0(0x10c)]>0x1&&_0x4cd6fa&&_0x457641['length']>0x0){const _0x2deea8=_0x457641['join']('\x0a');writeFileSync(_0x5e7855['output'],_0x2deea8),console['error'](_0x259bd0(0xe1)+_0x5e7855[_0x259bd0(0xfa)]);}return 0x0;}catch(_0x493cd6){throw _0x493cd6;}}[a26_0x4402e4(0xfc)](_0xfc7ddc){const _0x68fb88=a26_0x4402e4,_0x29d776=_0xfc7ddc[_0x68fb88(0xeb)][0x0],_0x30bee6=_0xfc7ddc[_0x68fb88(0x10b)][_0x68fb88(0xe4)];if(!_0x29d776&&!_0x30bee6)return _0x68fb88(0xe7);if(_0x29d776&&_0x30bee6)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|