@treasuredata/tdx 2026.3.15 → 2026.3.16
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/README.md +9 -0
- 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/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/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/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-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/oauth-keychain.js +1 -1
- package/dist/core/oauth.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/oauth-refresh.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/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-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/types/template-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/paginate.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.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x4fc0d8=a30_0x1520;(function(_0x28b4d2,_0x4c0e1b){const _0xec60e1=a30_0x1520,_0x2a4e9d=_0x28b4d2();while(!![]){try{const _0x2881e6=-parseInt(_0xec60e1(0x22a))/0x1*(parseInt(_0xec60e1(0x111))/0x2)+-parseInt(_0xec60e1(0x16c))/0x3*(-parseInt(_0xec60e1(0x1af))/0x4)+parseInt(_0xec60e1(0x13a))/0x5*(-parseInt(_0xec60e1(0x1f6))/0x6)+parseInt(_0xec60e1(0x1a7))/0x7*(parseInt(_0xec60e1(0x164))/0x8)+-parseInt(_0xec60e1(0xcc))/0x9+-parseInt(_0xec60e1(0x1fa))/0xa*(-parseInt(_0xec60e1(0x127))/0xb)+parseInt(_0xec60e1(0xe6))/0xc;if(_0x2881e6===_0x4c0e1b)break;else _0x2a4e9d['push'](_0x2a4e9d['shift']());}catch(_0x34c3d6){_0x2a4e9d['push'](_0x2a4e9d['shift']());}}}(a30_0x2f93,0x54cb3));function a30_0x2f93(){const _0x58c46f=['last_page_viewed','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','segment','td_client_id','Columns:','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','workflowId','test','\x20parent\x20segment\x20\x27','\x0a\x20\x20\x20\x20}','Validating\x20configuration...','behavior','schemaError','trim','cyan','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20Context\x20set:\x20','\x20tdx\x20wf\x20attempt\x20','tdx\x20ps\x20push\x20','To\x20view\x20sample\x20data:','toLowerCase','Show\x20parent\x20segment\x20schema\x20(column\x20types)','stitchingKeys','\x20\x20Database:\x20','true','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','displayRealtimeInfo','Attributes:','getParentFull','foreignKey','joinKey','\x20--interval\x20','Updating\x20parent\x20segment\x20\x27','Available\x20attributes:','match','ps:rt:list','Listing\x20parent\x20segments\x20matching\x20\x27','behaviors','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20Added\x20RT\x202.0\x20template\x20section','Error:\x20--attribute\x20requires\x20a\x20name\x0a','xdg-open','\x0a⚠️\x20\x20Both\x20','Validating\x20RT\x20configuration...','push','\x27\x20with\x20ID:\x20','sourceTableError','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','stop','user_id','/app/dw/parentSegments/','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','sampleData','status','Database:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','limit','⚡\x20Not\x20enabled','Apply\x20changes\x20to\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','database','setJobId','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20\x20Tables:\x201\x20customers\x20+\x20','displayPreviewHints','✔\x20Found\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','number','6bYbWnY','\x20configured','\x20section','\x0aNo\x20sample\x20data\x20available','375420FkNxkC','customerPercent','listParents','Error\x20reading\x20file:\x20','session','data','Table:\x20','rowCount','List\x20available\x20fields\x20for\x20segmentation','Create\x20parent\x20segment\x20\x27','open','use','\x20=\x20','/\x20→\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','Updating','customers','timezone','allValid','\x0a✔\x20Workflow\x20started','Error:\x20File\x20not\x20found:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','realtime','list','workflowAttemptId','Error:','Preview:','behavior_','Join\x20on:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','toLocaleString','sort','scheduleType','Error:\x20--database\x20and\x20--table\x20are\x20required','Master\x20+\x20Attributes','personalization','customersWithEvents','\x20parent\x20segment','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','dirname','attributes','Fetching\x20sample\x20data...','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Pattern:\x20','attributesFile','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','1wxjbzf','workflowSessionId','\x0aError:','RT\x202.0:','site','column_type','toFixed','sections','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','.yaml','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20field','Validate:','displaySummary','text','jobId','formatSchemaJson','Errors:','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:show','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','segment:parent:push','/\x20directory.\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','Master\x20Table','validateParentYaml','/attempt/','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','displayMasterInfo','Status:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isDirectory','Fetching\x20parent\x20segment\x20\x27','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','string','enabled','yellow','ps:pz:init','description','web','segment:parent:pull','/sessions/','getParentSQL','Source:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Resolving\x20parent\x20segment\x20\x27','Join:','Next\x20steps:','Options:','✔\x20Query\x20completed:\x20Processed\x20','bold','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','unref','\x20is\x20already\x20up\x20to\x20date','varchar','Session:','Listing\x20personalization\x20services\x20for\x20\x27','1311570WXvOZq','getOutputDatabaseName','\x20rows\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Error\x20parsing\x20YAML:\x20','addBehaviorsFile','length','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\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','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Options:\x0a','.customers)','Enriched:','%)\x20','idStitching','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','in\x20','stats','✔\x20Renamed\x20directory\x20to\x20','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','output','\x0a\x20\x20\x20\x20]','Show\x20parent\x20segment\x20details','\x20\x20No\x20sample\x20data\x20available','SQL\x20query:\x0a','7301400tCrfuI','FINISHED','attribute','log','Personalization\x20service\x20description','\x22,\x20\x22type\x22:\x20\x22','displayColumns','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','-1d','trigger_event','primaryKey','all','\x27...','format','/\x20and\x20','Behavior:','Aborted.','segment:parent:preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','execute','errors','valid','Attributes','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20--behavior\x20\x22<name>\x22','label','start','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Events:','interval','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x5c$&','repeat','\x0a\x20\x20]\x0a}\x0a','\x20personalization\x20service','red','List\x20parent\x20segments','\x20\x20\x20\x20','customerGroup','\x27\x20is\x20already\x20up\x20to\x20date','1354946PuABFb','\x22\x20}','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','schemaValid','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20--behavior\x20\x22','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','segment:parent:create','\x20to\x20configure\x20your\x20personalization\x20service','message','\x20behaviors','getBehaviorNames','run','createParent','segment:parent:validate','Analyzing\x20changes...','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','win32','55oGkCHv','Creating\x20parent\x20segment\x20\x27','Overwrite\x20\x27','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','single','addAttributesFile','ID\x20Stitching:','✔\x20No\x20changes\x20-\x20\x27','apply','replace','json','population','To\x20cancel:','localeCompare','verbose','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Coverage:','columns','773960cjEEhl','Behaviors','column_name','\x20+\x20[','map','Rows:','Executing\x20parent\x20segment\x20query...','Fetching\x20SQL\x20for\x20\x27','My\x20Service','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\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','parentSegment','\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','events','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:run','realtime:','endsWith','scheduleOption','Master:','\x20--attribute\x20\x22<name>\x22','\x20\x20\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','collectSchema','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','pushParentYaml','type','Personalization:','parent_segments','\x0a⚠️\x20\x20Migrating:\x20','`\x20to\x20download\x20the\x20configuration\x20first','column','resolveParentId','No\x20personalization\x20services\x20configured','\x20\x202.\x20Run\x20','ps:pz:list','dim','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20is\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','tdx\x20ps\x20preview\x20','8khPdow','behaviorsFile','personalizationServices','utf-8','page_view','displaySampleData','Fetching\x20customers\x20schema...','green','1527753cUWehM','elapsedTimeMillis','\x20rows)','SELECT\x20*\x20FROM\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Fetching\x20behavior\x20list...','displayAttributesStats','listFields','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','totalEvents','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','displayBehaviorsStats','pullParentYaml','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','runParent','<database>.<table>','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20[Job\x20ID:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','using\x20the\x20default\x20path:\x20','personalization_services','parent_segment','segment:parent:sql','double','segment:parent:list','error','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Name:\x20','Created','Updated','\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','jsonl','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','Creating','updateParent','\x20\x20\x20\x20-\x20','master','\x20service(s)\x20configured','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Parent\x20segment:\x20','\x20\x20Columns:\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','processedRows','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','matchedCount','\x20--attribute\x20\x22','Output\x20file:\x20','displayPreviewResults','table','Attribute:','name','join','\x20service','coveragePercent','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','139293bexPAm','query','yes','enriched','\x20to\x20push\x20the\x20configuration','\x20--enriched','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','.yml','4qkhYGm','filter','\x20RT-enabled\x20parent\x20segment'];a30_0x2f93=function(){return _0x58c46f;};return a30_0x2f93();}import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x33c29c 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 a30_0x51421d 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=a30_0x4fc0d8(0x157),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x505fe9){const _0x2eb484=a30_0x4fc0d8,_0x413c8b=process['platform'],_0x44152d=_0x413c8b==='darwin'?_0x2eb484(0x204):_0x413c8b===_0x2eb484(0x126)?_0x2eb484(0x101):_0x2eb484(0x1db);spawn(_0x44152d,[_0x505fe9],{'detached':!![],'stdio':'ignore'})[_0x2eb484(0xc7)]();}function migrateLegacyDirectory(){const _0x5d63af=a30_0x4fc0d8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x10d0c0=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x10d0c0[_0x5d63af(0x249)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5d63af(0x187)](a30_0x51421d[_0x5d63af(0x24f)](_0x5d63af(0x1dc)+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0xf5)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console['error'](a30_0x51421d[_0x5d63af(0x15f)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0x240))),![];console['error'](a30_0x51421d[_0x5d63af(0x24f)](_0x5d63af(0x158)+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0x207)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5d63af(0x187)](a30_0x51421d['green'](_0x5d63af(0xde)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3b2673){const _0x477e11=_0x3b2673 instanceof Error?_0x3b2673[_0x5d63af(0x11d)]:String(_0x3b2673);return console[_0x5d63af(0x187)](a30_0x51421d[_0x5d63af(0x10c)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x477e11+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x4fc0d8(0x120)](_0x9f8ba1){const _0x144208=a30_0x4fc0d8;return migrateLegacyDirectory(),super[_0x144208(0x120)](_0x9f8ba1);}}function resolveYamlFile(_0x2102a2){const _0x3f3298=a30_0x4fc0d8;if(_0x2102a2[_0x3f3298(0x14c)](_0x3f3298(0x1ae))||_0x2102a2[_0x3f3298(0x14c)](_0x3f3298(0x233)))return _0x2102a2;return a30_0x33c29c[_0x3f3298(0x1a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2102a2)+'.yml');}function formatProgressMessage(_0x46a108){const _0x25b690=a30_0x4fc0d8,_0x2822cd=_0x46a108[_0x25b690(0x1d4)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2822cd){const [,_0x1df558,_0x1b75c0,_0x24b2e0='']=_0x2822cd;return a30_0x51421d[_0x25b690(0x15f)](_0x1df558+':')+'\x20'+_0x1b75c0+a30_0x51421d[_0x25b690(0x15f)](_0x24b2e0);}return a30_0x51421d['dim'](_0x46a108);}function showFileNotFoundError(_0x30f059,_0x503029){const _0x2b490c=a30_0x4fc0d8;console[_0x2b490c(0x187)](a30_0x51421d['red'](_0x2b490c(0x20e)+_0x30f059+'\x0a')),console[_0x2b490c(0x187)](a30_0x51421d['cyan'](_0x2b490c(0x148)+_0x503029+_0x2b490c(0x159)));}function displayRealtimeValidation(_0x2da837){const _0x10ca55=a30_0x4fc0d8;if(!_0x2da837[_0x10ca55(0x212)])return;const _0x2dc92c=_0x2da837[_0x10ca55(0x212)],_0x62e86d=_0x2dc92c[_0x10ca55(0x24e)]?a30_0x51421d[_0x10ca55(0x16b)]('⚡\x20Enabled'):a30_0x51421d[_0x10ca55(0x24f)](_0x10ca55(0x1eb));console[_0x10ca55(0x187)]('\x0a'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x22d))+'\x20'+_0x62e86d);if(_0x2dc92c[_0x10ca55(0x147)]&&_0x2dc92c[_0x10ca55(0x147)]['length']>0x0){console['error']('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x105))+'\x20'+_0x2dc92c[_0x10ca55(0x147)][_0x10ca55(0xd2)]+_0x10ca55(0x1f7));for(const _0x154a59 of _0x2dc92c[_0x10ca55(0x147)]){const _0x41dcb3=_0x154a59['sourceTableValid']===![]?a30_0x51421d[_0x10ca55(0x10c)]('✘'):a30_0x51421d['green']('✔');console[_0x10ca55(0x187)](_0x10ca55(0x10e)+_0x41dcb3+'\x20'+_0x154a59[_0x10ca55(0x1a2)]),_0x154a59['sourceTableError']&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0x51421d['red'](_0x154a59[_0x10ca55(0x1e0)]));}}if(_0x2dc92c['attributes']&&_0x2dc92c[_0x10ca55(0x224)]['length']>0x0){console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x1cd))+'\x20'+_0x2dc92c['attributes'][_0x10ca55(0xd2)]+_0x10ca55(0x1f7));for(const _0x414833 of _0x2dc92c[_0x10ca55(0x224)]){const _0x489286=_0x414833[_0x10ca55(0xfc)]?a30_0x51421d['green']('✔'):a30_0x51421d[_0x10ca55(0x10c)]('✘');console[_0x10ca55(0x187)](_0x10ca55(0x10e)+_0x489286+'\x20'+_0x414833[_0x10ca55(0x1a2)]+'\x20'+a30_0x51421d[_0x10ca55(0x15f)]('('+_0x414833[_0x10ca55(0x155)]+')'));}}if(_0x2dc92c[_0x10ca55(0xda)]){const _0x513e70=_0x2dc92c[_0x10ca55(0xda)]['stitchingKeys']?.['length']?_0x10ca55(0x13d)+_0x2dc92c[_0x10ca55(0xda)][_0x10ca55(0x1c8)][_0x10ca55(0x1a3)](',\x20')+']':'';console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x12e))+'\x20'+_0x2dc92c[_0x10ca55(0xda)][_0x10ca55(0xf1)]+_0x513e70);}if(_0x2dc92c[_0x10ca55(0x166)]&&_0x2dc92c[_0x10ca55(0x166)][_0x10ca55(0xd2)]>0x0){console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x156))+'\x20'+_0x2dc92c[_0x10ca55(0x166)][_0x10ca55(0xd2)]+_0x10ca55(0x1a4)+(_0x2dc92c['personalizationServices'][_0x10ca55(0xd2)]!==0x1?'s':''));for(const _0x1f749f of _0x2dc92c[_0x10ca55(0x166)]){console[_0x10ca55(0x187)](_0x10ca55(0x193)+_0x1f749f['name']);}}}function showParentSegmentNotSetError(_0x3fbf3e){const _0x2ac8e6=a30_0x4fc0d8;console[_0x2ac8e6(0x187)](a30_0x51421d[_0x2ac8e6(0x24f)](_0x2ac8e6(0x17c))),console[_0x2ac8e6(0x187)](_0x3fbf3e);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x186);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x10d);async[a30_0x4fc0d8(0xfa)](_0x2f84a5){const _0x38cfde=a30_0x4fc0d8,{options:_0x409c76,args:_0x5170bc,tdx:_0x562aff}=_0x2f84a5,_0xdbe10a=_0x5170bc[0x0];_0x409c76[_0x38cfde(0x136)]&&(console[_0x38cfde(0x187)]('Site:\x20'+_0x409c76[_0x38cfde(0x22e)]),_0xdbe10a&&console[_0x38cfde(0x187)](_0x38cfde(0x227)+_0xdbe10a));const _0x4c95f3=await withSpinner(_0xdbe10a?_0x38cfde(0x1d6)+_0xdbe10a+_0x38cfde(0xf3):'Listing\x20parent\x20segments...',()=>_0x562aff[_0x38cfde(0x1b4)][_0x38cfde(0x1fc)](),{'verbose':_0x409c76[_0x38cfde(0x136)]});let _0x569d00=_0x4c95f3[_0x38cfde(0x1ff)];if(_0xdbe10a){const _0x57d688=_0xdbe10a[_0x38cfde(0x131)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x38cfde(0x131)](/\*/g,'.*')[_0x38cfde(0x131)](/\?/g,'.'),_0x55c140=new RegExp('^'+_0x57d688+'$','i');_0x569d00=_0x569d00['filter'](_0x3b65a3=>_0x55c140[_0x38cfde(0x1b9)](_0x3b65a3['attributes'][_0x38cfde(0x1a2)]));}_0x569d00[_0x38cfde(0x21b)]((_0x5efc60,_0x5e1a0e)=>_0x5efc60[_0x38cfde(0x224)][_0x38cfde(0x1a2)][_0x38cfde(0x135)](_0x5e1a0e[_0x38cfde(0x224)]['name'])),console[_0x38cfde(0x187)](_0x38cfde(0x1f3)+_0x569d00['length']+_0x38cfde(0x221)+(_0x569d00[_0x38cfde(0xd2)]!==0x1?'s':''));const _0x43f2fe=_0x2f6773=>{const _0x1eaa57=_0x38cfde;return getConsoleNextUrl(_0x409c76['site'],_0x1eaa57(0x1e4)+_0x2f6773);};if(_0x409c76[_0x38cfde(0xf4)]===_0x38cfde(0x132)||_0x409c76[_0x38cfde(0xf4)]==='jsonl'){const _0x36f9c1=_0x569d00[_0x38cfde(0x13e)](_0x199d6f=>({..._0x199d6f,'url':_0x43f2fe(_0x199d6f['id'])}));await handleSDKOutput(_0x36f9c1,_0x409c76);}else{if(_0x569d00[_0x38cfde(0xd2)]===0x0)_0xdbe10a?console['log'](_0x38cfde(0x114)+_0xdbe10a):console[_0x38cfde(0xe9)]('No\x20parent\x20segments\x20found');else for(const _0x18ce3d of _0x569d00){const _0x3e687f=_0x18ce3d[_0x38cfde(0x224)]['population']?a30_0x51421d[_0x38cfde(0x15f)]('\x20('+formatRows(_0x18ce3d[_0x38cfde(0x224)][_0x38cfde(0x133)])+')'):'',_0x309f6d=hyperlink(_0x18ce3d[_0x38cfde(0x224)]['name'],_0x43f2fe(_0x18ce3d['id']));console['log']('👥\x20'+_0x309f6d+_0x3e687f);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x11b);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x20f);async[a30_0x4fc0d8(0xfa)](_0x1b672b){const _0x3fbd01=a30_0x4fc0d8,{options:_0x16e98e,args:_0x1b5d79,tdx:_0x331b72}=_0x1b672b;console['error'](_0x3fbd01(0x1f4)+_0x3fbd01(0x1cb)+_0x3fbd01(0x174));const _0xcd166b=_0x16e98e;if(_0x1b5d79[_0x3fbd01(0xd2)]===0x0)return console[_0x3fbd01(0x187)](a30_0x51421d[_0x3fbd01(0x10c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3fbd01(0x187)](_0x3fbd01(0x118)),0x1;const _0x15b5b5=_0x1b5d79[0x0];if(!_0xcd166b[_0x3fbd01(0x1ee)]||!_0xcd166b[_0x3fbd01(0x1a0)])return console[_0x3fbd01(0x187)](_0x3fbd01(0x21d)),console[_0x3fbd01(0x187)](_0x3fbd01(0x118)),0x1;_0xcd166b[_0x3fbd01(0x136)]&&(console[_0x3fbd01(0x187)]('Site:\x20'+_0xcd166b['site']),console[_0x3fbd01(0x187)](_0x3fbd01(0x18a)+_0x15b5b5),console[_0x3fbd01(0x187)](_0x3fbd01(0x1e8)+_0xcd166b[_0x3fbd01(0x1ee)]),console[_0x3fbd01(0x187)](_0x3fbd01(0x200)+_0xcd166b[_0x3fbd01(0x1a0)]));const _0x52f0fb=await loadJSONFromOptions(_0xcd166b['attributes'],_0xcd166b[_0x3fbd01(0x228)]),_0x411aa7=await loadJSONFromOptions(_0xcd166b[_0x3fbd01(0x1d7)],_0xcd166b[_0x3fbd01(0x165)]),_0xf5efa8=await loadJSONFromOptions(_0xcd166b[_0x3fbd01(0x10f)],_0xcd166b['customerGroupFile']),_0x2e2e5e={'name':_0x15b5b5,'description':_0xcd166b['description'],'scheduleType':_0xcd166b[_0x3fbd01(0x21c)],'scheduleOption':_0xcd166b[_0x3fbd01(0x14d)],'timezone':_0xcd166b['timezone'],'master':{'parentDatabaseName':_0xcd166b[_0x3fbd01(0x1ee)],'parentTableName':_0xcd166b['table']},'attributes':_0x52f0fb,'behaviors':_0x411aa7,'customerGroup':_0xf5efa8},_0x120e37=await withSpinner(_0x3fbd01(0x128)+_0x15b5b5+_0x3fbd01(0xf3),()=>_0x331b72[_0x3fbd01(0x1b4)][_0x3fbd01(0x121)](_0x2e2e5e),{'verbose':_0x16e98e[_0x3fbd01(0x136)]}),_0x338117=_0x120e37[_0x3fbd01(0x1ff)];return console[_0x3fbd01(0x187)](_0x3fbd01(0x149)+_0x338117[_0x3fbd01(0x1a2)]+_0x3fbd01(0x1df)+_0x338117['id']),await handleSDKOutput([_0x338117],_0x16e98e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]='segment:parent:update';[a30_0x4fc0d8(0x251)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a30_0x4fc0d8(0xfa)](_0xa98306){const _0x68fa62=a30_0x4fc0d8,{options:_0xda60e3,args:_0x4ce5ea,tdx:_0x4fcb54}=_0xa98306;console[_0x68fa62(0x187)](_0x68fa62(0x219)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x68fa62(0x174));const _0x514e17=_0xda60e3;if(_0x4ce5ea['length']===0x0)return console['error'](a30_0x51421d[_0x68fa62(0x10c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x68fa62(0x19b)),0x1;const _0x396346=_0x4ce5ea[0x0];_0x514e17[_0x68fa62(0x136)]&&(console[_0x68fa62(0x187)](_0x68fa62(0x17f)+_0x514e17['site']),console[_0x68fa62(0x187)](_0x68fa62(0x197)+_0x396346));const _0x1eadbd=await withSpinner(_0x68fa62(0x17e)+_0x396346+'\x27...',()=>_0x4fcb54[_0x68fa62(0x1b4)]['getParentFull'](_0x396346),{'verbose':_0x514e17[_0x68fa62(0x136)]}),_0x428b71=_0x1eadbd[_0x68fa62(0x1ff)],_0x27d538=await loadJSONFromOptions(_0x514e17['addAttributes'],_0x514e17[_0x68fa62(0x12d)]),_0x3d27f7=await loadJSONFromOptions(_0x514e17['addBehaviors'],_0x514e17[_0x68fa62(0xd1)]),_0x5130ff={'name':_0x428b71[_0x68fa62(0x1a2)],'description':_0x514e17[_0x68fa62(0x251)]!==undefined?_0x514e17[_0x68fa62(0x251)]:_0x428b71[_0x68fa62(0x251)],'scheduleType':_0x514e17[_0x68fa62(0x21c)]!==undefined?_0x514e17[_0x68fa62(0x21c)]:_0x428b71['scheduleType'],'scheduleOption':_0x514e17['scheduleOption']!==undefined?_0x514e17[_0x68fa62(0x14d)]:_0x428b71['scheduleOption'],'timezone':_0x514e17['timezone']!==undefined?_0x514e17[_0x68fa62(0x20b)]:_0x428b71[_0x68fa62(0x20b)],'master':_0x428b71['master'],'attributes':_0x27d538?[..._0x428b71[_0x68fa62(0x224)]||[],..._0x27d538]:_0x428b71[_0x68fa62(0x224)],'behaviors':_0x3d27f7?[..._0x428b71[_0x68fa62(0x1d7)]||[],..._0x3d27f7]:_0x428b71['behaviors'],'customerGroup':_0x428b71[_0x68fa62(0x10f)]},_0x39510f=await withSpinner(_0x68fa62(0x1d2)+_0x396346+'\x27...',()=>_0x4fcb54['segment'][_0x68fa62(0x192)](_0x396346,_0x5130ff),{'verbose':_0x514e17['verbose']}),_0x5f08ee=_0x39510f[_0x68fa62(0x1ff)];return console['error'](_0x68fa62(0x241)+_0x5f08ee[_0x68fa62(0x1a2)]+'\x27'),await handleSDKOutput([_0x5f08ee],_0x514e17),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x253);['description']=a30_0x4fc0d8(0x196);async[a30_0x4fc0d8(0xfa)](_0x44f144){const _0x27ccb8=a30_0x4fc0d8,{options:_0x2b9f6f,args:_0x13e630,tdx:_0x327e16}=_0x44f144,_0x585c13=_0x2b9f6f,_0x2f70b3=_0x13e630[0x0]||_0x2b9f6f[_0x27ccb8(0x145)];if(!_0x2f70b3)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(_0x585c13[_0x27ccb8(0x205)]&&_0x585c13[_0x27ccb8(0xe1)])return console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x10c)](_0x27ccb8(0x1ad))),console[_0x27ccb8(0x187)](a30_0x51421d['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x15f)](_0x27ccb8(0x181)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a30_0x51421d[_0x27ccb8(0x1c0)](_0x27ccb8(0x107))),0x1;const _0x4c88b1=_0x585c13[_0x27ccb8(0xe1)]||a30_0x33c29c[_0x27ccb8(0x1a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2f70b3)+'.yml');_0x585c13[_0x27ccb8(0x136)]&&(console[_0x27ccb8(0x187)](_0x27ccb8(0x17f)+_0x585c13['site']),console[_0x27ccb8(0x187)](_0x27ccb8(0x197)+_0x2f70b3),console['error'](_0x27ccb8(0x19e)+_0x4c88b1));const _0x43ebfa=await withSpinner(_0x27ccb8(0x24a)+_0x2f70b3+_0x27ccb8(0xf3),()=>_0x327e16[_0x27ccb8(0x1b4)][_0x27ccb8(0x178)](_0x2f70b3),{'verbose':_0x585c13[_0x27ccb8(0x136)]}),_0x3e0239=_0x43ebfa[_0x27ccb8(0x1ff)];if(existsSync(_0x4c88b1)){const _0x5d760f=readFileSync(_0x4c88b1,_0x27ccb8(0x167)),_0x3900bc=generateDiff(_0x5d760f,_0x3e0239);if(!hasChanges(_0x3900bc))console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x16b)]('✔')+_0x27ccb8(0x210)+a30_0x51421d['cyan'](_0x4c88b1)+_0x27ccb8(0xc8));else{console[_0x27ccb8(0x187)]('\x0aChanges\x20to\x20\x27'+_0x4c88b1+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x27ccb8(0x187)](formatDiffWithColors(_0x3900bc)),console['error']('─'['repeat'](0x3c));if(!_0x585c13[_0x27ccb8(0x1a9)]){if(!isInteractive())return console['error'](a30_0x51421d['red'](_0x27ccb8(0x22c)),_0x27ccb8(0x248)),console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x15f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x526b6b=await confirmKey(_0x27ccb8(0x129)+_0x4c88b1+'\x27?');if(!_0x526b6b)return console['error'](a30_0x51421d[_0x27ccb8(0x24f)](_0x27ccb8(0xf7))),0x1;}writeFileSync(_0x4c88b1,_0x3e0239,_0x27ccb8(0x167)),console[_0x27ccb8(0x187)](a30_0x51421d['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x51421d[_0x27ccb8(0x1c0)](_0x4c88b1));}}else{const _0x486e79=a30_0x33c29c[_0x27ccb8(0x223)](_0x4c88b1);!existsSync(_0x486e79)&&mkdirSync(_0x486e79,{'recursive':!![]}),writeFileSync(_0x4c88b1,_0x3e0239,_0x27ccb8(0x167)),console['error'](a30_0x51421d['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x51421d[_0x27ccb8(0x1c0)](_0x4c88b1));}return saveSessionContext({'parent_segment':_0x2f70b3},_0x585c13[_0x27ccb8(0x1fe)]),console[_0x27ccb8(0x187)](a30_0x51421d['green']('✔')+_0x27ccb8(0x1c2)+a30_0x51421d['dim'](_0x27ccb8(0x183))+_0x27ccb8(0x206)+a30_0x51421d[_0x27ccb8(0x1c0)](_0x2f70b3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x23f);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x24b);async['execute'](_0x15cb59){const _0x1f4743=a30_0x4fc0d8,{options:_0x13d427,args:_0x582e59,tdx:_0x66d8a4}=_0x15cb59,_0x50a3c2=_0x13d427,_0x4b9a6f=_0x582e59[0x0]||_0x13d427[_0x1f4743(0x145)];if(!_0x4b9a6f)return showParentSegmentNotSetError(_0x1f4743(0x153)+_0x1f4743(0x162)),0x1;const _0x360134=resolveYamlFile(_0x4b9a6f);if(!existsSync(_0x360134))return showFileNotFoundError(_0x360134,_0x4b9a6f),0x1;_0x50a3c2[_0x1f4743(0x136)]&&(console[_0x1f4743(0x187)](_0x1f4743(0x17f)+_0x50a3c2[_0x1f4743(0x22e)]),console[_0x1f4743(0x187)]('YAML\x20file:\x20'+_0x360134));let _0x50670d;try{_0x50670d=readFileSync(_0x360134,_0x1f4743(0x167));}catch(_0x41cda4){const _0x3a42a2=_0x41cda4 instanceof Error?_0x41cda4[_0x1f4743(0x11d)]:String(_0x41cda4);return console[_0x1f4743(0x187)](_0x1f4743(0x1fd)+_0x3a42a2),0x1;}const _0x26ed44=await withSpinner(_0x1f4743(0x123),()=>_0x66d8a4['segment']['pushParentYaml'](_0x50670d),{'verbose':_0x50a3c2[_0x1f4743(0x136)]}),_0x40d8ce=_0x26ed44[_0x1f4743(0x1ff)],{isNew:_0x5afbb0,name:_0x5dc429,hasChanges:_0x2ba3fc,diffFormatted:_0x125d7c}=_0x40d8ce;if(!_0x2ba3fc)return console[_0x1f4743(0x187)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5dc429+_0x1f4743(0x110)),0x0;_0x5afbb0?console[_0x1f4743(0x187)](_0x1f4743(0xed)+_0x5dc429+'\x27:'):console[_0x1f4743(0x187)](_0x1f4743(0x23c)+_0x5dc429+'\x27:');console[_0x1f4743(0x187)]('─'[_0x1f4743(0x109)](0x3c)),console['error'](_0x125d7c),console['error']('─'['repeat'](0x3c));const _0x19917a=_0x5afbb0?_0x1f4743(0x203)+_0x5dc429+'\x27?':_0x1f4743(0x1ec)+_0x5dc429+'\x27?';if(!_0x50a3c2[_0x1f4743(0x1a9)]){if(!isInteractive())return console[_0x1f4743(0x187)](a30_0x51421d[_0x1f4743(0x10c)](_0x1f4743(0x22c)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a30_0x51421d[_0x1f4743(0x15f)](_0x1f4743(0x1d8))),0x1;const _0x2aaa3a=await confirmKey(_0x19917a);if(!_0x2aaa3a)return console['error'](a30_0x51421d[_0x1f4743(0x24f)](_0x1f4743(0xf7))),0x1;}const _0x61ad61=_0x5afbb0?_0x1f4743(0x191):'Updating',_0x3915ce=await withSpinner(_0x61ad61+'\x20parent\x20segment\x20\x27'+_0x5dc429+_0x1f4743(0xf3),()=>_0x40d8ce[_0x1f4743(0x130)](),{'verbose':_0x50a3c2[_0x1f4743(0x136)]}),_0x1e90ec=_0x3915ce[_0x1f4743(0x1ff)],_0x2fa9cc=getConsoleNextUrl(_0x50a3c2[_0x1f4743(0x22e)],'/app/dw/parentSegments/'+_0x1e90ec['id']),_0x2ca43c=_0x5afbb0?_0x1f4743(0x18b):_0x1f4743(0x18c);return console['error']('✔\x20'+_0x2ca43c+_0x1f4743(0x1ba)+_0x1e90ec[_0x1f4743(0x1a2)]+'\x27'),console['error']('\x20\x20'+_0x2fa9cc),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x122);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x11a);async['execute'](_0x12e0bc){const _0x4a5d9a=a30_0x4fc0d8,{options:_0x131389,args:_0x3b562d,tdx:_0x1a735a}=_0x12e0bc,_0x4e7d8a=_0x131389,_0x510301=_0x3b562d[0x0]||_0x131389[_0x4a5d9a(0x145)];if(!_0x510301)return showParentSegmentNotSetError(_0x4a5d9a(0x188)+_0x4a5d9a(0x1e9)+_0x4a5d9a(0xd6)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x4a5d9a(0x179)),0x1;const _0x5826f0=resolveYamlFile(_0x510301);if(!existsSync(_0x5826f0))return showFileNotFoundError(_0x5826f0,_0x510301),0x1;_0x4e7d8a[_0x4a5d9a(0x136)]&&(console[_0x4a5d9a(0x187)]('Site:\x20'+_0x4e7d8a[_0x4a5d9a(0x22e)]),console[_0x4a5d9a(0x187)](_0x4a5d9a(0xdf)+_0x5826f0));let _0x4b752c;try{_0x4b752c=readFileSync(_0x5826f0,_0x4a5d9a(0x167));}catch(_0x16bdd2){const _0x4dd7be=_0x16bdd2 instanceof Error?_0x16bdd2[_0x4a5d9a(0x11d)]:String(_0x16bdd2);return console[_0x4a5d9a(0x187)]('Error\x20reading\x20file:\x20'+_0x4dd7be),0x1;}const _0x491c23=createCommandSpinner(a30_0x51421d[_0x4a5d9a(0x15f)](_0x4a5d9a(0x1bc)),{'verbose':_0x4e7d8a[_0x4a5d9a(0x136)]});_0x491c23[_0x4a5d9a(0x101)]();const _0x2a2b81={'onProgress':_0x230ecd=>{_0x491c23['text']=formatProgressMessage(_0x230ecd);}};if(_0x4e7d8a[_0x4a5d9a(0x194)])_0x2a2b81[_0x4a5d9a(0x194)]=!![];if(_0x4e7d8a[_0x4a5d9a(0x1aa)])_0x2a2b81['enriched']=!![];_0x4e7d8a[_0x4a5d9a(0xe8)]&&(_0x2a2b81[_0x4a5d9a(0xe8)]=_0x4e7d8a[_0x4a5d9a(0xe8)]);_0x4e7d8a[_0x4a5d9a(0x1bd)]&&(_0x2a2b81[_0x4a5d9a(0x1bd)]=_0x4e7d8a[_0x4a5d9a(0x1bd)]);if(_0x4e7d8a[_0x4a5d9a(0x106)])_0x2a2b81['interval']=_0x4e7d8a[_0x4a5d9a(0x106)];let _0x690886;try{_0x690886=await _0x1a735a[_0x4a5d9a(0x1b4)][_0x4a5d9a(0x243)](_0x4b752c,_0x2a2b81),_0x491c23['stop']();}catch(_0xa40c20){_0x491c23[_0x4a5d9a(0x1e2)]();throw _0xa40c20;}const _0x1b6890=_0x4e7d8a[_0x4a5d9a(0x106)]||_0x4a5d9a(0xef);return this['displayValidateResults'](_0x690886,_0x2a2b81,_0x5826f0,_0x1b6890),_0x690886[_0x4a5d9a(0x20c)]?0x0:0x1;}['displayValidateResults'](_0x28c8fa,_0x23584f,_0x1dbfc6,_0x526f6b){const _0x7d70a3=a30_0x4fc0d8;console[_0x7d70a3(0x187)]('\x0a'+a30_0x51421d[_0x7d70a3(0xc5)](_0x7d70a3(0x236))+'\x20'+_0x28c8fa[_0x7d70a3(0x1a2)]),console[_0x7d70a3(0x187)]('═'[_0x7d70a3(0x109)](0x3c)),this[_0x7d70a3(0x246)](_0x28c8fa);if(typeof _0x23584f[_0x7d70a3(0xe8)]==='string'){this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x237)](_0x28c8fa),this['displayPreviewHints'](_0x1dbfc6,_0x526f6b,_0x7d70a3(0xe8),_0x23584f['attribute']);return;}if(_0x23584f['attribute']===!![]){this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x237)](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x224));return;}if(typeof _0x23584f['behavior']===_0x7d70a3(0x24d)){this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this[_0x7d70a3(0x237)](_0x28c8fa),this['displayPreviewHints'](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x1bd),_0x23584f[_0x7d70a3(0x1bd)]);return;}if(_0x23584f[_0x7d70a3(0x1bd)]===!![]){this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this['displaySummary'](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x1d7));return;}this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this[_0x7d70a3(0x1cc)](_0x28c8fa),this['displaySummary'](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0xf2));}[a30_0x4fc0d8(0x1cc)](_0x2d6bff){displayRealtimeValidation(_0x2d6bff);}[a30_0x4fc0d8(0x1f2)](_0x5c8201,_0x335a3a,_0x2192da,_0x1f9ff5){const _0x72649=a30_0x4fc0d8;console[_0x72649(0x187)]('\x0a'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x1c5)));const _0x31e67e=_0x335a3a!==_0x72649(0xef)?_0x72649(0x1d1)+_0x335a3a:'';if(_0x2192da===_0x72649(0xe8)&&_0x1f9ff5)console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0x19d)+_0x1f9ff5+'\x22'+_0x31e67e));else{if(_0x2192da===_0x72649(0x1bd)&&_0x1f9ff5)console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)]('tdx\x20ps\x20preview\x20'+_0x5c8201+_0x72649(0x119)+_0x1f9ff5+'\x22'+_0x31e67e));else(_0x2192da===_0x72649(0x224)||_0x2192da===_0x72649(0xf2))&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0x14f)+_0x31e67e));}(_0x2192da===_0x72649(0x1d7)||_0x2192da===_0x72649(0xf2))&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0xff)+_0x31e67e)),_0x2192da===_0x72649(0xf2)&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x72649(0x163)+_0x5c8201+_0x72649(0x1ac)+_0x31e67e));}[a30_0x4fc0d8(0x246)](_0x2cd935){const _0x2ea60f=a30_0x4fc0d8,{master:_0x102a10}=_0x2cd935,_0x29dc6c=_0x102a10['schemaValid']?a30_0x51421d[_0x2ea60f(0x16b)]('✔'):a30_0x51421d[_0x2ea60f(0x10c)]('✘');console[_0x2ea60f(0x187)]('\x0a'+a30_0x51421d[_0x2ea60f(0x15f)](_0x2ea60f(0x242))),console[_0x2ea60f(0x187)](_0x29dc6c+'\x20'+a30_0x51421d[_0x2ea60f(0xc5)](_0x102a10[_0x2ea60f(0x1ee)]+'.'+_0x102a10[_0x2ea60f(0x1a0)])),_0x102a10[_0x2ea60f(0x117)]?_0x102a10[_0x2ea60f(0x201)]!==undefined&&console[_0x2ea60f(0x187)]('\x20\x20'+a30_0x51421d[_0x2ea60f(0x15f)](_0x2ea60f(0x13f))+'\x20'+a30_0x51421d[_0x2ea60f(0x1c0)](formatRows(_0x102a10[_0x2ea60f(0x201)]))):console[_0x2ea60f(0x187)]('\x20\x20'+a30_0x51421d[_0x2ea60f(0x10c)](_0x2ea60f(0x215))+'\x20'+_0x102a10[_0x2ea60f(0x1be)]);}[a30_0x4fc0d8(0x172)](_0x57b6f0){const _0x4649ee=a30_0x4fc0d8;if(_0x57b6f0[_0x4649ee(0x224)]['length']===0x0)return;console[_0x4649ee(0x187)]('\x0a'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xfd)));for(const _0x30ed8e of _0x57b6f0['attributes']){const _0xc6de81=_0x30ed8e['schemaValid']?a30_0x51421d[_0x4649ee(0x16b)]('✔'):a30_0x51421d[_0x4649ee(0x10c)]('✘');let _0x9cb8ab='';if(_0x30ed8e['schemaValid']&&_0x30ed8e[_0x4649ee(0x19c)]!==undefined&&_0x30ed8e[_0x4649ee(0x1a5)]!==undefined){const _0x23b4a3=_0x30ed8e[_0x4649ee(0x1a5)]['toFixed'](0x1),_0x2bf2cc=_0x30ed8e[_0x4649ee(0x1a5)]>=0x50?a30_0x51421d[_0x4649ee(0x16b)]:_0x30ed8e[_0x4649ee(0x1a5)]>=0x32?a30_0x51421d['yellow']:a30_0x51421d['red'];_0x9cb8ab='\x20'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0x138))+'\x20'+_0x2bf2cc(_0x23b4a3+'%')+'\x20('+formatRows(_0x30ed8e[_0x4649ee(0x19c)])+_0x4649ee(0x16e);}console[_0x4649ee(0x187)](_0xc6de81+'\x20'+a30_0x51421d[_0x4649ee(0xc5)](_0x30ed8e[_0x4649ee(0x1a2)])+_0x9cb8ab),console['error']('\x20\x20'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xbe))+'\x20'+a30_0x51421d[_0x4649ee(0xc5)](_0x30ed8e['database']+'.'+_0x30ed8e[_0x4649ee(0x1a0)]));const _0x58bbef=_0x30ed8e[_0x4649ee(0x1d0)]===_0x30ed8e[_0x4649ee(0x1cf)]?a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0x218))+'\x20'+_0x30ed8e[_0x4649ee(0x1d0)]:a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xc1))+'\x20'+_0x30ed8e[_0x4649ee(0x1d0)]+_0x4649ee(0x206)+_0x30ed8e[_0x4649ee(0x1cf)];console[_0x4649ee(0x187)]('\x20\x20'+_0x58bbef),console['error']('\x20\x20'+a30_0x51421d['dim']('Columns:')),this[_0x4649ee(0xec)](_0x30ed8e[_0x4649ee(0x139)]),!_0x30ed8e['schemaValid']&&console[_0x4649ee(0x187)]('\x20\x20'+a30_0x51421d['red']('Error:')+'\x20'+_0x30ed8e[_0x4649ee(0x1be)]);}}[a30_0x4fc0d8(0x177)](_0x574d05,_0x29d6ae){const _0x4cdefd=a30_0x4fc0d8;if(_0x574d05['behaviors']['length']===0x0)return;console[_0x4cdefd(0x187)]('\x0a'+a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x13b))+'\x20'+a30_0x51421d['dim']('('+_0x29d6ae+')'));for(const _0x2272a6 of _0x574d05[_0x4cdefd(0x1d7)]){const _0x3d3844=_0x2272a6[_0x4cdefd(0x117)]?a30_0x51421d['green']('✔'):a30_0x51421d[_0x4cdefd(0x10c)]('✘');let _0x3cac0e='';if(_0x2272a6[_0x4cdefd(0x117)]&&_0x2272a6['customersWithEvents']!==undefined&&_0x2272a6[_0x4cdefd(0x175)]!==undefined){const _0x1ac2bd=_0x2272a6['customerPercent']?.[_0x4cdefd(0x230)](0x1)||'?',_0x249780=(_0x2272a6[_0x4cdefd(0x1fb)]??0x0)>=0x32?a30_0x51421d['green']:(_0x2272a6['customerPercent']??0x0)>=0x14?a30_0x51421d[_0x4cdefd(0x24f)]:a30_0x51421d[_0x4cdefd(0x10c)];_0x3cac0e='\x20'+a30_0x51421d['dim']('Customers:')+'\x20'+_0x249780(formatRows(_0x2272a6[_0x4cdefd(0x220)]))+'\x20('+_0x1ac2bd+_0x4cdefd(0xd9)+a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x105))+'\x20'+a30_0x51421d[_0x4cdefd(0x1c0)](formatRows(_0x2272a6[_0x4cdefd(0x175)]));}console[_0x4cdefd(0x187)](_0x3d3844+'\x20'+a30_0x51421d[_0x4cdefd(0xc5)](_0x2272a6[_0x4cdefd(0x1a2)])+_0x3cac0e),console[_0x4cdefd(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x4cdefd(0xbe))+'\x20'+a30_0x51421d['bold'](_0x2272a6[_0x4cdefd(0x1ee)]+'.'+_0x2272a6[_0x4cdefd(0x1a0)]));const _0x5ced6c=_0x2272a6[_0x4cdefd(0x1d0)]===_0x2272a6[_0x4cdefd(0x1cf)]?a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x218))+'\x20'+_0x2272a6[_0x4cdefd(0x1d0)]:a30_0x51421d[_0x4cdefd(0x15f)]('Join:')+'\x20'+_0x2272a6['joinKey']+_0x4cdefd(0x206)+_0x2272a6[_0x4cdefd(0x1cf)];console[_0x4cdefd(0x187)]('\x20\x20'+_0x5ced6c),console[_0x4cdefd(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x4cdefd(0x1b6))),this[_0x4cdefd(0xec)](_0x2272a6[_0x4cdefd(0x139)]),!_0x2272a6['schemaValid']&&console['error']('\x20\x20'+a30_0x51421d[_0x4cdefd(0x10c)](_0x4cdefd(0x215))+'\x20'+_0x2272a6[_0x4cdefd(0x1be)]);}}[a30_0x4fc0d8(0xec)](_0x56b375){const _0x2f58f7=a30_0x4fc0d8;for(const _0x18765a of _0x56b375){_0x18765a[_0x2f58f7(0x100)]===_0x18765a[_0x2f58f7(0x15a)]||_0x18765a[_0x2f58f7(0x15a)]==='*'?console[_0x2f58f7(0x187)](_0x2f58f7(0x193)+_0x18765a[_0x2f58f7(0x100)]):console[_0x2f58f7(0x187)](_0x2f58f7(0x193)+_0x18765a[_0x2f58f7(0x100)]+'\x20'+a30_0x51421d[_0x2f58f7(0x15f)]('('+_0x18765a['column']+')'));}}['displaySummary'](_0x345d8e){const _0x39ccfb=a30_0x4fc0d8;console[_0x39ccfb(0x187)]('─'[_0x39ccfb(0x109)](0x3c));if(_0x345d8e[_0x39ccfb(0xfb)][_0x39ccfb(0xd2)]>0x0){console[_0x39ccfb(0x187)]('\x0a'+a30_0x51421d['red'](_0x39ccfb(0x23b)));for(const _0x475b72 of _0x345d8e[_0x39ccfb(0xfb)]){console[_0x39ccfb(0x187)]('\x20\x20'+a30_0x51421d[_0x39ccfb(0x10c)]('•')+'\x20'+_0x475b72);}}_0x345d8e[_0x39ccfb(0x20c)]&&console['error']('\x0a'+a30_0x51421d[_0x39ccfb(0x16b)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0xf8);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0xfe);async[a30_0x4fc0d8(0xfa)](_0x349a45){const _0x1c54f4=a30_0x4fc0d8,{options:_0x1a595b,args:_0x5d7bb6,tdx:_0x35fa83}=_0x349a45,_0x271605=_0x1a595b,_0x1c066e=_0x5d7bb6[0x0]||_0x1a595b['parentSegment'];if(!_0x1c066e)return showParentSegmentNotSetError(_0x1c54f4(0x137)+_0x1c54f4(0xf9)+'Options\x20(one\x20required):\x0a'+_0x1c54f4(0x176)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x1c54f4(0x1ed)+_0x1c54f4(0x1e1)+_0x1c54f4(0x179)),0x1;if(!_0x271605['master']&&!_0x271605[_0x1c54f4(0xe8)]&&!_0x271605[_0x1c54f4(0x1bd)]&&!_0x271605[_0x1c54f4(0x1aa)])return console[_0x1c54f4(0x187)](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x1a6))),console['error'](_0x1c54f4(0x211)),console[_0x1c54f4(0x187)](_0x1c54f4(0xc3)),console['error'](_0x1c54f4(0xcf)),console[_0x1c54f4(0x187)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x1c54f4(0x187)](_0x1c54f4(0x143)),console[_0x1c54f4(0x187)](_0x1c54f4(0xd3)),0x1;const _0x403b77=resolveYamlFile(_0x1c066e);if(!existsSync(_0x403b77))return showFileNotFoundError(_0x403b77,_0x1c066e),0x1;_0x271605[_0x1c54f4(0x136)]&&(console[_0x1c54f4(0x187)](_0x1c54f4(0x17f)+_0x271605['site']),console[_0x1c54f4(0x187)](_0x1c54f4(0xdf)+_0x403b77));let _0xb68c34;try{_0xb68c34=readFileSync(_0x403b77,_0x1c54f4(0x167));}catch(_0x3f9e11){const _0x556aaa=_0x3f9e11 instanceof Error?_0x3f9e11[_0x1c54f4(0x11d)]:String(_0x3f9e11);return console[_0x1c54f4(0x187)]('Error\x20reading\x20file:\x20'+_0x556aaa),0x1;}let _0x8c422d;try{_0x8c422d=parseDef(_0xb68c34);}catch(_0x5604a6){const _0x4e573f=_0x5604a6 instanceof Error?_0x5604a6['message']:String(_0x5604a6);return console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0xd0)+_0x4e573f)),0x1;}if(_0x271605['attribute']===!![]||_0x271605[_0x1c54f4(0xe8)]===''){const _0x182792=_0x8c422d['attributes']?.[_0x1c54f4(0x13e)](_0x108a97=>_0x108a97[_0x1c54f4(0x1a2)])||[];if(_0x182792[_0x1c54f4(0xd2)]===0x0)console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x24c)));else{console[_0x1c54f4(0x187)](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x1da))),console[_0x1c54f4(0x187)](_0x1c54f4(0x1d3));for(const _0x33c58c of _0x182792){console[_0x1c54f4(0x187)]('\x20\x20'+a30_0x51421d['cyan'](_0x33c58c));}console[_0x1c54f4(0x187)](_0x1c54f4(0x160)+_0x1c066e+_0x1c54f4(0x19d)+_0x182792[0x0]+'\x22');}return 0x1;}if(_0x271605[_0x1c54f4(0x1bd)]===!![]||_0x271605[_0x1c54f4(0x1bd)]===''){const _0x23e6d6=_0x8c422d['behaviors']?.[_0x1c54f4(0x13e)](_0x2dcb79=>_0x2dcb79[_0x1c54f4(0x1a2)])||[];if(_0x23e6d6[_0x1c54f4(0xd2)]===0x0)console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0xc6)));else{console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x12b))),console[_0x1c54f4(0x187)]('Available\x20behaviors:');for(const _0x4d89b0 of _0x23e6d6){console['error']('\x20\x20'+a30_0x51421d['cyan'](_0x4d89b0));}console[_0x1c54f4(0x187)](_0x1c54f4(0x160)+_0x1c066e+'\x20--behavior\x20\x22'+_0x23e6d6[0x0]+'\x22');}return 0x1;}const _0x709fb0=createCommandSpinner(a30_0x51421d[_0x1c54f4(0x15f)](_0x1c54f4(0x225)),{'verbose':_0x271605[_0x1c54f4(0x136)]});_0x709fb0[_0x1c54f4(0x101)]();const _0x538b85={'onProgress':_0x26d260=>{const _0x2fe783=_0x1c54f4;_0x709fb0[_0x2fe783(0x238)]=formatProgressMessage(_0x26d260);}};if(_0x271605[_0x1c54f4(0x194)])_0x538b85[_0x1c54f4(0x194)]=!![];if(_0x271605[_0x1c54f4(0xe8)]&&typeof _0x271605[_0x1c54f4(0xe8)]===_0x1c54f4(0x24d))_0x538b85[_0x1c54f4(0xe8)]=_0x271605[_0x1c54f4(0xe8)];if(_0x271605[_0x1c54f4(0x1bd)]&&typeof _0x271605[_0x1c54f4(0x1bd)]==='string')_0x538b85[_0x1c54f4(0x1bd)]=_0x271605[_0x1c54f4(0x1bd)];if(_0x271605['enriched'])_0x538b85[_0x1c54f4(0x1aa)]=!![];if(_0x271605['interval'])_0x538b85[_0x1c54f4(0x106)]=_0x271605[_0x1c54f4(0x106)];let _0x133ed8;try{_0x133ed8=await _0x35fa83[_0x1c54f4(0x1b4)]['previewParentYaml'](_0xb68c34,_0x538b85),_0x709fb0[_0x1c54f4(0x1e2)]();}catch(_0x346ff7){_0x709fb0[_0x1c54f4(0x1e2)]();throw _0x346ff7;}return await this[_0x1c54f4(0x19f)](_0x133ed8,{'master':_0x271605['master'],'attribute':typeof _0x271605[_0x1c54f4(0xe8)]===_0x1c54f4(0x24d)?_0x271605[_0x1c54f4(0xe8)]:undefined,'behavior':typeof _0x271605[_0x1c54f4(0x1bd)]===_0x1c54f4(0x24d)?_0x271605[_0x1c54f4(0x1bd)]:undefined,'enriched':_0x271605['enriched']}),_0x133ed8[_0x1c54f4(0x20c)]?0x0:0x1;}async[a30_0x4fc0d8(0x19f)](_0x122558,_0x2d310b){const _0x1be168=a30_0x4fc0d8;console[_0x1be168(0x187)]('\x0a'+a30_0x51421d[_0x1be168(0xc5)](_0x1be168(0x216))+'\x20'+_0x122558[_0x1be168(0x1a2)]),console[_0x1be168(0x187)]('═'[_0x1be168(0x109)](0x3c));if(_0x2d310b[_0x1be168(0x194)]&&_0x122558[_0x1be168(0x1e6)]){const _0x5f2a5e=a30_0x51421d['dim'](_0x1be168(0x14e))+'\x20'+a30_0x51421d['bold'](_0x122558[_0x1be168(0x194)][_0x1be168(0x1ee)]+'.'+_0x122558[_0x1be168(0x194)][_0x1be168(0x1a0)]);await this[_0x1be168(0x169)](_0x5f2a5e,_0x122558[_0x1be168(0x1e6)]);}else{if(_0x2d310b[_0x1be168(0xe8)]&&_0x122558[_0x1be168(0x1e6)]){const _0x14ebd6=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0x1a1))+'\x20'+a30_0x51421d['bold'](_0x2d310b[_0x1be168(0xe8)]);await this[_0x1be168(0x169)](_0x14ebd6,_0x122558[_0x1be168(0x1e6)]);}else{if(_0x2d310b[_0x1be168(0x1bd)]&&_0x122558['sampleData']){const _0x3114fb=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0xf6))+'\x20'+a30_0x51421d['bold'](_0x2d310b[_0x1be168(0x1bd)]);await this[_0x1be168(0x169)](_0x3114fb,_0x122558['sampleData']);}else{if(_0x2d310b[_0x1be168(0x1aa)]&&_0x122558[_0x1be168(0x1e6)]){const _0x5b221a=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0xd8))+'\x20'+a30_0x51421d[_0x1be168(0xc5)](_0x1be168(0x21e));await this[_0x1be168(0x169)](_0x5b221a,_0x122558[_0x1be168(0x1e6)]);}else!_0x122558[_0x1be168(0x1e6)]&&console[_0x1be168(0x187)](_0x1be168(0x1f9));}}}if(_0x122558[_0x1be168(0xfb)][_0x1be168(0xd2)]>0x0){console['error']('─'[_0x1be168(0x109)](0x3c)),console['error']('\x0a'+a30_0x51421d[_0x1be168(0x10c)](_0x1be168(0x23b)));for(const _0x1896bb of _0x122558[_0x1be168(0xfb)]){console[_0x1be168(0x187)]('\x20\x20'+a30_0x51421d[_0x1be168(0x10c)]('•')+'\x20'+_0x1896bb);}}}async[a30_0x4fc0d8(0x169)](_0x3a62b7,_0x42051d){const _0x6fc4ec=a30_0x4fc0d8;if(_0x42051d[_0x6fc4ec(0xd2)]===0x0){console[_0x6fc4ec(0x187)]('\x0a'+_0x3a62b7),console[_0x6fc4ec(0x187)](_0x6fc4ec(0xe4));return;}console[_0x6fc4ec(0x187)]('\x0a'+_0x3a62b7);const _0x5cefcf=Object['keys'](_0x42051d[0x0])['map'](_0x232bfa=>({'name':_0x232bfa,'type':typeof _0x42051d[0x0][_0x232bfa]===_0x6fc4ec(0x1f5)?_0x6fc4ec(0x185):_0x6fc4ec(0xc9)})),_0x2c426b={'queryId':_0x6fc4ec(0x103),'columns':_0x5cefcf,'data':_0x42051d,'stats':{'state':_0x6fc4ec(0xe7),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x42051d[_0x6fc4ec(0xd2)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4c1b42=formatAsTable(_0x2c426b,_0x42051d['length'],!![]);await writeOutput(_0x4c1b42,undefined,_0x6fc4ec(0x1a0));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a30_0x4fc0d8(0x14a);[a30_0x4fc0d8(0x251)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a30_0x4fc0d8(0xfa)](_0x6067a8){const _0x2b55b5=a30_0x4fc0d8,{options:_0x16e7f2,args:_0x1e1265,tdx:_0x3d2d22}=_0x6067a8,_0x120e76=_0x16e7f2,_0x4dd2b3=_0x1e1265[0x0]||_0x16e7f2[_0x2b55b5(0x145)];if(!_0x4dd2b3)return showParentSegmentNotSetError(_0x2b55b5(0xe0)+_0x2b55b5(0x104)),0x1;const _0x976902=resolveYamlFile(_0x4dd2b3);if(existsSync(_0x976902)){_0x120e76[_0x2b55b5(0x136)]&&console[_0x2b55b5(0x187)]('Found\x20YAML\x20file:\x20'+_0x976902);let _0x4392f1;try{_0x4392f1=readFileSync(_0x976902,'utf-8');}catch(_0x394373){const _0x5ebb7c=_0x394373 instanceof Error?_0x394373[_0x2b55b5(0x11d)]:String(_0x394373);return console['error']('Error\x20reading\x20file:\x20'+_0x5ebb7c),0x1;}const _0x37e2b3=await withSpinner(_0x2b55b5(0x123),()=>_0x3d2d22[_0x2b55b5(0x1b4)][_0x2b55b5(0x154)](_0x4392f1),{'verbose':_0x120e76['verbose']}),_0x3cab1d=_0x37e2b3['data'],{isNew:_0x52f36e,name:_0x25a204,hasChanges:_0x4f9a38,diffFormatted:_0x58531f}=_0x3cab1d;if(_0x4f9a38){_0x52f36e?console['error'](_0x2b55b5(0xed)+_0x25a204+'\x27:'):console[_0x2b55b5(0x187)](_0x2b55b5(0x23c)+_0x25a204+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x58531f),console['error']('─'[_0x2b55b5(0x109)](0x3c));const _0x17462c=_0x52f36e?'Create\x20parent\x20segment\x20\x27'+_0x25a204+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x25a204+'\x27\x20and\x20run\x20workflow?';if(!_0x120e76[_0x2b55b5(0x1a9)]){if(!isInteractive())return console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x10c)](_0x2b55b5(0x22c)),_0x2b55b5(0x248)),console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x15f)](_0x2b55b5(0x1d8))),0x1;const _0x32ec2b=await confirmKey(_0x17462c);if(!_0x32ec2b)return console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x24f)]('Aborted.')),0x1;}const _0x2ba014=_0x52f36e?_0x2b55b5(0x191):_0x2b55b5(0x209);await withSpinner(_0x2ba014+_0x2b55b5(0x1ba)+_0x25a204+'\x27...',()=>_0x3cab1d[_0x2b55b5(0x130)](),{'verbose':_0x120e76[_0x2b55b5(0x136)]});const _0x35a584=_0x52f36e?'Created':_0x2b55b5(0x18c);console[_0x2b55b5(0x187)]('✔\x20'+_0x35a584+_0x2b55b5(0x1ba)+_0x25a204+'\x27');}else console['error'](_0x2b55b5(0x12f)+_0x25a204+_0x2b55b5(0x161));}const _0x16fc85=await withSpinner(_0x2b55b5(0x232)+_0x4dd2b3+_0x2b55b5(0xf3),()=>_0x3d2d22['segment'][_0x2b55b5(0x17a)](_0x4dd2b3),{'verbose':_0x120e76[_0x2b55b5(0x136)]}),_0x31f932=_0x16fc85[_0x2b55b5(0x1ff)],_0x2ffd17=getConsoleUrl(_0x120e76[_0x2b55b5(0x22e)],'/app/workflows/'+_0x31f932[_0x2b55b5(0x1b8)]+_0x2b55b5(0x254)+_0x31f932[_0x2b55b5(0x22b)]+_0x2b55b5(0x244)+_0x31f932['workflowAttemptId']);return console[_0x2b55b5(0x187)](_0x2b55b5(0x20d)),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)]('Audience\x20ID:')+'\x20'+_0x31f932['audienceId']),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x2b55b5(0x247))+'\x20'+_0x31f932[_0x2b55b5(0x1e7)]),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)](_0x2b55b5(0xca))+'\x20'+_0x31f932[_0x2b55b5(0x22b)]),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)]('Attempt:')+'\x20'+_0x31f932[_0x2b55b5(0x214)]),console[_0x2b55b5(0x187)]('\x20\x20'+_0x2ffd17),console[_0x2b55b5(0x187)]('\x0a'+a30_0x51421d['dim'](_0x2b55b5(0x134))+_0x2b55b5(0x1c3)+_0x31f932[_0x2b55b5(0x214)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x202);async['execute'](_0x8586ad){const _0x3c3c6e=a30_0x4fc0d8,{options:_0x3419bc,args:_0x4e6bab,tdx:_0x14188f}=_0x8586ad,_0x583d81=_0x4e6bab[0x0]||_0x3419bc[_0x3c3c6e(0x145)];if(!_0x583d81)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x3c3c6e(0x1b3)),0x1;_0x3419bc['verbose']&&(console[_0x3c3c6e(0x187)]('Site:\x20'+_0x3419bc[_0x3c3c6e(0x22e)]),console[_0x3c3c6e(0x187)]('Parent\x20segment:\x20'+_0x583d81));const _0x92b89f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x583d81+_0x3c3c6e(0xf3),()=>_0x14188f[_0x3c3c6e(0x1b4)][_0x3c3c6e(0x173)](_0x583d81),{'verbose':_0x3419bc['verbose']}),_0x51124f=_0x92b89f[_0x3c3c6e(0x1ff)];console['error']('✔\x20Found\x20'+_0x51124f[_0x3c3c6e(0xd2)]+_0x3c3c6e(0x235)+(_0x51124f[_0x3c3c6e(0xd2)]!==0x1?'s':''));if(_0x3419bc[_0x3c3c6e(0x132)]||_0x3419bc[_0x3c3c6e(0x18e)])return await handleSDKOutput(_0x51124f,_0x3419bc),0x0;return displayFieldsHumanReadable(_0x51124f,_0x583d81),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x190);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0xe3);async[a30_0x4fc0d8(0xfa)](_0x7dd894){const _0x5ec448=a30_0x4fc0d8,{options:_0x41dbd8,args:_0x1332d1,tdx:_0x36b973}=_0x7dd894,_0x4dcbbc=_0x41dbd8,_0x49be1e=_0x1332d1[0x0]||_0x41dbd8[_0x5ec448(0x145)];if(!_0x49be1e)return showParentSegmentNotSetError(_0x5ec448(0x1f0)+_0x5ec448(0x113)+_0x5ec448(0xd6)+_0x5ec448(0x151)),0x1;_0x41dbd8['verbose']&&(console[_0x5ec448(0x187)](_0x5ec448(0x17f)+_0x41dbd8[_0x5ec448(0x22e)]),console[_0x5ec448(0x187)]('Parent\x20segment:\x20'+_0x49be1e));const _0x37d393=await withSpinner(_0x5ec448(0x24a)+_0x49be1e+_0x5ec448(0xf3),()=>_0x36b973[_0x5ec448(0x1b4)][_0x5ec448(0x1ce)](_0x49be1e),{'verbose':_0x41dbd8[_0x5ec448(0x136)]}),_0x3f4edb=_0x37d393[_0x5ec448(0x1ff)];if(_0x4dcbbc[_0x5ec448(0x252)]){const _0x228909=getConsoleNextUrl(_0x4dcbbc[_0x5ec448(0x22e)],'/app/dw/parentSegments/'+_0x3f4edb['id']);return console[_0x5ec448(0x187)](a30_0x51421d[_0x5ec448(0x16b)]('✔')+'\x20Opening\x20'+a30_0x51421d[_0x5ec448(0x1c0)](_0x228909)),openBrowser(_0x228909),0x0;}return await handleSingleObjectOutput(_0x3f4edb,_0x41dbd8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']='segment:parent:desc';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x1c7);async[a30_0x4fc0d8(0xfa)](_0x361fc2){const _0x4a195b=a30_0x4fc0d8,{options:_0x853b0d,args:_0x1d0f9c,tdx:_0x1d2b17}=_0x361fc2,_0x252d3f=_0x853b0d,_0x4cb376=_0x1d0f9c[0x0]||_0x853b0d[_0x4a195b(0x145)];if(!_0x4cb376)return showParentSegmentNotSetError(_0x4a195b(0x199)+_0x4a195b(0x146)+_0x4a195b(0xd6)+_0x4a195b(0x23e)),0x1;_0x853b0d[_0x4a195b(0x136)]&&(console['error'](_0x4a195b(0x17f)+_0x853b0d[_0x4a195b(0x22e)]),console[_0x4a195b(0x187)](_0x4a195b(0x197)+_0x4cb376));const _0x500699=await withSpinner(_0x4a195b(0xc0)+_0x4cb376+_0x4a195b(0xf3),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0x15b)](_0x4cb376),{'verbose':_0x853b0d[_0x4a195b(0x136)]}),_0x284248=_0x500699[_0x4a195b(0x1ff)],_0x6ee39c=_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0xcd)](_0x284248);if(_0x252d3f[_0x4a195b(0xe1)]){const _0x5684eb=await this['collectSchema'](_0x361fc2,_0x4cb376,_0x284248,_0x6ee39c),_0x30bd73=this[_0x4a195b(0x23a)](_0x5684eb);writeFileSync(_0x252d3f['output'],_0x30bd73);const _0x1d946b=_0x5684eb['customers'][_0x4a195b(0x139)]['length']+_0x5684eb[_0x4a195b(0x1d7)]['reduce']((_0x21046d,_0x1a5cb8)=>_0x21046d+_0x1a5cb8[_0x4a195b(0x139)]['length'],0x0),_0x4f7bb9=_0x5684eb[_0x4a195b(0x1d7)][_0x4a195b(0x1b0)](_0x4f5eb8=>_0x4f5eb8[_0x4a195b(0x139)][_0x4a195b(0xd2)]===0x0)[_0x4a195b(0xd2)];return console['log']('Schema\x20saved\x20to\x20'+_0x252d3f[_0x4a195b(0xe1)]),console[_0x4a195b(0xe9)](_0x4a195b(0x1c9)+_0x6ee39c),console[_0x4a195b(0xe9)](_0x4a195b(0x1f1)+_0x5684eb[_0x4a195b(0x1d7)]['length']+_0x4a195b(0x11e)),console['log'](_0x4a195b(0x198)+_0x1d946b+'\x20total'),_0x4f7bb9>0x0&&console['log']('\x20\x20Note:\x20'+_0x4f7bb9+_0x4a195b(0xd5)),0x0;}console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d[_0x4a195b(0xc5)]('Output\x20Database:')+'\x20'+a30_0x51421d[_0x4a195b(0x1c0)](_0x6ee39c));const _0x424496=await withSpinner(_0x4a195b(0x16a),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0xbd)](_0x284248),{'verbose':_0x853b0d[_0x4a195b(0x136)]});console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d['bold'](_0x4a195b(0x20a))+'\x20'+a30_0x51421d[_0x4a195b(0x15f)]('('+_0x6ee39c+_0x4a195b(0xd7)));const _0x2f7a74=await executeSchemaQuery(_0x424496['data'],_0x1d2b17,_0x853b0d);await handleQueryOutput(_0x2f7a74,_0x853b0d);const _0x1661f7=await withSpinner(_0x4a195b(0x171),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0x11f)](_0x284248),{'verbose':_0x853b0d[_0x4a195b(0x136)]});for(const _0x499b8a of _0x1661f7[_0x4a195b(0x1ff)]){const _0x5cabb2=_0x4a195b(0x217)+_0x499b8a[_0x4a195b(0x1c6)]()['replace'](/\s+/g,'_'),_0x53d6b0=_0x4a195b(0x16f)+_0x6ee39c+'.'+_0x5cabb2;console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d['bold'](_0x499b8a)+'\x20'+a30_0x51421d[_0x4a195b(0x15f)]('('+_0x6ee39c+'.'+_0x5cabb2+')'));try{const _0xcd81b9=await executeSchemaQuery(_0x53d6b0,_0x1d2b17,_0x853b0d);await handleQueryOutput(_0xcd81b9,_0x853b0d);}catch{console['error'](a30_0x51421d[_0x4a195b(0x24f)](_0x4a195b(0xee)));}}return 0x0;}async[a30_0x4fc0d8(0x152)](_0x255044,_0x185e5d,_0x14745a,_0x267d7b){const _0x4bad91=a30_0x4fc0d8,{options:_0x310321,tdx:_0xf41c6e}=_0x255044,_0x382146=await withSpinner('Fetching\x20customers\x20schema...',()=>_0xf41c6e[_0x4bad91(0x1b4)]['getParentSQL'](_0x14745a),{'verbose':_0x310321[_0x4bad91(0x136)]}),_0x435afb=await executeSchemaQuery(_0x382146[_0x4bad91(0x1ff)],_0xf41c6e,_0x310321),_0xf68124=_0x435afb[_0x4bad91(0x1ff)][_0x4bad91(0x13e)](_0x580f95=>({'name':_0x580f95[_0x4bad91(0x13c)],'type':_0x580f95[_0x4bad91(0x22f)]})),_0x3ac7f9=await withSpinner(_0x4bad91(0x171),()=>_0xf41c6e['segment']['getBehaviorNames'](_0x14745a),{'verbose':_0x310321[_0x4bad91(0x136)]}),_0x25d921=[];for(const _0x1b9afa of _0x3ac7f9[_0x4bad91(0x1ff)]){const _0x29cf16=_0x4bad91(0x217)+_0x1b9afa[_0x4bad91(0x1c6)]()[_0x4bad91(0x131)](/\s+/g,'_'),_0x129a5a=_0x4bad91(0x16f)+_0x267d7b+'.'+_0x29cf16;let _0x5501dc=[];try{const _0x2daec7=await executeSchemaQuery(_0x129a5a,_0xf41c6e,_0x310321);_0x5501dc=_0x2daec7[_0x4bad91(0x1ff)][_0x4bad91(0x13e)](_0x936bdc=>({'name':_0x936bdc[_0x4bad91(0x13c)],'type':_0x936bdc['column_type']}));}catch{}_0x25d921[_0x4bad91(0x1de)]({'table':_0x29cf16,'columns':_0x5501dc});}return{'database':_0x267d7b,'parent_segment':_0x185e5d,'parent_id':_0x14745a,'customers':{'table':_0x4bad91(0x20a),'columns':_0xf68124},'behaviors':_0x25d921};}[a30_0x4fc0d8(0x23a)](_0x25e9fc){const _0x4cad6f=a30_0x4fc0d8,_0x38e308=_0x31411c=>{const _0x6b3dae=a30_0x1520;if(_0x31411c[_0x6b3dae(0xd2)]===0x0)return'[]';const _0x7edcdf=_0x31411c['map'](_0xcc5942=>_0x6b3dae(0x189)+_0xcc5942['name']+_0x6b3dae(0xeb)+_0xcc5942['type']+_0x6b3dae(0x112));return'[\x0a'+_0x7edcdf[_0x6b3dae(0x1a3)](',\x0a')+_0x6b3dae(0xe2);},_0xc952d2=_0x25e9fc[_0x4cad6f(0x1d7)][_0x4cad6f(0x13e)](_0x13f6e6=>{const _0x55117b=_0x4cad6f;return _0x55117b(0x226)+_0x13f6e6[_0x55117b(0x1a0)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x38e308(_0x13f6e6[_0x55117b(0x139)])[_0x55117b(0x131)](/^/gm,'\x20\x20')[_0x55117b(0x1bf)]()+_0x55117b(0x1bb);})[_0x4cad6f(0x1a3)](',\x0a');return _0x4cad6f(0x234)+_0x25e9fc[_0x4cad6f(0x1ee)]+_0x4cad6f(0x1c1)+_0x25e9fc[_0x4cad6f(0x183)]+_0x4cad6f(0x245)+_0x25e9fc['parent_id']+_0x4cad6f(0x124)+_0x25e9fc[_0x4cad6f(0x20a)][_0x4cad6f(0x1a0)]+_0x4cad6f(0x12a)+_0x38e308(_0x25e9fc[_0x4cad6f(0x20a)][_0x4cad6f(0x139)])['replace'](/^/gm,'\x20\x20')[_0x4cad6f(0x1bf)]()+_0x4cad6f(0x115)+_0xc952d2+_0x4cad6f(0x10a);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x184);[a30_0x4fc0d8(0x251)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x4fc0d8(0xfa)](_0xe1fb08){const _0x4948e6=a30_0x4fc0d8,{options:_0x5e4093,args:_0x25a3db,tdx:_0x9e38}=_0xe1fb08,_0x5639e2=_0x25a3db[0x0]||_0x5e4093[_0x4948e6(0x145)];if(!_0x5639e2)return showParentSegmentNotSetError(_0x4948e6(0x116)+_0x4948e6(0xbf)),0x1;_0x5e4093['verbose']&&(console['error']('Site:\x20'+_0x5e4093[_0x4948e6(0x22e)]),console[_0x4948e6(0x187)]('Parent\x20segment:\x20'+_0x5639e2));const _0x29294c=await withSpinner(_0x4948e6(0xc0)+_0x5639e2+_0x4948e6(0xf3),()=>_0x9e38[_0x4948e6(0x1b4)]['resolveParentId'](_0x5639e2),{'verbose':_0x5e4093[_0x4948e6(0x136)]}),_0x1640a6=_0x29294c[_0x4948e6(0x1ff)],_0x5e328f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5639e2+_0x4948e6(0xf3),()=>_0x9e38['segment'][_0x4948e6(0xbd)](_0x1640a6),{'verbose':_0x5e4093[_0x4948e6(0x136)]}),_0x5b6120=_0x5e328f[_0x4948e6(0x1ff)];return _0x5e4093[_0x4948e6(0xf4)]===_0x4948e6(0x132)||_0x5e4093[_0x4948e6(0xf4)]===_0x4948e6(0x18e)?await handleSDKOutput([{'sql':_0x5b6120}],_0x5e4093):console[_0x4948e6(0xe9)](_0x5b6120),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x23d);[a30_0x4fc0d8(0x251)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a30_0x4fc0d8(0xfa)](_0x6a13dc){const _0x2fe63b=a30_0x4fc0d8,{options:_0x49207a,args:_0x512d0b,tdx:_0x148f12}=_0x6a13dc,_0x4b009e=_0x512d0b[0x0]||_0x49207a[_0x2fe63b(0x145)];if(!_0x4b009e)return showParentSegmentNotSetError(_0x2fe63b(0x208)+_0x2fe63b(0x180)),0x1;_0x49207a['verbose']&&(console['error']('Site:\x20'+_0x49207a[_0x2fe63b(0x22e)]),console[_0x2fe63b(0x187)]('Parent\x20segment:\x20'+_0x4b009e));const _0x4abc81=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4b009e+_0x2fe63b(0xf3),()=>_0x148f12['segment'][_0x2fe63b(0x15b)](_0x4b009e),{'verbose':_0x49207a[_0x2fe63b(0x136)]}),_0x5a7624=_0x4abc81[_0x2fe63b(0x1ff)],_0x4fc9c5=await withSpinner(_0x2fe63b(0x141)+_0x4b009e+_0x2fe63b(0xf3),()=>_0x148f12[_0x2fe63b(0x1b4)][_0x2fe63b(0xbd)](_0x5a7624),{'verbose':_0x49207a[_0x2fe63b(0x136)]});let _0x3640c4=_0x4fc9c5[_0x2fe63b(0x1ff)];const _0x54d2e9=resolveLimit(_0x49207a[_0x2fe63b(0x1ea)],DEFAULT_DISPLAY_LIMIT),_0x170ac7=/\bLIMIT\s+\d+/i[_0x2fe63b(0x1b9)](_0x3640c4);!_0x170ac7&&(_0x3640c4=_0x3640c4['trim']()[_0x2fe63b(0x131)](/;+$/,''),_0x3640c4=_0x2fe63b(0x18f)+_0x3640c4+_0x2fe63b(0x102)+_0x54d2e9);_0x49207a[_0x2fe63b(0x136)]&&console[_0x2fe63b(0x187)](_0x2fe63b(0xe5)+_0x3640c4);const _0x4a844e=await withProgressSpinner(_0x2fe63b(0x140),async _0x24e167=>{const _0x537c94=_0x2fe63b,_0x31549f=await _0x148f12[_0x537c94(0x1a8)][_0x537c94(0xfa)](_0x3640c4,{'catalog':'td','schema':'information_schema','onJobId':_0x4e0512=>{const _0x14b1cf=_0x537c94;_0x24e167[_0x14b1cf(0x1ef)](_0x4e0512);}});return _0x31549f;},{'verbose':_0x49207a[_0x2fe63b(0x136)]}),_0x4b93b6=_0x4a844e['data'],_0x26d1cf=_0x4b93b6[_0x2fe63b(0x239)]?_0x2fe63b(0x17d)+_0x4b93b6[_0x2fe63b(0x239)]+']':'';return console['error'](_0x2fe63b(0xc4)+_0x4b93b6[_0x2fe63b(0xdd)][_0x2fe63b(0x19a)][_0x2fe63b(0x21a)]()+_0x2fe63b(0xce)+(_0x2fe63b(0xdc)+formatElapsed(_0x4b93b6[_0x2fe63b(0xdd)][_0x2fe63b(0x16d)])+_0x26d1cf)),await handleQueryOutput(_0x4b93b6,_0x49207a),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x1d5);['description']=a30_0x4fc0d8(0x1b7);async[a30_0x4fc0d8(0xfa)](_0x3607ef){const _0x1f5b6a=a30_0x4fc0d8,{options:_0x29d804,args:_0x1147a3,tdx:_0x37f316}=_0x3607ef,_0x5066c9=_0x1147a3[0x0],_0x4b995e=await withSpinner(_0x5066c9?_0x1f5b6a(0x229)+_0x5066c9+_0x1f5b6a(0xf3):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x37f316[_0x1f5b6a(0x212)][_0x1f5b6a(0x213)](),{'verbose':_0x29d804['verbose']});let _0x3174a4=_0x4b995e[_0x1f5b6a(0x1ff)][_0x1f5b6a(0x1b0)](_0x56e02e=>_0x56e02e['realtime_enabled']);if(_0x5066c9){const _0x35cee5=_0x5066c9['replace'](/[.+^${}()|[\]\\]/g,_0x1f5b6a(0x108))[_0x1f5b6a(0x131)](/\*/g,'.*')[_0x1f5b6a(0x131)](/\?/g,'.'),_0x3735b7=new RegExp('^'+_0x35cee5+'$','i');_0x3174a4=_0x3174a4[_0x1f5b6a(0x1b0)](_0x2a9c2c=>_0x3735b7[_0x1f5b6a(0x1b9)](_0x2a9c2c['name']));}_0x3174a4[_0x1f5b6a(0x21b)]((_0x374ed7,_0x518c24)=>_0x374ed7['name'][_0x1f5b6a(0x135)](_0x518c24[_0x1f5b6a(0x1a2)])),console['error']('✔\x20Found\x20'+_0x3174a4[_0x1f5b6a(0xd2)]+_0x1f5b6a(0x1b1)+(_0x3174a4[_0x1f5b6a(0xd2)]!==0x1?'s':''));const _0x52f13d=_0xba1ba9=>{const _0x1e850d=_0x1f5b6a;return getConsoleNextUrl(_0x29d804[_0x1e850d(0x22e)],_0x1e850d(0x1e4)+_0xba1ba9);};if(_0x29d804[_0x1f5b6a(0xf4)]===_0x1f5b6a(0x132)||_0x29d804['format']===_0x1f5b6a(0x18e)){const _0x27e860=_0x3174a4['map'](_0x160276=>({..._0x160276,'url':_0x52f13d(_0x160276['id'])}));await handleSDKOutput(_0x27e860,_0x29d804);}else{if(_0x3174a4[_0x1f5b6a(0xd2)]===0x0)console[_0x1f5b6a(0xe9)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x214071 of _0x3174a4){const _0x2389fd=_0x214071['population']?a30_0x51421d[_0x1f5b6a(0x15f)]('\x20('+formatRows(_0x214071[_0x1f5b6a(0x133)])+')'):'',_0x2fc0fd=hyperlink(_0x214071[_0x1f5b6a(0x1a2)],_0x52f13d(_0x214071['id']));console['log']('⚡\x20'+_0x2fc0fd+_0x2389fd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]='ps:rt:validate';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x1e5);async['execute'](_0x5973ba){const _0x37a13f=a30_0x4fc0d8,{options:_0x581d62,args:_0x5109b5,tdx:_0x276282}=_0x5973ba,_0x25c3cd=_0x5109b5[0x0]||_0x581d62[_0x37a13f(0x145)];if(!_0x25c3cd)return showParentSegmentNotSetError(_0x37a13f(0xdb)+_0x37a13f(0xd4)),0x1;const _0x2bb773=resolveYamlFile(_0x25c3cd);if(!existsSync(_0x2bb773))return showFileNotFoundError(_0x2bb773,_0x25c3cd),0x1;let _0x2f0f00;try{_0x2f0f00=readFileSync(_0x2bb773,_0x37a13f(0x167));}catch(_0x3d97e7){const _0x6a841a=_0x3d97e7 instanceof Error?_0x3d97e7[_0x37a13f(0x11d)]:String(_0x3d97e7);return console[_0x37a13f(0x187)]('Error\x20reading\x20file:\x20'+_0x6a841a),0x1;}const _0x1e1fb1=createCommandSpinner(a30_0x51421d[_0x37a13f(0x15f)](_0x37a13f(0x1dd)),{'verbose':_0x581d62[_0x37a13f(0x136)]});_0x1e1fb1['start']();const _0x2e2e99={'realtime':!![],'onProgress':_0x14c616=>{const _0x394a08=_0x37a13f;_0x1e1fb1[_0x394a08(0x238)]=formatProgressMessage(_0x14c616);}};let _0x381e0b;try{_0x381e0b=await _0x276282[_0x37a13f(0x1b4)][_0x37a13f(0x243)](_0x2f0f00,_0x2e2e99),_0x1e1fb1[_0x37a13f(0x1e2)]();}catch(_0x35c799){_0x1e1fb1[_0x37a13f(0x1e2)]();throw _0x35c799;}console['error']('\x0a'+a30_0x51421d[_0x37a13f(0xc5)]('RT\x202.0\x20Validate:')+'\x20'+_0x381e0b[_0x37a13f(0x1a2)]),console[_0x37a13f(0x187)]('═'[_0x37a13f(0x109)](0x3c)),displayRealtimeValidation(_0x381e0b),console[_0x37a13f(0x187)]('─'[_0x37a13f(0x109)](0x3c));if(_0x381e0b[_0x37a13f(0xfb)][_0x37a13f(0xd2)]>0x0){console[_0x37a13f(0x187)]('\x0a'+a30_0x51421d[_0x37a13f(0x10c)](_0x37a13f(0x23b)));for(const _0x3ffccf of _0x381e0b[_0x37a13f(0xfb)]){console['error']('\x20\x20'+a30_0x51421d[_0x37a13f(0x10c)]('•')+'\x20'+_0x3ffccf);}}return _0x381e0b[_0x37a13f(0x20c)]&&console[_0x37a13f(0x187)]('\x0a'+a30_0x51421d[_0x37a13f(0x16b)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x381e0b['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x15e);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x125);async['execute'](_0x21f46a){const _0x160e2b=a30_0x4fc0d8,{options:_0x39be5c,args:_0x501381,tdx:_0x54af35}=_0x21f46a,_0x53d325=_0x501381[0x0]||_0x39be5c[_0x160e2b(0x145)];if(!_0x53d325)return showParentSegmentNotSetError(_0x160e2b(0x222)+_0x160e2b(0x144)),0x1;const _0x3d4ca8=await withSpinner(_0x160e2b(0xc0)+_0x53d325+_0x160e2b(0xf3),()=>_0x54af35[_0x160e2b(0x1b4)]['resolveParentId'](_0x53d325),{'verbose':_0x39be5c['verbose']}),_0x55ff4d=_0x3d4ca8['data'],_0x42fdf8=await withSpinner(_0x160e2b(0xcb)+_0x53d325+_0x160e2b(0xf3),()=>_0x54af35[_0x160e2b(0x21f)][_0x160e2b(0x213)](_0x55ff4d),{'verbose':_0x39be5c[_0x160e2b(0x136)]}),_0x56f9b4=_0x42fdf8[_0x160e2b(0x1ff)];console[_0x160e2b(0x187)](_0x160e2b(0x1f3)+_0x56f9b4['length']+_0x160e2b(0x10b)+(_0x56f9b4[_0x160e2b(0xd2)]!==0x1?'s':''));if(_0x39be5c[_0x160e2b(0xf4)]==='json'||_0x39be5c['format']===_0x160e2b(0x18e))await handleSDKOutput(_0x56f9b4,_0x39be5c);else{if(_0x56f9b4[_0x160e2b(0xd2)]===0x0)console[_0x160e2b(0xe9)](_0x160e2b(0x15c)),console[_0x160e2b(0x187)](a30_0x51421d['cyan'](_0x160e2b(0x170)));else for(const _0x1ba343 of _0x56f9b4){const _0xcc06b1=_0x1ba343[_0x160e2b(0x231)]?.[_0x160e2b(0xd2)]||0x0,_0x5b4372=_0x1ba343[_0x160e2b(0xf0)]?a30_0x51421d[_0x160e2b(0x15f)]('\x20trigger='+_0x1ba343[_0x160e2b(0xf0)]):'',_0x1ddc8c=a30_0x51421d[_0x160e2b(0x15f)]('\x20('+_0xcc06b1+_0x160e2b(0x1f8)+(_0xcc06b1!==0x1?'s':'')+')');console[_0x160e2b(0xe9)]('\x20\x20'+_0x1ba343['name']+_0x5b4372+_0x1ddc8c),_0x1ba343['description']&&console['log']('\x20\x20\x20\x20'+a30_0x51421d[_0x160e2b(0x15f)](_0x1ba343[_0x160e2b(0x251)]));}}return 0x0;}}function a30_0x1520(_0x10785c,_0x181015){_0x10785c=_0x10785c-0xbd;const _0x2f93d6=a30_0x2f93();let _0x152011=_0x2f93d6[_0x10785c];return _0x152011;}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x250);[a30_0x4fc0d8(0x251)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async['execute'](_0x1125a9){const _0x3efdaf=a30_0x4fc0d8,{options:_0x4ac40b,args:_0x311e59}=_0x1125a9,_0x4e5b35=_0x311e59[0x0]||_0x4ac40b['parentSegment'];if(!_0x4e5b35)return showParentSegmentNotSetError('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'+_0x3efdaf(0x18d)),0x1;const _0x6e2b18=resolveYamlFile(_0x4e5b35);if(!existsSync(_0x6e2b18))return showFileNotFoundError(_0x6e2b18,_0x4e5b35),0x1;let _0x365425;try{_0x365425=readFileSync(_0x6e2b18,'utf-8');}catch(_0x230bf4){const _0x267c9e=_0x230bf4 instanceof Error?_0x230bf4['message']:String(_0x230bf4);return console[_0x3efdaf(0x187)]('Error\x20reading\x20file:\x20'+_0x267c9e),0x1;}let _0x252c6d;try{_0x252c6d=parseDef(_0x365425);}catch(_0xd10ea3){const _0x2f4053=_0xd10ea3 instanceof Error?_0xd10ea3[_0x3efdaf(0x11d)]:String(_0xd10ea3);return console[_0x3efdaf(0x187)](a30_0x51421d[_0x3efdaf(0x10c)](_0x3efdaf(0xd0)+_0x2f4053)),0x1;}if(_0x252c6d[_0x3efdaf(0x182)]&&_0x252c6d[_0x3efdaf(0x182)]['length']>0x0)return console['error'](a30_0x51421d[_0x3efdaf(0x24f)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x6e2b18)),console[_0x3efdaf(0x187)](a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0x150)+_0x252c6d[_0x3efdaf(0x182)][_0x3efdaf(0xd2)]+_0x3efdaf(0x195))),0x1;!_0x252c6d['realtime']&&(_0x252c6d[_0x3efdaf(0x212)]={'events':[{'name':_0x3efdaf(0x168),'source_table':_0x3efdaf(0x17b)}],'attributes':[{'name':_0x3efdaf(0x1b2),'type':_0x3efdaf(0x12c)}],'id_stitching':{'primary_key':_0x252c6d['master']['table']===_0x3efdaf(0x20a)?_0x3efdaf(0x1b5):_0x3efdaf(0x1e3)}});_0x252c6d['personalization_services']=[{'name':_0x3efdaf(0x142),'description':_0x3efdaf(0xea),'trigger_event':'page_view','sections':[{'name':'Default','criteria':_0x3efdaf(0x1ca),'attributes':['last_page_viewed']}]}];const _0x28f22c=serializeDef(_0x252c6d);return writeFileSync(_0x6e2b18,_0x28f22c,'utf-8'),console['error'](a30_0x51421d['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x51421d['cyan'](_0x6e2b18)),(!_0x252c6d[_0x3efdaf(0x212)]||_0x365425['indexOf'](_0x3efdaf(0x14b))===-0x1)&&console['error'](a30_0x51421d[_0x3efdaf(0x16b)]('✔')+_0x3efdaf(0x1d9)),console['error']('\x0a'+a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0xc2))),console[_0x3efdaf(0x187)]('\x20\x201.\x20Edit\x20'+_0x6e2b18+_0x3efdaf(0x11c)),console[_0x3efdaf(0x187)](_0x3efdaf(0x15d)+a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0x1c4)+_0x4e5b35)+_0x3efdaf(0x1ab)),0x0;}}
|
|
1
|
+
const a30_0x18fecb=a30_0xee43;(function(_0x32c534,_0x21151c){const _0x23584b=a30_0xee43,_0x53a52d=_0x32c534();while(!![]){try{const _0x399fc2=-parseInt(_0x23584b(0x288))/0x1*(-parseInt(_0x23584b(0x1ed))/0x2)+parseInt(_0x23584b(0x1b0))/0x3+parseInt(_0x23584b(0x17a))/0x4*(-parseInt(_0x23584b(0x23e))/0x5)+parseInt(_0x23584b(0x1bc))/0x6+-parseInt(_0x23584b(0x2a5))/0x7+parseInt(_0x23584b(0x1ff))/0x8*(parseInt(_0x23584b(0x235))/0x9)+parseInt(_0x23584b(0x240))/0xa*(parseInt(_0x23584b(0x256))/0xb);if(_0x399fc2===_0x21151c)break;else _0x53a52d['push'](_0x53a52d['shift']());}catch(_0x5728af){_0x53a52d['push'](_0x53a52d['shift']());}}}(a30_0x1ec4,0x618f9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x16185b 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 a30_0x2ae559 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=a30_0x18fecb(0x26e),LEGACY_PARENT_SEGMENT_DIR=a30_0x18fecb(0x13b);function openBrowser(_0x171e6e){const _0x5b8b8d=a30_0x18fecb,_0x4dcac4=process[_0x5b8b8d(0x21c)],_0x59a900=_0x4dcac4===_0x5b8b8d(0x239)?_0x5b8b8d(0x246):_0x4dcac4===_0x5b8b8d(0x1a8)?_0x5b8b8d(0x17c):_0x5b8b8d(0x27c);spawn(_0x59a900,[_0x171e6e],{'detached':!![],'stdio':'ignore'})[_0x5b8b8d(0x14e)]();}function migrateLegacyDirectory(){const _0x1f8f6a=a30_0x18fecb;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x585fe1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x585fe1[_0x1f8f6a(0x1c4)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x1bd)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x1d0)+PARENT_SEGMENT_DIR+_0x1f8f6a(0x1f9))),console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x2c4)](_0x1f8f6a(0x165)+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x150))),![];console['error'](a30_0x2ae559['yellow'](_0x1f8f6a(0x286)+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x29e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x297)](_0x1f8f6a(0x1e9)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x506f71){const _0x577b3c=_0x506f71 instanceof Error?_0x506f71[_0x1f8f6a(0x1c5)]:String(_0x506f71);return console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x20d)](_0x1f8f6a(0x151)+_0x577b3c+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x48e114){const _0x29aa05=a30_0x18fecb;return migrateLegacyDirectory(),super[_0x29aa05(0x28e)](_0x48e114);}}function a30_0x1ec4(){const _0x174987=['To\x20cancel:','td_client_id','ps:pz:list','\x20--behavior\x20\x22','\x0a\x20\x20]\x0a}\x0a','open','displayPreviewHints','behavior_','\x20Configuration\x20is\x20valid','segment:parent:desc','\x0a\x20\x20\x20\x20}','segment:parent:pull','Analyzing\x20changes...','Available\x20behaviors:','getParentSQL','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','timezone','No\x20RT-enabled\x20parent\x20segments\x20found','number','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x27\x20is\x20already\x20up\x20to\x20date','3278zDyJrr','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','filter','Enriched:','data','displayValidateResults','customers','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20kill','workflowAttemptId','RT\x202.0\x20Validate:','Found\x20YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','✔\x20Created\x20parent\x20segment\x20\x27','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','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Fetching\x20behavior\x20list...','/{name}.yml\x0a','reduce','attributes','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','setJobId','\x0a✔\x20Workflow\x20started','parent_segments','\x27\x20and\x20run\x20workflow?','query','My\x20Service','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Listing\x20parent\x20segments...','column_name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Output\x20file:\x20','limit','keys','Validating\x20configuration...','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','execute','xdg-open','log','list','interval','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','name','Events:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Apply\x20changes\x20to\x20\x27','{\x0a\x20\x20\x22database\x22:\x20\x22','\x0a⚠️\x20\x20Migrating:\x20','/app/dw/parentSegments/','151078MShNyO','workflowSessionId','Error\x20parsing\x20YAML:\x20','preview','match','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','run','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20--behavior\x20\x22<name>\x22','\x20to\x20configure\x20your\x20personalization\x20service','Name:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','To\x20view\x20sample\x20data:','\x20behaviors','\x0a\x20\x20\x20\x20]','green','stitchingKeys','/sessions/','Error:\x20File\x20not\x20found:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','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\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/\x20→\x20','format','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','map','displayPreviewResults','\x27...','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','4223632ZCIvXG','information_schema','segment:parent:validate','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','json','Validate:','SELECT\x20*\x20FROM\x20','single','.yaml','\x20Added\x20RT\x202.0\x20template\x20section','join','description','table','👥\x20','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','workflowId','customerPercent','Options\x20(one\x20required):\x0a','push','use','Creating\x20parent\x20segment\x20\x27','stats','using\x20the\x20default\x20path:\x20','Attempt:','Executing\x20parent\x20segment\x20query...','\x0aChanges\x20to\x20\x27','stop','previewParentYaml','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','type','dim','SQL\x20query:\x0a','Options:\x0a','-1d','\x20\x201.\x20Edit\x20','column','segment:parent:push','getParentFull','output','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','pullParentYaml','No\x20parent\x20segments\x20match\x20pattern:\x20','parent_segment','Attributes','\x20to\x20push\x20the\x20configuration','Behaviors','\x20\x20Tables:\x201\x20customers\x20+\x20','attribute','events','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20No\x20changes\x20-\x20','customerGroup','ps:pz:init','utf-8','getOutputDatabaseName','column_type','master','replace','behavior','errors','\x0aNew\x20parent\x20segment\x20\x27','unref','user_id','/\x20directory.\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','label','Updated','Errors:','addAttributes','\x20tdx\x20wf\x20attempt\x20','getBehaviorNames','formatSchemaJson','repeat','YAML\x20file:\x20','Schema\x20saved\x20to\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayBehaviorsStats','validateParentYaml','\x20trigger=','endsWith','segment:parent:run','displaySampleData','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','addBehaviorsFile','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Create\x20parent\x20segment\x20\x27','foreignKey','customerGroupFile','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','matchedCount','\x20\x20\x20\x20','localeCompare','Status:','enriched','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','sort','collectSchema','trim','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20is\x20already\x20up\x20to\x20date','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','apply','site','realtime_enabled','Attributes:','556IBaDLN','behaviors','start','Master\x20Table','Fetching\x20customers\x20schema...','FINISHED','displayColumns','true','segment:parent:update','No\x20parent\x20segments\x20found','toLowerCase','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20parent\x20segment','✔\x20Found\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','<database>.<table>','attributesFile','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','realtime','\x20rows)','\x20\x20\x20\x20-\x20','Updating','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','rowCount','database','Database:\x20','text','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0aNo\x20sample\x20data\x20available','length','yes','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','string','\x20\x202.\x20Run\x20','segment','Source:','displayAttributesStats','\x20total','trigger_event','\x5c$&','listParents','jsonl','Available\x20attributes:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','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','elapsedTimeMillis','win32','Columns:','Fetching\x20parent\x20segment\x20\x27','varchar','audienceId','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','scheduleOption','487617OMvBVi','Creating','coveragePercent','\x20personalization\x20service','Error:\x20--attribute\x20requires\x20a\x20name\x0a','personalization_services','tdx\x20ps\x20preview\x20','Fetching\x20sample\x20data...','Options:','Show\x20parent\x20segment\x20details','jobId','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','1238580PAyfKb','yellow','Rows:','Created','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','behaviorsFile','Listing\x20parent\x20segments\x20matching\x20\x27','addAttributesFile','isDirectory','message','\x20--enriched','dirname','Listing\x20RT-enabled\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Session:','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','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','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Next\x20steps:','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','/\x20and\x20','customersWithEvents','sourceTableError','Master:','\x20--attribute\x20\x22<name>\x22','verbose','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Site:\x20','cyan','web','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','displaySummary','all','session','displayRealtimeInfo','sourceTableValid','\x27\x20with\x20ID:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','ps:rt:list','createParent','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','pushParentYaml','%)\x20','✔\x20Renamed\x20directory\x20to\x20','allValid','scheduleType','schemaError','2lGAbru','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','addBehaviors','/attempt/','✔\x20No\x20changes\x20-\x20\x27','\x0aChanges\x20to\x20apply\x20to\x20\x27','sampleData','Aborted.','\x20=\x20','error','\x20rows\x20','Parent\x20segment:\x20','/\x20directories\x20exist.','\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','/app/workflows/','\x20Added\x20personalization\x20template\x20to\x20','Updating\x20parent\x20segment\x20\x27','columns','459880HJszeB','idStitching','Overwrite\x20\x27','Attribute:','Error\x20reading\x20file:\x20','\x20--attribute\x20\x22','\x20\x20No\x20sample\x20data\x20available','segment:parent:create','Join\x20on:','joinKey','displayMasterInfo','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x0aError:','Fetching\x20SQL\x20for\x20\x27','red','Default','Customers:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','personalizationServices','segment:parent:show','\x20\x20Note:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20\x20\x20\x20','parentSegment','test','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','last_page_viewed','resolveParentId','\x20RT-enabled\x20parent\x20segment','platform','\x20RT\x20configuration\x20is\x20valid','segment:parent:view','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','page_view','schemaValid','Resolving\x20parent\x20segment\x20\x27','Listing\x20fields\x20for\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Preview:','\x20\x20Database:\x20','realtime:','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','\x20parent\x20segment\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','toLocaleString','⚡\x20Enabled','\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','totalEvents','processedRows','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','toFixed','\x20configured','\x20--interval\x20','27erDgJk','.yml','Error:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','darwin','\x20Context\x20set:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','bold','Master\x20+\x20Attributes','21365GDpEZb','Join:','30350twluFN'];a30_0x1ec4=function(){return _0x174987;};return a30_0x1ec4();}function resolveYamlFile(_0x6fd40d){const _0x1e2e54=a30_0x18fecb;if(_0x6fd40d[_0x1e2e54(0x160)](_0x1e2e54(0x236))||_0x6fd40d[_0x1e2e54(0x160)](_0x1e2e54(0x2ae)))return _0x6fd40d;return a30_0x16185b[_0x1e2e54(0x2b0)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x6fd40d)+_0x1e2e54(0x236));}function formatProgressMessage(_0x120668){const _0x2f05bc=a30_0x18fecb,_0x514aa8=_0x120668[_0x2f05bc(0x28c)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x514aa8){const [,_0x23ebad,_0x40fc20,_0x1789c6='']=_0x514aa8;return a30_0x2ae559[_0x2f05bc(0x2c4)](_0x23ebad+':')+'\x20'+_0x40fc20+a30_0x2ae559[_0x2f05bc(0x2c4)](_0x1789c6);}return a30_0x2ae559[_0x2f05bc(0x2c4)](_0x120668);}function showFileNotFoundError(_0x236ffb,_0x58a3dd){const _0x40891a=a30_0x18fecb;console[_0x40891a(0x1f6)](a30_0x2ae559[_0x40891a(0x20d)](_0x40891a(0x29a)+_0x236ffb+'\x0a')),console['error'](a30_0x2ae559[_0x40891a(0x1da)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x58a3dd+_0x40891a(0x265)));}function displayRealtimeValidation(_0x43674e){const _0x4b6d59=a30_0x18fecb;if(!_0x43674e[_0x4b6d59(0x18c)])return;const _0x41755d=_0x43674e['realtime'],_0x22a55b=_0x41755d['enabled']?a30_0x2ae559[_0x4b6d59(0x297)](_0x4b6d59(0x22d)):a30_0x2ae559[_0x4b6d59(0x1bd)]('⚡\x20Not\x20enabled');console[_0x4b6d59(0x1f6)]('\x0a'+a30_0x2ae559[_0x4b6d59(0x2c4)]('RT\x202.0:')+'\x20'+_0x22a55b);if(_0x41755d['events']&&_0x41755d['events'][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4b6d59(0x2c4)](_0x4b6d59(0x282))+'\x20'+_0x41755d[_0x4b6d59(0x141)][_0x4b6d59(0x197)]+_0x4b6d59(0x233));for(const _0x551051 of _0x41755d[_0x4b6d59(0x141)]){const _0x34fccd=_0x551051[_0x4b6d59(0x1e1)]===![]?a30_0x2ae559[_0x4b6d59(0x20d)]('✘'):a30_0x2ae559[_0x4b6d59(0x297)]('✔');console[_0x4b6d59(0x1f6)](_0x4b6d59(0x16b)+_0x34fccd+'\x20'+_0x551051[_0x4b6d59(0x281)]),_0x551051['sourceTableError']&&console[_0x4b6d59(0x1f6)](_0x4b6d59(0x215)+a30_0x2ae559[_0x4b6d59(0x20d)](_0x551051[_0x4b6d59(0x1d2)]));}}if(_0x41755d[_0x4b6d59(0x26a)]&&_0x41755d[_0x4b6d59(0x26a)][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559['dim'](_0x4b6d59(0x179))+'\x20'+_0x41755d['attributes'][_0x4b6d59(0x197)]+_0x4b6d59(0x233));for(const _0x20e5d7 of _0x41755d[_0x4b6d59(0x26a)]){const _0x5d6df2=_0x20e5d7['valid']?a30_0x2ae559[_0x4b6d59(0x297)]('✔'):a30_0x2ae559['red']('✘');console[_0x4b6d59(0x1f6)](_0x4b6d59(0x16b)+_0x5d6df2+'\x20'+_0x20e5d7['name']+'\x20'+a30_0x2ae559['dim']('('+_0x20e5d7[_0x4b6d59(0x2c3)]+')'));}}if(_0x41755d['idStitching']){const _0x529143=_0x41755d[_0x4b6d59(0x200)][_0x4b6d59(0x298)]?.[_0x4b6d59(0x197)]?'\x20+\x20['+_0x41755d['idStitching'][_0x4b6d59(0x298)]['join'](',\x20')+']':'';console['error']('\x20\x20'+a30_0x2ae559[_0x4b6d59(0x2c4)]('ID\x20Stitching:')+'\x20'+_0x41755d[_0x4b6d59(0x200)]['primaryKey']+_0x529143);}if(_0x41755d[_0x4b6d59(0x211)]&&_0x41755d['personalizationServices'][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('Personalization:')+'\x20'+_0x41755d[_0x4b6d59(0x211)]['length']+'\x20service'+(_0x41755d[_0x4b6d59(0x211)][_0x4b6d59(0x197)]!==0x1?'s':''));for(const _0x2bf66b of _0x41755d[_0x4b6d59(0x211)]){console[_0x4b6d59(0x1f6)](_0x4b6d59(0x18e)+_0x2bf66b['name']);}}}function showParentSegmentNotSetError(_0x3b09e2){const _0x557032=a30_0x18fecb;console[_0x557032(0x1f6)](a30_0x2ae559[_0x557032(0x1bd)](_0x557032(0x238))),console['error'](_0x3b09e2);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x18fecb(0x281)]='segment:parent:list';[a30_0x18fecb(0x2b1)]='List\x20parent\x20segments';async[a30_0x18fecb(0x27b)](_0x37c802){const _0x2f6edf=a30_0x18fecb,{options:_0x5124c7,args:_0x362acf,tdx:_0x4be21a}=_0x37c802,_0x66e38d=_0x362acf[0x0];_0x5124c7[_0x2f6edf(0x1d5)]&&(console[_0x2f6edf(0x1f6)]('Site:\x20'+_0x5124c7[_0x2f6edf(0x177)]),_0x66e38d&&console[_0x2f6edf(0x1f6)]('Pattern:\x20'+_0x66e38d));const _0x298cf3=await withSpinner(_0x66e38d?_0x2f6edf(0x1c2)+_0x66e38d+'\x27...':_0x2f6edf(0x273),()=>_0x4be21a['segment'][_0x2f6edf(0x1a2)](),{'verbose':_0x5124c7[_0x2f6edf(0x1d5)]});let _0x307a6f=_0x298cf3[_0x2f6edf(0x25a)];if(_0x66e38d){const _0x293c88=_0x66e38d['replace'](/[.+^${}()|[\]\\]/g,_0x2f6edf(0x1a1))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x58a862=new RegExp('^'+_0x293c88+'$','i');_0x307a6f=_0x307a6f['filter'](_0x40d59f=>_0x58a862[_0x2f6edf(0x217)](_0x40d59f[_0x2f6edf(0x26a)][_0x2f6edf(0x281)]));}_0x307a6f[_0x2f6edf(0x170)]((_0x4ed63b,_0x3acfbf)=>_0x4ed63b['attributes'][_0x2f6edf(0x281)][_0x2f6edf(0x16c)](_0x3acfbf[_0x2f6edf(0x26a)][_0x2f6edf(0x281)])),console['error'](_0x2f6edf(0x187)+_0x307a6f[_0x2f6edf(0x197)]+_0x2f6edf(0x186)+(_0x307a6f[_0x2f6edf(0x197)]!==0x1?'s':''));const _0x71453c=_0x5dbb4d=>{const _0x5ec683=_0x2f6edf;return getConsoleNextUrl(_0x5124c7[_0x5ec683(0x177)],_0x5ec683(0x287)+_0x5dbb4d);};if(_0x5124c7['format']===_0x2f6edf(0x2aa)||_0x5124c7[_0x2f6edf(0x29f)]===_0x2f6edf(0x1a3)){const _0x3d1876=_0x307a6f[_0x2f6edf(0x2a1)](_0x354278=>({..._0x354278,'url':_0x71453c(_0x354278['id'])}));await handleSDKOutput(_0x3d1876,_0x5124c7);}else{if(_0x307a6f[_0x2f6edf(0x197)]===0x0)_0x66e38d?console[_0x2f6edf(0x27d)](_0x2f6edf(0x13a)+_0x66e38d):console['log'](_0x2f6edf(0x183));else for(const _0x4ff840 of _0x307a6f){const _0x4ecf8d=_0x4ff840[_0x2f6edf(0x26a)]['population']?a30_0x2ae559[_0x2f6edf(0x2c4)]('\x20('+formatRows(_0x4ff840[_0x2f6edf(0x26a)]['population'])+')'):'',_0x2b761a=hyperlink(_0x4ff840[_0x2f6edf(0x26a)][_0x2f6edf(0x281)],_0x71453c(_0x4ff840['id']));console[_0x2f6edf(0x27d)](_0x2f6edf(0x2b3)+_0x2b761a+_0x4ecf8d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x206);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1cd);async['execute'](_0x53d4ba){const _0x38fcf2=a30_0x18fecb,{options:_0x1438b6,args:_0x5a165f,tdx:_0x336531}=_0x53d4ba;console[_0x38fcf2(0x1f6)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x38fcf2(0x138)+_0x38fcf2(0x29d));const _0x593ca4=_0x1438b6;if(_0x5a165f[_0x38fcf2(0x197)]===0x0)return console[_0x38fcf2(0x1f6)](a30_0x2ae559[_0x38fcf2(0x20d)](_0x38fcf2(0x225))),console['error'](_0x38fcf2(0x190)),0x1;const _0x1b2030=_0x5a165f[0x0];if(!_0x593ca4[_0x38fcf2(0x192)]||!_0x593ca4[_0x38fcf2(0x2b2)])return console[_0x38fcf2(0x1f6)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x38fcf2(0x1f6)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x593ca4['verbose']&&(console['error'](_0x38fcf2(0x1d9)+_0x593ca4[_0x38fcf2(0x177)]),console[_0x38fcf2(0x1f6)](_0x38fcf2(0x292)+_0x1b2030),console[_0x38fcf2(0x1f6)](_0x38fcf2(0x193)+_0x593ca4[_0x38fcf2(0x192)]),console['error']('Table:\x20'+_0x593ca4[_0x38fcf2(0x2b2)]));const _0x446a98=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x26a)],_0x593ca4[_0x38fcf2(0x18a)]),_0x488eef=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x17b)],_0x593ca4[_0x38fcf2(0x1c1)]),_0x1f7e02=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x144)],_0x593ca4[_0x38fcf2(0x168)]),_0x229cb3={'name':_0x1b2030,'description':_0x593ca4['description'],'scheduleType':_0x593ca4['scheduleType'],'scheduleOption':_0x593ca4[_0x38fcf2(0x1af)],'timezone':_0x593ca4['timezone'],'master':{'parentDatabaseName':_0x593ca4[_0x38fcf2(0x192)],'parentTableName':_0x593ca4[_0x38fcf2(0x2b2)]},'attributes':_0x446a98,'behaviors':_0x488eef,'customerGroup':_0x1f7e02},_0x45d167=await withSpinner(_0x38fcf2(0x2ba)+_0x1b2030+_0x38fcf2(0x2a3),()=>_0x336531[_0x38fcf2(0x19c)][_0x38fcf2(0x1e5)](_0x229cb3),{'verbose':_0x1438b6[_0x38fcf2(0x1d5)]}),_0x47a43c=_0x45d167[_0x38fcf2(0x25a)];return console['error'](_0x38fcf2(0x263)+_0x47a43c['name']+_0x38fcf2(0x1e2)+_0x47a43c['id']),await handleSDKOutput([_0x47a43c],_0x1438b6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x182);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x210);async['execute'](_0x2a9c85){const _0x14636e=a30_0x18fecb,{options:_0x28acbf,args:_0x484688,tdx:_0x4a645b}=_0x2a9c85;console[_0x14636e(0x1f6)](_0x14636e(0x1a5)+_0x14636e(0x138)+_0x14636e(0x29d));const _0x24d3b6=_0x28acbf;if(_0x484688[_0x14636e(0x197)]===0x0)return console[_0x14636e(0x1f6)](a30_0x2ae559[_0x14636e(0x20d)](_0x14636e(0x225))),console['error'](_0x14636e(0x2a4)),0x1;const _0x3b71cd=_0x484688[0x0];_0x24d3b6[_0x14636e(0x1d5)]&&(console[_0x14636e(0x1f6)](_0x14636e(0x1d9)+_0x24d3b6[_0x14636e(0x177)]),console[_0x14636e(0x1f6)]('Parent\x20segment:\x20'+_0x3b71cd));const _0x878f5e=await withSpinner(_0x14636e(0x214)+_0x3b71cd+_0x14636e(0x2a3),()=>_0x4a645b[_0x14636e(0x19c)][_0x14636e(0x136)](_0x3b71cd),{'verbose':_0x24d3b6[_0x14636e(0x1d5)]}),_0x387f12=_0x878f5e['data'],_0x33f73c=await loadJSONFromOptions(_0x24d3b6[_0x14636e(0x155)],_0x24d3b6[_0x14636e(0x1c3)]),_0x38b27e=await loadJSONFromOptions(_0x24d3b6[_0x14636e(0x1ef)],_0x24d3b6[_0x14636e(0x164)]),_0x12f237={'name':_0x387f12[_0x14636e(0x281)],'description':_0x24d3b6[_0x14636e(0x2b1)]!==undefined?_0x24d3b6[_0x14636e(0x2b1)]:_0x387f12[_0x14636e(0x2b1)],'scheduleType':_0x24d3b6[_0x14636e(0x1eb)]!==undefined?_0x24d3b6[_0x14636e(0x1eb)]:_0x387f12[_0x14636e(0x1eb)],'scheduleOption':_0x24d3b6['scheduleOption']!==undefined?_0x24d3b6['scheduleOption']:_0x387f12[_0x14636e(0x1af)],'timezone':_0x24d3b6['timezone']!==undefined?_0x24d3b6[_0x14636e(0x251)]:_0x387f12[_0x14636e(0x251)],'master':_0x387f12[_0x14636e(0x149)],'attributes':_0x33f73c?[..._0x387f12['attributes']||[],..._0x33f73c]:_0x387f12[_0x14636e(0x26a)],'behaviors':_0x38b27e?[..._0x387f12[_0x14636e(0x17b)]||[],..._0x38b27e]:_0x387f12['behaviors'],'customerGroup':_0x387f12[_0x14636e(0x144)]},_0xfda497=await withSpinner(_0x14636e(0x1fd)+_0x3b71cd+_0x14636e(0x2a3),()=>_0x4a645b['segment']['updateParent'](_0x3b71cd,_0x12f237),{'verbose':_0x24d3b6[_0x14636e(0x1d5)]}),_0x40e045=_0xfda497[_0x14636e(0x25a)];return console[_0x14636e(0x1f6)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x40e045[_0x14636e(0x281)]+'\x27'),await handleSDKOutput([_0x40e045],_0x24d3b6),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x24c);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1d7);async[a30_0x18fecb(0x27b)](_0x44a916){const _0x6cca1c=a30_0x18fecb,{options:_0x541583,args:_0x20f07f,tdx:_0x7bd658}=_0x44a916,_0x415013=_0x541583,_0x4598c3=_0x20f07f[0x0]||_0x541583[_0x6cca1c(0x216)];if(!_0x4598c3)return showParentSegmentNotSetError(_0x6cca1c(0x1c9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x415013[_0x6cca1c(0x2b9)]&&_0x415013[_0x6cca1c(0x137)])return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x20d)](_0x6cca1c(0x254))),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x2c4)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a30_0x2ae559[_0x6cca1c(0x2c4)](_0x6cca1c(0x2bc)+PARENT_SEGMENT_DIR+_0x6cca1c(0x268))),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x1da)](_0x6cca1c(0x283))),0x1;const _0x3b700b=_0x415013[_0x6cca1c(0x137)]||a30_0x16185b[_0x6cca1c(0x2b0)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4598c3)+_0x6cca1c(0x236));_0x415013[_0x6cca1c(0x1d5)]&&(console['error'](_0x6cca1c(0x1d9)+_0x415013[_0x6cca1c(0x177)]),console['error'](_0x6cca1c(0x1f8)+_0x4598c3),console[_0x6cca1c(0x1f6)](_0x6cca1c(0x276)+_0x3b700b));const _0x502c51=await withSpinner(_0x6cca1c(0x1aa)+_0x4598c3+'\x27...',()=>_0x7bd658[_0x6cca1c(0x19c)][_0x6cca1c(0x139)](_0x4598c3),{'verbose':_0x415013['verbose']}),_0x5bc8c5=_0x502c51[_0x6cca1c(0x25a)];if(existsSync(_0x3b700b)){const _0x15c709=readFileSync(_0x3b700b,_0x6cca1c(0x146)),_0x4d2c74=generateDiff(_0x15c709,_0x5bc8c5);if(!hasChanges(_0x4d2c74))console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+_0x6cca1c(0x143)+a30_0x2ae559[_0x6cca1c(0x1da)](_0x3b700b)+_0x6cca1c(0x174));else{console['error'](_0x6cca1c(0x2bf)+_0x3b700b+'\x27:'),console[_0x6cca1c(0x1f6)]('─'[_0x6cca1c(0x159)](0x3c)),console[_0x6cca1c(0x1f6)](formatDiffWithColors(_0x4d2c74)),console[_0x6cca1c(0x1f6)]('─'[_0x6cca1c(0x159)](0x3c));if(!_0x415013[_0x6cca1c(0x198)]){if(!isInteractive())return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x20d)](_0x6cca1c(0x20b)),_0x6cca1c(0x1ee)),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x2c4)](_0x6cca1c(0x188))),0x1;const _0x410ee2=await confirmKey(_0x6cca1c(0x201)+_0x3b700b+'\x27?');if(!_0x410ee2)return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x1bd)]('Aborted.')),0x1;}writeFileSync(_0x3b700b,_0x5bc8c5,_0x6cca1c(0x146)),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x2ae559['cyan'](_0x3b700b));}}else{const _0x3b71d2=a30_0x16185b[_0x6cca1c(0x1c7)](_0x3b700b);!existsSync(_0x3b71d2)&&mkdirSync(_0x3b71d2,{'recursive':!![]}),writeFileSync(_0x3b700b,_0x5bc8c5,'utf-8'),console[_0x6cca1c(0x1f6)](a30_0x2ae559['green']('✔')+_0x6cca1c(0x250)+a30_0x2ae559[_0x6cca1c(0x1da)](_0x3b700b));}return saveSessionContext({'parent_segment':_0x4598c3},_0x415013[_0x6cca1c(0x1df)]),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+_0x6cca1c(0x23a)+a30_0x2ae559[_0x6cca1c(0x2c4)]('parent_segment')+'\x20=\x20'+a30_0x2ae559[_0x6cca1c(0x1da)](_0x4598c3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x135);[a30_0x18fecb(0x2b1)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x2fe29a){const _0x429781=a30_0x18fecb,{options:_0x96cdad,args:_0x3781a4,tdx:_0x4eca75}=_0x2fe29a,_0x25535e=_0x96cdad,_0x3e7a4a=_0x3781a4[0x0]||_0x96cdad[_0x429781(0x216)];if(!_0x3e7a4a)return showParentSegmentNotSetError(_0x429781(0x264)+_0x429781(0x195)),0x1;const _0xbf1328=resolveYamlFile(_0x3e7a4a);if(!existsSync(_0xbf1328))return showFileNotFoundError(_0xbf1328,_0x3e7a4a),0x1;_0x25535e[_0x429781(0x1d5)]&&(console[_0x429781(0x1f6)]('Site:\x20'+_0x25535e[_0x429781(0x177)]),console[_0x429781(0x1f6)](_0x429781(0x15a)+_0xbf1328));let _0x6be563;try{_0x6be563=readFileSync(_0xbf1328,_0x429781(0x146));}catch(_0x256213){const _0x2a8d72=_0x256213 instanceof Error?_0x256213[_0x429781(0x1c5)]:String(_0x256213);return console['error'](_0x429781(0x203)+_0x2a8d72),0x1;}const _0xcc9980=await withSpinner('Analyzing\x20changes...',()=>_0x4eca75[_0x429781(0x19c)][_0x429781(0x1e7)](_0x6be563),{'verbose':_0x25535e[_0x429781(0x1d5)]}),_0x2c714d=_0xcc9980[_0x429781(0x25a)],{isNew:_0x378699,name:_0x9374b4,hasChanges:_0x26ace7,diffFormatted:_0x334b7c}=_0x2c714d;if(!_0x26ace7)return console[_0x429781(0x1f6)](_0x429781(0x1f1)+_0x9374b4+_0x429781(0x255)),0x0;_0x378699?console['error'](_0x429781(0x14d)+_0x9374b4+'\x27:'):console['error'](_0x429781(0x1f2)+_0x9374b4+'\x27:');console['error']('─'[_0x429781(0x159)](0x3c)),console[_0x429781(0x1f6)](_0x334b7c),console[_0x429781(0x1f6)]('─'[_0x429781(0x159)](0x3c));const _0x2e4ad1=_0x378699?_0x429781(0x166)+_0x9374b4+'\x27?':_0x429781(0x284)+_0x9374b4+'\x27?';if(!_0x25535e['yes']){if(!isInteractive())return console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x20d)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x2c4)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x129cfc=await confirmKey(_0x2e4ad1);if(!_0x129cfc)return console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x1bd)](_0x429781(0x1f4))),0x1;}const _0x15f603=_0x378699?_0x429781(0x1b1):_0x429781(0x18f),_0x4ad61a=await withSpinner(_0x15f603+_0x429781(0x22a)+_0x9374b4+_0x429781(0x2a3),()=>_0x2c714d[_0x429781(0x176)](),{'verbose':_0x25535e[_0x429781(0x1d5)]}),_0x23186d=_0x4ad61a['data'],_0x39d0f9=getConsoleNextUrl(_0x25535e[_0x429781(0x177)],_0x429781(0x287)+_0x23186d['id']),_0x33bab7=_0x378699?_0x429781(0x1bf):'Updated';return console[_0x429781(0x1f6)]('✔\x20'+_0x33bab7+_0x429781(0x22a)+_0x23186d[_0x429781(0x281)]+'\x27'),console[_0x429781(0x1f6)]('\x20\x20'+_0x39d0f9),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x18fecb(0x2a7);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1c0);async[a30_0x18fecb(0x27b)](_0x48c2a1){const _0x221d23=a30_0x18fecb,{options:_0x244112,args:_0x174ed6,tdx:_0x318b52}=_0x48c2a1,_0x4c02ab=_0x244112,_0x57ff33=_0x174ed6[0x0]||_0x244112[_0x221d23(0x216)];if(!_0x57ff33)return showParentSegmentNotSetError(_0x221d23(0x15c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x221d23(0x2c6)+_0x221d23(0x1d6)+_0x221d23(0x175)+_0x221d23(0x18b)),0x1;const _0x4d846b=resolveYamlFile(_0x57ff33);if(!existsSync(_0x4d846b))return showFileNotFoundError(_0x4d846b,_0x57ff33),0x1;_0x4c02ab[_0x221d23(0x1d5)]&&(console[_0x221d23(0x1f6)](_0x221d23(0x1d9)+_0x4c02ab[_0x221d23(0x177)]),console[_0x221d23(0x1f6)]('YAML\x20file:\x20'+_0x4d846b));let _0x2e20b8;try{_0x2e20b8=readFileSync(_0x4d846b,'utf-8');}catch(_0xbaae2f){const _0x10c051=_0xbaae2f instanceof Error?_0xbaae2f[_0x221d23(0x1c5)]:String(_0xbaae2f);return console['error'](_0x221d23(0x203)+_0x10c051),0x1;}const _0x574a18=createCommandSpinner(a30_0x2ae559[_0x221d23(0x2c4)](_0x221d23(0x279)),{'verbose':_0x4c02ab[_0x221d23(0x1d5)]});_0x574a18[_0x221d23(0x17c)]();const _0x525b33={'onProgress':_0x330a41=>{_0x574a18['text']=formatProgressMessage(_0x330a41);}};if(_0x4c02ab['master'])_0x525b33[_0x221d23(0x149)]=!![];if(_0x4c02ab['enriched'])_0x525b33[_0x221d23(0x16e)]=!![];_0x4c02ab[_0x221d23(0x140)]&&(_0x525b33[_0x221d23(0x140)]=_0x4c02ab[_0x221d23(0x140)]);_0x4c02ab[_0x221d23(0x14b)]&&(_0x525b33[_0x221d23(0x14b)]=_0x4c02ab[_0x221d23(0x14b)]);if(_0x4c02ab['interval'])_0x525b33[_0x221d23(0x27f)]=_0x4c02ab[_0x221d23(0x27f)];let _0x4b24e9;try{_0x4b24e9=await _0x318b52[_0x221d23(0x19c)][_0x221d23(0x15e)](_0x2e20b8,_0x525b33),_0x574a18['stop']();}catch(_0x159b67){_0x574a18[_0x221d23(0x2c0)]();throw _0x159b67;}const _0x5192e9=_0x4c02ab['interval']||_0x221d23(0x2c7);return this[_0x221d23(0x25b)](_0x4b24e9,_0x525b33,_0x4d846b,_0x5192e9),_0x4b24e9[_0x221d23(0x1ea)]?0x0:0x1;}[a30_0x18fecb(0x25b)](_0x16c38f,_0x1fe9ac,_0x5bc87f,_0x4725cb){const _0x55d97a=a30_0x18fecb;console[_0x55d97a(0x1f6)]('\x0a'+a30_0x2ae559['bold'](_0x55d97a(0x2ab))+'\x20'+_0x16c38f[_0x55d97a(0x281)]),console[_0x55d97a(0x1f6)]('═'[_0x55d97a(0x159)](0x3c)),this['displayMasterInfo'](_0x16c38f);if(typeof _0x1fe9ac[_0x55d97a(0x140)]==='string'){this[_0x55d97a(0x19e)](_0x16c38f),this[_0x55d97a(0x1dd)](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x140),_0x1fe9ac[_0x55d97a(0x140)]);return;}if(_0x1fe9ac[_0x55d97a(0x140)]===!![]){this[_0x55d97a(0x19e)](_0x16c38f),this['displaySummary'](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x26a));return;}if(typeof _0x1fe9ac[_0x55d97a(0x14b)]==='string'){this['displayBehaviorsStats'](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1dd)](_0x16c38f),this['displayPreviewHints'](_0x5bc87f,_0x4725cb,_0x55d97a(0x14b),_0x1fe9ac[_0x55d97a(0x14b)]);return;}if(_0x1fe9ac[_0x55d97a(0x14b)]===!![]){this[_0x55d97a(0x15d)](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1dd)](_0x16c38f),this['displayPreviewHints'](_0x5bc87f,_0x4725cb,'behaviors');return;}this[_0x55d97a(0x19e)](_0x16c38f),this['displayBehaviorsStats'](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1e0)](_0x16c38f),this['displaySummary'](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x1de));}[a30_0x18fecb(0x1e0)](_0x141571){displayRealtimeValidation(_0x141571);}[a30_0x18fecb(0x247)](_0x45d8ee,_0x1d56d2,_0x524005,_0xcd0713){const _0x4d3f2e=a30_0x18fecb;console[_0x4d3f2e(0x1f6)]('\x0a'+a30_0x2ae559[_0x4d3f2e(0x2c4)](_0x4d3f2e(0x294)));const _0x2f6f01=_0x1d56d2!==_0x4d3f2e(0x2c7)?_0x4d3f2e(0x234)+_0x1d56d2:'';if(_0x524005===_0x4d3f2e(0x140)&&_0xcd0713)console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('tdx\x20ps\x20preview\x20'+_0x45d8ee+_0x4d3f2e(0x204)+_0xcd0713+'\x22'+_0x2f6f01));else{if(_0x524005===_0x4d3f2e(0x14b)&&_0xcd0713)console['error']('\x20\x20'+a30_0x2ae559['dim'](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x244)+_0xcd0713+'\x22'+_0x2f6f01));else(_0x524005===_0x4d3f2e(0x26a)||_0x524005==='all')&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559['dim'](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x1d4)+_0x2f6f01));}(_0x524005===_0x4d3f2e(0x17b)||_0x524005===_0x4d3f2e(0x1de))&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4d3f2e(0x2c4)](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x290)+_0x2f6f01)),_0x524005===_0x4d3f2e(0x1de)&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4d3f2e(0x2c4)]('tdx\x20ps\x20preview\x20'+_0x45d8ee+_0x4d3f2e(0x1c6)+_0x2f6f01));}[a30_0x18fecb(0x209)](_0x262ef5){const _0xdeccdc=a30_0x18fecb,{master:_0x147e57}=_0x262ef5,_0x3befb3=_0x147e57['schemaValid']?a30_0x2ae559['green']('✔'):a30_0x2ae559['red']('✘');console[_0xdeccdc(0x1f6)]('\x0a'+a30_0x2ae559[_0xdeccdc(0x2c4)](_0xdeccdc(0x17d))),console[_0xdeccdc(0x1f6)](_0x3befb3+'\x20'+a30_0x2ae559[_0xdeccdc(0x23c)](_0x147e57[_0xdeccdc(0x192)]+'.'+_0x147e57[_0xdeccdc(0x2b2)])),_0x147e57[_0xdeccdc(0x221)]?_0x147e57[_0xdeccdc(0x191)]!==undefined&&console[_0xdeccdc(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xdeccdc(0x2c4)](_0xdeccdc(0x1be))+'\x20'+a30_0x2ae559['cyan'](formatRows(_0x147e57['rowCount']))):console['error']('\x20\x20'+a30_0x2ae559['red'](_0xdeccdc(0x237))+'\x20'+_0x147e57[_0xdeccdc(0x1ec)]);}[a30_0x18fecb(0x19e)](_0x23de95){const _0x4f3917=a30_0x18fecb;if(_0x23de95[_0x4f3917(0x26a)][_0x4f3917(0x197)]===0x0)return;console[_0x4f3917(0x1f6)]('\x0a'+a30_0x2ae559['dim'](_0x4f3917(0x13c)));for(const _0x3abeb0 of _0x23de95[_0x4f3917(0x26a)]){const _0x1050fa=_0x3abeb0[_0x4f3917(0x221)]?a30_0x2ae559[_0x4f3917(0x297)]('✔'):a30_0x2ae559[_0x4f3917(0x20d)]('✘');let _0x22d6c6='';if(_0x3abeb0['schemaValid']&&_0x3abeb0[_0x4f3917(0x16a)]!==undefined&&_0x3abeb0[_0x4f3917(0x1b2)]!==undefined){const _0x155946=_0x3abeb0[_0x4f3917(0x1b2)][_0x4f3917(0x232)](0x1),_0x1dffe0=_0x3abeb0[_0x4f3917(0x1b2)]>=0x50?a30_0x2ae559[_0x4f3917(0x297)]:_0x3abeb0[_0x4f3917(0x1b2)]>=0x32?a30_0x2ae559[_0x4f3917(0x1bd)]:a30_0x2ae559[_0x4f3917(0x20d)];_0x22d6c6='\x20'+a30_0x2ae559[_0x4f3917(0x2c4)]('Coverage:')+'\x20'+_0x1dffe0(_0x155946+'%')+'\x20('+formatRows(_0x3abeb0[_0x4f3917(0x16a)])+_0x4f3917(0x18d);}console[_0x4f3917(0x1f6)](_0x1050fa+'\x20'+a30_0x2ae559['bold'](_0x3abeb0[_0x4f3917(0x281)])+_0x22d6c6),console['error']('\x20\x20'+a30_0x2ae559[_0x4f3917(0x2c4)]('Source:')+'\x20'+a30_0x2ae559[_0x4f3917(0x23c)](_0x3abeb0['database']+'.'+_0x3abeb0['table']));const _0x418a93=_0x3abeb0['joinKey']===_0x3abeb0[_0x4f3917(0x167)]?a30_0x2ae559[_0x4f3917(0x2c4)](_0x4f3917(0x207))+'\x20'+_0x3abeb0['joinKey']:a30_0x2ae559[_0x4f3917(0x2c4)](_0x4f3917(0x23f))+'\x20'+_0x3abeb0[_0x4f3917(0x208)]+_0x4f3917(0x1f5)+_0x3abeb0[_0x4f3917(0x167)];console['error']('\x20\x20'+_0x418a93),console['error']('\x20\x20'+a30_0x2ae559['dim'](_0x4f3917(0x1a9))),this[_0x4f3917(0x180)](_0x3abeb0[_0x4f3917(0x1fe)]),!_0x3abeb0[_0x4f3917(0x221)]&&console[_0x4f3917(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4f3917(0x20d)]('Error:')+'\x20'+_0x3abeb0['schemaError']);}}[a30_0x18fecb(0x15d)](_0x4bf585,_0x454625){const _0x343bc2=a30_0x18fecb;if(_0x4bf585['behaviors']['length']===0x0)return;console[_0x343bc2(0x1f6)]('\x0a'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x13e))+'\x20'+a30_0x2ae559[_0x343bc2(0x2c4)]('('+_0x454625+')'));for(const _0x1d7833 of _0x4bf585[_0x343bc2(0x17b)]){const _0x3bf25a=_0x1d7833['schemaValid']?a30_0x2ae559[_0x343bc2(0x297)]('✔'):a30_0x2ae559[_0x343bc2(0x20d)]('✘');let _0x178362='';if(_0x1d7833[_0x343bc2(0x221)]&&_0x1d7833[_0x343bc2(0x1d1)]!==undefined&&_0x1d7833[_0x343bc2(0x22f)]!==undefined){const _0x225d89=_0x1d7833[_0x343bc2(0x2b6)]?.[_0x343bc2(0x232)](0x1)||'?',_0x1eb547=(_0x1d7833[_0x343bc2(0x2b6)]??0x0)>=0x32?a30_0x2ae559['green']:(_0x1d7833[_0x343bc2(0x2b6)]??0x0)>=0x14?a30_0x2ae559['yellow']:a30_0x2ae559[_0x343bc2(0x20d)];_0x178362='\x20'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x20f))+'\x20'+_0x1eb547(formatRows(_0x1d7833[_0x343bc2(0x1d1)]))+'\x20('+_0x225d89+_0x343bc2(0x1e8)+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x282))+'\x20'+a30_0x2ae559['cyan'](formatRows(_0x1d7833[_0x343bc2(0x22f)]));}console[_0x343bc2(0x1f6)](_0x3bf25a+'\x20'+a30_0x2ae559[_0x343bc2(0x23c)](_0x1d7833[_0x343bc2(0x281)])+_0x178362),console['error']('\x20\x20'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x19d))+'\x20'+a30_0x2ae559[_0x343bc2(0x23c)](_0x1d7833[_0x343bc2(0x192)]+'.'+_0x1d7833[_0x343bc2(0x2b2)]));const _0x57d990=_0x1d7833[_0x343bc2(0x208)]===_0x1d7833[_0x343bc2(0x167)]?a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x207))+'\x20'+_0x1d7833['joinKey']:a30_0x2ae559[_0x343bc2(0x2c4)]('Join:')+'\x20'+_0x1d7833[_0x343bc2(0x208)]+_0x343bc2(0x1f5)+_0x1d7833[_0x343bc2(0x167)];console[_0x343bc2(0x1f6)]('\x20\x20'+_0x57d990),console[_0x343bc2(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('Columns:')),this[_0x343bc2(0x180)](_0x1d7833['columns']),!_0x1d7833[_0x343bc2(0x221)]&&console[_0x343bc2(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x343bc2(0x20d)](_0x343bc2(0x237))+'\x20'+_0x1d7833[_0x343bc2(0x1ec)]);}}[a30_0x18fecb(0x180)](_0x420832){const _0x50a785=a30_0x18fecb;for(const _0x5e702f of _0x420832){_0x5e702f[_0x50a785(0x152)]===_0x5e702f[_0x50a785(0x2c9)]||_0x5e702f[_0x50a785(0x2c9)]==='*'?console[_0x50a785(0x1f6)](_0x50a785(0x18e)+_0x5e702f['label']):console[_0x50a785(0x1f6)](_0x50a785(0x18e)+_0x5e702f[_0x50a785(0x152)]+'\x20'+a30_0x2ae559['dim']('('+_0x5e702f['column']+')'));}}[a30_0x18fecb(0x1dd)](_0x5cceb3){const _0x637f80=a30_0x18fecb;console['error']('─'[_0x637f80(0x159)](0x3c));if(_0x5cceb3['errors'][_0x637f80(0x197)]>0x0){console[_0x637f80(0x1f6)]('\x0a'+a30_0x2ae559[_0x637f80(0x20d)](_0x637f80(0x154)));for(const _0x5c66aa of _0x5cceb3[_0x637f80(0x14c)]){console[_0x637f80(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x637f80(0x20d)]('•')+'\x20'+_0x5c66aa);}}_0x5cceb3[_0x637f80(0x1ea)]&&console[_0x637f80(0x1f6)]('\x0a'+a30_0x2ae559[_0x637f80(0x297)]('✔')+_0x637f80(0x249));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]='segment:parent:preview';['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a30_0x18fecb(0x27b)](_0xd854e){const _0x192ba4=a30_0x18fecb,{options:_0x1ae7f8,args:_0xd6eb0,tdx:_0x381bf3}=_0xd854e,_0x483b8a=_0x1ae7f8,_0x32ef82=_0xd6eb0[0x0]||_0x1ae7f8[_0x192ba4(0x216)];if(!_0x32ef82)return showParentSegmentNotSetError(_0x192ba4(0x29c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x192ba4(0x2b7)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x192ba4(0x224)+_0x192ba4(0x1e3)+_0x192ba4(0x231)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x483b8a['master']&&!_0x483b8a['attribute']&&!_0x483b8a[_0x192ba4(0x14b)]&&!_0x483b8a['enriched'])return console['error'](a30_0x2ae559['red'](_0x192ba4(0x173))),console[_0x192ba4(0x1f6)](_0x192ba4(0x199)),console[_0x192ba4(0x1f6)](_0x192ba4(0x1b8)),console[_0x192ba4(0x1f6)](_0x192ba4(0x22b)),console[_0x192ba4(0x1f6)](_0x192ba4(0x257)),console[_0x192ba4(0x1f6)](_0x192ba4(0x293)),console['error'](_0x192ba4(0x27a)),0x1;const _0x3905c7=resolveYamlFile(_0x32ef82);if(!existsSync(_0x3905c7))return showFileNotFoundError(_0x3905c7,_0x32ef82),0x1;_0x483b8a['verbose']&&(console[_0x192ba4(0x1f6)](_0x192ba4(0x1d9)+_0x483b8a[_0x192ba4(0x177)]),console['error'](_0x192ba4(0x15a)+_0x3905c7));let _0x2d1bf7;try{_0x2d1bf7=readFileSync(_0x3905c7,_0x192ba4(0x146));}catch(_0x27e4aa){const _0x12f911=_0x27e4aa instanceof Error?_0x27e4aa[_0x192ba4(0x1c5)]:String(_0x27e4aa);return console[_0x192ba4(0x1f6)](_0x192ba4(0x203)+_0x12f911),0x1;}let _0x42587c;try{_0x42587c=parseDef(_0x2d1bf7);}catch(_0x1bd3f0){const _0x80ba59=_0x1bd3f0 instanceof Error?_0x1bd3f0[_0x192ba4(0x1c5)]:String(_0x1bd3f0);return console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x28a)+_0x80ba59)),0x1;}if(_0x483b8a[_0x192ba4(0x140)]===!![]||_0x483b8a[_0x192ba4(0x140)]===''){const _0x1e6940=_0x42587c['attributes']?.['map'](_0x8432f4=>_0x8432f4[_0x192ba4(0x281)])||[];if(_0x1e6940[_0x192ba4(0x197)]===0x0)console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x28f)));else{console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x1b4))),console[_0x192ba4(0x1f6)](_0x192ba4(0x1a4));for(const _0x4859f6 of _0x1e6940){console[_0x192ba4(0x1f6)]('\x20\x20'+a30_0x2ae559['cyan'](_0x4859f6));}console[_0x192ba4(0x1f6)](_0x192ba4(0x272)+_0x32ef82+'\x20--attribute\x20\x22'+_0x1e6940[0x0]+'\x22');}return 0x1;}if(_0x483b8a[_0x192ba4(0x14b)]===!![]||_0x483b8a[_0x192ba4(0x14b)]===''){const _0x2248e5=_0x42587c[_0x192ba4(0x17b)]?.[_0x192ba4(0x2a1)](_0x5dfaa5=>_0x5dfaa5[_0x192ba4(0x281)])||[];if(_0x2248e5[_0x192ba4(0x197)]===0x0)console['error'](a30_0x2ae559['red'](_0x192ba4(0x20a)));else{console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x192ba4(0x1f6)](_0x192ba4(0x24e));for(const _0x2b4587 of _0x2248e5){console[_0x192ba4(0x1f6)]('\x20\x20'+a30_0x2ae559['cyan'](_0x2b4587));}console[_0x192ba4(0x1f6)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x32ef82+_0x192ba4(0x244)+_0x2248e5[0x0]+'\x22');}return 0x1;}const _0x31ce10=createCommandSpinner(a30_0x2ae559[_0x192ba4(0x2c4)](_0x192ba4(0x1b7)),{'verbose':_0x483b8a[_0x192ba4(0x1d5)]});_0x31ce10['start']();const _0x29aa2e={'onProgress':_0x588bb9=>{const _0x305756=_0x192ba4;_0x31ce10[_0x305756(0x194)]=formatProgressMessage(_0x588bb9);}};if(_0x483b8a[_0x192ba4(0x149)])_0x29aa2e[_0x192ba4(0x149)]=!![];if(_0x483b8a['attribute']&&typeof _0x483b8a[_0x192ba4(0x140)]===_0x192ba4(0x19a))_0x29aa2e[_0x192ba4(0x140)]=_0x483b8a[_0x192ba4(0x140)];if(_0x483b8a['behavior']&&typeof _0x483b8a[_0x192ba4(0x14b)]===_0x192ba4(0x19a))_0x29aa2e[_0x192ba4(0x14b)]=_0x483b8a['behavior'];if(_0x483b8a['enriched'])_0x29aa2e[_0x192ba4(0x16e)]=!![];if(_0x483b8a['interval'])_0x29aa2e[_0x192ba4(0x27f)]=_0x483b8a[_0x192ba4(0x27f)];let _0x4ee702;try{_0x4ee702=await _0x381bf3[_0x192ba4(0x19c)][_0x192ba4(0x2c1)](_0x2d1bf7,_0x29aa2e),_0x31ce10[_0x192ba4(0x2c0)]();}catch(_0x22516d){_0x31ce10[_0x192ba4(0x2c0)]();throw _0x22516d;}return await this[_0x192ba4(0x2a2)](_0x4ee702,{'master':_0x483b8a['master'],'attribute':typeof _0x483b8a[_0x192ba4(0x140)]==='string'?_0x483b8a[_0x192ba4(0x140)]:undefined,'behavior':typeof _0x483b8a[_0x192ba4(0x14b)]===_0x192ba4(0x19a)?_0x483b8a[_0x192ba4(0x14b)]:undefined,'enriched':_0x483b8a[_0x192ba4(0x16e)]}),_0x4ee702[_0x192ba4(0x1ea)]?0x0:0x1;}async[a30_0x18fecb(0x2a2)](_0x3e6771,_0x2ad988){const _0x5ee8b5=a30_0x18fecb;console[_0x5ee8b5(0x1f6)]('\x0a'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x5ee8b5(0x226))+'\x20'+_0x3e6771['name']),console[_0x5ee8b5(0x1f6)]('═'[_0x5ee8b5(0x159)](0x3c));if(_0x2ad988[_0x5ee8b5(0x149)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x15a685=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x1d3))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x3e6771[_0x5ee8b5(0x149)][_0x5ee8b5(0x192)]+'.'+_0x3e6771[_0x5ee8b5(0x149)][_0x5ee8b5(0x2b2)]);await this[_0x5ee8b5(0x162)](_0x15a685,_0x3e6771['sampleData']);}else{if(_0x2ad988[_0x5ee8b5(0x140)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x197552=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x202))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x2ad988[_0x5ee8b5(0x140)]);await this[_0x5ee8b5(0x162)](_0x197552,_0x3e6771[_0x5ee8b5(0x1f3)]);}else{if(_0x2ad988['behavior']&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x2d96b8=a30_0x2ae559[_0x5ee8b5(0x2c4)]('Behavior:')+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x2ad988['behavior']);await this['displaySampleData'](_0x2d96b8,_0x3e6771[_0x5ee8b5(0x1f3)]);}else{if(_0x2ad988[_0x5ee8b5(0x16e)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x1ced36=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x259))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x5ee8b5(0x23d));await this[_0x5ee8b5(0x162)](_0x1ced36,_0x3e6771[_0x5ee8b5(0x1f3)]);}else!_0x3e6771['sampleData']&&console['error'](_0x5ee8b5(0x196));}}}if(_0x3e6771[_0x5ee8b5(0x14c)]['length']>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a30_0x2ae559[_0x5ee8b5(0x20d)]('Errors:'));for(const _0x4561f2 of _0x3e6771[_0x5ee8b5(0x14c)]){console[_0x5ee8b5(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x5ee8b5(0x20d)]('•')+'\x20'+_0x4561f2);}}}async[a30_0x18fecb(0x162)](_0x3691d0,_0x257493){const _0x5e5f94=a30_0x18fecb;if(_0x257493[_0x5e5f94(0x197)]===0x0){console[_0x5e5f94(0x1f6)]('\x0a'+_0x3691d0),console[_0x5e5f94(0x1f6)](_0x5e5f94(0x205));return;}console[_0x5e5f94(0x1f6)]('\x0a'+_0x3691d0);const _0x1aa42d=Object[_0x5e5f94(0x278)](_0x257493[0x0])[_0x5e5f94(0x2a1)](_0x540e5f=>({'name':_0x540e5f,'type':typeof _0x257493[0x0][_0x540e5f]===_0x5e5f94(0x253)?'double':_0x5e5f94(0x1ab)})),_0x37f6f3={'queryId':_0x5e5f94(0x28b),'columns':_0x1aa42d,'data':_0x257493,'stats':{'state':_0x5e5f94(0x17f),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x257493[_0x5e5f94(0x197)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x523479=formatAsTable(_0x37f6f3,_0x257493[_0x5e5f94(0x197)],!![]);await writeOutput(_0x523479,undefined,_0x5e5f94(0x2b2));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x161);['description']=a30_0x18fecb(0x1d8);async[a30_0x18fecb(0x27b)](_0x2f6c65){const _0xfb389b=a30_0x18fecb,{options:_0x48b330,args:_0xc9eeb,tdx:_0x5832fe}=_0x2f6c65,_0x8fecf6=_0x48b330,_0x597066=_0xc9eeb[0x0]||_0x48b330[_0xfb389b(0x216)];if(!_0x597066)return showParentSegmentNotSetError(_0xfb389b(0x218)+_0xfb389b(0x262)),0x1;const _0x177a24=resolveYamlFile(_0x597066);if(existsSync(_0x177a24)){_0x8fecf6[_0xfb389b(0x1d5)]&&console[_0xfb389b(0x1f6)](_0xfb389b(0x261)+_0x177a24);let _0x52a3ec;try{_0x52a3ec=readFileSync(_0x177a24,_0xfb389b(0x146));}catch(_0x21c695){const _0xc481e1=_0x21c695 instanceof Error?_0x21c695[_0xfb389b(0x1c5)]:String(_0x21c695);return console[_0xfb389b(0x1f6)]('Error\x20reading\x20file:\x20'+_0xc481e1),0x1;}const _0x54c564=await withSpinner(_0xfb389b(0x24d),()=>_0x5832fe[_0xfb389b(0x19c)][_0xfb389b(0x1e7)](_0x52a3ec),{'verbose':_0x8fecf6[_0xfb389b(0x1d5)]}),_0xc064b5=_0x54c564[_0xfb389b(0x25a)],{isNew:_0x5e6cfe,name:_0x446da9,hasChanges:_0x242f46,diffFormatted:_0x34add6}=_0xc064b5;if(_0x242f46){_0x5e6cfe?console[_0xfb389b(0x1f6)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x446da9+'\x27:'):console['error'](_0xfb389b(0x1f2)+_0x446da9+'\x27:');console[_0xfb389b(0x1f6)]('─'[_0xfb389b(0x159)](0x3c)),console[_0xfb389b(0x1f6)](_0x34add6),console[_0xfb389b(0x1f6)]('─'['repeat'](0x3c));const _0x2f4b7c=_0x5e6cfe?_0xfb389b(0x166)+_0x446da9+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x446da9+_0xfb389b(0x26f);if(!_0x8fecf6['yes']){if(!isInteractive())return console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x20d)](_0xfb389b(0x20b)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x188))),0x1;const _0x2185be=await confirmKey(_0x2f4b7c);if(!_0x2185be)return console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x1bd)]('Aborted.')),0x1;}const _0x40b1ba=_0x5e6cfe?'Creating':'Updating';await withSpinner(_0x40b1ba+_0xfb389b(0x22a)+_0x446da9+'\x27...',()=>_0xc064b5[_0xfb389b(0x176)](),{'verbose':_0x8fecf6['verbose']});const _0x5156a9=_0x5e6cfe?_0xfb389b(0x1bf):_0xfb389b(0x153);console['error']('✔\x20'+_0x5156a9+_0xfb389b(0x22a)+_0x446da9+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x446da9+'\x27\x20is\x20up\x20to\x20date');}const _0x1c8a0e=await withSpinner(_0xfb389b(0x169)+_0x597066+_0xfb389b(0x2a3),()=>_0x5832fe[_0xfb389b(0x19c)]['runParent'](_0x597066),{'verbose':_0x8fecf6[_0xfb389b(0x1d5)]}),_0x3f3ce3=_0x1c8a0e[_0xfb389b(0x25a)],_0x284329=getConsoleUrl(_0x8fecf6['site'],_0xfb389b(0x1fb)+_0x3f3ce3[_0xfb389b(0x2b5)]+_0xfb389b(0x299)+_0x3f3ce3[_0xfb389b(0x289)]+_0xfb389b(0x1f0)+_0x3f3ce3['workflowAttemptId']);return console[_0xfb389b(0x1f6)](_0xfb389b(0x26d)),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)]('Audience\x20ID:')+'\x20'+_0x3f3ce3[_0xfb389b(0x1ac)]),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x16d))+'\x20'+_0x3f3ce3['status']),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x1ca))+'\x20'+_0x3f3ce3[_0xfb389b(0x289)]),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x2bd))+'\x20'+_0x3f3ce3[_0xfb389b(0x25f)]),console[_0xfb389b(0x1f6)]('\x20\x20'+_0x284329),console['error']('\x0a'+a30_0x2ae559['dim'](_0xfb389b(0x241))+_0xfb389b(0x156)+_0x3f3ce3['workflowAttemptId']+_0xfb389b(0x25e)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x18fecb(0x2b1)]='List\x20available\x20fields\x20for\x20segmentation';async[a30_0x18fecb(0x27b)](_0x28d20c){const _0x12cd1e=a30_0x18fecb,{options:_0x183af2,args:_0x171961,tdx:_0x43931b}=_0x28d20c,_0x1fabdc=_0x171961[0x0]||_0x183af2[_0x12cd1e(0x216)];if(!_0x1fabdc)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x12cd1e(0x275)),0x1;_0x183af2[_0x12cd1e(0x1d5)]&&(console[_0x12cd1e(0x1f6)]('Site:\x20'+_0x183af2[_0x12cd1e(0x177)]),console[_0x12cd1e(0x1f6)](_0x12cd1e(0x1f8)+_0x1fabdc));const _0x4c3e19=await withSpinner(_0x12cd1e(0x223)+_0x1fabdc+_0x12cd1e(0x2a3),()=>_0x43931b[_0x12cd1e(0x19c)]['listFields'](_0x1fabdc),{'verbose':_0x183af2[_0x12cd1e(0x1d5)]}),_0x425967=_0x4c3e19[_0x12cd1e(0x25a)];console[_0x12cd1e(0x1f6)](_0x12cd1e(0x187)+_0x425967[_0x12cd1e(0x197)]+'\x20field'+(_0x425967[_0x12cd1e(0x197)]!==0x1?'s':''));if(_0x183af2[_0x12cd1e(0x2aa)]||_0x183af2[_0x12cd1e(0x1a3)])return await handleSDKOutput(_0x425967,_0x183af2),0x0;return displayFieldsHumanReadable(_0x425967,_0x1fabdc),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x21e);['description']=a30_0x18fecb(0x1b9);async[a30_0x18fecb(0x27b)](_0x8da6f0){const _0x208f7c=a30_0x18fecb,{options:_0x1e36cf,args:_0x4527a0,tdx:_0xad0205}=_0x8da6f0,_0x18887a=_0x1e36cf,_0x25f594=_0x4527a0[0x0]||_0x1e36cf[_0x208f7c(0x216)];if(!_0x25f594)return showParentSegmentNotSetError(_0x208f7c(0x280)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x208f7c(0x2c6)+_0x208f7c(0x1e6)),0x1;_0x1e36cf['verbose']&&(console[_0x208f7c(0x1f6)](_0x208f7c(0x1d9)+_0x1e36cf[_0x208f7c(0x177)]),console['error']('Parent\x20segment:\x20'+_0x25f594));const _0x29b8e4=await withSpinner(_0x208f7c(0x1aa)+_0x25f594+'\x27...',()=>_0xad0205[_0x208f7c(0x19c)][_0x208f7c(0x136)](_0x25f594),{'verbose':_0x1e36cf[_0x208f7c(0x1d5)]}),_0x28f8e8=_0x29b8e4[_0x208f7c(0x25a)];if(_0x18887a[_0x208f7c(0x1db)]){const _0x56245f=getConsoleNextUrl(_0x18887a[_0x208f7c(0x177)],_0x208f7c(0x287)+_0x28f8e8['id']);return console['error'](a30_0x2ae559[_0x208f7c(0x297)]('✔')+'\x20Opening\x20'+a30_0x2ae559[_0x208f7c(0x1da)](_0x56245f)),openBrowser(_0x56245f),0x0;}return await handleSingleObjectOutput(_0x28f8e8,_0x1e36cf),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x24a);[a30_0x18fecb(0x2b1)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a30_0x18fecb(0x27b)](_0x1fe01b){const _0x5b38cd=a30_0x18fecb,{options:_0x3043a3,args:_0x32d463,tdx:_0x37f107}=_0x1fe01b,_0x300d25=_0x3043a3,_0x2895b6=_0x32d463[0x0]||_0x3043a3[_0x5b38cd(0x216)];if(!_0x2895b6)return showParentSegmentNotSetError(_0x5b38cd(0x1a6)+'\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'+_0x5b38cd(0x2c6)+_0x5b38cd(0x29b)),0x1;_0x3043a3[_0x5b38cd(0x1d5)]&&(console[_0x5b38cd(0x1f6)](_0x5b38cd(0x1d9)+_0x3043a3[_0x5b38cd(0x177)]),console[_0x5b38cd(0x1f6)](_0x5b38cd(0x1f8)+_0x2895b6));const _0x4f92a0=await withSpinner(_0x5b38cd(0x222)+_0x2895b6+'\x27...',()=>_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x21a)](_0x2895b6),{'verbose':_0x3043a3[_0x5b38cd(0x1d5)]}),_0x3f82c4=_0x4f92a0[_0x5b38cd(0x25a)],_0x532c69=_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x147)](_0x3f82c4);if(_0x300d25[_0x5b38cd(0x137)]){const _0x46ea80=await this['collectSchema'](_0x1fe01b,_0x2895b6,_0x3f82c4,_0x532c69),_0x79dd62=this[_0x5b38cd(0x158)](_0x46ea80);writeFileSync(_0x300d25[_0x5b38cd(0x137)],_0x79dd62);const _0x4dfcbb=_0x46ea80[_0x5b38cd(0x25c)]['columns'][_0x5b38cd(0x197)]+_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x269)]((_0x5dc1e0,_0x4d5a7c)=>_0x5dc1e0+_0x4d5a7c[_0x5b38cd(0x1fe)][_0x5b38cd(0x197)],0x0),_0x1abf2a=_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x258)](_0x55a8d2=>_0x55a8d2['columns'][_0x5b38cd(0x197)]===0x0)[_0x5b38cd(0x197)];return console[_0x5b38cd(0x27d)](_0x5b38cd(0x15b)+_0x300d25[_0x5b38cd(0x137)]),console[_0x5b38cd(0x27d)](_0x5b38cd(0x227)+_0x532c69),console['log'](_0x5b38cd(0x13f)+_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x197)]+_0x5b38cd(0x295)),console['log']('\x20\x20Columns:\x20'+_0x4dfcbb+_0x5b38cd(0x19f)),_0x1abf2a>0x0&&console[_0x5b38cd(0x27d)](_0x5b38cd(0x213)+_0x1abf2a+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x5b38cd(0x1f6)]('\x0a'+a30_0x2ae559['bold']('Output\x20Database:')+'\x20'+a30_0x2ae559['cyan'](_0x532c69));const _0x27f995=await withSpinner(_0x5b38cd(0x17e),()=>_0x37f107['segment']['getParentSQL'](_0x3f82c4),{'verbose':_0x3043a3[_0x5b38cd(0x1d5)]});console[_0x5b38cd(0x1f6)]('\x0a'+a30_0x2ae559['bold']('customers')+'\x20'+a30_0x2ae559[_0x5b38cd(0x2c4)]('('+_0x532c69+'.customers)'));const _0x6a3552=await executeSchemaQuery(_0x27f995[_0x5b38cd(0x25a)],_0x37f107,_0x3043a3);await handleQueryOutput(_0x6a3552,_0x3043a3);const _0x25eb71=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x157)](_0x3f82c4),{'verbose':_0x3043a3['verbose']});for(const _0x10b54a of _0x25eb71['data']){const _0x3f19f0=_0x5b38cd(0x248)+_0x10b54a[_0x5b38cd(0x184)]()[_0x5b38cd(0x14a)](/\s+/g,'_'),_0x26e3a0=_0x5b38cd(0x2ac)+_0x532c69+'.'+_0x3f19f0;console['error']('\x0a'+a30_0x2ae559['bold'](_0x10b54a)+'\x20'+a30_0x2ae559[_0x5b38cd(0x2c4)]('('+_0x532c69+'.'+_0x3f19f0+')'));try{const _0x203492=await executeSchemaQuery(_0x26e3a0,_0x37f107,_0x3043a3);await handleQueryOutput(_0x203492,_0x3043a3);}catch{console[_0x5b38cd(0x1f6)](a30_0x2ae559[_0x5b38cd(0x1bd)](_0x5b38cd(0x266)));}}return 0x0;}async[a30_0x18fecb(0x171)](_0x46f562,_0x25fbcc,_0x3a89dc,_0x3597e0){const _0x3cfc04=a30_0x18fecb,{options:_0x2b85fd,tdx:_0x2ecd5e}=_0x46f562,_0x944fd5=await withSpinner(_0x3cfc04(0x17e),()=>_0x2ecd5e[_0x3cfc04(0x19c)]['getParentSQL'](_0x3a89dc),{'verbose':_0x2b85fd[_0x3cfc04(0x1d5)]}),_0x23d832=await executeSchemaQuery(_0x944fd5[_0x3cfc04(0x25a)],_0x2ecd5e,_0x2b85fd),_0x580875=_0x23d832[_0x3cfc04(0x25a)][_0x3cfc04(0x2a1)](_0x4182e6=>({'name':_0x4182e6['column_name'],'type':_0x4182e6[_0x3cfc04(0x148)]})),_0x4f5ddb=await withSpinner(_0x3cfc04(0x267),()=>_0x2ecd5e[_0x3cfc04(0x19c)][_0x3cfc04(0x157)](_0x3a89dc),{'verbose':_0x2b85fd[_0x3cfc04(0x1d5)]}),_0x14d323=[];for(const _0x55bc62 of _0x4f5ddb['data']){const _0x3a797d=_0x3cfc04(0x248)+_0x55bc62[_0x3cfc04(0x184)]()['replace'](/\s+/g,'_'),_0x4a4694='SELECT\x20*\x20FROM\x20'+_0x3597e0+'.'+_0x3a797d;let _0x4434d2=[];try{const _0xe55c9c=await executeSchemaQuery(_0x4a4694,_0x2ecd5e,_0x2b85fd);_0x4434d2=_0xe55c9c[_0x3cfc04(0x25a)][_0x3cfc04(0x2a1)](_0xbf8eef=>({'name':_0xbf8eef[_0x3cfc04(0x274)],'type':_0xbf8eef[_0x3cfc04(0x148)]}));}catch{}_0x14d323[_0x3cfc04(0x2b8)]({'table':_0x3a797d,'columns':_0x4434d2});}return{'database':_0x3597e0,'parent_segment':_0x25fbcc,'parent_id':_0x3a89dc,'customers':{'table':_0x3cfc04(0x25c),'columns':_0x580875},'behaviors':_0x14d323};}['formatSchemaJson'](_0x263334){const _0x3f8b77=a30_0x18fecb,_0x34811a=_0x23a733=>{const _0x337e9b=a30_0xee43;if(_0x23a733[_0x337e9b(0x197)]===0x0)return'[]';const _0x328e00=_0x23a733[_0x337e9b(0x2a1)](_0x2f5655=>_0x337e9b(0x142)+_0x2f5655['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x2f5655[_0x337e9b(0x2c3)]+'\x22\x20}');return'[\x0a'+_0x328e00['join'](',\x0a')+_0x337e9b(0x296);},_0x5e7614=_0x263334['behaviors'][_0x3f8b77(0x2a1)](_0x4ae5fd=>{const _0x10aa75=_0x3f8b77;return _0x10aa75(0x2a8)+_0x4ae5fd[_0x10aa75(0x2b2)]+_0x10aa75(0x185)+_0x34811a(_0x4ae5fd['columns'])[_0x10aa75(0x14a)](/^/gm,'\x20\x20')[_0x10aa75(0x172)]()+_0x10aa75(0x24b);})['join'](',\x0a');return _0x3f8b77(0x285)+_0x263334[_0x3f8b77(0x192)]+_0x3f8b77(0x1bb)+_0x263334[_0x3f8b77(0x13b)]+_0x3f8b77(0x1dc)+_0x263334['parent_id']+_0x3f8b77(0x2c2)+_0x263334['customers'][_0x3f8b77(0x2b2)]+_0x3f8b77(0x16f)+_0x34811a(_0x263334[_0x3f8b77(0x25c)][_0x3f8b77(0x1fe)])[_0x3f8b77(0x14a)](/^/gm,'\x20\x20')[_0x3f8b77(0x172)]()+_0x3f8b77(0x1cf)+_0x5e7614+_0x3f8b77(0x245);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x18fecb(0x281)]='segment:parent:sql';[a30_0x18fecb(0x2b1)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x18fecb(0x27b)](_0x90660b){const _0x4cd805=a30_0x18fecb,{options:_0x215c42,args:_0x2bcf49,tdx:_0x371b3b}=_0x90660b,_0x22c659=_0x2bcf49[0x0]||_0x215c42[_0x4cd805(0x216)];if(!_0x22c659)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x4cd805(0x28d)),0x1;_0x215c42[_0x4cd805(0x1d5)]&&(console[_0x4cd805(0x1f6)](_0x4cd805(0x1d9)+_0x215c42[_0x4cd805(0x177)]),console[_0x4cd805(0x1f6)]('Parent\x20segment:\x20'+_0x22c659));const _0x26f54f=await withSpinner(_0x4cd805(0x222)+_0x22c659+_0x4cd805(0x2a3),()=>_0x371b3b[_0x4cd805(0x19c)][_0x4cd805(0x21a)](_0x22c659),{'verbose':_0x215c42[_0x4cd805(0x1d5)]}),_0x58a673=_0x26f54f[_0x4cd805(0x25a)],_0x182c58=await withSpinner(_0x4cd805(0x20c)+_0x22c659+_0x4cd805(0x2a3),()=>_0x371b3b[_0x4cd805(0x19c)][_0x4cd805(0x24f)](_0x58a673),{'verbose':_0x215c42[_0x4cd805(0x1d5)]}),_0x18a65d=_0x182c58['data'];return _0x215c42[_0x4cd805(0x29f)]===_0x4cd805(0x2aa)||_0x215c42[_0x4cd805(0x29f)]==='jsonl'?await handleSDKOutput([{'sql':_0x18a65d}],_0x215c42):console[_0x4cd805(0x27d)](_0x18a65d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x212);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x3cde15){const _0x491b28=a30_0x18fecb,{options:_0xb1a24f,args:_0x554cfe,tdx:_0x5f45eb}=_0x3cde15,_0x497f68=_0x554cfe[0x0]||_0xb1a24f[_0x491b28(0x216)];if(!_0x497f68)return showParentSegmentNotSetError(_0x491b28(0x2a0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0xb1a24f['verbose']&&(console[_0x491b28(0x1f6)](_0x491b28(0x1d9)+_0xb1a24f[_0x491b28(0x177)]),console[_0x491b28(0x1f6)](_0x491b28(0x1f8)+_0x497f68));const _0x4a2dc2=await withSpinner(_0x491b28(0x222)+_0x497f68+_0x491b28(0x2a3),()=>_0x5f45eb[_0x491b28(0x19c)]['resolveParentId'](_0x497f68),{'verbose':_0xb1a24f[_0x491b28(0x1d5)]}),_0x31c761=_0x4a2dc2[_0x491b28(0x25a)],_0x156308=await withSpinner(_0x491b28(0x20c)+_0x497f68+_0x491b28(0x2a3),()=>_0x5f45eb[_0x491b28(0x19c)][_0x491b28(0x24f)](_0x31c761),{'verbose':_0xb1a24f[_0x491b28(0x1d5)]});let _0x12b93f=_0x156308[_0x491b28(0x25a)];const _0x31e590=resolveLimit(_0xb1a24f[_0x491b28(0x277)],DEFAULT_DISPLAY_LIMIT),_0xe1fd78=/\bLIMIT\s+\d+/i['test'](_0x12b93f);!_0xe1fd78&&(_0x12b93f=_0x12b93f[_0x491b28(0x172)]()['replace'](/;+$/,''),_0x12b93f='SELECT\x20*\x20FROM\x20(\x0a'+_0x12b93f+_0x491b28(0x25d)+_0x31e590);_0xb1a24f[_0x491b28(0x1d5)]&&console[_0x491b28(0x1f6)](_0x491b28(0x2c5)+_0x12b93f);const _0x4315b2=await withProgressSpinner(_0x491b28(0x2be),async _0x562e9a=>{const _0x39c2d6=_0x491b28,_0x4867bb=await _0x5f45eb[_0x39c2d6(0x270)]['execute'](_0x12b93f,{'catalog':'td','schema':_0x39c2d6(0x2a6),'onJobId':_0x288501=>{const _0x2607f9=_0x39c2d6;_0x562e9a[_0x2607f9(0x26c)](_0x288501);}});return _0x4867bb;},{'verbose':_0xb1a24f[_0x491b28(0x1d5)]}),_0x5f270e=_0x4315b2['data'],_0xdd3f01=_0x5f270e[_0x491b28(0x1ba)]?'\x20[Job\x20ID:\x20'+_0x5f270e[_0x491b28(0x1ba)]+']':'';return console[_0x491b28(0x1f6)](_0x491b28(0x1ae)+_0x5f270e[_0x491b28(0x2bb)][_0x491b28(0x230)][_0x491b28(0x22c)]()+_0x491b28(0x1f7)+('in\x20'+formatElapsed(_0x5f270e[_0x491b28(0x2bb)][_0x491b28(0x1a7)])+_0xdd3f01)),await handleQueryOutput(_0x5f270e,_0xb1a24f),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x1e4);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1cb);async[a30_0x18fecb(0x27b)](_0x56713c){const _0x16f8d4=a30_0x18fecb,{options:_0x5bf95b,args:_0x318f2d,tdx:_0x5a8f2e}=_0x56713c,_0x2df4aa=_0x318f2d[0x0],_0x27b824=await withSpinner(_0x2df4aa?_0x16f8d4(0x1ad)+_0x2df4aa+_0x16f8d4(0x2a3):_0x16f8d4(0x1c8),()=>_0x5a8f2e[_0x16f8d4(0x18c)]['list'](),{'verbose':_0x5bf95b[_0x16f8d4(0x1d5)]});let _0x4e9820=_0x27b824[_0x16f8d4(0x25a)][_0x16f8d4(0x258)](_0x2660fe=>_0x2660fe[_0x16f8d4(0x178)]);if(_0x2df4aa){const _0x340e5f=_0x2df4aa[_0x16f8d4(0x14a)](/[.+^${}()|[\]\\]/g,_0x16f8d4(0x1a1))['replace'](/\*/g,'.*')[_0x16f8d4(0x14a)](/\?/g,'.'),_0x9811d7=new RegExp('^'+_0x340e5f+'$','i');_0x4e9820=_0x4e9820[_0x16f8d4(0x258)](_0x694c6=>_0x9811d7['test'](_0x694c6[_0x16f8d4(0x281)]));}_0x4e9820[_0x16f8d4(0x170)]((_0x2351b6,_0x26e8a2)=>_0x2351b6[_0x16f8d4(0x281)]['localeCompare'](_0x26e8a2['name'])),console[_0x16f8d4(0x1f6)]('✔\x20Found\x20'+_0x4e9820[_0x16f8d4(0x197)]+_0x16f8d4(0x21b)+(_0x4e9820[_0x16f8d4(0x197)]!==0x1?'s':''));const _0xfadf0=_0x2f4ec8=>{const _0x4fff66=_0x16f8d4;return getConsoleNextUrl(_0x5bf95b[_0x4fff66(0x177)],'/app/dw/parentSegments/'+_0x2f4ec8);};if(_0x5bf95b[_0x16f8d4(0x29f)]===_0x16f8d4(0x2aa)||_0x5bf95b[_0x16f8d4(0x29f)]===_0x16f8d4(0x1a3)){const _0x206739=_0x4e9820['map'](_0x37fbc3=>({..._0x37fbc3,'url':_0xfadf0(_0x37fbc3['id'])}));await handleSDKOutput(_0x206739,_0x5bf95b);}else{if(_0x4e9820[_0x16f8d4(0x197)]===0x0)console[_0x16f8d4(0x27d)](_0x16f8d4(0x252));else for(const _0x209dd8 of _0x4e9820){const _0x1ebddd=_0x209dd8['population']?a30_0x2ae559[_0x16f8d4(0x2c4)]('\x20('+formatRows(_0x209dd8['population'])+')'):'',_0x125ff3=hyperlink(_0x209dd8['name'],_0xfadf0(_0x209dd8['id']));console['log']('⚡\x20'+_0x125ff3+_0x1ebddd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]='ps:rt:validate';['description']=a30_0x18fecb(0x2b4);async[a30_0x18fecb(0x27b)](_0x3c2dfc){const _0x4a22d5=a30_0x18fecb,{options:_0x2486bd,args:_0x4c0e06,tdx:_0x25b196}=_0x3c2dfc,_0x2eebac=_0x4c0e06[0x0]||_0x2486bd[_0x4a22d5(0x216)];if(!_0x2eebac)return showParentSegmentNotSetError(_0x4a22d5(0x21f)+'\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'),0x1;const _0x3856b5=resolveYamlFile(_0x2eebac);if(!existsSync(_0x3856b5))return showFileNotFoundError(_0x3856b5,_0x2eebac),0x1;let _0x3c0773;try{_0x3c0773=readFileSync(_0x3856b5,_0x4a22d5(0x146));}catch(_0x2c299a){const _0x44083f=_0x2c299a instanceof Error?_0x2c299a[_0x4a22d5(0x1c5)]:String(_0x2c299a);return console[_0x4a22d5(0x1f6)](_0x4a22d5(0x203)+_0x44083f),0x1;}const _0x5286d9=createCommandSpinner(a30_0x2ae559[_0x4a22d5(0x2c4)]('Validating\x20RT\x20configuration...'),{'verbose':_0x2486bd['verbose']});_0x5286d9[_0x4a22d5(0x17c)]();const _0x46115b={'realtime':!![],'onProgress':_0x3a87b9=>{const _0x2b5027=_0x4a22d5;_0x5286d9[_0x2b5027(0x194)]=formatProgressMessage(_0x3a87b9);}};let _0x1a338f;try{_0x1a338f=await _0x25b196[_0x4a22d5(0x19c)][_0x4a22d5(0x15e)](_0x3c0773,_0x46115b),_0x5286d9['stop']();}catch(_0x51c232){_0x5286d9[_0x4a22d5(0x2c0)]();throw _0x51c232;}console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x23c)](_0x4a22d5(0x260))+'\x20'+_0x1a338f['name']),console[_0x4a22d5(0x1f6)]('═'[_0x4a22d5(0x159)](0x3c)),displayRealtimeValidation(_0x1a338f),console['error']('─'['repeat'](0x3c));if(_0x1a338f[_0x4a22d5(0x14c)]['length']>0x0){console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x20d)](_0x4a22d5(0x154)));for(const _0x2916a0 of _0x1a338f[_0x4a22d5(0x14c)]){console[_0x4a22d5(0x1f6)]('\x20\x20'+a30_0x2ae559['red']('•')+'\x20'+_0x2916a0);}}return _0x1a338f['allValid']&&console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x297)]('✔')+_0x4a22d5(0x21d)),_0x1a338f['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a30_0x18fecb(0x243);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x2a9);async['execute'](_0x55eac1){const _0x230447=a30_0x18fecb,{options:_0x200139,args:_0x3cf9d7,tdx:_0x263505}=_0x55eac1,_0x3b08d6=_0x3cf9d7[0x0]||_0x200139['parentSegment'];if(!_0x3b08d6)return showParentSegmentNotSetError(_0x230447(0x1cc)+_0x230447(0x1fa)),0x1;const _0x52b1da=await withSpinner(_0x230447(0x222)+_0x3b08d6+_0x230447(0x2a3),()=>_0x263505[_0x230447(0x19c)][_0x230447(0x21a)](_0x3b08d6),{'verbose':_0x200139['verbose']}),_0x34c919=_0x52b1da[_0x230447(0x25a)],_0x4a18d8=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3b08d6+'\x27...',()=>_0x263505['personalization'][_0x230447(0x27e)](_0x34c919),{'verbose':_0x200139[_0x230447(0x1d5)]}),_0x6823fa=_0x4a18d8['data'];console[_0x230447(0x1f6)](_0x230447(0x187)+_0x6823fa[_0x230447(0x197)]+_0x230447(0x1b3)+(_0x6823fa['length']!==0x1?'s':''));if(_0x200139[_0x230447(0x29f)]===_0x230447(0x2aa)||_0x200139['format']===_0x230447(0x1a3))await handleSDKOutput(_0x6823fa,_0x200139);else{if(_0x6823fa[_0x230447(0x197)]===0x0)console[_0x230447(0x27d)]('No\x20personalization\x20services\x20configured'),console[_0x230447(0x1f6)](a30_0x2ae559[_0x230447(0x1da)](_0x230447(0x26b)));else for(const _0x542227 of _0x6823fa){const _0x457c78=_0x542227['sections']?.[_0x230447(0x197)]||0x0,_0x11578b=_0x542227[_0x230447(0x1a0)]?a30_0x2ae559['dim'](_0x230447(0x15f)+_0x542227[_0x230447(0x1a0)]):'',_0x55332f=a30_0x2ae559[_0x230447(0x2c4)]('\x20('+_0x457c78+'\x20section'+(_0x457c78!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x542227[_0x230447(0x281)]+_0x11578b+_0x55332f),_0x542227[_0x230447(0x2b1)]&&console[_0x230447(0x27d)](_0x230447(0x16b)+a30_0x2ae559[_0x230447(0x2c4)](_0x542227[_0x230447(0x2b1)]));}}return 0x0;}}function a30_0xee43(_0x189a70,_0x2ab08c){_0x189a70=_0x189a70-0x135;const _0x1ec491=a30_0x1ec4();let _0xee4334=_0x1ec491[_0x189a70];return _0xee4334;}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x18fecb(0x145);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x23b);async['execute'](_0x15d466){const _0x33d1e0=a30_0x18fecb,{options:_0x5a9322,args:_0x4549c9}=_0x15d466,_0x4cc330=_0x4549c9[0x0]||_0x5a9322[_0x33d1e0(0x216)];if(!_0x4cc330)return showParentSegmentNotSetError(_0x33d1e0(0x229)+_0x33d1e0(0x22e)),0x1;const _0x4b7414=resolveYamlFile(_0x4cc330);if(!existsSync(_0x4b7414))return showFileNotFoundError(_0x4b7414,_0x4cc330),0x1;let _0x2d2cf8;try{_0x2d2cf8=readFileSync(_0x4b7414,_0x33d1e0(0x146));}catch(_0x56bc0d){const _0x352244=_0x56bc0d instanceof Error?_0x56bc0d[_0x33d1e0(0x1c5)]:String(_0x56bc0d);return console[_0x33d1e0(0x1f6)](_0x33d1e0(0x203)+_0x352244),0x1;}let _0x1fdaef;try{_0x1fdaef=parseDef(_0x2d2cf8);}catch(_0x563f97){const _0x709017=_0x563f97 instanceof Error?_0x563f97[_0x33d1e0(0x1c5)]:String(_0x563f97);return console[_0x33d1e0(0x1f6)](a30_0x2ae559[_0x33d1e0(0x20d)](_0x33d1e0(0x28a)+_0x709017)),0x1;}if(_0x1fdaef[_0x33d1e0(0x1b5)]&&_0x1fdaef[_0x33d1e0(0x1b5)]['length']>0x0)return console[_0x33d1e0(0x1f6)](a30_0x2ae559[_0x33d1e0(0x1bd)](_0x33d1e0(0x163)+_0x4b7414)),console['error'](a30_0x2ae559[_0x33d1e0(0x2c4)]('\x20\x20\x20'+_0x1fdaef[_0x33d1e0(0x1b5)][_0x33d1e0(0x197)]+'\x20service(s)\x20configured')),0x1;!_0x1fdaef['realtime']&&(_0x1fdaef[_0x33d1e0(0x18c)]={'events':[{'name':_0x33d1e0(0x220),'source_table':_0x33d1e0(0x189)}],'attributes':[{'name':'last_page_viewed','type':_0x33d1e0(0x2ad)}],'id_stitching':{'primary_key':_0x1fdaef[_0x33d1e0(0x149)][_0x33d1e0(0x2b2)]===_0x33d1e0(0x25c)?_0x33d1e0(0x242):_0x33d1e0(0x14f)}});_0x1fdaef['personalization_services']=[{'name':_0x33d1e0(0x271),'description':'Personalization\x20service\x20description','trigger_event':_0x33d1e0(0x220),'sections':[{'name':_0x33d1e0(0x20e),'criteria':_0x33d1e0(0x181),'attributes':[_0x33d1e0(0x219)]}]}];const _0x534ef7=serializeDef(_0x1fdaef);return writeFileSync(_0x4b7414,_0x534ef7,_0x33d1e0(0x146)),console[_0x33d1e0(0x1f6)](a30_0x2ae559['green']('✔')+_0x33d1e0(0x1fc)+a30_0x2ae559[_0x33d1e0(0x1da)](_0x4b7414)),(!_0x1fdaef['realtime']||_0x2d2cf8['indexOf'](_0x33d1e0(0x228))===-0x1)&&console['error'](a30_0x2ae559[_0x33d1e0(0x297)]('✔')+_0x33d1e0(0x2af)),console[_0x33d1e0(0x1f6)]('\x0a'+a30_0x2ae559[_0x33d1e0(0x2c4)](_0x33d1e0(0x1ce))),console['error'](_0x33d1e0(0x2c8)+_0x4b7414+_0x33d1e0(0x291)),console[_0x33d1e0(0x1f6)](_0x33d1e0(0x19b)+a30_0x2ae559[_0x33d1e0(0x2c4)]('tdx\x20ps\x20push\x20'+_0x4cc330)+_0x33d1e0(0x13d)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1f65e9=a31_0x7f09;(function(_0x3a15d3,_0x4996ba){const _0x123d43=a31_0x7f09,_0xb031fa=_0x3a15d3();while(!![]){try{const _0x158b43=-parseInt(_0x123d43(0x159))/0x1*(parseInt(_0x123d43(0x154))/0x2)+-parseInt(_0x123d43(0x135))/0x3*(-parseInt(_0x123d43(0x148))/0x4)+-parseInt(_0x123d43(0x138))/0x5*(parseInt(_0x123d43(0x165))/0x6)+-parseInt(_0x123d43(0x15b))/0x7+-parseInt(_0x123d43(0x16d))/0x8+parseInt(_0x123d43(0x156))/0x9*(-parseInt(_0x123d43(0x17e))/0xa)+parseInt(_0x123d43(0x140))/0xb;if(_0x158b43===_0x4996ba)break;else _0xb031fa['push'](_0xb031fa['shift']());}catch(_0x42868f){_0xb031fa['push'](_0xb031fa['shift']());}}}(a31_0xc83d,0xd6961));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a31_0xc83d(){const _0x35ef4d=['\x20\x20(no\x20profiles\x20found)','Enter\x20profile\x20name:','yellow','3492582pKBqQF','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','✗\x20Validation\x20failed:\x20','19295cBumRl','\x20API\x20key\x20removed\x20from\x20system\x20keychain','getUserInfo','session','ERROR','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile','\x20\x20tdx\x20--profile\x20','54246104sljqVr','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','warn','(session:\x20','trim','confirm','\x0aSetup\x20cancelled','\x27\x20does\x20not\x20exist.','4cGUWnx','profile:create','password','\x20\x20-\x20','method','Validating\x20API\x20key...','Create\x20a\x20new\x20profile','create','tdx:\x20profile\x20create','parent_segment','red','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','2429646VBCVRe','Failed\x20to\x20remove\x20profile:\x20','9NWsDhn','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aSaved\x20to:\x20','1XLAlXy','\x27\x20removed\x20from\x20configuration','5276810XTnFfu','\x20Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Changing\x20site\x20to\x20\x27','\x27\x20requires\x20API\x20key\x20validation.','Default\x20profile\x20set\x20to:\x20','test','\x20--default\x27\x20to\x20save\x20permanently','profile:remove','llm_project','1698IqEMPZ','\x27\x20does\x20not\x20exist.\x20Create\x20it?','config','llm_agent','length','logLevel','us01','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','10641616eNkRev','log','\x27\x20created','default','VALID_KEYS','/app/mp/ak','jobs','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:use','Unknown\x20key\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','includes','API\x20Key','(cleared)','dim','tdx.json','8257610uIzeIx','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20your\x20TD\x20API\x20key:','apikey','Setup\x20cancelled','description','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','profileName','green','select','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20API\x20key\x20is\x20valid\x20(User:\x20','database','Set\x20a\x20profile\x20configuration\x20value','oauth','message','split','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','tdx:\x20profile\x20remove','apiKey','bold','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','validate','Profile\x20\x27','Choose\x20authentication\x20method:','name','error','join','\x27\x20updated:\x20','site','OAuth\x20(browser\x20login)','text','Session\x20profile\x20set\x20to:\x20'];a31_0xc83d=function(){return _0x35ef4d;};return a31_0xc83d();}import{getConfigDir}from'../core/config.js';import*as a31_0x4070e7 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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a31_0x7f09(_0x341c4e,_0xa3cd0f){_0x341c4e=_0x341c4e-0x10e;const _0xc83d41=a31_0xc83d();let _0x7f090f=_0xc83d41[_0x341c4e];return _0x7f090f;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x45d6f6 from'prompts';import a31_0x1e8b91 from'chalk';function validateProfileName(_0xa744eb){const _0x39d49a=a31_0x7f09;if(!_0xa744eb||!_0xa744eb['trim']())return _0x39d49a(0x17f);const _0x4509c9=_0xa744eb['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x39d49a(0x161)](_0x4509c9))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x4509c9))return _0x39d49a(0x128)+_0x4509c9+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x1f65e9(0x12a)]=a31_0x1f65e9(0x149);[a31_0x1f65e9(0x110)]=a31_0x1f65e9(0x14e);async['execute'](_0x5ce4bd){const _0x3a2ce6=a31_0x1f65e9,{options:_0x36930b,args:_0x4ecc16}=_0x5ce4bd;console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x121)](_0x3a2ce6(0x150)));let _0xe6364e;if(_0x4ecc16[_0x3a2ce6(0x169)]>0x0&&_0x4ecc16[0x0]){const _0xbb3dd4=_0x4ecc16[0x0]['trim'](),_0x144a2e=validateProfileName(_0xbb3dd4);if(_0x144a2e!==!![])return console[_0x3a2ce6(0x12b)](a31_0x1e8b91['red'](_0x144a2e)),0x1;_0xe6364e=_0xbb3dd4;}else{const _0x11d49b=await a31_0x45d6f6({'type':_0x3a2ce6(0x130),'name':_0x3a2ce6(0x112),'message':_0x3a2ce6(0x133),'validate':validateProfileName});if(!_0x11d49b[_0x3a2ce6(0x112)])return console['log'](_0x3a2ce6(0x146)),0x1;_0xe6364e=_0x11d49b[_0x3a2ce6(0x112)][_0x3a2ce6(0x144)]();}const _0x123a56=await a31_0x45d6f6({'type':_0x3a2ce6(0x130),'name':_0x3a2ce6(0x110),'message':'Enter\x20description\x20(optional):'}),_0x1b4a4e=_0x123a56['description']?.['trim']()||undefined,_0x345f7e=_0x36930b['site']||_0x3a2ce6(0x16b),_0x38a131=await promptSiteSelection(_0x345f7e,_0xe6364e,_0x3a2ce6(0x10f));if(!_0x38a131)return 0x1;const _0x22397c=resolveSite(_0x38a131);if(isOAuthSupported(_0x22397c)){const _0xb01541=await a31_0x45d6f6({'type':_0x3a2ce6(0x114),'name':_0x3a2ce6(0x14c),'message':_0x3a2ce6(0x129),'choices':[{'title':_0x3a2ce6(0x12f),'value':_0x3a2ce6(0x11a)},{'title':_0x3a2ce6(0x17a),'value':_0x3a2ce6(0x10e)}]});if(!_0xb01541['method'])return console[_0x3a2ce6(0x16e)]('\x0aSetup\x20cancelled'),0x1;if(_0xb01541[_0x3a2ce6(0x14c)]==='oauth'){if(_0x1b4a4e){const _0x510ad0={'site':_0x22397c,'description':_0x1b4a4e};saveProfileToUserConfig(_0xe6364e,_0x510ad0);}return await runOAuthLoginFlow(_0x22397c,_0xe6364e,_0x36930b[_0x3a2ce6(0x16a)]??LogLevel[_0x3a2ce6(0x13c)]),0x0;}}console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x153)+_0x22397c),console['log'](_0x3a2ce6(0x178)),console['log']('\x20\x20'+getConsoleUrl(_0x22397c,'/app/mp/ak'));const _0x5cd6f2=await a31_0x45d6f6({'type':_0x3a2ce6(0x14a),'name':_0x3a2ce6(0x120),'message':_0x3a2ce6(0x180),'validate':_0x38cbf1=>{const _0xd202ca=_0x3a2ce6;if(!_0x38cbf1||!_0x38cbf1[_0xd202ca(0x144)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5cd6f2[_0x3a2ce6(0x120)])return console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x146)),0x1;const _0x228d97=_0x5cd6f2[_0x3a2ce6(0x120)];console['log']('Validating\x20API\x20key...');try{const _0xd634d8=TDX[_0x3a2ce6(0x14f)]({'site':_0x22397c,'apiKey':_0x228d97[_0x3a2ce6(0x144)](),'logLevel':_0x36930b[_0x3a2ce6(0x16a)]??LogLevel[_0x3a2ce6(0x13c)]}),_0x252058=await _0xd634d8[_0x3a2ce6(0x173)][_0x3a2ce6(0x13a)]();console[_0x3a2ce6(0x16e)](a31_0x1e8b91['green']('✓')+_0x3a2ce6(0x117)+_0x252058[_0x3a2ce6(0x174)]+')');const _0x3ce82e=await isKeychainAvailable();_0x3ce82e?(await saveAPIKeyAsync(_0x228d97[_0x3a2ce6(0x144)](),_0x22397c,_0xe6364e),console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x113)]('✓')+_0x3a2ce6(0x13d)+_0xe6364e+')')):(console[_0x3a2ce6(0x142)](a31_0x1e8b91[_0x3a2ce6(0x134)](_0x3a2ce6(0x125))),console[_0x3a2ce6(0x142)](a31_0x1e8b91[_0x3a2ce6(0x134)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x48a869={'site':_0x22397c,..._0x1b4a4e&&{'description':_0x1b4a4e}};return saveProfileToUserConfig(_0xe6364e,_0x48a869),console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x113)]('✓')+'\x20Profile\x20\x27'+_0xe6364e+_0x3a2ce6(0x16f)),console[_0x3a2ce6(0x16e)](),console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x15d)),console['log']('\x20\x20tdx\x20--profile\x20'+_0xe6364e+_0x3a2ce6(0x157)),console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x13f)+_0xe6364e+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5a765a){if(_0x5a765a instanceof HTTPClientError&&_0x5a765a['status']===0x191)return printAuthError(_0x5a765a),0x1;return console[_0x3a2ce6(0x12b)](a31_0x1e8b91[_0x3a2ce6(0x152)](_0x3a2ce6(0x137)+(_0x5a765a instanceof Error?_0x5a765a[_0x3a2ce6(0x11b)]:String(_0x5a765a)))),console[_0x3a2ce6(0x12b)](_0x3a2ce6(0x111)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a31_0x1f65e9(0x163);[a31_0x1f65e9(0x110)]='Remove\x20a\x20profile';[a31_0x1f65e9(0x127)](_0x962bc1){const _0x508e6f=a31_0x1f65e9,{args:_0x96fca4}=_0x962bc1;if(_0x96fca4[_0x508e6f(0x169)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a31_0x1f65e9(0x11d)](_0x1f7575){const _0x2a43b7=a31_0x1f65e9,{args:_0x5e1e6d}=_0x1f7575,_0x315b0d=_0x5e1e6d[0x0];console['log'](a31_0x1e8b91[_0x2a43b7(0x121)](_0x2a43b7(0x11f)));if(!profileExists(_0x315b0d)){console[_0x2a43b7(0x12b)](a31_0x1e8b91[_0x2a43b7(0x152)](_0x2a43b7(0x128)+_0x315b0d+_0x2a43b7(0x147))),console[_0x2a43b7(0x16e)](_0x2a43b7(0x123));const _0x1ff239=listProfiles();if(_0x1ff239[_0x2a43b7(0x169)]===0x0)console[_0x2a43b7(0x16e)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x162608 of _0x1ff239){console[_0x2a43b7(0x16e)](_0x2a43b7(0x14b)+_0x162608[_0x2a43b7(0x12a)]);}return 0x1;}const _0x2494e1=await a31_0x45d6f6({'type':'confirm','name':_0x2a43b7(0x145),'message':_0x2a43b7(0x136)+_0x315b0d+'\x27?','initial':![]});if(!_0x2494e1[_0x2a43b7(0x145)])return console[_0x2a43b7(0x16e)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x315b0d),console['log'](a31_0x1e8b91['green']('✓')+_0x2a43b7(0x15c)+_0x315b0d+_0x2a43b7(0x15a));}catch(_0x573813){return console[_0x2a43b7(0x12b)](a31_0x1e8b91['red'](_0x2a43b7(0x155)+(_0x573813 instanceof Error?_0x573813[_0x2a43b7(0x11b)]:String(_0x573813)))),0x1;}const _0x1e70c1=await isKeychainAvailable();if(_0x1e70c1){const _0x1cda1c=await deleteKeychainAPIKey(_0x315b0d);_0x1cda1c&&console[_0x2a43b7(0x16e)](a31_0x1e8b91[_0x2a43b7(0x113)]('✓')+_0x2a43b7(0x139));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x1f65e9(0x12a)]=a31_0x1f65e9(0x115);[a31_0x1f65e9(0x110)]=a31_0x1f65e9(0x119);static [a31_0x1f65e9(0x171)]=[a31_0x1f65e9(0x12e),a31_0x1f65e9(0x118),a31_0x1f65e9(0x151),a31_0x1f65e9(0x164),a31_0x1f65e9(0x168),a31_0x1f65e9(0x110)];[a31_0x1f65e9(0x127)](_0x2b2165){const _0x3d104e=a31_0x1f65e9,{args:_0x376513,options:_0x181114}=_0x2b2165,_0x1580d2=_0x181114[_0x3d104e(0x13e)]||getActiveProfile();if(!_0x1580d2)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(_0x376513['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x12c)](',\x20');const _0x15f1ea=_0x376513[0x0];if(!_0x15f1ea[_0x3d104e(0x179)]('='))return _0x3d104e(0x122)+ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x12c)](',\x20');const [_0x29a0b3]=_0x15f1ea['split']('=',0x2);if(!ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x179)](_0x29a0b3))return _0x3d104e(0x177)+_0x29a0b3+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3d104e(0x171)]['join'](',\x20');return undefined;}async[a31_0x1f65e9(0x11d)](_0x2c5a2c){const _0x2373eb=a31_0x1f65e9,{args:_0x491ff7,options:_0x2ccb36}=_0x2c5a2c,_0x2494bc=_0x2ccb36[_0x2373eb(0x13e)]||getActiveProfile(),[_0x54ccef,..._0xa59d55]=_0x491ff7[0x0][_0x2373eb(0x11c)]('='),_0xba41b7=_0xa59d55[_0x2373eb(0x12c)]('=');console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x121)]('tdx:\x20profile\x20set'));if(!profileExists(_0x2494bc)){const _0x4207b5=await a31_0x45d6f6({'type':_0x2373eb(0x145),'name':_0x2373eb(0x14f),'message':_0x2373eb(0x128)+_0x2494bc+_0x2373eb(0x166),'initial':!![]});if(!_0x4207b5[_0x2373eb(0x14f)])return console[_0x2373eb(0x16e)]('Operation\x20cancelled'),0x1;}const _0x3f1e44=loadProfile(_0x2494bc),_0x449c7c=_0x3f1e44?.[_0x2373eb(0x167)]||{};if(_0x54ccef===_0x2373eb(0x12e)){const _0x5a24e9=resolveSite(_0xba41b7);console[_0x2373eb(0x16e)](_0x2373eb(0x15e)+_0x5a24e9+_0x2373eb(0x15f)),console[_0x2373eb(0x16e)](_0x2373eb(0x16c)),console[_0x2373eb(0x16e)]('\x20\x20'+getConsoleUrl(_0x5a24e9,_0x2373eb(0x172)));const _0x848a73=await a31_0x45d6f6({'type':_0x2373eb(0x14a),'name':'apiKey','message':_0x2373eb(0x175),'validate':_0x4a3db7=>{const _0x5e66ee=_0x2373eb;if(!_0x4a3db7||!_0x4a3db7[_0x5e66ee(0x144)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x848a73[_0x2373eb(0x120)])return console[_0x2373eb(0x16e)](_0x2373eb(0x124)),0x1;console[_0x2373eb(0x16e)](_0x2373eb(0x14d));try{const _0x2e8c14=TDX['create']({'site':_0x5a24e9,'apiKey':_0x848a73['apiKey'][_0x2373eb(0x144)](),'logLevel':_0x2ccb36[_0x2373eb(0x16a)]??LogLevel['ERROR']}),_0x43bb64=await _0x2e8c14[_0x2373eb(0x173)][_0x2373eb(0x13a)]();console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x113)]('✓')+_0x2373eb(0x117)+_0x43bb64[_0x2373eb(0x174)]+')');const _0x298d35=await isKeychainAvailable();_0x298d35?(await saveAPIKeyAsync(_0x848a73[_0x2373eb(0x120)]['trim'](),_0x5a24e9,_0x2494bc),console[_0x2373eb(0x16e)](a31_0x1e8b91['green']('✓')+_0x2373eb(0x116))):console[_0x2373eb(0x142)](a31_0x1e8b91['yellow'](_0x2373eb(0x125))),_0x449c7c[_0x2373eb(0x12e)]=_0x5a24e9;}catch(_0x23e720){if(_0x23e720 instanceof HTTPClientError&&_0x23e720[_0x2373eb(0x126)]===0x191)return printAuthError(_0x23e720),0x1;return console['error'](a31_0x1e8b91[_0x2373eb(0x152)](_0x2373eb(0x137)+(_0x23e720 instanceof Error?_0x23e720[_0x2373eb(0x11b)]:String(_0x23e720)))),console[_0x2373eb(0x12b)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x449c7c[_0x54ccef]=_0xba41b7||undefined;return saveProfileToUserConfig(_0x2494bc,_0x449c7c),console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x113)]('✓')+'\x20Profile\x20\x27'+_0x2494bc+_0x2373eb(0x12d)+_0x54ccef+'='+(_0xba41b7||_0x2373eb(0x17b))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a31_0x1f65e9(0x176);[a31_0x1f65e9(0x110)]='Set\x20session\x20profile';[a31_0x1f65e9(0x127)](_0x51f5ed){const _0x55ce44=a31_0x1f65e9,{args:_0x10b617}=_0x51f5ed;if(_0x10b617[_0x55ce44(0x169)]===0x0)return _0x55ce44(0x11e);return undefined;}async['execute'](_0x2abc42){const _0x387d2f=a31_0x1f65e9,{args:_0x355e00,options:_0x216e2b}=_0x2abc42,_0x571895=_0x355e00[0x0],_0x2b62f1=_0x216e2b[_0x387d2f(0x170)];cleanExpiredSessions();if(!profileExists(_0x571895)){console['error'](a31_0x1e8b91[_0x387d2f(0x152)]('Profile\x20\x27'+_0x571895+_0x387d2f(0x147))),console['log'](_0x387d2f(0x123));const _0x118fb6=listProfiles();if(_0x118fb6['length']===0x0)console[_0x387d2f(0x16e)](_0x387d2f(0x132));else for(const _0x50f202 of _0x118fb6){console[_0x387d2f(0x16e)](_0x387d2f(0x14b)+_0x50f202[_0x387d2f(0x12a)]);}return 0x1;}if(_0x2b62f1){const _0xadf436=a31_0x4070e7[_0x387d2f(0x12c)](getConfigDir(),_0x387d2f(0x17d));return saveActiveProfileToUserConfig(_0x571895),console[_0x387d2f(0x16e)](_0x387d2f(0x160)+a31_0x1e8b91['green'](_0x571895)),console[_0x387d2f(0x16e)](a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x158)+_0xadf436)),0x0;}const _0x3cedab=getSessionID(_0x216e2b[_0x387d2f(0x13b)]);return saveSessionContext({'profile':_0x571895},_0x216e2b[_0x387d2f(0x13b)]),console['log'](_0x387d2f(0x131)+a31_0x1e8b91[_0x387d2f(0x113)](_0x571895)+'\x20'+a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x143)+_0x3cedab+')')),console['log'](a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x141)+_0x571895+_0x387d2f(0x162))),0x0;}}
|
|
1
|
+
function a31_0x4e7d(_0xbdbed6,_0x361a1b){_0xbdbed6=_0xbdbed6-0x80;const _0x3371f9=a31_0x3371();let _0x4e7dd1=_0x3371f9[_0xbdbed6];return _0x4e7dd1;}const a31_0x254f57=a31_0x4e7d;(function(_0x4b79cc,_0x1187dd){const _0x39bf46=a31_0x4e7d,_0x509d64=_0x4b79cc();while(!![]){try{const _0x55b7c6=-parseInt(_0x39bf46(0xc9))/0x1*(parseInt(_0x39bf46(0xa0))/0x2)+parseInt(_0x39bf46(0xc2))/0x3*(parseInt(_0x39bf46(0xa8))/0x4)+parseInt(_0x39bf46(0xb3))/0x5*(parseInt(_0x39bf46(0xbb))/0x6)+parseInt(_0x39bf46(0xbc))/0x7*(-parseInt(_0x39bf46(0xc3))/0x8)+-parseInt(_0x39bf46(0xe7))/0x9*(-parseInt(_0x39bf46(0xef))/0xa)+-parseInt(_0x39bf46(0xcc))/0xb+-parseInt(_0x39bf46(0xde))/0xc;if(_0x55b7c6===_0x1187dd)break;else _0x509d64['push'](_0x509d64['shift']());}catch(_0x949bdd){_0x509d64['push'](_0x509d64['shift']());}}}(a31_0x3371,0x1cb2d));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 a31_0xcd274e from'node:path';function a31_0x3371(){const _0x30cc0b=['name','warn','Unknown\x20key\x20\x27','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20description\x20(optional):','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','length','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:use','oauth','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20created','log','OAuth\x20(browser\x20login)','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','error','\x20API\x20key\x20is\x20valid\x20(User:\x20','split','VALID_KEYS','✗\x20Validation\x20failed:\x20','\x20--default\x27\x20to\x20save\x20permanently','Failed\x20to\x20remove\x20profile:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','description','Enter\x20profile\x20name:','\x20Profile\x20\x27','tdx:\x20profile\x20set','Profile\x20\x27','84962jKFFvE','\x0aAvailable\x20profiles:','You\x20can\x20find\x20your\x20API\x20key\x20at:','status','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','message','Site\x20was\x20not\x20changed.','788692HOvMUG','Set\x20session\x20profile','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','red','profile:remove','parent_segment','yellow','apiKey','default','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','65iPlwgs','method','text','profile:set','\x0aOperation\x20cancelled','llm_agent','session','getUserInfo','87852mjUEIF','1000867oNVAgj','database','jobs','Operation\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','(session:\x20','3pPMvBH','8AlLiVq','select','Choose\x20authentication\x20method:','logLevel','config','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','2PzDAsR','Session\x20profile\x20set\x20to:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','1196096hAyxmI','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','site','\x0aSaved\x20to:\x20','\x27\x20updated:\x20','tdx.json','Removal\x20cancelled','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>','validate','confirm','create','\x20\x20(no\x20profiles\x20found)','ERROR','dim','\x0aSetup\x20cancelled','includes','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20does\x20not\x20exist.','384036siSLJh','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20\x20-\x20','/app/mp/ak','\x20\x20tdx\x20--profile\x20','profile','Create\x20a\x20new\x20profile','execute','profileName','1944EoJptS','Changing\x20site\x20to\x20\x27','trim','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','password','llm_project','green','4570nOIuYJ','Profile\x20name\x20cannot\x20be\x20empty','join','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'];a31_0x3371=function(){return _0x30cc0b;};return a31_0x3371();}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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x4d8956 from'prompts';import a31_0x11c719 from'chalk';function validateProfileName(_0x12e665){const _0x25f469=a31_0x4e7d;if(!_0x12e665||!_0x12e665['trim']())return _0x25f469(0x80);const _0x3f4c13=_0x12e665[_0x25f469(0xe9)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x3f4c13))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3f4c13))return'Profile\x20\x27'+_0x3f4c13+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a31_0x254f57(0xe4);async[a31_0x254f57(0xe5)](_0x22bb5a){const _0x459dc7=a31_0x254f57,{options:_0x569ec1,args:_0x38884b}=_0x22bb5a;console['log'](a31_0x11c719['bold']('tdx:\x20profile\x20create'));let _0x4bdfbc;if(_0x38884b['length']>0x0&&_0x38884b[0x0]){const _0x3c2a0d=_0x38884b[0x0][_0x459dc7(0xe9)](),_0x89eaf1=validateProfileName(_0x3c2a0d);if(_0x89eaf1!==!![])return console[_0x459dc7(0x93)](a31_0x11c719[_0x459dc7(0xac)](_0x89eaf1)),0x1;_0x4bdfbc=_0x3c2a0d;}else{const _0x6da4aa=await a31_0x4d8956({'type':_0x459dc7(0xb5),'name':_0x459dc7(0xe6),'message':_0x459dc7(0x9c),'validate':validateProfileName});if(!_0x6da4aa[_0x459dc7(0xe6)])return console['log'](_0x459dc7(0xda)),0x1;_0x4bdfbc=_0x6da4aa['profileName'][_0x459dc7(0xe9)]();}const _0x52259a=await a31_0x4d8956({'type':_0x459dc7(0xb5),'name':_0x459dc7(0x9b),'message':_0x459dc7(0x87)}),_0x41bada=_0x52259a['description']?.[_0x459dc7(0xe9)]()||undefined,_0x332d9d=_0x569ec1[_0x459dc7(0xce)]||'us01',_0x13b6cf=await promptSiteSelection(_0x332d9d,_0x4bdfbc,'Setup\x20cancelled');if(!_0x13b6cf)return 0x1;const _0x23e392=resolveSite(_0x13b6cf);if(isOAuthSupported(_0x23e392)){const _0x5e5901=await a31_0x4d8956({'type':_0x459dc7(0xc4),'name':_0x459dc7(0xb4),'message':_0x459dc7(0xc5),'choices':[{'title':_0x459dc7(0x91),'value':_0x459dc7(0x8d)},{'title':'API\x20Key','value':'apikey'}]});if(!_0x5e5901[_0x459dc7(0xb4)])return console[_0x459dc7(0x90)](_0x459dc7(0xda)),0x1;if(_0x5e5901[_0x459dc7(0xb4)]===_0x459dc7(0x8d)){if(_0x41bada){const _0x4d9aff={'site':_0x23e392,'description':_0x41bada};saveProfileToUserConfig(_0x4bdfbc,_0x4d9aff);}return await runOAuthLoginFlow(_0x23e392,_0x4bdfbc,_0x569ec1['logLevel']??LogLevel[_0x459dc7(0xd8)]),0x0;}}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x23e392),console['log'](_0x459dc7(0xa2)),console[_0x459dc7(0x90)]('\x20\x20'+getConsoleUrl(_0x23e392,_0x459dc7(0xe1)));const _0x512f70=await a31_0x4d8956({'type':_0x459dc7(0xec),'name':_0x459dc7(0xb0),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x22447e=>{const _0xd780f=_0x459dc7;if(!_0x22447e||!_0x22447e[_0xd780f(0xe9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x512f70[_0x459dc7(0xb0)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x49f7a6=_0x512f70[_0x459dc7(0xb0)];console[_0x459dc7(0x90)](_0x459dc7(0xa5));try{const _0x13db85=TDX[_0x459dc7(0xd6)]({'site':_0x23e392,'apiKey':_0x49f7a6[_0x459dc7(0xe9)](),'logLevel':_0x569ec1['logLevel']??LogLevel[_0x459dc7(0xd8)]}),_0x373c21=await _0x13db85['jobs'][_0x459dc7(0xba)]();console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+_0x459dc7(0x94)+_0x373c21['email']+')');const _0x3385d8=await isKeychainAvailable();_0x3385d8?(await saveAPIKeyAsync(_0x49f7a6[_0x459dc7(0xe9)](),_0x23e392,_0x4bdfbc),console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+_0x459dc7(0xcd)+_0x4bdfbc+')')):(console[_0x459dc7(0x84)](a31_0x11c719[_0x459dc7(0xaf)](_0x459dc7(0xcb))),console[_0x459dc7(0x84)](a31_0x11c719[_0x459dc7(0xaf)](_0x459dc7(0x9a))));const _0x2c6840={'site':_0x23e392,..._0x41bada&&{'description':_0x41bada}};return saveProfileToUserConfig(_0x4bdfbc,_0x2c6840),console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+'\x20Profile\x20\x27'+_0x4bdfbc+_0x459dc7(0x8f)),console[_0x459dc7(0x90)](),console[_0x459dc7(0x90)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x459dc7(0x90)](_0x459dc7(0xe2)+_0x4bdfbc+_0x459dc7(0xb2)),console['log'](_0x459dc7(0xe2)+_0x4bdfbc+_0x459dc7(0x82)),0x0;}catch(_0x407b92){if(_0x407b92 instanceof HTTPClientError&&_0x407b92[_0x459dc7(0xa3)]===0x191)return printAuthError(_0x407b92),0x1;return console[_0x459dc7(0x93)](a31_0x11c719[_0x459dc7(0xac)](_0x459dc7(0x97)+(_0x407b92 instanceof Error?_0x407b92[_0x459dc7(0xa6)]:String(_0x407b92)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x254f57(0x83)]=a31_0x254f57(0xad);[a31_0x254f57(0x9b)]='Remove\x20a\x20profile';[a31_0x254f57(0xd4)](_0x2245e9){const _0x3f5329=a31_0x254f57,{args:_0x3e0b42}=_0x2245e9;if(_0x3e0b42[_0x3f5329(0x89)]===0x0)return _0x3f5329(0x8a);return undefined;}async['execute'](_0x33cfa0){const _0x2a8863=a31_0x254f57,{args:_0x572f41}=_0x33cfa0,_0x597899=_0x572f41[0x0];console[_0x2a8863(0x90)](a31_0x11c719[_0x2a8863(0xaa)](_0x2a8863(0xeb)));if(!profileExists(_0x597899)){console[_0x2a8863(0x93)](a31_0x11c719[_0x2a8863(0xac)]('Profile\x20\x27'+_0x597899+_0x2a8863(0xdd))),console[_0x2a8863(0x90)](_0x2a8863(0xa1));const _0x1248cd=listProfiles();if(_0x1248cd[_0x2a8863(0x89)]===0x0)console[_0x2a8863(0x90)](_0x2a8863(0xd7));else for(const _0x4a0406 of _0x1248cd){console['log']('\x20\x20-\x20'+_0x4a0406['name']);}return 0x1;}const _0x552fa2=await a31_0x4d8956({'type':_0x2a8863(0xd5),'name':'confirm','message':_0x2a8863(0x92)+_0x597899+'\x27?','initial':![]});if(!_0x552fa2[_0x2a8863(0xd5)])return console[_0x2a8863(0x90)](_0x2a8863(0xd2)),0x0;try{removeProfileFromUserConfig(_0x597899),console[_0x2a8863(0x90)](a31_0x11c719['green']('✓')+_0x2a8863(0x9d)+_0x597899+_0x2a8863(0xea));}catch(_0x2eddf9){return console[_0x2a8863(0x93)](a31_0x11c719[_0x2a8863(0xac)](_0x2a8863(0x99)+(_0x2eddf9 instanceof Error?_0x2eddf9['message']:String(_0x2eddf9)))),0x1;}const _0x33cc5c=await isKeychainAvailable();if(_0x33cc5c){const _0x2b40f6=await deleteKeychainAPIKey(_0x597899);_0x2b40f6&&console[_0x2a8863(0x90)](a31_0x11c719['green']('✓')+_0x2a8863(0x8e));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a31_0x254f57(0xb6);[a31_0x254f57(0x9b)]='Set\x20a\x20profile\x20configuration\x20value';static [a31_0x254f57(0x96)]=['site',a31_0x254f57(0xbd),a31_0x254f57(0xae),a31_0x254f57(0xed),a31_0x254f57(0xb8),'description'];[a31_0x254f57(0xd4)](_0x224fad){const _0x142111=a31_0x254f57,{args:_0xed508e,options:_0x4a0f86}=_0x224fad,_0xb3800a=_0x4a0f86[_0x142111(0xe3)]||getActiveProfile();if(!_0xb3800a)return _0x142111(0xd3);if(_0xed508e[_0x142111(0x89)]===0x0)return _0x142111(0x88)+ProfileSetCommand[_0x142111(0x96)]['join'](',\x20');const _0xd1b49a=_0xed508e[0x0];if(!_0xd1b49a[_0x142111(0xdb)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x142111(0x96)][_0x142111(0x81)](',\x20');const [_0x49105a]=_0xd1b49a[_0x142111(0x95)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x142111(0xdb)](_0x49105a))return _0x142111(0x85)+_0x49105a+_0x142111(0xc0)+ProfileSetCommand['VALID_KEYS'][_0x142111(0x81)](',\x20');return undefined;}async[a31_0x254f57(0xe5)](_0x34a972){const _0x5a03a=a31_0x254f57,{args:_0x455848,options:_0x1c7fa7}=_0x34a972,_0x4b06ad=_0x1c7fa7[_0x5a03a(0xe3)]||getActiveProfile(),[_0x312d72,..._0xb28201]=_0x455848[0x0][_0x5a03a(0x95)]('='),_0x31bbcb=_0xb28201['join']('=');console['log'](a31_0x11c719[_0x5a03a(0xaa)](_0x5a03a(0x9e)));if(!profileExists(_0x4b06ad)){const _0x371f7d=await a31_0x4d8956({'type':_0x5a03a(0xd5),'name':_0x5a03a(0xd6),'message':'Profile\x20\x27'+_0x4b06ad+_0x5a03a(0x8b),'initial':!![]});if(!_0x371f7d[_0x5a03a(0xd6)])return console[_0x5a03a(0x90)](_0x5a03a(0xbf)),0x1;}const _0x40b9a2=loadProfile(_0x4b06ad),_0x198e42=_0x40b9a2?.[_0x5a03a(0xc7)]||{};if(_0x312d72==='site'){const _0x18fa13=resolveSite(_0x31bbcb);console[_0x5a03a(0x90)](_0x5a03a(0xe8)+_0x18fa13+_0x5a03a(0xdc)),console[_0x5a03a(0x90)](_0x5a03a(0x86)),console[_0x5a03a(0x90)]('\x20\x20'+getConsoleUrl(_0x18fa13,_0x5a03a(0xe1)));const _0x2f150a=await a31_0x4d8956({'type':_0x5a03a(0xec),'name':_0x5a03a(0xb0),'message':_0x5a03a(0xc8),'validate':_0x300436=>{const _0x5995ad=_0x5a03a;if(!_0x300436||!_0x300436[_0x5995ad(0xe9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2f150a[_0x5a03a(0xb0)])return console[_0x5a03a(0x90)](_0x5a03a(0xb7)),0x1;console['log'](_0x5a03a(0xa5));try{const _0x9403a2=TDX[_0x5a03a(0xd6)]({'site':_0x18fa13,'apiKey':_0x2f150a[_0x5a03a(0xb0)][_0x5a03a(0xe9)](),'logLevel':_0x1c7fa7[_0x5a03a(0xc6)]??LogLevel['ERROR']}),_0x32301d=await _0x9403a2[_0x5a03a(0xbe)][_0x5a03a(0xba)]();console['log'](a31_0x11c719[_0x5a03a(0xee)]('✓')+_0x5a03a(0x94)+_0x32301d['email']+')');const _0x20eeea=await isKeychainAvailable();_0x20eeea?(await saveAPIKeyAsync(_0x2f150a[_0x5a03a(0xb0)][_0x5a03a(0xe9)](),_0x18fa13,_0x4b06ad),console[_0x5a03a(0x90)](a31_0x11c719[_0x5a03a(0xee)]('✓')+_0x5a03a(0xdf))):console[_0x5a03a(0x84)](a31_0x11c719[_0x5a03a(0xaf)](_0x5a03a(0xcb))),_0x198e42[_0x5a03a(0xce)]=_0x18fa13;}catch(_0x2a996f){if(_0x2a996f instanceof HTTPClientError&&_0x2a996f[_0x5a03a(0xa3)]===0x191)return printAuthError(_0x2a996f),0x1;return console[_0x5a03a(0x93)](a31_0x11c719[_0x5a03a(0xac)](_0x5a03a(0x97)+(_0x2a996f instanceof Error?_0x2a996f[_0x5a03a(0xa6)]:String(_0x2a996f)))),console[_0x5a03a(0x93)](_0x5a03a(0xa7)),0x1;}}else _0x198e42[_0x312d72]=_0x31bbcb||undefined;return saveProfileToUserConfig(_0x4b06ad,_0x198e42),console['log'](a31_0x11c719[_0x5a03a(0xee)]('✓')+'\x20Profile\x20\x27'+_0x4b06ad+_0x5a03a(0xd0)+_0x312d72+'='+(_0x31bbcb||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x254f57(0x83)]=a31_0x254f57(0x8c);[a31_0x254f57(0x9b)]=a31_0x254f57(0xa9);[a31_0x254f57(0xd4)](_0x45edfd){const _0x4f5174=a31_0x254f57,{args:_0x5b3eff}=_0x45edfd;if(_0x5b3eff['length']===0x0)return _0x4f5174(0xab);return undefined;}async['execute'](_0x300664){const _0x13212e=a31_0x254f57,{args:_0x49f368,options:_0x56e288}=_0x300664,_0xeeea29=_0x49f368[0x0],_0x293768=_0x56e288[_0x13212e(0xb1)];cleanExpiredSessions();if(!profileExists(_0xeeea29)){console[_0x13212e(0x93)](a31_0x11c719[_0x13212e(0xac)](_0x13212e(0x9f)+_0xeeea29+_0x13212e(0xdd))),console['log'](_0x13212e(0xa1));const _0x3bc142=listProfiles();if(_0x3bc142[_0x13212e(0x89)]===0x0)console['log'](_0x13212e(0xd7));else for(const _0x271cef of _0x3bc142){console[_0x13212e(0x90)](_0x13212e(0xe0)+_0x271cef[_0x13212e(0x83)]);}return 0x1;}if(_0x293768){const _0x1d95a5=a31_0xcd274e[_0x13212e(0x81)](getConfigDir(),_0x13212e(0xd1));return saveActiveProfileToUserConfig(_0xeeea29),console[_0x13212e(0x90)](_0x13212e(0xa4)+a31_0x11c719['green'](_0xeeea29)),console['log'](a31_0x11c719[_0x13212e(0xd9)](_0x13212e(0xcf)+_0x1d95a5)),0x0;}const _0x24831c=getSessionID(_0x56e288[_0x13212e(0xb9)]);return saveSessionContext({'profile':_0xeeea29},_0x56e288[_0x13212e(0xb9)]),console[_0x13212e(0x90)](_0x13212e(0xca)+a31_0x11c719[_0x13212e(0xee)](_0xeeea29)+'\x20'+a31_0x11c719[_0x13212e(0xd9)](_0x13212e(0xc1)+_0x24831c+')')),console[_0x13212e(0x90)](a31_0x11c719['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xeeea29+_0x13212e(0x98))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x5dbf1e=a32_0x17c1;(function(_0x406443,_0x158deb){const _0x1ff7c5=a32_0x17c1,_0x25e7ba=_0x406443();while(!![]){try{const _0x22fe9b=parseInt(_0x1ff7c5(0x146))/0x1+parseInt(_0x1ff7c5(0x144))/0x2+-parseInt(_0x1ff7c5(0x152))/0x3*(-parseInt(_0x1ff7c5(0x13a))/0x4)+-parseInt(_0x1ff7c5(0x139))/0x5*(-parseInt(_0x1ff7c5(0x145))/0x6)+-parseInt(_0x1ff7c5(0x14d))/0x7*(parseInt(_0x1ff7c5(0x13f))/0x8)+-parseInt(_0x1ff7c5(0x147))/0x9+parseInt(_0x1ff7c5(0x148))/0xa*(-parseInt(_0x1ff7c5(0x151))/0xb);if(_0x22fe9b===_0x158deb)break;else _0x25e7ba['push'](_0x25e7ba['shift']());}catch(_0x8cbdcd){_0x25e7ba['push'](_0x25e7ba['shift']());}}}(a32_0x409e,0x1f79f));function a32_0x17c1(_0xcc50ce,_0x10a3e){_0xcc50ce=_0xcc50ce-0x138;const _0x409ec7=a32_0x409e();let _0x17c128=_0x409ec7[_0xcc50ce];return _0x17c128;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x41b0f6 from'chalk';function a32_0x409e(){const _0x4442bc=['\x20\x20Global:\x20~/.config/tdx/tdx.json','length','11AUklFU','42wVsSaP','profiles','log','290395lKTJwv','72764hcJUrf','map','execute','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','216616dwUdRm','Error:\x20','dim','👤\x20','config','140808mGRAkv','18YqulXj','211668xPhpKN','419724YZBauD','2917270nkLoeP','scope','description','error','green','63pztVSy','List\x20all\x20available\x20profiles'];a32_0x409e=function(){return _0x4442bc;};return a32_0x409e();}export class ProfilesCommand extends BaseCommand{[a32_0x5dbf1e(0x13d)]=a32_0x5dbf1e(0x153);[a32_0x5dbf1e(0x14a)]=a32_0x5dbf1e(0x14e);async[a32_0x5dbf1e(0x13c)](_0x4f2a9f){const _0x178d13=a32_0x5dbf1e,{options:_0xb1a65b}=_0x4f2a9f;try{const _0x4e3c49=listProfiles(),_0x5a695f=getActiveProfile();if(_0x4e3c49[_0x178d13(0x150)]===0x0)return console[_0x178d13(0x138)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x178d13(0x138)](_0x178d13(0x13e)),console[_0x178d13(0x138)](_0x178d13(0x14f)),0x0;const _0x2a6502=_0x4e3c49[_0x178d13(0x13b)](_0x29cdfc=>{const _0x41299b=_0x178d13,_0x24aab1=_0x29cdfc[_0x41299b(0x13d)]===_0x5a695f,_0x370dc1=getProfileParams(_0x29cdfc[_0x41299b(0x143)]);return{'name':_0x29cdfc['name'],'active':_0x24aab1,'scope':_0x29cdfc[_0x41299b(0x149)],'description':_0x29cdfc[_0x41299b(0x143)]['description']||'','params':_0x370dc1};});if(isStructuredFormat(_0xb1a65b))await handleSDKOutput(_0x2a6502,_0xb1a65b);else for(const _0x174aa2 of _0x4e3c49){const _0x22248b=_0x174aa2[_0x178d13(0x13d)]===_0x5a695f?a32_0x41b0f6[_0x178d13(0x14c)]('\x20✓'):'',_0x165090=_0x174aa2[_0x178d13(0x143)]['site']?a32_0x41b0f6[_0x178d13(0x141)]('\x20'+_0x174aa2[_0x178d13(0x143)]['site']):'',_0x26d8c9=_0x174aa2[_0x178d13(0x143)][_0x178d13(0x14a)]?a32_0x41b0f6[_0x178d13(0x141)]('\x20\x20'+_0x174aa2[_0x178d13(0x143)]['description']):'';console[_0x178d13(0x138)](_0x178d13(0x142)+_0x174aa2[_0x178d13(0x13d)]+_0x22248b+_0x165090+_0x26d8c9);}return 0x0;}catch(_0x5f242c){return _0x5f242c instanceof Error&&console[_0x178d13(0x14b)](_0x178d13(0x140)+_0x5f242c['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x5c5a97=a33_0x58a1;(function(_0xe36632,_0x232995){const _0x5bf1a7=a33_0x58a1,_0x3845bf=_0xe36632();while(!![]){try{const _0x2fb82a=-parseInt(_0x5bf1a7(0x1b3))/0x1+parseInt(_0x5bf1a7(0x1c2))/0x2+parseInt(_0x5bf1a7(0x1bb))/0x3*(parseInt(_0x5bf1a7(0x1a0))/0x4)+-parseInt(_0x5bf1a7(0x1ba))/0x5*(parseInt(_0x5bf1a7(0x1b0))/0x6)+parseInt(_0x5bf1a7(0x1b4))/0x7+-parseInt(_0x5bf1a7(0x1c6))/0x8+-parseInt(_0x5bf1a7(0x1b7))/0x9*(-parseInt(_0x5bf1a7(0x19a))/0xa);if(_0x2fb82a===_0x232995)break;else _0x3845bf['push'](_0x3845bf['shift']());}catch(_0x1ff25e){_0x3845bf['push'](_0x3845bf['shift']());}}}(a33_0x32ea,0x61ad7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x32ea(){const _0x1790f5=['error','setJobId','505376IxkBBE','Schema:\x20','stats','elapsedTimeMillis','5188792DSPkaL','\x20[Job\x20ID:\x20','join','verbose','file','10GgLHik','execute','Executing\x20query\x20[','state','Error:\x20','args','659996Tbtayo','name','message','...','site','Catalog:\x20','data','Run\x20Trino\x20queries\x20(streaming)','\x20rows\x20','jobId','No\x20SQL\x20provided','setPhase','Site:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','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','output','1144182QilTAT','setExtra','information_schema','134111wrEzLb','4196339QalcdT','push','\x0aAll\x20results\x20saved\x20to\x20','236988TXTJnJ','length','in\x20','5lkIDxH','9kVETNZ','validate','processedRows','Statement\x20','options'];a33_0x32ea=function(){return _0x1790f5;};return a33_0x32ea();}function a33_0x58a1(_0x21494a,_0x3ca3b1){_0x21494a=_0x21494a-0x19a;const _0x32ea53=a33_0x32ea();let _0x58a1a3=_0x32ea53[_0x21494a];return _0x58a1a3;}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{[a33_0x5c5a97(0x1a1)]='query';['description']=a33_0x5c5a97(0x1a7);async['execute'](_0x3b9eb2){const _0x1aa047=a33_0x5c5a97,{options:_0x362f57,args:_0xbfa757,tdx:_0x50d1f9}=_0x3b9eb2,_0x2f4192={..._0x362f57,'limitStructuredFormats':!![]},_0x2e7d8e=_0xbfa757[0x0],_0xc8c570=_0x362f57['file'];let _0x2a8b8f;try{if(_0xc8c570)_0x2a8b8f=readSqlStatementsFromFile(_0xc8c570);else{if(_0x2e7d8e==='-')_0x2a8b8f=await readSqlStatementsFromStdin();else{if(_0x2e7d8e&&isSqlFilePath(_0x2e7d8e))_0x2a8b8f=readSqlStatementsFromFile(_0x2e7d8e);else{if(_0x2e7d8e)_0x2a8b8f=splitSqlStatements(_0x2e7d8e);else throw new Error(_0x1aa047(0x1aa));}}}}catch(_0x21a862){return console['error'](_0x1aa047(0x19e)+_0x21a862[_0x1aa047(0x1a2)]),0x1;}const _0x24e96c=_0x362f57['database']||_0x1aa047(0x1b2),_0x16938d=_0x362f57['catalog'];try{const _0x54a6c2=[],_0x120891=!!_0x362f57[_0x1aa047(0x1af)];for(let _0x303af3=0x0;_0x303af3<_0x2a8b8f['length'];_0x303af3++){const _0x58336e=_0x2a8b8f[_0x303af3],_0xc66a8e=_0x303af3+0x1,_0x54ce8f=_0x2a8b8f[_0x1aa047(0x1b8)],_0x518470=_0x54ce8f>0x1;_0x362f57[_0x1aa047(0x1c9)]&&(console[_0x1aa047(0x1c0)]('\x0a'+(_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+':':'')),console[_0x1aa047(0x1c0)](_0x1aa047(0x1ac)+_0x362f57[_0x1aa047(0x1a4)]),console[_0x1aa047(0x1c0)](_0x1aa047(0x1a5)+(_0x16938d||'td')),console[_0x1aa047(0x1c0)](_0x1aa047(0x1c3)+_0x24e96c),console[_0x1aa047(0x1c0)]('SQL:\x20'+_0x58336e));const _0x2729e2=_0x518470?'Executing\x20statement\x20'+_0xc66a8e+'/'+_0x54ce8f+_0x1aa047(0x1a3):'Executing\x20query...';try{const _0x2497b4=await withProgressSpinner(_0x2729e2,async _0x550075=>{const _0x42d62d=_0x1aa047,_0x2de12a=await _0x50d1f9['query'][_0x42d62d(0x19b)](_0x58336e,{'catalog':_0x16938d,'schema':_0x24e96c,'onJobId':_0x37cb90=>{const _0x3a5931=_0x42d62d;_0x550075[_0x3a5931(0x1c1)](_0x37cb90);},'onProgress':_0x52ad90=>{const _0x538c38=_0x42d62d;_0x550075[_0x538c38(0x1ab)](_0x538c38(0x19c)+_0x52ad90[_0x538c38(0x19d)]+']'),_0x550075[_0x538c38(0x1b1)](formatRows(_0x52ad90[_0x538c38(0x1bd)])+'\x20rows\x20'+_0x52ad90['completedSplits']+'/'+_0x52ad90['totalSplits']+'\x20splits');}});return _0x2de12a;},{'verbose':_0x362f57['verbose']}),_0x4687d8=_0x2497b4[_0x1aa047(0x1a6)],_0x42d4f6=_0x4687d8[_0x1aa047(0x1a9)]?_0x1aa047(0x1c7)+_0x4687d8[_0x1aa047(0x1a9)]+']':'',_0x27ed3f=_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+'\x20-\x20':'';console[_0x1aa047(0x1c0)]('✔\x20'+_0x27ed3f+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4687d8[_0x1aa047(0x1c4)][_0x1aa047(0x1bd)])+_0x1aa047(0x1a8)+(_0x1aa047(0x1b9)+formatElapsed(_0x4687d8[_0x1aa047(0x1c4)][_0x1aa047(0x1c5)])+_0x42d4f6));if(_0x518470&&_0x120891){const _0x2c25ae=resolveOutputOptions(_0x2f4192),_0x5ddaed=await formatQueryOutput(_0x4687d8,_0x2c25ae);_0x54a6c2[_0x1aa047(0x1b5)](_0x5ddaed);}else await handleQueryOutput(_0x4687d8,_0x2f4192);}catch(_0x169323){const _0x2b0720=_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+':\x0a':'',_0x1ea6b5=_0x169323 instanceof SDKError?_0x169323['originalMessage']:_0x169323[_0x1aa047(0x1a2)];return console[_0x1aa047(0x1c0)](''+_0x2b0720+_0x1ea6b5),0x1;}}if(_0x2a8b8f['length']>0x1&&_0x120891&&_0x54a6c2[_0x1aa047(0x1b8)]>0x0){const _0x4bb2df=_0x54a6c2[_0x1aa047(0x1c8)]('\x0a');writeFileSync(_0x362f57[_0x1aa047(0x1af)],_0x4bb2df),console[_0x1aa047(0x1c0)](_0x1aa047(0x1b6)+_0x362f57[_0x1aa047(0x1af)]);}return 0x0;}catch(_0x3ddb46){throw _0x3ddb46;}}[a33_0x5c5a97(0x1bc)](_0x33e0bb){const _0x99c8a=a33_0x5c5a97,_0x5a67be=_0x33e0bb[_0x99c8a(0x19f)][0x0],_0x5e3ddb=_0x33e0bb[_0x99c8a(0x1bf)][_0x99c8a(0x1ca)];if(!_0x5a67be&&!_0x5e3ddb)return _0x99c8a(0x1ae);if(_0x5a67be&&_0x5e3ddb)return _0x99c8a(0x1ad);return undefined;}}
|