@treasuredata/tdx 0.10.0 → 0.10.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 +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.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/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/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/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.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-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js.map +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cdp.d.ts +5 -2
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.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_0x296be5=a22_0x2631;(function(_0x15b5eb,_0x165c0a){const _0x473d3c=a22_0x2631,_0x575dda=_0x15b5eb();while(!![]){try{const _0x437c4b=-parseInt(_0x473d3c(0x109))/0x1+parseInt(_0x473d3c(0x1e1))/0x2+parseInt(_0x473d3c(0x11f))/0x3*(parseInt(_0x473d3c(0x125))/0x4)+-parseInt(_0x473d3c(0x142))/0x5+-parseInt(_0x473d3c(0x1c2))/0x6*(-parseInt(_0x473d3c(0x14e))/0x7)+-parseInt(_0x473d3c(0x146))/0x8*(-parseInt(_0x473d3c(0xdc))/0x9)+parseInt(_0x473d3c(0xd6))/0xa;if(_0x437c4b===_0x165c0a)break;else _0x575dda['push'](_0x575dda['shift']());}catch(_0x4a1388){_0x575dda['push'](_0x575dda['shift']());}}}(a22_0x51e9,0xbfe3f));function a22_0x2631(_0x5d214e,_0x5d38ca){_0x5d214e=_0x5d214e-0xc6;const _0x51e92b=a22_0x51e9();let _0x26316c=_0x51e92b[_0x5d214e];return _0x26316c;}import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x20a34d 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}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x23b2b0 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_0x296be5(0x130),LEGACY_PARENT_SEGMENT_DIR=a22_0x296be5(0x129);function openBrowser(_0x26c007){const _0x51e179=a22_0x296be5,_0x414db8=process[_0x51e179(0xf0)],_0xde490e=_0x414db8===_0x51e179(0x10d)?_0x51e179(0x14d):_0x414db8==='win32'?_0x51e179(0x145):_0x51e179(0x111);spawn(_0xde490e,[_0x26c007],{'detached':!![],'stdio':_0x51e179(0x16f)})[_0x51e179(0x1b9)]();}function migrateLegacyDirectory(){const _0x4291e6=a22_0x296be5;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1aab5a=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1aab5a[_0x4291e6(0x115)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x4291e6(0x11d)](a22_0x23b2b0[_0x4291e6(0x1a2)](_0x4291e6(0x1cd)+LEGACY_PARENT_SEGMENT_DIR+_0x4291e6(0xfb)+PARENT_SEGMENT_DIR+_0x4291e6(0x1b0))),console[_0x4291e6(0x11d)](a22_0x23b2b0[_0x4291e6(0xca)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x4291e6(0x1af))),![];console[_0x4291e6(0x11d)](a22_0x23b2b0['yellow']('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x4291e6(0x101)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x4291e6(0x11d)](a22_0x23b2b0[_0x4291e6(0x1a4)](_0x4291e6(0x194)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x1acf49){const _0xf10dd2=_0x1acf49 instanceof Error?_0x1acf49[_0x4291e6(0x1c5)]:String(_0x1acf49);return console['error'](a22_0x23b2b0[_0x4291e6(0x16c)](_0x4291e6(0x18a)+_0xf10dd2+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x296be5(0xe0)](_0x127c3c){const _0x148d63=a22_0x296be5;return migrateLegacyDirectory(),super[_0x148d63(0xe0)](_0x127c3c);}}function resolveYamlFile(_0x4a1116){const _0x47e6b9=a22_0x296be5;if(_0x4a1116[_0x47e6b9(0x1bf)]('.yml')||_0x4a1116[_0x47e6b9(0x1bf)]('.yaml'))return _0x4a1116;return a22_0x20a34d[_0x47e6b9(0x1e3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4a1116)+'.yml');}function formatProgressMessage(_0x4ac6bc){const _0x64c80c=a22_0x296be5,_0x165ef0=_0x4ac6bc[_0x64c80c(0x197)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x165ef0){const [,_0x1811ab,_0xfb225f,_0x34b21d='']=_0x165ef0;return a22_0x23b2b0[_0x64c80c(0xca)](_0x1811ab+':')+'\x20'+_0xfb225f+a22_0x23b2b0[_0x64c80c(0xca)](_0x34b21d);}return a22_0x23b2b0['dim'](_0x4ac6bc);}function showFileNotFoundError(_0x8a0668,_0x39239e){const _0x844f31=a22_0x296be5;console[_0x844f31(0x11d)](a22_0x23b2b0['red'](_0x844f31(0x17c)+_0x8a0668+'\x0a')),console[_0x844f31(0x11d)](a22_0x23b2b0['cyan'](_0x844f31(0x160)+_0x39239e+_0x844f31(0xfa)));}function showParentSegmentNotSetError(_0x13ada1){const _0xf82f7a=a22_0x296be5;console[_0xf82f7a(0x11d)](a22_0x23b2b0['yellow'](_0xf82f7a(0x195))),console['error'](_0x13ada1);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x296be5(0x116);[a22_0x296be5(0xea)]=a22_0x296be5(0x114);async[a22_0x296be5(0x110)](_0x2ce6a5){const _0x167ae7=a22_0x296be5,{options:_0x165a23,args:_0x1947d8,tdx:_0x477112}=_0x2ce6a5,_0x3efc5e=_0x1947d8[0x0];_0x165a23['verbose']&&(console[_0x167ae7(0x11d)]('Site:\x20'+_0x165a23[_0x167ae7(0x135)]),_0x3efc5e&&console[_0x167ae7(0x11d)]('Pattern:\x20'+_0x3efc5e));const _0x8c9a27=await withSpinner(_0x3efc5e?_0x167ae7(0xcd)+_0x3efc5e+_0x167ae7(0xdd):_0x167ae7(0xe5),()=>_0x477112[_0x167ae7(0x19d)]['listParents'](),{'verbose':_0x165a23[_0x167ae7(0x198)]});let _0x2f54fc=_0x8c9a27['data'];if(_0x3efc5e){const _0x3806b3=_0x3efc5e[_0x167ae7(0x161)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x167ae7(0x161)](/\*/g,'.*')[_0x167ae7(0x161)](/\?/g,'.'),_0x3241ef=new RegExp('^'+_0x3806b3+'$','i');_0x2f54fc=_0x2f54fc[_0x167ae7(0xef)](_0x506145=>_0x3241ef['test'](_0x506145[_0x167ae7(0x1d4)][_0x167ae7(0x171)]));}_0x2f54fc['sort']((_0x56f1b5,_0x251760)=>_0x56f1b5[_0x167ae7(0x1d4)]['name'][_0x167ae7(0x1b3)](_0x251760[_0x167ae7(0x1d4)][_0x167ae7(0x171)])),console[_0x167ae7(0x11d)](_0x167ae7(0x1c4)+_0x2f54fc['length']+'\x20parent\x20segment'+(_0x2f54fc[_0x167ae7(0x16b)]!==0x1?'s':''));if(_0x165a23['format']===_0x167ae7(0x18b)||_0x165a23[_0x167ae7(0xe7)]===_0x167ae7(0xd9))await handleSDKOutput(_0x2f54fc,_0x165a23);else{if(_0x2f54fc['length']===0x0)_0x3efc5e?console[_0x167ae7(0x196)](_0x167ae7(0x1e2)+_0x3efc5e):console[_0x167ae7(0x196)]('No\x20parent\x20segments\x20found');else for(const _0x4d672a of _0x2f54fc){const _0x53cfe5=_0x4d672a[_0x167ae7(0x1d4)][_0x167ae7(0x1ba)]?a22_0x23b2b0[_0x167ae7(0xca)]('\x20('+formatRows(_0x4d672a['attributes'][_0x167ae7(0x1ba)])+')'):'';console['log']('👥\x20'+_0x4d672a['attributes'][_0x167ae7(0x171)]+_0x53cfe5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0x165);[a22_0x296be5(0xea)]=a22_0x296be5(0x1d1);async[a22_0x296be5(0x110)](_0x5cff5b){const _0x23b881=a22_0x296be5,{options:_0x1e7537,args:_0x243331,tdx:_0x390bbf}=_0x5cff5b;console[_0x23b881(0x11d)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\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 _0x2a8530=_0x1e7537;if(_0x243331[_0x23b881(0x16b)]===0x0)return console[_0x23b881(0x11d)](a22_0x23b2b0['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x23b881(0x11d)](_0x23b881(0x10b)),0x1;const _0x1fa4f6=_0x243331[0x0];if(!_0x2a8530[_0x23b881(0x1d5)]||!_0x2a8530[_0x23b881(0x1a1)])return console[_0x23b881(0x11d)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x23b881(0x11d)](_0x23b881(0x10b)),0x1;_0x2a8530[_0x23b881(0x198)]&&(console[_0x23b881(0x11d)](_0x23b881(0x1d0)+_0x2a8530['site']),console['error'](_0x23b881(0x1c3)+_0x1fa4f6),console[_0x23b881(0x11d)](_0x23b881(0x180)+_0x2a8530[_0x23b881(0x1d5)]),console[_0x23b881(0x11d)]('Table:\x20'+_0x2a8530[_0x23b881(0x1a1)]));const _0x46852c=await loadJSONFromOptions(_0x2a8530[_0x23b881(0x1d4)],_0x2a8530['attributesFile']),_0x1696c3=await loadJSONFromOptions(_0x2a8530[_0x23b881(0xed)],_0x2a8530[_0x23b881(0xe9)]),_0x21353e=await loadJSONFromOptions(_0x2a8530[_0x23b881(0x14a)],_0x2a8530[_0x23b881(0xe4)]),_0x5bff47={'name':_0x1fa4f6,'description':_0x2a8530[_0x23b881(0xea)],'scheduleType':_0x2a8530[_0x23b881(0x186)],'scheduleOption':_0x2a8530[_0x23b881(0x166)],'timezone':_0x2a8530[_0x23b881(0x156)],'master':{'parentDatabaseName':_0x2a8530[_0x23b881(0x1d5)],'parentTableName':_0x2a8530['table']},'attributes':_0x46852c,'behaviors':_0x1696c3,'customerGroup':_0x21353e},_0x4c73c2=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x1fa4f6+_0x23b881(0xdd),()=>_0x390bbf['segment'][_0x23b881(0x15f)](_0x5bff47),{'verbose':_0x1e7537[_0x23b881(0x198)]}),_0x53dcb8=_0x4c73c2[_0x23b881(0x1e9)];return console[_0x23b881(0x11d)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x53dcb8[_0x23b881(0x171)]+_0x23b881(0x143)+_0x53dcb8['id']),await handleSDKOutput([_0x53dcb8],_0x1e7537),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0x1ca);[a22_0x296be5(0xea)]=a22_0x296be5(0x1a8);async[a22_0x296be5(0x110)](_0x4dfc84){const _0x5d409c=a22_0x296be5,{options:_0x17af83,args:_0x1f3dc9,tdx:_0x596051}=_0x4dfc84;console['error'](_0x5d409c(0x148)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x5d409c(0x13f));const _0x44e081=_0x17af83;if(_0x1f3dc9[_0x5d409c(0x16b)]===0x0)return console['error'](a22_0x23b2b0['red'](_0x5d409c(0xe2))),console[_0x5d409c(0x11d)](_0x5d409c(0xd0)),0x1;const _0x183538=_0x1f3dc9[0x0];_0x44e081[_0x5d409c(0x198)]&&(console[_0x5d409c(0x11d)](_0x5d409c(0x1d0)+_0x44e081[_0x5d409c(0x135)]),console[_0x5d409c(0x11d)](_0x5d409c(0x1bc)+_0x183538));const _0x42b0a4=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x183538+_0x5d409c(0xdd),()=>_0x596051[_0x5d409c(0x19d)][_0x5d409c(0x1d8)](_0x183538),{'verbose':_0x44e081[_0x5d409c(0x198)]}),_0x32a5e1=_0x42b0a4[_0x5d409c(0x1e9)],_0x458e1b=await loadJSONFromOptions(_0x44e081[_0x5d409c(0x147)],_0x44e081[_0x5d409c(0x144)]),_0x383169=await loadJSONFromOptions(_0x44e081[_0x5d409c(0xde)],_0x44e081['addBehaviorsFile']),_0x51bb39={'name':_0x32a5e1[_0x5d409c(0x171)],'description':_0x44e081[_0x5d409c(0xea)]!==undefined?_0x44e081[_0x5d409c(0xea)]:_0x32a5e1[_0x5d409c(0xea)],'scheduleType':_0x44e081[_0x5d409c(0x186)]!==undefined?_0x44e081[_0x5d409c(0x186)]:_0x32a5e1[_0x5d409c(0x186)],'scheduleOption':_0x44e081['scheduleOption']!==undefined?_0x44e081[_0x5d409c(0x166)]:_0x32a5e1[_0x5d409c(0x166)],'timezone':_0x44e081[_0x5d409c(0x156)]!==undefined?_0x44e081[_0x5d409c(0x156)]:_0x32a5e1[_0x5d409c(0x156)],'master':_0x32a5e1[_0x5d409c(0xf5)],'attributes':_0x458e1b?[..._0x32a5e1[_0x5d409c(0x1d4)]||[],..._0x458e1b]:_0x32a5e1[_0x5d409c(0x1d4)],'behaviors':_0x383169?[..._0x32a5e1[_0x5d409c(0xed)]||[],..._0x383169]:_0x32a5e1[_0x5d409c(0xed)],'customerGroup':_0x32a5e1[_0x5d409c(0x14a)]},_0x240f24=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x183538+'\x27...',()=>_0x596051[_0x5d409c(0x19d)][_0x5d409c(0xeb)](_0x183538,_0x51bb39),{'verbose':_0x44e081['verbose']}),_0x3a7434=_0x240f24[_0x5d409c(0x1e9)];return console[_0x5d409c(0x11d)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3a7434[_0x5d409c(0x171)]+'\x27'),await handleSDKOutput([_0x3a7434],_0x44e081),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x296be5(0x171)]='segment:parent:pull';[a22_0x296be5(0xea)]=a22_0x296be5(0x10e);async['execute'](_0x147c83){const _0x576999=a22_0x296be5,{options:_0x2c0e8a,args:_0x4f9537,tdx:_0x2c45e5}=_0x147c83,_0x2b4330=_0x2c0e8a,_0x218f35=_0x4f9537[0x0]||_0x2c0e8a[_0x576999(0x1db)];if(!_0x218f35)return showParentSegmentNotSetError(_0x576999(0xf7)+_0x576999(0x1bd)),0x1;if(_0x2b4330[_0x576999(0xce)]&&_0x2b4330[_0x576999(0x1e6)])return console[_0x576999(0x11d)](a22_0x23b2b0[_0x576999(0x16c)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console['error'](a22_0x23b2b0[_0x576999(0xca)](_0x576999(0x18d))),console['error'](a22_0x23b2b0[_0x576999(0xca)](_0x576999(0xdb)+PARENT_SEGMENT_DIR+_0x576999(0x1dd))),console[_0x576999(0x11d)](a22_0x23b2b0[_0x576999(0x1b4)](_0x576999(0x1c8))),0x1;const _0x1765f1=_0x2b4330[_0x576999(0x1e6)]||a22_0x20a34d[_0x576999(0x1e3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x218f35)+'.yml');_0x2b4330[_0x576999(0x198)]&&(console[_0x576999(0x11d)](_0x576999(0x1d0)+_0x2b4330['site']),console[_0x576999(0x11d)](_0x576999(0x1bc)+_0x218f35),console[_0x576999(0x11d)]('Output\x20file:\x20'+_0x1765f1));const _0x10c5a1=await withSpinner(_0x576999(0x12c)+_0x218f35+_0x576999(0xdd),()=>_0x2c45e5['segment'][_0x576999(0xf3)](_0x218f35),{'verbose':_0x2b4330['verbose']}),_0x4e8b34=_0x10c5a1[_0x576999(0x1e9)];if(existsSync(_0x1765f1)){const _0x30896e=readFileSync(_0x1765f1,'utf-8'),_0x57d483=generateDiff(_0x30896e,_0x4e8b34);if(!hasChanges(_0x57d483))console['error'](a22_0x23b2b0[_0x576999(0x1a4)]('✔')+_0x576999(0x1d2)+a22_0x23b2b0[_0x576999(0x1b4)](_0x1765f1)+_0x576999(0x159));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x1765f1+'\x27:'),console[_0x576999(0x11d)]('─'[_0x576999(0x13a)](0x3c)),console[_0x576999(0x11d)](formatDiffWithColors(_0x57d483)),console[_0x576999(0x11d)]('─'['repeat'](0x3c));if(!_0x2b4330['yes']){const _0x5afa04=await confirmKey('Overwrite\x20\x27'+_0x1765f1+'\x27?');if(!_0x5afa04)return console['error'](_0x576999(0x1ac)),0x1;}writeFileSync(_0x1765f1,_0x4e8b34,'utf-8'),console[_0x576999(0x11d)](a22_0x23b2b0[_0x576999(0x1a4)]('✔')+_0x576999(0x163)+a22_0x23b2b0[_0x576999(0x1b4)](_0x1765f1));}}else{const _0x5b72a7=a22_0x20a34d[_0x576999(0x1b6)](_0x1765f1);!existsSync(_0x5b72a7)&&mkdirSync(_0x5b72a7,{'recursive':!![]}),writeFileSync(_0x1765f1,_0x4e8b34,'utf-8'),console[_0x576999(0x11d)](a22_0x23b2b0['green']('✔')+_0x576999(0x163)+a22_0x23b2b0[_0x576999(0x1b4)](_0x1765f1));}return saveSessionContext({'parent_segment':_0x218f35},_0x2b4330['session']),console[_0x576999(0x11d)](a22_0x23b2b0[_0x576999(0x1a4)]('✔')+_0x576999(0x155)+a22_0x23b2b0['dim']('parent_segment')+_0x576999(0x189)+a22_0x23b2b0[_0x576999(0x1b4)](_0x218f35)),0x0;}}function a22_0x51e9(){const _0x5321a0=['Creating','green','/attempt/','displayMasterInfo','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Found\x20YAML\x20file:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Aborted.','getParentSQL','\x20parent\x20segment\x20\x27','/\x20directory.\x0a','/\x20directories\x20exist.','Validating\x20configuration...','displayPreviewHints','localeCompare','cyan','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','dirname','\x27\x20is\x20up\x20to\x20date','Analyzing\x20changes...','unref','population','Updated','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','endsWith','SQL\x20query:\x0a','Events:','6492978DghTzQ','Name:\x20','✔\x20Found\x20','message','\x20--behavior\x20\x22<name>\x22','schemaError','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','string','segment:parent:update','YAML\x20file:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0a⚠️\x20\x20Both\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','segment:parent:fields','Site:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20No\x20changes\x20-\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','attributes','database','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','displayAttributesStats','getParentFull','Resolving\x20parent\x20segment\x20\x27','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','parentSegment','-1d','/{name}.yml\x0a','stats','Master:','runParent','838910krIlRJ','No\x20parent\x20segments\x20match\x20pattern:\x20','join','Error\x20parsing\x20YAML:\x20','\x20kill','output','Errors:','Customers:','data','To\x20view\x20sample\x20data:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','behavior','Options:\x0a','Behaviors','Behavior:','dim','\x0aUsage:\x20tdx\x20ps\x20preview\x20','interval','Listing\x20parent\x20segments\x20matching\x20\x27','use','\x20\x20\x20\x20-\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:sql','Attempt:','text','Fetching\x20SQL\x20for\x20\x27','pushParentYaml','13262020fSkpwv','sampleData','joinKey','jsonl','toLocaleString','using\x20the\x20default\x20path:\x20','279ifziug','\x27...','addBehaviors','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','run','toFixed','Error:\x20Parent\x20segment\x20name\x20is\x20required','elapsedTimeMillis','customerGroupFile','Listing\x20parent\x20segments...','coveragePercent','format','schemaValid','behaviorsFile','description','updateParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','behaviors','segment:parent:validate','filter','platform','Created','\x20--enriched','pullParentYaml','Error\x20reading\x20file:\x20','master','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20--interval\x20','`\x20to\x20download\x20the\x20configuration\x20first','/\x20and\x20','preview','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20rows\x20','errors','displayValidateResults','/\x20→\x20','Show\x20parent\x20segment\x20details','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:preview','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','enriched','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Master\x20Table','1133891oyxQaV','Attributes','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Error:\x20--behavior\x20requires\x20a\x20name\x0a','darwin','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','execute','xdg-open','Join:','displaySummary','List\x20parent\x20segments','isDirectory','segment:parent:list','\x0aNew\x20parent\x20segment\x20\x27','totalEvents','segment:parent:show','Fetching\x20sample\x20data...','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','error','yes','760008fipeNv','FINISHED','information_schema','Enriched:','Join\x20on:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','8KKkErA','Executing\x20parent\x20segment\x20query...','\x20tdx\x20wf\x20attempt\x20','\x20field','parent_segment','\x20--attribute\x20\x22<name>\x22','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20parent\x20segment\x20\x27','Rows:','Apply\x20changes\x20to\x20\x27','/sessions/','parent_segments','foreignKey','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','displayColumns','site','web','apply','displayPreviewResults','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','repeat','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','displaySampleData','varchar','test','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x27\x20and\x20run\x20workflow?','\x20\x20No\x20sample\x20data\x20available','7660540xLjOfl','\x27\x20with\x20ID:\x20','addAttributesFile','start','30320osKVVr','addAttributes','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','To\x20cancel:','customerGroup','columns','audienceId','open','7GwnuQC','Listing\x20fields\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20--attribute\x20\x22','validateParentYaml','Create\x20parent\x20segment\x20\x27','/app/dw/parentSegments/','\x20Context\x20set:\x20','timezone','limit','Source:','\x20is\x20already\x20up\x20to\x20date','workflowId','Get\x20SQL\x20query\x20for\x20parent\x20segment','Columns:','segment:parent:push','%)\x20','createParent','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','replace','bold','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0aNo\x20sample\x20data\x20available','segment:parent:create','scheduleOption','displayBehaviorsStats','tdx\x20segment\x20parent\x20preview\x20','double','in\x20','length','red','keys','query','ignore','trim','name','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','attribute','label','map','Options:','Available\x20behaviors:','resolveParentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','previewParentYaml','Error:\x20File\x20not\x20found:\x20','column','workflowAttemptId','\x20--behavior\x20\x22','Database:\x20','customersWithEvents','all','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20[Job\x20ID:\x20','customerPercent','scheduleType','stop','jobId','\x20=\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','json','\x0aChanges\x20to\x20apply\x20to\x20\x27','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','allValid','Error:','/app/workflows/','List\x20available\x20fields\x20for\x20segmentation','status','number','✔\x20Renamed\x20directory\x20to\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','log','match','verbose','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','rowCount','\x20rows)','✔\x20No\x20changes\x20-\x20\x27','segment','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','utf-8','Updating','table','yellow'];a22_0x51e9=function(){return _0x5321a0;};return a22_0x51e9();}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0x15d);[a22_0x296be5(0xea)]=a22_0x296be5(0x1da);async[a22_0x296be5(0x110)](_0x1c1a99){const _0x525a3=a22_0x296be5,{options:_0x344649,args:_0x7a81d7,tdx:_0x50ea6f}=_0x1c1a99,_0x1bca33=_0x344649,_0xb2b587=_0x7a81d7[0x0]||_0x344649['parentSegment'];if(!_0xb2b587)return showParentSegmentNotSetError(_0x525a3(0x103)+_0x525a3(0x1a9)),0x1;const _0x368e73=resolveYamlFile(_0xb2b587);if(!existsSync(_0x368e73))return showFileNotFoundError(_0x368e73,_0xb2b587),0x1;_0x1bca33[_0x525a3(0x198)]&&(console[_0x525a3(0x11d)](_0x525a3(0x1d0)+_0x1bca33[_0x525a3(0x135)]),console[_0x525a3(0x11d)](_0x525a3(0x1cb)+_0x368e73));let _0x1e2d0d;try{_0x1e2d0d=readFileSync(_0x368e73,_0x525a3(0x19f));}catch(_0x369b28){const _0x2f0d9c=_0x369b28 instanceof Error?_0x369b28[_0x525a3(0x1c5)]:String(_0x369b28);return console[_0x525a3(0x11d)](_0x525a3(0xf4)+_0x2f0d9c),0x1;}const _0x571281=await withSpinner(_0x525a3(0x1b8),()=>_0x50ea6f[_0x525a3(0x19d)][_0x525a3(0xd5)](_0x1e2d0d),{'verbose':_0x1bca33['verbose']}),_0x5399a1=_0x571281[_0x525a3(0x1e9)],{isNew:_0x530be9,name:_0x292c1f,hasChanges:_0x4a6836,diffFormatted:_0x53acf1}=_0x5399a1;if(!_0x4a6836)return console['error'](_0x525a3(0x19c)+_0x292c1f+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x530be9?console[_0x525a3(0x11d)](_0x525a3(0x117)+_0x292c1f+'\x27:'):console['error'](_0x525a3(0x18c)+_0x292c1f+'\x27:');console[_0x525a3(0x11d)]('─'[_0x525a3(0x13a)](0x3c)),console[_0x525a3(0x11d)](_0x53acf1),console[_0x525a3(0x11d)]('─'['repeat'](0x3c));const _0x3095b1=_0x530be9?_0x525a3(0x153)+_0x292c1f+'\x27?':_0x525a3(0x12e)+_0x292c1f+'\x27?';if(!_0x1bca33['yes']){const _0x17f3c3=await confirmKey(_0x3095b1);if(!_0x17f3c3)return console[_0x525a3(0x11d)]('Aborted.'),0x1;}const _0x115b11=_0x530be9?_0x525a3(0x1a3):_0x525a3(0x1a0),_0x568734=await withSpinner(_0x115b11+_0x525a3(0x1ae)+_0x292c1f+_0x525a3(0xdd),()=>_0x5399a1[_0x525a3(0x137)](),{'verbose':_0x1bca33['verbose']}),_0x28dadc=_0x568734['data'],_0x2223b8=getConsoleNextUrl(_0x1bca33[_0x525a3(0x135)],_0x525a3(0x154)+_0x28dadc['id']),_0x4d4408=_0x530be9?_0x525a3(0xf1):_0x525a3(0x1bb);return console[_0x525a3(0x11d)]('✔\x20'+_0x4d4408+_0x525a3(0x1ae)+_0x28dadc[_0x525a3(0x171)]+'\x27'),console['error']('\x20\x20'+_0x2223b8),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0xee);[a22_0x296be5(0xea)]=a22_0x296be5(0x10f);async[a22_0x296be5(0x110)](_0x4875f9){const _0x21930f=a22_0x296be5,{options:_0xe1e970,args:_0x57dbbe,tdx:_0x5b378f}=_0x4875f9,_0x3cb0d6=_0xe1e970,_0x24560a=_0x57dbbe[0x0]||_0xe1e970['parentSegment'];if(!_0x24560a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x21930f(0x17a)+'Options:\x0a'+_0x21930f(0x1be)+_0x21930f(0x124)+_0x21930f(0x107)),0x1;const _0x30c097=resolveYamlFile(_0x24560a);if(!existsSync(_0x30c097))return showFileNotFoundError(_0x30c097,_0x24560a),0x1;_0x3cb0d6[_0x21930f(0x198)]&&(console['error']('Site:\x20'+_0x3cb0d6['site']),console[_0x21930f(0x11d)](_0x21930f(0x1cb)+_0x30c097));let _0x2dfdf0;try{_0x2dfdf0=readFileSync(_0x30c097,'utf-8');}catch(_0x4b9626){const _0x353983=_0x4b9626 instanceof Error?_0x4b9626['message']:String(_0x4b9626);return console[_0x21930f(0x11d)](_0x21930f(0xf4)+_0x353983),0x1;}const _0x32beae=createCommandSpinner(a22_0x23b2b0[_0x21930f(0xca)](_0x21930f(0x1b1)),{'verbose':_0x3cb0d6[_0x21930f(0x198)]});_0x32beae[_0x21930f(0x145)]();const _0x1cc08c={'onProgress':_0x578047=>{const _0x562b6d=_0x21930f;_0x32beae[_0x562b6d(0xd3)]=formatProgressMessage(_0x578047);}};if(_0x3cb0d6['master'])_0x1cc08c[_0x21930f(0xf5)]=!![];if(_0x3cb0d6[_0x21930f(0x106)])_0x1cc08c['enriched']=!![];_0x3cb0d6[_0x21930f(0x174)]&&(_0x1cc08c[_0x21930f(0x174)]=_0x3cb0d6[_0x21930f(0x174)]);_0x3cb0d6[_0x21930f(0xc6)]&&(_0x1cc08c[_0x21930f(0xc6)]=_0x3cb0d6[_0x21930f(0xc6)]);if(_0x3cb0d6[_0x21930f(0xcc)])_0x1cc08c['interval']=_0x3cb0d6['interval'];let _0x57638d;try{_0x57638d=await _0x5b378f[_0x21930f(0x19d)][_0x21930f(0x152)](_0x2dfdf0,_0x1cc08c),_0x32beae[_0x21930f(0x187)]();}catch(_0x28ba4c){_0x32beae['stop']();throw _0x28ba4c;}const _0x43e316=_0x3cb0d6[_0x21930f(0xcc)]||'-1d';return this[_0x21930f(0x100)](_0x57638d,_0x1cc08c,_0x30c097,_0x43e316),_0x57638d[_0x21930f(0x18e)]?0x0:0x1;}[a22_0x296be5(0x100)](_0x43ed82,_0x159400,_0x35a747,_0x8a4896){const _0x496afc=a22_0x296be5;console['error']('\x0a'+a22_0x23b2b0[_0x496afc(0x162)]('Validate:')+'\x20'+_0x43ed82[_0x496afc(0x171)]),console['error']('═'[_0x496afc(0x13a)](0x3c)),this['displayMasterInfo'](_0x43ed82);if(typeof _0x159400[_0x496afc(0x174)]===_0x496afc(0x1c9)){this[_0x496afc(0x1d7)](_0x43ed82),this[_0x496afc(0x113)](_0x43ed82),this[_0x496afc(0x1b2)](_0x35a747,_0x8a4896,_0x496afc(0x174),_0x159400['attribute']);return;}if(_0x159400[_0x496afc(0x174)]===!![]){this['displayAttributesStats'](_0x43ed82),this[_0x496afc(0x113)](_0x43ed82),this[_0x496afc(0x1b2)](_0x35a747,_0x8a4896,_0x496afc(0x1d4));return;}if(typeof _0x159400[_0x496afc(0xc6)]==='string'){this[_0x496afc(0x167)](_0x43ed82,_0x8a4896),this['displaySummary'](_0x43ed82),this[_0x496afc(0x1b2)](_0x35a747,_0x8a4896,_0x496afc(0xc6),_0x159400[_0x496afc(0xc6)]);return;}if(_0x159400['behavior']===!![]){this[_0x496afc(0x167)](_0x43ed82,_0x8a4896),this[_0x496afc(0x113)](_0x43ed82),this[_0x496afc(0x1b2)](_0x35a747,_0x8a4896,_0x496afc(0xed));return;}this[_0x496afc(0x1d7)](_0x43ed82),this[_0x496afc(0x167)](_0x43ed82,_0x8a4896),this[_0x496afc(0x113)](_0x43ed82),this[_0x496afc(0x1b2)](_0x35a747,_0x8a4896,_0x496afc(0x182));}[a22_0x296be5(0x1b2)](_0x21a62f,_0x3e089a,_0x4bab66,_0x7acbde){const _0x13fe81=a22_0x296be5;console['error']('\x0a'+a22_0x23b2b0[_0x13fe81(0xca)](_0x13fe81(0x1ea)));const _0x147051=_0x3e089a!==_0x13fe81(0x1dc)?_0x13fe81(0xf9)+_0x3e089a:'';if(_0x4bab66===_0x13fe81(0x174)&&_0x7acbde)console[_0x13fe81(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x13fe81(0xca)]('tdx\x20segment\x20parent\x20preview\x20'+_0x21a62f+'\x20--attribute\x20\x22'+_0x7acbde+'\x22'+_0x147051));else{if(_0x4bab66==='behavior'&&_0x7acbde)console[_0x13fe81(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x13fe81(0xca)]('tdx\x20segment\x20parent\x20preview\x20'+_0x21a62f+_0x13fe81(0x17f)+_0x7acbde+'\x22'+_0x147051));else(_0x4bab66===_0x13fe81(0x1d4)||_0x4bab66===_0x13fe81(0x182))&&console[_0x13fe81(0x11d)]('\x20\x20'+a22_0x23b2b0['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x21a62f+_0x13fe81(0x12a)+_0x147051));}(_0x4bab66==='behaviors'||_0x4bab66===_0x13fe81(0x182))&&console[_0x13fe81(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x13fe81(0xca)](_0x13fe81(0x168)+_0x21a62f+_0x13fe81(0x1c6)+_0x147051)),_0x4bab66===_0x13fe81(0x182)&&console[_0x13fe81(0x11d)]('\x20\x20'+a22_0x23b2b0['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x21a62f+_0x13fe81(0xf2)+_0x147051));}[a22_0x296be5(0x1a6)](_0x2ae8c1){const _0x35bcd8=a22_0x296be5,{master:_0x286420}=_0x2ae8c1,_0x4ce75f=_0x286420[_0x35bcd8(0xe8)]?a22_0x23b2b0['green']('✔'):a22_0x23b2b0['red']('✘');console['error']('\x0a'+a22_0x23b2b0['dim'](_0x35bcd8(0x108))),console['error'](_0x4ce75f+'\x20'+a22_0x23b2b0[_0x35bcd8(0x162)](_0x286420[_0x35bcd8(0x1d5)]+'.'+_0x286420[_0x35bcd8(0x1a1)])),_0x286420[_0x35bcd8(0xe8)]?_0x286420[_0x35bcd8(0x19a)]!==undefined&&console[_0x35bcd8(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x35bcd8(0xca)](_0x35bcd8(0x12d))+'\x20'+a22_0x23b2b0[_0x35bcd8(0x1b4)](formatRows(_0x286420[_0x35bcd8(0x19a)]))):console[_0x35bcd8(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x35bcd8(0x16c)](_0x35bcd8(0x18f))+'\x20'+_0x286420[_0x35bcd8(0x1c7)]);}[a22_0x296be5(0x1d7)](_0x232179){const _0x5bace2=a22_0x296be5;if(_0x232179['attributes'][_0x5bace2(0x16b)]===0x0)return;console['error']('\x0a'+a22_0x23b2b0['dim'](_0x5bace2(0x10a)));for(const _0x54b34d of _0x232179['attributes']){const _0x2b7659=_0x54b34d[_0x5bace2(0xe8)]?a22_0x23b2b0[_0x5bace2(0x1a4)]('✔'):a22_0x23b2b0[_0x5bace2(0x16c)]('✘');let _0x30846b='';if(_0x54b34d[_0x5bace2(0xe8)]&&_0x54b34d['matchedCount']!==undefined&&_0x54b34d[_0x5bace2(0xe6)]!==undefined){const _0x2e34eb=_0x54b34d[_0x5bace2(0xe6)][_0x5bace2(0xe1)](0x1),_0x3d7865=_0x54b34d[_0x5bace2(0xe6)]>=0x50?a22_0x23b2b0[_0x5bace2(0x1a4)]:_0x54b34d[_0x5bace2(0xe6)]>=0x32?a22_0x23b2b0[_0x5bace2(0x1a2)]:a22_0x23b2b0[_0x5bace2(0x16c)];_0x30846b='\x20'+a22_0x23b2b0[_0x5bace2(0xca)]('Coverage:')+'\x20'+_0x3d7865(_0x2e34eb+'%')+'\x20('+formatRows(_0x54b34d['matchedCount'])+_0x5bace2(0x19b);}console[_0x5bace2(0x11d)](_0x2b7659+'\x20'+a22_0x23b2b0['bold'](_0x54b34d[_0x5bace2(0x171)])+_0x30846b),console[_0x5bace2(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x5bace2(0xca)](_0x5bace2(0x158))+'\x20'+a22_0x23b2b0[_0x5bace2(0x162)](_0x54b34d[_0x5bace2(0x1d5)]+'.'+_0x54b34d[_0x5bace2(0x1a1)]));const _0x59c346=_0x54b34d[_0x5bace2(0xd8)]===_0x54b34d[_0x5bace2(0x131)]?a22_0x23b2b0[_0x5bace2(0xca)](_0x5bace2(0x123))+'\x20'+_0x54b34d[_0x5bace2(0xd8)]:a22_0x23b2b0[_0x5bace2(0xca)](_0x5bace2(0x112))+'\x20'+_0x54b34d[_0x5bace2(0xd8)]+_0x5bace2(0x189)+_0x54b34d['foreignKey'];console[_0x5bace2(0x11d)]('\x20\x20'+_0x59c346),console['error']('\x20\x20'+a22_0x23b2b0['dim'](_0x5bace2(0x15c))),this[_0x5bace2(0x134)](_0x54b34d[_0x5bace2(0x14b)]),!_0x54b34d[_0x5bace2(0xe8)]&&console['error']('\x20\x20'+a22_0x23b2b0[_0x5bace2(0x16c)](_0x5bace2(0x18f))+'\x20'+_0x54b34d['schemaError']);}}['displayBehaviorsStats'](_0x1b1d7f,_0x26efa1){const _0x39e055=a22_0x296be5;if(_0x1b1d7f[_0x39e055(0xed)]['length']===0x0)return;console[_0x39e055(0x11d)]('\x0a'+a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0xc8))+'\x20'+a22_0x23b2b0[_0x39e055(0xca)]('('+_0x26efa1+')'));for(const _0x319079 of _0x1b1d7f['behaviors']){const _0x53b339=_0x319079[_0x39e055(0xe8)]?a22_0x23b2b0['green']('✔'):a22_0x23b2b0['red']('✘');let _0xe52ada='';if(_0x319079[_0x39e055(0xe8)]&&_0x319079[_0x39e055(0x181)]!==undefined&&_0x319079[_0x39e055(0x118)]!==undefined){const _0x5f5da7=_0x319079[_0x39e055(0x185)]?.[_0x39e055(0xe1)](0x1)||'?',_0x3c678d=(_0x319079[_0x39e055(0x185)]??0x0)>=0x32?a22_0x23b2b0[_0x39e055(0x1a4)]:(_0x319079[_0x39e055(0x185)]??0x0)>=0x14?a22_0x23b2b0[_0x39e055(0x1a2)]:a22_0x23b2b0['red'];_0xe52ada='\x20'+a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0x1e8))+'\x20'+_0x3c678d(formatRows(_0x319079[_0x39e055(0x181)]))+'\x20('+_0x5f5da7+_0x39e055(0x15e)+a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0x1c1))+'\x20'+a22_0x23b2b0[_0x39e055(0x1b4)](formatRows(_0x319079[_0x39e055(0x118)]));}console[_0x39e055(0x11d)](_0x53b339+'\x20'+a22_0x23b2b0[_0x39e055(0x162)](_0x319079[_0x39e055(0x171)])+_0xe52ada),console['error']('\x20\x20'+a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0x158))+'\x20'+a22_0x23b2b0['bold'](_0x319079[_0x39e055(0x1d5)]+'.'+_0x319079[_0x39e055(0x1a1)]));const _0x2a788f=_0x319079[_0x39e055(0xd8)]===_0x319079[_0x39e055(0x131)]?a22_0x23b2b0['dim'](_0x39e055(0x123))+'\x20'+_0x319079[_0x39e055(0xd8)]:a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0x112))+'\x20'+_0x319079[_0x39e055(0xd8)]+'\x20=\x20'+_0x319079[_0x39e055(0x131)];console['error']('\x20\x20'+_0x2a788f),console[_0x39e055(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x39e055(0xca)](_0x39e055(0x15c))),this[_0x39e055(0x134)](_0x319079[_0x39e055(0x14b)]),!_0x319079['schemaValid']&&console[_0x39e055(0x11d)]('\x20\x20'+a22_0x23b2b0['red'](_0x39e055(0x18f))+'\x20'+_0x319079[_0x39e055(0x1c7)]);}}[a22_0x296be5(0x134)](_0x2e71c3){const _0x41f037=a22_0x296be5;for(const _0x5e8ece of _0x2e71c3){_0x5e8ece['label']===_0x5e8ece[_0x41f037(0x17d)]||_0x5e8ece['column']==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x5e8ece['label']):console[_0x41f037(0x11d)](_0x41f037(0xcf)+_0x5e8ece[_0x41f037(0x175)]+'\x20'+a22_0x23b2b0['dim']('('+_0x5e8ece[_0x41f037(0x17d)]+')'));}}[a22_0x296be5(0x113)](_0x37790d){const _0x38c528=a22_0x296be5;console[_0x38c528(0x11d)]('─'[_0x38c528(0x13a)](0x3c));if(_0x37790d[_0x38c528(0xff)][_0x38c528(0x16b)]>0x0){console[_0x38c528(0x11d)]('\x0a'+a22_0x23b2b0[_0x38c528(0x16c)](_0x38c528(0x1e7)));for(const _0x262ff5 of _0x37790d[_0x38c528(0xff)]){console[_0x38c528(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x38c528(0x16c)]('•')+'\x20'+_0x262ff5);}}_0x37790d[_0x38c528(0x18e)]&&console[_0x38c528(0x11d)]('\x0a'+a22_0x23b2b0['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a22_0x296be5(0x104);[a22_0x296be5(0xea)]=a22_0x296be5(0x105);async[a22_0x296be5(0x110)](_0x487fdf){const _0x4ad769=a22_0x296be5,{options:_0x7c4265,args:_0x104285,tdx:_0x3acd10}=_0x487fdf,_0x1eb1b8=_0x7c4265,_0x498290=_0x104285[0x0]||_0x7c4265[_0x4ad769(0x1db)];if(!_0x498290)return showParentSegmentNotSetError(_0x4ad769(0x183)+_0x4ad769(0x150)+'Options\x20(one\x20required):\x0a'+_0x4ad769(0x1ce)+_0x4ad769(0x1b5)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x4ad769(0x1ab)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x1eb1b8[_0x4ad769(0xf5)]&&!_0x1eb1b8['attribute']&&!_0x1eb1b8['behavior']&&!_0x1eb1b8[_0x4ad769(0x106)])return console['error'](a22_0x23b2b0[_0x4ad769(0x16c)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x4ad769(0x11d)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x4ad769(0x11d)](_0x4ad769(0x177)),console[_0x4ad769(0x11d)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x4ad769(0x11d)](_0x4ad769(0x133)),console[_0x4ad769(0x11d)](_0x4ad769(0x1d6)),0x1;const _0x367728=resolveYamlFile(_0x498290);if(!existsSync(_0x367728))return showFileNotFoundError(_0x367728,_0x498290),0x1;_0x1eb1b8[_0x4ad769(0x198)]&&(console[_0x4ad769(0x11d)]('Site:\x20'+_0x1eb1b8[_0x4ad769(0x135)]),console['error'](_0x4ad769(0x1cb)+_0x367728));let _0x27a74e;try{_0x27a74e=readFileSync(_0x367728,_0x4ad769(0x19f));}catch(_0x561e41){const _0x4dbf20=_0x561e41 instanceof Error?_0x561e41[_0x4ad769(0x1c5)]:String(_0x561e41);return console['error'](_0x4ad769(0xf4)+_0x4dbf20),0x1;}let _0x2b217e;try{_0x2b217e=parseDef(_0x27a74e);}catch(_0xf864c5){const _0xf7d7a7=_0xf864c5 instanceof Error?_0xf864c5[_0x4ad769(0x1c5)]:String(_0xf864c5);return console['error'](a22_0x23b2b0[_0x4ad769(0x16c)](_0x4ad769(0x1e4)+_0xf7d7a7)),0x1;}if(_0x1eb1b8['attribute']===!![]||_0x1eb1b8[_0x4ad769(0x174)]===''){const _0x4142e2=_0x2b217e[_0x4ad769(0x1d4)]?.[_0x4ad769(0x176)](_0x438b1c=>_0x438b1c['name'])||[];if(_0x4142e2[_0x4ad769(0x16b)]===0x0)console[_0x4ad769(0x11d)](a22_0x23b2b0['red'](_0x4ad769(0xf6)));else{console[_0x4ad769(0x11d)](a22_0x23b2b0[_0x4ad769(0x16c)](_0x4ad769(0x132))),console[_0x4ad769(0x11d)]('Available\x20attributes:');for(const _0x236fa5 of _0x4142e2){console[_0x4ad769(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x4ad769(0x1b4)](_0x236fa5));}console[_0x4ad769(0x11d)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x498290+_0x4ad769(0x151)+_0x4142e2[0x0]+'\x22');}return 0x1;}if(_0x1eb1b8[_0x4ad769(0xc6)]===!![]||_0x1eb1b8[_0x4ad769(0xc6)]===''){const _0x4a2535=_0x2b217e[_0x4ad769(0xed)]?.[_0x4ad769(0x176)](_0x4c9d7c=>_0x4c9d7c['name'])||[];if(_0x4a2535[_0x4ad769(0x16b)]===0x0)console['error'](a22_0x23b2b0[_0x4ad769(0x16c)](_0x4ad769(0x173)));else{console[_0x4ad769(0x11d)](a22_0x23b2b0[_0x4ad769(0x16c)](_0x4ad769(0x10c))),console[_0x4ad769(0x11d)](_0x4ad769(0x178));for(const _0x46f2fe of _0x4a2535){console[_0x4ad769(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x4ad769(0x1b4)](_0x46f2fe));}console[_0x4ad769(0x11d)](_0x4ad769(0xcb)+_0x498290+_0x4ad769(0x17f)+_0x4a2535[0x0]+'\x22');}return 0x1;}const _0x5e745b=createCommandSpinner(a22_0x23b2b0[_0x4ad769(0xca)](_0x4ad769(0x11a)),{'verbose':_0x1eb1b8[_0x4ad769(0x198)]});_0x5e745b[_0x4ad769(0x145)]();const _0x55325a={'onProgress':_0x110f68=>{const _0x592afa=_0x4ad769;_0x5e745b[_0x592afa(0xd3)]=formatProgressMessage(_0x110f68);}};if(_0x1eb1b8[_0x4ad769(0xf5)])_0x55325a[_0x4ad769(0xf5)]=!![];if(_0x1eb1b8[_0x4ad769(0x174)]&&typeof _0x1eb1b8[_0x4ad769(0x174)]===_0x4ad769(0x1c9))_0x55325a[_0x4ad769(0x174)]=_0x1eb1b8[_0x4ad769(0x174)];if(_0x1eb1b8[_0x4ad769(0xc6)]&&typeof _0x1eb1b8['behavior']==='string')_0x55325a[_0x4ad769(0xc6)]=_0x1eb1b8[_0x4ad769(0xc6)];if(_0x1eb1b8[_0x4ad769(0x106)])_0x55325a[_0x4ad769(0x106)]=!![];if(_0x1eb1b8[_0x4ad769(0xcc)])_0x55325a[_0x4ad769(0xcc)]=_0x1eb1b8['interval'];let _0x5c0991;try{_0x5c0991=await _0x3acd10[_0x4ad769(0x19d)][_0x4ad769(0x17b)](_0x27a74e,_0x55325a),_0x5e745b[_0x4ad769(0x187)]();}catch(_0x36a1ab){_0x5e745b[_0x4ad769(0x187)]();throw _0x36a1ab;}return await this[_0x4ad769(0x138)](_0x5c0991,{'master':_0x1eb1b8['master'],'attribute':typeof _0x1eb1b8[_0x4ad769(0x174)]===_0x4ad769(0x1c9)?_0x1eb1b8[_0x4ad769(0x174)]:undefined,'behavior':typeof _0x1eb1b8[_0x4ad769(0xc6)]===_0x4ad769(0x1c9)?_0x1eb1b8[_0x4ad769(0xc6)]:undefined,'enriched':_0x1eb1b8[_0x4ad769(0x106)]}),_0x5c0991[_0x4ad769(0x18e)]?0x0:0x1;}async[a22_0x296be5(0x138)](_0x4d2f83,_0x1afaf9){const _0x494af3=a22_0x296be5;console[_0x494af3(0x11d)]('\x0a'+a22_0x23b2b0[_0x494af3(0x162)]('Preview:')+'\x20'+_0x4d2f83[_0x494af3(0x171)]),console[_0x494af3(0x11d)]('═'[_0x494af3(0x13a)](0x3c));if(_0x1afaf9[_0x494af3(0xf5)]&&_0x4d2f83['sampleData']){const _0x281e4b=a22_0x23b2b0[_0x494af3(0xca)](_0x494af3(0x1df))+'\x20'+a22_0x23b2b0[_0x494af3(0x162)](_0x4d2f83[_0x494af3(0xf5)]['database']+'.'+_0x4d2f83[_0x494af3(0xf5)]['table']);await this['displaySampleData'](_0x281e4b,_0x4d2f83[_0x494af3(0xd7)]);}else{if(_0x1afaf9['attribute']&&_0x4d2f83[_0x494af3(0xd7)]){const _0x579f46=a22_0x23b2b0[_0x494af3(0xca)]('Attribute:')+'\x20'+a22_0x23b2b0[_0x494af3(0x162)](_0x1afaf9[_0x494af3(0x174)]);await this[_0x494af3(0x13c)](_0x579f46,_0x4d2f83[_0x494af3(0xd7)]);}else{if(_0x1afaf9[_0x494af3(0xc6)]&&_0x4d2f83['sampleData']){const _0x2c1bf1=a22_0x23b2b0[_0x494af3(0xca)](_0x494af3(0xc9))+'\x20'+a22_0x23b2b0['bold'](_0x1afaf9[_0x494af3(0xc6)]);await this[_0x494af3(0x13c)](_0x2c1bf1,_0x4d2f83['sampleData']);}else{if(_0x1afaf9[_0x494af3(0x106)]&&_0x4d2f83[_0x494af3(0xd7)]){const _0x4885f0=a22_0x23b2b0[_0x494af3(0xca)](_0x494af3(0x122))+'\x20'+a22_0x23b2b0['bold']('Master\x20+\x20Attributes');await this[_0x494af3(0x13c)](_0x4885f0,_0x4d2f83[_0x494af3(0xd7)]);}else!_0x4d2f83[_0x494af3(0xd7)]&&console[_0x494af3(0x11d)](_0x494af3(0x164));}}}if(_0x4d2f83[_0x494af3(0xff)]['length']>0x0){console[_0x494af3(0x11d)]('─'['repeat'](0x3c)),console['error']('\x0a'+a22_0x23b2b0[_0x494af3(0x16c)]('Errors:'));for(const _0x5b5b13 of _0x4d2f83[_0x494af3(0xff)]){console['error']('\x20\x20'+a22_0x23b2b0['red']('•')+'\x20'+_0x5b5b13);}}}async['displaySampleData'](_0x1b86cc,_0x509833){const _0x27e627=a22_0x296be5;if(_0x509833[_0x27e627(0x16b)]===0x0){console[_0x27e627(0x11d)]('\x0a'+_0x1b86cc),console['error'](_0x27e627(0x141));return;}console[_0x27e627(0x11d)]('\x0a'+_0x1b86cc);const _0x5e1cf4=Object[_0x27e627(0x16d)](_0x509833[0x0])[_0x27e627(0x176)](_0x2ed541=>({'name':_0x2ed541,'type':typeof _0x509833[0x0][_0x2ed541]===_0x27e627(0x193)?_0x27e627(0x169):_0x27e627(0x13d)})),_0x221520={'queryId':_0x27e627(0xfc),'columns':_0x5e1cf4,'data':_0x509833,'stats':{'state':_0x27e627(0x120),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x509833[_0x27e627(0x16b)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4c667e=formatAsTable(_0x221520,_0x509833[_0x27e627(0x16b)],!![]);await writeOutput(_0x4c667e,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x296be5(0x171)]='segment:parent:run';['description']=a22_0x296be5(0x1cc);async[a22_0x296be5(0x110)](_0x2bc911){const _0x57b511=a22_0x296be5,{options:_0x3d9b00,args:_0x1002a9,tdx:_0x4903d6}=_0x2bc911,_0x575cab=_0x3d9b00,_0x163b6d=_0x1002a9[0x0]||_0x3d9b00[_0x57b511(0x1db)];if(!_0x163b6d)return showParentSegmentNotSetError(_0x57b511(0x172)+_0x57b511(0x1d3)),0x1;const _0x853fc5=resolveYamlFile(_0x163b6d);if(existsSync(_0x853fc5)){_0x575cab[_0x57b511(0x198)]&&console[_0x57b511(0x11d)](_0x57b511(0x1aa)+_0x853fc5);let _0x5544ee;try{_0x5544ee=readFileSync(_0x853fc5,_0x57b511(0x19f));}catch(_0x506056){const _0x15978d=_0x506056 instanceof Error?_0x506056['message']:String(_0x506056);return console[_0x57b511(0x11d)](_0x57b511(0xf4)+_0x15978d),0x1;}const _0xbd081e=await withSpinner(_0x57b511(0x1b8),()=>_0x4903d6[_0x57b511(0x19d)][_0x57b511(0xd5)](_0x5544ee),{'verbose':_0x575cab[_0x57b511(0x198)]}),_0x3d791f=_0xbd081e['data'],{isNew:_0x54ee6c,name:_0x22b599,hasChanges:_0x1b3828,diffFormatted:_0x2821a7}=_0x3d791f;if(_0x1b3828){_0x54ee6c?console[_0x57b511(0x11d)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x22b599+'\x27:'):console[_0x57b511(0x11d)](_0x57b511(0x18c)+_0x22b599+'\x27:');console[_0x57b511(0x11d)]('─'[_0x57b511(0x13a)](0x3c)),console[_0x57b511(0x11d)](_0x2821a7),console[_0x57b511(0x11d)]('─'[_0x57b511(0x13a)](0x3c));const _0x5aa4c9=_0x54ee6c?'Create\x20parent\x20segment\x20\x27'+_0x22b599+_0x57b511(0x140):_0x57b511(0x12e)+_0x22b599+_0x57b511(0x140);if(!_0x575cab[_0x57b511(0x11e)]){const _0x413682=await confirmKey(_0x5aa4c9);if(!_0x413682)return console['error'](_0x57b511(0x1ac)),0x1;}const _0x288f26=_0x54ee6c?_0x57b511(0x1a3):_0x57b511(0x1a0);await withSpinner(_0x288f26+_0x57b511(0x1ae)+_0x22b599+'\x27...',()=>_0x3d791f[_0x57b511(0x137)](),{'verbose':_0x575cab[_0x57b511(0x198)]});const _0x559574=_0x54ee6c?_0x57b511(0xf1):_0x57b511(0x1bb);console[_0x57b511(0x11d)]('✔\x20'+_0x559574+_0x57b511(0x1ae)+_0x22b599+'\x27');}else console[_0x57b511(0x11d)](_0x57b511(0x19c)+_0x22b599+_0x57b511(0x1b7));}const _0x2da0b1=await withSpinner(_0x57b511(0x1a7)+_0x163b6d+'\x27...',()=>_0x4903d6[_0x57b511(0x19d)][_0x57b511(0x1e0)](_0x163b6d),{'verbose':_0x575cab[_0x57b511(0x198)]}),_0x11b8cc=_0x2da0b1[_0x57b511(0x1e9)],_0x3355f6=getConsoleUrl(_0x575cab[_0x57b511(0x135)],_0x57b511(0x190)+_0x11b8cc[_0x57b511(0x15a)]+_0x57b511(0x12f)+_0x11b8cc['workflowSessionId']+_0x57b511(0x1a5)+_0x11b8cc[_0x57b511(0x17e)]);return console[_0x57b511(0x11d)]('\x0a✔\x20Workflow\x20started'),console[_0x57b511(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x57b511(0xca)]('Audience\x20ID:')+'\x20'+_0x11b8cc[_0x57b511(0x14c)]),console[_0x57b511(0x11d)]('\x20\x20'+a22_0x23b2b0['dim']('Status:')+'\x20'+_0x11b8cc[_0x57b511(0x192)]),console[_0x57b511(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x57b511(0xca)]('Session:')+'\x20'+_0x11b8cc['workflowSessionId']),console[_0x57b511(0x11d)]('\x20\x20'+a22_0x23b2b0[_0x57b511(0xca)](_0x57b511(0xd2))+'\x20'+_0x11b8cc['workflowAttemptId']),console[_0x57b511(0x11d)]('\x20\x20'+_0x3355f6),console[_0x57b511(0x11d)]('\x0a'+a22_0x23b2b0['dim'](_0x57b511(0x149))+_0x57b511(0x127)+_0x11b8cc[_0x57b511(0x17e)]+_0x57b511(0x1e5)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0x1cf);[a22_0x296be5(0xea)]=a22_0x296be5(0x191);async[a22_0x296be5(0x110)](_0x4887a7){const _0x5bc7f4=a22_0x296be5,{options:_0x7e4ec1,args:_0x5f16bb,tdx:_0x28eaa4}=_0x4887a7,_0x4156c2=_0x5f16bb[0x0]||_0x7e4ec1[_0x5bc7f4(0x1db)];if(!_0x4156c2)return showParentSegmentNotSetError(_0x5bc7f4(0x199)+_0x5bc7f4(0xec)),0x1;_0x7e4ec1[_0x5bc7f4(0x198)]&&(console[_0x5bc7f4(0x11d)](_0x5bc7f4(0x1d0)+_0x7e4ec1[_0x5bc7f4(0x135)]),console[_0x5bc7f4(0x11d)](_0x5bc7f4(0x1bc)+_0x4156c2));const _0x34f794=await withSpinner(_0x5bc7f4(0x14f)+_0x4156c2+_0x5bc7f4(0xdd),()=>_0x28eaa4[_0x5bc7f4(0x19d)]['listFields'](_0x4156c2),{'verbose':_0x7e4ec1[_0x5bc7f4(0x198)]}),_0x173758=_0x34f794['data'];console['error'](_0x5bc7f4(0x1c4)+_0x173758[_0x5bc7f4(0x16b)]+_0x5bc7f4(0x128)+(_0x173758['length']!==0x1?'s':''));if(_0x7e4ec1[_0x5bc7f4(0x18b)]||_0x7e4ec1[_0x5bc7f4(0xd9)])return await handleSDKOutput(_0x173758,_0x7e4ec1),0x0;return displayFieldsHumanReadable(_0x173758,_0x4156c2),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x296be5(0x171)]='segment:parent:view';[a22_0x296be5(0xea)]=a22_0x296be5(0x102);async['execute'](_0x4a0601){const _0x144cd1=a22_0x296be5,{options:_0x38c647,args:_0x1775c3,tdx:_0x49618f}=_0x4a0601,_0x525403=_0x38c647,_0x26c27a=_0x1775c3[0x0]||_0x38c647[_0x144cd1(0x1db)];if(!_0x26c27a)return showParentSegmentNotSetError(_0x144cd1(0xfd)+_0x144cd1(0x1eb)+_0x144cd1(0xc7)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x38c647[_0x144cd1(0x198)]&&(console[_0x144cd1(0x11d)]('Site:\x20'+_0x38c647['site']),console[_0x144cd1(0x11d)](_0x144cd1(0x1bc)+_0x26c27a));const _0x35f138=await withSpinner(_0x144cd1(0x12c)+_0x26c27a+_0x144cd1(0xdd),()=>_0x49618f[_0x144cd1(0x19d)][_0x144cd1(0x1d8)](_0x26c27a),{'verbose':_0x38c647[_0x144cd1(0x198)]}),_0x426575=_0x35f138['data'];if(_0x525403[_0x144cd1(0x136)]){const _0x4d2cf9=getConsoleNextUrl(_0x525403['site'],_0x144cd1(0x154)+_0x426575['id']);return console[_0x144cd1(0x11d)](a22_0x23b2b0[_0x144cd1(0x1a4)]('✔')+'\x20Opening\x20'+a22_0x23b2b0['cyan'](_0x4d2cf9)),openBrowser(_0x4d2cf9),0x0;}return await handleSingleObjectOutput(_0x426575,_0x38c647),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x296be5(0x171)]='segment:parent:desc';['description']=a22_0x296be5(0xf8);async[a22_0x296be5(0x110)](_0xb57ca2){const _0x2aec24=a22_0x296be5,{options:_0x513189,args:_0x2a4b57,tdx:_0x1e64e4}=_0xb57ca2,_0x3ad5aa=_0x2a4b57[0x0]||_0x513189[_0x2aec24(0x1db)];if(!_0x3ad5aa)return showParentSegmentNotSetError(_0x2aec24(0x139)+_0x2aec24(0x13b)),0x1;_0x513189[_0x2aec24(0x198)]&&(console[_0x2aec24(0x11d)](_0x2aec24(0x1d0)+_0x513189[_0x2aec24(0x135)]),console[_0x2aec24(0x11d)](_0x2aec24(0x1bc)+_0x3ad5aa));const _0x2c5019=await withSpinner(_0x2aec24(0x1d9)+_0x3ad5aa+_0x2aec24(0xdd),()=>_0x1e64e4[_0x2aec24(0x19d)]['resolveParentId'](_0x3ad5aa),{'verbose':_0x513189[_0x2aec24(0x198)]}),_0x276b6b=_0x2c5019[_0x2aec24(0x1e9)],_0x2f5553=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3ad5aa+_0x2aec24(0xdd),()=>_0x1e64e4['segment']['getParentSQL'](_0x276b6b),{'verbose':_0x513189[_0x2aec24(0x198)]}),_0x37ebe2=await executeSchemaQuery(_0x2f5553[_0x2aec24(0x1e9)],_0x1e64e4,_0x513189);return await handleQueryOutput(_0x37ebe2,_0x513189),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0xd1);[a22_0x296be5(0xea)]=a22_0x296be5(0x15b);async[a22_0x296be5(0x110)](_0x1f251c){const _0x38609f=a22_0x296be5,{options:_0x29e6c5,args:_0xe27143,tdx:_0x24f6db}=_0x1f251c,_0x4dc96e=_0xe27143[0x0]||_0x29e6c5[_0x38609f(0x1db)];if(!_0x4dc96e)return showParentSegmentNotSetError(_0x38609f(0xdf)+'\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;_0x29e6c5[_0x38609f(0x198)]&&(console['error'](_0x38609f(0x1d0)+_0x29e6c5[_0x38609f(0x135)]),console[_0x38609f(0x11d)](_0x38609f(0x1bc)+_0x4dc96e));const _0x500b1a=await withSpinner(_0x38609f(0x1d9)+_0x4dc96e+_0x38609f(0xdd),()=>_0x24f6db[_0x38609f(0x19d)][_0x38609f(0x179)](_0x4dc96e),{'verbose':_0x29e6c5[_0x38609f(0x198)]}),_0x2186ed=_0x500b1a[_0x38609f(0x1e9)],_0x55ef02=await withSpinner(_0x38609f(0xd4)+_0x4dc96e+_0x38609f(0xdd),()=>_0x24f6db[_0x38609f(0x19d)][_0x38609f(0x1ad)](_0x2186ed),{'verbose':_0x29e6c5['verbose']}),_0x3564d9=_0x55ef02[_0x38609f(0x1e9)];return _0x29e6c5[_0x38609f(0xe7)]===_0x38609f(0x18b)||_0x29e6c5[_0x38609f(0xe7)]===_0x38609f(0xd9)?await handleSDKOutput([{'sql':_0x3564d9}],_0x29e6c5):console[_0x38609f(0x196)](_0x3564d9),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x296be5(0x171)]=a22_0x296be5(0x119);[a22_0x296be5(0xea)]=a22_0x296be5(0x11b);async[a22_0x296be5(0x110)](_0x544b2c){const _0x429b59=a22_0x296be5,{options:_0x18490c,args:_0x5b48d7,tdx:_0x17e927}=_0x544b2c,_0x1ad420=_0x5b48d7[0x0]||_0x18490c[_0x429b59(0x1db)];if(!_0x1ad420)return showParentSegmentNotSetError(_0x429b59(0x19e)+_0x429b59(0x11c)),0x1;_0x18490c[_0x429b59(0x198)]&&(console[_0x429b59(0x11d)]('Site:\x20'+_0x18490c[_0x429b59(0x135)]),console[_0x429b59(0x11d)](_0x429b59(0x1bc)+_0x1ad420));const _0x267abe=await withSpinner(_0x429b59(0x1d9)+_0x1ad420+_0x429b59(0xdd),()=>_0x17e927[_0x429b59(0x19d)][_0x429b59(0x179)](_0x1ad420),{'verbose':_0x18490c['verbose']}),_0x390f11=_0x267abe[_0x429b59(0x1e9)],_0x5ea11d=await withSpinner(_0x429b59(0xd4)+_0x1ad420+_0x429b59(0xdd),()=>_0x17e927[_0x429b59(0x19d)][_0x429b59(0x1ad)](_0x390f11),{'verbose':_0x18490c['verbose']});let _0x224381=_0x5ea11d[_0x429b59(0x1e9)];const _0x3c9b9a=resolveLimit(_0x18490c[_0x429b59(0x157)],DEFAULT_DISPLAY_LIMIT),_0x59abb8=/\bLIMIT\s+\d+/i[_0x429b59(0x13e)](_0x224381);!_0x59abb8&&(_0x224381=_0x224381[_0x429b59(0x170)]()['replace'](/;+$/,''),_0x224381='SELECT\x20*\x20FROM\x20(\x0a'+_0x224381+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x3c9b9a);_0x18490c[_0x429b59(0x198)]&&console['error'](_0x429b59(0x1c0)+_0x224381);const _0x4f8d1f=await withProgressSpinner(_0x429b59(0x126),async _0x1e7962=>{const _0x452977=_0x429b59,_0x5f023a=await _0x17e927[_0x452977(0x16e)][_0x452977(0x110)](_0x224381,{'catalog':'td','schema':_0x452977(0x121),'onJobId':_0x4699a4=>{_0x1e7962['setJobId'](_0x4699a4);}});return _0x5f023a;},{'verbose':_0x18490c[_0x429b59(0x198)]}),_0x1c20c3=_0x4f8d1f[_0x429b59(0x1e9)],_0x1339cf=_0x1c20c3[_0x429b59(0x188)]?_0x429b59(0x184)+_0x1c20c3['jobId']+']':'';return console[_0x429b59(0x11d)](_0x429b59(0x12b)+_0x1c20c3[_0x429b59(0x1de)]['processedRows'][_0x429b59(0xda)]()+_0x429b59(0xfe)+(_0x429b59(0x16a)+formatElapsed(_0x1c20c3['stats'][_0x429b59(0xe3)])+_0x1339cf)),await handleQueryOutput(_0x1c20c3,_0x18490c),0x0;}}
|
|
1
|
+
const a22_0x31c158=a22_0x1b47;(function(_0x52812e,_0x173a8d){const _0x27e758=a22_0x1b47,_0x39acc3=_0x52812e();while(!![]){try{const _0x317c28=parseInt(_0x27e758(0x1b3))/0x1+-parseInt(_0x27e758(0x27f))/0x2*(-parseInt(_0x27e758(0x247))/0x3)+parseInt(_0x27e758(0x18e))/0x4*(-parseInt(_0x27e758(0x1a2))/0x5)+-parseInt(_0x27e758(0x21e))/0x6+-parseInt(_0x27e758(0x1ca))/0x7*(-parseInt(_0x27e758(0x1bb))/0x8)+-parseInt(_0x27e758(0x1c2))/0x9+parseInt(_0x27e758(0x1e8))/0xa*(parseInt(_0x27e758(0x22d))/0xb);if(_0x317c28===_0x173a8d)break;else _0x39acc3['push'](_0x39acc3['shift']());}catch(_0x58beef){_0x39acc3['push'](_0x39acc3['shift']());}}}(a22_0x43be,0x35a33));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x178d01 from'path';function a22_0x1b47(_0x28d228,_0x4fa295){_0x28d228=_0x28d228-0x150;const _0x43be83=a22_0x43be();let _0x1b476a=_0x43be83[_0x28d228];return _0x1b476a;}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}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';function a22_0x43be(){const _0x128e6b=['\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','1875843NeGJTO','resolveParentId','-1d','segment:parent:update','segment:parent:create','Get\x20SQL\x20query\x20for\x20parent\x20segment','Executing\x20parent\x20segment\x20query...','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','7IFNUUw','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','segment:parent:push','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Apply\x20changes\x20to\x20\x27','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','behaviors','segment','timezone','Resolving\x20parent\x20segment\x20\x27','errors','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Source:','unref','population','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Preview:','workflowAttemptId','To\x20view\x20sample\x20data:','Master:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','utf-8','customersWithEvents','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0a⚠️\x20\x20Both\x20','getParentSQL','Error:\x20--behavior\x20requires\x20a\x20name\x0a','20HQIAOM','Listing\x20fields\x20for\x20\x27','session','Creating','platform','customerGroupFile','segment:parent:list','toLocaleString','\x20--attribute\x20\x22','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','pushParentYaml','Updating','coveragePercent','length','/attempt/','Listing\x20parent\x20segments...','/app/workflows/','segment:parent:show','segment:parent:desc','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','error','segment:parent:fields','run','\x0aChanges\x20to\x20\x27','displaySummary','Fetching\x20current\x20configuration\x20for\x20\x27','Create\x20parent\x20segment\x20\x27','Rows:','Status:','✔\x20Created\x20parent\x20segment\x20\x27','Created','localeCompare','\x20[Job\x20ID:\x20','addBehaviorsFile','%)\x20','schemaValid','message','master','\x20parent\x20segment\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','matchedCount','repeat','runParent','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Creating\x20parent\x20segment\x20\x27','segment:parent:pull','description','workflowSessionId','all','double','yellow','2557968AgjiHj','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','displayAttributesStats','\x20=\x20','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','name','behavior','test','\x20tdx\x20wf\x20attempt\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20Query\x20completed:\x20Processed\x20','json','3181321XTiRYY','win32','Columns:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','cyan','scheduleType','Site:\x20','sampleData','replace','\x27\x20and\x20run\x20workflow?','Error\x20parsing\x20YAML:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Validate:','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Attributes','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','`\x20to\x20download\x20the\x20configuration\x20first','createParent','table','allValid','interval','✔\x20No\x20changes\x20-\x20\x27','foreignKey','\x20Opening\x20','execute','606741DagplP','Enriched:','\x27...','jsonl','Master\x20Table','tdx\x20segment\x20parent\x20preview\x20','\x20--behavior\x20\x22','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','elapsedTimeMillis','join','enriched','updateParent','\x20--interval\x20','Analyzing\x20changes...','Error:','yes','joinKey','Output\x20file:\x20','.yml','Events:','No\x20parent\x20segments\x20found','Session:','displayColumns','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','/{name}.yml\x0a','Options:','limit','displaySampleData','attributes','previewParentYaml','open','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','columns','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Join\x20on:','stats','attributesFile','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','pullParentYaml','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','👥\x20','/\x20directory.\x0a','toFixed','Fetching\x20parent\x20segment\x20\x27','database','Updated','trim','Coverage:','segment:parent:run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','bold','dim','customerGroup','stop','2KGxrzU','\x20\x20\x20\x20-\x20','.yaml','Options\x20(one\x20required):\x0a','red','darwin','site','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Error\x20reading\x20file:\x20','Available\x20behaviors:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Fetching\x20sample\x20data...','label','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','parent_segment','format','audienceId','sort','xdg-open','status','totalEvents','scheduleOption','column','isDirectory','customerPercent','\x20No\x20changes\x20-\x20','List\x20available\x20fields\x20for\x20segmentation','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','varchar','green','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','setJobId','segment:parent:sql','List\x20parent\x20segments','displayMasterInfo','listParents','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20Context\x20set:\x20','schemaError','map','\x27\x20is\x20up\x20to\x20date','Available\x20attributes:','Aborted.','Error:\x20--database\x20and\x20--table\x20are\x20required','processedRows','/\x20→\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','data','endsWith','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Customers:','Validating\x20configuration...','query','ignore','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','output','addAttributes','displayPreviewResults','jobId','attribute','in\x20','using\x20the\x20default\x20path:\x20','segment:parent:preview','verbose','keys','956320tBJQEe','\x20kill','use','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Join:','Attempt:','\x20rows)','number','dirname','\x0aChanges\x20to\x20apply\x20to\x20\x27','string','Attribute:','/sessions/','Audience\x20ID:','Listing\x20parent\x20segments\x20matching\x20\x27','start','✔\x20Found\x20','Parent\x20segment:\x20','5umXkZr','Errors:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','YAML\x20file:\x20','log','\x20is\x20already\x20up\x20to\x20date','displayPreviewHints','SQL\x20query:\x0a','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','To\x20cancel:','getParentFull','/\x20directories\x20exist.','Name:\x20','✔\x20Updated\x20parent\x20segment\x20\x27','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','displayBehaviorsStats','127019SQzOsr','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','/app/dw/parentSegments/','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20is\x20already\x20up\x20to\x20date','Show\x20parent\x20segment\x20details','Table:\x20','1486768YBbtBk','text','Options:\x0a','apply','Fetching\x20SQL\x20for\x20\x27','displayValidateResults'];a22_0x43be=function(){return _0x128e6b;};return a22_0x43be();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x46c484 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x90b589){const _0x1eac77=a22_0x1b47,_0x221ae3=process[_0x1eac77(0x1ec)],_0x72578a=_0x221ae3===_0x1eac77(0x152)?_0x1eac77(0x265):_0x221ae3===_0x1eac77(0x22e)?'start':_0x1eac77(0x15f);spawn(_0x72578a,[_0x90b589],{'detached':!![],'stdio':_0x1eac77(0x182)})[_0x1eac77(0x1d9)]();}function migrateLegacyDirectory(){const _0x740725=a22_0x1b47;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5a69e0=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5a69e0[_0x740725(0x164)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a22_0x46c484['yellow'](_0x740725(0x1e5)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x740725(0x1ae))),console[_0x740725(0x1fc)](a22_0x46c484['dim'](_0x740725(0x26c)+LEGACY_PARENT_SEGMENT_DIR+_0x740725(0x272))),![];console[_0x740725(0x1fc)](a22_0x46c484[_0x740725(0x21d)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x740725(0x17a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a22_0x46c484[_0x740725(0x16a)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x554131){const _0x387041=_0x554131 instanceof Error?_0x554131['message']:String(_0x554131);return console[_0x740725(0x1fc)](a22_0x46c484[_0x740725(0x151)](_0x740725(0x26f)+_0x387041+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x31c158(0x1fe)](_0x1ab5f2){const _0x157bdf=a22_0x31c158;return migrateLegacyDirectory(),super[_0x157bdf(0x1fe)](_0x1ab5f2);}}function resolveYamlFile(_0x575da7){const _0x2db92c=a22_0x31c158;if(_0x575da7['endsWith']('.yml')||_0x575da7[_0x2db92c(0x17d)](_0x2db92c(0x281)))return _0x575da7;return a22_0x178d01[_0x2db92c(0x250)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x575da7)+_0x2db92c(0x259));}function formatProgressMessage(_0x323ba0){const _0x4b9f07=a22_0x31c158,_0x2d51e4=_0x323ba0['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2d51e4){const [,_0x1f1e3f,_0x59b78d,_0x485bcf='']=_0x2d51e4;return a22_0x46c484['dim'](_0x1f1e3f+':')+'\x20'+_0x59b78d+a22_0x46c484[_0x4b9f07(0x27c)](_0x485bcf);}return a22_0x46c484['dim'](_0x323ba0);}function showFileNotFoundError(_0x517506,_0x453648){const _0x1e2bbf=a22_0x31c158;console[_0x1e2bbf(0x1fc)](a22_0x46c484[_0x1e2bbf(0x151)]('Error:\x20File\x20not\x20found:\x20'+_0x517506+'\x0a')),console[_0x1e2bbf(0x1fc)](a22_0x46c484['cyan'](_0x1e2bbf(0x1d7)+_0x453648+_0x1e2bbf(0x23e)));}function showParentSegmentNotSetError(_0x52404a){const _0x2a6099=a22_0x31c158;console[_0x2a6099(0x1fc)](a22_0x46c484[_0x2a6099(0x21d)](_0x2a6099(0x154))),console[_0x2a6099(0x1fc)](_0x52404a);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x31c158(0x1ee);[a22_0x31c158(0x219)]=a22_0x31c158(0x16e);async[a22_0x31c158(0x246)](_0x16b9db){const _0x2e8cfb=a22_0x31c158,{options:_0xb44dba,args:_0x140add,tdx:_0x3d9b72}=_0x16b9db,_0x55e608=_0x140add[0x0];_0xb44dba[_0x2e8cfb(0x18c)]&&(console[_0x2e8cfb(0x1fc)](_0x2e8cfb(0x233)+_0xb44dba[_0x2e8cfb(0x153)]),_0x55e608&&console[_0x2e8cfb(0x1fc)]('Pattern:\x20'+_0x55e608));const _0xd500fe=await withSpinner(_0x55e608?_0x2e8cfb(0x19e)+_0x55e608+_0x2e8cfb(0x249):_0x2e8cfb(0x1f7),()=>_0x3d9b72[_0x2e8cfb(0x1d3)][_0x2e8cfb(0x170)](),{'verbose':_0xb44dba[_0x2e8cfb(0x18c)]});let _0x56bb13=_0xd500fe[_0x2e8cfb(0x17c)];if(_0x55e608){const _0x2b3d70=_0x55e608[_0x2e8cfb(0x235)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x2e8cfb(0x235)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x22283a=new RegExp('^'+_0x2b3d70+'$','i');_0x56bb13=_0x56bb13['filter'](_0x5b8ffc=>_0x22283a[_0x2e8cfb(0x228)](_0x5b8ffc[_0x2e8cfb(0x263)][_0x2e8cfb(0x226)]));}_0x56bb13[_0x2e8cfb(0x15e)]((_0x2300dc,_0x4c9e05)=>_0x2300dc[_0x2e8cfb(0x263)][_0x2e8cfb(0x226)][_0x2e8cfb(0x207)](_0x4c9e05[_0x2e8cfb(0x263)][_0x2e8cfb(0x226)])),console[_0x2e8cfb(0x1fc)](_0x2e8cfb(0x1a0)+_0x56bb13['length']+'\x20parent\x20segment'+(_0x56bb13[_0x2e8cfb(0x1f5)]!==0x1?'s':''));if(_0xb44dba[_0x2e8cfb(0x15c)]==='json'||_0xb44dba['format']==='jsonl')await handleSDKOutput(_0x56bb13,_0xb44dba);else{if(_0x56bb13[_0x2e8cfb(0x1f5)]===0x0)_0x55e608?console[_0x2e8cfb(0x1a6)](_0x2e8cfb(0x191)+_0x55e608):console[_0x2e8cfb(0x1a6)](_0x2e8cfb(0x25b));else for(const _0x40fcb6 of _0x56bb13){const _0x241606=_0x40fcb6['attributes'][_0x2e8cfb(0x1da)]?a22_0x46c484[_0x2e8cfb(0x27c)]('\x20('+formatRows(_0x40fcb6[_0x2e8cfb(0x263)]['population'])+')'):'';console['log'](_0x2e8cfb(0x271)+_0x40fcb6[_0x2e8cfb(0x263)]['name']+_0x241606);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x1c6);[a22_0x31c158(0x219)]=a22_0x31c158(0x25e);async['execute'](_0x4b85e1){const _0x270bce=a22_0x31c158,{options:_0xb1cc8b,args:_0x1a630e,tdx:_0xe52273}=_0x4b85e1;console[_0x270bce(0x1fc)](_0x270bce(0x1e0)+_0x270bce(0x1c1)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x17dd89=_0xb1cc8b;if(_0x1a630e['length']===0x0)return console['error'](a22_0x46c484[_0x270bce(0x151)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x270bce(0x16b)),0x1;const _0x4c37c8=_0x1a630e[0x0];if(!_0x17dd89[_0x270bce(0x275)]||!_0x17dd89[_0x270bce(0x240)])return console[_0x270bce(0x1fc)](_0x270bce(0x178)),console['error'](_0x270bce(0x16b)),0x1;_0x17dd89[_0x270bce(0x18c)]&&(console[_0x270bce(0x1fc)](_0x270bce(0x233)+_0x17dd89[_0x270bce(0x153)]),console[_0x270bce(0x1fc)](_0x270bce(0x1af)+_0x4c37c8),console[_0x270bce(0x1fc)]('Database:\x20'+_0x17dd89[_0x270bce(0x275)]),console['error'](_0x270bce(0x1ba)+_0x17dd89[_0x270bce(0x240)]));const _0xcbe80=await loadJSONFromOptions(_0x17dd89[_0x270bce(0x263)],_0x17dd89[_0x270bce(0x26b)]),_0x940ed0=await loadJSONFromOptions(_0x17dd89['behaviors'],_0x17dd89['behaviorsFile']),_0x2b9f34=await loadJSONFromOptions(_0x17dd89['customerGroup'],_0x17dd89[_0x270bce(0x1ed)]),_0x243f6b={'name':_0x4c37c8,'description':_0x17dd89['description'],'scheduleType':_0x17dd89[_0x270bce(0x232)],'scheduleOption':_0x17dd89[_0x270bce(0x162)],'timezone':_0x17dd89[_0x270bce(0x1d4)],'master':{'parentDatabaseName':_0x17dd89[_0x270bce(0x275)],'parentTableName':_0x17dd89[_0x270bce(0x240)]},'attributes':_0xcbe80,'behaviors':_0x940ed0,'customerGroup':_0x2b9f34},_0x33b20f=await withSpinner(_0x270bce(0x217)+_0x4c37c8+_0x270bce(0x249),()=>_0xe52273[_0x270bce(0x1d3)][_0x270bce(0x23f)](_0x243f6b),{'verbose':_0xb1cc8b[_0x270bce(0x18c)]}),_0x3ab254=_0x33b20f[_0x270bce(0x17c)];return console[_0x270bce(0x1fc)](_0x270bce(0x205)+_0x3ab254['name']+_0x270bce(0x215)+_0x3ab254['id']),await handleSDKOutput([_0x3ab254],_0xb1cc8b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x1c5);[a22_0x31c158(0x219)]=a22_0x31c158(0x1cb);async[a22_0x31c158(0x246)](_0x54520d){const _0x35c4e4=a22_0x31c158,{options:_0x4dbb24,args:_0x40d03f,tdx:_0x579d40}=_0x54520d;console[_0x35c4e4(0x1fc)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x35c4e4(0x1c1)+_0x35c4e4(0x225));const _0x17874f=_0x4dbb24;if(_0x40d03f[_0x35c4e4(0x1f5)]===0x0)return console[_0x35c4e4(0x1fc)](a22_0x46c484[_0x35c4e4(0x151)](_0x35c4e4(0x22a))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x4a274b=_0x40d03f[0x0];_0x17874f[_0x35c4e4(0x18c)]&&(console['error'](_0x35c4e4(0x233)+_0x17874f['site']),console[_0x35c4e4(0x1fc)](_0x35c4e4(0x1a1)+_0x4a274b));const _0x554fc4=await withSpinner(_0x35c4e4(0x201)+_0x4a274b+_0x35c4e4(0x249),()=>_0x579d40[_0x35c4e4(0x1d3)][_0x35c4e4(0x1ad)](_0x4a274b),{'verbose':_0x17874f[_0x35c4e4(0x18c)]}),_0x5b8dea=_0x554fc4[_0x35c4e4(0x17c)],_0x5501e1=await loadJSONFromOptions(_0x17874f[_0x35c4e4(0x185)],_0x17874f['addAttributesFile']),_0x4b056d=await loadJSONFromOptions(_0x17874f['addBehaviors'],_0x17874f[_0x35c4e4(0x209)]),_0x5789ad={'name':_0x5b8dea[_0x35c4e4(0x226)],'description':_0x17874f[_0x35c4e4(0x219)]!==undefined?_0x17874f[_0x35c4e4(0x219)]:_0x5b8dea['description'],'scheduleType':_0x17874f[_0x35c4e4(0x232)]!==undefined?_0x17874f[_0x35c4e4(0x232)]:_0x5b8dea[_0x35c4e4(0x232)],'scheduleOption':_0x17874f[_0x35c4e4(0x162)]!==undefined?_0x17874f[_0x35c4e4(0x162)]:_0x5b8dea[_0x35c4e4(0x162)],'timezone':_0x17874f[_0x35c4e4(0x1d4)]!==undefined?_0x17874f[_0x35c4e4(0x1d4)]:_0x5b8dea[_0x35c4e4(0x1d4)],'master':_0x5b8dea[_0x35c4e4(0x20d)],'attributes':_0x5501e1?[..._0x5b8dea[_0x35c4e4(0x263)]||[],..._0x5501e1]:_0x5b8dea[_0x35c4e4(0x263)],'behaviors':_0x4b056d?[..._0x5b8dea['behaviors']||[],..._0x4b056d]:_0x5b8dea['behaviors'],'customerGroup':_0x5b8dea[_0x35c4e4(0x27d)]},_0x573025=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x4a274b+_0x35c4e4(0x249),()=>_0x579d40['segment'][_0x35c4e4(0x252)](_0x4a274b,_0x5789ad),{'verbose':_0x17874f['verbose']}),_0x586f3f=_0x573025[_0x35c4e4(0x17c)];return console['error'](_0x35c4e4(0x1b0)+_0x586f3f[_0x35c4e4(0x226)]+'\x27'),await handleSDKOutput([_0x586f3f],_0x17874f),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x218);[a22_0x31c158(0x219)]=a22_0x31c158(0x24e);async[a22_0x31c158(0x246)](_0x576f05){const _0x159a7f=a22_0x31c158,{options:_0x48812d,args:_0x5e0ec7,tdx:_0x581301}=_0x576f05,_0x2005fc=_0x48812d,_0x335161=_0x5e0ec7[0x0]||_0x48812d[_0x159a7f(0x222)];if(!_0x335161)return showParentSegmentNotSetError(_0x159a7f(0x216)+_0x159a7f(0x223)),0x1;if(_0x2005fc[_0x159a7f(0x190)]&&_0x2005fc[_0x159a7f(0x184)])return console['error'](a22_0x46c484['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x159a7f(0x1fc)](a22_0x46c484[_0x159a7f(0x27c)](_0x159a7f(0x1f1))),console['error'](a22_0x46c484[_0x159a7f(0x27c)](_0x159a7f(0x18a)+PARENT_SEGMENT_DIR+_0x159a7f(0x25f))),console[_0x159a7f(0x1fc)](a22_0x46c484[_0x159a7f(0x231)](_0x159a7f(0x230))),0x1;const _0x5f4dc3=_0x2005fc[_0x159a7f(0x184)]||a22_0x178d01['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x335161)+_0x159a7f(0x259));_0x2005fc[_0x159a7f(0x18c)]&&(console['error'](_0x159a7f(0x233)+_0x2005fc[_0x159a7f(0x153)]),console[_0x159a7f(0x1fc)](_0x159a7f(0x1a1)+_0x335161),console[_0x159a7f(0x1fc)](_0x159a7f(0x258)+_0x5f4dc3));const _0x37891e=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x335161+_0x159a7f(0x249),()=>_0x581301[_0x159a7f(0x1d3)][_0x159a7f(0x26e)](_0x335161),{'verbose':_0x2005fc[_0x159a7f(0x18c)]}),_0x5b85d7=_0x37891e[_0x159a7f(0x17c)];if(existsSync(_0x5f4dc3)){const _0x219257=readFileSync(_0x5f4dc3,_0x159a7f(0x1e2)),_0x26fa12=generateDiff(_0x219257,_0x5b85d7);if(!hasChanges(_0x26fa12))console['error'](a22_0x46c484[_0x159a7f(0x16a)]('✔')+_0x159a7f(0x166)+a22_0x46c484['cyan'](_0x5f4dc3)+_0x159a7f(0x1a7));else{console[_0x159a7f(0x1fc)](_0x159a7f(0x1ff)+_0x5f4dc3+'\x27:'),console['error']('─'[_0x159a7f(0x213)](0x3c)),console[_0x159a7f(0x1fc)](formatDiffWithColors(_0x26fa12)),console[_0x159a7f(0x1fc)]('─'['repeat'](0x3c));if(!_0x2005fc[_0x159a7f(0x256)]){const _0x34ba96=await confirmKey('Overwrite\x20\x27'+_0x5f4dc3+'\x27?');if(!_0x34ba96)return console['error']('Aborted.'),0x1;}writeFileSync(_0x5f4dc3,_0x5b85d7,_0x159a7f(0x1e2)),console[_0x159a7f(0x1fc)](a22_0x46c484[_0x159a7f(0x16a)]('✔')+_0x159a7f(0x270)+a22_0x46c484['cyan'](_0x5f4dc3));}}else{const _0x227d3d=a22_0x178d01[_0x159a7f(0x198)](_0x5f4dc3);!existsSync(_0x227d3d)&&mkdirSync(_0x227d3d,{'recursive':!![]}),writeFileSync(_0x5f4dc3,_0x5b85d7,_0x159a7f(0x1e2)),console[_0x159a7f(0x1fc)](a22_0x46c484[_0x159a7f(0x16a)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x46c484[_0x159a7f(0x231)](_0x5f4dc3));}return saveSessionContext({'parent_segment':_0x335161},_0x2005fc[_0x159a7f(0x1ea)]),console[_0x159a7f(0x1fc)](a22_0x46c484[_0x159a7f(0x16a)]('✔')+_0x159a7f(0x172)+a22_0x46c484['dim'](_0x159a7f(0x15b))+_0x159a7f(0x221)+a22_0x46c484[_0x159a7f(0x231)](_0x335161)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a22_0x31c158(0x1cc);[a22_0x31c158(0x219)]=a22_0x31c158(0x1b1);async['execute'](_0x3721f2){const _0x45607d=a22_0x31c158,{options:_0x3abab0,args:_0x2ae4d8,tdx:_0x4aef8f}=_0x3721f2,_0x5ecb9d=_0x3abab0,_0x297a99=_0x2ae4d8[0x0]||_0x3abab0[_0x45607d(0x222)];if(!_0x297a99)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'+_0x45607d(0x224)),0x1;const _0x3ac6d9=resolveYamlFile(_0x297a99);if(!existsSync(_0x3ac6d9))return showFileNotFoundError(_0x3ac6d9,_0x297a99),0x1;_0x5ecb9d['verbose']&&(console['error'](_0x45607d(0x233)+_0x5ecb9d[_0x45607d(0x153)]),console['error'](_0x45607d(0x1a5)+_0x3ac6d9));let _0x37ae9c;try{_0x37ae9c=readFileSync(_0x3ac6d9,'utf-8');}catch(_0x12268c){const _0x4f3ce2=_0x12268c instanceof Error?_0x12268c[_0x45607d(0x20c)]:String(_0x12268c);return console['error'](_0x45607d(0x155)+_0x4f3ce2),0x1;}const _0x5e9350=await withSpinner('Analyzing\x20changes...',()=>_0x4aef8f[_0x45607d(0x1d3)][_0x45607d(0x1f2)](_0x37ae9c),{'verbose':_0x5ecb9d['verbose']}),_0x1fa4f7=_0x5e9350[_0x45607d(0x17c)],{isNew:_0x54fe1f,name:_0x12f247,hasChanges:_0x47196f,diffFormatted:_0x1322c6}=_0x1fa4f7;if(!_0x47196f)return console['error'](_0x45607d(0x243)+_0x12f247+_0x45607d(0x1b8)),0x0;_0x54fe1f?console[_0x45607d(0x1fc)](_0x45607d(0x20f)+_0x12f247+'\x27:'):console[_0x45607d(0x1fc)](_0x45607d(0x199)+_0x12f247+'\x27:');console[_0x45607d(0x1fc)]('─'[_0x45607d(0x213)](0x3c)),console[_0x45607d(0x1fc)](_0x1322c6),console[_0x45607d(0x1fc)]('─'[_0x45607d(0x213)](0x3c));const _0x2ffcdb=_0x54fe1f?_0x45607d(0x202)+_0x12f247+'\x27?':_0x45607d(0x1cf)+_0x12f247+'\x27?';if(!_0x5ecb9d[_0x45607d(0x256)]){const _0x5e791b=await confirmKey(_0x2ffcdb);if(!_0x5e791b)return console['error'](_0x45607d(0x177)),0x1;}const _0x142bfa=_0x54fe1f?_0x45607d(0x1eb):_0x45607d(0x1f3),_0x43503d=await withSpinner(_0x142bfa+_0x45607d(0x20e)+_0x12f247+'\x27...',()=>_0x1fa4f7[_0x45607d(0x1be)](),{'verbose':_0x5ecb9d[_0x45607d(0x18c)]}),_0x560214=_0x43503d['data'],_0x3defdb=getConsoleNextUrl(_0x5ecb9d[_0x45607d(0x153)],_0x45607d(0x1b5)+_0x560214['id']),_0xc86683=_0x54fe1f?_0x45607d(0x206):_0x45607d(0x276);return console[_0x45607d(0x1fc)]('✔\x20'+_0xc86683+_0x45607d(0x20e)+_0x560214['name']+'\x27'),console[_0x45607d(0x1fc)]('\x20\x20'+_0x3defdb),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x31c158(0x226)]='segment:parent:validate';[a22_0x31c158(0x219)]=a22_0x31c158(0x1cd);async[a22_0x31c158(0x246)](_0x1c0a68){const _0x1271dc=a22_0x31c158,{options:_0x5dec93,args:_0x4d7220,tdx:_0x4b5e3a}=_0x1c0a68,_0x23c334=_0x5dec93,_0x31ea9c=_0x4d7220[0x0]||_0x5dec93[_0x1271dc(0x222)];if(!_0x31ea9c)return showParentSegmentNotSetError(_0x1271dc(0x23d)+_0x1271dc(0x168)+_0x1271dc(0x1bd)+_0x1271dc(0x1b6)+_0x1271dc(0x17b)+_0x1271dc(0x211)),0x1;const _0x15a74c=resolveYamlFile(_0x31ea9c);if(!existsSync(_0x15a74c))return showFileNotFoundError(_0x15a74c,_0x31ea9c),0x1;_0x23c334[_0x1271dc(0x18c)]&&(console['error'](_0x1271dc(0x233)+_0x23c334[_0x1271dc(0x153)]),console[_0x1271dc(0x1fc)](_0x1271dc(0x1a5)+_0x15a74c));let _0x374985;try{_0x374985=readFileSync(_0x15a74c,'utf-8');}catch(_0x4d363a){const _0x551aee=_0x4d363a instanceof Error?_0x4d363a[_0x1271dc(0x20c)]:String(_0x4d363a);return console[_0x1271dc(0x1fc)](_0x1271dc(0x155)+_0x551aee),0x1;}const _0x1ca807=createCommandSpinner(a22_0x46c484['dim'](_0x1271dc(0x180)),{'verbose':_0x23c334[_0x1271dc(0x18c)]});_0x1ca807[_0x1271dc(0x19f)]();const _0x1f39a9={'onProgress':_0x4d5325=>{const _0x4957b4=_0x1271dc;_0x1ca807[_0x4957b4(0x1bc)]=formatProgressMessage(_0x4d5325);}};if(_0x23c334['master'])_0x1f39a9['master']=!![];if(_0x23c334[_0x1271dc(0x251)])_0x1f39a9['enriched']=!![];_0x23c334[_0x1271dc(0x188)]&&(_0x1f39a9[_0x1271dc(0x188)]=_0x23c334[_0x1271dc(0x188)]);_0x23c334[_0x1271dc(0x227)]&&(_0x1f39a9[_0x1271dc(0x227)]=_0x23c334[_0x1271dc(0x227)]);if(_0x23c334[_0x1271dc(0x242)])_0x1f39a9[_0x1271dc(0x242)]=_0x23c334[_0x1271dc(0x242)];let _0x5db820;try{_0x5db820=await _0x4b5e3a['segment']['validateParentYaml'](_0x374985,_0x1f39a9),_0x1ca807[_0x1271dc(0x27e)]();}catch(_0x271206){_0x1ca807[_0x1271dc(0x27e)]();throw _0x271206;}const _0x365fef=_0x23c334[_0x1271dc(0x242)]||_0x1271dc(0x1c4);return this[_0x1271dc(0x1c0)](_0x5db820,_0x1f39a9,_0x15a74c,_0x365fef),_0x5db820[_0x1271dc(0x241)]?0x0:0x1;}[a22_0x31c158(0x1c0)](_0xa22fdc,_0x325515,_0x54717b,_0x161499){const _0x42751f=a22_0x31c158;console[_0x42751f(0x1fc)]('\x0a'+a22_0x46c484['bold'](_0x42751f(0x23a))+'\x20'+_0xa22fdc[_0x42751f(0x226)]),console[_0x42751f(0x1fc)]('═'['repeat'](0x3c)),this[_0x42751f(0x16f)](_0xa22fdc);if(typeof _0x325515[_0x42751f(0x188)]===_0x42751f(0x19a)){this[_0x42751f(0x220)](_0xa22fdc),this[_0x42751f(0x200)](_0xa22fdc),this[_0x42751f(0x1a8)](_0x54717b,_0x161499,_0x42751f(0x188),_0x325515[_0x42751f(0x188)]);return;}if(_0x325515['attribute']===!![]){this[_0x42751f(0x220)](_0xa22fdc),this[_0x42751f(0x200)](_0xa22fdc),this['displayPreviewHints'](_0x54717b,_0x161499,_0x42751f(0x263));return;}if(typeof _0x325515['behavior']===_0x42751f(0x19a)){this[_0x42751f(0x1b2)](_0xa22fdc,_0x161499),this[_0x42751f(0x200)](_0xa22fdc),this[_0x42751f(0x1a8)](_0x54717b,_0x161499,_0x42751f(0x227),_0x325515['behavior']);return;}if(_0x325515['behavior']===!![]){this['displayBehaviorsStats'](_0xa22fdc,_0x161499),this['displaySummary'](_0xa22fdc),this[_0x42751f(0x1a8)](_0x54717b,_0x161499,_0x42751f(0x1d2));return;}this[_0x42751f(0x220)](_0xa22fdc),this[_0x42751f(0x1b2)](_0xa22fdc,_0x161499),this[_0x42751f(0x200)](_0xa22fdc),this['displayPreviewHints'](_0x54717b,_0x161499,_0x42751f(0x21b));}[a22_0x31c158(0x1a8)](_0x3a2692,_0x21bc55,_0x624a12,_0x48e3da){const _0x316b07=a22_0x31c158;console[_0x316b07(0x1fc)]('\x0a'+a22_0x46c484[_0x316b07(0x27c)](_0x316b07(0x1de)));const _0x53aca3=_0x21bc55!=='-1d'?_0x316b07(0x253)+_0x21bc55:'';if(_0x624a12==='attribute'&&_0x48e3da)console[_0x316b07(0x1fc)]('\x20\x20'+a22_0x46c484[_0x316b07(0x27c)](_0x316b07(0x24c)+_0x3a2692+'\x20--attribute\x20\x22'+_0x48e3da+'\x22'+_0x53aca3));else{if(_0x624a12===_0x316b07(0x227)&&_0x48e3da)console[_0x316b07(0x1fc)]('\x20\x20'+a22_0x46c484[_0x316b07(0x27c)]('tdx\x20segment\x20parent\x20preview\x20'+_0x3a2692+_0x316b07(0x24d)+_0x48e3da+'\x22'+_0x53aca3));else(_0x624a12===_0x316b07(0x263)||_0x624a12===_0x316b07(0x21b))&&console[_0x316b07(0x1fc)]('\x20\x20'+a22_0x46c484['dim'](_0x316b07(0x24c)+_0x3a2692+'\x20--attribute\x20\x22<name>\x22'+_0x53aca3));}(_0x624a12===_0x316b07(0x1d2)||_0x624a12==='all')&&console[_0x316b07(0x1fc)]('\x20\x20'+a22_0x46c484[_0x316b07(0x27c)]('tdx\x20segment\x20parent\x20preview\x20'+_0x3a2692+'\x20--behavior\x20\x22<name>\x22'+_0x53aca3)),_0x624a12===_0x316b07(0x21b)&&console['error']('\x20\x20'+a22_0x46c484['dim'](_0x316b07(0x24c)+_0x3a2692+'\x20--enriched'+_0x53aca3));}[a22_0x31c158(0x16f)](_0xdd8d4f){const _0x281be2=a22_0x31c158,{master:_0x41e39e}=_0xdd8d4f,_0x41e48e=_0x41e39e[_0x281be2(0x20b)]?a22_0x46c484['green']('✔'):a22_0x46c484['red']('✘');console[_0x281be2(0x1fc)]('\x0a'+a22_0x46c484[_0x281be2(0x27c)](_0x281be2(0x24b))),console[_0x281be2(0x1fc)](_0x41e48e+'\x20'+a22_0x46c484[_0x281be2(0x27b)](_0x41e39e['database']+'.'+_0x41e39e[_0x281be2(0x240)])),_0x41e39e[_0x281be2(0x20b)]?_0x41e39e['rowCount']!==undefined&&console[_0x281be2(0x1fc)]('\x20\x20'+a22_0x46c484[_0x281be2(0x27c)](_0x281be2(0x203))+'\x20'+a22_0x46c484[_0x281be2(0x231)](formatRows(_0x41e39e['rowCount']))):console['error']('\x20\x20'+a22_0x46c484[_0x281be2(0x151)](_0x281be2(0x255))+'\x20'+_0x41e39e[_0x281be2(0x173)]);}[a22_0x31c158(0x220)](_0x147da6){const _0x11e977=a22_0x31c158;if(_0x147da6[_0x11e977(0x263)][_0x11e977(0x1f5)]===0x0)return;console[_0x11e977(0x1fc)]('\x0a'+a22_0x46c484[_0x11e977(0x27c)](_0x11e977(0x23c)));for(const _0x42478f of _0x147da6[_0x11e977(0x263)]){const _0x839f9d=_0x42478f[_0x11e977(0x20b)]?a22_0x46c484[_0x11e977(0x16a)]('✔'):a22_0x46c484[_0x11e977(0x151)]('✘');let _0x350bbc='';if(_0x42478f[_0x11e977(0x20b)]&&_0x42478f[_0x11e977(0x212)]!==undefined&&_0x42478f[_0x11e977(0x1f4)]!==undefined){const _0x5da784=_0x42478f['coveragePercent']['toFixed'](0x1),_0x542df3=_0x42478f[_0x11e977(0x1f4)]>=0x50?a22_0x46c484[_0x11e977(0x16a)]:_0x42478f[_0x11e977(0x1f4)]>=0x32?a22_0x46c484[_0x11e977(0x21d)]:a22_0x46c484[_0x11e977(0x151)];_0x350bbc='\x20'+a22_0x46c484['dim'](_0x11e977(0x278))+'\x20'+_0x542df3(_0x5da784+'%')+'\x20('+formatRows(_0x42478f[_0x11e977(0x212)])+_0x11e977(0x196);}console[_0x11e977(0x1fc)](_0x839f9d+'\x20'+a22_0x46c484[_0x11e977(0x27b)](_0x42478f[_0x11e977(0x226)])+_0x350bbc),console[_0x11e977(0x1fc)]('\x20\x20'+a22_0x46c484[_0x11e977(0x27c)](_0x11e977(0x1d8))+'\x20'+a22_0x46c484['bold'](_0x42478f['database']+'.'+_0x42478f[_0x11e977(0x240)]));const _0x1d8439=_0x42478f['joinKey']===_0x42478f[_0x11e977(0x244)]?a22_0x46c484[_0x11e977(0x27c)](_0x11e977(0x269))+'\x20'+_0x42478f['joinKey']:a22_0x46c484[_0x11e977(0x27c)](_0x11e977(0x194))+'\x20'+_0x42478f[_0x11e977(0x257)]+_0x11e977(0x221)+_0x42478f[_0x11e977(0x244)];console[_0x11e977(0x1fc)]('\x20\x20'+_0x1d8439),console['error']('\x20\x20'+a22_0x46c484[_0x11e977(0x27c)](_0x11e977(0x22f))),this['displayColumns'](_0x42478f[_0x11e977(0x267)]),!_0x42478f['schemaValid']&&console[_0x11e977(0x1fc)]('\x20\x20'+a22_0x46c484[_0x11e977(0x151)](_0x11e977(0x255))+'\x20'+_0x42478f[_0x11e977(0x173)]);}}[a22_0x31c158(0x1b2)](_0x59c4e0,_0x5555a0){const _0x52d903=a22_0x31c158;if(_0x59c4e0[_0x52d903(0x1d2)][_0x52d903(0x1f5)]===0x0)return;console['error']('\x0a'+a22_0x46c484['dim']('Behaviors')+'\x20'+a22_0x46c484[_0x52d903(0x27c)]('('+_0x5555a0+')'));for(const _0x7d70b of _0x59c4e0[_0x52d903(0x1d2)]){const _0x100e2a=_0x7d70b[_0x52d903(0x20b)]?a22_0x46c484['green']('✔'):a22_0x46c484['red']('✘');let _0x85562c='';if(_0x7d70b[_0x52d903(0x20b)]&&_0x7d70b[_0x52d903(0x1e3)]!==undefined&&_0x7d70b[_0x52d903(0x161)]!==undefined){const _0x30872c=_0x7d70b[_0x52d903(0x165)]?.[_0x52d903(0x273)](0x1)||'?',_0x438d62=(_0x7d70b[_0x52d903(0x165)]??0x0)>=0x32?a22_0x46c484[_0x52d903(0x16a)]:(_0x7d70b[_0x52d903(0x165)]??0x0)>=0x14?a22_0x46c484['yellow']:a22_0x46c484[_0x52d903(0x151)];_0x85562c='\x20'+a22_0x46c484['dim'](_0x52d903(0x17f))+'\x20'+_0x438d62(formatRows(_0x7d70b[_0x52d903(0x1e3)]))+'\x20('+_0x30872c+_0x52d903(0x20a)+a22_0x46c484[_0x52d903(0x27c)](_0x52d903(0x25a))+'\x20'+a22_0x46c484[_0x52d903(0x231)](formatRows(_0x7d70b[_0x52d903(0x161)]));}console[_0x52d903(0x1fc)](_0x100e2a+'\x20'+a22_0x46c484[_0x52d903(0x27b)](_0x7d70b[_0x52d903(0x226)])+_0x85562c),console['error']('\x20\x20'+a22_0x46c484['dim'](_0x52d903(0x1d8))+'\x20'+a22_0x46c484[_0x52d903(0x27b)](_0x7d70b[_0x52d903(0x275)]+'.'+_0x7d70b[_0x52d903(0x240)]));const _0x32c61d=_0x7d70b['joinKey']===_0x7d70b[_0x52d903(0x244)]?a22_0x46c484[_0x52d903(0x27c)]('Join\x20on:')+'\x20'+_0x7d70b[_0x52d903(0x257)]:a22_0x46c484['dim'](_0x52d903(0x194))+'\x20'+_0x7d70b['joinKey']+'\x20=\x20'+_0x7d70b[_0x52d903(0x244)];console[_0x52d903(0x1fc)]('\x20\x20'+_0x32c61d),console[_0x52d903(0x1fc)]('\x20\x20'+a22_0x46c484[_0x52d903(0x27c)](_0x52d903(0x22f))),this[_0x52d903(0x25d)](_0x7d70b[_0x52d903(0x267)]),!_0x7d70b[_0x52d903(0x20b)]&&console[_0x52d903(0x1fc)]('\x20\x20'+a22_0x46c484[_0x52d903(0x151)](_0x52d903(0x255))+'\x20'+_0x7d70b[_0x52d903(0x173)]);}}[a22_0x31c158(0x25d)](_0x4f9682){const _0x13b24a=a22_0x31c158;for(const _0x5f8222 of _0x4f9682){_0x5f8222[_0x13b24a(0x159)]===_0x5f8222[_0x13b24a(0x163)]||_0x5f8222['column']==='*'?console[_0x13b24a(0x1fc)](_0x13b24a(0x280)+_0x5f8222[_0x13b24a(0x159)]):console['error'](_0x13b24a(0x280)+_0x5f8222[_0x13b24a(0x159)]+'\x20'+a22_0x46c484[_0x13b24a(0x27c)]('('+_0x5f8222[_0x13b24a(0x163)]+')'));}}[a22_0x31c158(0x200)](_0x1893c7){const _0x5933c8=a22_0x31c158;console[_0x5933c8(0x1fc)]('─'[_0x5933c8(0x213)](0x3c));if(_0x1893c7[_0x5933c8(0x1d6)]['length']>0x0){console['error']('\x0a'+a22_0x46c484['red']('Errors:'));for(const _0x33d0c6 of _0x1893c7[_0x5933c8(0x1d6)]){console['error']('\x20\x20'+a22_0x46c484['red']('•')+'\x20'+_0x33d0c6);}}_0x1893c7[_0x5933c8(0x241)]&&console[_0x5933c8(0x1fc)]('\x0a'+a22_0x46c484[_0x5933c8(0x16a)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x18b);[a22_0x31c158(0x219)]=a22_0x31c158(0x1e4);async[a22_0x31c158(0x246)](_0xa01374){const _0xdab0ea=a22_0x31c158,{options:_0xc11da5,args:_0x41d45f,tdx:_0x425a42}=_0xa01374,_0x2d39bc=_0xc11da5,_0x320fb7=_0x41d45f[0x0]||_0xc11da5[_0xdab0ea(0x222)];if(!_0x320fb7)return showParentSegmentNotSetError(_0xdab0ea(0x1fb)+_0xdab0ea(0x21f)+_0xdab0ea(0x150)+_0xdab0ea(0x192)+_0xdab0ea(0x1ce)+_0xdab0ea(0x1c9)+_0xdab0ea(0x1db)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2d39bc['master']&&!_0x2d39bc[_0xdab0ea(0x188)]&&!_0x2d39bc[_0xdab0ea(0x227)]&&!_0x2d39bc['enriched'])return console['error'](a22_0x46c484[_0xdab0ea(0x151)](_0xdab0ea(0x193))),console['error'](_0xdab0ea(0x1ab)),console[_0xdab0ea(0x1fc)](_0xdab0ea(0x260)),console['error'](_0xdab0ea(0x238)),console['error'](_0xdab0ea(0x157)),console[_0xdab0ea(0x1fc)](_0xdab0ea(0x183)),console[_0xdab0ea(0x1fc)](_0xdab0ea(0x15a)),0x1;const _0x40d5cb=resolveYamlFile(_0x320fb7);if(!existsSync(_0x40d5cb))return showFileNotFoundError(_0x40d5cb,_0x320fb7),0x1;_0x2d39bc[_0xdab0ea(0x18c)]&&(console[_0xdab0ea(0x1fc)](_0xdab0ea(0x233)+_0x2d39bc[_0xdab0ea(0x153)]),console[_0xdab0ea(0x1fc)](_0xdab0ea(0x1a5)+_0x40d5cb));let _0x4018e6;try{_0x4018e6=readFileSync(_0x40d5cb,_0xdab0ea(0x1e2));}catch(_0x1579c5){const _0x2e3319=_0x1579c5 instanceof Error?_0x1579c5[_0xdab0ea(0x20c)]:String(_0x1579c5);return console[_0xdab0ea(0x1fc)](_0xdab0ea(0x155)+_0x2e3319),0x1;}let _0x301839;try{_0x301839=parseDef(_0x4018e6);}catch(_0x163c01){const _0x5340b8=_0x163c01 instanceof Error?_0x163c01[_0xdab0ea(0x20c)]:String(_0x163c01);return console['error'](a22_0x46c484[_0xdab0ea(0x151)](_0xdab0ea(0x237)+_0x5340b8)),0x1;}if(_0x2d39bc[_0xdab0ea(0x188)]===!![]||_0x2d39bc['attribute']===''){const _0x5d82ac=_0x301839['attributes']?.[_0xdab0ea(0x174)](_0x64fb00=>_0x64fb00[_0xdab0ea(0x226)])||[];if(_0x5d82ac['length']===0x0)console[_0xdab0ea(0x1fc)](a22_0x46c484[_0xdab0ea(0x151)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0xdab0ea(0x1fc)](a22_0x46c484[_0xdab0ea(0x151)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0xdab0ea(0x176));for(const _0x5748f7 of _0x5d82ac){console[_0xdab0ea(0x1fc)]('\x20\x20'+a22_0x46c484[_0xdab0ea(0x231)](_0x5748f7));}console[_0xdab0ea(0x1fc)](_0xdab0ea(0x1b7)+_0x320fb7+_0xdab0ea(0x1f0)+_0x5d82ac[0x0]+'\x22');}return 0x1;}if(_0x2d39bc['behavior']===!![]||_0x2d39bc['behavior']===''){const _0x5c8dc1=_0x301839['behaviors']?.[_0xdab0ea(0x174)](_0x487bc1=>_0x487bc1['name'])||[];if(_0x5c8dc1[_0xdab0ea(0x1f5)]===0x0)console[_0xdab0ea(0x1fc)](a22_0x46c484[_0xdab0ea(0x151)](_0xdab0ea(0x266)));else{console[_0xdab0ea(0x1fc)](a22_0x46c484[_0xdab0ea(0x151)](_0xdab0ea(0x1e7))),console[_0xdab0ea(0x1fc)](_0xdab0ea(0x156));for(const _0x1b7cf2 of _0x5c8dc1){console[_0xdab0ea(0x1fc)]('\x20\x20'+a22_0x46c484[_0xdab0ea(0x231)](_0x1b7cf2));}console[_0xdab0ea(0x1fc)](_0xdab0ea(0x1b7)+_0x320fb7+_0xdab0ea(0x24d)+_0x5c8dc1[0x0]+'\x22');}return 0x1;}const _0x4657fe=createCommandSpinner(a22_0x46c484[_0xdab0ea(0x27c)](_0xdab0ea(0x158)),{'verbose':_0x2d39bc['verbose']});_0x4657fe[_0xdab0ea(0x19f)]();const _0x360a64={'onProgress':_0x2e4fdb=>{const _0x4ba956=_0xdab0ea;_0x4657fe[_0x4ba956(0x1bc)]=formatProgressMessage(_0x2e4fdb);}};if(_0x2d39bc[_0xdab0ea(0x20d)])_0x360a64[_0xdab0ea(0x20d)]=!![];if(_0x2d39bc[_0xdab0ea(0x188)]&&typeof _0x2d39bc['attribute']===_0xdab0ea(0x19a))_0x360a64['attribute']=_0x2d39bc['attribute'];if(_0x2d39bc[_0xdab0ea(0x227)]&&typeof _0x2d39bc['behavior']===_0xdab0ea(0x19a))_0x360a64[_0xdab0ea(0x227)]=_0x2d39bc[_0xdab0ea(0x227)];if(_0x2d39bc[_0xdab0ea(0x251)])_0x360a64[_0xdab0ea(0x251)]=!![];if(_0x2d39bc[_0xdab0ea(0x242)])_0x360a64[_0xdab0ea(0x242)]=_0x2d39bc[_0xdab0ea(0x242)];let _0x4c1102;try{_0x4c1102=await _0x425a42[_0xdab0ea(0x1d3)][_0xdab0ea(0x264)](_0x4018e6,_0x360a64),_0x4657fe['stop']();}catch(_0x5d1852){_0x4657fe[_0xdab0ea(0x27e)]();throw _0x5d1852;}return await this[_0xdab0ea(0x186)](_0x4c1102,{'master':_0x2d39bc[_0xdab0ea(0x20d)],'attribute':typeof _0x2d39bc[_0xdab0ea(0x188)]===_0xdab0ea(0x19a)?_0x2d39bc[_0xdab0ea(0x188)]:undefined,'behavior':typeof _0x2d39bc['behavior']===_0xdab0ea(0x19a)?_0x2d39bc['behavior']:undefined,'enriched':_0x2d39bc['enriched']}),_0x4c1102[_0xdab0ea(0x241)]?0x0:0x1;}async[a22_0x31c158(0x186)](_0x5da626,_0x52831d){const _0x4d9b73=a22_0x31c158;console['error']('\x0a'+a22_0x46c484['bold'](_0x4d9b73(0x1dc))+'\x20'+_0x5da626[_0x4d9b73(0x226)]),console[_0x4d9b73(0x1fc)]('═'['repeat'](0x3c));if(_0x52831d[_0x4d9b73(0x20d)]&&_0x5da626[_0x4d9b73(0x234)]){const _0x46d374=a22_0x46c484['dim'](_0x4d9b73(0x1df))+'\x20'+a22_0x46c484[_0x4d9b73(0x27b)](_0x5da626[_0x4d9b73(0x20d)][_0x4d9b73(0x275)]+'.'+_0x5da626['master'][_0x4d9b73(0x240)]);await this[_0x4d9b73(0x262)](_0x46d374,_0x5da626[_0x4d9b73(0x234)]);}else{if(_0x52831d[_0x4d9b73(0x188)]&&_0x5da626['sampleData']){const _0x4247c8=a22_0x46c484['dim'](_0x4d9b73(0x19b))+'\x20'+a22_0x46c484['bold'](_0x52831d[_0x4d9b73(0x188)]);await this[_0x4d9b73(0x262)](_0x4247c8,_0x5da626['sampleData']);}else{if(_0x52831d[_0x4d9b73(0x227)]&&_0x5da626[_0x4d9b73(0x234)]){const _0x24bdc0=a22_0x46c484[_0x4d9b73(0x27c)]('Behavior:')+'\x20'+a22_0x46c484[_0x4d9b73(0x27b)](_0x52831d[_0x4d9b73(0x227)]);await this[_0x4d9b73(0x262)](_0x24bdc0,_0x5da626['sampleData']);}else{if(_0x52831d[_0x4d9b73(0x251)]&&_0x5da626['sampleData']){const _0x43ab59=a22_0x46c484['dim'](_0x4d9b73(0x248))+'\x20'+a22_0x46c484[_0x4d9b73(0x27b)]('Master\x20+\x20Attributes');await this[_0x4d9b73(0x262)](_0x43ab59,_0x5da626[_0x4d9b73(0x234)]);}else!_0x5da626[_0x4d9b73(0x234)]&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5da626['errors']['length']>0x0){console[_0x4d9b73(0x1fc)]('─'[_0x4d9b73(0x213)](0x3c)),console[_0x4d9b73(0x1fc)]('\x0a'+a22_0x46c484[_0x4d9b73(0x151)](_0x4d9b73(0x1a3)));for(const _0x1e52e3 of _0x5da626[_0x4d9b73(0x1d6)]){console[_0x4d9b73(0x1fc)]('\x20\x20'+a22_0x46c484[_0x4d9b73(0x151)]('•')+'\x20'+_0x1e52e3);}}}async['displaySampleData'](_0x552f5c,_0xb68f77){const _0x15272b=a22_0x31c158;if(_0xb68f77['length']===0x0){console[_0x15272b(0x1fc)]('\x0a'+_0x552f5c),console[_0x15272b(0x1fc)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x15272b(0x1fc)]('\x0a'+_0x552f5c);const _0x3ac481=Object[_0x15272b(0x18d)](_0xb68f77[0x0])[_0x15272b(0x174)](_0xca204f=>({'name':_0xca204f,'type':typeof _0xb68f77[0x0][_0xca204f]===_0x15272b(0x197)?_0x15272b(0x21c):_0x15272b(0x169)})),_0x189d98={'queryId':'preview','columns':_0x3ac481,'data':_0xb68f77,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xb68f77['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3a2915=formatAsTable(_0x189d98,_0xb68f77[_0x15272b(0x1f5)],!![]);await writeOutput(_0x3a2915,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x279);[a22_0x31c158(0x219)]=a22_0x31c158(0x26d);async[a22_0x31c158(0x246)](_0x2f0075){const _0x4b4461=a22_0x31c158,{options:_0x5abdc0,args:_0x14adc3,tdx:_0x175b76}=_0x2f0075,_0x49aed1=_0x5abdc0,_0x472035=_0x14adc3[0x0]||_0x5abdc0['parentSegment'];if(!_0x472035)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x4b4461(0x239)),0x1;const _0x2a73d5=resolveYamlFile(_0x472035);if(existsSync(_0x2a73d5)){_0x49aed1[_0x4b4461(0x18c)]&&console['error']('Found\x20YAML\x20file:\x20'+_0x2a73d5);let _0x36b528;try{_0x36b528=readFileSync(_0x2a73d5,'utf-8');}catch(_0x37b853){const _0x4b5dca=_0x37b853 instanceof Error?_0x37b853['message']:String(_0x37b853);return console[_0x4b4461(0x1fc)]('Error\x20reading\x20file:\x20'+_0x4b5dca),0x1;}const _0x2da5b8=await withSpinner(_0x4b4461(0x254),()=>_0x175b76[_0x4b4461(0x1d3)][_0x4b4461(0x1f2)](_0x36b528),{'verbose':_0x49aed1['verbose']}),_0x4ea0e3=_0x2da5b8[_0x4b4461(0x17c)],{isNew:_0x510c1b,name:_0x9f985b,hasChanges:_0x39395a,diffFormatted:_0x15ad69}=_0x4ea0e3;if(_0x39395a){_0x510c1b?console[_0x4b4461(0x1fc)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x9f985b+'\x27:'):console['error'](_0x4b4461(0x199)+_0x9f985b+'\x27:');console[_0x4b4461(0x1fc)]('─'[_0x4b4461(0x213)](0x3c)),console[_0x4b4461(0x1fc)](_0x15ad69),console[_0x4b4461(0x1fc)]('─'[_0x4b4461(0x213)](0x3c));const _0x4b20c9=_0x510c1b?'Create\x20parent\x20segment\x20\x27'+_0x9f985b+_0x4b4461(0x236):_0x4b4461(0x1cf)+_0x9f985b+_0x4b4461(0x236);if(!_0x49aed1[_0x4b4461(0x256)]){const _0x1727d6=await confirmKey(_0x4b20c9);if(!_0x1727d6)return console[_0x4b4461(0x1fc)]('Aborted.'),0x1;}const _0x4303e8=_0x510c1b?_0x4b4461(0x1eb):_0x4b4461(0x1f3);await withSpinner(_0x4303e8+_0x4b4461(0x20e)+_0x9f985b+_0x4b4461(0x249),()=>_0x4ea0e3[_0x4b4461(0x1be)](),{'verbose':_0x49aed1[_0x4b4461(0x18c)]});const _0x1afe4c=_0x510c1b?_0x4b4461(0x206):_0x4b4461(0x276);console[_0x4b4461(0x1fc)]('✔\x20'+_0x1afe4c+_0x4b4461(0x20e)+_0x9f985b+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x9f985b+_0x4b4461(0x175));}const _0x574b2b=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x472035+_0x4b4461(0x249),()=>_0x175b76['segment'][_0x4b4461(0x214)](_0x472035),{'verbose':_0x49aed1['verbose']}),_0xa2d819=_0x574b2b[_0x4b4461(0x17c)],_0x1900ab=getConsoleUrl(_0x49aed1[_0x4b4461(0x153)],_0x4b4461(0x1f8)+_0xa2d819['workflowId']+_0x4b4461(0x19c)+_0xa2d819[_0x4b4461(0x21a)]+_0x4b4461(0x1f6)+_0xa2d819['workflowAttemptId']);return console['error'](_0x4b4461(0x1aa)),console['error']('\x20\x20'+a22_0x46c484[_0x4b4461(0x27c)](_0x4b4461(0x19d))+'\x20'+_0xa2d819[_0x4b4461(0x15d)]),console[_0x4b4461(0x1fc)]('\x20\x20'+a22_0x46c484['dim'](_0x4b4461(0x204))+'\x20'+_0xa2d819[_0x4b4461(0x160)]),console[_0x4b4461(0x1fc)]('\x20\x20'+a22_0x46c484[_0x4b4461(0x27c)](_0x4b4461(0x25c))+'\x20'+_0xa2d819[_0x4b4461(0x21a)]),console[_0x4b4461(0x1fc)]('\x20\x20'+a22_0x46c484['dim'](_0x4b4461(0x195))+'\x20'+_0xa2d819[_0x4b4461(0x1dd)]),console['error']('\x20\x20'+_0x1900ab),console['error']('\x0a'+a22_0x46c484['dim'](_0x4b4461(0x1ac))+_0x4b4461(0x229)+_0xa2d819['workflowAttemptId']+_0x4b4461(0x18f)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x1fd);[a22_0x31c158(0x219)]=a22_0x31c158(0x167);async[a22_0x31c158(0x246)](_0x1bbd13){const _0x7e7917=a22_0x31c158,{options:_0x1f62fd,args:_0x294301,tdx:_0x1c0250}=_0x1bbd13,_0x556e8c=_0x294301[0x0]||_0x1f62fd[_0x7e7917(0x222)];if(!_0x556e8c)return showParentSegmentNotSetError(_0x7e7917(0x23b)+'\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;_0x1f62fd['verbose']&&(console[_0x7e7917(0x1fc)](_0x7e7917(0x233)+_0x1f62fd[_0x7e7917(0x153)]),console[_0x7e7917(0x1fc)]('Parent\x20segment:\x20'+_0x556e8c));const _0x5ddac3=await withSpinner(_0x7e7917(0x1e9)+_0x556e8c+_0x7e7917(0x249),()=>_0x1c0250[_0x7e7917(0x1d3)]['listFields'](_0x556e8c),{'verbose':_0x1f62fd[_0x7e7917(0x18c)]}),_0x437ad0=_0x5ddac3['data'];console[_0x7e7917(0x1fc)](_0x7e7917(0x1a0)+_0x437ad0[_0x7e7917(0x1f5)]+'\x20field'+(_0x437ad0[_0x7e7917(0x1f5)]!==0x1?'s':''));if(_0x1f62fd[_0x7e7917(0x22c)]||_0x1f62fd[_0x7e7917(0x24a)])return await handleSDKOutput(_0x437ad0,_0x1f62fd),0x0;return displayFieldsHumanReadable(_0x437ad0,_0x556e8c),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x31c158(0x226)]='segment:parent:view';[a22_0x31c158(0x219)]=a22_0x31c158(0x1b9);async[a22_0x31c158(0x246)](_0x4e2b2f){const _0x1a767b=a22_0x31c158,{options:_0x4f3ac7,args:_0x2c59a9,tdx:_0x3505f7}=_0x4e2b2f,_0x39e2c5=_0x4f3ac7,_0x421fa8=_0x2c59a9[0x0]||_0x4f3ac7['parentSegment'];if(!_0x421fa8)return showParentSegmentNotSetError(_0x1a767b(0x17e)+_0x1a767b(0x1e1)+'Options:\x0a'+_0x1a767b(0x1a4)),0x1;_0x4f3ac7[_0x1a767b(0x18c)]&&(console[_0x1a767b(0x1fc)](_0x1a767b(0x233)+_0x4f3ac7[_0x1a767b(0x153)]),console['error'](_0x1a767b(0x1a1)+_0x421fa8));const _0x122b29=await withSpinner(_0x1a767b(0x274)+_0x421fa8+_0x1a767b(0x249),()=>_0x3505f7[_0x1a767b(0x1d3)][_0x1a767b(0x1ad)](_0x421fa8),{'verbose':_0x4f3ac7[_0x1a767b(0x18c)]}),_0x15ce3f=_0x122b29[_0x1a767b(0x17c)];if(_0x39e2c5['web']){const _0x390d52=getConsoleNextUrl(_0x39e2c5['site'],'/app/dw/parentSegments/'+_0x15ce3f['id']);return console[_0x1a767b(0x1fc)](a22_0x46c484['green']('✔')+_0x1a767b(0x245)+a22_0x46c484[_0x1a767b(0x231)](_0x390d52)),openBrowser(_0x390d52),0x0;}return await handleSingleObjectOutput(_0x15ce3f,_0x4f3ac7),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a22_0x31c158(0x1fa);['description']=a22_0x31c158(0x268);async['execute'](_0x1395b8){const _0x1492aa=a22_0x31c158,{options:_0x1993e6,args:_0x126be2,tdx:_0x3c65eb}=_0x1395b8,_0x31afb9=_0x126be2[0x0]||_0x1993e6[_0x1492aa(0x222)];if(!_0x31afb9)return showParentSegmentNotSetError(_0x1492aa(0x1d0)+_0x1492aa(0x210)),0x1;_0x1993e6[_0x1492aa(0x18c)]&&(console[_0x1492aa(0x1fc)](_0x1492aa(0x233)+_0x1993e6['site']),console[_0x1492aa(0x1fc)]('Parent\x20segment:\x20'+_0x31afb9));const _0x1c97c8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31afb9+'\x27...',()=>_0x3c65eb[_0x1492aa(0x1d3)][_0x1492aa(0x1c3)](_0x31afb9),{'verbose':_0x1993e6[_0x1492aa(0x18c)]}),_0x5db12c=_0x1c97c8['data'],_0x59d222=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x31afb9+_0x1492aa(0x249),()=>_0x3c65eb['segment'][_0x1492aa(0x1e6)](_0x5db12c),{'verbose':_0x1993e6[_0x1492aa(0x18c)]}),_0x429de9=await executeSchemaQuery(_0x59d222[_0x1492aa(0x17c)],_0x3c65eb,_0x1993e6);return await handleQueryOutput(_0x429de9,_0x1993e6),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x16d);[a22_0x31c158(0x219)]=a22_0x31c158(0x1c7);async[a22_0x31c158(0x246)](_0xd3257a){const _0x32bce2=a22_0x31c158,{options:_0x99ef4,args:_0x5e051b,tdx:_0x3dfbc6}=_0xd3257a,_0x765fa6=_0x5e051b[0x0]||_0x99ef4[_0x32bce2(0x222)];if(!_0x765fa6)return showParentSegmentNotSetError(_0x32bce2(0x171)+_0x32bce2(0x27a)),0x1;_0x99ef4[_0x32bce2(0x18c)]&&(console[_0x32bce2(0x1fc)](_0x32bce2(0x233)+_0x99ef4[_0x32bce2(0x153)]),console['error']('Parent\x20segment:\x20'+_0x765fa6));const _0x161470=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x765fa6+_0x32bce2(0x249),()=>_0x3dfbc6['segment'][_0x32bce2(0x1c3)](_0x765fa6),{'verbose':_0x99ef4[_0x32bce2(0x18c)]}),_0x579a08=_0x161470['data'],_0x5aa0a0=await withSpinner(_0x32bce2(0x1bf)+_0x765fa6+_0x32bce2(0x249),()=>_0x3dfbc6['segment'][_0x32bce2(0x1e6)](_0x579a08),{'verbose':_0x99ef4['verbose']}),_0x4c8240=_0x5aa0a0['data'];return _0x99ef4[_0x32bce2(0x15c)]===_0x32bce2(0x22c)||_0x99ef4['format']===_0x32bce2(0x24a)?await handleSDKOutput([{'sql':_0x4c8240}],_0x99ef4):console['log'](_0x4c8240),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x31c158(0x226)]=a22_0x31c158(0x1f9);[a22_0x31c158(0x219)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a22_0x31c158(0x246)](_0x2abbcb){const _0x26328b=a22_0x31c158,{options:_0x24248e,args:_0x59afdc,tdx:_0x81e593}=_0x2abbcb,_0x10b4ab=_0x59afdc[0x0]||_0x24248e[_0x26328b(0x222)];if(!_0x10b4ab)return showParentSegmentNotSetError(_0x26328b(0x1b4)+_0x26328b(0x1d1)),0x1;_0x24248e['verbose']&&(console[_0x26328b(0x1fc)]('Site:\x20'+_0x24248e[_0x26328b(0x153)]),console['error']('Parent\x20segment:\x20'+_0x10b4ab));const _0x5a8152=await withSpinner(_0x26328b(0x1d5)+_0x10b4ab+_0x26328b(0x249),()=>_0x81e593['segment'][_0x26328b(0x1c3)](_0x10b4ab),{'verbose':_0x24248e[_0x26328b(0x18c)]}),_0x465f77=_0x5a8152[_0x26328b(0x17c)],_0x3b46b2=await withSpinner(_0x26328b(0x1bf)+_0x10b4ab+_0x26328b(0x249),()=>_0x81e593[_0x26328b(0x1d3)]['getParentSQL'](_0x465f77),{'verbose':_0x24248e['verbose']});let _0x1b6a09=_0x3b46b2[_0x26328b(0x17c)];const _0x397059=resolveLimit(_0x24248e[_0x26328b(0x261)],DEFAULT_DISPLAY_LIMIT),_0xfbdaba=/\bLIMIT\s+\d+/i[_0x26328b(0x228)](_0x1b6a09);!_0xfbdaba&&(_0x1b6a09=_0x1b6a09[_0x26328b(0x277)]()['replace'](/;+$/,''),_0x1b6a09='SELECT\x20*\x20FROM\x20(\x0a'+_0x1b6a09+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x397059);_0x24248e['verbose']&&console[_0x26328b(0x1fc)](_0x26328b(0x1a9)+_0x1b6a09);const _0x2b68b7=await withProgressSpinner(_0x26328b(0x1c8),async _0x2394a2=>{const _0x5e77a3=_0x26328b,_0x334a55=await _0x81e593[_0x5e77a3(0x181)][_0x5e77a3(0x246)](_0x1b6a09,{'catalog':'td','schema':'information_schema','onJobId':_0x3b7165=>{const _0xe2a535=_0x5e77a3;_0x2394a2[_0xe2a535(0x16c)](_0x3b7165);}});return _0x334a55;},{'verbose':_0x24248e[_0x26328b(0x18c)]}),_0x391bed=_0x2b68b7['data'],_0x4c59c9=_0x391bed[_0x26328b(0x187)]?_0x26328b(0x208)+_0x391bed[_0x26328b(0x187)]+']':'';return console[_0x26328b(0x1fc)](_0x26328b(0x22b)+_0x391bed['stats'][_0x26328b(0x179)][_0x26328b(0x1ef)]()+'\x20rows\x20'+(_0x26328b(0x189)+formatElapsed(_0x391bed[_0x26328b(0x26a)][_0x26328b(0x24f)])+_0x4c59c9)),await handleQueryOutput(_0x391bed,_0x24248e),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a23_0x4cf0(_0x50621b,_0x346fd5){_0x50621b=_0x50621b-0x163;const _0x594221=a23_0x5942();let _0x4cf0a1=_0x594221[_0x50621b];return _0x4cf0a1;}function a23_0x5942(){const _0x80378a=['message','error','log','length','name','config','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2421225duKIMo','1519320udaxwo','969294jgJVLw','2905720txsymZ','4038288JpHoip','14vWetiS','Error:\x20','1055873SKdTDB','106620sbCTbY','map','description'];a23_0x5942=function(){return _0x80378a;};return a23_0x5942();}const a23_0x3a61b9=a23_0x4cf0;(function(_0x86073d,_0xca5c84){const _0x2b6c77=a23_0x4cf0,_0x30ea64=_0x86073d();while(!![]){try{const _0x309174=parseInt(_0x2b6c77(0x169))/0x1*(parseInt(_0x2b6c77(0x16c))/0x2)+-parseInt(_0x2b6c77(0x164))/0x3+parseInt(_0x2b6c77(0x165))/0x4+-parseInt(_0x2b6c77(0x167))/0x5+parseInt(_0x2b6c77(0x166))/0x6+parseInt(_0x2b6c77(0x16b))/0x7+parseInt(_0x2b6c77(0x168))/0x8;if(_0x309174===_0xca5c84)break;else _0x30ea64['push'](_0x30ea64['shift']());}catch(_0xb3d71c){_0x30ea64['push'](_0x30ea64['shift']());}}}(a23_0x5942,0x87875));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{[a23_0x3a61b9(0x173)]='profiles';[a23_0x3a61b9(0x16e)]='List\x20all\x20available\x20profiles';async['execute'](_0x438abe){const _0x4caf07=a23_0x3a61b9,{options:_0x4f6183}=_0x438abe;try{const _0x24158e=listProfiles(),_0x87f7c4=getActiveProfile();if(_0x24158e[_0x4caf07(0x172)]===0x0)return console[_0x4caf07(0x171)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x4caf07(0x163)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x29bf05=_0x24158e[_0x4caf07(0x16d)](_0x3408e2=>{const _0x490a87=_0x4caf07,_0x1694ce=_0x3408e2[_0x490a87(0x173)]===_0x87f7c4,_0xc13786=getProfileParams(_0x3408e2['config']);return{'name':_0x3408e2['name'],'active':_0x1694ce,'scope':_0x3408e2[_0x490a87(0x175)],'description':_0x3408e2[_0x490a87(0x174)]['description']||'','params':_0xc13786};});return await handleSDKOutput(_0x29bf05,_0x4f6183),0x0;}catch(_0x2064b1){return _0x2064b1 instanceof Error&&console[_0x4caf07(0x170)](_0x4caf07(0x16a)+_0x2064b1[_0x4caf07(0x16f)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x3fa1da=a24_0x7441;(function(_0xf74c2,_0x38f2e3){const _0x25612f=a24_0x7441,_0x224d4c=_0xf74c2();while(!![]){try{const _0x348af8=-parseInt(_0x25612f(0x207))/0x1*(-parseInt(_0x25612f(0x1f2))/0x2)+-parseInt(_0x25612f(0x1d7))/0x3+parseInt(_0x25612f(0x1d5))/0x4*(-parseInt(_0x25612f(0x1e4))/0x5)+parseInt(_0x25612f(0x1da))/0x6*(parseInt(_0x25612f(0x1db))/0x7)+-parseInt(_0x25612f(0x20a))/0x8*(-parseInt(_0x25612f(0x1fe))/0x9)+-parseInt(_0x25612f(0x1d4))/0xa*(-parseInt(_0x25612f(0x1f3))/0xb)+-parseInt(_0x25612f(0x208))/0xc;if(_0x348af8===_0x38f2e3)break;else _0x224d4c['push'](_0x224d4c['shift']());}catch(_0x13662b){_0x224d4c['push'](_0x224d4c['shift']());}}}(a24_0x550c,0xd68e8));import{BaseCommand}from'./command.js';function a24_0x550c(){const _0x5d4336=['in\x20','setPhase','database','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20statement\x20','9ljBjIe','\x20rows\x20','length','message','Catalog:\x20','catalog','execute','query','push','43ioTQGa','32604648ahPChf','stats','4973448pZIZBu','setJobId','1679070CkidNX','263324DVOmjR','Executing\x20query\x20[','3070260KSKugC','file','\x20splits','42tfnvxE','1182209iOOrTL','args','error','processedRows','...','join','options','completedSplits','elapsedTimeMillis','30VvqLZe','site','information_schema','\x20-\x20','Executing\x20query...','validate','output','data','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','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','Statement\x20','originalMessage','state','description','79034GUBaPM','99DjhSeH','jobId','Error:\x20','name','verbose','setExtra'];a24_0x550c=function(){return _0x5d4336;};return a24_0x550c();}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';function a24_0x7441(_0x298a58,_0x720def){_0x298a58=_0x298a58-0x1d3;const _0x550c75=a24_0x550c();let _0x744107=_0x550c75[_0x298a58];return _0x744107;}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x3fa1da(0x1f6)]='query';[a24_0x3fa1da(0x1f1)]='Run\x20Trino\x20queries\x20(streaming)';async[a24_0x3fa1da(0x204)](_0x31c419){const _0x2cd983=a24_0x3fa1da,{options:_0x350f48,args:_0x2b3dce,tdx:_0x51a3be}=_0x31c419,_0x134113=_0x2b3dce[0x0],_0x4c2d6d=_0x350f48['file'];let _0x229623;try{if(_0x4c2d6d)_0x229623=readSqlStatementsFromFile(_0x4c2d6d);else{if(_0x134113==='-')_0x229623=await readSqlStatementsFromStdin();else{if(_0x134113&&isSqlFilePath(_0x134113))_0x229623=readSqlStatementsFromFile(_0x134113);else{if(_0x134113)_0x229623=splitSqlStatements(_0x134113);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xfc50d6){return console[_0x2cd983(0x1dd)](_0x2cd983(0x1f5)+_0xfc50d6[_0x2cd983(0x201)]),0x1;}const _0x5caf81=_0x350f48[_0x2cd983(0x1fb)]||_0x2cd983(0x1e6),_0x1d64c6=_0x350f48[_0x2cd983(0x203)];try{const _0x46b6fc=[],_0x5d110f=!!_0x350f48[_0x2cd983(0x1ea)];for(let _0x30028b=0x0;_0x30028b<_0x229623['length'];_0x30028b++){const _0x23b315=_0x229623[_0x30028b],_0x14396e=_0x30028b+0x1,_0x4f5bd1=_0x229623[_0x2cd983(0x200)],_0x7d7248=_0x4f5bd1>0x1;_0x350f48[_0x2cd983(0x1f7)]&&(console[_0x2cd983(0x1dd)]('\x0a'+(_0x7d7248?_0x2cd983(0x1ee)+_0x14396e+'/'+_0x4f5bd1+':':'')),console[_0x2cd983(0x1dd)]('Site:\x20'+_0x350f48[_0x2cd983(0x1e5)]),console[_0x2cd983(0x1dd)](_0x2cd983(0x202)+(_0x1d64c6||'td')),console['error']('Schema:\x20'+_0x5caf81),console[_0x2cd983(0x1dd)]('SQL:\x20'+_0x23b315));const _0x4b33e5=_0x7d7248?_0x2cd983(0x1fd)+_0x14396e+'/'+_0x4f5bd1+_0x2cd983(0x1df):_0x2cd983(0x1e8);try{const _0x598d5f=await withProgressSpinner(_0x4b33e5,async _0x1cdec9=>{const _0x276fe4=_0x2cd983,_0x4d4da7=await _0x51a3be[_0x276fe4(0x205)][_0x276fe4(0x204)](_0x23b315,{'catalog':_0x1d64c6,'schema':_0x5caf81,'onJobId':_0xa915e9=>{const _0x283254=_0x276fe4;_0x1cdec9[_0x283254(0x1d3)](_0xa915e9);},'onProgress':_0x289a7a=>{const _0x1d5de2=_0x276fe4;_0x1cdec9[_0x1d5de2(0x1fa)](_0x1d5de2(0x1d6)+_0x289a7a[_0x1d5de2(0x1f0)]+']'),_0x1cdec9[_0x1d5de2(0x1f8)](formatRows(_0x289a7a['processedRows'])+_0x1d5de2(0x1ff)+_0x289a7a[_0x1d5de2(0x1e2)]+'/'+_0x289a7a['totalSplits']+_0x1d5de2(0x1d9));}});return _0x4d4da7;},{'verbose':_0x350f48[_0x2cd983(0x1f7)]}),_0x70f6e8=_0x598d5f[_0x2cd983(0x1eb)],_0xeac4cc=_0x70f6e8[_0x2cd983(0x1f4)]?'\x20[Job\x20ID:\x20'+_0x70f6e8[_0x2cd983(0x1f4)]+']':'',_0x360cfe=_0x7d7248?_0x2cd983(0x1ee)+_0x14396e+'/'+_0x4f5bd1+_0x2cd983(0x1e7):'';console['error']('✔\x20'+_0x360cfe+'Query\x20completed:\x20Processed\x20'+formatRows(_0x70f6e8[_0x2cd983(0x209)][_0x2cd983(0x1de)])+'\x20rows\x20'+(_0x2cd983(0x1f9)+formatElapsed(_0x70f6e8['stats'][_0x2cd983(0x1e3)])+_0xeac4cc));if(_0x7d7248&&_0x5d110f){const _0x46cd7d=resolveOutputOptions(_0x350f48),_0x35235e=await formatQueryOutput(_0x70f6e8,_0x46cd7d);_0x46b6fc[_0x2cd983(0x206)](_0x35235e);}else await handleQueryOutput(_0x70f6e8,_0x350f48);}catch(_0x50f958){const _0x33ad42=_0x7d7248?_0x2cd983(0x1ee)+_0x14396e+'/'+_0x4f5bd1+':\x0a':'',_0x872d97=_0x50f958 instanceof SDKError?_0x50f958[_0x2cd983(0x1ef)]:_0x50f958[_0x2cd983(0x201)];return console[_0x2cd983(0x1dd)](''+_0x33ad42+_0x872d97),0x1;}}if(_0x229623['length']>0x1&&_0x5d110f&&_0x46b6fc['length']>0x0){const _0x3f88e3=_0x46b6fc[_0x2cd983(0x1e0)]('\x0a');writeFileSync(_0x350f48[_0x2cd983(0x1ea)],_0x3f88e3),console[_0x2cd983(0x1dd)](_0x2cd983(0x1fc)+_0x350f48[_0x2cd983(0x1ea)]);}return 0x0;}catch(_0x5e2c1d){throw _0x5e2c1d;}}[a24_0x3fa1da(0x1e9)](_0x15754f){const _0x6a984c=a24_0x3fa1da,_0x3757d5=_0x15754f[_0x6a984c(0x1dc)][0x0],_0xa864c1=_0x15754f[_0x6a984c(0x1e1)][_0x6a984c(0x1d8)];if(!_0x3757d5&&!_0xa864c1)return _0x6a984c(0x1ed);if(_0x3757d5&&_0xa864c1)return _0x6a984c(0x1ec);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a25_0x29b0fd=a25_0x52ee;(function(_0x20b287,_0xff2c69){const _0xa32e52=a25_0x52ee,_0x410659=_0x20b287();while(!![]){try{const _0x4c9a0f=parseInt(_0xa32e52(0x151))/0x1+parseInt(_0xa32e52(0xdc))/0x2*(parseInt(_0xa32e52(0xd2))/0x3)+parseInt(_0xa32e52(0xc7))/0x4*(parseInt(_0xa32e52(0x10b))/0x5)+parseInt(_0xa32e52(0x141))/0x6+-parseInt(_0xa32e52(0xcc))/0x7*(parseInt(_0xa32e52(0x146))/0x8)+parseInt(_0xa32e52(0x10d))/0x9+-parseInt(_0xa32e52(0x155))/0xa*(parseInt(_0xa32e52(0xc3))/0xb);if(_0x4c9a0f===_0xff2c69)break;else _0x410659['push'](_0x410659['shift']());}catch(_0x208afd){_0x410659['push'](_0x410659['shift']());}}}(a25_0x48a6,0xda3fb));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a25_0x52ee(_0x51239d,_0x34214c){_0x51239d=_0x51239d-0xbe;const _0x48a614=a25_0x48a6();let _0x52eec5=_0x48a614[_0x51239d];return _0x52eec5;}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x19b9f5 from'chalk';async function resolveSegmentTarget(_0x1d91f5,_0x15e21d,_0x3c59cd){const _0x20d3fc=a25_0x52ee;if(isYamlFilePath(_0x1d91f5))try{const _0x54f707=await resolveYamlFilePath(_0x1d91f5);return _0x3c59cd&&(console[_0x20d3fc(0x14d)](_0x20d3fc(0x135)+_0x1d91f5),console[_0x20d3fc(0x14d)]('\x20\x20Parent\x20segment:\x20'+_0x54f707[_0x20d3fc(0x127)]),console[_0x20d3fc(0x14d)](_0x20d3fc(0x121)+_0x54f707[_0x20d3fc(0xfa)]),console[_0x20d3fc(0x14d)](_0x20d3fc(0x138)+(_0x54f707[_0x20d3fc(0xdb)]||'(root)')),console[_0x20d3fc(0x14d)](_0x20d3fc(0x15a)+_0x54f707[_0x20d3fc(0x102)])),_0x54f707[_0x20d3fc(0x102)];}catch(_0x32c650){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x32c650[_0x20d3fc(0x130)]);}if(!_0x15e21d)throw new SDKError(ErrorCode[_0x20d3fc(0x140)],_0x20d3fc(0xd3));return _0x15e21d+'/'+_0x1d91f5;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x29b0fd(0x113)]=a25_0x29b0fd(0xe0);[a25_0x29b0fd(0xdd)]=a25_0x29b0fd(0xda);async[a25_0x29b0fd(0xe9)](_0x5d2506){const _0x1b0377=a25_0x29b0fd,{options:_0x5ccef5,args:_0x1a0206,tdx:_0x351fca}=_0x5d2506,_0x3a2ec6=_0x1a0206[0x0],_0xc3934a=!_0x3a2ec6&&!!_0x5ccef5[_0x1b0377(0x127)],_0x199bf6=_0x3a2ec6||_0x5ccef5['parentSegment'];if(!_0x199bf6)return console['error'](_0x1b0377(0x150)),console[_0x1b0377(0x14d)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1b0377(0x14d)](_0x1b0377(0x12d)),console[_0x1b0377(0x14d)](_0x1b0377(0xc8)),console['error'](_0x1b0377(0xcb)),console[_0x1b0377(0x14d)](_0x1b0377(0x11e)),console[_0x1b0377(0x14d)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x246eff=_0x5ccef5[_0x1b0377(0xf5)];let _0x4fde52=_0x199bf6;!_0xc3934a&&_0x246eff&&!_0x199bf6[_0x1b0377(0xfc)]('/')&&(_0x4fde52=_0x246eff+'/'+_0x199bf6,_0x5ccef5[_0x1b0377(0xcd)]&&console[_0x1b0377(0x14d)](_0x1b0377(0x10c)+_0x4fde52));const _0x3cb201=await withSpinner('Resolving\x20path\x20\x27'+_0x4fde52+_0x1b0377(0x14f),()=>_0x351fca[_0x1b0377(0x15b)]['resolvePathToResource'](_0x4fde52),{'verbose':_0x5ccef5[_0x1b0377(0xcd)]}),_0x8b2f24=_0x3cb201[_0x1b0377(0x11a)];_0x5ccef5[_0x1b0377(0xcd)]&&(console[_0x1b0377(0x14d)](_0x1b0377(0x157)+_0x8b2f24[_0x1b0377(0xc2)]),console['error'](_0x1b0377(0x123)+_0x8b2f24[_0x1b0377(0x118)]),_0x8b2f24[_0x1b0377(0xf0)]&&console[_0x1b0377(0x14d)](_0x1b0377(0xc1)+_0x8b2f24[_0x1b0377(0xf0)]),_0x8b2f24[_0x1b0377(0x13e)]&&console[_0x1b0377(0x14d)](_0x1b0377(0xbf)+_0x8b2f24[_0x1b0377(0x13e)]));if(_0x8b2f24['type']===_0x1b0377(0xd5)){const _0x31dcbf=await withSpinner(_0x1b0377(0x105),()=>_0x351fca[_0x1b0377(0x15b)][_0x1b0377(0xed)](_0x8b2f24[_0x1b0377(0x118)]),{'verbose':_0x5ccef5[_0x1b0377(0xcd)]});await handleSingleObjectOutput(_0x31dcbf[_0x1b0377(0x11a)],_0x5ccef5);}else{if(_0x8b2f24[_0x1b0377(0xc2)]==='folder'){if(!_0x8b2f24[_0x1b0377(0xf0)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x1b0377(0xc6));const _0x43d85d=await withSpinner(_0x1b0377(0xff),()=>_0x351fca[_0x1b0377(0x15b)]['getFolder'](_0x8b2f24[_0x1b0377(0xf0)]),{'verbose':_0x5ccef5[_0x1b0377(0xcd)]});await handleSingleObjectOutput(_0x43d85d[_0x1b0377(0x11a)],_0x5ccef5);}else{if(_0x8b2f24[_0x1b0377(0xc2)]===_0x1b0377(0x15b)){if(!_0x8b2f24['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1b0377(0xe2));const _0xd33121=await withSpinner(_0x1b0377(0x13d),()=>_0x351fca['segment']['getSegment'](_0x8b2f24[_0x1b0377(0x118)],_0x8b2f24[_0x1b0377(0x13e)]),{'verbose':_0x5ccef5[_0x1b0377(0xcd)]});await handleSingleObjectOutput(_0xd33121[_0x1b0377(0x11a)],_0x5ccef5);}}}return 0x0;}catch(_0x4b042c){if(_0x4b042c instanceof SDKError)return console[_0x1b0377(0x14d)]('Error:\x20'+_0x4b042c['message']),_0x4b042c['cause']&&console[_0x1b0377(0x14d)](_0x1b0377(0xef)+_0x4b042c[_0x1b0377(0xe7)]),0x1;throw _0x4b042c;}}}export class SegmentShowCommand extends BaseCommand{['name']=a25_0x29b0fd(0xc0);[a25_0x29b0fd(0xdd)]=a25_0x29b0fd(0xf8);async[a25_0x29b0fd(0xe9)](_0x541ad5){const _0x123add=a25_0x29b0fd,{options:_0x2f885d,args:_0x1f2870,tdx:_0x277206}=_0x541ad5,_0x577028=_0x1f2870[0x0];if(!_0x577028)return console['error'](_0x123add(0x11f)),console['error'](_0x123add(0xf2)),console['error'](_0x123add(0x107)),console[_0x123add(0x14d)](_0x123add(0x12d)),console['error'](_0x123add(0x15c)),console[_0x123add(0x14d)](_0x123add(0x145)),0x1;try{const _0x336760=_0x2f885d['parentSegment'],_0x324830=await resolveSegmentTarget(_0x577028,_0x336760,_0x2f885d['verbose']);_0x2f885d[_0x123add(0xcd)]&&console[_0x123add(0x14d)](_0x123add(0xce)+_0x324830);const _0x8f791f=await withSpinner(_0x123add(0x108)+_0x577028+_0x123add(0x14f),()=>_0x277206[_0x123add(0x15b)][_0x123add(0x14b)](_0x324830),{'verbose':_0x2f885d[_0x123add(0xcd)]}),_0x5bfca8=_0x8f791f[_0x123add(0x11a)];_0x2f885d[_0x123add(0xcd)]&&(console[_0x123add(0x14d)](_0x123add(0x157)+_0x5bfca8[_0x123add(0xc2)]),console[_0x123add(0x14d)](_0x123add(0x123)+_0x5bfca8[_0x123add(0x118)]));if(_0x5bfca8[_0x123add(0xc2)]===_0x123add(0x132))return console[_0x123add(0x14d)](_0x123add(0xe1)),console[_0x123add(0x14d)](_0x123add(0x129)),0x1;if(_0x5bfca8['type']===_0x123add(0xd5))return console[_0x123add(0x14d)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x123add(0x14d)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x5bfca8[_0x123add(0x13e)])throw new SDKError(ErrorCode[_0x123add(0xdf)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xebb37e=await withSpinner(_0x123add(0x13a),()=>_0x277206[_0x123add(0x15b)][_0x123add(0x131)](_0x5bfca8[_0x123add(0x118)],_0x5bfca8['segmentId']),{'verbose':_0x2f885d[_0x123add(0xcd)]});let _0x386ec3=_0xebb37e[_0x123add(0x11a)];const _0x167930=resolveLimit(_0x2f885d[_0x123add(0x13b)],DEFAULT_DISPLAY_LIMIT),_0x2ea52d=/\bLIMIT\s+\d+/i[_0x123add(0x103)](_0x386ec3);!_0x2ea52d&&(_0x386ec3=_0x386ec3[_0x123add(0x154)]()['replace'](/;+$/,''),_0x386ec3='SELECT\x20*\x20FROM\x20(\x0a'+_0x386ec3+_0x123add(0x136)+_0x167930);_0x2f885d[_0x123add(0xcd)]&&console['error'](_0x123add(0x126)+_0x386ec3);const _0x26af13=await withProgressSpinner(_0x123add(0x134),async _0x31a118=>{const _0x508932=_0x123add,_0x447215=await _0x277206[_0x508932(0xd0)]['execute'](_0x386ec3,{'catalog':'td','schema':_0x508932(0xd4),'onJobId':_0x1bd4ed=>{const _0x170388=_0x508932;_0x31a118[_0x170388(0x14e)](_0x1bd4ed);}});return _0x447215;},{'verbose':_0x2f885d[_0x123add(0xcd)]}),_0x56bcff=_0x26af13[_0x123add(0x11a)],_0x48b46f=_0x56bcff['jobId']?_0x123add(0x144)+_0x56bcff['jobId']+']':'';return console['error'](_0x123add(0x124)+_0x56bcff[_0x123add(0x159)][_0x123add(0xe3)]['toLocaleString']()+_0x123add(0x158)+(_0x123add(0x128)+formatElapsed(_0x56bcff['stats']['elapsedTimeMillis'])+_0x48b46f)),await handleQueryOutput(_0x56bcff,_0x2f885d),0x0;}catch(_0x12fc83){if(_0x12fc83 instanceof SDKError)return console[_0x123add(0x14d)](_0x123add(0xf7)+_0x12fc83[_0x123add(0x156)]+']'),console['error']('\x0a'+_0x12fc83['message']),0x1;throw _0x12fc83;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a25_0x29b0fd(0xdd)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a25_0x29b0fd(0xe9)](_0x8ce95){const _0x125161=a25_0x29b0fd,{options:_0x3a6cb5,args:_0x3ea11f,tdx:_0x2aa57d}=_0x8ce95;if(_0x3ea11f[_0x125161(0x12e)]===0x0)return console[_0x125161(0x14d)](_0x125161(0x139)),console[_0x125161(0x14d)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x436ce0=_0x3ea11f[0x0];try{_0x3a6cb5[_0x125161(0xcd)]&&(console[_0x125161(0x14d)](_0x125161(0x12a)+_0x3a6cb5[_0x125161(0x133)]),console['error'](_0x125161(0x137)+_0x436ce0));const _0x2d6d18=await withSpinner(_0x125161(0x152)+_0x436ce0+_0x125161(0x14f),()=>_0x2aa57d[_0x125161(0x15b)]['resolveParentId'](_0x436ce0),{'verbose':_0x3a6cb5['verbose']}),_0x2998fd=_0x2d6d18[_0x125161(0x11a)];_0x3a6cb5[_0x125161(0xcd)]&&console['error'](_0x125161(0x106)+_0x2998fd);const _0x6112fb=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x436ce0+_0x125161(0x14f),()=>_0x2aa57d['segment']['listFolders'](_0x2998fd),{'verbose':_0x3a6cb5[_0x125161(0xcd)]}),_0x57e654=_0x6112fb[_0x125161(0x11a)];return console[_0x125161(0x14d)]('✔\x20Found\x20'+_0x57e654[_0x125161(0x12e)]+'\x20folder'+(_0x57e654[_0x125161(0x12e)]!==0x1?'s':'')),await handleSDKOutput(_0x57e654,_0x3a6cb5),0x0;}catch(_0x17af34){if(_0x17af34 instanceof SDKError)return console[_0x125161(0x14d)](_0x125161(0xc4)+_0x17af34[_0x125161(0x130)]),_0x17af34[_0x125161(0xe7)]&&console[_0x125161(0x14d)](_0x125161(0xef)+_0x17af34[_0x125161(0xe7)]),0x1;throw _0x17af34;}}}function a25_0x48a6(){const _0x4419bb=['description','jsonl','SEGMENT_NOT_FOUND','segment:describe','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Segment\x20ID\x20missing\x20from\x20resolved\x20path','processedRows','json','Resolving\x20folder\x20\x27','Use:\x20tdx\x20ps\x20desc','cause','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','execute','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','format','getParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20Cause:\x20','folderId','parentFolder','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20segment:\x20','segmentPath','createFolder','✖\x20Query\x20failed\x20[','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segmentName','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','includes','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:view','fullPath','test','Creating\x20folder\x20\x27','Fetching\x20parent\x20segment\x20details...','Resolved\x20parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','2094005KuWLSI','Resolved\x20relative\x20path\x20to:\x20','9814797UHTzOE','getFolder','segment:folder:create','segment:folder:show','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','resolveFolderId','name','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Create\x20segment\x20folder\x20for\x20organization','Use:\x20tdx\x20ps\x20view\x20-w','parentId','Usage:\x20tdx\x20sg\x20desc\x20<name>','data','Show\x20folder\x20or\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20sql','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Parent\x20ID:\x20','✔\x20Query\x20completed:\x20Processed\x20','/app/ps/','SQL\x20query:\x0a','parentSegment','in\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Site:\x20','Use:\x20tdx\x20ps\x20view','green','Examples:','length','Usage:\x20tdx\x20sg\x20sql\x20<name>','message','getSegmentSQL','folder','site','Executing\x20segment\x20query...','Resolved\x20YAML\x20file:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20name:\x20','\x20\x20Folder\x20path:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','limit','resolveParentId','Fetching\x20segment\x20details...','segmentId','SEGMENT_FOLDER_NOT_FOUND','INVALID_ARGUMENT','7674750apsGgE','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','328ZUZXTx','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','cyan','/e/','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','resolvePathToResource','segment:sql','error','setJobId','\x27...','Error:\x20Path\x20or\x20name\x20is\x20required','81082fNPckh','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','trim','20BZknyT','code','Resolved\x20type:\x20','\x20rows\x20','stats','\x20\x20Full\x20path:\x20','segment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','getSegment','Segment\x20ID:\x20','segment:show','Folder\x20ID:\x20','type','11388443eybYeo','Error:\x20','log','Folder\x20ID\x20missing\x20from\x20resolved\x20path','4cWzXxo','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Folder\x20reference\x20is\x20required','Folder\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','83909BaiCNi','verbose','Target\x20path:\x20','\x20Opening\x20','query','\x27\x20with\x20ID:\x20','1759497MugDcb','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','information_schema','parent','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20folder\x20ID:\x20','Fetching\x20folder\x20\x27','Show\x20segment\x20or\x20folder\x20details','folderPath','2cbQtAb'];a25_0x48a6=function(){return _0x4419bb;};return a25_0x48a6();}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x29b0fd(0x113)]=a25_0x29b0fd(0x110);[a25_0x29b0fd(0xdd)]='Show\x20segment\x20folder\x20details';async[a25_0x29b0fd(0xe9)](_0x300adb){const _0x33b6c9=a25_0x29b0fd,{options:_0x4acec6,args:_0x132ded,tdx:_0x2c7dfa}=_0x300adb;if(_0x132ded['length']===0x0)return console[_0x33b6c9(0x14d)](_0x33b6c9(0xc9)),console[_0x33b6c9(0x14d)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x4e835e,childId:_0x2b6a83}=parseSegmentRef(_0x132ded[0x0]);_0x4acec6[_0x33b6c9(0xcd)]&&(console[_0x33b6c9(0x14d)](_0x33b6c9(0x12a)+_0x4acec6[_0x33b6c9(0x133)]),console[_0x33b6c9(0x14d)](_0x33b6c9(0x137)+_0x4e835e),_0x2b6a83&&console[_0x33b6c9(0x14d)]('Folder\x20name:\x20'+_0x2b6a83));if(!_0x2b6a83)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5fcd26=await withSpinner(_0x33b6c9(0x152)+_0x4e835e+_0x33b6c9(0x14f),()=>_0x2c7dfa[_0x33b6c9(0x15b)]['resolveParentId'](_0x4e835e),{'verbose':_0x4acec6[_0x33b6c9(0xcd)]}),_0x18c297=_0x5fcd26[_0x33b6c9(0x11a)];_0x4acec6[_0x33b6c9(0xcd)]&&console[_0x33b6c9(0x14d)](_0x33b6c9(0x106)+_0x18c297);const _0x9b36f1=await withSpinner(_0x33b6c9(0xe5)+_0x2b6a83+_0x33b6c9(0x14f),()=>_0x2c7dfa[_0x33b6c9(0x15b)][_0x33b6c9(0x112)](_0x18c297,_0x2b6a83),{'verbose':_0x4acec6[_0x33b6c9(0xcd)]}),_0x1e5d5f=_0x9b36f1['data'];_0x4acec6['verbose']&&console[_0x33b6c9(0x14d)](_0x33b6c9(0xd8)+_0x1e5d5f);const _0x790e02=await withSpinner(_0x33b6c9(0xd9)+_0x2b6a83+_0x33b6c9(0x14f),()=>_0x2c7dfa[_0x33b6c9(0x15b)][_0x33b6c9(0x10e)](_0x1e5d5f),{'verbose':_0x4acec6[_0x33b6c9(0xcd)]});return await handleSDKOutput([_0x790e02['data']],_0x4acec6),0x0;}catch(_0x1f5f8f){if(_0x1f5f8f instanceof SDKError)return console['error'](_0x33b6c9(0xc4)+_0x1f5f8f[_0x33b6c9(0x130)]),_0x1f5f8f[_0x33b6c9(0xe7)]&&console[_0x33b6c9(0x14d)]('\x20\x20Cause:\x20'+_0x1f5f8f[_0x33b6c9(0xe7)]),0x1;throw _0x1f5f8f;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x29b0fd(0x113)]=a25_0x29b0fd(0x14c);[a25_0x29b0fd(0xdd)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x29b0fd(0xe9)](_0x2751ee){const _0x47b1cf=a25_0x29b0fd,{options:_0x33b9b8,args:_0x3faab4,tdx:_0x4eac34}=_0x2751ee,_0x7fcf6f=_0x3faab4[0x0];if(!_0x7fcf6f)return console['error'](_0x47b1cf(0x11f)),console['error'](_0x47b1cf(0x12f)),console[_0x47b1cf(0x14d)](_0x47b1cf(0xf9)),console[_0x47b1cf(0x14d)](_0x47b1cf(0x12d)),console[_0x47b1cf(0x14d)](_0x47b1cf(0x120)),console['error'](_0x47b1cf(0x122)),0x1;try{const _0x4af21e=_0x33b9b8['parentSegment'],_0x310b97=await resolveSegmentTarget(_0x7fcf6f,_0x4af21e,_0x33b9b8[_0x47b1cf(0xcd)]);_0x33b9b8[_0x47b1cf(0xcd)]&&console['error'](_0x47b1cf(0xce)+_0x310b97);const _0x436dfd=await withSpinner('Resolving\x20\x27'+_0x7fcf6f+'\x27...',()=>_0x4eac34['segment'][_0x47b1cf(0x14b)](_0x310b97),{'verbose':_0x33b9b8[_0x47b1cf(0xcd)]}),_0x3818b4=_0x436dfd[_0x47b1cf(0x11a)];_0x33b9b8['verbose']&&(console['error'](_0x47b1cf(0x157)+_0x3818b4[_0x47b1cf(0xc2)]),console['error'](_0x47b1cf(0x123)+_0x3818b4['parentId']));if(_0x3818b4[_0x47b1cf(0xc2)]===_0x47b1cf(0x132))return console[_0x47b1cf(0x14d)](_0x47b1cf(0x111)),console['error'](_0x47b1cf(0x114)),0x1;if(_0x3818b4['type']===_0x47b1cf(0xd5))return console[_0x47b1cf(0x14d)](_0x47b1cf(0xd7)),console[_0x47b1cf(0x14d)](_0x47b1cf(0x11c)),0x1;if(!_0x3818b4[_0x47b1cf(0x13e)])throw new SDKError(ErrorCode[_0x47b1cf(0xdf)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x20f637=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4eac34[_0x47b1cf(0x15b)][_0x47b1cf(0x131)](_0x3818b4[_0x47b1cf(0x118)],_0x3818b4[_0x47b1cf(0x13e)]),{'verbose':_0x33b9b8[_0x47b1cf(0xcd)]}),_0x4a522d=_0x20f637[_0x47b1cf(0x11a)];return _0x33b9b8[_0x47b1cf(0xec)]===_0x47b1cf(0xe4)||_0x33b9b8['format']===_0x47b1cf(0xde)?await handleSDKOutput([{'sql':_0x4a522d}],_0x33b9b8):console[_0x47b1cf(0xc5)](_0x4a522d),0x0;}catch(_0x1be333){if(_0x1be333 instanceof SDKError)return console[_0x47b1cf(0x14d)]('Error:\x20'+_0x1be333['message']),_0x1be333[_0x47b1cf(0xe7)]&&console['error'](_0x47b1cf(0xef)+_0x1be333[_0x47b1cf(0xe7)]),0x1;throw _0x1be333;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x29b0fd(0x113)]=a25_0x29b0fd(0x10f);[a25_0x29b0fd(0xdd)]=a25_0x29b0fd(0x116);async['execute'](_0x193ade){const _0x1a1566=a25_0x29b0fd,{options:_0x2caf18,args:_0x44bd42,tdx:_0x2d6ab5}=_0x193ade,_0x438eb1=_0x2caf18;if(_0x44bd42[_0x1a1566(0x12e)]<0x2)return console[_0x1a1566(0x14d)](_0x1a1566(0x11d)),console['error'](_0x1a1566(0x153)),0x1;const _0x25bb6b=_0x44bd42[0x0],_0x424055=_0x44bd42[0x1];_0x438eb1[_0x1a1566(0xcd)]&&(console['error'](_0x1a1566(0x12a)+_0x438eb1[_0x1a1566(0x133)]),console[_0x1a1566(0x14d)](_0x1a1566(0xf4)+_0x25bb6b),console['error'](_0x1a1566(0xca)+_0x424055));let _0x4c5b56;if(_0x438eb1[_0x1a1566(0xf1)]){const _0x46cd2d=_0x438eb1[_0x1a1566(0xf1)],_0x4fbd64=await withSpinner(_0x1a1566(0x152)+_0x25bb6b+_0x1a1566(0x14f),()=>_0x2d6ab5[_0x1a1566(0x15b)][_0x1a1566(0x13c)](_0x25bb6b),{'verbose':_0x438eb1[_0x1a1566(0xcd)]}),_0x108f8a=_0x4fbd64[_0x1a1566(0x11a)],_0x437cb3=await withSpinner(_0x1a1566(0xd6)+_0x46cd2d+_0x1a1566(0x14f),()=>_0x2d6ab5['segment'][_0x1a1566(0x112)](_0x108f8a,_0x46cd2d),{'verbose':_0x438eb1[_0x1a1566(0xcd)]});_0x4c5b56=_0x437cb3[_0x1a1566(0x11a)],_0x438eb1[_0x1a1566(0xcd)]&&console[_0x1a1566(0x14d)](_0x1a1566(0xf3)+_0x4c5b56);}const _0xfeba02={'name':_0x424055,'description':_0x438eb1[_0x1a1566(0xdd)],'parentFolderId':_0x4c5b56},_0x423efd=await withSpinner(_0x1a1566(0x104)+_0x424055+_0x1a1566(0x14f),()=>_0x2d6ab5[_0x1a1566(0x15b)][_0x1a1566(0xf6)](_0x25bb6b,_0xfeba02),{'verbose':_0x438eb1[_0x1a1566(0xcd)]}),_0x205256=_0x423efd[_0x1a1566(0x11a)];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x205256[_0x1a1566(0x113)]+_0x1a1566(0xd1)+_0x205256['id']),await handleSDKOutput([_0x205256],_0x438eb1),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a25_0x29b0fd(0x101);[a25_0x29b0fd(0xdd)]=a25_0x29b0fd(0x11b);async['execute'](_0x294ebd){const _0x33edb5=a25_0x29b0fd,{options:_0x32941a,args:_0x562687,tdx:_0x98e67f}=_0x294ebd,_0x319ee7=_0x562687[0x0];if(!_0x319ee7)return console['error'](_0x33edb5(0xfd)),console[_0x33edb5(0x14d)](_0x33edb5(0x109)),console[_0x33edb5(0x14d)](_0x33edb5(0xfb)),console[_0x33edb5(0x14d)]('Options:'),console[_0x33edb5(0x14d)](_0x33edb5(0x100)),console['error'](_0x33edb5(0x12d)),console[_0x33edb5(0x14d)](_0x33edb5(0x14a)),console['error'](_0x33edb5(0x142)),console[_0x33edb5(0x14d)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x33edb5(0xe8)),0x1;try{const _0x109812=_0x32941a[_0x33edb5(0x127)],_0x2d9ad5=await resolveSegmentTarget(_0x319ee7,_0x109812,_0x32941a[_0x33edb5(0xcd)]);_0x32941a[_0x33edb5(0xcd)]&&console[_0x33edb5(0x14d)](_0x33edb5(0xce)+_0x2d9ad5);const _0x34e9f5=await withSpinner('Resolving\x20\x27'+_0x319ee7+_0x33edb5(0x14f),()=>_0x98e67f[_0x33edb5(0x15b)][_0x33edb5(0x14b)](_0x2d9ad5),{'verbose':_0x32941a[_0x33edb5(0xcd)]}),_0x3df01a=_0x34e9f5[_0x33edb5(0x11a)];_0x32941a['verbose']&&(console['error'](_0x33edb5(0x157)+_0x3df01a['type']),console['error'](_0x33edb5(0x123)+_0x3df01a[_0x33edb5(0x118)]),_0x3df01a['folderId']&&console[_0x33edb5(0x14d)](_0x33edb5(0xc1)+_0x3df01a[_0x33edb5(0xf0)]),_0x3df01a[_0x33edb5(0x13e)]&&console[_0x33edb5(0x14d)](_0x33edb5(0xbf)+_0x3df01a[_0x33edb5(0x13e)]));if(_0x32941a['web']){if(_0x3df01a[_0x33edb5(0xc2)]===_0x33edb5(0x132))return console['error'](_0x33edb5(0x115)),0x1;if(_0x3df01a[_0x33edb5(0xc2)]===_0x33edb5(0xd5))return console[_0x33edb5(0x14d)](_0x33edb5(0x143)),console['error'](_0x33edb5(0x117)),0x1;if(!_0x3df01a[_0x33edb5(0x13e)])throw new SDKError(ErrorCode[_0x33edb5(0xdf)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2e3a31=getConsoleNextUrl(_0x32941a['site'],_0x33edb5(0x125)+_0x3df01a[_0x33edb5(0x118)]+_0x33edb5(0x149)+_0x3df01a[_0x33edb5(0x13e)]);return console[_0x33edb5(0x14d)](a25_0x19b9f5[_0x33edb5(0x12c)]('✔')+_0x33edb5(0xcf)+a25_0x19b9f5[_0x33edb5(0x148)](_0x2e3a31)),openBrowser(_0x2e3a31),0x0;}if(_0x3df01a['type']===_0x33edb5(0x132)){if(!_0x3df01a[_0x33edb5(0xf0)])throw new SDKError(ErrorCode[_0x33edb5(0x13f)],_0x33edb5(0xc6));const _0x14c3cf=await withSpinner(_0x33edb5(0xff),()=>_0x98e67f[_0x33edb5(0x15b)][_0x33edb5(0x10e)](_0x3df01a[_0x33edb5(0xf0)]),{'verbose':_0x32941a[_0x33edb5(0xcd)]});await handleSingleObjectOutput(_0x14c3cf[_0x33edb5(0x11a)],_0x32941a);}else{if(_0x3df01a['type']===_0x33edb5(0x15b)){if(!_0x3df01a[_0x33edb5(0x13e)])throw new SDKError(ErrorCode[_0x33edb5(0xdf)],_0x33edb5(0xe2));const _0x210da9=await withSpinner(_0x33edb5(0x13d),()=>_0x98e67f[_0x33edb5(0x15b)][_0x33edb5(0xbe)](_0x3df01a[_0x33edb5(0x118)],_0x3df01a[_0x33edb5(0x13e)]),{'verbose':_0x32941a[_0x33edb5(0xcd)]}),_0x271516=getConsoleNextUrl(_0x32941a[_0x33edb5(0x133)],_0x33edb5(0x125)+_0x3df01a[_0x33edb5(0x118)]+_0x33edb5(0x149)+_0x3df01a[_0x33edb5(0x13e)]),_0x402fb2=_0x210da9['data'];_0x402fb2['url']=_0x271516,await handleSingleObjectOutput(_0x402fb2,_0x32941a);}else return console[_0x33edb5(0x14d)](_0x33edb5(0xea)),console[_0x33edb5(0x14d)](_0x33edb5(0x12b)),0x1;}return 0x0;}catch(_0x1a6871){if(_0x1a6871 instanceof SDKError)return console[_0x33edb5(0x14d)]('Error:\x20'+_0x1a6871[_0x33edb5(0x130)]),_0x1a6871['cause']&&console[_0x33edb5(0x14d)](_0x33edb5(0xef)+_0x1a6871[_0x33edb5(0xe7)]),0x1;throw _0x1a6871;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x29b0fd(0x113)]='segment:desc';[a25_0x29b0fd(0xdd)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a25_0x29b0fd(0xe9)](_0x1f1eca){const _0x31d273=a25_0x29b0fd,{options:_0x21c335,args:_0x19e159,tdx:_0x46e9e1}=_0x1f1eca,_0x2b9c23=_0x19e159[0x0];if(!_0x2b9c23)return console['error'](_0x31d273(0x11f)),console['error'](_0x31d273(0x119)),console[_0x31d273(0x14d)](_0x31d273(0xee)),console[_0x31d273(0x14d)](_0x31d273(0x12d)),console[_0x31d273(0x14d)](_0x31d273(0x10a)),console['error'](_0x31d273(0xeb)),0x1;try{const _0x58b477=_0x21c335['parentSegment'],_0x5b76c9=await resolveSegmentTarget(_0x2b9c23,_0x58b477,_0x21c335['verbose']);_0x21c335[_0x31d273(0xcd)]&&console[_0x31d273(0x14d)](_0x31d273(0xce)+_0x5b76c9);const _0x528f48=await withSpinner('Resolving\x20\x27'+_0x2b9c23+_0x31d273(0x14f),()=>_0x46e9e1[_0x31d273(0x15b)][_0x31d273(0x14b)](_0x5b76c9),{'verbose':_0x21c335[_0x31d273(0xcd)]}),_0x4cf142=_0x528f48['data'];_0x21c335[_0x31d273(0xcd)]&&(console[_0x31d273(0x14d)](_0x31d273(0x157)+_0x4cf142[_0x31d273(0xc2)]),console[_0x31d273(0x14d)](_0x31d273(0x123)+_0x4cf142['parentId']));if(_0x4cf142[_0x31d273(0xc2)]===_0x31d273(0x132))return console[_0x31d273(0x14d)](_0x31d273(0x147)),console[_0x31d273(0x14d)](_0x31d273(0x114)),0x1;if(_0x4cf142[_0x31d273(0xc2)]===_0x31d273(0xd5))return console[_0x31d273(0x14d)](_0x31d273(0xfe)),console[_0x31d273(0x14d)](_0x31d273(0xe6)),0x1;if(!_0x4cf142[_0x31d273(0x13e)])throw new SDKError(ErrorCode[_0x31d273(0xdf)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4bd8ce=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x46e9e1[_0x31d273(0x15b)][_0x31d273(0x131)](_0x4cf142[_0x31d273(0x118)],_0x4cf142[_0x31d273(0x13e)]),{'verbose':_0x21c335[_0x31d273(0xcd)]}),_0x2fd5b4=_0x4bd8ce['data'],_0x5c3903=await executeSchemaQuery(_0x2fd5b4,_0x46e9e1,_0x21c335);return await handleQueryOutput(_0x5c3903,_0x21c335),0x0;}catch(_0x45247a){if(_0x45247a instanceof SDKError)return console[_0x31d273(0x14d)]('Error:\x20'+_0x45247a['message']),_0x45247a['cause']&&console[_0x31d273(0x14d)]('\x20\x20Cause:\x20'+_0x45247a['cause']),0x1;throw _0x45247a;}}}
|
|
1
|
+
const a25_0x5180b4=a25_0x4f40;(function(_0x257f4c,_0x4bccf6){const _0x842cd8=a25_0x4f40,_0x579b7b=_0x257f4c();while(!![]){try{const _0x47dd8d=parseInt(_0x842cd8(0x15c))/0x1+parseInt(_0x842cd8(0x17e))/0x2+parseInt(_0x842cd8(0x14c))/0x3+parseInt(_0x842cd8(0x17a))/0x4*(parseInt(_0x842cd8(0x193))/0x5)+-parseInt(_0x842cd8(0x13d))/0x6+parseInt(_0x842cd8(0x19b))/0x7+parseInt(_0x842cd8(0x168))/0x8*(-parseInt(_0x842cd8(0x14d))/0x9);if(_0x47dd8d===_0x4bccf6)break;else _0x579b7b['push'](_0x579b7b['shift']());}catch(_0x326512){_0x579b7b['push'](_0x579b7b['shift']());}}}(a25_0x1fa1,0xe2b86));import{BaseCommand}from'./command.js';function a25_0x1fa1(){const _0x29a738=['jobId','folderId','Usage:\x20tdx\x20sg\x20desc\x20<name>','Create\x20segment\x20folder\x20for\x20organization','21712392bWxIYa','✔\x20Created\x20folder\x20\x27','Show\x20folder\x20or\x20child\x20segment\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','json','\x20\x20Segment\x20name:\x20','Resolving\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','Parent\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','segmentId','parentId','parentSegment','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','execute','getSegmentSQL','68756yHEFFM','fullPath','log','Fetching\x20folder\x20\x27','151964zmiqZG','Usage:\x20tdx\x20sg\x20show\x20<name>','site','Resolving\x20\x27','Resolved\x20YAML\x20file:\x20','message','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','description','Fetching\x20SQL\x20for\x20segment...','Parent\x20name:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','trim','(root)','\x20\x20Cause:\x20','folder','\x20Opening\x20','getFolder','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','✔\x20Found\x20','245fSvwxz','getParent','Use:\x20tdx\x20ps\x20view','segment:desc','segmentName','/e/','Fetching\x20segment\x20details...','Target\x20path:\x20','7930062nkPTBf','segmentPath','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Folder\x20ID:\x20','Options:','/app/ps/','Site:\x20','Use:\x20tdx\x20ps\x20sql','parentFolder','error','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','code','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','cause','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Path\x20or\x20name\x20is\x20required','getSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Show\x20child\x20segment\x20schema\x20(column\x20types)','resolveParentId','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','Resolving\x20path\x20\x27','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','verbose','\x27\x20with\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parent','format','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','name','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20folder\x20details...','includes','web','Resolved\x20folder\x20ID:\x20','Segment\x20ID:\x20','folderPath','segment','information_schema','Creating\x20folder\x20\x27','Resolved\x20type:\x20','data','INVALID_ARGUMENT','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','✖\x20Query\x20failed\x20[','resolvePathToResource','listFolders','Use:\x20tdx\x20ps\x20show','cyan','Show\x20segment\x20or\x20folder\x20details','type','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Parent\x20segment:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','2920902nmeHYQ','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','SEGMENT_NOT_FOUND','resolveFolderId','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:sql','query','\x27...','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_FOLDER_NOT_FOUND','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','setJobId','replace','4590645AgXvyo','9kgkFra','test','\x20\x20Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','stats','Resolved\x20parent\x20ID:\x20','segment:folder:create','\x20folder','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','limit','Use:\x20tdx\x20ps\x20view\x20-w','segment:view','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','length','548188ukjXoc','Folder\x20name:\x20','segment:folder:list','Listing\x20folders\x20for\x20parent\x20\x27','\x20rows\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'];a25_0x1fa1=function(){return _0x29a738;};return a25_0x1fa1();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a25_0x4f40(_0xfa9d06,_0x44220f){_0xfa9d06=_0xfa9d06-0x13d;const _0x1fa1b4=a25_0x1fa1();let _0x4f4063=_0x1fa1b4[_0xfa9d06];return _0x4f4063;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x2ed445 from'chalk';async function resolveSegmentTarget(_0x30ea65,_0x36c767,_0x315dbc){const _0x3aa182=a25_0x4f40;if(isYamlFilePath(_0x30ea65))try{const _0x4ff15b=await resolveYamlFilePath(_0x30ea65);return _0x315dbc&&(console[_0x3aa182(0x1a8)](_0x3aa182(0x182)+_0x30ea65),console[_0x3aa182(0x1a8)](_0x3aa182(0x1d8)+_0x4ff15b[_0x3aa182(0x174)]),console[_0x3aa182(0x1a8)](_0x3aa182(0x16d)+_0x4ff15b[_0x3aa182(0x197)]),console[_0x3aa182(0x1a8)](_0x3aa182(0x14f)+(_0x4ff15b[_0x3aa182(0x1c8)]||_0x3aa182(0x18a))),console['error']('\x20\x20Full\x20path:\x20'+_0x4ff15b[_0x3aa182(0x17b)])),_0x4ff15b['fullPath'];}catch(_0x41ae52){throw new SDKError(ErrorCode[_0x3aa182(0x1ce)],_0x3aa182(0x1b9)+_0x41ae52[_0x3aa182(0x183)]);}if(!_0x36c767)throw new SDKError(ErrorCode[_0x3aa182(0x1ce)],_0x3aa182(0x18f));return _0x36c767+'/'+_0x30ea65;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1d5);async[a25_0x5180b4(0x178)](_0x2b949f){const _0xbef1dd=a25_0x5180b4,{options:_0x29d9c7,args:_0xba7235,tdx:_0x4739f4}=_0x2b949f,_0x49f752=_0xba7235[0x0],_0xa03e9=!_0x49f752&&!!_0x29d9c7[_0xbef1dd(0x174)],_0x4e374c=_0x49f752||_0x29d9c7[_0xbef1dd(0x174)];if(!_0x4e374c)return console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1b0)),console[_0xbef1dd(0x1a8)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x19f)),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1a0)),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x161)),console[_0xbef1dd(0x1a8)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x1c0ebf=_0x29d9c7[_0xbef1dd(0x19c)];let _0x1260ab=_0x4e374c;!_0xa03e9&&_0x1c0ebf&&!_0x4e374c[_0xbef1dd(0x1c4)]('/')&&(_0x1260ab=_0x1c0ebf+'/'+_0x4e374c,_0x29d9c7[_0xbef1dd(0x1ba)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x175)+_0x1260ab));const _0x1d6ced=await withSpinner(_0xbef1dd(0x1b8)+_0x1260ab+_0xbef1dd(0x145),()=>_0x4739f4['segment'][_0xbef1dd(0x1d1)](_0x1260ab),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]}),_0x138e08=_0x1d6ced[_0xbef1dd(0x1cd)];_0x29d9c7[_0xbef1dd(0x1ba)]&&(console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1cc)+_0x138e08[_0xbef1dd(0x1d6)]),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x170)+_0x138e08['parentId']),_0x138e08['folderId']&&console['error'](_0xbef1dd(0x1a2)+_0x138e08[_0xbef1dd(0x165)]),_0x138e08[_0xbef1dd(0x172)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1c7)+_0x138e08[_0xbef1dd(0x172)]));if(_0x138e08[_0xbef1dd(0x1d6)]===_0xbef1dd(0x1bd)){const _0x59cf5d=await withSpinner(_0xbef1dd(0x171),()=>_0x4739f4[_0xbef1dd(0x1c9)][_0xbef1dd(0x194)](_0x138e08[_0xbef1dd(0x173)]),{'verbose':_0x29d9c7['verbose']});await handleSingleObjectOutput(_0x59cf5d[_0xbef1dd(0x1cd)],_0x29d9c7);}else{if(_0x138e08[_0xbef1dd(0x1d6)]===_0xbef1dd(0x18c)){if(!_0x138e08['folderId'])throw new SDKError(ErrorCode[_0xbef1dd(0x147)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x375a1c=await withSpinner(_0xbef1dd(0x1c3),()=>_0x4739f4[_0xbef1dd(0x1c9)][_0xbef1dd(0x18e)](_0x138e08[_0xbef1dd(0x165)]),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]});await handleSingleObjectOutput(_0x375a1c[_0xbef1dd(0x1cd)],_0x29d9c7);}else{if(_0x138e08['type']===_0xbef1dd(0x1c9)){if(!_0x138e08[_0xbef1dd(0x172)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xbef1dd(0x13e));const _0x3a3228=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4739f4[_0xbef1dd(0x1c9)]['getSegment'](_0x138e08[_0xbef1dd(0x173)],_0x138e08[_0xbef1dd(0x172)]),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]});await handleSingleObjectOutput(_0x3a3228[_0xbef1dd(0x1cd)],_0x29d9c7);}}}return 0x0;}catch(_0x53eff7){if(_0x53eff7 instanceof SDKError)return console['error'](_0xbef1dd(0x13f)+_0x53eff7[_0xbef1dd(0x183)]),_0x53eff7[_0xbef1dd(0x1ae)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x18b)+_0x53eff7[_0xbef1dd(0x1ae)]),0x1;throw _0x53eff7;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]='segment:show';['description']=a25_0x5180b4(0x16b);async['execute'](_0x469ed7){const _0x4f7b78=a25_0x5180b4,{options:_0x39400d,args:_0x2eb616,tdx:_0xcb60ad}=_0x469ed7,_0x3701ec=_0x2eb616[0x0];if(!_0x3701ec)return console[_0x4f7b78(0x1a8)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x17f)),console[_0x4f7b78(0x1a8)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x19f)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x146)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1b3)),0x1;try{const _0x7edf42=_0x39400d[_0x4f7b78(0x174)],_0x4ac3f5=await resolveSegmentTarget(_0x3701ec,_0x7edf42,_0x39400d[_0x4f7b78(0x1ba)]);_0x39400d[_0x4f7b78(0x1ba)]&&console[_0x4f7b78(0x1a8)](_0x4f7b78(0x19a)+_0x4ac3f5);const _0x3106d0=await withSpinner(_0x4f7b78(0x181)+_0x3701ec+_0x4f7b78(0x145),()=>_0xcb60ad[_0x4f7b78(0x1c9)]['resolvePathToResource'](_0x4ac3f5),{'verbose':_0x39400d[_0x4f7b78(0x1ba)]}),_0x5b038e=_0x3106d0[_0x4f7b78(0x1cd)];_0x39400d[_0x4f7b78(0x1ba)]&&(console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1cc)+_0x5b038e['type']),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x170)+_0x5b038e[_0x4f7b78(0x173)]));if(_0x5b038e[_0x4f7b78(0x1d6)]==='folder')return console['error'](_0x4f7b78(0x1c1)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1bf)),0x1;if(_0x5b038e['type']===_0x4f7b78(0x1bd))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1d3)),0x1;if(!_0x5b038e[_0x4f7b78(0x172)])throw new SDKError(ErrorCode[_0x4f7b78(0x140)],_0x4f7b78(0x13e));const _0x4bf4d0=await withSpinner(_0x4f7b78(0x186),()=>_0xcb60ad[_0x4f7b78(0x1c9)][_0x4f7b78(0x179)](_0x5b038e[_0x4f7b78(0x173)],_0x5b038e[_0x4f7b78(0x172)]),{'verbose':_0x39400d[_0x4f7b78(0x1ba)]});let _0x59ed88=_0x4bf4d0[_0x4f7b78(0x1cd)];const _0xf04482=resolveLimit(_0x39400d[_0x4f7b78(0x157)],DEFAULT_DISPLAY_LIMIT),_0xc27511=/\bLIMIT\s+\d+/i[_0x4f7b78(0x14e)](_0x59ed88);!_0xc27511&&(_0x59ed88=_0x59ed88[_0x4f7b78(0x189)]()[_0x4f7b78(0x14b)](/;+$/,''),_0x59ed88=_0x4f7b78(0x16f)+_0x59ed88+_0x4f7b78(0x1d9)+_0xf04482);_0x39400d[_0x4f7b78(0x1ba)]&&console['error']('SQL\x20query:\x0a'+_0x59ed88);const _0x1c3019=await withProgressSpinner(_0x4f7b78(0x148),async _0x2c0caf=>{const _0x55d22f=_0x4f7b78,_0x3f4ac4=await _0xcb60ad[_0x55d22f(0x144)][_0x55d22f(0x178)](_0x59ed88,{'catalog':'td','schema':_0x55d22f(0x1ca),'onJobId':_0x14cc21=>{const _0x349cf2=_0x55d22f;_0x2c0caf[_0x349cf2(0x14a)](_0x14cc21);}});return _0x3f4ac4;},{'verbose':_0x39400d[_0x4f7b78(0x1ba)]}),_0x254300=_0x1c3019[_0x4f7b78(0x1cd)],_0x151bce=_0x254300[_0x4f7b78(0x164)]?_0x4f7b78(0x1b6)+_0x254300[_0x4f7b78(0x164)]+']':'';return console[_0x4f7b78(0x1a8)](_0x4f7b78(0x149)+_0x254300['stats']['processedRows'][_0x4f7b78(0x191)]()+_0x4f7b78(0x160)+('in\x20'+formatElapsed(_0x254300[_0x4f7b78(0x152)]['elapsedTimeMillis'])+_0x151bce)),await handleQueryOutput(_0x254300,_0x39400d),0x0;}catch(_0x44e1c1){if(_0x44e1c1 instanceof SDKError)return console['error'](_0x4f7b78(0x1d0)+_0x44e1c1[_0x4f7b78(0x1ab)]+']'),console[_0x4f7b78(0x1a8)]('\x0a'+_0x44e1c1[_0x4f7b78(0x183)]),0x1;throw _0x44e1c1;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x15e);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1cf);async[a25_0x5180b4(0x178)](_0x2a6105){const _0x43afea=a25_0x5180b4,{options:_0x52b0d4,args:_0x5f3a6d,tdx:_0x3e0e25}=_0x2a6105;if(_0x5f3a6d['length']===0x0)return console[_0x43afea(0x1a8)](_0x43afea(0x1b2)),console['error'](_0x43afea(0x163)),0x1;const _0x502ea1=_0x5f3a6d[0x0];try{_0x52b0d4[_0x43afea(0x1ba)]&&(console[_0x43afea(0x1a8)](_0x43afea(0x1a5)+_0x52b0d4[_0x43afea(0x180)]),console['error'](_0x43afea(0x187)+_0x502ea1));const _0x5d71d3=await withSpinner(_0x43afea(0x16e)+_0x502ea1+_0x43afea(0x145),()=>_0x3e0e25[_0x43afea(0x1c9)][_0x43afea(0x1b5)](_0x502ea1),{'verbose':_0x52b0d4[_0x43afea(0x1ba)]}),_0x36986f=_0x5d71d3['data'];_0x52b0d4[_0x43afea(0x1ba)]&&console[_0x43afea(0x1a8)]('Resolved\x20parent\x20ID:\x20'+_0x36986f);const _0x2aac5b=await withSpinner(_0x43afea(0x15f)+_0x502ea1+'\x27...',()=>_0x3e0e25[_0x43afea(0x1c9)][_0x43afea(0x1d2)](_0x36986f),{'verbose':_0x52b0d4[_0x43afea(0x1ba)]}),_0x56df77=_0x2aac5b[_0x43afea(0x1cd)];return console[_0x43afea(0x1a8)](_0x43afea(0x192)+_0x56df77[_0x43afea(0x15b)]+_0x43afea(0x155)+(_0x56df77[_0x43afea(0x15b)]!==0x1?'s':'')),await handleSDKOutput(_0x56df77,_0x52b0d4),0x0;}catch(_0x3a8291){if(_0x3a8291 instanceof SDKError)return console[_0x43afea(0x1a8)](_0x43afea(0x13f)+_0x3a8291[_0x43afea(0x183)]),_0x3a8291['cause']&&console['error'](_0x43afea(0x18b)+_0x3a8291[_0x43afea(0x1ae)]),0x1;throw _0x3a8291;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]='segment:folder:show';[a25_0x5180b4(0x185)]='Show\x20segment\x20folder\x20details';async[a25_0x5180b4(0x178)](_0x1f2602){const _0x1b41b7=a25_0x5180b4,{options:_0x312e3f,args:_0x354abb,tdx:_0x373fa3}=_0x1f2602;if(_0x354abb[_0x1b41b7(0x15b)]===0x0)return console[_0x1b41b7(0x1a8)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x1b41b7(0x1a8)](_0x1b41b7(0x156)),0x1;try{const {parentId:_0x5100e6,childId:_0x158a7c}=parseSegmentRef(_0x354abb[0x0]);_0x312e3f['verbose']&&(console[_0x1b41b7(0x1a8)](_0x1b41b7(0x1a5)+_0x312e3f['site']),console['error'](_0x1b41b7(0x187)+_0x5100e6),_0x158a7c&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x15d)+_0x158a7c));if(!_0x158a7c)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x747c04=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5100e6+_0x1b41b7(0x145),()=>_0x373fa3[_0x1b41b7(0x1c9)]['resolveParentId'](_0x5100e6),{'verbose':_0x312e3f[_0x1b41b7(0x1ba)]}),_0x57ba1f=_0x747c04[_0x1b41b7(0x1cd)];_0x312e3f[_0x1b41b7(0x1ba)]&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x153)+_0x57ba1f);const _0x36a904=await withSpinner('Resolving\x20folder\x20\x27'+_0x158a7c+_0x1b41b7(0x145),()=>_0x373fa3['segment'][_0x1b41b7(0x141)](_0x57ba1f,_0x158a7c),{'verbose':_0x312e3f['verbose']}),_0x165b21=_0x36a904[_0x1b41b7(0x1cd)];_0x312e3f[_0x1b41b7(0x1ba)]&&console['error'](_0x1b41b7(0x1c6)+_0x165b21);const _0x3bf19d=await withSpinner(_0x1b41b7(0x17d)+_0x158a7c+_0x1b41b7(0x145),()=>_0x373fa3[_0x1b41b7(0x1c9)]['getFolder'](_0x165b21),{'verbose':_0x312e3f['verbose']});return await handleSDKOutput([_0x3bf19d[_0x1b41b7(0x1cd)]],_0x312e3f),0x0;}catch(_0x3ef871){if(_0x3ef871 instanceof SDKError)return console[_0x1b41b7(0x1a8)](_0x1b41b7(0x13f)+_0x3ef871[_0x1b41b7(0x183)]),_0x3ef871[_0x1b41b7(0x1ae)]&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x18b)+_0x3ef871[_0x1b41b7(0x1ae)]),0x1;throw _0x3ef871;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x143);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1d7);async[a25_0x5180b4(0x178)](_0x1a25ac){const _0x56ebab=a25_0x5180b4,{options:_0x99bb95,args:_0x38a133,tdx:_0x3b944d}=_0x1a25ac,_0x5d6ee0=_0x38a133[0x0];if(!_0x5d6ee0)return console[_0x56ebab(0x1a8)](_0x56ebab(0x1aa)),console['error'](_0x56ebab(0x1b7)),console[_0x56ebab(0x1a8)](_0x56ebab(0x1af)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19f)),console[_0x56ebab(0x1a8)](_0x56ebab(0x15a)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19e)),0x1;try{const _0x150f0d=_0x99bb95[_0x56ebab(0x174)],_0x57b2b7=await resolveSegmentTarget(_0x5d6ee0,_0x150f0d,_0x99bb95[_0x56ebab(0x1ba)]);_0x99bb95[_0x56ebab(0x1ba)]&&console[_0x56ebab(0x1a8)]('Target\x20path:\x20'+_0x57b2b7);const _0x6079cd=await withSpinner('Resolving\x20\x27'+_0x5d6ee0+_0x56ebab(0x145),()=>_0x3b944d[_0x56ebab(0x1c9)][_0x56ebab(0x1d1)](_0x57b2b7),{'verbose':_0x99bb95[_0x56ebab(0x1ba)]}),_0x1a879b=_0x6079cd[_0x56ebab(0x1cd)];_0x99bb95['verbose']&&(console['error'](_0x56ebab(0x1cc)+_0x1a879b[_0x56ebab(0x1d6)]),console[_0x56ebab(0x1a8)]('Parent\x20ID:\x20'+_0x1a879b[_0x56ebab(0x173)]));if(_0x1a879b[_0x56ebab(0x1d6)]===_0x56ebab(0x18c))return console['error'](_0x56ebab(0x184)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19d)),0x1;if(_0x1a879b[_0x56ebab(0x1d6)]===_0x56ebab(0x1bd))return console[_0x56ebab(0x1a8)](_0x56ebab(0x190)),console['error'](_0x56ebab(0x1a6)),0x1;if(!_0x1a879b[_0x56ebab(0x172)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56ebab(0x13e));const _0x22de17=await withSpinner(_0x56ebab(0x186),()=>_0x3b944d['segment'][_0x56ebab(0x179)](_0x1a879b[_0x56ebab(0x173)],_0x1a879b[_0x56ebab(0x172)]),{'verbose':_0x99bb95[_0x56ebab(0x1ba)]}),_0x1df827=_0x22de17[_0x56ebab(0x1cd)];return _0x99bb95[_0x56ebab(0x1be)]===_0x56ebab(0x16c)||_0x99bb95['format']==='jsonl'?await handleSDKOutput([{'sql':_0x1df827}],_0x99bb95):console[_0x56ebab(0x17c)](_0x1df827),0x0;}catch(_0xcd5a70){if(_0xcd5a70 instanceof SDKError)return console[_0x56ebab(0x1a8)](_0x56ebab(0x13f)+_0xcd5a70[_0x56ebab(0x183)]),_0xcd5a70['cause']&&console[_0x56ebab(0x1a8)](_0x56ebab(0x18b)+_0xcd5a70['cause']),0x1;throw _0xcd5a70;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x154);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x167);async[a25_0x5180b4(0x178)](_0x11b637){const _0x4a011d=a25_0x5180b4,{options:_0xde90d0,args:_0x5d67d0,tdx:_0x330c0b}=_0x11b637,_0x5f20cc=_0xde90d0;if(_0x5d67d0[_0x4a011d(0x15b)]<0x2)return console[_0x4a011d(0x1a8)](_0x4a011d(0x1ad)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x5c4572=_0x5d67d0[0x0],_0x5a2133=_0x5d67d0[0x1];_0x5f20cc['verbose']&&(console['error'](_0x4a011d(0x1a5)+_0x5f20cc[_0x4a011d(0x180)]),console[_0x4a011d(0x1a8)]('Parent\x20segment:\x20'+_0x5c4572),console[_0x4a011d(0x1a8)](_0x4a011d(0x15d)+_0x5a2133));let _0x368eef;if(_0x5f20cc[_0x4a011d(0x1a7)]){const _0xe3dd28=_0x5f20cc[_0x4a011d(0x1a7)],_0x56cb6f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c4572+_0x4a011d(0x145),()=>_0x330c0b[_0x4a011d(0x1c9)]['resolveParentId'](_0x5c4572),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]}),_0x4312cc=_0x56cb6f[_0x4a011d(0x1cd)],_0x5418ee=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xe3dd28+'\x27...',()=>_0x330c0b[_0x4a011d(0x1c9)]['resolveFolderId'](_0x4312cc,_0xe3dd28),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]});_0x368eef=_0x5418ee[_0x4a011d(0x1cd)],_0x5f20cc[_0x4a011d(0x1ba)]&&console[_0x4a011d(0x1a8)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x368eef);}const _0xc2c869={'name':_0x5a2133,'description':_0x5f20cc[_0x4a011d(0x185)],'parentFolderId':_0x368eef},_0x24764e=await withSpinner(_0x4a011d(0x1cb)+_0x5a2133+_0x4a011d(0x145),()=>_0x330c0b[_0x4a011d(0x1c9)]['createFolder'](_0x5c4572,_0xc2c869),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]}),_0x4db898=_0x24764e[_0x4a011d(0x1cd)];return console[_0x4a011d(0x1a8)](_0x4a011d(0x169)+_0x4db898[_0x4a011d(0x1c0)]+_0x4a011d(0x1bb)+_0x4db898['id']),await handleSDKOutput([_0x4db898],_0x5f20cc),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x159);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x16a);async['execute'](_0x52db71){const _0x47dc75=a25_0x5180b4,{options:_0x59b3a2,args:_0x245566,tdx:_0xa77d5b}=_0x52db71,_0x4e9b1c=_0x245566[0x0];if(!_0x4e9b1c)return console[_0x47dc75(0x1a8)](_0x47dc75(0x162)),console[_0x47dc75(0x1a8)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x47dc75(0x1a8)](_0x47dc75(0x150)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1a3)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1bc)),console['error'](_0x47dc75(0x19f)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1c2)),console[_0x47dc75(0x1a8)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x47dc75(0x1a8)](_0x47dc75(0x1a1)),console[_0x47dc75(0x1a8)](_0x47dc75(0x151)),0x1;try{const _0x543c3b=_0x59b3a2['parentSegment'],_0x1975ab=await resolveSegmentTarget(_0x4e9b1c,_0x543c3b,_0x59b3a2['verbose']);_0x59b3a2[_0x47dc75(0x1ba)]&&console[_0x47dc75(0x1a8)](_0x47dc75(0x19a)+_0x1975ab);const _0x4d79bf=await withSpinner(_0x47dc75(0x181)+_0x4e9b1c+_0x47dc75(0x145),()=>_0xa77d5b[_0x47dc75(0x1c9)][_0x47dc75(0x1d1)](_0x1975ab),{'verbose':_0x59b3a2['verbose']}),_0x593a5a=_0x4d79bf[_0x47dc75(0x1cd)];_0x59b3a2[_0x47dc75(0x1ba)]&&(console['error'](_0x47dc75(0x1cc)+_0x593a5a[_0x47dc75(0x1d6)]),console[_0x47dc75(0x1a8)](_0x47dc75(0x170)+_0x593a5a['parentId']),_0x593a5a[_0x47dc75(0x165)]&&console[_0x47dc75(0x1a8)]('Folder\x20ID:\x20'+_0x593a5a[_0x47dc75(0x165)]),_0x593a5a['segmentId']&&console[_0x47dc75(0x1a8)]('Segment\x20ID:\x20'+_0x593a5a['segmentId']));if(_0x59b3a2[_0x47dc75(0x1c5)]){if(_0x593a5a[_0x47dc75(0x1d6)]===_0x47dc75(0x18c))return console['error'](_0x47dc75(0x1ac)),0x1;if(_0x593a5a['type']===_0x47dc75(0x1bd))return console[_0x47dc75(0x1a8)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x47dc75(0x1a8)](_0x47dc75(0x158)),0x1;if(!_0x593a5a[_0x47dc75(0x172)])throw new SDKError(ErrorCode[_0x47dc75(0x140)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1b36ac=getConsoleNextUrl(_0x59b3a2[_0x47dc75(0x180)],'/app/ps/'+_0x593a5a[_0x47dc75(0x173)]+_0x47dc75(0x198)+_0x593a5a[_0x47dc75(0x172)]);return console[_0x47dc75(0x1a8)](a25_0x2ed445['green']('✔')+_0x47dc75(0x18d)+a25_0x2ed445[_0x47dc75(0x1d4)](_0x1b36ac)),openBrowser(_0x1b36ac),0x0;}if(_0x593a5a['type']===_0x47dc75(0x18c)){if(!_0x593a5a['folderId'])throw new SDKError(ErrorCode[_0x47dc75(0x147)],_0x47dc75(0x142));const _0x5d6ced=await withSpinner(_0x47dc75(0x1c3),()=>_0xa77d5b[_0x47dc75(0x1c9)]['getFolder'](_0x593a5a['folderId']),{'verbose':_0x59b3a2[_0x47dc75(0x1ba)]});await handleSingleObjectOutput(_0x5d6ced[_0x47dc75(0x1cd)],_0x59b3a2);}else{if(_0x593a5a[_0x47dc75(0x1d6)]===_0x47dc75(0x1c9)){if(!_0x593a5a['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x533002=await withSpinner(_0x47dc75(0x199),()=>_0xa77d5b[_0x47dc75(0x1c9)][_0x47dc75(0x1b1)](_0x593a5a[_0x47dc75(0x173)],_0x593a5a[_0x47dc75(0x172)]),{'verbose':_0x59b3a2[_0x47dc75(0x1ba)]}),_0x483b2d=getConsoleNextUrl(_0x59b3a2[_0x47dc75(0x180)],_0x47dc75(0x1a4)+_0x593a5a[_0x47dc75(0x173)]+_0x47dc75(0x198)+_0x593a5a[_0x47dc75(0x172)]),_0x150861=_0x533002[_0x47dc75(0x1cd)];_0x150861['url']=_0x483b2d,await handleSingleObjectOutput(_0x150861,_0x59b3a2);}else return console[_0x47dc75(0x1a8)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x47dc75(0x195)),0x1;}return 0x0;}catch(_0x207a79){if(_0x207a79 instanceof SDKError)return console[_0x47dc75(0x1a8)](_0x47dc75(0x13f)+_0x207a79[_0x47dc75(0x183)]),_0x207a79[_0x47dc75(0x1ae)]&&console[_0x47dc75(0x1a8)](_0x47dc75(0x18b)+_0x207a79[_0x47dc75(0x1ae)]),0x1;throw _0x207a79;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x196);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1b4);async['execute'](_0x5db59c){const _0x7890f0=a25_0x5180b4,{options:_0x2a4587,args:_0x212298,tdx:_0x4878b0}=_0x5db59c,_0x488263=_0x212298[0x0];if(!_0x488263)return console['error'](_0x7890f0(0x1aa)),console[_0x7890f0(0x1a8)](_0x7890f0(0x166)),console[_0x7890f0(0x1a8)](_0x7890f0(0x188)),console[_0x7890f0(0x1a8)](_0x7890f0(0x19f)),console[_0x7890f0(0x1a8)](_0x7890f0(0x177)),console[_0x7890f0(0x1a8)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x576a95=_0x2a4587[_0x7890f0(0x174)],_0x34ba27=await resolveSegmentTarget(_0x488263,_0x576a95,_0x2a4587[_0x7890f0(0x1ba)]);_0x2a4587[_0x7890f0(0x1ba)]&&console[_0x7890f0(0x1a8)](_0x7890f0(0x19a)+_0x34ba27);const _0xc63504=await withSpinner(_0x7890f0(0x181)+_0x488263+'\x27...',()=>_0x4878b0[_0x7890f0(0x1c9)][_0x7890f0(0x1d1)](_0x34ba27),{'verbose':_0x2a4587[_0x7890f0(0x1ba)]}),_0x1e4c1e=_0xc63504[_0x7890f0(0x1cd)];_0x2a4587['verbose']&&(console['error'](_0x7890f0(0x1cc)+_0x1e4c1e[_0x7890f0(0x1d6)]),console[_0x7890f0(0x1a8)](_0x7890f0(0x170)+_0x1e4c1e[_0x7890f0(0x173)]));if(_0x1e4c1e[_0x7890f0(0x1d6)]===_0x7890f0(0x18c))return console['error'](_0x7890f0(0x176)),console['error'](_0x7890f0(0x19d)),0x1;if(_0x1e4c1e['type']===_0x7890f0(0x1bd))return console[_0x7890f0(0x1a8)](_0x7890f0(0x1a9)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x1e4c1e[_0x7890f0(0x172)])throw new SDKError(ErrorCode[_0x7890f0(0x140)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1233f2=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4878b0['segment']['getSegmentSQL'](_0x1e4c1e[_0x7890f0(0x173)],_0x1e4c1e[_0x7890f0(0x172)]),{'verbose':_0x2a4587[_0x7890f0(0x1ba)]}),_0x1b67e4=_0x1233f2[_0x7890f0(0x1cd)],_0x59a162=await executeSchemaQuery(_0x1b67e4,_0x4878b0,_0x2a4587);return await handleQueryOutput(_0x59a162,_0x2a4587),0x0;}catch(_0x28729a){if(_0x28729a instanceof SDKError)return console[_0x7890f0(0x1a8)]('Error:\x20'+_0x28729a[_0x7890f0(0x183)]),_0x28729a[_0x7890f0(0x1ae)]&&console[_0x7890f0(0x1a8)](_0x7890f0(0x18b)+_0x28729a[_0x7890f0(0x1ae)]),0x1;throw _0x28729a;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a26_0x439b76=a26_0x2df2;(function(_0x48ad7b,_0x2bae97){const _0x532a6c=a26_0x2df2,_0x524e22=_0x48ad7b();while(!![]){try{const _0x262e72=parseInt(_0x532a6c(0x11f))/0x1+-parseInt(_0x532a6c(0x117))/0x2*(parseInt(_0x532a6c(0x127))/0x3)+-parseInt(_0x532a6c(0x130))/0x4*(parseInt(_0x532a6c(0x147))/0x5)+parseInt(_0x532a6c(0x13d))/0x6*(parseInt(_0x532a6c(0x13c))/0x7)+-parseInt(_0x532a6c(0x140))/0x8+-parseInt(_0x532a6c(0x134))/0x9*(-parseInt(_0x532a6c(0x14e))/0xa)+parseInt(_0x532a6c(0x14d))/0xb*(parseInt(_0x532a6c(0x13b))/0xc);if(_0x262e72===_0x2bae97)break;else _0x524e22['push'](_0x524e22['shift']());}catch(_0x41606d){_0x524e22['push'](_0x524e22['shift']());}}}(a26_0x7b5b,0xb19b0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x2df2(_0x236bf8,_0x4e7507){_0x236bf8=_0x236bf8-0x116;const _0x7b5b44=a26_0x7b5b();let _0x2df2ad=_0x7b5b44[_0x236bf8];return _0x2df2ad;}import{withSpinner}from'../utils/spinner.js';function a26_0x7b5b(){const _0x3e4fbd=['22cpLaxl','136370HeoKhY','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','289334JCgYHb','error','folderId','\x27...','invisible','Creating\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','894440NTaBib','description','verbose','createSegment','folder','Site:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','9UUMBfu','Create\x20child\x20segment\x20with\x20filtering\x20rules','segment','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','yellow','Parent\x20path:\x20','execute','data','4960976oDGSpl','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','153anioEL','segments','resolveParentId','Resolved\x20relative\x20path\x20to:\x20','noCountPopulation','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Examples:','4760796Gzolci','7aJYIiK','5986866aVtVTx','rule','type','4126632NDBFNC','kind','ruleFile','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20folder\x20\x27','resolvePathToResource','\x27\x20with\x20ID:\x20','5QiUStR','Parent:\x20','Segment\x20name:\x20','segment:create','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','length'];a26_0x7b5b=function(){return _0x3e4fbd;};return a26_0x7b5b();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x575eae from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a26_0x439b76(0x14a);[a26_0x439b76(0x120)]=a26_0x439b76(0x128);async[a26_0x439b76(0x12e)](_0x42f912){const _0x2ab989=a26_0x439b76;console[_0x2ab989(0x118)](a26_0x575eae[_0x2ab989(0x12c)](_0x2ab989(0x14b))),console[_0x2ab989(0x118)](a26_0x575eae[_0x2ab989(0x12c)](_0x2ab989(0x139)));const {options:_0x4c96d0,args:_0x150172,tdx:_0x1f026d}=_0x42f912,_0x16ad07=_0x4c96d0;if(_0x150172[_0x2ab989(0x14c)]===0x0)return console[_0x2ab989(0x118)](_0x2ab989(0x12a)),console[_0x2ab989(0x118)](_0x2ab989(0x11e)),console[_0x2ab989(0x118)](_0x2ab989(0x13a)),console[_0x2ab989(0x118)](_0x2ab989(0x131)),console[_0x2ab989(0x118)](_0x2ab989(0x126)),console[_0x2ab989(0x118)](_0x2ab989(0x11d)),0x1;const _0x5749d3=_0x150172[0x0],_0x4e6b03=_0x4c96d0['segmentPath'];let _0xe9723=_0x5749d3;_0x4e6b03&&!_0x5749d3['includes']('/')&&(_0xe9723=_0x4e6b03+'/'+_0x5749d3,_0x16ad07['verbose']&&console[_0x2ab989(0x118)](_0x2ab989(0x137)+_0xe9723));const _0x278165=parsePath(_0xe9723);if(_0x278165[_0x2ab989(0x135)][_0x2ab989(0x14c)]<0x2)return console['error'](_0x2ab989(0x143)),console[_0x2ab989(0x118)](_0x2ab989(0x116)),0x1;const _0x3325bf=_0x278165['segments'][0x0],_0x437a60=getBaseName(_0xe9723),_0x707b86=getParentPath(_0xe9723);_0x16ad07['verbose']&&(console['error'](_0x2ab989(0x124)+_0x16ad07['site']),console[_0x2ab989(0x118)]('Target\x20path:\x20'+_0xe9723),console[_0x2ab989(0x118)](_0x2ab989(0x148)+_0x3325bf),console[_0x2ab989(0x118)](_0x2ab989(0x149)+_0x437a60),console[_0x2ab989(0x118)](_0x2ab989(0x12d)+_0x707b86));const _0x319cc3=await withSpinner(_0x2ab989(0x125)+_0x3325bf+'\x27...',()=>_0x1f026d[_0x2ab989(0x129)][_0x2ab989(0x136)](_0x3325bf),{'verbose':_0x16ad07[_0x2ab989(0x121)]}),_0x5573db=_0x319cc3['data'];let _0x5d1bbb;if(_0x278165[_0x2ab989(0x135)][_0x2ab989(0x14c)]>0x2){const _0x1ce701=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x707b86+_0x2ab989(0x11a),()=>_0x1f026d[_0x2ab989(0x129)][_0x2ab989(0x145)](_0x707b86),{'verbose':_0x16ad07[_0x2ab989(0x121)]}),_0x1f78c6=_0x1ce701['data'];if(_0x1f78c6[_0x2ab989(0x13f)]!=='folder'&&_0x1f78c6['type']!=='parent')return console['error'](_0x2ab989(0x12b)),0x1;_0x5d1bbb=_0x1f78c6[_0x2ab989(0x119)];}else{if(_0x16ad07[_0x2ab989(0x123)]){const _0x51df23=await withSpinner(_0x2ab989(0x144)+_0x16ad07['folder']+_0x2ab989(0x11a),()=>_0x1f026d[_0x2ab989(0x129)]['resolveFolderId'](_0x5573db,_0x16ad07[_0x2ab989(0x123)]),{'verbose':_0x16ad07[_0x2ab989(0x121)]});_0x5d1bbb=_0x51df23[_0x2ab989(0x12f)];}}_0x16ad07[_0x2ab989(0x121)]&&_0x5d1bbb&&console[_0x2ab989(0x118)](_0x2ab989(0x133)+_0x5d1bbb);const _0x496ef5=await loadJSONFromOptions(_0x16ad07[_0x2ab989(0x13e)],_0x16ad07[_0x2ab989(0x142)]),_0x20a164={'name':_0x437a60,'description':_0x16ad07[_0x2ab989(0x120)],'rule':_0x496ef5,'kind':_0x16ad07['kind']!==undefined?parseInt(_0x16ad07[_0x2ab989(0x141)],0xa):undefined,'isVisible':_0x16ad07[_0x2ab989(0x11b)]?![]:undefined,'segmentFolderId':_0x5d1bbb,'countPopulation':_0x16ad07[_0x2ab989(0x138)]?![]:undefined},_0x45fc2d=await withSpinner(_0x2ab989(0x11c)+_0x437a60+_0x2ab989(0x11a),()=>_0x1f026d[_0x2ab989(0x129)][_0x2ab989(0x122)](_0x5573db,_0x20a164),{'verbose':_0x16ad07[_0x2ab989(0x121)]}),_0x98e594=_0x45fc2d[_0x2ab989(0x12f)];return console['error'](_0x2ab989(0x132)+_0x98e594['name']+_0x2ab989(0x146)+_0x98e594['id']),_0xe9723!==_0x5749d3&&console[_0x2ab989(0x118)]('\x20\x20\x20Path:\x20'+_0xe9723),await handleSDKOutput([_0x98e594],_0x16ad07),0x0;}}
|