@treasuredata/tdx 0.25.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-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/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a22_0x59b92d=a22_0xcfb4;(function(_0x59905d,_0x41cebe){const _0x464a46=a22_0xcfb4,_0x209971=_0x59905d();while(!![]){try{const _0x56ea80=parseInt(_0x464a46(0x2b5))/0x1*(-parseInt(_0x464a46(0x2b4))/0x2)+-parseInt(_0x464a46(0x1e9))/0x3+-parseInt(_0x464a46(0x23f))/0x4*(-parseInt(_0x464a46(0x218))/0x5)+-parseInt(_0x464a46(0x224))/0x6*(parseInt(_0x464a46(0x1d7))/0x7)+-parseInt(_0x464a46(0x27d))/0x8+parseInt(_0x464a46(0x2ae))/0x9+parseInt(_0x464a46(0x27b))/0xa;if(_0x56ea80===_0x41cebe)break;else _0x209971['push'](_0x209971['shift']());}catch(_0x5adb69){_0x209971['push'](_0x209971['shift']());}}}(a22_0x2b5a,0x6a4e9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x575f81 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,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x2c7678 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x59b92d(0x21f),LEGACY_PARENT_SEGMENT_DIR=a22_0x59b92d(0x2ce);function openBrowser(_0x4f0a5e){const _0x1d3d2d=a22_0x59b92d,_0x4565e2=process[_0x1d3d2d(0x24c)],_0x1b34ef=_0x4565e2===_0x1d3d2d(0x1cd)?_0x1d3d2d(0x2e9):_0x4565e2===_0x1d3d2d(0x1db)?_0x1d3d2d(0x308):'xdg-open';spawn(_0x1b34ef,[_0x4f0a5e],{'detached':!![],'stdio':_0x1d3d2d(0x25b)})[_0x1d3d2d(0x289)]();}function migrateLegacyDirectory(){const _0x231585=a22_0x59b92d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4c3a87=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4c3a87['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x2f7)](_0x231585(0x212)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x231585(0x28e))),console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x2e3)](_0x231585(0x2e7)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x231585(0x298)](a22_0x2c7678['yellow'](_0x231585(0x2cb)+LEGACY_PARENT_SEGMENT_DIR+_0x231585(0x2b0)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x290)](_0x231585(0x2bb)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x18c5a4){const _0x3efa53=_0x18c5a4 instanceof Error?_0x18c5a4[_0x231585(0x1e6)]:String(_0x18c5a4);return console[_0x231585(0x298)](a22_0x2c7678[_0x231585(0x1f8)](_0x231585(0x1dd)+_0x3efa53+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x59b92d(0x2d6)](_0x395f01){return migrateLegacyDirectory(),super['run'](_0x395f01);}}function resolveYamlFile(_0xd8bc1b){const _0x5420cc=a22_0x59b92d;if(_0xd8bc1b[_0x5420cc(0x252)](_0x5420cc(0x1f1))||_0xd8bc1b[_0x5420cc(0x252)](_0x5420cc(0x2d5)))return _0xd8bc1b;return a22_0x575f81[_0x5420cc(0x271)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd8bc1b)+_0x5420cc(0x1f1));}function formatProgressMessage(_0x3b3c2f){const _0x2c5a0e=a22_0x59b92d,_0x3ac700=_0x3b3c2f['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3ac700){const [,_0x427eef,_0x817fb1,_0x55bf67='']=_0x3ac700;return a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x427eef+':')+'\x20'+_0x817fb1+a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x55bf67);}return a22_0x2c7678[_0x2c5a0e(0x2e3)](_0x3b3c2f);}function showFileNotFoundError(_0x3f5977,_0x3eeda6){const _0xdddaca=a22_0x59b92d;console[_0xdddaca(0x298)](a22_0x2c7678[_0xdddaca(0x1f8)]('Error:\x20File\x20not\x20found:\x20'+_0x3f5977+'\x0a')),console['error'](a22_0x2c7678['cyan'](_0xdddaca(0x1dc)+_0x3eeda6+_0xdddaca(0x226)));}function showParentSegmentNotSetError(_0x49d484){const _0x3e0311=a22_0x59b92d;console[_0x3e0311(0x298)](a22_0x2c7678[_0x3e0311(0x2f7)](_0x3e0311(0x1e8))),console['error'](_0x49d484);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:list';['description']=a22_0x59b92d(0x2e4);async[a22_0x59b92d(0x317)](_0xdc3010){const _0x522c24=a22_0x59b92d,{options:_0x5efd8e,args:_0x456b9a,tdx:_0x8eff6f}=_0xdc3010,_0x3cfde2=_0x456b9a[0x0];_0x5efd8e[_0x522c24(0x1fe)]&&(console[_0x522c24(0x298)](_0x522c24(0x265)+_0x5efd8e[_0x522c24(0x260)]),_0x3cfde2&&console[_0x522c24(0x298)]('Pattern:\x20'+_0x3cfde2));const _0x43d3b1=await withSpinner(_0x3cfde2?_0x522c24(0x295)+_0x3cfde2+'\x27...':_0x522c24(0x25c),()=>_0x8eff6f['segment']['listParents'](),{'verbose':_0x5efd8e[_0x522c24(0x1fe)]});let _0x4bc42d=_0x43d3b1['data'];if(_0x3cfde2){const _0x2bf824=_0x3cfde2[_0x522c24(0x2fb)](/[.+^${}()|[\]\\]/g,_0x522c24(0x2c1))[_0x522c24(0x2fb)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2c8dd2=new RegExp('^'+_0x2bf824+'$','i');_0x4bc42d=_0x4bc42d['filter'](_0x289648=>_0x2c8dd2[_0x522c24(0x256)](_0x289648[_0x522c24(0x21e)][_0x522c24(0x2ff)]));}_0x4bc42d['sort']((_0x1097e0,_0x21f7e8)=>_0x1097e0[_0x522c24(0x21e)][_0x522c24(0x2ff)]['localeCompare'](_0x21f7e8['attributes']['name'])),console[_0x522c24(0x298)]('✔\x20Found\x20'+_0x4bc42d[_0x522c24(0x269)]+_0x522c24(0x2a0)+(_0x4bc42d[_0x522c24(0x269)]!==0x1?'s':''));const _0x1beaf7=_0xce12b8=>{const _0x2b4880=_0x522c24;return getConsoleNextUrl(_0x5efd8e[_0x2b4880(0x260)],_0x2b4880(0x314)+_0xce12b8);};if(_0x5efd8e[_0x522c24(0x21b)]===_0x522c24(0x204)||_0x5efd8e[_0x522c24(0x21b)]===_0x522c24(0x2d2)){const _0x4a19dd=_0x4bc42d[_0x522c24(0x2d0)](_0x35b5d6=>({..._0x35b5d6,'url':_0x1beaf7(_0x35b5d6['id'])}));await handleSDKOutput(_0x4a19dd,_0x5efd8e);}else{if(_0x4bc42d[_0x522c24(0x269)]===0x0)_0x3cfde2?console[_0x522c24(0x1f3)](_0x522c24(0x2ed)+_0x3cfde2):console['log'](_0x522c24(0x222));else for(const _0x4d887b of _0x4bc42d){const _0x15f61d=_0x4d887b[_0x522c24(0x21e)]['population']?a22_0x2c7678[_0x522c24(0x2e3)]('\x20('+formatRows(_0x4d887b[_0x522c24(0x21e)][_0x522c24(0x1d8)])+')'):'',_0x33d31d=hyperlink(_0x4d887b[_0x522c24(0x21e)][_0x522c24(0x2ff)],_0x1beaf7(_0x4d887b['id']));console['log'](_0x522c24(0x2ea)+_0x33d31d+_0x15f61d);}}return 0x0;}}function a22_0xcfb4(_0x9ac7c2,_0x52d742){_0x9ac7c2=_0x9ac7c2-0x1ca;const _0x2b5a92=a22_0x2b5a();let _0xcfb41e=_0x2b5a92[_0x9ac7c2];return _0xcfb41e;}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x201);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x305);async[a22_0x59b92d(0x317)](_0x16da33){const _0x4789f4=a22_0x59b92d,{options:_0x57b3b2,args:_0x12c2c8,tdx:_0x1d112f}=_0x16da33;console[_0x4789f4(0x298)](_0x4789f4(0x1cf)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x4789f4(0x1ef));const _0x148329=_0x57b3b2;if(_0x12c2c8[_0x4789f4(0x269)]===0x0)return console[_0x4789f4(0x298)](a22_0x2c7678[_0x4789f4(0x1f8)](_0x4789f4(0x279))),console[_0x4789f4(0x298)](_0x4789f4(0x1fb)),0x1;const _0x49119d=_0x12c2c8[0x0];if(!_0x148329[_0x4789f4(0x22e)]||!_0x148329[_0x4789f4(0x2a1)])return console[_0x4789f4(0x298)](_0x4789f4(0x273)),console[_0x4789f4(0x298)](_0x4789f4(0x1fb)),0x1;_0x148329['verbose']&&(console['error'](_0x4789f4(0x265)+_0x148329[_0x4789f4(0x260)]),console[_0x4789f4(0x298)](_0x4789f4(0x2ba)+_0x49119d),console['error'](_0x4789f4(0x213)+_0x148329[_0x4789f4(0x22e)]),console[_0x4789f4(0x298)](_0x4789f4(0x211)+_0x148329[_0x4789f4(0x2a1)]));const _0x1ab6ed=await loadJSONFromOptions(_0x148329['attributes'],_0x148329[_0x4789f4(0x1e5)]),_0x200d6b=await loadJSONFromOptions(_0x148329['behaviors'],_0x148329['behaviorsFile']),_0x1eaad4=await loadJSONFromOptions(_0x148329[_0x4789f4(0x2aa)],_0x148329[_0x4789f4(0x2f0)]),_0x290901={'name':_0x49119d,'description':_0x148329[_0x4789f4(0x2de)],'scheduleType':_0x148329['scheduleType'],'scheduleOption':_0x148329[_0x4789f4(0x1e7)],'timezone':_0x148329[_0x4789f4(0x2f1)],'master':{'parentDatabaseName':_0x148329[_0x4789f4(0x22e)],'parentTableName':_0x148329[_0x4789f4(0x2a1)]},'attributes':_0x1ab6ed,'behaviors':_0x200d6b,'customerGroup':_0x1eaad4},_0x522f4a=await withSpinner(_0x4789f4(0x1ca)+_0x49119d+_0x4789f4(0x1df),()=>_0x1d112f[_0x4789f4(0x282)]['createParent'](_0x290901),{'verbose':_0x57b3b2['verbose']}),_0x58c7c6=_0x522f4a[_0x4789f4(0x2fc)];return console['error'](_0x4789f4(0x2e1)+_0x58c7c6['name']+_0x4789f4(0x2d3)+_0x58c7c6['id']),await handleSDKOutput([_0x58c7c6],_0x57b3b2),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:update';[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x2e0);async[a22_0x59b92d(0x317)](_0x41dc7e){const _0x13443f=a22_0x59b92d,{options:_0x5d64ac,args:_0x33a50a,tdx:_0x57e299}=_0x41dc7e;console['error'](_0x13443f(0x267)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x13443f(0x1ef));const _0x4e478f=_0x5d64ac;if(_0x33a50a[_0x13443f(0x269)]===0x0)return console[_0x13443f(0x298)](a22_0x2c7678[_0x13443f(0x1f8)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x13443f(0x298)](_0x13443f(0x1e2)),0x1;const _0x55a21f=_0x33a50a[0x0];_0x4e478f[_0x13443f(0x1fe)]&&(console['error']('Site:\x20'+_0x4e478f[_0x13443f(0x260)]),console['error']('Parent\x20segment:\x20'+_0x55a21f));const _0x451aab=await withSpinner(_0x13443f(0x1f6)+_0x55a21f+_0x13443f(0x1df),()=>_0x57e299[_0x13443f(0x282)][_0x13443f(0x25e)](_0x55a21f),{'verbose':_0x4e478f[_0x13443f(0x1fe)]}),_0x258dff=_0x451aab[_0x13443f(0x2fc)],_0x1da6b8=await loadJSONFromOptions(_0x4e478f['addAttributes'],_0x4e478f[_0x13443f(0x239)]),_0x22fb83=await loadJSONFromOptions(_0x4e478f[_0x13443f(0x253)],_0x4e478f[_0x13443f(0x1d3)]),_0x4d3885={'name':_0x258dff[_0x13443f(0x2ff)],'description':_0x4e478f[_0x13443f(0x2de)]!==undefined?_0x4e478f[_0x13443f(0x2de)]:_0x258dff['description'],'scheduleType':_0x4e478f[_0x13443f(0x27f)]!==undefined?_0x4e478f[_0x13443f(0x27f)]:_0x258dff['scheduleType'],'scheduleOption':_0x4e478f[_0x13443f(0x1e7)]!==undefined?_0x4e478f[_0x13443f(0x1e7)]:_0x258dff[_0x13443f(0x1e7)],'timezone':_0x4e478f[_0x13443f(0x2f1)]!==undefined?_0x4e478f[_0x13443f(0x2f1)]:_0x258dff[_0x13443f(0x2f1)],'master':_0x258dff[_0x13443f(0x287)],'attributes':_0x1da6b8?[..._0x258dff[_0x13443f(0x21e)]||[],..._0x1da6b8]:_0x258dff[_0x13443f(0x21e)],'behaviors':_0x22fb83?[..._0x258dff[_0x13443f(0x2dd)]||[],..._0x22fb83]:_0x258dff[_0x13443f(0x2dd)],'customerGroup':_0x258dff[_0x13443f(0x2aa)]},_0x317d67=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x55a21f+'\x27...',()=>_0x57e299[_0x13443f(0x282)]['updateParent'](_0x55a21f,_0x4d3885),{'verbose':_0x4e478f[_0x13443f(0x1fe)]}),_0x44b142=_0x317d67['data'];return console['error'](_0x13443f(0x291)+_0x44b142[_0x13443f(0x2ff)]+'\x27'),await handleSDKOutput([_0x44b142],_0x4e478f),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';[a22_0x59b92d(0x2de)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x59b92d(0x317)](_0x2406d1){const _0x4a22da=a22_0x59b92d,{options:_0x2023e5,args:_0x282af6,tdx:_0x2b3191}=_0x2406d1,_0x5e64c0=_0x2023e5,_0xeb6d5e=_0x282af6[0x0]||_0x2023e5[_0x4a22da(0x30f)];if(!_0xeb6d5e)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'+_0x4a22da(0x30e)),0x1;if(_0x5e64c0[_0x4a22da(0x286)]&&_0x5e64c0[_0x4a22da(0x225)])return console[_0x4a22da(0x298)](a22_0x2c7678['red'](_0x4a22da(0x2e5))),console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x2e3)](_0x4a22da(0x2e8))),console[_0x4a22da(0x298)](a22_0x2c7678['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4a22da(0x1fd))),console[_0x4a22da(0x298)](a22_0x2c7678['cyan']('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x2e3e60=_0x5e64c0[_0x4a22da(0x225)]||a22_0x575f81[_0x4a22da(0x271)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xeb6d5e)+'.yml');_0x5e64c0[_0x4a22da(0x1fe)]&&(console[_0x4a22da(0x298)](_0x4a22da(0x265)+_0x5e64c0[_0x4a22da(0x260)]),console[_0x4a22da(0x298)](_0x4a22da(0x1cc)+_0xeb6d5e),console['error'](_0x4a22da(0x26c)+_0x2e3e60));const _0x514479=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xeb6d5e+_0x4a22da(0x1df),()=>_0x2b3191[_0x4a22da(0x282)]['pullParentYaml'](_0xeb6d5e),{'verbose':_0x5e64c0[_0x4a22da(0x1fe)]}),_0x338449=_0x514479['data'];if(existsSync(_0x2e3e60)){const _0x3f160b=readFileSync(_0x2e3e60,_0x4a22da(0x25f)),_0x27fee1=generateDiff(_0x3f160b,_0x338449);if(!hasChanges(_0x27fee1))console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x2dc)+a22_0x2c7678[_0x4a22da(0x24b)](_0x2e3e60)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x4a22da(0x298)]('\x0aChanges\x20to\x20\x27'+_0x2e3e60+'\x27:'),console[_0x4a22da(0x298)]('─'[_0x4a22da(0x2d7)](0x3c)),console[_0x4a22da(0x298)](formatDiffWithColors(_0x27fee1)),console['error']('─'[_0x4a22da(0x2d7)](0x3c));if(!_0x5e64c0[_0x4a22da(0x215)]){if(!isInteractive())return console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x1f8)](_0x4a22da(0x1ec)),_0x4a22da(0x23e)),console[_0x4a22da(0x298)](a22_0x2c7678['dim'](_0x4a22da(0x207))),0x1;const _0x56fed7=await confirmKey(_0x4a22da(0x285)+_0x2e3e60+'\x27?');if(!_0x56fed7)return console[_0x4a22da(0x298)](a22_0x2c7678[_0x4a22da(0x2f7)](_0x4a22da(0x216))),0x1;}writeFileSync(_0x2e3e60,_0x338449,'utf-8'),console['error'](a22_0x2c7678['green']('✔')+_0x4a22da(0x2d1)+a22_0x2c7678['cyan'](_0x2e3e60));}}else{const _0x1624f0=a22_0x575f81[_0x4a22da(0x2b9)](_0x2e3e60);!existsSync(_0x1624f0)&&mkdirSync(_0x1624f0,{'recursive':!![]}),writeFileSync(_0x2e3e60,_0x338449,_0x4a22da(0x25f)),console['error'](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x2d1)+a22_0x2c7678[_0x4a22da(0x24b)](_0x2e3e60));}return saveSessionContext({'parent_segment':_0xeb6d5e},_0x5e64c0[_0x4a22da(0x250)]),console['error'](a22_0x2c7678[_0x4a22da(0x290)]('✔')+_0x4a22da(0x28d)+a22_0x2c7678[_0x4a22da(0x2e3)](_0x4a22da(0x2ce))+_0x4a22da(0x230)+a22_0x2c7678[_0x4a22da(0x24b)](_0xeb6d5e)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x2c7);['description']=a22_0x59b92d(0x2ac);async[a22_0x59b92d(0x317)](_0x291c37){const _0x259b16=a22_0x59b92d,{options:_0x3124a8,args:_0x2bda1a,tdx:_0x57fa31}=_0x291c37,_0x5c0fbf=_0x3124a8,_0x55a674=_0x2bda1a[0x0]||_0x3124a8[_0x259b16(0x30f)];if(!_0x55a674)return showParentSegmentNotSetError(_0x259b16(0x221)+_0x259b16(0x266)),0x1;const _0x5f5036=resolveYamlFile(_0x55a674);if(!existsSync(_0x5f5036))return showFileNotFoundError(_0x5f5036,_0x55a674),0x1;_0x5c0fbf[_0x259b16(0x1fe)]&&(console[_0x259b16(0x298)]('Site:\x20'+_0x5c0fbf['site']),console[_0x259b16(0x298)](_0x259b16(0x2a9)+_0x5f5036));let _0x377bb7;try{_0x377bb7=readFileSync(_0x5f5036,_0x259b16(0x25f));}catch(_0x42709f){const _0x76d26e=_0x42709f instanceof Error?_0x42709f[_0x259b16(0x1e6)]:String(_0x42709f);return console[_0x259b16(0x298)](_0x259b16(0x205)+_0x76d26e),0x1;}const _0xe8c159=await withSpinner('Analyzing\x20changes...',()=>_0x57fa31[_0x259b16(0x282)][_0x259b16(0x29e)](_0x377bb7),{'verbose':_0x5c0fbf[_0x259b16(0x1fe)]}),_0x19a5a7=_0xe8c159[_0x259b16(0x2fc)],{isNew:_0x5f3097,name:_0x34e145,hasChanges:_0x1f5019,diffFormatted:_0x476848}=_0x19a5a7;if(!_0x1f5019)return console[_0x259b16(0x298)](_0x259b16(0x2c0)+_0x34e145+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x5f3097?console[_0x259b16(0x298)](_0x259b16(0x231)+_0x34e145+'\x27:'):console[_0x259b16(0x298)](_0x259b16(0x240)+_0x34e145+'\x27:');console[_0x259b16(0x298)]('─'[_0x259b16(0x2d7)](0x3c)),console['error'](_0x476848),console[_0x259b16(0x298)]('─'[_0x259b16(0x2d7)](0x3c));const _0x254629=_0x5f3097?_0x259b16(0x30c)+_0x34e145+'\x27?':_0x259b16(0x1f5)+_0x34e145+'\x27?';if(!_0x5c0fbf[_0x259b16(0x215)]){if(!isInteractive())return console[_0x259b16(0x298)](a22_0x2c7678[_0x259b16(0x1f8)]('\x0aError:'),_0x259b16(0x23e)),console[_0x259b16(0x298)](a22_0x2c7678[_0x259b16(0x2e3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x416865=await confirmKey(_0x254629);if(!_0x416865)return console[_0x259b16(0x298)](a22_0x2c7678['yellow'](_0x259b16(0x216))),0x1;}const _0x82c160=_0x5f3097?'Creating':_0x259b16(0x30d),_0x3810c6=await withSpinner(_0x82c160+_0x259b16(0x246)+_0x34e145+'\x27...',()=>_0x19a5a7[_0x259b16(0x268)](),{'verbose':_0x5c0fbf['verbose']}),_0x4ab191=_0x3810c6[_0x259b16(0x2fc)],_0xccead6=getConsoleNextUrl(_0x5c0fbf[_0x259b16(0x260)],_0x259b16(0x314)+_0x4ab191['id']),_0x4874d2=_0x5f3097?_0x259b16(0x2b7):_0x259b16(0x301);return console['error']('✔\x20'+_0x4874d2+_0x259b16(0x246)+_0x4ab191['name']+'\x27'),console[_0x259b16(0x298)]('\x20\x20'+_0xccead6),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1f2);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x25d);async[a22_0x59b92d(0x317)](_0x228717){const _0x478dea=a22_0x59b92d,{options:_0x6477ab,args:_0x1dee1e,tdx:_0x2062c6}=_0x228717,_0x1674c6=_0x6477ab,_0x8431f6=_0x1dee1e[0x0]||_0x6477ab['parentSegment'];if(!_0x8431f6)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'+_0x478dea(0x1e1)+_0x478dea(0x30b)+_0x478dea(0x234)+_0x478dea(0x300)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1da047=resolveYamlFile(_0x8431f6);if(!existsSync(_0x1da047))return showFileNotFoundError(_0x1da047,_0x8431f6),0x1;_0x1674c6[_0x478dea(0x1fe)]&&(console[_0x478dea(0x298)](_0x478dea(0x265)+_0x1674c6[_0x478dea(0x260)]),console['error']('YAML\x20file:\x20'+_0x1da047));let _0x9a334f;try{_0x9a334f=readFileSync(_0x1da047,_0x478dea(0x25f));}catch(_0x752d01){const _0x31d80d=_0x752d01 instanceof Error?_0x752d01[_0x478dea(0x1e6)]:String(_0x752d01);return console[_0x478dea(0x298)](_0x478dea(0x205)+_0x31d80d),0x1;}const _0x4a5849=createCommandSpinner(a22_0x2c7678[_0x478dea(0x2e3)]('Validating\x20configuration...'),{'verbose':_0x1674c6['verbose']});_0x4a5849['start']();const _0x22a918={'onProgress':_0x17567c=>{_0x4a5849['text']=formatProgressMessage(_0x17567c);}};if(_0x1674c6[_0x478dea(0x287)])_0x22a918[_0x478dea(0x287)]=!![];if(_0x1674c6['enriched'])_0x22a918[_0x478dea(0x1fc)]=!![];_0x1674c6[_0x478dea(0x2f3)]&&(_0x22a918['attribute']=_0x1674c6[_0x478dea(0x2f3)]);_0x1674c6[_0x478dea(0x2df)]&&(_0x22a918[_0x478dea(0x2df)]=_0x1674c6['behavior']);if(_0x1674c6[_0x478dea(0x208)])_0x22a918[_0x478dea(0x208)]=_0x1674c6[_0x478dea(0x208)];let _0x3f676b;try{_0x3f676b=await _0x2062c6[_0x478dea(0x282)][_0x478dea(0x2a7)](_0x9a334f,_0x22a918),_0x4a5849[_0x478dea(0x2eb)]();}catch(_0xe00dc9){_0x4a5849[_0x478dea(0x2eb)]();throw _0xe00dc9;}const _0x39ec2a=_0x1674c6[_0x478dea(0x208)]||'-1d';return this[_0x478dea(0x241)](_0x3f676b,_0x22a918,_0x1da047,_0x39ec2a),_0x3f676b[_0x478dea(0x223)]?0x0:0x1;}[a22_0x59b92d(0x241)](_0x54e965,_0x382c69,_0x51920f,_0x26bb54){const _0x5d4b8c=a22_0x59b92d;console[_0x5d4b8c(0x298)]('\x0a'+a22_0x2c7678[_0x5d4b8c(0x2ab)](_0x5d4b8c(0x302))+'\x20'+_0x54e965[_0x5d4b8c(0x2ff)]),console[_0x5d4b8c(0x298)]('═'[_0x5d4b8c(0x2d7)](0x3c)),this['displayMasterInfo'](_0x54e965);if(typeof _0x382c69[_0x5d4b8c(0x2f3)]===_0x5d4b8c(0x24f)){this[_0x5d4b8c(0x2ec)](_0x54e965),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x2f3),_0x382c69[_0x5d4b8c(0x2f3)]);return;}if(_0x382c69[_0x5d4b8c(0x2f3)]===!![]){this[_0x5d4b8c(0x2ec)](_0x54e965),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,'attributes');return;}if(typeof _0x382c69[_0x5d4b8c(0x2df)]===_0x5d4b8c(0x24f)){this[_0x5d4b8c(0x1f4)](_0x54e965,_0x26bb54),this['displaySummary'](_0x54e965),this['displayPreviewHints'](_0x51920f,_0x26bb54,_0x5d4b8c(0x2df),_0x382c69['behavior']);return;}if(_0x382c69[_0x5d4b8c(0x2df)]===!![]){this['displayBehaviorsStats'](_0x54e965,_0x26bb54),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x2dd));return;}this[_0x5d4b8c(0x2ec)](_0x54e965),this['displayBehaviorsStats'](_0x54e965,_0x26bb54),this[_0x5d4b8c(0x2cf)](_0x54e965),this[_0x5d4b8c(0x1d1)](_0x51920f,_0x26bb54,_0x5d4b8c(0x220));}[a22_0x59b92d(0x1d1)](_0x560f76,_0x3cf710,_0x1b3d5d,_0x3b67f1){const _0x5ea420=a22_0x59b92d;console['error']('\x0a'+a22_0x2c7678[_0x5ea420(0x2e3)]('To\x20view\x20sample\x20data:'));const _0x125cde=_0x3cf710!==_0x5ea420(0x2f9)?_0x5ea420(0x242)+_0x3cf710:'';if(_0x1b3d5d==='attribute'&&_0x3b67f1)console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)]('tdx\x20segment\x20parent\x20preview\x20'+_0x560f76+_0x5ea420(0x235)+_0x3b67f1+'\x22'+_0x125cde));else{if(_0x1b3d5d===_0x5ea420(0x2df)&&_0x3b67f1)console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x2b3)+_0x3b67f1+'\x22'+_0x125cde));else(_0x1b3d5d===_0x5ea420(0x21e)||_0x1b3d5d===_0x5ea420(0x220))&&console['error']('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x274)+_0x125cde));}(_0x1b3d5d===_0x5ea420(0x2dd)||_0x1b3d5d===_0x5ea420(0x220))&&console[_0x5ea420(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ea420(0x2e3)](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x294)+_0x125cde)),_0x1b3d5d==='all'&&console['error']('\x20\x20'+a22_0x2c7678['dim'](_0x5ea420(0x2ef)+_0x560f76+_0x5ea420(0x23a)+_0x125cde));}[a22_0x59b92d(0x297)](_0x1d01dc){const _0x2f6a1b=a22_0x59b92d,{master:_0x2540b1}=_0x1d01dc,_0x286bac=_0x2540b1['schemaValid']?a22_0x2c7678[_0x2f6a1b(0x290)]('✔'):a22_0x2c7678[_0x2f6a1b(0x1f8)]('✘');console[_0x2f6a1b(0x298)]('\x0a'+a22_0x2c7678[_0x2f6a1b(0x2e3)](_0x2f6a1b(0x272))),console['error'](_0x286bac+'\x20'+a22_0x2c7678['bold'](_0x2540b1[_0x2f6a1b(0x22e)]+'.'+_0x2540b1[_0x2f6a1b(0x2a1)])),_0x2540b1[_0x2f6a1b(0x1f9)]?_0x2540b1[_0x2f6a1b(0x2d8)]!==undefined&&console[_0x2f6a1b(0x298)]('\x20\x20'+a22_0x2c7678[_0x2f6a1b(0x2e3)](_0x2f6a1b(0x214))+'\x20'+a22_0x2c7678['cyan'](formatRows(_0x2540b1['rowCount']))):console[_0x2f6a1b(0x298)]('\x20\x20'+a22_0x2c7678[_0x2f6a1b(0x1f8)](_0x2f6a1b(0x28c))+'\x20'+_0x2540b1['schemaError']);}[a22_0x59b92d(0x2ec)](_0x5224fc){const _0x257aa=a22_0x59b92d;if(_0x5224fc[_0x257aa(0x21e)][_0x257aa(0x269)]===0x0)return;console[_0x257aa(0x298)]('\x0a'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x2c9)));for(const _0x17903b of _0x5224fc[_0x257aa(0x21e)]){const _0xe21380=_0x17903b[_0x257aa(0x1f9)]?a22_0x2c7678[_0x257aa(0x290)]('✔'):a22_0x2c7678[_0x257aa(0x1f8)]('✘');let _0x370713='';if(_0x17903b[_0x257aa(0x1f9)]&&_0x17903b[_0x257aa(0x304)]!==undefined&&_0x17903b[_0x257aa(0x2fa)]!==undefined){const _0x4e8ca0=_0x17903b[_0x257aa(0x2fa)][_0x257aa(0x2a8)](0x1),_0x5b9b9d=_0x17903b[_0x257aa(0x2fa)]>=0x50?a22_0x2c7678[_0x257aa(0x290)]:_0x17903b['coveragePercent']>=0x32?a22_0x2c7678['yellow']:a22_0x2c7678[_0x257aa(0x1f8)];_0x370713='\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x210))+'\x20'+_0x5b9b9d(_0x4e8ca0+'%')+'\x20('+formatRows(_0x17903b[_0x257aa(0x304)])+'\x20rows)';}console[_0x257aa(0x298)](_0xe21380+'\x20'+a22_0x2c7678[_0x257aa(0x2ab)](_0x17903b[_0x257aa(0x2ff)])+_0x370713),console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x20b))+'\x20'+a22_0x2c7678['bold'](_0x17903b[_0x257aa(0x22e)]+'.'+_0x17903b['table']));const _0x473295=_0x17903b['joinKey']===_0x17903b['foreignKey']?a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x217))+'\x20'+_0x17903b[_0x257aa(0x29f)]:a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x276))+'\x20'+_0x17903b[_0x257aa(0x29f)]+_0x257aa(0x230)+_0x17903b['foreignKey'];console[_0x257aa(0x298)]('\x20\x20'+_0x473295),console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x2e3)](_0x257aa(0x258))),this[_0x257aa(0x2b6)](_0x17903b[_0x257aa(0x1ce)]),!_0x17903b[_0x257aa(0x1f9)]&&console[_0x257aa(0x298)]('\x20\x20'+a22_0x2c7678[_0x257aa(0x1f8)]('Error:')+'\x20'+_0x17903b[_0x257aa(0x1d5)]);}}[a22_0x59b92d(0x1f4)](_0x227bba,_0x4064ec){const _0x2473a7=a22_0x59b92d;if(_0x227bba[_0x2473a7(0x2dd)][_0x2473a7(0x269)]===0x0)return;console['error']('\x0a'+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x238))+'\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('('+_0x4064ec+')'));for(const _0x27836f of _0x227bba[_0x2473a7(0x2dd)]){const _0x14f5e1=_0x27836f[_0x2473a7(0x1f9)]?a22_0x2c7678[_0x2473a7(0x290)]('✔'):a22_0x2c7678[_0x2473a7(0x1f8)]('✘');let _0x408281='';if(_0x27836f[_0x2473a7(0x1f9)]&&_0x27836f[_0x2473a7(0x27a)]!==undefined&&_0x27836f[_0x2473a7(0x29d)]!==undefined){const _0x254607=_0x27836f['customerPercent']?.[_0x2473a7(0x2a8)](0x1)||'?',_0xf25a5c=(_0x27836f[_0x2473a7(0x1d4)]??0x0)>=0x32?a22_0x2c7678[_0x2473a7(0x290)]:(_0x27836f[_0x2473a7(0x1d4)]??0x0)>=0x14?a22_0x2c7678[_0x2473a7(0x2f7)]:a22_0x2c7678[_0x2473a7(0x1f8)];_0x408281='\x20'+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x2a3))+'\x20'+_0xf25a5c(formatRows(_0x27836f['customersWithEvents']))+'\x20('+_0x254607+_0x2473a7(0x24d)+a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x23d))+'\x20'+a22_0x2c7678[_0x2473a7(0x24b)](formatRows(_0x27836f[_0x2473a7(0x29d)]));}console[_0x2473a7(0x298)](_0x14f5e1+'\x20'+a22_0x2c7678[_0x2473a7(0x2ab)](_0x27836f[_0x2473a7(0x2ff)])+_0x408281),console[_0x2473a7(0x298)]('\x20\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('Source:')+'\x20'+a22_0x2c7678[_0x2473a7(0x2ab)](_0x27836f[_0x2473a7(0x22e)]+'.'+_0x27836f[_0x2473a7(0x2a1)]));const _0x5d4c2f=_0x27836f['joinKey']===_0x27836f[_0x2473a7(0x2f8)]?a22_0x2c7678['dim']('Join\x20on:')+'\x20'+_0x27836f[_0x2473a7(0x29f)]:a22_0x2c7678[_0x2473a7(0x2e3)](_0x2473a7(0x276))+'\x20'+_0x27836f[_0x2473a7(0x29f)]+'\x20=\x20'+_0x27836f[_0x2473a7(0x2f8)];console['error']('\x20\x20'+_0x5d4c2f),console['error']('\x20\x20'+a22_0x2c7678[_0x2473a7(0x2e3)]('Columns:')),this[_0x2473a7(0x2b6)](_0x27836f[_0x2473a7(0x1ce)]),!_0x27836f[_0x2473a7(0x1f9)]&&console[_0x2473a7(0x298)]('\x20\x20'+a22_0x2c7678[_0x2473a7(0x1f8)]('Error:')+'\x20'+_0x27836f[_0x2473a7(0x1d5)]);}}[a22_0x59b92d(0x2b6)](_0x3ad136){const _0x49d5b0=a22_0x59b92d;for(const _0x3abb8e of _0x3ad136){_0x3abb8e[_0x49d5b0(0x1eb)]===_0x3abb8e[_0x49d5b0(0x2bd)]||_0x3abb8e[_0x49d5b0(0x2bd)]==='*'?console[_0x49d5b0(0x298)]('\x20\x20\x20\x20-\x20'+_0x3abb8e['label']):console[_0x49d5b0(0x298)]('\x20\x20\x20\x20-\x20'+_0x3abb8e[_0x49d5b0(0x1eb)]+'\x20'+a22_0x2c7678[_0x49d5b0(0x2e3)]('('+_0x3abb8e[_0x49d5b0(0x2bd)]+')'));}}[a22_0x59b92d(0x2cf)](_0x5a0550){const _0x316d8d=a22_0x59b92d;console['error']('─'[_0x316d8d(0x2d7)](0x3c));if(_0x5a0550[_0x316d8d(0x1ff)][_0x316d8d(0x269)]>0x0){console[_0x316d8d(0x298)]('\x0a'+a22_0x2c7678[_0x316d8d(0x1f8)]('Errors:'));for(const _0x15d2b7 of _0x5a0550[_0x316d8d(0x1ff)]){console[_0x316d8d(0x298)]('\x20\x20'+a22_0x2c7678[_0x316d8d(0x1f8)]('•')+'\x20'+_0x15d2b7);}}_0x5a0550[_0x316d8d(0x223)]&&console['error']('\x0a'+a22_0x2c7678[_0x316d8d(0x290)]('✔')+_0x316d8d(0x1d9));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a22_0x59b92d(0x288);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x284);async[a22_0x59b92d(0x317)](_0x5e2676){const _0x5ced27=a22_0x59b92d,{options:_0x5c1e70,args:_0x459eea,tdx:_0x3e7db1}=_0x5e2676,_0x488aa1=_0x5c1e70,_0x552b85=_0x459eea[0x0]||_0x5c1e70[_0x5ced27(0x30f)];if(!_0x552b85)return showParentSegmentNotSetError(_0x5ced27(0x277)+_0x5ced27(0x21a)+_0x5ced27(0x1d6)+_0x5ced27(0x27e)+_0x5ced27(0x262)+_0x5ced27(0x21c)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5ced27(0x202)),0x1;if(!_0x488aa1['master']&&!_0x488aa1[_0x5ced27(0x2f3)]&&!_0x488aa1[_0x5ced27(0x2df)]&&!_0x488aa1[_0x5ced27(0x1fc)])return console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x307))),console['error'](_0x5ced27(0x20d)),console[_0x5ced27(0x298)](_0x5ced27(0x28f)),console[_0x5ced27(0x298)](_0x5ced27(0x24a)),console[_0x5ced27(0x298)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x5ced27(0x298)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5ced27(0x298)](_0x5ced27(0x228)),0x1;const _0x181231=resolveYamlFile(_0x552b85);if(!existsSync(_0x181231))return showFileNotFoundError(_0x181231,_0x552b85),0x1;_0x488aa1[_0x5ced27(0x1fe)]&&(console['error'](_0x5ced27(0x265)+_0x488aa1[_0x5ced27(0x260)]),console[_0x5ced27(0x298)](_0x5ced27(0x2a9)+_0x181231));let _0x32ffdc;try{_0x32ffdc=readFileSync(_0x181231,_0x5ced27(0x25f));}catch(_0x315d74){const _0x37d35a=_0x315d74 instanceof Error?_0x315d74['message']:String(_0x315d74);return console[_0x5ced27(0x298)](_0x5ced27(0x205)+_0x37d35a),0x1;}let _0x33a69b;try{_0x33a69b=parseDef(_0x32ffdc);}catch(_0x41625c){const _0x49a4df=_0x41625c instanceof Error?_0x41625c['message']:String(_0x41625c);return console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x22c)+_0x49a4df)),0x1;}if(_0x488aa1[_0x5ced27(0x2f3)]===!![]||_0x488aa1['attribute']===''){const _0x595102=_0x33a69b['attributes']?.[_0x5ced27(0x2d0)](_0x3b319a=>_0x3b319a[_0x5ced27(0x2ff)])||[];if(_0x595102['length']===0x0)console[_0x5ced27(0x298)](a22_0x2c7678['red'](_0x5ced27(0x26d)));else{console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x5ced27(0x298)](_0x5ced27(0x26f));for(const _0x18faf1 of _0x595102){console[_0x5ced27(0x298)]('\x20\x20'+a22_0x2c7678['cyan'](_0x18faf1));}console[_0x5ced27(0x298)](_0x5ced27(0x248)+_0x552b85+_0x5ced27(0x235)+_0x595102[0x0]+'\x22');}return 0x1;}if(_0x488aa1['behavior']===!![]||_0x488aa1[_0x5ced27(0x2df)]===''){const _0x2470b9=_0x33a69b['behaviors']?.['map'](_0x1f7e71=>_0x1f7e71[_0x5ced27(0x2ff)])||[];if(_0x2470b9['length']===0x0)console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x1e3)));else{console[_0x5ced27(0x298)](a22_0x2c7678[_0x5ced27(0x1f8)](_0x5ced27(0x1e0))),console[_0x5ced27(0x298)](_0x5ced27(0x2b8));for(const _0x28cc64 of _0x2470b9){console[_0x5ced27(0x298)]('\x20\x20'+a22_0x2c7678[_0x5ced27(0x24b)](_0x28cc64));}console[_0x5ced27(0x298)](_0x5ced27(0x248)+_0x552b85+_0x5ced27(0x2b3)+_0x2470b9[0x0]+'\x22');}return 0x1;}const _0x1405ea=createCommandSpinner(a22_0x2c7678[_0x5ced27(0x2e3)](_0x5ced27(0x2a2)),{'verbose':_0x488aa1[_0x5ced27(0x1fe)]});_0x1405ea[_0x5ced27(0x308)]();const _0x25916f={'onProgress':_0x5c5d26=>{const _0x3a30f9=_0x5ced27;_0x1405ea[_0x3a30f9(0x26b)]=formatProgressMessage(_0x5c5d26);}};if(_0x488aa1[_0x5ced27(0x287)])_0x25916f[_0x5ced27(0x287)]=!![];if(_0x488aa1['attribute']&&typeof _0x488aa1['attribute']===_0x5ced27(0x24f))_0x25916f['attribute']=_0x488aa1[_0x5ced27(0x2f3)];if(_0x488aa1[_0x5ced27(0x2df)]&&typeof _0x488aa1[_0x5ced27(0x2df)]===_0x5ced27(0x24f))_0x25916f[_0x5ced27(0x2df)]=_0x488aa1[_0x5ced27(0x2df)];if(_0x488aa1[_0x5ced27(0x1fc)])_0x25916f['enriched']=!![];if(_0x488aa1[_0x5ced27(0x208)])_0x25916f[_0x5ced27(0x208)]=_0x488aa1[_0x5ced27(0x208)];let _0x5531cf;try{_0x5531cf=await _0x3e7db1[_0x5ced27(0x282)][_0x5ced27(0x29b)](_0x32ffdc,_0x25916f),_0x1405ea['stop']();}catch(_0x113bf7){_0x1405ea[_0x5ced27(0x2eb)]();throw _0x113bf7;}return await this[_0x5ced27(0x261)](_0x5531cf,{'master':_0x488aa1['master'],'attribute':typeof _0x488aa1[_0x5ced27(0x2f3)]===_0x5ced27(0x24f)?_0x488aa1['attribute']:undefined,'behavior':typeof _0x488aa1[_0x5ced27(0x2df)]===_0x5ced27(0x24f)?_0x488aa1['behavior']:undefined,'enriched':_0x488aa1['enriched']}),_0x5531cf[_0x5ced27(0x223)]?0x0:0x1;}async[a22_0x59b92d(0x261)](_0x1a0295,_0x5a14ea){const _0x3b76cc=a22_0x59b92d;console[_0x3b76cc(0x298)]('\x0a'+a22_0x2c7678['bold']('Preview:')+'\x20'+_0x1a0295['name']),console[_0x3b76cc(0x298)]('═'[_0x3b76cc(0x2d7)](0x3c));if(_0x5a14ea[_0x3b76cc(0x287)]&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x23683d=a22_0x2c7678[_0x3b76cc(0x2e3)](_0x3b76cc(0x227))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x1a0295['master'][_0x3b76cc(0x22e)]+'.'+_0x1a0295[_0x3b76cc(0x287)][_0x3b76cc(0x2a1)]);await this[_0x3b76cc(0x2c6)](_0x23683d,_0x1a0295['sampleData']);}else{if(_0x5a14ea[_0x3b76cc(0x2f3)]&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x495149=a22_0x2c7678['dim'](_0x3b76cc(0x2d9))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x5a14ea[_0x3b76cc(0x2f3)]);await this[_0x3b76cc(0x2c6)](_0x495149,_0x1a0295['sampleData']);}else{if(_0x5a14ea[_0x3b76cc(0x2df)]&&_0x1a0295['sampleData']){const _0x3d21bc=a22_0x2c7678[_0x3b76cc(0x2e3)](_0x3b76cc(0x278))+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x5a14ea[_0x3b76cc(0x2df)]);await this[_0x3b76cc(0x2c6)](_0x3d21bc,_0x1a0295[_0x3b76cc(0x1f0)]);}else{if(_0x5a14ea['enriched']&&_0x1a0295[_0x3b76cc(0x1f0)]){const _0x54eb5d=a22_0x2c7678[_0x3b76cc(0x2e3)]('Enriched:')+'\x20'+a22_0x2c7678[_0x3b76cc(0x2ab)](_0x3b76cc(0x281));await this[_0x3b76cc(0x2c6)](_0x54eb5d,_0x1a0295['sampleData']);}else!_0x1a0295[_0x3b76cc(0x1f0)]&&console[_0x3b76cc(0x298)](_0x3b76cc(0x251));}}}if(_0x1a0295['errors']['length']>0x0){console['error']('─'[_0x3b76cc(0x2d7)](0x3c)),console['error']('\x0a'+a22_0x2c7678[_0x3b76cc(0x1f8)]('Errors:'));for(const _0x1d6c87 of _0x1a0295[_0x3b76cc(0x1ff)]){console[_0x3b76cc(0x298)]('\x20\x20'+a22_0x2c7678['red']('•')+'\x20'+_0x1d6c87);}}}async[a22_0x59b92d(0x2c6)](_0x2b801b,_0x1ec48c){const _0x2396d9=a22_0x59b92d;if(_0x1ec48c[_0x2396d9(0x269)]===0x0){console['error']('\x0a'+_0x2b801b),console[_0x2396d9(0x298)](_0x2396d9(0x1d0));return;}console[_0x2396d9(0x298)]('\x0a'+_0x2b801b);const _0x327152=Object['keys'](_0x1ec48c[0x0])[_0x2396d9(0x2d0)](_0x4fd6cf=>({'name':_0x4fd6cf,'type':typeof _0x1ec48c[0x0][_0x4fd6cf]===_0x2396d9(0x2fd)?_0x2396d9(0x296):'varchar'})),_0x2b7ab6={'queryId':'preview','columns':_0x327152,'data':_0x1ec48c,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1ec48c[_0x2396d9(0x269)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x35040e=formatAsTable(_0x2b7ab6,_0x1ec48c[_0x2396d9(0x269)],!![]);await writeOutput(_0x35040e,undefined,_0x2396d9(0x2a1));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a22_0x59b92d(0x303);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x232);async['execute'](_0x3ef879){const _0x4fcffe=a22_0x59b92d,{options:_0xd22d21,args:_0x2419d9,tdx:_0x898b00}=_0x3ef879,_0x295e86=_0xd22d21,_0x5a5a79=_0x2419d9[0x0]||_0xd22d21[_0x4fcffe(0x30f)];if(!_0x5a5a79)return showParentSegmentNotSetError(_0x4fcffe(0x1f7)+_0x4fcffe(0x255)),0x1;const _0x27cded=resolveYamlFile(_0x5a5a79);if(existsSync(_0x27cded)){_0x295e86['verbose']&&console[_0x4fcffe(0x298)](_0x4fcffe(0x259)+_0x27cded);let _0xdda556;try{_0xdda556=readFileSync(_0x27cded,_0x4fcffe(0x25f));}catch(_0x1f5535){const _0x5cbeab=_0x1f5535 instanceof Error?_0x1f5535[_0x4fcffe(0x1e6)]:String(_0x1f5535);return console[_0x4fcffe(0x298)](_0x4fcffe(0x205)+_0x5cbeab),0x1;}const _0x380dd3=await withSpinner('Analyzing\x20changes...',()=>_0x898b00['segment'][_0x4fcffe(0x29e)](_0xdda556),{'verbose':_0x295e86[_0x4fcffe(0x1fe)]}),_0x502f22=_0x380dd3[_0x4fcffe(0x2fc)],{isNew:_0x15472c,name:_0x3521be,hasChanges:_0x237379,diffFormatted:_0x4c21dd}=_0x502f22;if(_0x237379){_0x15472c?console[_0x4fcffe(0x298)](_0x4fcffe(0x231)+_0x3521be+'\x27:'):console[_0x4fcffe(0x298)](_0x4fcffe(0x240)+_0x3521be+'\x27:');console[_0x4fcffe(0x298)]('─'[_0x4fcffe(0x2d7)](0x3c)),console['error'](_0x4c21dd),console[_0x4fcffe(0x298)]('─'['repeat'](0x3c));const _0x5dee96=_0x15472c?_0x4fcffe(0x30c)+_0x3521be+_0x4fcffe(0x2be):_0x4fcffe(0x1f5)+_0x3521be+_0x4fcffe(0x2be);if(!_0x295e86[_0x4fcffe(0x215)]){if(!isInteractive())return console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x1f8)](_0x4fcffe(0x1ec)),_0x4fcffe(0x23e)),console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x2e3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x521b6b=await confirmKey(_0x5dee96);if(!_0x521b6b)return console[_0x4fcffe(0x298)](a22_0x2c7678[_0x4fcffe(0x2f7)]('Aborted.')),0x1;}const _0x3052d5=_0x15472c?'Creating':'Updating';await withSpinner(_0x3052d5+'\x20parent\x20segment\x20\x27'+_0x3521be+_0x4fcffe(0x1df),()=>_0x502f22['apply'](),{'verbose':_0x295e86['verbose']});const _0x4ec596=_0x15472c?_0x4fcffe(0x2b7):_0x4fcffe(0x301);console[_0x4fcffe(0x298)]('✔\x20'+_0x4ec596+'\x20parent\x20segment\x20\x27'+_0x3521be+'\x27');}else console[_0x4fcffe(0x298)]('✔\x20No\x20changes\x20-\x20\x27'+_0x3521be+_0x4fcffe(0x22f));}const _0x13d791=await withSpinner(_0x4fcffe(0x299)+_0x5a5a79+_0x4fcffe(0x1df),()=>_0x898b00[_0x4fcffe(0x282)][_0x4fcffe(0x30a)](_0x5a5a79),{'verbose':_0x295e86['verbose']}),_0x25a50c=_0x13d791[_0x4fcffe(0x2fc)],_0x253a13=getConsoleUrl(_0x295e86[_0x4fcffe(0x260)],'/app/workflows/'+_0x25a50c[_0x4fcffe(0x29a)]+'/sessions/'+_0x25a50c['workflowSessionId']+_0x4fcffe(0x2c4)+_0x25a50c['workflowAttemptId']);return console[_0x4fcffe(0x298)](_0x4fcffe(0x2d4)),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)]('Audience\x20ID:')+'\x20'+_0x25a50c[_0x4fcffe(0x2da)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)]('Status:')+'\x20'+_0x25a50c[_0x4fcffe(0x313)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678[_0x4fcffe(0x2e3)](_0x4fcffe(0x22a))+'\x20'+_0x25a50c[_0x4fcffe(0x29c)]),console[_0x4fcffe(0x298)]('\x20\x20'+a22_0x2c7678['dim'](_0x4fcffe(0x264))+'\x20'+_0x25a50c[_0x4fcffe(0x2cc)]),console[_0x4fcffe(0x298)]('\x20\x20'+_0x253a13),console[_0x4fcffe(0x298)]('\x0a'+a22_0x2c7678[_0x4fcffe(0x2e3)](_0x4fcffe(0x2ca))+'\x20tdx\x20wf\x20attempt\x20'+_0x25a50c['workflowAttemptId']+_0x4fcffe(0x2f2)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]='segment:parent:fields';['description']=a22_0x59b92d(0x20c);async[a22_0x59b92d(0x317)](_0x4a5bd5){const _0x3fb831=a22_0x59b92d,{options:_0x2711c8,args:_0x1f8a9d,tdx:_0x4427b2}=_0x4a5bd5,_0x246ada=_0x1f8a9d[0x0]||_0x2711c8['parentSegment'];if(!_0x246ada)return showParentSegmentNotSetError(_0x3fb831(0x236)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x2711c8[_0x3fb831(0x1fe)]&&(console[_0x3fb831(0x298)]('Site:\x20'+_0x2711c8['site']),console[_0x3fb831(0x298)](_0x3fb831(0x1cc)+_0x246ada));const _0x256be2=await withSpinner(_0x3fb831(0x233)+_0x246ada+_0x3fb831(0x1df),()=>_0x4427b2[_0x3fb831(0x282)]['listFields'](_0x246ada),{'verbose':_0x2711c8[_0x3fb831(0x1fe)]}),_0x135a7e=_0x256be2['data'];console[_0x3fb831(0x298)](_0x3fb831(0x1ea)+_0x135a7e[_0x3fb831(0x269)]+_0x3fb831(0x275)+(_0x135a7e[_0x3fb831(0x269)]!==0x1?'s':''));if(_0x2711c8[_0x3fb831(0x204)]||_0x2711c8[_0x3fb831(0x2d2)])return await handleSDKOutput(_0x135a7e,_0x2711c8),0x0;return displayFieldsHumanReadable(_0x135a7e,_0x246ada),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x59b92d(0x2a4);[a22_0x59b92d(0x2de)]='Show\x20parent\x20segment\x20details';async[a22_0x59b92d(0x317)](_0x293659){const _0x2531be=a22_0x59b92d,{options:_0x23d6e6,args:_0x3c5c7b,tdx:_0x65c1f4}=_0x293659,_0x331327=_0x23d6e6,_0x400025=_0x3c5c7b[0x0]||_0x23d6e6[_0x2531be(0x30f)];if(!_0x400025)return showParentSegmentNotSetError(_0x2531be(0x315)+_0x2531be(0x306)+_0x2531be(0x30b)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x23d6e6[_0x2531be(0x1fe)]&&(console['error']('Site:\x20'+_0x23d6e6[_0x2531be(0x260)]),console[_0x2531be(0x298)](_0x2531be(0x1cc)+_0x400025));const _0x10907b=await withSpinner(_0x2531be(0x27c)+_0x400025+_0x2531be(0x1df),()=>_0x65c1f4[_0x2531be(0x282)][_0x2531be(0x25e)](_0x400025),{'verbose':_0x23d6e6[_0x2531be(0x1fe)]}),_0x4be1d3=_0x10907b[_0x2531be(0x2fc)];if(_0x331327[_0x2531be(0x22d)]){const _0x41851c=getConsoleNextUrl(_0x331327[_0x2531be(0x260)],'/app/dw/parentSegments/'+_0x4be1d3['id']);return console[_0x2531be(0x298)](a22_0x2c7678[_0x2531be(0x290)]('✔')+_0x2531be(0x2bf)+a22_0x2c7678[_0x2531be(0x24b)](_0x41851c)),openBrowser(_0x41851c),0x0;}return await handleSingleObjectOutput(_0x4be1d3,_0x23d6e6),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1e4);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x283);async[a22_0x59b92d(0x317)](_0x46f5db){const _0x2a5b01=a22_0x59b92d,{options:_0x5a4b60,args:_0x55c341,tdx:_0x2c1dd9}=_0x46f5db,_0x261326=_0x5a4b60,_0x38e403=_0x55c341[0x0]||_0x5a4b60[_0x2a5b01(0x30f)];if(!_0x38e403)return showParentSegmentNotSetError(_0x2a5b01(0x28a)+_0x2a5b01(0x26e)+_0x2a5b01(0x30b)+_0x2a5b01(0x2b2)),0x1;_0x5a4b60[_0x2a5b01(0x1fe)]&&(console[_0x2a5b01(0x298)](_0x2a5b01(0x265)+_0x5a4b60[_0x2a5b01(0x260)]),console[_0x2a5b01(0x298)](_0x2a5b01(0x1cc)+_0x38e403));const _0x1a1484=await withSpinner(_0x2a5b01(0x2f4)+_0x38e403+'\x27...',()=>_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x2af)](_0x38e403),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]}),_0x39bfd3=_0x1a1484[_0x2a5b01(0x2fc)],_0x4d5b43=_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x257)](_0x39bfd3);if(_0x261326[_0x2a5b01(0x225)]){const _0x247523=await this[_0x2a5b01(0x293)](_0x46f5db,_0x38e403,_0x39bfd3,_0x4d5b43),_0x3fb6c9=this['formatSchemaJson'](_0x247523);writeFileSync(_0x261326[_0x2a5b01(0x225)],_0x3fb6c9);const _0x594a48=_0x247523[_0x2a5b01(0x20f)]['columns'][_0x2a5b01(0x269)]+_0x247523[_0x2a5b01(0x2dd)][_0x2a5b01(0x219)]((_0x3147e5,_0x3e2836)=>_0x3147e5+_0x3e2836[_0x2a5b01(0x1ce)]['length'],0x0),_0x185723=_0x247523[_0x2a5b01(0x2dd)]['filter'](_0x1de8a5=>_0x1de8a5[_0x2a5b01(0x1ce)][_0x2a5b01(0x269)]===0x0)[_0x2a5b01(0x269)];return console[_0x2a5b01(0x1f3)](_0x2a5b01(0x2bc)+_0x261326[_0x2a5b01(0x225)]),console['log'](_0x2a5b01(0x245)+_0x4d5b43),console[_0x2a5b01(0x1f3)](_0x2a5b01(0x25a)+_0x247523[_0x2a5b01(0x2dd)]['length']+'\x20behaviors'),console[_0x2a5b01(0x1f3)]('\x20\x20Columns:\x20'+_0x594a48+_0x2a5b01(0x23c)),_0x185723>0x0&&console[_0x2a5b01(0x1f3)](_0x2a5b01(0x1cb)+_0x185723+_0x2a5b01(0x247)),0x0;}console['error']('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)]('Output\x20Database:')+'\x20'+a22_0x2c7678['cyan'](_0x4d5b43));const _0x42b8d6=await withSpinner(_0x2a5b01(0x244),()=>_0x2c1dd9[_0x2a5b01(0x282)][_0x2a5b01(0x2b1)](_0x39bfd3),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]});console[_0x2a5b01(0x298)]('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)](_0x2a5b01(0x20f))+'\x20'+a22_0x2c7678['dim']('('+_0x4d5b43+_0x2a5b01(0x263)));const _0x84e72=await executeSchemaQuery(_0x42b8d6[_0x2a5b01(0x2fc)],_0x2c1dd9,_0x5a4b60);await handleQueryOutput(_0x84e72,_0x5a4b60);const _0xc4fd7d=await withSpinner(_0x2a5b01(0x249),()=>_0x2c1dd9['segment'][_0x2a5b01(0x2ad)](_0x39bfd3),{'verbose':_0x5a4b60[_0x2a5b01(0x1fe)]});for(const _0x18918f of _0xc4fd7d['data']){const _0x3efb9e=_0x2a5b01(0x292)+_0x18918f['toLowerCase']()[_0x2a5b01(0x2fb)](/\s+/g,'_'),_0x47b371=_0x2a5b01(0x1ed)+_0x4d5b43+'.'+_0x3efb9e;console[_0x2a5b01(0x298)]('\x0a'+a22_0x2c7678[_0x2a5b01(0x2ab)](_0x18918f)+'\x20'+a22_0x2c7678[_0x2a5b01(0x2e3)]('('+_0x4d5b43+'.'+_0x3efb9e+')'));try{const _0x138102=await executeSchemaQuery(_0x47b371,_0x2c1dd9,_0x5a4b60);await handleQueryOutput(_0x138102,_0x5a4b60);}catch{console[_0x2a5b01(0x298)](a22_0x2c7678[_0x2a5b01(0x2f7)](_0x2a5b01(0x203)));}}return 0x0;}async[a22_0x59b92d(0x293)](_0x273ed7,_0x3092c0,_0x5dd399,_0x518539){const _0x4e0ef0=a22_0x59b92d,{options:_0x8286d9,tdx:_0x3c59cb}=_0x273ed7,_0x55d72f=await withSpinner(_0x4e0ef0(0x244),()=>_0x3c59cb[_0x4e0ef0(0x282)][_0x4e0ef0(0x2b1)](_0x5dd399),{'verbose':_0x8286d9['verbose']}),_0x5010c7=await executeSchemaQuery(_0x55d72f[_0x4e0ef0(0x2fc)],_0x3c59cb,_0x8286d9),_0x5ae401=_0x5010c7[_0x4e0ef0(0x2fc)][_0x4e0ef0(0x2d0)](_0x14a3cc=>({'name':_0x14a3cc[_0x4e0ef0(0x318)],'type':_0x14a3cc[_0x4e0ef0(0x1d2)]})),_0x427d03=await withSpinner(_0x4e0ef0(0x249),()=>_0x3c59cb[_0x4e0ef0(0x282)][_0x4e0ef0(0x2ad)](_0x5dd399),{'verbose':_0x8286d9[_0x4e0ef0(0x1fe)]}),_0x3b76aa=[];for(const _0x43460e of _0x427d03[_0x4e0ef0(0x2fc)]){const _0x183dd7=_0x4e0ef0(0x292)+_0x43460e['toLowerCase']()[_0x4e0ef0(0x2fb)](/\s+/g,'_'),_0xd8f374=_0x4e0ef0(0x1ed)+_0x518539+'.'+_0x183dd7;let _0x2bcc40=[];try{const _0x597b97=await executeSchemaQuery(_0xd8f374,_0x3c59cb,_0x8286d9);_0x2bcc40=_0x597b97[_0x4e0ef0(0x2fc)][_0x4e0ef0(0x2d0)](_0x1f4014=>({'name':_0x1f4014[_0x4e0ef0(0x318)],'type':_0x1f4014['column_type']}));}catch{}_0x3b76aa[_0x4e0ef0(0x1da)]({'table':_0x183dd7,'columns':_0x2bcc40});}return{'database':_0x518539,'parent_segment':_0x3092c0,'parent_id':_0x5dd399,'customers':{'table':_0x4e0ef0(0x20f),'columns':_0x5ae401},'behaviors':_0x3b76aa};}['formatSchemaJson'](_0x305182){const _0x3538b=a22_0x59b92d,_0x179756=_0x5de2fc=>{const _0x2531de=a22_0xcfb4;if(_0x5de2fc[_0x2531de(0x269)]===0x0)return'[]';const _0x3291e5=_0x5de2fc['map'](_0x3365c2=>_0x2531de(0x312)+_0x3365c2[_0x2531de(0x2ff)]+_0x2531de(0x2db)+_0x3365c2[_0x2531de(0x28b)]+_0x2531de(0x2c2));return'[\x0a'+_0x3291e5[_0x2531de(0x271)](',\x0a')+_0x2531de(0x316);},_0xf9ee1e=_0x305182[_0x3538b(0x2dd)]['map'](_0x7d3d74=>{const _0x47a26d=_0x3538b;return _0x47a26d(0x200)+_0x7d3d74[_0x47a26d(0x2a1)]+_0x47a26d(0x23b)+_0x179756(_0x7d3d74[_0x47a26d(0x1ce)])['replace'](/^/gm,'\x20\x20')[_0x47a26d(0x229)]()+_0x47a26d(0x1fa);})[_0x3538b(0x271)](',\x0a');return _0x3538b(0x270)+_0x305182[_0x3538b(0x22e)]+_0x3538b(0x2f5)+_0x305182[_0x3538b(0x2ce)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x305182['parent_id']+_0x3538b(0x2fe)+_0x305182['customers']['table']+_0x3538b(0x243)+_0x179756(_0x305182[_0x3538b(0x20f)]['columns'])[_0x3538b(0x2fb)](/^/gm,'\x20\x20')[_0x3538b(0x229)]()+_0x3538b(0x2c8)+_0xf9ee1e+_0x3538b(0x209);}}function a22_0x2b5a(){const _0x50abac=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:desc','attributesFile','message','scheduleOption','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','279045wiKDdV','✔\x20Found\x20','label','\x0aError:','SELECT\x20*\x20FROM\x20','segment:parent:show','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','sampleData','.yml','segment:parent:validate','log','displayBehaviorsStats','Apply\x20changes\x20to\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','red','schemaValid','\x0a\x20\x20\x20\x20}','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','enriched','/{name}.yml\x0a','verbose','errors','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','segment:parent:create','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','json','Error\x20reading\x20file:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','interval','\x0a\x20\x20]\x0a}\x0a','processedRows','Source:','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','limit','customers','Coverage:','Table:\x20','\x0a⚠️\x20\x20Both\x20','Database:\x20','Rows:','yes','Aborted.','Join\x20on:','278835NPHJfW','reduce','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','format','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','attributes','parent_segments','all','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','No\x20parent\x20segments\x20found','allValid','3875694jNzsCf','output','`\x20to\x20download\x20the\x20configuration\x20first','Master:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','trim','Session:','query','Error\x20parsing\x20YAML:\x20','web','database','\x27\x20is\x20up\x20to\x20date','\x20=\x20','\x0aNew\x20parent\x20segment\x20\x27','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Listing\x20fields\x20for\x20\x27','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20--attribute\x20\x22','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Behaviors','addAttributesFile','\x20--enriched','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20total','Events:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','8LoSXHF','\x0aChanges\x20to\x20apply\x20to\x20\x27','displayValidateResults','\x20--interval\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Fetching\x20customers\x20schema...','\x20\x20Database:\x20','\x20parent\x20segment\x20\x27','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Fetching\x20behavior\x20list...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','cyan','platform','%)\x20','stats','string','session','\x0aNo\x20sample\x20data\x20available','endsWith','addBehaviors','\x20[Job\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','test','getOutputDatabaseName','Columns:','Found\x20YAML\x20file:\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','ignore','Listing\x20parent\x20segments...','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','getParentFull','utf-8','site','displayPreviewResults','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','.customers)','Attempt:','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','apply','length','in\x20','text','Output\x20file:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','Available\x20attributes:','{\x0a\x20\x20\x22database\x22:\x20\x22','join','Master\x20Table','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20--attribute\x20\x22<name>\x22','\x20field','Join:','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Behavior:','Error:\x20Parent\x20segment\x20name\x20is\x20required','customersWithEvents','15711620AxtXUy','Fetching\x20parent\x20segment\x20\x27','4097824TNzfxj','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','scheduleType','segment:parent:sql','Master\x20+\x20Attributes','segment','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Overwrite\x20\x27','use','master','segment:parent:preview','unref','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','type','Error:','\x20Context\x20set:\x20','/\x20directories\x20exist.','Options:','green','✔\x20Updated\x20parent\x20segment\x20\x27','behavior_','collectSchema','\x20--behavior\x20\x22<name>\x22','Listing\x20parent\x20segments\x20matching\x20\x27','double','displayMasterInfo','error','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','workflowId','previewParentYaml','workflowSessionId','totalEvents','pushParentYaml','joinKey','\x20parent\x20segment','table','Fetching\x20sample\x20data...','Customers:','segment:parent:view','toLocaleString','Fetching\x20SQL\x20for\x20\x27','validateParentYaml','toFixed','YAML\x20file:\x20','customerGroup','bold','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','getBehaviorNames','5078619kqjuwE','resolveParentId','/\x20→\x20','getParentSQL','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20--behavior\x20\x22','2QRtpwN','560362apQRAW','displayColumns','Created','Available\x20behaviors:','dirname','Name:\x20','✔\x20Renamed\x20directory\x20to\x20','Schema\x20saved\x20to\x20','column','\x27\x20and\x20run\x20workflow?','\x20Opening\x20','✔\x20No\x20changes\x20-\x20\x27','\x5c$&','\x22\x20}','information_schema','/attempt/','jobId','displaySampleData','segment:parent:push','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Attributes','To\x20cancel:','\x0a⚠️\x20\x20Migrating:\x20','workflowAttemptId','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','parent_segment','displaySummary','map','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','jsonl','\x27\x20with\x20ID:\x20','\x0a✔\x20Workflow\x20started','.yaml','run','repeat','rowCount','Attribute:','audienceId','\x22,\x20\x22type\x22:\x20\x22','\x20No\x20changes\x20-\x20','behaviors','description','behavior','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','✔\x20Created\x20parent\x20segment\x20\x27','\x20rows\x20','dim','List\x20parent\x20segments','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','SQL\x20query:\x0a','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','open','👥\x20','stop','displayAttributesStats','No\x20parent\x20segments\x20match\x20pattern:\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','tdx\x20segment\x20parent\x20preview\x20','customerGroupFile','timezone','\x20kill','attribute','Resolving\x20parent\x20segment\x20\x27','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','yellow','foreignKey','-1d','coveragePercent','replace','data','number','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','name','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Updated','Validate:','segment:parent:run','matchedCount','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','start','elapsedTimeMillis','runParent','Options:\x0a','Create\x20parent\x20segment\x20\x27','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','parentSegment','setJobId','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','status','/app/dw/parentSegments/','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x0a\x20\x20\x20\x20]','execute','column_name','Creating\x20parent\x20segment\x20\x27','\x20\x20Note:\x20','Parent\x20segment:\x20','darwin','columns','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20No\x20sample\x20data\x20available','displayPreviewHints','column_type','addBehaviorsFile','customerPercent','schemaError','Options\x20(one\x20required):\x0a','7wTbuwd','population','\x20Configuration\x20is\x20valid','push','win32','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x27...','Error:\x20--behavior\x20requires\x20a\x20name\x0a'];a22_0x2b5a=function(){return _0x50abac;};return a22_0x2b5a();}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x280);['description']=a22_0x59b92d(0x21d);async[a22_0x59b92d(0x317)](_0x3bc41a){const _0x208451=a22_0x59b92d,{options:_0x19b1e3,args:_0x1194e0,tdx:_0x393172}=_0x3bc41a,_0x558b59=_0x1194e0[0x0]||_0x19b1e3[_0x208451(0x30f)];if(!_0x558b59)return showParentSegmentNotSetError(_0x208451(0x2cd)+_0x208451(0x2ee)),0x1;_0x19b1e3[_0x208451(0x1fe)]&&(console['error'](_0x208451(0x265)+_0x19b1e3['site']),console[_0x208451(0x298)](_0x208451(0x1cc)+_0x558b59));const _0x5677c5=await withSpinner(_0x208451(0x2f4)+_0x558b59+_0x208451(0x1df),()=>_0x393172[_0x208451(0x282)][_0x208451(0x2af)](_0x558b59),{'verbose':_0x19b1e3['verbose']}),_0x5cb5ef=_0x5677c5['data'],_0x145781=await withSpinner(_0x208451(0x2a6)+_0x558b59+'\x27...',()=>_0x393172[_0x208451(0x282)]['getParentSQL'](_0x5cb5ef),{'verbose':_0x19b1e3[_0x208451(0x1fe)]}),_0x5e4a23=_0x145781[_0x208451(0x2fc)];return _0x19b1e3[_0x208451(0x21b)]===_0x208451(0x204)||_0x19b1e3[_0x208451(0x21b)]===_0x208451(0x2d2)?await handleSDKOutput([{'sql':_0x5e4a23}],_0x19b1e3):console[_0x208451(0x1f3)](_0x5e4a23),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x59b92d(0x2ff)]=a22_0x59b92d(0x1ee);[a22_0x59b92d(0x2de)]=a22_0x59b92d(0x2f6);async[a22_0x59b92d(0x317)](_0x323de6){const _0x2094b6=a22_0x59b92d,{options:_0x4fbe98,args:_0x4e667e,tdx:_0xa2c78f}=_0x323de6,_0x442427=_0x4e667e[0x0]||_0x4fbe98[_0x2094b6(0x30f)];if(!_0x442427)return showParentSegmentNotSetError(_0x2094b6(0x206)+_0x2094b6(0x237)),0x1;_0x4fbe98[_0x2094b6(0x1fe)]&&(console[_0x2094b6(0x298)](_0x2094b6(0x265)+_0x4fbe98['site']),console[_0x2094b6(0x298)](_0x2094b6(0x1cc)+_0x442427));const _0x30695e=await withSpinner(_0x2094b6(0x2f4)+_0x442427+_0x2094b6(0x1df),()=>_0xa2c78f[_0x2094b6(0x282)][_0x2094b6(0x2af)](_0x442427),{'verbose':_0x4fbe98[_0x2094b6(0x1fe)]}),_0x1cea3b=_0x30695e['data'],_0x432498=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x442427+_0x2094b6(0x1df),()=>_0xa2c78f[_0x2094b6(0x282)]['getParentSQL'](_0x1cea3b),{'verbose':_0x4fbe98['verbose']});let _0x4c3c87=_0x432498[_0x2094b6(0x2fc)];const _0x468ca8=resolveLimit(_0x4fbe98[_0x2094b6(0x20e)],DEFAULT_DISPLAY_LIMIT),_0x3d5f4a=/\bLIMIT\s+\d+/i[_0x2094b6(0x256)](_0x4c3c87);!_0x3d5f4a&&(_0x4c3c87=_0x4c3c87[_0x2094b6(0x229)]()[_0x2094b6(0x2fb)](/;+$/,''),_0x4c3c87='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c3c87+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x468ca8);_0x4fbe98[_0x2094b6(0x1fe)]&&console['error'](_0x2094b6(0x2e6)+_0x4c3c87);const _0x359c95=await withProgressSpinner(_0x2094b6(0x311),async _0x2f874d=>{const _0x286182=_0x2094b6,_0x4ff53d=await _0xa2c78f[_0x286182(0x22b)][_0x286182(0x317)](_0x4c3c87,{'catalog':'td','schema':_0x286182(0x2c3),'onJobId':_0x32677b=>{const _0x18fbf3=_0x286182;_0x2f874d[_0x18fbf3(0x310)](_0x32677b);}});return _0x4ff53d;},{'verbose':_0x4fbe98[_0x2094b6(0x1fe)]}),_0x52f34a=_0x359c95[_0x2094b6(0x2fc)],_0x52bc0f=_0x52f34a[_0x2094b6(0x2c5)]?_0x2094b6(0x254)+_0x52f34a[_0x2094b6(0x2c5)]+']':'';return console['error'](_0x2094b6(0x1de)+_0x52f34a[_0x2094b6(0x24e)][_0x2094b6(0x20a)][_0x2094b6(0x2a5)]()+_0x2094b6(0x2e2)+(_0x2094b6(0x26a)+formatElapsed(_0x52f34a[_0x2094b6(0x24e)][_0x2094b6(0x309)])+_0x52bc0f)),await handleQueryOutput(_0x52f34a,_0x4fbe98),0x0;}}
|
|
1
|
+
const a22_0x14fbc1=a22_0x4d49;(function(_0x5db621,_0xe2bce9){const _0x307904=a22_0x4d49,_0x63a476=_0x5db621();while(!![]){try{const _0x446659=parseInt(_0x307904(0xe5))/0x1*(-parseInt(_0x307904(0xbc))/0x2)+parseInt(_0x307904(0x1da))/0x3*(parseInt(_0x307904(0xe0))/0x4)+parseInt(_0x307904(0x15d))/0x5*(parseInt(_0x307904(0xa4))/0x6)+parseInt(_0x307904(0x101))/0x7+parseInt(_0x307904(0xfa))/0x8+parseInt(_0x307904(0xa3))/0x9+parseInt(_0x307904(0x15f))/0xa*(-parseInt(_0x307904(0x1c3))/0xb);if(_0x446659===_0xe2bce9)break;else _0x63a476['push'](_0x63a476['shift']());}catch(_0x5befc0){_0x63a476['push'](_0x63a476['shift']());}}}(a22_0xca5d,0xa1fc6));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x316a68 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';function a22_0x4d49(_0xc1d108,_0x43ad8e){_0xc1d108=_0xc1d108-0x85;const _0xca5d82=a22_0xca5d();let _0x4d49ea=_0xca5d82[_0xc1d108];return _0x4d49ea;}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,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x36914f from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x14fbc1(0x1b5),LEGACY_PARENT_SEGMENT_DIR=a22_0x14fbc1(0xe7);function openBrowser(_0x43a943){const _0x4220ff=a22_0x14fbc1,_0x106a0b=process['platform'],_0x53113e=_0x106a0b===_0x4220ff(0x125)?'open':_0x106a0b===_0x4220ff(0x1b1)?_0x4220ff(0x1bd):'xdg-open';spawn(_0x53113e,[_0x43a943],{'detached':!![],'stdio':_0x4220ff(0xde)})[_0x4220ff(0x1b4)]();}function migrateLegacyDirectory(){const _0x3fa273=a22_0x14fbc1;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4ffe79=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4ffe79[_0x3fa273(0x15c)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3fa273(0x11d)](a22_0x36914f['yellow'](_0x3fa273(0xa8)+LEGACY_PARENT_SEGMENT_DIR+_0x3fa273(0xd0)+PARENT_SEGMENT_DIR+_0x3fa273(0x17c))),console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0x198)](_0x3fa273(0x1b7)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x36914f[_0x3fa273(0xdf)](_0x3fa273(0x1cf)+LEGACY_PARENT_SEGMENT_DIR+_0x3fa273(0x1a7)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0x1d2)](_0x3fa273(0xce)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x5ad24a){const _0x554603=_0x5ad24a instanceof Error?_0x5ad24a[_0x3fa273(0x149)]:String(_0x5ad24a);return console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0xb9)](_0x3fa273(0x1d0)+_0x554603+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x14fbc1(0x96)](_0xcd6b7){const _0x56868f=a22_0x14fbc1;return migrateLegacyDirectory(),super[_0x56868f(0x96)](_0xcd6b7);}}function resolveYamlFile(_0x1a6ee5){const _0x4f2c31=a22_0x14fbc1;if(_0x1a6ee5[_0x4f2c31(0x97)](_0x4f2c31(0x13a))||_0x1a6ee5[_0x4f2c31(0x97)](_0x4f2c31(0x188)))return _0x1a6ee5;return a22_0x316a68['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a6ee5)+_0x4f2c31(0x13a));}function formatProgressMessage(_0x18b0a1){const _0x366bc0=a22_0x14fbc1,_0x2a908d=_0x18b0a1['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2a908d){const [,_0x1bce59,_0x3b6ee6,_0x2680aa='']=_0x2a908d;return a22_0x36914f[_0x366bc0(0x198)](_0x1bce59+':')+'\x20'+_0x3b6ee6+a22_0x36914f['dim'](_0x2680aa);}return a22_0x36914f['dim'](_0x18b0a1);}function showFileNotFoundError(_0x3fa922,_0x44cfc6){const _0x10e84a=a22_0x14fbc1;console['error'](a22_0x36914f[_0x10e84a(0xb9)](_0x10e84a(0x90)+_0x3fa922+'\x0a')),console[_0x10e84a(0x11d)](a22_0x36914f['cyan'](_0x10e84a(0xa9)+_0x44cfc6+_0x10e84a(0x10a)));}function showParentSegmentNotSetError(_0x22f8b9){const _0x520041=a22_0x14fbc1;console['error'](a22_0x36914f[_0x520041(0xdf)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x520041(0x11d)](_0x22f8b9);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x14fbc1(0x15e);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0xa7);async['execute'](_0x473637){const _0x2f0805=a22_0x14fbc1,{options:_0xe315eb,args:_0x125e09,tdx:_0x32b959}=_0x473637,_0x25dd30=_0x125e09[0x0];_0xe315eb[_0x2f0805(0xed)]&&(console[_0x2f0805(0x11d)](_0x2f0805(0xb1)+_0xe315eb[_0x2f0805(0x18f)]),_0x25dd30&&console[_0x2f0805(0x11d)]('Pattern:\x20'+_0x25dd30));const _0x5682e4=await withSpinner(_0x25dd30?_0x2f0805(0x123)+_0x25dd30+_0x2f0805(0x13b):_0x2f0805(0x190),()=>_0x32b959[_0x2f0805(0x8e)]['listParents'](),{'verbose':_0xe315eb[_0x2f0805(0xed)]});let _0x181d8c=_0x5682e4['data'];if(_0x25dd30){const _0x16af92=_0x25dd30[_0x2f0805(0x189)](/[.+^${}()|[\]\\]/g,_0x2f0805(0x108))[_0x2f0805(0x189)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4b70fc=new RegExp('^'+_0x16af92+'$','i');_0x181d8c=_0x181d8c[_0x2f0805(0xfe)](_0x259645=>_0x4b70fc[_0x2f0805(0x170)](_0x259645[_0x2f0805(0x187)][_0x2f0805(0xb6)]));}_0x181d8c[_0x2f0805(0x8a)]((_0x2b60dd,_0x1bd3fc)=>_0x2b60dd[_0x2f0805(0x187)][_0x2f0805(0xb6)][_0x2f0805(0xc6)](_0x1bd3fc[_0x2f0805(0x187)][_0x2f0805(0xb6)])),console['error'](_0x2f0805(0x1c5)+_0x181d8c[_0x2f0805(0x155)]+_0x2f0805(0x17e)+(_0x181d8c[_0x2f0805(0x155)]!==0x1?'s':''));const _0x1f6669=_0x1fd332=>{const _0x55f329=_0x2f0805;return getConsoleNextUrl(_0xe315eb[_0x55f329(0x18f)],_0x55f329(0x199)+_0x1fd332);};if(_0xe315eb[_0x2f0805(0x147)]==='json'||_0xe315eb[_0x2f0805(0x147)]==='jsonl'){const _0x126e85=_0x181d8c[_0x2f0805(0x106)](_0x1e0d41=>({..._0x1e0d41,'url':_0x1f6669(_0x1e0d41['id'])}));await handleSDKOutput(_0x126e85,_0xe315eb);}else{if(_0x181d8c[_0x2f0805(0x155)]===0x0)_0x25dd30?console['log'](_0x2f0805(0x138)+_0x25dd30):console[_0x2f0805(0xc3)](_0x2f0805(0x169));else for(const _0x4b4e6a of _0x181d8c){const _0x1b3cf5=_0x4b4e6a[_0x2f0805(0x187)][_0x2f0805(0x1e3)]?a22_0x36914f['dim']('\x20('+formatRows(_0x4b4e6a[_0x2f0805(0x187)]['population'])+')'):'',_0x516506=hyperlink(_0x4b4e6a['attributes'][_0x2f0805(0xb6)],_0x1f6669(_0x4b4e6a['id']));console['log'](_0x2f0805(0x111)+_0x516506+_0x1b3cf5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x11b);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x182);async[a22_0x14fbc1(0x142)](_0x367c66){const _0x202517=a22_0x14fbc1,{options:_0x5b0fbf,args:_0x347698,tdx:_0x4f3bab}=_0x367c66;console[_0x202517(0x11d)](_0x202517(0x129)+_0x202517(0x1d6)+_0x202517(0xb3));const _0x5ed480=_0x5b0fbf;if(_0x347698[_0x202517(0x155)]===0x0)return console['error'](a22_0x36914f[_0x202517(0xb9)](_0x202517(0xac))),console[_0x202517(0x11d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2f94a3=_0x347698[0x0];if(!_0x5ed480[_0x202517(0xb8)]||!_0x5ed480[_0x202517(0xc1)])return console[_0x202517(0x11d)](_0x202517(0x10b)),console[_0x202517(0x11d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5ed480[_0x202517(0xed)]&&(console[_0x202517(0x11d)](_0x202517(0xb1)+_0x5ed480[_0x202517(0x18f)]),console[_0x202517(0x11d)](_0x202517(0x1be)+_0x2f94a3),console[_0x202517(0x11d)](_0x202517(0x116)+_0x5ed480['database']),console[_0x202517(0x11d)](_0x202517(0xee)+_0x5ed480[_0x202517(0xc1)]));const _0xabe5ad=await loadJSONFromOptions(_0x5ed480[_0x202517(0x187)],_0x5ed480[_0x202517(0xf8)]),_0x52b251=await loadJSONFromOptions(_0x5ed480[_0x202517(0x1cd)],_0x5ed480[_0x202517(0x112)]),_0x1eb9e6=await loadJSONFromOptions(_0x5ed480[_0x202517(0x19f)],_0x5ed480[_0x202517(0x17b)]),_0x10a8a3={'name':_0x2f94a3,'description':_0x5ed480[_0x202517(0xe1)],'scheduleType':_0x5ed480[_0x202517(0xef)],'scheduleOption':_0x5ed480[_0x202517(0x191)],'timezone':_0x5ed480[_0x202517(0xdb)],'master':{'parentDatabaseName':_0x5ed480['database'],'parentTableName':_0x5ed480[_0x202517(0xc1)]},'attributes':_0xabe5ad,'behaviors':_0x52b251,'customerGroup':_0x1eb9e6},_0xb6f58e=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2f94a3+_0x202517(0x13b),()=>_0x4f3bab[_0x202517(0x8e)][_0x202517(0xd9)](_0x10a8a3),{'verbose':_0x5b0fbf['verbose']}),_0x4f51f9=_0xb6f58e['data'];return console[_0x202517(0x11d)](_0x202517(0x1ad)+_0x4f51f9[_0x202517(0xb6)]+_0x202517(0x1a5)+_0x4f51f9['id']),await handleSDKOutput([_0x4f51f9],_0x5b0fbf),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0xd6);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x1dc);async[a22_0x14fbc1(0x142)](_0x1e51f7){const _0x7048ae=a22_0x14fbc1,{options:_0x4812af,args:_0x47d8df,tdx:_0x5238a0}=_0x1e51f7;console[_0x7048ae(0x11d)](_0x7048ae(0xa5)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x7048ae(0xb3));const _0x4b8d25=_0x4812af;if(_0x47d8df['length']===0x0)return console['error'](a22_0x36914f[_0x7048ae(0xb9)](_0x7048ae(0xac))),console['error'](_0x7048ae(0x107)),0x1;const _0x53fb16=_0x47d8df[0x0];_0x4b8d25[_0x7048ae(0xed)]&&(console['error'](_0x7048ae(0xb1)+_0x4b8d25[_0x7048ae(0x18f)]),console[_0x7048ae(0x11d)]('Parent\x20segment:\x20'+_0x53fb16));const _0x564eaf=await withSpinner(_0x7048ae(0x1aa)+_0x53fb16+_0x7048ae(0x13b),()=>_0x5238a0['segment'][_0x7048ae(0xaf)](_0x53fb16),{'verbose':_0x4b8d25[_0x7048ae(0xed)]}),_0x5f3402=_0x564eaf[_0x7048ae(0x194)],_0x29cb12=await loadJSONFromOptions(_0x4b8d25['addAttributes'],_0x4b8d25[_0x7048ae(0xdd)]),_0x4eaf24=await loadJSONFromOptions(_0x4b8d25[_0x7048ae(0x1de)],_0x4b8d25[_0x7048ae(0x1d3)]),_0x27901e={'name':_0x5f3402[_0x7048ae(0xb6)],'description':_0x4b8d25['description']!==undefined?_0x4b8d25[_0x7048ae(0xe1)]:_0x5f3402[_0x7048ae(0xe1)],'scheduleType':_0x4b8d25[_0x7048ae(0xef)]!==undefined?_0x4b8d25['scheduleType']:_0x5f3402[_0x7048ae(0xef)],'scheduleOption':_0x4b8d25['scheduleOption']!==undefined?_0x4b8d25[_0x7048ae(0x191)]:_0x5f3402['scheduleOption'],'timezone':_0x4b8d25['timezone']!==undefined?_0x4b8d25['timezone']:_0x5f3402['timezone'],'master':_0x5f3402['master'],'attributes':_0x29cb12?[..._0x5f3402[_0x7048ae(0x187)]||[],..._0x29cb12]:_0x5f3402[_0x7048ae(0x187)],'behaviors':_0x4eaf24?[..._0x5f3402[_0x7048ae(0x1cd)]||[],..._0x4eaf24]:_0x5f3402[_0x7048ae(0x1cd)],'customerGroup':_0x5f3402[_0x7048ae(0x19f)]},_0x329ae8=await withSpinner(_0x7048ae(0x1e0)+_0x53fb16+'\x27...',()=>_0x5238a0[_0x7048ae(0x8e)][_0x7048ae(0xba)](_0x53fb16,_0x27901e),{'verbose':_0x4b8d25[_0x7048ae(0xed)]}),_0x472044=_0x329ae8[_0x7048ae(0x194)];return console[_0x7048ae(0x11d)](_0x7048ae(0xda)+_0x472044[_0x7048ae(0xb6)]+'\x27'),await handleSDKOutput([_0x472044],_0x4b8d25),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x16f);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x14fbc1(0x142)](_0x149ced){const _0x3017e9=a22_0x14fbc1,{options:_0x5addd8,args:_0x25191c,tdx:_0x3e0912}=_0x149ced,_0x4bfd82=_0x5addd8,_0x175801=_0x25191c[0x0]||_0x5addd8[_0x3017e9(0xcc)];if(!_0x175801)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'+_0x3017e9(0x176)),0x1;if(_0x4bfd82[_0x3017e9(0x1bc)]&&_0x4bfd82['output'])return console[_0x3017e9(0x11d)](a22_0x36914f['red'](_0x3017e9(0xbe))),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x198)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x198)](_0x3017e9(0x19c)+PARENT_SEGMENT_DIR+_0x3017e9(0xc8))),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0xa2)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x3bd229=_0x4bfd82[_0x3017e9(0xcf)]||a22_0x316a68[_0x3017e9(0xc5)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x175801)+_0x3017e9(0x13a));_0x4bfd82[_0x3017e9(0xed)]&&(console['error'](_0x3017e9(0xb1)+_0x4bfd82['site']),console[_0x3017e9(0x11d)]('Parent\x20segment:\x20'+_0x175801),console[_0x3017e9(0x11d)](_0x3017e9(0x18b)+_0x3bd229));const _0x1bea03=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x175801+_0x3017e9(0x13b),()=>_0x3e0912['segment'][_0x3017e9(0x150)](_0x175801),{'verbose':_0x4bfd82[_0x3017e9(0xed)]}),_0x260705=_0x1bea03[_0x3017e9(0x194)];if(existsSync(_0x3bd229)){const _0x3cc543=readFileSync(_0x3bd229,_0x3017e9(0x104)),_0x3f5ccf=generateDiff(_0x3cc543,_0x260705);if(!hasChanges(_0x3f5ccf))console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x36914f['cyan'](_0x3bd229)+_0x3017e9(0x109));else{console[_0x3017e9(0x11d)](_0x3017e9(0x115)+_0x3bd229+'\x27:'),console[_0x3017e9(0x11d)]('─'[_0x3017e9(0x86)](0x3c)),console[_0x3017e9(0x11d)](formatDiffWithColors(_0x3f5ccf)),console[_0x3017e9(0x11d)]('─'[_0x3017e9(0x86)](0x3c));if(!_0x4bfd82[_0x3017e9(0x12b)]){if(!isInteractive())return console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0xb9)](_0x3017e9(0x173)),_0x3017e9(0xf6)),console[_0x3017e9(0x11d)](a22_0x36914f['dim'](_0x3017e9(0x93))),0x1;const _0x224b42=await confirmKey('Overwrite\x20\x27'+_0x3bd229+'\x27?');if(!_0x224b42)return console['error'](a22_0x36914f[_0x3017e9(0xdf)](_0x3017e9(0xea))),0x1;}writeFileSync(_0x3bd229,_0x260705,_0x3017e9(0x104)),console['error'](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+_0x3017e9(0x160)+a22_0x36914f['cyan'](_0x3bd229));}}else{const _0x3c018f=a22_0x316a68[_0x3017e9(0x113)](_0x3bd229);!existsSync(_0x3c018f)&&mkdirSync(_0x3c018f,{'recursive':!![]}),writeFileSync(_0x3bd229,_0x260705,_0x3017e9(0x104)),console[_0x3017e9(0x11d)](a22_0x36914f['green']('✔')+_0x3017e9(0x160)+a22_0x36914f[_0x3017e9(0xa2)](_0x3bd229));}return saveSessionContext({'parent_segment':_0x175801},_0x4bfd82[_0x3017e9(0x134)]),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+_0x3017e9(0xff)+a22_0x36914f[_0x3017e9(0x198)](_0x3017e9(0xe7))+_0x3017e9(0x177)+a22_0x36914f[_0x3017e9(0xa2)](_0x175801)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0xf3);[a22_0x14fbc1(0xe1)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a22_0x14fbc1(0x142)](_0x264399){const _0x2802f4=a22_0x14fbc1,{options:_0x27125e,args:_0x58c436,tdx:_0x5d7945}=_0x264399,_0x1048ac=_0x27125e,_0x40fb8f=_0x58c436[0x0]||_0x27125e['parentSegment'];if(!_0x40fb8f)return showParentSegmentNotSetError(_0x2802f4(0xf2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x58265d=resolveYamlFile(_0x40fb8f);if(!existsSync(_0x58265d))return showFileNotFoundError(_0x58265d,_0x40fb8f),0x1;_0x1048ac[_0x2802f4(0xed)]&&(console['error'](_0x2802f4(0xb1)+_0x1048ac['site']),console[_0x2802f4(0x11d)](_0x2802f4(0x9a)+_0x58265d));let _0x28987b;try{_0x28987b=readFileSync(_0x58265d,_0x2802f4(0x104));}catch(_0xf10d2){const _0x1adfda=_0xf10d2 instanceof Error?_0xf10d2['message']:String(_0xf10d2);return console['error'](_0x2802f4(0x94)+_0x1adfda),0x1;}const _0x458d76=await withSpinner('Analyzing\x20changes...',()=>_0x5d7945[_0x2802f4(0x8e)][_0x2802f4(0x171)](_0x28987b),{'verbose':_0x1048ac[_0x2802f4(0xed)]}),_0x2ccf51=_0x458d76[_0x2802f4(0x194)],{isNew:_0x5246e0,name:_0x531f35,hasChanges:_0x3698ba,diffFormatted:_0x3cf46f}=_0x2ccf51;if(!_0x3698ba)return console[_0x2802f4(0x11d)](_0x2802f4(0xb7)+_0x531f35+_0x2802f4(0x121)),0x0;_0x5246e0?console[_0x2802f4(0x11d)](_0x2802f4(0xe8)+_0x531f35+'\x27:'):console[_0x2802f4(0x11d)](_0x2802f4(0x1a8)+_0x531f35+'\x27:');console[_0x2802f4(0x11d)]('─'[_0x2802f4(0x86)](0x3c)),console['error'](_0x3cf46f),console['error']('─'['repeat'](0x3c));const _0x5c01c9=_0x5246e0?'Create\x20parent\x20segment\x20\x27'+_0x531f35+'\x27?':_0x2802f4(0xa1)+_0x531f35+'\x27?';if(!_0x1048ac[_0x2802f4(0x12b)]){if(!isInteractive())return console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0xb9)](_0x2802f4(0x173)),_0x2802f4(0xf6)),console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0x198)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x65199=await confirmKey(_0x5c01c9);if(!_0x65199)return console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0xdf)](_0x2802f4(0xea))),0x1;}const _0x3687b6=_0x5246e0?_0x2802f4(0x139):'Updating',_0x1a33c2=await withSpinner(_0x3687b6+_0x2802f4(0x1af)+_0x531f35+_0x2802f4(0x13b),()=>_0x2ccf51[_0x2802f4(0x17d)](),{'verbose':_0x1048ac[_0x2802f4(0xed)]}),_0x5df2a7=_0x1a33c2['data'],_0x2d028e=getConsoleNextUrl(_0x1048ac['site'],_0x2802f4(0x199)+_0x5df2a7['id']),_0x4f6a29=_0x5246e0?_0x2802f4(0x1b0):'Updated';return console[_0x2802f4(0x11d)]('✔\x20'+_0x4f6a29+_0x2802f4(0x1af)+_0x5df2a7[_0x2802f4(0xb6)]+'\x27'),console[_0x2802f4(0x11d)]('\x20\x20'+_0x2d028e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x14fbc1(0x1a2);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x16b);async[a22_0x14fbc1(0x142)](_0x4f66b2){const _0x21e5bc=a22_0x14fbc1,{options:_0x5b4617,args:_0x1a1ca3,tdx:_0x450845}=_0x4f66b2,_0x238d65=_0x5b4617,_0x6d4f48=_0x1a1ca3[0x0]||_0x5b4617[_0x21e5bc(0xcc)];if(!_0x6d4f48)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'+_0x21e5bc(0x9b)+_0x21e5bc(0xca)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x21e5bc(0x128)),0x1;const _0x1a7d60=resolveYamlFile(_0x6d4f48);if(!existsSync(_0x1a7d60))return showFileNotFoundError(_0x1a7d60,_0x6d4f48),0x1;_0x238d65[_0x21e5bc(0xed)]&&(console[_0x21e5bc(0x11d)](_0x21e5bc(0xb1)+_0x238d65['site']),console['error'](_0x21e5bc(0x9a)+_0x1a7d60));let _0x5eee3b;try{_0x5eee3b=readFileSync(_0x1a7d60,_0x21e5bc(0x104));}catch(_0x561c75){const _0x4958e9=_0x561c75 instanceof Error?_0x561c75[_0x21e5bc(0x149)]:String(_0x561c75);return console[_0x21e5bc(0x11d)](_0x21e5bc(0x94)+_0x4958e9),0x1;}const _0x1d946d=createCommandSpinner(a22_0x36914f[_0x21e5bc(0x198)](_0x21e5bc(0x16a)),{'verbose':_0x238d65[_0x21e5bc(0xed)]});_0x1d946d[_0x21e5bc(0x1bd)]();const _0x580b17={'onProgress':_0xf995b0=>{const _0x3cd4e4=_0x21e5bc;_0x1d946d[_0x3cd4e4(0x17a)]=formatProgressMessage(_0xf995b0);}};if(_0x238d65[_0x21e5bc(0xd1)])_0x580b17[_0x21e5bc(0xd1)]=!![];if(_0x238d65[_0x21e5bc(0x1bf)])_0x580b17['enriched']=!![];_0x238d65[_0x21e5bc(0x1ca)]&&(_0x580b17[_0x21e5bc(0x1ca)]=_0x238d65['attribute']);_0x238d65['behavior']&&(_0x580b17[_0x21e5bc(0x157)]=_0x238d65[_0x21e5bc(0x157)]);if(_0x238d65[_0x21e5bc(0x1a3)])_0x580b17['interval']=_0x238d65[_0x21e5bc(0x1a3)];let _0x423584;try{_0x423584=await _0x450845[_0x21e5bc(0x8e)][_0x21e5bc(0x137)](_0x5eee3b,_0x580b17),_0x1d946d[_0x21e5bc(0x13f)]();}catch(_0x5e59af){_0x1d946d['stop']();throw _0x5e59af;}const _0x3dc36e=_0x238d65[_0x21e5bc(0x1a3)]||_0x21e5bc(0x178);return this[_0x21e5bc(0x146)](_0x423584,_0x580b17,_0x1a7d60,_0x3dc36e),_0x423584[_0x21e5bc(0x159)]?0x0:0x1;}['displayValidateResults'](_0x4c06bc,_0x25070f,_0x39d362,_0x46a2ae){const _0x591db1=a22_0x14fbc1;console['error']('\x0a'+a22_0x36914f[_0x591db1(0x1c2)](_0x591db1(0xe2))+'\x20'+_0x4c06bc[_0x591db1(0xb6)]),console[_0x591db1(0x11d)]('═'[_0x591db1(0x86)](0x3c)),this[_0x591db1(0x148)](_0x4c06bc);if(typeof _0x25070f['attribute']===_0x591db1(0x120)){this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0x9d)](_0x4c06bc),this['displayPreviewHints'](_0x39d362,_0x46a2ae,'attribute',_0x25070f[_0x591db1(0x1ca)]);return;}if(_0x25070f[_0x591db1(0x1ca)]===!![]){this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'attributes');return;}if(typeof _0x25070f['behavior']===_0x591db1(0x120)){this[_0x591db1(0xfc)](_0x4c06bc,_0x46a2ae),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'behavior',_0x25070f[_0x591db1(0x157)]);return;}if(_0x25070f[_0x591db1(0x157)]===!![]){this['displayBehaviorsStats'](_0x4c06bc,_0x46a2ae),this['displaySummary'](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,_0x591db1(0x1cd));return;}this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0xfc)](_0x4c06bc,_0x46a2ae),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'all');}[a22_0x14fbc1(0x195)](_0x200bdd,_0x54669d,_0x51a32c,_0x21f682){const _0x463072=a22_0x14fbc1;console[_0x463072(0x11d)]('\x0a'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x87)));const _0xa81ebe=_0x54669d!==_0x463072(0x178)?'\x20--interval\x20'+_0x54669d:'';if(_0x51a32c===_0x463072(0x1ca)&&_0x21f682)console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x9f)+_0x21f682+'\x22'+_0xa81ebe));else{if(_0x51a32c==='behavior'&&_0x21f682)console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x8d)+_0x21f682+'\x22'+_0xa81ebe));else(_0x51a32c===_0x463072(0x187)||_0x51a32c===_0x463072(0x131))&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x1e4)+_0xa81ebe));}(_0x51a32c==='behaviors'||_0x51a32c==='all')&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x463072(0x16d)+_0x200bdd+_0x463072(0xe9)+_0xa81ebe)),_0x51a32c===_0x463072(0x131)&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x141)+_0xa81ebe));}['displayMasterInfo'](_0x10f18f){const _0xa9134f=a22_0x14fbc1,{master:_0x278b40}=_0x10f18f,_0x2e46dc=_0x278b40['schemaValid']?a22_0x36914f['green']('✔'):a22_0x36914f['red']('✘');console[_0xa9134f(0x11d)]('\x0a'+a22_0x36914f[_0xa9134f(0x198)](_0xa9134f(0xa0))),console[_0xa9134f(0x11d)](_0x2e46dc+'\x20'+a22_0x36914f[_0xa9134f(0x1c2)](_0x278b40[_0xa9134f(0xb8)]+'.'+_0x278b40[_0xa9134f(0xc1)])),_0x278b40[_0xa9134f(0x88)]?_0x278b40[_0xa9134f(0x103)]!==undefined&&console['error']('\x20\x20'+a22_0x36914f[_0xa9134f(0x198)](_0xa9134f(0x144))+'\x20'+a22_0x36914f[_0xa9134f(0xa2)](formatRows(_0x278b40[_0xa9134f(0x103)]))):console[_0xa9134f(0x11d)]('\x20\x20'+a22_0x36914f[_0xa9134f(0xb9)](_0xa9134f(0xc7))+'\x20'+_0x278b40[_0xa9134f(0x9c)]);}['displayAttributesStats'](_0x52d413){const _0x532c3b=a22_0x14fbc1;if(_0x52d413[_0x532c3b(0x187)][_0x532c3b(0x155)]===0x0)return;console[_0x532c3b(0x11d)]('\x0a'+a22_0x36914f[_0x532c3b(0x198)](_0x532c3b(0x85)));for(const _0x5c3534 of _0x52d413[_0x532c3b(0x187)]){const _0x3fbda1=_0x5c3534['schemaValid']?a22_0x36914f[_0x532c3b(0x1d2)]('✔'):a22_0x36914f[_0x532c3b(0xb9)]('✘');let _0x1357b9='';if(_0x5c3534['schemaValid']&&_0x5c3534[_0x532c3b(0x18a)]!==undefined&&_0x5c3534[_0x532c3b(0x95)]!==undefined){const _0x2d052b=_0x5c3534[_0x532c3b(0x95)]['toFixed'](0x1),_0x3d90ad=_0x5c3534[_0x532c3b(0x95)]>=0x50?a22_0x36914f['green']:_0x5c3534[_0x532c3b(0x95)]>=0x32?a22_0x36914f['yellow']:a22_0x36914f[_0x532c3b(0xb9)];_0x1357b9='\x20'+a22_0x36914f[_0x532c3b(0x198)]('Coverage:')+'\x20'+_0x3d90ad(_0x2d052b+'%')+'\x20('+formatRows(_0x5c3534[_0x532c3b(0x18a)])+_0x532c3b(0x166);}console[_0x532c3b(0x11d)](_0x3fbda1+'\x20'+a22_0x36914f['bold'](_0x5c3534[_0x532c3b(0xb6)])+_0x1357b9),console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x532c3b(0x11f))+'\x20'+a22_0x36914f['bold'](_0x5c3534['database']+'.'+_0x5c3534['table']));const _0x3df20c=_0x5c3534[_0x532c3b(0xf1)]===_0x5c3534[_0x532c3b(0x1d7)]?a22_0x36914f[_0x532c3b(0x198)]('Join\x20on:')+'\x20'+_0x5c3534[_0x532c3b(0xf1)]:a22_0x36914f[_0x532c3b(0x198)](_0x532c3b(0xbd))+'\x20'+_0x5c3534[_0x532c3b(0xf1)]+_0x532c3b(0x177)+_0x5c3534['foreignKey'];console[_0x532c3b(0x11d)]('\x20\x20'+_0x3df20c),console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x532c3b(0x126))),this['displayColumns'](_0x5c3534[_0x532c3b(0x175)]),!_0x5c3534[_0x532c3b(0x88)]&&console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f[_0x532c3b(0xb9)]('Error:')+'\x20'+_0x5c3534[_0x532c3b(0x9c)]);}}[a22_0x14fbc1(0xfc)](_0x358ac0,_0x5716d8){const _0x5a4ebd=a22_0x14fbc1;if(_0x358ac0[_0x5a4ebd(0x1cd)][_0x5a4ebd(0x155)]===0x0)return;console['error']('\x0a'+a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x1d9))+'\x20'+a22_0x36914f[_0x5a4ebd(0x198)]('('+_0x5716d8+')'));for(const _0x2496fe of _0x358ac0[_0x5a4ebd(0x1cd)]){const _0x2ec9d5=_0x2496fe['schemaValid']?a22_0x36914f[_0x5a4ebd(0x1d2)]('✔'):a22_0x36914f[_0x5a4ebd(0xb9)]('✘');let _0x5e81b2='';if(_0x2496fe['schemaValid']&&_0x2496fe['customersWithEvents']!==undefined&&_0x2496fe[_0x5a4ebd(0x151)]!==undefined){const _0x2a5303=_0x2496fe['customerPercent']?.[_0x5a4ebd(0x122)](0x1)||'?',_0x13c77a=(_0x2496fe['customerPercent']??0x0)>=0x32?a22_0x36914f[_0x5a4ebd(0x1d2)]:(_0x2496fe[_0x5a4ebd(0xdc)]??0x0)>=0x14?a22_0x36914f[_0x5a4ebd(0xdf)]:a22_0x36914f[_0x5a4ebd(0xb9)];_0x5e81b2='\x20'+a22_0x36914f['dim'](_0x5a4ebd(0xb5))+'\x20'+_0x13c77a(formatRows(_0x2496fe[_0x5a4ebd(0x1c7)]))+'\x20('+_0x2a5303+'%)\x20'+a22_0x36914f[_0x5a4ebd(0x198)]('Events:')+'\x20'+a22_0x36914f[_0x5a4ebd(0xa2)](formatRows(_0x2496fe['totalEvents']));}console['error'](_0x2ec9d5+'\x20'+a22_0x36914f[_0x5a4ebd(0x1c2)](_0x2496fe[_0x5a4ebd(0xb6)])+_0x5e81b2),console[_0x5a4ebd(0x11d)]('\x20\x20'+a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x11f))+'\x20'+a22_0x36914f[_0x5a4ebd(0x1c2)](_0x2496fe[_0x5a4ebd(0xb8)]+'.'+_0x2496fe[_0x5a4ebd(0xc1)]));const _0x29aa00=_0x2496fe['joinKey']===_0x2496fe['foreignKey']?a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x154))+'\x20'+_0x2496fe[_0x5a4ebd(0xf1)]:a22_0x36914f['dim']('Join:')+'\x20'+_0x2496fe[_0x5a4ebd(0xf1)]+_0x5a4ebd(0x177)+_0x2496fe['foreignKey'];console[_0x5a4ebd(0x11d)]('\x20\x20'+_0x29aa00),console[_0x5a4ebd(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x5a4ebd(0x126))),this[_0x5a4ebd(0x165)](_0x2496fe[_0x5a4ebd(0x175)]),!_0x2496fe[_0x5a4ebd(0x88)]&&console['error']('\x20\x20'+a22_0x36914f[_0x5a4ebd(0xb9)](_0x5a4ebd(0xc7))+'\x20'+_0x2496fe['schemaError']);}}[a22_0x14fbc1(0x165)](_0x4f352c){const _0x5d57af=a22_0x14fbc1;for(const _0x401654 of _0x4f352c){_0x401654['label']===_0x401654[_0x5d57af(0x102)]||_0x401654['column']==='*'?console[_0x5d57af(0x11d)](_0x5d57af(0x183)+_0x401654['label']):console['error'](_0x5d57af(0x183)+_0x401654[_0x5d57af(0x1ac)]+'\x20'+a22_0x36914f[_0x5d57af(0x198)]('('+_0x401654[_0x5d57af(0x102)]+')'));}}['displaySummary'](_0x55e4cd){const _0x49e168=a22_0x14fbc1;console['error']('─'[_0x49e168(0x86)](0x3c));if(_0x55e4cd['errors'][_0x49e168(0x155)]>0x0){console[_0x49e168(0x11d)]('\x0a'+a22_0x36914f['red']('Errors:'));for(const _0x1817a6 of _0x55e4cd[_0x49e168(0x13e)]){console[_0x49e168(0x11d)]('\x20\x20'+a22_0x36914f[_0x49e168(0xb9)]('•')+'\x20'+_0x1817a6);}}_0x55e4cd[_0x49e168(0x159)]&&console['error']('\x0a'+a22_0x36914f[_0x49e168(0x1d2)]('✔')+_0x49e168(0xd4));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x168);['description']=a22_0x14fbc1(0x180);async[a22_0x14fbc1(0x142)](_0xec639c){const _0x543011=a22_0x14fbc1,{options:_0x2041f0,args:_0x4e26b6,tdx:_0x1062b3}=_0xec639c,_0x406de7=_0x2041f0,_0x4fb472=_0x4e26b6[0x0]||_0x2041f0['parentSegment'];if(!_0x4fb472)return showParentSegmentNotSetError(_0x543011(0x161)+_0x543011(0x1ab)+_0x543011(0xeb)+_0x543011(0x124)+_0x543011(0x15b)+_0x543011(0x1a9)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x543011(0x128)),0x1;if(!_0x406de7[_0x543011(0xd1)]&&!_0x406de7[_0x543011(0x1ca)]&&!_0x406de7['behavior']&&!_0x406de7[_0x543011(0x1bf)])return console[_0x543011(0x11d)](a22_0x36914f['red'](_0x543011(0x11a))),console[_0x543011(0x11d)](_0x543011(0x16e)),console[_0x543011(0x11d)](_0x543011(0xe3)),console[_0x543011(0x11d)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x543011(0x1ae)),console['error'](_0x543011(0xd7)),console[_0x543011(0x11d)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0xd9d266=resolveYamlFile(_0x4fb472);if(!existsSync(_0xd9d266))return showFileNotFoundError(_0xd9d266,_0x4fb472),0x1;_0x406de7['verbose']&&(console[_0x543011(0x11d)](_0x543011(0xb1)+_0x406de7[_0x543011(0x18f)]),console[_0x543011(0x11d)](_0x543011(0x9a)+_0xd9d266));let _0x8ba420;try{_0x8ba420=readFileSync(_0xd9d266,_0x543011(0x104));}catch(_0x39b507){const _0x203426=_0x39b507 instanceof Error?_0x39b507[_0x543011(0x149)]:String(_0x39b507);return console[_0x543011(0x11d)](_0x543011(0x94)+_0x203426),0x1;}let _0x34cd5e;try{_0x34cd5e=parseDef(_0x8ba420);}catch(_0x239bcd){const _0x29002e=_0x239bcd instanceof Error?_0x239bcd[_0x543011(0x149)]:String(_0x239bcd);return console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xcb)+_0x29002e)),0x1;}if(_0x406de7[_0x543011(0x1ca)]===!![]||_0x406de7[_0x543011(0x1ca)]===''){const _0x4905da=_0x34cd5e[_0x543011(0x187)]?.['map'](_0x4037e2=>_0x4037e2['name'])||[];if(_0x4905da['length']===0x0)console['error'](a22_0x36914f[_0x543011(0xb9)](_0x543011(0x1df)));else{console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0x1b3))),console[_0x543011(0x11d)]('Available\x20attributes:');for(const _0x2e3361 of _0x4905da){console[_0x543011(0x11d)]('\x20\x20'+a22_0x36914f[_0x543011(0xa2)](_0x2e3361));}console['error'](_0x543011(0x1bb)+_0x4fb472+'\x20--attribute\x20\x22'+_0x4905da[0x0]+'\x22');}return 0x1;}if(_0x406de7[_0x543011(0x157)]===!![]||_0x406de7[_0x543011(0x157)]===''){const _0x2ed189=_0x34cd5e[_0x543011(0x1cd)]?.['map'](_0x56f5ef=>_0x56f5ef[_0x543011(0xb6)])||[];if(_0x2ed189['length']===0x0)console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xd5)));else{console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xb2))),console[_0x543011(0x11d)](_0x543011(0xf9));for(const _0x5545c6 of _0x2ed189){console[_0x543011(0x11d)]('\x20\x20'+a22_0x36914f['cyan'](_0x5545c6));}console[_0x543011(0x11d)](_0x543011(0x1bb)+_0x4fb472+_0x543011(0x8d)+_0x2ed189[0x0]+'\x22');}return 0x1;}const _0x2ea74f=createCommandSpinner(a22_0x36914f[_0x543011(0x198)](_0x543011(0x179)),{'verbose':_0x406de7[_0x543011(0xed)]});_0x2ea74f[_0x543011(0x1bd)]();const _0x3cf098={'onProgress':_0x1bfff6=>{const _0x561bbe=_0x543011;_0x2ea74f[_0x561bbe(0x17a)]=formatProgressMessage(_0x1bfff6);}};if(_0x406de7[_0x543011(0xd1)])_0x3cf098[_0x543011(0xd1)]=!![];if(_0x406de7[_0x543011(0x1ca)]&&typeof _0x406de7[_0x543011(0x1ca)]==='string')_0x3cf098[_0x543011(0x1ca)]=_0x406de7['attribute'];if(_0x406de7[_0x543011(0x157)]&&typeof _0x406de7[_0x543011(0x157)]==='string')_0x3cf098['behavior']=_0x406de7[_0x543011(0x157)];if(_0x406de7[_0x543011(0x1bf)])_0x3cf098[_0x543011(0x1bf)]=!![];if(_0x406de7['interval'])_0x3cf098[_0x543011(0x1a3)]=_0x406de7[_0x543011(0x1a3)];let _0x742b04;try{_0x742b04=await _0x1062b3[_0x543011(0x8e)][_0x543011(0x127)](_0x8ba420,_0x3cf098),_0x2ea74f[_0x543011(0x13f)]();}catch(_0x1798f6){_0x2ea74f['stop']();throw _0x1798f6;}return await this['displayPreviewResults'](_0x742b04,{'master':_0x406de7[_0x543011(0xd1)],'attribute':typeof _0x406de7[_0x543011(0x1ca)]===_0x543011(0x120)?_0x406de7[_0x543011(0x1ca)]:undefined,'behavior':typeof _0x406de7[_0x543011(0x157)]===_0x543011(0x120)?_0x406de7['behavior']:undefined,'enriched':_0x406de7['enriched']}),_0x742b04[_0x543011(0x159)]?0x0:0x1;}async[a22_0x14fbc1(0x186)](_0x19d3f3,_0x46d0eb){const _0x18d1c9=a22_0x14fbc1;console['error']('\x0a'+a22_0x36914f['bold'](_0x18d1c9(0x15a))+'\x20'+_0x19d3f3[_0x18d1c9(0xb6)]),console[_0x18d1c9(0x11d)]('═'[_0x18d1c9(0x86)](0x3c));if(_0x46d0eb[_0x18d1c9(0xd1)]&&_0x19d3f3[_0x18d1c9(0x16c)]){const _0x26e307=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x145))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x19d3f3['master'][_0x18d1c9(0xb8)]+'.'+_0x19d3f3[_0x18d1c9(0xd1)][_0x18d1c9(0xc1)]);await this[_0x18d1c9(0x1e2)](_0x26e307,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb[_0x18d1c9(0x1ca)]&&_0x19d3f3[_0x18d1c9(0x16c)]){const _0xad0cd3=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x10d))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x46d0eb[_0x18d1c9(0x1ca)]);await this['displaySampleData'](_0xad0cd3,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb[_0x18d1c9(0x157)]&&_0x19d3f3['sampleData']){const _0x54cfc8=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x14d))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x46d0eb[_0x18d1c9(0x157)]);await this[_0x18d1c9(0x1e2)](_0x54cfc8,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb['enriched']&&_0x19d3f3['sampleData']){const _0x7ed79c=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x1b9))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)]('Master\x20+\x20Attributes');await this[_0x18d1c9(0x1e2)](_0x7ed79c,_0x19d3f3[_0x18d1c9(0x16c)]);}else!_0x19d3f3[_0x18d1c9(0x16c)]&&console[_0x18d1c9(0x11d)](_0x18d1c9(0x193));}}}if(_0x19d3f3['errors'][_0x18d1c9(0x155)]>0x0){console[_0x18d1c9(0x11d)]('─'[_0x18d1c9(0x86)](0x3c)),console[_0x18d1c9(0x11d)]('\x0a'+a22_0x36914f[_0x18d1c9(0xb9)](_0x18d1c9(0x174)));for(const _0x17eba6 of _0x19d3f3[_0x18d1c9(0x13e)]){console['error']('\x20\x20'+a22_0x36914f['red']('•')+'\x20'+_0x17eba6);}}}async[a22_0x14fbc1(0x1e2)](_0x3dbe85,_0x3d5234){const _0x3a3f1c=a22_0x14fbc1;if(_0x3d5234[_0x3a3f1c(0x155)]===0x0){console[_0x3a3f1c(0x11d)]('\x0a'+_0x3dbe85),console[_0x3a3f1c(0x11d)](_0x3a3f1c(0x14e));return;}console[_0x3a3f1c(0x11d)]('\x0a'+_0x3dbe85);const _0x3a8628=Object[_0x3a3f1c(0xd3)](_0x3d5234[0x0])[_0x3a3f1c(0x106)](_0x509842=>({'name':_0x509842,'type':typeof _0x3d5234[0x0][_0x509842]===_0x3a3f1c(0x1c4)?_0x3a3f1c(0xd8):_0x3a3f1c(0x12f)})),_0x4cf0dc={'queryId':_0x3a3f1c(0x1d1),'columns':_0x3a8628,'data':_0x3d5234,'stats':{'state':_0x3a3f1c(0x1d8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3d5234[_0x3a3f1c(0x155)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x53bfc2=formatAsTable(_0x4cf0dc,_0x3d5234[_0x3a3f1c(0x155)],!![]);await writeOutput(_0x53bfc2,undefined,_0x3a3f1c(0xc1));}}function a22_0xca5d(){const _0x4d37a2=['allValid','Preview:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','isDirectory','5sqVNfU','segment:parent:list','10CeBRAU','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20field','\x20\x20Tables:\x201\x20customers\x20+\x20','/app/workflows/','displayColumns','\x20rows)','collectSchema','segment:parent:preview','No\x20parent\x20segments\x20found','Validating\x20configuration...','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','sampleData','tdx\x20segment\x20parent\x20preview\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','segment:parent:pull','test','pushParentYaml','\x20behaviors','\x0aError:','Errors:','columns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20=\x20','-1d','Fetching\x20sample\x20data...','text','customerGroupFile','/\x20directories\x20exist.','apply','\x20parent\x20segment','Show\x20parent\x20segment\x20details','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22\x20}','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20-\x20','/sessions/','processedRows','displayPreviewResults','attributes','.yaml','replace','matchedCount','Output\x20file:\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','runParent','site','Listing\x20parent\x20segments...','scheduleOption','Fetching\x20parent\x20segment\x20\x27','\x0aNo\x20sample\x20data\x20available','data','displayPreviewHints','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Parent\x20segment:\x20','dim','/app/dw/parentSegments/','push','segment:parent:fields','using\x20the\x20default\x20path:\x20','Session:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','customerGroup','Fetching\x20behavior\x20list...','segment:parent:desc','segment:parent:validate','interval','audienceId','\x27\x20with\x20ID:\x20','\x27\x20is\x20up\x20to\x20date','/\x20→\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','label','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20parent\x20segment\x20\x27','Created','win32','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Error:\x20--attribute\x20requires\x20a\x20name\x0a','unref','parent_segments','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','✔\x20Query\x20completed:\x20Processed\x20','Enriched:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','use','start','Name:\x20','enriched','\x0a\x20\x20\x20\x20}','getBehaviorNames','bold','28967521jXOmtD','number','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','customersWithEvents','workflowAttemptId','Schema\x20saved\x20to\x20','attribute','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','behaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20Migrating:\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','preview','green','addBehaviorsFile','\x0a✔\x20Workflow\x20started','getParentSQL','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','foreignKey','FINISHED','Behaviors','676047YmavRQ','segment:parent:sql','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','addBehaviors','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Updating\x20parent\x20segment\x20\x27','Status:','displaySampleData','population','\x20--attribute\x20\x22<name>\x22','Attributes','repeat','To\x20view\x20sample\x20data:','schemaValid','SELECT\x20*\x20FROM\x20','sort','query','getOutputDatabaseName','\x20--behavior\x20\x22','segment','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Error:\x20File\x20not\x20found:\x20','Listing\x20fields\x20for\x20\x27','\x20[Job\x20ID:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error\x20reading\x20file:\x20','coveragePercent','run','endsWith','Analyzing\x20changes...','\x27\x20and\x20run\x20workflow?','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','schemaError','displaySummary','Resolving\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','Master\x20Table','Apply\x20changes\x20to\x20\x27','cyan','11833371oDbWOj','5306118ZajFzD','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','displayAttributesStats','List\x20parent\x20segments','\x0a⚠️\x20\x20Both\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20Opening\x20','Updating','Error:\x20Parent\x20segment\x20name\x20is\x20required','in\x20','formatSchemaJson','getParentFull','jsonl','Site:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','limit','Customers:','name','✔\x20No\x20changes\x20-\x20\x27','database','red','updateParent','\x20\x20Columns:\x20','82yzlYHS','Join:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Updated','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','table','information_schema','log','segment:parent:view','join','localeCompare','Error:','/{name}.yml\x0a','type','Options:\x0a','Error\x20parsing\x20YAML:\x20','parentSegment','workflowSessionId','✔\x20Renamed\x20directory\x20to\x20','output','/\x20and\x20','master','Attempt:','keys','\x20Configuration\x20is\x20valid','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:update','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','double','createParent','✔\x20Updated\x20parent\x20segment\x20\x27','timezone','customerPercent','addAttributesFile','ignore','yellow','8PzmEzQ','description','Validate:','Options:','Found\x20YAML\x20file:\x20','20819QLjkUJ','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','parent_segment','\x0aNew\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22<name>\x22','Aborted.','Options\x20(one\x20required):\x0a','resolveParentId','verbose','Table:\x20','scheduleType','Executing\x20parent\x20segment\x20query...','joinKey','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:push','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','toLocaleString','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','attributesFile','Available\x20behaviors:','6179800rMfRkT','customers','displayBehaviorsStats','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','filter','\x20Context\x20set:\x20','jobId','5096973xshbCy','column','rowCount','utf-8','Fetching\x20SQL\x20for\x20\x27','map','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x5c$&','\x20is\x20already\x20up\x20to\x20date','`\x20to\x20download\x20the\x20configuration\x20first','Error:\x20--database\x20and\x20--table\x20are\x20required','listFields','Attribute:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Output\x20Database:','.customers)','👥\x20','behaviorsFile','dirname','parent_id','\x0aChanges\x20to\x20\x27','Database:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20kill','column_type','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','segment:parent:create','column_name','error','{\x0a\x20\x20\x22database\x22:\x20\x22','Source:','string','\x27\x20is\x20already\x20up\x20to\x20date','toFixed','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','darwin','Columns:','previewParentYaml','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','yes','setJobId','\x20\x20Database:\x20','Fetching\x20customers\x20schema...','varchar','\x20total','all','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','To\x20cancel:','session','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','toLowerCase','validateParentYaml','No\x20parent\x20segments\x20match\x20pattern:\x20','Creating','.yml','\x27...','trim','status','errors','stop','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20--enriched','execute','reduce','Rows:','Master:','displayValidateResults','format','displayMasterInfo','message','behavior_','workflowId','stats','Behavior:','\x20\x20No\x20sample\x20data\x20available','json','pullParentYaml','totalEvents','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','List\x20available\x20fields\x20for\x20segmentation','Join\x20on:','length','\x0a\x20\x20]\x0a}\x0a','behavior','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'];a22_0xca5d=function(){return _0x4d37a2;};return a22_0xca5d();}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]='segment:parent:run';[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x152);async[a22_0x14fbc1(0x142)](_0xe3fc1b){const _0x9bb9b6=a22_0x14fbc1,{options:_0x3670f2,args:_0x2f2fe9,tdx:_0x14ae0f}=_0xe3fc1b,_0x11162c=_0x3670f2,_0x37e6da=_0x2f2fe9[0x0]||_0x3670f2[_0x9bb9b6(0xcc)];if(!_0x37e6da)return showParentSegmentNotSetError(_0x9bb9b6(0x10e)+_0x9bb9b6(0x1c6)),0x1;const _0x46f3d8=resolveYamlFile(_0x37e6da);if(existsSync(_0x46f3d8)){_0x11162c[_0x9bb9b6(0xed)]&&console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xe4)+_0x46f3d8);let _0x2110e4;try{_0x2110e4=readFileSync(_0x46f3d8,_0x9bb9b6(0x104));}catch(_0x627ebf){const _0x17547f=_0x627ebf instanceof Error?_0x627ebf[_0x9bb9b6(0x149)]:String(_0x627ebf);return console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x94)+_0x17547f),0x1;}const _0x307d59=await withSpinner(_0x9bb9b6(0x98),()=>_0x14ae0f['segment'][_0x9bb9b6(0x171)](_0x2110e4),{'verbose':_0x11162c[_0x9bb9b6(0xed)]}),_0x31fd5b=_0x307d59[_0x9bb9b6(0x194)],{isNew:_0x2b4131,name:_0x2dcf48,hasChanges:_0x2ccbea,diffFormatted:_0x3fbec5}=_0x31fd5b;if(_0x2ccbea){_0x2b4131?console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xe8)+_0x2dcf48+'\x27:'):console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x1a8)+_0x2dcf48+'\x27:');console['error']('─'[_0x9bb9b6(0x86)](0x3c)),console['error'](_0x3fbec5),console[_0x9bb9b6(0x11d)]('─'[_0x9bb9b6(0x86)](0x3c));const _0x21f35e=_0x2b4131?'Create\x20parent\x20segment\x20\x27'+_0x2dcf48+_0x9bb9b6(0x99):_0x9bb9b6(0xa1)+_0x2dcf48+_0x9bb9b6(0x99);if(!_0x11162c[_0x9bb9b6(0x12b)]){if(!isInteractive())return console[_0x9bb9b6(0x11d)](a22_0x36914f['red'](_0x9bb9b6(0x173)),_0x9bb9b6(0xf6)),console[_0x9bb9b6(0x11d)](a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x93))),0x1;const _0x51a63b=await confirmKey(_0x21f35e);if(!_0x51a63b)return console['error'](a22_0x36914f['yellow'](_0x9bb9b6(0xea))),0x1;}const _0x382a71=_0x2b4131?_0x9bb9b6(0x139):_0x9bb9b6(0xab);await withSpinner(_0x382a71+_0x9bb9b6(0x1af)+_0x2dcf48+'\x27...',()=>_0x31fd5b[_0x9bb9b6(0x17d)](),{'verbose':_0x11162c[_0x9bb9b6(0xed)]});const _0x1f3da5=_0x2b4131?_0x9bb9b6(0x1b0):_0x9bb9b6(0xbf);console[_0x9bb9b6(0x11d)]('✔\x20'+_0x1f3da5+_0x9bb9b6(0x1af)+_0x2dcf48+'\x27');}else console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xb7)+_0x2dcf48+_0x9bb9b6(0x1a6));}const _0x11edff=await withSpinner(_0x9bb9b6(0x132)+_0x37e6da+_0x9bb9b6(0x13b),()=>_0x14ae0f[_0x9bb9b6(0x8e)][_0x9bb9b6(0x18e)](_0x37e6da),{'verbose':_0x11162c['verbose']}),_0x50e3a4=_0x11edff['data'],_0x42e4d3=getConsoleUrl(_0x11162c[_0x9bb9b6(0x18f)],_0x9bb9b6(0x164)+_0x50e3a4[_0x9bb9b6(0x14b)]+_0x9bb9b6(0x184)+_0x50e3a4[_0x9bb9b6(0xcd)]+'/attempt/'+_0x50e3a4['workflowAttemptId']);return console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x1d4)),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)]('Audience\x20ID:')+'\x20'+_0x50e3a4[_0x9bb9b6(0x1a4)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x1e1))+'\x20'+_0x50e3a4[_0x9bb9b6(0x13d)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x19d))+'\x20'+_0x50e3a4[_0x9bb9b6(0xcd)]),console['error']('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0xd2))+'\x20'+_0x50e3a4[_0x9bb9b6(0x1c8)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+_0x42e4d3),console[_0x9bb9b6(0x11d)]('\x0a'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x133))+'\x20tdx\x20wf\x20attempt\x20'+_0x50e3a4[_0x9bb9b6(0x1c8)]+_0x9bb9b6(0x118)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x19b);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x153);async[a22_0x14fbc1(0x142)](_0x13d8fc){const _0x1a05f5=a22_0x14fbc1,{options:_0x14bc1e,args:_0x414510,tdx:_0xc08519}=_0x13d8fc,_0x42de89=_0x414510[0x0]||_0x14bc1e[_0x1a05f5(0xcc)];if(!_0x42de89)return showParentSegmentNotSetError(_0x1a05f5(0x1cc)+_0x1a05f5(0x135)),0x1;_0x14bc1e[_0x1a05f5(0xed)]&&(console[_0x1a05f5(0x11d)]('Site:\x20'+_0x14bc1e[_0x1a05f5(0x18f)]),console[_0x1a05f5(0x11d)](_0x1a05f5(0x197)+_0x42de89));const _0x1315ef=await withSpinner(_0x1a05f5(0x91)+_0x42de89+_0x1a05f5(0x13b),()=>_0xc08519[_0x1a05f5(0x8e)][_0x1a05f5(0x10c)](_0x42de89),{'verbose':_0x14bc1e[_0x1a05f5(0xed)]}),_0x845970=_0x1315ef[_0x1a05f5(0x194)];console[_0x1a05f5(0x11d)]('✔\x20Found\x20'+_0x845970[_0x1a05f5(0x155)]+_0x1a05f5(0x162)+(_0x845970[_0x1a05f5(0x155)]!==0x1?'s':''));if(_0x14bc1e['json']||_0x14bc1e[_0x1a05f5(0xb0)])return await handleSDKOutput(_0x845970,_0x14bc1e),0x0;return displayFieldsHumanReadable(_0x845970,_0x42de89),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x14fbc1(0xc4);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x17f);async[a22_0x14fbc1(0x142)](_0x10a431){const _0x544678=a22_0x14fbc1,{options:_0x585313,args:_0x13c28a,tdx:_0x30bf29}=_0x10a431,_0x55666e=_0x585313,_0x15d44c=_0x13c28a[0x0]||_0x585313[_0x544678(0xcc)];if(!_0x15d44c)return showParentSegmentNotSetError(_0x544678(0x196)+_0x544678(0x117)+_0x544678(0xca)+_0x544678(0x12a)),0x1;_0x585313['verbose']&&(console[_0x544678(0x11d)](_0x544678(0xb1)+_0x585313[_0x544678(0x18f)]),console[_0x544678(0x11d)](_0x544678(0x197)+_0x15d44c));const _0x44f295=await withSpinner(_0x544678(0x192)+_0x15d44c+_0x544678(0x13b),()=>_0x30bf29['segment'][_0x544678(0xaf)](_0x15d44c),{'verbose':_0x585313[_0x544678(0xed)]}),_0x5866ce=_0x44f295['data'];if(_0x55666e['web']){const _0x47737f=getConsoleNextUrl(_0x55666e[_0x544678(0x18f)],_0x544678(0x199)+_0x5866ce['id']);return console[_0x544678(0x11d)](a22_0x36914f[_0x544678(0x1d2)]('✔')+_0x544678(0xaa)+a22_0x36914f[_0x544678(0xa2)](_0x47737f)),openBrowser(_0x47737f),0x0;}return await handleSingleObjectOutput(_0x5866ce,_0x585313),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x1a1);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x1ba);async[a22_0x14fbc1(0x142)](_0x359355){const _0x4dab03=a22_0x14fbc1,{options:_0x9530ee,args:_0x3b860,tdx:_0x159bca}=_0x359355,_0x87a66a=_0x9530ee,_0x2ee8b1=_0x3b860[0x0]||_0x9530ee[_0x4dab03(0xcc)];if(!_0x2ee8b1)return showParentSegmentNotSetError(_0x4dab03(0x8f)+_0x4dab03(0x158)+_0x4dab03(0xca)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x9530ee[_0x4dab03(0xed)]&&(console[_0x4dab03(0x11d)](_0x4dab03(0xb1)+_0x9530ee[_0x4dab03(0x18f)]),console[_0x4dab03(0x11d)](_0x4dab03(0x197)+_0x2ee8b1));const _0x2ad716=await withSpinner(_0x4dab03(0x9e)+_0x2ee8b1+_0x4dab03(0x13b),()=>_0x159bca[_0x4dab03(0x8e)][_0x4dab03(0xec)](_0x2ee8b1),{'verbose':_0x9530ee[_0x4dab03(0xed)]}),_0x53e1ab=_0x2ad716[_0x4dab03(0x194)],_0x52a96c=_0x159bca['segment'][_0x4dab03(0x8c)](_0x53e1ab);if(_0x87a66a[_0x4dab03(0xcf)]){const _0x20639b=await this[_0x4dab03(0x167)](_0x359355,_0x2ee8b1,_0x53e1ab,_0x52a96c),_0x4d0b6c=this[_0x4dab03(0xae)](_0x20639b);writeFileSync(_0x87a66a['output'],_0x4d0b6c);const _0x162e5c=_0x20639b[_0x4dab03(0xfb)][_0x4dab03(0x175)][_0x4dab03(0x155)]+_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0x143)]((_0x6666ab,_0x2d7bda)=>_0x6666ab+_0x2d7bda['columns'][_0x4dab03(0x155)],0x0),_0xf01a0e=_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0xfe)](_0x46b0fb=>_0x46b0fb['columns']['length']===0x0)[_0x4dab03(0x155)];return console[_0x4dab03(0xc3)](_0x4dab03(0x1c9)+_0x87a66a['output']),console[_0x4dab03(0xc3)](_0x4dab03(0x12d)+_0x52a96c),console[_0x4dab03(0xc3)](_0x4dab03(0x163)+_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0x155)]+_0x4dab03(0x172)),console[_0x4dab03(0xc3)](_0x4dab03(0xbb)+_0x162e5c+_0x4dab03(0x130)),_0xf01a0e>0x0&&console[_0x4dab03(0xc3)]('\x20\x20Note:\x20'+_0xf01a0e+_0x4dab03(0x1b2)),0x0;}console['error']('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x4dab03(0x10f))+'\x20'+a22_0x36914f[_0x4dab03(0xa2)](_0x52a96c));const _0x1468bc=await withSpinner(_0x4dab03(0x12e),()=>_0x159bca[_0x4dab03(0x8e)][_0x4dab03(0x1d5)](_0x53e1ab),{'verbose':_0x9530ee[_0x4dab03(0xed)]});console['error']('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x4dab03(0xfb))+'\x20'+a22_0x36914f['dim']('('+_0x52a96c+_0x4dab03(0x110)));const _0x287d1d=await executeSchemaQuery(_0x1468bc['data'],_0x159bca,_0x9530ee);await handleQueryOutput(_0x287d1d,_0x9530ee);const _0x1222d9=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x159bca[_0x4dab03(0x8e)]['getBehaviorNames'](_0x53e1ab),{'verbose':_0x9530ee['verbose']});for(const _0x25d1d0 of _0x1222d9[_0x4dab03(0x194)]){const _0x50c5a9='behavior_'+_0x25d1d0[_0x4dab03(0x136)]()[_0x4dab03(0x189)](/\s+/g,'_'),_0x180f11=_0x4dab03(0x89)+_0x52a96c+'.'+_0x50c5a9;console[_0x4dab03(0x11d)]('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x25d1d0)+'\x20'+a22_0x36914f[_0x4dab03(0x198)]('('+_0x52a96c+'.'+_0x50c5a9+')'));try{const _0x4ce595=await executeSchemaQuery(_0x180f11,_0x159bca,_0x9530ee);await handleQueryOutput(_0x4ce595,_0x9530ee);}catch{console[_0x4dab03(0x11d)](a22_0x36914f[_0x4dab03(0xdf)](_0x4dab03(0xf7)));}}return 0x0;}async[a22_0x14fbc1(0x167)](_0x2fa086,_0x3d1fd3,_0x4caaf6,_0x46062d){const _0x2e3243=a22_0x14fbc1,{options:_0x2038f7,tdx:_0xb253e7}=_0x2fa086,_0x5564bc=await withSpinner(_0x2e3243(0x12e),()=>_0xb253e7[_0x2e3243(0x8e)][_0x2e3243(0x1d5)](_0x4caaf6),{'verbose':_0x2038f7['verbose']}),_0x3b5806=await executeSchemaQuery(_0x5564bc[_0x2e3243(0x194)],_0xb253e7,_0x2038f7),_0x417a0c=_0x3b5806[_0x2e3243(0x194)][_0x2e3243(0x106)](_0x46e9ea=>({'name':_0x46e9ea[_0x2e3243(0x11c)],'type':_0x46e9ea[_0x2e3243(0x119)]})),_0x3b5bc8=await withSpinner(_0x2e3243(0x1a0),()=>_0xb253e7[_0x2e3243(0x8e)][_0x2e3243(0x1c1)](_0x4caaf6),{'verbose':_0x2038f7[_0x2e3243(0xed)]}),_0x57e32b=[];for(const _0x576792 of _0x3b5bc8[_0x2e3243(0x194)]){const _0x2a7d73=_0x2e3243(0x14a)+_0x576792[_0x2e3243(0x136)]()[_0x2e3243(0x189)](/\s+/g,'_'),_0x4f9df3='SELECT\x20*\x20FROM\x20'+_0x46062d+'.'+_0x2a7d73;let _0x1c8117=[];try{const _0x1be2d5=await executeSchemaQuery(_0x4f9df3,_0xb253e7,_0x2038f7);_0x1c8117=_0x1be2d5[_0x2e3243(0x194)]['map'](_0x8c28ea=>({'name':_0x8c28ea['column_name'],'type':_0x8c28ea[_0x2e3243(0x119)]}));}catch{}_0x57e32b[_0x2e3243(0x19a)]({'table':_0x2a7d73,'columns':_0x1c8117});}return{'database':_0x46062d,'parent_segment':_0x3d1fd3,'parent_id':_0x4caaf6,'customers':{'table':_0x2e3243(0xfb),'columns':_0x417a0c},'behaviors':_0x57e32b};}['formatSchemaJson'](_0x2baaf0){const _0x396db7=a22_0x14fbc1,_0x1fb82b=_0x486496=>{const _0x44229b=a22_0x4d49;if(_0x486496[_0x44229b(0x155)]===0x0)return'[]';const _0x3f5b0b=_0x486496[_0x44229b(0x106)](_0x38d3db=>_0x44229b(0x140)+_0x38d3db[_0x44229b(0xb6)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x38d3db[_0x44229b(0xc9)]+_0x44229b(0x181));return'[\x0a'+_0x3f5b0b['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x1de53a=_0x2baaf0[_0x396db7(0x1cd)][_0x396db7(0x106)](_0x411ecc=>{const _0x142f4d=_0x396db7;return _0x142f4d(0x1dd)+_0x411ecc[_0x142f4d(0xc1)]+_0x142f4d(0x18c)+_0x1fb82b(_0x411ecc['columns'])[_0x142f4d(0x189)](/^/gm,'\x20\x20')[_0x142f4d(0x13c)]()+_0x142f4d(0x1c0);})[_0x396db7(0xc5)](',\x0a');return _0x396db7(0x11e)+_0x2baaf0['database']+_0x396db7(0x1b6)+_0x2baaf0[_0x396db7(0xe7)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x2baaf0[_0x396db7(0x114)]+_0x396db7(0xfd)+_0x2baaf0[_0x396db7(0xfb)][_0x396db7(0xc1)]+_0x396db7(0x19e)+_0x1fb82b(_0x2baaf0[_0x396db7(0xfb)][_0x396db7(0x175)])[_0x396db7(0x189)](/^/gm,'\x20\x20')[_0x396db7(0x13c)]()+_0x396db7(0xe6)+_0x1de53a+_0x396db7(0x156);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x1db);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x2f43ff){const _0x42494b=a22_0x14fbc1,{options:_0x37aac6,args:_0x384c2c,tdx:_0x428791}=_0x2f43ff,_0x2e2fee=_0x384c2c[0x0]||_0x37aac6[_0x42494b(0xcc)];if(!_0x2e2fee)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x42494b(0x1ce)),0x1;_0x37aac6[_0x42494b(0xed)]&&(console['error'](_0x42494b(0xb1)+_0x37aac6[_0x42494b(0x18f)]),console['error']('Parent\x20segment:\x20'+_0x2e2fee));const _0x50ead3=await withSpinner(_0x42494b(0x9e)+_0x2e2fee+'\x27...',()=>_0x428791[_0x42494b(0x8e)][_0x42494b(0xec)](_0x2e2fee),{'verbose':_0x37aac6[_0x42494b(0xed)]}),_0x2f2a6c=_0x50ead3[_0x42494b(0x194)],_0xce9c23=await withSpinner(_0x42494b(0x105)+_0x2e2fee+'\x27...',()=>_0x428791[_0x42494b(0x8e)]['getParentSQL'](_0x2f2a6c),{'verbose':_0x37aac6['verbose']}),_0x86c849=_0xce9c23[_0x42494b(0x194)];return _0x37aac6[_0x42494b(0x147)]===_0x42494b(0x14f)||_0x37aac6[_0x42494b(0x147)]==='jsonl'?await handleSDKOutput([{'sql':_0x86c849}],_0x37aac6):console[_0x42494b(0xc3)](_0x86c849),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]='segment:parent:show';['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a22_0x14fbc1(0x142)](_0x3fa83e){const _0x4de150=a22_0x14fbc1,{options:_0x584f32,args:_0x33301a,tdx:_0x45f7a9}=_0x3fa83e,_0x5e5547=_0x33301a[0x0]||_0x584f32[_0x4de150(0xcc)];if(!_0x5e5547)return showParentSegmentNotSetError(_0x4de150(0xc0)+_0x4de150(0xf4)),0x1;_0x584f32[_0x4de150(0xed)]&&(console[_0x4de150(0x11d)](_0x4de150(0xb1)+_0x584f32['site']),console[_0x4de150(0x11d)]('Parent\x20segment:\x20'+_0x5e5547));const _0x4d25ab=await withSpinner(_0x4de150(0x9e)+_0x5e5547+_0x4de150(0x13b),()=>_0x45f7a9['segment'][_0x4de150(0xec)](_0x5e5547),{'verbose':_0x584f32['verbose']}),_0x5a5336=_0x4d25ab[_0x4de150(0x194)],_0x5c081b=await withSpinner(_0x4de150(0x105)+_0x5e5547+_0x4de150(0x13b),()=>_0x45f7a9[_0x4de150(0x8e)]['getParentSQL'](_0x5a5336),{'verbose':_0x584f32['verbose']});let _0x27d9b3=_0x5c081b['data'];const _0x352d93=resolveLimit(_0x584f32[_0x4de150(0xb4)],DEFAULT_DISPLAY_LIMIT),_0x1c5fb1=/\bLIMIT\s+\d+/i[_0x4de150(0x170)](_0x27d9b3);!_0x1c5fb1&&(_0x27d9b3=_0x27d9b3[_0x4de150(0x13c)]()['replace'](/;+$/,''),_0x27d9b3='SELECT\x20*\x20FROM\x20(\x0a'+_0x27d9b3+_0x4de150(0x18d)+_0x352d93);_0x584f32[_0x4de150(0xed)]&&console[_0x4de150(0x11d)]('SQL\x20query:\x0a'+_0x27d9b3);const _0x49b7f0=await withProgressSpinner(_0x4de150(0xf0),async _0x2d9f01=>{const _0x10dd38=_0x4de150,_0x56b1ad=await _0x45f7a9[_0x10dd38(0x8b)][_0x10dd38(0x142)](_0x27d9b3,{'catalog':'td','schema':_0x10dd38(0xc2),'onJobId':_0x170378=>{const _0x546012=_0x10dd38;_0x2d9f01[_0x546012(0x12c)](_0x170378);}});return _0x56b1ad;},{'verbose':_0x584f32[_0x4de150(0xed)]}),_0x18f96a=_0x49b7f0[_0x4de150(0x194)],_0x39bead=_0x18f96a[_0x4de150(0x100)]?_0x4de150(0x92)+_0x18f96a[_0x4de150(0x100)]+']':'';return console['error'](_0x4de150(0x1b8)+_0x18f96a[_0x4de150(0x14c)][_0x4de150(0x185)][_0x4de150(0xf5)]()+'\x20rows\x20'+(_0x4de150(0xad)+formatElapsed(_0x18f96a[_0x4de150(0x14c)][_0x4de150(0x1cb)])+_0x39bead)),await handleQueryOutput(_0x18f96a,_0x584f32),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x1cddb2=a23_0x20bc;(function(_0x31b35f,_0x295f00){const _0x3773a6=a23_0x20bc,_0x26fd3d=_0x31b35f();while(!![]){try{const _0x20ddfc=-parseInt(_0x3773a6(0x223))/0x1*(-parseInt(_0x3773a6(0x1e1))/0x2)+-parseInt(_0x3773a6(0x1f8))/0x3+parseInt(_0x3773a6(0x1d3))/0x4*(parseInt(_0x3773a6(0x206))/0x5)+parseInt(_0x3773a6(0x1d1))/0x6+parseInt(_0x3773a6(0x1db))/0x7+parseInt(_0x3773a6(0x21a))/0x8+-parseInt(_0x3773a6(0x220))/0x9*(parseInt(_0x3773a6(0x22c))/0xa);if(_0x20ddfc===_0x295f00)break;else _0x26fd3d['push'](_0x26fd3d['shift']());}catch(_0x4cff4e){_0x26fd3d['push'](_0x26fd3d['shift']());}}}(a23_0x224a,0x2c378));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x39a501 from'node:path';function a23_0x20bc(_0x4a7bcb,_0x2db5ac){_0x4a7bcb=_0x4a7bcb-0x1c6;const _0x224a7f=a23_0x224a();let _0x20bcda=_0x224a7f[_0x4a7bcb];return _0x20bcda;}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';function a23_0x224a(){const _0x31a077=['\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','19lAdWLL','tdx:\x20profile\x20remove','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','execute','Set\x20a\x20profile\x20configuration\x20value','test','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','status','tdx.json','10LwxFsZ','select','message','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','name','Default\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','includes','ERROR','\x20\x20-\x20','✗\x20Validation\x20failed:\x20','Unknown\x20key\x20\x27','Removal\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','596028UmzAlX','\x20API\x20key\x20is\x20valid\x20(User:\x20','2596riXLtM','\x20--default\x27\x20to\x20save\x20permanently','length','\x0aSaved\x20to:\x20','\x20Profile\x20\x27','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','API\x20key\x20cannot\x20be\x20empty','Validating\x20API\x20key...','1761963soaXrZ','log','join','\x27\x20requires\x20API\x20key\x20validation.','password','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','1010UJGFgT','trim','session','default','llm_project','Remove\x20a\x20profile','description','Failed\x20to\x20remove\x20profile:\x20','\x0aSetup\x20cancelled','tdx:\x20profile\x20set','\x20\x20tdx\x20--profile\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','dim','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Site\x20name\x20cannot\x20be\x20empty','text','Set\x20session\x20profile','error','profile:set','profile:use','apiKey','\x20\x20(no\x20profiles\x20found)','green','539109PafDxJ','llm_agent','warn','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','/app/mp/ak','validate','\x27\x20removed\x20from\x20configuration','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x0aAvailable\x20profiles:','split','red','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20created','(session:\x20','1215sSjssy','Changing\x20site\x20to\x20\x27','profileName','jobs','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','getUserInfo','profile:create','customSite','Profile\x20\x27','VALID_KEYS','profile','email','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>','(cleared)','Enter\x20your\x20TD\x20API\x20key:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','parent_segment','confirm','create','1899464haJhuV','bold','Site\x20was\x20not\x20changed.','yellow','Create\x20a\x20new\x20profile','site','3554703BMsqKr','logLevel'];a23_0x224a=function(){return _0x31a077;};return a23_0x224a();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x362c5f from'prompts';import a23_0x512a1e from'chalk';function validateProfileName(_0x544d4f){const _0x29db64=a23_0x20bc;if(!_0x544d4f||!_0x544d4f['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x34ccaa=_0x544d4f[_0x29db64(0x1e2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x29db64(0x228)](_0x34ccaa))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x34ccaa))return'Profile\x20\x27'+_0x34ccaa+_0x29db64(0x222);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x20c);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x21e);async[a23_0x1cddb2(0x226)](_0x5e4ae4){const _0x9fa00b=a23_0x1cddb2,{options:_0x30180e,args:_0x2285cd}=_0x5e4ae4;console[_0x9fa00b(0x1dc)](a23_0x512a1e[_0x9fa00b(0x21b)]('tdx:\x20profile\x20create'));let _0x99fee3;if(_0x2285cd[_0x9fa00b(0x1d5)]>0x0&&_0x2285cd[0x0]){const _0x42a588=_0x2285cd[0x0][_0x9fa00b(0x1e2)](),_0x282cf8=validateProfileName(_0x42a588);if(_0x282cf8!==!![])return console[_0x9fa00b(0x1f2)](a23_0x512a1e[_0x9fa00b(0x202)](_0x282cf8)),0x1;_0x99fee3=_0x42a588;}else{const _0xebd314=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x208),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0xebd314['profileName'])return console['log'](_0x9fa00b(0x1e9)),0x1;_0x99fee3=_0xebd314[_0x9fa00b(0x208)][_0x9fa00b(0x1e2)]();}const _0x4e9de9=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x1e7),'message':'Enter\x20description\x20(optional):'}),_0x39c3a5=_0x4e9de9[_0x9fa00b(0x1e7)]?.[_0x9fa00b(0x1e2)]()||undefined,_0x12aa34=_0x30180e[_0x9fa00b(0x21f)]||'us01',{choices:_0x1a4937,initialIndex:_0x2ae1bb}=buildSiteChoices(_0x12aa34),_0x40eec4=await a23_0x362c5f({'type':_0x9fa00b(0x22d),'name':_0x9fa00b(0x21f),'message':_0x9fa00b(0x1ff)+_0x99fee3+'\x27:','choices':_0x1a4937,'initial':_0x2ae1bb});if(!_0x40eec4[_0x9fa00b(0x21f)])return console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1e9)),0x1;let _0x3aa3c9;if(_0x40eec4[_0x9fa00b(0x21f)]==='other'){const _0x5d265c=await a23_0x362c5f({'type':_0x9fa00b(0x1f0),'name':_0x9fa00b(0x20d),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x3fe43d=>{const _0x31f608=_0x9fa00b;if(!_0x3fe43d||!_0x3fe43d['trim']())return _0x31f608(0x1ef);if(!/^[a-z0-9-]+$/[_0x31f608(0x228)](_0x3fe43d[_0x31f608(0x1e2)]()))return _0x31f608(0x216);return!![];}});if(!_0x5d265c[_0x9fa00b(0x20d)])return console[_0x9fa00b(0x1dc)]('\x0aSetup\x20cancelled'),0x1;_0x3aa3c9=_0x5d265c[_0x9fa00b(0x20d)];}else _0x3aa3c9=_0x40eec4[_0x9fa00b(0x21f)];const _0x41f9e1=resolveSite(_0x3aa3c9);console['log'](_0x9fa00b(0x1ee)+_0x41f9e1),console['log'](_0x9fa00b(0x22f)),console[_0x9fa00b(0x1dc)]('\x20\x20'+getConsoleUrl(_0x41f9e1,_0x9fa00b(0x1fc)));const _0x13a6d9=await a23_0x362c5f({'type':'password','name':_0x9fa00b(0x1f5),'message':_0x9fa00b(0x214),'validate':_0x5d8f8a=>{const _0x4e1387=_0x9fa00b;if(!_0x5d8f8a||!_0x5d8f8a[_0x4e1387(0x1e2)]())return _0x4e1387(0x1d9);return!![];}});if(!_0x13a6d9[_0x9fa00b(0x1f5)])return console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1e9)),0x1;const _0x1f960f=_0x13a6d9[_0x9fa00b(0x1f5)];console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1da));try{const _0x5b15af=TDX['create']({'site':_0x41f9e1,'apiKey':_0x1f960f[_0x9fa00b(0x1e2)](),'logLevel':_0x30180e[_0x9fa00b(0x221)]??LogLevel['ERROR']}),_0xd5ed59=await _0x5b15af['jobs'][_0x9fa00b(0x20b)]();console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+_0x9fa00b(0x1d2)+_0xd5ed59[_0x9fa00b(0x211)]+')');const _0x41df59=await isKeychainAvailable();_0x41df59?(await saveAPIKeyAsync(_0x1f960f[_0x9fa00b(0x1e2)](),_0x41f9e1,_0x99fee3),console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x99fee3+')')):(console[_0x9fa00b(0x1fa)](a23_0x512a1e[_0x9fa00b(0x21d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x9fa00b(0x1fa)](a23_0x512a1e['yellow'](_0x9fa00b(0x1d8))));const _0x202487={'site':_0x41f9e1,..._0x39c3a5&&{'description':_0x39c3a5}};return saveProfileToUserConfig(_0x99fee3,_0x202487),console[_0x9fa00b(0x1dc)](a23_0x512a1e['green']('✓')+_0x9fa00b(0x1d7)+_0x99fee3+_0x9fa00b(0x204)),console[_0x9fa00b(0x1dc)](),console[_0x9fa00b(0x1dc)](_0x9fa00b(0x203)),console[_0x9fa00b(0x1dc)]('\x20\x20tdx\x20--profile\x20'+_0x99fee3+_0x9fa00b(0x215)),console[_0x9fa00b(0x1dc)](_0x9fa00b(0x1eb)+_0x99fee3+_0x9fa00b(0x20a)),0x0;}catch(_0x4d15ed){if(_0x4d15ed instanceof HTTPClientError&&_0x4d15ed[_0x9fa00b(0x22a)]===0x191)return printAuthError(_0x4d15ed),0x1;return console[_0x9fa00b(0x1f2)](a23_0x512a1e[_0x9fa00b(0x202)](_0x9fa00b(0x1cd)+(_0x4d15ed instanceof Error?_0x4d15ed[_0x9fa00b(0x22e)]:String(_0x4d15ed)))),console[_0x9fa00b(0x1f2)](_0x9fa00b(0x1c6)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]='profile:remove';[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x1e6);[a23_0x1cddb2(0x1fd)](_0x5b9789){const _0x540804=a23_0x1cddb2,{args:_0x3ccee8}=_0x5b9789;if(_0x3ccee8[_0x540804(0x1d5)]===0x0)return _0x540804(0x1e0);return undefined;}async['execute'](_0x5b66e0){const _0x3bf752=a23_0x1cddb2,{args:_0x31742}=_0x5b66e0,_0x270b8d=_0x31742[0x0];console['log'](a23_0x512a1e['bold'](_0x3bf752(0x224)));if(!profileExists(_0x270b8d)){console[_0x3bf752(0x1f2)](a23_0x512a1e[_0x3bf752(0x202)](_0x3bf752(0x20e)+_0x270b8d+_0x3bf752(0x1c9))),console[_0x3bf752(0x1dc)](_0x3bf752(0x200));const _0x31ff51=listProfiles();if(_0x31ff51['length']===0x0)console[_0x3bf752(0x1dc)](_0x3bf752(0x1f6));else for(const _0x14b407 of _0x31ff51){console['log']('\x20\x20-\x20'+_0x14b407['name']);}return 0x1;}const _0xd820cf=await a23_0x362c5f({'type':_0x3bf752(0x218),'name':_0x3bf752(0x218),'message':_0x3bf752(0x1d0)+_0x270b8d+'\x27?','initial':![]});if(!_0xd820cf[_0x3bf752(0x218)])return console[_0x3bf752(0x1dc)](_0x3bf752(0x1cf)),0x0;try{removeProfileFromUserConfig(_0x270b8d),console[_0x3bf752(0x1dc)](a23_0x512a1e[_0x3bf752(0x1f7)]('✓')+_0x3bf752(0x1d7)+_0x270b8d+_0x3bf752(0x1fe));}catch(_0x57d0c4){return console[_0x3bf752(0x1f2)](a23_0x512a1e[_0x3bf752(0x202)](_0x3bf752(0x1e8)+(_0x57d0c4 instanceof Error?_0x57d0c4['message']:String(_0x57d0c4)))),0x1;}const _0x1cc0e5=await isKeychainAvailable();if(_0x1cc0e5){const _0x3c45db=await deleteKeychainAPIKey(_0x270b8d);_0x3c45db&&console[_0x3bf752(0x1dc)](a23_0x512a1e[_0x3bf752(0x1f7)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x1f3);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x227);static [a23_0x1cddb2(0x20f)]=[a23_0x1cddb2(0x21f),'database',a23_0x1cddb2(0x217),a23_0x1cddb2(0x1e5),a23_0x1cddb2(0x1f9),a23_0x1cddb2(0x1e7)];[a23_0x1cddb2(0x1fd)](_0x42352d){const _0xaaa673=a23_0x1cddb2,{args:_0x9dbfb7,options:_0x5a13de}=_0x42352d,_0x1d6397=_0x5a13de[_0xaaa673(0x210)]||getActiveProfile();if(!_0x1d6397)return _0xaaa673(0x212);if(_0x9dbfb7[_0xaaa673(0x1d5)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xaaa673(0x20f)][_0xaaa673(0x1dd)](',\x20');const _0x161565=_0x9dbfb7[0x0];if(!_0x161565[_0xaaa673(0x1ca)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xaaa673(0x20f)][_0xaaa673(0x1dd)](',\x20');const [_0x5f345a]=_0x161565[_0xaaa673(0x201)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0xaaa673(0x1ca)](_0x5f345a))return _0xaaa673(0x1ce)+_0x5f345a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a23_0x1cddb2(0x226)](_0x35c750){const _0x1863b0=a23_0x1cddb2,{args:_0x4a8eb6,options:_0x267d2c}=_0x35c750,_0x4fa59f=_0x267d2c[_0x1863b0(0x210)]||getActiveProfile(),[_0x3286ed,..._0x116793]=_0x4a8eb6[0x0][_0x1863b0(0x201)]('='),_0xd182c4=_0x116793[_0x1863b0(0x1dd)]('=');console['log'](a23_0x512a1e['bold'](_0x1863b0(0x1ea)));if(!profileExists(_0x4fa59f)){const _0x3cb746=await a23_0x362c5f({'type':_0x1863b0(0x218),'name':_0x1863b0(0x219),'message':_0x1863b0(0x20e)+_0x4fa59f+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x3cb746['create'])return console[_0x1863b0(0x1dc)]('Operation\x20cancelled'),0x1;}const _0x36c96f=loadProfile(_0x4fa59f),_0x48770a=_0x36c96f?.['config']||{};if(_0x3286ed===_0x1863b0(0x21f)){const _0xf9af4b=resolveSite(_0xd182c4);console[_0x1863b0(0x1dc)](_0x1863b0(0x207)+_0xf9af4b+_0x1863b0(0x1de)),console[_0x1863b0(0x1dc)](_0x1863b0(0x225)),console[_0x1863b0(0x1dc)]('\x20\x20'+getConsoleUrl(_0xf9af4b,'/app/mp/ak'));const _0x4d7439=await a23_0x362c5f({'type':_0x1863b0(0x1df),'name':_0x1863b0(0x1f5),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x4457b1=>{const _0x95a9aa=_0x1863b0;if(!_0x4457b1||!_0x4457b1[_0x95a9aa(0x1e2)]())return _0x95a9aa(0x1d9);return!![];}});if(!_0x4d7439[_0x1863b0(0x1f5)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x1863b0(0x1dc)](_0x1863b0(0x1da));try{const _0xdeebdc=TDX[_0x1863b0(0x219)]({'site':_0xf9af4b,'apiKey':_0x4d7439['apiKey'][_0x1863b0(0x1e2)](),'logLevel':_0x267d2c[_0x1863b0(0x221)]??LogLevel[_0x1863b0(0x1cb)]}),_0x333c24=await _0xdeebdc[_0x1863b0(0x209)][_0x1863b0(0x20b)]();console[_0x1863b0(0x1dc)](a23_0x512a1e[_0x1863b0(0x1f7)]('✓')+_0x1863b0(0x1d2)+_0x333c24['email']+')');const _0x5b6d8d=await isKeychainAvailable();_0x5b6d8d?(await saveAPIKeyAsync(_0x4d7439[_0x1863b0(0x1f5)][_0x1863b0(0x1e2)](),_0xf9af4b,_0x4fa59f),console[_0x1863b0(0x1dc)](a23_0x512a1e['green']('✓')+_0x1863b0(0x1ec))):console[_0x1863b0(0x1fa)](a23_0x512a1e[_0x1863b0(0x21d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x48770a[_0x1863b0(0x21f)]=_0xf9af4b;}catch(_0xac1595){if(_0xac1595 instanceof HTTPClientError&&_0xac1595['status']===0x191)return printAuthError(_0xac1595),0x1;return console[_0x1863b0(0x1f2)](a23_0x512a1e[_0x1863b0(0x202)](_0x1863b0(0x1cd)+(_0xac1595 instanceof Error?_0xac1595[_0x1863b0(0x22e)]:String(_0xac1595)))),console[_0x1863b0(0x1f2)](_0x1863b0(0x21c)),0x1;}}else _0x48770a[_0x3286ed]=_0xd182c4||undefined;return saveProfileToUserConfig(_0x4fa59f,_0x48770a),console[_0x1863b0(0x1dc)](a23_0x512a1e[_0x1863b0(0x1f7)]('✓')+_0x1863b0(0x1d7)+_0x4fa59f+'\x27\x20updated:\x20'+_0x3286ed+'='+(_0xd182c4||_0x1863b0(0x213))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x1cddb2(0x1c7)]=a23_0x1cddb2(0x1f4);[a23_0x1cddb2(0x1e7)]=a23_0x1cddb2(0x1f1);['validate'](_0x3b14a6){const _0x12bb02=a23_0x1cddb2,{args:_0x124c80}=_0x3b14a6;if(_0x124c80[_0x12bb02(0x1d5)]===0x0)return _0x12bb02(0x1fb);return undefined;}async[a23_0x1cddb2(0x226)](_0x37f5d5){const _0x2dd299=a23_0x1cddb2,{args:_0x1c937d,options:_0xafd8ab}=_0x37f5d5,_0x279fef=_0x1c937d[0x0],_0x29fa5c=_0xafd8ab[_0x2dd299(0x1e4)];cleanExpiredSessions();if(!profileExists(_0x279fef)){console[_0x2dd299(0x1f2)](a23_0x512a1e[_0x2dd299(0x202)](_0x2dd299(0x20e)+_0x279fef+'\x27\x20does\x20not\x20exist.')),console[_0x2dd299(0x1dc)]('\x0aAvailable\x20profiles:');const _0x2a2e66=listProfiles();if(_0x2a2e66['length']===0x0)console[_0x2dd299(0x1dc)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x248284 of _0x2a2e66){console[_0x2dd299(0x1dc)](_0x2dd299(0x1cc)+_0x248284[_0x2dd299(0x1c7)]);}return 0x1;}if(_0x29fa5c){const _0x180225=a23_0x39a501['join'](getConfigDir(),_0x2dd299(0x22b));return saveActiveProfileToUserConfig(_0x279fef),console['log'](_0x2dd299(0x1c8)+a23_0x512a1e[_0x2dd299(0x1f7)](_0x279fef)),console[_0x2dd299(0x1dc)](a23_0x512a1e[_0x2dd299(0x1ed)](_0x2dd299(0x1d6)+_0x180225)),0x0;}const _0x54fc71=getSessionID(_0xafd8ab['session']);return saveSessionContext({'profile':_0x279fef},_0xafd8ab[_0x2dd299(0x1e3)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a23_0x512a1e[_0x2dd299(0x1f7)](_0x279fef)+'\x20'+a23_0x512a1e['dim'](_0x2dd299(0x205)+_0x54fc71+')')),console['log'](a23_0x512a1e['dim'](_0x2dd299(0x229)+_0x279fef+_0x2dd299(0x1d4))),0x0;}}
|
|
1
|
+
const a23_0x8dce31=a23_0x2943;(function(_0x34e3ec,_0x2d584f){const _0x55439e=a23_0x2943,_0x28c99d=_0x34e3ec();while(!![]){try{const _0x58c82b=parseInt(_0x55439e(0x17f))/0x1*(-parseInt(_0x55439e(0x182))/0x2)+parseInt(_0x55439e(0x19b))/0x3*(parseInt(_0x55439e(0x13e))/0x4)+parseInt(_0x55439e(0x16c))/0x5*(-parseInt(_0x55439e(0x14f))/0x6)+-parseInt(_0x55439e(0x161))/0x7*(-parseInt(_0x55439e(0x17b))/0x8)+parseInt(_0x55439e(0x189))/0x9*(-parseInt(_0x55439e(0x1a4))/0xa)+-parseInt(_0x55439e(0x171))/0xb*(-parseInt(_0x55439e(0x17a))/0xc)+parseInt(_0x55439e(0x197))/0xd;if(_0x58c82b===_0x2d584f)break;else _0x28c99d['push'](_0x28c99d['shift']());}catch(_0x344e47){_0x28c99d['push'](_0x28c99d['shift']());}}}(a23_0x2599,0x1fb98));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x445a7e from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x2fff0b from'prompts';import a23_0x4c3044 from'chalk';function a23_0x2599(){const _0x1b23f8=['\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Operation\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Default\x20profile\x20set\x20to:\x20','other','email','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','green','Set\x20a\x20profile\x20configuration\x20value','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','5780CJfFtx','bold','profile:use','site','test','warn','Failed\x20to\x20remove\x20profile:\x20','Changing\x20site\x20to\x20\x27','profile:remove','tdx:\x20profile\x20remove','status','customSite','trim','tdx.json','password','Validating\x20API\x20key...','us01','35274wxXbAi','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Site\x20name\x20cannot\x20be\x20empty','confirm','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','select','dim','profile:create','\x27\x20removed\x20from\x20configuration','jobs','\x27\x20created','yellow','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSaved\x20to:\x20','includes','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','602FssuQt','execute','name','\x20\x20-\x20','\x0aSetup\x20cancelled','llm_agent','validate','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20updated:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','5ukJNSg','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','apiKey','red','2191442fHiVdE','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','text','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Profile\x20\x27','config','/app/mp/ak','split','join','12BkJnTK','16472hZWwjq','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','Enter\x20site\x20name:','641IQXqHs','default','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','778QnKzJZ','parent_segment','Create\x20a\x20new\x20profile','\x0aOperation\x20cancelled','\x0aAvailable\x20profiles:','Removal\x20cancelled','description','20187OtVPPG','\x27\x20does\x20not\x20exist.','profile','tdx:\x20profile\x20create','log','(cleared)','Unknown\x20key\x20\x27','\x20\x20(no\x20profiles\x20found)','Set\x20session\x20profile','create','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile:set','error','session','1113814KFCRrX','message','\x20--default\x27\x20to\x20save\x20permanently','✗\x20Validation\x20failed:\x20','255rupTxs','\x20\x20tdx\x20--profile\x20','Site\x20was\x20not\x20changed.','API\x20key\x20cannot\x20be\x20empty','(session:\x20','ERROR','profileName','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','VALID_KEYS','890IUnEwl','logLevel','length','Session\x20profile\x20set\x20to:\x20','Enter\x20profile\x20name:'];a23_0x2599=function(){return _0x1b23f8;};return a23_0x2599();}function validateProfileName(_0x251a1c){const _0x448d59=a23_0x2943;if(!_0x251a1c||!_0x251a1c[_0x448d59(0x14a)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x265e90=_0x251a1c['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x265e90))return _0x448d59(0x17c);if(profileExists(_0x265e90))return'Profile\x20\x27'+_0x265e90+_0x448d59(0x1af);return!![];}function a23_0x2943(_0x35ba2b,_0x273b43){_0x35ba2b=_0x35ba2b-0x13a;const _0x259944=a23_0x2599();let _0x29436c=_0x259944[_0x35ba2b];return _0x29436c;}export class ProfileCreateCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x157);[a23_0x8dce31(0x188)]=a23_0x8dce31(0x184);async[a23_0x8dce31(0x162)](_0x59090c){const _0x57c3b9=a23_0x8dce31,{options:_0x34e9be,args:_0x284290}=_0x59090c;console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x13f)](_0x57c3b9(0x18c)));let _0x13d3f6;if(_0x284290[_0x57c3b9(0x1a6)]>0x0&&_0x284290[0x0]){const _0x4cd9ac=_0x284290[0x0][_0x57c3b9(0x14a)](),_0x31be40=validateProfileName(_0x4cd9ac);if(_0x31be40!==!![])return console[_0x57c3b9(0x195)](a23_0x4c3044[_0x57c3b9(0x170)](_0x31be40)),0x1;_0x13d3f6=_0x4cd9ac;}else{const _0x680f28=await a23_0x2fff0b({'type':_0x57c3b9(0x173),'name':_0x57c3b9(0x1a1),'message':_0x57c3b9(0x1a8),'validate':validateProfileName});if(!_0x680f28[_0x57c3b9(0x1a1)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x13d3f6=_0x680f28['profileName'][_0x57c3b9(0x14a)]();}const _0x44828d=await a23_0x2fff0b({'type':_0x57c3b9(0x173),'name':_0x57c3b9(0x188),'message':'Enter\x20description\x20(optional):'}),_0x38b8a7=_0x44828d[_0x57c3b9(0x188)]?.['trim']()||undefined,_0x4b92b6=_0x34e9be[_0x57c3b9(0x141)]||_0x57c3b9(0x14e),{choices:_0x5ef065,initialIndex:_0x4d14e0}=buildSiteChoices(_0x4b92b6),_0x389e98=await a23_0x2fff0b({'type':_0x57c3b9(0x155),'name':'site','message':_0x57c3b9(0x1a2)+_0x13d3f6+'\x27:','choices':_0x5ef065,'initial':_0x4d14e0});if(!_0x389e98[_0x57c3b9(0x141)])return console[_0x57c3b9(0x18d)]('\x0aSetup\x20cancelled'),0x1;let _0x418ceb;if(_0x389e98[_0x57c3b9(0x141)]===_0x57c3b9(0x1ad)){const _0x429524=await a23_0x2fff0b({'type':'text','name':_0x57c3b9(0x149),'message':_0x57c3b9(0x17e),'initial':_0x57c3b9(0x14e),'validate':_0x4b57d2=>{const _0x34e3d1=_0x57c3b9;if(!_0x4b57d2||!_0x4b57d2[_0x34e3d1(0x14a)]())return _0x34e3d1(0x151);if(!/^[a-z0-9-]+$/[_0x34e3d1(0x142)](_0x4b57d2[_0x34e3d1(0x14a)]()))return _0x34e3d1(0x1ab);return!![];}});if(!_0x429524[_0x57c3b9(0x149)])return console['log'](_0x57c3b9(0x165)),0x1;_0x418ceb=_0x429524[_0x57c3b9(0x149)];}else _0x418ceb=_0x389e98[_0x57c3b9(0x141)];const _0x1641ff=resolveSite(_0x418ceb);console[_0x57c3b9(0x18d)](_0x57c3b9(0x181)+_0x1641ff),console[_0x57c3b9(0x18d)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x57c3b9(0x18d)]('\x20\x20'+getConsoleUrl(_0x1641ff,_0x57c3b9(0x177)));const _0xc24ad0=await a23_0x2fff0b({'type':_0x57c3b9(0x14c),'name':'apiKey','message':_0x57c3b9(0x153),'validate':_0x7cb96d=>{const _0x365576=_0x57c3b9;if(!_0x7cb96d||!_0x7cb96d['trim']())return _0x365576(0x19e);return!![];}});if(!_0xc24ad0[_0x57c3b9(0x16f)])return console[_0x57c3b9(0x18d)](_0x57c3b9(0x165)),0x1;const _0x152abe=_0xc24ad0['apiKey'];console[_0x57c3b9(0x18d)](_0x57c3b9(0x14d));try{const _0x3ddcc6=TDX[_0x57c3b9(0x192)]({'site':_0x1641ff,'apiKey':_0x152abe[_0x57c3b9(0x14a)](),'logLevel':_0x34e9be[_0x57c3b9(0x1a5)]??LogLevel[_0x57c3b9(0x1a0)]}),_0x52edad=await _0x3ddcc6[_0x57c3b9(0x159)][_0x57c3b9(0x17d)]();console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x193)+_0x52edad[_0x57c3b9(0x1ae)]+')');const _0x3fe967=await isKeychainAvailable();_0x3fe967?(await saveAPIKeyAsync(_0x152abe[_0x57c3b9(0x14a)](),_0x1641ff,_0x13d3f6),console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x1a9)+_0x13d3f6+')')):(console[_0x57c3b9(0x143)](a23_0x4c3044[_0x57c3b9(0x15b)](_0x57c3b9(0x16e))),console[_0x57c3b9(0x143)](a23_0x4c3044[_0x57c3b9(0x15b)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x103885={'site':_0x1641ff,..._0x38b8a7&&{'description':_0x38b8a7}};return saveProfileToUserConfig(_0x13d3f6,_0x103885),console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x154)+_0x13d3f6+_0x57c3b9(0x15a)),console['log'](),console[_0x57c3b9(0x18d)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x57c3b9(0x18d)]('\x20\x20tdx\x20--profile\x20'+_0x13d3f6+_0x57c3b9(0x16d)),console[_0x57c3b9(0x18d)](_0x57c3b9(0x19c)+_0x13d3f6+_0x57c3b9(0x16b)),0x0;}catch(_0x2dda72){if(_0x2dda72 instanceof HTTPClientError&&_0x2dda72['status']===0x191)return printAuthError(_0x2dda72),0x1;return console['error'](a23_0x4c3044[_0x57c3b9(0x170)]('✗\x20Validation\x20failed:\x20'+(_0x2dda72 instanceof Error?_0x2dda72[_0x57c3b9(0x198)]:String(_0x2dda72)))),console[_0x57c3b9(0x195)](_0x57c3b9(0x13b)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x8dce31(0x146);[a23_0x8dce31(0x188)]='Remove\x20a\x20profile';[a23_0x8dce31(0x167)](_0x42cb33){const _0x267b2a=a23_0x8dce31,{args:_0x502f5d}=_0x42cb33;if(_0x502f5d[_0x267b2a(0x1a6)]===0x0)return _0x267b2a(0x174);return undefined;}async['execute'](_0x41f3e3){const _0xd801ce=a23_0x8dce31,{args:_0x458971}=_0x41f3e3,_0x250eb0=_0x458971[0x0];console[_0xd801ce(0x18d)](a23_0x4c3044[_0xd801ce(0x13f)](_0xd801ce(0x147)));if(!profileExists(_0x250eb0)){console[_0xd801ce(0x195)](a23_0x4c3044['red'](_0xd801ce(0x175)+_0x250eb0+'\x27\x20does\x20not\x20exist.')),console[_0xd801ce(0x18d)]('\x0aAvailable\x20profiles:');const _0x31f13b=listProfiles();if(_0x31f13b[_0xd801ce(0x1a6)]===0x0)console[_0xd801ce(0x18d)](_0xd801ce(0x190));else for(const _0x69be22 of _0x31f13b){console[_0xd801ce(0x18d)]('\x20\x20-\x20'+_0x69be22[_0xd801ce(0x163)]);}return 0x1;}const _0x19e0df=await a23_0x2fff0b({'type':'confirm','name':'confirm','message':_0xd801ce(0x15d)+_0x250eb0+'\x27?','initial':![]});if(!_0x19e0df['confirm'])return console[_0xd801ce(0x18d)](_0xd801ce(0x187)),0x0;try{removeProfileFromUserConfig(_0x250eb0),console['log'](a23_0x4c3044[_0xd801ce(0x1b0)]('✓')+'\x20Profile\x20\x27'+_0x250eb0+_0xd801ce(0x158));}catch(_0x27b65a){return console[_0xd801ce(0x195)](a23_0x4c3044['red'](_0xd801ce(0x144)+(_0x27b65a instanceof Error?_0x27b65a[_0xd801ce(0x198)]:String(_0x27b65a)))),0x1;}const _0x3b959b=await isKeychainAvailable();if(_0x3b959b){const _0x30898e=await deleteKeychainAPIKey(_0x250eb0);_0x30898e&&console['log'](a23_0x4c3044[_0xd801ce(0x1b0)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x194);[a23_0x8dce31(0x188)]=a23_0x8dce31(0x13a);static [a23_0x8dce31(0x1a3)]=['site','database',a23_0x8dce31(0x183),'llm_project',a23_0x8dce31(0x166),'description'];[a23_0x8dce31(0x167)](_0x46c863){const _0x18984f=a23_0x8dce31,{args:_0x380760,options:_0x9b83e7}=_0x46c863,_0x446bbf=_0x9b83e7['profile']||getActiveProfile();if(!_0x446bbf)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x380760[_0x18984f(0x1a6)]===0x0)return _0x18984f(0x160)+ProfileSetCommand[_0x18984f(0x1a3)][_0x18984f(0x179)](',\x20');const _0x30db5b=_0x380760[0x0];if(!_0x30db5b[_0x18984f(0x15f)]('='))return _0x18984f(0x13d)+ProfileSetCommand[_0x18984f(0x1a3)]['join'](',\x20');const [_0x53b43a]=_0x30db5b[_0x18984f(0x178)]('=',0x2);if(!ProfileSetCommand[_0x18984f(0x1a3)][_0x18984f(0x15f)](_0x53b43a))return _0x18984f(0x18f)+_0x53b43a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x18984f(0x1a3)]['join'](',\x20');return undefined;}async[a23_0x8dce31(0x162)](_0x261aac){const _0x3fad35=a23_0x8dce31,{args:_0x447f0c,options:_0x5a2ac9}=_0x261aac,_0xb8093a=_0x5a2ac9[_0x3fad35(0x18b)]||getActiveProfile(),[_0x47e690,..._0x51b3a0]=_0x447f0c[0x0][_0x3fad35(0x178)]('='),_0x4196b2=_0x51b3a0[_0x3fad35(0x179)]('=');console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x13f)]('tdx:\x20profile\x20set'));if(!profileExists(_0xb8093a)){const _0x4c900d=await a23_0x2fff0b({'type':_0x3fad35(0x152),'name':_0x3fad35(0x192),'message':_0x3fad35(0x175)+_0xb8093a+_0x3fad35(0x168),'initial':!![]});if(!_0x4c900d[_0x3fad35(0x192)])return console[_0x3fad35(0x18d)](_0x3fad35(0x1aa)),0x1;}const _0x331782=loadProfile(_0xb8093a),_0x4a9121=_0x331782?.[_0x3fad35(0x176)]||{};if(_0x47e690===_0x3fad35(0x141)){const _0x13345d=resolveSite(_0x4196b2);console['log'](_0x3fad35(0x145)+_0x13345d+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3fad35(0x18d)](_0x3fad35(0x169)),console[_0x3fad35(0x18d)]('\x20\x20'+getConsoleUrl(_0x13345d,'/app/mp/ak'));const _0xae7892=await a23_0x2fff0b({'type':'password','name':'apiKey','message':_0x3fad35(0x13c),'validate':_0xebae47=>{if(!_0xebae47||!_0xebae47['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xae7892[_0x3fad35(0x16f)])return console[_0x3fad35(0x18d)](_0x3fad35(0x185)),0x1;console['log'](_0x3fad35(0x14d));try{const _0x2636f2=TDX[_0x3fad35(0x192)]({'site':_0x13345d,'apiKey':_0xae7892[_0x3fad35(0x16f)][_0x3fad35(0x14a)](),'logLevel':_0x5a2ac9[_0x3fad35(0x1a5)]??LogLevel[_0x3fad35(0x1a0)]}),_0x4aad2b=await _0x2636f2[_0x3fad35(0x159)][_0x3fad35(0x17d)]();console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x1b0)]('✓')+_0x3fad35(0x193)+_0x4aad2b['email']+')');const _0x484084=await isKeychainAvailable();_0x484084?(await saveAPIKeyAsync(_0xae7892[_0x3fad35(0x16f)][_0x3fad35(0x14a)](),_0x13345d,_0xb8093a),console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x1b0)]('✓')+_0x3fad35(0x150))):console[_0x3fad35(0x143)](a23_0x4c3044[_0x3fad35(0x15b)](_0x3fad35(0x16e))),_0x4a9121[_0x3fad35(0x141)]=_0x13345d;}catch(_0x539106){if(_0x539106 instanceof HTTPClientError&&_0x539106[_0x3fad35(0x148)]===0x191)return printAuthError(_0x539106),0x1;return console[_0x3fad35(0x195)](a23_0x4c3044['red'](_0x3fad35(0x19a)+(_0x539106 instanceof Error?_0x539106['message']:String(_0x539106)))),console['error'](_0x3fad35(0x19d)),0x1;}}else _0x4a9121[_0x47e690]=_0x4196b2||undefined;return saveProfileToUserConfig(_0xb8093a,_0x4a9121),console['log'](a23_0x4c3044['green']('✓')+_0x3fad35(0x154)+_0xb8093a+_0x3fad35(0x16a)+_0x47e690+'='+(_0x4196b2||_0x3fad35(0x18e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x140);['description']=a23_0x8dce31(0x191);[a23_0x8dce31(0x167)](_0x22cb1f){const _0x146897=a23_0x8dce31,{args:_0x254b64}=_0x22cb1f;if(_0x254b64['length']===0x0)return _0x146897(0x15c);return undefined;}async[a23_0x8dce31(0x162)](_0x18f772){const _0x350d7f=a23_0x8dce31,{args:_0x3f4eb2,options:_0x1f76cb}=_0x18f772,_0x599979=_0x3f4eb2[0x0],_0x4f4643=_0x1f76cb[_0x350d7f(0x180)];cleanExpiredSessions();if(!profileExists(_0x599979)){console[_0x350d7f(0x195)](a23_0x4c3044['red'](_0x350d7f(0x175)+_0x599979+_0x350d7f(0x18a))),console['log'](_0x350d7f(0x186));const _0x5bec1f=listProfiles();if(_0x5bec1f[_0x350d7f(0x1a6)]===0x0)console[_0x350d7f(0x18d)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x5da9eb of _0x5bec1f){console[_0x350d7f(0x18d)](_0x350d7f(0x164)+_0x5da9eb[_0x350d7f(0x163)]);}return 0x1;}if(_0x4f4643){const _0xe991b2=a23_0x445a7e[_0x350d7f(0x179)](getConfigDir(),_0x350d7f(0x14b));return saveActiveProfileToUserConfig(_0x599979),console['log'](_0x350d7f(0x1ac)+a23_0x4c3044[_0x350d7f(0x1b0)](_0x599979)),console[_0x350d7f(0x18d)](a23_0x4c3044[_0x350d7f(0x156)](_0x350d7f(0x15e)+_0xe991b2)),0x0;}const _0xe286a2=getSessionID(_0x1f76cb[_0x350d7f(0x196)]);return saveSessionContext({'profile':_0x599979},_0x1f76cb[_0x350d7f(0x196)]),console[_0x350d7f(0x18d)](_0x350d7f(0x1a7)+a23_0x4c3044[_0x350d7f(0x1b0)](_0x599979)+'\x20'+a23_0x4c3044['dim'](_0x350d7f(0x19f)+_0xe286a2+')')),console[_0x350d7f(0x18d)](a23_0x4c3044['dim'](_0x350d7f(0x172)+_0x599979+_0x350d7f(0x199))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x22774e=a24_0x271d;function a24_0x4b85(){const _0x1905f2=['121112nqZADW','260OiLiAy','log','execute','11942270uvtspY','description','List\x20all\x20available\x20profiles','3mffKyy','scope','map','3318240dfLwhq','\x20\x20Global:\x20~/.config/tdx/tdx.json','config','message','779724aJKFwa','168PmVxlg','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1643944WwoVEf','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','length','4898214WakzQL','142LkoGcI','error'];a24_0x4b85=function(){return _0x1905f2;};return a24_0x4b85();}function a24_0x271d(_0x5ee039,_0x432f13){_0x5ee039=_0x5ee039-0xec;const _0x4b85de=a24_0x4b85();let _0x271d3f=_0x4b85de[_0x5ee039];return _0x271d3f;}(function(_0x26e012,_0x5c4f61){const _0x30c917=a24_0x271d,_0x4bb2c5=_0x26e012();while(!![]){try{const _0x30f16e=parseInt(_0x30c917(0xed))/0x1*(-parseInt(_0x30c917(0x103))/0x2)+-parseInt(_0x30c917(0xf3))/0x3*(parseInt(_0x30c917(0xfd))/0x4)+-parseInt(_0x30c917(0xf6))/0x5+parseInt(_0x30c917(0xfa))/0x6+-parseInt(_0x30c917(0xfb))/0x7*(parseInt(_0x30c917(0xec))/0x8)+parseInt(_0x30c917(0x102))/0x9+parseInt(_0x30c917(0xf0))/0xa;if(_0x30f16e===_0x5c4f61)break;else _0x4bb2c5['push'](_0x4bb2c5['shift']());}catch(_0x29652d){_0x4bb2c5['push'](_0x4bb2c5['shift']());}}}(a24_0x4b85,0x6495d));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x22774e(0xfe)]=a24_0x22774e(0x100);[a24_0x22774e(0xf1)]=a24_0x22774e(0xf2);async[a24_0x22774e(0xef)](_0x5bc474){const _0x4dc7b9=a24_0x22774e,{options:_0x44a742}=_0x5bc474;try{const _0x4eda06=listProfiles(),_0x5c3aab=getActiveProfile();if(_0x4eda06[_0x4dc7b9(0x101)]===0x0)return console[_0x4dc7b9(0xee)](_0x4dc7b9(0xff)),console[_0x4dc7b9(0xee)](_0x4dc7b9(0xfc)),console[_0x4dc7b9(0xee)](_0x4dc7b9(0xf7)),0x0;const _0x337b93=_0x4eda06[_0x4dc7b9(0xf5)](_0xb091b5=>{const _0x4c87a7=_0x4dc7b9,_0x28455b=_0xb091b5[_0x4c87a7(0xfe)]===_0x5c3aab,_0x3cc3e6=getProfileParams(_0xb091b5[_0x4c87a7(0xf8)]);return{'name':_0xb091b5[_0x4c87a7(0xfe)],'active':_0x28455b,'scope':_0xb091b5[_0x4c87a7(0xf4)],'description':_0xb091b5['config'][_0x4c87a7(0xf1)]||'','params':_0x3cc3e6};});return await handleSDKOutput(_0x337b93,_0x44a742),0x0;}catch(_0x22c593){return _0x22c593 instanceof Error&&console[_0x4dc7b9(0x104)]('Error:\x20'+_0x22c593[_0x4dc7b9(0xf9)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x4be603=a25_0x40b7;(function(_0x59595f,_0x4e158b){const _0x2e98e8=a25_0x40b7,_0x178452=_0x59595f();while(!![]){try{const _0x433bef=-parseInt(_0x2e98e8(0x1d7))/0x1*(-parseInt(_0x2e98e8(0x1e0))/0x2)+parseInt(_0x2e98e8(0x1d9))/0x3+-parseInt(_0x2e98e8(0x1c6))/0x4*(parseInt(_0x2e98e8(0x1ce))/0x5)+-parseInt(_0x2e98e8(0x1c1))/0x6*(parseInt(_0x2e98e8(0x1d3))/0x7)+-parseInt(_0x2e98e8(0x1cd))/0x8+-parseInt(_0x2e98e8(0x1d8))/0x9+-parseInt(_0x2e98e8(0x1dc))/0xa*(-parseInt(_0x2e98e8(0x1e8))/0xb);if(_0x433bef===_0x4e158b)break;else _0x178452['push'](_0x178452['shift']());}catch(_0x3a47c2){_0x178452['push'](_0x178452['shift']());}}}(a25_0x403e,0x1b92b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x403e(){const _0xa4bf22=['site','Catalog:\x20','information_schema','message','119092PHsrhw','originalMessage','Statement\x20','No\x20SQL\x20provided','validate','\x20rows\x20','file','846416uWJgYE','5VpGeVu','length','verbose','Error:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','343WVEdEa','totalSplits','options','state','2119WMmobl','1649610ljiUBq','400971uizPjh','Executing\x20query\x20[','processedRows','1846030kbIgrt','name','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','execute','206silWmj','data','error','query','stats','description','output','Site:\x20','11lbRqus','push','in\x20','\x0aAll\x20results\x20saved\x20to\x20','database','Executing\x20statement\x20','setPhase','setJobId','completedSplits','\x20-\x20','jobId','elapsedTimeMillis','join','catalog','setExtra','\x20splits','12822eMrpTN'];a25_0x403e=function(){return _0xa4bf22;};return a25_0x403e();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a25_0x40b7(_0x3ac9bd,_0x5226ca){_0x3ac9bd=_0x3ac9bd-0x1b2;const _0x403ed6=a25_0x403e();let _0x40b7d7=_0x403ed6[_0x3ac9bd];return _0x40b7d7;}export class QueryCommand extends BaseCommand{[a25_0x4be603(0x1dd)]=a25_0x4be603(0x1e3);[a25_0x4be603(0x1e5)]='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x4be603(0x1df)](_0x3817c7){const _0x3d3875=a25_0x4be603,{options:_0x1c6507,args:_0x45f8f6,tdx:_0xd68fbd}=_0x3817c7,_0x2ec9d9=_0x45f8f6[0x0],_0x4c8f01=_0x1c6507[_0x3d3875(0x1cc)];let _0x1828d5;try{if(_0x4c8f01)_0x1828d5=readSqlStatementsFromFile(_0x4c8f01);else{if(_0x2ec9d9==='-')_0x1828d5=await readSqlStatementsFromStdin();else{if(_0x2ec9d9&&isSqlFilePath(_0x2ec9d9))_0x1828d5=readSqlStatementsFromFile(_0x2ec9d9);else{if(_0x2ec9d9)_0x1828d5=splitSqlStatements(_0x2ec9d9);else throw new Error(_0x3d3875(0x1c9));}}}}catch(_0x2cb0df){return console[_0x3d3875(0x1e2)](_0x3d3875(0x1d1)+_0x2cb0df[_0x3d3875(0x1c5)]),0x1;}const _0x115dfe=_0x1c6507[_0x3d3875(0x1b5)]||_0x3d3875(0x1c4),_0x5355da=_0x1c6507[_0x3d3875(0x1be)];try{const _0x1119f4=[],_0x202801=!!_0x1c6507['output'];for(let _0x363bd8=0x0;_0x363bd8<_0x1828d5[_0x3d3875(0x1cf)];_0x363bd8++){const _0x4a10ad=_0x1828d5[_0x363bd8],_0x3418cf=_0x363bd8+0x1,_0x509782=_0x1828d5[_0x3d3875(0x1cf)],_0x52afba=_0x509782>0x1;_0x1c6507[_0x3d3875(0x1d0)]&&(console['error']('\x0a'+(_0x52afba?_0x3d3875(0x1c8)+_0x3418cf+'/'+_0x509782+':':'')),console['error'](_0x3d3875(0x1e7)+_0x1c6507[_0x3d3875(0x1c2)]),console[_0x3d3875(0x1e2)](_0x3d3875(0x1c3)+(_0x5355da||'td')),console[_0x3d3875(0x1e2)]('Schema:\x20'+_0x115dfe),console[_0x3d3875(0x1e2)]('SQL:\x20'+_0x4a10ad));const _0x23c9f2=_0x52afba?_0x3d3875(0x1b6)+_0x3418cf+'/'+_0x509782+'...':'Executing\x20query...';try{const _0x9ebbb4=await withProgressSpinner(_0x23c9f2,async _0x53ab80=>{const _0x42a045=_0x3d3875,_0x11d4bc=await _0xd68fbd[_0x42a045(0x1e3)][_0x42a045(0x1df)](_0x4a10ad,{'catalog':_0x5355da,'schema':_0x115dfe,'onJobId':_0xad1888=>{const _0x1fdffe=_0x42a045;_0x53ab80[_0x1fdffe(0x1b8)](_0xad1888);},'onProgress':_0x1791bb=>{const _0x59450b=_0x42a045;_0x53ab80[_0x59450b(0x1b7)](_0x59450b(0x1da)+_0x1791bb[_0x59450b(0x1d6)]+']'),_0x53ab80[_0x59450b(0x1bf)](formatRows(_0x1791bb[_0x59450b(0x1db)])+'\x20rows\x20'+_0x1791bb[_0x59450b(0x1b9)]+'/'+_0x1791bb[_0x59450b(0x1d4)]+_0x59450b(0x1c0));}});return _0x11d4bc;},{'verbose':_0x1c6507[_0x3d3875(0x1d0)]}),_0x2ae358=_0x9ebbb4[_0x3d3875(0x1e1)],_0x99b002=_0x2ae358[_0x3d3875(0x1bb)]?'\x20[Job\x20ID:\x20'+_0x2ae358[_0x3d3875(0x1bb)]+']':'',_0x5dc3fb=_0x52afba?'Statement\x20'+_0x3418cf+'/'+_0x509782+_0x3d3875(0x1ba):'';console['error']('✔\x20'+_0x5dc3fb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x2ae358['stats'][_0x3d3875(0x1db)])+_0x3d3875(0x1cb)+(_0x3d3875(0x1b3)+formatElapsed(_0x2ae358[_0x3d3875(0x1e4)][_0x3d3875(0x1bc)])+_0x99b002));if(_0x52afba&&_0x202801){const _0x842581=resolveOutputOptions(_0x1c6507),_0x33f96e=await formatQueryOutput(_0x2ae358,_0x842581);_0x1119f4[_0x3d3875(0x1b2)](_0x33f96e);}else await handleQueryOutput(_0x2ae358,_0x1c6507);}catch(_0x9210eb){const _0x1e6d7d=_0x52afba?_0x3d3875(0x1c8)+_0x3418cf+'/'+_0x509782+':\x0a':'',_0x508b7a=_0x9210eb instanceof SDKError?_0x9210eb[_0x3d3875(0x1c7)]:_0x9210eb[_0x3d3875(0x1c5)];return console[_0x3d3875(0x1e2)](''+_0x1e6d7d+_0x508b7a),0x1;}}if(_0x1828d5[_0x3d3875(0x1cf)]>0x1&&_0x202801&&_0x1119f4[_0x3d3875(0x1cf)]>0x0){const _0x184b48=_0x1119f4[_0x3d3875(0x1bd)]('\x0a');writeFileSync(_0x1c6507[_0x3d3875(0x1e6)],_0x184b48),console[_0x3d3875(0x1e2)](_0x3d3875(0x1b4)+_0x1c6507[_0x3d3875(0x1e6)]);}return 0x0;}catch(_0x59e8e2){throw _0x59e8e2;}}[a25_0x4be603(0x1ca)](_0x9e239f){const _0x1795a9=a25_0x4be603,_0x256b1a=_0x9e239f['args'][0x0],_0x4b5ff1=_0x9e239f[_0x1795a9(0x1d5)][_0x1795a9(0x1cc)];if(!_0x256b1a&&!_0x4b5ff1)return _0x1795a9(0x1d2);if(_0x256b1a&&_0x4b5ff1)return _0x1795a9(0x1de);return undefined;}}
|