@treasuredata/tdx 0.14.3 → 0.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/claude-usage-tracker.js.map +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.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.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.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 a25_0x288065=a25_0x561c;(function(_0x1911e8,_0x330b18){const _0x2686ad=a25_0x561c,_0x5b6cc3=_0x1911e8();while(!![]){try{const _0x10fdaa=parseInt(_0x2686ad(0x1c7))/0x1+-parseInt(_0x2686ad(0x221))/0x2+parseInt(_0x2686ad(0x229))/0x3+parseInt(_0x2686ad(0x201))/0x4*(-parseInt(_0x2686ad(0x21a))/0x5)+-parseInt(_0x2686ad(0x1e5))/0x6*(parseInt(_0x2686ad(0x215))/0x7)+parseInt(_0x2686ad(0x1e3))/0x8+parseInt(_0x2686ad(0x1bd))/0x9;if(_0x10fdaa===_0x330b18)break;else _0x5b6cc3['push'](_0x5b6cc3['shift']());}catch(_0x48d37e){_0x5b6cc3['push'](_0x5b6cc3['shift']());}}}(a25_0x3390,0x49b00));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';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_0x3e730a from'chalk';async function resolveSegmentTarget(_0x38ac81,_0x470330,_0x5a0800){const _0x16e07c=a25_0x561c;if(isYamlFilePath(_0x38ac81))try{const _0x31ab08=await resolveYamlFilePath(_0x38ac81);return _0x5a0800&&(console[_0x16e07c(0x202)](_0x16e07c(0x1ee)+_0x38ac81),console[_0x16e07c(0x202)](_0x16e07c(0x1ed)+_0x31ab08[_0x16e07c(0x21b)]),console[_0x16e07c(0x202)](_0x16e07c(0x21f)+_0x31ab08['segmentName']),console[_0x16e07c(0x202)]('\x20\x20Folder\x20path:\x20'+(_0x31ab08['folderPath']||_0x16e07c(0x1bf))),console[_0x16e07c(0x202)]('\x20\x20Full\x20path:\x20'+_0x31ab08[_0x16e07c(0x1dc)])),_0x31ab08[_0x16e07c(0x1dc)];}catch(_0x9d9f10){throw new SDKError(ErrorCode[_0x16e07c(0x1d8)],_0x16e07c(0x242)+_0x9d9f10['message']);}if(!_0x470330)throw new SDKError(ErrorCode[_0x16e07c(0x1d8)],_0x16e07c(0x217));return _0x470330+'/'+_0x38ac81;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x288065(0x233)]='segment:describe';['description']=a25_0x288065(0x234);async[a25_0x288065(0x222)](_0x159c23){const _0x175344=a25_0x288065,{options:_0xcb18d7,args:_0x5b8c7e,tdx:_0x177bff}=_0x159c23,_0x1caa22=_0x5b8c7e[0x0],_0x160cb4=!_0x1caa22&&!!_0xcb18d7[_0x175344(0x21b)],_0xb9b95d=_0x1caa22||_0xcb18d7[_0x175344(0x21b)];if(!_0xb9b95d)return console[_0x175344(0x202)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x175344(0x202)](_0x175344(0x20d)),console[_0x175344(0x202)](_0x175344(0x211)),console[_0x175344(0x202)](_0x175344(0x1f2)),console[_0x175344(0x202)](_0x175344(0x246)),console[_0x175344(0x202)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x175344(0x202)](_0x175344(0x23d)),0x1;try{const _0x384af8=_0xcb18d7['segmentPath'];let _0x2b7af6=_0xb9b95d;!_0x160cb4&&_0x384af8&&!_0xb9b95d['includes']('/')&&(_0x2b7af6=_0x384af8+'/'+_0xb9b95d,_0xcb18d7['verbose']&&console[_0x175344(0x202)](_0x175344(0x1d2)+_0x2b7af6));const _0x5d70a8=await withSpinner(_0x175344(0x22f)+_0x2b7af6+_0x175344(0x1f4),()=>_0x177bff[_0x175344(0x20c)][_0x175344(0x1c6)](_0x2b7af6),{'verbose':_0xcb18d7[_0x175344(0x1e0)]}),_0x2f1ff8=_0x5d70a8[_0x175344(0x23a)];_0xcb18d7['verbose']&&(console[_0x175344(0x202)]('Resolved\x20type:\x20'+_0x2f1ff8['type']),console[_0x175344(0x202)](_0x175344(0x22c)+_0x2f1ff8[_0x175344(0x24e)]),_0x2f1ff8[_0x175344(0x243)]&&console[_0x175344(0x202)](_0x175344(0x1e2)+_0x2f1ff8[_0x175344(0x243)]),_0x2f1ff8[_0x175344(0x1ba)]&&console['error']('Segment\x20ID:\x20'+_0x2f1ff8[_0x175344(0x1ba)]));if(_0x2f1ff8[_0x175344(0x1c1)]===_0x175344(0x255)){const _0x2faf37=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x177bff['segment'][_0x175344(0x1cc)](_0x2f1ff8['parentId']),{'verbose':_0xcb18d7[_0x175344(0x1e0)]});await handleSingleObjectOutput(_0x2faf37[_0x175344(0x23a)],_0xcb18d7);}else{if(_0x2f1ff8[_0x175344(0x1c1)]===_0x175344(0x227)){if(!_0x2f1ff8[_0x175344(0x243)])throw new SDKError(ErrorCode[_0x175344(0x216)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5f2ca5=await withSpinner(_0x175344(0x1d1),()=>_0x177bff[_0x175344(0x20c)][_0x175344(0x1dd)](_0x2f1ff8['folderId']),{'verbose':_0xcb18d7[_0x175344(0x1e0)]});await handleSingleObjectOutput(_0x5f2ca5['data'],_0xcb18d7);}else{if(_0x2f1ff8[_0x175344(0x1c1)]===_0x175344(0x20c)){if(!_0x2f1ff8[_0x175344(0x1ba)])throw new SDKError(ErrorCode[_0x175344(0x251)],_0x175344(0x23e));const _0x548ef3=await withSpinner('Fetching\x20segment\x20details...',()=>_0x177bff[_0x175344(0x20c)]['getSegment'](_0x2f1ff8[_0x175344(0x24e)],_0x2f1ff8['segmentId']),{'verbose':_0xcb18d7['verbose']});await handleSingleObjectOutput(_0x548ef3[_0x175344(0x23a)],_0xcb18d7);}}}return 0x0;}catch(_0x3b82dc){if(_0x3b82dc instanceof SDKError)return console['error'](_0x175344(0x1c5)+_0x3b82dc[_0x175344(0x256)]),_0x3b82dc[_0x175344(0x232)]&&console[_0x175344(0x202)]('\x20\x20Cause:\x20'+_0x3b82dc[_0x175344(0x232)]),0x1;throw _0x3b82dc;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x288065(0x233)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a25_0x288065(0x222)](_0x3a9e93){const _0x1e8107=a25_0x288065,{options:_0x5ae287,args:_0x87f429,tdx:_0xdc1ee9}=_0x3a9e93,_0x9aad9f=_0x87f429[0x0];if(!_0x9aad9f)return console[_0x1e8107(0x202)](_0x1e8107(0x24d)),console['error'](_0x1e8107(0x1c8)),console[_0x1e8107(0x202)](_0x1e8107(0x1de)),console[_0x1e8107(0x202)](_0x1e8107(0x211)),console[_0x1e8107(0x202)](_0x1e8107(0x213)),console[_0x1e8107(0x202)](_0x1e8107(0x23f)),0x1;try{const _0x365e08=_0x5ae287[_0x1e8107(0x21b)],_0x1863af=await resolveSegmentTarget(_0x9aad9f,_0x365e08,_0x5ae287[_0x1e8107(0x1e0)]);_0x5ae287['verbose']&&console[_0x1e8107(0x202)](_0x1e8107(0x1fb)+_0x1863af);const _0x146ccd=await withSpinner(_0x1e8107(0x1ce)+_0x9aad9f+_0x1e8107(0x1f4),()=>_0xdc1ee9[_0x1e8107(0x20c)][_0x1e8107(0x1c6)](_0x1863af),{'verbose':_0x5ae287['verbose']}),_0x3351ea=_0x146ccd[_0x1e8107(0x23a)];_0x5ae287[_0x1e8107(0x1e0)]&&(console[_0x1e8107(0x202)](_0x1e8107(0x1f1)+_0x3351ea[_0x1e8107(0x1c1)]),console[_0x1e8107(0x202)](_0x1e8107(0x22c)+_0x3351ea[_0x1e8107(0x24e)]));if(_0x3351ea['type']===_0x1e8107(0x227))return console['error'](_0x1e8107(0x1e4)),console[_0x1e8107(0x202)](_0x1e8107(0x1d4)),0x1;if(_0x3351ea[_0x1e8107(0x1c1)]===_0x1e8107(0x255))return console[_0x1e8107(0x202)](_0x1e8107(0x205)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3351ea['segmentId'])throw new SDKError(ErrorCode[_0x1e8107(0x251)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2e6f18=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xdc1ee9[_0x1e8107(0x20c)][_0x1e8107(0x1cf)](_0x3351ea[_0x1e8107(0x24e)],_0x3351ea[_0x1e8107(0x1ba)]),{'verbose':_0x5ae287[_0x1e8107(0x1e0)]});let _0x4d1cff=_0x2e6f18['data'];const _0x1c4d8c=resolveLimit(_0x5ae287['limit'],DEFAULT_DISPLAY_LIMIT),_0x87c235=/\bLIMIT\s+\d+/i[_0x1e8107(0x241)](_0x4d1cff);!_0x87c235&&(_0x4d1cff=_0x4d1cff[_0x1e8107(0x248)]()[_0x1e8107(0x239)](/;+$/,''),_0x4d1cff='SELECT\x20*\x20FROM\x20(\x0a'+_0x4d1cff+_0x1e8107(0x1c0)+_0x1c4d8c);_0x5ae287[_0x1e8107(0x1e0)]&&console[_0x1e8107(0x202)](_0x1e8107(0x1fc)+_0x4d1cff);const _0x357cb9=await withProgressSpinner(_0x1e8107(0x1ec),async _0xebec26=>{const _0x60c046=_0x1e8107,_0x1bba4b=await _0xdc1ee9[_0x60c046(0x22d)][_0x60c046(0x222)](_0x4d1cff,{'catalog':'td','schema':'information_schema','onJobId':_0x55acc7=>{const _0x24c358=_0x60c046;_0xebec26[_0x24c358(0x1da)](_0x55acc7);}});return _0x1bba4b;},{'verbose':_0x5ae287[_0x1e8107(0x1e0)]}),_0x52b71b=_0x357cb9[_0x1e8107(0x23a)],_0x1086bc=_0x52b71b[_0x1e8107(0x230)]?_0x1e8107(0x1c9)+_0x52b71b[_0x1e8107(0x230)]+']':'';return console['error'](_0x1e8107(0x219)+_0x52b71b[_0x1e8107(0x24f)]['processedRows'][_0x1e8107(0x1f7)]()+_0x1e8107(0x1e6)+(_0x1e8107(0x226)+formatElapsed(_0x52b71b[_0x1e8107(0x24f)][_0x1e8107(0x231)])+_0x1086bc)),await handleQueryOutput(_0x52b71b,_0x5ae287),0x0;}catch(_0x2516d4){if(_0x2516d4 instanceof SDKError)return console[_0x1e8107(0x202)](_0x1e8107(0x24a)+_0x2516d4[_0x1e8107(0x1d0)]+']'),console[_0x1e8107(0x202)]('\x0a'+_0x2516d4[_0x1e8107(0x256)]),0x1;throw _0x2516d4;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x288065(0x233)]=a25_0x288065(0x1f9);[a25_0x288065(0x1e8)]=a25_0x288065(0x1fa);async[a25_0x288065(0x222)](_0x3e9d03){const _0x24a281=a25_0x288065,{options:_0x12c926,args:_0x1e6038,tdx:_0x42e274}=_0x3e9d03;if(_0x1e6038[_0x24a281(0x210)]===0x0)return console['error'](_0x24a281(0x1ca)),console['error'](_0x24a281(0x20e)),0x1;const _0x1dc154=_0x1e6038[0x0];try{_0x12c926[_0x24a281(0x1e0)]&&(console['error'](_0x24a281(0x1d6)+_0x12c926[_0x24a281(0x235)]),console[_0x24a281(0x202)](_0x24a281(0x21d)+_0x1dc154));const _0x5bc0a8=await withSpinner(_0x24a281(0x250)+_0x1dc154+_0x24a281(0x1f4),()=>_0x42e274[_0x24a281(0x20c)][_0x24a281(0x21e)](_0x1dc154),{'verbose':_0x12c926['verbose']}),_0x2b724f=_0x5bc0a8['data'];_0x12c926[_0x24a281(0x1e0)]&&console[_0x24a281(0x202)](_0x24a281(0x220)+_0x2b724f);const _0x5738e4=await withSpinner(_0x24a281(0x1e7)+_0x1dc154+_0x24a281(0x1f4),()=>_0x42e274['segment'][_0x24a281(0x206)](_0x2b724f),{'verbose':_0x12c926[_0x24a281(0x1e0)]}),_0x41500f=_0x5738e4[_0x24a281(0x23a)];return console[_0x24a281(0x202)](_0x24a281(0x24c)+_0x41500f['length']+_0x24a281(0x237)+(_0x41500f[_0x24a281(0x210)]!==0x1?'s':'')),await handleSDKOutput(_0x41500f,_0x12c926),0x0;}catch(_0x28cdfc){if(_0x28cdfc instanceof SDKError)return console[_0x24a281(0x202)](_0x24a281(0x1c5)+_0x28cdfc[_0x24a281(0x256)]),_0x28cdfc[_0x24a281(0x232)]&&console[_0x24a281(0x202)](_0x24a281(0x1ff)+_0x28cdfc[_0x24a281(0x232)]),0x1;throw _0x28cdfc;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x288065(0x233)]='segment:folder:show';['description']=a25_0x288065(0x1c3);async[a25_0x288065(0x222)](_0x236bc7){const _0x32ade6=a25_0x288065,{options:_0x1e3408,args:_0x113c7b,tdx:_0x4a47a3}=_0x236bc7;if(_0x113c7b[_0x32ade6(0x210)]===0x0)return console[_0x32ade6(0x202)](_0x32ade6(0x1f0)),console['error'](_0x32ade6(0x253)),0x1;try{const {parentId:_0xf38790,childId:_0x5176a8}=parseSegmentRef(_0x113c7b[0x0]);_0x1e3408['verbose']&&(console[_0x32ade6(0x202)](_0x32ade6(0x1d6)+_0x1e3408['site']),console[_0x32ade6(0x202)](_0x32ade6(0x21d)+_0xf38790),_0x5176a8&&console[_0x32ade6(0x202)](_0x32ade6(0x23b)+_0x5176a8));if(!_0x5176a8)return console[_0x32ade6(0x202)](_0x32ade6(0x1ea)),0x1;const _0x4cfc9a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf38790+_0x32ade6(0x1f4),()=>_0x4a47a3[_0x32ade6(0x20c)][_0x32ade6(0x21e)](_0xf38790),{'verbose':_0x1e3408[_0x32ade6(0x1e0)]}),_0x8c003=_0x4cfc9a['data'];_0x1e3408[_0x32ade6(0x1e0)]&&console[_0x32ade6(0x202)](_0x32ade6(0x220)+_0x8c003);const _0x487055=await withSpinner(_0x32ade6(0x257)+_0x5176a8+_0x32ade6(0x1f4),()=>_0x4a47a3[_0x32ade6(0x20c)][_0x32ade6(0x224)](_0x8c003,_0x5176a8),{'verbose':_0x1e3408[_0x32ade6(0x1e0)]}),_0x23726e=_0x487055['data'];_0x1e3408[_0x32ade6(0x1e0)]&&console[_0x32ade6(0x202)](_0x32ade6(0x1f3)+_0x23726e);const _0x312c46=await withSpinner(_0x32ade6(0x209)+_0x5176a8+'\x27...',()=>_0x4a47a3[_0x32ade6(0x20c)]['getFolder'](_0x23726e),{'verbose':_0x1e3408['verbose']});return await handleSDKOutput([_0x312c46['data']],_0x1e3408),0x0;}catch(_0x374fd4){if(_0x374fd4 instanceof SDKError)return console[_0x32ade6(0x202)](_0x32ade6(0x1c5)+_0x374fd4[_0x32ade6(0x256)]),_0x374fd4['cause']&&console[_0x32ade6(0x202)](_0x32ade6(0x1ff)+_0x374fd4[_0x32ade6(0x232)]),0x1;throw _0x374fd4;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x288065(0x233)]=a25_0x288065(0x1e1);[a25_0x288065(0x1e8)]=a25_0x288065(0x1f6);async[a25_0x288065(0x222)](_0x4631fa){const _0x5d660d=a25_0x288065,{options:_0x20b2cc,args:_0x1f1b3e,tdx:_0x56a761}=_0x4631fa,_0x528dbf=_0x1f1b3e[0x0];if(!_0x528dbf)return console[_0x5d660d(0x202)](_0x5d660d(0x24d)),console[_0x5d660d(0x202)](_0x5d660d(0x204)),console[_0x5d660d(0x202)](_0x5d660d(0x245)),console[_0x5d660d(0x202)]('Examples:'),console[_0x5d660d(0x202)](_0x5d660d(0x1c2)),console['error'](_0x5d660d(0x247)),0x1;try{const _0x4b694d=_0x20b2cc[_0x5d660d(0x21b)],_0x1c45b0=await resolveSegmentTarget(_0x528dbf,_0x4b694d,_0x20b2cc[_0x5d660d(0x1e0)]);_0x20b2cc[_0x5d660d(0x1e0)]&&console[_0x5d660d(0x202)](_0x5d660d(0x1fb)+_0x1c45b0);const _0x257987=await withSpinner(_0x5d660d(0x1ce)+_0x528dbf+_0x5d660d(0x1f4),()=>_0x56a761[_0x5d660d(0x20c)]['resolvePathToResource'](_0x1c45b0),{'verbose':_0x20b2cc[_0x5d660d(0x1e0)]}),_0x463f2d=_0x257987[_0x5d660d(0x23a)];_0x20b2cc[_0x5d660d(0x1e0)]&&(console['error'](_0x5d660d(0x1f1)+_0x463f2d[_0x5d660d(0x1c1)]),console[_0x5d660d(0x202)](_0x5d660d(0x22c)+_0x463f2d['parentId']));if(_0x463f2d[_0x5d660d(0x1c1)]===_0x5d660d(0x227))return console[_0x5d660d(0x202)](_0x5d660d(0x207)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x463f2d['type']===_0x5d660d(0x255))return console[_0x5d660d(0x202)](_0x5d660d(0x1cb)),console[_0x5d660d(0x202)](_0x5d660d(0x252)),0x1;if(!_0x463f2d['segmentId'])throw new SDKError(ErrorCode[_0x5d660d(0x251)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x43d052=await withSpinner(_0x5d660d(0x214),()=>_0x56a761['segment'][_0x5d660d(0x1cf)](_0x463f2d['parentId'],_0x463f2d[_0x5d660d(0x1ba)]),{'verbose':_0x20b2cc[_0x5d660d(0x1e0)]}),_0x5551c3=_0x43d052['data'];return _0x20b2cc['format']===_0x5d660d(0x1f8)||_0x20b2cc['format']==='jsonl'?await handleSDKOutput([{'sql':_0x5551c3}],_0x20b2cc):console[_0x5d660d(0x1be)](_0x5551c3),0x0;}catch(_0x3abf40){if(_0x3abf40 instanceof SDKError)return console[_0x5d660d(0x202)](_0x5d660d(0x1c5)+_0x3abf40['message']),_0x3abf40['cause']&&console[_0x5d660d(0x202)](_0x5d660d(0x1ff)+_0x3abf40[_0x5d660d(0x232)]),0x1;throw _0x3abf40;}}}function a25_0x561c(_0x1f2e15,_0x2c7ece){_0x1f2e15=_0x1f2e15-0x1ba;const _0x3390d2=a25_0x3390();let _0x561ccc=_0x3390d2[_0x1f2e15];return _0x561ccc;}function a25_0x3390(){const _0xaaf216=['Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','18AywYBH','\x20rows\x20','Listing\x20folders\x20for\x20parent\x20\x27','description','segment:folder:create','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','/app/ps/','Executing\x20segment\x20query...','\x20\x20Parent\x20segment:\x20','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20type:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolved\x20folder\x20ID:\x20','\x27...','✔\x20Created\x20folder\x20\x27','Get\x20SQL\x20query\x20for\x20child\x20segment','toLocaleString','json','segment:folder:list','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Target\x20path:\x20','SQL\x20query:\x0a','/e/','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Cause:\x20','Creating\x20folder\x20\x27','4qduKCL','error','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','listFolders','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','getSegment','Fetching\x20folder\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment','Usage:\x20tdx\x20segment\x20describe\x20<path>','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','length','Examples:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20SQL\x20for\x20segment...','813491AUBTKB','SEGMENT_FOLDER_NOT_FOUND','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','✔\x20Query\x20completed:\x20Processed\x20','467165eyoeEd','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Parent\x20name:\x20','resolveParentId','\x20\x20Segment\x20name:\x20','Resolved\x20parent\x20ID:\x20','398588LzTIif','execute','Options:','resolveFolderId','Resolving\x20parent\x20folder\x20\x27','in\x20','folder','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','1281207RzKmEL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','green','Parent\x20ID:\x20','query','Segment\x20ID:\x20','Resolving\x20path\x20\x27','jobId','elapsedTimeMillis','cause','name','Show\x20segment\x20or\x20folder\x20details','site','parentFolder','\x20folder','Fetching\x20segment\x20details...','replace','data','Folder\x20name:\x20','\x20Opening\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','test','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','folderId','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','trim','Usage:\x20tdx\x20sg\x20desc\x20<name>','✖\x20Query\x20failed\x20[','Show\x20folder\x20or\x20child\x20segment\x20details','✔\x20Found\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','parentId','stats','Resolving\x20parent\x20segment\x20\x27','SEGMENT_NOT_FOUND','Use:\x20tdx\x20ps\x20sql','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Use:\x20tdx\x20ps\x20view','parent','message','Resolving\x20folder\x20\x27','segmentId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','cyan','1436589UZhtsa','log','(root)','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','type','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20','resolvePathToResource','272570OYIAAP','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20[Job\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','getParent','Create\x20segment\x20folder\x20for\x20organization','Resolving\x20\x27','getSegmentSQL','code','Fetching\x20folder\x20details...','Resolved\x20relative\x20path\x20to:\x20','url','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment:desc','Site:\x20','Resolved\x20parent\x20folder\x20ID:\x20','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','setJobId','Parent\x20segment:\x20','fullPath','getFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x27\x20with\x20ID:\x20','verbose','segment:sql','Folder\x20ID:\x20','671440ktdJhU'];a25_0x3390=function(){return _0xaaf216;};return a25_0x3390();}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a25_0x288065(0x1e9);[a25_0x288065(0x1e8)]=a25_0x288065(0x1cd);async[a25_0x288065(0x222)](_0x5d4598){const _0x25807b=a25_0x288065,{options:_0x68defc,args:_0x12be7b,tdx:_0x4bb95d}=_0x5d4598,_0xb3406b=_0x68defc;if(_0x12be7b[_0x25807b(0x210)]<0x2)return console['error'](_0x25807b(0x244)),console[_0x25807b(0x202)](_0x25807b(0x1bb)),0x1;const _0x53e814=_0x12be7b[0x0],_0x100f43=_0x12be7b[0x1];_0xb3406b[_0x25807b(0x1e0)]&&(console['error'](_0x25807b(0x1d6)+_0xb3406b[_0x25807b(0x235)]),console['error'](_0x25807b(0x1db)+_0x53e814),console[_0x25807b(0x202)]('Folder\x20name:\x20'+_0x100f43));let _0x541d79;if(_0xb3406b['parentFolder']){const _0xf3b569=_0xb3406b[_0x25807b(0x236)],_0x52ab34=await withSpinner(_0x25807b(0x250)+_0x53e814+_0x25807b(0x1f4),()=>_0x4bb95d['segment']['resolveParentId'](_0x53e814),{'verbose':_0xb3406b[_0x25807b(0x1e0)]}),_0x5c3d80=_0x52ab34[_0x25807b(0x23a)],_0x123f26=await withSpinner(_0x25807b(0x225)+_0xf3b569+_0x25807b(0x1f4),()=>_0x4bb95d[_0x25807b(0x20c)]['resolveFolderId'](_0x5c3d80,_0xf3b569),{'verbose':_0xb3406b[_0x25807b(0x1e0)]});_0x541d79=_0x123f26[_0x25807b(0x23a)],_0xb3406b[_0x25807b(0x1e0)]&&console['error'](_0x25807b(0x1d7)+_0x541d79);}const _0x9a1b44={'name':_0x100f43,'description':_0xb3406b['description'],'parentFolderId':_0x541d79},_0x4656b1=await withSpinner(_0x25807b(0x200)+_0x100f43+_0x25807b(0x1f4),()=>_0x4bb95d[_0x25807b(0x20c)]['createFolder'](_0x53e814,_0x9a1b44),{'verbose':_0xb3406b[_0x25807b(0x1e0)]}),_0x50e522=_0x4656b1['data'];return console[_0x25807b(0x202)](_0x25807b(0x1f5)+_0x50e522[_0x25807b(0x233)]+_0x25807b(0x1df)+_0x50e522['id']),await handleSDKOutput([_0x50e522],_0xb3406b),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x288065(0x233)]='segment:view';[a25_0x288065(0x1e8)]=a25_0x288065(0x24b);async[a25_0x288065(0x222)](_0xc79376){const _0x474c9e=a25_0x288065,{options:_0x3a1052,args:_0x456311,tdx:_0x54ea9d}=_0xc79376,_0xf9cc2=_0x456311[0x0];if(!_0xf9cc2)return console[_0x474c9e(0x202)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x474c9e(0x202)](_0x474c9e(0x203)),console['error'](_0x474c9e(0x22a)),console[_0x474c9e(0x202)](_0x474c9e(0x223)),console['error'](_0x474c9e(0x20a)),console[_0x474c9e(0x202)]('Examples:'),console['error'](_0x474c9e(0x1ef)),console[_0x474c9e(0x202)](_0x474c9e(0x21c)),console['error'](_0x474c9e(0x240)),console[_0x474c9e(0x202)](_0x474c9e(0x1c4)),0x1;try{const _0x329212=_0x3a1052[_0x474c9e(0x21b)],_0x1b2181=await resolveSegmentTarget(_0xf9cc2,_0x329212,_0x3a1052[_0x474c9e(0x1e0)]);_0x3a1052[_0x474c9e(0x1e0)]&&console[_0x474c9e(0x202)](_0x474c9e(0x1fb)+_0x1b2181);const _0x4a67f1=await withSpinner(_0x474c9e(0x1ce)+_0xf9cc2+_0x474c9e(0x1f4),()=>_0x54ea9d['segment']['resolvePathToResource'](_0x1b2181),{'verbose':_0x3a1052[_0x474c9e(0x1e0)]}),_0x38b0a2=_0x4a67f1[_0x474c9e(0x23a)];_0x3a1052[_0x474c9e(0x1e0)]&&(console['error']('Resolved\x20type:\x20'+_0x38b0a2[_0x474c9e(0x1c1)]),console[_0x474c9e(0x202)](_0x474c9e(0x22c)+_0x38b0a2[_0x474c9e(0x24e)]),_0x38b0a2[_0x474c9e(0x243)]&&console[_0x474c9e(0x202)](_0x474c9e(0x1e2)+_0x38b0a2[_0x474c9e(0x243)]),_0x38b0a2['segmentId']&&console['error'](_0x474c9e(0x22e)+_0x38b0a2[_0x474c9e(0x1ba)]));if(_0x3a1052['web']){if(_0x38b0a2[_0x474c9e(0x1c1)]===_0x474c9e(0x227))return console[_0x474c9e(0x202)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x38b0a2[_0x474c9e(0x1c1)]===_0x474c9e(0x255))return console['error'](_0x474c9e(0x1fe)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x38b0a2[_0x474c9e(0x1ba)])throw new SDKError(ErrorCode[_0x474c9e(0x251)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4404e4=getConsoleNextUrl(_0x3a1052['site'],_0x474c9e(0x1eb)+_0x38b0a2[_0x474c9e(0x24e)]+'/e/'+_0x38b0a2[_0x474c9e(0x1ba)]);return console[_0x474c9e(0x202)](a25_0x3e730a[_0x474c9e(0x22b)]('✔')+_0x474c9e(0x23c)+a25_0x3e730a[_0x474c9e(0x1bc)](_0x4404e4)),openBrowser(_0x4404e4),0x0;}if(_0x38b0a2['type']===_0x474c9e(0x227)){if(!_0x38b0a2['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4c82ba=await withSpinner(_0x474c9e(0x1d1),()=>_0x54ea9d['segment'][_0x474c9e(0x1dd)](_0x38b0a2[_0x474c9e(0x243)]),{'verbose':_0x3a1052[_0x474c9e(0x1e0)]});await handleSingleObjectOutput(_0x4c82ba['data'],_0x3a1052);}else{if(_0x38b0a2[_0x474c9e(0x1c1)]===_0x474c9e(0x20c)){if(!_0x38b0a2[_0x474c9e(0x1ba)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x474c9e(0x23e));const _0x47e318=await withSpinner(_0x474c9e(0x238),()=>_0x54ea9d[_0x474c9e(0x20c)][_0x474c9e(0x208)](_0x38b0a2[_0x474c9e(0x24e)],_0x38b0a2[_0x474c9e(0x1ba)]),{'verbose':_0x3a1052[_0x474c9e(0x1e0)]}),_0x208781=getConsoleNextUrl(_0x3a1052[_0x474c9e(0x235)],_0x474c9e(0x1eb)+_0x38b0a2['parentId']+_0x474c9e(0x1fd)+_0x38b0a2[_0x474c9e(0x1ba)]),_0x132be2=_0x47e318[_0x474c9e(0x23a)];_0x132be2[_0x474c9e(0x1d3)]=_0x208781,await handleSingleObjectOutput(_0x132be2,_0x3a1052);}else return console[_0x474c9e(0x202)](_0x474c9e(0x20b)),console[_0x474c9e(0x202)](_0x474c9e(0x254)),0x1;}return 0x0;}catch(_0xd8b2e){if(_0xd8b2e instanceof SDKError)return console[_0x474c9e(0x202)]('Error:\x20'+_0xd8b2e['message']),_0xd8b2e[_0x474c9e(0x232)]&&console[_0x474c9e(0x202)](_0x474c9e(0x1ff)+_0xd8b2e[_0x474c9e(0x232)]),0x1;throw _0xd8b2e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x288065(0x233)]=a25_0x288065(0x1d5);[a25_0x288065(0x1e8)]=a25_0x288065(0x20f);async[a25_0x288065(0x222)](_0x2a3d1b){const _0x488397=a25_0x288065,{options:_0x130154,args:_0x354c3a,tdx:_0x497d7c}=_0x2a3d1b,_0x19a9c5=_0x354c3a[0x0];if(!_0x19a9c5)return console['error'](_0x488397(0x24d)),console[_0x488397(0x202)](_0x488397(0x249)),console['error'](_0x488397(0x212)),console['error'](_0x488397(0x211)),console[_0x488397(0x202)](_0x488397(0x1d9)),console[_0x488397(0x202)](_0x488397(0x218)),0x1;try{const _0x30027b=_0x130154[_0x488397(0x21b)],_0x52798f=await resolveSegmentTarget(_0x19a9c5,_0x30027b,_0x130154[_0x488397(0x1e0)]);_0x130154[_0x488397(0x1e0)]&&console['error'](_0x488397(0x1fb)+_0x52798f);const _0x2b92f2=await withSpinner(_0x488397(0x1ce)+_0x19a9c5+'\x27...',()=>_0x497d7c['segment'][_0x488397(0x1c6)](_0x52798f),{'verbose':_0x130154['verbose']}),_0x17a1bd=_0x2b92f2[_0x488397(0x23a)];_0x130154['verbose']&&(console[_0x488397(0x202)](_0x488397(0x1f1)+_0x17a1bd[_0x488397(0x1c1)]),console[_0x488397(0x202)](_0x488397(0x22c)+_0x17a1bd['parentId']));if(_0x17a1bd[_0x488397(0x1c1)]===_0x488397(0x227))return console[_0x488397(0x202)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x488397(0x228)),0x1;if(_0x17a1bd[_0x488397(0x1c1)]===_0x488397(0x255))return console[_0x488397(0x202)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x17a1bd[_0x488397(0x1ba)])throw new SDKError(ErrorCode[_0x488397(0x251)],_0x488397(0x23e));const _0x122a79=await withSpinner(_0x488397(0x214),()=>_0x497d7c['segment'][_0x488397(0x1cf)](_0x17a1bd[_0x488397(0x24e)],_0x17a1bd['segmentId']),{'verbose':_0x130154['verbose']}),_0x443c1d=_0x122a79[_0x488397(0x23a)],_0x3b7aff=await executeSchemaQuery(_0x443c1d,_0x497d7c,_0x130154);return await handleQueryOutput(_0x3b7aff,_0x130154),0x0;}catch(_0x1bd040){if(_0x1bd040 instanceof SDKError)return console[_0x488397(0x202)](_0x488397(0x1c5)+_0x1bd040[_0x488397(0x256)]),_0x1bd040[_0x488397(0x232)]&&console[_0x488397(0x202)](_0x488397(0x1ff)+_0x1bd040['cause']),0x1;throw _0x1bd040;}}}
|
|
1
|
+
const a25_0x2e3233=a25_0x48cb;(function(_0x48a20a,_0x3859b0){const _0x37a052=a25_0x48cb,_0x5080e0=_0x48a20a();while(!![]){try{const _0x264a59=-parseInt(_0x37a052(0x18c))/0x1*(-parseInt(_0x37a052(0x194))/0x2)+-parseInt(_0x37a052(0x18d))/0x3+-parseInt(_0x37a052(0x1bb))/0x4+parseInt(_0x37a052(0x160))/0x5+parseInt(_0x37a052(0x17e))/0x6+-parseInt(_0x37a052(0x15a))/0x7*(-parseInt(_0x37a052(0x165))/0x8)+parseInt(_0x37a052(0x1c4))/0x9;if(_0x264a59===_0x3859b0)break;else _0x5080e0['push'](_0x5080e0['shift']());}catch(_0x21859b){_0x5080e0['push'](_0x5080e0['shift']());}}}(a25_0x52fb,0x5554c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a25_0x52fb(){const _0x21ff2d=['error','trim','folderPath','Show\x20segment\x20folder\x20details','294vaZhUZ','verbose','Fetching\x20folder\x20\x27','\x20Opening\x20','length','segment:desc','2030865CudPrN','Usage:\x20tdx\x20sg\x20desc\x20<name>','/e/','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20sg\x20show\x20<name>','56696DRygZR','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','/app/ps/','parentFolder','message','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20sql','segmentName','segment:folder:list','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Parent\x20name:\x20','resolvePathToResource','✔\x20Created\x20folder\x20\x27','getSegment','type','green','jsonl','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Folder\x20ID:\x20','query','Error:\x20Folder\x20reference\x20is\x20required','Folder\x20name:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','1462308PuHpRE','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','createFolder','parentSegment','description','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','format','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','SEGMENT_FOLDER_NOT_FOUND','5qFyZHr','1502487BtUAOL','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Folder\x20path:\x20','SQL\x20query:\x0a','Executing\x20segment\x20query...','Resolved\x20type:\x20','log','39716lBSxZJ','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Resolved\x20relative\x20path\x20to:\x20','folder','Error:\x20','Use:\x20tdx\x20ps\x20view\x20-w','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','folderId','segment:folder:create','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Show\x20child\x20segment\x20schema\x20(column\x20types)','SEGMENT_NOT_FOUND','name','Listing\x20folders\x20for\x20parent\x20\x27','segment:sql','parent','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20folder','elapsedTimeMillis','Resolving\x20\x27','execute','url','code','Fetching\x20parent\x20segment\x20details...','Create\x20segment\x20folder\x20for\x20organization','segment:folder:show','in\x20','stats','fullPath','includes','jobId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','(root)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','\x27...','1550456gogsVX','Options:','Site:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20parent\x20folder\x20ID:\x20','toLocaleString','Examples:','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segmentId','1720116QMBVtm','Resolving\x20path\x20\x27','\x20\x20Cause:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','web','Show\x20folder\x20or\x20child\x20segment\x20details','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:show','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:view','INVALID_ARGUMENT','replace','getFolder','Parent\x20segment:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','limit','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Segment\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','cause','✔\x20Found\x20','Resolved\x20YAML\x20file:\x20','Target\x20path:\x20','parentId','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','resolveParentId','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segment','site','Fetching\x20SQL\x20for\x20segment...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Use:\x20tdx\x20ps\x20show','Use:\x20tdx\x20ps\x20desc','\x20rows\x20','listFolders','data'];a25_0x52fb=function(){return _0x21ff2d;};return a25_0x52fb();}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_0x48cb(_0x55c0a3,_0x230bb1){_0x55c0a3=_0x55c0a3-0x14a;const _0x52fb16=a25_0x52fb();let _0x48cb81=_0x52fb16[_0x55c0a3];return _0x48cb81;}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_0x116e5c from'chalk';async function resolveSegmentTarget(_0x39e20f,_0x1e6f63,_0x173259){const _0x34e31e=a25_0x48cb;if(isYamlFilePath(_0x39e20f))try{const _0x3757e5=await resolveYamlFilePath(_0x39e20f);return _0x173259&&(console['error'](_0x34e31e(0x1dc)+_0x39e20f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x3757e5[_0x34e31e(0x183)]),console[_0x34e31e(0x156)](_0x34e31e(0x1d8)+_0x3757e5[_0x34e31e(0x16d)]),console[_0x34e31e(0x156)](_0x34e31e(0x18f)+(_0x3757e5[_0x34e31e(0x158)]||_0x34e31e(0x1b7))),console[_0x34e31e(0x156)](_0x34e31e(0x180)+_0x3757e5['fullPath'])),_0x3757e5[_0x34e31e(0x1b3)];}catch(_0x43473a){throw new SDKError(ErrorCode[_0x34e31e(0x1d1)],_0x34e31e(0x17d)+_0x43473a[_0x34e31e(0x169)]);}if(!_0x1e6f63)throw new SDKError(ErrorCode[_0x34e31e(0x1d1)],_0x34e31e(0x18a));return _0x1e6f63+'/'+_0x39e20f;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]='segment:describe';['description']='Show\x20segment\x20or\x20folder\x20details';async[a25_0x2e3233(0x1ab)](_0x5dd46f){const _0x56c0ae=a25_0x2e3233,{options:_0x122850,args:_0x144771,tdx:_0x5b0e2c}=_0x5dd46f,_0x32bce9=_0x144771[0x0],_0x218956=!_0x32bce9&&!!_0x122850[_0x56c0ae(0x183)],_0x3fe314=_0x32bce9||_0x122850[_0x56c0ae(0x183)];if(!_0x3fe314)return console['error'](_0x56c0ae(0x1d5)),console[_0x56c0ae(0x156)](_0x56c0ae(0x1cb)),console[_0x56c0ae(0x156)](_0x56c0ae(0x1c1)),console[_0x56c0ae(0x156)](_0x56c0ae(0x181)),console['error'](_0x56c0ae(0x189)),console[_0x56c0ae(0x156)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x56c0ae(0x156)](_0x56c0ae(0x1df)),0x1;try{const _0x45f03e=_0x122850['segmentPath'];let _0x21984d=_0x3fe314;!_0x218956&&_0x45f03e&&!_0x3fe314[_0x56c0ae(0x1b4)]('/')&&(_0x21984d=_0x45f03e+'/'+_0x3fe314,_0x122850[_0x56c0ae(0x15b)]&&console[_0x56c0ae(0x156)](_0x56c0ae(0x196)+_0x21984d));const _0xec365b=await withSpinner(_0x56c0ae(0x1c5)+_0x21984d+_0x56c0ae(0x1ba),()=>_0x5b0e2c[_0x56c0ae(0x14c)]['resolvePathToResource'](_0x21984d),{'verbose':_0x122850[_0x56c0ae(0x15b)]}),_0x2bf5f3=_0xec365b['data'];_0x122850[_0x56c0ae(0x15b)]&&(console[_0x56c0ae(0x156)](_0x56c0ae(0x192)+_0x2bf5f3[_0x56c0ae(0x174)]),console['error']('Parent\x20ID:\x20'+_0x2bf5f3[_0x56c0ae(0x1de)]),_0x2bf5f3[_0x56c0ae(0x19d)]&&console[_0x56c0ae(0x156)](_0x56c0ae(0x179)+_0x2bf5f3[_0x56c0ae(0x19d)]),_0x2bf5f3[_0x56c0ae(0x1c3)]&&console['error']('Segment\x20ID:\x20'+_0x2bf5f3['segmentId']));if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x1a5)){const _0x21a62f=await withSpinner(_0x56c0ae(0x1ae),()=>_0x5b0e2c[_0x56c0ae(0x14c)]['getParent'](_0x2bf5f3[_0x56c0ae(0x1de)]),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x21a62f[_0x56c0ae(0x155)],_0x122850);}else{if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x197)){if(!_0x2bf5f3[_0x56c0ae(0x19d)])throw new SDKError(ErrorCode[_0x56c0ae(0x18b)],_0x56c0ae(0x14f));const _0x4ddb33=await withSpinner(_0x56c0ae(0x14a),()=>_0x5b0e2c[_0x56c0ae(0x14c)][_0x56c0ae(0x1d3)](_0x2bf5f3[_0x56c0ae(0x19d)]),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x4ddb33[_0x56c0ae(0x155)],_0x122850);}else{if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x14c)){if(!_0x2bf5f3[_0x56c0ae(0x1c3)])throw new SDKError(ErrorCode[_0x56c0ae(0x1a1)],_0x56c0ae(0x19a));const _0x2155b=await withSpinner(_0x56c0ae(0x1b9),()=>_0x5b0e2c['segment'][_0x56c0ae(0x173)](_0x2bf5f3[_0x56c0ae(0x1de)],_0x2bf5f3['segmentId']),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x2155b[_0x56c0ae(0x155)],_0x122850);}}}return 0x0;}catch(_0x63397a){if(_0x63397a instanceof SDKError)return console[_0x56c0ae(0x156)](_0x56c0ae(0x198)+_0x63397a[_0x56c0ae(0x169)]),_0x63397a['cause']&&console[_0x56c0ae(0x156)](_0x56c0ae(0x1c6)+_0x63397a[_0x56c0ae(0x1da)]),0x1;throw _0x63397a;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1cc);['description']=a25_0x2e3233(0x150);async[a25_0x2e3233(0x1ab)](_0x5a9f70){const _0xa097e6=a25_0x2e3233,{options:_0x35f7db,args:_0x5a55a2,tdx:_0x1cdf5d}=_0x5a9f70,_0x5e5553=_0x5a55a2[0x0];if(!_0x5e5553)return console[_0xa097e6(0x156)](_0xa097e6(0x1a7)),console[_0xa097e6(0x156)](_0xa097e6(0x164)),console[_0xa097e6(0x156)](_0xa097e6(0x19c)),console[_0xa097e6(0x156)](_0xa097e6(0x1c1)),console[_0xa097e6(0x156)](_0xa097e6(0x186)),console['error'](_0xa097e6(0x1b8)),0x1;try{const _0x23d796=_0x35f7db[_0xa097e6(0x183)],_0x4d27cf=await resolveSegmentTarget(_0x5e5553,_0x23d796,_0x35f7db[_0xa097e6(0x15b)]);_0x35f7db['verbose']&&console[_0xa097e6(0x156)]('Target\x20path:\x20'+_0x4d27cf);const _0x101173=await withSpinner(_0xa097e6(0x1aa)+_0x5e5553+_0xa097e6(0x1ba),()=>_0x1cdf5d[_0xa097e6(0x14c)][_0xa097e6(0x171)](_0x4d27cf),{'verbose':_0x35f7db['verbose']}),_0x6e778c=_0x101173[_0xa097e6(0x155)];_0x35f7db[_0xa097e6(0x15b)]&&(console['error'](_0xa097e6(0x192)+_0x6e778c[_0xa097e6(0x174)]),console[_0xa097e6(0x156)](_0xa097e6(0x19b)+_0x6e778c[_0xa097e6(0x1de)]));if(_0x6e778c[_0xa097e6(0x174)]===_0xa097e6(0x197))return console[_0xa097e6(0x156)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0xa097e6(0x156)](_0xa097e6(0x1b6)),0x1;if(_0x6e778c[_0xa097e6(0x174)]===_0xa097e6(0x1a5))return console[_0xa097e6(0x156)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0xa097e6(0x156)](_0xa097e6(0x151)),0x1;if(!_0x6e778c[_0xa097e6(0x1c3)])throw new SDKError(ErrorCode[_0xa097e6(0x1a1)],_0xa097e6(0x19a));const _0x46f440=await withSpinner(_0xa097e6(0x14e),()=>_0x1cdf5d[_0xa097e6(0x14c)]['getSegmentSQL'](_0x6e778c['parentId'],_0x6e778c[_0xa097e6(0x1c3)]),{'verbose':_0x35f7db[_0xa097e6(0x15b)]});let _0x17e277=_0x46f440[_0xa097e6(0x155)];const _0x464f3e=resolveLimit(_0x35f7db[_0xa097e6(0x1d6)],DEFAULT_DISPLAY_LIMIT),_0x47e77f=/\bLIMIT\s+\d+/i['test'](_0x17e277);!_0x47e77f&&(_0x17e277=_0x17e277[_0xa097e6(0x157)]()[_0xa097e6(0x1d2)](/;+$/,''),_0x17e277='SELECT\x20*\x20FROM\x20(\x0a'+_0x17e277+_0xa097e6(0x1cd)+_0x464f3e);_0x35f7db[_0xa097e6(0x15b)]&&console['error'](_0xa097e6(0x190)+_0x17e277);const _0x59db8a=await withProgressSpinner(_0xa097e6(0x191),async _0x1bc7f3=>{const _0x2c3aa6=_0xa097e6,_0xdfe0f=await _0x1cdf5d[_0x2c3aa6(0x17a)]['execute'](_0x17e277,{'catalog':'td','schema':'information_schema','onJobId':_0x4b8644=>{_0x1bc7f3['setJobId'](_0x4b8644);}});return _0xdfe0f;},{'verbose':_0x35f7db[_0xa097e6(0x15b)]}),_0x1ebbc=_0x59db8a[_0xa097e6(0x155)],_0x1adfc4=_0x1ebbc[_0xa097e6(0x1b5)]?'\x20[Job\x20ID:\x20'+_0x1ebbc[_0xa097e6(0x1b5)]+']':'';return console[_0xa097e6(0x156)](_0xa097e6(0x188)+_0x1ebbc[_0xa097e6(0x1b2)]['processedRows'][_0xa097e6(0x1c0)]()+_0xa097e6(0x153)+(_0xa097e6(0x1b1)+formatElapsed(_0x1ebbc[_0xa097e6(0x1b2)][_0xa097e6(0x1a9)])+_0x1adfc4)),await handleQueryOutput(_0x1ebbc,_0x35f7db),0x0;}catch(_0x55ab23){if(_0x55ab23 instanceof SDKError)return console['error'](_0xa097e6(0x16a)+_0x55ab23[_0xa097e6(0x1ad)]+']'),console['error']('\x0a'+_0x55ab23[_0xa097e6(0x169)]),0x1;throw _0x55ab23;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x16e);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x3d57ea){const _0x54a3b8=a25_0x2e3233,{options:_0x395306,args:_0x404314,tdx:_0x2e21ac}=_0x3d57ea;if(_0x404314['length']===0x0)return console['error'](_0x54a3b8(0x1d9)),console[_0x54a3b8(0x156)](_0x54a3b8(0x1cf)),0x1;const _0x12f919=_0x404314[0x0];try{_0x395306['verbose']&&(console[_0x54a3b8(0x156)](_0x54a3b8(0x1bd)+_0x395306[_0x54a3b8(0x14d)]),console[_0x54a3b8(0x156)](_0x54a3b8(0x170)+_0x12f919));const _0x345a41=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x12f919+_0x54a3b8(0x1ba),()=>_0x2e21ac[_0x54a3b8(0x14c)]['resolveParentId'](_0x12f919),{'verbose':_0x395306[_0x54a3b8(0x15b)]}),_0x46d0a1=_0x345a41[_0x54a3b8(0x155)];_0x395306[_0x54a3b8(0x15b)]&&console[_0x54a3b8(0x156)](_0x54a3b8(0x178)+_0x46d0a1);const _0x112396=await withSpinner(_0x54a3b8(0x1a3)+_0x12f919+_0x54a3b8(0x1ba),()=>_0x2e21ac[_0x54a3b8(0x14c)][_0x54a3b8(0x154)](_0x46d0a1),{'verbose':_0x395306['verbose']}),_0x5868a6=_0x112396[_0x54a3b8(0x155)];return console[_0x54a3b8(0x156)](_0x54a3b8(0x1db)+_0x5868a6[_0x54a3b8(0x15e)]+_0x54a3b8(0x1a8)+(_0x5868a6[_0x54a3b8(0x15e)]!==0x1?'s':'')),await handleSDKOutput(_0x5868a6,_0x395306),0x0;}catch(_0x41c28d){if(_0x41c28d instanceof SDKError)return console['error']('Error:\x20'+_0x41c28d['message']),_0x41c28d[_0x54a3b8(0x1da)]&&console[_0x54a3b8(0x156)](_0x54a3b8(0x1c6)+_0x41c28d['cause']),0x1;throw _0x41c28d;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1b0);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x159);async[a25_0x2e3233(0x1ab)](_0x4ccac2){const _0x2df14f=a25_0x2e3233,{options:_0x16d4dc,args:_0x2621c8,tdx:_0x5a2ac6}=_0x4ccac2;if(_0x2621c8['length']===0x0)return console[_0x2df14f(0x156)](_0x2df14f(0x17b)),console[_0x2df14f(0x156)](_0x2df14f(0x166)),0x1;try{const {parentId:_0x3fa9db,childId:_0x326722}=parseSegmentRef(_0x2621c8[0x0]);_0x16d4dc[_0x2df14f(0x15b)]&&(console['error'](_0x2df14f(0x1bd)+_0x16d4dc[_0x2df14f(0x14d)]),console[_0x2df14f(0x156)](_0x2df14f(0x170)+_0x3fa9db),_0x326722&&console[_0x2df14f(0x156)](_0x2df14f(0x17c)+_0x326722));if(!_0x326722)return console['error'](_0x2df14f(0x19f)),0x1;const _0x10e70a=await withSpinner(_0x2df14f(0x185)+_0x3fa9db+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)][_0x2df14f(0x1e0)](_0x3fa9db),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]}),_0xec4293=_0x10e70a[_0x2df14f(0x155)];_0x16d4dc[_0x2df14f(0x15b)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0xec4293);const _0x3874c1=await withSpinner('Resolving\x20folder\x20\x27'+_0x326722+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)]['resolveFolderId'](_0xec4293,_0x326722),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]}),_0x279fa8=_0x3874c1[_0x2df14f(0x155)];_0x16d4dc[_0x2df14f(0x15b)]&&console[_0x2df14f(0x156)]('Resolved\x20folder\x20ID:\x20'+_0x279fa8);const _0x231fcb=await withSpinner(_0x2df14f(0x15c)+_0x326722+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)][_0x2df14f(0x1d3)](_0x279fa8),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]});return await handleSDKOutput([_0x231fcb[_0x2df14f(0x155)]],_0x16d4dc),0x0;}catch(_0x17d11d){if(_0x17d11d instanceof SDKError)return console[_0x2df14f(0x156)](_0x2df14f(0x198)+_0x17d11d[_0x2df14f(0x169)]),_0x17d11d[_0x2df14f(0x1da)]&&console['error']('\x20\x20Cause:\x20'+_0x17d11d[_0x2df14f(0x1da)]),0x1;throw _0x17d11d;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1a4);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x2e3233(0x1ab)](_0x565853){const _0x39ce32=a25_0x2e3233,{options:_0x1c3728,args:_0x492353,tdx:_0x1732e6}=_0x565853,_0x3eb649=_0x492353[0x0];if(!_0x3eb649)return console['error'](_0x39ce32(0x1a7)),console[_0x39ce32(0x156)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console['error'](_0x39ce32(0x1c1)),console[_0x39ce32(0x156)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x39ce32(0x156)](_0x39ce32(0x1e1)),0x1;try{const _0x379442=_0x1c3728[_0x39ce32(0x183)],_0xb05209=await resolveSegmentTarget(_0x3eb649,_0x379442,_0x1c3728['verbose']);_0x1c3728[_0x39ce32(0x15b)]&&console[_0x39ce32(0x156)](_0x39ce32(0x1dd)+_0xb05209);const _0x20fc8b=await withSpinner(_0x39ce32(0x1aa)+_0x3eb649+_0x39ce32(0x1ba),()=>_0x1732e6[_0x39ce32(0x14c)][_0x39ce32(0x171)](_0xb05209),{'verbose':_0x1c3728['verbose']}),_0x1d7a3c=_0x20fc8b[_0x39ce32(0x155)];_0x1c3728['verbose']&&(console[_0x39ce32(0x156)](_0x39ce32(0x192)+_0x1d7a3c['type']),console['error']('Parent\x20ID:\x20'+_0x1d7a3c[_0x39ce32(0x1de)]));if(_0x1d7a3c['type']===_0x39ce32(0x197))return console[_0x39ce32(0x156)](_0x39ce32(0x195)),console['error'](_0x39ce32(0x14b)),0x1;if(_0x1d7a3c[_0x39ce32(0x174)]==='parent')return console[_0x39ce32(0x156)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x39ce32(0x156)](_0x39ce32(0x16c)),0x1;if(!_0x1d7a3c[_0x39ce32(0x1c3)])throw new SDKError(ErrorCode[_0x39ce32(0x1a1)],_0x39ce32(0x19a));const _0x12423c=await withSpinner(_0x39ce32(0x14e),()=>_0x1732e6['segment'][_0x39ce32(0x1ca)](_0x1d7a3c['parentId'],_0x1d7a3c['segmentId']),{'verbose':_0x1c3728[_0x39ce32(0x15b)]}),_0x4cd9b0=_0x12423c['data'];return _0x1c3728[_0x39ce32(0x187)]==='json'||_0x1c3728['format']===_0x39ce32(0x176)?await handleSDKOutput([{'sql':_0x4cd9b0}],_0x1c3728):console[_0x39ce32(0x193)](_0x4cd9b0),0x0;}catch(_0x3a6182){if(_0x3a6182 instanceof SDKError)return console['error'](_0x39ce32(0x198)+_0x3a6182['message']),_0x3a6182['cause']&&console[_0x39ce32(0x156)](_0x39ce32(0x1c6)+_0x3a6182[_0x39ce32(0x1da)]),0x1;throw _0x3a6182;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a25_0x2e3233(0x19e);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x1af);async[a25_0x2e3233(0x1ab)](_0x34124d){const _0x526bf7=a25_0x2e3233,{options:_0x39fad5,args:_0x72500,tdx:_0x37e25e}=_0x34124d,_0x5a9394=_0x39fad5;if(_0x72500['length']<0x2)return console[_0x526bf7(0x156)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x31dd6e=_0x72500[0x0],_0x4b0fa0=_0x72500[0x1];_0x5a9394[_0x526bf7(0x15b)]&&(console[_0x526bf7(0x156)](_0x526bf7(0x1bd)+_0x5a9394[_0x526bf7(0x14d)]),console[_0x526bf7(0x156)](_0x526bf7(0x1d4)+_0x31dd6e),console[_0x526bf7(0x156)](_0x526bf7(0x17c)+_0x4b0fa0));let _0x5d8308;if(_0x5a9394[_0x526bf7(0x168)]){const _0x22f936=_0x5a9394[_0x526bf7(0x168)],_0x5f0593=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31dd6e+_0x526bf7(0x1ba),()=>_0x37e25e['segment']['resolveParentId'](_0x31dd6e),{'verbose':_0x5a9394['verbose']}),_0x1ffc5c=_0x5f0593['data'],_0x47732b=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x22f936+_0x526bf7(0x1ba),()=>_0x37e25e['segment']['resolveFolderId'](_0x1ffc5c,_0x22f936),{'verbose':_0x5a9394['verbose']});_0x5d8308=_0x47732b['data'],_0x5a9394[_0x526bf7(0x15b)]&&console[_0x526bf7(0x156)](_0x526bf7(0x1bf)+_0x5d8308);}const _0x207d65={'name':_0x4b0fa0,'description':_0x5a9394[_0x526bf7(0x184)],'parentFolderId':_0x5d8308},_0x4f1761=await withSpinner('Creating\x20folder\x20\x27'+_0x4b0fa0+'\x27...',()=>_0x37e25e[_0x526bf7(0x14c)][_0x526bf7(0x182)](_0x31dd6e,_0x207d65),{'verbose':_0x5a9394[_0x526bf7(0x15b)]}),_0x502a19=_0x4f1761['data'];return console['error'](_0x526bf7(0x172)+_0x502a19[_0x526bf7(0x1a2)]+_0x526bf7(0x177)+_0x502a19['id']),await handleSDKOutput([_0x502a19],_0x5a9394),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1d0);['description']=a25_0x2e3233(0x1c9);async[a25_0x2e3233(0x1ab)](_0x400447){const _0x267c32=a25_0x2e3233,{options:_0x4960a9,args:_0x1b7ba1,tdx:_0x58a510}=_0x400447,_0x4f6fd8=_0x1b7ba1[0x0];if(!_0x4f6fd8)return console[_0x267c32(0x156)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x267c32(0x156)](_0x267c32(0x163)),console['error'](_0x267c32(0x1ce)),console[_0x267c32(0x156)](_0x267c32(0x1bc)),console[_0x267c32(0x156)](_0x267c32(0x1d7)),console[_0x267c32(0x156)](_0x267c32(0x1c1)),console[_0x267c32(0x156)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x267c32(0x17f)),console[_0x267c32(0x156)](_0x267c32(0x18e)),console[_0x267c32(0x156)](_0x267c32(0x1be)),0x1;try{const _0x2d8ccd=_0x4960a9['parentSegment'],_0x4dd0eb=await resolveSegmentTarget(_0x4f6fd8,_0x2d8ccd,_0x4960a9['verbose']);_0x4960a9['verbose']&&console[_0x267c32(0x156)](_0x267c32(0x1dd)+_0x4dd0eb);const _0x360dfb=await withSpinner(_0x267c32(0x1aa)+_0x4f6fd8+_0x267c32(0x1ba),()=>_0x58a510[_0x267c32(0x14c)][_0x267c32(0x171)](_0x4dd0eb),{'verbose':_0x4960a9[_0x267c32(0x15b)]}),_0x1e989b=_0x360dfb[_0x267c32(0x155)];_0x4960a9['verbose']&&(console[_0x267c32(0x156)](_0x267c32(0x192)+_0x1e989b[_0x267c32(0x174)]),console[_0x267c32(0x156)](_0x267c32(0x19b)+_0x1e989b[_0x267c32(0x1de)]),_0x1e989b[_0x267c32(0x19d)]&&console[_0x267c32(0x156)](_0x267c32(0x179)+_0x1e989b['folderId']),_0x1e989b['segmentId']&&console[_0x267c32(0x156)]('Segment\x20ID:\x20'+_0x1e989b[_0x267c32(0x1c3)]));if(_0x4960a9[_0x267c32(0x1c8)]){if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x197))return console[_0x267c32(0x156)](_0x267c32(0x1c2)),0x1;if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x1a5))return console['error'](_0x267c32(0x1c7)),console['error'](_0x267c32(0x199)),0x1;if(!_0x1e989b[_0x267c32(0x1c3)])throw new SDKError(ErrorCode[_0x267c32(0x1a1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x47d162=getConsoleNextUrl(_0x4960a9[_0x267c32(0x14d)],_0x267c32(0x167)+_0x1e989b['parentId']+'/e/'+_0x1e989b[_0x267c32(0x1c3)]);return console[_0x267c32(0x156)](a25_0x116e5c[_0x267c32(0x175)]('✔')+_0x267c32(0x15d)+a25_0x116e5c['cyan'](_0x47d162)),openBrowser(_0x47d162),0x0;}if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x197)){if(!_0x1e989b[_0x267c32(0x19d)])throw new SDKError(ErrorCode[_0x267c32(0x18b)],_0x267c32(0x14f));const _0xe36b1e=await withSpinner('Fetching\x20folder\x20details...',()=>_0x58a510['segment'][_0x267c32(0x1d3)](_0x1e989b[_0x267c32(0x19d)]),{'verbose':_0x4960a9[_0x267c32(0x15b)]});await handleSingleObjectOutput(_0xe36b1e[_0x267c32(0x155)],_0x4960a9);}else{if(_0x1e989b['type']===_0x267c32(0x14c)){if(!_0x1e989b[_0x267c32(0x1c3)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x30efc9=await withSpinner(_0x267c32(0x1b9),()=>_0x58a510[_0x267c32(0x14c)]['getSegment'](_0x1e989b[_0x267c32(0x1de)],_0x1e989b[_0x267c32(0x1c3)]),{'verbose':_0x4960a9[_0x267c32(0x15b)]}),_0x58870d=getConsoleNextUrl(_0x4960a9[_0x267c32(0x14d)],_0x267c32(0x167)+_0x1e989b[_0x267c32(0x1de)]+_0x267c32(0x162)+_0x1e989b[_0x267c32(0x1c3)]),_0x26ff90=_0x30efc9[_0x267c32(0x155)];_0x26ff90[_0x267c32(0x1ac)]=_0x58870d,await handleSingleObjectOutput(_0x26ff90,_0x4960a9);}else return console['error'](_0x267c32(0x16f)),console[_0x267c32(0x156)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x2df4cc){if(_0x2df4cc instanceof SDKError)return console['error'](_0x267c32(0x198)+_0x2df4cc[_0x267c32(0x169)]),_0x2df4cc[_0x267c32(0x1da)]&&console['error'](_0x267c32(0x1c6)+_0x2df4cc['cause']),0x1;throw _0x2df4cc;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x15f);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x1a0);async['execute'](_0x565ea4){const _0x56144b=a25_0x2e3233,{options:_0x4e88f0,args:_0x4c2cee,tdx:_0x3634da}=_0x565ea4,_0xf81357=_0x4c2cee[0x0];if(!_0xf81357)return console[_0x56144b(0x156)](_0x56144b(0x1a7)),console[_0x56144b(0x156)](_0x56144b(0x161)),console[_0x56144b(0x156)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x56144b(0x1c1)),console[_0x56144b(0x156)](_0x56144b(0x16b)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3d3d32=_0x4e88f0[_0x56144b(0x183)],_0x559f46=await resolveSegmentTarget(_0xf81357,_0x3d3d32,_0x4e88f0[_0x56144b(0x15b)]);_0x4e88f0[_0x56144b(0x15b)]&&console[_0x56144b(0x156)](_0x56144b(0x1dd)+_0x559f46);const _0xcceb96=await withSpinner(_0x56144b(0x1aa)+_0xf81357+_0x56144b(0x1ba),()=>_0x3634da[_0x56144b(0x14c)][_0x56144b(0x171)](_0x559f46),{'verbose':_0x4e88f0['verbose']}),_0x3e3385=_0xcceb96[_0x56144b(0x155)];_0x4e88f0[_0x56144b(0x15b)]&&(console[_0x56144b(0x156)](_0x56144b(0x192)+_0x3e3385[_0x56144b(0x174)]),console[_0x56144b(0x156)](_0x56144b(0x19b)+_0x3e3385['parentId']));if(_0x3e3385[_0x56144b(0x174)]===_0x56144b(0x197))return console[_0x56144b(0x156)](_0x56144b(0x1a6)),console[_0x56144b(0x156)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x3e3385['type']===_0x56144b(0x1a5))return console[_0x56144b(0x156)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x56144b(0x156)](_0x56144b(0x152)),0x1;if(!_0x3e3385[_0x56144b(0x1c3)])throw new SDKError(ErrorCode[_0x56144b(0x1a1)],_0x56144b(0x19a));const _0x25a8d5=await withSpinner(_0x56144b(0x14e),()=>_0x3634da[_0x56144b(0x14c)][_0x56144b(0x1ca)](_0x3e3385['parentId'],_0x3e3385['segmentId']),{'verbose':_0x4e88f0[_0x56144b(0x15b)]}),_0x1eef4b=_0x25a8d5[_0x56144b(0x155)],_0x31a870=await executeSchemaQuery(_0x1eef4b,_0x3634da,_0x4e88f0);return await handleQueryOutput(_0x31a870,_0x4e88f0),0x0;}catch(_0x462a38){if(_0x462a38 instanceof SDKError)return console[_0x56144b(0x156)]('Error:\x20'+_0x462a38[_0x56144b(0x169)]),_0x462a38[_0x56144b(0x1da)]&&console[_0x56144b(0x156)](_0x56144b(0x1c6)+_0x462a38['cause']),0x1;throw _0x462a38;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a26_0x83987a=a26_0x1ebf;(function(_0x4d9ad1,_0x596330){const _0x363776=a26_0x1ebf,_0x173f27=_0x4d9ad1();while(!![]){try{const _0x54b249=parseInt(_0x363776(0xa5))/0x1*(parseInt(_0x363776(0xad))/0x2)+-parseInt(_0x363776(0xb1))/0x3+-parseInt(_0x363776(0x82))/0x4*(-parseInt(_0x363776(0x90))/0x5)+parseInt(_0x363776(0x86))/0x6+parseInt(_0x363776(0xb3))/0x7*(-parseInt(_0x363776(0x8b))/0x8)+-parseInt(_0x363776(0xb8))/0x9+-parseInt(_0x363776(0xa7))/0xa*(-parseInt(_0x363776(0xa0))/0xb);if(_0x54b249===_0x596330)break;else _0x173f27['push'](_0x173f27['shift']());}catch(_0x6e1df7){_0x173f27['push'](_0x173f27['shift']());}}}(a26_0x4906,0x7363d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x1ebf(_0x41f349,_0x1ea6b7){_0x41f349=_0x41f349-0x80;const _0x4906dd=a26_0x4906();let _0x1ebfcf=_0x4906dd[_0x41f349];return _0x1ebfcf;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a26_0x4906(){const _0x5eb482=['resolveParentId','252BUOqgK','invisible','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Segment\x20name:\x20','1011786wwxVTH','segment','segments','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','createSegment','832wtGTFf','Site:\x20','execute','site','error','28790LIXVEZ','Parent:\x20','Resolved\x20folder\x20ID:\x20','includes','Target\x20path:\x20','kind','Parent\x20path:\x20','name','segmentPath','segment:create','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','length','data','11yaJYLf','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20folder\x20path\x20\x27','11uXHfse','ruleFile','14039840HnIPzC','Resolved\x20relative\x20path\x20to:\x20','verbose','folder','noCountPopulation','Resolving\x20folder\x20\x27','52690yGMnLK','description','✔\x20Created\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','2411289FqlIvZ','yellow','34454lPKpSe','folderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','3931884YjFvVf','parent'];a26_0x4906=function(){return _0x5eb482;};return a26_0x4906();}import a26_0x1e93cf from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x83987a(0x97)]=a26_0x83987a(0x99);[a26_0x83987a(0xae)]=a26_0x83987a(0x9d);async[a26_0x83987a(0x8d)](_0x50d807){const _0x222540=a26_0x83987a;console[_0x222540(0x8f)](a26_0x1e93cf[_0x222540(0xb2)](_0x222540(0xb0))),console[_0x222540(0x8f)](a26_0x1e93cf['yellow'](_0x222540(0x9a)));const {options:_0x1ecd56,args:_0x24cf43,tdx:_0x48a9b}=_0x50d807,_0xaa1279=_0x1ecd56;if(_0x24cf43['length']===0x0)return console['error'](_0x222540(0x89)),console[_0x222540(0x8f)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error']('Examples:'),console[_0x222540(0x8f)](_0x222540(0xa2)),console[_0x222540(0x8f)](_0x222540(0xb7)),console[_0x222540(0x8f)](_0x222540(0xa3)),0x1;const _0x52bdf3=_0x24cf43[0x0],_0x413028=_0x1ecd56[_0x222540(0x98)];let _0x16977c=_0x52bdf3;_0x413028&&!_0x52bdf3[_0x222540(0x93)]('/')&&(_0x16977c=_0x413028+'/'+_0x52bdf3,_0xaa1279[_0x222540(0xa9)]&&console[_0x222540(0x8f)](_0x222540(0xa8)+_0x16977c));const _0x54e5d0=parsePath(_0x16977c);if(_0x54e5d0[_0x222540(0x88)][_0x222540(0x9e)]<0x2)return console[_0x222540(0x8f)](_0x222540(0xb5)),console[_0x222540(0x8f)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x57e309=_0x54e5d0[_0x222540(0x88)][0x0],_0xdb84b3=getBaseName(_0x16977c),_0x1ebbb4=getParentPath(_0x16977c);_0xaa1279[_0x222540(0xa9)]&&(console[_0x222540(0x8f)](_0x222540(0x8c)+_0xaa1279[_0x222540(0x8e)]),console[_0x222540(0x8f)](_0x222540(0x94)+_0x16977c),console['error'](_0x222540(0x91)+_0x57e309),console[_0x222540(0x8f)](_0x222540(0x85)+_0xdb84b3),console[_0x222540(0x8f)](_0x222540(0x96)+_0x1ebbb4));const _0xe35bba=await withSpinner(_0x222540(0x9b)+_0x57e309+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x81)](_0x57e309),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x204ad2=_0xe35bba[_0x222540(0x9f)];let _0xd5a612;if(_0x54e5d0[_0x222540(0x88)][_0x222540(0x9e)]>0x2){const _0x1e68de=await withSpinner(_0x222540(0xa4)+_0x1ebbb4+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x9c)](_0x1ebbb4),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x14ce2d=_0x1e68de['data'];if(_0x14ce2d['type']!==_0x222540(0xaa)&&_0x14ce2d['type']!==_0x222540(0x80))return console['error'](_0x222540(0x84)),0x1;_0xd5a612=_0x14ce2d[_0x222540(0xb4)];}else{if(_0xaa1279[_0x222540(0xaa)]){const _0x55a293=await withSpinner(_0x222540(0xac)+_0xaa1279[_0x222540(0xaa)]+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)]['resolveFolderId'](_0x204ad2,_0xaa1279[_0x222540(0xaa)]),{'verbose':_0xaa1279['verbose']});_0xd5a612=_0x55a293['data'];}}_0xaa1279[_0x222540(0xa9)]&&_0xd5a612&&console['error'](_0x222540(0x92)+_0xd5a612);const _0x20240c=await loadJSONFromOptions(_0xaa1279['rule'],_0xaa1279[_0x222540(0xa6)]),_0x37cb87={'name':_0xdb84b3,'description':_0xaa1279['description'],'rule':_0x20240c,'kind':_0xaa1279[_0x222540(0x95)]!==undefined?parseInt(_0xaa1279[_0x222540(0x95)],0xa):undefined,'isVisible':_0xaa1279[_0x222540(0x83)]?![]:undefined,'segmentFolderId':_0xd5a612,'countPopulation':_0xaa1279[_0x222540(0xab)]?![]:undefined},_0x885e90=await withSpinner('Creating\x20segment\x20\x27'+_0xdb84b3+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x8a)](_0x204ad2,_0x37cb87),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x4380f1=_0x885e90[_0x222540(0x9f)];return console[_0x222540(0x8f)](_0x222540(0xaf)+_0x4380f1[_0x222540(0x97)]+'\x27\x20with\x20ID:\x20'+_0x4380f1['id']),_0x16977c!==_0x52bdf3&&console[_0x222540(0x8f)](_0x222540(0xb6)+_0x16977c),await handleSDKOutput([_0x4380f1],_0xaa1279),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a27_0x29f739=a27_0x24a1;(function(_0x5bc519,_0xc0743){const _0x379728=a27_0x24a1,_0x339d06=_0x5bc519();while(!![]){try{const _0x3ef594=-parseInt(_0x379728(0xf6))/0x1+parseInt(_0x379728(0xfe))/0x2*(-parseInt(_0x379728(0xe8))/0x3)+-parseInt(_0x379728(0xee))/0x4+-parseInt(_0x379728(0xf0))/0x5*(-parseInt(_0x379728(0xf9))/0x6)+parseInt(_0x379728(0xfc))/0x7+parseInt(_0x379728(0xe5))/0x8+-parseInt(_0x379728(0xf1))/0x9;if(_0x3ef594===_0xc0743)break;else _0x339d06['push'](_0x339d06['shift']());}catch(_0x36a50b){_0x339d06['push'](_0x339d06['shift']());}}}(a27_0x4bd9,0x49f7b));import{BaseCommand}from'./command.js';function a27_0x4bd9(){const _0x19d50b=['listFields','11905snBjci','1742481kmgJDK','verbose','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','jsonl','520020bjSAsf','json','\x20field','954qNssYU','\x27...','segment','3901541LGsETe','error','2638HvKHem','1783336gJDLTD','description','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','321eACHdp','✔\x20Found\x20','parentSegment','site','data','length','4504UYEoRc'];a27_0x4bd9=function(){return _0x19d50b;};return a27_0x4bd9();}function a27_0x24a1(_0x225beb,_0x4c20bd){_0x225beb=_0x225beb-0xe5;const _0x4bd9b5=a27_0x4bd9();let _0x24a154=_0x4bd9b5[_0x225beb];return _0x24a154;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a27_0x29f739(0xe6)]=a27_0x29f739(0xf3);async['execute'](_0x3a7bdd){const _0x326b3b=a27_0x29f739,{options:_0x5142e5,args:_0x17ef00,tdx:_0x4a08f7}=_0x3a7bdd,_0x185edf=_0x17ef00[0x0]||_0x5142e5[_0x326b3b(0xea)];if(!_0x185edf)return console[_0x326b3b(0xfd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x326b3b(0xfd)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x326b3b(0xfd)](_0x326b3b(0xe7)),0x1;_0x5142e5[_0x326b3b(0xf2)]&&(console[_0x326b3b(0xfd)]('Site:\x20'+_0x5142e5[_0x326b3b(0xeb)]),console['error'](_0x326b3b(0xf4)+_0x185edf));const _0x3ab6dc=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x185edf+_0x326b3b(0xfa),()=>_0x4a08f7[_0x326b3b(0xfb)][_0x326b3b(0xef)](_0x185edf),{'verbose':_0x5142e5[_0x326b3b(0xf2)]}),_0x2e4f4b=_0x3ab6dc[_0x326b3b(0xec)];console[_0x326b3b(0xfd)](_0x326b3b(0xe9)+_0x2e4f4b[_0x326b3b(0xed)]+_0x326b3b(0xf8)+(_0x2e4f4b[_0x326b3b(0xed)]!==0x1?'s':''));if(_0x5142e5[_0x326b3b(0xf7)]||_0x5142e5[_0x326b3b(0xf5)])return await handleSDKOutput(_0x2e4f4b,_0x5142e5),0x0;return displayFieldsHumanReadable(_0x2e4f4b,_0x185edf),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a28_0x287038=a28_0x212f;(function(_0x486346,_0x5150b4){const _0x55e6b3=a28_0x212f,_0x46223b=_0x486346();while(!![]){try{const _0x36eeb1=-parseInt(_0x55e6b3(0xcc))/0x1+parseInt(_0x55e6b3(0x99))/0x2+parseInt(_0x55e6b3(0xac))/0x3*(-parseInt(_0x55e6b3(0xd0))/0x4)+parseInt(_0x55e6b3(0xd4))/0x5+-parseInt(_0x55e6b3(0x9d))/0x6*(-parseInt(_0x55e6b3(0xb1))/0x7)+-parseInt(_0x55e6b3(0xbb))/0x8+parseInt(_0x55e6b3(0x9b))/0x9*(parseInt(_0x55e6b3(0xab))/0xa);if(_0x36eeb1===_0x5150b4)break;else _0x46223b['push'](_0x46223b['shift']());}catch(_0x4dfefb){_0x46223b['push'](_0x46223b['shift']());}}}(a28_0x2039,0xae227));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';function a28_0x212f(_0x46439a,_0x3c7d27){_0x46439a=_0x46439a-0x93;const _0x2039ed=a28_0x2039();let _0x212fb9=_0x2039ed[_0x46439a];return _0x212fb9;}import a28_0x2cb583 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x2e2c35 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a28_0x287038(0xd6)]=a28_0x287038(0xbc);[a28_0x287038(0xb5)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a28_0x287038(0xba)](_0x6746f7){const _0x14fd16=a28_0x287038,{options:_0x59e472,args:_0x3f9efc,tdx:_0x4f6ff}=_0x6746f7,_0x21d22d=_0x59e472,_0x2a1443=await resolveTarget({'arg':_0x3f9efc[0x0],'contextParent':_0x59e472[_0x14fd16(0xc4)],'cwd':process[_0x14fd16(0xc3)]()});if(!isSuccessfulResolution(_0x2a1443))return _0x2a1443[_0x14fd16(0xd1)]===_0x14fd16(0xd9)?(console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xc2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x14fd16(0xd7)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x14fd16(0xd7)](_0x14fd16(0xaa)),console[_0x14fd16(0xd7)](_0x14fd16(0xaf))):(console['error'](a28_0x2cb583[_0x14fd16(0x9c)](_0x14fd16(0xa9)+_0x2a1443[_0x14fd16(0xce)]+'\x0a')),_0x2a1443['helpText']&&console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xb6)](_0x2a1443[_0x14fd16(0xb3)]))),0x1;const _0x634c8e=_0x2a1443[_0x14fd16(0xda)],_0x5d5698=_0x2a1443['targetDir'],_0x147a5a=_0x2a1443[_0x14fd16(0xa3)]===_0x14fd16(0x98)?_0x2a1443[_0x14fd16(0xe2)]:undefined;_0x21d22d[_0x14fd16(0xe0)]&&(console['error'](_0x14fd16(0xd5)+_0x21d22d[_0x14fd16(0xca)]),console[_0x14fd16(0xd7)](_0x14fd16(0xb8)+_0x634c8e),_0x147a5a&&console['error'](_0x14fd16(0xcf)+_0x147a5a));const _0x353f03=await withProgressSpinner(_0x14fd16(0xd3)+_0x634c8e+_0x14fd16(0x96),_0x5be352=>_0x4f6ff[_0x14fd16(0x97)][_0x14fd16(0xa2)](_0x634c8e,{'targetDir':_0x5d5698,'targetResourceName':_0x147a5a,'verbose':_0x21d22d[_0x14fd16(0xe0)],'progress':{'update':_0x7a4333=>{const _0xe33417=_0x14fd16;_0x5be352[_0xe33417(0xc7)](_0x7a4333),_0x21d22d['verbose']&&console['error']('\x20\x20'+_0x7a4333);}}}),{'verbose':_0x21d22d[_0x14fd16(0xe0)]}),_0x1da348=_0x353f03[_0x14fd16(0xad)];if(_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xc6)]===0x0&&_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xd8)]===0x0)return console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xc2)](_0x14fd16(0x9e)+_0x1da348[_0x14fd16(0xda)]+'\x27')),0x0;const _0x5da4b6=_0x1da348[_0x14fd16(0x9f)]['filter'](_0x3b9202=>_0x3b9202['isNew']),_0x372f50=_0x1da348[_0x14fd16(0x9f)]['filter'](_0x2e4776=>!_0x2e4776['isNew']&&_0x2e4776[_0x14fd16(0xdb)]),_0x4d0860=_0x1da348['files']['filter'](_0x5d59ae=>!_0x5d59ae[_0x14fd16(0xde)]&&!_0x5d59ae[_0x14fd16(0xdb)]);console[_0x14fd16(0xd7)]('\x0aPull\x20summary\x20for\x20\x27'+_0x1da348['parentName']+'\x27:'),console[_0x14fd16(0xd7)](_0x14fd16(0xdc)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)]['segments']+_0x14fd16(0xc8))+_0x14fd16(0xb9)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xbe)]+'\x20activations'));if(_0x1da348['counts'][_0x14fd16(0xd8)]>0x0){const _0x222bb0=_0x1da348['counts'][_0x14fd16(0x9a)]>_0x1da348['counts'][_0x14fd16(0xd8)]?'\x20('+_0x1da348['counts'][_0x14fd16(0x9a)]+_0x14fd16(0xbd):'';console[_0x14fd16(0xd7)](_0x14fd16(0xb0)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xd8)]+_0x14fd16(0xc0))+a28_0x2cb583[_0x14fd16(0xb7)](_0x222bb0));}console['error']('\x20\x20'+a28_0x2cb583[_0x14fd16(0xcd)]('+\x20'+_0x5da4b6['length']+_0x14fd16(0xb4))),console['error']('\x20\x20'+a28_0x2cb583[_0x14fd16(0xc2)]('~\x20'+_0x372f50['length']+_0x14fd16(0xbf))),console[_0x14fd16(0xd7)]('\x20\x20'+a28_0x2cb583[_0x14fd16(0xb7)]('=\x20'+_0x4d0860['length']+_0x14fd16(0xa0))),console[_0x14fd16(0xd7)](_0x14fd16(0xe1)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xae)])+'\x0a');if(_0x372f50[_0x14fd16(0x95)]>0x0)for(const _0x58ffa5 of _0x372f50){console[_0x14fd16(0xd7)]('\x0aChanges\x20to\x20\x27'+_0x58ffa5[_0x14fd16(0xc5)]+'\x27:'),console[_0x14fd16(0xd7)]('─'[_0x14fd16(0xdd)](0x3c)),console[_0x14fd16(0xd7)](_0x58ffa5['diff']),console['error']('─'[_0x14fd16(0xdd)](0x3c));}if(_0x21d22d[_0x14fd16(0xc1)])return console[_0x14fd16(0xd7)](a28_0x2cb583['yellow'](_0x14fd16(0x94))),0x0;if(_0x5da4b6[_0x14fd16(0x95)]===0x0&&_0x372f50[_0x14fd16(0x95)]===0x0)return console['error'](a28_0x2cb583[_0x14fd16(0xcd)](_0x14fd16(0x93))),saveSessionContext({'parent_segment':_0x1da348[_0x14fd16(0xda)]},_0x21d22d[_0x14fd16(0xcb)]),console[_0x14fd16(0xd7)](a28_0x2cb583['green'](_0x14fd16(0xb2)+a28_0x2cb583[_0x14fd16(0xb7)](_0x14fd16(0xc9))+_0x14fd16(0xa4)+a28_0x2cb583['cyan'](_0x1da348[_0x14fd16(0xda)]))),0x0;if(!_0x21d22d['yes']){const _0x29a02f=await confirmKey(_0x14fd16(0xa8)+(_0x5da4b6[_0x14fd16(0x95)]+_0x372f50['length'])+_0x14fd16(0xe4));if(!_0x29a02f)return console['error'](_0x14fd16(0xe3)),0x1;}for(const _0x2de1d1 of _0x1da348[_0x14fd16(0x9f)]){if(_0x2de1d1[_0x14fd16(0xde)]||_0x2de1d1[_0x14fd16(0xdb)]){const _0x24905d=a28_0x2e2c35[_0x14fd16(0xdf)](_0x2de1d1[_0x14fd16(0xa5)]);!existsSync(_0x24905d)&&mkdirSync(_0x24905d,{'recursive':!![]}),writeFileSync(_0x2de1d1[_0x14fd16(0xa5)],_0x2de1d1[_0x14fd16(0xa1)],_0x14fd16(0xa7));}}return console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xcd)]('✔\x20Pulled\x20'+(_0x5da4b6[_0x14fd16(0x95)]+_0x372f50[_0x14fd16(0x95)])+_0x14fd16(0xd2)+_0x1da348[_0x14fd16(0xae)])),saveSessionContext({'parent_segment':_0x1da348[_0x14fd16(0xda)]},_0x21d22d[_0x14fd16(0xcb)]),console['error'](a28_0x2cb583['green'](_0x14fd16(0xb2)+a28_0x2cb583[_0x14fd16(0xb7)](_0x14fd16(0xc9))+'\x20=\x20'+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xda)]))),0x0;}}function a28_0x2039(){const _0x4531f2=['2247962aaAdoj','journeyVersions','738ZQIrNv','red','1194RSHBVw','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','files','\x20unchanged\x20files','content','pullSegments','type','\x20=\x20','absolutePath','counts','utf-8','Write\x20','Error:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','11620xZdjuW','594ORbltb','data','targetDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20\x20🗺️\x20\x20','763dkVPUX','✔\x20Context\x20set:\x20','helpText','\x20new\x20files','description','cyan','dim','Parent\x20segment:\x20','\x20with\x20','execute','10301872rzUQcc','segment:pull','\x20versions)','activations','\x20changed\x20files','\x20journeys','dryRun','yellow','cwd','parentSegment','relativePath','segments','setPhase','\x20segments','parent_segment','site','session','158747PsuCmu','green','message','Target\x20resource:\x20','44auBiUL','errorCode','\x20files\x20to\x20','Pulling\x20segments\x20from\x20\x27','4604790ukEuSR','Site:\x20','name','error','journeys','no_parent','parentName','hasChanges','\x20\x20🎯\x20','repeat','isNew','dirname','verbose','\x20\x20Target:\x20','resourceName','Aborted.','\x20files?','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','length','\x27...','segment','file'];a28_0x2039=function(){return _0x4531f2;};return a28_0x2039();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a29_0x1aaedb=a29_0x34e3;(function(_0x49e24e,_0xb6d422){const _0x480d08=a29_0x34e3,_0x257466=_0x49e24e();while(!![]){try{const _0x2f0d66=-parseInt(_0x480d08(0x112))/0x1*(-parseInt(_0x480d08(0x8a))/0x2)+-parseInt(_0x480d08(0xb5))/0x3*(parseInt(_0x480d08(0x124))/0x4)+parseInt(_0x480d08(0xbb))/0x5*(-parseInt(_0x480d08(0x106))/0x6)+parseInt(_0x480d08(0xe6))/0x7+parseInt(_0x480d08(0xbd))/0x8*(-parseInt(_0x480d08(0xd1))/0x9)+parseInt(_0x480d08(0x94))/0xa*(-parseInt(_0x480d08(0xdc))/0xb)+parseInt(_0x480d08(0x123))/0xc;if(_0x2f0d66===_0xb6d422)break;else _0x257466['push'](_0x257466['shift']());}catch(_0x43a38d){_0x257466['push'](_0x257466['shift']());}}}(a29_0x1fb6,0xcfddc));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a29_0x34e3(_0xf0de1e,_0x5f2a2b){_0xf0de1e=_0xf0de1e-0x86;const _0x1fb613=a29_0x1fb6();let _0x34e35c=_0x1fb613[_0xf0de1e];return _0x34e35c;}import{batchAsync}from'../utils/async.js';function a29_0x1fb6(){const _0x545402=['\x20folders\x20to\x20create','1759359pzXczf','resolveParentId','name','\x20\x20\x20\x20','Fetching\x20users\x20for\x20email\x20resolution...','Folders\x20to\x20create:','delete','set','.yml','all','Fetching\x20parent\x20segment\x20details...','📁\x20','helpText','results','message','New\x20journey:','data','idToName','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','dim','\x20to\x20delete','Fetching\x20existing\x20journeys...','join','journeyId','dryRun','\x20deleted','endsWith','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','setPhase','\x20changes?','\x20unchanged','toDelete','540lmFypz','/e/','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','user','updated','errorCode','Scoped\x20to\x20folder:\x20','Fetching\x20existing\x20folders...','\x20new','repeat','journeyBundleId','\x20changed','1126847YosrEp','yes','getParent','/j/da/je','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','new','\x20\x20🗺️\x20\x20Journeys:','connection','cwd','\x0aValidation\x20failed:','Parent\x20segment:\x20','cyan','description','journey','paused','Fetching\x20existing\x20activations...','relationships','37925628MmUEXJ','748MAzYlz','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','Error\x20parsing\x20YAML:\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','diff','add','2CZjiIJ','nameToType','\x20\x20Journeys:\x20','Error:\x20Directory\x20not\x20found:\x20','\x0a✔\x20Push\x20complete','\x20to\x20update','Fetching\x20connections\x20for\x20name\x20resolution...','length','Changes\x20to:','deleted','113770MDWXSz','state','New\x20segment:','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Delete\x20segment:','yamlConfig','No\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','journeysOnly','red','existingJourney','toString','getJourney','blue','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','listJourneysWithDetailsFromParentSegment','getOutputSchemaWithCache','green','get','yellow','\x20created','Error:\x20','\x20YAML\x20files\x20found','Fetching\x20existing\x20segments...','toUpdate','filter','activations','map','isNew','buildUserMaps','journeys','site','23184onDXkr','segmentFolderId','Push\x20','Changes\x20to\x20journey:','.yaml','Delete\x20journey:','2095TMAEeI','listFolders','5608GgTGLW','segment','folderId','versionNumber','type','\x20updated','filePath','parentFolder','changed','parentName','\x20\x20Activations:','\x20activations]','audienceId','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','\x0aPush\x20summary\x20for\x20\x27','segments','listActivations','listSegments','Aborted.','error','20268ZvJarZ','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20\x20Source:\x20','journeyBundleName','toCreate','nameToId','then','no_parent','folders','verbose','\x20to\x20create','605XnjiXc','Resolving\x20parent\x20segment\x20\x27','push','folderPath','attributes','parent_name','created','(Journey\x20will\x20be\x20deleted)','/app/ps/'];a29_0x1fb6=function(){return _0x545402;};return a29_0x1fb6();}import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x41437a from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a29_0x1aaedb(0xe8)]='segment:push';[a29_0x1aaedb(0x11e)]=a29_0x1aaedb(0x97);async['execute'](_0x1b86bc){const _0x518948=a29_0x1aaedb,{options:_0x2135c2,args:_0x589a59,tdx:_0x424321}=_0x1b86bc,_0x4b34ba=_0x2135c2,_0x28762e=await resolveTarget({'arg':_0x589a59[0x0],'contextParent':_0x2135c2['parentSegment'],'cwd':process[_0x518948(0x11a)]()});if(!isSuccessfulResolution(_0x28762e))return _0x28762e[_0x518948(0x10b)]===_0x518948(0xd8)?(console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0xa8)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x518948(0xd0)](_0x518948(0x125)),console[_0x518948(0xd0)](_0x518948(0x108)),console[_0x518948(0xd0)](_0x518948(0x9c))):(console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)](_0x518948(0xaa)+_0x28762e[_0x518948(0xf4)]+'\x0a')),_0x28762e[_0x518948(0xf2)]&&console['error'](a29_0x41437a['cyan'](_0x28762e['helpText']))),0x1;if(_0x28762e[_0x518948(0xc1)]===_0x518948(0xe1))return console['error'](a29_0x41437a['red'](_0x518948(0x8d)+_0x28762e['targetDir']+'\x0a')),console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x11d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0xb86f41=_0x28762e[_0x518948(0xc6)],_0x1ce4f7=_0x28762e['targetDir'],_0x1ea3f8=_0x28762e[_0x518948(0xc1)]==='file'?_0x28762e[_0x518948(0xc3)]:undefined,_0x4eb4d8=getScopedDetails(_0x28762e),_0x1e5a93=_0x4eb4d8?.['isScoped']??![],_0x25429c=_0x4eb4d8?.['scopedFolderPath']??'';if(!existsSync(_0x1ce4f7))return console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)](_0x518948(0x8d)+_0x1ce4f7+'\x0a')),console['error'](a29_0x41437a[_0x518948(0x11d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x4b34ba[_0x518948(0xda)]&&(console[_0x518948(0xd0)]('Site:\x20'+_0x4b34ba[_0x518948(0xb4)]),console[_0x518948(0xd0)](_0x518948(0x11c)+_0xb86f41),console[_0x518948(0xd0)]('Source\x20directory:\x20'+_0x1ce4f7),_0x1e5a93&&console[_0x518948(0xd0)](_0x518948(0x10c)+_0x25429c));const _0xa09d2d=await withSpinner(_0x518948(0xdd)+_0xb86f41+'\x27...',()=>_0x424321[_0x518948(0xbe)][_0x518948(0xe7)](_0xb86f41),{'verbose':_0x4b34ba['verbose']}),_0x39c6a2=_0xa09d2d['data'],[_0x405b34,_0x367368,_0x4835c7,_0x2f69e8,_0x472523]=await Promise[_0x518948(0xef)]([withSpinner(_0x518948(0xf0),()=>_0x424321['segment'][_0x518948(0x114)](_0x39c6a2),{'verbose':_0x4b34ba[_0x518948(0xda)]}),withSpinner(_0x518948(0xac),()=>_0x424321[_0x518948(0xbe)][_0x518948(0xce)](_0x39c6a2),{'verbose':_0x4b34ba[_0x518948(0xda)]}),withSpinner(_0x518948(0x10d),()=>_0x424321[_0x518948(0xbe)][_0x518948(0xbc)](_0x39c6a2),{'verbose':_0x4b34ba['verbose']}),withSpinner(_0x518948(0xfb),()=>_0x424321['journey'][_0x518948(0xa4)](_0x39c6a2,{'includeAllVersions':!![]}),{'verbose':_0x4b34ba[_0x518948(0xda)]}),withSpinner(_0x518948(0xea),()=>_0x424321[_0x518948(0x109)][_0x518948(0xb2)](),{'verbose':_0x4b34ba[_0x518948(0xda)]})['then'](_0x269074=>_0x269074[_0x518948(0xf6)])]),_0xd07a0d=_0x405b34[_0x518948(0xf6)],_0x4b7a36=extractRootFolderId(_0xd07a0d),_0x371b81=_0x367368[_0x518948(0xf6)],_0x14438c=_0x4835c7['data'],{journeys:_0x52b3d2,activationStepsById:_0x105872}=_0x2f69e8['data'],_0x46c8e1=new Map(_0x52b3d2[_0x518948(0xb0)](_0x3b7b9d=>[_0x3b7b9d['id'],_0x3b7b9d])),_0x46f229=_0x52b3d2[_0x518948(0xb0)](_0xd7e947=>({'id':_0xd7e947['id'],'name':_0xd7e947[_0x518948(0xe0)]['name'],'journeyBundleName':_0xd7e947['attributes'][_0x518948(0xd4)]||'','journeyBundleId':_0xd7e947['attributes'][_0x518948(0x110)]||'','versionNumber':_0xd7e947[_0x518948(0xe0)][_0x518948(0xc0)],'description':_0xd7e947['attributes'][_0x518948(0x11e)],'state':_0xd7e947[_0x518948(0xe0)][_0x518948(0x95)],'paused':_0xd7e947[_0x518948(0xe0)][_0x518948(0x120)],'audienceId':_0xd7e947['attributes'][_0x518948(0xc9)],'folderId':_0xd7e947[_0x518948(0x122)]?.[_0x518948(0xc4)]?.[_0x518948(0xf6)]?.['id'],'createdAt':_0xd7e947[_0x518948(0xe0)]['createdAt'],'updatedAt':_0xd7e947[_0x518948(0xe0)]['updatedAt']})),{emailToId:_0x145a24,idToEmail:_0x7c5a05}=_0x472523,_0x10426c=await withSpinner(_0x518948(0x90),async()=>{const _0x15aa0a=_0x518948,_0x4d6aae=await _0x424321[_0x15aa0a(0x119)]['list']();return buildConnectionMaps(_0x4d6aae);},{'verbose':_0x4b34ba['verbose']})[_0x518948(0xd7)](_0x5f2b52=>_0x5f2b52[_0x518948(0xf6)]),_0x6c537d=_0x10426c[_0x518948(0xd6)],_0x246193=_0x10426c[_0x518948(0xf7)],_0x19d89f=_0x10426c[_0x518948(0x8b)],_0x37da93={'emailToIdMap':_0x145a24,'connectionNameToIdMap':_0x6c537d,'connectionNameToTypeMap':_0x19d89f,'getSchema':_0x361e23=>_0x424321[_0x518948(0x119)][_0x518948(0xa5)](_0x361e23)};let {pathToId:_0x46f139,idToPath:_0x253b15}=buildFolderMaps(_0x14438c);const _0xd620aa=buildSegmentLookupMap(_0x371b81,_0x253b15),_0x729cdc=buildSegmentNameToIdMap(_0x371b81),_0x16ff36=buildJourneyBundleLookupMap(_0x46f229,_0x253b15);let _0xa6c3e3;if(_0x1ea3f8){if(!_0x1ea3f8[_0x518948(0x100)](_0x518948(0xee))&&!_0x1ea3f8[_0x518948(0x100)](_0x518948(0xb9)))return console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)](_0x518948(0x116)+_0x1ea3f8+'\x0a')),0x1;_0xa6c3e3=[_0x1ea3f8];}else _0xa6c3e3=findYamlFiles(_0x1ce4f7);if(_0xa6c3e3['length']===0x0)return console[_0x518948(0xd0)](a29_0x41437a['red'](_0x518948(0xa3)+_0x1ce4f7+'\x0a')),console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x11d)](_0x518948(0xf8))),0x1;let _0x3c727e,_0x373c4c;try{const _0x232888=parseAndClassifyYamlFiles(_0xa6c3e3,_0x1ce4f7,{'skipSegments':_0x4b34ba[_0x518948(0x9d)]});_0x3c727e=_0x232888[_0x518948(0xcc)],_0x373c4c=_0x232888['journeys'];const _0x3f70f3=validateParsedFiles(_0x232888,_0x1ce4f7);if(_0x3f70f3[_0x518948(0x91)]>0x0)return console['error'](a29_0x41437a[_0x518948(0x9e)](_0x518948(0x11b))),console[_0x518948(0xd0)](formatValidationErrors(_0x3f70f3)),console['error'](a29_0x41437a[_0x518948(0xa8)](_0x518948(0x87))),0x1;}catch(_0x30f82d){return console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)](_0x518948(0x86)+(_0x30f82d instanceof Error?_0x30f82d[_0x518948(0xf4)]:_0x30f82d))),0x1;}if(_0x3c727e[_0x518948(0x91)]===0x0&&_0x373c4c[_0x518948(0x91)]===0x0){const _0x332330=_0x4b34ba[_0x518948(0x9d)]?_0x518948(0x11f):'segment\x20or\x20journey';return console['error'](a29_0x41437a[_0x518948(0xa8)](_0x518948(0x9a)+_0x332330+_0x518948(0xab))),0x0;}const _0x495d66=new Map();_0x371b81[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0x9d)]&&await withSpinner(_0x518948(0x121),async()=>{await batchAsync(_0x371b81,async _0x4ab78b=>{const _0x1f4c1c=a29_0x34e3,_0x58d426=await _0x424321[_0x1f4c1c(0xbe)][_0x1f4c1c(0xcd)](_0x39c6a2,_0x4ab78b['id']);_0x495d66[_0x1f4c1c(0xed)](_0x4ab78b['id'],_0x58d426);});},{'verbose':_0x4b34ba[_0x518948(0xda)]});const {segmentFiles:_0x2a5e49,foldersToCreate:_0x20e931}=await prepareSegmentFiles(_0x3c727e,{'segmentByFolderAndName':_0xd620aa,'activationsBySegmentId':_0x495d66,'folderPathToId':_0x46f139,'idToEmailMap':_0x7c5a05,'connectionIdToNameMap':_0x246193},_0x37da93,_0x1e5a93,_0x25429c),_0x11cd80=_0x1ea3f8?[]:findSegmentsToDelete(_0x371b81,_0x3c727e[_0x518948(0xb0)](({yamlConfig:_0x4fd741,folderPath:_0x158eb8})=>({'yamlConfig':_0x4fd741,'folderPath':resolveTDFolderPath(_0x158eb8,_0x1e5a93,_0x25429c)})),_0x253b15,_0x25429c,_0x1e5a93),{journeyFiles:_0x1ea6d5,foldersToCreate:_0x83cd9d}=await withProgressSpinner('Preparing\x20journeys...',async _0x223637=>prepareJourneyFiles(_0x373c4c,{'fetchJourney':async _0x925d1d=>_0x424321[_0x518948(0x11f)][_0x518948(0xa1)](_0x925d1d[_0x518948(0xfd)]),'journeyBundlesByFolderAndName':_0x16ff36,'folderPathToId':_0x46f139,'idToEmailMap':_0x7c5a05,'connectionIdToNameMap':_0x246193,'existingSegments':_0x371b81,'parentId':_0x39c6a2,'deps':_0x424321,'progress':{'update':_0x5572ef=>{const _0x51814a=_0x518948;_0x223637[_0x51814a(0x102)](_0x5572ef),_0x4b34ba[_0x51814a(0xda)]&&console[_0x51814a(0xd0)]('\x20\x20'+_0x5572ef);}},'journeyById':_0x46c8e1,'activationStepsById':_0x105872},_0x1e5a93,_0x25429c),{'verbose':_0x4b34ba[_0x518948(0xda)]})[_0x518948(0xd7)](_0x3b6311=>_0x3b6311[_0x518948(0xf6)]);for(const _0x1b3b48 of _0x83cd9d){_0x20e931[_0x518948(0x89)](_0x1b3b48);}const _0xebf947=_0x1ea3f8?[]:findJourneysToDelete(_0x46f229,_0x373c4c[_0x518948(0xb0)](({yamlConfig:_0x5ed124,folderPath:_0x3e277a})=>({'yamlConfig':_0x5ed124,'folderPath':resolveTDFolderPath(_0x3e277a,_0x1e5a93,_0x25429c)})),_0x253b15,_0x25429c,_0x1e5a93),_0x302570=calculatePushStats(_0x2a5e49,_0x1ea6d5,_0x20e931,_0x11cd80,_0xebf947,!!_0x4b34ba[_0x518948(0xec)],!!_0x4b34ba[_0x518948(0x9d)]),_0x5b340c=_0x302570['segments'][_0x518948(0x117)],_0x2ac72d=_0x302570[_0x518948(0xcc)]['changed'],_0x29941c=_0x302570['segments']['unchanged'],_0x3ce5cf=_0x302570['segments']['toDelete'],_0x25c233=_0x302570[_0x518948(0xd9)][_0x518948(0xd5)],_0x1a7544=_0x302570[_0x518948(0xb3)][_0x518948(0x117)],_0x74bc24=_0x302570[_0x518948(0xb3)][_0x518948(0xc5)],_0x3ca522=_0x302570['journeys']['unchanged'],_0x597227=_0x302570['journeys'][_0x518948(0x105)],_0x1a5035=_0x302570[_0x518948(0xaf)]['all'],_0xaae605=_0x302570[_0x518948(0xaf)][_0x518948(0xd5)],_0x137c4e=_0x302570[_0x518948(0xaf)][_0x518948(0xad)],_0x4f93f6=_0x302570[_0x518948(0xaf)][_0x518948(0x105)];console['error'](_0x518948(0xcb)+_0xb86f41+'\x27:');_0x25c233[_0x518948(0x91)]>0x0&&console[_0x518948(0xd0)]('\x20\x20'+a29_0x41437a[_0x518948(0xa2)](_0x518948(0xf1)+_0x25c233[_0x518948(0x91)]+_0x518948(0xe5)));if(!_0x4b34ba[_0x518948(0x9d)]){console[_0x518948(0xd0)]('\x20\x20📊\x20Segments:'),console[_0x518948(0xd0)]('\x20\x20\x20\x20'+a29_0x41437a[_0x518948(0xa6)]('+\x20'+_0x5b340c[_0x518948(0x91)]+_0x518948(0x10e))),console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a['yellow']('~\x20'+_0x2ac72d[_0x518948(0x91)]+'\x20changed'));if(_0x3ce5cf[_0x518948(0x91)]>0x0)console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a['red']('-\x20'+_0x3ce5cf[_0x518948(0x91)]+'\x20to\x20delete'));else _0x11cd80[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0xec)]&&console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xf9)](_0x11cd80[_0x518948(0x91)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xf9)]('=\x20'+_0x29941c['length']+_0x518948(0x104)));}if(_0x1ea6d5[_0x518948(0x91)]>0x0||_0xebf947[_0x518948(0x91)]>0x0){console[_0x518948(0xd0)](_0x518948(0x118)),console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xa6)]('+\x20'+_0x1a7544[_0x518948(0x91)]+_0x518948(0x10e))),console[_0x518948(0xd0)]('\x20\x20\x20\x20'+a29_0x41437a[_0x518948(0xa8)]('~\x20'+_0x74bc24[_0x518948(0x91)]+_0x518948(0x111)));if(_0x597227['length']>0x0)console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0x9e)]('-\x20'+_0x597227[_0x518948(0x91)]+_0x518948(0xfa)));else _0xebf947[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0xec)]&&console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xf9)](_0xebf947[_0x518948(0x91)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x518948(0xd0)]('\x20\x20\x20\x20'+a29_0x41437a[_0x518948(0xf9)]('=\x20'+_0x3ca522[_0x518948(0x91)]+'\x20unchanged'));}_0x1a5035['length']>0x0&&!_0x4b34ba[_0x518948(0x9d)]&&(console['error'](''),console[_0x518948(0xd0)](_0x518948(0xc7)),_0xaae605[_0x518948(0x91)]>0x0&&console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xa6)]('+\x20'+_0xaae605[_0x518948(0x91)]+_0x518948(0xdb))),_0x137c4e[_0x518948(0x91)]>0x0&&console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0xa8)]('~\x20'+_0x137c4e[_0x518948(0x91)]+_0x518948(0x8f))),_0x4f93f6[_0x518948(0x91)]>0x0&&console[_0x518948(0xd0)](_0x518948(0xe9)+a29_0x41437a[_0x518948(0x9e)]('-\x20'+_0x4f93f6['length']+_0x518948(0xfa))));console[_0x518948(0xd0)](_0x518948(0xd3)+a29_0x41437a[_0x518948(0x11d)](_0x1ce4f7)+'\x0a');if(_0x25c233['length']>0x0){console[_0x518948(0xd0)](_0x518948(0xeb));for(const _0x1b6601 of _0x25c233){console[_0x518948(0xd0)]('\x20\x20'+a29_0x41437a[_0x518948(0xa2)]('+')+'\x20'+_0x1b6601);}console['error']('');}if(_0x5b340c[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0x9d)])for(const _0x3d7c97 of _0x5b340c){const _0x133ca7=_0x3d7c97[_0x518948(0xdf)]?_0x3d7c97[_0x518948(0xdf)]+'/'+_0x3d7c97[_0x518948(0x99)][_0x518948(0xe8)]:_0x3d7c97[_0x518948(0x99)]['name'],_0x453bca=_0x3d7c97[_0x518948(0x99)][_0x518948(0xaf)]?.[_0x518948(0x91)]||0x0,_0x5745dc=_0x453bca>0x0?a29_0x41437a['dim']('\x20['+_0x453bca+'\x20activations]'):'';console[_0x518948(0xd0)]('\x0a'+a29_0x41437a[_0x518948(0xa6)](_0x518948(0x96))+'\x20'+_0x133ca7+_0x5745dc),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c)),_0x3d7c97[_0x518948(0x88)]&&console['error'](_0x3d7c97[_0x518948(0x88)]),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));}if(_0x3ce5cf['length']>0x0&&!_0x4b34ba['journeysOnly'])for(const _0x1a6cd0 of _0x3ce5cf){const _0x2ae34a=_0x1a6cd0[_0x518948(0xb6)]?_0x253b15[_0x518948(0xa7)](_0x1a6cd0[_0x518948(0xb6)][_0x518948(0xa0)]())||'':'',_0x4d2582=_0x2ae34a?_0x2ae34a+'/'+_0x1a6cd0['name']:_0x1a6cd0[_0x518948(0xe8)],_0x16e402=_0x495d66[_0x518948(0xa7)](_0x1a6cd0['id'])||[],_0x531330=_0x16e402[_0x518948(0x91)]>0x0?a29_0x41437a['dim']('\x20['+_0x16e402['length']+_0x518948(0xc8)):'';console[_0x518948(0xd0)]('\x0a'+a29_0x41437a[_0x518948(0x9e)](_0x518948(0x98))+'\x20'+_0x4d2582+_0x531330),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));const _0x214578=segmentWithActivationsToYaml(_0x1a6cd0,_0x16e402,undefined,_0x7c5a05,_0x246193),_0x5a862c=segmentToYamlString(_0x214578),_0x311952=generateDiff(_0x5a862c,'');console[_0x518948(0xd0)](formatDiffWithColors(_0x311952)),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));}const _0x4663b2=_0x2a5e49['filter'](_0x206eec=>!_0x206eec[_0x518948(0xb1)]&&_0x206eec[_0x518948(0x88)]);if(_0x4663b2[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0x9d)])for(const _0x28ed3b of _0x4663b2){const _0x56e5cd=_0x28ed3b[_0x518948(0xdf)]?_0x28ed3b[_0x518948(0xdf)]+'/'+_0x28ed3b[_0x518948(0x99)][_0x518948(0xe8)]:_0x28ed3b[_0x518948(0x99)][_0x518948(0xe8)];console['error']('\x0a'+a29_0x41437a['yellow'](_0x518948(0x92))+'\x20'+_0x56e5cd),console[_0x518948(0xd0)]('─'['repeat'](0x3c)),console[_0x518948(0xd0)](_0x28ed3b[_0x518948(0x88)]),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));}if(_0x1a7544[_0x518948(0x91)]>0x0)for(const _0x166982 of _0x1a7544){const _0x483292=_0x166982[_0x518948(0xdf)]?_0x166982[_0x518948(0xdf)]+'/'+_0x166982['yamlConfig']['name']:_0x166982[_0x518948(0x99)][_0x518948(0xe8)];console['error']('\x0a'+a29_0x41437a[_0x518948(0xa6)](_0x518948(0xf5))+'\x20'+_0x483292),console[_0x518948(0xd0)]('─'['repeat'](0x3c)),_0x166982[_0x518948(0x88)]&&console[_0x518948(0xd0)](_0x166982['diff']),console[_0x518948(0xd0)]('─'['repeat'](0x3c));}const _0x574fac=_0x1ea6d5[_0x518948(0xae)](_0x3bae4a=>!_0x3bae4a[_0x518948(0xb1)]&&_0x3bae4a['diff']);if(_0x574fac[_0x518948(0x91)]>0x0)for(const _0x4dac8a of _0x574fac){const _0xa86708=_0x4dac8a[_0x518948(0xdf)]?_0x4dac8a[_0x518948(0xdf)]+'/'+_0x4dac8a[_0x518948(0x99)][_0x518948(0xe8)]:_0x4dac8a[_0x518948(0x99)][_0x518948(0xe8)];console['error']('\x0a'+a29_0x41437a[_0x518948(0xa8)](_0x518948(0xb8))+'\x20'+_0xa86708),console['error']('─'['repeat'](0x3c)),console['error'](_0x4dac8a['diff']),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));}if(_0x597227[_0x518948(0x91)]>0x0)for(const _0x2026a5 of _0x597227){const _0x2e345b=_0x2026a5[_0x518948(0xbf)]?_0x253b15[_0x518948(0xa7)](_0x2026a5[_0x518948(0xbf)])||'':'',_0x2e4535=_0x2e345b?_0x2e345b+'/'+_0x2026a5[_0x518948(0xd4)]:_0x2026a5['journeyBundleName'];console[_0x518948(0xd0)]('\x0a'+a29_0x41437a['red'](_0x518948(0xba))+'\x20'+_0x2e4535),console[_0x518948(0xd0)]('─'['repeat'](0x3c)),console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)](_0x518948(0xe3))),console[_0x518948(0xd0)]('─'[_0x518948(0x10f)](0x3c));}if(_0x4b34ba[_0x518948(0xfe)])return console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0xa8)](_0x518948(0x9b))),0x0;const _0x179ff7=_0x4b34ba[_0x518948(0x9d)]?![]:_0x5b340c[_0x518948(0x91)]>0x0||_0x2ac72d[_0x518948(0x91)]>0x0||_0x3ce5cf[_0x518948(0x91)]>0x0,_0x356d57=_0x1a7544[_0x518948(0x91)]>0x0||_0x74bc24[_0x518948(0x91)]>0x0||_0x597227[_0x518948(0x91)]>0x0,_0x4ce680=_0x4b34ba[_0x518948(0x9d)]?![]:_0x1a5035[_0x518948(0x91)]>0x0,_0x552a5f=_0x25c233[_0x518948(0x91)]>0x0;if(!_0x179ff7&&!_0x356d57&&!_0x4ce680&&!_0x552a5f){const _0x523706=_0x4b34ba['journeysOnly']?_0x518948(0xca):_0x518948(0xd2);console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0xa6)](_0x523706));if(_0x1ea3f8&&_0x3ca522['length']===0x1){const _0x5377a2=_0x3ca522[0x0];if(_0x5377a2[_0x518948(0x9f)]?.['id']){const _0xa54812=getConsoleNextUrl(_0x4b34ba[_0x518948(0xb4)],'/app/ps/'+_0x39c6a2+_0x518948(0x107)+_0x5377a2[_0x518948(0x9f)]['id']+_0x518948(0x115));console[_0x518948(0xd0)]('\x20\x20'+a29_0x41437a['cyan'](_0xa54812));}}return 0x0;}const _0x2010b7=_0x4b34ba[_0x518948(0x9d)]?_0x1a7544[_0x518948(0x91)]+_0x74bc24[_0x518948(0x91)]+_0x597227['length']+_0x25c233[_0x518948(0x91)]:_0x5b340c[_0x518948(0x91)]+_0x2ac72d[_0x518948(0x91)]+_0x3ce5cf[_0x518948(0x91)]+_0x1a7544[_0x518948(0x91)]+_0x74bc24[_0x518948(0x91)]+_0x597227[_0x518948(0x91)]+_0x25c233[_0x518948(0x91)]+_0x1a5035['length'];if(!_0x4b34ba[_0x518948(0x113)]&&_0x2010b7>0x0){const _0x115faa=await confirmKey(_0x518948(0xb7)+_0x2010b7+_0x518948(0x103));if(!_0x115faa)return console[_0x518948(0xd0)](_0x518948(0xcf)),0x1;}const _0x261f6b={'withProgress':async(_0x481da8,_0x3f6bf8)=>{const _0x294a55=_0x518948,_0x23d9c8=await withSpinner(_0x481da8,_0x3f6bf8,{'verbose':_0x4b34ba[_0x294a55(0xda)]});return{'data':_0x23d9c8[_0x294a55(0xf6)]};},'logInfo':_0x4d0a4c=>console[_0x518948(0xd0)](a29_0x41437a['blue']('✔\x20'+_0x4d0a4c)),'logSuccess':_0x333b42=>console['error'](a29_0x41437a['green']('✔\x20'+_0x333b42)),'logWarning':_0x14c67a=>console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0xa8)]('⚠\x20'+_0x14c67a)),'logDeleted':_0x1923f3=>console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0x9e)]('✔\x20'+_0x1923f3))},_0x3415f4={'segment':_0x424321['segment'],'journey':_0x424321[_0x518948(0x11f)],'user':_0x424321[_0x518948(0x109)],'connection':_0x424321[_0x518948(0x119)]};_0x25c233['length']>0x0&&(_0x46f139=await executePushFolders(_0x3415f4,_0x25c233,_0x46f139,{'parentId':_0x39c6a2},_0x261f6b));const _0x407b02={'rootFolderId':_0x4b7a36,'folderPathToId':_0x46f139,'folderIdToPath':_0x253b15,'segmentNameToId':_0x729cdc,'activationsBySegmentId':_0x495d66,'emailToIdMap':_0x145a24,'idToEmailMap':_0x7c5a05,'connectionNameToIdMap':_0x10426c[_0x518948(0xd6)],'connectionIdToNameMap':_0x10426c[_0x518948(0xf7)],'connectionNameToTypeMap':_0x19d89f},_0x319af7=await executePushSegments(_0x3415f4,_0x4b34ba[_0x518948(0x9d)]?[]:_0x2a5e49,_0x407b02,{'parentId':_0x39c6a2},_0x261f6b),_0x5177d4=_0x319af7[_0x518948(0xe2)],_0x511627=_0x319af7[_0x518948(0x10a)],_0x4045e3=_0x319af7['activations'][_0x518948(0xe2)],_0x40688d=_0x319af7[_0x518948(0xaf)][_0x518948(0x10a)],_0x493d33=_0x319af7[_0x518948(0xaf)][_0x518948(0x93)],_0x515328=await executePushSegmentDeletions(_0x3415f4,_0x4b34ba[_0x518948(0x9d)]?[]:_0x3ce5cf,_0x261f6b);let _0x2b944f=0x0,_0x3c7994=0x0,_0x546f29=0x0;const _0x26a477=new Map(_0x729cdc);for(const [_0x9f5684,_0x3a29e2]of _0x319af7['createdSegmentIds']){_0x26a477[_0x518948(0xed)](_0x9f5684,_0x3a29e2);}if(_0x1ea6d5[_0x518948(0x91)]>0x0){const _0x5a2787={..._0x407b02,'segmentNameToId':_0x26a477,'existingSegments':_0x371b81,'activationContext':_0x37da93},_0x24a290=await executePushJourneys(_0x3415f4,_0x1ea6d5,_0x5a2787,{'parentId':_0x39c6a2,'rootFolderId':_0x4b7a36,'verbose':_0x4b34ba[_0x518948(0xda)]},_0x261f6b);_0x2b944f=_0x24a290[_0x518948(0xe2)],_0x3c7994=_0x24a290[_0x518948(0x10a)];if(_0x1ea3f8&&_0x24a290[_0x518948(0xf3)][_0x518948(0x91)]===0x1){const _0x553910=_0x24a290['results'][0x0];if(_0x553910[_0x518948(0xfd)]){const _0x37aecb=getConsoleNextUrl(_0x4b34ba['site'],_0x518948(0xe4)+_0x39c6a2+'/e/'+_0x553910['journeyId']+'/j/da/je');console[_0x518948(0xd0)]('\x20\x20'+a29_0x41437a['cyan'](_0x37aecb));}}}for(const _0x59fba4 of _0x597227){console[_0x518948(0xd0)](a29_0x41437a[_0x518948(0xa8)](_0x518948(0x101)+_0x59fba4[_0x518948(0xd4)])),_0x546f29++;}const _0x518ee0=[];if(_0x5177d4>0x0)_0x518ee0[_0x518948(0xde)](_0x5177d4+_0x518948(0xa9));if(_0x511627>0x0)_0x518ee0['push'](_0x511627+_0x518948(0xc2));if(_0x515328>0x0)_0x518ee0[_0x518948(0xde)](_0x515328+'\x20deleted');const _0x115bb3=[];if(_0x2b944f>0x0)_0x115bb3[_0x518948(0xde)](_0x2b944f+'\x20created');if(_0x3c7994>0x0)_0x115bb3['push'](_0x3c7994+_0x518948(0xc2));if(_0x546f29>0x0)_0x115bb3[_0x518948(0xde)](_0x546f29+_0x518948(0xff));const _0x484924=[];if(_0x4045e3>0x0)_0x484924['push'](_0x4045e3+_0x518948(0xa9));if(_0x40688d>0x0)_0x484924['push'](_0x40688d+_0x518948(0xc2));if(_0x493d33>0x0)_0x484924[_0x518948(0xde)](_0x493d33+_0x518948(0xff));return console['error'](a29_0x41437a['green'](_0x518948(0x8e))),_0x518ee0[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0x9d)]&&console[_0x518948(0xd0)]('\x20\x20Segments:\x20'+_0x518ee0[_0x518948(0xfc)](',\x20')),_0x115bb3[_0x518948(0x91)]>0x0&&console[_0x518948(0xd0)](_0x518948(0x8c)+_0x115bb3[_0x518948(0xfc)](',\x20')),_0x484924[_0x518948(0x91)]>0x0&&!_0x4b34ba[_0x518948(0x9d)]&&console[_0x518948(0xd0)]('\x20\x20Activations:\x20'+_0x484924[_0x518948(0xfc)](',\x20')),0x0;}}
|
|
1
|
+
const a29_0x5b747d=a29_0x1516;(function(_0x360a9a,_0xbffabd){const _0x1d77bb=a29_0x1516,_0x1d2a2a=_0x360a9a();while(!![]){try{const _0x20a3b1=-parseInt(_0x1d77bb(0x255))/0x1+parseInt(_0x1d77bb(0x276))/0x2*(-parseInt(_0x1d77bb(0x27a))/0x3)+parseInt(_0x1d77bb(0x253))/0x4*(parseInt(_0x1d77bb(0x24a))/0x5)+parseInt(_0x1d77bb(0x1fa))/0x6*(-parseInt(_0x1d77bb(0x25c))/0x7)+-parseInt(_0x1d77bb(0x25d))/0x8*(-parseInt(_0x1d77bb(0x211))/0x9)+-parseInt(_0x1d77bb(0x248))/0xa*(parseInt(_0x1d77bb(0x204))/0xb)+parseInt(_0x1d77bb(0x244))/0xc;if(_0x20a3b1===_0xbffabd)break;else _0x1d2a2a['push'](_0x1d2a2a['shift']());}catch(_0x52e6e3){_0x1d2a2a['push'](_0x1d2a2a['shift']());}}}(a29_0x4022,0x48f29));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x5e6929 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a29_0x4022(){const _0x4a4c50=['⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','user','journeysOnly','(Journey\x20will\x20be\x20deleted)','4245240JUVycD','dim','idToName','changed','11810htIXFl','\x20\x20Activations:\x20','10630pvQAUY','nameToType','repeat','journeys','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','getParent','Error:\x20Directory\x20not\x20found:\x20','paused','New\x20journey:','632mOzODy','segment','2260XVycfB','green','listJourneysWithDetailsFromParentSegment','targetDir','Changes\x20to\x20journey:','journeyBundleId','versionNumber','644BPcDqJ','8upnimx','red','Fetching\x20existing\x20segments...','yamlConfig','\x20new','\x20updated','\x20\x20Source:\x20','getJourney','\x20\x20📊\x20Segments:','parent_name','isScoped','file','\x20to\x20update','length','listActivations','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','toDelete','results','attributes','No\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','journeyId','Parent\x20segment:\x20','scopedFolderPath','698AZmgho','\x20created','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','3981lWWLFo','\x20activations]','endsWith','yellow','\x0aPush\x20summary\x20for\x20\x27','journeyBundleName','listFolders','journey','Push\x20','\x20\x20Activations:','existingJourney','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','setPhase','segment:push','relationships','diff','toCreate','\x27...','delete','push','\x0aValidation\x20failed:','message','createdAt','cyan','getOutputSchemaWithCache','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isNew','parentSegment','toString','24132UWHGZy','Site:\x20','updatedAt','new','verbose','then','segment\x20or\x20journey','\x20unchanged','segments','Error:\x20','176yPDbyL','data','📁\x20','\x20\x20🗺️\x20\x20Journeys:','join','get','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','/e/','parentFolder','updated','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Preparing\x20journeys...','\x20deleted','4170762padCVf','type','no_parent','cwd','filter','listSegments','\x20changes?','/app/ps/','Scoped\x20to\x20folder:\x20','connection','\x0a✔\x20Push\x20complete','execute','name','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','description','segmentFolderId','/j/da/je','Resolving\x20parent\x20segment\x20\x27','Fetching\x20parent\x20segment\x20details...','\x20\x20Journeys:\x20','map','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','helpText','folderId','nameToId','\x20to\x20delete','yes','\x20\x20\x20\x20','activations','unchanged','resolveParentId','Delete\x20journey:','folderPath','state','Changes\x20to:','site','error','.yaml','\x20changed','blue','Aborted.','buildUserMaps','Fetching\x20existing\x20folders...','createdSegmentIds','list','\x20to\x20create','created'];a29_0x4022=function(){return _0x4a4c50;};return a29_0x4022();}function a29_0x1516(_0x2cdff6,_0x4590d0){_0x2cdff6=_0x2cdff6-0x1e0;const _0x402223=a29_0x4022();let _0x151650=_0x402223[_0x2cdff6];return _0x151650;}import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a29_0x5b747d(0x21d)]=a29_0x5b747d(0x1ea);[a29_0x5b747d(0x21f)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a29_0x5b747d(0x21c)](_0x428954){const _0x4d7d81=a29_0x5b747d,{options:_0x4f8f47,args:_0x375ffa,tdx:_0xbd46d4}=_0x428954,_0x1bfe92=_0x4f8f47,_0x12b503=await resolveTarget({'arg':_0x375ffa[0x0],'contextParent':_0x4f8f47[_0x4d7d81(0x1f8)],'cwd':process[_0x4d7d81(0x214)]()});if(!isSuccessfulResolution(_0x12b503))return _0x12b503['errorCode']===_0x4d7d81(0x213)?(console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x21e))),console[_0x4d7d81(0x235)](_0x4d7d81(0x1e8)),console[_0x4d7d81(0x235)](_0x4d7d81(0x272)),console[_0x4d7d81(0x235)](_0x4d7d81(0x26c))):(console['error'](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x203)+_0x12b503['message']+'\x0a')),_0x12b503[_0x4d7d81(0x227)]&&console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x12b503['helpText']))),0x1;if(_0x12b503[_0x4d7d81(0x212)]===_0x4d7d81(0x266))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x250)+_0x12b503[_0x4d7d81(0x258)]+'\x0a')),console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x1f6))),0x1;const _0x45cca4=_0x12b503['parentName'],_0x132cd3=_0x12b503['targetDir'],_0x4c6f5e=_0x12b503[_0x4d7d81(0x212)]===_0x4d7d81(0x268)?_0x12b503['filePath']:undefined,_0x40bd7c=getScopedDetails(_0x12b503),_0x5b1b69=_0x40bd7c?.[_0x4d7d81(0x267)]??![],_0x21fc4d=_0x40bd7c?.[_0x4d7d81(0x275)]??'';if(!existsSync(_0x132cd3))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x250)+_0x132cd3+'\x0a')),console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x1f6))),0x1;_0x1bfe92[_0x4d7d81(0x1fe)]&&(console[_0x4d7d81(0x235)](_0x4d7d81(0x1fb)+_0x1bfe92['site']),console[_0x4d7d81(0x235)](_0x4d7d81(0x274)+_0x45cca4),console['error']('Source\x20directory:\x20'+_0x132cd3),_0x5b1b69&&console[_0x4d7d81(0x235)](_0x4d7d81(0x219)+_0x21fc4d));const _0x4920ad=await withSpinner(_0x4d7d81(0x222)+_0x45cca4+_0x4d7d81(0x1ee),()=>_0xbd46d4[_0x4d7d81(0x254)][_0x4d7d81(0x22f)](_0x45cca4),{'verbose':_0x1bfe92['verbose']}),_0x34c916=_0x4920ad[_0x4d7d81(0x205)],[_0x1f064b,_0x3c46bc,_0x2f79ec,_0x2724b1,_0x3262cd]=await Promise['all']([withSpinner(_0x4d7d81(0x223),()=>_0xbd46d4['segment'][_0x4d7d81(0x24f)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner(_0x4d7d81(0x25f),()=>_0xbd46d4['segment'][_0x4d7d81(0x216)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner(_0x4d7d81(0x23b),()=>_0xbd46d4[_0x4d7d81(0x254)][_0x4d7d81(0x1e3)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0xbd46d4[_0x4d7d81(0x1e4)][_0x4d7d81(0x257)](_0x34c916,{'includeAllVersions':!![]}),{'verbose':_0x1bfe92['verbose']}),withSpinner(_0x4d7d81(0x271),()=>_0xbd46d4[_0x4d7d81(0x241)][_0x4d7d81(0x23a)](),{'verbose':_0x1bfe92['verbose']})['then'](_0x4af25e=>_0x4af25e[_0x4d7d81(0x205)])]),_0x30a21d=_0x1f064b[_0x4d7d81(0x205)],_0x2b7c93=extractRootFolderId(_0x30a21d),_0x2da16c=_0x3c46bc[_0x4d7d81(0x205)],_0x42728b=_0x2f79ec[_0x4d7d81(0x205)],{journeys:_0x54fd1e,activationStepsById:_0x17b1ec}=_0x2724b1['data'],_0x2d736a=new Map(_0x54fd1e[_0x4d7d81(0x225)](_0x1d205c=>[_0x1d205c['id'],_0x1d205c])),_0x34025c=_0x54fd1e[_0x4d7d81(0x225)](_0x5ab047=>({'id':_0x5ab047['id'],'name':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x21d)],'journeyBundleName':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x1e2)]||'','journeyBundleId':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x25a)]||'','versionNumber':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x25b)],'description':_0x5ab047[_0x4d7d81(0x26f)]['description'],'state':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x232)],'paused':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x251)],'audienceId':_0x5ab047['attributes']['audienceId'],'folderId':_0x5ab047[_0x4d7d81(0x1eb)]?.[_0x4d7d81(0x20c)]?.[_0x4d7d81(0x205)]?.['id'],'createdAt':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x1f3)],'updatedAt':_0x5ab047['attributes'][_0x4d7d81(0x1fc)]})),{emailToId:_0x315eee,idToEmail:_0x580524}=_0x3262cd,_0x1ee79c=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x14fb61=_0x4d7d81,_0x581770=await _0xbd46d4[_0x14fb61(0x21a)][_0x14fb61(0x23d)]();return buildConnectionMaps(_0x581770);},{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]})[_0x4d7d81(0x1ff)](_0x8f1628=>_0x8f1628[_0x4d7d81(0x205)]),_0x3c91ce=_0x1ee79c[_0x4d7d81(0x229)],_0x3d68fd=_0x1ee79c[_0x4d7d81(0x246)],_0x46c356=_0x1ee79c[_0x4d7d81(0x24b)],_0x48f71b={'emailToIdMap':_0x315eee,'connectionNameToIdMap':_0x3c91ce,'connectionNameToTypeMap':_0x46c356,'getSchema':_0x546913=>_0xbd46d4[_0x4d7d81(0x21a)][_0x4d7d81(0x1f5)](_0x546913)};let {pathToId:_0x2b231f,idToPath:_0x3314ee}=buildFolderMaps(_0x42728b);const _0x5f3847=buildSegmentLookupMap(_0x2da16c,_0x3314ee),_0x459d15=buildSegmentNameToIdMap(_0x2da16c),_0x1b36da=buildJourneyBundleLookupMap(_0x34025c,_0x3314ee);let _0x220268;if(_0x4c6f5e){if(!_0x4c6f5e[_0x4d7d81(0x27c)]('.yml')&&!_0x4c6f5e['endsWith'](_0x4d7d81(0x236)))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x226)+_0x4c6f5e+'\x0a')),0x1;_0x220268=[_0x4c6f5e];}else _0x220268=findYamlFiles(_0x132cd3);if(_0x220268[_0x4d7d81(0x26a)]===0x0)return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x132cd3+'\x0a')),console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x20a))),0x1;let _0x3cbc24,_0x2c7ea4;try{const _0xeb1066=parseAndClassifyYamlFiles(_0x220268,_0x132cd3,{'skipSegments':_0x1bfe92[_0x4d7d81(0x242)]});_0x3cbc24=_0xeb1066[_0x4d7d81(0x202)],_0x2c7ea4=_0xeb1066[_0x4d7d81(0x24d)];const _0x38cf0a=validateParsedFiles(_0xeb1066,_0x132cd3);if(_0x38cf0a[_0x4d7d81(0x26a)]>0x0)return console['error'](a29_0x5e6929['red'](_0x4d7d81(0x1f1))),console[_0x4d7d81(0x235)](formatValidationErrors(_0x38cf0a)),console['error'](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x24e))),0x1;}catch(_0xc26426){return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('Error\x20parsing\x20YAML:\x20'+(_0xc26426 instanceof Error?_0xc26426[_0x4d7d81(0x1f2)]:_0xc26426))),0x1;}if(_0x3cbc24[_0x4d7d81(0x26a)]===0x0&&_0x2c7ea4['length']===0x0){const _0x324c12=_0x1bfe92['journeysOnly']?'journey':_0x4d7d81(0x200);return console['error'](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x270)+_0x324c12+'\x20YAML\x20files\x20found')),0x0;}const _0x4fb0f3=new Map();_0x2da16c[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x2da16c,async _0x784fcf=>{const _0x5bab9e=a29_0x1516,_0x18259e=await _0xbd46d4[_0x5bab9e(0x254)][_0x5bab9e(0x26b)](_0x34c916,_0x784fcf['id']);_0x4fb0f3['set'](_0x784fcf['id'],_0x18259e);});},{'verbose':_0x1bfe92['verbose']});const {segmentFiles:_0x304ce2,foldersToCreate:_0x4763a0}=await prepareSegmentFiles(_0x3cbc24,{'segmentByFolderAndName':_0x5f3847,'activationsBySegmentId':_0x4fb0f3,'folderPathToId':_0x2b231f,'idToEmailMap':_0x580524,'connectionIdToNameMap':_0x3d68fd},_0x48f71b,_0x5b1b69,_0x21fc4d),_0x47c4ed=_0x4c6f5e?[]:findSegmentsToDelete(_0x2da16c,_0x3cbc24[_0x4d7d81(0x225)](({yamlConfig:_0x4e4b1f,folderPath:_0x93eb22})=>({'yamlConfig':_0x4e4b1f,'folderPath':resolveTDFolderPath(_0x93eb22,_0x5b1b69,_0x21fc4d)})),_0x3314ee,_0x21fc4d,_0x5b1b69),{journeyFiles:_0x44348f,foldersToCreate:_0x5ee4c0}=await withProgressSpinner(_0x4d7d81(0x20f),async _0xadc146=>prepareJourneyFiles(_0x2c7ea4,{'fetchJourney':async _0x29a2db=>_0xbd46d4[_0x4d7d81(0x1e4)][_0x4d7d81(0x264)](_0x29a2db[_0x4d7d81(0x273)]),'journeyBundlesByFolderAndName':_0x1b36da,'folderPathToId':_0x2b231f,'idToEmailMap':_0x580524,'connectionIdToNameMap':_0x3d68fd,'existingSegments':_0x2da16c,'parentId':_0x34c916,'deps':_0xbd46d4,'progress':{'update':_0x56b32e=>{const _0x17aa26=_0x4d7d81;_0xadc146[_0x17aa26(0x1e9)](_0x56b32e),_0x1bfe92[_0x17aa26(0x1fe)]&&console[_0x17aa26(0x235)]('\x20\x20'+_0x56b32e);}},'journeyById':_0x2d736a,'activationStepsById':_0x17b1ec},_0x5b1b69,_0x21fc4d),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]})[_0x4d7d81(0x1ff)](_0x147981=>_0x147981['data']);for(const _0xd2730f of _0x5ee4c0){_0x4763a0['add'](_0xd2730f);}const _0x305e83=_0x4c6f5e?[]:findJourneysToDelete(_0x34025c,_0x2c7ea4['map'](({yamlConfig:_0x4accf1,folderPath:_0x32d2dd})=>({'yamlConfig':_0x4accf1,'folderPath':resolveTDFolderPath(_0x32d2dd,_0x5b1b69,_0x21fc4d)})),_0x3314ee,_0x21fc4d,_0x5b1b69),_0x278d54=calculatePushStats(_0x304ce2,_0x44348f,_0x4763a0,_0x47c4ed,_0x305e83,!!_0x1bfe92[_0x4d7d81(0x1ef)],!!_0x1bfe92[_0x4d7d81(0x242)]),_0x22a617=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x1fd)],_0x5c8952=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x247)],_0x55bf73=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x22e)],_0x1d4b34=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x26d)],_0x3f0754=_0x278d54['folders']['toCreate'],_0x4fc09d=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x1fd)],_0xb44f5e=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x247)],_0x2fe622=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x22e)],_0x437d41=_0x278d54['journeys'][_0x4d7d81(0x26d)],_0x202f55=_0x278d54[_0x4d7d81(0x22d)]['all'],_0x44a84e=_0x278d54[_0x4d7d81(0x22d)][_0x4d7d81(0x1ed)],_0x290ed2=_0x278d54['activations']['toUpdate'],_0x4ef21f=_0x278d54[_0x4d7d81(0x22d)][_0x4d7d81(0x26d)];console[_0x4d7d81(0x235)](_0x4d7d81(0x1e1)+_0x45cca4+'\x27:');_0x3f0754[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x238)](_0x4d7d81(0x206)+_0x3f0754['length']+'\x20folders\x20to\x20create'));if(!_0x1bfe92[_0x4d7d81(0x242)]){console[_0x4d7d81(0x235)](_0x4d7d81(0x265)),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x22a617['length']+'\x20new')),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x1e0)]('~\x20'+_0x5c8952[_0x4d7d81(0x26a)]+_0x4d7d81(0x237)));if(_0x1d4b34[_0x4d7d81(0x26a)]>0x0)console['error'](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x25e)]('-\x20'+_0x1d4b34['length']+_0x4d7d81(0x22a)));else _0x47c4ed[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['delete']&&console[_0x4d7d81(0x235)]('\x20\x20\x20\x20'+a29_0x5e6929[_0x4d7d81(0x245)](_0x47c4ed[_0x4d7d81(0x26a)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x245)]('=\x20'+_0x55bf73['length']+_0x4d7d81(0x201)));}if(_0x44348f[_0x4d7d81(0x26a)]>0x0||_0x305e83[_0x4d7d81(0x26a)]>0x0){console[_0x4d7d81(0x235)](_0x4d7d81(0x207)),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x4fc09d['length']+_0x4d7d81(0x261))),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x1e0)]('~\x20'+_0xb44f5e[_0x4d7d81(0x26a)]+_0x4d7d81(0x237)));if(_0x437d41[_0x4d7d81(0x26a)]>0x0)console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x25e)]('-\x20'+_0x437d41[_0x4d7d81(0x26a)]+'\x20to\x20delete'));else _0x305e83[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x1ef)]&&console['error']('\x20\x20\x20\x20'+a29_0x5e6929[_0x4d7d81(0x245)](_0x305e83[_0x4d7d81(0x26a)]+_0x4d7d81(0x278)));console['error'](_0x4d7d81(0x22c)+a29_0x5e6929['dim']('=\x20'+_0x2fe622[_0x4d7d81(0x26a)]+'\x20unchanged'));}_0x202f55[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&(console[_0x4d7d81(0x235)](''),console[_0x4d7d81(0x235)](_0x4d7d81(0x1e6)),_0x44a84e[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x44a84e[_0x4d7d81(0x26a)]+_0x4d7d81(0x23e))),_0x290ed2[_0x4d7d81(0x26a)]>0x0&&console['error'](_0x4d7d81(0x22c)+a29_0x5e6929['yellow']('~\x20'+_0x290ed2[_0x4d7d81(0x26a)]+_0x4d7d81(0x269))),_0x4ef21f[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929['red']('-\x20'+_0x4ef21f[_0x4d7d81(0x26a)]+_0x4d7d81(0x22a))));console['error'](_0x4d7d81(0x263)+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x132cd3)+'\x0a');if(_0x3f0754[_0x4d7d81(0x26a)]>0x0){console['error']('Folders\x20to\x20create:');for(const _0x5875f6 of _0x3f0754){console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929['blue']('+')+'\x20'+_0x5875f6);}console[_0x4d7d81(0x235)]('');}if(_0x22a617[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['journeysOnly'])for(const _0x4205e1 of _0x22a617){const _0x42327e=_0x4205e1[_0x4d7d81(0x231)]?_0x4205e1[_0x4d7d81(0x231)]+'/'+_0x4205e1[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x4205e1['yamlConfig'][_0x4d7d81(0x21d)],_0x1b8edd=_0x4205e1[_0x4d7d81(0x260)][_0x4d7d81(0x22d)]?.[_0x4d7d81(0x26a)]||0x0,_0x66c479=_0x1b8edd>0x0?a29_0x5e6929['dim']('\x20['+_0x1b8edd+_0x4d7d81(0x27b)):'';console['error']('\x0a'+a29_0x5e6929[_0x4d7d81(0x256)]('New\x20segment:')+'\x20'+_0x42327e+_0x66c479),console['error']('─'[_0x4d7d81(0x24c)](0x3c)),_0x4205e1[_0x4d7d81(0x1ec)]&&console[_0x4d7d81(0x235)](_0x4205e1[_0x4d7d81(0x1ec)]),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x1d4b34[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['journeysOnly'])for(const _0x524700 of _0x1d4b34){const _0x5c48b1=_0x524700[_0x4d7d81(0x220)]?_0x3314ee[_0x4d7d81(0x209)](_0x524700[_0x4d7d81(0x220)][_0x4d7d81(0x1f9)]())||'':'',_0x2099bf=_0x5c48b1?_0x5c48b1+'/'+_0x524700['name']:_0x524700[_0x4d7d81(0x21d)],_0x1a6ed5=_0x4fb0f3[_0x4d7d81(0x209)](_0x524700['id'])||[],_0x298cb9=_0x1a6ed5[_0x4d7d81(0x26a)]>0x0?a29_0x5e6929[_0x4d7d81(0x245)]('\x20['+_0x1a6ed5[_0x4d7d81(0x26a)]+_0x4d7d81(0x27b)):'';console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929['red']('Delete\x20segment:')+'\x20'+_0x2099bf+_0x298cb9),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c));const _0x502cc7=segmentWithActivationsToYaml(_0x524700,_0x1a6ed5,undefined,_0x580524,_0x3d68fd),_0x19ba0e=segmentToYamlString(_0x502cc7),_0x47273f=generateDiff(_0x19ba0e,'');console[_0x4d7d81(0x235)](formatDiffWithColors(_0x47273f)),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}const _0x2e97d6=_0x304ce2[_0x4d7d81(0x215)](_0xc7553b=>!_0xc7553b[_0x4d7d81(0x1f7)]&&_0xc7553b[_0x4d7d81(0x1ec)]);if(_0x2e97d6[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)])for(const _0x8a37aa of _0x2e97d6){const _0x352172=_0x8a37aa[_0x4d7d81(0x231)]?_0x8a37aa[_0x4d7d81(0x231)]+'/'+_0x8a37aa[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x8a37aa[_0x4d7d81(0x260)][_0x4d7d81(0x21d)];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x233))+'\x20'+_0x352172),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c)),console[_0x4d7d81(0x235)](_0x8a37aa['diff']),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x4fc09d[_0x4d7d81(0x26a)]>0x0)for(const _0x352d53 of _0x4fc09d){const _0xd39434=_0x352d53[_0x4d7d81(0x231)]?_0x352d53['folderPath']+'/'+_0x352d53[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x352d53[_0x4d7d81(0x260)][_0x4d7d81(0x21d)];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x256)](_0x4d7d81(0x252))+'\x20'+_0xd39434),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),_0x352d53[_0x4d7d81(0x1ec)]&&console['error'](_0x352d53[_0x4d7d81(0x1ec)]),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}const _0x2c8cee=_0x44348f[_0x4d7d81(0x215)](_0xc32bf1=>!_0xc32bf1[_0x4d7d81(0x1f7)]&&_0xc32bf1['diff']);if(_0x2c8cee[_0x4d7d81(0x26a)]>0x0)for(const _0x4354a6 of _0x2c8cee){const _0x5334ee=_0x4354a6['folderPath']?_0x4354a6[_0x4d7d81(0x231)]+'/'+_0x4354a6[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x4354a6[_0x4d7d81(0x260)]['name'];console['error']('\x0a'+a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x259))+'\x20'+_0x5334ee),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),console[_0x4d7d81(0x235)](_0x4354a6['diff']),console['error']('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x437d41['length']>0x0)for(const _0xb9c601 of _0x437d41){const _0x4ab713=_0xb9c601[_0x4d7d81(0x228)]?_0x3314ee[_0x4d7d81(0x209)](_0xb9c601[_0x4d7d81(0x228)])||'':'',_0x27b8d9=_0x4ab713?_0x4ab713+'/'+_0xb9c601[_0x4d7d81(0x1e2)]:_0xb9c601['journeyBundleName'];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x230))+'\x20'+_0x27b8d9),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),console['error'](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x243))),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c));}if(_0x1bfe92['dryRun'])return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x20e))),0x0;const _0x39d039=_0x1bfe92['journeysOnly']?![]:_0x22a617['length']>0x0||_0x5c8952[_0x4d7d81(0x26a)]>0x0||_0x1d4b34['length']>0x0,_0x5eb464=_0x4fc09d[_0x4d7d81(0x26a)]>0x0||_0xb44f5e[_0x4d7d81(0x26a)]>0x0||_0x437d41[_0x4d7d81(0x26a)]>0x0,_0x45aafc=_0x1bfe92[_0x4d7d81(0x242)]?![]:_0x202f55[_0x4d7d81(0x26a)]>0x0,_0x21fcb1=_0x3f0754[_0x4d7d81(0x26a)]>0x0;if(!_0x39d039&&!_0x5eb464&&!_0x45aafc&&!_0x21fcb1){const _0x27b5da=_0x1bfe92['journeysOnly']?_0x4d7d81(0x279):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x256)](_0x27b5da));if(_0x4c6f5e&&_0x2fe622[_0x4d7d81(0x26a)]===0x1){const _0x482f3e=_0x2fe622[0x0];if(_0x482f3e['existingJourney']?.['id']){const _0x26e787=getConsoleNextUrl(_0x1bfe92[_0x4d7d81(0x234)],_0x4d7d81(0x218)+_0x34c916+_0x4d7d81(0x20b)+_0x482f3e[_0x4d7d81(0x1e7)]['id']+_0x4d7d81(0x221));console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x26e787));}}return 0x0;}const _0x10898c=_0x1bfe92['journeysOnly']?_0x4fc09d[_0x4d7d81(0x26a)]+_0xb44f5e[_0x4d7d81(0x26a)]+_0x437d41[_0x4d7d81(0x26a)]+_0x3f0754['length']:_0x22a617[_0x4d7d81(0x26a)]+_0x5c8952[_0x4d7d81(0x26a)]+_0x1d4b34[_0x4d7d81(0x26a)]+_0x4fc09d['length']+_0xb44f5e[_0x4d7d81(0x26a)]+_0x437d41[_0x4d7d81(0x26a)]+_0x3f0754[_0x4d7d81(0x26a)]+_0x202f55[_0x4d7d81(0x26a)];if(!_0x1bfe92[_0x4d7d81(0x22b)]&&_0x10898c>0x0){const _0xe2c2ca=await confirmKey(_0x4d7d81(0x1e5)+_0x10898c+_0x4d7d81(0x217));if(!_0xe2c2ca)return console['error'](_0x4d7d81(0x239)),0x1;}const _0x182919={'withProgress':async(_0x225e58,_0x91adca)=>{const _0x2d124b=_0x4d7d81,_0x3822f8=await withSpinner(_0x225e58,_0x91adca,{'verbose':_0x1bfe92[_0x2d124b(0x1fe)]});return{'data':_0x3822f8['data']};},'logInfo':_0x234ceb=>console['error'](a29_0x5e6929[_0x4d7d81(0x238)]('✔\x20'+_0x234ceb)),'logSuccess':_0x4aa321=>console['error'](a29_0x5e6929[_0x4d7d81(0x256)]('✔\x20'+_0x4aa321)),'logWarning':_0xf92dd5=>console[_0x4d7d81(0x235)](a29_0x5e6929['yellow']('⚠\x20'+_0xf92dd5)),'logDeleted':_0x2f4c69=>console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('✔\x20'+_0x2f4c69))},_0x3d2e4d={'segment':_0xbd46d4[_0x4d7d81(0x254)],'journey':_0xbd46d4[_0x4d7d81(0x1e4)],'user':_0xbd46d4[_0x4d7d81(0x241)],'connection':_0xbd46d4[_0x4d7d81(0x21a)]};_0x3f0754['length']>0x0&&(_0x2b231f=await executePushFolders(_0x3d2e4d,_0x3f0754,_0x2b231f,{'parentId':_0x34c916},_0x182919));const _0xf96b52={'rootFolderId':_0x2b7c93,'folderPathToId':_0x2b231f,'folderIdToPath':_0x3314ee,'segmentNameToId':_0x459d15,'activationsBySegmentId':_0x4fb0f3,'emailToIdMap':_0x315eee,'idToEmailMap':_0x580524,'connectionNameToIdMap':_0x1ee79c[_0x4d7d81(0x229)],'connectionIdToNameMap':_0x1ee79c[_0x4d7d81(0x246)],'connectionNameToTypeMap':_0x46c356},_0x2fd90d=await executePushSegments(_0x3d2e4d,_0x1bfe92[_0x4d7d81(0x242)]?[]:_0x304ce2,_0xf96b52,{'parentId':_0x34c916},_0x182919),_0x4e17d8=_0x2fd90d['created'],_0x550ba4=_0x2fd90d[_0x4d7d81(0x20d)],_0xbaef64=_0x2fd90d[_0x4d7d81(0x22d)][_0x4d7d81(0x23f)],_0x431e99=_0x2fd90d['activations'][_0x4d7d81(0x20d)],_0x89a596=_0x2fd90d[_0x4d7d81(0x22d)]['deleted'],_0x2f20d6=await executePushSegmentDeletions(_0x3d2e4d,_0x1bfe92[_0x4d7d81(0x242)]?[]:_0x1d4b34,_0x182919);let _0x4733ac=0x0,_0x3ce15d=0x0,_0x490ad5=0x0;const _0x241295=new Map(_0x459d15);for(const [_0x1ab0a5,_0x27badf]of _0x2fd90d[_0x4d7d81(0x23c)]){_0x241295['set'](_0x1ab0a5,_0x27badf);}if(_0x44348f[_0x4d7d81(0x26a)]>0x0){const _0x24233a={..._0xf96b52,'segmentNameToId':_0x241295,'existingSegments':_0x2da16c,'activationContext':_0x48f71b},_0x1b2b2a=await executePushJourneys(_0x3d2e4d,_0x44348f,_0x24233a,{'parentId':_0x34c916,'rootFolderId':_0x2b7c93,'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]},_0x182919);_0x4733ac=_0x1b2b2a[_0x4d7d81(0x23f)],_0x3ce15d=_0x1b2b2a['updated'];if(_0x4c6f5e&&_0x1b2b2a[_0x4d7d81(0x26e)][_0x4d7d81(0x26a)]===0x1){const _0x644adb=_0x1b2b2a[_0x4d7d81(0x26e)][0x0];if(_0x644adb[_0x4d7d81(0x273)]){const _0x2fb695=getConsoleNextUrl(_0x1bfe92[_0x4d7d81(0x234)],_0x4d7d81(0x218)+_0x34c916+_0x4d7d81(0x20b)+_0x644adb['journeyId']+_0x4d7d81(0x221));console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x2fb695));}}}for(const _0x3a1c58 of _0x437d41){console[_0x4d7d81(0x235)](a29_0x5e6929['yellow'](_0x4d7d81(0x240)+_0x3a1c58['journeyBundleName'])),_0x490ad5++;}const _0x50fa9d=[];if(_0x4e17d8>0x0)_0x50fa9d[_0x4d7d81(0x1f0)](_0x4e17d8+_0x4d7d81(0x277));if(_0x550ba4>0x0)_0x50fa9d['push'](_0x550ba4+_0x4d7d81(0x262));if(_0x2f20d6>0x0)_0x50fa9d[_0x4d7d81(0x1f0)](_0x2f20d6+_0x4d7d81(0x210));const _0x280da2=[];if(_0x4733ac>0x0)_0x280da2['push'](_0x4733ac+_0x4d7d81(0x277));if(_0x3ce15d>0x0)_0x280da2[_0x4d7d81(0x1f0)](_0x3ce15d+_0x4d7d81(0x262));if(_0x490ad5>0x0)_0x280da2[_0x4d7d81(0x1f0)](_0x490ad5+_0x4d7d81(0x210));const _0x5027c8=[];if(_0xbaef64>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0xbaef64+_0x4d7d81(0x277));if(_0x431e99>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0x431e99+'\x20updated');if(_0x89a596>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0x89a596+'\x20deleted');return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x256)](_0x4d7d81(0x21b))),_0x50fa9d[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&console[_0x4d7d81(0x235)]('\x20\x20Segments:\x20'+_0x50fa9d[_0x4d7d81(0x208)](',\x20')),_0x280da2[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x224)+_0x280da2[_0x4d7d81(0x208)](',\x20')),_0x5027c8[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&console['error'](_0x4d7d81(0x249)+_0x5027c8[_0x4d7d81(0x208)](',\x20')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a30_0x139579=a30_0x2355;(function(_0x57e11b,_0x40c052){const _0x44aed2=a30_0x2355,_0x2c8aa9=_0x57e11b();while(!![]){try{const _0x560e36=parseInt(_0x44aed2(0xa1))/0x1*(parseInt(_0x44aed2(0x91))/0x2)+parseInt(_0x44aed2(0x87))/0x3+-parseInt(_0x44aed2(0xa4))/0x4*(parseInt(_0x44aed2(0xaf))/0x5)+parseInt(_0x44aed2(0x82))/0x6+parseInt(_0x44aed2(0x92))/0x7+parseInt(_0x44aed2(0x9c))/0x8*(-parseInt(_0x44aed2(0xa3))/0x9)+-parseInt(_0x44aed2(0xa8))/0xa*(parseInt(_0x44aed2(0xa5))/0xb);if(_0x560e36===_0x40c052)break;else _0x2c8aa9['push'](_0x2c8aa9['shift']());}catch(_0x5125af){_0x2c8aa9['push'](_0x2c8aa9['shift']());}}}(a30_0x3bac,0x2e7b3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a30_0x2355(_0x49913f,_0x48b955){_0x49913f=_0x49913f-0x82;const _0x3bac80=a30_0x3bac();let _0x23559d=_0x3bac80[_0x49913f];return _0x23559d;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x4aa70b from'chalk';function a30_0x3bac(){const _0x5126ad=['description','46270NxKerN','Error:\x20Cannot\x20update\x20','2011572eayzce','Update\x20existing\x20child\x20segment','folder','updateSegmentById','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','410052bATemf','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','kind','verbose','parentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','execute','length','Resolved\x20type:\x20','resolveFolderId','28BqCEGf','452361xxFEkR','Resolving\x20path\x20\x27','yellow','✔\x20Updated\x20segment\x20\x27','includes','error','segment','name','rule','segmentPath','8OCpqaU','segmentName','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Updating\x20segment\x20\x27','19776jAPqpT','Parent\x20ID:\x20','848061WykDlf','84DcUmuM','583wbuazG','\x27...','Resolved\x20relative\x20path\x20to:\x20','63110LDivcy','type','data','resolvePathToResource','segment:update','segmentId'];a30_0x3bac=function(){return _0x5126ad;};return a30_0x3bac();}export class SegmentUpdateCommand extends BaseCommand{[a30_0x139579(0x99)]=a30_0x139579(0xac);[a30_0x139579(0xae)]=a30_0x139579(0x83);async[a30_0x139579(0x8d)](_0x15f1cb){const _0x2d26b0=a30_0x139579;console[_0x2d26b0(0x97)](a30_0x4aa70b[_0x2d26b0(0x94)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x2d26b0(0x97)](a30_0x4aa70b['yellow'](_0x2d26b0(0x88)));const {options:_0x3a6ba5,args:_0x3dbbde,tdx:_0x14b26e}=_0x15f1cb,_0x2b1086=_0x3a6ba5;if(_0x3dbbde[_0x2d26b0(0x8e)]===0x0)return console[_0x2d26b0(0x97)](_0x2d26b0(0x9e)),console['error']('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x2d26b0(0x97)]('Examples:'),console['error'](_0x2d26b0(0x8c)),console[_0x2d26b0(0x97)](_0x2d26b0(0x86)),0x1;const _0x1a77bc=_0x3dbbde[0x0],_0x410aff=_0x3a6ba5[_0x2d26b0(0x9b)];let _0x18b9ee=_0x1a77bc;_0x410aff&&!_0x1a77bc[_0x2d26b0(0x96)]('/')&&(_0x18b9ee=_0x410aff+'/'+_0x1a77bc,_0x2b1086[_0x2d26b0(0x8a)]&&console['error'](_0x2d26b0(0xa7)+_0x18b9ee));const _0x2e5699=await withSpinner(_0x2d26b0(0x93)+_0x18b9ee+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0xab)](_0x18b9ee),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]}),_0x319202=_0x2e5699['data'];_0x2b1086[_0x2d26b0(0x8a)]&&console[_0x2d26b0(0x97)](_0x2d26b0(0x8f)+_0x319202[_0x2d26b0(0xa9)]);if(_0x319202[_0x2d26b0(0xa9)]!==_0x2d26b0(0x98))return console[_0x2d26b0(0x97)](_0x2d26b0(0xb0)+_0x319202[_0x2d26b0(0xa9)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console['error']('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x319202[_0x2d26b0(0xad)])throw new SDKError(ErrorCode['INTERNAL'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38cfe8=_0x319202[_0x2d26b0(0x8b)],_0x1d40f9=_0x319202['segmentId'];_0x2b1086['verbose']&&(console[_0x2d26b0(0x97)](_0x2d26b0(0xa2)+_0x38cfe8),console[_0x2d26b0(0x97)]('Segment\x20ID:\x20'+_0x1d40f9));let _0x5dea28;if(_0x2b1086[_0x2d26b0(0x84)]){const _0x235ad8=_0x2b1086['folder'],_0x3d2cc8=await withSpinner('Resolving\x20folder\x20\x27'+_0x235ad8+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0x90)](_0x38cfe8,_0x235ad8),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]});_0x5dea28=parseInt(_0x3d2cc8[_0x2d26b0(0xaa)],0xa),_0x2b1086[_0x2d26b0(0x8a)]&&console[_0x2d26b0(0x97)](_0x2d26b0(0x9f)+_0x5dea28);}const _0xc070e0=await loadJSONFromOptions(_0x2b1086[_0x2d26b0(0x9a)],_0x2b1086['ruleFile']),_0x42a0d0={'name':_0x2b1086['name'],'description':_0x2b1086[_0x2d26b0(0xae)],'rule':_0xc070e0,'kind':_0x2b1086[_0x2d26b0(0x89)]!==undefined?parseInt(_0x2b1086['kind'],0xa):undefined,'segmentFolderId':_0x5dea28},_0x50c5d4=await withSpinner(_0x2d26b0(0xa0)+_0x319202[_0x2d26b0(0x9d)]+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0x85)](_0x38cfe8,_0x1d40f9,_0x42a0d0),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]}),_0x20008c=_0x50c5d4[_0x2d26b0(0xaa)];return console[_0x2d26b0(0x97)](_0x2d26b0(0x95)+_0x20008c[_0x2d26b0(0x99)]+'\x27'),_0x18b9ee!==_0x1a77bc&&console[_0x2d26b0(0x97)]('\x20\x20\x20Path:\x20'+_0x18b9ee),await handleSDKOutput([_0x20008c],_0x2b1086),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a31_0x4fdf6a=a31_0x3694;(function(_0x453b68,_0x4142e1){const _0x5125c1=a31_0x3694,_0x4944c1=_0x453b68();while(!![]){try{const _0x2b4498=parseInt(_0x5125c1(0x1e1))/0x1+-parseInt(_0x5125c1(0x1d3))/0x2+-parseInt(_0x5125c1(0x1d6))/0x3*(parseInt(_0x5125c1(0x1ad))/0x4)+-parseInt(_0x5125c1(0x1e5))/0x5+parseInt(_0x5125c1(0x1c0))/0x6*(parseInt(_0x5125c1(0x1c1))/0x7)+parseInt(_0x5125c1(0x1b4))/0x8+-parseInt(_0x5125c1(0x1b7))/0x9*(parseInt(_0x5125c1(0x1bc))/0xa);if(_0x2b4498===_0x4142e1)break;else _0x4944c1['push'](_0x4944c1['shift']());}catch(_0xfee1e8){_0x4944c1['push'](_0x4944c1['shift']());}}}(a31_0x3f31,0x1a61a));import{existsSync,statSync}from'fs';import a31_0xcf323c from'chalk';function a31_0x3694(_0x42f83b,_0x58e647){_0x42f83b=_0x42f83b-0x1ad;const _0x3f31bd=a31_0x3f31();let _0x369450=_0x3f31bd[_0x42f83b];return _0x369450;}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';function a31_0x3f31(){const _0x5e18c9=['site','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Use:\x20tdx\x20segment\x20use\x20','isDirectory','211854xovkta','length','name','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','158255xmZCOS','type','verbose','segment:use','280cKNYOa','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','execute','slice','segmentPath','Target\x20path:\x20','cyan','418792cvKGvI','\x27...','segments','13491duESxN','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','dim','460aFqiHz','parentId','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Folder\x20ID:\x20','21306PgdyjC','322keRMnW','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','folderId','parentName','✔\x20Context\x20set\x20to:\x20','Error:\x20Path\x20is\x20required\x0a','error','resolvePathToResource','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','fullPath','green','parent_segment','Resolved\x20path\x20type:\x20','join','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isAbsolute','session','red','140692ELMcAf','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','6366QvSwGy','log','segment','folderPath','description','Site:\x20','Parent\x20ID:\x20'];a31_0x3f31=function(){return _0x5e18c9;};return a31_0x3f31();}import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a31_0x4fdf6a(0x1e3)]=a31_0x4fdf6a(0x1e8);[a31_0x4fdf6a(0x1da)]=a31_0x4fdf6a(0x1d4);async[a31_0x4fdf6a(0x1af)](_0xeec877){const _0x32590a=a31_0x4fdf6a,{options:_0xae31c0,args:_0x3f8cc4,tdx:_0x14d8a2}=_0xeec877;if(_0x3f8cc4[_0x32590a(0x1e2)]===0x0)return console[_0x32590a(0x1c7)](a31_0xcf323c['red'](_0x32590a(0x1c6))),console[_0x32590a(0x1c7)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x32590a(0x1c7)]('Examples:'),console['error'](_0x32590a(0x1b9)),console[_0x32590a(0x1c7)](_0x32590a(0x1e4)),console[_0x32590a(0x1c7)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x32590a(0x1c7)](_0x32590a(0x1be)),0x1;const _0x552bdd=_0x3f8cc4[0x0],_0x3ca7fc=_0xae31c0[_0x32590a(0x1d1)];try{if(_0x552bdd==='/')return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;if(existsSync(_0x552bdd)&&statSync(_0x552bdd)[_0x32590a(0x1e0)]()){let _0x3af24d;try{_0x3af24d=findTdxConfig(_0x552bdd);}catch{return console['error'](a31_0xcf323c['red'](_0x32590a(0x1d5)+_0x552bdd)),console['error'](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1cf))),0x1;}const _0x4c7f00=_0x3af24d['config'][_0x32590a(0x1cc)];return saveSessionContext({'segment_path':_0x4c7f00,'parent_segment':_0x4c7f00},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)]('✔\x20Context\x20set\x20to:\x20'+a31_0xcf323c[_0x32590a(0x1b3)](_0x4c7f00))),0x0;}const _0x11f15a=_0xae31c0[_0x32590a(0x1b1)];let _0x27310d=_0x552bdd;const _0x343c2c=parsePath(_0x552bdd);if(!_0x343c2c[_0x32590a(0x1d0)]){if(!_0x11f15a)return console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1d2)](_0x32590a(0x1de))),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1ba))),0x1;if(_0x552bdd==='..'){const _0x535d2a=_0x11f15a['split']('/')[_0x32590a(0x1b0)](0x0,-0x1)[_0x32590a(0x1ce)]('/');_0x27310d=_0x535d2a||'/';}else _0x552bdd==='.'?_0x27310d=_0x11f15a:_0x27310d=_0x11f15a+'/'+_0x552bdd;_0xae31c0[_0x32590a(0x1e7)]&&console[_0x32590a(0x1c7)]('Resolved\x20relative\x20path\x20to:\x20'+_0x27310d);}if(_0x27310d==='/'||_0x27310d==='')return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;_0x27310d=normalizePath(_0x27310d);const _0x490fc8=parsePath(_0x27310d)[_0x32590a(0x1b6)];if(_0x490fc8['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](_0x32590a(0x1db)+_0xae31c0[_0x32590a(0x1dd)]),console[_0x32590a(0x1c7)](_0x32590a(0x1b2)+_0x27310d));const _0x34cedd=await withSpinner('Resolving\x20path\x20\x27'+_0x27310d+_0x32590a(0x1b5),()=>_0x14d8a2[_0x32590a(0x1d8)][_0x32590a(0x1c8)](_0x27310d),{'verbose':_0xae31c0['verbose']}),_0x113cf0=_0x34cedd['data'];_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](_0x32590a(0x1cd)+_0x113cf0[_0x32590a(0x1e6)]),console[_0x32590a(0x1c7)](_0x32590a(0x1dc)+_0x113cf0[_0x32590a(0x1bd)]),_0x113cf0[_0x32590a(0x1c3)]&&console[_0x32590a(0x1c7)](_0x32590a(0x1bf)+_0x113cf0['folderId']));if(_0x113cf0['type']===_0x32590a(0x1d8))return console['error'](a31_0xcf323c[_0x32590a(0x1d2)](_0x32590a(0x1b8))),console[_0x32590a(0x1c7)](_0x32590a(0x1c2)),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1df)+_0x113cf0[_0x32590a(0x1c4)]+(_0x113cf0[_0x32590a(0x1d9)]?'/'+_0x113cf0[_0x32590a(0x1d9)][_0x32590a(0x1ce)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x113cf0[_0x32590a(0x1ca)],'parent_segment':_0x113cf0[_0x32590a(0x1c4)]},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c['green'](_0x32590a(0x1c5)+a31_0xcf323c['cyan'](_0x113cf0[_0x32590a(0x1ca)]))),_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1bb)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1bb)](_0x32590a(0x1ae)))),0x0;}catch(_0x526f09){throw _0x526f09;}}}
|