@treasuredata/tdx 0.25.6 → 0.25.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.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/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/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/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.d.ts +7 -0
- package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/cdp-api-client.js.map +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-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.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.d.ts +19 -0
- package/dist/sdk/segment/journey-validator.d.ts.map +1 -0
- package/dist/sdk/segment/journey-validator.js +1 -0
- package/dist/sdk/segment/journey-validator.js.map +1 -0
- package/dist/sdk/segment/journey-yaml.d.ts.map +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.d.ts +42 -0
- package/dist/sdk/segment/push-recovery.d.ts.map +1 -0
- package/dist/sdk/segment/push-recovery.js +1 -0
- package/dist/sdk/segment/push-recovery.js.map +1 -0
- package/dist/sdk/segment/push-workflow.d.ts +18 -12
- package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js.map +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/segment-def.d.ts +2 -0
- package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
- package/dist/sdk/segment/validate-files.d.ts.map +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/validate-files.js.map +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts +7 -7
- package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +1 -1
- package/dist/sdk/segment.d.ts +5 -0
- package/dist/sdk/segment.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/types/cdp.d.ts +117 -0
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/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/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x471e2c=a22_0x561c;(function(_0x478c9a,_0x266819){const _0x3d71e8=a22_0x561c,_0x17957e=_0x478c9a();while(!![]){try{const _0x23ab85=-parseInt(_0x3d71e8(0x11d))/0x1+parseInt(_0x3d71e8(0xa4))/0x2*(-parseInt(_0x3d71e8(0x6d))/0x3)+-parseInt(_0x3d71e8(0x1a6))/0x4*(parseInt(_0x3d71e8(0x80))/0x5)+parseInt(_0x3d71e8(0x175))/0x6*(parseInt(_0x3d71e8(0x164))/0x7)+-parseInt(_0x3d71e8(0x159))/0x8+parseInt(_0x3d71e8(0xc7))/0x9+parseInt(_0x3d71e8(0x93))/0xa;if(_0x23ab85===_0x266819)break;else _0x17957e['push'](_0x17957e['shift']());}catch(_0x164368){_0x17957e['push'](_0x17957e['shift']());}}}(a22_0xd7a1,0x86464));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x49c75b from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x2cb6ba from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x471e2c(0xbe),LEGACY_PARENT_SEGMENT_DIR=a22_0x471e2c(0x12f);function a22_0x561c(_0x5a7008,_0x25fb8e){_0x5a7008=_0x5a7008-0x6c;const _0xd7a108=a22_0xd7a1();let _0x561c48=_0xd7a108[_0x5a7008];return _0x561c48;}function openBrowser(_0x4ea51d){const _0x55dbde=a22_0x471e2c,_0x40da81=process[_0x55dbde(0x1b6)],_0x59726a=_0x40da81===_0x55dbde(0x182)?_0x55dbde(0xeb):_0x40da81===_0x55dbde(0x9d)?_0x55dbde(0x197):'xdg-open';spawn(_0x59726a,[_0x4ea51d],{'detached':!![],'stdio':_0x55dbde(0x18b)})[_0x55dbde(0x101)]();}function migrateLegacyDirectory(){const _0xf0fca2=a22_0x471e2c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x574cc1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x574cc1['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xf0fca2(0x117)](a22_0x2cb6ba[_0xf0fca2(0x16c)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0xf0fca2(0xd7)+PARENT_SEGMENT_DIR+_0xf0fca2(0x192))),console[_0xf0fca2(0x117)](a22_0x2cb6ba[_0xf0fca2(0x1a9)](_0xf0fca2(0x18e)+LEGACY_PARENT_SEGMENT_DIR+_0xf0fca2(0x1f4))),![];console[_0xf0fca2(0x117)](a22_0x2cb6ba[_0xf0fca2(0x16c)](_0xf0fca2(0xc3)+LEGACY_PARENT_SEGMENT_DIR+_0xf0fca2(0x12e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0xf0fca2(0x117)](a22_0x2cb6ba[_0xf0fca2(0xfc)](_0xf0fca2(0xe1)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x55890f){const _0x3cb1a2=_0x55890f instanceof Error?_0x55890f[_0xf0fca2(0x13e)]:String(_0x55890f);return console['error'](a22_0x2cb6ba[_0xf0fca2(0x1aa)](_0xf0fca2(0x1c7)+_0x3cb1a2+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x471e2c(0x1cd)](_0x383d0f){const _0x20e9a9=a22_0x471e2c;return migrateLegacyDirectory(),super[_0x20e9a9(0x1cd)](_0x383d0f);}}function resolveYamlFile(_0x233106){const _0x11e12d=a22_0x471e2c;if(_0x233106['endsWith'](_0x11e12d(0x172))||_0x233106[_0x11e12d(0xd6)](_0x11e12d(0x1ec)))return _0x233106;return a22_0x49c75b[_0x11e12d(0x1c9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x233106)+_0x11e12d(0x172));}function formatProgressMessage(_0x35a620){const _0x1e46c3=a22_0x471e2c,_0x33d403=_0x35a620[_0x1e46c3(0x189)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x33d403){const [,_0x324b9f,_0x559c5b,_0x42671d='']=_0x33d403;return a22_0x2cb6ba[_0x1e46c3(0x1a9)](_0x324b9f+':')+'\x20'+_0x559c5b+a22_0x2cb6ba[_0x1e46c3(0x1a9)](_0x42671d);}return a22_0x2cb6ba[_0x1e46c3(0x1a9)](_0x35a620);}function showFileNotFoundError(_0x45c701,_0x35685a){const _0xc01845=a22_0x471e2c;console[_0xc01845(0x117)](a22_0x2cb6ba[_0xc01845(0x1aa)]('Error:\x20File\x20not\x20found:\x20'+_0x45c701+'\x0a')),console['error'](a22_0x2cb6ba[_0xc01845(0xf0)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x35685a+_0xc01845(0xe4)));}function displayRealtimeValidation(_0x1da439){const _0x22fbe0=a22_0x471e2c;if(!_0x1da439['realtime'])return;const _0x30d8d=_0x1da439[_0x22fbe0(0xec)],_0x24ec1f=_0x30d8d['enabled']?a22_0x2cb6ba[_0x22fbe0(0xfc)](_0x22fbe0(0x12a)):a22_0x2cb6ba[_0x22fbe0(0x16c)]('⚡\x20Not\x20enabled');console[_0x22fbe0(0x117)]('\x0a'+a22_0x2cb6ba['dim'](_0x22fbe0(0x17f))+'\x20'+_0x24ec1f);if(_0x30d8d['events']&&_0x30d8d[_0x22fbe0(0x1a0)][_0x22fbe0(0xa6)]>0x0){console[_0x22fbe0(0x117)]('\x20\x20'+a22_0x2cb6ba['dim'](_0x22fbe0(0xed))+'\x20'+_0x30d8d[_0x22fbe0(0x1a0)]['length']+_0x22fbe0(0x1e3));for(const _0x586f62 of _0x30d8d[_0x22fbe0(0x1a0)]){const _0x132261=_0x586f62[_0x22fbe0(0xce)]===![]?a22_0x2cb6ba['red']('✘'):a22_0x2cb6ba[_0x22fbe0(0xfc)]('✔');console[_0x22fbe0(0x117)](_0x22fbe0(0x9f)+_0x132261+'\x20'+_0x586f62['name']),_0x586f62[_0x22fbe0(0x185)]&&console[_0x22fbe0(0x117)](_0x22fbe0(0x14d)+a22_0x2cb6ba[_0x22fbe0(0x1aa)](_0x586f62[_0x22fbe0(0x185)]));}}if(_0x30d8d[_0x22fbe0(0x13f)]&&_0x30d8d[_0x22fbe0(0x13f)]['length']>0x0){console[_0x22fbe0(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x22fbe0(0x1a9)](_0x22fbe0(0x7f))+'\x20'+_0x30d8d[_0x22fbe0(0x13f)]['length']+_0x22fbe0(0x1e3));for(const _0xf6d5bc of _0x30d8d[_0x22fbe0(0x13f)]){const _0x37e407=_0xf6d5bc[_0x22fbe0(0x1c2)]?a22_0x2cb6ba[_0x22fbe0(0xfc)]('✔'):a22_0x2cb6ba['red']('✘');console[_0x22fbe0(0x117)]('\x20\x20\x20\x20'+_0x37e407+'\x20'+_0xf6d5bc[_0x22fbe0(0x155)]+'\x20'+a22_0x2cb6ba[_0x22fbe0(0x1a9)]('('+_0xf6d5bc[_0x22fbe0(0x1e1)]+')'));}}if(_0x30d8d[_0x22fbe0(0x1ed)]){const _0x1f6219=_0x30d8d[_0x22fbe0(0x1ed)][_0x22fbe0(0x10c)]?.[_0x22fbe0(0xa6)]?_0x22fbe0(0x16a)+_0x30d8d[_0x22fbe0(0x1ed)]['stitchingKeys'][_0x22fbe0(0x1c9)](',\x20')+']':'';console[_0x22fbe0(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x22fbe0(0x1a9)](_0x22fbe0(0xbf))+'\x20'+_0x30d8d['idStitching'][_0x22fbe0(0x1a1)]+_0x1f6219);}if(_0x30d8d[_0x22fbe0(0x120)]&&_0x30d8d[_0x22fbe0(0x120)][_0x22fbe0(0xa6)]>0x0){console[_0x22fbe0(0x117)]('\x20\x20'+a22_0x2cb6ba['dim'](_0x22fbe0(0x1ad))+'\x20'+_0x30d8d[_0x22fbe0(0x120)][_0x22fbe0(0xa6)]+_0x22fbe0(0x122)+(_0x30d8d[_0x22fbe0(0x120)][_0x22fbe0(0xa6)]!==0x1?'s':''));for(const _0x40e1aa of _0x30d8d[_0x22fbe0(0x120)]){console[_0x22fbe0(0x117)](_0x22fbe0(0x19e)+_0x40e1aa[_0x22fbe0(0x155)]);}}}function showParentSegmentNotSetError(_0x36cfee){const _0x26e28b=a22_0x471e2c;console[_0x26e28b(0x117)](a22_0x2cb6ba[_0x26e28b(0x16c)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x26e28b(0x117)](_0x36cfee);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x8d);['description']=a22_0x471e2c(0x107);async[a22_0x471e2c(0xf1)](_0x3561a9){const _0x52baa4=a22_0x471e2c,{options:_0x9543c7,args:_0x47c578,tdx:_0x276cdc}=_0x3561a9,_0x432a51=_0x47c578[0x0];_0x9543c7[_0x52baa4(0xf5)]&&(console[_0x52baa4(0x117)](_0x52baa4(0x187)+_0x9543c7[_0x52baa4(0x134)]),_0x432a51&&console[_0x52baa4(0x117)](_0x52baa4(0x143)+_0x432a51));const _0x3f1a8b=await withSpinner(_0x432a51?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x432a51+_0x52baa4(0x12d):_0x52baa4(0xba),()=>_0x276cdc[_0x52baa4(0x190)][_0x52baa4(0xcd)](),{'verbose':_0x9543c7[_0x52baa4(0xf5)]});let _0x30f7e3=_0x3f1a8b[_0x52baa4(0x8b)];if(_0x432a51){const _0x1fed02=_0x432a51[_0x52baa4(0x16d)](/[.+^${}()|[\]\\]/g,_0x52baa4(0x88))[_0x52baa4(0x16d)](/\*/g,'.*')[_0x52baa4(0x16d)](/\?/g,'.'),_0x1a94f2=new RegExp('^'+_0x1fed02+'$','i');_0x30f7e3=_0x30f7e3['filter'](_0x2a1fe5=>_0x1a94f2[_0x52baa4(0x1bd)](_0x2a1fe5[_0x52baa4(0x13f)][_0x52baa4(0x155)]));}_0x30f7e3[_0x52baa4(0xf8)]((_0x26de10,_0x1f4895)=>_0x26de10[_0x52baa4(0x13f)][_0x52baa4(0x155)]['localeCompare'](_0x1f4895[_0x52baa4(0x13f)][_0x52baa4(0x155)])),console['error'](_0x52baa4(0x1ab)+_0x30f7e3[_0x52baa4(0xa6)]+_0x52baa4(0x167)+(_0x30f7e3[_0x52baa4(0xa6)]!==0x1?'s':''));const _0x4317a2=_0x2255e8=>{const _0x24569f=_0x52baa4;return getConsoleNextUrl(_0x9543c7[_0x24569f(0x134)],'/app/dw/parentSegments/'+_0x2255e8);};if(_0x9543c7['format']===_0x52baa4(0x13d)||_0x9543c7[_0x52baa4(0xbc)]===_0x52baa4(0xb4)){const _0x497c6d=_0x30f7e3[_0x52baa4(0x10b)](_0x39134a=>({..._0x39134a,'url':_0x4317a2(_0x39134a['id'])}));await handleSDKOutput(_0x497c6d,_0x9543c7);}else{if(_0x30f7e3[_0x52baa4(0xa6)]===0x0)_0x432a51?console[_0x52baa4(0x13a)](_0x52baa4(0x139)+_0x432a51):console[_0x52baa4(0x13a)](_0x52baa4(0x198));else for(const _0x5d595b of _0x30f7e3){const _0x133471=_0x5d595b[_0x52baa4(0x13f)]['population']?a22_0x2cb6ba[_0x52baa4(0x1a9)]('\x20('+formatRows(_0x5d595b[_0x52baa4(0x13f)]['population'])+')'):'',_0x3858b5=hyperlink(_0x5d595b[_0x52baa4(0x13f)]['name'],_0x4317a2(_0x5d595b['id']));console[_0x52baa4(0x13a)](_0x52baa4(0x112)+_0x3858b5+_0x133471);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x13b);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x96);async['execute'](_0x16171d){const _0x5c922=a22_0x471e2c,{options:_0x2ac22e,args:_0x35a505,tdx:_0x47b2f4}=_0x16171d;console['error'](_0x5c922(0x1b5)+_0x5c922(0xa5)+_0x5c922(0xe6));const _0x1e30c1=_0x2ac22e;if(_0x35a505[_0x5c922(0xa6)]===0x0)return console[_0x5c922(0x117)](a22_0x2cb6ba['red'](_0x5c922(0x79))),console[_0x5c922(0x117)](_0x5c922(0x1dc)),0x1;const _0x16ce2e=_0x35a505[0x0];if(!_0x1e30c1['database']||!_0x1e30c1[_0x5c922(0x16f)])return console[_0x5c922(0x117)](_0x5c922(0xb2)),console['error'](_0x5c922(0x1dc)),0x1;_0x1e30c1['verbose']&&(console[_0x5c922(0x117)]('Site:\x20'+_0x1e30c1[_0x5c922(0x134)]),console[_0x5c922(0x117)](_0x5c922(0x1d1)+_0x16ce2e),console[_0x5c922(0x117)](_0x5c922(0xef)+_0x1e30c1['database']),console['error'](_0x5c922(0x149)+_0x1e30c1[_0x5c922(0x16f)]));const _0x520e59=await loadJSONFromOptions(_0x1e30c1[_0x5c922(0x13f)],_0x1e30c1['attributesFile']),_0x4de863=await loadJSONFromOptions(_0x1e30c1['behaviors'],_0x1e30c1[_0x5c922(0x16e)]),_0x2bf57d=await loadJSONFromOptions(_0x1e30c1[_0x5c922(0xea)],_0x1e30c1[_0x5c922(0x1b1)]),_0x176eeb={'name':_0x16ce2e,'description':_0x1e30c1[_0x5c922(0xda)],'scheduleType':_0x1e30c1[_0x5c922(0x19f)],'scheduleOption':_0x1e30c1['scheduleOption'],'timezone':_0x1e30c1[_0x5c922(0x1fc)],'master':{'parentDatabaseName':_0x1e30c1['database'],'parentTableName':_0x1e30c1[_0x5c922(0x16f)]},'attributes':_0x520e59,'behaviors':_0x4de863,'customerGroup':_0x2bf57d},_0x4fbf54=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x16ce2e+_0x5c922(0x12d),()=>_0x47b2f4['segment'][_0x5c922(0x17a)](_0x176eeb),{'verbose':_0x2ac22e['verbose']}),_0xb88e74=_0x4fbf54[_0x5c922(0x8b)];return console[_0x5c922(0x117)](_0x5c922(0xc1)+_0xb88e74['name']+_0x5c922(0x147)+_0xb88e74['id']),await handleSDKOutput([_0xb88e74],_0x2ac22e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x19c);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x17d);async[a22_0x471e2c(0xf1)](_0x5aecc3){const _0x14f594=a22_0x471e2c,{options:_0x2a0ca9,args:_0x1f5602,tdx:_0xf26167}=_0x5aecc3;console[_0x14f594(0x117)](_0x14f594(0x8e)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x14f594(0xe6));const _0x4a19f7=_0x2a0ca9;if(_0x1f5602[_0x14f594(0xa6)]===0x0)return console['error'](a22_0x2cb6ba[_0x14f594(0x1aa)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x14f594(0x117)](_0x14f594(0x124)),0x1;const _0x105a8a=_0x1f5602[0x0];_0x4a19f7[_0x14f594(0xf5)]&&(console[_0x14f594(0x117)]('Site:\x20'+_0x4a19f7[_0x14f594(0x134)]),console[_0x14f594(0x117)](_0x14f594(0x84)+_0x105a8a));const _0x4de325=await withSpinner(_0x14f594(0x1d0)+_0x105a8a+'\x27...',()=>_0xf26167[_0x14f594(0x190)][_0x14f594(0x1a4)](_0x105a8a),{'verbose':_0x4a19f7[_0x14f594(0xf5)]}),_0xf016b=_0x4de325[_0x14f594(0x8b)],_0x596200=await loadJSONFromOptions(_0x4a19f7[_0x14f594(0x75)],_0x4a19f7[_0x14f594(0x1bc)]),_0x404326=await loadJSONFromOptions(_0x4a19f7[_0x14f594(0x15b)],_0x4a19f7['addBehaviorsFile']),_0x42ab87={'name':_0xf016b[_0x14f594(0x155)],'description':_0x4a19f7[_0x14f594(0xda)]!==undefined?_0x4a19f7[_0x14f594(0xda)]:_0xf016b[_0x14f594(0xda)],'scheduleType':_0x4a19f7[_0x14f594(0x19f)]!==undefined?_0x4a19f7[_0x14f594(0x19f)]:_0xf016b[_0x14f594(0x19f)],'scheduleOption':_0x4a19f7[_0x14f594(0xa3)]!==undefined?_0x4a19f7['scheduleOption']:_0xf016b[_0x14f594(0xa3)],'timezone':_0x4a19f7[_0x14f594(0x1fc)]!==undefined?_0x4a19f7[_0x14f594(0x1fc)]:_0xf016b[_0x14f594(0x1fc)],'master':_0xf016b[_0x14f594(0x16b)],'attributes':_0x596200?[..._0xf016b[_0x14f594(0x13f)]||[],..._0x596200]:_0xf016b[_0x14f594(0x13f)],'behaviors':_0x404326?[..._0xf016b['behaviors']||[],..._0x404326]:_0xf016b['behaviors'],'customerGroup':_0xf016b[_0x14f594(0xea)]},_0x3406f0=await withSpinner(_0x14f594(0x140)+_0x105a8a+'\x27...',()=>_0xf26167[_0x14f594(0x190)][_0x14f594(0x95)](_0x105a8a,_0x42ab87),{'verbose':_0x4a19f7[_0x14f594(0xf5)]}),_0x2361de=_0x3406f0[_0x14f594(0x8b)];return console[_0x14f594(0x117)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x2361de['name']+'\x27'),await handleSDKOutput([_0x2361de],_0x4a19f7),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x471e2c(0x184);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x1c3);async[a22_0x471e2c(0xf1)](_0x2abd0e){const _0x31daa9=a22_0x471e2c,{options:_0x2b7a34,args:_0x44c56a,tdx:_0x5125e7}=_0x2abd0e,_0x53b959=_0x2b7a34,_0x31a3c5=_0x44c56a[0x0]||_0x2b7a34[_0x31daa9(0x132)];if(!_0x31a3c5)return showParentSegmentNotSetError(_0x31daa9(0x1f1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x53b959['use']&&_0x53b959[_0x31daa9(0xf6)])return console[_0x31daa9(0x117)](a22_0x2cb6ba['red'](_0x31daa9(0x119))),console[_0x31daa9(0x117)](a22_0x2cb6ba['dim'](_0x31daa9(0xfa))),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0x1a9)](_0x31daa9(0x150)+PARENT_SEGMENT_DIR+_0x31daa9(0xbd))),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0xf0)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x51892c=_0x53b959[_0x31daa9(0xf6)]||a22_0x49c75b[_0x31daa9(0x1c9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31a3c5)+'.yml');_0x53b959[_0x31daa9(0xf5)]&&(console[_0x31daa9(0x117)]('Site:\x20'+_0x53b959['site']),console['error'](_0x31daa9(0x84)+_0x31a3c5),console[_0x31daa9(0x117)](_0x31daa9(0x188)+_0x51892c));const _0x3a6574=await withSpinner(_0x31daa9(0xac)+_0x31a3c5+'\x27...',()=>_0x5125e7['segment'][_0x31daa9(0x1ee)](_0x31a3c5),{'verbose':_0x53b959[_0x31daa9(0xf5)]}),_0x26a366=_0x3a6574['data'];if(existsSync(_0x51892c)){const _0x58e0a3=readFileSync(_0x51892c,_0x31daa9(0x163)),_0x34a321=generateDiff(_0x58e0a3,_0x26a366);if(!hasChanges(_0x34a321))console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0xfc)]('✔')+_0x31daa9(0x92)+a22_0x2cb6ba[_0x31daa9(0xf0)](_0x51892c)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x31daa9(0x117)](_0x31daa9(0x1b4)+_0x51892c+'\x27:'),console[_0x31daa9(0x117)]('─'[_0x31daa9(0xe8)](0x3c)),console['error'](formatDiffWithColors(_0x34a321)),console[_0x31daa9(0x117)]('─'[_0x31daa9(0xe8)](0x3c));if(!_0x53b959['yes']){if(!isInteractive())return console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0x1aa)](_0x31daa9(0x19d)),_0x31daa9(0x1d8)),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0x1a9)](_0x31daa9(0x1cb))),0x1;const _0x1d473e=await confirmKey(_0x31daa9(0x10d)+_0x51892c+'\x27?');if(!_0x1d473e)return console[_0x31daa9(0x117)](a22_0x2cb6ba['yellow'](_0x31daa9(0xf9))),0x1;}writeFileSync(_0x51892c,_0x26a366,'utf-8'),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0xfc)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x2cb6ba['cyan'](_0x51892c));}}else{const _0x2bc720=a22_0x49c75b[_0x31daa9(0x9e)](_0x51892c);!existsSync(_0x2bc720)&&mkdirSync(_0x2bc720,{'recursive':!![]}),writeFileSync(_0x51892c,_0x26a366,_0x31daa9(0x163)),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0xfc)]('✔')+_0x31daa9(0x10e)+a22_0x2cb6ba[_0x31daa9(0xf0)](_0x51892c));}return saveSessionContext({'parent_segment':_0x31a3c5},_0x53b959[_0x31daa9(0xcc)]),console[_0x31daa9(0x117)](a22_0x2cb6ba[_0x31daa9(0xfc)]('✔')+_0x31daa9(0x1f9)+a22_0x2cb6ba[_0x31daa9(0x1a9)](_0x31daa9(0x12f))+'\x20=\x20'+a22_0x2cb6ba['cyan'](_0x31a3c5)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0xd3);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x1a5);async[a22_0x471e2c(0xf1)](_0x302e1d){const _0x5dcab8=a22_0x471e2c,{options:_0x1320e6,args:_0x1cbdde,tdx:_0x309e43}=_0x302e1d,_0x46dcf8=_0x1320e6,_0x4462c8=_0x1cbdde[0x0]||_0x1320e6['parentSegment'];if(!_0x4462c8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x5dcab8(0x1c0)),0x1;const _0x385988=resolveYamlFile(_0x4462c8);if(!existsSync(_0x385988))return showFileNotFoundError(_0x385988,_0x4462c8),0x1;_0x46dcf8['verbose']&&(console[_0x5dcab8(0x117)](_0x5dcab8(0x187)+_0x46dcf8[_0x5dcab8(0x134)]),console[_0x5dcab8(0x117)](_0x5dcab8(0x180)+_0x385988));let _0x36d899;try{_0x36d899=readFileSync(_0x385988,_0x5dcab8(0x163));}catch(_0x365b73){const _0x2afe0e=_0x365b73 instanceof Error?_0x365b73[_0x5dcab8(0x13e)]:String(_0x365b73);return console[_0x5dcab8(0x117)](_0x5dcab8(0x109)+_0x2afe0e),0x1;}const _0x1b5476=await withSpinner(_0x5dcab8(0x14e),()=>_0x309e43[_0x5dcab8(0x190)][_0x5dcab8(0xb6)](_0x36d899),{'verbose':_0x46dcf8[_0x5dcab8(0xf5)]}),_0x6bc092=_0x1b5476[_0x5dcab8(0x8b)],{isNew:_0x33a810,name:_0x6c95c9,hasChanges:_0x1cdf74,diffFormatted:_0x476489}=_0x6bc092;if(!_0x1cdf74)return console[_0x5dcab8(0x117)](_0x5dcab8(0x1b0)+_0x6c95c9+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x33a810?console[_0x5dcab8(0x117)](_0x5dcab8(0x165)+_0x6c95c9+'\x27:'):console[_0x5dcab8(0x117)](_0x5dcab8(0x1dd)+_0x6c95c9+'\x27:');console[_0x5dcab8(0x117)]('─'['repeat'](0x3c)),console[_0x5dcab8(0x117)](_0x476489),console[_0x5dcab8(0x117)]('─'[_0x5dcab8(0xe8)](0x3c));const _0x4c0df2=_0x33a810?'Create\x20parent\x20segment\x20\x27'+_0x6c95c9+'\x27?':_0x5dcab8(0xb5)+_0x6c95c9+'\x27?';if(!_0x46dcf8[_0x5dcab8(0xdb)]){if(!isInteractive())return console[_0x5dcab8(0x117)](a22_0x2cb6ba[_0x5dcab8(0x1aa)](_0x5dcab8(0x19d)),_0x5dcab8(0x1d8)),console[_0x5dcab8(0x117)](a22_0x2cb6ba[_0x5dcab8(0x1a9)](_0x5dcab8(0x1cb))),0x1;const _0x3e98f2=await confirmKey(_0x4c0df2);if(!_0x3e98f2)return console[_0x5dcab8(0x117)](a22_0x2cb6ba[_0x5dcab8(0x16c)]('Aborted.')),0x1;}const _0x157485=_0x33a810?_0x5dcab8(0xe5):_0x5dcab8(0xc8),_0x2f3154=await withSpinner(_0x157485+_0x5dcab8(0x19b)+_0x6c95c9+_0x5dcab8(0x12d),()=>_0x6bc092[_0x5dcab8(0x17e)](),{'verbose':_0x46dcf8[_0x5dcab8(0xf5)]}),_0x4d2f86=_0x2f3154[_0x5dcab8(0x8b)],_0xea21d=getConsoleNextUrl(_0x46dcf8[_0x5dcab8(0x134)],'/app/dw/parentSegments/'+_0x4d2f86['id']),_0x389ade=_0x33a810?'Created':_0x5dcab8(0x15e);return console[_0x5dcab8(0x117)]('✔\x20'+_0x389ade+_0x5dcab8(0x19b)+_0x4d2f86['name']+'\x27'),console[_0x5dcab8(0x117)]('\x20\x20'+_0xea21d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x106);[a22_0x471e2c(0xda)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a22_0x471e2c(0xf1)](_0x6c079a){const _0x29cb72=a22_0x471e2c,{options:_0x598a83,args:_0x22f994,tdx:_0x29a48f}=_0x6c079a,_0x28e9e1=_0x598a83,_0x714d9d=_0x22f994[0x0]||_0x598a83[_0x29cb72(0x132)];if(!_0x714d9d)return showParentSegmentNotSetError(_0x29cb72(0x171)+_0x29cb72(0x73)+_0x29cb72(0xc2)+_0x29cb72(0x142)+_0x29cb72(0x1a2)+_0x29cb72(0x151)),0x1;const _0x3fd6cb=resolveYamlFile(_0x714d9d);if(!existsSync(_0x3fd6cb))return showFileNotFoundError(_0x3fd6cb,_0x714d9d),0x1;_0x28e9e1[_0x29cb72(0xf5)]&&(console[_0x29cb72(0x117)](_0x29cb72(0x187)+_0x28e9e1[_0x29cb72(0x134)]),console[_0x29cb72(0x117)](_0x29cb72(0x180)+_0x3fd6cb));let _0x5e0966;try{_0x5e0966=readFileSync(_0x3fd6cb,_0x29cb72(0x163));}catch(_0x1f4614){const _0x1dfcbe=_0x1f4614 instanceof Error?_0x1f4614['message']:String(_0x1f4614);return console[_0x29cb72(0x117)](_0x29cb72(0x109)+_0x1dfcbe),0x1;}const _0x2db514=createCommandSpinner(a22_0x2cb6ba[_0x29cb72(0x1a9)](_0x29cb72(0x82)),{'verbose':_0x28e9e1['verbose']});_0x2db514[_0x29cb72(0x197)]();const _0x5628ad={'onProgress':_0x418db1=>{const _0x30410f=_0x29cb72;_0x2db514[_0x30410f(0x1d5)]=formatProgressMessage(_0x418db1);}};if(_0x28e9e1['master'])_0x5628ad[_0x29cb72(0x16b)]=!![];if(_0x28e9e1[_0x29cb72(0x127)])_0x5628ad[_0x29cb72(0x127)]=!![];_0x28e9e1[_0x29cb72(0x116)]&&(_0x5628ad[_0x29cb72(0x116)]=_0x28e9e1['attribute']);_0x28e9e1['behavior']&&(_0x5628ad[_0x29cb72(0x1f7)]=_0x28e9e1[_0x29cb72(0x1f7)]);if(_0x28e9e1['interval'])_0x5628ad[_0x29cb72(0x11c)]=_0x28e9e1['interval'];let _0x4587de;try{_0x4587de=await _0x29a48f[_0x29cb72(0x190)][_0x29cb72(0x7c)](_0x5e0966,_0x5628ad),_0x2db514['stop']();}catch(_0x56daf3){_0x2db514[_0x29cb72(0x183)]();throw _0x56daf3;}const _0x5b2397=_0x28e9e1[_0x29cb72(0x11c)]||'-1d';return this[_0x29cb72(0x186)](_0x4587de,_0x5628ad,_0x3fd6cb,_0x5b2397),_0x4587de[_0x29cb72(0x153)]?0x0:0x1;}[a22_0x471e2c(0x186)](_0x132cec,_0x1b006c,_0x2ff3f3,_0x44d35f){const _0x2616d6=a22_0x471e2c;console[_0x2616d6(0x117)]('\x0a'+a22_0x2cb6ba[_0x2616d6(0x14a)]('Validate:')+'\x20'+_0x132cec[_0x2616d6(0x155)]),console[_0x2616d6(0x117)]('═'[_0x2616d6(0xe8)](0x3c)),this[_0x2616d6(0x156)](_0x132cec);if(typeof _0x1b006c[_0x2616d6(0x116)]==='string'){this[_0x2616d6(0xfb)](_0x132cec),this['displaySummary'](_0x132cec),this[_0x2616d6(0x113)](_0x2ff3f3,_0x44d35f,_0x2616d6(0x116),_0x1b006c[_0x2616d6(0x116)]);return;}if(_0x1b006c[_0x2616d6(0x116)]===!![]){this[_0x2616d6(0xfb)](_0x132cec),this['displaySummary'](_0x132cec),this[_0x2616d6(0x113)](_0x2ff3f3,_0x44d35f,_0x2616d6(0x13f));return;}if(typeof _0x1b006c[_0x2616d6(0x1f7)]==='string'){this[_0x2616d6(0x1ae)](_0x132cec,_0x44d35f),this[_0x2616d6(0x173)](_0x132cec),this['displayPreviewHints'](_0x2ff3f3,_0x44d35f,'behavior',_0x1b006c['behavior']);return;}if(_0x1b006c[_0x2616d6(0x1f7)]===!![]){this[_0x2616d6(0x1ae)](_0x132cec,_0x44d35f),this[_0x2616d6(0x173)](_0x132cec),this[_0x2616d6(0x113)](_0x2ff3f3,_0x44d35f,_0x2616d6(0x1ea));return;}this[_0x2616d6(0xfb)](_0x132cec),this['displayBehaviorsStats'](_0x132cec,_0x44d35f),this[_0x2616d6(0x12b)](_0x132cec),this['displaySummary'](_0x132cec),this['displayPreviewHints'](_0x2ff3f3,_0x44d35f,_0x2616d6(0xca));}[a22_0x471e2c(0x12b)](_0x748592){displayRealtimeValidation(_0x748592);}[a22_0x471e2c(0x113)](_0x1614ed,_0xdb5046,_0x2d30ef,_0x67844d){const _0x2700ba=a22_0x471e2c;console['error']('\x0a'+a22_0x2cb6ba[_0x2700ba(0x1a9)](_0x2700ba(0x1b2)));const _0x6a7805=_0xdb5046!==_0x2700ba(0x1e7)?_0x2700ba(0x71)+_0xdb5046:'';if(_0x2d30ef===_0x2700ba(0x116)&&_0x67844d)console[_0x2700ba(0x117)]('\x20\x20'+a22_0x2cb6ba['dim']('tdx\x20ps\x20preview\x20'+_0x1614ed+_0x2700ba(0x11b)+_0x67844d+'\x22'+_0x6a7805));else{if(_0x2d30ef===_0x2700ba(0x1f7)&&_0x67844d)console[_0x2700ba(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x2700ba(0x1a9)](_0x2700ba(0x146)+_0x1614ed+_0x2700ba(0x1f8)+_0x67844d+'\x22'+_0x6a7805));else(_0x2d30ef==='attributes'||_0x2d30ef==='all')&&console[_0x2700ba(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x2700ba(0x1a9)](_0x2700ba(0x146)+_0x1614ed+_0x2700ba(0x193)+_0x6a7805));}(_0x2d30ef==='behaviors'||_0x2d30ef===_0x2700ba(0xca))&&console[_0x2700ba(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x2700ba(0x1a9)](_0x2700ba(0x146)+_0x1614ed+'\x20--behavior\x20\x22<name>\x22'+_0x6a7805)),_0x2d30ef===_0x2700ba(0xca)&&console['error']('\x20\x20'+a22_0x2cb6ba['dim'](_0x2700ba(0x146)+_0x1614ed+'\x20--enriched'+_0x6a7805));}['displayMasterInfo'](_0x562320){const _0x5eb3f8=a22_0x471e2c,{master:_0x36c3af}=_0x562320,_0x31bc0c=_0x36c3af[_0x5eb3f8(0x1eb)]?a22_0x2cb6ba['green']('✔'):a22_0x2cb6ba[_0x5eb3f8(0x1aa)]('✘');console[_0x5eb3f8(0x117)]('\x0a'+a22_0x2cb6ba['dim'](_0x5eb3f8(0x194))),console[_0x5eb3f8(0x117)](_0x31bc0c+'\x20'+a22_0x2cb6ba[_0x5eb3f8(0x14a)](_0x36c3af[_0x5eb3f8(0xc5)]+'.'+_0x36c3af[_0x5eb3f8(0x16f)])),_0x36c3af[_0x5eb3f8(0x1eb)]?_0x36c3af['rowCount']!==undefined&&console[_0x5eb3f8(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x5eb3f8(0x1a9)](_0x5eb3f8(0x123))+'\x20'+a22_0x2cb6ba[_0x5eb3f8(0xf0)](formatRows(_0x36c3af['rowCount']))):console[_0x5eb3f8(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x5eb3f8(0x1aa)]('Error:')+'\x20'+_0x36c3af['schemaError']);}['displayAttributesStats'](_0x17ff18){const _0x4ddabb=a22_0x471e2c;if(_0x17ff18['attributes'][_0x4ddabb(0xa6)]===0x0)return;console['error']('\x0a'+a22_0x2cb6ba[_0x4ddabb(0x1a9)](_0x4ddabb(0x154)));for(const _0x51faa2 of _0x17ff18[_0x4ddabb(0x13f)]){const _0x1223fc=_0x51faa2[_0x4ddabb(0x1eb)]?a22_0x2cb6ba[_0x4ddabb(0xfc)]('✔'):a22_0x2cb6ba[_0x4ddabb(0x1aa)]('✘');let _0x91b122='';if(_0x51faa2['schemaValid']&&_0x51faa2[_0x4ddabb(0x6c)]!==undefined&&_0x51faa2[_0x4ddabb(0xd1)]!==undefined){const _0x4d13c1=_0x51faa2[_0x4ddabb(0xd1)][_0x4ddabb(0x118)](0x1),_0x28c7f8=_0x51faa2['coveragePercent']>=0x50?a22_0x2cb6ba[_0x4ddabb(0xfc)]:_0x51faa2[_0x4ddabb(0xd1)]>=0x32?a22_0x2cb6ba[_0x4ddabb(0x16c)]:a22_0x2cb6ba[_0x4ddabb(0x1aa)];_0x91b122='\x20'+a22_0x2cb6ba[_0x4ddabb(0x1a9)]('Coverage:')+'\x20'+_0x28c7f8(_0x4d13c1+'%')+'\x20('+formatRows(_0x51faa2[_0x4ddabb(0x6c)])+_0x4ddabb(0x1ef);}console['error'](_0x1223fc+'\x20'+a22_0x2cb6ba[_0x4ddabb(0x14a)](_0x51faa2['name'])+_0x91b122),console[_0x4ddabb(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x4ddabb(0x1a9)](_0x4ddabb(0xd8))+'\x20'+a22_0x2cb6ba['bold'](_0x51faa2['database']+'.'+_0x51faa2['table']));const _0x18cb5d=_0x51faa2[_0x4ddabb(0x1a3)]===_0x51faa2[_0x4ddabb(0x135)]?a22_0x2cb6ba['dim'](_0x4ddabb(0xb0))+'\x20'+_0x51faa2[_0x4ddabb(0x1a3)]:a22_0x2cb6ba[_0x4ddabb(0x1a9)](_0x4ddabb(0x111))+'\x20'+_0x51faa2[_0x4ddabb(0x1a3)]+_0x4ddabb(0x6e)+_0x51faa2[_0x4ddabb(0x135)];console[_0x4ddabb(0x117)]('\x20\x20'+_0x18cb5d),console['error']('\x20\x20'+a22_0x2cb6ba[_0x4ddabb(0x1a9)]('Columns:')),this['displayColumns'](_0x51faa2['columns']),!_0x51faa2[_0x4ddabb(0x1eb)]&&console[_0x4ddabb(0x117)]('\x20\x20'+a22_0x2cb6ba['red'](_0x4ddabb(0x10a))+'\x20'+_0x51faa2[_0x4ddabb(0x1f5)]);}}[a22_0x471e2c(0x1ae)](_0x2d53b5,_0x3ebcb4){const _0x5e154f=a22_0x471e2c;if(_0x2d53b5[_0x5e154f(0x1ea)][_0x5e154f(0xa6)]===0x0)return;console[_0x5e154f(0x117)]('\x0a'+a22_0x2cb6ba[_0x5e154f(0x1a9)](_0x5e154f(0x1f0))+'\x20'+a22_0x2cb6ba[_0x5e154f(0x1a9)]('('+_0x3ebcb4+')'));for(const _0x2bb7e1 of _0x2d53b5[_0x5e154f(0x1ea)]){const _0x56c30d=_0x2bb7e1['schemaValid']?a22_0x2cb6ba[_0x5e154f(0xfc)]('✔'):a22_0x2cb6ba[_0x5e154f(0x1aa)]('✘');let _0x455893='';if(_0x2bb7e1[_0x5e154f(0x1eb)]&&_0x2bb7e1[_0x5e154f(0x77)]!==undefined&&_0x2bb7e1[_0x5e154f(0x70)]!==undefined){const _0x1c0b5e=_0x2bb7e1[_0x5e154f(0xb1)]?.[_0x5e154f(0x118)](0x1)||'?',_0x47f4a3=(_0x2bb7e1[_0x5e154f(0xb1)]??0x0)>=0x32?a22_0x2cb6ba[_0x5e154f(0xfc)]:(_0x2bb7e1[_0x5e154f(0xb1)]??0x0)>=0x14?a22_0x2cb6ba['yellow']:a22_0x2cb6ba['red'];_0x455893='\x20'+a22_0x2cb6ba[_0x5e154f(0x1a9)]('Customers:')+'\x20'+_0x47f4a3(formatRows(_0x2bb7e1[_0x5e154f(0x77)]))+'\x20('+_0x1c0b5e+_0x5e154f(0x1cf)+a22_0x2cb6ba[_0x5e154f(0x1a9)](_0x5e154f(0xed))+'\x20'+a22_0x2cb6ba['cyan'](formatRows(_0x2bb7e1[_0x5e154f(0x70)]));}console[_0x5e154f(0x117)](_0x56c30d+'\x20'+a22_0x2cb6ba[_0x5e154f(0x14a)](_0x2bb7e1['name'])+_0x455893),console[_0x5e154f(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x5e154f(0x1a9)]('Source:')+'\x20'+a22_0x2cb6ba[_0x5e154f(0x14a)](_0x2bb7e1[_0x5e154f(0xc5)]+'.'+_0x2bb7e1['table']));const _0x189bfc=_0x2bb7e1[_0x5e154f(0x1a3)]===_0x2bb7e1[_0x5e154f(0x135)]?a22_0x2cb6ba[_0x5e154f(0x1a9)](_0x5e154f(0xb0))+'\x20'+_0x2bb7e1[_0x5e154f(0x1a3)]:a22_0x2cb6ba[_0x5e154f(0x1a9)](_0x5e154f(0x111))+'\x20'+_0x2bb7e1['joinKey']+_0x5e154f(0x6e)+_0x2bb7e1['foreignKey'];console[_0x5e154f(0x117)]('\x20\x20'+_0x189bfc),console[_0x5e154f(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x5e154f(0x1a9)](_0x5e154f(0x98))),this[_0x5e154f(0x1c4)](_0x2bb7e1['columns']),!_0x2bb7e1[_0x5e154f(0x1eb)]&&console[_0x5e154f(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x5e154f(0x1aa)](_0x5e154f(0x10a))+'\x20'+_0x2bb7e1[_0x5e154f(0x1f5)]);}}[a22_0x471e2c(0x1c4)](_0xa671bb){const _0x1442f5=a22_0x471e2c;for(const _0x5d878e of _0xa671bb){_0x5d878e[_0x1442f5(0xa9)]===_0x5d878e[_0x1442f5(0x1b9)]||_0x5d878e[_0x1442f5(0x1b9)]==='*'?console[_0x1442f5(0x117)](_0x1442f5(0x19e)+_0x5d878e['label']):console['error']('\x20\x20\x20\x20-\x20'+_0x5d878e['label']+'\x20'+a22_0x2cb6ba[_0x1442f5(0x1a9)]('('+_0x5d878e[_0x1442f5(0x1b9)]+')'));}}[a22_0x471e2c(0x173)](_0x55a998){const _0x117a99=a22_0x471e2c;console[_0x117a99(0x117)]('─'['repeat'](0x3c));if(_0x55a998[_0x117a99(0x14f)]['length']>0x0){console[_0x117a99(0x117)]('\x0a'+a22_0x2cb6ba[_0x117a99(0x1aa)](_0x117a99(0x181)));for(const _0x1d063e of _0x55a998[_0x117a99(0x14f)]){console['error']('\x20\x20'+a22_0x2cb6ba[_0x117a99(0x1aa)]('•')+'\x20'+_0x1d063e);}}_0x55a998['allValid']&&console[_0x117a99(0x117)]('\x0a'+a22_0x2cb6ba[_0x117a99(0xfc)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x12c);[a22_0x471e2c(0xda)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a22_0x471e2c(0xf1)](_0x5bb889){const _0x324b67=a22_0x471e2c,{options:_0x46fcdf,args:_0x45b953,tdx:_0x4d7c44}=_0x5bb889,_0x9ff7f6=_0x46fcdf,_0x1440db=_0x45b953[0x0]||_0x46fcdf['parentSegment'];if(!_0x1440db)return showParentSegmentNotSetError(_0x324b67(0x1df)+_0x324b67(0x1ba)+_0x324b67(0x11e)+_0x324b67(0x196)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x324b67(0x87)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x9ff7f6[_0x324b67(0x16b)]&&!_0x9ff7f6[_0x324b67(0x116)]&&!_0x9ff7f6['behavior']&&!_0x9ff7f6[_0x324b67(0x127)])return console[_0x324b67(0x117)](a22_0x2cb6ba['red'](_0x324b67(0x9a))),console['error'](_0x324b67(0x1fd)),console[_0x324b67(0x117)](_0x324b67(0x15f)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x324b67(0x117)](_0x324b67(0x166)),console[_0x324b67(0x117)](_0x324b67(0x11f)),console['error'](_0x324b67(0x89)),0x1;const _0x30262a=resolveYamlFile(_0x1440db);if(!existsSync(_0x30262a))return showFileNotFoundError(_0x30262a,_0x1440db),0x1;_0x9ff7f6['verbose']&&(console['error']('Site:\x20'+_0x9ff7f6[_0x324b67(0x134)]),console[_0x324b67(0x117)](_0x324b67(0x180)+_0x30262a));let _0x5ea3e0;try{_0x5ea3e0=readFileSync(_0x30262a,_0x324b67(0x163));}catch(_0x4551c9){const _0x33e393=_0x4551c9 instanceof Error?_0x4551c9[_0x324b67(0x13e)]:String(_0x4551c9);return console[_0x324b67(0x117)](_0x324b67(0x109)+_0x33e393),0x1;}let _0x41beb0;try{_0x41beb0=parseDef(_0x5ea3e0);}catch(_0x428241){const _0x4d861e=_0x428241 instanceof Error?_0x428241['message']:String(_0x428241);return console[_0x324b67(0x117)](a22_0x2cb6ba[_0x324b67(0x1aa)](_0x324b67(0xdd)+_0x4d861e)),0x1;}if(_0x9ff7f6[_0x324b67(0x116)]===!![]||_0x9ff7f6[_0x324b67(0x116)]===''){const _0x40db1c=_0x41beb0[_0x324b67(0x13f)]?.['map'](_0x17c970=>_0x17c970[_0x324b67(0x155)])||[];if(_0x40db1c[_0x324b67(0xa6)]===0x0)console['error'](a22_0x2cb6ba[_0x324b67(0x1aa)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a22_0x2cb6ba[_0x324b67(0x1aa)](_0x324b67(0xdc))),console[_0x324b67(0x117)](_0x324b67(0xde));for(const _0x463d23 of _0x40db1c){console[_0x324b67(0x117)]('\x20\x20'+a22_0x2cb6ba['cyan'](_0x463d23));}console[_0x324b67(0x117)](_0x324b67(0x1d4)+_0x1440db+_0x324b67(0x11b)+_0x40db1c[0x0]+'\x22');}return 0x1;}if(_0x9ff7f6[_0x324b67(0x1f7)]===!![]||_0x9ff7f6[_0x324b67(0x1f7)]===''){const _0x5e11f7=_0x41beb0[_0x324b67(0x1ea)]?.[_0x324b67(0x10b)](_0x5bf750=>_0x5bf750['name'])||[];if(_0x5e11f7['length']===0x0)console['error'](a22_0x2cb6ba['red'](_0x324b67(0x1b8)));else{console['error'](a22_0x2cb6ba[_0x324b67(0x1aa)](_0x324b67(0x97))),console[_0x324b67(0x117)](_0x324b67(0x1d7));for(const _0x276202 of _0x5e11f7){console[_0x324b67(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x324b67(0xf0)](_0x276202));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x1440db+_0x324b67(0x1f8)+_0x5e11f7[0x0]+'\x22');}return 0x1;}const _0x20f985=createCommandSpinner(a22_0x2cb6ba[_0x324b67(0x1a9)](_0x324b67(0xb7)),{'verbose':_0x9ff7f6[_0x324b67(0xf5)]});_0x20f985[_0x324b67(0x197)]();const _0x4078fa={'onProgress':_0x561a92=>{const _0x370eb6=_0x324b67;_0x20f985[_0x370eb6(0x1d5)]=formatProgressMessage(_0x561a92);}};if(_0x9ff7f6['master'])_0x4078fa[_0x324b67(0x16b)]=!![];if(_0x9ff7f6[_0x324b67(0x116)]&&typeof _0x9ff7f6[_0x324b67(0x116)]===_0x324b67(0x131))_0x4078fa[_0x324b67(0x116)]=_0x9ff7f6[_0x324b67(0x116)];if(_0x9ff7f6['behavior']&&typeof _0x9ff7f6[_0x324b67(0x1f7)]===_0x324b67(0x131))_0x4078fa[_0x324b67(0x1f7)]=_0x9ff7f6[_0x324b67(0x1f7)];if(_0x9ff7f6[_0x324b67(0x127)])_0x4078fa[_0x324b67(0x127)]=!![];if(_0x9ff7f6['interval'])_0x4078fa[_0x324b67(0x11c)]=_0x9ff7f6[_0x324b67(0x11c)];let _0x1a4cf6;try{_0x1a4cf6=await _0x4d7c44['segment'][_0x324b67(0x74)](_0x5ea3e0,_0x4078fa),_0x20f985[_0x324b67(0x183)]();}catch(_0x539e4e){_0x20f985[_0x324b67(0x183)]();throw _0x539e4e;}return await this['displayPreviewResults'](_0x1a4cf6,{'master':_0x9ff7f6[_0x324b67(0x16b)],'attribute':typeof _0x9ff7f6['attribute']===_0x324b67(0x131)?_0x9ff7f6[_0x324b67(0x116)]:undefined,'behavior':typeof _0x9ff7f6['behavior']==='string'?_0x9ff7f6[_0x324b67(0x1f7)]:undefined,'enriched':_0x9ff7f6[_0x324b67(0x127)]}),_0x1a4cf6['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x41e551,_0x209df3){const _0x575131=a22_0x471e2c;console[_0x575131(0x117)]('\x0a'+a22_0x2cb6ba[_0x575131(0x14a)](_0x575131(0x1c5))+'\x20'+_0x41e551[_0x575131(0x155)]),console['error']('═'[_0x575131(0xe8)](0x3c));if(_0x209df3[_0x575131(0x16b)]&&_0x41e551[_0x575131(0x8a)]){const _0x2a8892=a22_0x2cb6ba['dim'](_0x575131(0x7d))+'\x20'+a22_0x2cb6ba[_0x575131(0x14a)](_0x41e551[_0x575131(0x16b)][_0x575131(0xc5)]+'.'+_0x41e551[_0x575131(0x16b)]['table']);await this[_0x575131(0xd4)](_0x2a8892,_0x41e551[_0x575131(0x8a)]);}else{if(_0x209df3['attribute']&&_0x41e551[_0x575131(0x8a)]){const _0x5f322d=a22_0x2cb6ba[_0x575131(0x1a9)](_0x575131(0xbb))+'\x20'+a22_0x2cb6ba[_0x575131(0x14a)](_0x209df3[_0x575131(0x116)]);await this[_0x575131(0xd4)](_0x5f322d,_0x41e551['sampleData']);}else{if(_0x209df3[_0x575131(0x1f7)]&&_0x41e551['sampleData']){const _0x411726=a22_0x2cb6ba[_0x575131(0x1a9)](_0x575131(0xe7))+'\x20'+a22_0x2cb6ba[_0x575131(0x14a)](_0x209df3[_0x575131(0x1f7)]);await this[_0x575131(0xd4)](_0x411726,_0x41e551[_0x575131(0x8a)]);}else{if(_0x209df3['enriched']&&_0x41e551[_0x575131(0x8a)]){const _0x945d9=a22_0x2cb6ba[_0x575131(0x1a9)]('Enriched:')+'\x20'+a22_0x2cb6ba['bold'](_0x575131(0x128));await this[_0x575131(0xd4)](_0x945d9,_0x41e551[_0x575131(0x8a)]);}else!_0x41e551['sampleData']&&console[_0x575131(0x117)](_0x575131(0xa0));}}}if(_0x41e551[_0x575131(0x14f)][_0x575131(0xa6)]>0x0){console['error']('─'['repeat'](0x3c)),console[_0x575131(0x117)]('\x0a'+a22_0x2cb6ba[_0x575131(0x1aa)]('Errors:'));for(const _0x3badf0 of _0x41e551[_0x575131(0x14f)]){console[_0x575131(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x575131(0x1aa)]('•')+'\x20'+_0x3badf0);}}}async[a22_0x471e2c(0xd4)](_0x11fee8,_0xa669b5){const _0x24e00f=a22_0x471e2c;if(_0xa669b5[_0x24e00f(0xa6)]===0x0){console[_0x24e00f(0x117)]('\x0a'+_0x11fee8),console[_0x24e00f(0x117)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x24e00f(0x117)]('\x0a'+_0x11fee8);const _0x282361=Object[_0x24e00f(0x169)](_0xa669b5[0x0])[_0x24e00f(0x10b)](_0x53e40f=>({'name':_0x53e40f,'type':typeof _0xa669b5[0x0][_0x53e40f]===_0x24e00f(0x1ce)?_0x24e00f(0xf4):_0x24e00f(0xc4)})),_0x3810d3={'queryId':_0x24e00f(0xae),'columns':_0x282361,'data':_0xa669b5,'stats':{'state':_0x24e00f(0x14b),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xa669b5[_0x24e00f(0xa6)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3fc2e3=formatAsTable(_0x3810d3,_0xa669b5[_0x24e00f(0xa6)],!![]);await writeOutput(_0x3fc2e3,undefined,_0x24e00f(0x16f));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x471e2c(0x155)]='segment:parent:run';[a22_0x471e2c(0xda)]=a22_0x471e2c(0xd5);async[a22_0x471e2c(0xf1)](_0x48e1a3){const _0x30dabf=a22_0x471e2c,{options:_0x1a7d2a,args:_0x370d6b,tdx:_0x1a113b}=_0x48e1a3,_0x48a66=_0x1a7d2a,_0x1f6f58=_0x370d6b[0x0]||_0x1a7d2a[_0x30dabf(0x132)];if(!_0x1f6f58)return showParentSegmentNotSetError(_0x30dabf(0x17c)+_0x30dabf(0x81)),0x1;const _0x307358=resolveYamlFile(_0x1f6f58);if(existsSync(_0x307358)){_0x48a66[_0x30dabf(0xf5)]&&console[_0x30dabf(0x117)]('Found\x20YAML\x20file:\x20'+_0x307358);let _0x350d5a;try{_0x350d5a=readFileSync(_0x307358,'utf-8');}catch(_0x15c060){const _0x2eb534=_0x15c060 instanceof Error?_0x15c060[_0x30dabf(0x13e)]:String(_0x15c060);return console['error']('Error\x20reading\x20file:\x20'+_0x2eb534),0x1;}const _0x24440c=await withSpinner(_0x30dabf(0x14e),()=>_0x1a113b[_0x30dabf(0x190)][_0x30dabf(0xb6)](_0x350d5a),{'verbose':_0x48a66['verbose']}),_0xdfaad3=_0x24440c[_0x30dabf(0x8b)],{isNew:_0x542911,name:_0x52408c,hasChanges:_0x4a2e04,diffFormatted:_0x430248}=_0xdfaad3;if(_0x4a2e04){_0x542911?console[_0x30dabf(0x117)](_0x30dabf(0x165)+_0x52408c+'\x27:'):console[_0x30dabf(0x117)](_0x30dabf(0x1dd)+_0x52408c+'\x27:');console['error']('─'[_0x30dabf(0xe8)](0x3c)),console[_0x30dabf(0x117)](_0x430248),console['error']('─'[_0x30dabf(0xe8)](0x3c));const _0xf8bea0=_0x542911?_0x30dabf(0x6f)+_0x52408c+_0x30dabf(0x191):_0x30dabf(0xb5)+_0x52408c+_0x30dabf(0x191);if(!_0x48a66[_0x30dabf(0xdb)]){if(!isInteractive())return console[_0x30dabf(0x117)](a22_0x2cb6ba['red']('\x0aError:'),_0x30dabf(0x1d8)),console['error'](a22_0x2cb6ba[_0x30dabf(0x1a9)](_0x30dabf(0x1cb))),0x1;const _0xd1006f=await confirmKey(_0xf8bea0);if(!_0xd1006f)return console[_0x30dabf(0x117)](a22_0x2cb6ba[_0x30dabf(0x16c)]('Aborted.')),0x1;}const _0x28ea63=_0x542911?_0x30dabf(0xe5):_0x30dabf(0xc8);await withSpinner(_0x28ea63+_0x30dabf(0x19b)+_0x52408c+_0x30dabf(0x12d),()=>_0xdfaad3[_0x30dabf(0x17e)](),{'verbose':_0x48a66['verbose']});const _0x591999=_0x542911?_0x30dabf(0x94):_0x30dabf(0x15e);console[_0x30dabf(0x117)]('✔\x20'+_0x591999+_0x30dabf(0x19b)+_0x52408c+'\x27');}else console[_0x30dabf(0x117)](_0x30dabf(0x1b0)+_0x52408c+_0x30dabf(0x8c));}const _0x406385=await withSpinner(_0x30dabf(0x1de)+_0x1f6f58+_0x30dabf(0x12d),()=>_0x1a113b['segment'][_0x30dabf(0x1fb)](_0x1f6f58),{'verbose':_0x48a66[_0x30dabf(0xf5)]}),_0x2e87b2=_0x406385[_0x30dabf(0x8b)],_0x234431=getConsoleUrl(_0x48a66[_0x30dabf(0x134)],_0x30dabf(0x144)+_0x2e87b2['workflowId']+_0x30dabf(0x1b7)+_0x2e87b2[_0x30dabf(0x1db)]+_0x30dabf(0x18c)+_0x2e87b2[_0x30dabf(0x161)]);return console['error'](_0x30dabf(0x91)),console['error']('\x20\x20'+a22_0x2cb6ba['dim']('Audience\x20ID:')+'\x20'+_0x2e87b2[_0x30dabf(0x18d)]),console[_0x30dabf(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x30dabf(0x1a9)]('Status:')+'\x20'+_0x2e87b2[_0x30dabf(0x18a)]),console[_0x30dabf(0x117)]('\x20\x20'+a22_0x2cb6ba['dim'](_0x30dabf(0x99))+'\x20'+_0x2e87b2[_0x30dabf(0x1db)]),console[_0x30dabf(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x30dabf(0x1a9)]('Attempt:')+'\x20'+_0x2e87b2['workflowAttemptId']),console[_0x30dabf(0x117)]('\x20\x20'+_0x234431),console[_0x30dabf(0x117)]('\x0a'+a22_0x2cb6ba[_0x30dabf(0x1a9)](_0x30dabf(0xb3))+_0x30dabf(0x1e8)+_0x2e87b2[_0x30dabf(0x161)]+_0x30dabf(0x162)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x1da);['description']=a22_0x471e2c(0x1bb);async['execute'](_0x13e759){const _0x4e3369=a22_0x471e2c,{options:_0x3b7867,args:_0xf7163d,tdx:_0x2422d0}=_0x13e759,_0x12089e=_0xf7163d[0x0]||_0x3b7867[_0x4e3369(0x132)];if(!_0x12089e)return showParentSegmentNotSetError(_0x4e3369(0x15c)+_0x4e3369(0xa8)),0x1;_0x3b7867['verbose']&&(console[_0x4e3369(0x117)]('Site:\x20'+_0x3b7867['site']),console[_0x4e3369(0x117)](_0x4e3369(0x84)+_0x12089e));const _0x587cf7=await withSpinner(_0x4e3369(0x1d3)+_0x12089e+'\x27...',()=>_0x2422d0[_0x4e3369(0x190)][_0x4e3369(0x178)](_0x12089e),{'verbose':_0x3b7867[_0x4e3369(0xf5)]}),_0x162538=_0x587cf7[_0x4e3369(0x8b)];console[_0x4e3369(0x117)]('✔\x20Found\x20'+_0x162538[_0x4e3369(0xa6)]+_0x4e3369(0x160)+(_0x162538[_0x4e3369(0xa6)]!==0x1?'s':''));if(_0x3b7867['json']||_0x3b7867[_0x4e3369(0xb4)])return await handleSDKOutput(_0x162538,_0x3b7867),0x0;return displayFieldsHumanReadable(_0x162538,_0x12089e),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x471e2c(0x155)]='segment:parent:view';[a22_0x471e2c(0xda)]=a22_0x471e2c(0x148);async[a22_0x471e2c(0xf1)](_0x3ab1e1){const _0x53e862=a22_0x471e2c,{options:_0x3e9c04,args:_0x24ba0a,tdx:_0x2c6af1}=_0x3ab1e1,_0x4675b7=_0x3e9c04,_0x49004f=_0x24ba0a[0x0]||_0x3e9c04[_0x53e862(0x132)];if(!_0x49004f)return showParentSegmentNotSetError(_0x53e862(0x1a8)+_0x53e862(0xab)+_0x53e862(0xc2)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x3e9c04[_0x53e862(0xf5)]&&(console[_0x53e862(0x117)](_0x53e862(0x187)+_0x3e9c04[_0x53e862(0x134)]),console[_0x53e862(0x117)]('Parent\x20segment:\x20'+_0x49004f));const _0x577e9f=await withSpinner(_0x53e862(0xac)+_0x49004f+'\x27...',()=>_0x2c6af1[_0x53e862(0x190)][_0x53e862(0x1a4)](_0x49004f),{'verbose':_0x3e9c04[_0x53e862(0xf5)]}),_0x35c6fe=_0x577e9f[_0x53e862(0x8b)];if(_0x4675b7[_0x53e862(0xc9)]){const _0xfa32b3=getConsoleNextUrl(_0x4675b7[_0x53e862(0x134)],_0x53e862(0x83)+_0x35c6fe['id']);return console[_0x53e862(0x117)](a22_0x2cb6ba[_0x53e862(0xfc)]('✔')+'\x20Opening\x20'+a22_0x2cb6ba[_0x53e862(0xf0)](_0xfa32b3)),openBrowser(_0xfa32b3),0x0;}return await handleSingleObjectOutput(_0x35c6fe,_0x3e9c04),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a22_0x471e2c(0xa2);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x1e2);async[a22_0x471e2c(0xf1)](_0x2c80e0){const _0x7e6e47=a22_0x471e2c,{options:_0x30cfed,args:_0x125296,tdx:_0x57fd7b}=_0x2c80e0,_0x49c245=_0x30cfed,_0x6952ba=_0x125296[0x0]||_0x30cfed[_0x7e6e47(0x132)];if(!_0x6952ba)return showParentSegmentNotSetError(_0x7e6e47(0x1b3)+'\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'+_0x7e6e47(0xc2)+_0x7e6e47(0xb9)),0x1;_0x30cfed[_0x7e6e47(0xf5)]&&(console[_0x7e6e47(0x117)](_0x7e6e47(0x187)+_0x30cfed[_0x7e6e47(0x134)]),console[_0x7e6e47(0x117)](_0x7e6e47(0x84)+_0x6952ba));const _0x345b97=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x6952ba+'\x27...',()=>_0x57fd7b[_0x7e6e47(0x190)][_0x7e6e47(0xf2)](_0x6952ba),{'verbose':_0x30cfed['verbose']}),_0x5fe702=_0x345b97[_0x7e6e47(0x8b)],_0x50c509=_0x57fd7b[_0x7e6e47(0x190)][_0x7e6e47(0x1fe)](_0x5fe702);if(_0x49c245[_0x7e6e47(0xf6)]){const _0x379aee=await this[_0x7e6e47(0x1e4)](_0x2c80e0,_0x6952ba,_0x5fe702,_0x50c509),_0x210537=this[_0x7e6e47(0xf3)](_0x379aee);writeFileSync(_0x49c245['output'],_0x210537);const _0x1baab9=_0x379aee['customers']['columns']['length']+_0x379aee[_0x7e6e47(0x1ea)][_0x7e6e47(0xee)]((_0x2af69b,_0x163949)=>_0x2af69b+_0x163949['columns']['length'],0x0),_0x55476b=_0x379aee['behaviors'][_0x7e6e47(0xd2)](_0x2dff65=>_0x2dff65[_0x7e6e47(0xc0)][_0x7e6e47(0xa6)]===0x0)[_0x7e6e47(0xa6)];return console[_0x7e6e47(0x13a)](_0x7e6e47(0xdf)+_0x49c245[_0x7e6e47(0xf6)]),console[_0x7e6e47(0x13a)](_0x7e6e47(0x1cc)+_0x50c509),console[_0x7e6e47(0x13a)](_0x7e6e47(0x100)+_0x379aee[_0x7e6e47(0x1ea)][_0x7e6e47(0xa6)]+_0x7e6e47(0xa1)),console['log'](_0x7e6e47(0x1d2)+_0x1baab9+_0x7e6e47(0x1e9)),_0x55476b>0x0&&console[_0x7e6e47(0x13a)]('\x20\x20Note:\x20'+_0x55476b+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x7e6e47(0x117)]('\x0a'+a22_0x2cb6ba[_0x7e6e47(0x14a)]('Output\x20Database:')+'\x20'+a22_0x2cb6ba[_0x7e6e47(0xf0)](_0x50c509));const _0xdeb570=await withSpinner(_0x7e6e47(0x1d9),()=>_0x57fd7b['segment'][_0x7e6e47(0x7e)](_0x5fe702),{'verbose':_0x30cfed[_0x7e6e47(0xf5)]});console['error']('\x0a'+a22_0x2cb6ba[_0x7e6e47(0x14a)](_0x7e6e47(0x1ac))+'\x20'+a22_0x2cb6ba['dim']('('+_0x50c509+_0x7e6e47(0x85)));const _0x3a6066=await executeSchemaQuery(_0xdeb570[_0x7e6e47(0x8b)],_0x57fd7b,_0x30cfed);await handleQueryOutput(_0x3a6066,_0x30cfed);const _0x481342=await withSpinner(_0x7e6e47(0x18f),()=>_0x57fd7b[_0x7e6e47(0x190)][_0x7e6e47(0x10f)](_0x5fe702),{'verbose':_0x30cfed['verbose']});for(const _0x4c74db of _0x481342['data']){const _0x89522b='behavior_'+_0x4c74db['toLowerCase']()[_0x7e6e47(0x16d)](/\s+/g,'_'),_0x22f803=_0x7e6e47(0x1e6)+_0x50c509+'.'+_0x89522b;console['error']('\x0a'+a22_0x2cb6ba['bold'](_0x4c74db)+'\x20'+a22_0x2cb6ba[_0x7e6e47(0x1a9)]('('+_0x50c509+'.'+_0x89522b+')'));try{const _0x6e8da7=await executeSchemaQuery(_0x22f803,_0x57fd7b,_0x30cfed);await handleQueryOutput(_0x6e8da7,_0x30cfed);}catch{console[_0x7e6e47(0x117)](a22_0x2cb6ba[_0x7e6e47(0x16c)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x471e2c(0x1e4)](_0x128b2c,_0x286082,_0x2755fc,_0x403e5b){const _0x539648=a22_0x471e2c,{options:_0xb2716a,tdx:_0x44d19d}=_0x128b2c,_0x318a90=await withSpinner(_0x539648(0x1d9),()=>_0x44d19d[_0x539648(0x190)][_0x539648(0x7e)](_0x2755fc),{'verbose':_0xb2716a['verbose']}),_0x29e027=await executeSchemaQuery(_0x318a90[_0x539648(0x8b)],_0x44d19d,_0xb2716a),_0x50806e=_0x29e027[_0x539648(0x8b)][_0x539648(0x10b)](_0x48aae7=>({'name':_0x48aae7[_0x539648(0x136)],'type':_0x48aae7['column_type']})),_0x447eca=await withSpinner(_0x539648(0x18f),()=>_0x44d19d['segment'][_0x539648(0x10f)](_0x2755fc),{'verbose':_0xb2716a[_0x539648(0xf5)]}),_0x372f4e=[];for(const _0x4bad39 of _0x447eca[_0x539648(0x8b)]){const _0x362f7e=_0x539648(0x8f)+_0x4bad39[_0x539648(0x158)]()[_0x539648(0x16d)](/\s+/g,'_'),_0x9ff799=_0x539648(0x1e6)+_0x403e5b+'.'+_0x362f7e;let _0x4f6996=[];try{const _0x547cde=await executeSchemaQuery(_0x9ff799,_0x44d19d,_0xb2716a);_0x4f6996=_0x547cde['data'][_0x539648(0x10b)](_0x16619d=>({'name':_0x16619d[_0x539648(0x136)],'type':_0x16619d[_0x539648(0x103)]}));}catch{}_0x372f4e[_0x539648(0x7b)]({'table':_0x362f7e,'columns':_0x4f6996});}return{'database':_0x403e5b,'parent_segment':_0x286082,'parent_id':_0x2755fc,'customers':{'table':'customers','columns':_0x50806e},'behaviors':_0x372f4e};}['formatSchemaJson'](_0x87de61){const _0x494c27=a22_0x471e2c,_0x511523=_0x256530=>{const _0x354433=a22_0x561c;if(_0x256530[_0x354433(0xa6)]===0x0)return'[]';const _0x5bc7a2=_0x256530[_0x354433(0x10b)](_0x1b1dcf=>_0x354433(0xd9)+_0x1b1dcf[_0x354433(0x155)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x1b1dcf[_0x354433(0x1e1)]+_0x354433(0x115));return'[\x0a'+_0x5bc7a2[_0x354433(0x1c9)](',\x0a')+_0x354433(0x78);},_0x15fc57=_0x87de61[_0x494c27(0x1ea)][_0x494c27(0x10b)](_0x766ab1=>{const _0x14ab9e=_0x494c27;return _0x14ab9e(0x105)+_0x766ab1[_0x14ab9e(0x16f)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x511523(_0x766ab1[_0x14ab9e(0xc0)])[_0x14ab9e(0x16d)](/^/gm,'\x20\x20')[_0x14ab9e(0x1d6)]()+'\x0a\x20\x20\x20\x20}';})['join'](',\x0a');return _0x494c27(0x14c)+_0x87de61[_0x494c27(0xc5)]+_0x494c27(0x141)+_0x87de61[_0x494c27(0x12f)]+_0x494c27(0x179)+_0x87de61[_0x494c27(0xc6)]+_0x494c27(0xff)+_0x87de61[_0x494c27(0x1ac)][_0x494c27(0x16f)]+_0x494c27(0x110)+_0x511523(_0x87de61[_0x494c27(0x1ac)][_0x494c27(0xc0)])[_0x494c27(0x16d)](/^/gm,'\x20\x20')[_0x494c27(0x1d6)]()+_0x494c27(0xe3)+_0x15fc57+_0x494c27(0x199);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x9b);['description']=a22_0x471e2c(0x19a);async[a22_0x471e2c(0xf1)](_0x2024a7){const _0x281dfa=a22_0x471e2c,{options:_0x594981,args:_0x376962,tdx:_0x1adf16}=_0x2024a7,_0x13cead=_0x376962[0x0]||_0x594981[_0x281dfa(0x132)];if(!_0x13cead)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'+_0x281dfa(0x17b)),0x1;_0x594981[_0x281dfa(0xf5)]&&(console[_0x281dfa(0x117)]('Site:\x20'+_0x594981[_0x281dfa(0x134)]),console['error'](_0x281dfa(0x84)+_0x13cead));const _0x787b3f=await withSpinner(_0x281dfa(0xaf)+_0x13cead+_0x281dfa(0x12d),()=>_0x1adf16[_0x281dfa(0x190)][_0x281dfa(0xf2)](_0x13cead),{'verbose':_0x594981[_0x281dfa(0xf5)]}),_0x18518e=_0x787b3f[_0x281dfa(0x8b)],_0x698472=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x13cead+_0x281dfa(0x12d),()=>_0x1adf16[_0x281dfa(0x190)]['getParentSQL'](_0x18518e),{'verbose':_0x594981[_0x281dfa(0xf5)]}),_0x19a725=_0x698472['data'];return _0x594981['format']==='json'||_0x594981[_0x281dfa(0xbc)]===_0x281dfa(0xb4)?await handleSDKOutput([{'sql':_0x19a725}],_0x594981):console[_0x281dfa(0x13a)](_0x19a725),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x1be);['description']=a22_0x471e2c(0x15a);async[a22_0x471e2c(0xf1)](_0x49f71c){const _0x512fcf=a22_0x471e2c,{options:_0x5b93e3,args:_0x4cb047,tdx:_0x3aaf40}=_0x49f71c,_0x5d74ce=_0x4cb047[0x0]||_0x5b93e3[_0x512fcf(0x132)];if(!_0x5d74ce)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'+_0x512fcf(0x174)),0x1;_0x5b93e3[_0x512fcf(0xf5)]&&(console[_0x512fcf(0x117)](_0x512fcf(0x187)+_0x5b93e3['site']),console['error']('Parent\x20segment:\x20'+_0x5d74ce));const _0x2f822d=await withSpinner(_0x512fcf(0xaf)+_0x5d74ce+_0x512fcf(0x12d),()=>_0x3aaf40[_0x512fcf(0x190)][_0x512fcf(0xf2)](_0x5d74ce),{'verbose':_0x5b93e3[_0x512fcf(0xf5)]}),_0x4337b7=_0x2f822d[_0x512fcf(0x8b)],_0x319099=await withSpinner(_0x512fcf(0xb8)+_0x5d74ce+'\x27...',()=>_0x3aaf40[_0x512fcf(0x190)][_0x512fcf(0x7e)](_0x4337b7),{'verbose':_0x5b93e3[_0x512fcf(0xf5)]});let _0x297780=_0x319099[_0x512fcf(0x8b)];const _0x49d64b=resolveLimit(_0x5b93e3[_0x512fcf(0xfd)],DEFAULT_DISPLAY_LIMIT),_0x4690af=/\bLIMIT\s+\d+/i[_0x512fcf(0x1bd)](_0x297780);!_0x4690af&&(_0x297780=_0x297780['trim']()[_0x512fcf(0x16d)](/;+$/,''),_0x297780=_0x512fcf(0x1c6)+_0x297780+_0x512fcf(0x72)+_0x49d64b);_0x5b93e3[_0x512fcf(0xf5)]&&console[_0x512fcf(0x117)](_0x512fcf(0xe0)+_0x297780);const _0x3f85dd=await withProgressSpinner(_0x512fcf(0xd0),async _0x26fed6=>{const _0x266747=_0x512fcf,_0x3d0d6e=await _0x3aaf40['query'][_0x266747(0xf1)](_0x297780,{'catalog':'td','schema':'information_schema','onJobId':_0x498245=>{_0x26fed6['setJobId'](_0x498245);}});return _0x3d0d6e;},{'verbose':_0x5b93e3[_0x512fcf(0xf5)]}),_0x4dc8e2=_0x3f85dd[_0x512fcf(0x8b)],_0x5e6ef5=_0x4dc8e2[_0x512fcf(0x126)]?'\x20[Job\x20ID:\x20'+_0x4dc8e2['jobId']+']':'';return console[_0x512fcf(0x117)](_0x512fcf(0xfe)+_0x4dc8e2[_0x512fcf(0x9c)][_0x512fcf(0x121)][_0x512fcf(0xcf)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4dc8e2[_0x512fcf(0x9c)][_0x512fcf(0xe2)])+_0x5e6ef5)),await handleQueryOutput(_0x4dc8e2,_0x5b93e3),0x0;}}export class PSRtListCommand extends BaseCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x145);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x1e5);async[a22_0x471e2c(0xf1)](_0x415b7f){const _0x5b9b97=a22_0x471e2c,{options:_0x2644e2,args:_0x3f4256,tdx:_0x1e3d32}=_0x415b7f,_0x2e563e=_0x3f4256[0x0],_0x50e494=await withSpinner(_0x2e563e?_0x5b9b97(0x1a7)+_0x2e563e+_0x5b9b97(0x12d):_0x5b9b97(0xcb),()=>_0x1e3d32['realtime']['list'](),{'verbose':_0x2644e2[_0x5b9b97(0xf5)]});let _0x2a68bf=_0x50e494[_0x5b9b97(0x8b)]['filter'](_0x521007=>_0x521007['realtime_enabled']);if(_0x2e563e){const _0x1a7615=_0x2e563e[_0x5b9b97(0x16d)](/[.+^${}()|[\]\\]/g,_0x5b9b97(0x88))[_0x5b9b97(0x16d)](/\*/g,'.*')[_0x5b9b97(0x16d)](/\?/g,'.'),_0x28dec7=new RegExp('^'+_0x1a7615+'$','i');_0x2a68bf=_0x2a68bf[_0x5b9b97(0xd2)](_0x23deca=>_0x28dec7[_0x5b9b97(0x1bd)](_0x23deca[_0x5b9b97(0x155)]));}_0x2a68bf['sort']((_0x46582,_0x380382)=>_0x46582[_0x5b9b97(0x155)][_0x5b9b97(0x177)](_0x380382['name'])),console[_0x5b9b97(0x117)](_0x5b9b97(0x1ab)+_0x2a68bf['length']+'\x20RT-enabled\x20parent\x20segment'+(_0x2a68bf[_0x5b9b97(0xa6)]!==0x1?'s':''));const _0x103ee6=_0x572644=>{const _0x5b2c03=_0x5b9b97;return getConsoleNextUrl(_0x2644e2[_0x5b2c03(0x134)],'/app/dw/parentSegments/'+_0x572644);};if(_0x2644e2['format']===_0x5b9b97(0x13d)||_0x2644e2[_0x5b9b97(0xbc)]===_0x5b9b97(0xb4)){const _0x141e81=_0x2a68bf[_0x5b9b97(0x10b)](_0xd04a8=>({..._0xd04a8,'url':_0x103ee6(_0xd04a8['id'])}));await handleSDKOutput(_0x141e81,_0x2644e2);}else{if(_0x2a68bf[_0x5b9b97(0xa6)]===0x0)console['log'](_0x5b9b97(0x90));else for(const _0x4405de of _0x2a68bf){const _0x195f94=_0x4405de[_0x5b9b97(0x130)]?a22_0x2cb6ba[_0x5b9b97(0x1a9)]('\x20('+formatRows(_0x4405de[_0x5b9b97(0x130)])+')'):'',_0x2c5724=hyperlink(_0x4405de[_0x5b9b97(0x155)],_0x103ee6(_0x4405de['id']));console['log']('⚡\x20'+_0x2c5724+_0x195f94);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x471e2c(0x155)]=a22_0x471e2c(0x1c1);[a22_0x471e2c(0xda)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a22_0x471e2c(0xf1)](_0x27a8c8){const _0x3150ee=a22_0x471e2c,{options:_0x447dc4,args:_0x41879f,tdx:_0x173c3f}=_0x27a8c8,_0x1d7f6e=_0x41879f[0x0]||_0x447dc4[_0x3150ee(0x132)];if(!_0x1d7f6e)return showParentSegmentNotSetError(_0x3150ee(0xad)+_0x3150ee(0x133)),0x1;const _0x4c8a8d=resolveYamlFile(_0x1d7f6e);if(!existsSync(_0x4c8a8d))return showFileNotFoundError(_0x4c8a8d,_0x1d7f6e),0x1;let _0x4d3dae;try{_0x4d3dae=readFileSync(_0x4c8a8d,_0x3150ee(0x163));}catch(_0x28a83c){const _0x42a23d=_0x28a83c instanceof Error?_0x28a83c['message']:String(_0x28a83c);return console['error'](_0x3150ee(0x109)+_0x42a23d),0x1;}const _0xbd9072=createCommandSpinner(a22_0x2cb6ba[_0x3150ee(0x1a9)](_0x3150ee(0x176)),{'verbose':_0x447dc4[_0x3150ee(0xf5)]});_0xbd9072['start']();const _0x8a0b4b={'realtime':!![],'onProgress':_0x336168=>{_0xbd9072['text']=formatProgressMessage(_0x336168);}};let _0x29616b;try{_0x29616b=await _0x173c3f[_0x3150ee(0x190)][_0x3150ee(0x7c)](_0x4d3dae,_0x8a0b4b),_0xbd9072[_0x3150ee(0x183)]();}catch(_0x6f0265){_0xbd9072[_0x3150ee(0x183)]();throw _0x6f0265;}console[_0x3150ee(0x117)]('\x0a'+a22_0x2cb6ba['bold'](_0x3150ee(0x168))+'\x20'+_0x29616b['name']),console['error']('═'['repeat'](0x3c)),displayRealtimeValidation(_0x29616b),console['error']('─'['repeat'](0x3c));if(_0x29616b[_0x3150ee(0x14f)][_0x3150ee(0xa6)]>0x0){console[_0x3150ee(0x117)]('\x0a'+a22_0x2cb6ba['red'](_0x3150ee(0x181)));for(const _0x37d800 of _0x29616b[_0x3150ee(0x14f)]){console[_0x3150ee(0x117)]('\x20\x20'+a22_0x2cb6ba[_0x3150ee(0x1aa)]('•')+'\x20'+_0x37d800);}}return _0x29616b[_0x3150ee(0x153)]&&console[_0x3150ee(0x117)]('\x0a'+a22_0x2cb6ba['green']('✔')+_0x3150ee(0x1c8)),_0x29616b[_0x3150ee(0x153)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x471e2c(0x155)]='ps:pz:list';[a22_0x471e2c(0xda)]=a22_0x471e2c(0x1f2);async[a22_0x471e2c(0xf1)](_0x2d161e){const _0x40999a=a22_0x471e2c,{options:_0xd34852,args:_0xcf0c8,tdx:_0x3dbfc2}=_0x2d161e,_0xc37efb=_0xcf0c8[0x0]||_0xd34852[_0x40999a(0x132)];if(!_0xc37efb)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x7aed47=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xc37efb+_0x40999a(0x12d),()=>_0x3dbfc2[_0x40999a(0x190)][_0x40999a(0xf2)](_0xc37efb),{'verbose':_0xd34852['verbose']}),_0x505223=_0x7aed47[_0x40999a(0x8b)],_0x222337=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0xc37efb+_0x40999a(0x12d),()=>_0x3dbfc2[_0x40999a(0x7a)]['list'](_0x505223),{'verbose':_0xd34852[_0x40999a(0xf5)]}),_0x17d4de=_0x222337[_0x40999a(0x8b)];console[_0x40999a(0x117)](_0x40999a(0x1ab)+_0x17d4de['length']+_0x40999a(0x152)+(_0x17d4de['length']!==0x1?'s':''));if(_0xd34852['format']===_0x40999a(0x13d)||_0xd34852[_0x40999a(0xbc)]===_0x40999a(0xb4))await handleSDKOutput(_0x17d4de,_0xd34852);else{if(_0x17d4de[_0x40999a(0xa6)]===0x0)console[_0x40999a(0x13a)](_0x40999a(0x102)),console['error'](a22_0x2cb6ba[_0x40999a(0xf0)](_0x40999a(0x1af)));else for(const _0x926fbb of _0x17d4de){const _0x469e96=_0x926fbb[_0x40999a(0x1fa)]?.[_0x40999a(0xa6)]||0x0,_0x103dd1=_0x926fbb[_0x40999a(0xe9)]?a22_0x2cb6ba['dim'](_0x40999a(0xf7)+_0x926fbb['trigger_event']):'',_0x4004db=a22_0x2cb6ba[_0x40999a(0x1a9)]('\x20('+_0x469e96+_0x40999a(0x1bf)+(_0x469e96!==0x1?'s':'')+')');console[_0x40999a(0x13a)]('\x20\x20'+_0x926fbb[_0x40999a(0x155)]+_0x103dd1+_0x4004db),_0x926fbb['description']&&console[_0x40999a(0x13a)](_0x40999a(0x9f)+a22_0x2cb6ba[_0x40999a(0x1a9)](_0x926fbb[_0x40999a(0xda)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a22_0x471e2c(0x15d);[a22_0x471e2c(0xda)]=a22_0x471e2c(0x129);async[a22_0x471e2c(0xf1)](_0x2112c7){const _0x1acb0d=a22_0x471e2c,{options:_0x20d587,args:_0x4996a9}=_0x2112c7,_0x33677b=_0x4996a9[0x0]||_0x20d587[_0x1acb0d(0x132)];if(!_0x33677b)return showParentSegmentNotSetError(_0x1acb0d(0x137)+_0x1acb0d(0x1e0)),0x1;const _0x4d88f0=resolveYamlFile(_0x33677b);if(!existsSync(_0x4d88f0))return showFileNotFoundError(_0x4d88f0,_0x33677b),0x1;let _0x3f8290;try{_0x3f8290=readFileSync(_0x4d88f0,_0x1acb0d(0x163));}catch(_0x211002){const _0x5d0dd5=_0x211002 instanceof Error?_0x211002['message']:String(_0x211002);return console[_0x1acb0d(0x117)]('Error\x20reading\x20file:\x20'+_0x5d0dd5),0x1;}let _0x1de758;try{_0x1de758=parseDef(_0x3f8290);}catch(_0x299c73){const _0x1481c8=_0x299c73 instanceof Error?_0x299c73['message']:String(_0x299c73);return console['error'](a22_0x2cb6ba[_0x1acb0d(0x1aa)](_0x1acb0d(0xdd)+_0x1481c8)),0x1;}if(_0x1de758[_0x1acb0d(0x195)]&&_0x1de758['personalization_services']['length']>0x0)return console[_0x1acb0d(0x117)](a22_0x2cb6ba[_0x1acb0d(0x16c)](_0x1acb0d(0x114)+_0x4d88f0)),console[_0x1acb0d(0x117)](a22_0x2cb6ba[_0x1acb0d(0x1a9)](_0x1acb0d(0x1f6)+_0x1de758[_0x1acb0d(0x195)][_0x1acb0d(0xa6)]+_0x1acb0d(0x125))),0x1;!_0x1de758[_0x1acb0d(0xec)]&&(_0x1de758[_0x1acb0d(0xec)]={'events':[{'name':'page_view','source_table':_0x1acb0d(0x1f3)}],'attributes':[{'name':_0x1acb0d(0x157),'type':_0x1acb0d(0x13c)}],'id_stitching':{'primary_key':_0x1de758[_0x1acb0d(0x16b)][_0x1acb0d(0x16f)]===_0x1acb0d(0x1ac)?'td_client_id':'user_id'}});_0x1de758[_0x1acb0d(0x195)]=[{'name':'My\x20Service','description':'Personalization\x20service\x20description','trigger_event':_0x1acb0d(0x138),'sections':[{'name':_0x1acb0d(0x170),'criteria':_0x1acb0d(0x76),'attributes':[_0x1acb0d(0x157)]}]}];const _0x16ba17=serializeDef(_0x1de758);return writeFileSync(_0x4d88f0,_0x16ba17,_0x1acb0d(0x163)),console[_0x1acb0d(0x117)](a22_0x2cb6ba[_0x1acb0d(0xfc)]('✔')+_0x1acb0d(0xa7)+a22_0x2cb6ba['cyan'](_0x4d88f0)),(!_0x1de758['realtime']||_0x3f8290[_0x1acb0d(0x104)](_0x1acb0d(0x1ca))===-0x1)&&console[_0x1acb0d(0x117)](a22_0x2cb6ba[_0x1acb0d(0xfc)]('✔')+_0x1acb0d(0x11a)),console[_0x1acb0d(0x117)]('\x0a'+a22_0x2cb6ba['dim']('Next\x20steps:')),console['error'](_0x1acb0d(0xaa)+_0x4d88f0+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x1acb0d(0x117)]('\x20\x202.\x20Run\x20'+a22_0x2cb6ba['dim'](_0x1acb0d(0x86)+_0x33677b)+_0x1acb0d(0x108)),0x0;}}function a22_0xd7a1(){const _0x3c6aba=['\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20Tables:\x201\x20customers\x20+\x20','unref','No\x20personalization\x20services\x20configured','column_type','indexOf','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','segment:parent:validate','List\x20parent\x20segments','\x20to\x20push\x20the\x20configuration','Error\x20reading\x20file:\x20','Error:','map','stitchingKeys','Overwrite\x20\x27','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','getBehaviorNames','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Join:','👥\x20','displayPreviewHints','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x22\x20}','attribute','error','toFixed','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20Added\x20RT\x202.0\x20template\x20section','\x20--attribute\x20\x22','interval','135754RfjrcI','Options\x20(one\x20required):\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','personalizationServices','processedRows','\x20service','Rows:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20service(s)\x20configured','jobId','enriched','Master\x20+\x20Attributes','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','⚡\x20Enabled','displayRealtimeInfo','segment:parent:preview','\x27...','/\x20→\x20','parent_segment','population','string','parentSegment','\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','site','foreignKey','column_name','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','page_view','No\x20parent\x20segments\x20match\x20pattern:\x20','log','segment:parent:create','single','json','message','attributes','Updating\x20parent\x20segment\x20\x27','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Pattern:\x20','/app/workflows/','ps:rt:list','tdx\x20ps\x20preview\x20','\x27\x20with\x20ID:\x20','Show\x20parent\x20segment\x20details','Table:\x20','bold','FINISHED','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20\x20\x20\x20\x20','Analyzing\x20changes...','errors','using\x20the\x20default\x20path:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20personalization\x20service','allValid','Attributes','name','displayMasterInfo','last_page_viewed','toLowerCase','3194384xOwRKt','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','addBehaviors','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','ps:pz:init','Updated','Options:','\x20field','workflowAttemptId','\x20kill','utf-8','507521kgblGd','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20parent\x20segment','RT\x202.0\x20Validate:','keys','\x20+\x20[','master','yellow','replace','behaviorsFile','table','Default','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','.yml','displaySummary','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','48RkuHqu','Validating\x20RT\x20configuration...','localeCompare','listFields','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','createParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','apply','RT\x202.0:','YAML\x20file:\x20','Errors:','darwin','stop','segment:parent:pull','sourceTableError','displayValidateResults','Site:\x20','Output\x20file:\x20','match','status','ignore','/attempt/','audienceId','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Fetching\x20behavior\x20list...','segment','\x27\x20and\x20run\x20workflow?','/\x20directories\x20exist.','\x20--attribute\x20\x22<name>\x22','Master\x20Table','personalization_services','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','start','No\x20parent\x20segments\x20found','\x0a\x20\x20]\x0a}\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20parent\x20segment\x20\x27','segment:parent:update','\x0aError:','\x20\x20\x20\x20-\x20','scheduleType','events','primaryKey','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','joinKey','getParentFull','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','1390840RDLwfU','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','dim','red','✔\x20Found\x20','customers','Personalization:','displayBehaviorsStats','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','✔\x20No\x20changes\x20-\x20\x27','customerGroupFile','To\x20view\x20sample\x20data:','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','\x0aChanges\x20to\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','platform','/sessions/','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','column','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','List\x20available\x20fields\x20for\x20segmentation','addAttributesFile','test','segment:parent:show','\x20section','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','ps:rt:validate','valid','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','displayColumns','Preview:','SELECT\x20*\x20FROM\x20(\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20RT\x20configuration\x20is\x20valid','join','realtime:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20Database:\x20','run','number','%)\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Name:\x20','\x20\x20Columns:\x20','Listing\x20fields\x20for\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','text','trim','Available\x20behaviors:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Fetching\x20customers\x20schema...','segment:parent:fields','workflowSessionId','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0aChanges\x20to\x20apply\x20to\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','type','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20configured','collectSchema','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','SELECT\x20*\x20FROM\x20','-1d','\x20tdx\x20wf\x20attempt\x20','\x20total','behaviors','schemaValid','.yaml','idStitching','pullParentYaml','\x20rows)','Behaviors','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','<database>.<table>','/\x20directory.\x0a','schemaError','\x20\x20\x20','behavior','\x20--behavior\x20\x22','\x20Context\x20set:\x20','sections','runParent','timezone','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','getOutputDatabaseName','matchedCount','3QgpVme','\x20=\x20','Create\x20parent\x20segment\x20\x27','totalEvents','\x20--interval\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','previewParentYaml','addAttributes','true','customersWithEvents','\x0a\x20\x20\x20\x20]','Error:\x20Parent\x20segment\x20name\x20is\x20required','personalization','push','validateParentYaml','Master:','getParentSQL','Attributes:','15iZYISq','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Validating\x20configuration...','/app/dw/parentSegments/','Parent\x20segment:\x20','.customers)','tdx\x20ps\x20push\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x5c$&','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','sampleData','data','\x27\x20is\x20up\x20to\x20date','segment:parent:list','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','behavior_','No\x20RT-enabled\x20parent\x20segments\x20found','\x0a✔\x20Workflow\x20started','\x20No\x20changes\x20-\x20','16326830jVFZoJ','Created','updateParent','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Columns:','Session:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','segment:parent:sql','stats','win32','dirname','\x20\x20\x20\x20','\x0aNo\x20sample\x20data\x20available','\x20behaviors','segment:parent:desc','scheduleOption','1213806NRaFZt','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','length','\x20Added\x20personalization\x20template\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','label','\x20\x201.\x20Edit\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Fetching\x20parent\x20segment\x20\x27','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','preview','Resolving\x20parent\x20segment\x20\x27','Join\x20on:','customerPercent','Error:\x20--database\x20and\x20--table\x20are\x20required','To\x20cancel:','jsonl','Apply\x20changes\x20to\x20\x27','pushParentYaml','Fetching\x20sample\x20data...','Fetching\x20SQL\x20for\x20\x27','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Listing\x20parent\x20segments...','Attribute:','format','/{name}.yml\x0a','parent_segments','ID\x20Stitching:','columns','✔\x20Created\x20parent\x20segment\x20\x27','Options:\x0a','\x0a⚠️\x20\x20Migrating:\x20','varchar','database','parent_id','4701294KDYHPE','Updating','web','all','Listing\x20RT-enabled\x20parent\x20segments...','session','listParents','sourceTableValid','toLocaleString','Executing\x20parent\x20segment\x20query...','coveragePercent','filter','segment:parent:push','displaySampleData','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','endsWith','/\x20and\x20','Source:','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','description','yes','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Error\x20parsing\x20YAML:\x20','Available\x20attributes:','Schema\x20saved\x20to\x20','SQL\x20query:\x0a','✔\x20Renamed\x20directory\x20to\x20','elapsedTimeMillis','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','`\x20to\x20download\x20the\x20configuration\x20first','Creating','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Behavior:','repeat','trigger_event','customerGroup','open','realtime','Events:','reduce','Database:\x20','cyan','execute','resolveParentId','formatSchemaJson','double','verbose','output','\x20trigger=','sort','Aborted.','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','displayAttributesStats','green','limit','✔\x20Query\x20completed:\x20Processed\x20'];a22_0xd7a1=function(){return _0x3c6aba;};return a22_0xd7a1();}
|
|
1
|
+
const a22_0x2331ee=a22_0x4694;(function(_0x26a990,_0x4a45b8){const _0x1c6a56=a22_0x4694,_0x2409b5=_0x26a990();while(!![]){try{const _0xc327f3=parseInt(_0x1c6a56(0x280))/0x1*(-parseInt(_0x1c6a56(0x268))/0x2)+-parseInt(_0x1c6a56(0x1ed))/0x3*(parseInt(_0x1c6a56(0x1dd))/0x4)+-parseInt(_0x1c6a56(0x1c4))/0x5+parseInt(_0x1c6a56(0x226))/0x6*(-parseInt(_0x1c6a56(0x14f))/0x7)+-parseInt(_0x1c6a56(0x15a))/0x8*(-parseInt(_0x1c6a56(0x1ce))/0x9)+-parseInt(_0x1c6a56(0x23c))/0xa+-parseInt(_0x1c6a56(0x19c))/0xb*(-parseInt(_0x1c6a56(0x283))/0xc);if(_0xc327f3===_0x4a45b8)break;else _0x2409b5['push'](_0x2409b5['shift']());}catch(_0x2b921f){_0x2409b5['push'](_0x2409b5['shift']());}}}(a22_0x12f0,0x20d28));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x5d62e3 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x3a5229 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x2331ee(0x1a2),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x3bd051){const _0x4c41fd=a22_0x2331ee,_0x5c01d1=process[_0x4c41fd(0x116)],_0x16601e=_0x5c01d1==='darwin'?_0x4c41fd(0x15b):_0x5c01d1===_0x4c41fd(0x171)?_0x4c41fd(0x26d):_0x4c41fd(0x24b);spawn(_0x16601e,[_0x3bd051],{'detached':!![],'stdio':_0x4c41fd(0x213)})[_0x4c41fd(0x2a0)]();}function migrateLegacyDirectory(){const _0x5c66db=a22_0x2331ee;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1bc78b=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1bc78b[_0x5c66db(0x21e)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5c66db(0x1d1)](a22_0x3a5229['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console['error'](a22_0x3a5229[_0x5c66db(0x1e0)](_0x5c66db(0x1e1)+LEGACY_PARENT_SEGMENT_DIR+_0x5c66db(0x273))),![];console[_0x5c66db(0x1d1)](a22_0x3a5229[_0x5c66db(0x239)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a22_0x3a5229[_0x5c66db(0x178)](_0x5c66db(0x23e)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x52acae){const _0x5b65dd=_0x52acae instanceof Error?_0x52acae[_0x5c66db(0x20f)]:String(_0x52acae);return console['error'](a22_0x3a5229['red'](_0x5c66db(0x1d3)+_0x5b65dd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x2331ee(0x191)](_0x4d9d50){const _0x829aa3=a22_0x2331ee;return migrateLegacyDirectory(),super[_0x829aa3(0x191)](_0x4d9d50);}}function resolveYamlFile(_0x4bb2a2){const _0x27df9e=a22_0x2331ee;if(_0x4bb2a2[_0x27df9e(0x27f)](_0x27df9e(0x1b1))||_0x4bb2a2['endsWith'](_0x27df9e(0x25b)))return _0x4bb2a2;return a22_0x5d62e3[_0x27df9e(0x18a)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4bb2a2)+_0x27df9e(0x1b1));}function formatProgressMessage(_0x1a15b6){const _0x500278=a22_0x2331ee,_0x5232c5=_0x1a15b6[_0x500278(0x1e3)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5232c5){const [,_0x387831,_0x36a00e,_0x211632='']=_0x5232c5;return a22_0x3a5229['dim'](_0x387831+':')+'\x20'+_0x36a00e+a22_0x3a5229[_0x500278(0x1e0)](_0x211632);}return a22_0x3a5229['dim'](_0x1a15b6);}function showFileNotFoundError(_0x2ba51a,_0x1fcd67){const _0x2ee876=a22_0x2331ee;console[_0x2ee876(0x1d1)](a22_0x3a5229[_0x2ee876(0x147)](_0x2ee876(0x22d)+_0x2ba51a+'\x0a')),console[_0x2ee876(0x1d1)](a22_0x3a5229['cyan'](_0x2ee876(0x26a)+_0x1fcd67+_0x2ee876(0x151)));}function displayRealtimeValidation(_0x334592){const _0x2bce1a=a22_0x2331ee;if(!_0x334592['realtime'])return;const _0x38d9d1=_0x334592[_0x2bce1a(0x1e6)],_0xd8a4b=_0x38d9d1[_0x2bce1a(0x181)]?a22_0x3a5229[_0x2bce1a(0x178)](_0x2bce1a(0x201)):a22_0x3a5229[_0x2bce1a(0x239)](_0x2bce1a(0x251));console[_0x2bce1a(0x1d1)]('\x0a'+a22_0x3a5229[_0x2bce1a(0x1e0)]('RT\x202.0:')+'\x20'+_0xd8a4b);if(_0x38d9d1[_0x2bce1a(0x1e9)]&&_0x38d9d1[_0x2bce1a(0x1e9)][_0x2bce1a(0x1ab)]>0x0){console[_0x2bce1a(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x2bce1a(0x1e0)](_0x2bce1a(0x185))+'\x20'+_0x38d9d1['events'][_0x2bce1a(0x1ab)]+_0x2bce1a(0x118));for(const _0x36abaa of _0x38d9d1['events']){const _0x4b473c=_0x36abaa[_0x2bce1a(0x1b8)]===![]?a22_0x3a5229[_0x2bce1a(0x147)]('✘'):a22_0x3a5229[_0x2bce1a(0x178)]('✔');console[_0x2bce1a(0x1d1)](_0x2bce1a(0x209)+_0x4b473c+'\x20'+_0x36abaa['name']),_0x36abaa[_0x2bce1a(0x1d4)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a22_0x3a5229[_0x2bce1a(0x147)](_0x36abaa[_0x2bce1a(0x1d4)]));}}if(_0x38d9d1[_0x2bce1a(0x27e)]&&_0x38d9d1['attributes']['length']>0x0){console[_0x2bce1a(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x2bce1a(0x1e0)](_0x2bce1a(0x18b))+'\x20'+_0x38d9d1[_0x2bce1a(0x27e)]['length']+_0x2bce1a(0x118));for(const _0x11e700 of _0x38d9d1[_0x2bce1a(0x27e)]){const _0x41d079=_0x11e700[_0x2bce1a(0x241)]?a22_0x3a5229[_0x2bce1a(0x178)]('✔'):a22_0x3a5229[_0x2bce1a(0x147)]('✘');console[_0x2bce1a(0x1d1)](_0x2bce1a(0x209)+_0x41d079+'\x20'+_0x11e700[_0x2bce1a(0x1c0)]+'\x20'+a22_0x3a5229[_0x2bce1a(0x1e0)]('('+_0x11e700[_0x2bce1a(0x278)]+')'));}}if(_0x38d9d1[_0x2bce1a(0x276)]){const _0x5c7bdb=_0x38d9d1[_0x2bce1a(0x276)][_0x2bce1a(0x1d0)]?.[_0x2bce1a(0x1ab)]?_0x2bce1a(0x24c)+_0x38d9d1[_0x2bce1a(0x276)][_0x2bce1a(0x1d0)][_0x2bce1a(0x18a)](',\x20')+']':'';console['error']('\x20\x20'+a22_0x3a5229[_0x2bce1a(0x1e0)](_0x2bce1a(0x1a1))+'\x20'+_0x38d9d1['idStitching'][_0x2bce1a(0x234)]+_0x5c7bdb);}if(_0x38d9d1[_0x2bce1a(0x1ef)]&&_0x38d9d1[_0x2bce1a(0x1ef)]['length']>0x0){console[_0x2bce1a(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x2bce1a(0x1e0)](_0x2bce1a(0x1cd))+'\x20'+_0x38d9d1[_0x2bce1a(0x1ef)][_0x2bce1a(0x1ab)]+_0x2bce1a(0x12b)+(_0x38d9d1[_0x2bce1a(0x1ef)]['length']!==0x1?'s':''));for(const _0x4b955e of _0x38d9d1[_0x2bce1a(0x1ef)]){console[_0x2bce1a(0x1d1)]('\x20\x20\x20\x20-\x20'+_0x4b955e[_0x2bce1a(0x1c0)]);}}}function showParentSegmentNotSetError(_0x370629){const _0x3092d4=a22_0x2331ee;console['error'](a22_0x3a5229[_0x3092d4(0x239)](_0x3092d4(0x18f))),console[_0x3092d4(0x1d1)](_0x370629);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x144);[a22_0x2331ee(0x24e)]='List\x20parent\x20segments';async[a22_0x2331ee(0x28b)](_0x5a274a){const _0xb2c289=a22_0x2331ee,{options:_0x17fafc,args:_0x4cd026,tdx:_0x1ef263}=_0x5a274a,_0x45d52f=_0x4cd026[0x0];_0x17fafc['verbose']&&(console[_0xb2c289(0x1d1)](_0xb2c289(0x161)+_0x17fafc[_0xb2c289(0x29f)]),_0x45d52f&&console[_0xb2c289(0x1d1)]('Pattern:\x20'+_0x45d52f));const _0x5138ed=await withSpinner(_0x45d52f?_0xb2c289(0x141)+_0x45d52f+_0xb2c289(0x233):'Listing\x20parent\x20segments...',()=>_0x1ef263['segment'][_0xb2c289(0x275)](),{'verbose':_0x17fafc[_0xb2c289(0x22f)]});let _0x1496d1=_0x5138ed['data'];if(_0x45d52f){const _0x59e4f3=_0x45d52f[_0xb2c289(0x27c)](/[.+^${}()|[\]\\]/g,_0xb2c289(0x134))[_0xb2c289(0x27c)](/\*/g,'.*')[_0xb2c289(0x27c)](/\?/g,'.'),_0x455c18=new RegExp('^'+_0x59e4f3+'$','i');_0x1496d1=_0x1496d1[_0xb2c289(0x19a)](_0x2d50ff=>_0x455c18[_0xb2c289(0x224)](_0x2d50ff['attributes'][_0xb2c289(0x1c0)]));}_0x1496d1[_0xb2c289(0x127)]((_0x6f2cd7,_0x3bc6b1)=>_0x6f2cd7[_0xb2c289(0x27e)][_0xb2c289(0x1c0)]['localeCompare'](_0x3bc6b1['attributes'][_0xb2c289(0x1c0)])),console[_0xb2c289(0x1d1)]('✔\x20Found\x20'+_0x1496d1[_0xb2c289(0x1ab)]+_0xb2c289(0x244)+(_0x1496d1[_0xb2c289(0x1ab)]!==0x1?'s':''));const _0x5430ad=_0x2e037f=>{const _0x2d710b=_0xb2c289;return getConsoleNextUrl(_0x17fafc['site'],_0x2d710b(0x24f)+_0x2e037f);};if(_0x17fafc[_0xb2c289(0x1ad)]===_0xb2c289(0x26f)||_0x17fafc[_0xb2c289(0x1ad)]===_0xb2c289(0x121)){const _0x3f9936=_0x1496d1[_0xb2c289(0x21a)](_0x580f8c=>({..._0x580f8c,'url':_0x5430ad(_0x580f8c['id'])}));await handleSDKOutput(_0x3f9936,_0x17fafc);}else{if(_0x1496d1[_0xb2c289(0x1ab)]===0x0)_0x45d52f?console[_0xb2c289(0x130)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x45d52f):console[_0xb2c289(0x130)](_0xb2c289(0x1f3));else for(const _0x2ead7c of _0x1496d1){const _0x182be5=_0x2ead7c['attributes']['population']?a22_0x3a5229[_0xb2c289(0x1e0)]('\x20('+formatRows(_0x2ead7c['attributes']['population'])+')'):'',_0x8542e4=hyperlink(_0x2ead7c['attributes'][_0xb2c289(0x1c0)],_0x5430ad(_0x2ead7c['id']));console[_0xb2c289(0x130)]('👥\x20'+_0x8542e4+_0x182be5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]='segment:parent:create';[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x1e4);async[a22_0x2331ee(0x28b)](_0x2a98e5){const _0x3da5f3=a22_0x2331ee,{options:_0x5cc4bd,args:_0x30b9c7,tdx:_0x500aa7}=_0x2a98e5;console[_0x3da5f3(0x1d1)](_0x3da5f3(0x285)+_0x3da5f3(0x235)+_0x3da5f3(0x1b7));const _0x5a8388=_0x5cc4bd;if(_0x30b9c7['length']===0x0)return console[_0x3da5f3(0x1d1)](a22_0x3a5229[_0x3da5f3(0x147)](_0x3da5f3(0x15d))),console[_0x3da5f3(0x1d1)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x8df781=_0x30b9c7[0x0];if(!_0x5a8388[_0x3da5f3(0x13f)]||!_0x5a8388[_0x3da5f3(0x166)])return console['error'](_0x3da5f3(0x206)),console[_0x3da5f3(0x1d1)](_0x3da5f3(0x18e)),0x1;_0x5a8388[_0x3da5f3(0x22f)]&&(console[_0x3da5f3(0x1d1)](_0x3da5f3(0x161)+_0x5a8388['site']),console[_0x3da5f3(0x1d1)]('Name:\x20'+_0x8df781),console[_0x3da5f3(0x1d1)]('Database:\x20'+_0x5a8388[_0x3da5f3(0x13f)]),console[_0x3da5f3(0x1d1)](_0x3da5f3(0x25e)+_0x5a8388[_0x3da5f3(0x166)]));const _0x142c8a=await loadJSONFromOptions(_0x5a8388[_0x3da5f3(0x27e)],_0x5a8388[_0x3da5f3(0x12c)]),_0x29d8ff=await loadJSONFromOptions(_0x5a8388[_0x3da5f3(0x23a)],_0x5a8388[_0x3da5f3(0x1c9)]),_0x5d66a0=await loadJSONFromOptions(_0x5a8388[_0x3da5f3(0x123)],_0x5a8388[_0x3da5f3(0x205)]),_0x1257b0={'name':_0x8df781,'description':_0x5a8388['description'],'scheduleType':_0x5a8388[_0x3da5f3(0x274)],'scheduleOption':_0x5a8388[_0x3da5f3(0x1a3)],'timezone':_0x5a8388[_0x3da5f3(0x20e)],'master':{'parentDatabaseName':_0x5a8388['database'],'parentTableName':_0x5a8388[_0x3da5f3(0x166)]},'attributes':_0x142c8a,'behaviors':_0x29d8ff,'customerGroup':_0x5d66a0},_0x2b690b=await withSpinner(_0x3da5f3(0x1aa)+_0x8df781+_0x3da5f3(0x233),()=>_0x500aa7['segment'][_0x3da5f3(0x194)](_0x1257b0),{'verbose':_0x5cc4bd[_0x3da5f3(0x22f)]}),_0x341029=_0x2b690b[_0x3da5f3(0x19e)];return console[_0x3da5f3(0x1d1)](_0x3da5f3(0x295)+_0x341029['name']+'\x27\x20with\x20ID:\x20'+_0x341029['id']),await handleSDKOutput([_0x341029],_0x5cc4bd),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x13a);['description']=a22_0x2331ee(0x1be);async[a22_0x2331ee(0x28b)](_0x488145){const _0x5a6da5=a22_0x2331ee,{options:_0x433c97,args:_0x52dba9,tdx:_0x563210}=_0x488145;console[_0x5a6da5(0x1d1)](_0x5a6da5(0x26c)+_0x5a6da5(0x235)+_0x5a6da5(0x1b7));const _0x48aad4=_0x433c97;if(_0x52dba9[_0x5a6da5(0x1ab)]===0x0)return console[_0x5a6da5(0x1d1)](a22_0x3a5229['red'](_0x5a6da5(0x15d))),console[_0x5a6da5(0x1d1)](_0x5a6da5(0x26b)),0x1;const _0x43bd0e=_0x52dba9[0x0];_0x48aad4[_0x5a6da5(0x22f)]&&(console[_0x5a6da5(0x1d1)](_0x5a6da5(0x161)+_0x48aad4[_0x5a6da5(0x29f)]),console[_0x5a6da5(0x1d1)](_0x5a6da5(0x1b5)+_0x43bd0e));const _0x53057c=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x43bd0e+_0x5a6da5(0x233),()=>_0x563210[_0x5a6da5(0x237)][_0x5a6da5(0x271)](_0x43bd0e),{'verbose':_0x48aad4['verbose']}),_0x52fcc8=_0x53057c[_0x5a6da5(0x19e)],_0xb9b53=await loadJSONFromOptions(_0x48aad4[_0x5a6da5(0x28f)],_0x48aad4['addAttributesFile']),_0x35c893=await loadJSONFromOptions(_0x48aad4[_0x5a6da5(0x1af)],_0x48aad4[_0x5a6da5(0x160)]),_0x40c123={'name':_0x52fcc8['name'],'description':_0x48aad4[_0x5a6da5(0x24e)]!==undefined?_0x48aad4[_0x5a6da5(0x24e)]:_0x52fcc8[_0x5a6da5(0x24e)],'scheduleType':_0x48aad4[_0x5a6da5(0x274)]!==undefined?_0x48aad4[_0x5a6da5(0x274)]:_0x52fcc8[_0x5a6da5(0x274)],'scheduleOption':_0x48aad4['scheduleOption']!==undefined?_0x48aad4['scheduleOption']:_0x52fcc8[_0x5a6da5(0x1a3)],'timezone':_0x48aad4[_0x5a6da5(0x20e)]!==undefined?_0x48aad4[_0x5a6da5(0x20e)]:_0x52fcc8['timezone'],'master':_0x52fcc8['master'],'attributes':_0xb9b53?[..._0x52fcc8['attributes']||[],..._0xb9b53]:_0x52fcc8[_0x5a6da5(0x27e)],'behaviors':_0x35c893?[..._0x52fcc8[_0x5a6da5(0x23a)]||[],..._0x35c893]:_0x52fcc8[_0x5a6da5(0x23a)],'customerGroup':_0x52fcc8['customerGroup']},_0x74a92d=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x43bd0e+'\x27...',()=>_0x563210[_0x5a6da5(0x237)][_0x5a6da5(0x1a6)](_0x43bd0e,_0x40c123),{'verbose':_0x48aad4[_0x5a6da5(0x22f)]}),_0x276982=_0x74a92d['data'];return console[_0x5a6da5(0x1d1)](_0x5a6da5(0x137)+_0x276982['name']+'\x27'),await handleSDKOutput([_0x276982],_0x48aad4),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x272);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x1ba);async[a22_0x2331ee(0x28b)](_0x455a9a){const _0x42622e=a22_0x2331ee,{options:_0x31fe28,args:_0xcfd72e,tdx:_0x1530c8}=_0x455a9a,_0x3da47c=_0x31fe28,_0x4a5599=_0xcfd72e[0x0]||_0x31fe28[_0x42622e(0x23f)];if(!_0x4a5599)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x42622e(0x196)),0x1;if(_0x3da47c[_0x42622e(0x28a)]&&_0x3da47c[_0x42622e(0x1b3)])return console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x147)](_0x42622e(0x247))),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x1e0)](_0x42622e(0x15f))),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x1e0)](_0x42622e(0x229)+PARENT_SEGMENT_DIR+_0x42622e(0x182))),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x1c1)](_0x42622e(0x162))),0x1;const _0x29e7b3=_0x3da47c[_0x42622e(0x1b3)]||a22_0x5d62e3['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4a5599)+'.yml');_0x3da47c[_0x42622e(0x22f)]&&(console[_0x42622e(0x1d1)](_0x42622e(0x161)+_0x3da47c['site']),console[_0x42622e(0x1d1)](_0x42622e(0x1b5)+_0x4a5599),console[_0x42622e(0x1d1)](_0x42622e(0x1d9)+_0x29e7b3));const _0x56ba4e=await withSpinner(_0x42622e(0x157)+_0x4a5599+_0x42622e(0x233),()=>_0x1530c8['segment']['pullParentYaml'](_0x4a5599),{'verbose':_0x3da47c[_0x42622e(0x22f)]}),_0x26d400=_0x56ba4e[_0x42622e(0x19e)];if(existsSync(_0x29e7b3)){const _0x42919b=readFileSync(_0x29e7b3,_0x42622e(0x165)),_0x33e401=generateDiff(_0x42919b,_0x26d400);if(!hasChanges(_0x33e401))console['error'](a22_0x3a5229[_0x42622e(0x178)]('✔')+_0x42622e(0x1ca)+a22_0x3a5229[_0x42622e(0x1c1)](_0x29e7b3)+_0x42622e(0x1bb));else{console['error'](_0x42622e(0x264)+_0x29e7b3+'\x27:'),console[_0x42622e(0x1d1)]('─'[_0x42622e(0x25f)](0x3c)),console[_0x42622e(0x1d1)](formatDiffWithColors(_0x33e401)),console['error']('─'[_0x42622e(0x25f)](0x3c));if(!_0x3da47c[_0x42622e(0x218)]){if(!isInteractive())return console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x147)]('\x0aError:'),_0x42622e(0x1c7)),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x1e0)](_0x42622e(0x217))),0x1;const _0x460c70=await confirmKey(_0x42622e(0x27b)+_0x29e7b3+'\x27?');if(!_0x460c70)return console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x239)](_0x42622e(0x21f))),0x1;}writeFileSync(_0x29e7b3,_0x26d400,'utf-8'),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x178)]('✔')+_0x42622e(0x14e)+a22_0x3a5229[_0x42622e(0x1c1)](_0x29e7b3));}}else{const _0x536b7a=a22_0x5d62e3['dirname'](_0x29e7b3);!existsSync(_0x536b7a)&&mkdirSync(_0x536b7a,{'recursive':!![]}),writeFileSync(_0x29e7b3,_0x26d400,_0x42622e(0x165)),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x178)]('✔')+_0x42622e(0x14e)+a22_0x3a5229[_0x42622e(0x1c1)](_0x29e7b3));}return saveSessionContext({'parent_segment':_0x4a5599},_0x3da47c[_0x42622e(0x1fa)]),console[_0x42622e(0x1d1)](a22_0x3a5229[_0x42622e(0x178)]('✔')+_0x42622e(0x1e2)+a22_0x3a5229[_0x42622e(0x1e0)](_0x42622e(0x11f))+'\x20=\x20'+a22_0x3a5229[_0x42622e(0x1c1)](_0x4a5599)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]='segment:parent:push';[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x19f);async[a22_0x2331ee(0x28b)](_0x36a4df){const _0x26339c=a22_0x2331ee,{options:_0x532005,args:_0x29e6c0,tdx:_0x3670b9}=_0x36a4df,_0x558034=_0x532005,_0x35759b=_0x29e6c0[0x0]||_0x532005[_0x26339c(0x23f)];if(!_0x35759b)return showParentSegmentNotSetError(_0x26339c(0x120)+_0x26339c(0x24a)),0x1;const _0x1bc72c=resolveYamlFile(_0x35759b);if(!existsSync(_0x1bc72c))return showFileNotFoundError(_0x1bc72c,_0x35759b),0x1;_0x558034[_0x26339c(0x22f)]&&(console[_0x26339c(0x1d1)](_0x26339c(0x161)+_0x558034[_0x26339c(0x29f)]),console[_0x26339c(0x1d1)](_0x26339c(0x18c)+_0x1bc72c));let _0x598e41;try{_0x598e41=readFileSync(_0x1bc72c,_0x26339c(0x165));}catch(_0x2e65b6){const _0x7ec8ad=_0x2e65b6 instanceof Error?_0x2e65b6[_0x26339c(0x20f)]:String(_0x2e65b6);return console[_0x26339c(0x1d1)](_0x26339c(0x140)+_0x7ec8ad),0x1;}const _0x432bb1=await withSpinner(_0x26339c(0x11e),()=>_0x3670b9['segment'][_0x26339c(0x1f5)](_0x598e41),{'verbose':_0x558034[_0x26339c(0x22f)]}),_0x28bc27=_0x432bb1['data'],{isNew:_0x27ca0d,name:_0x41013a,hasChanges:_0x1673ac,diffFormatted:_0x38939e}=_0x28bc27;if(!_0x1673ac)return console[_0x26339c(0x1d1)](_0x26339c(0x159)+_0x41013a+_0x26339c(0x136)),0x0;_0x27ca0d?console[_0x26339c(0x1d1)](_0x26339c(0x20b)+_0x41013a+'\x27:'):console[_0x26339c(0x1d1)](_0x26339c(0x1da)+_0x41013a+'\x27:');console[_0x26339c(0x1d1)]('─'[_0x26339c(0x25f)](0x3c)),console['error'](_0x38939e),console[_0x26339c(0x1d1)]('─'['repeat'](0x3c));const _0x5c40d0=_0x27ca0d?_0x26339c(0x214)+_0x41013a+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x41013a+'\x27?';if(!_0x558034[_0x26339c(0x218)]){if(!isInteractive())return console[_0x26339c(0x1d1)](a22_0x3a5229[_0x26339c(0x147)](_0x26339c(0x125)),_0x26339c(0x1c7)),console[_0x26339c(0x1d1)](a22_0x3a5229[_0x26339c(0x1e0)](_0x26339c(0x217))),0x1;const _0x4b387a=await confirmKey(_0x5c40d0);if(!_0x4b387a)return console[_0x26339c(0x1d1)](a22_0x3a5229[_0x26339c(0x239)](_0x26339c(0x21f))),0x1;}const _0x59519d=_0x27ca0d?_0x26339c(0x168):'Updating',_0x41faf5=await withSpinner(_0x59519d+_0x26339c(0x1c6)+_0x41013a+_0x26339c(0x233),()=>_0x28bc27[_0x26339c(0x298)](),{'verbose':_0x558034['verbose']}),_0x81be10=_0x41faf5[_0x26339c(0x19e)],_0x483101=getConsoleNextUrl(_0x558034['site'],_0x26339c(0x24f)+_0x81be10['id']),_0x8461d1=_0x27ca0d?_0x26339c(0x252):_0x26339c(0x216);return console[_0x26339c(0x1d1)]('✔\x20'+_0x8461d1+_0x26339c(0x1c6)+_0x81be10[_0x26339c(0x1c0)]+'\x27'),console[_0x26339c(0x1d1)]('\x20\x20'+_0x483101),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x145);[a22_0x2331ee(0x24e)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x98f58){const _0x1a8531=a22_0x2331ee,{options:_0x4a3531,args:_0xf09b76,tdx:_0x3157b1}=_0x98f58,_0x1ac8fe=_0x4a3531,_0x13e32a=_0xf09b76[0x0]||_0x4a3531[_0x1a8531(0x23f)];if(!_0x13e32a)return showParentSegmentNotSetError(_0x1a8531(0x245)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x1a8531(0x115)+_0x1a8531(0x223)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x2b13bd=resolveYamlFile(_0x13e32a);if(!existsSync(_0x2b13bd))return showFileNotFoundError(_0x2b13bd,_0x13e32a),0x1;_0x1ac8fe[_0x1a8531(0x22f)]&&(console['error'](_0x1a8531(0x161)+_0x1ac8fe[_0x1a8531(0x29f)]),console[_0x1a8531(0x1d1)](_0x1a8531(0x18c)+_0x2b13bd));let _0x108cab;try{_0x108cab=readFileSync(_0x2b13bd,_0x1a8531(0x165));}catch(_0x275a38){const _0x53128e=_0x275a38 instanceof Error?_0x275a38[_0x1a8531(0x20f)]:String(_0x275a38);return console[_0x1a8531(0x1d1)]('Error\x20reading\x20file:\x20'+_0x53128e),0x1;}const _0x3576a8=createCommandSpinner(a22_0x3a5229['dim'](_0x1a8531(0x1eb)),{'verbose':_0x1ac8fe[_0x1a8531(0x22f)]});_0x3576a8[_0x1a8531(0x26d)]();const _0x560364={'onProgress':_0x39d2d6=>{const _0x4b32a7=_0x1a8531;_0x3576a8[_0x4b32a7(0x1a8)]=formatProgressMessage(_0x39d2d6);}};if(_0x1ac8fe[_0x1a8531(0x22b)])_0x560364['master']=!![];if(_0x1ac8fe[_0x1a8531(0x1f6)])_0x560364[_0x1a8531(0x1f6)]=!![];_0x1ac8fe[_0x1a8531(0x13b)]&&(_0x560364[_0x1a8531(0x13b)]=_0x1ac8fe[_0x1a8531(0x13b)]);_0x1ac8fe[_0x1a8531(0x1c2)]&&(_0x560364['behavior']=_0x1ac8fe[_0x1a8531(0x1c2)]);if(_0x1ac8fe['interval'])_0x560364[_0x1a8531(0x189)]=_0x1ac8fe[_0x1a8531(0x189)];let _0x1cdb86;try{_0x1cdb86=await _0x3157b1[_0x1a8531(0x237)][_0x1a8531(0x17a)](_0x108cab,_0x560364),_0x3576a8[_0x1a8531(0x282)]();}catch(_0x2d578e){_0x3576a8[_0x1a8531(0x282)]();throw _0x2d578e;}const _0xc02f65=_0x1ac8fe['interval']||'-1d';return this[_0x1a8531(0x1a5)](_0x1cdb86,_0x560364,_0x2b13bd,_0xc02f65),_0x1cdb86[_0x1a8531(0x242)]?0x0:0x1;}['displayValidateResults'](_0x4d014a,_0x253a2e,_0x5046de,_0x589831){const _0x22d119=a22_0x2331ee;console['error']('\x0a'+a22_0x3a5229[_0x22d119(0x243)](_0x22d119(0x262))+'\x20'+_0x4d014a[_0x22d119(0x1c0)]),console[_0x22d119(0x1d1)]('═'[_0x22d119(0x25f)](0x3c)),this['displayMasterInfo'](_0x4d014a);if(typeof _0x253a2e[_0x22d119(0x13b)]==='string'){this[_0x22d119(0x26e)](_0x4d014a),this[_0x22d119(0x170)](_0x4d014a),this[_0x22d119(0x174)](_0x5046de,_0x589831,_0x22d119(0x13b),_0x253a2e['attribute']);return;}if(_0x253a2e[_0x22d119(0x13b)]===!![]){this[_0x22d119(0x26e)](_0x4d014a),this[_0x22d119(0x170)](_0x4d014a),this[_0x22d119(0x174)](_0x5046de,_0x589831,_0x22d119(0x27e));return;}if(typeof _0x253a2e['behavior']===_0x22d119(0x1df)){this[_0x22d119(0x1f8)](_0x4d014a,_0x589831),this[_0x22d119(0x170)](_0x4d014a),this[_0x22d119(0x174)](_0x5046de,_0x589831,'behavior',_0x253a2e[_0x22d119(0x1c2)]);return;}if(_0x253a2e[_0x22d119(0x1c2)]===!![]){this['displayBehaviorsStats'](_0x4d014a,_0x589831),this[_0x22d119(0x170)](_0x4d014a),this[_0x22d119(0x174)](_0x5046de,_0x589831,_0x22d119(0x23a));return;}this['displayAttributesStats'](_0x4d014a),this[_0x22d119(0x1f8)](_0x4d014a,_0x589831),this['displayRealtimeInfo'](_0x4d014a),this[_0x22d119(0x170)](_0x4d014a),this[_0x22d119(0x174)](_0x5046de,_0x589831,_0x22d119(0x184));}[a22_0x2331ee(0x227)](_0x3c976d){displayRealtimeValidation(_0x3c976d);}[a22_0x2331ee(0x174)](_0x5bb853,_0x1d3dd3,_0x1b531e,_0x4bb5fc){const _0x550411=a22_0x2331ee;console['error']('\x0a'+a22_0x3a5229[_0x550411(0x1e0)]('To\x20view\x20sample\x20data:'));const _0x41b7d7=_0x1d3dd3!=='-1d'?'\x20--interval\x20'+_0x1d3dd3:'';if(_0x1b531e===_0x550411(0x13b)&&_0x4bb5fc)console[_0x550411(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x550411(0x1e0)](_0x550411(0x13e)+_0x5bb853+'\x20--attribute\x20\x22'+_0x4bb5fc+'\x22'+_0x41b7d7));else{if(_0x1b531e==='behavior'&&_0x4bb5fc)console[_0x550411(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x550411(0x1e0)](_0x550411(0x13e)+_0x5bb853+_0x550411(0x192)+_0x4bb5fc+'\x22'+_0x41b7d7));else(_0x1b531e===_0x550411(0x27e)||_0x1b531e===_0x550411(0x184))&&console[_0x550411(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x550411(0x1e0)](_0x550411(0x13e)+_0x5bb853+_0x550411(0x1bd)+_0x41b7d7));}(_0x1b531e===_0x550411(0x23a)||_0x1b531e===_0x550411(0x184))&&console[_0x550411(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x550411(0x1e0)](_0x550411(0x13e)+_0x5bb853+_0x550411(0x1ee)+_0x41b7d7)),_0x1b531e===_0x550411(0x184)&&console[_0x550411(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x550411(0x1e0)](_0x550411(0x13e)+_0x5bb853+'\x20--enriched'+_0x41b7d7));}[a22_0x2331ee(0x22c)](_0x19e32f){const _0xd0b7c3=a22_0x2331ee,{master:_0x15f5c9}=_0x19e32f,_0x5cba54=_0x15f5c9['schemaValid']?a22_0x3a5229['green']('✔'):a22_0x3a5229['red']('✘');console[_0xd0b7c3(0x1d1)]('\x0a'+a22_0x3a5229['dim'](_0xd0b7c3(0x1db))),console[_0xd0b7c3(0x1d1)](_0x5cba54+'\x20'+a22_0x3a5229['bold'](_0x15f5c9[_0xd0b7c3(0x13f)]+'.'+_0x15f5c9['table'])),_0x15f5c9[_0xd0b7c3(0x13c)]?_0x15f5c9[_0xd0b7c3(0x154)]!==undefined&&console[_0xd0b7c3(0x1d1)]('\x20\x20'+a22_0x3a5229[_0xd0b7c3(0x1e0)](_0xd0b7c3(0x163))+'\x20'+a22_0x3a5229[_0xd0b7c3(0x1c1)](formatRows(_0x15f5c9[_0xd0b7c3(0x154)]))):console[_0xd0b7c3(0x1d1)]('\x20\x20'+a22_0x3a5229['red'](_0xd0b7c3(0x210))+'\x20'+_0x15f5c9[_0xd0b7c3(0x1f9)]);}[a22_0x2331ee(0x26e)](_0x3c296e){const _0x2b18f5=a22_0x2331ee;if(_0x3c296e[_0x2b18f5(0x27e)][_0x2b18f5(0x1ab)]===0x0)return;console[_0x2b18f5(0x1d1)]('\x0a'+a22_0x3a5229[_0x2b18f5(0x1e0)]('Attributes'));for(const _0x55798f of _0x3c296e[_0x2b18f5(0x27e)]){const _0x2623a2=_0x55798f[_0x2b18f5(0x13c)]?a22_0x3a5229[_0x2b18f5(0x178)]('✔'):a22_0x3a5229['red']('✘');let _0x52bdaa='';if(_0x55798f[_0x2b18f5(0x13c)]&&_0x55798f[_0x2b18f5(0x22a)]!==undefined&&_0x55798f['coveragePercent']!==undefined){const _0x90c2bd=_0x55798f[_0x2b18f5(0x29b)][_0x2b18f5(0x24d)](0x1),_0x4781ec=_0x55798f[_0x2b18f5(0x29b)]>=0x50?a22_0x3a5229[_0x2b18f5(0x178)]:_0x55798f[_0x2b18f5(0x29b)]>=0x32?a22_0x3a5229[_0x2b18f5(0x239)]:a22_0x3a5229[_0x2b18f5(0x147)];_0x52bdaa='\x20'+a22_0x3a5229[_0x2b18f5(0x1e0)](_0x2b18f5(0x299))+'\x20'+_0x4781ec(_0x90c2bd+'%')+'\x20('+formatRows(_0x55798f[_0x2b18f5(0x22a)])+_0x2b18f5(0x119);}console[_0x2b18f5(0x1d1)](_0x2623a2+'\x20'+a22_0x3a5229[_0x2b18f5(0x243)](_0x55798f['name'])+_0x52bdaa),console[_0x2b18f5(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x2b18f5(0x1e0)](_0x2b18f5(0x29a))+'\x20'+a22_0x3a5229[_0x2b18f5(0x243)](_0x55798f[_0x2b18f5(0x13f)]+'.'+_0x55798f[_0x2b18f5(0x166)]));const _0x4ddf52=_0x55798f[_0x2b18f5(0x13d)]===_0x55798f[_0x2b18f5(0x204)]?a22_0x3a5229['dim'](_0x2b18f5(0x294))+'\x20'+_0x55798f[_0x2b18f5(0x13d)]:a22_0x3a5229['dim'](_0x2b18f5(0x21d))+'\x20'+_0x55798f['joinKey']+_0x2b18f5(0x29e)+_0x55798f[_0x2b18f5(0x204)];console[_0x2b18f5(0x1d1)]('\x20\x20'+_0x4ddf52),console[_0x2b18f5(0x1d1)]('\x20\x20'+a22_0x3a5229['dim'](_0x2b18f5(0x188))),this[_0x2b18f5(0x25c)](_0x55798f[_0x2b18f5(0x266)]),!_0x55798f[_0x2b18f5(0x13c)]&&console[_0x2b18f5(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x2b18f5(0x147)]('Error:')+'\x20'+_0x55798f['schemaError']);}}[a22_0x2331ee(0x1f8)](_0x2371c3,_0x33a934){const _0x3742ce=a22_0x2331ee;if(_0x2371c3[_0x3742ce(0x23a)][_0x3742ce(0x1ab)]===0x0)return;console[_0x3742ce(0x1d1)]('\x0a'+a22_0x3a5229[_0x3742ce(0x1e0)](_0x3742ce(0x17e))+'\x20'+a22_0x3a5229['dim']('('+_0x33a934+')'));for(const _0x174974 of _0x2371c3['behaviors']){const _0x10cb15=_0x174974[_0x3742ce(0x13c)]?a22_0x3a5229['green']('✔'):a22_0x3a5229[_0x3742ce(0x147)]('✘');let _0x576621='';if(_0x174974[_0x3742ce(0x13c)]&&_0x174974[_0x3742ce(0x1d5)]!==undefined&&_0x174974['totalEvents']!==undefined){const _0x229bf5=_0x174974[_0x3742ce(0x29c)]?.[_0x3742ce(0x24d)](0x1)||'?',_0x3a2850=(_0x174974['customerPercent']??0x0)>=0x32?a22_0x3a5229[_0x3742ce(0x178)]:(_0x174974['customerPercent']??0x0)>=0x14?a22_0x3a5229['yellow']:a22_0x3a5229[_0x3742ce(0x147)];_0x576621='\x20'+a22_0x3a5229[_0x3742ce(0x1e0)](_0x3742ce(0x12e))+'\x20'+_0x3a2850(formatRows(_0x174974[_0x3742ce(0x1d5)]))+'\x20('+_0x229bf5+'%)\x20'+a22_0x3a5229[_0x3742ce(0x1e0)]('Events:')+'\x20'+a22_0x3a5229['cyan'](formatRows(_0x174974[_0x3742ce(0x258)]));}console['error'](_0x10cb15+'\x20'+a22_0x3a5229[_0x3742ce(0x243)](_0x174974[_0x3742ce(0x1c0)])+_0x576621),console[_0x3742ce(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x3742ce(0x1e0)](_0x3742ce(0x29a))+'\x20'+a22_0x3a5229[_0x3742ce(0x243)](_0x174974[_0x3742ce(0x13f)]+'.'+_0x174974[_0x3742ce(0x166)]));const _0x4175ed=_0x174974['joinKey']===_0x174974[_0x3742ce(0x204)]?a22_0x3a5229['dim'](_0x3742ce(0x294))+'\x20'+_0x174974[_0x3742ce(0x13d)]:a22_0x3a5229[_0x3742ce(0x1e0)](_0x3742ce(0x21d))+'\x20'+_0x174974[_0x3742ce(0x13d)]+_0x3742ce(0x29e)+_0x174974[_0x3742ce(0x204)];console['error']('\x20\x20'+_0x4175ed),console[_0x3742ce(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x3742ce(0x1e0)](_0x3742ce(0x188))),this['displayColumns'](_0x174974[_0x3742ce(0x266)]),!_0x174974[_0x3742ce(0x13c)]&&console[_0x3742ce(0x1d1)]('\x20\x20'+a22_0x3a5229['red'](_0x3742ce(0x210))+'\x20'+_0x174974[_0x3742ce(0x1f9)]);}}[a22_0x2331ee(0x25c)](_0x1b2279){const _0xfdb4ae=a22_0x2331ee;for(const _0x5e5fe1 of _0x1b2279){_0x5e5fe1[_0xfdb4ae(0x296)]===_0x5e5fe1[_0xfdb4ae(0x17f)]||_0x5e5fe1['column']==='*'?console[_0xfdb4ae(0x1d1)](_0xfdb4ae(0x1a0)+_0x5e5fe1['label']):console['error'](_0xfdb4ae(0x1a0)+_0x5e5fe1[_0xfdb4ae(0x296)]+'\x20'+a22_0x3a5229['dim']('('+_0x5e5fe1[_0xfdb4ae(0x17f)]+')'));}}[a22_0x2331ee(0x170)](_0xac637f){const _0x33d573=a22_0x2331ee;console[_0x33d573(0x1d1)]('─'[_0x33d573(0x25f)](0x3c));if(_0xac637f[_0x33d573(0x14a)][_0x33d573(0x1ab)]>0x0){console[_0x33d573(0x1d1)]('\x0a'+a22_0x3a5229[_0x33d573(0x147)](_0x33d573(0x16d)));for(const _0x40a807 of _0xac637f[_0x33d573(0x14a)]){console[_0x33d573(0x1d1)]('\x20\x20'+a22_0x3a5229['red']('•')+'\x20'+_0x40a807);}}_0xac637f[_0x33d573(0x242)]&&console[_0x33d573(0x1d1)]('\x0a'+a22_0x3a5229['green']('✔')+_0x33d573(0x221));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]='segment:parent:preview';[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x117);async[a22_0x2331ee(0x28b)](_0x52f349){const _0x5c4aa6=a22_0x2331ee,{options:_0x4309fb,args:_0x34749a,tdx:_0x4d8dd9}=_0x52f349,_0x55fc56=_0x4309fb,_0x4656fc=_0x34749a[0x0]||_0x4309fb['parentSegment'];if(!_0x4656fc)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x5c4aa6(0x249)+_0x5c4aa6(0x1d2)+_0x5c4aa6(0x291)+_0x5c4aa6(0x215)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\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(!_0x55fc56[_0x5c4aa6(0x22b)]&&!_0x55fc56[_0x5c4aa6(0x13b)]&&!_0x55fc56[_0x5c4aa6(0x1c2)]&&!_0x55fc56[_0x5c4aa6(0x1f6)])return console['error'](a22_0x3a5229[_0x5c4aa6(0x147)](_0x5c4aa6(0x124))),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x173)),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x1fb)),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x1a9)),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x122)),console['error'](_0x5c4aa6(0x126)),console['error'](_0x5c4aa6(0x164)),0x1;const _0x35c16d=resolveYamlFile(_0x4656fc);if(!existsSync(_0x35c16d))return showFileNotFoundError(_0x35c16d,_0x4656fc),0x1;_0x55fc56['verbose']&&(console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x161)+_0x55fc56[_0x5c4aa6(0x29f)]),console['error'](_0x5c4aa6(0x18c)+_0x35c16d));let _0x54f60d;try{_0x54f60d=readFileSync(_0x35c16d,'utf-8');}catch(_0x407811){const _0x5910fc=_0x407811 instanceof Error?_0x407811[_0x5c4aa6(0x20f)]:String(_0x407811);return console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x140)+_0x5910fc),0x1;}let _0x17e15c;try{_0x17e15c=parseDef(_0x54f60d);}catch(_0x5e9b44){const _0x27cbf2=_0x5e9b44 instanceof Error?_0x5e9b44['message']:String(_0x5e9b44);return console[_0x5c4aa6(0x1d1)](a22_0x3a5229[_0x5c4aa6(0x147)](_0x5c4aa6(0x155)+_0x27cbf2)),0x1;}if(_0x55fc56[_0x5c4aa6(0x13b)]===!![]||_0x55fc56[_0x5c4aa6(0x13b)]===''){const _0x57870a=_0x17e15c[_0x5c4aa6(0x27e)]?.[_0x5c4aa6(0x21a)](_0x3b5020=>_0x3b5020[_0x5c4aa6(0x1c0)])||[];if(_0x57870a[_0x5c4aa6(0x1ab)]===0x0)console[_0x5c4aa6(0x1d1)](a22_0x3a5229[_0x5c4aa6(0x147)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a22_0x3a5229['red'](_0x5c4aa6(0x297))),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x177));for(const _0x1c00ce of _0x57870a){console[_0x5c4aa6(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x5c4aa6(0x1c1)](_0x1c00ce));}console['error'](_0x5c4aa6(0x135)+_0x4656fc+'\x20--attribute\x20\x22'+_0x57870a[0x0]+'\x22');}return 0x1;}if(_0x55fc56['behavior']===!![]||_0x55fc56['behavior']===''){const _0x5541c0=_0x17e15c[_0x5c4aa6(0x23a)]?.['map'](_0x485fa4=>_0x485fa4[_0x5c4aa6(0x1c0)])||[];if(_0x5541c0[_0x5c4aa6(0x1ab)]===0x0)console[_0x5c4aa6(0x1d1)](a22_0x3a5229[_0x5c4aa6(0x147)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x5c4aa6(0x1d1)](a22_0x3a5229[_0x5c4aa6(0x147)](_0x5c4aa6(0x1ec))),console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x259));for(const _0xb8ba6a of _0x5541c0){console[_0x5c4aa6(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x5c4aa6(0x1c1)](_0xb8ba6a));}console[_0x5c4aa6(0x1d1)](_0x5c4aa6(0x135)+_0x4656fc+_0x5c4aa6(0x192)+_0x5541c0[0x0]+'\x22');}return 0x1;}const _0x24c72b=createCommandSpinner(a22_0x3a5229['dim'](_0x5c4aa6(0x1e8)),{'verbose':_0x55fc56['verbose']});_0x24c72b[_0x5c4aa6(0x26d)]();const _0xc29c22={'onProgress':_0xb30c02=>{const _0x402326=_0x5c4aa6;_0x24c72b[_0x402326(0x1a8)]=formatProgressMessage(_0xb30c02);}};if(_0x55fc56['master'])_0xc29c22[_0x5c4aa6(0x22b)]=!![];if(_0x55fc56['attribute']&&typeof _0x55fc56[_0x5c4aa6(0x13b)]===_0x5c4aa6(0x1df))_0xc29c22[_0x5c4aa6(0x13b)]=_0x55fc56[_0x5c4aa6(0x13b)];if(_0x55fc56[_0x5c4aa6(0x1c2)]&&typeof _0x55fc56['behavior']===_0x5c4aa6(0x1df))_0xc29c22[_0x5c4aa6(0x1c2)]=_0x55fc56[_0x5c4aa6(0x1c2)];if(_0x55fc56[_0x5c4aa6(0x1f6)])_0xc29c22[_0x5c4aa6(0x1f6)]=!![];if(_0x55fc56[_0x5c4aa6(0x189)])_0xc29c22[_0x5c4aa6(0x189)]=_0x55fc56[_0x5c4aa6(0x189)];let _0x35ed01;try{_0x35ed01=await _0x4d8dd9['segment'][_0x5c4aa6(0x1cc)](_0x54f60d,_0xc29c22),_0x24c72b[_0x5c4aa6(0x282)]();}catch(_0x568def){_0x24c72b[_0x5c4aa6(0x282)]();throw _0x568def;}return await this['displayPreviewResults'](_0x35ed01,{'master':_0x55fc56[_0x5c4aa6(0x22b)],'attribute':typeof _0x55fc56['attribute']==='string'?_0x55fc56[_0x5c4aa6(0x13b)]:undefined,'behavior':typeof _0x55fc56[_0x5c4aa6(0x1c2)]==='string'?_0x55fc56[_0x5c4aa6(0x1c2)]:undefined,'enriched':_0x55fc56[_0x5c4aa6(0x1f6)]}),_0x35ed01['allValid']?0x0:0x1;}async[a22_0x2331ee(0x195)](_0x2e98e1,_0x25a41e){const _0x360f30=a22_0x2331ee;console[_0x360f30(0x1d1)]('\x0a'+a22_0x3a5229['bold'](_0x360f30(0x152))+'\x20'+_0x2e98e1[_0x360f30(0x1c0)]),console[_0x360f30(0x1d1)]('═'[_0x360f30(0x25f)](0x3c));if(_0x25a41e['master']&&_0x2e98e1[_0x360f30(0x1b6)]){const _0x2f2d37=a22_0x3a5229[_0x360f30(0x1e0)]('Master:')+'\x20'+a22_0x3a5229['bold'](_0x2e98e1['master'][_0x360f30(0x13f)]+'.'+_0x2e98e1[_0x360f30(0x22b)][_0x360f30(0x166)]);await this['displaySampleData'](_0x2f2d37,_0x2e98e1[_0x360f30(0x1b6)]);}else{if(_0x25a41e[_0x360f30(0x13b)]&&_0x2e98e1[_0x360f30(0x1b6)]){const _0x1b82a0=a22_0x3a5229[_0x360f30(0x1e0)]('Attribute:')+'\x20'+a22_0x3a5229[_0x360f30(0x243)](_0x25a41e['attribute']);await this[_0x360f30(0x12a)](_0x1b82a0,_0x2e98e1[_0x360f30(0x1b6)]);}else{if(_0x25a41e[_0x360f30(0x1c2)]&&_0x2e98e1[_0x360f30(0x1b6)]){const _0x231445=a22_0x3a5229[_0x360f30(0x1e0)](_0x360f30(0x16a))+'\x20'+a22_0x3a5229['bold'](_0x25a41e[_0x360f30(0x1c2)]);await this['displaySampleData'](_0x231445,_0x2e98e1[_0x360f30(0x1b6)]);}else{if(_0x25a41e[_0x360f30(0x1f6)]&&_0x2e98e1['sampleData']){const _0x676a38=a22_0x3a5229[_0x360f30(0x1e0)](_0x360f30(0x18d))+'\x20'+a22_0x3a5229[_0x360f30(0x243)](_0x360f30(0x14b));await this['displaySampleData'](_0x676a38,_0x2e98e1[_0x360f30(0x1b6)]);}else!_0x2e98e1[_0x360f30(0x1b6)]&&console[_0x360f30(0x1d1)](_0x360f30(0x261));}}}if(_0x2e98e1[_0x360f30(0x14a)]['length']>0x0){console['error']('─'['repeat'](0x3c)),console[_0x360f30(0x1d1)]('\x0a'+a22_0x3a5229[_0x360f30(0x147)]('Errors:'));for(const _0x435d9d of _0x2e98e1['errors']){console['error']('\x20\x20'+a22_0x3a5229[_0x360f30(0x147)]('•')+'\x20'+_0x435d9d);}}}async[a22_0x2331ee(0x12a)](_0x509e29,_0x346f7e){const _0x23963e=a22_0x2331ee;if(_0x346f7e[_0x23963e(0x1ab)]===0x0){console['error']('\x0a'+_0x509e29),console[_0x23963e(0x1d1)](_0x23963e(0x1d7));return;}console['error']('\x0a'+_0x509e29);const _0x342172=Object[_0x23963e(0x236)](_0x346f7e[0x0])[_0x23963e(0x21a)](_0x5b7edd=>({'name':_0x5b7edd,'type':typeof _0x346f7e[0x0][_0x5b7edd]==='number'?'double':_0x23963e(0x200)})),_0x31617f={'queryId':_0x23963e(0x1f1),'columns':_0x342172,'data':_0x346f7e,'stats':{'state':_0x23963e(0x202),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x346f7e[_0x23963e(0x1ab)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4eab60=formatAsTable(_0x31617f,_0x346f7e['length'],!![]);await writeOutput(_0x4eab60,undefined,_0x23963e(0x166));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x27d);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x113);async[a22_0x2331ee(0x28b)](_0x278653){const _0x5ef66f=a22_0x2331ee,{options:_0x14b5ba,args:_0x18fffa,tdx:_0x5d9d2a}=_0x278653,_0x46d907=_0x14b5ba,_0x3ba5f6=_0x18fffa[0x0]||_0x14b5ba[_0x5ef66f(0x23f)];if(!_0x3ba5f6)return showParentSegmentNotSetError(_0x5ef66f(0x1b2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x7e610f=resolveYamlFile(_0x3ba5f6);if(existsSync(_0x7e610f)){_0x46d907[_0x5ef66f(0x22f)]&&console[_0x5ef66f(0x1d1)](_0x5ef66f(0x17d)+_0x7e610f);let _0x2097f3;try{_0x2097f3=readFileSync(_0x7e610f,_0x5ef66f(0x165));}catch(_0x22e27b){const _0x5df870=_0x22e27b instanceof Error?_0x22e27b[_0x5ef66f(0x20f)]:String(_0x22e27b);return console[_0x5ef66f(0x1d1)](_0x5ef66f(0x140)+_0x5df870),0x1;}const _0x27246b=await withSpinner(_0x5ef66f(0x11e),()=>_0x5d9d2a['segment']['pushParentYaml'](_0x2097f3),{'verbose':_0x46d907['verbose']}),_0x44a227=_0x27246b[_0x5ef66f(0x19e)],{isNew:_0x26354a,name:_0x46b57c,hasChanges:_0x5c0f75,diffFormatted:_0x59f2c9}=_0x44a227;if(_0x5c0f75){_0x26354a?console[_0x5ef66f(0x1d1)](_0x5ef66f(0x20b)+_0x46b57c+'\x27:'):console[_0x5ef66f(0x1d1)](_0x5ef66f(0x1da)+_0x46b57c+'\x27:');console[_0x5ef66f(0x1d1)]('─'[_0x5ef66f(0x25f)](0x3c)),console['error'](_0x59f2c9),console['error']('─'['repeat'](0x3c));const _0x598a5b=_0x26354a?_0x5ef66f(0x214)+_0x46b57c+_0x5ef66f(0x1d8):_0x5ef66f(0x148)+_0x46b57c+_0x5ef66f(0x1d8);if(!_0x46d907['yes']){if(!isInteractive())return console[_0x5ef66f(0x1d1)](a22_0x3a5229[_0x5ef66f(0x147)](_0x5ef66f(0x125)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x5ef66f(0x1d1)](a22_0x3a5229[_0x5ef66f(0x1e0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x5da420=await confirmKey(_0x598a5b);if(!_0x5da420)return console[_0x5ef66f(0x1d1)](a22_0x3a5229['yellow'](_0x5ef66f(0x21f))),0x1;}const _0x48378e=_0x26354a?_0x5ef66f(0x168):'Updating';await withSpinner(_0x48378e+'\x20parent\x20segment\x20\x27'+_0x46b57c+_0x5ef66f(0x233),()=>_0x44a227[_0x5ef66f(0x298)](),{'verbose':_0x46d907[_0x5ef66f(0x22f)]});const _0x31a559=_0x26354a?'Created':_0x5ef66f(0x216);console[_0x5ef66f(0x1d1)]('✔\x20'+_0x31a559+_0x5ef66f(0x1c6)+_0x46b57c+'\x27');}else console[_0x5ef66f(0x1d1)](_0x5ef66f(0x159)+_0x46b57c+_0x5ef66f(0x1f0));}const _0x204437=await withSpinner(_0x5ef66f(0x169)+_0x3ba5f6+_0x5ef66f(0x233),()=>_0x5d9d2a[_0x5ef66f(0x237)]['runParent'](_0x3ba5f6),{'verbose':_0x46d907[_0x5ef66f(0x22f)]}),_0x51d08d=_0x204437[_0x5ef66f(0x19e)],_0x1c1750=getConsoleUrl(_0x46d907[_0x5ef66f(0x29f)],_0x5ef66f(0x290)+_0x51d08d[_0x5ef66f(0x17c)]+_0x5ef66f(0x208)+_0x51d08d['workflowSessionId']+_0x5ef66f(0x1cb)+_0x51d08d[_0x5ef66f(0x1c3)]);return console['error'](_0x5ef66f(0x114)),console['error']('\x20\x20'+a22_0x3a5229[_0x5ef66f(0x1e0)](_0x5ef66f(0x1c5))+'\x20'+_0x51d08d[_0x5ef66f(0x1a7)]),console['error']('\x20\x20'+a22_0x3a5229[_0x5ef66f(0x1e0)]('Status:')+'\x20'+_0x51d08d['status']),console[_0x5ef66f(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x5ef66f(0x1e0)]('Session:')+'\x20'+_0x51d08d['workflowSessionId']),console['error']('\x20\x20'+a22_0x3a5229[_0x5ef66f(0x1e0)](_0x5ef66f(0x1f4))+'\x20'+_0x51d08d[_0x5ef66f(0x1c3)]),console[_0x5ef66f(0x1d1)]('\x20\x20'+_0x1c1750),console[_0x5ef66f(0x1d1)]('\x0a'+a22_0x3a5229[_0x5ef66f(0x1e0)]('To\x20cancel:')+_0x5ef66f(0x1ae)+_0x51d08d[_0x5ef66f(0x1c3)]+_0x5ef66f(0x1fe)),0x0;}}function a22_0x4694(_0x1c5fbb,_0x52360d){_0x1c5fbb=_0x1c5fbb-0x112;const _0x12f073=a22_0x12f0();let _0x469469=_0x12f073[_0x1c5fbb];return _0x469469;}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x1f2);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x203);async[a22_0x2331ee(0x28b)](_0x17eea0){const _0x17c318=a22_0x2331ee,{options:_0x576648,args:_0x5e5089,tdx:_0x4c3896}=_0x17eea0,_0x2c5a77=_0x5e5089[0x0]||_0x576648[_0x17c318(0x23f)];if(!_0x2c5a77)return showParentSegmentNotSetError(_0x17c318(0x27a)+_0x17c318(0x158)),0x1;_0x576648[_0x17c318(0x22f)]&&(console[_0x17c318(0x1d1)](_0x17c318(0x161)+_0x576648[_0x17c318(0x29f)]),console['error']('Parent\x20segment:\x20'+_0x2c5a77));const _0x47a4ac=await withSpinner(_0x17c318(0x133)+_0x2c5a77+_0x17c318(0x233),()=>_0x4c3896['segment'][_0x17c318(0x25d)](_0x2c5a77),{'verbose':_0x576648[_0x17c318(0x22f)]}),_0x27d6cc=_0x47a4ac[_0x17c318(0x19e)];console[_0x17c318(0x1d1)](_0x17c318(0x25a)+_0x27d6cc[_0x17c318(0x1ab)]+_0x17c318(0x193)+(_0x27d6cc[_0x17c318(0x1ab)]!==0x1?'s':''));if(_0x576648[_0x17c318(0x26f)]||_0x576648['jsonl'])return await handleSDKOutput(_0x27d6cc,_0x576648),0x0;return displayFieldsHumanReadable(_0x27d6cc,_0x2c5a77),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]='segment:parent:view';[a22_0x2331ee(0x24e)]='Show\x20parent\x20segment\x20details';async[a22_0x2331ee(0x28b)](_0x118610){const _0x5cee41=a22_0x2331ee,{options:_0x59f1d7,args:_0x376957,tdx:_0x417ef8}=_0x118610,_0x3f8cbd=_0x59f1d7,_0x51f7e4=_0x376957[0x0]||_0x59f1d7[_0x5cee41(0x23f)];if(!_0x51f7e4)return showParentSegmentNotSetError(_0x5cee41(0x23d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x5cee41(0x1ff)+_0x5cee41(0x293)),0x1;_0x59f1d7[_0x5cee41(0x22f)]&&(console['error']('Site:\x20'+_0x59f1d7[_0x5cee41(0x29f)]),console[_0x5cee41(0x1d1)](_0x5cee41(0x1b5)+_0x51f7e4));const _0x38cfff=await withSpinner(_0x5cee41(0x157)+_0x51f7e4+_0x5cee41(0x233),()=>_0x417ef8[_0x5cee41(0x237)][_0x5cee41(0x271)](_0x51f7e4),{'verbose':_0x59f1d7[_0x5cee41(0x22f)]}),_0x5e16cd=_0x38cfff[_0x5cee41(0x19e)];if(_0x3f8cbd[_0x5cee41(0x199)]){const _0x210d04=getConsoleNextUrl(_0x3f8cbd[_0x5cee41(0x29f)],'/app/dw/parentSegments/'+_0x5e16cd['id']);return console[_0x5cee41(0x1d1)](a22_0x3a5229[_0x5cee41(0x178)]('✔')+_0x5cee41(0x11b)+a22_0x3a5229[_0x5cee41(0x1c1)](_0x210d04)),openBrowser(_0x210d04),0x0;}return await handleSingleObjectOutput(_0x5e16cd,_0x59f1d7),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x1ac);['description']=a22_0x2331ee(0x240);async[a22_0x2331ee(0x28b)](_0x263175){const _0x467982=a22_0x2331ee,{options:_0x4744f5,args:_0x483c0f,tdx:_0x5d65ce}=_0x263175,_0x47ab44=_0x4744f5,_0x800ff5=_0x483c0f[0x0]||_0x4744f5[_0x467982(0x23f)];if(!_0x800ff5)return showParentSegmentNotSetError(_0x467982(0x131)+_0x467982(0x265)+_0x467982(0x1ff)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x4744f5[_0x467982(0x22f)]&&(console[_0x467982(0x1d1)](_0x467982(0x161)+_0x4744f5[_0x467982(0x29f)]),console[_0x467982(0x1d1)](_0x467982(0x1b5)+_0x800ff5));const _0x39e1e0=await withSpinner(_0x467982(0x19b)+_0x800ff5+_0x467982(0x233),()=>_0x5d65ce['segment']['resolveParentId'](_0x800ff5),{'verbose':_0x4744f5['verbose']}),_0x5de3c5=_0x39e1e0[_0x467982(0x19e)],_0x3277b1=_0x5d65ce[_0x467982(0x237)][_0x467982(0x292)](_0x5de3c5);if(_0x47ab44[_0x467982(0x1b3)]){const _0x1558d4=await this['collectSchema'](_0x263175,_0x800ff5,_0x5de3c5,_0x3277b1),_0x602b4b=this[_0x467982(0x20c)](_0x1558d4);writeFileSync(_0x47ab44['output'],_0x602b4b);const _0x3812d6=_0x1558d4[_0x467982(0x270)][_0x467982(0x266)]['length']+_0x1558d4['behaviors'][_0x467982(0x255)]((_0xd1c1ca,_0x5caf04)=>_0xd1c1ca+_0x5caf04[_0x467982(0x266)][_0x467982(0x1ab)],0x0),_0xc15958=_0x1558d4['behaviors'][_0x467982(0x19a)](_0x361ff2=>_0x361ff2['columns']['length']===0x0)['length'];return console['log'](_0x467982(0x129)+_0x47ab44[_0x467982(0x1b3)]),console[_0x467982(0x130)]('\x20\x20Database:\x20'+_0x3277b1),console['log'](_0x467982(0x19d)+_0x1558d4[_0x467982(0x23a)][_0x467982(0x1ab)]+_0x467982(0x138)),console['log'](_0x467982(0x1e5)+_0x3812d6+_0x467982(0x17b)),_0xc15958>0x0&&console[_0x467982(0x130)](_0x467982(0x146)+_0xc15958+_0x467982(0x1ea)),0x0;}console[_0x467982(0x1d1)]('\x0a'+a22_0x3a5229['bold']('Output\x20Database:')+'\x20'+a22_0x3a5229[_0x467982(0x1c1)](_0x3277b1));const _0x5b2bc1=await withSpinner(_0x467982(0x211),()=>_0x5d65ce[_0x467982(0x237)][_0x467982(0x167)](_0x5de3c5),{'verbose':_0x4744f5[_0x467982(0x22f)]});console[_0x467982(0x1d1)]('\x0a'+a22_0x3a5229[_0x467982(0x243)](_0x467982(0x270))+'\x20'+a22_0x3a5229[_0x467982(0x1e0)]('('+_0x3277b1+_0x467982(0x1b0)));const _0x290496=await executeSchemaQuery(_0x5b2bc1[_0x467982(0x19e)],_0x5d65ce,_0x4744f5);await handleQueryOutput(_0x290496,_0x4744f5);const _0x25c4fe=await withSpinner(_0x467982(0x16f),()=>_0x5d65ce[_0x467982(0x237)][_0x467982(0x1d6)](_0x5de3c5),{'verbose':_0x4744f5[_0x467982(0x22f)]});for(const _0x58e60b of _0x25c4fe[_0x467982(0x19e)]){const _0x5c33a9='behavior_'+_0x58e60b[_0x467982(0x20a)]()['replace'](/\s+/g,'_'),_0x343c02=_0x467982(0x1de)+_0x3277b1+'.'+_0x5c33a9;console['error']('\x0a'+a22_0x3a5229[_0x467982(0x243)](_0x58e60b)+'\x20'+a22_0x3a5229[_0x467982(0x1e0)]('('+_0x3277b1+'.'+_0x5c33a9+')'));try{const _0xef2ec=await executeSchemaQuery(_0x343c02,_0x5d65ce,_0x4744f5);await handleQueryOutput(_0xef2ec,_0x4744f5);}catch{console[_0x467982(0x1d1)](a22_0x3a5229[_0x467982(0x239)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async['collectSchema'](_0xaa7fba,_0x2c66c3,_0x308258,_0x2dd17d){const _0x57ed79=a22_0x2331ee,{options:_0x430254,tdx:_0x3dd93c}=_0xaa7fba,_0x5094da=await withSpinner(_0x57ed79(0x211),()=>_0x3dd93c[_0x57ed79(0x237)][_0x57ed79(0x167)](_0x308258),{'verbose':_0x430254[_0x57ed79(0x22f)]}),_0xdd02fb=await executeSchemaQuery(_0x5094da[_0x57ed79(0x19e)],_0x3dd93c,_0x430254),_0x2df2bf=_0xdd02fb['data'][_0x57ed79(0x21a)](_0xd5178d=>({'name':_0xd5178d[_0x57ed79(0x172)],'type':_0xd5178d['column_type']})),_0x414a07=await withSpinner(_0x57ed79(0x16f),()=>_0x3dd93c[_0x57ed79(0x237)][_0x57ed79(0x1d6)](_0x308258),{'verbose':_0x430254[_0x57ed79(0x22f)]}),_0x31d308=[];for(const _0x318561 of _0x414a07[_0x57ed79(0x19e)]){const _0x449610='behavior_'+_0x318561[_0x57ed79(0x20a)]()[_0x57ed79(0x27c)](/\s+/g,'_'),_0x197607=_0x57ed79(0x1de)+_0x2dd17d+'.'+_0x449610;let _0x423d0c=[];try{const _0x23baf9=await executeSchemaQuery(_0x197607,_0x3dd93c,_0x430254);_0x423d0c=_0x23baf9[_0x57ed79(0x19e)][_0x57ed79(0x21a)](_0x289dd0=>({'name':_0x289dd0[_0x57ed79(0x172)],'type':_0x289dd0[_0x57ed79(0x250)]}));}catch{}_0x31d308[_0x57ed79(0x183)]({'table':_0x449610,'columns':_0x423d0c});}return{'database':_0x2dd17d,'parent_segment':_0x2c66c3,'parent_id':_0x308258,'customers':{'table':_0x57ed79(0x270),'columns':_0x2df2bf},'behaviors':_0x31d308};}[a22_0x2331ee(0x20c)](_0x1e6d5d){const _0x5e495c=a22_0x2331ee,_0x37ddf7=_0x36e74a=>{const _0x37df8f=a22_0x4694;if(_0x36e74a[_0x37df8f(0x1ab)]===0x0)return'[]';const _0x1c2345=_0x36e74a[_0x37df8f(0x21a)](_0x5eb987=>_0x37df8f(0x257)+_0x5eb987[_0x37df8f(0x1c0)]+_0x37df8f(0x1bf)+_0x5eb987[_0x37df8f(0x278)]+'\x22\x20}');return'[\x0a'+_0x1c2345[_0x37df8f(0x18a)](',\x0a')+_0x37df8f(0x267);},_0x13590f=_0x1e6d5d[_0x5e495c(0x23a)][_0x5e495c(0x21a)](_0x4841d3=>{const _0xce0079=_0x5e495c;return _0xce0079(0x1f7)+_0x4841d3['table']+_0xce0079(0x21c)+_0x37ddf7(_0x4841d3['columns'])['replace'](/^/gm,'\x20\x20')[_0xce0079(0x142)]()+_0xce0079(0x11c);})[_0x5e495c(0x18a)](',\x0a');return _0x5e495c(0x28d)+_0x1e6d5d[_0x5e495c(0x13f)]+_0x5e495c(0x289)+_0x1e6d5d[_0x5e495c(0x11f)]+_0x5e495c(0x150)+_0x1e6d5d[_0x5e495c(0x219)]+_0x5e495c(0x187)+_0x1e6d5d[_0x5e495c(0x270)][_0x5e495c(0x166)]+_0x5e495c(0x156)+_0x37ddf7(_0x1e6d5d[_0x5e495c(0x270)][_0x5e495c(0x266)])[_0x5e495c(0x27c)](/^/gm,'\x20\x20')[_0x5e495c(0x142)]()+_0x5e495c(0x1b4)+_0x13590f+_0x5e495c(0x1cf);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x254);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x277);async[a22_0x2331ee(0x28b)](_0xb45f48){const _0x1a1e1b=a22_0x2331ee,{options:_0x4a1855,args:_0x10f7e8,tdx:_0x5e8ef6}=_0xb45f48,_0x591d6e=_0x10f7e8[0x0]||_0x4a1855[_0x1a1e1b(0x23f)];if(!_0x591d6e)return showParentSegmentNotSetError(_0x1a1e1b(0x12d)+_0x1a1e1b(0x28e)),0x1;_0x4a1855[_0x1a1e1b(0x22f)]&&(console[_0x1a1e1b(0x1d1)](_0x1a1e1b(0x161)+_0x4a1855[_0x1a1e1b(0x29f)]),console[_0x1a1e1b(0x1d1)]('Parent\x20segment:\x20'+_0x591d6e));const _0x25b33a=await withSpinner(_0x1a1e1b(0x19b)+_0x591d6e+_0x1a1e1b(0x233),()=>_0x5e8ef6[_0x1a1e1b(0x237)]['resolveParentId'](_0x591d6e),{'verbose':_0x4a1855[_0x1a1e1b(0x22f)]}),_0x9f309e=_0x25b33a['data'],_0x4a2b7f=await withSpinner(_0x1a1e1b(0x11a)+_0x591d6e+_0x1a1e1b(0x233),()=>_0x5e8ef6[_0x1a1e1b(0x237)][_0x1a1e1b(0x167)](_0x9f309e),{'verbose':_0x4a1855[_0x1a1e1b(0x22f)]}),_0x4a93c6=_0x4a2b7f['data'];return _0x4a1855[_0x1a1e1b(0x1ad)]===_0x1a1e1b(0x26f)||_0x4a1855[_0x1a1e1b(0x1ad)]===_0x1a1e1b(0x121)?await handleSDKOutput([{'sql':_0x4a93c6}],_0x4a1855):console['log'](_0x4a93c6),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x176);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x238);async['execute'](_0x47e8ef){const _0x38dc3c=a22_0x2331ee,{options:_0x411451,args:_0x3d021f,tdx:_0x5ee677}=_0x47e8ef,_0x5c0680=_0x3d021f[0x0]||_0x411451[_0x38dc3c(0x23f)];if(!_0x5c0680)return showParentSegmentNotSetError(_0x38dc3c(0x228)+_0x38dc3c(0x263)),0x1;_0x411451[_0x38dc3c(0x22f)]&&(console[_0x38dc3c(0x1d1)](_0x38dc3c(0x161)+_0x411451['site']),console['error'](_0x38dc3c(0x1b5)+_0x5c0680));const _0x560649=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c0680+'\x27...',()=>_0x5ee677[_0x38dc3c(0x237)][_0x38dc3c(0x269)](_0x5c0680),{'verbose':_0x411451[_0x38dc3c(0x22f)]}),_0xceaf0b=_0x560649[_0x38dc3c(0x19e)],_0xdd32fd=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5c0680+_0x38dc3c(0x233),()=>_0x5ee677['segment'][_0x38dc3c(0x167)](_0xceaf0b),{'verbose':_0x411451[_0x38dc3c(0x22f)]});let _0x5c1cec=_0xdd32fd[_0x38dc3c(0x19e)];const _0x128e78=resolveLimit(_0x411451[_0x38dc3c(0x149)],DEFAULT_DISPLAY_LIMIT),_0x564b86=/\bLIMIT\s+\d+/i['test'](_0x5c1cec);!_0x564b86&&(_0x5c1cec=_0x5c1cec[_0x38dc3c(0x142)]()[_0x38dc3c(0x27c)](/;+$/,''),_0x5c1cec=_0x38dc3c(0x11d)+_0x5c1cec+_0x38dc3c(0x179)+_0x128e78);_0x411451[_0x38dc3c(0x22f)]&&console[_0x38dc3c(0x1d1)]('SQL\x20query:\x0a'+_0x5c1cec);const _0x5982e3=await withProgressSpinner(_0x38dc3c(0x286),async _0x3c87a2=>{const _0x3ca349=_0x38dc3c,_0x451307=await _0x5ee677[_0x3ca349(0x16e)][_0x3ca349(0x28b)](_0x5c1cec,{'catalog':'td','schema':'information_schema','onJobId':_0x4681d3=>{const _0x20f406=_0x3ca349;_0x3c87a2[_0x20f406(0x143)](_0x4681d3);}});return _0x451307;},{'verbose':_0x411451['verbose']}),_0x42e099=_0x5982e3[_0x38dc3c(0x19e)],_0x5aeb8b=_0x42e099[_0x38dc3c(0x20d)]?_0x38dc3c(0x222)+_0x42e099['jobId']+']':'';return console[_0x38dc3c(0x1d1)](_0x38dc3c(0x15c)+_0x42e099[_0x38dc3c(0x16c)][_0x38dc3c(0x12f)]['toLocaleString']()+_0x38dc3c(0x246)+(_0x38dc3c(0x112)+formatElapsed(_0x42e099[_0x38dc3c(0x16c)][_0x38dc3c(0x1b9)])+_0x5aeb8b)),await handleQueryOutput(_0x42e099,_0x411451),0x0;}}function a22_0x12f0(){const _0x830688=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','✔\x20No\x20changes\x20-\x20\x27','33960brfEmr','open','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Personalization\x20service\x20description','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','addBehaviorsFile','Site:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Rows:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','utf-8','table','getParentSQL','Creating','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Behavior:','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','stats','Errors:','query','Fetching\x20behavior\x20list...','displaySummary','win32','column_name','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','displayPreviewHints','\x20trigger=','segment:parent:show','Available\x20attributes:','green','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','validateParentYaml','\x20total','workflowId','Found\x20YAML\x20file:\x20','Behaviors','column','list','enabled','/{name}.yml\x0a','push','all','Events:','\x20section','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Columns:','interval','join','Attributes:','YAML\x20file:\x20','Enriched:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','trigger_event','run','\x20--behavior\x20\x22','\x20field','createParent','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','single','td_client_id','web','filter','Resolving\x20parent\x20segment\x20\x27','5174257bdZrjN','\x20\x20Tables:\x201\x20customers\x20+\x20','data','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20\x20\x20\x20-\x20','ID\x20Stitching:','parent_segments','scheduleOption','\x20to\x20configure\x20your\x20personalization\x20service','displayValidateResults','updateParent','audienceId','text','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Creating\x20parent\x20segment\x20\x27','length','segment:parent:desc','format','\x20tdx\x20wf\x20attempt\x20','addBehaviors','.customers)','.yml','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','output','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Parent\x20segment:\x20','sampleData','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','sourceTableValid','elapsedTimeMillis','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20is\x20already\x20up\x20to\x20date','Next\x20steps:','\x20--attribute\x20\x22<name>\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x22,\x20\x22type\x22:\x20\x22','name','cyan','behavior','workflowAttemptId','117685KKiXgm','Audience\x20ID:','\x20parent\x20segment\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20Added\x20personalization\x20template\x20to\x20','behaviorsFile','\x20No\x20changes\x20-\x20','/attempt/','previewParentYaml','Personalization:','189Rnsosk','\x0a\x20\x20]\x0a}\x0a','stitchingKeys','error','Options\x20(one\x20required):\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','sourceTableError','customersWithEvents','getBehaviorNames','\x20\x20No\x20sample\x20data\x20available','\x27\x20and\x20run\x20workflow?','Output\x20file:\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','Master\x20Table','Default','128628zGjYbR','SELECT\x20*\x20FROM\x20','string','dim','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20Context\x20set:\x20','match','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20Columns:\x20','realtime','true','Fetching\x20sample\x20data...','events','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Validating\x20configuration...','Error:\x20--behavior\x20requires\x20a\x20name\x0a','3MUlqxC','\x20--behavior\x20\x22<name>\x22','personalizationServices','\x27\x20is\x20up\x20to\x20date','preview','segment:parent:fields','No\x20parent\x20segments\x20found','Attempt:','pushParentYaml','enriched','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','displayBehaviorsStats','schemaError','session','Options:','personalization_services','\x20to\x20push\x20the\x20configuration','\x20kill','Options:\x0a','varchar','⚡\x20Enabled','FINISHED','List\x20available\x20fields\x20for\x20segmentation','foreignKey','customerGroupFile','Error:\x20--database\x20and\x20--table\x20are\x20required','population','/sessions/','\x20\x20\x20\x20','toLowerCase','\x0aNew\x20parent\x20segment\x20\x27','formatSchemaJson','jobId','timezone','message','Error:','Fetching\x20customers\x20schema...','No\x20RT-enabled\x20parent\x20segments\x20found','ignore','Create\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Updated','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','yes','parent_id','map','indexOf','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Join:','isDirectory','Aborted.','ps:pz:list','\x20Configuration\x20is\x20valid','\x20[Job\x20ID:\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','test','ps:pz:init','1448442NRVlBb','displayRealtimeInfo','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','using\x20the\x20default\x20path:\x20','matchedCount','master','displayMasterInfo','Error:\x20File\x20not\x20found:\x20','<database>.<table>','verbose','last_page_viewed','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','\x20\x201.\x20Edit\x20','\x27...','primaryKey','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','keys','segment','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','yellow','behaviors','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','184090bZLGvg','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','✔\x20Renamed\x20directory\x20to\x20','parentSegment','Show\x20parent\x20segment\x20schema\x20(column\x20types)','valid','allValid','bold','\x20parent\x20segment','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20rows\x20','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','ps:rt:validate','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','xdg-open','\x20+\x20[','toFixed','description','/app/dw/parentSegments/','column_type','⚡\x20Not\x20enabled','Created','Validating\x20RT\x20configuration...','segment:parent:sql','reduce','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','totalEvents','Available\x20behaviors:','✔\x20Found\x20','.yaml','displayColumns','listFields','Table:\x20','repeat','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x0aNo\x20sample\x20data\x20available','Validate:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x0aChanges\x20to\x20\x27','\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','columns','\x0a\x20\x20\x20\x20]','12892NMFsFE','resolveParentId','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','start','displayAttributesStats','json','customers','getParentFull','segment:parent:pull','/\x20directory.\x0a','scheduleType','listParents','idStitching','Get\x20SQL\x20query\x20for\x20parent\x20segment','type','realtime_enabled','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Overwrite\x20\x27','replace','segment:parent:run','attributes','endsWith','17NvVcHO','\x20personalization\x20service','stop','12FNSppY','page_view','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Executing\x20parent\x20segment\x20query...','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20RT-enabled\x20parent\x20segment','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','use','execute','\x20service(s)\x20configured','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','addAttributes','/app/workflows/','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','getOutputDatabaseName','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Join\x20on:','✔\x20Created\x20parent\x20segment\x20\x27','label','Error:\x20--attribute\x20requires\x20a\x20name\x0a','apply','Coverage:','Source:','coveragePercent','customerPercent','No\x20personalization\x20services\x20configured','\x20=\x20','site','unref','localeCompare','in\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0a✔\x20Workflow\x20started','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','platform','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20configured','\x20rows)','Fetching\x20SQL\x20for\x20\x27','\x20Opening\x20','\x0a\x20\x20\x20\x20}','SELECT\x20*\x20FROM\x20(\x0a','Analyzing\x20changes...','parent_segment','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','jsonl','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','customerGroup','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x0aError:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','sort','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','Schema\x20saved\x20to\x20','displaySampleData','\x20service','attributesFile','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Customers:','processedRows','log','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','\x20RT\x20configuration\x20is\x20valid','Listing\x20fields\x20for\x20\x27','\x5c$&','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20is\x20already\x20up\x20to\x20date','✔\x20Updated\x20parent\x20segment\x20\x27','\x20behaviors','sections','segment:parent:update','attribute','schemaValid','joinKey','tdx\x20ps\x20preview\x20','database','Error\x20reading\x20file:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','trim','setJobId','segment:parent:list','segment:parent:validate','\x20\x20Note:\x20','red','Apply\x20changes\x20to\x20\x27','limit','errors','Master\x20+\x20Attributes','\x20\x20\x20','\x20Added\x20RT\x202.0\x20template\x20section','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','7jTydZI','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','`\x20to\x20download\x20the\x20configuration\x20first','Preview:','\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','rowCount','Error\x20parsing\x20YAML:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Fetching\x20parent\x20segment\x20\x27'];a22_0x12f0=function(){return _0x830688;};return a22_0x12f0();}export class PSRtListCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]='ps:rt:list';['description']=a22_0x2331ee(0x260);async[a22_0x2331ee(0x28b)](_0x15e59e){const _0x3edb6e=a22_0x2331ee,{options:_0x330fdb,args:_0x522ab1,tdx:_0xbe4364}=_0x15e59e,_0x4cc465=_0x522ab1[0x0],_0x2b7513=await withSpinner(_0x4cc465?_0x3edb6e(0x256)+_0x4cc465+'\x27...':'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0xbe4364[_0x3edb6e(0x1e6)][_0x3edb6e(0x180)](),{'verbose':_0x330fdb[_0x3edb6e(0x22f)]});let _0x1310ff=_0x2b7513[_0x3edb6e(0x19e)]['filter'](_0x2e2e45=>_0x2e2e45[_0x3edb6e(0x279)]);if(_0x4cc465){const _0x3b7304=_0x4cc465['replace'](/[.+^${}()|[\]\\]/g,_0x3edb6e(0x134))[_0x3edb6e(0x27c)](/\*/g,'.*')['replace'](/\?/g,'.'),_0xc759b9=new RegExp('^'+_0x3b7304+'$','i');_0x1310ff=_0x1310ff[_0x3edb6e(0x19a)](_0x5238f1=>_0xc759b9[_0x3edb6e(0x224)](_0x5238f1[_0x3edb6e(0x1c0)]));}_0x1310ff['sort']((_0x5e4038,_0x31eba9)=>_0x5e4038[_0x3edb6e(0x1c0)][_0x3edb6e(0x2a1)](_0x31eba9[_0x3edb6e(0x1c0)])),console[_0x3edb6e(0x1d1)](_0x3edb6e(0x25a)+_0x1310ff[_0x3edb6e(0x1ab)]+_0x3edb6e(0x288)+(_0x1310ff[_0x3edb6e(0x1ab)]!==0x1?'s':''));const _0x34f7ab=_0x239bb9=>{const _0x1a42f4=_0x3edb6e;return getConsoleNextUrl(_0x330fdb['site'],_0x1a42f4(0x24f)+_0x239bb9);};if(_0x330fdb[_0x3edb6e(0x1ad)]===_0x3edb6e(0x26f)||_0x330fdb[_0x3edb6e(0x1ad)]==='jsonl'){const _0x34ab9c=_0x1310ff[_0x3edb6e(0x21a)](_0x473480=>({..._0x473480,'url':_0x34f7ab(_0x473480['id'])}));await handleSDKOutput(_0x34ab9c,_0x330fdb);}else{if(_0x1310ff[_0x3edb6e(0x1ab)]===0x0)console[_0x3edb6e(0x130)](_0x3edb6e(0x212));else for(const _0x5537d4 of _0x1310ff){const _0x28aae5=_0x5537d4[_0x3edb6e(0x207)]?a22_0x3a5229[_0x3edb6e(0x1e0)]('\x20('+formatRows(_0x5537d4[_0x3edb6e(0x207)])+')'):'',_0x504421=hyperlink(_0x5537d4[_0x3edb6e(0x1c0)],_0x34f7ab(_0x5537d4['id']));console[_0x3edb6e(0x130)]('⚡\x20'+_0x504421+_0x28aae5);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x2331ee(0x248);[a22_0x2331ee(0x24e)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a22_0x2331ee(0x28b)](_0x592758){const _0x55db9d=a22_0x2331ee,{options:_0x558401,args:_0x192a16,tdx:_0x15e3a7}=_0x592758,_0x2fc304=_0x192a16[0x0]||_0x558401['parentSegment'];if(!_0x2fc304)return showParentSegmentNotSetError(_0x55db9d(0x23b)+_0x55db9d(0x153)),0x1;const _0x6fd7e9=resolveYamlFile(_0x2fc304);if(!existsSync(_0x6fd7e9))return showFileNotFoundError(_0x6fd7e9,_0x2fc304),0x1;let _0x546dd3;try{_0x546dd3=readFileSync(_0x6fd7e9,_0x55db9d(0x165));}catch(_0x11ea49){const _0x5ca70c=_0x11ea49 instanceof Error?_0x11ea49[_0x55db9d(0x20f)]:String(_0x11ea49);return console[_0x55db9d(0x1d1)](_0x55db9d(0x140)+_0x5ca70c),0x1;}const _0x484388=createCommandSpinner(a22_0x3a5229['dim'](_0x55db9d(0x253)),{'verbose':_0x558401[_0x55db9d(0x22f)]});_0x484388[_0x55db9d(0x26d)]();const _0x1f5b7d={'realtime':!![],'onProgress':_0x9cd2fe=>{const _0x29d490=_0x55db9d;_0x484388[_0x29d490(0x1a8)]=formatProgressMessage(_0x9cd2fe);}};let _0x8fb175;try{_0x8fb175=await _0x15e3a7[_0x55db9d(0x237)]['validateParentYaml'](_0x546dd3,_0x1f5b7d),_0x484388['stop']();}catch(_0x141a20){_0x484388[_0x55db9d(0x282)]();throw _0x141a20;}console['error']('\x0a'+a22_0x3a5229[_0x55db9d(0x243)]('RT\x202.0\x20Validate:')+'\x20'+_0x8fb175[_0x55db9d(0x1c0)]),console[_0x55db9d(0x1d1)]('═'[_0x55db9d(0x25f)](0x3c)),displayRealtimeValidation(_0x8fb175),console[_0x55db9d(0x1d1)]('─'[_0x55db9d(0x25f)](0x3c));if(_0x8fb175[_0x55db9d(0x14a)]['length']>0x0){console[_0x55db9d(0x1d1)]('\x0a'+a22_0x3a5229[_0x55db9d(0x147)]('Errors:'));for(const _0x31b9e4 of _0x8fb175[_0x55db9d(0x14a)]){console[_0x55db9d(0x1d1)]('\x20\x20'+a22_0x3a5229[_0x55db9d(0x147)]('•')+'\x20'+_0x31b9e4);}}return _0x8fb175[_0x55db9d(0x242)]&&console[_0x55db9d(0x1d1)]('\x0a'+a22_0x3a5229[_0x55db9d(0x178)]('✔')+_0x55db9d(0x132)),_0x8fb175[_0x55db9d(0x242)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x220);[a22_0x2331ee(0x24e)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a22_0x2331ee(0x28b)](_0x26be30){const _0x3e2ff4=a22_0x2331ee,{options:_0x363608,args:_0x11b1a9,tdx:_0x4ae4c6}=_0x26be30,_0x3b2bb9=_0x11b1a9[0x0]||_0x363608[_0x3e2ff4(0x23f)];if(!_0x3b2bb9)return showParentSegmentNotSetError(_0x3e2ff4(0x128)+'\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 _0x50e89e=await withSpinner(_0x3e2ff4(0x19b)+_0x3b2bb9+_0x3e2ff4(0x233),()=>_0x4ae4c6[_0x3e2ff4(0x237)][_0x3e2ff4(0x269)](_0x3b2bb9),{'verbose':_0x363608[_0x3e2ff4(0x22f)]}),_0x40844d=_0x50e89e[_0x3e2ff4(0x19e)],_0x14aee2=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3b2bb9+'\x27...',()=>_0x4ae4c6['personalization'][_0x3e2ff4(0x180)](_0x40844d),{'verbose':_0x363608[_0x3e2ff4(0x22f)]}),_0x1838f3=_0x14aee2[_0x3e2ff4(0x19e)];console['error']('✔\x20Found\x20'+_0x1838f3[_0x3e2ff4(0x1ab)]+_0x3e2ff4(0x281)+(_0x1838f3[_0x3e2ff4(0x1ab)]!==0x1?'s':''));if(_0x363608[_0x3e2ff4(0x1ad)]===_0x3e2ff4(0x26f)||_0x363608[_0x3e2ff4(0x1ad)]==='jsonl')await handleSDKOutput(_0x1838f3,_0x363608);else{if(_0x1838f3[_0x3e2ff4(0x1ab)]===0x0)console['log'](_0x3e2ff4(0x29d)),console[_0x3e2ff4(0x1d1)](a22_0x3a5229[_0x3e2ff4(0x1c1)](_0x3e2ff4(0x16b)));else for(const _0xb12c8 of _0x1838f3){const _0x3a85da=_0xb12c8[_0x3e2ff4(0x139)]?.[_0x3e2ff4(0x1ab)]||0x0,_0x4f282d=_0xb12c8[_0x3e2ff4(0x190)]?a22_0x3a5229[_0x3e2ff4(0x1e0)](_0x3e2ff4(0x175)+_0xb12c8[_0x3e2ff4(0x190)]):'',_0x2e1805=a22_0x3a5229[_0x3e2ff4(0x1e0)]('\x20('+_0x3a85da+_0x3e2ff4(0x186)+(_0x3a85da!==0x1?'s':'')+')');console[_0x3e2ff4(0x130)]('\x20\x20'+_0xb12c8[_0x3e2ff4(0x1c0)]+_0x4f282d+_0x2e1805),_0xb12c8['description']&&console[_0x3e2ff4(0x130)](_0x3e2ff4(0x209)+a22_0x3a5229[_0x3e2ff4(0x1e0)](_0xb12c8[_0x3e2ff4(0x24e)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x2331ee(0x1c0)]=a22_0x2331ee(0x225);[a22_0x2331ee(0x24e)]=a22_0x2331ee(0x287);async[a22_0x2331ee(0x28b)](_0x1293ae){const _0x4ea5d2=a22_0x2331ee,{options:_0xf9d6b8,args:_0x4ce694}=_0x1293ae,_0x4e6743=_0x4ce694[0x0]||_0xf9d6b8[_0x4ea5d2(0x23f)];if(!_0x4e6743)return showParentSegmentNotSetError(_0x4ea5d2(0x231)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x5ea2d6=resolveYamlFile(_0x4e6743);if(!existsSync(_0x5ea2d6))return showFileNotFoundError(_0x5ea2d6,_0x4e6743),0x1;let _0x12e281;try{_0x12e281=readFileSync(_0x5ea2d6,_0x4ea5d2(0x165));}catch(_0x20819f){const _0x289d2d=_0x20819f instanceof Error?_0x20819f['message']:String(_0x20819f);return console['error'](_0x4ea5d2(0x140)+_0x289d2d),0x1;}let _0x54ef46;try{_0x54ef46=parseDef(_0x12e281);}catch(_0x1aad6e){const _0x1886da=_0x1aad6e instanceof Error?_0x1aad6e[_0x4ea5d2(0x20f)]:String(_0x1aad6e);return console[_0x4ea5d2(0x1d1)](a22_0x3a5229[_0x4ea5d2(0x147)](_0x4ea5d2(0x155)+_0x1886da)),0x1;}if(_0x54ef46[_0x4ea5d2(0x1fc)]&&_0x54ef46['personalization_services'][_0x4ea5d2(0x1ab)]>0x0)return console[_0x4ea5d2(0x1d1)](a22_0x3a5229[_0x4ea5d2(0x239)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x5ea2d6)),console['error'](a22_0x3a5229[_0x4ea5d2(0x1e0)](_0x4ea5d2(0x14c)+_0x54ef46[_0x4ea5d2(0x1fc)][_0x4ea5d2(0x1ab)]+_0x4ea5d2(0x28c))),0x1;!_0x54ef46[_0x4ea5d2(0x1e6)]&&(_0x54ef46['realtime']={'events':[{'name':_0x4ea5d2(0x284),'source_table':_0x4ea5d2(0x22e)}],'attributes':[{'name':_0x4ea5d2(0x230),'type':_0x4ea5d2(0x197)}],'id_stitching':{'primary_key':_0x54ef46[_0x4ea5d2(0x22b)]['table']===_0x4ea5d2(0x270)?_0x4ea5d2(0x198):'user_id'}});_0x54ef46[_0x4ea5d2(0x1fc)]=[{'name':'My\x20Service','description':_0x4ea5d2(0x15e),'trigger_event':_0x4ea5d2(0x284),'sections':[{'name':_0x4ea5d2(0x1dc),'criteria':_0x4ea5d2(0x1e7),'attributes':[_0x4ea5d2(0x230)]}]}];const _0x1e542e=serializeDef(_0x54ef46);return writeFileSync(_0x5ea2d6,_0x1e542e,_0x4ea5d2(0x165)),console[_0x4ea5d2(0x1d1)](a22_0x3a5229['green']('✔')+_0x4ea5d2(0x1c8)+a22_0x3a5229['cyan'](_0x5ea2d6)),(!_0x54ef46['realtime']||_0x12e281[_0x4ea5d2(0x21b)]('realtime:')===-0x1)&&console[_0x4ea5d2(0x1d1)](a22_0x3a5229['green']('✔')+_0x4ea5d2(0x14d)),console[_0x4ea5d2(0x1d1)]('\x0a'+a22_0x3a5229[_0x4ea5d2(0x1e0)](_0x4ea5d2(0x1bc))),console[_0x4ea5d2(0x1d1)](_0x4ea5d2(0x232)+_0x5ea2d6+_0x4ea5d2(0x1a4)),console['error']('\x20\x202.\x20Run\x20'+a22_0x3a5229['dim']('tdx\x20ps\x20push\x20'+_0x4e6743)+_0x4ea5d2(0x1fd)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x4fcfa9=a23_0x1503;(function(_0x51117c,_0x490f22){const _0x59ccf5=a23_0x1503,_0x15da6f=_0x51117c();while(!![]){try{const _0xe994fd=-parseInt(_0x59ccf5(0x19f))/0x1*(-parseInt(_0x59ccf5(0x1ce))/0x2)+parseInt(_0x59ccf5(0x1f7))/0x3+-parseInt(_0x59ccf5(0x19d))/0x4+parseInt(_0x59ccf5(0x1bf))/0x5*(parseInt(_0x59ccf5(0x207))/0x6)+-parseInt(_0x59ccf5(0x19c))/0x7+parseInt(_0x59ccf5(0x1ee))/0x8+parseInt(_0x59ccf5(0x19e))/0x9;if(_0xe994fd===_0x490f22)break;else _0x15da6f['push'](_0x15da6f['shift']());}catch(_0x3fd3fe){_0x15da6f['push'](_0x15da6f['shift']());}}}(a23_0x1ed2,0x2c640));function a23_0x1ed2(){const _0x4ea88b=['llm_agent','ERROR','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Create\x20a\x20new\x20profile','validate','bold','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','dim','tdx.json','profile','create','error','\x0aAvailable\x20profiles:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Session\x20profile\x20set\x20to:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','getUserInfo','session','API\x20key\x20cannot\x20be\x20empty','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','config','1468016flIrFe','Enter\x20profile\x20name:','Changing\x20site\x20to\x20\x27','Enter\x20site\x20name:','\x20\x20tdx\x20--profile\x20','green','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','profile:remove','Failed\x20to\x20remove\x20profile:\x20','611538yBKRnq','password','Profile\x20\x27','\x0aSaved\x20to:\x20','text','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>','site','length','other','includes','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20created','You\x20can\x20find\x20your\x20API\x20key\x20at:','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','profile:create','75882oczlDY','995330KBiJtW','946224fkVboK','4239CtLLZh','122163TUcCBh','database','default','confirm','Site\x20was\x20not\x20changed.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20saved\x20to\x20system\x20keychain','parent_segment','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','jobs','us01','\x20API\x20key\x20removed\x20from\x20system\x20keychain','test','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','red','\x20--default\x27\x20to\x20save\x20permanently','\x0aOperation\x20cancelled','execute','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','split','apiKey','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','message','Operation\x20cancelled','\x20\x20(no\x20profiles\x20found)','select','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:use','20EfvlLI','Validating\x20API\x20key...','\x20Profile\x20\x27','join','Set\x20session\x20profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','✗\x20Validation\x20failed:\x20','Removal\x20cancelled','Site\x20name\x20cannot\x20be\x20empty','log','Set\x20a\x20profile\x20configuration\x20value','trim','profileName','logLevel','name','2uwoEtD','customSite','\x20\x20-\x20','warn','VALID_KEYS','status','\x0aSetup\x20cancelled','tdx:\x20profile\x20set','(session:\x20','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x27\x20does\x20not\x20exist.'];a23_0x1ed2=function(){return _0x4ea88b;};return a23_0x1ed2();}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 a23_0x21a4fa from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a23_0x1503(_0x19081d,_0x3767ae){_0x19081d=_0x19081d-0x19c;const _0x1ed25c=a23_0x1ed2();let _0x150317=_0x1ed25c[_0x19081d];return _0x150317;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x30ca8d from'prompts';import a23_0x199dd3 from'chalk';function validateProfileName(_0x4ce67e){const _0x129e13=a23_0x1503;if(!_0x4ce67e||!_0x4ce67e['trim']())return _0x129e13(0x1b5);const _0x118ae2=_0x4ce67e[_0x129e13(0x1ca)]();if(!/^[a-zA-Z0-9_-]+$/[_0x129e13(0x1ae)](_0x118ae2))return _0x129e13(0x1e6);if(profileExists(_0x118ae2))return _0x129e13(0x1f9)+_0x118ae2+_0x129e13(0x1db);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x4fcfa9(0x1cd)]=a23_0x4fcfa9(0x206);[a23_0x4fcfa9(0x201)]=a23_0x4fcfa9(0x1dc);async[a23_0x4fcfa9(0x1b3)](_0xc62d8e){const _0x430d68=a23_0x4fcfa9,{options:_0x56ce2a,args:_0x511930}=_0xc62d8e;console[_0x430d68(0x1c8)](a23_0x199dd3[_0x430d68(0x1de)]('tdx:\x20profile\x20create'));let _0x149430;if(_0x511930[_0x430d68(0x1fe)]>0x0&&_0x511930[0x0]){const _0x48ef64=_0x511930[0x0]['trim'](),_0x5533dd=validateProfileName(_0x48ef64);if(_0x5533dd!==!![])return console[_0x430d68(0x1e4)](a23_0x199dd3[_0x430d68(0x1b0)](_0x5533dd)),0x1;_0x149430=_0x48ef64;}else{const _0x5112f9=await a23_0x30ca8d({'type':_0x430d68(0x1fb),'name':_0x430d68(0x1cb),'message':_0x430d68(0x1ef),'validate':validateProfileName});if(!_0x5112f9[_0x430d68(0x1cb)])return console[_0x430d68(0x1c8)](_0x430d68(0x1d4)),0x1;_0x149430=_0x5112f9[_0x430d68(0x1cb)][_0x430d68(0x1ca)]();}const _0x426a03=await a23_0x30ca8d({'type':'text','name':_0x430d68(0x201),'message':'Enter\x20description\x20(optional):'}),_0x38511f=_0x426a03[_0x430d68(0x201)]?.[_0x430d68(0x1ca)]()||undefined,_0x7b197b=_0x56ce2a['site']||_0x430d68(0x1ac),{choices:_0x41404a,initialIndex:_0x18ded5}=buildSiteChoices(_0x7b197b),_0x1261e5=await a23_0x30ca8d({'type':_0x430d68(0x1bc),'name':_0x430d68(0x1fd),'message':_0x430d68(0x1d7)+_0x149430+'\x27:','choices':_0x41404a,'initial':_0x18ded5});if(!_0x1261e5[_0x430d68(0x1fd)])return console[_0x430d68(0x1c8)]('\x0aSetup\x20cancelled'),0x1;let _0x3386c9;if(_0x1261e5[_0x430d68(0x1fd)]===_0x430d68(0x1ff)){const _0x3a73e5=await a23_0x30ca8d({'type':_0x430d68(0x1fb),'name':_0x430d68(0x1cf),'message':_0x430d68(0x1f1),'initial':_0x430d68(0x1ac),'validate':_0x3b5887=>{const _0xfc51dd=_0x430d68;if(!_0x3b5887||!_0x3b5887['trim']())return _0xfc51dd(0x1c7);if(!/^[a-z0-9-]+$/[_0xfc51dd(0x1ae)](_0x3b5887[_0xfc51dd(0x1ca)]()))return _0xfc51dd(0x205);return!![];}});if(!_0x3a73e5['customSite'])return console['log'](_0x430d68(0x1d4)),0x1;_0x3386c9=_0x3a73e5[_0x430d68(0x1cf)];}else _0x3386c9=_0x1261e5[_0x430d68(0x1fd)];const _0x28d3ab=resolveSite(_0x3386c9);console[_0x430d68(0x1c8)](_0x430d68(0x1a8)+_0x28d3ab),console[_0x430d68(0x1c8)](_0x430d68(0x204)),console['log']('\x20\x20'+getConsoleUrl(_0x28d3ab,'/app/mp/ak'));const _0x509c80=await a23_0x30ca8d({'type':_0x430d68(0x1f8),'name':_0x430d68(0x1b7),'message':_0x430d68(0x1a5),'validate':_0x1a7c2f=>{const _0x7c0107=_0x430d68;if(!_0x1a7c2f||!_0x1a7c2f[_0x7c0107(0x1ca)]())return _0x7c0107(0x1eb);return!![];}});if(!_0x509c80['apiKey'])return console[_0x430d68(0x1c8)]('\x0aSetup\x20cancelled'),0x1;const _0x3417be=_0x509c80['apiKey'];console[_0x430d68(0x1c8)](_0x430d68(0x1c0));try{const _0x3f1fec=TDX[_0x430d68(0x1e3)]({'site':_0x28d3ab,'apiKey':_0x3417be[_0x430d68(0x1ca)](),'logLevel':_0x56ce2a[_0x430d68(0x1cc)]??LogLevel[_0x430d68(0x1da)]}),_0x1a957f=await _0x3f1fec[_0x430d68(0x1ab)]['getUserInfo']();console[_0x430d68(0x1c8)](a23_0x199dd3[_0x430d68(0x1f3)]('✓')+_0x430d68(0x1aa)+_0x1a957f['email']+')');const _0x2a1159=await isKeychainAvailable();_0x2a1159?(await saveAPIKeyAsync(_0x3417be[_0x430d68(0x1ca)](),_0x28d3ab,_0x149430),console[_0x430d68(0x1c8)](a23_0x199dd3['green']('✓')+_0x430d68(0x1a9)+_0x149430+')')):(console[_0x430d68(0x1d1)](a23_0x199dd3['yellow'](_0x430d68(0x202))),console['warn'](a23_0x199dd3['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x26f54b={'site':_0x28d3ab,..._0x38511f&&{'description':_0x38511f}};return saveProfileToUserConfig(_0x149430,_0x26f54b),console[_0x430d68(0x1c8)](a23_0x199dd3[_0x430d68(0x1f3)]('✓')+'\x20Profile\x20\x27'+_0x149430+_0x430d68(0x203)),console[_0x430d68(0x1c8)](),console[_0x430d68(0x1c8)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x430d68(0x1c8)](_0x430d68(0x1f2)+_0x149430+_0x430d68(0x1e8)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x149430+_0x430d68(0x1df)),0x0;}catch(_0x237f35){if(_0x237f35 instanceof HTTPClientError&&_0x237f35[_0x430d68(0x1d3)]===0x191)return printAuthError(_0x237f35),0x1;return console['error'](a23_0x199dd3[_0x430d68(0x1b0)]('✗\x20Validation\x20failed:\x20'+(_0x237f35 instanceof Error?_0x237f35['message']:String(_0x237f35)))),console[_0x430d68(0x1e4)](_0x430d68(0x1b8)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x4fcfa9(0x1cd)]=a23_0x4fcfa9(0x1f5);['description']='Remove\x20a\x20profile';['validate'](_0x5a4f66){const _0x76abb7=a23_0x4fcfa9,{args:_0x4a67a4}=_0x5a4f66;if(_0x4a67a4[_0x76abb7(0x1fe)]===0x0)return _0x76abb7(0x1af);return undefined;}async[a23_0x4fcfa9(0x1b3)](_0x793e9c){const _0x19288d=a23_0x4fcfa9,{args:_0x510f7c}=_0x793e9c,_0x49362e=_0x510f7c[0x0];console[_0x19288d(0x1c8)](a23_0x199dd3[_0x19288d(0x1de)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x49362e)){console[_0x19288d(0x1e4)](a23_0x199dd3[_0x19288d(0x1b0)](_0x19288d(0x1f9)+_0x49362e+_0x19288d(0x1d8))),console[_0x19288d(0x1c8)](_0x19288d(0x1e5));const _0x41b0cd=listProfiles();if(_0x41b0cd['length']===0x0)console[_0x19288d(0x1c8)](_0x19288d(0x1bb));else for(const _0x129370 of _0x41b0cd){console[_0x19288d(0x1c8)](_0x19288d(0x1d0)+_0x129370[_0x19288d(0x1cd)]);}return 0x1;}const _0x2bb3e3=await a23_0x30ca8d({'type':_0x19288d(0x1a2),'name':_0x19288d(0x1a2),'message':_0x19288d(0x1b4)+_0x49362e+'\x27?','initial':![]});if(!_0x2bb3e3[_0x19288d(0x1a2)])return console[_0x19288d(0x1c8)](_0x19288d(0x1c6)),0x0;try{removeProfileFromUserConfig(_0x49362e),console[_0x19288d(0x1c8)](a23_0x199dd3[_0x19288d(0x1f3)]('✓')+_0x19288d(0x1c1)+_0x49362e+'\x27\x20removed\x20from\x20configuration');}catch(_0x3d598b){return console[_0x19288d(0x1e4)](a23_0x199dd3[_0x19288d(0x1b0)](_0x19288d(0x1f6)+(_0x3d598b instanceof Error?_0x3d598b[_0x19288d(0x1b9)]:String(_0x3d598b)))),0x1;}const _0x2838ee=await isKeychainAvailable();if(_0x2838ee){const _0x327dd1=await deleteKeychainAPIKey(_0x49362e);_0x327dd1&&console[_0x19288d(0x1c8)](a23_0x199dd3[_0x19288d(0x1f3)]('✓')+_0x19288d(0x1ad));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a23_0x4fcfa9(0x201)]=a23_0x4fcfa9(0x1c9);static [a23_0x4fcfa9(0x1d2)]=['site',a23_0x4fcfa9(0x1a0),a23_0x4fcfa9(0x1a7),'llm_project',a23_0x4fcfa9(0x1d9),'description'];[a23_0x4fcfa9(0x1dd)](_0x1aac1e){const _0x4c5bdf=a23_0x4fcfa9,{args:_0x2f13b9,options:_0x6eef62}=_0x1aac1e,_0x219e6c=_0x6eef62['profile']||getActiveProfile();if(!_0x219e6c)return _0x4c5bdf(0x1fc);if(_0x2f13b9[_0x4c5bdf(0x1fe)]===0x0)return _0x4c5bdf(0x1f4)+ProfileSetCommand[_0x4c5bdf(0x1d2)][_0x4c5bdf(0x1c2)](',\x20');const _0x2f1776=_0x2f13b9[0x0];if(!_0x2f1776[_0x4c5bdf(0x200)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4c5bdf(0x1d2)][_0x4c5bdf(0x1c2)](',\x20');const [_0x2d2f1f]=_0x2f1776[_0x4c5bdf(0x1b6)]('=',0x2);if(!ProfileSetCommand[_0x4c5bdf(0x1d2)][_0x4c5bdf(0x200)](_0x2d2f1f))return'Unknown\x20key\x20\x27'+_0x2d2f1f+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4c5bdf(0x1d2)]['join'](',\x20');return undefined;}async['execute'](_0x29ad95){const _0x3e4dde=a23_0x4fcfa9,{args:_0xc7fe9f,options:_0x10fc57}=_0x29ad95,_0x166d4b=_0x10fc57[_0x3e4dde(0x1e2)]||getActiveProfile(),[_0x1f8156,..._0x4e6044]=_0xc7fe9f[0x0][_0x3e4dde(0x1b6)]('='),_0x1d220d=_0x4e6044[_0x3e4dde(0x1c2)]('=');console[_0x3e4dde(0x1c8)](a23_0x199dd3['bold'](_0x3e4dde(0x1d5)));if(!profileExists(_0x166d4b)){const _0x472391=await a23_0x30ca8d({'type':_0x3e4dde(0x1a2),'name':_0x3e4dde(0x1e3),'message':_0x3e4dde(0x1f9)+_0x166d4b+_0x3e4dde(0x1bd),'initial':!![]});if(!_0x472391[_0x3e4dde(0x1e3)])return console[_0x3e4dde(0x1c8)](_0x3e4dde(0x1ba)),0x1;}const _0xb0284=loadProfile(_0x166d4b),_0x594672=_0xb0284?.[_0x3e4dde(0x1ed)]||{};if(_0x1f8156===_0x3e4dde(0x1fd)){const _0x1e66d4=resolveSite(_0x1d220d);console[_0x3e4dde(0x1c8)](_0x3e4dde(0x1f0)+_0x1e66d4+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3e4dde(0x1c8)](_0x3e4dde(0x1a4)),console[_0x3e4dde(0x1c8)]('\x20\x20'+getConsoleUrl(_0x1e66d4,'/app/mp/ak'));const _0x503914=await a23_0x30ca8d({'type':_0x3e4dde(0x1f8),'name':_0x3e4dde(0x1b7),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1fbee8=>{const _0x543a09=_0x3e4dde;if(!_0x1fbee8||!_0x1fbee8['trim']())return _0x543a09(0x1eb);return!![];}});if(!_0x503914[_0x3e4dde(0x1b7)])return console[_0x3e4dde(0x1c8)](_0x3e4dde(0x1b2)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x29cf2f=TDX[_0x3e4dde(0x1e3)]({'site':_0x1e66d4,'apiKey':_0x503914[_0x3e4dde(0x1b7)][_0x3e4dde(0x1ca)](),'logLevel':_0x10fc57['logLevel']??LogLevel[_0x3e4dde(0x1da)]}),_0x41308d=await _0x29cf2f[_0x3e4dde(0x1ab)][_0x3e4dde(0x1e9)]();console[_0x3e4dde(0x1c8)](a23_0x199dd3['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x41308d['email']+')');const _0x5d7311=await isKeychainAvailable();_0x5d7311?(await saveAPIKeyAsync(_0x503914['apiKey'][_0x3e4dde(0x1ca)](),_0x1e66d4,_0x166d4b),console[_0x3e4dde(0x1c8)](a23_0x199dd3['green']('✓')+_0x3e4dde(0x1a6))):console[_0x3e4dde(0x1d1)](a23_0x199dd3['yellow'](_0x3e4dde(0x202))),_0x594672['site']=_0x1e66d4;}catch(_0x1af8c3){if(_0x1af8c3 instanceof HTTPClientError&&_0x1af8c3[_0x3e4dde(0x1d3)]===0x191)return printAuthError(_0x1af8c3),0x1;return console[_0x3e4dde(0x1e4)](a23_0x199dd3['red'](_0x3e4dde(0x1c5)+(_0x1af8c3 instanceof Error?_0x1af8c3[_0x3e4dde(0x1b9)]:String(_0x1af8c3)))),console[_0x3e4dde(0x1e4)](_0x3e4dde(0x1a3)),0x1;}}else _0x594672[_0x1f8156]=_0x1d220d||undefined;return saveProfileToUserConfig(_0x166d4b,_0x594672),console[_0x3e4dde(0x1c8)](a23_0x199dd3[_0x3e4dde(0x1f3)]('✓')+'\x20Profile\x20\x27'+_0x166d4b+'\x27\x20updated:\x20'+_0x1f8156+'='+(_0x1d220d||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x4fcfa9(0x1cd)]=a23_0x4fcfa9(0x1be);[a23_0x4fcfa9(0x201)]=a23_0x4fcfa9(0x1c3);[a23_0x4fcfa9(0x1dd)](_0x32afd3){const _0x2ee6ac=a23_0x4fcfa9,{args:_0x185ea3}=_0x32afd3;if(_0x185ea3[_0x2ee6ac(0x1fe)]===0x0)return _0x2ee6ac(0x1ec);return undefined;}async[a23_0x4fcfa9(0x1b3)](_0x5a66ef){const _0x95f9dc=a23_0x4fcfa9,{args:_0x36b1f5,options:_0x4f03a8}=_0x5a66ef,_0x3fce37=_0x36b1f5[0x0],_0x1b1c46=_0x4f03a8[_0x95f9dc(0x1a1)];cleanExpiredSessions();if(!profileExists(_0x3fce37)){console[_0x95f9dc(0x1e4)](a23_0x199dd3[_0x95f9dc(0x1b0)](_0x95f9dc(0x1f9)+_0x3fce37+_0x95f9dc(0x1d8))),console[_0x95f9dc(0x1c8)](_0x95f9dc(0x1e5));const _0xa657d9=listProfiles();if(_0xa657d9['length']===0x0)console[_0x95f9dc(0x1c8)](_0x95f9dc(0x1bb));else for(const _0x679b93 of _0xa657d9){console[_0x95f9dc(0x1c8)]('\x20\x20-\x20'+_0x679b93[_0x95f9dc(0x1cd)]);}return 0x1;}if(_0x1b1c46){const _0x3ecc0e=a23_0x21a4fa[_0x95f9dc(0x1c2)](getConfigDir(),_0x95f9dc(0x1e1));return saveActiveProfileToUserConfig(_0x3fce37),console[_0x95f9dc(0x1c8)]('Default\x20profile\x20set\x20to:\x20'+a23_0x199dd3[_0x95f9dc(0x1f3)](_0x3fce37)),console[_0x95f9dc(0x1c8)](a23_0x199dd3[_0x95f9dc(0x1e0)](_0x95f9dc(0x1fa)+_0x3ecc0e)),0x0;}const _0x3b77e3=getSessionID(_0x4f03a8[_0x95f9dc(0x1ea)]);return saveSessionContext({'profile':_0x3fce37},_0x4f03a8[_0x95f9dc(0x1ea)]),console['log'](_0x95f9dc(0x1e7)+a23_0x199dd3[_0x95f9dc(0x1f3)](_0x3fce37)+'\x20'+a23_0x199dd3[_0x95f9dc(0x1e0)](_0x95f9dc(0x1d6)+_0x3b77e3+')')),console[_0x95f9dc(0x1c8)](a23_0x199dd3[_0x95f9dc(0x1e0)](_0x95f9dc(0x1c4)+_0x3fce37+_0x95f9dc(0x1b1))),0x0;}}
|
|
1
|
+
function a23_0x24a6(){const _0xfb51f4=['Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x27\x20created','1WOJQdd','Enter\x20your\x20TD\x20API\x20key:','profileName','\x20--default\x27\x20to\x20save\x20permanently','execute','Set\x20session\x20profile','Enter\x20site\x20name:','8808HXzrTX','message','site','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>','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Site\x20name\x20cannot\x20be\x20empty','\x20\x20tdx\x20--profile\x20','2550222HfgSJa','Default\x20profile\x20set\x20to:\x20','API\x20key\x20cannot\x20be\x20empty','length','\x20API\x20key\x20is\x20valid\x20(User:\x20','(cleared)','Changing\x20site\x20to\x20\x27','✗\x20Validation\x20failed:\x20','1115xHlTAF','\x0aAvailable\x20profiles:','status','llm_project','(session:\x20','\x20Profile\x20\x27','trim','You\x20can\x20find\x20your\x20API\x20key\x20at:','password','session','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Validating\x20API\x20key...','test','description','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','error','red','profile:remove','create','Session\x20profile\x20set\x20to:\x20','includes','yellow','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','9552774feQtGY','Site\x20was\x20not\x20changed.','dim','apiKey','validate','log','tdx:\x20profile\x20create','bold','\x27\x20updated:\x20','5073093lKNOKE','text','\x20\x20-\x20','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','9868vnvFMK','jobs','Enter\x20description\x20(optional):','us01','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','warn','name','\x27.\x0a\x0aValid\x20keys:\x20','790ETPlvZ','\x0aSetup\x20cancelled','customSite','split','Set\x20a\x20profile\x20configuration\x20value','/app/mp/ak','VALID_KEYS','Removal\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','profile:set','7658063WwMMCI','\x20\x20(no\x20profiles\x20found)','config','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','getUserInfo','Unknown\x20key\x20\x27','8766VTkHUS','email','34573fYZvTd','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Remove\x20a\x20profile','Profile\x20name\x20cannot\x20be\x20empty','Operation\x20cancelled','select','Enter\x20profile\x20name:','profile:use','\x27\x20removed\x20from\x20configuration','ERROR','\x27\x20does\x20not\x20exist.','other','llm_agent','confirm','tdx:\x20profile\x20set','tdx:\x20profile\x20remove','database','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','tdx.json','logLevel'];a23_0x24a6=function(){return _0xfb51f4;};return a23_0x24a6();}const a23_0x2b1ff5=a23_0x2e2c;function a23_0x2e2c(_0x9cd877,_0x32f0d8){_0x9cd877=_0x9cd877-0xda;const _0x24a609=a23_0x24a6();let _0x2e2cf7=_0x24a609[_0x9cd877];return _0x2e2cf7;}(function(_0x62b523,_0x1cd8bd){const _0x53edb3=a23_0x2e2c,_0xf34f8c=_0x62b523();while(!![]){try{const _0x5b3848=-parseInt(_0x53edb3(0x111))/0x1*(-parseInt(_0x53edb3(0x11f))/0x2)+-parseInt(_0x53edb3(0xdb))/0x3+-parseInt(_0x53edb3(0xe0))/0x4*(-parseInt(_0x53edb3(0x127))/0x5)+-parseInt(_0x53edb3(0x140))/0x6+parseInt(_0x53edb3(0xf2))/0x7+parseInt(_0x53edb3(0x118))/0x8*(parseInt(_0x53edb3(0xf8))/0x9)+-parseInt(_0x53edb3(0xe8))/0xa*(-parseInt(_0x53edb3(0xfa))/0xb);if(_0x5b3848===_0x1cd8bd)break;else _0xf34f8c['push'](_0xf34f8c['shift']());}catch(_0x1bc012){_0xf34f8c['push'](_0xf34f8c['shift']());}}}(a23_0x24a6,0xe9964));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 a23_0x4b0838 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x499305 from'prompts';import a23_0x54f69b from'chalk';function validateProfileName(_0x462c54){const _0x22eb9c=a23_0x2e2c;if(!_0x462c54||!_0x462c54[_0x22eb9c(0x12d)]())return _0x22eb9c(0xfd);const _0x443f4a=_0x462c54[_0x22eb9c(0x12d)]();if(!/^[a-zA-Z0-9_-]+$/[_0x22eb9c(0x133)](_0x443f4a))return _0x22eb9c(0xfb);if(profileExists(_0x443f4a))return'Profile\x20\x27'+_0x443f4a+_0x22eb9c(0xe4);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a23_0x2b1ff5(0x134)]='Create\x20a\x20new\x20profile';async[a23_0x2b1ff5(0x115)](_0x4febbc){const _0x4b42a0=a23_0x2b1ff5,{options:_0x3c17c4,args:_0x42d8f1}=_0x4febbc;console[_0x4b42a0(0x145)](a23_0x54f69b[_0x4b42a0(0x147)](_0x4b42a0(0x146)));let _0x5ae37d;if(_0x42d8f1['length']>0x0&&_0x42d8f1[0x0]){const _0x4836d3=_0x42d8f1[0x0]['trim'](),_0x56de33=validateProfileName(_0x4836d3);if(_0x56de33!==!![])return console[_0x4b42a0(0x137)](a23_0x54f69b['red'](_0x56de33)),0x1;_0x5ae37d=_0x4836d3;}else{const _0x17ea3f=await a23_0x499305({'type':_0x4b42a0(0xdc),'name':_0x4b42a0(0x113),'message':_0x4b42a0(0x100),'validate':validateProfileName});if(!_0x17ea3f['profileName'])return console[_0x4b42a0(0x145)]('\x0aSetup\x20cancelled'),0x1;_0x5ae37d=_0x17ea3f[_0x4b42a0(0x113)][_0x4b42a0(0x12d)]();}const _0x45e333=await a23_0x499305({'type':_0x4b42a0(0xdc),'name':_0x4b42a0(0x134),'message':_0x4b42a0(0xe2)}),_0x5b2113=_0x45e333[_0x4b42a0(0x134)]?.[_0x4b42a0(0x12d)]()||undefined,_0x213fd4=_0x3c17c4['site']||_0x4b42a0(0xe3),{choices:_0x4f60f9,initialIndex:_0x1ec618}=buildSiteChoices(_0x213fd4),_0x45c165=await a23_0x499305({'type':_0x4b42a0(0xff),'name':_0x4b42a0(0x11a),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x5ae37d+'\x27:','choices':_0x4f60f9,'initial':_0x1ec618});if(!_0x45c165[_0x4b42a0(0x11a)])return console['log'](_0x4b42a0(0xe9)),0x1;let _0x1b0bf0;if(_0x45c165[_0x4b42a0(0x11a)]===_0x4b42a0(0x105)){const _0x3123e5=await a23_0x499305({'type':_0x4b42a0(0xdc),'name':'customSite','message':_0x4b42a0(0x117),'initial':_0x4b42a0(0xe3),'validate':_0x5d6717=>{const _0x4376e9=_0x4b42a0;if(!_0x5d6717||!_0x5d6717[_0x4376e9(0x12d)]())return _0x4376e9(0x11d);if(!/^[a-z0-9-]+$/[_0x4376e9(0x133)](_0x5d6717[_0x4376e9(0x12d)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x3123e5[_0x4b42a0(0xea)])return console['log'](_0x4b42a0(0xe9)),0x1;_0x1b0bf0=_0x3123e5[_0x4b42a0(0xea)];}else _0x1b0bf0=_0x45c165[_0x4b42a0(0x11a)];const _0x33aaee=resolveSite(_0x1b0bf0);console[_0x4b42a0(0x145)](_0x4b42a0(0xf5)+_0x33aaee),console[_0x4b42a0(0x145)](_0x4b42a0(0x12e)),console[_0x4b42a0(0x145)]('\x20\x20'+getConsoleUrl(_0x33aaee,_0x4b42a0(0xed)));const _0x5c9c67=await a23_0x499305({'type':_0x4b42a0(0x12f),'name':_0x4b42a0(0x143),'message':_0x4b42a0(0x112),'validate':_0x7bdcf=>{const _0x10ae2d=_0x4b42a0;if(!_0x7bdcf||!_0x7bdcf[_0x10ae2d(0x12d)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5c9c67[_0x4b42a0(0x143)])return console[_0x4b42a0(0x145)](_0x4b42a0(0xe9)),0x1;const _0xfd5b44=_0x5c9c67[_0x4b42a0(0x143)];console[_0x4b42a0(0x145)]('Validating\x20API\x20key...');try{const _0x290130=TDX['create']({'site':_0x33aaee,'apiKey':_0xfd5b44[_0x4b42a0(0x12d)](),'logLevel':_0x3c17c4[_0x4b42a0(0x10d)]??LogLevel[_0x4b42a0(0x103)]}),_0x4e11b1=await _0x290130[_0x4b42a0(0xe1)][_0x4b42a0(0xf6)]();console[_0x4b42a0(0x145)](a23_0x54f69b[_0x4b42a0(0x13f)]('✓')+_0x4b42a0(0x123)+_0x4e11b1[_0x4b42a0(0xf9)]+')');const _0x3220b2=await isKeychainAvailable();_0x3220b2?(await saveAPIKeyAsync(_0xfd5b44[_0x4b42a0(0x12d)](),_0x33aaee,_0x5ae37d),console[_0x4b42a0(0x145)](a23_0x54f69b[_0x4b42a0(0x13f)]('✓')+_0x4b42a0(0x13e)+_0x5ae37d+')')):(console['warn'](a23_0x54f69b['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4b42a0(0xe5)](a23_0x54f69b[_0x4b42a0(0x13d)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x41c7f5={'site':_0x33aaee,..._0x5b2113&&{'description':_0x5b2113}};return saveProfileToUserConfig(_0x5ae37d,_0x41c7f5),console[_0x4b42a0(0x145)](a23_0x54f69b[_0x4b42a0(0x13f)]('✓')+'\x20Profile\x20\x27'+_0x5ae37d+_0x4b42a0(0x110)),console[_0x4b42a0(0x145)](),console['log'](_0x4b42a0(0x136)),console[_0x4b42a0(0x145)](_0x4b42a0(0x11e)+_0x5ae37d+_0x4b42a0(0x10b)),console[_0x4b42a0(0x145)]('\x20\x20tdx\x20--profile\x20'+_0x5ae37d+_0x4b42a0(0x135)),0x0;}catch(_0x1f761c){if(_0x1f761c instanceof HTTPClientError&&_0x1f761c['status']===0x191)return printAuthError(_0x1f761c),0x1;return console[_0x4b42a0(0x137)](a23_0x54f69b[_0x4b42a0(0x138)](_0x4b42a0(0x126)+(_0x1f761c instanceof Error?_0x1f761c[_0x4b42a0(0x119)]:String(_0x1f761c)))),console[_0x4b42a0(0x137)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x2b1ff5(0x139);[a23_0x2b1ff5(0x134)]=a23_0x2b1ff5(0xfc);['validate'](_0x3706af){const _0x43c2a2=a23_0x2b1ff5,{args:_0x1b505e}=_0x3706af;if(_0x1b505e[_0x43c2a2(0x122)]===0x0)return _0x43c2a2(0x10f);return undefined;}async[a23_0x2b1ff5(0x115)](_0x55394f){const _0x3a0b1c=a23_0x2b1ff5,{args:_0x650248}=_0x55394f,_0x4be602=_0x650248[0x0];console[_0x3a0b1c(0x145)](a23_0x54f69b[_0x3a0b1c(0x147)](_0x3a0b1c(0x109)));if(!profileExists(_0x4be602)){console[_0x3a0b1c(0x137)](a23_0x54f69b['red'](_0x3a0b1c(0x10e)+_0x4be602+_0x3a0b1c(0x104))),console[_0x3a0b1c(0x145)](_0x3a0b1c(0x128));const _0x9cee06=listProfiles();if(_0x9cee06['length']===0x0)console['log'](_0x3a0b1c(0xf3));else for(const _0x3f4dfe of _0x9cee06){console['log'](_0x3a0b1c(0xdd)+_0x3f4dfe['name']);}return 0x1;}const _0xed2967=await a23_0x499305({'type':'confirm','name':_0x3a0b1c(0x107),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4be602+'\x27?','initial':![]});if(!_0xed2967['confirm'])return console[_0x3a0b1c(0x145)](_0x3a0b1c(0xef)),0x0;try{removeProfileFromUserConfig(_0x4be602),console['log'](a23_0x54f69b[_0x3a0b1c(0x13f)]('✓')+'\x20Profile\x20\x27'+_0x4be602+_0x3a0b1c(0x102));}catch(_0x2a0af7){return console[_0x3a0b1c(0x137)](a23_0x54f69b[_0x3a0b1c(0x138)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x2a0af7 instanceof Error?_0x2a0af7[_0x3a0b1c(0x119)]:String(_0x2a0af7)))),0x1;}const _0x5979c8=await isKeychainAvailable();if(_0x5979c8){const _0x3f3bb8=await deleteKeychainAPIKey(_0x4be602);_0x3f3bb8&&console[_0x3a0b1c(0x145)](a23_0x54f69b[_0x3a0b1c(0x13f)]('✓')+_0x3a0b1c(0x131));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x2b1ff5(0xe6)]=a23_0x2b1ff5(0xf1);['description']=a23_0x2b1ff5(0xec);static [a23_0x2b1ff5(0xee)]=[a23_0x2b1ff5(0x11a),a23_0x2b1ff5(0x10a),'parent_segment',a23_0x2b1ff5(0x12a),a23_0x2b1ff5(0x106),a23_0x2b1ff5(0x134)];['validate'](_0x4d5e14){const _0xd7f04d=a23_0x2b1ff5,{args:_0x22053f,options:_0x51f5c5}=_0x4d5e14,_0x1fa0a7=_0x51f5c5['profile']||getActiveProfile();if(!_0x1fa0a7)return _0xd7f04d(0x11b);if(_0x22053f[_0xd7f04d(0x122)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0xd7f04d(0xde)](',\x20');const _0x309760=_0x22053f[0x0];if(!_0x309760[_0xd7f04d(0x13c)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xd7f04d(0xee)][_0xd7f04d(0xde)](',\x20');const [_0x206ec4]=_0x309760[_0xd7f04d(0xeb)]('=',0x2);if(!ProfileSetCommand[_0xd7f04d(0xee)][_0xd7f04d(0x13c)](_0x206ec4))return _0xd7f04d(0xf7)+_0x206ec4+_0xd7f04d(0xe7)+ProfileSetCommand['VALID_KEYS'][_0xd7f04d(0xde)](',\x20');return undefined;}async[a23_0x2b1ff5(0x115)](_0x5bad60){const _0x4cc7a1=a23_0x2b1ff5,{args:_0x1a084d,options:_0x29aa47}=_0x5bad60,_0x325f1b=_0x29aa47['profile']||getActiveProfile(),[_0xc91dcb,..._0x4f2899]=_0x1a084d[0x0][_0x4cc7a1(0xeb)]('='),_0x40be=_0x4f2899[_0x4cc7a1(0xde)]('=');console[_0x4cc7a1(0x145)](a23_0x54f69b[_0x4cc7a1(0x147)](_0x4cc7a1(0x108)));if(!profileExists(_0x325f1b)){const _0x294d70=await a23_0x499305({'type':_0x4cc7a1(0x107),'name':'create','message':'Profile\x20\x27'+_0x325f1b+_0x4cc7a1(0xdf),'initial':!![]});if(!_0x294d70[_0x4cc7a1(0x13a)])return console[_0x4cc7a1(0x145)](_0x4cc7a1(0xfe)),0x1;}const _0x444027=loadProfile(_0x325f1b),_0x1c3e42=_0x444027?.[_0x4cc7a1(0xf4)]||{};if(_0xc91dcb===_0x4cc7a1(0x11a)){const _0x22c222=resolveSite(_0x40be);console[_0x4cc7a1(0x145)](_0x4cc7a1(0x125)+_0x22c222+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x4cc7a1(0x145)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4cc7a1(0x145)]('\x20\x20'+getConsoleUrl(_0x22c222,'/app/mp/ak'));const _0x19ff46=await a23_0x499305({'type':_0x4cc7a1(0x12f),'name':_0x4cc7a1(0x143),'message':_0x4cc7a1(0x11c),'validate':_0x3bdc4b=>{const _0x1d3d9f=_0x4cc7a1;if(!_0x3bdc4b||!_0x3bdc4b[_0x1d3d9f(0x12d)]())return _0x1d3d9f(0x121);return!![];}});if(!_0x19ff46['apiKey'])return console[_0x4cc7a1(0x145)]('\x0aOperation\x20cancelled'),0x1;console[_0x4cc7a1(0x145)](_0x4cc7a1(0x132));try{const _0x3207e0=TDX[_0x4cc7a1(0x13a)]({'site':_0x22c222,'apiKey':_0x19ff46[_0x4cc7a1(0x143)][_0x4cc7a1(0x12d)](),'logLevel':_0x29aa47[_0x4cc7a1(0x10d)]??LogLevel[_0x4cc7a1(0x103)]}),_0x1a28f5=await _0x3207e0['jobs']['getUserInfo']();console['log'](a23_0x54f69b['green']('✓')+_0x4cc7a1(0x123)+_0x1a28f5[_0x4cc7a1(0xf9)]+')');const _0x2d4dcd=await isKeychainAvailable();_0x2d4dcd?(await saveAPIKeyAsync(_0x19ff46[_0x4cc7a1(0x143)]['trim'](),_0x22c222,_0x325f1b),console[_0x4cc7a1(0x145)](a23_0x54f69b['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x4cc7a1(0xe5)](a23_0x54f69b[_0x4cc7a1(0x13d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x1c3e42['site']=_0x22c222;}catch(_0x18a6fd){if(_0x18a6fd instanceof HTTPClientError&&_0x18a6fd[_0x4cc7a1(0x129)]===0x191)return printAuthError(_0x18a6fd),0x1;return console[_0x4cc7a1(0x137)](a23_0x54f69b[_0x4cc7a1(0x138)](_0x4cc7a1(0x126)+(_0x18a6fd instanceof Error?_0x18a6fd[_0x4cc7a1(0x119)]:String(_0x18a6fd)))),console['error'](_0x4cc7a1(0x141)),0x1;}}else _0x1c3e42[_0xc91dcb]=_0x40be||undefined;return saveProfileToUserConfig(_0x325f1b,_0x1c3e42),console['log'](a23_0x54f69b['green']('✓')+_0x4cc7a1(0x12c)+_0x325f1b+_0x4cc7a1(0xda)+_0xc91dcb+'='+(_0x40be||_0x4cc7a1(0x124))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x2b1ff5(0xe6)]=a23_0x2b1ff5(0x101);[a23_0x2b1ff5(0x134)]=a23_0x2b1ff5(0x116);[a23_0x2b1ff5(0x144)](_0x58da3e){const _0x5796ab=a23_0x2b1ff5,{args:_0x3781ae}=_0x58da3e;if(_0x3781ae[_0x5796ab(0x122)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x33bd8e){const _0x113590=a23_0x2b1ff5,{args:_0xc394e9,options:_0x4da2cc}=_0x33bd8e,_0x3a62a4=_0xc394e9[0x0],_0x35fb9b=_0x4da2cc['default'];cleanExpiredSessions();if(!profileExists(_0x3a62a4)){console['error'](a23_0x54f69b[_0x113590(0x138)]('Profile\x20\x27'+_0x3a62a4+_0x113590(0x104))),console[_0x113590(0x145)](_0x113590(0x128));const _0x5536d0=listProfiles();if(_0x5536d0['length']===0x0)console[_0x113590(0x145)](_0x113590(0xf3));else for(const _0x178d4a of _0x5536d0){console[_0x113590(0x145)](_0x113590(0xdd)+_0x178d4a[_0x113590(0xe6)]);}return 0x1;}if(_0x35fb9b){const _0x4988e5=a23_0x4b0838[_0x113590(0xde)](getConfigDir(),_0x113590(0x10c));return saveActiveProfileToUserConfig(_0x3a62a4),console[_0x113590(0x145)](_0x113590(0x120)+a23_0x54f69b[_0x113590(0x13f)](_0x3a62a4)),console[_0x113590(0x145)](a23_0x54f69b[_0x113590(0x142)]('\x0aSaved\x20to:\x20'+_0x4988e5)),0x0;}const _0x1a8984=getSessionID(_0x4da2cc[_0x113590(0x130)]);return saveSessionContext({'profile':_0x3a62a4},_0x4da2cc[_0x113590(0x130)]),console[_0x113590(0x145)](_0x113590(0x13b)+a23_0x54f69b['green'](_0x3a62a4)+'\x20'+a23_0x54f69b[_0x113590(0x142)](_0x113590(0x12b)+_0x1a8984+')')),console[_0x113590(0x145)](a23_0x54f69b[_0x113590(0x142)](_0x113590(0xf0)+_0x3a62a4+_0x113590(0x114))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x491886=a24_0x2b97;(function(_0x21a6c1,_0x470fcf){const _0x2ec6df=a24_0x2b97,_0x4bf7aa=_0x21a6c1();while(!![]){try{const _0x168c61=parseInt(_0x2ec6df(0x1c5))/0x1+parseInt(_0x2ec6df(0x1be))/0x2+parseInt(_0x2ec6df(0x1d0))/0x3+parseInt(_0x2ec6df(0x1cc))/0x4+-parseInt(_0x2ec6df(0x1c6))/0x5+-parseInt(_0x2ec6df(0x1bd))/0x6*(parseInt(_0x2ec6df(0x1c3))/0x7)+parseInt(_0x2ec6df(0x1ca))/0x8;if(_0x168c61===_0x470fcf)break;else _0x4bf7aa['push'](_0x4bf7aa['shift']());}catch(_0x2043f2){_0x4bf7aa['push'](_0x4bf7aa['shift']());}}}(a24_0x367b,0xc8a88));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x491886(0x1c1)]=a24_0x491886(0x1bf);['description']=a24_0x491886(0x1cb);async['execute'](_0x296822){const _0x1c5a50=a24_0x491886,{options:_0x31a5a4}=_0x296822;try{const _0x209c2a=listProfiles(),_0x5544eb=getActiveProfile();if(_0x209c2a[_0x1c5a50(0x1c0)]===0x0)return console[_0x1c5a50(0x1c9)](_0x1c5a50(0x1c7)),console[_0x1c5a50(0x1c9)](_0x1c5a50(0x1cd)),console['log'](_0x1c5a50(0x1cf)),0x0;const _0x4b6bc0=_0x209c2a[_0x1c5a50(0x1d1)](_0x126ed4=>{const _0x50fd31=_0x1c5a50,_0x718d73=_0x126ed4[_0x50fd31(0x1c1)]===_0x5544eb,_0x3f1e65=getProfileParams(_0x126ed4['config']);return{'name':_0x126ed4[_0x50fd31(0x1c1)],'active':_0x718d73,'scope':_0x126ed4[_0x50fd31(0x1ce)],'description':_0x126ed4[_0x50fd31(0x1c4)]['description']||'','params':_0x3f1e65};});return await handleSDKOutput(_0x4b6bc0,_0x31a5a4),0x0;}catch(_0x3a2103){return _0x3a2103 instanceof Error&&console[_0x1c5a50(0x1c8)](_0x1c5a50(0x1c2)+_0x3a2103['message']),0x1;}}}function a24_0x2b97(_0x4128c0,_0x3d844a){_0x4128c0=_0x4128c0-0x1bd;const _0x367b44=a24_0x367b();let _0x2b973=_0x367b44[_0x4128c0];return _0x2b973;}function a24_0x367b(){const _0x39db6a=['log','1481008nqiROH','List\x20all\x20available\x20profiles','4450332hIinPo','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','scope','\x20\x20Global:\x20~/.config/tdx/tdx.json','3685425wxgywl','map','8958342DjvEeG','741058HwwcaA','profiles','length','name','Error:\x20','7gQjpsL','config','747492ZelHqF','6646260uzPAWD','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','error'];a24_0x367b=function(){return _0x39db6a;};return a24_0x367b();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x28b306=a25_0x2e29;(function(_0x30765b,_0x275b20){const _0x2568e0=a25_0x2e29,_0x6cabff=_0x30765b();while(!![]){try{const _0x4eb9fc=parseInt(_0x2568e0(0xde))/0x1*(-parseInt(_0x2568e0(0xf4))/0x2)+parseInt(_0x2568e0(0xe0))/0x3+-parseInt(_0x2568e0(0xfb))/0x4+parseInt(_0x2568e0(0x103))/0x5*(-parseInt(_0x2568e0(0xf0))/0x6)+-parseInt(_0x2568e0(0xef))/0x7*(parseInt(_0x2568e0(0xd9))/0x8)+-parseInt(_0x2568e0(0xff))/0x9+parseInt(_0x2568e0(0xfe))/0xa*(parseInt(_0x2568e0(0xdb))/0xb);if(_0x4eb9fc===_0x275b20)break;else _0x6cabff['push'](_0x6cabff['shift']());}catch(_0x1d215d){_0x6cabff['push'](_0x6cabff['shift']());}}}(a25_0x4c7a,0x6374c));import{BaseCommand}from'./command.js';function a25_0x2e29(_0x47b140,_0x71047e){_0x47b140=_0x47b140-0xd2;const _0x4c7a2c=a25_0x4c7a();let _0x2e29d3=_0x4c7a2c[_0x47b140];return _0x2e29d3;}import{SDKError}from'../sdk/index.js';function a25_0x4c7a(){const _0x328a29=['Catalog:\x20','totalSplits','Executing\x20query...','state','completedSplits','output','setJobId','2647386ZEGGgl','225306kBfxhW','Executing\x20query\x20[','Site:\x20','name','15214OuphfO','site','error','originalMessage','length','push','\x20-\x20','1432020ZJHWbm','Statement\x20','jobId','2685950ArWUMu','7179714FEvgeH','SQL:\x20','No\x20SQL\x20provided','\x20splits','40fuXwrG','message','execute','processedRows','elapsedTimeMillis','in\x20','stats','verbose','setPhase','Query\x20completed:\x20Processed\x20','8Pbjkfy','setExtra','77jgRztD','options','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','23ezjLdO','\x20rows\x20','1609575VVbAml','description','file','...','join','data','query','database'];a25_0x4c7a=function(){return _0x328a29;};return a25_0x4c7a();}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{[a25_0x28b306(0xf3)]='query';[a25_0x28b306(0xe1)]='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x28b306(0x105)](_0x59bc29){const _0x3198b3=a25_0x28b306,{options:_0x5bd438,args:_0x26fb10,tdx:_0x31f587}=_0x59bc29,_0x23bf0a=_0x26fb10[0x0],_0x51b817=_0x5bd438[_0x3198b3(0xe2)];let _0x304f04;try{if(_0x51b817)_0x304f04=readSqlStatementsFromFile(_0x51b817);else{if(_0x23bf0a==='-')_0x304f04=await readSqlStatementsFromStdin();else{if(_0x23bf0a&&isSqlFilePath(_0x23bf0a))_0x304f04=readSqlStatementsFromFile(_0x23bf0a);else{if(_0x23bf0a)_0x304f04=splitSqlStatements(_0x23bf0a);else throw new Error(_0x3198b3(0x101));}}}}catch(_0x362db2){return console[_0x3198b3(0xf6)]('Error:\x20'+_0x362db2[_0x3198b3(0x104)]),0x1;}const _0x20ea45=_0x5bd438[_0x3198b3(0xe7)]||'information_schema',_0xb934a4=_0x5bd438['catalog'];try{const _0x13c86b=[],_0x217da6=!!_0x5bd438['output'];for(let _0x4d3f98=0x0;_0x4d3f98<_0x304f04[_0x3198b3(0xf8)];_0x4d3f98++){const _0x2d802c=_0x304f04[_0x4d3f98],_0x14a3ab=_0x4d3f98+0x1,_0x1db079=_0x304f04['length'],_0x15ee07=_0x1db079>0x1;_0x5bd438['verbose']&&(console['error']('\x0a'+(_0x15ee07?_0x3198b3(0xfc)+_0x14a3ab+'/'+_0x1db079+':':'')),console[_0x3198b3(0xf6)](_0x3198b3(0xf2)+_0x5bd438[_0x3198b3(0xf5)]),console[_0x3198b3(0xf6)](_0x3198b3(0xe8)+(_0xb934a4||'td')),console['error']('Schema:\x20'+_0x20ea45),console[_0x3198b3(0xf6)](_0x3198b3(0x100)+_0x2d802c));const _0x119393=_0x15ee07?'Executing\x20statement\x20'+_0x14a3ab+'/'+_0x1db079+_0x3198b3(0xe3):_0x3198b3(0xea);try{const _0x4b3643=await withProgressSpinner(_0x119393,async _0x26f308=>{const _0x3ad95d=_0x3198b3,_0x5f0b54=await _0x31f587[_0x3ad95d(0xe6)][_0x3ad95d(0x105)](_0x2d802c,{'catalog':_0xb934a4,'schema':_0x20ea45,'onJobId':_0xbc760b=>{const _0x37d376=_0x3ad95d;_0x26f308[_0x37d376(0xee)](_0xbc760b);},'onProgress':_0x12dbc3=>{const _0x52ca38=_0x3ad95d;_0x26f308[_0x52ca38(0xd7)](_0x52ca38(0xf1)+_0x12dbc3[_0x52ca38(0xeb)]+']'),_0x26f308[_0x52ca38(0xda)](formatRows(_0x12dbc3[_0x52ca38(0xd2)])+'\x20rows\x20'+_0x12dbc3[_0x52ca38(0xec)]+'/'+_0x12dbc3[_0x52ca38(0xe9)]+_0x52ca38(0x102));}});return _0x5f0b54;},{'verbose':_0x5bd438[_0x3198b3(0xd6)]}),_0x10e330=_0x4b3643[_0x3198b3(0xe5)],_0x3b69ea=_0x10e330['jobId']?'\x20[Job\x20ID:\x20'+_0x10e330[_0x3198b3(0xfd)]+']':'',_0x5ce8e4=_0x15ee07?_0x3198b3(0xfc)+_0x14a3ab+'/'+_0x1db079+_0x3198b3(0xfa):'';console[_0x3198b3(0xf6)]('✔\x20'+_0x5ce8e4+_0x3198b3(0xd8)+formatRows(_0x10e330[_0x3198b3(0xd5)][_0x3198b3(0xd2)])+_0x3198b3(0xdf)+(_0x3198b3(0xd4)+formatElapsed(_0x10e330[_0x3198b3(0xd5)][_0x3198b3(0xd3)])+_0x3b69ea));if(_0x15ee07&&_0x217da6){const _0x387301=resolveOutputOptions(_0x5bd438),_0x1f3eb1=await formatQueryOutput(_0x10e330,_0x387301);_0x13c86b[_0x3198b3(0xf9)](_0x1f3eb1);}else await handleQueryOutput(_0x10e330,_0x5bd438);}catch(_0x10ffd9){const _0x39745d=_0x15ee07?_0x3198b3(0xfc)+_0x14a3ab+'/'+_0x1db079+':\x0a':'',_0x2bfb4d=_0x10ffd9 instanceof SDKError?_0x10ffd9[_0x3198b3(0xf7)]:_0x10ffd9['message'];return console['error'](''+_0x39745d+_0x2bfb4d),0x1;}}if(_0x304f04[_0x3198b3(0xf8)]>0x1&&_0x217da6&&_0x13c86b['length']>0x0){const _0x5b1eef=_0x13c86b[_0x3198b3(0xe4)]('\x0a');writeFileSync(_0x5bd438['output'],_0x5b1eef),console[_0x3198b3(0xf6)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x5bd438[_0x3198b3(0xed)]);}return 0x0;}catch(_0x473b10){throw _0x473b10;}}['validate'](_0x5ba5f7){const _0x257953=a25_0x28b306,_0x519700=_0x5ba5f7['args'][0x0],_0x342131=_0x5ba5f7[_0x257953(0xdc)][_0x257953(0xe2)];if(!_0x519700&&!_0x342131)return _0x257953(0xdd);if(_0x519700&&_0x342131)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
|