@treasuredata/tdx 0.14.5 → 0.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/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.d.ts +0 -4
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.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/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/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/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.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/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.d.ts +3 -2
- package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js.map +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/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/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/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/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/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.d.ts +21 -0
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +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 a21_0x32761f=a21_0x39f1;(function(_0x14fa34,_0x53f61b){const _0x188e5c=a21_0x39f1,_0x3e3912=_0x14fa34();while(!![]){try{const _0x2a7daa=parseInt(_0x188e5c(0x290))/0x1+-parseInt(_0x188e5c(0x191))/0x2*(-parseInt(_0x188e5c(0x1be))/0x3)+parseInt(_0x188e5c(0x19a))/0x4+-parseInt(_0x188e5c(0x227))/0x5+parseInt(_0x188e5c(0x214))/0x6+-parseInt(_0x188e5c(0x276))/0x7*(-parseInt(_0x188e5c(0x267))/0x8)+-parseInt(_0x188e5c(0x280))/0x9*(parseInt(_0x188e5c(0x22b))/0xa);if(_0x2a7daa===_0x53f61b)break;else _0x3e3912['push'](_0x3e3912['shift']());}catch(_0x13170f){_0x3e3912['push'](_0x3e3912['shift']());}}}(a21_0x2a24,0xc5b20));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x37b6cd 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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x17398f from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x3e0dfe){const _0x519e6b=a21_0x39f1,_0x315c48=process[_0x519e6b(0x19d)],_0x431676=_0x315c48===_0x519e6b(0x1c5)?_0x519e6b(0x248):_0x315c48===_0x519e6b(0x291)?_0x519e6b(0x187):_0x519e6b(0x23d);spawn(_0x431676,[_0x3e0dfe],{'detached':!![],'stdio':_0x519e6b(0x234)})[_0x519e6b(0x27f)]();}function migrateLegacyDirectory(){const _0x3b7dcb=a21_0x39f1;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x38fe16=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x38fe16[_0x3b7dcb(0x1ca)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3b7dcb(0x288)](a21_0x17398f[_0x3b7dcb(0x1a8)](_0x3b7dcb(0x226)+LEGACY_PARENT_SEGMENT_DIR+_0x3b7dcb(0x215)+PARENT_SEGMENT_DIR+_0x3b7dcb(0x2a2))),console[_0x3b7dcb(0x288)](a21_0x17398f[_0x3b7dcb(0x262)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3b7dcb(0x1d9))),![];console[_0x3b7dcb(0x288)](a21_0x17398f[_0x3b7dcb(0x1a8)](_0x3b7dcb(0x275)+LEGACY_PARENT_SEGMENT_DIR+_0x3b7dcb(0x225)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3b7dcb(0x288)](a21_0x17398f[_0x3b7dcb(0x1d4)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x33d8ad){const _0xb0a02d=_0x33d8ad instanceof Error?_0x33d8ad[_0x3b7dcb(0x21d)]:String(_0x33d8ad);return console[_0x3b7dcb(0x288)](a21_0x17398f[_0x3b7dcb(0x29c)](_0x3b7dcb(0x29a)+_0xb0a02d+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x32761f(0x237)](_0x4dd7d5){const _0x591a32=a21_0x32761f;return migrateLegacyDirectory(),super[_0x591a32(0x237)](_0x4dd7d5);}}function resolveYamlFile(_0x452e22){const _0x3aea10=a21_0x32761f;if(_0x452e22[_0x3aea10(0x206)](_0x3aea10(0x1ce))||_0x452e22['endsWith'](_0x3aea10(0x193)))return _0x452e22;return a21_0x37b6cd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x452e22)+_0x3aea10(0x1ce));}function formatProgressMessage(_0x187150){const _0x3db2cd=a21_0x32761f,_0x19b0a3=_0x187150['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x19b0a3){const [,_0x1205d6,_0x1fbaf8,_0x4e3d2f='']=_0x19b0a3;return a21_0x17398f[_0x3db2cd(0x262)](_0x1205d6+':')+'\x20'+_0x1fbaf8+a21_0x17398f[_0x3db2cd(0x262)](_0x4e3d2f);}return a21_0x17398f[_0x3db2cd(0x262)](_0x187150);}function showFileNotFoundError(_0x583743,_0x2e4329){const _0x51183e=a21_0x32761f;console[_0x51183e(0x288)](a21_0x17398f['red'](_0x51183e(0x212)+_0x583743+'\x0a')),console[_0x51183e(0x288)](a21_0x17398f[_0x51183e(0x180)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x2e4329+_0x51183e(0x1df)));}function showParentSegmentNotSetError(_0x214ebf){const _0x47a3ca=a21_0x32761f;console[_0x47a3ca(0x288)](a21_0x17398f[_0x47a3ca(0x1a8)](_0x47a3ca(0x254))),console[_0x47a3ca(0x288)](_0x214ebf);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x19e);[a21_0x32761f(0x274)]=a21_0x32761f(0x1f0);async[a21_0x32761f(0x240)](_0x26cbc1){const _0x3cd0d1=a21_0x32761f,{options:_0x16aeb5,args:_0x1ca543,tdx:_0x41994e}=_0x26cbc1,_0x41bd94=_0x1ca543[0x0];_0x16aeb5['verbose']&&(console[_0x3cd0d1(0x288)]('Site:\x20'+_0x16aeb5[_0x3cd0d1(0x27d)]),_0x41bd94&&console[_0x3cd0d1(0x288)](_0x3cd0d1(0x1f2)+_0x41bd94));const _0x1a328e=await withSpinner(_0x41bd94?_0x3cd0d1(0x287)+_0x41bd94+_0x3cd0d1(0x1f4):_0x3cd0d1(0x256),()=>_0x41994e[_0x3cd0d1(0x21c)]['listParents'](),{'verbose':_0x16aeb5[_0x3cd0d1(0x1ab)]});let _0x2784c3=_0x1a328e[_0x3cd0d1(0x28e)];if(_0x41bd94){const _0x3c5715=_0x41bd94[_0x3cd0d1(0x299)](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')[_0x3cd0d1(0x299)](/\?/g,'.'),_0x127a11=new RegExp('^'+_0x3c5715+'$','i');_0x2784c3=_0x2784c3[_0x3cd0d1(0x181)](_0x1b2dcf=>_0x127a11[_0x3cd0d1(0x272)](_0x1b2dcf['attributes'][_0x3cd0d1(0x286)]));}_0x2784c3[_0x3cd0d1(0x1db)]((_0x16cc49,_0x337545)=>_0x16cc49[_0x3cd0d1(0x1ae)][_0x3cd0d1(0x286)][_0x3cd0d1(0x1e8)](_0x337545[_0x3cd0d1(0x1ae)][_0x3cd0d1(0x286)])),console['error'](_0x3cd0d1(0x28a)+_0x2784c3[_0x3cd0d1(0x1b7)]+'\x20parent\x20segment'+(_0x2784c3[_0x3cd0d1(0x1b7)]!==0x1?'s':''));const _0x36b4e0=_0x330088=>{const _0x2ad9ca=_0x3cd0d1;return getConsoleNextUrl(_0x16aeb5[_0x2ad9ca(0x27d)],_0x2ad9ca(0x18e)+_0x330088);};if(_0x16aeb5[_0x3cd0d1(0x22c)]==='json'||_0x16aeb5[_0x3cd0d1(0x22c)]===_0x3cd0d1(0x1de)){const _0x10a3e4=_0x2784c3[_0x3cd0d1(0x1b5)](_0x3abdd6=>({..._0x3abdd6,'url':_0x36b4e0(_0x3abdd6['id'])}));await handleSDKOutput(_0x10a3e4,_0x16aeb5);}else{if(_0x2784c3['length']===0x0)_0x41bd94?console[_0x3cd0d1(0x284)](_0x3cd0d1(0x278)+_0x41bd94):console['log'](_0x3cd0d1(0x269));else for(const _0x2f14b7 of _0x2784c3){const _0x1afbfa=_0x2f14b7[_0x3cd0d1(0x1ae)][_0x3cd0d1(0x231)]?a21_0x17398f['dim']('\x20('+formatRows(_0x2f14b7[_0x3cd0d1(0x1ae)][_0x3cd0d1(0x231)])+')'):'',_0x2df322=hyperlink(_0x2f14b7['attributes'][_0x3cd0d1(0x286)],_0x36b4e0(_0x2f14b7['id']));console[_0x3cd0d1(0x284)](_0x3cd0d1(0x1af)+_0x2df322+_0x1afbfa);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x1bc);[a21_0x32761f(0x274)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a21_0x32761f(0x240)](_0x38b060){const _0x3d884b=a21_0x32761f,{options:_0x5ce473,args:_0x5977de,tdx:_0x5897c4}=_0x38b060;console['error'](_0x3d884b(0x18b)+_0x3d884b(0x222)+_0x3d884b(0x1c7));const _0x3e776a=_0x5ce473;if(_0x5977de[_0x3d884b(0x1b7)]===0x0)return console[_0x3d884b(0x288)](a21_0x17398f[_0x3d884b(0x29c)](_0x3d884b(0x26d))),console[_0x3d884b(0x288)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x20a7c1=_0x5977de[0x0];if(!_0x3e776a[_0x3d884b(0x19c)]||!_0x3e776a[_0x3d884b(0x1d8)])return console[_0x3d884b(0x288)](_0x3d884b(0x1ac)),console[_0x3d884b(0x288)](_0x3d884b(0x289)),0x1;_0x3e776a[_0x3d884b(0x1ab)]&&(console[_0x3d884b(0x288)](_0x3d884b(0x270)+_0x3e776a[_0x3d884b(0x27d)]),console[_0x3d884b(0x288)]('Name:\x20'+_0x20a7c1),console['error']('Database:\x20'+_0x3e776a[_0x3d884b(0x19c)]),console['error'](_0x3d884b(0x28b)+_0x3e776a[_0x3d884b(0x1d8)]));const _0xb389ff=await loadJSONFromOptions(_0x3e776a[_0x3d884b(0x1ae)],_0x3e776a[_0x3d884b(0x246)]),_0xbf9307=await loadJSONFromOptions(_0x3e776a[_0x3d884b(0x2a5)],_0x3e776a['behaviorsFile']),_0x293bbb=await loadJSONFromOptions(_0x3e776a[_0x3d884b(0x1b6)],_0x3e776a['customerGroupFile']),_0x508711={'name':_0x20a7c1,'description':_0x3e776a[_0x3d884b(0x274)],'scheduleType':_0x3e776a['scheduleType'],'scheduleOption':_0x3e776a[_0x3d884b(0x230)],'timezone':_0x3e776a['timezone'],'master':{'parentDatabaseName':_0x3e776a[_0x3d884b(0x19c)],'parentTableName':_0x3e776a[_0x3d884b(0x1d8)]},'attributes':_0xb389ff,'behaviors':_0xbf9307,'customerGroup':_0x293bbb},_0x744715=await withSpinner(_0x3d884b(0x277)+_0x20a7c1+'\x27...',()=>_0x5897c4[_0x3d884b(0x21c)]['createParent'](_0x508711),{'verbose':_0x5ce473[_0x3d884b(0x1ab)]}),_0x2612ac=_0x744715[_0x3d884b(0x28e)];return console[_0x3d884b(0x288)](_0x3d884b(0x26e)+_0x2612ac[_0x3d884b(0x286)]+_0x3d884b(0x2a6)+_0x2612ac['id']),await handleSDKOutput([_0x2612ac],_0x5ce473),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x238);[a21_0x32761f(0x274)]=a21_0x32761f(0x184);async[a21_0x32761f(0x240)](_0x306b76){const _0x3f5b63=a21_0x32761f,{options:_0x5c5420,args:_0x122ee3,tdx:_0x29a12e}=_0x306b76;console[_0x3f5b63(0x288)](_0x3f5b63(0x1c3)+_0x3f5b63(0x222)+_0x3f5b63(0x1c7));const _0x222f39=_0x5c5420;if(_0x122ee3[_0x3f5b63(0x1b7)]===0x0)return console['error'](a21_0x17398f[_0x3f5b63(0x29c)](_0x3f5b63(0x26d))),console[_0x3f5b63(0x288)](_0x3f5b63(0x1d0)),0x1;const _0x676302=_0x122ee3[0x0];_0x222f39[_0x3f5b63(0x1ab)]&&(console[_0x3f5b63(0x288)](_0x3f5b63(0x270)+_0x222f39[_0x3f5b63(0x27d)]),console[_0x3f5b63(0x288)](_0x3f5b63(0x24f)+_0x676302));const _0x42fb2a=await withSpinner(_0x3f5b63(0x20b)+_0x676302+_0x3f5b63(0x1f4),()=>_0x29a12e[_0x3f5b63(0x21c)][_0x3f5b63(0x20c)](_0x676302),{'verbose':_0x222f39[_0x3f5b63(0x1ab)]}),_0x4f3940=_0x42fb2a[_0x3f5b63(0x28e)],_0x50d70e=await loadJSONFromOptions(_0x222f39[_0x3f5b63(0x2a9)],_0x222f39[_0x3f5b63(0x25c)]),_0x3271ba=await loadJSONFromOptions(_0x222f39[_0x3f5b63(0x239)],_0x222f39['addBehaviorsFile']),_0x411b2c={'name':_0x4f3940['name'],'description':_0x222f39[_0x3f5b63(0x274)]!==undefined?_0x222f39[_0x3f5b63(0x274)]:_0x4f3940[_0x3f5b63(0x274)],'scheduleType':_0x222f39[_0x3f5b63(0x265)]!==undefined?_0x222f39[_0x3f5b63(0x265)]:_0x4f3940[_0x3f5b63(0x265)],'scheduleOption':_0x222f39[_0x3f5b63(0x230)]!==undefined?_0x222f39[_0x3f5b63(0x230)]:_0x4f3940['scheduleOption'],'timezone':_0x222f39[_0x3f5b63(0x22e)]!==undefined?_0x222f39[_0x3f5b63(0x22e)]:_0x4f3940[_0x3f5b63(0x22e)],'master':_0x4f3940[_0x3f5b63(0x1f9)],'attributes':_0x50d70e?[..._0x4f3940['attributes']||[],..._0x50d70e]:_0x4f3940[_0x3f5b63(0x1ae)],'behaviors':_0x3271ba?[..._0x4f3940[_0x3f5b63(0x2a5)]||[],..._0x3271ba]:_0x4f3940[_0x3f5b63(0x2a5)],'customerGroup':_0x4f3940[_0x3f5b63(0x1b6)]},_0x34711b=await withSpinner(_0x3f5b63(0x250)+_0x676302+_0x3f5b63(0x1f4),()=>_0x29a12e['segment'][_0x3f5b63(0x1b9)](_0x676302,_0x411b2c),{'verbose':_0x222f39[_0x3f5b63(0x1ab)]}),_0x5c264c=_0x34711b['data'];return console[_0x3f5b63(0x288)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x5c264c[_0x3f5b63(0x286)]+'\x27'),await handleSDKOutput([_0x5c264c],_0x222f39),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x207);[a21_0x32761f(0x274)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x1a5ea2){const _0x583564=a21_0x32761f,{options:_0x31dc70,args:_0x24fefa,tdx:_0x1a7c6e}=_0x1a5ea2,_0x406b59=_0x31dc70,_0x462a05=_0x24fefa[0x0]||_0x31dc70[_0x583564(0x259)];if(!_0x462a05)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x583564(0x188)),0x1;if(_0x406b59[_0x583564(0x17e)]&&_0x406b59[_0x583564(0x1cd)])return console[_0x583564(0x288)](a21_0x17398f[_0x583564(0x29c)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x583564(0x288)](a21_0x17398f[_0x583564(0x262)](_0x583564(0x21b))),console['error'](a21_0x17398f['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x583564(0x1b8))),console['error'](a21_0x17398f[_0x583564(0x180)](_0x583564(0x183))),0x1;const _0x9b113f=_0x406b59['output']||a21_0x37b6cd[_0x583564(0x22f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x462a05)+_0x583564(0x1ce));_0x406b59[_0x583564(0x1ab)]&&(console[_0x583564(0x288)]('Site:\x20'+_0x406b59[_0x583564(0x27d)]),console[_0x583564(0x288)](_0x583564(0x24f)+_0x462a05),console[_0x583564(0x288)](_0x583564(0x1bd)+_0x9b113f));const _0x150a00=await withSpinner(_0x583564(0x1a2)+_0x462a05+'\x27...',()=>_0x1a7c6e[_0x583564(0x21c)][_0x583564(0x235)](_0x462a05),{'verbose':_0x406b59['verbose']}),_0x9f79d3=_0x150a00[_0x583564(0x28e)];if(existsSync(_0x9b113f)){const _0x3e3d55=readFileSync(_0x9b113f,_0x583564(0x279)),_0x22c155=generateDiff(_0x3e3d55,_0x9f79d3);if(!hasChanges(_0x22c155))console[_0x583564(0x288)](a21_0x17398f[_0x583564(0x1d4)]('✔')+_0x583564(0x24d)+a21_0x17398f[_0x583564(0x180)](_0x9b113f)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x583564(0x288)](_0x583564(0x255)+_0x9b113f+'\x27:'),console[_0x583564(0x288)]('─'[_0x583564(0x218)](0x3c)),console[_0x583564(0x288)](formatDiffWithColors(_0x22c155)),console[_0x583564(0x288)]('─'[_0x583564(0x218)](0x3c));if(!_0x406b59[_0x583564(0x249)]){const _0x107949=await confirmKey(_0x583564(0x261)+_0x9b113f+'\x27?');if(!_0x107949)return console[_0x583564(0x288)](_0x583564(0x220)),0x1;}writeFileSync(_0x9b113f,_0x9f79d3,_0x583564(0x279)),console['error'](a21_0x17398f['green']('✔')+_0x583564(0x1e3)+a21_0x17398f[_0x583564(0x180)](_0x9b113f));}}else{const _0xdbc487=a21_0x37b6cd['dirname'](_0x9b113f);!existsSync(_0xdbc487)&&mkdirSync(_0xdbc487,{'recursive':!![]}),writeFileSync(_0x9b113f,_0x9f79d3,'utf-8'),console[_0x583564(0x288)](a21_0x17398f[_0x583564(0x1d4)]('✔')+_0x583564(0x1e3)+a21_0x17398f[_0x583564(0x180)](_0x9b113f));}return saveSessionContext({'parent_segment':_0x462a05},_0x406b59[_0x583564(0x1d1)]),console[_0x583564(0x288)](a21_0x17398f[_0x583564(0x1d4)]('✔')+_0x583564(0x1c9)+a21_0x17398f[_0x583564(0x262)](_0x583564(0x1cb))+_0x583564(0x22d)+a21_0x17398f[_0x583564(0x180)](_0x462a05)),0x0;}}function a21_0x39f1(_0x299a0d,_0x36f1b7){_0x299a0d=_0x299a0d-0x17e;const _0x2a249b=a21_0x2a24();let _0x39f120=_0x2a249b[_0x299a0d];return _0x39f120;}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x32761f(0x286)]='segment:parent:push';[a21_0x32761f(0x274)]=a21_0x32761f(0x1ef);async['execute'](_0x18e509){const _0x4b2660=a21_0x32761f,{options:_0x21e0bd,args:_0x1ac7f3,tdx:_0x54b9b0}=_0x18e509,_0x16003d=_0x21e0bd,_0x4468d9=_0x1ac7f3[0x0]||_0x21e0bd['parentSegment'];if(!_0x4468d9)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'+_0x4b2660(0x204)),0x1;const _0xc5a972=resolveYamlFile(_0x4468d9);if(!existsSync(_0xc5a972))return showFileNotFoundError(_0xc5a972,_0x4468d9),0x1;_0x16003d[_0x4b2660(0x1ab)]&&(console['error']('Site:\x20'+_0x16003d[_0x4b2660(0x27d)]),console[_0x4b2660(0x288)](_0x4b2660(0x194)+_0xc5a972));let _0x31caf7;try{_0x31caf7=readFileSync(_0xc5a972,_0x4b2660(0x279));}catch(_0x499d1b){const _0x3c1209=_0x499d1b instanceof Error?_0x499d1b[_0x4b2660(0x21d)]:String(_0x499d1b);return console['error'](_0x4b2660(0x1ad)+_0x3c1209),0x1;}const _0x5f2fda=await withSpinner(_0x4b2660(0x29d),()=>_0x54b9b0[_0x4b2660(0x21c)][_0x4b2660(0x233)](_0x31caf7),{'verbose':_0x16003d[_0x4b2660(0x1ab)]}),_0x21a252=_0x5f2fda[_0x4b2660(0x28e)],{isNew:_0x5e1d4a,name:_0x513eab,hasChanges:_0x46296c,diffFormatted:_0x376436}=_0x21a252;if(!_0x46296c)return console[_0x4b2660(0x288)](_0x4b2660(0x282)+_0x513eab+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x5e1d4a?console[_0x4b2660(0x288)](_0x4b2660(0x199)+_0x513eab+'\x27:'):console['error'](_0x4b2660(0x245)+_0x513eab+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x376436),console[_0x4b2660(0x288)]('─'['repeat'](0x3c));const _0x32dc1e=_0x5e1d4a?_0x4b2660(0x1ff)+_0x513eab+'\x27?':_0x4b2660(0x292)+_0x513eab+'\x27?';if(!_0x16003d[_0x4b2660(0x249)]){const _0x40aacd=await confirmKey(_0x32dc1e);if(!_0x40aacd)return console[_0x4b2660(0x288)](_0x4b2660(0x220)),0x1;}const _0x546a6e=_0x5e1d4a?_0x4b2660(0x1ba):_0x4b2660(0x217),_0x390234=await withSpinner(_0x546a6e+_0x4b2660(0x203)+_0x513eab+'\x27...',()=>_0x21a252[_0x4b2660(0x268)](),{'verbose':_0x16003d['verbose']}),_0x25d964=_0x390234[_0x4b2660(0x28e)],_0x216825=getConsoleNextUrl(_0x16003d[_0x4b2660(0x27d)],_0x4b2660(0x18e)+_0x25d964['id']),_0x111d63=_0x5e1d4a?'Created':_0x4b2660(0x244);return console[_0x4b2660(0x288)]('✔\x20'+_0x111d63+'\x20parent\x20segment\x20\x27'+_0x25d964['name']+'\x27'),console['error']('\x20\x20'+_0x216825),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x2ac);[a21_0x32761f(0x274)]=a21_0x32761f(0x1f3);async['execute'](_0x26be63){const _0x51c2db=a21_0x32761f,{options:_0x3683ff,args:_0x248af0,tdx:_0xc73041}=_0x26be63,_0x4e67d5=_0x3683ff,_0x47103e=_0x248af0[0x0]||_0x3683ff[_0x51c2db(0x259)];if(!_0x47103e)return showParentSegmentNotSetError(_0x51c2db(0x27e)+_0x51c2db(0x1bf)+_0x51c2db(0x243)+_0x51c2db(0x1a5)+_0x51c2db(0x1f5)+_0x51c2db(0x1aa)),0x1;const _0x38aef9=resolveYamlFile(_0x47103e);if(!existsSync(_0x38aef9))return showFileNotFoundError(_0x38aef9,_0x47103e),0x1;_0x4e67d5[_0x51c2db(0x1ab)]&&(console[_0x51c2db(0x288)](_0x51c2db(0x270)+_0x4e67d5[_0x51c2db(0x27d)]),console[_0x51c2db(0x288)](_0x51c2db(0x194)+_0x38aef9));let _0x394180;try{_0x394180=readFileSync(_0x38aef9,'utf-8');}catch(_0x11cc92){const _0x7b032b=_0x11cc92 instanceof Error?_0x11cc92[_0x51c2db(0x21d)]:String(_0x11cc92);return console[_0x51c2db(0x288)](_0x51c2db(0x1ad)+_0x7b032b),0x1;}const _0x3f239f=createCommandSpinner(a21_0x17398f[_0x51c2db(0x262)](_0x51c2db(0x1fa)),{'verbose':_0x4e67d5['verbose']});_0x3f239f[_0x51c2db(0x187)]();const _0xd5d344={'onProgress':_0x19bd71=>{const _0x2002e5=_0x51c2db;_0x3f239f[_0x2002e5(0x229)]=formatProgressMessage(_0x19bd71);}};if(_0x4e67d5[_0x51c2db(0x1f9)])_0xd5d344['master']=!![];if(_0x4e67d5['enriched'])_0xd5d344['enriched']=!![];_0x4e67d5['attribute']&&(_0xd5d344[_0x51c2db(0x29e)]=_0x4e67d5[_0x51c2db(0x29e)]);_0x4e67d5['behavior']&&(_0xd5d344['behavior']=_0x4e67d5[_0x51c2db(0x26f)]);if(_0x4e67d5[_0x51c2db(0x23c)])_0xd5d344[_0x51c2db(0x23c)]=_0x4e67d5[_0x51c2db(0x23c)];let _0x462eaa;try{_0x462eaa=await _0xc73041[_0x51c2db(0x21c)][_0x51c2db(0x285)](_0x394180,_0xd5d344),_0x3f239f['stop']();}catch(_0x664e2a){_0x3f239f[_0x51c2db(0x24c)]();throw _0x664e2a;}const _0x5edbb9=_0x4e67d5[_0x51c2db(0x23c)]||_0x51c2db(0x1e1);return this['displayValidateResults'](_0x462eaa,_0xd5d344,_0x38aef9,_0x5edbb9),_0x462eaa[_0x51c2db(0x196)]?0x0:0x1;}[a21_0x32761f(0x200)](_0x3dbb81,_0x33e17c,_0x5d1f89,_0x423db3){const _0x23305d=a21_0x32761f;console[_0x23305d(0x288)]('\x0a'+a21_0x17398f[_0x23305d(0x260)]('Validate:')+'\x20'+_0x3dbb81[_0x23305d(0x286)]),console[_0x23305d(0x288)]('═'[_0x23305d(0x218)](0x3c)),this[_0x23305d(0x208)](_0x3dbb81);if(typeof _0x33e17c[_0x23305d(0x29e)]===_0x23305d(0x1eb)){this['displayAttributesStats'](_0x3dbb81),this[_0x23305d(0x18d)](_0x3dbb81),this['displayPreviewHints'](_0x5d1f89,_0x423db3,_0x23305d(0x29e),_0x33e17c[_0x23305d(0x29e)]);return;}if(_0x33e17c[_0x23305d(0x29e)]===!![]){this[_0x23305d(0x28f)](_0x3dbb81),this[_0x23305d(0x18d)](_0x3dbb81),this[_0x23305d(0x1dc)](_0x5d1f89,_0x423db3,_0x23305d(0x1ae));return;}if(typeof _0x33e17c['behavior']===_0x23305d(0x1eb)){this['displayBehaviorsStats'](_0x3dbb81,_0x423db3),this[_0x23305d(0x18d)](_0x3dbb81),this[_0x23305d(0x1dc)](_0x5d1f89,_0x423db3,_0x23305d(0x26f),_0x33e17c[_0x23305d(0x26f)]);return;}if(_0x33e17c[_0x23305d(0x26f)]===!![]){this[_0x23305d(0x1c2)](_0x3dbb81,_0x423db3),this[_0x23305d(0x18d)](_0x3dbb81),this[_0x23305d(0x1dc)](_0x5d1f89,_0x423db3,_0x23305d(0x2a5));return;}this['displayAttributesStats'](_0x3dbb81),this['displayBehaviorsStats'](_0x3dbb81,_0x423db3),this[_0x23305d(0x18d)](_0x3dbb81),this[_0x23305d(0x1dc)](_0x5d1f89,_0x423db3,_0x23305d(0x236));}[a21_0x32761f(0x1dc)](_0x3a620a,_0xe84757,_0x3087be,_0x279990){const _0x171d17=a21_0x32761f;console[_0x171d17(0x288)]('\x0a'+a21_0x17398f[_0x171d17(0x262)](_0x171d17(0x1b1)));const _0x70b0e0=_0xe84757!==_0x171d17(0x1e1)?_0x171d17(0x1a0)+_0xe84757:'';if(_0x3087be==='attribute'&&_0x279990)console['error']('\x20\x20'+a21_0x17398f['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x3a620a+_0x171d17(0x1c8)+_0x279990+'\x22'+_0x70b0e0));else{if(_0x3087be===_0x171d17(0x26f)&&_0x279990)console[_0x171d17(0x288)]('\x20\x20'+a21_0x17398f[_0x171d17(0x262)](_0x171d17(0x251)+_0x3a620a+_0x171d17(0x1da)+_0x279990+'\x22'+_0x70b0e0));else(_0x3087be===_0x171d17(0x1ae)||_0x3087be===_0x171d17(0x236))&&console[_0x171d17(0x288)]('\x20\x20'+a21_0x17398f[_0x171d17(0x262)](_0x171d17(0x251)+_0x3a620a+_0x171d17(0x27c)+_0x70b0e0));}(_0x3087be===_0x171d17(0x2a5)||_0x3087be==='all')&&console['error']('\x20\x20'+a21_0x17398f[_0x171d17(0x262)]('tdx\x20segment\x20parent\x20preview\x20'+_0x3a620a+'\x20--behavior\x20\x22<name>\x22'+_0x70b0e0)),_0x3087be===_0x171d17(0x236)&&console[_0x171d17(0x288)]('\x20\x20'+a21_0x17398f['dim'](_0x171d17(0x251)+_0x3a620a+_0x171d17(0x2a0)+_0x70b0e0));}[a21_0x32761f(0x208)](_0x41d7d2){const _0x239b97=a21_0x32761f,{master:_0xa824a6}=_0x41d7d2,_0x862d8f=_0xa824a6[_0x239b97(0x198)]?a21_0x17398f['green']('✔'):a21_0x17398f[_0x239b97(0x29c)]('✘');console['error']('\x0a'+a21_0x17398f[_0x239b97(0x262)](_0x239b97(0x1e5))),console['error'](_0x862d8f+'\x20'+a21_0x17398f['bold'](_0xa824a6[_0x239b97(0x19c)]+'.'+_0xa824a6[_0x239b97(0x1d8)])),_0xa824a6[_0x239b97(0x198)]?_0xa824a6[_0x239b97(0x241)]!==undefined&&console[_0x239b97(0x288)]('\x20\x20'+a21_0x17398f['dim'](_0x239b97(0x210))+'\x20'+a21_0x17398f[_0x239b97(0x180)](formatRows(_0xa824a6[_0x239b97(0x241)]))):console['error']('\x20\x20'+a21_0x17398f[_0x239b97(0x29c)](_0x239b97(0x1fd))+'\x20'+_0xa824a6[_0x239b97(0x25b)]);}['displayAttributesStats'](_0x1a609b){const _0x2be73d=a21_0x32761f;if(_0x1a609b[_0x2be73d(0x1ae)][_0x2be73d(0x1b7)]===0x0)return;console['error']('\x0a'+a21_0x17398f['dim'](_0x2be73d(0x2aa)));for(const _0x43c88d of _0x1a609b['attributes']){const _0x49140e=_0x43c88d['schemaValid']?a21_0x17398f['green']('✔'):a21_0x17398f[_0x2be73d(0x29c)]('✘');let _0x469876='';if(_0x43c88d[_0x2be73d(0x198)]&&_0x43c88d[_0x2be73d(0x20e)]!==undefined&&_0x43c88d[_0x2be73d(0x21a)]!==undefined){const _0x106b43=_0x43c88d[_0x2be73d(0x21a)][_0x2be73d(0x18f)](0x1),_0x1debd5=_0x43c88d[_0x2be73d(0x21a)]>=0x50?a21_0x17398f[_0x2be73d(0x1d4)]:_0x43c88d['coveragePercent']>=0x32?a21_0x17398f[_0x2be73d(0x1a8)]:a21_0x17398f[_0x2be73d(0x29c)];_0x469876='\x20'+a21_0x17398f[_0x2be73d(0x262)](_0x2be73d(0x2a8))+'\x20'+_0x1debd5(_0x106b43+'%')+'\x20('+formatRows(_0x43c88d[_0x2be73d(0x20e)])+_0x2be73d(0x2a4);}console['error'](_0x49140e+'\x20'+a21_0x17398f[_0x2be73d(0x260)](_0x43c88d[_0x2be73d(0x286)])+_0x469876),console['error']('\x20\x20'+a21_0x17398f['dim'](_0x2be73d(0x25a))+'\x20'+a21_0x17398f[_0x2be73d(0x260)](_0x43c88d[_0x2be73d(0x19c)]+'.'+_0x43c88d[_0x2be73d(0x1d8)]));const _0x1c091b=_0x43c88d[_0x2be73d(0x1fe)]===_0x43c88d['foreignKey']?a21_0x17398f[_0x2be73d(0x262)](_0x2be73d(0x27a))+'\x20'+_0x43c88d[_0x2be73d(0x1fe)]:a21_0x17398f['dim'](_0x2be73d(0x1fc))+'\x20'+_0x43c88d[_0x2be73d(0x1fe)]+_0x2be73d(0x22d)+_0x43c88d[_0x2be73d(0x1c4)];console[_0x2be73d(0x288)]('\x20\x20'+_0x1c091b),console[_0x2be73d(0x288)]('\x20\x20'+a21_0x17398f[_0x2be73d(0x262)](_0x2be73d(0x1ed))),this[_0x2be73d(0x20a)](_0x43c88d[_0x2be73d(0x23a)]),!_0x43c88d[_0x2be73d(0x198)]&&console[_0x2be73d(0x288)]('\x20\x20'+a21_0x17398f['red'](_0x2be73d(0x1fd))+'\x20'+_0x43c88d[_0x2be73d(0x25b)]);}}[a21_0x32761f(0x1c2)](_0x31788e,_0x35609c){const _0x1797bd=a21_0x32761f;if(_0x31788e[_0x1797bd(0x2a5)]['length']===0x0)return;console[_0x1797bd(0x288)]('\x0a'+a21_0x17398f[_0x1797bd(0x262)](_0x1797bd(0x1e7))+'\x20'+a21_0x17398f['dim']('('+_0x35609c+')'));for(const _0x34f54e of _0x31788e[_0x1797bd(0x2a5)]){const _0x7c8d9d=_0x34f54e['schemaValid']?a21_0x17398f[_0x1797bd(0x1d4)]('✔'):a21_0x17398f[_0x1797bd(0x29c)]('✘');let _0x461891='';if(_0x34f54e['schemaValid']&&_0x34f54e[_0x1797bd(0x1d7)]!==undefined&&_0x34f54e[_0x1797bd(0x1f7)]!==undefined){const _0x45c84e=_0x34f54e[_0x1797bd(0x1a1)]?.[_0x1797bd(0x18f)](0x1)||'?',_0x5110c7=(_0x34f54e[_0x1797bd(0x1a1)]??0x0)>=0x32?a21_0x17398f['green']:(_0x34f54e[_0x1797bd(0x1a1)]??0x0)>=0x14?a21_0x17398f[_0x1797bd(0x1a8)]:a21_0x17398f[_0x1797bd(0x29c)];_0x461891='\x20'+a21_0x17398f[_0x1797bd(0x262)]('Customers:')+'\x20'+_0x5110c7(formatRows(_0x34f54e[_0x1797bd(0x1d7)]))+'\x20('+_0x45c84e+_0x1797bd(0x242)+a21_0x17398f[_0x1797bd(0x262)](_0x1797bd(0x1c1))+'\x20'+a21_0x17398f[_0x1797bd(0x180)](formatRows(_0x34f54e[_0x1797bd(0x1f7)]));}console[_0x1797bd(0x288)](_0x7c8d9d+'\x20'+a21_0x17398f[_0x1797bd(0x260)](_0x34f54e[_0x1797bd(0x286)])+_0x461891),console['error']('\x20\x20'+a21_0x17398f['dim'](_0x1797bd(0x25a))+'\x20'+a21_0x17398f[_0x1797bd(0x260)](_0x34f54e[_0x1797bd(0x19c)]+'.'+_0x34f54e[_0x1797bd(0x1d8)]));const _0x266474=_0x34f54e['joinKey']===_0x34f54e['foreignKey']?a21_0x17398f['dim'](_0x1797bd(0x27a))+'\x20'+_0x34f54e['joinKey']:a21_0x17398f[_0x1797bd(0x262)](_0x1797bd(0x1fc))+'\x20'+_0x34f54e[_0x1797bd(0x1fe)]+_0x1797bd(0x22d)+_0x34f54e['foreignKey'];console[_0x1797bd(0x288)]('\x20\x20'+_0x266474),console[_0x1797bd(0x288)]('\x20\x20'+a21_0x17398f[_0x1797bd(0x262)](_0x1797bd(0x1ed))),this['displayColumns'](_0x34f54e[_0x1797bd(0x23a)]),!_0x34f54e[_0x1797bd(0x198)]&&console[_0x1797bd(0x288)]('\x20\x20'+a21_0x17398f[_0x1797bd(0x29c)](_0x1797bd(0x1fd))+'\x20'+_0x34f54e['schemaError']);}}[a21_0x32761f(0x20a)](_0x3b402e){const _0x2be59=a21_0x32761f;for(const _0x597b14 of _0x3b402e){_0x597b14['label']===_0x597b14[_0x2be59(0x21f)]||_0x597b14[_0x2be59(0x21f)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x597b14['label']):console[_0x2be59(0x288)](_0x2be59(0x23e)+_0x597b14['label']+'\x20'+a21_0x17398f[_0x2be59(0x262)]('('+_0x597b14[_0x2be59(0x21f)]+')'));}}['displaySummary'](_0x194b2e){const _0x3b0bd9=a21_0x32761f;console[_0x3b0bd9(0x288)]('─'['repeat'](0x3c));if(_0x194b2e[_0x3b0bd9(0x29b)][_0x3b0bd9(0x1b7)]>0x0){console[_0x3b0bd9(0x288)]('\x0a'+a21_0x17398f[_0x3b0bd9(0x29c)](_0x3b0bd9(0x1a3)));for(const _0x40cf5f of _0x194b2e['errors']){console[_0x3b0bd9(0x288)]('\x20\x20'+a21_0x17398f[_0x3b0bd9(0x29c)]('•')+'\x20'+_0x40cf5f);}}_0x194b2e[_0x3b0bd9(0x196)]&&console[_0x3b0bd9(0x288)]('\x0a'+a21_0x17398f[_0x3b0bd9(0x1d4)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x32761f(0x286)]='segment:parent:preview';[a21_0x32761f(0x274)]=a21_0x32761f(0x1cc);async[a21_0x32761f(0x240)](_0x2a3f02){const _0x487152=a21_0x32761f,{options:_0x125680,args:_0x566b77,tdx:_0x5716d4}=_0x2a3f02,_0x4f9203=_0x125680,_0x2649d=_0x566b77[0x0]||_0x125680['parentSegment'];if(!_0x2649d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x487152(0x228)+_0x487152(0x202)+_0x487152(0x25d)+_0x487152(0x1b2)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x487152(0x1aa)),0x1;if(!_0x4f9203['master']&&!_0x4f9203[_0x487152(0x29e)]&&!_0x4f9203['behavior']&&!_0x4f9203[_0x487152(0x1dd)])return console[_0x487152(0x288)](a21_0x17398f[_0x487152(0x29c)](_0x487152(0x205))),console[_0x487152(0x288)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x487152(0x209)),console[_0x487152(0x288)](_0x487152(0x2a7)),console[_0x487152(0x288)](_0x487152(0x1fb)),console[_0x487152(0x288)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x487152(0x288)](_0x487152(0x22a)),0x1;const _0x380519=resolveYamlFile(_0x2649d);if(!existsSync(_0x380519))return showFileNotFoundError(_0x380519,_0x2649d),0x1;_0x4f9203['verbose']&&(console[_0x487152(0x288)](_0x487152(0x270)+_0x4f9203['site']),console[_0x487152(0x288)](_0x487152(0x194)+_0x380519));let _0x596ed5;try{_0x596ed5=readFileSync(_0x380519,'utf-8');}catch(_0x2e9d03){const _0x5d7dde=_0x2e9d03 instanceof Error?_0x2e9d03['message']:String(_0x2e9d03);return console['error'](_0x487152(0x1ad)+_0x5d7dde),0x1;}let _0x3d300f;try{_0x3d300f=parseDef(_0x596ed5);}catch(_0x18acf2){const _0x1ac409=_0x18acf2 instanceof Error?_0x18acf2[_0x487152(0x21d)]:String(_0x18acf2);return console['error'](a21_0x17398f['red']('Error\x20parsing\x20YAML:\x20'+_0x1ac409)),0x1;}if(_0x4f9203[_0x487152(0x29e)]===!![]||_0x4f9203[_0x487152(0x29e)]===''){const _0x3db729=_0x3d300f[_0x487152(0x1ae)]?.[_0x487152(0x1b5)](_0x6bcd74=>_0x6bcd74[_0x487152(0x286)])||[];if(_0x3db729[_0x487152(0x1b7)]===0x0)console[_0x487152(0x288)](a21_0x17398f[_0x487152(0x29c)](_0x487152(0x273)));else{console[_0x487152(0x288)](a21_0x17398f[_0x487152(0x29c)](_0x487152(0x1b3))),console['error']('Available\x20attributes:');for(const _0x4c7cf9 of _0x3db729){console[_0x487152(0x288)]('\x20\x20'+a21_0x17398f[_0x487152(0x180)](_0x4c7cf9));}console[_0x487152(0x288)](_0x487152(0x2ab)+_0x2649d+_0x487152(0x1c8)+_0x3db729[0x0]+'\x22');}return 0x1;}if(_0x4f9203[_0x487152(0x26f)]===!![]||_0x4f9203[_0x487152(0x26f)]===''){const _0x2d6ce5=_0x3d300f[_0x487152(0x2a5)]?.[_0x487152(0x1b5)](_0xbbf721=>_0xbbf721[_0x487152(0x286)])||[];if(_0x2d6ce5['length']===0x0)console[_0x487152(0x288)](a21_0x17398f['red'](_0x487152(0x20d)));else{console['error'](a21_0x17398f[_0x487152(0x29c)](_0x487152(0x298))),console['error'](_0x487152(0x219));for(const _0x2017be of _0x2d6ce5){console['error']('\x20\x20'+a21_0x17398f[_0x487152(0x180)](_0x2017be));}console[_0x487152(0x288)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2649d+_0x487152(0x1da)+_0x2d6ce5[0x0]+'\x22');}return 0x1;}const _0x46784b=createCommandSpinner(a21_0x17398f[_0x487152(0x262)](_0x487152(0x1a4)),{'verbose':_0x4f9203[_0x487152(0x1ab)]});_0x46784b[_0x487152(0x187)]();const _0x527c66={'onProgress':_0xf5842f=>{const _0x4dfa22=_0x487152;_0x46784b[_0x4dfa22(0x229)]=formatProgressMessage(_0xf5842f);}};if(_0x4f9203[_0x487152(0x1f9)])_0x527c66[_0x487152(0x1f9)]=!![];if(_0x4f9203['attribute']&&typeof _0x4f9203['attribute']===_0x487152(0x1eb))_0x527c66['attribute']=_0x4f9203[_0x487152(0x29e)];if(_0x4f9203[_0x487152(0x26f)]&&typeof _0x4f9203[_0x487152(0x26f)]===_0x487152(0x1eb))_0x527c66['behavior']=_0x4f9203[_0x487152(0x26f)];if(_0x4f9203[_0x487152(0x1dd)])_0x527c66['enriched']=!![];if(_0x4f9203[_0x487152(0x23c)])_0x527c66['interval']=_0x4f9203['interval'];let _0x2f77e1;try{_0x2f77e1=await _0x5716d4[_0x487152(0x21c)][_0x487152(0x252)](_0x596ed5,_0x527c66),_0x46784b[_0x487152(0x24c)]();}catch(_0x3ac435){_0x46784b[_0x487152(0x24c)]();throw _0x3ac435;}return await this[_0x487152(0x1b0)](_0x2f77e1,{'master':_0x4f9203[_0x487152(0x1f9)],'attribute':typeof _0x4f9203[_0x487152(0x29e)]===_0x487152(0x1eb)?_0x4f9203[_0x487152(0x29e)]:undefined,'behavior':typeof _0x4f9203[_0x487152(0x26f)]===_0x487152(0x1eb)?_0x4f9203[_0x487152(0x26f)]:undefined,'enriched':_0x4f9203[_0x487152(0x1dd)]}),_0x2f77e1[_0x487152(0x196)]?0x0:0x1;}async['displayPreviewResults'](_0x38bc0e,_0x4febbe){const _0x2669b7=a21_0x32761f;console[_0x2669b7(0x288)]('\x0a'+a21_0x17398f[_0x2669b7(0x260)](_0x2669b7(0x1a9))+'\x20'+_0x38bc0e['name']),console[_0x2669b7(0x288)]('═'[_0x2669b7(0x218)](0x3c));if(_0x4febbe[_0x2669b7(0x1f9)]&&_0x38bc0e[_0x2669b7(0x232)]){const _0x2aa7c2=a21_0x17398f[_0x2669b7(0x262)](_0x2669b7(0x263))+'\x20'+a21_0x17398f[_0x2669b7(0x260)](_0x38bc0e[_0x2669b7(0x1f9)][_0x2669b7(0x19c)]+'.'+_0x38bc0e[_0x2669b7(0x1f9)][_0x2669b7(0x1d8)]);await this[_0x2669b7(0x27b)](_0x2aa7c2,_0x38bc0e['sampleData']);}else{if(_0x4febbe[_0x2669b7(0x29e)]&&_0x38bc0e[_0x2669b7(0x232)]){const _0x313474=a21_0x17398f[_0x2669b7(0x262)]('Attribute:')+'\x20'+a21_0x17398f['bold'](_0x4febbe[_0x2669b7(0x29e)]);await this[_0x2669b7(0x27b)](_0x313474,_0x38bc0e[_0x2669b7(0x232)]);}else{if(_0x4febbe[_0x2669b7(0x26f)]&&_0x38bc0e[_0x2669b7(0x232)]){const _0x2a2763=a21_0x17398f[_0x2669b7(0x262)](_0x2669b7(0x223))+'\x20'+a21_0x17398f[_0x2669b7(0x260)](_0x4febbe[_0x2669b7(0x26f)]);await this[_0x2669b7(0x27b)](_0x2a2763,_0x38bc0e['sampleData']);}else{if(_0x4febbe[_0x2669b7(0x1dd)]&&_0x38bc0e[_0x2669b7(0x232)]){const _0x30448c=a21_0x17398f['dim'](_0x2669b7(0x182))+'\x20'+a21_0x17398f[_0x2669b7(0x260)](_0x2669b7(0x24b));await this[_0x2669b7(0x27b)](_0x30448c,_0x38bc0e[_0x2669b7(0x232)]);}else!_0x38bc0e[_0x2669b7(0x232)]&&console[_0x2669b7(0x288)](_0x2669b7(0x1e2));}}}if(_0x38bc0e[_0x2669b7(0x29b)]['length']>0x0){console[_0x2669b7(0x288)]('─'[_0x2669b7(0x218)](0x3c)),console['error']('\x0a'+a21_0x17398f[_0x2669b7(0x29c)](_0x2669b7(0x1a3)));for(const _0x3e4c4a of _0x38bc0e[_0x2669b7(0x29b)]){console['error']('\x20\x20'+a21_0x17398f[_0x2669b7(0x29c)]('•')+'\x20'+_0x3e4c4a);}}}async[a21_0x32761f(0x27b)](_0x3d2f3e,_0xc7917c){const _0x317353=a21_0x32761f;if(_0xc7917c['length']===0x0){console[_0x317353(0x288)]('\x0a'+_0x3d2f3e),console[_0x317353(0x288)](_0x317353(0x296));return;}console[_0x317353(0x288)]('\x0a'+_0x3d2f3e);const _0x2ff469=Object[_0x317353(0x281)](_0xc7917c[0x0])[_0x317353(0x1b5)](_0x145a68=>({'name':_0x145a68,'type':typeof _0xc7917c[0x0][_0x145a68]==='number'?_0x317353(0x297):'varchar'})),_0x1af4aa={'queryId':_0x317353(0x24a),'columns':_0x2ff469,'data':_0xc7917c,'stats':{'state':_0x317353(0x1bb),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xc7917c[_0x317353(0x1b7)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x185596=formatAsTable(_0x1af4aa,_0xc7917c[_0x317353(0x1b7)],!![]);await writeOutput(_0x185596,undefined,_0x317353(0x1d8));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x264);[a21_0x32761f(0x274)]=a21_0x32761f(0x190);async[a21_0x32761f(0x240)](_0x57ae91){const _0x3281fa=a21_0x32761f,{options:_0x1bd1e9,args:_0x24cacf,tdx:_0x29ca25}=_0x57ae91,_0x545ba7=_0x1bd1e9,_0x480c3b=_0x24cacf[0x0]||_0x1bd1e9['parentSegment'];if(!_0x480c3b)return showParentSegmentNotSetError(_0x3281fa(0x24e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x130ea7=resolveYamlFile(_0x480c3b);if(existsSync(_0x130ea7)){_0x545ba7['verbose']&&console['error'](_0x3281fa(0x1cf)+_0x130ea7);let _0x163dd6;try{_0x163dd6=readFileSync(_0x130ea7,'utf-8');}catch(_0x15a67b){const _0x5dcbcc=_0x15a67b instanceof Error?_0x15a67b[_0x3281fa(0x21d)]:String(_0x15a67b);return console[_0x3281fa(0x288)](_0x3281fa(0x1ad)+_0x5dcbcc),0x1;}const _0x633655=await withSpinner(_0x3281fa(0x29d),()=>_0x29ca25[_0x3281fa(0x21c)][_0x3281fa(0x233)](_0x163dd6),{'verbose':_0x545ba7[_0x3281fa(0x1ab)]}),_0xa6c495=_0x633655[_0x3281fa(0x28e)],{isNew:_0x403f3d,name:_0xe0aaa6,hasChanges:_0x149c21,diffFormatted:_0x49a06b}=_0xa6c495;if(_0x149c21){_0x403f3d?console['error'](_0x3281fa(0x199)+_0xe0aaa6+'\x27:'):console['error'](_0x3281fa(0x245)+_0xe0aaa6+'\x27:');console[_0x3281fa(0x288)]('─'['repeat'](0x3c)),console['error'](_0x49a06b),console['error']('─'[_0x3281fa(0x218)](0x3c));const _0x41913b=_0x403f3d?_0x3281fa(0x1ff)+_0xe0aaa6+_0x3281fa(0x271):'Apply\x20changes\x20to\x20\x27'+_0xe0aaa6+_0x3281fa(0x271);if(!_0x545ba7[_0x3281fa(0x249)]){const _0x1cef4c=await confirmKey(_0x41913b);if(!_0x1cef4c)return console[_0x3281fa(0x288)](_0x3281fa(0x220)),0x1;}const _0x4bfe48=_0x403f3d?_0x3281fa(0x1ba):_0x3281fa(0x217);await withSpinner(_0x4bfe48+_0x3281fa(0x203)+_0xe0aaa6+_0x3281fa(0x1f4),()=>_0xa6c495[_0x3281fa(0x268)](),{'verbose':_0x545ba7[_0x3281fa(0x1ab)]});const _0x4db656=_0x403f3d?_0x3281fa(0x258):_0x3281fa(0x244);console['error']('✔\x20'+_0x4db656+_0x3281fa(0x203)+_0xe0aaa6+'\x27');}else console[_0x3281fa(0x288)](_0x3281fa(0x282)+_0xe0aaa6+'\x27\x20is\x20up\x20to\x20date');}const _0x492ffd=await withSpinner(_0x3281fa(0x1c6)+_0x480c3b+_0x3281fa(0x1f4),()=>_0x29ca25[_0x3281fa(0x21c)][_0x3281fa(0x1ec)](_0x480c3b),{'verbose':_0x545ba7[_0x3281fa(0x1ab)]}),_0x2e8756=_0x492ffd[_0x3281fa(0x28e)],_0x147b3a=getConsoleUrl(_0x545ba7[_0x3281fa(0x27d)],_0x3281fa(0x253)+_0x2e8756[_0x3281fa(0x1a6)]+_0x3281fa(0x185)+_0x2e8756[_0x3281fa(0x28c)]+_0x3281fa(0x283)+_0x2e8756[_0x3281fa(0x2a1)]);return console[_0x3281fa(0x288)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a21_0x17398f[_0x3281fa(0x262)](_0x3281fa(0x294))+'\x20'+_0x2e8756[_0x3281fa(0x23f)]),console[_0x3281fa(0x288)]('\x20\x20'+a21_0x17398f['dim'](_0x3281fa(0x1f8))+'\x20'+_0x2e8756[_0x3281fa(0x197)]),console['error']('\x20\x20'+a21_0x17398f[_0x3281fa(0x262)](_0x3281fa(0x192))+'\x20'+_0x2e8756[_0x3281fa(0x28c)]),console[_0x3281fa(0x288)]('\x20\x20'+a21_0x17398f['dim'](_0x3281fa(0x25f))+'\x20'+_0x2e8756[_0x3281fa(0x2a1)]),console['error']('\x20\x20'+_0x147b3a),console[_0x3281fa(0x288)]('\x0a'+a21_0x17398f[_0x3281fa(0x262)](_0x3281fa(0x1f6))+_0x3281fa(0x213)+_0x2e8756[_0x3281fa(0x2a1)]+_0x3281fa(0x201)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a21_0x32761f(0x26a);['description']=a21_0x32761f(0x1e0);async['execute'](_0xd3fb19){const _0xfacee4=a21_0x32761f,{options:_0x1ddc6c,args:_0x537633,tdx:_0x231336}=_0xd3fb19,_0x31ef04=_0x537633[0x0]||_0x1ddc6c['parentSegment'];if(!_0x31ef04)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0xfacee4(0x1d6)),0x1;_0x1ddc6c['verbose']&&(console[_0xfacee4(0x288)]('Site:\x20'+_0x1ddc6c['site']),console['error'](_0xfacee4(0x24f)+_0x31ef04));const _0x111449=await withSpinner(_0xfacee4(0x26b)+_0x31ef04+_0xfacee4(0x1f4),()=>_0x231336['segment'][_0xfacee4(0x19f)](_0x31ef04),{'verbose':_0x1ddc6c[_0xfacee4(0x1ab)]}),_0x481559=_0x111449[_0xfacee4(0x28e)];console['error'](_0xfacee4(0x28a)+_0x481559['length']+_0xfacee4(0x23b)+(_0x481559[_0xfacee4(0x1b7)]!==0x1?'s':''));if(_0x1ddc6c[_0xfacee4(0x247)]||_0x1ddc6c[_0xfacee4(0x1de)])return await handleSDKOutput(_0x481559,_0x1ddc6c),0x0;return displayFieldsHumanReadable(_0x481559,_0x31ef04),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x28d);['description']=a21_0x32761f(0x186);async[a21_0x32761f(0x240)](_0x57a9b1){const _0x1cc53d=a21_0x32761f,{options:_0x1374bc,args:_0x30de7d,tdx:_0xaaf3df}=_0x57a9b1,_0x2c32b3=_0x1374bc,_0x8968fb=_0x30de7d[0x0]||_0x1374bc[_0x1cc53d(0x259)];if(!_0x8968fb)return showParentSegmentNotSetError(_0x1cc53d(0x21e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x1cc53d(0x243)+_0x1cc53d(0x17f)),0x1;_0x1374bc[_0x1cc53d(0x1ab)]&&(console[_0x1cc53d(0x288)]('Site:\x20'+_0x1374bc[_0x1cc53d(0x27d)]),console[_0x1cc53d(0x288)](_0x1cc53d(0x24f)+_0x8968fb));const _0x1b24af=await withSpinner(_0x1cc53d(0x1a2)+_0x8968fb+_0x1cc53d(0x1f4),()=>_0xaaf3df[_0x1cc53d(0x21c)]['getParentFull'](_0x8968fb),{'verbose':_0x1374bc['verbose']}),_0x52db75=_0x1b24af[_0x1cc53d(0x28e)];if(_0x2c32b3[_0x1cc53d(0x257)]){const _0x1e549f=getConsoleNextUrl(_0x2c32b3[_0x1cc53d(0x27d)],_0x1cc53d(0x18e)+_0x52db75['id']);return console[_0x1cc53d(0x288)](a21_0x17398f[_0x1cc53d(0x1d4)]('✔')+_0x1cc53d(0x1a7)+a21_0x17398f[_0x1cc53d(0x180)](_0x1e549f)),openBrowser(_0x1e549f),0x0;}return await handleSingleObjectOutput(_0x52db75,_0x1374bc),0x0;}}function a21_0x2a24(){const _0x14532b=['\x20\x20\x20\x20-\x20','audienceId','execute','rowCount','%)\x20','Options:\x0a','Updated','\x0aChanges\x20to\x20apply\x20to\x20\x27','attributesFile','json','open','yes','preview','Master\x20+\x20Attributes','stop','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Parent\x20segment:\x20','Updating\x20parent\x20segment\x20\x27','tdx\x20segment\x20parent\x20preview\x20','previewParentYaml','/app/workflows/','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x0aChanges\x20to\x20\x27','Listing\x20parent\x20segments...','web','Created','parentSegment','Source:','schemaError','addAttributesFile','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','trim','Attempt:','bold','Overwrite\x20\x27','dim','Master:','segment:parent:run','scheduleType','✔\x20Query\x20completed:\x20Processed\x20','3586368vRRpdl','apply','No\x20parent\x20segments\x20found','segment:parent:fields','Listing\x20fields\x20for\x20\x27','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20Created\x20parent\x20segment\x20\x27','behavior','Site:\x20','\x27\x20and\x20run\x20workflow?','test','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','description','\x0a⚠️\x20\x20Migrating:\x20','14THDRDJ','Creating\x20parent\x20segment\x20\x27','No\x20parent\x20segments\x20match\x20pattern:\x20','utf-8','Join\x20on:','displaySampleData','\x20--attribute\x20\x22<name>\x22','site','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','unref','15579NcyLIi','keys','✔\x20No\x20changes\x20-\x20\x27','/attempt/','log','validateParentYaml','name','Listing\x20parent\x20segments\x20matching\x20\x27','error','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','✔\x20Found\x20','Table:\x20','workflowSessionId','segment:parent:view','data','displayAttributesStats','1550367kiRycW','win32','Apply\x20changes\x20to\x20\x27','stats','Audience\x20ID:','Executing\x20parent\x20segment\x20query...','\x20\x20No\x20sample\x20data\x20available','double','Error:\x20--behavior\x20requires\x20a\x20name\x0a','replace','✘\x20Failed\x20to\x20rename\x20directory:\x20','errors','red','Analyzing\x20changes...','attribute','SELECT\x20*\x20FROM\x20(\x0a','\x20--enriched','workflowAttemptId','/\x20directories\x20exist.','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20rows)','behaviors','\x27\x20with\x20ID:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Coverage:','addAttributes','Attributes','\x0aUsage:\x20tdx\x20ps\x20preview\x20','segment:parent:validate','use','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','cyan','filter','Enriched:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','/sessions/','Show\x20parent\x20segment\x20details','start','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','segment:parent:show','in\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','segment:parent:desc','displaySummary','/app/dw/parentSegments/','toFixed','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','49652vUigYe','Session:','.yaml','YAML\x20file:\x20','jobId','allValid','status','schemaValid','\x0aNew\x20parent\x20segment\x20\x27','5539664HXQIuB','\x20[Job\x20ID:\x20','database','platform','segment:parent:list','listFields','\x20--interval\x20','customerPercent','Fetching\x20parent\x20segment\x20\x27','Errors:','Fetching\x20sample\x20data...','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','workflowId','\x20Opening\x20','yellow','Preview:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','verbose','Error:\x20--database\x20and\x20--table\x20are\x20required','Error\x20reading\x20file:\x20','attributes','👥\x20','displayPreviewResults','To\x20view\x20sample\x20data:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','map','customerGroup','length','/{name}.yml\x0a','updateParent','Creating','FINISHED','segment:parent:create','Output\x20file:\x20','102AotYqp','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','SQL\x20query:\x0a','Events:','displayBehaviorsStats','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','foreignKey','darwin','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20--attribute\x20\x22','\x20Context\x20set:\x20','isDirectory','parent_segment','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','output','.yml','Found\x20YAML\x20file:\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','session','limit','information_schema','green','Fetching\x20SQL\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','customersWithEvents','table','/\x20directory.\x0a','\x20--behavior\x20\x22','sort','displayPreviewHints','enriched','jsonl','`\x20to\x20download\x20the\x20configuration\x20first','List\x20available\x20fields\x20for\x20segmentation','-1d','\x0aNo\x20sample\x20data\x20available','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Master\x20Table','processedRows','Behaviors','localeCompare','getParentSQL','elapsedTimeMillis','string','runParent','Columns:','query','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','List\x20parent\x20segments','toLocaleString','Pattern:\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x27...','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','To\x20cancel:','totalEvents','Status:','master','Validating\x20configuration...','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Join:','Error:','joinKey','Create\x20parent\x20segment\x20\x27','displayValidateResults','\x20kill','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','endsWith','segment:parent:pull','displayMasterInfo','Options:','displayColumns','Fetching\x20current\x20configuration\x20for\x20\x27','getParentFull','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','matchedCount','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Rows:','resolveParentId','Error:\x20File\x20not\x20found:\x20','\x20tdx\x20wf\x20attempt\x20','4699110IhlxTF','/\x20and\x20','Resolving\x20parent\x20segment\x20\x27','Updating','repeat','Available\x20behaviors:','coveragePercent','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','segment','message','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','column','Aborted.','segment:parent:sql','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Behavior:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','/\x20→\x20','\x0a⚠️\x20\x20Both\x20','5954230JbGOsB','Options\x20(one\x20required):\x0a','text','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','19980hzTBxP','format','\x20=\x20','timezone','join','scheduleOption','population','sampleData','pushParentYaml','ignore','pullParentYaml','all','run','segment:parent:update','addBehaviors','columns','\x20field','interval','xdg-open'];a21_0x2a24=function(){return _0x14532b;};return a21_0x2a24();}export class ParentSegmentDescCommand extends BaseCommand{['name']=a21_0x32761f(0x18c);[a21_0x32761f(0x274)]=a21_0x32761f(0x2a3);async['execute'](_0x53c38d){const _0x5c6e26=a21_0x32761f,{options:_0x3fa6ac,args:_0x977b4,tdx:_0x1006af}=_0x53c38d,_0x31fd8b=_0x977b4[0x0]||_0x3fa6ac['parentSegment'];if(!_0x31fd8b)return showParentSegmentNotSetError(_0x5c6e26(0x1b4)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x3fa6ac[_0x5c6e26(0x1ab)]&&(console['error'](_0x5c6e26(0x270)+_0x3fa6ac[_0x5c6e26(0x27d)]),console[_0x5c6e26(0x288)](_0x5c6e26(0x24f)+_0x31fd8b));const _0x21aacc=await withSpinner(_0x5c6e26(0x216)+_0x31fd8b+_0x5c6e26(0x1f4),()=>_0x1006af[_0x5c6e26(0x21c)][_0x5c6e26(0x211)](_0x31fd8b),{'verbose':_0x3fa6ac[_0x5c6e26(0x1ab)]}),_0x170b26=_0x21aacc[_0x5c6e26(0x28e)],_0x107531=await withSpinner(_0x5c6e26(0x1d5)+_0x31fd8b+_0x5c6e26(0x1f4),()=>_0x1006af['segment']['getParentSQL'](_0x170b26),{'verbose':_0x3fa6ac[_0x5c6e26(0x1ab)]}),_0xac5e2a=await executeSchemaQuery(_0x107531[_0x5c6e26(0x28e)],_0x1006af,_0x3fa6ac);return await handleQueryOutput(_0xac5e2a,_0x3fa6ac),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x221);[a21_0x32761f(0x274)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a21_0x32761f(0x240)](_0x1038f6){const _0x2d71e0=a21_0x32761f,{options:_0x10f181,args:_0x1c3a9f,tdx:_0x141039}=_0x1038f6,_0xd9c260=_0x1c3a9f[0x0]||_0x10f181[_0x2d71e0(0x259)];if(!_0xd9c260)return showParentSegmentNotSetError(_0x2d71e0(0x20f)+_0x2d71e0(0x1e4)),0x1;_0x10f181['verbose']&&(console['error'](_0x2d71e0(0x270)+_0x10f181['site']),console[_0x2d71e0(0x288)](_0x2d71e0(0x24f)+_0xd9c260));const _0xe9c0de=await withSpinner(_0x2d71e0(0x216)+_0xd9c260+_0x2d71e0(0x1f4),()=>_0x141039[_0x2d71e0(0x21c)][_0x2d71e0(0x211)](_0xd9c260),{'verbose':_0x10f181[_0x2d71e0(0x1ab)]}),_0x55726e=_0xe9c0de['data'],_0xeef6b9=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0xd9c260+_0x2d71e0(0x1f4),()=>_0x141039['segment'][_0x2d71e0(0x1e9)](_0x55726e),{'verbose':_0x10f181[_0x2d71e0(0x1ab)]}),_0x31a41c=_0xeef6b9['data'];return _0x10f181[_0x2d71e0(0x22c)]===_0x2d71e0(0x247)||_0x10f181[_0x2d71e0(0x22c)]===_0x2d71e0(0x1de)?await handleSDKOutput([{'sql':_0x31a41c}],_0x10f181):console[_0x2d71e0(0x284)](_0x31a41c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x32761f(0x286)]=a21_0x32761f(0x189);[a21_0x32761f(0x274)]=a21_0x32761f(0x26c);async[a21_0x32761f(0x240)](_0x509486){const _0xc5504b=a21_0x32761f,{options:_0x592a7e,args:_0x522dbb,tdx:_0x409104}=_0x509486,_0xb3f290=_0x522dbb[0x0]||_0x592a7e[_0xc5504b(0x259)];if(!_0xb3f290)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+'\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;_0x592a7e['verbose']&&(console[_0xc5504b(0x288)]('Site:\x20'+_0x592a7e[_0xc5504b(0x27d)]),console['error'](_0xc5504b(0x24f)+_0xb3f290));const _0x4487b2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xb3f290+_0xc5504b(0x1f4),()=>_0x409104[_0xc5504b(0x21c)]['resolveParentId'](_0xb3f290),{'verbose':_0x592a7e[_0xc5504b(0x1ab)]}),_0x4bf3d8=_0x4487b2[_0xc5504b(0x28e)],_0x1fa95b=await withSpinner(_0xc5504b(0x1d5)+_0xb3f290+'\x27...',()=>_0x409104[_0xc5504b(0x21c)][_0xc5504b(0x1e9)](_0x4bf3d8),{'verbose':_0x592a7e[_0xc5504b(0x1ab)]});let _0x20f1a5=_0x1fa95b[_0xc5504b(0x28e)];const _0x5e0373=resolveLimit(_0x592a7e[_0xc5504b(0x1d2)],DEFAULT_DISPLAY_LIMIT),_0x3de3be=/\bLIMIT\s+\d+/i[_0xc5504b(0x272)](_0x20f1a5);!_0x3de3be&&(_0x20f1a5=_0x20f1a5[_0xc5504b(0x25e)]()[_0xc5504b(0x299)](/;+$/,''),_0x20f1a5=_0xc5504b(0x29f)+_0x20f1a5+_0xc5504b(0x224)+_0x5e0373);_0x592a7e[_0xc5504b(0x1ab)]&&console[_0xc5504b(0x288)](_0xc5504b(0x1c0)+_0x20f1a5);const _0x2cafe9=await withProgressSpinner(_0xc5504b(0x295),async _0x2f211b=>{const _0x5c324b=_0xc5504b,_0x3e43bf=await _0x409104[_0x5c324b(0x1ee)][_0x5c324b(0x240)](_0x20f1a5,{'catalog':'td','schema':_0x5c324b(0x1d3),'onJobId':_0x14b15c=>{_0x2f211b['setJobId'](_0x14b15c);}});return _0x3e43bf;},{'verbose':_0x592a7e[_0xc5504b(0x1ab)]}),_0x5e761c=_0x2cafe9[_0xc5504b(0x28e)],_0x2c4b2e=_0x5e761c[_0xc5504b(0x195)]?_0xc5504b(0x19b)+_0x5e761c[_0xc5504b(0x195)]+']':'';return console[_0xc5504b(0x288)](_0xc5504b(0x266)+_0x5e761c[_0xc5504b(0x293)][_0xc5504b(0x1e6)][_0xc5504b(0x1f1)]()+'\x20rows\x20'+(_0xc5504b(0x18a)+formatElapsed(_0x5e761c[_0xc5504b(0x293)][_0xc5504b(0x1ea)])+_0x2c4b2e)),await handleQueryOutput(_0x5e761c,_0x592a7e),0x0;}}
|
|
1
|
+
const a21_0x3eafb8=a21_0xda3b;(function(_0x35cf8f,_0xb85be5){const _0x485648=a21_0xda3b,_0x5ee386=_0x35cf8f();while(!![]){try{const _0x3ca636=parseInt(_0x485648(0x19a))/0x1+parseInt(_0x485648(0xd6))/0x2+-parseInt(_0x485648(0xf2))/0x3*(-parseInt(_0x485648(0x13e))/0x4)+-parseInt(_0x485648(0x1c5))/0x5+-parseInt(_0x485648(0xdf))/0x6+-parseInt(_0x485648(0x168))/0x7*(-parseInt(_0x485648(0x120))/0x8)+parseInt(_0x485648(0xe6))/0x9*(-parseInt(_0x485648(0x180))/0xa);if(_0x3ca636===_0xb85be5)break;else _0x5ee386['push'](_0x5ee386['shift']());}catch(_0x383679){_0x5ee386['push'](_0x5ee386['shift']());}}}(a21_0x7168,0xa4b4a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x34a43a from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a21_0xda3b(_0x48fe6d,_0x4c0c9d){_0x48fe6d=_0x48fe6d-0x9d;const _0x716888=a21_0x7168();let _0xda3b9=_0x716888[_0x48fe6d];return _0xda3b9;}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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x112008 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=a21_0x3eafb8(0x175),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x34c6b0){const _0x4427fa=a21_0x3eafb8,_0x42c6bc=process[_0x4427fa(0x131)],_0x2258a0=_0x42c6bc===_0x4427fa(0x1b5)?_0x4427fa(0x16a):_0x42c6bc==='win32'?_0x4427fa(0x1b1):_0x4427fa(0x196);spawn(_0x2258a0,[_0x34c6b0],{'detached':!![],'stdio':_0x4427fa(0x165)})[_0x4427fa(0x9f)]();}function migrateLegacyDirectory(){const _0x4f32a1=a21_0x3eafb8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x202d6b=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x202d6b[_0x4f32a1(0xda)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a21_0x112008[_0x4f32a1(0xbc)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x4f32a1(0xe7)+PARENT_SEGMENT_DIR+_0x4f32a1(0x1ca))),console[_0x4f32a1(0x19f)](a21_0x112008['dim'](_0x4f32a1(0x134)+LEGACY_PARENT_SEGMENT_DIR+_0x4f32a1(0x172))),![];console[_0x4f32a1(0x19f)](a21_0x112008[_0x4f32a1(0xbc)](_0x4f32a1(0xce)+LEGACY_PARENT_SEGMENT_DIR+_0x4f32a1(0x12f)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x4f32a1(0x19f)](a21_0x112008[_0x4f32a1(0x156)](_0x4f32a1(0x14a)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x55714b){const _0x1dc324=_0x55714b instanceof Error?_0x55714b['message']:String(_0x55714b);return console[_0x4f32a1(0x19f)](a21_0x112008[_0x4f32a1(0xa3)](_0x4f32a1(0x18a)+_0x1dc324+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x3eafb8(0x11f)](_0x33164a){const _0x31baa9=a21_0x3eafb8;return migrateLegacyDirectory(),super[_0x31baa9(0x11f)](_0x33164a);}}function resolveYamlFile(_0x376a83){const _0x17f25d=a21_0x3eafb8;if(_0x376a83['endsWith'](_0x17f25d(0xd4))||_0x376a83[_0x17f25d(0x17e)]('.yaml'))return _0x376a83;return a21_0x34a43a[_0x17f25d(0x15d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x376a83)+_0x17f25d(0xd4));}function formatProgressMessage(_0x304ef6){const _0x1b4f72=a21_0x3eafb8,_0x1119ae=_0x304ef6[_0x1b4f72(0xef)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1119ae){const [,_0x4207a5,_0x2911db,_0xe979a2='']=_0x1119ae;return a21_0x112008[_0x1b4f72(0x145)](_0x4207a5+':')+'\x20'+_0x2911db+a21_0x112008[_0x1b4f72(0x145)](_0xe979a2);}return a21_0x112008[_0x1b4f72(0x145)](_0x304ef6);}function showFileNotFoundError(_0x51bb37,_0x20614e){const _0x117bb8=a21_0x3eafb8;console['error'](a21_0x112008[_0x117bb8(0xa3)]('Error:\x20File\x20not\x20found:\x20'+_0x51bb37+'\x0a')),console[_0x117bb8(0x19f)](a21_0x112008['cyan'](_0x117bb8(0xae)+_0x20614e+_0x117bb8(0x150)));}function showParentSegmentNotSetError(_0x44830a){const _0x3c2124=a21_0x3eafb8;console[_0x3c2124(0x19f)](a21_0x112008['yellow'](_0x3c2124(0xc3))),console[_0x3c2124(0x19f)](_0x44830a);}export class ParentSegmentListCommand extends BaseCommand{['name']=a21_0x3eafb8(0x132);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0xcc);async[a21_0x3eafb8(0x118)](_0x5197de){const _0x1072b3=a21_0x3eafb8,{options:_0xe8ca52,args:_0x5bb2e0,tdx:_0x1523a9}=_0x5197de,_0x2e3887=_0x5bb2e0[0x0];_0xe8ca52['verbose']&&(console['error']('Site:\x20'+_0xe8ca52[_0x1072b3(0x116)]),_0x2e3887&&console['error']('Pattern:\x20'+_0x2e3887));const _0x5f3616=await withSpinner(_0x2e3887?_0x1072b3(0xeb)+_0x2e3887+_0x1072b3(0x1a9):_0x1072b3(0xc9),()=>_0x1523a9[_0x1072b3(0x16b)][_0x1072b3(0x1a4)](),{'verbose':_0xe8ca52[_0x1072b3(0x100)]});let _0x5b6537=_0x5f3616[_0x1072b3(0x1ab)];if(_0x2e3887){const _0x4d041a=_0x2e3887[_0x1072b3(0xbe)](/[.+^${}()|[\]\\]/g,_0x1072b3(0x146))[_0x1072b3(0xbe)](/\*/g,'.*')[_0x1072b3(0xbe)](/\?/g,'.'),_0x2c2657=new RegExp('^'+_0x4d041a+'$','i');_0x5b6537=_0x5b6537[_0x1072b3(0x1a0)](_0x273bcb=>_0x2c2657[_0x1072b3(0x9d)](_0x273bcb[_0x1072b3(0x139)]['name']));}_0x5b6537[_0x1072b3(0x158)]((_0x293958,_0x10dc94)=>_0x293958[_0x1072b3(0x139)][_0x1072b3(0xf7)]['localeCompare'](_0x10dc94[_0x1072b3(0x139)]['name'])),console[_0x1072b3(0x19f)]('✔\x20Found\x20'+_0x5b6537['length']+'\x20parent\x20segment'+(_0x5b6537[_0x1072b3(0x169)]!==0x1?'s':''));const _0x1819c7=_0x54863d=>{const _0x4f8b4a=_0x1072b3;return getConsoleNextUrl(_0xe8ca52[_0x4f8b4a(0x116)],'/app/dw/parentSegments/'+_0x54863d);};if(_0xe8ca52[_0x1072b3(0xf0)]==='json'||_0xe8ca52['format']===_0x1072b3(0xad)){const _0x54092c=_0x5b6537[_0x1072b3(0x1b4)](_0x4dbf76=>({..._0x4dbf76,'url':_0x1819c7(_0x4dbf76['id'])}));await handleSDKOutput(_0x54092c,_0xe8ca52);}else{if(_0x5b6537[_0x1072b3(0x169)]===0x0)_0x2e3887?console[_0x1072b3(0x167)](_0x1072b3(0xe4)+_0x2e3887):console[_0x1072b3(0x167)](_0x1072b3(0xe1));else for(const _0x35f1aa of _0x5b6537){const _0x18fabf=_0x35f1aa[_0x1072b3(0x139)][_0x1072b3(0x1a7)]?a21_0x112008[_0x1072b3(0x145)]('\x20('+formatRows(_0x35f1aa['attributes'][_0x1072b3(0x1a7)])+')'):'',_0x6be79f=hyperlink(_0x35f1aa[_0x1072b3(0x139)][_0x1072b3(0xf7)],_0x1819c7(_0x35f1aa['id']));console[_0x1072b3(0x167)](_0x1072b3(0xd3)+_0x6be79f+_0x18fabf);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0x1b9);['description']=a21_0x3eafb8(0x1ba);async[a21_0x3eafb8(0x118)](_0xae03d5){const _0x10d66b=a21_0x3eafb8,{options:_0x52f8e0,args:_0x10f412,tdx:_0x340630}=_0xae03d5;console[_0x10d66b(0x19f)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x10d66b(0x1a2)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x2d65f8=_0x52f8e0;if(_0x10f412[_0x10d66b(0x169)]===0x0)return console[_0x10d66b(0x19f)](a21_0x112008[_0x10d66b(0xa3)](_0x10d66b(0xb1))),console[_0x10d66b(0x19f)](_0x10d66b(0xc7)),0x1;const _0x488685=_0x10f412[0x0];if(!_0x2d65f8[_0x10d66b(0xf4)]||!_0x2d65f8['table'])return console[_0x10d66b(0x19f)](_0x10d66b(0x1a3)),console[_0x10d66b(0x19f)](_0x10d66b(0xc7)),0x1;_0x2d65f8[_0x10d66b(0x100)]&&(console['error'](_0x10d66b(0x15f)+_0x2d65f8['site']),console['error'](_0x10d66b(0xa1)+_0x488685),console['error'](_0x10d66b(0x133)+_0x2d65f8[_0x10d66b(0xf4)]),console[_0x10d66b(0x19f)]('Table:\x20'+_0x2d65f8['table']));const _0x467965=await loadJSONFromOptions(_0x2d65f8[_0x10d66b(0x139)],_0x2d65f8[_0x10d66b(0xd7)]),_0x37bae0=await loadJSONFromOptions(_0x2d65f8['behaviors'],_0x2d65f8['behaviorsFile']),_0x4f8086=await loadJSONFromOptions(_0x2d65f8[_0x10d66b(0x15e)],_0x2d65f8[_0x10d66b(0x147)]),_0x4b3cd4={'name':_0x488685,'description':_0x2d65f8[_0x10d66b(0x17a)],'scheduleType':_0x2d65f8['scheduleType'],'scheduleOption':_0x2d65f8[_0x10d66b(0x115)],'timezone':_0x2d65f8[_0x10d66b(0x11e)],'master':{'parentDatabaseName':_0x2d65f8[_0x10d66b(0xf4)],'parentTableName':_0x2d65f8[_0x10d66b(0x111)]},'attributes':_0x467965,'behaviors':_0x37bae0,'customerGroup':_0x4f8086},_0xb04bf0=await withSpinner(_0x10d66b(0xb7)+_0x488685+_0x10d66b(0x1a9),()=>_0x340630['segment'][_0x10d66b(0x1b7)](_0x4b3cd4),{'verbose':_0x52f8e0[_0x10d66b(0x100)]}),_0x3faa60=_0xb04bf0[_0x10d66b(0x1ab)];return console[_0x10d66b(0x19f)](_0x10d66b(0x102)+_0x3faa60[_0x10d66b(0xf7)]+_0x10d66b(0xfc)+_0x3faa60['id']),await handleSDKOutput([_0x3faa60],_0x52f8e0),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0xee);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0xdd);async[a21_0x3eafb8(0x118)](_0x25e5c5){const _0x4e8714=a21_0x3eafb8,{options:_0x3561c8,args:_0x4a4c70,tdx:_0x46960e}=_0x25e5c5;console[_0x4e8714(0x19f)](_0x4e8714(0xd0)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4e8714(0xa8));const _0x30ba8f=_0x3561c8;if(_0x4a4c70[_0x4e8714(0x169)]===0x0)return console['error'](a21_0x112008[_0x4e8714(0xa3)](_0x4e8714(0xb1))),console[_0x4e8714(0x19f)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0xb3df8e=_0x4a4c70[0x0];_0x30ba8f['verbose']&&(console[_0x4e8714(0x19f)](_0x4e8714(0x15f)+_0x30ba8f[_0x4e8714(0x116)]),console[_0x4e8714(0x19f)]('Parent\x20segment:\x20'+_0xb3df8e));const _0x4be878=await withSpinner(_0x4e8714(0x189)+_0xb3df8e+_0x4e8714(0x1a9),()=>_0x46960e[_0x4e8714(0x16b)][_0x4e8714(0x107)](_0xb3df8e),{'verbose':_0x30ba8f['verbose']}),_0x304e38=_0x4be878['data'],_0x5e06c7=await loadJSONFromOptions(_0x30ba8f[_0x4e8714(0x1ac)],_0x30ba8f[_0x4e8714(0x13a)]),_0x2ce039=await loadJSONFromOptions(_0x30ba8f[_0x4e8714(0x19e)],_0x30ba8f[_0x4e8714(0x122)]),_0x50d033={'name':_0x304e38['name'],'description':_0x30ba8f[_0x4e8714(0x17a)]!==undefined?_0x30ba8f['description']:_0x304e38[_0x4e8714(0x17a)],'scheduleType':_0x30ba8f[_0x4e8714(0x187)]!==undefined?_0x30ba8f[_0x4e8714(0x187)]:_0x304e38[_0x4e8714(0x187)],'scheduleOption':_0x30ba8f[_0x4e8714(0x115)]!==undefined?_0x30ba8f[_0x4e8714(0x115)]:_0x304e38[_0x4e8714(0x115)],'timezone':_0x30ba8f[_0x4e8714(0x11e)]!==undefined?_0x30ba8f[_0x4e8714(0x11e)]:_0x304e38[_0x4e8714(0x11e)],'master':_0x304e38['master'],'attributes':_0x5e06c7?[..._0x304e38[_0x4e8714(0x139)]||[],..._0x5e06c7]:_0x304e38[_0x4e8714(0x139)],'behaviors':_0x2ce039?[..._0x304e38[_0x4e8714(0xbd)]||[],..._0x2ce039]:_0x304e38['behaviors'],'customerGroup':_0x304e38[_0x4e8714(0x15e)]},_0x3e5299=await withSpinner(_0x4e8714(0x10f)+_0xb3df8e+'\x27...',()=>_0x46960e[_0x4e8714(0x16b)][_0x4e8714(0x19b)](_0xb3df8e,_0x50d033),{'verbose':_0x30ba8f['verbose']}),_0x266258=_0x3e5299[_0x4e8714(0x1ab)];return console['error'](_0x4e8714(0x178)+_0x266258['name']+'\x27'),await handleSDKOutput([_0x266258],_0x30ba8f),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x3eafb8(0xf7)]='segment:parent:pull';['description']=a21_0x3eafb8(0x184);async[a21_0x3eafb8(0x118)](_0x2389e3){const _0x5259d7=a21_0x3eafb8,{options:_0x5c8277,args:_0x36514a,tdx:_0x3ec6b3}=_0x2389e3,_0x2c35d2=_0x5c8277,_0x352ed2=_0x36514a[0x0]||_0x5c8277['parentSegment'];if(!_0x352ed2)return showParentSegmentNotSetError(_0x5259d7(0x10c)+_0x5259d7(0x1aa)),0x1;if(_0x2c35d2[_0x5259d7(0x1b0)]&&_0x2c35d2[_0x5259d7(0x135)])return console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0xa3)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0x145)](_0x5259d7(0xf5))),console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0x145)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x5259d7(0xfe))),console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0x18b)](_0x5259d7(0x173))),0x1;const _0xea4f6a=_0x2c35d2['output']||a21_0x34a43a[_0x5259d7(0x15d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x352ed2)+_0x5259d7(0xd4));_0x2c35d2[_0x5259d7(0x100)]&&(console[_0x5259d7(0x19f)](_0x5259d7(0x15f)+_0x2c35d2['site']),console['error']('Parent\x20segment:\x20'+_0x352ed2),console[_0x5259d7(0x19f)]('Output\x20file:\x20'+_0xea4f6a));const _0x59fca0=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x352ed2+'\x27...',()=>_0x3ec6b3[_0x5259d7(0x16b)][_0x5259d7(0x121)](_0x352ed2),{'verbose':_0x2c35d2['verbose']}),_0x45898d=_0x59fca0['data'];if(existsSync(_0xea4f6a)){const _0x56425b=readFileSync(_0xea4f6a,'utf-8'),_0x2e72b9=generateDiff(_0x56425b,_0x45898d);if(!hasChanges(_0x2e72b9))console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0x156)]('✔')+_0x5259d7(0xca)+a21_0x112008[_0x5259d7(0x18b)](_0xea4f6a)+_0x5259d7(0x103));else{console[_0x5259d7(0x19f)](_0x5259d7(0x1b8)+_0xea4f6a+'\x27:'),console[_0x5259d7(0x19f)]('─'[_0x5259d7(0x1b3)](0x3c)),console[_0x5259d7(0x19f)](formatDiffWithColors(_0x2e72b9)),console[_0x5259d7(0x19f)]('─'[_0x5259d7(0x1b3)](0x3c));if(!_0x2c35d2['yes']){const _0x16f8ee=await confirmKey(_0x5259d7(0xf9)+_0xea4f6a+'\x27?');if(!_0x16f8ee)return console[_0x5259d7(0x19f)]('Aborted.'),0x1;}writeFileSync(_0xea4f6a,_0x45898d,_0x5259d7(0x112)),console['error'](a21_0x112008[_0x5259d7(0x156)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a21_0x112008[_0x5259d7(0x18b)](_0xea4f6a));}}else{const _0x11e01b=a21_0x34a43a[_0x5259d7(0x161)](_0xea4f6a);!existsSync(_0x11e01b)&&mkdirSync(_0x11e01b,{'recursive':!![]}),writeFileSync(_0xea4f6a,_0x45898d,_0x5259d7(0x112)),console[_0x5259d7(0x19f)](a21_0x112008[_0x5259d7(0x156)]('✔')+_0x5259d7(0x17c)+a21_0x112008[_0x5259d7(0x18b)](_0xea4f6a));}return saveSessionContext({'parent_segment':_0x352ed2},_0x2c35d2[_0x5259d7(0xdb)]),console['error'](a21_0x112008['green']('✔')+_0x5259d7(0x1bb)+a21_0x112008[_0x5259d7(0x145)](_0x5259d7(0x14d))+_0x5259d7(0x1c0)+a21_0x112008[_0x5259d7(0x18b)](_0x352ed2)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0x1c2);[a21_0x3eafb8(0x17a)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a21_0x3eafb8(0x118)](_0x26ded6){const _0x45a760=a21_0x3eafb8,{options:_0x3acb24,args:_0x521e4a,tdx:_0x56de57}=_0x26ded6,_0x13170d=_0x3acb24,_0xffeff6=_0x521e4a[0x0]||_0x3acb24[_0x45a760(0x14e)];if(!_0xffeff6)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'+_0x45a760(0x199)),0x1;const _0x2ff6a4=resolveYamlFile(_0xffeff6);if(!existsSync(_0x2ff6a4))return showFileNotFoundError(_0x2ff6a4,_0xffeff6),0x1;_0x13170d['verbose']&&(console[_0x45a760(0x19f)](_0x45a760(0x15f)+_0x13170d[_0x45a760(0x116)]),console[_0x45a760(0x19f)](_0x45a760(0x10b)+_0x2ff6a4));let _0x102101;try{_0x102101=readFileSync(_0x2ff6a4,_0x45a760(0x112));}catch(_0x1c41d3){const _0x3e7fa5=_0x1c41d3 instanceof Error?_0x1c41d3['message']:String(_0x1c41d3);return console[_0x45a760(0x19f)](_0x45a760(0xd9)+_0x3e7fa5),0x1;}const _0x21f27e=await withSpinner(_0x45a760(0x129),()=>_0x56de57[_0x45a760(0x16b)][_0x45a760(0xff)](_0x102101),{'verbose':_0x13170d[_0x45a760(0x100)]}),_0x2de511=_0x21f27e[_0x45a760(0x1ab)],{isNew:_0x417925,name:_0x4cccf9,hasChanges:_0x3d2e15,diffFormatted:_0x4ab726}=_0x2de511;if(!_0x3d2e15)return console[_0x45a760(0x19f)](_0x45a760(0xb2)+_0x4cccf9+_0x45a760(0x144)),0x0;_0x417925?console['error'](_0x45a760(0xe9)+_0x4cccf9+'\x27:'):console[_0x45a760(0x19f)](_0x45a760(0x1ad)+_0x4cccf9+'\x27:');console[_0x45a760(0x19f)]('─'['repeat'](0x3c)),console[_0x45a760(0x19f)](_0x4ab726),console[_0x45a760(0x19f)]('─'['repeat'](0x3c));const _0xd0f42d=_0x417925?_0x45a760(0xf1)+_0x4cccf9+'\x27?':_0x45a760(0x193)+_0x4cccf9+'\x27?';if(!_0x13170d[_0x45a760(0x1be)]){const _0x431cef=await confirmKey(_0xd0f42d);if(!_0x431cef)return console[_0x45a760(0x19f)](_0x45a760(0xcb)),0x1;}const _0x1e9edc=_0x417925?_0x45a760(0x17b):_0x45a760(0x125),_0x3fc5ce=await withSpinner(_0x1e9edc+_0x45a760(0x128)+_0x4cccf9+'\x27...',()=>_0x2de511['apply'](),{'verbose':_0x13170d[_0x45a760(0x100)]}),_0x1d166b=_0x3fc5ce[_0x45a760(0x1ab)],_0x339b05=getConsoleNextUrl(_0x13170d[_0x45a760(0x116)],_0x45a760(0x1bd)+_0x1d166b['id']),_0x54af38=_0x417925?_0x45a760(0x138):_0x45a760(0x1ae);return console[_0x45a760(0x19f)]('✔\x20'+_0x54af38+_0x45a760(0x128)+_0x1d166b[_0x45a760(0xf7)]+'\x27'),console[_0x45a760(0x19f)]('\x20\x20'+_0x339b05),0x0;}}function a21_0x7168(){const _0x4e7235=['text','parent_segment','parentSegment','Join\x20on:','`\x20to\x20download\x20the\x20configuration\x20first','segment:parent:preview','Parent\x20segment:\x20','To\x20cancel:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','displayBehaviorsStats','green','varchar','sort','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','joinKey','resolveParentId','join','customerGroup','Site:\x20','Available\x20behaviors:','dirname','workflowSessionId','listFields','errors','ignore','preview','log','70rYslXU','length','open','segment','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','keys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20rows)','setJobId','/\x20directory.\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','parent_segments','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20--behavior\x20\x22<name>\x22','✔\x20Updated\x20parent\x20segment\x20\x27','label','description','Creating','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','schemaError','endsWith','bold','2470dvzSGx','Master\x20Table','displayPreviewResults','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','scheduleType','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','cyan','\x20kill','previewParentYaml','displaySummary','\x20--attribute\x20\x22','Fetching\x20SQL\x20for\x20\x27','displayPreviewHints','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Apply\x20changes\x20to\x20\x27','Master:','columns','xdg-open','To\x20view\x20sample\x20data:','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','30192JdGeCm','updateParent','validateParentYaml','jobId','addBehaviors','error','filter','coveragePercent','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','listParents','Errors:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','population','query','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','data','addAttributes','\x0aChanges\x20to\x20apply\x20to\x20\x27','Updated','all','use','start','Join:','repeat','map','darwin','column','createParent','\x0aChanges\x20to\x20\x27','segment:parent:create','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20Context\x20set:\x20','/sessions/','/app/dw/parentSegments/','yes','SELECT\x20*\x20FROM\x20(\x0a','\x20=\x20','Show\x20parent\x20segment\x20details','segment:parent:push','List\x20available\x20fields\x20for\x20segmentation','schemaValid','411365LuNpMt','interval','message','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','/\x20directories\x20exist.','rowCount','test','attribute','unref','\x0a✔\x20Workflow\x20started','Name:\x20','\x20tdx\x20wf\x20attempt\x20','red','customerPercent','information_schema','matchedCount','Columns:','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Events:','Behavior:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','jsonl','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','tdx\x20segment\x20parent\x20preview\x20','Error:','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20No\x20changes\x20-\x20\x27','\x20--behavior\x20\x22','behavior','elapsedTimeMillis','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Creating\x20parent\x20segment\x20\x27','segment:parent:run','Executing\x20parent\x20segment\x20query...','segment:parent:fields','\x20[Job\x20ID:\x20','yellow','behaviors','replace','✔\x20Query\x20completed:\x20Processed\x20','sampleData','Rows:','limit','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','toLocaleString','\x20Configuration\x20is\x20valid','json','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','double','Listing\x20parent\x20segments...','\x20No\x20changes\x20-\x20','Aborted.','List\x20parent\x20segments','Customers:','\x0a⚠️\x20\x20Migrating:\x20','/attempt/','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','displayMasterInfo','👥\x20','.yml','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','231952RpckJi','attributesFile','Master\x20+\x20Attributes','Error\x20reading\x20file:\x20','isDirectory','session','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','enriched','5893248zxQZRH','Attribute:','No\x20parent\x20segments\x20found','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','toFixed','No\x20parent\x20segments\x20match\x20pattern:\x20','Options:','7767iARIaI','/\x20and\x20','segment:parent:view','\x0aNew\x20parent\x20segment\x20\x27','displayColumns','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','foreignKey','segment:parent:update','match','format','Create\x20parent\x20segment\x20\x27','6027ZkoHiS','segment:parent:desc','database','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Audience\x20ID:','name','FINISHED','Overwrite\x20\x27','/app/workflows/','status','\x27\x20with\x20ID:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','/{name}.yml\x0a','pushParentYaml','verbose','master','✔\x20Created\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','processedRows','allValid','Source:','getParentFull','getParentSQL','\x20\x20\x20\x20-\x20','Status:','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','workflowAttemptId','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Updating\x20parent\x20segment\x20\x27','displaySampleData','table','utf-8','trim','Options:\x0a','scheduleOption','site','audienceId','execute','stop','\x27\x20is\x20up\x20to\x20date','web','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20--attribute\x20\x22<name>\x22','timezone','run','670216whmaix','pullParentYaml','addBehaviorsFile','\x20--interval\x20','\x20Opening\x20','Updating','displayValidateResults','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20parent\x20segment\x20\x27','Analyzing\x20changes...','Preview:','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Found\x20YAML\x20file:\x20','SQL\x20query:\x0a','\x27\x20and\x20run\x20workflow?','/\x20→\x20','Validate:','platform','segment:parent:list','Database:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','output','displayAttributesStats','string','Created','attributes','addAttributesFile','Options\x20(one\x20required):\x0a','segment:parent:show','Attributes','1928rMSqgo','Resolving\x20parent\x20segment\x20\x27','Enriched:','stats','totalEvents','Listing\x20fields\x20for\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','dim','\x5c$&','customerGroupFile','\x0aUsage:\x20tdx\x20ps\x20preview\x20','customersWithEvents','✔\x20Renamed\x20directory\x20to\x20','Attempt:'];a21_0x7168=function(){return _0x4e7235;};return a21_0x7168();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x3eafb8(0xf7)]='segment:parent:validate';[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x183);async[a21_0x3eafb8(0x118)](_0x518f58){const _0x44d8b3=a21_0x3eafb8,{options:_0x1c2e9c,args:_0x456d27,tdx:_0x4deec8}=_0x518f58,_0x3d4c2d=_0x1c2e9c,_0x23d51f=_0x456d27[0x0]||_0x1c2e9c[_0x44d8b3(0x14e)];if(!_0x23d51f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x44d8b3(0x12b)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x44d8b3(0x16d)),0x1;const _0x29b431=resolveYamlFile(_0x23d51f);if(!existsSync(_0x29b431))return showFileNotFoundError(_0x29b431,_0x23d51f),0x1;_0x3d4c2d[_0x44d8b3(0x100)]&&(console[_0x44d8b3(0x19f)](_0x44d8b3(0x15f)+_0x3d4c2d[_0x44d8b3(0x116)]),console[_0x44d8b3(0x19f)](_0x44d8b3(0x10b)+_0x29b431));let _0x169ca5;try{_0x169ca5=readFileSync(_0x29b431,'utf-8');}catch(_0x120322){const _0xd3b84f=_0x120322 instanceof Error?_0x120322[_0x44d8b3(0x1c7)]:String(_0x120322);return console[_0x44d8b3(0x19f)]('Error\x20reading\x20file:\x20'+_0xd3b84f),0x1;}const _0x555181=createCommandSpinner(a21_0x112008[_0x44d8b3(0x145)]('Validating\x20configuration...'),{'verbose':_0x3d4c2d['verbose']});_0x555181[_0x44d8b3(0x1b1)]();const _0x355afd={'onProgress':_0x4e23db=>{const _0x16add5=_0x44d8b3;_0x555181[_0x16add5(0x14c)]=formatProgressMessage(_0x4e23db);}};if(_0x3d4c2d['master'])_0x355afd[_0x44d8b3(0x101)]=!![];if(_0x3d4c2d['enriched'])_0x355afd[_0x44d8b3(0xde)]=!![];_0x3d4c2d[_0x44d8b3(0x9e)]&&(_0x355afd[_0x44d8b3(0x9e)]=_0x3d4c2d[_0x44d8b3(0x9e)]);_0x3d4c2d[_0x44d8b3(0xb4)]&&(_0x355afd[_0x44d8b3(0xb4)]=_0x3d4c2d[_0x44d8b3(0xb4)]);if(_0x3d4c2d[_0x44d8b3(0x1c6)])_0x355afd[_0x44d8b3(0x1c6)]=_0x3d4c2d[_0x44d8b3(0x1c6)];let _0x1bf57c;try{_0x1bf57c=await _0x4deec8[_0x44d8b3(0x16b)][_0x44d8b3(0x19c)](_0x169ca5,_0x355afd),_0x555181[_0x44d8b3(0x119)]();}catch(_0xfdfe6){_0x555181[_0x44d8b3(0x119)]();throw _0xfdfe6;}const _0x4c0623=_0x3d4c2d[_0x44d8b3(0x1c6)]||'-1d';return this[_0x44d8b3(0x126)](_0x1bf57c,_0x355afd,_0x29b431,_0x4c0623),_0x1bf57c['allValid']?0x0:0x1;}['displayValidateResults'](_0x5de67f,_0x1af8cb,_0x47c5dd,_0x42bb79){const _0x464794=a21_0x3eafb8;console[_0x464794(0x19f)]('\x0a'+a21_0x112008[_0x464794(0x17f)](_0x464794(0x130))+'\x20'+_0x5de67f['name']),console[_0x464794(0x19f)]('═'[_0x464794(0x1b3)](0x3c)),this[_0x464794(0xd2)](_0x5de67f);if(typeof _0x1af8cb[_0x464794(0x9e)]===_0x464794(0x137)){this[_0x464794(0x136)](_0x5de67f),this['displaySummary'](_0x5de67f),this[_0x464794(0x191)](_0x47c5dd,_0x42bb79,_0x464794(0x9e),_0x1af8cb[_0x464794(0x9e)]);return;}if(_0x1af8cb[_0x464794(0x9e)]===!![]){this[_0x464794(0x136)](_0x5de67f),this['displaySummary'](_0x5de67f),this['displayPreviewHints'](_0x47c5dd,_0x42bb79,'attributes');return;}if(typeof _0x1af8cb[_0x464794(0xb4)]===_0x464794(0x137)){this[_0x464794(0x155)](_0x5de67f,_0x42bb79),this[_0x464794(0x18e)](_0x5de67f),this['displayPreviewHints'](_0x47c5dd,_0x42bb79,'behavior',_0x1af8cb[_0x464794(0xb4)]);return;}if(_0x1af8cb['behavior']===!![]){this['displayBehaviorsStats'](_0x5de67f,_0x42bb79),this[_0x464794(0x18e)](_0x5de67f),this['displayPreviewHints'](_0x47c5dd,_0x42bb79,_0x464794(0xbd));return;}this[_0x464794(0x136)](_0x5de67f),this[_0x464794(0x155)](_0x5de67f,_0x42bb79),this['displaySummary'](_0x5de67f),this['displayPreviewHints'](_0x47c5dd,_0x42bb79,'all');}[a21_0x3eafb8(0x191)](_0x1674e1,_0x51393b,_0x5e33df,_0x54dfe8){const _0x539531=a21_0x3eafb8;console[_0x539531(0x19f)]('\x0a'+a21_0x112008[_0x539531(0x145)](_0x539531(0x197)));const _0xcbf8c1=_0x51393b!=='-1d'?_0x539531(0x123)+_0x51393b:'';if(_0x5e33df===_0x539531(0x9e)&&_0x54dfe8)console[_0x539531(0x19f)]('\x20\x20'+a21_0x112008[_0x539531(0x145)](_0x539531(0xaf)+_0x1674e1+_0x539531(0x18f)+_0x54dfe8+'\x22'+_0xcbf8c1));else{if(_0x5e33df===_0x539531(0xb4)&&_0x54dfe8)console[_0x539531(0x19f)]('\x20\x20'+a21_0x112008[_0x539531(0x145)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1674e1+_0x539531(0xb3)+_0x54dfe8+'\x22'+_0xcbf8c1));else(_0x5e33df===_0x539531(0x139)||_0x5e33df===_0x539531(0x1af))&&console['error']('\x20\x20'+a21_0x112008['dim'](_0x539531(0xaf)+_0x1674e1+_0x539531(0x11d)+_0xcbf8c1));}(_0x5e33df===_0x539531(0xbd)||_0x5e33df==='all')&&console[_0x539531(0x19f)]('\x20\x20'+a21_0x112008[_0x539531(0x145)](_0x539531(0xaf)+_0x1674e1+_0x539531(0x177)+_0xcbf8c1)),_0x5e33df===_0x539531(0x1af)&&console['error']('\x20\x20'+a21_0x112008[_0x539531(0x145)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1674e1+'\x20--enriched'+_0xcbf8c1));}[a21_0x3eafb8(0xd2)](_0xb98148){const _0x140252=a21_0x3eafb8,{master:_0x350482}=_0xb98148,_0x3e9d8f=_0x350482[_0x140252(0x1c4)]?a21_0x112008[_0x140252(0x156)]('✔'):a21_0x112008['red']('✘');console[_0x140252(0x19f)]('\x0a'+a21_0x112008[_0x140252(0x145)](_0x140252(0x181))),console['error'](_0x3e9d8f+'\x20'+a21_0x112008['bold'](_0x350482[_0x140252(0xf4)]+'.'+_0x350482[_0x140252(0x111)])),_0x350482[_0x140252(0x1c4)]?_0x350482[_0x140252(0x1cb)]!==undefined&&console[_0x140252(0x19f)]('\x20\x20'+a21_0x112008[_0x140252(0x145)](_0x140252(0xc1))+'\x20'+a21_0x112008[_0x140252(0x18b)](formatRows(_0x350482[_0x140252(0x1cb)]))):console[_0x140252(0x19f)]('\x20\x20'+a21_0x112008[_0x140252(0xa3)](_0x140252(0xb0))+'\x20'+_0x350482['schemaError']);}[a21_0x3eafb8(0x136)](_0x111873){const _0xb20d85=a21_0x3eafb8;if(_0x111873[_0xb20d85(0x139)][_0xb20d85(0x169)]===0x0)return;console[_0xb20d85(0x19f)]('\x0a'+a21_0x112008['dim'](_0xb20d85(0x13d)));for(const _0x12bd45 of _0x111873[_0xb20d85(0x139)]){const _0x1ae5e1=_0x12bd45[_0xb20d85(0x1c4)]?a21_0x112008[_0xb20d85(0x156)]('✔'):a21_0x112008[_0xb20d85(0xa3)]('✘');let _0x234af4='';if(_0x12bd45['schemaValid']&&_0x12bd45['matchedCount']!==undefined&&_0x12bd45[_0xb20d85(0x1a1)]!==undefined){const _0x48ae03=_0x12bd45[_0xb20d85(0x1a1)][_0xb20d85(0xe3)](0x1),_0x1cd2af=_0x12bd45['coveragePercent']>=0x50?a21_0x112008[_0xb20d85(0x156)]:_0x12bd45[_0xb20d85(0x1a1)]>=0x32?a21_0x112008[_0xb20d85(0xbc)]:a21_0x112008[_0xb20d85(0xa3)];_0x234af4='\x20'+a21_0x112008['dim']('Coverage:')+'\x20'+_0x1cd2af(_0x48ae03+'%')+'\x20('+formatRows(_0x12bd45[_0xb20d85(0xa6)])+_0xb20d85(0x170);}console[_0xb20d85(0x19f)](_0x1ae5e1+'\x20'+a21_0x112008['bold'](_0x12bd45[_0xb20d85(0xf7)])+_0x234af4),console[_0xb20d85(0x19f)]('\x20\x20'+a21_0x112008['dim'](_0xb20d85(0x106))+'\x20'+a21_0x112008[_0xb20d85(0x17f)](_0x12bd45[_0xb20d85(0xf4)]+'.'+_0x12bd45[_0xb20d85(0x111)]));const _0x33e7ac=_0x12bd45[_0xb20d85(0x15b)]===_0x12bd45[_0xb20d85(0xed)]?a21_0x112008[_0xb20d85(0x145)]('Join\x20on:')+'\x20'+_0x12bd45[_0xb20d85(0x15b)]:a21_0x112008[_0xb20d85(0x145)](_0xb20d85(0x1b2))+'\x20'+_0x12bd45[_0xb20d85(0x15b)]+_0xb20d85(0x1c0)+_0x12bd45[_0xb20d85(0xed)];console[_0xb20d85(0x19f)]('\x20\x20'+_0x33e7ac),console[_0xb20d85(0x19f)]('\x20\x20'+a21_0x112008['dim'](_0xb20d85(0xa7))),this[_0xb20d85(0xea)](_0x12bd45[_0xb20d85(0x195)]),!_0x12bd45[_0xb20d85(0x1c4)]&&console[_0xb20d85(0x19f)]('\x20\x20'+a21_0x112008[_0xb20d85(0xa3)](_0xb20d85(0xb0))+'\x20'+_0x12bd45[_0xb20d85(0x17d)]);}}['displayBehaviorsStats'](_0x240eb7,_0xb8092c){const _0xdc9750=a21_0x3eafb8;if(_0x240eb7[_0xdc9750(0xbd)][_0xdc9750(0x169)]===0x0)return;console[_0xdc9750(0x19f)]('\x0a'+a21_0x112008[_0xdc9750(0x145)]('Behaviors')+'\x20'+a21_0x112008[_0xdc9750(0x145)]('('+_0xb8092c+')'));for(const _0x5841ed of _0x240eb7['behaviors']){const _0x1c9bd1=_0x5841ed[_0xdc9750(0x1c4)]?a21_0x112008[_0xdc9750(0x156)]('✔'):a21_0x112008[_0xdc9750(0xa3)]('✘');let _0x4f62c5='';if(_0x5841ed['schemaValid']&&_0x5841ed[_0xdc9750(0x149)]!==undefined&&_0x5841ed[_0xdc9750(0x142)]!==undefined){const _0x2f6ad2=_0x5841ed[_0xdc9750(0xa4)]?.[_0xdc9750(0xe3)](0x1)||'?',_0x3837ca=(_0x5841ed['customerPercent']??0x0)>=0x32?a21_0x112008[_0xdc9750(0x156)]:(_0x5841ed[_0xdc9750(0xa4)]??0x0)>=0x14?a21_0x112008['yellow']:a21_0x112008[_0xdc9750(0xa3)];_0x4f62c5='\x20'+a21_0x112008[_0xdc9750(0x145)](_0xdc9750(0xcd))+'\x20'+_0x3837ca(formatRows(_0x5841ed[_0xdc9750(0x149)]))+'\x20('+_0x2f6ad2+'%)\x20'+a21_0x112008['dim'](_0xdc9750(0xaa))+'\x20'+a21_0x112008['cyan'](formatRows(_0x5841ed['totalEvents']));}console[_0xdc9750(0x19f)](_0x1c9bd1+'\x20'+a21_0x112008[_0xdc9750(0x17f)](_0x5841ed['name'])+_0x4f62c5),console['error']('\x20\x20'+a21_0x112008[_0xdc9750(0x145)]('Source:')+'\x20'+a21_0x112008[_0xdc9750(0x17f)](_0x5841ed[_0xdc9750(0xf4)]+'.'+_0x5841ed['table']));const _0x2f074d=_0x5841ed[_0xdc9750(0x15b)]===_0x5841ed['foreignKey']?a21_0x112008[_0xdc9750(0x145)](_0xdc9750(0x14f))+'\x20'+_0x5841ed[_0xdc9750(0x15b)]:a21_0x112008['dim'](_0xdc9750(0x1b2))+'\x20'+_0x5841ed[_0xdc9750(0x15b)]+_0xdc9750(0x1c0)+_0x5841ed[_0xdc9750(0xed)];console[_0xdc9750(0x19f)]('\x20\x20'+_0x2f074d),console[_0xdc9750(0x19f)]('\x20\x20'+a21_0x112008[_0xdc9750(0x145)](_0xdc9750(0xa7))),this[_0xdc9750(0xea)](_0x5841ed[_0xdc9750(0x195)]),!_0x5841ed['schemaValid']&&console[_0xdc9750(0x19f)]('\x20\x20'+a21_0x112008[_0xdc9750(0xa3)]('Error:')+'\x20'+_0x5841ed[_0xdc9750(0x17d)]);}}[a21_0x3eafb8(0xea)](_0x349bcf){const _0x4aaddd=a21_0x3eafb8;for(const _0x355cb6 of _0x349bcf){_0x355cb6['label']===_0x355cb6['column']||_0x355cb6[_0x4aaddd(0x1b6)]==='*'?console[_0x4aaddd(0x19f)](_0x4aaddd(0x109)+_0x355cb6['label']):console[_0x4aaddd(0x19f)](_0x4aaddd(0x109)+_0x355cb6[_0x4aaddd(0x179)]+'\x20'+a21_0x112008['dim']('('+_0x355cb6['column']+')'));}}['displaySummary'](_0x51ea3d){const _0x1e3670=a21_0x3eafb8;console['error']('─'[_0x1e3670(0x1b3)](0x3c));if(_0x51ea3d[_0x1e3670(0x164)][_0x1e3670(0x169)]>0x0){console[_0x1e3670(0x19f)]('\x0a'+a21_0x112008['red'](_0x1e3670(0x1a5)));for(const _0x463a0b of _0x51ea3d[_0x1e3670(0x164)]){console[_0x1e3670(0x19f)]('\x20\x20'+a21_0x112008['red']('•')+'\x20'+_0x463a0b);}}_0x51ea3d[_0x1e3670(0x105)]&&console[_0x1e3670(0x19f)]('\x0a'+a21_0x112008[_0x1e3670(0x156)]('✔')+_0x1e3670(0xc5));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0x151);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x11c);async['execute'](_0x2c7fe2){const _0x215100=a21_0x3eafb8,{options:_0x4f6a32,args:_0x1a2120,tdx:_0x16dd78}=_0x2c7fe2,_0x20b10b=_0x4f6a32,_0x531ca3=_0x1a2120[0x0]||_0x4f6a32[_0x215100(0x14e)];if(!_0x531ca3)return showParentSegmentNotSetError(_0x215100(0xd5)+_0x215100(0xa9)+_0x215100(0x13b)+_0x215100(0x127)+_0x215100(0x185)+_0x215100(0x10e)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x215100(0x16d)),0x1;if(!_0x20b10b[_0x215100(0x101)]&&!_0x20b10b[_0x215100(0x9e)]&&!_0x20b10b[_0x215100(0xb4)]&&!_0x20b10b[_0x215100(0xde)])return console['error'](a21_0x112008[_0x215100(0xa3)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x215100(0xdc)),console[_0x215100(0x19f)](_0x215100(0xe5)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x215100(0x19f)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console['error'](_0x215100(0x1c8)),console[_0x215100(0x19f)](_0x215100(0xe2)),0x1;const _0x29be38=resolveYamlFile(_0x531ca3);if(!existsSync(_0x29be38))return showFileNotFoundError(_0x29be38,_0x531ca3),0x1;_0x20b10b['verbose']&&(console[_0x215100(0x19f)]('Site:\x20'+_0x20b10b[_0x215100(0x116)]),console[_0x215100(0x19f)](_0x215100(0x10b)+_0x29be38));let _0x1acaa1;try{_0x1acaa1=readFileSync(_0x29be38,_0x215100(0x112));}catch(_0x5c3d99){const _0x4b064f=_0x5c3d99 instanceof Error?_0x5c3d99[_0x215100(0x1c7)]:String(_0x5c3d99);return console[_0x215100(0x19f)]('Error\x20reading\x20file:\x20'+_0x4b064f),0x1;}let _0x6ad404;try{_0x6ad404=parseDef(_0x1acaa1);}catch(_0x20305a){const _0x7b07a=_0x20305a instanceof Error?_0x20305a['message']:String(_0x20305a);return console[_0x215100(0x19f)](a21_0x112008[_0x215100(0xa3)]('Error\x20parsing\x20YAML:\x20'+_0x7b07a)),0x1;}if(_0x20b10b['attribute']===!![]||_0x20b10b[_0x215100(0x9e)]===''){const _0x318b38=_0x6ad404[_0x215100(0x139)]?.['map'](_0x1497c8=>_0x1497c8[_0x215100(0xf7)])||[];if(_0x318b38[_0x215100(0x169)]===0x0)console['error'](a21_0x112008[_0x215100(0xa3)](_0x215100(0xfd)));else{console[_0x215100(0x19f)](a21_0x112008[_0x215100(0xa3)](_0x215100(0x188))),console[_0x215100(0x19f)]('Available\x20attributes:');for(const _0x407f80 of _0x318b38){console[_0x215100(0x19f)]('\x20\x20'+a21_0x112008['cyan'](_0x407f80));}console[_0x215100(0x19f)](_0x215100(0x148)+_0x531ca3+_0x215100(0x18f)+_0x318b38[0x0]+'\x22');}return 0x1;}if(_0x20b10b[_0x215100(0xb4)]===!![]||_0x20b10b['behavior']===''){const _0x551f2c=_0x6ad404[_0x215100(0xbd)]?.[_0x215100(0x1b4)](_0xcb876b=>_0xcb876b[_0x215100(0xf7)])||[];if(_0x551f2c[_0x215100(0x169)]===0x0)console[_0x215100(0x19f)](a21_0x112008[_0x215100(0xa3)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x215100(0x19f)](a21_0x112008[_0x215100(0xa3)](_0x215100(0x192))),console[_0x215100(0x19f)](_0x215100(0x160));for(const _0x5eca6b of _0x551f2c){console['error']('\x20\x20'+a21_0x112008[_0x215100(0x18b)](_0x5eca6b));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x531ca3+_0x215100(0xb3)+_0x551f2c[0x0]+'\x22');}return 0x1;}const _0x196811=createCommandSpinner(a21_0x112008[_0x215100(0x145)]('Fetching\x20sample\x20data...'),{'verbose':_0x20b10b[_0x215100(0x100)]});_0x196811[_0x215100(0x1b1)]();const _0x4e2061={'onProgress':_0x563174=>{const _0x1e1665=_0x215100;_0x196811[_0x1e1665(0x14c)]=formatProgressMessage(_0x563174);}};if(_0x20b10b['master'])_0x4e2061['master']=!![];if(_0x20b10b[_0x215100(0x9e)]&&typeof _0x20b10b['attribute']===_0x215100(0x137))_0x4e2061[_0x215100(0x9e)]=_0x20b10b[_0x215100(0x9e)];if(_0x20b10b[_0x215100(0xb4)]&&typeof _0x20b10b['behavior']===_0x215100(0x137))_0x4e2061[_0x215100(0xb4)]=_0x20b10b[_0x215100(0xb4)];if(_0x20b10b['enriched'])_0x4e2061[_0x215100(0xde)]=!![];if(_0x20b10b[_0x215100(0x1c6)])_0x4e2061['interval']=_0x20b10b[_0x215100(0x1c6)];let _0x2d4d99;try{_0x2d4d99=await _0x16dd78[_0x215100(0x16b)][_0x215100(0x18d)](_0x1acaa1,_0x4e2061),_0x196811[_0x215100(0x119)]();}catch(_0x2f85c5){_0x196811['stop']();throw _0x2f85c5;}return await this[_0x215100(0x182)](_0x2d4d99,{'master':_0x20b10b[_0x215100(0x101)],'attribute':typeof _0x20b10b[_0x215100(0x9e)]==='string'?_0x20b10b[_0x215100(0x9e)]:undefined,'behavior':typeof _0x20b10b[_0x215100(0xb4)]===_0x215100(0x137)?_0x20b10b[_0x215100(0xb4)]:undefined,'enriched':_0x20b10b[_0x215100(0xde)]}),_0x2d4d99[_0x215100(0x105)]?0x0:0x1;}async[a21_0x3eafb8(0x182)](_0x282c3f,_0x854439){const _0x582653=a21_0x3eafb8;console['error']('\x0a'+a21_0x112008[_0x582653(0x17f)](_0x582653(0x12a))+'\x20'+_0x282c3f[_0x582653(0xf7)]),console['error']('═'['repeat'](0x3c));if(_0x854439['master']&&_0x282c3f[_0x582653(0xc0)]){const _0x56caa5=a21_0x112008[_0x582653(0x145)](_0x582653(0x194))+'\x20'+a21_0x112008[_0x582653(0x17f)](_0x282c3f[_0x582653(0x101)][_0x582653(0xf4)]+'.'+_0x282c3f[_0x582653(0x101)]['table']);await this[_0x582653(0x110)](_0x56caa5,_0x282c3f[_0x582653(0xc0)]);}else{if(_0x854439[_0x582653(0x9e)]&&_0x282c3f[_0x582653(0xc0)]){const _0x4dd5e2=a21_0x112008[_0x582653(0x145)](_0x582653(0xe0))+'\x20'+a21_0x112008[_0x582653(0x17f)](_0x854439[_0x582653(0x9e)]);await this[_0x582653(0x110)](_0x4dd5e2,_0x282c3f['sampleData']);}else{if(_0x854439[_0x582653(0xb4)]&&_0x282c3f[_0x582653(0xc0)]){const _0x387ef9=a21_0x112008[_0x582653(0x145)](_0x582653(0xab))+'\x20'+a21_0x112008[_0x582653(0x17f)](_0x854439[_0x582653(0xb4)]);await this[_0x582653(0x110)](_0x387ef9,_0x282c3f['sampleData']);}else{if(_0x854439['enriched']&&_0x282c3f['sampleData']){const _0x8a2d37=a21_0x112008[_0x582653(0x145)](_0x582653(0x140))+'\x20'+a21_0x112008[_0x582653(0x17f)](_0x582653(0xd8));await this[_0x582653(0x110)](_0x8a2d37,_0x282c3f[_0x582653(0xc0)]);}else!_0x282c3f['sampleData']&&console[_0x582653(0x19f)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x282c3f[_0x582653(0x164)]['length']>0x0){console[_0x582653(0x19f)]('─'[_0x582653(0x1b3)](0x3c)),console[_0x582653(0x19f)]('\x0a'+a21_0x112008[_0x582653(0xa3)]('Errors:'));for(const _0x3388f2 of _0x282c3f[_0x582653(0x164)]){console['error']('\x20\x20'+a21_0x112008[_0x582653(0xa3)]('•')+'\x20'+_0x3388f2);}}}async[a21_0x3eafb8(0x110)](_0x2179ae,_0x4bf9df){const _0x23a12b=a21_0x3eafb8;if(_0x4bf9df[_0x23a12b(0x169)]===0x0){console['error']('\x0a'+_0x2179ae),console[_0x23a12b(0x19f)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x23a12b(0x19f)]('\x0a'+_0x2179ae);const _0xdc7c5e=Object[_0x23a12b(0x16e)](_0x4bf9df[0x0])[_0x23a12b(0x1b4)](_0x3c80d8=>({'name':_0x3c80d8,'type':typeof _0x4bf9df[0x0][_0x3c80d8]==='number'?_0x23a12b(0xc8):_0x23a12b(0x157)})),_0x512a32={'queryId':_0x23a12b(0x166),'columns':_0xdc7c5e,'data':_0x4bf9df,'stats':{'state':_0x23a12b(0xf8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4bf9df[_0x23a12b(0x169)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x81d11e=formatAsTable(_0x512a32,_0x4bf9df[_0x23a12b(0x169)],!![]);await writeOutput(_0x81d11e,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0xb8);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x174);async[a21_0x3eafb8(0x118)](_0x230033){const _0x2bfaf4=a21_0x3eafb8,{options:_0x231bbf,args:_0x4e0de9,tdx:_0xea9bad}=_0x230033,_0x23b5fa=_0x231bbf,_0x28efdf=_0x4e0de9[0x0]||_0x231bbf['parentSegment'];if(!_0x28efdf)return showParentSegmentNotSetError(_0x2bfaf4(0x159)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x312459=resolveYamlFile(_0x28efdf);if(existsSync(_0x312459)){_0x23b5fa[_0x2bfaf4(0x100)]&&console['error'](_0x2bfaf4(0x12c)+_0x312459);let _0x111ca0;try{_0x111ca0=readFileSync(_0x312459,_0x2bfaf4(0x112));}catch(_0x25aadb){const _0x5badbc=_0x25aadb instanceof Error?_0x25aadb[_0x2bfaf4(0x1c7)]:String(_0x25aadb);return console[_0x2bfaf4(0x19f)]('Error\x20reading\x20file:\x20'+_0x5badbc),0x1;}const _0x2fbedf=await withSpinner('Analyzing\x20changes...',()=>_0xea9bad['segment'][_0x2bfaf4(0xff)](_0x111ca0),{'verbose':_0x23b5fa['verbose']}),_0x2c166e=_0x2fbedf[_0x2bfaf4(0x1ab)],{isNew:_0x42ae00,name:_0x28c699,hasChanges:_0x4e7f5e,diffFormatted:_0x3408df}=_0x2c166e;if(_0x4e7f5e){_0x42ae00?console[_0x2bfaf4(0x19f)](_0x2bfaf4(0xe9)+_0x28c699+'\x27:'):console['error'](_0x2bfaf4(0x1ad)+_0x28c699+'\x27:');console[_0x2bfaf4(0x19f)]('─'[_0x2bfaf4(0x1b3)](0x3c)),console['error'](_0x3408df),console['error']('─'[_0x2bfaf4(0x1b3)](0x3c));const _0x2e7f9e=_0x42ae00?_0x2bfaf4(0xf1)+_0x28c699+'\x27\x20and\x20run\x20workflow?':_0x2bfaf4(0x193)+_0x28c699+_0x2bfaf4(0x12e);if(!_0x23b5fa[_0x2bfaf4(0x1be)]){const _0x228c45=await confirmKey(_0x2e7f9e);if(!_0x228c45)return console[_0x2bfaf4(0x19f)](_0x2bfaf4(0xcb)),0x1;}const _0x31e934=_0x42ae00?'Creating':'Updating';await withSpinner(_0x31e934+_0x2bfaf4(0x128)+_0x28c699+'\x27...',()=>_0x2c166e['apply'](),{'verbose':_0x23b5fa[_0x2bfaf4(0x100)]});const _0xb1cd94=_0x42ae00?_0x2bfaf4(0x138):'Updated';console[_0x2bfaf4(0x19f)]('✔\x20'+_0xb1cd94+_0x2bfaf4(0x128)+_0x28c699+'\x27');}else console[_0x2bfaf4(0x19f)](_0x2bfaf4(0xb2)+_0x28c699+_0x2bfaf4(0x11a));}const _0x23ab63=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x28efdf+_0x2bfaf4(0x1a9),()=>_0xea9bad[_0x2bfaf4(0x16b)]['runParent'](_0x28efdf),{'verbose':_0x23b5fa['verbose']}),_0x3365ca=_0x23ab63['data'],_0xed8751=getConsoleUrl(_0x23b5fa[_0x2bfaf4(0x116)],_0x2bfaf4(0xfa)+_0x3365ca['workflowId']+_0x2bfaf4(0x1bc)+_0x3365ca['workflowSessionId']+_0x2bfaf4(0xcf)+_0x3365ca['workflowAttemptId']);return console[_0x2bfaf4(0x19f)](_0x2bfaf4(0xa0)),console[_0x2bfaf4(0x19f)]('\x20\x20'+a21_0x112008[_0x2bfaf4(0x145)](_0x2bfaf4(0xf6))+'\x20'+_0x3365ca[_0x2bfaf4(0x117)]),console['error']('\x20\x20'+a21_0x112008[_0x2bfaf4(0x145)](_0x2bfaf4(0x10a))+'\x20'+_0x3365ca[_0x2bfaf4(0xfb)]),console[_0x2bfaf4(0x19f)]('\x20\x20'+a21_0x112008[_0x2bfaf4(0x145)]('Session:')+'\x20'+_0x3365ca[_0x2bfaf4(0x162)]),console[_0x2bfaf4(0x19f)]('\x20\x20'+a21_0x112008[_0x2bfaf4(0x145)](_0x2bfaf4(0x14b))+'\x20'+_0x3365ca[_0x2bfaf4(0x10d)]),console[_0x2bfaf4(0x19f)]('\x20\x20'+_0xed8751),console['error']('\x0a'+a21_0x112008[_0x2bfaf4(0x145)](_0x2bfaf4(0x153))+_0x2bfaf4(0xa2)+_0x3365ca[_0x2bfaf4(0x10d)]+_0x2bfaf4(0x18c)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0xba);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x1c3);async[a21_0x3eafb8(0x118)](_0x43c48b){const _0x178d69=a21_0x3eafb8,{options:_0xebf05,args:_0x1d741b,tdx:_0x2f8228}=_0x43c48b,_0x20b60d=_0x1d741b[0x0]||_0xebf05['parentSegment'];if(!_0x20b60d)return showParentSegmentNotSetError(_0x178d69(0xb6)+_0x178d69(0xec)),0x1;_0xebf05['verbose']&&(console['error'](_0x178d69(0x15f)+_0xebf05['site']),console[_0x178d69(0x19f)](_0x178d69(0x152)+_0x20b60d));const _0xdce3c2=await withSpinner(_0x178d69(0x143)+_0x20b60d+'\x27...',()=>_0x2f8228[_0x178d69(0x16b)][_0x178d69(0x163)](_0x20b60d),{'verbose':_0xebf05[_0x178d69(0x100)]}),_0x1442c9=_0xdce3c2[_0x178d69(0x1ab)];console[_0x178d69(0x19f)](_0x178d69(0x198)+_0x1442c9[_0x178d69(0x169)]+'\x20field'+(_0x1442c9[_0x178d69(0x169)]!==0x1?'s':''));if(_0xebf05[_0x178d69(0xc6)]||_0xebf05[_0x178d69(0xad)])return await handleSDKOutput(_0x1442c9,_0xebf05),0x0;return displayFieldsHumanReadable(_0x1442c9,_0x20b60d),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0xe8);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x1c1);async[a21_0x3eafb8(0x118)](_0x13ce4d){const _0x5212da=a21_0x3eafb8,{options:_0x24da79,args:_0x5cbdce,tdx:_0x57fec0}=_0x13ce4d,_0x21d544=_0x24da79,_0x26b1cf=_0x5cbdce[0x0]||_0x24da79[_0x5212da(0x14e)];if(!_0x26b1cf)return showParentSegmentNotSetError(_0x5212da(0x15a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x5212da(0x114)+_0x5212da(0x1c9)),0x1;_0x24da79[_0x5212da(0x100)]&&(console[_0x5212da(0x19f)](_0x5212da(0x15f)+_0x24da79[_0x5212da(0x116)]),console[_0x5212da(0x19f)](_0x5212da(0x152)+_0x26b1cf));const _0x4e2169=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x26b1cf+'\x27...',()=>_0x57fec0[_0x5212da(0x16b)][_0x5212da(0x107)](_0x26b1cf),{'verbose':_0x24da79[_0x5212da(0x100)]}),_0x5a7399=_0x4e2169['data'];if(_0x21d544[_0x5212da(0x11b)]){const _0x4e783b=getConsoleNextUrl(_0x21d544[_0x5212da(0x116)],_0x5212da(0x1bd)+_0x5a7399['id']);return console[_0x5212da(0x19f)](a21_0x112008[_0x5212da(0x156)]('✔')+_0x5212da(0x124)+a21_0x112008[_0x5212da(0x18b)](_0x4e783b)),openBrowser(_0x4e783b),0x0;}return await handleSingleObjectOutput(_0x5a7399,_0x24da79),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x3eafb8(0xf7)]=a21_0x3eafb8(0xf3);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x154);async[a21_0x3eafb8(0x118)](_0x5cfbac){const _0x16f502=a21_0x3eafb8,{options:_0x3ca526,args:_0x128ddd,tdx:_0x48e414}=_0x5cfbac,_0x13f9ec=_0x128ddd[0x0]||_0x3ca526[_0x16f502(0x14e)];if(!_0x13f9ec)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x16f502(0x16f)),0x1;_0x3ca526['verbose']&&(console['error'](_0x16f502(0x15f)+_0x3ca526[_0x16f502(0x116)]),console[_0x16f502(0x19f)](_0x16f502(0x152)+_0x13f9ec));const _0x269479=await withSpinner(_0x16f502(0x13f)+_0x13f9ec+_0x16f502(0x1a9),()=>_0x48e414[_0x16f502(0x16b)][_0x16f502(0x15c)](_0x13f9ec),{'verbose':_0x3ca526[_0x16f502(0x100)]}),_0x593f2c=_0x269479['data'],_0x3ca999=await withSpinner(_0x16f502(0x190)+_0x13f9ec+'\x27...',()=>_0x48e414[_0x16f502(0x16b)][_0x16f502(0x108)](_0x593f2c),{'verbose':_0x3ca526[_0x16f502(0x100)]}),_0x2282cc=await executeSchemaQuery(_0x3ca999[_0x16f502(0x1ab)],_0x48e414,_0x3ca526);return await handleQueryOutput(_0x2282cc,_0x3ca526),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']='segment:parent:sql';[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0xd1);async[a21_0x3eafb8(0x118)](_0x1a4e4c){const _0x15d8b9=a21_0x3eafb8,{options:_0x35b87b,args:_0x4cbb10,tdx:_0x37f0ac}=_0x1a4e4c,_0x1eb22a=_0x4cbb10[0x0]||_0x35b87b[_0x15d8b9(0x14e)];if(!_0x1eb22a)return showParentSegmentNotSetError(_0x15d8b9(0x1a6)+_0x15d8b9(0x186)),0x1;_0x35b87b[_0x15d8b9(0x100)]&&(console[_0x15d8b9(0x19f)]('Site:\x20'+_0x35b87b['site']),console[_0x15d8b9(0x19f)](_0x15d8b9(0x152)+_0x1eb22a));const _0x54fea4=await withSpinner(_0x15d8b9(0x13f)+_0x1eb22a+_0x15d8b9(0x1a9),()=>_0x37f0ac[_0x15d8b9(0x16b)]['resolveParentId'](_0x1eb22a),{'verbose':_0x35b87b[_0x15d8b9(0x100)]}),_0x34b913=_0x54fea4[_0x15d8b9(0x1ab)],_0x3be095=await withSpinner(_0x15d8b9(0x190)+_0x1eb22a+_0x15d8b9(0x1a9),()=>_0x37f0ac[_0x15d8b9(0x16b)][_0x15d8b9(0x108)](_0x34b913),{'verbose':_0x35b87b['verbose']}),_0x28ee05=_0x3be095[_0x15d8b9(0x1ab)];return _0x35b87b[_0x15d8b9(0xf0)]===_0x15d8b9(0xc6)||_0x35b87b['format']===_0x15d8b9(0xad)?await handleSDKOutput([{'sql':_0x28ee05}],_0x35b87b):console[_0x15d8b9(0x167)](_0x28ee05),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a21_0x3eafb8(0x13c);[a21_0x3eafb8(0x17a)]=a21_0x3eafb8(0x176);async[a21_0x3eafb8(0x118)](_0x242f00){const _0x49aa64=a21_0x3eafb8,{options:_0x3ca6ea,args:_0x123f71,tdx:_0x571a7a}=_0x242f00,_0x866b40=_0x123f71[0x0]||_0x3ca6ea['parentSegment'];if(!_0x866b40)return showParentSegmentNotSetError(_0x49aa64(0x16c)+'\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;_0x3ca6ea['verbose']&&(console['error'](_0x49aa64(0x15f)+_0x3ca6ea['site']),console[_0x49aa64(0x19f)](_0x49aa64(0x152)+_0x866b40));const _0x173cef=await withSpinner(_0x49aa64(0x13f)+_0x866b40+_0x49aa64(0x1a9),()=>_0x571a7a[_0x49aa64(0x16b)][_0x49aa64(0x15c)](_0x866b40),{'verbose':_0x3ca6ea[_0x49aa64(0x100)]}),_0x504b5e=_0x173cef[_0x49aa64(0x1ab)],_0x59552a=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x866b40+_0x49aa64(0x1a9),()=>_0x571a7a[_0x49aa64(0x16b)][_0x49aa64(0x108)](_0x504b5e),{'verbose':_0x3ca6ea[_0x49aa64(0x100)]});let _0x1f5b77=_0x59552a['data'];const _0x4d35af=resolveLimit(_0x3ca6ea[_0x49aa64(0xc2)],DEFAULT_DISPLAY_LIMIT),_0x5e0de3=/\bLIMIT\s+\d+/i[_0x49aa64(0x9d)](_0x1f5b77);!_0x5e0de3&&(_0x1f5b77=_0x1f5b77[_0x49aa64(0x113)]()[_0x49aa64(0xbe)](/;+$/,''),_0x1f5b77=_0x49aa64(0x1bf)+_0x1f5b77+_0x49aa64(0xac)+_0x4d35af);_0x3ca6ea[_0x49aa64(0x100)]&&console[_0x49aa64(0x19f)](_0x49aa64(0x12d)+_0x1f5b77);const _0xd76359=await withProgressSpinner(_0x49aa64(0xb9),async _0x3c76a2=>{const _0x570989=_0x49aa64,_0x28b9d9=await _0x571a7a[_0x570989(0x1a8)][_0x570989(0x118)](_0x1f5b77,{'catalog':'td','schema':_0x570989(0xa5),'onJobId':_0x4e06a4=>{const _0x3ea82f=_0x570989;_0x3c76a2[_0x3ea82f(0x171)](_0x4e06a4);}});return _0x28b9d9;},{'verbose':_0x3ca6ea[_0x49aa64(0x100)]}),_0x2aca00=_0xd76359[_0x49aa64(0x1ab)],_0xd59d93=_0x2aca00[_0x49aa64(0x19d)]?_0x49aa64(0xbb)+_0x2aca00[_0x49aa64(0x19d)]+']':'';return console['error'](_0x49aa64(0xbf)+_0x2aca00[_0x49aa64(0x141)][_0x49aa64(0x104)][_0x49aa64(0xc4)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x2aca00[_0x49aa64(0x141)][_0x49aa64(0xb5)])+_0xd59d93)),await handleQueryOutput(_0x2aca00,_0x3ca6ea),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x14a0ad=a22_0xc3af;(function(_0x5c3951,_0x53212e){const _0x5ebcc0=a22_0xc3af,_0x31baf6=_0x5c3951();while(!![]){try{const _0x1728af=-parseInt(_0x5ebcc0(0xcd))/0x1+-parseInt(_0x5ebcc0(0x108))/0x2*(parseInt(_0x5ebcc0(0xb2))/0x3)+parseInt(_0x5ebcc0(0x9c))/0x4+-parseInt(_0x5ebcc0(0xd7))/0x5*(-parseInt(_0x5ebcc0(0xf4))/0x6)+parseInt(_0x5ebcc0(0xa8))/0x7+parseInt(_0x5ebcc0(0xc7))/0x8*(-parseInt(_0x5ebcc0(0xfa))/0x9)+-parseInt(_0x5ebcc0(0xd4))/0xa*(parseInt(_0x5ebcc0(0xb8))/0xb);if(_0x1728af===_0x53212e)break;else _0x31baf6['push'](_0x31baf6['shift']());}catch(_0x3f6a34){_0x31baf6['push'](_0x31baf6['shift']());}}}(a22_0x7968,0xc3b30));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 a22_0x14d041 from'node:path';function a22_0x7968(){const _0x186045=['Remove\x20a\x20profile','validate','test','Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','default','profile:remove','9237btwjBx','\x20--default\x27\x20to\x20save\x20permanently','eu01','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','jp01','tdx:\x20profile\x20set','16313dHMHJc','apiKey','error','profileName','toString','Unknown\x20key\x20\x27','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','tdx:\x20profile\x20create','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','create','\x0aAvailable\x20profiles:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20remove','site','parent_segment','8WuiXxc','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Enter\x20custom\x20site','config','description','555066veyqSr','\x20\x20-\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','ap02','profile','name','\x20API\x20key\x20is\x20valid\x20(User:\x20','2040pdprjl','password','eu\x20\x20\x20-\x20Europe','31805CgByEB','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','split','VALID_KEYS','logLevel','Operation\x20cancelled','tdx.json','status','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','llm_agent','ERROR','select','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27\x20updated:\x20','\x0aOperation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','(session:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20tdx\x20--profile\x20','jobs','jp\x20\x20\x20-\x20Japan','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','findIndex','dim','You\x20can\x20find\x20your\x20API\x20key\x20at:','other','message','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','396IwSpFS','red','customSite','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','includes','Set\x20session\x20profile','3883986WnrqOE','\x27\x20created','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>','push','profile:use','Enter\x20site\x20name:','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','us01','us\x20\x20\x20-\x20United\x20States','Validating\x20API\x20key...','Set\x20a\x20profile\x20configuration\x20value','ap02\x20-\x20Korea','green','548RsNFqu','profile:create','\x20\x20(no\x20profiles\x20found)','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Removal\x20cancelled','execute','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','getUserInfo','log','Create\x20a\x20new\x20profile','join','Profile\x20name\x20cannot\x20be\x20empty','trim','session','6043224eKDdqC','text','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','✗\x20Validation\x20failed:\x20','warn','Default\x20profile\x20set\x20to:\x20','\x0aSaved\x20to:\x20','bold','confirm','Changing\x20site\x20to\x20\x27','\x27\x20removed\x20from\x20configuration','database','7026250YpumdH','length','\x0aSetup\x20cancelled'];a22_0x7968=function(){return _0x186045;};return a22_0x7968();}import{saveSessionContext,getCurrentSessionPID,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{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a22_0xc3af(_0x4e11f9,_0x197fbb){_0x4e11f9=_0x4e11f9-0x97;const _0x796837=a22_0x7968();let _0xc3af75=_0x796837[_0x4e11f9];return _0xc3af75;}import a22_0x5ca639 from'prompts';import a22_0x2e6c6b from'chalk';function validateProfileName(_0x2985d0){const _0x11db4a=a22_0xc3af;if(!_0x2985d0||!_0x2985d0[_0x11db4a(0x9a)]())return _0x11db4a(0x99);const _0x4407dd=_0x2985d0[_0x11db4a(0x9a)]();if(!/^[a-zA-Z0-9_-]+$/[_0x11db4a(0xad)](_0x4407dd))return _0x11db4a(0xf3);if(profileExists(_0x4407dd))return'Profile\x20\x27'+_0x4407dd+_0x11db4a(0xf7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0x14a0ad(0xd2)]=a22_0x14a0ad(0x109);[a22_0x14a0ad(0xcc)]=a22_0x14a0ad(0x97);async[a22_0x14a0ad(0x10d)](_0x5751cc){const _0x591509=a22_0x14a0ad,{options:_0x4ef92d,args:_0x43d91d}=_0x5751cc;console[_0x591509(0x111)](a22_0x2e6c6b[_0x591509(0xa3)](_0x591509(0xbf)));let _0x3ceb1c;if(_0x43d91d['length']>0x0&&_0x43d91d[0x0]){const _0x1eb407=_0x43d91d[0x0][_0x591509(0x9a)](),_0x101bc2=validateProfileName(_0x1eb407);if(_0x101bc2!==!![])return console[_0x591509(0xba)](a22_0x2e6c6b[_0x591509(0xf5)](_0x101bc2)),0x1;_0x3ceb1c=_0x1eb407;}else{const _0x3b8d99=await a22_0x5ca639({'type':_0x591509(0x9d),'name':_0x591509(0xbb),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x3b8d99[_0x591509(0xbb)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x3ceb1c=_0x3b8d99[_0x591509(0xbb)][_0x591509(0x9a)]();}const _0x1d8fbf=await a22_0x5ca639({'type':'text','name':'description','message':'Enter\x20description\x20(optional):'}),_0x115691=_0x1d8fbf[_0x591509(0xcc)]?.[_0x591509(0x9a)]()||undefined,_0x10fdfb=_0x4ef92d[_0x591509(0xc5)]||_0x591509(0x102),_0x12b38b=[{'title':_0x591509(0x103),'value':_0x591509(0x102)},{'title':_0x591509(0xec),'value':_0x591509(0xb6)},{'title':_0x591509(0xd6),'value':_0x591509(0xb4)},{'title':_0x591509(0x106),'value':_0x591509(0xd0)}];let _0x484cc0=_0x12b38b[_0x591509(0xee)](_0x355234=>_0x355234['value']===_0x10fdfb);_0x484cc0===-0x1&&_0x10fdfb!=='us01'&&(_0x12b38b[_0x591509(0xfd)]({'title':_0x10fdfb,'value':_0x10fdfb}),_0x484cc0=_0x12b38b['length']-0x1);_0x12b38b['push']({'title':_0x591509(0xca),'value':_0x591509(0xf1)});const _0x33d265=await a22_0x5ca639({'type':_0x591509(0xe2),'name':_0x591509(0xc5),'message':_0x591509(0xb5)+_0x3ceb1c+'\x27:','choices':_0x12b38b,'initial':_0x484cc0>=0x0?_0x484cc0:0x0});if(!_0x33d265[_0x591509(0xc5)])return console[_0x591509(0x111)](_0x591509(0xaa)),0x1;let _0x407a26;if(_0x33d265[_0x591509(0xc5)]===_0x591509(0xf1)){const _0x474df8=await a22_0x5ca639({'type':_0x591509(0x9d),'name':_0x591509(0xf6),'message':_0x591509(0xff),'initial':_0x591509(0x102),'validate':_0x42f640=>{const _0x4c6f19=_0x591509;if(!_0x42f640||!_0x42f640[_0x4c6f19(0x9a)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x4c6f19(0xad)](_0x42f640[_0x4c6f19(0x9a)]()))return _0x4c6f19(0xbe);return!![];}});if(!_0x474df8[_0x591509(0xf6)])return console['log'](_0x591509(0xaa)),0x1;_0x407a26=_0x474df8['customSite'];}else _0x407a26=_0x33d265['site'];const _0x5473c5=resolveSite(_0x407a26);console[_0x591509(0x111)](_0x591509(0xe4)+_0x5473c5),console[_0x591509(0x111)](_0x591509(0xf0)),console[_0x591509(0x111)]('\x20\x20'+getConsoleUrl(_0x5473c5,'/app/mp/ak'));const _0x11a92b=await a22_0x5ca639({'type':_0x591509(0xd5),'name':_0x591509(0xb9),'message':_0x591509(0xc8),'validate':_0x58c9fb=>{if(!_0x58c9fb||!_0x58c9fb['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x11a92b[_0x591509(0xb9)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x501a81=_0x11a92b[_0x591509(0xb9)];console[_0x591509(0x111)](_0x591509(0x104));try{const _0x128b3c=TDX['create']({'site':_0x5473c5,'apiKey':_0x501a81[_0x591509(0x9a)](),'logLevel':_0x4ef92d[_0x591509(0xdb)]??LogLevel[_0x591509(0xe1)]}),_0x42ccb6=await _0x128b3c['jobs'][_0x591509(0x110)]();console[_0x591509(0x111)](a22_0x2e6c6b[_0x591509(0x107)]('✓')+_0x591509(0xd3)+_0x42ccb6['email']+')');const _0x541616=await isKeychainAvailable();_0x541616?(await saveAPIKeyAsync(_0x501a81[_0x591509(0x9a)](),_0x5473c5,_0x3ceb1c),console[_0x591509(0x111)](a22_0x2e6c6b[_0x591509(0x107)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3ceb1c+')')):(console['warn'](a22_0x2e6c6b['yellow'](_0x591509(0xed))),console[_0x591509(0xa0)](a22_0x2e6c6b['yellow'](_0x591509(0xc0))));const _0x590439={'site':_0x5473c5,..._0x115691&&{'description':_0x115691}};return saveProfileToUserConfig(_0x3ceb1c,_0x590439),console[_0x591509(0x111)](a22_0x2e6c6b[_0x591509(0x107)]('✓')+_0x591509(0x101)+_0x3ceb1c+_0x591509(0xfb)),console['log'](),console[_0x591509(0x111)](_0x591509(0xaf)),console['log'](_0x591509(0xea)+_0x3ceb1c+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x591509(0xea)+_0x3ceb1c+_0x591509(0xc3)),0x0;}catch(_0x24d9b6){if(_0x24d9b6 instanceof HTTPClientError&&_0x24d9b6[_0x591509(0xde)]===0x191)return printAuthError(_0x24d9b6),0x1;return console[_0x591509(0xba)](a22_0x2e6c6b[_0x591509(0xf5)](_0x591509(0x9f)+(_0x24d9b6 instanceof Error?_0x24d9b6['message']:String(_0x24d9b6)))),console['error'](_0x591509(0x9e)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0x14a0ad(0xd2)]=a22_0x14a0ad(0xb1);['description']=a22_0x14a0ad(0xab);[a22_0x14a0ad(0xac)](_0x27a750){const _0x4f831f=a22_0x14a0ad,{args:_0x108009}=_0x27a750;if(_0x108009[_0x4f831f(0xa9)]===0x0)return _0x4f831f(0xcf);return undefined;}async[a22_0x14a0ad(0x10d)](_0x3376ba){const _0x277c2a=a22_0x14a0ad,{args:_0x572399}=_0x3376ba,_0x3d2efa=_0x572399[0x0];console['log'](a22_0x2e6c6b['bold'](_0x277c2a(0xc4)));if(!profileExists(_0x3d2efa)){console[_0x277c2a(0xba)](a22_0x2e6c6b[_0x277c2a(0xf5)]('Profile\x20\x27'+_0x3d2efa+'\x27\x20does\x20not\x20exist.')),console['log'](_0x277c2a(0xc2));const _0x6c8882=listProfiles();if(_0x6c8882[_0x277c2a(0xa9)]===0x0)console['log'](_0x277c2a(0x10a));else for(const _0x3ff302 of _0x6c8882){console[_0x277c2a(0x111)](_0x277c2a(0xce)+_0x3ff302[_0x277c2a(0xd2)]);}return 0x1;}const _0x1c7f7b=await a22_0x5ca639({'type':_0x277c2a(0xa4),'name':_0x277c2a(0xa4),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x3d2efa+'\x27?','initial':![]});if(!_0x1c7f7b[_0x277c2a(0xa4)])return console[_0x277c2a(0x111)](_0x277c2a(0x10c)),0x0;try{removeProfileFromUserConfig(_0x3d2efa),console[_0x277c2a(0x111)](a22_0x2e6c6b[_0x277c2a(0x107)]('✓')+_0x277c2a(0x101)+_0x3d2efa+_0x277c2a(0xa6));}catch(_0xa065e4){return console[_0x277c2a(0xba)](a22_0x2e6c6b[_0x277c2a(0xf5)]('Failed\x20to\x20remove\x20profile:\x20'+(_0xa065e4 instanceof Error?_0xa065e4[_0x277c2a(0xf2)]:String(_0xa065e4)))),0x1;}const _0xbd10fe=await isKeychainAvailable();if(_0xbd10fe){const _0x1a1a80=await deleteKeychainAPIKey(_0x3d2efa);_0x1a1a80&&console[_0x277c2a(0x111)](a22_0x2e6c6b[_0x277c2a(0x107)]('✓')+_0x277c2a(0xc9));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x14a0ad(0xd2)]='profile:set';[a22_0x14a0ad(0xcc)]=a22_0x14a0ad(0x105);static [a22_0x14a0ad(0xda)]=[a22_0x14a0ad(0xc5),a22_0x14a0ad(0xa7),a22_0x14a0ad(0xc6),'llm_project',a22_0x14a0ad(0xe0),a22_0x14a0ad(0xcc)];['validate'](_0x1e2503){const _0x5bbbfd=a22_0x14a0ad,{args:_0x281f10,options:_0x38a473}=_0x1e2503,_0x485b96=_0x38a473[_0x5bbbfd(0xd1)]||getActiveProfile();if(!_0x485b96)return _0x5bbbfd(0xfc);if(_0x281f10['length']===0x0)return _0x5bbbfd(0xe9)+ProfileSetCommand['VALID_KEYS'][_0x5bbbfd(0x98)](',\x20');const _0x2379ae=_0x281f10[0x0];if(!_0x2379ae[_0x5bbbfd(0xf8)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5bbbfd(0xda)][_0x5bbbfd(0x98)](',\x20');const [_0x18ffdd]=_0x2379ae['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x5bbbfd(0xf8)](_0x18ffdd))return _0x5bbbfd(0xbd)+_0x18ffdd+_0x5bbbfd(0x100)+ProfileSetCommand[_0x5bbbfd(0xda)][_0x5bbbfd(0x98)](',\x20');return undefined;}async['execute'](_0x38551d){const _0x45961c=a22_0x14a0ad,{args:_0x1a93f8,options:_0x291eb9}=_0x38551d,_0x2cbea6=_0x291eb9['profile']||getActiveProfile(),[_0x1b20d8,..._0x71b929]=_0x1a93f8[0x0][_0x45961c(0xd9)]('='),_0xae3e54=_0x71b929['join']('=');console[_0x45961c(0x111)](a22_0x2e6c6b[_0x45961c(0xa3)](_0x45961c(0xb7)));if(!profileExists(_0x2cbea6)){const _0x274344=await a22_0x5ca639({'type':_0x45961c(0xa4),'name':_0x45961c(0xc1),'message':_0x45961c(0xae)+_0x2cbea6+_0x45961c(0x10b),'initial':!![]});if(!_0x274344[_0x45961c(0xc1)])return console['log'](_0x45961c(0xdc)),0x1;}const _0x1fa201=loadProfile(_0x2cbea6),_0x50ad79=_0x1fa201?.[_0x45961c(0xcb)]||{};if(_0x1b20d8==='site'){const _0x114da2=resolveSite(_0xae3e54);console[_0x45961c(0x111)](_0x45961c(0xa5)+_0x114da2+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x45961c(0x111)](_0x45961c(0xd8)),console['log']('\x20\x20'+getConsoleUrl(_0x114da2,'/app/mp/ak'));const _0x119b4f=await a22_0x5ca639({'type':_0x45961c(0xd5),'name':_0x45961c(0xb9),'message':_0x45961c(0x10e),'validate':_0xf5cfa1=>{const _0x35cb23=_0x45961c;if(!_0xf5cfa1||!_0xf5cfa1[_0x35cb23(0x9a)]())return _0x35cb23(0xe7);return!![];}});if(!_0x119b4f[_0x45961c(0xb9)])return console['log'](_0x45961c(0xe6)),0x1;console['log'](_0x45961c(0x104));try{const _0x5b01b8=TDX[_0x45961c(0xc1)]({'site':_0x114da2,'apiKey':_0x119b4f[_0x45961c(0xb9)][_0x45961c(0x9a)](),'logLevel':_0x291eb9['logLevel']??LogLevel[_0x45961c(0xe1)]}),_0x94c569=await _0x5b01b8[_0x45961c(0xeb)][_0x45961c(0x110)]();console['log'](a22_0x2e6c6b[_0x45961c(0x107)]('✓')+_0x45961c(0xd3)+_0x94c569['email']+')');const _0x244083=await isKeychainAvailable();_0x244083?(await saveAPIKeyAsync(_0x119b4f[_0x45961c(0xb9)][_0x45961c(0x9a)](),_0x114da2,_0x2cbea6),console['log'](a22_0x2e6c6b[_0x45961c(0x107)]('✓')+_0x45961c(0xe3))):console[_0x45961c(0xa0)](a22_0x2e6c6b['yellow'](_0x45961c(0xed))),_0x50ad79['site']=_0x114da2;}catch(_0x352d0e){if(_0x352d0e instanceof HTTPClientError&&_0x352d0e[_0x45961c(0xde)]===0x191)return printAuthError(_0x352d0e),0x1;return console[_0x45961c(0xba)](a22_0x2e6c6b[_0x45961c(0xf5)](_0x45961c(0x9f)+(_0x352d0e instanceof Error?_0x352d0e[_0x45961c(0xf2)]:String(_0x352d0e)))),console[_0x45961c(0xba)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x50ad79[_0x1b20d8]=_0xae3e54||undefined;return saveProfileToUserConfig(_0x2cbea6,_0x50ad79),console['log'](a22_0x2e6c6b[_0x45961c(0x107)]('✓')+_0x45961c(0x101)+_0x2cbea6+_0x45961c(0xe5)+_0x1b20d8+'='+(_0xae3e54||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0x14a0ad(0xd2)]=a22_0x14a0ad(0xfe);['description']=a22_0x14a0ad(0xf9);[a22_0x14a0ad(0xac)](_0x2d50eb){const _0x39a537=a22_0x14a0ad,{args:_0x511467}=_0x2d50eb;if(_0x511467['length']===0x0)return _0x39a537(0x10f);return undefined;}async[a22_0x14a0ad(0x10d)](_0x330a4d){const _0x1a82e8=a22_0x14a0ad,{args:_0x1836c9,options:_0x2f291e}=_0x330a4d,_0x577d68=_0x1836c9[0x0],_0x3e7e7b=_0x2f291e[_0x1a82e8(0xb0)];cleanExpiredSessions();if(!profileExists(_0x577d68)){console[_0x1a82e8(0xba)](a22_0x2e6c6b['red']('Profile\x20\x27'+_0x577d68+'\x27\x20does\x20not\x20exist.')),console[_0x1a82e8(0x111)]('\x0aAvailable\x20profiles:');const _0x5d3987=listProfiles();if(_0x5d3987[_0x1a82e8(0xa9)]===0x0)console[_0x1a82e8(0x111)](_0x1a82e8(0x10a));else for(const _0x33f432 of _0x5d3987){console[_0x1a82e8(0x111)](_0x1a82e8(0xce)+_0x33f432[_0x1a82e8(0xd2)]);}return 0x1;}if(_0x3e7e7b){const _0x5ad57d=a22_0x14d041[_0x1a82e8(0x98)](getConfigDir(),_0x1a82e8(0xdd));return saveActiveProfileToUserConfig(_0x577d68),console[_0x1a82e8(0x111)](_0x1a82e8(0xa1)+a22_0x2e6c6b[_0x1a82e8(0x107)](_0x577d68)),console['log'](a22_0x2e6c6b[_0x1a82e8(0xef)](_0x1a82e8(0xa2)+_0x5ad57d)),0x0;}const _0x4dae22=_0x2f291e[_0x1a82e8(0x9b)]||getCurrentSessionPID()[_0x1a82e8(0xbc)]();return saveSessionContext({'profile':_0x577d68},_0x2f291e[_0x1a82e8(0x9b)]),console[_0x1a82e8(0x111)]('Session\x20profile\x20set\x20to:\x20'+a22_0x2e6c6b[_0x1a82e8(0x107)](_0x577d68)+'\x20'+a22_0x2e6c6b[_0x1a82e8(0xef)](_0x1a82e8(0xe8)+_0x4dae22+')')),console[_0x1a82e8(0x111)](a22_0x2e6c6b[_0x1a82e8(0xef)](_0x1a82e8(0xdf)+_0x577d68+_0x1a82e8(0xb3))),0x0;}}
|
|
1
|
+
const a22_0x159ae9=a22_0x2272;(function(_0x5562c1,_0x41cb6a){const _0x293faa=a22_0x2272,_0x5db3c0=_0x5562c1();while(!![]){try{const _0x2405d0=-parseInt(_0x293faa(0xd7))/0x1+-parseInt(_0x293faa(0xd9))/0x2*(-parseInt(_0x293faa(0xf9))/0x3)+-parseInt(_0x293faa(0xf6))/0x4+parseInt(_0x293faa(0xdd))/0x5+-parseInt(_0x293faa(0xea))/0x6+-parseInt(_0x293faa(0x123))/0x7*(parseInt(_0x293faa(0xc9))/0x8)+parseInt(_0x293faa(0x10c))/0x9;if(_0x2405d0===_0x41cb6a)break;else _0x5db3c0['push'](_0x5db3c0['shift']());}catch(_0x122e68){_0x5db3c0['push'](_0x5db3c0['shift']());}}}(a22_0x819f,0x1f6dd));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 a22_0x5c1b19 from'node:path';import{saveSessionContext,getCurrentSessionPID,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{HTTPClientError}from'../sdk/client/http-client.js';function a22_0x819f(){const _0xd1fe73=['push','tdx:\x20profile\x20set','parent_segment','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Operation\x20cancelled','status','Changing\x20site\x20to\x20\x27','config','Enter\x20site\x20name:','toString','3052134uBiBHN','yellow','Profile\x20\x27','trim','description','profile:create','test','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','findIndex','\x20API\x20key\x20removed\x20from\x20system\x20keychain','eu\x20\x20\x20-\x20Europe','ERROR','select','tdx:\x20profile\x20remove','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Session\x20profile\x20set\x20to:\x20','length','\x27\x20does\x20not\x20exist.','includes','name','profile:use','Remove\x20a\x20profile','7TyaGiE','Set\x20session\x20profile','\x20--default\x27\x20to\x20save\x20permanently','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','email','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_project','jobs','error','Enter\x20description\x20(optional):','API\x20key\x20cannot\x20be\x20empty','validate','Set\x20a\x20profile\x20configuration\x20value','Enter\x20profile\x20name:','jp\x20\x20\x20-\x20Japan','(cleared)','profile:remove','\x0aOperation\x20cancelled','VALID_KEYS','Enter\x20custom\x20site','confirm','apiKey','\x0aSetup\x20cancelled','Site\x20name\x20cannot\x20be\x20empty','red','join','1117672TXOeTK','password','text','green','getUserInfo','Validating\x20API\x20key...','(session:\x20','tdx.json','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','create','Profile\x20name\x20cannot\x20be\x20empty','execute','tdx:\x20profile\x20create','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','144536wiOisj','site','2idrUCA','bold','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','warn','960815yuJmyr','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>','\x0aAvailable\x20profiles:','Site\x20was\x20not\x20changed.','customSite','logLevel','profileName','default','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','/app/mp/ak','ap02','message','208428enBtmS','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Unknown\x20key\x20\x27','us01','✗\x20Validation\x20failed:\x20','\x20\x20(no\x20profiles\x20found)','log','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile','split','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','929592bjCDby','\x27\x20removed\x20from\x20configuration','llm_agent','446475kQjufo','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20Profile\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','value','\x27\x20created','\x27\x20updated:\x20'];a22_0x819f=function(){return _0xd1fe73;};return a22_0x819f();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a22_0x68ba84 from'prompts';function a22_0x2272(_0x4197ba,_0x3987e5){_0x4197ba=_0x4197ba-0xb5;const _0x819f3=a22_0x819f();let _0x2272d8=_0x819f3[_0x4197ba];return _0x2272d8;}import a22_0x102c98 from'chalk';function validateProfileName(_0x30fffc){const _0x39a5a8=a22_0x2272;if(!_0x30fffc||!_0x30fffc[_0x39a5a8(0x10f)]())return _0x39a5a8(0xd3);const _0x3676d5=_0x30fffc[_0x39a5a8(0x10f)]();if(!/^[a-zA-Z0-9_-]+$/[_0x39a5a8(0x112)](_0x3676d5))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3676d5))return _0x39a5a8(0x10e)+_0x3676d5+_0x39a5a8(0xfd);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0x159ae9(0x120)]=a22_0x159ae9(0x111);[a22_0x159ae9(0x110)]='Create\x20a\x20new\x20profile';async['execute'](_0x5cc35a){const _0x564e02=a22_0x159ae9,{options:_0x1d4076,args:_0x2ec8f3}=_0x5cc35a;console[_0x564e02(0xf0)](a22_0x102c98[_0x564e02(0xda)](_0x564e02(0xd5)));let _0x2f63d4;if(_0x2ec8f3['length']>0x0&&_0x2ec8f3[0x0]){const _0x1e3b40=_0x2ec8f3[0x0][_0x564e02(0x10f)](),_0x8c72a=validateProfileName(_0x1e3b40);if(_0x8c72a!==!![])return console[_0x564e02(0xb7)](a22_0x102c98[_0x564e02(0xc7)](_0x8c72a)),0x1;_0x2f63d4=_0x1e3b40;}else{const _0x2d1297=await a22_0x68ba84({'type':'text','name':_0x564e02(0xe3),'message':_0x564e02(0xbc),'validate':validateProfileName});if(!_0x2d1297[_0x564e02(0xe3)])return console[_0x564e02(0xf0)](_0x564e02(0xc5)),0x1;_0x2f63d4=_0x2d1297['profileName'][_0x564e02(0x10f)]();}const _0x394b8f=await a22_0x68ba84({'type':_0x564e02(0xcb),'name':_0x564e02(0x110),'message':_0x564e02(0xb8)}),_0x338ec0=_0x394b8f['description']?.[_0x564e02(0x10f)]()||undefined,_0xcec6e4=_0x1d4076[_0x564e02(0xd8)]||_0x564e02(0xed),_0x32a1a4=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x564e02(0xed)},{'title':_0x564e02(0xbd),'value':'jp01'},{'title':_0x564e02(0x117),'value':'eu01'},{'title':'ap02\x20-\x20Korea','value':_0x564e02(0xe8)}];let _0x347336=_0x32a1a4[_0x564e02(0x115)](_0x50d519=>_0x50d519[_0x564e02(0xfe)]===_0xcec6e4);_0x347336===-0x1&&_0xcec6e4!==_0x564e02(0xed)&&(_0x32a1a4[_0x564e02(0x101)]({'title':_0xcec6e4,'value':_0xcec6e4}),_0x347336=_0x32a1a4['length']-0x1);_0x32a1a4[_0x564e02(0x101)]({'title':_0x564e02(0xc2),'value':'other'});const _0x244c6c=await a22_0x68ba84({'type':_0x564e02(0x119),'name':_0x564e02(0xd8),'message':_0x564e02(0xe6)+_0x2f63d4+'\x27:','choices':_0x32a1a4,'initial':_0x347336>=0x0?_0x347336:0x0});if(!_0x244c6c['site'])return console[_0x564e02(0xf0)](_0x564e02(0xc5)),0x1;let _0x45bf94;if(_0x244c6c[_0x564e02(0xd8)]==='other'){const _0x5a2d6a=await a22_0x68ba84({'type':'text','name':_0x564e02(0xe1),'message':_0x564e02(0x10a),'initial':_0x564e02(0xed),'validate':_0x305a45=>{const _0x2fba74=_0x564e02;if(!_0x305a45||!_0x305a45[_0x2fba74(0x10f)]())return _0x2fba74(0xc6);if(!/^[a-z0-9-]+$/['test'](_0x305a45[_0x2fba74(0x10f)]()))return _0x2fba74(0x126);return!![];}});if(!_0x5a2d6a[_0x564e02(0xe1)])return console['log'](_0x564e02(0xc5)),0x1;_0x45bf94=_0x5a2d6a['customSite'];}else _0x45bf94=_0x244c6c[_0x564e02(0xd8)];const _0x373f59=resolveSite(_0x45bf94);console[_0x564e02(0xf0)](_0x564e02(0x105)+_0x373f59),console[_0x564e02(0xf0)](_0x564e02(0x113)),console['log']('\x20\x20'+getConsoleUrl(_0x373f59,_0x564e02(0xe7)));const _0x2cb10d=await a22_0x68ba84({'type':_0x564e02(0xca),'name':_0x564e02(0xc4),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x24d827=>{const _0x1a4ab6=_0x564e02;if(!_0x24d827||!_0x24d827[_0x1a4ab6(0x10f)]())return _0x1a4ab6(0xb9);return!![];}});if(!_0x2cb10d[_0x564e02(0xc4)])return console[_0x564e02(0xf0)]('\x0aSetup\x20cancelled'),0x1;const _0x54524c=_0x2cb10d[_0x564e02(0xc4)];console[_0x564e02(0xf0)](_0x564e02(0xce));try{const _0x1d773f=TDX[_0x564e02(0xd2)]({'site':_0x373f59,'apiKey':_0x54524c[_0x564e02(0x10f)](),'logLevel':_0x1d4076[_0x564e02(0xe2)]??LogLevel[_0x564e02(0x118)]}),_0x5b974d=await _0x1d773f[_0x564e02(0xb6)][_0x564e02(0xcd)]();console[_0x564e02(0xf0)](a22_0x102c98[_0x564e02(0xcc)]('✓')+_0x564e02(0xf1)+_0x5b974d[_0x564e02(0x127)]+')');const _0x5520fe=await isKeychainAvailable();_0x5520fe?(await saveAPIKeyAsync(_0x54524c[_0x564e02(0x10f)](),_0x373f59,_0x2f63d4),console[_0x564e02(0xf0)](a22_0x102c98[_0x564e02(0xcc)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2f63d4+')')):(console[_0x564e02(0xdc)](a22_0x102c98[_0x564e02(0x10d)](_0x564e02(0xe5))),console[_0x564e02(0xdc)](a22_0x102c98['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5554a2={'site':_0x373f59,..._0x338ec0&&{'description':_0x338ec0}};return saveProfileToUserConfig(_0x2f63d4,_0x5554a2),console[_0x564e02(0xf0)](a22_0x102c98[_0x564e02(0xcc)]('✓')+_0x564e02(0xfc)+_0x2f63d4+_0x564e02(0xff)),console[_0x564e02(0xf0)](),console[_0x564e02(0xf0)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x564e02(0xf0)]('\x20\x20tdx\x20--profile\x20'+_0x2f63d4+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log']('\x20\x20tdx\x20--profile\x20'+_0x2f63d4+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x40ea65){if(_0x40ea65 instanceof HTTPClientError&&_0x40ea65[_0x564e02(0x107)]===0x191)return printAuthError(_0x40ea65),0x1;return console[_0x564e02(0xb7)](a22_0x102c98['red']('✗\x20Validation\x20failed:\x20'+(_0x40ea65 instanceof Error?_0x40ea65['message']:String(_0x40ea65)))),console[_0x564e02(0xb7)](_0x564e02(0xeb)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0x159ae9(0x120)]=a22_0x159ae9(0xbf);[a22_0x159ae9(0x110)]=a22_0x159ae9(0x122);['validate'](_0x57890b){const _0x4b4e46=a22_0x159ae9,{args:_0x5856c6}=_0x57890b;if(_0x5856c6[_0x4b4e46(0x11d)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a22_0x159ae9(0xd4)](_0xf76aa9){const _0x58d642=a22_0x159ae9,{args:_0x137930}=_0xf76aa9,_0x3701f6=_0x137930[0x0];console[_0x58d642(0xf0)](a22_0x102c98['bold'](_0x58d642(0x11a)));if(!profileExists(_0x3701f6)){console[_0x58d642(0xb7)](a22_0x102c98[_0x58d642(0xc7)]('Profile\x20\x27'+_0x3701f6+_0x58d642(0x11e))),console[_0x58d642(0xf0)](_0x58d642(0xdf));const _0x50ae0a=listProfiles();if(_0x50ae0a[_0x58d642(0x11d)]===0x0)console[_0x58d642(0xf0)](_0x58d642(0xef));else for(const _0x40c865 of _0x50ae0a){console[_0x58d642(0xf0)]('\x20\x20-\x20'+_0x40c865['name']);}return 0x1;}const _0x49e269=await a22_0x68ba84({'type':_0x58d642(0xc3),'name':_0x58d642(0xc3),'message':_0x58d642(0xd1)+_0x3701f6+'\x27?','initial':![]});if(!_0x49e269[_0x58d642(0xc3)])return console[_0x58d642(0xf0)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x3701f6),console[_0x58d642(0xf0)](a22_0x102c98[_0x58d642(0xcc)]('✓')+'\x20Profile\x20\x27'+_0x3701f6+_0x58d642(0xf7));}catch(_0x227e09){return console[_0x58d642(0xb7)](a22_0x102c98[_0x58d642(0xc7)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x227e09 instanceof Error?_0x227e09[_0x58d642(0xe9)]:String(_0x227e09)))),0x1;}const _0x537fe7=await isKeychainAvailable();if(_0x537fe7){const _0x33f653=await deleteKeychainAPIKey(_0x3701f6);_0x33f653&&console[_0x58d642(0xf0)](a22_0x102c98[_0x58d642(0xcc)]('✓')+_0x58d642(0x116));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x159ae9(0x120)]='profile:set';[a22_0x159ae9(0x110)]=a22_0x159ae9(0xbb);static [a22_0x159ae9(0xc1)]=[a22_0x159ae9(0xd8),'database',a22_0x159ae9(0x103),a22_0x159ae9(0xb5),a22_0x159ae9(0xf8),a22_0x159ae9(0x110)];[a22_0x159ae9(0xba)](_0x2aaefa){const _0x4e17dc=a22_0x159ae9,{args:_0x655818,options:_0x3fd282}=_0x2aaefa,_0x59a2dc=_0x3fd282[_0x4e17dc(0xf2)]||getActiveProfile();if(!_0x59a2dc)return _0x4e17dc(0xde);if(_0x655818[_0x4e17dc(0x11d)]===0x0)return _0x4e17dc(0xf4)+ProfileSetCommand[_0x4e17dc(0xc1)][_0x4e17dc(0xc8)](',\x20');const _0x2b6f17=_0x655818[0x0];if(!_0x2b6f17['includes']('='))return _0x4e17dc(0x11b)+ProfileSetCommand[_0x4e17dc(0xc1)][_0x4e17dc(0xc8)](',\x20');const [_0x447a2e]=_0x2b6f17[_0x4e17dc(0xf3)]('=',0x2);if(!ProfileSetCommand[_0x4e17dc(0xc1)][_0x4e17dc(0x11f)](_0x447a2e))return _0x4e17dc(0xec)+_0x447a2e+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4e17dc(0xc1)][_0x4e17dc(0xc8)](',\x20');return undefined;}async['execute'](_0x1097a3){const _0x24b6b=a22_0x159ae9,{args:_0x1cee69,options:_0x144fa2}=_0x1097a3,_0x26528f=_0x144fa2[_0x24b6b(0xf2)]||getActiveProfile(),[_0x5401be,..._0x52afaa]=_0x1cee69[0x0][_0x24b6b(0xf3)]('='),_0x50d10f=_0x52afaa[_0x24b6b(0xc8)]('=');console['log'](a22_0x102c98[_0x24b6b(0xda)](_0x24b6b(0x102)));if(!profileExists(_0x26528f)){const _0x96d62=await a22_0x68ba84({'type':_0x24b6b(0xc3),'name':'create','message':_0x24b6b(0x10e)+_0x26528f+_0x24b6b(0xfa),'initial':!![]});if(!_0x96d62[_0x24b6b(0xd2)])return console[_0x24b6b(0xf0)](_0x24b6b(0x106)),0x1;}const _0x37a997=loadProfile(_0x26528f),_0x202652=_0x37a997?.[_0x24b6b(0x109)]||{};if(_0x5401be===_0x24b6b(0xd8)){const _0x3506bc=resolveSite(_0x50d10f);console[_0x24b6b(0xf0)](_0x24b6b(0x108)+_0x3506bc+_0x24b6b(0xf5)),console['log'](_0x24b6b(0xd6)),console['log']('\x20\x20'+getConsoleUrl(_0x3506bc,_0x24b6b(0xe7)));const _0x3c26ef=await a22_0x68ba84({'type':_0x24b6b(0xca),'name':_0x24b6b(0xc4),'message':_0x24b6b(0xfb),'validate':_0xdf8bd5=>{const _0x948582=_0x24b6b;if(!_0xdf8bd5||!_0xdf8bd5[_0x948582(0x10f)]())return _0x948582(0xb9);return!![];}});if(!_0x3c26ef[_0x24b6b(0xc4)])return console['log'](_0x24b6b(0xc0)),0x1;console[_0x24b6b(0xf0)](_0x24b6b(0xce));try{const _0x16ddd1=TDX[_0x24b6b(0xd2)]({'site':_0x3506bc,'apiKey':_0x3c26ef[_0x24b6b(0xc4)][_0x24b6b(0x10f)](),'logLevel':_0x144fa2[_0x24b6b(0xe2)]??LogLevel[_0x24b6b(0x118)]}),_0x355574=await _0x16ddd1[_0x24b6b(0xb6)][_0x24b6b(0xcd)]();console[_0x24b6b(0xf0)](a22_0x102c98[_0x24b6b(0xcc)]('✓')+_0x24b6b(0xf1)+_0x355574[_0x24b6b(0x127)]+')');const _0xd8c599=await isKeychainAvailable();_0xd8c599?(await saveAPIKeyAsync(_0x3c26ef[_0x24b6b(0xc4)][_0x24b6b(0x10f)](),_0x3506bc,_0x26528f),console[_0x24b6b(0xf0)](a22_0x102c98[_0x24b6b(0xcc)]('✓')+_0x24b6b(0x128))):console[_0x24b6b(0xdc)](a22_0x102c98['yellow'](_0x24b6b(0xe5))),_0x202652[_0x24b6b(0xd8)]=_0x3506bc;}catch(_0x3319b8){if(_0x3319b8 instanceof HTTPClientError&&_0x3319b8[_0x24b6b(0x107)]===0x191)return printAuthError(_0x3319b8),0x1;return console[_0x24b6b(0xb7)](a22_0x102c98[_0x24b6b(0xc7)](_0x24b6b(0xee)+(_0x3319b8 instanceof Error?_0x3319b8[_0x24b6b(0xe9)]:String(_0x3319b8)))),console['error'](_0x24b6b(0xe0)),0x1;}}else _0x202652[_0x5401be]=_0x50d10f||undefined;return saveProfileToUserConfig(_0x26528f,_0x202652),console[_0x24b6b(0xf0)](a22_0x102c98[_0x24b6b(0xcc)]('✓')+_0x24b6b(0xfc)+_0x26528f+_0x24b6b(0x100)+_0x5401be+'='+(_0x50d10f||_0x24b6b(0xbe))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a22_0x159ae9(0x121);[a22_0x159ae9(0x110)]=a22_0x159ae9(0x124);[a22_0x159ae9(0xba)](_0x2c2d12){const _0x3b813a=a22_0x159ae9,{args:_0x2fc602}=_0x2c2d12;if(_0x2fc602[_0x3b813a(0x11d)]===0x0)return _0x3b813a(0x104);return undefined;}async[a22_0x159ae9(0xd4)](_0xec0cdb){const _0x4a644b=a22_0x159ae9,{args:_0x54350f,options:_0x582dd6}=_0xec0cdb,_0x594bff=_0x54350f[0x0],_0x15f7d2=_0x582dd6[_0x4a644b(0xe4)];cleanExpiredSessions();if(!profileExists(_0x594bff)){console[_0x4a644b(0xb7)](a22_0x102c98['red'](_0x4a644b(0x10e)+_0x594bff+'\x27\x20does\x20not\x20exist.')),console[_0x4a644b(0xf0)]('\x0aAvailable\x20profiles:');const _0x1aa8ee=listProfiles();if(_0x1aa8ee[_0x4a644b(0x11d)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x4df58a of _0x1aa8ee){console['log']('\x20\x20-\x20'+_0x4df58a['name']);}return 0x1;}if(_0x15f7d2){const _0x4de777=a22_0x5c1b19['join'](getConfigDir(),_0x4a644b(0xd0));return saveActiveProfileToUserConfig(_0x594bff),console[_0x4a644b(0xf0)]('Default\x20profile\x20set\x20to:\x20'+a22_0x102c98[_0x4a644b(0xcc)](_0x594bff)),console[_0x4a644b(0xf0)](a22_0x102c98[_0x4a644b(0x114)]('\x0aSaved\x20to:\x20'+_0x4de777)),0x0;}const _0x24d19c=_0x582dd6['session']||getCurrentSessionPID()[_0x4a644b(0x10b)]();return saveSessionContext({'profile':_0x594bff},_0x582dd6['session']),console[_0x4a644b(0xf0)](_0x4a644b(0x11c)+a22_0x102c98[_0x4a644b(0xcc)](_0x594bff)+'\x20'+a22_0x102c98[_0x4a644b(0x114)](_0x4a644b(0xcf)+_0x24d19c+')')),console[_0x4a644b(0xf0)](a22_0x102c98['dim'](_0x4a644b(0xdb)+_0x594bff+_0x4a644b(0x125))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a23_0x1d37(_0x31d2f3,_0x5cbd08){_0x31d2f3=_0x31d2f3-0x73;const _0x317b9d=a23_0x317b();let _0x1d375f=_0x317b9d[_0x31d2f3];return _0x1d375f;}const a23_0x3b6071=a23_0x1d37;(function(_0x1e82ec,_0x39cbeb){const _0x4a3ba1=a23_0x1d37,_0x4a5999=_0x1e82ec();while(!![]){try{const _0x2be955=parseInt(_0x4a3ba1(0x85))/0x1+-parseInt(_0x4a3ba1(0x84))/0x2+-parseInt(_0x4a3ba1(0x88))/0x3*(parseInt(_0x4a3ba1(0x75))/0x4)+parseInt(_0x4a3ba1(0x7d))/0x5+-parseInt(_0x4a3ba1(0x74))/0x6+parseInt(_0x4a3ba1(0x87))/0x7*(-parseInt(_0x4a3ba1(0x86))/0x8)+parseInt(_0x4a3ba1(0x82))/0x9;if(_0x2be955===_0x39cbeb)break;else _0x4a5999['push'](_0x4a5999['shift']());}catch(_0x5e6161){_0x4a5999['push'](_0x4a5999['shift']());}}}(a23_0x317b,0xc4650));import{BaseCommand}from'./command.js';function a23_0x317b(){const _0x11d812=['description','profiles','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','message','execute','2632985bbuaUm','config','error','name','Error:\x20','32156145utJDZf','List\x20all\x20available\x20profiles','1988846XVtFzb','455612NFNhFm','8ZxBMMH','10625783WRbWks','111ndEoPx','length','map','5514546MoYSzG','34508zwQXAQ','\x20\x20Global:\x20~/.config/tdx/tdx.json','log'];a23_0x317b=function(){return _0x11d812;};return a23_0x317b();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0x3b6071(0x80)]=a23_0x3b6071(0x79);[a23_0x3b6071(0x78)]=a23_0x3b6071(0x83);async[a23_0x3b6071(0x7c)](_0x338611){const _0x187bb7=a23_0x3b6071,{options:_0x5c8986}=_0x338611;try{const _0x84cb06=listProfiles(),_0x18fac6=getActiveProfile();if(_0x84cb06[_0x187bb7(0x89)]===0x0)return console[_0x187bb7(0x77)](_0x187bb7(0x7a)),console[_0x187bb7(0x77)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x187bb7(0x76)),0x0;const _0x3e4aa9=_0x84cb06[_0x187bb7(0x73)](_0x6b66ef=>{const _0xb8ec7e=_0x187bb7,_0x88c673=_0x6b66ef[_0xb8ec7e(0x80)]===_0x18fac6,_0x3c6cfa=getProfileParams(_0x6b66ef[_0xb8ec7e(0x7e)]);return{'name':_0x6b66ef['name'],'active':_0x88c673,'scope':_0x6b66ef['scope'],'description':_0x6b66ef[_0xb8ec7e(0x7e)][_0xb8ec7e(0x78)]||'','params':_0x3c6cfa};});return await handleSDKOutput(_0x3e4aa9,_0x5c8986),0x0;}catch(_0x3d3f04){return _0x3d3f04 instanceof Error&&console[_0x187bb7(0x7f)](_0x187bb7(0x81)+_0x3d3f04[_0x187bb7(0x7b)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x12770a=a24_0x2a07;(function(_0xb1b80f,_0x1a11c6){const _0x1bcc0c=a24_0x2a07,_0x548701=_0xb1b80f();while(!![]){try{const _0x4fa622=parseInt(_0x1bcc0c(0x165))/0x1*(-parseInt(_0x1bcc0c(0x178))/0x2)+parseInt(_0x1bcc0c(0x163))/0x3+parseInt(_0x1bcc0c(0x182))/0x4+-parseInt(_0x1bcc0c(0x155))/0x5+-parseInt(_0x1bcc0c(0x161))/0x6+-parseInt(_0x1bcc0c(0x17c))/0x7*(parseInt(_0x1bcc0c(0x15f))/0x8)+-parseInt(_0x1bcc0c(0x176))/0x9*(-parseInt(_0x1bcc0c(0x17b))/0xa);if(_0x4fa622===_0x1a11c6)break;else _0x548701['push'](_0x548701['shift']());}catch(_0x2e46a9){_0x548701['push'](_0x548701['shift']());}}}(a24_0x279b,0xe3b0a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a24_0x2a07(_0xa47ce7,_0x2a6400){_0xa47ce7=_0xa47ce7-0x152;const _0x279bfe=a24_0x279b();let _0x2a071d=_0x279bfe[_0xa47ce7];return _0x2a071d;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a24_0x12770a(0x162);[a24_0x12770a(0x156)]=a24_0x12770a(0x159);async['execute'](_0x3e5029){const _0x443abe=a24_0x12770a,{options:_0x548945,args:_0x37d059,tdx:_0x56476b}=_0x3e5029,_0x8bb793=_0x37d059[0x0],_0x25a7b3=_0x548945[_0x443abe(0x16f)];let _0x3f8b2e;try{if(_0x25a7b3)_0x3f8b2e=readSqlStatementsFromFile(_0x25a7b3);else{if(_0x8bb793==='-')_0x3f8b2e=await readSqlStatementsFromStdin();else{if(_0x8bb793&&isSqlFilePath(_0x8bb793))_0x3f8b2e=readSqlStatementsFromFile(_0x8bb793);else{if(_0x8bb793)_0x3f8b2e=splitSqlStatements(_0x8bb793);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x272770){return console[_0x443abe(0x169)](_0x443abe(0x15a)+_0x272770[_0x443abe(0x157)]),0x1;}const _0x19bb6b=_0x548945[_0x443abe(0x171)]||_0x443abe(0x15d),_0x1eafec=_0x548945[_0x443abe(0x17e)];try{const _0x43c4e7=[],_0x2a8e75=!!_0x548945['output'];for(let _0x17c359=0x0;_0x17c359<_0x3f8b2e[_0x443abe(0x173)];_0x17c359++){const _0xf46077=_0x3f8b2e[_0x17c359],_0x490dca=_0x17c359+0x1,_0x298669=_0x3f8b2e['length'],_0x5ed265=_0x298669>0x1;_0x548945[_0x443abe(0x16c)]&&(console[_0x443abe(0x169)]('\x0a'+(_0x5ed265?'Statement\x20'+_0x490dca+'/'+_0x298669+':':'')),console['error'](_0x443abe(0x15c)+_0x548945[_0x443abe(0x17a)]),console[_0x443abe(0x169)](_0x443abe(0x177)+(_0x1eafec||'td')),console[_0x443abe(0x169)]('Schema:\x20'+_0x19bb6b),console['error'](_0x443abe(0x158)+_0xf46077));const _0x2f80b7=_0x5ed265?'Executing\x20statement\x20'+_0x490dca+'/'+_0x298669+_0x443abe(0x172):_0x443abe(0x16b);try{const _0x493208=await withProgressSpinner(_0x2f80b7,async _0xb5cc28=>{const _0x1be581=_0x443abe,_0x336bd2=await _0x56476b[_0x1be581(0x162)][_0x1be581(0x181)](_0xf46077,{'catalog':_0x1eafec,'schema':_0x19bb6b,'onJobId':_0x4c1027=>{const _0x4b19fe=_0x1be581;_0xb5cc28[_0x4b19fe(0x167)](_0x4c1027);},'onProgress':_0x2cf155=>{const _0x19089=_0x1be581;_0xb5cc28[_0x19089(0x168)](_0x19089(0x16e)+_0x2cf155[_0x19089(0x15e)]+']'),_0xb5cc28[_0x19089(0x17d)](formatRows(_0x2cf155['processedRows'])+_0x19089(0x164)+_0x2cf155['completedSplits']+'/'+_0x2cf155[_0x19089(0x180)]+_0x19089(0x152));}});return _0x336bd2;},{'verbose':_0x548945[_0x443abe(0x16c)]}),_0x3706c8=_0x493208[_0x443abe(0x15b)],_0x539742=_0x3706c8[_0x443abe(0x17f)]?'\x20[Job\x20ID:\x20'+_0x3706c8[_0x443abe(0x17f)]+']':'',_0x445050=_0x5ed265?_0x443abe(0x154)+_0x490dca+'/'+_0x298669+'\x20-\x20':'';console[_0x443abe(0x169)]('✔\x20'+_0x445050+_0x443abe(0x160)+formatRows(_0x3706c8[_0x443abe(0x16d)]['processedRows'])+_0x443abe(0x164)+(_0x443abe(0x16a)+formatElapsed(_0x3706c8[_0x443abe(0x16d)][_0x443abe(0x175)])+_0x539742));if(_0x5ed265&&_0x2a8e75){const _0x4323fc=resolveOutputOptions(_0x548945),_0x3cf510=await formatQueryOutput(_0x3706c8,_0x4323fc);_0x43c4e7[_0x443abe(0x153)](_0x3cf510);}else await handleQueryOutput(_0x3706c8,_0x548945);}catch(_0x41afcb){const _0xe0bf0=_0x5ed265?_0x443abe(0x154)+_0x490dca+'/'+_0x298669+':\x0a':'',_0x3bcd32=_0x41afcb instanceof SDKError?_0x41afcb[_0x443abe(0x179)]:_0x41afcb[_0x443abe(0x157)];return console[_0x443abe(0x169)](''+_0xe0bf0+_0x3bcd32),0x1;}}if(_0x3f8b2e[_0x443abe(0x173)]>0x1&&_0x2a8e75&&_0x43c4e7[_0x443abe(0x173)]>0x0){const _0x528e89=_0x43c4e7[_0x443abe(0x166)]('\x0a');writeFileSync(_0x548945['output'],_0x528e89),console[_0x443abe(0x169)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x548945['output']);}return 0x0;}catch(_0x199012){throw _0x199012;}}[a24_0x12770a(0x174)](_0x54a3b7){const _0x39f5b1=a24_0x12770a,_0x226f4d=_0x54a3b7[_0x39f5b1(0x170)][0x0],_0xf1797d=_0x54a3b7['options'][_0x39f5b1(0x16f)];if(!_0x226f4d&&!_0xf1797d)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x226f4d&&_0xf1797d)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}function a24_0x279b(){const _0x1545b7=['241869ORsIxS','\x20rows\x20','34605WGPSiL','join','setJobId','setPhase','error','in\x20','Executing\x20query...','verbose','stats','Executing\x20query\x20[','file','args','database','...','length','validate','elapsedTimeMillis','837DYeQti','Catalog:\x20','2LDLPnM','originalMessage','site','236490nUkUJc','14bvGBpJ','setExtra','catalog','jobId','totalSplits','execute','5601100TlNyLp','\x20splits','push','Statement\x20','3605790nAabsF','description','message','SQL:\x20','Run\x20Trino\x20queries\x20(streaming)','Error:\x20','data','Site:\x20','information_schema','state','4838512Kdvtwo','Query\x20completed:\x20Processed\x20','4693476CEUxvG','query'];a24_0x279b=function(){return _0x1545b7;};return a24_0x279b();}
|