@treasuredata/tdx 0.14.7 → 0.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/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.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/tdx +10 -0
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
const a21_0x6e5b10=a21_0x4dcf;(function(_0x2f70fc,_0x1c747a){const _0x1bcc6d=a21_0x4dcf,_0x50b523=_0x2f70fc();while(!![]){try{const _0x4cb388=-parseInt(_0x1bcc6d(0x276))/0x1+parseInt(_0x1bcc6d(0x2e2))/0x2+parseInt(_0x1bcc6d(0x24b))/0x3+-parseInt(_0x1bcc6d(0x2b0))/0x4*(-parseInt(_0x1bcc6d(0x22c))/0x5)+-parseInt(_0x1bcc6d(0x2a9))/0x6+parseInt(_0x1bcc6d(0x2bd))/0x7+parseInt(_0x1bcc6d(0x26b))/0x8;if(_0x4cb388===_0x1c747a)break;else _0x50b523['push'](_0x50b523['shift']());}catch(_0xa9bc18){_0x50b523['push'](_0x50b523['shift']());}}}(a21_0x4d9d,0x5638b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a21_0x4dcf(_0x66008f,_0x576163){_0x66008f=_0x66008f-0x1be;const _0x4d9dd6=a21_0x4d9d();let _0x4dcf71=_0x4d9dd6[_0x66008f];return _0x4dcf71;}import a21_0x568a92 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';function a21_0x4d9d(){const _0x44cc82=['Created','Options:','\x20=\x20','displaySampleData','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','segment:parent:push','Preview:','behavior','Join:','tdx\x20segment\x20parent\x20preview\x20','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Error\x20reading\x20file:\x20','/app/workflows/','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','platform','string','customerGroup','segment:parent:show','Options\x20(one\x20required):\x0a','displayValidateResults','✘\x20Failed\x20to\x20rename\x20directory:\x20','allValid','previewParentYaml','parent_segment','.yaml','pullParentYaml','execute','4035WnmkVv','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','interval','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','localeCompare','\x5c$&','Columns:','Behavior:','behaviorsFile','repeat','\x20--interval\x20','schemaValid','Error:\x20File\x20not\x20found:\x20','\x0a✔\x20Workflow\x20started','Audience\x20ID:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Updated','\x20\x20No\x20sample\x20data\x20available','jobId','customerGroupFile','utf-8','segment:parent:desc','double','✔\x20Updated\x20parent\x20segment\x20\x27','varchar','To\x20cancel:','\x0a⚠️\x20\x20Both\x20','segment:parent:fields','scheduleType','787260nggYVU','master','\x20kill','message','coveragePercent','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:update','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','resolveParentId','displayPreviewHints','verbose','use','displaySummary','bold','Fetching\x20SQL\x20for\x20\x27','Listing\x20fields\x20for\x20\x27','test','.yml','/attempt/','\x27\x20with\x20ID:\x20','👥\x20','table','runParent','rowCount','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','xdg-open','/\x20directory.\x0a','jsonl','Error:','stop','json','843888koRtKK','processedRows','segment:parent:pull','\x20--behavior\x20\x22','Master:','displayBehaviorsStats','workflowSessionId','\x20parent\x20segment\x20\x27','updateParent','/sessions/','run','489573lmDquS','\x20--behavior\x20\x22<name>\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','replace','Available\x20behaviors:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Creating\x20parent\x20segment\x20\x27','unref','Resolving\x20parent\x20segment\x20\x27','\x20rows\x20','\x20Context\x20set:\x20','information_schema','listParents','join','/\x20and\x20','Table:\x20','joinKey','\x27\x20is\x20already\x20up\x20to\x20date','columns','in\x20','setJobId','Session:','Listing\x20parent\x20segments...','Error:\x20--attribute\x20requires\x20a\x20name\x0a','attribute','createParent','customerPercent','dim','\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','listFields','Attributes','\x0a⚠️\x20\x20Migrating:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--attribute\x20\x22<name>\x22','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20rows)','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','start','site','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Site:\x20','text','scheduleOption','\x20is\x20already\x20up\x20to\x20date','Coverage:','\x0aNew\x20parent\x20segment\x20\x27','4125858VwJNla','workflowId','Enriched:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','validateParentYaml','endsWith','Validate:','1692UTZYyQ','query','YAML\x20file:\x20','filter','sampleData','/{name}.yml\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','-1d','\x20Opening\x20','web','segment:parent:run','all','Database:\x20','3825696gkTJYR','/\x20directories\x20exist.','Join\x20on:','using\x20the\x20default\x20path:\x20','✔\x20Renamed\x20directory\x20to\x20','data','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','attributesFile','keys','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','displayAttributesStats','Parent\x20segment:\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','segment','addBehaviorsFile','Updating\x20parent\x20segment\x20\x27','timezone','parent_segments','Behaviors','foreignKey','getParentSQL','segment:parent:preview','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','red','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','length','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','addAttributesFile','Rows:','Creating','displayPreviewResults','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','name','yellow','label','549168OIwTGf','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','customersWithEvents','Customers:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','errors','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','format','\x20--attribute\x20\x22','%)\x20','\x20tdx\x20wf\x20attempt\x20','cyan','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','win32','match','Master\x20+\x20Attributes','darwin','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','parentSegment','column','yes','segment:parent:create','Name:\x20','Options:\x0a','totalEvents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Status:','enriched','Found\x20YAML\x20file:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','population','Apply\x20changes\x20to\x20\x27','attributes','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','SQL\x20query:\x0a','No\x20parent\x20segments\x20found','✔\x20Found\x20','Fetching\x20parent\x20segment\x20\x27','description','\x27...','Analyzing\x20changes...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Source:','\x27\x20and\x20run\x20workflow?','segment:parent:validate','SELECT\x20*\x20FROM\x20(\x0a','output','\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:list','behaviors','Aborted.','database','green','\x20[Job\x20ID:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','status','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','apply','error','/app/dw/parentSegments/','session','List\x20parent\x20segments','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','log','workflowAttemptId','pushParentYaml','preview','Show\x20parent\x20segment\x20details','✔\x20No\x20changes\x20-\x20\x27','Master\x20Table','displayColumns','matchedCount','segment:parent:view','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0aChanges\x20to\x20\x27','getParentFull','displayMasterInfo','Overwrite\x20\x27','\x20\x20\x20\x20-\x20','number','limit','Updating','Attempt:','map','Errors:'];a21_0x4d9d=function(){return _0x44cc82;};return a21_0x4d9d();}import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x5051ed 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=a21_0x6e5b10(0x2d0),LEGACY_PARENT_SEGMENT_DIR=a21_0x6e5b10(0x228);function openBrowser(_0x10c64a){const _0x2c8e18=a21_0x6e5b10,_0xce3d6=process[_0x2c8e18(0x21f)],_0x49c46d=_0xce3d6===_0x2c8e18(0x1c2)?'open':_0xce3d6===_0x2c8e18(0x1bf)?_0x2c8e18(0x2a0):_0x2c8e18(0x265);spawn(_0x49c46d,[_0x10c64a],{'detached':!![],'stdio':'ignore'})[_0x2c8e18(0x27f)]();}function migrateLegacyDirectory(){const _0x585315=a21_0x6e5b10;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3d838f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3d838f['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a21_0x5051ed[_0x585315(0x2e0)](_0x585315(0x248)+LEGACY_PARENT_SEGMENT_DIR+_0x585315(0x286)+PARENT_SEGMENT_DIR+_0x585315(0x2be))),console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x293)](_0x585315(0x2ac)+LEGACY_PARENT_SEGMENT_DIR+_0x585315(0x266))),![];console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x2e0)](_0x585315(0x299)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x585315(0x1ee)](a21_0x5051ed['green'](_0x585315(0x2c1)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x16d8c3){const _0x412414=_0x16d8c3 instanceof Error?_0x16d8c3[_0x585315(0x24e)]:String(_0x16d8c3);return console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x2d6)](_0x585315(0x225)+_0x412414+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x6e5b10(0x275)](_0x24d878){return migrateLegacyDirectory(),super['run'](_0x24d878);}}function resolveYamlFile(_0xd31fd6){const _0x36296d=a21_0x6e5b10;if(_0xd31fd6[_0x36296d(0x2ae)](_0x36296d(0x25d))||_0xd31fd6[_0x36296d(0x2ae)](_0x36296d(0x229)))return _0xd31fd6;return a21_0x568a92[_0x36296d(0x285)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd31fd6)+_0x36296d(0x25d));}function formatProgressMessage(_0xe297f){const _0x335466=a21_0x6e5b10,_0xbc6547=_0xe297f[_0x335466(0x1c0)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xbc6547){const [,_0x3aa9e2,_0x54878a,_0x542f9f='']=_0xbc6547;return a21_0x5051ed[_0x335466(0x293)](_0x3aa9e2+':')+'\x20'+_0x54878a+a21_0x5051ed['dim'](_0x542f9f);}return a21_0x5051ed[_0x335466(0x293)](_0xe297f);}function showFileNotFoundError(_0x569967,_0x4d4289){const _0x34830d=a21_0x6e5b10;console[_0x34830d(0x1ee)](a21_0x5051ed[_0x34830d(0x2d6)](_0x34830d(0x239)+_0x569967+'\x0a')),console[_0x34830d(0x1ee)](a21_0x5051ed[_0x34830d(0x2f0)](_0x34830d(0x252)+_0x4d4289+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x3e61cc){const _0xe90eec=a21_0x6e5b10;console['error'](a21_0x5051ed[_0xe90eec(0x2e0)](_0xe90eec(0x2e9))),console['error'](_0x3e61cc);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1e3);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x1f1);async[a21_0x6e5b10(0x22b)](_0x2a9bf){const _0x5751f0=a21_0x6e5b10,{options:_0x5b4e7c,args:_0x23b469,tdx:_0x1a1577}=_0x2a9bf,_0x207812=_0x23b469[0x0];_0x5b4e7c[_0x5751f0(0x256)]&&(console[_0x5751f0(0x1ee)]('Site:\x20'+_0x5b4e7c[_0x5751f0(0x2a1)]),_0x207812&&console[_0x5751f0(0x1ee)]('Pattern:\x20'+_0x207812));const _0x58fffc=await withSpinner(_0x207812?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x207812+_0x5751f0(0x1da):_0x5751f0(0x28e),()=>_0x1a1577['segment'][_0x5751f0(0x284)](),{'verbose':_0x5b4e7c[_0x5751f0(0x256)]});let _0x3fafcf=_0x58fffc[_0x5751f0(0x2c2)];if(_0x207812){const _0x38b084=_0x207812[_0x5751f0(0x27a)](/[.+^${}()|[\]\\]/g,_0x5751f0(0x232))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4ba212=new RegExp('^'+_0x38b084+'$','i');_0x3fafcf=_0x3fafcf[_0x5751f0(0x2b3)](_0x356983=>_0x4ba212[_0x5751f0(0x25c)](_0x356983[_0x5751f0(0x1d3)][_0x5751f0(0x2df)]));}_0x3fafcf['sort']((_0x1518f8,_0x123ad4)=>_0x1518f8[_0x5751f0(0x1d3)][_0x5751f0(0x2df)][_0x5751f0(0x231)](_0x123ad4[_0x5751f0(0x1d3)][_0x5751f0(0x2df)])),console[_0x5751f0(0x1ee)](_0x5751f0(0x1d7)+_0x3fafcf['length']+_0x5751f0(0x294)+(_0x3fafcf[_0x5751f0(0x2d8)]!==0x1?'s':''));const _0x20a319=_0x4a208a=>{const _0x509008=_0x5751f0;return getConsoleNextUrl(_0x5b4e7c[_0x509008(0x2a1)],_0x509008(0x1ef)+_0x4a208a);};if(_0x5b4e7c[_0x5751f0(0x2ec)]==='json'||_0x5b4e7c[_0x5751f0(0x2ec)]===_0x5751f0(0x267)){const _0x5a7dcf=_0x3fafcf[_0x5751f0(0x20d)](_0x26cc15=>({..._0x26cc15,'url':_0x20a319(_0x26cc15['id'])}));await handleSDKOutput(_0x5a7dcf,_0x5b4e7c);}else{if(_0x3fafcf[_0x5751f0(0x2d8)]===0x0)_0x207812?console['log'](_0x5751f0(0x1eb)+_0x207812):console[_0x5751f0(0x1f6)](_0x5751f0(0x1d6));else for(const _0x5d431c of _0x3fafcf){const _0x5795f8=_0x5d431c[_0x5751f0(0x1d3)]['population']?a21_0x5051ed[_0x5751f0(0x293)]('\x20('+formatRows(_0x5d431c[_0x5751f0(0x1d3)][_0x5751f0(0x1d1)])+')'):'',_0x2123ec=hyperlink(_0x5d431c[_0x5751f0(0x1d3)][_0x5751f0(0x2df)],_0x20a319(_0x5d431c['id']));console['log'](_0x5751f0(0x260)+_0x2123ec+_0x5795f8);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1c8);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x203);async['execute'](_0x3bf2c2){const _0xc5ef6b=a21_0x6e5b10,{options:_0x4cc35e,args:_0x315597,tdx:_0x129497}=_0x3bf2c2;console['error'](_0xc5ef6b(0x2e3)+_0xc5ef6b(0x1d0)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1365fb=_0x4cc35e;if(_0x315597[_0xc5ef6b(0x2d8)]===0x0)return console['error'](a21_0x5051ed[_0xc5ef6b(0x2d6)](_0xc5ef6b(0x2b6))),console[_0xc5ef6b(0x1ee)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0xc56707=_0x315597[0x0];if(!_0x1365fb[_0xc5ef6b(0x1e6)]||!_0x1365fb[_0xc5ef6b(0x261)])return console[_0xc5ef6b(0x1ee)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0xc5ef6b(0x202)),0x1;_0x1365fb[_0xc5ef6b(0x256)]&&(console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x2a3)+_0x1365fb[_0xc5ef6b(0x2a1)]),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x1c9)+_0xc56707),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x2bc)+_0x1365fb['database']),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x287)+_0x1365fb[_0xc5ef6b(0x261)]));const _0x33e40c=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x1d3)],_0x1365fb[_0xc5ef6b(0x2c6)]),_0x3667fb=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x1e4)],_0x1365fb[_0xc5ef6b(0x235)]),_0x403930=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x221)],_0x1365fb[_0xc5ef6b(0x241)]),_0x23152e={'name':_0xc56707,'description':_0x1365fb[_0xc5ef6b(0x1d9)],'scheduleType':_0x1365fb[_0xc5ef6b(0x24a)],'scheduleOption':_0x1365fb[_0xc5ef6b(0x2a5)],'timezone':_0x1365fb[_0xc5ef6b(0x2cf)],'master':{'parentDatabaseName':_0x1365fb[_0xc5ef6b(0x1e6)],'parentTableName':_0x1365fb[_0xc5ef6b(0x261)]},'attributes':_0x33e40c,'behaviors':_0x3667fb,'customerGroup':_0x403930},_0x19ad61=await withSpinner(_0xc5ef6b(0x27e)+_0xc56707+_0xc5ef6b(0x1da),()=>_0x129497[_0xc5ef6b(0x2cc)][_0xc5ef6b(0x291)](_0x23152e),{'verbose':_0x4cc35e['verbose']}),_0x3e032e=_0x19ad61[_0xc5ef6b(0x2c2)];return console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x250)+_0x3e032e[_0xc5ef6b(0x2df)]+_0xc5ef6b(0x25f)+_0x3e032e['id']),await handleSDKOutput([_0x3e032e],_0x4cc35e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x251);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x278);async['execute'](_0x498bd9){const _0xf30ffc=a21_0x6e5b10,{options:_0x50536c,args:_0x5c4a36,tdx:_0xae0a62}=_0x498bd9;console[_0xf30ffc(0x1ee)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0xf30ffc(0x1d0)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1163cd=_0x50536c;if(_0x5c4a36[_0xf30ffc(0x2d8)]===0x0)return console[_0xf30ffc(0x1ee)](a21_0x5051ed['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xf30ffc(0x1ee)](_0xf30ffc(0x23c)),0x1;const _0x34b932=_0x5c4a36[0x0];_0x1163cd[_0xf30ffc(0x256)]&&(console['error']('Site:\x20'+_0x1163cd[_0xf30ffc(0x2a1)]),console[_0xf30ffc(0x1ee)](_0xf30ffc(0x2ca)+_0x34b932));const _0x56d4d0=await withSpinner(_0xf30ffc(0x2ea)+_0x34b932+'\x27...',()=>_0xae0a62['segment'][_0xf30ffc(0x205)](_0x34b932),{'verbose':_0x1163cd[_0xf30ffc(0x256)]}),_0x9dda23=_0x56d4d0[_0xf30ffc(0x2c2)],_0x1fce9e=await loadJSONFromOptions(_0x1163cd['addAttributes'],_0x1163cd[_0xf30ffc(0x2da)]),_0x3fd8fa=await loadJSONFromOptions(_0x1163cd['addBehaviors'],_0x1163cd[_0xf30ffc(0x2cd)]),_0x4f2f75={'name':_0x9dda23['name'],'description':_0x1163cd[_0xf30ffc(0x1d9)]!==undefined?_0x1163cd['description']:_0x9dda23[_0xf30ffc(0x1d9)],'scheduleType':_0x1163cd['scheduleType']!==undefined?_0x1163cd[_0xf30ffc(0x24a)]:_0x9dda23[_0xf30ffc(0x24a)],'scheduleOption':_0x1163cd[_0xf30ffc(0x2a5)]!==undefined?_0x1163cd[_0xf30ffc(0x2a5)]:_0x9dda23[_0xf30ffc(0x2a5)],'timezone':_0x1163cd['timezone']!==undefined?_0x1163cd['timezone']:_0x9dda23['timezone'],'master':_0x9dda23[_0xf30ffc(0x24c)],'attributes':_0x1fce9e?[..._0x9dda23[_0xf30ffc(0x1d3)]||[],..._0x1fce9e]:_0x9dda23[_0xf30ffc(0x1d3)],'behaviors':_0x3fd8fa?[..._0x9dda23[_0xf30ffc(0x1e4)]||[],..._0x3fd8fa]:_0x9dda23[_0xf30ffc(0x1e4)],'customerGroup':_0x9dda23[_0xf30ffc(0x221)]},_0x4fb62a=await withSpinner(_0xf30ffc(0x2ce)+_0x34b932+_0xf30ffc(0x1da),()=>_0xae0a62[_0xf30ffc(0x2cc)][_0xf30ffc(0x273)](_0x34b932,_0x4f2f75),{'verbose':_0x1163cd['verbose']}),_0xbb5943=_0x4fb62a[_0xf30ffc(0x2c2)];return console[_0xf30ffc(0x1ee)](_0xf30ffc(0x245)+_0xbb5943[_0xf30ffc(0x2df)]+'\x27'),await handleSDKOutput([_0xbb5943],_0x1163cd),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x26d);[a21_0x6e5b10(0x1d9)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x6e5b10(0x22b)](_0x16d7b2){const _0x32b190=a21_0x6e5b10,{options:_0x13409e,args:_0xf55739,tdx:_0x3c9d29}=_0x16d7b2,_0x5456bb=_0x13409e,_0x4b08bf=_0xf55739[0x0]||_0x13409e['parentSegment'];if(!_0x4b08bf)return showParentSegmentNotSetError(_0x32b190(0x23d)+_0x32b190(0x295)),0x1;if(_0x5456bb[_0x32b190(0x257)]&&_0x5456bb['output'])return console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x2d6)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console['error'](a21_0x5051ed[_0x32b190(0x293)](_0x32b190(0x2e6))),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x293)](_0x32b190(0x2c0)+PARENT_SEGMENT_DIR+_0x32b190(0x2b5))),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x2f0)](_0x32b190(0x1c3))),0x1;const _0x2700bf=_0x5456bb[_0x32b190(0x1e1)]||a21_0x568a92[_0x32b190(0x285)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4b08bf)+'.yml');_0x5456bb[_0x32b190(0x256)]&&(console[_0x32b190(0x1ee)](_0x32b190(0x2a3)+_0x5456bb[_0x32b190(0x2a1)]),console[_0x32b190(0x1ee)]('Parent\x20segment:\x20'+_0x4b08bf),console[_0x32b190(0x1ee)]('Output\x20file:\x20'+_0x2700bf));const _0x37ded5=await withSpinner(_0x32b190(0x1d8)+_0x4b08bf+_0x32b190(0x1da),()=>_0x3c9d29[_0x32b190(0x2cc)][_0x32b190(0x22a)](_0x4b08bf),{'verbose':_0x5456bb['verbose']}),_0x32e409=_0x37ded5[_0x32b190(0x2c2)];if(existsSync(_0x2700bf)){const _0x25700b=readFileSync(_0x2700bf,_0x32b190(0x242)),_0x29a24b=generateDiff(_0x25700b,_0x32e409);if(!hasChanges(_0x29a24b))console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c4)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf)+_0x32b190(0x2a6));else{console[_0x32b190(0x1ee)](_0x32b190(0x204)+_0x2700bf+'\x27:'),console['error']('─'[_0x32b190(0x236)](0x3c)),console[_0x32b190(0x1ee)](formatDiffWithColors(_0x29a24b)),console[_0x32b190(0x1ee)]('─'[_0x32b190(0x236)](0x3c));if(!_0x5456bb['yes']){const _0x266d60=await confirmKey(_0x32b190(0x207)+_0x2700bf+'\x27?');if(!_0x266d60)return console[_0x32b190(0x1ee)](_0x32b190(0x1e5)),0x1;}writeFileSync(_0x2700bf,_0x32e409,_0x32b190(0x242)),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c8)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf));}}else{const _0x4d2161=a21_0x568a92['dirname'](_0x2700bf);!existsSync(_0x4d2161)&&mkdirSync(_0x4d2161,{'recursive':!![]}),writeFileSync(_0x2700bf,_0x32e409,'utf-8'),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c8)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf));}return saveSessionContext({'parent_segment':_0x4b08bf},_0x5456bb[_0x32b190(0x1f0)]),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x282)+a21_0x5051ed[_0x32b190(0x293)]('parent_segment')+_0x32b190(0x211)+a21_0x5051ed[_0x32b190(0x2f0)](_0x4b08bf)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x214);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a21_0x6e5b10(0x22b)](_0x2de41b){const _0x36b9a4=a21_0x6e5b10,{options:_0x5256d6,args:_0x425df5,tdx:_0x698e87}=_0x2de41b,_0x408007=_0x5256d6,_0x3ec28c=_0x425df5[0x0]||_0x5256d6[_0x36b9a4(0x1c5)];if(!_0x3ec28c)return showParentSegmentNotSetError(_0x36b9a4(0x253)+_0x36b9a4(0x1f3)),0x1;const _0x1cdab5=resolveYamlFile(_0x3ec28c);if(!existsSync(_0x1cdab5))return showFileNotFoundError(_0x1cdab5,_0x3ec28c),0x1;_0x408007[_0x36b9a4(0x256)]&&(console[_0x36b9a4(0x1ee)]('Site:\x20'+_0x408007[_0x36b9a4(0x2a1)]),console['error'](_0x36b9a4(0x2b2)+_0x1cdab5));let _0x3e7ce6;try{_0x3e7ce6=readFileSync(_0x1cdab5,'utf-8');}catch(_0x2d7534){const _0x36c0c0=_0x2d7534 instanceof Error?_0x2d7534[_0x36b9a4(0x24e)]:String(_0x2d7534);return console['error'](_0x36b9a4(0x21b)+_0x36c0c0),0x1;}const _0xce2c4a=await withSpinner(_0x36b9a4(0x1db),()=>_0x698e87[_0x36b9a4(0x2cc)][_0x36b9a4(0x1f8)](_0x3e7ce6),{'verbose':_0x408007[_0x36b9a4(0x256)]}),_0x5bf998=_0xce2c4a[_0x36b9a4(0x2c2)],{isNew:_0x54fe8d,name:_0x41fc8c,hasChanges:_0x1b0f8f,diffFormatted:_0x243627}=_0x5bf998;if(!_0x1b0f8f)return console[_0x36b9a4(0x1ee)](_0x36b9a4(0x1fb)+_0x41fc8c+_0x36b9a4(0x289)),0x0;_0x54fe8d?console[_0x36b9a4(0x1ee)](_0x36b9a4(0x2a8)+_0x41fc8c+'\x27:'):console[_0x36b9a4(0x1ee)](_0x36b9a4(0x200)+_0x41fc8c+'\x27:');console[_0x36b9a4(0x1ee)]('─'[_0x36b9a4(0x236)](0x3c)),console[_0x36b9a4(0x1ee)](_0x243627),console[_0x36b9a4(0x1ee)]('─'['repeat'](0x3c));const _0x2bdaea=_0x54fe8d?'Create\x20parent\x20segment\x20\x27'+_0x41fc8c+'\x27?':_0x36b9a4(0x1d2)+_0x41fc8c+'\x27?';if(!_0x408007[_0x36b9a4(0x1c7)]){const _0x12b3b5=await confirmKey(_0x2bdaea);if(!_0x12b3b5)return console['error'](_0x36b9a4(0x1e5)),0x1;}const _0x172db3=_0x54fe8d?_0x36b9a4(0x2dc):_0x36b9a4(0x20b),_0x5573df=await withSpinner(_0x172db3+_0x36b9a4(0x272)+_0x41fc8c+_0x36b9a4(0x1da),()=>_0x5bf998['apply'](),{'verbose':_0x408007[_0x36b9a4(0x256)]}),_0x2c0162=_0x5573df['data'],_0x4f0a0c=getConsoleNextUrl(_0x408007['site'],_0x36b9a4(0x1ef)+_0x2c0162['id']),_0x906ce5=_0x54fe8d?_0x36b9a4(0x20f):'Updated';return console['error']('✔\x20'+_0x906ce5+_0x36b9a4(0x272)+_0x2c0162[_0x36b9a4(0x2df)]+'\x27'),console[_0x36b9a4(0x1ee)]('\x20\x20'+_0x4f0a0c),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a21_0x6e5b10(0x1df);['description']=a21_0x6e5b10(0x2eb);async[a21_0x6e5b10(0x22b)](_0x414242){const _0x487bfc=a21_0x6e5b10,{options:_0x51d452,args:_0x153aba,tdx:_0x4f7914}=_0x414242,_0xc4a2fb=_0x51d452,_0x5288cf=_0x153aba[0x0]||_0x51d452['parentSegment'];if(!_0x5288cf)return showParentSegmentNotSetError(_0x487bfc(0x213)+_0x487bfc(0x1c4)+_0x487bfc(0x1ca)+_0x487bfc(0x29e)+_0x487bfc(0x29c)+_0x487bfc(0x1ec)),0x1;const _0x3495f2=resolveYamlFile(_0x5288cf);if(!existsSync(_0x3495f2))return showFileNotFoundError(_0x3495f2,_0x5288cf),0x1;_0xc4a2fb['verbose']&&(console[_0x487bfc(0x1ee)]('Site:\x20'+_0xc4a2fb[_0x487bfc(0x2a1)]),console[_0x487bfc(0x1ee)]('YAML\x20file:\x20'+_0x3495f2));let _0x4ca39e;try{_0x4ca39e=readFileSync(_0x3495f2,_0x487bfc(0x242));}catch(_0x42e4ca){const _0x1f266b=_0x42e4ca instanceof Error?_0x42e4ca['message']:String(_0x42e4ca);return console[_0x487bfc(0x1ee)](_0x487bfc(0x21b)+_0x1f266b),0x1;}const _0x2937ae=createCommandSpinner(a21_0x5051ed[_0x487bfc(0x293)]('Validating\x20configuration...'),{'verbose':_0xc4a2fb[_0x487bfc(0x256)]});_0x2937ae[_0x487bfc(0x2a0)]();const _0x3dbc33={'onProgress':_0x4ef26a=>{const _0x1cb438=_0x487bfc;_0x2937ae[_0x1cb438(0x2a4)]=formatProgressMessage(_0x4ef26a);}};if(_0xc4a2fb[_0x487bfc(0x24c)])_0x3dbc33[_0x487bfc(0x24c)]=!![];if(_0xc4a2fb[_0x487bfc(0x1ce)])_0x3dbc33['enriched']=!![];_0xc4a2fb['attribute']&&(_0x3dbc33['attribute']=_0xc4a2fb[_0x487bfc(0x290)]);_0xc4a2fb[_0x487bfc(0x216)]&&(_0x3dbc33[_0x487bfc(0x216)]=_0xc4a2fb[_0x487bfc(0x216)]);if(_0xc4a2fb['interval'])_0x3dbc33[_0x487bfc(0x22f)]=_0xc4a2fb[_0x487bfc(0x22f)];let _0x36f93d;try{_0x36f93d=await _0x4f7914[_0x487bfc(0x2cc)][_0x487bfc(0x2ad)](_0x4ca39e,_0x3dbc33),_0x2937ae['stop']();}catch(_0x448c89){_0x2937ae['stop']();throw _0x448c89;}const _0x296765=_0xc4a2fb['interval']||_0x487bfc(0x2b7);return this[_0x487bfc(0x224)](_0x36f93d,_0x3dbc33,_0x3495f2,_0x296765),_0x36f93d['allValid']?0x0:0x1;}[a21_0x6e5b10(0x224)](_0xfcc5c2,_0x318d20,_0x14908a,_0x5d6d48){const _0x5f4d0b=a21_0x6e5b10;console[_0x5f4d0b(0x1ee)]('\x0a'+a21_0x5051ed['bold'](_0x5f4d0b(0x2af))+'\x20'+_0xfcc5c2[_0x5f4d0b(0x2df)]),console[_0x5f4d0b(0x1ee)]('═'[_0x5f4d0b(0x236)](0x3c)),this[_0x5f4d0b(0x206)](_0xfcc5c2);if(typeof _0x318d20[_0x5f4d0b(0x290)]===_0x5f4d0b(0x220)){this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x258)](_0xfcc5c2),this['displayPreviewHints'](_0x14908a,_0x5d6d48,'attribute',_0x318d20[_0x5f4d0b(0x290)]);return;}if(_0x318d20[_0x5f4d0b(0x290)]===!![]){this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'attributes');return;}if(typeof _0x318d20[_0x5f4d0b(0x216)]===_0x5f4d0b(0x220)){this['displayBehaviorsStats'](_0xfcc5c2,_0x5d6d48),this['displaySummary'](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'behavior',_0x318d20['behavior']);return;}if(_0x318d20[_0x5f4d0b(0x216)]===!![]){this[_0x5f4d0b(0x270)](_0xfcc5c2,_0x5d6d48),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,_0x5f4d0b(0x1e4));return;}this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x270)](_0xfcc5c2,_0x5d6d48),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'all');}[a21_0x6e5b10(0x255)](_0x1ce74a,_0x39e361,_0x7e35df,_0x32c9b4){const _0x3c22c2=a21_0x6e5b10;console[_0x3c22c2(0x1ee)]('\x0a'+a21_0x5051ed[_0x3c22c2(0x293)]('To\x20view\x20sample\x20data:'));const _0xf252c6=_0x39e361!==_0x3c22c2(0x2b7)?_0x3c22c2(0x237)+_0x39e361:'';if(_0x7e35df===_0x3c22c2(0x290)&&_0x32c9b4)console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+_0x3c22c2(0x2ed)+_0x32c9b4+'\x22'+_0xf252c6));else{if(_0x7e35df==='behavior'&&_0x32c9b4)console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+'\x20--behavior\x20\x22'+_0x32c9b4+'\x22'+_0xf252c6));else(_0x7e35df==='attributes'||_0x7e35df===_0x3c22c2(0x2bb))&&console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1ce74a+_0x3c22c2(0x29b)+_0xf252c6));}(_0x7e35df===_0x3c22c2(0x1e4)||_0x7e35df===_0x3c22c2(0x2bb))&&console['error']('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+_0x3c22c2(0x277)+_0xf252c6)),_0x7e35df===_0x3c22c2(0x2bb)&&console['error']('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1ce74a+'\x20--enriched'+_0xf252c6));}['displayMasterInfo'](_0x16a7e7){const _0x213746=a21_0x6e5b10,{master:_0x1b59d0}=_0x16a7e7,_0x17660e=_0x1b59d0[_0x213746(0x238)]?a21_0x5051ed[_0x213746(0x1e7)]('✔'):a21_0x5051ed['red']('✘');console[_0x213746(0x1ee)]('\x0a'+a21_0x5051ed[_0x213746(0x293)](_0x213746(0x1fc))),console['error'](_0x17660e+'\x20'+a21_0x5051ed[_0x213746(0x259)](_0x1b59d0[_0x213746(0x1e6)]+'.'+_0x1b59d0['table'])),_0x1b59d0['schemaValid']?_0x1b59d0[_0x213746(0x263)]!==undefined&&console[_0x213746(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x213746(0x293)](_0x213746(0x2db))+'\x20'+a21_0x5051ed['cyan'](formatRows(_0x1b59d0[_0x213746(0x263)]))):console[_0x213746(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x213746(0x2d6)](_0x213746(0x268))+'\x20'+_0x1b59d0['schemaError']);}['displayAttributesStats'](_0x199ada){const _0x203785=a21_0x6e5b10;if(_0x199ada[_0x203785(0x1d3)][_0x203785(0x2d8)]===0x0)return;console[_0x203785(0x1ee)]('\x0a'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x298)));for(const _0x2573af of _0x199ada[_0x203785(0x1d3)]){const _0x22dc3=_0x2573af['schemaValid']?a21_0x5051ed[_0x203785(0x1e7)]('✔'):a21_0x5051ed[_0x203785(0x2d6)]('✘');let _0x5e5768='';if(_0x2573af[_0x203785(0x238)]&&_0x2573af['matchedCount']!==undefined&&_0x2573af[_0x203785(0x24f)]!==undefined){const _0x496d11=_0x2573af[_0x203785(0x24f)]['toFixed'](0x1),_0x344ed6=_0x2573af['coveragePercent']>=0x50?a21_0x5051ed['green']:_0x2573af[_0x203785(0x24f)]>=0x32?a21_0x5051ed['yellow']:a21_0x5051ed[_0x203785(0x2d6)];_0x5e5768='\x20'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x2a7))+'\x20'+_0x344ed6(_0x496d11+'%')+'\x20('+formatRows(_0x2573af[_0x203785(0x1fe)])+_0x203785(0x29d);}console[_0x203785(0x1ee)](_0x22dc3+'\x20'+a21_0x5051ed[_0x203785(0x259)](_0x2573af[_0x203785(0x2df)])+_0x5e5768),console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed['dim'](_0x203785(0x1dd))+'\x20'+a21_0x5051ed['bold'](_0x2573af[_0x203785(0x1e6)]+'.'+_0x2573af[_0x203785(0x261)]));const _0x5903ee=_0x2573af[_0x203785(0x288)]===_0x2573af['foreignKey']?a21_0x5051ed[_0x203785(0x293)]('Join\x20on:')+'\x20'+_0x2573af['joinKey']:a21_0x5051ed[_0x203785(0x293)](_0x203785(0x217))+'\x20'+_0x2573af[_0x203785(0x288)]+'\x20=\x20'+_0x2573af[_0x203785(0x2d2)];console[_0x203785(0x1ee)]('\x20\x20'+_0x5903ee),console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x233))),this[_0x203785(0x1fd)](_0x2573af[_0x203785(0x28a)]),!_0x2573af[_0x203785(0x238)]&&console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x203785(0x2d6)]('Error:')+'\x20'+_0x2573af['schemaError']);}}[a21_0x6e5b10(0x270)](_0x2efd96,_0x59888f){const _0x356438=a21_0x6e5b10;if(_0x2efd96['behaviors'][_0x356438(0x2d8)]===0x0)return;console[_0x356438(0x1ee)]('\x0a'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x2d1))+'\x20'+a21_0x5051ed['dim']('('+_0x59888f+')'));for(const _0x5614c8 of _0x2efd96[_0x356438(0x1e4)]){const _0x2b9870=_0x5614c8['schemaValid']?a21_0x5051ed[_0x356438(0x1e7)]('✔'):a21_0x5051ed[_0x356438(0x2d6)]('✘');let _0x5dd6b5='';if(_0x5614c8[_0x356438(0x238)]&&_0x5614c8['customersWithEvents']!==undefined&&_0x5614c8[_0x356438(0x1cb)]!==undefined){const _0x14125f=_0x5614c8['customerPercent']?.['toFixed'](0x1)||'?',_0x2fdb04=(_0x5614c8[_0x356438(0x292)]??0x0)>=0x32?a21_0x5051ed[_0x356438(0x1e7)]:(_0x5614c8[_0x356438(0x292)]??0x0)>=0x14?a21_0x5051ed[_0x356438(0x2e0)]:a21_0x5051ed[_0x356438(0x2d6)];_0x5dd6b5='\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x2e5))+'\x20'+_0x2fdb04(formatRows(_0x5614c8[_0x356438(0x2e4)]))+'\x20('+_0x14125f+_0x356438(0x2ee)+a21_0x5051ed[_0x356438(0x293)]('Events:')+'\x20'+a21_0x5051ed['cyan'](formatRows(_0x5614c8[_0x356438(0x1cb)]));}console['error'](_0x2b9870+'\x20'+a21_0x5051ed[_0x356438(0x259)](_0x5614c8[_0x356438(0x2df)])+_0x5dd6b5),console[_0x356438(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x1dd))+'\x20'+a21_0x5051ed['bold'](_0x5614c8[_0x356438(0x1e6)]+'.'+_0x5614c8[_0x356438(0x261)]));const _0x395542=_0x5614c8[_0x356438(0x288)]===_0x5614c8[_0x356438(0x2d2)]?a21_0x5051ed['dim'](_0x356438(0x2bf))+'\x20'+_0x5614c8['joinKey']:a21_0x5051ed[_0x356438(0x293)](_0x356438(0x217))+'\x20'+_0x5614c8[_0x356438(0x288)]+'\x20=\x20'+_0x5614c8['foreignKey'];console['error']('\x20\x20'+_0x395542),console[_0x356438(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x233))),this[_0x356438(0x1fd)](_0x5614c8['columns']),!_0x5614c8[_0x356438(0x238)]&&console['error']('\x20\x20'+a21_0x5051ed[_0x356438(0x2d6)](_0x356438(0x268))+'\x20'+_0x5614c8['schemaError']);}}[a21_0x6e5b10(0x1fd)](_0x151aa0){const _0x178812=a21_0x6e5b10;for(const _0x2b45bd of _0x151aa0){_0x2b45bd[_0x178812(0x2e1)]===_0x2b45bd['column']||_0x2b45bd[_0x178812(0x1c6)]==='*'?console[_0x178812(0x1ee)]('\x20\x20\x20\x20-\x20'+_0x2b45bd[_0x178812(0x2e1)]):console[_0x178812(0x1ee)](_0x178812(0x208)+_0x2b45bd[_0x178812(0x2e1)]+'\x20'+a21_0x5051ed[_0x178812(0x293)]('('+_0x2b45bd['column']+')'));}}[a21_0x6e5b10(0x258)](_0x34a8b6){const _0x2c503a=a21_0x6e5b10;console[_0x2c503a(0x1ee)]('─'[_0x2c503a(0x236)](0x3c));if(_0x34a8b6['errors'][_0x2c503a(0x2d8)]>0x0){console['error']('\x0a'+a21_0x5051ed[_0x2c503a(0x2d6)]('Errors:'));for(const _0x12cc66 of _0x34a8b6['errors']){console[_0x2c503a(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x2c503a(0x2d6)]('•')+'\x20'+_0x12cc66);}}_0x34a8b6[_0x2c503a(0x226)]&&console['error']('\x0a'+a21_0x5051ed[_0x2c503a(0x1e7)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x2d4);['description']=a21_0x6e5b10(0x279);async['execute'](_0x271d5d){const _0x5c2344=a21_0x6e5b10,{options:_0x266065,args:_0x51d2f5,tdx:_0x5d42f1}=_0x271d5d,_0xa950cb=_0x266065,_0x5cc7ea=_0x51d2f5[0x0]||_0x266065['parentSegment'];if(!_0x5cc7ea)return showParentSegmentNotSetError(_0x5c2344(0x2d9)+_0x5c2344(0x201)+_0x5c2344(0x223)+_0x5c2344(0x1dc)+_0x5c2344(0x2d7)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x5c2344(0x2de)+_0x5c2344(0x1ec)),0x1;if(!_0xa950cb['master']&&!_0xa950cb['attribute']&&!_0xa950cb[_0x5c2344(0x216)]&&!_0xa950cb['enriched'])return console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x22d))),console[_0x5c2344(0x1ee)](_0x5c2344(0x29f)),console[_0x5c2344(0x1ee)](_0x5c2344(0x210)),console['error'](_0x5c2344(0x1e9)),console[_0x5c2344(0x1ee)](_0x5c2344(0x21e)),console[_0x5c2344(0x1ee)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5c2344(0x1ee)](_0x5c2344(0x264)),0x1;const _0x526c7e=resolveYamlFile(_0x5cc7ea);if(!existsSync(_0x526c7e))return showFileNotFoundError(_0x526c7e,_0x5cc7ea),0x1;_0xa950cb[_0x5c2344(0x256)]&&(console[_0x5c2344(0x1ee)](_0x5c2344(0x2a3)+_0xa950cb[_0x5c2344(0x2a1)]),console[_0x5c2344(0x1ee)](_0x5c2344(0x2b2)+_0x526c7e));let _0x22faad;try{_0x22faad=readFileSync(_0x526c7e,'utf-8');}catch(_0x439fff){const _0x1cb127=_0x439fff instanceof Error?_0x439fff[_0x5c2344(0x24e)]:String(_0x439fff);return console[_0x5c2344(0x1ee)](_0x5c2344(0x21b)+_0x1cb127),0x1;}let _0x1427cc;try{_0x1427cc=parseDef(_0x22faad);}catch(_0x4fc6f6){const _0x5cc4da=_0x4fc6f6 instanceof Error?_0x4fc6f6[_0x5c2344(0x24e)]:String(_0x4fc6f6);return console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)]('Error\x20parsing\x20YAML:\x20'+_0x5cc4da)),0x1;}if(_0xa950cb[_0x5c2344(0x290)]===!![]||_0xa950cb[_0x5c2344(0x290)]===''){const _0x33a698=_0x1427cc[_0x5c2344(0x1d3)]?.[_0x5c2344(0x20d)](_0x2a07b7=>_0x2a07b7['name'])||[];if(_0x33a698[_0x5c2344(0x2d8)]===0x0)console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x1be)));else{console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x28f))),console[_0x5c2344(0x1ee)](_0x5c2344(0x296));for(const _0x53e7d9 of _0x33a698){console['error']('\x20\x20'+a21_0x5051ed['cyan'](_0x53e7d9));}console[_0x5c2344(0x1ee)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5cc7ea+_0x5c2344(0x2ed)+_0x33a698[0x0]+'\x22');}return 0x1;}if(_0xa950cb['behavior']===!![]||_0xa950cb['behavior']===''){const _0x39d87b=_0x1427cc[_0x5c2344(0x1e4)]?.[_0x5c2344(0x20d)](_0x3cfb2a=>_0x3cfb2a[_0x5c2344(0x2df)])||[];if(_0x39d87b[_0x5c2344(0x2d8)]===0x0)console[_0x5c2344(0x1ee)](a21_0x5051ed['red'](_0x5c2344(0x1f4)));else{console['error'](a21_0x5051ed['red'](_0x5c2344(0x22e))),console[_0x5c2344(0x1ee)](_0x5c2344(0x27b));for(const _0x303ffe of _0x39d87b){console[_0x5c2344(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x5c2344(0x2f0)](_0x303ffe));}console['error'](_0x5c2344(0x29a)+_0x5cc7ea+_0x5c2344(0x26e)+_0x39d87b[0x0]+'\x22');}return 0x1;}const _0x438e4a=createCommandSpinner(a21_0x5051ed['dim']('Fetching\x20sample\x20data...'),{'verbose':_0xa950cb[_0x5c2344(0x256)]});_0x438e4a[_0x5c2344(0x2a0)]();const _0x25e6e4={'onProgress':_0xe0b983=>{_0x438e4a['text']=formatProgressMessage(_0xe0b983);}};if(_0xa950cb[_0x5c2344(0x24c)])_0x25e6e4['master']=!![];if(_0xa950cb[_0x5c2344(0x290)]&&typeof _0xa950cb['attribute']===_0x5c2344(0x220))_0x25e6e4[_0x5c2344(0x290)]=_0xa950cb['attribute'];if(_0xa950cb[_0x5c2344(0x216)]&&typeof _0xa950cb[_0x5c2344(0x216)]===_0x5c2344(0x220))_0x25e6e4['behavior']=_0xa950cb[_0x5c2344(0x216)];if(_0xa950cb[_0x5c2344(0x1ce)])_0x25e6e4['enriched']=!![];if(_0xa950cb[_0x5c2344(0x22f)])_0x25e6e4[_0x5c2344(0x22f)]=_0xa950cb[_0x5c2344(0x22f)];let _0x2a62a1;try{_0x2a62a1=await _0x5d42f1[_0x5c2344(0x2cc)][_0x5c2344(0x227)](_0x22faad,_0x25e6e4),_0x438e4a['stop']();}catch(_0x3d229f){_0x438e4a[_0x5c2344(0x269)]();throw _0x3d229f;}return await this['displayPreviewResults'](_0x2a62a1,{'master':_0xa950cb[_0x5c2344(0x24c)],'attribute':typeof _0xa950cb[_0x5c2344(0x290)]===_0x5c2344(0x220)?_0xa950cb[_0x5c2344(0x290)]:undefined,'behavior':typeof _0xa950cb['behavior']===_0x5c2344(0x220)?_0xa950cb[_0x5c2344(0x216)]:undefined,'enriched':_0xa950cb['enriched']}),_0x2a62a1[_0x5c2344(0x226)]?0x0:0x1;}async[a21_0x6e5b10(0x2dd)](_0x5755b0,_0x5a5c12){const _0x4dafd0=a21_0x6e5b10;console['error']('\x0a'+a21_0x5051ed[_0x4dafd0(0x259)](_0x4dafd0(0x215))+'\x20'+_0x5755b0[_0x4dafd0(0x2df)]),console[_0x4dafd0(0x1ee)]('═'['repeat'](0x3c));if(_0x5a5c12[_0x4dafd0(0x24c)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x31070f=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x26f))+'\x20'+a21_0x5051ed[_0x4dafd0(0x259)](_0x5755b0[_0x4dafd0(0x24c)][_0x4dafd0(0x1e6)]+'.'+_0x5755b0[_0x4dafd0(0x24c)]['table']);await this['displaySampleData'](_0x31070f,_0x5755b0['sampleData']);}else{if(_0x5a5c12[_0x4dafd0(0x290)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x3046d0=a21_0x5051ed[_0x4dafd0(0x293)]('Attribute:')+'\x20'+a21_0x5051ed['bold'](_0x5a5c12[_0x4dafd0(0x290)]);await this['displaySampleData'](_0x3046d0,_0x5755b0['sampleData']);}else{if(_0x5a5c12[_0x4dafd0(0x216)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x56402c=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x234))+'\x20'+a21_0x5051ed[_0x4dafd0(0x259)](_0x5a5c12[_0x4dafd0(0x216)]);await this[_0x4dafd0(0x212)](_0x56402c,_0x5755b0[_0x4dafd0(0x2b4)]);}else{if(_0x5a5c12[_0x4dafd0(0x1ce)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x88d261=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x2ab))+'\x20'+a21_0x5051ed['bold'](_0x4dafd0(0x1c1));await this[_0x4dafd0(0x212)](_0x88d261,_0x5755b0[_0x4dafd0(0x2b4)]);}else!_0x5755b0[_0x4dafd0(0x2b4)]&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5755b0[_0x4dafd0(0x2e7)]['length']>0x0){console['error']('─'[_0x4dafd0(0x236)](0x3c)),console[_0x4dafd0(0x1ee)]('\x0a'+a21_0x5051ed['red'](_0x4dafd0(0x20e)));for(const _0x2a2533 of _0x5755b0[_0x4dafd0(0x2e7)]){console['error']('\x20\x20'+a21_0x5051ed[_0x4dafd0(0x2d6)]('•')+'\x20'+_0x2a2533);}}}async['displaySampleData'](_0x97736c,_0x139034){const _0x2f5d35=a21_0x6e5b10;if(_0x139034[_0x2f5d35(0x2d8)]===0x0){console[_0x2f5d35(0x1ee)]('\x0a'+_0x97736c),console[_0x2f5d35(0x1ee)](_0x2f5d35(0x23f));return;}console[_0x2f5d35(0x1ee)]('\x0a'+_0x97736c);const _0x2a7fa5=Object[_0x2f5d35(0x2c7)](_0x139034[0x0])['map'](_0x10127e=>({'name':_0x10127e,'type':typeof _0x139034[0x0][_0x10127e]===_0x2f5d35(0x209)?_0x2f5d35(0x244):_0x2f5d35(0x246)})),_0x316311={'queryId':_0x2f5d35(0x1f9),'columns':_0x2a7fa5,'data':_0x139034,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x139034['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x118605=formatAsTable(_0x316311,_0x139034['length'],!![]);await writeOutput(_0x118605,undefined,_0x2f5d35(0x261));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x2ba);['description']=a21_0x6e5b10(0x27d);async[a21_0x6e5b10(0x22b)](_0x159e23){const _0x266890=a21_0x6e5b10,{options:_0x188f24,args:_0xbc0186,tdx:_0x14081b}=_0x159e23,_0x2404fb=_0x188f24,_0xb86aa0=_0xbc0186[0x0]||_0x188f24['parentSegment'];if(!_0xb86aa0)return showParentSegmentNotSetError(_0x266890(0x2e8)+_0x266890(0x21a)),0x1;const _0x3c04f7=resolveYamlFile(_0xb86aa0);if(existsSync(_0x3c04f7)){_0x2404fb['verbose']&&console[_0x266890(0x1ee)](_0x266890(0x1cf)+_0x3c04f7);let _0x582c13;try{_0x582c13=readFileSync(_0x3c04f7,_0x266890(0x242));}catch(_0xfa329a){const _0x4eca57=_0xfa329a instanceof Error?_0xfa329a[_0x266890(0x24e)]:String(_0xfa329a);return console['error'](_0x266890(0x21b)+_0x4eca57),0x1;}const _0x37e408=await withSpinner(_0x266890(0x1db),()=>_0x14081b[_0x266890(0x2cc)]['pushParentYaml'](_0x582c13),{'verbose':_0x2404fb[_0x266890(0x256)]}),_0xac66c6=_0x37e408['data'],{isNew:_0x5143fd,name:_0x4fdf6c,hasChanges:_0x4387e,diffFormatted:_0x10f1a1}=_0xac66c6;if(_0x4387e){_0x5143fd?console['error'](_0x266890(0x2a8)+_0x4fdf6c+'\x27:'):console['error'](_0x266890(0x200)+_0x4fdf6c+'\x27:');console['error']('─'[_0x266890(0x236)](0x3c)),console['error'](_0x10f1a1),console[_0x266890(0x1ee)]('─'[_0x266890(0x236)](0x3c));const _0x4d10da=_0x5143fd?'Create\x20parent\x20segment\x20\x27'+_0x4fdf6c+'\x27\x20and\x20run\x20workflow?':_0x266890(0x1d2)+_0x4fdf6c+_0x266890(0x1de);if(!_0x2404fb[_0x266890(0x1c7)]){const _0x16daf4=await confirmKey(_0x4d10da);if(!_0x16daf4)return console[_0x266890(0x1ee)](_0x266890(0x1e5)),0x1;}const _0x36f6b9=_0x5143fd?_0x266890(0x2dc):_0x266890(0x20b);await withSpinner(_0x36f6b9+_0x266890(0x272)+_0x4fdf6c+_0x266890(0x1da),()=>_0xac66c6[_0x266890(0x1ed)](),{'verbose':_0x2404fb[_0x266890(0x256)]});const _0x344778=_0x5143fd?_0x266890(0x20f):_0x266890(0x23e);console[_0x266890(0x1ee)]('✔\x20'+_0x344778+_0x266890(0x272)+_0x4fdf6c+'\x27');}else console[_0x266890(0x1ee)](_0x266890(0x1fb)+_0x4fdf6c+'\x27\x20is\x20up\x20to\x20date');}const _0x510d1e=await withSpinner(_0x266890(0x230)+_0xb86aa0+_0x266890(0x1da),()=>_0x14081b['segment'][_0x266890(0x262)](_0xb86aa0),{'verbose':_0x2404fb[_0x266890(0x256)]}),_0xe037ba=_0x510d1e[_0x266890(0x2c2)],_0x1c2bbd=getConsoleUrl(_0x2404fb['site'],_0x266890(0x21c)+_0xe037ba[_0x266890(0x2aa)]+_0x266890(0x274)+_0xe037ba[_0x266890(0x271)]+_0x266890(0x25e)+_0xe037ba[_0x266890(0x1f7)]);return console[_0x266890(0x1ee)](_0x266890(0x23a)),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x23b))+'\x20'+_0xe037ba['audienceId']),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x1cd))+'\x20'+_0xe037ba[_0x266890(0x1ea)]),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x28d))+'\x20'+_0xe037ba[_0x266890(0x271)]),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x20c))+'\x20'+_0xe037ba[_0x266890(0x1f7)]),console[_0x266890(0x1ee)]('\x20\x20'+_0x1c2bbd),console[_0x266890(0x1ee)]('\x0a'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x247))+_0x266890(0x2ef)+_0xe037ba[_0x266890(0x1f7)]+_0x266890(0x24d)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a21_0x6e5b10(0x249);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a21_0x6e5b10(0x22b)](_0x48de83){const _0x480b10=a21_0x6e5b10,{options:_0x446bb7,args:_0x3f4461,tdx:_0x2ad519}=_0x48de83,_0x24268c=_0x3f4461[0x0]||_0x446bb7['parentSegment'];if(!_0x24268c)return showParentSegmentNotSetError(_0x480b10(0x1f2)+_0x480b10(0x1e2)),0x1;_0x446bb7[_0x480b10(0x256)]&&(console['error']('Site:\x20'+_0x446bb7[_0x480b10(0x2a1)]),console[_0x480b10(0x1ee)]('Parent\x20segment:\x20'+_0x24268c));const _0x366f1b=await withSpinner(_0x480b10(0x25b)+_0x24268c+_0x480b10(0x1da),()=>_0x2ad519[_0x480b10(0x2cc)][_0x480b10(0x297)](_0x24268c),{'verbose':_0x446bb7[_0x480b10(0x256)]}),_0x182135=_0x366f1b[_0x480b10(0x2c2)];console[_0x480b10(0x1ee)](_0x480b10(0x1d7)+_0x182135['length']+'\x20field'+(_0x182135[_0x480b10(0x2d8)]!==0x1?'s':''));if(_0x446bb7[_0x480b10(0x26a)]||_0x446bb7['jsonl'])return await handleSDKOutput(_0x182135,_0x446bb7),0x0;return displayFieldsHumanReadable(_0x182135,_0x24268c),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1ff);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x1fa);async['execute'](_0x50f6b8){const _0x3e80f4=a21_0x6e5b10,{options:_0x5d099b,args:_0x1ec199,tdx:_0x48cbb7}=_0x50f6b8,_0x549025=_0x5d099b,_0x36a713=_0x1ec199[0x0]||_0x5d099b[_0x3e80f4(0x1c5)];if(!_0x36a713)return showParentSegmentNotSetError(_0x3e80f4(0x1f5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x5d099b[_0x3e80f4(0x256)]&&(console[_0x3e80f4(0x1ee)](_0x3e80f4(0x2a3)+_0x5d099b[_0x3e80f4(0x2a1)]),console[_0x3e80f4(0x1ee)](_0x3e80f4(0x2ca)+_0x36a713));const _0x51ab22=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x36a713+_0x3e80f4(0x1da),()=>_0x48cbb7[_0x3e80f4(0x2cc)][_0x3e80f4(0x205)](_0x36a713),{'verbose':_0x5d099b['verbose']}),_0x108fcd=_0x51ab22[_0x3e80f4(0x2c2)];if(_0x549025[_0x3e80f4(0x2b9)]){const _0x843516=getConsoleNextUrl(_0x549025[_0x3e80f4(0x2a1)],_0x3e80f4(0x1ef)+_0x108fcd['id']);return console[_0x3e80f4(0x1ee)](a21_0x5051ed['green']('✔')+_0x3e80f4(0x2b8)+a21_0x5051ed['cyan'](_0x843516)),openBrowser(_0x843516),0x0;}return await handleSingleObjectOutput(_0x108fcd,_0x5d099b),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x243);['description']=a21_0x6e5b10(0x27c);async[a21_0x6e5b10(0x22b)](_0x13feb7){const _0x4ffd17=a21_0x6e5b10,{options:_0x418105,args:_0x552a12,tdx:_0x255ad0}=_0x13feb7,_0x5c9675=_0x552a12[0x0]||_0x418105[_0x4ffd17(0x1c5)];if(!_0x5c9675)return showParentSegmentNotSetError(_0x4ffd17(0x2c5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x418105['verbose']&&(console['error'](_0x4ffd17(0x2a3)+_0x418105[_0x4ffd17(0x2a1)]),console[_0x4ffd17(0x1ee)](_0x4ffd17(0x2ca)+_0x5c9675));const _0x422a7f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c9675+_0x4ffd17(0x1da),()=>_0x255ad0[_0x4ffd17(0x2cc)][_0x4ffd17(0x254)](_0x5c9675),{'verbose':_0x418105[_0x4ffd17(0x256)]}),_0x22a1d7=_0x422a7f[_0x4ffd17(0x2c2)],_0x3358c3=await withSpinner(_0x4ffd17(0x25a)+_0x5c9675+'\x27...',()=>_0x255ad0[_0x4ffd17(0x2cc)][_0x4ffd17(0x2d3)](_0x22a1d7),{'verbose':_0x418105['verbose']}),_0x135179=await executeSchemaQuery(_0x3358c3['data'],_0x255ad0,_0x418105);return await handleQueryOutput(_0x135179,_0x418105),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]='segment:parent:sql';['description']=a21_0x6e5b10(0x2c3);async['execute'](_0x179f05){const _0x493982=a21_0x6e5b10,{options:_0x4d33a4,args:_0x54cc59,tdx:_0x476c11}=_0x179f05,_0x463f33=_0x54cc59[0x0]||_0x4d33a4[_0x493982(0x1c5)];if(!_0x463f33)return showParentSegmentNotSetError(_0x493982(0x2cb)+_0x493982(0x1cc)),0x1;_0x4d33a4[_0x493982(0x256)]&&(console[_0x493982(0x1ee)](_0x493982(0x2a3)+_0x4d33a4['site']),console[_0x493982(0x1ee)]('Parent\x20segment:\x20'+_0x463f33));const _0x2ec2a3=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x463f33+_0x493982(0x1da),()=>_0x476c11['segment']['resolveParentId'](_0x463f33),{'verbose':_0x4d33a4[_0x493982(0x256)]}),_0x3d4436=_0x2ec2a3[_0x493982(0x2c2)],_0x1b95c7=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x463f33+'\x27...',()=>_0x476c11[_0x493982(0x2cc)][_0x493982(0x2d3)](_0x3d4436),{'verbose':_0x4d33a4[_0x493982(0x256)]}),_0x1dbd46=_0x1b95c7[_0x493982(0x2c2)];return _0x4d33a4[_0x493982(0x2ec)]===_0x493982(0x26a)||_0x4d33a4['format']==='jsonl'?await handleSDKOutput([{'sql':_0x1dbd46}],_0x4d33a4):console[_0x493982(0x1f6)](_0x1dbd46),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x222);['description']=a21_0x6e5b10(0x2d5);async[a21_0x6e5b10(0x22b)](_0x160c58){const _0x1c48bf=a21_0x6e5b10,{options:_0x515c8a,args:_0x19230d,tdx:_0x41de13}=_0x160c58,_0x1f3deb=_0x19230d[0x0]||_0x515c8a[_0x1c48bf(0x1c5)];if(!_0x1f3deb)return showParentSegmentNotSetError(_0x1c48bf(0x2a2)+'\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;_0x515c8a[_0x1c48bf(0x256)]&&(console[_0x1c48bf(0x1ee)](_0x1c48bf(0x2a3)+_0x515c8a[_0x1c48bf(0x2a1)]),console[_0x1c48bf(0x1ee)](_0x1c48bf(0x2ca)+_0x1f3deb));const _0x4e9a4c=await withSpinner(_0x1c48bf(0x280)+_0x1f3deb+_0x1c48bf(0x1da),()=>_0x41de13[_0x1c48bf(0x2cc)]['resolveParentId'](_0x1f3deb),{'verbose':_0x515c8a[_0x1c48bf(0x256)]}),_0x2fed40=_0x4e9a4c['data'],_0x461c1c=await withSpinner(_0x1c48bf(0x25a)+_0x1f3deb+_0x1c48bf(0x1da),()=>_0x41de13[_0x1c48bf(0x2cc)][_0x1c48bf(0x2d3)](_0x2fed40),{'verbose':_0x515c8a[_0x1c48bf(0x256)]});let _0x238872=_0x461c1c['data'];const _0x1f3617=resolveLimit(_0x515c8a[_0x1c48bf(0x20a)],DEFAULT_DISPLAY_LIMIT),_0x154191=/\bLIMIT\s+\d+/i[_0x1c48bf(0x25c)](_0x238872);!_0x154191&&(_0x238872=_0x238872['trim']()[_0x1c48bf(0x27a)](/;+$/,''),_0x238872=_0x1c48bf(0x1e0)+_0x238872+_0x1c48bf(0x1d4)+_0x1f3617);_0x515c8a[_0x1c48bf(0x256)]&&console[_0x1c48bf(0x1ee)](_0x1c48bf(0x1d5)+_0x238872);const _0x5b043c=await withProgressSpinner(_0x1c48bf(0x219),async _0x343bbc=>{const _0x3484ef=_0x1c48bf,_0x531363=await _0x41de13[_0x3484ef(0x2b1)][_0x3484ef(0x22b)](_0x238872,{'catalog':'td','schema':_0x3484ef(0x283),'onJobId':_0x469b1d=>{const _0x33f9f8=_0x3484ef;_0x343bbc[_0x33f9f8(0x28c)](_0x469b1d);}});return _0x531363;},{'verbose':_0x515c8a[_0x1c48bf(0x256)]}),_0x38322b=_0x5b043c[_0x1c48bf(0x2c2)],_0x5bdde7=_0x38322b['jobId']?_0x1c48bf(0x1e8)+_0x38322b[_0x1c48bf(0x240)]+']':'';return console[_0x1c48bf(0x1ee)](_0x1c48bf(0x21d)+_0x38322b['stats'][_0x1c48bf(0x26c)]['toLocaleString']()+_0x1c48bf(0x281)+(_0x1c48bf(0x28b)+formatElapsed(_0x38322b['stats']['elapsedTimeMillis'])+_0x5bdde7)),await handleQueryOutput(_0x38322b,_0x515c8a),0x0;}}
|
|
1
|
+
const a21_0x5571d2=a21_0x45f5;(function(_0x291425,_0x478ddf){const _0x307222=a21_0x45f5,_0x4e0a9c=_0x291425();while(!![]){try{const _0x32d827=-parseInt(_0x307222(0x296))/0x1*(-parseInt(_0x307222(0x295))/0x2)+-parseInt(_0x307222(0x22f))/0x3*(parseInt(_0x307222(0x219))/0x4)+parseInt(_0x307222(0x266))/0x5+-parseInt(_0x307222(0x25f))/0x6+parseInt(_0x307222(0x1b9))/0x7*(-parseInt(_0x307222(0x228))/0x8)+parseInt(_0x307222(0x221))/0x9+parseInt(_0x307222(0x26a))/0xa;if(_0x32d827===_0x478ddf)break;else _0x4e0a9c['push'](_0x4e0a9c['shift']());}catch(_0x15d4a3){_0x4e0a9c['push'](_0x4e0a9c['shift']());}}}(a21_0x2b5a,0x80e1a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';function a21_0x45f5(_0x37a64e,_0x448488){_0x37a64e=_0x37a64e-0x190;const _0x2b5a0d=a21_0x2b5a();let _0x45f5f8=_0x2b5a0d[_0x37a64e];return _0x45f5f8;}import{spawn}from'child_process';import a21_0x4d0cee 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';function a21_0x2b5a(){const _0x1bfb79=['attribute','session','behaviorsFile','behaviors','Error:\x20File\x20not\x20found:\x20','displayBehaviorsStats','/app/dw/parentSegments/','\x27...','Overwrite\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x0aNo\x20sample\x20data\x20available','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','test','elapsedTimeMillis','Aborted.','Master\x20+\x20Attributes','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Error:\x20Parent\x20segment\x20name\x20is\x20required','site','text','sampleData','format','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','listParents','enriched','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','using\x20the\x20default\x20path:\x20','Attributes','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','YAML\x20file:\x20','👥\x20','Options:\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27\x20is\x20already\x20up\x20to\x20date','\x20=\x20','population','rowCount','Listing\x20parent\x20segments...','dirname','Attribute:','Fetching\x20parent\x20segment\x20\x27','foreignKey','segment:parent:update','error','Source:','updateParent','execute','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','✔\x20No\x20changes\x20-\x20\x27','matchedCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20-\x20','Parent\x20segment:\x20','errors','Found\x20YAML\x20file:\x20','displayPreviewHints','segment:parent:show','column','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','joinKey','Customers:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','segment:parent:view','run','dim','\x0a⚠️\x20\x20Both\x20','displayAttributesStats','displaySummary','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x0aNew\x20parent\x20segment\x20\x27','yellow','win32','\x20--interval\x20','segment','utf-8','9457BiVSiE','setJobId','\x0a✔\x20Workflow\x20started','verbose','label','displayMasterInfo','status','/attempt/','No\x20parent\x20segments\x20match\x20pattern:\x20','Table:\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','segment:parent:run','table','trim','segment:parent:pull','Show\x20parent\x20segment\x20details','\x0aChanges\x20to\x20\x27','Options:','pullParentYaml','schemaError','darwin','✔\x20Found\x20','Database:\x20','\x20--attribute\x20\x22<name>\x22','allValid','localeCompare','customerPercent','SELECT\x20*\x20FROM\x20(\x0a','Show\x20parent\x20segment\x20schema\x20(column\x20types)','scheduleOption','behavior','✔\x20Created\x20parent\x20segment\x20\x27','\x20No\x20changes\x20-\x20','/\x20directory.\x0a','replace','displayValidateResults','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--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20--enriched','/\x20directories\x20exist.','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Site:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x27\x20and\x20run\x20workflow?','Created','timezone','Behavior:','information_schema','Error\x20parsing\x20YAML:\x20','\x0a⚠️\x20\x20Migrating:\x20','log','map','Options\x20(one\x20required):\x0a','Validate:','Apply\x20changes\x20to\x20\x27','output','Fetching\x20current\x20configuration\x20for\x20\x27','addBehaviors','parent_segments','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','resolveParentId','message','\x0aChanges\x20to\x20apply\x20to\x20\x27','Coverage:','Columns:','limit','SQL\x20query:\x0a','scheduleType','Master\x20Table','length','toLocaleString','\x20tdx\x20wf\x20attempt\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','`\x20to\x20download\x20the\x20configuration\x20first','Enriched:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','workflowSessionId','✘\x20Failed\x20to\x20rename\x20directory:\x20','in\x20','Rows:','jsonl','json','getParentFull','parentSegment','No\x20parent\x20segments\x20found','repeat','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','database','platform','number','Join\x20on:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','displayPreviewResults','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','schemaValid','.yaml','12fYiQrQ','interval','\x27\x20is\x20up\x20to\x20date','segment:parent:sql','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','/\x20→\x20','double','green','9384453gjPqMn','Updated','toFixed','Error\x20reading\x20file:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','data','stop','4600vcgqSr','open','customersWithEvents','To\x20cancel:','processedRows','yes','To\x20view\x20sample\x20data:','952005nCwuph','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Master:','\x20--attribute\x20\x22','\x20rows)','isDirectory','endsWith','\x20Configuration\x20is\x20valid','listFields','\x20is\x20already\x20up\x20to\x20date','Analyzing\x20changes...','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20parent\x20segment\x20\x27','workflowId','addAttributesFile','Preview:','preview','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','-1d','segment:parent:preview','totalEvents','Creating','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','parent_segment','filter','getParentSQL','List\x20parent\x20segments','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','name','columns','coveragePercent','Events:','\x20--behavior\x20\x22','previewParentYaml','.yml','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Resolving\x20parent\x20segment\x20\x27','attributesFile','Error:\x20--database\x20and\x20--table\x20are\x20required','/app/workflows/','%)\x20','Behaviors','✔\x20Updated\x20parent\x20segment\x20\x27','5880132VUDkIl','displayColumns','Creating\x20parent\x20segment\x20\x27','description','master','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','all','706270wzmvfW','start','\x5c$&','apply','18032970BpRxRi','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','displaySampleData','addBehaviorsFile','jobId','red','Available\x20behaviors:','string','✔\x20Query\x20completed:\x20Processed\x20','\x20rows\x20','\x20\x20No\x20sample\x20data\x20available','\x20field','Fetching\x20SQL\x20for\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','segment:parent:validate','Audience\x20ID:','Error:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','cyan','tdx\x20segment\x20parent\x20preview\x20','\x20Opening\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','pushParentYaml','Session:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','customerGroup','Updating','join','sort','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Updating\x20parent\x20segment\x20\x27','\x20parent\x20segment','Join:','Status:','workflowAttemptId','stats','attributes','FINISHED','bold','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','validateParentYaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','249482nflkwC','2WNIsRD','varchar'];a21_0x2b5a=function(){return _0x1bfb79;};return a21_0x2b5a();}import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x4bc0c2 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=a21_0x5571d2(0x1f3),LEGACY_PARENT_SEGMENT_DIR=a21_0x5571d2(0x247);function openBrowser(_0x168aa){const _0x7a9ce2=a21_0x5571d2,_0x13d52c=process[_0x7a9ce2(0x211)],_0x514a69=_0x13d52c===_0x7a9ce2(0x1cd)?_0x7a9ce2(0x229):_0x13d52c===_0x7a9ce2(0x1b5)?_0x7a9ce2(0x267):'xdg-open';spawn(_0x514a69,[_0x168aa],{'detached':!![],'stdio':'ignore'})['unref']();}function migrateLegacyDirectory(){const _0x368bfc=a21_0x5571d2;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4925f3=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4925f3[_0x368bfc(0x234)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x368bfc(0x199)](a21_0x4bc0c2['yellow'](_0x368bfc(0x1af)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x368bfc(0x1e0))),console[_0x368bfc(0x199)](a21_0x4bc0c2[_0x368bfc(0x1ae)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x368bfc(0x1da))),![];console[_0x368bfc(0x199)](a21_0x4bc0c2[_0x368bfc(0x1b4)](_0x368bfc(0x1ea)+LEGACY_PARENT_SEGMENT_DIR+_0x368bfc(0x21e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x368bfc(0x199)](a21_0x4bc0c2['green']('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x563a6b){const _0x687f02=_0x563a6b instanceof Error?_0x563a6b[_0x368bfc(0x1f6)]:String(_0x563a6b);return console[_0x368bfc(0x199)](a21_0x4bc0c2[_0x368bfc(0x26f)](_0x368bfc(0x206)+_0x687f02+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x5571d2(0x1ad)](_0x1d5d00){const _0x50039c=a21_0x5571d2;return migrateLegacyDirectory(),super[_0x50039c(0x1ad)](_0x1d5d00);}}function resolveYamlFile(_0x59d671){const _0x275033=a21_0x5571d2;if(_0x59d671[_0x275033(0x235)](_0x275033(0x253))||_0x59d671[_0x275033(0x235)](_0x275033(0x218)))return _0x59d671;return a21_0x4d0cee['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x59d671)+_0x275033(0x253));}function formatProgressMessage(_0x352220){const _0x69f967=a21_0x5571d2,_0x308399=_0x352220['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x308399){const [,_0xb25921,_0x105c0b,_0x554c27='']=_0x308399;return a21_0x4bc0c2['dim'](_0xb25921+':')+'\x20'+_0x105c0b+a21_0x4bc0c2[_0x69f967(0x1ae)](_0x554c27);}return a21_0x4bc0c2['dim'](_0x352220);}function showFileNotFoundError(_0x1298b2,_0x5112ba){const _0x59bc77=a21_0x5571d2;console[_0x59bc77(0x199)](a21_0x4bc0c2[_0x59bc77(0x26f)](_0x59bc77(0x29c)+_0x1298b2+'\x0a')),console['error'](a21_0x4bc0c2['cyan'](_0x59bc77(0x20f)+_0x5112ba+_0x59bc77(0x202)));}function showParentSegmentNotSetError(_0x2455c7){const _0xb92217=a21_0x5571d2;console[_0xb92217(0x199)](a21_0x4bc0c2[_0xb92217(0x1b4)](_0xb92217(0x2a3))),console[_0xb92217(0x199)](_0x2455c7);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x5571d2(0x24d)]='segment:parent:list';[a21_0x5571d2(0x262)]=a21_0x5571d2(0x24a);async[a21_0x5571d2(0x19c)](_0x47542a){const _0x405d3a=a21_0x5571d2,{options:_0x532132,args:_0x90f338,tdx:_0x95ea13}=_0x47542a,_0x3d4c5a=_0x90f338[0x0];_0x532132[_0x405d3a(0x1bc)]&&(console[_0x405d3a(0x199)](_0x405d3a(0x1e2)+_0x532132['site']),_0x3d4c5a&&console[_0x405d3a(0x199)]('Pattern:\x20'+_0x3d4c5a));const _0x4a8826=await withSpinner(_0x3d4c5a?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x3d4c5a+_0x405d3a(0x29f):_0x405d3a(0x193),()=>_0x95ea13[_0x405d3a(0x1b7)][_0x405d3a(0x2af)](),{'verbose':_0x532132['verbose']});let _0x1c91b5=_0x4a8826[_0x405d3a(0x226)];if(_0x3d4c5a){const _0x3abdde=_0x3d4c5a[_0x405d3a(0x1db)](/[.+^${}()|[\]\\]/g,_0x405d3a(0x268))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x25a639=new RegExp('^'+_0x3abdde+'$','i');_0x1c91b5=_0x1c91b5[_0x405d3a(0x248)](_0x188f75=>_0x25a639[_0x405d3a(0x2a4)](_0x188f75[_0x405d3a(0x28f)][_0x405d3a(0x24d)]));}_0x1c91b5[_0x405d3a(0x287)]((_0x116f98,_0x5c36c0)=>_0x116f98['attributes'][_0x405d3a(0x24d)][_0x405d3a(0x1d2)](_0x5c36c0['attributes']['name'])),console[_0x405d3a(0x199)](_0x405d3a(0x1ce)+_0x1c91b5[_0x405d3a(0x1fe)]+_0x405d3a(0x28a)+(_0x1c91b5['length']!==0x1?'s':''));const _0x56ecb9=_0xfa1b90=>{const _0x52966c=_0x405d3a;return getConsoleNextUrl(_0x532132[_0x52966c(0x2aa)],_0x52966c(0x29e)+_0xfa1b90);};if(_0x532132[_0x405d3a(0x2ad)]===_0x405d3a(0x20a)||_0x532132['format']===_0x405d3a(0x209)){const _0x4c7b54=_0x1c91b5[_0x405d3a(0x1ec)](_0x559a59=>({..._0x559a59,'url':_0x56ecb9(_0x559a59['id'])}));await handleSDKOutput(_0x4c7b54,_0x532132);}else{if(_0x1c91b5['length']===0x0)_0x3d4c5a?console[_0x405d3a(0x1eb)](_0x405d3a(0x1c1)+_0x3d4c5a):console[_0x405d3a(0x1eb)](_0x405d3a(0x20d));else for(const _0x991c38 of _0x1c91b5){const _0x294eaa=_0x991c38['attributes'][_0x405d3a(0x191)]?a21_0x4bc0c2[_0x405d3a(0x1ae)]('\x20('+formatRows(_0x991c38[_0x405d3a(0x28f)][_0x405d3a(0x191)])+')'):'',_0x55b236=hyperlink(_0x991c38[_0x405d3a(0x28f)][_0x405d3a(0x24d)],_0x56ecb9(_0x991c38['id']));console[_0x405d3a(0x1eb)](_0x405d3a(0x2b6)+_0x55b236+_0x294eaa);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']='segment:parent:create';[a21_0x5571d2(0x262)]=a21_0x5571d2(0x2a8);async['execute'](_0x47b6cc){const _0xb44bee=a21_0x5571d2,{options:_0x418df3,args:_0x20a927,tdx:_0x1abecd}=_0x47b6cc;console[_0xb44bee(0x199)](_0xb44bee(0x214)+_0xb44bee(0x24c)+_0xb44bee(0x277));const _0x13ff1c=_0x418df3;if(_0x20a927[_0xb44bee(0x1fe)]===0x0)return console[_0xb44bee(0x199)](a21_0x4bc0c2[_0xb44bee(0x26f)](_0xb44bee(0x2a9))),console['error'](_0xb44bee(0x1e3)),0x1;const _0x33b496=_0x20a927[0x0];if(!_0x13ff1c[_0xb44bee(0x210)]||!_0x13ff1c[_0xb44bee(0x1c5)])return console[_0xb44bee(0x199)](_0xb44bee(0x25a)),console[_0xb44bee(0x199)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x13ff1c['verbose']&&(console['error'](_0xb44bee(0x1e2)+_0x13ff1c['site']),console[_0xb44bee(0x199)]('Name:\x20'+_0x33b496),console[_0xb44bee(0x199)](_0xb44bee(0x1cf)+_0x13ff1c[_0xb44bee(0x210)]),console[_0xb44bee(0x199)](_0xb44bee(0x1c2)+_0x13ff1c[_0xb44bee(0x1c5)]));const _0x462561=await loadJSONFromOptions(_0x13ff1c[_0xb44bee(0x28f)],_0x13ff1c[_0xb44bee(0x259)]),_0x194588=await loadJSONFromOptions(_0x13ff1c[_0xb44bee(0x29b)],_0x13ff1c[_0xb44bee(0x29a)]),_0x1dee00=await loadJSONFromOptions(_0x13ff1c[_0xb44bee(0x284)],_0x13ff1c['customerGroupFile']),_0x795bf2={'name':_0x33b496,'description':_0x13ff1c['description'],'scheduleType':_0x13ff1c['scheduleType'],'scheduleOption':_0x13ff1c[_0xb44bee(0x1d6)],'timezone':_0x13ff1c[_0xb44bee(0x1e6)],'master':{'parentDatabaseName':_0x13ff1c[_0xb44bee(0x210)],'parentTableName':_0x13ff1c[_0xb44bee(0x1c5)]},'attributes':_0x462561,'behaviors':_0x194588,'customerGroup':_0x1dee00},_0x511c7c=await withSpinner(_0xb44bee(0x261)+_0x33b496+_0xb44bee(0x29f),()=>_0x1abecd[_0xb44bee(0x1b7)]['createParent'](_0x795bf2),{'verbose':_0x418df3[_0xb44bee(0x1bc)]}),_0x4fa274=_0x511c7c[_0xb44bee(0x226)];return console[_0xb44bee(0x199)](_0xb44bee(0x1d8)+_0x4fa274[_0xb44bee(0x24d)]+'\x27\x20with\x20ID:\x20'+_0x4fa274['id']),await handleSDKOutput([_0x4fa274],_0x418df3),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a21_0x5571d2(0x198);[a21_0x5571d2(0x262)]=a21_0x5571d2(0x2b8);async['execute'](_0x4c7c1d){const _0x246bd7=a21_0x5571d2,{options:_0xff09ca,args:_0x3f4b57,tdx:_0x805f80}=_0x4c7c1d;console['error'](_0x246bd7(0x257)+_0x246bd7(0x24c)+_0x246bd7(0x277));const _0x42fb38=_0xff09ca;if(_0x3f4b57[_0x246bd7(0x1fe)]===0x0)return console[_0x246bd7(0x199)](a21_0x4bc0c2['red'](_0x246bd7(0x2a9))),console[_0x246bd7(0x199)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0xfc667e=_0x3f4b57[0x0];_0x42fb38['verbose']&&(console[_0x246bd7(0x199)](_0x246bd7(0x1e2)+_0x42fb38['site']),console[_0x246bd7(0x199)](_0x246bd7(0x1a2)+_0xfc667e));const _0x223f57=await withSpinner(_0x246bd7(0x1f1)+_0xfc667e+'\x27...',()=>_0x805f80['segment'][_0x246bd7(0x20b)](_0xfc667e),{'verbose':_0x42fb38[_0x246bd7(0x1bc)]}),_0x38a8c4=_0x223f57['data'],_0x58118f=await loadJSONFromOptions(_0x42fb38['addAttributes'],_0x42fb38[_0x246bd7(0x23d)]),_0x3cca9f=await loadJSONFromOptions(_0x42fb38[_0x246bd7(0x1f2)],_0x42fb38[_0x246bd7(0x26d)]),_0xa7e6d={'name':_0x38a8c4[_0x246bd7(0x24d)],'description':_0x42fb38['description']!==undefined?_0x42fb38[_0x246bd7(0x262)]:_0x38a8c4[_0x246bd7(0x262)],'scheduleType':_0x42fb38[_0x246bd7(0x1fc)]!==undefined?_0x42fb38[_0x246bd7(0x1fc)]:_0x38a8c4[_0x246bd7(0x1fc)],'scheduleOption':_0x42fb38[_0x246bd7(0x1d6)]!==undefined?_0x42fb38[_0x246bd7(0x1d6)]:_0x38a8c4[_0x246bd7(0x1d6)],'timezone':_0x42fb38[_0x246bd7(0x1e6)]!==undefined?_0x42fb38[_0x246bd7(0x1e6)]:_0x38a8c4[_0x246bd7(0x1e6)],'master':_0x38a8c4[_0x246bd7(0x263)],'attributes':_0x58118f?[..._0x38a8c4[_0x246bd7(0x28f)]||[],..._0x58118f]:_0x38a8c4['attributes'],'behaviors':_0x3cca9f?[..._0x38a8c4[_0x246bd7(0x29b)]||[],..._0x3cca9f]:_0x38a8c4['behaviors'],'customerGroup':_0x38a8c4[_0x246bd7(0x284)]},_0x117bdf=await withSpinner(_0x246bd7(0x289)+_0xfc667e+_0x246bd7(0x29f),()=>_0x805f80[_0x246bd7(0x1b7)][_0x246bd7(0x19b)](_0xfc667e,_0xa7e6d),{'verbose':_0x42fb38['verbose']}),_0x292ef4=_0x117bdf['data'];return console[_0x246bd7(0x199)](_0x246bd7(0x25e)+_0x292ef4[_0x246bd7(0x24d)]+'\x27'),await handleSDKOutput([_0x292ef4],_0x42fb38),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a21_0x5571d2(0x1c7);[a21_0x5571d2(0x262)]=a21_0x5571d2(0x1f4);async[a21_0x5571d2(0x19c)](_0x4a8035){const _0x36aed3=a21_0x5571d2,{options:_0x157a47,args:_0x2f644e,tdx:_0x2d8589}=_0x4a8035,_0x15998e=_0x157a47,_0x33f692=_0x2f644e[0x0]||_0x157a47[_0x36aed3(0x20c)];if(!_0x33f692)return showParentSegmentNotSetError(_0x36aed3(0x216)+_0x36aed3(0x294)),0x1;if(_0x15998e['use']&&_0x15998e[_0x36aed3(0x1f0)])return console[_0x36aed3(0x199)](a21_0x4bc0c2[_0x36aed3(0x26f)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x36aed3(0x199)](a21_0x4bc0c2[_0x36aed3(0x1ae)](_0x36aed3(0x27c))),console['error'](a21_0x4bc0c2[_0x36aed3(0x1ae)](_0x36aed3(0x2b2)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a21_0x4bc0c2['cyan'](_0x36aed3(0x2ae))),0x1;const _0x40de97=_0x15998e[_0x36aed3(0x1f0)]||a21_0x4d0cee[_0x36aed3(0x286)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x33f692)+_0x36aed3(0x253));_0x15998e[_0x36aed3(0x1bc)]&&(console[_0x36aed3(0x199)](_0x36aed3(0x1e2)+_0x15998e[_0x36aed3(0x2aa)]),console[_0x36aed3(0x199)](_0x36aed3(0x1a2)+_0x33f692),console[_0x36aed3(0x199)]('Output\x20file:\x20'+_0x40de97));const _0x880d52=await withSpinner(_0x36aed3(0x196)+_0x33f692+'\x27...',()=>_0x2d8589['segment'][_0x36aed3(0x1cb)](_0x33f692),{'verbose':_0x15998e['verbose']}),_0x35dedd=_0x880d52[_0x36aed3(0x226)];if(existsSync(_0x40de97)){const _0x3ca0bd=readFileSync(_0x40de97,_0x36aed3(0x1b8)),_0x5b7bd7=generateDiff(_0x3ca0bd,_0x35dedd);if(!hasChanges(_0x5b7bd7))console[_0x36aed3(0x199)](a21_0x4bc0c2[_0x36aed3(0x220)]('✔')+_0x36aed3(0x1d9)+a21_0x4bc0c2[_0x36aed3(0x27d)](_0x40de97)+_0x36aed3(0x238));else{console[_0x36aed3(0x199)](_0x36aed3(0x1c9)+_0x40de97+'\x27:'),console[_0x36aed3(0x199)]('─'['repeat'](0x3c)),console[_0x36aed3(0x199)](formatDiffWithColors(_0x5b7bd7)),console[_0x36aed3(0x199)]('─'[_0x36aed3(0x20e)](0x3c));if(!_0x15998e[_0x36aed3(0x22d)]){const _0x4a5c5a=await confirmKey(_0x36aed3(0x2a0)+_0x40de97+'\x27?');if(!_0x4a5c5a)return console[_0x36aed3(0x199)]('Aborted.'),0x1;}writeFileSync(_0x40de97,_0x35dedd,_0x36aed3(0x1b8)),console['error'](a21_0x4bc0c2['green']('✔')+_0x36aed3(0x26b)+a21_0x4bc0c2['cyan'](_0x40de97));}}else{const _0x1e14d7=a21_0x4d0cee[_0x36aed3(0x194)](_0x40de97);!existsSync(_0x1e14d7)&&mkdirSync(_0x1e14d7,{'recursive':!![]}),writeFileSync(_0x40de97,_0x35dedd,'utf-8'),console[_0x36aed3(0x199)](a21_0x4bc0c2[_0x36aed3(0x220)]('✔')+_0x36aed3(0x26b)+a21_0x4bc0c2[_0x36aed3(0x27d)](_0x40de97));}return saveSessionContext({'parent_segment':_0x33f692},_0x15998e[_0x36aed3(0x299)]),console['error'](a21_0x4bc0c2[_0x36aed3(0x220)]('✔')+'\x20Context\x20set:\x20'+a21_0x4bc0c2[_0x36aed3(0x1ae)]('parent_segment')+_0x36aed3(0x190)+a21_0x4bc0c2['cyan'](_0x33f692)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x5571d2(0x24d)]='segment:parent:push';[a21_0x5571d2(0x262)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a21_0x5571d2(0x19c)](_0xe60b2c){const _0x4b2cdd=a21_0x5571d2,{options:_0x27989a,args:_0xea9826,tdx:_0x32a130}=_0xe60b2c,_0x8c7a2c=_0x27989a,_0x27208c=_0xea9826[0x0]||_0x27989a[_0x4b2cdd(0x20c)];if(!_0x27208c)return showParentSegmentNotSetError(_0x4b2cdd(0x245)+_0x4b2cdd(0x255)),0x1;const _0x582eda=resolveYamlFile(_0x27208c);if(!existsSync(_0x582eda))return showFileNotFoundError(_0x582eda,_0x27208c),0x1;_0x8c7a2c['verbose']&&(console[_0x4b2cdd(0x199)](_0x4b2cdd(0x1e2)+_0x8c7a2c[_0x4b2cdd(0x2aa)]),console[_0x4b2cdd(0x199)]('YAML\x20file:\x20'+_0x582eda));let _0x35b4f1;try{_0x35b4f1=readFileSync(_0x582eda,_0x4b2cdd(0x1b8));}catch(_0x281fc2){const _0x3df7ba=_0x281fc2 instanceof Error?_0x281fc2[_0x4b2cdd(0x1f6)]:String(_0x281fc2);return console[_0x4b2cdd(0x199)](_0x4b2cdd(0x224)+_0x3df7ba),0x1;}const _0x2ee026=await withSpinner('Analyzing\x20changes...',()=>_0x32a130[_0x4b2cdd(0x1b7)][_0x4b2cdd(0x281)](_0x35b4f1),{'verbose':_0x8c7a2c[_0x4b2cdd(0x1bc)]}),_0x31c88c=_0x2ee026['data'],{isNew:_0x81e20c,name:_0x558517,hasChanges:_0x1fe2c6,diffFormatted:_0x5125ab}=_0x31c88c;if(!_0x1fe2c6)return console[_0x4b2cdd(0x199)](_0x4b2cdd(0x19e)+_0x558517+_0x4b2cdd(0x2b9)),0x0;_0x81e20c?console[_0x4b2cdd(0x199)](_0x4b2cdd(0x1b3)+_0x558517+'\x27:'):console[_0x4b2cdd(0x199)](_0x4b2cdd(0x1f7)+_0x558517+'\x27:');console[_0x4b2cdd(0x199)]('─'[_0x4b2cdd(0x20e)](0x3c)),console[_0x4b2cdd(0x199)](_0x5125ab),console[_0x4b2cdd(0x199)]('─'[_0x4b2cdd(0x20e)](0x3c));const _0x23c7c1=_0x81e20c?'Create\x20parent\x20segment\x20\x27'+_0x558517+'\x27?':_0x4b2cdd(0x1ef)+_0x558517+'\x27?';if(!_0x8c7a2c['yes']){const _0x504921=await confirmKey(_0x23c7c1);if(!_0x504921)return console[_0x4b2cdd(0x199)](_0x4b2cdd(0x2a6)),0x1;}const _0x1ee6fc=_0x81e20c?_0x4b2cdd(0x244):'Updating',_0x325823=await withSpinner(_0x1ee6fc+'\x20parent\x20segment\x20\x27'+_0x558517+_0x4b2cdd(0x29f),()=>_0x31c88c[_0x4b2cdd(0x269)](),{'verbose':_0x8c7a2c[_0x4b2cdd(0x1bc)]}),_0x3b2d9e=_0x325823[_0x4b2cdd(0x226)],_0x4d2a2b=getConsoleNextUrl(_0x8c7a2c[_0x4b2cdd(0x2aa)],'/app/dw/parentSegments/'+_0x3b2d9e['id']),_0x456a21=_0x81e20c?_0x4b2cdd(0x1e5):'Updated';return console[_0x4b2cdd(0x199)]('✔\x20'+_0x456a21+_0x4b2cdd(0x23b)+_0x3b2d9e['name']+'\x27'),console[_0x4b2cdd(0x199)]('\x20\x20'+_0x4d2a2b),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x5571d2(0x24d)]=a21_0x5571d2(0x279);[a21_0x5571d2(0x262)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a21_0x5571d2(0x19c)](_0x257c87){const _0x1c52fe=a21_0x5571d2,{options:_0x523aad,args:_0x4698e3,tdx:_0x15f88a}=_0x257c87,_0x58efa4=_0x523aad,_0x3dba93=_0x4698e3[0x0]||_0x523aad['parentSegment'];if(!_0x3dba93)return showParentSegmentNotSetError(_0x1c52fe(0x1dd)+_0x1c52fe(0x283)+_0x1c52fe(0x2b7)+_0x1c52fe(0x19d)+_0x1c52fe(0x21d)+_0x1c52fe(0x225)),0x1;const _0x13c3b3=resolveYamlFile(_0x3dba93);if(!existsSync(_0x13c3b3))return showFileNotFoundError(_0x13c3b3,_0x3dba93),0x1;_0x58efa4[_0x1c52fe(0x1bc)]&&(console[_0x1c52fe(0x199)]('Site:\x20'+_0x58efa4[_0x1c52fe(0x2aa)]),console[_0x1c52fe(0x199)](_0x1c52fe(0x2b5)+_0x13c3b3));let _0x3f912b;try{_0x3f912b=readFileSync(_0x13c3b3,_0x1c52fe(0x1b8));}catch(_0x102d45){const _0xe73d38=_0x102d45 instanceof Error?_0x102d45[_0x1c52fe(0x1f6)]:String(_0x102d45);return console['error'](_0x1c52fe(0x224)+_0xe73d38),0x1;}const _0x1f22c1=createCommandSpinner(a21_0x4bc0c2['dim']('Validating\x20configuration...'),{'verbose':_0x58efa4['verbose']});_0x1f22c1[_0x1c52fe(0x267)]();const _0x35a8bd={'onProgress':_0x458c7c=>{_0x1f22c1['text']=formatProgressMessage(_0x458c7c);}};if(_0x58efa4[_0x1c52fe(0x263)])_0x35a8bd[_0x1c52fe(0x263)]=!![];if(_0x58efa4[_0x1c52fe(0x2b0)])_0x35a8bd['enriched']=!![];_0x58efa4['attribute']&&(_0x35a8bd[_0x1c52fe(0x298)]=_0x58efa4[_0x1c52fe(0x298)]);_0x58efa4[_0x1c52fe(0x1d7)]&&(_0x35a8bd[_0x1c52fe(0x1d7)]=_0x58efa4[_0x1c52fe(0x1d7)]);if(_0x58efa4[_0x1c52fe(0x21a)])_0x35a8bd[_0x1c52fe(0x21a)]=_0x58efa4[_0x1c52fe(0x21a)];let _0x7524ce;try{_0x7524ce=await _0x15f88a[_0x1c52fe(0x1b7)][_0x1c52fe(0x293)](_0x3f912b,_0x35a8bd),_0x1f22c1[_0x1c52fe(0x227)]();}catch(_0x5de546){_0x1f22c1['stop']();throw _0x5de546;}const _0x5e06f4=_0x58efa4[_0x1c52fe(0x21a)]||_0x1c52fe(0x241);return this['displayValidateResults'](_0x7524ce,_0x35a8bd,_0x13c3b3,_0x5e06f4),_0x7524ce['allValid']?0x0:0x1;}[a21_0x5571d2(0x1dc)](_0x191c5f,_0x475c68,_0x5d52f1,_0x163720){const _0x9b76cd=a21_0x5571d2;console[_0x9b76cd(0x199)]('\x0a'+a21_0x4bc0c2[_0x9b76cd(0x291)](_0x9b76cd(0x1ee))+'\x20'+_0x191c5f[_0x9b76cd(0x24d)]),console[_0x9b76cd(0x199)]('═'['repeat'](0x3c)),this['displayMasterInfo'](_0x191c5f);if(typeof _0x475c68['attribute']===_0x9b76cd(0x271)){this['displayAttributesStats'](_0x191c5f),this[_0x9b76cd(0x1b1)](_0x191c5f),this[_0x9b76cd(0x1a5)](_0x5d52f1,_0x163720,_0x9b76cd(0x298),_0x475c68[_0x9b76cd(0x298)]);return;}if(_0x475c68[_0x9b76cd(0x298)]===!![]){this[_0x9b76cd(0x1b0)](_0x191c5f),this[_0x9b76cd(0x1b1)](_0x191c5f),this[_0x9b76cd(0x1a5)](_0x5d52f1,_0x163720,_0x9b76cd(0x28f));return;}if(typeof _0x475c68[_0x9b76cd(0x1d7)]==='string'){this['displayBehaviorsStats'](_0x191c5f,_0x163720),this[_0x9b76cd(0x1b1)](_0x191c5f),this[_0x9b76cd(0x1a5)](_0x5d52f1,_0x163720,_0x9b76cd(0x1d7),_0x475c68[_0x9b76cd(0x1d7)]);return;}if(_0x475c68['behavior']===!![]){this[_0x9b76cd(0x29d)](_0x191c5f,_0x163720),this[_0x9b76cd(0x1b1)](_0x191c5f),this[_0x9b76cd(0x1a5)](_0x5d52f1,_0x163720,_0x9b76cd(0x29b));return;}this[_0x9b76cd(0x1b0)](_0x191c5f),this[_0x9b76cd(0x29d)](_0x191c5f,_0x163720),this[_0x9b76cd(0x1b1)](_0x191c5f),this[_0x9b76cd(0x1a5)](_0x5d52f1,_0x163720,_0x9b76cd(0x265));}[a21_0x5571d2(0x1a5)](_0x111c43,_0x5d9050,_0x4d0e5f,_0x1d664e){const _0x47cc5b=a21_0x5571d2;console[_0x47cc5b(0x199)]('\x0a'+a21_0x4bc0c2['dim'](_0x47cc5b(0x22e)));const _0x152a94=_0x5d9050!==_0x47cc5b(0x241)?_0x47cc5b(0x1b6)+_0x5d9050:'';if(_0x4d0e5f==='attribute'&&_0x1d664e)console[_0x47cc5b(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x47cc5b(0x1ae)]('tdx\x20segment\x20parent\x20preview\x20'+_0x111c43+'\x20--attribute\x20\x22'+_0x1d664e+'\x22'+_0x152a94));else{if(_0x4d0e5f===_0x47cc5b(0x1d7)&&_0x1d664e)console[_0x47cc5b(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x47cc5b(0x1ae)](_0x47cc5b(0x27e)+_0x111c43+_0x47cc5b(0x251)+_0x1d664e+'\x22'+_0x152a94));else(_0x4d0e5f===_0x47cc5b(0x28f)||_0x4d0e5f==='all')&&console[_0x47cc5b(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x47cc5b(0x1ae)](_0x47cc5b(0x27e)+_0x111c43+_0x47cc5b(0x1d0)+_0x152a94));}(_0x4d0e5f===_0x47cc5b(0x29b)||_0x4d0e5f===_0x47cc5b(0x265))&&console['error']('\x20\x20'+a21_0x4bc0c2[_0x47cc5b(0x1ae)](_0x47cc5b(0x27e)+_0x111c43+'\x20--behavior\x20\x22<name>\x22'+_0x152a94)),_0x4d0e5f===_0x47cc5b(0x265)&&console[_0x47cc5b(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x47cc5b(0x1ae)](_0x47cc5b(0x27e)+_0x111c43+_0x47cc5b(0x1df)+_0x152a94));}[a21_0x5571d2(0x1be)](_0xa97f03){const _0x115500=a21_0x5571d2,{master:_0x7d89f}=_0xa97f03,_0x118dca=_0x7d89f['schemaValid']?a21_0x4bc0c2[_0x115500(0x220)]('✔'):a21_0x4bc0c2[_0x115500(0x26f)]('✘');console[_0x115500(0x199)]('\x0a'+a21_0x4bc0c2[_0x115500(0x1ae)](_0x115500(0x1fd))),console[_0x115500(0x199)](_0x118dca+'\x20'+a21_0x4bc0c2[_0x115500(0x291)](_0x7d89f['database']+'.'+_0x7d89f['table'])),_0x7d89f[_0x115500(0x217)]?_0x7d89f['rowCount']!==undefined&&console[_0x115500(0x199)]('\x20\x20'+a21_0x4bc0c2['dim'](_0x115500(0x208))+'\x20'+a21_0x4bc0c2[_0x115500(0x27d)](formatRows(_0x7d89f[_0x115500(0x192)]))):console[_0x115500(0x199)]('\x20\x20'+a21_0x4bc0c2['red'](_0x115500(0x27b))+'\x20'+_0x7d89f['schemaError']);}[a21_0x5571d2(0x1b0)](_0x4e7f58){const _0x464cb3=a21_0x5571d2;if(_0x4e7f58[_0x464cb3(0x28f)]['length']===0x0)return;console[_0x464cb3(0x199)]('\x0a'+a21_0x4bc0c2[_0x464cb3(0x1ae)](_0x464cb3(0x2b3)));for(const _0xec5bb1 of _0x4e7f58[_0x464cb3(0x28f)]){const _0xbf1b03=_0xec5bb1[_0x464cb3(0x217)]?a21_0x4bc0c2[_0x464cb3(0x220)]('✔'):a21_0x4bc0c2['red']('✘');let _0x2d4da3='';if(_0xec5bb1['schemaValid']&&_0xec5bb1[_0x464cb3(0x19f)]!==undefined&&_0xec5bb1[_0x464cb3(0x24f)]!==undefined){const _0x443114=_0xec5bb1[_0x464cb3(0x24f)]['toFixed'](0x1),_0x3d0077=_0xec5bb1[_0x464cb3(0x24f)]>=0x50?a21_0x4bc0c2[_0x464cb3(0x220)]:_0xec5bb1[_0x464cb3(0x24f)]>=0x32?a21_0x4bc0c2[_0x464cb3(0x1b4)]:a21_0x4bc0c2[_0x464cb3(0x26f)];_0x2d4da3='\x20'+a21_0x4bc0c2['dim'](_0x464cb3(0x1f8))+'\x20'+_0x3d0077(_0x443114+'%')+'\x20('+formatRows(_0xec5bb1['matchedCount'])+_0x464cb3(0x233);}console[_0x464cb3(0x199)](_0xbf1b03+'\x20'+a21_0x4bc0c2['bold'](_0xec5bb1[_0x464cb3(0x24d)])+_0x2d4da3),console[_0x464cb3(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x464cb3(0x1ae)](_0x464cb3(0x19a))+'\x20'+a21_0x4bc0c2[_0x464cb3(0x291)](_0xec5bb1[_0x464cb3(0x210)]+'.'+_0xec5bb1[_0x464cb3(0x1c5)]));const _0x1f204f=_0xec5bb1[_0x464cb3(0x1a9)]===_0xec5bb1[_0x464cb3(0x197)]?a21_0x4bc0c2[_0x464cb3(0x1ae)](_0x464cb3(0x213))+'\x20'+_0xec5bb1[_0x464cb3(0x1a9)]:a21_0x4bc0c2[_0x464cb3(0x1ae)]('Join:')+'\x20'+_0xec5bb1['joinKey']+'\x20=\x20'+_0xec5bb1[_0x464cb3(0x197)];console[_0x464cb3(0x199)]('\x20\x20'+_0x1f204f),console[_0x464cb3(0x199)]('\x20\x20'+a21_0x4bc0c2['dim'](_0x464cb3(0x1f9))),this[_0x464cb3(0x260)](_0xec5bb1[_0x464cb3(0x24e)]),!_0xec5bb1[_0x464cb3(0x217)]&&console[_0x464cb3(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x464cb3(0x26f)]('Error:')+'\x20'+_0xec5bb1['schemaError']);}}[a21_0x5571d2(0x29d)](_0x2ec6a9,_0x26aaf9){const _0x2dbff1=a21_0x5571d2;if(_0x2ec6a9[_0x2dbff1(0x29b)][_0x2dbff1(0x1fe)]===0x0)return;console[_0x2dbff1(0x199)]('\x0a'+a21_0x4bc0c2['dim'](_0x2dbff1(0x25d))+'\x20'+a21_0x4bc0c2[_0x2dbff1(0x1ae)]('('+_0x26aaf9+')'));for(const _0x3f9bc9 of _0x2ec6a9['behaviors']){const _0x36c966=_0x3f9bc9[_0x2dbff1(0x217)]?a21_0x4bc0c2['green']('✔'):a21_0x4bc0c2[_0x2dbff1(0x26f)]('✘');let _0x312c5a='';if(_0x3f9bc9['schemaValid']&&_0x3f9bc9[_0x2dbff1(0x22a)]!==undefined&&_0x3f9bc9[_0x2dbff1(0x243)]!==undefined){const _0x3ac32a=_0x3f9bc9['customerPercent']?.[_0x2dbff1(0x223)](0x1)||'?',_0x1bc4df=(_0x3f9bc9[_0x2dbff1(0x1d3)]??0x0)>=0x32?a21_0x4bc0c2[_0x2dbff1(0x220)]:(_0x3f9bc9[_0x2dbff1(0x1d3)]??0x0)>=0x14?a21_0x4bc0c2[_0x2dbff1(0x1b4)]:a21_0x4bc0c2[_0x2dbff1(0x26f)];_0x312c5a='\x20'+a21_0x4bc0c2[_0x2dbff1(0x1ae)](_0x2dbff1(0x1aa))+'\x20'+_0x1bc4df(formatRows(_0x3f9bc9['customersWithEvents']))+'\x20('+_0x3ac32a+_0x2dbff1(0x25c)+a21_0x4bc0c2[_0x2dbff1(0x1ae)](_0x2dbff1(0x250))+'\x20'+a21_0x4bc0c2[_0x2dbff1(0x27d)](formatRows(_0x3f9bc9[_0x2dbff1(0x243)]));}console[_0x2dbff1(0x199)](_0x36c966+'\x20'+a21_0x4bc0c2[_0x2dbff1(0x291)](_0x3f9bc9[_0x2dbff1(0x24d)])+_0x312c5a),console['error']('\x20\x20'+a21_0x4bc0c2['dim'](_0x2dbff1(0x19a))+'\x20'+a21_0x4bc0c2[_0x2dbff1(0x291)](_0x3f9bc9['database']+'.'+_0x3f9bc9['table']));const _0x5ac382=_0x3f9bc9[_0x2dbff1(0x1a9)]===_0x3f9bc9[_0x2dbff1(0x197)]?a21_0x4bc0c2[_0x2dbff1(0x1ae)](_0x2dbff1(0x213))+'\x20'+_0x3f9bc9[_0x2dbff1(0x1a9)]:a21_0x4bc0c2[_0x2dbff1(0x1ae)](_0x2dbff1(0x28b))+'\x20'+_0x3f9bc9[_0x2dbff1(0x1a9)]+_0x2dbff1(0x190)+_0x3f9bc9[_0x2dbff1(0x197)];console['error']('\x20\x20'+_0x5ac382),console[_0x2dbff1(0x199)]('\x20\x20'+a21_0x4bc0c2['dim']('Columns:')),this[_0x2dbff1(0x260)](_0x3f9bc9[_0x2dbff1(0x24e)]),!_0x3f9bc9[_0x2dbff1(0x217)]&&console[_0x2dbff1(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x2dbff1(0x26f)](_0x2dbff1(0x27b))+'\x20'+_0x3f9bc9[_0x2dbff1(0x1cc)]);}}[a21_0x5571d2(0x260)](_0x1eb65a){const _0x28bcf5=a21_0x5571d2;for(const _0x121237 of _0x1eb65a){_0x121237[_0x28bcf5(0x1bd)]===_0x121237['column']||_0x121237[_0x28bcf5(0x1a7)]==='*'?console[_0x28bcf5(0x199)](_0x28bcf5(0x1a1)+_0x121237[_0x28bcf5(0x1bd)]):console[_0x28bcf5(0x199)](_0x28bcf5(0x1a1)+_0x121237[_0x28bcf5(0x1bd)]+'\x20'+a21_0x4bc0c2[_0x28bcf5(0x1ae)]('('+_0x121237[_0x28bcf5(0x1a7)]+')'));}}['displaySummary'](_0x167986){const _0x31929f=a21_0x5571d2;console[_0x31929f(0x199)]('─'['repeat'](0x3c));if(_0x167986['errors'][_0x31929f(0x1fe)]>0x0){console[_0x31929f(0x199)]('\x0a'+a21_0x4bc0c2[_0x31929f(0x26f)]('Errors:'));for(const _0x166c77 of _0x167986[_0x31929f(0x1a3)]){console[_0x31929f(0x199)]('\x20\x20'+a21_0x4bc0c2['red']('•')+'\x20'+_0x166c77);}}_0x167986[_0x31929f(0x1d1)]&&console[_0x31929f(0x199)]('\x0a'+a21_0x4bc0c2['green']('✔')+_0x31929f(0x236));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x5571d2(0x24d)]=a21_0x5571d2(0x242);[a21_0x5571d2(0x262)]=a21_0x5571d2(0x1c3);async[a21_0x5571d2(0x19c)](_0x41eada){const _0x89a6e0=a21_0x5571d2,{options:_0x338fdc,args:_0x12dcdd,tdx:_0x401ba0}=_0x41eada,_0x51b879=_0x338fdc,_0x9784b2=_0x12dcdd[0x0]||_0x338fdc[_0x89a6e0(0x20c)];if(!_0x9784b2)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x89a6e0(0x1a0)+_0x89a6e0(0x1ed)+_0x89a6e0(0x1de)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x89a6e0(0x2b4)+_0x89a6e0(0x2b1)+_0x89a6e0(0x225)),0x1;if(!_0x51b879['master']&&!_0x51b879[_0x89a6e0(0x298)]&&!_0x51b879[_0x89a6e0(0x1d7)]&&!_0x51b879['enriched'])return console['error'](a21_0x4bc0c2[_0x89a6e0(0x26f)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x89a6e0(0x199)](_0x89a6e0(0x278)),console[_0x89a6e0(0x199)](_0x89a6e0(0x1ca)),console['error'](_0x89a6e0(0x264)),console[_0x89a6e0(0x199)](_0x89a6e0(0x246)),console['error']('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x89a6e0(0x199)](_0x89a6e0(0x1a8)),0x1;const _0xe2a1aa=resolveYamlFile(_0x9784b2);if(!existsSync(_0xe2a1aa))return showFileNotFoundError(_0xe2a1aa,_0x9784b2),0x1;_0x51b879[_0x89a6e0(0x1bc)]&&(console[_0x89a6e0(0x199)](_0x89a6e0(0x1e2)+_0x51b879['site']),console[_0x89a6e0(0x199)]('YAML\x20file:\x20'+_0xe2a1aa));let _0x5024a7;try{_0x5024a7=readFileSync(_0xe2a1aa,_0x89a6e0(0x1b8));}catch(_0x24053b){const _0x2d8ba7=_0x24053b instanceof Error?_0x24053b['message']:String(_0x24053b);return console['error']('Error\x20reading\x20file:\x20'+_0x2d8ba7),0x1;}let _0x3f9917;try{_0x3f9917=parseDef(_0x5024a7);}catch(_0x466050){const _0x39459e=_0x466050 instanceof Error?_0x466050[_0x89a6e0(0x1f6)]:String(_0x466050);return console[_0x89a6e0(0x199)](a21_0x4bc0c2[_0x89a6e0(0x26f)](_0x89a6e0(0x1e9)+_0x39459e)),0x1;}if(_0x51b879[_0x89a6e0(0x298)]===!![]||_0x51b879[_0x89a6e0(0x298)]===''){const _0x49124c=_0x3f9917[_0x89a6e0(0x28f)]?.[_0x89a6e0(0x1ec)](_0xc97c98=>_0xc97c98['name'])||[];if(_0x49124c[_0x89a6e0(0x1fe)]===0x0)console['error'](a21_0x4bc0c2[_0x89a6e0(0x26f)](_0x89a6e0(0x230)));else{console[_0x89a6e0(0x199)](a21_0x4bc0c2['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error']('Available\x20attributes:');for(const _0x54c363 of _0x49124c){console['error']('\x20\x20'+a21_0x4bc0c2[_0x89a6e0(0x27d)](_0x54c363));}console[_0x89a6e0(0x199)](_0x89a6e0(0x256)+_0x9784b2+_0x89a6e0(0x232)+_0x49124c[0x0]+'\x22');}return 0x1;}if(_0x51b879[_0x89a6e0(0x1d7)]===!![]||_0x51b879['behavior']===''){const _0x1693f0=_0x3f9917['behaviors']?.[_0x89a6e0(0x1ec)](_0x480b6c=>_0x480b6c[_0x89a6e0(0x24d)])||[];if(_0x1693f0[_0x89a6e0(0x1fe)]===0x0)console[_0x89a6e0(0x199)](a21_0x4bc0c2[_0x89a6e0(0x26f)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x89a6e0(0x199)](a21_0x4bc0c2[_0x89a6e0(0x26f)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x89a6e0(0x199)](_0x89a6e0(0x270));for(const _0x2d332b of _0x1693f0){console[_0x89a6e0(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x89a6e0(0x27d)](_0x2d332b));}console[_0x89a6e0(0x199)](_0x89a6e0(0x256)+_0x9784b2+_0x89a6e0(0x251)+_0x1693f0[0x0]+'\x22');}return 0x1;}const _0x10dad5=createCommandSpinner(a21_0x4bc0c2[_0x89a6e0(0x1ae)]('Fetching\x20sample\x20data...'),{'verbose':_0x51b879[_0x89a6e0(0x1bc)]});_0x10dad5[_0x89a6e0(0x267)]();const _0xbc81f9={'onProgress':_0x3d68b5=>{const _0x228d8c=_0x89a6e0;_0x10dad5[_0x228d8c(0x2ab)]=formatProgressMessage(_0x3d68b5);}};if(_0x51b879[_0x89a6e0(0x263)])_0xbc81f9[_0x89a6e0(0x263)]=!![];if(_0x51b879[_0x89a6e0(0x298)]&&typeof _0x51b879['attribute']===_0x89a6e0(0x271))_0xbc81f9['attribute']=_0x51b879[_0x89a6e0(0x298)];if(_0x51b879[_0x89a6e0(0x1d7)]&&typeof _0x51b879[_0x89a6e0(0x1d7)]===_0x89a6e0(0x271))_0xbc81f9['behavior']=_0x51b879['behavior'];if(_0x51b879[_0x89a6e0(0x2b0)])_0xbc81f9['enriched']=!![];if(_0x51b879[_0x89a6e0(0x21a)])_0xbc81f9[_0x89a6e0(0x21a)]=_0x51b879[_0x89a6e0(0x21a)];let _0x25405d;try{_0x25405d=await _0x401ba0[_0x89a6e0(0x1b7)][_0x89a6e0(0x252)](_0x5024a7,_0xbc81f9),_0x10dad5[_0x89a6e0(0x227)]();}catch(_0x586862){_0x10dad5['stop']();throw _0x586862;}return await this[_0x89a6e0(0x215)](_0x25405d,{'master':_0x51b879[_0x89a6e0(0x263)],'attribute':typeof _0x51b879[_0x89a6e0(0x298)]===_0x89a6e0(0x271)?_0x51b879[_0x89a6e0(0x298)]:undefined,'behavior':typeof _0x51b879[_0x89a6e0(0x1d7)]===_0x89a6e0(0x271)?_0x51b879['behavior']:undefined,'enriched':_0x51b879['enriched']}),_0x25405d[_0x89a6e0(0x1d1)]?0x0:0x1;}async[a21_0x5571d2(0x215)](_0x5c3b3b,_0x4e01ed){const _0x19eaa1=a21_0x5571d2;console['error']('\x0a'+a21_0x4bc0c2[_0x19eaa1(0x291)](_0x19eaa1(0x23e))+'\x20'+_0x5c3b3b[_0x19eaa1(0x24d)]),console[_0x19eaa1(0x199)]('═'[_0x19eaa1(0x20e)](0x3c));if(_0x4e01ed[_0x19eaa1(0x263)]&&_0x5c3b3b[_0x19eaa1(0x2ac)]){const _0x25645d=a21_0x4bc0c2[_0x19eaa1(0x1ae)](_0x19eaa1(0x231))+'\x20'+a21_0x4bc0c2[_0x19eaa1(0x291)](_0x5c3b3b[_0x19eaa1(0x263)][_0x19eaa1(0x210)]+'.'+_0x5c3b3b['master'][_0x19eaa1(0x1c5)]);await this[_0x19eaa1(0x26c)](_0x25645d,_0x5c3b3b[_0x19eaa1(0x2ac)]);}else{if(_0x4e01ed[_0x19eaa1(0x298)]&&_0x5c3b3b['sampleData']){const _0x388cd6=a21_0x4bc0c2['dim'](_0x19eaa1(0x195))+'\x20'+a21_0x4bc0c2[_0x19eaa1(0x291)](_0x4e01ed[_0x19eaa1(0x298)]);await this[_0x19eaa1(0x26c)](_0x388cd6,_0x5c3b3b['sampleData']);}else{if(_0x4e01ed[_0x19eaa1(0x1d7)]&&_0x5c3b3b[_0x19eaa1(0x2ac)]){const _0x23946b=a21_0x4bc0c2[_0x19eaa1(0x1ae)](_0x19eaa1(0x1e7))+'\x20'+a21_0x4bc0c2['bold'](_0x4e01ed[_0x19eaa1(0x1d7)]);await this['displaySampleData'](_0x23946b,_0x5c3b3b[_0x19eaa1(0x2ac)]);}else{if(_0x4e01ed[_0x19eaa1(0x2b0)]&&_0x5c3b3b[_0x19eaa1(0x2ac)]){const _0x1a4dd6=a21_0x4bc0c2['dim'](_0x19eaa1(0x203))+'\x20'+a21_0x4bc0c2['bold'](_0x19eaa1(0x2a7));await this[_0x19eaa1(0x26c)](_0x1a4dd6,_0x5c3b3b[_0x19eaa1(0x2ac)]);}else!_0x5c3b3b[_0x19eaa1(0x2ac)]&&console['error'](_0x19eaa1(0x2a2));}}}if(_0x5c3b3b[_0x19eaa1(0x1a3)][_0x19eaa1(0x1fe)]>0x0){console['error']('─'[_0x19eaa1(0x20e)](0x3c)),console['error']('\x0a'+a21_0x4bc0c2[_0x19eaa1(0x26f)]('Errors:'));for(const _0x5cb013 of _0x5c3b3b['errors']){console[_0x19eaa1(0x199)]('\x20\x20'+a21_0x4bc0c2['red']('•')+'\x20'+_0x5cb013);}}}async[a21_0x5571d2(0x26c)](_0x5db659,_0x4049a0){const _0x398af0=a21_0x5571d2;if(_0x4049a0['length']===0x0){console['error']('\x0a'+_0x5db659),console[_0x398af0(0x199)](_0x398af0(0x274));return;}console[_0x398af0(0x199)]('\x0a'+_0x5db659);const _0x5500f4=Object['keys'](_0x4049a0[0x0])[_0x398af0(0x1ec)](_0x32ccef=>({'name':_0x32ccef,'type':typeof _0x4049a0[0x0][_0x32ccef]===_0x398af0(0x212)?_0x398af0(0x21f):_0x398af0(0x297)})),_0x22a648={'queryId':_0x398af0(0x23f),'columns':_0x5500f4,'data':_0x4049a0,'stats':{'state':_0x398af0(0x290),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4049a0['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5b4aae=formatAsTable(_0x22a648,_0x4049a0[_0x398af0(0x1fe)],!![]);await writeOutput(_0x5b4aae,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x5571d2(0x24d)]=a21_0x5571d2(0x1c4);['description']=a21_0x5571d2(0x1e1);async[a21_0x5571d2(0x19c)](_0x4fb423){const _0x35cf58=a21_0x5571d2,{options:_0x1d721d,args:_0x164ba7,tdx:_0x344db6}=_0x4fb423,_0x1665cd=_0x1d721d,_0x39d95f=_0x164ba7[0x0]||_0x1d721d[_0x35cf58(0x20c)];if(!_0x39d95f)return showParentSegmentNotSetError(_0x35cf58(0x288)+_0x35cf58(0x24b)),0x1;const _0x29d341=resolveYamlFile(_0x39d95f);if(existsSync(_0x29d341)){_0x1665cd[_0x35cf58(0x1bc)]&&console[_0x35cf58(0x199)](_0x35cf58(0x1a4)+_0x29d341);let _0x2a5058;try{_0x2a5058=readFileSync(_0x29d341,'utf-8');}catch(_0xf90176){const _0x6897ae=_0xf90176 instanceof Error?_0xf90176[_0x35cf58(0x1f6)]:String(_0xf90176);return console[_0x35cf58(0x199)](_0x35cf58(0x224)+_0x6897ae),0x1;}const _0x4721f1=await withSpinner(_0x35cf58(0x239),()=>_0x344db6[_0x35cf58(0x1b7)][_0x35cf58(0x281)](_0x2a5058),{'verbose':_0x1665cd['verbose']}),_0x5c45ad=_0x4721f1[_0x35cf58(0x226)],{isNew:_0x4f93cb,name:_0x49492f,hasChanges:_0x2d3313,diffFormatted:_0x3743fd}=_0x5c45ad;if(_0x2d3313){_0x4f93cb?console[_0x35cf58(0x199)](_0x35cf58(0x1b3)+_0x49492f+'\x27:'):console[_0x35cf58(0x199)](_0x35cf58(0x1f7)+_0x49492f+'\x27:');console['error']('─'[_0x35cf58(0x20e)](0x3c)),console[_0x35cf58(0x199)](_0x3743fd),console[_0x35cf58(0x199)]('─'['repeat'](0x3c));const _0x3d12ab=_0x4f93cb?'Create\x20parent\x20segment\x20\x27'+_0x49492f+'\x27\x20and\x20run\x20workflow?':_0x35cf58(0x1ef)+_0x49492f+_0x35cf58(0x1e4);if(!_0x1665cd[_0x35cf58(0x22d)]){const _0x42075c=await confirmKey(_0x3d12ab);if(!_0x42075c)return console[_0x35cf58(0x199)](_0x35cf58(0x2a6)),0x1;}const _0x4aa076=_0x4f93cb?_0x35cf58(0x244):_0x35cf58(0x285);await withSpinner(_0x4aa076+_0x35cf58(0x23b)+_0x49492f+_0x35cf58(0x29f),()=>_0x5c45ad[_0x35cf58(0x269)](),{'verbose':_0x1665cd[_0x35cf58(0x1bc)]});const _0x334fdf=_0x4f93cb?'Created':_0x35cf58(0x222);console[_0x35cf58(0x199)]('✔\x20'+_0x334fdf+_0x35cf58(0x23b)+_0x49492f+'\x27');}else console[_0x35cf58(0x199)](_0x35cf58(0x19e)+_0x49492f+_0x35cf58(0x21b));}const _0x3ac63b=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x39d95f+_0x35cf58(0x29f),()=>_0x344db6[_0x35cf58(0x1b7)]['runParent'](_0x39d95f),{'verbose':_0x1665cd[_0x35cf58(0x1bc)]}),_0x4cc588=_0x3ac63b[_0x35cf58(0x226)],_0x22a9f9=getConsoleUrl(_0x1665cd['site'],_0x35cf58(0x25b)+_0x4cc588[_0x35cf58(0x23c)]+'/sessions/'+_0x4cc588['workflowSessionId']+_0x35cf58(0x1c0)+_0x4cc588[_0x35cf58(0x28d)]);return console['error'](_0x35cf58(0x1bb)),console[_0x35cf58(0x199)]('\x20\x20'+a21_0x4bc0c2['dim'](_0x35cf58(0x27a))+'\x20'+_0x4cc588['audienceId']),console[_0x35cf58(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x35cf58(0x1ae)](_0x35cf58(0x28c))+'\x20'+_0x4cc588[_0x35cf58(0x1bf)]),console[_0x35cf58(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x35cf58(0x1ae)](_0x35cf58(0x282))+'\x20'+_0x4cc588[_0x35cf58(0x205)]),console[_0x35cf58(0x199)]('\x20\x20'+a21_0x4bc0c2[_0x35cf58(0x1ae)]('Attempt:')+'\x20'+_0x4cc588[_0x35cf58(0x28d)]),console['error']('\x20\x20'+_0x22a9f9),console['error']('\x0a'+a21_0x4bc0c2[_0x35cf58(0x1ae)](_0x35cf58(0x22b))+_0x35cf58(0x200)+_0x4cc588[_0x35cf58(0x28d)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a21_0x5571d2(0x262)]='List\x20available\x20fields\x20for\x20segmentation';async[a21_0x5571d2(0x19c)](_0x385755){const _0x335621=a21_0x5571d2,{options:_0x16f124,args:_0xe79b9e,tdx:_0xd05ea1}=_0x385755,_0x23be91=_0xe79b9e[0x0]||_0x16f124['parentSegment'];if(!_0x23be91)return showParentSegmentNotSetError(_0x335621(0x240)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x16f124[_0x335621(0x1bc)]&&(console[_0x335621(0x199)](_0x335621(0x1e2)+_0x16f124[_0x335621(0x2aa)]),console['error'](_0x335621(0x1a2)+_0x23be91));const _0x11650e=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x23be91+_0x335621(0x29f),()=>_0xd05ea1[_0x335621(0x1b7)][_0x335621(0x237)](_0x23be91),{'verbose':_0x16f124[_0x335621(0x1bc)]}),_0x492b8c=_0x11650e[_0x335621(0x226)];console[_0x335621(0x199)]('✔\x20Found\x20'+_0x492b8c[_0x335621(0x1fe)]+_0x335621(0x275)+(_0x492b8c[_0x335621(0x1fe)]!==0x1?'s':''));if(_0x16f124[_0x335621(0x20a)]||_0x16f124[_0x335621(0x209)])return await handleSDKOutput(_0x492b8c,_0x16f124),0x0;return displayFieldsHumanReadable(_0x492b8c,_0x23be91),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x5571d2(0x24d)]=a21_0x5571d2(0x1ac);[a21_0x5571d2(0x262)]=a21_0x5571d2(0x1c8);async[a21_0x5571d2(0x19c)](_0x45fe33){const _0x4ca686=a21_0x5571d2,{options:_0x11403b,args:_0x50a83a,tdx:_0x95b49c}=_0x45fe33,_0x521bd6=_0x11403b,_0x3d9b03=_0x50a83a[0x0]||_0x11403b['parentSegment'];if(!_0x3d9b03)return showParentSegmentNotSetError(_0x4ca686(0x280)+_0x4ca686(0x2a1)+_0x4ca686(0x2b7)+_0x4ca686(0x23a)),0x1;_0x11403b[_0x4ca686(0x1bc)]&&(console[_0x4ca686(0x199)](_0x4ca686(0x1e2)+_0x11403b['site']),console['error'](_0x4ca686(0x1a2)+_0x3d9b03));const _0x44d592=await withSpinner(_0x4ca686(0x196)+_0x3d9b03+_0x4ca686(0x29f),()=>_0x95b49c[_0x4ca686(0x1b7)][_0x4ca686(0x20b)](_0x3d9b03),{'verbose':_0x11403b[_0x4ca686(0x1bc)]}),_0x395781=_0x44d592[_0x4ca686(0x226)];if(_0x521bd6['web']){const _0x308ee7=getConsoleNextUrl(_0x521bd6[_0x4ca686(0x2aa)],_0x4ca686(0x29e)+_0x395781['id']);return console[_0x4ca686(0x199)](a21_0x4bc0c2[_0x4ca686(0x220)]('✔')+_0x4ca686(0x27f)+a21_0x4bc0c2[_0x4ca686(0x27d)](_0x308ee7)),openBrowser(_0x308ee7),0x0;}return await handleSingleObjectOutput(_0x395781,_0x11403b),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x5571d2(0x24d)]='segment:parent:desc';[a21_0x5571d2(0x262)]=a21_0x5571d2(0x1d5);async[a21_0x5571d2(0x19c)](_0x1bab51){const _0x84e601=a21_0x5571d2,{options:_0x39b933,args:_0x3f951c,tdx:_0x56cd75}=_0x1bab51,_0x808c17=_0x3f951c[0x0]||_0x39b933[_0x84e601(0x20c)];if(!_0x808c17)return showParentSegmentNotSetError(_0x84e601(0x254)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x39b933[_0x84e601(0x1bc)]&&(console[_0x84e601(0x199)](_0x84e601(0x1e2)+_0x39b933['site']),console['error'](_0x84e601(0x1a2)+_0x808c17));const _0x189ddc=await withSpinner(_0x84e601(0x258)+_0x808c17+_0x84e601(0x29f),()=>_0x56cd75[_0x84e601(0x1b7)][_0x84e601(0x1f5)](_0x808c17),{'verbose':_0x39b933[_0x84e601(0x1bc)]}),_0x139a90=_0x189ddc[_0x84e601(0x226)],_0x2cad71=await withSpinner(_0x84e601(0x276)+_0x808c17+'\x27...',()=>_0x56cd75[_0x84e601(0x1b7)][_0x84e601(0x249)](_0x139a90),{'verbose':_0x39b933[_0x84e601(0x1bc)]}),_0x59440=await executeSchemaQuery(_0x2cad71[_0x84e601(0x226)],_0x56cd75,_0x39b933);return await handleQueryOutput(_0x59440,_0x39b933),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x5571d2(0x24d)]=a21_0x5571d2(0x21c);[a21_0x5571d2(0x262)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a21_0x5571d2(0x19c)](_0x491fc3){const _0xd01bce=a21_0x5571d2,{options:_0xf2b4f0,args:_0x16e0f2,tdx:_0x3b428f}=_0x491fc3,_0x577951=_0x16e0f2[0x0]||_0xf2b4f0[_0xd01bce(0x20c)];if(!_0x577951)return showParentSegmentNotSetError(_0xd01bce(0x292)+_0xd01bce(0x201)),0x1;_0xf2b4f0['verbose']&&(console[_0xd01bce(0x199)](_0xd01bce(0x1e2)+_0xf2b4f0[_0xd01bce(0x2aa)]),console[_0xd01bce(0x199)](_0xd01bce(0x1a2)+_0x577951));const _0x5b55ca=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x577951+'\x27...',()=>_0x3b428f['segment'][_0xd01bce(0x1f5)](_0x577951),{'verbose':_0xf2b4f0['verbose']}),_0x257775=_0x5b55ca[_0xd01bce(0x226)],_0x2e2342=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x577951+_0xd01bce(0x29f),()=>_0x3b428f[_0xd01bce(0x1b7)][_0xd01bce(0x249)](_0x257775),{'verbose':_0xf2b4f0[_0xd01bce(0x1bc)]}),_0x3143bc=_0x2e2342['data'];return _0xf2b4f0[_0xd01bce(0x2ad)]===_0xd01bce(0x20a)||_0xf2b4f0['format']==='jsonl'?await handleSDKOutput([{'sql':_0x3143bc}],_0xf2b4f0):console[_0xd01bce(0x1eb)](_0x3143bc),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a21_0x5571d2(0x1a6);[a21_0x5571d2(0x262)]=a21_0x5571d2(0x204);async[a21_0x5571d2(0x19c)](_0x1b197d){const _0x256772=a21_0x5571d2,{options:_0x177a6b,args:_0x49f9ca,tdx:_0x49acf6}=_0x1b197d,_0x46b3d6=_0x49f9ca[0x0]||_0x177a6b[_0x256772(0x20c)];if(!_0x46b3d6)return showParentSegmentNotSetError(_0x256772(0x1ab)+'\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;_0x177a6b['verbose']&&(console[_0x256772(0x199)](_0x256772(0x1e2)+_0x177a6b[_0x256772(0x2aa)]),console[_0x256772(0x199)]('Parent\x20segment:\x20'+_0x46b3d6));const _0x357f88=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x46b3d6+_0x256772(0x29f),()=>_0x49acf6['segment'][_0x256772(0x1f5)](_0x46b3d6),{'verbose':_0x177a6b[_0x256772(0x1bc)]}),_0x303a01=_0x357f88[_0x256772(0x226)],_0x5b4fe2=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x46b3d6+'\x27...',()=>_0x49acf6['segment'][_0x256772(0x249)](_0x303a01),{'verbose':_0x177a6b[_0x256772(0x1bc)]});let _0xfa664a=_0x5b4fe2[_0x256772(0x226)];const _0x38bdb4=resolveLimit(_0x177a6b[_0x256772(0x1fa)],DEFAULT_DISPLAY_LIMIT),_0x123521=/\bLIMIT\s+\d+/i['test'](_0xfa664a);!_0x123521&&(_0xfa664a=_0xfa664a[_0x256772(0x1c6)]()[_0x256772(0x1db)](/;+$/,''),_0xfa664a=_0x256772(0x1d4)+_0xfa664a+_0x256772(0x1b2)+_0x38bdb4);_0x177a6b[_0x256772(0x1bc)]&&console[_0x256772(0x199)](_0x256772(0x1fb)+_0xfa664a);const _0x52fd37=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x5499af=>{const _0x3c0fbd=_0x256772,_0x392a0d=await _0x49acf6['query'][_0x3c0fbd(0x19c)](_0xfa664a,{'catalog':'td','schema':_0x3c0fbd(0x1e8),'onJobId':_0x5d47af=>{const _0x4200a5=_0x3c0fbd;_0x5499af[_0x4200a5(0x1ba)](_0x5d47af);}});return _0x392a0d;},{'verbose':_0x177a6b[_0x256772(0x1bc)]}),_0x202a5b=_0x52fd37[_0x256772(0x226)],_0x2ead8e=_0x202a5b[_0x256772(0x26e)]?'\x20[Job\x20ID:\x20'+_0x202a5b[_0x256772(0x26e)]+']':'';return console[_0x256772(0x199)](_0x256772(0x272)+_0x202a5b[_0x256772(0x28e)][_0x256772(0x22c)][_0x256772(0x1ff)]()+_0x256772(0x273)+(_0x256772(0x207)+formatElapsed(_0x202a5b[_0x256772(0x28e)][_0x256772(0x2a5)])+_0x2ead8e)),await handleQueryOutput(_0x202a5b,_0x177a6b),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a22_0x38b1(_0xb06f24,_0x59e7db){_0xb06f24=_0xb06f24-0x19a;const _0x185252=a22_0x1852();let _0x38b1ba=_0x185252[_0xb06f24];return _0x38b1ba;}const a22_0xcb5c1c=a22_0x38b1;(function(_0xcbcc61,_0x3703e9){const _0x5c3aff=a22_0x38b1,_0x4a1567=_0xcbcc61();while(!![]){try{const _0x5e269a=-parseInt(_0x5c3aff(0x1fa))/0x1+-parseInt(_0x5c3aff(0x1d7))/0x2*(-parseInt(_0x5c3aff(0x1c9))/0x3)+-parseInt(_0x5c3aff(0x20b))/0x4+parseInt(_0x5c3aff(0x19b))/0x5+-parseInt(_0x5c3aff(0x19f))/0x6*(parseInt(_0x5c3aff(0x207))/0x7)+-parseInt(_0x5c3aff(0x1c6))/0x8*(-parseInt(_0x5c3aff(0x1df))/0x9)+-parseInt(_0x5c3aff(0x1e0))/0xa*(-parseInt(_0x5c3aff(0x1b5))/0xb);if(_0x5e269a===_0x3703e9)break;else _0x4a1567['push'](_0x4a1567['shift']());}catch(_0x3ae728){_0x4a1567['push'](_0x4a1567['shift']());}}}(a22_0x1852,0xe26f5));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 a22_0x5aecbd from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a22_0x1852(){const _0x56aacc=['trim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','tdx:\x20profile\x20set','includes','Enter\x20profile\x20name:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20was\x20not\x20changed.','\x0aOperation\x20cancelled','findIndex','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','(session:\x20','jobs','green','message','apiKey','\x20API\x20key\x20saved\x20to\x20system\x20keychain','/app/mp/ak','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','text','us\x20\x20\x20-\x20United\x20States','681164wGjuxl','\x20\x20tdx\x20--profile\x20','session','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Remove\x20a\x20profile','create','profile:create','\x20\x20-\x20','jp01','getUserInfo','error','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','VALID_KEYS','224FznpRN','\x27\x20updated:\x20','✗\x20Validation\x20failed:\x20','ERROR','6777788cjVdgH','ap02\x20-\x20Korea','1408465ZGnrwQ','Unknown\x20key\x20\x27','execute','Set\x20session\x20profile','22530bzXQAU','Validating\x20API\x20key...','\x0aSaved\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','description','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','dim','\x0aAvailable\x20profiles:','profile:remove','Profile\x20\x27','yellow','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','email','site','red','profile:use','Enter\x20custom\x20site','\x20Profile\x20\x27','\x27\x20removed\x20from\x20configuration','Failed\x20to\x20remove\x20profile:\x20','length','20282999OrQPDO','Changing\x20site\x20to\x20\x27','bold','API\x20key\x20cannot\x20be\x20empty','logLevel','test','select','parent_segment','push','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','profile:set','customSite','profileName','name','join','Operation\x20cancelled','validate','24iBKjbB','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20remove','3LwsUqz','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','confirm','llm_project','status','\x27\x20created','profile','\x0aSetup\x20cancelled','\x27\x20requires\x20API\x20key\x20validation.','tdx:\x20profile\x20create','Create\x20a\x20new\x20profile','\x20\x20(no\x20profiles\x20found)','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20cannot\x20be\x20empty','1980838sBRJSu','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>','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','value','(cleared)','password','other','921681lLMpXL','10BXFFQW','us01','toString','log','Default\x20profile\x20set\x20to:\x20'];a22_0x1852=function(){return _0x56aacc;};return a22_0x1852();}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a22_0x31010f from'prompts';import a22_0x29f13 from'chalk';function validateProfileName(_0x25ac48){const _0x1113da=a22_0x38b1;if(!_0x25ac48||!_0x25ac48[_0x1113da(0x1e5)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x432ba3=_0x25ac48['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x432ba3))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x432ba3))return _0x1113da(0x1a9)+_0x432ba3+_0x1113da(0x1ee);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x200);['description']=a22_0xcb5c1c(0x1d3);async[a22_0xcb5c1c(0x19d)](_0x4bcec6){const _0x80f196=a22_0xcb5c1c,{options:_0x5b4491,args:_0xff916c}=_0x4bcec6;console[_0x80f196(0x1e3)](a22_0x29f13[_0x80f196(0x1b7)](_0x80f196(0x1d2)));let _0x8fa9c1;if(_0xff916c[_0x80f196(0x1b4)]>0x0&&_0xff916c[0x0]){const _0x1785f8=_0xff916c[0x0][_0x80f196(0x1e5)](),_0x22fc4b=validateProfileName(_0x1785f8);if(_0x22fc4b!==!![])return console['error'](a22_0x29f13['red'](_0x22fc4b)),0x1;_0x8fa9c1=_0x1785f8;}else{const _0x1a330f=await a22_0x31010f({'type':_0x80f196(0x1f8),'name':_0x80f196(0x1c1),'message':_0x80f196(0x1e9),'validate':validateProfileName});if(!_0x1a330f[_0x80f196(0x1c1)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;_0x8fa9c1=_0x1a330f[_0x80f196(0x1c1)][_0x80f196(0x1e5)]();}const _0x282f11=await a22_0x31010f({'type':'text','name':_0x80f196(0x1a3),'message':'Enter\x20description\x20(optional):'}),_0x1d4658=_0x282f11[_0x80f196(0x1a3)]?.['trim']()||undefined,_0x342bad=_0x5b4491['site']||_0x80f196(0x1e1),_0x52c078=[{'title':_0x80f196(0x1f9),'value':_0x80f196(0x1e1)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x80f196(0x202)},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':_0x80f196(0x19a),'value':'ap02'}];let _0x384685=_0x52c078[_0x80f196(0x1ed)](_0x13777a=>_0x13777a[_0x80f196(0x1db)]===_0x342bad);_0x384685===-0x1&&_0x342bad!==_0x80f196(0x1e1)&&(_0x52c078[_0x80f196(0x1bd)]({'title':_0x342bad,'value':_0x342bad}),_0x384685=_0x52c078[_0x80f196(0x1b4)]-0x1);_0x52c078[_0x80f196(0x1bd)]({'title':_0x80f196(0x1b0),'value':_0x80f196(0x1de)});const _0x4766a2=await a22_0x31010f({'type':_0x80f196(0x1bb),'name':_0x80f196(0x1ad),'message':_0x80f196(0x1be)+_0x8fa9c1+'\x27:','choices':_0x52c078,'initial':_0x384685>=0x0?_0x384685:0x0});if(!_0x4766a2[_0x80f196(0x1ad)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;let _0x77e24f;if(_0x4766a2[_0x80f196(0x1ad)]===_0x80f196(0x1de)){const _0xcd3b9e=await a22_0x31010f({'type':'text','name':_0x80f196(0x1c0),'message':'Enter\x20site\x20name:','initial':_0x80f196(0x1e1),'validate':_0x5a39af=>{const _0x382192=_0x80f196;if(!_0x5a39af||!_0x5a39af['trim']())return _0x382192(0x1d6);if(!/^[a-z0-9-]+$/[_0x382192(0x1ba)](_0x5a39af[_0x382192(0x1e5)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0xcd3b9e[_0x80f196(0x1c0)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;_0x77e24f=_0xcd3b9e[_0x80f196(0x1c0)];}else _0x77e24f=_0x4766a2[_0x80f196(0x1ad)];const _0x4d6092=resolveSite(_0x77e24f);console[_0x80f196(0x1e3)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4d6092),console[_0x80f196(0x1e3)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x4d6092,'/app/mp/ak'));const _0x3cf7a0=await a22_0x31010f({'type':_0x80f196(0x1dd),'name':_0x80f196(0x1f3),'message':_0x80f196(0x1a2),'validate':_0x1419fd=>{const _0x58167d=_0x80f196;if(!_0x1419fd||!_0x1419fd[_0x58167d(0x1e5)]())return _0x58167d(0x1b8);return!![];}});if(!_0x3cf7a0[_0x80f196(0x1f3)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;const _0x4c45c2=_0x3cf7a0[_0x80f196(0x1f3)];console[_0x80f196(0x1e3)]('Validating\x20API\x20key...');try{const _0xb07c8=TDX['create']({'site':_0x4d6092,'apiKey':_0x4c45c2[_0x80f196(0x1e5)](),'logLevel':_0x5b4491[_0x80f196(0x1b9)]??LogLevel[_0x80f196(0x20a)]}),_0x2f1f07=await _0xb07c8[_0x80f196(0x1f0)][_0x80f196(0x203)]();console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2f1f07[_0x80f196(0x1ac)]+')');const _0x284bb8=await isKeychainAvailable();_0x284bb8?(await saveAPIKeyAsync(_0x4c45c2['trim'](),_0x4d6092,_0x8fa9c1),console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+_0x80f196(0x1a5)+_0x8fa9c1+')')):(console['warn'](a22_0x29f13[_0x80f196(0x1aa)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x80f196(0x1da)](a22_0x29f13[_0x80f196(0x1aa)](_0x80f196(0x1e6))));const _0x49490c={'site':_0x4d6092,..._0x1d4658&&{'description':_0x1d4658}};return saveProfileToUserConfig(_0x8fa9c1,_0x49490c),console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+_0x80f196(0x1b1)+_0x8fa9c1+_0x80f196(0x1ce)),console['log'](),console[_0x80f196(0x1e3)](_0x80f196(0x1ab)),console['log'](_0x80f196(0x1fb)+_0x8fa9c1+_0x80f196(0x1ea)),console[_0x80f196(0x1e3)](_0x80f196(0x1fb)+_0x8fa9c1+_0x80f196(0x1c7)),0x0;}catch(_0x336744){if(_0x336744 instanceof HTTPClientError&&_0x336744[_0x80f196(0x1cd)]===0x191)return printAuthError(_0x336744),0x1;return console['error'](a22_0x29f13[_0x80f196(0x1ae)](_0x80f196(0x209)+(_0x336744 instanceof Error?_0x336744[_0x80f196(0x1f2)]:String(_0x336744)))),console[_0x80f196(0x204)](_0x80f196(0x1f6)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x1a8);[a22_0xcb5c1c(0x1a3)]=a22_0xcb5c1c(0x1fe);[a22_0xcb5c1c(0x1c5)](_0x5494af){const _0x10847e=a22_0xcb5c1c,{args:_0x329d0e}=_0x5494af;if(_0x329d0e[_0x10847e(0x1b4)]===0x0)return _0x10847e(0x1d5);return undefined;}async[a22_0xcb5c1c(0x19d)](_0x48d9f1){const _0x25df46=a22_0xcb5c1c,{args:_0x4e36a6}=_0x48d9f1,_0x2d8493=_0x4e36a6[0x0];console['log'](a22_0x29f13['bold'](_0x25df46(0x1c8)));if(!profileExists(_0x2d8493)){console[_0x25df46(0x204)](a22_0x29f13[_0x25df46(0x1ae)](_0x25df46(0x1a9)+_0x2d8493+'\x27\x20does\x20not\x20exist.')),console[_0x25df46(0x1e3)]('\x0aAvailable\x20profiles:');const _0x2ba02b=listProfiles();if(_0x2ba02b[_0x25df46(0x1b4)]===0x0)console[_0x25df46(0x1e3)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x25d1bb of _0x2ba02b){console['log'](_0x25df46(0x201)+_0x25d1bb['name']);}return 0x1;}const _0x34c41f=await a22_0x31010f({'type':_0x25df46(0x1cb),'name':'confirm','message':_0x25df46(0x205)+_0x2d8493+'\x27?','initial':![]});if(!_0x34c41f[_0x25df46(0x1cb)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2d8493),console['log'](a22_0x29f13[_0x25df46(0x1f1)]('✓')+_0x25df46(0x1b1)+_0x2d8493+_0x25df46(0x1b2));}catch(_0x59baa9){return console[_0x25df46(0x204)](a22_0x29f13[_0x25df46(0x1ae)](_0x25df46(0x1b3)+(_0x59baa9 instanceof Error?_0x59baa9[_0x25df46(0x1f2)]:String(_0x59baa9)))),0x1;}const _0x286a70=await isKeychainAvailable();if(_0x286a70){const _0xf6d167=await deleteKeychainAPIKey(_0x2d8493);_0xf6d167&&console[_0x25df46(0x1e3)](a22_0x29f13[_0x25df46(0x1f1)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a22_0xcb5c1c(0x1bf);[a22_0xcb5c1c(0x1a3)]='Set\x20a\x20profile\x20configuration\x20value';static [a22_0xcb5c1c(0x206)]=[a22_0xcb5c1c(0x1ad),'database',a22_0xcb5c1c(0x1bc),a22_0xcb5c1c(0x1cc),'llm_agent',a22_0xcb5c1c(0x1a3)];[a22_0xcb5c1c(0x1c5)](_0x5624d1){const _0x40bf56=a22_0xcb5c1c,{args:_0x5ce7d7,options:_0x1c613c}=_0x5624d1,_0x3199aa=_0x1c613c[_0x40bf56(0x1cf)]||getActiveProfile();if(!_0x3199aa)return _0x40bf56(0x1d8);if(_0x5ce7d7[_0x40bf56(0x1b4)]===0x0)return _0x40bf56(0x1d9)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x4f2b4d=_0x5ce7d7[0x0];if(!_0x4f2b4d['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x40bf56(0x206)]['join'](',\x20');const [_0x43a714]=_0x4f2b4d['split']('=',0x2);if(!ProfileSetCommand[_0x40bf56(0x206)][_0x40bf56(0x1e8)](_0x43a714))return _0x40bf56(0x19c)+_0x43a714+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x40bf56(0x206)][_0x40bf56(0x1c3)](',\x20');return undefined;}async[a22_0xcb5c1c(0x19d)](_0xca9761){const _0x586fc6=a22_0xcb5c1c,{args:_0x258116,options:_0x11c64f}=_0xca9761,_0x13969a=_0x11c64f[_0x586fc6(0x1cf)]||getActiveProfile(),[_0xfa2372,..._0x291d9b]=_0x258116[0x0]['split']('='),_0x4cd965=_0x291d9b[_0x586fc6(0x1c3)]('=');console['log'](a22_0x29f13['bold'](_0x586fc6(0x1e7)));if(!profileExists(_0x13969a)){const _0x180419=await a22_0x31010f({'type':_0x586fc6(0x1cb),'name':'create','message':_0x586fc6(0x1a9)+_0x13969a+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x180419[_0x586fc6(0x1ff)])return console[_0x586fc6(0x1e3)](_0x586fc6(0x1c4)),0x1;}const _0x3ce146=loadProfile(_0x13969a),_0x14e5b3=_0x3ce146?.['config']||{};if(_0xfa2372===_0x586fc6(0x1ad)){const _0x14e7a9=resolveSite(_0x4cd965);console['log'](_0x586fc6(0x1b6)+_0x14e7a9+_0x586fc6(0x1d1)),console[_0x586fc6(0x1e3)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x14e7a9,_0x586fc6(0x1f5)));const _0x2bcce9=await a22_0x31010f({'type':_0x586fc6(0x1dd),'name':_0x586fc6(0x1f3),'message':_0x586fc6(0x1a4),'validate':_0x4906f0=>{const _0x3c3113=_0x586fc6;if(!_0x4906f0||!_0x4906f0[_0x3c3113(0x1e5)]())return _0x3c3113(0x1b8);return!![];}});if(!_0x2bcce9[_0x586fc6(0x1f3)])return console[_0x586fc6(0x1e3)](_0x586fc6(0x1ec)),0x1;console['log'](_0x586fc6(0x1a0));try{const _0x34ad14=TDX[_0x586fc6(0x1ff)]({'site':_0x14e7a9,'apiKey':_0x2bcce9[_0x586fc6(0x1f3)][_0x586fc6(0x1e5)](),'logLevel':_0x11c64f[_0x586fc6(0x1b9)]??LogLevel[_0x586fc6(0x20a)]}),_0x5a4514=await _0x34ad14['jobs']['getUserInfo']();console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5a4514[_0x586fc6(0x1ac)]+')');const _0x4d804a=await isKeychainAvailable();_0x4d804a?(await saveAPIKeyAsync(_0x2bcce9[_0x586fc6(0x1f3)][_0x586fc6(0x1e5)](),_0x14e7a9,_0x13969a),console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+_0x586fc6(0x1f4))):console[_0x586fc6(0x1da)](a22_0x29f13[_0x586fc6(0x1aa)](_0x586fc6(0x1fd))),_0x14e5b3['site']=_0x14e7a9;}catch(_0x3ae367){if(_0x3ae367 instanceof HTTPClientError&&_0x3ae367[_0x586fc6(0x1cd)]===0x191)return printAuthError(_0x3ae367),0x1;return console[_0x586fc6(0x204)](a22_0x29f13[_0x586fc6(0x1ae)](_0x586fc6(0x209)+(_0x3ae367 instanceof Error?_0x3ae367['message']:String(_0x3ae367)))),console[_0x586fc6(0x204)](_0x586fc6(0x1eb)),0x1;}}else _0x14e5b3[_0xfa2372]=_0x4cd965||undefined;return saveProfileToUserConfig(_0x13969a,_0x14e5b3),console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+_0x586fc6(0x1b1)+_0x13969a+_0x586fc6(0x208)+_0xfa2372+'='+(_0x4cd965||_0x586fc6(0x1dc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x1af);[a22_0xcb5c1c(0x1a3)]=a22_0xcb5c1c(0x19e);[a22_0xcb5c1c(0x1c5)](_0x4c01e6){const _0xed9425=a22_0xcb5c1c,{args:_0x34acef}=_0x4c01e6;if(_0x34acef['length']===0x0)return _0xed9425(0x1f7);return undefined;}async[a22_0xcb5c1c(0x19d)](_0x89b56c){const _0x454027=a22_0xcb5c1c,{args:_0x233df4,options:_0x405ad0}=_0x89b56c,_0x2e103a=_0x233df4[0x0],_0x2c49c3=_0x405ad0['default'];cleanExpiredSessions();if(!profileExists(_0x2e103a)){console[_0x454027(0x204)](a22_0x29f13[_0x454027(0x1ae)](_0x454027(0x1a9)+_0x2e103a+'\x27\x20does\x20not\x20exist.')),console[_0x454027(0x1e3)](_0x454027(0x1a7));const _0x439209=listProfiles();if(_0x439209[_0x454027(0x1b4)]===0x0)console[_0x454027(0x1e3)](_0x454027(0x1d4));else for(const _0x511d74 of _0x439209){console[_0x454027(0x1e3)](_0x454027(0x201)+_0x511d74[_0x454027(0x1c2)]);}return 0x1;}if(_0x2c49c3){const _0x2f00d=a22_0x5aecbd[_0x454027(0x1c3)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x2e103a),console['log'](_0x454027(0x1e4)+a22_0x29f13[_0x454027(0x1f1)](_0x2e103a)),console[_0x454027(0x1e3)](a22_0x29f13[_0x454027(0x1a6)](_0x454027(0x1a1)+_0x2f00d)),0x0;}const _0x241414=_0x405ad0[_0x454027(0x1fc)]||getCurrentSessionPID()[_0x454027(0x1e2)]();return saveSessionContext({'profile':_0x2e103a},_0x405ad0[_0x454027(0x1fc)]),console[_0x454027(0x1e3)]('Session\x20profile\x20set\x20to:\x20'+a22_0x29f13[_0x454027(0x1f1)](_0x2e103a)+'\x20'+a22_0x29f13[_0x454027(0x1a6)](_0x454027(0x1ef)+_0x241414+')')),console[_0x454027(0x1e3)](a22_0x29f13['dim'](_0x454027(0x1ca)+_0x2e103a+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
1
|
+
const a22_0x356a3=a22_0x30c4;(function(_0x4d5956,_0x4c01a5){const _0x1b0650=a22_0x30c4,_0x4664e7=_0x4d5956();while(!![]){try{const _0x2f61ac=parseInt(_0x1b0650(0x187))/0x1+-parseInt(_0x1b0650(0x1af))/0x2*(-parseInt(_0x1b0650(0x1c1))/0x3)+parseInt(_0x1b0650(0x183))/0x4+-parseInt(_0x1b0650(0x168))/0x5+parseInt(_0x1b0650(0x18d))/0x6*(parseInt(_0x1b0650(0x17d))/0x7)+-parseInt(_0x1b0650(0x19e))/0x8+-parseInt(_0x1b0650(0x186))/0x9;if(_0x2f61ac===_0x4c01a5)break;else _0x4664e7['push'](_0x4664e7['shift']());}catch(_0x2c2449){_0x4664e7['push'](_0x4664e7['shift']());}}}(a22_0x682a,0xe5dc7));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 a22_0x2e3325 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a22_0x30c4(_0x3276a2,_0x107cb9){_0x3276a2=_0x3276a2-0x15e;const _0x682aad=a22_0x682a();let _0x30c45a=_0x682aad[_0x3276a2];return _0x30c45a;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a22_0x27769c from'prompts';import a22_0x5d9cd0 from'chalk';function validateProfileName(_0x4ded6f){const _0x1cec7c=a22_0x30c4;if(!_0x4ded6f||!_0x4ded6f[_0x1cec7c(0x194)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x182f87=_0x4ded6f['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x182f87))return _0x1cec7c(0x16c);if(profileExists(_0x182f87))return'Profile\x20\x27'+_0x182f87+_0x1cec7c(0x1ac);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0x356a3(0x199)]=a22_0x356a3(0x19a);[a22_0x356a3(0x1ad)]=a22_0x356a3(0x1b6);async[a22_0x356a3(0x16d)](_0x5762b3){const _0x49b946=a22_0x356a3,{options:_0x2a00d6,args:_0x3bbe67}=_0x5762b3;console[_0x49b946(0x17f)](a22_0x5d9cd0[_0x49b946(0x1cb)]('tdx:\x20profile\x20create'));let _0x3178ab;if(_0x3bbe67[_0x49b946(0x16b)]>0x0&&_0x3bbe67[0x0]){const _0x182465=_0x3bbe67[0x0][_0x49b946(0x194)](),_0x5cef49=validateProfileName(_0x182465);if(_0x5cef49!==!![])return console[_0x49b946(0x1b0)](a22_0x5d9cd0['red'](_0x5cef49)),0x1;_0x3178ab=_0x182465;}else{const _0x3e7f9d=await a22_0x27769c({'type':_0x49b946(0x1bb),'name':_0x49b946(0x1c6),'message':_0x49b946(0x17b),'validate':validateProfileName});if(!_0x3e7f9d['profileName'])return console[_0x49b946(0x17f)](_0x49b946(0x18c)),0x1;_0x3178ab=_0x3e7f9d['profileName'][_0x49b946(0x194)]();}const _0x4b16bc=await a22_0x27769c({'type':_0x49b946(0x1bb),'name':_0x49b946(0x1ad),'message':'Enter\x20description\x20(optional):'}),_0x56ca70=_0x4b16bc[_0x49b946(0x1ad)]?.[_0x49b946(0x194)]()||undefined,_0x496e56=_0x2a00d6['site']||_0x49b946(0x1b8),_0x2d0e19=[{'title':_0x49b946(0x1be),'value':_0x49b946(0x1b8)},{'title':_0x49b946(0x19b),'value':_0x49b946(0x1a1)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x49b946(0x1a4)},{'title':_0x49b946(0x174),'value':_0x49b946(0x1c0)}];let _0x5c9dc4=_0x2d0e19['findIndex'](_0x46e999=>_0x46e999[_0x49b946(0x163)]===_0x496e56);_0x5c9dc4===-0x1&&_0x496e56!==_0x49b946(0x1b8)&&(_0x2d0e19['push']({'title':_0x496e56,'value':_0x496e56}),_0x5c9dc4=_0x2d0e19[_0x49b946(0x16b)]-0x1);_0x2d0e19['push']({'title':_0x49b946(0x19d),'value':_0x49b946(0x16f)});const _0x64c638=await a22_0x27769c({'type':_0x49b946(0x197),'name':_0x49b946(0x1b7),'message':_0x49b946(0x192)+_0x3178ab+'\x27:','choices':_0x2d0e19,'initial':_0x5c9dc4>=0x0?_0x5c9dc4:0x0});if(!_0x64c638[_0x49b946(0x1b7)])return console[_0x49b946(0x17f)]('\x0aSetup\x20cancelled'),0x1;let _0x152976;if(_0x64c638[_0x49b946(0x1b7)]===_0x49b946(0x16f)){const _0x98ecaf=await a22_0x27769c({'type':_0x49b946(0x1bb),'name':_0x49b946(0x196),'message':_0x49b946(0x1b2),'initial':'us01','validate':_0x5464c4=>{const _0x4dd69c=_0x49b946;if(!_0x5464c4||!_0x5464c4[_0x4dd69c(0x194)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x5464c4['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x98ecaf[_0x49b946(0x196)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x152976=_0x98ecaf[_0x49b946(0x196)];}else _0x152976=_0x64c638[_0x49b946(0x1b7)];const _0x39eace=resolveSite(_0x152976);console[_0x49b946(0x17f)](_0x49b946(0x1ae)+_0x39eace),console['log'](_0x49b946(0x18a)),console['log']('\x20\x20'+getConsoleUrl(_0x39eace,_0x49b946(0x1c7)));const _0x4d66a7=await a22_0x27769c({'type':_0x49b946(0x182),'name':_0x49b946(0x1b3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x441d25=>{const _0x4d9eaa=_0x49b946;if(!_0x441d25||!_0x441d25[_0x4d9eaa(0x194)]())return _0x4d9eaa(0x177);return!![];}});if(!_0x4d66a7['apiKey'])return console['log'](_0x49b946(0x18c)),0x1;const _0x3a2d75=_0x4d66a7[_0x49b946(0x1b3)];console[_0x49b946(0x17f)](_0x49b946(0x1a2));try{const _0x31797a=TDX[_0x49b946(0x178)]({'site':_0x39eace,'apiKey':_0x3a2d75[_0x49b946(0x194)](),'logLevel':_0x2a00d6[_0x49b946(0x172)]??LogLevel[_0x49b946(0x1cd)]}),_0x5896e9=await _0x31797a[_0x49b946(0x1a9)][_0x49b946(0x170)]();console[_0x49b946(0x17f)](a22_0x5d9cd0[_0x49b946(0x184)]('✓')+_0x49b946(0x1bf)+_0x5896e9['email']+')');const _0x4771b3=await isKeychainAvailable();_0x4771b3?(await saveAPIKeyAsync(_0x3a2d75[_0x49b946(0x194)](),_0x39eace,_0x3178ab),console[_0x49b946(0x17f)](a22_0x5d9cd0[_0x49b946(0x184)]('✓')+_0x49b946(0x1bc)+_0x3178ab+')')):(console[_0x49b946(0x1c5)](a22_0x5d9cd0[_0x49b946(0x18f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a22_0x5d9cd0[_0x49b946(0x18f)](_0x49b946(0x179))));const _0x26bead={'site':_0x39eace,..._0x56ca70&&{'description':_0x56ca70}};return saveProfileToUserConfig(_0x3178ab,_0x26bead),console[_0x49b946(0x17f)](a22_0x5d9cd0[_0x49b946(0x184)]('✓')+'\x20Profile\x20\x27'+_0x3178ab+_0x49b946(0x1d1)),console['log'](),console[_0x49b946(0x17f)](_0x49b946(0x1bd)),console[_0x49b946(0x17f)](_0x49b946(0x1ab)+_0x3178ab+_0x49b946(0x16e)),console[_0x49b946(0x17f)](_0x49b946(0x1ab)+_0x3178ab+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x4180c0){if(_0x4180c0 instanceof HTTPClientError&&_0x4180c0[_0x49b946(0x1a0)]===0x191)return printAuthError(_0x4180c0),0x1;return console[_0x49b946(0x1b0)](a22_0x5d9cd0[_0x49b946(0x164)](_0x49b946(0x1a3)+(_0x4180c0 instanceof Error?_0x4180c0[_0x49b946(0x1c2)]:String(_0x4180c0)))),console['error'](_0x49b946(0x1a5)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0x356a3(0x199)]='profile:remove';['description']='Remove\x20a\x20profile';['validate'](_0x3dcc97){const _0x259821=a22_0x356a3,{args:_0x4cedad}=_0x3dcc97;if(_0x4cedad['length']===0x0)return _0x259821(0x17c);return undefined;}async[a22_0x356a3(0x16d)](_0x35faec){const _0x2dab9e=a22_0x356a3,{args:_0x4c4f85}=_0x35faec,_0x12ddc4=_0x4c4f85[0x0];console[_0x2dab9e(0x17f)](a22_0x5d9cd0[_0x2dab9e(0x1cb)](_0x2dab9e(0x18b)));if(!profileExists(_0x12ddc4)){console['error'](a22_0x5d9cd0[_0x2dab9e(0x164)]('Profile\x20\x27'+_0x12ddc4+_0x2dab9e(0x195))),console[_0x2dab9e(0x17f)](_0x2dab9e(0x169));const _0x2642de=listProfiles();if(_0x2642de[_0x2dab9e(0x16b)]===0x0)console[_0x2dab9e(0x17f)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x472351 of _0x2642de){console[_0x2dab9e(0x17f)](_0x2dab9e(0x166)+_0x472351['name']);}return 0x1;}const _0x1fd72d=await a22_0x27769c({'type':_0x2dab9e(0x191),'name':_0x2dab9e(0x191),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x12ddc4+'\x27?','initial':![]});if(!_0x1fd72d[_0x2dab9e(0x191)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x12ddc4),console[_0x2dab9e(0x17f)](a22_0x5d9cd0[_0x2dab9e(0x184)]('✓')+_0x2dab9e(0x1ce)+_0x12ddc4+_0x2dab9e(0x180));}catch(_0x23b5d5){return console[_0x2dab9e(0x1b0)](a22_0x5d9cd0[_0x2dab9e(0x164)](_0x2dab9e(0x1b4)+(_0x23b5d5 instanceof Error?_0x23b5d5['message']:String(_0x23b5d5)))),0x1;}const _0x64b217=await isKeychainAvailable();if(_0x64b217){const _0x4645a0=await deleteKeychainAPIKey(_0x12ddc4);_0x4645a0&&console[_0x2dab9e(0x17f)](a22_0x5d9cd0[_0x2dab9e(0x184)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x356a3(0x199)]=a22_0x356a3(0x190);[a22_0x356a3(0x1ad)]=a22_0x356a3(0x1c3);static [a22_0x356a3(0x15e)]=['site','database',a22_0x356a3(0x18e),'llm_project',a22_0x356a3(0x171),'description'];[a22_0x356a3(0x1aa)](_0x45f9b8){const _0x5a9247=a22_0x356a3,{args:_0x3551f8,options:_0x152356}=_0x45f9b8,_0x18b809=_0x152356['profile']||getActiveProfile();if(!_0x18b809)return _0x5a9247(0x193);if(_0x3551f8[_0x5a9247(0x16b)]===0x0)return _0x5a9247(0x1c9)+ProfileSetCommand[_0x5a9247(0x15e)][_0x5a9247(0x17e)](',\x20');const _0x168fce=_0x3551f8[0x0];if(!_0x168fce['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5a9247(0x15e)]['join'](',\x20');const [_0x5a77de]=_0x168fce[_0x5a9247(0x1b1)]('=',0x2);if(!ProfileSetCommand[_0x5a9247(0x15e)][_0x5a9247(0x162)](_0x5a77de))return _0x5a9247(0x1a6)+_0x5a77de+_0x5a9247(0x161)+ProfileSetCommand[_0x5a9247(0x15e)]['join'](',\x20');return undefined;}async[a22_0x356a3(0x16d)](_0x3a0512){const _0x5aa71c=a22_0x356a3,{args:_0xab9f59,options:_0x509e9d}=_0x3a0512,_0x170ca6=_0x509e9d[_0x5aa71c(0x160)]||getActiveProfile(),[_0x14f297,..._0x122213]=_0xab9f59[0x0][_0x5aa71c(0x1b1)]('='),_0x10d92e=_0x122213[_0x5aa71c(0x17e)]('=');console['log'](a22_0x5d9cd0[_0x5aa71c(0x1cb)]('tdx:\x20profile\x20set'));if(!profileExists(_0x170ca6)){const _0x1ee8f8=await a22_0x27769c({'type':_0x5aa71c(0x191),'name':_0x5aa71c(0x178),'message':_0x5aa71c(0x1cf)+_0x170ca6+_0x5aa71c(0x1b9),'initial':!![]});if(!_0x1ee8f8[_0x5aa71c(0x178)])return console['log'](_0x5aa71c(0x15f)),0x1;}const _0x3e4717=loadProfile(_0x170ca6),_0x35371f=_0x3e4717?.[_0x5aa71c(0x175)]||{};if(_0x14f297===_0x5aa71c(0x1b7)){const _0x15fa67=resolveSite(_0x10d92e);console['log']('Changing\x20site\x20to\x20\x27'+_0x15fa67+_0x5aa71c(0x1a8)),console['log'](_0x5aa71c(0x19f)),console['log']('\x20\x20'+getConsoleUrl(_0x15fa67,_0x5aa71c(0x1c7)));const _0x350b22=await a22_0x27769c({'type':_0x5aa71c(0x182),'name':_0x5aa71c(0x1b3),'message':_0x5aa71c(0x188),'validate':_0x53d4e0=>{const _0x4dc7b5=_0x5aa71c;if(!_0x53d4e0||!_0x53d4e0[_0x4dc7b5(0x194)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x350b22[_0x5aa71c(0x1b3)])return console['log'](_0x5aa71c(0x19c)),0x1;console[_0x5aa71c(0x17f)](_0x5aa71c(0x1a2));try{const _0x1a6d23=TDX['create']({'site':_0x15fa67,'apiKey':_0x350b22[_0x5aa71c(0x1b3)][_0x5aa71c(0x194)](),'logLevel':_0x509e9d[_0x5aa71c(0x172)]??LogLevel[_0x5aa71c(0x1cd)]}),_0x3b395c=await _0x1a6d23[_0x5aa71c(0x1a9)][_0x5aa71c(0x170)]();console[_0x5aa71c(0x17f)](a22_0x5d9cd0[_0x5aa71c(0x184)]('✓')+_0x5aa71c(0x1bf)+_0x3b395c[_0x5aa71c(0x1b5)]+')');const _0x15875f=await isKeychainAvailable();_0x15875f?(await saveAPIKeyAsync(_0x350b22[_0x5aa71c(0x1b3)][_0x5aa71c(0x194)](),_0x15fa67,_0x170ca6),console[_0x5aa71c(0x17f)](a22_0x5d9cd0[_0x5aa71c(0x184)]('✓')+_0x5aa71c(0x167))):console['warn'](a22_0x5d9cd0[_0x5aa71c(0x18f)](_0x5aa71c(0x1c8))),_0x35371f[_0x5aa71c(0x1b7)]=_0x15fa67;}catch(_0x353626){if(_0x353626 instanceof HTTPClientError&&_0x353626[_0x5aa71c(0x1a0)]===0x191)return printAuthError(_0x353626),0x1;return console[_0x5aa71c(0x1b0)](a22_0x5d9cd0[_0x5aa71c(0x164)](_0x5aa71c(0x1a3)+(_0x353626 instanceof Error?_0x353626[_0x5aa71c(0x1c2)]:String(_0x353626)))),console[_0x5aa71c(0x1b0)](_0x5aa71c(0x181)),0x1;}}else _0x35371f[_0x14f297]=_0x10d92e||undefined;return saveProfileToUserConfig(_0x170ca6,_0x35371f),console['log'](a22_0x5d9cd0[_0x5aa71c(0x184)]('✓')+_0x5aa71c(0x1ce)+_0x170ca6+_0x5aa71c(0x185)+_0x14f297+'='+(_0x10d92e||_0x5aa71c(0x189))),0x0;}}function a22_0x682a(){const _0x44bc4f=['status','jp01','Validating\x20API\x20key...','✗\x20Validation\x20failed:\x20','eu01','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Unknown\x20key\x20\x27','toString','\x27\x20requires\x20API\x20key\x20validation.','jobs','validate','\x20\x20tdx\x20--profile\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','description','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','250PkExFN','error','split','Enter\x20site\x20name:','apiKey','Failed\x20to\x20remove\x20profile:\x20','email','Create\x20a\x20new\x20profile','site','us01','\x27\x20does\x20not\x20exist.\x20Create\x20it?','session','text','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','us\x20\x20\x20-\x20United\x20States','\x20API\x20key\x20is\x20valid\x20(User:\x20','ap02','24090ElnEMy','message','Set\x20a\x20profile\x20configuration\x20value','tdx.json','warn','profileName','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','bold','default','ERROR','\x20Profile\x20\x27','Profile\x20\x27','dim','\x27\x20created','VALID_KEYS','Operation\x20cancelled','profile','\x27.\x0a\x0aValid\x20keys:\x20','includes','value','red','\x20\x20(no\x20profiles\x20found)','\x20\x20-\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','3431045PVEEzc','\x0aAvailable\x20profiles:','profile:use','length','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','execute','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','other','getUserInfo','llm_agent','logLevel','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','ap02\x20-\x20Korea','config','\x20--default\x27\x20to\x20save\x20permanently','API\x20key\x20cannot\x20be\x20empty','create','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Default\x20profile\x20set\x20to:\x20','Enter\x20profile\x20name:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','9240574ZObjiC','join','log','\x27\x20removed\x20from\x20configuration','Site\x20was\x20not\x20changed.','password','6219272llcxvt','green','\x27\x20updated:\x20','29459241ZUMbNO','1631293SzjlGJ','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','(cleared)','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20remove','\x0aSetup\x20cancelled','6RnSIbA','parent_segment','yellow','profile:set','confirm','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','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>','trim','\x27\x20does\x20not\x20exist.','customSite','select','(session:\x20','name','profile:create','jp\x20\x20\x20-\x20Japan','\x0aOperation\x20cancelled','Enter\x20custom\x20site','4871792ymzJFG','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'];a22_0x682a=function(){return _0x44bc4f;};return a22_0x682a();}export class ProfileUseCommand extends BaseCommand{['name']=a22_0x356a3(0x16a);[a22_0x356a3(0x1ad)]='Set\x20session\x20profile';['validate'](_0x2985b3){const _0x137ef2=a22_0x356a3,{args:_0x2fa7cf}=_0x2985b3;if(_0x2fa7cf['length']===0x0)return _0x137ef2(0x173);return undefined;}async['execute'](_0x5a747d){const _0x2dbea1=a22_0x356a3,{args:_0x18df1c,options:_0x5a61f8}=_0x5a747d,_0x5b8b63=_0x18df1c[0x0],_0x3678c9=_0x5a61f8[_0x2dbea1(0x1cc)];cleanExpiredSessions();if(!profileExists(_0x5b8b63)){console[_0x2dbea1(0x1b0)](a22_0x5d9cd0[_0x2dbea1(0x164)]('Profile\x20\x27'+_0x5b8b63+_0x2dbea1(0x195))),console[_0x2dbea1(0x17f)]('\x0aAvailable\x20profiles:');const _0x15ba7a=listProfiles();if(_0x15ba7a['length']===0x0)console[_0x2dbea1(0x17f)](_0x2dbea1(0x165));else for(const _0x707693 of _0x15ba7a){console['log'](_0x2dbea1(0x166)+_0x707693['name']);}return 0x1;}if(_0x3678c9){const _0x101522=a22_0x2e3325[_0x2dbea1(0x17e)](getConfigDir(),_0x2dbea1(0x1c4));return saveActiveProfileToUserConfig(_0x5b8b63),console[_0x2dbea1(0x17f)](_0x2dbea1(0x17a)+a22_0x5d9cd0[_0x2dbea1(0x184)](_0x5b8b63)),console[_0x2dbea1(0x17f)](a22_0x5d9cd0['dim']('\x0aSaved\x20to:\x20'+_0x101522)),0x0;}const _0x156456=_0x5a61f8[_0x2dbea1(0x1ba)]||getCurrentSessionPID()[_0x2dbea1(0x1a7)]();return saveSessionContext({'profile':_0x5b8b63},_0x5a61f8[_0x2dbea1(0x1ba)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a22_0x5d9cd0[_0x2dbea1(0x184)](_0x5b8b63)+'\x20'+a22_0x5d9cd0['dim'](_0x2dbea1(0x198)+_0x156456+')')),console[_0x2dbea1(0x17f)](a22_0x5d9cd0[_0x2dbea1(0x1d0)](_0x2dbea1(0x1ca)+_0x5b8b63+_0x2dbea1(0x176))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a23_0x20d0b0=a23_0x12d7;function a23_0x590b(){const _0x2aaff6=['log','profiles','map','610UKCDQi','6149032VuPlVv','7392ySXYKz','2834pkBvJc','description','name','List\x20all\x20available\x20profiles','2386485Lqbbil','92VpuYYV','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','Error:\x20','4AMwbli','config','length','2826dhqPKt','15257TQNXyV','\x20\x20Global:\x20~/.config/tdx/tdx.json','3451MxJrMr','message','58851jgsPVZ','440931CJwTtS','execute'];a23_0x590b=function(){return _0x2aaff6;};return a23_0x590b();}function a23_0x12d7(_0x470e66,_0x2f1676){_0x470e66=_0x470e66-0x1e3;const _0x590b65=a23_0x590b();let _0x12d761=_0x590b65[_0x470e66];return _0x12d761;}(function(_0x167ee4,_0x61acc1){const _0x273da1=a23_0x12d7,_0x499306=_0x167ee4();while(!![]){try{const _0x5490a6=parseInt(_0x273da1(0x1fa))/0x1*(parseInt(_0x273da1(0x1f5))/0x2)+-parseInt(_0x273da1(0x1ed))/0x3+-parseInt(_0x273da1(0x1e4))/0x4*(-parseInt(_0x273da1(0x1f9))/0x5)+parseInt(_0x273da1(0x1e7))/0x6*(-parseInt(_0x273da1(0x1ea))/0x7)+-parseInt(_0x273da1(0x1f3))/0x8+parseInt(_0x273da1(0x1ec))/0x9*(parseInt(_0x273da1(0x1f2))/0xa)+parseInt(_0x273da1(0x1e8))/0xb*(parseInt(_0x273da1(0x1f4))/0xc);if(_0x5490a6===_0x61acc1)break;else _0x499306['push'](_0x499306['shift']());}catch(_0x2db105){_0x499306['push'](_0x499306['shift']());}}}(a23_0x590b,0xae1a3));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0x20d0b0(0x1f7)]=a23_0x20d0b0(0x1f0);['description']=a23_0x20d0b0(0x1f8);async[a23_0x20d0b0(0x1ee)](_0x100683){const _0x24880d=a23_0x20d0b0,{options:_0x3675a0}=_0x100683;try{const _0x5210f7=listProfiles(),_0x539052=getActiveProfile();if(_0x5210f7[_0x24880d(0x1e6)]===0x0)return console[_0x24880d(0x1ef)](_0x24880d(0x1fb)),console[_0x24880d(0x1ef)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x24880d(0x1ef)](_0x24880d(0x1e9)),0x0;const _0x45818b=_0x5210f7[_0x24880d(0x1f1)](_0x146e24=>{const _0xd5c4c7=_0x24880d,_0x595fb8=_0x146e24[_0xd5c4c7(0x1f7)]===_0x539052,_0x170afb=getProfileParams(_0x146e24[_0xd5c4c7(0x1e5)]);return{'name':_0x146e24[_0xd5c4c7(0x1f7)],'active':_0x595fb8,'scope':_0x146e24['scope'],'description':_0x146e24[_0xd5c4c7(0x1e5)][_0xd5c4c7(0x1f6)]||'','params':_0x170afb};});return await handleSDKOutput(_0x45818b,_0x3675a0),0x0;}catch(_0x57c4df){return _0x57c4df instanceof Error&&console['error'](_0x24880d(0x1e3)+_0x57c4df[_0x24880d(0x1eb)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x46c598=a24_0x5640;(function(_0x15c777,_0x22be76){const _0x113255=a24_0x5640,_0x4555f6=_0x15c777();while(!![]){try{const _0x39d9a3=-parseInt(_0x113255(0x1a5))/0x1+parseInt(_0x113255(0x178))/0x2+parseInt(_0x113255(0x189))/0x3*(-parseInt(_0x113255(0x1a8))/0x4)+-parseInt(_0x113255(0x1a3))/0x5+parseInt(_0x113255(0x183))/0x6+-parseInt(_0x113255(0x196))/0x7*(-parseInt(_0x113255(0x19c))/0x8)+parseInt(_0x113255(0x1a0))/0x9;if(_0x39d9a3===_0x22be76)break;else _0x4555f6['push'](_0x4555f6['shift']());}catch(_0x5b1f48){_0x4555f6['push'](_0x4555f6['shift']());}}}(a24_0x7ed8,0x4b12e));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{[a24_0x46c598(0x192)]=a24_0x46c598(0x19b);[a24_0x46c598(0x1ab)]=a24_0x46c598(0x1a2);async[a24_0x46c598(0x17b)](_0xef0bf3){const _0x4dcc71=a24_0x46c598,{options:_0x290371,args:_0x5eb7ff,tdx:_0xbc2737}=_0xef0bf3,_0x28fa85=_0x5eb7ff[0x0],_0x47109d=_0x290371[_0x4dcc71(0x18e)];let _0x242bf0;try{if(_0x47109d)_0x242bf0=readSqlStatementsFromFile(_0x47109d);else{if(_0x28fa85==='-')_0x242bf0=await readSqlStatementsFromStdin();else{if(_0x28fa85&&isSqlFilePath(_0x28fa85))_0x242bf0=readSqlStatementsFromFile(_0x28fa85);else{if(_0x28fa85)_0x242bf0=splitSqlStatements(_0x28fa85);else throw new Error(_0x4dcc71(0x190));}}}}catch(_0x3ade0c){return console[_0x4dcc71(0x19a)](_0x4dcc71(0x180)+_0x3ade0c[_0x4dcc71(0x1a7)]),0x1;}const _0x3df7aa=_0x290371[_0x4dcc71(0x199)]||_0x4dcc71(0x185),_0x37ded7=_0x290371[_0x4dcc71(0x17d)];try{const _0x1bb8a1=[],_0x3a4ffc=!!_0x290371['output'];for(let _0x1ff416=0x0;_0x1ff416<_0x242bf0[_0x4dcc71(0x193)];_0x1ff416++){const _0x45f9c3=_0x242bf0[_0x1ff416],_0x17f953=_0x1ff416+0x1,_0x27196c=_0x242bf0['length'],_0x3cddab=_0x27196c>0x1;_0x290371[_0x4dcc71(0x17c)]&&(console[_0x4dcc71(0x19a)]('\x0a'+(_0x3cddab?_0x4dcc71(0x197)+_0x17f953+'/'+_0x27196c+':':'')),console['error'](_0x4dcc71(0x188)+_0x290371[_0x4dcc71(0x198)]),console[_0x4dcc71(0x19a)](_0x4dcc71(0x18f)+(_0x37ded7||'td')),console['error'](_0x4dcc71(0x19f)+_0x3df7aa),console[_0x4dcc71(0x19a)](_0x4dcc71(0x179)+_0x45f9c3));const _0x3f580e=_0x3cddab?_0x4dcc71(0x176)+_0x17f953+'/'+_0x27196c+_0x4dcc71(0x18a):'Executing\x20query...';try{const _0x3c9e08=await withProgressSpinner(_0x3f580e,async _0x5b067a=>{const _0x29e981=_0x4dcc71,_0x30e778=await _0xbc2737['query'][_0x29e981(0x17b)](_0x45f9c3,{'catalog':_0x37ded7,'schema':_0x3df7aa,'onJobId':_0xee6097=>{const _0x54cb36=_0x29e981;_0x5b067a[_0x54cb36(0x17e)](_0xee6097);},'onProgress':_0x316021=>{const _0x27aef2=_0x29e981;_0x5b067a['setPhase'](_0x27aef2(0x1a4)+_0x316021[_0x27aef2(0x18b)]+']'),_0x5b067a[_0x27aef2(0x191)](formatRows(_0x316021[_0x27aef2(0x1a9)])+_0x27aef2(0x1aa)+_0x316021[_0x27aef2(0x195)]+'/'+_0x316021['totalSplits']+_0x27aef2(0x19e));}});return _0x30e778;},{'verbose':_0x290371[_0x4dcc71(0x17c)]}),_0x1580c4=_0x3c9e08[_0x4dcc71(0x18d)],_0x470c65=_0x1580c4['jobId']?_0x4dcc71(0x1a6)+_0x1580c4[_0x4dcc71(0x19d)]+']':'',_0x2869f9=_0x3cddab?_0x4dcc71(0x197)+_0x17f953+'/'+_0x27196c+'\x20-\x20':'';console[_0x4dcc71(0x19a)]('✔\x20'+_0x2869f9+_0x4dcc71(0x187)+formatRows(_0x1580c4['stats'][_0x4dcc71(0x1a9)])+_0x4dcc71(0x1aa)+(_0x4dcc71(0x182)+formatElapsed(_0x1580c4['stats'][_0x4dcc71(0x194)])+_0x470c65));if(_0x3cddab&&_0x3a4ffc){const _0x259658=resolveOutputOptions(_0x290371),_0x364db0=await formatQueryOutput(_0x1580c4,_0x259658);_0x1bb8a1[_0x4dcc71(0x17f)](_0x364db0);}else await handleQueryOutput(_0x1580c4,_0x290371);}catch(_0x141ea0){const _0x23049f=_0x3cddab?'Statement\x20'+_0x17f953+'/'+_0x27196c+':\x0a':'',_0x3ae677=_0x141ea0 instanceof SDKError?_0x141ea0[_0x4dcc71(0x184)]:_0x141ea0[_0x4dcc71(0x1a7)];return console[_0x4dcc71(0x19a)](''+_0x23049f+_0x3ae677),0x1;}}if(_0x242bf0[_0x4dcc71(0x193)]>0x1&&_0x3a4ffc&&_0x1bb8a1['length']>0x0){const _0x3c929f=_0x1bb8a1[_0x4dcc71(0x175)]('\x0a');writeFileSync(_0x290371[_0x4dcc71(0x18c)],_0x3c929f),console[_0x4dcc71(0x19a)](_0x4dcc71(0x1a1)+_0x290371['output']);}return 0x0;}catch(_0x309940){throw _0x309940;}}['validate'](_0x1a6e7f){const _0xbb915f=a24_0x46c598,_0x51d320=_0x1a6e7f[_0xbb915f(0x186)][0x0],_0x3c6e34=_0x1a6e7f[_0xbb915f(0x177)][_0xbb915f(0x18e)];if(!_0x51d320&&!_0x3c6e34)return _0xbb915f(0x181);if(_0x51d320&&_0x3c6e34)return _0xbb915f(0x17a);return undefined;}}function a24_0x5640(_0x96c230,_0x34ca6b){_0x96c230=_0x96c230-0x175;const _0x7ed82a=a24_0x7ed8();let _0x5640c2=_0x7ed82a[_0x96c230];return _0x5640c2;}function a24_0x7ed8(){const _0x2f1697=['Site:\x20','481266Nxgaba','...','state','output','data','file','Catalog:\x20','No\x20SQL\x20provided','setExtra','name','length','elapsedTimeMillis','completedSplits','7IIzqxH','Statement\x20','site','database','error','query','4427784nkRRGr','jobId','\x20splits','Schema:\x20','2653497GGgaoI','\x0aAll\x20results\x20saved\x20to\x20','Run\x20Trino\x20queries\x20(streaming)','1831920lsBjzW','Executing\x20query\x20[','312552DtLXuQ','\x20[Job\x20ID:\x20','message','12sDwJfC','processedRows','\x20rows\x20','description','join','Executing\x20statement\x20','options','1131176hiKMOn','SQL:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','execute','verbose','catalog','setJobId','push','Error:\x20','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','in\x20','322860aCpCnx','originalMessage','information_schema','args','Query\x20completed:\x20Processed\x20'];a24_0x7ed8=function(){return _0x2f1697;};return a24_0x7ed8();}
|