@treasuredata/tdx 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/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/context-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/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/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.d.ts +2 -4
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/auth.js.map +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.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.d.ts +2 -1
- package/dist/core/profile.d.ts.map +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/profile.js.map +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.d.ts +45 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +1 -0
- package/dist/core/version.js.map +1 -0
- 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/server.js +1 -1
- package/dist/proxy/session-cache.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/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function a22_0x5edf(){const _0x52c6a0=['dim','all','2544751ZWdJdT','enriched','limit','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20No\x20changes\x20-\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','.yaml','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','16icZQeY','\x20--behavior\x20\x22','verbose','6DZOoKZ','List\x20available\x20fields\x20for\x20segmentation','300hClnoz','\x20parent\x20segment','255598iESzoD','behaviorsFile','Listing\x20fields\x20for\x20\x27','updateParent','customerGroup','Preview:','Show\x20parent\x20segment\x20details','localeCompare','label','attributes','18288VrzvJW','repeat','Master\x20Table','length','Site:\x20','match','start','use','segment:parent:pull','displayColumns','sampleData','\x20--enriched','2422987jOdqKi','jsonl','error','✔\x20Created\x20parent\x20segment\x20\x27','coveragePercent','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Master:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','status','\x20kill','run','listParents','elapsedTimeMillis','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Session:','Customers:','description','\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','pushParentYaml','schemaValid','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','getParentSQL','red','database','foreignKey','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Executing\x20parent\x20segment\x20query...','/{name}.yml\x0a','toFixed','40Nyidot','xdg-open','runParent','Rows:','No\x20parent\x20segments\x20found','information_schema','rowCount','Listing\x20parent\x20segments\x20matching\x20\x27','Coverage:','/sessions/','List\x20parent\x20segments','stop','\x20=\x20','Join:','parentSegment','behaviors','Errors:','green','parent_segments','schemaError','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','scheduleType','FINISHED','✔\x20Found\x20','json','segment:parent:create','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x0aNew\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','jobId','workflowId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','win32','displayAttributesStats','filter','Resolving\x20parent\x20segment\x20\x27','Columns:','resolveParentId','Apply\x20changes\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Source:','Creating','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x27\x20and\x20run\x20workflow?','cyan','5739545QBCsVE','displayPreviewResults','✔\x20Query\x20completed:\x20Processed\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','Updating\x20parent\x20segment\x20\x27','toLocaleString','4gagBsQ','\x20[Job\x20ID:\x20','\x20parent\x20segment\x20\x27','attribute','output','getParentFull','Fetching\x20sample\x20data...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','web','query','segment','trim','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20--behavior\x20\x22<name>\x22','text','Error:\x20Parent\x20segment\x20name\x20is\x20required','interval','using\x20the\x20default\x20path:\x20','displaySummary','customerGroupFile','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','endsWith','segment:parent:push','joinKey','SQL\x20query:\x0a','Options:\x0a','join','timezone','execute','segment:parent:sql','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Context\x20set:\x20','apply','Events:','log','scheduleOption','Get\x20SQL\x20query\x20for\x20parent\x20segment','errors','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Join\x20on:','test','column','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','columns','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','map','utf-8','Updating','parent_segment','To\x20cancel:','No\x20parent\x20segments\x20match\x20pattern:\x20','allValid','/\x20directories\x20exist.','displayPreviewHints','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','displayMasterInfo','YAML\x20file:\x20','Analyzing\x20changes...','Pattern:\x20','displayBehaviorsStats','session','table','isDirectory','behavior','segment:parent:update','/app/dw/parentSegments/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','platform','customerPercent','in\x20','workflowAttemptId','segment:parent:run','Validating\x20configuration...','\x0a⚠️\x20\x20Migrating:\x20','customersWithEvents','workflowSessionId','segment:parent:fields','Behaviors','Updated','Error:','Output\x20file:\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Available\x20behaviors:','data','displayValidateResults','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','processedRows','segment:parent:show','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Audience\x20ID:','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','format','\x20--attribute\x20\x22','To\x20view\x20sample\x20data:','/attempt/','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','`\x20to\x20download\x20the\x20configuration\x20first','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','string','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','yellow','\x0aChanges\x20to\x20apply\x20to\x20\x27','Options\x20(one\x20required):\x0a','/\x20→\x20','sort','Name:\x20','Attributes','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Created','pullParentYaml','Aborted.','\x0a✔\x20Workflow\x20started','Found\x20YAML\x20file:\x20','preview','\x27\x20is\x20already\x20up\x20to\x20date','site','-1d','\x0aChanges\x20to\x20\x27','Parent\x20segment:\x20','\x0aNo\x20sample\x20data\x20available','Fetching\x20SQL\x20for\x20\x27','addBehaviorsFile','Database:\x20','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20-\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','replace','Show\x20parent\x20segment\x20schema\x20(column\x20types)','population','addBehaviors','createParent','Error\x20reading\x20file:\x20','Status:','addAttributes','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','30148hAaSVj','tdx\x20segment\x20parent\x20preview\x20','master','Error:\x20File\x20not\x20found:\x20','Available\x20attributes:','yes','/app/workflows/','bold','Attempt:','\x20Configuration\x20is\x20valid','\x20rows\x20','\x20tdx\x20wf\x20attempt\x20','ignore','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','dirname','matchedCount','Master\x20+\x20Attributes','Options:','segment:parent:view','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x27...','\x20field','✔\x20Renamed\x20directory\x20to\x20','stats','message','Fetching\x20parent\x20segment\x20\x27','18382KrlPyP','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','3483423XTMmZI','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','audienceId','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','.yml','name','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','displaySampleData','Error:\x20--attribute\x20requires\x20a\x20name\x0a'];a22_0x5edf=function(){return _0x52c6a0;};return a22_0x5edf();}const a22_0x428e50=a22_0x22fd;(function(_0x1950e4,_0x2681d8){const _0x2ace95=a22_0x22fd,_0x4b6b3a=_0x1950e4();while(!![]){try{const _0x3f1961=-parseInt(_0x2ace95(0x284))/0x1*(parseInt(_0x2ace95(0x21b))/0x2)+-parseInt(_0x2ace95(0x219))/0x3*(parseInt(_0x2ace95(0x1e2))/0x4)+-parseInt(_0x2ace95(0x27e))/0x5*(-parseInt(_0x2ace95(0x217))/0x6)+-parseInt(_0x2ace95(0x231))/0x7*(parseInt(_0x2ace95(0x214))/0x8)+parseInt(_0x2ace95(0x1fe))/0x9+-parseInt(_0x2ace95(0x250))/0xa*(parseInt(_0x2ace95(0x20a))/0xb)+-parseInt(_0x2ace95(0x225))/0xc*(-parseInt(_0x2ace95(0x1fc))/0xd);if(_0x3f1961===_0x2681d8)break;else _0x4b6b3a['push'](_0x4b6b3a['shift']());}catch(_0x1a1013){_0x4b6b3a['push'](_0x4b6b3a['shift']());}}}(a22_0x5edf,0xc51b6));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x9419a8 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}from'../sdk/util/formatters.js';function a22_0x22fd(_0x4a3521,_0x265269){_0x4a3521=_0x4a3521-0x190;const _0x5edf1a=a22_0x5edf();let _0x22fd7a=_0x5edf1a[_0x4a3521];return _0x22fd7a;}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 a22_0x5c26e2 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x428e50(0x262),LEGACY_PARENT_SEGMENT_DIR=a22_0x428e50(0x2b6);function openBrowser(_0x15d133){const _0x14d307=a22_0x428e50,_0xa583b3=process[_0x14d307(0x19a)],_0x836370=_0xa583b3==='darwin'?'open':_0xa583b3===_0x14d307(0x271)?_0x14d307(0x22b):_0x14d307(0x251);spawn(_0x836370,[_0x15d133],{'detached':!![],'stdio':_0x14d307(0x1ee)})['unref']();}function migrateLegacyDirectory(){const _0x213655=a22_0x428e50;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3cb46f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3cb46f[_0x213655(0x195)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x213655(0x233)](a22_0x5c26e2[_0x213655(0x1bf)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x213655(0x2ba))),console['error'](a22_0x5c26e2[_0x213655(0x208)](_0x213655(0x20d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x5c26e2['yellow'](_0x213655(0x1a0)+LEGACY_PARENT_SEGMENT_DIR+_0x213655(0x1c2)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a22_0x5c26e2[_0x213655(0x261)](_0x213655(0x1f8)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3c1942){const _0x299a2e=_0x3c1942 instanceof Error?_0x3c1942[_0x213655(0x1fa)]:String(_0x3c1942);return console[_0x213655(0x233)](a22_0x5c26e2[_0x213655(0x249)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x299a2e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x428e50(0x23b)](_0x591ab8){return migrateLegacyDirectory(),super['run'](_0x591ab8);}}function resolveYamlFile(_0x3a02b8){const _0x18f451=a22_0x428e50;if(_0x3a02b8[_0x18f451(0x29a)](_0x18f451(0x203))||_0x3a02b8[_0x18f451(0x29a)](_0x18f451(0x212)))return _0x3a02b8;return a22_0x9419a8['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3a02b8)+_0x18f451(0x203));}function formatProgressMessage(_0xbb9b64){const _0x37faec=a22_0x428e50,_0x3299d2=_0xbb9b64[_0x37faec(0x22a)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3299d2){const [,_0x271295,_0x4fb0bf,_0x2b1c3a='']=_0x3299d2;return a22_0x5c26e2[_0x37faec(0x208)](_0x271295+':')+'\x20'+_0x4fb0bf+a22_0x5c26e2[_0x37faec(0x208)](_0x2b1c3a);}return a22_0x5c26e2[_0x37faec(0x208)](_0xbb9b64);}function showFileNotFoundError(_0x172822,_0x59e186){const _0x4bef27=a22_0x428e50;console['error'](a22_0x5c26e2['red'](_0x4bef27(0x1e5)+_0x172822+'\x0a')),console[_0x4bef27(0x233)](a22_0x5c26e2[_0x4bef27(0x27d)](_0x4bef27(0x213)+_0x59e186+_0x4bef27(0x1bb)));}function showParentSegmentNotSetError(_0x254011){const _0x4a1e14=a22_0x428e50;console[_0x4a1e14(0x233)](a22_0x5c26e2['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x4a1e14(0x233)](_0x254011);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x428e50(0x204)]='segment:parent:list';[a22_0x428e50(0x241)]=a22_0x428e50(0x25a);async[a22_0x428e50(0x2a1)](_0x318bc7){const _0x6bf6c9=a22_0x428e50,{options:_0x22c2d7,args:_0x14557a,tdx:_0x2f97e1}=_0x318bc7,_0x25231c=_0x14557a[0x0];_0x22c2d7[_0x6bf6c9(0x216)]&&(console[_0x6bf6c9(0x233)](_0x6bf6c9(0x229)+_0x22c2d7[_0x6bf6c9(0x1ce)]),_0x25231c&&console[_0x6bf6c9(0x233)](_0x6bf6c9(0x191)+_0x25231c));const _0x17e9e9=await withSpinner(_0x25231c?_0x6bf6c9(0x257)+_0x25231c+'\x27...':'Listing\x20parent\x20segments...',()=>_0x2f97e1['segment'][_0x6bf6c9(0x23c)](),{'verbose':_0x22c2d7[_0x6bf6c9(0x216)]});let _0x5caa33=_0x17e9e9[_0x6bf6c9(0x1aa)];if(_0x25231c){const _0x47976d=_0x25231c['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')[_0x6bf6c9(0x1d9)](/\?/g,'.'),_0x5c58bd=new RegExp('^'+_0x47976d+'$','i');_0x5caa33=_0x5caa33[_0x6bf6c9(0x273)](_0x401417=>_0x5c58bd[_0x6bf6c9(0x2ad)](_0x401417['attributes'][_0x6bf6c9(0x204)]));}_0x5caa33[_0x6bf6c9(0x1c3)]((_0x43d0d9,_0x52b807)=>_0x43d0d9[_0x6bf6c9(0x224)][_0x6bf6c9(0x204)][_0x6bf6c9(0x222)](_0x52b807[_0x6bf6c9(0x224)][_0x6bf6c9(0x204)])),console[_0x6bf6c9(0x233)](_0x6bf6c9(0x267)+_0x5caa33[_0x6bf6c9(0x228)]+_0x6bf6c9(0x21a)+(_0x5caa33[_0x6bf6c9(0x228)]!==0x1?'s':''));if(_0x22c2d7[_0x6bf6c9(0x1b6)]===_0x6bf6c9(0x268)||_0x22c2d7['format']===_0x6bf6c9(0x232))await handleSDKOutput(_0x5caa33,_0x22c2d7);else{if(_0x5caa33[_0x6bf6c9(0x228)]===0x0)_0x25231c?console['log'](_0x6bf6c9(0x2b8)+_0x25231c):console['log'](_0x6bf6c9(0x254));else for(const _0x46aea0 of _0x5caa33){const _0x24bcf0=_0x46aea0['attributes'][_0x6bf6c9(0x1db)]?a22_0x5c26e2['dim']('\x20('+formatRows(_0x46aea0[_0x6bf6c9(0x224)][_0x6bf6c9(0x1db)])+')'):'';console[_0x6bf6c9(0x2a7)]('👥\x20'+_0x46aea0['attributes']['name']+_0x24bcf0);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x269);[a22_0x428e50(0x241)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x428e50(0x2a1)](_0x40d637){const _0x2cf3bd=a22_0x428e50,{options:_0xdeacf,args:_0x241cef,tdx:_0x557222}=_0x40d637;console[_0x2cf3bd(0x233)](_0x2cf3bd(0x202)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x17e6d6=_0xdeacf;if(_0x241cef[_0x2cf3bd(0x228)]===0x0)return console[_0x2cf3bd(0x233)](a22_0x5c26e2[_0x2cf3bd(0x249)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x2cf3bd(0x233)](_0x2cf3bd(0x26c)),0x1;const _0x10a672=_0x241cef[0x0];if(!_0x17e6d6[_0x2cf3bd(0x24a)]||!_0x17e6d6['table'])return console[_0x2cf3bd(0x233)](_0x2cf3bd(0x291)),console[_0x2cf3bd(0x233)](_0x2cf3bd(0x26c)),0x1;_0x17e6d6['verbose']&&(console[_0x2cf3bd(0x233)](_0x2cf3bd(0x229)+_0x17e6d6['site']),console[_0x2cf3bd(0x233)](_0x2cf3bd(0x1c4)+_0x10a672),console[_0x2cf3bd(0x233)](_0x2cf3bd(0x1d5)+_0x17e6d6[_0x2cf3bd(0x24a)]),console[_0x2cf3bd(0x233)]('Table:\x20'+_0x17e6d6[_0x2cf3bd(0x194)]));const _0x443b31=await loadJSONFromOptions(_0x17e6d6[_0x2cf3bd(0x224)],_0x17e6d6['attributesFile']),_0xab0063=await loadJSONFromOptions(_0x17e6d6[_0x2cf3bd(0x25f)],_0x17e6d6[_0x2cf3bd(0x21c)]),_0x48bbe4=await loadJSONFromOptions(_0x17e6d6[_0x2cf3bd(0x21f)],_0x17e6d6[_0x2cf3bd(0x298)]),_0x4b4f09={'name':_0x10a672,'description':_0x17e6d6[_0x2cf3bd(0x241)],'scheduleType':_0x17e6d6[_0x2cf3bd(0x265)],'scheduleOption':_0x17e6d6[_0x2cf3bd(0x2a8)],'timezone':_0x17e6d6[_0x2cf3bd(0x2a0)],'master':{'parentDatabaseName':_0x17e6d6[_0x2cf3bd(0x24a)],'parentTableName':_0x17e6d6[_0x2cf3bd(0x194)]},'attributes':_0x443b31,'behaviors':_0xab0063,'customerGroup':_0x48bbe4},_0x1d2a45=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x10a672+'\x27...',()=>_0x557222['segment'][_0x2cf3bd(0x1dd)](_0x4b4f09),{'verbose':_0xdeacf['verbose']}),_0x560887=_0x1d2a45[_0x2cf3bd(0x1aa)];return console[_0x2cf3bd(0x233)](_0x2cf3bd(0x234)+_0x560887[_0x2cf3bd(0x204)]+_0x2cf3bd(0x1d6)+_0x560887['id']),await handleSDKOutput([_0x560887],_0xdeacf),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x197);[a22_0x428e50(0x241)]=a22_0x428e50(0x1ba);async[a22_0x428e50(0x2a1)](_0x2031b1){const _0x538c1e=a22_0x428e50,{options:_0x1e041a,args:_0x359fb7,tdx:_0x4b4487}=_0x2031b1;console[_0x538c1e(0x233)](_0x538c1e(0x28b)+_0x538c1e(0x1b5)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x6b0c9e=_0x1e041a;if(_0x359fb7['length']===0x0)return console[_0x538c1e(0x233)](a22_0x5c26e2[_0x538c1e(0x249)](_0x538c1e(0x294))),console['error'](_0x538c1e(0x2a3)),0x1;const _0x586d3c=_0x359fb7[0x0];_0x6b0c9e[_0x538c1e(0x216)]&&(console['error']('Site:\x20'+_0x6b0c9e[_0x538c1e(0x1ce)]),console[_0x538c1e(0x233)](_0x538c1e(0x1d1)+_0x586d3c));const _0x26b394=await withSpinner(_0x538c1e(0x1b3)+_0x586d3c+_0x538c1e(0x1f6),()=>_0x4b4487['segment']['getParentFull'](_0x586d3c),{'verbose':_0x6b0c9e[_0x538c1e(0x216)]}),_0x1bdbc9=_0x26b394[_0x538c1e(0x1aa)],_0x3c351e=await loadJSONFromOptions(_0x6b0c9e[_0x538c1e(0x1e0)],_0x6b0c9e['addAttributesFile']),_0x13b67e=await loadJSONFromOptions(_0x6b0c9e[_0x538c1e(0x1dc)],_0x6b0c9e[_0x538c1e(0x1d4)]),_0x226311={'name':_0x1bdbc9[_0x538c1e(0x204)],'description':_0x6b0c9e['description']!==undefined?_0x6b0c9e[_0x538c1e(0x241)]:_0x1bdbc9[_0x538c1e(0x241)],'scheduleType':_0x6b0c9e[_0x538c1e(0x265)]!==undefined?_0x6b0c9e['scheduleType']:_0x1bdbc9[_0x538c1e(0x265)],'scheduleOption':_0x6b0c9e[_0x538c1e(0x2a8)]!==undefined?_0x6b0c9e[_0x538c1e(0x2a8)]:_0x1bdbc9['scheduleOption'],'timezone':_0x6b0c9e[_0x538c1e(0x2a0)]!==undefined?_0x6b0c9e[_0x538c1e(0x2a0)]:_0x1bdbc9[_0x538c1e(0x2a0)],'master':_0x1bdbc9['master'],'attributes':_0x3c351e?[..._0x1bdbc9[_0x538c1e(0x224)]||[],..._0x3c351e]:_0x1bdbc9['attributes'],'behaviors':_0x13b67e?[..._0x1bdbc9[_0x538c1e(0x25f)]||[],..._0x13b67e]:_0x1bdbc9[_0x538c1e(0x25f)],'customerGroup':_0x1bdbc9[_0x538c1e(0x21f)]},_0x129838=await withSpinner(_0x538c1e(0x282)+_0x586d3c+'\x27...',()=>_0x4b4487['segment'][_0x538c1e(0x21e)](_0x586d3c,_0x226311),{'verbose':_0x6b0c9e[_0x538c1e(0x216)]}),_0x186374=_0x129838[_0x538c1e(0x1aa)];return console[_0x538c1e(0x233)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x186374['name']+'\x27'),await handleSDKOutput([_0x186374],_0x6b0c9e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x428e50(0x22d);[a22_0x428e50(0x241)]=a22_0x428e50(0x205);async[a22_0x428e50(0x2a1)](_0x41924d){const _0x135479=a22_0x428e50,{options:_0x559bbd,args:_0xea3182,tdx:_0x504acf}=_0x41924d,_0x2f24af=_0x559bbd,_0xf2e539=_0xea3182[0x0]||_0x559bbd[_0x135479(0x25e)];if(!_0xf2e539)return showParentSegmentNotSetError(_0x135479(0x2b2)+_0x135479(0x278)),0x1;if(_0x2f24af[_0x135479(0x22c)]&&_0x2f24af[_0x135479(0x288)])return console[_0x135479(0x233)](a22_0x5c26e2['red'](_0x135479(0x24c))),console[_0x135479(0x233)](a22_0x5c26e2[_0x135479(0x208)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x135479(0x233)](a22_0x5c26e2['dim'](_0x135479(0x296)+PARENT_SEGMENT_DIR+_0x135479(0x24e))),console['error'](a22_0x5c26e2['cyan'](_0x135479(0x200))),0x1;const _0x41c2f0=_0x2f24af[_0x135479(0x288)]||a22_0x9419a8[_0x135479(0x29f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xf2e539)+_0x135479(0x203));_0x2f24af['verbose']&&(console[_0x135479(0x233)]('Site:\x20'+_0x2f24af[_0x135479(0x1ce)]),console['error'](_0x135479(0x1d1)+_0xf2e539),console[_0x135479(0x233)](_0x135479(0x1a7)+_0x41c2f0));const _0x7447aa=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xf2e539+'\x27...',()=>_0x504acf['segment'][_0x135479(0x1c8)](_0xf2e539),{'verbose':_0x2f24af[_0x135479(0x216)]}),_0x1ff003=_0x7447aa['data'];if(existsSync(_0x41c2f0)){const _0x140a20=readFileSync(_0x41c2f0,_0x135479(0x2b4)),_0x3aa0ad=generateDiff(_0x140a20,_0x1ff003);if(!hasChanges(_0x3aa0ad))console[_0x135479(0x233)](a22_0x5c26e2[_0x135479(0x261)]('✔')+_0x135479(0x20e)+a22_0x5c26e2['cyan'](_0x41c2f0)+_0x135479(0x242));else{console[_0x135479(0x233)](_0x135479(0x1d0)+_0x41c2f0+'\x27:'),console[_0x135479(0x233)]('─'[_0x135479(0x226)](0x3c)),console[_0x135479(0x233)](formatDiffWithColors(_0x3aa0ad)),console[_0x135479(0x233)]('─'[_0x135479(0x226)](0x3c));if(!_0x2f24af['yes']){const _0x465384=await confirmKey('Overwrite\x20\x27'+_0x41c2f0+'\x27?');if(!_0x465384)return console['error'](_0x135479(0x1c9)),0x1;}writeFileSync(_0x41c2f0,_0x1ff003,'utf-8'),console['error'](a22_0x5c26e2[_0x135479(0x261)]('✔')+_0x135479(0x1a8)+a22_0x5c26e2['cyan'](_0x41c2f0));}}else{const _0x423809=a22_0x9419a8[_0x135479(0x1f0)](_0x41c2f0);!existsSync(_0x423809)&&mkdirSync(_0x423809,{'recursive':!![]}),writeFileSync(_0x41c2f0,_0x1ff003,_0x135479(0x2b4)),console['error'](a22_0x5c26e2['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x5c26e2[_0x135479(0x27d)](_0x41c2f0));}return saveSessionContext({'parent_segment':_0xf2e539},_0x2f24af[_0x135479(0x193)]),console[_0x135479(0x233)](a22_0x5c26e2[_0x135479(0x261)]('✔')+_0x135479(0x2a4)+a22_0x5c26e2[_0x135479(0x208)](_0x135479(0x2b6))+_0x135479(0x25c)+a22_0x5c26e2['cyan'](_0xf2e539)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x29b);['description']=a22_0x428e50(0x1b1);async[a22_0x428e50(0x2a1)](_0x258449){const _0x5f027c=a22_0x428e50,{options:_0x2c12ec,args:_0x225beb,tdx:_0x5787c6}=_0x258449,_0x5c15f0=_0x2c12ec,_0x529aec=_0x225beb[0x0]||_0x2c12ec[_0x5f027c(0x25e)];if(!_0x529aec)return showParentSegmentNotSetError(_0x5f027c(0x1b0)+_0x5f027c(0x26d)),0x1;const _0x1554a9=resolveYamlFile(_0x529aec);if(!existsSync(_0x1554a9))return showFileNotFoundError(_0x1554a9,_0x529aec),0x1;_0x5c15f0[_0x5f027c(0x216)]&&(console['error']('Site:\x20'+_0x5c15f0[_0x5f027c(0x1ce)]),console[_0x5f027c(0x233)]('YAML\x20file:\x20'+_0x1554a9));let _0x111cfc;try{_0x111cfc=readFileSync(_0x1554a9,'utf-8');}catch(_0x4a3e95){const _0xd17c98=_0x4a3e95 instanceof Error?_0x4a3e95['message']:String(_0x4a3e95);return console[_0x5f027c(0x233)]('Error\x20reading\x20file:\x20'+_0xd17c98),0x1;}const _0x339300=await withSpinner(_0x5f027c(0x190),()=>_0x5787c6[_0x5f027c(0x28e)][_0x5f027c(0x244)](_0x111cfc),{'verbose':_0x5c15f0[_0x5f027c(0x216)]}),_0x1871c9=_0x339300[_0x5f027c(0x1aa)],{isNew:_0x41c711,name:_0xc84a98,hasChanges:_0x9fa79f,diffFormatted:_0x2c6a33}=_0x1871c9;if(!_0x9fa79f)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0xc84a98+_0x5f027c(0x1cd)),0x0;_0x41c711?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0xc84a98+'\x27:'):console[_0x5f027c(0x233)](_0x5f027c(0x1c0)+_0xc84a98+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x2c6a33),console[_0x5f027c(0x233)]('─'[_0x5f027c(0x226)](0x3c));const _0x1053e1=_0x41c711?'Create\x20parent\x20segment\x20\x27'+_0xc84a98+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xc84a98+'\x27?';if(!_0x5c15f0[_0x5f027c(0x1e7)]){const _0x319753=await confirmKey(_0x1053e1);if(!_0x319753)return console['error'](_0x5f027c(0x1c9)),0x1;}const _0xcb8d12=_0x41c711?_0x5f027c(0x27a):_0x5f027c(0x2b5),_0x1110a0=await withSpinner(_0xcb8d12+_0x5f027c(0x286)+_0xc84a98+_0x5f027c(0x1f6),()=>_0x1871c9[_0x5f027c(0x2a5)](),{'verbose':_0x5c15f0[_0x5f027c(0x216)]}),_0x4351f5=_0x1110a0['data'],_0xb31078=getConsoleNextUrl(_0x5c15f0[_0x5f027c(0x1ce)],'/app/dw/parentSegments/'+_0x4351f5['id']),_0x1641f8=_0x41c711?_0x5f027c(0x1c7):'Updated';return console['error']('✔\x20'+_0x1641f8+_0x5f027c(0x286)+_0x4351f5[_0x5f027c(0x204)]+'\x27'),console[_0x5f027c(0x233)]('\x20\x20'+_0xb31078),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x428e50(0x204)]='segment:parent:validate';[a22_0x428e50(0x241)]=a22_0x428e50(0x2af);async[a22_0x428e50(0x2a1)](_0x3cec95){const _0x2ec1c7=a22_0x428e50,{options:_0x2dad8b,args:_0x19f2f6,tdx:_0x21a856}=_0x3cec95,_0x2cb476=_0x2dad8b,_0x3d6821=_0x19f2f6[0x0]||_0x2dad8b[_0x2ec1c7(0x25e)];if(!_0x3d6821)return showParentSegmentNotSetError(_0x2ec1c7(0x264)+_0x2ec1c7(0x199)+_0x2ec1c7(0x29e)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x2ec1c7(0x1ef)+_0x2ec1c7(0x211)),0x1;const _0x2964ce=resolveYamlFile(_0x3d6821);if(!existsSync(_0x2964ce))return showFileNotFoundError(_0x2964ce,_0x3d6821),0x1;_0x2cb476[_0x2ec1c7(0x216)]&&(console[_0x2ec1c7(0x233)](_0x2ec1c7(0x229)+_0x2cb476[_0x2ec1c7(0x1ce)]),console['error'](_0x2ec1c7(0x2be)+_0x2964ce));let _0x5b88a4;try{_0x5b88a4=readFileSync(_0x2964ce,_0x2ec1c7(0x2b4));}catch(_0x2dfc6f){const _0x4a18df=_0x2dfc6f instanceof Error?_0x2dfc6f[_0x2ec1c7(0x1fa)]:String(_0x2dfc6f);return console[_0x2ec1c7(0x233)](_0x2ec1c7(0x1de)+_0x4a18df),0x1;}const _0x382e24=createCommandSpinner(a22_0x5c26e2['dim'](_0x2ec1c7(0x19f)),{'verbose':_0x2cb476['verbose']});_0x382e24[_0x2ec1c7(0x22b)]();const _0x37cbc8={'onProgress':_0x591406=>{_0x382e24['text']=formatProgressMessage(_0x591406);}};if(_0x2cb476[_0x2ec1c7(0x1e4)])_0x37cbc8[_0x2ec1c7(0x1e4)]=!![];if(_0x2cb476[_0x2ec1c7(0x20b)])_0x37cbc8[_0x2ec1c7(0x20b)]=!![];_0x2cb476['attribute']&&(_0x37cbc8[_0x2ec1c7(0x287)]=_0x2cb476[_0x2ec1c7(0x287)]);_0x2cb476[_0x2ec1c7(0x196)]&&(_0x37cbc8['behavior']=_0x2cb476[_0x2ec1c7(0x196)]);if(_0x2cb476['interval'])_0x37cbc8[_0x2ec1c7(0x295)]=_0x2cb476[_0x2ec1c7(0x295)];let _0x59af83;try{_0x59af83=await _0x21a856[_0x2ec1c7(0x28e)]['validateParentYaml'](_0x5b88a4,_0x37cbc8),_0x382e24['stop']();}catch(_0x1358f4){_0x382e24[_0x2ec1c7(0x25b)]();throw _0x1358f4;}const _0x423fb3=_0x2cb476[_0x2ec1c7(0x295)]||_0x2ec1c7(0x1cf);return this[_0x2ec1c7(0x1ab)](_0x59af83,_0x37cbc8,_0x2964ce,_0x423fb3),_0x59af83[_0x2ec1c7(0x2b9)]?0x0:0x1;}[a22_0x428e50(0x1ab)](_0x30e347,_0x410f53,_0x50d3fc,_0x24ff9b){const _0x288a74=a22_0x428e50;console['error']('\x0a'+a22_0x5c26e2[_0x288a74(0x1e9)]('Validate:')+'\x20'+_0x30e347[_0x288a74(0x204)]),console[_0x288a74(0x233)]('═'[_0x288a74(0x226)](0x3c)),this['displayMasterInfo'](_0x30e347);if(typeof _0x410f53[_0x288a74(0x287)]==='string'){this[_0x288a74(0x272)](_0x30e347),this['displaySummary'](_0x30e347),this[_0x288a74(0x2bb)](_0x50d3fc,_0x24ff9b,'attribute',_0x410f53['attribute']);return;}if(_0x410f53[_0x288a74(0x287)]===!![]){this[_0x288a74(0x272)](_0x30e347),this['displaySummary'](_0x30e347),this['displayPreviewHints'](_0x50d3fc,_0x24ff9b,_0x288a74(0x224));return;}if(typeof _0x410f53['behavior']===_0x288a74(0x1bd)){this[_0x288a74(0x192)](_0x30e347,_0x24ff9b),this[_0x288a74(0x297)](_0x30e347),this[_0x288a74(0x2bb)](_0x50d3fc,_0x24ff9b,_0x288a74(0x196),_0x410f53[_0x288a74(0x196)]);return;}if(_0x410f53[_0x288a74(0x196)]===!![]){this[_0x288a74(0x192)](_0x30e347,_0x24ff9b),this[_0x288a74(0x297)](_0x30e347),this[_0x288a74(0x2bb)](_0x50d3fc,_0x24ff9b,_0x288a74(0x25f));return;}this[_0x288a74(0x272)](_0x30e347),this['displayBehaviorsStats'](_0x30e347,_0x24ff9b),this[_0x288a74(0x297)](_0x30e347),this['displayPreviewHints'](_0x50d3fc,_0x24ff9b,'all');}[a22_0x428e50(0x2bb)](_0x4831b1,_0x3d11b4,_0x5d7820,_0x564f80){const _0x3293e9=a22_0x428e50;console['error']('\x0a'+a22_0x5c26e2[_0x3293e9(0x208)](_0x3293e9(0x1b8)));const _0x1d9361=_0x3d11b4!==_0x3293e9(0x1cf)?'\x20--interval\x20'+_0x3d11b4:'';if(_0x5d7820===_0x3293e9(0x287)&&_0x564f80)console['error']('\x20\x20'+a22_0x5c26e2[_0x3293e9(0x208)]('tdx\x20segment\x20parent\x20preview\x20'+_0x4831b1+_0x3293e9(0x1b7)+_0x564f80+'\x22'+_0x1d9361));else{if(_0x5d7820===_0x3293e9(0x196)&&_0x564f80)console['error']('\x20\x20'+a22_0x5c26e2[_0x3293e9(0x208)](_0x3293e9(0x1e3)+_0x4831b1+_0x3293e9(0x215)+_0x564f80+'\x22'+_0x1d9361));else(_0x5d7820===_0x3293e9(0x224)||_0x5d7820===_0x3293e9(0x209))&&console[_0x3293e9(0x233)]('\x20\x20'+a22_0x5c26e2[_0x3293e9(0x208)]('tdx\x20segment\x20parent\x20preview\x20'+_0x4831b1+'\x20--attribute\x20\x22<name>\x22'+_0x1d9361));}(_0x5d7820===_0x3293e9(0x25f)||_0x5d7820===_0x3293e9(0x209))&&console['error']('\x20\x20'+a22_0x5c26e2[_0x3293e9(0x208)](_0x3293e9(0x1e3)+_0x4831b1+_0x3293e9(0x292)+_0x1d9361)),_0x5d7820==='all'&&console['error']('\x20\x20'+a22_0x5c26e2[_0x3293e9(0x208)](_0x3293e9(0x1e3)+_0x4831b1+_0x3293e9(0x230)+_0x1d9361));}[a22_0x428e50(0x2bd)](_0x3f1c87){const _0x3ac147=a22_0x428e50,{master:_0x57361f}=_0x3f1c87,_0x18d04a=_0x57361f[_0x3ac147(0x245)]?a22_0x5c26e2[_0x3ac147(0x261)]('✔'):a22_0x5c26e2['red']('✘');console[_0x3ac147(0x233)]('\x0a'+a22_0x5c26e2[_0x3ac147(0x208)](_0x3ac147(0x227))),console[_0x3ac147(0x233)](_0x18d04a+'\x20'+a22_0x5c26e2['bold'](_0x57361f['database']+'.'+_0x57361f[_0x3ac147(0x194)])),_0x57361f[_0x3ac147(0x245)]?_0x57361f[_0x3ac147(0x256)]!==undefined&&console[_0x3ac147(0x233)]('\x20\x20'+a22_0x5c26e2[_0x3ac147(0x208)](_0x3ac147(0x253))+'\x20'+a22_0x5c26e2[_0x3ac147(0x27d)](formatRows(_0x57361f[_0x3ac147(0x256)]))):console[_0x3ac147(0x233)]('\x20\x20'+a22_0x5c26e2[_0x3ac147(0x249)](_0x3ac147(0x1a6))+'\x20'+_0x57361f['schemaError']);}['displayAttributesStats'](_0x162722){const _0x30ea4e=a22_0x428e50;if(_0x162722['attributes'][_0x30ea4e(0x228)]===0x0)return;console[_0x30ea4e(0x233)]('\x0a'+a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x1c5)));for(const _0x5cf845 of _0x162722[_0x30ea4e(0x224)]){const _0x2501f4=_0x5cf845[_0x30ea4e(0x245)]?a22_0x5c26e2['green']('✔'):a22_0x5c26e2[_0x30ea4e(0x249)]('✘');let _0x1309e4='';if(_0x5cf845[_0x30ea4e(0x245)]&&_0x5cf845[_0x30ea4e(0x1f1)]!==undefined&&_0x5cf845[_0x30ea4e(0x235)]!==undefined){const _0x5341b5=_0x5cf845[_0x30ea4e(0x235)]['toFixed'](0x1),_0x44c9c2=_0x5cf845[_0x30ea4e(0x235)]>=0x50?a22_0x5c26e2[_0x30ea4e(0x261)]:_0x5cf845[_0x30ea4e(0x235)]>=0x32?a22_0x5c26e2['yellow']:a22_0x5c26e2['red'];_0x1309e4='\x20'+a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x258))+'\x20'+_0x44c9c2(_0x5341b5+'%')+'\x20('+formatRows(_0x5cf845[_0x30ea4e(0x1f1)])+'\x20rows)';}console[_0x30ea4e(0x233)](_0x2501f4+'\x20'+a22_0x5c26e2[_0x30ea4e(0x1e9)](_0x5cf845[_0x30ea4e(0x204)])+_0x1309e4),console[_0x30ea4e(0x233)]('\x20\x20'+a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x279))+'\x20'+a22_0x5c26e2[_0x30ea4e(0x1e9)](_0x5cf845[_0x30ea4e(0x24a)]+'.'+_0x5cf845[_0x30ea4e(0x194)]));const _0x37f0c8=_0x5cf845['joinKey']===_0x5cf845[_0x30ea4e(0x24b)]?a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x2ac))+'\x20'+_0x5cf845[_0x30ea4e(0x29c)]:a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x25d))+'\x20'+_0x5cf845[_0x30ea4e(0x29c)]+_0x30ea4e(0x25c)+_0x5cf845[_0x30ea4e(0x24b)];console[_0x30ea4e(0x233)]('\x20\x20'+_0x37f0c8),console['error']('\x20\x20'+a22_0x5c26e2[_0x30ea4e(0x208)](_0x30ea4e(0x275))),this[_0x30ea4e(0x22e)](_0x5cf845[_0x30ea4e(0x2b1)]),!_0x5cf845['schemaValid']&&console['error']('\x20\x20'+a22_0x5c26e2[_0x30ea4e(0x249)](_0x30ea4e(0x1a6))+'\x20'+_0x5cf845[_0x30ea4e(0x263)]);}}[a22_0x428e50(0x192)](_0x41eb64,_0x3e37a3){const _0x9a9d89=a22_0x428e50;if(_0x41eb64['behaviors'][_0x9a9d89(0x228)]===0x0)return;console['error']('\x0a'+a22_0x5c26e2[_0x9a9d89(0x208)](_0x9a9d89(0x1a4))+'\x20'+a22_0x5c26e2[_0x9a9d89(0x208)]('('+_0x3e37a3+')'));for(const _0x439743 of _0x41eb64[_0x9a9d89(0x25f)]){const _0x524859=_0x439743[_0x9a9d89(0x245)]?a22_0x5c26e2['green']('✔'):a22_0x5c26e2[_0x9a9d89(0x249)]('✘');let _0x47b9c0='';if(_0x439743[_0x9a9d89(0x245)]&&_0x439743[_0x9a9d89(0x1a1)]!==undefined&&_0x439743['totalEvents']!==undefined){const _0x5b7eb5=_0x439743['customerPercent']?.[_0x9a9d89(0x24f)](0x1)||'?',_0x5ebbc5=(_0x439743[_0x9a9d89(0x19b)]??0x0)>=0x32?a22_0x5c26e2[_0x9a9d89(0x261)]:(_0x439743['customerPercent']??0x0)>=0x14?a22_0x5c26e2[_0x9a9d89(0x1bf)]:a22_0x5c26e2[_0x9a9d89(0x249)];_0x47b9c0='\x20'+a22_0x5c26e2[_0x9a9d89(0x208)](_0x9a9d89(0x240))+'\x20'+_0x5ebbc5(formatRows(_0x439743[_0x9a9d89(0x1a1)]))+'\x20('+_0x5b7eb5+'%)\x20'+a22_0x5c26e2['dim'](_0x9a9d89(0x2a6))+'\x20'+a22_0x5c26e2[_0x9a9d89(0x27d)](formatRows(_0x439743['totalEvents']));}console[_0x9a9d89(0x233)](_0x524859+'\x20'+a22_0x5c26e2[_0x9a9d89(0x1e9)](_0x439743['name'])+_0x47b9c0),console['error']('\x20\x20'+a22_0x5c26e2[_0x9a9d89(0x208)](_0x9a9d89(0x279))+'\x20'+a22_0x5c26e2[_0x9a9d89(0x1e9)](_0x439743['database']+'.'+_0x439743[_0x9a9d89(0x194)]));const _0x3281d5=_0x439743[_0x9a9d89(0x29c)]===_0x439743[_0x9a9d89(0x24b)]?a22_0x5c26e2[_0x9a9d89(0x208)](_0x9a9d89(0x2ac))+'\x20'+_0x439743[_0x9a9d89(0x29c)]:a22_0x5c26e2['dim'](_0x9a9d89(0x25d))+'\x20'+_0x439743['joinKey']+_0x9a9d89(0x25c)+_0x439743[_0x9a9d89(0x24b)];console['error']('\x20\x20'+_0x3281d5),console[_0x9a9d89(0x233)]('\x20\x20'+a22_0x5c26e2['dim']('Columns:')),this[_0x9a9d89(0x22e)](_0x439743[_0x9a9d89(0x2b1)]),!_0x439743['schemaValid']&&console['error']('\x20\x20'+a22_0x5c26e2[_0x9a9d89(0x249)](_0x9a9d89(0x1a6))+'\x20'+_0x439743[_0x9a9d89(0x263)]);}}[a22_0x428e50(0x22e)](_0x25a27f){const _0x3c3a5b=a22_0x428e50;for(const _0x555309 of _0x25a27f){_0x555309[_0x3c3a5b(0x223)]===_0x555309[_0x3c3a5b(0x2ae)]||_0x555309[_0x3c3a5b(0x2ae)]==='*'?console['error'](_0x3c3a5b(0x1d7)+_0x555309['label']):console['error'](_0x3c3a5b(0x1d7)+_0x555309[_0x3c3a5b(0x223)]+'\x20'+a22_0x5c26e2['dim']('('+_0x555309[_0x3c3a5b(0x2ae)]+')'));}}[a22_0x428e50(0x297)](_0x15b5df){const _0x390f66=a22_0x428e50;console[_0x390f66(0x233)]('─'['repeat'](0x3c));if(_0x15b5df[_0x390f66(0x2aa)]['length']>0x0){console['error']('\x0a'+a22_0x5c26e2[_0x390f66(0x249)](_0x390f66(0x260)));for(const _0x11eabe of _0x15b5df[_0x390f66(0x2aa)]){console[_0x390f66(0x233)]('\x20\x20'+a22_0x5c26e2[_0x390f66(0x249)]('•')+'\x20'+_0x11eabe);}}_0x15b5df[_0x390f66(0x2b9)]&&console[_0x390f66(0x233)]('\x0a'+a22_0x5c26e2[_0x390f66(0x261)]('✔')+_0x390f66(0x1eb));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x428e50(0x204)]='segment:parent:preview';[a22_0x428e50(0x241)]=a22_0x428e50(0x238);async[a22_0x428e50(0x2a1)](_0xa3e7a1){const _0xd2fdeb=a22_0x428e50,{options:_0x153b76,args:_0x53e909,tdx:_0x58555b}=_0xa3e7a1,_0x161e93=_0x153b76,_0xd9e8b1=_0x53e909[0x0]||_0x153b76[_0xd2fdeb(0x25e)];if(!_0xd9e8b1)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'+_0xd2fdeb(0x2bc)+_0xd2fdeb(0x1c1)+_0xd2fdeb(0x1f5)+_0xd2fdeb(0x26a)+_0xd2fdeb(0x1b4)+_0xd2fdeb(0x210)+_0xd2fdeb(0x211)),0x1;if(!_0x161e93[_0xd2fdeb(0x1e4)]&&!_0x161e93['attribute']&&!_0x161e93[_0xd2fdeb(0x196)]&&!_0x161e93[_0xd2fdeb(0x20b)])return console['error'](a22_0x5c26e2[_0xd2fdeb(0x249)](_0xd2fdeb(0x299))),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x1d8)),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x1f3)),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x246)),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x1ff)),console['error'](_0xd2fdeb(0x2ab)),0x1;const _0x289794=resolveYamlFile(_0xd9e8b1);if(!existsSync(_0x289794))return showFileNotFoundError(_0x289794,_0xd9e8b1),0x1;_0x161e93[_0xd2fdeb(0x216)]&&(console[_0xd2fdeb(0x233)]('Site:\x20'+_0x161e93[_0xd2fdeb(0x1ce)]),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x2be)+_0x289794));let _0x2e1bbf;try{_0x2e1bbf=readFileSync(_0x289794,'utf-8');}catch(_0xbefac6){const _0xc2202d=_0xbefac6 instanceof Error?_0xbefac6['message']:String(_0xbefac6);return console['error'](_0xd2fdeb(0x1de)+_0xc2202d),0x1;}let _0x11cdd9;try{_0x11cdd9=parseDef(_0x2e1bbf);}catch(_0x3946ba){const _0x5e3a96=_0x3946ba instanceof Error?_0x3946ba['message']:String(_0x3946ba);return console[_0xd2fdeb(0x233)](a22_0x5c26e2['red']('Error\x20parsing\x20YAML:\x20'+_0x5e3a96)),0x1;}if(_0x161e93[_0xd2fdeb(0x287)]===!![]||_0x161e93[_0xd2fdeb(0x287)]===''){const _0x3c7fa9=_0x11cdd9['attributes']?.[_0xd2fdeb(0x2b3)](_0x32ada6=>_0x32ada6[_0xd2fdeb(0x204)])||[];if(_0x3c7fa9[_0xd2fdeb(0x228)]===0x0)console[_0xd2fdeb(0x233)](a22_0x5c26e2['red'](_0xd2fdeb(0x27b)));else{console[_0xd2fdeb(0x233)](a22_0x5c26e2[_0xd2fdeb(0x249)](_0xd2fdeb(0x207))),console[_0xd2fdeb(0x233)](_0xd2fdeb(0x1e6));for(const _0x47d1aa of _0x3c7fa9){console[_0xd2fdeb(0x233)]('\x20\x20'+a22_0x5c26e2['cyan'](_0x47d1aa));}console[_0xd2fdeb(0x233)](_0xd2fdeb(0x1c6)+_0xd9e8b1+_0xd2fdeb(0x1b7)+_0x3c7fa9[0x0]+'\x22');}return 0x1;}if(_0x161e93[_0xd2fdeb(0x196)]===!![]||_0x161e93[_0xd2fdeb(0x196)]===''){const _0x2aff60=_0x11cdd9[_0xd2fdeb(0x25f)]?.['map'](_0xbe982c=>_0xbe982c[_0xd2fdeb(0x204)])||[];if(_0x2aff60[_0xd2fdeb(0x228)]===0x0)console[_0xd2fdeb(0x233)](a22_0x5c26e2[_0xd2fdeb(0x249)](_0xd2fdeb(0x236)));else{console[_0xd2fdeb(0x233)](a22_0x5c26e2[_0xd2fdeb(0x249)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console['error'](_0xd2fdeb(0x1a9));for(const _0x4e7cb5 of _0x2aff60){console[_0xd2fdeb(0x233)]('\x20\x20'+a22_0x5c26e2['cyan'](_0x4e7cb5));}console['error'](_0xd2fdeb(0x1c6)+_0xd9e8b1+'\x20--behavior\x20\x22'+_0x2aff60[0x0]+'\x22');}return 0x1;}const _0x3e9723=createCommandSpinner(a22_0x5c26e2[_0xd2fdeb(0x208)](_0xd2fdeb(0x28a)),{'verbose':_0x161e93[_0xd2fdeb(0x216)]});_0x3e9723[_0xd2fdeb(0x22b)]();const _0x58e69c={'onProgress':_0x40dbaf=>{const _0x22a569=_0xd2fdeb;_0x3e9723[_0x22a569(0x293)]=formatProgressMessage(_0x40dbaf);}};if(_0x161e93[_0xd2fdeb(0x1e4)])_0x58e69c[_0xd2fdeb(0x1e4)]=!![];if(_0x161e93[_0xd2fdeb(0x287)]&&typeof _0x161e93[_0xd2fdeb(0x287)]===_0xd2fdeb(0x1bd))_0x58e69c[_0xd2fdeb(0x287)]=_0x161e93[_0xd2fdeb(0x287)];if(_0x161e93['behavior']&&typeof _0x161e93[_0xd2fdeb(0x196)]===_0xd2fdeb(0x1bd))_0x58e69c[_0xd2fdeb(0x196)]=_0x161e93[_0xd2fdeb(0x196)];if(_0x161e93[_0xd2fdeb(0x20b)])_0x58e69c[_0xd2fdeb(0x20b)]=!![];if(_0x161e93['interval'])_0x58e69c[_0xd2fdeb(0x295)]=_0x161e93['interval'];let _0xa71b83;try{_0xa71b83=await _0x58555b['segment']['previewParentYaml'](_0x2e1bbf,_0x58e69c),_0x3e9723[_0xd2fdeb(0x25b)]();}catch(_0x497d30){_0x3e9723[_0xd2fdeb(0x25b)]();throw _0x497d30;}return await this[_0xd2fdeb(0x27f)](_0xa71b83,{'master':_0x161e93[_0xd2fdeb(0x1e4)],'attribute':typeof _0x161e93[_0xd2fdeb(0x287)]===_0xd2fdeb(0x1bd)?_0x161e93[_0xd2fdeb(0x287)]:undefined,'behavior':typeof _0x161e93[_0xd2fdeb(0x196)]===_0xd2fdeb(0x1bd)?_0x161e93['behavior']:undefined,'enriched':_0x161e93[_0xd2fdeb(0x20b)]}),_0xa71b83[_0xd2fdeb(0x2b9)]?0x0:0x1;}async['displayPreviewResults'](_0x3dd9f2,_0x10cf2f){const _0x59f9fb=a22_0x428e50;console['error']('\x0a'+a22_0x5c26e2[_0x59f9fb(0x1e9)](_0x59f9fb(0x220))+'\x20'+_0x3dd9f2[_0x59f9fb(0x204)]),console[_0x59f9fb(0x233)]('═'[_0x59f9fb(0x226)](0x3c));if(_0x10cf2f[_0x59f9fb(0x1e4)]&&_0x3dd9f2['sampleData']){const _0x7bb4ac=a22_0x5c26e2[_0x59f9fb(0x208)](_0x59f9fb(0x237))+'\x20'+a22_0x5c26e2[_0x59f9fb(0x1e9)](_0x3dd9f2[_0x59f9fb(0x1e4)]['database']+'.'+_0x3dd9f2['master'][_0x59f9fb(0x194)]);await this[_0x59f9fb(0x206)](_0x7bb4ac,_0x3dd9f2['sampleData']);}else{if(_0x10cf2f[_0x59f9fb(0x287)]&&_0x3dd9f2['sampleData']){const _0x2f64a8=a22_0x5c26e2[_0x59f9fb(0x208)]('Attribute:')+'\x20'+a22_0x5c26e2[_0x59f9fb(0x1e9)](_0x10cf2f[_0x59f9fb(0x287)]);await this[_0x59f9fb(0x206)](_0x2f64a8,_0x3dd9f2[_0x59f9fb(0x22f)]);}else{if(_0x10cf2f['behavior']&&_0x3dd9f2[_0x59f9fb(0x22f)]){const _0x23cd4b=a22_0x5c26e2[_0x59f9fb(0x208)]('Behavior:')+'\x20'+a22_0x5c26e2[_0x59f9fb(0x1e9)](_0x10cf2f[_0x59f9fb(0x196)]);await this[_0x59f9fb(0x206)](_0x23cd4b,_0x3dd9f2[_0x59f9fb(0x22f)]);}else{if(_0x10cf2f[_0x59f9fb(0x20b)]&&_0x3dd9f2[_0x59f9fb(0x22f)]){const _0x3dda61=a22_0x5c26e2['dim']('Enriched:')+'\x20'+a22_0x5c26e2[_0x59f9fb(0x1e9)](_0x59f9fb(0x1f2));await this[_0x59f9fb(0x206)](_0x3dda61,_0x3dd9f2['sampleData']);}else!_0x3dd9f2[_0x59f9fb(0x22f)]&&console[_0x59f9fb(0x233)](_0x59f9fb(0x1d2));}}}if(_0x3dd9f2[_0x59f9fb(0x2aa)][_0x59f9fb(0x228)]>0x0){console[_0x59f9fb(0x233)]('─'[_0x59f9fb(0x226)](0x3c)),console[_0x59f9fb(0x233)]('\x0a'+a22_0x5c26e2[_0x59f9fb(0x249)](_0x59f9fb(0x260)));for(const _0x7b7588 of _0x3dd9f2[_0x59f9fb(0x2aa)]){console[_0x59f9fb(0x233)]('\x20\x20'+a22_0x5c26e2[_0x59f9fb(0x249)]('•')+'\x20'+_0x7b7588);}}}async[a22_0x428e50(0x206)](_0x2146e5,_0x25f53a){const _0x2364a1=a22_0x428e50;if(_0x25f53a[_0x2364a1(0x228)]===0x0){console[_0x2364a1(0x233)]('\x0a'+_0x2146e5),console[_0x2364a1(0x233)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x2364a1(0x233)]('\x0a'+_0x2146e5);const _0x488e50=Object['keys'](_0x25f53a[0x0])[_0x2364a1(0x2b3)](_0x520a95=>({'name':_0x520a95,'type':typeof _0x25f53a[0x0][_0x520a95]==='number'?'double':'varchar'})),_0x4a10af={'queryId':_0x2364a1(0x1cc),'columns':_0x488e50,'data':_0x25f53a,'stats':{'state':_0x2364a1(0x266),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x25f53a[_0x2364a1(0x228)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x27e3e4=formatAsTable(_0x4a10af,_0x25f53a['length'],!![]);await writeOutput(_0x27e3e4,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x19e);[a22_0x428e50(0x241)]=a22_0x428e50(0x20f);async[a22_0x428e50(0x2a1)](_0x519bfc){const _0x58bc70=a22_0x428e50,{options:_0x1c9048,args:_0x3c6453,tdx:_0x1dd26e}=_0x519bfc,_0x49f9ba=_0x1c9048,_0x1aeb94=_0x3c6453[0x0]||_0x1c9048['parentSegment'];if(!_0x1aeb94)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x58bc70(0x2b0)),0x1;const _0x285333=resolveYamlFile(_0x1aeb94);if(existsSync(_0x285333)){_0x49f9ba[_0x58bc70(0x216)]&&console[_0x58bc70(0x233)](_0x58bc70(0x1cb)+_0x285333);let _0x34d942;try{_0x34d942=readFileSync(_0x285333,'utf-8');}catch(_0x3d1cf5){const _0x7bcc94=_0x3d1cf5 instanceof Error?_0x3d1cf5[_0x58bc70(0x1fa)]:String(_0x3d1cf5);return console[_0x58bc70(0x233)]('Error\x20reading\x20file:\x20'+_0x7bcc94),0x1;}const _0x123954=await withSpinner(_0x58bc70(0x190),()=>_0x1dd26e[_0x58bc70(0x28e)]['pushParentYaml'](_0x34d942),{'verbose':_0x49f9ba[_0x58bc70(0x216)]}),_0x35cbf4=_0x123954[_0x58bc70(0x1aa)],{isNew:_0x4a647b,name:_0x431c0f,hasChanges:_0x12a3bf,diffFormatted:_0x30e7e4}=_0x35cbf4;if(_0x12a3bf){_0x4a647b?console[_0x58bc70(0x233)](_0x58bc70(0x26b)+_0x431c0f+'\x27:'):console[_0x58bc70(0x233)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x431c0f+'\x27:');console['error']('─'[_0x58bc70(0x226)](0x3c)),console[_0x58bc70(0x233)](_0x30e7e4),console[_0x58bc70(0x233)]('─'[_0x58bc70(0x226)](0x3c));const _0x2371ab=_0x4a647b?'Create\x20parent\x20segment\x20\x27'+_0x431c0f+_0x58bc70(0x27c):_0x58bc70(0x277)+_0x431c0f+_0x58bc70(0x27c);if(!_0x49f9ba[_0x58bc70(0x1e7)]){const _0xa67c76=await confirmKey(_0x2371ab);if(!_0xa67c76)return console[_0x58bc70(0x233)](_0x58bc70(0x1c9)),0x1;}const _0x30c1ad=_0x4a647b?_0x58bc70(0x27a):'Updating';await withSpinner(_0x30c1ad+'\x20parent\x20segment\x20\x27'+_0x431c0f+_0x58bc70(0x1f6),()=>_0x35cbf4[_0x58bc70(0x2a5)](),{'verbose':_0x49f9ba[_0x58bc70(0x216)]});const _0x5870ea=_0x4a647b?_0x58bc70(0x1c7):_0x58bc70(0x1a5);console[_0x58bc70(0x233)]('✔\x20'+_0x5870ea+_0x58bc70(0x286)+_0x431c0f+'\x27');}else console[_0x58bc70(0x233)]('✔\x20No\x20changes\x20-\x20\x27'+_0x431c0f+_0x58bc70(0x1ad));}const _0x220bd1=await withSpinner(_0x58bc70(0x1bc)+_0x1aeb94+_0x58bc70(0x1f6),()=>_0x1dd26e[_0x58bc70(0x28e)][_0x58bc70(0x252)](_0x1aeb94),{'verbose':_0x49f9ba[_0x58bc70(0x216)]}),_0x560fa4=_0x220bd1[_0x58bc70(0x1aa)],_0x4883f7=getConsoleUrl(_0x49f9ba['site'],_0x58bc70(0x1e8)+_0x560fa4[_0x58bc70(0x26f)]+_0x58bc70(0x259)+_0x560fa4[_0x58bc70(0x1a2)]+_0x58bc70(0x1b9)+_0x560fa4[_0x58bc70(0x19d)]);return console['error'](_0x58bc70(0x1ca)),console[_0x58bc70(0x233)]('\x20\x20'+a22_0x5c26e2[_0x58bc70(0x208)](_0x58bc70(0x1b2))+'\x20'+_0x560fa4[_0x58bc70(0x201)]),console[_0x58bc70(0x233)]('\x20\x20'+a22_0x5c26e2[_0x58bc70(0x208)](_0x58bc70(0x1df))+'\x20'+_0x560fa4[_0x58bc70(0x239)]),console['error']('\x20\x20'+a22_0x5c26e2[_0x58bc70(0x208)](_0x58bc70(0x23f))+'\x20'+_0x560fa4[_0x58bc70(0x1a2)]),console[_0x58bc70(0x233)]('\x20\x20'+a22_0x5c26e2[_0x58bc70(0x208)](_0x58bc70(0x1ea))+'\x20'+_0x560fa4[_0x58bc70(0x19d)]),console['error']('\x20\x20'+_0x4883f7),console[_0x58bc70(0x233)]('\x0a'+a22_0x5c26e2[_0x58bc70(0x208)](_0x58bc70(0x2b7))+_0x58bc70(0x1ed)+_0x560fa4[_0x58bc70(0x19d)]+_0x58bc70(0x23a)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x1a3);['description']=a22_0x428e50(0x218);async[a22_0x428e50(0x2a1)](_0x50bc90){const _0x26113e=a22_0x428e50,{options:_0x45bcc1,args:_0x2aeb60,tdx:_0x14098b}=_0x50bc90,_0x4a12a6=_0x2aeb60[0x0]||_0x45bcc1[_0x26113e(0x25e)];if(!_0x4a12a6)return showParentSegmentNotSetError(_0x26113e(0x290)+_0x26113e(0x270)),0x1;_0x45bcc1[_0x26113e(0x216)]&&(console[_0x26113e(0x233)]('Site:\x20'+_0x45bcc1['site']),console['error'](_0x26113e(0x1d1)+_0x4a12a6));const _0x2cdca2=await withSpinner(_0x26113e(0x21d)+_0x4a12a6+_0x26113e(0x1f6),()=>_0x14098b[_0x26113e(0x28e)]['listFields'](_0x4a12a6),{'verbose':_0x45bcc1[_0x26113e(0x216)]}),_0x15804b=_0x2cdca2[_0x26113e(0x1aa)];console[_0x26113e(0x233)](_0x26113e(0x267)+_0x15804b['length']+_0x26113e(0x1f7)+(_0x15804b['length']!==0x1?'s':''));if(_0x45bcc1[_0x26113e(0x268)]||_0x45bcc1['jsonl'])return await handleSDKOutput(_0x15804b,_0x45bcc1),0x0;return displayFieldsHumanReadable(_0x15804b,_0x4a12a6),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x1f4);['description']=a22_0x428e50(0x221);async[a22_0x428e50(0x2a1)](_0x1a335b){const _0xb10f3f=a22_0x428e50,{options:_0x5c0a20,args:_0xf5d5c4,tdx:_0x14838a}=_0x1a335b,_0x2e2ccc=_0x5c0a20,_0x2aa8dd=_0xf5d5c4[0x0]||_0x5c0a20[_0xb10f3f(0x25e)];if(!_0x2aa8dd)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0xb10f3f(0x247)+_0xb10f3f(0x29e)+_0xb10f3f(0x23e)),0x1;_0x5c0a20['verbose']&&(console[_0xb10f3f(0x233)](_0xb10f3f(0x229)+_0x5c0a20[_0xb10f3f(0x1ce)]),console[_0xb10f3f(0x233)](_0xb10f3f(0x1d1)+_0x2aa8dd));const _0x34d778=await withSpinner(_0xb10f3f(0x1fb)+_0x2aa8dd+_0xb10f3f(0x1f6),()=>_0x14838a[_0xb10f3f(0x28e)][_0xb10f3f(0x289)](_0x2aa8dd),{'verbose':_0x5c0a20[_0xb10f3f(0x216)]}),_0x2b14d9=_0x34d778[_0xb10f3f(0x1aa)];if(_0x2e2ccc[_0xb10f3f(0x28c)]){const _0x314a65=getConsoleNextUrl(_0x2e2ccc[_0xb10f3f(0x1ce)],_0xb10f3f(0x198)+_0x2b14d9['id']);return console[_0xb10f3f(0x233)](a22_0x5c26e2[_0xb10f3f(0x261)]('✔')+'\x20Opening\x20'+a22_0x5c26e2[_0xb10f3f(0x27d)](_0x314a65)),openBrowser(_0x314a65),0x0;}return await handleSingleObjectOutput(_0x2b14d9,_0x5c0a20),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']='segment:parent:desc';[a22_0x428e50(0x241)]=a22_0x428e50(0x1da);async['execute'](_0x41e637){const _0x1f1b88=a22_0x428e50,{options:_0x353800,args:_0x40e51d,tdx:_0x1b3446}=_0x41e637,_0x2ce4b1=_0x40e51d[0x0]||_0x353800['parentSegment'];if(!_0x2ce4b1)return showParentSegmentNotSetError(_0x1f1b88(0x1ac)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x353800[_0x1f1b88(0x216)]&&(console[_0x1f1b88(0x233)](_0x1f1b88(0x229)+_0x353800[_0x1f1b88(0x1ce)]),console['error'](_0x1f1b88(0x1d1)+_0x2ce4b1));const _0x4cc35a=await withSpinner(_0x1f1b88(0x274)+_0x2ce4b1+'\x27...',()=>_0x1b3446['segment'][_0x1f1b88(0x276)](_0x2ce4b1),{'verbose':_0x353800['verbose']}),_0xa66def=_0x4cc35a[_0x1f1b88(0x1aa)],_0x121366=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2ce4b1+'\x27...',()=>_0x1b3446[_0x1f1b88(0x28e)]['getParentSQL'](_0xa66def),{'verbose':_0x353800[_0x1f1b88(0x216)]}),_0x4f9f06=await executeSchemaQuery(_0x121366[_0x1f1b88(0x1aa)],_0x1b3446,_0x353800);return await handleQueryOutput(_0x4f9f06,_0x353800),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x428e50(0x2a2);['description']=a22_0x428e50(0x2a9);async[a22_0x428e50(0x2a1)](_0x21c5ce){const _0x40b307=a22_0x428e50,{options:_0x25210c,args:_0x4d9f79,tdx:_0x551a21}=_0x21c5ce,_0x2b81da=_0x4d9f79[0x0]||_0x25210c[_0x40b307(0x25e)];if(!_0x2b81da)return showParentSegmentNotSetError(_0x40b307(0x1fd)+_0x40b307(0x281)),0x1;_0x25210c[_0x40b307(0x216)]&&(console[_0x40b307(0x233)](_0x40b307(0x229)+_0x25210c[_0x40b307(0x1ce)]),console[_0x40b307(0x233)](_0x40b307(0x1d1)+_0x2b81da));const _0x5426b7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2b81da+_0x40b307(0x1f6),()=>_0x551a21[_0x40b307(0x28e)][_0x40b307(0x276)](_0x2b81da),{'verbose':_0x25210c[_0x40b307(0x216)]}),_0x5b65c8=_0x5426b7[_0x40b307(0x1aa)],_0x273746=await withSpinner(_0x40b307(0x1d3)+_0x2b81da+'\x27...',()=>_0x551a21['segment']['getParentSQL'](_0x5b65c8),{'verbose':_0x25210c[_0x40b307(0x216)]}),_0x3a4e6e=_0x273746[_0x40b307(0x1aa)];return _0x25210c['format']===_0x40b307(0x268)||_0x25210c['format']===_0x40b307(0x232)?await handleSDKOutput([{'sql':_0x3a4e6e}],_0x25210c):console[_0x40b307(0x2a7)](_0x3a4e6e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x428e50(0x204)]=a22_0x428e50(0x1af);[a22_0x428e50(0x241)]=a22_0x428e50(0x1e1);async['execute'](_0x36e10f){const _0x89fd38=a22_0x428e50,{options:_0x34b3b0,args:_0x14955e,tdx:_0x8d916d}=_0x36e10f,_0x17bb6f=_0x14955e[0x0]||_0x34b3b0[_0x89fd38(0x25e)];if(!_0x17bb6f)return showParentSegmentNotSetError(_0x89fd38(0x243)+'\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;_0x34b3b0['verbose']&&(console[_0x89fd38(0x233)](_0x89fd38(0x229)+_0x34b3b0[_0x89fd38(0x1ce)]),console[_0x89fd38(0x233)](_0x89fd38(0x1d1)+_0x17bb6f));const _0x47e281=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x17bb6f+'\x27...',()=>_0x8d916d['segment'][_0x89fd38(0x276)](_0x17bb6f),{'verbose':_0x34b3b0['verbose']}),_0x2507c7=_0x47e281[_0x89fd38(0x1aa)],_0x13ba5e=await withSpinner(_0x89fd38(0x1d3)+_0x17bb6f+_0x89fd38(0x1f6),()=>_0x8d916d[_0x89fd38(0x28e)][_0x89fd38(0x248)](_0x2507c7),{'verbose':_0x34b3b0[_0x89fd38(0x216)]});let _0x210bd0=_0x13ba5e[_0x89fd38(0x1aa)];const _0x2678e0=resolveLimit(_0x34b3b0[_0x89fd38(0x20c)],DEFAULT_DISPLAY_LIMIT),_0x400d2d=/\bLIMIT\s+\d+/i[_0x89fd38(0x2ad)](_0x210bd0);!_0x400d2d&&(_0x210bd0=_0x210bd0[_0x89fd38(0x28f)]()['replace'](/;+$/,''),_0x210bd0='SELECT\x20*\x20FROM\x20(\x0a'+_0x210bd0+_0x89fd38(0x1be)+_0x2678e0);_0x34b3b0[_0x89fd38(0x216)]&&console[_0x89fd38(0x233)](_0x89fd38(0x29d)+_0x210bd0);const _0x6edb35=await withProgressSpinner(_0x89fd38(0x24d),async _0x5958cc=>{const _0x462bf5=_0x89fd38,_0x151fae=await _0x8d916d[_0x462bf5(0x28d)][_0x462bf5(0x2a1)](_0x210bd0,{'catalog':'td','schema':_0x462bf5(0x255),'onJobId':_0xaa4c4c=>{_0x5958cc['setJobId'](_0xaa4c4c);}});return _0x151fae;},{'verbose':_0x34b3b0[_0x89fd38(0x216)]}),_0x4d89cc=_0x6edb35[_0x89fd38(0x1aa)],_0x52f087=_0x4d89cc[_0x89fd38(0x26e)]?_0x89fd38(0x285)+_0x4d89cc[_0x89fd38(0x26e)]+']':'';return console[_0x89fd38(0x233)](_0x89fd38(0x280)+_0x4d89cc[_0x89fd38(0x1f9)][_0x89fd38(0x1ae)][_0x89fd38(0x283)]()+_0x89fd38(0x1ec)+(_0x89fd38(0x19c)+formatElapsed(_0x4d89cc[_0x89fd38(0x1f9)][_0x89fd38(0x23d)])+_0x52f087)),await handleQueryOutput(_0x4d89cc,_0x34b3b0),0x0;}}
|
|
1
|
+
const a22_0x56ccaf=a22_0x38e3;(function(_0x49749b,_0x1df1a4){const _0x4ff987=a22_0x38e3,_0x2feea2=_0x49749b();while(!![]){try{const _0xb4bbc1=-parseInt(_0x4ff987(0x12b))/0x1+parseInt(_0x4ff987(0x98))/0x2*(parseInt(_0x4ff987(0xac))/0x3)+-parseInt(_0x4ff987(0x1b5))/0x4*(-parseInt(_0x4ff987(0x113))/0x5)+parseInt(_0x4ff987(0x124))/0x6*(-parseInt(_0x4ff987(0x13c))/0x7)+-parseInt(_0x4ff987(0xd3))/0x8+parseInt(_0x4ff987(0x1b8))/0x9+parseInt(_0x4ff987(0xf6))/0xa;if(_0xb4bbc1===_0x1df1a4)break;else _0x2feea2['push'](_0x2feea2['shift']());}catch(_0x5b3044){_0x2feea2['push'](_0x2feea2['shift']());}}}(a22_0x3381,0x3fff8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x272d27 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}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 a22_0x3917cb from'chalk';function a22_0x38e3(_0x4555bd,_0x35f646){_0x4555bd=_0x4555bd-0x8c;const _0x3381a7=a22_0x3381();let _0x38e319=_0x3381a7[_0x4555bd];return _0x38e319;}import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x56ccaf(0xe0),LEGACY_PARENT_SEGMENT_DIR=a22_0x56ccaf(0xfa);function openBrowser(_0x481265){const _0x304544=a22_0x56ccaf,_0x838e3a=process[_0x304544(0xb3)],_0x439e80=_0x838e3a===_0x304544(0xe6)?_0x304544(0x11f):_0x838e3a===_0x304544(0x10e)?_0x304544(0x1b0):_0x304544(0x100);spawn(_0x439e80,[_0x481265],{'detached':!![],'stdio':_0x304544(0x172)})[_0x304544(0x102)]();}function migrateLegacyDirectory(){const _0x464378=a22_0x56ccaf;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x38a305=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x38a305['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x464378(0xc7)](a22_0x3917cb[_0x464378(0x1b2)](_0x464378(0x191)+LEGACY_PARENT_SEGMENT_DIR+_0x464378(0x109)+PARENT_SEGMENT_DIR+_0x464378(0xe1))),console['error'](a22_0x3917cb[_0x464378(0xdd)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x464378(0x112))),![];console[_0x464378(0xc7)](a22_0x3917cb[_0x464378(0x1b2)](_0x464378(0xc4)+LEGACY_PARENT_SEGMENT_DIR+_0x464378(0x110)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x464378(0xc7)](a22_0x3917cb['green']('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3145d5){const _0x3d5ea2=_0x3145d5 instanceof Error?_0x3145d5[_0x464378(0x141)]:String(_0x3145d5);return console[_0x464378(0xc7)](a22_0x3917cb[_0x464378(0x15e)](_0x464378(0x140)+_0x3d5ea2+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x56ccaf(0x171)](_0x125e32){return migrateLegacyDirectory(),super['run'](_0x125e32);}}function resolveYamlFile(_0x393f0c){const _0x5d542e=a22_0x56ccaf;if(_0x393f0c['endsWith'](_0x5d542e(0xbd))||_0x393f0c[_0x5d542e(0x99)](_0x5d542e(0x16c)))return _0x393f0c;return a22_0x272d27[_0x5d542e(0x165)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x393f0c)+'.yml');}function formatProgressMessage(_0x430005){const _0x12a350=a22_0x56ccaf,_0x2151d7=_0x430005[_0x12a350(0x198)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2151d7){const [,_0x1926a5,_0x136eed,_0x24bb4b='']=_0x2151d7;return a22_0x3917cb[_0x12a350(0xdd)](_0x1926a5+':')+'\x20'+_0x136eed+a22_0x3917cb['dim'](_0x24bb4b);}return a22_0x3917cb['dim'](_0x430005);}function showFileNotFoundError(_0x40bb3f,_0x56d6d4){const _0x4c6e44=a22_0x56ccaf;console[_0x4c6e44(0xc7)](a22_0x3917cb['red'](_0x4c6e44(0x1ae)+_0x40bb3f+'\x0a')),console['error'](a22_0x3917cb['cyan'](_0x4c6e44(0xfe)+_0x56d6d4+_0x4c6e44(0x14b)));}function showParentSegmentNotSetError(_0x457d1b){const _0x48eb81=a22_0x56ccaf;console[_0x48eb81(0xc7)](a22_0x3917cb[_0x48eb81(0x1b2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x457d1b);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x56ccaf(0x9b);[a22_0x56ccaf(0x1a5)]='List\x20parent\x20segments';async[a22_0x56ccaf(0x9c)](_0x335bf4){const _0x4e93e4=a22_0x56ccaf,{options:_0x210fe8,args:_0x2a6793,tdx:_0x52b15d}=_0x335bf4,_0x3f88fa=_0x2a6793[0x0];_0x210fe8[_0x4e93e4(0x139)]&&(console[_0x4e93e4(0xc7)](_0x4e93e4(0x17e)+_0x210fe8[_0x4e93e4(0xf2)]),_0x3f88fa&&console[_0x4e93e4(0xc7)](_0x4e93e4(0xb0)+_0x3f88fa));const _0x3ff882=await withSpinner(_0x3f88fa?_0x4e93e4(0x18c)+_0x3f88fa+_0x4e93e4(0x167):_0x4e93e4(0xd1),()=>_0x52b15d[_0x4e93e4(0x8f)][_0x4e93e4(0x15f)](),{'verbose':_0x210fe8[_0x4e93e4(0x139)]});let _0x1bec7f=_0x3ff882[_0x4e93e4(0xdf)];if(_0x3f88fa){const _0x422b32=_0x3f88fa['replace'](/[.+^${}()|[\]\\]/g,_0x4e93e4(0xc6))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x14c866=new RegExp('^'+_0x422b32+'$','i');_0x1bec7f=_0x1bec7f[_0x4e93e4(0x161)](_0xe8a5ee=>_0x14c866[_0x4e93e4(0x150)](_0xe8a5ee[_0x4e93e4(0x126)][_0x4e93e4(0x11b)]));}_0x1bec7f[_0x4e93e4(0xe5)]((_0x1f2094,_0x2e2b7f)=>_0x1f2094[_0x4e93e4(0x126)][_0x4e93e4(0x11b)]['localeCompare'](_0x2e2b7f[_0x4e93e4(0x126)]['name'])),console[_0x4e93e4(0xc7)](_0x4e93e4(0x17a)+_0x1bec7f[_0x4e93e4(0x18b)]+_0x4e93e4(0x195)+(_0x1bec7f['length']!==0x1?'s':''));if(_0x210fe8['format']===_0x4e93e4(0xf7)||_0x210fe8[_0x4e93e4(0xc8)]===_0x4e93e4(0x179))await handleSDKOutput(_0x1bec7f,_0x210fe8);else{if(_0x1bec7f[_0x4e93e4(0x18b)]===0x0)_0x3f88fa?console['log'](_0x4e93e4(0x170)+_0x3f88fa):console[_0x4e93e4(0x9f)](_0x4e93e4(0x154));else for(const _0x803219 of _0x1bec7f){const _0x467897=_0x803219[_0x4e93e4(0x126)][_0x4e93e4(0x15a)]?a22_0x3917cb[_0x4e93e4(0xdd)]('\x20('+formatRows(_0x803219[_0x4e93e4(0x126)][_0x4e93e4(0x15a)])+')'):'';console['log'](_0x4e93e4(0x9d)+_0x803219[_0x4e93e4(0x126)][_0x4e93e4(0x11b)]+_0x467897);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x10f);[a22_0x56ccaf(0x1a5)]=a22_0x56ccaf(0x16b);async[a22_0x56ccaf(0x9c)](_0x43387a){const _0x5a5cb5=a22_0x56ccaf,{options:_0x5a2068,args:_0x185d8c,tdx:_0x517090}=_0x43387a;console[_0x5a5cb5(0xc7)](_0x5a5cb5(0x18f)+_0x5a5cb5(0x158)+_0x5a5cb5(0x10c));const _0x37fac2=_0x5a2068;if(_0x185d8c['length']===0x0)return console[_0x5a5cb5(0xc7)](a22_0x3917cb[_0x5a5cb5(0x15e)](_0x5a5cb5(0x174))),console['error'](_0x5a5cb5(0x15d)),0x1;const _0x2ace9a=_0x185d8c[0x0];if(!_0x37fac2[_0x5a5cb5(0x142)]||!_0x37fac2[_0x5a5cb5(0xbe)])return console[_0x5a5cb5(0xc7)](_0x5a5cb5(0xaf)),console['error'](_0x5a5cb5(0x15d)),0x1;_0x37fac2[_0x5a5cb5(0x139)]&&(console[_0x5a5cb5(0xc7)]('Site:\x20'+_0x37fac2[_0x5a5cb5(0xf2)]),console[_0x5a5cb5(0xc7)](_0x5a5cb5(0x1af)+_0x2ace9a),console[_0x5a5cb5(0xc7)]('Database:\x20'+_0x37fac2['database']),console[_0x5a5cb5(0xc7)](_0x5a5cb5(0x103)+_0x37fac2[_0x5a5cb5(0xbe)]));const _0x2f576a=await loadJSONFromOptions(_0x37fac2[_0x5a5cb5(0x126)],_0x37fac2['attributesFile']),_0x210a17=await loadJSONFromOptions(_0x37fac2[_0x5a5cb5(0x10b)],_0x37fac2[_0x5a5cb5(0x114)]),_0x4ac27c=await loadJSONFromOptions(_0x37fac2[_0x5a5cb5(0x13d)],_0x37fac2[_0x5a5cb5(0xae)]),_0x1be297={'name':_0x2ace9a,'description':_0x37fac2[_0x5a5cb5(0x1a5)],'scheduleType':_0x37fac2[_0x5a5cb5(0x16a)],'scheduleOption':_0x37fac2['scheduleOption'],'timezone':_0x37fac2['timezone'],'master':{'parentDatabaseName':_0x37fac2['database'],'parentTableName':_0x37fac2[_0x5a5cb5(0xbe)]},'attributes':_0x2f576a,'behaviors':_0x210a17,'customerGroup':_0x4ac27c},_0x30e4db=await withSpinner(_0x5a5cb5(0xa1)+_0x2ace9a+_0x5a5cb5(0x167),()=>_0x517090[_0x5a5cb5(0x8f)][_0x5a5cb5(0x107)](_0x1be297),{'verbose':_0x5a2068[_0x5a5cb5(0x139)]}),_0x462160=_0x30e4db[_0x5a5cb5(0xdf)];return console[_0x5a5cb5(0xc7)](_0x5a5cb5(0x136)+_0x462160[_0x5a5cb5(0x11b)]+'\x27\x20with\x20ID:\x20'+_0x462160['id']),await handleSDKOutput([_0x462160],_0x5a2068),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x1a1);['description']=a22_0x56ccaf(0xd9);async['execute'](_0x24801b){const _0x3c76a7=a22_0x56ccaf,{options:_0xd6456f,args:_0x1d09d7,tdx:_0x4fafd9}=_0x24801b;console[_0x3c76a7(0xc7)](_0x3c76a7(0xce)+_0x3c76a7(0x158)+_0x3c76a7(0x10c));const _0x18e6f3=_0xd6456f;if(_0x1d09d7['length']===0x0)return console[_0x3c76a7(0xc7)](a22_0x3917cb['red'](_0x3c76a7(0x174))),console[_0x3c76a7(0xc7)](_0x3c76a7(0x137)),0x1;const _0x36c160=_0x1d09d7[0x0];_0x18e6f3[_0x3c76a7(0x139)]&&(console[_0x3c76a7(0xc7)](_0x3c76a7(0x17e)+_0x18e6f3[_0x3c76a7(0xf2)]),console['error'](_0x3c76a7(0x17d)+_0x36c160));const _0x350c71=await withSpinner(_0x3c76a7(0x17f)+_0x36c160+_0x3c76a7(0x167),()=>_0x4fafd9['segment'][_0x3c76a7(0x143)](_0x36c160),{'verbose':_0x18e6f3[_0x3c76a7(0x139)]}),_0x57b881=_0x350c71[_0x3c76a7(0xdf)],_0xc2940d=await loadJSONFromOptions(_0x18e6f3[_0x3c76a7(0x178)],_0x18e6f3[_0x3c76a7(0x16d)]),_0x1979fd=await loadJSONFromOptions(_0x18e6f3[_0x3c76a7(0xf0)],_0x18e6f3[_0x3c76a7(0xc0)]),_0xb6a977={'name':_0x57b881[_0x3c76a7(0x11b)],'description':_0x18e6f3['description']!==undefined?_0x18e6f3[_0x3c76a7(0x1a5)]:_0x57b881['description'],'scheduleType':_0x18e6f3[_0x3c76a7(0x16a)]!==undefined?_0x18e6f3[_0x3c76a7(0x16a)]:_0x57b881['scheduleType'],'scheduleOption':_0x18e6f3[_0x3c76a7(0x90)]!==undefined?_0x18e6f3['scheduleOption']:_0x57b881[_0x3c76a7(0x90)],'timezone':_0x18e6f3[_0x3c76a7(0xbb)]!==undefined?_0x18e6f3[_0x3c76a7(0xbb)]:_0x57b881[_0x3c76a7(0xbb)],'master':_0x57b881[_0x3c76a7(0xfb)],'attributes':_0xc2940d?[..._0x57b881['attributes']||[],..._0xc2940d]:_0x57b881[_0x3c76a7(0x126)],'behaviors':_0x1979fd?[..._0x57b881[_0x3c76a7(0x10b)]||[],..._0x1979fd]:_0x57b881['behaviors'],'customerGroup':_0x57b881[_0x3c76a7(0x13d)]},_0x59a687=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x36c160+'\x27...',()=>_0x4fafd9['segment']['updateParent'](_0x36c160,_0xb6a977),{'verbose':_0x18e6f3[_0x3c76a7(0x139)]}),_0x17b464=_0x59a687[_0x3c76a7(0xdf)];return console[_0x3c76a7(0xc7)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x17b464[_0x3c76a7(0x11b)]+'\x27'),await handleSDKOutput([_0x17b464],_0x18e6f3),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x56ccaf(0x1a2);[a22_0x56ccaf(0x1a5)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x56ccaf(0x9c)](_0x167b1c){const _0x19a639=a22_0x56ccaf,{options:_0x4a26e3,args:_0x3d891a,tdx:_0x4a682c}=_0x167b1c,_0x16adaf=_0x4a26e3,_0x4025b7=_0x3d891a[0x0]||_0x4a26e3['parentSegment'];if(!_0x4025b7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x16adaf['use']&&_0x16adaf[_0x19a639(0x14c)])return console[_0x19a639(0xc7)](a22_0x3917cb[_0x19a639(0x15e)](_0x19a639(0xa5))),console[_0x19a639(0xc7)](a22_0x3917cb[_0x19a639(0xdd)](_0x19a639(0x181))),console['error'](a22_0x3917cb[_0x19a639(0xdd)](_0x19a639(0x1bb)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x19a639(0xc7)](a22_0x3917cb[_0x19a639(0x19b)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x751b96=_0x16adaf[_0x19a639(0x14c)]||a22_0x272d27[_0x19a639(0x165)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4025b7)+_0x19a639(0xbd));_0x16adaf[_0x19a639(0x139)]&&(console[_0x19a639(0xc7)](_0x19a639(0x17e)+_0x16adaf[_0x19a639(0xf2)]),console[_0x19a639(0xc7)](_0x19a639(0x17d)+_0x4025b7),console[_0x19a639(0xc7)](_0x19a639(0x14e)+_0x751b96));const _0x8df5c9=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x4025b7+_0x19a639(0x167),()=>_0x4a682c[_0x19a639(0x8f)]['pullParentYaml'](_0x4025b7),{'verbose':_0x16adaf[_0x19a639(0x139)]}),_0x451bcd=_0x8df5c9[_0x19a639(0xdf)];if(existsSync(_0x751b96)){const _0xc48145=readFileSync(_0x751b96,'utf-8'),_0x791e14=generateDiff(_0xc48145,_0x451bcd);if(!hasChanges(_0x791e14))console[_0x19a639(0xc7)](a22_0x3917cb[_0x19a639(0x1b4)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x3917cb[_0x19a639(0x19b)](_0x751b96)+_0x19a639(0x19d));else{console['error'](_0x19a639(0x151)+_0x751b96+'\x27:'),console[_0x19a639(0xc7)]('─'[_0x19a639(0xff)](0x3c)),console[_0x19a639(0xc7)](formatDiffWithColors(_0x791e14)),console[_0x19a639(0xc7)]('─'['repeat'](0x3c));if(!_0x16adaf[_0x19a639(0x93)]){const _0x183a80=await confirmKey('Overwrite\x20\x27'+_0x751b96+'\x27?');if(!_0x183a80)return console[_0x19a639(0xc7)](_0x19a639(0x117)),0x1;}writeFileSync(_0x751b96,_0x451bcd,_0x19a639(0x1bc)),console[_0x19a639(0xc7)](a22_0x3917cb['green']('✔')+_0x19a639(0xed)+a22_0x3917cb[_0x19a639(0x19b)](_0x751b96));}}else{const _0x5cbae6=a22_0x272d27[_0x19a639(0x11e)](_0x751b96);!existsSync(_0x5cbae6)&&mkdirSync(_0x5cbae6,{'recursive':!![]}),writeFileSync(_0x751b96,_0x451bcd,_0x19a639(0x1bc)),console['error'](a22_0x3917cb[_0x19a639(0x1b4)]('✔')+_0x19a639(0xed)+a22_0x3917cb['cyan'](_0x751b96));}return saveSessionContext({'parent_segment':_0x4025b7},_0x16adaf[_0x19a639(0x115)]),console[_0x19a639(0xc7)](a22_0x3917cb[_0x19a639(0x1b4)]('✔')+'\x20Context\x20set:\x20'+a22_0x3917cb[_0x19a639(0xdd)](_0x19a639(0xfa))+_0x19a639(0x12d)+a22_0x3917cb[_0x19a639(0x19b)](_0x4025b7)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0xdc);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x16c0b5){const _0x56cf9c=a22_0x56ccaf,{options:_0x4dcdd,args:_0x5a98be,tdx:_0x930123}=_0x16c0b5,_0x385d81=_0x4dcdd,_0x456435=_0x5a98be[0x0]||_0x4dcdd[_0x56cf9c(0x8e)];if(!_0x456435)return showParentSegmentNotSetError(_0x56cf9c(0x189)+_0x56cf9c(0x166)),0x1;const _0x12d7d8=resolveYamlFile(_0x456435);if(!existsSync(_0x12d7d8))return showFileNotFoundError(_0x12d7d8,_0x456435),0x1;_0x385d81['verbose']&&(console['error']('Site:\x20'+_0x385d81[_0x56cf9c(0xf2)]),console[_0x56cf9c(0xc7)](_0x56cf9c(0xee)+_0x12d7d8));let _0x55fdbc;try{_0x55fdbc=readFileSync(_0x12d7d8,'utf-8');}catch(_0x5db29c){const _0x3c47e9=_0x5db29c instanceof Error?_0x5db29c[_0x56cf9c(0x141)]:String(_0x5db29c);return console[_0x56cf9c(0xc7)](_0x56cf9c(0x120)+_0x3c47e9),0x1;}const _0x51ff8d=await withSpinner('Analyzing\x20changes...',()=>_0x930123['segment']['pushParentYaml'](_0x55fdbc),{'verbose':_0x385d81[_0x56cf9c(0x139)]}),_0xf80a4=_0x51ff8d[_0x56cf9c(0xdf)],{isNew:_0x22c320,name:_0x5cba30,hasChanges:_0x5b03b6,diffFormatted:_0x228655}=_0xf80a4;if(!_0x5b03b6)return console['error'](_0x56cf9c(0xb4)+_0x5cba30+_0x56cf9c(0x94)),0x0;_0x22c320?console[_0x56cf9c(0xc7)](_0x56cf9c(0x173)+_0x5cba30+'\x27:'):console[_0x56cf9c(0xc7)](_0x56cf9c(0xa0)+_0x5cba30+'\x27:');console['error']('─'[_0x56cf9c(0xff)](0x3c)),console[_0x56cf9c(0xc7)](_0x228655),console[_0x56cf9c(0xc7)]('─'[_0x56cf9c(0xff)](0x3c));const _0x4765ac=_0x22c320?_0x56cf9c(0x118)+_0x5cba30+'\x27?':_0x56cf9c(0xc9)+_0x5cba30+'\x27?';if(!_0x385d81['yes']){const _0x26b47a=await confirmKey(_0x4765ac);if(!_0x26b47a)return console[_0x56cf9c(0xc7)](_0x56cf9c(0x117)),0x1;}const _0x11a16d=_0x22c320?_0x56cf9c(0x91):_0x56cf9c(0x19c),_0x3ec434=await withSpinner(_0x11a16d+_0x56cf9c(0x168)+_0x5cba30+_0x56cf9c(0x167),()=>_0xf80a4[_0x56cf9c(0x1a3)](),{'verbose':_0x385d81[_0x56cf9c(0x139)]}),_0x24dd91=_0x3ec434[_0x56cf9c(0xdf)],_0x4007a6=getConsoleNextUrl(_0x385d81[_0x56cf9c(0xf2)],_0x56cf9c(0xec)+_0x24dd91['id']),_0xc243e8=_0x22c320?'Created':'Updated';return console['error']('✔\x20'+_0xc243e8+_0x56cf9c(0x168)+_0x24dd91['name']+'\x27'),console[_0x56cf9c(0xc7)]('\x20\x20'+_0x4007a6),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x56ccaf(0x11b)]='segment:parent:validate';[a22_0x56ccaf(0x1a5)]=a22_0x56ccaf(0x1a6);async[a22_0x56ccaf(0x9c)](_0x482225){const _0x3ff8d3=a22_0x56ccaf,{options:_0x235db1,args:_0x585b3f,tdx:_0x55724f}=_0x482225,_0x38e64a=_0x235db1,_0x35583d=_0x585b3f[0x0]||_0x235db1['parentSegment'];if(!_0x35583d)return showParentSegmentNotSetError(_0x3ff8d3(0x192)+_0x3ff8d3(0xa6)+'Options:\x0a'+_0x3ff8d3(0xa8)+_0x3ff8d3(0x1ba)+_0x3ff8d3(0x13e)),0x1;const _0x31da4e=resolveYamlFile(_0x35583d);if(!existsSync(_0x31da4e))return showFileNotFoundError(_0x31da4e,_0x35583d),0x1;_0x38e64a['verbose']&&(console[_0x3ff8d3(0xc7)]('Site:\x20'+_0x38e64a[_0x3ff8d3(0xf2)]),console[_0x3ff8d3(0xc7)](_0x3ff8d3(0xee)+_0x31da4e));let _0x4dcf8c;try{_0x4dcf8c=readFileSync(_0x31da4e,_0x3ff8d3(0x1bc));}catch(_0x31cddc){const _0x48e63d=_0x31cddc instanceof Error?_0x31cddc[_0x3ff8d3(0x141)]:String(_0x31cddc);return console[_0x3ff8d3(0xc7)](_0x3ff8d3(0x120)+_0x48e63d),0x1;}const _0x5adefb=createCommandSpinner(a22_0x3917cb[_0x3ff8d3(0xdd)](_0x3ff8d3(0x18a)),{'verbose':_0x38e64a[_0x3ff8d3(0x139)]});_0x5adefb[_0x3ff8d3(0x1b0)]();const _0x14fd6a={'onProgress':_0x29beb6=>{const _0x2acf4d=_0x3ff8d3;_0x5adefb[_0x2acf4d(0x15c)]=formatProgressMessage(_0x29beb6);}};if(_0x38e64a[_0x3ff8d3(0xfb)])_0x14fd6a[_0x3ff8d3(0xfb)]=!![];if(_0x38e64a[_0x3ff8d3(0x160)])_0x14fd6a['enriched']=!![];_0x38e64a[_0x3ff8d3(0x175)]&&(_0x14fd6a[_0x3ff8d3(0x175)]=_0x38e64a[_0x3ff8d3(0x175)]);_0x38e64a['behavior']&&(_0x14fd6a[_0x3ff8d3(0xc3)]=_0x38e64a[_0x3ff8d3(0xc3)]);if(_0x38e64a['interval'])_0x14fd6a['interval']=_0x38e64a[_0x3ff8d3(0xd2)];let _0x30bb5e;try{_0x30bb5e=await _0x55724f[_0x3ff8d3(0x8f)][_0x3ff8d3(0x1b3)](_0x4dcf8c,_0x14fd6a),_0x5adefb[_0x3ff8d3(0x155)]();}catch(_0xc567ee){_0x5adefb[_0x3ff8d3(0x155)]();throw _0xc567ee;}const _0x42639f=_0x38e64a[_0x3ff8d3(0xd2)]||_0x3ff8d3(0x12a);return this[_0x3ff8d3(0xd6)](_0x30bb5e,_0x14fd6a,_0x31da4e,_0x42639f),_0x30bb5e[_0x3ff8d3(0x16e)]?0x0:0x1;}[a22_0x56ccaf(0xd6)](_0x1730c1,_0x307d75,_0x15be38,_0x4b95a4){const _0x35b30c=a22_0x56ccaf;console[_0x35b30c(0xc7)]('\x0a'+a22_0x3917cb[_0x35b30c(0xc1)]('Validate:')+'\x20'+_0x1730c1[_0x35b30c(0x11b)]),console['error']('═'[_0x35b30c(0xff)](0x3c)),this[_0x35b30c(0xd4)](_0x1730c1);if(typeof _0x307d75[_0x35b30c(0x175)]===_0x35b30c(0x19e)){this[_0x35b30c(0x19a)](_0x1730c1),this['displaySummary'](_0x1730c1),this[_0x35b30c(0xbf)](_0x15be38,_0x4b95a4,_0x35b30c(0x175),_0x307d75[_0x35b30c(0x175)]);return;}if(_0x307d75[_0x35b30c(0x175)]===!![]){this[_0x35b30c(0x19a)](_0x1730c1),this['displaySummary'](_0x1730c1),this[_0x35b30c(0xbf)](_0x15be38,_0x4b95a4,'attributes');return;}if(typeof _0x307d75[_0x35b30c(0xc3)]===_0x35b30c(0x19e)){this['displayBehaviorsStats'](_0x1730c1,_0x4b95a4),this[_0x35b30c(0x17b)](_0x1730c1),this[_0x35b30c(0xbf)](_0x15be38,_0x4b95a4,_0x35b30c(0xc3),_0x307d75[_0x35b30c(0xc3)]);return;}if(_0x307d75[_0x35b30c(0xc3)]===!![]){this[_0x35b30c(0x106)](_0x1730c1,_0x4b95a4),this[_0x35b30c(0x17b)](_0x1730c1),this[_0x35b30c(0xbf)](_0x15be38,_0x4b95a4,_0x35b30c(0x10b));return;}this[_0x35b30c(0x19a)](_0x1730c1),this['displayBehaviorsStats'](_0x1730c1,_0x4b95a4),this[_0x35b30c(0x17b)](_0x1730c1),this['displayPreviewHints'](_0x15be38,_0x4b95a4,'all');}[a22_0x56ccaf(0xbf)](_0x33566a,_0x437ffe,_0x2447d2,_0x618107){const _0x11f9d0=a22_0x56ccaf;console[_0x11f9d0(0xc7)]('\x0a'+a22_0x3917cb[_0x11f9d0(0xdd)](_0x11f9d0(0x1b7)));const _0x49bd7b=_0x437ffe!==_0x11f9d0(0x12a)?_0x11f9d0(0x1b9)+_0x437ffe:'';if(_0x2447d2===_0x11f9d0(0x175)&&_0x618107)console['error']('\x20\x20'+a22_0x3917cb[_0x11f9d0(0xdd)]('tdx\x20segment\x20parent\x20preview\x20'+_0x33566a+_0x11f9d0(0x12e)+_0x618107+'\x22'+_0x49bd7b));else{if(_0x2447d2===_0x11f9d0(0xc3)&&_0x618107)console[_0x11f9d0(0xc7)]('\x20\x20'+a22_0x3917cb[_0x11f9d0(0xdd)](_0x11f9d0(0x169)+_0x33566a+_0x11f9d0(0x1aa)+_0x618107+'\x22'+_0x49bd7b));else(_0x2447d2==='attributes'||_0x2447d2===_0x11f9d0(0xb7))&&console[_0x11f9d0(0xc7)]('\x20\x20'+a22_0x3917cb[_0x11f9d0(0xdd)](_0x11f9d0(0x169)+_0x33566a+_0x11f9d0(0xbc)+_0x49bd7b));}(_0x2447d2===_0x11f9d0(0x10b)||_0x2447d2===_0x11f9d0(0xb7))&&console[_0x11f9d0(0xc7)]('\x20\x20'+a22_0x3917cb[_0x11f9d0(0xdd)](_0x11f9d0(0x169)+_0x33566a+_0x11f9d0(0x104)+_0x49bd7b)),_0x2447d2===_0x11f9d0(0xb7)&&console[_0x11f9d0(0xc7)]('\x20\x20'+a22_0x3917cb[_0x11f9d0(0xdd)]('tdx\x20segment\x20parent\x20preview\x20'+_0x33566a+_0x11f9d0(0x177)+_0x49bd7b));}[a22_0x56ccaf(0xd4)](_0x5c811c){const _0x5b7826=a22_0x56ccaf,{master:_0x1a04ed}=_0x5c811c,_0x457174=_0x1a04ed['schemaValid']?a22_0x3917cb[_0x5b7826(0x1b4)]('✔'):a22_0x3917cb[_0x5b7826(0x15e)]('✘');console[_0x5b7826(0xc7)]('\x0a'+a22_0x3917cb[_0x5b7826(0xdd)](_0x5b7826(0x10d))),console[_0x5b7826(0xc7)](_0x457174+'\x20'+a22_0x3917cb[_0x5b7826(0xc1)](_0x1a04ed[_0x5b7826(0x142)]+'.'+_0x1a04ed['table'])),_0x1a04ed[_0x5b7826(0x97)]?_0x1a04ed[_0x5b7826(0x146)]!==undefined&&console[_0x5b7826(0xc7)]('\x20\x20'+a22_0x3917cb[_0x5b7826(0xdd)](_0x5b7826(0xfd))+'\x20'+a22_0x3917cb[_0x5b7826(0x19b)](formatRows(_0x1a04ed[_0x5b7826(0x146)]))):console[_0x5b7826(0xc7)]('\x20\x20'+a22_0x3917cb['red']('Error:')+'\x20'+_0x1a04ed[_0x5b7826(0x176)]);}[a22_0x56ccaf(0x19a)](_0x3ffea5){const _0xc425a1=a22_0x56ccaf;if(_0x3ffea5[_0xc425a1(0x126)][_0xc425a1(0x18b)]===0x0)return;console[_0xc425a1(0xc7)]('\x0a'+a22_0x3917cb['dim'](_0xc425a1(0x153)));for(const _0x35743f of _0x3ffea5[_0xc425a1(0x126)]){const _0xb73aef=_0x35743f[_0xc425a1(0x97)]?a22_0x3917cb['green']('✔'):a22_0x3917cb[_0xc425a1(0x15e)]('✘');let _0x56db75='';if(_0x35743f[_0xc425a1(0x97)]&&_0x35743f[_0xc425a1(0x1bd)]!==undefined&&_0x35743f[_0xc425a1(0x18d)]!==undefined){const _0x1759f4=_0x35743f['coveragePercent']['toFixed'](0x1),_0x160ab0=_0x35743f['coveragePercent']>=0x50?a22_0x3917cb[_0xc425a1(0x1b4)]:_0x35743f[_0xc425a1(0x18d)]>=0x32?a22_0x3917cb[_0xc425a1(0x1b2)]:a22_0x3917cb[_0xc425a1(0x15e)];_0x56db75='\x20'+a22_0x3917cb['dim'](_0xc425a1(0x190))+'\x20'+_0x160ab0(_0x1759f4+'%')+'\x20('+formatRows(_0x35743f[_0xc425a1(0x1bd)])+'\x20rows)';}console['error'](_0xb73aef+'\x20'+a22_0x3917cb[_0xc425a1(0xc1)](_0x35743f[_0xc425a1(0x11b)])+_0x56db75),console[_0xc425a1(0xc7)]('\x20\x20'+a22_0x3917cb[_0xc425a1(0xdd)](_0xc425a1(0xb6))+'\x20'+a22_0x3917cb[_0xc425a1(0xc1)](_0x35743f[_0xc425a1(0x142)]+'.'+_0x35743f[_0xc425a1(0xbe)]));const _0x2620bd=_0x35743f[_0xc425a1(0xa9)]===_0x35743f['foreignKey']?a22_0x3917cb[_0xc425a1(0xdd)](_0xc425a1(0xef))+'\x20'+_0x35743f['joinKey']:a22_0x3917cb[_0xc425a1(0xdd)](_0xc425a1(0x1a7))+'\x20'+_0x35743f[_0xc425a1(0xa9)]+_0xc425a1(0x12d)+_0x35743f[_0xc425a1(0x148)];console[_0xc425a1(0xc7)]('\x20\x20'+_0x2620bd),console[_0xc425a1(0xc7)]('\x20\x20'+a22_0x3917cb[_0xc425a1(0xdd)]('Columns:')),this[_0xc425a1(0xda)](_0x35743f[_0xc425a1(0xea)]),!_0x35743f[_0xc425a1(0x97)]&&console[_0xc425a1(0xc7)]('\x20\x20'+a22_0x3917cb[_0xc425a1(0x15e)](_0xc425a1(0xd0))+'\x20'+_0x35743f['schemaError']);}}['displayBehaviorsStats'](_0x2c954a,_0x3575dd){const _0x3f0b30=a22_0x56ccaf;if(_0x2c954a[_0x3f0b30(0x10b)]['length']===0x0)return;console[_0x3f0b30(0xc7)]('\x0a'+a22_0x3917cb[_0x3f0b30(0xdd)]('Behaviors')+'\x20'+a22_0x3917cb[_0x3f0b30(0xdd)]('('+_0x3575dd+')'));for(const _0xce533e of _0x2c954a['behaviors']){const _0x585391=_0xce533e[_0x3f0b30(0x97)]?a22_0x3917cb['green']('✔'):a22_0x3917cb[_0x3f0b30(0x15e)]('✘');let _0x18a2dc='';if(_0xce533e[_0x3f0b30(0x97)]&&_0xce533e[_0x3f0b30(0xcc)]!==undefined&&_0xce533e[_0x3f0b30(0xe3)]!==undefined){const _0x22d453=_0xce533e['customerPercent']?.[_0x3f0b30(0x157)](0x1)||'?',_0xdd4dd5=(_0xce533e[_0x3f0b30(0xe9)]??0x0)>=0x32?a22_0x3917cb[_0x3f0b30(0x1b4)]:(_0xce533e[_0x3f0b30(0xe9)]??0x0)>=0x14?a22_0x3917cb['yellow']:a22_0x3917cb[_0x3f0b30(0x15e)];_0x18a2dc='\x20'+a22_0x3917cb[_0x3f0b30(0xdd)]('Customers:')+'\x20'+_0xdd4dd5(formatRows(_0xce533e[_0x3f0b30(0xcc)]))+'\x20('+_0x22d453+'%)\x20'+a22_0x3917cb[_0x3f0b30(0xdd)](_0x3f0b30(0x14d))+'\x20'+a22_0x3917cb[_0x3f0b30(0x19b)](formatRows(_0xce533e[_0x3f0b30(0xe3)]));}console[_0x3f0b30(0xc7)](_0x585391+'\x20'+a22_0x3917cb['bold'](_0xce533e[_0x3f0b30(0x11b)])+_0x18a2dc),console[_0x3f0b30(0xc7)]('\x20\x20'+a22_0x3917cb['dim'](_0x3f0b30(0xb6))+'\x20'+a22_0x3917cb[_0x3f0b30(0xc1)](_0xce533e[_0x3f0b30(0x142)]+'.'+_0xce533e[_0x3f0b30(0xbe)]));const _0x94aefd=_0xce533e['joinKey']===_0xce533e[_0x3f0b30(0x148)]?a22_0x3917cb[_0x3f0b30(0xdd)](_0x3f0b30(0xef))+'\x20'+_0xce533e[_0x3f0b30(0xa9)]:a22_0x3917cb['dim']('Join:')+'\x20'+_0xce533e[_0x3f0b30(0xa9)]+'\x20=\x20'+_0xce533e[_0x3f0b30(0x148)];console[_0x3f0b30(0xc7)]('\x20\x20'+_0x94aefd),console[_0x3f0b30(0xc7)]('\x20\x20'+a22_0x3917cb['dim'](_0x3f0b30(0x187))),this[_0x3f0b30(0xda)](_0xce533e['columns']),!_0xce533e[_0x3f0b30(0x97)]&&console[_0x3f0b30(0xc7)]('\x20\x20'+a22_0x3917cb[_0x3f0b30(0x15e)](_0x3f0b30(0xd0))+'\x20'+_0xce533e['schemaError']);}}[a22_0x56ccaf(0xda)](_0x185537){const _0x1db6b5=a22_0x56ccaf;for(const _0x2ec083 of _0x185537){_0x2ec083[_0x1db6b5(0x163)]===_0x2ec083[_0x1db6b5(0x101)]||_0x2ec083[_0x1db6b5(0x101)]==='*'?console[_0x1db6b5(0xc7)](_0x1db6b5(0x125)+_0x2ec083[_0x1db6b5(0x163)]):console[_0x1db6b5(0xc7)]('\x20\x20\x20\x20-\x20'+_0x2ec083[_0x1db6b5(0x163)]+'\x20'+a22_0x3917cb[_0x1db6b5(0xdd)]('('+_0x2ec083[_0x1db6b5(0x101)]+')'));}}[a22_0x56ccaf(0x17b)](_0x305030){const _0x1c23af=a22_0x56ccaf;console[_0x1c23af(0xc7)]('─'[_0x1c23af(0xff)](0x3c));if(_0x305030['errors']['length']>0x0){console[_0x1c23af(0xc7)]('\x0a'+a22_0x3917cb[_0x1c23af(0x15e)](_0x1c23af(0x147)));for(const _0x4b05d3 of _0x305030[_0x1c23af(0xf9)]){console['error']('\x20\x20'+a22_0x3917cb[_0x1c23af(0x15e)]('•')+'\x20'+_0x4b05d3);}}_0x305030[_0x1c23af(0x16e)]&&console['error']('\x0a'+a22_0x3917cb['green']('✔')+_0x1c23af(0xf1));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x199);[a22_0x56ccaf(0x1a5)]=a22_0x56ccaf(0x193);async[a22_0x56ccaf(0x9c)](_0x19fe9e){const _0x100cb3=a22_0x56ccaf,{options:_0x106092,args:_0x1bfb26,tdx:_0x169526}=_0x19fe9e,_0x53bd80=_0x106092,_0xadf344=_0x1bfb26[0x0]||_0x106092[_0x100cb3(0x8e)];if(!_0xadf344)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'+_0x100cb3(0xcf)+_0x100cb3(0x119)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x100cb3(0x12f)+_0x100cb3(0x13e)),0x1;if(!_0x53bd80['master']&&!_0x53bd80['attribute']&&!_0x53bd80['behavior']&&!_0x53bd80[_0x100cb3(0x160)])return console[_0x100cb3(0xc7)](a22_0x3917cb[_0x100cb3(0x15e)](_0x100cb3(0x92))),console['error'](_0x100cb3(0x130)),console[_0x100cb3(0xc7)](_0x100cb3(0xf5)),console[_0x100cb3(0xc7)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x100cb3(0xc7)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x100cb3(0xc7)](_0x100cb3(0x183)),console[_0x100cb3(0xc7)](_0x100cb3(0xad)),0x1;const _0x3601a5=resolveYamlFile(_0xadf344);if(!existsSync(_0x3601a5))return showFileNotFoundError(_0x3601a5,_0xadf344),0x1;_0x53bd80['verbose']&&(console[_0x100cb3(0xc7)](_0x100cb3(0x17e)+_0x53bd80[_0x100cb3(0xf2)]),console[_0x100cb3(0xc7)]('YAML\x20file:\x20'+_0x3601a5));let _0x143faf;try{_0x143faf=readFileSync(_0x3601a5,_0x100cb3(0x1bc));}catch(_0x13d6b2){const _0x43a053=_0x13d6b2 instanceof Error?_0x13d6b2[_0x100cb3(0x141)]:String(_0x13d6b2);return console[_0x100cb3(0xc7)](_0x100cb3(0x120)+_0x43a053),0x1;}let _0x433ef2;try{_0x433ef2=parseDef(_0x143faf);}catch(_0xe4070c){const _0x422edd=_0xe4070c instanceof Error?_0xe4070c[_0x100cb3(0x141)]:String(_0xe4070c);return console[_0x100cb3(0xc7)](a22_0x3917cb['red'](_0x100cb3(0x10a)+_0x422edd)),0x1;}if(_0x53bd80[_0x100cb3(0x175)]===!![]||_0x53bd80[_0x100cb3(0x175)]===''){const _0x287526=_0x433ef2['attributes']?.[_0x100cb3(0xd7)](_0x58ac0c=>_0x58ac0c[_0x100cb3(0x11b)])||[];if(_0x287526[_0x100cb3(0x18b)]===0x0)console[_0x100cb3(0xc7)](a22_0x3917cb['red'](_0x100cb3(0xf3)));else{console[_0x100cb3(0xc7)](a22_0x3917cb[_0x100cb3(0x15e)](_0x100cb3(0x182))),console['error']('Available\x20attributes:');for(const _0x512ade of _0x287526){console['error']('\x20\x20'+a22_0x3917cb['cyan'](_0x512ade));}console[_0x100cb3(0xc7)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0xadf344+_0x100cb3(0x12e)+_0x287526[0x0]+'\x22');}return 0x1;}if(_0x53bd80[_0x100cb3(0xc3)]===!![]||_0x53bd80['behavior']===''){const _0x19a609=_0x433ef2['behaviors']?.[_0x100cb3(0xd7)](_0x1f6bb0=>_0x1f6bb0['name'])||[];if(_0x19a609['length']===0x0)console[_0x100cb3(0xc7)](a22_0x3917cb[_0x100cb3(0x15e)](_0x100cb3(0xb8)));else{console[_0x100cb3(0xc7)](a22_0x3917cb[_0x100cb3(0x15e)](_0x100cb3(0x19f))),console[_0x100cb3(0xc7)](_0x100cb3(0x188));for(const _0x5543dd of _0x19a609){console[_0x100cb3(0xc7)]('\x20\x20'+a22_0x3917cb[_0x100cb3(0x19b)](_0x5543dd));}console[_0x100cb3(0xc7)](_0x100cb3(0x1ac)+_0xadf344+_0x100cb3(0x1aa)+_0x19a609[0x0]+'\x22');}return 0x1;}const _0x2cfbcb=createCommandSpinner(a22_0x3917cb[_0x100cb3(0xdd)](_0x100cb3(0x196)),{'verbose':_0x53bd80[_0x100cb3(0x139)]});_0x2cfbcb[_0x100cb3(0x1b0)]();const _0x24d158={'onProgress':_0x1342cf=>{const _0x547536=_0x100cb3;_0x2cfbcb[_0x547536(0x15c)]=formatProgressMessage(_0x1342cf);}};if(_0x53bd80[_0x100cb3(0xfb)])_0x24d158['master']=!![];if(_0x53bd80[_0x100cb3(0x175)]&&typeof _0x53bd80[_0x100cb3(0x175)]===_0x100cb3(0x19e))_0x24d158[_0x100cb3(0x175)]=_0x53bd80[_0x100cb3(0x175)];if(_0x53bd80[_0x100cb3(0xc3)]&&typeof _0x53bd80['behavior']==='string')_0x24d158[_0x100cb3(0xc3)]=_0x53bd80[_0x100cb3(0xc3)];if(_0x53bd80[_0x100cb3(0x160)])_0x24d158[_0x100cb3(0x160)]=!![];if(_0x53bd80[_0x100cb3(0xd2)])_0x24d158[_0x100cb3(0xd2)]=_0x53bd80[_0x100cb3(0xd2)];let _0x51c4c6;try{_0x51c4c6=await _0x169526[_0x100cb3(0x8f)]['previewParentYaml'](_0x143faf,_0x24d158),_0x2cfbcb[_0x100cb3(0x155)]();}catch(_0x7270ce){_0x2cfbcb[_0x100cb3(0x155)]();throw _0x7270ce;}return await this['displayPreviewResults'](_0x51c4c6,{'master':_0x53bd80[_0x100cb3(0xfb)],'attribute':typeof _0x53bd80[_0x100cb3(0x175)]===_0x100cb3(0x19e)?_0x53bd80['attribute']:undefined,'behavior':typeof _0x53bd80[_0x100cb3(0xc3)]==='string'?_0x53bd80[_0x100cb3(0xc3)]:undefined,'enriched':_0x53bd80[_0x100cb3(0x160)]}),_0x51c4c6[_0x100cb3(0x16e)]?0x0:0x1;}async['displayPreviewResults'](_0x1137da,_0x505821){const _0x1b60e2=a22_0x56ccaf;console[_0x1b60e2(0xc7)]('\x0a'+a22_0x3917cb['bold'](_0x1b60e2(0x149))+'\x20'+_0x1137da[_0x1b60e2(0x11b)]),console[_0x1b60e2(0xc7)]('═'[_0x1b60e2(0xff)](0x3c));if(_0x505821['master']&&_0x1137da[_0x1b60e2(0x1b1)]){const _0x107021=a22_0x3917cb['dim'](_0x1b60e2(0x135))+'\x20'+a22_0x3917cb[_0x1b60e2(0xc1)](_0x1137da[_0x1b60e2(0xfb)]['database']+'.'+_0x1137da[_0x1b60e2(0xfb)][_0x1b60e2(0xbe)]);await this[_0x1b60e2(0x184)](_0x107021,_0x1137da[_0x1b60e2(0x1b1)]);}else{if(_0x505821[_0x1b60e2(0x175)]&&_0x1137da[_0x1b60e2(0x1b1)]){const _0x33f9b4=a22_0x3917cb['dim'](_0x1b60e2(0x96))+'\x20'+a22_0x3917cb[_0x1b60e2(0xc1)](_0x505821[_0x1b60e2(0x175)]);await this['displaySampleData'](_0x33f9b4,_0x1137da[_0x1b60e2(0x1b1)]);}else{if(_0x505821[_0x1b60e2(0xc3)]&&_0x1137da[_0x1b60e2(0x1b1)]){const _0x2f0b61=a22_0x3917cb[_0x1b60e2(0xdd)](_0x1b60e2(0x145))+'\x20'+a22_0x3917cb[_0x1b60e2(0xc1)](_0x505821['behavior']);await this['displaySampleData'](_0x2f0b61,_0x1137da['sampleData']);}else{if(_0x505821['enriched']&&_0x1137da['sampleData']){const _0x396c7f=a22_0x3917cb['dim'](_0x1b60e2(0xdb))+'\x20'+a22_0x3917cb[_0x1b60e2(0xc1)](_0x1b60e2(0x15b));await this['displaySampleData'](_0x396c7f,_0x1137da[_0x1b60e2(0x1b1)]);}else!_0x1137da[_0x1b60e2(0x1b1)]&&console[_0x1b60e2(0xc7)](_0x1b60e2(0x144));}}}if(_0x1137da[_0x1b60e2(0xf9)][_0x1b60e2(0x18b)]>0x0){console['error']('─'[_0x1b60e2(0xff)](0x3c)),console[_0x1b60e2(0xc7)]('\x0a'+a22_0x3917cb['red']('Errors:'));for(const _0x47deec of _0x1137da[_0x1b60e2(0xf9)]){console[_0x1b60e2(0xc7)]('\x20\x20'+a22_0x3917cb[_0x1b60e2(0x15e)]('•')+'\x20'+_0x47deec);}}}async[a22_0x56ccaf(0x184)](_0x1411f4,_0x3fc9f4){const _0x226e91=a22_0x56ccaf;if(_0x3fc9f4['length']===0x0){console[_0x226e91(0xc7)]('\x0a'+_0x1411f4),console[_0x226e91(0xc7)](_0x226e91(0x11a));return;}console['error']('\x0a'+_0x1411f4);const _0x56dd6f=Object[_0x226e91(0xab)](_0x3fc9f4[0x0])[_0x226e91(0xd7)](_0x12eda0=>({'name':_0x12eda0,'type':typeof _0x3fc9f4[0x0][_0x12eda0]===_0x226e91(0x131)?_0x226e91(0x95):_0x226e91(0x8c)})),_0x3f4db0={'queryId':_0x226e91(0x116),'columns':_0x56dd6f,'data':_0x3fc9f4,'stats':{'state':_0x226e91(0x111),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3fc9f4[_0x226e91(0x18b)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2338db=formatAsTable(_0x3f4db0,_0x3fc9f4['length'],!![]);await writeOutput(_0x2338db,undefined,_0x226e91(0xbe));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x9a);[a22_0x56ccaf(0x1a5)]=a22_0x56ccaf(0x152);async['execute'](_0x240f0a){const _0x50b9f5=a22_0x56ccaf,{options:_0x3b9b39,args:_0x2d81d2,tdx:_0x4c334c}=_0x240f0a,_0x487620=_0x3b9b39,_0x2671ac=_0x2d81d2[0x0]||_0x3b9b39['parentSegment'];if(!_0x2671ac)return showParentSegmentNotSetError(_0x50b9f5(0x1a4)+_0x50b9f5(0xd5)),0x1;const _0x262349=resolveYamlFile(_0x2671ac);if(existsSync(_0x262349)){_0x487620[_0x50b9f5(0x139)]&&console[_0x50b9f5(0xc7)]('Found\x20YAML\x20file:\x20'+_0x262349);let _0x1c6cb8;try{_0x1c6cb8=readFileSync(_0x262349,'utf-8');}catch(_0x25b2da){const _0x47b5f8=_0x25b2da instanceof Error?_0x25b2da['message']:String(_0x25b2da);return console['error'](_0x50b9f5(0x120)+_0x47b5f8),0x1;}const _0x18629b=await withSpinner(_0x50b9f5(0x14a),()=>_0x4c334c['segment']['pushParentYaml'](_0x1c6cb8),{'verbose':_0x487620[_0x50b9f5(0x139)]}),_0x402629=_0x18629b[_0x50b9f5(0xdf)],{isNew:_0x110903,name:_0x3a8903,hasChanges:_0x21847f,diffFormatted:_0x15e0f5}=_0x402629;if(_0x21847f){_0x110903?console[_0x50b9f5(0xc7)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3a8903+'\x27:'):console[_0x50b9f5(0xc7)](_0x50b9f5(0xa0)+_0x3a8903+'\x27:');console['error']('─'[_0x50b9f5(0xff)](0x3c)),console[_0x50b9f5(0xc7)](_0x15e0f5),console['error']('─'[_0x50b9f5(0xff)](0x3c));const _0x49d400=_0x110903?_0x50b9f5(0x118)+_0x3a8903+_0x50b9f5(0x1a9):_0x50b9f5(0xc9)+_0x3a8903+_0x50b9f5(0x1a9);if(!_0x487620['yes']){const _0x1d7cdb=await confirmKey(_0x49d400);if(!_0x1d7cdb)return console[_0x50b9f5(0xc7)](_0x50b9f5(0x117)),0x1;}const _0x36a4c4=_0x110903?_0x50b9f5(0x91):_0x50b9f5(0x19c);await withSpinner(_0x36a4c4+_0x50b9f5(0x168)+_0x3a8903+_0x50b9f5(0x167),()=>_0x402629['apply'](),{'verbose':_0x487620[_0x50b9f5(0x139)]});const _0x2fb08a=_0x110903?_0x50b9f5(0x16f):_0x50b9f5(0xb2);console[_0x50b9f5(0xc7)]('✔\x20'+_0x2fb08a+_0x50b9f5(0x168)+_0x3a8903+'\x27');}else console[_0x50b9f5(0xc7)](_0x50b9f5(0xb4)+_0x3a8903+_0x50b9f5(0xa4));}const _0x344093=await withSpinner(_0x50b9f5(0x134)+_0x2671ac+_0x50b9f5(0x167),()=>_0x4c334c['segment'][_0x50b9f5(0xa2)](_0x2671ac),{'verbose':_0x487620['verbose']}),_0xe6276=_0x344093['data'],_0x355200=getConsoleUrl(_0x487620[_0x50b9f5(0xf2)],_0x50b9f5(0x17c)+_0xe6276[_0x50b9f5(0x159)]+_0x50b9f5(0xb1)+_0xe6276[_0x50b9f5(0x123)]+_0x50b9f5(0x8d)+_0xe6276[_0x50b9f5(0x13b)]);return console['error'](_0x50b9f5(0x132)),console[_0x50b9f5(0xc7)]('\x20\x20'+a22_0x3917cb[_0x50b9f5(0xdd)](_0x50b9f5(0xf8))+'\x20'+_0xe6276[_0x50b9f5(0x127)]),console[_0x50b9f5(0xc7)]('\x20\x20'+a22_0x3917cb[_0x50b9f5(0xdd)](_0x50b9f5(0x14f))+'\x20'+_0xe6276['status']),console[_0x50b9f5(0xc7)]('\x20\x20'+a22_0x3917cb[_0x50b9f5(0xdd)]('Session:')+'\x20'+_0xe6276['workflowSessionId']),console['error']('\x20\x20'+a22_0x3917cb['dim']('Attempt:')+'\x20'+_0xe6276['workflowAttemptId']),console[_0x50b9f5(0xc7)]('\x20\x20'+_0x355200),console[_0x50b9f5(0xc7)]('\x0a'+a22_0x3917cb[_0x50b9f5(0xdd)](_0x50b9f5(0x164))+_0x50b9f5(0x185)+_0xe6276[_0x50b9f5(0x13b)]+_0x50b9f5(0xc5)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0xb5);[a22_0x56ccaf(0x1a5)]='List\x20available\x20fields\x20for\x20segmentation';async[a22_0x56ccaf(0x9c)](_0x2a4093){const _0x5a2294=a22_0x56ccaf,{options:_0x47a1b6,args:_0xeadb01,tdx:_0x240335}=_0x2a4093,_0xb81d72=_0xeadb01[0x0]||_0x47a1b6['parentSegment'];if(!_0xb81d72)return showParentSegmentNotSetError(_0x5a2294(0xf4)+_0x5a2294(0xe8)),0x1;_0x47a1b6[_0x5a2294(0x139)]&&(console[_0x5a2294(0xc7)](_0x5a2294(0x17e)+_0x47a1b6[_0x5a2294(0xf2)]),console[_0x5a2294(0xc7)]('Parent\x20segment:\x20'+_0xb81d72));const _0x1484a2=await withSpinner(_0x5a2294(0xe7)+_0xb81d72+_0x5a2294(0x167),()=>_0x240335['segment'][_0x5a2294(0x133)](_0xb81d72),{'verbose':_0x47a1b6[_0x5a2294(0x139)]}),_0x47647b=_0x1484a2[_0x5a2294(0xdf)];console[_0x5a2294(0xc7)](_0x5a2294(0x17a)+_0x47647b[_0x5a2294(0x18b)]+_0x5a2294(0x1ab)+(_0x47647b[_0x5a2294(0x18b)]!==0x1?'s':''));if(_0x47a1b6[_0x5a2294(0xf7)]||_0x47a1b6[_0x5a2294(0x179)])return await handleSDKOutput(_0x47647b,_0x47a1b6),0x0;return displayFieldsHumanReadable(_0x47647b,_0xb81d72),0x0;}}function a22_0x3381(){const _0x20dd3b=['Analyzing\x20changes...','`\x20to\x20download\x20the\x20configuration\x20first','output','Events:','Output\x20file:\x20','Status:','test','\x0aChanges\x20to\x20\x27','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Attributes','No\x20parent\x20segments\x20found','stop','\x20[Job\x20ID:\x20','toFixed','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','workflowId','population','Master\x20+\x20Attributes','text','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','red','listParents','enriched','filter','information_schema','label','To\x20cancel:','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x27...','\x20parent\x20segment\x20\x27','tdx\x20segment\x20parent\x20preview\x20','scheduleType','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','.yaml','addAttributesFile','allValid','Created','No\x20parent\x20segments\x20match\x20pattern:\x20','run','ignore','\x0aNew\x20parent\x20segment\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','attribute','schemaError','\x20--enriched','addAttributes','jsonl','✔\x20Found\x20','displaySummary','/app/workflows/','Parent\x20segment:\x20','Site:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Get\x20SQL\x20query\x20for\x20parent\x20segment','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','displaySampleData','\x20tdx\x20wf\x20attempt\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Columns:','Available\x20behaviors:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Validating\x20configuration...','length','Listing\x20parent\x20segments\x20matching\x20\x27','coveragePercent','Fetching\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Coverage:','\x0a⚠️\x20\x20Both\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','web','\x20parent\x20segment','Fetching\x20sample\x20data...','segment:parent:desc','match','segment:parent:preview','displayAttributesStats','cyan','Updating','\x20is\x20already\x20up\x20to\x20date','string','Error:\x20--behavior\x20requires\x20a\x20name\x0a','setJobId','segment:parent:update','segment:parent:pull','apply','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','description','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Join:','segment:parent:sql','\x27\x20and\x20run\x20workflow?','\x20--behavior\x20\x22','\x20field','\x0aUsage:\x20tdx\x20ps\x20preview\x20','resolveParentId','Error:\x20File\x20not\x20found:\x20','Name:\x20','start','sampleData','yellow','validateParentYaml','green','8IXsBeB','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','To\x20view\x20sample\x20data:','3465522lSQqXV','\x20--interval\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','using\x20the\x20default\x20path:\x20','utf-8','matchedCount','varchar','/attempt/','parentSegment','segment','scheduleOption','Creating','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','yes','\x27\x20is\x20already\x20up\x20to\x20date','double','Attribute:','schemaValid','17988qQaBYC','endsWith','segment:parent:run','segment:parent:list','execute','👥\x20','Options:\x0a','log','\x0aChanges\x20to\x20apply\x20to\x20\x27','Creating\x20parent\x20segment\x20\x27','runParent','toLocaleString','\x27\x20is\x20up\x20to\x20date','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','getParentSQL','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','joinKey','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','keys','129BhNDCI','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','customerGroupFile','Error:\x20--database\x20and\x20--table\x20are\x20required','Pattern:\x20','/sessions/','Updated','platform','✔\x20No\x20changes\x20-\x20\x27','segment:parent:fields','Source:','all','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','in\x20','trim','timezone','\x20--attribute\x20\x22<name>\x22','.yml','table','displayPreviewHints','addBehaviorsFile','bold','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','behavior','\x0a⚠️\x20\x20Migrating:\x20','\x20kill','\x5c$&','error','format','Apply\x20changes\x20to\x20\x27','processedRows','limit','customersWithEvents','SELECT\x20*\x20FROM\x20(\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Error:','Listing\x20parent\x20segments...','interval','4188864bKlWxG','displayMasterInfo','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','displayValidateResults','map','stats','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','displayColumns','Enriched:','segment:parent:push','dim','jobId','data','parent_segments','/\x20directories\x20exist.','Resolving\x20parent\x20segment\x20\x27','totalEvents','\x20Opening\x20','sort','darwin','Listing\x20fields\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','customerPercent','columns','Show\x20parent\x20segment\x20details','/app/dw/parentSegments/','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','YAML\x20file:\x20','Join\x20on:','addBehaviors','\x20Configuration\x20is\x20valid','site','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Options:','7194160XmsZif','json','Audience\x20ID:','errors','parent_segment','master','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Rows:','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','repeat','xdg-open','column','unref','Table:\x20','\x20--behavior\x20\x22<name>\x22','SQL\x20query:\x0a','displayBehaviorsStats','createParent','Show\x20parent\x20segment\x20schema\x20(column\x20types)','/\x20and\x20','Error\x20parsing\x20YAML:\x20','behaviors','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Master\x20Table','win32','segment:parent:create','/\x20→\x20','FINISHED','/\x20directory.\x0a','141745wCQVFL','behaviorsFile','session','preview','Aborted.','Create\x20parent\x20segment\x20\x27','Options\x20(one\x20required):\x0a','\x20\x20No\x20sample\x20data\x20available','name','Fetching\x20SQL\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','dirname','open','Error\x20reading\x20file:\x20','Executing\x20parent\x20segment\x20query...','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','workflowSessionId','10956QaLBEo','\x20\x20\x20\x20-\x20','attributes','audienceId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','-1d','258194VQTofK','segment:parent:show','\x20=\x20','\x20--attribute\x20\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','number','\x0a✔\x20Workflow\x20started','listFields','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Master:','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','✔\x20Query\x20completed:\x20Processed\x20','verbose','replace','workflowAttemptId','1932wcAQvX','customerGroup','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','message','database','getParentFull','\x0aNo\x20sample\x20data\x20available','Behavior:','rowCount','Errors:','foreignKey','Preview:'];a22_0x3381=function(){return _0x20dd3b;};return a22_0x3381();}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]='segment:parent:view';['description']=a22_0x56ccaf(0xeb);async[a22_0x56ccaf(0x9c)](_0x5419ea){const _0x88457b=a22_0x56ccaf,{options:_0x3d456a,args:_0x205b07,tdx:_0x51f43f}=_0x5419ea,_0x256eef=_0x3d456a,_0x23d39e=_0x205b07[0x0]||_0x3d456a[_0x88457b(0x8e)];if(!_0x23d39e)return showParentSegmentNotSetError(_0x88457b(0x122)+_0x88457b(0x1b6)+_0x88457b(0x9e)+_0x88457b(0xc2)),0x1;_0x3d456a[_0x88457b(0x139)]&&(console['error'](_0x88457b(0x17e)+_0x3d456a['site']),console[_0x88457b(0xc7)](_0x88457b(0x17d)+_0x23d39e));const _0xffedcc=await withSpinner(_0x88457b(0x18e)+_0x23d39e+_0x88457b(0x167),()=>_0x51f43f[_0x88457b(0x8f)]['getParentFull'](_0x23d39e),{'verbose':_0x3d456a['verbose']}),_0x2a10e5=_0xffedcc['data'];if(_0x256eef[_0x88457b(0x194)]){const _0x48bcf8=getConsoleNextUrl(_0x256eef[_0x88457b(0xf2)],'/app/dw/parentSegments/'+_0x2a10e5['id']);return console[_0x88457b(0xc7)](a22_0x3917cb[_0x88457b(0x1b4)]('✔')+_0x88457b(0xe4)+a22_0x3917cb[_0x88457b(0x19b)](_0x48bcf8)),openBrowser(_0x48bcf8),0x0;}return await handleSingleObjectOutput(_0x2a10e5,_0x3d456a),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a22_0x56ccaf(0x197);['description']=a22_0x56ccaf(0x108);async[a22_0x56ccaf(0x9c)](_0x1ae46e){const _0xf6fb7a=a22_0x56ccaf,{options:_0x39c848,args:_0x8e242,tdx:_0x2782fb}=_0x1ae46e,_0x301d66=_0x8e242[0x0]||_0x39c848['parentSegment'];if(!_0x301d66)return showParentSegmentNotSetError(_0xf6fb7a(0x13f)+_0xf6fb7a(0x128)),0x1;_0x39c848[_0xf6fb7a(0x139)]&&(console['error'](_0xf6fb7a(0x17e)+_0x39c848['site']),console[_0xf6fb7a(0xc7)](_0xf6fb7a(0x17d)+_0x301d66));const _0x571ae2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x301d66+_0xf6fb7a(0x167),()=>_0x2782fb[_0xf6fb7a(0x8f)][_0xf6fb7a(0x1ad)](_0x301d66),{'verbose':_0x39c848[_0xf6fb7a(0x139)]}),_0x1d747a=_0x571ae2['data'],_0x128fa0=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x301d66+_0xf6fb7a(0x167),()=>_0x2782fb['segment'][_0xf6fb7a(0xa7)](_0x1d747a),{'verbose':_0x39c848[_0xf6fb7a(0x139)]}),_0x50aadb=await executeSchemaQuery(_0x128fa0[_0xf6fb7a(0xdf)],_0x2782fb,_0x39c848);return await handleQueryOutput(_0x50aadb,_0x39c848),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x1a8);['description']=a22_0x56ccaf(0x180);async[a22_0x56ccaf(0x9c)](_0x535f16){const _0x523358=a22_0x56ccaf,{options:_0x320ad5,args:_0x23e5ae,tdx:_0x242820}=_0x535f16,_0x494989=_0x23e5ae[0x0]||_0x320ad5['parentSegment'];if(!_0x494989)return showParentSegmentNotSetError(_0x523358(0x186)+_0x523358(0x129)),0x1;_0x320ad5[_0x523358(0x139)]&&(console['error'](_0x523358(0x17e)+_0x320ad5[_0x523358(0xf2)]),console[_0x523358(0xc7)]('Parent\x20segment:\x20'+_0x494989));const _0x5d14be=await withSpinner(_0x523358(0xe2)+_0x494989+'\x27...',()=>_0x242820['segment'][_0x523358(0x1ad)](_0x494989),{'verbose':_0x320ad5['verbose']}),_0x4c61dd=_0x5d14be[_0x523358(0xdf)],_0x28f16f=await withSpinner(_0x523358(0x11c)+_0x494989+_0x523358(0x167),()=>_0x242820[_0x523358(0x8f)][_0x523358(0xa7)](_0x4c61dd),{'verbose':_0x320ad5[_0x523358(0x139)]}),_0x99362f=_0x28f16f[_0x523358(0xdf)];return _0x320ad5[_0x523358(0xc8)]===_0x523358(0xf7)||_0x320ad5[_0x523358(0xc8)]==='jsonl'?await handleSDKOutput([{'sql':_0x99362f}],_0x320ad5):console[_0x523358(0x9f)](_0x99362f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x56ccaf(0x11b)]=a22_0x56ccaf(0x12c);[a22_0x56ccaf(0x1a5)]=a22_0x56ccaf(0xaa);async[a22_0x56ccaf(0x9c)](_0x51c04b){const _0x385cd2=a22_0x56ccaf,{options:_0x16e572,args:_0x2c4a79,tdx:_0x2890ec}=_0x51c04b,_0x29bdd8=_0x2c4a79[0x0]||_0x16e572[_0x385cd2(0x8e)];if(!_0x29bdd8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x385cd2(0xfc)),0x1;_0x16e572[_0x385cd2(0x139)]&&(console[_0x385cd2(0xc7)]('Site:\x20'+_0x16e572[_0x385cd2(0xf2)]),console[_0x385cd2(0xc7)](_0x385cd2(0x17d)+_0x29bdd8));const _0x3bdec8=await withSpinner(_0x385cd2(0xe2)+_0x29bdd8+_0x385cd2(0x167),()=>_0x2890ec[_0x385cd2(0x8f)][_0x385cd2(0x1ad)](_0x29bdd8),{'verbose':_0x16e572[_0x385cd2(0x139)]}),_0x99c4be=_0x3bdec8[_0x385cd2(0xdf)],_0x117b2d=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x29bdd8+_0x385cd2(0x167),()=>_0x2890ec[_0x385cd2(0x8f)][_0x385cd2(0xa7)](_0x99c4be),{'verbose':_0x16e572['verbose']});let _0x4f0976=_0x117b2d['data'];const _0x33ba82=resolveLimit(_0x16e572[_0x385cd2(0xcb)],DEFAULT_DISPLAY_LIMIT),_0x753993=/\bLIMIT\s+\d+/i[_0x385cd2(0x150)](_0x4f0976);!_0x753993&&(_0x4f0976=_0x4f0976[_0x385cd2(0xba)]()[_0x385cd2(0x13a)](/;+$/,''),_0x4f0976=_0x385cd2(0xcd)+_0x4f0976+_0x385cd2(0x11d)+_0x33ba82);_0x16e572[_0x385cd2(0x139)]&&console[_0x385cd2(0xc7)](_0x385cd2(0x105)+_0x4f0976);const _0x5e448c=await withProgressSpinner(_0x385cd2(0x121),async _0x11c1ce=>{const _0x16b7ff=_0x385cd2,_0x35eae7=await _0x2890ec['query'][_0x16b7ff(0x9c)](_0x4f0976,{'catalog':'td','schema':_0x16b7ff(0x162),'onJobId':_0x1b9104=>{const _0x5c6b4c=_0x16b7ff;_0x11c1ce[_0x5c6b4c(0x1a0)](_0x1b9104);}});return _0x35eae7;},{'verbose':_0x16e572['verbose']}),_0x2aca8d=_0x5e448c['data'],_0x564199=_0x2aca8d[_0x385cd2(0xde)]?_0x385cd2(0x156)+_0x2aca8d[_0x385cd2(0xde)]+']':'';return console['error'](_0x385cd2(0x138)+_0x2aca8d[_0x385cd2(0xd8)][_0x385cd2(0xca)][_0x385cd2(0xa3)]()+'\x20rows\x20'+(_0x385cd2(0xb9)+formatElapsed(_0x2aca8d[_0x385cd2(0xd8)]['elapsedTimeMillis'])+_0x564199)),await handleQueryOutput(_0x2aca8d,_0x16e572),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a23_0xb2a28e=a23_0x573a;function a23_0x27bd(){const _0x24af00=['message','length','1853679mMhCCI','scope','error','10083227inGDMN','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','1334245jYwLri','5605712nZDema','2435642npbxhp','\x20\x20Global:\x20~/.config/tdx/tdx.json','name','description','366786WjavuZ','5OdElvU','5011416YYiOPE','profiles','Error:\x20','map'];a23_0x27bd=function(){return _0x24af00;};return a23_0x27bd();}(function(_0x4c7edd,_0x2a2621){const _0x2fc029=a23_0x573a,_0x308c3b=_0x4c7edd();while(!![]){try{const _0x1522e1=-parseInt(_0x2fc029(0xe2))/0x1+parseInt(_0x2fc029(0xe4))/0x2+parseInt(_0x2fc029(0xdc))/0x3+parseInt(_0x2fc029(0xea))/0x4+parseInt(_0x2fc029(0xe9))/0x5*(-parseInt(_0x2fc029(0xe8))/0x6)+-parseInt(_0x2fc029(0xdf))/0x7+parseInt(_0x2fc029(0xe3))/0x8;if(_0x1522e1===_0x2a2621)break;else _0x308c3b['push'](_0x308c3b['shift']());}catch(_0x45041f){_0x308c3b['push'](_0x308c3b['shift']());}}}(a23_0x27bd,0xe8c65));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a23_0x573a(_0x5623e3,_0x49f64e){_0x5623e3=_0x5623e3-0xda;const _0x27bdae=a23_0x27bd();let _0x573a01=_0x27bdae[_0x5623e3];return _0x573a01;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0xb2a28e(0xe6)]=a23_0xb2a28e(0xeb);[a23_0xb2a28e(0xe7)]='List\x20all\x20available\x20profiles';async['execute'](_0x2c18a6){const _0x42250f=a23_0xb2a28e,{options:_0x164d47}=_0x2c18a6;try{const _0x2821cf=listProfiles(),_0xabfa68=getActiveProfile();if(_0x2821cf[_0x42250f(0xdb)]===0x0)return console[_0x42250f(0xe1)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x42250f(0xe0)),console[_0x42250f(0xe1)](_0x42250f(0xe5)),0x0;const _0x32ffc1=_0x2821cf[_0x42250f(0xed)](_0x5cb7eb=>{const _0x36f8cf=_0x42250f,_0x439763=_0x5cb7eb[_0x36f8cf(0xe6)]===_0xabfa68,_0x35595a=getProfileParams(_0x5cb7eb['config']);return{'name':_0x5cb7eb[_0x36f8cf(0xe6)],'active':_0x439763,'scope':_0x5cb7eb[_0x36f8cf(0xdd)],'description':_0x5cb7eb['config'][_0x36f8cf(0xe7)]||'','params':_0x35595a};});return await handleSDKOutput(_0x32ffc1,_0x164d47),0x0;}catch(_0xf866f9){return _0xf866f9 instanceof Error&&console[_0x42250f(0xde)](_0x42250f(0xec)+_0xf866f9[_0x42250f(0xda)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x3d7fdb=a24_0x35d6;(function(_0x58eff0,_0x5a4f97){const _0x5a5703=a24_0x35d6,_0x46fda4=_0x58eff0();while(!![]){try{const _0x98dc1c=-parseInt(_0x5a5703(0x101))/0x1+parseInt(_0x5a5703(0xee))/0x2+-parseInt(_0x5a5703(0x10b))/0x3+-parseInt(_0x5a5703(0x110))/0x4*(-parseInt(_0x5a5703(0xe8))/0x5)+parseInt(_0x5a5703(0x106))/0x6*(-parseInt(_0x5a5703(0xe2))/0x7)+parseInt(_0x5a5703(0x104))/0x8*(parseInt(_0x5a5703(0xf2))/0x9)+parseInt(_0x5a5703(0x10d))/0xa*(-parseInt(_0x5a5703(0xdd))/0xb);if(_0x98dc1c===_0x5a4f97)break;else _0x46fda4['push'](_0x46fda4['shift']());}catch(_0x101864){_0x46fda4['push'](_0x46fda4['shift']());}}}(a24_0x7d0e,0x7ccf4));import{BaseCommand}from'./command.js';function a24_0x35d6(_0x5552eb,_0x4365af){_0x5552eb=_0x5552eb-0xdc;const _0x7d0e03=a24_0x7d0e();let _0x35d653=_0x7d0e03[_0x5552eb];return _0x35d653;}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';function a24_0x7d0e(){const _0x1dd7d4=['message','36BxOODM','setJobId','jobId','setPhase','validate','Run\x20Trino\x20queries\x20(streaming)','Schema:\x20','Statement\x20','verbose','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','file','Catalog:\x20','Executing\x20query\x20[','output','...','237210fQkOkf','\x20rows\x20','stats','971728EWmqJF','args','53286EWIJVL','processedRows','setExtra','No\x20SQL\x20provided','query','170586xDLKQb','\x20-\x20','167760kErloq','execute','Site:\x20','4FWwiPV','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','options','341sqgnGn','originalMessage','length','database','description','91yDMCCw','Executing\x20statement\x20','in\x20','Query\x20completed:\x20Processed\x20','error','\x20splits','717845HTGvDv','completedSplits','Executing\x20query...','\x20[Job\x20ID:\x20','data','Error:\x20','1622736BJUbuP','name','state'];a24_0x7d0e=function(){return _0x1dd7d4;};return a24_0x7d0e();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x3d7fdb(0xef)]=a24_0x3d7fdb(0x10a);[a24_0x3d7fdb(0xe1)]=a24_0x3d7fdb(0xf7);async[a24_0x3d7fdb(0x10e)](_0x49d24f){const _0x39fdf1=a24_0x3d7fdb,{options:_0x13a966,args:_0x57c7b9,tdx:_0x143acf}=_0x49d24f,_0xd20ac8=_0x57c7b9[0x0],_0x1cc0a9=_0x13a966[_0x39fdf1(0xfc)];let _0x24eec8;try{if(_0x1cc0a9)_0x24eec8=readSqlStatementsFromFile(_0x1cc0a9);else{if(_0xd20ac8==='-')_0x24eec8=await readSqlStatementsFromStdin();else{if(_0xd20ac8&&isSqlFilePath(_0xd20ac8))_0x24eec8=readSqlStatementsFromFile(_0xd20ac8);else{if(_0xd20ac8)_0x24eec8=splitSqlStatements(_0xd20ac8);else throw new Error(_0x39fdf1(0x109));}}}}catch(_0x144c14){return console[_0x39fdf1(0xe6)](_0x39fdf1(0xed)+_0x144c14[_0x39fdf1(0xf1)]),0x1;}const _0x556d96=_0x13a966[_0x39fdf1(0xe0)]||'information_schema',_0x111c95=_0x13a966['catalog'];try{const _0x278140=[],_0x3d9d24=!!_0x13a966[_0x39fdf1(0xff)];for(let _0x158f45=0x0;_0x158f45<_0x24eec8[_0x39fdf1(0xdf)];_0x158f45++){const _0x4be512=_0x24eec8[_0x158f45],_0x43e3c5=_0x158f45+0x1,_0x369015=_0x24eec8['length'],_0x22a97f=_0x369015>0x1;_0x13a966['verbose']&&(console[_0x39fdf1(0xe6)]('\x0a'+(_0x22a97f?_0x39fdf1(0xf9)+_0x43e3c5+'/'+_0x369015+':':'')),console[_0x39fdf1(0xe6)](_0x39fdf1(0x10f)+_0x13a966['site']),console[_0x39fdf1(0xe6)](_0x39fdf1(0xfd)+(_0x111c95||'td')),console['error'](_0x39fdf1(0xf8)+_0x556d96),console[_0x39fdf1(0xe6)]('SQL:\x20'+_0x4be512));const _0x57bbd1=_0x22a97f?_0x39fdf1(0xe3)+_0x43e3c5+'/'+_0x369015+_0x39fdf1(0x100):_0x39fdf1(0xea);try{const _0x2ecdc1=await withProgressSpinner(_0x57bbd1,async _0x54b935=>{const _0x333c91=_0x39fdf1,_0xfd2511=await _0x143acf['query'][_0x333c91(0x10e)](_0x4be512,{'catalog':_0x111c95,'schema':_0x556d96,'onJobId':_0x45f073=>{const _0x270bb4=_0x333c91;_0x54b935[_0x270bb4(0xf3)](_0x45f073);},'onProgress':_0x58cbf5=>{const _0x1f5c77=_0x333c91;_0x54b935[_0x1f5c77(0xf5)](_0x1f5c77(0xfe)+_0x58cbf5[_0x1f5c77(0xf0)]+']'),_0x54b935[_0x1f5c77(0x108)](formatRows(_0x58cbf5[_0x1f5c77(0x107)])+_0x1f5c77(0x102)+_0x58cbf5[_0x1f5c77(0xe9)]+'/'+_0x58cbf5['totalSplits']+_0x1f5c77(0xe7));}});return _0xfd2511;},{'verbose':_0x13a966[_0x39fdf1(0xfa)]}),_0x1cdeac=_0x2ecdc1[_0x39fdf1(0xec)],_0x3a8098=_0x1cdeac[_0x39fdf1(0xf4)]?_0x39fdf1(0xeb)+_0x1cdeac[_0x39fdf1(0xf4)]+']':'',_0x3b2dd0=_0x22a97f?_0x39fdf1(0xf9)+_0x43e3c5+'/'+_0x369015+_0x39fdf1(0x10c):'';console[_0x39fdf1(0xe6)]('✔\x20'+_0x3b2dd0+_0x39fdf1(0xe5)+formatRows(_0x1cdeac[_0x39fdf1(0x103)][_0x39fdf1(0x107)])+_0x39fdf1(0x102)+(_0x39fdf1(0xe4)+formatElapsed(_0x1cdeac['stats']['elapsedTimeMillis'])+_0x3a8098));if(_0x22a97f&&_0x3d9d24){const _0x28a3a6=resolveOutputOptions(_0x13a966),_0x2d02ff=await formatQueryOutput(_0x1cdeac,_0x28a3a6);_0x278140['push'](_0x2d02ff);}else await handleQueryOutput(_0x1cdeac,_0x13a966);}catch(_0x11c18c){const _0x9c7738=_0x22a97f?_0x39fdf1(0xf9)+_0x43e3c5+'/'+_0x369015+':\x0a':'',_0x933600=_0x11c18c instanceof SDKError?_0x11c18c[_0x39fdf1(0xde)]:_0x11c18c['message'];return console[_0x39fdf1(0xe6)](''+_0x9c7738+_0x933600),0x1;}}if(_0x24eec8[_0x39fdf1(0xdf)]>0x1&&_0x3d9d24&&_0x278140['length']>0x0){const _0xc7723e=_0x278140['join']('\x0a');writeFileSync(_0x13a966[_0x39fdf1(0xff)],_0xc7723e),console[_0x39fdf1(0xe6)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x13a966[_0x39fdf1(0xff)]);}return 0x0;}catch(_0x1740f7){throw _0x1740f7;}}[a24_0x3d7fdb(0xf6)](_0x1e37a2){const _0x49666b=a24_0x3d7fdb,_0x2624d8=_0x1e37a2[_0x49666b(0x105)][0x0],_0x15aa64=_0x1e37a2[_0x49666b(0xdc)]['file'];if(!_0x2624d8&&!_0x15aa64)return _0x49666b(0x111);if(_0x2624d8&&_0x15aa64)return _0x49666b(0xfb);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a25_0x4d4a(){const _0x413cc9=['getSegmentSQL','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','folderPath','Resolving\x20path\x20\x27','✔\x20Found\x20','Fetching\x20folder\x20details...','message','\x20\x20Segment\x20name:\x20','Use:\x20tdx\x20ps\x20desc','\x27...','4MpIojy','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segment','Executing\x20segment\x20query...','Resolved\x20type:\x20','Parent\x20ID:\x20','stats','test','jobId','Examples:','Segment\x20ID\x20missing\x20from\x20resolved\x20path','✔\x20Query\x20completed:\x20Processed\x20','site','Folder\x20ID:\x20','(root)','trim','SQL\x20query:\x0a','Target\x20path:\x20','elapsedTimeMillis','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','getParent','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','3788240hFuaAA','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','6LdvxiU','\x20\x20Cause:\x20','url','/app/ps/','replace','/e/','resolveFolderId','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','SEGMENT_NOT_FOUND','query','Resolving\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','name','type','listFolders','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','getSegment','folderId','Usage:\x20tdx\x20sg\x20show\x20<name>','672444pGOpkN','execute','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20Folder\x20path:\x20','1983879jEGTwg','Fetching\x20SQL\x20for\x20segment...','Fetching\x20segment\x20details...','length','Use:\x20tdx\x20ps\x20show','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20folder','folder','resolvePathToResource','segment:folder:list','parentFolder','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','resolveParentId','in\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','cause','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment:desc','verbose','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','json','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segmentId','Parent\x20segment:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20parent\x20segment\x20details...','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','SEGMENT_FOLDER_NOT_FOUND','createFolder','segment:sql','✖\x20Query\x20failed\x20[','error','toLocaleString','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','setJobId','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','cyan','limit','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Site:\x20','Error:\x20Folder\x20reference\x20is\x20required','segment:folder:show','3212455uOwrSO','Use:\x20tdx\x20ps\x20view','data','Resolved\x20YAML\x20file:\x20','parentSegment','log','parentId','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view\x20-w','parent','\x20rows\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','segment:folder:create','description','getFolder','✔\x20Created\x20folder\x20\x27','segmentPath','Show\x20segment\x20or\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','format','processedRows','Error:\x20','Parent\x20name:\x20','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','458269IuNVWH','Resolved\x20parent\x20ID:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','2471721WYgaQL','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20[Job\x20ID:\x20','10OmGYHZ','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20\x27','Resolved\x20relative\x20path\x20to:\x20','segment:show','INVALID_ARGUMENT','Use:\x20tdx\x20ps\x20sql','1284399iNHMUr'];a25_0x4d4a=function(){return _0x413cc9;};return a25_0x4d4a();}const a25_0x84662d=a25_0x4a74;(function(_0x3afbd3,_0x94d702){const _0x739f4b=a25_0x4a74,_0x2a169e=_0x3afbd3();while(!![]){try{const _0x4c55d4=parseInt(_0x739f4b(0x1d2))/0x1+parseInt(_0x739f4b(0x21c))/0x2+-parseInt(_0x739f4b(0x1e2))/0x3*(parseInt(_0x739f4b(0x1ed))/0x4)+parseInt(_0x739f4b(0x24e))/0x5*(-parseInt(_0x739f4b(0x208))/0x6)+parseInt(_0x739f4b(0x1d7))/0x7+parseInt(_0x739f4b(0x205))/0x8+parseInt(_0x739f4b(0x220))/0x9*(-parseInt(_0x739f4b(0x1db))/0xa);if(_0x4c55d4===_0x94d702)break;else _0x2a169e['push'](_0x2a169e['shift']());}catch(_0x363d65){_0x2a169e['push'](_0x2a169e['shift']());}}}(a25_0x4d4a,0x50955));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a25_0x4a74(_0x2d6bba,_0x501b9c){_0x2d6bba=_0x2d6bba-0x1b7;const _0x4d4a50=a25_0x4d4a();let _0x4a7447=_0x4d4a50[_0x2d6bba];return _0x4a7447;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x4d6f96 from'chalk';async function resolveSegmentTarget(_0xf59013,_0x503ccb,_0x354bc4){const _0x56c4d4=a25_0x4a74;if(isYamlFilePath(_0xf59013))try{const _0x201b6a=await resolveYamlFilePath(_0xf59013);return _0x354bc4&&(console[_0x56c4d4(0x240)](_0x56c4d4(0x1b9)+_0xf59013),console[_0x56c4d4(0x240)](_0x56c4d4(0x1bd)+_0x201b6a['parentSegment']),console[_0x56c4d4(0x240)](_0x56c4d4(0x1ea)+_0x201b6a['segmentName']),console[_0x56c4d4(0x240)](_0x56c4d4(0x21f)+(_0x201b6a[_0x56c4d4(0x1e5)]||_0x56c4d4(0x1fb))),console[_0x56c4d4(0x240)]('\x20\x20Full\x20path:\x20'+_0x201b6a['fullPath'])),_0x201b6a['fullPath'];}catch(_0x48b195){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x56c4d4(0x239)+_0x48b195['message']);}if(!_0x503ccb)throw new SDKError(ErrorCode[_0x56c4d4(0x1e0)],_0x56c4d4(0x20f));return _0x503ccb+'/'+_0xf59013;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x84662d(0x215)]='segment:describe';[a25_0x84662d(0x1c4)]=a25_0x84662d(0x1c8);async[a25_0x84662d(0x21d)](_0x130ed8){const _0x3abf7c=a25_0x84662d,{options:_0x6f2cdb,args:_0xfeac7f,tdx:_0x2a9e26}=_0x130ed8,_0xd89a6=_0xfeac7f[0x0],_0x3995ac=!_0xd89a6&&!!_0x6f2cdb[_0x3abf7c(0x1ba)],_0x26b84b=_0xd89a6||_0x6f2cdb[_0x3abf7c(0x1ba)];if(!_0x26b84b)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x3abf7c(0x240)](_0x3abf7c(0x206)),console['error']('Examples:'),console[_0x3abf7c(0x240)](_0x3abf7c(0x1d9)),console[_0x3abf7c(0x240)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3abf7c(0x240)](_0x3abf7c(0x203)),console[_0x3abf7c(0x240)](_0x3abf7c(0x200)),0x1;try{const _0x405ab1=_0x6f2cdb[_0x3abf7c(0x1c7)];let _0x37efa=_0x26b84b;!_0x3995ac&&_0x405ab1&&!_0x26b84b['includes']('/')&&(_0x37efa=_0x405ab1+'/'+_0x26b84b,_0x6f2cdb[_0x3abf7c(0x233)]&&console[_0x3abf7c(0x240)](_0x3abf7c(0x1de)+_0x37efa));const _0x358104=await withSpinner(_0x3abf7c(0x1e6)+_0x37efa+_0x3abf7c(0x1ec),()=>_0x2a9e26[_0x3abf7c(0x1ef)][_0x3abf7c(0x229)](_0x37efa),{'verbose':_0x6f2cdb['verbose']}),_0x529024=_0x358104[_0x3abf7c(0x1b8)];_0x6f2cdb[_0x3abf7c(0x233)]&&(console[_0x3abf7c(0x240)](_0x3abf7c(0x1f1)+_0x529024[_0x3abf7c(0x216)]),console['error'](_0x3abf7c(0x1f2)+_0x529024['parentId']),_0x529024['folderId']&&console['error'](_0x3abf7c(0x1fa)+_0x529024[_0x3abf7c(0x21a)]),_0x529024[_0x3abf7c(0x237)]&&console[_0x3abf7c(0x240)](_0x3abf7c(0x249)+_0x529024[_0x3abf7c(0x237)]));if(_0x529024['type']===_0x3abf7c(0x1c0)){const _0x57906f=await withSpinner(_0x3abf7c(0x23a),()=>_0x2a9e26[_0x3abf7c(0x1ef)][_0x3abf7c(0x202)](_0x529024[_0x3abf7c(0x1bc)]),{'verbose':_0x6f2cdb[_0x3abf7c(0x233)]});await handleSingleObjectOutput(_0x57906f[_0x3abf7c(0x1b8)],_0x6f2cdb);}else{if(_0x529024[_0x3abf7c(0x216)]===_0x3abf7c(0x228)){if(!_0x529024['folderId'])throw new SDKError(ErrorCode[_0x3abf7c(0x23c)],_0x3abf7c(0x248));const _0x17923f=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2a9e26[_0x3abf7c(0x1ef)]['getFolder'](_0x529024[_0x3abf7c(0x21a)]),{'verbose':_0x6f2cdb[_0x3abf7c(0x233)]});await handleSingleObjectOutput(_0x17923f['data'],_0x6f2cdb);}else{if(_0x529024[_0x3abf7c(0x216)]===_0x3abf7c(0x1ef)){if(!_0x529024[_0x3abf7c(0x237)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3abf7c(0x1f7));const _0x4a3dd0=await withSpinner(_0x3abf7c(0x222),()=>_0x2a9e26['segment']['getSegment'](_0x529024[_0x3abf7c(0x1bc)],_0x529024[_0x3abf7c(0x237)]),{'verbose':_0x6f2cdb[_0x3abf7c(0x233)]});await handleSingleObjectOutput(_0x4a3dd0[_0x3abf7c(0x1b8)],_0x6f2cdb);}}}return 0x0;}catch(_0xaadec8){if(_0xaadec8 instanceof SDKError)return console[_0x3abf7c(0x240)]('Error:\x20'+_0xaadec8[_0x3abf7c(0x1e9)]),_0xaadec8['cause']&&console[_0x3abf7c(0x240)](_0x3abf7c(0x209)+_0xaadec8['cause']),0x1;throw _0xaadec8;}}}export class SegmentShowCommand extends BaseCommand{['name']=a25_0x84662d(0x1df);[a25_0x84662d(0x1c4)]=a25_0x84662d(0x1d4);async['execute'](_0x1174be){const _0x83886a=a25_0x84662d,{options:_0x110f38,args:_0x355725,tdx:_0x45a2a7}=_0x1174be,_0x5ccee8=_0x355725[0x0];if(!_0x5ccee8)return console[_0x83886a(0x240)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x83886a(0x21b)),console['error'](_0x83886a(0x1cb)),console[_0x83886a(0x240)]('Examples:'),console[_0x83886a(0x240)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x83886a(0x240)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5436ea=_0x110f38[_0x83886a(0x1ba)],_0x291c91=await resolveSegmentTarget(_0x5ccee8,_0x5436ea,_0x110f38[_0x83886a(0x233)]);_0x110f38['verbose']&&console[_0x83886a(0x240)](_0x83886a(0x1fe)+_0x291c91);const _0x253955=await withSpinner('Resolving\x20\x27'+_0x5ccee8+_0x83886a(0x1ec),()=>_0x45a2a7[_0x83886a(0x1ef)]['resolvePathToResource'](_0x291c91),{'verbose':_0x110f38[_0x83886a(0x233)]}),_0x135e25=_0x253955[_0x83886a(0x1b8)];_0x110f38[_0x83886a(0x233)]&&(console[_0x83886a(0x240)]('Resolved\x20type:\x20'+_0x135e25[_0x83886a(0x216)]),console['error'](_0x83886a(0x1f2)+_0x135e25[_0x83886a(0x1bc)]));if(_0x135e25[_0x83886a(0x216)]===_0x83886a(0x228))return console[_0x83886a(0x240)](_0x83886a(0x218)),console[_0x83886a(0x240)](_0x83886a(0x201)),0x1;if(_0x135e25[_0x83886a(0x216)]===_0x83886a(0x1c0))return console[_0x83886a(0x240)](_0x83886a(0x22f)),console[_0x83886a(0x240)](_0x83886a(0x224)),0x1;if(!_0x135e25[_0x83886a(0x237)])throw new SDKError(ErrorCode[_0x83886a(0x211)],_0x83886a(0x1f7));const _0x1c641f=await withSpinner(_0x83886a(0x221),()=>_0x45a2a7[_0x83886a(0x1ef)]['getSegmentSQL'](_0x135e25[_0x83886a(0x1bc)],_0x135e25[_0x83886a(0x237)]),{'verbose':_0x110f38[_0x83886a(0x233)]});let _0x2632ec=_0x1c641f['data'];const _0x17995f=resolveLimit(_0x110f38[_0x83886a(0x247)],DEFAULT_DISPLAY_LIMIT),_0x51a5af=/\bLIMIT\s+\d+/i[_0x83886a(0x1f4)](_0x2632ec);!_0x51a5af&&(_0x2632ec=_0x2632ec[_0x83886a(0x1fc)]()[_0x83886a(0x20c)](/;+$/,''),_0x2632ec='SELECT\x20*\x20FROM\x20(\x0a'+_0x2632ec+_0x83886a(0x1dc)+_0x17995f);_0x110f38[_0x83886a(0x233)]&&console[_0x83886a(0x240)](_0x83886a(0x1fd)+_0x2632ec);const _0x84700e=await withProgressSpinner(_0x83886a(0x1f0),async _0x28755d=>{const _0x323663=_0x83886a,_0x563d2b=await _0x45a2a7[_0x323663(0x212)][_0x323663(0x21d)](_0x2632ec,{'catalog':'td','schema':'information_schema','onJobId':_0x273131=>{const _0x12871c=_0x323663;_0x28755d[_0x12871c(0x243)](_0x273131);}});return _0x563d2b;},{'verbose':_0x110f38['verbose']}),_0xd566e9=_0x84700e[_0x83886a(0x1b8)],_0x1cc884=_0xd566e9[_0x83886a(0x1f5)]?_0x83886a(0x1da)+_0xd566e9[_0x83886a(0x1f5)]+']':'';return console['error'](_0x83886a(0x1f8)+_0xd566e9[_0x83886a(0x1f3)][_0x83886a(0x1cd)][_0x83886a(0x241)]()+_0x83886a(0x1c1)+(_0x83886a(0x22e)+formatElapsed(_0xd566e9[_0x83886a(0x1f3)][_0x83886a(0x1ff)])+_0x1cc884)),await handleQueryOutput(_0xd566e9,_0x110f38),0x0;}catch(_0x38ad8f){if(_0x38ad8f instanceof SDKError)return console[_0x83886a(0x240)](_0x83886a(0x23f)+_0x38ad8f['code']+']'),console[_0x83886a(0x240)]('\x0a'+_0x38ad8f[_0x83886a(0x1e9)]),0x1;throw _0x38ad8f;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x84662d(0x215)]=a25_0x84662d(0x22a);[a25_0x84662d(0x1c4)]=a25_0x84662d(0x225);async[a25_0x84662d(0x21d)](_0x25714e){const _0x1618bd=a25_0x84662d,{options:_0x2545bc,args:_0x5c3676,tdx:_0x819ed4}=_0x25714e;if(_0x5c3676[_0x1618bd(0x223)]===0x0)return console[_0x1618bd(0x240)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x301416=_0x5c3676[0x0];try{_0x2545bc[_0x1618bd(0x233)]&&(console[_0x1618bd(0x240)](_0x1618bd(0x24b)+_0x2545bc[_0x1618bd(0x1f9)]),console[_0x1618bd(0x240)](_0x1618bd(0x1cf)+_0x301416));const _0x213476=await withSpinner(_0x1618bd(0x1d5)+_0x301416+'\x27...',()=>_0x819ed4[_0x1618bd(0x1ef)]['resolveParentId'](_0x301416),{'verbose':_0x2545bc['verbose']}),_0x592d91=_0x213476['data'];_0x2545bc[_0x1618bd(0x233)]&&console[_0x1618bd(0x240)](_0x1618bd(0x1d3)+_0x592d91);const _0x4ff812=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x301416+_0x1618bd(0x1ec),()=>_0x819ed4[_0x1618bd(0x1ef)][_0x1618bd(0x217)](_0x592d91),{'verbose':_0x2545bc[_0x1618bd(0x233)]}),_0x55fc91=_0x4ff812[_0x1618bd(0x1b8)];return console[_0x1618bd(0x240)](_0x1618bd(0x1e7)+_0x55fc91[_0x1618bd(0x223)]+_0x1618bd(0x227)+(_0x55fc91[_0x1618bd(0x223)]!==0x1?'s':'')),await handleSDKOutput(_0x55fc91,_0x2545bc),0x0;}catch(_0x49d170){if(_0x49d170 instanceof SDKError)return console[_0x1618bd(0x240)](_0x1618bd(0x1ce)+_0x49d170[_0x1618bd(0x1e9)]),_0x49d170['cause']&&console[_0x1618bd(0x240)](_0x1618bd(0x209)+_0x49d170['cause']),0x1;throw _0x49d170;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x84662d(0x215)]=a25_0x84662d(0x24d);[a25_0x84662d(0x1c4)]=a25_0x84662d(0x1d0);async['execute'](_0x4bd64c){const _0x48102e=a25_0x84662d,{options:_0x47aaa1,args:_0xe46565,tdx:_0x14a519}=_0x4bd64c;if(_0xe46565[_0x48102e(0x223)]===0x0)return console['error'](_0x48102e(0x24c)),console[_0x48102e(0x240)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x39d911,childId:_0x1f63f0}=parseSegmentRef(_0xe46565[0x0]);_0x47aaa1[_0x48102e(0x233)]&&(console[_0x48102e(0x240)](_0x48102e(0x24b)+_0x47aaa1[_0x48102e(0x1f9)]),console[_0x48102e(0x240)]('Parent\x20name:\x20'+_0x39d911),_0x1f63f0&&console['error']('Folder\x20name:\x20'+_0x1f63f0));if(!_0x1f63f0)return console[_0x48102e(0x240)](_0x48102e(0x234)),0x1;const _0x1c14a0=await withSpinner(_0x48102e(0x1d5)+_0x39d911+'\x27...',()=>_0x14a519[_0x48102e(0x1ef)][_0x48102e(0x22d)](_0x39d911),{'verbose':_0x47aaa1[_0x48102e(0x233)]}),_0x156151=_0x1c14a0['data'];_0x47aaa1[_0x48102e(0x233)]&&console[_0x48102e(0x240)](_0x48102e(0x1d3)+_0x156151);const _0x1ac625=await withSpinner(_0x48102e(0x213)+_0x1f63f0+'\x27...',()=>_0x14a519[_0x48102e(0x1ef)]['resolveFolderId'](_0x156151,_0x1f63f0),{'verbose':_0x47aaa1['verbose']}),_0x3c4dd5=_0x1ac625[_0x48102e(0x1b8)];_0x47aaa1[_0x48102e(0x233)]&&console[_0x48102e(0x240)]('Resolved\x20folder\x20ID:\x20'+_0x3c4dd5);const _0x5ea0b9=await withSpinner('Fetching\x20folder\x20\x27'+_0x1f63f0+_0x48102e(0x1ec),()=>_0x14a519[_0x48102e(0x1ef)][_0x48102e(0x1c5)](_0x3c4dd5),{'verbose':_0x47aaa1[_0x48102e(0x233)]});return await handleSDKOutput([_0x5ea0b9['data']],_0x47aaa1),0x0;}catch(_0xf55f8){if(_0xf55f8 instanceof SDKError)return console['error']('Error:\x20'+_0xf55f8[_0x48102e(0x1e9)]),_0xf55f8[_0x48102e(0x230)]&&console[_0x48102e(0x240)](_0x48102e(0x209)+_0xf55f8['cause']),0x1;throw _0xf55f8;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x84662d(0x215)]=a25_0x84662d(0x23e);[a25_0x84662d(0x1c4)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x84662d(0x21d)](_0xfa664c){const _0x53ea6c=a25_0x84662d,{options:_0x333236,args:_0x33e0a6,tdx:_0x1f0731}=_0xfa664c,_0xeb93a4=_0x33e0a6[0x0];if(!_0xeb93a4)return console[_0x53ea6c(0x240)](_0x53ea6c(0x23b)),console[_0x53ea6c(0x240)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x53ea6c(0x240)](_0x53ea6c(0x204)),console[_0x53ea6c(0x240)]('Examples:'),console[_0x53ea6c(0x240)](_0x53ea6c(0x24a)),console[_0x53ea6c(0x240)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1d138e=_0x333236['parentSegment'],_0x5699c9=await resolveSegmentTarget(_0xeb93a4,_0x1d138e,_0x333236['verbose']);_0x333236[_0x53ea6c(0x233)]&&console['error'](_0x53ea6c(0x1fe)+_0x5699c9);const _0x1c723a=await withSpinner('Resolving\x20\x27'+_0xeb93a4+'\x27...',()=>_0x1f0731[_0x53ea6c(0x1ef)][_0x53ea6c(0x229)](_0x5699c9),{'verbose':_0x333236[_0x53ea6c(0x233)]}),_0x2e0f72=_0x1c723a[_0x53ea6c(0x1b8)];_0x333236[_0x53ea6c(0x233)]&&(console['error'](_0x53ea6c(0x1f1)+_0x2e0f72[_0x53ea6c(0x216)]),console[_0x53ea6c(0x240)](_0x53ea6c(0x1f2)+_0x2e0f72[_0x53ea6c(0x1bc)]));if(_0x2e0f72[_0x53ea6c(0x216)]===_0x53ea6c(0x228))return console[_0x53ea6c(0x240)](_0x53ea6c(0x226)),console[_0x53ea6c(0x240)](_0x53ea6c(0x242)),0x1;if(_0x2e0f72[_0x53ea6c(0x216)]==='parent')return console[_0x53ea6c(0x240)](_0x53ea6c(0x236)),console[_0x53ea6c(0x240)](_0x53ea6c(0x1e1)),0x1;if(!_0x2e0f72['segmentId'])throw new SDKError(ErrorCode[_0x53ea6c(0x211)],_0x53ea6c(0x1f7));const _0x31ca95=await withSpinner(_0x53ea6c(0x221),()=>_0x1f0731[_0x53ea6c(0x1ef)]['getSegmentSQL'](_0x2e0f72[_0x53ea6c(0x1bc)],_0x2e0f72[_0x53ea6c(0x237)]),{'verbose':_0x333236[_0x53ea6c(0x233)]}),_0x4de6d6=_0x31ca95[_0x53ea6c(0x1b8)];return _0x333236[_0x53ea6c(0x1cc)]===_0x53ea6c(0x235)||_0x333236['format']==='jsonl'?await handleSDKOutput([{'sql':_0x4de6d6}],_0x333236):console[_0x53ea6c(0x1bb)](_0x4de6d6),0x0;}catch(_0x254510){if(_0x254510 instanceof SDKError)return console[_0x53ea6c(0x240)](_0x53ea6c(0x1ce)+_0x254510[_0x53ea6c(0x1e9)]),_0x254510[_0x53ea6c(0x230)]&&console['error']('\x20\x20Cause:\x20'+_0x254510[_0x53ea6c(0x230)]),0x1;throw _0x254510;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x84662d(0x215)]=a25_0x84662d(0x1c3);[a25_0x84662d(0x1c4)]='Create\x20segment\x20folder\x20for\x20organization';async[a25_0x84662d(0x21d)](_0xf505b3){const _0x1a94cf=a25_0x84662d,{options:_0x218982,args:_0x1d2b35,tdx:_0x3cf492}=_0xf505b3,_0xfeb081=_0x218982;if(_0x1d2b35['length']<0x2)return console[_0x1a94cf(0x240)](_0x1a94cf(0x245)),console[_0x1a94cf(0x240)](_0x1a94cf(0x1d6)),0x1;const _0x5e0e02=_0x1d2b35[0x0],_0x3f2430=_0x1d2b35[0x1];_0xfeb081['verbose']&&(console['error']('Site:\x20'+_0xfeb081[_0x1a94cf(0x1f9)]),console[_0x1a94cf(0x240)](_0x1a94cf(0x238)+_0x5e0e02),console[_0x1a94cf(0x240)]('Folder\x20name:\x20'+_0x3f2430));let _0x288dcc;if(_0xfeb081[_0x1a94cf(0x22b)]){const _0x5d2276=_0xfeb081[_0x1a94cf(0x22b)],_0x457e4b=await withSpinner(_0x1a94cf(0x1d5)+_0x5e0e02+'\x27...',()=>_0x3cf492[_0x1a94cf(0x1ef)][_0x1a94cf(0x22d)](_0x5e0e02),{'verbose':_0xfeb081[_0x1a94cf(0x233)]}),_0x57ff03=_0x457e4b[_0x1a94cf(0x1b8)],_0x9ccce9=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x5d2276+'\x27...',()=>_0x3cf492['segment'][_0x1a94cf(0x20e)](_0x57ff03,_0x5d2276),{'verbose':_0xfeb081[_0x1a94cf(0x233)]});_0x288dcc=_0x9ccce9[_0x1a94cf(0x1b8)],_0xfeb081[_0x1a94cf(0x233)]&&console[_0x1a94cf(0x240)](_0x1a94cf(0x21e)+_0x288dcc);}const _0x1ce18e={'name':_0x3f2430,'description':_0xfeb081['description'],'parentFolderId':_0x288dcc},_0x36c69f=await withSpinner('Creating\x20folder\x20\x27'+_0x3f2430+_0x1a94cf(0x1ec),()=>_0x3cf492[_0x1a94cf(0x1ef)][_0x1a94cf(0x23d)](_0x5e0e02,_0x1ce18e),{'verbose':_0xfeb081['verbose']}),_0x1cf060=_0x36c69f[_0x1a94cf(0x1b8)];return console[_0x1a94cf(0x240)](_0x1a94cf(0x1c6)+_0x1cf060[_0x1a94cf(0x215)]+'\x27\x20with\x20ID:\x20'+_0x1cf060['id']),await handleSDKOutput([_0x1cf060],_0xfeb081),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x84662d(0x215)]='segment:view';[a25_0x84662d(0x1c4)]=a25_0x84662d(0x244);async['execute'](_0x4ff1a8){const _0x5dda93=a25_0x84662d,{options:_0xaba9ab,args:_0x4d3bdb,tdx:_0x4c7e4a}=_0x4ff1a8,_0x5a4212=_0x4d3bdb[0x0];if(!_0x5a4212)return console[_0x5dda93(0x240)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5dda93(0x240)](_0x5dda93(0x231)),console[_0x5dda93(0x240)](_0x5dda93(0x207)),console['error']('Options:'),console[_0x5dda93(0x240)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5dda93(0x240)]('Examples:'),console[_0x5dda93(0x240)](_0x5dda93(0x22c)),console['error'](_0x5dda93(0x1e4)),console['error'](_0x5dda93(0x210)),console[_0x5dda93(0x240)](_0x5dda93(0x1c2)),0x1;try{const _0x101160=_0xaba9ab['parentSegment'],_0x455db1=await resolveSegmentTarget(_0x5a4212,_0x101160,_0xaba9ab['verbose']);_0xaba9ab['verbose']&&console[_0x5dda93(0x240)](_0x5dda93(0x1fe)+_0x455db1);const _0x275c13=await withSpinner(_0x5dda93(0x1dd)+_0x5a4212+_0x5dda93(0x1ec),()=>_0x4c7e4a[_0x5dda93(0x1ef)][_0x5dda93(0x229)](_0x455db1),{'verbose':_0xaba9ab[_0x5dda93(0x233)]}),_0x2751ea=_0x275c13[_0x5dda93(0x1b8)];_0xaba9ab[_0x5dda93(0x233)]&&(console['error'](_0x5dda93(0x1f1)+_0x2751ea[_0x5dda93(0x216)]),console['error'](_0x5dda93(0x1f2)+_0x2751ea[_0x5dda93(0x1bc)]),_0x2751ea[_0x5dda93(0x21a)]&&console[_0x5dda93(0x240)](_0x5dda93(0x1fa)+_0x2751ea['folderId']),_0x2751ea[_0x5dda93(0x237)]&&console['error'](_0x5dda93(0x249)+_0x2751ea[_0x5dda93(0x237)]));if(_0xaba9ab['web']){if(_0x2751ea[_0x5dda93(0x216)]===_0x5dda93(0x228))return console[_0x5dda93(0x240)](_0x5dda93(0x1ee)),0x1;if(_0x2751ea[_0x5dda93(0x216)]===_0x5dda93(0x1c0))return console[_0x5dda93(0x240)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5dda93(0x240)](_0x5dda93(0x1bf)),0x1;if(!_0x2751ea[_0x5dda93(0x237)])throw new SDKError(ErrorCode[_0x5dda93(0x211)],_0x5dda93(0x1f7));const _0x3a06eb=getConsoleNextUrl(_0xaba9ab[_0x5dda93(0x1f9)],_0x5dda93(0x20b)+_0x2751ea[_0x5dda93(0x1bc)]+_0x5dda93(0x20d)+_0x2751ea[_0x5dda93(0x237)]);return console[_0x5dda93(0x240)](a25_0x4d6f96['green']('✔')+'\x20Opening\x20'+a25_0x4d6f96[_0x5dda93(0x246)](_0x3a06eb)),openBrowser(_0x3a06eb),0x0;}if(_0x2751ea[_0x5dda93(0x216)]===_0x5dda93(0x228)){if(!_0x2751ea[_0x5dda93(0x21a)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x5dda93(0x248));const _0x1cc5ac=await withSpinner(_0x5dda93(0x1e8),()=>_0x4c7e4a[_0x5dda93(0x1ef)]['getFolder'](_0x2751ea[_0x5dda93(0x21a)]),{'verbose':_0xaba9ab[_0x5dda93(0x233)]});await handleSingleObjectOutput(_0x1cc5ac[_0x5dda93(0x1b8)],_0xaba9ab);}else{if(_0x2751ea[_0x5dda93(0x216)]===_0x5dda93(0x1ef)){if(!_0x2751ea[_0x5dda93(0x237)])throw new SDKError(ErrorCode[_0x5dda93(0x211)],_0x5dda93(0x1f7));const _0x18db73=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4c7e4a[_0x5dda93(0x1ef)][_0x5dda93(0x219)](_0x2751ea[_0x5dda93(0x1bc)],_0x2751ea[_0x5dda93(0x237)]),{'verbose':_0xaba9ab[_0x5dda93(0x233)]}),_0x48c11d=getConsoleNextUrl(_0xaba9ab[_0x5dda93(0x1f9)],_0x5dda93(0x20b)+_0x2751ea[_0x5dda93(0x1bc)]+_0x5dda93(0x20d)+_0x2751ea[_0x5dda93(0x237)]),_0x12d41b=_0x18db73['data'];_0x12d41b[_0x5dda93(0x20a)]=_0x48c11d,await handleSingleObjectOutput(_0x12d41b,_0xaba9ab);}else return console[_0x5dda93(0x240)](_0x5dda93(0x1ca)),console['error'](_0x5dda93(0x1b7)),0x1;}return 0x0;}catch(_0x50cd73){if(_0x50cd73 instanceof SDKError)return console['error']('Error:\x20'+_0x50cd73[_0x5dda93(0x1e9)]),_0x50cd73[_0x5dda93(0x230)]&&console['error'](_0x5dda93(0x209)+_0x50cd73[_0x5dda93(0x230)]),0x1;throw _0x50cd73;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x84662d(0x215)]=a25_0x84662d(0x232);['description']=a25_0x84662d(0x1d8);async[a25_0x84662d(0x21d)](_0x5cd7f9){const _0x3083ad=a25_0x84662d,{options:_0x2150cc,args:_0x17debf,tdx:_0x178397}=_0x5cd7f9,_0x4030db=_0x17debf[0x0];if(!_0x4030db)return console[_0x3083ad(0x240)](_0x3083ad(0x23b)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x3083ad(0x1c9)),console[_0x3083ad(0x240)](_0x3083ad(0x1f6)),console[_0x3083ad(0x240)](_0x3083ad(0x1d1)),console[_0x3083ad(0x240)](_0x3083ad(0x1be)),0x1;try{const _0x908878=_0x2150cc['parentSegment'],_0x188326=await resolveSegmentTarget(_0x4030db,_0x908878,_0x2150cc['verbose']);_0x2150cc['verbose']&&console['error'](_0x3083ad(0x1fe)+_0x188326);const _0x3eb875=await withSpinner(_0x3083ad(0x1dd)+_0x4030db+_0x3083ad(0x1ec),()=>_0x178397[_0x3083ad(0x1ef)][_0x3083ad(0x229)](_0x188326),{'verbose':_0x2150cc[_0x3083ad(0x233)]}),_0x3743ec=_0x3eb875[_0x3083ad(0x1b8)];_0x2150cc[_0x3083ad(0x233)]&&(console[_0x3083ad(0x240)](_0x3083ad(0x1f1)+_0x3743ec['type']),console[_0x3083ad(0x240)](_0x3083ad(0x1f2)+_0x3743ec[_0x3083ad(0x1bc)]));if(_0x3743ec[_0x3083ad(0x216)]==='folder')return console[_0x3083ad(0x240)](_0x3083ad(0x214)),console[_0x3083ad(0x240)](_0x3083ad(0x242)),0x1;if(_0x3743ec[_0x3083ad(0x216)]===_0x3083ad(0x1c0))return console[_0x3083ad(0x240)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3083ad(0x240)](_0x3083ad(0x1eb)),0x1;if(!_0x3743ec[_0x3083ad(0x237)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3083ad(0x1f7));const _0x541218=await withSpinner(_0x3083ad(0x221),()=>_0x178397[_0x3083ad(0x1ef)][_0x3083ad(0x1e3)](_0x3743ec[_0x3083ad(0x1bc)],_0x3743ec[_0x3083ad(0x237)]),{'verbose':_0x2150cc[_0x3083ad(0x233)]}),_0x249eb2=_0x541218['data'],_0x53d330=await executeSchemaQuery(_0x249eb2,_0x178397,_0x2150cc);return await handleQueryOutput(_0x53d330,_0x2150cc),0x0;}catch(_0x55bf93){if(_0x55bf93 instanceof SDKError)return console['error'](_0x3083ad(0x1ce)+_0x55bf93['message']),_0x55bf93['cause']&&console[_0x3083ad(0x240)](_0x3083ad(0x209)+_0x55bf93[_0x3083ad(0x230)]),0x1;throw _0x55bf93;}}}
|
|
1
|
+
const a25_0x108244=a25_0x424d;(function(_0x2b82b5,_0x4aeca5){const _0x8cb412=a25_0x424d,_0xf76e9=_0x2b82b5();while(!![]){try{const _0x3c4a1d=-parseInt(_0x8cb412(0xe5))/0x1+-parseInt(_0x8cb412(0x122))/0x2+-parseInt(_0x8cb412(0x118))/0x3+parseInt(_0x8cb412(0xff))/0x4+-parseInt(_0x8cb412(0x107))/0x5*(-parseInt(_0x8cb412(0xdc))/0x6)+parseInt(_0x8cb412(0x104))/0x7*(-parseInt(_0x8cb412(0x161))/0x8)+parseInt(_0x8cb412(0x15e))/0x9*(parseInt(_0x8cb412(0x141))/0xa);if(_0x3c4a1d===_0x4aeca5)break;else _0xf76e9['push'](_0xf76e9['shift']());}catch(_0x164f68){_0xf76e9['push'](_0xf76e9['shift']());}}}(a25_0x4df9,0x84ab8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a25_0x424d(_0x26950e,_0x44e834){_0x26950e=_0x26950e-0xd0;const _0x4df982=a25_0x4df9();let _0x424d3a=_0x4df982[_0x26950e];return _0x424d3a;}import a25_0x28a98a from'chalk';function a25_0x4df9(){const _0x27f9e5=['Show\x20folder\x20or\x20child\x20segment\x20details','setJobId','toLocaleString','site','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segment:view','fullPath','\x27\x20with\x20ID:\x20','type','segmentName','✔\x20Created\x20folder\x20\x27','Error:\x20','parent','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','2301543VWGLcV','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','verbose','\x27...','Site:\x20','getParent','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','json','1628900JbpQIr','\x20\x20Cause:\x20','segment:describe','segment:folder:list','execute','SEGMENT_NOT_FOUND','Resolving\x20path\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','SEGMENT_FOLDER_NOT_FOUND','Use:\x20tdx\x20ps\x20view\x20-w','\x20[Job\x20ID:\x20','folder','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentId','Target\x20path:\x20','Fetching\x20segment\x20details...','cause','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20rows\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segmentId','/app/ps/','Options:','getSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','cyan','segment:desc','message','information_schema','resolveParentId','25910xGZFHW','createFolder','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','stats','in\x20','segment:sql','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','/e/','listFolders','segment:folder:create','Examples:','Segment\x20ID\x20missing\x20from\x20resolved\x20path','code','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','error','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20desc','Resolving\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Creating\x20folder\x20\x27','description','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Full\x20path:\x20','parentSegment','✖\x20Query\x20failed\x20[','folderPath','7002LBIwwe','(root)','Executing\x20segment\x20query...','32Epgeoe','web','Resolving\x20folder\x20\x27','test','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20view','green','Parent\x20name:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','INVALID_ARGUMENT','Fetching\x20folder\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','Resolving\x20parent\x20folder\x20\x27','Parent\x20ID:\x20','Resolved\x20parent\x20ID:\x20','url','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','jsonl','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20sql','1046172NKDJZe','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment','includes','resolvePathToResource','segmentPath','\x20folder','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','367730mUXQxc','data','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','name','jobId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Create\x20segment\x20folder\x20for\x20organization','getFolder','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20parent\x20segment\x20\x27','\x20\x20Segment\x20name:\x20','Fetching\x20SQL\x20for\x20segment...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','format','resolveFolderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Listing\x20folders\x20for\x20parent\x20\x27','getSegmentSQL','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','✔\x20Found\x20','\x20Opening\x20','Folder\x20name:\x20','query','Folder\x20ID:\x20','1766004QBgHFV','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','243047PZWJlk','Error:\x20Path\x20or\x20name\x20is\x20required','Fetching\x20parent\x20segment\x20details...','5CPxgrS'];a25_0x4df9=function(){return _0x27f9e5;};return a25_0x4df9();}async function resolveSegmentTarget(_0x5007aa,_0x3ecfdc,_0x47a376){const _0x55184c=a25_0x424d;if(isYamlFilePath(_0x5007aa))try{const _0x3369a4=await resolveYamlFilePath(_0x5007aa);return _0x47a376&&(console[_0x55184c(0x150)]('Resolved\x20YAML\x20file:\x20'+_0x5007aa),console['error']('\x20\x20Parent\x20segment:\x20'+_0x3369a4[_0x55184c(0x15b)]),console[_0x55184c(0x150)](_0x55184c(0xf1)+_0x3369a4[_0x55184c(0x111)]),console[_0x55184c(0x150)]('\x20\x20Folder\x20path:\x20'+(_0x3369a4[_0x55184c(0x15d)]||_0x55184c(0x15f))),console[_0x55184c(0x150)](_0x55184c(0x15a)+_0x3369a4[_0x55184c(0x10e)])),_0x3369a4[_0x55184c(0x10e)];}catch(_0x23239e){throw new SDKError(ErrorCode[_0x55184c(0x16b)],_0x55184c(0x16a)+_0x23239e[_0x55184c(0x13e)]);}if(!_0x3ecfdc)throw new SDKError(ErrorCode[_0x55184c(0x16b)],_0x55184c(0x120));return _0x3ecfdc+'/'+_0x5007aa;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0x108244(0x124);[a25_0x108244(0x157)]='Show\x20segment\x20or\x20folder\x20details';async[a25_0x108244(0x126)](_0x4a2497){const _0x136b0d=a25_0x108244,{options:_0x3efec4,args:_0x1d3600,tdx:_0x18dd6b}=_0x4a2497,_0x408f95=_0x1d3600[0x0],_0x183b98=!_0x408f95&&!!_0x3efec4[_0x136b0d(0x15b)],_0x804581=_0x408f95||_0x3efec4[_0x136b0d(0x15b)];if(!_0x804581)return console[_0x136b0d(0x150)](_0x136b0d(0x105)),console['error'](_0x136b0d(0x165)),console[_0x136b0d(0x150)]('Examples:'),console[_0x136b0d(0x150)](_0x136b0d(0xef)),console[_0x136b0d(0x150)](_0x136b0d(0x100)),console[_0x136b0d(0x150)](_0x136b0d(0x129)),console[_0x136b0d(0x150)](_0x136b0d(0x152)),0x1;try{const _0x402710=_0x3efec4[_0x136b0d(0xe2)];let _0x580338=_0x804581;!_0x183b98&&_0x402710&&!_0x804581[_0x136b0d(0xe0)]('/')&&(_0x580338=_0x402710+'/'+_0x804581,_0x3efec4[_0x136b0d(0x11c)]&&console[_0x136b0d(0x150)](_0x136b0d(0x102)+_0x580338));const _0x4a06bb=await withSpinner(_0x136b0d(0x128)+_0x580338+_0x136b0d(0x11d),()=>_0x18dd6b[_0x136b0d(0xdf)]['resolvePathToResource'](_0x580338),{'verbose':_0x3efec4['verbose']}),_0x4eb027=_0x4a06bb[_0x136b0d(0xe6)];_0x3efec4['verbose']&&(console['error'](_0x136b0d(0xe7)+_0x4eb027['type']),console[_0x136b0d(0x150)](_0x136b0d(0xd3)+_0x4eb027['parentId']),_0x4eb027[_0x136b0d(0x117)]&&console[_0x136b0d(0x150)](_0x136b0d(0xfe)+_0x4eb027[_0x136b0d(0x117)]),_0x4eb027[_0x136b0d(0x137)]&&console[_0x136b0d(0x150)]('Segment\x20ID:\x20'+_0x4eb027[_0x136b0d(0x137)]));if(_0x4eb027[_0x136b0d(0x110)]===_0x136b0d(0x114)){const _0x2d7017=await withSpinner(_0x136b0d(0x106),()=>_0x18dd6b[_0x136b0d(0xdf)][_0x136b0d(0x11f)](_0x4eb027[_0x136b0d(0x130)]),{'verbose':_0x3efec4['verbose']});await handleSingleObjectOutput(_0x2d7017['data'],_0x3efec4);}else{if(_0x4eb027['type']===_0x136b0d(0x12d)){if(!_0x4eb027[_0x136b0d(0x117)])throw new SDKError(ErrorCode[_0x136b0d(0x12a)],_0x136b0d(0xf3));const _0x120230=await withSpinner('Fetching\x20folder\x20details...',()=>_0x18dd6b[_0x136b0d(0xdf)][_0x136b0d(0xed)](_0x4eb027['folderId']),{'verbose':_0x3efec4['verbose']});await handleSingleObjectOutput(_0x120230[_0x136b0d(0xe6)],_0x3efec4);}else{if(_0x4eb027['type']===_0x136b0d(0xdf)){if(!_0x4eb027[_0x136b0d(0x137)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x136b0d(0x14c));const _0x5a1559=await withSpinner('Fetching\x20segment\x20details...',()=>_0x18dd6b[_0x136b0d(0xdf)][_0x136b0d(0x13a)](_0x4eb027['parentId'],_0x4eb027['segmentId']),{'verbose':_0x3efec4[_0x136b0d(0x11c)]});await handleSingleObjectOutput(_0x5a1559['data'],_0x3efec4);}}}return 0x0;}catch(_0x5c50e4){if(_0x5c50e4 instanceof SDKError)return console[_0x136b0d(0x150)]('Error:\x20'+_0x5c50e4[_0x136b0d(0x13e)]),_0x5c50e4['cause']&&console[_0x136b0d(0x150)](_0x136b0d(0x123)+_0x5c50e4[_0x136b0d(0x133)]),0x1;throw _0x5c50e4;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x108244(0xe9)]='segment:show';[a25_0x108244(0x157)]=a25_0x108244(0x136);async[a25_0x108244(0x126)](_0x32d7c1){const _0x4cd887=a25_0x108244,{options:_0x25d875,args:_0xd83522,tdx:_0x51f63c}=_0x32d7c1,_0x92f9d1=_0xd83522[0x0];if(!_0x92f9d1)return console[_0x4cd887(0x150)](_0x4cd887(0x11a)),console[_0x4cd887(0x150)](_0x4cd887(0x13b)),console[_0x4cd887(0x150)](_0x4cd887(0xda)),console['error'](_0x4cd887(0x14b)),console[_0x4cd887(0x150)](_0x4cd887(0x14e)),console[_0x4cd887(0x150)](_0x4cd887(0x12f)),0x1;try{const _0x43be7a=_0x25d875[_0x4cd887(0x15b)],_0x297c4c=await resolveSegmentTarget(_0x92f9d1,_0x43be7a,_0x25d875[_0x4cd887(0x11c)]);_0x25d875['verbose']&&console[_0x4cd887(0x150)](_0x4cd887(0x131)+_0x297c4c);const _0x1b7f55=await withSpinner('Resolving\x20\x27'+_0x92f9d1+_0x4cd887(0x11d),()=>_0x51f63c[_0x4cd887(0xdf)][_0x4cd887(0xe1)](_0x297c4c),{'verbose':_0x25d875['verbose']}),_0x23d616=_0x1b7f55[_0x4cd887(0xe6)];_0x25d875[_0x4cd887(0x11c)]&&(console[_0x4cd887(0x150)]('Resolved\x20type:\x20'+_0x23d616[_0x4cd887(0x110)]),console[_0x4cd887(0x150)](_0x4cd887(0xd3)+_0x23d616[_0x4cd887(0x130)]));if(_0x23d616[_0x4cd887(0x110)]===_0x4cd887(0x12d))return console[_0x4cd887(0x150)](_0x4cd887(0x147)),console[_0x4cd887(0x150)](_0x4cd887(0xde)),0x1;if(_0x23d616[_0x4cd887(0x110)]==='parent')return console[_0x4cd887(0x150)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4cd887(0x150)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x23d616[_0x4cd887(0x137)])throw new SDKError(ErrorCode[_0x4cd887(0x127)],_0x4cd887(0x14c));const _0x3b6d5b=await withSpinner(_0x4cd887(0xf2),()=>_0x51f63c[_0x4cd887(0xdf)][_0x4cd887(0xf8)](_0x23d616[_0x4cd887(0x130)],_0x23d616[_0x4cd887(0x137)]),{'verbose':_0x25d875[_0x4cd887(0x11c)]});let _0xcb97e8=_0x3b6d5b[_0x4cd887(0xe6)];const _0xd1cab3=resolveLimit(_0x25d875['limit'],DEFAULT_DISPLAY_LIMIT),_0x463688=/\bLIMIT\s+\d+/i[_0x4cd887(0x164)](_0xcb97e8);!_0x463688&&(_0xcb97e8=_0xcb97e8['trim']()['replace'](/;+$/,''),_0xcb97e8='SELECT\x20*\x20FROM\x20(\x0a'+_0xcb97e8+_0x4cd887(0xee)+_0xd1cab3);_0x25d875[_0x4cd887(0x11c)]&&console['error']('SQL\x20query:\x0a'+_0xcb97e8);const _0x2512c4=await withProgressSpinner(_0x4cd887(0x160),async _0x33ed62=>{const _0x70f4cb=_0x4cd887,_0x19d70b=await _0x51f63c[_0x70f4cb(0xfd)][_0x70f4cb(0x126)](_0xcb97e8,{'catalog':'td','schema':_0x70f4cb(0x13f),'onJobId':_0x53ac38=>{const _0x169ace=_0x70f4cb;_0x33ed62[_0x169ace(0x109)](_0x53ac38);}});return _0x19d70b;},{'verbose':_0x25d875[_0x4cd887(0x11c)]}),_0x44b0cc=_0x2512c4[_0x4cd887(0xe6)],_0x32be0e=_0x44b0cc[_0x4cd887(0xea)]?_0x4cd887(0x12c)+_0x44b0cc[_0x4cd887(0xea)]+']':'';return console[_0x4cd887(0x150)](_0x4cd887(0x151)+_0x44b0cc[_0x4cd887(0x144)]['processedRows'][_0x4cd887(0x10a)]()+_0x4cd887(0x135)+(_0x4cd887(0x145)+formatElapsed(_0x44b0cc[_0x4cd887(0x144)]['elapsedTimeMillis'])+_0x32be0e)),await handleQueryOutput(_0x44b0cc,_0x25d875),0x0;}catch(_0x1fe7cb){if(_0x1fe7cb instanceof SDKError)return console['error'](_0x4cd887(0x15c)+_0x1fe7cb[_0x4cd887(0x14d)]+']'),console[_0x4cd887(0x150)]('\x0a'+_0x1fe7cb[_0x4cd887(0x13e)]),0x1;throw _0x1fe7cb;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a25_0x108244(0x125);[a25_0x108244(0x157)]=a25_0x108244(0x115);async[a25_0x108244(0x126)](_0x75667){const _0x5f172b=a25_0x108244,{options:_0x255e44,args:_0x55fe99,tdx:_0x401799}=_0x75667;if(_0x55fe99['length']===0x0)return console[_0x5f172b(0x150)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x5f172b(0x150)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x2b2013=_0x55fe99[0x0];try{_0x255e44[_0x5f172b(0x11c)]&&(console[_0x5f172b(0x150)]('Site:\x20'+_0x255e44[_0x5f172b(0x10b)]),console[_0x5f172b(0x150)](_0x5f172b(0x169)+_0x2b2013));const _0x3c1199=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2b2013+_0x5f172b(0x11d),()=>_0x401799[_0x5f172b(0xdf)][_0x5f172b(0x140)](_0x2b2013),{'verbose':_0x255e44[_0x5f172b(0x11c)]}),_0x2e12d2=_0x3c1199[_0x5f172b(0xe6)];_0x255e44[_0x5f172b(0x11c)]&&console[_0x5f172b(0x150)](_0x5f172b(0xd4)+_0x2e12d2);const _0xf89e72=await withSpinner(_0x5f172b(0xf7)+_0x2b2013+_0x5f172b(0x11d),()=>_0x401799[_0x5f172b(0xdf)][_0x5f172b(0x149)](_0x2e12d2),{'verbose':_0x255e44[_0x5f172b(0x11c)]}),_0x49bbda=_0xf89e72['data'];return console[_0x5f172b(0x150)](_0x5f172b(0xfa)+_0x49bbda[_0x5f172b(0xd9)]+_0x5f172b(0xe3)+(_0x49bbda[_0x5f172b(0xd9)]!==0x1?'s':'')),await handleSDKOutput(_0x49bbda,_0x255e44),0x0;}catch(_0x425f2a){if(_0x425f2a instanceof SDKError)return console[_0x5f172b(0x150)](_0x5f172b(0x113)+_0x425f2a[_0x5f172b(0x13e)]),_0x425f2a[_0x5f172b(0x133)]&&console['error'](_0x5f172b(0x123)+_0x425f2a[_0x5f172b(0x133)]),0x1;throw _0x425f2a;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x108244(0xe9)]='segment:folder:show';['description']=a25_0x108244(0x158);async['execute'](_0x26f31d){const _0x217de7=a25_0x108244,{options:_0xdfca54,args:_0x55ee8f,tdx:_0x3e1a8a}=_0x26f31d;if(_0x55ee8f[_0x217de7(0xd9)]===0x0)return console[_0x217de7(0x150)](_0x217de7(0xd6)),console[_0x217de7(0x150)](_0x217de7(0x11b)),0x1;try{const {parentId:_0x3929ef,childId:_0x1460eb}=parseSegmentRef(_0x55ee8f[0x0]);_0xdfca54[_0x217de7(0x11c)]&&(console[_0x217de7(0x150)](_0x217de7(0x11e)+_0xdfca54[_0x217de7(0x10b)]),console[_0x217de7(0x150)](_0x217de7(0x169)+_0x3929ef),_0x1460eb&&console['error'](_0x217de7(0xfc)+_0x1460eb));if(!_0x1460eb)return console[_0x217de7(0x150)](_0x217de7(0xeb)),0x1;const _0x46fcaa=await withSpinner(_0x217de7(0xf0)+_0x3929ef+_0x217de7(0x11d),()=>_0x3e1a8a[_0x217de7(0xdf)][_0x217de7(0x140)](_0x3929ef),{'verbose':_0xdfca54[_0x217de7(0x11c)]}),_0x4262ef=_0x46fcaa[_0x217de7(0xe6)];_0xdfca54[_0x217de7(0x11c)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x4262ef);const _0x4cb3c1=await withSpinner(_0x217de7(0x163)+_0x1460eb+_0x217de7(0x11d),()=>_0x3e1a8a[_0x217de7(0xdf)][_0x217de7(0xf5)](_0x4262ef,_0x1460eb),{'verbose':_0xdfca54['verbose']}),_0x48492a=_0x4cb3c1['data'];_0xdfca54['verbose']&&console[_0x217de7(0x150)]('Resolved\x20folder\x20ID:\x20'+_0x48492a);const _0x798ecb=await withSpinner('Fetching\x20folder\x20\x27'+_0x1460eb+_0x217de7(0x11d),()=>_0x3e1a8a[_0x217de7(0xdf)]['getFolder'](_0x48492a),{'verbose':_0xdfca54['verbose']});return await handleSDKOutput([_0x798ecb['data']],_0xdfca54),0x0;}catch(_0x608d4e){if(_0x608d4e instanceof SDKError)return console[_0x217de7(0x150)](_0x217de7(0x113)+_0x608d4e['message']),_0x608d4e[_0x217de7(0x133)]&&console[_0x217de7(0x150)](_0x217de7(0x123)+_0x608d4e['cause']),0x1;throw _0x608d4e;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a25_0x108244(0x146);[a25_0x108244(0x157)]=a25_0x108244(0xd1);async[a25_0x108244(0x126)](_0x556946){const _0x1c982a=a25_0x108244,{options:_0x29cf17,args:_0x10437d,tdx:_0x357611}=_0x556946,_0x417949=_0x10437d[0x0];if(!_0x417949)return console[_0x1c982a(0x150)](_0x1c982a(0x11a)),console[_0x1c982a(0x150)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x1c982a(0x150)](_0x1c982a(0x10c)),console[_0x1c982a(0x150)]('Examples:'),console[_0x1c982a(0x150)](_0x1c982a(0x103)),console[_0x1c982a(0x150)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x31a9f9=_0x29cf17[_0x1c982a(0x15b)],_0x1a0a7d=await resolveSegmentTarget(_0x417949,_0x31a9f9,_0x29cf17[_0x1c982a(0x11c)]);_0x29cf17[_0x1c982a(0x11c)]&&console['error'](_0x1c982a(0x131)+_0x1a0a7d);const _0x2da6e7=await withSpinner(_0x1c982a(0x154)+_0x417949+'\x27...',()=>_0x357611[_0x1c982a(0xdf)][_0x1c982a(0xe1)](_0x1a0a7d),{'verbose':_0x29cf17[_0x1c982a(0x11c)]}),_0x19456b=_0x2da6e7[_0x1c982a(0xe6)];_0x29cf17[_0x1c982a(0x11c)]&&(console['error'](_0x1c982a(0xe7)+_0x19456b[_0x1c982a(0x110)]),console[_0x1c982a(0x150)](_0x1c982a(0xd3)+_0x19456b['parentId']));if(_0x19456b[_0x1c982a(0x110)]===_0x1c982a(0x12d))return console['error']('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console['error'](_0x1c982a(0x12e)),0x1;if(_0x19456b[_0x1c982a(0x110)]==='parent')return console[_0x1c982a(0x150)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1c982a(0x150)](_0x1c982a(0xdb)),0x1;if(!_0x19456b['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x50ae01=await withSpinner(_0x1c982a(0xf2),()=>_0x357611[_0x1c982a(0xdf)][_0x1c982a(0xf8)](_0x19456b[_0x1c982a(0x130)],_0x19456b[_0x1c982a(0x137)]),{'verbose':_0x29cf17['verbose']}),_0x5908eb=_0x50ae01['data'];return _0x29cf17[_0x1c982a(0xf4)]===_0x1c982a(0x121)||_0x29cf17['format']===_0x1c982a(0xd8)?await handleSDKOutput([{'sql':_0x5908eb}],_0x29cf17):console['log'](_0x5908eb),0x0;}catch(_0xb5937b){if(_0xb5937b instanceof SDKError)return console['error'](_0x1c982a(0x113)+_0xb5937b['message']),_0xb5937b[_0x1c982a(0x133)]&&console['error'](_0x1c982a(0x123)+_0xb5937b['cause']),0x1;throw _0xb5937b;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x108244(0xe9)]=a25_0x108244(0x14a);['description']=a25_0x108244(0xec);async['execute'](_0x210f3f){const _0x433666=a25_0x108244,{options:_0x8a49af,args:_0xd7c446,tdx:_0x4da5d3}=_0x210f3f,_0x178b71=_0x8a49af;if(_0xd7c446[_0x433666(0xd9)]<0x2)return console[_0x433666(0x150)](_0x433666(0x143)),console['error'](_0x433666(0x101)),0x1;const _0x480af1=_0xd7c446[0x0],_0x29c973=_0xd7c446[0x1];_0x178b71[_0x433666(0x11c)]&&(console['error'](_0x433666(0x11e)+_0x178b71[_0x433666(0x10b)]),console[_0x433666(0x150)]('Parent\x20segment:\x20'+_0x480af1),console[_0x433666(0x150)](_0x433666(0xfc)+_0x29c973));let _0x27f459;if(_0x178b71['parentFolder']){const _0x2f5673=_0x178b71['parentFolder'],_0x1ec02a=await withSpinner(_0x433666(0xf0)+_0x480af1+_0x433666(0x11d),()=>_0x4da5d3[_0x433666(0xdf)][_0x433666(0x140)](_0x480af1),{'verbose':_0x178b71[_0x433666(0x11c)]}),_0x1b1827=_0x1ec02a[_0x433666(0xe6)],_0x28831e=await withSpinner(_0x433666(0xd2)+_0x2f5673+_0x433666(0x11d),()=>_0x4da5d3[_0x433666(0xdf)][_0x433666(0xf5)](_0x1b1827,_0x2f5673),{'verbose':_0x178b71[_0x433666(0x11c)]});_0x27f459=_0x28831e[_0x433666(0xe6)],_0x178b71[_0x433666(0x11c)]&&console[_0x433666(0x150)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x27f459);}const _0x4f0b3c={'name':_0x29c973,'description':_0x178b71[_0x433666(0x157)],'parentFolderId':_0x27f459},_0x3333f5=await withSpinner(_0x433666(0x156)+_0x29c973+_0x433666(0x11d),()=>_0x4da5d3[_0x433666(0xdf)][_0x433666(0x142)](_0x480af1,_0x4f0b3c),{'verbose':_0x178b71[_0x433666(0x11c)]}),_0x317fa0=_0x3333f5['data'];return console[_0x433666(0x150)](_0x433666(0x112)+_0x317fa0[_0x433666(0xe9)]+_0x433666(0x10f)+_0x317fa0['id']),await handleSDKOutput([_0x317fa0],_0x178b71),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x108244(0xe9)]=a25_0x108244(0x10d);[a25_0x108244(0x157)]=a25_0x108244(0x108);async[a25_0x108244(0x126)](_0x1be02b){const _0x4abc4e=a25_0x108244,{options:_0x198c96,args:_0x1ddd36,tdx:_0x1ac576}=_0x1be02b,_0x136d77=_0x1ddd36[0x0];if(!_0x136d77)return console[_0x4abc4e(0x150)](_0x4abc4e(0x155)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x4abc4e(0x150)](_0x4abc4e(0xf6)),console['error'](_0x4abc4e(0x139)),console['error'](_0x4abc4e(0xd7)),console[_0x4abc4e(0x150)](_0x4abc4e(0x14b)),console[_0x4abc4e(0x150)](_0x4abc4e(0xe8)),console[_0x4abc4e(0x150)](_0x4abc4e(0x166)),console[_0x4abc4e(0x150)](_0x4abc4e(0xf9)),console[_0x4abc4e(0x150)](_0x4abc4e(0xe4)),0x1;try{const _0x5634f8=_0x198c96['parentSegment'],_0x5afcc6=await resolveSegmentTarget(_0x136d77,_0x5634f8,_0x198c96['verbose']);_0x198c96[_0x4abc4e(0x11c)]&&console[_0x4abc4e(0x150)]('Target\x20path:\x20'+_0x5afcc6);const _0x3b17b2=await withSpinner(_0x4abc4e(0x154)+_0x136d77+_0x4abc4e(0x11d),()=>_0x1ac576[_0x4abc4e(0xdf)][_0x4abc4e(0xe1)](_0x5afcc6),{'verbose':_0x198c96['verbose']}),_0x23adc0=_0x3b17b2[_0x4abc4e(0xe6)];_0x198c96[_0x4abc4e(0x11c)]&&(console[_0x4abc4e(0x150)](_0x4abc4e(0xe7)+_0x23adc0[_0x4abc4e(0x110)]),console[_0x4abc4e(0x150)]('Parent\x20ID:\x20'+_0x23adc0[_0x4abc4e(0x130)]),_0x23adc0['folderId']&&console[_0x4abc4e(0x150)](_0x4abc4e(0xfe)+_0x23adc0[_0x4abc4e(0x117)]),_0x23adc0[_0x4abc4e(0x137)]&&console[_0x4abc4e(0x150)]('Segment\x20ID:\x20'+_0x23adc0['segmentId']));if(_0x198c96[_0x4abc4e(0x162)]){if(_0x23adc0['type']==='folder')return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x23adc0[_0x4abc4e(0x110)]===_0x4abc4e(0x114))return console[_0x4abc4e(0x150)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4abc4e(0x150)](_0x4abc4e(0x12b)),0x1;if(!_0x23adc0[_0x4abc4e(0x137)])throw new SDKError(ErrorCode[_0x4abc4e(0x127)],_0x4abc4e(0x14c));const _0xd332a3=getConsoleNextUrl(_0x198c96[_0x4abc4e(0x10b)],_0x4abc4e(0x138)+_0x23adc0['parentId']+_0x4abc4e(0x148)+_0x23adc0[_0x4abc4e(0x137)]);return console[_0x4abc4e(0x150)](a25_0x28a98a[_0x4abc4e(0x168)]('✔')+_0x4abc4e(0xfb)+a25_0x28a98a[_0x4abc4e(0x13c)](_0xd332a3)),openBrowser(_0xd332a3),0x0;}if(_0x23adc0[_0x4abc4e(0x110)]===_0x4abc4e(0x12d)){if(!_0x23adc0[_0x4abc4e(0x117)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x4abc4e(0xf3));const _0xae9226=await withSpinner(_0x4abc4e(0xd0),()=>_0x1ac576[_0x4abc4e(0xdf)][_0x4abc4e(0xed)](_0x23adc0[_0x4abc4e(0x117)]),{'verbose':_0x198c96[_0x4abc4e(0x11c)]});await handleSingleObjectOutput(_0xae9226[_0x4abc4e(0xe6)],_0x198c96);}else{if(_0x23adc0[_0x4abc4e(0x110)]===_0x4abc4e(0xdf)){if(!_0x23adc0[_0x4abc4e(0x137)])throw new SDKError(ErrorCode[_0x4abc4e(0x127)],_0x4abc4e(0x14c));const _0x1f9430=await withSpinner(_0x4abc4e(0x132),()=>_0x1ac576['segment']['getSegment'](_0x23adc0['parentId'],_0x23adc0['segmentId']),{'verbose':_0x198c96['verbose']}),_0x3df509=getConsoleNextUrl(_0x198c96[_0x4abc4e(0x10b)],_0x4abc4e(0x138)+_0x23adc0[_0x4abc4e(0x130)]+_0x4abc4e(0x148)+_0x23adc0['segmentId']),_0x527300=_0x1f9430[_0x4abc4e(0xe6)];_0x527300[_0x4abc4e(0xd5)]=_0x3df509,await handleSingleObjectOutput(_0x527300,_0x198c96);}else return console[_0x4abc4e(0x150)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x4abc4e(0x150)](_0x4abc4e(0x167)),0x1;}return 0x0;}catch(_0x3ca1c5){if(_0x3ca1c5 instanceof SDKError)return console[_0x4abc4e(0x150)](_0x4abc4e(0x113)+_0x3ca1c5['message']),_0x3ca1c5[_0x4abc4e(0x133)]&&console[_0x4abc4e(0x150)]('\x20\x20Cause:\x20'+_0x3ca1c5[_0x4abc4e(0x133)]),0x1;throw _0x3ca1c5;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x108244(0xe9)]=a25_0x108244(0x13d);['description']=a25_0x108244(0x134);async[a25_0x108244(0x126)](_0x58820a){const _0x22fc85=a25_0x108244,{options:_0x155f46,args:_0x445659,tdx:_0x3545a5}=_0x58820a,_0x4ef1ae=_0x445659[0x0];if(!_0x4ef1ae)return console['error'](_0x22fc85(0x11a)),console[_0x22fc85(0x150)](_0x22fc85(0x119)),console['error'](_0x22fc85(0xdd)),console[_0x22fc85(0x150)]('Examples:'),console[_0x22fc85(0x150)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x22fc85(0x150)](_0x22fc85(0x159)),0x1;try{const _0x3d79dc=_0x155f46[_0x22fc85(0x15b)],_0x1c041a=await resolveSegmentTarget(_0x4ef1ae,_0x3d79dc,_0x155f46['verbose']);_0x155f46[_0x22fc85(0x11c)]&&console[_0x22fc85(0x150)]('Target\x20path:\x20'+_0x1c041a);const _0x2bf635=await withSpinner(_0x22fc85(0x154)+_0x4ef1ae+_0x22fc85(0x11d),()=>_0x3545a5[_0x22fc85(0xdf)]['resolvePathToResource'](_0x1c041a),{'verbose':_0x155f46[_0x22fc85(0x11c)]}),_0x4d6e5b=_0x2bf635[_0x22fc85(0xe6)];_0x155f46['verbose']&&(console[_0x22fc85(0x150)](_0x22fc85(0xe7)+_0x4d6e5b[_0x22fc85(0x110)]),console['error'](_0x22fc85(0xd3)+_0x4d6e5b[_0x22fc85(0x130)]));if(_0x4d6e5b[_0x22fc85(0x110)]===_0x22fc85(0x12d))return console[_0x22fc85(0x150)](_0x22fc85(0x116)),console['error'](_0x22fc85(0x12e)),0x1;if(_0x4d6e5b[_0x22fc85(0x110)]===_0x22fc85(0x114))return console[_0x22fc85(0x150)](_0x22fc85(0x14f)),console['error'](_0x22fc85(0x153)),0x1;if(!_0x4d6e5b['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4278c2=await withSpinner(_0x22fc85(0xf2),()=>_0x3545a5[_0x22fc85(0xdf)][_0x22fc85(0xf8)](_0x4d6e5b[_0x22fc85(0x130)],_0x4d6e5b['segmentId']),{'verbose':_0x155f46['verbose']}),_0x538c04=_0x4278c2['data'],_0x11e115=await executeSchemaQuery(_0x538c04,_0x3545a5,_0x155f46);return await handleQueryOutput(_0x11e115,_0x155f46),0x0;}catch(_0x54ed35){if(_0x54ed35 instanceof SDKError)return console[_0x22fc85(0x150)](_0x22fc85(0x113)+_0x54ed35[_0x22fc85(0x13e)]),_0x54ed35[_0x22fc85(0x133)]&&console[_0x22fc85(0x150)](_0x22fc85(0x123)+_0x54ed35[_0x22fc85(0x133)]),0x1;throw _0x54ed35;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a26_0x503f39=a26_0x4d9e;(function(_0x5b22f9,_0x33bc5e){const _0x5798c9=a26_0x4d9e,_0x5b42c1=_0x5b22f9();while(!![]){try{const _0x42f720=parseInt(_0x5798c9(0x98))/0x1+parseInt(_0x5798c9(0x95))/0x2*(-parseInt(_0x5798c9(0xa2))/0x3)+parseInt(_0x5798c9(0x74))/0x4*(parseInt(_0x5798c9(0x75))/0x5)+-parseInt(_0x5798c9(0x8c))/0x6+parseInt(_0x5798c9(0x8f))/0x7*(parseInt(_0x5798c9(0xa1))/0x8)+-parseInt(_0x5798c9(0x82))/0x9+-parseInt(_0x5798c9(0x79))/0xa*(-parseInt(_0x5798c9(0x84))/0xb);if(_0x42f720===_0x33bc5e)break;else _0x5b42c1['push'](_0x5b42c1['shift']());}catch(_0x33670d){_0x5b42c1['push'](_0x5b42c1['shift']());}}}(a26_0x507a,0x875ce));function a26_0x507a(){const _0x6d94f3=['32ROXzvk','111ECzKBP','verbose','invisible','segments','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','159924vjKwGz','35OdVvhC','data','Create\x20child\x20segment\x20with\x20filtering\x20rules','description','10zYrkkV','length','Resolving\x20folder\x20path\x20\x27','ruleFile','execute','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment','error','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','3741129SwUDGo','Site:\x20','2177417yaKALP','segment:create','site','\x20\x20\x20Path:\x20','folder','Resolving\x20parent\x20segment\x20\x27','yellow','includes','2609172xKbFoh','Parent\x20path:\x20','Resolving\x20folder\x20\x27','6706IzFZEV','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveFolderId','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','kind','parent','7208nvFnWa','type','Segment\x20name:\x20','1056691fcCRkM','createSegment','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','rule','noCountPopulation','\x27\x20with\x20ID:\x20','✔\x20Created\x20segment\x20\x27','folderId'];a26_0x507a=function(){return _0x6d94f3;};return a26_0x507a();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x4d9e(_0x3099f5,_0x288a45){_0x3099f5=_0x3099f5-0x72;const _0x507a54=a26_0x507a();let _0x4d9e1e=_0x507a54[_0x3099f5];return _0x4d9e1e;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x561d2d from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a26_0x503f39(0x85);['description']=a26_0x503f39(0x77);async[a26_0x503f39(0x7d)](_0x4ec35c){const _0x425354=a26_0x503f39;console[_0x425354(0x80)](a26_0x561d2d[_0x425354(0x8a)](_0x425354(0x72))),console['error'](a26_0x561d2d[_0x425354(0x8a)](_0x425354(0x92)));const {options:_0x2fe7ec,args:_0x4c4983,tdx:_0x3ac729}=_0x4ec35c,_0x4f66a6=_0x2fe7ec;if(_0x4c4983[_0x425354(0x7a)]===0x0)return console[_0x425354(0x80)](_0x425354(0x7e)),console[_0x425354(0x80)](_0x425354(0x9b)),console['error']('Examples:'),console[_0x425354(0x80)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x425354(0x80)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x3d34b3=_0x4c4983[0x0],_0x5ad497=_0x2fe7ec['segmentPath'];let _0x380831=_0x3d34b3;_0x5ad497&&!_0x3d34b3[_0x425354(0x8b)]('/')&&(_0x380831=_0x5ad497+'/'+_0x3d34b3,_0x4f66a6[_0x425354(0xa3)]&&console[_0x425354(0x80)]('Resolved\x20relative\x20path\x20to:\x20'+_0x380831));const _0x2a0b25=parsePath(_0x380831);if(_0x2a0b25[_0x425354(0xa5)][_0x425354(0x7a)]<0x2)return console['error'](_0x425354(0x90)),console[_0x425354(0x80)](_0x425354(0x81)),0x1;const _0x5d07b8=_0x2a0b25[_0x425354(0xa5)][0x0],_0x50bdd5=getBaseName(_0x380831),_0x5e0167=getParentPath(_0x380831);_0x4f66a6['verbose']&&(console[_0x425354(0x80)](_0x425354(0x83)+_0x4f66a6[_0x425354(0x86)]),console[_0x425354(0x80)]('Target\x20path:\x20'+_0x380831),console[_0x425354(0x80)]('Parent:\x20'+_0x5d07b8),console[_0x425354(0x80)](_0x425354(0x97)+_0x50bdd5),console[_0x425354(0x80)](_0x425354(0x8d)+_0x5e0167));const _0x70fe04=await withSpinner(_0x425354(0x89)+_0x5d07b8+_0x425354(0x73),()=>_0x3ac729['segment']['resolveParentId'](_0x5d07b8),{'verbose':_0x4f66a6[_0x425354(0xa3)]}),_0x50ef57=_0x70fe04[_0x425354(0x76)];let _0xd80cc9;if(_0x2a0b25[_0x425354(0xa5)][_0x425354(0x7a)]>0x2){const _0x52abae=await withSpinner(_0x425354(0x7b)+_0x5e0167+_0x425354(0x73),()=>_0x3ac729['segment']['resolvePathToResource'](_0x5e0167),{'verbose':_0x4f66a6[_0x425354(0xa3)]}),_0x208d3e=_0x52abae[_0x425354(0x76)];if(_0x208d3e[_0x425354(0x96)]!==_0x425354(0x88)&&_0x208d3e[_0x425354(0x96)]!==_0x425354(0x94))return console[_0x425354(0x80)](_0x425354(0x9a)),0x1;_0xd80cc9=_0x208d3e[_0x425354(0xa0)];}else{if(_0x4f66a6[_0x425354(0x88)]){const _0x5abba6=await withSpinner(_0x425354(0x8e)+_0x4f66a6[_0x425354(0x88)]+_0x425354(0x73),()=>_0x3ac729[_0x425354(0x7f)][_0x425354(0x91)](_0x50ef57,_0x4f66a6[_0x425354(0x88)]),{'verbose':_0x4f66a6['verbose']});_0xd80cc9=_0x5abba6[_0x425354(0x76)];}}_0x4f66a6['verbose']&&_0xd80cc9&&console['error']('Resolved\x20folder\x20ID:\x20'+_0xd80cc9);const _0x170f2f=await loadJSONFromOptions(_0x4f66a6[_0x425354(0x9c)],_0x4f66a6[_0x425354(0x7c)]),_0x47f785={'name':_0x50bdd5,'description':_0x4f66a6[_0x425354(0x78)],'rule':_0x170f2f,'kind':_0x4f66a6[_0x425354(0x93)]!==undefined?parseInt(_0x4f66a6[_0x425354(0x93)],0xa):undefined,'isVisible':_0x4f66a6[_0x425354(0xa4)]?![]:undefined,'segmentFolderId':_0xd80cc9,'countPopulation':_0x4f66a6[_0x425354(0x9d)]?![]:undefined},_0x2d3d77=await withSpinner('Creating\x20segment\x20\x27'+_0x50bdd5+_0x425354(0x73),()=>_0x3ac729[_0x425354(0x7f)][_0x425354(0x99)](_0x50ef57,_0x47f785),{'verbose':_0x4f66a6[_0x425354(0xa3)]}),_0x34a89c=_0x2d3d77[_0x425354(0x76)];return console[_0x425354(0x80)](_0x425354(0x9f)+_0x34a89c['name']+_0x425354(0x9e)+_0x34a89c['id']),_0x380831!==_0x3d34b3&&console['error'](_0x425354(0x87)+_0x380831),await handleSDKOutput([_0x34a89c],_0x4f66a6),0x0;}}
|