@treasuredata/tdx 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.d.ts +14 -3
- package/dist/commands/chat-command.d.ts.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/chat-command.js.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.d.ts +4 -4
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/llm.d.ts +1 -0
- package/dist/sdk/types/llm.d.ts.map +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x46b216=a22_0xd58f;(function(_0xddd773,_0x5f0453){const _0x2142e9=a22_0xd58f,_0x1b3907=_0xddd773();while(!![]){try{const _0x5a709e=-parseInt(_0x2142e9(0x1e9))/0x1*(parseInt(_0x2142e9(0x2e5))/0x2)+parseInt(_0x2142e9(0x2cb))/0x3+parseInt(_0x2142e9(0x21e))/0x4*(-parseInt(_0x2142e9(0x207))/0x5)+-parseInt(_0x2142e9(0x2d5))/0x6+-parseInt(_0x2142e9(0x26d))/0x7*(parseInt(_0x2142e9(0x30c))/0x8)+-parseInt(_0x2142e9(0x2c2))/0x9*(-parseInt(_0x2142e9(0x2e4))/0xa)+-parseInt(_0x2142e9(0x238))/0xb*(-parseInt(_0x2142e9(0x2c4))/0xc);if(_0x5a709e===_0x5f0453)break;else _0x1b3907['push'](_0x1b3907['shift']());}catch(_0x47625a){_0x1b3907['push'](_0x1b3907['shift']());}}}(a22_0x328c,0xe4ad3));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x487f45 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a22_0x328c(){const _0x3e16f0=['all','segment:parent:push','addAttributes','query','List\x20available\x20fields\x20for\x20segmentation','yes','✘\x20Failed\x20to\x20rename\x20directory:\x20','sort','Listing\x20fields\x20for\x20\x27','pushParentYaml','segment:parent:fields','toLocaleString','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','rowCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','createParent','\x20--attribute\x20\x22','Fetching\x20SQL\x20for\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Found\x20YAML\x20file:\x20','jsonl','map','customerPercent','toLowerCase','match','description','segment:parent:sql','Validating\x20configuration...','data','Master\x20+\x20Attributes','customers','To\x20cancel:','Error:\x20Parent\x20segment\x20name\x20is\x20required','allValid','Apply\x20changes\x20to\x20\x27','jobId','\x0aChanges\x20to\x20apply\x20to\x20\x27','audienceId','Enriched:','start','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20--interval\x20','displayMasterInfo','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','column','segment:parent:validate','timezone','Database:\x20','interval','%)\x20','Options\x20(one\x20required):\x0a','\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','stop','dirname','getParentFull','SQL\x20query:\x0a','Fetching\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20No\x20sample\x20data\x20available','segment:parent:desc','customerGroup','Pattern:\x20','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','execute','string','segment:parent:list','displayPreviewResults','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','run','\x20--behavior\x20\x22','joinKey','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','displayAttributesStats','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment','162xRaMmZ','👥\x20','38992476gizDRD','\x20[Job\x20ID:\x20','✔\x20No\x20changes\x20-\x20\x27','scheduleOption','Fetching\x20customers\x20schema...','coveragePercent','\x20Configuration\x20is\x20valid','1059900ryARlF','cyan','use','\x20\x20Database:\x20','\x20=\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20rows\x20','`\x20to\x20download\x20the\x20configuration\x20first','sampleData','listFields','10370286jrhNAa','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','table','Schema\x20saved\x20to\x20','segment:parent:show','darwin','displayValidateResults','\x27\x20is\x20already\x20up\x20to\x20date','displaySummary','reduce','Join:','Get\x20SQL\x20query\x20for\x20parent\x20segment','Events:','Overwrite\x20\x27','786340WqjWdn','406gWvspj','Columns:','Analyzing\x20changes...','filter','List\x20parent\x20segments','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','segment:parent:update','\x22,\x20\x22type\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','listParents','matchedCount','getBehaviorNames','double','column_type','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','trim','No\x20parent\x20segments\x20match\x20pattern:\x20','information_schema','length','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20tdx\x20wf\x20attempt\x20','addAttributesFile','setJobId','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','errors','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','behaviors','\x20rows)','Updated','pullParentYaml','Site:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','scheduleType','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Creating','addBehaviorsFile','\x0aNew\x20parent\x20segment\x20\x27','Master\x20Table','4488fMtRyv','label','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','message','\x0aChanges\x20to\x20\x27','behaviorsFile','status','FINISHED','Created','\x0aNo\x20sample\x20data\x20available','database','in\x20','limit','schemaValid','displayColumns','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','segment:parent:preview','ignore','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','platform','replace','Updating','formatSchemaJson','\x0a\x20\x20]\x0a}\x0a','Options:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error:\x20File\x20not\x20found:\x20','Attributes','.customers)','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x0aUsage:\x20tdx\x20ps\x20preview\x20','log','type','\x20behaviors','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Fetching\x20sample\x20data...','columns','/attempt/','processedRows','master','YAML\x20file:\x20','segment:parent:pull','displayPreviewHints','477GXsCvJ','Errors:','\x20--enriched','join','Preview:','Error\x20reading\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Parent\x20segment:\x20','segment:parent:run','Creating\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:create','\x27\x20is\x20up\x20to\x20date','/\x20→\x20','✔\x20Query\x20completed:\x20Processed\x20','utf-8','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayBehaviorsStats','yellow','enriched','\x20\x20\x20\x20-\x20','Source:','Error:\x20--database\x20and\x20--table\x20are\x20required','.yml','test','output','Behaviors','toFixed','/\x20and\x20','behavior','7595WTRHnU','Customers:','workflowSessionId','\x20parent\x20segment\x20\x27','parentSegment','Master:','attributes','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','varchar','\x0aError:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','localeCompare','Resolving\x20parent\x20segment\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','\x0a✔\x20Workflow\x20started','isDirectory','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','runParent','Join\x20on:','workflowAttemptId','Error\x20parsing\x20YAML:\x20','resolveParentId','endsWith','4108XbjSkF','\x20field','\x27...','getOutputDatabaseName','text','population','verbose','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Create\x20parent\x20segment\x20\x27','push','name','repeat','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Attribute:','/sessions/','totalEvents','Fetching\x20behavior\x20list...','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','validateParentYaml','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','green','11NeZgil','.yaml','Error:','behavior_','displaySampleData','json','attribute','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x27\x20and\x20run\x20workflow?','keys','Available\x20behaviors:','attributesFile','Table:\x20','unref','Aborted.','✔\x20Found\x20','parent_segment','\x20Context\x20set:\x20','Rows:','/\x20directory.\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','collectSchema','open','tdx\x20segment\x20parent\x20preview\x20','\x0a\x20\x20\x20\x20}','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','format','Available\x20attributes:','\x20--attribute\x20\x22<name>\x22','site','stats','Options:\x0a','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','getParentSQL','bold','Validate:','/app/workflows/','addBehaviors','customersWithEvents','schemaError','Output\x20Database:','\x20Opening\x20','\x0a⚠️\x20\x20Both\x20','Coverage:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','/app/dw/parentSegments/','previewParentYaml','customerGroupFile','8687CjEmzY','apply','foreignKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','error','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a'];a22_0x328c=function(){return _0x3e16f0;};return a22_0x328c();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x3237f9 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a22_0x46b216(0x248);function openBrowser(_0x54ed21){const _0x1d3910=a22_0x46b216,_0x2f7135=process[_0x1d3910(0x31f)],_0x5f1f75=_0x2f7135===_0x1d3910(0x2db)?_0x1d3910(0x24e):_0x2f7135==='win32'?_0x1d3910(0x29a):'xdg-open';spawn(_0x5f1f75,[_0x54ed21],{'detached':!![],'stdio':_0x1d3910(0x31d)})[_0x1d3910(0x245)]();}function migrateLegacyDirectory(){const _0x57b9cd=a22_0x46b216;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x86c9a8=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x86c9a8[_0x57b9cd(0x216)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x57b9cd(0x271)](a22_0x3237f9['yellow'](_0x57b9cd(0x266)+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x205)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console['error'](a22_0x3237f9[_0x57b9cd(0x253)](_0x57b9cd(0x217)+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x24b))),![];console[_0x57b9cd(0x271)](a22_0x3237f9[_0x57b9cd(0x1fb)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x57b9cd(0x1f6)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x57b9cd(0x271)](a22_0x3237f9['green'](_0x57b9cd(0x235)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x264f7e){const _0x25eadc=_0x264f7e instanceof Error?_0x264f7e[_0x57b9cd(0x30f)]:String(_0x264f7e);return console[_0x57b9cd(0x271)](a22_0x3237f9['red'](_0x57b9cd(0x279)+_0x25eadc+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x46b216(0x2bb)](_0x48a010){const _0x406e81=a22_0x46b216;return migrateLegacyDirectory(),super[_0x406e81(0x2bb)](_0x48a010);}}function resolveYamlFile(_0x5ce5e2){const _0x3628e1=a22_0x46b216;if(_0x5ce5e2[_0x3628e1(0x21d)](_0x3628e1(0x200))||_0x5ce5e2[_0x3628e1(0x21d)](_0x3628e1(0x239)))return _0x5ce5e2;return a22_0x487f45[_0x3628e1(0x1ec)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5ce5e2)+_0x3628e1(0x200));}function formatProgressMessage(_0x138aaa){const _0x96c1cf=a22_0x46b216,_0x4bf42d=_0x138aaa[_0x96c1cf(0x28b)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4bf42d){const [,_0x28b0d9,_0x49d883,_0x12f883='']=_0x4bf42d;return a22_0x3237f9[_0x96c1cf(0x253)](_0x28b0d9+':')+'\x20'+_0x49d883+a22_0x3237f9[_0x96c1cf(0x253)](_0x12f883);}return a22_0x3237f9[_0x96c1cf(0x253)](_0x138aaa);}function showFileNotFoundError(_0xdcb4ff,_0x129a7b){const _0x2536df=a22_0x46b216;console[_0x2536df(0x271)](a22_0x3237f9[_0x2536df(0x2b3)](_0x2536df(0x326)+_0xdcb4ff+'\x0a')),console['error'](a22_0x3237f9['cyan'](_0x2536df(0x2ea)+_0x129a7b+_0x2536df(0x2d2)));}function showParentSegmentNotSetError(_0x2939e9){const _0x8f6367=a22_0x46b216;console[_0x8f6367(0x271)](a22_0x3237f9['yellow'](_0x8f6367(0x24c))),console[_0x8f6367(0x271)](_0x2939e9);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2b7);['description']=a22_0x46b216(0x2e9);async[a22_0x46b216(0x2b5)](_0x12a67){const _0x1cf8aa=a22_0x46b216,{options:_0x10697f,args:_0x361d7c,tdx:_0x3bf7f8}=_0x12a67,_0x58f1d3=_0x361d7c[0x0];_0x10697f[_0x1cf8aa(0x224)]&&(console[_0x1cf8aa(0x271)](_0x1cf8aa(0x304)+_0x10697f['site']),_0x58f1d3&&console['error'](_0x1cf8aa(0x2b2)+_0x58f1d3));const _0x1a95e8=await withSpinner(_0x58f1d3?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x58f1d3+_0x1cf8aa(0x220):'Listing\x20parent\x20segments...',()=>_0x3bf7f8[_0x1cf8aa(0x2c1)][_0x1cf8aa(0x2ee)](),{'verbose':_0x10697f['verbose']});let _0xd3824f=_0x1a95e8['data'];if(_0x58f1d3){const _0x57e0cb=_0x58f1d3[_0x1cf8aa(0x320)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x1cf8aa(0x320)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2c2a0c=new RegExp('^'+_0x57e0cb+'$','i');_0xd3824f=_0xd3824f[_0x1cf8aa(0x2e8)](_0x1355ef=>_0x2c2a0c['test'](_0x1355ef[_0x1cf8aa(0x20d)]['name']));}_0xd3824f[_0x1cf8aa(0x27a)]((_0x1605fd,_0x49fc2e)=>_0x1605fd[_0x1cf8aa(0x20d)][_0x1cf8aa(0x228)][_0x1cf8aa(0x212)](_0x49fc2e[_0x1cf8aa(0x20d)]['name'])),console[_0x1cf8aa(0x271)](_0x1cf8aa(0x247)+_0xd3824f[_0x1cf8aa(0x2f8)]+'\x20parent\x20segment'+(_0xd3824f[_0x1cf8aa(0x2f8)]!==0x1?'s':''));const _0x2da5a3=_0x6b6894=>{const _0x3e9520=_0x1cf8aa;return getConsoleNextUrl(_0x10697f[_0x3e9520(0x259)],'/app/dw/parentSegments/'+_0x6b6894);};if(_0x10697f['format']===_0x1cf8aa(0x23d)||_0x10697f[_0x1cf8aa(0x256)]===_0x1cf8aa(0x287)){const _0x109fa5=_0xd3824f[_0x1cf8aa(0x288)](_0x3f911b=>({..._0x3f911b,'url':_0x2da5a3(_0x3f911b['id'])}));await handleSDKOutput(_0x109fa5,_0x10697f);}else{if(_0xd3824f[_0x1cf8aa(0x2f8)]===0x0)_0x58f1d3?console[_0x1cf8aa(0x32b)](_0x1cf8aa(0x2f6)+_0x58f1d3):console['log'](_0x1cf8aa(0x233));else for(const _0xf04947 of _0xd3824f){const _0x3be9ac=_0xf04947[_0x1cf8aa(0x20d)][_0x1cf8aa(0x223)]?a22_0x3237f9[_0x1cf8aa(0x253)]('\x20('+formatRows(_0xf04947[_0x1cf8aa(0x20d)][_0x1cf8aa(0x223)])+')'):'',_0x5e8116=hyperlink(_0xf04947['attributes'][_0x1cf8aa(0x228)],_0x2da5a3(_0xf04947['id']));console[_0x1cf8aa(0x32b)](_0x1cf8aa(0x2c3)+_0x5e8116+_0x3be9ac);}}return 0x0;}}function a22_0xd58f(_0x3cc5bb,_0x4cce81){_0x3cc5bb=_0x3cc5bb-0x1e6;const _0x328c9d=a22_0x328c();let _0xd58f27=_0x328c9d[_0x3cc5bb];return _0xd58f27;}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x1f4);[a22_0x46b216(0x28c)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x46b216(0x2b5)](_0x4e506c){const _0x7f8d0d=a22_0x46b216,{options:_0x4d1f72,args:_0x345834,tdx:_0x52d377}=_0x4e506c;console[_0x7f8d0d(0x271)](_0x7f8d0d(0x2f3)+_0x7f8d0d(0x254)+_0x7f8d0d(0x272));const _0x130754=_0x4d1f72;if(_0x345834[_0x7f8d0d(0x2f8)]===0x0)return console[_0x7f8d0d(0x271)](a22_0x3237f9[_0x7f8d0d(0x2b3)](_0x7f8d0d(0x293))),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x31e)),0x1;const _0x54683d=_0x345834[0x0];if(!_0x130754[_0x7f8d0d(0x316)]||!_0x130754[_0x7f8d0d(0x2d8)])return console['error'](_0x7f8d0d(0x1ff)),console['error'](_0x7f8d0d(0x31e)),0x1;_0x130754[_0x7f8d0d(0x224)]&&(console[_0x7f8d0d(0x271)](_0x7f8d0d(0x304)+_0x130754[_0x7f8d0d(0x259)]),console[_0x7f8d0d(0x271)]('Name:\x20'+_0x54683d),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x2a2)+_0x130754[_0x7f8d0d(0x316)]),console[_0x7f8d0d(0x271)](_0x7f8d0d(0x244)+_0x130754[_0x7f8d0d(0x2d8)]));const _0xa9b4dd=await loadJSONFromOptions(_0x130754[_0x7f8d0d(0x20d)],_0x130754[_0x7f8d0d(0x243)]),_0x2a51fd=await loadJSONFromOptions(_0x130754[_0x7f8d0d(0x300)],_0x130754[_0x7f8d0d(0x311)]),_0x2f57f2=await loadJSONFromOptions(_0x130754['customerGroup'],_0x130754[_0x7f8d0d(0x26c)]),_0x1b1345={'name':_0x54683d,'description':_0x130754[_0x7f8d0d(0x28c)],'scheduleType':_0x130754[_0x7f8d0d(0x306)],'scheduleOption':_0x130754['scheduleOption'],'timezone':_0x130754[_0x7f8d0d(0x2a1)],'master':{'parentDatabaseName':_0x130754[_0x7f8d0d(0x316)],'parentTableName':_0x130754[_0x7f8d0d(0x2d8)]},'attributes':_0xa9b4dd,'behaviors':_0x2a51fd,'customerGroup':_0x2f57f2},_0x4e859a=await withSpinner(_0x7f8d0d(0x1f2)+_0x54683d+_0x7f8d0d(0x220),()=>_0x52d377[_0x7f8d0d(0x2c1)][_0x7f8d0d(0x282)](_0x1b1345),{'verbose':_0x4d1f72['verbose']}),_0x374def=_0x4e859a['data'];return console[_0x7f8d0d(0x271)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x374def[_0x7f8d0d(0x228)]+'\x27\x20with\x20ID:\x20'+_0x374def['id']),await handleSDKOutput([_0x374def],_0x4d1f72),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2eb);[a22_0x46b216(0x28c)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x46b216(0x2b5)](_0x968a8c){const _0x4ec12b=a22_0x46b216,{options:_0x6efe74,args:_0x2c9527,tdx:_0x3cec37}=_0x968a8c;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4ec12b(0x272));const _0x4713ee=_0x6efe74;if(_0x2c9527[_0x4ec12b(0x2f8)]===0x0)return console[_0x4ec12b(0x271)](a22_0x3237f9[_0x4ec12b(0x2b3)](_0x4ec12b(0x293))),console['error'](_0x4ec12b(0x2ff)),0x1;const _0x5899c9=_0x2c9527[0x0];_0x4713ee[_0x4ec12b(0x224)]&&(console[_0x4ec12b(0x271)](_0x4ec12b(0x304)+_0x4713ee[_0x4ec12b(0x259)]),console[_0x4ec12b(0x271)](_0x4ec12b(0x1f0)+_0x5899c9));const _0x152c3d=await withSpinner(_0x4ec12b(0x214)+_0x5899c9+_0x4ec12b(0x220),()=>_0x3cec37['segment'][_0x4ec12b(0x2aa)](_0x5899c9),{'verbose':_0x4713ee[_0x4ec12b(0x224)]}),_0x365308=_0x152c3d[_0x4ec12b(0x28f)],_0x1b0475=await loadJSONFromOptions(_0x4713ee[_0x4ec12b(0x275)],_0x4713ee[_0x4ec12b(0x2fb)]),_0x274fc6=await loadJSONFromOptions(_0x4713ee[_0x4ec12b(0x261)],_0x4713ee[_0x4ec12b(0x309)]),_0x246603={'name':_0x365308[_0x4ec12b(0x228)],'description':_0x4713ee[_0x4ec12b(0x28c)]!==undefined?_0x4713ee['description']:_0x365308['description'],'scheduleType':_0x4713ee['scheduleType']!==undefined?_0x4713ee['scheduleType']:_0x365308['scheduleType'],'scheduleOption':_0x4713ee[_0x4ec12b(0x2c7)]!==undefined?_0x4713ee[_0x4ec12b(0x2c7)]:_0x365308['scheduleOption'],'timezone':_0x4713ee[_0x4ec12b(0x2a1)]!==undefined?_0x4713ee[_0x4ec12b(0x2a1)]:_0x365308['timezone'],'master':_0x365308[_0x4ec12b(0x334)],'attributes':_0x1b0475?[..._0x365308[_0x4ec12b(0x20d)]||[],..._0x1b0475]:_0x365308[_0x4ec12b(0x20d)],'behaviors':_0x274fc6?[..._0x365308[_0x4ec12b(0x300)]||[],..._0x274fc6]:_0x365308['behaviors'],'customerGroup':_0x365308[_0x4ec12b(0x2b1)]},_0x481c69=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x5899c9+_0x4ec12b(0x220),()=>_0x3cec37[_0x4ec12b(0x2c1)]['updateParent'](_0x5899c9,_0x246603),{'verbose':_0x4713ee[_0x4ec12b(0x224)]}),_0x75ec24=_0x481c69[_0x4ec12b(0x28f)];return console[_0x4ec12b(0x271)](_0x4ec12b(0x2b9)+_0x75ec24[_0x4ec12b(0x228)]+'\x27'),await handleSDKOutput([_0x75ec24],_0x4713ee),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x1e7);[a22_0x46b216(0x28c)]=a22_0x46b216(0x329);async[a22_0x46b216(0x2b5)](_0xe675be){const _0x41f15c=a22_0x46b216,{options:_0x1e6547,args:_0x5c8f52,tdx:_0xcb81a0}=_0xe675be,_0x43b7ef=_0x1e6547,_0x43d412=_0x5c8f52[0x0]||_0x1e6547[_0x41f15c(0x20b)];if(!_0x43d412)return showParentSegmentNotSetError(_0x41f15c(0x2f9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x43b7ef[_0x41f15c(0x2cd)]&&_0x43b7ef['output'])return console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x2b3)](_0x41f15c(0x2c0))),console['error'](a22_0x3237f9['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x253)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x41f15c(0x271)](a22_0x3237f9['cyan'](_0x41f15c(0x268))),0x1;const _0x278231=_0x43b7ef[_0x41f15c(0x202)]||a22_0x487f45[_0x41f15c(0x1ec)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x43d412)+'.yml');_0x43b7ef[_0x41f15c(0x224)]&&(console[_0x41f15c(0x271)](_0x41f15c(0x304)+_0x43b7ef['site']),console[_0x41f15c(0x271)](_0x41f15c(0x1f0)+_0x43d412),console[_0x41f15c(0x271)]('Output\x20file:\x20'+_0x278231));const _0x3b892d=await withSpinner(_0x41f15c(0x2ac)+_0x43d412+'\x27...',()=>_0xcb81a0['segment'][_0x41f15c(0x303)](_0x43d412),{'verbose':_0x43b7ef['verbose']}),_0x17695d=_0x3b892d[_0x41f15c(0x28f)];if(existsSync(_0x278231)){const _0x36d36a=readFileSync(_0x278231,_0x41f15c(0x1f8)),_0x2d9837=generateDiff(_0x36d36a,_0x17695d);if(!hasChanges(_0x2d9837))console['error'](a22_0x3237f9[_0x41f15c(0x237)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x3237f9[_0x41f15c(0x2cc)](_0x278231)+_0x41f15c(0x2a6));else{console['error'](_0x41f15c(0x310)+_0x278231+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x2d9837)),console['error']('─'[_0x41f15c(0x229)](0x3c));if(!_0x43b7ef['yes']){if(!isInteractive())return console[_0x41f15c(0x271)](a22_0x3237f9['red'](_0x41f15c(0x210)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x253)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xa512b3=await confirmKey(_0x41f15c(0x2e3)+_0x278231+'\x27?');if(!_0xa512b3)return console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x1fb)](_0x41f15c(0x246))),0x1;}writeFileSync(_0x278231,_0x17695d,_0x41f15c(0x1f8)),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x237)]('✔')+_0x41f15c(0x325)+a22_0x3237f9[_0x41f15c(0x2cc)](_0x278231));}}else{const _0xc33baa=a22_0x487f45[_0x41f15c(0x2a9)](_0x278231);!existsSync(_0xc33baa)&&mkdirSync(_0xc33baa,{'recursive':!![]}),writeFileSync(_0x278231,_0x17695d,_0x41f15c(0x1f8)),console[_0x41f15c(0x271)](a22_0x3237f9[_0x41f15c(0x237)]('✔')+_0x41f15c(0x325)+a22_0x3237f9['cyan'](_0x278231));}return saveSessionContext({'parent_segment':_0x43d412},_0x43b7ef['session']),console[_0x41f15c(0x271)](a22_0x3237f9['green']('✔')+_0x41f15c(0x249)+a22_0x3237f9[_0x41f15c(0x253)]('parent_segment')+_0x41f15c(0x2cf)+a22_0x3237f9['cyan'](_0x43d412)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x274);[a22_0x46b216(0x28c)]=a22_0x46b216(0x32f);async['execute'](_0x592e08){const _0xfedcd9=a22_0x46b216,{options:_0x34ecaa,args:_0x593901,tdx:_0x45f823}=_0x592e08,_0x6d758=_0x34ecaa,_0x36b203=_0x593901[0x0]||_0x34ecaa[_0xfedcd9(0x20b)];if(!_0x36b203)return showParentSegmentNotSetError(_0xfedcd9(0x2f4)+_0xfedcd9(0x281)),0x1;const _0x29ec4e=resolveYamlFile(_0x36b203);if(!existsSync(_0x29ec4e))return showFileNotFoundError(_0x29ec4e,_0x36b203),0x1;_0x6d758[_0xfedcd9(0x224)]&&(console[_0xfedcd9(0x271)](_0xfedcd9(0x304)+_0x6d758['site']),console[_0xfedcd9(0x271)](_0xfedcd9(0x1e6)+_0x29ec4e));let _0x43540b;try{_0x43540b=readFileSync(_0x29ec4e,_0xfedcd9(0x1f8));}catch(_0x34727e){const _0x8e76a6=_0x34727e instanceof Error?_0x34727e['message']:String(_0x34727e);return console['error'](_0xfedcd9(0x1ee)+_0x8e76a6),0x1;}const _0x351ae1=await withSpinner(_0xfedcd9(0x2e7),()=>_0x45f823['segment']['pushParentYaml'](_0x43540b),{'verbose':_0x6d758['verbose']}),_0xcc388a=_0x351ae1[_0xfedcd9(0x28f)],{isNew:_0x4d9455,name:_0x2af3ab,hasChanges:_0x41c2ae,diffFormatted:_0x56ec1b}=_0xcc388a;if(!_0x41c2ae)return console[_0xfedcd9(0x271)](_0xfedcd9(0x2c6)+_0x2af3ab+_0xfedcd9(0x2dd)),0x0;_0x4d9455?console[_0xfedcd9(0x271)](_0xfedcd9(0x30a)+_0x2af3ab+'\x27:'):console[_0xfedcd9(0x271)](_0xfedcd9(0x297)+_0x2af3ab+'\x27:');console[_0xfedcd9(0x271)]('─'[_0xfedcd9(0x229)](0x3c)),console[_0xfedcd9(0x271)](_0x56ec1b),console[_0xfedcd9(0x271)]('─'[_0xfedcd9(0x229)](0x3c));const _0x338fc4=_0x4d9455?_0xfedcd9(0x226)+_0x2af3ab+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x2af3ab+'\x27?';if(!_0x6d758[_0xfedcd9(0x278)]){if(!isInteractive())return console[_0xfedcd9(0x271)](a22_0x3237f9['red'](_0xfedcd9(0x210)),_0xfedcd9(0x20e)),console[_0xfedcd9(0x271)](a22_0x3237f9[_0xfedcd9(0x253)](_0xfedcd9(0x251))),0x1;const _0x55d728=await confirmKey(_0x338fc4);if(!_0x55d728)return console[_0xfedcd9(0x271)](a22_0x3237f9['yellow'](_0xfedcd9(0x246))),0x1;}const _0x2380bf=_0x4d9455?_0xfedcd9(0x308):_0xfedcd9(0x321),_0x2c4e61=await withSpinner(_0x2380bf+_0xfedcd9(0x20a)+_0x2af3ab+'\x27...',()=>_0xcc388a[_0xfedcd9(0x26e)](),{'verbose':_0x6d758['verbose']}),_0x22df3e=_0x2c4e61[_0xfedcd9(0x28f)],_0x5bbf82=getConsoleNextUrl(_0x6d758[_0xfedcd9(0x259)],_0xfedcd9(0x26a)+_0x22df3e['id']),_0xfc1975=_0x4d9455?'Created':_0xfedcd9(0x302);return console['error']('✔\x20'+_0xfc1975+'\x20parent\x20segment\x20\x27'+_0x22df3e['name']+'\x27'),console['error']('\x20\x20'+_0x5bbf82),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x2a0);[a22_0x46b216(0x28c)]=a22_0x46b216(0x1f9);async[a22_0x46b216(0x2b5)](_0x442fd0){const _0x59520f=a22_0x46b216,{options:_0x263b9e,args:_0x19a36d,tdx:_0x5ef384}=_0x442fd0,_0x423f81=_0x263b9e,_0x6554e4=_0x19a36d[0x0]||_0x263b9e[_0x59520f(0x20b)];if(!_0x6554e4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+'\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'+_0x59520f(0x211)+_0x59520f(0x30e)),0x1;const _0x4fef69=resolveYamlFile(_0x6554e4);if(!existsSync(_0x4fef69))return showFileNotFoundError(_0x4fef69,_0x6554e4),0x1;_0x423f81[_0x59520f(0x224)]&&(console[_0x59520f(0x271)](_0x59520f(0x304)+_0x423f81['site']),console[_0x59520f(0x271)]('YAML\x20file:\x20'+_0x4fef69));let _0x5d41b7;try{_0x5d41b7=readFileSync(_0x4fef69,_0x59520f(0x1f8));}catch(_0xe1d9d0){const _0x1481f7=_0xe1d9d0 instanceof Error?_0xe1d9d0['message']:String(_0xe1d9d0);return console[_0x59520f(0x271)]('Error\x20reading\x20file:\x20'+_0x1481f7),0x1;}const _0x2dd73f=createCommandSpinner(a22_0x3237f9['dim'](_0x59520f(0x28e)),{'verbose':_0x423f81[_0x59520f(0x224)]});_0x2dd73f[_0x59520f(0x29a)]();const _0x5e855c={'onProgress':_0x926242=>{const _0x323b85=_0x59520f;_0x2dd73f[_0x323b85(0x222)]=formatProgressMessage(_0x926242);}};if(_0x423f81[_0x59520f(0x334)])_0x5e855c[_0x59520f(0x334)]=!![];if(_0x423f81['enriched'])_0x5e855c[_0x59520f(0x1fc)]=!![];_0x423f81[_0x59520f(0x23e)]&&(_0x5e855c[_0x59520f(0x23e)]=_0x423f81[_0x59520f(0x23e)]);_0x423f81['behavior']&&(_0x5e855c[_0x59520f(0x206)]=_0x423f81['behavior']);if(_0x423f81[_0x59520f(0x2a3)])_0x5e855c['interval']=_0x423f81[_0x59520f(0x2a3)];let _0x307820;try{_0x307820=await _0x5ef384[_0x59520f(0x2c1)][_0x59520f(0x231)](_0x5d41b7,_0x5e855c),_0x2dd73f[_0x59520f(0x2a8)]();}catch(_0x142aac){_0x2dd73f[_0x59520f(0x2a8)]();throw _0x142aac;}const _0x30e109=_0x423f81[_0x59520f(0x2a3)]||'-1d';return this['displayValidateResults'](_0x307820,_0x5e855c,_0x4fef69,_0x30e109),_0x307820[_0x59520f(0x294)]?0x0:0x1;}[a22_0x46b216(0x2dc)](_0x58927e,_0x2ac168,_0x497b38,_0x234647){const _0x40d826=a22_0x46b216;console[_0x40d826(0x271)]('\x0a'+a22_0x3237f9[_0x40d826(0x25e)](_0x40d826(0x25f))+'\x20'+_0x58927e[_0x40d826(0x228)]),console[_0x40d826(0x271)]('═'[_0x40d826(0x229)](0x3c)),this[_0x40d826(0x29d)](_0x58927e);if(typeof _0x2ac168['attribute']==='string'){this[_0x40d826(0x2bf)](_0x58927e),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x23e),_0x2ac168['attribute']);return;}if(_0x2ac168[_0x40d826(0x23e)]===!![]){this[_0x40d826(0x2bf)](_0x58927e),this['displaySummary'](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x20d));return;}if(typeof _0x2ac168[_0x40d826(0x206)]==='string'){this['displayBehaviorsStats'](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x206),_0x2ac168['behavior']);return;}if(_0x2ac168[_0x40d826(0x206)]===!![]){this[_0x40d826(0x1fa)](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x300));return;}this['displayAttributesStats'](_0x58927e),this[_0x40d826(0x1fa)](_0x58927e,_0x234647),this[_0x40d826(0x2de)](_0x58927e),this[_0x40d826(0x1e8)](_0x497b38,_0x234647,_0x40d826(0x273));}[a22_0x46b216(0x1e8)](_0x41caf7,_0x96bffc,_0xf0bbdb,_0x1ffce4){const _0x177e1d=a22_0x46b216;console[_0x177e1d(0x271)]('\x0a'+a22_0x3237f9[_0x177e1d(0x253)]('To\x20view\x20sample\x20data:'));const _0x1af936=_0x96bffc!=='-1d'?_0x177e1d(0x29c)+_0x96bffc:'';if(_0xf0bbdb===_0x177e1d(0x23e)&&_0x1ffce4)console['error']('\x20\x20'+a22_0x3237f9['dim'](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x283)+_0x1ffce4+'\x22'+_0x1af936));else{if(_0xf0bbdb===_0x177e1d(0x206)&&_0x1ffce4)console[_0x177e1d(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x2bc)+_0x1ffce4+'\x22'+_0x1af936));else(_0xf0bbdb==='attributes'||_0xf0bbdb==='all')&&console['error']('\x20\x20'+a22_0x3237f9[_0x177e1d(0x253)]('tdx\x20segment\x20parent\x20preview\x20'+_0x41caf7+_0x177e1d(0x258)+_0x1af936));}(_0xf0bbdb===_0x177e1d(0x300)||_0xf0bbdb===_0x177e1d(0x273))&&console['error']('\x20\x20'+a22_0x3237f9['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x41caf7+'\x20--behavior\x20\x22<name>\x22'+_0x1af936)),_0xf0bbdb===_0x177e1d(0x273)&&console[_0x177e1d(0x271)]('\x20\x20'+a22_0x3237f9[_0x177e1d(0x253)](_0x177e1d(0x24f)+_0x41caf7+_0x177e1d(0x1eb)+_0x1af936));}['displayMasterInfo'](_0x1c880d){const _0x167d95=a22_0x46b216,{master:_0x4ff340}=_0x1c880d,_0x2fe5b1=_0x4ff340[_0x167d95(0x319)]?a22_0x3237f9['green']('✔'):a22_0x3237f9['red']('✘');console[_0x167d95(0x271)]('\x0a'+a22_0x3237f9[_0x167d95(0x253)](_0x167d95(0x30b))),console[_0x167d95(0x271)](_0x2fe5b1+'\x20'+a22_0x3237f9[_0x167d95(0x25e)](_0x4ff340['database']+'.'+_0x4ff340[_0x167d95(0x2d8)])),_0x4ff340[_0x167d95(0x319)]?_0x4ff340[_0x167d95(0x280)]!==undefined&&console[_0x167d95(0x271)]('\x20\x20'+a22_0x3237f9[_0x167d95(0x253)](_0x167d95(0x24a))+'\x20'+a22_0x3237f9[_0x167d95(0x2cc)](formatRows(_0x4ff340['rowCount']))):console[_0x167d95(0x271)]('\x20\x20'+a22_0x3237f9[_0x167d95(0x2b3)]('Error:')+'\x20'+_0x4ff340['schemaError']);}['displayAttributesStats'](_0x2a8de5){const _0x7686d0=a22_0x46b216;if(_0x2a8de5[_0x7686d0(0x20d)][_0x7686d0(0x2f8)]===0x0)return;console[_0x7686d0(0x271)]('\x0a'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x327)));for(const _0x233d3f of _0x2a8de5[_0x7686d0(0x20d)]){const _0x5578fa=_0x233d3f['schemaValid']?a22_0x3237f9[_0x7686d0(0x237)]('✔'):a22_0x3237f9[_0x7686d0(0x2b3)]('✘');let _0x3c5481='';if(_0x233d3f[_0x7686d0(0x319)]&&_0x233d3f['matchedCount']!==undefined&&_0x233d3f[_0x7686d0(0x2c9)]!==undefined){const _0x3661eb=_0x233d3f[_0x7686d0(0x2c9)]['toFixed'](0x1),_0x2ee844=_0x233d3f['coveragePercent']>=0x50?a22_0x3237f9[_0x7686d0(0x237)]:_0x233d3f['coveragePercent']>=0x32?a22_0x3237f9['yellow']:a22_0x3237f9['red'];_0x3c5481='\x20'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x267))+'\x20'+_0x2ee844(_0x3661eb+'%')+'\x20('+formatRows(_0x233d3f[_0x7686d0(0x2ef)])+_0x7686d0(0x301);}console[_0x7686d0(0x271)](_0x5578fa+'\x20'+a22_0x3237f9['bold'](_0x233d3f[_0x7686d0(0x228)])+_0x3c5481),console[_0x7686d0(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x7686d0(0x1fe))+'\x20'+a22_0x3237f9['bold'](_0x233d3f['database']+'.'+_0x233d3f[_0x7686d0(0x2d8)]));const _0x5c3c30=_0x233d3f[_0x7686d0(0x2bd)]===_0x233d3f['foreignKey']?a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x219))+'\x20'+_0x233d3f[_0x7686d0(0x2bd)]:a22_0x3237f9['dim'](_0x7686d0(0x2e0))+'\x20'+_0x233d3f[_0x7686d0(0x2bd)]+_0x7686d0(0x2cf)+_0x233d3f[_0x7686d0(0x26f)];console[_0x7686d0(0x271)]('\x20\x20'+_0x5c3c30),console['error']('\x20\x20'+a22_0x3237f9[_0x7686d0(0x253)](_0x7686d0(0x2e6))),this[_0x7686d0(0x31a)](_0x233d3f[_0x7686d0(0x331)]),!_0x233d3f[_0x7686d0(0x319)]&&console[_0x7686d0(0x271)]('\x20\x20'+a22_0x3237f9[_0x7686d0(0x2b3)](_0x7686d0(0x23a))+'\x20'+_0x233d3f[_0x7686d0(0x263)]);}}[a22_0x46b216(0x1fa)](_0x6fbaab,_0x3b4072){const _0x527456=a22_0x46b216;if(_0x6fbaab[_0x527456(0x300)][_0x527456(0x2f8)]===0x0)return;console[_0x527456(0x271)]('\x0a'+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x203))+'\x20'+a22_0x3237f9[_0x527456(0x253)]('('+_0x3b4072+')'));for(const _0x1c4457 of _0x6fbaab['behaviors']){const _0x54ce5d=_0x1c4457[_0x527456(0x319)]?a22_0x3237f9[_0x527456(0x237)]('✔'):a22_0x3237f9['red']('✘');let _0x3bfd7a='';if(_0x1c4457[_0x527456(0x319)]&&_0x1c4457['customersWithEvents']!==undefined&&_0x1c4457[_0x527456(0x22d)]!==undefined){const _0x46691e=_0x1c4457[_0x527456(0x289)]?.[_0x527456(0x204)](0x1)||'?',_0x372e64=(_0x1c4457[_0x527456(0x289)]??0x0)>=0x32?a22_0x3237f9[_0x527456(0x237)]:(_0x1c4457['customerPercent']??0x0)>=0x14?a22_0x3237f9[_0x527456(0x1fb)]:a22_0x3237f9[_0x527456(0x2b3)];_0x3bfd7a='\x20'+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x208))+'\x20'+_0x372e64(formatRows(_0x1c4457[_0x527456(0x262)]))+'\x20('+_0x46691e+_0x527456(0x2a4)+a22_0x3237f9[_0x527456(0x253)](_0x527456(0x2e2))+'\x20'+a22_0x3237f9[_0x527456(0x2cc)](formatRows(_0x1c4457['totalEvents']));}console[_0x527456(0x271)](_0x54ce5d+'\x20'+a22_0x3237f9[_0x527456(0x25e)](_0x1c4457[_0x527456(0x228)])+_0x3bfd7a),console['error']('\x20\x20'+a22_0x3237f9['dim'](_0x527456(0x1fe))+'\x20'+a22_0x3237f9[_0x527456(0x25e)](_0x1c4457[_0x527456(0x316)]+'.'+_0x1c4457['table']));const _0x5ca049=_0x1c4457[_0x527456(0x2bd)]===_0x1c4457['foreignKey']?a22_0x3237f9['dim'](_0x527456(0x219))+'\x20'+_0x1c4457[_0x527456(0x2bd)]:a22_0x3237f9['dim']('Join:')+'\x20'+_0x1c4457['joinKey']+'\x20=\x20'+_0x1c4457['foreignKey'];console['error']('\x20\x20'+_0x5ca049),console[_0x527456(0x271)]('\x20\x20'+a22_0x3237f9['dim'](_0x527456(0x2e6))),this[_0x527456(0x31a)](_0x1c4457[_0x527456(0x331)]),!_0x1c4457[_0x527456(0x319)]&&console[_0x527456(0x271)]('\x20\x20'+a22_0x3237f9[_0x527456(0x2b3)]('Error:')+'\x20'+_0x1c4457['schemaError']);}}[a22_0x46b216(0x31a)](_0x2b51e3){const _0x1660c5=a22_0x46b216;for(const _0x1a0db4 of _0x2b51e3){_0x1a0db4['label']===_0x1a0db4['column']||_0x1a0db4[_0x1660c5(0x29f)]==='*'?console[_0x1660c5(0x271)](_0x1660c5(0x1fd)+_0x1a0db4[_0x1660c5(0x30d)]):console[_0x1660c5(0x271)]('\x20\x20\x20\x20-\x20'+_0x1a0db4[_0x1660c5(0x30d)]+'\x20'+a22_0x3237f9['dim']('('+_0x1a0db4[_0x1660c5(0x29f)]+')'));}}[a22_0x46b216(0x2de)](_0x3df0ab){const _0x3af7ee=a22_0x46b216;console[_0x3af7ee(0x271)]('─'[_0x3af7ee(0x229)](0x3c));if(_0x3df0ab[_0x3af7ee(0x2fe)][_0x3af7ee(0x2f8)]>0x0){console['error']('\x0a'+a22_0x3237f9[_0x3af7ee(0x2b3)](_0x3af7ee(0x1ea)));for(const _0x879ca8 of _0x3df0ab['errors']){console[_0x3af7ee(0x271)]('\x20\x20'+a22_0x3237f9[_0x3af7ee(0x2b3)]('•')+'\x20'+_0x879ca8);}}_0x3df0ab[_0x3af7ee(0x294)]&&console[_0x3af7ee(0x271)]('\x0a'+a22_0x3237f9['green']('✔')+_0x3af7ee(0x2ca));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x31c);['description']=a22_0x46b216(0x230);async[a22_0x46b216(0x2b5)](_0x3b1d2c){const _0xabea6c=a22_0x46b216,{options:_0x134786,args:_0x22d5d7,tdx:_0x9cfede}=_0x3b1d2c,_0xa80af8=_0x134786,_0x1a51f3=_0x22d5d7[0x0]||_0x134786[_0xabea6c(0x20b)];if(!_0x1a51f3)return showParentSegmentNotSetError(_0xabea6c(0x2d6)+_0xabea6c(0x2d7)+_0xabea6c(0x2a5)+_0xabea6c(0x305)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0xabea6c(0x32e)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0xabea6c(0x30e)),0x1;if(!_0xa80af8['master']&&!_0xa80af8['attribute']&&!_0xa80af8[_0xabea6c(0x206)]&&!_0xa80af8[_0xabea6c(0x1fc)])return console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x232))),console['error'](_0xabea6c(0x307)),console['error'](_0xabea6c(0x324)),console[_0xabea6c(0x271)](_0xabea6c(0x285)),console[_0xabea6c(0x271)](_0xabea6c(0x2ad)),console[_0xabea6c(0x271)](_0xabea6c(0x31b)),console['error'](_0xabea6c(0x2d0)),0x1;const _0x51e95b=resolveYamlFile(_0x1a51f3);if(!existsSync(_0x51e95b))return showFileNotFoundError(_0x51e95b,_0x1a51f3),0x1;_0xa80af8[_0xabea6c(0x224)]&&(console['error'](_0xabea6c(0x304)+_0xa80af8[_0xabea6c(0x259)]),console[_0xabea6c(0x271)](_0xabea6c(0x1e6)+_0x51e95b));let _0x291ff0;try{_0x291ff0=readFileSync(_0x51e95b,_0xabea6c(0x1f8));}catch(_0x397aef){const _0x1ef57d=_0x397aef instanceof Error?_0x397aef['message']:String(_0x397aef);return console['error'](_0xabea6c(0x1ee)+_0x1ef57d),0x1;}let _0x1c968a;try{_0x1c968a=parseDef(_0x291ff0);}catch(_0x2ff498){const _0x5dda37=_0x2ff498 instanceof Error?_0x2ff498[_0xabea6c(0x30f)]:String(_0x2ff498);return console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x21b)+_0x5dda37)),0x1;}if(_0xa80af8[_0xabea6c(0x23e)]===!![]||_0xa80af8['attribute']===''){const _0x13762a=_0x1c968a[_0xabea6c(0x20d)]?.[_0xabea6c(0x288)](_0x1b7951=>_0x1b7951[_0xabea6c(0x228)])||[];if(_0x13762a[_0xabea6c(0x2f8)]===0x0)console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x252)));else{console[_0xabea6c(0x271)](a22_0x3237f9['red'](_0xabea6c(0x225))),console[_0xabea6c(0x271)](_0xabea6c(0x257));for(const _0xfe6bf7 of _0x13762a){console[_0xabea6c(0x271)]('\x20\x20'+a22_0x3237f9[_0xabea6c(0x2cc)](_0xfe6bf7));}console[_0xabea6c(0x271)](_0xabea6c(0x32a)+_0x1a51f3+_0xabea6c(0x283)+_0x13762a[0x0]+'\x22');}return 0x1;}if(_0xa80af8['behavior']===!![]||_0xa80af8[_0xabea6c(0x206)]===''){const _0x589fef=_0x1c968a[_0xabea6c(0x300)]?.[_0xabea6c(0x288)](_0x212c9a=>_0x212c9a[_0xabea6c(0x228)])||[];if(_0x589fef[_0xabea6c(0x2f8)]===0x0)console[_0xabea6c(0x271)](a22_0x3237f9['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0xabea6c(0x271)](a22_0x3237f9[_0xabea6c(0x2b3)](_0xabea6c(0x29b))),console[_0xabea6c(0x271)](_0xabea6c(0x242));for(const _0x490c1f of _0x589fef){console[_0xabea6c(0x271)]('\x20\x20'+a22_0x3237f9['cyan'](_0x490c1f));}console[_0xabea6c(0x271)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x1a51f3+_0xabea6c(0x2bc)+_0x589fef[0x0]+'\x22');}return 0x1;}const _0x13a1af=createCommandSpinner(a22_0x3237f9[_0xabea6c(0x253)](_0xabea6c(0x330)),{'verbose':_0xa80af8[_0xabea6c(0x224)]});_0x13a1af[_0xabea6c(0x29a)]();const _0x1f3900={'onProgress':_0x3a9010=>{const _0x4a2dce=_0xabea6c;_0x13a1af[_0x4a2dce(0x222)]=formatProgressMessage(_0x3a9010);}};if(_0xa80af8[_0xabea6c(0x334)])_0x1f3900[_0xabea6c(0x334)]=!![];if(_0xa80af8[_0xabea6c(0x23e)]&&typeof _0xa80af8[_0xabea6c(0x23e)]===_0xabea6c(0x2b6))_0x1f3900[_0xabea6c(0x23e)]=_0xa80af8['attribute'];if(_0xa80af8['behavior']&&typeof _0xa80af8[_0xabea6c(0x206)]===_0xabea6c(0x2b6))_0x1f3900[_0xabea6c(0x206)]=_0xa80af8['behavior'];if(_0xa80af8[_0xabea6c(0x1fc)])_0x1f3900['enriched']=!![];if(_0xa80af8['interval'])_0x1f3900[_0xabea6c(0x2a3)]=_0xa80af8[_0xabea6c(0x2a3)];let _0x2a1462;try{_0x2a1462=await _0x9cfede['segment'][_0xabea6c(0x26b)](_0x291ff0,_0x1f3900),_0x13a1af['stop']();}catch(_0x37bdee){_0x13a1af[_0xabea6c(0x2a8)]();throw _0x37bdee;}return await this['displayPreviewResults'](_0x2a1462,{'master':_0xa80af8[_0xabea6c(0x334)],'attribute':typeof _0xa80af8[_0xabea6c(0x23e)]===_0xabea6c(0x2b6)?_0xa80af8[_0xabea6c(0x23e)]:undefined,'behavior':typeof _0xa80af8['behavior']===_0xabea6c(0x2b6)?_0xa80af8[_0xabea6c(0x206)]:undefined,'enriched':_0xa80af8[_0xabea6c(0x1fc)]}),_0x2a1462[_0xabea6c(0x294)]?0x0:0x1;}async[a22_0x46b216(0x2b8)](_0x357f2c,_0x4eb8af){const _0x5d11a3=a22_0x46b216;console['error']('\x0a'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x5d11a3(0x1ed))+'\x20'+_0x357f2c[_0x5d11a3(0x228)]),console[_0x5d11a3(0x271)]('═'[_0x5d11a3(0x229)](0x3c));if(_0x4eb8af[_0x5d11a3(0x334)]&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x55b15b=a22_0x3237f9['dim'](_0x5d11a3(0x20c))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x357f2c[_0x5d11a3(0x334)][_0x5d11a3(0x316)]+'.'+_0x357f2c['master'][_0x5d11a3(0x2d8)]);await this[_0x5d11a3(0x23c)](_0x55b15b,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af[_0x5d11a3(0x23e)]&&_0x357f2c['sampleData']){const _0xe95e15=a22_0x3237f9['dim'](_0x5d11a3(0x22b))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x4eb8af['attribute']);await this[_0x5d11a3(0x23c)](_0xe95e15,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af['behavior']&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x4965f2=a22_0x3237f9['dim']('Behavior:')+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x4eb8af['behavior']);await this['displaySampleData'](_0x4965f2,_0x357f2c[_0x5d11a3(0x2d3)]);}else{if(_0x4eb8af[_0x5d11a3(0x1fc)]&&_0x357f2c[_0x5d11a3(0x2d3)]){const _0x358f8b=a22_0x3237f9[_0x5d11a3(0x253)](_0x5d11a3(0x299))+'\x20'+a22_0x3237f9[_0x5d11a3(0x25e)](_0x5d11a3(0x290));await this[_0x5d11a3(0x23c)](_0x358f8b,_0x357f2c[_0x5d11a3(0x2d3)]);}else!_0x357f2c[_0x5d11a3(0x2d3)]&&console[_0x5d11a3(0x271)](_0x5d11a3(0x315));}}}if(_0x357f2c[_0x5d11a3(0x2fe)][_0x5d11a3(0x2f8)]>0x0){console[_0x5d11a3(0x271)]('─'[_0x5d11a3(0x229)](0x3c)),console[_0x5d11a3(0x271)]('\x0a'+a22_0x3237f9[_0x5d11a3(0x2b3)](_0x5d11a3(0x1ea)));for(const _0x270dea of _0x357f2c[_0x5d11a3(0x2fe)]){console['error']('\x20\x20'+a22_0x3237f9[_0x5d11a3(0x2b3)]('•')+'\x20'+_0x270dea);}}}async[a22_0x46b216(0x23c)](_0x30edfe,_0x365301){const _0x33ad57=a22_0x46b216;if(_0x365301[_0x33ad57(0x2f8)]===0x0){console[_0x33ad57(0x271)]('\x0a'+_0x30edfe),console[_0x33ad57(0x271)](_0x33ad57(0x2af));return;}console[_0x33ad57(0x271)]('\x0a'+_0x30edfe);const _0x2f4eb5=Object[_0x33ad57(0x241)](_0x365301[0x0])[_0x33ad57(0x288)](_0x409e90=>({'name':_0x409e90,'type':typeof _0x365301[0x0][_0x409e90]==='number'?_0x33ad57(0x2f1):_0x33ad57(0x20f)})),_0x557cec={'queryId':'preview','columns':_0x2f4eb5,'data':_0x365301,'stats':{'state':_0x33ad57(0x313),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x365301[_0x33ad57(0x2f8)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x29b2ed=formatAsTable(_0x557cec,_0x365301[_0x33ad57(0x2f8)],!![]);await writeOutput(_0x29b2ed,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a22_0x46b216(0x1f1);[a22_0x46b216(0x28c)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a22_0x46b216(0x2b5)](_0x47f1a7){const _0xd13702=a22_0x46b216,{options:_0x1d63e8,args:_0x231c50,tdx:_0x1223af}=_0x47f1a7,_0x2e6657=_0x1d63e8,_0x307ec6=_0x231c50[0x0]||_0x1d63e8[_0xd13702(0x20b)];if(!_0x307ec6)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'+_0xd13702(0x270)),0x1;const _0x23143a=resolveYamlFile(_0x307ec6);if(existsSync(_0x23143a)){_0x2e6657['verbose']&&console[_0xd13702(0x271)](_0xd13702(0x286)+_0x23143a);let _0x598467;try{_0x598467=readFileSync(_0x23143a,_0xd13702(0x1f8));}catch(_0x2738d0){const _0x8a9242=_0x2738d0 instanceof Error?_0x2738d0[_0xd13702(0x30f)]:String(_0x2738d0);return console[_0xd13702(0x271)]('Error\x20reading\x20file:\x20'+_0x8a9242),0x1;}const _0xfd4f68=await withSpinner('Analyzing\x20changes...',()=>_0x1223af[_0xd13702(0x2c1)][_0xd13702(0x27c)](_0x598467),{'verbose':_0x2e6657[_0xd13702(0x224)]}),_0x4c86aa=_0xfd4f68[_0xd13702(0x28f)],{isNew:_0x192a17,name:_0x44ed70,hasChanges:_0xd5b08f,diffFormatted:_0x44536e}=_0x4c86aa;if(_0xd5b08f){_0x192a17?console[_0xd13702(0x271)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x44ed70+'\x27:'):console[_0xd13702(0x271)](_0xd13702(0x297)+_0x44ed70+'\x27:');console['error']('─'[_0xd13702(0x229)](0x3c)),console[_0xd13702(0x271)](_0x44536e),console[_0xd13702(0x271)]('─'[_0xd13702(0x229)](0x3c));const _0x498016=_0x192a17?'Create\x20parent\x20segment\x20\x27'+_0x44ed70+_0xd13702(0x240):_0xd13702(0x295)+_0x44ed70+_0xd13702(0x240);if(!_0x2e6657[_0xd13702(0x278)]){if(!isInteractive())return console[_0xd13702(0x271)](a22_0x3237f9[_0xd13702(0x2b3)]('\x0aError:'),_0xd13702(0x20e)),console[_0xd13702(0x271)](a22_0x3237f9[_0xd13702(0x253)](_0xd13702(0x251))),0x1;const _0x4efd2c=await confirmKey(_0x498016);if(!_0x4efd2c)return console['error'](a22_0x3237f9[_0xd13702(0x1fb)]('Aborted.')),0x1;}const _0x284517=_0x192a17?_0xd13702(0x308):'Updating';await withSpinner(_0x284517+_0xd13702(0x20a)+_0x44ed70+_0xd13702(0x220),()=>_0x4c86aa['apply'](),{'verbose':_0x2e6657['verbose']});const _0x78cb47=_0x192a17?_0xd13702(0x314):'Updated';console[_0xd13702(0x271)]('✔\x20'+_0x78cb47+'\x20parent\x20segment\x20\x27'+_0x44ed70+'\x27');}else console['error'](_0xd13702(0x2c6)+_0x44ed70+_0xd13702(0x1f5));}const _0x47e784=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x307ec6+_0xd13702(0x220),()=>_0x1223af[_0xd13702(0x2c1)][_0xd13702(0x218)](_0x307ec6),{'verbose':_0x2e6657[_0xd13702(0x224)]}),_0x28e746=_0x47e784[_0xd13702(0x28f)],_0x219b1d=getConsoleUrl(_0x2e6657['site'],_0xd13702(0x260)+_0x28e746['workflowId']+_0xd13702(0x22c)+_0x28e746['workflowSessionId']+_0xd13702(0x332)+_0x28e746[_0xd13702(0x21a)]);return console[_0xd13702(0x271)](_0xd13702(0x215)),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9[_0xd13702(0x253)]('Audience\x20ID:')+'\x20'+_0x28e746[_0xd13702(0x298)]),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9['dim']('Status:')+'\x20'+_0x28e746[_0xd13702(0x312)]),console[_0xd13702(0x271)]('\x20\x20'+a22_0x3237f9['dim']('Session:')+'\x20'+_0x28e746[_0xd13702(0x209)]),console['error']('\x20\x20'+a22_0x3237f9[_0xd13702(0x253)]('Attempt:')+'\x20'+_0x28e746[_0xd13702(0x21a)]),console[_0xd13702(0x271)]('\x20\x20'+_0x219b1d),console[_0xd13702(0x271)]('\x0a'+a22_0x3237f9['dim'](_0xd13702(0x292))+_0xd13702(0x2fa)+_0x28e746[_0xd13702(0x21a)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x27d);[a22_0x46b216(0x28c)]=a22_0x46b216(0x277);async[a22_0x46b216(0x2b5)](_0x1b9d18){const _0x45c51e=a22_0x46b216,{options:_0xf26f0f,args:_0x579ecd,tdx:_0x567b54}=_0x1b9d18,_0x462dc4=_0x579ecd[0x0]||_0xf26f0f[_0x45c51e(0x20b)];if(!_0x462dc4)return showParentSegmentNotSetError(_0x45c51e(0x269)+_0x45c51e(0x236)),0x1;_0xf26f0f['verbose']&&(console['error'](_0x45c51e(0x304)+_0xf26f0f[_0x45c51e(0x259)]),console[_0x45c51e(0x271)]('Parent\x20segment:\x20'+_0x462dc4));const _0x48c288=await withSpinner(_0x45c51e(0x27b)+_0x462dc4+_0x45c51e(0x220),()=>_0x567b54[_0x45c51e(0x2c1)][_0x45c51e(0x2d4)](_0x462dc4),{'verbose':_0xf26f0f[_0x45c51e(0x224)]}),_0x11b5b9=_0x48c288[_0x45c51e(0x28f)];console[_0x45c51e(0x271)]('✔\x20Found\x20'+_0x11b5b9['length']+_0x45c51e(0x21f)+(_0x11b5b9['length']!==0x1?'s':''));if(_0xf26f0f[_0x45c51e(0x23d)]||_0xf26f0f[_0x45c51e(0x287)])return await handleSDKOutput(_0x11b5b9,_0xf26f0f),0x0;return displayFieldsHumanReadable(_0x11b5b9,_0x462dc4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']='segment:parent:view';[a22_0x46b216(0x28c)]='Show\x20parent\x20segment\x20details';async[a22_0x46b216(0x2b5)](_0x36377a){const _0x1b591b=a22_0x46b216,{options:_0x1d09f9,args:_0x1bd069,tdx:_0xdff7b7}=_0x36377a,_0x2b178e=_0x1d09f9,_0x3822fd=_0x1bd069[0x0]||_0x1d09f9['parentSegment'];if(!_0x3822fd)return showParentSegmentNotSetError(_0x1b591b(0x1ef)+_0x1b591b(0x2ed)+_0x1b591b(0x25b)+_0x1b591b(0x255)),0x1;_0x1d09f9[_0x1b591b(0x224)]&&(console[_0x1b591b(0x271)](_0x1b591b(0x304)+_0x1d09f9[_0x1b591b(0x259)]),console['error']('Parent\x20segment:\x20'+_0x3822fd));const _0x1c3dae=await withSpinner(_0x1b591b(0x2ac)+_0x3822fd+_0x1b591b(0x220),()=>_0xdff7b7[_0x1b591b(0x2c1)][_0x1b591b(0x2aa)](_0x3822fd),{'verbose':_0x1d09f9[_0x1b591b(0x224)]}),_0x373196=_0x1c3dae[_0x1b591b(0x28f)];if(_0x2b178e['web']){const _0x17d06a=getConsoleNextUrl(_0x2b178e['site'],_0x1b591b(0x26a)+_0x373196['id']);return console[_0x1b591b(0x271)](a22_0x3237f9[_0x1b591b(0x237)]('✔')+_0x1b591b(0x265)+a22_0x3237f9[_0x1b591b(0x2cc)](_0x17d06a)),openBrowser(_0x17d06a),0x0;}return await handleSingleObjectOutput(_0x373196,_0x1d09f9),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2b0);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a22_0x46b216(0x2b5)](_0xd4e168){const _0x4748fc=a22_0x46b216,{options:_0x2d7c33,args:_0xe3a917,tdx:_0x2570c1}=_0xd4e168,_0x2b8e6a=_0x2d7c33,_0x2b9bed=_0xe3a917[0x0]||_0x2d7c33[_0x4748fc(0x20b)];if(!_0x2b9bed)return showParentSegmentNotSetError(_0x4748fc(0x2be)+_0x4748fc(0x2b4)+_0x4748fc(0x25b)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x2d7c33[_0x4748fc(0x224)]&&(console['error'](_0x4748fc(0x304)+_0x2d7c33[_0x4748fc(0x259)]),console[_0x4748fc(0x271)]('Parent\x20segment:\x20'+_0x2b9bed));const _0x24892d=await withSpinner(_0x4748fc(0x213)+_0x2b9bed+_0x4748fc(0x220),()=>_0x2570c1[_0x4748fc(0x2c1)]['resolveParentId'](_0x2b9bed),{'verbose':_0x2d7c33[_0x4748fc(0x224)]}),_0x45d60b=_0x24892d[_0x4748fc(0x28f)],_0x558591=_0x2570c1[_0x4748fc(0x2c1)][_0x4748fc(0x221)](_0x45d60b);if(_0x2b8e6a[_0x4748fc(0x202)]){const _0x562ca3=await this[_0x4748fc(0x24d)](_0xd4e168,_0x2b9bed,_0x45d60b,_0x558591),_0x37ba0e=this[_0x4748fc(0x322)](_0x562ca3);writeFileSync(_0x2b8e6a[_0x4748fc(0x202)],_0x37ba0e);const _0x179c17=_0x562ca3[_0x4748fc(0x291)][_0x4748fc(0x331)][_0x4748fc(0x2f8)]+_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2df)]((_0x23ce02,_0x12c233)=>_0x23ce02+_0x12c233['columns'][_0x4748fc(0x2f8)],0x0),_0x45a5d3=_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2e8)](_0x5a832e=>_0x5a832e['columns'][_0x4748fc(0x2f8)]===0x0)[_0x4748fc(0x2f8)];return console['log'](_0x4748fc(0x2d9)+_0x2b8e6a[_0x4748fc(0x202)]),console[_0x4748fc(0x32b)](_0x4748fc(0x2ce)+_0x558591),console[_0x4748fc(0x32b)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x562ca3[_0x4748fc(0x300)][_0x4748fc(0x2f8)]+_0x4748fc(0x32d)),console[_0x4748fc(0x32b)]('\x20\x20Columns:\x20'+_0x179c17+'\x20total'),_0x45a5d3>0x0&&console[_0x4748fc(0x32b)]('\x20\x20Note:\x20'+_0x45a5d3+_0x4748fc(0x22f)),0x0;}console[_0x4748fc(0x271)]('\x0a'+a22_0x3237f9['bold'](_0x4748fc(0x264))+'\x20'+a22_0x3237f9[_0x4748fc(0x2cc)](_0x558591));const _0x4c3ae7=await withSpinner(_0x4748fc(0x2c8),()=>_0x2570c1[_0x4748fc(0x2c1)][_0x4748fc(0x25d)](_0x45d60b),{'verbose':_0x2d7c33[_0x4748fc(0x224)]});console['error']('\x0a'+a22_0x3237f9[_0x4748fc(0x25e)]('customers')+'\x20'+a22_0x3237f9['dim']('('+_0x558591+_0x4748fc(0x328)));const _0x14b44f=await executeSchemaQuery(_0x4c3ae7[_0x4748fc(0x28f)],_0x2570c1,_0x2d7c33);await handleQueryOutput(_0x14b44f,_0x2d7c33);const _0x412205=await withSpinner(_0x4748fc(0x22e),()=>_0x2570c1[_0x4748fc(0x2c1)]['getBehaviorNames'](_0x45d60b),{'verbose':_0x2d7c33[_0x4748fc(0x224)]});for(const _0x466f88 of _0x412205['data']){const _0x4fd323='behavior_'+_0x466f88[_0x4748fc(0x28a)]()[_0x4748fc(0x320)](/\s+/g,'_'),_0x5b2a6b='SELECT\x20*\x20FROM\x20'+_0x558591+'.'+_0x4fd323;console[_0x4748fc(0x271)]('\x0a'+a22_0x3237f9['bold'](_0x466f88)+'\x20'+a22_0x3237f9[_0x4748fc(0x253)]('('+_0x558591+'.'+_0x4fd323+')'));try{const _0x45e00b=await executeSchemaQuery(_0x5b2a6b,_0x2570c1,_0x2d7c33);await handleQueryOutput(_0x45e00b,_0x2d7c33);}catch{console['error'](a22_0x3237f9['yellow'](_0x4748fc(0x25c)));}}return 0x0;}async[a22_0x46b216(0x24d)](_0x42e418,_0x527b6c,_0x32de30,_0x2fceae){const _0x5d7f53=a22_0x46b216,{options:_0x331948,tdx:_0x2c9220}=_0x42e418,_0x443135=await withSpinner(_0x5d7f53(0x2c8),()=>_0x2c9220[_0x5d7f53(0x2c1)]['getParentSQL'](_0x32de30),{'verbose':_0x331948[_0x5d7f53(0x224)]}),_0x5a6836=await executeSchemaQuery(_0x443135[_0x5d7f53(0x28f)],_0x2c9220,_0x331948),_0x1b13a5=_0x5a6836[_0x5d7f53(0x28f)][_0x5d7f53(0x288)](_0x1fa86f=>({'name':_0x1fa86f['column_name'],'type':_0x1fa86f[_0x5d7f53(0x2f2)]})),_0x46a0e3=await withSpinner(_0x5d7f53(0x22e),()=>_0x2c9220[_0x5d7f53(0x2c1)][_0x5d7f53(0x2f0)](_0x32de30),{'verbose':_0x331948[_0x5d7f53(0x224)]}),_0xf10163=[];for(const _0x4172b4 of _0x46a0e3[_0x5d7f53(0x28f)]){const _0x29bdde=_0x5d7f53(0x23b)+_0x4172b4[_0x5d7f53(0x28a)]()[_0x5d7f53(0x320)](/\s+/g,'_'),_0x2d6728='SELECT\x20*\x20FROM\x20'+_0x2fceae+'.'+_0x29bdde;let _0x4bc119=[];try{const _0x2312e0=await executeSchemaQuery(_0x2d6728,_0x2c9220,_0x331948);_0x4bc119=_0x2312e0[_0x5d7f53(0x28f)][_0x5d7f53(0x288)](_0x11860f=>({'name':_0x11860f['column_name'],'type':_0x11860f[_0x5d7f53(0x2f2)]}));}catch{}_0xf10163[_0x5d7f53(0x227)]({'table':_0x29bdde,'columns':_0x4bc119});}return{'database':_0x2fceae,'parent_segment':_0x527b6c,'parent_id':_0x32de30,'customers':{'table':_0x5d7f53(0x291),'columns':_0x1b13a5},'behaviors':_0xf10163};}[a22_0x46b216(0x322)](_0x293442){const _0x5a970f=a22_0x46b216,_0x4bd3e3=_0x3699d6=>{const _0xfafbc4=a22_0xd58f;if(_0x3699d6['length']===0x0)return'[]';const _0x231d9c=_0x3699d6[_0xfafbc4(0x288)](_0x2ea6b5=>_0xfafbc4(0x27f)+_0x2ea6b5[_0xfafbc4(0x228)]+_0xfafbc4(0x2ec)+_0x2ea6b5[_0xfafbc4(0x32c)]+'\x22\x20}');return'[\x0a'+_0x231d9c[_0xfafbc4(0x1ec)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x128265=_0x293442[_0x5a970f(0x300)][_0x5a970f(0x288)](_0x566c0e=>{const _0x3a87bc=_0x5a970f;return _0x3a87bc(0x2ba)+_0x566c0e[_0x3a87bc(0x2d8)]+_0x3a87bc(0x2fd)+_0x4bd3e3(_0x566c0e['columns'])['replace'](/^/gm,'\x20\x20')['trim']()+_0x3a87bc(0x250);})[_0x5a970f(0x1ec)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x293442[_0x5a970f(0x316)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x293442[_0x5a970f(0x248)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x293442['parent_id']+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x293442[_0x5a970f(0x291)][_0x5a970f(0x2d8)]+_0x5a970f(0x29e)+_0x4bd3e3(_0x293442[_0x5a970f(0x291)][_0x5a970f(0x331)])[_0x5a970f(0x320)](/^/gm,'\x20\x20')[_0x5a970f(0x2f5)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x128265+_0x5a970f(0x323);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x46b216(0x28d);[a22_0x46b216(0x28c)]=a22_0x46b216(0x2e1);async[a22_0x46b216(0x2b5)](_0x239b95){const _0x529731=a22_0x46b216,{options:_0x3d8cc4,args:_0x3c3ed2,tdx:_0x470d9f}=_0x239b95,_0x155014=_0x3c3ed2[0x0]||_0x3d8cc4[_0x529731(0x20b)];if(!_0x155014)return showParentSegmentNotSetError(_0x529731(0x2a7)+_0x529731(0x23f)),0x1;_0x3d8cc4[_0x529731(0x224)]&&(console['error'](_0x529731(0x304)+_0x3d8cc4[_0x529731(0x259)]),console[_0x529731(0x271)](_0x529731(0x1f0)+_0x155014));const _0x4d0034=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x155014+'\x27...',()=>_0x470d9f[_0x529731(0x2c1)][_0x529731(0x21c)](_0x155014),{'verbose':_0x3d8cc4['verbose']}),_0x25193f=_0x4d0034[_0x529731(0x28f)],_0x4c0787=await withSpinner(_0x529731(0x284)+_0x155014+_0x529731(0x220),()=>_0x470d9f['segment'][_0x529731(0x25d)](_0x25193f),{'verbose':_0x3d8cc4['verbose']}),_0x280d0b=_0x4c0787[_0x529731(0x28f)];return _0x3d8cc4['format']===_0x529731(0x23d)||_0x3d8cc4[_0x529731(0x256)]===_0x529731(0x287)?await handleSDKOutput([{'sql':_0x280d0b}],_0x3d8cc4):console[_0x529731(0x32b)](_0x280d0b),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x46b216(0x228)]=a22_0x46b216(0x2da);[a22_0x46b216(0x28c)]=a22_0x46b216(0x234);async['execute'](_0x574afa){const _0x32fc83=a22_0x46b216,{options:_0x1cb753,args:_0x463292,tdx:_0x4fff31}=_0x574afa,_0x68ef21=_0x463292[0x0]||_0x1cb753[_0x32fc83(0x20b)];if(!_0x68ef21)return showParentSegmentNotSetError(_0x32fc83(0x2ae)+'\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;_0x1cb753[_0x32fc83(0x224)]&&(console['error'](_0x32fc83(0x304)+_0x1cb753['site']),console[_0x32fc83(0x271)](_0x32fc83(0x1f0)+_0x68ef21));const _0x5662e8=await withSpinner(_0x32fc83(0x213)+_0x68ef21+_0x32fc83(0x220),()=>_0x4fff31[_0x32fc83(0x2c1)][_0x32fc83(0x21c)](_0x68ef21),{'verbose':_0x1cb753[_0x32fc83(0x224)]}),_0x3a9242=_0x5662e8['data'],_0x5b9ed9=await withSpinner(_0x32fc83(0x284)+_0x68ef21+_0x32fc83(0x220),()=>_0x4fff31[_0x32fc83(0x2c1)]['getParentSQL'](_0x3a9242),{'verbose':_0x1cb753[_0x32fc83(0x224)]});let _0x5d83fc=_0x5b9ed9[_0x32fc83(0x28f)];const _0x3918ed=resolveLimit(_0x1cb753[_0x32fc83(0x318)],DEFAULT_DISPLAY_LIMIT),_0x310247=/\bLIMIT\s+\d+/i[_0x32fc83(0x201)](_0x5d83fc);!_0x310247&&(_0x5d83fc=_0x5d83fc[_0x32fc83(0x2f5)]()['replace'](/;+$/,''),_0x5d83fc=_0x32fc83(0x1f3)+_0x5d83fc+_0x32fc83(0x22a)+_0x3918ed);_0x1cb753[_0x32fc83(0x224)]&&console[_0x32fc83(0x271)](_0x32fc83(0x2ab)+_0x5d83fc);const _0x5ec92d=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x3fa84d=>{const _0x1ee7e5=_0x32fc83,_0x581ec7=await _0x4fff31[_0x1ee7e5(0x276)][_0x1ee7e5(0x2b5)](_0x5d83fc,{'catalog':'td','schema':_0x1ee7e5(0x2f7),'onJobId':_0x42a67b=>{const _0x3d35fc=_0x1ee7e5;_0x3fa84d[_0x3d35fc(0x2fc)](_0x42a67b);}});return _0x581ec7;},{'verbose':_0x1cb753['verbose']}),_0x20a7d7=_0x5ec92d['data'],_0x5009b4=_0x20a7d7[_0x32fc83(0x296)]?_0x32fc83(0x2c5)+_0x20a7d7['jobId']+']':'';return console['error'](_0x32fc83(0x1f7)+_0x20a7d7['stats'][_0x32fc83(0x333)][_0x32fc83(0x27e)]()+_0x32fc83(0x2d1)+(_0x32fc83(0x317)+formatElapsed(_0x20a7d7[_0x32fc83(0x25a)]['elapsedTimeMillis'])+_0x5009b4)),await handleQueryOutput(_0x20a7d7,_0x1cb753),0x0;}}
|
|
1
|
+
const a22_0x46829f=a22_0x33a2;(function(_0xc4aa2c,_0x447b85){const _0x929727=a22_0x33a2,_0xbd4d5f=_0xc4aa2c();while(!![]){try{const _0x5926ae=parseInt(_0x929727(0x1bc))/0x1+parseInt(_0x929727(0x1dd))/0x2+parseInt(_0x929727(0x234))/0x3+parseInt(_0x929727(0x182))/0x4+-parseInt(_0x929727(0x1cf))/0x5*(-parseInt(_0x929727(0x238))/0x6)+parseInt(_0x929727(0x167))/0x7*(parseInt(_0x929727(0x1ec))/0x8)+-parseInt(_0x929727(0x1b2))/0x9*(parseInt(_0x929727(0x1d4))/0xa);if(_0x5926ae===_0x447b85)break;else _0xbd4d5f['push'](_0xbd4d5f['shift']());}catch(_0x5c6873){_0xbd4d5f['push'](_0xbd4d5f['shift']());}}}(a22_0x1d94,0x3382b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a22_0x33a2(_0x46d407,_0x29a936){_0x46d407=_0x46d407-0x145;const _0x1d94ba=a22_0x1d94();let _0x33a2d4=_0x1d94ba[_0x46d407];return _0x33a2d4;}import a22_0x188799 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x225566 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x46829f(0x259),LEGACY_PARENT_SEGMENT_DIR=a22_0x46829f(0x240);function openBrowser(_0x407895){const _0x416344=a22_0x46829f,_0x4fb800=process[_0x416344(0x285)],_0x4e65cf=_0x4fb800===_0x416344(0x171)?_0x416344(0x14c):_0x4fb800===_0x416344(0x19d)?_0x416344(0x19c):_0x416344(0x149);spawn(_0x4e65cf,[_0x407895],{'detached':!![],'stdio':_0x416344(0x20b)})['unref']();}function migrateLegacyDirectory(){const _0x3f7545=a22_0x46829f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x37d454=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x37d454[_0x3f7545(0x152)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3f7545(0x248)](a22_0x225566[_0x3f7545(0x19b)](_0x3f7545(0x211)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x3f7545(0x1e6))),console[_0x3f7545(0x248)](a22_0x225566[_0x3f7545(0x1f0)](_0x3f7545(0x26d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3f7545(0x248)](a22_0x225566[_0x3f7545(0x19b)](_0x3f7545(0x1d7)+LEGACY_PARENT_SEGMENT_DIR+_0x3f7545(0x27c)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3f7545(0x248)](a22_0x225566[_0x3f7545(0x1d3)](_0x3f7545(0x188)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x108503){const _0x4b9d71=_0x108503 instanceof Error?_0x108503[_0x3f7545(0x18f)]:String(_0x108503);return console[_0x3f7545(0x248)](a22_0x225566[_0x3f7545(0x1b4)](_0x3f7545(0x1d8)+_0x4b9d71+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x2077ae){const _0x303760=a22_0x46829f;return migrateLegacyDirectory(),super[_0x303760(0x1c4)](_0x2077ae);}}function resolveYamlFile(_0x5e3ed4){const _0x489b52=a22_0x46829f;if(_0x5e3ed4['endsWith']('.yml')||_0x5e3ed4['endsWith'](_0x489b52(0x269)))return _0x5e3ed4;return a22_0x188799[_0x489b52(0x1a1)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5e3ed4)+_0x489b52(0x185));}function formatProgressMessage(_0x582c4a){const _0x3e5df7=a22_0x46829f,_0x1799fc=_0x582c4a['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1799fc){const [,_0xf85cf6,_0x39634b,_0x436638='']=_0x1799fc;return a22_0x225566[_0x3e5df7(0x1f0)](_0xf85cf6+':')+'\x20'+_0x39634b+a22_0x225566[_0x3e5df7(0x1f0)](_0x436638);}return a22_0x225566['dim'](_0x582c4a);}function showFileNotFoundError(_0x23b35e,_0x596d6b){const _0x5bb309=a22_0x46829f;console[_0x5bb309(0x248)](a22_0x225566['red']('Error:\x20File\x20not\x20found:\x20'+_0x23b35e+'\x0a')),console[_0x5bb309(0x248)](a22_0x225566[_0x5bb309(0x159)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x596d6b+_0x5bb309(0x26c)));}function showParentSegmentNotSetError(_0x32e614){const _0x3096ee=a22_0x46829f;console[_0x3096ee(0x248)](a22_0x225566['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3096ee(0x248)](_0x32e614);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x247);[a22_0x46829f(0x1e9)]='List\x20parent\x20segments';async['execute'](_0x578159){const _0x33f4ea=a22_0x46829f,{options:_0xff0696,args:_0xda7a57,tdx:_0x37b977}=_0x578159,_0x42d45c=_0xda7a57[0x0];_0xff0696['verbose']&&(console['error'](_0x33f4ea(0x215)+_0xff0696[_0x33f4ea(0x27d)]),_0x42d45c&&console[_0x33f4ea(0x248)](_0x33f4ea(0x16f)+_0x42d45c));const _0x32d83c=await withSpinner(_0x42d45c?_0x33f4ea(0x21e)+_0x42d45c+_0x33f4ea(0x178):'Listing\x20parent\x20segments...',()=>_0x37b977['segment'][_0x33f4ea(0x25a)](),{'verbose':_0xff0696[_0x33f4ea(0x24c)]});let _0xe67f09=_0x32d83c[_0x33f4ea(0x241)];if(_0x42d45c){const _0x3b30d6=_0x42d45c[_0x33f4ea(0x1ca)](/[.+^${}()|[\]\\]/g,_0x33f4ea(0x192))[_0x33f4ea(0x1ca)](/\*/g,'.*')[_0x33f4ea(0x1ca)](/\?/g,'.'),_0x448ca5=new RegExp('^'+_0x3b30d6+'$','i');_0xe67f09=_0xe67f09['filter'](_0x104ea5=>_0x448ca5[_0x33f4ea(0x283)](_0x104ea5[_0x33f4ea(0x250)]['name']));}_0xe67f09['sort']((_0x5d943,_0x824c30)=>_0x5d943[_0x33f4ea(0x250)][_0x33f4ea(0x151)][_0x33f4ea(0x1da)](_0x824c30[_0x33f4ea(0x250)][_0x33f4ea(0x151)])),console['error'](_0x33f4ea(0x24b)+_0xe67f09['length']+'\x20parent\x20segment'+(_0xe67f09['length']!==0x1?'s':''));const _0xeb1121=_0x1f970e=>{const _0x193ebe=_0x33f4ea;return getConsoleNextUrl(_0xff0696[_0x193ebe(0x27d)],'/app/dw/parentSegments/'+_0x1f970e);};if(_0xff0696[_0x33f4ea(0x19e)]===_0x33f4ea(0x1fc)||_0xff0696[_0x33f4ea(0x19e)]===_0x33f4ea(0x267)){const _0x8eff46=_0xe67f09[_0x33f4ea(0x1a3)](_0x1ccd03=>({..._0x1ccd03,'url':_0xeb1121(_0x1ccd03['id'])}));await handleSDKOutput(_0x8eff46,_0xff0696);}else{if(_0xe67f09[_0x33f4ea(0x1a9)]===0x0)_0x42d45c?console[_0x33f4ea(0x23a)](_0x33f4ea(0x251)+_0x42d45c):console[_0x33f4ea(0x23a)]('No\x20parent\x20segments\x20found');else for(const _0x5eb027 of _0xe67f09){const _0x91a295=_0x5eb027[_0x33f4ea(0x250)][_0x33f4ea(0x15e)]?a22_0x225566[_0x33f4ea(0x1f0)]('\x20('+formatRows(_0x5eb027[_0x33f4ea(0x250)][_0x33f4ea(0x15e)])+')'):'',_0x428858=hyperlink(_0x5eb027['attributes']['name'],_0xeb1121(_0x5eb027['id']));console[_0x33f4ea(0x23a)](_0x33f4ea(0x1a7)+_0x428858+_0x91a295);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x243);['description']=a22_0x46829f(0x1fb);async[a22_0x46829f(0x274)](_0x5d69a1){const _0x1f825c=a22_0x46829f,{options:_0x8a9ae4,args:_0x1b0e6b,tdx:_0x1edb5b}=_0x5d69a1;console[_0x1f825c(0x248)](_0x1f825c(0x206)+_0x1f825c(0x169)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x4125eb=_0x8a9ae4;if(_0x1b0e6b['length']===0x0)return console[_0x1f825c(0x248)](a22_0x225566[_0x1f825c(0x1b4)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x1f825c(0x248)](_0x1f825c(0x161)),0x1;const _0x5956aa=_0x1b0e6b[0x0];if(!_0x4125eb[_0x1f825c(0x275)]||!_0x4125eb[_0x1f825c(0x1fa)])return console[_0x1f825c(0x248)](_0x1f825c(0x186)),console[_0x1f825c(0x248)](_0x1f825c(0x161)),0x1;_0x4125eb['verbose']&&(console[_0x1f825c(0x248)]('Site:\x20'+_0x4125eb[_0x1f825c(0x27d)]),console[_0x1f825c(0x248)](_0x1f825c(0x1c1)+_0x5956aa),console[_0x1f825c(0x248)]('Database:\x20'+_0x4125eb[_0x1f825c(0x275)]),console[_0x1f825c(0x248)](_0x1f825c(0x237)+_0x4125eb['table']));const _0x31960a=await loadJSONFromOptions(_0x4125eb[_0x1f825c(0x250)],_0x4125eb[_0x1f825c(0x279)]),_0x5b8299=await loadJSONFromOptions(_0x4125eb[_0x1f825c(0x255)],_0x4125eb['behaviorsFile']),_0x358873=await loadJSONFromOptions(_0x4125eb[_0x1f825c(0x213)],_0x4125eb[_0x1f825c(0x256)]),_0x17d035={'name':_0x5956aa,'description':_0x4125eb[_0x1f825c(0x1e9)],'scheduleType':_0x4125eb[_0x1f825c(0x261)],'scheduleOption':_0x4125eb[_0x1f825c(0x157)],'timezone':_0x4125eb[_0x1f825c(0x1a6)],'master':{'parentDatabaseName':_0x4125eb['database'],'parentTableName':_0x4125eb[_0x1f825c(0x1fa)]},'attributes':_0x31960a,'behaviors':_0x5b8299,'customerGroup':_0x358873},_0x4f5754=await withSpinner(_0x1f825c(0x18c)+_0x5956aa+_0x1f825c(0x178),()=>_0x1edb5b[_0x1f825c(0x1ee)][_0x1f825c(0x266)](_0x17d035),{'verbose':_0x8a9ae4[_0x1f825c(0x24c)]}),_0x2c7e53=_0x4f5754['data'];return console['error'](_0x1f825c(0x246)+_0x2c7e53[_0x1f825c(0x151)]+_0x1f825c(0x258)+_0x2c7e53['id']),await handleSDKOutput([_0x2c7e53],_0x8a9ae4),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x46829f(0x151)]='segment:parent:update';[a22_0x46829f(0x1e9)]=a22_0x46829f(0x1c5);async[a22_0x46829f(0x274)](_0x5c0552){const _0x477781=a22_0x46829f,{options:_0x5bcbb8,args:_0x21d500,tdx:_0x98f45}=_0x5c0552;console[_0x477781(0x248)](_0x477781(0x271)+_0x477781(0x169)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x3848e4=_0x5bcbb8;if(_0x21d500[_0x477781(0x1a9)]===0x0)return console['error'](a22_0x225566[_0x477781(0x1b4)](_0x477781(0x229))),console[_0x477781(0x248)](_0x477781(0x286)),0x1;const _0x5a7f71=_0x21d500[0x0];_0x3848e4[_0x477781(0x24c)]&&(console[_0x477781(0x248)](_0x477781(0x215)+_0x3848e4[_0x477781(0x27d)]),console[_0x477781(0x248)](_0x477781(0x254)+_0x5a7f71));const _0xacd99b=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x5a7f71+_0x477781(0x178),()=>_0x98f45[_0x477781(0x1ee)][_0x477781(0x14d)](_0x5a7f71),{'verbose':_0x3848e4[_0x477781(0x24c)]}),_0x3e9ca5=_0xacd99b[_0x477781(0x241)],_0x1e6a6c=await loadJSONFromOptions(_0x3848e4['addAttributes'],_0x3848e4['addAttributesFile']),_0x25a0f2=await loadJSONFromOptions(_0x3848e4[_0x477781(0x1de)],_0x3848e4[_0x477781(0x25e)]),_0x18d920={'name':_0x3e9ca5['name'],'description':_0x3848e4[_0x477781(0x1e9)]!==undefined?_0x3848e4[_0x477781(0x1e9)]:_0x3e9ca5[_0x477781(0x1e9)],'scheduleType':_0x3848e4['scheduleType']!==undefined?_0x3848e4[_0x477781(0x261)]:_0x3e9ca5[_0x477781(0x261)],'scheduleOption':_0x3848e4[_0x477781(0x157)]!==undefined?_0x3848e4[_0x477781(0x157)]:_0x3e9ca5[_0x477781(0x157)],'timezone':_0x3848e4[_0x477781(0x1a6)]!==undefined?_0x3848e4[_0x477781(0x1a6)]:_0x3e9ca5[_0x477781(0x1a6)],'master':_0x3e9ca5[_0x477781(0x1bf)],'attributes':_0x1e6a6c?[..._0x3e9ca5[_0x477781(0x250)]||[],..._0x1e6a6c]:_0x3e9ca5[_0x477781(0x250)],'behaviors':_0x25a0f2?[..._0x3e9ca5[_0x477781(0x255)]||[],..._0x25a0f2]:_0x3e9ca5[_0x477781(0x255)],'customerGroup':_0x3e9ca5[_0x477781(0x213)]},_0x48f100=await withSpinner(_0x477781(0x145)+_0x5a7f71+_0x477781(0x178),()=>_0x98f45[_0x477781(0x1ee)][_0x477781(0x1a5)](_0x5a7f71,_0x18d920),{'verbose':_0x3848e4[_0x477781(0x24c)]}),_0x2a5fc8=_0x48f100[_0x477781(0x241)];return console[_0x477781(0x248)](_0x477781(0x199)+_0x2a5fc8['name']+'\x27'),await handleSDKOutput([_0x2a5fc8],_0x3848e4),0x0;}}function a22_0x1d94(){const _0xe56702=['\x20rows)','\x20rows\x20','2616AGydEY','segment:parent:validate','segment','\x22,\x20\x22type\x22:\x20\x22','dim','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Options:\x0a','displayMasterInfo','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Aborted.','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20kill','table','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','json','toFixed','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','To\x20view\x20sample\x20data:','dirname','displayBehaviorsStats','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','toLocaleString','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','processedRows','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','/attempt/','setJobId','ignore','segment:parent:sql','Updating','collectSchema','To\x20cancel:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x0a⚠️\x20\x20Both\x20','workflowId','customerGroup','SELECT\x20*\x20FROM\x20(\x0a','Site:\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','displayPreviewResults','\x20field','\x0aError:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','column_type','segment:parent:run','Listing\x20parent\x20segments\x20matching\x20\x27','interval','displayColumns','Error\x20reading\x20file:\x20','SQL\x20query:\x0a','using\x20the\x20default\x20path:\x20','\x20--interval\x20','/app/workflows/','displaySummary','runParent','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','apply','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Schema\x20saved\x20to\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','tdx\x20segment\x20parent\x20preview\x20','Enriched:','type','label','Get\x20SQL\x20query\x20for\x20parent\x20segment','151749RcRjKB','Attempt:','Errors:','Table:\x20','6WYCyJa','SELECT\x20*\x20FROM\x20','log','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','schemaValid','\x20tdx\x20wf\x20attempt\x20','Fetching\x20SQL\x20for\x20\x27','Error\x20parsing\x20YAML:\x20','parent_segment','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','segment:parent:create','Preview:','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:list','error','-1d','enriched','✔\x20Found\x20','verbose','use','Found\x20YAML\x20file:\x20','preview','attributes','No\x20parent\x20segments\x20match\x20pattern:\x20','getBehaviorNames','Master\x20+\x20Attributes','Parent\x20segment:\x20','behaviors','customerGroupFile','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\x20with\x20ID:\x20','parent_segments','listParents','✔\x20No\x20changes\x20-\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Behavior:','addBehaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Opening\x20','scheduleType','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Options:','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','createParent','jsonl','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','.yaml','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','customerPercent','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','string','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Fetching\x20parent\x20segment\x20\x27','execute','database','behavior_','limit','YAML\x20file:\x20','attributesFile','Created','push','/\x20→\x20','site','Join\x20on:','keys','customersWithEvents','customers','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','test','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','platform','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','foreignKey','\x20--enriched','Overwrite\x20\x27','/{name}.yml\x0a','query','audienceId','pullParentYaml','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Updating\x20parent\x20segment\x20\x27','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','getParentSQL','Show\x20parent\x20segment\x20details','xdg-open','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','open','getParentFull','allValid','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','yes','name','isDirectory','joinKey','\x0aChanges\x20to\x20\x27','displayValidateResults','\x27\x20is\x20already\x20up\x20to\x20date','scheduleOption','\x20--attribute\x20\x22','cyan','/app/dw/parentSegments/','in\x20','schemaError','toLowerCase','population','all','Fetching\x20customers\x20schema...','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','✔\x20Query\x20completed:\x20Processed\x20','Coverage:','rowCount','Creating','Attribute:','973iHWoVA','Updated','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x27\x20is\x20up\x20to\x20date','getOutputDatabaseName','Resolving\x20parent\x20segment\x20\x27','bold','validateParentYaml','Pattern:\x20','Output\x20file:\x20','darwin','totalEvents','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Apply\x20changes\x20to\x20\x27','column_name','workflowAttemptId','\x0a\x20\x20\x20\x20]','\x27...','Columns:','\x20--behavior\x20\x22','{\x0a\x20\x20\x22database\x22:\x20\x22','/sessions/','displayAttributesStats','Session:','elapsedTimeMillis','\x20--behavior\x20\x22<name>\x22','List\x20available\x20fields\x20for\x20segmentation','494124wIBsev','\x20parent\x20segment\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','.yml','Error:\x20--database\x20and\x20--table\x20are\x20required','stop','✔\x20Renamed\x20directory\x20to\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','coveragePercent','Creating\x20parent\x20segment\x20\x27','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','message','stats','repeat','\x5c$&','displaySampleData','listFields','segment:parent:view','segment:parent:pull','\x0a✔\x20Workflow\x20started','resolveParentId','✔\x20Updated\x20parent\x20segment\x20\x27','errors','yellow','start','win32','format','Master\x20Table','information_schema','join','number','map','Error:\x20--behavior\x20requires\x20a\x20name\x0a','updateParent','timezone','👥\x20','status','length','web','\x0aNo\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Analyzing\x20changes...','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','parent_id','Source:','utf-8','2088EOKAtQ','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','red','pushParentYaml','segment:parent:push','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','behavior','\x20\x20\x20\x20-\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','14315poutAY','column','segment:parent:show','master','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Name:\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20=\x20','run','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Join:','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','filter','replace','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','.customers)','session','1624195DgqEKD','columns','%)\x20','Create\x20parent\x20segment\x20\x27','green','31900mfUFgU','jobId','\x20Configuration\x20is\x20valid','\x0a⚠️\x20\x20Migrating:\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','trim','localeCompare','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','784692pLoLxv','addBehaviors','\x22\x20}','Validate:','Error:','output','\x20\x20Note:\x20','displayPreviewHints','\x27\x20and\x20run\x20workflow?','/\x20directories\x20exist.','matchedCount','attribute','description'];a22_0x1d94=function(){return _0xe56702;};return a22_0x1d94();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x196);[a22_0x46829f(0x1e9)]=a22_0x46829f(0x189);async[a22_0x46829f(0x274)](_0x3cccd3){const _0x425650=a22_0x46829f,{options:_0xa478fc,args:_0x3421e3,tdx:_0xf4b6c1}=_0x3cccd3,_0x22f033=_0xa478fc,_0x5245e7=_0x3421e3[0x0]||_0xa478fc[_0x425650(0x1f4)];if(!_0x5245e7)return showParentSegmentNotSetError(_0x425650(0x263)+_0x425650(0x26f)),0x1;if(_0x22f033[_0x425650(0x24d)]&&_0x22f033[_0x425650(0x1e2)])return console['error'](a22_0x225566[_0x425650(0x1b4)](_0x425650(0x1f1))),console[_0x425650(0x248)](a22_0x225566[_0x425650(0x1f0)](_0x425650(0x1fe))),console[_0x425650(0x248)](a22_0x225566[_0x425650(0x1f0)](_0x425650(0x223)+PARENT_SEGMENT_DIR+_0x425650(0x28a))),console[_0x425650(0x248)](a22_0x225566['cyan'](_0x425650(0x22e))),0x1;const _0x511737=_0x22f033[_0x425650(0x1e2)]||a22_0x188799[_0x425650(0x1a1)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5245e7)+_0x425650(0x185));_0x22f033[_0x425650(0x24c)]&&(console[_0x425650(0x248)]('Site:\x20'+_0x22f033['site']),console[_0x425650(0x248)](_0x425650(0x254)+_0x5245e7),console[_0x425650(0x248)](_0x425650(0x170)+_0x511737));const _0x5b06fd=await withSpinner(_0x425650(0x273)+_0x5245e7+_0x425650(0x178),()=>_0xf4b6c1[_0x425650(0x1ee)][_0x425650(0x28d)](_0x5245e7),{'verbose':_0x22f033[_0x425650(0x24c)]}),_0xf65208=_0x5b06fd[_0x425650(0x241)];if(existsSync(_0x511737)){const _0x47e4de=readFileSync(_0x511737,_0x425650(0x1b1)),_0x1776a0=generateDiff(_0x47e4de,_0xf65208);if(!hasChanges(_0x1776a0))console[_0x425650(0x248)](a22_0x225566['green']('✔')+'\x20No\x20changes\x20-\x20'+a22_0x225566[_0x425650(0x159)](_0x511737)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x425650(0x248)](_0x425650(0x154)+_0x511737+'\x27:'),console['error']('─'[_0x425650(0x191)](0x3c)),console[_0x425650(0x248)](formatDiffWithColors(_0x1776a0)),console[_0x425650(0x248)]('─'[_0x425650(0x191)](0x3c));if(!_0x22f033[_0x425650(0x150)]){if(!isInteractive())return console['error'](a22_0x225566[_0x425650(0x1b4)](_0x425650(0x21a)),_0x425650(0x14a)),console[_0x425650(0x248)](a22_0x225566['dim'](_0x425650(0x23b))),0x1;const _0x442bdb=await confirmKey(_0x425650(0x289)+_0x511737+'\x27?');if(!_0x442bdb)return console[_0x425650(0x248)](a22_0x225566[_0x425650(0x19b)](_0x425650(0x1f7))),0x1;}writeFileSync(_0x511737,_0xf65208,_0x425650(0x1b1)),console[_0x425650(0x248)](a22_0x225566[_0x425650(0x1d3)]('✔')+_0x425650(0x146)+a22_0x225566[_0x425650(0x159)](_0x511737));}}else{const _0x261bf9=a22_0x188799[_0x425650(0x200)](_0x511737);!existsSync(_0x261bf9)&&mkdirSync(_0x261bf9,{'recursive':!![]}),writeFileSync(_0x511737,_0xf65208,_0x425650(0x1b1)),console[_0x425650(0x248)](a22_0x225566['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x225566[_0x425650(0x159)](_0x511737));}return saveSessionContext({'parent_segment':_0x5245e7},_0x22f033[_0x425650(0x1ce)]),console[_0x425650(0x248)](a22_0x225566[_0x425650(0x1d3)]('✔')+'\x20Context\x20set:\x20'+a22_0x225566[_0x425650(0x1f0)](_0x425650(0x240))+'\x20=\x20'+a22_0x225566[_0x425650(0x159)](_0x5245e7)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x1b6);['description']=a22_0x46829f(0x1b3);async[a22_0x46829f(0x274)](_0x145740){const _0x3ae61f=a22_0x46829f,{options:_0xe3cdec,args:_0x274c66,tdx:_0x33fbed}=_0x145740,_0x460966=_0xe3cdec,_0x1fce41=_0x274c66[0x0]||_0xe3cdec[_0x3ae61f(0x1f4)];if(!_0x1fce41)return showParentSegmentNotSetError(_0x3ae61f(0x14f)+_0x3ae61f(0x18e)),0x1;const _0x175c71=resolveYamlFile(_0x1fce41);if(!existsSync(_0x175c71))return showFileNotFoundError(_0x175c71,_0x1fce41),0x1;_0x460966['verbose']&&(console[_0x3ae61f(0x248)](_0x3ae61f(0x215)+_0x460966[_0x3ae61f(0x27d)]),console[_0x3ae61f(0x248)](_0x3ae61f(0x278)+_0x175c71));let _0x3f5bd2;try{_0x3f5bd2=readFileSync(_0x175c71,_0x3ae61f(0x1b1));}catch(_0x24f74c){const _0x3c8483=_0x24f74c instanceof Error?_0x24f74c[_0x3ae61f(0x18f)]:String(_0x24f74c);return console[_0x3ae61f(0x248)]('Error\x20reading\x20file:\x20'+_0x3c8483),0x1;}const _0xed4b69=await withSpinner(_0x3ae61f(0x1ad),()=>_0x33fbed['segment'][_0x3ae61f(0x1b5)](_0x3f5bd2),{'verbose':_0x460966[_0x3ae61f(0x24c)]}),_0x1b9650=_0xed4b69[_0x3ae61f(0x241)],{isNew:_0xe0daa7,name:_0x4eb601,hasChanges:_0x595d0b,diffFormatted:_0x399e7b}=_0x1b9650;if(!_0x595d0b)return console[_0x3ae61f(0x248)](_0x3ae61f(0x25b)+_0x4eb601+_0x3ae61f(0x156)),0x0;_0xe0daa7?console[_0x3ae61f(0x248)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x4eb601+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x4eb601+'\x27:');console[_0x3ae61f(0x248)]('─'['repeat'](0x3c)),console[_0x3ae61f(0x248)](_0x399e7b),console['error']('─'['repeat'](0x3c));const _0x56c86f=_0xe0daa7?'Create\x20parent\x20segment\x20\x27'+_0x4eb601+'\x27?':_0x3ae61f(0x174)+_0x4eb601+'\x27?';if(!_0x460966[_0x3ae61f(0x150)]){if(!isInteractive())return console[_0x3ae61f(0x248)](a22_0x225566[_0x3ae61f(0x1b4)](_0x3ae61f(0x21a)),_0x3ae61f(0x14a)),console['error'](a22_0x225566['dim'](_0x3ae61f(0x23b))),0x1;const _0x4b0717=await confirmKey(_0x56c86f);if(!_0x4b0717)return console['error'](a22_0x225566[_0x3ae61f(0x19b)](_0x3ae61f(0x1f7))),0x1;}const _0x50bcde=_0xe0daa7?'Creating':_0x3ae61f(0x20d),_0x13171b=await withSpinner(_0x50bcde+_0x3ae61f(0x183)+_0x4eb601+_0x3ae61f(0x178),()=>_0x1b9650[_0x3ae61f(0x22b)](),{'verbose':_0x460966['verbose']}),_0xb1626=_0x13171b[_0x3ae61f(0x241)],_0xe4e8b6=getConsoleNextUrl(_0x460966[_0x3ae61f(0x27d)],_0x3ae61f(0x15a)+_0xb1626['id']),_0x116252=_0xe0daa7?_0x3ae61f(0x27a):'Updated';return console[_0x3ae61f(0x248)]('✔\x20'+_0x116252+_0x3ae61f(0x183)+_0xb1626[_0x3ae61f(0x151)]+'\x27'),console[_0x3ae61f(0x248)]('\x20\x20'+_0xe4e8b6),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x1ed);[a22_0x46829f(0x1e9)]=a22_0x46829f(0x228);async['execute'](_0x3b038f){const _0x3e8dda=a22_0x46829f,{options:_0x134885,args:_0x488e5c,tdx:_0x2978f2}=_0x3b038f,_0x4a981b=_0x134885,_0x475a97=_0x488e5c[0x0]||_0x134885[_0x3e8dda(0x1f4)];if(!_0x475a97)return showParentSegmentNotSetError(_0x3e8dda(0x1bb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x3e8dda(0x1f2)+_0x3e8dda(0x173)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x3e8dda(0x268)),0x1;const _0x52d190=resolveYamlFile(_0x475a97);if(!existsSync(_0x52d190))return showFileNotFoundError(_0x52d190,_0x475a97),0x1;_0x4a981b[_0x3e8dda(0x24c)]&&(console['error']('Site:\x20'+_0x4a981b[_0x3e8dda(0x27d)]),console['error']('YAML\x20file:\x20'+_0x52d190));let _0x5a35a6;try{_0x5a35a6=readFileSync(_0x52d190,_0x3e8dda(0x1b1));}catch(_0xbbc414){const _0x155909=_0xbbc414 instanceof Error?_0xbbc414[_0x3e8dda(0x18f)]:String(_0xbbc414);return console[_0x3e8dda(0x248)](_0x3e8dda(0x221)+_0x155909),0x1;}const _0x13e5f6=createCommandSpinner(a22_0x225566[_0x3e8dda(0x1f0)]('Validating\x20configuration...'),{'verbose':_0x4a981b['verbose']});_0x13e5f6[_0x3e8dda(0x19c)]();const _0x5ed472={'onProgress':_0x1507eb=>{_0x13e5f6['text']=formatProgressMessage(_0x1507eb);}};if(_0x4a981b['master'])_0x5ed472['master']=!![];if(_0x4a981b[_0x3e8dda(0x24a)])_0x5ed472[_0x3e8dda(0x24a)]=!![];_0x4a981b[_0x3e8dda(0x1e8)]&&(_0x5ed472[_0x3e8dda(0x1e8)]=_0x4a981b['attribute']);_0x4a981b[_0x3e8dda(0x1b8)]&&(_0x5ed472[_0x3e8dda(0x1b8)]=_0x4a981b[_0x3e8dda(0x1b8)]);if(_0x4a981b['interval'])_0x5ed472[_0x3e8dda(0x21f)]=_0x4a981b['interval'];let _0x544382;try{_0x544382=await _0x2978f2[_0x3e8dda(0x1ee)][_0x3e8dda(0x16e)](_0x5a35a6,_0x5ed472),_0x13e5f6[_0x3e8dda(0x187)]();}catch(_0x477a6e){_0x13e5f6[_0x3e8dda(0x187)]();throw _0x477a6e;}const _0x35a15d=_0x4a981b[_0x3e8dda(0x21f)]||_0x3e8dda(0x249);return this[_0x3e8dda(0x155)](_0x544382,_0x5ed472,_0x52d190,_0x35a15d),_0x544382[_0x3e8dda(0x14e)]?0x0:0x1;}[a22_0x46829f(0x155)](_0x233c0a,_0x30762a,_0x3c4d55,_0x501386){const _0x36b611=a22_0x46829f;console[_0x36b611(0x248)]('\x0a'+a22_0x225566[_0x36b611(0x16d)](_0x36b611(0x1e0))+'\x20'+_0x233c0a[_0x36b611(0x151)]),console[_0x36b611(0x248)]('═'[_0x36b611(0x191)](0x3c)),this[_0x36b611(0x1f3)](_0x233c0a);if(typeof _0x30762a[_0x36b611(0x1e8)]===_0x36b611(0x270)){this['displayAttributesStats'](_0x233c0a),this['displaySummary'](_0x233c0a),this['displayPreviewHints'](_0x3c4d55,_0x501386,'attribute',_0x30762a['attribute']);return;}if(_0x30762a[_0x36b611(0x1e8)]===!![]){this[_0x36b611(0x17d)](_0x233c0a),this[_0x36b611(0x226)](_0x233c0a),this[_0x36b611(0x1e4)](_0x3c4d55,_0x501386,_0x36b611(0x250));return;}if(typeof _0x30762a[_0x36b611(0x1b8)]===_0x36b611(0x270)){this[_0x36b611(0x201)](_0x233c0a,_0x501386),this[_0x36b611(0x226)](_0x233c0a),this['displayPreviewHints'](_0x3c4d55,_0x501386,_0x36b611(0x1b8),_0x30762a[_0x36b611(0x1b8)]);return;}if(_0x30762a[_0x36b611(0x1b8)]===!![]){this[_0x36b611(0x201)](_0x233c0a,_0x501386),this['displaySummary'](_0x233c0a),this[_0x36b611(0x1e4)](_0x3c4d55,_0x501386,_0x36b611(0x255));return;}this[_0x36b611(0x17d)](_0x233c0a),this[_0x36b611(0x201)](_0x233c0a,_0x501386),this['displaySummary'](_0x233c0a),this[_0x36b611(0x1e4)](_0x3c4d55,_0x501386,_0x36b611(0x15f));}[a22_0x46829f(0x1e4)](_0x1705a9,_0x2993da,_0x229c1c,_0x5b9a7f){const _0x6608e6=a22_0x46829f;console['error']('\x0a'+a22_0x225566[_0x6608e6(0x1f0)](_0x6608e6(0x1ff)));const _0x1b9c9a=_0x2993da!==_0x6608e6(0x249)?_0x6608e6(0x224)+_0x2993da:'';if(_0x229c1c===_0x6608e6(0x1e8)&&_0x5b9a7f)console['error']('\x20\x20'+a22_0x225566[_0x6608e6(0x1f0)](_0x6608e6(0x22f)+_0x1705a9+'\x20--attribute\x20\x22'+_0x5b9a7f+'\x22'+_0x1b9c9a));else{if(_0x229c1c===_0x6608e6(0x1b8)&&_0x5b9a7f)console[_0x6608e6(0x248)]('\x20\x20'+a22_0x225566['dim'](_0x6608e6(0x22f)+_0x1705a9+_0x6608e6(0x17a)+_0x5b9a7f+'\x22'+_0x1b9c9a));else(_0x229c1c===_0x6608e6(0x250)||_0x229c1c===_0x6608e6(0x15f))&&console[_0x6608e6(0x248)]('\x20\x20'+a22_0x225566[_0x6608e6(0x1f0)](_0x6608e6(0x22f)+_0x1705a9+'\x20--attribute\x20\x22<name>\x22'+_0x1b9c9a));}(_0x229c1c===_0x6608e6(0x255)||_0x229c1c===_0x6608e6(0x15f))&&console[_0x6608e6(0x248)]('\x20\x20'+a22_0x225566['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x1705a9+_0x6608e6(0x180)+_0x1b9c9a)),_0x229c1c===_0x6608e6(0x15f)&&console[_0x6608e6(0x248)]('\x20\x20'+a22_0x225566[_0x6608e6(0x1f0)](_0x6608e6(0x22f)+_0x1705a9+_0x6608e6(0x288)+_0x1b9c9a));}['displayMasterInfo'](_0x11c28f){const _0xa5aa10=a22_0x46829f,{master:_0x525837}=_0x11c28f,_0x17c892=_0x525837['schemaValid']?a22_0x225566[_0xa5aa10(0x1d3)]('✔'):a22_0x225566['red']('✘');console[_0xa5aa10(0x248)]('\x0a'+a22_0x225566[_0xa5aa10(0x1f0)](_0xa5aa10(0x19f))),console[_0xa5aa10(0x248)](_0x17c892+'\x20'+a22_0x225566[_0xa5aa10(0x16d)](_0x525837[_0xa5aa10(0x275)]+'.'+_0x525837[_0xa5aa10(0x1fa)])),_0x525837[_0xa5aa10(0x23c)]?_0x525837[_0xa5aa10(0x164)]!==undefined&&console[_0xa5aa10(0x248)]('\x20\x20'+a22_0x225566[_0xa5aa10(0x1f0)]('Rows:')+'\x20'+a22_0x225566[_0xa5aa10(0x159)](formatRows(_0x525837[_0xa5aa10(0x164)]))):console['error']('\x20\x20'+a22_0x225566[_0xa5aa10(0x1b4)]('Error:')+'\x20'+_0x525837[_0xa5aa10(0x15c)]);}[a22_0x46829f(0x17d)](_0x1b8b9f){const _0xddaab4=a22_0x46829f;if(_0x1b8b9f['attributes']['length']===0x0)return;console[_0xddaab4(0x248)]('\x0a'+a22_0x225566[_0xddaab4(0x1f0)]('Attributes'));for(const _0x3b8215 of _0x1b8b9f['attributes']){const _0x45000e=_0x3b8215[_0xddaab4(0x23c)]?a22_0x225566['green']('✔'):a22_0x225566[_0xddaab4(0x1b4)]('✘');let _0x3606fa='';if(_0x3b8215[_0xddaab4(0x23c)]&&_0x3b8215[_0xddaab4(0x1e7)]!==undefined&&_0x3b8215['coveragePercent']!==undefined){const _0x3bedc4=_0x3b8215[_0xddaab4(0x18b)][_0xddaab4(0x1fd)](0x1),_0x49f868=_0x3b8215[_0xddaab4(0x18b)]>=0x50?a22_0x225566['green']:_0x3b8215[_0xddaab4(0x18b)]>=0x32?a22_0x225566['yellow']:a22_0x225566[_0xddaab4(0x1b4)];_0x3606fa='\x20'+a22_0x225566['dim'](_0xddaab4(0x163))+'\x20'+_0x49f868(_0x3bedc4+'%')+'\x20('+formatRows(_0x3b8215[_0xddaab4(0x1e7)])+_0xddaab4(0x1ea);}console[_0xddaab4(0x248)](_0x45000e+'\x20'+a22_0x225566[_0xddaab4(0x16d)](_0x3b8215['name'])+_0x3606fa),console[_0xddaab4(0x248)]('\x20\x20'+a22_0x225566[_0xddaab4(0x1f0)](_0xddaab4(0x1b0))+'\x20'+a22_0x225566[_0xddaab4(0x16d)](_0x3b8215['database']+'.'+_0x3b8215[_0xddaab4(0x1fa)]));const _0x23b2c7=_0x3b8215['joinKey']===_0x3b8215[_0xddaab4(0x287)]?a22_0x225566[_0xddaab4(0x1f0)](_0xddaab4(0x27e))+'\x20'+_0x3b8215[_0xddaab4(0x153)]:a22_0x225566[_0xddaab4(0x1f0)]('Join:')+'\x20'+_0x3b8215['joinKey']+_0xddaab4(0x1c3)+_0x3b8215[_0xddaab4(0x287)];console[_0xddaab4(0x248)]('\x20\x20'+_0x23b2c7),console[_0xddaab4(0x248)]('\x20\x20'+a22_0x225566[_0xddaab4(0x1f0)]('Columns:')),this[_0xddaab4(0x220)](_0x3b8215[_0xddaab4(0x1d0)]),!_0x3b8215['schemaValid']&&console['error']('\x20\x20'+a22_0x225566[_0xddaab4(0x1b4)](_0xddaab4(0x1e1))+'\x20'+_0x3b8215[_0xddaab4(0x15c)]);}}[a22_0x46829f(0x201)](_0x46709b,_0x4f8b58){const _0x522946=a22_0x46829f;if(_0x46709b['behaviors'][_0x522946(0x1a9)]===0x0)return;console[_0x522946(0x248)]('\x0a'+a22_0x225566[_0x522946(0x1f0)]('Behaviors')+'\x20'+a22_0x225566[_0x522946(0x1f0)]('('+_0x4f8b58+')'));for(const _0x54f917 of _0x46709b[_0x522946(0x255)]){const _0xfece88=_0x54f917[_0x522946(0x23c)]?a22_0x225566[_0x522946(0x1d3)]('✔'):a22_0x225566[_0x522946(0x1b4)]('✘');let _0xea0c2a='';if(_0x54f917[_0x522946(0x23c)]&&_0x54f917[_0x522946(0x280)]!==undefined&&_0x54f917[_0x522946(0x172)]!==undefined){const _0x1919fe=_0x54f917['customerPercent']?.[_0x522946(0x1fd)](0x1)||'?',_0x480091=(_0x54f917[_0x522946(0x26b)]??0x0)>=0x32?a22_0x225566['green']:(_0x54f917[_0x522946(0x26b)]??0x0)>=0x14?a22_0x225566[_0x522946(0x19b)]:a22_0x225566[_0x522946(0x1b4)];_0xea0c2a='\x20'+a22_0x225566[_0x522946(0x1f0)]('Customers:')+'\x20'+_0x480091(formatRows(_0x54f917[_0x522946(0x280)]))+'\x20('+_0x1919fe+_0x522946(0x1d1)+a22_0x225566[_0x522946(0x1f0)]('Events:')+'\x20'+a22_0x225566[_0x522946(0x159)](formatRows(_0x54f917[_0x522946(0x172)]));}console[_0x522946(0x248)](_0xfece88+'\x20'+a22_0x225566[_0x522946(0x16d)](_0x54f917[_0x522946(0x151)])+_0xea0c2a),console[_0x522946(0x248)]('\x20\x20'+a22_0x225566[_0x522946(0x1f0)](_0x522946(0x1b0))+'\x20'+a22_0x225566[_0x522946(0x16d)](_0x54f917['database']+'.'+_0x54f917[_0x522946(0x1fa)]));const _0x4b9542=_0x54f917[_0x522946(0x153)]===_0x54f917[_0x522946(0x287)]?a22_0x225566[_0x522946(0x1f0)]('Join\x20on:')+'\x20'+_0x54f917[_0x522946(0x153)]:a22_0x225566[_0x522946(0x1f0)](_0x522946(0x1c6))+'\x20'+_0x54f917['joinKey']+_0x522946(0x1c3)+_0x54f917[_0x522946(0x287)];console[_0x522946(0x248)]('\x20\x20'+_0x4b9542),console['error']('\x20\x20'+a22_0x225566['dim'](_0x522946(0x179))),this[_0x522946(0x220)](_0x54f917['columns']),!_0x54f917[_0x522946(0x23c)]&&console[_0x522946(0x248)]('\x20\x20'+a22_0x225566[_0x522946(0x1b4)](_0x522946(0x1e1))+'\x20'+_0x54f917[_0x522946(0x15c)]);}}[a22_0x46829f(0x220)](_0x42a3cf){const _0x597663=a22_0x46829f;for(const _0x359ffc of _0x42a3cf){_0x359ffc[_0x597663(0x232)]===_0x359ffc['column']||_0x359ffc[_0x597663(0x1bd)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x359ffc[_0x597663(0x232)]):console[_0x597663(0x248)](_0x597663(0x1b9)+_0x359ffc[_0x597663(0x232)]+'\x20'+a22_0x225566[_0x597663(0x1f0)]('('+_0x359ffc['column']+')'));}}[a22_0x46829f(0x226)](_0x345f64){const _0x1ecb69=a22_0x46829f;console[_0x1ecb69(0x248)]('─'[_0x1ecb69(0x191)](0x3c));if(_0x345f64['errors'][_0x1ecb69(0x1a9)]>0x0){console[_0x1ecb69(0x248)]('\x0a'+a22_0x225566[_0x1ecb69(0x1b4)]('Errors:'));for(const _0x497065 of _0x345f64[_0x1ecb69(0x19a)]){console['error']('\x20\x20'+a22_0x225566[_0x1ecb69(0x1b4)]('•')+'\x20'+_0x497065);}}_0x345f64['allValid']&&console['error']('\x0a'+a22_0x225566[_0x1ecb69(0x1d3)]('✔')+_0x1ecb69(0x1d6));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x46829f(0x151)]='segment:parent:preview';[a22_0x46829f(0x1e9)]=a22_0x46829f(0x282);async['execute'](_0x5f2517){const _0x1856d8=a22_0x46829f,{options:_0x15f9c7,args:_0x50e243,tdx:_0x522aa6}=_0x5f2517,_0x833752=_0x15f9c7,_0x52a1b1=_0x50e243[0x0]||_0x15f9c7[_0x1856d8(0x1f4)];if(!_0x52a1b1)return showParentSegmentNotSetError(_0x1856d8(0x1c2)+_0x1856d8(0x1ac)+'Options\x20(one\x20required):\x0a'+_0x1856d8(0x14b)+_0x1856d8(0x272)+_0x1856d8(0x1c0)+_0x1856d8(0x1cc)+_0x1856d8(0x268)),0x1;if(!_0x833752[_0x1856d8(0x1bf)]&&!_0x833752[_0x1856d8(0x1e8)]&&!_0x833752[_0x1856d8(0x1b8)]&&!_0x833752[_0x1856d8(0x24a)])return console[_0x1856d8(0x248)](a22_0x225566[_0x1856d8(0x1b4)](_0x1856d8(0x1b7))),console[_0x1856d8(0x248)](_0x1856d8(0x1ae)),console[_0x1856d8(0x248)](_0x1856d8(0x264)),console[_0x1856d8(0x248)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x1856d8(0x210)),console[_0x1856d8(0x248)](_0x1856d8(0x25c)),console['error'](_0x1856d8(0x208)),0x1;const _0x1bb815=resolveYamlFile(_0x52a1b1);if(!existsSync(_0x1bb815))return showFileNotFoundError(_0x1bb815,_0x52a1b1),0x1;_0x833752[_0x1856d8(0x24c)]&&(console[_0x1856d8(0x248)](_0x1856d8(0x215)+_0x833752[_0x1856d8(0x27d)]),console[_0x1856d8(0x248)]('YAML\x20file:\x20'+_0x1bb815));let _0x44c26d;try{_0x44c26d=readFileSync(_0x1bb815,'utf-8');}catch(_0x214f54){const _0x49e0b7=_0x214f54 instanceof Error?_0x214f54['message']:String(_0x214f54);return console['error']('Error\x20reading\x20file:\x20'+_0x49e0b7),0x1;}let _0x56bec0;try{_0x56bec0=parseDef(_0x44c26d);}catch(_0x34ba86){const _0x5e0359=_0x34ba86 instanceof Error?_0x34ba86[_0x1856d8(0x18f)]:String(_0x34ba86);return console[_0x1856d8(0x248)](a22_0x225566[_0x1856d8(0x1b4)](_0x1856d8(0x23f)+_0x5e0359)),0x1;}if(_0x833752[_0x1856d8(0x1e8)]===!![]||_0x833752[_0x1856d8(0x1e8)]===''){const _0x5f3287=_0x56bec0[_0x1856d8(0x250)]?.[_0x1856d8(0x1a3)](_0x184ca3=>_0x184ca3[_0x1856d8(0x151)])||[];if(_0x5f3287['length']===0x0)console[_0x1856d8(0x248)](a22_0x225566[_0x1856d8(0x1b4)](_0x1856d8(0x1db)));else{console[_0x1856d8(0x248)](a22_0x225566[_0x1856d8(0x1b4)](_0x1856d8(0x1c8))),console[_0x1856d8(0x248)]('Available\x20attributes:');for(const _0x403f45 of _0x5f3287){console[_0x1856d8(0x248)]('\x20\x20'+a22_0x225566['cyan'](_0x403f45));}console[_0x1856d8(0x248)](_0x1856d8(0x204)+_0x52a1b1+_0x1856d8(0x158)+_0x5f3287[0x0]+'\x22');}return 0x1;}if(_0x833752[_0x1856d8(0x1b8)]===!![]||_0x833752[_0x1856d8(0x1b8)]===''){const _0x470ed7=_0x56bec0[_0x1856d8(0x255)]?.['map'](_0x3ff4c3=>_0x3ff4c3['name'])||[];if(_0x470ed7[_0x1856d8(0x1a9)]===0x0)console['error'](a22_0x225566[_0x1856d8(0x1b4)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a22_0x225566[_0x1856d8(0x1b4)](_0x1856d8(0x1a4))),console[_0x1856d8(0x248)]('Available\x20behaviors:');for(const _0x5e55f5 of _0x470ed7){console[_0x1856d8(0x248)]('\x20\x20'+a22_0x225566[_0x1856d8(0x159)](_0x5e55f5));}console[_0x1856d8(0x248)](_0x1856d8(0x204)+_0x52a1b1+_0x1856d8(0x17a)+_0x470ed7[0x0]+'\x22');}return 0x1;}const _0x419814=createCommandSpinner(a22_0x225566[_0x1856d8(0x1f0)]('Fetching\x20sample\x20data...'),{'verbose':_0x833752[_0x1856d8(0x24c)]});_0x419814['start']();const _0x2c040f={'onProgress':_0x58cb61=>{_0x419814['text']=formatProgressMessage(_0x58cb61);}};if(_0x833752[_0x1856d8(0x1bf)])_0x2c040f[_0x1856d8(0x1bf)]=!![];if(_0x833752[_0x1856d8(0x1e8)]&&typeof _0x833752[_0x1856d8(0x1e8)]===_0x1856d8(0x270))_0x2c040f[_0x1856d8(0x1e8)]=_0x833752['attribute'];if(_0x833752['behavior']&&typeof _0x833752[_0x1856d8(0x1b8)]==='string')_0x2c040f[_0x1856d8(0x1b8)]=_0x833752['behavior'];if(_0x833752[_0x1856d8(0x24a)])_0x2c040f[_0x1856d8(0x24a)]=!![];if(_0x833752['interval'])_0x2c040f[_0x1856d8(0x21f)]=_0x833752[_0x1856d8(0x21f)];let _0x4dfeb2;try{_0x4dfeb2=await _0x522aa6['segment']['previewParentYaml'](_0x44c26d,_0x2c040f),_0x419814[_0x1856d8(0x187)]();}catch(_0x25b332){_0x419814[_0x1856d8(0x187)]();throw _0x25b332;}return await this[_0x1856d8(0x218)](_0x4dfeb2,{'master':_0x833752[_0x1856d8(0x1bf)],'attribute':typeof _0x833752[_0x1856d8(0x1e8)]===_0x1856d8(0x270)?_0x833752[_0x1856d8(0x1e8)]:undefined,'behavior':typeof _0x833752[_0x1856d8(0x1b8)]===_0x1856d8(0x270)?_0x833752[_0x1856d8(0x1b8)]:undefined,'enriched':_0x833752[_0x1856d8(0x24a)]}),_0x4dfeb2[_0x1856d8(0x14e)]?0x0:0x1;}async[a22_0x46829f(0x218)](_0x15005f,_0x12944d){const _0xf41f26=a22_0x46829f;console[_0xf41f26(0x248)]('\x0a'+a22_0x225566[_0xf41f26(0x16d)](_0xf41f26(0x244))+'\x20'+_0x15005f['name']),console['error']('═'[_0xf41f26(0x191)](0x3c));if(_0x12944d['master']&&_0x15005f[_0xf41f26(0x18d)]){const _0x1c410a=a22_0x225566['dim']('Master:')+'\x20'+a22_0x225566[_0xf41f26(0x16d)](_0x15005f[_0xf41f26(0x1bf)][_0xf41f26(0x275)]+'.'+_0x15005f[_0xf41f26(0x1bf)]['table']);await this['displaySampleData'](_0x1c410a,_0x15005f[_0xf41f26(0x18d)]);}else{if(_0x12944d['attribute']&&_0x15005f[_0xf41f26(0x18d)]){const _0x344af7=a22_0x225566['dim'](_0xf41f26(0x166))+'\x20'+a22_0x225566['bold'](_0x12944d[_0xf41f26(0x1e8)]);await this[_0xf41f26(0x193)](_0x344af7,_0x15005f['sampleData']);}else{if(_0x12944d['behavior']&&_0x15005f[_0xf41f26(0x18d)]){const _0x2327af=a22_0x225566[_0xf41f26(0x1f0)](_0xf41f26(0x25d))+'\x20'+a22_0x225566[_0xf41f26(0x16d)](_0x12944d[_0xf41f26(0x1b8)]);await this[_0xf41f26(0x193)](_0x2327af,_0x15005f['sampleData']);}else{if(_0x12944d['enriched']&&_0x15005f['sampleData']){const _0x318e28=a22_0x225566[_0xf41f26(0x1f0)](_0xf41f26(0x230))+'\x20'+a22_0x225566['bold'](_0xf41f26(0x253));await this[_0xf41f26(0x193)](_0x318e28,_0x15005f[_0xf41f26(0x18d)]);}else!_0x15005f[_0xf41f26(0x18d)]&&console[_0xf41f26(0x248)](_0xf41f26(0x1ab));}}}if(_0x15005f[_0xf41f26(0x19a)]['length']>0x0){console['error']('─'[_0xf41f26(0x191)](0x3c)),console[_0xf41f26(0x248)]('\x0a'+a22_0x225566['red'](_0xf41f26(0x236)));for(const _0x6fcc0 of _0x15005f[_0xf41f26(0x19a)]){console[_0xf41f26(0x248)]('\x20\x20'+a22_0x225566[_0xf41f26(0x1b4)]('•')+'\x20'+_0x6fcc0);}}}async[a22_0x46829f(0x193)](_0x1b114f,_0x3b7445){const _0x249e0a=a22_0x46829f;if(_0x3b7445[_0x249e0a(0x1a9)]===0x0){console['error']('\x0a'+_0x1b114f),console[_0x249e0a(0x248)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x249e0a(0x248)]('\x0a'+_0x1b114f);const _0x2ea5f9=Object[_0x249e0a(0x27f)](_0x3b7445[0x0])[_0x249e0a(0x1a3)](_0x299a80=>({'name':_0x299a80,'type':typeof _0x3b7445[0x0][_0x299a80]===_0x249e0a(0x1a2)?'double':'varchar'})),_0x407ed1={'queryId':_0x249e0a(0x24f),'columns':_0x2ea5f9,'data':_0x3b7445,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3b7445['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x260bbe=formatAsTable(_0x407ed1,_0x3b7445[_0x249e0a(0x1a9)],!![]);await writeOutput(_0x260bbe,undefined,_0x249e0a(0x1fa));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x21d);[a22_0x46829f(0x1e9)]=a22_0x46829f(0x26a);async[a22_0x46829f(0x274)](_0x4b7384){const _0x5a627f=a22_0x46829f,{options:_0x502603,args:_0xf1a033,tdx:_0x4069ba}=_0x4b7384,_0x583dc5=_0x502603,_0x4b95e4=_0xf1a033[0x0]||_0x502603['parentSegment'];if(!_0x4b95e4)return showParentSegmentNotSetError(_0x5a627f(0x284)+_0x5a627f(0x18a)),0x1;const _0x3af112=resolveYamlFile(_0x4b95e4);if(existsSync(_0x3af112)){_0x583dc5[_0x5a627f(0x24c)]&&console['error'](_0x5a627f(0x24e)+_0x3af112);let _0x18d342;try{_0x18d342=readFileSync(_0x3af112,'utf-8');}catch(_0x4d25b9){const _0x32d254=_0x4d25b9 instanceof Error?_0x4d25b9[_0x5a627f(0x18f)]:String(_0x4d25b9);return console[_0x5a627f(0x248)](_0x5a627f(0x221)+_0x32d254),0x1;}const _0x3ba3c4=await withSpinner('Analyzing\x20changes...',()=>_0x4069ba[_0x5a627f(0x1ee)][_0x5a627f(0x1b5)](_0x18d342),{'verbose':_0x583dc5[_0x5a627f(0x24c)]}),_0x547f63=_0x3ba3c4[_0x5a627f(0x241)],{isNew:_0x22d2e6,name:_0x3ce3c7,hasChanges:_0x5991e6,diffFormatted:_0x468794}=_0x547f63;if(_0x5991e6){_0x22d2e6?console[_0x5a627f(0x248)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3ce3c7+'\x27:'):console[_0x5a627f(0x248)](_0x5a627f(0x202)+_0x3ce3c7+'\x27:');console[_0x5a627f(0x248)]('─'[_0x5a627f(0x191)](0x3c)),console[_0x5a627f(0x248)](_0x468794),console[_0x5a627f(0x248)]('─'['repeat'](0x3c));const _0x3610ca=_0x22d2e6?_0x5a627f(0x1d2)+_0x3ce3c7+_0x5a627f(0x1e5):_0x5a627f(0x174)+_0x3ce3c7+'\x27\x20and\x20run\x20workflow?';if(!_0x583dc5[_0x5a627f(0x150)]){if(!isInteractive())return console[_0x5a627f(0x248)](a22_0x225566[_0x5a627f(0x1b4)](_0x5a627f(0x21a)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x5a627f(0x248)](a22_0x225566['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x774112=await confirmKey(_0x3610ca);if(!_0x774112)return console[_0x5a627f(0x248)](a22_0x225566[_0x5a627f(0x19b)](_0x5a627f(0x1f7))),0x1;}const _0x7793d3=_0x22d2e6?_0x5a627f(0x165):'Updating';await withSpinner(_0x7793d3+'\x20parent\x20segment\x20\x27'+_0x3ce3c7+_0x5a627f(0x178),()=>_0x547f63['apply'](),{'verbose':_0x583dc5[_0x5a627f(0x24c)]});const _0x2a1dc3=_0x22d2e6?_0x5a627f(0x27a):_0x5a627f(0x168);console[_0x5a627f(0x248)]('✔\x20'+_0x2a1dc3+_0x5a627f(0x183)+_0x3ce3c7+'\x27');}else console[_0x5a627f(0x248)](_0x5a627f(0x25b)+_0x3ce3c7+_0x5a627f(0x16a));}const _0x1ba57c=await withSpinner(_0x5a627f(0x245)+_0x4b95e4+'\x27...',()=>_0x4069ba[_0x5a627f(0x1ee)][_0x5a627f(0x227)](_0x4b95e4),{'verbose':_0x583dc5[_0x5a627f(0x24c)]}),_0x18aeff=_0x1ba57c[_0x5a627f(0x241)],_0x7fa5e=getConsoleUrl(_0x583dc5['site'],_0x5a627f(0x225)+_0x18aeff[_0x5a627f(0x212)]+_0x5a627f(0x17c)+_0x18aeff['workflowSessionId']+_0x5a627f(0x209)+_0x18aeff[_0x5a627f(0x176)]);return console[_0x5a627f(0x248)](_0x5a627f(0x197)),console['error']('\x20\x20'+a22_0x225566[_0x5a627f(0x1f0)]('Audience\x20ID:')+'\x20'+_0x18aeff[_0x5a627f(0x28c)]),console[_0x5a627f(0x248)]('\x20\x20'+a22_0x225566[_0x5a627f(0x1f0)]('Status:')+'\x20'+_0x18aeff[_0x5a627f(0x1a8)]),console[_0x5a627f(0x248)]('\x20\x20'+a22_0x225566[_0x5a627f(0x1f0)](_0x5a627f(0x17e))+'\x20'+_0x18aeff['workflowSessionId']),console[_0x5a627f(0x248)]('\x20\x20'+a22_0x225566[_0x5a627f(0x1f0)](_0x5a627f(0x235))+'\x20'+_0x18aeff[_0x5a627f(0x176)]),console[_0x5a627f(0x248)]('\x20\x20'+_0x7fa5e),console[_0x5a627f(0x248)]('\x0a'+a22_0x225566[_0x5a627f(0x1f0)](_0x5a627f(0x20f))+_0x5a627f(0x23d)+_0x18aeff[_0x5a627f(0x176)]+_0x5a627f(0x1f9)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x46829f(0x151)]='segment:parent:fields';[a22_0x46829f(0x1e9)]=a22_0x46829f(0x181);async[a22_0x46829f(0x274)](_0x9a3cf6){const _0x539fdc=a22_0x46829f,{options:_0x203431,args:_0xacef99,tdx:_0x16d22f}=_0x9a3cf6,_0x4ba876=_0xacef99[0x0]||_0x203431[_0x539fdc(0x1f4)];if(!_0x4ba876)return showParentSegmentNotSetError(_0x539fdc(0x265)+_0x539fdc(0x242)),0x1;_0x203431[_0x539fdc(0x24c)]&&(console[_0x539fdc(0x248)](_0x539fdc(0x215)+_0x203431[_0x539fdc(0x27d)]),console[_0x539fdc(0x248)]('Parent\x20segment:\x20'+_0x4ba876));const _0x526321=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x4ba876+_0x539fdc(0x178),()=>_0x16d22f['segment'][_0x539fdc(0x194)](_0x4ba876),{'verbose':_0x203431[_0x539fdc(0x24c)]}),_0x5e8ea4=_0x526321[_0x539fdc(0x241)];console[_0x539fdc(0x248)](_0x539fdc(0x24b)+_0x5e8ea4['length']+_0x539fdc(0x219)+(_0x5e8ea4['length']!==0x1?'s':''));if(_0x203431['json']||_0x203431['jsonl'])return await handleSDKOutput(_0x5e8ea4,_0x203431),0x0;return displayFieldsHumanReadable(_0x5e8ea4,_0x4ba876),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x195);[a22_0x46829f(0x1e9)]=a22_0x46829f(0x148);async['execute'](_0x2c1836){const _0x54c14f=a22_0x46829f,{options:_0x2dc649,args:_0x2ebe1e,tdx:_0xfbeca6}=_0x2c1836,_0x3f06fe=_0x2dc649,_0x21d272=_0x2ebe1e[0x0]||_0x2dc649['parentSegment'];if(!_0x21d272)return showParentSegmentNotSetError(_0x54c14f(0x21b)+_0x54c14f(0x1dc)+_0x54c14f(0x1f2)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x2dc649[_0x54c14f(0x24c)]&&(console[_0x54c14f(0x248)]('Site:\x20'+_0x2dc649[_0x54c14f(0x27d)]),console[_0x54c14f(0x248)]('Parent\x20segment:\x20'+_0x21d272));const _0x30c70d=await withSpinner(_0x54c14f(0x273)+_0x21d272+_0x54c14f(0x178),()=>_0xfbeca6[_0x54c14f(0x1ee)][_0x54c14f(0x14d)](_0x21d272),{'verbose':_0x2dc649['verbose']}),_0x2c667c=_0x30c70d['data'];if(_0x3f06fe[_0x54c14f(0x1aa)]){const _0x4c2ead=getConsoleNextUrl(_0x3f06fe['site'],'/app/dw/parentSegments/'+_0x2c667c['id']);return console[_0x54c14f(0x248)](a22_0x225566[_0x54c14f(0x1d3)]('✔')+_0x54c14f(0x260)+a22_0x225566[_0x54c14f(0x159)](_0x4c2ead)),openBrowser(_0x4c2ead),0x0;}return await handleSingleObjectOutput(_0x2c667c,_0x2dc649),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x46829f(0x151)]='segment:parent:desc';['description']=a22_0x46829f(0x216);async[a22_0x46829f(0x274)](_0xe4a47a){const _0x58d268=a22_0x46829f,{options:_0x4c4074,args:_0x270848,tdx:_0x211df9}=_0xe4a47a,_0x3a3355=_0x4c4074,_0x40050f=_0x270848[0x0]||_0x4c4074['parentSegment'];if(!_0x40050f)return showParentSegmentNotSetError(_0x58d268(0x1c7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x58d268(0x1f2)+_0x58d268(0x1f6)),0x1;_0x4c4074[_0x58d268(0x24c)]&&(console['error'](_0x58d268(0x215)+_0x4c4074[_0x58d268(0x27d)]),console[_0x58d268(0x248)]('Parent\x20segment:\x20'+_0x40050f));const _0xf9776c=await withSpinner(_0x58d268(0x16c)+_0x40050f+_0x58d268(0x178),()=>_0x211df9[_0x58d268(0x1ee)][_0x58d268(0x198)](_0x40050f),{'verbose':_0x4c4074[_0x58d268(0x24c)]}),_0xc3fa64=_0xf9776c[_0x58d268(0x241)],_0x3d4854=_0x211df9['segment'][_0x58d268(0x16b)](_0xc3fa64);if(_0x3a3355[_0x58d268(0x1e2)]){const _0x2a9f1d=await this[_0x58d268(0x20e)](_0xe4a47a,_0x40050f,_0xc3fa64,_0x3d4854),_0x1b992a=this[_0x58d268(0x26e)](_0x2a9f1d);writeFileSync(_0x3a3355[_0x58d268(0x1e2)],_0x1b992a);const _0x699a65=_0x2a9f1d[_0x58d268(0x281)][_0x58d268(0x1d0)][_0x58d268(0x1a9)]+_0x2a9f1d[_0x58d268(0x255)]['reduce']((_0x5a01c6,_0x1b1420)=>_0x5a01c6+_0x1b1420[_0x58d268(0x1d0)][_0x58d268(0x1a9)],0x0),_0xcd91ba=_0x2a9f1d['behaviors'][_0x58d268(0x1c9)](_0x5ab7e4=>_0x5ab7e4['columns'][_0x58d268(0x1a9)]===0x0)[_0x58d268(0x1a9)];return console[_0x58d268(0x23a)](_0x58d268(0x22d)+_0x3a3355['output']),console[_0x58d268(0x23a)]('\x20\x20Database:\x20'+_0x3d4854),console[_0x58d268(0x23a)](_0x58d268(0x1ba)+_0x2a9f1d[_0x58d268(0x255)][_0x58d268(0x1a9)]+'\x20behaviors'),console['log']('\x20\x20Columns:\x20'+_0x699a65+'\x20total'),_0xcd91ba>0x0&&console[_0x58d268(0x23a)](_0x58d268(0x1e3)+_0xcd91ba+_0x58d268(0x22a)),0x0;}console[_0x58d268(0x248)]('\x0a'+a22_0x225566[_0x58d268(0x16d)]('Output\x20Database:')+'\x20'+a22_0x225566['cyan'](_0x3d4854));const _0x54324f=await withSpinner(_0x58d268(0x160),()=>_0x211df9['segment']['getParentSQL'](_0xc3fa64),{'verbose':_0x4c4074[_0x58d268(0x24c)]});console['error']('\x0a'+a22_0x225566[_0x58d268(0x16d)](_0x58d268(0x281))+'\x20'+a22_0x225566[_0x58d268(0x1f0)]('('+_0x3d4854+_0x58d268(0x1cd)));const _0x3a1d74=await executeSchemaQuery(_0x54324f['data'],_0x211df9,_0x4c4074);await handleQueryOutput(_0x3a1d74,_0x4c4074);const _0x4265a1=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x211df9[_0x58d268(0x1ee)][_0x58d268(0x252)](_0xc3fa64),{'verbose':_0x4c4074[_0x58d268(0x24c)]});for(const _0x33976d of _0x4265a1[_0x58d268(0x241)]){const _0x161920=_0x58d268(0x276)+_0x33976d['toLowerCase']()[_0x58d268(0x1ca)](/\s+/g,'_'),_0x40a55a=_0x58d268(0x239)+_0x3d4854+'.'+_0x161920;console[_0x58d268(0x248)]('\x0a'+a22_0x225566[_0x58d268(0x16d)](_0x33976d)+'\x20'+a22_0x225566[_0x58d268(0x1f0)]('('+_0x3d4854+'.'+_0x161920+')'));try{const _0x87495=await executeSchemaQuery(_0x40a55a,_0x211df9,_0x4c4074);await handleQueryOutput(_0x87495,_0x4c4074);}catch{console[_0x58d268(0x248)](a22_0x225566[_0x58d268(0x19b)](_0x58d268(0x184)));}}return 0x0;}async[a22_0x46829f(0x20e)](_0x230e5d,_0x3a3e8c,_0x1a9b06,_0x3ae62c){const _0x38bc87=a22_0x46829f,{options:_0x28c695,tdx:_0x28c9fb}=_0x230e5d,_0x4a027d=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x28c9fb[_0x38bc87(0x1ee)]['getParentSQL'](_0x1a9b06),{'verbose':_0x28c695[_0x38bc87(0x24c)]}),_0x21d066=await executeSchemaQuery(_0x4a027d[_0x38bc87(0x241)],_0x28c9fb,_0x28c695),_0xcda396=_0x21d066[_0x38bc87(0x241)][_0x38bc87(0x1a3)](_0x2b81ea=>({'name':_0x2b81ea[_0x38bc87(0x175)],'type':_0x2b81ea[_0x38bc87(0x21c)]})),_0x274ddb=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x28c9fb[_0x38bc87(0x1ee)][_0x38bc87(0x252)](_0x1a9b06),{'verbose':_0x28c695[_0x38bc87(0x24c)]}),_0x448ac8=[];for(const _0x2f6c93 of _0x274ddb['data']){const _0x4ea40e=_0x38bc87(0x276)+_0x2f6c93[_0x38bc87(0x15d)]()[_0x38bc87(0x1ca)](/\s+/g,'_'),_0x36c693=_0x38bc87(0x239)+_0x3ae62c+'.'+_0x4ea40e;let _0x23d041=[];try{const _0x37d98a=await executeSchemaQuery(_0x36c693,_0x28c9fb,_0x28c695);_0x23d041=_0x37d98a[_0x38bc87(0x241)][_0x38bc87(0x1a3)](_0xd2d44=>({'name':_0xd2d44[_0x38bc87(0x175)],'type':_0xd2d44[_0x38bc87(0x21c)]}));}catch{}_0x448ac8[_0x38bc87(0x27b)]({'table':_0x4ea40e,'columns':_0x23d041});}return{'database':_0x3ae62c,'parent_segment':_0x3a3e8c,'parent_id':_0x1a9b06,'customers':{'table':'customers','columns':_0xcda396},'behaviors':_0x448ac8};}[a22_0x46829f(0x26e)](_0x37f0c2){const _0x2c4b2f=a22_0x46829f,_0x3265df=_0x5a59c6=>{const _0x5c2e47=a22_0x33a2;if(_0x5a59c6[_0x5c2e47(0x1a9)]===0x0)return'[]';const _0x2a582c=_0x5a59c6[_0x5c2e47(0x1a3)](_0x52c522=>_0x5c2e47(0x262)+_0x52c522[_0x5c2e47(0x151)]+_0x5c2e47(0x1ef)+_0x52c522[_0x5c2e47(0x231)]+_0x5c2e47(0x1df));return'[\x0a'+_0x2a582c['join'](',\x0a')+_0x5c2e47(0x177);},_0x42cd96=_0x37f0c2[_0x2c4b2f(0x255)][_0x2c4b2f(0x1a3)](_0x1b348e=>{const _0x57c8ab=_0x2c4b2f;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1b348e[_0x57c8ab(0x1fa)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x3265df(_0x1b348e[_0x57c8ab(0x1d0)])[_0x57c8ab(0x1ca)](/^/gm,'\x20\x20')[_0x57c8ab(0x1d9)]()+'\x0a\x20\x20\x20\x20}';})[_0x2c4b2f(0x1a1)](',\x0a');return _0x2c4b2f(0x17b)+_0x37f0c2[_0x2c4b2f(0x275)]+_0x2c4b2f(0x28e)+_0x37f0c2[_0x2c4b2f(0x240)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x37f0c2[_0x2c4b2f(0x1af)]+_0x2c4b2f(0x1cb)+_0x37f0c2['customers'][_0x2c4b2f(0x1fa)]+_0x2c4b2f(0x1f8)+_0x3265df(_0x37f0c2[_0x2c4b2f(0x281)][_0x2c4b2f(0x1d0)])['replace'](/^/gm,'\x20\x20')[_0x2c4b2f(0x1d9)]()+_0x2c4b2f(0x217)+_0x42cd96+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x46829f(0x151)]=a22_0x46829f(0x20c);[a22_0x46829f(0x1e9)]=a22_0x46829f(0x233);async['execute'](_0x8aead0){const _0x3c71e6=a22_0x46829f,{options:_0x5ce9b3,args:_0x34f681,tdx:_0x1dbd1c}=_0x8aead0,_0x3eb3f8=_0x34f681[0x0]||_0x5ce9b3['parentSegment'];if(!_0x3eb3f8)return showParentSegmentNotSetError(_0x3c71e6(0x22c)+_0x3c71e6(0x25f)),0x1;_0x5ce9b3[_0x3c71e6(0x24c)]&&(console[_0x3c71e6(0x248)]('Site:\x20'+_0x5ce9b3[_0x3c71e6(0x27d)]),console[_0x3c71e6(0x248)]('Parent\x20segment:\x20'+_0x3eb3f8));const _0x591193=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3eb3f8+'\x27...',()=>_0x1dbd1c['segment'][_0x3c71e6(0x198)](_0x3eb3f8),{'verbose':_0x5ce9b3[_0x3c71e6(0x24c)]}),_0x397056=_0x591193[_0x3c71e6(0x241)],_0x34c71b=await withSpinner(_0x3c71e6(0x23e)+_0x3eb3f8+'\x27...',()=>_0x1dbd1c['segment'][_0x3c71e6(0x147)](_0x397056),{'verbose':_0x5ce9b3[_0x3c71e6(0x24c)]}),_0xcb9019=_0x34c71b[_0x3c71e6(0x241)];return _0x5ce9b3[_0x3c71e6(0x19e)]==='json'||_0x5ce9b3[_0x3c71e6(0x19e)]==='jsonl'?await handleSDKOutput([{'sql':_0xcb9019}],_0x5ce9b3):console[_0x3c71e6(0x23a)](_0xcb9019),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a22_0x46829f(0x1be);[a22_0x46829f(0x1e9)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x266c7a){const _0x37565a=a22_0x46829f,{options:_0x22a03a,args:_0x3eab2e,tdx:_0x4213c9}=_0x266c7a,_0x5e1837=_0x3eab2e[0x0]||_0x22a03a[_0x37565a(0x1f4)];if(!_0x5e1837)return showParentSegmentNotSetError(_0x37565a(0x257)+_0x37565a(0x1f5)),0x1;_0x22a03a[_0x37565a(0x24c)]&&(console[_0x37565a(0x248)](_0x37565a(0x215)+_0x22a03a[_0x37565a(0x27d)]),console[_0x37565a(0x248)](_0x37565a(0x254)+_0x5e1837));const _0x1ec6f1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5e1837+_0x37565a(0x178),()=>_0x4213c9[_0x37565a(0x1ee)][_0x37565a(0x198)](_0x5e1837),{'verbose':_0x22a03a[_0x37565a(0x24c)]}),_0x431dfc=_0x1ec6f1['data'],_0x3aa3fe=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5e1837+_0x37565a(0x178),()=>_0x4213c9['segment'][_0x37565a(0x147)](_0x431dfc),{'verbose':_0x22a03a[_0x37565a(0x24c)]});let _0xa0bdc=_0x3aa3fe[_0x37565a(0x241)];const _0x15ea14=resolveLimit(_0x22a03a[_0x37565a(0x277)],DEFAULT_DISPLAY_LIMIT),_0x1b2383=/\bLIMIT\s+\d+/i[_0x37565a(0x283)](_0xa0bdc);!_0x1b2383&&(_0xa0bdc=_0xa0bdc[_0x37565a(0x1d9)]()['replace'](/;+$/,''),_0xa0bdc=_0x37565a(0x214)+_0xa0bdc+_0x37565a(0x203)+_0x15ea14);_0x22a03a[_0x37565a(0x24c)]&&console['error'](_0x37565a(0x222)+_0xa0bdc);const _0x1a1382=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x220ea2=>{const _0x4595e5=_0x37565a,_0xc30b98=await _0x4213c9[_0x4595e5(0x28b)][_0x4595e5(0x274)](_0xa0bdc,{'catalog':'td','schema':_0x4595e5(0x1a0),'onJobId':_0x502ee0=>{const _0x6ec487=_0x4595e5;_0x220ea2[_0x6ec487(0x20a)](_0x502ee0);}});return _0xc30b98;},{'verbose':_0x22a03a[_0x37565a(0x24c)]}),_0x1fc720=_0x1a1382[_0x37565a(0x241)],_0x28e918=_0x1fc720[_0x37565a(0x1d5)]?'\x20[Job\x20ID:\x20'+_0x1fc720[_0x37565a(0x1d5)]+']':'';return console[_0x37565a(0x248)](_0x37565a(0x162)+_0x1fc720[_0x37565a(0x190)][_0x37565a(0x207)][_0x37565a(0x205)]()+_0x37565a(0x1eb)+(_0x37565a(0x15b)+formatElapsed(_0x1fc720[_0x37565a(0x190)][_0x37565a(0x17f)])+_0x28e918)),await handleQueryOutput(_0x1fc720,_0x22a03a),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x64c92=a23_0x5d1b;(function(_0x402f60,_0x306c08){const _0x3999a4=a23_0x5d1b,_0x53a803=_0x402f60();while(!![]){try{const _0x527a8c=-parseInt(_0x3999a4(0x14f))/0x1+-parseInt(_0x3999a4(0x10d))/0x2+parseInt(_0x3999a4(0x120))/0x3*(-parseInt(_0x3999a4(0x121))/0x4)+-parseInt(_0x3999a4(0xf7))/0x5*(-parseInt(_0x3999a4(0xee))/0x6)+parseInt(_0x3999a4(0x144))/0x7+parseInt(_0x3999a4(0x117))/0x8*(parseInt(_0x3999a4(0x153))/0x9)+-parseInt(_0x3999a4(0x138))/0xa*(parseInt(_0x3999a4(0x113))/0xb);if(_0x527a8c===_0x306c08)break;else _0x53a803['push'](_0x53a803['shift']());}catch(_0xd48b57){_0x53a803['push'](_0x53a803['shift']());}}}(a23_0x41ab,0x83024));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x236cb1 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a23_0x5d1b(_0x29899c,_0x3d6195){_0x29899c=_0x29899c-0xe4;const _0x41abf4=a23_0x41ab();let _0x5d1b04=_0x41abf4[_0x29899c];return _0x5d1b04;}function a23_0x41ab(){const _0x535e65=['\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','129LbkrDT','32484KCywAp','text','logLevel','dim','ERROR','tdx:\x20profile\x20create','log','\x20\x20-\x20','execute','Enter\x20your\x20TD\x20API\x20key:','Site\x20was\x20not\x20changed.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','config','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','llm_project','profileName','select','tdx:\x20profile\x20set','database','name','129980UqTegR','\x0aAvailable\x20profiles:','red','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','message','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','site','warn','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>','test','description','4367454iLNCRb','us01','create','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Enter\x20profile\x20name:','✗\x20Validation\x20failed:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','join','default','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','password','55302QkrjST','Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','API\x20key\x20cannot\x20be\x20empty','4232997yghNRQ','Enter\x20description\x20(optional):','parent_segment','split','error','profile:use','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:set','profile:remove','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Remove\x20a\x20profile','222UHvhYU','confirm','\x0aSetup\x20cancelled','getUserInfo','Set\x20a\x20profile\x20configuration\x20value','green','length','\x20--default\x27\x20to\x20save\x20permanently','profile','109815vidXur','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Set\x20session\x20profile','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','tdx.json','\x20\x20tdx\x20--profile\x20','\x20\x20(no\x20profiles\x20found)','Unknown\x20key\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','validate','apiKey','Validating\x20API\x20key...','\x0aOperation\x20cancelled','(cleared)','(session:\x20','\x27\x20removed\x20from\x20configuration','\x27\x20requires\x20API\x20key\x20validation.','Operation\x20cancelled','VALID_KEYS','yellow','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','trim','553750SvxdBE','\x27.\x0a\x0aValid\x20keys:\x20','jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Session\x20profile\x20set\x20to:\x20','profile:create','583dkONmu','session','email','tdx:\x20profile\x20remove','8wvFpwh','\x20Profile\x20\x27','bold','Removal\x20cancelled','includes','/app/mp/ak','customSite','\x27\x20created'];a23_0x41ab=function(){return _0x535e65;};return a23_0x41ab();}import{LogLevel}from'../utils/tdx-logger.js';import a23_0x5caf6b from'prompts';import a23_0x561b56 from'chalk';function validateProfileName(_0x34b118){const _0x21bb3e=a23_0x5d1b;if(!_0x34b118||!_0x34b118[_0x21bb3e(0x10c)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x413045=_0x34b118[_0x21bb3e(0x10c)]();if(!/^[a-zA-Z0-9_-]+$/[_0x21bb3e(0x142)](_0x413045))return _0x21bb3e(0x131);if(profileExists(_0x413045))return _0x21bb3e(0x150)+_0x413045+_0x21bb3e(0x12d);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0x112);['description']='Create\x20a\x20new\x20profile';async[a23_0x64c92(0x129)](_0x5dbde6){const _0xd746c7=a23_0x64c92,{options:_0x162a02,args:_0x1f25d8}=_0x5dbde6;console[_0xd746c7(0x127)](a23_0x561b56['bold'](_0xd746c7(0x126)));let _0x48d0b3;if(_0x1f25d8[_0xd746c7(0xf4)]>0x0&&_0x1f25d8[0x0]){const _0x1c7d07=_0x1f25d8[0x0]['trim'](),_0x38727b=validateProfileName(_0x1c7d07);if(_0x38727b!==!![])return console[_0xd746c7(0xe6)](a23_0x561b56['red'](_0x38727b)),0x1;_0x48d0b3=_0x1c7d07;}else{const _0x3d6341=await a23_0x5caf6b({'type':_0xd746c7(0x122),'name':_0xd746c7(0x133),'message':_0xd746c7(0x148),'validate':validateProfileName});if(!_0x3d6341[_0xd746c7(0x133)])return console['log'](_0xd746c7(0xf0)),0x1;_0x48d0b3=_0x3d6341[_0xd746c7(0x133)][_0xd746c7(0x10c)]();}const _0x407308=await a23_0x5caf6b({'type':'text','name':_0xd746c7(0x143),'message':_0xd746c7(0x154)}),_0x3ad2d6=_0x407308[_0xd746c7(0x143)]?.['trim']()||undefined,_0x111b41=_0x162a02['site']||'us01',{choices:_0x491858,initialIndex:_0x17c32e}=buildSiteChoices(_0x111b41),_0x31e399=await a23_0x5caf6b({'type':_0xd746c7(0x134),'name':'site','message':_0xd746c7(0xfa)+_0x48d0b3+'\x27:','choices':_0x491858,'initial':_0x17c32e});if(!_0x31e399[_0xd746c7(0x13f)])return console['log'](_0xd746c7(0xf0)),0x1;let _0x59f176;if(_0x31e399[_0xd746c7(0x13f)]==='other'){const _0xc374ee=await a23_0x5caf6b({'type':'text','name':_0xd746c7(0x11d),'message':'Enter\x20site\x20name:','initial':_0xd746c7(0x145),'validate':_0x17c9ce=>{const _0xa31a9=_0xd746c7;if(!_0x17c9ce||!_0x17c9ce[_0xa31a9(0x10c)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0xa31a9(0x142)](_0x17c9ce[_0xa31a9(0x10c)]()))return _0xa31a9(0x147);return!![];}});if(!_0xc374ee[_0xd746c7(0x11d)])return console[_0xd746c7(0x127)](_0xd746c7(0xf0)),0x1;_0x59f176=_0xc374ee['customSite'];}else _0x59f176=_0x31e399[_0xd746c7(0x13f)];const _0x4284e7=resolveSite(_0x59f176);console[_0xd746c7(0x127)](_0xd746c7(0x13b)+_0x4284e7),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xd746c7(0x127)]('\x20\x20'+getConsoleUrl(_0x4284e7,_0xd746c7(0x11c)));const _0x500260=await a23_0x5caf6b({'type':_0xd746c7(0x14e),'name':'apiKey','message':_0xd746c7(0x12a),'validate':_0x1e0fbb=>{const _0x50a953=_0xd746c7;if(!_0x1e0fbb||!_0x1e0fbb['trim']())return _0x50a953(0x152);return!![];}});if(!_0x500260[_0xd746c7(0x101)])return console['log'](_0xd746c7(0xf0)),0x1;const _0x40062e=_0x500260['apiKey'];console['log'](_0xd746c7(0x102));try{const _0x253c34=TDX[_0xd746c7(0x146)]({'site':_0x4284e7,'apiKey':_0x40062e[_0xd746c7(0x10c)](),'logLevel':_0x162a02[_0xd746c7(0x123)]??LogLevel[_0xd746c7(0x125)]}),_0x40a69c=await _0x253c34[_0xd746c7(0x10f)][_0xd746c7(0xf1)]();console[_0xd746c7(0x127)](a23_0x561b56['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x40a69c[_0xd746c7(0x115)]+')');const _0x29a47a=await isKeychainAvailable();_0x29a47a?(await saveAPIKeyAsync(_0x40062e['trim'](),_0x4284e7,_0x48d0b3),console[_0xd746c7(0x127)](a23_0x561b56[_0xd746c7(0xf3)]('✓')+_0xd746c7(0x130)+_0x48d0b3+')')):(console[_0xd746c7(0x140)](a23_0x561b56[_0xd746c7(0x10a)](_0xd746c7(0x110))),console['warn'](a23_0x561b56[_0xd746c7(0x10a)](_0xd746c7(0xec))));const _0x40eb82={'site':_0x4284e7,..._0x3ad2d6&&{'description':_0x3ad2d6}};return saveProfileToUserConfig(_0x48d0b3,_0x40eb82),console[_0xd746c7(0x127)](a23_0x561b56[_0xd746c7(0xf3)]('✓')+_0xd746c7(0x118)+_0x48d0b3+_0xd746c7(0x11e)),console[_0xd746c7(0x127)](),console['log'](_0xd746c7(0xe8)),console[_0xd746c7(0x127)](_0xd746c7(0xfc)+_0x48d0b3+_0xd746c7(0x11f)),console[_0xd746c7(0x127)](_0xd746c7(0xfc)+_0x48d0b3+_0xd746c7(0x14a)),0x0;}catch(_0x115605){if(_0x115605 instanceof HTTPClientError&&_0x115605[_0xd746c7(0x12f)]===0x191)return printAuthError(_0x115605),0x1;return console['error'](a23_0x561b56[_0xd746c7(0x13a)](_0xd746c7(0x149)+(_0x115605 instanceof Error?_0x115605[_0xd746c7(0x13d)]:String(_0x115605)))),console[_0xd746c7(0xe6)](_0xd746c7(0x14d)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x64c92(0xea);['description']=a23_0x64c92(0xed);[a23_0x64c92(0x100)](_0x44c8c2){const _0x52da22=a23_0x64c92,{args:_0x1c409f}=_0x44c8c2;if(_0x1c409f[_0x52da22(0xf4)]===0x0)return _0x52da22(0x151);return undefined;}async['execute'](_0x369279){const _0x2ce28f=a23_0x64c92,{args:_0x8eb593}=_0x369279,_0x33cce1=_0x8eb593[0x0];console['log'](a23_0x561b56[_0x2ce28f(0x119)](_0x2ce28f(0x116)));if(!profileExists(_0x33cce1)){console['error'](a23_0x561b56[_0x2ce28f(0x13a)](_0x2ce28f(0x150)+_0x33cce1+'\x27\x20does\x20not\x20exist.')),console[_0x2ce28f(0x127)]('\x0aAvailable\x20profiles:');const _0x4d2acf=listProfiles();if(_0x4d2acf[_0x2ce28f(0xf4)]===0x0)console[_0x2ce28f(0x127)](_0x2ce28f(0xfd));else for(const _0x3f4c6e of _0x4d2acf){console['log'](_0x2ce28f(0x128)+_0x3f4c6e[_0x2ce28f(0x137)]);}return 0x1;}const _0x4e92fd=await a23_0x5caf6b({'type':_0x2ce28f(0xef),'name':_0x2ce28f(0xef),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x33cce1+'\x27?','initial':![]});if(!_0x4e92fd[_0x2ce28f(0xef)])return console[_0x2ce28f(0x127)](_0x2ce28f(0x11a)),0x0;try{removeProfileFromUserConfig(_0x33cce1),console[_0x2ce28f(0x127)](a23_0x561b56[_0x2ce28f(0xf3)]('✓')+_0x2ce28f(0x118)+_0x33cce1+_0x2ce28f(0x106));}catch(_0x307ed4){return console[_0x2ce28f(0xe6)](a23_0x561b56['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x307ed4 instanceof Error?_0x307ed4[_0x2ce28f(0x13d)]:String(_0x307ed4)))),0x1;}const _0x390e63=await isKeychainAvailable();if(_0x390e63){const _0x3853bd=await deleteKeychainAPIKey(_0x33cce1);_0x3853bd&&console['log'](a23_0x561b56[_0x2ce28f(0xf3)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0xe9);[a23_0x64c92(0x143)]=a23_0x64c92(0xf2);static ['VALID_KEYS']=['site',a23_0x64c92(0x136),a23_0x64c92(0xe4),a23_0x64c92(0x132),'llm_agent',a23_0x64c92(0x143)];['validate'](_0x26640a){const _0x227eda=a23_0x64c92,{args:_0x45b084,options:_0x52efd6}=_0x26640a,_0x574f01=_0x52efd6[_0x227eda(0xf6)]||getActiveProfile();if(!_0x574f01)return _0x227eda(0x141);if(_0x45b084[_0x227eda(0xf4)]===0x0)return _0x227eda(0x13e)+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');const _0x361c00=_0x45b084[0x0];if(!_0x361c00[_0x227eda(0x11b)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');const [_0x4a329b]=_0x361c00[_0x227eda(0xe5)]('=',0x2);if(!ProfileSetCommand[_0x227eda(0x109)]['includes'](_0x4a329b))return _0x227eda(0xfe)+_0x4a329b+_0x227eda(0x10e)+ProfileSetCommand[_0x227eda(0x109)][_0x227eda(0x14b)](',\x20');return undefined;}async[a23_0x64c92(0x129)](_0x1a036d){const _0x3bc8da=a23_0x64c92,{args:_0x2aab7e,options:_0xc4f0c}=_0x1a036d,_0x50579b=_0xc4f0c[_0x3bc8da(0xf6)]||getActiveProfile(),[_0x2722be,..._0x13997e]=_0x2aab7e[0x0][_0x3bc8da(0xe5)]('='),_0x19543b=_0x13997e[_0x3bc8da(0x14b)]('=');console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0x119)](_0x3bc8da(0x135)));if(!profileExists(_0x50579b)){const _0x1f525e=await a23_0x5caf6b({'type':_0x3bc8da(0xef),'name':_0x3bc8da(0x146),'message':'Profile\x20\x27'+_0x50579b+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x1f525e[_0x3bc8da(0x146)])return console[_0x3bc8da(0x127)](_0x3bc8da(0x108)),0x1;}const _0x7db20f=loadProfile(_0x50579b),_0x39cd95=_0x7db20f?.[_0x3bc8da(0x12e)]||{};if(_0x2722be===_0x3bc8da(0x13f)){const _0x516519=resolveSite(_0x19543b);console['log']('Changing\x20site\x20to\x20\x27'+_0x516519+_0x3bc8da(0x107)),console[_0x3bc8da(0x127)](_0x3bc8da(0xeb)),console[_0x3bc8da(0x127)]('\x20\x20'+getConsoleUrl(_0x516519,_0x3bc8da(0x11c)));const _0x13e410=await a23_0x5caf6b({'type':_0x3bc8da(0x14e),'name':_0x3bc8da(0x101),'message':_0x3bc8da(0x10b),'validate':_0x2efddd=>{const _0x1093ee=_0x3bc8da;if(!_0x2efddd||!_0x2efddd[_0x1093ee(0x10c)]())return _0x1093ee(0x152);return!![];}});if(!_0x13e410['apiKey'])return console[_0x3bc8da(0x127)](_0x3bc8da(0x103)),0x1;console[_0x3bc8da(0x127)](_0x3bc8da(0x102));try{const _0x37f8d4=TDX['create']({'site':_0x516519,'apiKey':_0x13e410[_0x3bc8da(0x101)]['trim'](),'logLevel':_0xc4f0c[_0x3bc8da(0x123)]??LogLevel[_0x3bc8da(0x125)]}),_0x219efc=await _0x37f8d4['jobs'][_0x3bc8da(0xf1)]();console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0xf3)]('✓')+_0x3bc8da(0xff)+_0x219efc[_0x3bc8da(0x115)]+')');const _0x103635=await isKeychainAvailable();_0x103635?(await saveAPIKeyAsync(_0x13e410['apiKey'][_0x3bc8da(0x10c)](),_0x516519,_0x50579b),console[_0x3bc8da(0x127)](a23_0x561b56['green']('✓')+_0x3bc8da(0x12c))):console[_0x3bc8da(0x140)](a23_0x561b56[_0x3bc8da(0x10a)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x39cd95[_0x3bc8da(0x13f)]=_0x516519;}catch(_0x33b0ec){if(_0x33b0ec instanceof HTTPClientError&&_0x33b0ec[_0x3bc8da(0x12f)]===0x191)return printAuthError(_0x33b0ec),0x1;return console[_0x3bc8da(0xe6)](a23_0x561b56['red'](_0x3bc8da(0x149)+(_0x33b0ec instanceof Error?_0x33b0ec[_0x3bc8da(0x13d)]:String(_0x33b0ec)))),console['error'](_0x3bc8da(0x12b)),0x1;}}else _0x39cd95[_0x2722be]=_0x19543b||undefined;return saveProfileToUserConfig(_0x50579b,_0x39cd95),console[_0x3bc8da(0x127)](a23_0x561b56[_0x3bc8da(0xf3)]('✓')+_0x3bc8da(0x118)+_0x50579b+'\x27\x20updated:\x20'+_0x2722be+'='+(_0x19543b||_0x3bc8da(0x104))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x64c92(0x137)]=a23_0x64c92(0xe7);[a23_0x64c92(0x143)]=a23_0x64c92(0xf9);['validate'](_0x1a5393){const _0x20a683=a23_0x64c92,{args:_0x23ec01}=_0x1a5393;if(_0x23ec01[_0x20a683(0xf4)]===0x0)return _0x20a683(0x13c);return undefined;}async[a23_0x64c92(0x129)](_0x55dfdc){const _0x54b7ce=a23_0x64c92,{args:_0x5a42e9,options:_0x5944e6}=_0x55dfdc,_0x1f8a94=_0x5a42e9[0x0],_0x3bfc90=_0x5944e6[_0x54b7ce(0x14c)];cleanExpiredSessions();if(!profileExists(_0x1f8a94)){console[_0x54b7ce(0xe6)](a23_0x561b56['red'](_0x54b7ce(0x150)+_0x1f8a94+'\x27\x20does\x20not\x20exist.')),console['log'](_0x54b7ce(0x139));const _0x13f772=listProfiles();if(_0x13f772[_0x54b7ce(0xf4)]===0x0)console['log'](_0x54b7ce(0xfd));else for(const _0x4adfe6 of _0x13f772){console[_0x54b7ce(0x127)](_0x54b7ce(0x128)+_0x4adfe6[_0x54b7ce(0x137)]);}return 0x1;}if(_0x3bfc90){const _0x4bb55b=a23_0x236cb1[_0x54b7ce(0x14b)](getConfigDir(),_0x54b7ce(0xfb));return saveActiveProfileToUserConfig(_0x1f8a94),console[_0x54b7ce(0x127)]('Default\x20profile\x20set\x20to:\x20'+a23_0x561b56[_0x54b7ce(0xf3)](_0x1f8a94)),console[_0x54b7ce(0x127)](a23_0x561b56['dim']('\x0aSaved\x20to:\x20'+_0x4bb55b)),0x0;}const _0x178f1e=getSessionID(_0x5944e6['session']);return saveSessionContext({'profile':_0x1f8a94},_0x5944e6[_0x54b7ce(0x114)]),console['log'](_0x54b7ce(0x111)+a23_0x561b56[_0x54b7ce(0xf3)](_0x1f8a94)+'\x20'+a23_0x561b56[_0x54b7ce(0x124)](_0x54b7ce(0x105)+_0x178f1e+')')),console[_0x54b7ce(0x127)](a23_0x561b56[_0x54b7ce(0x124)](_0x54b7ce(0xf8)+_0x1f8a94+_0x54b7ce(0xf5))),0x0;}}
|
|
1
|
+
const a23_0x27a184=a23_0xddcf;(function(_0x487c88,_0x2d4073){const _0x39a084=a23_0xddcf,_0x4c103e=_0x487c88();while(!![]){try{const _0xb83966=-parseInt(_0x39a084(0x184))/0x1*(parseInt(_0x39a084(0x1c3))/0x2)+parseInt(_0x39a084(0x1ba))/0x3+-parseInt(_0x39a084(0x1cd))/0x4*(parseInt(_0x39a084(0x1b1))/0x5)+parseInt(_0x39a084(0x1c6))/0x6*(-parseInt(_0x39a084(0x1c5))/0x7)+parseInt(_0x39a084(0x18e))/0x8*(parseInt(_0x39a084(0x1c8))/0x9)+-parseInt(_0x39a084(0x1a1))/0xa*(-parseInt(_0x39a084(0x18f))/0xb)+-parseInt(_0x39a084(0x1bf))/0xc;if(_0xb83966===_0x2d4073)break;else _0x4c103e['push'](_0x4c103e['shift']());}catch(_0x116537){_0x4c103e['push'](_0x4c103e['shift']());}}}(a23_0x2e13,0x4bb85));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a23_0x2e13(){const _0x344d8d=['trim','parent_segment','tdx.json','Site\x20name\x20cannot\x20be\x20empty','\x0aSaved\x20to:\x20','join','Set\x20a\x20profile\x20configuration\x20value','VALID_KEYS','Failed\x20to\x20remove\x20profile:\x20','profile:remove','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','site','includes','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aSetup\x20cancelled','yellow','\x20API\x20key\x20removed\x20from\x20system\x20keychain','✗\x20Validation\x20failed:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','profile:create','execute','Enter\x20site\x20name:','Profile\x20\x27','text','other','profile:use','Removal\x20cancelled','create','\x20\x20tdx\x20--profile\x20','\x20\x20(no\x20profiles\x20found)','getUserInfo','Changing\x20site\x20to\x20\x27','\x27\x20requires\x20API\x20key\x20validation.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','apiKey','customSite','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aAvailable\x20profiles:','Remove\x20a\x20profile','184787goArVm','log','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','ERROR','name','session','\x27\x20does\x20not\x20exist.','\x20Profile\x20\x27','logLevel','8OeJUZy','8525KdGWJm','llm_agent','dim','\x27\x20created','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','status','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','warn','test','\x0aOperation\x20cancelled','profileName','validate','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','jobs','Unknown\x20key\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','select','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','5760tIQeMJ','confirm','\x27\x20updated:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20-\x20','config','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','description','error','profile','password','Session\x20profile\x20set\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','green','486030HeuoSF','(session:\x20','/app/mp/ak','llm_project','Validating\x20API\x20key...','message','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20--default\x27\x20to\x20save\x20permanently','red','1379187mZHmuB','default','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20description\x20(optional):','\x27\x20does\x20not\x20exist.\x20Create\x20it?','654228vVsHFA','database','Enter\x20profile\x20name:','(cleared)','2NztNcw','\x20API\x20key\x20saved\x20to\x20system\x20keychain','289163ebsqgz','42eNupvT','us01','3766671rVxCaU','API\x20key\x20cannot\x20be\x20empty','email','tdx:\x20profile\x20set','bold','20OqEbib','tdx:\x20profile\x20remove'];a23_0x2e13=function(){return _0x344d8d;};return a23_0x2e13();}import{getConfigDir}from'../core/config.js';import*as a23_0x5acfc9 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x10eb67 from'prompts';import a23_0x569122 from'chalk';function validateProfileName(_0x38c05a){const _0xe26718=a23_0xddcf;if(!_0x38c05a||!_0x38c05a[_0xe26718(0x1cf)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x37d253=_0x38c05a[_0xe26718(0x1cf)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x37d253))return _0xe26718(0x1a9);if(profileExists(_0x37d253))return _0xe26718(0x173)+_0x37d253+_0xe26718(0x195);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x27a184(0x189)]=a23_0x27a184(0x170);[a23_0x27a184(0x1aa)]='Create\x20a\x20new\x20profile';async[a23_0x27a184(0x171)](_0x27aa65){const _0x4d8008=a23_0x27a184,{options:_0x3d177e,args:_0x28fd24}=_0x27aa65;console['log'](a23_0x569122['bold']('tdx:\x20profile\x20create'));let _0x269e7b;if(_0x28fd24[_0x4d8008(0x16f)]>0x0&&_0x28fd24[0x0]){const _0x2eac8f=_0x28fd24[0x0][_0x4d8008(0x1cf)](),_0x20fb57=validateProfileName(_0x2eac8f);if(_0x20fb57!==!![])return console[_0x4d8008(0x1ab)](a23_0x569122[_0x4d8008(0x1b9)](_0x20fb57)),0x1;_0x269e7b=_0x2eac8f;}else{const _0x2b225a=await a23_0x10eb67({'type':_0x4d8008(0x174),'name':'profileName','message':_0x4d8008(0x1c1),'validate':validateProfileName});if(!_0x2b225a[_0x4d8008(0x199)])return console[_0x4d8008(0x185)](_0x4d8008(0x1dd)),0x1;_0x269e7b=_0x2b225a['profileName'][_0x4d8008(0x1cf)]();}const _0x38389c=await a23_0x10eb67({'type':'text','name':_0x4d8008(0x1aa),'message':_0x4d8008(0x1bd)}),_0x20a1ba=_0x38389c['description']?.[_0x4d8008(0x1cf)]()||undefined,_0x421437=_0x3d177e['site']||_0x4d8008(0x1c7),{choices:_0xa4f808,initialIndex:_0x5d2448}=buildSiteChoices(_0x421437),_0xea7b7=await a23_0x10eb67({'type':_0x4d8008(0x19f),'name':'site','message':_0x4d8008(0x187)+_0x269e7b+'\x27:','choices':_0xa4f808,'initial':_0x5d2448});if(!_0xea7b7[_0x4d8008(0x1da)])return console[_0x4d8008(0x185)](_0x4d8008(0x1dd)),0x1;let _0x681a8f;if(_0xea7b7[_0x4d8008(0x1da)]===_0x4d8008(0x175)){const _0x33ca0e=await a23_0x10eb67({'type':_0x4d8008(0x174),'name':'customSite','message':_0x4d8008(0x172),'initial':_0x4d8008(0x1c7),'validate':_0x4fd715=>{const _0x30c0d2=_0x4d8008;if(!_0x4fd715||!_0x4fd715[_0x30c0d2(0x1cf)]())return _0x30c0d2(0x1d2);if(!/^[a-z0-9-]+$/[_0x30c0d2(0x197)](_0x4fd715[_0x30c0d2(0x1cf)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x33ca0e[_0x4d8008(0x180)])return console[_0x4d8008(0x185)]('\x0aSetup\x20cancelled'),0x1;_0x681a8f=_0x33ca0e[_0x4d8008(0x180)];}else _0x681a8f=_0xea7b7[_0x4d8008(0x1da)];const _0xb9b79f=resolveSite(_0x681a8f);console[_0x4d8008(0x185)](_0x4d8008(0x16e)+_0xb9b79f),console[_0x4d8008(0x185)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4d8008(0x185)]('\x20\x20'+getConsoleUrl(_0xb9b79f,'/app/mp/ak'));const _0x518cd5=await a23_0x10eb67({'type':_0x4d8008(0x1ad),'name':'apiKey','message':_0x4d8008(0x1af),'validate':_0x299727=>{const _0x771bf4=_0x4d8008;if(!_0x299727||!_0x299727[_0x771bf4(0x1cf)]())return _0x771bf4(0x1c9);return!![];}});if(!_0x518cd5[_0x4d8008(0x17f)])return console[_0x4d8008(0x185)](_0x4d8008(0x1dd)),0x1;const _0x1f5fcf=_0x518cd5[_0x4d8008(0x17f)];console[_0x4d8008(0x185)](_0x4d8008(0x1b5));try{const _0x46eb20=TDX[_0x4d8008(0x178)]({'site':_0xb9b79f,'apiKey':_0x1f5fcf[_0x4d8008(0x1cf)](),'logLevel':_0x3d177e[_0x4d8008(0x18d)]??LogLevel[_0x4d8008(0x188)]}),_0x2dcae2=await _0x46eb20[_0x4d8008(0x19c)][_0x4d8008(0x17b)]();console[_0x4d8008(0x185)](a23_0x569122[_0x4d8008(0x1b0)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2dcae2[_0x4d8008(0x1ca)]+')');const _0x13987a=await isKeychainAvailable();_0x13987a?(await saveAPIKeyAsync(_0x1f5fcf[_0x4d8008(0x1cf)](),_0xb9b79f,_0x269e7b),console[_0x4d8008(0x185)](a23_0x569122['green']('✓')+_0x4d8008(0x181)+_0x269e7b+')')):(console[_0x4d8008(0x196)](a23_0x569122[_0x4d8008(0x1de)](_0x4d8008(0x1dc))),console[_0x4d8008(0x196)](a23_0x569122[_0x4d8008(0x1de)](_0x4d8008(0x17e))));const _0x306b1b={'site':_0xb9b79f,..._0x20a1ba&&{'description':_0x20a1ba}};return saveProfileToUserConfig(_0x269e7b,_0x306b1b),console['log'](a23_0x569122[_0x4d8008(0x1b0)]('✓')+_0x4d8008(0x18c)+_0x269e7b+_0x4d8008(0x192)),console['log'](),console[_0x4d8008(0x185)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x4d8008(0x179)+_0x269e7b+_0x4d8008(0x193)),console[_0x4d8008(0x185)](_0x4d8008(0x179)+_0x269e7b+_0x4d8008(0x19b)),0x0;}catch(_0x3e2aca){if(_0x3e2aca instanceof HTTPClientError&&_0x3e2aca[_0x4d8008(0x194)]===0x191)return printAuthError(_0x3e2aca),0x1;return console[_0x4d8008(0x1ab)](a23_0x569122[_0x4d8008(0x1b9)]('✗\x20Validation\x20failed:\x20'+(_0x3e2aca instanceof Error?_0x3e2aca['message']:String(_0x3e2aca)))),console[_0x4d8008(0x1ab)](_0x4d8008(0x186)),0x1;}}}function a23_0xddcf(_0xad894c,_0x3e2233){_0xad894c=_0xad894c-0x16e;const _0x2e1383=a23_0x2e13();let _0xddcf1d=_0x2e1383[_0xad894c];return _0xddcf1d;}export class ProfileRemoveCommand extends BaseCommand{[a23_0x27a184(0x189)]=a23_0x27a184(0x1d8);['description']=a23_0x27a184(0x183);['validate'](_0x31ee81){const _0x20b0af=a23_0x27a184,{args:_0x3699e6}=_0x31ee81;if(_0x3699e6[_0x20b0af(0x16f)]===0x0)return _0x20b0af(0x1d9);return undefined;}async[a23_0x27a184(0x171)](_0x219116){const _0x3f33a0=a23_0x27a184,{args:_0x21a8f3}=_0x219116,_0x28e18a=_0x21a8f3[0x0];console['log'](a23_0x569122[_0x3f33a0(0x1cc)](_0x3f33a0(0x1ce)));if(!profileExists(_0x28e18a)){console[_0x3f33a0(0x1ab)](a23_0x569122[_0x3f33a0(0x1b9)](_0x3f33a0(0x173)+_0x28e18a+_0x3f33a0(0x18b))),console[_0x3f33a0(0x185)](_0x3f33a0(0x182));const _0x285f7e=listProfiles();if(_0x285f7e['length']===0x0)console[_0x3f33a0(0x185)](_0x3f33a0(0x17a));else for(const _0x22e725 of _0x285f7e){console[_0x3f33a0(0x185)](_0x3f33a0(0x1a7)+_0x22e725[_0x3f33a0(0x189)]);}return 0x1;}const _0x445f14=await a23_0x10eb67({'type':'confirm','name':_0x3f33a0(0x1a2),'message':_0x3f33a0(0x1a0)+_0x28e18a+'\x27?','initial':![]});if(!_0x445f14['confirm'])return console[_0x3f33a0(0x185)](_0x3f33a0(0x177)),0x0;try{removeProfileFromUserConfig(_0x28e18a),console['log'](a23_0x569122[_0x3f33a0(0x1b0)]('✓')+_0x3f33a0(0x18c)+_0x28e18a+'\x27\x20removed\x20from\x20configuration');}catch(_0x5dbd22){return console[_0x3f33a0(0x1ab)](a23_0x569122[_0x3f33a0(0x1b9)](_0x3f33a0(0x1d7)+(_0x5dbd22 instanceof Error?_0x5dbd22[_0x3f33a0(0x1b6)]:String(_0x5dbd22)))),0x1;}const _0x1291bf=await isKeychainAvailable();if(_0x1291bf){const _0x5133c5=await deleteKeychainAPIKey(_0x28e18a);_0x5133c5&&console[_0x3f33a0(0x185)](a23_0x569122['green']('✓')+_0x3f33a0(0x1df));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x27a184(0x189)]='profile:set';[a23_0x27a184(0x1aa)]=a23_0x27a184(0x1d5);static ['VALID_KEYS']=['site',a23_0x27a184(0x1c0),a23_0x27a184(0x1d0),a23_0x27a184(0x1b4),a23_0x27a184(0x190),'description'];['validate'](_0x244d0d){const _0x3d96f0=a23_0x27a184,{args:_0xab2a1f,options:_0x344dc5}=_0x244d0d,_0x35e612=_0x344dc5[_0x3d96f0(0x1ac)]||getActiveProfile();if(!_0x35e612)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0xab2a1f[_0x3d96f0(0x16f)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x50f15f=_0xab2a1f[0x0];if(!_0x50f15f['includes']('='))return _0x3d96f0(0x1a5)+ProfileSetCommand[_0x3d96f0(0x1d6)][_0x3d96f0(0x1d4)](',\x20');const [_0x57f895]=_0x50f15f['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x3d96f0(0x1db)](_0x57f895))return _0x3d96f0(0x19d)+_0x57f895+_0x3d96f0(0x19e)+ProfileSetCommand[_0x3d96f0(0x1d6)][_0x3d96f0(0x1d4)](',\x20');return undefined;}async[a23_0x27a184(0x171)](_0x3208ac){const _0x4aba39=a23_0x27a184,{args:_0x406fd3,options:_0x4145d3}=_0x3208ac,_0x1c16fc=_0x4145d3[_0x4aba39(0x1ac)]||getActiveProfile(),[_0x1aa305,..._0x4a28ce]=_0x406fd3[0x0]['split']('='),_0x5a005b=_0x4a28ce[_0x4aba39(0x1d4)]('=');console[_0x4aba39(0x185)](a23_0x569122['bold'](_0x4aba39(0x1cb)));if(!profileExists(_0x1c16fc)){const _0x54ca7e=await a23_0x10eb67({'type':_0x4aba39(0x1a2),'name':_0x4aba39(0x178),'message':'Profile\x20\x27'+_0x1c16fc+_0x4aba39(0x1be),'initial':!![]});if(!_0x54ca7e['create'])return console[_0x4aba39(0x185)]('Operation\x20cancelled'),0x1;}const _0x4871d7=loadProfile(_0x1c16fc),_0x164223=_0x4871d7?.[_0x4aba39(0x1a8)]||{};if(_0x1aa305===_0x4aba39(0x1da)){const _0x916835=resolveSite(_0x5a005b);console[_0x4aba39(0x185)](_0x4aba39(0x17c)+_0x916835+_0x4aba39(0x17d)),console[_0x4aba39(0x185)](_0x4aba39(0x1bc)),console['log']('\x20\x20'+getConsoleUrl(_0x916835,_0x4aba39(0x1b3)));const _0xc9a456=await a23_0x10eb67({'type':_0x4aba39(0x1ad),'name':_0x4aba39(0x17f),'message':_0x4aba39(0x1a6),'validate':_0x5e1655=>{const _0x5c449f=_0x4aba39;if(!_0x5e1655||!_0x5e1655[_0x5c449f(0x1cf)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xc9a456[_0x4aba39(0x17f)])return console[_0x4aba39(0x185)](_0x4aba39(0x198)),0x1;console[_0x4aba39(0x185)]('Validating\x20API\x20key...');try{const _0x1d8d2e=TDX[_0x4aba39(0x178)]({'site':_0x916835,'apiKey':_0xc9a456[_0x4aba39(0x17f)][_0x4aba39(0x1cf)](),'logLevel':_0x4145d3[_0x4aba39(0x18d)]??LogLevel[_0x4aba39(0x188)]}),_0x769d3f=await _0x1d8d2e[_0x4aba39(0x19c)][_0x4aba39(0x17b)]();console[_0x4aba39(0x185)](a23_0x569122[_0x4aba39(0x1b0)]('✓')+_0x4aba39(0x1b7)+_0x769d3f[_0x4aba39(0x1ca)]+')');const _0x1a34fc=await isKeychainAvailable();_0x1a34fc?(await saveAPIKeyAsync(_0xc9a456[_0x4aba39(0x17f)][_0x4aba39(0x1cf)](),_0x916835,_0x1c16fc),console[_0x4aba39(0x185)](a23_0x569122[_0x4aba39(0x1b0)]('✓')+_0x4aba39(0x1c4))):console[_0x4aba39(0x196)](a23_0x569122[_0x4aba39(0x1de)](_0x4aba39(0x1dc))),_0x164223[_0x4aba39(0x1da)]=_0x916835;}catch(_0x3c40da){if(_0x3c40da instanceof HTTPClientError&&_0x3c40da[_0x4aba39(0x194)]===0x191)return printAuthError(_0x3c40da),0x1;return console[_0x4aba39(0x1ab)](a23_0x569122['red'](_0x4aba39(0x1e0)+(_0x3c40da instanceof Error?_0x3c40da[_0x4aba39(0x1b6)]:String(_0x3c40da)))),console[_0x4aba39(0x1ab)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x164223[_0x1aa305]=_0x5a005b||undefined;return saveProfileToUserConfig(_0x1c16fc,_0x164223),console[_0x4aba39(0x185)](a23_0x569122[_0x4aba39(0x1b0)]('✓')+_0x4aba39(0x18c)+_0x1c16fc+_0x4aba39(0x1a3)+_0x1aa305+'='+(_0x5a005b||_0x4aba39(0x1c2))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x27a184(0x189)]=a23_0x27a184(0x176);[a23_0x27a184(0x1aa)]='Set\x20session\x20profile';[a23_0x27a184(0x19a)](_0x15383b){const _0x5407d9=a23_0x27a184,{args:_0x59a63a}=_0x15383b;if(_0x59a63a[_0x5407d9(0x16f)]===0x0)return _0x5407d9(0x1a4);return undefined;}async[a23_0x27a184(0x171)](_0xf32ea6){const _0x3c022b=a23_0x27a184,{args:_0x50de27,options:_0x5be72c}=_0xf32ea6,_0x331c94=_0x50de27[0x0],_0x4ac172=_0x5be72c[_0x3c022b(0x1bb)];cleanExpiredSessions();if(!profileExists(_0x331c94)){console[_0x3c022b(0x1ab)](a23_0x569122[_0x3c022b(0x1b9)]('Profile\x20\x27'+_0x331c94+'\x27\x20does\x20not\x20exist.')),console[_0x3c022b(0x185)]('\x0aAvailable\x20profiles:');const _0x1f1005=listProfiles();if(_0x1f1005[_0x3c022b(0x16f)]===0x0)console[_0x3c022b(0x185)](_0x3c022b(0x17a));else for(const _0x3a0ed3 of _0x1f1005){console[_0x3c022b(0x185)](_0x3c022b(0x1a7)+_0x3a0ed3[_0x3c022b(0x189)]);}return 0x1;}if(_0x4ac172){const _0x26ffc6=a23_0x5acfc9[_0x3c022b(0x1d4)](getConfigDir(),_0x3c022b(0x1d1));return saveActiveProfileToUserConfig(_0x331c94),console[_0x3c022b(0x185)]('Default\x20profile\x20set\x20to:\x20'+a23_0x569122['green'](_0x331c94)),console[_0x3c022b(0x185)](a23_0x569122[_0x3c022b(0x191)](_0x3c022b(0x1d3)+_0x26ffc6)),0x0;}const _0x4ecbab=getSessionID(_0x5be72c[_0x3c022b(0x18a)]);return saveSessionContext({'profile':_0x331c94},_0x5be72c[_0x3c022b(0x18a)]),console[_0x3c022b(0x185)](_0x3c022b(0x1ae)+a23_0x569122['green'](_0x331c94)+'\x20'+a23_0x569122[_0x3c022b(0x191)](_0x3c022b(0x1b2)+_0x4ecbab+')')),console[_0x3c022b(0x185)](a23_0x569122['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x331c94+_0x3c022b(0x1b8))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0xc7033c=a24_0x9a9b;(function(_0x596e96,_0xca61f9){const _0x4989af=a24_0x9a9b,_0x2b4362=_0x596e96();while(!![]){try{const _0x589f5f=-parseInt(_0x4989af(0x9a))/0x1*(parseInt(_0x4989af(0x9c))/0x2)+-parseInt(_0x4989af(0x9b))/0x3+parseInt(_0x4989af(0xa3))/0x4*(parseInt(_0x4989af(0x95))/0x5)+-parseInt(_0x4989af(0xa1))/0x6+-parseInt(_0x4989af(0x9d))/0x7*(-parseInt(_0x4989af(0x97))/0x8)+-parseInt(_0x4989af(0xa7))/0x9*(parseInt(_0x4989af(0xa2))/0xa)+parseInt(_0x4989af(0xa9))/0xb*(parseInt(_0x4989af(0x99))/0xc);if(_0x589f5f===_0xca61f9)break;else _0x2b4362['push'](_0x2b4362['shift']());}catch(_0x476138){_0x2b4362['push'](_0x2b4362['shift']());}}}(a24_0x37e8,0x4297a));import{BaseCommand}from'./command.js';function a24_0x9a9b(_0x1302a2,_0x1ec5f7){_0x1302a2=_0x1302a2-0x95;const _0x37e854=a24_0x37e8();let _0x9a9be9=_0x37e854[_0x1302a2];return _0x9a9be9;}function a24_0x37e8(){const _0x9ab533=['1055XvjoWk','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','272bwpBQT','map','12mORiAw','6VIyVrs','1397433chWvFj','77898vRQkQd','59157ybvQVF','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','841974kvEvwk','80zCUcXr','9260OZZDBl','message','log','name','556830xEiwhq','config','9149327gxiPkq','\x20\x20Global:\x20~/.config/tdx/tdx.json','length'];a24_0x37e8=function(){return _0x9ab533;};return a24_0x37e8();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a24_0xc7033c(0x9e)]='List\x20all\x20available\x20profiles';async[a24_0xc7033c(0xa0)](_0x27446d){const _0x4002fe=a24_0xc7033c,{options:_0x48a7f7}=_0x27446d;try{const _0x27d7fd=listProfiles(),_0x35907c=getActiveProfile();if(_0x27d7fd[_0x4002fe(0xab)]===0x0)return console[_0x4002fe(0xa5)](_0x4002fe(0x96)),console[_0x4002fe(0xa5)](_0x4002fe(0x9f)),console[_0x4002fe(0xa5)](_0x4002fe(0xaa)),0x0;const _0x5a5881=_0x27d7fd[_0x4002fe(0x98)](_0x54391f=>{const _0x59f542=_0x4002fe,_0x30d61e=_0x54391f[_0x59f542(0xa6)]===_0x35907c,_0x399db5=getProfileParams(_0x54391f[_0x59f542(0xa8)]);return{'name':_0x54391f['name'],'active':_0x30d61e,'scope':_0x54391f['scope'],'description':_0x54391f[_0x59f542(0xa8)][_0x59f542(0x9e)]||'','params':_0x399db5};});return await handleSDKOutput(_0x5a5881,_0x48a7f7),0x0;}catch(_0xdacee3){return _0xdacee3 instanceof Error&&console['error']('Error:\x20'+_0xdacee3[_0x4002fe(0xa4)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x323394=a25_0x2af4;function a25_0x394a(){const _0x3d2690=['Query\x20completed:\x20Processed\x20','\x20[Job\x20ID:\x20','originalMessage','processedRows','data','output','information_schema','site','error','totalSplits','validate','20VEGJnp','verbose','file','\x0aAll\x20results\x20saved\x20to\x20','jobId','name','query','length','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','description','setExtra','setPhase','execute','SQL:\x20','state','in\x20','stats','Error:\x20','331038aEIoEk','Executing\x20query...','...','18rQDcbX','catalog','Statement\x20','join','push','database','Site:\x20','14013640WkLXCS','Executing\x20statement\x20','749886HWLppX','1582248XfdFEA','7737289lGyBLj','44670RClYvf','\x20rows\x20','No\x20SQL\x20provided','\x20-\x20','Executing\x20query\x20[','setJobId','6zNAXuM','6993808VKjbey','Schema:\x20'];a25_0x394a=function(){return _0x3d2690;};return a25_0x394a();}function a25_0x2af4(_0x306f6c,_0x3fc0f6){_0x306f6c=_0x306f6c-0x1c3;const _0x394ae0=a25_0x394a();let _0x2af49f=_0x394ae0[_0x306f6c];return _0x2af49f;}(function(_0x4782c6,_0x5e7df2){const _0x265408=a25_0x2af4,_0x3c853b=_0x4782c6();while(!![]){try{const _0xd455e3=-parseInt(_0x265408(0x1ee))/0x1+parseInt(_0x265408(0x1eb))/0x2+-parseInt(_0x265408(0x1df))/0x3+parseInt(_0x265408(0x1ec))/0x4*(parseInt(_0x265408(0x1cd))/0x5)+parseInt(_0x265408(0x1f4))/0x6*(parseInt(_0x265408(0x1ed))/0x7)+parseInt(_0x265408(0x1f5))/0x8+-parseInt(_0x265408(0x1e2))/0x9*(parseInt(_0x265408(0x1e9))/0xa);if(_0xd455e3===_0x5e7df2)break;else _0x3c853b['push'](_0x3c853b['shift']());}catch(_0x551642){_0x3c853b['push'](_0x3c853b['shift']());}}}(a25_0x394a,0xef038));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';export class QueryCommand extends BaseCommand{[a25_0x323394(0x1d2)]=a25_0x323394(0x1d3);[a25_0x323394(0x1d6)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x25dbec){const _0x4e3971=a25_0x323394,{options:_0x836920,args:_0x5abd31,tdx:_0x392a4f}=_0x25dbec,_0x68890f=_0x5abd31[0x0],_0x250ab7=_0x836920[_0x4e3971(0x1cf)];let _0x2522bd;try{if(_0x250ab7)_0x2522bd=readSqlStatementsFromFile(_0x250ab7);else{if(_0x68890f==='-')_0x2522bd=await readSqlStatementsFromStdin();else{if(_0x68890f&&isSqlFilePath(_0x68890f))_0x2522bd=readSqlStatementsFromFile(_0x68890f);else{if(_0x68890f)_0x2522bd=splitSqlStatements(_0x68890f);else throw new Error(_0x4e3971(0x1f0));}}}}catch(_0x4ffe4f){return console[_0x4e3971(0x1ca)](_0x4e3971(0x1de)+_0x4ffe4f['message']),0x1;}const _0x1b8852=_0x836920[_0x4e3971(0x1e7)]||_0x4e3971(0x1c8),_0x35e063=_0x836920[_0x4e3971(0x1e3)];try{const _0x8d353b=[],_0x3f61b0=!!_0x836920[_0x4e3971(0x1c7)];for(let _0x3c06c8=0x0;_0x3c06c8<_0x2522bd[_0x4e3971(0x1d4)];_0x3c06c8++){const _0x1b0e75=_0x2522bd[_0x3c06c8],_0x3432c5=_0x3c06c8+0x1,_0x432ce2=_0x2522bd[_0x4e3971(0x1d4)],_0x3abad5=_0x432ce2>0x1;_0x836920[_0x4e3971(0x1ce)]&&(console[_0x4e3971(0x1ca)]('\x0a'+(_0x3abad5?_0x4e3971(0x1e4)+_0x3432c5+'/'+_0x432ce2+':':'')),console[_0x4e3971(0x1ca)](_0x4e3971(0x1e8)+_0x836920[_0x4e3971(0x1c9)]),console['error']('Catalog:\x20'+(_0x35e063||'td')),console[_0x4e3971(0x1ca)](_0x4e3971(0x1f6)+_0x1b8852),console[_0x4e3971(0x1ca)](_0x4e3971(0x1da)+_0x1b0e75));const _0xb7e764=_0x3abad5?_0x4e3971(0x1ea)+_0x3432c5+'/'+_0x432ce2+_0x4e3971(0x1e1):_0x4e3971(0x1e0);try{const _0x388c82=await withProgressSpinner(_0xb7e764,async _0x14a365=>{const _0x25c2a5=_0x4e3971,_0x4692a6=await _0x392a4f[_0x25c2a5(0x1d3)][_0x25c2a5(0x1d9)](_0x1b0e75,{'catalog':_0x35e063,'schema':_0x1b8852,'onJobId':_0x41ba1a=>{const _0x4fba17=_0x25c2a5;_0x14a365[_0x4fba17(0x1f3)](_0x41ba1a);},'onProgress':_0x2a0a52=>{const _0x1876cd=_0x25c2a5;_0x14a365[_0x1876cd(0x1d8)](_0x1876cd(0x1f2)+_0x2a0a52[_0x1876cd(0x1db)]+']'),_0x14a365[_0x1876cd(0x1d7)](formatRows(_0x2a0a52[_0x1876cd(0x1c5)])+_0x1876cd(0x1ef)+_0x2a0a52['completedSplits']+'/'+_0x2a0a52[_0x1876cd(0x1cb)]+'\x20splits');}});return _0x4692a6;},{'verbose':_0x836920[_0x4e3971(0x1ce)]}),_0x46c3c9=_0x388c82[_0x4e3971(0x1c6)],_0x2de067=_0x46c3c9[_0x4e3971(0x1d1)]?_0x4e3971(0x1c3)+_0x46c3c9[_0x4e3971(0x1d1)]+']':'',_0x26d6a9=_0x3abad5?_0x4e3971(0x1e4)+_0x3432c5+'/'+_0x432ce2+_0x4e3971(0x1f1):'';console[_0x4e3971(0x1ca)]('✔\x20'+_0x26d6a9+_0x4e3971(0x1f7)+formatRows(_0x46c3c9[_0x4e3971(0x1dd)][_0x4e3971(0x1c5)])+'\x20rows\x20'+(_0x4e3971(0x1dc)+formatElapsed(_0x46c3c9[_0x4e3971(0x1dd)]['elapsedTimeMillis'])+_0x2de067));if(_0x3abad5&&_0x3f61b0){const _0x4a29ba=resolveOutputOptions(_0x836920),_0x1c7a55=await formatQueryOutput(_0x46c3c9,_0x4a29ba);_0x8d353b[_0x4e3971(0x1e6)](_0x1c7a55);}else await handleQueryOutput(_0x46c3c9,_0x836920);}catch(_0x4f8c12){const _0x30bcb7=_0x3abad5?'Statement\x20'+_0x3432c5+'/'+_0x432ce2+':\x0a':'',_0xc46da1=_0x4f8c12 instanceof SDKError?_0x4f8c12[_0x4e3971(0x1c4)]:_0x4f8c12['message'];return console['error'](''+_0x30bcb7+_0xc46da1),0x1;}}if(_0x2522bd[_0x4e3971(0x1d4)]>0x1&&_0x3f61b0&&_0x8d353b['length']>0x0){const _0x4943d3=_0x8d353b[_0x4e3971(0x1e5)]('\x0a');writeFileSync(_0x836920[_0x4e3971(0x1c7)],_0x4943d3),console[_0x4e3971(0x1ca)](_0x4e3971(0x1d0)+_0x836920[_0x4e3971(0x1c7)]);}return 0x0;}catch(_0x59915c){throw _0x59915c;}}[a25_0x323394(0x1cc)](_0x2060d5){const _0x180975=a25_0x323394,_0x1e6263=_0x2060d5['args'][0x0],_0x16a63a=_0x2060d5['options'][_0x180975(0x1cf)];if(!_0x1e6263&&!_0x16a63a)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x1e6263&&_0x16a63a)return _0x180975(0x1d5);return undefined;}}
|