@treasuredata/tdx 0.29.2 → 0.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-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/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.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-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.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-recovery.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/segment-validator.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/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.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/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.d.ts +17 -0
- package/dist/utils/github-releases.d.ts.map +1 -0
- package/dist/utils/github-releases.js +1 -0
- package/dist/utils/github-releases.js.map +1 -0
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0x3b2896=a26_0x5b8a;(function(_0x244cf4,_0x4cec0e){const _0x2d0ffb=a26_0x5b8a,_0x20edb9=_0x244cf4();while(!![]){try{const _0x25d6b7=parseInt(_0x2d0ffb(0x23f))/0x1*(parseInt(_0x2d0ffb(0x256))/0x2)+-parseInt(_0x2d0ffb(0x18f))/0x3*(-parseInt(_0x2d0ffb(0x297))/0x4)+-parseInt(_0x2d0ffb(0x155))/0x5+parseInt(_0x2d0ffb(0x123))/0x6+parseInt(_0x2d0ffb(0x237))/0x7+parseInt(_0x2d0ffb(0x201))/0x8+-parseInt(_0x2d0ffb(0x116))/0x9*(parseInt(_0x2d0ffb(0x242))/0xa);if(_0x25d6b7===_0x4cec0e)break;else _0x20edb9['push'](_0x20edb9['shift']());}catch(_0x432d29){_0x20edb9['push'](_0x20edb9['shift']());}}}(a26_0x57d5,0xbc298));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x4d4c78 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a26_0x5b8a(_0x37a32c,_0x5e6aa0){_0x37a32c=_0x37a32c-0x115;const _0x57d5d3=a26_0x57d5();let _0x5b8ab9=_0x57d5d3[_0x37a32c];return _0x5b8ab9;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a26_0x57d5(){const _0x2f12aa=['attribute','status','/\x20→\x20','.yml','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','segment:parent:update','-1d','description','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','foreignKey','workflowSessionId','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Resolving\x20parent\x20segment\x20\x27','\x20RT-enabled\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','yes','\x20--enriched','/\x20and\x20','36dGSECe','parent_id','Fetching\x20current\x20configuration\x20for\x20\x27','trim','\x20\x20\x20\x20\x20\x20','previewParentYaml','Available\x20attributes:','unref','displayPreviewHints','toLowerCase','column','start','columns','{\x0a\x20\x20\x22database\x22:\x20\x22','/app/workflows/','Events:','\x20to\x20push\x20the\x20configuration','Error\x20reading\x20file:\x20','\x20field','collectSchema','displayBehaviorsStats','message','\x27\x20is\x20already\x20up\x20to\x20date','runParent','customers','Attributes:','Source:','\x20+\x20[','pushParentYaml','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','`\x20to\x20download\x20the\x20configuration\x20first','enabled','displayValidateResults','No\x20parent\x20segments\x20match\x20pattern:\x20','addAttributesFile','Schema\x20saved\x20to\x20','Output\x20file:\x20','resolveParentId','endsWith','Aborted.','Fetching\x20behavior\x20list...','Executing\x20parent\x20segment\x20query...','\x0a✔\x20Workflow\x20started','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Join\x20on:','Attribute:','listFields','No\x20parent\x20segments\x20found','\x27\x20and\x20run\x20workflow?','getOutputDatabaseName','Error:\x20--database\x20and\x20--table\x20are\x20required','page_view','push','Fetching\x20parent\x20segment\x20\x27','timezone','master','Preview:','user_id','valid','\x20parent\x20segment\x20\x27','realtime','Default','scheduleOption','toFixed','Personalization\x20service\x20description','18964hJQEVy','cyan','Overwrite\x20\x27','\x20--attribute\x20\x22<name>\x22','all','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20configured','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','test','\x20is\x20already\x20up\x20to\x20date','RT\x202.0\x20Validate:','addAttributes','\x0aNew\x20parent\x20segment\x20\x27','32682753wWhuiS','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','length','data','Site:\x20','green','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','formatSchemaJson','parent_segments','column_type','\x20kill','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','198300MODMWY','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','indexOf','displayPreviewResults','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','<database>.<table>','segment','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20RT\x20configuration\x20is\x20valid','\x22,\x20\x22type\x22:\x20\x22','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','join','updateParent','pullParentYaml','\x20=\x20','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','dirname','\x20\x20No\x20sample\x20data\x20available','displayAttributesStats','interval','Behaviors','displaySampleData','Validate:','SELECT\x20*\x20FROM\x20','Created','Fetching\x20customers\x20schema...','xdg-open','\x22\x20}','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','/sessions/','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Status:','enriched','\x27\x20with\x20ID:\x20','getBehaviorNames','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','session','\x20\x20\x20\x20-\x20','Master\x20Table','\x20\x202.\x20Run\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','stitchingKeys','Pattern:\x20','segment:parent:run','✔\x20No\x20changes\x20-\x20\x27','events','segment:parent:desc','1509870gGIaeo','web','behaviorsFile','✔\x20Created\x20parent\x20segment\x20\x27','\x20[Job\x20ID:\x20','joinKey','displayRealtimeInfo','👥\x20','SQL\x20query:\x0a','reduce','customerPercent','type','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','behaviors','execute','verbose','realtime:','idStitching','segment:parent:validate','displayColumns','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','run','validateParentYaml','Error:\x20File\x20not\x20found:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','sort','/\x20directories\x20exist.','use','parentSegment','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Next\x20steps:','customerGroup','personalization_services','Listing\x20parent\x20segments\x20matching\x20\x27','rowCount','⚡\x20Enabled','sourceTableValid','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','✔\x20Found\x20','listParents','column_name','Show\x20parent\x20segment\x20details','\x0a⚠️\x20\x20Both\x20','\x20Added\x20RT\x202.0\x20template\x20section','Validating\x20configuration...','customersWithEvents','output','\x20section','Listing\x20fields\x20for\x20\x27','\x20\x20Tables:\x201\x20customers\x20+\x20','behavior_','segment:parent:create','\x0a\x20\x20]\x0a}\x0a','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Analyzing\x20changes...','\x0aNo\x20sample\x20data\x20available','411DilDzs','Apply\x20changes\x20to\x20\x27','processedRows','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','schemaValid','jsonl','attributesFile','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','map','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Get\x20SQL\x20query\x20for\x20parent\x20segment','⚡\x20Not\x20enabled','segment:parent:show','\x0aError:','createParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20tdx\x20wf\x20attempt\x20','stop','repeat','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20--behavior\x20\x22','parent_segment','\x20Context\x20set:\x20','totalEvents','text','segment:parent:fields','SELECT\x20*\x20FROM\x20(\x0a','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','sampleData','list','Creating','\x0a\x20\x20\x20\x20]','\x20parent\x20segment','elapsedTimeMillis','\x27...','.yaml','error','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','List\x20parent\x20segments','bold','log','in\x20','Updating','Customers:','filter','Updated','/app/dw/parentSegments/','sourceTableError','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20Configuration\x20is\x20valid','site','ID\x20Stitching:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20\x20\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','coveragePercent','displaySummary','keys','\x20Added\x20personalization\x20template\x20to\x20','✔\x20Updated\x20parent\x20segment\x20\x27','Audience\x20ID:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','dim','setJobId','label','No\x20personalization\x20services\x20configured','\x20\x20\x20\x20','segment:parent:pull','\x20\x20Columns:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','ignore','\x20\x20Database:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','workflowAttemptId','using\x20the\x20default\x20path:\x20','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','replace','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','workflowId','Master:','ps:rt:validate','Fetching\x20sample\x20data...','utf-8','\x5c$&','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','getParentSQL','Found\x20YAML\x20file:\x20','\x20--attribute\x20\x22','personalization','attributes','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','YAML\x20file:\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x201.\x20Edit\x20','string','ps:pz:list','format','last_page_viewed','table','✘\x20Failed\x20to\x20rename\x20directory:\x20','Options:\x0a','audienceId','tdx\x20ps\x20preview\x20','personalizationServices','/{name}.yml\x0a','segment:parent:list','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','11765512hUmndl','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','stats','localeCompare','database','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','ps:rt:list','/attempt/','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Attributes','My\x20Service','allValid','tdx\x20ps\x20push\x20','jobId','double','behavior','To\x20view\x20sample\x20data:','json','Options:','\x20behaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','addBehaviors','\x20trigger=','darwin','Error:','toLocaleString','segment:parent:sql','getParentFull','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','population','Validating\x20RT\x20configuration...','Session:','Join:','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','varchar','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Error:\x20Parent\x20segment\x20name\x20is\x20required','schemaError','Errors:','\x20--behavior\x20\x22<name>\x22','primaryKey','limit','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','scheduleType','name','Creating\x20parent\x20segment\x20\x27','Listing\x20RT-enabled\x20parent\x20segments...','Parent\x20segment:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Fetching\x20SQL\x20for\x20\x27','7734223luoLhI','Listing\x20parent\x20segments...','match','trigger_event','\x20to\x20configure\x20your\x20personalization\x20service','✔\x20Renamed\x20directory\x20to\x20','Error\x20parsing\x20YAML:\x20','apply','80331FzPHAH','errors','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','10Mriyqi'];a26_0x57d5=function(){return _0x2f12aa;};return a26_0x57d5();}import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0x42e058 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=a26_0x3b2896(0x11f),LEGACY_PARENT_SEGMENT_DIR=a26_0x3b2896(0x1a6);function openBrowser(_0x2ead85){const _0x4dd487=a26_0x3b2896,_0x2e47de=process['platform'],_0x1a9eaa=_0x2e47de===_0x4dd487(0x219)?'open':_0x2e47de==='win32'?_0x4dd487(0x261):_0x4dd487(0x13f);spawn(_0x1a9eaa,[_0x2ead85],{'detached':!![],'stdio':_0x4dd487(0x1d8)})[_0x4dd487(0x25d)]();}function migrateLegacyDirectory(){const _0x4b54bc=a26_0x3b2896;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0xfc6cad=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0xfc6cad['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x4b54bc(0x1b5)](a26_0x42e058['yellow'](_0x4b54bc(0x181)+LEGACY_PARENT_SEGMENT_DIR+_0x4b54bc(0x255)+PARENT_SEGMENT_DIR+_0x4b54bc(0x170))),console['error'](a26_0x42e058[_0x4b54bc(0x1d0)](_0x4b54bc(0x235)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x4b54bc(0x1b5)](a26_0x42e058[_0x4b54bc(0x24b)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x4b54bc(0x245)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a26_0x42e058['green'](_0x4b54bc(0x23c)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c38ba){const _0x126b1c=_0x2c38ba instanceof Error?_0x2c38ba[_0x4b54bc(0x26b)]:String(_0x2c38ba);return console['error'](a26_0x42e058[_0x4b54bc(0x1dd)](_0x4b54bc(0x1f8)+_0x126b1c+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x3b2896(0x16b)](_0x282102){const _0x5ee7c1=a26_0x3b2896;return migrateLegacyDirectory(),super[_0x5ee7c1(0x16b)](_0x282102);}}function resolveYamlFile(_0x318224){const _0x3358cd=a26_0x3b2896;if(_0x318224[_0x3358cd(0x27c)](_0x3358cd(0x246))||_0x318224[_0x3358cd(0x27c)](_0x3358cd(0x1b4)))return _0x318224;return a26_0x4d4c78['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x318224)+_0x3358cd(0x246));}function formatProgressMessage(_0x5d2c29){const _0x3a9b84=a26_0x3b2896,_0x364d90=_0x5d2c29[_0x3a9b84(0x239)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x364d90){const [,_0x504715,_0x54da0,_0xb866d4='']=_0x364d90;return a26_0x42e058[_0x3a9b84(0x1d0)](_0x504715+':')+'\x20'+_0x54da0+a26_0x42e058[_0x3a9b84(0x1d0)](_0xb866d4);}return a26_0x42e058[_0x3a9b84(0x1d0)](_0x5d2c29);}function showFileNotFoundError(_0x32b2db,_0x19694e){const _0x546b9f=a26_0x3b2896;console[_0x546b9f(0x1b5)](a26_0x42e058[_0x546b9f(0x1dd)](_0x546b9f(0x16d)+_0x32b2db+'\x0a')),console[_0x546b9f(0x1b5)](a26_0x42e058[_0x546b9f(0x298)](_0x546b9f(0x20a)+_0x19694e+_0x546b9f(0x274)));}function displayRealtimeValidation(_0x67dbb3){const _0x5c4c06=a26_0x3b2896;if(!_0x67dbb3[_0x5c4c06(0x292)])return;const _0x52dc8e=_0x67dbb3['realtime'],_0x773283=_0x52dc8e[_0x5c4c06(0x275)]?a26_0x42e058[_0x5c4c06(0x11b)](_0x5c4c06(0x17a)):a26_0x42e058[_0x5c4c06(0x24b)](_0x5c4c06(0x19c));console[_0x5c4c06(0x1b5)]('\x0a'+a26_0x42e058[_0x5c4c06(0x1d0)]('RT\x202.0:')+'\x20'+_0x773283);if(_0x52dc8e[_0x5c4c06(0x153)]&&_0x52dc8e[_0x5c4c06(0x153)][_0x5c4c06(0x118)]>0x0){console['error']('\x20\x20'+a26_0x42e058['dim'](_0x5c4c06(0x265))+'\x20'+_0x52dc8e['events'][_0x5c4c06(0x118)]+_0x5c4c06(0x29e));for(const _0x31eebf of _0x52dc8e['events']){const _0x595f01=_0x31eebf[_0x5c4c06(0x17b)]===![]?a26_0x42e058['red']('✘'):a26_0x42e058[_0x5c4c06(0x11b)]('✔');console[_0x5c4c06(0x1b5)](_0x5c4c06(0x1d4)+_0x595f01+'\x20'+_0x31eebf[_0x5c4c06(0x230)]),_0x31eebf[_0x5c4c06(0x1c0)]&&console[_0x5c4c06(0x1b5)](_0x5c4c06(0x25a)+a26_0x42e058[_0x5c4c06(0x1dd)](_0x31eebf[_0x5c4c06(0x1c0)]));}}if(_0x52dc8e[_0x5c4c06(0x1ec)]&&_0x52dc8e[_0x5c4c06(0x1ec)]['length']>0x0){console[_0x5c4c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x5c4c06(0x1d0)](_0x5c4c06(0x26f))+'\x20'+_0x52dc8e['attributes'][_0x5c4c06(0x118)]+_0x5c4c06(0x29e));for(const _0x406899 of _0x52dc8e[_0x5c4c06(0x1ec)]){const _0xe0e5ca=_0x406899[_0x5c4c06(0x290)]?a26_0x42e058['green']('✔'):a26_0x42e058['red']('✘');console[_0x5c4c06(0x1b5)](_0x5c4c06(0x1d4)+_0xe0e5ca+'\x20'+_0x406899[_0x5c4c06(0x230)]+'\x20'+a26_0x42e058[_0x5c4c06(0x1d0)]('('+_0x406899[_0x5c4c06(0x160)]+')'));}}if(_0x52dc8e[_0x5c4c06(0x166)]){const _0x467fa5=_0x52dc8e['idStitching'][_0x5c4c06(0x14f)]?.[_0x5c4c06(0x118)]?_0x5c4c06(0x271)+_0x52dc8e[_0x5c4c06(0x166)][_0x5c4c06(0x14f)]['join'](',\x20')+']':'';console[_0x5c4c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x5c4c06(0x1d0)](_0x5c4c06(0x1c4))+'\x20'+_0x52dc8e['idStitching'][_0x5c4c06(0x22b)]+_0x467fa5);}if(_0x52dc8e[_0x5c4c06(0x1fc)]&&_0x52dc8e['personalizationServices'][_0x5c4c06(0x118)]>0x0){console[_0x5c4c06(0x1b5)]('\x20\x20'+a26_0x42e058['dim']('Personalization:')+'\x20'+_0x52dc8e[_0x5c4c06(0x1fc)]['length']+'\x20service'+(_0x52dc8e[_0x5c4c06(0x1fc)][_0x5c4c06(0x118)]!==0x1?'s':''));for(const _0x3242b5 of _0x52dc8e[_0x5c4c06(0x1fc)]){console[_0x5c4c06(0x1b5)]('\x20\x20\x20\x20-\x20'+_0x3242b5['name']);}}}function showParentSegmentNotSetError(_0x155b9f){const _0x164c69=a26_0x3b2896;console[_0x164c69(0x1b5)](a26_0x42e058[_0x164c69(0x24b)](_0x164c69(0x16a))),console['error'](_0x155b9f);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x1fe);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x1b7);async[a26_0x3b2896(0x163)](_0x5227c4){const _0x591693=a26_0x3b2896,{options:_0x5f3f2b,args:_0x1c8b76,tdx:_0x4062c5}=_0x5227c4,_0x2a7fd6=_0x1c8b76[0x0];_0x5f3f2b[_0x591693(0x164)]&&(console[_0x591693(0x1b5)](_0x591693(0x11a)+_0x5f3f2b[_0x591693(0x1c3)]),_0x2a7fd6&&console[_0x591693(0x1b5)](_0x591693(0x150)+_0x2a7fd6));const _0x186a8f=await withSpinner(_0x2a7fd6?_0x591693(0x178)+_0x2a7fd6+_0x591693(0x1b3):_0x591693(0x238),()=>_0x4062c5[_0x591693(0x12b)][_0x591693(0x17e)](),{'verbose':_0x5f3f2b[_0x591693(0x164)]});let _0x1cc013=_0x186a8f['data'];if(_0x2a7fd6){const _0x26ba02=_0x2a7fd6['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x591693(0x1df)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3bfdf2=new RegExp('^'+_0x26ba02+'$','i');_0x1cc013=_0x1cc013[_0x591693(0x1bd)](_0x1592bc=>_0x3bfdf2['test'](_0x1592bc[_0x591693(0x1ec)][_0x591693(0x230)]));}_0x1cc013[_0x591693(0x16f)]((_0x54b7ce,_0xd38cb9)=>_0x54b7ce[_0x591693(0x1ec)][_0x591693(0x230)][_0x591693(0x204)](_0xd38cb9[_0x591693(0x1ec)]['name'])),console[_0x591693(0x1b5)](_0x591693(0x17d)+_0x1cc013[_0x591693(0x118)]+_0x591693(0x1b1)+(_0x1cc013[_0x591693(0x118)]!==0x1?'s':''));const _0x128524=_0xcfdeca=>{const _0x5acce3=_0x591693;return getConsoleNextUrl(_0x5f3f2b[_0x5acce3(0x1c3)],'/app/dw/parentSegments/'+_0xcfdeca);};if(_0x5f3f2b[_0x591693(0x1f5)]===_0x591693(0x213)||_0x5f3f2b[_0x591693(0x1f5)]===_0x591693(0x195)){const _0x3f032a=_0x1cc013[_0x591693(0x199)](_0x4adda7=>({..._0x4adda7,'url':_0x128524(_0x4adda7['id'])}));await handleSDKOutput(_0x3f032a,_0x5f3f2b);}else{if(_0x1cc013[_0x591693(0x118)]===0x0)_0x2a7fd6?console['log'](_0x591693(0x277)+_0x2a7fd6):console[_0x591693(0x1b9)](_0x591693(0x285));else for(const _0x1f8b71 of _0x1cc013){const _0x5ef9da=_0x1f8b71[_0x591693(0x1ec)]['population']?a26_0x42e058[_0x591693(0x1d0)]('\x20('+formatRows(_0x1f8b71['attributes'][_0x591693(0x21f)])+')'):'',_0x4fff7a=hyperlink(_0x1f8b71[_0x591693(0x1ec)][_0x591693(0x230)],_0x128524(_0x1f8b71['id']));console[_0x591693(0x1b9)](_0x591693(0x15c)+_0x4fff7a+_0x5ef9da);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a26_0x3b2896(0x18a);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x14e);async[a26_0x3b2896(0x163)](_0x49772a){const _0x56b52b=a26_0x3b2896,{options:_0xfa3696,args:_0x465e8c,tdx:_0x2a6b80}=_0x49772a;console[_0x56b52b(0x1b5)](_0x56b52b(0x247)+_0x56b52b(0x197)+_0x56b52b(0x128));const _0x2c2a53=_0xfa3696;if(_0x465e8c[_0x56b52b(0x118)]===0x0)return console[_0x56b52b(0x1b5)](a26_0x42e058[_0x56b52b(0x1dd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x56b52b(0x1da)),0x1;const _0x1d50f9=_0x465e8c[0x0];if(!_0x2c2a53[_0x56b52b(0x205)]||!_0x2c2a53[_0x56b52b(0x1f7)])return console['error'](_0x56b52b(0x288)),console[_0x56b52b(0x1b5)](_0x56b52b(0x1da)),0x1;_0x2c2a53[_0x56b52b(0x164)]&&(console['error'](_0x56b52b(0x11a)+_0x2c2a53[_0x56b52b(0x1c3)]),console[_0x56b52b(0x1b5)]('Name:\x20'+_0x1d50f9),console[_0x56b52b(0x1b5)]('Database:\x20'+_0x2c2a53['database']),console[_0x56b52b(0x1b5)]('Table:\x20'+_0x2c2a53[_0x56b52b(0x1f7)]));const _0x532dd4=await loadJSONFromOptions(_0x2c2a53[_0x56b52b(0x1ec)],_0x2c2a53[_0x56b52b(0x196)]),_0x1bb641=await loadJSONFromOptions(_0x2c2a53[_0x56b52b(0x162)],_0x2c2a53[_0x56b52b(0x157)]),_0x232c3b=await loadJSONFromOptions(_0x2c2a53[_0x56b52b(0x176)],_0x2c2a53['customerGroupFile']),_0x33d8ce={'name':_0x1d50f9,'description':_0x2c2a53[_0x56b52b(0x24a)],'scheduleType':_0x2c2a53[_0x56b52b(0x22f)],'scheduleOption':_0x2c2a53[_0x56b52b(0x294)],'timezone':_0x2c2a53[_0x56b52b(0x28c)],'master':{'parentDatabaseName':_0x2c2a53[_0x56b52b(0x205)],'parentTableName':_0x2c2a53[_0x56b52b(0x1f7)]},'attributes':_0x532dd4,'behaviors':_0x1bb641,'customerGroup':_0x232c3b},_0x29cde5=await withSpinner(_0x56b52b(0x231)+_0x1d50f9+_0x56b52b(0x1b3),()=>_0x2a6b80[_0x56b52b(0x12b)][_0x56b52b(0x19f)](_0x33d8ce),{'verbose':_0xfa3696[_0x56b52b(0x164)]}),_0x10d1f4=_0x29cde5[_0x56b52b(0x119)];return console[_0x56b52b(0x1b5)](_0x56b52b(0x158)+_0x10d1f4[_0x56b52b(0x230)]+_0x56b52b(0x146)+_0x10d1f4['id']),await handleSDKOutput([_0x10d1f4],_0xfa3696),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x248);[a26_0x3b2896(0x24a)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x3b2896(0x163)](_0x2b57d6){const _0x1a2ad3=a26_0x3b2896,{options:_0x2526b8,args:_0x5e8704,tdx:_0x56e099}=_0x2b57d6;console[_0x1a2ad3(0x1b5)](_0x1a2ad3(0x24f)+_0x1a2ad3(0x197)+_0x1a2ad3(0x128));const _0x5c89b6=_0x2526b8;if(_0x5e8704[_0x1a2ad3(0x118)]===0x0)return console[_0x1a2ad3(0x1b5)](a26_0x42e058['red'](_0x1a2ad3(0x227))),console[_0x1a2ad3(0x1b5)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x332405=_0x5e8704[0x0];_0x5c89b6['verbose']&&(console[_0x1a2ad3(0x1b5)](_0x1a2ad3(0x11a)+_0x5c89b6[_0x1a2ad3(0x1c3)]),console[_0x1a2ad3(0x1b5)](_0x1a2ad3(0x233)+_0x332405));const _0x530aae=await withSpinner(_0x1a2ad3(0x258)+_0x332405+_0x1a2ad3(0x1b3),()=>_0x56e099[_0x1a2ad3(0x12b)]['getParentFull'](_0x332405),{'verbose':_0x5c89b6[_0x1a2ad3(0x164)]}),_0xac5b98=_0x530aae[_0x1a2ad3(0x119)],_0x195508=await loadJSONFromOptions(_0x5c89b6[_0x1a2ad3(0x2a4)],_0x5c89b6[_0x1a2ad3(0x278)]),_0x49f577=await loadJSONFromOptions(_0x5c89b6[_0x1a2ad3(0x217)],_0x5c89b6['addBehaviorsFile']),_0x3ef499={'name':_0xac5b98['name'],'description':_0x5c89b6[_0x1a2ad3(0x24a)]!==undefined?_0x5c89b6[_0x1a2ad3(0x24a)]:_0xac5b98[_0x1a2ad3(0x24a)],'scheduleType':_0x5c89b6['scheduleType']!==undefined?_0x5c89b6[_0x1a2ad3(0x22f)]:_0xac5b98[_0x1a2ad3(0x22f)],'scheduleOption':_0x5c89b6['scheduleOption']!==undefined?_0x5c89b6[_0x1a2ad3(0x294)]:_0xac5b98[_0x1a2ad3(0x294)],'timezone':_0x5c89b6[_0x1a2ad3(0x28c)]!==undefined?_0x5c89b6[_0x1a2ad3(0x28c)]:_0xac5b98[_0x1a2ad3(0x28c)],'master':_0xac5b98[_0x1a2ad3(0x28d)],'attributes':_0x195508?[..._0xac5b98[_0x1a2ad3(0x1ec)]||[],..._0x195508]:_0xac5b98[_0x1a2ad3(0x1ec)],'behaviors':_0x49f577?[..._0xac5b98[_0x1a2ad3(0x162)]||[],..._0x49f577]:_0xac5b98[_0x1a2ad3(0x162)],'customerGroup':_0xac5b98[_0x1a2ad3(0x176)]},_0x283eb7=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x332405+_0x1a2ad3(0x1b3),()=>_0x56e099[_0x1a2ad3(0x12b)][_0x1a2ad3(0x131)](_0x332405,_0x3ef499),{'verbose':_0x5c89b6[_0x1a2ad3(0x164)]}),_0x199b4c=_0x283eb7[_0x1a2ad3(0x119)];return console['error'](_0x1a2ad3(0x1cd)+_0x199b4c[_0x1a2ad3(0x230)]+'\x27'),await handleSDKOutput([_0x199b4c],_0x5c89b6),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x1d5);[a26_0x3b2896(0x24a)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x56d3d8){const _0x1c00fb=a26_0x3b2896,{options:_0x4d8927,args:_0x499811,tdx:_0x5d3394}=_0x56d3d8,_0x887165=_0x4d8927,_0x457400=_0x499811[0x0]||_0x4d8927[_0x1c00fb(0x172)];if(!_0x457400)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(_0x887165[_0x1c00fb(0x171)]&&_0x887165[_0x1c00fb(0x185)])return console[_0x1c00fb(0x1b5)](a26_0x42e058[_0x1c00fb(0x1dd)](_0x1c00fb(0x29d))),console[_0x1c00fb(0x1b5)](a26_0x42e058[_0x1c00fb(0x1d0)](_0x1c00fb(0x17c))),console['error'](a26_0x42e058[_0x1c00fb(0x1d0)](_0x1c00fb(0x1dc)+PARENT_SEGMENT_DIR+_0x1c00fb(0x1fd))),console['error'](a26_0x42e058['cyan'](_0x1c00fb(0x124))),0x1;const _0x51bba1=_0x887165[_0x1c00fb(0x185)]||a26_0x4d4c78[_0x1c00fb(0x130)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x457400)+_0x1c00fb(0x246));_0x887165[_0x1c00fb(0x164)]&&(console[_0x1c00fb(0x1b5)](_0x1c00fb(0x11a)+_0x887165[_0x1c00fb(0x1c3)]),console[_0x1c00fb(0x1b5)](_0x1c00fb(0x233)+_0x457400),console[_0x1c00fb(0x1b5)](_0x1c00fb(0x27a)+_0x51bba1));const _0x52ea40=await withSpinner(_0x1c00fb(0x28b)+_0x457400+_0x1c00fb(0x1b3),()=>_0x5d3394[_0x1c00fb(0x12b)][_0x1c00fb(0x132)](_0x457400),{'verbose':_0x887165['verbose']}),_0x2b96d2=_0x52ea40['data'];if(existsSync(_0x51bba1)){const _0x330585=readFileSync(_0x51bba1,'utf-8'),_0x2b0482=generateDiff(_0x330585,_0x2b96d2);if(!hasChanges(_0x2b0482))console['error'](a26_0x42e058[_0x1c00fb(0x11b)]('✔')+'\x20No\x20changes\x20-\x20'+a26_0x42e058[_0x1c00fb(0x298)](_0x51bba1)+_0x1c00fb(0x2a2));else{console[_0x1c00fb(0x1b5)]('\x0aChanges\x20to\x20\x27'+_0x51bba1+'\x27:'),console['error']('─'[_0x1c00fb(0x1a3)](0x3c)),console['error'](formatDiffWithColors(_0x2b0482)),console[_0x1c00fb(0x1b5)]('─'[_0x1c00fb(0x1a3)](0x3c));if(!_0x887165['yes']){if(!isInteractive())return console[_0x1c00fb(0x1b5)](a26_0x42e058['red'](_0x1c00fb(0x19e)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1c00fb(0x1b5)](a26_0x42e058['dim'](_0x1c00fb(0x18c))),0x1;const _0x50297d=await confirmKey(_0x1c00fb(0x299)+_0x51bba1+'\x27?');if(!_0x50297d)return console['error'](a26_0x42e058['yellow'](_0x1c00fb(0x27d))),0x1;}writeFileSync(_0x51bba1,_0x2b96d2,_0x1c00fb(0x1e5)),console[_0x1c00fb(0x1b5)](a26_0x42e058[_0x1c00fb(0x11b)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x42e058[_0x1c00fb(0x298)](_0x51bba1));}}else{const _0x173c1c=a26_0x4d4c78[_0x1c00fb(0x135)](_0x51bba1);!existsSync(_0x173c1c)&&mkdirSync(_0x173c1c,{'recursive':!![]}),writeFileSync(_0x51bba1,_0x2b96d2,_0x1c00fb(0x1e5)),console[_0x1c00fb(0x1b5)](a26_0x42e058[_0x1c00fb(0x11b)]('✔')+_0x1c00fb(0x169)+a26_0x42e058['cyan'](_0x51bba1));}return saveSessionContext({'parent_segment':_0x457400},_0x887165[_0x1c00fb(0x149)]),console[_0x1c00fb(0x1b5)](a26_0x42e058[_0x1c00fb(0x11b)]('✔')+_0x1c00fb(0x1a7)+a26_0x42e058[_0x1c00fb(0x1d0)](_0x1c00fb(0x1a6))+'\x20=\x20'+a26_0x42e058[_0x1c00fb(0x298)](_0x457400)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x3b2896(0x230)]='segment:parent:push';[a26_0x3b2896(0x24a)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x3b2896(0x163)](_0x4d9437){const _0x1bfb78=a26_0x3b2896,{options:_0x40465c,args:_0x34d4df,tdx:_0x57cc01}=_0x4d9437,_0x4f171f=_0x40465c,_0x3c0e97=_0x34d4df[0x0]||_0x40465c['parentSegment'];if(!_0x3c0e97)return showParentSegmentNotSetError(_0x1bfb78(0x273)+_0x1bfb78(0x252)),0x1;const _0x1ba5dc=resolveYamlFile(_0x3c0e97);if(!existsSync(_0x1ba5dc))return showFileNotFoundError(_0x1ba5dc,_0x3c0e97),0x1;_0x4f171f[_0x1bfb78(0x164)]&&(console['error']('Site:\x20'+_0x4f171f[_0x1bfb78(0x1c3)]),console[_0x1bfb78(0x1b5)](_0x1bfb78(0x1ee)+_0x1ba5dc));let _0x473f80;try{_0x473f80=readFileSync(_0x1ba5dc,_0x1bfb78(0x1e5));}catch(_0x39f710){const _0x1f85c5=_0x39f710 instanceof Error?_0x39f710[_0x1bfb78(0x26b)]:String(_0x39f710);return console[_0x1bfb78(0x1b5)](_0x1bfb78(0x267)+_0x1f85c5),0x1;}const _0x555709=await withSpinner(_0x1bfb78(0x18d),()=>_0x57cc01[_0x1bfb78(0x12b)][_0x1bfb78(0x272)](_0x473f80),{'verbose':_0x4f171f['verbose']}),_0x14b2b4=_0x555709[_0x1bfb78(0x119)],{isNew:_0x5a655d,name:_0x299fdb,hasChanges:_0xb95f9f,diffFormatted:_0x286fd0}=_0x14b2b4;if(!_0xb95f9f)return console[_0x1bfb78(0x1b5)]('✔\x20No\x20changes\x20-\x20\x27'+_0x299fdb+_0x1bfb78(0x26c)),0x0;_0x5a655d?console['error'](_0x1bfb78(0x115)+_0x299fdb+'\x27:'):console[_0x1bfb78(0x1b5)](_0x1bfb78(0x1f0)+_0x299fdb+'\x27:');console[_0x1bfb78(0x1b5)]('─'['repeat'](0x3c)),console[_0x1bfb78(0x1b5)](_0x286fd0),console[_0x1bfb78(0x1b5)]('─'['repeat'](0x3c));const _0x56f3f9=_0x5a655d?_0x1bfb78(0x1ff)+_0x299fdb+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x299fdb+'\x27?';if(!_0x4f171f[_0x1bfb78(0x253)]){if(!isInteractive())return console[_0x1bfb78(0x1b5)](a26_0x42e058[_0x1bfb78(0x1dd)](_0x1bfb78(0x19e)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a26_0x42e058[_0x1bfb78(0x1d0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3f19b6=await confirmKey(_0x56f3f9);if(!_0x3f19b6)return console[_0x1bfb78(0x1b5)](a26_0x42e058[_0x1bfb78(0x24b)]('Aborted.')),0x1;}const _0x3db794=_0x5a655d?_0x1bfb78(0x1af):_0x1bfb78(0x1bb),_0x308284=await withSpinner(_0x3db794+'\x20parent\x20segment\x20\x27'+_0x299fdb+_0x1bfb78(0x1b3),()=>_0x14b2b4[_0x1bfb78(0x23e)](),{'verbose':_0x4f171f[_0x1bfb78(0x164)]}),_0x284e61=_0x308284['data'],_0x552796=getConsoleNextUrl(_0x4f171f['site'],'/app/dw/parentSegments/'+_0x284e61['id']),_0x3e84df=_0x5a655d?_0x1bfb78(0x13d):_0x1bfb78(0x1be);return console[_0x1bfb78(0x1b5)]('✔\x20'+_0x3e84df+_0x1bfb78(0x291)+_0x284e61[_0x1bfb78(0x230)]+'\x27'),console[_0x1bfb78(0x1b5)]('\x20\x20'+_0x552796),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x3b2896(0x167);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x5aea4f){const _0x4dec7e=a26_0x3b2896,{options:_0x447d26,args:_0x479892,tdx:_0x1d0fc0}=_0x5aea4f,_0x4bdfe1=_0x447d26,_0x2c722f=_0x479892[0x0]||_0x447d26['parentSegment'];if(!_0x2c722f)return showParentSegmentNotSetError(_0x4dec7e(0x200)+_0x4dec7e(0x24c)+_0x4dec7e(0x1f9)+_0x4dec7e(0x1a4)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x5b1621=resolveYamlFile(_0x2c722f);if(!existsSync(_0x5b1621))return showFileNotFoundError(_0x5b1621,_0x2c722f),0x1;_0x4bdfe1['verbose']&&(console[_0x4dec7e(0x1b5)](_0x4dec7e(0x11a)+_0x4bdfe1[_0x4dec7e(0x1c3)]),console[_0x4dec7e(0x1b5)](_0x4dec7e(0x1ee)+_0x5b1621));let _0x4c57c9;try{_0x4c57c9=readFileSync(_0x5b1621,_0x4dec7e(0x1e5));}catch(_0xa3d19b){const _0x470e8a=_0xa3d19b instanceof Error?_0xa3d19b[_0x4dec7e(0x26b)]:String(_0xa3d19b);return console[_0x4dec7e(0x1b5)](_0x4dec7e(0x267)+_0x470e8a),0x1;}const _0x5e93e9=createCommandSpinner(a26_0x42e058[_0x4dec7e(0x1d0)](_0x4dec7e(0x183)),{'verbose':_0x4bdfe1[_0x4dec7e(0x164)]});_0x5e93e9[_0x4dec7e(0x261)]();const _0x15078c={'onProgress':_0x205325=>{const _0x563e03=_0x4dec7e;_0x5e93e9[_0x563e03(0x1a9)]=formatProgressMessage(_0x205325);}};if(_0x4bdfe1[_0x4dec7e(0x28d)])_0x15078c['master']=!![];if(_0x4bdfe1[_0x4dec7e(0x145)])_0x15078c[_0x4dec7e(0x145)]=!![];_0x4bdfe1[_0x4dec7e(0x243)]&&(_0x15078c['attribute']=_0x4bdfe1[_0x4dec7e(0x243)]);_0x4bdfe1[_0x4dec7e(0x211)]&&(_0x15078c['behavior']=_0x4bdfe1['behavior']);if(_0x4bdfe1[_0x4dec7e(0x138)])_0x15078c['interval']=_0x4bdfe1['interval'];let _0x2f8781;try{_0x2f8781=await _0x1d0fc0[_0x4dec7e(0x12b)][_0x4dec7e(0x16c)](_0x4c57c9,_0x15078c),_0x5e93e9[_0x4dec7e(0x1a2)]();}catch(_0x4d7a65){_0x5e93e9['stop']();throw _0x4d7a65;}const _0x3672d8=_0x4bdfe1[_0x4dec7e(0x138)]||_0x4dec7e(0x249);return this[_0x4dec7e(0x276)](_0x2f8781,_0x15078c,_0x5b1621,_0x3672d8),_0x2f8781[_0x4dec7e(0x20d)]?0x0:0x1;}[a26_0x3b2896(0x276)](_0xcb2c88,_0x29f28c,_0x17e3af,_0x453e2d){const _0x576ea8=a26_0x3b2896;console[_0x576ea8(0x1b5)]('\x0a'+a26_0x42e058[_0x576ea8(0x1b8)](_0x576ea8(0x13b))+'\x20'+_0xcb2c88[_0x576ea8(0x230)]),console[_0x576ea8(0x1b5)]('═'[_0x576ea8(0x1a3)](0x3c)),this['displayMasterInfo'](_0xcb2c88);if(typeof _0x29f28c['attribute']===_0x576ea8(0x1f3)){this[_0x576ea8(0x137)](_0xcb2c88),this[_0x576ea8(0x1ca)](_0xcb2c88),this[_0x576ea8(0x25e)](_0x17e3af,_0x453e2d,_0x576ea8(0x243),_0x29f28c['attribute']);return;}if(_0x29f28c[_0x576ea8(0x243)]===!![]){this[_0x576ea8(0x137)](_0xcb2c88),this[_0x576ea8(0x1ca)](_0xcb2c88),this['displayPreviewHints'](_0x17e3af,_0x453e2d,_0x576ea8(0x1ec));return;}if(typeof _0x29f28c[_0x576ea8(0x211)]===_0x576ea8(0x1f3)){this[_0x576ea8(0x26a)](_0xcb2c88,_0x453e2d),this['displaySummary'](_0xcb2c88),this[_0x576ea8(0x25e)](_0x17e3af,_0x453e2d,_0x576ea8(0x211),_0x29f28c[_0x576ea8(0x211)]);return;}if(_0x29f28c['behavior']===!![]){this[_0x576ea8(0x26a)](_0xcb2c88,_0x453e2d),this[_0x576ea8(0x1ca)](_0xcb2c88),this['displayPreviewHints'](_0x17e3af,_0x453e2d,'behaviors');return;}this[_0x576ea8(0x137)](_0xcb2c88),this[_0x576ea8(0x26a)](_0xcb2c88,_0x453e2d),this[_0x576ea8(0x15b)](_0xcb2c88),this[_0x576ea8(0x1ca)](_0xcb2c88),this[_0x576ea8(0x25e)](_0x17e3af,_0x453e2d,_0x576ea8(0x29b));}[a26_0x3b2896(0x15b)](_0x3860a0){displayRealtimeValidation(_0x3860a0);}['displayPreviewHints'](_0xb0477f,_0x509cca,_0xb43d07,_0x23fc60){const _0x260c06=a26_0x3b2896;console[_0x260c06(0x1b5)]('\x0a'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x212)));const _0x3d1ce9=_0x509cca!==_0x260c06(0x249)?'\x20--interval\x20'+_0x509cca:'';if(_0xb43d07===_0x260c06(0x243)&&_0x23fc60)console[_0x260c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x1fb)+_0xb0477f+_0x260c06(0x1ea)+_0x23fc60+'\x22'+_0x3d1ce9));else{if(_0xb43d07===_0x260c06(0x211)&&_0x23fc60)console[_0x260c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x1fb)+_0xb0477f+_0x260c06(0x1a5)+_0x23fc60+'\x22'+_0x3d1ce9));else(_0xb43d07==='attributes'||_0xb43d07===_0x260c06(0x29b))&&console[_0x260c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x1fb)+_0xb0477f+_0x260c06(0x29a)+_0x3d1ce9));}(_0xb43d07===_0x260c06(0x162)||_0xb43d07===_0x260c06(0x29b))&&console[_0x260c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x1fb)+_0xb0477f+_0x260c06(0x22a)+_0x3d1ce9)),_0xb43d07===_0x260c06(0x29b)&&console[_0x260c06(0x1b5)]('\x20\x20'+a26_0x42e058[_0x260c06(0x1d0)](_0x260c06(0x1fb)+_0xb0477f+_0x260c06(0x254)+_0x3d1ce9));}['displayMasterInfo'](_0x3c4b2d){const _0x2afb6c=a26_0x3b2896,{master:_0x13a2ca}=_0x3c4b2d,_0x19838a=_0x13a2ca['schemaValid']?a26_0x42e058[_0x2afb6c(0x11b)]('✔'):a26_0x42e058[_0x2afb6c(0x1dd)]('✘');console[_0x2afb6c(0x1b5)]('\x0a'+a26_0x42e058['dim'](_0x2afb6c(0x14b))),console[_0x2afb6c(0x1b5)](_0x19838a+'\x20'+a26_0x42e058[_0x2afb6c(0x1b8)](_0x13a2ca[_0x2afb6c(0x205)]+'.'+_0x13a2ca[_0x2afb6c(0x1f7)])),_0x13a2ca[_0x2afb6c(0x194)]?_0x13a2ca['rowCount']!==undefined&&console[_0x2afb6c(0x1b5)]('\x20\x20'+a26_0x42e058[_0x2afb6c(0x1d0)]('Rows:')+'\x20'+a26_0x42e058[_0x2afb6c(0x298)](formatRows(_0x13a2ca[_0x2afb6c(0x179)]))):console['error']('\x20\x20'+a26_0x42e058[_0x2afb6c(0x1dd)](_0x2afb6c(0x21a))+'\x20'+_0x13a2ca[_0x2afb6c(0x228)]);}[a26_0x3b2896(0x137)](_0x440bcb){const _0x1058b2=a26_0x3b2896;if(_0x440bcb[_0x1058b2(0x1ec)][_0x1058b2(0x118)]===0x0)return;console[_0x1058b2(0x1b5)]('\x0a'+a26_0x42e058[_0x1058b2(0x1d0)](_0x1058b2(0x20b)));for(const _0x482bbb of _0x440bcb[_0x1058b2(0x1ec)]){const _0x238dc4=_0x482bbb[_0x1058b2(0x194)]?a26_0x42e058[_0x1058b2(0x11b)]('✔'):a26_0x42e058['red']('✘');let _0xcbaecd='';if(_0x482bbb[_0x1058b2(0x194)]&&_0x482bbb['matchedCount']!==undefined&&_0x482bbb[_0x1058b2(0x1c9)]!==undefined){const _0x23ca0c=_0x482bbb[_0x1058b2(0x1c9)][_0x1058b2(0x295)](0x1),_0x68805f=_0x482bbb['coveragePercent']>=0x50?a26_0x42e058[_0x1058b2(0x11b)]:_0x482bbb[_0x1058b2(0x1c9)]>=0x32?a26_0x42e058[_0x1058b2(0x24b)]:a26_0x42e058[_0x1058b2(0x1dd)];_0xcbaecd='\x20'+a26_0x42e058[_0x1058b2(0x1d0)]('Coverage:')+'\x20'+_0x68805f(_0x23ca0c+'%')+'\x20('+formatRows(_0x482bbb['matchedCount'])+'\x20rows)';}console[_0x1058b2(0x1b5)](_0x238dc4+'\x20'+a26_0x42e058[_0x1058b2(0x1b8)](_0x482bbb[_0x1058b2(0x230)])+_0xcbaecd),console[_0x1058b2(0x1b5)]('\x20\x20'+a26_0x42e058[_0x1058b2(0x1d0)](_0x1058b2(0x270))+'\x20'+a26_0x42e058[_0x1058b2(0x1b8)](_0x482bbb['database']+'.'+_0x482bbb[_0x1058b2(0x1f7)]));const _0xb89529=_0x482bbb[_0x1058b2(0x15a)]===_0x482bbb[_0x1058b2(0x24d)]?a26_0x42e058['dim']('Join\x20on:')+'\x20'+_0x482bbb['joinKey']:a26_0x42e058[_0x1058b2(0x1d0)](_0x1058b2(0x222))+'\x20'+_0x482bbb[_0x1058b2(0x15a)]+_0x1058b2(0x133)+_0x482bbb[_0x1058b2(0x24d)];console[_0x1058b2(0x1b5)]('\x20\x20'+_0xb89529),console[_0x1058b2(0x1b5)]('\x20\x20'+a26_0x42e058[_0x1058b2(0x1d0)]('Columns:')),this[_0x1058b2(0x168)](_0x482bbb[_0x1058b2(0x262)]),!_0x482bbb['schemaValid']&&console[_0x1058b2(0x1b5)]('\x20\x20'+a26_0x42e058[_0x1058b2(0x1dd)](_0x1058b2(0x21a))+'\x20'+_0x482bbb[_0x1058b2(0x228)]);}}[a26_0x3b2896(0x26a)](_0x2fe706,_0x2e8724){const _0xac27c=a26_0x3b2896;if(_0x2fe706['behaviors'][_0xac27c(0x118)]===0x0)return;console[_0xac27c(0x1b5)]('\x0a'+a26_0x42e058['dim'](_0xac27c(0x139))+'\x20'+a26_0x42e058[_0xac27c(0x1d0)]('('+_0x2e8724+')'));for(const _0x28ceea of _0x2fe706['behaviors']){const _0x35af72=_0x28ceea[_0xac27c(0x194)]?a26_0x42e058['green']('✔'):a26_0x42e058[_0xac27c(0x1dd)]('✘');let _0x51cc9e='';if(_0x28ceea['schemaValid']&&_0x28ceea[_0xac27c(0x184)]!==undefined&&_0x28ceea[_0xac27c(0x1a8)]!==undefined){const _0x37beec=_0x28ceea[_0xac27c(0x15f)]?.[_0xac27c(0x295)](0x1)||'?',_0x16b29d=(_0x28ceea[_0xac27c(0x15f)]??0x0)>=0x32?a26_0x42e058[_0xac27c(0x11b)]:(_0x28ceea[_0xac27c(0x15f)]??0x0)>=0x14?a26_0x42e058[_0xac27c(0x24b)]:a26_0x42e058[_0xac27c(0x1dd)];_0x51cc9e='\x20'+a26_0x42e058[_0xac27c(0x1d0)](_0xac27c(0x1bc))+'\x20'+_0x16b29d(formatRows(_0x28ceea[_0xac27c(0x184)]))+'\x20('+_0x37beec+'%)\x20'+a26_0x42e058[_0xac27c(0x1d0)]('Events:')+'\x20'+a26_0x42e058[_0xac27c(0x298)](formatRows(_0x28ceea['totalEvents']));}console[_0xac27c(0x1b5)](_0x35af72+'\x20'+a26_0x42e058[_0xac27c(0x1b8)](_0x28ceea['name'])+_0x51cc9e),console[_0xac27c(0x1b5)]('\x20\x20'+a26_0x42e058['dim'](_0xac27c(0x270))+'\x20'+a26_0x42e058['bold'](_0x28ceea['database']+'.'+_0x28ceea[_0xac27c(0x1f7)]));const _0x4dcd62=_0x28ceea[_0xac27c(0x15a)]===_0x28ceea['foreignKey']?a26_0x42e058['dim'](_0xac27c(0x282))+'\x20'+_0x28ceea['joinKey']:a26_0x42e058[_0xac27c(0x1d0)](_0xac27c(0x222))+'\x20'+_0x28ceea[_0xac27c(0x15a)]+_0xac27c(0x133)+_0x28ceea[_0xac27c(0x24d)];console[_0xac27c(0x1b5)]('\x20\x20'+_0x4dcd62),console[_0xac27c(0x1b5)]('\x20\x20'+a26_0x42e058['dim']('Columns:')),this[_0xac27c(0x168)](_0x28ceea[_0xac27c(0x262)]),!_0x28ceea[_0xac27c(0x194)]&&console[_0xac27c(0x1b5)]('\x20\x20'+a26_0x42e058[_0xac27c(0x1dd)](_0xac27c(0x21a))+'\x20'+_0x28ceea['schemaError']);}}['displayColumns'](_0x123934){const _0xe01180=a26_0x3b2896;for(const _0x2a1cbb of _0x123934){_0x2a1cbb['label']===_0x2a1cbb[_0xe01180(0x260)]||_0x2a1cbb[_0xe01180(0x260)]==='*'?console[_0xe01180(0x1b5)](_0xe01180(0x14a)+_0x2a1cbb[_0xe01180(0x1d2)]):console[_0xe01180(0x1b5)]('\x20\x20\x20\x20-\x20'+_0x2a1cbb[_0xe01180(0x1d2)]+'\x20'+a26_0x42e058[_0xe01180(0x1d0)]('('+_0x2a1cbb[_0xe01180(0x260)]+')'));}}['displaySummary'](_0x41d2c6){const _0x274b1a=a26_0x3b2896;console[_0x274b1a(0x1b5)]('─'['repeat'](0x3c));if(_0x41d2c6[_0x274b1a(0x240)][_0x274b1a(0x118)]>0x0){console[_0x274b1a(0x1b5)]('\x0a'+a26_0x42e058[_0x274b1a(0x1dd)]('Errors:'));for(const _0x26f0c9 of _0x41d2c6[_0x274b1a(0x240)]){console[_0x274b1a(0x1b5)]('\x20\x20'+a26_0x42e058[_0x274b1a(0x1dd)]('•')+'\x20'+_0x26f0c9);}}_0x41d2c6['allValid']&&console[_0x274b1a(0x1b5)]('\x0a'+a26_0x42e058[_0x274b1a(0x11b)]('✔')+_0x274b1a(0x1c2));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x3b2896(0x230)]='segment:parent:preview';[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x1cf);async['execute'](_0x1f7d02){const _0x552659=a26_0x3b2896,{options:_0x382b39,args:_0x2cb41f,tdx:_0x5cde41}=_0x1f7d02,_0x89cb6=_0x382b39,_0x8c6838=_0x2cb41f[0x0]||_0x382b39['parentSegment'];if(!_0x8c6838)return showParentSegmentNotSetError(_0x552659(0x129)+_0x552659(0x1a0)+'Options\x20(one\x20required):\x0a'+_0x552659(0x16e)+_0x552659(0x1c1)+_0x552659(0x12c)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x552659(0x1f1)),0x1;if(!_0x89cb6['master']&&!_0x89cb6[_0x552659(0x243)]&&!_0x89cb6['behavior']&&!_0x89cb6['enriched'])return console[_0x552659(0x1b5)](a26_0x42e058['red'](_0x552659(0x1b6))),console['error'](_0x552659(0x127)),console[_0x552659(0x1b5)](_0x552659(0x214)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x552659(0x1b5)](_0x552659(0x1c5)),console[_0x552659(0x1b5)](_0x552659(0x281)),console[_0x552659(0x1b5)](_0x552659(0x241)),0x1;const _0xc1ead7=resolveYamlFile(_0x8c6838);if(!existsSync(_0xc1ead7))return showFileNotFoundError(_0xc1ead7,_0x8c6838),0x1;_0x89cb6[_0x552659(0x164)]&&(console[_0x552659(0x1b5)](_0x552659(0x11a)+_0x89cb6[_0x552659(0x1c3)]),console[_0x552659(0x1b5)]('YAML\x20file:\x20'+_0xc1ead7));let _0x526b66;try{_0x526b66=readFileSync(_0xc1ead7,'utf-8');}catch(_0x402e85){const _0x20ff42=_0x402e85 instanceof Error?_0x402e85[_0x552659(0x26b)]:String(_0x402e85);return console[_0x552659(0x1b5)](_0x552659(0x267)+_0x20ff42),0x1;}let _0x371a11;try{_0x371a11=parseDef(_0x526b66);}catch(_0x338412){const _0x30747d=_0x338412 instanceof Error?_0x338412[_0x552659(0x26b)]:String(_0x338412);return console[_0x552659(0x1b5)](a26_0x42e058['red'](_0x552659(0x23d)+_0x30747d)),0x1;}if(_0x89cb6['attribute']===!![]||_0x89cb6[_0x552659(0x243)]===''){const _0x5ca250=_0x371a11[_0x552659(0x1ec)]?.['map'](_0x1c25a8=>_0x1c25a8['name'])||[];if(_0x5ca250['length']===0x0)console[_0x552659(0x1b5)](a26_0x42e058[_0x552659(0x1dd)](_0x552659(0x1c7)));else{console['error'](a26_0x42e058[_0x552659(0x1dd)](_0x552659(0x29c))),console[_0x552659(0x1b5)](_0x552659(0x25c));for(const _0x4de26a of _0x5ca250){console['error']('\x20\x20'+a26_0x42e058[_0x552659(0x298)](_0x4de26a));}console[_0x552659(0x1b5)](_0x552659(0x143)+_0x8c6838+_0x552659(0x1ea)+_0x5ca250[0x0]+'\x22');}return 0x1;}if(_0x89cb6[_0x552659(0x211)]===!![]||_0x89cb6[_0x552659(0x211)]===''){const _0x2d0953=_0x371a11[_0x552659(0x162)]?.[_0x552659(0x199)](_0x32f20d=>_0x32f20d[_0x552659(0x230)])||[];if(_0x2d0953[_0x552659(0x118)]===0x0)console[_0x552659(0x1b5)](a26_0x42e058[_0x552659(0x1dd)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x552659(0x1b5)](a26_0x42e058['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x552659(0x1b5)]('Available\x20behaviors:');for(const _0xa832bb of _0x2d0953){console[_0x552659(0x1b5)]('\x20\x20'+a26_0x42e058[_0x552659(0x298)](_0xa832bb));}console[_0x552659(0x1b5)](_0x552659(0x143)+_0x8c6838+_0x552659(0x1a5)+_0x2d0953[0x0]+'\x22');}return 0x1;}const _0x214bdd=createCommandSpinner(a26_0x42e058[_0x552659(0x1d0)](_0x552659(0x1e4)),{'verbose':_0x89cb6['verbose']});_0x214bdd[_0x552659(0x261)]();const _0x303ec8={'onProgress':_0x32f8f3=>{const _0x5abf86=_0x552659;_0x214bdd[_0x5abf86(0x1a9)]=formatProgressMessage(_0x32f8f3);}};if(_0x89cb6[_0x552659(0x28d)])_0x303ec8['master']=!![];if(_0x89cb6[_0x552659(0x243)]&&typeof _0x89cb6[_0x552659(0x243)]==='string')_0x303ec8['attribute']=_0x89cb6[_0x552659(0x243)];if(_0x89cb6[_0x552659(0x211)]&&typeof _0x89cb6[_0x552659(0x211)]===_0x552659(0x1f3))_0x303ec8[_0x552659(0x211)]=_0x89cb6['behavior'];if(_0x89cb6[_0x552659(0x145)])_0x303ec8[_0x552659(0x145)]=!![];if(_0x89cb6[_0x552659(0x138)])_0x303ec8['interval']=_0x89cb6[_0x552659(0x138)];let _0x439168;try{_0x439168=await _0x5cde41['segment'][_0x552659(0x25b)](_0x526b66,_0x303ec8),_0x214bdd[_0x552659(0x1a2)]();}catch(_0x4da54e){_0x214bdd[_0x552659(0x1a2)]();throw _0x4da54e;}return await this['displayPreviewResults'](_0x439168,{'master':_0x89cb6[_0x552659(0x28d)],'attribute':typeof _0x89cb6[_0x552659(0x243)]===_0x552659(0x1f3)?_0x89cb6['attribute']:undefined,'behavior':typeof _0x89cb6[_0x552659(0x211)]==='string'?_0x89cb6[_0x552659(0x211)]:undefined,'enriched':_0x89cb6[_0x552659(0x145)]}),_0x439168[_0x552659(0x20d)]?0x0:0x1;}async[a26_0x3b2896(0x126)](_0x148faa,_0x583202){const _0xc925d=a26_0x3b2896;console[_0xc925d(0x1b5)]('\x0a'+a26_0x42e058[_0xc925d(0x1b8)](_0xc925d(0x28e))+'\x20'+_0x148faa[_0xc925d(0x230)]),console[_0xc925d(0x1b5)]('═'['repeat'](0x3c));if(_0x583202[_0xc925d(0x28d)]&&_0x148faa[_0xc925d(0x1ad)]){const _0xff6a83=a26_0x42e058[_0xc925d(0x1d0)](_0xc925d(0x1e2))+'\x20'+a26_0x42e058[_0xc925d(0x1b8)](_0x148faa[_0xc925d(0x28d)][_0xc925d(0x205)]+'.'+_0x148faa[_0xc925d(0x28d)][_0xc925d(0x1f7)]);await this[_0xc925d(0x13a)](_0xff6a83,_0x148faa[_0xc925d(0x1ad)]);}else{if(_0x583202['attribute']&&_0x148faa[_0xc925d(0x1ad)]){const _0x5d4851=a26_0x42e058['dim'](_0xc925d(0x283))+'\x20'+a26_0x42e058[_0xc925d(0x1b8)](_0x583202[_0xc925d(0x243)]);await this[_0xc925d(0x13a)](_0x5d4851,_0x148faa['sampleData']);}else{if(_0x583202['behavior']&&_0x148faa[_0xc925d(0x1ad)]){const _0xa757f=a26_0x42e058[_0xc925d(0x1d0)]('Behavior:')+'\x20'+a26_0x42e058[_0xc925d(0x1b8)](_0x583202['behavior']);await this[_0xc925d(0x13a)](_0xa757f,_0x148faa[_0xc925d(0x1ad)]);}else{if(_0x583202[_0xc925d(0x145)]&&_0x148faa[_0xc925d(0x1ad)]){const _0x581240=a26_0x42e058[_0xc925d(0x1d0)]('Enriched:')+'\x20'+a26_0x42e058['bold']('Master\x20+\x20Attributes');await this['displaySampleData'](_0x581240,_0x148faa[_0xc925d(0x1ad)]);}else!_0x148faa[_0xc925d(0x1ad)]&&console[_0xc925d(0x1b5)](_0xc925d(0x18e));}}}if(_0x148faa[_0xc925d(0x240)][_0xc925d(0x118)]>0x0){console[_0xc925d(0x1b5)]('─'[_0xc925d(0x1a3)](0x3c)),console[_0xc925d(0x1b5)]('\x0a'+a26_0x42e058['red'](_0xc925d(0x229)));for(const _0x34938c of _0x148faa[_0xc925d(0x240)]){console[_0xc925d(0x1b5)]('\x20\x20'+a26_0x42e058['red']('•')+'\x20'+_0x34938c);}}}async[a26_0x3b2896(0x13a)](_0x4a3839,_0x248e66){const _0x599f5e=a26_0x3b2896;if(_0x248e66[_0x599f5e(0x118)]===0x0){console[_0x599f5e(0x1b5)]('\x0a'+_0x4a3839),console[_0x599f5e(0x1b5)](_0x599f5e(0x136));return;}console[_0x599f5e(0x1b5)]('\x0a'+_0x4a3839);const _0x19ea42=Object[_0x599f5e(0x1cb)](_0x248e66[0x0])[_0x599f5e(0x199)](_0x7326cc=>({'name':_0x7326cc,'type':typeof _0x248e66[0x0][_0x7326cc]==='number'?_0x599f5e(0x210):_0x599f5e(0x225)})),_0xdb3e88={'queryId':'preview','columns':_0x19ea42,'data':_0x248e66,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x248e66[_0x599f5e(0x118)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x10dff0=formatAsTable(_0xdb3e88,_0x248e66[_0x599f5e(0x118)],!![]);await writeOutput(_0x10dff0,undefined,_0x599f5e(0x1f7));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a26_0x3b2896(0x151);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x224);async['execute'](_0x2bf286){const _0x4b2596=a26_0x3b2896,{options:_0x41a4b8,args:_0x19f598,tdx:_0x1058cb}=_0x2bf286,_0xeca2a1=_0x41a4b8,_0x1a4f98=_0x19f598[0x0]||_0x41a4b8['parentSegment'];if(!_0x1a4f98)return showParentSegmentNotSetError(_0x4b2596(0x14d)+_0x4b2596(0x21e)),0x1;const _0x2bd476=resolveYamlFile(_0x1a4f98);if(existsSync(_0x2bd476)){_0xeca2a1[_0x4b2596(0x164)]&&console['error'](_0x4b2596(0x1e9)+_0x2bd476);let _0x5dcd47;try{_0x5dcd47=readFileSync(_0x2bd476,_0x4b2596(0x1e5));}catch(_0x2310d0){const _0x160bb5=_0x2310d0 instanceof Error?_0x2310d0[_0x4b2596(0x26b)]:String(_0x2310d0);return console['error'](_0x4b2596(0x267)+_0x160bb5),0x1;}const _0x187aeb=await withSpinner(_0x4b2596(0x18d),()=>_0x1058cb['segment'][_0x4b2596(0x272)](_0x5dcd47),{'verbose':_0xeca2a1['verbose']}),_0x12646b=_0x187aeb[_0x4b2596(0x119)],{isNew:_0xa3735f,name:_0x33c56a,hasChanges:_0x1232f7,diffFormatted:_0x2426f7}=_0x12646b;if(_0x1232f7){_0xa3735f?console['error'](_0x4b2596(0x115)+_0x33c56a+'\x27:'):console[_0x4b2596(0x1b5)](_0x4b2596(0x1f0)+_0x33c56a+'\x27:');console[_0x4b2596(0x1b5)]('─'[_0x4b2596(0x1a3)](0x3c)),console[_0x4b2596(0x1b5)](_0x2426f7),console[_0x4b2596(0x1b5)]('─'[_0x4b2596(0x1a3)](0x3c));const _0xbf22b5=_0xa3735f?'Create\x20parent\x20segment\x20\x27'+_0x33c56a+_0x4b2596(0x286):_0x4b2596(0x190)+_0x33c56a+_0x4b2596(0x286);if(!_0xeca2a1['yes']){if(!isInteractive())return console[_0x4b2596(0x1b5)](a26_0x42e058[_0x4b2596(0x1dd)](_0x4b2596(0x19e)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a26_0x42e058['dim'](_0x4b2596(0x18c))),0x1;const _0x5aba47=await confirmKey(_0xbf22b5);if(!_0x5aba47)return console[_0x4b2596(0x1b5)](a26_0x42e058[_0x4b2596(0x24b)](_0x4b2596(0x27d))),0x1;}const _0xdc16ec=_0xa3735f?_0x4b2596(0x1af):_0x4b2596(0x1bb);await withSpinner(_0xdc16ec+'\x20parent\x20segment\x20\x27'+_0x33c56a+_0x4b2596(0x1b3),()=>_0x12646b[_0x4b2596(0x23e)](),{'verbose':_0xeca2a1['verbose']});const _0x19f045=_0xa3735f?_0x4b2596(0x13d):_0x4b2596(0x1be);console[_0x4b2596(0x1b5)]('✔\x20'+_0x19f045+_0x4b2596(0x291)+_0x33c56a+'\x27');}else console['error'](_0x4b2596(0x152)+_0x33c56a+_0x4b2596(0x11c));}const _0x3fbd0f=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x1a4f98+_0x4b2596(0x1b3),()=>_0x1058cb[_0x4b2596(0x12b)][_0x4b2596(0x26d)](_0x1a4f98),{'verbose':_0xeca2a1['verbose']}),_0x540cfc=_0x3fbd0f[_0x4b2596(0x119)],_0x215d2f=getConsoleUrl(_0xeca2a1[_0x4b2596(0x1c3)],_0x4b2596(0x264)+_0x540cfc[_0x4b2596(0x1e1)]+_0x4b2596(0x142)+_0x540cfc[_0x4b2596(0x24e)]+_0x4b2596(0x208)+_0x540cfc[_0x4b2596(0x1db)]);return console[_0x4b2596(0x1b5)](_0x4b2596(0x280)),console[_0x4b2596(0x1b5)]('\x20\x20'+a26_0x42e058[_0x4b2596(0x1d0)](_0x4b2596(0x1ce))+'\x20'+_0x540cfc[_0x4b2596(0x1fa)]),console[_0x4b2596(0x1b5)]('\x20\x20'+a26_0x42e058['dim'](_0x4b2596(0x144))+'\x20'+_0x540cfc[_0x4b2596(0x244)]),console[_0x4b2596(0x1b5)]('\x20\x20'+a26_0x42e058[_0x4b2596(0x1d0)](_0x4b2596(0x221))+'\x20'+_0x540cfc['workflowSessionId']),console[_0x4b2596(0x1b5)]('\x20\x20'+a26_0x42e058[_0x4b2596(0x1d0)]('Attempt:')+'\x20'+_0x540cfc['workflowAttemptId']),console[_0x4b2596(0x1b5)]('\x20\x20'+_0x215d2f),console[_0x4b2596(0x1b5)]('\x0a'+a26_0x42e058[_0x4b2596(0x1d0)]('To\x20cancel:')+_0x4b2596(0x1a1)+_0x540cfc['workflowAttemptId']+_0x4b2596(0x121)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a26_0x3b2896(0x1aa);[a26_0x3b2896(0x24a)]='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x3b2896(0x163)](_0x201944){const _0x4440a6=a26_0x3b2896,{options:_0x4ae838,args:_0x159c88,tdx:_0x3eb118}=_0x201944,_0x152603=_0x159c88[0x0]||_0x4ae838[_0x4440a6(0x172)];if(!_0x152603)return showParentSegmentNotSetError(_0x4440a6(0x209)+_0x4440a6(0x29f)),0x1;_0x4ae838[_0x4440a6(0x164)]&&(console['error']('Site:\x20'+_0x4ae838[_0x4440a6(0x1c3)]),console['error'](_0x4440a6(0x233)+_0x152603));const _0x23fa2d=await withSpinner(_0x4440a6(0x187)+_0x152603+_0x4440a6(0x1b3),()=>_0x3eb118[_0x4440a6(0x12b)][_0x4440a6(0x284)](_0x152603),{'verbose':_0x4ae838['verbose']}),_0x4ce80b=_0x23fa2d['data'];console[_0x4440a6(0x1b5)](_0x4440a6(0x17d)+_0x4ce80b[_0x4440a6(0x118)]+_0x4440a6(0x268)+(_0x4ce80b['length']!==0x1?'s':''));if(_0x4ae838['json']||_0x4ae838['jsonl'])return await handleSDKOutput(_0x4ce80b,_0x4ae838),0x0;return displayFieldsHumanReadable(_0x4ce80b,_0x152603),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3b2896(0x230)]='segment:parent:view';[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x180);async[a26_0x3b2896(0x163)](_0x375060){const _0x390ec1=a26_0x3b2896,{options:_0x6f70f,args:_0x30c403,tdx:_0x57f403}=_0x375060,_0x43e183=_0x6f70f,_0x588ba9=_0x30c403[0x0]||_0x6f70f['parentSegment'];if(!_0x588ba9)return showParentSegmentNotSetError(_0x390ec1(0x117)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x390ec1(0x1f9)+_0x390ec1(0x226)),0x1;_0x6f70f[_0x390ec1(0x164)]&&(console[_0x390ec1(0x1b5)](_0x390ec1(0x11a)+_0x6f70f[_0x390ec1(0x1c3)]),console[_0x390ec1(0x1b5)]('Parent\x20segment:\x20'+_0x588ba9));const _0x52af2f=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x588ba9+'\x27...',()=>_0x57f403['segment'][_0x390ec1(0x21d)](_0x588ba9),{'verbose':_0x6f70f[_0x390ec1(0x164)]}),_0x1a5417=_0x52af2f[_0x390ec1(0x119)];if(_0x43e183[_0x390ec1(0x156)]){const _0x4f9275=getConsoleNextUrl(_0x43e183['site'],_0x390ec1(0x1bf)+_0x1a5417['id']);return console[_0x390ec1(0x1b5)](a26_0x42e058[_0x390ec1(0x11b)]('✔')+'\x20Opening\x20'+a26_0x42e058[_0x390ec1(0x298)](_0x4f9275)),openBrowser(_0x4f9275),0x0;}return await handleSingleObjectOutput(_0x1a5417,_0x6f70f),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x154);['description']=a26_0x3b2896(0x174);async['execute'](_0x1d4e2d){const _0x27132a=a26_0x3b2896,{options:_0x4effdb,args:_0x382236,tdx:_0x546fec}=_0x1d4e2d,_0x111022=_0x4effdb,_0x4456d5=_0x382236[0x0]||_0x4effdb[_0x27132a(0x172)];if(!_0x4456d5)return showParentSegmentNotSetError(_0x27132a(0x1ed)+_0x27132a(0x216)+_0x27132a(0x1f9)+_0x27132a(0x1c8)),0x1;_0x4effdb['verbose']&&(console[_0x27132a(0x1b5)]('Site:\x20'+_0x4effdb['site']),console['error']('Parent\x20segment:\x20'+_0x4456d5));const _0x184eff=await withSpinner(_0x27132a(0x250)+_0x4456d5+_0x27132a(0x1b3),()=>_0x546fec[_0x27132a(0x12b)][_0x27132a(0x27b)](_0x4456d5),{'verbose':_0x4effdb[_0x27132a(0x164)]}),_0x20bfe3=_0x184eff[_0x27132a(0x119)],_0x44bf0e=_0x546fec['segment'][_0x27132a(0x287)](_0x20bfe3);if(_0x111022[_0x27132a(0x185)]){const _0xce1354=await this[_0x27132a(0x269)](_0x1d4e2d,_0x4456d5,_0x20bfe3,_0x44bf0e),_0x2ae5d7=this[_0x27132a(0x11e)](_0xce1354);writeFileSync(_0x111022['output'],_0x2ae5d7);const _0xea2022=_0xce1354[_0x27132a(0x26e)][_0x27132a(0x262)][_0x27132a(0x118)]+_0xce1354['behaviors'][_0x27132a(0x15e)]((_0x4796fc,_0x4f62bb)=>_0x4796fc+_0x4f62bb[_0x27132a(0x262)][_0x27132a(0x118)],0x0),_0x3557fa=_0xce1354['behaviors'][_0x27132a(0x1bd)](_0x133d57=>_0x133d57[_0x27132a(0x262)][_0x27132a(0x118)]===0x0)['length'];return console['log'](_0x27132a(0x279)+_0x111022[_0x27132a(0x185)]),console[_0x27132a(0x1b9)](_0x27132a(0x1d9)+_0x44bf0e),console[_0x27132a(0x1b9)](_0x27132a(0x188)+_0xce1354['behaviors'][_0x27132a(0x118)]+_0x27132a(0x215)),console[_0x27132a(0x1b9)](_0x27132a(0x1d6)+_0xea2022+'\x20total'),_0x3557fa>0x0&&console[_0x27132a(0x1b9)]('\x20\x20Note:\x20'+_0x3557fa+_0x27132a(0x134)),0x0;}console['error']('\x0a'+a26_0x42e058[_0x27132a(0x1b8)]('Output\x20Database:')+'\x20'+a26_0x42e058[_0x27132a(0x298)](_0x44bf0e));const _0x17135a=await withSpinner(_0x27132a(0x13e),()=>_0x546fec[_0x27132a(0x12b)]['getParentSQL'](_0x20bfe3),{'verbose':_0x4effdb[_0x27132a(0x164)]});console[_0x27132a(0x1b5)]('\x0a'+a26_0x42e058[_0x27132a(0x1b8)](_0x27132a(0x26e))+'\x20'+a26_0x42e058[_0x27132a(0x1d0)]('('+_0x44bf0e+'.customers)'));const _0x51ea49=await executeSchemaQuery(_0x17135a[_0x27132a(0x119)],_0x546fec,_0x4effdb);await handleQueryOutput(_0x51ea49,_0x4effdb);const _0x30412c=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x546fec[_0x27132a(0x12b)][_0x27132a(0x147)](_0x20bfe3),{'verbose':_0x4effdb[_0x27132a(0x164)]});for(const _0x4c45e3 of _0x30412c[_0x27132a(0x119)]){const _0x3dadc5=_0x27132a(0x189)+_0x4c45e3['toLowerCase']()[_0x27132a(0x1df)](/\s+/g,'_'),_0x4fd6df=_0x27132a(0x13c)+_0x44bf0e+'.'+_0x3dadc5;console[_0x27132a(0x1b5)]('\x0a'+a26_0x42e058['bold'](_0x4c45e3)+'\x20'+a26_0x42e058['dim']('('+_0x44bf0e+'.'+_0x3dadc5+')'));try{const _0x5e9f29=await executeSchemaQuery(_0x4fd6df,_0x546fec,_0x4effdb);await handleQueryOutput(_0x5e9f29,_0x4effdb);}catch{console['error'](a26_0x42e058['yellow'](_0x27132a(0x12f)));}}return 0x0;}async[a26_0x3b2896(0x269)](_0xb0e785,_0x3da3bc,_0x36a9c2,_0x2cf35d){const _0x4558f5=a26_0x3b2896,{options:_0x1ed672,tdx:_0x34d2de}=_0xb0e785,_0x45e337=await withSpinner(_0x4558f5(0x13e),()=>_0x34d2de[_0x4558f5(0x12b)][_0x4558f5(0x1e8)](_0x36a9c2),{'verbose':_0x1ed672[_0x4558f5(0x164)]}),_0x2195c3=await executeSchemaQuery(_0x45e337['data'],_0x34d2de,_0x1ed672),_0x55445d=_0x2195c3[_0x4558f5(0x119)][_0x4558f5(0x199)](_0x24e4ed=>({'name':_0x24e4ed[_0x4558f5(0x17f)],'type':_0x24e4ed[_0x4558f5(0x120)]})),_0x31b983=await withSpinner(_0x4558f5(0x27e),()=>_0x34d2de[_0x4558f5(0x12b)]['getBehaviorNames'](_0x36a9c2),{'verbose':_0x1ed672[_0x4558f5(0x164)]}),_0x34455b=[];for(const _0x453ccb of _0x31b983['data']){const _0x38145b='behavior_'+_0x453ccb[_0x4558f5(0x25f)]()[_0x4558f5(0x1df)](/\s+/g,'_'),_0x5395ab=_0x4558f5(0x13c)+_0x2cf35d+'.'+_0x38145b;let _0x483920=[];try{const _0x5249ac=await executeSchemaQuery(_0x5395ab,_0x34d2de,_0x1ed672);_0x483920=_0x5249ac['data']['map'](_0x3a7eff=>({'name':_0x3a7eff['column_name'],'type':_0x3a7eff[_0x4558f5(0x120)]}));}catch{}_0x34455b[_0x4558f5(0x28a)]({'table':_0x38145b,'columns':_0x483920});}return{'database':_0x2cf35d,'parent_segment':_0x3da3bc,'parent_id':_0x36a9c2,'customers':{'table':_0x4558f5(0x26e),'columns':_0x55445d},'behaviors':_0x34455b};}[a26_0x3b2896(0x11e)](_0x221be8){const _0x1a1877=a26_0x3b2896,_0x5e4ea0=_0x43fef3=>{const _0x378360=a26_0x5b8a;if(_0x43fef3['length']===0x0)return'[]';const _0x3eb675=_0x43fef3[_0x378360(0x199)](_0x5dde1e=>_0x378360(0x2a0)+_0x5dde1e['name']+_0x378360(0x12e)+_0x5dde1e['type']+_0x378360(0x140));return'[\x0a'+_0x3eb675['join'](',\x0a')+_0x378360(0x1b0);},_0x5c8576=_0x221be8[_0x1a1877(0x162)]['map'](_0x180f8d=>{const _0x26715c=_0x1a1877;return _0x26715c(0x122)+_0x180f8d['table']+_0x26715c(0x1ef)+_0x5e4ea0(_0x180f8d['columns'])[_0x26715c(0x1df)](/^/gm,'\x20\x20')[_0x26715c(0x259)]()+'\x0a\x20\x20\x20\x20}';})['join'](',\x0a');return _0x1a1877(0x263)+_0x221be8[_0x1a1877(0x205)]+_0x1a1877(0x141)+_0x221be8[_0x1a1877(0x1a6)]+_0x1a1877(0x1ac)+_0x221be8[_0x1a1877(0x257)]+_0x1a1877(0x22e)+_0x221be8[_0x1a1877(0x26e)][_0x1a1877(0x1f7)]+_0x1a1877(0x161)+_0x5e4ea0(_0x221be8['customers']['columns'])['replace'](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x5c8576+_0x1a1877(0x18b);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x21c);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x19b);async[a26_0x3b2896(0x163)](_0x36cc0a){const _0x21ecb0=a26_0x3b2896,{options:_0x5123d4,args:_0x33a4c6,tdx:_0x2f23d6}=_0x36cc0a,_0x1c3a09=_0x33a4c6[0x0]||_0x5123d4[_0x21ecb0(0x172)];if(!_0x1c3a09)return showParentSegmentNotSetError(_0x21ecb0(0x11d)+_0x21ecb0(0x148)),0x1;_0x5123d4[_0x21ecb0(0x164)]&&(console['error']('Site:\x20'+_0x5123d4[_0x21ecb0(0x1c3)]),console['error'](_0x21ecb0(0x233)+_0x1c3a09));const _0x551b03=await withSpinner(_0x21ecb0(0x250)+_0x1c3a09+_0x21ecb0(0x1b3),()=>_0x2f23d6['segment'][_0x21ecb0(0x27b)](_0x1c3a09),{'verbose':_0x5123d4[_0x21ecb0(0x164)]}),_0x5750ab=_0x551b03['data'],_0x57470a=await withSpinner(_0x21ecb0(0x236)+_0x1c3a09+_0x21ecb0(0x1b3),()=>_0x2f23d6['segment']['getParentSQL'](_0x5750ab),{'verbose':_0x5123d4[_0x21ecb0(0x164)]}),_0x57fc5c=_0x57470a[_0x21ecb0(0x119)];return _0x5123d4[_0x21ecb0(0x1f5)]===_0x21ecb0(0x213)||_0x5123d4['format']==='jsonl'?await handleSDKOutput([{'sql':_0x57fc5c}],_0x5123d4):console['log'](_0x57fc5c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a26_0x3b2896(0x19d);[a26_0x3b2896(0x24a)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a26_0x3b2896(0x163)](_0x475c3d){const _0x539ab2=a26_0x3b2896,{options:_0x38fa4a,args:_0x5a5f54,tdx:_0x1e59ad}=_0x475c3d,_0x3ac34b=_0x5a5f54[0x0]||_0x38fa4a[_0x539ab2(0x172)];if(!_0x3ac34b)return showParentSegmentNotSetError(_0x539ab2(0x234)+_0x539ab2(0x22d)),0x1;_0x38fa4a['verbose']&&(console[_0x539ab2(0x1b5)](_0x539ab2(0x11a)+_0x38fa4a['site']),console[_0x539ab2(0x1b5)](_0x539ab2(0x233)+_0x3ac34b));const _0x288376=await withSpinner(_0x539ab2(0x250)+_0x3ac34b+_0x539ab2(0x1b3),()=>_0x1e59ad[_0x539ab2(0x12b)][_0x539ab2(0x27b)](_0x3ac34b),{'verbose':_0x38fa4a[_0x539ab2(0x164)]}),_0x2c8384=_0x288376[_0x539ab2(0x119)],_0x5c72ba=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3ac34b+_0x539ab2(0x1b3),()=>_0x1e59ad[_0x539ab2(0x12b)]['getParentSQL'](_0x2c8384),{'verbose':_0x38fa4a[_0x539ab2(0x164)]});let _0x4ace42=_0x5c72ba[_0x539ab2(0x119)];const _0x48bbd7=resolveLimit(_0x38fa4a[_0x539ab2(0x22c)],DEFAULT_DISPLAY_LIMIT),_0x16c355=/\bLIMIT\s+\d+/i[_0x539ab2(0x2a1)](_0x4ace42);!_0x16c355&&(_0x4ace42=_0x4ace42['trim']()['replace'](/;+$/,''),_0x4ace42=_0x539ab2(0x1ab)+_0x4ace42+_0x539ab2(0x1e7)+_0x48bbd7);_0x38fa4a['verbose']&&console[_0x539ab2(0x1b5)](_0x539ab2(0x15d)+_0x4ace42);const _0x61ad1e=await withProgressSpinner(_0x539ab2(0x27f),async _0x496808=>{const _0xc6e7c8=await _0x1e59ad['query']['execute'](_0x4ace42,{'catalog':'td','schema':'information_schema','onJobId':_0x31f42a=>{const _0xeb5665=a26_0x5b8a;_0x496808[_0xeb5665(0x1d1)](_0x31f42a);}});return _0xc6e7c8;},{'verbose':_0x38fa4a['verbose']}),_0xf91fe5=_0x61ad1e[_0x539ab2(0x119)],_0xe16057=_0xf91fe5[_0x539ab2(0x20f)]?_0x539ab2(0x159)+_0xf91fe5[_0x539ab2(0x20f)]+']':'';return console[_0x539ab2(0x1b5)]('✔\x20Query\x20completed:\x20Processed\x20'+_0xf91fe5[_0x539ab2(0x203)][_0x539ab2(0x191)][_0x539ab2(0x21b)]()+'\x20rows\x20'+(_0x539ab2(0x1ba)+formatElapsed(_0xf91fe5[_0x539ab2(0x203)][_0x539ab2(0x1b2)])+_0xe16057)),await handleQueryOutput(_0xf91fe5,_0x38fa4a),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x207);['description']='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x378fd7){const _0x51ff73=a26_0x3b2896,{options:_0x267057,args:_0x5f2fdb,tdx:_0x189079}=_0x378fd7,_0x16c8a6=_0x5f2fdb[0x0],_0x385679=await withSpinner(_0x16c8a6?_0x51ff73(0x19a)+_0x16c8a6+'\x27...':_0x51ff73(0x232),()=>_0x189079[_0x51ff73(0x292)][_0x51ff73(0x1ae)](),{'verbose':_0x267057[_0x51ff73(0x164)]});let _0x45449e=_0x385679['data'][_0x51ff73(0x1bd)](_0x364b65=>_0x364b65['realtime_enabled']);if(_0x16c8a6){const _0x124a43=_0x16c8a6[_0x51ff73(0x1df)](/[.+^${}()|[\]\\]/g,_0x51ff73(0x1e6))[_0x51ff73(0x1df)](/\*/g,'.*')[_0x51ff73(0x1df)](/\?/g,'.'),_0x2f3bf3=new RegExp('^'+_0x124a43+'$','i');_0x45449e=_0x45449e['filter'](_0x3d8e15=>_0x2f3bf3[_0x51ff73(0x2a1)](_0x3d8e15[_0x51ff73(0x230)]));}_0x45449e[_0x51ff73(0x16f)]((_0x3ead40,_0x26689c)=>_0x3ead40[_0x51ff73(0x230)][_0x51ff73(0x204)](_0x26689c[_0x51ff73(0x230)])),console['error'](_0x51ff73(0x17d)+_0x45449e[_0x51ff73(0x118)]+_0x51ff73(0x251)+(_0x45449e['length']!==0x1?'s':''));const _0x3a87fa=_0x59b992=>{const _0x22e233=_0x51ff73;return getConsoleNextUrl(_0x267057['site'],_0x22e233(0x1bf)+_0x59b992);};if(_0x267057['format']==='json'||_0x267057['format']===_0x51ff73(0x195)){const _0x2af2d3=_0x45449e[_0x51ff73(0x199)](_0x33e853=>({..._0x33e853,'url':_0x3a87fa(_0x33e853['id'])}));await handleSDKOutput(_0x2af2d3,_0x267057);}else{if(_0x45449e[_0x51ff73(0x118)]===0x0)console['log']('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0xb1abb9 of _0x45449e){const _0x505c75=_0xb1abb9['population']?a26_0x42e058['dim']('\x20('+formatRows(_0xb1abb9[_0x51ff73(0x21f)])+')'):'',_0x1ec994=hyperlink(_0xb1abb9[_0x51ff73(0x230)],_0x3a87fa(_0xb1abb9['id']));console[_0x51ff73(0x1b9)]('⚡\x20'+_0x1ec994+_0x505c75);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x1e3);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x1e0);async[a26_0x3b2896(0x163)](_0x31923e){const _0x5142a3=a26_0x3b2896,{options:_0x20782f,args:_0x16d9f9,tdx:_0x28d403}=_0x31923e,_0x2866f5=_0x16d9f9[0x0]||_0x20782f[_0x5142a3(0x172)];if(!_0x2866f5)return showParentSegmentNotSetError(_0x5142a3(0x193)+_0x5142a3(0x206)),0x1;const _0x3c2b19=resolveYamlFile(_0x2866f5);if(!existsSync(_0x3c2b19))return showFileNotFoundError(_0x3c2b19,_0x2866f5),0x1;let _0x33c894;try{_0x33c894=readFileSync(_0x3c2b19,_0x5142a3(0x1e5));}catch(_0x216e64){const _0x2fe8c1=_0x216e64 instanceof Error?_0x216e64[_0x5142a3(0x26b)]:String(_0x216e64);return console[_0x5142a3(0x1b5)](_0x5142a3(0x267)+_0x2fe8c1),0x1;}const _0x866f8e=createCommandSpinner(a26_0x42e058['dim'](_0x5142a3(0x220)),{'verbose':_0x20782f['verbose']});_0x866f8e['start']();const _0x36e802={'realtime':!![],'onProgress':_0x5bc724=>{const _0x4e36d5=_0x5142a3;_0x866f8e[_0x4e36d5(0x1a9)]=formatProgressMessage(_0x5bc724);}};let _0x35c7d8;try{_0x35c7d8=await _0x28d403[_0x5142a3(0x12b)]['validateParentYaml'](_0x33c894,_0x36e802),_0x866f8e['stop']();}catch(_0x4434d1){_0x866f8e[_0x5142a3(0x1a2)]();throw _0x4434d1;}console[_0x5142a3(0x1b5)]('\x0a'+a26_0x42e058[_0x5142a3(0x1b8)](_0x5142a3(0x2a3))+'\x20'+_0x35c7d8[_0x5142a3(0x230)]),console[_0x5142a3(0x1b5)]('═'[_0x5142a3(0x1a3)](0x3c)),displayRealtimeValidation(_0x35c7d8),console[_0x5142a3(0x1b5)]('─'[_0x5142a3(0x1a3)](0x3c));if(_0x35c7d8[_0x5142a3(0x240)][_0x5142a3(0x118)]>0x0){console['error']('\x0a'+a26_0x42e058[_0x5142a3(0x1dd)]('Errors:'));for(const _0x51fe65 of _0x35c7d8[_0x5142a3(0x240)]){console[_0x5142a3(0x1b5)]('\x20\x20'+a26_0x42e058[_0x5142a3(0x1dd)]('•')+'\x20'+_0x51fe65);}}return _0x35c7d8[_0x5142a3(0x20d)]&&console[_0x5142a3(0x1b5)]('\x0a'+a26_0x42e058[_0x5142a3(0x11b)]('✔')+_0x5142a3(0x12d)),_0x35c7d8[_0x5142a3(0x20d)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x3b2896(0x230)]=a26_0x3b2896(0x1f4);[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x198);async[a26_0x3b2896(0x163)](_0x31ae35){const _0x4588fe=a26_0x3b2896,{options:_0x42897c,args:_0x1cbbc9,tdx:_0x25f48c}=_0x31ae35,_0x19514e=_0x1cbbc9[0x0]||_0x42897c[_0x4588fe(0x172)];if(!_0x19514e)return showParentSegmentNotSetError(_0x4588fe(0x202)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x5b40e5=await withSpinner(_0x4588fe(0x250)+_0x19514e+_0x4588fe(0x1b3),()=>_0x25f48c['segment'][_0x4588fe(0x27b)](_0x19514e),{'verbose':_0x42897c[_0x4588fe(0x164)]}),_0x36be02=_0x5b40e5[_0x4588fe(0x119)],_0x50a6c2=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x19514e+_0x4588fe(0x1b3),()=>_0x25f48c[_0x4588fe(0x1eb)][_0x4588fe(0x1ae)](_0x36be02),{'verbose':_0x42897c[_0x4588fe(0x164)]}),_0x5653c6=_0x50a6c2[_0x4588fe(0x119)];console[_0x4588fe(0x1b5)](_0x4588fe(0x17d)+_0x5653c6[_0x4588fe(0x118)]+'\x20personalization\x20service'+(_0x5653c6[_0x4588fe(0x118)]!==0x1?'s':''));if(_0x42897c['format']===_0x4588fe(0x213)||_0x42897c[_0x4588fe(0x1f5)]===_0x4588fe(0x195))await handleSDKOutput(_0x5653c6,_0x42897c);else{if(_0x5653c6['length']===0x0)console['log'](_0x4588fe(0x1d3)),console['error'](a26_0x42e058['cyan'](_0x4588fe(0x173)));else for(const _0x296339 of _0x5653c6){const _0x38ee87=_0x296339['sections']?.[_0x4588fe(0x118)]||0x0,_0x45d07f=_0x296339[_0x4588fe(0x23a)]?a26_0x42e058[_0x4588fe(0x1d0)](_0x4588fe(0x218)+_0x296339[_0x4588fe(0x23a)]):'',_0x310662=a26_0x42e058[_0x4588fe(0x1d0)]('\x20('+_0x38ee87+_0x4588fe(0x186)+(_0x38ee87!==0x1?'s':'')+')');console[_0x4588fe(0x1b9)]('\x20\x20'+_0x296339[_0x4588fe(0x230)]+_0x45d07f+_0x310662),_0x296339[_0x4588fe(0x24a)]&&console[_0x4588fe(0x1b9)](_0x4588fe(0x1d4)+a26_0x42e058['dim'](_0x296339['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x3b2896(0x230)]='ps:pz:init';[a26_0x3b2896(0x24a)]=a26_0x3b2896(0x1d7);async['execute'](_0x5c2d92){const _0x292eaa=a26_0x3b2896,{options:_0x480769,args:_0x1af618}=_0x5c2d92,_0x274683=_0x1af618[0x0]||_0x480769['parentSegment'];if(!_0x274683)return showParentSegmentNotSetError(_0x292eaa(0x192)+_0x292eaa(0x1de)),0x1;const _0x1995f0=resolveYamlFile(_0x274683);if(!existsSync(_0x1995f0))return showFileNotFoundError(_0x1995f0,_0x274683),0x1;let _0x25c923;try{_0x25c923=readFileSync(_0x1995f0,_0x292eaa(0x1e5));}catch(_0x487e00){const _0x11554c=_0x487e00 instanceof Error?_0x487e00[_0x292eaa(0x26b)]:String(_0x487e00);return console[_0x292eaa(0x1b5)](_0x292eaa(0x267)+_0x11554c),0x1;}let _0xf86e5b;try{_0xf86e5b=parseDef(_0x25c923);}catch(_0x35e2ae){const _0xd15d06=_0x35e2ae instanceof Error?_0x35e2ae['message']:String(_0x35e2ae);return console[_0x292eaa(0x1b5)](a26_0x42e058[_0x292eaa(0x1dd)](_0x292eaa(0x23d)+_0xd15d06)),0x1;}if(_0xf86e5b[_0x292eaa(0x177)]&&_0xf86e5b['personalization_services'][_0x292eaa(0x118)]>0x0)return console['error'](a26_0x42e058[_0x292eaa(0x24b)](_0x292eaa(0x223)+_0x1995f0)),console['error'](a26_0x42e058['dim'](_0x292eaa(0x1c6)+_0xf86e5b[_0x292eaa(0x177)][_0x292eaa(0x118)]+'\x20service(s)\x20configured')),0x1;!_0xf86e5b[_0x292eaa(0x292)]&&(_0xf86e5b[_0x292eaa(0x292)]={'events':[{'name':_0x292eaa(0x289),'source_table':_0x292eaa(0x12a)}],'attributes':[{'name':_0x292eaa(0x1f6),'type':'single'}],'id_stitching':{'primary_key':_0xf86e5b[_0x292eaa(0x28d)][_0x292eaa(0x1f7)]===_0x292eaa(0x26e)?'td_client_id':_0x292eaa(0x28f)}});_0xf86e5b[_0x292eaa(0x177)]=[{'name':_0x292eaa(0x20c),'description':_0x292eaa(0x296),'trigger_event':_0x292eaa(0x289),'sections':[{'name':_0x292eaa(0x293),'criteria':'true','attributes':[_0x292eaa(0x1f6)]}]}];const _0xe278d2=serializeDef(_0xf86e5b);return writeFileSync(_0x1995f0,_0xe278d2,'utf-8'),console[_0x292eaa(0x1b5)](a26_0x42e058['green']('✔')+_0x292eaa(0x1cc)+a26_0x42e058[_0x292eaa(0x298)](_0x1995f0)),(!_0xf86e5b[_0x292eaa(0x292)]||_0x25c923[_0x292eaa(0x125)](_0x292eaa(0x165))===-0x1)&&console['error'](a26_0x42e058[_0x292eaa(0x11b)]('✔')+_0x292eaa(0x182)),console[_0x292eaa(0x1b5)]('\x0a'+a26_0x42e058[_0x292eaa(0x1d0)](_0x292eaa(0x175))),console[_0x292eaa(0x1b5)](_0x292eaa(0x1f2)+_0x1995f0+_0x292eaa(0x23b)),console[_0x292eaa(0x1b5)](_0x292eaa(0x14c)+a26_0x42e058[_0x292eaa(0x1d0)](_0x292eaa(0x20e)+_0x274683)+_0x292eaa(0x266)),0x0;}}
|
|
1
|
+
const a26_0x1d9f23=a26_0x1eb2;(function(_0x248e30,_0x97dff6){const _0xc16e77=a26_0x1eb2,_0x307319=_0x248e30();while(!![]){try{const _0x2438c9=parseInt(_0xc16e77(0x1ce))/0x1*(-parseInt(_0xc16e77(0x10a))/0x2)+-parseInt(_0xc16e77(0x213))/0x3+-parseInt(_0xc16e77(0x1e1))/0x4*(parseInt(_0xc16e77(0x1c5))/0x5)+parseInt(_0xc16e77(0x16b))/0x6+-parseInt(_0xc16e77(0x151))/0x7+-parseInt(_0xc16e77(0x1a4))/0x8+-parseInt(_0xc16e77(0x160))/0x9*(-parseInt(_0xc16e77(0xff))/0xa);if(_0x2438c9===_0x97dff6)break;else _0x307319['push'](_0x307319['shift']());}catch(_0x3c36cd){_0x307319['push'](_0x307319['shift']());}}}(a26_0x5676,0x424e0));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x1a0643 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0x4a65d0 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=a26_0x1d9f23(0x175),LEGACY_PARENT_SEGMENT_DIR=a26_0x1d9f23(0xd7);function a26_0x5676(){const _0xc8f139=['displayPreviewHints','apply','Master\x20Table','column_type','cyan','Validating\x20configuration...','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20--enriched','sourceTableValid','Updating\x20parent\x20segment\x20\x27','pushParentYaml','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x0aError:','List\x20parent\x20segments','parentSegment','Audience\x20ID:','\x20--attribute\x20\x22','string','SELECT\x20*\x20FROM\x20','\x27\x20and\x20run\x20workflow?','\x20parent\x20segment\x20\x27','segment:parent:view','\x20\x20Note:\x20','Behavior:','Site:\x20','Errors:','trim','260wEcxJs','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','text','schemaValid','joinKey','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Analyzing\x20changes...','indexOf','/app/workflows/','test','\x0aNew\x20parent\x20segment\x20\x27','276FaTBWQ','\x20parent\x20segment','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','segment:parent:preview','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','elapsedTimeMillis','\x20personalization\x20service','Aborted.','timezone','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Creating','<database>.<table>','FINISHED','Status:','segment:parent:sql','valid','\x20[Job\x20ID:\x20','query','Available\x20behaviors:','execute','log','format','isDirectory','Fetching\x20customers\x20schema...','Error:\x20--behavior\x20requires\x20a\x20name\x0a','customerPercent','toLowerCase','session','/\x20→\x20','audienceId','Resolving\x20parent\x20segment\x20\x27','scheduleType','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','Master\x20+\x20Attributes','\x20to\x20configure\x20your\x20personalization\x20service','workflowSessionId','number','localeCompare','Database:\x20','personalization_services','table','\x5c$&','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Show\x20parent\x20segment\x20details','Updated','open','Error:\x20Parent\x20segment\x20name\x20is\x20required','stats','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20field','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','\x20Configuration\x20is\x20valid','\x20RT-enabled\x20parent\x20segment','Options:\x0a','\x0a\x20\x20]\x0a}\x0a','Apply\x20changes\x20to\x20\x27','behavior','Listing\x20fields\x20for\x20\x27','displayPreviewResults','Parent\x20segment:\x20','message','Overwrite\x20\x27','\x20behaviors','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','green','columns','1375836EDLeuP','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20\x20\x20','run','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Attempt:','✔\x20Found\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','totalEvents','.yml','column','displayMasterInfo','\x20section','Fetching\x20sample\x20data...','Personalization:','541089hvNisc','displaySampleData','description','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Updating','type','Error\x20parsing\x20YAML:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Join\x20on:','Columns:','1460994BaCnwL','getOutputDatabaseName','allValid','realtime_enabled','.yaml','utf-8','Next\x20steps:','name','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','database','parent_segments','\x20Added\x20RT\x202.0\x20template\x20section','Found\x20YAML\x20file:\x20','\x22\x20}','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','behaviors','/{name}.yml\x0a','varchar','{\x0a\x20\x20\x22database\x22:\x20\x22','RT\x202.0:','all','last_page_viewed','ignore','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','replace','\x20Added\x20personalization\x20template\x20to\x20','behaviorsFile','\x27...','\x20\x202.\x20Run\x20','repeat','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','foreignKey','Behaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','ID\x20Stitching:','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','createParent','\x20rows)','Customers:','enriched','red','collectSchema','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','events','master','\x20--behavior\x20\x22<name>\x22','\x20\x20\x20\x20-\x20','Listing\x20personalization\x20services\x20for\x20\x27','Default','workflowAttemptId','displayValidateResults','using\x20the\x20default\x20path:\x20','Session:','jobId','map','\x20Opening\x20','2208152VCoYTK','trigger_event','site','label','interval','\x27\x20with\x20ID:\x20','length','⚡\x20Enabled','\x20service','in\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','dim','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','customersWithEvents','segment:parent:list','\x0a✔\x20Workflow\x20started','information_schema','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','segment:parent:create','stitchingKeys','yellow','\x0a\x20\x20\x20\x20]','segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Fetching\x20parent\x20segment\x20\x27','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','status','realtime','displayColumns','Error\x20reading\x20file:\x20','ps:pz:init','Source:','platform','309710YoRFON','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','attributesFile','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','matchedCount','tdx\x20ps\x20push\x20','/app/dw/parentSegments/','getBehaviorNames','3019vOVgpk','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20total','true','start','segment:parent:push','segment:parent:pull','Error:\x20--database\x20and\x20--table\x20are\x20required','getParentFull','attribute','displayBehaviorsStats','dirname','filter','join','list','segment:parent:validate','-1d','Output\x20file:\x20','24bUgkHM','Name:\x20','Error:\x20File\x20not\x20found:\x20','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','Executing\x20parent\x20segment\x20query...','parent_id','.customers)','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','getParentSQL','segment:parent:show','bold','✔\x20Renamed\x20directory\x20to\x20','/\x20directory.\x0a','👥\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','formatSchemaJson','Output\x20Database:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','errors','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','scheduleOption','Events:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','yes','sections','column_name','push','td_client_id','displayAttributesStats','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','user_id','output','previewParentYaml','Fetching\x20current\x20configuration\x20for\x20\x27','customerGroup','Create\x20parent\x20segment\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','\x20\x20\x20\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20to\x20push\x20the\x20configuration','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x0a⚠️\x20\x20Migrating:\x20','\x20\x201.\x20Edit\x20','Options:','Enriched:','822660cdbWtg','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','coveragePercent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20is\x20already\x20up\x20to\x20date','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','%)\x20','SQL\x20query:\x0a','segment:parent:fields','\x20service(s)\x20configured','stop','updateParent','match','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','win32','No\x20personalization\x20services\x20configured','realtime:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','listFields','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20--attribute\x20\x22<name>\x22','behavior_','jsonl','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','toFixed','page_view','addBehaviorsFile','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','json','\x27\x20is\x20already\x20up\x20to\x20date','schemaError','Options\x20(one\x20required):\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x22,\x20\x22type\x22:\x20\x22','Fetching\x20SQL\x20for\x20\x27','sourceTableError','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20configured','`\x20to\x20download\x20the\x20configuration\x20first','double','customers','\x27\x20is\x20up\x20to\x20date','\x0aUsage:\x20tdx\x20ps\x20preview\x20','single','My\x20Service','\x20\x20Columns:\x20','Schema\x20saved\x20to\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','resolveParentId','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Master:','attributes','✘\x20Failed\x20to\x20rename\x20directory:\x20','keys','\x20--interval\x20','No\x20RT-enabled\x20parent\x20segments\x20found','displaySummary','sort','segment:parent:run','✔\x20Query\x20completed:\x20Processed\x20','\x20=\x20','error','tdx\x20ps\x20preview\x20','idStitching','Listing\x20parent\x20segments\x20matching\x20\x27','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','population','Join:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20tdx\x20wf\x20attempt\x20','segment:parent:desc','personalizationServices','validateParentYaml','ps:rt:validate','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x0aChanges\x20to\x20\x27','Attributes','\x20trigger=','segment:parent:update','darwin','preview','listParents','parent_segment','RT\x202.0\x20Validate:','\x0a⚠️\x20\x20Both\x20','List\x20available\x20fields\x20for\x20segmentation','unref','Fetching\x20behavior\x20list...','verbose','rowCount','data','✔\x20No\x20changes\x20-\x20\x27','Available\x20attributes:','Error:'];a26_0x5676=function(){return _0xc8f139;};return a26_0x5676();}function openBrowser(_0x16ebf7){const _0x1f0961=a26_0x1d9f23,_0x3cb04c=process[_0x1f0961(0x1c4)],_0x1c3749=_0x3cb04c===_0x1f0961(0xd4)?_0x1f0961(0x139):_0x3cb04c===_0x1f0961(0x222)?_0x1f0961(0x1d3):'xdg-open';spawn(_0x1c3749,[_0x16ebf7],{'detached':!![],'stdio':_0x1f0961(0x181)})[_0x1f0961(0xdb)]();}function migrateLegacyDirectory(){const _0x3a5059=a26_0x1d9f23;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x12f949=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x12f949[_0x3a5059(0x121)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3a5059(0x252)](a26_0x4a65d0[_0x3a5059(0x1b8)](_0x3a5059(0xd9)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x3a5059(0x252)](a26_0x4a65d0[_0x3a5059(0x1af)](_0x3a5059(0x1c7)+LEGACY_PARENT_SEGMENT_DIR+_0x3a5059(0x1ed))),![];console[_0x3a5059(0x252)](a26_0x4a65d0[_0x3a5059(0x1b8)](_0x3a5059(0x20f)+LEGACY_PARENT_SEGMENT_DIR+_0x3a5059(0x127)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3a5059(0x252)](a26_0x4a65d0[_0x3a5059(0x14f)](_0x3a5059(0x1ec)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x67850b){const _0x2c2e20=_0x67850b instanceof Error?_0x67850b[_0x3a5059(0x14b)]:String(_0x67850b);return console[_0x3a5059(0x252)](a26_0x4a65d0[_0x3a5059(0x194)](_0x3a5059(0x249)+_0x2c2e20+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x17bc07){const _0x37d4bc=a26_0x1d9f23;return migrateLegacyDirectory(),super[_0x37d4bc(0x154)](_0x17bc07);}}function resolveYamlFile(_0x176beb){const _0x3388b5=a26_0x1d9f23;if(_0x176beb['endsWith']('.yml')||_0x176beb['endsWith'](_0x3388b5(0x16f)))return _0x176beb;return a26_0x1a0643[_0x3388b5(0x1dc)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x176beb)+_0x3388b5(0x15a));}function formatProgressMessage(_0x225403){const _0x238918=a26_0x1d9f23,_0xc892ca=_0x225403[_0x238918(0x220)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xc892ca){const [,_0x543139,_0x5d6dbd,_0x560b62='']=_0xc892ca;return a26_0x4a65d0[_0x238918(0x1af)](_0x543139+':')+'\x20'+_0x5d6dbd+a26_0x4a65d0[_0x238918(0x1af)](_0x560b62);}return a26_0x4a65d0[_0x238918(0x1af)](_0x225403);}function showFileNotFoundError(_0x14b321,_0x50fe23){const _0x41fcd6=a26_0x1d9f23;console[_0x41fcd6(0x252)](a26_0x4a65d0[_0x41fcd6(0x194)](_0x41fcd6(0x1e3)+_0x14b321+'\x0a')),console['error'](a26_0x4a65d0[_0x41fcd6(0xe7)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x50fe23+_0x41fcd6(0x23b)));}function displayRealtimeValidation(_0x196650){const _0x3a328a=a26_0x1d9f23;if(!_0x196650[_0x3a328a(0x1bf)])return;const _0x37686b=_0x196650['realtime'],_0x2da695=_0x37686b['enabled']?a26_0x4a65d0[_0x3a328a(0x14f)](_0x3a328a(0x1ab)):a26_0x4a65d0['yellow']('⚡\x20Not\x20enabled');console['error']('\x0a'+a26_0x4a65d0[_0x3a328a(0x1af)](_0x3a328a(0x17e))+'\x20'+_0x2da695);if(_0x37686b['events']&&_0x37686b['events'][_0x3a328a(0x1aa)]>0x0){console[_0x3a328a(0x252)]('\x20\x20'+a26_0x4a65d0[_0x3a328a(0x1af)](_0x3a328a(0x1fa))+'\x20'+_0x37686b[_0x3a328a(0x197)][_0x3a328a(0x1aa)]+_0x3a328a(0x23a));for(const _0x165e14 of _0x37686b[_0x3a328a(0x197)]){const _0x35ce4e=_0x165e14[_0x3a328a(0xeb)]===![]?a26_0x4a65d0['red']('✘'):a26_0x4a65d0[_0x3a328a(0x14f)]('✔');console[_0x3a328a(0x252)](_0x3a328a(0x20b)+_0x35ce4e+'\x20'+_0x165e14['name']),_0x165e14[_0x3a328a(0x238)]&&console[_0x3a328a(0x252)]('\x20\x20\x20\x20\x20\x20'+a26_0x4a65d0[_0x3a328a(0x194)](_0x165e14[_0x3a328a(0x238)]));}}if(_0x37686b[_0x3a328a(0x248)]&&_0x37686b[_0x3a328a(0x248)][_0x3a328a(0x1aa)]>0x0){console[_0x3a328a(0x252)]('\x20\x20'+a26_0x4a65d0[_0x3a328a(0x1af)]('Attributes:')+'\x20'+_0x37686b['attributes'][_0x3a328a(0x1aa)]+_0x3a328a(0x23a));for(const _0x51632f of _0x37686b[_0x3a328a(0x248)]){const _0x158254=_0x51632f[_0x3a328a(0x11a)]?a26_0x4a65d0['green']('✔'):a26_0x4a65d0[_0x3a328a(0x194)]('✘');console['error']('\x20\x20\x20\x20'+_0x158254+'\x20'+_0x51632f[_0x3a328a(0x172)]+'\x20'+a26_0x4a65d0[_0x3a328a(0x1af)]('('+_0x51632f[_0x3a328a(0x165)]+')'));}}if(_0x37686b[_0x3a328a(0x254)]){const _0x4b1756=_0x37686b[_0x3a328a(0x254)]['stitchingKeys']?.[_0x3a328a(0x1aa)]?'\x20+\x20['+_0x37686b[_0x3a328a(0x254)][_0x3a328a(0x1b7)][_0x3a328a(0x1dc)](',\x20')+']':'';console[_0x3a328a(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x3a328a(0x18e))+'\x20'+_0x37686b[_0x3a328a(0x254)]['primaryKey']+_0x4b1756);}if(_0x37686b[_0x3a328a(0x25c)]&&_0x37686b[_0x3a328a(0x25c)][_0x3a328a(0x1aa)]>0x0){console[_0x3a328a(0x252)]('\x20\x20'+a26_0x4a65d0[_0x3a328a(0x1af)](_0x3a328a(0x15f))+'\x20'+_0x37686b[_0x3a328a(0x25c)][_0x3a328a(0x1aa)]+_0x3a328a(0x1ac)+(_0x37686b[_0x3a328a(0x25c)][_0x3a328a(0x1aa)]!==0x1?'s':''));for(const _0x26ca66 of _0x37686b[_0x3a328a(0x25c)]){console[_0x3a328a(0x252)](_0x3a328a(0x19a)+_0x26ca66[_0x3a328a(0x172)]);}}}function showParentSegmentNotSetError(_0x5ba29b){const _0xf5e02c=a26_0x1d9f23;console[_0xf5e02c(0x252)](a26_0x4a65d0[_0xf5e02c(0x1b8)](_0xf5e02c(0x1f8))),console[_0xf5e02c(0x252)](_0x5ba29b);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1b2);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0xf1);async[a26_0x1d9f23(0x11e)](_0x454f71){const _0x3fc313=a26_0x1d9f23,{options:_0x26b367,args:_0x301191,tdx:_0x660483}=_0x454f71,_0x18076a=_0x301191[0x0];_0x26b367[_0x3fc313(0xdd)]&&(console[_0x3fc313(0x252)](_0x3fc313(0xfc)+_0x26b367[_0x3fc313(0x1a6)]),_0x18076a&&console['error']('Pattern:\x20'+_0x18076a));const _0x24f263=await withSpinner(_0x18076a?_0x3fc313(0x255)+_0x18076a+_0x3fc313(0x186):'Listing\x20parent\x20segments...',()=>_0x660483[_0x3fc313(0x1ba)][_0x3fc313(0xd6)](),{'verbose':_0x26b367[_0x3fc313(0xdd)]});let _0x40a73c=_0x24f263[_0x3fc313(0xdf)];if(_0x18076a){const _0x596d69=_0x18076a[_0x3fc313(0x183)](/[.+^${}()|[\]\\]/g,_0x3fc313(0x135))[_0x3fc313(0x183)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x230bed=new RegExp('^'+_0x596d69+'$','i');_0x40a73c=_0x40a73c['filter'](_0x244e45=>_0x230bed[_0x3fc313(0x108)](_0x244e45['attributes'][_0x3fc313(0x172)]));}_0x40a73c[_0x3fc313(0x24e)]((_0x3b1738,_0x38a43b)=>_0x3b1738[_0x3fc313(0x248)][_0x3fc313(0x172)][_0x3fc313(0x131)](_0x38a43b[_0x3fc313(0x248)][_0x3fc313(0x172)])),console[_0x3fc313(0x252)]('✔\x20Found\x20'+_0x40a73c['length']+_0x3fc313(0x10b)+(_0x40a73c['length']!==0x1?'s':''));const _0x5cfdd2=_0x46006e=>{const _0x4698a7=_0x3fc313;return getConsoleNextUrl(_0x26b367[_0x4698a7(0x1a6)],_0x4698a7(0x1cc)+_0x46006e);};if(_0x26b367[_0x3fc313(0x120)]===_0x3fc313(0x230)||_0x26b367[_0x3fc313(0x120)]==='jsonl'){const _0x4390ea=_0x40a73c[_0x3fc313(0x1a2)](_0x59b56d=>({..._0x59b56d,'url':_0x5cfdd2(_0x59b56d['id'])}));await handleSDKOutput(_0x4390ea,_0x26b367);}else{if(_0x40a73c[_0x3fc313(0x1aa)]===0x0)_0x18076a?console[_0x3fc313(0x11f)](_0x3fc313(0x12c)+_0x18076a):console[_0x3fc313(0x11f)]('No\x20parent\x20segments\x20found');else for(const _0x30a9a5 of _0x40a73c){const _0x1bf61a=_0x30a9a5[_0x3fc313(0x248)]['population']?a26_0x4a65d0['dim']('\x20('+formatRows(_0x30a9a5[_0x3fc313(0x248)][_0x3fc313(0x257)])+')'):'',_0x15de5=hyperlink(_0x30a9a5['attributes'][_0x3fc313(0x172)],_0x5cfdd2(_0x30a9a5['id']));console[_0x3fc313(0x11f)](_0x3fc313(0x1ee)+_0x15de5+_0x1bf61a);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1b6);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x100);async[a26_0x1d9f23(0x11e)](_0x48b165){const _0x55b801=a26_0x1d9f23,{options:_0x9f332,args:_0x5d04d7,tdx:_0x318f7c}=_0x48b165;console['error'](_0x55b801(0x1f0)+_0x55b801(0x227)+_0x55b801(0x13c));const _0x31c422=_0x9f332;if(_0x5d04d7['length']===0x0)return console['error'](a26_0x4a65d0[_0x55b801(0x194)](_0x55b801(0x13a))),console['error'](_0x55b801(0x1ef)),0x1;const _0x520cf9=_0x5d04d7[0x0];if(!_0x31c422[_0x55b801(0x174)]||!_0x31c422[_0x55b801(0x134)])return console[_0x55b801(0x252)](_0x55b801(0x1d6)),console[_0x55b801(0x252)](_0x55b801(0x1ef)),0x1;_0x31c422[_0x55b801(0xdd)]&&(console[_0x55b801(0x252)](_0x55b801(0xfc)+_0x31c422['site']),console[_0x55b801(0x252)](_0x55b801(0x1e2)+_0x520cf9),console[_0x55b801(0x252)](_0x55b801(0x132)+_0x31c422[_0x55b801(0x174)]),console[_0x55b801(0x252)]('Table:\x20'+_0x31c422['table']));const _0x1a8d8e=await loadJSONFromOptions(_0x31c422[_0x55b801(0x248)],_0x31c422[_0x55b801(0x1c8)]),_0x2ad113=await loadJSONFromOptions(_0x31c422['behaviors'],_0x31c422[_0x55b801(0x185)]),_0x1c36d4=await loadJSONFromOptions(_0x31c422[_0x55b801(0x208)],_0x31c422['customerGroupFile']),_0x16a59d={'name':_0x520cf9,'description':_0x31c422[_0x55b801(0x162)],'scheduleType':_0x31c422['scheduleType'],'scheduleOption':_0x31c422[_0x55b801(0x1f9)],'timezone':_0x31c422['timezone'],'master':{'parentDatabaseName':_0x31c422['database'],'parentTableName':_0x31c422['table']},'attributes':_0x1a8d8e,'behaviors':_0x2ad113,'customerGroup':_0x1c36d4},_0x38a844=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x520cf9+_0x55b801(0x186),()=>_0x318f7c[_0x55b801(0x1ba)][_0x55b801(0x190)](_0x16a59d),{'verbose':_0x9f332[_0x55b801(0xdd)]}),_0x274953=_0x38a844[_0x55b801(0xdf)];return console['error']('✔\x20Created\x20parent\x20segment\x20\x27'+_0x274953[_0x55b801(0x172)]+_0x55b801(0x1a9)+_0x274953['id']),await handleSDKOutput([_0x274953],_0x9f332),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0xd3);[a26_0x1d9f23(0x162)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x1d9f23(0x11e)](_0x21198c){const _0x419543=a26_0x1d9f23,{options:_0xca3ace,args:_0xb506a1,tdx:_0x1be5bf}=_0x21198c;console[_0x419543(0x252)](_0x419543(0x225)+'\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 _0x46a88e=_0xca3ace;if(_0xb506a1[_0x419543(0x1aa)]===0x0)return console['error'](a26_0x4a65d0['red'](_0x419543(0x13a))),console[_0x419543(0x252)](_0x419543(0x173)),0x1;const _0x2edc0c=_0xb506a1[0x0];_0x46a88e['verbose']&&(console[_0x419543(0x252)]('Site:\x20'+_0x46a88e['site']),console[_0x419543(0x252)](_0x419543(0x14a)+_0x2edc0c));const _0xfc0d1b=await withSpinner(_0x419543(0x207)+_0x2edc0c+_0x419543(0x186),()=>_0x1be5bf['segment'][_0x419543(0x1d7)](_0x2edc0c),{'verbose':_0x46a88e[_0x419543(0xdd)]}),_0x34fb2b=_0xfc0d1b[_0x419543(0xdf)],_0x1cdc94=await loadJSONFromOptions(_0x46a88e['addAttributes'],_0x46a88e['addAttributesFile']),_0x395ecf=await loadJSONFromOptions(_0x46a88e['addBehaviors'],_0x46a88e[_0x419543(0x22e)]),_0x159c4b={'name':_0x34fb2b[_0x419543(0x172)],'description':_0x46a88e[_0x419543(0x162)]!==undefined?_0x46a88e[_0x419543(0x162)]:_0x34fb2b[_0x419543(0x162)],'scheduleType':_0x46a88e[_0x419543(0x12a)]!==undefined?_0x46a88e['scheduleType']:_0x34fb2b[_0x419543(0x12a)],'scheduleOption':_0x46a88e[_0x419543(0x1f9)]!==undefined?_0x46a88e['scheduleOption']:_0x34fb2b[_0x419543(0x1f9)],'timezone':_0x46a88e[_0x419543(0x113)]!==undefined?_0x46a88e['timezone']:_0x34fb2b[_0x419543(0x113)],'master':_0x34fb2b['master'],'attributes':_0x1cdc94?[..._0x34fb2b['attributes']||[],..._0x1cdc94]:_0x34fb2b[_0x419543(0x248)],'behaviors':_0x395ecf?[..._0x34fb2b[_0x419543(0x17a)]||[],..._0x395ecf]:_0x34fb2b[_0x419543(0x17a)],'customerGroup':_0x34fb2b[_0x419543(0x208)]},_0x38e999=await withSpinner(_0x419543(0xec)+_0x2edc0c+_0x419543(0x186),()=>_0x1be5bf[_0x419543(0x1ba)][_0x419543(0x21f)](_0x2edc0c,_0x159c4b),{'verbose':_0x46a88e[_0x419543(0xdd)]}),_0xd5d356=_0x38e999['data'];return console['error'](_0x419543(0x1c6)+_0xd5d356['name']+'\x27'),await handleSDKOutput([_0xd5d356],_0x46a88e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1d5);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x104);async[a26_0x1d9f23(0x11e)](_0x35b033){const _0x32ab15=a26_0x1d9f23,{options:_0x343c60,args:_0x5614b3,tdx:_0x5031d3}=_0x35b033,_0x27ff81=_0x343c60,_0x1c6446=_0x5614b3[0x0]||_0x343c60[_0x32ab15(0xf2)];if(!_0x1c6446)return showParentSegmentNotSetError(_0x32ab15(0x155)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x27ff81['use']&&_0x27ff81[_0x32ab15(0x205)])return console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x194)](_0x32ab15(0x1f6))),console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x1af)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x1af)](_0x32ab15(0x19f)+PARENT_SEGMENT_DIR+_0x32ab15(0x17b))),console[_0x32ab15(0x252)](a26_0x4a65d0['cyan'](_0x32ab15(0x259))),0x1;const _0x365f93=_0x27ff81[_0x32ab15(0x205)]||a26_0x1a0643[_0x32ab15(0x1dc)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1c6446)+_0x32ab15(0x15a));_0x27ff81[_0x32ab15(0xdd)]&&(console[_0x32ab15(0x252)]('Site:\x20'+_0x27ff81[_0x32ab15(0x1a6)]),console[_0x32ab15(0x252)]('Parent\x20segment:\x20'+_0x1c6446),console[_0x32ab15(0x252)](_0x32ab15(0x1e0)+_0x365f93));const _0x1d2f51=await withSpinner(_0x32ab15(0x1bc)+_0x1c6446+'\x27...',()=>_0x5031d3[_0x32ab15(0x1ba)]['pullParentYaml'](_0x1c6446),{'verbose':_0x27ff81['verbose']}),_0x23c6bf=_0x1d2f51[_0x32ab15(0xdf)];if(existsSync(_0x365f93)){const _0x29dd90=readFileSync(_0x365f93,_0x32ab15(0x170)),_0x50a5dd=generateDiff(_0x29dd90,_0x23c6bf);if(!hasChanges(_0x50a5dd))console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x14f)]('✔')+'\x20No\x20changes\x20-\x20'+a26_0x4a65d0[_0x32ab15(0xe7)](_0x365f93)+_0x32ab15(0x218));else{console[_0x32ab15(0x252)](_0x32ab15(0xd0)+_0x365f93+'\x27:'),console[_0x32ab15(0x252)]('─'[_0x32ab15(0x188)](0x3c)),console[_0x32ab15(0x252)](formatDiffWithColors(_0x50a5dd)),console[_0x32ab15(0x252)]('─'['repeat'](0x3c));if(!_0x27ff81[_0x32ab15(0x1fc)]){if(!isInteractive())return console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x194)]('\x0aError:'),_0x32ab15(0x1f5)),console[_0x32ab15(0x252)](a26_0x4a65d0['dim'](_0x32ab15(0x136))),0x1;const _0x5719f0=await confirmKey(_0x32ab15(0x14c)+_0x365f93+'\x27?');if(!_0x5719f0)return console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x1b8)]('Aborted.')),0x1;}writeFileSync(_0x365f93,_0x23c6bf,_0x32ab15(0x170)),console['error'](a26_0x4a65d0[_0x32ab15(0x14f)]('✔')+_0x32ab15(0x1b5)+a26_0x4a65d0['cyan'](_0x365f93));}}else{const _0x1aab35=a26_0x1a0643[_0x32ab15(0x1da)](_0x365f93);!existsSync(_0x1aab35)&&mkdirSync(_0x1aab35,{'recursive':!![]}),writeFileSync(_0x365f93,_0x23c6bf,_0x32ab15(0x170)),console[_0x32ab15(0x252)](a26_0x4a65d0[_0x32ab15(0x14f)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x4a65d0['cyan'](_0x365f93));}return saveSessionContext({'parent_segment':_0x1c6446},_0x27ff81[_0x32ab15(0x126)]),console['error'](a26_0x4a65d0[_0x32ab15(0x14f)]('✔')+'\x20Context\x20set:\x20'+a26_0x4a65d0[_0x32ab15(0x1af)]('parent_segment')+_0x32ab15(0x251)+a26_0x4a65d0[_0x32ab15(0xe7)](_0x1c6446)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a26_0x1d9f23(0x1d4);['description']=a26_0x1d9f23(0x244);async['execute'](_0x16f344){const _0x1d61e9=a26_0x1d9f23,{options:_0x1c8a2b,args:_0x1e9f31,tdx:_0x45e9f0}=_0x16f344,_0x50a531=_0x1c8a2b,_0x319352=_0x1e9f31[0x0]||_0x1c8a2b[_0x1d61e9(0xf2)];if(!_0x319352)return showParentSegmentNotSetError(_0x1d61e9(0x12b)+_0x1d61e9(0x22b)),0x1;const _0x2663e5=resolveYamlFile(_0x319352);if(!existsSync(_0x2663e5))return showFileNotFoundError(_0x2663e5,_0x319352),0x1;_0x50a531[_0x1d61e9(0xdd)]&&(console['error'](_0x1d61e9(0xfc)+_0x50a531[_0x1d61e9(0x1a6)]),console[_0x1d61e9(0x252)](_0x1d61e9(0x214)+_0x2663e5));let _0x743e20;try{_0x743e20=readFileSync(_0x2663e5,_0x1d61e9(0x170));}catch(_0x438dbd){const _0x48854e=_0x438dbd instanceof Error?_0x438dbd[_0x1d61e9(0x14b)]:String(_0x438dbd);return console[_0x1d61e9(0x252)](_0x1d61e9(0x1c1)+_0x48854e),0x1;}const _0x1c2784=await withSpinner(_0x1d61e9(0x105),()=>_0x45e9f0[_0x1d61e9(0x1ba)][_0x1d61e9(0xed)](_0x743e20),{'verbose':_0x50a531[_0x1d61e9(0xdd)]}),_0x1ddb63=_0x1c2784[_0x1d61e9(0xdf)],{isNew:_0x2dd60c,name:_0xa582ab,hasChanges:_0x1d4856,diffFormatted:_0x5aff2b}=_0x1ddb63;if(!_0x1d4856)return console[_0x1d61e9(0x252)](_0x1d61e9(0xe0)+_0xa582ab+_0x1d61e9(0x231)),0x0;_0x2dd60c?console[_0x1d61e9(0x252)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xa582ab+'\x27:'):console['error'](_0x1d61e9(0x1f1)+_0xa582ab+'\x27:');console[_0x1d61e9(0x252)]('─'['repeat'](0x3c)),console['error'](_0x5aff2b),console['error']('─'['repeat'](0x3c));const _0x305cff=_0x2dd60c?_0x1d61e9(0x209)+_0xa582ab+'\x27?':_0x1d61e9(0x146)+_0xa582ab+'\x27?';if(!_0x50a531[_0x1d61e9(0x1fc)]){if(!isInteractive())return console[_0x1d61e9(0x252)](a26_0x4a65d0[_0x1d61e9(0x194)]('\x0aError:'),_0x1d61e9(0x1f5)),console['error'](a26_0x4a65d0['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x353d37=await confirmKey(_0x305cff);if(!_0x353d37)return console['error'](a26_0x4a65d0[_0x1d61e9(0x1b8)](_0x1d61e9(0x112))),0x1;}const _0xe61388=_0x2dd60c?_0x1d61e9(0x115):_0x1d61e9(0x164),_0x4fdbbe=await withSpinner(_0xe61388+_0x1d61e9(0xf8)+_0xa582ab+_0x1d61e9(0x186),()=>_0x1ddb63['apply'](),{'verbose':_0x50a531[_0x1d61e9(0xdd)]}),_0xbfd8dd=_0x4fdbbe[_0x1d61e9(0xdf)],_0x385813=getConsoleNextUrl(_0x50a531[_0x1d61e9(0x1a6)],_0x1d61e9(0x1cc)+_0xbfd8dd['id']),_0x104e8a=_0x2dd60c?'Created':_0x1d61e9(0x138);return console['error']('✔\x20'+_0x104e8a+_0x1d61e9(0xf8)+_0xbfd8dd['name']+'\x27'),console['error']('\x20\x20'+_0x385813),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1de);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x158);async[a26_0x1d9f23(0x11e)](_0x10e5bf){const _0x2209ec=a26_0x1d9f23,{options:_0xefd5cb,args:_0x44317b,tdx:_0x240d9}=_0x10e5bf,_0x47ae99=_0xefd5cb,_0x5d98a5=_0x44317b[0x0]||_0xefd5cb[_0x2209ec(0xf2)];if(!_0x5d98a5)return showParentSegmentNotSetError(_0x2209ec(0x13d)+_0x2209ec(0x182)+_0x2209ec(0x144)+_0x2209ec(0x189)+_0x2209ec(0xcf)+_0x2209ec(0xef)),0x1;const _0x2e4439=resolveYamlFile(_0x5d98a5);if(!existsSync(_0x2e4439))return showFileNotFoundError(_0x2e4439,_0x5d98a5),0x1;_0x47ae99[_0x2209ec(0xdd)]&&(console[_0x2209ec(0x252)](_0x2209ec(0xfc)+_0x47ae99[_0x2209ec(0x1a6)]),console[_0x2209ec(0x252)](_0x2209ec(0x214)+_0x2e4439));let _0x1ea242;try{_0x1ea242=readFileSync(_0x2e4439,_0x2209ec(0x170));}catch(_0x2b5beb){const _0x1123b8=_0x2b5beb instanceof Error?_0x2b5beb[_0x2209ec(0x14b)]:String(_0x2b5beb);return console[_0x2209ec(0x252)]('Error\x20reading\x20file:\x20'+_0x1123b8),0x1;}const _0x2b5dbe=createCommandSpinner(a26_0x4a65d0[_0x2209ec(0x1af)](_0x2209ec(0xe8)),{'verbose':_0x47ae99['verbose']});_0x2b5dbe[_0x2209ec(0x1d3)]();const _0x1b1aa9={'onProgress':_0x239b4f=>{const _0x3e31e7=_0x2209ec;_0x2b5dbe[_0x3e31e7(0x101)]=formatProgressMessage(_0x239b4f);}};if(_0x47ae99[_0x2209ec(0x198)])_0x1b1aa9[_0x2209ec(0x198)]=!![];if(_0x47ae99['enriched'])_0x1b1aa9['enriched']=!![];_0x47ae99['attribute']&&(_0x1b1aa9[_0x2209ec(0x1d8)]=_0x47ae99[_0x2209ec(0x1d8)]);_0x47ae99['behavior']&&(_0x1b1aa9[_0x2209ec(0x147)]=_0x47ae99[_0x2209ec(0x147)]);if(_0x47ae99[_0x2209ec(0x1a8)])_0x1b1aa9['interval']=_0x47ae99[_0x2209ec(0x1a8)];let _0x41634b;try{_0x41634b=await _0x240d9[_0x2209ec(0x1ba)][_0x2209ec(0xcd)](_0x1ea242,_0x1b1aa9),_0x2b5dbe[_0x2209ec(0x21e)]();}catch(_0x41c3ec){_0x2b5dbe[_0x2209ec(0x21e)]();throw _0x41c3ec;}const _0x5e5e31=_0x47ae99[_0x2209ec(0x1a8)]||_0x2209ec(0x1df);return this[_0x2209ec(0x19e)](_0x41634b,_0x1b1aa9,_0x2e4439,_0x5e5e31),_0x41634b['allValid']?0x0:0x1;}[a26_0x1d9f23(0x19e)](_0x369ac2,_0x45ba80,_0x208752,_0x551ee9){const _0xdb15b9=a26_0x1d9f23;console[_0xdb15b9(0x252)]('\x0a'+a26_0x4a65d0[_0xdb15b9(0x1eb)]('Validate:')+'\x20'+_0x369ac2[_0xdb15b9(0x172)]),console[_0xdb15b9(0x252)]('═'[_0xdb15b9(0x188)](0x3c)),this[_0xdb15b9(0x15c)](_0x369ac2);if(typeof _0x45ba80[_0xdb15b9(0x1d8)]==='string'){this['displayAttributesStats'](_0x369ac2),this[_0xdb15b9(0x24d)](_0x369ac2),this['displayPreviewHints'](_0x208752,_0x551ee9,_0xdb15b9(0x1d8),_0x45ba80[_0xdb15b9(0x1d8)]);return;}if(_0x45ba80[_0xdb15b9(0x1d8)]===!![]){this[_0xdb15b9(0x201)](_0x369ac2),this[_0xdb15b9(0x24d)](_0x369ac2),this[_0xdb15b9(0xe3)](_0x208752,_0x551ee9,_0xdb15b9(0x248));return;}if(typeof _0x45ba80['behavior']===_0xdb15b9(0xf5)){this[_0xdb15b9(0x1d9)](_0x369ac2,_0x551ee9),this[_0xdb15b9(0x24d)](_0x369ac2),this[_0xdb15b9(0xe3)](_0x208752,_0x551ee9,_0xdb15b9(0x147),_0x45ba80[_0xdb15b9(0x147)]);return;}if(_0x45ba80[_0xdb15b9(0x147)]===!![]){this[_0xdb15b9(0x1d9)](_0x369ac2,_0x551ee9),this['displaySummary'](_0x369ac2),this[_0xdb15b9(0xe3)](_0x208752,_0x551ee9,'behaviors');return;}this['displayAttributesStats'](_0x369ac2),this[_0xdb15b9(0x1d9)](_0x369ac2,_0x551ee9),this['displayRealtimeInfo'](_0x369ac2),this['displaySummary'](_0x369ac2),this['displayPreviewHints'](_0x208752,_0x551ee9,'all');}['displayRealtimeInfo'](_0x56ea71){displayRealtimeValidation(_0x56ea71);}[a26_0x1d9f23(0xe3)](_0x46b6f5,_0x1ca5e6,_0x15247c,_0x3be6c4){const _0x11cb02=a26_0x1d9f23;console['error']('\x0a'+a26_0x4a65d0[_0x11cb02(0x1af)]('To\x20view\x20sample\x20data:'));const _0x2ef6cc=_0x1ca5e6!==_0x11cb02(0x1df)?_0x11cb02(0x24b)+_0x1ca5e6:'';if(_0x15247c===_0x11cb02(0x1d8)&&_0x3be6c4)console[_0x11cb02(0x252)]('\x20\x20'+a26_0x4a65d0[_0x11cb02(0x1af)](_0x11cb02(0x253)+_0x46b6f5+_0x11cb02(0xf4)+_0x3be6c4+'\x22'+_0x2ef6cc));else{if(_0x15247c===_0x11cb02(0x147)&&_0x3be6c4)console[_0x11cb02(0x252)]('\x20\x20'+a26_0x4a65d0[_0x11cb02(0x1af)](_0x11cb02(0x253)+_0x46b6f5+'\x20--behavior\x20\x22'+_0x3be6c4+'\x22'+_0x2ef6cc));else(_0x15247c===_0x11cb02(0x248)||_0x15247c===_0x11cb02(0x17f))&&console[_0x11cb02(0x252)]('\x20\x20'+a26_0x4a65d0['dim']('tdx\x20ps\x20preview\x20'+_0x46b6f5+_0x11cb02(0x228)+_0x2ef6cc));}(_0x15247c===_0x11cb02(0x17a)||_0x15247c==='all')&&console[_0x11cb02(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x11cb02(0x253)+_0x46b6f5+_0x11cb02(0x199)+_0x2ef6cc)),_0x15247c===_0x11cb02(0x17f)&&console[_0x11cb02(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x11cb02(0x253)+_0x46b6f5+_0x11cb02(0xea)+_0x2ef6cc));}[a26_0x1d9f23(0x15c)](_0x1f7c2f){const _0x20223a=a26_0x1d9f23,{master:_0x9df25b}=_0x1f7c2f,_0x5df433=_0x9df25b[_0x20223a(0x102)]?a26_0x4a65d0['green']('✔'):a26_0x4a65d0[_0x20223a(0x194)]('✘');console[_0x20223a(0x252)]('\x0a'+a26_0x4a65d0[_0x20223a(0x1af)](_0x20223a(0xe5))),console[_0x20223a(0x252)](_0x5df433+'\x20'+a26_0x4a65d0[_0x20223a(0x1eb)](_0x9df25b[_0x20223a(0x174)]+'.'+_0x9df25b[_0x20223a(0x134)])),_0x9df25b[_0x20223a(0x102)]?_0x9df25b[_0x20223a(0xde)]!==undefined&&console[_0x20223a(0x252)]('\x20\x20'+a26_0x4a65d0[_0x20223a(0x1af)]('Rows:')+'\x20'+a26_0x4a65d0['cyan'](formatRows(_0x9df25b[_0x20223a(0xde)]))):console[_0x20223a(0x252)]('\x20\x20'+a26_0x4a65d0['red'](_0x20223a(0xe2))+'\x20'+_0x9df25b[_0x20223a(0x232)]);}[a26_0x1d9f23(0x201)](_0x4ef97d){const _0x449172=a26_0x1d9f23;if(_0x4ef97d[_0x449172(0x248)]['length']===0x0)return;console[_0x449172(0x252)]('\x0a'+a26_0x4a65d0['dim'](_0x449172(0xd1)));for(const _0x2064a6 of _0x4ef97d[_0x449172(0x248)]){const _0xf10f44=_0x2064a6[_0x449172(0x102)]?a26_0x4a65d0[_0x449172(0x14f)]('✔'):a26_0x4a65d0[_0x449172(0x194)]('✘');let _0x4b211d='';if(_0x2064a6[_0x449172(0x102)]&&_0x2064a6['matchedCount']!==undefined&&_0x2064a6[_0x449172(0x216)]!==undefined){const _0x1f5211=_0x2064a6['coveragePercent'][_0x449172(0x22c)](0x1),_0xf73dee=_0x2064a6[_0x449172(0x216)]>=0x50?a26_0x4a65d0[_0x449172(0x14f)]:_0x2064a6[_0x449172(0x216)]>=0x32?a26_0x4a65d0[_0x449172(0x1b8)]:a26_0x4a65d0[_0x449172(0x194)];_0x4b211d='\x20'+a26_0x4a65d0['dim']('Coverage:')+'\x20'+_0xf73dee(_0x1f5211+'%')+'\x20('+formatRows(_0x2064a6[_0x449172(0x1ca)])+_0x449172(0x191);}console[_0x449172(0x252)](_0xf10f44+'\x20'+a26_0x4a65d0[_0x449172(0x1eb)](_0x2064a6['name'])+_0x4b211d),console[_0x449172(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x449172(0x1c3))+'\x20'+a26_0x4a65d0[_0x449172(0x1eb)](_0x2064a6[_0x449172(0x174)]+'.'+_0x2064a6['table']));const _0x25a5ce=_0x2064a6[_0x449172(0x103)]===_0x2064a6[_0x449172(0x18a)]?a26_0x4a65d0[_0x449172(0x1af)]('Join\x20on:')+'\x20'+_0x2064a6['joinKey']:a26_0x4a65d0[_0x449172(0x1af)](_0x449172(0x258))+'\x20'+_0x2064a6[_0x449172(0x103)]+'\x20=\x20'+_0x2064a6[_0x449172(0x18a)];console[_0x449172(0x252)]('\x20\x20'+_0x25a5ce),console[_0x449172(0x252)]('\x20\x20'+a26_0x4a65d0[_0x449172(0x1af)](_0x449172(0x16a))),this[_0x449172(0x1c0)](_0x2064a6['columns']),!_0x2064a6[_0x449172(0x102)]&&console[_0x449172(0x252)]('\x20\x20'+a26_0x4a65d0[_0x449172(0x194)](_0x449172(0xe2))+'\x20'+_0x2064a6['schemaError']);}}[a26_0x1d9f23(0x1d9)](_0x570a0e,_0x5902aa){const _0x4c04cd=a26_0x1d9f23;if(_0x570a0e[_0x4c04cd(0x17a)][_0x4c04cd(0x1aa)]===0x0)return;console['error']('\x0a'+a26_0x4a65d0[_0x4c04cd(0x1af)](_0x4c04cd(0x18b))+'\x20'+a26_0x4a65d0['dim']('('+_0x5902aa+')'));for(const _0x315395 of _0x570a0e['behaviors']){const _0x5ab83a=_0x315395[_0x4c04cd(0x102)]?a26_0x4a65d0[_0x4c04cd(0x14f)]('✔'):a26_0x4a65d0['red']('✘');let _0x3360e0='';if(_0x315395[_0x4c04cd(0x102)]&&_0x315395[_0x4c04cd(0x1b1)]!==undefined&&_0x315395[_0x4c04cd(0x159)]!==undefined){const _0x7eabef=_0x315395[_0x4c04cd(0x124)]?.[_0x4c04cd(0x22c)](0x1)||'?',_0xb743cb=(_0x315395[_0x4c04cd(0x124)]??0x0)>=0x32?a26_0x4a65d0[_0x4c04cd(0x14f)]:(_0x315395[_0x4c04cd(0x124)]??0x0)>=0x14?a26_0x4a65d0[_0x4c04cd(0x1b8)]:a26_0x4a65d0[_0x4c04cd(0x194)];_0x3360e0='\x20'+a26_0x4a65d0[_0x4c04cd(0x1af)](_0x4c04cd(0x192))+'\x20'+_0xb743cb(formatRows(_0x315395[_0x4c04cd(0x1b1)]))+'\x20('+_0x7eabef+_0x4c04cd(0x21a)+a26_0x4a65d0[_0x4c04cd(0x1af)](_0x4c04cd(0x1fa))+'\x20'+a26_0x4a65d0[_0x4c04cd(0xe7)](formatRows(_0x315395[_0x4c04cd(0x159)]));}console[_0x4c04cd(0x252)](_0x5ab83a+'\x20'+a26_0x4a65d0[_0x4c04cd(0x1eb)](_0x315395[_0x4c04cd(0x172)])+_0x3360e0),console[_0x4c04cd(0x252)]('\x20\x20'+a26_0x4a65d0[_0x4c04cd(0x1af)](_0x4c04cd(0x1c3))+'\x20'+a26_0x4a65d0[_0x4c04cd(0x1eb)](_0x315395[_0x4c04cd(0x174)]+'.'+_0x315395[_0x4c04cd(0x134)]));const _0x1a45e9=_0x315395[_0x4c04cd(0x103)]===_0x315395[_0x4c04cd(0x18a)]?a26_0x4a65d0[_0x4c04cd(0x1af)](_0x4c04cd(0x169))+'\x20'+_0x315395[_0x4c04cd(0x103)]:a26_0x4a65d0['dim'](_0x4c04cd(0x258))+'\x20'+_0x315395[_0x4c04cd(0x103)]+_0x4c04cd(0x251)+_0x315395[_0x4c04cd(0x18a)];console[_0x4c04cd(0x252)]('\x20\x20'+_0x1a45e9),console[_0x4c04cd(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x4c04cd(0x16a))),this[_0x4c04cd(0x1c0)](_0x315395[_0x4c04cd(0x150)]),!_0x315395[_0x4c04cd(0x102)]&&console['error']('\x20\x20'+a26_0x4a65d0[_0x4c04cd(0x194)](_0x4c04cd(0xe2))+'\x20'+_0x315395['schemaError']);}}['displayColumns'](_0x383935){const _0xbb7ba7=a26_0x1d9f23;for(const _0x14bae8 of _0x383935){_0x14bae8[_0xbb7ba7(0x1a7)]===_0x14bae8[_0xbb7ba7(0x15b)]||_0x14bae8['column']==='*'?console[_0xbb7ba7(0x252)]('\x20\x20\x20\x20-\x20'+_0x14bae8[_0xbb7ba7(0x1a7)]):console[_0xbb7ba7(0x252)](_0xbb7ba7(0x19a)+_0x14bae8[_0xbb7ba7(0x1a7)]+'\x20'+a26_0x4a65d0[_0xbb7ba7(0x1af)]('('+_0x14bae8['column']+')'));}}[a26_0x1d9f23(0x24d)](_0x1efa1b){const _0x358a35=a26_0x1d9f23;console[_0x358a35(0x252)]('─'[_0x358a35(0x188)](0x3c));if(_0x1efa1b['errors']['length']>0x0){console['error']('\x0a'+a26_0x4a65d0[_0x358a35(0x194)](_0x358a35(0xfd)));for(const _0x2eb47f of _0x1efa1b[_0x358a35(0x1f7)]){console[_0x358a35(0x252)]('\x20\x20'+a26_0x4a65d0[_0x358a35(0x194)]('•')+'\x20'+_0x2eb47f);}}_0x1efa1b[_0x358a35(0x16d)]&&console['error']('\x0a'+a26_0x4a65d0['green']('✔')+_0x358a35(0x142));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x10e);[a26_0x1d9f23(0x162)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x26595d){const _0x2468a5=a26_0x1d9f23,{options:_0x57da5f,args:_0x364f33,tdx:_0x252a66}=_0x26595d,_0x5e1e98=_0x57da5f,_0x2caab1=_0x364f33[0x0]||_0x57da5f['parentSegment'];if(!_0x2caab1)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x2468a5(0x233)+_0x2468a5(0x1bb)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x2468a5(0x1c9)+_0x2468a5(0x239)+_0x2468a5(0xef)),0x1;if(!_0x5e1e98['master']&&!_0x5e1e98[_0x2468a5(0x1d8)]&&!_0x5e1e98[_0x2468a5(0x147)]&&!_0x5e1e98['enriched'])return console['error'](a26_0x4a65d0[_0x2468a5(0x194)](_0x2468a5(0x10f))),console[_0x2468a5(0x252)](_0x2468a5(0x202)),console[_0x2468a5(0x252)](_0x2468a5(0x211)),console[_0x2468a5(0x252)](_0x2468a5(0x246)),console[_0x2468a5(0x252)](_0x2468a5(0x235)),console[_0x2468a5(0x252)](_0x2468a5(0x1f4)),console[_0x2468a5(0x252)](_0x2468a5(0x168)),0x1;const _0x44a879=resolveYamlFile(_0x2caab1);if(!existsSync(_0x44a879))return showFileNotFoundError(_0x44a879,_0x2caab1),0x1;_0x5e1e98[_0x2468a5(0xdd)]&&(console[_0x2468a5(0x252)](_0x2468a5(0xfc)+_0x5e1e98[_0x2468a5(0x1a6)]),console[_0x2468a5(0x252)](_0x2468a5(0x214)+_0x44a879));let _0x4dd175;try{_0x4dd175=readFileSync(_0x44a879,_0x2468a5(0x170));}catch(_0x5d4aa6){const _0x2a4a91=_0x5d4aa6 instanceof Error?_0x5d4aa6['message']:String(_0x5d4aa6);return console[_0x2468a5(0x252)](_0x2468a5(0x1c1)+_0x2a4a91),0x1;}let _0x39af01;try{_0x39af01=parseDef(_0x4dd175);}catch(_0x47dfe5){const _0x68d410=_0x47dfe5 instanceof Error?_0x47dfe5[_0x2468a5(0x14b)]:String(_0x47dfe5);return console['error'](a26_0x4a65d0[_0x2468a5(0x194)](_0x2468a5(0x166)+_0x68d410)),0x1;}if(_0x5e1e98[_0x2468a5(0x1d8)]===!![]||_0x5e1e98['attribute']===''){const _0x209549=_0x39af01['attributes']?.[_0x2468a5(0x1a2)](_0x42d1bf=>_0x42d1bf[_0x2468a5(0x172)])||[];if(_0x209549['length']===0x0)console[_0x2468a5(0x252)](a26_0x4a65d0[_0x2468a5(0x194)](_0x2468a5(0x234)));else{console['error'](a26_0x4a65d0[_0x2468a5(0x194)](_0x2468a5(0x140))),console['error'](_0x2468a5(0xe1));for(const _0x181494 of _0x209549){console[_0x2468a5(0x252)]('\x20\x20'+a26_0x4a65d0[_0x2468a5(0xe7)](_0x181494));}console[_0x2468a5(0x252)](_0x2468a5(0x23f)+_0x2caab1+_0x2468a5(0xf4)+_0x209549[0x0]+'\x22');}return 0x1;}if(_0x5e1e98['behavior']===!![]||_0x5e1e98[_0x2468a5(0x147)]===''){const _0x5c523f=_0x39af01[_0x2468a5(0x17a)]?.['map'](_0x54945b=>_0x54945b['name'])||[];if(_0x5c523f['length']===0x0)console[_0x2468a5(0x252)](a26_0x4a65d0[_0x2468a5(0x194)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x2468a5(0x252)](a26_0x4a65d0[_0x2468a5(0x194)](_0x2468a5(0x123))),console[_0x2468a5(0x252)](_0x2468a5(0x11d));for(const _0x20ee5e of _0x5c523f){console[_0x2468a5(0x252)]('\x20\x20'+a26_0x4a65d0[_0x2468a5(0xe7)](_0x20ee5e));}console['error'](_0x2468a5(0x23f)+_0x2caab1+'\x20--behavior\x20\x22'+_0x5c523f[0x0]+'\x22');}return 0x1;}const _0x2cc0a1=createCommandSpinner(a26_0x4a65d0[_0x2468a5(0x1af)](_0x2468a5(0x15e)),{'verbose':_0x5e1e98[_0x2468a5(0xdd)]});_0x2cc0a1[_0x2468a5(0x1d3)]();const _0x855f09={'onProgress':_0x4c06e7=>{const _0x48cfdf=_0x2468a5;_0x2cc0a1[_0x48cfdf(0x101)]=formatProgressMessage(_0x4c06e7);}};if(_0x5e1e98[_0x2468a5(0x198)])_0x855f09[_0x2468a5(0x198)]=!![];if(_0x5e1e98[_0x2468a5(0x1d8)]&&typeof _0x5e1e98['attribute']==='string')_0x855f09[_0x2468a5(0x1d8)]=_0x5e1e98['attribute'];if(_0x5e1e98['behavior']&&typeof _0x5e1e98[_0x2468a5(0x147)]===_0x2468a5(0xf5))_0x855f09[_0x2468a5(0x147)]=_0x5e1e98['behavior'];if(_0x5e1e98[_0x2468a5(0x193)])_0x855f09[_0x2468a5(0x193)]=!![];if(_0x5e1e98['interval'])_0x855f09[_0x2468a5(0x1a8)]=_0x5e1e98['interval'];let _0x36c4b1;try{_0x36c4b1=await _0x252a66[_0x2468a5(0x1ba)][_0x2468a5(0x206)](_0x4dd175,_0x855f09),_0x2cc0a1[_0x2468a5(0x21e)]();}catch(_0x2e6c91){_0x2cc0a1[_0x2468a5(0x21e)]();throw _0x2e6c91;}return await this[_0x2468a5(0x149)](_0x36c4b1,{'master':_0x5e1e98[_0x2468a5(0x198)],'attribute':typeof _0x5e1e98[_0x2468a5(0x1d8)]===_0x2468a5(0xf5)?_0x5e1e98[_0x2468a5(0x1d8)]:undefined,'behavior':typeof _0x5e1e98[_0x2468a5(0x147)]==='string'?_0x5e1e98[_0x2468a5(0x147)]:undefined,'enriched':_0x5e1e98[_0x2468a5(0x193)]}),_0x36c4b1[_0x2468a5(0x16d)]?0x0:0x1;}async[a26_0x1d9f23(0x149)](_0x50ea4e,_0x4a2129){const _0x2f896e=a26_0x1d9f23;console['error']('\x0a'+a26_0x4a65d0['bold']('Preview:')+'\x20'+_0x50ea4e[_0x2f896e(0x172)]),console['error']('═'['repeat'](0x3c));if(_0x4a2129[_0x2f896e(0x198)]&&_0x50ea4e[_0x2f896e(0x1cf)]){const _0x5ee535=a26_0x4a65d0['dim'](_0x2f896e(0x247))+'\x20'+a26_0x4a65d0[_0x2f896e(0x1eb)](_0x50ea4e[_0x2f896e(0x198)][_0x2f896e(0x174)]+'.'+_0x50ea4e[_0x2f896e(0x198)][_0x2f896e(0x134)]);await this[_0x2f896e(0x161)](_0x5ee535,_0x50ea4e[_0x2f896e(0x1cf)]);}else{if(_0x4a2129[_0x2f896e(0x1d8)]&&_0x50ea4e['sampleData']){const _0x43c54c=a26_0x4a65d0[_0x2f896e(0x1af)]('Attribute:')+'\x20'+a26_0x4a65d0['bold'](_0x4a2129['attribute']);await this[_0x2f896e(0x161)](_0x43c54c,_0x50ea4e['sampleData']);}else{if(_0x4a2129[_0x2f896e(0x147)]&&_0x50ea4e[_0x2f896e(0x1cf)]){const _0x42cc49=a26_0x4a65d0[_0x2f896e(0x1af)](_0x2f896e(0xfb))+'\x20'+a26_0x4a65d0[_0x2f896e(0x1eb)](_0x4a2129[_0x2f896e(0x147)]);await this[_0x2f896e(0x161)](_0x42cc49,_0x50ea4e[_0x2f896e(0x1cf)]);}else{if(_0x4a2129[_0x2f896e(0x193)]&&_0x50ea4e[_0x2f896e(0x1cf)]){const _0x25904d=a26_0x4a65d0[_0x2f896e(0x1af)](_0x2f896e(0x212))+'\x20'+a26_0x4a65d0[_0x2f896e(0x1eb)](_0x2f896e(0x12d));await this['displaySampleData'](_0x25904d,_0x50ea4e[_0x2f896e(0x1cf)]);}else!_0x50ea4e[_0x2f896e(0x1cf)]&&console[_0x2f896e(0x252)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x50ea4e[_0x2f896e(0x1f7)][_0x2f896e(0x1aa)]>0x0){console['error']('─'[_0x2f896e(0x188)](0x3c)),console[_0x2f896e(0x252)]('\x0a'+a26_0x4a65d0[_0x2f896e(0x194)](_0x2f896e(0xfd)));for(const _0x26a4d0 of _0x50ea4e[_0x2f896e(0x1f7)]){console['error']('\x20\x20'+a26_0x4a65d0[_0x2f896e(0x194)]('•')+'\x20'+_0x26a4d0);}}}async[a26_0x1d9f23(0x161)](_0xf65f49,_0x3927d0){const _0xc5849d=a26_0x1d9f23;if(_0x3927d0[_0xc5849d(0x1aa)]===0x0){console[_0xc5849d(0x252)]('\x0a'+_0xf65f49),console['error']('\x20\x20No\x20sample\x20data\x20available');return;}console[_0xc5849d(0x252)]('\x0a'+_0xf65f49);const _0x547289=Object[_0xc5849d(0x24a)](_0x3927d0[0x0])[_0xc5849d(0x1a2)](_0x2e837c=>({'name':_0x2e837c,'type':typeof _0x3927d0[0x0][_0x2e837c]===_0xc5849d(0x130)?_0xc5849d(0x23c):_0xc5849d(0x17c)})),_0x596735={'queryId':_0xc5849d(0xd5),'columns':_0x547289,'data':_0x3927d0,'stats':{'state':_0xc5849d(0x117),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3927d0[_0xc5849d(0x1aa)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3f2a13=formatAsTable(_0x596735,_0x3927d0[_0xc5849d(0x1aa)],!![]);await writeOutput(_0x3f2a13,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x24f);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x1fb);async[a26_0x1d9f23(0x11e)](_0x196eca){const _0x452565=a26_0x1d9f23,{options:_0x55618b,args:_0x3eb0df,tdx:_0x4afc96}=_0x196eca,_0x59ebe4=_0x55618b,_0x251dae=_0x3eb0df[0x0]||_0x55618b[_0x452565(0xf2)];if(!_0x251dae)return showParentSegmentNotSetError(_0x452565(0x14e)+_0x452565(0x203)),0x1;const _0x57c1f8=resolveYamlFile(_0x251dae);if(existsSync(_0x57c1f8)){_0x59ebe4[_0x452565(0xdd)]&&console[_0x452565(0x252)](_0x452565(0x177)+_0x57c1f8);let _0x566ec9;try{_0x566ec9=readFileSync(_0x57c1f8,'utf-8');}catch(_0x2f24b1){const _0xb239d8=_0x2f24b1 instanceof Error?_0x2f24b1[_0x452565(0x14b)]:String(_0x2f24b1);return console[_0x452565(0x252)](_0x452565(0x1c1)+_0xb239d8),0x1;}const _0x128c28=await withSpinner(_0x452565(0x105),()=>_0x4afc96['segment'][_0x452565(0xed)](_0x566ec9),{'verbose':_0x59ebe4['verbose']}),_0x45a7c9=_0x128c28[_0x452565(0xdf)],{isNew:_0x2c2488,name:_0x57677a,hasChanges:_0x1e5c94,diffFormatted:_0x4df872}=_0x45a7c9;if(_0x1e5c94){_0x2c2488?console[_0x452565(0x252)](_0x452565(0x109)+_0x57677a+'\x27:'):console[_0x452565(0x252)](_0x452565(0x1f1)+_0x57677a+'\x27:');console[_0x452565(0x252)]('─'[_0x452565(0x188)](0x3c)),console[_0x452565(0x252)](_0x4df872),console[_0x452565(0x252)]('─'[_0x452565(0x188)](0x3c));const _0x3593f5=_0x2c2488?'Create\x20parent\x20segment\x20\x27'+_0x57677a+_0x452565(0xf7):_0x452565(0x146)+_0x57677a+_0x452565(0xf7);if(!_0x59ebe4['yes']){if(!isInteractive())return console[_0x452565(0x252)](a26_0x4a65d0[_0x452565(0x194)](_0x452565(0xf0)),_0x452565(0x1f5)),console[_0x452565(0x252)](a26_0x4a65d0['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1e098d=await confirmKey(_0x3593f5);if(!_0x1e098d)return console[_0x452565(0x252)](a26_0x4a65d0[_0x452565(0x1b8)](_0x452565(0x112))),0x1;}const _0x74a0de=_0x2c2488?_0x452565(0x115):_0x452565(0x164);await withSpinner(_0x74a0de+_0x452565(0xf8)+_0x57677a+_0x452565(0x186),()=>_0x45a7c9[_0x452565(0xe4)](),{'verbose':_0x59ebe4[_0x452565(0xdd)]});const _0x9b09bc=_0x2c2488?'Created':'Updated';console[_0x452565(0x252)]('✔\x20'+_0x9b09bc+'\x20parent\x20segment\x20\x27'+_0x57677a+'\x27');}else console[_0x452565(0x252)](_0x452565(0xe0)+_0x57677a+_0x452565(0x23e));}const _0x51c0ea=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x251dae+'\x27...',()=>_0x4afc96['segment']['runParent'](_0x251dae),{'verbose':_0x59ebe4[_0x452565(0xdd)]}),_0x53af99=_0x51c0ea[_0x452565(0xdf)],_0x20fb7b=getConsoleUrl(_0x59ebe4[_0x452565(0x1a6)],_0x452565(0x107)+_0x53af99['workflowId']+'/sessions/'+_0x53af99[_0x452565(0x12f)]+'/attempt/'+_0x53af99[_0x452565(0x19d)]);return console[_0x452565(0x252)](_0x452565(0x1b3)),console['error']('\x20\x20'+a26_0x4a65d0[_0x452565(0x1af)](_0x452565(0xf3))+'\x20'+_0x53af99[_0x452565(0x128)]),console[_0x452565(0x252)]('\x20\x20'+a26_0x4a65d0[_0x452565(0x1af)](_0x452565(0x118))+'\x20'+_0x53af99[_0x452565(0x1be)]),console[_0x452565(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x452565(0x1a0))+'\x20'+_0x53af99[_0x452565(0x12f)]),console[_0x452565(0x252)]('\x20\x20'+a26_0x4a65d0['dim'](_0x452565(0x156))+'\x20'+_0x53af99['workflowAttemptId']),console[_0x452565(0x252)]('\x20\x20'+_0x20fb7b),console[_0x452565(0x252)]('\x0a'+a26_0x4a65d0['dim']('To\x20cancel:')+_0x452565(0x25a)+_0x53af99['workflowAttemptId']+'\x20kill'),0x0;}}function a26_0x1eb2(_0x5ad6bd,_0x43c5c4){_0x5ad6bd=_0x5ad6bd-0xcd;const _0x56765d=a26_0x5676();let _0x1eb28b=_0x56765d[_0x5ad6bd];return _0x1eb28b;}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x21c);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0xda);async[a26_0x1d9f23(0x11e)](_0x2b683f){const _0x178102=a26_0x1d9f23,{options:_0x4fe5b5,args:_0x2347d9,tdx:_0x50561c}=_0x2b683f,_0xb12640=_0x2347d9[0x0]||_0x4fe5b5[_0x178102(0xf2)];if(!_0xb12640)return showParentSegmentNotSetError(_0x178102(0x114)+_0x178102(0x20a)),0x1;_0x4fe5b5['verbose']&&(console['error']('Site:\x20'+_0x4fe5b5[_0x178102(0x1a6)]),console[_0x178102(0x252)](_0x178102(0x14a)+_0xb12640));const _0x395032=await withSpinner(_0x178102(0x148)+_0xb12640+'\x27...',()=>_0x50561c[_0x178102(0x1ba)][_0x178102(0x226)](_0xb12640),{'verbose':_0x4fe5b5[_0x178102(0xdd)]}),_0x22f92c=_0x395032['data'];console['error'](_0x178102(0x157)+_0x22f92c['length']+_0x178102(0x13e)+(_0x22f92c['length']!==0x1?'s':''));if(_0x4fe5b5['json']||_0x4fe5b5['jsonl'])return await handleSDKOutput(_0x22f92c,_0x4fe5b5),0x0;return displayFieldsHumanReadable(_0x22f92c,_0xb12640),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0xf9);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x137);async['execute'](_0x198c59){const _0x78e0e0=a26_0x1d9f23,{options:_0x2608a6,args:_0x703447,tdx:_0x86fc1d}=_0x198c59,_0x401b30=_0x2608a6,_0x4e751a=_0x703447[0x0]||_0x2608a6[_0x78e0e0(0xf2)];if(!_0x4e751a)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'+_0x78e0e0(0x1d0)+_0x78e0e0(0x144)+_0x78e0e0(0x221)),0x1;_0x2608a6[_0x78e0e0(0xdd)]&&(console[_0x78e0e0(0x252)](_0x78e0e0(0xfc)+_0x2608a6[_0x78e0e0(0x1a6)]),console['error']('Parent\x20segment:\x20'+_0x4e751a));const _0x387226=await withSpinner(_0x78e0e0(0x1bc)+_0x4e751a+_0x78e0e0(0x186),()=>_0x86fc1d[_0x78e0e0(0x1ba)]['getParentFull'](_0x4e751a),{'verbose':_0x2608a6['verbose']}),_0x1b9c12=_0x387226[_0x78e0e0(0xdf)];if(_0x401b30['web']){const _0x422159=getConsoleNextUrl(_0x401b30[_0x78e0e0(0x1a6)],_0x78e0e0(0x1cc)+_0x1b9c12['id']);return console['error'](a26_0x4a65d0[_0x78e0e0(0x14f)]('✔')+_0x78e0e0(0x1a3)+a26_0x4a65d0[_0x78e0e0(0xe7)](_0x422159)),openBrowser(_0x422159),0x0;}return await handleSingleObjectOutput(_0x1b9c12,_0x2608a6),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x25b);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a26_0x1d9f23(0x11e)](_0x45bd2c){const _0x33e65b=a26_0x1d9f23,{options:_0x16b2e1,args:_0x228579,tdx:_0xbc4fcd}=_0x45bd2c,_0x2bf8de=_0x16b2e1,_0x58036c=_0x228579[0x0]||_0x16b2e1[_0x33e65b(0xf2)];if(!_0x58036c)return showParentSegmentNotSetError(_0x33e65b(0x215)+_0x33e65b(0x141)+_0x33e65b(0x144)+_0x33e65b(0x167)),0x1;_0x16b2e1[_0x33e65b(0xdd)]&&(console[_0x33e65b(0x252)](_0x33e65b(0xfc)+_0x16b2e1[_0x33e65b(0x1a6)]),console[_0x33e65b(0x252)]('Parent\x20segment:\x20'+_0x58036c));const _0x1ea83=await withSpinner(_0x33e65b(0x129)+_0x58036c+_0x33e65b(0x186),()=>_0xbc4fcd[_0x33e65b(0x1ba)]['resolveParentId'](_0x58036c),{'verbose':_0x16b2e1[_0x33e65b(0xdd)]}),_0x4779c3=_0x1ea83['data'],_0x5b4367=_0xbc4fcd[_0x33e65b(0x1ba)][_0x33e65b(0x16c)](_0x4779c3);if(_0x2bf8de[_0x33e65b(0x205)]){const _0x103566=await this['collectSchema'](_0x45bd2c,_0x58036c,_0x4779c3,_0x5b4367),_0x34eb7a=this['formatSchemaJson'](_0x103566);writeFileSync(_0x2bf8de[_0x33e65b(0x205)],_0x34eb7a);const _0x4325bf=_0x103566[_0x33e65b(0x23d)][_0x33e65b(0x150)][_0x33e65b(0x1aa)]+_0x103566[_0x33e65b(0x17a)]['reduce']((_0x49f16a,_0x2ddaf5)=>_0x49f16a+_0x2ddaf5[_0x33e65b(0x150)][_0x33e65b(0x1aa)],0x0),_0x4d292c=_0x103566[_0x33e65b(0x17a)][_0x33e65b(0x1db)](_0x386dc0=>_0x386dc0[_0x33e65b(0x150)][_0x33e65b(0x1aa)]===0x0)[_0x33e65b(0x1aa)];return console[_0x33e65b(0x11f)](_0x33e65b(0x243)+_0x2bf8de[_0x33e65b(0x205)]),console[_0x33e65b(0x11f)]('\x20\x20Database:\x20'+_0x5b4367),console[_0x33e65b(0x11f)](_0x33e65b(0x10d)+_0x103566[_0x33e65b(0x17a)][_0x33e65b(0x1aa)]+_0x33e65b(0x14d)),console[_0x33e65b(0x11f)](_0x33e65b(0x242)+_0x4325bf+_0x33e65b(0x1d1)),_0x4d292c>0x0&&console[_0x33e65b(0x11f)](_0x33e65b(0xfa)+_0x4d292c+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x33e65b(0x252)]('\x0a'+a26_0x4a65d0[_0x33e65b(0x1eb)](_0x33e65b(0x1f3))+'\x20'+a26_0x4a65d0['cyan'](_0x5b4367));const _0x158b6b=await withSpinner('Fetching\x20customers\x20schema...',()=>_0xbc4fcd['segment'][_0x33e65b(0x1e9)](_0x4779c3),{'verbose':_0x16b2e1[_0x33e65b(0xdd)]});console[_0x33e65b(0x252)]('\x0a'+a26_0x4a65d0[_0x33e65b(0x1eb)](_0x33e65b(0x23d))+'\x20'+a26_0x4a65d0['dim']('('+_0x5b4367+_0x33e65b(0x1e7)));const _0x386029=await executeSchemaQuery(_0x158b6b[_0x33e65b(0xdf)],_0xbc4fcd,_0x16b2e1);await handleQueryOutput(_0x386029,_0x16b2e1);const _0x362e34=await withSpinner(_0x33e65b(0xdc),()=>_0xbc4fcd[_0x33e65b(0x1ba)]['getBehaviorNames'](_0x4779c3),{'verbose':_0x16b2e1[_0x33e65b(0xdd)]});for(const _0x45e64e of _0x362e34[_0x33e65b(0xdf)]){const _0x521cb0='behavior_'+_0x45e64e[_0x33e65b(0x125)]()[_0x33e65b(0x183)](/\s+/g,'_'),_0x1860a4=_0x33e65b(0xf6)+_0x5b4367+'.'+_0x521cb0;console['error']('\x0a'+a26_0x4a65d0[_0x33e65b(0x1eb)](_0x45e64e)+'\x20'+a26_0x4a65d0[_0x33e65b(0x1af)]('('+_0x5b4367+'.'+_0x521cb0+')'));try{const _0x5739f0=await executeSchemaQuery(_0x1860a4,_0xbc4fcd,_0x16b2e1);await handleQueryOutput(_0x5739f0,_0x16b2e1);}catch{console[_0x33e65b(0x252)](a26_0x4a65d0['yellow'](_0x33e65b(0x219)));}}return 0x0;}async[a26_0x1d9f23(0x195)](_0x2978a6,_0x1cc337,_0x28978c,_0x1af6a0){const _0xd93f3f=a26_0x1d9f23,{options:_0x4d0db9,tdx:_0x10f2b8}=_0x2978a6,_0x3beeec=await withSpinner(_0xd93f3f(0x122),()=>_0x10f2b8['segment'][_0xd93f3f(0x1e9)](_0x28978c),{'verbose':_0x4d0db9[_0xd93f3f(0xdd)]}),_0x4ba5f1=await executeSchemaQuery(_0x3beeec[_0xd93f3f(0xdf)],_0x10f2b8,_0x4d0db9),_0xd2ac6d=_0x4ba5f1['data'][_0xd93f3f(0x1a2)](_0x1acacd=>({'name':_0x1acacd[_0xd93f3f(0x1fe)],'type':_0x1acacd['column_type']})),_0x3c330c=await withSpinner(_0xd93f3f(0xdc),()=>_0x10f2b8[_0xd93f3f(0x1ba)][_0xd93f3f(0x1cd)](_0x28978c),{'verbose':_0x4d0db9[_0xd93f3f(0xdd)]}),_0x1f8cd6=[];for(const _0x5bf8f5 of _0x3c330c[_0xd93f3f(0xdf)]){const _0x5643a2=_0xd93f3f(0x229)+_0x5bf8f5[_0xd93f3f(0x125)]()[_0xd93f3f(0x183)](/\s+/g,'_'),_0x41e5a3=_0xd93f3f(0xf6)+_0x1af6a0+'.'+_0x5643a2;let _0x593fe9=[];try{const _0x532ca7=await executeSchemaQuery(_0x41e5a3,_0x10f2b8,_0x4d0db9);_0x593fe9=_0x532ca7[_0xd93f3f(0xdf)][_0xd93f3f(0x1a2)](_0x4a7443=>({'name':_0x4a7443[_0xd93f3f(0x1fe)],'type':_0x4a7443[_0xd93f3f(0xe6)]}));}catch{}_0x1f8cd6[_0xd93f3f(0x1ff)]({'table':_0x5643a2,'columns':_0x593fe9});}return{'database':_0x1af6a0,'parent_segment':_0x1cc337,'parent_id':_0x28978c,'customers':{'table':'customers','columns':_0xd2ac6d},'behaviors':_0x1f8cd6};}[a26_0x1d9f23(0x1f2)](_0x80401c){const _0x27d75c=a26_0x1d9f23,_0x6a64a7=_0x55f557=>{const _0x1a4ec8=a26_0x1eb2;if(_0x55f557[_0x1a4ec8(0x1aa)]===0x0)return'[]';const _0x52057e=_0x55f557[_0x1a4ec8(0x1a2)](_0x3b591d=>_0x1a4ec8(0x163)+_0x3b591d[_0x1a4ec8(0x172)]+_0x1a4ec8(0x236)+_0x3b591d['type']+_0x1a4ec8(0x178));return'[\x0a'+_0x52057e[_0x1a4ec8(0x1dc)](',\x0a')+_0x1a4ec8(0x1b9);},_0x5d35d3=_0x80401c[_0x27d75c(0x17a)][_0x27d75c(0x1a2)](_0x4bba27=>{const _0x1b3966=_0x27d75c;return _0x1b3966(0x1e8)+_0x4bba27[_0x1b3966(0x134)]+_0x1b3966(0x1bd)+_0x6a64a7(_0x4bba27[_0x1b3966(0x150)])['replace'](/^/gm,'\x20\x20')[_0x1b3966(0xfe)]()+'\x0a\x20\x20\x20\x20}';})[_0x27d75c(0x1dc)](',\x0a');return _0x27d75c(0x17d)+_0x80401c[_0x27d75c(0x174)]+_0x27d75c(0x20e)+_0x80401c[_0x27d75c(0xd7)]+_0x27d75c(0x256)+_0x80401c[_0x27d75c(0x1e6)]+_0x27d75c(0x1b0)+_0x80401c[_0x27d75c(0x23d)][_0x27d75c(0x134)]+_0x27d75c(0x152)+_0x6a64a7(_0x80401c[_0x27d75c(0x23d)][_0x27d75c(0x150)])[_0x27d75c(0x183)](/^/gm,'\x20\x20')[_0x27d75c(0xfe)]()+_0x27d75c(0x196)+_0x5d35d3+_0x27d75c(0x145);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a26_0x1d9f23(0x119);[a26_0x1d9f23(0x162)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x132cea){const _0x52acf1=a26_0x1d9f23,{options:_0x1f17d0,args:_0xce37f8,tdx:_0x329e8d}=_0x132cea,_0x4eeabd=_0xce37f8[0x0]||_0x1f17d0[_0x52acf1(0xf2)];if(!_0x4eeabd)return showParentSegmentNotSetError(_0x52acf1(0xee)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x1f17d0[_0x52acf1(0xdd)]&&(console[_0x52acf1(0x252)](_0x52acf1(0xfc)+_0x1f17d0[_0x52acf1(0x1a6)]),console[_0x52acf1(0x252)]('Parent\x20segment:\x20'+_0x4eeabd));const _0x39686f=await withSpinner(_0x52acf1(0x129)+_0x4eeabd+_0x52acf1(0x186),()=>_0x329e8d[_0x52acf1(0x1ba)][_0x52acf1(0x245)](_0x4eeabd),{'verbose':_0x1f17d0[_0x52acf1(0xdd)]}),_0x28e42c=_0x39686f[_0x52acf1(0xdf)],_0x132882=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4eeabd+'\x27...',()=>_0x329e8d[_0x52acf1(0x1ba)][_0x52acf1(0x1e9)](_0x28e42c),{'verbose':_0x1f17d0[_0x52acf1(0xdd)]}),_0x4b42aa=_0x132882['data'];return _0x1f17d0[_0x52acf1(0x120)]===_0x52acf1(0x230)||_0x1f17d0[_0x52acf1(0x120)]==='jsonl'?await handleSDKOutput([{'sql':_0x4b42aa}],_0x1f17d0):console[_0x52acf1(0x11f)](_0x4b42aa),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1ea);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x55630a){const _0x21e0ad=a26_0x1d9f23,{options:_0x5ada61,args:_0x1f8ae7,tdx:_0x3b1854}=_0x55630a,_0x4fb4e8=_0x1f8ae7[0x0]||_0x5ada61['parentSegment'];if(!_0x4fb4e8)return showParentSegmentNotSetError(_0x21e0ad(0x22f)+_0x21e0ad(0x217)),0x1;_0x5ada61[_0x21e0ad(0xdd)]&&(console[_0x21e0ad(0x252)]('Site:\x20'+_0x5ada61[_0x21e0ad(0x1a6)]),console[_0x21e0ad(0x252)](_0x21e0ad(0x14a)+_0x4fb4e8));const _0x5e70ef=await withSpinner(_0x21e0ad(0x129)+_0x4fb4e8+_0x21e0ad(0x186),()=>_0x3b1854[_0x21e0ad(0x1ba)]['resolveParentId'](_0x4fb4e8),{'verbose':_0x5ada61[_0x21e0ad(0xdd)]}),_0x4abec9=_0x5e70ef['data'],_0x489b62=await withSpinner(_0x21e0ad(0x237)+_0x4fb4e8+'\x27...',()=>_0x3b1854[_0x21e0ad(0x1ba)][_0x21e0ad(0x1e9)](_0x4abec9),{'verbose':_0x5ada61['verbose']});let _0x4a2d75=_0x489b62[_0x21e0ad(0xdf)];const _0x344e3a=resolveLimit(_0x5ada61['limit'],DEFAULT_DISPLAY_LIMIT),_0x218f58=/\bLIMIT\s+\d+/i[_0x21e0ad(0x108)](_0x4a2d75);!_0x218f58&&(_0x4a2d75=_0x4a2d75[_0x21e0ad(0xfe)]()[_0x21e0ad(0x183)](/;+$/,''),_0x4a2d75='SELECT\x20*\x20FROM\x20(\x0a'+_0x4a2d75+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x344e3a);_0x5ada61[_0x21e0ad(0xdd)]&&console[_0x21e0ad(0x252)](_0x21e0ad(0x21b)+_0x4a2d75);const _0x4caecd=await withProgressSpinner(_0x21e0ad(0x1e5),async _0x1358d8=>{const _0x264f72=_0x21e0ad,_0x286859=await _0x3b1854[_0x264f72(0x11c)][_0x264f72(0x11e)](_0x4a2d75,{'catalog':'td','schema':_0x264f72(0x1b4),'onJobId':_0x94eda7=>{_0x1358d8['setJobId'](_0x94eda7);}});return _0x286859;},{'verbose':_0x5ada61[_0x21e0ad(0xdd)]}),_0x344504=_0x4caecd[_0x21e0ad(0xdf)],_0x447f41=_0x344504['jobId']?_0x21e0ad(0x11b)+_0x344504[_0x21e0ad(0x1a1)]+']':'';return console['error'](_0x21e0ad(0x250)+_0x344504[_0x21e0ad(0x13b)]['processedRows']['toLocaleString']()+'\x20rows\x20'+(_0x21e0ad(0x1ad)+formatElapsed(_0x344504[_0x21e0ad(0x13b)][_0x21e0ad(0x110)])+_0x447f41)),await handleQueryOutput(_0x344504,_0x5ada61),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x1d9f23(0x172)]='ps:rt:list';[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x1ae);async['execute'](_0x415aef){const _0x956182=a26_0x1d9f23,{options:_0x211f21,args:_0x39f9d1,tdx:_0x4ccc7b}=_0x415aef,_0x2c64f2=_0x39f9d1[0x0],_0x4cfe1c=await withSpinner(_0x2c64f2?_0x956182(0x20c)+_0x2c64f2+_0x956182(0x186):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x4ccc7b['realtime'][_0x956182(0x1dd)](),{'verbose':_0x211f21['verbose']});let _0xe30bbc=_0x4cfe1c[_0x956182(0xdf)]['filter'](_0x1aba42=>_0x1aba42[_0x956182(0x16e)]);if(_0x2c64f2){const _0x5b4b35=_0x2c64f2['replace'](/[.+^${}()|[\]\\]/g,_0x956182(0x135))[_0x956182(0x183)](/\*/g,'.*')[_0x956182(0x183)](/\?/g,'.'),_0x192ec6=new RegExp('^'+_0x5b4b35+'$','i');_0xe30bbc=_0xe30bbc['filter'](_0xe6d5ef=>_0x192ec6[_0x956182(0x108)](_0xe6d5ef[_0x956182(0x172)]));}_0xe30bbc[_0x956182(0x24e)]((_0x129ce0,_0x3f806b)=>_0x129ce0[_0x956182(0x172)][_0x956182(0x131)](_0x3f806b[_0x956182(0x172)])),console[_0x956182(0x252)](_0x956182(0x157)+_0xe30bbc[_0x956182(0x1aa)]+_0x956182(0x143)+(_0xe30bbc[_0x956182(0x1aa)]!==0x1?'s':''));const _0x38f00c=_0x3773c=>{const _0x94d6ba=_0x956182;return getConsoleNextUrl(_0x211f21[_0x94d6ba(0x1a6)],_0x94d6ba(0x1cc)+_0x3773c);};if(_0x211f21[_0x956182(0x120)]===_0x956182(0x230)||_0x211f21[_0x956182(0x120)]==='jsonl'){const _0x3ffe80=_0xe30bbc[_0x956182(0x1a2)](_0x3a4783=>({..._0x3a4783,'url':_0x38f00c(_0x3a4783['id'])}));await handleSDKOutput(_0x3ffe80,_0x211f21);}else{if(_0xe30bbc[_0x956182(0x1aa)]===0x0)console[_0x956182(0x11f)](_0x956182(0x24c));else for(const _0x28341d of _0xe30bbc){const _0x49469e=_0x28341d[_0x956182(0x257)]?a26_0x4a65d0['dim']('\x20('+formatRows(_0x28341d[_0x956182(0x257)])+')'):'',_0x3b4f23=hyperlink(_0x28341d['name'],_0x38f00c(_0x28341d['id']));console[_0x956182(0x11f)]('⚡\x20'+_0x3b4f23+_0x49469e);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0xce);['description']=a26_0x1d9f23(0xe9);async[a26_0x1d9f23(0x11e)](_0xb26d98){const _0x1f9241=a26_0x1d9f23,{options:_0x1f8396,args:_0x5b980c,tdx:_0x5567cf}=_0xb26d98,_0x442f18=_0x5b980c[0x0]||_0x1f8396[_0x1f9241(0xf2)];if(!_0x442f18)return showParentSegmentNotSetError(_0x1f9241(0x1e4)+_0x1f9241(0x18c)),0x1;const _0x2b8a92=resolveYamlFile(_0x442f18);if(!existsSync(_0x2b8a92))return showFileNotFoundError(_0x2b8a92,_0x442f18),0x1;let _0x5eba7b;try{_0x5eba7b=readFileSync(_0x2b8a92,_0x1f9241(0x170));}catch(_0x3b1630){const _0x1dba23=_0x3b1630 instanceof Error?_0x3b1630[_0x1f9241(0x14b)]:String(_0x3b1630);return console['error'](_0x1f9241(0x1c1)+_0x1dba23),0x1;}const _0xaec2b6=createCommandSpinner(a26_0x4a65d0[_0x1f9241(0x1af)]('Validating\x20RT\x20configuration...'),{'verbose':_0x1f8396['verbose']});_0xaec2b6[_0x1f9241(0x1d3)]();const _0x2350b3={'realtime':!![],'onProgress':_0x5e9656=>{_0xaec2b6['text']=formatProgressMessage(_0x5e9656);}};let _0x421659;try{_0x421659=await _0x5567cf['segment'][_0x1f9241(0xcd)](_0x5eba7b,_0x2350b3),_0xaec2b6[_0x1f9241(0x21e)]();}catch(_0x105950){_0xaec2b6[_0x1f9241(0x21e)]();throw _0x105950;}console['error']('\x0a'+a26_0x4a65d0[_0x1f9241(0x1eb)](_0x1f9241(0xd8))+'\x20'+_0x421659[_0x1f9241(0x172)]),console[_0x1f9241(0x252)]('═'[_0x1f9241(0x188)](0x3c)),displayRealtimeValidation(_0x421659),console['error']('─'[_0x1f9241(0x188)](0x3c));if(_0x421659['errors'][_0x1f9241(0x1aa)]>0x0){console[_0x1f9241(0x252)]('\x0a'+a26_0x4a65d0['red'](_0x1f9241(0xfd)));for(const _0x562335 of _0x421659[_0x1f9241(0x1f7)]){console['error']('\x20\x20'+a26_0x4a65d0['red']('•')+'\x20'+_0x562335);}}return _0x421659[_0x1f9241(0x16d)]&&console[_0x1f9241(0x252)]('\x0a'+a26_0x4a65d0[_0x1f9241(0x14f)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x421659['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x1d9f23(0x172)]='ps:pz:list';[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x18d);async[a26_0x1d9f23(0x11e)](_0x34f7c5){const _0x485fe1=a26_0x1d9f23,{options:_0x9ab7ed,args:_0x1aa971,tdx:_0x326476}=_0x34f7c5,_0x926c1c=_0x1aa971[0x0]||_0x9ab7ed[_0x485fe1(0xf2)];if(!_0x926c1c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x3e6ec2=await withSpinner(_0x485fe1(0x129)+_0x926c1c+'\x27...',()=>_0x326476[_0x485fe1(0x1ba)][_0x485fe1(0x245)](_0x926c1c),{'verbose':_0x9ab7ed[_0x485fe1(0xdd)]}),_0x42a4bd=_0x3e6ec2['data'],_0x402933=await withSpinner(_0x485fe1(0x19b)+_0x926c1c+_0x485fe1(0x186),()=>_0x326476['personalization'][_0x485fe1(0x1dd)](_0x42a4bd),{'verbose':_0x9ab7ed[_0x485fe1(0xdd)]}),_0x5ccdfe=_0x402933[_0x485fe1(0xdf)];console['error']('✔\x20Found\x20'+_0x5ccdfe[_0x485fe1(0x1aa)]+_0x485fe1(0x111)+(_0x5ccdfe[_0x485fe1(0x1aa)]!==0x1?'s':''));if(_0x9ab7ed['format']===_0x485fe1(0x230)||_0x9ab7ed[_0x485fe1(0x120)]===_0x485fe1(0x22a))await handleSDKOutput(_0x5ccdfe,_0x9ab7ed);else{if(_0x5ccdfe['length']===0x0)console[_0x485fe1(0x11f)](_0x485fe1(0x223)),console[_0x485fe1(0x252)](a26_0x4a65d0[_0x485fe1(0xe7)](_0x485fe1(0x18f)));else for(const _0x47f774 of _0x5ccdfe){const _0x5bf228=_0x47f774[_0x485fe1(0x1fd)]?.[_0x485fe1(0x1aa)]||0x0,_0x13111f=_0x47f774[_0x485fe1(0x1a5)]?a26_0x4a65d0[_0x485fe1(0x1af)](_0x485fe1(0xd2)+_0x47f774[_0x485fe1(0x1a5)]):'',_0x3b07d1=a26_0x4a65d0[_0x485fe1(0x1af)]('\x20('+_0x5bf228+_0x485fe1(0x15d)+(_0x5bf228!==0x1?'s':'')+')');console[_0x485fe1(0x11f)]('\x20\x20'+_0x47f774['name']+_0x13111f+_0x3b07d1),_0x47f774[_0x485fe1(0x162)]&&console['log'](_0x485fe1(0x20b)+a26_0x4a65d0['dim'](_0x47f774[_0x485fe1(0x162)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x1d9f23(0x172)]=a26_0x1d9f23(0x1c2);[a26_0x1d9f23(0x162)]=a26_0x1d9f23(0x179);async[a26_0x1d9f23(0x11e)](_0x4420ef){const _0x4284be=a26_0x1d9f23,{options:_0x3eaffe,args:_0x25209f}=_0x4420ef,_0x2b5ce9=_0x25209f[0x0]||_0x3eaffe[_0x4284be(0xf2)];if(!_0x2b5ce9)return showParentSegmentNotSetError(_0x4284be(0x13f)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x46991a=resolveYamlFile(_0x2b5ce9);if(!existsSync(_0x46991a))return showFileNotFoundError(_0x46991a,_0x2b5ce9),0x1;let _0x3ad402;try{_0x3ad402=readFileSync(_0x46991a,'utf-8');}catch(_0x3ab6f3){const _0x1c868f=_0x3ab6f3 instanceof Error?_0x3ab6f3[_0x4284be(0x14b)]:String(_0x3ab6f3);return console[_0x4284be(0x252)](_0x4284be(0x1c1)+_0x1c868f),0x1;}let _0x5048e5;try{_0x5048e5=parseDef(_0x3ad402);}catch(_0x4b6667){const _0x3b5572=_0x4b6667 instanceof Error?_0x4b6667[_0x4284be(0x14b)]:String(_0x4b6667);return console[_0x4284be(0x252)](a26_0x4a65d0[_0x4284be(0x194)]('Error\x20parsing\x20YAML:\x20'+_0x3b5572)),0x1;}if(_0x5048e5['personalization_services']&&_0x5048e5['personalization_services'][_0x4284be(0x1aa)]>0x0)return console[_0x4284be(0x252)](a26_0x4a65d0[_0x4284be(0x1b8)](_0x4284be(0x10c)+_0x46991a)),console[_0x4284be(0x252)](a26_0x4a65d0['dim'](_0x4284be(0x153)+_0x5048e5[_0x4284be(0x133)][_0x4284be(0x1aa)]+_0x4284be(0x21d))),0x1;!_0x5048e5['realtime']&&(_0x5048e5[_0x4284be(0x1bf)]={'events':[{'name':_0x4284be(0x22d),'source_table':_0x4284be(0x116)}],'attributes':[{'name':'last_page_viewed','type':_0x4284be(0x240)}],'id_stitching':{'primary_key':_0x5048e5['master'][_0x4284be(0x134)]==='customers'?_0x4284be(0x200):_0x4284be(0x204)}});_0x5048e5[_0x4284be(0x133)]=[{'name':_0x4284be(0x241),'description':'Personalization\x20service\x20description','trigger_event':_0x4284be(0x22d),'sections':[{'name':_0x4284be(0x19c),'criteria':_0x4284be(0x1d2),'attributes':[_0x4284be(0x180)]}]}];const _0x4caa11=serializeDef(_0x5048e5);return writeFileSync(_0x46991a,_0x4caa11,_0x4284be(0x170)),console['error'](a26_0x4a65d0[_0x4284be(0x14f)]('✔')+_0x4284be(0x184)+a26_0x4a65d0[_0x4284be(0xe7)](_0x46991a)),(!_0x5048e5[_0x4284be(0x1bf)]||_0x3ad402[_0x4284be(0x106)](_0x4284be(0x224))===-0x1)&&console['error'](a26_0x4a65d0['green']('✔')+_0x4284be(0x176)),console[_0x4284be(0x252)]('\x0a'+a26_0x4a65d0['dim'](_0x4284be(0x171))),console[_0x4284be(0x252)](_0x4284be(0x210)+_0x46991a+_0x4284be(0x12e)),console[_0x4284be(0x252)](_0x4284be(0x187)+a26_0x4a65d0[_0x4284be(0x1af)](_0x4284be(0x1cb)+_0x2b5ce9)+_0x4284be(0x20d)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x3607f6=a27_0x33d7;(function(_0x10ad81,_0x4e4f29){const _0x5a5832=a27_0x33d7,_0x5ed36c=_0x10ad81();while(!![]){try{const _0x1cae70=-parseInt(_0x5a5832(0x1bc))/0x1+-parseInt(_0x5a5832(0x172))/0x2*(parseInt(_0x5a5832(0x16c))/0x3)+parseInt(_0x5a5832(0x180))/0x4*(parseInt(_0x5a5832(0x1b7))/0x5)+-parseInt(_0x5a5832(0x15f))/0x6*(parseInt(_0x5a5832(0x15c))/0x7)+-parseInt(_0x5a5832(0x192))/0x8*(-parseInt(_0x5a5832(0x175))/0x9)+-parseInt(_0x5a5832(0x1c1))/0xa+parseInt(_0x5a5832(0x1b9))/0xb;if(_0x1cae70===_0x4e4f29)break;else _0x5ed36c['push'](_0x5ed36c['shift']());}catch(_0x2856f5){_0x5ed36c['push'](_0x5ed36c['shift']());}}}(a27_0x269b,0x1c589));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a27_0x31d7f5 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a27_0x269b(){const _0x541d9c=['8925UMCQdn','profile:set','tdx:\x20profile\x20create','1050DmEybF','site','name','length','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','tdx:\x20profile\x20set','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Set\x20a\x20profile\x20configuration\x20value','create','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','select','join','2274kqmtvq','text','red','llm_agent','Removal\x20cancelled','customSite','72lxFmqq','VALID_KEYS','Profile\x20\x27','549TBFPKJ','dim','\x20API\x20key\x20removed\x20from\x20system\x20keychain','validate','includes','warn','Default\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','932egchnv','\x27\x20requires\x20API\x20key\x20validation.','Set\x20session\x20profile','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20\x20(no\x20profiles\x20found)','Session\x20profile\x20set\x20to:\x20','Unknown\x20key\x20\x27','\x0aSetup\x20cancelled','\x0aSaved\x20to:\x20','test','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20-\x20','profile','confirm','\x20Profile\x20\x27','profile:use','logLevel','\x20API\x20key\x20is\x20valid\x20(User:\x20','19336ctWjOi','tdx:\x20profile\x20remove','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profileName','Enter\x20description\x20(optional):','You\x20can\x20find\x20your\x20API\x20key\x20at:','getUserInfo','Operation\x20cancelled','Profile\x20name\x20cannot\x20be\x20empty','tdx.json','\x0aOperation\x20cancelled','error','\x27\x20does\x20not\x20exist.\x20Create\x20it?','green','other','Failed\x20to\x20remove\x20profile:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','profile:remove','\x0aAvailable\x20profiles:','default','\x27\x20removed\x20from\x20configuration','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','split','session','config','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','trim','log','yellow','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','us01','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','status','3145QrjXHt','Create\x20a\x20new\x20profile','2933183AnqCyv','\x20\x20tdx\x20--profile\x20','\x20--default\x27\x20to\x20save\x20permanently','137738HseBEP','Enter\x20profile\x20name:','API\x20key\x20cannot\x20be\x20empty','bold','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','563910ZCEpmk','execute','✗\x20Validation\x20failed:\x20','\x27\x20updated:\x20','(cleared)','email','message','Validating\x20API\x20key...','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','password','(session:\x20','Site\x20was\x20not\x20changed.','jobs','llm_project'];a27_0x269b=function(){return _0x541d9c;};return a27_0x269b();}function a27_0x33d7(_0x32e820,_0x549dfd){_0x32e820=_0x32e820-0x158;const _0x269b98=a27_0x269b();let _0x33d75d=_0x269b98[_0x32e820];return _0x33d75d;}import a27_0xc9cfc6 from'prompts';import a27_0x14794b from'chalk';function validateProfileName(_0xa6c59e){const _0x38be24=a27_0x33d7;if(!_0xa6c59e||!_0xa6c59e['trim']())return _0x38be24(0x19a);const _0x46bc69=_0xa6c59e[_0x38be24(0x1af)]();if(!/^[a-zA-Z0-9_-]+$/[_0x38be24(0x189)](_0x46bc69))return _0x38be24(0x1a2);if(profileExists(_0x46bc69))return _0x38be24(0x174)+_0x46bc69+_0x38be24(0x1a9);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x3607f6(0x161)]='profile:create';['description']=a27_0x3607f6(0x1b8);async[a27_0x3607f6(0x1c2)](_0x1af72c){const _0x4a7dd7=a27_0x3607f6,{options:_0x212fca,args:_0x281fa5}=_0x1af72c;console[_0x4a7dd7(0x1b0)](a27_0x14794b[_0x4a7dd7(0x1bf)](_0x4a7dd7(0x15e)));let _0x5092c6;if(_0x281fa5[_0x4a7dd7(0x162)]>0x0&&_0x281fa5[0x0]){const _0x2d9a87=_0x281fa5[0x0]['trim'](),_0xbd3aa=validateProfileName(_0x2d9a87);if(_0xbd3aa!==!![])return console[_0x4a7dd7(0x19d)](a27_0x14794b[_0x4a7dd7(0x16e)](_0xbd3aa)),0x1;_0x5092c6=_0x2d9a87;}else{const _0x10531d=await a27_0xc9cfc6({'type':_0x4a7dd7(0x16d),'name':_0x4a7dd7(0x195),'message':_0x4a7dd7(0x1bd),'validate':validateProfileName});if(!_0x10531d[_0x4a7dd7(0x195)])return console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x187)),0x1;_0x5092c6=_0x10531d[_0x4a7dd7(0x195)][_0x4a7dd7(0x1af)]();}const _0x222681=await a27_0xc9cfc6({'type':_0x4a7dd7(0x16d),'name':_0x4a7dd7(0x168),'message':_0x4a7dd7(0x196)}),_0x2ede1a=_0x222681[_0x4a7dd7(0x168)]?.[_0x4a7dd7(0x1af)]()||undefined,_0x50665d=_0x212fca[_0x4a7dd7(0x160)]||'us01',{choices:_0x2dea84,initialIndex:_0x6ab25e}=buildSiteChoices(_0x50665d),_0xd89fab=await a27_0xc9cfc6({'type':_0x4a7dd7(0x16a),'name':'site','message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x5092c6+'\x27:','choices':_0x2dea84,'initial':_0x6ab25e});if(!_0xd89fab[_0x4a7dd7(0x160)])return console['log'](_0x4a7dd7(0x187)),0x1;let _0x3cad47;if(_0xd89fab['site']===_0x4a7dd7(0x1a0)){const _0x4b720c=await a27_0xc9cfc6({'type':'text','name':_0x4a7dd7(0x171),'message':'Enter\x20site\x20name:','initial':_0x4a7dd7(0x1b3),'validate':_0x1d3721=>{const _0xbc63b7=_0x4a7dd7;if(!_0x1d3721||!_0x1d3721[_0xbc63b7(0x1af)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x1d3721[_0xbc63b7(0x1af)]()))return _0xbc63b7(0x183);return!![];}});if(!_0x4b720c[_0x4a7dd7(0x171)])return console['log'](_0x4a7dd7(0x187)),0x1;_0x3cad47=_0x4b720c['customSite'];}else _0x3cad47=_0xd89fab[_0x4a7dd7(0x160)];const _0x56ad96=resolveSite(_0x3cad47);console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x1ae)+_0x56ad96),console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x197)),console[_0x4a7dd7(0x1b0)]('\x20\x20'+getConsoleUrl(_0x56ad96,_0x4a7dd7(0x17e)));const _0x38a454=await a27_0xc9cfc6({'type':_0x4a7dd7(0x1ca),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x35aead=>{if(!_0x35aead||!_0x35aead['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x38a454[_0x4a7dd7(0x1a3)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x55331f=_0x38a454[_0x4a7dd7(0x1a3)];console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x1c8));try{const _0x3ac258=TDX[_0x4a7dd7(0x167)]({'site':_0x56ad96,'apiKey':_0x55331f[_0x4a7dd7(0x1af)](),'logLevel':_0x212fca['logLevel']??LogLevel['ERROR']}),_0x41faef=await _0x3ac258[_0x4a7dd7(0x15a)][_0x4a7dd7(0x198)]();console[_0x4a7dd7(0x1b0)](a27_0x14794b['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x41faef[_0x4a7dd7(0x1c6)]+')');const _0x35c880=await isKeychainAvailable();_0x35c880?(await saveAPIKeyAsync(_0x55331f['trim'](),_0x56ad96,_0x5092c6),console[_0x4a7dd7(0x1b0)](a27_0x14794b['green']('✓')+_0x4a7dd7(0x194)+_0x5092c6+')')):(console[_0x4a7dd7(0x17a)](a27_0x14794b[_0x4a7dd7(0x1b1)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4a7dd7(0x17a)](a27_0x14794b[_0x4a7dd7(0x1b1)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1b7bfc={'site':_0x56ad96,..._0x2ede1a&&{'description':_0x2ede1a}};return saveProfileToUserConfig(_0x5092c6,_0x1b7bfc),console[_0x4a7dd7(0x1b0)](a27_0x14794b[_0x4a7dd7(0x19f)]('✓')+_0x4a7dd7(0x18e)+_0x5092c6+'\x27\x20created'),console['log'](),console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x1c0)),console[_0x4a7dd7(0x1b0)](_0x4a7dd7(0x1ba)+_0x5092c6+_0x4a7dd7(0x1b2)),console[_0x4a7dd7(0x1b0)]('\x20\x20tdx\x20--profile\x20'+_0x5092c6+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x1d7877){if(_0x1d7877 instanceof HTTPClientError&&_0x1d7877[_0x4a7dd7(0x1b6)]===0x191)return printAuthError(_0x1d7877),0x1;return console[_0x4a7dd7(0x19d)](a27_0x14794b[_0x4a7dd7(0x16e)](_0x4a7dd7(0x1c3)+(_0x1d7877 instanceof Error?_0x1d7877[_0x4a7dd7(0x1c7)]:String(_0x1d7877)))),console[_0x4a7dd7(0x19d)](_0x4a7dd7(0x163)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x3607f6(0x161)]=a27_0x3607f6(0x1a5);[a27_0x3607f6(0x168)]='Remove\x20a\x20profile';[a27_0x3607f6(0x178)](_0xf0672f){const _0xb53034=a27_0x3607f6,{args:_0x312495}=_0xf0672f;if(_0x312495['length']===0x0)return _0xb53034(0x1a4);return undefined;}async['execute'](_0xce9d4c){const _0x3553e2=a27_0x3607f6,{args:_0x1e0a28}=_0xce9d4c,_0x31e86d=_0x1e0a28[0x0];console[_0x3553e2(0x1b0)](a27_0x14794b[_0x3553e2(0x1bf)](_0x3553e2(0x193)));if(!profileExists(_0x31e86d)){console[_0x3553e2(0x19d)](a27_0x14794b[_0x3553e2(0x16e)](_0x3553e2(0x174)+_0x31e86d+_0x3553e2(0x17c))),console[_0x3553e2(0x1b0)](_0x3553e2(0x1a6));const _0xed6810=listProfiles();if(_0xed6810[_0x3553e2(0x162)]===0x0)console[_0x3553e2(0x1b0)](_0x3553e2(0x184));else for(const _0x241de2 of _0xed6810){console[_0x3553e2(0x1b0)](_0x3553e2(0x18b)+_0x241de2['name']);}return 0x1;}const _0x41503b=await a27_0xc9cfc6({'type':_0x3553e2(0x18d),'name':_0x3553e2(0x18d),'message':_0x3553e2(0x165)+_0x31e86d+'\x27?','initial':![]});if(!_0x41503b[_0x3553e2(0x18d)])return console[_0x3553e2(0x1b0)](_0x3553e2(0x170)),0x0;try{removeProfileFromUserConfig(_0x31e86d),console[_0x3553e2(0x1b0)](a27_0x14794b[_0x3553e2(0x19f)]('✓')+_0x3553e2(0x18e)+_0x31e86d+_0x3553e2(0x1a8));}catch(_0x590318){return console['error'](a27_0x14794b['red'](_0x3553e2(0x1a1)+(_0x590318 instanceof Error?_0x590318[_0x3553e2(0x1c7)]:String(_0x590318)))),0x1;}const _0x484442=await isKeychainAvailable();if(_0x484442){const _0x516e07=await deleteKeychainAPIKey(_0x31e86d);_0x516e07&&console[_0x3553e2(0x1b0)](a27_0x14794b[_0x3553e2(0x19f)]('✓')+_0x3553e2(0x177));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x3607f6(0x161)]=a27_0x3607f6(0x15d);[a27_0x3607f6(0x168)]=a27_0x3607f6(0x166);static [a27_0x3607f6(0x173)]=[a27_0x3607f6(0x160),'database','parent_segment',a27_0x3607f6(0x15b),a27_0x3607f6(0x16f),a27_0x3607f6(0x168)];['validate'](_0x2717eb){const _0x522baa=a27_0x3607f6,{args:_0x42f056,options:_0x20a4c0}=_0x2717eb,_0x38768b=_0x20a4c0[_0x522baa(0x18c)]||getActiveProfile();if(!_0x38768b)return _0x522baa(0x17d);if(_0x42f056[_0x522baa(0x162)]===0x0)return _0x522baa(0x1b5)+ProfileSetCommand[_0x522baa(0x173)][_0x522baa(0x16b)](',\x20');const _0xee908c=_0x42f056[0x0];if(!_0xee908c[_0x522baa(0x179)]('='))return _0x522baa(0x18a)+ProfileSetCommand[_0x522baa(0x173)][_0x522baa(0x16b)](',\x20');const [_0x381321]=_0xee908c[_0x522baa(0x1aa)]('=',0x2);if(!ProfileSetCommand[_0x522baa(0x173)][_0x522baa(0x179)](_0x381321))return _0x522baa(0x186)+_0x381321+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x522baa(0x173)][_0x522baa(0x16b)](',\x20');return undefined;}async[a27_0x3607f6(0x1c2)](_0x22479b){const _0x31f57a=a27_0x3607f6,{args:_0x5c61c6,options:_0x2efb39}=_0x22479b,_0x388a2b=_0x2efb39[_0x31f57a(0x18c)]||getActiveProfile(),[_0x9a3a29,..._0x255115]=_0x5c61c6[0x0][_0x31f57a(0x1aa)]('='),_0x5643de=_0x255115[_0x31f57a(0x16b)]('=');console['log'](a27_0x14794b['bold'](_0x31f57a(0x164)));if(!profileExists(_0x388a2b)){const _0x53f38a=await a27_0xc9cfc6({'type':_0x31f57a(0x18d),'name':_0x31f57a(0x167),'message':_0x31f57a(0x174)+_0x388a2b+_0x31f57a(0x19e),'initial':!![]});if(!_0x53f38a['create'])return console[_0x31f57a(0x1b0)](_0x31f57a(0x199)),0x1;}const _0x5ba746=loadProfile(_0x388a2b),_0x39eb88=_0x5ba746?.[_0x31f57a(0x1ac)]||{};if(_0x9a3a29===_0x31f57a(0x160)){const _0xe108e2=resolveSite(_0x5643de);console[_0x31f57a(0x1b0)]('Changing\x20site\x20to\x20\x27'+_0xe108e2+_0x31f57a(0x181)),console[_0x31f57a(0x1b0)](_0x31f57a(0x1c9)),console[_0x31f57a(0x1b0)]('\x20\x20'+getConsoleUrl(_0xe108e2,_0x31f57a(0x17e)));const _0xe404bc=await a27_0xc9cfc6({'type':_0x31f57a(0x1ca),'name':'apiKey','message':_0x31f57a(0x17f),'validate':_0x25216e=>{const _0xffb30f=_0x31f57a;if(!_0x25216e||!_0x25216e['trim']())return _0xffb30f(0x1be);return!![];}});if(!_0xe404bc[_0x31f57a(0x1a3)])return console[_0x31f57a(0x1b0)](_0x31f57a(0x19c)),0x1;console[_0x31f57a(0x1b0)](_0x31f57a(0x1c8));try{const _0x5cf9d7=TDX['create']({'site':_0xe108e2,'apiKey':_0xe404bc[_0x31f57a(0x1a3)][_0x31f57a(0x1af)](),'logLevel':_0x2efb39[_0x31f57a(0x190)]??LogLevel['ERROR']}),_0x4f81a5=await _0x5cf9d7[_0x31f57a(0x15a)][_0x31f57a(0x198)]();console['log'](a27_0x14794b['green']('✓')+_0x31f57a(0x191)+_0x4f81a5['email']+')');const _0x12b830=await isKeychainAvailable();_0x12b830?(await saveAPIKeyAsync(_0xe404bc[_0x31f57a(0x1a3)][_0x31f57a(0x1af)](),_0xe108e2,_0x388a2b),console[_0x31f57a(0x1b0)](a27_0x14794b[_0x31f57a(0x19f)]('✓')+_0x31f57a(0x1b4))):console[_0x31f57a(0x17a)](a27_0x14794b[_0x31f57a(0x1b1)](_0x31f57a(0x169))),_0x39eb88[_0x31f57a(0x160)]=_0xe108e2;}catch(_0x3caf12){if(_0x3caf12 instanceof HTTPClientError&&_0x3caf12[_0x31f57a(0x1b6)]===0x191)return printAuthError(_0x3caf12),0x1;return console[_0x31f57a(0x19d)](a27_0x14794b['red']('✗\x20Validation\x20failed:\x20'+(_0x3caf12 instanceof Error?_0x3caf12[_0x31f57a(0x1c7)]:String(_0x3caf12)))),console[_0x31f57a(0x19d)](_0x31f57a(0x159)),0x1;}}else _0x39eb88[_0x9a3a29]=_0x5643de||undefined;return saveProfileToUserConfig(_0x388a2b,_0x39eb88),console[_0x31f57a(0x1b0)](a27_0x14794b[_0x31f57a(0x19f)]('✓')+_0x31f57a(0x18e)+_0x388a2b+_0x31f57a(0x1c4)+_0x9a3a29+'='+(_0x5643de||_0x31f57a(0x1c5))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x3607f6(0x161)]=a27_0x3607f6(0x18f);[a27_0x3607f6(0x168)]=a27_0x3607f6(0x182);[a27_0x3607f6(0x178)](_0x4e6d4a){const _0x8bbcea=a27_0x3607f6,{args:_0x5e7d31}=_0x4e6d4a;if(_0x5e7d31[_0x8bbcea(0x162)]===0x0)return _0x8bbcea(0x1ad);return undefined;}async[a27_0x3607f6(0x1c2)](_0x4dda39){const _0x7d82ba=a27_0x3607f6,{args:_0x439110,options:_0x38d758}=_0x4dda39,_0x3570df=_0x439110[0x0],_0x89f6bf=_0x38d758[_0x7d82ba(0x1a7)];cleanExpiredSessions();if(!profileExists(_0x3570df)){console[_0x7d82ba(0x19d)](a27_0x14794b[_0x7d82ba(0x16e)](_0x7d82ba(0x174)+_0x3570df+_0x7d82ba(0x17c))),console[_0x7d82ba(0x1b0)]('\x0aAvailable\x20profiles:');const _0x128679=listProfiles();if(_0x128679[_0x7d82ba(0x162)]===0x0)console[_0x7d82ba(0x1b0)](_0x7d82ba(0x184));else for(const _0x4a9519 of _0x128679){console[_0x7d82ba(0x1b0)](_0x7d82ba(0x18b)+_0x4a9519['name']);}return 0x1;}if(_0x89f6bf){const _0xa9f055=a27_0x31d7f5[_0x7d82ba(0x16b)](getConfigDir(),_0x7d82ba(0x19b));return saveActiveProfileToUserConfig(_0x3570df),console[_0x7d82ba(0x1b0)](_0x7d82ba(0x17b)+a27_0x14794b[_0x7d82ba(0x19f)](_0x3570df)),console[_0x7d82ba(0x1b0)](a27_0x14794b[_0x7d82ba(0x176)](_0x7d82ba(0x188)+_0xa9f055)),0x0;}const _0x5b1acd=getSessionID(_0x38d758[_0x7d82ba(0x1ab)]);return saveSessionContext({'profile':_0x3570df},_0x38d758[_0x7d82ba(0x1ab)]),console[_0x7d82ba(0x1b0)](_0x7d82ba(0x185)+a27_0x14794b['green'](_0x3570df)+'\x20'+a27_0x14794b['dim'](_0x7d82ba(0x158)+_0x5b1acd+')')),console['log'](a27_0x14794b[_0x7d82ba(0x176)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3570df+_0x7d82ba(0x1bb))),0x0;}}
|
|
1
|
+
const a27_0x17bd72=a27_0x4b98;(function(_0x3a7ea1,_0x1fda30){const _0x4b2027=a27_0x4b98,_0x295b45=_0x3a7ea1();while(!![]){try{const _0x26d093=-parseInt(_0x4b2027(0x254))/0x1*(parseInt(_0x4b2027(0x24f))/0x2)+parseInt(_0x4b2027(0x211))/0x3*(-parseInt(_0x4b2027(0x23b))/0x4)+-parseInt(_0x4b2027(0x22c))/0x5+parseInt(_0x4b2027(0x23a))/0x6+parseInt(_0x4b2027(0x1ec))/0x7*(parseInt(_0x4b2027(0x233))/0x8)+parseInt(_0x4b2027(0x213))/0x9+-parseInt(_0x4b2027(0x1ed))/0xa*(parseInt(_0x4b2027(0x212))/0xb);if(_0x26d093===_0x1fda30)break;else _0x295b45['push'](_0x295b45['shift']());}catch(_0x5b9769){_0x295b45['push'](_0x295b45['shift']());}}}(a27_0xf6d1,0xe5b06));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a27_0x3be730 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a27_0x4b98(_0x3163c4,_0x1fd9c4){_0x3163c4=_0x3163c4-0x1eb;const _0xf6d164=a27_0xf6d1();let _0x4b98ff=_0xf6d164[_0x3163c4];return _0x4b98ff;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a27_0xf6d1(){const _0xaf6830=['Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','Default\x20profile\x20set\x20to:\x20','text','Enter\x20site\x20name:','Failed\x20to\x20remove\x20profile:\x20','Removal\x20cancelled','status','\x27\x20created','logLevel','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','710594dlgobT','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20requires\x20API\x20key\x20validation.','/app/mp/ak','Changing\x20site\x20to\x20\x27','1pFMviQ','Set\x20session\x20profile','Enter\x20profile\x20name:','description','parent_segment','tdx:\x20profile\x20create','\x0aOperation\x20cancelled','2807svcttp','10stxsAO','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','llm_agent','config','getUserInfo','Remove\x20a\x20profile','VALID_KEYS','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','select','message','password','\x20\x20tdx\x20--profile\x20','profile:remove','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile','llm_project','email','other','Create\x20a\x20new\x20profile','\x0aAvailable\x20profiles:','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Set\x20a\x20profile\x20configuration\x20value','(cleared)','profile:use','ERROR','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Validating\x20API\x20key...','✗\x20Validation\x20failed:\x20','log','\x27.\x0a\x0aValid\x20keys:\x20','name','validate','red','tdx:\x20profile\x20set','3IBNTPy','3076546FCjODa','15487020syopWq','API\x20key\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','site','\x27\x20removed\x20from\x20configuration','\x20\x20-\x20','join','\x20Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aSetup\x20cancelled','(session:\x20','\x0aSaved\x20to:\x20','Unknown\x20key\x20\x27','create','\x27\x20does\x20not\x20exist.','jobs','length','error','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','dim','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','yellow','confirm','4921580MtGpmy','customSite','includes','apiKey','green','bold','profile:create','26576IAwtgw','Enter\x20your\x20TD\x20API\x20key:','execute','test','Profile\x20\x27','warn','Site\x20was\x20not\x20changed.','4107504QPPNia','4709524VHFsBT','You\x20can\x20find\x20your\x20API\x20key\x20at:','trim','split','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','profileName','us01','\x20\x20(no\x20profiles\x20found)'];a27_0xf6d1=function(){return _0xaf6830;};return a27_0xf6d1();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0x1be068 from'prompts';import a27_0x5e205b from'chalk';function validateProfileName(_0x14d0be){const _0x4cc8de=a27_0x4b98;if(!_0x14d0be||!_0x14d0be['trim']())return _0x4cc8de(0x21b);const _0x5a9327=_0x14d0be[_0x4cc8de(0x23d)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5a9327))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x5a9327))return'Profile\x20\x27'+_0x5a9327+_0x4cc8de(0x203);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x17bd72(0x20d)]=a27_0x17bd72(0x232);[a27_0x17bd72(0x257)]=a27_0x17bd72(0x201);async[a27_0x17bd72(0x235)](_0x21ab08){const _0x314bf2=a27_0x17bd72,{options:_0x492b62,args:_0x459f39}=_0x21ab08;console[_0x314bf2(0x20b)](a27_0x5e205b[_0x314bf2(0x231)](_0x314bf2(0x259)));let _0x36cdd3;if(_0x459f39[_0x314bf2(0x224)]>0x0&&_0x459f39[0x0]){const _0x385847=_0x459f39[0x0][_0x314bf2(0x23d)](),_0x1643d2=validateProfileName(_0x385847);if(_0x1643d2!==!![])return console['error'](a27_0x5e205b[_0x314bf2(0x20f)](_0x1643d2)),0x1;_0x36cdd3=_0x385847;}else{const _0xd5106c=await a27_0x1be068({'type':'text','name':_0x314bf2(0x241),'message':_0x314bf2(0x256),'validate':validateProfileName});if(!_0xd5106c[_0x314bf2(0x241)])return console[_0x314bf2(0x20b)]('\x0aSetup\x20cancelled'),0x1;_0x36cdd3=_0xd5106c[_0x314bf2(0x241)][_0x314bf2(0x23d)]();}const _0x31be5b=await a27_0x1be068({'type':_0x314bf2(0x247),'name':_0x314bf2(0x257),'message':'Enter\x20description\x20(optional):'}),_0x5b2355=_0x31be5b[_0x314bf2(0x257)]?.[_0x314bf2(0x23d)]()||undefined,_0x765b3f=_0x492b62[_0x314bf2(0x216)]||_0x314bf2(0x242),{choices:_0x290a55,initialIndex:_0x4034e2}=buildSiteChoices(_0x765b3f),_0xbe12f3=await a27_0x1be068({'type':_0x314bf2(0x1f7),'name':_0x314bf2(0x216),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x36cdd3+'\x27:','choices':_0x290a55,'initial':_0x4034e2});if(!_0xbe12f3['site'])return console[_0x314bf2(0x20b)](_0x314bf2(0x21d)),0x1;let _0x3bb747;if(_0xbe12f3['site']===_0x314bf2(0x200)){const _0x3da7f7=await a27_0x1be068({'type':_0x314bf2(0x247),'name':_0x314bf2(0x22d),'message':_0x314bf2(0x248),'initial':'us01','validate':_0x3f232e=>{const _0x5b9422=_0x314bf2;if(!_0x3f232e||!_0x3f232e[_0x5b9422(0x23d)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x5b9422(0x236)](_0x3f232e[_0x5b9422(0x23d)]()))return _0x5b9422(0x1fc);return!![];}});if(!_0x3da7f7[_0x314bf2(0x22d)])return console[_0x314bf2(0x20b)]('\x0aSetup\x20cancelled'),0x1;_0x3bb747=_0x3da7f7[_0x314bf2(0x22d)];}else _0x3bb747=_0xbe12f3['site'];const _0x436bd9=resolveSite(_0x3bb747);console[_0x314bf2(0x20b)](_0x314bf2(0x208)+_0x436bd9),console[_0x314bf2(0x20b)](_0x314bf2(0x23c)),console[_0x314bf2(0x20b)]('\x20\x20'+getConsoleUrl(_0x436bd9,'/app/mp/ak'));const _0x51e0c3=await a27_0x1be068({'type':_0x314bf2(0x1f9),'name':'apiKey','message':_0x314bf2(0x234),'validate':_0x482709=>{if(!_0x482709||!_0x482709['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x51e0c3[_0x314bf2(0x22f)])return console[_0x314bf2(0x20b)](_0x314bf2(0x21d)),0x1;const _0x527c07=_0x51e0c3[_0x314bf2(0x22f)];console['log'](_0x314bf2(0x209));try{const _0xae62f8=TDX['create']({'site':_0x436bd9,'apiKey':_0x527c07[_0x314bf2(0x23d)](),'logLevel':_0x492b62[_0x314bf2(0x24d)]??LogLevel[_0x314bf2(0x207)]}),_0x1aa5df=await _0xae62f8[_0x314bf2(0x223)][_0x314bf2(0x1f2)]();console[_0x314bf2(0x20b)](a27_0x5e205b[_0x314bf2(0x230)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x1aa5df[_0x314bf2(0x1ff)]+')');const _0x560ea8=await isKeychainAvailable();_0x560ea8?(await saveAPIKeyAsync(_0x527c07[_0x314bf2(0x23d)](),_0x436bd9,_0x36cdd3),console['log'](a27_0x5e205b[_0x314bf2(0x230)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x36cdd3+')')):(console[_0x314bf2(0x238)](a27_0x5e205b[_0x314bf2(0x22a)](_0x314bf2(0x215))),console['warn'](a27_0x5e205b[_0x314bf2(0x22a)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5ba615={'site':_0x436bd9,..._0x5b2355&&{'description':_0x5b2355}};return saveProfileToUserConfig(_0x36cdd3,_0x5ba615),console[_0x314bf2(0x20b)](a27_0x5e205b['green']('✓')+_0x314bf2(0x21a)+_0x36cdd3+_0x314bf2(0x24c)),console[_0x314bf2(0x20b)](),console[_0x314bf2(0x20b)](_0x314bf2(0x250)),console[_0x314bf2(0x20b)]('\x20\x20tdx\x20--profile\x20'+_0x36cdd3+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x314bf2(0x20b)](_0x314bf2(0x1fa)+_0x36cdd3+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0xb57fa0){if(_0xb57fa0 instanceof HTTPClientError&&_0xb57fa0[_0x314bf2(0x24b)]===0x191)return printAuthError(_0xb57fa0),0x1;return console[_0x314bf2(0x225)](a27_0x5e205b[_0x314bf2(0x20f)](_0x314bf2(0x20a)+(_0xb57fa0 instanceof Error?_0xb57fa0[_0x314bf2(0x1f8)]:String(_0xb57fa0)))),console[_0x314bf2(0x225)](_0x314bf2(0x1ef)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x17bd72(0x20d)]=a27_0x17bd72(0x1fb);[a27_0x17bd72(0x257)]=a27_0x17bd72(0x1f3);[a27_0x17bd72(0x20e)](_0x2a6093){const _0x5a8513=a27_0x17bd72,{args:_0x9c353a}=_0x2a6093;if(_0x9c353a[_0x5a8513(0x224)]===0x0)return _0x5a8513(0x1f6);return undefined;}async[a27_0x17bd72(0x235)](_0x5adbe0){const _0x2998e0=a27_0x17bd72,{args:_0x5a21d9}=_0x5adbe0,_0x4a3fbe=_0x5a21d9[0x0];console[_0x2998e0(0x20b)](a27_0x5e205b[_0x2998e0(0x231)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x4a3fbe)){console[_0x2998e0(0x225)](a27_0x5e205b[_0x2998e0(0x20f)](_0x2998e0(0x237)+_0x4a3fbe+_0x2998e0(0x222))),console['log'](_0x2998e0(0x202));const _0x560681=listProfiles();if(_0x560681[_0x2998e0(0x224)]===0x0)console['log'](_0x2998e0(0x243));else for(const _0x1c0829 of _0x560681){console[_0x2998e0(0x20b)](_0x2998e0(0x218)+_0x1c0829[_0x2998e0(0x20d)]);}return 0x1;}const _0x36d30d=await a27_0x1be068({'type':'confirm','name':_0x2998e0(0x22b),'message':_0x2998e0(0x226)+_0x4a3fbe+'\x27?','initial':![]});if(!_0x36d30d[_0x2998e0(0x22b)])return console[_0x2998e0(0x20b)](_0x2998e0(0x24a)),0x0;try{removeProfileFromUserConfig(_0x4a3fbe),console[_0x2998e0(0x20b)](a27_0x5e205b[_0x2998e0(0x230)]('✓')+_0x2998e0(0x21a)+_0x4a3fbe+_0x2998e0(0x217));}catch(_0x35ecd5){return console[_0x2998e0(0x225)](a27_0x5e205b[_0x2998e0(0x20f)](_0x2998e0(0x249)+(_0x35ecd5 instanceof Error?_0x35ecd5[_0x2998e0(0x1f8)]:String(_0x35ecd5)))),0x1;}const _0x32f838=await isKeychainAvailable();if(_0x32f838){const _0x1cefca=await deleteKeychainAPIKey(_0x4a3fbe);_0x1cefca&&console[_0x2998e0(0x20b)](a27_0x5e205b[_0x2998e0(0x230)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x17bd72(0x20d)]='profile:set';[a27_0x17bd72(0x257)]=a27_0x17bd72(0x204);static ['VALID_KEYS']=[a27_0x17bd72(0x216),a27_0x17bd72(0x245),a27_0x17bd72(0x258),a27_0x17bd72(0x1fe),a27_0x17bd72(0x1f0),a27_0x17bd72(0x257)];['validate'](_0x5a09e2){const _0x51fbf6=a27_0x17bd72,{args:_0x1fec61,options:_0x41219a}=_0x5a09e2,_0x356080=_0x41219a[_0x51fbf6(0x1fd)]||getActiveProfile();if(!_0x356080)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x1fec61[_0x51fbf6(0x224)]===0x0)return _0x51fbf6(0x229)+ProfileSetCommand[_0x51fbf6(0x1f4)]['join'](',\x20');const _0x50a49d=_0x1fec61[0x0];if(!_0x50a49d[_0x51fbf6(0x22e)]('='))return _0x51fbf6(0x244)+ProfileSetCommand[_0x51fbf6(0x1f4)][_0x51fbf6(0x219)](',\x20');const [_0x312c06]=_0x50a49d[_0x51fbf6(0x23e)]('=',0x2);if(!ProfileSetCommand[_0x51fbf6(0x1f4)][_0x51fbf6(0x22e)](_0x312c06))return _0x51fbf6(0x220)+_0x312c06+_0x51fbf6(0x20c)+ProfileSetCommand[_0x51fbf6(0x1f4)]['join'](',\x20');return undefined;}async[a27_0x17bd72(0x235)](_0x19d3a2){const _0x1cbf15=a27_0x17bd72,{args:_0x5955ac,options:_0x546c11}=_0x19d3a2,_0x25592f=_0x546c11[_0x1cbf15(0x1fd)]||getActiveProfile(),[_0x4b6510,..._0x385eeb]=_0x5955ac[0x0][_0x1cbf15(0x23e)]('='),_0x339c65=_0x385eeb[_0x1cbf15(0x219)]('=');console[_0x1cbf15(0x20b)](a27_0x5e205b[_0x1cbf15(0x231)](_0x1cbf15(0x210)));if(!profileExists(_0x25592f)){const _0x456083=await a27_0x1be068({'type':_0x1cbf15(0x22b),'name':_0x1cbf15(0x221),'message':_0x1cbf15(0x237)+_0x25592f+_0x1cbf15(0x21c),'initial':!![]});if(!_0x456083[_0x1cbf15(0x221)])return console[_0x1cbf15(0x20b)]('Operation\x20cancelled'),0x1;}const _0x4e1623=loadProfile(_0x25592f),_0x4d168a=_0x4e1623?.[_0x1cbf15(0x1f1)]||{};if(_0x4b6510===_0x1cbf15(0x216)){const _0x4f020d=resolveSite(_0x339c65);console[_0x1cbf15(0x20b)](_0x1cbf15(0x253)+_0x4f020d+_0x1cbf15(0x251)),console[_0x1cbf15(0x20b)](_0x1cbf15(0x24e)),console['log']('\x20\x20'+getConsoleUrl(_0x4f020d,_0x1cbf15(0x252)));const _0x3b853e=await a27_0x1be068({'type':_0x1cbf15(0x1f9),'name':_0x1cbf15(0x22f),'message':_0x1cbf15(0x227),'validate':_0x5b1d8f=>{const _0x44d8e7=_0x1cbf15;if(!_0x5b1d8f||!_0x5b1d8f[_0x44d8e7(0x23d)]())return _0x44d8e7(0x214);return!![];}});if(!_0x3b853e[_0x1cbf15(0x22f)])return console['log'](_0x1cbf15(0x1eb)),0x1;console['log'](_0x1cbf15(0x209));try{const _0x140875=TDX[_0x1cbf15(0x221)]({'site':_0x4f020d,'apiKey':_0x3b853e[_0x1cbf15(0x22f)][_0x1cbf15(0x23d)](),'logLevel':_0x546c11[_0x1cbf15(0x24d)]??LogLevel[_0x1cbf15(0x207)]}),_0x3318ee=await _0x140875[_0x1cbf15(0x223)][_0x1cbf15(0x1f2)]();console[_0x1cbf15(0x20b)](a27_0x5e205b[_0x1cbf15(0x230)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3318ee[_0x1cbf15(0x1ff)]+')');const _0x23dce3=await isKeychainAvailable();_0x23dce3?(await saveAPIKeyAsync(_0x3b853e['apiKey'][_0x1cbf15(0x23d)](),_0x4f020d,_0x25592f),console[_0x1cbf15(0x20b)](a27_0x5e205b[_0x1cbf15(0x230)]('✓')+_0x1cbf15(0x1ee))):console['warn'](a27_0x5e205b['yellow'](_0x1cbf15(0x215))),_0x4d168a['site']=_0x4f020d;}catch(_0x2e1684){if(_0x2e1684 instanceof HTTPClientError&&_0x2e1684['status']===0x191)return printAuthError(_0x2e1684),0x1;return console[_0x1cbf15(0x225)](a27_0x5e205b[_0x1cbf15(0x20f)](_0x1cbf15(0x20a)+(_0x2e1684 instanceof Error?_0x2e1684[_0x1cbf15(0x1f8)]:String(_0x2e1684)))),console[_0x1cbf15(0x225)](_0x1cbf15(0x239)),0x1;}}else _0x4d168a[_0x4b6510]=_0x339c65||undefined;return saveProfileToUserConfig(_0x25592f,_0x4d168a),console['log'](a27_0x5e205b[_0x1cbf15(0x230)]('✓')+'\x20Profile\x20\x27'+_0x25592f+'\x27\x20updated:\x20'+_0x4b6510+'='+(_0x339c65||_0x1cbf15(0x205))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x17bd72(0x20d)]=a27_0x17bd72(0x206);['description']=a27_0x17bd72(0x255);['validate'](_0x4731d1){const _0x2b58b8=a27_0x17bd72,{args:_0x307596}=_0x4731d1;if(_0x307596[_0x2b58b8(0x224)]===0x0)return _0x2b58b8(0x240);return undefined;}async[a27_0x17bd72(0x235)](_0x95c8b){const _0x422d61=a27_0x17bd72,{args:_0x426212,options:_0x580999}=_0x95c8b,_0x25f12c=_0x426212[0x0],_0x5386ad=_0x580999['default'];cleanExpiredSessions();if(!profileExists(_0x25f12c)){console[_0x422d61(0x225)](a27_0x5e205b[_0x422d61(0x20f)](_0x422d61(0x237)+_0x25f12c+_0x422d61(0x222))),console[_0x422d61(0x20b)](_0x422d61(0x202));const _0x111f66=listProfiles();if(_0x111f66[_0x422d61(0x224)]===0x0)console[_0x422d61(0x20b)](_0x422d61(0x243));else for(const _0x561744 of _0x111f66){console[_0x422d61(0x20b)]('\x20\x20-\x20'+_0x561744['name']);}return 0x1;}if(_0x5386ad){const _0x4e200f=a27_0x3be730['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x25f12c),console[_0x422d61(0x20b)](_0x422d61(0x246)+a27_0x5e205b[_0x422d61(0x230)](_0x25f12c)),console[_0x422d61(0x20b)](a27_0x5e205b[_0x422d61(0x228)](_0x422d61(0x21f)+_0x4e200f)),0x0;}const _0x4a86d9=getSessionID(_0x580999[_0x422d61(0x23f)]);return saveSessionContext({'profile':_0x25f12c},_0x580999[_0x422d61(0x23f)]),console[_0x422d61(0x20b)]('Session\x20profile\x20set\x20to:\x20'+a27_0x5e205b[_0x422d61(0x230)](_0x25f12c)+'\x20'+a27_0x5e205b['dim'](_0x422d61(0x21e)+_0x4a86d9+')')),console['log'](a27_0x5e205b[_0x422d61(0x228)](_0x422d61(0x1f5)+_0x25f12c+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x510876=a28_0x3d35;(function(_0x154502,_0x2a6166){const _0x3a2ffb=a28_0x3d35,_0xb7b19f=_0x154502();while(!![]){try{const _0x408d36=parseInt(_0x3a2ffb(0x1d2))/0x1*(-parseInt(_0x3a2ffb(0x1ca))/0x2)+parseInt(_0x3a2ffb(0x1c5))/0x3*(-parseInt(_0x3a2ffb(0x1cc))/0x4)+parseInt(_0x3a2ffb(0x1d6))/0x5+-parseInt(_0x3a2ffb(0x1ce))/0x6+-parseInt(_0x3a2ffb(0x1c6))/0x7*(-parseInt(_0x3a2ffb(0x1c4))/0x8)+-parseInt(_0x3a2ffb(0x1c7))/0x9+parseInt(_0x3a2ffb(0x1d4))/0xa*(parseInt(_0x3a2ffb(0x1cd))/0xb);if(_0x408d36===_0x2a6166)break;else _0xb7b19f['push'](_0xb7b19f['shift']());}catch(_0x1451c2){_0xb7b19f['push'](_0xb7b19f['shift']());}}}(a28_0x5044,0x8ca39));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x3d35(_0x4eca6f,_0x201024){_0x4eca6f=_0x4eca6f-0x1c2;const _0x5044b7=a28_0x5044();let _0x3d3504=_0x5044b7[_0x4eca6f];return _0x3d3504;}function a28_0x5044(){const _0x2d209b=['281518yjQVjZ','length','52WvnyTL','95832XWbwzV','3354738XSSdKV','config','name','\x20\x20Global:\x20~/.config/tdx/tdx.json','1aCWXDy','message','300FDnmvD','execute','3330860lPSSfO','Error:\x20','log','error','8KKtCKa','6429Wdjwnr','5822558lNtzaX','4099752qJFkPD','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','profiles'];a28_0x5044=function(){return _0x2d209b;};return a28_0x5044();}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x510876(0x1d0)]=a28_0x510876(0x1c9);['description']='List\x20all\x20available\x20profiles';async[a28_0x510876(0x1d5)](_0x54f8e9){const _0x5d6e78=a28_0x510876,{options:_0x54adec}=_0x54f8e9;try{const _0x4a6818=listProfiles(),_0x3324a6=getActiveProfile();if(_0x4a6818[_0x5d6e78(0x1cb)]===0x0)return console[_0x5d6e78(0x1c2)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x5d6e78(0x1c2)](_0x5d6e78(0x1c8)),console[_0x5d6e78(0x1c2)](_0x5d6e78(0x1d1)),0x0;const _0x292725=_0x4a6818['map'](_0x3d1c59=>{const _0x4a6e3d=_0x5d6e78,_0x261c10=_0x3d1c59[_0x4a6e3d(0x1d0)]===_0x3324a6,_0x410846=getProfileParams(_0x3d1c59[_0x4a6e3d(0x1cf)]);return{'name':_0x3d1c59['name'],'active':_0x261c10,'scope':_0x3d1c59['scope'],'description':_0x3d1c59['config']['description']||'','params':_0x410846};});return await handleSDKOutput(_0x292725,_0x54adec),0x0;}catch(_0x373adc){return _0x373adc instanceof Error&&console[_0x5d6e78(0x1c3)](_0x5d6e78(0x1d7)+_0x373adc[_0x5d6e78(0x1d3)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x12ce12=a29_0x3761;(function(_0x2fc24e,_0x24172e){const _0x11f327=a29_0x3761,_0x3e0c01=_0x2fc24e();while(!![]){try{const _0x495d81=-parseInt(_0x11f327(0x1c2))/0x1*(parseInt(_0x11f327(0x1ed))/0x2)+-parseInt(_0x11f327(0x1e4))/0x3+parseInt(_0x11f327(0x1e5))/0x4+-parseInt(_0x11f327(0x1c4))/0x5*(-parseInt(_0x11f327(0x1c6))/0x6)+parseInt(_0x11f327(0x1ee))/0x7+parseInt(_0x11f327(0x1de))/0x8+-parseInt(_0x11f327(0x1d8))/0x9;if(_0x495d81===_0x24172e)break;else _0x3e0c01['push'](_0x3e0c01['shift']());}catch(_0x9c88b7){_0x3e0c01['push'](_0x3e0c01['shift']());}}}(a29_0x4046,0xa4687));import{BaseCommand}from'./command.js';function a29_0x3761(_0x5bfbb2,_0x231092){_0x5bfbb2=_0x5bfbb2-0x1be;const _0x404661=a29_0x4046();let _0x3761de=_0x404661[_0x5bfbb2];return _0x3761de;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a29_0x4046(){const _0x54f9eb=['join','length','push','options','error','completedSplits','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','\x20rows\x20','output','12696813ZkhOny','totalSplits','verbose','Query\x20completed:\x20Processed\x20','SQL:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','2967440cHudqt','information_schema','file','name','Run\x20Trino\x20queries\x20(streaming)','Error:\x20','2799867sJehtH','4276148CQvVzr','setJobId','stats','processedRows','No\x20SQL\x20provided','message','validate','setExtra','4nTyEaa','9223571YFiHCk','catalog','\x20splits','site','database','Statement\x20','27112StbJuX','originalMessage','13655tPZUyz','args','690tSwHfN','query','state','execute','...','jobId','Catalog:\x20','Executing\x20query\x20[','in\x20'];a29_0x4046=function(){return _0x54f9eb;};return a29_0x4046();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x12ce12(0x1e1)]=a29_0x12ce12(0x1c7);['description']=a29_0x12ce12(0x1e2);async[a29_0x12ce12(0x1c9)](_0x2db055){const _0x58814a=a29_0x12ce12,{options:_0x203e09,args:_0x1be02f,tdx:_0xab1e05}=_0x2db055,_0x2322bd=_0x1be02f[0x0],_0x1f5ebb=_0x203e09[_0x58814a(0x1e0)];let _0x52f994;try{if(_0x1f5ebb)_0x52f994=readSqlStatementsFromFile(_0x1f5ebb);else{if(_0x2322bd==='-')_0x52f994=await readSqlStatementsFromStdin();else{if(_0x2322bd&&isSqlFilePath(_0x2322bd))_0x52f994=readSqlStatementsFromFile(_0x2322bd);else{if(_0x2322bd)_0x52f994=splitSqlStatements(_0x2322bd);else throw new Error(_0x58814a(0x1e9));}}}}catch(_0x31f26c){return console[_0x58814a(0x1d3)](_0x58814a(0x1e3)+_0x31f26c['message']),0x1;}const _0x324f10=_0x203e09[_0x58814a(0x1c0)]||_0x58814a(0x1df),_0x5abd4b=_0x203e09[_0x58814a(0x1ef)];try{const _0x52545d=[],_0x33ea75=!!_0x203e09[_0x58814a(0x1d7)];for(let _0x3f64c=0x0;_0x3f64c<_0x52f994['length'];_0x3f64c++){const _0x486a7a=_0x52f994[_0x3f64c],_0x5675db=_0x3f64c+0x1,_0x43a3a3=_0x52f994['length'],_0x30ce92=_0x43a3a3>0x1;_0x203e09[_0x58814a(0x1da)]&&(console['error']('\x0a'+(_0x30ce92?'Statement\x20'+_0x5675db+'/'+_0x43a3a3+':':'')),console[_0x58814a(0x1d3)]('Site:\x20'+_0x203e09[_0x58814a(0x1bf)]),console[_0x58814a(0x1d3)](_0x58814a(0x1cc)+(_0x5abd4b||'td')),console[_0x58814a(0x1d3)]('Schema:\x20'+_0x324f10),console[_0x58814a(0x1d3)](_0x58814a(0x1dc)+_0x486a7a));const _0x4e7e22=_0x30ce92?'Executing\x20statement\x20'+_0x5675db+'/'+_0x43a3a3+_0x58814a(0x1ca):'Executing\x20query...';try{const _0x1424e9=await withProgressSpinner(_0x4e7e22,async _0x2e71ce=>{const _0x47470c=_0x58814a,_0x569335=await _0xab1e05[_0x47470c(0x1c7)][_0x47470c(0x1c9)](_0x486a7a,{'catalog':_0x5abd4b,'schema':_0x324f10,'onJobId':_0x5ad66f=>{const _0x570fab=_0x47470c;_0x2e71ce[_0x570fab(0x1e6)](_0x5ad66f);},'onProgress':_0x205da9=>{const _0x26d036=_0x47470c;_0x2e71ce['setPhase'](_0x26d036(0x1cd)+_0x205da9[_0x26d036(0x1c8)]+']'),_0x2e71ce[_0x26d036(0x1ec)](formatRows(_0x205da9[_0x26d036(0x1e8)])+_0x26d036(0x1d6)+_0x205da9[_0x26d036(0x1d4)]+'/'+_0x205da9[_0x26d036(0x1d9)]+_0x26d036(0x1be));}});return _0x569335;},{'verbose':_0x203e09['verbose']}),_0x236a2e=_0x1424e9['data'],_0x9278f7=_0x236a2e[_0x58814a(0x1cb)]?'\x20[Job\x20ID:\x20'+_0x236a2e[_0x58814a(0x1cb)]+']':'',_0x43ba78=_0x30ce92?_0x58814a(0x1c1)+_0x5675db+'/'+_0x43a3a3+'\x20-\x20':'';console[_0x58814a(0x1d3)]('✔\x20'+_0x43ba78+_0x58814a(0x1db)+formatRows(_0x236a2e['stats'][_0x58814a(0x1e8)])+_0x58814a(0x1d6)+(_0x58814a(0x1ce)+formatElapsed(_0x236a2e[_0x58814a(0x1e7)]['elapsedTimeMillis'])+_0x9278f7));if(_0x30ce92&&_0x33ea75){const _0x266d42=resolveOutputOptions(_0x203e09),_0x45b8e8=await formatQueryOutput(_0x236a2e,_0x266d42);_0x52545d[_0x58814a(0x1d1)](_0x45b8e8);}else await handleQueryOutput(_0x236a2e,_0x203e09);}catch(_0x2dc6ec){const _0x4df119=_0x30ce92?_0x58814a(0x1c1)+_0x5675db+'/'+_0x43a3a3+':\x0a':'',_0x584919=_0x2dc6ec instanceof SDKError?_0x2dc6ec[_0x58814a(0x1c3)]:_0x2dc6ec[_0x58814a(0x1ea)];return console[_0x58814a(0x1d3)](''+_0x4df119+_0x584919),0x1;}}if(_0x52f994['length']>0x1&&_0x33ea75&&_0x52545d[_0x58814a(0x1d0)]>0x0){const _0xfd489=_0x52545d[_0x58814a(0x1cf)]('\x0a');writeFileSync(_0x203e09[_0x58814a(0x1d7)],_0xfd489),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x203e09['output']);}return 0x0;}catch(_0x1b28b4){throw _0x1b28b4;}}[a29_0x12ce12(0x1eb)](_0x4edb41){const _0x2d37fd=a29_0x12ce12,_0x3bd543=_0x4edb41[_0x2d37fd(0x1c5)][0x0],_0x2deb16=_0x4edb41[_0x2d37fd(0x1d2)]['file'];if(!_0x3bd543&&!_0x2deb16)return _0x2d37fd(0x1d5);if(_0x3bd543&&_0x2deb16)return _0x2d37fd(0x1dd);return undefined;}}
|