@treasuredata/tdx 0.27.0 → 0.27.1
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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.d.ts +52 -0
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +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/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.d.ts +85 -2
- 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.d.ts +149 -2
- package/dist/sdk/journey.d.ts.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/journey.js.map +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.map +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-validator.js.map +1 -1
- 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.js +1 -1
- package/dist/sdk/segment/push-workflow.d.ts +13 -3
- 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/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cdp.d.ts +165 -1
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.d.ts +1 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +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/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_0x567877=a22_0x19ff;(function(_0x49365b,_0x27a4bb){const _0x55bd62=a22_0x19ff,_0x3dd276=_0x49365b();while(!![]){try{const _0x5856ee=-parseInt(_0x55bd62(0x21d))/0x1+parseInt(_0x55bd62(0x1a7))/0x2*(-parseInt(_0x55bd62(0x184))/0x3)+parseInt(_0x55bd62(0x1f0))/0x4+parseInt(_0x55bd62(0x13e))/0x5*(-parseInt(_0x55bd62(0x228))/0x6)+-parseInt(_0x55bd62(0x1fc))/0x7+-parseInt(_0x55bd62(0x143))/0x8*(-parseInt(_0x55bd62(0x120))/0x9)+parseInt(_0x55bd62(0x223))/0xa*(parseInt(_0x55bd62(0x270))/0xb);if(_0x5856ee===_0x27a4bb)break;else _0x3dd276['push'](_0x3dd276['shift']());}catch(_0x52106d){_0x3dd276['push'](_0x3dd276['shift']());}}}(a22_0x13bd,0x5d7ec));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x4d6651 from'path';function a22_0x19ff(_0x5e6d0e,_0x1f486f){_0x5e6d0e=_0x5e6d0e-0x108;const _0x13bd66=a22_0x13bd();let _0x19ff05=_0x13bd66[_0x5e6d0e];return _0x19ff05;}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_0x2cd7a0 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_0x567877(0x200),LEGACY_PARENT_SEGMENT_DIR=a22_0x567877(0x159);function openBrowser(_0x417e6b){const _0x5c2fd7=a22_0x567877,_0x4d6fed=process[_0x5c2fd7(0x1ab)],_0x1126f6=_0x4d6fed===_0x5c2fd7(0x208)?_0x5c2fd7(0x239):_0x4d6fed===_0x5c2fd7(0x1d7)?_0x5c2fd7(0x1ad):_0x5c2fd7(0x1b4);spawn(_0x1126f6,[_0x417e6b],{'detached':!![],'stdio':'ignore'})[_0x5c2fd7(0x24d)]();}function migrateLegacyDirectory(){const _0x17561a=a22_0x567877;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x431c41=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x431c41[_0x17561a(0x1bf)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x17561a(0x26a)](a22_0x2cd7a0[_0x17561a(0x27b)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x17561a(0x25b)+PARENT_SEGMENT_DIR+_0x17561a(0x1cd))),console[_0x17561a(0x26a)](a22_0x2cd7a0[_0x17561a(0x1b8)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x17561a(0x188))),![];console[_0x17561a(0x26a)](a22_0x2cd7a0[_0x17561a(0x27b)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x17561a(0x21f)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a22_0x2cd7a0[_0x17561a(0x24e)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x46a4af){const _0x2b91f6=_0x46a4af instanceof Error?_0x46a4af[_0x17561a(0x209)]:String(_0x46a4af);return console[_0x17561a(0x26a)](a22_0x2cd7a0[_0x17561a(0x272)](_0x17561a(0x20c)+_0x2b91f6+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x567877(0x189)](_0x1f8357){const _0x57a5c3=a22_0x567877;return migrateLegacyDirectory(),super[_0x57a5c3(0x189)](_0x1f8357);}}function resolveYamlFile(_0x3fef18){const _0x33a24d=a22_0x567877;if(_0x3fef18[_0x33a24d(0x187)](_0x33a24d(0x26b))||_0x3fef18[_0x33a24d(0x187)](_0x33a24d(0x279)))return _0x3fef18;return a22_0x4d6651[_0x33a24d(0x1e8)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3fef18)+_0x33a24d(0x26b));}function formatProgressMessage(_0x17b4f0){const _0x461ffa=a22_0x567877,_0x32868d=_0x17b4f0[_0x461ffa(0x28d)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x32868d){const [,_0x18197f,_0x234e92,_0x140150='']=_0x32868d;return a22_0x2cd7a0[_0x461ffa(0x1b8)](_0x18197f+':')+'\x20'+_0x234e92+a22_0x2cd7a0['dim'](_0x140150);}return a22_0x2cd7a0[_0x461ffa(0x1b8)](_0x17b4f0);}function showFileNotFoundError(_0x55ca93,_0x3fb697){const _0x4ebcb7=a22_0x567877;console[_0x4ebcb7(0x26a)](a22_0x2cd7a0[_0x4ebcb7(0x272)](_0x4ebcb7(0x19d)+_0x55ca93+'\x0a')),console[_0x4ebcb7(0x26a)](a22_0x2cd7a0[_0x4ebcb7(0x146)](_0x4ebcb7(0x1b9)+_0x3fb697+_0x4ebcb7(0x15d)));}function displayRealtimeValidation(_0x574a78){const _0x4e85c7=a22_0x567877;if(!_0x574a78['realtime'])return;const _0x3acb5d=_0x574a78[_0x4e85c7(0x145)],_0x397827=_0x3acb5d[_0x4e85c7(0x17e)]?a22_0x2cd7a0[_0x4e85c7(0x24e)]('⚡\x20Enabled'):a22_0x2cd7a0['yellow'](_0x4e85c7(0x22d));console['error']('\x0a'+a22_0x2cd7a0[_0x4e85c7(0x1b8)](_0x4e85c7(0x181))+'\x20'+_0x397827);if(_0x3acb5d[_0x4e85c7(0x21a)]&&_0x3acb5d['events'][_0x4e85c7(0x131)]>0x0){console[_0x4e85c7(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4e85c7(0x1b8)](_0x4e85c7(0x244))+'\x20'+_0x3acb5d[_0x4e85c7(0x21a)][_0x4e85c7(0x131)]+'\x20configured');for(const _0xaec57b of _0x3acb5d[_0x4e85c7(0x21a)]){const _0x5e142a=_0xaec57b['sourceTableValid']===![]?a22_0x2cd7a0['red']('✘'):a22_0x2cd7a0[_0x4e85c7(0x24e)]('✔');console['error'](_0x4e85c7(0x216)+_0x5e142a+'\x20'+_0xaec57b[_0x4e85c7(0x1ca)]),_0xaec57b['sourceTableError']&&console['error'](_0x4e85c7(0x1a6)+a22_0x2cd7a0[_0x4e85c7(0x272)](_0xaec57b['sourceTableError']));}}if(_0x3acb5d[_0x4e85c7(0x156)]&&_0x3acb5d['attributes'][_0x4e85c7(0x131)]>0x0){console[_0x4e85c7(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4e85c7(0x1b8)](_0x4e85c7(0x18d))+'\x20'+_0x3acb5d[_0x4e85c7(0x156)]['length']+_0x4e85c7(0x154));for(const _0x34a66e of _0x3acb5d[_0x4e85c7(0x156)]){const _0x2339ed=_0x34a66e['valid']?a22_0x2cd7a0[_0x4e85c7(0x24e)]('✔'):a22_0x2cd7a0[_0x4e85c7(0x272)]('✘');console[_0x4e85c7(0x26a)](_0x4e85c7(0x216)+_0x2339ed+'\x20'+_0x34a66e['name']+'\x20'+a22_0x2cd7a0[_0x4e85c7(0x1b8)]('('+_0x34a66e[_0x4e85c7(0x220)]+')'));}}if(_0x3acb5d[_0x4e85c7(0x175)]){const _0x185630=_0x3acb5d[_0x4e85c7(0x175)][_0x4e85c7(0x136)]?.[_0x4e85c7(0x131)]?_0x4e85c7(0x21e)+_0x3acb5d['idStitching']['stitchingKeys'][_0x4e85c7(0x1e8)](',\x20')+']':'';console[_0x4e85c7(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4e85c7(0x1b8)](_0x4e85c7(0x11d))+'\x20'+_0x3acb5d[_0x4e85c7(0x175)][_0x4e85c7(0x1d4)]+_0x185630);}if(_0x3acb5d[_0x4e85c7(0x1d5)]&&_0x3acb5d['personalizationServices'][_0x4e85c7(0x131)]>0x0){console['error']('\x20\x20'+a22_0x2cd7a0['dim']('Personalization:')+'\x20'+_0x3acb5d['personalizationServices'][_0x4e85c7(0x131)]+_0x4e85c7(0x232)+(_0x3acb5d['personalizationServices'][_0x4e85c7(0x131)]!==0x1?'s':''));for(const _0xa86272 of _0x3acb5d[_0x4e85c7(0x1d5)]){console[_0x4e85c7(0x26a)](_0x4e85c7(0x274)+_0xa86272[_0x4e85c7(0x1ca)]);}}}function showParentSegmentNotSetError(_0x5eff4a){const _0x38e06d=a22_0x567877;console[_0x38e06d(0x26a)](a22_0x2cd7a0[_0x38e06d(0x27b)](_0x38e06d(0x260))),console['error'](_0x5eff4a);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x567877(0x1e0);[a22_0x567877(0x1ee)]='List\x20parent\x20segments';async[a22_0x567877(0x273)](_0x2d1291){const _0x5a1bb8=a22_0x567877,{options:_0x39ed07,args:_0x150f22,tdx:_0x5ec86b}=_0x2d1291,_0x273eb7=_0x150f22[0x0];_0x39ed07['verbose']&&(console[_0x5a1bb8(0x26a)]('Site:\x20'+_0x39ed07[_0x5a1bb8(0x140)]),_0x273eb7&&console['error'](_0x5a1bb8(0x1d0)+_0x273eb7));const _0x554107=await withSpinner(_0x273eb7?_0x5a1bb8(0x128)+_0x273eb7+_0x5a1bb8(0x10c):_0x5a1bb8(0x134),()=>_0x5ec86b[_0x5a1bb8(0x1e4)][_0x5a1bb8(0x237)](),{'verbose':_0x39ed07['verbose']});let _0x4cf3d3=_0x554107[_0x5a1bb8(0x118)];if(_0x273eb7){const _0x119a48=_0x273eb7[_0x5a1bb8(0x1db)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x5a1bb8(0x1db)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4bb398=new RegExp('^'+_0x119a48+'$','i');_0x4cf3d3=_0x4cf3d3[_0x5a1bb8(0x298)](_0x47257a=>_0x4bb398['test'](_0x47257a['attributes'][_0x5a1bb8(0x1ca)]));}_0x4cf3d3['sort']((_0x32394a,_0x4aa003)=>_0x32394a[_0x5a1bb8(0x156)][_0x5a1bb8(0x1ca)][_0x5a1bb8(0x122)](_0x4aa003['attributes'][_0x5a1bb8(0x1ca)])),console['error'](_0x5a1bb8(0x1d1)+_0x4cf3d3['length']+'\x20parent\x20segment'+(_0x4cf3d3[_0x5a1bb8(0x131)]!==0x1?'s':''));const _0x3a93e4=_0xaf7a4e=>{return getConsoleNextUrl(_0x39ed07['site'],'/app/dw/parentSegments/'+_0xaf7a4e);};if(_0x39ed07[_0x5a1bb8(0x199)]===_0x5a1bb8(0x202)||_0x39ed07[_0x5a1bb8(0x199)]==='jsonl'){const _0x1568d7=_0x4cf3d3['map'](_0x1d3b00=>({..._0x1d3b00,'url':_0x3a93e4(_0x1d3b00['id'])}));await handleSDKOutput(_0x1568d7,_0x39ed07);}else{if(_0x4cf3d3['length']===0x0)_0x273eb7?console[_0x5a1bb8(0x13d)](_0x5a1bb8(0x13a)+_0x273eb7):console[_0x5a1bb8(0x13d)]('No\x20parent\x20segments\x20found');else for(const _0x40d106 of _0x4cf3d3){const _0x54600e=_0x40d106[_0x5a1bb8(0x156)][_0x5a1bb8(0x201)]?a22_0x2cd7a0[_0x5a1bb8(0x1b8)]('\x20('+formatRows(_0x40d106[_0x5a1bb8(0x156)][_0x5a1bb8(0x201)])+')'):'',_0x29da5e=hyperlink(_0x40d106[_0x5a1bb8(0x156)][_0x5a1bb8(0x1ca)],_0x3a93e4(_0x40d106['id']));console[_0x5a1bb8(0x13d)](_0x5a1bb8(0x241)+_0x29da5e+_0x54600e);}}return 0x0;}}function a22_0x13bd(){const _0x5cbe56=['match','toLowerCase','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Available\x20behaviors:','preview','sections','toFixed','\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','getOutputDatabaseName','\x20Configuration\x20is\x20valid','filter','\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','customerGroup','Overwrite\x20\x27','/sessions/','\x20trigger=','displaySummary','Rows:','\x0a\x20\x20\x20\x20]','schemaValid','personalization_services','formatSchemaJson','getParentFull','\x27...','SELECT\x20*\x20FROM\x20','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Name:\x20','\x20service(s)\x20configured','/app/workflows/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Errors:','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Site:\x20','Updating\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','data','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','Join\x20on:','interval','getBehaviorNames','ID\x20Stitching:','yes','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','45utRPXi','information_schema','localeCompare','\x20\x202.\x20Run\x20','runParent','processedRows','My\x20Service','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','Behavior:','Personalization\x20service\x20description','apply','Listing\x20personalization\x20services\x20for\x20\x27','segment:parent:preview','displayBehaviorsStats','-1d','errors','length','displayColumns','collectSchema','Listing\x20parent\x20segments...','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','stitchingKeys','ps:pz:init','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','map','ps:rt:list','log','515hpOSdV','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','site','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','addAttributesFile','437872SkLaYw','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','realtime','cyan','createParent','No\x20personalization\x20services\x20configured','string','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20Added\x20personalization\x20template\x20to\x20','segment:parent:view','displayMasterInfo','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','%)\x20','elapsedTimeMillis','resolveParentId','List\x20available\x20fields\x20for\x20segmentation','Validate:','\x20configured','Session:','attributes','<database>.<table>','workflowAttemptId','parent_segment','Master:','Found\x20YAML\x20file:\x20','Fetching\x20customers\x20schema...','`\x20to\x20download\x20the\x20configuration\x20first','Creating\x20parent\x20segment\x20\x27','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Coverage:','tdx\x20ps\x20push\x20','\x20to\x20configure\x20your\x20personalization\x20service','\x22,\x20\x22type\x22:\x20\x22','indexOf','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20[Job\x20ID:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20personalization\x20service','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','listFields','verbose','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Options:\x0a','sort','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','label','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x5c$&','idStitching','addBehaviors','web','\x0aChanges\x20to\x20\x27','✔\x20No\x20changes\x20-\x20\x27','column_type','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','enabled','Attributes','output','RT\x202.0:','timezone','query','3057PVpvzr','\x20=\x20','double','endsWith','/\x20directory.\x0a','run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','/app/dw/parentSegments/','\x20field','Attributes:','utf-8','coveragePercent','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','validateParentYaml','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','totalEvents','pushParentYaml','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--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','column_name','Listing\x20fields\x20for\x20\x27','format','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','displayPreviewResults','stats','Error:\x20File\x20not\x20found:\x20','column','No\x20RT-enabled\x20parent\x20segments\x20found','jsonl','displayPreviewHints','\x20tdx\x20wf\x20attempt\x20','\x20\x20\x20','✔\x20Updated\x20parent\x20segment\x20\x27','\x0aNo\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20','1346tfiwVY','Table:\x20','page_view','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','platform','Fetching\x20current\x20configuration\x20for\x20\x27','start','customers','\x20\x201.\x20Edit\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displaySampleData','rowCount','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','xdg-open','last_page_viewed','\x0a\x20\x20]\x0a}\x0a','Output\x20file:\x20','dim','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20behaviors','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20--attribute\x20\x22<name>\x22','true','Join:','isDirectory','workflowId','Fetching\x20sample\x20data...','Output\x20Database:','\x0a\x20\x20\x20\x20}','Fetching\x20behavior\x20list...','workflowSessionId','parent_id','\x27\x20is\x20already\x20up\x20to\x20date','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Parent\x20segment:\x20','/\x20directories\x20exist.','SQL\x20query:\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Pattern:\x20','✔\x20Found\x20','\x20kill','/attempt/','primaryKey','personalizationServices','behaviors','win32','segment:parent:pull','Columns:','previewParentYaml','replace','Options:','reduce','displayAttributesStats','\x20--behavior\x20\x22<name>\x22','segment:parent:list','Create\x20parent\x20segment\x20\x27','Apply\x20changes\x20to\x20\x27','\x20\x20No\x20sample\x20data\x20available','segment','\x20No\x20changes\x20-\x20','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','bold','join','\x20--attribute\x20\x22','matchedCount','varchar','toLocaleString','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','description','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','1418008DEpwqI','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','segment:parent:create','.customers)','Validating\x20RT\x20configuration...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Aborted.','Audience\x20ID:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','in\x20','Created','Executing\x20parent\x20segment\x20query...','2752701BXuqmV','realtime:','\x22\x20}','/{name}.yml\x0a','parent_segments','population','json','Error:','all','Creating','scheduleType','\x20\x20Database:\x20','darwin','message','\x0aNew\x20parent\x20segment\x20\x27','Enriched:','✘\x20Failed\x20to\x20rename\x20directory:\x20','segment:parent:run','columns','{\x0a\x20\x20\x22database\x22:\x20\x22','Error:\x20--behavior\x20requires\x20a\x20name\x0a','single','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','test','Behaviors','FINISHED','\x20\x20\x20\x20','limit','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20Opening\x20','events','behavior','trigger_event','447512zIoWZl','\x20+\x20[','/\x20→\x20','type','\x20Added\x20RT\x202.0\x20template\x20section','✔\x20Created\x20parent\x20segment\x20\x27','10KNMcpm','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x0aError:','status','Resolving\x20parent\x20segment\x20\x27','174CTqWYN','master','getParentSQL','\x0aUsage:\x20tdx\x20ps\x20preview\x20','updateParent','⚡\x20Not\x20enabled','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','tdx\x20ps\x20preview\x20','ps:rt:validate','sampleData','\x20service','\x27\x20and\x20run\x20workflow?','Updated','displayValidateResults','trim','listParents','segment:parent:show','open','ps:pz:list','repeat','Customers:','attribute','setJobId','\x20rows)','session','👥\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','attributesFile','Events:','td_client_id','Schema\x20saved\x20to\x20','audienceId','list','Source:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x27\x20is\x20up\x20to\x20date','Updating','unref','green','\x20RT-enabled\x20parent\x20segment','segment:parent:validate','\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','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','scheduleOption','schemaError','displayRealtimeInfo','Available\x20attributes:','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','To\x20cancel:','Database:\x20','/\x20and\x20','foreignKey','addAttributes','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20--behavior\x20\x22','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x0a✔\x20Workflow\x20started','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','Error\x20reading\x20file:\x20','RT\x202.0\x20Validate:','customerPercent','table','error','.yml','addBehaviorsFile','Fetching\x20parent\x20segment\x20\x27','customersWithEvents','jobId','14127443rtnBeA','Error\x20parsing\x20YAML:\x20','red','execute','\x20\x20\x20\x20-\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','joinKey','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','text','.yaml','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','yellow','Error:\x20--database\x20and\x20--table\x20are\x20required','behavior_','use','\x20total','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','enriched','\x20\x20Columns:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','allValid','stop','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','database','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','segment:parent:update','Default','parentSegment','\x20section'];a22_0x13bd=function(){return _0x5cbe56;};return a22_0x13bd();}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x1f2);[a22_0x567877(0x1ee)]=a22_0x567877(0x141);async[a22_0x567877(0x273)](_0x49aee1){const _0x398de0=a22_0x567877,{options:_0x15c047,args:_0x3f710f,tdx:_0x3adac3}=_0x49aee1;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x398de0(0x11f)+_0x398de0(0x1ef));const _0x2bf4c2=_0x15c047;if(_0x3f710f[_0x398de0(0x131)]===0x0)return console[_0x398de0(0x26a)](a22_0x2cd7a0[_0x398de0(0x272)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x398de0(0x26a)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x4fb7a9=_0x3f710f[0x0];if(!_0x2bf4c2['database']||!_0x2bf4c2['table'])return console[_0x398de0(0x26a)](_0x398de0(0x27c)),console[_0x398de0(0x26a)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2bf4c2[_0x398de0(0x16b)]&&(console[_0x398de0(0x26a)]('Site:\x20'+_0x2bf4c2['site']),console[_0x398de0(0x26a)](_0x398de0(0x10f)+_0x4fb7a9),console['error'](_0x398de0(0x25a)+_0x2bf4c2[_0x398de0(0x287)]),console[_0x398de0(0x26a)](_0x398de0(0x1a8)+_0x2bf4c2['table']));const _0x57c32f=await loadJSONFromOptions(_0x2bf4c2[_0x398de0(0x156)],_0x2bf4c2[_0x398de0(0x243)]),_0x242810=await loadJSONFromOptions(_0x2bf4c2[_0x398de0(0x1d6)],_0x2bf4c2['behaviorsFile']),_0x1814c4=await loadJSONFromOptions(_0x2bf4c2[_0x398de0(0x29a)],_0x2bf4c2['customerGroupFile']),_0x3519dc={'name':_0x4fb7a9,'description':_0x2bf4c2[_0x398de0(0x1ee)],'scheduleType':_0x2bf4c2[_0x398de0(0x206)],'scheduleOption':_0x2bf4c2['scheduleOption'],'timezone':_0x2bf4c2['timezone'],'master':{'parentDatabaseName':_0x2bf4c2[_0x398de0(0x287)],'parentTableName':_0x2bf4c2[_0x398de0(0x269)]},'attributes':_0x57c32f,'behaviors':_0x242810,'customerGroup':_0x1814c4},_0x7dfd7e=await withSpinner(_0x398de0(0x15e)+_0x4fb7a9+_0x398de0(0x10c),()=>_0x3adac3[_0x398de0(0x1e4)][_0x398de0(0x147)](_0x3519dc),{'verbose':_0x15c047['verbose']}),_0x41096e=_0x7dfd7e[_0x398de0(0x118)];return console[_0x398de0(0x26a)](_0x398de0(0x222)+_0x41096e[_0x398de0(0x1ca)]+_0x398de0(0x28f)+_0x41096e['id']),await handleSDKOutput([_0x41096e],_0x15c047),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x289);['description']=a22_0x567877(0x15f);async[a22_0x567877(0x273)](_0x5c8e5f){const _0x23fd0c=a22_0x567877,{options:_0x86bc22,args:_0x567127,tdx:_0x46193e}=_0x5c8e5f;console[_0x23fd0c(0x26a)](_0x23fd0c(0x283)+_0x23fd0c(0x11f)+_0x23fd0c(0x1ef));const _0x24c3f9=_0x86bc22;if(_0x567127[_0x23fd0c(0x131)]===0x0)return console[_0x23fd0c(0x26a)](a22_0x2cd7a0[_0x23fd0c(0x272)](_0x23fd0c(0x1c8))),console[_0x23fd0c(0x26a)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x283741=_0x567127[0x0];_0x24c3f9[_0x23fd0c(0x16b)]&&(console[_0x23fd0c(0x26a)](_0x23fd0c(0x115)+_0x24c3f9[_0x23fd0c(0x140)]),console[_0x23fd0c(0x26a)](_0x23fd0c(0x1cc)+_0x283741));const _0x2d352d=await withSpinner(_0x23fd0c(0x1ac)+_0x283741+'\x27...',()=>_0x46193e[_0x23fd0c(0x1e4)][_0x23fd0c(0x10b)](_0x283741),{'verbose':_0x24c3f9[_0x23fd0c(0x16b)]}),_0x37444e=_0x2d352d[_0x23fd0c(0x118)],_0x4a2613=await loadJSONFromOptions(_0x24c3f9[_0x23fd0c(0x25d)],_0x24c3f9[_0x23fd0c(0x142)]),_0x1807a1=await loadJSONFromOptions(_0x24c3f9[_0x23fd0c(0x176)],_0x24c3f9[_0x23fd0c(0x26c)]),_0x393718={'name':_0x37444e[_0x23fd0c(0x1ca)],'description':_0x24c3f9[_0x23fd0c(0x1ee)]!==undefined?_0x24c3f9[_0x23fd0c(0x1ee)]:_0x37444e[_0x23fd0c(0x1ee)],'scheduleType':_0x24c3f9[_0x23fd0c(0x206)]!==undefined?_0x24c3f9[_0x23fd0c(0x206)]:_0x37444e['scheduleType'],'scheduleOption':_0x24c3f9[_0x23fd0c(0x254)]!==undefined?_0x24c3f9[_0x23fd0c(0x254)]:_0x37444e[_0x23fd0c(0x254)],'timezone':_0x24c3f9[_0x23fd0c(0x182)]!==undefined?_0x24c3f9[_0x23fd0c(0x182)]:_0x37444e[_0x23fd0c(0x182)],'master':_0x37444e[_0x23fd0c(0x229)],'attributes':_0x4a2613?[..._0x37444e[_0x23fd0c(0x156)]||[],..._0x4a2613]:_0x37444e['attributes'],'behaviors':_0x1807a1?[..._0x37444e['behaviors']||[],..._0x1807a1]:_0x37444e[_0x23fd0c(0x1d6)],'customerGroup':_0x37444e[_0x23fd0c(0x29a)]},_0x47ae9d=await withSpinner(_0x23fd0c(0x116)+_0x283741+_0x23fd0c(0x10c),()=>_0x46193e[_0x23fd0c(0x1e4)][_0x23fd0c(0x22c)](_0x283741,_0x393718),{'verbose':_0x24c3f9[_0x23fd0c(0x16b)]}),_0x67b729=_0x47ae9d[_0x23fd0c(0x118)];return console[_0x23fd0c(0x26a)](_0x23fd0c(0x1a4)+_0x67b729[_0x23fd0c(0x1ca)]+'\x27'),await handleSDKOutput([_0x67b729],_0x24c3f9),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x1d8);[a22_0x567877(0x1ee)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x567877(0x273)](_0x3df772){const _0x82f618=a22_0x567877,{options:_0x22389d,args:_0x52f540,tdx:_0x5836ca}=_0x3df772,_0x2e4195=_0x22389d,_0x5a3eaa=_0x52f540[0x0]||_0x22389d['parentSegment'];if(!_0x5a3eaa)return showParentSegmentNotSetError(_0x82f618(0x1b3)+_0x82f618(0x1cb)),0x1;if(_0x2e4195[_0x82f618(0x27e)]&&_0x2e4195[_0x82f618(0x180)])return console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x272)](_0x82f618(0x117))),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x1b8)](_0x82f618(0x212))),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x1b8)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x82f618(0x1ff))),console[_0x82f618(0x26a)](a22_0x2cd7a0['cyan']('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x1c57f6=_0x2e4195[_0x82f618(0x180)]||a22_0x4d6651['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5a3eaa)+'.yml');_0x2e4195[_0x82f618(0x16b)]&&(console['error']('Site:\x20'+_0x2e4195[_0x82f618(0x140)]),console['error']('Parent\x20segment:\x20'+_0x5a3eaa),console[_0x82f618(0x26a)](_0x82f618(0x1b7)+_0x1c57f6));const _0x3e90cd=await withSpinner(_0x82f618(0x26d)+_0x5a3eaa+_0x82f618(0x10c),()=>_0x5836ca[_0x82f618(0x1e4)]['pullParentYaml'](_0x5a3eaa),{'verbose':_0x2e4195[_0x82f618(0x16b)]}),_0x225ce7=_0x3e90cd[_0x82f618(0x118)];if(existsSync(_0x1c57f6)){const _0xd286a5=readFileSync(_0x1c57f6,_0x82f618(0x18e)),_0x538459=generateDiff(_0xd286a5,_0x225ce7);if(!hasChanges(_0x538459))console[_0x82f618(0x26a)](a22_0x2cd7a0['green']('✔')+_0x82f618(0x1e5)+a22_0x2cd7a0[_0x82f618(0x146)](_0x1c57f6)+_0x82f618(0x17d));else{console['error'](_0x82f618(0x178)+_0x1c57f6+'\x27:'),console['error']('─'[_0x82f618(0x23b)](0x3c)),console[_0x82f618(0x26a)](formatDiffWithColors(_0x538459)),console[_0x82f618(0x26a)]('─'[_0x82f618(0x23b)](0x3c));if(!_0x2e4195['yes']){if(!isInteractive())return console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x272)]('\x0aError:'),_0x82f618(0x14e)),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x1b8)](_0x82f618(0x17b))),0x1;const _0x1c1adf=await confirmKey(_0x82f618(0x29b)+_0x1c57f6+'\x27?');if(!_0x1c1adf)return console['error'](a22_0x2cd7a0[_0x82f618(0x27b)](_0x82f618(0x1f6))),0x1;}writeFileSync(_0x1c57f6,_0x225ce7,_0x82f618(0x18e)),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x24e)]('✔')+_0x82f618(0x1cf)+a22_0x2cd7a0[_0x82f618(0x146)](_0x1c57f6));}}else{const _0x15a91e=a22_0x4d6651['dirname'](_0x1c57f6);!existsSync(_0x15a91e)&&mkdirSync(_0x15a91e,{'recursive':!![]}),writeFileSync(_0x1c57f6,_0x225ce7,_0x82f618(0x18e)),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x24e)]('✔')+_0x82f618(0x1cf)+a22_0x2cd7a0['cyan'](_0x1c57f6));}return saveSessionContext({'parent_segment':_0x5a3eaa},_0x2e4195[_0x82f618(0x240)]),console[_0x82f618(0x26a)](a22_0x2cd7a0[_0x82f618(0x24e)]('✔')+'\x20Context\x20set:\x20'+a22_0x2cd7a0[_0x82f618(0x1b8)](_0x82f618(0x159))+_0x82f618(0x185)+a22_0x2cd7a0[_0x82f618(0x146)](_0x5a3eaa)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]='segment:parent:push';[a22_0x567877(0x1ee)]=a22_0x567877(0x1ed);async[a22_0x567877(0x273)](_0x5b5853){const _0x4c5276=a22_0x567877,{options:_0x43b088,args:_0x19d710,tdx:_0xbbf6b2}=_0x5b5853,_0x55c04b=_0x43b088,_0x3a1cbc=_0x19d710[0x0]||_0x43b088[_0x4c5276(0x28b)];if(!_0x3a1cbc)return showParentSegmentNotSetError(_0x4c5276(0x286)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x346e28=resolveYamlFile(_0x3a1cbc);if(!existsSync(_0x346e28))return showFileNotFoundError(_0x346e28,_0x3a1cbc),0x1;_0x55c04b[_0x4c5276(0x16b)]&&(console[_0x4c5276(0x26a)]('Site:\x20'+_0x55c04b[_0x4c5276(0x140)]),console['error'](_0x4c5276(0x138)+_0x346e28));let _0x51c0bf;try{_0x51c0bf=readFileSync(_0x346e28,_0x4c5276(0x18e));}catch(_0x3803ee){const _0x4674bb=_0x3803ee instanceof Error?_0x3803ee[_0x4c5276(0x209)]:String(_0x3803ee);return console['error']('Error\x20reading\x20file:\x20'+_0x4674bb),0x1;}const _0x2a8528=await withSpinner('Analyzing\x20changes...',()=>_0xbbf6b2[_0x4c5276(0x1e4)][_0x4c5276(0x194)](_0x51c0bf),{'verbose':_0x55c04b[_0x4c5276(0x16b)]}),_0x597c34=_0x2a8528['data'],{isNew:_0x3a0369,name:_0x49cd19,hasChanges:_0x4e376c,diffFormatted:_0x1b5514}=_0x597c34;if(!_0x4e376c)return console['error'](_0x4c5276(0x179)+_0x49cd19+_0x4c5276(0x1c7)),0x0;_0x3a0369?console[_0x4c5276(0x26a)](_0x4c5276(0x20a)+_0x49cd19+'\x27:'):console['error'](_0x4c5276(0x165)+_0x49cd19+'\x27:');console[_0x4c5276(0x26a)]('─'[_0x4c5276(0x23b)](0x3c)),console[_0x4c5276(0x26a)](_0x1b5514),console[_0x4c5276(0x26a)]('─'[_0x4c5276(0x23b)](0x3c));const _0x1e4720=_0x3a0369?_0x4c5276(0x1e1)+_0x49cd19+'\x27?':_0x4c5276(0x1e2)+_0x49cd19+'\x27?';if(!_0x55c04b[_0x4c5276(0x11e)]){if(!isInteractive())return console[_0x4c5276(0x26a)](a22_0x2cd7a0[_0x4c5276(0x272)](_0x4c5276(0x225)),_0x4c5276(0x14e)),console[_0x4c5276(0x26a)](a22_0x2cd7a0[_0x4c5276(0x1b8)](_0x4c5276(0x17b))),0x1;const _0x7555ef=await confirmKey(_0x1e4720);if(!_0x7555ef)return console[_0x4c5276(0x26a)](a22_0x2cd7a0[_0x4c5276(0x27b)]('Aborted.')),0x1;}const _0x32ab90=_0x3a0369?'Creating':_0x4c5276(0x24c),_0x54fc3f=await withSpinner(_0x32ab90+_0x4c5276(0x17c)+_0x49cd19+_0x4c5276(0x10c),()=>_0x597c34[_0x4c5276(0x12b)](),{'verbose':_0x55c04b[_0x4c5276(0x16b)]}),_0x1b3404=_0x54fc3f[_0x4c5276(0x118)],_0x313331=getConsoleNextUrl(_0x55c04b['site'],_0x4c5276(0x18b)+_0x1b3404['id']),_0x4436b9=_0x3a0369?_0x4c5276(0x1fa):_0x4c5276(0x234);return console['error']('✔\x20'+_0x4436b9+'\x20parent\x20segment\x20\x27'+_0x1b3404['name']+'\x27'),console['error']('\x20\x20'+_0x313331),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x250);[a22_0x567877(0x1ee)]=a22_0x567877(0x114);async[a22_0x567877(0x273)](_0x24fba1){const _0x3d80d9=a22_0x567877,{options:_0x5a72bd,args:_0x5c9f89,tdx:_0x364d04}=_0x24fba1,_0x954518=_0x5a72bd,_0x361b82=_0x5c9f89[0x0]||_0x5a72bd[_0x3d80d9(0x28b)];if(!_0x361b82)return showParentSegmentNotSetError(_0x3d80d9(0x169)+_0x3d80d9(0x18a)+_0x3d80d9(0x16d)+_0x3d80d9(0x24a)+_0x3d80d9(0x275)+_0x3d80d9(0x277)),0x1;const _0x516acf=resolveYamlFile(_0x361b82);if(!existsSync(_0x516acf))return showFileNotFoundError(_0x516acf,_0x361b82),0x1;_0x954518[_0x3d80d9(0x16b)]&&(console['error'](_0x3d80d9(0x115)+_0x954518[_0x3d80d9(0x140)]),console[_0x3d80d9(0x26a)]('YAML\x20file:\x20'+_0x516acf));let _0x1f4022;try{_0x1f4022=readFileSync(_0x516acf,_0x3d80d9(0x18e));}catch(_0xc44c07){const _0x32802a=_0xc44c07 instanceof Error?_0xc44c07[_0x3d80d9(0x209)]:String(_0xc44c07);return console[_0x3d80d9(0x26a)]('Error\x20reading\x20file:\x20'+_0x32802a),0x1;}const _0x46023a=createCommandSpinner(a22_0x2cd7a0[_0x3d80d9(0x1b8)]('Validating\x20configuration...'),{'verbose':_0x954518[_0x3d80d9(0x16b)]});_0x46023a['start']();const _0x1fd2a7={'onProgress':_0x42839a=>{const _0x58eec0=_0x3d80d9;_0x46023a[_0x58eec0(0x278)]=formatProgressMessage(_0x42839a);}};if(_0x954518[_0x3d80d9(0x229)])_0x1fd2a7['master']=!![];if(_0x954518['enriched'])_0x1fd2a7[_0x3d80d9(0x281)]=!![];_0x954518[_0x3d80d9(0x23d)]&&(_0x1fd2a7['attribute']=_0x954518[_0x3d80d9(0x23d)]);_0x954518[_0x3d80d9(0x21b)]&&(_0x1fd2a7[_0x3d80d9(0x21b)]=_0x954518[_0x3d80d9(0x21b)]);if(_0x954518[_0x3d80d9(0x11b)])_0x1fd2a7['interval']=_0x954518[_0x3d80d9(0x11b)];let _0x59acb1;try{_0x59acb1=await _0x364d04[_0x3d80d9(0x1e4)][_0x3d80d9(0x191)](_0x1f4022,_0x1fd2a7),_0x46023a[_0x3d80d9(0x285)]();}catch(_0x5179a4){_0x46023a[_0x3d80d9(0x285)]();throw _0x5179a4;}const _0x1d8a0a=_0x954518[_0x3d80d9(0x11b)]||_0x3d80d9(0x12f);return this[_0x3d80d9(0x235)](_0x59acb1,_0x1fd2a7,_0x516acf,_0x1d8a0a),_0x59acb1[_0x3d80d9(0x284)]?0x0:0x1;}['displayValidateResults'](_0x331583,_0x27a151,_0x473a14,_0x1e3fda){const _0x33959c=a22_0x567877;console[_0x33959c(0x26a)]('\x0a'+a22_0x2cd7a0['bold'](_0x33959c(0x153))+'\x20'+_0x331583[_0x33959c(0x1ca)]),console[_0x33959c(0x26a)]('═'[_0x33959c(0x23b)](0x3c)),this[_0x33959c(0x14d)](_0x331583);if(typeof _0x27a151['attribute']===_0x33959c(0x149)){this[_0x33959c(0x1de)](_0x331583),this[_0x33959c(0x29e)](_0x331583),this[_0x33959c(0x1a1)](_0x473a14,_0x1e3fda,_0x33959c(0x23d),_0x27a151[_0x33959c(0x23d)]);return;}if(_0x27a151[_0x33959c(0x23d)]===!![]){this[_0x33959c(0x1de)](_0x331583),this[_0x33959c(0x29e)](_0x331583),this[_0x33959c(0x1a1)](_0x473a14,_0x1e3fda,'attributes');return;}if(typeof _0x27a151[_0x33959c(0x21b)]===_0x33959c(0x149)){this['displayBehaviorsStats'](_0x331583,_0x1e3fda),this[_0x33959c(0x29e)](_0x331583),this[_0x33959c(0x1a1)](_0x473a14,_0x1e3fda,_0x33959c(0x21b),_0x27a151[_0x33959c(0x21b)]);return;}if(_0x27a151[_0x33959c(0x21b)]===!![]){this[_0x33959c(0x12e)](_0x331583,_0x1e3fda),this[_0x33959c(0x29e)](_0x331583),this[_0x33959c(0x1a1)](_0x473a14,_0x1e3fda,_0x33959c(0x1d6));return;}this[_0x33959c(0x1de)](_0x331583),this[_0x33959c(0x12e)](_0x331583,_0x1e3fda),this['displayRealtimeInfo'](_0x331583),this[_0x33959c(0x29e)](_0x331583),this[_0x33959c(0x1a1)](_0x473a14,_0x1e3fda,_0x33959c(0x204));}[a22_0x567877(0x256)](_0x46a359){displayRealtimeValidation(_0x46a359);}[a22_0x567877(0x1a1)](_0x2d26c7,_0x42f763,_0x272497,_0x48137c){const _0x4a796f=a22_0x567877;console[_0x4a796f(0x26a)]('\x0a'+a22_0x2cd7a0[_0x4a796f(0x1b8)]('To\x20view\x20sample\x20data:'));const _0x4c4f2d=_0x42f763!==_0x4a796f(0x12f)?'\x20--interval\x20'+_0x42f763:'';if(_0x272497===_0x4a796f(0x23d)&&_0x48137c)console[_0x4a796f(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4a796f(0x1b8)](_0x4a796f(0x22f)+_0x2d26c7+_0x4a796f(0x1e9)+_0x48137c+'\x22'+_0x4c4f2d));else{if(_0x272497===_0x4a796f(0x21b)&&_0x48137c)console[_0x4a796f(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4a796f(0x1b8)](_0x4a796f(0x22f)+_0x2d26c7+_0x4a796f(0x261)+_0x48137c+'\x22'+_0x4c4f2d));else(_0x272497==='attributes'||_0x272497===_0x4a796f(0x204))&&console[_0x4a796f(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4a796f(0x1b8)](_0x4a796f(0x22f)+_0x2d26c7+_0x4a796f(0x1bc)+_0x4c4f2d));}(_0x272497===_0x4a796f(0x1d6)||_0x272497===_0x4a796f(0x204))&&console[_0x4a796f(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4a796f(0x1b8)](_0x4a796f(0x22f)+_0x2d26c7+_0x4a796f(0x1df)+_0x4c4f2d)),_0x272497===_0x4a796f(0x204)&&console['error']('\x20\x20'+a22_0x2cd7a0[_0x4a796f(0x1b8)](_0x4a796f(0x22f)+_0x2d26c7+'\x20--enriched'+_0x4c4f2d));}[a22_0x567877(0x14d)](_0x2557c0){const _0x247063=a22_0x567877,{master:_0x51ebdf}=_0x2557c0,_0x24a9fd=_0x51ebdf[_0x247063(0x108)]?a22_0x2cd7a0['green']('✔'):a22_0x2cd7a0['red']('✘');console[_0x247063(0x26a)]('\x0a'+a22_0x2cd7a0['dim']('Master\x20Table')),console['error'](_0x24a9fd+'\x20'+a22_0x2cd7a0['bold'](_0x51ebdf['database']+'.'+_0x51ebdf[_0x247063(0x269)])),_0x51ebdf[_0x247063(0x108)]?_0x51ebdf[_0x247063(0x1b2)]!==undefined&&console[_0x247063(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x247063(0x1b8)](_0x247063(0x29f))+'\x20'+a22_0x2cd7a0['cyan'](formatRows(_0x51ebdf['rowCount']))):console[_0x247063(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x247063(0x272)]('Error:')+'\x20'+_0x51ebdf[_0x247063(0x255)]);}[a22_0x567877(0x1de)](_0x2c1971){const _0x191657=a22_0x567877;if(_0x2c1971[_0x191657(0x156)]['length']===0x0)return;console[_0x191657(0x26a)]('\x0a'+a22_0x2cd7a0['dim'](_0x191657(0x17f)));for(const _0x8b5d5c of _0x2c1971[_0x191657(0x156)]){const _0x156c2f=_0x8b5d5c['schemaValid']?a22_0x2cd7a0[_0x191657(0x24e)]('✔'):a22_0x2cd7a0[_0x191657(0x272)]('✘');let _0x112791='';if(_0x8b5d5c['schemaValid']&&_0x8b5d5c[_0x191657(0x1ea)]!==undefined&&_0x8b5d5c[_0x191657(0x18f)]!==undefined){const _0x265f69=_0x8b5d5c[_0x191657(0x18f)][_0x191657(0x294)](0x1),_0x599079=_0x8b5d5c[_0x191657(0x18f)]>=0x50?a22_0x2cd7a0['green']:_0x8b5d5c['coveragePercent']>=0x32?a22_0x2cd7a0[_0x191657(0x27b)]:a22_0x2cd7a0[_0x191657(0x272)];_0x112791='\x20'+a22_0x2cd7a0[_0x191657(0x1b8)](_0x191657(0x160))+'\x20'+_0x599079(_0x265f69+'%')+'\x20('+formatRows(_0x8b5d5c['matchedCount'])+_0x191657(0x23f);}console[_0x191657(0x26a)](_0x156c2f+'\x20'+a22_0x2cd7a0[_0x191657(0x1e7)](_0x8b5d5c[_0x191657(0x1ca)])+_0x112791),console[_0x191657(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x191657(0x1b8)](_0x191657(0x249))+'\x20'+a22_0x2cd7a0[_0x191657(0x1e7)](_0x8b5d5c[_0x191657(0x287)]+'.'+_0x8b5d5c['table']));const _0x4abd1c=_0x8b5d5c[_0x191657(0x276)]===_0x8b5d5c['foreignKey']?a22_0x2cd7a0[_0x191657(0x1b8)](_0x191657(0x11a))+'\x20'+_0x8b5d5c[_0x191657(0x276)]:a22_0x2cd7a0['dim']('Join:')+'\x20'+_0x8b5d5c[_0x191657(0x276)]+'\x20=\x20'+_0x8b5d5c['foreignKey'];console[_0x191657(0x26a)]('\x20\x20'+_0x4abd1c),console['error']('\x20\x20'+a22_0x2cd7a0['dim'](_0x191657(0x1d9))),this[_0x191657(0x132)](_0x8b5d5c[_0x191657(0x20e)]),!_0x8b5d5c[_0x191657(0x108)]&&console[_0x191657(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x191657(0x272)](_0x191657(0x203))+'\x20'+_0x8b5d5c['schemaError']);}}['displayBehaviorsStats'](_0x3f5c1b,_0x541272){const _0x4398e3=a22_0x567877;if(_0x3f5c1b[_0x4398e3(0x1d6)][_0x4398e3(0x131)]===0x0)return;console[_0x4398e3(0x26a)]('\x0a'+a22_0x2cd7a0[_0x4398e3(0x1b8)](_0x4398e3(0x214))+'\x20'+a22_0x2cd7a0[_0x4398e3(0x1b8)]('('+_0x541272+')'));for(const _0x134cee of _0x3f5c1b[_0x4398e3(0x1d6)]){const _0x5bf00e=_0x134cee[_0x4398e3(0x108)]?a22_0x2cd7a0['green']('✔'):a22_0x2cd7a0[_0x4398e3(0x272)]('✘');let _0x47ff87='';if(_0x134cee[_0x4398e3(0x108)]&&_0x134cee['customersWithEvents']!==undefined&&_0x134cee[_0x4398e3(0x193)]!==undefined){const _0x208036=_0x134cee[_0x4398e3(0x268)]?.[_0x4398e3(0x294)](0x1)||'?',_0x43ebb0=(_0x134cee[_0x4398e3(0x268)]??0x0)>=0x32?a22_0x2cd7a0[_0x4398e3(0x24e)]:(_0x134cee[_0x4398e3(0x268)]??0x0)>=0x14?a22_0x2cd7a0[_0x4398e3(0x27b)]:a22_0x2cd7a0['red'];_0x47ff87='\x20'+a22_0x2cd7a0['dim'](_0x4398e3(0x23c))+'\x20'+_0x43ebb0(formatRows(_0x134cee[_0x4398e3(0x26e)]))+'\x20('+_0x208036+_0x4398e3(0x14f)+a22_0x2cd7a0['dim'](_0x4398e3(0x244))+'\x20'+a22_0x2cd7a0['cyan'](formatRows(_0x134cee[_0x4398e3(0x193)]));}console[_0x4398e3(0x26a)](_0x5bf00e+'\x20'+a22_0x2cd7a0[_0x4398e3(0x1e7)](_0x134cee['name'])+_0x47ff87),console['error']('\x20\x20'+a22_0x2cd7a0[_0x4398e3(0x1b8)](_0x4398e3(0x249))+'\x20'+a22_0x2cd7a0[_0x4398e3(0x1e7)](_0x134cee[_0x4398e3(0x287)]+'.'+_0x134cee[_0x4398e3(0x269)]));const _0x18356a=_0x134cee[_0x4398e3(0x276)]===_0x134cee['foreignKey']?a22_0x2cd7a0['dim']('Join\x20on:')+'\x20'+_0x134cee[_0x4398e3(0x276)]:a22_0x2cd7a0[_0x4398e3(0x1b8)](_0x4398e3(0x1be))+'\x20'+_0x134cee[_0x4398e3(0x276)]+_0x4398e3(0x185)+_0x134cee[_0x4398e3(0x25c)];console[_0x4398e3(0x26a)]('\x20\x20'+_0x18356a),console[_0x4398e3(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4398e3(0x1b8)](_0x4398e3(0x1d9))),this[_0x4398e3(0x132)](_0x134cee[_0x4398e3(0x20e)]),!_0x134cee[_0x4398e3(0x108)]&&console[_0x4398e3(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x4398e3(0x272)](_0x4398e3(0x203))+'\x20'+_0x134cee[_0x4398e3(0x255)]);}}[a22_0x567877(0x132)](_0x262f8c){const _0x5e21ac=a22_0x567877;for(const _0x4fbe1d of _0x262f8c){_0x4fbe1d['label']===_0x4fbe1d['column']||_0x4fbe1d['column']==='*'?console['error'](_0x5e21ac(0x274)+_0x4fbe1d[_0x5e21ac(0x171)]):console[_0x5e21ac(0x26a)](_0x5e21ac(0x274)+_0x4fbe1d[_0x5e21ac(0x171)]+'\x20'+a22_0x2cd7a0['dim']('('+_0x4fbe1d[_0x5e21ac(0x19e)]+')'));}}['displaySummary'](_0x2f0a5f){const _0x13d334=a22_0x567877;console[_0x13d334(0x26a)]('─'[_0x13d334(0x23b)](0x3c));if(_0x2f0a5f['errors'][_0x13d334(0x131)]>0x0){console[_0x13d334(0x26a)]('\x0a'+a22_0x2cd7a0[_0x13d334(0x272)]('Errors:'));for(const _0x234c47 of _0x2f0a5f[_0x13d334(0x130)]){console[_0x13d334(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x13d334(0x272)]('•')+'\x20'+_0x234c47);}}_0x2f0a5f['allValid']&&console[_0x13d334(0x26a)]('\x0a'+a22_0x2cd7a0['green']('✔')+_0x13d334(0x297));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x12d);[a22_0x567877(0x1ee)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a22_0x567877(0x273)](_0x4eed91){const _0x56db31=a22_0x567877,{options:_0x150841,args:_0x2a5e96,tdx:_0x2f6784}=_0x4eed91,_0x2dca64=_0x150841,_0x1e76eb=_0x2a5e96[0x0]||_0x150841[_0x56db31(0x28b)];if(!_0x1e76eb)return showParentSegmentNotSetError(_0x56db31(0x195)+_0x56db31(0x112)+'Options\x20(one\x20required):\x0a'+_0x56db31(0x127)+_0x56db31(0x16c)+_0x56db31(0x242)+_0x56db31(0x167)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2dca64['master']&&!_0x2dca64[_0x56db31(0x23d)]&&!_0x2dca64['behavior']&&!_0x2dca64['enriched'])return console[_0x56db31(0x26a)](a22_0x2cd7a0[_0x56db31(0x272)](_0x56db31(0x22e))),console[_0x56db31(0x26a)](_0x56db31(0x16f)),console[_0x56db31(0x26a)](_0x56db31(0x1dc)),console['error'](_0x56db31(0x196)),console[_0x56db31(0x26a)](_0x56db31(0x190)),console[_0x56db31(0x26a)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x56db31(0x26a)](_0x56db31(0x135)),0x1;const _0x3be54d=resolveYamlFile(_0x1e76eb);if(!existsSync(_0x3be54d))return showFileNotFoundError(_0x3be54d,_0x1e76eb),0x1;_0x2dca64[_0x56db31(0x16b)]&&(console[_0x56db31(0x26a)](_0x56db31(0x115)+_0x2dca64[_0x56db31(0x140)]),console['error'](_0x56db31(0x138)+_0x3be54d));let _0x25635d;try{_0x25635d=readFileSync(_0x3be54d,_0x56db31(0x18e));}catch(_0x43c6b9){const _0x477a24=_0x43c6b9 instanceof Error?_0x43c6b9['message']:String(_0x43c6b9);return console[_0x56db31(0x26a)](_0x56db31(0x266)+_0x477a24),0x1;}let _0x8ca04c;try{_0x8ca04c=parseDef(_0x25635d);}catch(_0x1d7f8b){const _0x250d99=_0x1d7f8b instanceof Error?_0x1d7f8b[_0x56db31(0x209)]:String(_0x1d7f8b);return console[_0x56db31(0x26a)](a22_0x2cd7a0[_0x56db31(0x272)](_0x56db31(0x271)+_0x250d99)),0x1;}if(_0x2dca64[_0x56db31(0x23d)]===!![]||_0x2dca64[_0x56db31(0x23d)]===''){const _0x456477=_0x8ca04c[_0x56db31(0x156)]?.['map'](_0x12edde=>_0x12edde['name'])||[];if(_0x456477[_0x56db31(0x131)]===0x0)console[_0x56db31(0x26a)](a22_0x2cd7a0[_0x56db31(0x272)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x56db31(0x26a)](a22_0x2cd7a0[_0x56db31(0x272)](_0x56db31(0x1f8))),console['error'](_0x56db31(0x257));for(const _0x46b7c8 of _0x456477){console[_0x56db31(0x26a)]('\x20\x20'+a22_0x2cd7a0['cyan'](_0x46b7c8));}console['error'](_0x56db31(0x22b)+_0x1e76eb+'\x20--attribute\x20\x22'+_0x456477[0x0]+'\x22');}return 0x1;}if(_0x2dca64[_0x56db31(0x21b)]===!![]||_0x2dca64[_0x56db31(0x21b)]===''){const _0xcaeeaf=_0x8ca04c[_0x56db31(0x1d6)]?.['map'](_0xc8f23=>_0xc8f23[_0x56db31(0x1ca)])||[];if(_0xcaeeaf['length']===0x0)console['error'](a22_0x2cd7a0[_0x56db31(0x272)](_0x56db31(0x1bb)));else{console['error'](a22_0x2cd7a0[_0x56db31(0x272)](_0x56db31(0x210))),console['error'](_0x56db31(0x291));for(const _0x42adbe of _0xcaeeaf){console[_0x56db31(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x56db31(0x146)](_0x42adbe));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x1e76eb+'\x20--behavior\x20\x22'+_0xcaeeaf[0x0]+'\x22');}return 0x1;}const _0x3c274b=createCommandSpinner(a22_0x2cd7a0[_0x56db31(0x1b8)](_0x56db31(0x1c1)),{'verbose':_0x2dca64['verbose']});_0x3c274b[_0x56db31(0x1ad)]();const _0x9bd89f={'onProgress':_0x2647b6=>{_0x3c274b['text']=formatProgressMessage(_0x2647b6);}};if(_0x2dca64[_0x56db31(0x229)])_0x9bd89f[_0x56db31(0x229)]=!![];if(_0x2dca64[_0x56db31(0x23d)]&&typeof _0x2dca64[_0x56db31(0x23d)]===_0x56db31(0x149))_0x9bd89f[_0x56db31(0x23d)]=_0x2dca64[_0x56db31(0x23d)];if(_0x2dca64['behavior']&&typeof _0x2dca64[_0x56db31(0x21b)]==='string')_0x9bd89f[_0x56db31(0x21b)]=_0x2dca64[_0x56db31(0x21b)];if(_0x2dca64[_0x56db31(0x281)])_0x9bd89f['enriched']=!![];if(_0x2dca64[_0x56db31(0x11b)])_0x9bd89f[_0x56db31(0x11b)]=_0x2dca64[_0x56db31(0x11b)];let _0x8ccef;try{_0x8ccef=await _0x2f6784[_0x56db31(0x1e4)][_0x56db31(0x1da)](_0x25635d,_0x9bd89f),_0x3c274b['stop']();}catch(_0x2de723){_0x3c274b[_0x56db31(0x285)]();throw _0x2de723;}return await this[_0x56db31(0x19b)](_0x8ccef,{'master':_0x2dca64[_0x56db31(0x229)],'attribute':typeof _0x2dca64['attribute']===_0x56db31(0x149)?_0x2dca64['attribute']:undefined,'behavior':typeof _0x2dca64[_0x56db31(0x21b)]===_0x56db31(0x149)?_0x2dca64[_0x56db31(0x21b)]:undefined,'enriched':_0x2dca64[_0x56db31(0x281)]}),_0x8ccef[_0x56db31(0x284)]?0x0:0x1;}async['displayPreviewResults'](_0x17852f,_0x1079ee){const _0x171cca=a22_0x567877;console['error']('\x0a'+a22_0x2cd7a0[_0x171cca(0x1e7)]('Preview:')+'\x20'+_0x17852f[_0x171cca(0x1ca)]),console[_0x171cca(0x26a)]('═'['repeat'](0x3c));if(_0x1079ee['master']&&_0x17852f['sampleData']){const _0x4b2586=a22_0x2cd7a0[_0x171cca(0x1b8)](_0x171cca(0x15a))+'\x20'+a22_0x2cd7a0['bold'](_0x17852f[_0x171cca(0x229)][_0x171cca(0x287)]+'.'+_0x17852f['master']['table']);await this[_0x171cca(0x1b1)](_0x4b2586,_0x17852f[_0x171cca(0x231)]);}else{if(_0x1079ee[_0x171cca(0x23d)]&&_0x17852f['sampleData']){const _0x22d0da=a22_0x2cd7a0[_0x171cca(0x1b8)]('Attribute:')+'\x20'+a22_0x2cd7a0[_0x171cca(0x1e7)](_0x1079ee[_0x171cca(0x23d)]);await this['displaySampleData'](_0x22d0da,_0x17852f[_0x171cca(0x231)]);}else{if(_0x1079ee[_0x171cca(0x21b)]&&_0x17852f[_0x171cca(0x231)]){const _0x556698=a22_0x2cd7a0['dim'](_0x171cca(0x129))+'\x20'+a22_0x2cd7a0[_0x171cca(0x1e7)](_0x1079ee[_0x171cca(0x21b)]);await this[_0x171cca(0x1b1)](_0x556698,_0x17852f['sampleData']);}else{if(_0x1079ee[_0x171cca(0x281)]&&_0x17852f[_0x171cca(0x231)]){const _0xa4607f=a22_0x2cd7a0[_0x171cca(0x1b8)](_0x171cca(0x20b))+'\x20'+a22_0x2cd7a0[_0x171cca(0x1e7)]('Master\x20+\x20Attributes');await this[_0x171cca(0x1b1)](_0xa4607f,_0x17852f[_0x171cca(0x231)]);}else!_0x17852f[_0x171cca(0x231)]&&console['error'](_0x171cca(0x1a5));}}}if(_0x17852f[_0x171cca(0x130)][_0x171cca(0x131)]>0x0){console[_0x171cca(0x26a)]('─'[_0x171cca(0x23b)](0x3c)),console[_0x171cca(0x26a)]('\x0a'+a22_0x2cd7a0[_0x171cca(0x272)](_0x171cca(0x113)));for(const _0x416ef4 of _0x17852f[_0x171cca(0x130)]){console[_0x171cca(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0x171cca(0x272)]('•')+'\x20'+_0x416ef4);}}}async[a22_0x567877(0x1b1)](_0x7a6821,_0x1a45c3){const _0x44960e=a22_0x567877;if(_0x1a45c3[_0x44960e(0x131)]===0x0){console[_0x44960e(0x26a)]('\x0a'+_0x7a6821),console[_0x44960e(0x26a)](_0x44960e(0x1e3));return;}console[_0x44960e(0x26a)]('\x0a'+_0x7a6821);const _0x41c219=Object['keys'](_0x1a45c3[0x0])[_0x44960e(0x13b)](_0x5eddaf=>({'name':_0x5eddaf,'type':typeof _0x1a45c3[0x0][_0x5eddaf]==='number'?_0x44960e(0x186):_0x44960e(0x1eb)})),_0x4d8bc4={'queryId':_0x44960e(0x292),'columns':_0x41c219,'data':_0x1a45c3,'stats':{'state':_0x44960e(0x215),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1a45c3[_0x44960e(0x131)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x25866f=formatAsTable(_0x4d8bc4,_0x1a45c3[_0x44960e(0x131)],!![]);await writeOutput(_0x25866f,undefined,_0x44960e(0x269));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x20d);['description']=a22_0x567877(0x25f);async[a22_0x567877(0x273)](_0x16d12c){const _0xf78656=a22_0x567877,{options:_0x79ca57,args:_0x3ae1e6,tdx:_0x4f44de}=_0x16d12c,_0x2422f3=_0x79ca57,_0x30b124=_0x3ae1e6[0x0]||_0x79ca57[_0xf78656(0x28b)];if(!_0x30b124)return showParentSegmentNotSetError(_0xf78656(0x170)+_0xf78656(0x290)),0x1;const _0x24d611=resolveYamlFile(_0x30b124);if(existsSync(_0x24d611)){_0x2422f3[_0xf78656(0x16b)]&&console[_0xf78656(0x26a)](_0xf78656(0x15b)+_0x24d611);let _0x24c9d7;try{_0x24c9d7=readFileSync(_0x24d611,_0xf78656(0x18e));}catch(_0x34731e){const _0x21f5b1=_0x34731e instanceof Error?_0x34731e[_0xf78656(0x209)]:String(_0x34731e);return console[_0xf78656(0x26a)](_0xf78656(0x266)+_0x21f5b1),0x1;}const _0x36a422=await withSpinner('Analyzing\x20changes...',()=>_0x4f44de[_0xf78656(0x1e4)][_0xf78656(0x194)](_0x24c9d7),{'verbose':_0x2422f3[_0xf78656(0x16b)]}),_0x232267=_0x36a422[_0xf78656(0x118)],{isNew:_0x353bb3,name:_0xd4cb41,hasChanges:_0x2b239e,diffFormatted:_0x2608a7}=_0x232267;if(_0x2b239e){_0x353bb3?console[_0xf78656(0x26a)](_0xf78656(0x20a)+_0xd4cb41+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xd4cb41+'\x27:');console[_0xf78656(0x26a)]('─'[_0xf78656(0x23b)](0x3c)),console['error'](_0x2608a7),console[_0xf78656(0x26a)]('─'[_0xf78656(0x23b)](0x3c));const _0x3b57be=_0x353bb3?_0xf78656(0x1e1)+_0xd4cb41+_0xf78656(0x233):'Apply\x20changes\x20to\x20\x27'+_0xd4cb41+_0xf78656(0x233);if(!_0x2422f3[_0xf78656(0x11e)]){if(!isInteractive())return console['error'](a22_0x2cd7a0[_0xf78656(0x272)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0xf78656(0x26a)](a22_0x2cd7a0[_0xf78656(0x1b8)](_0xf78656(0x17b))),0x1;const _0xde0ff5=await confirmKey(_0x3b57be);if(!_0xde0ff5)return console[_0xf78656(0x26a)](a22_0x2cd7a0[_0xf78656(0x27b)](_0xf78656(0x1f6))),0x1;}const _0x439bc4=_0x353bb3?_0xf78656(0x205):_0xf78656(0x24c);await withSpinner(_0x439bc4+_0xf78656(0x17c)+_0xd4cb41+'\x27...',()=>_0x232267[_0xf78656(0x12b)](),{'verbose':_0x2422f3[_0xf78656(0x16b)]});const _0x505278=_0x353bb3?_0xf78656(0x1fa):_0xf78656(0x234);console[_0xf78656(0x26a)]('✔\x20'+_0x505278+_0xf78656(0x17c)+_0xd4cb41+'\x27');}else console[_0xf78656(0x26a)](_0xf78656(0x179)+_0xd4cb41+_0xf78656(0x24b));}const _0x21760f=await withSpinner(_0xf78656(0x264)+_0x30b124+_0xf78656(0x10c),()=>_0x4f44de[_0xf78656(0x1e4)][_0xf78656(0x124)](_0x30b124),{'verbose':_0x2422f3[_0xf78656(0x16b)]}),_0x7e60d4=_0x21760f[_0xf78656(0x118)],_0x47a6db=getConsoleUrl(_0x2422f3[_0xf78656(0x140)],_0xf78656(0x111)+_0x7e60d4[_0xf78656(0x1c0)]+_0xf78656(0x29c)+_0x7e60d4[_0xf78656(0x1c5)]+_0xf78656(0x1d3)+_0x7e60d4['workflowAttemptId']);return console[_0xf78656(0x26a)](_0xf78656(0x263)),console[_0xf78656(0x26a)]('\x20\x20'+a22_0x2cd7a0[_0xf78656(0x1b8)](_0xf78656(0x1f7))+'\x20'+_0x7e60d4[_0xf78656(0x247)]),console['error']('\x20\x20'+a22_0x2cd7a0[_0xf78656(0x1b8)]('Status:')+'\x20'+_0x7e60d4[_0xf78656(0x226)]),console[_0xf78656(0x26a)]('\x20\x20'+a22_0x2cd7a0['dim'](_0xf78656(0x155))+'\x20'+_0x7e60d4[_0xf78656(0x1c5)]),console['error']('\x20\x20'+a22_0x2cd7a0[_0xf78656(0x1b8)]('Attempt:')+'\x20'+_0x7e60d4[_0xf78656(0x158)]),console[_0xf78656(0x26a)]('\x20\x20'+_0x47a6db),console[_0xf78656(0x26a)]('\x0a'+a22_0x2cd7a0[_0xf78656(0x1b8)](_0xf78656(0x259))+_0xf78656(0x1a2)+_0x7e60d4[_0xf78656(0x158)]+_0xf78656(0x1d2)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';['description']=a22_0x567877(0x152);async['execute'](_0x23b0d1){const _0x3562c5=a22_0x567877,{options:_0x56f412,args:_0x211c5b,tdx:_0x68d9a0}=_0x23b0d1,_0x427ab9=_0x211c5b[0x0]||_0x56f412[_0x3562c5(0x28b)];if(!_0x427ab9)return showParentSegmentNotSetError(_0x3562c5(0x192)+_0x3562c5(0x218)),0x1;_0x56f412['verbose']&&(console['error'](_0x3562c5(0x115)+_0x56f412[_0x3562c5(0x140)]),console[_0x3562c5(0x26a)]('Parent\x20segment:\x20'+_0x427ab9));const _0x1a30f5=await withSpinner(_0x3562c5(0x198)+_0x427ab9+_0x3562c5(0x10c),()=>_0x68d9a0[_0x3562c5(0x1e4)][_0x3562c5(0x16a)](_0x427ab9),{'verbose':_0x56f412[_0x3562c5(0x16b)]}),_0x1d85c5=_0x1a30f5['data'];console[_0x3562c5(0x26a)]('✔\x20Found\x20'+_0x1d85c5[_0x3562c5(0x131)]+_0x3562c5(0x18c)+(_0x1d85c5['length']!==0x1?'s':''));if(_0x56f412[_0x3562c5(0x202)]||_0x56f412['jsonl'])return await handleSDKOutput(_0x1d85c5,_0x56f412),0x0;return displayFieldsHumanReadable(_0x1d85c5,_0x427ab9),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x14c);[a22_0x567877(0x1ee)]='Show\x20parent\x20segment\x20details';async[a22_0x567877(0x273)](_0x1185ec){const _0x39df4b=a22_0x567877,{options:_0x5704f1,args:_0x104919,tdx:_0x56f0f8}=_0x1185ec,_0x36b0c7=_0x5704f1,_0x2f483a=_0x104919[0x0]||_0x5704f1[_0x39df4b(0x28b)];if(!_0x2f483a)return showParentSegmentNotSetError(_0x39df4b(0x139)+_0x39df4b(0x1f5)+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x5704f1['verbose']&&(console['error'](_0x39df4b(0x115)+_0x5704f1['site']),console[_0x39df4b(0x26a)](_0x39df4b(0x1cc)+_0x2f483a));const _0x1501bd=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x2f483a+'\x27...',()=>_0x56f0f8[_0x39df4b(0x1e4)][_0x39df4b(0x10b)](_0x2f483a),{'verbose':_0x5704f1[_0x39df4b(0x16b)]}),_0x3ef23b=_0x1501bd['data'];if(_0x36b0c7[_0x39df4b(0x177)]){const _0x131ac7=getConsoleNextUrl(_0x36b0c7[_0x39df4b(0x140)],_0x39df4b(0x18b)+_0x3ef23b['id']);return console[_0x39df4b(0x26a)](a22_0x2cd7a0[_0x39df4b(0x24e)]('✔')+_0x39df4b(0x219)+a22_0x2cd7a0[_0x39df4b(0x146)](_0x131ac7)),openBrowser(_0x131ac7),0x0;}return await handleSingleObjectOutput(_0x3ef23b,_0x5704f1),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x567877(0x1ca)]='segment:parent:desc';['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a22_0x567877(0x273)](_0x143e39){const _0x48348d=a22_0x567877,{options:_0x534e20,args:_0x45c604,tdx:_0x213b10}=_0x143e39,_0x3225c4=_0x534e20,_0x39b2a4=_0x45c604[0x0]||_0x534e20['parentSegment'];if(!_0x39b2a4)return showParentSegmentNotSetError(_0x48348d(0x119)+_0x48348d(0x251)+_0x48348d(0x16d)+_0x48348d(0x253)),0x1;_0x534e20[_0x48348d(0x16b)]&&(console[_0x48348d(0x26a)](_0x48348d(0x115)+_0x534e20['site']),console[_0x48348d(0x26a)](_0x48348d(0x1cc)+_0x39b2a4));const _0x1e6e33=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x39b2a4+'\x27...',()=>_0x213b10[_0x48348d(0x1e4)]['resolveParentId'](_0x39b2a4),{'verbose':_0x534e20[_0x48348d(0x16b)]}),_0x5e77fe=_0x1e6e33[_0x48348d(0x118)],_0x551902=_0x213b10[_0x48348d(0x1e4)][_0x48348d(0x296)](_0x5e77fe);if(_0x3225c4['output']){const _0x239729=await this['collectSchema'](_0x143e39,_0x39b2a4,_0x5e77fe,_0x551902),_0x223704=this['formatSchemaJson'](_0x239729);writeFileSync(_0x3225c4[_0x48348d(0x180)],_0x223704);const _0x17ee04=_0x239729[_0x48348d(0x1ae)][_0x48348d(0x20e)]['length']+_0x239729[_0x48348d(0x1d6)][_0x48348d(0x1dd)]((_0x65c9de,_0x473a79)=>_0x65c9de+_0x473a79[_0x48348d(0x20e)]['length'],0x0),_0x5a23e7=_0x239729[_0x48348d(0x1d6)]['filter'](_0x99900b=>_0x99900b[_0x48348d(0x20e)][_0x48348d(0x131)]===0x0)[_0x48348d(0x131)];return console[_0x48348d(0x13d)](_0x48348d(0x246)+_0x3225c4[_0x48348d(0x180)]),console[_0x48348d(0x13d)](_0x48348d(0x207)+_0x551902),console[_0x48348d(0x13d)](_0x48348d(0x14a)+_0x239729[_0x48348d(0x1d6)]['length']+_0x48348d(0x1ba)),console[_0x48348d(0x13d)](_0x48348d(0x282)+_0x17ee04+_0x48348d(0x27f)),_0x5a23e7>0x0&&console['log']('\x20\x20Note:\x20'+_0x5a23e7+_0x48348d(0x144)),0x0;}console[_0x48348d(0x26a)]('\x0a'+a22_0x2cd7a0[_0x48348d(0x1e7)](_0x48348d(0x1c2))+'\x20'+a22_0x2cd7a0[_0x48348d(0x146)](_0x551902));const _0x4b7451=await withSpinner(_0x48348d(0x15c),()=>_0x213b10['segment'][_0x48348d(0x22a)](_0x5e77fe),{'verbose':_0x534e20['verbose']});console[_0x48348d(0x26a)]('\x0a'+a22_0x2cd7a0[_0x48348d(0x1e7)]('customers')+'\x20'+a22_0x2cd7a0[_0x48348d(0x1b8)]('('+_0x551902+_0x48348d(0x1f3)));const _0x12e4ac=await executeSchemaQuery(_0x4b7451['data'],_0x213b10,_0x534e20);await handleQueryOutput(_0x12e4ac,_0x534e20);const _0x448a10=await withSpinner(_0x48348d(0x1c4),()=>_0x213b10['segment'][_0x48348d(0x11c)](_0x5e77fe),{'verbose':_0x534e20[_0x48348d(0x16b)]});for(const _0x5fc30b of _0x448a10[_0x48348d(0x118)]){const _0x4aec5d=_0x48348d(0x27d)+_0x5fc30b[_0x48348d(0x28e)]()[_0x48348d(0x1db)](/\s+/g,'_'),_0x5dafa2=_0x48348d(0x10d)+_0x551902+'.'+_0x4aec5d;console[_0x48348d(0x26a)]('\x0a'+a22_0x2cd7a0['bold'](_0x5fc30b)+'\x20'+a22_0x2cd7a0[_0x48348d(0x1b8)]('('+_0x551902+'.'+_0x4aec5d+')'));try{const _0x3b1431=await executeSchemaQuery(_0x5dafa2,_0x213b10,_0x534e20);await handleQueryOutput(_0x3b1431,_0x534e20);}catch{console[_0x48348d(0x26a)](a22_0x2cd7a0[_0x48348d(0x27b)](_0x48348d(0x19a)));}}return 0x0;}async[a22_0x567877(0x133)](_0x66686c,_0x229e25,_0x374660,_0x2622dc){const _0x5f2323=a22_0x567877,{options:_0x64bcb6,tdx:_0x55c478}=_0x66686c,_0x229947=await withSpinner(_0x5f2323(0x15c),()=>_0x55c478['segment'][_0x5f2323(0x22a)](_0x374660),{'verbose':_0x64bcb6[_0x5f2323(0x16b)]}),_0x4dad07=await executeSchemaQuery(_0x229947[_0x5f2323(0x118)],_0x55c478,_0x64bcb6),_0x200a75=_0x4dad07[_0x5f2323(0x118)][_0x5f2323(0x13b)](_0x1dcbd5=>({'name':_0x1dcbd5[_0x5f2323(0x197)],'type':_0x1dcbd5[_0x5f2323(0x17a)]})),_0x4f7eab=await withSpinner(_0x5f2323(0x1c4),()=>_0x55c478[_0x5f2323(0x1e4)][_0x5f2323(0x11c)](_0x374660),{'verbose':_0x64bcb6[_0x5f2323(0x16b)]}),_0x2ab1d2=[];for(const _0x28d467 of _0x4f7eab['data']){const _0x1427c2=_0x5f2323(0x27d)+_0x28d467[_0x5f2323(0x28e)]()['replace'](/\s+/g,'_'),_0xd80a4='SELECT\x20*\x20FROM\x20'+_0x2622dc+'.'+_0x1427c2;let _0x5ea91d=[];try{const _0x568f2a=await executeSchemaQuery(_0xd80a4,_0x55c478,_0x64bcb6);_0x5ea91d=_0x568f2a[_0x5f2323(0x118)][_0x5f2323(0x13b)](_0x29b7a3=>({'name':_0x29b7a3[_0x5f2323(0x197)],'type':_0x29b7a3[_0x5f2323(0x17a)]}));}catch{}_0x2ab1d2['push']({'table':_0x1427c2,'columns':_0x5ea91d});}return{'database':_0x2622dc,'parent_segment':_0x229e25,'parent_id':_0x374660,'customers':{'table':_0x5f2323(0x1ae),'columns':_0x200a75},'behaviors':_0x2ab1d2};}[a22_0x567877(0x10a)](_0x433967){const _0x4559f2=a22_0x567877,_0x1b2372=_0x4e84af=>{const _0x3b3048=a22_0x19ff;if(_0x4e84af[_0x3b3048(0x131)]===0x0)return'[]';const _0x41cfcb=_0x4e84af[_0x3b3048(0x13b)](_0x533168=>_0x3b3048(0x1aa)+_0x533168[_0x3b3048(0x1ca)]+_0x3b3048(0x163)+_0x533168[_0x3b3048(0x220)]+_0x3b3048(0x1fe));return'[\x0a'+_0x41cfcb['join'](',\x0a')+_0x3b3048(0x2a0);},_0x31ce0c=_0x433967[_0x4559f2(0x1d6)][_0x4559f2(0x13b)](_0x23fceb=>{const _0x425f85=_0x4559f2;return _0x425f85(0x1e6)+_0x23fceb[_0x425f85(0x269)]+_0x425f85(0x1c9)+_0x1b2372(_0x23fceb['columns'])['replace'](/^/gm,'\x20\x20')[_0x425f85(0x236)]()+_0x425f85(0x1c3);})['join'](',\x0a');return _0x4559f2(0x20f)+_0x433967['database']+_0x4559f2(0x25e)+_0x433967[_0x4559f2(0x159)]+_0x4559f2(0x1f1)+_0x433967[_0x4559f2(0x1c6)]+_0x4559f2(0x27a)+_0x433967['customers'][_0x4559f2(0x269)]+_0x4559f2(0x262)+_0x1b2372(_0x433967[_0x4559f2(0x1ae)]['columns'])[_0x4559f2(0x1db)](/^/gm,'\x20\x20')['trim']()+_0x4559f2(0x258)+_0x31ce0c+_0x4559f2(0x1b6);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x567877(0x1ca)]='segment:parent:sql';[a22_0x567877(0x1ee)]=a22_0x567877(0x252);async['execute'](_0x394a4c){const _0x5df9be=a22_0x567877,{options:_0x3110fb,args:_0x332274,tdx:_0x583302}=_0x394a4c,_0x4d2c57=_0x332274[0x0]||_0x3110fb[_0x5df9be(0x28b)];if(!_0x4d2c57)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'+_0x5df9be(0x288)),0x1;_0x3110fb['verbose']&&(console[_0x5df9be(0x26a)](_0x5df9be(0x115)+_0x3110fb[_0x5df9be(0x140)]),console['error'](_0x5df9be(0x1cc)+_0x4d2c57));const _0x4ccc23=await withSpinner(_0x5df9be(0x227)+_0x4d2c57+_0x5df9be(0x10c),()=>_0x583302[_0x5df9be(0x1e4)][_0x5df9be(0x151)](_0x4d2c57),{'verbose':_0x3110fb['verbose']}),_0x1a9908=_0x4ccc23[_0x5df9be(0x118)],_0x399917=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4d2c57+_0x5df9be(0x10c),()=>_0x583302[_0x5df9be(0x1e4)]['getParentSQL'](_0x1a9908),{'verbose':_0x3110fb['verbose']}),_0x3961f7=_0x399917[_0x5df9be(0x118)];return _0x3110fb[_0x5df9be(0x199)]===_0x5df9be(0x202)||_0x3110fb[_0x5df9be(0x199)]===_0x5df9be(0x1a0)?await handleSDKOutput([{'sql':_0x3961f7}],_0x3110fb):console[_0x5df9be(0x13d)](_0x3961f7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a22_0x567877(0x238);[a22_0x567877(0x1ee)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a22_0x567877(0x273)](_0x5b0aa5){const _0xd9aab4=a22_0x567877,{options:_0x1b1fac,args:_0x58bcc6,tdx:_0x504107}=_0x5b0aa5,_0x60cba1=_0x58bcc6[0x0]||_0x1b1fac[_0xd9aab4(0x28b)];if(!_0x60cba1)return showParentSegmentNotSetError(_0xd9aab4(0x1b0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x1b1fac['verbose']&&(console[_0xd9aab4(0x26a)](_0xd9aab4(0x115)+_0x1b1fac['site']),console[_0xd9aab4(0x26a)]('Parent\x20segment:\x20'+_0x60cba1));const _0x267569=await withSpinner(_0xd9aab4(0x227)+_0x60cba1+_0xd9aab4(0x10c),()=>_0x504107[_0xd9aab4(0x1e4)][_0xd9aab4(0x151)](_0x60cba1),{'verbose':_0x1b1fac['verbose']}),_0x208986=_0x267569['data'],_0x3a87e9=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x60cba1+_0xd9aab4(0x10c),()=>_0x504107[_0xd9aab4(0x1e4)]['getParentSQL'](_0x208986),{'verbose':_0x1b1fac[_0xd9aab4(0x16b)]});let _0x18c243=_0x3a87e9[_0xd9aab4(0x118)];const _0x52b6eb=resolveLimit(_0x1b1fac[_0xd9aab4(0x217)],DEFAULT_DISPLAY_LIMIT),_0x225a60=/\bLIMIT\s+\d+/i[_0xd9aab4(0x213)](_0x18c243);!_0x225a60&&(_0x18c243=_0x18c243[_0xd9aab4(0x236)]()[_0xd9aab4(0x1db)](/;+$/,''),_0x18c243='SELECT\x20*\x20FROM\x20(\x0a'+_0x18c243+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x52b6eb);_0x1b1fac[_0xd9aab4(0x16b)]&&console['error'](_0xd9aab4(0x1ce)+_0x18c243);const _0x527d9a=await withProgressSpinner(_0xd9aab4(0x1fb),async _0x552f84=>{const _0x5b3c53=_0xd9aab4,_0x4f173f=await _0x504107[_0x5b3c53(0x183)]['execute'](_0x18c243,{'catalog':'td','schema':_0x5b3c53(0x121),'onJobId':_0x2b355d=>{const _0x31519f=_0x5b3c53;_0x552f84[_0x31519f(0x23e)](_0x2b355d);}});return _0x4f173f;},{'verbose':_0x1b1fac[_0xd9aab4(0x16b)]}),_0x387778=_0x527d9a[_0xd9aab4(0x118)],_0x1fd871=_0x387778[_0xd9aab4(0x26f)]?_0xd9aab4(0x166)+_0x387778[_0xd9aab4(0x26f)]+']':'';return console[_0xd9aab4(0x26a)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x387778[_0xd9aab4(0x19c)][_0xd9aab4(0x125)][_0xd9aab4(0x1ec)]()+'\x20rows\x20'+(_0xd9aab4(0x1f9)+formatElapsed(_0x387778[_0xd9aab4(0x19c)][_0xd9aab4(0x150)])+_0x1fd871)),await handleQueryOutput(_0x387778,_0x1b1fac),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a22_0x567877(0x13c);[a22_0x567877(0x1ee)]=a22_0x567877(0x172);async[a22_0x567877(0x273)](_0x4ba775){const _0x57bab5=a22_0x567877,{options:_0x222d98,args:_0x121bad,tdx:_0x5255ba}=_0x4ba775,_0x5a3ffd=_0x121bad[0x0],_0x4b5b82=await withSpinner(_0x5a3ffd?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x5a3ffd+_0x57bab5(0x10c):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x5255ba['realtime'][_0x57bab5(0x248)](),{'verbose':_0x222d98[_0x57bab5(0x16b)]});let _0x410dcf=_0x4b5b82[_0x57bab5(0x118)]['filter'](_0x224cbc=>_0x224cbc['realtime_enabled']);if(_0x5a3ffd){const _0x49ab82=_0x5a3ffd[_0x57bab5(0x1db)](/[.+^${}()|[\]\\]/g,_0x57bab5(0x174))['replace'](/\*/g,'.*')[_0x57bab5(0x1db)](/\?/g,'.'),_0x33509d=new RegExp('^'+_0x49ab82+'$','i');_0x410dcf=_0x410dcf[_0x57bab5(0x298)](_0x26b931=>_0x33509d['test'](_0x26b931[_0x57bab5(0x1ca)]));}_0x410dcf[_0x57bab5(0x16e)]((_0x4c07fc,_0x52b542)=>_0x4c07fc[_0x57bab5(0x1ca)][_0x57bab5(0x122)](_0x52b542[_0x57bab5(0x1ca)])),console[_0x57bab5(0x26a)]('✔\x20Found\x20'+_0x410dcf[_0x57bab5(0x131)]+_0x57bab5(0x24f)+(_0x410dcf[_0x57bab5(0x131)]!==0x1?'s':''));const _0x3bde61=_0x517959=>{const _0x361b99=_0x57bab5;return getConsoleNextUrl(_0x222d98[_0x361b99(0x140)],_0x361b99(0x18b)+_0x517959);};if(_0x222d98[_0x57bab5(0x199)]===_0x57bab5(0x202)||_0x222d98[_0x57bab5(0x199)]===_0x57bab5(0x1a0)){const _0x513c4f=_0x410dcf[_0x57bab5(0x13b)](_0x1a923a=>({..._0x1a923a,'url':_0x3bde61(_0x1a923a['id'])}));await handleSDKOutput(_0x513c4f,_0x222d98);}else{if(_0x410dcf[_0x57bab5(0x131)]===0x0)console[_0x57bab5(0x13d)](_0x57bab5(0x19f));else for(const _0x4b4552 of _0x410dcf){const _0x2b3919=_0x4b4552[_0x57bab5(0x201)]?a22_0x2cd7a0[_0x57bab5(0x1b8)]('\x20('+formatRows(_0x4b4552[_0x57bab5(0x201)])+')'):'',_0x2382d1=hyperlink(_0x4b4552[_0x57bab5(0x1ca)],_0x3bde61(_0x4b4552['id']));console[_0x57bab5(0x13d)]('⚡\x20'+_0x2382d1+_0x2b3919);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x230);[a22_0x567877(0x1ee)]=a22_0x567877(0x13f);async[a22_0x567877(0x273)](_0x44fdeb){const _0x51a3dd=a22_0x567877,{options:_0x4aa8c7,args:_0x238319,tdx:_0x58c5c6}=_0x44fdeb,_0x427da1=_0x238319[0x0]||_0x4aa8c7[_0x51a3dd(0x28b)];if(!_0x427da1)return showParentSegmentNotSetError('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'+_0x51a3dd(0x265)),0x1;const _0x49019d=resolveYamlFile(_0x427da1);if(!existsSync(_0x49019d))return showFileNotFoundError(_0x49019d,_0x427da1),0x1;let _0x554600;try{_0x554600=readFileSync(_0x49019d,_0x51a3dd(0x18e));}catch(_0xf882c8){const _0x3890cb=_0xf882c8 instanceof Error?_0xf882c8[_0x51a3dd(0x209)]:String(_0xf882c8);return console['error'](_0x51a3dd(0x266)+_0x3890cb),0x1;}const _0x2b09e5=createCommandSpinner(a22_0x2cd7a0['dim'](_0x51a3dd(0x1f4)),{'verbose':_0x4aa8c7[_0x51a3dd(0x16b)]});_0x2b09e5[_0x51a3dd(0x1ad)]();const _0x438729={'realtime':!![],'onProgress':_0x1ec73c=>{_0x2b09e5['text']=formatProgressMessage(_0x1ec73c);}};let _0x400954;try{_0x400954=await _0x58c5c6['segment'][_0x51a3dd(0x191)](_0x554600,_0x438729),_0x2b09e5[_0x51a3dd(0x285)]();}catch(_0x3e9230){_0x2b09e5[_0x51a3dd(0x285)]();throw _0x3e9230;}console['error']('\x0a'+a22_0x2cd7a0[_0x51a3dd(0x1e7)](_0x51a3dd(0x267))+'\x20'+_0x400954[_0x51a3dd(0x1ca)]),console[_0x51a3dd(0x26a)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x400954),console[_0x51a3dd(0x26a)]('─'[_0x51a3dd(0x23b)](0x3c));if(_0x400954[_0x51a3dd(0x130)][_0x51a3dd(0x131)]>0x0){console[_0x51a3dd(0x26a)]('\x0a'+a22_0x2cd7a0[_0x51a3dd(0x272)](_0x51a3dd(0x113)));for(const _0x3e39ac of _0x400954[_0x51a3dd(0x130)]){console['error']('\x20\x20'+a22_0x2cd7a0[_0x51a3dd(0x272)]('•')+'\x20'+_0x3e39ac);}}return _0x400954[_0x51a3dd(0x284)]&&console[_0x51a3dd(0x26a)]('\x0a'+a22_0x2cd7a0[_0x51a3dd(0x24e)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x400954['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a22_0x567877(0x23a);[a22_0x567877(0x1ee)]=a22_0x567877(0x280);async[a22_0x567877(0x273)](_0x565ded){const _0x16c04e=a22_0x567877,{options:_0x5bd4b8,args:_0xf1a6c7,tdx:_0x49aac2}=_0x565ded,_0xb563b1=_0xf1a6c7[0x0]||_0x5bd4b8[_0x16c04e(0x28b)];if(!_0xb563b1)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'+_0x16c04e(0x299)),0x1;const _0x9019d8=await withSpinner(_0x16c04e(0x227)+_0xb563b1+'\x27...',()=>_0x49aac2[_0x16c04e(0x1e4)][_0x16c04e(0x151)](_0xb563b1),{'verbose':_0x5bd4b8[_0x16c04e(0x16b)]}),_0x55d097=_0x9019d8[_0x16c04e(0x118)],_0x4e6214=await withSpinner(_0x16c04e(0x12c)+_0xb563b1+'\x27...',()=>_0x49aac2['personalization']['list'](_0x55d097),{'verbose':_0x5bd4b8[_0x16c04e(0x16b)]}),_0x383551=_0x4e6214[_0x16c04e(0x118)];console[_0x16c04e(0x26a)](_0x16c04e(0x1d1)+_0x383551[_0x16c04e(0x131)]+_0x16c04e(0x168)+(_0x383551[_0x16c04e(0x131)]!==0x1?'s':''));if(_0x5bd4b8[_0x16c04e(0x199)]===_0x16c04e(0x202)||_0x5bd4b8[_0x16c04e(0x199)]===_0x16c04e(0x1a0))await handleSDKOutput(_0x383551,_0x5bd4b8);else{if(_0x383551[_0x16c04e(0x131)]===0x0)console[_0x16c04e(0x13d)](_0x16c04e(0x148)),console[_0x16c04e(0x26a)](a22_0x2cd7a0['cyan'](_0x16c04e(0x173)));else for(const _0x1bdcc1 of _0x383551){const _0x7c01f5=_0x1bdcc1[_0x16c04e(0x293)]?.[_0x16c04e(0x131)]||0x0,_0x564000=_0x1bdcc1[_0x16c04e(0x21c)]?a22_0x2cd7a0['dim'](_0x16c04e(0x29d)+_0x1bdcc1[_0x16c04e(0x21c)]):'',_0x3ed2c0=a22_0x2cd7a0[_0x16c04e(0x1b8)]('\x20('+_0x7c01f5+_0x16c04e(0x28c)+(_0x7c01f5!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x1bdcc1[_0x16c04e(0x1ca)]+_0x564000+_0x3ed2c0),_0x1bdcc1['description']&&console[_0x16c04e(0x13d)](_0x16c04e(0x216)+a22_0x2cd7a0[_0x16c04e(0x1b8)](_0x1bdcc1[_0x16c04e(0x1ee)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x567877(0x1ca)]=a22_0x567877(0x137);[a22_0x567877(0x1ee)]=a22_0x567877(0x224);async[a22_0x567877(0x273)](_0x32f98d){const _0x6f19e8=a22_0x567877,{options:_0x245c46,args:_0x282185}=_0x32f98d,_0x3d7a0c=_0x282185[0x0]||_0x245c46[_0x6f19e8(0x28b)];if(!_0x3d7a0c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+_0x6f19e8(0x295)),0x1;const _0x2ca3f3=resolveYamlFile(_0x3d7a0c);if(!existsSync(_0x2ca3f3))return showFileNotFoundError(_0x2ca3f3,_0x3d7a0c),0x1;let _0x2eecdf;try{_0x2eecdf=readFileSync(_0x2ca3f3,'utf-8');}catch(_0x5d02a7){const _0x4a21e0=_0x5d02a7 instanceof Error?_0x5d02a7['message']:String(_0x5d02a7);return console[_0x6f19e8(0x26a)](_0x6f19e8(0x266)+_0x4a21e0),0x1;}let _0x44bd18;try{_0x44bd18=parseDef(_0x2eecdf);}catch(_0x220866){const _0x35739b=_0x220866 instanceof Error?_0x220866[_0x6f19e8(0x209)]:String(_0x220866);return console['error'](a22_0x2cd7a0[_0x6f19e8(0x272)](_0x6f19e8(0x271)+_0x35739b)),0x1;}if(_0x44bd18[_0x6f19e8(0x109)]&&_0x44bd18[_0x6f19e8(0x109)]['length']>0x0)return console['error'](a22_0x2cd7a0['yellow'](_0x6f19e8(0x10e)+_0x2ca3f3)),console['error'](a22_0x2cd7a0[_0x6f19e8(0x1b8)](_0x6f19e8(0x1a3)+_0x44bd18[_0x6f19e8(0x109)][_0x6f19e8(0x131)]+_0x6f19e8(0x110))),0x1;!_0x44bd18['realtime']&&(_0x44bd18[_0x6f19e8(0x145)]={'events':[{'name':_0x6f19e8(0x1a9),'source_table':_0x6f19e8(0x157)}],'attributes':[{'name':_0x6f19e8(0x1b5),'type':_0x6f19e8(0x211)}],'id_stitching':{'primary_key':_0x44bd18[_0x6f19e8(0x229)][_0x6f19e8(0x269)]===_0x6f19e8(0x1ae)?_0x6f19e8(0x245):'user_id'}});_0x44bd18[_0x6f19e8(0x109)]=[{'name':_0x6f19e8(0x126),'description':_0x6f19e8(0x12a),'trigger_event':'page_view','sections':[{'name':_0x6f19e8(0x28a),'criteria':_0x6f19e8(0x1bd),'attributes':['last_page_viewed']}]}];const _0x48370e=serializeDef(_0x44bd18);return writeFileSync(_0x2ca3f3,_0x48370e,_0x6f19e8(0x18e)),console['error'](a22_0x2cd7a0['green']('✔')+_0x6f19e8(0x14b)+a22_0x2cd7a0['cyan'](_0x2ca3f3)),(!_0x44bd18[_0x6f19e8(0x145)]||_0x2eecdf[_0x6f19e8(0x164)](_0x6f19e8(0x1fd))===-0x1)&&console[_0x6f19e8(0x26a)](a22_0x2cd7a0[_0x6f19e8(0x24e)]('✔')+_0x6f19e8(0x221)),console['error']('\x0a'+a22_0x2cd7a0['dim']('Next\x20steps:')),console[_0x6f19e8(0x26a)](_0x6f19e8(0x1af)+_0x2ca3f3+_0x6f19e8(0x162)),console[_0x6f19e8(0x26a)](_0x6f19e8(0x123)+a22_0x2cd7a0['dim'](_0x6f19e8(0x161)+_0x3d7a0c)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
|
|
1
|
+
const a22_0x2df86f=a22_0x2d13;(function(_0xbc330,_0x1f28f7){const _0x52a5d8=a22_0x2d13,_0x335788=_0xbc330();while(!![]){try{const _0x4ffbfd=-parseInt(_0x52a5d8(0x281))/0x1+-parseInt(_0x52a5d8(0x173))/0x2*(-parseInt(_0x52a5d8(0x245))/0x3)+parseInt(_0x52a5d8(0x1e6))/0x4*(-parseInt(_0x52a5d8(0x29f))/0x5)+-parseInt(_0x52a5d8(0x1ab))/0x6+-parseInt(_0x52a5d8(0x2c3))/0x7*(-parseInt(_0x52a5d8(0x1b1))/0x8)+parseInt(_0x52a5d8(0x18e))/0x9+parseInt(_0x52a5d8(0x2ad))/0xa*(parseInt(_0x52a5d8(0x20f))/0xb);if(_0x4ffbfd===_0x1f28f7)break;else _0x335788['push'](_0x335788['shift']());}catch(_0x45ae56){_0x335788['push'](_0x335788['shift']());}}}(a22_0x3b2e,0xb3141));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x5f4fdc 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_0x2534e9 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a22_0x3b2e(){const _0x38566b=['\x0a\x20\x20]\x0a}\x0a','customerPercent','varchar','verbose','9002yhafhn','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','jsonl','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Available\x20behaviors:','\x5c$&','\x20\x201.\x20Edit\x20','Show\x20parent\x20segment\x20details','using\x20the\x20default\x20path:\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','utf-8','Status:','%)\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','tdx\x20ps\x20push\x20','Listing\x20parent\x20segments\x20matching\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','-1d','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20','displayPreviewHints','realtime:','web','Columns:','personalization','true','No\x20parent\x20segments\x20found','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x22\x20}','json','trim','information_schema','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20\x20Note:\x20','Executing\x20parent\x20segment\x20query...','toLocaleString','Available\x20attributes:','Fetching\x20sample\x20data...','createParent','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:update','runParent','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','addBehaviors','pushParentYaml','string','yellow','win32','\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','primaryKey','segment:parent:push','rowCount','errors','Personalization\x20service\x20description','getParentFull','segment:parent:validate','realtime_enabled','segment:parent:fields','\x20--attribute\x20\x22<name>\x22','name','No\x20RT-enabled\x20parent\x20segments\x20found','number','previewParentYaml','\x20\x20\x20\x20','\x20--behavior\x20\x22<name>\x22','pullParentYaml','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','collectSchema','list','Validating\x20configuration...','dim','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20tdx\x20wf\x20attempt\x20','last_page_viewed','12QvgGmH','List\x20available\x20fields\x20for\x20segmentation','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','elapsedTimeMillis','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','timezone','start','column_type','error','Source:','filter','Master\x20Table','audienceId','addAttributesFile','\x0a⚠️\x20\x20Migrating:\x20','\x20section','Resolving\x20parent\x20segment\x20\x27','/\x20directory.\x0a','execute','site','✔\x20Created\x20parent\x20segment\x20\x27','\x20+\x20[','type','Next\x20steps:','keys','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','sections','6792138bgwyZw','session','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20\x20No\x20sample\x20data\x20available','ps:rt:validate','\x20=\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','toLowerCase','replace','processedRows','stop','behaviorsFile','foreignKey','\x20personalization\x20service','realtime','xdg-open','/{name}.yml\x0a','Error:','Master\x20+\x20Attributes','status','\x20rows\x20','behavior','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','endsWith','\x20service(s)\x20configured','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','red','in\x20','4575090tRPsWG','✔\x20Found\x20','customers','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Name:\x20','1624eidIkL','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','schemaError','\x20Context\x20set:\x20','.customers)','RT\x202.0:','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','\x20Configuration\x20is\x20valid','join','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','query','\x20\x20\x20\x20-\x20','data','displayColumns','Fetching\x20behavior\x20list...','scheduleType','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Overwrite\x20\x27','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20total','coveragePercent','Updating','all','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','/\x20directories\x20exist.','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','resolveParentId','Error:\x20--behavior\x20requires\x20a\x20name\x0a','isDirectory','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x0aNo\x20sample\x20data\x20available','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','segment','\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','bold','message','addBehaviorsFile','Created','stitchingKeys','Table:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Aborted.','`\x20to\x20download\x20the\x20configuration\x20first','listFields','.yml','page_view','ID\x20Stitching:','scheduleOption','validateParentYaml','✔\x20Updated\x20parent\x20segment\x20\x27','\x20[Job\x20ID:\x20','Parent\x20segment:\x20','356992TcuBGI','displaySampleData','Validating\x20RT\x20configuration...','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','column','use','Session:','Updated','displayRealtimeInfo','addAttributes','Listing\x20personalization\x20services\x20for\x20\x27','Fetching\x20SQL\x20for\x20\x27','yes','No\x20parent\x20segments\x20match\x20pattern:\x20','column_name','sourceTableValid','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','FINISHED','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0a\x20\x20\x20\x20}','Attributes','\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','segment:parent:list','indexOf','apply','List\x20parent\x20segments','getBehaviorNames','/\x20and\x20','Analyzing\x20changes...','Creating\x20parent\x20segment\x20\x27','Events:','test','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20behaviors','/app/workflows/','\x20field','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','push','parent_id','\x0aError:','528MXfWYw','getParentSQL','displaySummary','jobId','attribute','To\x20view\x20sample\x20data:','sort','green','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','unref','Error:\x20--attribute\x20requires\x20a\x20name\x0a','behaviors','\x20\x20Database:\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','/app/dw/parentSegments/','ignore','personalization_services','segment:parent:pull','idStitching','Found\x20YAML\x20file:\x20','database','sampleData','\x20trigger=','setJobId','events','Listing\x20RT-enabled\x20parent\x20segments...','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','\x0a✔\x20Workflow\x20started','Listing\x20fields\x20for\x20\x27','\x0a\x20\x20\x20\x20]','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','interval','attributes','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','segment:parent:desc','enabled','workflowSessionId','Fetching\x20customers\x20schema...','Updating\x20parent\x20segment\x20\x27','\x20configured','ps:pz:list','\x27\x20is\x20up\x20to\x20date','Options\x20(one\x20required):\x0a','segment:parent:view','SQL\x20query:\x0a','totalEvents','workflowAttemptId','\x20to\x20push\x20the\x20configuration','displayValidateResults','Error\x20parsing\x20YAML:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','format','sourceTableError','703641jQjGIr','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Join:','Output\x20Database:','Behavior:','ps:rt:list','⚡\x20Not\x20enabled','Fetching\x20parent\x20segment\x20\x27','Rows:','Customers:','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','Options:','displayAttributesStats','single','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','<database>.<table>','platform','\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','\x27...','displayMasterInfo','output','log','Schema\x20saved\x20to\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20Added\x20RT\x202.0\x20template\x20section','Site:\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Personalization:','segment:parent:create','customerGroupFile','customersWithEvents','parent_segments','\x20No\x20changes\x20-\x20','localeCompare','user_id','workflowId','darwin','My\x20Service','limit','columns','parentSegment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Join\x20on:','displayBehaviorsStats','Attribute:','YAML\x20file:\x20','segment:parent:sql','cyan','valid','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','To\x20cancel:','✘\x20Failed\x20to\x20rename\x20directory:\x20','✔\x20No\x20changes\x20-\x20\x27','description','label','master','Error\x20reading\x20file:\x20','\x20\x20\x20','schemaValid','1209338oiUXMm','Output\x20file:\x20','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','No\x20personalization\x20services\x20configured','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','open','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','getOutputDatabaseName','👥\x20','text','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20Both\x20','joinKey','\x27\x20and\x20run\x20workflow?','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','segment:parent:show','personalizationServices','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','stats','Coverage:','\x20Opening\x20','\x0aChanges\x20to\x20\x27','map','\x20--attribute\x20\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','parent_segment','customerGroup','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Create\x20parent\x20segment\x20\x27','15dtaOcW','repeat','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','population','Listing\x20parent\x20segments...','tdx\x20ps\x20preview\x20','\x20is\x20already\x20up\x20to\x20date','toFixed','Options:\x0a','/attempt/','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','\x20parent\x20segment\x20\x27','match','114600sPiMEi','allValid','behavior_','reduce','Pattern:\x20','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','length','/\x20→\x20','Errors:','dirname','Creating','\x20--behavior\x20\x22','\x20parent\x20segment','table','\x20Added\x20personalization\x20template\x20to\x20','enriched','Default','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'];a22_0x3b2e=function(){return _0x38566b;};return a22_0x3b2e();}const PARENT_SEGMENT_DIR=a22_0x2df86f(0x264),LEGACY_PARENT_SEGMENT_DIR=a22_0x2df86f(0x29b);function openBrowser(_0xbe00c0){const _0x52a07b=a22_0x2df86f,_0x4627d6=process[_0x52a07b(0x255)],_0x5e67e5=_0x4627d6===_0x52a07b(0x269)?_0x52a07b(0x286):_0x4627d6===_0x52a07b(0x158)?_0x52a07b(0x179):_0x52a07b(0x19e);spawn(_0x5e67e5,[_0xbe00c0],{'detached':!![],'stdio':_0x52a07b(0x21e)})[_0x52a07b(0x218)]();}function migrateLegacyDirectory(){const _0x52491c=a22_0x2df86f;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1e7dd3=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1e7dd3[_0x52491c(0x1ce)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x52491c(0x17b)](a22_0x2534e9[_0x52491c(0x157)](_0x52491c(0x28c)+LEGACY_PARENT_SEGMENT_DIR+_0x52491c(0x202)+PARENT_SEGMENT_DIR+_0x52491c(0x1ca))),console[_0x52491c(0x17b)](a22_0x2534e9[_0x52491c(0x16f)](_0x52491c(0x2d3)+LEGACY_PARENT_SEGMENT_DIR+_0x52491c(0x184))),![];console[_0x52491c(0x17b)](a22_0x2534e9[_0x52491c(0x157)](_0x52491c(0x181)+LEGACY_PARENT_SEGMENT_DIR+_0x52491c(0x2b4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x52491c(0x17b)](a22_0x2534e9['green']('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2a1779){const _0x3ca290=_0x2a1779 instanceof Error?_0x2a1779[_0x52491c(0x1d5)]:String(_0x2a1779);return console[_0x52491c(0x17b)](a22_0x2534e9[_0x52491c(0x1a9)](_0x52491c(0x279)+_0x3ca290+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x2174ae){return migrateLegacyDirectory(),super['run'](_0x2174ae);}}function resolveYamlFile(_0x4c1214){const _0xdbe5b9=a22_0x2df86f;if(_0x4c1214[_0xdbe5b9(0x1a6)](_0xdbe5b9(0x1de))||_0x4c1214[_0xdbe5b9(0x1a6)]('.yaml'))return _0x4c1214;return a22_0x5f4fdc[_0xdbe5b9(0x1b9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4c1214)+'.yml');}function formatProgressMessage(_0x2865f9){const _0x27b8e0=a22_0x2df86f,_0x5c85b5=_0x2865f9[_0x27b8e0(0x2ac)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5c85b5){const [,_0x1de51d,_0x43f40d,_0xa20171='']=_0x5c85b5;return a22_0x2534e9['dim'](_0x1de51d+':')+'\x20'+_0x43f40d+a22_0x2534e9[_0x27b8e0(0x16f)](_0xa20171);}return a22_0x2534e9[_0x27b8e0(0x16f)](_0x2865f9);}function showFileNotFoundError(_0xfb7ced,_0x3e6b3b){const _0x43273a=a22_0x2df86f;console[_0x43273a(0x17b)](a22_0x2534e9['red']('Error:\x20File\x20not\x20found:\x20'+_0xfb7ced+'\x0a')),console[_0x43273a(0x17b)](a22_0x2534e9[_0x43273a(0x274)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x3e6b3b+_0x43273a(0x1dc)));}function displayRealtimeValidation(_0x4c0f71){const _0x2ede89=a22_0x2df86f;if(!_0x4c0f71[_0x2ede89(0x19d)])return;const _0x14ce61=_0x4c0f71[_0x2ede89(0x19d)],_0xc8b9a4=_0x14ce61[_0x2ede89(0x233)]?a22_0x2534e9[_0x2ede89(0x216)]('⚡\x20Enabled'):a22_0x2534e9[_0x2ede89(0x157)](_0x2ede89(0x24b));console[_0x2ede89(0x17b)]('\x0a'+a22_0x2534e9[_0x2ede89(0x16f)](_0x2ede89(0x1b6))+'\x20'+_0xc8b9a4);if(_0x14ce61[_0x2ede89(0x227)]&&_0x14ce61[_0x2ede89(0x227)][_0x2ede89(0x2b3)]>0x0){console[_0x2ede89(0x17b)]('\x20\x20'+a22_0x2534e9[_0x2ede89(0x16f)](_0x2ede89(0x205))+'\x20'+_0x14ce61[_0x2ede89(0x227)][_0x2ede89(0x2b3)]+'\x20configured');for(const _0xcbfc5b of _0x14ce61[_0x2ede89(0x227)]){const _0x515c03=_0xcbfc5b[_0x2ede89(0x1f6)]===![]?a22_0x2534e9['red']('✘'):a22_0x2534e9['green']('✔');console[_0x2ede89(0x17b)](_0x2ede89(0x168)+_0x515c03+'\x20'+_0xcbfc5b['name']),_0xcbfc5b[_0x2ede89(0x244)]&&console[_0x2ede89(0x17b)](_0x2ede89(0x2d9)+a22_0x2534e9[_0x2ede89(0x1a9)](_0xcbfc5b[_0x2ede89(0x244)]));}}if(_0x14ce61[_0x2ede89(0x22f)]&&_0x14ce61[_0x2ede89(0x22f)][_0x2ede89(0x2b3)]>0x0){console[_0x2ede89(0x17b)]('\x20\x20'+a22_0x2534e9['dim']('Attributes:')+'\x20'+_0x14ce61['attributes'][_0x2ede89(0x2b3)]+_0x2ede89(0x237));for(const _0x49e93e of _0x14ce61[_0x2ede89(0x22f)]){const _0x357776=_0x49e93e[_0x2ede89(0x275)]?a22_0x2534e9[_0x2ede89(0x216)]('✔'):a22_0x2534e9['red']('✘');console['error'](_0x2ede89(0x168)+_0x357776+'\x20'+_0x49e93e[_0x2ede89(0x164)]+'\x20'+a22_0x2534e9[_0x2ede89(0x16f)]('('+_0x49e93e[_0x2ede89(0x189)]+')'));}}if(_0x14ce61[_0x2ede89(0x221)]){const _0x20f206=_0x14ce61['idStitching']['stitchingKeys']?.['length']?_0x2ede89(0x188)+_0x14ce61[_0x2ede89(0x221)][_0x2ede89(0x1d8)][_0x2ede89(0x1b9)](',\x20')+']':'';console[_0x2ede89(0x17b)]('\x20\x20'+a22_0x2534e9['dim'](_0x2ede89(0x1e0))+'\x20'+_0x14ce61['idStitching'][_0x2ede89(0x15a)]+_0x20f206);}if(_0x14ce61[_0x2ede89(0x292)]&&_0x14ce61['personalizationServices']['length']>0x0){console[_0x2ede89(0x17b)]('\x20\x20'+a22_0x2534e9[_0x2ede89(0x16f)](_0x2ede89(0x260))+'\x20'+_0x14ce61['personalizationServices'][_0x2ede89(0x2b3)]+'\x20service'+(_0x14ce61[_0x2ede89(0x292)]['length']!==0x1?'s':''));for(const _0x1aca19 of _0x14ce61['personalizationServices']){console['error'](_0x2ede89(0x1bc)+_0x1aca19[_0x2ede89(0x164)]);}}}function showParentSegmentNotSetError(_0x23349e){const _0x4452db=a22_0x2df86f;console[_0x4452db(0x17b)](a22_0x2534e9[_0x4452db(0x157)](_0x4452db(0x170))),console['error'](_0x23349e);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x1fd);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x200);async[a22_0x2df86f(0x185)](_0x1f56fe){const _0x25d81e=a22_0x2df86f,{options:_0x2566cb,args:_0x8732e3,tdx:_0x52e178}=_0x1f56fe,_0x4a0586=_0x8732e3[0x0];_0x2566cb[_0x25d81e(0x2c2)]&&(console[_0x25d81e(0x17b)](_0x25d81e(0x25e)+_0x2566cb[_0x25d81e(0x186)]),_0x4a0586&&console[_0x25d81e(0x17b)](_0x25d81e(0x2b1)+_0x4a0586));const _0x2123fa=await withSpinner(_0x4a0586?_0x25d81e(0x2d5)+_0x4a0586+_0x25d81e(0x257):_0x25d81e(0x2a3),()=>_0x52e178['segment']['listParents'](),{'verbose':_0x2566cb[_0x25d81e(0x2c2)]});let _0x4034e3=_0x2123fa['data'];if(_0x4a0586){const _0x15a21b=_0x4a0586[_0x25d81e(0x197)](/[.+^${}()|[\]\\]/g,_0x25d81e(0x2c9))[_0x25d81e(0x197)](/\*/g,'.*')[_0x25d81e(0x197)](/\?/g,'.'),_0x28db42=new RegExp('^'+_0x15a21b+'$','i');_0x4034e3=_0x4034e3[_0x25d81e(0x17d)](_0x4e0f4a=>_0x28db42[_0x25d81e(0x206)](_0x4e0f4a[_0x25d81e(0x22f)][_0x25d81e(0x164)]));}_0x4034e3[_0x25d81e(0x215)]((_0x5ef870,_0x5747ef)=>_0x5ef870[_0x25d81e(0x22f)][_0x25d81e(0x164)][_0x25d81e(0x266)](_0x5747ef[_0x25d81e(0x22f)][_0x25d81e(0x164)])),console['error'](_0x25d81e(0x1ac)+_0x4034e3[_0x25d81e(0x2b3)]+_0x25d81e(0x2b9)+(_0x4034e3[_0x25d81e(0x2b3)]!==0x1?'s':''));const _0xea24ce=_0x2c3a02=>{const _0x1700d1=_0x25d81e;return getConsoleNextUrl(_0x2566cb[_0x1700d1(0x186)],_0x1700d1(0x21d)+_0x2c3a02);};if(_0x2566cb['format']===_0x25d81e(0x146)||_0x2566cb[_0x25d81e(0x243)]==='jsonl'){const _0x1aeb06=_0x4034e3[_0x25d81e(0x298)](_0xde8959=>({..._0xde8959,'url':_0xea24ce(_0xde8959['id'])}));await handleSDKOutput(_0x1aeb06,_0x2566cb);}else{if(_0x4034e3[_0x25d81e(0x2b3)]===0x0)_0x4a0586?console[_0x25d81e(0x25a)](_0x25d81e(0x1f4)+_0x4a0586):console[_0x25d81e(0x25a)](_0x25d81e(0x141));else for(const _0x47db21 of _0x4034e3){const _0x314a02=_0x47db21[_0x25d81e(0x22f)][_0x25d81e(0x2a2)]?a22_0x2534e9[_0x25d81e(0x16f)]('\x20('+formatRows(_0x47db21['attributes'][_0x25d81e(0x2a2)])+')'):'',_0x1ec0ab=hyperlink(_0x47db21['attributes'][_0x25d81e(0x164)],_0xea24ce(_0x47db21['id']));console['log'](_0x25d81e(0x289)+_0x1ec0ab+_0x314a02);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x261);['description']=a22_0x2df86f(0x1ba);async['execute'](_0x4912e6){const _0x10a845=a22_0x2df86f,{options:_0x5a78d3,args:_0x5827e9,tdx:_0x1906fb}=_0x4912e6;console['error'](_0x10a845(0x1da)+_0x10a845(0x18c)+_0x10a845(0x285));const _0x10a2e8=_0x5a78d3;if(_0x5827e9[_0x10a845(0x2b3)]===0x0)return console[_0x10a845(0x17b)](a22_0x2534e9[_0x10a845(0x1a9)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x54894e=_0x5827e9[0x0];if(!_0x10a2e8[_0x10a845(0x223)]||!_0x10a2e8[_0x10a845(0x2ba)])return console[_0x10a845(0x17b)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x10a845(0x17b)](_0x10a845(0x276)),0x1;_0x10a2e8['verbose']&&(console['error'](_0x10a845(0x25e)+_0x10a2e8[_0x10a845(0x186)]),console[_0x10a845(0x17b)](_0x10a845(0x1b0)+_0x54894e),console[_0x10a845(0x17b)]('Database:\x20'+_0x10a2e8['database']),console[_0x10a845(0x17b)](_0x10a845(0x1d9)+_0x10a2e8[_0x10a845(0x2ba)]));const _0x24166d=await loadJSONFromOptions(_0x10a2e8['attributes'],_0x10a2e8['attributesFile']),_0x325047=await loadJSONFromOptions(_0x10a2e8[_0x10a845(0x21a)],_0x10a2e8[_0x10a845(0x19a)]),_0x396734=await loadJSONFromOptions(_0x10a2e8[_0x10a845(0x29c)],_0x10a2e8[_0x10a845(0x262)]),_0x1b2e4d={'name':_0x54894e,'description':_0x10a2e8['description'],'scheduleType':_0x10a2e8['scheduleType'],'scheduleOption':_0x10a2e8[_0x10a845(0x1e1)],'timezone':_0x10a2e8[_0x10a845(0x178)],'master':{'parentDatabaseName':_0x10a2e8[_0x10a845(0x223)],'parentTableName':_0x10a2e8[_0x10a845(0x2ba)]},'attributes':_0x24166d,'behaviors':_0x325047,'customerGroup':_0x396734},_0x337b8f=await withSpinner(_0x10a845(0x204)+_0x54894e+_0x10a845(0x257),()=>_0x1906fb[_0x10a845(0x1d2)][_0x10a845(0x14f)](_0x1b2e4d),{'verbose':_0x5a78d3[_0x10a845(0x2c2)]}),_0x268861=_0x337b8f['data'];return console[_0x10a845(0x17b)](_0x10a845(0x187)+_0x268861['name']+_0x10a845(0x2a9)+_0x268861['id']),await handleSDKOutput([_0x268861],_0x5a78d3),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x151);['description']=a22_0x2df86f(0x29a);async[a22_0x2df86f(0x185)](_0x3f580b){const _0x364ecc=a22_0x2df86f,{options:_0x4e76ca,args:_0x57bc53,tdx:_0x51ba6c}=_0x3f580b;console[_0x364ecc(0x17b)](_0x364ecc(0x142)+_0x364ecc(0x18c)+_0x364ecc(0x285));const _0x3301f4=_0x4e76ca;if(_0x57bc53[_0x364ecc(0x2b3)]===0x0)return console[_0x364ecc(0x17b)](a22_0x2534e9[_0x364ecc(0x1a9)](_0x364ecc(0x25c))),console[_0x364ecc(0x17b)](_0x364ecc(0x26e)),0x1;const _0x4f9b3c=_0x57bc53[0x0];_0x3301f4[_0x364ecc(0x2c2)]&&(console[_0x364ecc(0x17b)](_0x364ecc(0x25e)+_0x3301f4['site']),console[_0x364ecc(0x17b)]('Parent\x20segment:\x20'+_0x4f9b3c));const _0x20cb0e=await withSpinner(_0x364ecc(0x1af)+_0x4f9b3c+'\x27...',()=>_0x51ba6c[_0x364ecc(0x1d2)][_0x364ecc(0x15f)](_0x4f9b3c),{'verbose':_0x3301f4[_0x364ecc(0x2c2)]}),_0xadb8df=_0x20cb0e[_0x364ecc(0x1bd)],_0x29479c=await loadJSONFromOptions(_0x3301f4[_0x364ecc(0x1f0)],_0x3301f4[_0x364ecc(0x180)]),_0x229a21=await loadJSONFromOptions(_0x3301f4[_0x364ecc(0x154)],_0x3301f4[_0x364ecc(0x1d6)]),_0x1b3a56={'name':_0xadb8df['name'],'description':_0x3301f4['description']!==undefined?_0x3301f4[_0x364ecc(0x27b)]:_0xadb8df[_0x364ecc(0x27b)],'scheduleType':_0x3301f4[_0x364ecc(0x1c0)]!==undefined?_0x3301f4[_0x364ecc(0x1c0)]:_0xadb8df[_0x364ecc(0x1c0)],'scheduleOption':_0x3301f4[_0x364ecc(0x1e1)]!==undefined?_0x3301f4[_0x364ecc(0x1e1)]:_0xadb8df[_0x364ecc(0x1e1)],'timezone':_0x3301f4['timezone']!==undefined?_0x3301f4[_0x364ecc(0x178)]:_0xadb8df[_0x364ecc(0x178)],'master':_0xadb8df[_0x364ecc(0x27d)],'attributes':_0x29479c?[..._0xadb8df[_0x364ecc(0x22f)]||[],..._0x29479c]:_0xadb8df[_0x364ecc(0x22f)],'behaviors':_0x229a21?[..._0xadb8df[_0x364ecc(0x21a)]||[],..._0x229a21]:_0xadb8df[_0x364ecc(0x21a)],'customerGroup':_0xadb8df[_0x364ecc(0x29c)]},_0x35a404=await withSpinner(_0x364ecc(0x236)+_0x4f9b3c+_0x364ecc(0x257),()=>_0x51ba6c[_0x364ecc(0x1d2)]['updateParent'](_0x4f9b3c,_0x1b3a56),{'verbose':_0x3301f4['verbose']}),_0x4bcd42=_0x35a404['data'];return console[_0x364ecc(0x17b)](_0x364ecc(0x1e3)+_0x4bcd42[_0x364ecc(0x164)]+'\x27'),await handleSDKOutput([_0x4bcd42],_0x3301f4),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x220);['description']=a22_0x2df86f(0x246);async['execute'](_0x614a27){const _0x968c5d=a22_0x2df86f,{options:_0xb92802,args:_0x27fc8b,tdx:_0x2b986f}=_0x614a27,_0xd0a785=_0xb92802,_0x1af293=_0x27fc8b[0x0]||_0xb92802['parentSegment'];if(!_0x1af293)return showParentSegmentNotSetError(_0x968c5d(0x1a8)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0xd0a785[_0x968c5d(0x1ec)]&&_0xd0a785[_0x968c5d(0x259)])return console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x1a9)](_0x968c5d(0x190))),console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x16f)](_0x968c5d(0x177))),console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x16f)](_0x968c5d(0x2cc)+PARENT_SEGMENT_DIR+_0x968c5d(0x19f))),console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x274)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x363ce0=_0xd0a785[_0x968c5d(0x259)]||a22_0x5f4fdc[_0x968c5d(0x1b9)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1af293)+_0x968c5d(0x1de));_0xd0a785[_0x968c5d(0x2c2)]&&(console[_0x968c5d(0x17b)]('Site:\x20'+_0xd0a785[_0x968c5d(0x186)]),console[_0x968c5d(0x17b)](_0x968c5d(0x1e5)+_0x1af293),console[_0x968c5d(0x17b)](_0x968c5d(0x282)+_0x363ce0));const _0x1b0c4d=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x1af293+_0x968c5d(0x257),()=>_0x2b986f[_0x968c5d(0x1d2)][_0x968c5d(0x16a)](_0x1af293),{'verbose':_0xd0a785[_0x968c5d(0x2c2)]}),_0x1a561d=_0x1b0c4d[_0x968c5d(0x1bd)];if(existsSync(_0x363ce0)){const _0x1a4f7b=readFileSync(_0x363ce0,'utf-8'),_0x1d17fe=generateDiff(_0x1a4f7b,_0x1a561d);if(!hasChanges(_0x1d17fe))console['error'](a22_0x2534e9[_0x968c5d(0x216)]('✔')+_0x968c5d(0x265)+a22_0x2534e9[_0x968c5d(0x274)](_0x363ce0)+_0x968c5d(0x2a5));else{console[_0x968c5d(0x17b)](_0x968c5d(0x297)+_0x363ce0+'\x27:'),console[_0x968c5d(0x17b)]('─'[_0x968c5d(0x2a0)](0x3c)),console['error'](formatDiffWithColors(_0x1d17fe)),console['error']('─'[_0x968c5d(0x2a0)](0x3c));if(!_0xd0a785['yes']){if(!isInteractive())return console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x1a9)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a22_0x2534e9[_0x968c5d(0x16f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x5b2801=await confirmKey(_0x968c5d(0x1c3)+_0x363ce0+'\x27?');if(!_0x5b2801)return console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x157)]('Aborted.')),0x1;}writeFileSync(_0x363ce0,_0x1a561d,_0x968c5d(0x2d0)),console[_0x968c5d(0x17b)](a22_0x2534e9['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x2534e9['cyan'](_0x363ce0));}}else{const _0x325aa6=a22_0x5f4fdc[_0x968c5d(0x2b6)](_0x363ce0);!existsSync(_0x325aa6)&&mkdirSync(_0x325aa6,{'recursive':!![]}),writeFileSync(_0x363ce0,_0x1a561d,'utf-8'),console[_0x968c5d(0x17b)](a22_0x2534e9[_0x968c5d(0x216)]('✔')+_0x968c5d(0x1b2)+a22_0x2534e9['cyan'](_0x363ce0));}return saveSessionContext({'parent_segment':_0x1af293},_0xd0a785[_0x968c5d(0x18f)]),console['error'](a22_0x2534e9['green']('✔')+_0x968c5d(0x1b4)+a22_0x2534e9[_0x968c5d(0x16f)](_0x968c5d(0x29b))+'\x20=\x20'+a22_0x2534e9[_0x968c5d(0x274)](_0x1af293)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x15b);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x22d);async[a22_0x2df86f(0x185)](_0x41fbc5){const _0x3ab76b=a22_0x2df86f,{options:_0x4a1682,args:_0x47f69f,tdx:_0x14e97e}=_0x41fbc5,_0xb161f0=_0x4a1682,_0x22fdc9=_0x47f69f[0x0]||_0x4a1682['parentSegment'];if(!_0x22fdc9)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'+_0x3ab76b(0x290)),0x1;const _0x790539=resolveYamlFile(_0x22fdc9);if(!existsSync(_0x790539))return showFileNotFoundError(_0x790539,_0x22fdc9),0x1;_0xb161f0['verbose']&&(console[_0x3ab76b(0x17b)](_0x3ab76b(0x25e)+_0xb161f0[_0x3ab76b(0x186)]),console[_0x3ab76b(0x17b)](_0x3ab76b(0x272)+_0x790539));let _0x59fd87;try{_0x59fd87=readFileSync(_0x790539,_0x3ab76b(0x2d0));}catch(_0x3b0c29){const _0x2cb363=_0x3b0c29 instanceof Error?_0x3b0c29[_0x3ab76b(0x1d5)]:String(_0x3b0c29);return console[_0x3ab76b(0x17b)]('Error\x20reading\x20file:\x20'+_0x2cb363),0x1;}const _0x3ca579=await withSpinner('Analyzing\x20changes...',()=>_0x14e97e[_0x3ab76b(0x1d2)]['pushParentYaml'](_0x59fd87),{'verbose':_0xb161f0[_0x3ab76b(0x2c2)]}),_0x450fd8=_0x3ca579[_0x3ab76b(0x1bd)],{isNew:_0xb8e080,name:_0x407993,hasChanges:_0x30291e,diffFormatted:_0x316ef0}=_0x450fd8;if(!_0x30291e)return console[_0x3ab76b(0x17b)](_0x3ab76b(0x27a)+_0x407993+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0xb8e080?console[_0x3ab76b(0x17b)](_0x3ab76b(0x2d6)+_0x407993+'\x27:'):console[_0x3ab76b(0x17b)](_0x3ab76b(0x150)+_0x407993+'\x27:');console[_0x3ab76b(0x17b)]('─'[_0x3ab76b(0x2a0)](0x3c)),console[_0x3ab76b(0x17b)](_0x316ef0),console[_0x3ab76b(0x17b)]('─'['repeat'](0x3c));const _0x18f2b3=_0xb8e080?_0x3ab76b(0x29e)+_0x407993+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x407993+'\x27?';if(!_0xb161f0[_0x3ab76b(0x1f3)]){if(!isInteractive())return console[_0x3ab76b(0x17b)](a22_0x2534e9[_0x3ab76b(0x1a9)](_0x3ab76b(0x20e)),_0x3ab76b(0x2be)),console[_0x3ab76b(0x17b)](a22_0x2534e9[_0x3ab76b(0x16f)](_0x3ab76b(0x2a1))),0x1;const _0xefc033=await confirmKey(_0x18f2b3);if(!_0xefc033)return console[_0x3ab76b(0x17b)](a22_0x2534e9[_0x3ab76b(0x157)]('Aborted.')),0x1;}const _0x33d5f4=_0xb8e080?'Creating':_0x3ab76b(0x1c7),_0x131a03=await withSpinner(_0x33d5f4+_0x3ab76b(0x2ab)+_0x407993+_0x3ab76b(0x257),()=>_0x450fd8[_0x3ab76b(0x1ff)](),{'verbose':_0xb161f0[_0x3ab76b(0x2c2)]}),_0x1db203=_0x131a03[_0x3ab76b(0x1bd)],_0x2179e2=getConsoleNextUrl(_0xb161f0[_0x3ab76b(0x186)],_0x3ab76b(0x21d)+_0x1db203['id']),_0x588b63=_0xb8e080?_0x3ab76b(0x1d7):_0x3ab76b(0x1ee);return console['error']('✔\x20'+_0x588b63+_0x3ab76b(0x2ab)+_0x1db203['name']+'\x27'),console[_0x3ab76b(0x17b)]('\x20\x20'+_0x2179e2),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x160);[a22_0x2df86f(0x27b)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a22_0x2df86f(0x185)](_0x39e1a8){const _0x2b9e8d=a22_0x2df86f,{options:_0x4b6864,args:_0x57dea5,tdx:_0x238ec7}=_0x39e1a8,_0x284a95=_0x4b6864,_0x2306ee=_0x57dea5[0x0]||_0x4b6864[_0x2b9e8d(0x26d)];if(!_0x2306ee)return showParentSegmentNotSetError(_0x2b9e8d(0x153)+_0x2b9e8d(0x2c5)+_0x2b9e8d(0x2a7)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x2b9e8d(0x25f)+_0x2b9e8d(0x1c9)),0x1;const _0x44a239=resolveYamlFile(_0x2306ee);if(!existsSync(_0x44a239))return showFileNotFoundError(_0x44a239,_0x2306ee),0x1;_0x284a95['verbose']&&(console['error'](_0x2b9e8d(0x25e)+_0x284a95[_0x2b9e8d(0x186)]),console[_0x2b9e8d(0x17b)]('YAML\x20file:\x20'+_0x44a239));let _0x214353;try{_0x214353=readFileSync(_0x44a239,_0x2b9e8d(0x2d0));}catch(_0x5be681){const _0x545583=_0x5be681 instanceof Error?_0x5be681[_0x2b9e8d(0x1d5)]:String(_0x5be681);return console['error']('Error\x20reading\x20file:\x20'+_0x545583),0x1;}const _0x5c1f89=createCommandSpinner(a22_0x2534e9[_0x2b9e8d(0x16f)](_0x2b9e8d(0x16e)),{'verbose':_0x284a95['verbose']});_0x5c1f89[_0x2b9e8d(0x179)]();const _0x44a7f0={'onProgress':_0x4e7242=>{const _0x3d2d02=_0x2b9e8d;_0x5c1f89[_0x3d2d02(0x28a)]=formatProgressMessage(_0x4e7242);}};if(_0x284a95[_0x2b9e8d(0x27d)])_0x44a7f0[_0x2b9e8d(0x27d)]=!![];if(_0x284a95[_0x2b9e8d(0x2bc)])_0x44a7f0['enriched']=!![];_0x284a95['attribute']&&(_0x44a7f0['attribute']=_0x284a95[_0x2b9e8d(0x213)]);_0x284a95['behavior']&&(_0x44a7f0[_0x2b9e8d(0x1a4)]=_0x284a95[_0x2b9e8d(0x1a4)]);if(_0x284a95[_0x2b9e8d(0x22e)])_0x44a7f0[_0x2b9e8d(0x22e)]=_0x284a95[_0x2b9e8d(0x22e)];let _0x259944;try{_0x259944=await _0x238ec7[_0x2b9e8d(0x1d2)][_0x2b9e8d(0x1e2)](_0x214353,_0x44a7f0),_0x5c1f89[_0x2b9e8d(0x199)]();}catch(_0x400d4c){_0x5c1f89[_0x2b9e8d(0x199)]();throw _0x400d4c;}const _0x1bb95d=_0x284a95[_0x2b9e8d(0x22e)]||_0x2b9e8d(0x2d7);return this[_0x2b9e8d(0x240)](_0x259944,_0x44a7f0,_0x44a239,_0x1bb95d),_0x259944[_0x2b9e8d(0x2ae)]?0x0:0x1;}[a22_0x2df86f(0x240)](_0x1fa86c,_0x395344,_0x1f07b3,_0x321beb){const _0xc6f846=a22_0x2df86f;console[_0xc6f846(0x17b)]('\x0a'+a22_0x2534e9['bold']('Validate:')+'\x20'+_0x1fa86c[_0xc6f846(0x164)]),console[_0xc6f846(0x17b)]('═'[_0xc6f846(0x2a0)](0x3c)),this[_0xc6f846(0x258)](_0x1fa86c);if(typeof _0x395344[_0xc6f846(0x213)]===_0xc6f846(0x156)){this[_0xc6f846(0x251)](_0x1fa86c),this[_0xc6f846(0x211)](_0x1fa86c),this[_0xc6f846(0x2da)](_0x1f07b3,_0x321beb,'attribute',_0x395344[_0xc6f846(0x213)]);return;}if(_0x395344[_0xc6f846(0x213)]===!![]){this[_0xc6f846(0x251)](_0x1fa86c),this[_0xc6f846(0x211)](_0x1fa86c),this[_0xc6f846(0x2da)](_0x1f07b3,_0x321beb,_0xc6f846(0x22f));return;}if(typeof _0x395344[_0xc6f846(0x1a4)]==='string'){this[_0xc6f846(0x270)](_0x1fa86c,_0x321beb),this[_0xc6f846(0x211)](_0x1fa86c),this['displayPreviewHints'](_0x1f07b3,_0x321beb,_0xc6f846(0x1a4),_0x395344[_0xc6f846(0x1a4)]);return;}if(_0x395344[_0xc6f846(0x1a4)]===!![]){this[_0xc6f846(0x270)](_0x1fa86c,_0x321beb),this['displaySummary'](_0x1fa86c),this[_0xc6f846(0x2da)](_0x1f07b3,_0x321beb,_0xc6f846(0x21a));return;}this[_0xc6f846(0x251)](_0x1fa86c),this[_0xc6f846(0x270)](_0x1fa86c,_0x321beb),this['displayRealtimeInfo'](_0x1fa86c),this['displaySummary'](_0x1fa86c),this[_0xc6f846(0x2da)](_0x1f07b3,_0x321beb,'all');}[a22_0x2df86f(0x1ef)](_0x2dc406){displayRealtimeValidation(_0x2dc406);}['displayPreviewHints'](_0x2cf8e6,_0x451809,_0x148e05,_0x4cb929){const _0x4a5cad=a22_0x2df86f;console['error']('\x0a'+a22_0x2534e9[_0x4a5cad(0x16f)](_0x4a5cad(0x214)));const _0x8d8256=_0x451809!=='-1d'?'\x20--interval\x20'+_0x451809:'';if(_0x148e05===_0x4a5cad(0x213)&&_0x4cb929)console[_0x4a5cad(0x17b)]('\x20\x20'+a22_0x2534e9['dim'](_0x4a5cad(0x2a4)+_0x2cf8e6+_0x4a5cad(0x299)+_0x4cb929+'\x22'+_0x8d8256));else{if(_0x148e05==='behavior'&&_0x4cb929)console[_0x4a5cad(0x17b)]('\x20\x20'+a22_0x2534e9['dim'](_0x4a5cad(0x2a4)+_0x2cf8e6+'\x20--behavior\x20\x22'+_0x4cb929+'\x22'+_0x8d8256));else(_0x148e05===_0x4a5cad(0x22f)||_0x148e05==='all')&&console[_0x4a5cad(0x17b)]('\x20\x20'+a22_0x2534e9[_0x4a5cad(0x16f)](_0x4a5cad(0x2a4)+_0x2cf8e6+_0x4a5cad(0x163)+_0x8d8256));}(_0x148e05===_0x4a5cad(0x21a)||_0x148e05==='all')&&console[_0x4a5cad(0x17b)]('\x20\x20'+a22_0x2534e9['dim'](_0x4a5cad(0x2a4)+_0x2cf8e6+_0x4a5cad(0x169)+_0x8d8256)),_0x148e05===_0x4a5cad(0x1c8)&&console[_0x4a5cad(0x17b)]('\x20\x20'+a22_0x2534e9['dim']('tdx\x20ps\x20preview\x20'+_0x2cf8e6+'\x20--enriched'+_0x8d8256));}[a22_0x2df86f(0x258)](_0x5a462e){const _0x53a82e=a22_0x2df86f,{master:_0x304072}=_0x5a462e,_0x1ddc53=_0x304072[_0x53a82e(0x280)]?a22_0x2534e9['green']('✔'):a22_0x2534e9[_0x53a82e(0x1a9)]('✘');console[_0x53a82e(0x17b)]('\x0a'+a22_0x2534e9[_0x53a82e(0x16f)](_0x53a82e(0x17e))),console['error'](_0x1ddc53+'\x20'+a22_0x2534e9[_0x53a82e(0x1d4)](_0x304072[_0x53a82e(0x223)]+'.'+_0x304072[_0x53a82e(0x2ba)])),_0x304072[_0x53a82e(0x280)]?_0x304072[_0x53a82e(0x15c)]!==undefined&&console[_0x53a82e(0x17b)]('\x20\x20'+a22_0x2534e9['dim'](_0x53a82e(0x24d))+'\x20'+a22_0x2534e9[_0x53a82e(0x274)](formatRows(_0x304072[_0x53a82e(0x15c)]))):console[_0x53a82e(0x17b)]('\x20\x20'+a22_0x2534e9[_0x53a82e(0x1a9)](_0x53a82e(0x1a0))+'\x20'+_0x304072['schemaError']);}[a22_0x2df86f(0x251)](_0x27caf9){const _0x11e6d1=a22_0x2df86f;if(_0x27caf9[_0x11e6d1(0x22f)][_0x11e6d1(0x2b3)]===0x0)return;console['error']('\x0a'+a22_0x2534e9[_0x11e6d1(0x16f)](_0x11e6d1(0x1fb)));for(const _0x479a3a of _0x27caf9[_0x11e6d1(0x22f)]){const _0x1dbf7f=_0x479a3a[_0x11e6d1(0x280)]?a22_0x2534e9[_0x11e6d1(0x216)]('✔'):a22_0x2534e9[_0x11e6d1(0x1a9)]('✘');let _0xbf8e98='';if(_0x479a3a[_0x11e6d1(0x280)]&&_0x479a3a['matchedCount']!==undefined&&_0x479a3a[_0x11e6d1(0x1c6)]!==undefined){const _0x1f9bc3=_0x479a3a[_0x11e6d1(0x1c6)][_0x11e6d1(0x2a6)](0x1),_0xe107c0=_0x479a3a[_0x11e6d1(0x1c6)]>=0x50?a22_0x2534e9[_0x11e6d1(0x216)]:_0x479a3a[_0x11e6d1(0x1c6)]>=0x32?a22_0x2534e9['yellow']:a22_0x2534e9[_0x11e6d1(0x1a9)];_0xbf8e98='\x20'+a22_0x2534e9[_0x11e6d1(0x16f)](_0x11e6d1(0x295))+'\x20'+_0xe107c0(_0x1f9bc3+'%')+'\x20('+formatRows(_0x479a3a['matchedCount'])+'\x20rows)';}console['error'](_0x1dbf7f+'\x20'+a22_0x2534e9['bold'](_0x479a3a[_0x11e6d1(0x164)])+_0xbf8e98),console['error']('\x20\x20'+a22_0x2534e9[_0x11e6d1(0x16f)](_0x11e6d1(0x17c))+'\x20'+a22_0x2534e9[_0x11e6d1(0x1d4)](_0x479a3a['database']+'.'+_0x479a3a[_0x11e6d1(0x2ba)]));const _0xd964cf=_0x479a3a[_0x11e6d1(0x28d)]===_0x479a3a['foreignKey']?a22_0x2534e9['dim'](_0x11e6d1(0x26f))+'\x20'+_0x479a3a[_0x11e6d1(0x28d)]:a22_0x2534e9[_0x11e6d1(0x16f)](_0x11e6d1(0x247))+'\x20'+_0x479a3a['joinKey']+'\x20=\x20'+_0x479a3a[_0x11e6d1(0x19b)];console['error']('\x20\x20'+_0xd964cf),console['error']('\x20\x20'+a22_0x2534e9[_0x11e6d1(0x16f)](_0x11e6d1(0x2dd))),this['displayColumns'](_0x479a3a[_0x11e6d1(0x26c)]),!_0x479a3a['schemaValid']&&console[_0x11e6d1(0x17b)]('\x20\x20'+a22_0x2534e9[_0x11e6d1(0x1a9)](_0x11e6d1(0x1a0))+'\x20'+_0x479a3a['schemaError']);}}[a22_0x2df86f(0x270)](_0x12157a,_0x29f4cd){const _0x13383e=a22_0x2df86f;if(_0x12157a['behaviors'][_0x13383e(0x2b3)]===0x0)return;console[_0x13383e(0x17b)]('\x0a'+a22_0x2534e9[_0x13383e(0x16f)]('Behaviors')+'\x20'+a22_0x2534e9['dim']('('+_0x29f4cd+')'));for(const _0x2f8324 of _0x12157a[_0x13383e(0x21a)]){const _0x2f7f88=_0x2f8324[_0x13383e(0x280)]?a22_0x2534e9[_0x13383e(0x216)]('✔'):a22_0x2534e9[_0x13383e(0x1a9)]('✘');let _0x2825a9='';if(_0x2f8324[_0x13383e(0x280)]&&_0x2f8324['customersWithEvents']!==undefined&&_0x2f8324[_0x13383e(0x23d)]!==undefined){const _0x839ef4=_0x2f8324['customerPercent']?.[_0x13383e(0x2a6)](0x1)||'?',_0xfa758d=(_0x2f8324[_0x13383e(0x2c0)]??0x0)>=0x32?a22_0x2534e9[_0x13383e(0x216)]:(_0x2f8324[_0x13383e(0x2c0)]??0x0)>=0x14?a22_0x2534e9['yellow']:a22_0x2534e9[_0x13383e(0x1a9)];_0x2825a9='\x20'+a22_0x2534e9['dim'](_0x13383e(0x24e))+'\x20'+_0xfa758d(formatRows(_0x2f8324[_0x13383e(0x263)]))+'\x20('+_0x839ef4+_0x13383e(0x2d2)+a22_0x2534e9[_0x13383e(0x16f)](_0x13383e(0x205))+'\x20'+a22_0x2534e9['cyan'](formatRows(_0x2f8324[_0x13383e(0x23d)]));}console['error'](_0x2f7f88+'\x20'+a22_0x2534e9[_0x13383e(0x1d4)](_0x2f8324[_0x13383e(0x164)])+_0x2825a9),console['error']('\x20\x20'+a22_0x2534e9[_0x13383e(0x16f)]('Source:')+'\x20'+a22_0x2534e9[_0x13383e(0x1d4)](_0x2f8324[_0x13383e(0x223)]+'.'+_0x2f8324['table']));const _0xd216a=_0x2f8324['joinKey']===_0x2f8324[_0x13383e(0x19b)]?a22_0x2534e9[_0x13383e(0x16f)](_0x13383e(0x26f))+'\x20'+_0x2f8324[_0x13383e(0x28d)]:a22_0x2534e9[_0x13383e(0x16f)](_0x13383e(0x247))+'\x20'+_0x2f8324[_0x13383e(0x28d)]+_0x13383e(0x194)+_0x2f8324[_0x13383e(0x19b)];console[_0x13383e(0x17b)]('\x20\x20'+_0xd216a),console[_0x13383e(0x17b)]('\x20\x20'+a22_0x2534e9[_0x13383e(0x16f)]('Columns:')),this[_0x13383e(0x1be)](_0x2f8324[_0x13383e(0x26c)]),!_0x2f8324[_0x13383e(0x280)]&&console[_0x13383e(0x17b)]('\x20\x20'+a22_0x2534e9['red'](_0x13383e(0x1a0))+'\x20'+_0x2f8324[_0x13383e(0x1b3)]);}}[a22_0x2df86f(0x1be)](_0x1fcdf8){const _0x1cd65a=a22_0x2df86f;for(const _0x3bebe1 of _0x1fcdf8){_0x3bebe1['label']===_0x3bebe1[_0x1cd65a(0x1eb)]||_0x3bebe1[_0x1cd65a(0x1eb)]==='*'?console[_0x1cd65a(0x17b)](_0x1cd65a(0x1bc)+_0x3bebe1[_0x1cd65a(0x27c)]):console[_0x1cd65a(0x17b)](_0x1cd65a(0x1bc)+_0x3bebe1[_0x1cd65a(0x27c)]+'\x20'+a22_0x2534e9[_0x1cd65a(0x16f)]('('+_0x3bebe1[_0x1cd65a(0x1eb)]+')'));}}[a22_0x2df86f(0x211)](_0x33bef8){const _0x5b9769=a22_0x2df86f;console[_0x5b9769(0x17b)]('─'['repeat'](0x3c));if(_0x33bef8['errors']['length']>0x0){console[_0x5b9769(0x17b)]('\x0a'+a22_0x2534e9[_0x5b9769(0x1a9)](_0x5b9769(0x2b5)));for(const _0x14fa8d of _0x33bef8[_0x5b9769(0x15d)]){console[_0x5b9769(0x17b)]('\x20\x20'+a22_0x2534e9[_0x5b9769(0x1a9)]('•')+'\x20'+_0x14fa8d);}}_0x33bef8[_0x5b9769(0x2ae)]&&console[_0x5b9769(0x17b)]('\x0a'+a22_0x2534e9['green']('✔')+_0x5b9769(0x1b8));}}function a22_0x2d13(_0x241501,_0x41df2f){_0x241501=_0x241501-0x140;const _0x3b2ee8=a22_0x3b2e();let _0x2d1338=_0x3b2ee8[_0x241501];return _0x2d1338;}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']='segment:parent:preview';['description']=a22_0x2df86f(0x283);async[a22_0x2df86f(0x185)](_0x16bef5){const _0x2aa020=a22_0x2df86f,{options:_0x5c7336,args:_0xdabb72,tdx:_0x103b8e}=_0x16bef5,_0xbfefaa=_0x5c7336,_0x3bc836=_0xdabb72[0x0]||_0x5c7336[_0x2aa020(0x26d)];if(!_0x3bc836)return showParentSegmentNotSetError(_0x2aa020(0x21c)+_0x2aa020(0x242)+_0x2aa020(0x23a)+_0x2aa020(0x230)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x2aa020(0x2ce)+_0x2aa020(0x217)+_0x2aa020(0x1c9)),0x1;if(!_0xbfefaa[_0x2aa020(0x27d)]&&!_0xbfefaa[_0x2aa020(0x213)]&&!_0xbfefaa[_0x2aa020(0x1a4)]&&!_0xbfefaa[_0x2aa020(0x2bc)])return console[_0x2aa020(0x17b)](a22_0x2534e9['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x2aa020(0x1c2)),console['error'](_0x2aa020(0x250)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x2aa020(0x17b)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x2aa020(0x17b)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x2aa020(0x17b)](_0x2aa020(0x287)),0x1;const _0x2d6738=resolveYamlFile(_0x3bc836);if(!existsSync(_0x2d6738))return showFileNotFoundError(_0x2d6738,_0x3bc836),0x1;_0xbfefaa[_0x2aa020(0x2c2)]&&(console[_0x2aa020(0x17b)](_0x2aa020(0x25e)+_0xbfefaa['site']),console['error'](_0x2aa020(0x272)+_0x2d6738));let _0x5411f0;try{_0x5411f0=readFileSync(_0x2d6738,'utf-8');}catch(_0x4efdbe){const _0x514edd=_0x4efdbe instanceof Error?_0x4efdbe[_0x2aa020(0x1d5)]:String(_0x4efdbe);return console[_0x2aa020(0x17b)](_0x2aa020(0x27e)+_0x514edd),0x1;}let _0x33dac9;try{_0x33dac9=parseDef(_0x5411f0);}catch(_0xa50002){const _0x371fd3=_0xa50002 instanceof Error?_0xa50002['message']:String(_0xa50002);return console[_0x2aa020(0x17b)](a22_0x2534e9[_0x2aa020(0x1a9)](_0x2aa020(0x241)+_0x371fd3)),0x1;}if(_0xbfefaa[_0x2aa020(0x213)]===!![]||_0xbfefaa[_0x2aa020(0x213)]===''){const _0x36f2c5=_0x33dac9[_0x2aa020(0x22f)]?.[_0x2aa020(0x298)](_0x319e00=>_0x319e00[_0x2aa020(0x164)])||[];if(_0x36f2c5[_0x2aa020(0x2b3)]===0x0)console['error'](a22_0x2534e9[_0x2aa020(0x1a9)](_0x2aa020(0x2cf)));else{console[_0x2aa020(0x17b)](a22_0x2534e9[_0x2aa020(0x1a9)](_0x2aa020(0x219))),console[_0x2aa020(0x17b)](_0x2aa020(0x14d));for(const _0x4ef322 of _0x36f2c5){console[_0x2aa020(0x17b)]('\x20\x20'+a22_0x2534e9[_0x2aa020(0x274)](_0x4ef322));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3bc836+_0x2aa020(0x299)+_0x36f2c5[0x0]+'\x22');}return 0x1;}if(_0xbfefaa['behavior']===!![]||_0xbfefaa[_0x2aa020(0x1a4)]===''){const _0x328199=_0x33dac9[_0x2aa020(0x21a)]?.[_0x2aa020(0x298)](_0x3fa628=>_0x3fa628[_0x2aa020(0x164)])||[];if(_0x328199[_0x2aa020(0x2b3)]===0x0)console['error'](a22_0x2534e9['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a22_0x2534e9[_0x2aa020(0x1a9)](_0x2aa020(0x1cd))),console[_0x2aa020(0x17b)](_0x2aa020(0x2c8));for(const _0x172199 of _0x328199){console[_0x2aa020(0x17b)]('\x20\x20'+a22_0x2534e9[_0x2aa020(0x274)](_0x172199));}console[_0x2aa020(0x17b)](_0x2aa020(0x149)+_0x3bc836+_0x2aa020(0x2b8)+_0x328199[0x0]+'\x22');}return 0x1;}const _0x26ad90=createCommandSpinner(a22_0x2534e9['dim'](_0x2aa020(0x14e)),{'verbose':_0xbfefaa['verbose']});_0x26ad90[_0x2aa020(0x179)]();const _0x13362a={'onProgress':_0x3af835=>{const _0xb02d20=_0x2aa020;_0x26ad90[_0xb02d20(0x28a)]=formatProgressMessage(_0x3af835);}};if(_0xbfefaa[_0x2aa020(0x27d)])_0x13362a[_0x2aa020(0x27d)]=!![];if(_0xbfefaa[_0x2aa020(0x213)]&&typeof _0xbfefaa[_0x2aa020(0x213)]===_0x2aa020(0x156))_0x13362a[_0x2aa020(0x213)]=_0xbfefaa[_0x2aa020(0x213)];if(_0xbfefaa['behavior']&&typeof _0xbfefaa[_0x2aa020(0x1a4)]==='string')_0x13362a[_0x2aa020(0x1a4)]=_0xbfefaa[_0x2aa020(0x1a4)];if(_0xbfefaa['enriched'])_0x13362a[_0x2aa020(0x2bc)]=!![];if(_0xbfefaa[_0x2aa020(0x22e)])_0x13362a[_0x2aa020(0x22e)]=_0xbfefaa[_0x2aa020(0x22e)];let _0x200346;try{_0x200346=await _0x103b8e[_0x2aa020(0x1d2)][_0x2aa020(0x167)](_0x5411f0,_0x13362a),_0x26ad90[_0x2aa020(0x199)]();}catch(_0x5ea434){_0x26ad90[_0x2aa020(0x199)]();throw _0x5ea434;}return await this[_0x2aa020(0x28f)](_0x200346,{'master':_0xbfefaa[_0x2aa020(0x27d)],'attribute':typeof _0xbfefaa['attribute']==='string'?_0xbfefaa[_0x2aa020(0x213)]:undefined,'behavior':typeof _0xbfefaa['behavior']===_0x2aa020(0x156)?_0xbfefaa['behavior']:undefined,'enriched':_0xbfefaa[_0x2aa020(0x2bc)]}),_0x200346['allValid']?0x0:0x1;}async[a22_0x2df86f(0x28f)](_0x30610e,_0x30b7dc){const _0x42375f=a22_0x2df86f;console[_0x42375f(0x17b)]('\x0a'+a22_0x2534e9[_0x42375f(0x1d4)]('Preview:')+'\x20'+_0x30610e['name']),console[_0x42375f(0x17b)]('═'[_0x42375f(0x2a0)](0x3c));if(_0x30b7dc[_0x42375f(0x27d)]&&_0x30610e['sampleData']){const _0x3b7446=a22_0x2534e9[_0x42375f(0x16f)]('Master:')+'\x20'+a22_0x2534e9[_0x42375f(0x1d4)](_0x30610e['master'][_0x42375f(0x223)]+'.'+_0x30610e[_0x42375f(0x27d)][_0x42375f(0x2ba)]);await this[_0x42375f(0x1e7)](_0x3b7446,_0x30610e[_0x42375f(0x224)]);}else{if(_0x30b7dc[_0x42375f(0x213)]&&_0x30610e[_0x42375f(0x224)]){const _0x24ddfa=a22_0x2534e9[_0x42375f(0x16f)](_0x42375f(0x271))+'\x20'+a22_0x2534e9['bold'](_0x30b7dc[_0x42375f(0x213)]);await this['displaySampleData'](_0x24ddfa,_0x30610e[_0x42375f(0x224)]);}else{if(_0x30b7dc[_0x42375f(0x1a4)]&&_0x30610e[_0x42375f(0x224)]){const _0x594514=a22_0x2534e9[_0x42375f(0x16f)](_0x42375f(0x249))+'\x20'+a22_0x2534e9[_0x42375f(0x1d4)](_0x30b7dc['behavior']);await this[_0x42375f(0x1e7)](_0x594514,_0x30610e[_0x42375f(0x224)]);}else{if(_0x30b7dc[_0x42375f(0x2bc)]&&_0x30610e[_0x42375f(0x224)]){const _0x5be7bb=a22_0x2534e9[_0x42375f(0x16f)]('Enriched:')+'\x20'+a22_0x2534e9[_0x42375f(0x1d4)](_0x42375f(0x1a1));await this[_0x42375f(0x1e7)](_0x5be7bb,_0x30610e['sampleData']);}else!_0x30610e[_0x42375f(0x224)]&&console[_0x42375f(0x17b)](_0x42375f(0x1d0));}}}if(_0x30610e['errors'][_0x42375f(0x2b3)]>0x0){console[_0x42375f(0x17b)]('─'[_0x42375f(0x2a0)](0x3c)),console[_0x42375f(0x17b)]('\x0a'+a22_0x2534e9[_0x42375f(0x1a9)](_0x42375f(0x2b5)));for(const _0x970b41 of _0x30610e[_0x42375f(0x15d)]){console[_0x42375f(0x17b)]('\x20\x20'+a22_0x2534e9['red']('•')+'\x20'+_0x970b41);}}}async[a22_0x2df86f(0x1e7)](_0x5ab558,_0x431e7a){const _0x5d949a=a22_0x2df86f;if(_0x431e7a[_0x5d949a(0x2b3)]===0x0){console['error']('\x0a'+_0x5ab558),console[_0x5d949a(0x17b)](_0x5d949a(0x192));return;}console[_0x5d949a(0x17b)]('\x0a'+_0x5ab558);const _0x51659d=Object[_0x5d949a(0x18b)](_0x431e7a[0x0])[_0x5d949a(0x298)](_0x1bc0bb=>({'name':_0x1bc0bb,'type':typeof _0x431e7a[0x0][_0x1bc0bb]===_0x5d949a(0x166)?'double':_0x5d949a(0x2c1)})),_0x563426={'queryId':'preview','columns':_0x51659d,'data':_0x431e7a,'stats':{'state':_0x5d949a(0x1f8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x431e7a['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x47db8c=formatAsTable(_0x563426,_0x431e7a['length'],!![]);await writeOutput(_0x47db8c,undefined,_0x5d949a(0x2ba));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x2df86f(0x164)]='segment:parent:run';['description']=a22_0x2df86f(0x1d1);async[a22_0x2df86f(0x185)](_0x407c2d){const _0x449182=a22_0x2df86f,{options:_0x551632,args:_0x4ff289,tdx:_0x227c13}=_0x407c2d,_0x391a32=_0x551632,_0x4fdeac=_0x4ff289[0x0]||_0x551632[_0x449182(0x26d)];if(!_0x4fdeac)return showParentSegmentNotSetError(_0x449182(0x1cf)+_0x449182(0x143)),0x1;const _0x5db703=resolveYamlFile(_0x4fdeac);if(existsSync(_0x5db703)){_0x391a32[_0x449182(0x2c2)]&&console[_0x449182(0x17b)](_0x449182(0x222)+_0x5db703);let _0x202ed3;try{_0x202ed3=readFileSync(_0x5db703,_0x449182(0x2d0));}catch(_0x28b1ca){const _0x470298=_0x28b1ca instanceof Error?_0x28b1ca[_0x449182(0x1d5)]:String(_0x28b1ca);return console['error'](_0x449182(0x27e)+_0x470298),0x1;}const _0x17efd1=await withSpinner(_0x449182(0x203),()=>_0x227c13[_0x449182(0x1d2)][_0x449182(0x155)](_0x202ed3),{'verbose':_0x391a32[_0x449182(0x2c2)]}),_0x4533da=_0x17efd1[_0x449182(0x1bd)],{isNew:_0x450712,name:_0x20f8b7,hasChanges:_0x8b7d36,diffFormatted:_0x143c66}=_0x4533da;if(_0x8b7d36){_0x450712?console[_0x449182(0x17b)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x20f8b7+'\x27:'):console[_0x449182(0x17b)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x20f8b7+'\x27:');console[_0x449182(0x17b)]('─'[_0x449182(0x2a0)](0x3c)),console['error'](_0x143c66),console['error']('─'['repeat'](0x3c));const _0xecd55b=_0x450712?_0x449182(0x29e)+_0x20f8b7+_0x449182(0x28e):'Apply\x20changes\x20to\x20\x27'+_0x20f8b7+_0x449182(0x28e);if(!_0x391a32[_0x449182(0x1f3)]){if(!isInteractive())return console[_0x449182(0x17b)](a22_0x2534e9[_0x449182(0x1a9)](_0x449182(0x20e)),_0x449182(0x2be)),console[_0x449182(0x17b)](a22_0x2534e9[_0x449182(0x16f)](_0x449182(0x2a1))),0x1;const _0x1458e5=await confirmKey(_0xecd55b);if(!_0x1458e5)return console['error'](a22_0x2534e9[_0x449182(0x157)](_0x449182(0x1db))),0x1;}const _0x31e071=_0x450712?_0x449182(0x2b7):_0x449182(0x1c7);await withSpinner(_0x31e071+'\x20parent\x20segment\x20\x27'+_0x20f8b7+_0x449182(0x257),()=>_0x4533da[_0x449182(0x1ff)](),{'verbose':_0x391a32[_0x449182(0x2c2)]});const _0xd43c41=_0x450712?'Created':'Updated';console[_0x449182(0x17b)]('✔\x20'+_0xd43c41+'\x20parent\x20segment\x20\x27'+_0x20f8b7+'\x27');}else console[_0x449182(0x17b)](_0x449182(0x27a)+_0x20f8b7+_0x449182(0x239));}const _0x19f53a=await withSpinner(_0x449182(0x195)+_0x4fdeac+_0x449182(0x257),()=>_0x227c13[_0x449182(0x1d2)][_0x449182(0x152)](_0x4fdeac),{'verbose':_0x391a32[_0x449182(0x2c2)]}),_0x34619c=_0x19f53a[_0x449182(0x1bd)],_0xd80da1=getConsoleUrl(_0x391a32['site'],_0x449182(0x209)+_0x34619c[_0x449182(0x268)]+'/sessions/'+_0x34619c['workflowSessionId']+_0x449182(0x2a8)+_0x34619c[_0x449182(0x23e)]);return console['error'](_0x449182(0x22a)),console[_0x449182(0x17b)]('\x20\x20'+a22_0x2534e9[_0x449182(0x16f)](_0x449182(0x2c4))+'\x20'+_0x34619c[_0x449182(0x17f)]),console[_0x449182(0x17b)]('\x20\x20'+a22_0x2534e9[_0x449182(0x16f)](_0x449182(0x2d1))+'\x20'+_0x34619c[_0x449182(0x1a2)]),console[_0x449182(0x17b)]('\x20\x20'+a22_0x2534e9[_0x449182(0x16f)](_0x449182(0x1ed))+'\x20'+_0x34619c[_0x449182(0x234)]),console[_0x449182(0x17b)]('\x20\x20'+a22_0x2534e9['dim']('Attempt:')+'\x20'+_0x34619c[_0x449182(0x23e)]),console[_0x449182(0x17b)]('\x20\x20'+_0xd80da1),console[_0x449182(0x17b)]('\x0a'+a22_0x2534e9['dim'](_0x449182(0x278))+_0x449182(0x171)+_0x34619c['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x162);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x174);async[a22_0x2df86f(0x185)](_0xd0064c){const _0x26f4e2=a22_0x2df86f,{options:_0x37bc4e,args:_0x3fc05c,tdx:_0x118794}=_0xd0064c,_0x5cd643=_0x3fc05c[0x0]||_0x37bc4e[_0x26f4e2(0x26d)];if(!_0x5cd643)return showParentSegmentNotSetError(_0x26f4e2(0x2d8)+_0x26f4e2(0x293)),0x1;_0x37bc4e[_0x26f4e2(0x2c2)]&&(console[_0x26f4e2(0x17b)]('Site:\x20'+_0x37bc4e['site']),console[_0x26f4e2(0x17b)](_0x26f4e2(0x1e5)+_0x5cd643));const _0x1fcb91=await withSpinner(_0x26f4e2(0x22b)+_0x5cd643+_0x26f4e2(0x257),()=>_0x118794[_0x26f4e2(0x1d2)][_0x26f4e2(0x1dd)](_0x5cd643),{'verbose':_0x37bc4e[_0x26f4e2(0x2c2)]}),_0x30b248=_0x1fcb91['data'];console[_0x26f4e2(0x17b)](_0x26f4e2(0x1ac)+_0x30b248['length']+_0x26f4e2(0x20a)+(_0x30b248[_0x26f4e2(0x2b3)]!==0x1?'s':''));if(_0x37bc4e['json']||_0x37bc4e[_0x26f4e2(0x2c6)])return await handleSDKOutput(_0x30b248,_0x37bc4e),0x0;return displayFieldsHumanReadable(_0x30b248,_0x5cd643),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x23b);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x2cb);async['execute'](_0x5d1850){const _0x589867=a22_0x2df86f,{options:_0x201b8b,args:_0x47e528,tdx:_0x3fcab4}=_0x5d1850,_0x3d016b=_0x201b8b,_0x15d818=_0x47e528[0x0]||_0x201b8b[_0x589867(0x26d)];if(!_0x15d818)return showParentSegmentNotSetError(_0x589867(0x2c7)+_0x589867(0x253)+_0x589867(0x2a7)+_0x589867(0x20b)),0x1;_0x201b8b['verbose']&&(console['error'](_0x589867(0x25e)+_0x201b8b[_0x589867(0x186)]),console[_0x589867(0x17b)]('Parent\x20segment:\x20'+_0x15d818));const _0x34055d=await withSpinner(_0x589867(0x24c)+_0x15d818+_0x589867(0x257),()=>_0x3fcab4[_0x589867(0x1d2)][_0x589867(0x15f)](_0x15d818),{'verbose':_0x201b8b[_0x589867(0x2c2)]}),_0x52d2f0=_0x34055d[_0x589867(0x1bd)];if(_0x3d016b[_0x589867(0x2dc)]){const _0x391fe5=getConsoleNextUrl(_0x3d016b[_0x589867(0x186)],'/app/dw/parentSegments/'+_0x52d2f0['id']);return console['error'](a22_0x2534e9[_0x589867(0x216)]('✔')+_0x589867(0x296)+a22_0x2534e9['cyan'](_0x391fe5)),openBrowser(_0x391fe5),0x0;}return await handleSingleObjectOutput(_0x52d2f0,_0x201b8b),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x232);[a22_0x2df86f(0x27b)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a22_0x2df86f(0x185)](_0x594c22){const _0x511b66=a22_0x2df86f,{options:_0x57c467,args:_0x1b5db8,tdx:_0x472439}=_0x594c22,_0x4a461b=_0x57c467,_0x1824d3=_0x1b5db8[0x0]||_0x57c467[_0x511b66(0x26d)];if(!_0x1824d3)return showParentSegmentNotSetError(_0x511b66(0x24f)+_0x511b66(0x1fc)+_0x511b66(0x2a7)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x57c467['verbose']&&(console[_0x511b66(0x17b)](_0x511b66(0x25e)+_0x57c467['site']),console[_0x511b66(0x17b)](_0x511b66(0x1e5)+_0x1824d3));const _0x579a58=await withSpinner(_0x511b66(0x183)+_0x1824d3+'\x27...',()=>_0x472439[_0x511b66(0x1d2)][_0x511b66(0x1cc)](_0x1824d3),{'verbose':_0x57c467['verbose']}),_0x190506=_0x579a58['data'],_0xb790f4=_0x472439[_0x511b66(0x1d2)][_0x511b66(0x288)](_0x190506);if(_0x4a461b[_0x511b66(0x259)]){const _0x203798=await this['collectSchema'](_0x594c22,_0x1824d3,_0x190506,_0xb790f4),_0x2ea407=this['formatSchemaJson'](_0x203798);writeFileSync(_0x4a461b['output'],_0x2ea407);const _0x5620c0=_0x203798['customers'][_0x511b66(0x26c)][_0x511b66(0x2b3)]+_0x203798['behaviors'][_0x511b66(0x2b0)]((_0x1a7663,_0x94ef60)=>_0x1a7663+_0x94ef60[_0x511b66(0x26c)][_0x511b66(0x2b3)],0x0),_0x218690=_0x203798[_0x511b66(0x21a)][_0x511b66(0x17d)](_0x36b29e=>_0x36b29e[_0x511b66(0x26c)][_0x511b66(0x2b3)]===0x0)[_0x511b66(0x2b3)];return console[_0x511b66(0x25a)](_0x511b66(0x25b)+_0x4a461b[_0x511b66(0x259)]),console[_0x511b66(0x25a)](_0x511b66(0x21b)+_0xb790f4),console[_0x511b66(0x25a)](_0x511b66(0x207)+_0x203798[_0x511b66(0x21a)][_0x511b66(0x2b3)]+_0x511b66(0x208)),console['log']('\x20\x20Columns:\x20'+_0x5620c0+_0x511b66(0x1c5)),_0x218690>0x0&&console[_0x511b66(0x25a)](_0x511b66(0x14a)+_0x218690+_0x511b66(0x1c1)),0x0;}console['error']('\x0a'+a22_0x2534e9[_0x511b66(0x1d4)](_0x511b66(0x248))+'\x20'+a22_0x2534e9[_0x511b66(0x274)](_0xb790f4));const _0x36c3b0=await withSpinner(_0x511b66(0x235),()=>_0x472439[_0x511b66(0x1d2)][_0x511b66(0x210)](_0x190506),{'verbose':_0x57c467[_0x511b66(0x2c2)]});console[_0x511b66(0x17b)]('\x0a'+a22_0x2534e9[_0x511b66(0x1d4)](_0x511b66(0x1ad))+'\x20'+a22_0x2534e9['dim']('('+_0xb790f4+_0x511b66(0x1b5)));const _0x3f8f55=await executeSchemaQuery(_0x36c3b0[_0x511b66(0x1bd)],_0x472439,_0x57c467);await handleQueryOutput(_0x3f8f55,_0x57c467);const _0x3e3981=await withSpinner(_0x511b66(0x1bf),()=>_0x472439['segment'][_0x511b66(0x201)](_0x190506),{'verbose':_0x57c467[_0x511b66(0x2c2)]});for(const _0x3ce738 of _0x3e3981[_0x511b66(0x1bd)]){const _0x4b47b9=_0x511b66(0x2af)+_0x3ce738[_0x511b66(0x196)]()[_0x511b66(0x197)](/\s+/g,'_'),_0x5155ec='SELECT\x20*\x20FROM\x20'+_0xb790f4+'.'+_0x4b47b9;console[_0x511b66(0x17b)]('\x0a'+a22_0x2534e9[_0x511b66(0x1d4)](_0x3ce738)+'\x20'+a22_0x2534e9[_0x511b66(0x16f)]('('+_0xb790f4+'.'+_0x4b47b9+')'));try{const _0x40233b=await executeSchemaQuery(_0x5155ec,_0x472439,_0x57c467);await handleQueryOutput(_0x40233b,_0x57c467);}catch{console[_0x511b66(0x17b)](a22_0x2534e9[_0x511b66(0x157)](_0x511b66(0x1a5)));}}return 0x0;}async[a22_0x2df86f(0x16c)](_0xb69558,_0x142536,_0x2a0940,_0x220bdf){const _0x1ce5f0=a22_0x2df86f,{options:_0x9ce4ce,tdx:_0x2b2070}=_0xb69558,_0x5832f1=await withSpinner(_0x1ce5f0(0x235),()=>_0x2b2070[_0x1ce5f0(0x1d2)]['getParentSQL'](_0x2a0940),{'verbose':_0x9ce4ce[_0x1ce5f0(0x2c2)]}),_0x473f1b=await executeSchemaQuery(_0x5832f1[_0x1ce5f0(0x1bd)],_0x2b2070,_0x9ce4ce),_0x494478=_0x473f1b[_0x1ce5f0(0x1bd)][_0x1ce5f0(0x298)](_0x5358b9=>({'name':_0x5358b9['column_name'],'type':_0x5358b9[_0x1ce5f0(0x17a)]})),_0x4fe167=await withSpinner(_0x1ce5f0(0x1bf),()=>_0x2b2070['segment'][_0x1ce5f0(0x201)](_0x2a0940),{'verbose':_0x9ce4ce[_0x1ce5f0(0x2c2)]}),_0x2fb4f3=[];for(const _0x44f595 of _0x4fe167[_0x1ce5f0(0x1bd)]){const _0x194d4c=_0x1ce5f0(0x2af)+_0x44f595[_0x1ce5f0(0x196)]()[_0x1ce5f0(0x197)](/\s+/g,'_'),_0x1ef79d='SELECT\x20*\x20FROM\x20'+_0x220bdf+'.'+_0x194d4c;let _0x255530=[];try{const _0x3b51ff=await executeSchemaQuery(_0x1ef79d,_0x2b2070,_0x9ce4ce);_0x255530=_0x3b51ff['data'][_0x1ce5f0(0x298)](_0x92af29=>({'name':_0x92af29[_0x1ce5f0(0x1f5)],'type':_0x92af29[_0x1ce5f0(0x17a)]}));}catch{}_0x2fb4f3[_0x1ce5f0(0x20c)]({'table':_0x194d4c,'columns':_0x255530});}return{'database':_0x220bdf,'parent_segment':_0x142536,'parent_id':_0x2a0940,'customers':{'table':_0x1ce5f0(0x1ad),'columns':_0x494478},'behaviors':_0x2fb4f3};}['formatSchemaJson'](_0x2e31d7){const _0xa5b12=a22_0x2df86f,_0x5c4ab6=_0xe97154=>{const _0x17a38=a22_0x2d13;if(_0xe97154[_0x17a38(0x2b3)]===0x0)return'[]';const _0x12e251=_0xe97154[_0x17a38(0x298)](_0x57d356=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x57d356[_0x17a38(0x164)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x57d356[_0x17a38(0x189)]+_0x17a38(0x145));return'[\x0a'+_0x12e251['join'](',\x0a')+_0x17a38(0x22c);},_0x5e2689=_0x2e31d7['behaviors']['map'](_0x5de792=>{const _0x4e6669=a22_0x2d13;return _0x4e6669(0x2b2)+_0x5de792[_0x4e6669(0x2ba)]+_0x4e6669(0x191)+_0x5c4ab6(_0x5de792[_0x4e6669(0x26c)])[_0x4e6669(0x197)](/^/gm,'\x20\x20')['trim']()+_0x4e6669(0x1fa);})[_0xa5b12(0x1b9)](',\x0a');return _0xa5b12(0x1c4)+_0x2e31d7['database']+_0xa5b12(0x1cb)+_0x2e31d7[_0xa5b12(0x29b)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x2e31d7[_0xa5b12(0x20d)]+_0xa5b12(0x1f7)+_0x2e31d7[_0xa5b12(0x1ad)][_0xa5b12(0x2ba)]+_0xa5b12(0x175)+_0x5c4ab6(_0x2e31d7[_0xa5b12(0x1ad)][_0xa5b12(0x26c)])[_0xa5b12(0x197)](/^/gm,'\x20\x20')[_0xa5b12(0x147)]()+_0xa5b12(0x277)+_0x5e2689+_0xa5b12(0x2bf);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x273);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x2cd);async[a22_0x2df86f(0x185)](_0x3f7f81){const _0x54fe9d=a22_0x2df86f,{options:_0x4dc4fa,args:_0x78ba0c,tdx:_0x3a4156}=_0x3f7f81,_0x46e351=_0x78ba0c[0x0]||_0x4dc4fa[_0x54fe9d(0x26d)];if(!_0x46e351)return showParentSegmentNotSetError(_0x54fe9d(0x28b)+_0x54fe9d(0x144)),0x1;_0x4dc4fa[_0x54fe9d(0x2c2)]&&(console['error'](_0x54fe9d(0x25e)+_0x4dc4fa[_0x54fe9d(0x186)]),console[_0x54fe9d(0x17b)]('Parent\x20segment:\x20'+_0x46e351));const _0x2ce580=await withSpinner(_0x54fe9d(0x183)+_0x46e351+'\x27...',()=>_0x3a4156[_0x54fe9d(0x1d2)][_0x54fe9d(0x1cc)](_0x46e351),{'verbose':_0x4dc4fa[_0x54fe9d(0x2c2)]}),_0x28ec55=_0x2ce580[_0x54fe9d(0x1bd)],_0x5dbc7f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x46e351+_0x54fe9d(0x257),()=>_0x3a4156[_0x54fe9d(0x1d2)]['getParentSQL'](_0x28ec55),{'verbose':_0x4dc4fa[_0x54fe9d(0x2c2)]}),_0x2967a0=_0x5dbc7f[_0x54fe9d(0x1bd)];return _0x4dc4fa[_0x54fe9d(0x243)]===_0x54fe9d(0x146)||_0x4dc4fa[_0x54fe9d(0x243)]===_0x54fe9d(0x2c6)?await handleSDKOutput([{'sql':_0x2967a0}],_0x4dc4fa):console[_0x54fe9d(0x25a)](_0x2967a0),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x291);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x1f9);async[a22_0x2df86f(0x185)](_0x4dede0){const _0x5cbf66=a22_0x2df86f,{options:_0x21d66a,args:_0xe9bcef,tdx:_0xb4c0f3}=_0x4dede0,_0x59a424=_0xe9bcef[0x0]||_0x21d66a['parentSegment'];if(!_0x59a424)return showParentSegmentNotSetError(_0x5cbf66(0x16b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x21d66a[_0x5cbf66(0x2c2)]&&(console[_0x5cbf66(0x17b)]('Site:\x20'+_0x21d66a['site']),console[_0x5cbf66(0x17b)](_0x5cbf66(0x1e5)+_0x59a424));const _0x44ad8c=await withSpinner(_0x5cbf66(0x183)+_0x59a424+_0x5cbf66(0x257),()=>_0xb4c0f3[_0x5cbf66(0x1d2)][_0x5cbf66(0x1cc)](_0x59a424),{'verbose':_0x21d66a['verbose']}),_0x45aded=_0x44ad8c[_0x5cbf66(0x1bd)],_0x164951=await withSpinner(_0x5cbf66(0x1f2)+_0x59a424+_0x5cbf66(0x257),()=>_0xb4c0f3['segment']['getParentSQL'](_0x45aded),{'verbose':_0x21d66a['verbose']});let _0x1c69d3=_0x164951['data'];const _0x1e5e20=resolveLimit(_0x21d66a[_0x5cbf66(0x26b)],DEFAULT_DISPLAY_LIMIT),_0x519a90=/\bLIMIT\s+\d+/i['test'](_0x1c69d3);!_0x519a90&&(_0x1c69d3=_0x1c69d3['trim']()[_0x5cbf66(0x197)](/;+$/,''),_0x1c69d3='SELECT\x20*\x20FROM\x20(\x0a'+_0x1c69d3+_0x5cbf66(0x29d)+_0x1e5e20);_0x21d66a['verbose']&&console[_0x5cbf66(0x17b)](_0x5cbf66(0x23c)+_0x1c69d3);const _0x218818=await withProgressSpinner(_0x5cbf66(0x14b),async _0x2d41ff=>{const _0x20b0f4=_0x5cbf66,_0x517897=await _0xb4c0f3[_0x20b0f4(0x1bb)][_0x20b0f4(0x185)](_0x1c69d3,{'catalog':'td','schema':_0x20b0f4(0x148),'onJobId':_0x4647b2=>{const _0x4d2742=_0x20b0f4;_0x2d41ff[_0x4d2742(0x226)](_0x4647b2);}});return _0x517897;},{'verbose':_0x21d66a[_0x5cbf66(0x2c2)]}),_0x19725d=_0x218818[_0x5cbf66(0x1bd)],_0x2961e6=_0x19725d[_0x5cbf66(0x212)]?_0x5cbf66(0x1e4)+_0x19725d['jobId']+']':'';return console[_0x5cbf66(0x17b)](_0x5cbf66(0x1ae)+_0x19725d[_0x5cbf66(0x294)][_0x5cbf66(0x198)][_0x5cbf66(0x14c)]()+_0x5cbf66(0x1a3)+(_0x5cbf66(0x1aa)+formatElapsed(_0x19725d[_0x5cbf66(0x294)][_0x5cbf66(0x176)])+_0x2961e6)),await handleQueryOutput(_0x19725d,_0x21d66a),0x0;}}export class PSRtListCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x24a);[a22_0x2df86f(0x27b)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x18a168){const _0x57c134=a22_0x2df86f,{options:_0x351aba,args:_0x4819d3,tdx:_0x5cf635}=_0x18a168,_0x50cfa1=_0x4819d3[0x0],_0x269e3a=await withSpinner(_0x50cfa1?_0x57c134(0x1ea)+_0x50cfa1+'\x27...':_0x57c134(0x228),()=>_0x5cf635['realtime'][_0x57c134(0x16d)](),{'verbose':_0x351aba['verbose']});let _0x340e08=_0x269e3a[_0x57c134(0x1bd)]['filter'](_0x566385=>_0x566385[_0x57c134(0x161)]);if(_0x50cfa1){const _0x4a52f1=_0x50cfa1[_0x57c134(0x197)](/[.+^${}()|[\]\\]/g,_0x57c134(0x2c9))['replace'](/\*/g,'.*')[_0x57c134(0x197)](/\?/g,'.'),_0x53bab8=new RegExp('^'+_0x4a52f1+'$','i');_0x340e08=_0x340e08[_0x57c134(0x17d)](_0x4df7d1=>_0x53bab8[_0x57c134(0x206)](_0x4df7d1[_0x57c134(0x164)]));}_0x340e08[_0x57c134(0x215)]((_0x786ca0,_0x574c45)=>_0x786ca0[_0x57c134(0x164)]['localeCompare'](_0x574c45['name'])),console[_0x57c134(0x17b)](_0x57c134(0x1ac)+_0x340e08[_0x57c134(0x2b3)]+'\x20RT-enabled\x20parent\x20segment'+(_0x340e08[_0x57c134(0x2b3)]!==0x1?'s':''));const _0x332ab4=_0x59de00=>{const _0x112e5c=_0x57c134;return getConsoleNextUrl(_0x351aba[_0x112e5c(0x186)],_0x112e5c(0x21d)+_0x59de00);};if(_0x351aba[_0x57c134(0x243)]===_0x57c134(0x146)||_0x351aba[_0x57c134(0x243)]==='jsonl'){const _0x46de1a=_0x340e08[_0x57c134(0x298)](_0x5d2ef8=>({..._0x5d2ef8,'url':_0x332ab4(_0x5d2ef8['id'])}));await handleSDKOutput(_0x46de1a,_0x351aba);}else{if(_0x340e08[_0x57c134(0x2b3)]===0x0)console[_0x57c134(0x25a)](_0x57c134(0x165));else for(const _0x5cd260 of _0x340e08){const _0x3d54c9=_0x5cd260[_0x57c134(0x2a2)]?a22_0x2534e9[_0x57c134(0x16f)]('\x20('+formatRows(_0x5cd260[_0x57c134(0x2a2)])+')'):'',_0x4521f9=hyperlink(_0x5cd260[_0x57c134(0x164)],_0x332ab4(_0x5cd260['id']));console[_0x57c134(0x25a)]('⚡\x20'+_0x4521f9+_0x3d54c9);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x2df86f(0x193);[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x1e9);async[a22_0x2df86f(0x185)](_0x54b8de){const _0x45b69a=a22_0x2df86f,{options:_0x513132,args:_0x582b14,tdx:_0xa54217}=_0x54b8de,_0x3b0448=_0x582b14[0x0]||_0x513132[_0x45b69a(0x26d)];if(!_0x3b0448)return showParentSegmentNotSetError(_0x45b69a(0x1b7)+_0x45b69a(0x256)),0x1;const _0x57408f=resolveYamlFile(_0x3b0448);if(!existsSync(_0x57408f))return showFileNotFoundError(_0x57408f,_0x3b0448),0x1;let _0x55fc44;try{_0x55fc44=readFileSync(_0x57408f,_0x45b69a(0x2d0));}catch(_0xce8ac5){const _0x2e2a43=_0xce8ac5 instanceof Error?_0xce8ac5[_0x45b69a(0x1d5)]:String(_0xce8ac5);return console[_0x45b69a(0x17b)](_0x45b69a(0x27e)+_0x2e2a43),0x1;}const _0x2568b9=createCommandSpinner(a22_0x2534e9[_0x45b69a(0x16f)](_0x45b69a(0x1e8)),{'verbose':_0x513132['verbose']});_0x2568b9[_0x45b69a(0x179)]();const _0x2b48f7={'realtime':!![],'onProgress':_0x3421e5=>{const _0x2b1d0c=_0x45b69a;_0x2568b9[_0x2b1d0c(0x28a)]=formatProgressMessage(_0x3421e5);}};let _0x23d863;try{_0x23d863=await _0xa54217[_0x45b69a(0x1d2)][_0x45b69a(0x1e2)](_0x55fc44,_0x2b48f7),_0x2568b9[_0x45b69a(0x199)]();}catch(_0x2c8e9b){_0x2568b9[_0x45b69a(0x199)]();throw _0x2c8e9b;}console[_0x45b69a(0x17b)]('\x0a'+a22_0x2534e9[_0x45b69a(0x1d4)]('RT\x202.0\x20Validate:')+'\x20'+_0x23d863[_0x45b69a(0x164)]),console[_0x45b69a(0x17b)]('═'[_0x45b69a(0x2a0)](0x3c)),displayRealtimeValidation(_0x23d863),console[_0x45b69a(0x17b)]('─'[_0x45b69a(0x2a0)](0x3c));if(_0x23d863['errors'][_0x45b69a(0x2b3)]>0x0){console[_0x45b69a(0x17b)]('\x0a'+a22_0x2534e9[_0x45b69a(0x1a9)](_0x45b69a(0x2b5)));for(const _0x4bf872 of _0x23d863[_0x45b69a(0x15d)]){console[_0x45b69a(0x17b)]('\x20\x20'+a22_0x2534e9[_0x45b69a(0x1a9)]('•')+'\x20'+_0x4bf872);}}return _0x23d863['allValid']&&console[_0x45b69a(0x17b)]('\x0a'+a22_0x2534e9[_0x45b69a(0x216)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x23d863[_0x45b69a(0x2ae)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x2df86f(0x164)]=a22_0x2df86f(0x238);[a22_0x2df86f(0x27b)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a22_0x2df86f(0x185)](_0x4e8a25){const _0x79a73f=a22_0x2df86f,{options:_0x51c749,args:_0x1f99c7,tdx:_0x3ad1b4}=_0x4e8a25,_0x32f69c=_0x1f99c7[0x0]||_0x51c749['parentSegment'];if(!_0x32f69c)return showParentSegmentNotSetError(_0x79a73f(0x2aa)+_0x79a73f(0x1d3)),0x1;const _0x5bbf97=await withSpinner(_0x79a73f(0x183)+_0x32f69c+_0x79a73f(0x257),()=>_0x3ad1b4[_0x79a73f(0x1d2)][_0x79a73f(0x1cc)](_0x32f69c),{'verbose':_0x51c749[_0x79a73f(0x2c2)]}),_0x56a6ba=_0x5bbf97[_0x79a73f(0x1bd)],_0x10d2cb=await withSpinner(_0x79a73f(0x1f1)+_0x32f69c+'\x27...',()=>_0x3ad1b4[_0x79a73f(0x2de)]['list'](_0x56a6ba),{'verbose':_0x51c749[_0x79a73f(0x2c2)]}),_0x45ceb7=_0x10d2cb[_0x79a73f(0x1bd)];console[_0x79a73f(0x17b)]('✔\x20Found\x20'+_0x45ceb7[_0x79a73f(0x2b3)]+_0x79a73f(0x19c)+(_0x45ceb7[_0x79a73f(0x2b3)]!==0x1?'s':''));if(_0x51c749['format']==='json'||_0x51c749[_0x79a73f(0x243)]===_0x79a73f(0x2c6))await handleSDKOutput(_0x45ceb7,_0x51c749);else{if(_0x45ceb7[_0x79a73f(0x2b3)]===0x0)console[_0x79a73f(0x25a)](_0x79a73f(0x284)),console[_0x79a73f(0x17b)](a22_0x2534e9[_0x79a73f(0x274)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x4c4fe6 of _0x45ceb7){const _0x357e88=_0x4c4fe6[_0x79a73f(0x18d)]?.[_0x79a73f(0x2b3)]||0x0,_0x825a13=_0x4c4fe6['trigger_event']?a22_0x2534e9[_0x79a73f(0x16f)](_0x79a73f(0x225)+_0x4c4fe6['trigger_event']):'',_0x1aba6e=a22_0x2534e9[_0x79a73f(0x16f)]('\x20('+_0x357e88+_0x79a73f(0x182)+(_0x357e88!==0x1?'s':'')+')');console[_0x79a73f(0x25a)]('\x20\x20'+_0x4c4fe6['name']+_0x825a13+_0x1aba6e),_0x4c4fe6['description']&&console['log'](_0x79a73f(0x168)+a22_0x2534e9[_0x79a73f(0x16f)](_0x4c4fe6[_0x79a73f(0x27b)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x2df86f(0x164)]='ps:pz:init';[a22_0x2df86f(0x27b)]=a22_0x2df86f(0x231);async[a22_0x2df86f(0x185)](_0x4490cd){const _0x49f7b1=a22_0x2df86f,{options:_0xd1ed5c,args:_0x1f2e5a}=_0x4490cd,_0x2d7e99=_0x1f2e5a[0x0]||_0xd1ed5c[_0x49f7b1(0x26d)];if(!_0x2d7e99)return showParentSegmentNotSetError(_0x49f7b1(0x229)+_0x49f7b1(0x159)),0x1;const _0xcd60e5=resolveYamlFile(_0x2d7e99);if(!existsSync(_0xcd60e5))return showFileNotFoundError(_0xcd60e5,_0x2d7e99),0x1;let _0x4ef012;try{_0x4ef012=readFileSync(_0xcd60e5,'utf-8');}catch(_0x2cd053){const _0x43ca8e=_0x2cd053 instanceof Error?_0x2cd053[_0x49f7b1(0x1d5)]:String(_0x2cd053);return console['error']('Error\x20reading\x20file:\x20'+_0x43ca8e),0x1;}let _0x50655c;try{_0x50655c=parseDef(_0x4ef012);}catch(_0x419165){const _0x337151=_0x419165 instanceof Error?_0x419165[_0x49f7b1(0x1d5)]:String(_0x419165);return console[_0x49f7b1(0x17b)](a22_0x2534e9[_0x49f7b1(0x1a9)](_0x49f7b1(0x241)+_0x337151)),0x1;}if(_0x50655c[_0x49f7b1(0x21f)]&&_0x50655c[_0x49f7b1(0x21f)]['length']>0x0)return console[_0x49f7b1(0x17b)](a22_0x2534e9[_0x49f7b1(0x157)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0xcd60e5)),console[_0x49f7b1(0x17b)](a22_0x2534e9['dim'](_0x49f7b1(0x27f)+_0x50655c[_0x49f7b1(0x21f)][_0x49f7b1(0x2b3)]+_0x49f7b1(0x1a7))),0x1;!_0x50655c['realtime']&&(_0x50655c[_0x49f7b1(0x19d)]={'events':[{'name':_0x49f7b1(0x1df),'source_table':_0x49f7b1(0x254)}],'attributes':[{'name':_0x49f7b1(0x172),'type':_0x49f7b1(0x252)}],'id_stitching':{'primary_key':_0x50655c['master'][_0x49f7b1(0x2ba)]===_0x49f7b1(0x1ad)?'td_client_id':_0x49f7b1(0x267)}});_0x50655c[_0x49f7b1(0x21f)]=[{'name':_0x49f7b1(0x26a),'description':_0x49f7b1(0x15e),'trigger_event':_0x49f7b1(0x1df),'sections':[{'name':_0x49f7b1(0x2bd),'criteria':_0x49f7b1(0x140),'attributes':[_0x49f7b1(0x172)]}]}];const _0x2422f9=serializeDef(_0x50655c);return writeFileSync(_0xcd60e5,_0x2422f9,'utf-8'),console[_0x49f7b1(0x17b)](a22_0x2534e9['green']('✔')+_0x49f7b1(0x2bb)+a22_0x2534e9['cyan'](_0xcd60e5)),(!_0x50655c[_0x49f7b1(0x19d)]||_0x4ef012[_0x49f7b1(0x1fe)](_0x49f7b1(0x2db))===-0x1)&&console['error'](a22_0x2534e9[_0x49f7b1(0x216)]('✔')+_0x49f7b1(0x25d)),console[_0x49f7b1(0x17b)]('\x0a'+a22_0x2534e9['dim'](_0x49f7b1(0x18a))),console[_0x49f7b1(0x17b)](_0x49f7b1(0x2ca)+_0xcd60e5+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x49f7b1(0x17b)]('\x20\x202.\x20Run\x20'+a22_0x2534e9[_0x49f7b1(0x16f)](_0x49f7b1(0x2d4)+_0x2d7e99)+_0x49f7b1(0x23f)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x32e8cc=a23_0x37fd;(function(_0x46b0af,_0x5f4260){const _0x47d4fc=a23_0x37fd,_0x3340ef=_0x46b0af();while(!![]){try{const _0x17adb1=-parseInt(_0x47d4fc(0x1d8))/0x1*(-parseInt(_0x47d4fc(0x217))/0x2)+-parseInt(_0x47d4fc(0x1ee))/0x3*(-parseInt(_0x47d4fc(0x216))/0x4)+parseInt(_0x47d4fc(0x202))/0x5+parseInt(_0x47d4fc(0x1f0))/0x6*(parseInt(_0x47d4fc(0x1ea))/0x7)+-parseInt(_0x47d4fc(0x220))/0x8+parseInt(_0x47d4fc(0x20c))/0x9*(parseInt(_0x47d4fc(0x212))/0xa)+-parseInt(_0x47d4fc(0x1fa))/0xb;if(_0x17adb1===_0x5f4260)break;else _0x3340ef['push'](_0x3340ef['shift']());}catch(_0x4ac631){_0x3340ef['push'](_0x3340ef['shift']());}}}(a23_0x176e,0xee14f));function a23_0x37fd(_0x2c3e42,_0x1182d3){_0x2c3e42=_0x2c3e42-0x1d0;const _0x176e4d=a23_0x176e();let _0x37fdec=_0x176e4d[_0x2c3e42];return _0x37fdec;}function a23_0x176e(){const _0x468f56=['test','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>','apiKey','Default\x20profile\x20set\x20to:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Site\x20was\x20not\x20changed.','542833sjOoAs','Enter\x20profile\x20name:','\x20\x20-\x20','\x0aSetup\x20cancelled','parent_segment','green','profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20does\x20not\x20exist.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','warn','bold','tdx.json','\x27\x20created','text','tdx:\x20profile\x20create','llm_project','site','7ytYjVO','trim','Validating\x20API\x20key...','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','321zRpOoU','profileName','243642axSNKH','Site\x20name\x20cannot\x20be\x20empty','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','execute','length','join','create','log','logLevel','profile:remove','6108146YckYjv','other','API\x20key\x20cannot\x20be\x20empty','/app/mp/ak','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Operation\x20cancelled','ERROR','tdx:\x20profile\x20set','3042820WQYLuH','Profile\x20name\x20cannot\x20be\x20empty','yellow','Create\x20a\x20new\x20profile','includes','confirm','Failed\x20to\x20remove\x20profile:\x20','Enter\x20description\x20(optional):','dim','red','29637RGlVWM','\x27\x20removed\x20from\x20configuration','Remove\x20a\x20profile','status','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','2110uQAXEs','message','split','\x20\x20(no\x20profiles\x20found)','13076JvQcaD','2aCZfmH','select','error','validate','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20Profile\x20\x27','Unknown\x20key\x20\x27','\x20\x20tdx\x20--profile\x20','session','5649128uXGFKJ','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20saved\x20to\x20system\x20keychain','tdx:\x20profile\x20remove','\x0aSaved\x20to:\x20','customSite','profile:use','name','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','description','us01','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20updated:\x20','\x27.\x0a\x0aValid\x20keys:\x20','jobs','VALID_KEYS','Set\x20a\x20profile\x20configuration\x20value','\x20API\x20key\x20is\x20valid\x20(User:\x20','✗\x20Validation\x20failed:\x20','Set\x20session\x20profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:create','email','(session:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','Removal\x20cancelled','Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','profile:set'];a23_0x176e=function(){return _0x468f56;};return a23_0x176e();}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_0x8b599a 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_0x3e24e3 from'prompts';import a23_0x2ef82c from'chalk';function validateProfileName(_0xbda014){const _0x5bc42d=a23_0x37fd;if(!_0xbda014||!_0xbda014['trim']())return _0x5bc42d(0x203);const _0x12e552=_0xbda014[_0x5bc42d(0x1eb)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5bc42d(0x1d1)](_0x12e552))return _0x5bc42d(0x1e1);if(profileExists(_0x12e552))return _0x5bc42d(0x23c)+_0x12e552+_0x5bc42d(0x228);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x32e8cc(0x227)]=a23_0x32e8cc(0x237);[a23_0x32e8cc(0x22a)]=a23_0x32e8cc(0x205);async[a23_0x32e8cc(0x1f3)](_0x1d0cd0){const _0x50ced3=a23_0x32e8cc,{options:_0x4306fb,args:_0x4f807a}=_0x1d0cd0;console[_0x50ced3(0x1f7)](a23_0x2ef82c['bold'](_0x50ced3(0x1e7)));let _0x47b681;if(_0x4f807a[_0x50ced3(0x1f4)]>0x0&&_0x4f807a[0x0]){const _0x26475a=_0x4f807a[0x0]['trim'](),_0x5a38f2=validateProfileName(_0x26475a);if(_0x5a38f2!==!![])return console[_0x50ced3(0x219)](a23_0x2ef82c[_0x50ced3(0x20b)](_0x5a38f2)),0x1;_0x47b681=_0x26475a;}else{const _0x2f2dd9=await a23_0x3e24e3({'type':_0x50ced3(0x1e6),'name':'profileName','message':_0x50ced3(0x1d9),'validate':validateProfileName});if(!_0x2f2dd9[_0x50ced3(0x1ef)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x47b681=_0x2f2dd9[_0x50ced3(0x1ef)][_0x50ced3(0x1eb)]();}const _0x49ef47=await a23_0x3e24e3({'type':'text','name':_0x50ced3(0x22a),'message':_0x50ced3(0x209)}),_0x3f438d=_0x49ef47[_0x50ced3(0x22a)]?.[_0x50ced3(0x1eb)]()||undefined,_0x3defe3=_0x4306fb['site']||'us01',{choices:_0x5658dc,initialIndex:_0x2baeea}=buildSiteChoices(_0x3defe3),_0x859044=await a23_0x3e24e3({'type':_0x50ced3(0x218),'name':_0x50ced3(0x1e9),'message':_0x50ced3(0x21b)+_0x47b681+'\x27:','choices':_0x5658dc,'initial':_0x2baeea});if(!_0x859044[_0x50ced3(0x1e9)])return console[_0x50ced3(0x1f7)]('\x0aSetup\x20cancelled'),0x1;let _0x2dd436;if(_0x859044[_0x50ced3(0x1e9)]===_0x50ced3(0x1fb)){const _0x1475d9=await a23_0x3e24e3({'type':_0x50ced3(0x1e6),'name':_0x50ced3(0x225),'message':'Enter\x20site\x20name:','initial':_0x50ced3(0x22b),'validate':_0x575f88=>{const _0x56213e=_0x50ced3;if(!_0x575f88||!_0x575f88[_0x56213e(0x1eb)]())return _0x56213e(0x1f1);if(!/^[a-z0-9-]+$/[_0x56213e(0x1d1)](_0x575f88['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x1475d9[_0x50ced3(0x225)])return console[_0x50ced3(0x1f7)](_0x50ced3(0x1db)),0x1;_0x2dd436=_0x1475d9[_0x50ced3(0x225)];}else _0x2dd436=_0x859044[_0x50ced3(0x1e9)];const _0x3c4096=resolveSite(_0x2dd436);console[_0x50ced3(0x1f7)](_0x50ced3(0x210)+_0x3c4096),console[_0x50ced3(0x1f7)](_0x50ced3(0x23a)),console[_0x50ced3(0x1f7)]('\x20\x20'+getConsoleUrl(_0x3c4096,_0x50ced3(0x1fd)));const _0x3a04ca=await a23_0x3e24e3({'type':'password','name':_0x50ced3(0x1d3),'message':_0x50ced3(0x221),'validate':_0x36cc8d=>{const _0x23071e=_0x50ced3;if(!_0x36cc8d||!_0x36cc8d[_0x23071e(0x1eb)]())return _0x23071e(0x1fc);return!![];}});if(!_0x3a04ca[_0x50ced3(0x1d3)])return console[_0x50ced3(0x1f7)](_0x50ced3(0x1db)),0x1;const _0x5c62d9=_0x3a04ca['apiKey'];console[_0x50ced3(0x1f7)](_0x50ced3(0x1ec));try{const _0x53b3e2=TDX['create']({'site':_0x3c4096,'apiKey':_0x5c62d9['trim'](),'logLevel':_0x4306fb[_0x50ced3(0x1f8)]??LogLevel[_0x50ced3(0x200)]}),_0x5c8c17=await _0x53b3e2[_0x50ced3(0x22f)]['getUserInfo']();console[_0x50ced3(0x1f7)](a23_0x2ef82c[_0x50ced3(0x1dd)]('✓')+_0x50ced3(0x232)+_0x5c8c17[_0x50ced3(0x238)]+')');const _0x18a574=await isKeychainAvailable();_0x18a574?(await saveAPIKeyAsync(_0x5c62d9[_0x50ced3(0x1eb)](),_0x3c4096,_0x47b681),console[_0x50ced3(0x1f7)](a23_0x2ef82c[_0x50ced3(0x1dd)]('✓')+_0x50ced3(0x236)+_0x47b681+')')):(console[_0x50ced3(0x1e2)](a23_0x2ef82c[_0x50ced3(0x204)](_0x50ced3(0x211))),console['warn'](a23_0x2ef82c['yellow'](_0x50ced3(0x1fe))));const _0x4eaa17={'site':_0x3c4096,..._0x3f438d&&{'description':_0x3f438d}};return saveProfileToUserConfig(_0x47b681,_0x4eaa17),console[_0x50ced3(0x1f7)](a23_0x2ef82c[_0x50ced3(0x1dd)]('✓')+_0x50ced3(0x21c)+_0x47b681+_0x50ced3(0x1e5)),console[_0x50ced3(0x1f7)](),console[_0x50ced3(0x1f7)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x50ced3(0x1f7)](_0x50ced3(0x21e)+_0x47b681+_0x50ced3(0x1ed)),console[_0x50ced3(0x1f7)](_0x50ced3(0x21e)+_0x47b681+_0x50ced3(0x1f2)),0x0;}catch(_0x205167){if(_0x205167 instanceof HTTPClientError&&_0x205167[_0x50ced3(0x20f)]===0x191)return printAuthError(_0x205167),0x1;return console['error'](a23_0x2ef82c['red'](_0x50ced3(0x233)+(_0x205167 instanceof Error?_0x205167[_0x50ced3(0x213)]:String(_0x205167)))),console[_0x50ced3(0x219)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x32e8cc(0x227)]=a23_0x32e8cc(0x1f9);[a23_0x32e8cc(0x22a)]=a23_0x32e8cc(0x20e);[a23_0x32e8cc(0x21a)](_0x4aeaa8){const _0x2de739=a23_0x32e8cc,{args:_0x305c41}=_0x4aeaa8;if(_0x305c41[_0x2de739(0x1f4)]===0x0)return _0x2de739(0x1d5);return undefined;}async[a23_0x32e8cc(0x1f3)](_0x417063){const _0x51fa65=a23_0x32e8cc,{args:_0x56cfa8}=_0x417063,_0x438a3c=_0x56cfa8[0x0];console[_0x51fa65(0x1f7)](a23_0x2ef82c[_0x51fa65(0x1e3)](_0x51fa65(0x223)));if(!profileExists(_0x438a3c)){console[_0x51fa65(0x219)](a23_0x2ef82c[_0x51fa65(0x20b)]('Profile\x20\x27'+_0x438a3c+_0x51fa65(0x1e0))),console['log'](_0x51fa65(0x23e));const _0x1cd676=listProfiles();if(_0x1cd676[_0x51fa65(0x1f4)]===0x0)console['log'](_0x51fa65(0x215));else for(const _0x45d5d2 of _0x1cd676){console[_0x51fa65(0x1f7)](_0x51fa65(0x1da)+_0x45d5d2[_0x51fa65(0x227)]);}return 0x1;}const _0x27c311=await a23_0x3e24e3({'type':_0x51fa65(0x207),'name':_0x51fa65(0x207),'message':_0x51fa65(0x235)+_0x438a3c+'\x27?','initial':![]});if(!_0x27c311[_0x51fa65(0x207)])return console['log'](_0x51fa65(0x23b)),0x0;try{removeProfileFromUserConfig(_0x438a3c),console[_0x51fa65(0x1f7)](a23_0x2ef82c[_0x51fa65(0x1dd)]('✓')+_0x51fa65(0x21c)+_0x438a3c+_0x51fa65(0x20d));}catch(_0x56c5ee){return console[_0x51fa65(0x219)](a23_0x2ef82c[_0x51fa65(0x20b)](_0x51fa65(0x208)+(_0x56c5ee instanceof Error?_0x56c5ee[_0x51fa65(0x213)]:String(_0x56c5ee)))),0x1;}const _0x132949=await isKeychainAvailable();if(_0x132949){const _0x27ca8e=await deleteKeychainAPIKey(_0x438a3c);_0x27ca8e&&console[_0x51fa65(0x1f7)](a23_0x2ef82c['green']('✓')+_0x51fa65(0x22c));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a23_0x32e8cc(0x1d0);[a23_0x32e8cc(0x22a)]=a23_0x32e8cc(0x231);static [a23_0x32e8cc(0x230)]=[a23_0x32e8cc(0x1e9),'database',a23_0x32e8cc(0x1dc),a23_0x32e8cc(0x1e8),'llm_agent',a23_0x32e8cc(0x22a)];[a23_0x32e8cc(0x21a)](_0x9c1b59){const _0x331f4e=a23_0x32e8cc,{args:_0x317209,options:_0x195f20}=_0x9c1b59,_0x28e287=_0x195f20[_0x331f4e(0x1de)]||getActiveProfile();if(!_0x28e287)return _0x331f4e(0x1d2);if(_0x317209[_0x331f4e(0x1f4)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x331f4e(0x230)][_0x331f4e(0x1f5)](',\x20');const _0x520534=_0x317209[0x0];if(!_0x520534[_0x331f4e(0x206)]('='))return _0x331f4e(0x229)+ProfileSetCommand['VALID_KEYS'][_0x331f4e(0x1f5)](',\x20');const [_0x278743]=_0x520534[_0x331f4e(0x214)]('=',0x2);if(!ProfileSetCommand[_0x331f4e(0x230)][_0x331f4e(0x206)](_0x278743))return _0x331f4e(0x21d)+_0x278743+_0x331f4e(0x22e)+ProfileSetCommand['VALID_KEYS'][_0x331f4e(0x1f5)](',\x20');return undefined;}async['execute'](_0x2d503b){const _0xa0bab8=a23_0x32e8cc,{args:_0x1889c5,options:_0x30e36d}=_0x2d503b,_0xb490b6=_0x30e36d[_0xa0bab8(0x1de)]||getActiveProfile(),[_0x1dde7d,..._0x1fb6ed]=_0x1889c5[0x0]['split']('='),_0x220d35=_0x1fb6ed['join']('=');console[_0xa0bab8(0x1f7)](a23_0x2ef82c[_0xa0bab8(0x1e3)](_0xa0bab8(0x201)));if(!profileExists(_0xb490b6)){const _0x5b2cde=await a23_0x3e24e3({'type':'confirm','name':_0xa0bab8(0x1f6),'message':_0xa0bab8(0x23c)+_0xb490b6+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x5b2cde[_0xa0bab8(0x1f6)])return console[_0xa0bab8(0x1f7)](_0xa0bab8(0x1ff)),0x1;}const _0xd40550=loadProfile(_0xb490b6),_0xb13010=_0xd40550?.['config']||{};if(_0x1dde7d==='site'){const _0x56674c=resolveSite(_0x220d35);console[_0xa0bab8(0x1f7)]('Changing\x20site\x20to\x20\x27'+_0x56674c+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0xa0bab8(0x1f7)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xa0bab8(0x1f7)]('\x20\x20'+getConsoleUrl(_0x56674c,_0xa0bab8(0x1fd)));const _0x20578a=await a23_0x3e24e3({'type':'password','name':_0xa0bab8(0x1d3),'message':_0xa0bab8(0x1d6),'validate':_0x1b2a68=>{const _0x141a40=_0xa0bab8;if(!_0x1b2a68||!_0x1b2a68[_0x141a40(0x1eb)]())return _0x141a40(0x1fc);return!![];}});if(!_0x20578a[_0xa0bab8(0x1d3)])return console[_0xa0bab8(0x1f7)](_0xa0bab8(0x23f)),0x1;console['log'](_0xa0bab8(0x1ec));try{const _0x5710e6=TDX[_0xa0bab8(0x1f6)]({'site':_0x56674c,'apiKey':_0x20578a[_0xa0bab8(0x1d3)][_0xa0bab8(0x1eb)](),'logLevel':_0x30e36d[_0xa0bab8(0x1f8)]??LogLevel[_0xa0bab8(0x200)]}),_0x1bcdcc=await _0x5710e6[_0xa0bab8(0x22f)]['getUserInfo']();console[_0xa0bab8(0x1f7)](a23_0x2ef82c[_0xa0bab8(0x1dd)]('✓')+_0xa0bab8(0x232)+_0x1bcdcc['email']+')');const _0x4b243f=await isKeychainAvailable();_0x4b243f?(await saveAPIKeyAsync(_0x20578a[_0xa0bab8(0x1d3)]['trim'](),_0x56674c,_0xb490b6),console[_0xa0bab8(0x1f7)](a23_0x2ef82c['green']('✓')+_0xa0bab8(0x222))):console[_0xa0bab8(0x1e2)](a23_0x2ef82c[_0xa0bab8(0x204)](_0xa0bab8(0x211))),_0xb13010[_0xa0bab8(0x1e9)]=_0x56674c;}catch(_0x4ef75b){if(_0x4ef75b instanceof HTTPClientError&&_0x4ef75b['status']===0x191)return printAuthError(_0x4ef75b),0x1;return console[_0xa0bab8(0x219)](a23_0x2ef82c['red'](_0xa0bab8(0x233)+(_0x4ef75b instanceof Error?_0x4ef75b[_0xa0bab8(0x213)]:String(_0x4ef75b)))),console['error'](_0xa0bab8(0x1d7)),0x1;}}else _0xb13010[_0x1dde7d]=_0x220d35||undefined;return saveProfileToUserConfig(_0xb490b6,_0xb13010),console[_0xa0bab8(0x1f7)](a23_0x2ef82c[_0xa0bab8(0x1dd)]('✓')+'\x20Profile\x20\x27'+_0xb490b6+_0xa0bab8(0x22d)+_0x1dde7d+'='+(_0x220d35||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x32e8cc(0x226);['description']=a23_0x32e8cc(0x234);[a23_0x32e8cc(0x21a)](_0xedaa3a){const _0x77f1e4=a23_0x32e8cc,{args:_0x388bfe}=_0xedaa3a;if(_0x388bfe['length']===0x0)return _0x77f1e4(0x23d);return undefined;}async[a23_0x32e8cc(0x1f3)](_0x38c140){const _0x487829=a23_0x32e8cc,{args:_0x26cfa4,options:_0x14fded}=_0x38c140,_0x1cd3f0=_0x26cfa4[0x0],_0x120fb7=_0x14fded['default'];cleanExpiredSessions();if(!profileExists(_0x1cd3f0)){console['error'](a23_0x2ef82c['red'](_0x487829(0x23c)+_0x1cd3f0+_0x487829(0x1e0))),console['log'](_0x487829(0x23e));const _0x59c21a=listProfiles();if(_0x59c21a[_0x487829(0x1f4)]===0x0)console[_0x487829(0x1f7)](_0x487829(0x215));else for(const _0x5c8b6d of _0x59c21a){console[_0x487829(0x1f7)](_0x487829(0x1da)+_0x5c8b6d['name']);}return 0x1;}if(_0x120fb7){const _0x13672f=a23_0x8b599a[_0x487829(0x1f5)](getConfigDir(),_0x487829(0x1e4));return saveActiveProfileToUserConfig(_0x1cd3f0),console['log'](_0x487829(0x1d4)+a23_0x2ef82c[_0x487829(0x1dd)](_0x1cd3f0)),console[_0x487829(0x1f7)](a23_0x2ef82c[_0x487829(0x20a)](_0x487829(0x224)+_0x13672f)),0x0;}const _0x135ab6=getSessionID(_0x14fded[_0x487829(0x21f)]);return saveSessionContext({'profile':_0x1cd3f0},_0x14fded[_0x487829(0x21f)]),console[_0x487829(0x1f7)]('Session\x20profile\x20set\x20to:\x20'+a23_0x2ef82c[_0x487829(0x1dd)](_0x1cd3f0)+'\x20'+a23_0x2ef82c[_0x487829(0x20a)](_0x487829(0x239)+_0x135ab6+')')),console[_0x487829(0x1f7)](a23_0x2ef82c['dim'](_0x487829(0x1df)+_0x1cd3f0+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
1
|
+
function a23_0x4e7f(){const _0x36fc1f=['Unknown\x20key\x20\x27','2034840DcHHno','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','tdx:\x20profile\x20remove','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','validate','profile:create','confirm','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSaved\x20to:\x20','join','length','Enter\x20description\x20(optional):','/app/mp/ak','jobs','\x27\x20does\x20not\x20exist.\x20Create\x20it?','VALID_KEYS','profile:use','name','us01','2591372Tytzoq','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','database','message','green','\x20\x20(no\x20profiles\x20found)','site','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','49955420aIckES','profileName','\x27\x20does\x20not\x20exist.','config','dim','getUserInfo','27486ZndJHN','Removal\x20cancelled','6AyqbKS','\x0aAvailable\x20profiles:','apiKey','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','llm_project','red','2768VrtNkf','tdx.json','split','logLevel','default','Failed\x20to\x20remove\x20profile:\x20','trim','yellow','log','Site\x20was\x20not\x20changed.','API\x20key\x20cannot\x20be\x20empty','status','customSite','bold','(session:\x20','Remove\x20a\x20profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Operation\x20cancelled','\x0aSetup\x20cancelled','\x27\x20created','profile','Profile\x20\x27','llm_agent','1qjqyyM','\x27.\x0a\x0aValid\x20keys:\x20','password','Session\x20profile\x20set\x20to:\x20','parent_segment','other','profile:set','Profile\x20name\x20cannot\x20be\x20empty','967629cUwUxz','Create\x20a\x20new\x20profile','3773568EoLKKq','\x27\x20updated:\x20','\x20\x20tdx\x20--profile\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','test','create','description','\x20--default\x27\x20to\x20save\x20permanently','text','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','ERROR','email','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:remove','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','You\x20can\x20find\x20your\x20API\x20key\x20at:','select','error','\x20API\x20key\x20removed\x20from\x20system\x20keychain','3607945VmFrrR','warn','\x27\x20removed\x20from\x20configuration','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20Profile\x20\x27','session','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','tdx:\x20profile\x20create','Enter\x20your\x20TD\x20API\x20key:','Enter\x20profile\x20name:','includes','execute','✗\x20Validation\x20failed:\x20'];a23_0x4e7f=function(){return _0x36fc1f;};return a23_0x4e7f();}const a23_0x22f566=a23_0x250d;(function(_0x66658c,_0x9ece3c){const _0x23e371=a23_0x250d,_0x5103ff=_0x66658c();while(!![]){try{const _0x425304=-parseInt(_0x23e371(0x13c))/0x1*(parseInt(_0x23e371(0x16a))/0x2)+-parseInt(_0x23e371(0x144))/0x3+-parseInt(_0x23e371(0x146))/0x4+parseInt(_0x23e371(0x159))/0x5*(-parseInt(_0x23e371(0x11e))/0x6)+-parseInt(_0x23e371(0x17e))/0x7+parseInt(_0x23e371(0x125))/0x8*(-parseInt(_0x23e371(0x11c))/0x9)+parseInt(_0x23e371(0x186))/0xa;if(_0x425304===_0x9ece3c)break;else _0x5103ff['push'](_0x5103ff['shift']());}catch(_0x4950e4){_0x5103ff['push'](_0x5103ff['shift']());}}}(a23_0x4e7f,0x89a06));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a23_0x250d(_0x1777c4,_0x220d40){_0x1777c4=_0x1777c4-0x118;const _0x4e7f78=a23_0x4e7f();let _0x250df2=_0x4e7f78[_0x1777c4];return _0x250df2;}import{getConfigDir}from'../core/config.js';import*as a23_0x29375f 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_0x40b577 from'prompts';import a23_0x36263b from'chalk';function validateProfileName(_0x5c7af1){const _0x50f779=a23_0x250d;if(!_0x5c7af1||!_0x5c7af1[_0x50f779(0x12b)]())return _0x50f779(0x143);const _0x4c5b05=_0x5c7af1[_0x50f779(0x12b)]();if(!/^[a-zA-Z0-9_-]+$/[_0x50f779(0x14a)](_0x4c5b05))return _0x50f779(0x15d);if(profileExists(_0x4c5b05))return _0x50f779(0x13a)+_0x4c5b05+_0x50f779(0x154);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a23_0x22f566(0x170);[a23_0x22f566(0x14c)]=a23_0x22f566(0x145);async[a23_0x22f566(0x167)](_0x36e968){const _0x228d30=a23_0x22f566,{options:_0x378376,args:_0x1860e7}=_0x36e968;console[_0x228d30(0x12d)](a23_0x36263b['bold'](_0x228d30(0x163)));let _0x102c36;if(_0x1860e7['length']>0x0&&_0x1860e7[0x0]){const _0x44f671=_0x1860e7[0x0][_0x228d30(0x12b)](),_0x2e49b7=validateProfileName(_0x44f671);if(_0x2e49b7!==!![])return console[_0x228d30(0x157)](a23_0x36263b[_0x228d30(0x124)](_0x2e49b7)),0x1;_0x102c36=_0x44f671;}else{const _0x5ace13=await a23_0x40b577({'type':'text','name':_0x228d30(0x187),'message':_0x228d30(0x165),'validate':validateProfileName});if(!_0x5ace13[_0x228d30(0x187)])return console['log'](_0x228d30(0x137)),0x1;_0x102c36=_0x5ace13[_0x228d30(0x187)][_0x228d30(0x12b)]();}const _0xab9423=await a23_0x40b577({'type':'text','name':_0x228d30(0x14c),'message':_0x228d30(0x176)}),_0x397745=_0xab9423['description']?.[_0x228d30(0x12b)]()||undefined,_0x16ea12=_0x378376[_0x228d30(0x184)]||_0x228d30(0x17d),{choices:_0x1a765a,initialIndex:_0x53e769}=buildSiteChoices(_0x16ea12),_0x37a10e=await a23_0x40b577({'type':_0x228d30(0x156),'name':_0x228d30(0x184),'message':_0x228d30(0x162)+_0x102c36+'\x27:','choices':_0x1a765a,'initial':_0x53e769});if(!_0x37a10e[_0x228d30(0x184)])return console[_0x228d30(0x12d)](_0x228d30(0x137)),0x1;let _0x33a7bf;if(_0x37a10e[_0x228d30(0x184)]===_0x228d30(0x141)){const _0x1dbea1=await a23_0x40b577({'type':_0x228d30(0x14e),'name':'customSite','message':'Enter\x20site\x20name:','initial':_0x228d30(0x17d),'validate':_0x130681=>{const _0x330839=_0x228d30;if(!_0x130681||!_0x130681[_0x330839(0x12b)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x130681[_0x330839(0x12b)]()))return _0x330839(0x16b);return!![];}});if(!_0x1dbea1[_0x228d30(0x131)])return console[_0x228d30(0x12d)]('\x0aSetup\x20cancelled'),0x1;_0x33a7bf=_0x1dbea1['customSite'];}else _0x33a7bf=_0x37a10e[_0x228d30(0x184)];const _0x5e87be=resolveSite(_0x33a7bf);console[_0x228d30(0x12d)](_0x228d30(0x149)+_0x5e87be),console[_0x228d30(0x12d)](_0x228d30(0x155)),console[_0x228d30(0x12d)]('\x20\x20'+getConsoleUrl(_0x5e87be,_0x228d30(0x177)));const _0x54f600=await a23_0x40b577({'type':_0x228d30(0x13e),'name':_0x228d30(0x120),'message':_0x228d30(0x164),'validate':_0x17690d=>{const _0x39c9fb=_0x228d30;if(!_0x17690d||!_0x17690d[_0x39c9fb(0x12b)]())return _0x39c9fb(0x12f);return!![];}});if(!_0x54f600[_0x228d30(0x120)])return console['log'](_0x228d30(0x137)),0x1;const _0x5a4703=_0x54f600[_0x228d30(0x120)];console[_0x228d30(0x12d)](_0x228d30(0x16e));try{const _0x322679=TDX[_0x228d30(0x14b)]({'site':_0x5e87be,'apiKey':_0x5a4703[_0x228d30(0x12b)](),'logLevel':_0x378376[_0x228d30(0x128)]??LogLevel[_0x228d30(0x150)]}),_0x56d7e4=await _0x322679[_0x228d30(0x178)][_0x228d30(0x11b)]();console[_0x228d30(0x12d)](a23_0x36263b[_0x228d30(0x182)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x56d7e4[_0x228d30(0x151)]+')');const _0x6f3894=await isKeychainAvailable();_0x6f3894?(await saveAPIKeyAsync(_0x5a4703['trim'](),_0x5e87be,_0x102c36),console[_0x228d30(0x12d)](a23_0x36263b[_0x228d30(0x182)]('✓')+_0x228d30(0x185)+_0x102c36+')')):(console['warn'](a23_0x36263b[_0x228d30(0x12c)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x228d30(0x15a)](a23_0x36263b['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x4e0291={'site':_0x5e87be,..._0x397745&&{'description':_0x397745}};return saveProfileToUserConfig(_0x102c36,_0x4e0291),console[_0x228d30(0x12d)](a23_0x36263b['green']('✓')+_0x228d30(0x15e)+_0x102c36+_0x228d30(0x138)),console[_0x228d30(0x12d)](),console[_0x228d30(0x12d)](_0x228d30(0x122)),console[_0x228d30(0x12d)](_0x228d30(0x148)+_0x102c36+_0x228d30(0x160)),console[_0x228d30(0x12d)](_0x228d30(0x148)+_0x102c36+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2de764){if(_0x2de764 instanceof HTTPClientError&&_0x2de764[_0x228d30(0x130)]===0x191)return printAuthError(_0x2de764),0x1;return console['error'](a23_0x36263b[_0x228d30(0x124)](_0x228d30(0x168)+(_0x2de764 instanceof Error?_0x2de764[_0x228d30(0x181)]:String(_0x2de764)))),console['error'](_0x228d30(0x161)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x22f566(0x153);['description']=a23_0x22f566(0x134);['validate'](_0x42b603){const _0x5eb0a7=a23_0x22f566,{args:_0x32acb9}=_0x42b603;if(_0x32acb9[_0x5eb0a7(0x175)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x22f566(0x167)](_0x17ded9){const _0x240ca3=a23_0x22f566,{args:_0x15b20a}=_0x17ded9,_0x44302c=_0x15b20a[0x0];console[_0x240ca3(0x12d)](a23_0x36263b[_0x240ca3(0x132)](_0x240ca3(0x16c)));if(!profileExists(_0x44302c)){console['error'](a23_0x36263b['red'](_0x240ca3(0x13a)+_0x44302c+'\x27\x20does\x20not\x20exist.')),console[_0x240ca3(0x12d)](_0x240ca3(0x11f));const _0x5844c6=listProfiles();if(_0x5844c6[_0x240ca3(0x175)]===0x0)console[_0x240ca3(0x12d)](_0x240ca3(0x183));else for(const _0x3e5ac5 of _0x5844c6){console[_0x240ca3(0x12d)]('\x20\x20-\x20'+_0x3e5ac5[_0x240ca3(0x17c)]);}return 0x1;}const _0x5eda82=await a23_0x40b577({'type':'confirm','name':_0x240ca3(0x171),'message':_0x240ca3(0x121)+_0x44302c+'\x27?','initial':![]});if(!_0x5eda82[_0x240ca3(0x171)])return console[_0x240ca3(0x12d)](_0x240ca3(0x11d)),0x0;try{removeProfileFromUserConfig(_0x44302c),console[_0x240ca3(0x12d)](a23_0x36263b[_0x240ca3(0x182)]('✓')+'\x20Profile\x20\x27'+_0x44302c+_0x240ca3(0x15b));}catch(_0x142bb5){return console['error'](a23_0x36263b[_0x240ca3(0x124)](_0x240ca3(0x12a)+(_0x142bb5 instanceof Error?_0x142bb5['message']:String(_0x142bb5)))),0x1;}const _0x435a7d=await isKeychainAvailable();if(_0x435a7d){const _0x7af2ba=await deleteKeychainAPIKey(_0x44302c);_0x7af2ba&&console[_0x240ca3(0x12d)](a23_0x36263b[_0x240ca3(0x182)]('✓')+_0x240ca3(0x158));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x22f566(0x17c)]=a23_0x22f566(0x142);[a23_0x22f566(0x14c)]='Set\x20a\x20profile\x20configuration\x20value';static [a23_0x22f566(0x17a)]=[a23_0x22f566(0x184),a23_0x22f566(0x180),a23_0x22f566(0x140),a23_0x22f566(0x123),a23_0x22f566(0x13b),a23_0x22f566(0x14c)];[a23_0x22f566(0x16f)](_0x1b0871){const _0x51020b=a23_0x22f566,{args:_0x1b29f0,options:_0x263fda}=_0x1b0871,_0x88f629=_0x263fda[_0x51020b(0x139)]||getActiveProfile();if(!_0x88f629)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x1b29f0[_0x51020b(0x175)]===0x0)return _0x51020b(0x14f)+ProfileSetCommand[_0x51020b(0x17a)][_0x51020b(0x174)](',\x20');const _0x3c15e9=_0x1b29f0[0x0];if(!_0x3c15e9[_0x51020b(0x166)]('='))return _0x51020b(0x17f)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x21928f]=_0x3c15e9[_0x51020b(0x127)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x51020b(0x166)](_0x21928f))return _0x51020b(0x169)+_0x21928f+_0x51020b(0x13d)+ProfileSetCommand[_0x51020b(0x17a)][_0x51020b(0x174)](',\x20');return undefined;}async['execute'](_0x5be231){const _0x476c48=a23_0x22f566,{args:_0x4bc5da,options:_0x2a3916}=_0x5be231,_0x3fae83=_0x2a3916[_0x476c48(0x139)]||getActiveProfile(),[_0xcae45b,..._0x25c424]=_0x4bc5da[0x0][_0x476c48(0x127)]('='),_0x3393cd=_0x25c424[_0x476c48(0x174)]('=');console['log'](a23_0x36263b[_0x476c48(0x132)]('tdx:\x20profile\x20set'));if(!profileExists(_0x3fae83)){const _0x337e51=await a23_0x40b577({'type':_0x476c48(0x171),'name':'create','message':_0x476c48(0x13a)+_0x3fae83+_0x476c48(0x179),'initial':!![]});if(!_0x337e51[_0x476c48(0x14b)])return console['log'](_0x476c48(0x136)),0x1;}const _0x214499=loadProfile(_0x3fae83),_0x2a4e46=_0x214499?.[_0x476c48(0x119)]||{};if(_0xcae45b==='site'){const _0x27997c=resolveSite(_0x3393cd);console[_0x476c48(0x12d)]('Changing\x20site\x20to\x20\x27'+_0x27997c+_0x476c48(0x15c)),console[_0x476c48(0x12d)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x476c48(0x12d)]('\x20\x20'+getConsoleUrl(_0x27997c,_0x476c48(0x177)));const _0x4f6d72=await a23_0x40b577({'type':_0x476c48(0x13e),'name':_0x476c48(0x120),'message':_0x476c48(0x172),'validate':_0x1a3f49=>{const _0x244b50=_0x476c48;if(!_0x1a3f49||!_0x1a3f49[_0x244b50(0x12b)]())return _0x244b50(0x12f);return!![];}});if(!_0x4f6d72[_0x476c48(0x120)])return console[_0x476c48(0x12d)]('\x0aOperation\x20cancelled'),0x1;console[_0x476c48(0x12d)]('Validating\x20API\x20key...');try{const _0x546738=TDX[_0x476c48(0x14b)]({'site':_0x27997c,'apiKey':_0x4f6d72[_0x476c48(0x120)][_0x476c48(0x12b)](),'logLevel':_0x2a3916[_0x476c48(0x128)]??LogLevel[_0x476c48(0x150)]}),_0x4c4739=await _0x546738[_0x476c48(0x178)][_0x476c48(0x11b)]();console[_0x476c48(0x12d)](a23_0x36263b[_0x476c48(0x182)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4c4739[_0x476c48(0x151)]+')');const _0x10ea23=await isKeychainAvailable();_0x10ea23?(await saveAPIKeyAsync(_0x4f6d72[_0x476c48(0x120)]['trim'](),_0x27997c,_0x3fae83),console[_0x476c48(0x12d)](a23_0x36263b[_0x476c48(0x182)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a23_0x36263b[_0x476c48(0x12c)](_0x476c48(0x152))),_0x2a4e46['site']=_0x27997c;}catch(_0x380f45){if(_0x380f45 instanceof HTTPClientError&&_0x380f45['status']===0x191)return printAuthError(_0x380f45),0x1;return console[_0x476c48(0x157)](a23_0x36263b[_0x476c48(0x124)](_0x476c48(0x168)+(_0x380f45 instanceof Error?_0x380f45['message']:String(_0x380f45)))),console[_0x476c48(0x157)](_0x476c48(0x12e)),0x1;}}else _0x2a4e46[_0xcae45b]=_0x3393cd||undefined;return saveProfileToUserConfig(_0x3fae83,_0x2a4e46),console['log'](a23_0x36263b[_0x476c48(0x182)]('✓')+_0x476c48(0x15e)+_0x3fae83+_0x476c48(0x147)+_0xcae45b+'='+(_0x3393cd||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x22f566(0x17b);['description']='Set\x20session\x20profile';['validate'](_0xf36bf3){const _0x4c1d66=a23_0x22f566,{args:_0x8f3c3b}=_0xf36bf3;if(_0x8f3c3b[_0x4c1d66(0x175)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a23_0x22f566(0x167)](_0x1fb359){const _0x2d3e6a=a23_0x22f566,{args:_0x1af297,options:_0x281e12}=_0x1fb359,_0x4ae6bf=_0x1af297[0x0],_0x129650=_0x281e12[_0x2d3e6a(0x129)];cleanExpiredSessions();if(!profileExists(_0x4ae6bf)){console['error'](a23_0x36263b[_0x2d3e6a(0x124)](_0x2d3e6a(0x13a)+_0x4ae6bf+_0x2d3e6a(0x118))),console[_0x2d3e6a(0x12d)]('\x0aAvailable\x20profiles:');const _0x69726d=listProfiles();if(_0x69726d[_0x2d3e6a(0x175)]===0x0)console[_0x2d3e6a(0x12d)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x40fe61 of _0x69726d){console['log']('\x20\x20-\x20'+_0x40fe61[_0x2d3e6a(0x17c)]);}return 0x1;}if(_0x129650){const _0x4b2ef9=a23_0x29375f[_0x2d3e6a(0x174)](getConfigDir(),_0x2d3e6a(0x126));return saveActiveProfileToUserConfig(_0x4ae6bf),console['log'](_0x2d3e6a(0x16d)+a23_0x36263b[_0x2d3e6a(0x182)](_0x4ae6bf)),console[_0x2d3e6a(0x12d)](a23_0x36263b[_0x2d3e6a(0x11a)](_0x2d3e6a(0x173)+_0x4b2ef9)),0x0;}const _0x3811af=getSessionID(_0x281e12[_0x2d3e6a(0x15f)]);return saveSessionContext({'profile':_0x4ae6bf},_0x281e12[_0x2d3e6a(0x15f)]),console[_0x2d3e6a(0x12d)](_0x2d3e6a(0x13f)+a23_0x36263b['green'](_0x4ae6bf)+'\x20'+a23_0x36263b[_0x2d3e6a(0x11a)](_0x2d3e6a(0x133)+_0x3811af+')')),console[_0x2d3e6a(0x12d)](a23_0x36263b[_0x2d3e6a(0x11a)](_0x2d3e6a(0x135)+_0x4ae6bf+_0x2d3e6a(0x14d))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x541ef4=a24_0x4f30;(function(_0x492e8d,_0x344de6){const _0x390042=a24_0x4f30,_0x1be266=_0x492e8d();while(!![]){try{const _0x5835aa=-parseInt(_0x390042(0x103))/0x1+-parseInt(_0x390042(0x104))/0x2*(parseInt(_0x390042(0x116))/0x3)+parseInt(_0x390042(0x112))/0x4*(parseInt(_0x390042(0x114))/0x5)+-parseInt(_0x390042(0x115))/0x6+-parseInt(_0x390042(0x10d))/0x7*(parseInt(_0x390042(0x10a))/0x8)+parseInt(_0x390042(0x101))/0x9*(-parseInt(_0x390042(0x113))/0xa)+parseInt(_0x390042(0x105))/0xb;if(_0x5835aa===_0x344de6)break;else _0x1be266['push'](_0x1be266['shift']());}catch(_0x320be5){_0x1be266['push'](_0x1be266['shift']());}}}(a24_0x48c3,0xe5dd2));function a24_0x4f30(_0x2b3133,_0x406e58){_0x2b3133=_0x2b3133-0x101;const _0x48c323=a24_0x48c3();let _0x4f304b=_0x48c323[_0x2b3133];return _0x4f304b;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a24_0x48c3(){const _0x4159f0=['scope','741396LJDgVZ','383246zCAdgX','38938592WUPEFa','name','execute','length','error','1073840ktntEn','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','56XwCzNt','log','config','List\x20all\x20available\x20profiles','message','8bVFgNA','30lIxtYB','3189670BChCKW','6724608mTCKOg','9TesMCF','description','\x20\x20Global:\x20~/.config/tdx/tdx.json','1090035ZNWlbg'];a24_0x48c3=function(){return _0x4159f0;};return a24_0x48c3();}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x541ef4(0x106)]='profiles';['description']=a24_0x541ef4(0x110);async[a24_0x541ef4(0x107)](_0x47d488){const _0x37f98d=a24_0x541ef4,{options:_0x215a30}=_0x47d488;try{const _0x43891c=listProfiles(),_0x4f2aaa=getActiveProfile();if(_0x43891c[_0x37f98d(0x108)]===0x0)return console['log'](_0x37f98d(0x10c)),console[_0x37f98d(0x10e)](_0x37f98d(0x10b)),console[_0x37f98d(0x10e)](_0x37f98d(0x118)),0x0;const _0x3a5f4d=_0x43891c['map'](_0x51057b=>{const _0x3546bb=_0x37f98d,_0x56e210=_0x51057b[_0x3546bb(0x106)]===_0x4f2aaa,_0x520754=getProfileParams(_0x51057b['config']);return{'name':_0x51057b[_0x3546bb(0x106)],'active':_0x56e210,'scope':_0x51057b[_0x3546bb(0x102)],'description':_0x51057b[_0x3546bb(0x10f)][_0x3546bb(0x117)]||'','params':_0x520754};});return await handleSDKOutput(_0x3a5f4d,_0x215a30),0x0;}catch(_0x2abfbc){return _0x2abfbc instanceof Error&&console[_0x37f98d(0x109)]('Error:\x20'+_0x2abfbc[_0x37f98d(0x111)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x1b7097=a25_0x4bcc;function a25_0x4bcc(_0x42acc8,_0x44601b){_0x42acc8=_0x42acc8-0xc3;const _0xba73ef=a25_0xba73();let _0x4bcc6b=_0xba73ef[_0x42acc8];return _0x4bcc6b;}(function(_0x429ad9,_0x592d3e){const _0x125b20=a25_0x4bcc,_0x2ca0f6=_0x429ad9();while(!![]){try{const _0xe4f826=-parseInt(_0x125b20(0xcf))/0x1+parseInt(_0x125b20(0xd2))/0x2+-parseInt(_0x125b20(0xf2))/0x3*(parseInt(_0x125b20(0xd4))/0x4)+parseInt(_0x125b20(0xc8))/0x5+parseInt(_0x125b20(0xe7))/0x6+-parseInt(_0x125b20(0xeb))/0x7+-parseInt(_0x125b20(0xc7))/0x8*(-parseInt(_0x125b20(0xca))/0x9);if(_0xe4f826===_0x592d3e)break;else _0x2ca0f6['push'](_0x2ca0f6['shift']());}catch(_0x6ddf7e){_0x2ca0f6['push'](_0x2ca0f6['shift']());}}}(a25_0xba73,0x7de95));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a25_0xba73(){const _0x59ccd4=['\x20splits','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','output','options','\x20[Job\x20ID:\x20','information_schema','Executing\x20query\x20[','join','description','Query\x20completed:\x20Processed\x20','elapsedTimeMillis','totalSplits','Statement\x20','4515150pzZDmg','stats','originalMessage','push','5825932LNERRR','Schema:\x20','file','site','execute','name','catalog','19377qaysLT','Error:\x20','message','setJobId','setPhase','in\x20','database','verbose','args','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','10658720oDkfRb','342330ahqmvJ','query','9VvQXFy','\x20rows\x20','processedRows','No\x20SQL\x20provided','\x20-\x20','984944Hpkzez','length','error','1870650YypyOs','Catalog:\x20','468PvsIrN','Executing\x20statement\x20','jobId','validate','Site:\x20','Executing\x20query...'];a25_0xba73=function(){return _0x59ccd4;};return a25_0xba73();}export class QueryCommand extends BaseCommand{[a25_0x1b7097(0xf0)]='query';[a25_0x1b7097(0xe2)]='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x1b7097(0xef)](_0x62c7e){const _0x43952a=a25_0x1b7097,{options:_0x1ca67c,args:_0x23e521,tdx:_0x308855}=_0x62c7e,_0x41ea32=_0x23e521[0x0],_0x2827e5=_0x1ca67c[_0x43952a(0xed)];let _0x5da501;try{if(_0x2827e5)_0x5da501=readSqlStatementsFromFile(_0x2827e5);else{if(_0x41ea32==='-')_0x5da501=await readSqlStatementsFromStdin();else{if(_0x41ea32&&isSqlFilePath(_0x41ea32))_0x5da501=readSqlStatementsFromFile(_0x41ea32);else{if(_0x41ea32)_0x5da501=splitSqlStatements(_0x41ea32);else throw new Error(_0x43952a(0xcd));}}}}catch(_0x53f622){return console['error'](_0x43952a(0xf3)+_0x53f622[_0x43952a(0xf4)]),0x1;}const _0x176de3=_0x1ca67c[_0x43952a(0xc3)]||_0x43952a(0xdf),_0x1540c9=_0x1ca67c[_0x43952a(0xf1)];try{const _0x14e58d=[],_0x22c6f5=!!_0x1ca67c[_0x43952a(0xdc)];for(let _0x49690d=0x0;_0x49690d<_0x5da501[_0x43952a(0xd0)];_0x49690d++){const _0x15e37b=_0x5da501[_0x49690d],_0x42958d=_0x49690d+0x1,_0x22aaa3=_0x5da501[_0x43952a(0xd0)],_0x58e398=_0x22aaa3>0x1;_0x1ca67c[_0x43952a(0xc4)]&&(console['error']('\x0a'+(_0x58e398?_0x43952a(0xe6)+_0x42958d+'/'+_0x22aaa3+':':'')),console[_0x43952a(0xd1)](_0x43952a(0xd8)+_0x1ca67c[_0x43952a(0xee)]),console[_0x43952a(0xd1)](_0x43952a(0xd3)+(_0x1540c9||'td')),console[_0x43952a(0xd1)](_0x43952a(0xec)+_0x176de3),console['error']('SQL:\x20'+_0x15e37b));const _0x35d3f2=_0x58e398?_0x43952a(0xd5)+_0x42958d+'/'+_0x22aaa3+'...':_0x43952a(0xd9);try{const _0x1946db=await withProgressSpinner(_0x35d3f2,async _0x3fec4c=>{const _0x5f57be=_0x43952a,_0x3883a5=await _0x308855[_0x5f57be(0xc9)]['execute'](_0x15e37b,{'catalog':_0x1540c9,'schema':_0x176de3,'onJobId':_0x1d73f7=>{const _0x4f29e9=_0x5f57be;_0x3fec4c[_0x4f29e9(0xf5)](_0x1d73f7);},'onProgress':_0x593d2a=>{const _0x3c4c2c=_0x5f57be;_0x3fec4c[_0x3c4c2c(0xf6)](_0x3c4c2c(0xe0)+_0x593d2a['state']+']'),_0x3fec4c['setExtra'](formatRows(_0x593d2a['processedRows'])+_0x3c4c2c(0xcb)+_0x593d2a['completedSplits']+'/'+_0x593d2a[_0x3c4c2c(0xe5)]+_0x3c4c2c(0xda));}});return _0x3883a5;},{'verbose':_0x1ca67c[_0x43952a(0xc4)]}),_0x2536f8=_0x1946db['data'],_0x2c2bd5=_0x2536f8[_0x43952a(0xd6)]?_0x43952a(0xde)+_0x2536f8[_0x43952a(0xd6)]+']':'',_0x5bb8e0=_0x58e398?'Statement\x20'+_0x42958d+'/'+_0x22aaa3+_0x43952a(0xce):'';console[_0x43952a(0xd1)]('✔\x20'+_0x5bb8e0+_0x43952a(0xe3)+formatRows(_0x2536f8[_0x43952a(0xe8)][_0x43952a(0xcc)])+'\x20rows\x20'+(_0x43952a(0xf7)+formatElapsed(_0x2536f8['stats'][_0x43952a(0xe4)])+_0x2c2bd5));if(_0x58e398&&_0x22c6f5){const _0x4b00c3=resolveOutputOptions(_0x1ca67c),_0x4b0bd5=await formatQueryOutput(_0x2536f8,_0x4b00c3);_0x14e58d[_0x43952a(0xea)](_0x4b0bd5);}else await handleQueryOutput(_0x2536f8,_0x1ca67c);}catch(_0x26a0fe){const _0x41111e=_0x58e398?_0x43952a(0xe6)+_0x42958d+'/'+_0x22aaa3+':\x0a':'',_0x361db6=_0x26a0fe instanceof SDKError?_0x26a0fe[_0x43952a(0xe9)]:_0x26a0fe[_0x43952a(0xf4)];return console[_0x43952a(0xd1)](''+_0x41111e+_0x361db6),0x1;}}if(_0x5da501[_0x43952a(0xd0)]>0x1&&_0x22c6f5&&_0x14e58d[_0x43952a(0xd0)]>0x0){const _0x569419=_0x14e58d[_0x43952a(0xe1)]('\x0a');writeFileSync(_0x1ca67c[_0x43952a(0xdc)],_0x569419),console[_0x43952a(0xd1)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x1ca67c[_0x43952a(0xdc)]);}return 0x0;}catch(_0x44d750){throw _0x44d750;}}[a25_0x1b7097(0xd7)](_0x474158){const _0x350488=a25_0x1b7097,_0x2cebd9=_0x474158[_0x350488(0xc5)][0x0],_0x4e4512=_0x474158[_0x350488(0xdd)][_0x350488(0xed)];if(!_0x2cebd9&&!_0x4e4512)return _0x350488(0xc6);if(_0x2cebd9&&_0x4e4512)return _0x350488(0xdb);return undefined;}}
|