@treasuredata/tdx 2026.3.8 → 2026.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/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.d.ts +2 -2
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/profile.js.map +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.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/endpoints.js.map +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.d.ts +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.d.ts.map +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-utils.js.map +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x2f8a7f=a30_0x536a;function a30_0x5f24(){const _0xeeb54c=['List\x20parent\x20segments','\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','\x20\x20Database:\x20','/\x20→\x20','Error\x20parsing\x20YAML:\x20','green','\x20field','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Updating','rowCount','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20tdx\x20wf\x20attempt\x20','format','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','collectSchema','/{name}.yml\x0a','\x20--behavior\x20\x22','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','jobId','getBehaviorNames','Updated','ID\x20Stitching:','validateParentYaml','Listing\x20parent\x20segments\x20matching\x20\x27','\x20=\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','Error:\x20Parent\x20segment\x20name\x20is\x20required','displayRealtimeInfo','scheduleOption','Master\x20+\x20Attributes','Error:\x20--behavior\x20requires\x20a\x20name\x0a','List\x20available\x20fields\x20for\x20segmentation','customers','To\x20cancel:','Validate:','label','`\x20to\x20download\x20the\x20configuration\x20first','\x0aError:','true','Creating','\x20--attribute\x20\x22<name>\x22','dirname','Behavior:','repeat','json','filter','trim','\x20\x20\x20\x20\x20\x20','page_view','\x27...','stats','⚡\x20Enabled','\x20service(s)\x20configured','start','ignore','RT\x202.0:','enabled','apply','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','segment:parent:pull','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','site','\x20\x20Tables:\x201\x20customers\x20+\x20','YAML\x20file:\x20','\x20Context\x20set:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','map','behavior','Fetching\x20behavior\x20list...','toFixed','Executing\x20parent\x20segment\x20query...','Created','createParent','20415967JLoImg','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','👥\x20','last_page_viewed','Validating\x20configuration...','\x20\x202.\x20Run\x20','/app/workflows/','column_name','parent_id','segment:parent:push','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20Migrating:\x20','Master:','displayMasterInfo','\x0a\x20\x20\x20\x20]','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','timezone','Columns:','reduce','Listing\x20fields\x20for\x20\x27','addAttributesFile','Resolving\x20parent\x20segment\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Behaviors','\x0a\x20\x20\x20\x20}','all','\x0aChanges\x20to\x20apply\x20to\x20\x27','stop','Options:','/sessions/','\x20parent\x20segment\x20\x27','red','runParent','Fetching\x20parent\x20segment\x20\x27','attributesFile','Fetching\x20current\x20configuration\x20for\x20\x27','status','\x20\x20\x20\x20','4964160DEAzdx','Database:\x20','1155868ZlhefF','Creating\x20parent\x20segment\x20\x27','Updating\x20parent\x20segment\x20\x27','No\x20parent\x20segments\x20found','\x20kill','test','\x20to\x20configure\x20your\x20personalization\x20service','\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','tdx\x20ps\x20push\x20','join','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','endsWith','RT\x202.0\x20Validate:','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20trigger=','Error\x20reading\x20file:\x20','table','\x20to\x20push\x20the\x20configuration','Error:','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','errors','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','allValid','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Events:','\x20--attribute\x20\x22','utf-8','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','displayPreviewHints','trigger_event','schemaError','✘\x20Failed\x20to\x20rename\x20directory:\x20','segment:parent:preview','sort','Output\x20Database:','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20\x20-\x20','customerGroupFile','attribute','\x20total','\x20No\x20changes\x20-\x20','.customers)','SELECT\x20*\x20FROM\x20(\x0a','segment','verbose','30GMewoJ','Next\x20steps:','attributes','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','win32','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Options:\x0a','workflowAttemptId','coveragePercent','dim','Validating\x20RT\x20configuration...','parentSegment','darwin','Attempt:','primaryKey','\x20\x201.\x20Edit\x20','Fetching\x20SQL\x20for\x20\x27','varchar','\x20\x20Columns:\x20','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20section','✔\x20Created\x20parent\x20segment\x20\x27','pushParentYaml','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','getParentSQL','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','.yaml','personalizationServices','text','single','\x20personalization\x20service','My\x20Service','displayPreviewResults','\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','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','segment:parent:view','\x0aChanges\x20to\x20\x27','sampleData','database','\x20+\x20[','ps:rt:validate','realtime:','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','✔\x20Renamed\x20directory\x20to\x20','using\x20the\x20default\x20path:\x20','open','Create\x20parent\x20segment\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sourceTableError','\x20rows)','Listing\x20RT-enabled\x20parent\x20segments...','displayValidateResults','Attributes','xdg-open','user_id','enriched','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','addBehaviors','execute','SELECT\x20*\x20FROM\x20','length','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Join:','displayAttributesStats','Show\x20parent\x20segment\x20details','Available\x20behaviors:','displaySampleData','\x0a✔\x20Workflow\x20started','/\x20directories\x20exist.','description','Join\x20on:','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20configured','/\x20directory.\x0a','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','schemaValid','Errors:','Audience\x20ID:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','population','idStitching','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','unref','15516cCTaIm','segment:parent:list','Coverage:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','.yml','parent_segment','pullParentYaml','getParentFull','match','segment:parent:create','Enriched:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','bold','name','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','keys','ps:pz:init','-1d','localeCompare','segment:parent:update','run','displaySummary','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20RT-enabled\x20parent\x20segment','<database>.<table>','yellow','replace','segment:parent:show','/app/dw/parentSegments/','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','✔\x20Found\x20','data','list','addAttributes','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','156633iJxbjA','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','7528fDLZXp','/attempt/','2WpcUkL','indexOf','⚡\x20Not\x20enabled','customersWithEvents','\x0a\x20\x20]\x0a}\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','information_schema','\x22,\x20\x22type\x22:\x20\x22','Source:','scheduleType','\x27\x20and\x20run\x20workflow?','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Listing\x20parent\x20segments...','stitchingKeys','Session:','\x20rows\x20','Overwrite\x20\x27','behaviorsFile','Pattern:\x20','jsonl','\x20\x20No\x20sample\x20data\x20available','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','foreignKey','Personalization:','Aborted.','Parent\x20segment:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','sourceTableValid','joinKey','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','elapsedTimeMillis','web','output','totalEvents','167313RMaBfN','toLowerCase','log','td_client_id','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','segment:parent:desc','listParents','interval','Status:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','resolveParentId','segment:parent:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','personalization_services','column','message','realtime','displayBehaviorsStats','personalization','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','updateParent','\x20\x20Note:\x20','master','\x20--enriched','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','No\x20RT-enabled\x20parent\x20segments\x20found','audienceId','68vdtydp','push','Attributes:','error','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','tdx\x20ps\x20preview\x20','listFields','\x20--behavior\x20\x22<name>\x22','number','columns','\x20Opening\x20','FINISHED','\x0aNew\x20parent\x20segment\x20\x27','\x5c$&','✔\x20Query\x20completed:\x20Processed\x20','423860ClRalv','isDirectory','type','Analyzing\x20changes...','customerGroup','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','behaviors','customerPercent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','limit','preview','Apply\x20changes\x20to\x20\x27','yes','double','displayColumns','string','\x20Added\x20personalization\x20template\x20to\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Fetching\x20customers\x20schema...','matchedCount','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','events','workflowSessionId','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','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Schema\x20saved\x20to\x20','Site:\x20','cyan','sections','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','previewParentYaml'];a30_0x5f24=function(){return _0xeeb54c;};return a30_0x5f24();}(function(_0x1ddc43,_0x41c07f){const _0x1f4c6d=a30_0x536a,_0x47f0eb=_0x1ddc43();while(!![]){try{const _0x5f06e9=-parseInt(_0x1f4c6d(0x169))/0x1*(-parseInt(_0x1f4c6d(0x146))/0x2)+parseInt(_0x1f4c6d(0x142))/0x3*(-parseInt(_0x1f4c6d(0x185))/0x4)+parseInt(_0x1f4c6d(0x226))/0x5+-parseInt(_0x1f4c6d(0x257))/0x6*(-parseInt(_0x1f4c6d(0x228))/0x7)+-parseInt(_0x1f4c6d(0x144))/0x8*(-parseInt(_0x1f4c6d(0x2ac))/0x9)+-parseInt(_0x1f4c6d(0x195))/0xa+-parseInt(_0x1f4c6d(0x1ff))/0xb;if(_0x5f06e9===_0x41c07f)break;else _0x47f0eb['push'](_0x47f0eb['shift']());}catch(_0x1010db){_0x47f0eb['push'](_0x47f0eb['shift']());}}}(a30_0x5f24,0xc8b3f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x5a1aa1 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';function a30_0x536a(_0x2a3307,_0x3782f7){_0x2a3307=_0x2a3307-0x120;const _0x5f245c=a30_0x5f24();let _0x536add=_0x5f245c[_0x2a3307];return _0x536add;}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_0x28e1b1 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='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a30_0x2f8a7f(0x123);function openBrowser(_0x48c20d){const _0xe6c636=a30_0x2f8a7f,_0x4ee01c=process['platform'],_0x358992=_0x4ee01c===_0xe6c636(0x263)?_0xe6c636(0x284):_0x4ee01c===_0xe6c636(0x25b)?_0xe6c636(0x1eb):_0xe6c636(0x28c);spawn(_0x358992,[_0x48c20d],{'detached':!![],'stdio':_0xe6c636(0x1ec)})[_0xe6c636(0x2ab)]();}function migrateLegacyDirectory(){const _0x14bfb7=a30_0x2f8a7f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x518896=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x518896[_0x14bfb7(0x196)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x14bfb7(0x188)](a30_0x28e1b1['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x14bfb7(0x29c))),console[_0x14bfb7(0x188)](a30_0x28e1b1[_0x14bfb7(0x260)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x14bfb7(0x2a1))),![];console[_0x14bfb7(0x188)](a30_0x28e1b1[_0x14bfb7(0x138)](_0x14bfb7(0x20a)+LEGACY_PARENT_SEGMENT_DIR+_0x14bfb7(0x1b9)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x14bfb7(0x188)](a30_0x28e1b1[_0x14bfb7(0x1bb)](_0x14bfb7(0x282)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3f4185){const _0x5b5172=_0x3f4185 instanceof Error?_0x3f4185[_0x14bfb7(0x178)]:String(_0x3f4185);return console[_0x14bfb7(0x188)](a30_0x28e1b1[_0x14bfb7(0x21f)](_0x14bfb7(0x249)+_0x5b5172+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x2f8a7f(0x132)](_0x4aee21){const _0x3bcc0f=a30_0x2f8a7f;return migrateLegacyDirectory(),super[_0x3bcc0f(0x132)](_0x4aee21);}}function resolveYamlFile(_0x473194){const _0x1e3d92=a30_0x2f8a7f;if(_0x473194[_0x1e3d92(0x233)](_0x1e3d92(0x122))||_0x473194[_0x1e3d92(0x233)](_0x1e3d92(0x271)))return _0x473194;return a30_0x5a1aa1[_0x1e3d92(0x231)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x473194)+_0x1e3d92(0x122));}function formatProgressMessage(_0x261316){const _0x2d3abd=a30_0x2f8a7f,_0x3f73db=_0x261316[_0x2d3abd(0x126)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3f73db){const [,_0x2f9457,_0x57042f,_0x26d2c8='']=_0x3f73db;return a30_0x28e1b1['dim'](_0x2f9457+':')+'\x20'+_0x57042f+a30_0x28e1b1[_0x2d3abd(0x260)](_0x26d2c8);}return a30_0x28e1b1[_0x2d3abd(0x260)](_0x261316);}function showFileNotFoundError(_0x29977e,_0x4f7e8f){const _0xa3915c=a30_0x2f8a7f;console['error'](a30_0x28e1b1[_0xa3915c(0x21f)]('Error:\x20File\x20not\x20found:\x20'+_0x29977e+'\x0a')),console[_0xa3915c(0x188)](a30_0x28e1b1[_0xa3915c(0x1b2)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x4f7e8f+_0xa3915c(0x1da)));}function displayRealtimeValidation(_0x16d1cd){const _0x22b33d=a30_0x2f8a7f;if(!_0x16d1cd[_0x22b33d(0x179)])return;const _0x248b22=_0x16d1cd[_0x22b33d(0x179)],_0x588964=_0x248b22[_0x22b33d(0x1ee)]?a30_0x28e1b1[_0x22b33d(0x1bb)](_0x22b33d(0x1e9)):a30_0x28e1b1['yellow'](_0x22b33d(0x148));console[_0x22b33d(0x188)]('\x0a'+a30_0x28e1b1[_0x22b33d(0x260)](_0x22b33d(0x1ed))+'\x20'+_0x588964);if(_0x248b22['events']&&_0x248b22[_0x22b33d(0x1ac)][_0x22b33d(0x294)]>0x0){console['error']('\x20\x20'+a30_0x28e1b1[_0x22b33d(0x260)](_0x22b33d(0x242))+'\x20'+_0x248b22[_0x22b33d(0x1ac)]['length']+_0x22b33d(0x2a0));for(const _0x407d97 of _0x248b22[_0x22b33d(0x1ac)]){const _0x4d47c1=_0x407d97[_0x22b33d(0x162)]===![]?a30_0x28e1b1[_0x22b33d(0x21f)]('✘'):a30_0x28e1b1[_0x22b33d(0x1bb)]('✔');console[_0x22b33d(0x188)](_0x22b33d(0x225)+_0x4d47c1+'\x20'+_0x407d97[_0x22b33d(0x12b)]),_0x407d97[_0x22b33d(0x287)]&&console[_0x22b33d(0x188)](_0x22b33d(0x1e5)+a30_0x28e1b1[_0x22b33d(0x21f)](_0x407d97[_0x22b33d(0x287)]));}}if(_0x248b22[_0x22b33d(0x259)]&&_0x248b22['attributes'][_0x22b33d(0x294)]>0x0){console[_0x22b33d(0x188)]('\x20\x20'+a30_0x28e1b1[_0x22b33d(0x260)](_0x22b33d(0x187))+'\x20'+_0x248b22[_0x22b33d(0x259)][_0x22b33d(0x294)]+_0x22b33d(0x2a0));for(const _0x1a77fa of _0x248b22['attributes']){const _0x1f98ad=_0x1a77fa['valid']?a30_0x28e1b1[_0x22b33d(0x1bb)]('✔'):a30_0x28e1b1[_0x22b33d(0x21f)]('✘');console[_0x22b33d(0x188)]('\x20\x20\x20\x20'+_0x1f98ad+'\x20'+_0x1a77fa[_0x22b33d(0x12b)]+'\x20'+a30_0x28e1b1[_0x22b33d(0x260)]('('+_0x1a77fa[_0x22b33d(0x197)]+')'));}}if(_0x248b22[_0x22b33d(0x2a9)]){const _0x34ddc8=_0x248b22[_0x22b33d(0x2a9)]['stitchingKeys']?.[_0x22b33d(0x294)]?_0x22b33d(0x27e)+_0x248b22[_0x22b33d(0x2a9)][_0x22b33d(0x153)][_0x22b33d(0x231)](',\x20')+']':'';console[_0x22b33d(0x188)]('\x20\x20'+a30_0x28e1b1[_0x22b33d(0x260)](_0x22b33d(0x1cb))+'\x20'+_0x248b22['idStitching'][_0x22b33d(0x265)]+_0x34ddc8);}if(_0x248b22[_0x22b33d(0x272)]&&_0x248b22['personalizationServices'][_0x22b33d(0x294)]>0x0){console['error']('\x20\x20'+a30_0x28e1b1['dim'](_0x22b33d(0x15e))+'\x20'+_0x248b22['personalizationServices'][_0x22b33d(0x294)]+'\x20service'+(_0x248b22[_0x22b33d(0x272)]['length']!==0x1?'s':''));for(const _0x3ad57d of _0x248b22[_0x22b33d(0x272)]){console[_0x22b33d(0x188)](_0x22b33d(0x24e)+_0x3ad57d[_0x22b33d(0x12b)]);}}}function showParentSegmentNotSetError(_0x355d6f){const _0x34fe33=a30_0x2f8a7f;console[_0x34fe33(0x188)](a30_0x28e1b1['yellow'](_0x34fe33(0x216))),console['error'](_0x355d6f);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x2ad);['description']=a30_0x2f8a7f(0x1b6);async['execute'](_0x4d4a5b){const _0x571af8=a30_0x2f8a7f,{options:_0x4d741e,args:_0xbba604,tdx:_0x55346e}=_0x4d4a5b,_0x4bc75a=_0xbba604[0x0];_0x4d741e[_0x571af8(0x256)]&&(console[_0x571af8(0x188)]('Site:\x20'+_0x4d741e['site']),_0x4bc75a&&console['error'](_0x571af8(0x158)+_0x4bc75a));const _0xe2cb7e=await withSpinner(_0x4bc75a?_0x571af8(0x1cd)+_0x4bc75a+_0x571af8(0x1e7):_0x571af8(0x152),()=>_0x55346e[_0x571af8(0x255)][_0x571af8(0x16f)](),{'verbose':_0x4d741e[_0x571af8(0x256)]});let _0x448b75=_0xe2cb7e[_0x571af8(0x13e)];if(_0x4bc75a){const _0x11f657=_0x4bc75a[_0x571af8(0x139)](/[.+^${}()|[\]\\]/g,_0x571af8(0x193))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x404e4e=new RegExp('^'+_0x11f657+'$','i');_0x448b75=_0x448b75['filter'](_0x33fc83=>_0x404e4e['test'](_0x33fc83[_0x571af8(0x259)][_0x571af8(0x12b)]));}_0x448b75[_0x571af8(0x24b)]((_0x538cc5,_0x259726)=>_0x538cc5[_0x571af8(0x259)][_0x571af8(0x12b)][_0x571af8(0x130)](_0x259726['attributes'][_0x571af8(0x12b)])),console[_0x571af8(0x188)]('✔\x20Found\x20'+_0x448b75[_0x571af8(0x294)]+'\x20parent\x20segment'+(_0x448b75['length']!==0x1?'s':''));const _0x8557fb=_0x256869=>{const _0x4726a6=_0x571af8;return getConsoleNextUrl(_0x4d741e[_0x4726a6(0x1f3)],_0x4726a6(0x13b)+_0x256869);};if(_0x4d741e[_0x571af8(0x1c2)]==='json'||_0x4d741e[_0x571af8(0x1c2)]===_0x571af8(0x159)){const _0x383594=_0x448b75['map'](_0x32663a=>({..._0x32663a,'url':_0x8557fb(_0x32663a['id'])}));await handleSDKOutput(_0x383594,_0x4d741e);}else{if(_0x448b75[_0x571af8(0x294)]===0x0)_0x4bc75a?console[_0x571af8(0x16b)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x4bc75a):console[_0x571af8(0x16b)](_0x571af8(0x22b));else for(const _0x1fb8c3 of _0x448b75){const _0x55608a=_0x1fb8c3['attributes'][_0x571af8(0x2a8)]?a30_0x28e1b1[_0x571af8(0x260)]('\x20('+formatRows(_0x1fb8c3[_0x571af8(0x259)]['population'])+')'):'',_0x16bb38=hyperlink(_0x1fb8c3['attributes'][_0x571af8(0x12b)],_0x8557fb(_0x1fb8c3['id']));console[_0x571af8(0x16b)](_0x571af8(0x201)+_0x16bb38+_0x55608a);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x127);['description']=a30_0x2f8a7f(0x161);async[a30_0x2f8a7f(0x292)](_0x4c5229){const _0x56d2e9=a30_0x2f8a7f,{options:_0x92d61b,args:_0x5571fe,tdx:_0x8df186}=_0x4c5229;console[_0x56d2e9(0x188)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x56d2e9(0x24d)+_0x56d2e9(0x295));const _0x312728=_0x92d61b;if(_0x5571fe[_0x56d2e9(0x294)]===0x0)return console[_0x56d2e9(0x188)](a30_0x28e1b1[_0x56d2e9(0x21f)](_0x56d2e9(0x1d0))),console[_0x56d2e9(0x188)](_0x56d2e9(0x12c)),0x1;const _0x3e009e=_0x5571fe[0x0];if(!_0x312728[_0x56d2e9(0x27d)]||!_0x312728[_0x56d2e9(0x23a)])return console[_0x56d2e9(0x188)](_0x56d2e9(0x1f7)),console[_0x56d2e9(0x188)](_0x56d2e9(0x12c)),0x1;_0x312728[_0x56d2e9(0x256)]&&(console[_0x56d2e9(0x188)](_0x56d2e9(0x1b1)+_0x312728['site']),console[_0x56d2e9(0x188)]('Name:\x20'+_0x3e009e),console[_0x56d2e9(0x188)](_0x56d2e9(0x227)+_0x312728[_0x56d2e9(0x27d)]),console[_0x56d2e9(0x188)]('Table:\x20'+_0x312728[_0x56d2e9(0x23a)]));const _0x3593f0=await loadJSONFromOptions(_0x312728[_0x56d2e9(0x259)],_0x312728[_0x56d2e9(0x222)]),_0xba33ab=await loadJSONFromOptions(_0x312728['behaviors'],_0x312728[_0x56d2e9(0x157)]),_0xe9b42c=await loadJSONFromOptions(_0x312728[_0x56d2e9(0x199)],_0x312728[_0x56d2e9(0x24f)]),_0x1ed7a3={'name':_0x3e009e,'description':_0x312728['description'],'scheduleType':_0x312728[_0x56d2e9(0x14f)],'scheduleOption':_0x312728[_0x56d2e9(0x1d2)],'timezone':_0x312728[_0x56d2e9(0x210)],'master':{'parentDatabaseName':_0x312728[_0x56d2e9(0x27d)],'parentTableName':_0x312728['table']},'attributes':_0x3593f0,'behaviors':_0xba33ab,'customerGroup':_0xe9b42c},_0x3deedc=await withSpinner(_0x56d2e9(0x229)+_0x3e009e+_0x56d2e9(0x1e7),()=>_0x8df186[_0x56d2e9(0x255)][_0x56d2e9(0x1fe)](_0x1ed7a3),{'verbose':_0x92d61b[_0x56d2e9(0x256)]}),_0x4c5d92=_0x3deedc[_0x56d2e9(0x13e)];return console[_0x56d2e9(0x188)](_0x56d2e9(0x26c)+_0x4c5d92[_0x56d2e9(0x12b)]+'\x27\x20with\x20ID:\x20'+_0x4c5d92['id']),await handleSDKOutput([_0x4c5d92],_0x92d61b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x131);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x1a8);async[a30_0x2f8a7f(0x292)](_0x3e4419){const _0xe96525=a30_0x2f8a7f,{options:_0x1b9dab,args:_0x17af35,tdx:_0x79d090}=_0x3e4419;console[_0xe96525(0x188)](_0xe96525(0x1f0)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xd803a8=_0x1b9dab;if(_0x17af35['length']===0x0)return console[_0xe96525(0x188)](a30_0x28e1b1[_0xe96525(0x21f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xe96525(0x188)](_0xe96525(0x236)),0x1;const _0x996462=_0x17af35[0x0];_0xd803a8['verbose']&&(console[_0xe96525(0x188)](_0xe96525(0x1b1)+_0xd803a8[_0xe96525(0x1f3)]),console[_0xe96525(0x188)]('Parent\x20segment:\x20'+_0x996462));const _0x2e1112=await withSpinner(_0xe96525(0x223)+_0x996462+_0xe96525(0x1e7),()=>_0x79d090[_0xe96525(0x255)]['getParentFull'](_0x996462),{'verbose':_0xd803a8[_0xe96525(0x256)]}),_0x5b5f58=_0x2e1112[_0xe96525(0x13e)],_0x1f50f9=await loadJSONFromOptions(_0xd803a8[_0xe96525(0x140)],_0xd803a8[_0xe96525(0x214)]),_0x5c9330=await loadJSONFromOptions(_0xd803a8[_0xe96525(0x291)],_0xd803a8['addBehaviorsFile']),_0x2a3e32={'name':_0x5b5f58[_0xe96525(0x12b)],'description':_0xd803a8[_0xe96525(0x29d)]!==undefined?_0xd803a8[_0xe96525(0x29d)]:_0x5b5f58[_0xe96525(0x29d)],'scheduleType':_0xd803a8[_0xe96525(0x14f)]!==undefined?_0xd803a8['scheduleType']:_0x5b5f58['scheduleType'],'scheduleOption':_0xd803a8[_0xe96525(0x1d2)]!==undefined?_0xd803a8[_0xe96525(0x1d2)]:_0x5b5f58[_0xe96525(0x1d2)],'timezone':_0xd803a8['timezone']!==undefined?_0xd803a8[_0xe96525(0x210)]:_0x5b5f58[_0xe96525(0x210)],'master':_0x5b5f58[_0xe96525(0x180)],'attributes':_0x1f50f9?[..._0x5b5f58['attributes']||[],..._0x1f50f9]:_0x5b5f58[_0xe96525(0x259)],'behaviors':_0x5c9330?[..._0x5b5f58[_0xe96525(0x19b)]||[],..._0x5c9330]:_0x5b5f58[_0xe96525(0x19b)],'customerGroup':_0x5b5f58[_0xe96525(0x199)]},_0x130184=await withSpinner(_0xe96525(0x22a)+_0x996462+_0xe96525(0x1e7),()=>_0x79d090[_0xe96525(0x255)][_0xe96525(0x17e)](_0x996462,_0x2a3e32),{'verbose':_0xd803a8[_0xe96525(0x256)]}),_0x3842fb=_0x130184['data'];return console[_0xe96525(0x188)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3842fb[_0xe96525(0x12b)]+'\x27'),await handleSDKOutput([_0x3842fb],_0xd803a8),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x1f1);['description']=a30_0x2f8a7f(0x19f);async[a30_0x2f8a7f(0x292)](_0x46df5d){const _0x53ac97=a30_0x2f8a7f,{options:_0x2f7293,args:_0x5cfcc1,tdx:_0x3cd078}=_0x46df5d,_0x1071d4=_0x2f7293,_0x220a0f=_0x5cfcc1[0x0]||_0x2f7293[_0x53ac97(0x262)];if(!_0x220a0f)return showParentSegmentNotSetError(_0x53ac97(0x172)+_0x53ac97(0x20f)),0x1;if(_0x1071d4['use']&&_0x1071d4['output'])return console['error'](a30_0x28e1b1['red'](_0x53ac97(0x17c))),console['error'](a30_0x28e1b1[_0x53ac97(0x260)](_0x53ac97(0x16d))),console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x260)](_0x53ac97(0x283)+PARENT_SEGMENT_DIR+_0x53ac97(0x1c5))),console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x1b2)](_0x53ac97(0x2aa))),0x1;const _0x4225ff=_0x1071d4['output']||a30_0x5a1aa1[_0x53ac97(0x231)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x220a0f)+_0x53ac97(0x122));_0x1071d4['verbose']&&(console['error']('Site:\x20'+_0x1071d4[_0x53ac97(0x1f3)]),console['error'](_0x53ac97(0x160)+_0x220a0f),console[_0x53ac97(0x188)]('Output\x20file:\x20'+_0x4225ff));const _0x1c9aef=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x220a0f+_0x53ac97(0x1e7),()=>_0x3cd078[_0x53ac97(0x255)][_0x53ac97(0x124)](_0x220a0f),{'verbose':_0x1071d4[_0x53ac97(0x256)]}),_0x29ed5f=_0x1c9aef['data'];if(existsSync(_0x4225ff)){const _0x432538=readFileSync(_0x4225ff,_0x53ac97(0x244)),_0xc37d00=generateDiff(_0x432538,_0x29ed5f);if(!hasChanges(_0xc37d00))console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x1bb)]('✔')+_0x53ac97(0x252)+a30_0x28e1b1['cyan'](_0x4225ff)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x53ac97(0x27b)+_0x4225ff+'\x27:'),console[_0x53ac97(0x188)]('─'[_0x53ac97(0x1e1)](0x3c)),console[_0x53ac97(0x188)](formatDiffWithColors(_0xc37d00)),console[_0x53ac97(0x188)]('─'['repeat'](0x3c));if(!_0x1071d4[_0x53ac97(0x1a3)]){if(!isInteractive())return console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x21f)]('\x0aError:'),_0x53ac97(0x14b)),console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x260)](_0x53ac97(0x26e))),0x1;const _0x2deecc=await confirmKey(_0x53ac97(0x156)+_0x4225ff+'\x27?');if(!_0x2deecc)return console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x138)]('Aborted.')),0x1;}writeFileSync(_0x4225ff,_0x29ed5f,_0x53ac97(0x244)),console['error'](a30_0x28e1b1[_0x53ac97(0x1bb)]('✔')+_0x53ac97(0x2a3)+a30_0x28e1b1['cyan'](_0x4225ff));}}else{const _0x15e908=a30_0x5a1aa1[_0x53ac97(0x1df)](_0x4225ff);!existsSync(_0x15e908)&&mkdirSync(_0x15e908,{'recursive':!![]}),writeFileSync(_0x4225ff,_0x29ed5f,_0x53ac97(0x244)),console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x1bb)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x28e1b1['cyan'](_0x4225ff));}return saveSessionContext({'parent_segment':_0x220a0f},_0x1071d4['session']),console[_0x53ac97(0x188)](a30_0x28e1b1[_0x53ac97(0x1bb)]('✔')+_0x53ac97(0x1f6)+a30_0x28e1b1[_0x53ac97(0x260)](_0x53ac97(0x123))+'\x20=\x20'+a30_0x28e1b1[_0x53ac97(0x1b2)](_0x220a0f)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x208);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x129);async[a30_0x2f8a7f(0x292)](_0x316fb6){const _0x8ec09b=a30_0x2f8a7f,{options:_0x18372a,args:_0x3a84e5,tdx:_0x5c9c82}=_0x316fb6,_0xc62f66=_0x18372a,_0x49ed3f=_0x3a84e5[0x0]||_0x18372a[_0x8ec09b(0x262)];if(!_0x49ed3f)return showParentSegmentNotSetError(_0x8ec09b(0x189)+_0x8ec09b(0x209)),0x1;const _0x25f71c=resolveYamlFile(_0x49ed3f);if(!existsSync(_0x25f71c))return showFileNotFoundError(_0x25f71c,_0x49ed3f),0x1;_0xc62f66[_0x8ec09b(0x256)]&&(console[_0x8ec09b(0x188)](_0x8ec09b(0x1b1)+_0xc62f66[_0x8ec09b(0x1f3)]),console[_0x8ec09b(0x188)](_0x8ec09b(0x1f5)+_0x25f71c));let _0x5f1cdb;try{_0x5f1cdb=readFileSync(_0x25f71c,_0x8ec09b(0x244));}catch(_0x5c056a){const _0x262ee9=_0x5c056a instanceof Error?_0x5c056a['message']:String(_0x5c056a);return console[_0x8ec09b(0x188)](_0x8ec09b(0x239)+_0x262ee9),0x1;}const _0x46f8c8=await withSpinner(_0x8ec09b(0x198),()=>_0x5c9c82[_0x8ec09b(0x255)][_0x8ec09b(0x26d)](_0x5f1cdb),{'verbose':_0xc62f66['verbose']}),_0x3a61ae=_0x46f8c8['data'],{isNew:_0x5b567d,name:_0x25da9c,hasChanges:_0x1fc2ab,diffFormatted:_0x244bfd}=_0x3a61ae;if(!_0x1fc2ab)return console[_0x8ec09b(0x188)]('✔\x20No\x20changes\x20-\x20\x27'+_0x25da9c+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x5b567d?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x25da9c+'\x27:'):console[_0x8ec09b(0x188)](_0x8ec09b(0x21a)+_0x25da9c+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x8ec09b(0x188)](_0x244bfd),console[_0x8ec09b(0x188)]('─'[_0x8ec09b(0x1e1)](0x3c));const _0x56e7c3=_0x5b567d?_0x8ec09b(0x285)+_0x25da9c+'\x27?':_0x8ec09b(0x1a2)+_0x25da9c+'\x27?';if(!_0xc62f66[_0x8ec09b(0x1a3)]){if(!isInteractive())return console[_0x8ec09b(0x188)](a30_0x28e1b1[_0x8ec09b(0x21f)](_0x8ec09b(0x1db)),_0x8ec09b(0x14b)),console[_0x8ec09b(0x188)](a30_0x28e1b1[_0x8ec09b(0x260)](_0x8ec09b(0x26e))),0x1;const _0x3974af=await confirmKey(_0x56e7c3);if(!_0x3974af)return console[_0x8ec09b(0x188)](a30_0x28e1b1['yellow'](_0x8ec09b(0x15f))),0x1;}const _0x523ec3=_0x5b567d?_0x8ec09b(0x1dd):_0x8ec09b(0x1be),_0xb8f2bb=await withSpinner(_0x523ec3+_0x8ec09b(0x21e)+_0x25da9c+'\x27...',()=>_0x3a61ae[_0x8ec09b(0x1ef)](),{'verbose':_0xc62f66[_0x8ec09b(0x256)]}),_0x1886eb=_0xb8f2bb[_0x8ec09b(0x13e)],_0x31a59b=getConsoleNextUrl(_0xc62f66['site'],_0x8ec09b(0x13b)+_0x1886eb['id']),_0x3ef2c1=_0x5b567d?_0x8ec09b(0x1fd):_0x8ec09b(0x1ca);return console['error']('✔\x20'+_0x3ef2c1+'\x20parent\x20segment\x20\x27'+_0x1886eb[_0x8ec09b(0x12b)]+'\x27'),console[_0x8ec09b(0x188)]('\x20\x20'+_0x31a59b),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x174);[a30_0x2f8a7f(0x29d)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x30dcff){const _0x42c9dc=a30_0x2f8a7f,{options:_0x8ee93a,args:_0x19acf8,tdx:_0x5737eb}=_0x30dcff,_0x2cbe4b=_0x8ee93a,_0x2dd0b8=_0x19acf8[0x0]||_0x8ee93a['parentSegment'];if(!_0x2dd0b8)return showParentSegmentNotSetError(_0x42c9dc(0x143)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x42c9dc(0x25d)+_0x42c9dc(0x1f2)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x42c9dc(0x1c3)),0x1;const _0x458c7a=resolveYamlFile(_0x2dd0b8);if(!existsSync(_0x458c7a))return showFileNotFoundError(_0x458c7a,_0x2dd0b8),0x1;_0x2cbe4b['verbose']&&(console[_0x42c9dc(0x188)]('Site:\x20'+_0x2cbe4b['site']),console[_0x42c9dc(0x188)]('YAML\x20file:\x20'+_0x458c7a));let _0x47e9b7;try{_0x47e9b7=readFileSync(_0x458c7a,'utf-8');}catch(_0x18d7a5){const _0x3a4139=_0x18d7a5 instanceof Error?_0x18d7a5[_0x42c9dc(0x178)]:String(_0x18d7a5);return console['error'](_0x42c9dc(0x239)+_0x3a4139),0x1;}const _0x58993f=createCommandSpinner(a30_0x28e1b1['dim'](_0x42c9dc(0x203)),{'verbose':_0x2cbe4b[_0x42c9dc(0x256)]});_0x58993f['start']();const _0x242cbd={'onProgress':_0x5bd7fb=>{const _0x691347=_0x42c9dc;_0x58993f[_0x691347(0x273)]=formatProgressMessage(_0x5bd7fb);}};if(_0x2cbe4b[_0x42c9dc(0x180)])_0x242cbd[_0x42c9dc(0x180)]=!![];if(_0x2cbe4b['enriched'])_0x242cbd[_0x42c9dc(0x28e)]=!![];_0x2cbe4b[_0x42c9dc(0x250)]&&(_0x242cbd['attribute']=_0x2cbe4b['attribute']);_0x2cbe4b[_0x42c9dc(0x1f9)]&&(_0x242cbd[_0x42c9dc(0x1f9)]=_0x2cbe4b[_0x42c9dc(0x1f9)]);if(_0x2cbe4b[_0x42c9dc(0x170)])_0x242cbd['interval']=_0x2cbe4b[_0x42c9dc(0x170)];let _0x1fa5a1;try{_0x1fa5a1=await _0x5737eb[_0x42c9dc(0x255)][_0x42c9dc(0x1cc)](_0x47e9b7,_0x242cbd),_0x58993f[_0x42c9dc(0x21b)]();}catch(_0x576cac){_0x58993f[_0x42c9dc(0x21b)]();throw _0x576cac;}const _0x2756d8=_0x2cbe4b[_0x42c9dc(0x170)]||'-1d';return this[_0x42c9dc(0x28a)](_0x1fa5a1,_0x242cbd,_0x458c7a,_0x2756d8),_0x1fa5a1[_0x42c9dc(0x240)]?0x0:0x1;}['displayValidateResults'](_0x5e1ea5,_0x2189b6,_0x55b889,_0x37c490){const _0x2d68ef=a30_0x2f8a7f;console[_0x2d68ef(0x188)]('\x0a'+a30_0x28e1b1['bold'](_0x2d68ef(0x1d8))+'\x20'+_0x5e1ea5[_0x2d68ef(0x12b)]),console[_0x2d68ef(0x188)]('═'[_0x2d68ef(0x1e1)](0x3c)),this[_0x2d68ef(0x20c)](_0x5e1ea5);if(typeof _0x2189b6['attribute']===_0x2d68ef(0x1a6)){this[_0x2d68ef(0x297)](_0x5e1ea5),this[_0x2d68ef(0x133)](_0x5e1ea5),this[_0x2d68ef(0x246)](_0x55b889,_0x37c490,_0x2d68ef(0x250),_0x2189b6['attribute']);return;}if(_0x2189b6['attribute']===!![]){this[_0x2d68ef(0x297)](_0x5e1ea5),this[_0x2d68ef(0x133)](_0x5e1ea5),this[_0x2d68ef(0x246)](_0x55b889,_0x37c490,'attributes');return;}if(typeof _0x2189b6[_0x2d68ef(0x1f9)]==='string'){this['displayBehaviorsStats'](_0x5e1ea5,_0x37c490),this[_0x2d68ef(0x133)](_0x5e1ea5),this[_0x2d68ef(0x246)](_0x55b889,_0x37c490,_0x2d68ef(0x1f9),_0x2189b6[_0x2d68ef(0x1f9)]);return;}if(_0x2189b6[_0x2d68ef(0x1f9)]===!![]){this[_0x2d68ef(0x17a)](_0x5e1ea5,_0x37c490),this[_0x2d68ef(0x133)](_0x5e1ea5),this[_0x2d68ef(0x246)](_0x55b889,_0x37c490,_0x2d68ef(0x19b));return;}this[_0x2d68ef(0x297)](_0x5e1ea5),this[_0x2d68ef(0x17a)](_0x5e1ea5,_0x37c490),this[_0x2d68ef(0x1d1)](_0x5e1ea5),this['displaySummary'](_0x5e1ea5),this['displayPreviewHints'](_0x55b889,_0x37c490,_0x2d68ef(0x219));}[a30_0x2f8a7f(0x1d1)](_0x3da6cf){displayRealtimeValidation(_0x3da6cf);}[a30_0x2f8a7f(0x246)](_0x5dff47,_0xb1c4fd,_0x536c7e,_0x339478){const _0x26659f=a30_0x2f8a7f;console['error']('\x0a'+a30_0x28e1b1[_0x26659f(0x260)]('To\x20view\x20sample\x20data:'));const _0xad3b02=_0xb1c4fd!==_0x26659f(0x12f)?'\x20--interval\x20'+_0xb1c4fd:'';if(_0x536c7e===_0x26659f(0x250)&&_0x339478)console[_0x26659f(0x188)]('\x20\x20'+a30_0x28e1b1[_0x26659f(0x260)]('tdx\x20ps\x20preview\x20'+_0x5dff47+_0x26659f(0x243)+_0x339478+'\x22'+_0xad3b02));else{if(_0x536c7e===_0x26659f(0x1f9)&&_0x339478)console[_0x26659f(0x188)]('\x20\x20'+a30_0x28e1b1[_0x26659f(0x260)](_0x26659f(0x18b)+_0x5dff47+_0x26659f(0x1c6)+_0x339478+'\x22'+_0xad3b02));else(_0x536c7e===_0x26659f(0x259)||_0x536c7e===_0x26659f(0x219))&&console['error']('\x20\x20'+a30_0x28e1b1['dim'](_0x26659f(0x18b)+_0x5dff47+_0x26659f(0x1de)+_0xad3b02));}(_0x536c7e==='behaviors'||_0x536c7e===_0x26659f(0x219))&&console[_0x26659f(0x188)]('\x20\x20'+a30_0x28e1b1[_0x26659f(0x260)]('tdx\x20ps\x20preview\x20'+_0x5dff47+_0x26659f(0x18d)+_0xad3b02)),_0x536c7e===_0x26659f(0x219)&&console['error']('\x20\x20'+a30_0x28e1b1['dim'](_0x26659f(0x18b)+_0x5dff47+_0x26659f(0x181)+_0xad3b02));}[a30_0x2f8a7f(0x20c)](_0x1d7159){const _0xed05c3=a30_0x2f8a7f,{master:_0x11c351}=_0x1d7159,_0x6f7cce=_0x11c351['schemaValid']?a30_0x28e1b1['green']('✔'):a30_0x28e1b1['red']('✘');console[_0xed05c3(0x188)]('\x0a'+a30_0x28e1b1[_0xed05c3(0x260)]('Master\x20Table')),console[_0xed05c3(0x188)](_0x6f7cce+'\x20'+a30_0x28e1b1['bold'](_0x11c351['database']+'.'+_0x11c351['table'])),_0x11c351[_0xed05c3(0x2a4)]?_0x11c351[_0xed05c3(0x1bf)]!==undefined&&console[_0xed05c3(0x188)]('\x20\x20'+a30_0x28e1b1[_0xed05c3(0x260)]('Rows:')+'\x20'+a30_0x28e1b1['cyan'](formatRows(_0x11c351[_0xed05c3(0x1bf)]))):console[_0xed05c3(0x188)]('\x20\x20'+a30_0x28e1b1[_0xed05c3(0x21f)]('Error:')+'\x20'+_0x11c351[_0xed05c3(0x248)]);}[a30_0x2f8a7f(0x297)](_0xea942){const _0x99e33b=a30_0x2f8a7f;if(_0xea942[_0x99e33b(0x259)][_0x99e33b(0x294)]===0x0)return;console[_0x99e33b(0x188)]('\x0a'+a30_0x28e1b1['dim'](_0x99e33b(0x28b)));for(const _0x38be30 of _0xea942[_0x99e33b(0x259)]){const _0x36fd22=_0x38be30[_0x99e33b(0x2a4)]?a30_0x28e1b1[_0x99e33b(0x1bb)]('✔'):a30_0x28e1b1[_0x99e33b(0x21f)]('✘');let _0x3cf6eb='';if(_0x38be30[_0x99e33b(0x2a4)]&&_0x38be30[_0x99e33b(0x1aa)]!==undefined&&_0x38be30[_0x99e33b(0x25f)]!==undefined){const _0x540bf9=_0x38be30[_0x99e33b(0x25f)]['toFixed'](0x1),_0x4c8f9b=_0x38be30[_0x99e33b(0x25f)]>=0x50?a30_0x28e1b1[_0x99e33b(0x1bb)]:_0x38be30[_0x99e33b(0x25f)]>=0x32?a30_0x28e1b1[_0x99e33b(0x138)]:a30_0x28e1b1[_0x99e33b(0x21f)];_0x3cf6eb='\x20'+a30_0x28e1b1['dim'](_0x99e33b(0x2ae))+'\x20'+_0x4c8f9b(_0x540bf9+'%')+'\x20('+formatRows(_0x38be30[_0x99e33b(0x1aa)])+_0x99e33b(0x288);}console['error'](_0x36fd22+'\x20'+a30_0x28e1b1[_0x99e33b(0x12a)](_0x38be30[_0x99e33b(0x12b)])+_0x3cf6eb),console[_0x99e33b(0x188)]('\x20\x20'+a30_0x28e1b1[_0x99e33b(0x260)](_0x99e33b(0x14e))+'\x20'+a30_0x28e1b1[_0x99e33b(0x12a)](_0x38be30[_0x99e33b(0x27d)]+'.'+_0x38be30[_0x99e33b(0x23a)]));const _0x35a7e4=_0x38be30[_0x99e33b(0x163)]===_0x38be30[_0x99e33b(0x15d)]?a30_0x28e1b1[_0x99e33b(0x260)](_0x99e33b(0x29e))+'\x20'+_0x38be30['joinKey']:a30_0x28e1b1[_0x99e33b(0x260)](_0x99e33b(0x296))+'\x20'+_0x38be30[_0x99e33b(0x163)]+'\x20=\x20'+_0x38be30['foreignKey'];console['error']('\x20\x20'+_0x35a7e4),console[_0x99e33b(0x188)]('\x20\x20'+a30_0x28e1b1[_0x99e33b(0x260)](_0x99e33b(0x211))),this['displayColumns'](_0x38be30['columns']),!_0x38be30[_0x99e33b(0x2a4)]&&console[_0x99e33b(0x188)]('\x20\x20'+a30_0x28e1b1[_0x99e33b(0x21f)]('Error:')+'\x20'+_0x38be30['schemaError']);}}[a30_0x2f8a7f(0x17a)](_0x57379a,_0x2fe940){const _0x3e739b=a30_0x2f8a7f;if(_0x57379a[_0x3e739b(0x19b)][_0x3e739b(0x294)]===0x0)return;console[_0x3e739b(0x188)]('\x0a'+a30_0x28e1b1[_0x3e739b(0x260)](_0x3e739b(0x217))+'\x20'+a30_0x28e1b1['dim']('('+_0x2fe940+')'));for(const _0x9dfad6 of _0x57379a[_0x3e739b(0x19b)]){const _0x554803=_0x9dfad6[_0x3e739b(0x2a4)]?a30_0x28e1b1[_0x3e739b(0x1bb)]('✔'):a30_0x28e1b1[_0x3e739b(0x21f)]('✘');let _0x256188='';if(_0x9dfad6[_0x3e739b(0x2a4)]&&_0x9dfad6[_0x3e739b(0x149)]!==undefined&&_0x9dfad6[_0x3e739b(0x168)]!==undefined){const _0x5e2289=_0x9dfad6[_0x3e739b(0x19c)]?.[_0x3e739b(0x1fb)](0x1)||'?',_0x5a41c8=(_0x9dfad6[_0x3e739b(0x19c)]??0x0)>=0x32?a30_0x28e1b1['green']:(_0x9dfad6[_0x3e739b(0x19c)]??0x0)>=0x14?a30_0x28e1b1[_0x3e739b(0x138)]:a30_0x28e1b1[_0x3e739b(0x21f)];_0x256188='\x20'+a30_0x28e1b1[_0x3e739b(0x260)]('Customers:')+'\x20'+_0x5a41c8(formatRows(_0x9dfad6[_0x3e739b(0x149)]))+'\x20('+_0x5e2289+'%)\x20'+a30_0x28e1b1[_0x3e739b(0x260)](_0x3e739b(0x242))+'\x20'+a30_0x28e1b1[_0x3e739b(0x1b2)](formatRows(_0x9dfad6[_0x3e739b(0x168)]));}console['error'](_0x554803+'\x20'+a30_0x28e1b1['bold'](_0x9dfad6[_0x3e739b(0x12b)])+_0x256188),console[_0x3e739b(0x188)]('\x20\x20'+a30_0x28e1b1[_0x3e739b(0x260)](_0x3e739b(0x14e))+'\x20'+a30_0x28e1b1[_0x3e739b(0x12a)](_0x9dfad6[_0x3e739b(0x27d)]+'.'+_0x9dfad6[_0x3e739b(0x23a)]));const _0x4a9057=_0x9dfad6['joinKey']===_0x9dfad6['foreignKey']?a30_0x28e1b1['dim'](_0x3e739b(0x29e))+'\x20'+_0x9dfad6[_0x3e739b(0x163)]:a30_0x28e1b1[_0x3e739b(0x260)](_0x3e739b(0x296))+'\x20'+_0x9dfad6[_0x3e739b(0x163)]+_0x3e739b(0x1ce)+_0x9dfad6[_0x3e739b(0x15d)];console[_0x3e739b(0x188)]('\x20\x20'+_0x4a9057),console[_0x3e739b(0x188)]('\x20\x20'+a30_0x28e1b1[_0x3e739b(0x260)](_0x3e739b(0x211))),this[_0x3e739b(0x1a5)](_0x9dfad6[_0x3e739b(0x18f)]),!_0x9dfad6[_0x3e739b(0x2a4)]&&console['error']('\x20\x20'+a30_0x28e1b1[_0x3e739b(0x21f)](_0x3e739b(0x23c))+'\x20'+_0x9dfad6[_0x3e739b(0x248)]);}}[a30_0x2f8a7f(0x1a5)](_0x5c8f08){const _0x4bd9f7=a30_0x2f8a7f;for(const _0x46db89 of _0x5c8f08){_0x46db89[_0x4bd9f7(0x1d9)]===_0x46db89['column']||_0x46db89[_0x4bd9f7(0x177)]==='*'?console[_0x4bd9f7(0x188)](_0x4bd9f7(0x24e)+_0x46db89[_0x4bd9f7(0x1d9)]):console[_0x4bd9f7(0x188)](_0x4bd9f7(0x24e)+_0x46db89[_0x4bd9f7(0x1d9)]+'\x20'+a30_0x28e1b1[_0x4bd9f7(0x260)]('('+_0x46db89[_0x4bd9f7(0x177)]+')'));}}['displaySummary'](_0x39bfc4){const _0x381960=a30_0x2f8a7f;console['error']('─'['repeat'](0x3c));if(_0x39bfc4['errors'][_0x381960(0x294)]>0x0){console['error']('\x0a'+a30_0x28e1b1['red'](_0x381960(0x2a5)));for(const _0x4b3361 of _0x39bfc4['errors']){console[_0x381960(0x188)]('\x20\x20'+a30_0x28e1b1[_0x381960(0x21f)]('•')+'\x20'+_0x4b3361);}}_0x39bfc4['allValid']&&console['error']('\x0a'+a30_0x28e1b1['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x24a);['description']=a30_0x2f8a7f(0x232);async[a30_0x2f8a7f(0x292)](_0x4e3c09){const _0x50c7d0=a30_0x2f8a7f,{options:_0x29993d,args:_0x330de2,tdx:_0x5b71be}=_0x4e3c09,_0x4d294d=_0x29993d,_0x4cc7f2=_0x330de2[0x0]||_0x29993d['parentSegment'];if(!_0x4cc7f2)return showParentSegmentNotSetError(_0x50c7d0(0x164)+_0x50c7d0(0x121)+'Options\x20(one\x20required):\x0a'+_0x50c7d0(0x28f)+_0x50c7d0(0x2a7)+_0x50c7d0(0x20e)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x4d294d[_0x50c7d0(0x180)]&&!_0x4d294d['attribute']&&!_0x4d294d[_0x50c7d0(0x1f9)]&&!_0x4d294d['enriched'])return console['error'](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x120))),console[_0x50c7d0(0x188)](_0x50c7d0(0x1ab)),console[_0x50c7d0(0x188)](_0x50c7d0(0x21c)),console['error'](_0x50c7d0(0x25a)),console[_0x50c7d0(0x188)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x50c7d0(0x188)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x50c7d0(0x13c)),0x1;const _0x399968=resolveYamlFile(_0x4cc7f2);if(!existsSync(_0x399968))return showFileNotFoundError(_0x399968,_0x4cc7f2),0x1;_0x4d294d[_0x50c7d0(0x256)]&&(console[_0x50c7d0(0x188)](_0x50c7d0(0x1b1)+_0x4d294d[_0x50c7d0(0x1f3)]),console[_0x50c7d0(0x188)](_0x50c7d0(0x1f5)+_0x399968));let _0x24078e;try{_0x24078e=readFileSync(_0x399968,_0x50c7d0(0x244));}catch(_0x3d2d1c){const _0x1d3a90=_0x3d2d1c instanceof Error?_0x3d2d1c[_0x50c7d0(0x178)]:String(_0x3d2d1c);return console[_0x50c7d0(0x188)](_0x50c7d0(0x239)+_0x1d3a90),0x1;}let _0x430225;try{_0x430225=parseDef(_0x24078e);}catch(_0x217b98){const _0x7ecc1d=_0x217b98 instanceof Error?_0x217b98['message']:String(_0x217b98);return console[_0x50c7d0(0x188)](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x1ba)+_0x7ecc1d)),0x1;}if(_0x4d294d['attribute']===!![]||_0x4d294d[_0x50c7d0(0x250)]===''){const _0x1757f2=_0x430225[_0x50c7d0(0x259)]?.[_0x50c7d0(0x1f8)](_0x3bb12c=>_0x3bb12c[_0x50c7d0(0x12b)])||[];if(_0x1757f2['length']===0x0)console[_0x50c7d0(0x188)](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x141)));else{console[_0x50c7d0(0x188)](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x1af))),console[_0x50c7d0(0x188)]('Available\x20attributes:');for(const _0x2ae76a of _0x1757f2){console[_0x50c7d0(0x188)]('\x20\x20'+a30_0x28e1b1[_0x50c7d0(0x1b2)](_0x2ae76a));}console[_0x50c7d0(0x188)](_0x50c7d0(0x286)+_0x4cc7f2+'\x20--attribute\x20\x22'+_0x1757f2[0x0]+'\x22');}return 0x1;}if(_0x4d294d['behavior']===!![]||_0x4d294d['behavior']===''){const _0x2c364a=_0x430225[_0x50c7d0(0x19b)]?.[_0x50c7d0(0x1f8)](_0x2565bb=>_0x2565bb['name'])||[];if(_0x2c364a[_0x50c7d0(0x294)]===0x0)console[_0x50c7d0(0x188)](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x23d)));else{console[_0x50c7d0(0x188)](a30_0x28e1b1[_0x50c7d0(0x21f)](_0x50c7d0(0x1d4))),console[_0x50c7d0(0x188)](_0x50c7d0(0x299));for(const _0x11d615 of _0x2c364a){console[_0x50c7d0(0x188)]('\x20\x20'+a30_0x28e1b1[_0x50c7d0(0x1b2)](_0x11d615));}console[_0x50c7d0(0x188)](_0x50c7d0(0x286)+_0x4cc7f2+_0x50c7d0(0x1c6)+_0x2c364a[0x0]+'\x22');}return 0x1;}const _0x2fc9fe=createCommandSpinner(a30_0x28e1b1['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x4d294d[_0x50c7d0(0x256)]});_0x2fc9fe[_0x50c7d0(0x1eb)]();const _0x3fecf5={'onProgress':_0x2a0663=>{const _0x22d608=_0x50c7d0;_0x2fc9fe[_0x22d608(0x273)]=formatProgressMessage(_0x2a0663);}};if(_0x4d294d['master'])_0x3fecf5[_0x50c7d0(0x180)]=!![];if(_0x4d294d[_0x50c7d0(0x250)]&&typeof _0x4d294d['attribute']==='string')_0x3fecf5[_0x50c7d0(0x250)]=_0x4d294d[_0x50c7d0(0x250)];if(_0x4d294d['behavior']&&typeof _0x4d294d[_0x50c7d0(0x1f9)]===_0x50c7d0(0x1a6))_0x3fecf5[_0x50c7d0(0x1f9)]=_0x4d294d[_0x50c7d0(0x1f9)];if(_0x4d294d[_0x50c7d0(0x28e)])_0x3fecf5[_0x50c7d0(0x28e)]=!![];if(_0x4d294d[_0x50c7d0(0x170)])_0x3fecf5['interval']=_0x4d294d[_0x50c7d0(0x170)];let _0x165fbe;try{_0x165fbe=await _0x5b71be[_0x50c7d0(0x255)][_0x50c7d0(0x1b5)](_0x24078e,_0x3fecf5),_0x2fc9fe['stop']();}catch(_0x1db6f3){_0x2fc9fe[_0x50c7d0(0x21b)]();throw _0x1db6f3;}return await this[_0x50c7d0(0x277)](_0x165fbe,{'master':_0x4d294d[_0x50c7d0(0x180)],'attribute':typeof _0x4d294d[_0x50c7d0(0x250)]===_0x50c7d0(0x1a6)?_0x4d294d['attribute']:undefined,'behavior':typeof _0x4d294d[_0x50c7d0(0x1f9)]===_0x50c7d0(0x1a6)?_0x4d294d[_0x50c7d0(0x1f9)]:undefined,'enriched':_0x4d294d[_0x50c7d0(0x28e)]}),_0x165fbe[_0x50c7d0(0x240)]?0x0:0x1;}async['displayPreviewResults'](_0x32bd40,_0x4ba8a1){const _0x1a91ee=a30_0x2f8a7f;console[_0x1a91ee(0x188)]('\x0a'+a30_0x28e1b1[_0x1a91ee(0x12a)]('Preview:')+'\x20'+_0x32bd40[_0x1a91ee(0x12b)]),console['error']('═'[_0x1a91ee(0x1e1)](0x3c));if(_0x4ba8a1[_0x1a91ee(0x180)]&&_0x32bd40[_0x1a91ee(0x27c)]){const _0x53a47d=a30_0x28e1b1[_0x1a91ee(0x260)](_0x1a91ee(0x20b))+'\x20'+a30_0x28e1b1[_0x1a91ee(0x12a)](_0x32bd40[_0x1a91ee(0x180)][_0x1a91ee(0x27d)]+'.'+_0x32bd40['master'][_0x1a91ee(0x23a)]);await this[_0x1a91ee(0x29a)](_0x53a47d,_0x32bd40[_0x1a91ee(0x27c)]);}else{if(_0x4ba8a1[_0x1a91ee(0x250)]&&_0x32bd40[_0x1a91ee(0x27c)]){const _0x123ba0=a30_0x28e1b1[_0x1a91ee(0x260)]('Attribute:')+'\x20'+a30_0x28e1b1[_0x1a91ee(0x12a)](_0x4ba8a1['attribute']);await this[_0x1a91ee(0x29a)](_0x123ba0,_0x32bd40[_0x1a91ee(0x27c)]);}else{if(_0x4ba8a1[_0x1a91ee(0x1f9)]&&_0x32bd40[_0x1a91ee(0x27c)]){const _0x5b2c57=a30_0x28e1b1[_0x1a91ee(0x260)](_0x1a91ee(0x1e0))+'\x20'+a30_0x28e1b1[_0x1a91ee(0x12a)](_0x4ba8a1['behavior']);await this['displaySampleData'](_0x5b2c57,_0x32bd40[_0x1a91ee(0x27c)]);}else{if(_0x4ba8a1[_0x1a91ee(0x28e)]&&_0x32bd40[_0x1a91ee(0x27c)]){const _0x3d4f59=a30_0x28e1b1[_0x1a91ee(0x260)](_0x1a91ee(0x128))+'\x20'+a30_0x28e1b1[_0x1a91ee(0x12a)](_0x1a91ee(0x1d3));await this['displaySampleData'](_0x3d4f59,_0x32bd40[_0x1a91ee(0x27c)]);}else!_0x32bd40[_0x1a91ee(0x27c)]&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x32bd40[_0x1a91ee(0x23e)][_0x1a91ee(0x294)]>0x0){console[_0x1a91ee(0x188)]('─'['repeat'](0x3c)),console[_0x1a91ee(0x188)]('\x0a'+a30_0x28e1b1[_0x1a91ee(0x21f)](_0x1a91ee(0x2a5)));for(const _0x48de69 of _0x32bd40[_0x1a91ee(0x23e)]){console['error']('\x20\x20'+a30_0x28e1b1[_0x1a91ee(0x21f)]('•')+'\x20'+_0x48de69);}}}async[a30_0x2f8a7f(0x29a)](_0x554ed6,_0x2ea03d){const _0x32bb8e=a30_0x2f8a7f;if(_0x2ea03d['length']===0x0){console[_0x32bb8e(0x188)]('\x0a'+_0x554ed6),console[_0x32bb8e(0x188)](_0x32bb8e(0x15a));return;}console['error']('\x0a'+_0x554ed6);const _0x34e11f=Object[_0x32bb8e(0x12d)](_0x2ea03d[0x0])[_0x32bb8e(0x1f8)](_0x320203=>({'name':_0x320203,'type':typeof _0x2ea03d[0x0][_0x320203]===_0x32bb8e(0x18e)?_0x32bb8e(0x1a4):_0x32bb8e(0x268)})),_0x1f294f={'queryId':_0x32bb8e(0x1a1),'columns':_0x34e11f,'data':_0x2ea03d,'stats':{'state':_0x32bb8e(0x191),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2ea03d[_0x32bb8e(0x294)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0xd96f97=formatAsTable(_0x1f294f,_0x2ea03d[_0x32bb8e(0x294)],!![]);await writeOutput(_0xd96f97,undefined,_0x32bb8e(0x23a));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]='segment:parent:run';[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x134);async[a30_0x2f8a7f(0x292)](_0x378764){const _0x5e42e5=a30_0x2f8a7f,{options:_0x325c10,args:_0x45f1c4,tdx:_0x18aeed}=_0x378764,_0x5805b0=_0x325c10,_0x431295=_0x45f1c4[0x0]||_0x325c10['parentSegment'];if(!_0x431295)return showParentSegmentNotSetError(_0x5e42e5(0x135)+_0x5e42e5(0x182)),0x1;const _0x45b0f3=resolveYamlFile(_0x431295);if(existsSync(_0x45b0f3)){_0x5805b0[_0x5e42e5(0x256)]&&console[_0x5e42e5(0x188)]('Found\x20YAML\x20file:\x20'+_0x45b0f3);let _0x4fe493;try{_0x4fe493=readFileSync(_0x45b0f3,_0x5e42e5(0x244));}catch(_0x26f4a7){const _0x3332b8=_0x26f4a7 instanceof Error?_0x26f4a7[_0x5e42e5(0x178)]:String(_0x26f4a7);return console[_0x5e42e5(0x188)](_0x5e42e5(0x239)+_0x3332b8),0x1;}const _0x10d02c=await withSpinner('Analyzing\x20changes...',()=>_0x18aeed[_0x5e42e5(0x255)][_0x5e42e5(0x26d)](_0x4fe493),{'verbose':_0x5805b0[_0x5e42e5(0x256)]}),_0x3c6afb=_0x10d02c[_0x5e42e5(0x13e)],{isNew:_0x3cfeb9,name:_0x2e2627,hasChanges:_0x5de7e0,diffFormatted:_0xdf39c4}=_0x3c6afb;if(_0x5de7e0){_0x3cfeb9?console[_0x5e42e5(0x188)](_0x5e42e5(0x192)+_0x2e2627+'\x27:'):console['error'](_0x5e42e5(0x21a)+_0x2e2627+'\x27:');console[_0x5e42e5(0x188)]('─'[_0x5e42e5(0x1e1)](0x3c)),console[_0x5e42e5(0x188)](_0xdf39c4),console[_0x5e42e5(0x188)]('─'[_0x5e42e5(0x1e1)](0x3c));const _0x3e7eb7=_0x3cfeb9?_0x5e42e5(0x285)+_0x2e2627+_0x5e42e5(0x150):_0x5e42e5(0x1a2)+_0x2e2627+'\x27\x20and\x20run\x20workflow?';if(!_0x5805b0['yes']){if(!isInteractive())return console[_0x5e42e5(0x188)](a30_0x28e1b1[_0x5e42e5(0x21f)](_0x5e42e5(0x1db)),_0x5e42e5(0x14b)),console[_0x5e42e5(0x188)](a30_0x28e1b1['dim'](_0x5e42e5(0x26e))),0x1;const _0x27f25e=await confirmKey(_0x3e7eb7);if(!_0x27f25e)return console[_0x5e42e5(0x188)](a30_0x28e1b1[_0x5e42e5(0x138)]('Aborted.')),0x1;}const _0xe222d1=_0x3cfeb9?_0x5e42e5(0x1dd):_0x5e42e5(0x1be);await withSpinner(_0xe222d1+_0x5e42e5(0x21e)+_0x2e2627+_0x5e42e5(0x1e7),()=>_0x3c6afb[_0x5e42e5(0x1ef)](),{'verbose':_0x5805b0[_0x5e42e5(0x256)]});const _0x15c328=_0x3cfeb9?'Created':_0x5e42e5(0x1ca);console['error']('✔\x20'+_0x15c328+_0x5e42e5(0x21e)+_0x2e2627+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x2e2627+'\x27\x20is\x20up\x20to\x20date');}const _0x52d542=await withSpinner(_0x5e42e5(0x23f)+_0x431295+'\x27...',()=>_0x18aeed[_0x5e42e5(0x255)][_0x5e42e5(0x220)](_0x431295),{'verbose':_0x5805b0[_0x5e42e5(0x256)]}),_0x48f1ff=_0x52d542[_0x5e42e5(0x13e)],_0x462128=getConsoleUrl(_0x5805b0[_0x5e42e5(0x1f3)],_0x5e42e5(0x205)+_0x48f1ff['workflowId']+_0x5e42e5(0x21d)+_0x48f1ff[_0x5e42e5(0x1ad)]+_0x5e42e5(0x145)+_0x48f1ff[_0x5e42e5(0x25e)]);return console[_0x5e42e5(0x188)](_0x5e42e5(0x29b)),console[_0x5e42e5(0x188)]('\x20\x20'+a30_0x28e1b1[_0x5e42e5(0x260)](_0x5e42e5(0x2a6))+'\x20'+_0x48f1ff[_0x5e42e5(0x184)]),console[_0x5e42e5(0x188)]('\x20\x20'+a30_0x28e1b1['dim'](_0x5e42e5(0x171))+'\x20'+_0x48f1ff[_0x5e42e5(0x224)]),console[_0x5e42e5(0x188)]('\x20\x20'+a30_0x28e1b1[_0x5e42e5(0x260)](_0x5e42e5(0x154))+'\x20'+_0x48f1ff['workflowSessionId']),console[_0x5e42e5(0x188)]('\x20\x20'+a30_0x28e1b1['dim'](_0x5e42e5(0x264))+'\x20'+_0x48f1ff[_0x5e42e5(0x25e)]),console[_0x5e42e5(0x188)]('\x20\x20'+_0x462128),console[_0x5e42e5(0x188)]('\x0a'+a30_0x28e1b1['dim'](_0x5e42e5(0x1d7))+_0x5e42e5(0x1c1)+_0x48f1ff[_0x5e42e5(0x25e)]+_0x5e42e5(0x22c)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]='segment:parent:fields';[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x1d5);async[a30_0x2f8a7f(0x292)](_0x66fa5){const _0x2d4bfb=a30_0x2f8a7f,{options:_0x219f2e,args:_0x505be0,tdx:_0xee0b98}=_0x66fa5,_0x43092b=_0x505be0[0x0]||_0x219f2e[_0x2d4bfb(0x262)];if(!_0x43092b)return showParentSegmentNotSetError(_0x2d4bfb(0x18a)+_0x2d4bfb(0x175)),0x1;_0x219f2e[_0x2d4bfb(0x256)]&&(console['error'](_0x2d4bfb(0x1b1)+_0x219f2e['site']),console[_0x2d4bfb(0x188)](_0x2d4bfb(0x160)+_0x43092b));const _0x2b95ae=await withSpinner(_0x2d4bfb(0x213)+_0x43092b+_0x2d4bfb(0x1e7),()=>_0xee0b98['segment'][_0x2d4bfb(0x18c)](_0x43092b),{'verbose':_0x219f2e[_0x2d4bfb(0x256)]}),_0x52f968=_0x2b95ae[_0x2d4bfb(0x13e)];console[_0x2d4bfb(0x188)](_0x2d4bfb(0x13d)+_0x52f968['length']+_0x2d4bfb(0x1bc)+(_0x52f968[_0x2d4bfb(0x294)]!==0x1?'s':''));if(_0x219f2e[_0x2d4bfb(0x1e2)]||_0x219f2e['jsonl'])return await handleSDKOutput(_0x52f968,_0x219f2e),0x0;return displayFieldsHumanReadable(_0x52f968,_0x43092b),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a30_0x2f8a7f(0x27a);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x298);async[a30_0x2f8a7f(0x292)](_0x3a4be8){const _0x52f47b=a30_0x2f8a7f,{options:_0x4ae425,args:_0x3e0c49,tdx:_0x41f225}=_0x3a4be8,_0xaf1514=_0x4ae425,_0x5ef515=_0x3e0c49[0x0]||_0x4ae425['parentSegment'];if(!_0x5ef515)return showParentSegmentNotSetError(_0x52f47b(0x15c)+_0x52f47b(0x19d)+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x4ae425[_0x52f47b(0x256)]&&(console['error'](_0x52f47b(0x1b1)+_0x4ae425[_0x52f47b(0x1f3)]),console['error'](_0x52f47b(0x160)+_0x5ef515));const _0x1def49=await withSpinner(_0x52f47b(0x221)+_0x5ef515+'\x27...',()=>_0x41f225[_0x52f47b(0x255)][_0x52f47b(0x125)](_0x5ef515),{'verbose':_0x4ae425[_0x52f47b(0x256)]}),_0x53ef15=_0x1def49[_0x52f47b(0x13e)];if(_0xaf1514[_0x52f47b(0x166)]){const _0x2d659a=getConsoleNextUrl(_0xaf1514['site'],'/app/dw/parentSegments/'+_0x53ef15['id']);return console['error'](a30_0x28e1b1[_0x52f47b(0x1bb)]('✔')+_0x52f47b(0x190)+a30_0x28e1b1[_0x52f47b(0x1b2)](_0x2d659a)),openBrowser(_0x2d659a),0x0;}return await handleSingleObjectOutput(_0x53ef15,_0x4ae425),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x16e);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x1bd);async[a30_0x2f8a7f(0x292)](_0x2c1268){const _0x3588f4=a30_0x2f8a7f,{options:_0x444971,args:_0x2429e2,tdx:_0x17b7d9}=_0x2c1268,_0x5ba965=_0x444971,_0x21b608=_0x2429e2[0x0]||_0x444971[_0x3588f4(0x262)];if(!_0x21b608)return showParentSegmentNotSetError(_0x3588f4(0x290)+'\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'+_0x3588f4(0x25d)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x444971[_0x3588f4(0x256)]&&(console[_0x3588f4(0x188)]('Site:\x20'+_0x444971[_0x3588f4(0x1f3)]),console[_0x3588f4(0x188)]('Parent\x20segment:\x20'+_0x21b608));const _0x2b2c33=await withSpinner(_0x3588f4(0x215)+_0x21b608+_0x3588f4(0x1e7),()=>_0x17b7d9['segment'][_0x3588f4(0x173)](_0x21b608),{'verbose':_0x444971['verbose']}),_0x53c8af=_0x2b2c33[_0x3588f4(0x13e)],_0x3672c3=_0x17b7d9['segment']['getOutputDatabaseName'](_0x53c8af);if(_0x5ba965[_0x3588f4(0x167)]){const _0x5758a0=await this[_0x3588f4(0x1c4)](_0x2c1268,_0x21b608,_0x53c8af,_0x3672c3),_0x4128c0=this['formatSchemaJson'](_0x5758a0);writeFileSync(_0x5ba965[_0x3588f4(0x167)],_0x4128c0);const _0x5c2fb4=_0x5758a0[_0x3588f4(0x1d6)][_0x3588f4(0x18f)]['length']+_0x5758a0['behaviors'][_0x3588f4(0x212)]((_0x1a2b71,_0x43dfe1)=>_0x1a2b71+_0x43dfe1[_0x3588f4(0x18f)][_0x3588f4(0x294)],0x0),_0x12dd6e=_0x5758a0['behaviors'][_0x3588f4(0x1e3)](_0x2deca9=>_0x2deca9[_0x3588f4(0x18f)]['length']===0x0)[_0x3588f4(0x294)];return console[_0x3588f4(0x16b)](_0x3588f4(0x1b0)+_0x5ba965[_0x3588f4(0x167)]),console['log'](_0x3588f4(0x1b8)+_0x3672c3),console[_0x3588f4(0x16b)](_0x3588f4(0x1f4)+_0x5758a0['behaviors']['length']+'\x20behaviors'),console[_0x3588f4(0x16b)](_0x3588f4(0x269)+_0x5c2fb4+_0x3588f4(0x251)),_0x12dd6e>0x0&&console[_0x3588f4(0x16b)](_0x3588f4(0x17f)+_0x12dd6e+_0x3588f4(0x245)),0x0;}console[_0x3588f4(0x188)]('\x0a'+a30_0x28e1b1['bold'](_0x3588f4(0x24c))+'\x20'+a30_0x28e1b1[_0x3588f4(0x1b2)](_0x3672c3));const _0x4b0de5=await withSpinner(_0x3588f4(0x1a9),()=>_0x17b7d9['segment'][_0x3588f4(0x26f)](_0x53c8af),{'verbose':_0x444971[_0x3588f4(0x256)]});console['error']('\x0a'+a30_0x28e1b1[_0x3588f4(0x12a)](_0x3588f4(0x1d6))+'\x20'+a30_0x28e1b1[_0x3588f4(0x260)]('('+_0x3672c3+_0x3588f4(0x253)));const _0x2a34a8=await executeSchemaQuery(_0x4b0de5[_0x3588f4(0x13e)],_0x17b7d9,_0x444971);await handleQueryOutput(_0x2a34a8,_0x444971);const _0xa65f59=await withSpinner(_0x3588f4(0x1fa),()=>_0x17b7d9[_0x3588f4(0x255)][_0x3588f4(0x1c9)](_0x53c8af),{'verbose':_0x444971[_0x3588f4(0x256)]});for(const _0x4758f7 of _0xa65f59[_0x3588f4(0x13e)]){const _0x241181='behavior_'+_0x4758f7[_0x3588f4(0x16a)]()[_0x3588f4(0x139)](/\s+/g,'_'),_0x2a9895=_0x3588f4(0x293)+_0x3672c3+'.'+_0x241181;console['error']('\x0a'+a30_0x28e1b1[_0x3588f4(0x12a)](_0x4758f7)+'\x20'+a30_0x28e1b1[_0x3588f4(0x260)]('('+_0x3672c3+'.'+_0x241181+')'));try{const _0x1f920d=await executeSchemaQuery(_0x2a9895,_0x17b7d9,_0x444971);await handleQueryOutput(_0x1f920d,_0x444971);}catch{console['error'](a30_0x28e1b1['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async['collectSchema'](_0x3a5f11,_0x218cb5,_0x3adb03,_0x5261dd){const _0xdaf9d2=a30_0x2f8a7f,{options:_0x3fbbd4,tdx:_0x256185}=_0x3a5f11,_0x4027ca=await withSpinner(_0xdaf9d2(0x1a9),()=>_0x256185[_0xdaf9d2(0x255)][_0xdaf9d2(0x26f)](_0x3adb03),{'verbose':_0x3fbbd4[_0xdaf9d2(0x256)]}),_0x3f3382=await executeSchemaQuery(_0x4027ca[_0xdaf9d2(0x13e)],_0x256185,_0x3fbbd4),_0x708ab9=_0x3f3382[_0xdaf9d2(0x13e)][_0xdaf9d2(0x1f8)](_0x31f6f3=>({'name':_0x31f6f3[_0xdaf9d2(0x206)],'type':_0x31f6f3['column_type']})),_0x3a6af6=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x256185['segment'][_0xdaf9d2(0x1c9)](_0x3adb03),{'verbose':_0x3fbbd4[_0xdaf9d2(0x256)]}),_0xa88ec8=[];for(const _0x2bdace of _0x3a6af6['data']){const _0xb43e13='behavior_'+_0x2bdace['toLowerCase']()['replace'](/\s+/g,'_'),_0x4e342b=_0xdaf9d2(0x293)+_0x5261dd+'.'+_0xb43e13;let _0x210170=[];try{const _0x136d55=await executeSchemaQuery(_0x4e342b,_0x256185,_0x3fbbd4);_0x210170=_0x136d55[_0xdaf9d2(0x13e)]['map'](_0x430b64=>({'name':_0x430b64['column_name'],'type':_0x430b64['column_type']}));}catch{}_0xa88ec8[_0xdaf9d2(0x186)]({'table':_0xb43e13,'columns':_0x210170});}return{'database':_0x5261dd,'parent_segment':_0x218cb5,'parent_id':_0x3adb03,'customers':{'table':'customers','columns':_0x708ab9},'behaviors':_0xa88ec8};}['formatSchemaJson'](_0x303ad8){const _0x2233f6=a30_0x2f8a7f,_0x37efc6=_0x2fcd1b=>{const _0x2b8e59=a30_0x536a;if(_0x2fcd1b[_0x2b8e59(0x294)]===0x0)return'[]';const _0x59cb04=_0x2fcd1b[_0x2b8e59(0x1f8)](_0x2ab533=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x2ab533[_0x2b8e59(0x12b)]+_0x2b8e59(0x14d)+_0x2ab533[_0x2b8e59(0x197)]+'\x22\x20}');return'[\x0a'+_0x59cb04[_0x2b8e59(0x231)](',\x0a')+_0x2b8e59(0x20d);},_0x3455d5=_0x303ad8[_0x2233f6(0x19b)]['map'](_0x40c61a=>{const _0x3aa824=_0x2233f6;return _0x3aa824(0x1c7)+_0x40c61a[_0x3aa824(0x23a)]+_0x3aa824(0x241)+_0x37efc6(_0x40c61a[_0x3aa824(0x18f)])[_0x3aa824(0x139)](/^/gm,'\x20\x20')[_0x3aa824(0x1e4)]()+_0x3aa824(0x218);})[_0x2233f6(0x231)](',\x0a');return _0x2233f6(0x26a)+_0x303ad8[_0x2233f6(0x27d)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x303ad8[_0x2233f6(0x123)]+_0x2233f6(0x25c)+_0x303ad8[_0x2233f6(0x207)]+_0x2233f6(0x17d)+_0x303ad8['customers']['table']+_0x2233f6(0x19a)+_0x37efc6(_0x303ad8[_0x2233f6(0x1d6)][_0x2233f6(0x18f)])[_0x2233f6(0x139)](/^/gm,'\x20\x20')[_0x2233f6(0x1e4)]()+_0x2233f6(0x279)+_0x3455d5+_0x2233f6(0x14a);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]='segment:parent:sql';['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x59c311){const _0x31e362=a30_0x2f8a7f,{options:_0xf62dad,args:_0x21bb1b,tdx:_0x2b00d8}=_0x59c311,_0xf75e1c=_0x21bb1b[0x0]||_0xf62dad[_0x31e362(0x262)];if(!_0xf75e1c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x31e362(0x1b4)),0x1;_0xf62dad[_0x31e362(0x256)]&&(console[_0x31e362(0x188)](_0x31e362(0x1b1)+_0xf62dad['site']),console[_0x31e362(0x188)](_0x31e362(0x160)+_0xf75e1c));const _0x1b664a=await withSpinner(_0x31e362(0x215)+_0xf75e1c+_0x31e362(0x1e7),()=>_0x2b00d8[_0x31e362(0x255)][_0x31e362(0x173)](_0xf75e1c),{'verbose':_0xf62dad[_0x31e362(0x256)]}),_0x3cc778=_0x1b664a['data'],_0x2e8688=await withSpinner(_0x31e362(0x267)+_0xf75e1c+'\x27...',()=>_0x2b00d8[_0x31e362(0x255)][_0x31e362(0x26f)](_0x3cc778),{'verbose':_0xf62dad['verbose']}),_0x5326b6=_0x2e8688['data'];return _0xf62dad[_0x31e362(0x1c2)]===_0x31e362(0x1e2)||_0xf62dad[_0x31e362(0x1c2)]===_0x31e362(0x159)?await handleSDKOutput([{'sql':_0x5326b6}],_0xf62dad):console['log'](_0x5326b6),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x13a);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x15b);async[a30_0x2f8a7f(0x292)](_0x5317a7){const _0x4f9553=a30_0x2f8a7f,{options:_0x368840,args:_0x3453ae,tdx:_0x47836}=_0x5317a7,_0x56b858=_0x3453ae[0x0]||_0x368840[_0x4f9553(0x262)];if(!_0x56b858)return showParentSegmentNotSetError(_0x4f9553(0x151)+_0x4f9553(0x1cf)),0x1;_0x368840[_0x4f9553(0x256)]&&(console[_0x4f9553(0x188)](_0x4f9553(0x1b1)+_0x368840[_0x4f9553(0x1f3)]),console['error']('Parent\x20segment:\x20'+_0x56b858));const _0x35ba90=await withSpinner(_0x4f9553(0x215)+_0x56b858+_0x4f9553(0x1e7),()=>_0x47836[_0x4f9553(0x255)][_0x4f9553(0x173)](_0x56b858),{'verbose':_0x368840[_0x4f9553(0x256)]}),_0x102616=_0x35ba90[_0x4f9553(0x13e)],_0x122708=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x56b858+_0x4f9553(0x1e7),()=>_0x47836[_0x4f9553(0x255)][_0x4f9553(0x26f)](_0x102616),{'verbose':_0x368840[_0x4f9553(0x256)]});let _0x174582=_0x122708[_0x4f9553(0x13e)];const _0x2b4b13=resolveLimit(_0x368840[_0x4f9553(0x1a0)],DEFAULT_DISPLAY_LIMIT),_0x3399bd=/\bLIMIT\s+\d+/i[_0x4f9553(0x22d)](_0x174582);!_0x3399bd&&(_0x174582=_0x174582[_0x4f9553(0x1e4)]()[_0x4f9553(0x139)](/;+$/,''),_0x174582=_0x4f9553(0x254)+_0x174582+_0x4f9553(0x200)+_0x2b4b13);_0x368840[_0x4f9553(0x256)]&&console[_0x4f9553(0x188)]('SQL\x20query:\x0a'+_0x174582);const _0x14b10c=await withProgressSpinner(_0x4f9553(0x1fc),async _0x2639ae=>{const _0x407ac3=_0x4f9553,_0x9fdb41=await _0x47836['query'][_0x407ac3(0x292)](_0x174582,{'catalog':'td','schema':_0x407ac3(0x14c),'onJobId':_0x302ac3=>{_0x2639ae['setJobId'](_0x302ac3);}});return _0x9fdb41;},{'verbose':_0x368840[_0x4f9553(0x256)]}),_0x2f8596=_0x14b10c['data'],_0x575291=_0x2f8596[_0x4f9553(0x1c8)]?'\x20[Job\x20ID:\x20'+_0x2f8596[_0x4f9553(0x1c8)]+']':'';return console[_0x4f9553(0x188)](_0x4f9553(0x194)+_0x2f8596['stats']['processedRows']['toLocaleString']()+_0x4f9553(0x155)+('in\x20'+formatElapsed(_0x2f8596[_0x4f9553(0x1e8)][_0x4f9553(0x165)])+_0x575291)),await handleQueryOutput(_0x2f8596,_0x368840),0x0;}}export class PSRtListCommand extends BaseCommand{['name']='ps:rt:list';[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x281);async['execute'](_0x4afc0b){const _0x5e0457=a30_0x2f8a7f,{options:_0x51ef43,args:_0x4f449b,tdx:_0x41ed9f}=_0x4afc0b,_0x28956b=_0x4f449b[0x0],_0x1e42cb=await withSpinner(_0x28956b?_0x5e0457(0x2a2)+_0x28956b+_0x5e0457(0x1e7):_0x5e0457(0x289),()=>_0x41ed9f['realtime'][_0x5e0457(0x13f)](),{'verbose':_0x51ef43['verbose']});let _0x44166b=_0x1e42cb[_0x5e0457(0x13e)][_0x5e0457(0x1e3)](_0x470175=>_0x470175['realtime_enabled']);if(_0x28956b){const _0x447109=_0x28956b[_0x5e0457(0x139)](/[.+^${}()|[\]\\]/g,_0x5e0457(0x193))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3c43a8=new RegExp('^'+_0x447109+'$','i');_0x44166b=_0x44166b[_0x5e0457(0x1e3)](_0x330d71=>_0x3c43a8[_0x5e0457(0x22d)](_0x330d71[_0x5e0457(0x12b)]));}_0x44166b[_0x5e0457(0x24b)]((_0x4f028f,_0x32215f)=>_0x4f028f['name'][_0x5e0457(0x130)](_0x32215f[_0x5e0457(0x12b)])),console[_0x5e0457(0x188)](_0x5e0457(0x13d)+_0x44166b[_0x5e0457(0x294)]+_0x5e0457(0x136)+(_0x44166b['length']!==0x1?'s':''));const _0x47ea00=_0x497af8=>{const _0x307bb1=_0x5e0457;return getConsoleNextUrl(_0x51ef43[_0x307bb1(0x1f3)],_0x307bb1(0x13b)+_0x497af8);};if(_0x51ef43[_0x5e0457(0x1c2)]===_0x5e0457(0x1e2)||_0x51ef43[_0x5e0457(0x1c2)]===_0x5e0457(0x159)){const _0x103aaf=_0x44166b['map'](_0x500351=>({..._0x500351,'url':_0x47ea00(_0x500351['id'])}));await handleSDKOutput(_0x103aaf,_0x51ef43);}else{if(_0x44166b['length']===0x0)console[_0x5e0457(0x16b)](_0x5e0457(0x183));else for(const _0x45ad40 of _0x44166b){const _0x2df89e=_0x45ad40[_0x5e0457(0x2a8)]?a30_0x28e1b1[_0x5e0457(0x260)]('\x20('+formatRows(_0x45ad40['population'])+')'):'',_0xa29d0f=hyperlink(_0x45ad40[_0x5e0457(0x12b)],_0x47ea00(_0x45ad40['id']));console[_0x5e0457(0x16b)]('⚡\x20'+_0xa29d0f+_0x2df89e);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x2f8a7f(0x12b)]=a30_0x2f8a7f(0x27f);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x1c0);async[a30_0x2f8a7f(0x292)](_0x31621e){const _0x475814=a30_0x2f8a7f,{options:_0x58c468,args:_0x4ab052,tdx:_0x106ed3}=_0x31621e,_0xe1ce22=_0x4ab052[0x0]||_0x58c468[_0x475814(0x262)];if(!_0xe1ce22)return showParentSegmentNotSetError(_0x475814(0x270)+_0x475814(0x278)),0x1;const _0x23336f=resolveYamlFile(_0xe1ce22);if(!existsSync(_0x23336f))return showFileNotFoundError(_0x23336f,_0xe1ce22),0x1;let _0x3edc62;try{_0x3edc62=readFileSync(_0x23336f,_0x475814(0x244));}catch(_0x1d23db){const _0x2fa93c=_0x1d23db instanceof Error?_0x1d23db[_0x475814(0x178)]:String(_0x1d23db);return console[_0x475814(0x188)](_0x475814(0x239)+_0x2fa93c),0x1;}const _0x559e67=createCommandSpinner(a30_0x28e1b1[_0x475814(0x260)](_0x475814(0x261)),{'verbose':_0x58c468[_0x475814(0x256)]});_0x559e67['start']();const _0x769c00={'realtime':!![],'onProgress':_0x419ac5=>{const _0x32479f=_0x475814;_0x559e67[_0x32479f(0x273)]=formatProgressMessage(_0x419ac5);}};let _0x1b730a;try{_0x1b730a=await _0x106ed3[_0x475814(0x255)]['validateParentYaml'](_0x3edc62,_0x769c00),_0x559e67[_0x475814(0x21b)]();}catch(_0x338c50){_0x559e67[_0x475814(0x21b)]();throw _0x338c50;}console[_0x475814(0x188)]('\x0a'+a30_0x28e1b1[_0x475814(0x12a)](_0x475814(0x234))+'\x20'+_0x1b730a['name']),console[_0x475814(0x188)]('═'[_0x475814(0x1e1)](0x3c)),displayRealtimeValidation(_0x1b730a),console['error']('─'[_0x475814(0x1e1)](0x3c));if(_0x1b730a['errors'][_0x475814(0x294)]>0x0){console[_0x475814(0x188)]('\x0a'+a30_0x28e1b1[_0x475814(0x21f)](_0x475814(0x2a5)));for(const _0x528e11 of _0x1b730a[_0x475814(0x23e)]){console[_0x475814(0x188)]('\x20\x20'+a30_0x28e1b1[_0x475814(0x21f)]('•')+'\x20'+_0x528e11);}}return _0x1b730a['allValid']&&console[_0x475814(0x188)]('\x0a'+a30_0x28e1b1[_0x475814(0x1bb)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x1b730a[_0x475814(0x240)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x2f8a7f(0x12b)]='ps:pz:list';[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x235);async['execute'](_0x1dffcb){const _0x36adb=a30_0x2f8a7f,{options:_0x556103,args:_0x39e41d,tdx:_0x3418b4}=_0x1dffcb,_0x25ca6e=_0x39e41d[0x0]||_0x556103[_0x36adb(0x262)];if(!_0x25ca6e)return showParentSegmentNotSetError(_0x36adb(0x1ae)+_0x36adb(0x1b7)),0x1;const _0x3d5140=await withSpinner(_0x36adb(0x215)+_0x25ca6e+_0x36adb(0x1e7),()=>_0x3418b4[_0x36adb(0x255)]['resolveParentId'](_0x25ca6e),{'verbose':_0x556103[_0x36adb(0x256)]}),_0x5237a9=_0x3d5140[_0x36adb(0x13e)],_0x343a77=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x25ca6e+_0x36adb(0x1e7),()=>_0x3418b4[_0x36adb(0x17b)][_0x36adb(0x13f)](_0x5237a9),{'verbose':_0x556103['verbose']}),_0x46b367=_0x343a77[_0x36adb(0x13e)];console[_0x36adb(0x188)](_0x36adb(0x13d)+_0x46b367[_0x36adb(0x294)]+_0x36adb(0x275)+(_0x46b367[_0x36adb(0x294)]!==0x1?'s':''));if(_0x556103[_0x36adb(0x1c2)]===_0x36adb(0x1e2)||_0x556103['format']==='jsonl')await handleSDKOutput(_0x46b367,_0x556103);else{if(_0x46b367['length']===0x0)console[_0x36adb(0x16b)]('No\x20personalization\x20services\x20configured'),console['error'](a30_0x28e1b1[_0x36adb(0x1b2)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x7ba362 of _0x46b367){const _0x1bc597=_0x7ba362[_0x36adb(0x1b3)]?.[_0x36adb(0x294)]||0x0,_0x1675df=_0x7ba362[_0x36adb(0x247)]?a30_0x28e1b1['dim'](_0x36adb(0x238)+_0x7ba362['trigger_event']):'',_0x544a54=a30_0x28e1b1[_0x36adb(0x260)]('\x20('+_0x1bc597+_0x36adb(0x26b)+(_0x1bc597!==0x1?'s':'')+')');console[_0x36adb(0x16b)]('\x20\x20'+_0x7ba362[_0x36adb(0x12b)]+_0x1675df+_0x544a54),_0x7ba362[_0x36adb(0x29d)]&&console['log'](_0x36adb(0x225)+a30_0x28e1b1['dim'](_0x7ba362['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x2f8a7f(0x12e);[a30_0x2f8a7f(0x29d)]=a30_0x2f8a7f(0x29f);async['execute'](_0x3d8f00){const _0x91764e=a30_0x2f8a7f,{options:_0x1e288a,args:_0x38f5bb}=_0x3d8f00,_0x2b6436=_0x38f5bb[0x0]||_0x1e288a[_0x91764e(0x262)];if(!_0x2b6436)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'+_0x91764e(0x22f)),0x1;const _0x279baf=resolveYamlFile(_0x2b6436);if(!existsSync(_0x279baf))return showFileNotFoundError(_0x279baf,_0x2b6436),0x1;let _0x52f36e;try{_0x52f36e=readFileSync(_0x279baf,_0x91764e(0x244));}catch(_0x2cf672){const _0x4b256b=_0x2cf672 instanceof Error?_0x2cf672['message']:String(_0x2cf672);return console['error'](_0x91764e(0x239)+_0x4b256b),0x1;}let _0x5d6f78;try{_0x5d6f78=parseDef(_0x52f36e);}catch(_0x33869d){const _0x2abe3f=_0x33869d instanceof Error?_0x33869d[_0x91764e(0x178)]:String(_0x33869d);return console[_0x91764e(0x188)](a30_0x28e1b1[_0x91764e(0x21f)]('Error\x20parsing\x20YAML:\x20'+_0x2abe3f)),0x1;}if(_0x5d6f78[_0x91764e(0x176)]&&_0x5d6f78[_0x91764e(0x176)][_0x91764e(0x294)]>0x0)return console[_0x91764e(0x188)](a30_0x28e1b1['yellow'](_0x91764e(0x237)+_0x279baf)),console['error'](a30_0x28e1b1[_0x91764e(0x260)](_0x91764e(0x19e)+_0x5d6f78['personalization_services'][_0x91764e(0x294)]+_0x91764e(0x1ea))),0x1;!_0x5d6f78[_0x91764e(0x179)]&&(_0x5d6f78[_0x91764e(0x179)]={'events':[{'name':_0x91764e(0x1e6),'source_table':_0x91764e(0x137)}],'attributes':[{'name':_0x91764e(0x202),'type':_0x91764e(0x274)}],'id_stitching':{'primary_key':_0x5d6f78[_0x91764e(0x180)][_0x91764e(0x23a)]===_0x91764e(0x1d6)?_0x91764e(0x16c):_0x91764e(0x28d)}});_0x5d6f78[_0x91764e(0x176)]=[{'name':_0x91764e(0x276),'description':'Personalization\x20service\x20description','trigger_event':'page_view','sections':[{'name':'Default','criteria':_0x91764e(0x1dc),'attributes':['last_page_viewed']}]}];const _0x13ef23=serializeDef(_0x5d6f78);return writeFileSync(_0x279baf,_0x13ef23,'utf-8'),console[_0x91764e(0x188)](a30_0x28e1b1[_0x91764e(0x1bb)]('✔')+_0x91764e(0x1a7)+a30_0x28e1b1['cyan'](_0x279baf)),(!_0x5d6f78[_0x91764e(0x179)]||_0x52f36e[_0x91764e(0x147)](_0x91764e(0x280))===-0x1)&&console['error'](a30_0x28e1b1[_0x91764e(0x1bb)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console['error']('\x0a'+a30_0x28e1b1[_0x91764e(0x260)](_0x91764e(0x258))),console[_0x91764e(0x188)](_0x91764e(0x266)+_0x279baf+_0x91764e(0x22e)),console[_0x91764e(0x188)](_0x91764e(0x204)+a30_0x28e1b1['dim'](_0x91764e(0x230)+_0x2b6436)+_0x91764e(0x23b)),0x0;}}
|
|
1
|
+
const a30_0x266c7f=a30_0x442f;(function(_0x27420a,_0x2d422d){const _0x24cbd6=a30_0x442f,_0x3a47cd=_0x27420a();while(!![]){try{const _0x57ab86=parseInt(_0x24cbd6(0x124))/0x1+-parseInt(_0x24cbd6(0x7d))/0x2*(parseInt(_0x24cbd6(0x1f7))/0x3)+parseInt(_0x24cbd6(0xb1))/0x4+parseInt(_0x24cbd6(0x1fa))/0x5+parseInt(_0x24cbd6(0x8c))/0x6+-parseInt(_0x24cbd6(0x1b9))/0x7*(-parseInt(_0x24cbd6(0xfd))/0x8)+parseInt(_0x24cbd6(0x91))/0x9*(-parseInt(_0x24cbd6(0xbe))/0xa);if(_0x57ab86===_0x2d422d)break;else _0x3a47cd['push'](_0x3a47cd['shift']());}catch(_0x51ff53){_0x3a47cd['push'](_0x3a47cd['shift']());}}}(a30_0x33c8,0xeafa9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x41b2d2 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';function a30_0x442f(_0x2059f0,_0x1fcf59){_0x2059f0=_0x2059f0-0x75;const _0x33c895=a30_0x33c8();let _0x442fa6=_0x33c895[_0x2059f0];return _0x442fa6;}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_0x1b0436 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_0x266c7f(0xc1),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x2b7151){const _0x16a7f8=a30_0x266c7f,_0x14236e=process[_0x16a7f8(0x133)],_0x442254=_0x14236e==='darwin'?'open':_0x14236e===_0x16a7f8(0x18e)?_0x16a7f8(0x192):_0x16a7f8(0x80);spawn(_0x442254,[_0x2b7151],{'detached':!![],'stdio':_0x16a7f8(0xe2)})[_0x16a7f8(0x1c1)]();}function migrateLegacyDirectory(){const _0x22461b=a30_0x266c7f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x186fc1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x186fc1[_0x22461b(0x1a5)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0xb2)](_0x22461b(0x19b)+LEGACY_PARENT_SEGMENT_DIR+_0x22461b(0xc2)+PARENT_SEGMENT_DIR+_0x22461b(0x12c))),console['error'](a30_0x1b0436[_0x22461b(0x116)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x22461b(0x182))),![];console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0xb2)](_0x22461b(0x16d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x1b0436[_0x22461b(0x1dc)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4b40c7){const _0x5b2c02=_0x4b40c7 instanceof Error?_0x4b40c7[_0x22461b(0xa4)]:String(_0x4b40c7);return console[_0x22461b(0x127)](a30_0x1b0436[_0x22461b(0x181)](_0x22461b(0x1e8)+_0x5b2c02+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x3de85e){const _0xdf0cbf=a30_0x266c7f;return migrateLegacyDirectory(),super[_0xdf0cbf(0x1e3)](_0x3de85e);}}function resolveYamlFile(_0x168147){const _0x4a47a7=a30_0x266c7f;if(_0x168147['endsWith'](_0x4a47a7(0x158))||_0x168147[_0x4a47a7(0x9e)]('.yaml'))return _0x168147;return a30_0x41b2d2[_0x4a47a7(0xed)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x168147)+_0x4a47a7(0x158));}function formatProgressMessage(_0x445505){const _0x5a3d09=a30_0x266c7f,_0x50e88d=_0x445505['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x50e88d){const [,_0x2c0297,_0xd349c6,_0x5020bd='']=_0x50e88d;return a30_0x1b0436[_0x5a3d09(0x116)](_0x2c0297+':')+'\x20'+_0xd349c6+a30_0x1b0436[_0x5a3d09(0x116)](_0x5020bd);}return a30_0x1b0436[_0x5a3d09(0x116)](_0x445505);}function showFileNotFoundError(_0x4e4ae2,_0x5f36e1){const _0x51c54a=a30_0x266c7f;console['error'](a30_0x1b0436[_0x51c54a(0x181)](_0x51c54a(0xc3)+_0x4e4ae2+'\x0a')),console[_0x51c54a(0x127)](a30_0x1b0436[_0x51c54a(0x1ba)](_0x51c54a(0xd6)+_0x5f36e1+_0x51c54a(0xfe)));}function displayRealtimeValidation(_0x31fee9){const _0x320c92=a30_0x266c7f;if(!_0x31fee9[_0x320c92(0x7c)])return;const _0x4edda8=_0x31fee9[_0x320c92(0x7c)],_0x511336=_0x4edda8[_0x320c92(0x17f)]?a30_0x1b0436[_0x320c92(0x1dc)](_0x320c92(0x1d8)):a30_0x1b0436[_0x320c92(0xb2)](_0x320c92(0x11c));console['error']('\x0a'+a30_0x1b0436['dim']('RT\x202.0:')+'\x20'+_0x511336);if(_0x4edda8[_0x320c92(0xdb)]&&_0x4edda8[_0x320c92(0xdb)]['length']>0x0){console['error']('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)]('Events:')+'\x20'+_0x4edda8[_0x320c92(0xdb)][_0x320c92(0xa8)]+'\x20configured');for(const _0x430b6f of _0x4edda8[_0x320c92(0xdb)]){const _0x198f5e=_0x430b6f[_0x320c92(0xcc)]===![]?a30_0x1b0436[_0x320c92(0x181)]('✘'):a30_0x1b0436['green']('✔');console['error'](_0x320c92(0x1ca)+_0x198f5e+'\x20'+_0x430b6f[_0x320c92(0x199)]),_0x430b6f[_0x320c92(0x15c)]&&console[_0x320c92(0x127)](_0x320c92(0x1be)+a30_0x1b0436[_0x320c92(0x181)](_0x430b6f['sourceTableError']));}}if(_0x4edda8[_0x320c92(0xc4)]&&_0x4edda8[_0x320c92(0xc4)][_0x320c92(0xa8)]>0x0){console['error']('\x20\x20'+a30_0x1b0436['dim']('Attributes:')+'\x20'+_0x4edda8[_0x320c92(0xc4)][_0x320c92(0xa8)]+_0x320c92(0x123));for(const _0x3ef7a2 of _0x4edda8[_0x320c92(0xc4)]){const _0x76d5f=_0x3ef7a2[_0x320c92(0x16b)]?a30_0x1b0436[_0x320c92(0x1dc)]('✔'):a30_0x1b0436[_0x320c92(0x181)]('✘');console[_0x320c92(0x127)](_0x320c92(0x1ca)+_0x76d5f+'\x20'+_0x3ef7a2[_0x320c92(0x199)]+'\x20'+a30_0x1b0436[_0x320c92(0x116)]('('+_0x3ef7a2[_0x320c92(0x1aa)]+')'));}}if(_0x4edda8[_0x320c92(0x143)]){const _0x14aae9=_0x4edda8[_0x320c92(0x143)][_0x320c92(0x87)]?.[_0x320c92(0xa8)]?'\x20+\x20['+_0x4edda8[_0x320c92(0x143)][_0x320c92(0x87)][_0x320c92(0xed)](',\x20')+']':'';console['error']('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)](_0x320c92(0xc8))+'\x20'+_0x4edda8[_0x320c92(0x143)][_0x320c92(0x141)]+_0x14aae9);}if(_0x4edda8[_0x320c92(0x1ad)]&&_0x4edda8['personalizationServices']['length']>0x0){console[_0x320c92(0x127)]('\x20\x20'+a30_0x1b0436[_0x320c92(0x116)](_0x320c92(0x1d3))+'\x20'+_0x4edda8[_0x320c92(0x1ad)]['length']+_0x320c92(0x12a)+(_0x4edda8[_0x320c92(0x1ad)][_0x320c92(0xa8)]!==0x1?'s':''));for(const _0x2d67d6 of _0x4edda8['personalizationServices']){console['error'](_0x320c92(0x122)+_0x2d67d6[_0x320c92(0x199)]);}}}function showParentSegmentNotSetError(_0x632a98){const _0x3df88c=a30_0x266c7f;console[_0x3df88c(0x127)](a30_0x1b0436[_0x3df88c(0xb2)](_0x3df88c(0x82))),console[_0x3df88c(0x127)](_0x632a98);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x266c7f(0x99);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xeb);async['execute'](_0x21e4b6){const _0x247d6a=a30_0x266c7f,{options:_0x1144e4,args:_0x447e16,tdx:_0x31a3ae}=_0x21e4b6,_0x5b3bd7=_0x447e16[0x0];_0x1144e4[_0x247d6a(0xb5)]&&(console[_0x247d6a(0x127)](_0x247d6a(0x108)+_0x1144e4[_0x247d6a(0x175)]),_0x5b3bd7&&console[_0x247d6a(0x127)](_0x247d6a(0x162)+_0x5b3bd7));const _0x132840=await withSpinner(_0x5b3bd7?_0x247d6a(0x117)+_0x5b3bd7+_0x247d6a(0x76):_0x247d6a(0x1bd),()=>_0x31a3ae[_0x247d6a(0x105)][_0x247d6a(0xc7)](),{'verbose':_0x1144e4[_0x247d6a(0xb5)]});let _0x4f7f95=_0x132840[_0x247d6a(0xe8)];if(_0x5b3bd7){const _0x33004a=_0x5b3bd7[_0x247d6a(0x14d)](/[.+^${}()|[\]\\]/g,_0x247d6a(0x161))['replace'](/\*/g,'.*')[_0x247d6a(0x14d)](/\?/g,'.'),_0xaee835=new RegExp('^'+_0x33004a+'$','i');_0x4f7f95=_0x4f7f95['filter'](_0x4bb0d7=>_0xaee835[_0x247d6a(0x137)](_0x4bb0d7[_0x247d6a(0xc4)]['name']));}_0x4f7f95['sort']((_0x3d36e2,_0x28ba99)=>_0x3d36e2[_0x247d6a(0xc4)][_0x247d6a(0x199)][_0x247d6a(0x166)](_0x28ba99[_0x247d6a(0xc4)][_0x247d6a(0x199)])),console[_0x247d6a(0x127)]('✔\x20Found\x20'+_0x4f7f95[_0x247d6a(0xa8)]+_0x247d6a(0x134)+(_0x4f7f95['length']!==0x1?'s':''));const _0x9bf1f9=_0x58f00f=>{const _0x2f430d=_0x247d6a;return getConsoleNextUrl(_0x1144e4[_0x2f430d(0x175)],_0x2f430d(0x1e1)+_0x58f00f);};if(_0x1144e4['format']===_0x247d6a(0xae)||_0x1144e4[_0x247d6a(0xd2)]===_0x247d6a(0x140)){const _0x3713af=_0x4f7f95[_0x247d6a(0x178)](_0x555a73=>({..._0x555a73,'url':_0x9bf1f9(_0x555a73['id'])}));await handleSDKOutput(_0x3713af,_0x1144e4);}else{if(_0x4f7f95['length']===0x0)_0x5b3bd7?console['log'](_0x247d6a(0x194)+_0x5b3bd7):console[_0x247d6a(0x1a7)](_0x247d6a(0x1ff));else for(const _0x2b11a3 of _0x4f7f95){const _0x5d2059=_0x2b11a3[_0x247d6a(0xc4)][_0x247d6a(0x1c7)]?a30_0x1b0436[_0x247d6a(0x116)]('\x20('+formatRows(_0x2b11a3[_0x247d6a(0xc4)][_0x247d6a(0x1c7)])+')'):'',_0x36394f=hyperlink(_0x2b11a3['attributes'][_0x247d6a(0x199)],_0x9bf1f9(_0x2b11a3['id']));console[_0x247d6a(0x1a7)](_0x247d6a(0x1cf)+_0x36394f+_0x5d2059);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x266c7f(0x199)]='segment:parent:create';[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x1d7);async[a30_0x266c7f(0xd5)](_0x2cae5e){const _0x31dbfe=a30_0x266c7f,{options:_0x2f350b,args:_0x4f5d91,tdx:_0x400f43}=_0x2cae5e;console[_0x31dbfe(0x127)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x31dbfe(0x153));const _0x2e8f47=_0x2f350b;if(_0x4f5d91[_0x31dbfe(0xa8)]===0x0)return console[_0x31dbfe(0x127)](a30_0x1b0436[_0x31dbfe(0x181)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x31dbfe(0x127)](_0x31dbfe(0x1ed)),0x1;const _0x375b57=_0x4f5d91[0x0];if(!_0x2e8f47[_0x31dbfe(0x11d)]||!_0x2e8f47[_0x31dbfe(0xd3)])return console[_0x31dbfe(0x127)](_0x31dbfe(0x1f4)),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2e8f47['verbose']&&(console[_0x31dbfe(0x127)](_0x31dbfe(0x108)+_0x2e8f47['site']),console[_0x31dbfe(0x127)](_0x31dbfe(0x18d)+_0x375b57),console[_0x31dbfe(0x127)](_0x31dbfe(0x10f)+_0x2e8f47[_0x31dbfe(0x11d)]),console[_0x31dbfe(0x127)](_0x31dbfe(0x169)+_0x2e8f47[_0x31dbfe(0xd3)]));const _0x1f4781=await loadJSONFromOptions(_0x2e8f47[_0x31dbfe(0xc4)],_0x2e8f47[_0x31dbfe(0xef)]),_0x1391f2=await loadJSONFromOptions(_0x2e8f47['behaviors'],_0x2e8f47[_0x31dbfe(0x102)]),_0x3c2ee7=await loadJSONFromOptions(_0x2e8f47[_0x31dbfe(0xaa)],_0x2e8f47[_0x31dbfe(0x14a)]),_0x34befb={'name':_0x375b57,'description':_0x2e8f47[_0x31dbfe(0xe0)],'scheduleType':_0x2e8f47[_0x31dbfe(0xd8)],'scheduleOption':_0x2e8f47[_0x31dbfe(0x19c)],'timezone':_0x2e8f47[_0x31dbfe(0x118)],'master':{'parentDatabaseName':_0x2e8f47['database'],'parentTableName':_0x2e8f47[_0x31dbfe(0xd3)]},'attributes':_0x1f4781,'behaviors':_0x1391f2,'customerGroup':_0x3c2ee7},_0x1081ea=await withSpinner(_0x31dbfe(0xab)+_0x375b57+'\x27...',()=>_0x400f43[_0x31dbfe(0x105)]['createParent'](_0x34befb),{'verbose':_0x2f350b[_0x31dbfe(0xb5)]}),_0x50fe74=_0x1081ea[_0x31dbfe(0xe8)];return console[_0x31dbfe(0x127)](_0x31dbfe(0x1c5)+_0x50fe74[_0x31dbfe(0x199)]+_0x31dbfe(0x101)+_0x50fe74['id']),await handleSDKOutput([_0x50fe74],_0x2f350b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x266c7f(0xa9);['description']=a30_0x266c7f(0x1a8);async['execute'](_0x2768bf){const _0x3b6dcf=a30_0x266c7f,{options:_0x32137f,args:_0x3df690,tdx:_0xbc77ee}=_0x2768bf;console[_0x3b6dcf(0x127)](_0x3b6dcf(0x179)+_0x3b6dcf(0x1ea)+_0x3b6dcf(0x153));const _0xcbfd38=_0x32137f;if(_0x3df690['length']===0x0)return console[_0x3b6dcf(0x127)](a30_0x1b0436[_0x3b6dcf(0x181)](_0x3b6dcf(0x17d))),console[_0x3b6dcf(0x127)](_0x3b6dcf(0x12d)),0x1;const _0x43fe5a=_0x3df690[0x0];_0xcbfd38[_0x3b6dcf(0xb5)]&&(console[_0x3b6dcf(0x127)]('Site:\x20'+_0xcbfd38[_0x3b6dcf(0x175)]),console['error'](_0x3b6dcf(0x1e4)+_0x43fe5a));const _0x5d7728=await withSpinner(_0x3b6dcf(0x160)+_0x43fe5a+_0x3b6dcf(0x76),()=>_0xbc77ee['segment'][_0x3b6dcf(0x1ee)](_0x43fe5a),{'verbose':_0xcbfd38['verbose']}),_0x2961eb=_0x5d7728[_0x3b6dcf(0xe8)],_0xd986f3=await loadJSONFromOptions(_0xcbfd38['addAttributes'],_0xcbfd38[_0x3b6dcf(0x19a)]),_0x540d70=await loadJSONFromOptions(_0xcbfd38[_0x3b6dcf(0x17e)],_0xcbfd38[_0x3b6dcf(0x11a)]),_0x187924={'name':_0x2961eb[_0x3b6dcf(0x199)],'description':_0xcbfd38[_0x3b6dcf(0xe0)]!==undefined?_0xcbfd38['description']:_0x2961eb[_0x3b6dcf(0xe0)],'scheduleType':_0xcbfd38[_0x3b6dcf(0xd8)]!==undefined?_0xcbfd38[_0x3b6dcf(0xd8)]:_0x2961eb[_0x3b6dcf(0xd8)],'scheduleOption':_0xcbfd38[_0x3b6dcf(0x19c)]!==undefined?_0xcbfd38['scheduleOption']:_0x2961eb[_0x3b6dcf(0x19c)],'timezone':_0xcbfd38[_0x3b6dcf(0x118)]!==undefined?_0xcbfd38[_0x3b6dcf(0x118)]:_0x2961eb['timezone'],'master':_0x2961eb['master'],'attributes':_0xd986f3?[..._0x2961eb['attributes']||[],..._0xd986f3]:_0x2961eb[_0x3b6dcf(0xc4)],'behaviors':_0x540d70?[..._0x2961eb[_0x3b6dcf(0x16c)]||[],..._0x540d70]:_0x2961eb[_0x3b6dcf(0x16c)],'customerGroup':_0x2961eb['customerGroup']},_0x3a7b82=await withSpinner(_0x3b6dcf(0x1c8)+_0x43fe5a+_0x3b6dcf(0x76),()=>_0xbc77ee[_0x3b6dcf(0x105)][_0x3b6dcf(0xfb)](_0x43fe5a,_0x187924),{'verbose':_0xcbfd38[_0x3b6dcf(0xb5)]}),_0x2a1502=_0x3a7b82[_0x3b6dcf(0xe8)];return console['error'](_0x3b6dcf(0x1ce)+_0x2a1502[_0x3b6dcf(0x199)]+'\x27'),await handleSDKOutput([_0x2a1502],_0xcbfd38),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x154);['description']=a30_0x266c7f(0x1b3);async[a30_0x266c7f(0xd5)](_0x3bcee9){const _0x61cdbf=a30_0x266c7f,{options:_0x13150b,args:_0x2cbfac,tdx:_0x3989c8}=_0x3bcee9,_0x3046fc=_0x13150b,_0x52a821=_0x2cbfac[0x0]||_0x13150b['parentSegment'];if(!_0x52a821)return showParentSegmentNotSetError(_0x61cdbf(0xb9)+_0x61cdbf(0x106)),0x1;if(_0x3046fc['use']&&_0x3046fc[_0x61cdbf(0xe7)])return console['error'](a30_0x1b0436[_0x61cdbf(0x181)](_0x61cdbf(0x1ef))),console['error'](a30_0x1b0436['dim'](_0x61cdbf(0xc6))),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x116)](_0x61cdbf(0x180)+PARENT_SEGMENT_DIR+_0x61cdbf(0x1fe))),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1ba)](_0x61cdbf(0x77))),0x1;const _0x5cfe7d=_0x3046fc[_0x61cdbf(0xe7)]||a30_0x41b2d2['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x52a821)+_0x61cdbf(0x158));_0x3046fc[_0x61cdbf(0xb5)]&&(console['error'](_0x61cdbf(0x108)+_0x3046fc[_0x61cdbf(0x175)]),console[_0x61cdbf(0x127)](_0x61cdbf(0x1e4)+_0x52a821),console['error'](_0x61cdbf(0x1a2)+_0x5cfe7d));const _0x514b06=await withSpinner(_0x61cdbf(0xca)+_0x52a821+_0x61cdbf(0x76),()=>_0x3989c8[_0x61cdbf(0x105)][_0x61cdbf(0xa6)](_0x52a821),{'verbose':_0x3046fc[_0x61cdbf(0xb5)]}),_0x39b674=_0x514b06[_0x61cdbf(0xe8)];if(existsSync(_0x5cfe7d)){const _0x480640=readFileSync(_0x5cfe7d,_0x61cdbf(0x90)),_0x54373f=generateDiff(_0x480640,_0x39b674);if(!hasChanges(_0x54373f))console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0xd1)+a30_0x1b0436[_0x61cdbf(0x1ba)](_0x5cfe7d)+_0x61cdbf(0x1b4));else{console['error'](_0x61cdbf(0x17c)+_0x5cfe7d+'\x27:'),console[_0x61cdbf(0x127)]('─'[_0x61cdbf(0x145)](0x3c)),console[_0x61cdbf(0x127)](formatDiffWithColors(_0x54373f)),console[_0x61cdbf(0x127)]('─'[_0x61cdbf(0x145)](0x3c));if(!_0x3046fc[_0x61cdbf(0x190)]){if(!isInteractive())return console[_0x61cdbf(0x127)](a30_0x1b0436['red'](_0x61cdbf(0xff)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x61cdbf(0x127)](a30_0x1b0436['dim'](_0x61cdbf(0x1d9))),0x1;const _0x3a0007=await confirmKey(_0x61cdbf(0x1f1)+_0x5cfe7d+'\x27?');if(!_0x3a0007)return console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0xb2)]('Aborted.')),0x1;}writeFileSync(_0x5cfe7d,_0x39b674,_0x61cdbf(0x90)),console['error'](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0x13e)+a30_0x1b0436['cyan'](_0x5cfe7d));}}else{const _0x2b0db4=a30_0x41b2d2[_0x61cdbf(0x164)](_0x5cfe7d);!existsSync(_0x2b0db4)&&mkdirSync(_0x2b0db4,{'recursive':!![]}),writeFileSync(_0x5cfe7d,_0x39b674,_0x61cdbf(0x90)),console[_0x61cdbf(0x127)](a30_0x1b0436['green']('✔')+_0x61cdbf(0x13e)+a30_0x1b0436['cyan'](_0x5cfe7d));}return saveSessionContext({'parent_segment':_0x52a821},_0x3046fc[_0x61cdbf(0xce)]),console[_0x61cdbf(0x127)](a30_0x1b0436[_0x61cdbf(0x1dc)]('✔')+_0x61cdbf(0x1c6)+a30_0x1b0436['dim']('parent_segment')+_0x61cdbf(0x17a)+a30_0x1b0436[_0x61cdbf(0x1ba)](_0x52a821)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1d0);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x89);async[a30_0x266c7f(0xd5)](_0x4f4730){const _0x5d0abc=a30_0x266c7f,{options:_0x5c3e1a,args:_0x5f2616,tdx:_0x25e5e0}=_0x4f4730,_0x1149e9=_0x5c3e1a,_0x14ab99=_0x5f2616[0x0]||_0x5c3e1a[_0x5d0abc(0xe6)];if(!_0x14ab99)return showParentSegmentNotSetError(_0x5d0abc(0x13a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x4b8b8a=resolveYamlFile(_0x14ab99);if(!existsSync(_0x4b8b8a))return showFileNotFoundError(_0x4b8b8a,_0x14ab99),0x1;_0x1149e9[_0x5d0abc(0xb5)]&&(console[_0x5d0abc(0x127)](_0x5d0abc(0x108)+_0x1149e9[_0x5d0abc(0x175)]),console[_0x5d0abc(0x127)](_0x5d0abc(0xdf)+_0x4b8b8a));let _0x5ace9a;try{_0x5ace9a=readFileSync(_0x4b8b8a,_0x5d0abc(0x90));}catch(_0x559fb8){const _0xa11510=_0x559fb8 instanceof Error?_0x559fb8[_0x5d0abc(0xa4)]:String(_0x559fb8);return console[_0x5d0abc(0x127)]('Error\x20reading\x20file:\x20'+_0xa11510),0x1;}const _0xe91bf5=await withSpinner(_0x5d0abc(0xcd),()=>_0x25e5e0[_0x5d0abc(0x105)][_0x5d0abc(0x14b)](_0x5ace9a),{'verbose':_0x1149e9['verbose']}),_0x53e87d=_0xe91bf5['data'],{isNew:_0x4cf8c0,name:_0x210b6f,hasChanges:_0x1fa8a5,diffFormatted:_0xde2e53}=_0x53e87d;if(!_0x1fa8a5)return console['error'](_0x5d0abc(0xd4)+_0x210b6f+_0x5d0abc(0x119)),0x0;_0x4cf8c0?console[_0x5d0abc(0x127)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27:'):console[_0x5d0abc(0x127)](_0x5d0abc(0x9d)+_0x210b6f+'\x27:');console['error']('─'[_0x5d0abc(0x145)](0x3c)),console[_0x5d0abc(0x127)](_0xde2e53),console[_0x5d0abc(0x127)]('─'[_0x5d0abc(0x145)](0x3c));const _0x5677d3=_0x4cf8c0?'Create\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27?':_0x5d0abc(0x86)+_0x210b6f+'\x27?';if(!_0x1149e9[_0x5d0abc(0x190)]){if(!isInteractive())return console[_0x5d0abc(0x127)](a30_0x1b0436[_0x5d0abc(0x181)]('\x0aError:'),_0x5d0abc(0x10c)),console[_0x5d0abc(0x127)](a30_0x1b0436['dim'](_0x5d0abc(0x1d9))),0x1;const _0x3bd4af=await confirmKey(_0x5677d3);if(!_0x3bd4af)return console[_0x5d0abc(0x127)](a30_0x1b0436['yellow'](_0x5d0abc(0x186))),0x1;}const _0x544c23=_0x4cf8c0?_0x5d0abc(0x12b):_0x5d0abc(0x193),_0x1692e4=await withSpinner(_0x544c23+'\x20parent\x20segment\x20\x27'+_0x210b6f+'\x27...',()=>_0x53e87d['apply'](),{'verbose':_0x1149e9['verbose']}),_0x1ade1a=_0x1692e4['data'],_0x359a52=getConsoleNextUrl(_0x1149e9[_0x5d0abc(0x175)],'/app/dw/parentSegments/'+_0x1ade1a['id']),_0x13f02d=_0x4cf8c0?_0x5d0abc(0x14c):_0x5d0abc(0x9b);return console[_0x5d0abc(0x127)]('✔\x20'+_0x13f02d+_0x5d0abc(0xd7)+_0x1ade1a[_0x5d0abc(0x199)]+'\x27'),console[_0x5d0abc(0x127)]('\x20\x20'+_0x359a52),0x0;}}function a30_0x33c8(){const _0x17c07c=['\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','workflowSessionId','dim','Listing\x20parent\x20segments\x20matching\x20\x27','timezone','\x27\x20is\x20already\x20up\x20to\x20date','addBehaviorsFile','/sessions/','⚡\x20Not\x20enabled','database','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20--attribute\x20\x22','\x0a\x20\x20\x20\x20}','\x20\x20\x20\x20-\x20','\x20configured','1257481lSmwhR','Status:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','error','\x20RT\x20configuration\x20is\x20valid','list','\x20service','Creating','/\x20directories\x20exist.','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:preview','in\x20','double','foreignKey','Listing\x20RT-enabled\x20parent\x20segments...','platform','\x20parent\x20segment','page_view','Fetching\x20SQL\x20for\x20\x27','test','\x20\x20No\x20sample\x20data\x20available','Validate:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:show','ps:rt:list','joinKey','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','personalization','jsonl','primaryKey','Rows:','idStitching','listFields','repeat','RT\x202.0\x20Validate:','Columns:','parent_segment','Fetching\x20sample\x20data...','customerGroupFile','pushParentYaml','Created','replace','Schema\x20saved\x20to\x20','apply','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','stats','all','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','segment:parent:pull','Next\x20steps:','keys','Attribute:','.yml','\x20\x202.\x20Run\x20','Fetching\x20behavior\x20list...','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','sourceTableError','Options:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','filter','Fetching\x20current\x20configuration\x20for\x20\x27','\x5c$&','Pattern:\x20','preview','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','localeCompare','Customers:','validateParentYaml','Table:\x20','Master\x20Table','valid','behaviors','\x0a⚠️\x20\x20Migrating:\x20','customerPercent','getBehaviorNames','My\x20Service','customersWithEvents','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','trigger_event','site','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Error\x20reading\x20file:\x20','map','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20=\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0aChanges\x20to\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','addBehaviors','enabled','using\x20the\x20default\x20path:\x20','red','/\x20directory.\x0a','Join\x20on:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','master','Aborted.','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x27\x20is\x20up\x20to\x20date','\x22,\x20\x22type\x22:\x20\x22','\x0aUsage:\x20tdx\x20ps\x20preview\x20','ps:pz:list','columns','Name:\x20','win32','\x20Added\x20personalization\x20template\x20to\x20','yes','Errors:','start','Updating','No\x20parent\x20segments\x20match\x20pattern:\x20','label','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x201.\x20Edit\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','name','addAttributesFile','\x0a⚠️\x20\x20Both\x20','scheduleOption','\x20section','elapsedTimeMillis','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','interval','Output\x20file:\x20','column_type','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','isDirectory','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','log','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','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','type','\x20tdx\x20wf\x20attempt\x20','collectSchema','personalizationServices','segment:parent:view','ps:pz:init','schemaValid','indexOf','query','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20is\x20already\x20up\x20to\x20date','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','toFixed','toLowerCase','SQL\x20query:\x0a','385VPHkyO','cyan','\x22\x20}','attribute','Listing\x20parent\x20segments...','\x20\x20\x20\x20\x20\x20','No\x20RT-enabled\x20parent\x20segments\x20found','totalEvents','unref','SELECT\x20*\x20FROM\x20(\x0a','td_client_id','Preview:','✔\x20Created\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','population','Updating\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20','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','To\x20cancel:','audienceId','✔\x20Updated\x20parent\x20segment\x20\x27','👥\x20','segment:parent:push','schemaError','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Personalization:','%)\x20','behavior','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','⚡\x20Enabled','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','column','formatSchemaJson','green','\x20RT-enabled\x20parent\x20segment','column_name','Error\x20parsing\x20YAML:\x20','displayPreviewHints','/app/dw/parentSegments/','\x20behaviors','run','Parent\x20segment:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayColumns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','✘\x20Failed\x20to\x20rename\x20directory:\x20','previewParentYaml','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','errors','\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','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','getParentFull','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:fields','Overwrite\x20\x27','Coverage:','\x20--behavior\x20\x22<name>\x22','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Events:','4103721kvopJC','trim','text','3997285zsAHaM','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','status','\x0a\x20\x20\x20\x20]','/{name}.yml\x0a','No\x20parent\x20segments\x20found','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x27...','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Create\x20parent\x20segment\x20\x27','/attempt/','rowCount','displayRealtimeInfo','realtime','2yIVPPq','Source:','enriched','xdg-open','customers','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','sort','\x27\x20and\x20run\x20workflow?','behavior_','Apply\x20changes\x20to\x20\x27','stitchingKeys','Attempt:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','✔\x20Query\x20completed:\x20Processed\x20','number','6469176UZdzTr','allValid','segment:parent:desc','\x20kill','utf-8','9ArVpJq','displayPreviewResults','.customers)','Behavior:','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','displaySampleData','Behaviors','displayBehaviorsStats','segment:parent:list','displaySummary','Updated','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','endsWith','string','\x20to\x20push\x20the\x20configuration','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Fetching\x20customers\x20schema...','tdx\x20ps\x20preview\x20','message','<database>.<table>','pullParentYaml','displayValidateResults','length','segment:parent:update','customerGroup','Creating\x20parent\x20segment\x20\x27','{\x0a\x20\x20\x22database\x22:\x20\x22','realtime:','json','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','5258736zfRKZC','yellow','coveragePercent','Resolving\x20parent\x20segment\x20\x27','verbose','✔\x20Found\x20','displayMasterInfo','Enriched:','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--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20trigger=','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','25679630OXnXTQ','last_page_viewed','No\x20personalization\x20services\x20configured','parent_segments','/\x20and\x20','Error:\x20File\x20not\x20found:\x20','attributes','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','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','listParents','ID\x20Stitching:','Validating\x20configuration...','Fetching\x20parent\x20segment\x20\x27','Found\x20YAML\x20file:\x20','sourceTableValid','Analyzing\x20changes...','session','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','runParent','\x20No\x20changes\x20-\x20','format','table','✔\x20No\x20changes\x20-\x20\x27','execute','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20parent\x20segment\x20\x27','scheduleType','Show\x20parent\x20segment\x20details','personalization_services','events','workflowAttemptId','matchedCount','\x20rows\x20','YAML\x20file:\x20','description','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','ignore','getParentSQL','Master:','varchar','parentSegment','output','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','reduce','List\x20parent\x20segments','\x20Opening\x20','join','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','attributesFile','Available\x20behaviors:','Output\x20Database:','SELECT\x20*\x20FROM\x20','push','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20--attribute\x20\x22<name>\x22','stop','Error:','bold','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:validate','updateParent','\x0a\x20\x20]\x0a}\x0a','65240ibSgRh','`\x20to\x20download\x20the\x20configuration\x20first','\x0aError:','displayAttributesStats','\x27\x20with\x20ID:\x20','behaviorsFile','true','tdx\x20ps\x20push\x20','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','getOutputDatabaseName','Site:\x20','resolveParentId','\x20--behavior\x20\x22','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20--enriched','\x20field','Database:\x20','\x20personalization\x20service','Options:\x0a','Default','Listing\x20fields\x20for\x20\x27'];a30_0x33c8=function(){return _0x17c07c;};return a30_0x33c8();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0xfa);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a30_0x266c7f(0xd5)](_0x22df18){const _0xae6da5=a30_0x266c7f,{options:_0x5dcf49,args:_0x1fbace,tdx:_0x4c6b5f}=_0x22df18,_0x95f9b9=_0x5dcf49,_0x20d258=_0x1fbace[0x0]||_0x5dcf49[_0xae6da5(0xe6)];if(!_0x20d258)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0xae6da5(0x9c)+_0xae6da5(0x111)+_0xae6da5(0xba)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0xae6da5(0x1e5)),0x1;const _0x1d2c15=resolveYamlFile(_0x20d258);if(!existsSync(_0x1d2c15))return showFileNotFoundError(_0x1d2c15,_0x20d258),0x1;_0x95f9b9[_0xae6da5(0xb5)]&&(console[_0xae6da5(0x127)](_0xae6da5(0x108)+_0x95f9b9[_0xae6da5(0x175)]),console[_0xae6da5(0x127)](_0xae6da5(0xdf)+_0x1d2c15));let _0x1b050e;try{_0x1b050e=readFileSync(_0x1d2c15,_0xae6da5(0x90));}catch(_0x59335e){const _0x26767c=_0x59335e instanceof Error?_0x59335e[_0xae6da5(0xa4)]:String(_0x59335e);return console[_0xae6da5(0x127)]('Error\x20reading\x20file:\x20'+_0x26767c),0x1;}const _0x5cd7be=createCommandSpinner(a30_0x1b0436[_0xae6da5(0x116)](_0xae6da5(0xc9)),{'verbose':_0x95f9b9['verbose']});_0x5cd7be[_0xae6da5(0x192)]();const _0x3f4efa={'onProgress':_0x3ddd7e=>{const _0x562e51=_0xae6da5;_0x5cd7be[_0x562e51(0x1f9)]=formatProgressMessage(_0x3ddd7e);}};if(_0x95f9b9['master'])_0x3f4efa['master']=!![];if(_0x95f9b9['enriched'])_0x3f4efa[_0xae6da5(0x7f)]=!![];_0x95f9b9[_0xae6da5(0x1bc)]&&(_0x3f4efa[_0xae6da5(0x1bc)]=_0x95f9b9['attribute']);_0x95f9b9[_0xae6da5(0x1d5)]&&(_0x3f4efa[_0xae6da5(0x1d5)]=_0x95f9b9['behavior']);if(_0x95f9b9[_0xae6da5(0x1a1)])_0x3f4efa[_0xae6da5(0x1a1)]=_0x95f9b9[_0xae6da5(0x1a1)];let _0x37080a;try{_0x37080a=await _0x4c6b5f[_0xae6da5(0x105)][_0xae6da5(0x168)](_0x1b050e,_0x3f4efa),_0x5cd7be[_0xae6da5(0xf6)]();}catch(_0x554945){_0x5cd7be[_0xae6da5(0xf6)]();throw _0x554945;}const _0x20ecb5=_0x95f9b9[_0xae6da5(0x1a1)]||'-1d';return this[_0xae6da5(0xa7)](_0x37080a,_0x3f4efa,_0x1d2c15,_0x20ecb5),_0x37080a[_0xae6da5(0x8d)]?0x0:0x1;}[a30_0x266c7f(0xa7)](_0x7221f6,_0xc82361,_0xc0e7c6,_0x11c0b8){const _0x5a4318=a30_0x266c7f;console[_0x5a4318(0x127)]('\x0a'+a30_0x1b0436[_0x5a4318(0xf8)](_0x5a4318(0x139))+'\x20'+_0x7221f6[_0x5a4318(0x199)]),console[_0x5a4318(0x127)]('═'[_0x5a4318(0x145)](0x3c)),this[_0x5a4318(0xb7)](_0x7221f6);if(typeof _0xc82361[_0x5a4318(0x1bc)]==='string'){this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this['displayPreviewHints'](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x1bc),_0xc82361[_0x5a4318(0x1bc)]);return;}if(_0xc82361[_0x5a4318(0x1bc)]===!![]){this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0xc4));return;}if(typeof _0xc82361['behavior']==='string'){this[_0x5a4318(0x98)](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x1d5),_0xc82361[_0x5a4318(0x1d5)]);return;}if(_0xc82361[_0x5a4318(0x1d5)]===!![]){this['displayBehaviorsStats'](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x9a)](_0x7221f6),this[_0x5a4318(0x1e0)](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x16c));return;}this[_0x5a4318(0x100)](_0x7221f6),this[_0x5a4318(0x98)](_0x7221f6,_0x11c0b8),this[_0x5a4318(0x7b)](_0x7221f6),this[_0x5a4318(0x9a)](_0x7221f6),this['displayPreviewHints'](_0xc0e7c6,_0x11c0b8,_0x5a4318(0x152));}[a30_0x266c7f(0x7b)](_0x4bb8fc){displayRealtimeValidation(_0x4bb8fc);}[a30_0x266c7f(0x1e0)](_0x5bb6ab,_0x2dde21,_0xda2cd9,_0x1c879d){const _0x28f32a=a30_0x266c7f;console[_0x28f32a(0x127)]('\x0a'+a30_0x1b0436[_0x28f32a(0x116)]('To\x20view\x20sample\x20data:'));const _0x28f098=_0x2dde21!=='-1d'?'\x20--interval\x20'+_0x2dde21:'';if(_0xda2cd9===_0x28f32a(0x1bc)&&_0x1c879d)console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+_0x28f32a(0x120)+_0x1c879d+'\x22'+_0x28f098));else{if(_0xda2cd9==='behavior'&&_0x1c879d)console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+'\x20--behavior\x20\x22'+_0x1c879d+'\x22'+_0x28f098));else(_0xda2cd9===_0x28f32a(0xc4)||_0xda2cd9==='all')&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)](_0x28f32a(0xa3)+_0x5bb6ab+_0x28f32a(0xf5)+_0x28f098));}(_0xda2cd9===_0x28f32a(0x16c)||_0xda2cd9===_0x28f32a(0x152))&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)]('tdx\x20ps\x20preview\x20'+_0x5bb6ab+_0x28f32a(0x1f3)+_0x28f098)),_0xda2cd9===_0x28f32a(0x152)&&console[_0x28f32a(0x127)]('\x20\x20'+a30_0x1b0436[_0x28f32a(0x116)]('tdx\x20ps\x20preview\x20'+_0x5bb6ab+_0x28f32a(0x10d)+_0x28f098));}[a30_0x266c7f(0xb7)](_0x2b8493){const _0xa8e50=a30_0x266c7f,{master:_0x33c90e}=_0x2b8493,_0x55c070=_0x33c90e['schemaValid']?a30_0x1b0436[_0xa8e50(0x1dc)]('✔'):a30_0x1b0436[_0xa8e50(0x181)]('✘');console[_0xa8e50(0x127)]('\x0a'+a30_0x1b0436[_0xa8e50(0x116)](_0xa8e50(0x16a))),console['error'](_0x55c070+'\x20'+a30_0x1b0436[_0xa8e50(0xf8)](_0x33c90e[_0xa8e50(0x11d)]+'.'+_0x33c90e[_0xa8e50(0xd3)])),_0x33c90e[_0xa8e50(0x1b0)]?_0x33c90e[_0xa8e50(0x7a)]!==undefined&&console[_0xa8e50(0x127)]('\x20\x20'+a30_0x1b0436[_0xa8e50(0x116)](_0xa8e50(0x142))+'\x20'+a30_0x1b0436[_0xa8e50(0x1ba)](formatRows(_0x33c90e['rowCount']))):console[_0xa8e50(0x127)]('\x20\x20'+a30_0x1b0436[_0xa8e50(0x181)]('Error:')+'\x20'+_0x33c90e[_0xa8e50(0x1d1)]);}['displayAttributesStats'](_0x13b229){const _0x4587b0=a30_0x266c7f;if(_0x13b229['attributes'][_0x4587b0(0xa8)]===0x0)return;console[_0x4587b0(0x127)]('\x0a'+a30_0x1b0436['dim']('Attributes'));for(const _0x4dd7d7 of _0x13b229[_0x4587b0(0xc4)]){const _0x7ad7c4=_0x4dd7d7[_0x4587b0(0x1b0)]?a30_0x1b0436[_0x4587b0(0x1dc)]('✔'):a30_0x1b0436[_0x4587b0(0x181)]('✘');let _0x59732c='';if(_0x4dd7d7[_0x4587b0(0x1b0)]&&_0x4dd7d7['matchedCount']!==undefined&&_0x4dd7d7['coveragePercent']!==undefined){const _0x4898b0=_0x4dd7d7['coveragePercent'][_0x4587b0(0x1b6)](0x1),_0x5e5e27=_0x4dd7d7[_0x4587b0(0xb3)]>=0x50?a30_0x1b0436[_0x4587b0(0x1dc)]:_0x4dd7d7[_0x4587b0(0xb3)]>=0x32?a30_0x1b0436[_0x4587b0(0xb2)]:a30_0x1b0436[_0x4587b0(0x181)];_0x59732c='\x20'+a30_0x1b0436['dim'](_0x4587b0(0x1f2))+'\x20'+_0x5e5e27(_0x4898b0+'%')+'\x20('+formatRows(_0x4dd7d7[_0x4587b0(0xdd)])+'\x20rows)';}console['error'](_0x7ad7c4+'\x20'+a30_0x1b0436[_0x4587b0(0xf8)](_0x4dd7d7['name'])+_0x59732c),console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436[_0x4587b0(0x116)](_0x4587b0(0x7e))+'\x20'+a30_0x1b0436['bold'](_0x4dd7d7[_0x4587b0(0x11d)]+'.'+_0x4dd7d7[_0x4587b0(0xd3)]));const _0x3afe4e=_0x4dd7d7['joinKey']===_0x4dd7d7[_0x4587b0(0x131)]?a30_0x1b0436['dim']('Join\x20on:')+'\x20'+_0x4dd7d7[_0x4587b0(0x13d)]:a30_0x1b0436[_0x4587b0(0x116)]('Join:')+'\x20'+_0x4dd7d7[_0x4587b0(0x13d)]+_0x4587b0(0x17a)+_0x4dd7d7[_0x4587b0(0x131)];console[_0x4587b0(0x127)]('\x20\x20'+_0x3afe4e),console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436['dim']('Columns:')),this[_0x4587b0(0x1e6)](_0x4dd7d7[_0x4587b0(0x18c)]),!_0x4dd7d7[_0x4587b0(0x1b0)]&&console[_0x4587b0(0x127)]('\x20\x20'+a30_0x1b0436['red']('Error:')+'\x20'+_0x4dd7d7[_0x4587b0(0x1d1)]);}}[a30_0x266c7f(0x98)](_0x21f123,_0x26792c){const _0x30a6a8=a30_0x266c7f;if(_0x21f123[_0x30a6a8(0x16c)][_0x30a6a8(0xa8)]===0x0)return;console['error']('\x0a'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x97))+'\x20'+a30_0x1b0436[_0x30a6a8(0x116)]('('+_0x26792c+')'));for(const _0x46b8c4 of _0x21f123[_0x30a6a8(0x16c)]){const _0xeb023b=_0x46b8c4['schemaValid']?a30_0x1b0436[_0x30a6a8(0x1dc)]('✔'):a30_0x1b0436['red']('✘');let _0x46cc48='';if(_0x46b8c4[_0x30a6a8(0x1b0)]&&_0x46b8c4[_0x30a6a8(0x171)]!==undefined&&_0x46b8c4[_0x30a6a8(0x1c0)]!==undefined){const _0x189fab=_0x46b8c4[_0x30a6a8(0x16e)]?.['toFixed'](0x1)||'?',_0x3318b5=(_0x46b8c4[_0x30a6a8(0x16e)]??0x0)>=0x32?a30_0x1b0436['green']:(_0x46b8c4['customerPercent']??0x0)>=0x14?a30_0x1b0436[_0x30a6a8(0xb2)]:a30_0x1b0436[_0x30a6a8(0x181)];_0x46cc48='\x20'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x167))+'\x20'+_0x3318b5(formatRows(_0x46b8c4[_0x30a6a8(0x171)]))+'\x20('+_0x189fab+_0x30a6a8(0x1d4)+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x1f6))+'\x20'+a30_0x1b0436[_0x30a6a8(0x1ba)](formatRows(_0x46b8c4[_0x30a6a8(0x1c0)]));}console[_0x30a6a8(0x127)](_0xeb023b+'\x20'+a30_0x1b0436['bold'](_0x46b8c4[_0x30a6a8(0x199)])+_0x46cc48),console['error']('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x116)]('Source:')+'\x20'+a30_0x1b0436[_0x30a6a8(0xf8)](_0x46b8c4[_0x30a6a8(0x11d)]+'.'+_0x46b8c4[_0x30a6a8(0xd3)]));const _0x3127fe=_0x46b8c4['joinKey']===_0x46b8c4[_0x30a6a8(0x131)]?a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x183))+'\x20'+_0x46b8c4[_0x30a6a8(0x13d)]:a30_0x1b0436[_0x30a6a8(0x116)]('Join:')+'\x20'+_0x46b8c4['joinKey']+_0x30a6a8(0x17a)+_0x46b8c4[_0x30a6a8(0x131)];console[_0x30a6a8(0x127)]('\x20\x20'+_0x3127fe),console[_0x30a6a8(0x127)]('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x116)](_0x30a6a8(0x147))),this[_0x30a6a8(0x1e6)](_0x46b8c4['columns']),!_0x46b8c4[_0x30a6a8(0x1b0)]&&console[_0x30a6a8(0x127)]('\x20\x20'+a30_0x1b0436[_0x30a6a8(0x181)](_0x30a6a8(0xf7))+'\x20'+_0x46b8c4['schemaError']);}}[a30_0x266c7f(0x1e6)](_0x4a2fd6){const _0x33c621=a30_0x266c7f;for(const _0x361d57 of _0x4a2fd6){_0x361d57[_0x33c621(0x195)]===_0x361d57[_0x33c621(0x1da)]||_0x361d57['column']==='*'?console['error'](_0x33c621(0x122)+_0x361d57[_0x33c621(0x195)]):console[_0x33c621(0x127)](_0x33c621(0x122)+_0x361d57[_0x33c621(0x195)]+'\x20'+a30_0x1b0436['dim']('('+_0x361d57[_0x33c621(0x1da)]+')'));}}[a30_0x266c7f(0x9a)](_0x407e26){const _0x5e0c7d=a30_0x266c7f;console[_0x5e0c7d(0x127)]('─'[_0x5e0c7d(0x145)](0x3c));if(_0x407e26[_0x5e0c7d(0x1eb)]['length']>0x0){console[_0x5e0c7d(0x127)]('\x0a'+a30_0x1b0436[_0x5e0c7d(0x181)](_0x5e0c7d(0x191)));for(const _0x14453d of _0x407e26[_0x5e0c7d(0x1eb)]){console[_0x5e0c7d(0x127)]('\x20\x20'+a30_0x1b0436[_0x5e0c7d(0x181)]('•')+'\x20'+_0x14453d);}}_0x407e26[_0x5e0c7d(0x8d)]&&console[_0x5e0c7d(0x127)]('\x0a'+a30_0x1b0436['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x12e);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xbc);async[a30_0x266c7f(0xd5)](_0x555a87){const _0x2409d1=a30_0x266c7f,{options:_0x5c4e1d,args:_0x1dc7f7,tdx:_0x10bdbc}=_0x555a87,_0x5989b3=_0x5c4e1d,_0x3bd5e1=_0x1dc7f7[0x0]||_0x5c4e1d[_0x2409d1(0xe6)];if(!_0x3bd5e1)return showParentSegmentNotSetError(_0x2409d1(0x173)+_0x2409d1(0x184)+'Options\x20(one\x20required):\x0a'+_0x2409d1(0x1f5)+_0x2409d1(0x1a4)+_0x2409d1(0x17b)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2409d1(0x1e5)),0x1;if(!_0x5989b3['master']&&!_0x5989b3[_0x2409d1(0x1bc)]&&!_0x5989b3[_0x2409d1(0x1d5)]&&!_0x5989b3[_0x2409d1(0x7f)])return console['error'](a30_0x1b0436['red'](_0x2409d1(0xa1))),console[_0x2409d1(0x127)](_0x2409d1(0xb0)),console[_0x2409d1(0x127)](_0x2409d1(0x15d)),console[_0x2409d1(0x127)](_0x2409d1(0x1d6)),console['error'](_0x2409d1(0x75)),console[_0x2409d1(0x127)](_0x2409d1(0x1d2)),console[_0x2409d1(0x127)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x291b06=resolveYamlFile(_0x3bd5e1);if(!existsSync(_0x291b06))return showFileNotFoundError(_0x291b06,_0x3bd5e1),0x1;_0x5989b3[_0x2409d1(0xb5)]&&(console[_0x2409d1(0x127)](_0x2409d1(0x108)+_0x5989b3[_0x2409d1(0x175)]),console[_0x2409d1(0x127)](_0x2409d1(0xdf)+_0x291b06));let _0x3d689a;try{_0x3d689a=readFileSync(_0x291b06,_0x2409d1(0x90));}catch(_0xd9fdfd){const _0x1e6e2a=_0xd9fdfd instanceof Error?_0xd9fdfd[_0x2409d1(0xa4)]:String(_0xd9fdfd);return console[_0x2409d1(0x127)]('Error\x20reading\x20file:\x20'+_0x1e6e2a),0x1;}let _0x14ac93;try{_0x14ac93=parseDef(_0x3d689a);}catch(_0x4fac9c){const _0x39dc26=_0x4fac9c instanceof Error?_0x4fac9c[_0x2409d1(0xa4)]:String(_0x4fac9c);return console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0x1df)+_0x39dc26)),0x1;}if(_0x5989b3[_0x2409d1(0x1bc)]===!![]||_0x5989b3['attribute']===''){const _0x37ceae=_0x14ac93[_0x2409d1(0xc4)]?.[_0x2409d1(0x178)](_0x3ff6b7=>_0x3ff6b7[_0x2409d1(0x199)])||[];if(_0x37ceae[_0x2409d1(0xa8)]===0x0)console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0x11e)));else{console[_0x2409d1(0x127)](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0xf4))),console['error']('Available\x20attributes:');for(const _0x27961d of _0x37ceae){console['error']('\x20\x20'+a30_0x1b0436[_0x2409d1(0x1ba)](_0x27961d));}console[_0x2409d1(0x127)](_0x2409d1(0x18a)+_0x3bd5e1+'\x20--attribute\x20\x22'+_0x37ceae[0x0]+'\x22');}return 0x1;}if(_0x5989b3[_0x2409d1(0x1d5)]===!![]||_0x5989b3['behavior']===''){const _0x2805df=_0x14ac93[_0x2409d1(0x16c)]?.['map'](_0x2863f4=>_0x2863f4['name'])||[];if(_0x2805df[_0x2409d1(0xa8)]===0x0)console['error'](a30_0x1b0436[_0x2409d1(0x181)](_0x2409d1(0xf9)));else{console['error'](a30_0x1b0436['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x2409d1(0x127)](_0x2409d1(0xf0));for(const _0x33cf45 of _0x2805df){console[_0x2409d1(0x127)]('\x20\x20'+a30_0x1b0436[_0x2409d1(0x1ba)](_0x33cf45));}console['error'](_0x2409d1(0x18a)+_0x3bd5e1+_0x2409d1(0x10a)+_0x2805df[0x0]+'\x22');}return 0x1;}const _0x30e78d=createCommandSpinner(a30_0x1b0436[_0x2409d1(0x116)](_0x2409d1(0x149)),{'verbose':_0x5989b3[_0x2409d1(0xb5)]});_0x30e78d[_0x2409d1(0x192)]();const _0x396760={'onProgress':_0x10cd46=>{_0x30e78d['text']=formatProgressMessage(_0x10cd46);}};if(_0x5989b3[_0x2409d1(0x185)])_0x396760[_0x2409d1(0x185)]=!![];if(_0x5989b3[_0x2409d1(0x1bc)]&&typeof _0x5989b3[_0x2409d1(0x1bc)]==='string')_0x396760['attribute']=_0x5989b3[_0x2409d1(0x1bc)];if(_0x5989b3[_0x2409d1(0x1d5)]&&typeof _0x5989b3[_0x2409d1(0x1d5)]==='string')_0x396760[_0x2409d1(0x1d5)]=_0x5989b3['behavior'];if(_0x5989b3['enriched'])_0x396760[_0x2409d1(0x7f)]=!![];if(_0x5989b3['interval'])_0x396760[_0x2409d1(0x1a1)]=_0x5989b3[_0x2409d1(0x1a1)];let _0x199bf2;try{_0x199bf2=await _0x10bdbc[_0x2409d1(0x105)][_0x2409d1(0x1e9)](_0x3d689a,_0x396760),_0x30e78d['stop']();}catch(_0x1b8c41){_0x30e78d[_0x2409d1(0xf6)]();throw _0x1b8c41;}return await this[_0x2409d1(0x92)](_0x199bf2,{'master':_0x5989b3[_0x2409d1(0x185)],'attribute':typeof _0x5989b3[_0x2409d1(0x1bc)]==='string'?_0x5989b3['attribute']:undefined,'behavior':typeof _0x5989b3[_0x2409d1(0x1d5)]===_0x2409d1(0x9f)?_0x5989b3['behavior']:undefined,'enriched':_0x5989b3[_0x2409d1(0x7f)]}),_0x199bf2['allValid']?0x0:0x1;}async[a30_0x266c7f(0x92)](_0x4b842a,_0x51b590){const _0x396e7f=a30_0x266c7f;console[_0x396e7f(0x127)]('\x0a'+a30_0x1b0436[_0x396e7f(0xf8)](_0x396e7f(0x1c4))+'\x20'+_0x4b842a['name']),console['error']('═'['repeat'](0x3c));if(_0x51b590['master']&&_0x4b842a[_0x396e7f(0x19f)]){const _0x204e9e=a30_0x1b0436['dim'](_0x396e7f(0xe4))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x4b842a[_0x396e7f(0x185)][_0x396e7f(0x11d)]+'.'+_0x4b842a[_0x396e7f(0x185)][_0x396e7f(0xd3)]);await this[_0x396e7f(0x96)](_0x204e9e,_0x4b842a['sampleData']);}else{if(_0x51b590[_0x396e7f(0x1bc)]&&_0x4b842a[_0x396e7f(0x19f)]){const _0x264bde=a30_0x1b0436[_0x396e7f(0x116)](_0x396e7f(0x157))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x51b590[_0x396e7f(0x1bc)]);await this[_0x396e7f(0x96)](_0x264bde,_0x4b842a[_0x396e7f(0x19f)]);}else{if(_0x51b590['behavior']&&_0x4b842a[_0x396e7f(0x19f)]){const _0xfd580f=a30_0x1b0436[_0x396e7f(0x116)](_0x396e7f(0x94))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)](_0x51b590[_0x396e7f(0x1d5)]);await this[_0x396e7f(0x96)](_0xfd580f,_0x4b842a[_0x396e7f(0x19f)]);}else{if(_0x51b590[_0x396e7f(0x7f)]&&_0x4b842a[_0x396e7f(0x19f)]){const _0x46c3aa=a30_0x1b0436['dim'](_0x396e7f(0xb8))+'\x20'+a30_0x1b0436[_0x396e7f(0xf8)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x46c3aa,_0x4b842a[_0x396e7f(0x19f)]);}else!_0x4b842a[_0x396e7f(0x19f)]&&console[_0x396e7f(0x127)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x4b842a[_0x396e7f(0x1eb)][_0x396e7f(0xa8)]>0x0){console[_0x396e7f(0x127)]('─'[_0x396e7f(0x145)](0x3c)),console['error']('\x0a'+a30_0x1b0436['red'](_0x396e7f(0x191)));for(const _0x3f41f9 of _0x4b842a['errors']){console[_0x396e7f(0x127)]('\x20\x20'+a30_0x1b0436[_0x396e7f(0x181)]('•')+'\x20'+_0x3f41f9);}}}async['displaySampleData'](_0x1ecc43,_0x529ba8){const _0x5754ee=a30_0x266c7f;if(_0x529ba8[_0x5754ee(0xa8)]===0x0){console['error']('\x0a'+_0x1ecc43),console[_0x5754ee(0x127)](_0x5754ee(0x138));return;}console[_0x5754ee(0x127)]('\x0a'+_0x1ecc43);const _0x524560=Object[_0x5754ee(0x156)](_0x529ba8[0x0])[_0x5754ee(0x178)](_0x5e48e9=>({'name':_0x5e48e9,'type':typeof _0x529ba8[0x0][_0x5e48e9]===_0x5754ee(0x8b)?_0x5754ee(0x130):_0x5754ee(0xe5)})),_0x2594f6={'queryId':_0x5754ee(0x163),'columns':_0x524560,'data':_0x529ba8,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x529ba8[_0x5754ee(0xa8)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x34aa8a=formatAsTable(_0x2594f6,_0x529ba8['length'],!![]);await writeOutput(_0x34aa8a,undefined,_0x5754ee(0xd3));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x266c7f(0x199)]='segment:parent:run';['description']=a30_0x266c7f(0x126);async[a30_0x266c7f(0xd5)](_0x4396fb){const _0x1238ad=a30_0x266c7f,{options:_0x689bbd,args:_0x4db3cc,tdx:_0x22c48a}=_0x4396fb,_0x26700e=_0x689bbd,_0x1b0fc1=_0x4db3cc[0x0]||_0x689bbd[_0x1238ad(0xe6)];if(!_0x1b0fc1)return showParentSegmentNotSetError(_0x1238ad(0x15e)+_0x1238ad(0x165)),0x1;const _0x46c829=resolveYamlFile(_0x1b0fc1);if(existsSync(_0x46c829)){_0x26700e['verbose']&&console[_0x1238ad(0x127)](_0x1238ad(0xcb)+_0x46c829);let _0x58c001;try{_0x58c001=readFileSync(_0x46c829,_0x1238ad(0x90));}catch(_0x5c3db7){const _0x2e2e85=_0x5c3db7 instanceof Error?_0x5c3db7[_0x1238ad(0xa4)]:String(_0x5c3db7);return console[_0x1238ad(0x127)](_0x1238ad(0x177)+_0x2e2e85),0x1;}const _0x415196=await withSpinner('Analyzing\x20changes...',()=>_0x22c48a[_0x1238ad(0x105)][_0x1238ad(0x14b)](_0x58c001),{'verbose':_0x26700e[_0x1238ad(0xb5)]}),_0x480bd5=_0x415196[_0x1238ad(0xe8)],{isNew:_0x193ad9,name:_0x900375,hasChanges:_0xcaafbf,diffFormatted:_0xe147d4}=_0x480bd5;if(_0xcaafbf){_0x193ad9?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x900375+'\x27:'):console[_0x1238ad(0x127)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x900375+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x1238ad(0x127)](_0xe147d4),console[_0x1238ad(0x127)]('─'[_0x1238ad(0x145)](0x3c));const _0x22844f=_0x193ad9?_0x1238ad(0x78)+_0x900375+_0x1238ad(0x84):_0x1238ad(0x86)+_0x900375+_0x1238ad(0x84);if(!_0x26700e[_0x1238ad(0x190)]){if(!isInteractive())return console[_0x1238ad(0x127)](a30_0x1b0436[_0x1238ad(0x181)]('\x0aError:'),_0x1238ad(0x10c)),console['error'](a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x1d9))),0x1;const _0x4d3e66=await confirmKey(_0x22844f);if(!_0x4d3e66)return console[_0x1238ad(0x127)](a30_0x1b0436[_0x1238ad(0xb2)](_0x1238ad(0x186))),0x1;}const _0x1cd1db=_0x193ad9?'Creating':_0x1238ad(0x193);await withSpinner(_0x1cd1db+_0x1238ad(0xd7)+_0x900375+_0x1238ad(0x76),()=>_0x480bd5[_0x1238ad(0x14f)](),{'verbose':_0x26700e[_0x1238ad(0xb5)]});const _0x3497c8=_0x193ad9?_0x1238ad(0x14c):_0x1238ad(0x9b);console[_0x1238ad(0x127)]('✔\x20'+_0x3497c8+'\x20parent\x20segment\x20\x27'+_0x900375+'\x27');}else console[_0x1238ad(0x127)](_0x1238ad(0xd4)+_0x900375+_0x1238ad(0x188));}const _0x31a4b5=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x1b0fc1+_0x1238ad(0x76),()=>_0x22c48a[_0x1238ad(0x105)][_0x1238ad(0xd0)](_0x1b0fc1),{'verbose':_0x26700e[_0x1238ad(0xb5)]}),_0x276e=_0x31a4b5[_0x1238ad(0xe8)],_0x110f2d=getConsoleUrl(_0x26700e[_0x1238ad(0x175)],'/app/workflows/'+_0x276e['workflowId']+_0x1238ad(0x11b)+_0x276e[_0x1238ad(0x115)]+_0x1238ad(0x79)+_0x276e[_0x1238ad(0xdc)]);return console[_0x1238ad(0x127)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a30_0x1b0436[_0x1238ad(0x116)]('Audience\x20ID:')+'\x20'+_0x276e[_0x1238ad(0x1cd)]),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x125))+'\x20'+_0x276e[_0x1238ad(0x1fc)]),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436['dim']('Session:')+'\x20'+_0x276e['workflowSessionId']),console[_0x1238ad(0x127)]('\x20\x20'+a30_0x1b0436['dim'](_0x1238ad(0x88))+'\x20'+_0x276e[_0x1238ad(0xdc)]),console[_0x1238ad(0x127)]('\x20\x20'+_0x110f2d),console[_0x1238ad(0x127)]('\x0a'+a30_0x1b0436[_0x1238ad(0x116)](_0x1238ad(0x1cc))+_0x1238ad(0x1ab)+_0x276e[_0x1238ad(0xdc)]+_0x1238ad(0x8f)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1f0);[a30_0x266c7f(0xe0)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x567359){const _0x819de0=a30_0x266c7f,{options:_0xad82b6,args:_0x3e9c71,tdx:_0x5c8a2b}=_0x567359,_0x15d7d3=_0x3e9c71[0x0]||_0xad82b6[_0x819de0(0xe6)];if(!_0x15d7d3)return showParentSegmentNotSetError(_0x819de0(0x10b)+_0x819de0(0x1e7)),0x1;_0xad82b6['verbose']&&(console[_0x819de0(0x127)](_0x819de0(0x108)+_0xad82b6[_0x819de0(0x175)]),console[_0x819de0(0x127)]('Parent\x20segment:\x20'+_0x15d7d3));const _0x157015=await withSpinner(_0x819de0(0x113)+_0x15d7d3+'\x27...',()=>_0x5c8a2b[_0x819de0(0x105)][_0x819de0(0x144)](_0x15d7d3),{'verbose':_0xad82b6['verbose']}),_0x4fee4b=_0x157015[_0x819de0(0xe8)];console[_0x819de0(0x127)](_0x819de0(0xb6)+_0x4fee4b[_0x819de0(0xa8)]+_0x819de0(0x10e)+(_0x4fee4b[_0x819de0(0xa8)]!==0x1?'s':''));if(_0xad82b6['json']||_0xad82b6[_0x819de0(0x140)])return await handleSDKOutput(_0x4fee4b,_0xad82b6),0x0;return displayFieldsHumanReadable(_0x4fee4b,_0x15d7d3),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x1ae);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xd9);async[a30_0x266c7f(0xd5)](_0x2fecac){const _0x267c72=a30_0x266c7f,{options:_0x48abde,args:_0x283582,tdx:_0x5ec967}=_0x2fecac,_0x496920=_0x48abde,_0x18c330=_0x283582[0x0]||_0x48abde[_0x267c72(0xe6)];if(!_0x18c330)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x267c72(0x11f)+_0x267c72(0x111)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x48abde[_0x267c72(0xb5)]&&(console[_0x267c72(0x127)](_0x267c72(0x108)+_0x48abde['site']),console[_0x267c72(0x127)](_0x267c72(0x1e4)+_0x18c330));const _0x63e97e=await withSpinner(_0x267c72(0xca)+_0x18c330+_0x267c72(0x76),()=>_0x5ec967[_0x267c72(0x105)][_0x267c72(0x1ee)](_0x18c330),{'verbose':_0x48abde[_0x267c72(0xb5)]}),_0x19fd3e=_0x63e97e[_0x267c72(0xe8)];if(_0x496920['web']){const _0x195268=getConsoleNextUrl(_0x496920[_0x267c72(0x175)],'/app/dw/parentSegments/'+_0x19fd3e['id']);return console[_0x267c72(0x127)](a30_0x1b0436[_0x267c72(0x1dc)]('✔')+_0x267c72(0xec)+a30_0x1b0436[_0x267c72(0x1ba)](_0x195268)),openBrowser(_0x195268),0x0;}return await handleSingleObjectOutput(_0x19fd3e,_0x48abde),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a30_0x266c7f(0x8e);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x198);async[a30_0x266c7f(0xd5)](_0x2cd73a){const _0x347875=a30_0x266c7f,{options:_0x1ec9dc,args:_0x283c9d,tdx:_0xce0632}=_0x2cd73a,_0x5563c0=_0x1ec9dc,_0x210199=_0x283c9d[0x0]||_0x1ec9dc[_0x347875(0xe6)];if(!_0x210199)return showParentSegmentNotSetError(_0x347875(0x1a6)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x347875(0x111)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x1ec9dc[_0x347875(0xb5)]&&(console['error'](_0x347875(0x108)+_0x1ec9dc['site']),console['error'](_0x347875(0x1e4)+_0x210199));const _0x2e1025=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x210199+_0x347875(0x76),()=>_0xce0632['segment'][_0x347875(0x109)](_0x210199),{'verbose':_0x1ec9dc[_0x347875(0xb5)]}),_0x5510d3=_0x2e1025[_0x347875(0xe8)],_0x10c721=_0xce0632['segment'][_0x347875(0x107)](_0x5510d3);if(_0x5563c0[_0x347875(0xe7)]){const _0x497d2a=await this['collectSchema'](_0x2cd73a,_0x210199,_0x5510d3,_0x10c721),_0x4b12bb=this[_0x347875(0x1db)](_0x497d2a);writeFileSync(_0x5563c0['output'],_0x4b12bb);const _0x90bc57=_0x497d2a['customers'][_0x347875(0x18c)][_0x347875(0xa8)]+_0x497d2a[_0x347875(0x16c)][_0x347875(0xea)]((_0x43c718,_0x3328c0)=>_0x43c718+_0x3328c0[_0x347875(0x18c)][_0x347875(0xa8)],0x0),_0x40f24a=_0x497d2a[_0x347875(0x16c)][_0x347875(0x15f)](_0x23ec6e=>_0x23ec6e[_0x347875(0x18c)][_0x347875(0xa8)]===0x0)[_0x347875(0xa8)];return console['log'](_0x347875(0x14e)+_0x5563c0[_0x347875(0xe7)]),console[_0x347875(0x1a7)]('\x20\x20Database:\x20'+_0x10c721),console[_0x347875(0x1a7)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x497d2a[_0x347875(0x16c)][_0x347875(0xa8)]+_0x347875(0x1e2)),console[_0x347875(0x1a7)]('\x20\x20Columns:\x20'+_0x90bc57+'\x20total'),_0x40f24a>0x0&&console[_0x347875(0x1a7)]('\x20\x20Note:\x20'+_0x40f24a+_0x347875(0x1b5)),0x0;}console['error']('\x0a'+a30_0x1b0436[_0x347875(0xf8)](_0x347875(0xf1))+'\x20'+a30_0x1b0436[_0x347875(0x1ba)](_0x10c721));const _0x3b6a79=await withSpinner(_0x347875(0xa2),()=>_0xce0632[_0x347875(0x105)][_0x347875(0xe3)](_0x5510d3),{'verbose':_0x1ec9dc[_0x347875(0xb5)]});console['error']('\x0a'+a30_0x1b0436[_0x347875(0xf8)]('customers')+'\x20'+a30_0x1b0436[_0x347875(0x116)]('('+_0x10c721+_0x347875(0x93)));const _0x14528b=await executeSchemaQuery(_0x3b6a79[_0x347875(0xe8)],_0xce0632,_0x1ec9dc);await handleQueryOutput(_0x14528b,_0x1ec9dc);const _0x1ad9f4=await withSpinner('Fetching\x20behavior\x20list...',()=>_0xce0632['segment'][_0x347875(0x16f)](_0x5510d3),{'verbose':_0x1ec9dc[_0x347875(0xb5)]});for(const _0x39f887 of _0x1ad9f4[_0x347875(0xe8)]){const _0x416856=_0x347875(0x85)+_0x39f887[_0x347875(0x1b7)]()[_0x347875(0x14d)](/\s+/g,'_'),_0x408433=_0x347875(0xf2)+_0x10c721+'.'+_0x416856;console[_0x347875(0x127)]('\x0a'+a30_0x1b0436[_0x347875(0xf8)](_0x39f887)+'\x20'+a30_0x1b0436[_0x347875(0x116)]('('+_0x10c721+'.'+_0x416856+')'));try{const _0x9f9c1a=await executeSchemaQuery(_0x408433,_0xce0632,_0x1ec9dc);await handleQueryOutput(_0x9f9c1a,_0x1ec9dc);}catch{console[_0x347875(0x127)](a30_0x1b0436[_0x347875(0xb2)](_0x347875(0x114)));}}return 0x0;}async[a30_0x266c7f(0x1ac)](_0x51d7e7,_0x2de6ef,_0x8f0cf5,_0x56bd53){const _0x2a5115=a30_0x266c7f,{options:_0x4faaaa,tdx:_0x583c49}=_0x51d7e7,_0x5abb76=await withSpinner(_0x2a5115(0xa2),()=>_0x583c49[_0x2a5115(0x105)][_0x2a5115(0xe3)](_0x8f0cf5),{'verbose':_0x4faaaa[_0x2a5115(0xb5)]}),_0x826b70=await executeSchemaQuery(_0x5abb76[_0x2a5115(0xe8)],_0x583c49,_0x4faaaa),_0x5ae383=_0x826b70[_0x2a5115(0xe8)][_0x2a5115(0x178)](_0xc90c66=>({'name':_0xc90c66[_0x2a5115(0x1de)],'type':_0xc90c66[_0x2a5115(0x1a3)]})),_0x26a06a=await withSpinner(_0x2a5115(0x15a),()=>_0x583c49[_0x2a5115(0x105)][_0x2a5115(0x16f)](_0x8f0cf5),{'verbose':_0x4faaaa[_0x2a5115(0xb5)]}),_0x405f81=[];for(const _0x123a42 of _0x26a06a[_0x2a5115(0xe8)]){const _0x1019b5=_0x2a5115(0x85)+_0x123a42['toLowerCase']()['replace'](/\s+/g,'_'),_0x1d9c43=_0x2a5115(0xf2)+_0x56bd53+'.'+_0x1019b5;let _0x47f2b9=[];try{const _0x2fa752=await executeSchemaQuery(_0x1d9c43,_0x583c49,_0x4faaaa);_0x47f2b9=_0x2fa752['data'][_0x2a5115(0x178)](_0x33675f=>({'name':_0x33675f[_0x2a5115(0x1de)],'type':_0x33675f[_0x2a5115(0x1a3)]}));}catch{}_0x405f81[_0x2a5115(0xf3)]({'table':_0x1019b5,'columns':_0x47f2b9});}return{'database':_0x56bd53,'parent_segment':_0x2de6ef,'parent_id':_0x8f0cf5,'customers':{'table':_0x2a5115(0x81),'columns':_0x5ae383},'behaviors':_0x405f81};}[a30_0x266c7f(0x1db)](_0x5dc1ab){const _0x4b9af0=a30_0x266c7f,_0x49dd68=_0x5931d1=>{const _0x14f713=a30_0x442f;if(_0x5931d1['length']===0x0)return'[]';const _0x3c8c46=_0x5931d1['map'](_0x10140c=>_0x14f713(0xcf)+_0x10140c[_0x14f713(0x199)]+_0x14f713(0x189)+_0x10140c[_0x14f713(0x1aa)]+_0x14f713(0x1bb));return'[\x0a'+_0x3c8c46[_0x14f713(0xed)](',\x0a')+_0x14f713(0x1fd);},_0x2c304f=_0x5dc1ab['behaviors'][_0x4b9af0(0x178)](_0x5f04b=>{const _0x367786=_0x4b9af0;return _0x367786(0x172)+_0x5f04b[_0x367786(0xd3)]+_0x367786(0x95)+_0x49dd68(_0x5f04b[_0x367786(0x18c)])[_0x367786(0x14d)](/^/gm,'\x20\x20')[_0x367786(0x1f8)]()+_0x367786(0x121);})['join'](',\x0a');return _0x4b9af0(0xac)+_0x5dc1ab[_0x4b9af0(0x11d)]+_0x4b9af0(0x1fb)+_0x5dc1ab[_0x4b9af0(0x148)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x5dc1ab['parent_id']+_0x4b9af0(0xbd)+_0x5dc1ab['customers'][_0x4b9af0(0xd3)]+_0x4b9af0(0xee)+_0x49dd68(_0x5dc1ab[_0x4b9af0(0x81)]['columns'])[_0x4b9af0(0x14d)](/^/gm,'\x20\x20')[_0x4b9af0(0x1f8)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x2c304f+_0x4b9af0(0xfc);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']='segment:parent:sql';[a30_0x266c7f(0xe0)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x266c7f(0xd5)](_0x2a2f7e){const _0x1db330=a30_0x266c7f,{options:_0x15b129,args:_0x383149,tdx:_0x11cd28}=_0x2a2f7e,_0x289ff3=_0x383149[0x0]||_0x15b129[_0x1db330(0xe6)];if(!_0x289ff3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x1db330(0x1a0)),0x1;_0x15b129[_0x1db330(0xb5)]&&(console['error'](_0x1db330(0x108)+_0x15b129[_0x1db330(0x175)]),console[_0x1db330(0x127)](_0x1db330(0x1e4)+_0x289ff3));const _0x568454=await withSpinner(_0x1db330(0xb4)+_0x289ff3+_0x1db330(0x76),()=>_0x11cd28[_0x1db330(0x105)][_0x1db330(0x109)](_0x289ff3),{'verbose':_0x15b129[_0x1db330(0xb5)]}),_0x382e2d=_0x568454['data'],_0x3229f6=await withSpinner(_0x1db330(0x136)+_0x289ff3+_0x1db330(0x76),()=>_0x11cd28[_0x1db330(0x105)][_0x1db330(0xe3)](_0x382e2d),{'verbose':_0x15b129[_0x1db330(0xb5)]}),_0x113d1e=_0x3229f6[_0x1db330(0xe8)];return _0x15b129['format']==='json'||_0x15b129[_0x1db330(0xd2)]===_0x1db330(0x140)?await handleSDKOutput([{'sql':_0x113d1e}],_0x15b129):console[_0x1db330(0x1a7)](_0x113d1e),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x13b);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x150);async[a30_0x266c7f(0xd5)](_0x427b03){const _0x3a0193=a30_0x266c7f,{options:_0x300dc0,args:_0x328920,tdx:_0x3af15c}=_0x427b03,_0x563a4c=_0x328920[0x0]||_0x300dc0[_0x3a0193(0xe6)];if(!_0x563a4c)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'+_0x3a0193(0xe9)),0x1;_0x300dc0[_0x3a0193(0xb5)]&&(console[_0x3a0193(0x127)](_0x3a0193(0x108)+_0x300dc0[_0x3a0193(0x175)]),console[_0x3a0193(0x127)]('Parent\x20segment:\x20'+_0x563a4c));const _0x2cd36a=await withSpinner(_0x3a0193(0xb4)+_0x563a4c+'\x27...',()=>_0x3af15c[_0x3a0193(0x105)]['resolveParentId'](_0x563a4c),{'verbose':_0x300dc0[_0x3a0193(0xb5)]}),_0x1563b4=_0x2cd36a[_0x3a0193(0xe8)],_0x5bac5b=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x563a4c+_0x3a0193(0x76),()=>_0x3af15c[_0x3a0193(0x105)]['getParentSQL'](_0x1563b4),{'verbose':_0x300dc0[_0x3a0193(0xb5)]});let _0x2e4ee5=_0x5bac5b[_0x3a0193(0xe8)];const _0xb135f1=resolveLimit(_0x300dc0['limit'],DEFAULT_DISPLAY_LIMIT),_0x1567d4=/\bLIMIT\s+\d+/i[_0x3a0193(0x137)](_0x2e4ee5);!_0x1567d4&&(_0x2e4ee5=_0x2e4ee5['trim']()['replace'](/;+$/,''),_0x2e4ee5=_0x3a0193(0x1c2)+_0x2e4ee5+_0x3a0193(0x1c9)+_0xb135f1);_0x300dc0[_0x3a0193(0xb5)]&&console[_0x3a0193(0x127)](_0x3a0193(0x1b8)+_0x2e4ee5);const _0xe47744=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x2a8239=>{const _0x5e33b4=_0x3a0193,_0x4644e0=await _0x3af15c[_0x5e33b4(0x1b2)][_0x5e33b4(0xd5)](_0x2e4ee5,{'catalog':'td','schema':'information_schema','onJobId':_0x3d15e1=>{_0x2a8239['setJobId'](_0x3d15e1);}});return _0x4644e0;},{'verbose':_0x300dc0[_0x3a0193(0xb5)]}),_0xced3e=_0xe47744[_0x3a0193(0xe8)],_0x106379=_0xced3e['jobId']?_0x3a0193(0xaf)+_0xced3e['jobId']+']':'';return console[_0x3a0193(0x127)](_0x3a0193(0x8a)+_0xced3e['stats']['processedRows']['toLocaleString']()+_0x3a0193(0xde)+(_0x3a0193(0x12f)+formatElapsed(_0xced3e[_0x3a0193(0x151)][_0x3a0193(0x19e)])+_0x106379)),await handleQueryOutput(_0xced3e,_0x300dc0),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x266c7f(0x13c);[a30_0x266c7f(0xe0)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a30_0x266c7f(0xd5)](_0x3f5014){const _0x3918cb=a30_0x266c7f,{options:_0x31625a,args:_0x1d1f77,tdx:_0x3eb7f8}=_0x3f5014,_0x5471b5=_0x1d1f77[0x0],_0x136c60=await withSpinner(_0x5471b5?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x5471b5+_0x3918cb(0x76):_0x3918cb(0x132),()=>_0x3eb7f8[_0x3918cb(0x7c)]['list'](),{'verbose':_0x31625a[_0x3918cb(0xb5)]});let _0x5910fe=_0x136c60[_0x3918cb(0xe8)][_0x3918cb(0x15f)](_0x186313=>_0x186313['realtime_enabled']);if(_0x5471b5){const _0x340f7a=_0x5471b5[_0x3918cb(0x14d)](/[.+^${}()|[\]\\]/g,_0x3918cb(0x161))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x197225=new RegExp('^'+_0x340f7a+'$','i');_0x5910fe=_0x5910fe[_0x3918cb(0x15f)](_0x8b4c46=>_0x197225['test'](_0x8b4c46['name']));}_0x5910fe[_0x3918cb(0x83)]((_0x223ea1,_0x1dd85a)=>_0x223ea1[_0x3918cb(0x199)][_0x3918cb(0x166)](_0x1dd85a['name'])),console['error'](_0x3918cb(0xb6)+_0x5910fe[_0x3918cb(0xa8)]+_0x3918cb(0x1dd)+(_0x5910fe[_0x3918cb(0xa8)]!==0x1?'s':''));const _0x191ccc=_0x29dac5=>{const _0x2a33f0=_0x3918cb;return getConsoleNextUrl(_0x31625a[_0x2a33f0(0x175)],'/app/dw/parentSegments/'+_0x29dac5);};if(_0x31625a[_0x3918cb(0xd2)]===_0x3918cb(0xae)||_0x31625a[_0x3918cb(0xd2)]===_0x3918cb(0x140)){const _0x1c32c7=_0x5910fe[_0x3918cb(0x178)](_0x431618=>({..._0x431618,'url':_0x191ccc(_0x431618['id'])}));await handleSDKOutput(_0x1c32c7,_0x31625a);}else{if(_0x5910fe[_0x3918cb(0xa8)]===0x0)console[_0x3918cb(0x1a7)](_0x3918cb(0x1bf));else for(const _0x2404b8 of _0x5910fe){const _0x534e1e=_0x2404b8['population']?a30_0x1b0436[_0x3918cb(0x116)]('\x20('+formatRows(_0x2404b8['population'])+')'):'',_0x302246=hyperlink(_0x2404b8['name'],_0x191ccc(_0x2404b8['id']));console['log']('⚡\x20'+_0x302246+_0x534e1e);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']='ps:rt:validate';[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x187);async['execute'](_0x47e75f){const _0x137d0b=a30_0x266c7f,{options:_0x2ae378,args:_0x1ce852,tdx:_0x2506bd}=_0x47e75f,_0x1a2a13=_0x1ce852[0x0]||_0x2ae378[_0x137d0b(0xe6)];if(!_0x1a2a13)return showParentSegmentNotSetError(_0x137d0b(0x1a9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x299f4e=resolveYamlFile(_0x1a2a13);if(!existsSync(_0x299f4e))return showFileNotFoundError(_0x299f4e,_0x1a2a13),0x1;let _0x3cf7b5;try{_0x3cf7b5=readFileSync(_0x299f4e,'utf-8');}catch(_0x1d5ee5){const _0x559384=_0x1d5ee5 instanceof Error?_0x1d5ee5[_0x137d0b(0xa4)]:String(_0x1d5ee5);return console['error'](_0x137d0b(0x177)+_0x559384),0x1;}const _0x3f3623=createCommandSpinner(a30_0x1b0436[_0x137d0b(0x116)]('Validating\x20RT\x20configuration...'),{'verbose':_0x2ae378['verbose']});_0x3f3623[_0x137d0b(0x192)]();const _0x5e60e5={'realtime':!![],'onProgress':_0x22abd0=>{_0x3f3623['text']=formatProgressMessage(_0x22abd0);}};let _0x145f01;try{_0x145f01=await _0x2506bd[_0x137d0b(0x105)][_0x137d0b(0x168)](_0x3cf7b5,_0x5e60e5),_0x3f3623[_0x137d0b(0xf6)]();}catch(_0x1c0203){_0x3f3623['stop']();throw _0x1c0203;}console['error']('\x0a'+a30_0x1b0436[_0x137d0b(0xf8)](_0x137d0b(0x146))+'\x20'+_0x145f01[_0x137d0b(0x199)]),console[_0x137d0b(0x127)]('═'[_0x137d0b(0x145)](0x3c)),displayRealtimeValidation(_0x145f01),console[_0x137d0b(0x127)]('─'[_0x137d0b(0x145)](0x3c));if(_0x145f01[_0x137d0b(0x1eb)][_0x137d0b(0xa8)]>0x0){console[_0x137d0b(0x127)]('\x0a'+a30_0x1b0436[_0x137d0b(0x181)](_0x137d0b(0x191)));for(const _0x5bdd5e of _0x145f01[_0x137d0b(0x1eb)]){console[_0x137d0b(0x127)]('\x20\x20'+a30_0x1b0436[_0x137d0b(0x181)]('•')+'\x20'+_0x5bdd5e);}}return _0x145f01['allValid']&&console[_0x137d0b(0x127)]('\x0a'+a30_0x1b0436[_0x137d0b(0x1dc)]('✔')+_0x137d0b(0x128)),_0x145f01['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x266c7f(0x199)]=a30_0x266c7f(0x18b);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0xe1);async[a30_0x266c7f(0xd5)](_0x396c15){const _0x2908a0=a30_0x266c7f,{options:_0x23d63f,args:_0x3d491b,tdx:_0x2bfd61}=_0x396c15,_0x7ee574=_0x3d491b[0x0]||_0x23d63f[_0x2908a0(0xe6)];if(!_0x7ee574)return showParentSegmentNotSetError(_0x2908a0(0x1cb)+'\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 _0x9c68a9=await withSpinner(_0x2908a0(0xb4)+_0x7ee574+_0x2908a0(0x76),()=>_0x2bfd61[_0x2908a0(0x105)][_0x2908a0(0x109)](_0x7ee574),{'verbose':_0x23d63f[_0x2908a0(0xb5)]}),_0x821aee=_0x9c68a9['data'],_0x5cf8a0=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x7ee574+'\x27...',()=>_0x2bfd61[_0x2908a0(0x13f)][_0x2908a0(0x129)](_0x821aee),{'verbose':_0x23d63f[_0x2908a0(0xb5)]}),_0x560a64=_0x5cf8a0[_0x2908a0(0xe8)];console[_0x2908a0(0x127)](_0x2908a0(0xb6)+_0x560a64[_0x2908a0(0xa8)]+_0x2908a0(0x110)+(_0x560a64[_0x2908a0(0xa8)]!==0x1?'s':''));if(_0x23d63f[_0x2908a0(0xd2)]===_0x2908a0(0xae)||_0x23d63f[_0x2908a0(0xd2)]===_0x2908a0(0x140))await handleSDKOutput(_0x560a64,_0x23d63f);else{if(_0x560a64[_0x2908a0(0xa8)]===0x0)console[_0x2908a0(0x1a7)](_0x2908a0(0xc0)),console[_0x2908a0(0x127)](a30_0x1b0436['cyan'](_0x2908a0(0x196)));else for(const _0x5ede97 of _0x560a64){const _0x20e724=_0x5ede97['sections']?.[_0x2908a0(0xa8)]||0x0,_0x144625=_0x5ede97[_0x2908a0(0x174)]?a30_0x1b0436[_0x2908a0(0x116)](_0x2908a0(0xbb)+_0x5ede97[_0x2908a0(0x174)]):'',_0x2fb10b=a30_0x1b0436['dim']('\x20('+_0x20e724+_0x2908a0(0x19d)+(_0x20e724!==0x1?'s':'')+')');console[_0x2908a0(0x1a7)]('\x20\x20'+_0x5ede97[_0x2908a0(0x199)]+_0x144625+_0x2fb10b),_0x5ede97['description']&&console[_0x2908a0(0x1a7)]('\x20\x20\x20\x20'+a30_0x1b0436[_0x2908a0(0x116)](_0x5ede97[_0x2908a0(0xe0)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x266c7f(0x1af);[a30_0x266c7f(0xe0)]=a30_0x266c7f(0x15b);async[a30_0x266c7f(0xd5)](_0x481464){const _0x16981f=a30_0x266c7f,{options:_0x47a097,args:_0x2c1d32}=_0x481464,_0x1410ce=_0x2c1d32[0x0]||_0x47a097[_0x16981f(0xe6)];if(!_0x1410ce)return showParentSegmentNotSetError(_0x16981f(0xc5)+_0x16981f(0x1ec)),0x1;const _0x1a5110=resolveYamlFile(_0x1410ce);if(!existsSync(_0x1a5110))return showFileNotFoundError(_0x1a5110,_0x1410ce),0x1;let _0xcd4737;try{_0xcd4737=readFileSync(_0x1a5110,_0x16981f(0x90));}catch(_0xea1036){const _0x4eca16=_0xea1036 instanceof Error?_0xea1036[_0x16981f(0xa4)]:String(_0xea1036);return console[_0x16981f(0x127)]('Error\x20reading\x20file:\x20'+_0x4eca16),0x1;}let _0x419855;try{_0x419855=parseDef(_0xcd4737);}catch(_0xde8b0e){const _0x9abf37=_0xde8b0e instanceof Error?_0xde8b0e['message']:String(_0xde8b0e);return console[_0x16981f(0x127)](a30_0x1b0436['red'](_0x16981f(0x1df)+_0x9abf37)),0x1;}if(_0x419855[_0x16981f(0xda)]&&_0x419855[_0x16981f(0xda)][_0x16981f(0xa8)]>0x0)return console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0xb2)](_0x16981f(0x176)+_0x1a5110)),console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x116)]('\x20\x20\x20'+_0x419855[_0x16981f(0xda)][_0x16981f(0xa8)]+'\x20service(s)\x20configured')),0x1;!_0x419855[_0x16981f(0x7c)]&&(_0x419855[_0x16981f(0x7c)]={'events':[{'name':_0x16981f(0x135),'source_table':_0x16981f(0xa5)}],'attributes':[{'name':_0x16981f(0xbf),'type':'single'}],'id_stitching':{'primary_key':_0x419855['master'][_0x16981f(0xd3)]==='customers'?_0x16981f(0x1c3):'user_id'}});_0x419855[_0x16981f(0xda)]=[{'name':_0x16981f(0x170),'description':'Personalization\x20service\x20description','trigger_event':_0x16981f(0x135),'sections':[{'name':_0x16981f(0x112),'criteria':_0x16981f(0x103),'attributes':[_0x16981f(0xbf)]}]}];const _0xc4476f=serializeDef(_0x419855);return writeFileSync(_0x1a5110,_0xc4476f,_0x16981f(0x90)),console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x1dc)]('✔')+_0x16981f(0x18f)+a30_0x1b0436[_0x16981f(0x1ba)](_0x1a5110)),(!_0x419855['realtime']||_0xcd4737[_0x16981f(0x1b1)](_0x16981f(0xad))===-0x1)&&console[_0x16981f(0x127)](a30_0x1b0436[_0x16981f(0x1dc)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console['error']('\x0a'+a30_0x1b0436['dim'](_0x16981f(0x155))),console[_0x16981f(0x127)](_0x16981f(0x197)+_0x1a5110+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x16981f(0x127)](_0x16981f(0x159)+a30_0x1b0436[_0x16981f(0x116)](_0x16981f(0x104)+_0x1410ce)+_0x16981f(0xa0)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x32edd9=a31_0xf18c;(function(_0x5c7d44,_0x4033e7){const _0x3318cc=a31_0xf18c,_0x58573d=_0x5c7d44();while(!![]){try{const _0x1222a0=-parseInt(_0x3318cc(0x1d5))/0x1*(parseInt(_0x3318cc(0x165))/0x2)+-parseInt(_0x3318cc(0x1c7))/0x3*(parseInt(_0x3318cc(0x191))/0x4)+parseInt(_0x3318cc(0x19e))/0x5+parseInt(_0x3318cc(0x171))/0x6*(-parseInt(_0x3318cc(0x1b3))/0x7)+-parseInt(_0x3318cc(0x1b5))/0x8*(parseInt(_0x3318cc(0x1c8))/0x9)+parseInt(_0x3318cc(0x1c6))/0xa+parseInt(_0x3318cc(0x1be))/0xb;if(_0x1222a0===_0x4033e7)break;else _0x58573d['push'](_0x58573d['shift']());}catch(_0x498525){_0x58573d['push'](_0x58573d['shift']());}}}(a31_0x39f5,0x2efc3));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x19f50d 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';function a31_0x39f5(){const _0x33e5b4=['30233opPcsL','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','8bmiNxy','\x0aAvailable\x20profiles:','getUserInfo','jobs','trim','message','log','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','9164837avlsDv','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','length','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20created','validate','Profile\x20name\x20cannot\x20be\x20empty','3372550DysFTO','560826eCnXua','2386899tMHpBM','Unknown\x20key\x20\x27','create','\x0aOperation\x20cancelled','llm_project','Operation\x20cancelled','password','error','name','dim','Removal\x20cancelled','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','10083GVFWAV','\x27\x20does\x20not\x20exist.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','54VyGvYW','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','API\x20key\x20cannot\x20be\x20empty','✗\x20Validation\x20failed:\x20','execute','Session\x20profile\x20set\x20to:\x20','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','\x20\x20-\x20','green','includes','510ShYnXr','profile','Validating\x20API\x20key...','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','(cleared)','\x0aSetup\x20cancelled','yellow','us01','bold','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','text','email','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20create','config','warn','tdx:\x20profile\x20remove','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Enter\x20your\x20TD\x20API\x20key:','\x27\x20updated:\x20','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','split','\x27.\x0a\x0aValid\x20keys:\x20','Set\x20a\x20profile\x20configuration\x20value','Enter\x20description\x20(optional):','confirm','join','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','site','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','8RMwZox','Remove\x20a\x20profile','oauth','Set\x20session\x20profile','apiKey','Choose\x20authentication\x20method:','description','Changing\x20site\x20to\x20\x27','database','apikey','tdx.json','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Create\x20a\x20new\x20profile','1502400bXIpfQ','status','Enter\x20profile\x20name:','red','default','/app/mp/ak','VALID_KEYS','OAuth\x20(browser\x20login)','profile:create','profileName','\x27\x20removed\x20from\x20configuration','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20Profile\x20\x27','ERROR','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x20--default\x27\x20to\x20save\x20permanently','session','method','llm_agent','(session:\x20','\x20\x20tdx\x20--profile\x20'];a31_0x39f5=function(){return _0x33e5b4;};return a31_0x39f5();}function a31_0xf18c(_0x3e0c97,_0x100ce0){_0x3e0c97=_0x3e0c97-0x165;const _0x39f5bc=a31_0x39f5();let _0xf18c62=_0x39f5bc[_0x3e0c97];return _0xf18c62;}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_0x4a7d1f from'prompts';import a31_0x41ec54 from'chalk';function validateProfileName(_0x39aba8){const _0x1c17f8=a31_0xf18c;if(!_0x39aba8||!_0x39aba8[_0x1c17f8(0x1b9)]())return _0x1c17f8(0x1c5);const _0xbba545=_0x39aba8['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0xbba545))return _0x1c17f8(0x17d);if(profileExists(_0xbba545))return _0x1c17f8(0x185)+_0xbba545+_0x1c17f8(0x1d7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x32edd9(0x1d0)]=a31_0x32edd9(0x1a6);[a31_0x32edd9(0x197)]=a31_0x32edd9(0x19d);async[a31_0x32edd9(0x169)](_0x320b8c){const _0xd642=a31_0x32edd9,{options:_0x3c737d,args:_0x421329}=_0x320b8c;console['log'](a31_0x41ec54[_0xd642(0x179)](_0xd642(0x17e)));let _0x4f588b;if(_0x421329['length']>0x0&&_0x421329[0x0]){const _0x59ab81=_0x421329[0x0][_0xd642(0x1b9)](),_0x2793d3=validateProfileName(_0x59ab81);if(_0x2793d3!==!![])return console[_0xd642(0x1cf)](a31_0x41ec54[_0xd642(0x1a1)](_0x2793d3)),0x1;_0x4f588b=_0x59ab81;}else{const _0xf89bc8=await a31_0x4a7d1f({'type':'text','name':'profileName','message':_0xd642(0x1a0),'validate':validateProfileName});if(!_0xf89bc8[_0xd642(0x1a7)])return console[_0xd642(0x1bb)](_0xd642(0x176)),0x1;_0x4f588b=_0xf89bc8[_0xd642(0x1a7)]['trim']();}const _0x25222a=await a31_0x4a7d1f({'type':_0xd642(0x17b),'name':_0xd642(0x197),'message':_0xd642(0x18a)}),_0x5ab0b4=_0x25222a['description']?.[_0xd642(0x1b9)]()||undefined,_0x2a5fe1=_0x3c737d[_0xd642(0x18e)]||_0xd642(0x178),_0x3be46f=await promptSiteSelection(_0x2a5fe1,_0x4f588b,'Setup\x20cancelled');if(!_0x3be46f)return 0x1;const _0x6e1955=resolveSite(_0x3be46f);if(isOAuthSupported(_0x6e1955)){const _0x303c7c=await a31_0x4a7d1f({'type':'select','name':_0xd642(0x1af),'message':_0xd642(0x196),'choices':[{'title':_0xd642(0x1a5),'value':_0xd642(0x193)},{'title':'API\x20Key','value':_0xd642(0x19a)}]});if(!_0x303c7c[_0xd642(0x1af)])return console['log'](_0xd642(0x176)),0x1;if(_0x303c7c[_0xd642(0x1af)]===_0xd642(0x193)){if(_0x5ab0b4){const _0x4d962f={'site':_0x6e1955,'description':_0x5ab0b4};saveProfileToUserConfig(_0x4f588b,_0x4d962f);}return await runOAuthLoginFlow(_0x6e1955,_0x4f588b,_0x3c737d[_0xd642(0x1d3)]??LogLevel[_0xd642(0x1ab)]),0x0;}}console[_0xd642(0x1bb)](_0xd642(0x17a)+_0x6e1955),console[_0xd642(0x1bb)](_0xd642(0x1bc)),console[_0xd642(0x1bb)]('\x20\x20'+getConsoleUrl(_0x6e1955,_0xd642(0x1a3)));const _0x477737=await a31_0x4a7d1f({'type':_0xd642(0x1ce),'name':_0xd642(0x195),'message':_0xd642(0x183),'validate':_0xc1c15=>{if(!_0xc1c15||!_0xc1c15['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x477737[_0xd642(0x195)])return console[_0xd642(0x1bb)](_0xd642(0x176)),0x1;const _0x19a502=_0x477737[_0xd642(0x195)];console[_0xd642(0x1bb)](_0xd642(0x173));try{const _0x31cc8d=TDX[_0xd642(0x1ca)]({'site':_0x6e1955,'apiKey':_0x19a502[_0xd642(0x1b9)](),'logLevel':_0x3c737d[_0xd642(0x1d3)]??LogLevel[_0xd642(0x1ab)]}),_0x534281=await _0x31cc8d[_0xd642(0x1b8)][_0xd642(0x1b7)]();console[_0xd642(0x1bb)](a31_0x41ec54['green']('✓')+_0xd642(0x1c1)+_0x534281[_0xd642(0x17c)]+')');const _0x2b307a=await isKeychainAvailable();_0x2b307a?(await saveAPIKeyAsync(_0x19a502[_0xd642(0x1b9)](),_0x6e1955,_0x4f588b),console['log'](a31_0x41ec54[_0xd642(0x16f)]('✓')+_0xd642(0x166)+_0x4f588b+')')):(console['warn'](a31_0x41ec54[_0xd642(0x177)](_0xd642(0x1d4))),console[_0xd642(0x180)](a31_0x41ec54[_0xd642(0x177)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xd38545={'site':_0x6e1955,..._0x5ab0b4&&{'description':_0x5ab0b4}};return saveProfileToUserConfig(_0x4f588b,_0xd38545),console[_0xd642(0x1bb)](a31_0x41ec54[_0xd642(0x16f)]('✓')+'\x20Profile\x20\x27'+_0x4f588b+_0xd642(0x1c3)),console[_0xd642(0x1bb)](),console[_0xd642(0x1bb)](_0xd642(0x1bf)),console[_0xd642(0x1bb)](_0xd642(0x1b2)+_0x4f588b+_0xd642(0x186)),console[_0xd642(0x1bb)]('\x20\x20tdx\x20--profile\x20'+_0x4f588b+_0xd642(0x19c)),0x0;}catch(_0x154b76){if(_0x154b76 instanceof HTTPClientError&&_0x154b76['status']===0x191)return printAuthError(_0x154b76),0x1;return console['error'](a31_0x41ec54[_0xd642(0x1a1)](_0xd642(0x168)+(_0x154b76 instanceof Error?_0x154b76[_0xd642(0x1ba)]:String(_0x154b76)))),console[_0xd642(0x1cf)](_0xd642(0x182)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']='profile:remove';[a31_0x32edd9(0x197)]=a31_0x32edd9(0x192);[a31_0x32edd9(0x1c4)](_0x25f555){const _0x4ed797=a31_0x32edd9,{args:_0x34075d}=_0x25f555;if(_0x34075d[_0x4ed797(0x1c0)]===0x0)return _0x4ed797(0x1bd);return undefined;}async[a31_0x32edd9(0x169)](_0x429232){const _0x52f541=a31_0x32edd9,{args:_0xa69c0a}=_0x429232,_0x4d112d=_0xa69c0a[0x0];console[_0x52f541(0x1bb)](a31_0x41ec54[_0x52f541(0x179)](_0x52f541(0x181)));if(!profileExists(_0x4d112d)){console[_0x52f541(0x1cf)](a31_0x41ec54[_0x52f541(0x1a1)]('Profile\x20\x27'+_0x4d112d+'\x27\x20does\x20not\x20exist.')),console['log'](_0x52f541(0x1b6));const _0x38c8a8=listProfiles();if(_0x38c8a8[_0x52f541(0x1c0)]===0x0)console[_0x52f541(0x1bb)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x541389 of _0x38c8a8){console[_0x52f541(0x1bb)](_0x52f541(0x16e)+_0x541389[_0x52f541(0x1d0)]);}return 0x1;}const _0x232efc=await a31_0x4a7d1f({'type':_0x52f541(0x18b),'name':_0x52f541(0x18b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4d112d+'\x27?','initial':![]});if(!_0x232efc[_0x52f541(0x18b)])return console['log'](_0x52f541(0x1d2)),0x0;try{removeProfileFromUserConfig(_0x4d112d),console[_0x52f541(0x1bb)](a31_0x41ec54['green']('✓')+_0x52f541(0x1aa)+_0x4d112d+_0x52f541(0x1a8));}catch(_0x5dfb60){return console[_0x52f541(0x1cf)](a31_0x41ec54[_0x52f541(0x1a1)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5dfb60 instanceof Error?_0x5dfb60[_0x52f541(0x1ba)]:String(_0x5dfb60)))),0x1;}const _0x2c1081=await isKeychainAvailable();if(_0x2c1081){const _0x5c3b2c=await deleteKeychainAPIKey(_0x4d112d);_0x5c3b2c&&console[_0x52f541(0x1bb)](a31_0x41ec54[_0x52f541(0x16f)]('✓')+_0x52f541(0x1ac));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x32edd9(0x1d0)]=a31_0x32edd9(0x16b);[a31_0x32edd9(0x197)]=a31_0x32edd9(0x189);static [a31_0x32edd9(0x1a4)]=['site',a31_0x32edd9(0x199),'parent_segment',a31_0x32edd9(0x1cc),a31_0x32edd9(0x1b0),a31_0x32edd9(0x197)];['validate'](_0x490efb){const _0x530005=a31_0x32edd9,{args:_0x29b5d4,options:_0xd7f5dc}=_0x490efb,_0x26dbf1=_0xd7f5dc[_0x530005(0x172)]||getActiveProfile();if(!_0x26dbf1)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(_0x29b5d4[_0x530005(0x1c0)]===0x0)return _0x530005(0x174)+ProfileSetCommand[_0x530005(0x1a4)]['join'](',\x20');const _0x31d544=_0x29b5d4[0x0];if(!_0x31d544[_0x530005(0x170)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x530005(0x1a4)]['join'](',\x20');const [_0x167b9a]=_0x31d544[_0x530005(0x187)]('=',0x2);if(!ProfileSetCommand[_0x530005(0x1a4)]['includes'](_0x167b9a))return _0x530005(0x1c9)+_0x167b9a+_0x530005(0x188)+ProfileSetCommand[_0x530005(0x1a4)][_0x530005(0x18c)](',\x20');return undefined;}async[a31_0x32edd9(0x169)](_0x34a864){const _0x22542f=a31_0x32edd9,{args:_0x154ba6,options:_0x1043c2}=_0x34a864,_0x4faf34=_0x1043c2[_0x22542f(0x172)]||getActiveProfile(),[_0x103f3a,..._0x5b3451]=_0x154ba6[0x0][_0x22542f(0x187)]('='),_0x5783fe=_0x5b3451[_0x22542f(0x18c)]('=');console['log'](a31_0x41ec54[_0x22542f(0x179)]('tdx:\x20profile\x20set'));if(!profileExists(_0x4faf34)){const _0x401b59=await a31_0x4a7d1f({'type':_0x22542f(0x18b),'name':_0x22542f(0x1ca),'message':_0x22542f(0x185)+_0x4faf34+_0x22542f(0x18f),'initial':!![]});if(!_0x401b59[_0x22542f(0x1ca)])return console[_0x22542f(0x1bb)](_0x22542f(0x1cd)),0x1;}const _0x480995=loadProfile(_0x4faf34),_0x534edc=_0x480995?.[_0x22542f(0x17f)]||{};if(_0x103f3a===_0x22542f(0x18e)){const _0x10f48d=resolveSite(_0x5783fe);console['log'](_0x22542f(0x198)+_0x10f48d+_0x22542f(0x1c2)),console['log'](_0x22542f(0x1a9)),console['log']('\x20\x20'+getConsoleUrl(_0x10f48d,_0x22542f(0x1a3)));const _0x32e6b2=await a31_0x4a7d1f({'type':'password','name':_0x22542f(0x195),'message':_0x22542f(0x18d),'validate':_0x3cb7f2=>{const _0x21cf25=_0x22542f;if(!_0x3cb7f2||!_0x3cb7f2[_0x21cf25(0x1b9)]())return _0x21cf25(0x167);return!![];}});if(!_0x32e6b2[_0x22542f(0x195)])return console['log'](_0x22542f(0x1cb)),0x1;console[_0x22542f(0x1bb)](_0x22542f(0x173));try{const _0x6694bc=TDX[_0x22542f(0x1ca)]({'site':_0x10f48d,'apiKey':_0x32e6b2['apiKey'][_0x22542f(0x1b9)](),'logLevel':_0x1043c2[_0x22542f(0x1d3)]??LogLevel[_0x22542f(0x1ab)]}),_0x195e61=await _0x6694bc[_0x22542f(0x1b8)][_0x22542f(0x1b7)]();console['log'](a31_0x41ec54['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x195e61[_0x22542f(0x17c)]+')');const _0xabacdf=await isKeychainAvailable();_0xabacdf?(await saveAPIKeyAsync(_0x32e6b2['apiKey'][_0x22542f(0x1b9)](),_0x10f48d,_0x4faf34),console[_0x22542f(0x1bb)](a31_0x41ec54[_0x22542f(0x16f)]('✓')+_0x22542f(0x16c))):console[_0x22542f(0x180)](a31_0x41ec54[_0x22542f(0x177)](_0x22542f(0x1d4))),_0x534edc[_0x22542f(0x18e)]=_0x10f48d;}catch(_0x472ba5){if(_0x472ba5 instanceof HTTPClientError&&_0x472ba5[_0x22542f(0x19f)]===0x191)return printAuthError(_0x472ba5),0x1;return console[_0x22542f(0x1cf)](a31_0x41ec54['red']('✗\x20Validation\x20failed:\x20'+(_0x472ba5 instanceof Error?_0x472ba5[_0x22542f(0x1ba)]:String(_0x472ba5)))),console[_0x22542f(0x1cf)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x534edc[_0x103f3a]=_0x5783fe||undefined;return saveProfileToUserConfig(_0x4faf34,_0x534edc),console[_0x22542f(0x1bb)](a31_0x41ec54[_0x22542f(0x16f)]('✓')+_0x22542f(0x1aa)+_0x4faf34+_0x22542f(0x184)+_0x103f3a+'='+(_0x5783fe||_0x22542f(0x175))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x32edd9(0x1d0)]='profile:use';[a31_0x32edd9(0x197)]=a31_0x32edd9(0x194);[a31_0x32edd9(0x1c4)](_0x217bc0){const _0x246a9f=a31_0x32edd9,{args:_0x3c678a}=_0x217bc0;if(_0x3c678a['length']===0x0)return _0x246a9f(0x1b4);return undefined;}async[a31_0x32edd9(0x169)](_0x32f594){const _0x15d59c=a31_0x32edd9,{args:_0x4de084,options:_0xbc658d}=_0x32f594,_0x35df6c=_0x4de084[0x0],_0xd65ae4=_0xbc658d[_0x15d59c(0x1a2)];cleanExpiredSessions();if(!profileExists(_0x35df6c)){console['error'](a31_0x41ec54['red']('Profile\x20\x27'+_0x35df6c+_0x15d59c(0x1d6))),console[_0x15d59c(0x1bb)](_0x15d59c(0x1b6));const _0x384d18=listProfiles();if(_0x384d18['length']===0x0)console[_0x15d59c(0x1bb)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x4c776d of _0x384d18){console['log']('\x20\x20-\x20'+_0x4c776d[_0x15d59c(0x1d0)]);}return 0x1;}if(_0xd65ae4){const _0x3f5427=a31_0x19f50d['join'](getConfigDir(),_0x15d59c(0x19b));return saveActiveProfileToUserConfig(_0x35df6c),console['log'](_0x15d59c(0x16d)+a31_0x41ec54[_0x15d59c(0x16f)](_0x35df6c)),console[_0x15d59c(0x1bb)](a31_0x41ec54[_0x15d59c(0x1d1)]('\x0aSaved\x20to:\x20'+_0x3f5427)),0x0;}const _0x462384=getSessionID(_0xbc658d[_0x15d59c(0x1ae)]);return saveSessionContext({'profile':_0x35df6c},_0xbc658d[_0x15d59c(0x1ae)]),console[_0x15d59c(0x1bb)](_0x15d59c(0x16a)+a31_0x41ec54['green'](_0x35df6c)+'\x20'+a31_0x41ec54[_0x15d59c(0x1d1)](_0x15d59c(0x1b1)+_0x462384+')')),console[_0x15d59c(0x1bb)](a31_0x41ec54['dim'](_0x15d59c(0x190)+_0x35df6c+_0x15d59c(0x1ad))),0x0;}}
|
|
1
|
+
const a31_0x5308d9=a31_0x218f;(function(_0x18d3ee,_0x18d24c){const _0x156e54=a31_0x218f,_0x1d8782=_0x18d3ee();while(!![]){try{const _0x11d51d=-parseInt(_0x156e54(0xe8))/0x1*(parseInt(_0x156e54(0xec))/0x2)+parseInt(_0x156e54(0xf1))/0x3+-parseInt(_0x156e54(0xc7))/0x4*(-parseInt(_0x156e54(0xcc))/0x5)+parseInt(_0x156e54(0x89))/0x6+parseInt(_0x156e54(0x94))/0x7*(-parseInt(_0x156e54(0xef))/0x8)+-parseInt(_0x156e54(0x7f))/0x9+parseInt(_0x156e54(0xe2))/0xa*(parseInt(_0x156e54(0x91))/0xb);if(_0x11d51d===_0x18d24c)break;else _0x1d8782['push'](_0x1d8782['shift']());}catch(_0x1ef393){_0x1d8782['push'](_0x1d8782['shift']());}}}(a31_0x1c2e,0x77f6a));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x1c6f0d 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';function a31_0x1c2e(){const _0x411e13=['\x27\x20created','Profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','create','profile:remove','/app/mp/ak','\x20API\x20key\x20saved\x20to\x20system\x20keychain','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:set','session','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','password','Setup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20(no\x20profiles\x20found)','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Default\x20profile\x20set\x20to:\x20','validate','red','log','join','ERROR','\x0aSetup\x20cancelled','logLevel','jobs','\x20API\x20key\x20removed\x20from\x20system\x20keychain','llm_project','tdx.json','OAuth\x20(browser\x20login)','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.','\x20API\x20key\x20is\x20valid\x20(User:\x20','split','includes','message','length','execute','Session\x20profile\x20set\x20to:\x20','getUserInfo','name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','API\x20Key','error','Operation\x20cancelled','\x27\x20does\x20not\x20exist.\x20Create\x20it?','3700yEDiim','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','You\x20can\x20find\x20your\x20API\x20key\x20at:','llm_agent','profileName','4495sGvepq','Enter\x20description\x20(optional):','profile','API\x20key\x20cannot\x20be\x20empty','Choose\x20authentication\x20method:','VALID_KEYS','Unknown\x20key\x20\x27','yellow','parent_segment','Failed\x20to\x20remove\x20profile:\x20','Remove\x20a\x20profile','apiKey','Validating\x20API\x20key...','confirm','\x27\x20updated:\x20','select','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','text','warn','site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','test','410hFkYUJ','trim','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Set\x20a\x20profile\x20configuration\x20value','122pvxCsl','green','method','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','10592VYZXLD','Enter\x20profile\x20name:','Set\x20session\x20profile','24otNPhE','Profile\x20name\x20cannot\x20be\x20empty','33183cBhgFt','\x27.\x0a\x0aValid\x20keys:\x20','default','8621829VtErGb','Site\x20was\x20not\x20changed.','✗\x20Validation\x20failed:\x20','description','profile:create','bold','profile:use','Removal\x20cancelled','oauth','email','764616XKmuHT','\x0aAvailable\x20profiles:','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','apikey','\x0aOperation\x20cancelled','dim','\x20\x20-\x20','config','350515lkyTyL','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','422506HyJtCb'];a31_0x1c2e=function(){return _0x411e13;};return a31_0x1c2e();}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_0x1dea08 from'prompts';import a31_0x5021cd from'chalk';function validateProfileName(_0x217988){const _0x2be375=a31_0x218f;if(!_0x217988||!_0x217988[_0x2be375(0xe3)]())return _0x2be375(0xf0);const _0x3ad839=_0x217988['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x2be375(0xe1)](_0x3ad839))return _0x2be375(0xeb);if(profileExists(_0x3ad839))return _0x2be375(0x96)+_0x3ad839+_0x2be375(0xe4);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a31_0x5308d9(0x83);[a31_0x5308d9(0x82)]='Create\x20a\x20new\x20profile';async[a31_0x5308d9(0xbe)](_0x11945b){const _0x18520f=a31_0x5308d9,{options:_0x42811a,args:_0x22e8fe}=_0x11945b;console[_0x18520f(0xad)](a31_0x5021cd['bold'](_0x18520f(0xb7)));let _0x36da8c;if(_0x22e8fe['length']>0x0&&_0x22e8fe[0x0]){const _0x21e37b=_0x22e8fe[0x0][_0x18520f(0xe3)](),_0x363794=validateProfileName(_0x21e37b);if(_0x363794!==!![])return console[_0x18520f(0xc4)](a31_0x5021cd[_0x18520f(0xac)](_0x363794)),0x1;_0x36da8c=_0x21e37b;}else{const _0xa80655=await a31_0x1dea08({'type':_0x18520f(0xdd),'name':'profileName','message':_0x18520f(0xed),'validate':validateProfileName});if(!_0xa80655['profileName'])return console[_0x18520f(0xad)](_0x18520f(0xb0)),0x1;_0x36da8c=_0xa80655[_0x18520f(0xcb)][_0x18520f(0xe3)]();}const _0x266371=await a31_0x1dea08({'type':_0x18520f(0xdd),'name':'description','message':_0x18520f(0xcd)}),_0xd99d00=_0x266371[_0x18520f(0x82)]?.[_0x18520f(0xe3)]()||undefined,_0x5278fc=_0x42811a[_0x18520f(0xdf)]||'us01',_0x21f522=await promptSiteSelection(_0x5278fc,_0x36da8c,_0x18520f(0xa5));if(!_0x21f522)return 0x1;const _0x5850f8=resolveSite(_0x21f522);if(isOAuthSupported(_0x5850f8)){const _0xcaf03f=await a31_0x1dea08({'type':_0x18520f(0xdb),'name':_0x18520f(0xea),'message':_0x18520f(0xd0),'choices':[{'title':_0x18520f(0xb6),'value':_0x18520f(0x87)},{'title':_0x18520f(0xc3),'value':_0x18520f(0x8c)}]});if(!_0xcaf03f[_0x18520f(0xea)])return console['log'](_0x18520f(0xb0)),0x1;if(_0xcaf03f[_0x18520f(0xea)]==='oauth'){if(_0xd99d00){const _0x5b56bf={'site':_0x5850f8,'description':_0xd99d00};saveProfileToUserConfig(_0x36da8c,_0x5b56bf);}return await runOAuthLoginFlow(_0x5850f8,_0x36da8c,_0x42811a['logLevel']??LogLevel[_0x18520f(0xaf)]),0x0;}}console[_0x18520f(0xad)](_0x18520f(0xdc)+_0x5850f8),console[_0x18520f(0xad)](_0x18520f(0xc9)),console[_0x18520f(0xad)]('\x20\x20'+getConsoleUrl(_0x5850f8,_0x18520f(0x9c)));const _0x1a42d6=await a31_0x1dea08({'type':_0x18520f(0xa4),'name':_0x18520f(0xd7),'message':_0x18520f(0x92),'validate':_0x3fdab9=>{const _0x2bc954=_0x18520f;if(!_0x3fdab9||!_0x3fdab9[_0x2bc954(0xe3)]())return _0x2bc954(0xcf);return!![];}});if(!_0x1a42d6[_0x18520f(0xd7)])return console['log'](_0x18520f(0xb0)),0x1;const _0x3a4785=_0x1a42d6[_0x18520f(0xd7)];console[_0x18520f(0xad)](_0x18520f(0xd8));try{const _0x5ceae8=TDX['create']({'site':_0x5850f8,'apiKey':_0x3a4785[_0x18520f(0xe3)](),'logLevel':_0x42811a[_0x18520f(0xb1)]??LogLevel[_0x18520f(0xaf)]}),_0x325358=await _0x5ceae8[_0x18520f(0xb2)]['getUserInfo']();console[_0x18520f(0xad)](a31_0x5021cd['green']('✓')+_0x18520f(0xb9)+_0x325358[_0x18520f(0x88)]+')');const _0x1aeffe=await isKeychainAvailable();_0x1aeffe?(await saveAPIKeyAsync(_0x3a4785[_0x18520f(0xe3)](),_0x5850f8,_0x36da8c),console['log'](a31_0x5021cd[_0x18520f(0xe9)]('✓')+_0x18520f(0xa1)+_0x36da8c+')')):(console['warn'](a31_0x5021cd['yellow'](_0x18520f(0xa7))),console['warn'](a31_0x5021cd[_0x18520f(0xd3)](_0x18520f(0xe0))));const _0x2b29a3={'site':_0x5850f8,..._0xd99d00&&{'description':_0xd99d00}};return saveProfileToUserConfig(_0x36da8c,_0x2b29a3),console[_0x18520f(0xad)](a31_0x5021cd[_0x18520f(0xe9)]('✓')+_0x18520f(0x93)+_0x36da8c+_0x18520f(0x95)),console[_0x18520f(0xad)](),console[_0x18520f(0xad)](_0x18520f(0x9e)),console['log'](_0x18520f(0x97)+_0x36da8c+_0x18520f(0xe6)),console[_0x18520f(0xad)]('\x20\x20tdx\x20--profile\x20'+_0x36da8c+_0x18520f(0xc2)),0x0;}catch(_0x4fb05d){if(_0x4fb05d instanceof HTTPClientError&&_0x4fb05d['status']===0x191)return printAuthError(_0x4fb05d),0x1;return console['error'](a31_0x5021cd[_0x18520f(0xac)](_0x18520f(0x81)+(_0x4fb05d instanceof Error?_0x4fb05d['message']:String(_0x4fb05d)))),console[_0x18520f(0xc4)](_0x18520f(0xa9)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x9b);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xd6);[a31_0x5308d9(0xab)](_0x3f2daa){const _0x5bf14b=a31_0x5308d9,{args:_0x4df116}=_0x3f2daa;if(_0x4df116['length']===0x0)return _0x5bf14b(0xe5);return undefined;}async[a31_0x5308d9(0xbe)](_0x36df09){const _0x129418=a31_0x5308d9,{args:_0x415c93}=_0x36df09,_0xbca90=_0x415c93[0x0];console['log'](a31_0x5021cd[_0x129418(0x84)](_0x129418(0xa3)));if(!profileExists(_0xbca90)){console[_0x129418(0xc4)](a31_0x5021cd[_0x129418(0xac)](_0x129418(0x96)+_0xbca90+'\x27\x20does\x20not\x20exist.')),console[_0x129418(0xad)](_0x129418(0x8a));const _0x179f96=listProfiles();if(_0x179f96[_0x129418(0xbd)]===0x0)console[_0x129418(0xad)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x39ca04 of _0x179f96){console[_0x129418(0xad)](_0x129418(0x8f)+_0x39ca04[_0x129418(0xc1)]);}return 0x1;}const _0x1b9354=await a31_0x1dea08({'type':_0x129418(0xd9),'name':_0x129418(0xd9),'message':_0x129418(0x8b)+_0xbca90+'\x27?','initial':![]});if(!_0x1b9354[_0x129418(0xd9)])return console['log'](_0x129418(0x86)),0x0;try{removeProfileFromUserConfig(_0xbca90),console['log'](a31_0x5021cd[_0x129418(0xe9)]('✓')+_0x129418(0x93)+_0xbca90+_0x129418(0xa2));}catch(_0x114ffe){return console[_0x129418(0xc4)](a31_0x5021cd[_0x129418(0xac)](_0x129418(0xd5)+(_0x114ffe instanceof Error?_0x114ffe[_0x129418(0xbc)]:String(_0x114ffe)))),0x1;}const _0x300132=await isKeychainAvailable();if(_0x300132){const _0xab7aaf=await deleteKeychainAPIKey(_0xbca90);_0xab7aaf&&console['log'](a31_0x5021cd[_0x129418(0xe9)]('✓')+_0x129418(0xb3));}return 0x0;}}function a31_0x218f(_0x4a12b1,_0x1ac7e1){_0x4a12b1=_0x4a12b1-0x7f;const _0x1c2e1a=a31_0x1c2e();let _0x218f72=_0x1c2e1a[_0x4a12b1];return _0x218f72;}export class ProfileSetCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x9f);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xe7);static [a31_0x5308d9(0xd1)]=[a31_0x5308d9(0xdf),'database',a31_0x5308d9(0xd4),a31_0x5308d9(0xb4),a31_0x5308d9(0xca),a31_0x5308d9(0x82)];[a31_0x5308d9(0xab)](_0x48c5c8){const _0x56f51e=a31_0x5308d9,{args:_0x2fe7f3,options:_0x520ce6}=_0x48c5c8,_0x491163=_0x520ce6[_0x56f51e(0xce)]||getActiveProfile();if(!_0x491163)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(_0x2fe7f3[_0x56f51e(0xbd)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56f51e(0xd1)][_0x56f51e(0xae)](',\x20');const _0x29fc6e=_0x2fe7f3[0x0];if(!_0x29fc6e[_0x56f51e(0xbb)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x56f51e(0xd1)][_0x56f51e(0xae)](',\x20');const [_0x247c38]=_0x29fc6e[_0x56f51e(0xba)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x56f51e(0xbb)](_0x247c38))return _0x56f51e(0xd2)+_0x247c38+_0x56f51e(0xf2)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a31_0x5308d9(0xbe)](_0x2ef26f){const _0x459581=a31_0x5308d9,{args:_0x40e902,options:_0xd52e6c}=_0x2ef26f,_0x466184=_0xd52e6c[_0x459581(0xce)]||getActiveProfile(),[_0x450c8f,..._0x166313]=_0x40e902[0x0][_0x459581(0xba)]('='),_0x49084b=_0x166313['join']('=');console[_0x459581(0xad)](a31_0x5021cd['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x466184)){const _0x584d8f=await a31_0x1dea08({'type':_0x459581(0xd9),'name':_0x459581(0x9a),'message':_0x459581(0x96)+_0x466184+_0x459581(0xc6),'initial':!![]});if(!_0x584d8f[_0x459581(0x9a)])return console[_0x459581(0xad)](_0x459581(0xc5)),0x1;}const _0x29bf5c=loadProfile(_0x466184),_0x181bba=_0x29bf5c?.[_0x459581(0x90)]||{};if(_0x450c8f===_0x459581(0xdf)){const _0x585a00=resolveSite(_0x49084b);console[_0x459581(0xad)]('Changing\x20site\x20to\x20\x27'+_0x585a00+_0x459581(0x98)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x459581(0xad)]('\x20\x20'+getConsoleUrl(_0x585a00,_0x459581(0x9c)));const _0x452fcd=await a31_0x1dea08({'type':_0x459581(0xa4),'name':_0x459581(0xd7),'message':_0x459581(0xc8),'validate':_0x2c7a04=>{const _0x432b41=_0x459581;if(!_0x2c7a04||!_0x2c7a04[_0x432b41(0xe3)]())return _0x432b41(0xcf);return!![];}});if(!_0x452fcd[_0x459581(0xd7)])return console[_0x459581(0xad)](_0x459581(0x8d)),0x1;console['log'](_0x459581(0xd8));try{const _0x209d03=TDX[_0x459581(0x9a)]({'site':_0x585a00,'apiKey':_0x452fcd[_0x459581(0xd7)][_0x459581(0xe3)](),'logLevel':_0xd52e6c[_0x459581(0xb1)]??LogLevel[_0x459581(0xaf)]}),_0x7d6ac1=await _0x209d03[_0x459581(0xb2)][_0x459581(0xc0)]();console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0xb9)+_0x7d6ac1[_0x459581(0x88)]+')');const _0x3e406c=await isKeychainAvailable();_0x3e406c?(await saveAPIKeyAsync(_0x452fcd['apiKey'][_0x459581(0xe3)](),_0x585a00,_0x466184),console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0x9d))):console[_0x459581(0xde)](a31_0x5021cd[_0x459581(0xd3)](_0x459581(0xa7))),_0x181bba[_0x459581(0xdf)]=_0x585a00;}catch(_0x5a86a0){if(_0x5a86a0 instanceof HTTPClientError&&_0x5a86a0['status']===0x191)return printAuthError(_0x5a86a0),0x1;return console['error'](a31_0x5021cd['red'](_0x459581(0x81)+(_0x5a86a0 instanceof Error?_0x5a86a0[_0x459581(0xbc)]:String(_0x5a86a0)))),console['error'](_0x459581(0x80)),0x1;}}else _0x181bba[_0x450c8f]=_0x49084b||undefined;return saveProfileToUserConfig(_0x466184,_0x181bba),console[_0x459581(0xad)](a31_0x5021cd[_0x459581(0xe9)]('✓')+_0x459581(0x93)+_0x466184+_0x459581(0xda)+_0x450c8f+'='+(_0x49084b||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x5308d9(0xc1)]=a31_0x5308d9(0x85);[a31_0x5308d9(0x82)]=a31_0x5308d9(0xee);['validate'](_0x9e11d8){const {args:_0x5ab2d2}=_0x9e11d8;if(_0x5ab2d2['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a31_0x5308d9(0xbe)](_0x4a3186){const _0xe5446e=a31_0x5308d9,{args:_0xa99820,options:_0x213a8c}=_0x4a3186,_0x2f03b7=_0xa99820[0x0],_0x5a279e=_0x213a8c[_0xe5446e(0xf3)];cleanExpiredSessions();if(!profileExists(_0x2f03b7)){console[_0xe5446e(0xc4)](a31_0x5021cd[_0xe5446e(0xac)]('Profile\x20\x27'+_0x2f03b7+_0xe5446e(0xb8))),console[_0xe5446e(0xad)](_0xe5446e(0x8a));const _0x201f55=listProfiles();if(_0x201f55[_0xe5446e(0xbd)]===0x0)console[_0xe5446e(0xad)](_0xe5446e(0xa8));else for(const _0x3a1cfd of _0x201f55){console[_0xe5446e(0xad)](_0xe5446e(0x8f)+_0x3a1cfd['name']);}return 0x1;}if(_0x5a279e){const _0x5716a5=a31_0x1c6f0d[_0xe5446e(0xae)](getConfigDir(),_0xe5446e(0xb5));return saveActiveProfileToUserConfig(_0x2f03b7),console['log'](_0xe5446e(0xaa)+a31_0x5021cd['green'](_0x2f03b7)),console[_0xe5446e(0xad)](a31_0x5021cd[_0xe5446e(0x8e)]('\x0aSaved\x20to:\x20'+_0x5716a5)),0x0;}const _0x334d7a=getSessionID(_0x213a8c[_0xe5446e(0xa0)]);return saveSessionContext({'profile':_0x2f03b7},_0x213a8c[_0xe5446e(0xa0)]),console[_0xe5446e(0xad)](_0xe5446e(0xbf)+a31_0x5021cd[_0xe5446e(0xe9)](_0x2f03b7)+'\x20'+a31_0x5021cd[_0xe5446e(0x8e)]('(session:\x20'+_0x334d7a+')')),console[_0xe5446e(0xad)](a31_0x5021cd[_0xe5446e(0x8e)](_0xe5446e(0x99)+_0x2f03b7+_0xe5446e(0xa6))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a32_0xfb87(){const _0x25f45f=['name','4XPJmED','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','7204616gqWIlV','52956boAnhh','👤\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1293537fykoso','config','12dEGvkr','map','scope','site','25ymBmdS','1273233sDbYQL','Error:\x20','profiles','3420290rJTmtt','log','description','13276989jZbaUq','error','45YSMMuF','2822810qBOUPZ'];a32_0xfb87=function(){return _0x25f45f;};return a32_0xfb87();}const a32_0xa41afa=a32_0x1221;(function(_0x5e0108,_0x211918){const _0x32b862=a32_0x1221,_0x5c5da6=_0x5e0108();while(!![]){try{const _0x257fc5=parseInt(_0x32b862(0x1bc))/0x1*(-parseInt(_0x32b862(0x1b3))/0x2)+-parseInt(_0x32b862(0x1bd))/0x3*(-parseInt(_0x32b862(0x1af))/0x4)+parseInt(_0x32b862(0x1a7))/0x5+parseInt(_0x32b862(0x1b8))/0x6*(-parseInt(_0x32b862(0x1b6))/0x7)+parseInt(_0x32b862(0x1b2))/0x8+-parseInt(_0x32b862(0x1ac))/0x9*(parseInt(_0x32b862(0x1ad))/0xa)+parseInt(_0x32b862(0x1aa))/0xb;if(_0x257fc5===_0x211918)break;else _0x5c5da6['push'](_0x5c5da6['shift']());}catch(_0x119a7){_0x5c5da6['push'](_0x5c5da6['shift']());}}}(a32_0xfb87,0xbcbf4));function a32_0x1221(_0x4edaf5,_0x102bd9){_0x4edaf5=_0x4edaf5-0x1a6;const _0xfb870b=a32_0xfb87();let _0x1221f8=_0xfb870b[_0x4edaf5];return _0x1221f8;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0xaccab5 from'chalk';export class ProfilesCommand extends BaseCommand{[a32_0xa41afa(0x1ae)]=a32_0xa41afa(0x1a6);['description']='List\x20all\x20available\x20profiles';async['execute'](_0x444451){const _0x40c148=a32_0xa41afa,{options:_0x1adda2}=_0x444451;try{const _0x109dd8=listProfiles(),_0x4c2acc=getActiveProfile();if(_0x109dd8[_0x40c148(0x1b0)]===0x0)return console[_0x40c148(0x1a8)](_0x40c148(0x1b1)),console[_0x40c148(0x1a8)](_0x40c148(0x1b5)),console[_0x40c148(0x1a8)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x613e26=_0x109dd8[_0x40c148(0x1b9)](_0x5d4bd8=>{const _0x411abc=_0x40c148,_0x52a041=_0x5d4bd8[_0x411abc(0x1ae)]===_0x4c2acc,_0x2829e3=getProfileParams(_0x5d4bd8[_0x411abc(0x1b7)]);return{'name':_0x5d4bd8[_0x411abc(0x1ae)],'active':_0x52a041,'scope':_0x5d4bd8[_0x411abc(0x1ba)],'description':_0x5d4bd8[_0x411abc(0x1b7)][_0x411abc(0x1a9)]||'','params':_0x2829e3};});if(isStructuredFormat(_0x1adda2))await handleSDKOutput(_0x613e26,_0x1adda2);else for(const _0xc7fed0 of _0x109dd8){const _0x552f21=_0xc7fed0['name']===_0x4c2acc?a32_0xaccab5['green']('\x20✓'):'',_0x58d46e=_0xc7fed0['config'][_0x40c148(0x1bb)]?a32_0xaccab5['dim']('\x20'+_0xc7fed0[_0x40c148(0x1b7)]['site']):'',_0x29936c=_0xc7fed0[_0x40c148(0x1b7)]['description']?a32_0xaccab5['dim']('\x20\x20'+_0xc7fed0[_0x40c148(0x1b7)][_0x40c148(0x1a9)]):'';console[_0x40c148(0x1a8)](_0x40c148(0x1b4)+_0xc7fed0[_0x40c148(0x1ae)]+_0x552f21+_0x58d46e+_0x29936c);}return 0x0;}catch(_0x1cd4e4){return _0x1cd4e4 instanceof Error&&console[_0x40c148(0x1ab)](_0x40c148(0x1be)+_0x1cd4e4['message']),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x2e40c9=a33_0x3f62;(function(_0x43a028,_0x178ea2){const _0x144a47=a33_0x3f62,_0x3ac2ca=_0x43a028();while(!![]){try{const _0x3c2eb8=parseInt(_0x144a47(0xf5))/0x1*(parseInt(_0x144a47(0x10f))/0x2)+parseInt(_0x144a47(0x10a))/0x3*(parseInt(_0x144a47(0xf6))/0x4)+-parseInt(_0x144a47(0xe3))/0x5*(parseInt(_0x144a47(0xea))/0x6)+-parseInt(_0x144a47(0x101))/0x7*(-parseInt(_0x144a47(0xf7))/0x8)+parseInt(_0x144a47(0x103))/0x9+-parseInt(_0x144a47(0xe5))/0xa*(-parseInt(_0x144a47(0x10d))/0xb)+parseInt(_0x144a47(0xf9))/0xc*(-parseInt(_0x144a47(0xe2))/0xd);if(_0x3c2eb8===_0x178ea2)break;else _0x3ac2ca['push'](_0x3ac2ca['shift']());}catch(_0x527b8b){_0x3ac2ca['push'](_0x3ac2ca['shift']());}}}(a33_0x539e,0x4d0cd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x2e40c9(0xeb)]='query';[a33_0x2e40c9(0xe7)]=a33_0x2e40c9(0x108);async[a33_0x2e40c9(0x10c)](_0x1d0e4e){const _0x28dace=a33_0x2e40c9,{options:_0x4a9eb5,args:_0x4475c4,tdx:_0x222f68}=_0x1d0e4e,_0x27fe37={..._0x4a9eb5,'limitStructuredFormats':!![]},_0x404889=_0x4475c4[0x0],_0x12c44a=_0x4a9eb5['file'];let _0x464c78;try{if(_0x12c44a)_0x464c78=readSqlStatementsFromFile(_0x12c44a);else{if(_0x404889==='-')_0x464c78=await readSqlStatementsFromStdin();else{if(_0x404889&&isSqlFilePath(_0x404889))_0x464c78=readSqlStatementsFromFile(_0x404889);else{if(_0x404889)_0x464c78=splitSqlStatements(_0x404889);else throw new Error(_0x28dace(0xf8));}}}}catch(_0x376733){return console[_0x28dace(0x10b)](_0x28dace(0xf3)+_0x376733[_0x28dace(0x107)]),0x1;}const _0x4c77cf=_0x4a9eb5['database']||_0x28dace(0xe9),_0x2facdd=_0x4a9eb5[_0x28dace(0xec)];try{const _0x43af52=[],_0x1c8b55=!!_0x4a9eb5[_0x28dace(0xe1)];for(let _0x187dae=0x0;_0x187dae<_0x464c78[_0x28dace(0x104)];_0x187dae++){const _0x540783=_0x464c78[_0x187dae],_0xe5bc5d=_0x187dae+0x1,_0x1131a7=_0x464c78['length'],_0x4c3628=_0x1131a7>0x1;_0x4a9eb5['verbose']&&(console['error']('\x0a'+(_0x4c3628?_0x28dace(0x105)+_0xe5bc5d+'/'+_0x1131a7+':':'')),console[_0x28dace(0x10b)](_0x28dace(0x118)+_0x4a9eb5[_0x28dace(0xe6)]),console[_0x28dace(0x10b)](_0x28dace(0xee)+(_0x2facdd||'td')),console[_0x28dace(0x10b)](_0x28dace(0x116)+_0x4c77cf),console['error'](_0x28dace(0x113)+_0x540783));const _0x4f2e60=_0x4c3628?_0x28dace(0xfb)+_0xe5bc5d+'/'+_0x1131a7+_0x28dace(0x10e):_0x28dace(0xe8);try{const _0x526e45=await withProgressSpinner(_0x4f2e60,async _0x47f551=>{const _0x5255cc=_0x28dace,_0x369539=await _0x222f68[_0x5255cc(0xfd)]['execute'](_0x540783,{'catalog':_0x2facdd,'schema':_0x4c77cf,'onJobId':_0x19a42e=>{const _0x2e03fd=_0x5255cc;_0x47f551[_0x2e03fd(0xfa)](_0x19a42e);},'onProgress':_0x4a30af=>{const _0x49a1f5=_0x5255cc;_0x47f551[_0x49a1f5(0xfe)]('Executing\x20query\x20['+_0x4a30af[_0x49a1f5(0x102)]+']'),_0x47f551[_0x49a1f5(0x111)](formatRows(_0x4a30af[_0x49a1f5(0x109)])+'\x20rows\x20'+_0x4a30af[_0x49a1f5(0xf0)]+'/'+_0x4a30af[_0x49a1f5(0xf1)]+'\x20splits');}});return _0x369539;},{'verbose':_0x4a9eb5['verbose']}),_0x9cfe81=_0x526e45[_0x28dace(0x110)],_0x44f558=_0x9cfe81[_0x28dace(0x115)]?'\x20[Job\x20ID:\x20'+_0x9cfe81[_0x28dace(0x115)]+']':'',_0x4046bf=_0x4c3628?'Statement\x20'+_0xe5bc5d+'/'+_0x1131a7+_0x28dace(0xfc):'';console['error']('✔\x20'+_0x4046bf+'Query\x20completed:\x20Processed\x20'+formatRows(_0x9cfe81[_0x28dace(0xe4)]['processedRows'])+_0x28dace(0xf2)+('in\x20'+formatElapsed(_0x9cfe81[_0x28dace(0xe4)][_0x28dace(0xef)])+_0x44f558));if(_0x4c3628&&_0x1c8b55){const _0x403c5e=resolveOutputOptions(_0x27fe37),_0x2cda85=await formatQueryOutput(_0x9cfe81,_0x403c5e);_0x43af52[_0x28dace(0xff)](_0x2cda85);}else await handleQueryOutput(_0x9cfe81,_0x27fe37);}catch(_0xdd0739){const _0x26d229=_0x4c3628?'Statement\x20'+_0xe5bc5d+'/'+_0x1131a7+':\x0a':'',_0x28aabb=_0xdd0739 instanceof SDKError?_0xdd0739[_0x28dace(0xf4)]:_0xdd0739[_0x28dace(0x107)];return console['error'](''+_0x26d229+_0x28aabb),0x1;}}if(_0x464c78[_0x28dace(0x104)]>0x1&&_0x1c8b55&&_0x43af52['length']>0x0){const _0x193a46=_0x43af52['join']('\x0a');writeFileSync(_0x4a9eb5[_0x28dace(0xe1)],_0x193a46),console[_0x28dace(0x10b)](_0x28dace(0xed)+_0x4a9eb5[_0x28dace(0xe1)]);}return 0x0;}catch(_0x3a52b8){throw _0x3a52b8;}}[a33_0x2e40c9(0x112)](_0x3c43ad){const _0x1ca24f=a33_0x2e40c9,_0x564c22=_0x3c43ad[_0x1ca24f(0x114)][0x0],_0x14fa67=_0x3c43ad[_0x1ca24f(0x100)]['file'];if(!_0x564c22&&!_0x14fa67)return _0x1ca24f(0x117);if(_0x564c22&&_0x14fa67)return _0x1ca24f(0x106);return undefined;}}function a33_0x3f62(_0x1892a5,_0x27f568){_0x1892a5=_0x1892a5-0xe1;const _0x539e9e=a33_0x539e();let _0x3f624e=_0x539e9e[_0x1892a5];return _0x3f624e;}function a33_0x539e(){const _0x1c02c5=['length','Statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','message','Run\x20Trino\x20queries\x20(streaming)','processedRows','57966KZPRAW','error','execute','1518GFoMLD','...','26RoeyHy','data','setExtra','validate','SQL:\x20','args','jobId','Schema:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Site:\x20','output','13ePdUfB','94175Zilvzg','stats','19160iDFReF','site','description','Executing\x20query...','information_schema','150pouwZa','name','catalog','\x0aAll\x20results\x20saved\x20to\x20','Catalog:\x20','elapsedTimeMillis','completedSplits','totalSplits','\x20rows\x20','Error:\x20','originalMessage','17771KYoSuu','32KLUIoK','8csrXDo','No\x20SQL\x20provided','3167460rBGqjm','setJobId','Executing\x20statement\x20','\x20-\x20','query','setPhase','push','options','2567278hscGrz','state','302994UlgaZT'];a33_0x539e=function(){return _0x1c02c5;};return a33_0x539e();}
|