@treasuredata/tdx 2026.3.15 → 2026.3.17
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 +3 -3
|
@@ -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_0x386a98=a30_0x3363;(function(_0x38b1ac,_0x598857){const _0xac6514=a30_0x3363,_0x18b3a0=_0x38b1ac();while(!![]){try{const _0x1dc774=parseInt(_0xac6514(0x33a))/0x1+-parseInt(_0xac6514(0x30c))/0x2+parseInt(_0xac6514(0x30e))/0x3+-parseInt(_0xac6514(0x21c))/0x4+-parseInt(_0xac6514(0x26e))/0x5+-parseInt(_0xac6514(0x2b5))/0x6+-parseInt(_0xac6514(0x1fb))/0x7*(-parseInt(_0xac6514(0x2a0))/0x8);if(_0x1dc774===_0x598857)break;else _0x18b3a0['push'](_0x18b3a0['shift']());}catch(_0x1b145b){_0x18b3a0['push'](_0x18b3a0['shift']());}}}(a30_0x2cbd,0x3bb64));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x335f84 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_0x455b25 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_0x386a98(0x1db),LEGACY_PARENT_SEGMENT_DIR=a30_0x386a98(0x265);function openBrowser(_0x3dbff4){const _0x6b074=a30_0x386a98,_0xfa1676=process['platform'],_0x5c3a92=_0xfa1676===_0x6b074(0x1d2)?_0x6b074(0x245):_0xfa1676===_0x6b074(0x258)?_0x6b074(0x2d2):_0x6b074(0x271);spawn(_0x5c3a92,[_0x3dbff4],{'detached':!![],'stdio':_0x6b074(0x2f3)})['unref']();}function migrateLegacyDirectory(){const _0x5c199e=a30_0x386a98;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x386d28=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x386d28['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5c199e(0x253)](a30_0x455b25[_0x5c199e(0x30a)](_0x5c199e(0x2e2)+LEGACY_PARENT_SEGMENT_DIR+_0x5c199e(0x2a4)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x5c199e(0x253)](a30_0x455b25[_0x5c199e(0x21a)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5c199e(0x328))),![];console[_0x5c199e(0x253)](a30_0x455b25[_0x5c199e(0x30a)](_0x5c199e(0x2e4)+LEGACY_PARENT_SEGMENT_DIR+_0x5c199e(0x2a8)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5c199e(0x253)](a30_0x455b25[_0x5c199e(0x2e8)](_0x5c199e(0x312)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x1f7b7b){const _0x402f7b=_0x1f7b7b instanceof Error?_0x1f7b7b[_0x5c199e(0x1dc)]:String(_0x1f7b7b);return console['error'](a30_0x455b25['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x402f7b+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x386a98(0x30b)](_0x27814b){const _0xb7233=a30_0x386a98;return migrateLegacyDirectory(),super[_0xb7233(0x30b)](_0x27814b);}}function resolveYamlFile(_0x4e89e2){const _0x4329ff=a30_0x386a98;if(_0x4e89e2['endsWith'](_0x4329ff(0x1f2))||_0x4e89e2[_0x4329ff(0x1cb)](_0x4329ff(0x284)))return _0x4e89e2;return a30_0x335f84[_0x4329ff(0x248)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4e89e2)+'.yml');}function formatProgressMessage(_0x56b85f){const _0x4f076f=a30_0x386a98,_0x47f810=_0x56b85f[_0x4f076f(0x268)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x47f810){const [,_0x10b664,_0x1a9e12,_0x4b92de='']=_0x47f810;return a30_0x455b25[_0x4f076f(0x21a)](_0x10b664+':')+'\x20'+_0x1a9e12+a30_0x455b25[_0x4f076f(0x21a)](_0x4b92de);}return a30_0x455b25['dim'](_0x56b85f);}function showFileNotFoundError(_0xf4b114,_0x2a283d){const _0x288b0c=a30_0x386a98;console[_0x288b0c(0x253)](a30_0x455b25[_0x288b0c(0x26f)]('Error:\x20File\x20not\x20found:\x20'+_0xf4b114+'\x0a')),console['error'](a30_0x455b25[_0x288b0c(0x216)](_0x288b0c(0x261)+_0x2a283d+_0x288b0c(0x32a)));}function displayRealtimeValidation(_0x1ad97a){const _0x1a9acc=a30_0x386a98;if(!_0x1ad97a[_0x1a9acc(0x2fd)])return;const _0x400760=_0x1ad97a['realtime'],_0x417cda=_0x400760['enabled']?a30_0x455b25[_0x1a9acc(0x2e8)](_0x1a9acc(0x302)):a30_0x455b25['yellow'](_0x1a9acc(0x239));console[_0x1a9acc(0x253)]('\x0a'+a30_0x455b25[_0x1a9acc(0x21a)](_0x1a9acc(0x29a))+'\x20'+_0x417cda);if(_0x400760[_0x1a9acc(0x290)]&&_0x400760['events'][_0x1a9acc(0x221)]>0x0){console['error']('\x20\x20'+a30_0x455b25[_0x1a9acc(0x21a)](_0x1a9acc(0x327))+'\x20'+_0x400760['events']['length']+_0x1a9acc(0x1e7));for(const _0x4ccb9a of _0x400760[_0x1a9acc(0x290)]){const _0x1d6580=_0x4ccb9a[_0x1a9acc(0x20f)]===![]?a30_0x455b25['red']('✘'):a30_0x455b25['green']('✔');console[_0x1a9acc(0x253)](_0x1a9acc(0x2f1)+_0x1d6580+'\x20'+_0x4ccb9a[_0x1a9acc(0x333)]),_0x4ccb9a[_0x1a9acc(0x293)]&&console[_0x1a9acc(0x253)](_0x1a9acc(0x1eb)+a30_0x455b25[_0x1a9acc(0x26f)](_0x4ccb9a[_0x1a9acc(0x293)]));}}if(_0x400760[_0x1a9acc(0x33e)]&&_0x400760[_0x1a9acc(0x33e)][_0x1a9acc(0x221)]>0x0){console[_0x1a9acc(0x253)]('\x20\x20'+a30_0x455b25[_0x1a9acc(0x21a)](_0x1a9acc(0x214))+'\x20'+_0x400760[_0x1a9acc(0x33e)][_0x1a9acc(0x221)]+_0x1a9acc(0x1e7));for(const _0x1117e5 of _0x400760[_0x1a9acc(0x33e)]){const _0x31c94d=_0x1117e5[_0x1a9acc(0x1d7)]?a30_0x455b25[_0x1a9acc(0x2e8)]('✔'):a30_0x455b25[_0x1a9acc(0x26f)]('✘');console['error']('\x20\x20\x20\x20'+_0x31c94d+'\x20'+_0x1117e5[_0x1a9acc(0x333)]+'\x20'+a30_0x455b25[_0x1a9acc(0x21a)]('('+_0x1117e5['type']+')'));}}if(_0x400760[_0x1a9acc(0x1d1)]){const _0x3a376e=_0x400760[_0x1a9acc(0x1d1)]['stitchingKeys']?.[_0x1a9acc(0x221)]?_0x1a9acc(0x28a)+_0x400760['idStitching'][_0x1a9acc(0x1d3)][_0x1a9acc(0x248)](',\x20')+']':'';console['error']('\x20\x20'+a30_0x455b25[_0x1a9acc(0x21a)](_0x1a9acc(0x250))+'\x20'+_0x400760[_0x1a9acc(0x1d1)]['primaryKey']+_0x3a376e);}if(_0x400760[_0x1a9acc(0x266)]&&_0x400760['personalizationServices'][_0x1a9acc(0x221)]>0x0){console[_0x1a9acc(0x253)]('\x20\x20'+a30_0x455b25['dim'](_0x1a9acc(0x2da))+'\x20'+_0x400760[_0x1a9acc(0x266)][_0x1a9acc(0x221)]+_0x1a9acc(0x27c)+(_0x400760['personalizationServices'][_0x1a9acc(0x221)]!==0x1?'s':''));for(const _0x5a95b1 of _0x400760['personalizationServices']){console['error'](_0x1a9acc(0x331)+_0x5a95b1['name']);}}}function showParentSegmentNotSetError(_0x37a07f){const _0x14b0c7=a30_0x386a98;console[_0x14b0c7(0x253)](a30_0x455b25[_0x14b0c7(0x30a)](_0x14b0c7(0x2ff))),console[_0x14b0c7(0x253)](_0x37a07f);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x27b);['description']=a30_0x386a98(0x2cf);async['execute'](_0x49a1db){const _0x28d2ca=a30_0x386a98,{options:_0xb97eb,args:_0x222fbd,tdx:_0x197cac}=_0x49a1db,_0x7922d2=_0x222fbd[0x0];_0xb97eb[_0x28d2ca(0x2d3)]&&(console[_0x28d2ca(0x253)](_0x28d2ca(0x2f5)+_0xb97eb[_0x28d2ca(0x24d)]),_0x7922d2&&console[_0x28d2ca(0x253)](_0x28d2ca(0x2f6)+_0x7922d2));const _0x4721ca=await withSpinner(_0x7922d2?_0x28d2ca(0x32e)+_0x7922d2+_0x28d2ca(0x2d7):_0x28d2ca(0x234),()=>_0x197cac[_0x28d2ca(0x1bd)][_0x28d2ca(0x21b)](),{'verbose':_0xb97eb[_0x28d2ca(0x2d3)]});let _0x5f1c6c=_0x4721ca[_0x28d2ca(0x2c1)];if(_0x7922d2){const _0x4c7506=_0x7922d2[_0x28d2ca(0x255)](/[.+^${}()|[\]\\]/g,_0x28d2ca(0x233))[_0x28d2ca(0x255)](/\*/g,'.*')[_0x28d2ca(0x255)](/\?/g,'.'),_0x5cb668=new RegExp('^'+_0x4c7506+'$','i');_0x5f1c6c=_0x5f1c6c[_0x28d2ca(0x313)](_0x5cb312=>_0x5cb668[_0x28d2ca(0x1ea)](_0x5cb312[_0x28d2ca(0x33e)][_0x28d2ca(0x333)]));}_0x5f1c6c[_0x28d2ca(0x1ed)]((_0x3ea3c6,_0x4c69a0)=>_0x3ea3c6[_0x28d2ca(0x33e)]['name']['localeCompare'](_0x4c69a0['attributes'][_0x28d2ca(0x333)])),console[_0x28d2ca(0x253)]('✔\x20Found\x20'+_0x5f1c6c[_0x28d2ca(0x221)]+'\x20parent\x20segment'+(_0x5f1c6c[_0x28d2ca(0x221)]!==0x1?'s':''));const _0x7b8037=_0x3d93d6=>{const _0x2dbc2a=_0x28d2ca;return getConsoleNextUrl(_0xb97eb[_0x2dbc2a(0x24d)],_0x2dbc2a(0x257)+_0x3d93d6);};if(_0xb97eb['format']===_0x28d2ca(0x25f)||_0xb97eb[_0x28d2ca(0x2ba)]===_0x28d2ca(0x2f2)){const _0x1b97a9=_0x5f1c6c[_0x28d2ca(0x2fb)](_0x170c5d=>({..._0x170c5d,'url':_0x7b8037(_0x170c5d['id'])}));await handleSDKOutput(_0x1b97a9,_0xb97eb);}else{if(_0x5f1c6c[_0x28d2ca(0x221)]===0x0)_0x7922d2?console[_0x28d2ca(0x1bf)](_0x28d2ca(0x237)+_0x7922d2):console['log'](_0x28d2ca(0x20a));else for(const _0x281d51 of _0x5f1c6c){const _0x4896b4=_0x281d51[_0x28d2ca(0x33e)][_0x28d2ca(0x1c5)]?a30_0x455b25[_0x28d2ca(0x21a)]('\x20('+formatRows(_0x281d51[_0x28d2ca(0x33e)]['population'])+')'):'',_0x48968c=hyperlink(_0x281d51[_0x28d2ca(0x33e)]['name'],_0x7b8037(_0x281d51['id']));console[_0x28d2ca(0x1bf)](_0x28d2ca(0x240)+_0x48968c+_0x4896b4);}}return 0x0;}}function a30_0x3363(_0x4b5381,_0x71d131){_0x4b5381=_0x4b5381-0x1ba;const _0x2cbd5b=a30_0x2cbd();let _0x33637d=_0x2cbd5b[_0x4b5381];return _0x33637d;}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x386a98(0x333)]='segment:parent:create';['description']=a30_0x386a98(0x254);async[a30_0x386a98(0x340)](_0x160323){const _0x4085cd=a30_0x386a98,{options:_0x18b0c6,args:_0x2f4547,tdx:_0x123af6}=_0x160323;console[_0x4085cd(0x253)](_0x4085cd(0x25e)+_0x4085cd(0x274)+_0x4085cd(0x2b6));const _0x183647=_0x18b0c6;if(_0x2f4547[_0x4085cd(0x221)]===0x0)return console[_0x4085cd(0x253)](a30_0x455b25[_0x4085cd(0x26f)](_0x4085cd(0x2c3))),console[_0x4085cd(0x253)](_0x4085cd(0x2dc)),0x1;const _0x19848e=_0x2f4547[0x0];if(!_0x183647['database']||!_0x183647[_0x4085cd(0x29e)])return console[_0x4085cd(0x253)](_0x4085cd(0x1ba)),console[_0x4085cd(0x253)](_0x4085cd(0x2dc)),0x1;_0x183647['verbose']&&(console['error'](_0x4085cd(0x2f5)+_0x183647[_0x4085cd(0x24d)]),console[_0x4085cd(0x253)](_0x4085cd(0x20b)+_0x19848e),console[_0x4085cd(0x253)](_0x4085cd(0x244)+_0x183647[_0x4085cd(0x2fe)]),console[_0x4085cd(0x253)](_0x4085cd(0x251)+_0x183647[_0x4085cd(0x29e)]));const _0x16384c=await loadJSONFromOptions(_0x183647['attributes'],_0x183647['attributesFile']),_0x46d86b=await loadJSONFromOptions(_0x183647['behaviors'],_0x183647[_0x4085cd(0x28f)]),_0x195301=await loadJSONFromOptions(_0x183647['customerGroup'],_0x183647[_0x4085cd(0x31f)]),_0x5774f4={'name':_0x19848e,'description':_0x183647[_0x4085cd(0x1ff)],'scheduleType':_0x183647[_0x4085cd(0x24c)],'scheduleOption':_0x183647[_0x4085cd(0x336)],'timezone':_0x183647[_0x4085cd(0x289)],'master':{'parentDatabaseName':_0x183647[_0x4085cd(0x2fe)],'parentTableName':_0x183647[_0x4085cd(0x29e)]},'attributes':_0x16384c,'behaviors':_0x46d86b,'customerGroup':_0x195301},_0x22ecf4=await withSpinner(_0x4085cd(0x2ed)+_0x19848e+_0x4085cd(0x2d7),()=>_0x123af6['segment'][_0x4085cd(0x332)](_0x5774f4),{'verbose':_0x18b0c6[_0x4085cd(0x2d3)]}),_0x39b3ec=_0x22ecf4[_0x4085cd(0x2c1)];return console[_0x4085cd(0x253)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x39b3ec[_0x4085cd(0x333)]+_0x4085cd(0x2b2)+_0x39b3ec['id']),await handleSDKOutput([_0x39b3ec],_0x18b0c6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x386a98(0x333)]='segment:parent:update';[a30_0x386a98(0x1ff)]=a30_0x386a98(0x322);async[a30_0x386a98(0x340)](_0x42af96){const _0x1dfc3a=a30_0x386a98,{options:_0xedb6b1,args:_0x143538,tdx:_0x17226f}=_0x42af96;console[_0x1dfc3a(0x253)](_0x1dfc3a(0x31b)+_0x1dfc3a(0x274)+_0x1dfc3a(0x2b6));const _0x353a3b=_0xedb6b1;if(_0x143538[_0x1dfc3a(0x221)]===0x0)return console[_0x1dfc3a(0x253)](a30_0x455b25[_0x1dfc3a(0x26f)](_0x1dfc3a(0x2c3))),console[_0x1dfc3a(0x253)](_0x1dfc3a(0x22d)),0x1;const _0x21fc0d=_0x143538[0x0];_0x353a3b['verbose']&&(console['error'](_0x1dfc3a(0x2f5)+_0x353a3b['site']),console[_0x1dfc3a(0x253)](_0x1dfc3a(0x22f)+_0x21fc0d));const _0x224652=await withSpinner(_0x1dfc3a(0x1d9)+_0x21fc0d+_0x1dfc3a(0x2d7),()=>_0x17226f[_0x1dfc3a(0x1bd)]['getParentFull'](_0x21fc0d),{'verbose':_0x353a3b[_0x1dfc3a(0x2d3)]}),_0x504a02=_0x224652['data'],_0x233305=await loadJSONFromOptions(_0x353a3b[_0x1dfc3a(0x32f)],_0x353a3b[_0x1dfc3a(0x1c0)]),_0x11b01a=await loadJSONFromOptions(_0x353a3b[_0x1dfc3a(0x21e)],_0x353a3b['addBehaviorsFile']),_0x449e69={'name':_0x504a02[_0x1dfc3a(0x333)],'description':_0x353a3b['description']!==undefined?_0x353a3b['description']:_0x504a02[_0x1dfc3a(0x1ff)],'scheduleType':_0x353a3b[_0x1dfc3a(0x24c)]!==undefined?_0x353a3b['scheduleType']:_0x504a02[_0x1dfc3a(0x24c)],'scheduleOption':_0x353a3b['scheduleOption']!==undefined?_0x353a3b[_0x1dfc3a(0x336)]:_0x504a02['scheduleOption'],'timezone':_0x353a3b[_0x1dfc3a(0x289)]!==undefined?_0x353a3b[_0x1dfc3a(0x289)]:_0x504a02[_0x1dfc3a(0x289)],'master':_0x504a02[_0x1dfc3a(0x1df)],'attributes':_0x233305?[..._0x504a02[_0x1dfc3a(0x33e)]||[],..._0x233305]:_0x504a02['attributes'],'behaviors':_0x11b01a?[..._0x504a02['behaviors']||[],..._0x11b01a]:_0x504a02[_0x1dfc3a(0x305)],'customerGroup':_0x504a02[_0x1dfc3a(0x31c)]},_0x1ffa95=await withSpinner(_0x1dfc3a(0x2c8)+_0x21fc0d+_0x1dfc3a(0x2d7),()=>_0x17226f[_0x1dfc3a(0x1bd)][_0x1dfc3a(0x27a)](_0x21fc0d,_0x449e69),{'verbose':_0x353a3b[_0x1dfc3a(0x2d3)]}),_0x268ea1=_0x1ffa95[_0x1dfc3a(0x2c1)];return console[_0x1dfc3a(0x253)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x268ea1[_0x1dfc3a(0x333)]+'\x27'),await handleSDKOutput([_0x268ea1],_0x353a3b),0x0;}}function a30_0x2cbd(){const _0x1f38a8=['1919796qLIQdZ','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','addBehaviors','List\x20available\x20fields\x20for\x20segmentation','using\x20the\x20default\x20path:\x20','length','Apply\x20changes\x20to\x20\x27','td_client_id','-1d','Aborted.','schemaError','\x20Context\x20set:\x20','errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20kill','\x0aError:','stats','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','getParentFull','Parent\x20segment:\x20','\x20Added\x20RT\x202.0\x20template\x20section','\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','Error:','\x5c$&','Listing\x20parent\x20segments...','\x20\x20No\x20sample\x20data\x20available','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','No\x20parent\x20segments\x20match\x20pattern:\x20','personalization_services','⚡\x20Not\x20enabled','tdx\x20ps\x20preview\x20','Default','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','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','toLocaleString','ps:pz:init','👥\x20','\x20=\x20','Created','\x27\x20and\x20run\x20workflow?','Database:\x20','open','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','pushParentYaml','join','Listing\x20personalization\x20services\x20for\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','getOutputDatabaseName','scheduleType','site','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','ps:rt:list','ID\x20Stitching:','Table:\x20','column_type','error','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','replace','\x27\x20is\x20already\x20up\x20to\x20date','/app/dw/parentSegments/','win32','true','sections','\x20\x202.\x20Run\x20','attribute','\x0aNo\x20sample\x20data\x20available','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','json','pullParentYaml','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','toFixed','ps:pz:list','\x20--attribute\x20\x22<name>\x22','parent_segment','personalizationServices','✔\x20No\x20changes\x20-\x20\x27','match','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Audience\x20ID:','Master\x20+\x20Attributes','push','Behaviors','1906430MKewWb','red','/app/workflows/','xdg-open','Personalization\x20service\x20description','segment:parent:pull','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','repeat','customers','To\x20cancel:','tdx\x20ps\x20push\x20','\x20rows\x20','updateParent','segment:parent:list','\x20service','Fetching\x20SQL\x20for\x20\x27','Errors:','displayAttributesStats','\x20Opening\x20','parent_id','Coverage:','\x20section','.yaml','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','limit','FINISHED','timezone','\x20+\x20[','Behavior:','Fetching\x20behavior\x20list...','Get\x20SQL\x20query\x20for\x20parent\x20segment','previewParentYaml','behaviorsFile','events','trim','\x0a✔\x20Workflow\x20started','sourceTableError','Error\x20reading\x20file:\x20','Output\x20file:\x20','string','displaySummary','Overwrite\x20\x27','Fetching\x20sample\x20data...','RT\x202.0:','displayRealtimeInfo','localeCompare','single','table','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','487272pJQlHo','✔\x20Query\x20completed:\x20Processed\x20','behavior','validateParentYaml','/\x20and\x20','collectSchema','\x20\x20Database:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','/\x20→\x20','all','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Options\x20(one\x20required):\x0a','column_name','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','indexOf','Columns:','audienceId','resolveParentId','\x27\x20with\x20ID:\x20','My\x20Service','text','778428eqSSdD','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','getParentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20[Job\x20ID:\x20','format','YAML\x20file:\x20','Found\x20YAML\x20file:\x20','\x20RT-enabled\x20parent\x20segment','\x22,\x20\x22type\x22:\x20\x22','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','personalization','data','\x20--attribute\x20\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Creating','yes','workflowId','Master\x20Table','Updating\x20parent\x20segment\x20\x27','rowCount','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','ps:rt:validate','user_id','Master:','✔\x20Found\x20','List\x20parent\x20segments','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','start','verbose','Error\x20parsing\x20YAML:\x20','in\x20','Session:','\x27...','\x0a\x20\x20\x20\x20]','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','Personalization:','\x20to\x20push\x20the\x20configuration','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20No\x20changes\x20-\x20','type','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','utf-8','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x0a⚠️\x20\x20Both\x20','Customers:','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','realtime:','green','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','coveragePercent','segment:parent:sql','customerPercent','Creating\x20parent\x20segment\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','displayPreviewHints','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20\x20\x20','jsonl','ignore','Updated','Site:\x20','Pattern:\x20','Updating','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Analyzing\x20changes...','stop','map','label','realtime','database','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Fetching\x20customers\x20schema...','\x20behaviors','⚡\x20Enabled','\x20\x20Tables:\x201\x20customers\x20+\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','behaviors','allValid','\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','getBehaviorNames','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','yellow','run','268318yxNFAp','sampleData','1058187mvgoEQ','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','foreignKey','/{name}.yml\x0a','✔\x20Renamed\x20directory\x20to\x20','filter','%)\x20','elapsedTimeMillis','totalEvents','\x20--behavior\x20\x22','list','bold','\x20Configuration\x20is\x20valid','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','customerGroup','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x0a\x20\x20\x20\x20}','customerGroupFile','column','enriched','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Resolving\x20parent\x20segment\x20\x27','trigger_event','segment:parent:push','Events:','/\x20directory.\x0a','Listing\x20fields\x20for\x20\x27','`\x20to\x20download\x20the\x20configuration\x20first','No\x20RT-enabled\x20parent\x20segments\x20found','displayColumns','Source:','Listing\x20parent\x20segments\x20matching\x20\x27','addAttributes','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20\x20\x20\x20-\x20','createParent','name','schemaValid','parentSegment','scheduleOption','matchedCount','displayMasterInfo','\x0a\x20\x20]\x0a}\x0a','164257yFFdRt','formatSchemaJson','\x22\x20}','Validate:','attributes','/attempt/','execute','\x20trigger=','double','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Create\x20parent\x20segment\x20\x27','Join:','output','\x20parent\x20segment\x20\x27','Available\x20attributes:','/sessions/','Error:\x20--database\x20and\x20--table\x20are\x20required','keys','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','segment','\x20total','log','addAttributesFile','apply','listFields','\x20\x20Columns:\x20','Next\x20steps:','population','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20RT\x20configuration\x20is\x20valid','displayBehaviorsStats','toLowerCase','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','endsWith','displayPreviewResults','\x0aNew\x20parent\x20segment\x20\x27','varchar','Enriched:','behavior_','idStitching','darwin','stitchingKeys','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','last_page_viewed','workflowAttemptId','valid','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','Fetching\x20current\x20configuration\x20for\x20\x27','Output\x20Database:','parent_segments','message','.customers)','interval','master','\x20to\x20configure\x20your\x20personalization\x20service','workflowSessionId','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20\x20','segment:parent:preview','\x20\x20Note:\x20','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20configured','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','setJobId','test','\x20\x20\x20\x20\x20\x20','displaySampleData','sort','SELECT\x20*\x20FROM\x20','realtime_enabled','processedRows','query','.yml','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:run','session','\x20rows)','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','To\x20view\x20sample\x20data:','Fetching\x20parent\x20segment\x20\x27','98OneCuA','columns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','page_view','description','segment:parent:fields','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20tdx\x20wf\x20attempt\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','jobId','\x20Added\x20personalization\x20template\x20to\x20','Validating\x20RT\x20configuration...','joinKey','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','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','No\x20parent\x20segments\x20found','Name:\x20','displayValidateResults','\x20\x201.\x20Edit\x20','segment:parent:desc','sourceTableValid','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Listing\x20RT-enabled\x20parent\x20segments...','segment:parent:validate','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Attributes:','\x20--interval\x20','cyan','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','number','segment:parent:show','dim','listParents'];a30_0x2cbd=function(){return _0x1f38a8;};return a30_0x2cbd();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a30_0x386a98(0x273);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x2e9);async['execute'](_0x3e486d){const _0x247c6c=a30_0x386a98,{options:_0x23a6f2,args:_0x11e99e,tdx:_0xefe27e}=_0x3e486d,_0x388b91=_0x23a6f2,_0x242df0=_0x11e99e[0x0]||_0x23a6f2['parentSegment'];if(!_0x242df0)return showParentSegmentNotSetError(_0x247c6c(0x344)+_0x247c6c(0x1ca)),0x1;if(_0x388b91['use']&&_0x388b91[_0x247c6c(0x347)])return console['error'](a30_0x455b25[_0x247c6c(0x26f)](_0x247c6c(0x1f3))),console[_0x247c6c(0x253)](a30_0x455b25['dim'](_0x247c6c(0x2e6))),console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x21a)](_0x247c6c(0x220)+PARENT_SEGMENT_DIR+_0x247c6c(0x311))),console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x216)](_0x247c6c(0x210))),0x1;const _0x246f4c=_0x388b91[_0x247c6c(0x347)]||a30_0x335f84['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x242df0)+_0x247c6c(0x1f2));_0x388b91[_0x247c6c(0x2d3)]&&(console['error'](_0x247c6c(0x2f5)+_0x388b91[_0x247c6c(0x24d)]),console[_0x247c6c(0x253)](_0x247c6c(0x22f)+_0x242df0),console[_0x247c6c(0x253)](_0x247c6c(0x295)+_0x246f4c));const _0x5c6663=await withSpinner(_0x247c6c(0x1fa)+_0x242df0+_0x247c6c(0x2d7),()=>_0xefe27e[_0x247c6c(0x1bd)][_0x247c6c(0x260)](_0x242df0),{'verbose':_0x388b91[_0x247c6c(0x2d3)]}),_0x293469=_0x5c6663[_0x247c6c(0x2c1)];if(existsSync(_0x246f4c)){const _0x201151=readFileSync(_0x246f4c,_0x247c6c(0x2e0)),_0x452506=generateDiff(_0x201151,_0x293469);if(!hasChanges(_0x452506))console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x2e8)]('✔')+_0x247c6c(0x2dd)+a30_0x455b25[_0x247c6c(0x216)](_0x246f4c)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x247c6c(0x253)]('\x0aChanges\x20to\x20\x27'+_0x246f4c+'\x27:'),console[_0x247c6c(0x253)]('─'[_0x247c6c(0x275)](0x3c)),console[_0x247c6c(0x253)](formatDiffWithColors(_0x452506)),console[_0x247c6c(0x253)]('─'[_0x247c6c(0x275)](0x3c));if(!_0x388b91[_0x247c6c(0x2c5)]){if(!isInteractive())return console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x26f)](_0x247c6c(0x22b)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x21a)](_0x247c6c(0x31d))),0x1;const _0x467b97=await confirmKey(_0x247c6c(0x298)+_0x246f4c+'\x27?');if(!_0x467b97)return console[_0x247c6c(0x253)](a30_0x455b25['yellow'](_0x247c6c(0x225))),0x1;}writeFileSync(_0x246f4c,_0x293469,'utf-8'),console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x2e8)]('✔')+_0x247c6c(0x24e)+a30_0x455b25['cyan'](_0x246f4c));}}else{const _0x4cfec4=a30_0x335f84['dirname'](_0x246f4c);!existsSync(_0x4cfec4)&&mkdirSync(_0x4cfec4,{'recursive':!![]}),writeFileSync(_0x246f4c,_0x293469,_0x247c6c(0x2e0)),console[_0x247c6c(0x253)](a30_0x455b25['green']('✔')+_0x247c6c(0x24e)+a30_0x455b25[_0x247c6c(0x216)](_0x246f4c));}return saveSessionContext({'parent_segment':_0x242df0},_0x388b91[_0x247c6c(0x1f5)]),console[_0x247c6c(0x253)](a30_0x455b25[_0x247c6c(0x2e8)]('✔')+_0x247c6c(0x227)+a30_0x455b25['dim'](_0x247c6c(0x265))+'\x20=\x20'+a30_0x455b25[_0x247c6c(0x216)](_0x242df0)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x326);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x2df);async[a30_0x386a98(0x340)](_0x5ce66f){const _0x1551bb=a30_0x386a98,{options:_0x3d3d37,args:_0x15e40c,tdx:_0x3542fc}=_0x5ce66f,_0xa66968=_0x3d3d37,_0x27ba4d=_0x15e40c[0x0]||_0x3d3d37[_0x1551bb(0x335)];if(!_0x27ba4d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x1551bb(0x229)),0x1;const _0x185a05=resolveYamlFile(_0x27ba4d);if(!existsSync(_0x185a05))return showFileNotFoundError(_0x185a05,_0x27ba4d),0x1;_0xa66968[_0x1551bb(0x2d3)]&&(console[_0x1551bb(0x253)](_0x1551bb(0x2f5)+_0xa66968[_0x1551bb(0x24d)]),console[_0x1551bb(0x253)](_0x1551bb(0x2bb)+_0x185a05));let _0x9073be;try{_0x9073be=readFileSync(_0x185a05,_0x1551bb(0x2e0));}catch(_0x35fda5){const _0x48cb77=_0x35fda5 instanceof Error?_0x35fda5[_0x1551bb(0x1dc)]:String(_0x35fda5);return console[_0x1551bb(0x253)]('Error\x20reading\x20file:\x20'+_0x48cb77),0x1;}const _0x20f202=await withSpinner(_0x1551bb(0x2f9),()=>_0x3542fc[_0x1551bb(0x1bd)][_0x1551bb(0x247)](_0x9073be),{'verbose':_0xa66968[_0x1551bb(0x2d3)]}),_0xb5cbce=_0x20f202[_0x1551bb(0x2c1)],{isNew:_0xf03cec,name:_0x40758d,hasChanges:_0xa6716c,diffFormatted:_0x418d25}=_0xb5cbce;if(!_0xa6716c)return console[_0x1551bb(0x253)](_0x1551bb(0x267)+_0x40758d+_0x1551bb(0x256)),0x0;_0xf03cec?console[_0x1551bb(0x253)](_0x1551bb(0x1cd)+_0x40758d+'\x27:'):console[_0x1551bb(0x253)](_0x1551bb(0x286)+_0x40758d+'\x27:');console[_0x1551bb(0x253)]('─'['repeat'](0x3c)),console['error'](_0x418d25),console[_0x1551bb(0x253)]('─'['repeat'](0x3c));const _0x25e947=_0xf03cec?_0x1551bb(0x345)+_0x40758d+'\x27?':_0x1551bb(0x222)+_0x40758d+'\x27?';if(!_0xa66968['yes']){if(!isInteractive())return console[_0x1551bb(0x253)](a30_0x455b25['red'](_0x1551bb(0x22b)),_0x1551bb(0x304)),console[_0x1551bb(0x253)](a30_0x455b25[_0x1551bb(0x21a)](_0x1551bb(0x31d))),0x1;const _0x45f517=await confirmKey(_0x25e947);if(!_0x45f517)return console[_0x1551bb(0x253)](a30_0x455b25[_0x1551bb(0x30a)]('Aborted.')),0x1;}const _0x438d51=_0xf03cec?_0x1551bb(0x2c4):_0x1551bb(0x2f7),_0xa93393=await withSpinner(_0x438d51+_0x1551bb(0x348)+_0x40758d+_0x1551bb(0x2d7),()=>_0xb5cbce[_0x1551bb(0x1c1)](),{'verbose':_0xa66968[_0x1551bb(0x2d3)]}),_0x1a5acc=_0xa93393[_0x1551bb(0x2c1)],_0x2c08ce=getConsoleNextUrl(_0xa66968[_0x1551bb(0x24d)],_0x1551bb(0x257)+_0x1a5acc['id']),_0x1d66fe=_0xf03cec?_0x1551bb(0x242):'Updated';return console[_0x1551bb(0x253)]('✔\x20'+_0x1d66fe+_0x1551bb(0x348)+_0x1a5acc[_0x1551bb(0x333)]+'\x27'),console[_0x1551bb(0x253)]('\x20\x20'+_0x2c08ce),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x212);[a30_0x386a98(0x1ff)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x2cd2a1){const _0x436af6=a30_0x386a98,{options:_0x3a062f,args:_0x56f4f7,tdx:_0x118ce5}=_0x2cd2a1,_0x45a427=_0x3a062f,_0x2e071f=_0x56f4f7[0x0]||_0x3a062f[_0x436af6(0x335)];if(!_0x2e071f)return showParentSegmentNotSetError(_0x436af6(0x2ca)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x436af6(0x2e5)+_0x436af6(0x2d0)+_0x436af6(0x1bc)),0x1;const _0x2d0e43=resolveYamlFile(_0x2e071f);if(!existsSync(_0x2d0e43))return showFileNotFoundError(_0x2d0e43,_0x2e071f),0x1;_0x45a427[_0x436af6(0x2d3)]&&(console['error'](_0x436af6(0x2f5)+_0x45a427[_0x436af6(0x24d)]),console[_0x436af6(0x253)](_0x436af6(0x2bb)+_0x2d0e43));let _0x46f4ab;try{_0x46f4ab=readFileSync(_0x2d0e43,'utf-8');}catch(_0x55c3cd){const _0x296326=_0x55c3cd instanceof Error?_0x55c3cd[_0x436af6(0x1dc)]:String(_0x55c3cd);return console[_0x436af6(0x253)]('Error\x20reading\x20file:\x20'+_0x296326),0x1;}const _0x457d36=createCommandSpinner(a30_0x455b25[_0x436af6(0x21a)]('Validating\x20configuration...'),{'verbose':_0x45a427[_0x436af6(0x2d3)]});_0x457d36[_0x436af6(0x2d2)]();const _0x50820d={'onProgress':_0x31fa91=>{const _0x3d780f=_0x436af6;_0x457d36[_0x3d780f(0x2b4)]=formatProgressMessage(_0x31fa91);}};if(_0x45a427[_0x436af6(0x1df)])_0x50820d[_0x436af6(0x1df)]=!![];if(_0x45a427[_0x436af6(0x321)])_0x50820d[_0x436af6(0x321)]=!![];_0x45a427['attribute']&&(_0x50820d[_0x436af6(0x25c)]=_0x45a427[_0x436af6(0x25c)]);_0x45a427[_0x436af6(0x2a2)]&&(_0x50820d['behavior']=_0x45a427['behavior']);if(_0x45a427[_0x436af6(0x1de)])_0x50820d[_0x436af6(0x1de)]=_0x45a427['interval'];let _0x5f4178;try{_0x5f4178=await _0x118ce5[_0x436af6(0x1bd)][_0x436af6(0x2a3)](_0x46f4ab,_0x50820d),_0x457d36['stop']();}catch(_0x2e74eb){_0x457d36[_0x436af6(0x2fa)]();throw _0x2e74eb;}const _0x212a92=_0x45a427[_0x436af6(0x1de)]||_0x436af6(0x224);return this[_0x436af6(0x20c)](_0x5f4178,_0x50820d,_0x2d0e43,_0x212a92),_0x5f4178[_0x436af6(0x306)]?0x0:0x1;}[a30_0x386a98(0x20c)](_0x2672d7,_0x2e4e1c,_0x1970a4,_0x2be671){const _0x536a5a=a30_0x386a98;console[_0x536a5a(0x253)]('\x0a'+a30_0x455b25[_0x536a5a(0x319)](_0x536a5a(0x33d))+'\x20'+_0x2672d7[_0x536a5a(0x333)]),console[_0x536a5a(0x253)]('═'[_0x536a5a(0x275)](0x3c)),this[_0x536a5a(0x338)](_0x2672d7);if(typeof _0x2e4e1c[_0x536a5a(0x25c)]===_0x536a5a(0x296)){this[_0x536a5a(0x27f)](_0x2672d7),this[_0x536a5a(0x297)](_0x2672d7),this['displayPreviewHints'](_0x1970a4,_0x2be671,_0x536a5a(0x25c),_0x2e4e1c['attribute']);return;}if(_0x2e4e1c[_0x536a5a(0x25c)]===!![]){this['displayAttributesStats'](_0x2672d7),this[_0x536a5a(0x297)](_0x2672d7),this[_0x536a5a(0x2ef)](_0x1970a4,_0x2be671,_0x536a5a(0x33e));return;}if(typeof _0x2e4e1c[_0x536a5a(0x2a2)]===_0x536a5a(0x296)){this['displayBehaviorsStats'](_0x2672d7,_0x2be671),this[_0x536a5a(0x297)](_0x2672d7),this[_0x536a5a(0x2ef)](_0x1970a4,_0x2be671,_0x536a5a(0x2a2),_0x2e4e1c[_0x536a5a(0x2a2)]);return;}if(_0x2e4e1c[_0x536a5a(0x2a2)]===!![]){this['displayBehaviorsStats'](_0x2672d7,_0x2be671),this[_0x536a5a(0x297)](_0x2672d7),this[_0x536a5a(0x2ef)](_0x1970a4,_0x2be671,'behaviors');return;}this['displayAttributesStats'](_0x2672d7),this[_0x536a5a(0x1c8)](_0x2672d7,_0x2be671),this['displayRealtimeInfo'](_0x2672d7),this[_0x536a5a(0x297)](_0x2672d7),this['displayPreviewHints'](_0x1970a4,_0x2be671,_0x536a5a(0x2a9));}[a30_0x386a98(0x29b)](_0x7a0f1c){displayRealtimeValidation(_0x7a0f1c);}['displayPreviewHints'](_0x52fa68,_0x2978f3,_0x5198e0,_0x41b54b){const _0x1213ff=a30_0x386a98;console[_0x1213ff(0x253)]('\x0a'+a30_0x455b25['dim'](_0x1213ff(0x1f9)));const _0x109858=_0x2978f3!==_0x1213ff(0x224)?_0x1213ff(0x215)+_0x2978f3:'';if(_0x5198e0===_0x1213ff(0x25c)&&_0x41b54b)console[_0x1213ff(0x253)]('\x20\x20'+a30_0x455b25[_0x1213ff(0x21a)]('tdx\x20ps\x20preview\x20'+_0x52fa68+_0x1213ff(0x2c2)+_0x41b54b+'\x22'+_0x109858));else{if(_0x5198e0==='behavior'&&_0x41b54b)console[_0x1213ff(0x253)]('\x20\x20'+a30_0x455b25['dim'](_0x1213ff(0x23a)+_0x52fa68+_0x1213ff(0x317)+_0x41b54b+'\x22'+_0x109858));else(_0x5198e0===_0x1213ff(0x33e)||_0x5198e0==='all')&&console[_0x1213ff(0x253)]('\x20\x20'+a30_0x455b25[_0x1213ff(0x21a)](_0x1213ff(0x23a)+_0x52fa68+_0x1213ff(0x264)+_0x109858));}(_0x5198e0===_0x1213ff(0x305)||_0x5198e0===_0x1213ff(0x2a9))&&console['error']('\x20\x20'+a30_0x455b25['dim'](_0x1213ff(0x23a)+_0x52fa68+'\x20--behavior\x20\x22<name>\x22'+_0x109858)),_0x5198e0===_0x1213ff(0x2a9)&&console['error']('\x20\x20'+a30_0x455b25[_0x1213ff(0x21a)]('tdx\x20ps\x20preview\x20'+_0x52fa68+'\x20--enriched'+_0x109858));}[a30_0x386a98(0x338)](_0x3003f4){const _0x357186=a30_0x386a98,{master:_0x89f774}=_0x3003f4,_0x2c9b15=_0x89f774[_0x357186(0x334)]?a30_0x455b25['green']('✔'):a30_0x455b25[_0x357186(0x26f)]('✘');console[_0x357186(0x253)]('\x0a'+a30_0x455b25[_0x357186(0x21a)](_0x357186(0x2c7))),console[_0x357186(0x253)](_0x2c9b15+'\x20'+a30_0x455b25['bold'](_0x89f774[_0x357186(0x2fe)]+'.'+_0x89f774[_0x357186(0x29e)])),_0x89f774['schemaValid']?_0x89f774[_0x357186(0x2c9)]!==undefined&&console[_0x357186(0x253)]('\x20\x20'+a30_0x455b25['dim']('Rows:')+'\x20'+a30_0x455b25[_0x357186(0x216)](formatRows(_0x89f774[_0x357186(0x2c9)]))):console[_0x357186(0x253)]('\x20\x20'+a30_0x455b25[_0x357186(0x26f)](_0x357186(0x232))+'\x20'+_0x89f774[_0x357186(0x226)]);}['displayAttributesStats'](_0x327940){const _0x593328=a30_0x386a98;if(_0x327940['attributes'][_0x593328(0x221)]===0x0)return;console[_0x593328(0x253)]('\x0a'+a30_0x455b25[_0x593328(0x21a)]('Attributes'));for(const _0x4b84fe of _0x327940[_0x593328(0x33e)]){const _0x16a1c7=_0x4b84fe[_0x593328(0x334)]?a30_0x455b25[_0x593328(0x2e8)]('✔'):a30_0x455b25[_0x593328(0x26f)]('✘');let _0x54b6c3='';if(_0x4b84fe['schemaValid']&&_0x4b84fe[_0x593328(0x337)]!==undefined&&_0x4b84fe[_0x593328(0x2ea)]!==undefined){const _0x51b0dc=_0x4b84fe[_0x593328(0x2ea)][_0x593328(0x262)](0x1),_0x57f8e8=_0x4b84fe[_0x593328(0x2ea)]>=0x50?a30_0x455b25['green']:_0x4b84fe[_0x593328(0x2ea)]>=0x32?a30_0x455b25[_0x593328(0x30a)]:a30_0x455b25[_0x593328(0x26f)];_0x54b6c3='\x20'+a30_0x455b25[_0x593328(0x21a)](_0x593328(0x282))+'\x20'+_0x57f8e8(_0x51b0dc+'%')+'\x20('+formatRows(_0x4b84fe['matchedCount'])+_0x593328(0x1f6);}console[_0x593328(0x253)](_0x16a1c7+'\x20'+a30_0x455b25[_0x593328(0x319)](_0x4b84fe['name'])+_0x54b6c3),console[_0x593328(0x253)]('\x20\x20'+a30_0x455b25[_0x593328(0x21a)](_0x593328(0x32d))+'\x20'+a30_0x455b25[_0x593328(0x319)](_0x4b84fe['database']+'.'+_0x4b84fe[_0x593328(0x29e)]));const _0x460619=_0x4b84fe[_0x593328(0x207)]===_0x4b84fe['foreignKey']?a30_0x455b25[_0x593328(0x21a)]('Join\x20on:')+'\x20'+_0x4b84fe[_0x593328(0x207)]:a30_0x455b25['dim'](_0x593328(0x346))+'\x20'+_0x4b84fe[_0x593328(0x207)]+_0x593328(0x241)+_0x4b84fe[_0x593328(0x310)];console['error']('\x20\x20'+_0x460619),console[_0x593328(0x253)]('\x20\x20'+a30_0x455b25[_0x593328(0x21a)]('Columns:')),this[_0x593328(0x32c)](_0x4b84fe['columns']),!_0x4b84fe[_0x593328(0x334)]&&console[_0x593328(0x253)]('\x20\x20'+a30_0x455b25[_0x593328(0x26f)](_0x593328(0x232))+'\x20'+_0x4b84fe[_0x593328(0x226)]);}}['displayBehaviorsStats'](_0x453f83,_0x134a33){const _0x1225b3=a30_0x386a98;if(_0x453f83[_0x1225b3(0x305)][_0x1225b3(0x221)]===0x0)return;console['error']('\x0a'+a30_0x455b25['dim'](_0x1225b3(0x26d))+'\x20'+a30_0x455b25[_0x1225b3(0x21a)]('('+_0x134a33+')'));for(const _0x11dceb of _0x453f83[_0x1225b3(0x305)]){const _0xc1c183=_0x11dceb['schemaValid']?a30_0x455b25[_0x1225b3(0x2e8)]('✔'):a30_0x455b25[_0x1225b3(0x26f)]('✘');let _0x44d910='';if(_0x11dceb[_0x1225b3(0x334)]&&_0x11dceb['customersWithEvents']!==undefined&&_0x11dceb['totalEvents']!==undefined){const _0x2c4955=_0x11dceb['customerPercent']?.['toFixed'](0x1)||'?',_0x566a18=(_0x11dceb[_0x1225b3(0x2ec)]??0x0)>=0x32?a30_0x455b25[_0x1225b3(0x2e8)]:(_0x11dceb[_0x1225b3(0x2ec)]??0x0)>=0x14?a30_0x455b25['yellow']:a30_0x455b25[_0x1225b3(0x26f)];_0x44d910='\x20'+a30_0x455b25[_0x1225b3(0x21a)](_0x1225b3(0x2e3))+'\x20'+_0x566a18(formatRows(_0x11dceb['customersWithEvents']))+'\x20('+_0x2c4955+_0x1225b3(0x314)+a30_0x455b25[_0x1225b3(0x21a)](_0x1225b3(0x327))+'\x20'+a30_0x455b25['cyan'](formatRows(_0x11dceb[_0x1225b3(0x316)]));}console[_0x1225b3(0x253)](_0xc1c183+'\x20'+a30_0x455b25[_0x1225b3(0x319)](_0x11dceb[_0x1225b3(0x333)])+_0x44d910),console[_0x1225b3(0x253)]('\x20\x20'+a30_0x455b25['dim'](_0x1225b3(0x32d))+'\x20'+a30_0x455b25['bold'](_0x11dceb[_0x1225b3(0x2fe)]+'.'+_0x11dceb['table']));const _0x58b957=_0x11dceb[_0x1225b3(0x207)]===_0x11dceb[_0x1225b3(0x310)]?a30_0x455b25[_0x1225b3(0x21a)]('Join\x20on:')+'\x20'+_0x11dceb[_0x1225b3(0x207)]:a30_0x455b25['dim'](_0x1225b3(0x346))+'\x20'+_0x11dceb[_0x1225b3(0x207)]+_0x1225b3(0x241)+_0x11dceb[_0x1225b3(0x310)];console[_0x1225b3(0x253)]('\x20\x20'+_0x58b957),console[_0x1225b3(0x253)]('\x20\x20'+a30_0x455b25[_0x1225b3(0x21a)](_0x1225b3(0x2af))),this['displayColumns'](_0x11dceb[_0x1225b3(0x1fc)]),!_0x11dceb[_0x1225b3(0x334)]&&console['error']('\x20\x20'+a30_0x455b25[_0x1225b3(0x26f)](_0x1225b3(0x232))+'\x20'+_0x11dceb[_0x1225b3(0x226)]);}}[a30_0x386a98(0x32c)](_0x57766d){const _0x54bbda=a30_0x386a98;for(const _0x5e7282 of _0x57766d){_0x5e7282[_0x54bbda(0x2fc)]===_0x5e7282['column']||_0x5e7282[_0x54bbda(0x320)]==='*'?console[_0x54bbda(0x253)](_0x54bbda(0x331)+_0x5e7282['label']):console['error'](_0x54bbda(0x331)+_0x5e7282[_0x54bbda(0x2fc)]+'\x20'+a30_0x455b25['dim']('('+_0x5e7282[_0x54bbda(0x320)]+')'));}}[a30_0x386a98(0x297)](_0x6559e1){const _0x3d5a9a=a30_0x386a98;console[_0x3d5a9a(0x253)]('─'[_0x3d5a9a(0x275)](0x3c));if(_0x6559e1[_0x3d5a9a(0x228)][_0x3d5a9a(0x221)]>0x0){console[_0x3d5a9a(0x253)]('\x0a'+a30_0x455b25['red'](_0x3d5a9a(0x27e)));for(const _0x34a6df of _0x6559e1[_0x3d5a9a(0x228)]){console[_0x3d5a9a(0x253)]('\x20\x20'+a30_0x455b25['red']('•')+'\x20'+_0x34a6df);}}_0x6559e1[_0x3d5a9a(0x306)]&&console['error']('\x0a'+a30_0x455b25[_0x3d5a9a(0x2e8)]('✔')+_0x3d5a9a(0x31a));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x1e4);['description']=a30_0x386a98(0x203);async[a30_0x386a98(0x340)](_0x599149){const _0x29ce36=a30_0x386a98,{options:_0x42b914,args:_0x15d13e,tdx:_0xda4b95}=_0x599149,_0x4c44c4=_0x42b914,_0x396282=_0x15d13e[0x0]||_0x42b914[_0x29ce36(0x335)];if(!_0x396282)return showParentSegmentNotSetError(_0x29ce36(0x2ad)+_0x29ce36(0x1f8)+_0x29ce36(0x2ab)+_0x29ce36(0x2f0)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x29ce36(0x246)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x29ce36(0x1bc)),0x1;if(!_0x4c44c4[_0x29ce36(0x1df)]&&!_0x4c44c4[_0x29ce36(0x25c)]&&!_0x4c44c4['behavior']&&!_0x4c44c4[_0x29ce36(0x321)])return console[_0x29ce36(0x253)](a30_0x455b25[_0x29ce36(0x26f)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x29ce36(0x30f)),console[_0x29ce36(0x253)]('Options:'),console[_0x29ce36(0x253)](_0x29ce36(0x29f)),console[_0x29ce36(0x253)](_0x29ce36(0x24a)),console[_0x29ce36(0x253)](_0x29ce36(0x269)),console[_0x29ce36(0x253)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x474065=resolveYamlFile(_0x396282);if(!existsSync(_0x474065))return showFileNotFoundError(_0x474065,_0x396282),0x1;_0x4c44c4['verbose']&&(console['error'](_0x29ce36(0x2f5)+_0x4c44c4[_0x29ce36(0x24d)]),console[_0x29ce36(0x253)]('YAML\x20file:\x20'+_0x474065));let _0x330fed;try{_0x330fed=readFileSync(_0x474065,'utf-8');}catch(_0x133feb){const _0x2e3374=_0x133feb instanceof Error?_0x133feb[_0x29ce36(0x1dc)]:String(_0x133feb);return console[_0x29ce36(0x253)](_0x29ce36(0x294)+_0x2e3374),0x1;}let _0x542832;try{_0x542832=parseDef(_0x330fed);}catch(_0x9b8d86){const _0x28c394=_0x9b8d86 instanceof Error?_0x9b8d86[_0x29ce36(0x1dc)]:String(_0x9b8d86);return console[_0x29ce36(0x253)](a30_0x455b25[_0x29ce36(0x26f)](_0x29ce36(0x2d4)+_0x28c394)),0x1;}if(_0x4c44c4['attribute']===!![]||_0x4c44c4[_0x29ce36(0x25c)]===''){const _0x1365e2=_0x542832[_0x29ce36(0x33e)]?.['map'](_0x5018ca=>_0x5018ca[_0x29ce36(0x333)])||[];if(_0x1365e2[_0x29ce36(0x221)]===0x0)console[_0x29ce36(0x253)](a30_0x455b25[_0x29ce36(0x26f)](_0x29ce36(0x1d4)));else{console[_0x29ce36(0x253)](a30_0x455b25[_0x29ce36(0x26f)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x29ce36(0x253)](_0x29ce36(0x349));for(const _0x3b7b00 of _0x1365e2){console[_0x29ce36(0x253)]('\x20\x20'+a30_0x455b25[_0x29ce36(0x216)](_0x3b7b00));}console[_0x29ce36(0x253)](_0x29ce36(0x2ee)+_0x396282+_0x29ce36(0x2c2)+_0x1365e2[0x0]+'\x22');}return 0x1;}if(_0x4c44c4[_0x29ce36(0x2a2)]===!![]||_0x4c44c4[_0x29ce36(0x2a2)]===''){const _0x2fd706=_0x542832[_0x29ce36(0x305)]?.[_0x29ce36(0x2fb)](_0x476d4c=>_0x476d4c[_0x29ce36(0x333)])||[];if(_0x2fd706[_0x29ce36(0x221)]===0x0)console['error'](a30_0x455b25[_0x29ce36(0x26f)](_0x29ce36(0x2e1)));else{console['error'](a30_0x455b25[_0x29ce36(0x26f)](_0x29ce36(0x285))),console['error']('Available\x20behaviors:');for(const _0x5ea2ee of _0x2fd706){console[_0x29ce36(0x253)]('\x20\x20'+a30_0x455b25[_0x29ce36(0x216)](_0x5ea2ee));}console['error'](_0x29ce36(0x2ee)+_0x396282+_0x29ce36(0x317)+_0x2fd706[0x0]+'\x22');}return 0x1;}const _0x5e6ea1=createCommandSpinner(a30_0x455b25[_0x29ce36(0x21a)](_0x29ce36(0x299)),{'verbose':_0x4c44c4[_0x29ce36(0x2d3)]});_0x5e6ea1[_0x29ce36(0x2d2)]();const _0x7fdfa6={'onProgress':_0x41dca8=>{const _0x108a2f=_0x29ce36;_0x5e6ea1[_0x108a2f(0x2b4)]=formatProgressMessage(_0x41dca8);}};if(_0x4c44c4[_0x29ce36(0x1df)])_0x7fdfa6[_0x29ce36(0x1df)]=!![];if(_0x4c44c4[_0x29ce36(0x25c)]&&typeof _0x4c44c4[_0x29ce36(0x25c)]===_0x29ce36(0x296))_0x7fdfa6[_0x29ce36(0x25c)]=_0x4c44c4['attribute'];if(_0x4c44c4[_0x29ce36(0x2a2)]&&typeof _0x4c44c4['behavior']===_0x29ce36(0x296))_0x7fdfa6[_0x29ce36(0x2a2)]=_0x4c44c4[_0x29ce36(0x2a2)];if(_0x4c44c4[_0x29ce36(0x321)])_0x7fdfa6['enriched']=!![];if(_0x4c44c4[_0x29ce36(0x1de)])_0x7fdfa6[_0x29ce36(0x1de)]=_0x4c44c4[_0x29ce36(0x1de)];let _0x1523e7;try{_0x1523e7=await _0xda4b95['segment'][_0x29ce36(0x28e)](_0x330fed,_0x7fdfa6),_0x5e6ea1[_0x29ce36(0x2fa)]();}catch(_0x40a282){_0x5e6ea1[_0x29ce36(0x2fa)]();throw _0x40a282;}return await this[_0x29ce36(0x1cc)](_0x1523e7,{'master':_0x4c44c4[_0x29ce36(0x1df)],'attribute':typeof _0x4c44c4[_0x29ce36(0x25c)]==='string'?_0x4c44c4['attribute']:undefined,'behavior':typeof _0x4c44c4[_0x29ce36(0x2a2)]===_0x29ce36(0x296)?_0x4c44c4[_0x29ce36(0x2a2)]:undefined,'enriched':_0x4c44c4[_0x29ce36(0x321)]}),_0x1523e7[_0x29ce36(0x306)]?0x0:0x1;}async[a30_0x386a98(0x1cc)](_0x3b0e20,_0xb5c732){const _0x3987a2=a30_0x386a98;console[_0x3987a2(0x253)]('\x0a'+a30_0x455b25[_0x3987a2(0x319)]('Preview:')+'\x20'+_0x3b0e20[_0x3987a2(0x333)]),console[_0x3987a2(0x253)]('═'[_0x3987a2(0x275)](0x3c));if(_0xb5c732[_0x3987a2(0x1df)]&&_0x3b0e20[_0x3987a2(0x30d)]){const _0x49d4e4=a30_0x455b25[_0x3987a2(0x21a)](_0x3987a2(0x2cd))+'\x20'+a30_0x455b25[_0x3987a2(0x319)](_0x3b0e20['master'][_0x3987a2(0x2fe)]+'.'+_0x3b0e20[_0x3987a2(0x1df)][_0x3987a2(0x29e)]);await this[_0x3987a2(0x1ec)](_0x49d4e4,_0x3b0e20[_0x3987a2(0x30d)]);}else{if(_0xb5c732[_0x3987a2(0x25c)]&&_0x3b0e20[_0x3987a2(0x30d)]){const _0x57f203=a30_0x455b25[_0x3987a2(0x21a)]('Attribute:')+'\x20'+a30_0x455b25[_0x3987a2(0x319)](_0xb5c732[_0x3987a2(0x25c)]);await this[_0x3987a2(0x1ec)](_0x57f203,_0x3b0e20[_0x3987a2(0x30d)]);}else{if(_0xb5c732['behavior']&&_0x3b0e20[_0x3987a2(0x30d)]){const _0x578010=a30_0x455b25[_0x3987a2(0x21a)](_0x3987a2(0x28b))+'\x20'+a30_0x455b25[_0x3987a2(0x319)](_0xb5c732['behavior']);await this[_0x3987a2(0x1ec)](_0x578010,_0x3b0e20[_0x3987a2(0x30d)]);}else{if(_0xb5c732[_0x3987a2(0x321)]&&_0x3b0e20[_0x3987a2(0x30d)]){const _0x4b68f9=a30_0x455b25['dim'](_0x3987a2(0x1cf))+'\x20'+a30_0x455b25[_0x3987a2(0x319)](_0x3987a2(0x26b));await this[_0x3987a2(0x1ec)](_0x4b68f9,_0x3b0e20[_0x3987a2(0x30d)]);}else!_0x3b0e20['sampleData']&&console[_0x3987a2(0x253)](_0x3987a2(0x25d));}}}if(_0x3b0e20[_0x3987a2(0x228)][_0x3987a2(0x221)]>0x0){console['error']('─'[_0x3987a2(0x275)](0x3c)),console[_0x3987a2(0x253)]('\x0a'+a30_0x455b25[_0x3987a2(0x26f)]('Errors:'));for(const _0x4e1b52 of _0x3b0e20['errors']){console[_0x3987a2(0x253)]('\x20\x20'+a30_0x455b25[_0x3987a2(0x26f)]('•')+'\x20'+_0x4e1b52);}}}async[a30_0x386a98(0x1ec)](_0x249e76,_0xbaa635){const _0x2337d8=a30_0x386a98;if(_0xbaa635[_0x2337d8(0x221)]===0x0){console[_0x2337d8(0x253)]('\x0a'+_0x249e76),console['error'](_0x2337d8(0x235));return;}console['error']('\x0a'+_0x249e76);const _0x2783d4=Object[_0x2337d8(0x1bb)](_0xbaa635[0x0])[_0x2337d8(0x2fb)](_0x5cf0d2=>({'name':_0x5cf0d2,'type':typeof _0xbaa635[0x0][_0x5cf0d2]===_0x2337d8(0x218)?_0x2337d8(0x342):_0x2337d8(0x1ce)})),_0x3b7e39={'queryId':'preview','columns':_0x2783d4,'data':_0xbaa635,'stats':{'state':_0x2337d8(0x288),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xbaa635['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2ac7f6=formatAsTable(_0x3b7e39,_0xbaa635[_0x2337d8(0x221)],!![]);await writeOutput(_0x2ac7f6,undefined,_0x2337d8(0x29e));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x1f4);['description']=a30_0x386a98(0x208);async[a30_0x386a98(0x340)](_0x1af8c9){const _0xfb15c2=a30_0x386a98,{options:_0x281d05,args:_0x4a8618,tdx:_0x2b0385}=_0x1af8c9,_0x4cf69a=_0x281d05,_0xed5ddd=_0x4a8618[0x0]||_0x281d05[_0xfb15c2(0x335)];if(!_0xed5ddd)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0xfb15c2(0x2b8)),0x1;const _0x557c64=resolveYamlFile(_0xed5ddd);if(existsSync(_0x557c64)){_0x4cf69a[_0xfb15c2(0x2d3)]&&console['error'](_0xfb15c2(0x2bc)+_0x557c64);let _0x23d7aa;try{_0x23d7aa=readFileSync(_0x557c64,_0xfb15c2(0x2e0));}catch(_0x395eee){const _0x21c1d2=_0x395eee instanceof Error?_0x395eee['message']:String(_0x395eee);return console[_0xfb15c2(0x253)](_0xfb15c2(0x294)+_0x21c1d2),0x1;}const _0x3bafbf=await withSpinner('Analyzing\x20changes...',()=>_0x2b0385[_0xfb15c2(0x1bd)][_0xfb15c2(0x247)](_0x23d7aa),{'verbose':_0x4cf69a[_0xfb15c2(0x2d3)]}),_0x52057b=_0x3bafbf['data'],{isNew:_0xd957f1,name:_0x3010f4,hasChanges:_0x5d7033,diffFormatted:_0x25d859}=_0x52057b;if(_0x5d7033){_0xd957f1?console[_0xfb15c2(0x253)](_0xfb15c2(0x1cd)+_0x3010f4+'\x27:'):console['error'](_0xfb15c2(0x286)+_0x3010f4+'\x27:');console[_0xfb15c2(0x253)]('─'[_0xfb15c2(0x275)](0x3c)),console['error'](_0x25d859),console[_0xfb15c2(0x253)]('─'[_0xfb15c2(0x275)](0x3c));const _0x113a0f=_0xd957f1?_0xfb15c2(0x345)+_0x3010f4+_0xfb15c2(0x243):_0xfb15c2(0x222)+_0x3010f4+_0xfb15c2(0x243);if(!_0x4cf69a[_0xfb15c2(0x2c5)]){if(!isInteractive())return console[_0xfb15c2(0x253)](a30_0x455b25[_0xfb15c2(0x26f)](_0xfb15c2(0x22b)),_0xfb15c2(0x304)),console['error'](a30_0x455b25[_0xfb15c2(0x21a)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4ed984=await confirmKey(_0x113a0f);if(!_0x4ed984)return console[_0xfb15c2(0x253)](a30_0x455b25[_0xfb15c2(0x30a)](_0xfb15c2(0x225))),0x1;}const _0x35abb1=_0xd957f1?_0xfb15c2(0x2c4):_0xfb15c2(0x2f7);await withSpinner(_0x35abb1+_0xfb15c2(0x348)+_0x3010f4+_0xfb15c2(0x2d7),()=>_0x52057b['apply'](),{'verbose':_0x4cf69a[_0xfb15c2(0x2d3)]});const _0x2c3a87=_0xd957f1?_0xfb15c2(0x242):_0xfb15c2(0x2f4);console[_0xfb15c2(0x253)]('✔\x20'+_0x2c3a87+_0xfb15c2(0x348)+_0x3010f4+'\x27');}else console[_0xfb15c2(0x253)](_0xfb15c2(0x267)+_0x3010f4+'\x27\x20is\x20up\x20to\x20date');}const _0x375314=await withSpinner(_0xfb15c2(0x21d)+_0xed5ddd+_0xfb15c2(0x2d7),()=>_0x2b0385['segment']['runParent'](_0xed5ddd),{'verbose':_0x4cf69a[_0xfb15c2(0x2d3)]}),_0x412653=_0x375314['data'],_0x48aa0b=getConsoleUrl(_0x4cf69a[_0xfb15c2(0x24d)],_0xfb15c2(0x270)+_0x412653[_0xfb15c2(0x2c6)]+_0xfb15c2(0x34a)+_0x412653[_0xfb15c2(0x1e1)]+_0xfb15c2(0x33f)+_0x412653[_0xfb15c2(0x1d6)]);return console[_0xfb15c2(0x253)](_0xfb15c2(0x292)),console[_0xfb15c2(0x253)]('\x20\x20'+a30_0x455b25[_0xfb15c2(0x21a)](_0xfb15c2(0x26a))+'\x20'+_0x412653[_0xfb15c2(0x2b0)]),console['error']('\x20\x20'+a30_0x455b25[_0xfb15c2(0x21a)]('Status:')+'\x20'+_0x412653['status']),console[_0xfb15c2(0x253)]('\x20\x20'+a30_0x455b25['dim'](_0xfb15c2(0x2d6))+'\x20'+_0x412653[_0xfb15c2(0x1e1)]),console[_0xfb15c2(0x253)]('\x20\x20'+a30_0x455b25[_0xfb15c2(0x21a)]('Attempt:')+'\x20'+_0x412653['workflowAttemptId']),console[_0xfb15c2(0x253)]('\x20\x20'+_0x48aa0b),console[_0xfb15c2(0x253)]('\x0a'+a30_0x455b25[_0xfb15c2(0x21a)](_0xfb15c2(0x277))+_0xfb15c2(0x202)+_0x412653[_0xfb15c2(0x1d6)]+_0xfb15c2(0x22a)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x200);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x21f);async[a30_0x386a98(0x340)](_0x59fc27){const _0xfde70=a30_0x386a98,{options:_0x2948c5,args:_0x167052,tdx:_0x13abb0}=_0x59fc27,_0x149d73=_0x167052[0x0]||_0x2948c5[_0xfde70(0x335)];if(!_0x149d73)return showParentSegmentNotSetError(_0xfde70(0x1e8)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x2948c5['verbose']&&(console[_0xfde70(0x253)](_0xfde70(0x2f5)+_0x2948c5[_0xfde70(0x24d)]),console[_0xfde70(0x253)](_0xfde70(0x22f)+_0x149d73));const _0x1796f2=await withSpinner(_0xfde70(0x329)+_0x149d73+'\x27...',()=>_0x13abb0[_0xfde70(0x1bd)][_0xfde70(0x1c2)](_0x149d73),{'verbose':_0x2948c5[_0xfde70(0x2d3)]}),_0x45980c=_0x1796f2['data'];console['error'](_0xfde70(0x2ce)+_0x45980c[_0xfde70(0x221)]+'\x20field'+(_0x45980c[_0xfde70(0x221)]!==0x1?'s':''));if(_0x2948c5[_0xfde70(0x25f)]||_0x2948c5[_0xfde70(0x2f2)])return await handleSDKOutput(_0x45980c,_0x2948c5),0x0;return displayFieldsHumanReadable(_0x45980c,_0x149d73),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x386a98(0x333)]='segment:parent:view';[a30_0x386a98(0x1ff)]='Show\x20parent\x20segment\x20details';async['execute'](_0x346249){const _0x496308=a30_0x386a98,{options:_0x3aa7a8,args:_0x38ff61,tdx:_0x502213}=_0x346249,_0x5f4f94=_0x3aa7a8,_0x8d8ffb=_0x38ff61[0x0]||_0x3aa7a8[_0x496308(0x335)];if(!_0x8d8ffb)return showParentSegmentNotSetError(_0x496308(0x2f8)+_0x496308(0x2d1)+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x3aa7a8[_0x496308(0x2d3)]&&(console[_0x496308(0x253)](_0x496308(0x2f5)+_0x3aa7a8['site']),console[_0x496308(0x253)](_0x496308(0x22f)+_0x8d8ffb));const _0x21ec11=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x8d8ffb+_0x496308(0x2d7),()=>_0x502213[_0x496308(0x1bd)][_0x496308(0x22e)](_0x8d8ffb),{'verbose':_0x3aa7a8[_0x496308(0x2d3)]}),_0x194713=_0x21ec11['data'];if(_0x5f4f94['web']){const _0x3ed307=getConsoleNextUrl(_0x5f4f94[_0x496308(0x24d)],'/app/dw/parentSegments/'+_0x194713['id']);return console[_0x496308(0x253)](a30_0x455b25[_0x496308(0x2e8)]('✔')+_0x496308(0x280)+a30_0x455b25[_0x496308(0x216)](_0x3ed307)),openBrowser(_0x3ed307),0x0;}return await handleSingleObjectOutput(_0x194713,_0x3aa7a8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x20e);[a30_0x386a98(0x1ff)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x34989c){const _0x291e0a=a30_0x386a98,{options:_0x2248f3,args:_0x2416cb,tdx:_0x994d6e}=_0x34989c,_0x18cbd7=_0x2248f3,_0x5709a4=_0x2416cb[0x0]||_0x2248f3[_0x291e0a(0x335)];if(!_0x5709a4)return showParentSegmentNotSetError(_0x291e0a(0x1d8)+'\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'+'Options:\x0a'+_0x291e0a(0x1f7)),0x1;_0x2248f3[_0x291e0a(0x2d3)]&&(console[_0x291e0a(0x253)](_0x291e0a(0x2f5)+_0x2248f3[_0x291e0a(0x24d)]),console[_0x291e0a(0x253)]('Parent\x20segment:\x20'+_0x5709a4));const _0x3912b3=await withSpinner(_0x291e0a(0x324)+_0x5709a4+_0x291e0a(0x2d7),()=>_0x994d6e[_0x291e0a(0x1bd)][_0x291e0a(0x2b1)](_0x5709a4),{'verbose':_0x2248f3[_0x291e0a(0x2d3)]}),_0xa8aee=_0x3912b3[_0x291e0a(0x2c1)],_0x2cc111=_0x994d6e[_0x291e0a(0x1bd)][_0x291e0a(0x24b)](_0xa8aee);if(_0x18cbd7['output']){const _0x476ddf=await this[_0x291e0a(0x2a5)](_0x34989c,_0x5709a4,_0xa8aee,_0x2cc111),_0x1df176=this[_0x291e0a(0x33b)](_0x476ddf);writeFileSync(_0x18cbd7[_0x291e0a(0x347)],_0x1df176);const _0x57a6b5=_0x476ddf[_0x291e0a(0x276)][_0x291e0a(0x1fc)][_0x291e0a(0x221)]+_0x476ddf[_0x291e0a(0x305)]['reduce']((_0x539f0b,_0x231e6a)=>_0x539f0b+_0x231e6a['columns']['length'],0x0),_0x220437=_0x476ddf[_0x291e0a(0x305)][_0x291e0a(0x313)](_0x5f573c=>_0x5f573c['columns'][_0x291e0a(0x221)]===0x0)[_0x291e0a(0x221)];return console[_0x291e0a(0x1bf)]('Schema\x20saved\x20to\x20'+_0x18cbd7['output']),console[_0x291e0a(0x1bf)](_0x291e0a(0x2a6)+_0x2cc111),console[_0x291e0a(0x1bf)](_0x291e0a(0x303)+_0x476ddf[_0x291e0a(0x305)][_0x291e0a(0x221)]+_0x291e0a(0x301)),console[_0x291e0a(0x1bf)](_0x291e0a(0x1c3)+_0x57a6b5+_0x291e0a(0x1be)),_0x220437>0x0&&console[_0x291e0a(0x1bf)](_0x291e0a(0x1e5)+_0x220437+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x291e0a(0x253)]('\x0a'+a30_0x455b25[_0x291e0a(0x319)](_0x291e0a(0x1da))+'\x20'+a30_0x455b25[_0x291e0a(0x216)](_0x2cc111));const _0x5f3dba=await withSpinner(_0x291e0a(0x300),()=>_0x994d6e[_0x291e0a(0x1bd)][_0x291e0a(0x2b7)](_0xa8aee),{'verbose':_0x2248f3[_0x291e0a(0x2d3)]});console[_0x291e0a(0x253)]('\x0a'+a30_0x455b25[_0x291e0a(0x319)](_0x291e0a(0x276))+'\x20'+a30_0x455b25[_0x291e0a(0x21a)]('('+_0x2cc111+_0x291e0a(0x1dd)));const _0x4b42ea=await executeSchemaQuery(_0x5f3dba[_0x291e0a(0x2c1)],_0x994d6e,_0x2248f3);await handleQueryOutput(_0x4b42ea,_0x2248f3);const _0x2c3d22=await withSpinner(_0x291e0a(0x28c),()=>_0x994d6e[_0x291e0a(0x1bd)]['getBehaviorNames'](_0xa8aee),{'verbose':_0x2248f3[_0x291e0a(0x2d3)]});for(const _0x1cb805 of _0x2c3d22[_0x291e0a(0x2c1)]){const _0x86aa25=_0x291e0a(0x1d0)+_0x1cb805[_0x291e0a(0x1c9)]()[_0x291e0a(0x255)](/\s+/g,'_'),_0x4e9883='SELECT\x20*\x20FROM\x20'+_0x2cc111+'.'+_0x86aa25;console[_0x291e0a(0x253)]('\x0a'+a30_0x455b25['bold'](_0x1cb805)+'\x20'+a30_0x455b25[_0x291e0a(0x21a)]('('+_0x2cc111+'.'+_0x86aa25+')'));try{const _0x1a1a8c=await executeSchemaQuery(_0x4e9883,_0x994d6e,_0x2248f3);await handleQueryOutput(_0x1a1a8c,_0x2248f3);}catch{console[_0x291e0a(0x253)](a30_0x455b25[_0x291e0a(0x30a)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a30_0x386a98(0x2a5)](_0x55815d,_0x17ae0e,_0x2a11d0,_0x264d3f){const _0x341c3b=a30_0x386a98,{options:_0x14c56b,tdx:_0x58d266}=_0x55815d,_0x154d8b=await withSpinner(_0x341c3b(0x300),()=>_0x58d266[_0x341c3b(0x1bd)][_0x341c3b(0x2b7)](_0x2a11d0),{'verbose':_0x14c56b['verbose']}),_0x34036=await executeSchemaQuery(_0x154d8b[_0x341c3b(0x2c1)],_0x58d266,_0x14c56b),_0x2129f8=_0x34036[_0x341c3b(0x2c1)][_0x341c3b(0x2fb)](_0x359864=>({'name':_0x359864[_0x341c3b(0x2ac)],'type':_0x359864['column_type']})),_0x35b26b=await withSpinner(_0x341c3b(0x28c),()=>_0x58d266['segment'][_0x341c3b(0x308)](_0x2a11d0),{'verbose':_0x14c56b[_0x341c3b(0x2d3)]}),_0x5e0c3b=[];for(const _0x2e2a53 of _0x35b26b[_0x341c3b(0x2c1)]){const _0x3d873c=_0x341c3b(0x1d0)+_0x2e2a53[_0x341c3b(0x1c9)]()[_0x341c3b(0x255)](/\s+/g,'_'),_0x217de6=_0x341c3b(0x1ee)+_0x264d3f+'.'+_0x3d873c;let _0x1aea48=[];try{const _0xd67dea=await executeSchemaQuery(_0x217de6,_0x58d266,_0x14c56b);_0x1aea48=_0xd67dea['data'][_0x341c3b(0x2fb)](_0x49dd92=>({'name':_0x49dd92['column_name'],'type':_0x49dd92[_0x341c3b(0x252)]}));}catch{}_0x5e0c3b[_0x341c3b(0x26c)]({'table':_0x3d873c,'columns':_0x1aea48});}return{'database':_0x264d3f,'parent_segment':_0x17ae0e,'parent_id':_0x2a11d0,'customers':{'table':_0x341c3b(0x276),'columns':_0x2129f8},'behaviors':_0x5e0c3b};}[a30_0x386a98(0x33b)](_0x5997c8){const _0x2076df=a30_0x386a98,_0xcd65ec=_0x228d88=>{const _0xc25d71=a30_0x3363;if(_0x228d88[_0xc25d71(0x221)]===0x0)return'[]';const _0x1f1ad1=_0x228d88[_0xc25d71(0x2fb)](_0x416a2c=>_0xc25d71(0x201)+_0x416a2c['name']+_0xc25d71(0x2be)+_0x416a2c[_0xc25d71(0x2de)]+_0xc25d71(0x33c));return'[\x0a'+_0x1f1ad1[_0xc25d71(0x248)](',\x0a')+_0xc25d71(0x2d8);},_0x345fa5=_0x5997c8[_0x2076df(0x305)][_0x2076df(0x2fb)](_0x52cda=>{const _0x873129=_0x2076df;return _0x873129(0x1e6)+_0x52cda[_0x873129(0x29e)]+_0x873129(0x2aa)+_0xcd65ec(_0x52cda[_0x873129(0x1fc)])[_0x873129(0x255)](/^/gm,'\x20\x20')[_0x873129(0x291)]()+_0x873129(0x31e);})[_0x2076df(0x248)](',\x0a');return _0x2076df(0x1e2)+_0x5997c8[_0x2076df(0x2fe)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x5997c8[_0x2076df(0x265)]+_0x2076df(0x23d)+_0x5997c8[_0x2076df(0x281)]+_0x2076df(0x236)+_0x5997c8[_0x2076df(0x276)][_0x2076df(0x29e)]+_0x2076df(0x2a7)+_0xcd65ec(_0x5997c8[_0x2076df(0x276)][_0x2076df(0x1fc)])['replace'](/^/gm,'\x20\x20')[_0x2076df(0x291)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x345fa5+_0x2076df(0x339);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x2eb);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x28d);async['execute'](_0x499fd8){const _0x3b11c2=a30_0x386a98,{options:_0xed5b8,args:_0x51320f,tdx:_0x1b78c8}=_0x499fd8,_0x41e923=_0x51320f[0x0]||_0xed5b8[_0x3b11c2(0x335)];if(!_0x41e923)return showParentSegmentNotSetError(_0x3b11c2(0x330)+_0x3b11c2(0x1fd)),0x1;_0xed5b8['verbose']&&(console[_0x3b11c2(0x253)]('Site:\x20'+_0xed5b8[_0x3b11c2(0x24d)]),console[_0x3b11c2(0x253)](_0x3b11c2(0x22f)+_0x41e923));const _0x48f895=await withSpinner(_0x3b11c2(0x324)+_0x41e923+_0x3b11c2(0x2d7),()=>_0x1b78c8[_0x3b11c2(0x1bd)]['resolveParentId'](_0x41e923),{'verbose':_0xed5b8[_0x3b11c2(0x2d3)]}),_0x510f08=_0x48f895['data'],_0x190158=await withSpinner(_0x3b11c2(0x27d)+_0x41e923+_0x3b11c2(0x2d7),()=>_0x1b78c8[_0x3b11c2(0x1bd)][_0x3b11c2(0x2b7)](_0x510f08),{'verbose':_0xed5b8[_0x3b11c2(0x2d3)]}),_0x287d77=_0x190158[_0x3b11c2(0x2c1)];return _0xed5b8[_0x3b11c2(0x2ba)]==='json'||_0xed5b8[_0x3b11c2(0x2ba)]===_0x3b11c2(0x2f2)?await handleSDKOutput([{'sql':_0x287d77}],_0xed5b8):console['log'](_0x287d77),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x219);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x2bf);async[a30_0x386a98(0x340)](_0x59c46f){const _0x39284c=a30_0x386a98,{options:_0x30a4d0,args:_0x1a0820,tdx:_0x309096}=_0x59c46f,_0x3ede7c=_0x1a0820[0x0]||_0x30a4d0['parentSegment'];if(!_0x3ede7c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x39284c(0x309)),0x1;_0x30a4d0[_0x39284c(0x2d3)]&&(console['error'](_0x39284c(0x2f5)+_0x30a4d0[_0x39284c(0x24d)]),console[_0x39284c(0x253)](_0x39284c(0x22f)+_0x3ede7c));const _0x5671bc=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3ede7c+'\x27...',()=>_0x309096[_0x39284c(0x1bd)][_0x39284c(0x2b1)](_0x3ede7c),{'verbose':_0x30a4d0[_0x39284c(0x2d3)]}),_0x26a9eb=_0x5671bc[_0x39284c(0x2c1)],_0x3b41fe=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3ede7c+_0x39284c(0x2d7),()=>_0x309096['segment'][_0x39284c(0x2b7)](_0x26a9eb),{'verbose':_0x30a4d0[_0x39284c(0x2d3)]});let _0x4e51e7=_0x3b41fe['data'];const _0x2b8b41=resolveLimit(_0x30a4d0[_0x39284c(0x287)],DEFAULT_DISPLAY_LIMIT),_0x5c7465=/\bLIMIT\s+\d+/i['test'](_0x4e51e7);!_0x5c7465&&(_0x4e51e7=_0x4e51e7[_0x39284c(0x291)]()[_0x39284c(0x255)](/;+$/,''),_0x4e51e7=_0x39284c(0x343)+_0x4e51e7+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x2b8b41);_0x30a4d0[_0x39284c(0x2d3)]&&console[_0x39284c(0x253)]('SQL\x20query:\x0a'+_0x4e51e7);const _0x8fd40=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x3ee4dd=>{const _0x25e054=_0x39284c,_0x252cb3=await _0x309096[_0x25e054(0x1f1)][_0x25e054(0x340)](_0x4e51e7,{'catalog':'td','schema':'information_schema','onJobId':_0x46fa43=>{const _0x8bc9cd=_0x25e054;_0x3ee4dd[_0x8bc9cd(0x1e9)](_0x46fa43);}});return _0x252cb3;},{'verbose':_0x30a4d0['verbose']}),_0xf4f0ac=_0x8fd40[_0x39284c(0x2c1)],_0x4c611c=_0xf4f0ac[_0x39284c(0x204)]?_0x39284c(0x2b9)+_0xf4f0ac[_0x39284c(0x204)]+']':'';return console[_0x39284c(0x253)](_0x39284c(0x2a1)+_0xf4f0ac[_0x39284c(0x22c)][_0x39284c(0x1f0)][_0x39284c(0x23e)]()+_0x39284c(0x279)+(_0x39284c(0x2d5)+formatElapsed(_0xf4f0ac['stats'][_0x39284c(0x315)])+_0x4c611c)),await handleQueryOutput(_0xf4f0ac,_0x30a4d0),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x386a98(0x24f);[a30_0x386a98(0x1ff)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a30_0x386a98(0x340)](_0x5c06d4){const _0x8835da=a30_0x386a98,{options:_0x113480,args:_0x31338a,tdx:_0x2265a8}=_0x5c06d4,_0x211234=_0x31338a[0x0],_0x3431d3=await withSpinner(_0x211234?_0x8835da(0x323)+_0x211234+_0x8835da(0x2d7):_0x8835da(0x211),()=>_0x2265a8[_0x8835da(0x2fd)][_0x8835da(0x318)](),{'verbose':_0x113480[_0x8835da(0x2d3)]});let _0x3f42a9=_0x3431d3[_0x8835da(0x2c1)]['filter'](_0x14f292=>_0x14f292[_0x8835da(0x1ef)]);if(_0x211234){const _0x4518a5=_0x211234[_0x8835da(0x255)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x8835da(0x255)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x39ae91=new RegExp('^'+_0x4518a5+'$','i');_0x3f42a9=_0x3f42a9[_0x8835da(0x313)](_0x3397ef=>_0x39ae91[_0x8835da(0x1ea)](_0x3397ef[_0x8835da(0x333)]));}_0x3f42a9['sort']((_0x57a135,_0x537f63)=>_0x57a135[_0x8835da(0x333)][_0x8835da(0x29c)](_0x537f63[_0x8835da(0x333)])),console[_0x8835da(0x253)](_0x8835da(0x2ce)+_0x3f42a9['length']+_0x8835da(0x2bd)+(_0x3f42a9['length']!==0x1?'s':''));const _0x11a705=_0x266ed3=>{const _0x4a1e14=_0x8835da;return getConsoleNextUrl(_0x113480[_0x4a1e14(0x24d)],_0x4a1e14(0x257)+_0x266ed3);};if(_0x113480[_0x8835da(0x2ba)]===_0x8835da(0x25f)||_0x113480[_0x8835da(0x2ba)]===_0x8835da(0x2f2)){const _0x46c92b=_0x3f42a9[_0x8835da(0x2fb)](_0x53c2b8=>({..._0x53c2b8,'url':_0x11a705(_0x53c2b8['id'])}));await handleSDKOutput(_0x46c92b,_0x113480);}else{if(_0x3f42a9[_0x8835da(0x221)]===0x0)console[_0x8835da(0x1bf)](_0x8835da(0x32b));else for(const _0x3694bb of _0x3f42a9){const _0x228614=_0x3694bb[_0x8835da(0x1c5)]?a30_0x455b25[_0x8835da(0x21a)]('\x20('+formatRows(_0x3694bb[_0x8835da(0x1c5)])+')'):'',_0x3b8a31=hyperlink(_0x3694bb[_0x8835da(0x333)],_0x11a705(_0x3694bb['id']));console[_0x8835da(0x1bf)]('⚡\x20'+_0x3b8a31+_0x228614);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x2cb);['description']=a30_0x386a98(0x1c6);async[a30_0x386a98(0x340)](_0x43ad00){const _0x261374=a30_0x386a98,{options:_0x559b5c,args:_0x4703d2,tdx:_0x550a66}=_0x43ad00,_0xcec503=_0x4703d2[0x0]||_0x559b5c['parentSegment'];if(!_0xcec503)return showParentSegmentNotSetError(_0x261374(0x209)+_0x261374(0x231)),0x1;const _0x26cf97=resolveYamlFile(_0xcec503);if(!existsSync(_0x26cf97))return showFileNotFoundError(_0x26cf97,_0xcec503),0x1;let _0x4665ac;try{_0x4665ac=readFileSync(_0x26cf97,_0x261374(0x2e0));}catch(_0x6a19dd){const _0x37584c=_0x6a19dd instanceof Error?_0x6a19dd[_0x261374(0x1dc)]:String(_0x6a19dd);return console[_0x261374(0x253)](_0x261374(0x294)+_0x37584c),0x1;}const _0x19293b=createCommandSpinner(a30_0x455b25['dim'](_0x261374(0x206)),{'verbose':_0x559b5c[_0x261374(0x2d3)]});_0x19293b[_0x261374(0x2d2)]();const _0x1a749a={'realtime':!![],'onProgress':_0x1c247c=>{const _0x43bf7e=_0x261374;_0x19293b[_0x43bf7e(0x2b4)]=formatProgressMessage(_0x1c247c);}};let _0x33fb49;try{_0x33fb49=await _0x550a66[_0x261374(0x1bd)]['validateParentYaml'](_0x4665ac,_0x1a749a),_0x19293b[_0x261374(0x2fa)]();}catch(_0x1e8347){_0x19293b[_0x261374(0x2fa)]();throw _0x1e8347;}console[_0x261374(0x253)]('\x0a'+a30_0x455b25[_0x261374(0x319)]('RT\x202.0\x20Validate:')+'\x20'+_0x33fb49[_0x261374(0x333)]),console['error']('═'[_0x261374(0x275)](0x3c)),displayRealtimeValidation(_0x33fb49),console['error']('─'[_0x261374(0x275)](0x3c));if(_0x33fb49['errors'][_0x261374(0x221)]>0x0){console[_0x261374(0x253)]('\x0a'+a30_0x455b25['red'](_0x261374(0x27e)));for(const _0x50f5d2 of _0x33fb49[_0x261374(0x228)]){console[_0x261374(0x253)]('\x20\x20'+a30_0x455b25[_0x261374(0x26f)]('•')+'\x20'+_0x50f5d2);}}return _0x33fb49['allValid']&&console['error']('\x0a'+a30_0x455b25[_0x261374(0x2e8)]('✔')+_0x261374(0x1c7)),_0x33fb49[_0x261374(0x306)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x386a98(0x333)]=a30_0x386a98(0x263);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x2d9);async[a30_0x386a98(0x340)](_0x1e62b1){const _0x5d4e92=a30_0x386a98,{options:_0x309118,args:_0xf3f831,tdx:_0x2c697f}=_0x1e62b1,_0x365805=_0xf3f831[0x0]||_0x309118[_0x5d4e92(0x335)];if(!_0x365805)return showParentSegmentNotSetError(_0x5d4e92(0x217)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x16aece=await withSpinner(_0x5d4e92(0x324)+_0x365805+_0x5d4e92(0x2d7),()=>_0x2c697f[_0x5d4e92(0x1bd)][_0x5d4e92(0x2b1)](_0x365805),{'verbose':_0x309118[_0x5d4e92(0x2d3)]}),_0x49ee94=_0x16aece['data'],_0x5cbf4b=await withSpinner(_0x5d4e92(0x249)+_0x365805+_0x5d4e92(0x2d7),()=>_0x2c697f[_0x5d4e92(0x2c0)][_0x5d4e92(0x318)](_0x49ee94),{'verbose':_0x309118[_0x5d4e92(0x2d3)]}),_0x5a6474=_0x5cbf4b[_0x5d4e92(0x2c1)];console[_0x5d4e92(0x253)](_0x5d4e92(0x2ce)+_0x5a6474['length']+'\x20personalization\x20service'+(_0x5a6474[_0x5d4e92(0x221)]!==0x1?'s':''));if(_0x309118[_0x5d4e92(0x2ba)]===_0x5d4e92(0x25f)||_0x309118[_0x5d4e92(0x2ba)]===_0x5d4e92(0x2f2))await handleSDKOutput(_0x5a6474,_0x309118);else{if(_0x5a6474[_0x5d4e92(0x221)]===0x0)console[_0x5d4e92(0x1bf)]('No\x20personalization\x20services\x20configured'),console[_0x5d4e92(0x253)](a30_0x455b25[_0x5d4e92(0x216)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x4ff9c0 of _0x5a6474){const _0x4c1370=_0x4ff9c0[_0x5d4e92(0x25a)]?.['length']||0x0,_0x271a7a=_0x4ff9c0[_0x5d4e92(0x325)]?a30_0x455b25[_0x5d4e92(0x21a)](_0x5d4e92(0x341)+_0x4ff9c0[_0x5d4e92(0x325)]):'',_0xd3a564=a30_0x455b25[_0x5d4e92(0x21a)]('\x20('+_0x4c1370+_0x5d4e92(0x283)+(_0x4c1370!==0x1?'s':'')+')');console[_0x5d4e92(0x1bf)]('\x20\x20'+_0x4ff9c0[_0x5d4e92(0x333)]+_0x271a7a+_0xd3a564),_0x4ff9c0[_0x5d4e92(0x1ff)]&&console['log'](_0x5d4e92(0x2f1)+a30_0x455b25['dim'](_0x4ff9c0[_0x5d4e92(0x1ff)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x386a98(0x23f);[a30_0x386a98(0x1ff)]=a30_0x386a98(0x213);async['execute'](_0x419899){const _0x252074=a30_0x386a98,{options:_0x490a25,args:_0x1a1912}=_0x419899,_0x45f5a8=_0x1a1912[0x0]||_0x490a25[_0x252074(0x335)];if(!_0x45f5a8)return showParentSegmentNotSetError(_0x252074(0x23c)+_0x252074(0x307)),0x1;const _0x3fe649=resolveYamlFile(_0x45f5a8);if(!existsSync(_0x3fe649))return showFileNotFoundError(_0x3fe649,_0x45f5a8),0x1;let _0x3961fd;try{_0x3961fd=readFileSync(_0x3fe649,_0x252074(0x2e0));}catch(_0x317401){const _0x5847c8=_0x317401 instanceof Error?_0x317401[_0x252074(0x1dc)]:String(_0x317401);return console['error'](_0x252074(0x294)+_0x5847c8),0x1;}let _0x3bcb84;try{_0x3bcb84=parseDef(_0x3961fd);}catch(_0xd558d0){const _0x33d1e5=_0xd558d0 instanceof Error?_0xd558d0[_0x252074(0x1dc)]:String(_0xd558d0);return console[_0x252074(0x253)](a30_0x455b25[_0x252074(0x26f)](_0x252074(0x2d4)+_0x33d1e5)),0x1;}if(_0x3bcb84['personalization_services']&&_0x3bcb84['personalization_services'][_0x252074(0x221)]>0x0)return console[_0x252074(0x253)](a30_0x455b25['yellow']('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x3fe649)),console['error'](a30_0x455b25[_0x252074(0x21a)](_0x252074(0x1e3)+_0x3bcb84['personalization_services'][_0x252074(0x221)]+'\x20service(s)\x20configured')),0x1;!_0x3bcb84['realtime']&&(_0x3bcb84[_0x252074(0x2fd)]={'events':[{'name':_0x252074(0x1fe),'source_table':'<database>.<table>'}],'attributes':[{'name':_0x252074(0x1d5),'type':_0x252074(0x29d)}],'id_stitching':{'primary_key':_0x3bcb84['master'][_0x252074(0x29e)]===_0x252074(0x276)?_0x252074(0x223):_0x252074(0x2cc)}});_0x3bcb84[_0x252074(0x238)]=[{'name':_0x252074(0x2b3),'description':_0x252074(0x272),'trigger_event':_0x252074(0x1fe),'sections':[{'name':_0x252074(0x23b),'criteria':_0x252074(0x259),'attributes':[_0x252074(0x1d5)]}]}];const _0x39eb8c=serializeDef(_0x3bcb84);return writeFileSync(_0x3fe649,_0x39eb8c,_0x252074(0x2e0)),console['error'](a30_0x455b25[_0x252074(0x2e8)]('✔')+_0x252074(0x205)+a30_0x455b25[_0x252074(0x216)](_0x3fe649)),(!_0x3bcb84[_0x252074(0x2fd)]||_0x3961fd[_0x252074(0x2ae)](_0x252074(0x2e7))===-0x1)&&console[_0x252074(0x253)](a30_0x455b25['green']('✔')+_0x252074(0x230)),console[_0x252074(0x253)]('\x0a'+a30_0x455b25['dim'](_0x252074(0x1c4))),console[_0x252074(0x253)](_0x252074(0x20d)+_0x3fe649+_0x252074(0x1e0)),console[_0x252074(0x253)](_0x252074(0x25b)+a30_0x455b25['dim'](_0x252074(0x278)+_0x45f5a8)+_0x252074(0x2db)),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
|
+
const a31_0x442eb7=a31_0x44be;(function(_0x441d74,_0xc46c6a){const _0x6225b2=a31_0x44be,_0x5b0b72=_0x441d74();while(!![]){try{const _0x3e8c16=-parseInt(_0x6225b2(0x18f))/0x1+parseInt(_0x6225b2(0x168))/0x2*(parseInt(_0x6225b2(0x193))/0x3)+-parseInt(_0x6225b2(0x1b0))/0x4+parseInt(_0x6225b2(0x1a7))/0x5*(parseInt(_0x6225b2(0x19a))/0x6)+parseInt(_0x6225b2(0x163))/0x7*(-parseInt(_0x6225b2(0x1a0))/0x8)+-parseInt(_0x6225b2(0x1b5))/0x9*(parseInt(_0x6225b2(0x1a4))/0xa)+-parseInt(_0x6225b2(0x19c))/0xb*(-parseInt(_0x6225b2(0x176))/0xc);if(_0x3e8c16===_0xc46c6a)break;else _0x5b0b72['push'](_0x5b0b72['shift']());}catch(_0xacd4cd){_0x5b0b72['push'](_0x5b0b72['shift']());}}}(a31_0x1209,0xac0d4));import{BaseCommand,printAuthError}from'./command.js';function a31_0x1209(){const _0x9ee695=['Profile\x20\x27','\x20\x20-\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','database','(session:\x20','config','status','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','Enter\x20your\x20TD\x20API\x20key:','session','green','message','apiKey','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Validating\x20API\x20key...','method','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x0aSaved\x20to:\x20','default','profile:use','Changing\x20site\x20to\x20\x27','Enter\x20profile\x20name:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','error','warn','Set\x20a\x20profile\x20configuration\x20value','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','28NycvdZ','ERROR','text','\x27\x20removed\x20from\x20configuration','\x20Profile\x20\x27','94174Basgen','length','red','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','validate','llm_project','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','join','Site\x20was\x20not\x20changed.','name','logLevel','Failed\x20to\x20remove\x20profile:\x20','profile:set','execute','84dzOuIf','getUserInfo','profile:remove','\x27\x20updated:\x20','parent_segment','yellow','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aOperation\x20cancelled','\x20API\x20key\x20is\x20valid\x20(User:\x20','/app/mp/ak','\x20API\x20key\x20saved\x20to\x20system\x20keychain','OAuth\x20(browser\x20login)','Removal\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','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>','password','us01','create','Enter\x20description\x20(optional):','tdx:\x20profile\x20set','email','jobs','\x0aSetup\x20cancelled','tdx:\x20profile\x20remove','VALID_KEYS','1081703yNZgGp','oauth','llm_agent','confirm','87SDRAnY','You\x20can\x20find\x20your\x20API\x20key\x20at:','trim','\x27\x20requires\x20API\x20key\x20validation.','includes','split','\x0aAvailable\x20profiles:','18jHviXF','profileName','2268409BBMwsT','profile','log','site','1160296uXAZAi','Setup\x20cancelled','Profile\x20name\x20cannot\x20be\x20empty','dim','9182510zvGfgA','description','\x27\x20does\x20not\x20exist.','1354685QWmpQa','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','tdx:\x20profile\x20create','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','bold','✗\x20Validation\x20failed:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','1348164cdUkXP','\x27\x20created','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20\x20tdx\x20--profile\x20','9saXiHb'];a31_0x1209=function(){return _0x9ee695;};return a31_0x1209();}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a31_0x44be(_0x1c6111,_0x535c75){_0x1c6111=_0x1c6111-0x15f;const _0x1209fc=a31_0x1209();let _0x44bed1=_0x1209fc[_0x1c6111];return _0x44bed1;}import{getConfigDir}from'../core/config.js';import*as a31_0x58708a 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';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x5a3d6e from'prompts';import a31_0xae0580 from'chalk';function validateProfileName(_0x561f15){const _0x26e125=a31_0x44be;if(!_0x561f15||!_0x561f15[_0x26e125(0x195)]())return _0x26e125(0x1a2);const _0x1c9c32=_0x561f15['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1c9c32))return _0x26e125(0x1ce);if(profileExists(_0x1c9c32))return _0x26e125(0x1b6)+_0x1c9c32+_0x26e125(0x1c8);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x442eb7(0x171)]='profile:create';[a31_0x442eb7(0x1a5)]=a31_0x442eb7(0x1aa);async[a31_0x442eb7(0x175)](_0x1c9dd6){const _0x1ba344=a31_0x442eb7,{options:_0x3e29f1,args:_0x51323a}=_0x1c9dd6;console['log'](a31_0xae0580['bold'](_0x1ba344(0x1ab)));let _0x3e5624;if(_0x51323a[_0x1ba344(0x169)]>0x0&&_0x51323a[0x0]){const _0x29bf42=_0x51323a[0x0][_0x1ba344(0x195)](),_0x324918=validateProfileName(_0x29bf42);if(_0x324918!==!![])return console['error'](a31_0xae0580[_0x1ba344(0x16a)](_0x324918)),0x1;_0x3e5624=_0x29bf42;}else{const _0x377218=await a31_0x5a3d6e({'type':_0x1ba344(0x165),'name':'profileName','message':_0x1ba344(0x1cd),'validate':validateProfileName});if(!_0x377218['profileName'])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x3e5624=_0x377218[_0x1ba344(0x19b)][_0x1ba344(0x195)]();}const _0x4ae80f=await a31_0x5a3d6e({'type':_0x1ba344(0x165),'name':_0x1ba344(0x1a5),'message':_0x1ba344(0x188)}),_0x342c47=_0x4ae80f['description']?.[_0x1ba344(0x195)]()||undefined,_0x2edd9d=_0x3e29f1['site']||_0x1ba344(0x186),_0x3f1f8f=await promptSiteSelection(_0x2edd9d,_0x3e5624,_0x1ba344(0x1a1));if(!_0x3f1f8f)return 0x1;const _0x4a69fa=resolveSite(_0x3f1f8f);if(isOAuthSupported(_0x4a69fa)){const _0x2d2cb4=await a31_0x5a3d6e({'type':'select','name':'method','message':'Choose\x20authentication\x20method:','choices':[{'title':_0x1ba344(0x181),'value':'oauth'},{'title':'API\x20Key','value':'apikey'}]});if(!_0x2d2cb4[_0x1ba344(0x1c7)])return console[_0x1ba344(0x19e)]('\x0aSetup\x20cancelled'),0x1;if(_0x2d2cb4[_0x1ba344(0x1c7)]===_0x1ba344(0x190)){if(_0x342c47){const _0x488c4f={'site':_0x4a69fa,'description':_0x342c47};saveProfileToUserConfig(_0x3e5624,_0x488c4f);}return await runOAuthLoginFlow(_0x4a69fa,_0x3e5624,_0x3e29f1[_0x1ba344(0x172)]??LogLevel[_0x1ba344(0x164)]),0x0;}}console[_0x1ba344(0x19e)](_0x1ba344(0x162)+_0x4a69fa),console[_0x1ba344(0x19e)](_0x1ba344(0x194)),console[_0x1ba344(0x19e)]('\x20\x20'+getConsoleUrl(_0x4a69fa,_0x1ba344(0x17f)));const _0x39c45d=await a31_0x5a3d6e({'type':_0x1ba344(0x185),'name':'apiKey','message':_0x1ba344(0x1c0),'validate':_0x4aec8a=>{const _0x5874e1=_0x1ba344;if(!_0x4aec8a||!_0x4aec8a[_0x5874e1(0x195)]())return _0x5874e1(0x1a9);return!![];}});if(!_0x39c45d['apiKey'])return console[_0x1ba344(0x19e)](_0x1ba344(0x18c)),0x1;const _0x134dc7=_0x39c45d['apiKey'];console[_0x1ba344(0x19e)](_0x1ba344(0x1c6));try{const _0x3ccb16=TDX[_0x1ba344(0x187)]({'site':_0x4a69fa,'apiKey':_0x134dc7[_0x1ba344(0x195)](),'logLevel':_0x3e29f1['logLevel']??LogLevel[_0x1ba344(0x164)]}),_0xb92cec=await _0x3ccb16['jobs'][_0x1ba344(0x177)]();console[_0x1ba344(0x19e)](a31_0xae0580[_0x1ba344(0x1c2)]('✓')+_0x1ba344(0x17e)+_0xb92cec['email']+')');const _0x2cb985=await isKeychainAvailable();_0x2cb985?(await saveAPIKeyAsync(_0x134dc7['trim'](),_0x4a69fa,_0x3e5624),console['log'](a31_0xae0580[_0x1ba344(0x1c2)]('✓')+_0x1ba344(0x1a8)+_0x3e5624+')')):(console['warn'](a31_0xae0580[_0x1ba344(0x17b)](_0x1ba344(0x1b2))),console[_0x1ba344(0x15f)](a31_0xae0580['yellow'](_0x1ba344(0x16b))));const _0x2d6b87={'site':_0x4a69fa,..._0x342c47&&{'description':_0x342c47}};return saveProfileToUserConfig(_0x3e5624,_0x2d6b87),console[_0x1ba344(0x19e)](a31_0xae0580[_0x1ba344(0x1c2)]('✓')+_0x1ba344(0x167)+_0x3e5624+_0x1ba344(0x1b1)),console['log'](),console[_0x1ba344(0x19e)](_0x1ba344(0x1b3)),console[_0x1ba344(0x19e)](_0x1ba344(0x1b4)+_0x3e5624+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x1ba344(0x1b4)+_0x3e5624+_0x1ba344(0x16e)),0x0;}catch(_0xea7501){if(_0xea7501 instanceof HTTPClientError&&_0xea7501[_0x1ba344(0x1bd)]===0x191)return printAuthError(_0xea7501),0x1;return console[_0x1ba344(0x1cf)](a31_0xae0580[_0x1ba344(0x16a)](_0x1ba344(0x1ae)+(_0xea7501 instanceof Error?_0xea7501[_0x1ba344(0x1c3)]:String(_0xea7501)))),console[_0x1ba344(0x1cf)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x442eb7(0x171)]=a31_0x442eb7(0x178);[a31_0x442eb7(0x1a5)]='Remove\x20a\x20profile';['validate'](_0x205ea7){const _0x386617=a31_0x442eb7,{args:_0x60d8c6}=_0x205ea7;if(_0x60d8c6[_0x386617(0x169)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a31_0x442eb7(0x175)](_0x580879){const _0x2b45ef=a31_0x442eb7,{args:_0x63cec5}=_0x580879,_0x4478e6=_0x63cec5[0x0];console['log'](a31_0xae0580[_0x2b45ef(0x1ad)](_0x2b45ef(0x18d)));if(!profileExists(_0x4478e6)){console['error'](a31_0xae0580[_0x2b45ef(0x16a)](_0x2b45ef(0x1b6)+_0x4478e6+_0x2b45ef(0x1a6))),console[_0x2b45ef(0x19e)](_0x2b45ef(0x199));const _0x155b0b=listProfiles();if(_0x155b0b[_0x2b45ef(0x169)]===0x0)console['log'](_0x2b45ef(0x1bf));else for(const _0x8be01b of _0x155b0b){console[_0x2b45ef(0x19e)](_0x2b45ef(0x1b7)+_0x8be01b[_0x2b45ef(0x171)]);}return 0x1;}const _0x53fbce=await a31_0x5a3d6e({'type':_0x2b45ef(0x192),'name':'confirm','message':_0x2b45ef(0x1ac)+_0x4478e6+'\x27?','initial':![]});if(!_0x53fbce['confirm'])return console[_0x2b45ef(0x19e)](_0x2b45ef(0x182)),0x0;try{removeProfileFromUserConfig(_0x4478e6),console['log'](a31_0xae0580[_0x2b45ef(0x1c2)]('✓')+_0x2b45ef(0x167)+_0x4478e6+_0x2b45ef(0x166));}catch(_0x36b644){return console['error'](a31_0xae0580[_0x2b45ef(0x16a)](_0x2b45ef(0x173)+(_0x36b644 instanceof Error?_0x36b644[_0x2b45ef(0x1c3)]:String(_0x36b644)))),0x1;}const _0x3ef58e=await isKeychainAvailable();if(_0x3ef58e){const _0x2db425=await deleteKeychainAPIKey(_0x4478e6);_0x2db425&&console[_0x2b45ef(0x19e)](a31_0xae0580[_0x2b45ef(0x1c2)]('✓')+_0x2b45ef(0x161));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x442eb7(0x171)]=a31_0x442eb7(0x174);['description']=a31_0x442eb7(0x160);static [a31_0x442eb7(0x18e)]=[a31_0x442eb7(0x19f),a31_0x442eb7(0x1ba),a31_0x442eb7(0x17a),a31_0x442eb7(0x16d),a31_0x442eb7(0x191),'description'];[a31_0x442eb7(0x16c)](_0x111edc){const _0x4251bc=a31_0x442eb7,{args:_0xbe3bf2,options:_0xc6d025}=_0x111edc,_0x50c6d5=_0xc6d025[_0x4251bc(0x19d)]||getActiveProfile();if(!_0x50c6d5)return _0x4251bc(0x184);if(_0xbe3bf2[_0x4251bc(0x169)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x4251bc(0x16f)](',\x20');const _0x2c9289=_0xbe3bf2[0x0];if(!_0x2c9289[_0x4251bc(0x197)]('='))return _0x4251bc(0x1af)+ProfileSetCommand[_0x4251bc(0x18e)][_0x4251bc(0x16f)](',\x20');const [_0x301c9a]=_0x2c9289[_0x4251bc(0x198)]('=',0x2);if(!ProfileSetCommand[_0x4251bc(0x18e)][_0x4251bc(0x197)](_0x301c9a))return'Unknown\x20key\x20\x27'+_0x301c9a+_0x4251bc(0x183)+ProfileSetCommand['VALID_KEYS'][_0x4251bc(0x16f)](',\x20');return undefined;}async[a31_0x442eb7(0x175)](_0x3fe56e){const _0x5b478a=a31_0x442eb7,{args:_0x3cb414,options:_0x11a936}=_0x3fe56e,_0x1a29e3=_0x11a936[_0x5b478a(0x19d)]||getActiveProfile(),[_0x25a35f,..._0x57f671]=_0x3cb414[0x0][_0x5b478a(0x198)]('='),_0x20d9e7=_0x57f671[_0x5b478a(0x16f)]('=');console['log'](a31_0xae0580['bold'](_0x5b478a(0x189)));if(!profileExists(_0x1a29e3)){const _0xdc2383=await a31_0x5a3d6e({'type':_0x5b478a(0x192),'name':_0x5b478a(0x187),'message':_0x5b478a(0x1b6)+_0x1a29e3+_0x5b478a(0x17c),'initial':!![]});if(!_0xdc2383[_0x5b478a(0x187)])return console[_0x5b478a(0x19e)]('Operation\x20cancelled'),0x1;}const _0x306b88=loadProfile(_0x1a29e3),_0x3cbabb=_0x306b88?.[_0x5b478a(0x1bc)]||{};if(_0x25a35f===_0x5b478a(0x19f)){const _0x1e0270=resolveSite(_0x20d9e7);console[_0x5b478a(0x19e)](_0x5b478a(0x1cc)+_0x1e0270+_0x5b478a(0x196)),console[_0x5b478a(0x19e)](_0x5b478a(0x1be)),console['log']('\x20\x20'+getConsoleUrl(_0x1e0270,_0x5b478a(0x17f)));const _0x201cda=await a31_0x5a3d6e({'type':_0x5b478a(0x185),'name':_0x5b478a(0x1c4),'message':_0x5b478a(0x1b9),'validate':_0x509010=>{const _0x26485e=_0x5b478a;if(!_0x509010||!_0x509010[_0x26485e(0x195)]())return _0x26485e(0x1a9);return!![];}});if(!_0x201cda[_0x5b478a(0x1c4)])return console[_0x5b478a(0x19e)](_0x5b478a(0x17d)),0x1;console[_0x5b478a(0x19e)](_0x5b478a(0x1c6));try{const _0x5db4f5=TDX[_0x5b478a(0x187)]({'site':_0x1e0270,'apiKey':_0x201cda[_0x5b478a(0x1c4)][_0x5b478a(0x195)](),'logLevel':_0x11a936[_0x5b478a(0x172)]??LogLevel['ERROR']}),_0x3c070f=await _0x5db4f5[_0x5b478a(0x18b)][_0x5b478a(0x177)]();console[_0x5b478a(0x19e)](a31_0xae0580[_0x5b478a(0x1c2)]('✓')+_0x5b478a(0x17e)+_0x3c070f[_0x5b478a(0x18a)]+')');const _0x36af35=await isKeychainAvailable();_0x36af35?(await saveAPIKeyAsync(_0x201cda[_0x5b478a(0x1c4)][_0x5b478a(0x195)](),_0x1e0270,_0x1a29e3),console[_0x5b478a(0x19e)](a31_0xae0580[_0x5b478a(0x1c2)]('✓')+_0x5b478a(0x180))):console[_0x5b478a(0x15f)](a31_0xae0580[_0x5b478a(0x17b)](_0x5b478a(0x1b2))),_0x3cbabb['site']=_0x1e0270;}catch(_0x2bb829){if(_0x2bb829 instanceof HTTPClientError&&_0x2bb829[_0x5b478a(0x1bd)]===0x191)return printAuthError(_0x2bb829),0x1;return console[_0x5b478a(0x1cf)](a31_0xae0580[_0x5b478a(0x16a)](_0x5b478a(0x1ae)+(_0x2bb829 instanceof Error?_0x2bb829[_0x5b478a(0x1c3)]:String(_0x2bb829)))),console[_0x5b478a(0x1cf)](_0x5b478a(0x170)),0x1;}}else _0x3cbabb[_0x25a35f]=_0x20d9e7||undefined;return saveProfileToUserConfig(_0x1a29e3,_0x3cbabb),console[_0x5b478a(0x19e)](a31_0xae0580[_0x5b478a(0x1c2)]('✓')+_0x5b478a(0x167)+_0x1a29e3+_0x5b478a(0x179)+_0x25a35f+'='+(_0x20d9e7||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x442eb7(0x171)]=a31_0x442eb7(0x1cb);[a31_0x442eb7(0x1a5)]='Set\x20session\x20profile';[a31_0x442eb7(0x16c)](_0x5b3eec){const _0x300e24=a31_0x442eb7,{args:_0x17b0d7}=_0x5b3eec;if(_0x17b0d7['length']===0x0)return _0x300e24(0x1b8);return undefined;}async[a31_0x442eb7(0x175)](_0x5e253d){const _0x568285=a31_0x442eb7,{args:_0x597914,options:_0x46de87}=_0x5e253d,_0x36dc41=_0x597914[0x0],_0x12e416=_0x46de87[_0x568285(0x1ca)];cleanExpiredSessions();if(!profileExists(_0x36dc41)){console[_0x568285(0x1cf)](a31_0xae0580[_0x568285(0x16a)](_0x568285(0x1b6)+_0x36dc41+_0x568285(0x1a6))),console[_0x568285(0x19e)]('\x0aAvailable\x20profiles:');const _0x10a5c6=listProfiles();if(_0x10a5c6[_0x568285(0x169)]===0x0)console[_0x568285(0x19e)](_0x568285(0x1bf));else for(const _0x217b9f of _0x10a5c6){console[_0x568285(0x19e)](_0x568285(0x1b7)+_0x217b9f[_0x568285(0x171)]);}return 0x1;}if(_0x12e416){const _0x5043e4=a31_0x58708a['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x36dc41),console['log']('Default\x20profile\x20set\x20to:\x20'+a31_0xae0580[_0x568285(0x1c2)](_0x36dc41)),console[_0x568285(0x19e)](a31_0xae0580[_0x568285(0x1a3)](_0x568285(0x1c9)+_0x5043e4)),0x0;}const _0x4b3408=getSessionID(_0x46de87[_0x568285(0x1c1)]);return saveSessionContext({'profile':_0x36dc41},_0x46de87[_0x568285(0x1c1)]),console[_0x568285(0x19e)]('Session\x20profile\x20set\x20to:\x20'+a31_0xae0580[_0x568285(0x1c2)](_0x36dc41)+'\x20'+a31_0xae0580['dim'](_0x568285(0x1bb)+_0x4b3408+')')),console[_0x568285(0x19e)](a31_0xae0580[_0x568285(0x1a3)](_0x568285(0x1c5)+_0x36dc41+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x1429e3=a32_0x5bdc;(function(_0x5cf888,_0x392cbc){const _0x4ab7a7=a32_0x5bdc,_0x5efb8f=_0x5cf888();while(!![]){try{const _0x224cb9=-parseInt(_0x4ab7a7(0x1f7))/0x1+parseInt(_0x4ab7a7(0x202))/0x2*(-parseInt(_0x4ab7a7(0x204))/0x3)+-parseInt(_0x4ab7a7(0x200))/0x4*(parseInt(_0x4ab7a7(0x208))/0x5)+parseInt(_0x4ab7a7(0x1fc))/0x6+-parseInt(_0x4ab7a7(0x201))/0x7+-parseInt(_0x4ab7a7(0x20b))/0x8+parseInt(_0x4ab7a7(0x206))/0x9;if(_0x224cb9===_0x392cbc)break;else _0x5efb8f['push'](_0x5efb8f['shift']());}catch(_0x4e952b){_0x5efb8f['push'](_0x5efb8f['shift']());}}}(a32_0x24df,0xd975a));function a32_0x5bdc(_0xf99def,_0x5333dd){_0xf99def=_0xf99def-0x1f4;const _0x24df10=a32_0x24df();let _0x5bdccb=_0x24df10[_0xf99def];return _0x5bdccb;}function a32_0x24df(){const _0x166e19=['description','4TKoWpG','9767051TIzkJg','12LgeCkq','site','555342YOLzBi','Error:\x20','41678568EanVuS','name','3193560vdjGql','message','config','7399672AmRkfr','\x20\x20Global:\x20~/.config/tdx/tdx.json','dim','profiles','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','588079lsEFrp','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','log','execute','5504934EgNwaS','map','green'];a32_0x24df=function(){return _0x166e19;};return a32_0x24df();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x163391 from'chalk';export class ProfilesCommand extends BaseCommand{[a32_0x1429e3(0x207)]=a32_0x1429e3(0x1f4);[a32_0x1429e3(0x1ff)]=a32_0x1429e3(0x1f9);async[a32_0x1429e3(0x1fb)](_0x236d78){const _0x50ae8c=a32_0x1429e3,{options:_0x373a98}=_0x236d78;try{const _0x2350e1=listProfiles(),_0x4f2f42=getActiveProfile();if(_0x2350e1[_0x50ae8c(0x1f5)]===0x0)return console[_0x50ae8c(0x1fa)](_0x50ae8c(0x1f6)),console['log'](_0x50ae8c(0x1f8)),console[_0x50ae8c(0x1fa)](_0x50ae8c(0x20c)),0x0;const _0x48a352=_0x2350e1[_0x50ae8c(0x1fd)](_0x1500f1=>{const _0x106964=_0x50ae8c,_0x399c24=_0x1500f1['name']===_0x4f2f42,_0x5b60fc=getProfileParams(_0x1500f1[_0x106964(0x20a)]);return{'name':_0x1500f1[_0x106964(0x207)],'active':_0x399c24,'scope':_0x1500f1['scope'],'description':_0x1500f1['config'][_0x106964(0x1ff)]||'','params':_0x5b60fc};});if(isStructuredFormat(_0x373a98))await handleSDKOutput(_0x48a352,_0x373a98);else for(const _0x5d390e of _0x2350e1){const _0x42c494=_0x5d390e[_0x50ae8c(0x207)]===_0x4f2f42?a32_0x163391[_0x50ae8c(0x1fe)]('\x20✓'):'',_0x49df60=_0x5d390e[_0x50ae8c(0x20a)][_0x50ae8c(0x203)]?a32_0x163391[_0x50ae8c(0x20d)]('\x20'+_0x5d390e[_0x50ae8c(0x20a)][_0x50ae8c(0x203)]):'',_0x1bc49a=_0x5d390e[_0x50ae8c(0x20a)]['description']?a32_0x163391[_0x50ae8c(0x20d)]('\x20\x20'+_0x5d390e[_0x50ae8c(0x20a)]['description']):'';console[_0x50ae8c(0x1fa)]('👤\x20'+_0x5d390e['name']+_0x42c494+_0x49df60+_0x1bc49a);}return 0x0;}catch(_0x1165ff){return _0x1165ff instanceof Error&&console['error'](_0x50ae8c(0x205)+_0x1165ff[_0x50ae8c(0x209)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a33_0x1ecb(){const _0x2adafc=['output','push','1115646pfrYoj','file','Site:\x20','jobId','Executing\x20query...','elapsedTimeMillis','query','Schema:\x20','6207282MdwKfk','error','Query\x20completed:\x20Processed\x20','\x20-\x20','stats','setPhase','150729nTcBsA','join','data','Executing\x20query\x20[','...','\x20splits','639728TsXCvx','Executing\x20statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','No\x20SQL\x20provided','Run\x20Trino\x20queries\x20(streaming)','Statement\x20','name','description','message','8teeGla','length','processedRows','12570hDzEBv','834MKDMhY','verbose','setJobId','5243508TWcLgW','13460nujtqe','\x0aAll\x20results\x20saved\x20to\x20','site','execute','\x20rows\x20','options','Catalog:\x20','\x20[Job\x20ID:\x20','2288tMKzeQ','setExtra','validate','8oFmFZx'];a33_0x1ecb=function(){return _0x2adafc;};return a33_0x1ecb();}const a33_0x45117f=a33_0x40ed;(function(_0x3150f0,_0x5ed5ba){const _0x247cf0=a33_0x40ed,_0xe5ea94=_0x3150f0();while(!![]){try{const _0x254fa3=parseInt(_0x247cf0(0x113))/0x1+-parseInt(_0x247cf0(0xfc))/0x2*(-parseInt(_0x247cf0(0x10d))/0x3)+-parseInt(_0x247cf0(0x123))/0x4+parseInt(_0x247cf0(0xf1))/0x5*(parseInt(_0x247cf0(0x120))/0x6)+parseInt(_0x247cf0(0xff))/0x7*(-parseInt(_0x247cf0(0x11c))/0x8)+parseInt(_0x247cf0(0x107))/0x9+-parseInt(_0x247cf0(0x11f))/0xa*(-parseInt(_0x247cf0(0xf9))/0xb);if(_0x254fa3===_0x5ed5ba)break;else _0xe5ea94['push'](_0xe5ea94['shift']());}catch(_0x49130){_0xe5ea94['push'](_0xe5ea94['shift']());}}}(a33_0x1ecb,0xa9deb));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a33_0x40ed(_0x2fe14d,_0xef0333){_0x2fe14d=_0x2fe14d-0xf1;const _0x1ecb99=a33_0x1ecb();let _0x40edda=_0x1ecb99[_0x2fe14d];return _0x40edda;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x45117f(0x119)]=a33_0x45117f(0x105);[a33_0x45117f(0x11a)]=a33_0x45117f(0x117);async[a33_0x45117f(0xf4)](_0x500c7f){const _0x4000a4=a33_0x45117f,{options:_0xe93d39,args:_0x129d3e,tdx:_0x2d13c8}=_0x500c7f,_0x3be91f={..._0xe93d39,'limitStructuredFormats':!![]},_0xc53fb8=_0x129d3e[0x0],_0x1a01eb=_0xe93d39['file'];let _0xf3137f;try{if(_0x1a01eb)_0xf3137f=readSqlStatementsFromFile(_0x1a01eb);else{if(_0xc53fb8==='-')_0xf3137f=await readSqlStatementsFromStdin();else{if(_0xc53fb8&&isSqlFilePath(_0xc53fb8))_0xf3137f=readSqlStatementsFromFile(_0xc53fb8);else{if(_0xc53fb8)_0xf3137f=splitSqlStatements(_0xc53fb8);else throw new Error(_0x4000a4(0x116));}}}}catch(_0x508588){return console[_0x4000a4(0x108)]('Error:\x20'+_0x508588['message']),0x1;}const _0x1f0d07=_0xe93d39['database']||'information_schema',_0x11e215=_0xe93d39['catalog'];try{const _0x1425f7=[],_0x2f359a=!!_0xe93d39['output'];for(let _0x23acac=0x0;_0x23acac<_0xf3137f[_0x4000a4(0x11d)];_0x23acac++){const _0x351d7d=_0xf3137f[_0x23acac],_0x4b540b=_0x23acac+0x1,_0x23021a=_0xf3137f[_0x4000a4(0x11d)],_0x35d186=_0x23021a>0x1;_0xe93d39['verbose']&&(console[_0x4000a4(0x108)]('\x0a'+(_0x35d186?'Statement\x20'+_0x4b540b+'/'+_0x23021a+':':'')),console[_0x4000a4(0x108)](_0x4000a4(0x101)+_0xe93d39[_0x4000a4(0xf3)]),console[_0x4000a4(0x108)](_0x4000a4(0xf7)+(_0x11e215||'td')),console[_0x4000a4(0x108)](_0x4000a4(0x106)+_0x1f0d07),console[_0x4000a4(0x108)]('SQL:\x20'+_0x351d7d));const _0x12fa49=_0x35d186?_0x4000a4(0x114)+_0x4b540b+'/'+_0x23021a+_0x4000a4(0x111):_0x4000a4(0x103);try{const _0x24b182=await withProgressSpinner(_0x12fa49,async _0xb98323=>{const _0x230245=_0x4000a4,_0x3ab52e=await _0x2d13c8['query'][_0x230245(0xf4)](_0x351d7d,{'catalog':_0x11e215,'schema':_0x1f0d07,'onJobId':_0x50df1f=>{const _0x1d5187=_0x230245;_0xb98323[_0x1d5187(0x122)](_0x50df1f);},'onProgress':_0x29930b=>{const _0x24c8d0=_0x230245;_0xb98323[_0x24c8d0(0x10c)](_0x24c8d0(0x110)+_0x29930b['state']+']'),_0xb98323[_0x24c8d0(0xfa)](formatRows(_0x29930b['processedRows'])+_0x24c8d0(0xf5)+_0x29930b['completedSplits']+'/'+_0x29930b['totalSplits']+_0x24c8d0(0x112));}});return _0x3ab52e;},{'verbose':_0xe93d39[_0x4000a4(0x121)]}),_0x1aefcc=_0x24b182[_0x4000a4(0x10f)],_0xeb78a=_0x1aefcc[_0x4000a4(0x102)]?_0x4000a4(0xf8)+_0x1aefcc[_0x4000a4(0x102)]+']':'',_0x36ea04=_0x35d186?_0x4000a4(0x118)+_0x4b540b+'/'+_0x23021a+_0x4000a4(0x10a):'';console[_0x4000a4(0x108)]('✔\x20'+_0x36ea04+_0x4000a4(0x109)+formatRows(_0x1aefcc[_0x4000a4(0x10b)][_0x4000a4(0x11e)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x1aefcc['stats'][_0x4000a4(0x104)])+_0xeb78a));if(_0x35d186&&_0x2f359a){const _0x408edb=resolveOutputOptions(_0x3be91f),_0x2eb6ee=await formatQueryOutput(_0x1aefcc,_0x408edb);_0x1425f7[_0x4000a4(0xfe)](_0x2eb6ee);}else await handleQueryOutput(_0x1aefcc,_0x3be91f);}catch(_0x32632b){const _0x16cea9=_0x35d186?_0x4000a4(0x118)+_0x4b540b+'/'+_0x23021a+':\x0a':'',_0x4fd2b2=_0x32632b instanceof SDKError?_0x32632b['originalMessage']:_0x32632b[_0x4000a4(0x11b)];return console[_0x4000a4(0x108)](''+_0x16cea9+_0x4fd2b2),0x1;}}if(_0xf3137f[_0x4000a4(0x11d)]>0x1&&_0x2f359a&&_0x1425f7[_0x4000a4(0x11d)]>0x0){const _0x1daaa0=_0x1425f7[_0x4000a4(0x10e)]('\x0a');writeFileSync(_0xe93d39['output'],_0x1daaa0),console[_0x4000a4(0x108)](_0x4000a4(0xf2)+_0xe93d39[_0x4000a4(0xfd)]);}return 0x0;}catch(_0x2c7916){throw _0x2c7916;}}[a33_0x45117f(0xfb)](_0x32ccf0){const _0x329e30=a33_0x45117f,_0x7d05d=_0x32ccf0['args'][0x0],_0x39a7d9=_0x32ccf0[_0x329e30(0xf6)][_0x329e30(0x100)];if(!_0x7d05d&&!_0x39a7d9)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x7d05d&&_0x39a7d9)return _0x329e30(0x115);return undefined;}}
|