@treasuredata/tdx 0.23.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.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_0x1b8974=a22_0x1461;(function(_0x5e12ac,_0x10d1a1){const _0x23581e=a22_0x1461,_0x22a6fe=_0x5e12ac();while(!![]){try{const _0x4ad484=parseInt(_0x23581e(0x19a))/0x1+-parseInt(_0x23581e(0x28c))/0x2*(-parseInt(_0x23581e(0x1b2))/0x3)+parseInt(_0x23581e(0x2ae))/0x4+-parseInt(_0x23581e(0x25b))/0x5+parseInt(_0x23581e(0x1f2))/0x6+parseInt(_0x23581e(0x170))/0x7+-parseInt(_0x23581e(0x1e0))/0x8*(parseInt(_0x23581e(0x21a))/0x9);if(_0x4ad484===_0x10d1a1)break;else _0x22a6fe['push'](_0x22a6fe['shift']());}catch(_0x4a3e51){_0x22a6fe['push'](_0x22a6fe['shift']());}}}(a22_0x574e,0xd421b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x476a17 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_0x200aac 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_0x1b8974(0x26d),LEGACY_PARENT_SEGMENT_DIR=a22_0x1b8974(0x208);function openBrowser(_0x302631){const _0x526eaa=a22_0x1b8974,_0x303df6=process[_0x526eaa(0x185)],_0xece517=_0x303df6==='darwin'?_0x526eaa(0x1f8):_0x303df6==='win32'?_0x526eaa(0x28f):_0x526eaa(0x177);spawn(_0xece517,[_0x302631],{'detached':!![],'stdio':_0x526eaa(0x20c)})['unref']();}function migrateLegacyDirectory(){const _0x38faca=a22_0x1b8974;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2e489d=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2e489d[_0x38faca(0x234)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a22_0x200aac['yellow'](_0x38faca(0x1d5)+LEGACY_PARENT_SEGMENT_DIR+_0x38faca(0x1a9)+PARENT_SEGMENT_DIR+_0x38faca(0x264))),console[_0x38faca(0x2b3)](a22_0x200aac[_0x38faca(0x1e9)](_0x38faca(0x192)+LEGACY_PARENT_SEGMENT_DIR+_0x38faca(0x17a))),![];console[_0x38faca(0x2b3)](a22_0x200aac[_0x38faca(0x276)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x38faca(0x227)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x38faca(0x2b3)](a22_0x200aac[_0x38faca(0x230)](_0x38faca(0x223)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4e6129){const _0x315a5d=_0x4e6129 instanceof Error?_0x4e6129[_0x38faca(0x1bd)]:String(_0x4e6129);return console[_0x38faca(0x2b3)](a22_0x200aac[_0x38faca(0x1c4)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x315a5d+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x1b8974(0x247)](_0x49d76c){const _0x4cef94=a22_0x1b8974;return migrateLegacyDirectory(),super[_0x4cef94(0x247)](_0x49d76c);}}function resolveYamlFile(_0xf394de){const _0x3a6058=a22_0x1b8974;if(_0xf394de[_0x3a6058(0x29f)](_0x3a6058(0x22a))||_0xf394de[_0x3a6058(0x29f)](_0x3a6058(0x2b1)))return _0xf394de;return a22_0x476a17[_0x3a6058(0x17f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xf394de)+_0x3a6058(0x22a));}function formatProgressMessage(_0x4cf0f3){const _0x169185=a22_0x1b8974,_0x1254d2=_0x4cf0f3[_0x169185(0x197)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1254d2){const [,_0x4ef548,_0x3a9001,_0xb42a6e='']=_0x1254d2;return a22_0x200aac[_0x169185(0x1e9)](_0x4ef548+':')+'\x20'+_0x3a9001+a22_0x200aac[_0x169185(0x1e9)](_0xb42a6e);}return a22_0x200aac['dim'](_0x4cf0f3);}function showFileNotFoundError(_0x28740d,_0x18650d){const _0x1923af=a22_0x1b8974;console[_0x1923af(0x2b3)](a22_0x200aac[_0x1923af(0x1c4)]('Error:\x20File\x20not\x20found:\x20'+_0x28740d+'\x0a')),console[_0x1923af(0x2b3)](a22_0x200aac[_0x1923af(0x1c3)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x18650d+_0x1923af(0x196)));}function showParentSegmentNotSetError(_0x1f027f){const _0x34daa0=a22_0x1b8974;console[_0x34daa0(0x2b3)](a22_0x200aac[_0x34daa0(0x276)](_0x34daa0(0x257))),console[_0x34daa0(0x2b3)](_0x1f027f);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x221);[a22_0x1b8974(0x1bc)]=a22_0x1b8974(0x250);async[a22_0x1b8974(0x1a4)](_0x4eea4f){const _0x4793e5=a22_0x1b8974,{options:_0x4f9eeb,args:_0x2cac60,tdx:_0x1a6655}=_0x4eea4f,_0x49f975=_0x2cac60[0x0];_0x4f9eeb['verbose']&&(console[_0x4793e5(0x2b3)](_0x4793e5(0x2aa)+_0x4f9eeb['site']),_0x49f975&&console[_0x4793e5(0x2b3)](_0x4793e5(0x26e)+_0x49f975));const _0x1cf3a4=await withSpinner(_0x49f975?_0x4793e5(0x289)+_0x49f975+_0x4793e5(0x171):_0x4793e5(0x259),()=>_0x1a6655[_0x4793e5(0x1d7)][_0x4793e5(0x2b4)](),{'verbose':_0x4f9eeb[_0x4793e5(0x1db)]});let _0x1ef7ef=_0x1cf3a4[_0x4793e5(0x183)];if(_0x49f975){const _0x179174=_0x49f975[_0x4793e5(0x198)](/[.+^${}()|[\]\\]/g,_0x4793e5(0x25f))['replace'](/\*/g,'.*')[_0x4793e5(0x198)](/\?/g,'.'),_0x3b3367=new RegExp('^'+_0x179174+'$','i');_0x1ef7ef=_0x1ef7ef[_0x4793e5(0x209)](_0x54fa2b=>_0x3b3367[_0x4793e5(0x1c5)](_0x54fa2b[_0x4793e5(0x22d)][_0x4793e5(0x1ff)]));}_0x1ef7ef[_0x4793e5(0x254)]((_0x7c67f3,_0x46e7b1)=>_0x7c67f3[_0x4793e5(0x22d)][_0x4793e5(0x1ff)][_0x4793e5(0x1bb)](_0x46e7b1['attributes']['name'])),console[_0x4793e5(0x2b3)](_0x4793e5(0x2a9)+_0x1ef7ef[_0x4793e5(0x19f)]+_0x4793e5(0x241)+(_0x1ef7ef[_0x4793e5(0x19f)]!==0x1?'s':''));const _0xc4decc=_0x44b4d9=>{const _0x14afc2=_0x4793e5;return getConsoleNextUrl(_0x4f9eeb[_0x14afc2(0x273)],_0x14afc2(0x190)+_0x44b4d9);};if(_0x4f9eeb[_0x4793e5(0x18f)]===_0x4793e5(0x28b)||_0x4f9eeb[_0x4793e5(0x18f)]===_0x4793e5(0x22b)){const _0x113d68=_0x1ef7ef['map'](_0x30484d=>({..._0x30484d,'url':_0xc4decc(_0x30484d['id'])}));await handleSDKOutput(_0x113d68,_0x4f9eeb);}else{if(_0x1ef7ef[_0x4793e5(0x19f)]===0x0)_0x49f975?console[_0x4793e5(0x1e6)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x49f975):console[_0x4793e5(0x1e6)](_0x4793e5(0x286));else for(const _0x13e627 of _0x1ef7ef){const _0x58d5f6=_0x13e627['attributes'][_0x4793e5(0x263)]?a22_0x200aac[_0x4793e5(0x1e9)]('\x20('+formatRows(_0x13e627[_0x4793e5(0x22d)][_0x4793e5(0x263)])+')'):'',_0x438c92=hyperlink(_0x13e627[_0x4793e5(0x22d)][_0x4793e5(0x1ff)],_0xc4decc(_0x13e627['id']));console['log'](_0x4793e5(0x1f7)+_0x438c92+_0x58d5f6);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x1b8974(0x27c);[a22_0x1b8974(0x1bc)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x1b8974(0x1a4)](_0xb3e747){const _0x7a546=a22_0x1b8974,{options:_0x1ade3c,args:_0x5243b5,tdx:_0x2a4ff0}=_0xb3e747;console[_0x7a546(0x2b3)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x7a546(0x204)+_0x7a546(0x21c));const _0xaa9098=_0x1ade3c;if(_0x5243b5[_0x7a546(0x19f)]===0x0)return console['error'](a22_0x200aac[_0x7a546(0x1c4)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x7a546(0x2b3)](_0x7a546(0x172)),0x1;const _0x1ca2a5=_0x5243b5[0x0];if(!_0xaa9098[_0x7a546(0x2a6)]||!_0xaa9098[_0x7a546(0x207)])return console['error'](_0x7a546(0x284)),console[_0x7a546(0x2b3)](_0x7a546(0x172)),0x1;_0xaa9098[_0x7a546(0x1db)]&&(console[_0x7a546(0x2b3)](_0x7a546(0x2aa)+_0xaa9098['site']),console['error']('Name:\x20'+_0x1ca2a5),console[_0x7a546(0x2b3)](_0x7a546(0x1d6)+_0xaa9098['database']),console[_0x7a546(0x2b3)](_0x7a546(0x1ce)+_0xaa9098[_0x7a546(0x207)]));const _0x479e10=await loadJSONFromOptions(_0xaa9098[_0x7a546(0x22d)],_0xaa9098[_0x7a546(0x23c)]),_0x55883f=await loadJSONFromOptions(_0xaa9098[_0x7a546(0x242)],_0xaa9098[_0x7a546(0x1c2)]),_0x4afa2c=await loadJSONFromOptions(_0xaa9098['customerGroup'],_0xaa9098[_0x7a546(0x18a)]),_0x49a1cb={'name':_0x1ca2a5,'description':_0xaa9098['description'],'scheduleType':_0xaa9098[_0x7a546(0x251)],'scheduleOption':_0xaa9098['scheduleOption'],'timezone':_0xaa9098[_0x7a546(0x2b0)],'master':{'parentDatabaseName':_0xaa9098['database'],'parentTableName':_0xaa9098[_0x7a546(0x207)]},'attributes':_0x479e10,'behaviors':_0x55883f,'customerGroup':_0x4afa2c},_0x2cbb97=await withSpinner(_0x7a546(0x16f)+_0x1ca2a5+_0x7a546(0x171),()=>_0x2a4ff0['segment'][_0x7a546(0x173)](_0x49a1cb),{'verbose':_0x1ade3c[_0x7a546(0x1db)]}),_0x422076=_0x2cbb97[_0x7a546(0x183)];return console[_0x7a546(0x2b3)](_0x7a546(0x249)+_0x422076[_0x7a546(0x1ff)]+_0x7a546(0x1a0)+_0x422076['id']),await handleSDKOutput([_0x422076],_0x1ade3c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x231);['description']=a22_0x1b8974(0x22f);async[a22_0x1b8974(0x1a4)](_0x4e6259){const _0x628838=a22_0x1b8974,{options:_0x1a14e2,args:_0x375413,tdx:_0x37f696}=_0x4e6259;console[_0x628838(0x2b3)](_0x628838(0x175)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5b5f35=_0x1a14e2;if(_0x375413['length']===0x0)return console[_0x628838(0x2b3)](a22_0x200aac[_0x628838(0x1c4)](_0x628838(0x1be))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x5bf8bc=_0x375413[0x0];_0x5b5f35[_0x628838(0x1db)]&&(console[_0x628838(0x2b3)](_0x628838(0x2aa)+_0x5b5f35[_0x628838(0x273)]),console[_0x628838(0x2b3)](_0x628838(0x1aa)+_0x5bf8bc));const _0x446c3a=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x5bf8bc+_0x628838(0x171),()=>_0x37f696['segment'][_0x628838(0x277)](_0x5bf8bc),{'verbose':_0x5b5f35['verbose']}),_0x465516=_0x446c3a[_0x628838(0x183)],_0x20c11a=await loadJSONFromOptions(_0x5b5f35['addAttributes'],_0x5b5f35[_0x628838(0x1d4)]),_0x3b6543=await loadJSONFromOptions(_0x5b5f35[_0x628838(0x194)],_0x5b5f35[_0x628838(0x17b)]),_0x49da3a={'name':_0x465516['name'],'description':_0x5b5f35['description']!==undefined?_0x5b5f35[_0x628838(0x1bc)]:_0x465516[_0x628838(0x1bc)],'scheduleType':_0x5b5f35['scheduleType']!==undefined?_0x5b5f35[_0x628838(0x251)]:_0x465516[_0x628838(0x251)],'scheduleOption':_0x5b5f35[_0x628838(0x216)]!==undefined?_0x5b5f35[_0x628838(0x216)]:_0x465516[_0x628838(0x216)],'timezone':_0x5b5f35[_0x628838(0x2b0)]!==undefined?_0x5b5f35[_0x628838(0x2b0)]:_0x465516[_0x628838(0x2b0)],'master':_0x465516[_0x628838(0x26f)],'attributes':_0x20c11a?[..._0x465516['attributes']||[],..._0x20c11a]:_0x465516['attributes'],'behaviors':_0x3b6543?[..._0x465516[_0x628838(0x242)]||[],..._0x3b6543]:_0x465516[_0x628838(0x242)],'customerGroup':_0x465516['customerGroup']},_0x68380f=await withSpinner(_0x628838(0x23b)+_0x5bf8bc+_0x628838(0x171),()=>_0x37f696['segment'][_0x628838(0x27f)](_0x5bf8bc,_0x49da3a),{'verbose':_0x5b5f35['verbose']}),_0x458a85=_0x68380f[_0x628838(0x183)];return console[_0x628838(0x2b3)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x458a85[_0x628838(0x1ff)]+'\x27'),await handleSDKOutput([_0x458a85],_0x5b5f35),0x0;}}function a22_0x574e(){const _0x3ab3ba=['column','\x20No\x20changes\x20-\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','all','Updating\x20parent\x20segment\x20\x27','attributesFile','previewParentYaml','To\x20cancel:','/attempt/','limit','\x20parent\x20segment','behaviors','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','To\x20view\x20sample\x20data:','YAML\x20file:\x20','displayMasterInfo','run','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','✔\x20Created\x20parent\x20segment\x20\x27','workflowId','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Enriched:','\x0a✔\x20Workflow\x20started','segment:parent:fields','List\x20parent\x20segments','scheduleType','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Apply\x20changes\x20to\x20\x27','sort','Customers:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Listing\x20fields\x20for\x20\x27','Listing\x20parent\x20segments...','resolveParentId','6005480swFSZY','Options:\x0a','Preview:','pullParentYaml','\x5c$&','elapsedTimeMillis','{\x0a\x20\x20\x22database\x22:\x20\x22','Errors:','population','/\x20directories\x20exist.','✔\x20No\x20changes\x20-\x20\x27','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Source:','repeat','displaySampleData','double','Fetching\x20SQL\x20for\x20\x27','preview','parent_segments','Pattern:\x20','master','totalEvents','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','site','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Output\x20Database:','yellow','getParentFull','stop','Aborted.','Analyzing\x20changes...','displayValidateResults','segment:parent:create','tdx\x20segment\x20parent\x20preview\x20','yes','updateParent','map','Available\x20attributes:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','workflowAttemptId','Error:\x20--database\x20and\x20--table\x20are\x20required','runParent','No\x20parent\x20segments\x20found','Join\x20on:','Validate:','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20Columns:\x20','json','54JvihyA','Resolving\x20parent\x20segment\x20\x27','status','start','behavior','pushParentYaml','%)\x20','jobId','Join:','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','text','\x22\x20}','getParentSQL','/app/workflows/','displayColumns','\x20rows\x20','-1d','Master:','parent_id','endsWith','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20--attribute\x20\x22<name>\x22','foreignKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','joinKey','getBehaviorNames','database','rowCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','✔\x20Found\x20','Site:\x20','reduce','Updating','label','2529236jBioSp','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','timezone','.yaml','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','error','listParents','bold','validateParentYaml','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayBehaviorsStats','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','429380BhvkAl','\x27...','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','createParent','parentSegment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','xdg-open','web','type','/\x20directory.\x0a','addBehaviorsFile','enriched','\x20--behavior\x20\x22<name>\x22','errors','join','Behaviors','Schema\x20saved\x20to\x20','allValid','data','Rows:','platform','\x0a\x20\x20\x20\x20}','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Fetching\x20customers\x20schema...','customersWithEvents','customerGroupFile','\x20[Job\x20ID:\x20','Fetching\x20parent\x20segment\x20\x27','\x27\x20and\x20run\x20workflow?','Updated','format','/app/dw/parentSegments/','schemaValid','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20\x20\x20\x20-\x20','addBehaviors','columns','`\x20to\x20download\x20the\x20configuration\x20first','match','replace','push','1489013mBDNWW','schemaError','Validating\x20configuration...','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x22,\x20\x22type\x22:\x20\x22','length','\x27\x20with\x20ID:\x20','Fetching\x20behavior\x20list...','Session:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','execute','\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','\x0aUsage:\x20tdx\x20ps\x20preview\x20','in\x20','Options\x20(one\x20required):\x0a','/\x20and\x20','Parent\x20segment:\x20','varchar','toLowerCase','\x20\x20Note:\x20','getOutputDatabaseName','List\x20available\x20fields\x20for\x20segmentation','\x20\x20Tables:\x201\x20customers\x20+\x20','Coverage:','91506Cqiuyw','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','toFixed','formatSchemaJson','Output\x20file:\x20','Create\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20','\x20=\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','localeCompare','description','message','Error:\x20Parent\x20segment\x20name\x20is\x20required','attribute','displayAttributesStats','collectSchema','behaviorsFile','cyan','red','test','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','trim','\x0aNew\x20parent\x20segment\x20\x27','\x20--enriched','segment:parent:desc','Master\x20+\x20Attributes','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','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','Table:\x20','session','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','customers','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','addAttributesFile','\x0a⚠️\x20\x20Both\x20','Database:\x20','segment','matchedCount','\x20--behavior\x20\x22','coveragePercent','verbose','\x0aNo\x20sample\x20data\x20available','displaySummary','\x20\x20No\x20sample\x20data\x20available','\x20Opening\x20','8XADdkl','Available\x20behaviors:','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','workflowSessionId','\x20Context\x20set:\x20','.customers)','log','setJobId','SQL\x20query:\x0a','dim','utf-8','Executing\x20parent\x20segment\x20query...','segment:parent:validate','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','output','\x20--attribute\x20\x22','segment:parent:preview','Created','4347738dpWLxX','segment:parent:show','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Audience\x20ID:','\x27\x20is\x20up\x20to\x20date','👥\x20','open','Error:','\x20total','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','column_type','Columns:','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','column_name','Fetching\x20sample\x20data...','using\x20the\x20default\x20path:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x0a\x20\x20\x20\x20]','Show\x20parent\x20segment\x20schema\x20(column\x20types)','table','parent_segment','filter','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','ignore','interval','toLocaleString','Attempt:','Overwrite\x20\x27','segment:parent:sql','displayPreviewResults','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayPreviewHints','Found\x20YAML\x20file:\x20','scheduleOption','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','query','/{name}.yml\x0a','14947668UfzjnQ','\x0aError:','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','number','audienceId','\x20rows)','keys','segment:parent:list','sampleData','✔\x20Renamed\x20directory\x20to\x20','string','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','/\x20→\x20','\x20kill','behavior_','.yml','jsonl','information_schema','attributes','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','green','segment:parent:update','customerPercent','Attribute:','isDirectory','Error\x20reading\x20file:\x20','processedRows'];a22_0x574e=function(){return _0x3ab3ba;};return a22_0x574e();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x1b8974(0x1ff)]='segment:parent:pull';['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x1b8974(0x1a4)](_0x35f4d3){const _0x294d2c=a22_0x1b8974,{options:_0x3594b7,args:_0x151f05,tdx:_0x5640db}=_0x35f4d3,_0x4d6499=_0x3594b7,_0x4592a1=_0x151f05[0x0]||_0x3594b7['parentSegment'];if(!_0x4592a1)return showParentSegmentNotSetError(_0x294d2c(0x217)+_0x294d2c(0x239)),0x1;if(_0x4d6499['use']&&_0x4d6499[_0x294d2c(0x1ee)])return console[_0x294d2c(0x2b3)](a22_0x200aac['red'](_0x294d2c(0x272))),console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x1e9)](_0x294d2c(0x282))),console[_0x294d2c(0x2b3)](a22_0x200aac['dim'](_0x294d2c(0x203)+PARENT_SEGMENT_DIR+_0x294d2c(0x219))),console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x1c3)](_0x294d2c(0x1cc))),0x1;const _0x2df4c8=_0x4d6499[_0x294d2c(0x1ee)]||a22_0x476a17['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4592a1)+'.yml');_0x4d6499[_0x294d2c(0x1db)]&&(console['error'](_0x294d2c(0x2aa)+_0x4d6499[_0x294d2c(0x273)]),console[_0x294d2c(0x2b3)](_0x294d2c(0x1aa)+_0x4592a1),console[_0x294d2c(0x2b3)](_0x294d2c(0x1b6)+_0x2df4c8));const _0x21fdea=await withSpinner(_0x294d2c(0x18c)+_0x4592a1+_0x294d2c(0x171),()=>_0x5640db['segment'][_0x294d2c(0x25e)](_0x4592a1),{'verbose':_0x4d6499['verbose']}),_0x396760=_0x21fdea['data'];if(existsSync(_0x2df4c8)){const _0x168aad=readFileSync(_0x2df4c8,_0x294d2c(0x1ea)),_0x1217b3=generateDiff(_0x168aad,_0x396760);if(!hasChanges(_0x1217b3))console[_0x294d2c(0x2b3)](a22_0x200aac['green']('✔')+_0x294d2c(0x238)+a22_0x200aac[_0x294d2c(0x1c3)](_0x2df4c8)+'\x20is\x20already\x20up\x20to\x20date');else{console['error']('\x0aChanges\x20to\x20\x27'+_0x2df4c8+'\x27:'),console['error']('─'[_0x294d2c(0x268)](0x3c)),console[_0x294d2c(0x2b3)](formatDiffWithColors(_0x1217b3)),console[_0x294d2c(0x2b3)]('─'['repeat'](0x3c));if(!_0x4d6499[_0x294d2c(0x27e)]){if(!isInteractive())return console[_0x294d2c(0x2b3)](a22_0x200aac['red']('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a22_0x200aac['dim'](_0x294d2c(0x20b))),0x1;const _0x4ecaf1=await confirmKey(_0x294d2c(0x210)+_0x2df4c8+'\x27?');if(!_0x4ecaf1)return console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x276)](_0x294d2c(0x279))),0x1;}writeFileSync(_0x2df4c8,_0x396760,_0x294d2c(0x1ea)),console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x230)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x200aac['cyan'](_0x2df4c8));}}else{const _0x2b5bf1=a22_0x476a17['dirname'](_0x2df4c8);!existsSync(_0x2b5bf1)&&mkdirSync(_0x2b5bf1,{'recursive':!![]}),writeFileSync(_0x2df4c8,_0x396760,_0x294d2c(0x1ea)),console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x230)]('✔')+_0x294d2c(0x271)+a22_0x200aac[_0x294d2c(0x1c3)](_0x2df4c8));}return saveSessionContext({'parent_segment':_0x4592a1},_0x4d6499[_0x294d2c(0x1cf)]),console[_0x294d2c(0x2b3)](a22_0x200aac[_0x294d2c(0x230)]('✔')+_0x294d2c(0x1e4)+a22_0x200aac[_0x294d2c(0x1e9)](_0x294d2c(0x208))+_0x294d2c(0x1b9)+a22_0x200aac[_0x294d2c(0x1c3)](_0x4592a1)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x1b8974(0x1ff)]='segment:parent:push';['description']=a22_0x1b8974(0x1d0);async['execute'](_0x13a0e0){const _0x24785e=a22_0x1b8974,{options:_0x75e3f9,args:_0x56deb8,tdx:_0x28ae43}=_0x13a0e0,_0x32c4b1=_0x75e3f9,_0x4cd391=_0x56deb8[0x0]||_0x75e3f9[_0x24785e(0x174)];if(!_0x4cd391)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x24785e(0x1fb)),0x1;const _0x225d96=resolveYamlFile(_0x4cd391);if(!existsSync(_0x225d96))return showFileNotFoundError(_0x225d96,_0x4cd391),0x1;_0x32c4b1['verbose']&&(console['error']('Site:\x20'+_0x32c4b1[_0x24785e(0x273)]),console[_0x24785e(0x2b3)]('YAML\x20file:\x20'+_0x225d96));let _0x2a241e;try{_0x2a241e=readFileSync(_0x225d96,'utf-8');}catch(_0x20c55b){const _0x47928b=_0x20c55b instanceof Error?_0x20c55b[_0x24785e(0x1bd)]:String(_0x20c55b);return console[_0x24785e(0x2b3)]('Error\x20reading\x20file:\x20'+_0x47928b),0x1;}const _0x2de2a4=await withSpinner(_0x24785e(0x27a),()=>_0x28ae43[_0x24785e(0x1d7)][_0x24785e(0x291)](_0x2a241e),{'verbose':_0x32c4b1[_0x24785e(0x1db)]}),_0x3663a1=_0x2de2a4[_0x24785e(0x183)],{isNew:_0x53936a,name:_0x210872,hasChanges:_0x1ea5d8,diffFormatted:_0x40b688}=_0x3663a1;if(!_0x1ea5d8)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x210872+_0x24785e(0x1d3)),0x0;_0x53936a?console[_0x24785e(0x2b3)](_0x24785e(0x1c8)+_0x210872+'\x27:'):console['error'](_0x24785e(0x1d2)+_0x210872+'\x27:');console[_0x24785e(0x2b3)]('─'[_0x24785e(0x268)](0x3c)),console[_0x24785e(0x2b3)](_0x40b688),console[_0x24785e(0x2b3)]('─'['repeat'](0x3c));const _0x2a9420=_0x53936a?_0x24785e(0x1b7)+_0x210872+'\x27?':_0x24785e(0x253)+_0x210872+'\x27?';if(!_0x32c4b1[_0x24785e(0x27e)]){if(!isInteractive())return console[_0x24785e(0x2b3)](a22_0x200aac['red'](_0x24785e(0x21b)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a22_0x200aac['dim'](_0x24785e(0x20b))),0x1;const _0x336440=await confirmKey(_0x2a9420);if(!_0x336440)return console['error'](a22_0x200aac[_0x24785e(0x276)]('Aborted.')),0x1;}const _0x1cb846=_0x53936a?'Creating':_0x24785e(0x2ac),_0x382476=await withSpinner(_0x1cb846+_0x24785e(0x16e)+_0x210872+_0x24785e(0x171),()=>_0x3663a1['apply'](),{'verbose':_0x32c4b1[_0x24785e(0x1db)]}),_0x3f282c=_0x382476[_0x24785e(0x183)],_0x13d200=getConsoleNextUrl(_0x32c4b1[_0x24785e(0x273)],_0x24785e(0x190)+_0x3f282c['id']),_0x4683ab=_0x53936a?_0x24785e(0x1f1):_0x24785e(0x18e);return console['error']('✔\x20'+_0x4683ab+_0x24785e(0x16e)+_0x3f282c[_0x24785e(0x1ff)]+'\x27'),console['error']('\x20\x20'+_0x13d200),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x1ec);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x2f3d16){const _0x4beb38=a22_0x1b8974,{options:_0x140903,args:_0x270422,tdx:_0x1b0e54}=_0x2f3d16,_0x2f4b1b=_0x140903,_0x5bf589=_0x270422[0x0]||_0x140903[_0x4beb38(0x174)];if(!_0x5bf589)return showParentSegmentNotSetError(_0x4beb38(0x213)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x4beb38(0x248)+_0x4beb38(0x19d)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3cfd6d=resolveYamlFile(_0x5bf589);if(!existsSync(_0x3cfd6d))return showFileNotFoundError(_0x3cfd6d,_0x5bf589),0x1;_0x2f4b1b[_0x4beb38(0x1db)]&&(console[_0x4beb38(0x2b3)](_0x4beb38(0x2aa)+_0x2f4b1b[_0x4beb38(0x273)]),console[_0x4beb38(0x2b3)]('YAML\x20file:\x20'+_0x3cfd6d));let _0x4a7cec;try{_0x4a7cec=readFileSync(_0x3cfd6d,_0x4beb38(0x1ea));}catch(_0x1bdb11){const _0x5adefd=_0x1bdb11 instanceof Error?_0x1bdb11[_0x4beb38(0x1bd)]:String(_0x1bdb11);return console[_0x4beb38(0x2b3)](_0x4beb38(0x235)+_0x5adefd),0x1;}const _0x32804c=createCommandSpinner(a22_0x200aac[_0x4beb38(0x1e9)](_0x4beb38(0x19c)),{'verbose':_0x2f4b1b[_0x4beb38(0x1db)]});_0x32804c['start']();const _0x1fa621={'onProgress':_0x54bc37=>{const _0x300a4b=_0x4beb38;_0x32804c[_0x300a4b(0x296)]=formatProgressMessage(_0x54bc37);}};if(_0x2f4b1b[_0x4beb38(0x26f)])_0x1fa621['master']=!![];if(_0x2f4b1b['enriched'])_0x1fa621[_0x4beb38(0x17c)]=!![];_0x2f4b1b['attribute']&&(_0x1fa621[_0x4beb38(0x1bf)]=_0x2f4b1b[_0x4beb38(0x1bf)]);_0x2f4b1b['behavior']&&(_0x1fa621[_0x4beb38(0x290)]=_0x2f4b1b['behavior']);if(_0x2f4b1b['interval'])_0x1fa621['interval']=_0x2f4b1b['interval'];let _0x188a15;try{_0x188a15=await _0x1b0e54[_0x4beb38(0x1d7)][_0x4beb38(0x16a)](_0x4a7cec,_0x1fa621),_0x32804c[_0x4beb38(0x278)]();}catch(_0x3962c2){_0x32804c['stop']();throw _0x3962c2;}const _0x4187f7=_0x2f4b1b[_0x4beb38(0x20d)]||_0x4beb38(0x29c);return this[_0x4beb38(0x27b)](_0x188a15,_0x1fa621,_0x3cfd6d,_0x4187f7),_0x188a15[_0x4beb38(0x182)]?0x0:0x1;}[a22_0x1b8974(0x27b)](_0x20e0f0,_0xe3d184,_0x3f5ba8,_0xcacd03){const _0x2d60d8=a22_0x1b8974;console[_0x2d60d8(0x2b3)]('\x0a'+a22_0x200aac[_0x2d60d8(0x169)](_0x2d60d8(0x288))+'\x20'+_0x20e0f0[_0x2d60d8(0x1ff)]),console[_0x2d60d8(0x2b3)]('═'[_0x2d60d8(0x268)](0x3c)),this[_0x2d60d8(0x246)](_0x20e0f0);if(typeof _0xe3d184[_0x2d60d8(0x1bf)]===_0x2d60d8(0x224)){this[_0x2d60d8(0x1c0)](_0x20e0f0),this[_0x2d60d8(0x1dd)](_0x20e0f0),this[_0x2d60d8(0x214)](_0x3f5ba8,_0xcacd03,'attribute',_0xe3d184[_0x2d60d8(0x1bf)]);return;}if(_0xe3d184[_0x2d60d8(0x1bf)]===!![]){this[_0x2d60d8(0x1c0)](_0x20e0f0),this[_0x2d60d8(0x1dd)](_0x20e0f0),this[_0x2d60d8(0x214)](_0x3f5ba8,_0xcacd03,_0x2d60d8(0x22d));return;}if(typeof _0xe3d184[_0x2d60d8(0x290)]===_0x2d60d8(0x224)){this['displayBehaviorsStats'](_0x20e0f0,_0xcacd03),this[_0x2d60d8(0x1dd)](_0x20e0f0),this[_0x2d60d8(0x214)](_0x3f5ba8,_0xcacd03,_0x2d60d8(0x290),_0xe3d184['behavior']);return;}if(_0xe3d184['behavior']===!![]){this[_0x2d60d8(0x16c)](_0x20e0f0,_0xcacd03),this[_0x2d60d8(0x1dd)](_0x20e0f0),this[_0x2d60d8(0x214)](_0x3f5ba8,_0xcacd03,_0x2d60d8(0x242));return;}this[_0x2d60d8(0x1c0)](_0x20e0f0),this['displayBehaviorsStats'](_0x20e0f0,_0xcacd03),this[_0x2d60d8(0x1dd)](_0x20e0f0),this[_0x2d60d8(0x214)](_0x3f5ba8,_0xcacd03,_0x2d60d8(0x23a));}[a22_0x1b8974(0x214)](_0x410938,_0x31dd56,_0x5589f8,_0x9a532d){const _0x57915a=a22_0x1b8974;console[_0x57915a(0x2b3)]('\x0a'+a22_0x200aac[_0x57915a(0x1e9)](_0x57915a(0x244)));const _0x3b52c2=_0x31dd56!==_0x57915a(0x29c)?'\x20--interval\x20'+_0x31dd56:'';if(_0x5589f8===_0x57915a(0x1bf)&&_0x9a532d)console[_0x57915a(0x2b3)]('\x20\x20'+a22_0x200aac[_0x57915a(0x1e9)](_0x57915a(0x27d)+_0x410938+'\x20--attribute\x20\x22'+_0x9a532d+'\x22'+_0x3b52c2));else{if(_0x5589f8===_0x57915a(0x290)&&_0x9a532d)console[_0x57915a(0x2b3)]('\x20\x20'+a22_0x200aac[_0x57915a(0x1e9)](_0x57915a(0x27d)+_0x410938+_0x57915a(0x1d9)+_0x9a532d+'\x22'+_0x3b52c2));else(_0x5589f8===_0x57915a(0x22d)||_0x5589f8===_0x57915a(0x23a))&&console['error']('\x20\x20'+a22_0x200aac[_0x57915a(0x1e9)]('tdx\x20segment\x20parent\x20preview\x20'+_0x410938+_0x57915a(0x2a1)+_0x3b52c2));}(_0x5589f8===_0x57915a(0x242)||_0x5589f8==='all')&&console[_0x57915a(0x2b3)]('\x20\x20'+a22_0x200aac[_0x57915a(0x1e9)](_0x57915a(0x27d)+_0x410938+_0x57915a(0x17d)+_0x3b52c2)),_0x5589f8===_0x57915a(0x23a)&&console[_0x57915a(0x2b3)]('\x20\x20'+a22_0x200aac['dim'](_0x57915a(0x27d)+_0x410938+_0x57915a(0x1c9)+_0x3b52c2));}[a22_0x1b8974(0x246)](_0x125c8f){const _0x2d85cc=a22_0x1b8974,{master:_0x5a68c8}=_0x125c8f,_0x490f00=_0x5a68c8[_0x2d85cc(0x191)]?a22_0x200aac['green']('✔'):a22_0x200aac['red']('✘');console['error']('\x0a'+a22_0x200aac['dim']('Master\x20Table')),console['error'](_0x490f00+'\x20'+a22_0x200aac[_0x2d85cc(0x169)](_0x5a68c8[_0x2d85cc(0x2a6)]+'.'+_0x5a68c8['table'])),_0x5a68c8[_0x2d85cc(0x191)]?_0x5a68c8[_0x2d85cc(0x2a7)]!==undefined&&console[_0x2d85cc(0x2b3)]('\x20\x20'+a22_0x200aac[_0x2d85cc(0x1e9)](_0x2d85cc(0x184))+'\x20'+a22_0x200aac[_0x2d85cc(0x1c3)](formatRows(_0x5a68c8[_0x2d85cc(0x2a7)]))):console[_0x2d85cc(0x2b3)]('\x20\x20'+a22_0x200aac['red'](_0x2d85cc(0x1f9))+'\x20'+_0x5a68c8['schemaError']);}[a22_0x1b8974(0x1c0)](_0x53aaf7){const _0x5c56e4=a22_0x1b8974;if(_0x53aaf7['attributes'][_0x5c56e4(0x19f)]===0x0)return;console[_0x5c56e4(0x2b3)]('\x0a'+a22_0x200aac[_0x5c56e4(0x1e9)]('Attributes'));for(const _0x37a7ef of _0x53aaf7['attributes']){const _0x1d10a0=_0x37a7ef[_0x5c56e4(0x191)]?a22_0x200aac[_0x5c56e4(0x230)]('✔'):a22_0x200aac[_0x5c56e4(0x1c4)]('✘');let _0x37558b='';if(_0x37a7ef[_0x5c56e4(0x191)]&&_0x37a7ef['matchedCount']!==undefined&&_0x37a7ef[_0x5c56e4(0x1da)]!==undefined){const _0x277153=_0x37a7ef[_0x5c56e4(0x1da)]['toFixed'](0x1),_0x543f4b=_0x37a7ef[_0x5c56e4(0x1da)]>=0x50?a22_0x200aac[_0x5c56e4(0x230)]:_0x37a7ef[_0x5c56e4(0x1da)]>=0x32?a22_0x200aac['yellow']:a22_0x200aac[_0x5c56e4(0x1c4)];_0x37558b='\x20'+a22_0x200aac[_0x5c56e4(0x1e9)](_0x5c56e4(0x1b1))+'\x20'+_0x543f4b(_0x277153+'%')+'\x20('+formatRows(_0x37a7ef[_0x5c56e4(0x1d8)])+_0x5c56e4(0x21f);}console[_0x5c56e4(0x2b3)](_0x1d10a0+'\x20'+a22_0x200aac[_0x5c56e4(0x169)](_0x37a7ef[_0x5c56e4(0x1ff)])+_0x37558b),console[_0x5c56e4(0x2b3)]('\x20\x20'+a22_0x200aac[_0x5c56e4(0x1e9)](_0x5c56e4(0x267))+'\x20'+a22_0x200aac[_0x5c56e4(0x169)](_0x37a7ef[_0x5c56e4(0x2a6)]+'.'+_0x37a7ef[_0x5c56e4(0x207)]));const _0x45c343=_0x37a7ef[_0x5c56e4(0x2a4)]===_0x37a7ef[_0x5c56e4(0x2a2)]?a22_0x200aac['dim'](_0x5c56e4(0x287))+'\x20'+_0x37a7ef[_0x5c56e4(0x2a4)]:a22_0x200aac[_0x5c56e4(0x1e9)]('Join:')+'\x20'+_0x37a7ef[_0x5c56e4(0x2a4)]+_0x5c56e4(0x1b9)+_0x37a7ef[_0x5c56e4(0x2a2)];console['error']('\x20\x20'+_0x45c343),console[_0x5c56e4(0x2b3)]('\x20\x20'+a22_0x200aac[_0x5c56e4(0x1e9)]('Columns:')),this[_0x5c56e4(0x29a)](_0x37a7ef[_0x5c56e4(0x195)]),!_0x37a7ef[_0x5c56e4(0x191)]&&console[_0x5c56e4(0x2b3)]('\x20\x20'+a22_0x200aac[_0x5c56e4(0x1c4)]('Error:')+'\x20'+_0x37a7ef[_0x5c56e4(0x19b)]);}}[a22_0x1b8974(0x16c)](_0x31c18a,_0x56cce2){const _0x3c1f58=a22_0x1b8974;if(_0x31c18a['behaviors'][_0x3c1f58(0x19f)]===0x0)return;console[_0x3c1f58(0x2b3)]('\x0a'+a22_0x200aac[_0x3c1f58(0x1e9)](_0x3c1f58(0x180))+'\x20'+a22_0x200aac['dim']('('+_0x56cce2+')'));for(const _0x3fa997 of _0x31c18a['behaviors']){const _0x60be0e=_0x3fa997[_0x3c1f58(0x191)]?a22_0x200aac[_0x3c1f58(0x230)]('✔'):a22_0x200aac[_0x3c1f58(0x1c4)]('✘');let _0x32d303='';if(_0x3fa997['schemaValid']&&_0x3fa997[_0x3c1f58(0x189)]!==undefined&&_0x3fa997[_0x3c1f58(0x270)]!==undefined){const _0x3ec65a=_0x3fa997[_0x3c1f58(0x232)]?.[_0x3c1f58(0x1b4)](0x1)||'?',_0x57dcbc=(_0x3fa997['customerPercent']??0x0)>=0x32?a22_0x200aac[_0x3c1f58(0x230)]:(_0x3fa997[_0x3c1f58(0x232)]??0x0)>=0x14?a22_0x200aac[_0x3c1f58(0x276)]:a22_0x200aac[_0x3c1f58(0x1c4)];_0x32d303='\x20'+a22_0x200aac['dim'](_0x3c1f58(0x255))+'\x20'+_0x57dcbc(formatRows(_0x3fa997['customersWithEvents']))+'\x20('+_0x3ec65a+_0x3c1f58(0x292)+a22_0x200aac['dim']('Events:')+'\x20'+a22_0x200aac[_0x3c1f58(0x1c3)](formatRows(_0x3fa997[_0x3c1f58(0x270)]));}console[_0x3c1f58(0x2b3)](_0x60be0e+'\x20'+a22_0x200aac[_0x3c1f58(0x169)](_0x3fa997['name'])+_0x32d303),console[_0x3c1f58(0x2b3)]('\x20\x20'+a22_0x200aac[_0x3c1f58(0x1e9)](_0x3c1f58(0x267))+'\x20'+a22_0x200aac[_0x3c1f58(0x169)](_0x3fa997['database']+'.'+_0x3fa997[_0x3c1f58(0x207)]));const _0x58d55b=_0x3fa997[_0x3c1f58(0x2a4)]===_0x3fa997[_0x3c1f58(0x2a2)]?a22_0x200aac[_0x3c1f58(0x1e9)](_0x3c1f58(0x287))+'\x20'+_0x3fa997['joinKey']:a22_0x200aac[_0x3c1f58(0x1e9)](_0x3c1f58(0x294))+'\x20'+_0x3fa997['joinKey']+'\x20=\x20'+_0x3fa997[_0x3c1f58(0x2a2)];console['error']('\x20\x20'+_0x58d55b),console[_0x3c1f58(0x2b3)]('\x20\x20'+a22_0x200aac[_0x3c1f58(0x1e9)](_0x3c1f58(0x1fe))),this[_0x3c1f58(0x29a)](_0x3fa997['columns']),!_0x3fa997[_0x3c1f58(0x191)]&&console[_0x3c1f58(0x2b3)]('\x20\x20'+a22_0x200aac[_0x3c1f58(0x1c4)]('Error:')+'\x20'+_0x3fa997['schemaError']);}}['displayColumns'](_0x243b99){const _0x40aae9=a22_0x1b8974;for(const _0x4e7599 of _0x243b99){_0x4e7599[_0x40aae9(0x2ad)]===_0x4e7599[_0x40aae9(0x237)]||_0x4e7599['column']==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x4e7599[_0x40aae9(0x2ad)]):console[_0x40aae9(0x2b3)](_0x40aae9(0x193)+_0x4e7599['label']+'\x20'+a22_0x200aac['dim']('('+_0x4e7599[_0x40aae9(0x237)]+')'));}}[a22_0x1b8974(0x1dd)](_0x17c79b){const _0x311542=a22_0x1b8974;console[_0x311542(0x2b3)]('─'[_0x311542(0x268)](0x3c));if(_0x17c79b['errors']['length']>0x0){console['error']('\x0a'+a22_0x200aac['red'](_0x311542(0x262)));for(const _0x22a11c of _0x17c79b['errors']){console[_0x311542(0x2b3)]('\x20\x20'+a22_0x200aac[_0x311542(0x1c4)]('•')+'\x20'+_0x22a11c);}}_0x17c79b[_0x311542(0x182)]&&console[_0x311542(0x2b3)]('\x0a'+a22_0x200aac['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x1f0);['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a22_0x1b8974(0x1a4)](_0xd35601){const _0x21419a=a22_0x1b8974,{options:_0x110c41,args:_0x38ef09,tdx:_0x150be3}=_0xd35601,_0x16c59c=_0x110c41,_0x441e97=_0x38ef09[0x0]||_0x110c41[_0x21419a(0x174)];if(!_0x441e97)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x21419a(0x1a8)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x21419a(0x274)+_0x21419a(0x16b)),0x1;if(!_0x16c59c[_0x21419a(0x26f)]&&!_0x16c59c['attribute']&&!_0x16c59c[_0x21419a(0x290)]&&!_0x16c59c[_0x21419a(0x17c)])return console[_0x21419a(0x2b3)](a22_0x200aac['red'](_0x21419a(0x2af))),console[_0x21419a(0x2b3)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x21419a(0x2b3)]('Options:'),console[_0x21419a(0x2b3)](_0x21419a(0x1b3)),console['error'](_0x21419a(0x1ba)),console[_0x21419a(0x2b3)](_0x21419a(0x252)),console[_0x21419a(0x2b3)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x533a76=resolveYamlFile(_0x441e97);if(!existsSync(_0x533a76))return showFileNotFoundError(_0x533a76,_0x441e97),0x1;_0x16c59c['verbose']&&(console[_0x21419a(0x2b3)](_0x21419a(0x2aa)+_0x16c59c[_0x21419a(0x273)]),console['error'](_0x21419a(0x245)+_0x533a76));let _0x485fd8;try{_0x485fd8=readFileSync(_0x533a76,_0x21419a(0x1ea));}catch(_0xf2f773){const _0x4f4efb=_0xf2f773 instanceof Error?_0xf2f773['message']:String(_0xf2f773);return console[_0x21419a(0x2b3)](_0x21419a(0x235)+_0x4f4efb),0x1;}let _0x548245;try{_0x548245=parseDef(_0x485fd8);}catch(_0x1ab882){const _0x55c2de=_0x1ab882 instanceof Error?_0x1ab882[_0x21419a(0x1bd)]:String(_0x1ab882);return console[_0x21419a(0x2b3)](a22_0x200aac['red']('Error\x20parsing\x20YAML:\x20'+_0x55c2de)),0x1;}if(_0x16c59c[_0x21419a(0x1bf)]===!![]||_0x16c59c[_0x21419a(0x1bf)]===''){const _0x44ffce=_0x548245[_0x21419a(0x22d)]?.[_0x21419a(0x280)](_0x4ca59c=>_0x4ca59c[_0x21419a(0x1ff)])||[];if(_0x44ffce[_0x21419a(0x19f)]===0x0)console[_0x21419a(0x2b3)](a22_0x200aac[_0x21419a(0x1c4)](_0x21419a(0x2b2)));else{console[_0x21419a(0x2b3)](a22_0x200aac[_0x21419a(0x1c4)](_0x21419a(0x266))),console[_0x21419a(0x2b3)](_0x21419a(0x281));for(const _0x7b0cd5 of _0x44ffce){console['error']('\x20\x20'+a22_0x200aac[_0x21419a(0x1c3)](_0x7b0cd5));}console[_0x21419a(0x2b3)](_0x21419a(0x1a6)+_0x441e97+_0x21419a(0x1ef)+_0x44ffce[0x0]+'\x22');}return 0x1;}if(_0x16c59c[_0x21419a(0x290)]===!![]||_0x16c59c['behavior']===''){const _0x12cdb8=_0x548245['behaviors']?.[_0x21419a(0x280)](_0x470f13=>_0x470f13[_0x21419a(0x1ff)])||[];if(_0x12cdb8[_0x21419a(0x19f)]===0x0)console[_0x21419a(0x2b3)](a22_0x200aac[_0x21419a(0x1c4)](_0x21419a(0x187)));else{console['error'](a22_0x200aac[_0x21419a(0x1c4)](_0x21419a(0x24c))),console[_0x21419a(0x2b3)](_0x21419a(0x1e1));for(const _0x170737 of _0x12cdb8){console[_0x21419a(0x2b3)]('\x20\x20'+a22_0x200aac[_0x21419a(0x1c3)](_0x170737));}console[_0x21419a(0x2b3)](_0x21419a(0x1a6)+_0x441e97+_0x21419a(0x1d9)+_0x12cdb8[0x0]+'\x22');}return 0x1;}const _0x32c46b=createCommandSpinner(a22_0x200aac[_0x21419a(0x1e9)](_0x21419a(0x202)),{'verbose':_0x16c59c[_0x21419a(0x1db)]});_0x32c46b[_0x21419a(0x28f)]();const _0x2daa52={'onProgress':_0x174f17=>{const _0x262497=_0x21419a;_0x32c46b[_0x262497(0x296)]=formatProgressMessage(_0x174f17);}};if(_0x16c59c[_0x21419a(0x26f)])_0x2daa52[_0x21419a(0x26f)]=!![];if(_0x16c59c['attribute']&&typeof _0x16c59c[_0x21419a(0x1bf)]===_0x21419a(0x224))_0x2daa52[_0x21419a(0x1bf)]=_0x16c59c['attribute'];if(_0x16c59c[_0x21419a(0x290)]&&typeof _0x16c59c[_0x21419a(0x290)]===_0x21419a(0x224))_0x2daa52['behavior']=_0x16c59c[_0x21419a(0x290)];if(_0x16c59c[_0x21419a(0x17c)])_0x2daa52[_0x21419a(0x17c)]=!![];if(_0x16c59c[_0x21419a(0x20d)])_0x2daa52[_0x21419a(0x20d)]=_0x16c59c[_0x21419a(0x20d)];let _0x34db1e;try{_0x34db1e=await _0x150be3[_0x21419a(0x1d7)][_0x21419a(0x23d)](_0x485fd8,_0x2daa52),_0x32c46b[_0x21419a(0x278)]();}catch(_0x2e8614){_0x32c46b['stop']();throw _0x2e8614;}return await this[_0x21419a(0x212)](_0x34db1e,{'master':_0x16c59c[_0x21419a(0x26f)],'attribute':typeof _0x16c59c['attribute']===_0x21419a(0x224)?_0x16c59c[_0x21419a(0x1bf)]:undefined,'behavior':typeof _0x16c59c[_0x21419a(0x290)]===_0x21419a(0x224)?_0x16c59c[_0x21419a(0x290)]:undefined,'enriched':_0x16c59c[_0x21419a(0x17c)]}),_0x34db1e['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x4469d1,_0xa8debf){const _0x4f4a4c=a22_0x1b8974;console[_0x4f4a4c(0x2b3)]('\x0a'+a22_0x200aac[_0x4f4a4c(0x169)](_0x4f4a4c(0x25d))+'\x20'+_0x4469d1[_0x4f4a4c(0x1ff)]),console[_0x4f4a4c(0x2b3)]('═'[_0x4f4a4c(0x268)](0x3c));if(_0xa8debf[_0x4f4a4c(0x26f)]&&_0x4469d1[_0x4f4a4c(0x222)]){const _0x384b6a=a22_0x200aac['dim'](_0x4f4a4c(0x29d))+'\x20'+a22_0x200aac['bold'](_0x4469d1['master'][_0x4f4a4c(0x2a6)]+'.'+_0x4469d1['master'][_0x4f4a4c(0x207)]);await this[_0x4f4a4c(0x269)](_0x384b6a,_0x4469d1[_0x4f4a4c(0x222)]);}else{if(_0xa8debf[_0x4f4a4c(0x1bf)]&&_0x4469d1['sampleData']){const _0x59fb4f=a22_0x200aac[_0x4f4a4c(0x1e9)](_0x4f4a4c(0x233))+'\x20'+a22_0x200aac[_0x4f4a4c(0x169)](_0xa8debf[_0x4f4a4c(0x1bf)]);await this[_0x4f4a4c(0x269)](_0x59fb4f,_0x4469d1[_0x4f4a4c(0x222)]);}else{if(_0xa8debf[_0x4f4a4c(0x290)]&&_0x4469d1[_0x4f4a4c(0x222)]){const _0x28d1c6=a22_0x200aac[_0x4f4a4c(0x1e9)]('Behavior:')+'\x20'+a22_0x200aac['bold'](_0xa8debf[_0x4f4a4c(0x290)]);await this['displaySampleData'](_0x28d1c6,_0x4469d1[_0x4f4a4c(0x222)]);}else{if(_0xa8debf[_0x4f4a4c(0x17c)]&&_0x4469d1['sampleData']){const _0x203f59=a22_0x200aac[_0x4f4a4c(0x1e9)](_0x4f4a4c(0x24d))+'\x20'+a22_0x200aac['bold'](_0x4f4a4c(0x1cb));await this[_0x4f4a4c(0x269)](_0x203f59,_0x4469d1[_0x4f4a4c(0x222)]);}else!_0x4469d1['sampleData']&&console[_0x4f4a4c(0x2b3)](_0x4f4a4c(0x1dc));}}}if(_0x4469d1['errors'][_0x4f4a4c(0x19f)]>0x0){console['error']('─'[_0x4f4a4c(0x268)](0x3c)),console[_0x4f4a4c(0x2b3)]('\x0a'+a22_0x200aac['red'](_0x4f4a4c(0x262)));for(const _0x2c8a8e of _0x4469d1[_0x4f4a4c(0x17e)]){console[_0x4f4a4c(0x2b3)]('\x20\x20'+a22_0x200aac[_0x4f4a4c(0x1c4)]('•')+'\x20'+_0x2c8a8e);}}}async[a22_0x1b8974(0x269)](_0x414e45,_0x396180){const _0x186504=a22_0x1b8974;if(_0x396180['length']===0x0){console[_0x186504(0x2b3)]('\x0a'+_0x414e45),console[_0x186504(0x2b3)](_0x186504(0x1de));return;}console[_0x186504(0x2b3)]('\x0a'+_0x414e45);const _0x533017=Object[_0x186504(0x220)](_0x396180[0x0])['map'](_0x4e4c78=>({'name':_0x4e4c78,'type':typeof _0x396180[0x0][_0x4e4c78]===_0x186504(0x21d)?_0x186504(0x26a):_0x186504(0x1ab)})),_0x497f7e={'queryId':_0x186504(0x26c),'columns':_0x533017,'data':_0x396180,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x396180[_0x186504(0x19f)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x354b1b=formatAsTable(_0x497f7e,_0x396180['length'],!![]);await writeOutput(_0x354b1b,undefined,_0x186504(0x207));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a22_0x1b8974(0x1bc)]=a22_0x1b8974(0x243);async[a22_0x1b8974(0x1a4)](_0x1b68f6){const _0x1e2def=a22_0x1b8974,{options:_0xe69bae,args:_0x5718ab,tdx:_0x3f4923}=_0x1b68f6,_0x121694=_0xe69bae,_0x43b845=_0x5718ab[0x0]||_0xe69bae['parentSegment'];if(!_0x43b845)return showParentSegmentNotSetError(_0x1e2def(0x226)+_0x1e2def(0x2a3)),0x1;const _0x30fe83=resolveYamlFile(_0x43b845);if(existsSync(_0x30fe83)){_0x121694[_0x1e2def(0x1db)]&&console[_0x1e2def(0x2b3)](_0x1e2def(0x215)+_0x30fe83);let _0x404ebf;try{_0x404ebf=readFileSync(_0x30fe83,_0x1e2def(0x1ea));}catch(_0x34ab1c){const _0xdd214d=_0x34ab1c instanceof Error?_0x34ab1c[_0x1e2def(0x1bd)]:String(_0x34ab1c);return console[_0x1e2def(0x2b3)]('Error\x20reading\x20file:\x20'+_0xdd214d),0x1;}const _0x32742d=await withSpinner(_0x1e2def(0x27a),()=>_0x3f4923[_0x1e2def(0x1d7)][_0x1e2def(0x291)](_0x404ebf),{'verbose':_0x121694[_0x1e2def(0x1db)]}),_0x41f98d=_0x32742d[_0x1e2def(0x183)],{isNew:_0x1f5649,name:_0x245c2f,hasChanges:_0x12c6b5,diffFormatted:_0x4ec217}=_0x41f98d;if(_0x12c6b5){_0x1f5649?console[_0x1e2def(0x2b3)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x245c2f+'\x27:'):console[_0x1e2def(0x2b3)](_0x1e2def(0x1d2)+_0x245c2f+'\x27:');console[_0x1e2def(0x2b3)]('─'[_0x1e2def(0x268)](0x3c)),console['error'](_0x4ec217),console[_0x1e2def(0x2b3)]('─'[_0x1e2def(0x268)](0x3c));const _0xaae56=_0x1f5649?_0x1e2def(0x1b7)+_0x245c2f+_0x1e2def(0x18d):_0x1e2def(0x253)+_0x245c2f+'\x27\x20and\x20run\x20workflow?';if(!_0x121694[_0x1e2def(0x27e)]){if(!isInteractive())return console[_0x1e2def(0x2b3)](a22_0x200aac[_0x1e2def(0x1c4)](_0x1e2def(0x21b)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1e2def(0x2b3)](a22_0x200aac[_0x1e2def(0x1e9)](_0x1e2def(0x20b))),0x1;const _0x40276e=await confirmKey(_0xaae56);if(!_0x40276e)return console[_0x1e2def(0x2b3)](a22_0x200aac['yellow'](_0x1e2def(0x279))),0x1;}const _0x5a1f9e=_0x1f5649?'Creating':_0x1e2def(0x2ac);await withSpinner(_0x5a1f9e+_0x1e2def(0x16e)+_0x245c2f+_0x1e2def(0x171),()=>_0x41f98d['apply'](),{'verbose':_0x121694['verbose']});const _0x457a05=_0x1f5649?'Created':_0x1e2def(0x18e);console[_0x1e2def(0x2b3)]('✔\x20'+_0x457a05+'\x20parent\x20segment\x20\x27'+_0x245c2f+'\x27');}else console['error'](_0x1e2def(0x265)+_0x245c2f+_0x1e2def(0x1f6));}const _0x3bf907=await withSpinner(_0x1e2def(0x1f4)+_0x43b845+'\x27...',()=>_0x3f4923[_0x1e2def(0x1d7)][_0x1e2def(0x285)](_0x43b845),{'verbose':_0x121694[_0x1e2def(0x1db)]}),_0x3723f2=_0x3bf907['data'],_0x165207=getConsoleUrl(_0x121694[_0x1e2def(0x273)],_0x1e2def(0x299)+_0x3723f2[_0x1e2def(0x24a)]+'/sessions/'+_0x3723f2[_0x1e2def(0x1e3)]+_0x1e2def(0x23f)+_0x3723f2['workflowAttemptId']);return console[_0x1e2def(0x2b3)](_0x1e2def(0x24e)),console[_0x1e2def(0x2b3)]('\x20\x20'+a22_0x200aac['dim'](_0x1e2def(0x1f5))+'\x20'+_0x3723f2[_0x1e2def(0x21e)]),console[_0x1e2def(0x2b3)]('\x20\x20'+a22_0x200aac[_0x1e2def(0x1e9)]('Status:')+'\x20'+_0x3723f2[_0x1e2def(0x28e)]),console[_0x1e2def(0x2b3)]('\x20\x20'+a22_0x200aac[_0x1e2def(0x1e9)](_0x1e2def(0x1a2))+'\x20'+_0x3723f2[_0x1e2def(0x1e3)]),console[_0x1e2def(0x2b3)]('\x20\x20'+a22_0x200aac['dim'](_0x1e2def(0x20f))+'\x20'+_0x3723f2[_0x1e2def(0x283)]),console[_0x1e2def(0x2b3)]('\x20\x20'+_0x165207),console[_0x1e2def(0x2b3)]('\x0a'+a22_0x200aac[_0x1e2def(0x1e9)](_0x1e2def(0x23e))+'\x20tdx\x20wf\x20attempt\x20'+_0x3723f2[_0x1e2def(0x283)]+_0x1e2def(0x228)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a22_0x1b8974(0x24f);['description']=a22_0x1b8974(0x1af);async['execute'](_0x356c5d){const _0x496bba=a22_0x1b8974,{options:_0x414c08,args:_0x55873d,tdx:_0x9b622b}=_0x356c5d,_0x176748=_0x55873d[0x0]||_0x414c08['parentSegment'];if(!_0x176748)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x496bba(0x200)),0x1;_0x414c08[_0x496bba(0x1db)]&&(console[_0x496bba(0x2b3)](_0x496bba(0x2aa)+_0x414c08[_0x496bba(0x273)]),console['error'](_0x496bba(0x1aa)+_0x176748));const _0x2b415c=await withSpinner(_0x496bba(0x258)+_0x176748+'\x27...',()=>_0x9b622b['segment']['listFields'](_0x176748),{'verbose':_0x414c08[_0x496bba(0x1db)]}),_0x2826f5=_0x2b415c['data'];console['error'](_0x496bba(0x2a9)+_0x2826f5['length']+'\x20field'+(_0x2826f5['length']!==0x1?'s':''));if(_0x414c08[_0x496bba(0x28b)]||_0x414c08[_0x496bba(0x22b)])return await handleSDKOutput(_0x2826f5,_0x414c08),0x0;return displayFieldsHumanReadable(_0x2826f5,_0x176748),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x1b8974(0x1ff)]='segment:parent:view';[a22_0x1b8974(0x1bc)]='Show\x20parent\x20segment\x20details';async[a22_0x1b8974(0x1a4)](_0x4a0316){const _0x1222e5=a22_0x1b8974,{options:_0x320d91,args:_0x6970f3,tdx:_0x4323c5}=_0x4a0316,_0x34f4bb=_0x320d91,_0x526555=_0x6970f3[0x0]||_0x320d91[_0x1222e5(0x174)];if(!_0x526555)return showParentSegmentNotSetError(_0x1222e5(0x1a3)+_0x1222e5(0x1fc)+_0x1222e5(0x25c)+_0x1222e5(0x24b)),0x1;_0x320d91[_0x1222e5(0x1db)]&&(console['error'](_0x1222e5(0x2aa)+_0x320d91[_0x1222e5(0x273)]),console['error'](_0x1222e5(0x1aa)+_0x526555));const _0x2a1655=await withSpinner(_0x1222e5(0x18c)+_0x526555+_0x1222e5(0x171),()=>_0x4323c5['segment'][_0x1222e5(0x277)](_0x526555),{'verbose':_0x320d91[_0x1222e5(0x1db)]}),_0x1e0b1c=_0x2a1655[_0x1222e5(0x183)];if(_0x34f4bb[_0x1222e5(0x178)]){const _0x125eee=getConsoleNextUrl(_0x34f4bb[_0x1222e5(0x273)],_0x1222e5(0x190)+_0x1e0b1c['id']);return console[_0x1222e5(0x2b3)](a22_0x200aac[_0x1222e5(0x230)]('✔')+_0x1222e5(0x1df)+a22_0x200aac[_0x1222e5(0x1c3)](_0x125eee)),openBrowser(_0x125eee),0x0;}return await handleSingleObjectOutput(_0x1e0b1c,_0x320d91),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a22_0x1b8974(0x1ca);[a22_0x1b8974(0x1bc)]=a22_0x1b8974(0x206);async[a22_0x1b8974(0x1a4)](_0x30b8c8){const _0x1a03c1=a22_0x1b8974,{options:_0x20abc4,args:_0x579111,tdx:_0x3764a9}=_0x30b8c8,_0x5b1e8e=_0x20abc4,_0x4f883b=_0x579111[0x0]||_0x20abc4[_0x1a03c1(0x174)];if(!_0x4f883b)return showParentSegmentNotSetError(_0x1a03c1(0x1cd)+_0x1a03c1(0x1a5)+_0x1a03c1(0x25c)+_0x1a03c1(0x1e2)),0x1;_0x20abc4['verbose']&&(console[_0x1a03c1(0x2b3)](_0x1a03c1(0x2aa)+_0x20abc4[_0x1a03c1(0x273)]),console[_0x1a03c1(0x2b3)](_0x1a03c1(0x1aa)+_0x4f883b));const _0x357ce9=await withSpinner(_0x1a03c1(0x28d)+_0x4f883b+'\x27...',()=>_0x3764a9['segment'][_0x1a03c1(0x25a)](_0x4f883b),{'verbose':_0x20abc4[_0x1a03c1(0x1db)]}),_0x180be0=_0x357ce9['data'],_0x303d6d=_0x3764a9[_0x1a03c1(0x1d7)][_0x1a03c1(0x1ae)](_0x180be0);if(_0x5b1e8e[_0x1a03c1(0x1ee)]){const _0xaba9ea=await this['collectSchema'](_0x30b8c8,_0x4f883b,_0x180be0,_0x303d6d),_0xd8b8a7=this[_0x1a03c1(0x1b5)](_0xaba9ea);writeFileSync(_0x5b1e8e[_0x1a03c1(0x1ee)],_0xd8b8a7);const _0x4c8f03=_0xaba9ea[_0x1a03c1(0x1d1)][_0x1a03c1(0x195)][_0x1a03c1(0x19f)]+_0xaba9ea['behaviors'][_0x1a03c1(0x2ab)]((_0x5119b2,_0x28cbbb)=>_0x5119b2+_0x28cbbb[_0x1a03c1(0x195)]['length'],0x0),_0x2b1edb=_0xaba9ea[_0x1a03c1(0x242)][_0x1a03c1(0x209)](_0x11a456=>_0x11a456['columns'][_0x1a03c1(0x19f)]===0x0)[_0x1a03c1(0x19f)];return console[_0x1a03c1(0x1e6)](_0x1a03c1(0x181)+_0x5b1e8e[_0x1a03c1(0x1ee)]),console[_0x1a03c1(0x1e6)]('\x20\x20Database:\x20'+_0x303d6d),console[_0x1a03c1(0x1e6)](_0x1a03c1(0x1b0)+_0xaba9ea['behaviors'][_0x1a03c1(0x19f)]+'\x20behaviors'),console[_0x1a03c1(0x1e6)](_0x1a03c1(0x28a)+_0x4c8f03+_0x1a03c1(0x1fa)),_0x2b1edb>0x0&&console[_0x1a03c1(0x1e6)](_0x1a03c1(0x1ad)+_0x2b1edb+_0x1a03c1(0x20a)),0x0;}console['error']('\x0a'+a22_0x200aac[_0x1a03c1(0x169)](_0x1a03c1(0x275))+'\x20'+a22_0x200aac[_0x1a03c1(0x1c3)](_0x303d6d));const _0x37b538=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x3764a9['segment']['getParentSQL'](_0x180be0),{'verbose':_0x20abc4[_0x1a03c1(0x1db)]});console['error']('\x0a'+a22_0x200aac[_0x1a03c1(0x169)](_0x1a03c1(0x1d1))+'\x20'+a22_0x200aac[_0x1a03c1(0x1e9)]('('+_0x303d6d+_0x1a03c1(0x1e5)));const _0x1fb75d=await executeSchemaQuery(_0x37b538[_0x1a03c1(0x183)],_0x3764a9,_0x20abc4);await handleQueryOutput(_0x1fb75d,_0x20abc4);const _0x4396c4=await withSpinner(_0x1a03c1(0x1a1),()=>_0x3764a9[_0x1a03c1(0x1d7)][_0x1a03c1(0x2a5)](_0x180be0),{'verbose':_0x20abc4[_0x1a03c1(0x1db)]});for(const _0x5a660a of _0x4396c4['data']){const _0x24298e=_0x1a03c1(0x229)+_0x5a660a[_0x1a03c1(0x1ac)]()['replace'](/\s+/g,'_'),_0x5ad596='SELECT\x20*\x20FROM\x20'+_0x303d6d+'.'+_0x24298e;console['error']('\x0a'+a22_0x200aac[_0x1a03c1(0x169)](_0x5a660a)+'\x20'+a22_0x200aac[_0x1a03c1(0x1e9)]('('+_0x303d6d+'.'+_0x24298e+')'));try{const _0x368963=await executeSchemaQuery(_0x5ad596,_0x3764a9,_0x20abc4);await handleQueryOutput(_0x368963,_0x20abc4);}catch{console[_0x1a03c1(0x2b3)](a22_0x200aac['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x1b8974(0x1c1)](_0x3e36c8,_0x10ec89,_0x54f853,_0x4fb2b0){const _0x3f14d4=a22_0x1b8974,{options:_0x25838b,tdx:_0x5b0ae2}=_0x3e36c8,_0x2ee774=await withSpinner(_0x3f14d4(0x188),()=>_0x5b0ae2[_0x3f14d4(0x1d7)][_0x3f14d4(0x298)](_0x54f853),{'verbose':_0x25838b[_0x3f14d4(0x1db)]}),_0x5df41d=await executeSchemaQuery(_0x2ee774[_0x3f14d4(0x183)],_0x5b0ae2,_0x25838b),_0x5deb7a=_0x5df41d['data']['map'](_0x458880=>({'name':_0x458880['column_name'],'type':_0x458880['column_type']})),_0x4f4789=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x5b0ae2['segment'][_0x3f14d4(0x2a5)](_0x54f853),{'verbose':_0x25838b[_0x3f14d4(0x1db)]}),_0x1a2aad=[];for(const _0x1d11a8 of _0x4f4789[_0x3f14d4(0x183)]){const _0x1a6b8a='behavior_'+_0x1d11a8[_0x3f14d4(0x1ac)]()[_0x3f14d4(0x198)](/\s+/g,'_'),_0x1467d3=_0x3f14d4(0x1b8)+_0x4fb2b0+'.'+_0x1a6b8a;let _0x3cf195=[];try{const _0x21f202=await executeSchemaQuery(_0x1467d3,_0x5b0ae2,_0x25838b);_0x3cf195=_0x21f202[_0x3f14d4(0x183)]['map'](_0x54cf87=>({'name':_0x54cf87[_0x3f14d4(0x201)],'type':_0x54cf87[_0x3f14d4(0x1fd)]}));}catch{}_0x1a2aad[_0x3f14d4(0x199)]({'table':_0x1a6b8a,'columns':_0x3cf195});}return{'database':_0x4fb2b0,'parent_segment':_0x10ec89,'parent_id':_0x54f853,'customers':{'table':_0x3f14d4(0x1d1),'columns':_0x5deb7a},'behaviors':_0x1a2aad};}[a22_0x1b8974(0x1b5)](_0x17041e){const _0x313fd2=a22_0x1b8974,_0x88da5d=_0x11a528=>{const _0x48b7bd=a22_0x1461;if(_0x11a528[_0x48b7bd(0x19f)]===0x0)return'[]';const _0x1af6f9=_0x11a528[_0x48b7bd(0x280)](_0x58e0d0=>_0x48b7bd(0x1ed)+_0x58e0d0['name']+_0x48b7bd(0x19e)+_0x58e0d0[_0x48b7bd(0x179)]+_0x48b7bd(0x297));return'[\x0a'+_0x1af6f9[_0x48b7bd(0x17f)](',\x0a')+_0x48b7bd(0x205);},_0x11ac0e=_0x17041e[_0x313fd2(0x242)][_0x313fd2(0x280)](_0x3a7867=>{const _0x615a0d=_0x313fd2;return _0x615a0d(0x295)+_0x3a7867[_0x615a0d(0x207)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x88da5d(_0x3a7867[_0x615a0d(0x195)])[_0x615a0d(0x198)](/^/gm,'\x20\x20')[_0x615a0d(0x1c7)]()+_0x615a0d(0x186);})[_0x313fd2(0x17f)](',\x0a');return _0x313fd2(0x261)+_0x17041e['database']+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x17041e[_0x313fd2(0x208)]+_0x313fd2(0x22e)+_0x17041e[_0x313fd2(0x29e)]+_0x313fd2(0x176)+_0x17041e[_0x313fd2(0x1d1)][_0x313fd2(0x207)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x88da5d(_0x17041e['customers']['columns'])['replace'](/^/gm,'\x20\x20')[_0x313fd2(0x1c7)]()+_0x313fd2(0x1c6)+_0x11ac0e+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x211);[a22_0x1b8974(0x1bc)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a22_0x1b8974(0x1a4)](_0x13dc1d){const _0x34a588=a22_0x1b8974,{options:_0x1a3ca9,args:_0x12c178,tdx:_0x26ec5e}=_0x13dc1d,_0x3b321d=_0x12c178[0x0]||_0x1a3ca9[_0x34a588(0x174)];if(!_0x3b321d)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'+_0x34a588(0x2a8)),0x1;_0x1a3ca9['verbose']&&(console['error'](_0x34a588(0x2aa)+_0x1a3ca9['site']),console[_0x34a588(0x2b3)]('Parent\x20segment:\x20'+_0x3b321d));const _0x4c270e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3b321d+'\x27...',()=>_0x26ec5e[_0x34a588(0x1d7)]['resolveParentId'](_0x3b321d),{'verbose':_0x1a3ca9[_0x34a588(0x1db)]}),_0x3ce11b=_0x4c270e[_0x34a588(0x183)],_0xce7896=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3b321d+_0x34a588(0x171),()=>_0x26ec5e[_0x34a588(0x1d7)][_0x34a588(0x298)](_0x3ce11b),{'verbose':_0x1a3ca9[_0x34a588(0x1db)]}),_0xaff18a=_0xce7896[_0x34a588(0x183)];return _0x1a3ca9['format']===_0x34a588(0x28b)||_0x1a3ca9[_0x34a588(0x18f)]==='jsonl'?await handleSDKOutput([{'sql':_0xaff18a}],_0x1a3ca9):console[_0x34a588(0x1e6)](_0xaff18a),0x0;}}function a22_0x1461(_0x5dd584,_0x10a6e3){_0x5dd584=_0x5dd584-0x169;const _0x574e67=a22_0x574e();let _0x1461ec=_0x574e67[_0x5dd584];return _0x1461ec;}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x1b8974(0x1ff)]=a22_0x1b8974(0x1f3);[a22_0x1b8974(0x1bc)]=a22_0x1b8974(0x225);async[a22_0x1b8974(0x1a4)](_0xc22a9){const _0x487267=a22_0x1b8974,{options:_0x556534,args:_0x443780,tdx:_0x54e17b}=_0xc22a9,_0x49963d=_0x443780[0x0]||_0x556534[_0x487267(0x174)];if(!_0x49963d)return showParentSegmentNotSetError(_0x487267(0x16d)+_0x487267(0x256)),0x1;_0x556534['verbose']&&(console[_0x487267(0x2b3)](_0x487267(0x2aa)+_0x556534[_0x487267(0x273)]),console[_0x487267(0x2b3)](_0x487267(0x1aa)+_0x49963d));const _0x5e6a7f=await withSpinner(_0x487267(0x28d)+_0x49963d+'\x27...',()=>_0x54e17b[_0x487267(0x1d7)]['resolveParentId'](_0x49963d),{'verbose':_0x556534[_0x487267(0x1db)]}),_0x1e50c8=_0x5e6a7f[_0x487267(0x183)],_0x58660f=await withSpinner(_0x487267(0x26b)+_0x49963d+_0x487267(0x171),()=>_0x54e17b['segment'][_0x487267(0x298)](_0x1e50c8),{'verbose':_0x556534[_0x487267(0x1db)]});let _0x31220d=_0x58660f['data'];const _0x2e8310=resolveLimit(_0x556534[_0x487267(0x240)],DEFAULT_DISPLAY_LIMIT),_0x28be0d=/\bLIMIT\s+\d+/i[_0x487267(0x1c5)](_0x31220d);!_0x28be0d&&(_0x31220d=_0x31220d[_0x487267(0x1c7)]()[_0x487267(0x198)](/;+$/,''),_0x31220d='SELECT\x20*\x20FROM\x20(\x0a'+_0x31220d+_0x487267(0x2a0)+_0x2e8310);_0x556534['verbose']&&console[_0x487267(0x2b3)](_0x487267(0x1e8)+_0x31220d);const _0x43ff02=await withProgressSpinner(_0x487267(0x1eb),async _0xc31092=>{const _0x30e053=_0x487267,_0x30e196=await _0x54e17b[_0x30e053(0x218)][_0x30e053(0x1a4)](_0x31220d,{'catalog':'td','schema':_0x30e053(0x22c),'onJobId':_0x78a620=>{const _0x2770bd=_0x30e053;_0xc31092[_0x2770bd(0x1e7)](_0x78a620);}});return _0x30e196;},{'verbose':_0x556534[_0x487267(0x1db)]}),_0x3f97bc=_0x43ff02['data'],_0x2da2bd=_0x3f97bc[_0x487267(0x293)]?_0x487267(0x18b)+_0x3f97bc[_0x487267(0x293)]+']':'';return console[_0x487267(0x2b3)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x3f97bc['stats'][_0x487267(0x236)][_0x487267(0x20e)]()+_0x487267(0x29b)+(_0x487267(0x1a7)+formatElapsed(_0x3f97bc['stats'][_0x487267(0x260)])+_0x2da2bd)),await handleQueryOutput(_0x3f97bc,_0x556534),0x0;}}
|
|
1
|
+
const a22_0x1a5e68=a22_0x1aab;(function(_0x76610d,_0x6e1fe9){const _0x5a93d1=a22_0x1aab,_0x2a1ead=_0x76610d();while(!![]){try{const _0x26df42=parseInt(_0x5a93d1(0x1b8))/0x1+parseInt(_0x5a93d1(0x296))/0x2+-parseInt(_0x5a93d1(0x1e2))/0x3*(parseInt(_0x5a93d1(0x24a))/0x4)+-parseInt(_0x5a93d1(0x208))/0x5+-parseInt(_0x5a93d1(0x1f1))/0x6*(-parseInt(_0x5a93d1(0x1f8))/0x7)+-parseInt(_0x5a93d1(0x23b))/0x8*(parseInt(_0x5a93d1(0x252))/0x9)+parseInt(_0x5a93d1(0x1d4))/0xa*(parseInt(_0x5a93d1(0x224))/0xb);if(_0x26df42===_0x6e1fe9)break;else _0x2a1ead['push'](_0x2a1ead['shift']());}catch(_0x570dda){_0x2a1ead['push'](_0x2a1ead['shift']());}}}(a22_0x3772,0x7da45));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x3c811b from'path';function a22_0x3772(){const _0x2dfa33=['Apply\x20changes\x20to\x20\x27','behaviorsFile','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','using\x20the\x20default\x20path:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Source:','utf-8','message','Updating','\x20Opening\x20','Listing\x20parent\x20segments\x20matching\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','master','\x20\x20Columns:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','stats','yes','sort','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','✔\x20Found\x20','\x20Context\x20set:\x20','elapsedTimeMillis','name','pushParentYaml','\x20\x20\x20\x20-\x20','\x20rows\x20','totalEvents','\x5c$&','json','scheduleOption','Fetching\x20parent\x20segment\x20\x27','jsonl','/\x20→\x20','displayBehaviorsStats','customerGroup','Output\x20Database:','platform','description','status','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','previewParentYaml','validateParentYaml','Error\x20parsing\x20YAML:\x20','length','use','Listing\x20fields\x20for\x20\x27','collectSchema','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','ignore','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Options:','start','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20--enriched','✔\x20Renamed\x20directory\x20to\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','segment:parent:view','Schema\x20saved\x20to\x20','map','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','130970QLoRZc','behavior','column','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','timezone','Updating\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','displayValidateResults','\x20--attribute\x20\x22<name>\x22','workflowSessionId','SELECT\x20*\x20FROM\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','all','displayPreviewHints','\x0aChanges\x20to\x20\x27','runParent','\x0aChanges\x20to\x20apply\x20to\x20\x27','joinKey','\x20=\x20','test','\x20\x20Database:\x20','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','trim','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Pattern:\x20','customerGroupFile','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','repeat','\x22\x20}','Fetching\x20sample\x20data...','Created','segment:parent:desc','toLowerCase','displayColumns','audienceId','YAML\x20file:\x20','\x27\x20and\x20run\x20workflow?','open','Found\x20YAML\x20file:\x20','\x20--interval\x20','Error\x20reading\x20file:\x20','/attempt/','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Available\x20attributes:','\x0aNo\x20sample\x20data\x20available','processedRows','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','/\x20directories\x20exist.','Error:\x20--behavior\x20requires\x20a\x20name\x0a','matchedCount','sampleData','workflowAttemptId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','parentSegment','Listing\x20parent\x20segments...','column_name','\x20--behavior\x20\x22','Fetching\x20current\x20configuration\x20for\x20\x27','Behaviors','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','/sessions/','No\x20parent\x20segments\x20found','Error:\x20Parent\x20segment\x20name\x20is\x20required','format','foreignKey','Audience\x20ID:','match','displaySampleData','Options:\x0a','formatSchemaJson','\x0a⚠️\x20\x20Migrating:\x20','behaviors','SELECT\x20*\x20FROM\x20(\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','/app/workflows/','\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','\x20rows)','bold','jobId','double','schemaValid','Database:\x20','allValid','attributesFile','parent_segment','\x0a⚠️\x20\x20Both\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Columns:','displayMasterInfo','isDirectory','addAttributes','Output\x20file:\x20','\x20parent\x20segment\x20\x27','segment','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','✔\x20Query\x20completed:\x20Processed\x20','darwin','table','addBehaviors','\x20\x20Tables:\x201\x20customers\x20+\x20','rowCount','Join:','resolveParentId','parent_segments','Options\x20(one\x20required):\x0a','Attributes','.yaml','Executing\x20parent\x20segment\x20query...','\x27...','number','656399FtCGkd','\x27\x20with\x20ID:\x20','segment:parent:show','population','segment:parent:sql','\x0a\x20\x20]\x0a}\x0a','Errors:','output','\x20--attribute\x20\x22','apply','updateParent','Attempt:','Enriched:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','setJobId','displayPreviewResults','✔\x20Updated\x20parent\x20segment\x20\x27','Creating','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','join','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','replace','coveragePercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Attribute:','string','addBehaviorsFile','getBehaviorNames','530XUJXxa','type','schemaError','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','.yml','verbose','Error:\x20File\x20not\x20found:\x20','execute','`\x20to\x20download\x20the\x20configuration\x20first','customersWithEvents','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','columns','Updated','toFixed','429zDXfYH','\x0aNew\x20parent\x20segment\x20\x27','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','database','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','errors','site','/\x20and\x20','web','tdx\x20segment\x20parent\x20preview\x20','segment:parent:run','Resolving\x20parent\x20segment\x20\x27','\x20total','1343334zlzyhw','FINISHED','interval','green','displayAttributesStats','customers','limit','7IgAeDC','attributes','column_type','in\x20','segment:parent:create','segment:parent:preview','log','yellow','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','enriched','session','/app/dw/parentSegments/','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','/{name}.yml\x0a','To\x20cancel:','\x20\x20Note:\x20','1838550NpOBLE','\x20kill','Error:','\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','To\x20view\x20sample\x20data:','Creating\x20parent\x20segment\x20\x27','preview','workflowId','✘\x20Failed\x20to\x20rename\x20directory:\x20','displaySummary','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','listParents','listFields','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Fetching\x20behavior\x20list...','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','attribute','\x0a✔\x20Workflow\x20started','Create\x20parent\x20segment\x20\x27','Overwrite\x20\x27','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','cyan','parent_id','Preview:','203060TqkDyW','customerPercent','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','localeCompare','endsWith','win32','dirname','error','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','dim','pullParentYaml','varchar','getParentSQL','getOutputDatabaseName','Available\x20behaviors:','scheduleType','red','stop','run','\x20parent\x20segment','filter','data','Analyzing\x20changes...','284264KEnEtS','Site:\x20','Parent\x20segment:\x20','Table:\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Fetching\x20customers\x20schema...','getParentFull','\x27\x20is\x20already\x20up\x20to\x20date','text','List\x20parent\x20segments','information_schema','\x0aError:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Aborted.','24172itJPBW','behavior_','\x20behaviors','Status:','query','Name:\x20','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','45dUfZUC','%)\x20','toLocaleString','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires'];a22_0x3772=function(){return _0x2dfa33;};return a22_0x3772();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a22_0x1aab(_0xb85020,_0x2de41f){_0xb85020=_0xb85020-0x18f;const _0x37726e=a22_0x3772();let _0x1aab7e=_0x37726e[_0xb85020];return _0x1aab7e;}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_0x5b42bc 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_0x1a5e68(0x1b1),LEGACY_PARENT_SEGMENT_DIR=a22_0x1a5e68(0x19e);function openBrowser(_0x2ca94f){const _0x248c35=a22_0x1a5e68,_0x166219=process[_0x248c35(0x27b)],_0x5dfcdb=_0x166219===_0x248c35(0x1aa)?_0x248c35(0x2bb):_0x166219===_0x248c35(0x229)?_0x248c35(0x28b):'xdg-open';spawn(_0x5dfcdb,[_0x2ca94f],{'detached':!![],'stdio':_0x248c35(0x288)})['unref']();}function migrateLegacyDirectory(){const _0x506e62=a22_0x1a5e68;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4907c6=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4907c6[_0x506e62(0x1a3)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x506e62(0x22b)](a22_0x5b42bc[_0x506e62(0x1ff)](_0x506e62(0x19f)+LEGACY_PARENT_SEGMENT_DIR+_0x506e62(0x1eb)+PARENT_SEGMENT_DIR+_0x506e62(0x2c5))),console[_0x506e62(0x22b)](a22_0x5b42bc[_0x506e62(0x22d)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x5b42bc[_0x506e62(0x1ff)](_0x506e62(0x2dc)+LEGACY_PARENT_SEGMENT_DIR+_0x506e62(0x277)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x506e62(0x22b)](a22_0x5b42bc[_0x506e62(0x1f4)](_0x506e62(0x28f)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0xfe764a){const _0x2d34fb=_0xfe764a instanceof Error?_0xfe764a[_0x506e62(0x25e)]:String(_0xfe764a);return console[_0x506e62(0x22b)](a22_0x5b42bc[_0x506e62(0x234)](_0x506e62(0x211)+_0x2d34fb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x39d18f){const _0x31a6f4=a22_0x1a5e68;return migrateLegacyDirectory(),super[_0x31a6f4(0x236)](_0x39d18f);}}function resolveYamlFile(_0x14a3c7){const _0x2332e3=a22_0x1a5e68;if(_0x14a3c7[_0x2332e3(0x228)](_0x2332e3(0x1d8))||_0x14a3c7[_0x2332e3(0x228)](_0x2332e3(0x1b4)))return _0x14a3c7;return a22_0x3c811b[_0x2332e3(0x1cb)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x14a3c7)+_0x2332e3(0x1d8));}function formatProgressMessage(_0x50418a){const _0x44f13c=a22_0x1a5e68,_0x2743c4=_0x50418a[_0x44f13c(0x2d8)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2743c4){const [,_0x28038a,_0x40a9eb,_0x4e180f='']=_0x2743c4;return a22_0x5b42bc['dim'](_0x28038a+':')+'\x20'+_0x40a9eb+a22_0x5b42bc[_0x44f13c(0x22d)](_0x4e180f);}return a22_0x5b42bc['dim'](_0x50418a);}function showFileNotFoundError(_0x2011d1,_0x3becf2){const _0x539c28=a22_0x1a5e68;console[_0x539c28(0x22b)](a22_0x5b42bc['red'](_0x539c28(0x1da)+_0x2011d1+'\x0a')),console['error'](a22_0x5b42bc[_0x539c28(0x221)](_0x539c28(0x27e)+_0x3becf2+_0x539c28(0x1dc)));}function showParentSegmentNotSetError(_0x420650){const _0x3e56d9=a22_0x1a5e68;console[_0x3e56d9(0x22b)](a22_0x5b42bc[_0x3e56d9(0x1ff)](_0x3e56d9(0x2c0))),console['error'](_0x420650);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]='segment:parent:list';[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x244);async[a22_0x1a5e68(0x1db)](_0x5776c1){const _0x52898e=a22_0x1a5e68,{options:_0x3ab449,args:_0x5deb13,tdx:_0xb7be4c}=_0x5776c1,_0x521ffb=_0x5deb13[0x0];_0x3ab449[_0x52898e(0x1d9)]&&(console[_0x52898e(0x22b)](_0x52898e(0x23c)+_0x3ab449[_0x52898e(0x1ea)]),_0x521ffb&&console[_0x52898e(0x22b)](_0x52898e(0x2ae)+_0x521ffb));const _0x3ffeeb=await withSpinner(_0x521ffb?_0x52898e(0x261)+_0x521ffb+'\x27...':_0x52898e(0x2cc),()=>_0xb7be4c[_0x52898e(0x1a7)][_0x52898e(0x217)](),{'verbose':_0x3ab449['verbose']});let _0x1615ef=_0x3ffeeb[_0x52898e(0x239)];if(_0x521ffb){const _0x33ff65=_0x521ffb[_0x52898e(0x1cd)](/[.+^${}()|[\]\\]/g,_0x52898e(0x272))[_0x52898e(0x1cd)](/\*/g,'.*')[_0x52898e(0x1cd)](/\?/g,'.'),_0x5ae44a=new RegExp('^'+_0x33ff65+'$','i');_0x1615ef=_0x1615ef[_0x52898e(0x238)](_0x5f123f=>_0x5ae44a[_0x52898e(0x2a9)](_0x5f123f['attributes'][_0x52898e(0x26d)]));}_0x1615ef[_0x52898e(0x268)]((_0x3bf65d,_0x1a8e4f)=>_0x3bf65d['attributes'][_0x52898e(0x26d)][_0x52898e(0x227)](_0x1a8e4f['attributes'][_0x52898e(0x26d)])),console[_0x52898e(0x22b)](_0x52898e(0x26a)+_0x1615ef['length']+_0x52898e(0x237)+(_0x1615ef[_0x52898e(0x283)]!==0x1?'s':''));const _0x3f8b27=_0x26064a=>{const _0x354ef1=_0x52898e;return getConsoleNextUrl(_0x3ab449['site'],_0x354ef1(0x203)+_0x26064a);};if(_0x3ab449[_0x52898e(0x2d5)]===_0x52898e(0x273)||_0x3ab449[_0x52898e(0x2d5)]===_0x52898e(0x276)){const _0x2b1fb6=_0x1615ef[_0x52898e(0x293)](_0x3f3c82=>({..._0x3f3c82,'url':_0x3f8b27(_0x3f3c82['id'])}));await handleSDKOutput(_0x2b1fb6,_0x3ab449);}else{if(_0x1615ef[_0x52898e(0x283)]===0x0)_0x521ffb?console[_0x52898e(0x1fe)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x521ffb):console[_0x52898e(0x1fe)](_0x52898e(0x2d3));else for(const _0x122bd8 of _0x1615ef){const _0x539a07=_0x122bd8[_0x52898e(0x1f9)][_0x52898e(0x1bb)]?a22_0x5b42bc['dim']('\x20('+formatRows(_0x122bd8[_0x52898e(0x1f9)]['population'])+')'):'',_0x19284f=hyperlink(_0x122bd8[_0x52898e(0x1f9)][_0x52898e(0x26d)],_0x3f8b27(_0x122bd8['id']));console[_0x52898e(0x1fe)]('👥\x20'+_0x19284f+_0x539a07);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x1a5e68(0x1fc);[a22_0x1a5e68(0x27c)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x1a5e68(0x1db)](_0x1a2f01){const _0x35724a=a22_0x1a5e68,{options:_0x499723,args:_0x4499ed,tdx:_0x2532df}=_0x1a2f01;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x35724a(0x21b)+_0x35724a(0x251));const _0x3b357e=_0x499723;if(_0x4499ed[_0x35724a(0x283)]===0x0)return console[_0x35724a(0x22b)](a22_0x5b42bc['red'](_0x35724a(0x2d4))),console[_0x35724a(0x22b)](_0x35724a(0x269)),0x1;const _0x43d71f=_0x4499ed[0x0];if(!_0x3b357e[_0x35724a(0x1e6)]||!_0x3b357e[_0x35724a(0x1ab)])return console[_0x35724a(0x22b)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x35724a(0x269)),0x1;_0x3b357e[_0x35724a(0x1d9)]&&(console[_0x35724a(0x22b)](_0x35724a(0x23c)+_0x3b357e[_0x35724a(0x1ea)]),console[_0x35724a(0x22b)](_0x35724a(0x24f)+_0x43d71f),console['error'](_0x35724a(0x19b)+_0x3b357e['database']),console['error'](_0x35724a(0x23e)+_0x3b357e[_0x35724a(0x1ab)]));const _0x32fd5c=await loadJSONFromOptions(_0x3b357e['attributes'],_0x3b357e[_0x35724a(0x19d)]),_0xf9abfb=await loadJSONFromOptions(_0x3b357e['behaviors'],_0x3b357e[_0x35724a(0x258)]),_0x2bdc9f=await loadJSONFromOptions(_0x3b357e[_0x35724a(0x279)],_0x3b357e[_0x35724a(0x2af)]),_0x573bf1={'name':_0x43d71f,'description':_0x3b357e['description'],'scheduleType':_0x3b357e[_0x35724a(0x233)],'scheduleOption':_0x3b357e[_0x35724a(0x274)],'timezone':_0x3b357e[_0x35724a(0x29a)],'master':{'parentDatabaseName':_0x3b357e['database'],'parentTableName':_0x3b357e[_0x35724a(0x1ab)]},'attributes':_0x32fd5c,'behaviors':_0xf9abfb,'customerGroup':_0x2bdc9f},_0x422501=await withSpinner(_0x35724a(0x20e)+_0x43d71f+_0x35724a(0x1b6),()=>_0x2532df[_0x35724a(0x1a7)]['createParent'](_0x573bf1),{'verbose':_0x499723[_0x35724a(0x1d9)]}),_0xeaca83=_0x422501['data'];return console[_0x35724a(0x22b)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0xeaca83[_0x35724a(0x26d)]+_0x35724a(0x1b9)+_0xeaca83['id']),await handleSDKOutput([_0xeaca83],_0x499723),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]='segment:parent:update';[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x255);async[a22_0x1a5e68(0x1db)](_0x39e9a2){const _0x43fb86=a22_0x1a5e68,{options:_0x57331a,args:_0x8a5c81,tdx:_0x45baca}=_0x39e9a2;console[_0x43fb86(0x22b)](_0x43fb86(0x247)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x43fb86(0x251));const _0x10981a=_0x57331a;if(_0x8a5c81[_0x43fb86(0x283)]===0x0)return console[_0x43fb86(0x22b)](a22_0x5b42bc['red'](_0x43fb86(0x2d4))),console[_0x43fb86(0x22b)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x41a5d5=_0x8a5c81[0x0];_0x10981a['verbose']&&(console[_0x43fb86(0x22b)]('Site:\x20'+_0x10981a[_0x43fb86(0x1ea)]),console[_0x43fb86(0x22b)](_0x43fb86(0x23d)+_0x41a5d5));const _0x46c3b5=await withSpinner(_0x43fb86(0x2cf)+_0x41a5d5+_0x43fb86(0x1b6),()=>_0x45baca[_0x43fb86(0x1a7)][_0x43fb86(0x241)](_0x41a5d5),{'verbose':_0x10981a[_0x43fb86(0x1d9)]}),_0x1fd8b1=_0x46c3b5['data'],_0x185667=await loadJSONFromOptions(_0x10981a[_0x43fb86(0x1a4)],_0x10981a['addAttributesFile']),_0x1ff7a1=await loadJSONFromOptions(_0x10981a[_0x43fb86(0x1ac)],_0x10981a[_0x43fb86(0x1d2)]),_0x1f7b63={'name':_0x1fd8b1[_0x43fb86(0x26d)],'description':_0x10981a[_0x43fb86(0x27c)]!==undefined?_0x10981a[_0x43fb86(0x27c)]:_0x1fd8b1[_0x43fb86(0x27c)],'scheduleType':_0x10981a[_0x43fb86(0x233)]!==undefined?_0x10981a[_0x43fb86(0x233)]:_0x1fd8b1['scheduleType'],'scheduleOption':_0x10981a['scheduleOption']!==undefined?_0x10981a[_0x43fb86(0x274)]:_0x1fd8b1['scheduleOption'],'timezone':_0x10981a['timezone']!==undefined?_0x10981a[_0x43fb86(0x29a)]:_0x1fd8b1['timezone'],'master':_0x1fd8b1[_0x43fb86(0x263)],'attributes':_0x185667?[..._0x1fd8b1[_0x43fb86(0x1f9)]||[],..._0x185667]:_0x1fd8b1[_0x43fb86(0x1f9)],'behaviors':_0x1ff7a1?[..._0x1fd8b1[_0x43fb86(0x18f)]||[],..._0x1ff7a1]:_0x1fd8b1['behaviors'],'customerGroup':_0x1fd8b1[_0x43fb86(0x279)]},_0x2dcd32=await withSpinner(_0x43fb86(0x29b)+_0x41a5d5+'\x27...',()=>_0x45baca[_0x43fb86(0x1a7)][_0x43fb86(0x1c2)](_0x41a5d5,_0x1f7b63),{'verbose':_0x10981a[_0x43fb86(0x1d9)]}),_0x3a40c2=_0x2dcd32[_0x43fb86(0x239)];return console['error'](_0x43fb86(0x1c8)+_0x3a40c2[_0x43fb86(0x26d)]+'\x27'),await handleSDKOutput([_0x3a40c2],_0x10981a),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';['description']=a22_0x1a5e68(0x204);async[a22_0x1a5e68(0x1db)](_0x45b265){const _0x2a480d=a22_0x1a5e68,{options:_0xbfaf14,args:_0x5d2b75,tdx:_0x5cbe93}=_0x45b265,_0x250bb0=_0xbfaf14,_0x126721=_0x5d2b75[0x0]||_0xbfaf14[_0x2a480d(0x2cb)];if(!_0x126721)return showParentSegmentNotSetError(_0x2a480d(0x2c4)+_0x2a480d(0x213)),0x1;if(_0x250bb0[_0x2a480d(0x284)]&&_0x250bb0[_0x2a480d(0x1bf)])return console[_0x2a480d(0x22b)](a22_0x5b42bc[_0x2a480d(0x234)](_0x2a480d(0x1de))),console['error'](a22_0x5b42bc[_0x2a480d(0x22d)](_0x2a480d(0x256))),console[_0x2a480d(0x22b)](a22_0x5b42bc['dim'](_0x2a480d(0x25a)+PARENT_SEGMENT_DIR+_0x2a480d(0x205))),console[_0x2a480d(0x22b)](a22_0x5b42bc[_0x2a480d(0x221)](_0x2a480d(0x191))),0x1;const _0x13b2db=_0x250bb0[_0x2a480d(0x1bf)]||a22_0x3c811b[_0x2a480d(0x1cb)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x126721)+_0x2a480d(0x1d8));_0x250bb0['verbose']&&(console[_0x2a480d(0x22b)](_0x2a480d(0x23c)+_0x250bb0[_0x2a480d(0x1ea)]),console[_0x2a480d(0x22b)](_0x2a480d(0x23d)+_0x126721),console[_0x2a480d(0x22b)](_0x2a480d(0x1a5)+_0x13b2db));const _0x348895=await withSpinner(_0x2a480d(0x275)+_0x126721+_0x2a480d(0x1b6),()=>_0x5cbe93[_0x2a480d(0x1a7)][_0x2a480d(0x22e)](_0x126721),{'verbose':_0x250bb0[_0x2a480d(0x1d9)]}),_0x3ca4d9=_0x348895[_0x2a480d(0x239)];if(existsSync(_0x13b2db)){const _0x3dfbec=readFileSync(_0x13b2db,'utf-8'),_0xc95ea4=generateDiff(_0x3dfbec,_0x3ca4d9);if(!hasChanges(_0xc95ea4))console['error'](a22_0x5b42bc[_0x2a480d(0x1f4)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x5b42bc[_0x2a480d(0x221)](_0x13b2db)+_0x2a480d(0x20b));else{console['error'](_0x2a480d(0x2a4)+_0x13b2db+'\x27:'),console[_0x2a480d(0x22b)]('─'[_0x2a480d(0x2b1)](0x3c)),console[_0x2a480d(0x22b)](formatDiffWithColors(_0xc95ea4)),console[_0x2a480d(0x22b)]('─'[_0x2a480d(0x2b1)](0x3c));if(!_0x250bb0[_0x2a480d(0x267)]){if(!isInteractive())return console[_0x2a480d(0x22b)](a22_0x5b42bc['red'](_0x2a480d(0x246)),_0x2a480d(0x27f)),console[_0x2a480d(0x22b)](a22_0x5b42bc[_0x2a480d(0x22d)](_0x2a480d(0x200))),0x1;const _0x3fdac1=await confirmKey(_0x2a480d(0x21f)+_0x13b2db+'\x27?');if(!_0x3fdac1)return console[_0x2a480d(0x22b)](a22_0x5b42bc[_0x2a480d(0x1ff)](_0x2a480d(0x249))),0x1;}writeFileSync(_0x13b2db,_0x3ca4d9,_0x2a480d(0x25d)),console['error'](a22_0x5b42bc[_0x2a480d(0x1f4)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x5b42bc[_0x2a480d(0x221)](_0x13b2db));}}else{const _0x345b87=a22_0x3c811b[_0x2a480d(0x22a)](_0x13b2db);!existsSync(_0x345b87)&&mkdirSync(_0x345b87,{'recursive':!![]}),writeFileSync(_0x13b2db,_0x3ca4d9,_0x2a480d(0x25d)),console[_0x2a480d(0x22b)](a22_0x5b42bc[_0x2a480d(0x1f4)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x5b42bc[_0x2a480d(0x221)](_0x13b2db));}return saveSessionContext({'parent_segment':_0x126721},_0x250bb0[_0x2a480d(0x202)]),console['error'](a22_0x5b42bc[_0x2a480d(0x1f4)]('✔')+_0x2a480d(0x26b)+a22_0x5b42bc[_0x2a480d(0x22d)](_0x2a480d(0x19e))+_0x2a480d(0x2a8)+a22_0x5b42bc['cyan'](_0x126721)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x1a5e68(0x26d)]='segment:parent:push';[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x1ca);async[a22_0x1a5e68(0x1db)](_0x5a942d){const _0x941705=a22_0x1a5e68,{options:_0x4dde4e,args:_0x11ca82,tdx:_0x2c20d2}=_0x5a942d,_0x2a9b95=_0x4dde4e,_0xcd6f80=_0x11ca82[0x0]||_0x4dde4e[_0x941705(0x2cb)];if(!_0xcd6f80)return showParentSegmentNotSetError(_0x941705(0x248)+_0x941705(0x219)),0x1;const _0xc2e74b=resolveYamlFile(_0xcd6f80);if(!existsSync(_0xc2e74b))return showFileNotFoundError(_0xc2e74b,_0xcd6f80),0x1;_0x2a9b95[_0x941705(0x1d9)]&&(console['error'](_0x941705(0x23c)+_0x2a9b95[_0x941705(0x1ea)]),console[_0x941705(0x22b)](_0x941705(0x2b9)+_0xc2e74b));let _0x813a13;try{_0x813a13=readFileSync(_0xc2e74b,_0x941705(0x25d));}catch(_0x37051b){const _0x28b927=_0x37051b instanceof Error?_0x37051b['message']:String(_0x37051b);return console['error'](_0x941705(0x2be)+_0x28b927),0x1;}const _0x581508=await withSpinner(_0x941705(0x23a),()=>_0x2c20d2[_0x941705(0x1a7)][_0x941705(0x26e)](_0x813a13),{'verbose':_0x2a9b95['verbose']}),_0x32b566=_0x581508[_0x941705(0x239)],{isNew:_0xe798b5,name:_0x18688e,hasChanges:_0x383c21,diffFormatted:_0xb0eef}=_0x32b566;if(!_0x383c21)return console[_0x941705(0x22b)](_0x941705(0x250)+_0x18688e+_0x941705(0x242)),0x0;_0xe798b5?console['error'](_0x941705(0x1e3)+_0x18688e+'\x27:'):console[_0x941705(0x22b)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x18688e+'\x27:');console[_0x941705(0x22b)]('─'[_0x941705(0x2b1)](0x3c)),console[_0x941705(0x22b)](_0xb0eef),console[_0x941705(0x22b)]('─'[_0x941705(0x2b1)](0x3c));const _0x478cc0=_0xe798b5?'Create\x20parent\x20segment\x20\x27'+_0x18688e+'\x27?':_0x941705(0x257)+_0x18688e+'\x27?';if(!_0x2a9b95[_0x941705(0x267)]){if(!isInteractive())return console['error'](a22_0x5b42bc['red'](_0x941705(0x246)),_0x941705(0x27f)),console[_0x941705(0x22b)](a22_0x5b42bc[_0x941705(0x22d)](_0x941705(0x200))),0x1;const _0x1af078=await confirmKey(_0x478cc0);if(!_0x1af078)return console['error'](a22_0x5b42bc[_0x941705(0x1ff)](_0x941705(0x249))),0x1;}const _0xcefe86=_0xe798b5?'Creating':_0x941705(0x25f),_0xcd74c1=await withSpinner(_0xcefe86+_0x941705(0x1a6)+_0x18688e+'\x27...',()=>_0x32b566[_0x941705(0x1c1)](),{'verbose':_0x2a9b95[_0x941705(0x1d9)]}),_0x46e760=_0xcd74c1[_0x941705(0x239)],_0x5c9a2b=getConsoleNextUrl(_0x2a9b95[_0x941705(0x1ea)],_0x941705(0x203)+_0x46e760['id']),_0xc02b77=_0xe798b5?'Created':_0x941705(0x1e0);return console[_0x941705(0x22b)]('✔\x20'+_0xc02b77+_0x941705(0x1a6)+_0x46e760['name']+'\x27'),console[_0x941705(0x22b)]('\x20\x20'+_0x5c9a2b),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']='segment:parent:validate';[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x290);async[a22_0x1a5e68(0x1db)](_0x52ae4c){const _0x32bf30=a22_0x1a5e68,{options:_0x522e67,args:_0x344946,tdx:_0x5c0e88}=_0x52ae4c,_0x2eb85a=_0x522e67,_0x35f41f=_0x344946[0x0]||_0x522e67[_0x32bf30(0x2cb)];if(!_0x35f41f)return showParentSegmentNotSetError(_0x32bf30(0x215)+_0x32bf30(0x294)+_0x32bf30(0x2da)+_0x32bf30(0x1e5)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x32bf30(0x2ca)),0x1;const _0x53a23f=resolveYamlFile(_0x35f41f);if(!existsSync(_0x53a23f))return showFileNotFoundError(_0x53a23f,_0x35f41f),0x1;_0x2eb85a[_0x32bf30(0x1d9)]&&(console[_0x32bf30(0x22b)]('Site:\x20'+_0x2eb85a[_0x32bf30(0x1ea)]),console[_0x32bf30(0x22b)](_0x32bf30(0x2b9)+_0x53a23f));let _0x36bf4b;try{_0x36bf4b=readFileSync(_0x53a23f,_0x32bf30(0x25d));}catch(_0x1c9eb9){const _0x1ae161=_0x1c9eb9 instanceof Error?_0x1c9eb9[_0x32bf30(0x25e)]:String(_0x1c9eb9);return console[_0x32bf30(0x22b)](_0x32bf30(0x2be)+_0x1ae161),0x1;}const _0x2ae42f=createCommandSpinner(a22_0x5b42bc[_0x32bf30(0x22d)]('Validating\x20configuration...'),{'verbose':_0x2eb85a[_0x32bf30(0x1d9)]});_0x2ae42f[_0x32bf30(0x28b)]();const _0x248987={'onProgress':_0x4b3bb8=>{const _0x2d9d7a=_0x32bf30;_0x2ae42f[_0x2d9d7a(0x243)]=formatProgressMessage(_0x4b3bb8);}};if(_0x2eb85a[_0x32bf30(0x263)])_0x248987[_0x32bf30(0x263)]=!![];if(_0x2eb85a['enriched'])_0x248987[_0x32bf30(0x201)]=!![];_0x2eb85a[_0x32bf30(0x21c)]&&(_0x248987[_0x32bf30(0x21c)]=_0x2eb85a[_0x32bf30(0x21c)]);_0x2eb85a[_0x32bf30(0x297)]&&(_0x248987[_0x32bf30(0x297)]=_0x2eb85a[_0x32bf30(0x297)]);if(_0x2eb85a[_0x32bf30(0x1f3)])_0x248987[_0x32bf30(0x1f3)]=_0x2eb85a['interval'];let _0x187772;try{_0x187772=await _0x5c0e88['segment'][_0x32bf30(0x281)](_0x36bf4b,_0x248987),_0x2ae42f[_0x32bf30(0x235)]();}catch(_0x6549b0){_0x2ae42f[_0x32bf30(0x235)]();throw _0x6549b0;}const _0x17ad58=_0x2eb85a[_0x32bf30(0x1f3)]||'-1d';return this[_0x32bf30(0x29d)](_0x187772,_0x248987,_0x53a23f,_0x17ad58),_0x187772[_0x32bf30(0x19c)]?0x0:0x1;}[a22_0x1a5e68(0x29d)](_0x4a64a9,_0x2c9ab7,_0x4db98c,_0x2898a2){const _0x1aa65c=a22_0x1a5e68;console[_0x1aa65c(0x22b)]('\x0a'+a22_0x5b42bc[_0x1aa65c(0x197)]('Validate:')+'\x20'+_0x4a64a9[_0x1aa65c(0x26d)]),console[_0x1aa65c(0x22b)]('═'[_0x1aa65c(0x2b1)](0x3c)),this['displayMasterInfo'](_0x4a64a9);if(typeof _0x2c9ab7[_0x1aa65c(0x21c)]==='string'){this[_0x1aa65c(0x1f5)](_0x4a64a9),this[_0x1aa65c(0x212)](_0x4a64a9),this[_0x1aa65c(0x2a3)](_0x4db98c,_0x2898a2,'attribute',_0x2c9ab7[_0x1aa65c(0x21c)]);return;}if(_0x2c9ab7[_0x1aa65c(0x21c)]===!![]){this[_0x1aa65c(0x1f5)](_0x4a64a9),this[_0x1aa65c(0x212)](_0x4a64a9),this[_0x1aa65c(0x2a3)](_0x4db98c,_0x2898a2,'attributes');return;}if(typeof _0x2c9ab7[_0x1aa65c(0x297)]===_0x1aa65c(0x1d1)){this[_0x1aa65c(0x278)](_0x4a64a9,_0x2898a2),this[_0x1aa65c(0x212)](_0x4a64a9),this[_0x1aa65c(0x2a3)](_0x4db98c,_0x2898a2,_0x1aa65c(0x297),_0x2c9ab7[_0x1aa65c(0x297)]);return;}if(_0x2c9ab7[_0x1aa65c(0x297)]===!![]){this['displayBehaviorsStats'](_0x4a64a9,_0x2898a2),this[_0x1aa65c(0x212)](_0x4a64a9),this['displayPreviewHints'](_0x4db98c,_0x2898a2,_0x1aa65c(0x18f));return;}this[_0x1aa65c(0x1f5)](_0x4a64a9),this['displayBehaviorsStats'](_0x4a64a9,_0x2898a2),this[_0x1aa65c(0x212)](_0x4a64a9),this[_0x1aa65c(0x2a3)](_0x4db98c,_0x2898a2,_0x1aa65c(0x2a2));}['displayPreviewHints'](_0x4b9d83,_0x3dc7ea,_0x42b611,_0x44a37b){const _0x14fc39=a22_0x1a5e68;console[_0x14fc39(0x22b)]('\x0a'+a22_0x5b42bc[_0x14fc39(0x22d)](_0x14fc39(0x20d)));const _0x2b1e4b=_0x3dc7ea!=='-1d'?_0x14fc39(0x2bd)+_0x3dc7ea:'';if(_0x42b611===_0x14fc39(0x21c)&&_0x44a37b)console[_0x14fc39(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x14fc39(0x22d)](_0x14fc39(0x1ed)+_0x4b9d83+_0x14fc39(0x1c0)+_0x44a37b+'\x22'+_0x2b1e4b));else{if(_0x42b611==='behavior'&&_0x44a37b)console[_0x14fc39(0x22b)]('\x20\x20'+a22_0x5b42bc['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x4b9d83+'\x20--behavior\x20\x22'+_0x44a37b+'\x22'+_0x2b1e4b));else(_0x42b611==='attributes'||_0x42b611==='all')&&console[_0x14fc39(0x22b)]('\x20\x20'+a22_0x5b42bc['dim'](_0x14fc39(0x1ed)+_0x4b9d83+_0x14fc39(0x29e)+_0x2b1e4b));}(_0x42b611===_0x14fc39(0x18f)||_0x42b611===_0x14fc39(0x2a2))&&console['error']('\x20\x20'+a22_0x5b42bc[_0x14fc39(0x22d)](_0x14fc39(0x1ed)+_0x4b9d83+'\x20--behavior\x20\x22<name>\x22'+_0x2b1e4b)),_0x42b611==='all'&&console[_0x14fc39(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x14fc39(0x22d)](_0x14fc39(0x1ed)+_0x4b9d83+_0x14fc39(0x28e)+_0x2b1e4b));}[a22_0x1a5e68(0x1a2)](_0x3cafea){const _0x5589e6=a22_0x1a5e68,{master:_0x4e9bec}=_0x3cafea,_0x2e4ac6=_0x4e9bec[_0x5589e6(0x19a)]?a22_0x5b42bc[_0x5589e6(0x1f4)]('✔'):a22_0x5b42bc['red']('✘');console[_0x5589e6(0x22b)]('\x0a'+a22_0x5b42bc[_0x5589e6(0x22d)]('Master\x20Table')),console['error'](_0x2e4ac6+'\x20'+a22_0x5b42bc[_0x5589e6(0x197)](_0x4e9bec['database']+'.'+_0x4e9bec[_0x5589e6(0x1ab)])),_0x4e9bec[_0x5589e6(0x19a)]?_0x4e9bec[_0x5589e6(0x1ae)]!==undefined&&console[_0x5589e6(0x22b)]('\x20\x20'+a22_0x5b42bc['dim']('Rows:')+'\x20'+a22_0x5b42bc[_0x5589e6(0x221)](formatRows(_0x4e9bec[_0x5589e6(0x1ae)]))):console['error']('\x20\x20'+a22_0x5b42bc[_0x5589e6(0x234)]('Error:')+'\x20'+_0x4e9bec['schemaError']);}[a22_0x1a5e68(0x1f5)](_0x59e3de){const _0x3a8f39=a22_0x1a5e68;if(_0x59e3de['attributes'][_0x3a8f39(0x283)]===0x0)return;console['error']('\x0a'+a22_0x5b42bc[_0x3a8f39(0x22d)](_0x3a8f39(0x1b3)));for(const _0x58ac48 of _0x59e3de[_0x3a8f39(0x1f9)]){const _0x20a927=_0x58ac48['schemaValid']?a22_0x5b42bc['green']('✔'):a22_0x5b42bc[_0x3a8f39(0x234)]('✘');let _0x413922='';if(_0x58ac48[_0x3a8f39(0x19a)]&&_0x58ac48[_0x3a8f39(0x2c7)]!==undefined&&_0x58ac48[_0x3a8f39(0x1ce)]!==undefined){const _0x4b8c8c=_0x58ac48['coveragePercent'][_0x3a8f39(0x1e1)](0x1),_0xb48b51=_0x58ac48[_0x3a8f39(0x1ce)]>=0x50?a22_0x5b42bc[_0x3a8f39(0x1f4)]:_0x58ac48[_0x3a8f39(0x1ce)]>=0x32?a22_0x5b42bc['yellow']:a22_0x5b42bc[_0x3a8f39(0x234)];_0x413922='\x20'+a22_0x5b42bc[_0x3a8f39(0x22d)]('Coverage:')+'\x20'+_0xb48b51(_0x4b8c8c+'%')+'\x20('+formatRows(_0x58ac48[_0x3a8f39(0x2c7)])+_0x3a8f39(0x196);}console['error'](_0x20a927+'\x20'+a22_0x5b42bc[_0x3a8f39(0x197)](_0x58ac48[_0x3a8f39(0x26d)])+_0x413922),console[_0x3a8f39(0x22b)]('\x20\x20'+a22_0x5b42bc['dim'](_0x3a8f39(0x25c))+'\x20'+a22_0x5b42bc[_0x3a8f39(0x197)](_0x58ac48[_0x3a8f39(0x1e6)]+'.'+_0x58ac48[_0x3a8f39(0x1ab)]));const _0x186619=_0x58ac48['joinKey']===_0x58ac48[_0x3a8f39(0x2d6)]?a22_0x5b42bc['dim']('Join\x20on:')+'\x20'+_0x58ac48[_0x3a8f39(0x2a7)]:a22_0x5b42bc[_0x3a8f39(0x22d)](_0x3a8f39(0x1af))+'\x20'+_0x58ac48[_0x3a8f39(0x2a7)]+_0x3a8f39(0x2a8)+_0x58ac48['foreignKey'];console[_0x3a8f39(0x22b)]('\x20\x20'+_0x186619),console[_0x3a8f39(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x3a8f39(0x22d)]('Columns:')),this[_0x3a8f39(0x2b7)](_0x58ac48['columns']),!_0x58ac48[_0x3a8f39(0x19a)]&&console['error']('\x20\x20'+a22_0x5b42bc[_0x3a8f39(0x234)](_0x3a8f39(0x20a))+'\x20'+_0x58ac48[_0x3a8f39(0x1d6)]);}}[a22_0x1a5e68(0x278)](_0x2d4207,_0x14f038){const _0x545bdd=a22_0x1a5e68;if(_0x2d4207[_0x545bdd(0x18f)][_0x545bdd(0x283)]===0x0)return;console[_0x545bdd(0x22b)]('\x0a'+a22_0x5b42bc[_0x545bdd(0x22d)](_0x545bdd(0x2d0))+'\x20'+a22_0x5b42bc[_0x545bdd(0x22d)]('('+_0x14f038+')'));for(const _0x571e54 of _0x2d4207['behaviors']){const _0x3a5079=_0x571e54[_0x545bdd(0x19a)]?a22_0x5b42bc['green']('✔'):a22_0x5b42bc[_0x545bdd(0x234)]('✘');let _0x1c280a='';if(_0x571e54[_0x545bdd(0x19a)]&&_0x571e54['customersWithEvents']!==undefined&&_0x571e54['totalEvents']!==undefined){const _0x4f756e=_0x571e54[_0x545bdd(0x225)]?.[_0x545bdd(0x1e1)](0x1)||'?',_0x1f82e3=(_0x571e54['customerPercent']??0x0)>=0x32?a22_0x5b42bc[_0x545bdd(0x1f4)]:(_0x571e54[_0x545bdd(0x225)]??0x0)>=0x14?a22_0x5b42bc[_0x545bdd(0x1ff)]:a22_0x5b42bc['red'];_0x1c280a='\x20'+a22_0x5b42bc['dim']('Customers:')+'\x20'+_0x1f82e3(formatRows(_0x571e54[_0x545bdd(0x1dd)]))+'\x20('+_0x4f756e+_0x545bdd(0x253)+a22_0x5b42bc[_0x545bdd(0x22d)]('Events:')+'\x20'+a22_0x5b42bc[_0x545bdd(0x221)](formatRows(_0x571e54[_0x545bdd(0x271)]));}console[_0x545bdd(0x22b)](_0x3a5079+'\x20'+a22_0x5b42bc[_0x545bdd(0x197)](_0x571e54[_0x545bdd(0x26d)])+_0x1c280a),console['error']('\x20\x20'+a22_0x5b42bc[_0x545bdd(0x22d)](_0x545bdd(0x25c))+'\x20'+a22_0x5b42bc[_0x545bdd(0x197)](_0x571e54[_0x545bdd(0x1e6)]+'.'+_0x571e54[_0x545bdd(0x1ab)]));const _0xe6a9ed=_0x571e54[_0x545bdd(0x2a7)]===_0x571e54[_0x545bdd(0x2d6)]?a22_0x5b42bc['dim']('Join\x20on:')+'\x20'+_0x571e54[_0x545bdd(0x2a7)]:a22_0x5b42bc['dim'](_0x545bdd(0x1af))+'\x20'+_0x571e54[_0x545bdd(0x2a7)]+_0x545bdd(0x2a8)+_0x571e54['foreignKey'];console['error']('\x20\x20'+_0xe6a9ed),console['error']('\x20\x20'+a22_0x5b42bc[_0x545bdd(0x22d)](_0x545bdd(0x1a1))),this['displayColumns'](_0x571e54[_0x545bdd(0x1df)]),!_0x571e54[_0x545bdd(0x19a)]&&console[_0x545bdd(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x545bdd(0x234)](_0x545bdd(0x20a))+'\x20'+_0x571e54[_0x545bdd(0x1d6)]);}}['displayColumns'](_0x500c87){const _0x169f99=a22_0x1a5e68;for(const _0x195846 of _0x500c87){_0x195846['label']===_0x195846[_0x169f99(0x298)]||_0x195846[_0x169f99(0x298)]==='*'?console[_0x169f99(0x22b)]('\x20\x20\x20\x20-\x20'+_0x195846['label']):console[_0x169f99(0x22b)](_0x169f99(0x26f)+_0x195846['label']+'\x20'+a22_0x5b42bc[_0x169f99(0x22d)]('('+_0x195846[_0x169f99(0x298)]+')'));}}[a22_0x1a5e68(0x212)](_0x3f741c){const _0x21f700=a22_0x1a5e68;console[_0x21f700(0x22b)]('─'['repeat'](0x3c));if(_0x3f741c[_0x21f700(0x1e9)]['length']>0x0){console[_0x21f700(0x22b)]('\x0a'+a22_0x5b42bc[_0x21f700(0x234)](_0x21f700(0x1be)));for(const _0x118ce1 of _0x3f741c[_0x21f700(0x1e9)]){console[_0x21f700(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x21f700(0x234)]('•')+'\x20'+_0x118ce1);}}_0x3f741c[_0x21f700(0x19c)]&&console[_0x21f700(0x22b)]('\x0a'+a22_0x5b42bc[_0x21f700(0x1f4)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a22_0x1a5e68(0x1fd);[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x1e4);async[a22_0x1a5e68(0x1db)](_0x117356){const _0x2799f6=a22_0x1a5e68,{options:_0x41d032,args:_0x3aecc1,tdx:_0x41943a}=_0x117356,_0x2767d6=_0x41d032,_0x1bd7a1=_0x3aecc1[0x0]||_0x41d032['parentSegment'];if(!_0x1bd7a1)return showParentSegmentNotSetError(_0x2799f6(0x2b0)+_0x2799f6(0x289)+_0x2799f6(0x1b2)+_0x2799f6(0x1cf)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x2799f6(0x2a1)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x2799f6(0x2ca)),0x1;if(!_0x2767d6['master']&&!_0x2767d6['attribute']&&!_0x2767d6[_0x2799f6(0x297)]&&!_0x2767d6['enriched'])return console[_0x2799f6(0x22b)](a22_0x5b42bc[_0x2799f6(0x234)](_0x2799f6(0x214))),console[_0x2799f6(0x22b)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x2799f6(0x22b)](_0x2799f6(0x28a)),console[_0x2799f6(0x22b)](_0x2799f6(0x22c)),console[_0x2799f6(0x22b)](_0x2799f6(0x193)),console[_0x2799f6(0x22b)](_0x2799f6(0x287)),console['error'](_0x2799f6(0x1cc)),0x1;const _0x326e21=resolveYamlFile(_0x1bd7a1);if(!existsSync(_0x326e21))return showFileNotFoundError(_0x326e21,_0x1bd7a1),0x1;_0x2767d6[_0x2799f6(0x1d9)]&&(console[_0x2799f6(0x22b)](_0x2799f6(0x23c)+_0x2767d6['site']),console[_0x2799f6(0x22b)]('YAML\x20file:\x20'+_0x326e21));let _0x2ea257;try{_0x2ea257=readFileSync(_0x326e21,_0x2799f6(0x25d));}catch(_0x3fd762){const _0xadd95e=_0x3fd762 instanceof Error?_0x3fd762[_0x2799f6(0x25e)]:String(_0x3fd762);return console['error'](_0x2799f6(0x2be)+_0xadd95e),0x1;}let _0x175038;try{_0x175038=parseDef(_0x2ea257);}catch(_0x6e4868){const _0x168c44=_0x6e4868 instanceof Error?_0x6e4868[_0x2799f6(0x25e)]:String(_0x6e4868);return console[_0x2799f6(0x22b)](a22_0x5b42bc[_0x2799f6(0x234)](_0x2799f6(0x282)+_0x168c44)),0x1;}if(_0x2767d6[_0x2799f6(0x21c)]===!![]||_0x2767d6[_0x2799f6(0x21c)]===''){const _0x186427=_0x175038[_0x2799f6(0x1f9)]?.[_0x2799f6(0x293)](_0x36b126=>_0x36b126['name'])||[];if(_0x186427[_0x2799f6(0x283)]===0x0)console['error'](a22_0x5b42bc['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x2799f6(0x22b)](a22_0x5b42bc[_0x2799f6(0x234)](_0x2799f6(0x23f))),console[_0x2799f6(0x22b)](_0x2799f6(0x2c1));for(const _0x2afe4d of _0x186427){console['error']('\x20\x20'+a22_0x5b42bc[_0x2799f6(0x221)](_0x2afe4d));}console[_0x2799f6(0x22b)](_0x2799f6(0x262)+_0x1bd7a1+_0x2799f6(0x1c0)+_0x186427[0x0]+'\x22');}return 0x1;}if(_0x2767d6[_0x2799f6(0x297)]===!![]||_0x2767d6[_0x2799f6(0x297)]===''){const _0x46d051=_0x175038[_0x2799f6(0x18f)]?.[_0x2799f6(0x293)](_0x5d08f6=>_0x5d08f6[_0x2799f6(0x26d)])||[];if(_0x46d051['length']===0x0)console[_0x2799f6(0x22b)](a22_0x5b42bc[_0x2799f6(0x234)](_0x2799f6(0x295)));else{console[_0x2799f6(0x22b)](a22_0x5b42bc[_0x2799f6(0x234)](_0x2799f6(0x2c6))),console['error'](_0x2799f6(0x232));for(const _0xf063d2 of _0x46d051){console[_0x2799f6(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x2799f6(0x221)](_0xf063d2));}console[_0x2799f6(0x22b)](_0x2799f6(0x262)+_0x1bd7a1+_0x2799f6(0x2ce)+_0x46d051[0x0]+'\x22');}return 0x1;}const _0x27e612=createCommandSpinner(a22_0x5b42bc[_0x2799f6(0x22d)](_0x2799f6(0x2b3)),{'verbose':_0x2767d6[_0x2799f6(0x1d9)]});_0x27e612[_0x2799f6(0x28b)]();const _0x5bfcd3={'onProgress':_0x91d155=>{const _0x23aa58=_0x2799f6;_0x27e612[_0x23aa58(0x243)]=formatProgressMessage(_0x91d155);}};if(_0x2767d6[_0x2799f6(0x263)])_0x5bfcd3[_0x2799f6(0x263)]=!![];if(_0x2767d6[_0x2799f6(0x21c)]&&typeof _0x2767d6['attribute']==='string')_0x5bfcd3['attribute']=_0x2767d6[_0x2799f6(0x21c)];if(_0x2767d6['behavior']&&typeof _0x2767d6[_0x2799f6(0x297)]===_0x2799f6(0x1d1))_0x5bfcd3[_0x2799f6(0x297)]=_0x2767d6[_0x2799f6(0x297)];if(_0x2767d6[_0x2799f6(0x201)])_0x5bfcd3[_0x2799f6(0x201)]=!![];if(_0x2767d6['interval'])_0x5bfcd3[_0x2799f6(0x1f3)]=_0x2767d6['interval'];let _0x3bdece;try{_0x3bdece=await _0x41943a['segment'][_0x2799f6(0x280)](_0x2ea257,_0x5bfcd3),_0x27e612[_0x2799f6(0x235)]();}catch(_0x180d65){_0x27e612[_0x2799f6(0x235)]();throw _0x180d65;}return await this[_0x2799f6(0x1c7)](_0x3bdece,{'master':_0x2767d6[_0x2799f6(0x263)],'attribute':typeof _0x2767d6[_0x2799f6(0x21c)]===_0x2799f6(0x1d1)?_0x2767d6[_0x2799f6(0x21c)]:undefined,'behavior':typeof _0x2767d6['behavior']===_0x2799f6(0x1d1)?_0x2767d6['behavior']:undefined,'enriched':_0x2767d6[_0x2799f6(0x201)]}),_0x3bdece[_0x2799f6(0x19c)]?0x0:0x1;}async[a22_0x1a5e68(0x1c7)](_0x198ded,_0x524f0e){const _0x52312b=a22_0x1a5e68;console['error']('\x0a'+a22_0x5b42bc['bold'](_0x52312b(0x223))+'\x20'+_0x198ded[_0x52312b(0x26d)]),console[_0x52312b(0x22b)]('═'[_0x52312b(0x2b1)](0x3c));if(_0x524f0e[_0x52312b(0x263)]&&_0x198ded[_0x52312b(0x2c8)]){const _0x54b83f=a22_0x5b42bc[_0x52312b(0x22d)]('Master:')+'\x20'+a22_0x5b42bc[_0x52312b(0x197)](_0x198ded[_0x52312b(0x263)][_0x52312b(0x1e6)]+'.'+_0x198ded[_0x52312b(0x263)][_0x52312b(0x1ab)]);await this[_0x52312b(0x2d9)](_0x54b83f,_0x198ded[_0x52312b(0x2c8)]);}else{if(_0x524f0e[_0x52312b(0x21c)]&&_0x198ded['sampleData']){const _0xa980f8=a22_0x5b42bc[_0x52312b(0x22d)](_0x52312b(0x1d0))+'\x20'+a22_0x5b42bc['bold'](_0x524f0e['attribute']);await this[_0x52312b(0x2d9)](_0xa980f8,_0x198ded['sampleData']);}else{if(_0x524f0e[_0x52312b(0x297)]&&_0x198ded[_0x52312b(0x2c8)]){const _0x43e3ef=a22_0x5b42bc[_0x52312b(0x22d)]('Behavior:')+'\x20'+a22_0x5b42bc[_0x52312b(0x197)](_0x524f0e[_0x52312b(0x297)]);await this[_0x52312b(0x2d9)](_0x43e3ef,_0x198ded[_0x52312b(0x2c8)]);}else{if(_0x524f0e[_0x52312b(0x201)]&&_0x198ded[_0x52312b(0x2c8)]){const _0x43436f=a22_0x5b42bc[_0x52312b(0x22d)](_0x52312b(0x1c4))+'\x20'+a22_0x5b42bc[_0x52312b(0x197)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x43436f,_0x198ded['sampleData']);}else!_0x198ded[_0x52312b(0x2c8)]&&console[_0x52312b(0x22b)](_0x52312b(0x2c2));}}}if(_0x198ded[_0x52312b(0x1e9)][_0x52312b(0x283)]>0x0){console[_0x52312b(0x22b)]('─'['repeat'](0x3c)),console[_0x52312b(0x22b)]('\x0a'+a22_0x5b42bc['red'](_0x52312b(0x1be)));for(const _0x25d7ea of _0x198ded[_0x52312b(0x1e9)]){console[_0x52312b(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x52312b(0x234)]('•')+'\x20'+_0x25d7ea);}}}async[a22_0x1a5e68(0x2d9)](_0x1c3b82,_0x55f6f3){const _0x12dbad=a22_0x1a5e68;if(_0x55f6f3[_0x12dbad(0x283)]===0x0){console[_0x12dbad(0x22b)]('\x0a'+_0x1c3b82),console['error'](_0x12dbad(0x29c));return;}console[_0x12dbad(0x22b)]('\x0a'+_0x1c3b82);const _0xbec3a3=Object['keys'](_0x55f6f3[0x0])[_0x12dbad(0x293)](_0x4b4be5=>({'name':_0x4b4be5,'type':typeof _0x55f6f3[0x0][_0x4b4be5]===_0x12dbad(0x1b7)?_0x12dbad(0x199):_0x12dbad(0x22f)})),_0x48bd95={'queryId':_0x12dbad(0x20f),'columns':_0xbec3a3,'data':_0x55f6f3,'stats':{'state':_0x12dbad(0x1f2),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x55f6f3['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x18830b=formatAsTable(_0x48bd95,_0x55f6f3['length'],!![]);await writeOutput(_0x18830b,undefined,_0x12dbad(0x1ab));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x1a5e68(0x26d)]=a22_0x1a5e68(0x1ee);[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x2ad);async[a22_0x1a5e68(0x1db)](_0x3618d4){const _0x35c5a4=a22_0x1a5e68,{options:_0x45094c,args:_0x4c9ffc,tdx:_0xe8c731}=_0x3618d4,_0x184c43=_0x45094c,_0x17b596=_0x4c9ffc[0x0]||_0x45094c[_0x35c5a4(0x2cb)];if(!_0x17b596)return showParentSegmentNotSetError(_0x35c5a4(0x216)+_0x35c5a4(0x265)),0x1;const _0x313366=resolveYamlFile(_0x17b596);if(existsSync(_0x313366)){_0x184c43['verbose']&&console['error'](_0x35c5a4(0x2bc)+_0x313366);let _0x8af1ff;try{_0x8af1ff=readFileSync(_0x313366,_0x35c5a4(0x25d));}catch(_0x2ea9ca){const _0x432242=_0x2ea9ca instanceof Error?_0x2ea9ca[_0x35c5a4(0x25e)]:String(_0x2ea9ca);return console[_0x35c5a4(0x22b)]('Error\x20reading\x20file:\x20'+_0x432242),0x1;}const _0xacc99d=await withSpinner(_0x35c5a4(0x23a),()=>_0xe8c731['segment'][_0x35c5a4(0x26e)](_0x8af1ff),{'verbose':_0x184c43[_0x35c5a4(0x1d9)]}),_0xde1914=_0xacc99d[_0x35c5a4(0x239)],{isNew:_0x51db05,name:_0xb61b7a,hasChanges:_0x29824b,diffFormatted:_0x379143}=_0xde1914;if(_0x29824b){_0x51db05?console[_0x35c5a4(0x22b)](_0x35c5a4(0x1e3)+_0xb61b7a+'\x27:'):console['error'](_0x35c5a4(0x2a6)+_0xb61b7a+'\x27:');console[_0x35c5a4(0x22b)]('─'[_0x35c5a4(0x2b1)](0x3c)),console[_0x35c5a4(0x22b)](_0x379143),console[_0x35c5a4(0x22b)]('─'[_0x35c5a4(0x2b1)](0x3c));const _0x20d7d4=_0x51db05?_0x35c5a4(0x21e)+_0xb61b7a+_0x35c5a4(0x2ba):_0x35c5a4(0x257)+_0xb61b7a+_0x35c5a4(0x2ba);if(!_0x184c43['yes']){if(!isInteractive())return console[_0x35c5a4(0x22b)](a22_0x5b42bc[_0x35c5a4(0x234)](_0x35c5a4(0x246)),_0x35c5a4(0x27f)),console[_0x35c5a4(0x22b)](a22_0x5b42bc[_0x35c5a4(0x22d)](_0x35c5a4(0x200))),0x1;const _0x309b80=await confirmKey(_0x20d7d4);if(!_0x309b80)return console[_0x35c5a4(0x22b)](a22_0x5b42bc[_0x35c5a4(0x1ff)](_0x35c5a4(0x249))),0x1;}const _0x173866=_0x51db05?_0x35c5a4(0x1c9):_0x35c5a4(0x25f);await withSpinner(_0x173866+_0x35c5a4(0x1a6)+_0xb61b7a+_0x35c5a4(0x1b6),()=>_0xde1914['apply'](),{'verbose':_0x184c43[_0x35c5a4(0x1d9)]});const _0x158013=_0x51db05?_0x35c5a4(0x2b4):_0x35c5a4(0x1e0);console[_0x35c5a4(0x22b)]('✔\x20'+_0x158013+_0x35c5a4(0x1a6)+_0xb61b7a+'\x27');}else console[_0x35c5a4(0x22b)](_0x35c5a4(0x250)+_0xb61b7a+'\x27\x20is\x20up\x20to\x20date');}const _0x22a7c9=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x17b596+_0x35c5a4(0x1b6),()=>_0xe8c731[_0x35c5a4(0x1a7)][_0x35c5a4(0x2a5)](_0x17b596),{'verbose':_0x184c43[_0x35c5a4(0x1d9)]}),_0x3314d4=_0x22a7c9[_0x35c5a4(0x239)],_0x23e114=getConsoleUrl(_0x184c43[_0x35c5a4(0x1ea)],_0x35c5a4(0x194)+_0x3314d4[_0x35c5a4(0x210)]+_0x35c5a4(0x2d2)+_0x3314d4[_0x35c5a4(0x29f)]+_0x35c5a4(0x2bf)+_0x3314d4[_0x35c5a4(0x2c9)]);return console['error'](_0x35c5a4(0x21d)),console[_0x35c5a4(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x35c5a4(0x22d)](_0x35c5a4(0x2d7))+'\x20'+_0x3314d4[_0x35c5a4(0x2b8)]),console['error']('\x20\x20'+a22_0x5b42bc[_0x35c5a4(0x22d)](_0x35c5a4(0x24d))+'\x20'+_0x3314d4[_0x35c5a4(0x27d)]),console[_0x35c5a4(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x35c5a4(0x22d)]('Session:')+'\x20'+_0x3314d4[_0x35c5a4(0x29f)]),console[_0x35c5a4(0x22b)]('\x20\x20'+a22_0x5b42bc[_0x35c5a4(0x22d)](_0x35c5a4(0x1c3))+'\x20'+_0x3314d4[_0x35c5a4(0x2c9)]),console['error']('\x20\x20'+_0x23e114),console[_0x35c5a4(0x22b)]('\x0a'+a22_0x5b42bc[_0x35c5a4(0x22d)](_0x35c5a4(0x206))+'\x20tdx\x20wf\x20attempt\x20'+_0x3314d4['workflowAttemptId']+_0x35c5a4(0x209)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]='segment:parent:fields';[a22_0x1a5e68(0x27c)]='List\x20available\x20fields\x20for\x20segmentation';async[a22_0x1a5e68(0x1db)](_0x193537){const _0x3ed563=a22_0x1a5e68,{options:_0x43c008,args:_0xfe3187,tdx:_0x7ebe13}=_0x193537,_0x4925bb=_0xfe3187[0x0]||_0x43c008['parentSegment'];if(!_0x4925bb)return showParentSegmentNotSetError(_0x3ed563(0x1a8)+'\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;_0x43c008[_0x3ed563(0x1d9)]&&(console[_0x3ed563(0x22b)](_0x3ed563(0x23c)+_0x43c008[_0x3ed563(0x1ea)]),console[_0x3ed563(0x22b)](_0x3ed563(0x23d)+_0x4925bb));const _0x2b6ef5=await withSpinner(_0x3ed563(0x285)+_0x4925bb+_0x3ed563(0x1b6),()=>_0x7ebe13[_0x3ed563(0x1a7)][_0x3ed563(0x218)](_0x4925bb),{'verbose':_0x43c008[_0x3ed563(0x1d9)]}),_0xd1007f=_0x2b6ef5[_0x3ed563(0x239)];console[_0x3ed563(0x22b)](_0x3ed563(0x26a)+_0xd1007f[_0x3ed563(0x283)]+'\x20field'+(_0xd1007f[_0x3ed563(0x283)]!==0x1?'s':''));if(_0x43c008['json']||_0x43c008['jsonl'])return await handleSDKOutput(_0xd1007f,_0x43c008),0x0;return displayFieldsHumanReadable(_0xd1007f,_0x4925bb),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x1a5e68(0x291);[a22_0x1a5e68(0x27c)]='Show\x20parent\x20segment\x20details';async['execute'](_0x2aee42){const _0x518645=a22_0x1a5e68,{options:_0xc734a0,args:_0x2cdc0e,tdx:_0x1ed746}=_0x2aee42,_0x376361=_0xc734a0,_0x579209=_0x2cdc0e[0x0]||_0xc734a0['parentSegment'];if(!_0x579209)return showParentSegmentNotSetError(_0x518645(0x1c5)+_0x518645(0x299)+_0x518645(0x2da)+_0x518645(0x192)),0x1;_0xc734a0['verbose']&&(console[_0x518645(0x22b)](_0x518645(0x23c)+_0xc734a0[_0x518645(0x1ea)]),console[_0x518645(0x22b)](_0x518645(0x23d)+_0x579209));const _0x179d1e=await withSpinner(_0x518645(0x275)+_0x579209+_0x518645(0x1b6),()=>_0x1ed746[_0x518645(0x1a7)]['getParentFull'](_0x579209),{'verbose':_0xc734a0[_0x518645(0x1d9)]}),_0x3589d1=_0x179d1e[_0x518645(0x239)];if(_0x376361[_0x518645(0x1ec)]){const _0x51f903=getConsoleNextUrl(_0x376361[_0x518645(0x1ea)],_0x518645(0x203)+_0x3589d1['id']);return console[_0x518645(0x22b)](a22_0x5b42bc[_0x518645(0x1f4)]('✔')+_0x518645(0x260)+a22_0x5b42bc[_0x518645(0x221)](_0x51f903)),openBrowser(_0x51f903),0x0;}return await handleSingleObjectOutput(_0x3589d1,_0xc734a0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]=a22_0x1a5e68(0x2b5);[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x1a0);async[a22_0x1a5e68(0x1db)](_0x189c90){const _0x4efba6=a22_0x1a5e68,{options:_0x1c9083,args:_0x36dc7b,tdx:_0x508982}=_0x189c90,_0x19b699=_0x1c9083,_0x28e70c=_0x36dc7b[0x0]||_0x1c9083[_0x4efba6(0x2cb)];if(!_0x28e70c)return showParentSegmentNotSetError(_0x4efba6(0x226)+_0x4efba6(0x195)+_0x4efba6(0x2da)+_0x4efba6(0x1e8)),0x1;_0x1c9083['verbose']&&(console['error']('Site:\x20'+_0x1c9083['site']),console[_0x4efba6(0x22b)](_0x4efba6(0x23d)+_0x28e70c));const _0x1d3216=await withSpinner(_0x4efba6(0x1ef)+_0x28e70c+_0x4efba6(0x1b6),()=>_0x508982[_0x4efba6(0x1a7)][_0x4efba6(0x1b0)](_0x28e70c),{'verbose':_0x1c9083[_0x4efba6(0x1d9)]}),_0x4658ce=_0x1d3216[_0x4efba6(0x239)],_0x42a37d=_0x508982[_0x4efba6(0x1a7)][_0x4efba6(0x231)](_0x4658ce);if(_0x19b699['output']){const _0x4cfcf1=await this['collectSchema'](_0x189c90,_0x28e70c,_0x4658ce,_0x42a37d),_0x1bce93=this['formatSchemaJson'](_0x4cfcf1);writeFileSync(_0x19b699['output'],_0x1bce93);const _0x833dc6=_0x4cfcf1['customers']['columns'][_0x4efba6(0x283)]+_0x4cfcf1[_0x4efba6(0x18f)]['reduce']((_0x1ca73d,_0x1a4057)=>_0x1ca73d+_0x1a4057['columns'][_0x4efba6(0x283)],0x0),_0x19126d=_0x4cfcf1['behaviors'][_0x4efba6(0x238)](_0x1be339=>_0x1be339[_0x4efba6(0x1df)][_0x4efba6(0x283)]===0x0)[_0x4efba6(0x283)];return console['log'](_0x4efba6(0x292)+_0x19b699['output']),console[_0x4efba6(0x1fe)](_0x4efba6(0x2aa)+_0x42a37d),console['log'](_0x4efba6(0x1ad)+_0x4cfcf1[_0x4efba6(0x18f)][_0x4efba6(0x283)]+_0x4efba6(0x24c)),console[_0x4efba6(0x1fe)](_0x4efba6(0x264)+_0x833dc6+_0x4efba6(0x1f0)),_0x19126d>0x0&&console['log'](_0x4efba6(0x207)+_0x19126d+_0x4efba6(0x220)),0x0;}console[_0x4efba6(0x22b)]('\x0a'+a22_0x5b42bc[_0x4efba6(0x197)](_0x4efba6(0x27a))+'\x20'+a22_0x5b42bc[_0x4efba6(0x221)](_0x42a37d));const _0xa01977=await withSpinner(_0x4efba6(0x240),()=>_0x508982[_0x4efba6(0x1a7)][_0x4efba6(0x230)](_0x4658ce),{'verbose':_0x1c9083[_0x4efba6(0x1d9)]});console['error']('\x0a'+a22_0x5b42bc[_0x4efba6(0x197)]('customers')+'\x20'+a22_0x5b42bc[_0x4efba6(0x22d)]('('+_0x42a37d+'.customers)'));const _0x31da49=await executeSchemaQuery(_0xa01977[_0x4efba6(0x239)],_0x508982,_0x1c9083);await handleQueryOutput(_0x31da49,_0x1c9083);const _0x14a8f1=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x508982[_0x4efba6(0x1a7)][_0x4efba6(0x1d3)](_0x4658ce),{'verbose':_0x1c9083[_0x4efba6(0x1d9)]});for(const _0x49351e of _0x14a8f1[_0x4efba6(0x239)]){const _0x2c8c6b=_0x4efba6(0x24b)+_0x49351e[_0x4efba6(0x2b6)]()[_0x4efba6(0x1cd)](/\s+/g,'_'),_0x4a1b44=_0x4efba6(0x2a0)+_0x42a37d+'.'+_0x2c8c6b;console[_0x4efba6(0x22b)]('\x0a'+a22_0x5b42bc[_0x4efba6(0x197)](_0x49351e)+'\x20'+a22_0x5b42bc[_0x4efba6(0x22d)]('('+_0x42a37d+'.'+_0x2c8c6b+')'));try{const _0x1dadac=await executeSchemaQuery(_0x4a1b44,_0x508982,_0x1c9083);await handleQueryOutput(_0x1dadac,_0x1c9083);}catch{console[_0x4efba6(0x22b)](a22_0x5b42bc['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x1a5e68(0x286)](_0x29260a,_0x32902b,_0x23cc11,_0x27b049){const _0x44db20=a22_0x1a5e68,{options:_0x26cee8,tdx:_0x5eb09b}=_0x29260a,_0x108144=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x5eb09b[_0x44db20(0x1a7)][_0x44db20(0x230)](_0x23cc11),{'verbose':_0x26cee8[_0x44db20(0x1d9)]}),_0x18dfc1=await executeSchemaQuery(_0x108144[_0x44db20(0x239)],_0x5eb09b,_0x26cee8),_0x5110a0=_0x18dfc1['data'][_0x44db20(0x293)](_0x2bbb65=>({'name':_0x2bbb65[_0x44db20(0x2cd)],'type':_0x2bbb65[_0x44db20(0x1fa)]})),_0x42c9a7=await withSpinner(_0x44db20(0x21a),()=>_0x5eb09b[_0x44db20(0x1a7)][_0x44db20(0x1d3)](_0x23cc11),{'verbose':_0x26cee8[_0x44db20(0x1d9)]}),_0x1c9ecc=[];for(const _0x4af401 of _0x42c9a7[_0x44db20(0x239)]){const _0x5a6392=_0x44db20(0x24b)+_0x4af401['toLowerCase']()[_0x44db20(0x1cd)](/\s+/g,'_'),_0x2a5463='SELECT\x20*\x20FROM\x20'+_0x27b049+'.'+_0x5a6392;let _0x5facbe=[];try{const _0x5129be=await executeSchemaQuery(_0x2a5463,_0x5eb09b,_0x26cee8);_0x5facbe=_0x5129be[_0x44db20(0x239)]['map'](_0x34ad4a=>({'name':_0x34ad4a[_0x44db20(0x2cd)],'type':_0x34ad4a['column_type']}));}catch{}_0x1c9ecc['push']({'table':_0x5a6392,'columns':_0x5facbe});}return{'database':_0x27b049,'parent_segment':_0x32902b,'parent_id':_0x23cc11,'customers':{'table':_0x44db20(0x1f6),'columns':_0x5110a0},'behaviors':_0x1c9ecc};}[a22_0x1a5e68(0x2db)](_0x3f77b9){const _0x41c502=a22_0x1a5e68,_0x2a1a38=_0x1ae5b0=>{const _0x4c53c0=a22_0x1aab;if(_0x1ae5b0['length']===0x0)return'[]';const _0x492699=_0x1ae5b0[_0x4c53c0(0x293)](_0x361a39=>_0x4c53c0(0x1d7)+_0x361a39[_0x4c53c0(0x26d)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x361a39[_0x4c53c0(0x1d5)]+_0x4c53c0(0x2b2));return'[\x0a'+_0x492699[_0x4c53c0(0x1cb)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x62457c=_0x3f77b9[_0x41c502(0x18f)][_0x41c502(0x293)](_0x98f948=>{const _0x151288=_0x41c502;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x98f948['table']+_0x151288(0x1e7)+_0x2a1a38(_0x98f948['columns'])[_0x151288(0x1cd)](/^/gm,'\x20\x20')[_0x151288(0x2ac)]()+'\x0a\x20\x20\x20\x20}';})[_0x41c502(0x1cb)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x3f77b9['database']+_0x41c502(0x2ab)+_0x3f77b9[_0x41c502(0x19e)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x3f77b9[_0x41c502(0x222)]+_0x41c502(0x28d)+_0x3f77b9['customers'][_0x41c502(0x1ab)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x2a1a38(_0x3f77b9[_0x41c502(0x1f6)][_0x41c502(0x1df)])[_0x41c502(0x1cd)](/^/gm,'\x20\x20')[_0x41c502(0x2ac)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x62457c+_0x41c502(0x1bd);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]=a22_0x1a5e68(0x1bc);['description']=a22_0x1a5e68(0x28c);async[a22_0x1a5e68(0x1db)](_0x23fbee){const _0x234d67=a22_0x1a5e68,{options:_0x38849d,args:_0x2465ea,tdx:_0x5b1ad4}=_0x23fbee,_0x549b0b=_0x2465ea[0x0]||_0x38849d[_0x234d67(0x2cb)];if(!_0x549b0b)return showParentSegmentNotSetError(_0x234d67(0x20c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x38849d[_0x234d67(0x1d9)]&&(console['error']('Site:\x20'+_0x38849d[_0x234d67(0x1ea)]),console['error']('Parent\x20segment:\x20'+_0x549b0b));const _0x3ac421=await withSpinner(_0x234d67(0x1ef)+_0x549b0b+_0x234d67(0x1b6),()=>_0x5b1ad4[_0x234d67(0x1a7)][_0x234d67(0x1b0)](_0x549b0b),{'verbose':_0x38849d['verbose']}),_0x3e8f46=_0x3ac421[_0x234d67(0x239)],_0x1eee6d=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x549b0b+_0x234d67(0x1b6),()=>_0x5b1ad4[_0x234d67(0x1a7)][_0x234d67(0x230)](_0x3e8f46),{'verbose':_0x38849d['verbose']}),_0x105a6d=_0x1eee6d[_0x234d67(0x239)];return _0x38849d['format']===_0x234d67(0x273)||_0x38849d[_0x234d67(0x2d5)]===_0x234d67(0x276)?await handleSDKOutput([{'sql':_0x105a6d}],_0x38849d):console[_0x234d67(0x1fe)](_0x105a6d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x1a5e68(0x26d)]=a22_0x1a5e68(0x1ba);[a22_0x1a5e68(0x27c)]=a22_0x1a5e68(0x259);async[a22_0x1a5e68(0x1db)](_0x4dca3c){const _0x3782de=a22_0x1a5e68,{options:_0x22f05f,args:_0x56922d,tdx:_0x4f59fa}=_0x4dca3c,_0x34f292=_0x56922d[0x0]||_0x22f05f[_0x3782de(0x2cb)];if(!_0x34f292)return showParentSegmentNotSetError(_0x3782de(0x2d1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x22f05f['verbose']&&(console[_0x3782de(0x22b)](_0x3782de(0x23c)+_0x22f05f[_0x3782de(0x1ea)]),console['error']('Parent\x20segment:\x20'+_0x34f292));const _0x47403a=await withSpinner(_0x3782de(0x1ef)+_0x34f292+_0x3782de(0x1b6),()=>_0x4f59fa[_0x3782de(0x1a7)][_0x3782de(0x1b0)](_0x34f292),{'verbose':_0x22f05f['verbose']}),_0x26f518=_0x47403a['data'],_0x2096a4=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x34f292+_0x3782de(0x1b6),()=>_0x4f59fa[_0x3782de(0x1a7)]['getParentSQL'](_0x26f518),{'verbose':_0x22f05f[_0x3782de(0x1d9)]});let _0x29c8d7=_0x2096a4[_0x3782de(0x239)];const _0x27a15e=resolveLimit(_0x22f05f[_0x3782de(0x1f7)],DEFAULT_DISPLAY_LIMIT),_0x3cdd46=/\bLIMIT\s+\d+/i[_0x3782de(0x2a9)](_0x29c8d7);!_0x3cdd46&&(_0x29c8d7=_0x29c8d7[_0x3782de(0x2ac)]()[_0x3782de(0x1cd)](/;+$/,''),_0x29c8d7=_0x3782de(0x190)+_0x29c8d7+_0x3782de(0x25b)+_0x27a15e);_0x22f05f[_0x3782de(0x1d9)]&&console['error']('SQL\x20query:\x0a'+_0x29c8d7);const _0x15b936=await withProgressSpinner(_0x3782de(0x1b5),async _0x4f63d4=>{const _0x40a3f9=_0x3782de,_0x50decf=await _0x4f59fa[_0x40a3f9(0x24e)][_0x40a3f9(0x1db)](_0x29c8d7,{'catalog':'td','schema':_0x40a3f9(0x245),'onJobId':_0x1b2313=>{const _0xa66366=_0x40a3f9;_0x4f63d4[_0xa66366(0x1c6)](_0x1b2313);}});return _0x50decf;},{'verbose':_0x22f05f[_0x3782de(0x1d9)]}),_0x40b550=_0x15b936['data'],_0x21c19c=_0x40b550['jobId']?'\x20[Job\x20ID:\x20'+_0x40b550[_0x3782de(0x198)]+']':'';return console[_0x3782de(0x22b)](_0x3782de(0x1a9)+_0x40b550[_0x3782de(0x266)][_0x3782de(0x2c3)][_0x3782de(0x254)]()+_0x3782de(0x270)+(_0x3782de(0x1fb)+formatElapsed(_0x40b550['stats'][_0x3782de(0x26c)])+_0x21c19c)),await handleQueryOutput(_0x40b550,_0x22f05f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x4ed49c=a23_0x5299;(function(_0x195b41,_0x186fd8){const _0x16813c=a23_0x5299,_0x122702=_0x195b41();while(!![]){try{const _0x11b727=-parseInt(_0x16813c(0x182))/0x1+-parseInt(_0x16813c(0x148))/0x2*(-parseInt(_0x16813c(0x140))/0x3)+-parseInt(_0x16813c(0x171))/0x4*(parseInt(_0x16813c(0x193))/0x5)+parseInt(_0x16813c(0x17f))/0x6+parseInt(_0x16813c(0x14f))/0x7+parseInt(_0x16813c(0x184))/0x8*(parseInt(_0x16813c(0x16f))/0x9)+-parseInt(_0x16813c(0x179))/0xa;if(_0x11b727===_0x186fd8)break;else _0x122702['push'](_0x122702['shift']());}catch(_0x5c56ba){_0x122702['push'](_0x122702['shift']());}}}(a23_0x33fb,0x87525));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a23_0x33fb(){const _0xa6336=['database','9940160uBwNfX','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','validate','Changing\x20site\x20to\x20\x27','profile:set','\x27\x20does\x20not\x20exist.','2225388aLnuxg','\x20API\x20key\x20removed\x20from\x20system\x20keychain','tdx.json','1021529HJaJZQ','error','200pDNtwq','yellow','trim','green','Enter\x20description\x20(optional):','warn','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:remove','description','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','red','jobs','\x27\x20removed\x20from\x20configuration','create','Enter\x20your\x20TD\x20API\x20key:','34130zkcsCp','ERROR','getUserInfo','\x0aAvailable\x20profiles:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','select','Site\x20was\x20not\x20changed.','split','Remove\x20a\x20profile','Set\x20session\x20profile','bold','\x20API\x20key\x20saved\x20to\x20system\x20keychain','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20cannot\x20be\x20empty','execute','length','Enter\x20profile\x20name:','Profile\x20\x27','\x0aOperation\x20cancelled','confirm','\x27\x20does\x20not\x20exist.\x20Create\x20it?','session','Set\x20a\x20profile\x20configuration\x20value','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','/app/mp/ak','customSite','3AqqCyU','Failed\x20to\x20remove\x20profile:\x20','\x20Profile\x20\x27','Enter\x20site\x20name:','profileName','llm_agent','tdx:\x20profile\x20set','log','1949050MfkxSw','\x27\x20updated:\x20','\x20\x20tdx\x20--profile\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','join','6046670maDFKk','apiKey','test','status','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','name','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','Validating\x20API\x20key...','password','VALID_KEYS','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Site\x20name\x20cannot\x20be\x20empty','(session:\x20','site','tdx:\x20profile\x20remove','\x0aSetup\x20cancelled','\x20\x20(no\x20profiles\x20found)','\x20--default\x27\x20to\x20save\x20permanently','Removal\x20cancelled','\x20\x20-\x20','\x27\x20created','text','logLevel','us01','profile','✗\x20Validation\x20failed:\x20','default','message','\x27.\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','279711LBVqso','profile:create','244xlPEgB','Session\x20profile\x20set\x20to:\x20','parent_segment','dim','\x20API\x20key\x20is\x20valid\x20(User:\x20','Operation\x20cancelled','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'];a23_0x33fb=function(){return _0xa6336;};return a23_0x33fb();}import{getConfigDir}from'../core/config.js';import*as a23_0x40c7e7 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';function a23_0x5299(_0x4c4521,_0x391d59){_0x4c4521=_0x4c4521-0x12b;const _0x33fb17=a23_0x33fb();let _0x5299c0=_0x33fb17[_0x4c4521];return _0x5299c0;}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_0x3ecf03 from'prompts';import a23_0x3d9504 from'chalk';function validateProfileName(_0x2f6861){const _0x572d30=a23_0x5299;if(!_0x2f6861||!_0x2f6861[_0x572d30(0x186)]())return _0x572d30(0x132);const _0x1832c0=_0x2f6861['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x572d30(0x151)](_0x1832c0))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x1832c0))return _0x572d30(0x136)+_0x1832c0+_0x572d30(0x16e);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x170);[a23_0x4ed49c(0x18c)]='Create\x20a\x20new\x20profile';async[a23_0x4ed49c(0x133)](_0x1bd7ac){const _0x2c9cae=a23_0x4ed49c,{options:_0x2a794c,args:_0x1cbe1b}=_0x1bd7ac;console[_0x2c9cae(0x147)](a23_0x3d9504[_0x2c9cae(0x12f)]('tdx:\x20profile\x20create'));let _0x19eea9;if(_0x1cbe1b['length']>0x0&&_0x1cbe1b[0x0]){const _0x4dee46=_0x1cbe1b[0x0][_0x2c9cae(0x186)](),_0x3c454d=validateProfileName(_0x4dee46);if(_0x3c454d!==!![])return console[_0x2c9cae(0x183)](a23_0x3d9504['red'](_0x3c454d)),0x1;_0x19eea9=_0x4dee46;}else{const _0x138f94=await a23_0x3ecf03({'type':_0x2c9cae(0x165),'name':_0x2c9cae(0x144),'message':_0x2c9cae(0x135),'validate':validateProfileName});if(!_0x138f94[_0x2c9cae(0x144)])return console[_0x2c9cae(0x147)](_0x2c9cae(0x15f)),0x1;_0x19eea9=_0x138f94['profileName'][_0x2c9cae(0x186)]();}const _0x56ac48=await a23_0x3ecf03({'type':'text','name':_0x2c9cae(0x18c),'message':_0x2c9cae(0x188)}),_0x58cd82=_0x56ac48[_0x2c9cae(0x18c)]?.[_0x2c9cae(0x186)]()||undefined,_0x561cdf=_0x2a794c[_0x2c9cae(0x15d)]||_0x2c9cae(0x167),{choices:_0x5c5b37,initialIndex:_0x2cfedb}=buildSiteChoices(_0x561cdf),_0x28fc0d=await a23_0x3ecf03({'type':_0x2c9cae(0x199),'name':_0x2c9cae(0x15d),'message':_0x2c9cae(0x197)+_0x19eea9+'\x27:','choices':_0x5c5b37,'initial':_0x2cfedb});if(!_0x28fc0d[_0x2c9cae(0x15d)])return console['log']('\x0aSetup\x20cancelled'),0x1;let _0x9b2436;if(_0x28fc0d[_0x2c9cae(0x15d)]==='other'){const _0x317986=await a23_0x3ecf03({'type':_0x2c9cae(0x165),'name':_0x2c9cae(0x13f),'message':_0x2c9cae(0x143),'initial':_0x2c9cae(0x167),'validate':_0x1f1b62=>{const _0x47ecc3=_0x2c9cae;if(!_0x1f1b62||!_0x1f1b62[_0x47ecc3(0x186)]())return _0x47ecc3(0x15b);if(!/^[a-z0-9-]+$/[_0x47ecc3(0x151)](_0x1f1b62[_0x47ecc3(0x186)]()))return _0x47ecc3(0x14d);return!![];}});if(!_0x317986['customSite'])return console['log'](_0x2c9cae(0x15f)),0x1;_0x9b2436=_0x317986[_0x2c9cae(0x13f)];}else _0x9b2436=_0x28fc0d[_0x2c9cae(0x15d)];const _0x4206eb=resolveSite(_0x9b2436);console[_0x2c9cae(0x147)](_0x2c9cae(0x18d)+_0x4206eb),console[_0x2c9cae(0x147)](_0x2c9cae(0x131)),console[_0x2c9cae(0x147)]('\x20\x20'+getConsoleUrl(_0x4206eb,_0x2c9cae(0x13e)));const _0x211020=await a23_0x3ecf03({'type':_0x2c9cae(0x158),'name':_0x2c9cae(0x150),'message':_0x2c9cae(0x192),'validate':_0x2d20ef=>{const _0x2ff56a=_0x2c9cae;if(!_0x2d20ef||!_0x2d20ef[_0x2ff56a(0x186)]())return _0x2ff56a(0x14c);return!![];}});if(!_0x211020[_0x2c9cae(0x150)])return console[_0x2c9cae(0x147)](_0x2c9cae(0x15f)),0x1;const _0x1c0a30=_0x211020[_0x2c9cae(0x150)];console[_0x2c9cae(0x147)](_0x2c9cae(0x157));try{const _0x494333=TDX[_0x2c9cae(0x191)]({'site':_0x4206eb,'apiKey':_0x1c0a30['trim'](),'logLevel':_0x2a794c[_0x2c9cae(0x166)]??LogLevel['ERROR']}),_0x15e240=await _0x494333[_0x2c9cae(0x18f)]['getUserInfo']();console['log'](a23_0x3d9504[_0x2c9cae(0x187)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x15e240['email']+')');const _0x204dfa=await isKeychainAvailable();_0x204dfa?(await saveAPIKeyAsync(_0x1c0a30[_0x2c9cae(0x186)](),_0x4206eb,_0x19eea9),console[_0x2c9cae(0x147)](a23_0x3d9504[_0x2c9cae(0x187)]('✓')+_0x2c9cae(0x18a)+_0x19eea9+')')):(console[_0x2c9cae(0x189)](a23_0x3d9504['yellow'](_0x2c9cae(0x16d))),console['warn'](a23_0x3d9504[_0x2c9cae(0x185)](_0x2c9cae(0x14b))));const _0x165174={'site':_0x4206eb,..._0x58cd82&&{'description':_0x58cd82}};return saveProfileToUserConfig(_0x19eea9,_0x165174),console[_0x2c9cae(0x147)](a23_0x3d9504['green']('✓')+'\x20Profile\x20\x27'+_0x19eea9+_0x2c9cae(0x164)),console[_0x2c9cae(0x147)](),console[_0x2c9cae(0x147)](_0x2c9cae(0x177)),console[_0x2c9cae(0x147)](_0x2c9cae(0x14a)+_0x19eea9+_0x2c9cae(0x153)),console[_0x2c9cae(0x147)](_0x2c9cae(0x14a)+_0x19eea9+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5dbbe1){if(_0x5dbbe1 instanceof HTTPClientError&&_0x5dbbe1[_0x2c9cae(0x152)]===0x191)return printAuthError(_0x5dbbe1),0x1;return console[_0x2c9cae(0x183)](a23_0x3d9504[_0x2c9cae(0x18e)](_0x2c9cae(0x169)+(_0x5dbbe1 instanceof Error?_0x5dbbe1['message']:String(_0x5dbbe1)))),console[_0x2c9cae(0x183)](_0x2c9cae(0x17a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x18b);[a23_0x4ed49c(0x18c)]=a23_0x4ed49c(0x12d);[a23_0x4ed49c(0x17b)](_0x51b83d){const _0x44e64c=a23_0x4ed49c,{args:_0x45e4eb}=_0x51b83d;if(_0x45e4eb[_0x44e64c(0x134)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x4ed49c(0x133)](_0xde4176){const _0x1b9292=a23_0x4ed49c,{args:_0x25035f}=_0xde4176,_0x40a939=_0x25035f[0x0];console[_0x1b9292(0x147)](a23_0x3d9504[_0x1b9292(0x12f)](_0x1b9292(0x15e)));if(!profileExists(_0x40a939)){console[_0x1b9292(0x183)](a23_0x3d9504['red'](_0x1b9292(0x136)+_0x40a939+'\x27\x20does\x20not\x20exist.')),console[_0x1b9292(0x147)](_0x1b9292(0x196));const _0x5772c3=listProfiles();if(_0x5772c3[_0x1b9292(0x134)]===0x0)console[_0x1b9292(0x147)](_0x1b9292(0x160));else for(const _0x120b3b of _0x5772c3){console[_0x1b9292(0x147)](_0x1b9292(0x163)+_0x120b3b['name']);}return 0x1;}const _0x181f9c=await a23_0x3ecf03({'type':'confirm','name':_0x1b9292(0x138),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x40a939+'\x27?','initial':![]});if(!_0x181f9c['confirm'])return console[_0x1b9292(0x147)](_0x1b9292(0x162)),0x0;try{removeProfileFromUserConfig(_0x40a939),console[_0x1b9292(0x147)](a23_0x3d9504[_0x1b9292(0x187)]('✓')+_0x1b9292(0x142)+_0x40a939+_0x1b9292(0x190));}catch(_0x2777bc){return console[_0x1b9292(0x183)](a23_0x3d9504[_0x1b9292(0x18e)](_0x1b9292(0x141)+(_0x2777bc instanceof Error?_0x2777bc[_0x1b9292(0x16b)]:String(_0x2777bc)))),0x1;}const _0x3492d3=await isKeychainAvailable();if(_0x3492d3){const _0x4b1e73=await deleteKeychainAPIKey(_0x40a939);_0x4b1e73&&console['log'](a23_0x3d9504[_0x1b9292(0x187)]('✓')+_0x1b9292(0x180));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x17d);['description']=a23_0x4ed49c(0x13b);static ['VALID_KEYS']=[a23_0x4ed49c(0x15d),a23_0x4ed49c(0x178),a23_0x4ed49c(0x173),a23_0x4ed49c(0x13d),a23_0x4ed49c(0x145),a23_0x4ed49c(0x18c)];['validate'](_0x4f1e29){const _0x5cb006=a23_0x4ed49c,{args:_0x48839a,options:_0x489b81}=_0x4f1e29,_0x28b99c=_0x489b81[_0x5cb006(0x168)]||getActiveProfile();if(!_0x28b99c)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(_0x48839a[_0x5cb006(0x134)]===0x0)return _0x5cb006(0x13c)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');const _0x5628c=_0x48839a[0x0];if(!_0x5628c['includes']('='))return _0x5cb006(0x155)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');const [_0x19c6d8]=_0x5628c[_0x5cb006(0x12c)]('=',0x2);if(!ProfileSetCommand[_0x5cb006(0x159)]['includes'](_0x19c6d8))return'Unknown\x20key\x20\x27'+_0x19c6d8+_0x5cb006(0x16c)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');return undefined;}async[a23_0x4ed49c(0x133)](_0x46a5a4){const _0x503df9=a23_0x4ed49c,{args:_0x44ee0d,options:_0x38ca95}=_0x46a5a4,_0x2f4a42=_0x38ca95[_0x503df9(0x168)]||getActiveProfile(),[_0x299a85,..._0x293295]=_0x44ee0d[0x0][_0x503df9(0x12c)]('='),_0x5314b1=_0x293295[_0x503df9(0x14e)]('=');console[_0x503df9(0x147)](a23_0x3d9504[_0x503df9(0x12f)](_0x503df9(0x146)));if(!profileExists(_0x2f4a42)){const _0x1a107b=await a23_0x3ecf03({'type':_0x503df9(0x138),'name':'create','message':_0x503df9(0x136)+_0x2f4a42+_0x503df9(0x139),'initial':!![]});if(!_0x1a107b[_0x503df9(0x191)])return console[_0x503df9(0x147)](_0x503df9(0x176)),0x1;}const _0x2638c4=loadProfile(_0x2f4a42),_0x18728d=_0x2638c4?.['config']||{};if(_0x299a85===_0x503df9(0x15d)){const _0x473a89=resolveSite(_0x5314b1);console[_0x503df9(0x147)](_0x503df9(0x17c)+_0x473a89+_0x503df9(0x156)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x503df9(0x147)]('\x20\x20'+getConsoleUrl(_0x473a89,_0x503df9(0x13e)));const _0x384dda=await a23_0x3ecf03({'type':_0x503df9(0x158),'name':_0x503df9(0x150),'message':_0x503df9(0x198),'validate':_0x36756f=>{const _0xc1a1a0=_0x503df9;if(!_0x36756f||!_0x36756f[_0xc1a1a0(0x186)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x384dda[_0x503df9(0x150)])return console[_0x503df9(0x147)](_0x503df9(0x137)),0x1;console['log'](_0x503df9(0x157));try{const _0x45b674=TDX[_0x503df9(0x191)]({'site':_0x473a89,'apiKey':_0x384dda['apiKey']['trim'](),'logLevel':_0x38ca95['logLevel']??LogLevel[_0x503df9(0x194)]}),_0x28515a=await _0x45b674[_0x503df9(0x18f)][_0x503df9(0x195)]();console[_0x503df9(0x147)](a23_0x3d9504[_0x503df9(0x187)]('✓')+_0x503df9(0x175)+_0x28515a['email']+')');const _0x13809e=await isKeychainAvailable();_0x13809e?(await saveAPIKeyAsync(_0x384dda[_0x503df9(0x150)][_0x503df9(0x186)](),_0x473a89,_0x2f4a42),console[_0x503df9(0x147)](a23_0x3d9504['green']('✓')+_0x503df9(0x130))):console['warn'](a23_0x3d9504['yellow'](_0x503df9(0x16d))),_0x18728d[_0x503df9(0x15d)]=_0x473a89;}catch(_0x49bcc5){if(_0x49bcc5 instanceof HTTPClientError&&_0x49bcc5[_0x503df9(0x152)]===0x191)return printAuthError(_0x49bcc5),0x1;return console[_0x503df9(0x183)](a23_0x3d9504['red'](_0x503df9(0x169)+(_0x49bcc5 instanceof Error?_0x49bcc5[_0x503df9(0x16b)]:String(_0x49bcc5)))),console[_0x503df9(0x183)](_0x503df9(0x12b)),0x1;}}else _0x18728d[_0x299a85]=_0x5314b1||undefined;return saveProfileToUserConfig(_0x2f4a42,_0x18728d),console['log'](a23_0x3d9504['green']('✓')+_0x503df9(0x142)+_0x2f4a42+_0x503df9(0x149)+_0x299a85+'='+(_0x5314b1||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x4ed49c(0x154)]='profile:use';[a23_0x4ed49c(0x18c)]=a23_0x4ed49c(0x12e);[a23_0x4ed49c(0x17b)](_0x1d92ca){const _0x4a532d=a23_0x4ed49c,{args:_0x766c42}=_0x1d92ca;if(_0x766c42['length']===0x0)return _0x4a532d(0x15a);return undefined;}async[a23_0x4ed49c(0x133)](_0x1f5634){const _0x1d328d=a23_0x4ed49c,{args:_0x581aba,options:_0x28bdd7}=_0x1f5634,_0x18adc8=_0x581aba[0x0],_0x4d5f5f=_0x28bdd7[_0x1d328d(0x16a)];cleanExpiredSessions();if(!profileExists(_0x18adc8)){console[_0x1d328d(0x183)](a23_0x3d9504[_0x1d328d(0x18e)]('Profile\x20\x27'+_0x18adc8+_0x1d328d(0x17e))),console[_0x1d328d(0x147)](_0x1d328d(0x196));const _0x39140d=listProfiles();if(_0x39140d[_0x1d328d(0x134)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x2656ca of _0x39140d){console['log']('\x20\x20-\x20'+_0x2656ca[_0x1d328d(0x154)]);}return 0x1;}if(_0x4d5f5f){const _0x917dae=a23_0x40c7e7[_0x1d328d(0x14e)](getConfigDir(),_0x1d328d(0x181));return saveActiveProfileToUserConfig(_0x18adc8),console[_0x1d328d(0x147)]('Default\x20profile\x20set\x20to:\x20'+a23_0x3d9504['green'](_0x18adc8)),console[_0x1d328d(0x147)](a23_0x3d9504['dim']('\x0aSaved\x20to:\x20'+_0x917dae)),0x0;}const _0x4dfe99=getSessionID(_0x28bdd7[_0x1d328d(0x13a)]);return saveSessionContext({'profile':_0x18adc8},_0x28bdd7[_0x1d328d(0x13a)]),console[_0x1d328d(0x147)](_0x1d328d(0x172)+a23_0x3d9504['green'](_0x18adc8)+'\x20'+a23_0x3d9504['dim'](_0x1d328d(0x15c)+_0x4dfe99+')')),console[_0x1d328d(0x147)](a23_0x3d9504[_0x1d328d(0x174)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x18adc8+_0x1d328d(0x161))),0x0;}}
|
|
1
|
+
const a23_0x5400e5=a23_0x32ec;(function(_0x3fd948,_0x540bfe){const _0x2bea2e=a23_0x32ec,_0x14c174=_0x3fd948();while(!![]){try{const _0x571a8a=-parseInt(_0x2bea2e(0x1ac))/0x1+-parseInt(_0x2bea2e(0x187))/0x2*(-parseInt(_0x2bea2e(0x1b8))/0x3)+-parseInt(_0x2bea2e(0x191))/0x4*(parseInt(_0x2bea2e(0x1b0))/0x5)+-parseInt(_0x2bea2e(0x1ab))/0x6+-parseInt(_0x2bea2e(0x1a1))/0x7+parseInt(_0x2bea2e(0x16c))/0x8*(parseInt(_0x2bea2e(0x1a6))/0x9)+parseInt(_0x2bea2e(0x18f))/0xa;if(_0x571a8a===_0x540bfe)break;else _0x14c174['push'](_0x14c174['shift']());}catch(_0x2c7122){_0x14c174['push'](_0x14c174['shift']());}}}(a23_0x1cec,0x1c22b));function a23_0x1cec(){const _0xca4b0d=['115954rVPwrx','Failed\x20to\x20remove\x20profile:\x20','profileName','confirm','Session\x20profile\x20set\x20to:\x20','profile:use','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','3266060KOwndi','Enter\x20your\x20TD\x20API\x20key:','110468Gonmth','logLevel','Set\x20a\x20profile\x20configuration\x20value','tdx:\x20profile\x20remove','red','log','config','✗\x20Validation\x20failed:\x20','API\x20key\x20cannot\x20be\x20empty','test','/app/mp/ak','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','site','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Enter\x20site\x20name:','Profile\x20name\x20cannot\x20be\x20empty','281750JEXGlb','\x20\x20-\x20','password','yellow','includes','1836279RYedMw','tdx.json','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','green','1200150ziVDtT','177862YLJmtB','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20Profile\x20\x27','10iAhhib','\x27\x20removed\x20from\x20configuration','trim','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','create','Profile\x20\x27','apiKey','customSite','3HxNWPG','llm_agent','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Remove\x20a\x20profile','\x20--default\x27\x20to\x20save\x20permanently','Removal\x20cancelled','\x27\x20created','Unknown\x20key\x20\x27','split','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','us01','message','email','dim','\x27.\x0a\x0aValid\x20keys:\x20','(session:\x20','profile:create','\x27\x20requires\x20API\x20key\x20validation.','\x20\x20(no\x20profiles\x20found)','Validating\x20API\x20key...','\x0aSetup\x20cancelled','Set\x20session\x20profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','llm_project','length','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Operation\x20cancelled','\x27\x20does\x20not\x20exist.','8LcIhxH','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','text','ERROR','join','jobs','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','description','\x20\x20tdx\x20--profile\x20','status','VALID_KEYS','\x0aOperation\x20cancelled','session','validate','name','profile:set','getUserInfo','execute','profile','(cleared)','error','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','\x0aAvailable\x20profiles:','warn','tdx:\x20profile\x20create','bold'];a23_0x1cec=function(){return _0xca4b0d;};return a23_0x1cec();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a23_0x32ec(_0x41393d,_0x49abc0){_0x41393d=_0x41393d-0x165;const _0x1cec7e=a23_0x1cec();let _0x32ec65=_0x1cec7e[_0x41393d];return _0x32ec65;}import*as a23_0x42364d 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_0x144249 from'prompts';import a23_0x3193da from'chalk';function validateProfileName(_0x5aaffe){const _0x2bf7fd=a23_0x32ec;if(!_0x5aaffe||!_0x5aaffe[_0x2bf7fd(0x1b2)]())return _0x2bf7fd(0x1a0);const _0x1e020a=_0x5aaffe[_0x2bf7fd(0x1b2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x2bf7fd(0x19a)](_0x1e020a))return _0x2bf7fd(0x1a9);if(profileExists(_0x1e020a))return _0x2bf7fd(0x1b5)+_0x1e020a+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x5400e5(0x17a)]=a23_0x5400e5(0x1c9);[a23_0x5400e5(0x173)]='Create\x20a\x20new\x20profile';async[a23_0x5400e5(0x17d)](_0x25cc24){const _0x54658b=a23_0x5400e5,{options:_0x5e4ff8,args:_0x3bb2fa}=_0x25cc24;console['log'](a23_0x3193da[_0x54658b(0x186)](_0x54658b(0x185)));let _0x1f2544;if(_0x3bb2fa[_0x54658b(0x168)]>0x0&&_0x3bb2fa[0x0]){const _0x59a78b=_0x3bb2fa[0x0][_0x54658b(0x1b2)](),_0xa51dae=validateProfileName(_0x59a78b);if(_0xa51dae!==!![])return console[_0x54658b(0x180)](a23_0x3193da[_0x54658b(0x195)](_0xa51dae)),0x1;_0x1f2544=_0x59a78b;}else{const _0x2dbc99=await a23_0x144249({'type':_0x54658b(0x16e),'name':_0x54658b(0x189),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x2dbc99[_0x54658b(0x189)])return console[_0x54658b(0x196)]('\x0aSetup\x20cancelled'),0x1;_0x1f2544=_0x2dbc99['profileName'][_0x54658b(0x1b2)]();}const _0x2b3384=await a23_0x144249({'type':_0x54658b(0x16e),'name':_0x54658b(0x173),'message':'Enter\x20description\x20(optional):'}),_0x4f118d=_0x2b3384[_0x54658b(0x173)]?.['trim']()||undefined,_0x1ecaf6=_0x5e4ff8['site']||_0x54658b(0x1c3),{choices:_0x3b41f3,initialIndex:_0x600abd}=buildSiteChoices(_0x1ecaf6),_0x599530=await a23_0x144249({'type':'select','name':_0x54658b(0x19d),'message':_0x54658b(0x1ba)+_0x1f2544+'\x27:','choices':_0x3b41f3,'initial':_0x600abd});if(!_0x599530[_0x54658b(0x19d)])return console[_0x54658b(0x196)](_0x54658b(0x1cd)),0x1;let _0x5bf9e2;if(_0x599530[_0x54658b(0x19d)]==='other'){const _0x282274=await a23_0x144249({'type':'text','name':_0x54658b(0x1b7),'message':_0x54658b(0x19f),'initial':_0x54658b(0x1c3),'validate':_0x4ff7d0=>{const _0x7c13f=_0x54658b;if(!_0x4ff7d0||!_0x4ff7d0[_0x7c13f(0x1b2)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x4ff7d0['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x282274[_0x54658b(0x1b7)])return console[_0x54658b(0x196)](_0x54658b(0x1cd)),0x1;_0x5bf9e2=_0x282274[_0x54658b(0x1b7)];}else _0x5bf9e2=_0x599530[_0x54658b(0x19d)];const _0x2d8f00=resolveSite(_0x5bf9e2);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2d8f00),console[_0x54658b(0x196)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x54658b(0x196)]('\x20\x20'+getConsoleUrl(_0x2d8f00,_0x54658b(0x19b)));const _0x517f9d=await a23_0x144249({'type':_0x54658b(0x1a3),'name':'apiKey','message':_0x54658b(0x190),'validate':_0x15249e=>{const _0x1de047=_0x54658b;if(!_0x15249e||!_0x15249e[_0x1de047(0x1b2)]())return _0x1de047(0x199);return!![];}});if(!_0x517f9d[_0x54658b(0x1b6)])return console[_0x54658b(0x196)](_0x54658b(0x1cd)),0x1;const _0x3c3ddf=_0x517f9d[_0x54658b(0x1b6)];console[_0x54658b(0x196)](_0x54658b(0x1cc));try{const _0x455733=TDX[_0x54658b(0x1b4)]({'site':_0x2d8f00,'apiKey':_0x3c3ddf['trim'](),'logLevel':_0x5e4ff8[_0x54658b(0x192)]??LogLevel[_0x54658b(0x16f)]}),_0x333f7c=await _0x455733[_0x54658b(0x171)][_0x54658b(0x17c)]();console[_0x54658b(0x196)](a23_0x3193da[_0x54658b(0x1aa)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x333f7c[_0x54658b(0x1c5)]+')');const _0x54d053=await isKeychainAvailable();_0x54d053?(await saveAPIKeyAsync(_0x3c3ddf[_0x54658b(0x1b2)](),_0x2d8f00,_0x1f2544),console['log'](a23_0x3193da[_0x54658b(0x1aa)]('✓')+_0x54658b(0x1c2)+_0x1f2544+')')):(console[_0x54658b(0x184)](a23_0x3193da['yellow'](_0x54658b(0x19e))),console[_0x54658b(0x184)](a23_0x3193da[_0x54658b(0x1a4)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1187c8={'site':_0x2d8f00,..._0x4f118d&&{'description':_0x4f118d}};return saveProfileToUserConfig(_0x1f2544,_0x1187c8),console[_0x54658b(0x196)](a23_0x3193da[_0x54658b(0x1aa)]('✓')+_0x54658b(0x1af)+_0x1f2544+_0x54658b(0x1bf)),console[_0x54658b(0x196)](),console[_0x54658b(0x196)](_0x54658b(0x1ad)),console[_0x54658b(0x196)](_0x54658b(0x174)+_0x1f2544+_0x54658b(0x169)),console[_0x54658b(0x196)](_0x54658b(0x174)+_0x1f2544+_0x54658b(0x1b3)),0x0;}catch(_0x2ae75c){if(_0x2ae75c instanceof HTTPClientError&&_0x2ae75c['status']===0x191)return printAuthError(_0x2ae75c),0x1;return console[_0x54658b(0x180)](a23_0x3193da[_0x54658b(0x195)]('✗\x20Validation\x20failed:\x20'+(_0x2ae75c instanceof Error?_0x2ae75c[_0x54658b(0x1c4)]:String(_0x2ae75c)))),console[_0x54658b(0x180)](_0x54658b(0x18e)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x5400e5(0x17a)]='profile:remove';[a23_0x5400e5(0x173)]=a23_0x5400e5(0x1bc);[a23_0x5400e5(0x179)](_0x41a697){const _0x1d230a=a23_0x5400e5,{args:_0x4d9f2d}=_0x41a697;if(_0x4d9f2d[_0x1d230a(0x168)]===0x0)return _0x1d230a(0x16d);return undefined;}async[a23_0x5400e5(0x17d)](_0x14724c){const _0x2dfa69=a23_0x5400e5,{args:_0xa7162}=_0x14724c,_0x37eeb5=_0xa7162[0x0];console[_0x2dfa69(0x196)](a23_0x3193da[_0x2dfa69(0x186)](_0x2dfa69(0x194)));if(!profileExists(_0x37eeb5)){console[_0x2dfa69(0x180)](a23_0x3193da[_0x2dfa69(0x195)](_0x2dfa69(0x1b5)+_0x37eeb5+'\x27\x20does\x20not\x20exist.')),console['log'](_0x2dfa69(0x183));const _0x56cf98=listProfiles();if(_0x56cf98[_0x2dfa69(0x168)]===0x0)console[_0x2dfa69(0x196)](_0x2dfa69(0x1cb));else for(const _0x4683ff of _0x56cf98){console['log'](_0x2dfa69(0x1a2)+_0x4683ff[_0x2dfa69(0x17a)]);}return 0x1;}const _0x7d5af=await a23_0x144249({'type':_0x2dfa69(0x18a),'name':_0x2dfa69(0x18a),'message':_0x2dfa69(0x166)+_0x37eeb5+'\x27?','initial':![]});if(!_0x7d5af[_0x2dfa69(0x18a)])return console[_0x2dfa69(0x196)](_0x2dfa69(0x1be)),0x0;try{removeProfileFromUserConfig(_0x37eeb5),console[_0x2dfa69(0x196)](a23_0x3193da[_0x2dfa69(0x1aa)]('✓')+_0x2dfa69(0x1af)+_0x37eeb5+_0x2dfa69(0x1b1));}catch(_0x821c8b){return console[_0x2dfa69(0x180)](a23_0x3193da[_0x2dfa69(0x195)](_0x2dfa69(0x188)+(_0x821c8b instanceof Error?_0x821c8b[_0x2dfa69(0x1c4)]:String(_0x821c8b)))),0x1;}const _0x57b3bf=await isKeychainAvailable();if(_0x57b3bf){const _0x40faf6=await deleteKeychainAPIKey(_0x37eeb5);_0x40faf6&&console[_0x2dfa69(0x196)](a23_0x3193da[_0x2dfa69(0x1aa)]('✓')+_0x2dfa69(0x1bb));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x5400e5(0x17a)]=a23_0x5400e5(0x17b);[a23_0x5400e5(0x173)]=a23_0x5400e5(0x193);static [a23_0x5400e5(0x176)]=[a23_0x5400e5(0x19d),'database','parent_segment',a23_0x5400e5(0x167),a23_0x5400e5(0x1b9),'description'];[a23_0x5400e5(0x179)](_0x622d51){const _0xff066a=a23_0x5400e5,{args:_0x3a950,options:_0x236d1a}=_0x622d51,_0x23c2bd=_0x236d1a[_0xff066a(0x17e)]||getActiveProfile();if(!_0x23c2bd)return _0xff066a(0x19c);if(_0x3a950[_0xff066a(0x168)]===0x0)return _0xff066a(0x181)+ProfileSetCommand[_0xff066a(0x176)][_0xff066a(0x170)](',\x20');const _0x25344e=_0x3a950[0x0];if(!_0x25344e[_0xff066a(0x1a5)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x5277ce]=_0x25344e[_0xff066a(0x1c1)]('=',0x2);if(!ProfileSetCommand[_0xff066a(0x176)][_0xff066a(0x1a5)](_0x5277ce))return _0xff066a(0x1c0)+_0x5277ce+_0xff066a(0x1c7)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a23_0x5400e5(0x17d)](_0x34596d){const _0x4ca9d6=a23_0x5400e5,{args:_0x245765,options:_0x167f9c}=_0x34596d,_0x5238e0=_0x167f9c[_0x4ca9d6(0x17e)]||getActiveProfile(),[_0x240204,..._0x18dc40]=_0x245765[0x0][_0x4ca9d6(0x1c1)]('='),_0x3cc7bb=_0x18dc40[_0x4ca9d6(0x170)]('=');console['log'](a23_0x3193da[_0x4ca9d6(0x186)]('tdx:\x20profile\x20set'));if(!profileExists(_0x5238e0)){const _0x5c6890=await a23_0x144249({'type':'confirm','name':_0x4ca9d6(0x1b4),'message':_0x4ca9d6(0x1b5)+_0x5238e0+_0x4ca9d6(0x1ae),'initial':!![]});if(!_0x5c6890[_0x4ca9d6(0x1b4)])return console[_0x4ca9d6(0x196)](_0x4ca9d6(0x16a)),0x1;}const _0x2c8fab=loadProfile(_0x5238e0),_0x596ac0=_0x2c8fab?.[_0x4ca9d6(0x197)]||{};if(_0x240204===_0x4ca9d6(0x19d)){const _0x3760fe=resolveSite(_0x3cc7bb);console[_0x4ca9d6(0x196)]('Changing\x20site\x20to\x20\x27'+_0x3760fe+_0x4ca9d6(0x1ca)),console[_0x4ca9d6(0x196)](_0x4ca9d6(0x18d)),console[_0x4ca9d6(0x196)]('\x20\x20'+getConsoleUrl(_0x3760fe,_0x4ca9d6(0x19b)));const _0x3793d6=await a23_0x144249({'type':_0x4ca9d6(0x1a3),'name':_0x4ca9d6(0x1b6),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1fc667=>{const _0x1eb86f=_0x4ca9d6;if(!_0x1fc667||!_0x1fc667['trim']())return _0x1eb86f(0x199);return!![];}});if(!_0x3793d6[_0x4ca9d6(0x1b6)])return console[_0x4ca9d6(0x196)](_0x4ca9d6(0x177)),0x1;console[_0x4ca9d6(0x196)]('Validating\x20API\x20key...');try{const _0x312581=TDX[_0x4ca9d6(0x1b4)]({'site':_0x3760fe,'apiKey':_0x3793d6[_0x4ca9d6(0x1b6)][_0x4ca9d6(0x1b2)](),'logLevel':_0x167f9c['logLevel']??LogLevel[_0x4ca9d6(0x16f)]}),_0x51127b=await _0x312581[_0x4ca9d6(0x171)][_0x4ca9d6(0x17c)]();console['log'](a23_0x3193da[_0x4ca9d6(0x1aa)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x51127b[_0x4ca9d6(0x1c5)]+')');const _0x119336=await isKeychainAvailable();_0x119336?(await saveAPIKeyAsync(_0x3793d6[_0x4ca9d6(0x1b6)][_0x4ca9d6(0x1b2)](),_0x3760fe,_0x5238e0),console[_0x4ca9d6(0x196)](a23_0x3193da[_0x4ca9d6(0x1aa)]('✓')+_0x4ca9d6(0x1a8))):console[_0x4ca9d6(0x184)](a23_0x3193da[_0x4ca9d6(0x1a4)](_0x4ca9d6(0x19e))),_0x596ac0['site']=_0x3760fe;}catch(_0x272d7f){if(_0x272d7f instanceof HTTPClientError&&_0x272d7f[_0x4ca9d6(0x175)]===0x191)return printAuthError(_0x272d7f),0x1;return console[_0x4ca9d6(0x180)](a23_0x3193da[_0x4ca9d6(0x195)](_0x4ca9d6(0x198)+(_0x272d7f instanceof Error?_0x272d7f[_0x4ca9d6(0x1c4)]:String(_0x272d7f)))),console[_0x4ca9d6(0x180)](_0x4ca9d6(0x182)),0x1;}}else _0x596ac0[_0x240204]=_0x3cc7bb||undefined;return saveProfileToUserConfig(_0x5238e0,_0x596ac0),console[_0x4ca9d6(0x196)](a23_0x3193da[_0x4ca9d6(0x1aa)]('✓')+'\x20Profile\x20\x27'+_0x5238e0+'\x27\x20updated:\x20'+_0x240204+'='+(_0x3cc7bb||_0x4ca9d6(0x17f))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x5400e5(0x17a)]=a23_0x5400e5(0x18c);[a23_0x5400e5(0x173)]=a23_0x5400e5(0x165);[a23_0x5400e5(0x179)](_0xe10810){const _0x299ee8=a23_0x5400e5,{args:_0x558b8f}=_0xe10810;if(_0x558b8f[_0x299ee8(0x168)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x1cde41){const _0x2e0b24=a23_0x5400e5,{args:_0x3d8e56,options:_0x1c01b1}=_0x1cde41,_0x441cfe=_0x3d8e56[0x0],_0x5c4954=_0x1c01b1['default'];cleanExpiredSessions();if(!profileExists(_0x441cfe)){console[_0x2e0b24(0x180)](a23_0x3193da['red'](_0x2e0b24(0x1b5)+_0x441cfe+_0x2e0b24(0x16b))),console[_0x2e0b24(0x196)](_0x2e0b24(0x183));const _0xb3aae0=listProfiles();if(_0xb3aae0['length']===0x0)console[_0x2e0b24(0x196)](_0x2e0b24(0x1cb));else for(const _0x191787 of _0xb3aae0){console[_0x2e0b24(0x196)]('\x20\x20-\x20'+_0x191787[_0x2e0b24(0x17a)]);}return 0x1;}if(_0x5c4954){const _0x5e66fd=a23_0x42364d[_0x2e0b24(0x170)](getConfigDir(),_0x2e0b24(0x1a7));return saveActiveProfileToUserConfig(_0x441cfe),console['log']('Default\x20profile\x20set\x20to:\x20'+a23_0x3193da[_0x2e0b24(0x1aa)](_0x441cfe)),console['log'](a23_0x3193da[_0x2e0b24(0x1c6)]('\x0aSaved\x20to:\x20'+_0x5e66fd)),0x0;}const _0x9902bd=getSessionID(_0x1c01b1[_0x2e0b24(0x178)]);return saveSessionContext({'profile':_0x441cfe},_0x1c01b1[_0x2e0b24(0x178)]),console[_0x2e0b24(0x196)](_0x2e0b24(0x18b)+a23_0x3193da[_0x2e0b24(0x1aa)](_0x441cfe)+'\x20'+a23_0x3193da[_0x2e0b24(0x1c6)](_0x2e0b24(0x1c8)+_0x9902bd+')')),console['log'](a23_0x3193da['dim'](_0x2e0b24(0x172)+_0x441cfe+_0x2e0b24(0x1bd))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a24_0x5e96(_0x3c68d1,_0xa65d89){_0x3c68d1=_0x3c68d1-0x11e;const _0x3a0f66=a24_0x3a0f();let _0x5e969d=_0x3a0f66[_0x3c68d1];return _0x5e969d;}const a24_0x59bea7=a24_0x5e96;(function(_0x6685f7,_0x2b2b6d){const _0x191ee9=a24_0x5e96,_0xf362e6=_0x6685f7();while(!![]){try{const _0x4124b6=parseInt(_0x191ee9(0x134))/0x1*(-parseInt(_0x191ee9(0x122))/0x2)+parseInt(_0x191ee9(0x133))/0x3*(parseInt(_0x191ee9(0x12a))/0x4)+parseInt(_0x191ee9(0x12c))/0x5+parseInt(_0x191ee9(0x127))/0x6+-parseInt(_0x191ee9(0x12b))/0x7*(parseInt(_0x191ee9(0x12f))/0x8)+parseInt(_0x191ee9(0x125))/0x9+-parseInt(_0x191ee9(0x126))/0xa*(parseInt(_0x191ee9(0x11e))/0xb);if(_0x4124b6===_0x2b2b6d)break;else _0xf362e6['push'](_0xf362e6['shift']());}catch(_0x2d3350){_0xf362e6['push'](_0xf362e6['shift']());}}}(a24_0x3a0f,0x7fbab));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{['name']=a24_0x59bea7(0x124);[a24_0x59bea7(0x12e)]='List\x20all\x20available\x20profiles';async[a24_0x59bea7(0x120)](_0x1ebba3){const _0x572e98=a24_0x59bea7,{options:_0x550463}=_0x1ebba3;try{const _0x497b1f=listProfiles(),_0x500cb7=getActiveProfile();if(_0x497b1f['length']===0x0)return console[_0x572e98(0x11f)](_0x572e98(0x129)),console[_0x572e98(0x11f)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x572e98(0x11f)](_0x572e98(0x131)),0x0;const _0x20cef9=_0x497b1f[_0x572e98(0x128)](_0x35961d=>{const _0x52f259=_0x572e98,_0x268b8f=_0x35961d[_0x52f259(0x135)]===_0x500cb7,_0x9000c5=getProfileParams(_0x35961d[_0x52f259(0x123)]);return{'name':_0x35961d['name'],'active':_0x268b8f,'scope':_0x35961d[_0x52f259(0x12d)],'description':_0x35961d['config'][_0x52f259(0x12e)]||'','params':_0x9000c5};});return await handleSDKOutput(_0x20cef9,_0x550463),0x0;}catch(_0x294e75){return _0x294e75 instanceof Error&&console[_0x572e98(0x130)](_0x572e98(0x132)+_0x294e75[_0x572e98(0x121)]),0x1;}}}function a24_0x3a0f(){const _0x2524e1=['profiles','7356762zMEzuz','100790AmpWMO','5189766NAwCZf','map','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','424XjaXFE','6083cjybUL','1936745MFIhHP','scope','description','3496XdtzHf','error','\x20\x20Global:\x20~/.config/tdx/tdx.json','Error:\x20','9711RCkdoR','298msJDwE','name','814DHAETI','log','execute','message','5128QNZxCD','config'];a24_0x3a0f=function(){return _0x2524e1;};return a24_0x3a0f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a25_0x5011(){const _0x56b113=['Executing\x20query...','182824SlKTCr','Site:\x20','validate','30LwkZes','...','length','join','1928136bBgfBo','2792toczin','488tqCnQi','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','verbose','\x20splits','information_schema','totalSplits','state','7170570wpNErJ','Error:\x20','Statement\x20','setExtra','Executing\x20statement\x20','originalMessage','Schema:\x20','file','args','jobId','84066GBsjtA','name','Catalog:\x20','output','Executing\x20query\x20[','elapsedTimeMillis','28083STorvq','execute','Query\x20completed:\x20Processed\x20','Run\x20Trino\x20queries\x20(streaming)','query','setJobId','826880ZJimgL','processedRows','No\x20SQL\x20provided','7LbPqby','30348DWAPgG','\x20-\x20','message','data','error','options','push','in\x20'];a25_0x5011=function(){return _0x56b113;};return a25_0x5011();}const a25_0x59264a=a25_0x5e7c;function a25_0x5e7c(_0x572861,_0x4164aa){_0x572861=_0x572861-0x1e9;const _0x50119d=a25_0x5011();let _0x5e7ccb=_0x50119d[_0x572861];return _0x5e7ccb;}(function(_0x102a2a,_0x45f98e){const _0x4aa86d=a25_0x5e7c,_0x1b2738=_0x102a2a();while(!![]){try{const _0x5c38d5=parseInt(_0x4aa86d(0x20d))/0x1+parseInt(_0x4aa86d(0x214))/0x2+parseInt(_0x4aa86d(0x1fa))/0x3*(-parseInt(_0x4aa86d(0x216))/0x4)+-parseInt(_0x4aa86d(0x200))/0x5+parseInt(_0x4aa86d(0x1f4))/0x6*(-parseInt(_0x4aa86d(0x203))/0x7)+-parseInt(_0x4aa86d(0x215))/0x8*(parseInt(_0x4aa86d(0x204))/0x9)+parseInt(_0x4aa86d(0x210))/0xa*(parseInt(_0x4aa86d(0x1ea))/0xb);if(_0x5c38d5===_0x45f98e)break;else _0x1b2738['push'](_0x1b2738['shift']());}catch(_0x50183a){_0x1b2738['push'](_0x1b2738['shift']());}}}(a25_0x5011,0x93855));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x59264a(0x1f5)]='query';['description']=a25_0x59264a(0x1fd);async[a25_0x59264a(0x1fb)](_0x351703){const _0x728584=a25_0x59264a,{options:_0x39a3ec,args:_0x19e7c6,tdx:_0xd09c3b}=_0x351703,_0x1d81ff=_0x19e7c6[0x0],_0x127e18=_0x39a3ec[_0x728584(0x1f1)];let _0x22f000;try{if(_0x127e18)_0x22f000=readSqlStatementsFromFile(_0x127e18);else{if(_0x1d81ff==='-')_0x22f000=await readSqlStatementsFromStdin();else{if(_0x1d81ff&&isSqlFilePath(_0x1d81ff))_0x22f000=readSqlStatementsFromFile(_0x1d81ff);else{if(_0x1d81ff)_0x22f000=splitSqlStatements(_0x1d81ff);else throw new Error(_0x728584(0x202));}}}}catch(_0x19e664){return console['error'](_0x728584(0x1eb)+_0x19e664[_0x728584(0x206)]),0x1;}const _0x27ae16=_0x39a3ec['database']||_0x728584(0x21a),_0x279dc4=_0x39a3ec['catalog'];try{const _0x4dba24=[],_0x4b25ae=!!_0x39a3ec['output'];for(let _0x2cadaf=0x0;_0x2cadaf<_0x22f000[_0x728584(0x212)];_0x2cadaf++){const _0xd2eb4e=_0x22f000[_0x2cadaf],_0x5b621d=_0x2cadaf+0x1,_0x50b500=_0x22f000[_0x728584(0x212)],_0x532582=_0x50b500>0x1;_0x39a3ec[_0x728584(0x218)]&&(console[_0x728584(0x208)]('\x0a'+(_0x532582?_0x728584(0x1ec)+_0x5b621d+'/'+_0x50b500+':':'')),console['error'](_0x728584(0x20e)+_0x39a3ec['site']),console['error'](_0x728584(0x1f6)+(_0x279dc4||'td')),console[_0x728584(0x208)](_0x728584(0x1f0)+_0x27ae16),console[_0x728584(0x208)]('SQL:\x20'+_0xd2eb4e));const _0x1ab618=_0x532582?_0x728584(0x1ee)+_0x5b621d+'/'+_0x50b500+_0x728584(0x211):_0x728584(0x20c);try{const _0x1b17f0=await withProgressSpinner(_0x1ab618,async _0x3007ae=>{const _0x49cc11=_0x728584,_0x19849b=await _0xd09c3b[_0x49cc11(0x1fe)][_0x49cc11(0x1fb)](_0xd2eb4e,{'catalog':_0x279dc4,'schema':_0x27ae16,'onJobId':_0x13bd9f=>{const _0x49ae65=_0x49cc11;_0x3007ae[_0x49ae65(0x1ff)](_0x13bd9f);},'onProgress':_0x40efc1=>{const _0x475e33=_0x49cc11;_0x3007ae['setPhase'](_0x475e33(0x1f8)+_0x40efc1[_0x475e33(0x1e9)]+']'),_0x3007ae[_0x475e33(0x1ed)](formatRows(_0x40efc1[_0x475e33(0x201)])+'\x20rows\x20'+_0x40efc1['completedSplits']+'/'+_0x40efc1[_0x475e33(0x21b)]+_0x475e33(0x219));}});return _0x19849b;},{'verbose':_0x39a3ec[_0x728584(0x218)]}),_0x1db5e3=_0x1b17f0[_0x728584(0x207)],_0x2d845c=_0x1db5e3[_0x728584(0x1f3)]?'\x20[Job\x20ID:\x20'+_0x1db5e3[_0x728584(0x1f3)]+']':'',_0x3a0aa3=_0x532582?_0x728584(0x1ec)+_0x5b621d+'/'+_0x50b500+_0x728584(0x205):'';console[_0x728584(0x208)]('✔\x20'+_0x3a0aa3+_0x728584(0x1fc)+formatRows(_0x1db5e3['stats']['processedRows'])+'\x20rows\x20'+(_0x728584(0x20b)+formatElapsed(_0x1db5e3['stats'][_0x728584(0x1f9)])+_0x2d845c));if(_0x532582&&_0x4b25ae){const _0x1bdc6f=resolveOutputOptions(_0x39a3ec),_0x3ff7d2=await formatQueryOutput(_0x1db5e3,_0x1bdc6f);_0x4dba24[_0x728584(0x20a)](_0x3ff7d2);}else await handleQueryOutput(_0x1db5e3,_0x39a3ec);}catch(_0x25f512){const _0x1353da=_0x532582?_0x728584(0x1ec)+_0x5b621d+'/'+_0x50b500+':\x0a':'',_0xfb3782=_0x25f512 instanceof SDKError?_0x25f512[_0x728584(0x1ef)]:_0x25f512[_0x728584(0x206)];return console[_0x728584(0x208)](''+_0x1353da+_0xfb3782),0x1;}}if(_0x22f000['length']>0x1&&_0x4b25ae&&_0x4dba24['length']>0x0){const _0x19919e=_0x4dba24[_0x728584(0x213)]('\x0a');writeFileSync(_0x39a3ec[_0x728584(0x1f7)],_0x19919e),console[_0x728584(0x208)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x39a3ec[_0x728584(0x1f7)]);}return 0x0;}catch(_0x206627){throw _0x206627;}}[a25_0x59264a(0x20f)](_0x493398){const _0x747375=a25_0x59264a,_0x5e43ae=_0x493398[_0x747375(0x1f2)][0x0],_0x5d8fda=_0x493398[_0x747375(0x209)][_0x747375(0x1f1)];if(!_0x5e43ae&&!_0x5d8fda)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x5e43ae&&_0x5d8fda)return _0x747375(0x217);return undefined;}}
|