@treasuredata/tdx 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts.map +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-command.js.map +1 -1
- package/dist/commands/agent-test-command.d.ts.map +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/agent-test-command.js.map +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.d.ts.map +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-config.js.map +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +44 -0
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/index.d.ts +2 -1
- package/dist/sdk/claude-agent/index.d.ts.map +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/index.js.map +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/claude-agent/types.d.ts +4 -1
- package/dist/sdk/claude-agent/types.d.ts.map +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.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +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 a16_0xb139fa=a16_0x459a;(function(_0x43211e,_0x48b3c8){const _0x380f7a=a16_0x459a,_0xced18c=_0x43211e();while(!![]){try{const _0x40a013=-parseInt(_0x380f7a(0xf1))/0x1+-parseInt(_0x380f7a(0xcb))/0x2+-parseInt(_0x380f7a(0xfe))/0x3*(-parseInt(_0x380f7a(0xe0))/0x4)+-parseInt(_0x380f7a(0xff))/0x5*(-parseInt(_0x380f7a(0xb9))/0x6)+-parseInt(_0x380f7a(0xc6))/0x7*(-parseInt(_0x380f7a(0xeb))/0x8)+-parseInt(_0x380f7a(0x123))/0x9+parseInt(_0x380f7a(0x10e))/0xa;if(_0x40a013===_0x48b3c8)break;else _0xced18c['push'](_0xced18c['shift']());}catch(_0x3143b7){_0xced18c['push'](_0xced18c['shift']());}}}(a16_0x5aa4,0x50025));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x101a8f,_0x41b816,_0x2fb026=![]){const _0x482501=a16_0x459a;if(_0x101a8f[_0x482501(0x120)])return await _0x41b816[_0x482501(0xe7)][_0x482501(0xa7)](_0x101a8f['workspace']);const _0x1c8692=loadSessionContext(_0x101a8f[_0x482501(0xf0)]);if(_0x1c8692?.[_0x482501(0xc2)])return await _0x41b816['engage']['resolveWorkspaceId'](_0x1c8692[_0x482501(0xc2)]);if(_0x2fb026)throw new SDKError(ErrorCode[_0x482501(0xb6)],_0x482501(0xfa),undefined,{'helpText':_0x482501(0x12d)});return undefined;}async function resolveSegmentFromOptions(_0x3ca3aa,_0xa793ec){const _0x3925d6=a16_0x459a;if(!_0x3ca3aa[_0x3925d6(0xd5)])return{};const _0x369477=_0x3ca3aa[_0x3925d6(0xd5)],_0x2ef36d=await _0xa793ec['segment'][_0x3925d6(0x128)](_0x369477);return{'audienceId':_0x2ef36d[_0x3925d6(0xb4)],'audienceName':_0x2ef36d['parentName'],..._0x2ef36d[_0x3925d6(0x122)]&&{'segmentId':_0x2ef36d[_0x3925d6(0x122)],'segmentName':_0x2ef36d[_0x3925d6(0xae)]}};}function buildConnectorConfig(_0x12f5a9){const _0xdaf50d=a16_0x459a,_0x2b9157=_0x12f5a9[_0xdaf50d(0xf8)],_0x5a77f3=_0x12f5a9[_0xdaf50d(0xcd)];if(!_0x2b9157&&!_0x5a77f3)return undefined;return{..._0x2b9157&&{'emailSenderId':_0x2b9157},..._0x5a77f3&&{'jsonColumns':_0x5a77f3}};}export class EngageCampaignsCommand extends BaseCommand{['name']='engage:campaigns';[a16_0xb139fa(0x10b)]=a16_0xb139fa(0x127);async['execute'](_0x2e02b1){const _0x5d1ea1=a16_0xb139fa,{options:_0x202fb9,args:_0x146eed,tdx:_0x37c0c3}=_0x2e02b1,_0x1d152d=_0x146eed[0x0],_0x4749f7=resolveLimit(_0x202fb9[_0x5d1ea1(0x10d)],DEFAULT_LLM_LIMIT),_0x522f5a=_0x202fb9,_0x4083cd=_0x522f5a[_0x5d1ea1(0xf5)],_0x4d6967=_0x522f5a[_0x5d1ea1(0xce)],_0x23d29b=await resolveWorkspaceIdFromOptions(_0x522f5a,_0x37c0c3),_0x1c0a3b=await withSpinner(_0x5d1ea1(0xf9),()=>_0x37c0c3[_0x5d1ea1(0xe7)]['listCampaigns']({'type':_0x4083cd,'status':_0x4d6967,'workspaceId':_0x23d29b,'limit':_0x4749f7}),{'verbose':_0x202fb9[_0x5d1ea1(0x131)]});let _0x39a27c=_0x1c0a3b[_0x5d1ea1(0xc4)];return _0x1d152d&&(_0x39a27c=_0x1c0a3b[_0x5d1ea1(0xc4)][_0x5d1ea1(0xfc)](_0x1ffe32=>matchGlobPattern(_0x1ffe32[_0x5d1ea1(0xa4)],_0x1d152d))),await handleSDKOutput(_0x39a27c,_0x202fb9),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']=a16_0xb139fa(0xb2);['description']=a16_0xb139fa(0xe2);async[a16_0xb139fa(0xb7)](_0x53833c){const _0x820f74=a16_0xb139fa,{options:_0x403bfd,args:_0x15d138,tdx:_0x2482ed}=_0x53833c;if(_0x15d138[_0x820f74(0x113)]===0x0)return console[_0x820f74(0x108)](_0x820f74(0x104)),console[_0x820f74(0x108)](_0x820f74(0x12c)),0x1;const _0x4739c7=_0x15d138[0x0],_0x1caa73=_0x403bfd,_0x2da736=await resolveWorkspaceIdFromOptions(_0x1caa73,_0x2482ed),_0x401113=_0x1caa73['full'];if(_0x401113){const _0x301420=await withSpinner('Fetching\x20campaign\x20\x27'+_0x4739c7+_0x820f74(0x12e),()=>_0x2482ed['engage'][_0x820f74(0xc8)](_0x4739c7,_0x2da736),{'verbose':_0x403bfd[_0x820f74(0x131)]});await handleSDKOutput([_0x301420],_0x403bfd);}else{const _0x8f3650=await withSpinner(_0x820f74(0x12a)+_0x4739c7+'\x27...',()=>_0x2482ed[_0x820f74(0xe7)][_0x820f74(0x118)](_0x4739c7,_0x2da736),{'verbose':_0x403bfd[_0x820f74(0x131)]});await handleSDKOutput([_0x8f3650],_0x403bfd);}return 0x0;}}function a16_0x5aa4(){const _0x5638ea=['verbose','fromEntries','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','name','engage:template:delete','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','resolveWorkspaceId','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Updating\x20workspace\x20\x27','log','subject','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','segmentName','Fetching\x20workspaces...','Create\x20a\x20workspace','\x27\x20launched\x20successfully','engage:campaign:show','Updating\x20template\x20\x27','parentId','deleteCampaign','MISSING_ARGUMENT','execute','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','6360iFSNpk','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','engage:campaign:launch','Update\x20a\x20workspace','Duplicate\x20a\x20campaign','List\x20workspaces','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Verifying\x20workspace\x20\x27','engage_workspace','yes','data','plaintext','7eXRgie','resumeCampaign','getCampaignFull','editorType','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','719748ToDrDy','Resuming\x20campaign\x20\x27','jsonColumns','status','Deleting\x20campaign\x20\x27','Engage\x20workspace\x20set\x20to:\x20','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','getTemplate','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Delete\x20a\x20campaign','segment','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','engage:workspace:show','Delete\x20an\x20email\x20template','Campaign\x20\x27','launchCampaign','Show\x20email\x20template\x20details','Workspace\x20\x27','\x27\x20resumed\x20successfully','1724smjnZP','duplicateCampaign','Show\x20campaign\x20details','Create\x20a\x20new\x20campaign','Update\x20an\x20email\x20template','Options:\x20--name,\x20--description','startAt','engage','pauseCampaign','Fetching\x20template\x20\x27','keys','2053288vmFZeD','Creating\x20template\x20\x27','\x27\x20paused\x20successfully','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','updateCampaign','session','426714VfJkRv','updateWorkspace','getWorkspace','engage:workspace:delete','type','engage:templates','\x27\x20deleted\x20successfully','emailSenderId','Fetching\x20campaigns...','Workspace\x20is\x20required\x20for\x20this\x20operation','html','filter','engage:workspace:create','1374pqrvuh','2510aptzUs','full','engage:workspace:update','timezone','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','createWorkspace','Fetching\x20workspace\x20\x27','Duplicating\x20campaign\x20\x27','error','Error:\x20--name\x20is\x20required','engage:campaign:pause','description','getTemplateFull','limit','7227610gXtVeD','Error:\x20--html\x20is\x20required','createCampaign','engage:workspaces','\x27?\x20This\x20cannot\x20be\x20undone.','length','Error:\x20--subject\x20is\x20required','listWorkspaces','Creating\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','getCampaign','Operation\x20cancelled','engage:campaign:resume','Show\x20workspace\x20details','updateTemplate','Fetching\x20templates...','listTemplates','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','workspace','Launch\x20a\x20campaign','segmentId','5351715IXHOkH','engage:template:create','Create\x20an\x20email\x20template','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','List\x20campaigns','resolvePathToResource','Deleting\x20template\x20\x27','Fetching\x20campaign\x20\x27','entries','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','\x27...','engage:template:update','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'];a16_0x5aa4=function(){return _0x5638ea;};return a16_0x5aa4();}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:campaign:create';['description']=a16_0xb139fa(0xe3);async[a16_0xb139fa(0xb7)](_0x2c3113){const _0x3adf8d=a16_0xb139fa,{options:_0x529b40,tdx:_0x5ea22c}=_0x2c3113,_0x449053=_0x529b40,_0x34fd87=_0x449053['name'],_0x4cc735=_0x449053[_0x3adf8d(0xf5)];if(!_0x34fd87)return console[_0x3adf8d(0x108)](_0x3adf8d(0x109)),console['error'](_0x3adf8d(0xa6)),0x1;if(!_0x4cc735)return console[_0x3adf8d(0x108)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console['error'](_0x3adf8d(0xa6)),0x1;const _0x252a90=await resolveWorkspaceIdFromOptions(_0x449053,_0x5ea22c,!![]),_0xdaa95a=await resolveSegmentFromOptions(_0x449053,_0x5ea22c),_0x4a6cec=buildConnectorConfig(_0x449053),_0x9f9e7a={'name':_0x34fd87,'campaignType':_0x4cc735,'workspaceId':_0x252a90,'description':_0x449053['description'],..._0xdaa95a,'connectorConfig':_0x4a6cec,'startAt':_0x449053[_0x3adf8d(0xe6)],'timezone':_0x449053[_0x3adf8d(0x102)]},_0x3195da=await withSpinner(_0x3adf8d(0x116)+_0x34fd87+_0x3adf8d(0x12e),()=>_0x5ea22c[_0x3adf8d(0xe7)][_0x3adf8d(0x110)](_0x9f9e7a));return await handleSDKOutput([_0x3195da['data']],_0x529b40),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:campaign:update';['description']='Update\x20a\x20campaign';async[a16_0xb139fa(0xb7)](_0x164ac5){const _0x3a9066=a16_0xb139fa,{options:_0x5739e6,args:_0x7fc19e,tdx:_0x1096ac}=_0x164ac5;if(_0x7fc19e[_0x3a9066(0x113)]===0x0)return console[_0x3a9066(0x108)](_0x3a9066(0x104)),console[_0x3a9066(0x108)]('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x48bfae=_0x7fc19e[0x0],_0x3250e5=_0x5739e6,_0x21fc5f=await resolveWorkspaceIdFromOptions(_0x3250e5,_0x1096ac),_0x23b308=await resolveSegmentFromOptions(_0x3250e5,_0x1096ac),_0x3147dd=buildConnectorConfig(_0x3250e5),_0x5a5045={'name':_0x3250e5[_0x3a9066(0xa4)],'description':_0x3250e5[_0x3a9066(0x10b)],..._0x23b308,'connectorConfig':_0x3147dd,'startAt':_0x3250e5['startAt'],'timezone':_0x3250e5['timezone']},_0x54cc3d=Object['fromEntries'](Object[_0x3a9066(0x12b)](_0x5a5045)[_0x3a9066(0xfc)](([,_0x1a9f07])=>_0x1a9f07!==undefined));if(Object[_0x3a9066(0xea)](_0x54cc3d)[_0x3a9066(0x113)]===0x0)return console[_0x3a9066(0x108)](_0x3a9066(0xd6)),console[_0x3a9066(0x108)](_0x3a9066(0xa3)),0x1;const _0x18cbd5=await withSpinner('Updating\x20campaign\x20\x27'+_0x48bfae+'\x27...',()=>_0x1096ac[_0x3a9066(0xe7)][_0x3a9066(0xef)](_0x48bfae,_0x54cc3d,_0x21fc5f),{'verbose':_0x5739e6['verbose']});return await handleSDKOutput([_0x18cbd5[_0x3a9066(0xc4)]],_0x5739e6),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:campaign:delete';[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xd4);async['execute'](_0x4c9a72){const _0x25fd10=a16_0xb139fa,{options:_0x426437,args:_0x54701d,tdx:_0x5e0374}=_0x4c9a72;if(_0x54701d['length']===0x0)return console[_0x25fd10(0x108)](_0x25fd10(0x104)),console[_0x25fd10(0x108)](_0x25fd10(0xd8)),0x1;const _0x3ff609=_0x54701d[0x0],_0x2c9beb=_0x426437,_0x2ec261=await resolveWorkspaceIdFromOptions(_0x2c9beb,_0x5e0374);if(!_0x426437[_0x25fd10(0xc3)]){const _0x4aa1dc=await confirm(_0x25fd10(0xc0)+_0x3ff609+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x4aa1dc)return console[_0x25fd10(0xaa)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x25fd10(0xcf)+_0x3ff609+_0x25fd10(0x12e),()=>_0x5e0374[_0x25fd10(0xe7)][_0x25fd10(0xb5)](_0x3ff609,_0x2ec261),{'verbose':_0x426437[_0x25fd10(0x131)]}),console[_0x25fd10(0xaa)](_0x25fd10(0xdb)+_0x3ff609+_0x25fd10(0xf7)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xbc);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0x121);async[a16_0xb139fa(0xb7)](_0x26f39b){const _0x4d0dbd=a16_0xb139fa,{options:_0x5701cc,args:_0x21ac43,tdx:_0x2cded5}=_0x26f39b;if(_0x21ac43[_0x4d0dbd(0x113)]===0x0)return console[_0x4d0dbd(0x108)](_0x4d0dbd(0x104)),console['error'](_0x4d0dbd(0x117)),0x1;const _0x5aad25=_0x21ac43[0x0],_0x31ddd7=_0x5701cc,_0x20e7be=await resolveWorkspaceIdFromOptions(_0x31ddd7,_0x2cded5);return await withSpinner('Launching\x20campaign\x20\x27'+_0x5aad25+'\x27...',()=>_0x2cded5[_0x4d0dbd(0xe7)][_0x4d0dbd(0xdc)](_0x5aad25,_0x20e7be),{'verbose':_0x5701cc[_0x4d0dbd(0x131)]}),console['log'](_0x4d0dbd(0xdb)+_0x5aad25+_0x4d0dbd(0xb1)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0x10a);[a16_0xb139fa(0x10b)]='Pause\x20a\x20campaign';async[a16_0xb139fa(0xb7)](_0x456d63){const _0x42038d=a16_0xb139fa,{options:_0x271218,args:_0x50db4c,tdx:_0x3ad033}=_0x456d63;if(_0x50db4c[_0x42038d(0x113)]===0x0)return console[_0x42038d(0x108)](_0x42038d(0x104)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x5c44d3=_0x50db4c[0x0],_0x81ae43=_0x271218,_0x3666ca=await resolveWorkspaceIdFromOptions(_0x81ae43,_0x3ad033);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x5c44d3+_0x42038d(0x12e),()=>_0x3ad033[_0x42038d(0xe7)][_0x42038d(0xe8)](_0x5c44d3,_0x3666ca),{'verbose':_0x271218[_0x42038d(0x131)]}),console['log'](_0x42038d(0xdb)+_0x5c44d3+_0x42038d(0xed)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0x11a);['description']='Resume\x20a\x20paused\x20campaign';async[a16_0xb139fa(0xb7)](_0x4926cf){const _0xb27d49=a16_0xb139fa,{options:_0x28fde1,args:_0x24d23b,tdx:_0x5cda3e}=_0x4926cf;if(_0x24d23b['length']===0x0)return console['error'](_0xb27d49(0x104)),console[_0xb27d49(0x108)]('Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>'),0x1;const _0x42b93b=_0x24d23b[0x0],_0x55090e=_0x28fde1,_0x48ccfb=await resolveWorkspaceIdFromOptions(_0x55090e,_0x5cda3e);return await withSpinner(_0xb27d49(0xcc)+_0x42b93b+'\x27...',()=>_0x5cda3e[_0xb27d49(0xe7)][_0xb27d49(0xc7)](_0x42b93b,_0x48ccfb),{'verbose':_0x28fde1[_0xb27d49(0x131)]}),console[_0xb27d49(0xaa)]('Campaign\x20\x27'+_0x42b93b+_0xb27d49(0xdf)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:campaign:duplicate';[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xbe);async[a16_0xb139fa(0xb7)](_0x4deac0){const _0x33981f=a16_0xb139fa,{options:_0x4623dd,args:_0x3b7690,tdx:_0x4d470f}=_0x4deac0;if(_0x3b7690[_0x33981f(0x113)]===0x0)return console[_0x33981f(0x108)](_0x33981f(0x104)),console['error'](_0x33981f(0xd1)),0x1;const _0x35964e=_0x3b7690[0x0],_0x9f24ce=_0x4623dd,_0x5d3d7c=await resolveWorkspaceIdFromOptions(_0x9f24ce,_0x4d470f),_0x24b06a=await withSpinner(_0x33981f(0x107)+_0x35964e+'\x27...',()=>_0x4d470f[_0x33981f(0xe7)][_0x33981f(0xe1)](_0x35964e,_0x5d3d7c),{'verbose':_0x4623dd[_0x33981f(0x131)]});return await handleSDKOutput([_0x24b06a[_0x33981f(0xc4)]],_0x4623dd),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xf6);['description']='List\x20email\x20templates';async['execute'](_0x13e9cf){const _0x1857f9=a16_0xb139fa,{options:_0x2af36e,args:_0xa42c8f,tdx:_0x4b6f01}=_0x13e9cf,_0x1fb1f3=_0xa42c8f[0x0],_0x2bd4b8=resolveLimit(_0x2af36e[_0x1857f9(0x10d)],DEFAULT_LLM_LIMIT),_0x327b70=_0x2af36e,_0x4b42cc=await resolveWorkspaceIdFromOptions(_0x327b70,_0x4b6f01),_0x181613=await withSpinner(_0x1857f9(0x11d),()=>_0x4b6f01[_0x1857f9(0xe7)][_0x1857f9(0x11e)]({'workspaceId':_0x4b42cc,'limit':_0x2bd4b8}),{'verbose':_0x2af36e[_0x1857f9(0x131)]});let _0x557f42=_0x181613['data'];return _0x1fb1f3&&(_0x557f42=_0x181613['data']['filter'](_0x2ddd7f=>matchGlobPattern(_0x2ddd7f[_0x1857f9(0xa4)],_0x1fb1f3))),await handleSDKOutput(_0x557f42,_0x2af36e),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:template:show';[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xdd);async[a16_0xb139fa(0xb7)](_0x5b3760){const _0x5011f9=a16_0xb139fa,{options:_0x24282f,args:_0x333c4e,tdx:_0x589532}=_0x5b3760;if(_0x333c4e['length']===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x5011f9(0x108)](_0x5011f9(0xba)),0x1;const _0x49031e=_0x333c4e[0x0],_0x2ffada=_0x24282f,_0x61a99a=await resolveWorkspaceIdFromOptions(_0x2ffada,_0x589532),_0x2d0789=_0x2ffada['full'];if(_0x2d0789){const _0xada977=await withSpinner(_0x5011f9(0xe9)+_0x49031e+_0x5011f9(0x12e),()=>_0x589532['engage'][_0x5011f9(0x10c)](_0x49031e,_0x61a99a),{'verbose':_0x24282f[_0x5011f9(0x131)]});await handleSDKOutput([_0xada977],_0x24282f);}else{const _0x8c4675=await withSpinner('Fetching\x20template\x20\x27'+_0x49031e+_0x5011f9(0x12e),()=>_0x589532[_0x5011f9(0xe7)][_0x5011f9(0xd2)](_0x49031e,_0x61a99a),{'verbose':_0x24282f[_0x5011f9(0x131)]});await handleSDKOutput([_0x8c4675],_0x24282f);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']=a16_0xb139fa(0x124);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0x125);async['execute'](_0x38d5cf){const _0x3fc77a=a16_0xb139fa,{options:_0x47b3c5,tdx:_0x47d4d1}=_0x38d5cf,_0x1ffa56=_0x47b3c5,_0x42d8fe=_0x1ffa56[_0x3fc77a(0xa4)],_0x119fda=_0x1ffa56[_0x3fc77a(0xab)],_0x382314=_0x1ffa56[_0x3fc77a(0xfb)];if(!_0x42d8fe)return console[_0x3fc77a(0x108)]('Error:\x20--name\x20is\x20required'),console[_0x3fc77a(0x108)](_0x3fc77a(0xd7)),0x1;if(!_0x119fda)return console[_0x3fc77a(0x108)](_0x3fc77a(0x114)),0x1;if(!_0x382314)return console[_0x3fc77a(0x108)](_0x3fc77a(0x10f)),0x1;const _0x1a97af=await resolveWorkspaceIdFromOptions(_0x1ffa56,_0x47d4d1,!![]),_0x271a9e={'name':_0x42d8fe,'subjectTemplate':_0x119fda,'htmlTemplate':_0x382314,'workspaceId':_0x1a97af,'plaintextTemplate':_0x1ffa56[_0x3fc77a(0xc5)],'editorType':_0x1ffa56[_0x3fc77a(0xc9)]},_0x2eae26=await withSpinner(_0x3fc77a(0xec)+_0x42d8fe+_0x3fc77a(0x12e),()=>_0x47d4d1['engage']['createTemplate'](_0x271a9e));return await handleSDKOutput([_0x2eae26[_0x3fc77a(0xc4)]],_0x47b3c5),0x0;}}function a16_0x459a(_0x5edac2,_0x5503d6){_0x5edac2=_0x5edac2-0xa3;const _0x5aa41f=a16_0x5aa4();let _0x459a59=_0x5aa41f[_0x5edac2];return _0x459a59;}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0xb139fa(0x12f);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xe4);async[a16_0xb139fa(0xb7)](_0x37789c){const _0x1eabef=a16_0xb139fa,{options:_0x26bf4a,args:_0xcc5a0e,tdx:_0xf169fd}=_0x37789c;if(_0xcc5a0e['length']===0x0)return console['error'](_0x1eabef(0x126)),console[_0x1eabef(0x108)](_0x1eabef(0xa8)),0x1;const _0x5a26e2=_0xcc5a0e[0x0],_0x3d622b=_0x26bf4a,_0x2662a8=await resolveWorkspaceIdFromOptions(_0x3d622b,_0xf169fd),_0x36bdaa={'name':_0x3d622b[_0x1eabef(0xa4)],'subjectTemplate':_0x3d622b[_0x1eabef(0xab)],'htmlTemplate':_0x3d622b[_0x1eabef(0xfb)],'plaintextTemplate':_0x3d622b[_0x1eabef(0xc5)]},_0x33a86a=Object[_0x1eabef(0x132)](Object[_0x1eabef(0x12b)](_0x36bdaa)['filter'](([,_0x590f71])=>_0x590f71!==undefined));if(Object['keys'](_0x33a86a)['length']===0x0)return console[_0x1eabef(0x108)](_0x1eabef(0xd6)),console[_0x1eabef(0x108)](_0x1eabef(0xad)),0x1;const _0x33e516=await withSpinner(_0x1eabef(0xb3)+_0x5a26e2+'\x27...',()=>_0xf169fd[_0x1eabef(0xe7)][_0x1eabef(0x11c)](_0x5a26e2,_0x33a86a,_0x2662a8),{'verbose':_0x26bf4a[_0x1eabef(0x131)]});return await handleSDKOutput([_0x33e516[_0x1eabef(0xc4)]],_0x26bf4a),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xa5);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xda);async['execute'](_0x2f38a2){const _0x1a8e46=a16_0xb139fa,{options:_0x485a1d,args:_0x1c632d,tdx:_0x10262a}=_0x2f38a2;if(_0x1c632d['length']===0x0)return console[_0x1a8e46(0x108)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x1a8e46(0x108)](_0x1a8e46(0xac)),0x1;const _0x4de8f1=_0x1c632d[0x0],_0x1c3d73=_0x485a1d,_0x4c608b=await resolveWorkspaceIdFromOptions(_0x1c3d73,_0x10262a);if(!_0x485a1d[_0x1a8e46(0xc3)]){const _0xcf2e8b=await confirm(_0x1a8e46(0x130)+_0x4de8f1+_0x1a8e46(0x112));if(!_0xcf2e8b)return console[_0x1a8e46(0xaa)](_0x1a8e46(0x119)),0x0;}return await withSpinner(_0x1a8e46(0x129)+_0x4de8f1+_0x1a8e46(0x12e),()=>_0x10262a['engage']['deleteTemplate'](_0x4de8f1,_0x4c608b),{'verbose':_0x485a1d[_0x1a8e46(0x131)]}),console['log']('Template\x20\x27'+_0x4de8f1+_0x1a8e46(0xf7)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0x111);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xbf);async[a16_0xb139fa(0xb7)](_0x55f214){const _0x1f6075=a16_0xb139fa,{options:_0x52abf2,args:_0x110245,tdx:_0x4e1470}=_0x55f214,_0x4f4f11=_0x110245[0x0],_0x142b0c=resolveLimit(_0x52abf2[_0x1f6075(0x10d)],DEFAULT_LLM_LIMIT),_0x21bc1e=await withSpinner(_0x1f6075(0xaf),()=>_0x4e1470[_0x1f6075(0xe7)][_0x1f6075(0x115)]({'limit':_0x142b0c}),{'verbose':_0x52abf2[_0x1f6075(0x131)]});let _0x238771=_0x21bc1e[_0x1f6075(0xc4)];return _0x4f4f11&&(_0x238771=_0x21bc1e[_0x1f6075(0xc4)][_0x1f6075(0xfc)](_0x4507e6=>matchGlobPattern(_0x4507e6[_0x1f6075(0xa4)],_0x4f4f11))),await handleSDKOutput(_0x238771,_0x52abf2),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xd9);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0x11b);async[a16_0xb139fa(0xb7)](_0x423a60){const _0x228622=a16_0xb139fa,{options:_0x41a6c3,args:_0x50063d,tdx:_0x36e6f8}=_0x423a60;if(_0x50063d[_0x228622(0x113)]===0x0)return console['error'](_0x228622(0xbb)),console[_0x228622(0x108)](_0x228622(0x103)),0x1;const _0x2d8c93=_0x50063d[0x0],_0x48a702=_0x41a6c3,_0x5b5d1a=_0x48a702[_0x228622(0x100)];if(_0x5b5d1a){const _0x4f2633=await withSpinner('Fetching\x20workspace\x20\x27'+_0x2d8c93+_0x228622(0x12e),()=>_0x36e6f8[_0x228622(0xe7)]['getWorkspaceFull'](_0x2d8c93),{'verbose':_0x41a6c3['verbose']});await handleSDKOutput([_0x4f2633],_0x41a6c3);}else{const _0x46d889=await withSpinner(_0x228622(0x106)+_0x2d8c93+_0x228622(0x12e),()=>_0x36e6f8[_0x228622(0xe7)][_0x228622(0xf3)](_0x2d8c93),{'verbose':_0x41a6c3['verbose']});await handleSDKOutput([_0x46d889],_0x41a6c3);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xfd);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xb0);async[a16_0xb139fa(0xb7)](_0x53fd28){const _0x2f613f=a16_0xb139fa,{options:_0x2838ea,tdx:_0x241c53}=_0x53fd28,_0x58892c=_0x2838ea,_0x212f7=_0x58892c['name'];if(!_0x212f7)return console['error'](_0x2f613f(0x109)),console['error'](_0x2f613f(0xb8)),0x1;const _0xd6ebd={'name':_0x212f7,'description':_0x58892c[_0x2f613f(0x10b)]},_0x4c2050=await withSpinner('Creating\x20workspace\x20\x27'+_0x212f7+_0x2f613f(0x12e),()=>_0x241c53[_0x2f613f(0xe7)][_0x2f613f(0x105)](_0xd6ebd));return await handleSDKOutput([_0x4c2050['data']],_0x2838ea),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0x101);[a16_0xb139fa(0x10b)]=a16_0xb139fa(0xbd);async[a16_0xb139fa(0xb7)](_0x3ee26b){const _0x350764=a16_0xb139fa,{options:_0x5095a2,args:_0x50d326,tdx:_0x463e0a}=_0x3ee26b;if(_0x50d326[_0x350764(0x113)]===0x0)return console['error'](_0x350764(0xbb)),console[_0x350764(0x108)](_0x350764(0xee)),0x1;const _0x4c4410=_0x50d326[0x0],_0xa5e76f=_0x5095a2,_0x201c27={'name':_0xa5e76f[_0x350764(0xa4)],'description':_0xa5e76f[_0x350764(0x10b)]},_0x3ae428=Object['fromEntries'](Object['entries'](_0x201c27)[_0x350764(0xfc)](([,_0x591a8a])=>_0x591a8a!==undefined));if(Object['keys'](_0x3ae428)['length']===0x0)return console['error'](_0x350764(0xd6)),console[_0x350764(0x108)](_0x350764(0xe5)),0x1;const _0x55fbf5=await withSpinner(_0x350764(0xa9)+_0x4c4410+_0x350764(0x12e),()=>_0x463e0a[_0x350764(0xe7)][_0x350764(0xf2)](_0x4c4410,_0x3ae428),{'verbose':_0x5095a2[_0x350764(0x131)]});return await handleSDKOutput([_0x55fbf5['data']],_0x5095a2),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0xb139fa(0xa4)]=a16_0xb139fa(0xf4);[a16_0xb139fa(0x10b)]='Delete\x20a\x20workspace';async[a16_0xb139fa(0xb7)](_0x49150e){const _0x11bb8f=a16_0xb139fa,{options:_0x129f5b,args:_0x444a5d,tdx:_0x207c9b}=_0x49150e;if(_0x444a5d[_0x11bb8f(0x113)]===0x0)return console[_0x11bb8f(0x108)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x11bb8f(0x108)](_0x11bb8f(0x11f)),0x1;const _0x1acfca=_0x444a5d[0x0];if(!_0x129f5b[_0x11bb8f(0xc3)]){const _0x3c4407=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x1acfca+_0x11bb8f(0x112));if(!_0x3c4407)return console[_0x11bb8f(0xaa)](_0x11bb8f(0x119)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x1acfca+_0x11bb8f(0x12e),()=>_0x207c9b[_0x11bb8f(0xe7)]['deleteWorkspace'](_0x1acfca),{'verbose':_0x129f5b['verbose']}),console[_0x11bb8f(0xaa)](_0x11bb8f(0xde)+_0x1acfca+_0x11bb8f(0xf7)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0xb139fa(0xa4)]='engage:workspace:use';['description']='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0xb139fa(0xb7)](_0x4a5373){const _0x165175=a16_0xb139fa,{options:_0x498404,args:_0x58d1c5,tdx:_0x5a3e30}=_0x4a5373;if(_0x58d1c5[_0x165175(0x113)]===0x0)return console[_0x165175(0x108)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x165175(0x108)](_0x165175(0xd3)),0x1;const _0x11c7e4=_0x58d1c5[0x0];await withSpinner(_0x165175(0xc1)+_0x11c7e4+_0x165175(0x12e),()=>_0x5a3e30[_0x165175(0xe7)][_0x165175(0xa7)](_0x11c7e4));const _0x44a3cd=_0x498404[_0x165175(0xf0)]||undefined;return saveSessionContext({'engage_workspace':_0x11c7e4},_0x44a3cd),console[_0x165175(0xaa)](_0x165175(0xd0)+_0x11c7e4),console[_0x165175(0xaa)](_0x165175(0xca)),0x0;}}
|
|
1
|
+
const a16_0x4706a6=a16_0xb3ef;(function(_0x2dca69,_0xb6c70f){const _0x22151b=a16_0xb3ef,_0x23a884=_0x2dca69();while(!![]){try{const _0xa0ca62=parseInt(_0x22151b(0x242))/0x1*(-parseInt(_0x22151b(0x23b))/0x2)+-parseInt(_0x22151b(0x1f6))/0x3*(parseInt(_0x22151b(0x204))/0x4)+-parseInt(_0x22151b(0x231))/0x5+-parseInt(_0x22151b(0x1ec))/0x6*(-parseInt(_0x22151b(0x1dd))/0x7)+parseInt(_0x22151b(0x205))/0x8+parseInt(_0x22151b(0x1da))/0x9+-parseInt(_0x22151b(0x251))/0xa*(-parseInt(_0x22151b(0x1df))/0xb);if(_0xa0ca62===_0xb6c70f)break;else _0x23a884['push'](_0x23a884['shift']());}catch(_0x560422){_0x23a884['push'](_0x23a884['shift']());}}}(a16_0x15e1,0x6affb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0xd6cde1,_0x48db65,_0x35175d=![]){const _0x2274c6=a16_0xb3ef;if(_0xd6cde1['workspace'])return await _0x48db65[_0x2274c6(0x250)][_0x2274c6(0x1e5)](_0xd6cde1[_0x2274c6(0x23d)]);const _0x5cdb20=loadSessionContext(_0xd6cde1[_0x2274c6(0x212)]);if(_0x5cdb20?.[_0x2274c6(0x217)])return await _0x48db65['engage']['resolveWorkspaceId'](_0x5cdb20['engage_workspace']);if(_0x35175d)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x2274c6(0x245),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x4723bc,_0x5dd73a){const _0x2816e1=a16_0xb3ef;if(!_0x4723bc[_0x2816e1(0x24b)])return{};const _0x209e48=_0x4723bc[_0x2816e1(0x24b)],_0x40311c=await _0x5dd73a['segment'][_0x2816e1(0x233)](_0x209e48);return{'audienceId':_0x40311c[_0x2816e1(0x1ed)],'audienceName':_0x40311c[_0x2816e1(0x1e8)],..._0x40311c['segmentId']&&{'segmentId':_0x40311c[_0x2816e1(0x1ee)],'segmentName':_0x40311c[_0x2816e1(0x201)]}};}function buildConnectorConfig(_0x1a64d8){const _0x63301a=a16_0xb3ef,_0x43bade=_0x1a64d8[_0x63301a(0x20d)],_0x1bd8ae=_0x1a64d8[_0x63301a(0x1d6)];if(!_0x43bade&&!_0x1bd8ae)return undefined;return{..._0x43bade&&{'emailSenderId':_0x43bade},..._0x1bd8ae&&{'jsonColumns':_0x1bd8ae}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1f4);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x1d9);async[a16_0x4706a6(0x21a)](_0x299e32){const _0x1d7d8d=a16_0x4706a6,{options:_0x16ece4,args:_0x46aaa8,tdx:_0x4ed131}=_0x299e32,_0x15a67f=_0x46aaa8[0x0],_0x161bd2=resolveLimit(_0x16ece4[_0x1d7d8d(0x246)],DEFAULT_LLM_LIMIT),_0x36fb11=_0x16ece4,_0x2ca989=_0x36fb11['type'],_0x40e280=_0x36fb11[_0x1d7d8d(0x1e6)],_0x34f420=await resolveWorkspaceIdFromOptions(_0x36fb11,_0x4ed131),_0x2890bf=await withSpinner(_0x1d7d8d(0x22f),()=>_0x4ed131['engage'][_0x1d7d8d(0x1fd)]({'type':_0x2ca989,'status':_0x40e280,'workspaceId':_0x34f420,'limit':_0x161bd2}),{'verbose':_0x16ece4[_0x1d7d8d(0x238)]});let _0x148346=_0x2890bf[_0x1d7d8d(0x256)];return _0x15a67f&&(_0x148346=_0x2890bf[_0x1d7d8d(0x256)]['filter'](_0x540de4=>matchGlobPattern(_0x540de4[_0x1d7d8d(0x240)],_0x15a67f))),await handleSDKOutput(_0x148346,_0x16ece4),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']=a16_0x4706a6(0x1e1);[a16_0x4706a6(0x1d8)]='Show\x20campaign\x20details';async['execute'](_0x13544d){const _0x2a438f=a16_0x4706a6,{options:_0x296ec3,args:_0x1d46c3,tdx:_0x1fb864}=_0x13544d;if(_0x1d46c3[_0x2a438f(0x220)]===0x0)return console[_0x2a438f(0x232)](_0x2a438f(0x234)),console[_0x2a438f(0x232)](_0x2a438f(0x1e4)),0x1;const _0x3c8788=_0x1d46c3[0x0],_0x1f2aae=_0x296ec3,_0x511384=await resolveWorkspaceIdFromOptions(_0x1f2aae,_0x1fb864),_0x5d97a0=_0x1f2aae['full'];if(_0x5d97a0){const _0x592b4f=await withSpinner(_0x2a438f(0x202)+_0x3c8788+_0x2a438f(0x211),()=>_0x1fb864['engage'][_0x2a438f(0x208)](_0x3c8788,_0x511384),{'verbose':_0x296ec3[_0x2a438f(0x238)]});await handleSDKOutput([_0x592b4f],_0x296ec3);}else{const _0x46c1bc=await withSpinner(_0x2a438f(0x202)+_0x3c8788+_0x2a438f(0x211),()=>_0x1fb864['engage']['getCampaign'](_0x3c8788,_0x511384),{'verbose':_0x296ec3[_0x2a438f(0x238)]});await handleSDKOutput([_0x46c1bc],_0x296ec3);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x4706a6(0x206);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x21b);async[a16_0x4706a6(0x21a)](_0x52daf2){const _0x1e3fbf=a16_0x4706a6,{options:_0x571f9d,tdx:_0x21c5f5}=_0x52daf2,_0x3c3ace=_0x571f9d,_0x58c4cf=_0x3c3ace['name'],_0x1d3585=_0x3c3ace[_0x1e3fbf(0x243)];if(!_0x58c4cf)return console[_0x1e3fbf(0x232)](_0x1e3fbf(0x249)),console['error'](_0x1e3fbf(0x24a)),0x1;if(!_0x1d3585)return console[_0x1e3fbf(0x232)](_0x1e3fbf(0x1f1)),console[_0x1e3fbf(0x232)](_0x1e3fbf(0x24a)),0x1;const _0x48f058=await resolveWorkspaceIdFromOptions(_0x3c3ace,_0x21c5f5,!![]),_0x4e2326=await resolveSegmentFromOptions(_0x3c3ace,_0x21c5f5),_0x3de0ea=buildConnectorConfig(_0x3c3ace),_0x179788={'name':_0x58c4cf,'campaignType':_0x1d3585,'workspaceId':_0x48f058,'description':_0x3c3ace[_0x1e3fbf(0x1d8)],..._0x4e2326,'connectorConfig':_0x3de0ea,'startAt':_0x3c3ace['startAt'],'timezone':_0x3c3ace[_0x1e3fbf(0x253)]},_0x406ba0=await withSpinner(_0x1e3fbf(0x1d7)+_0x58c4cf+_0x1e3fbf(0x211),()=>_0x21c5f5[_0x1e3fbf(0x250)]['createCampaign'](_0x179788));return await handleSDKOutput([_0x406ba0[_0x1e3fbf(0x256)]],_0x571f9d),0x0;}}function a16_0xb3ef(_0xf43dd6,_0xfab46f){_0xf43dd6=_0xf43dd6-0x1d1;const _0x15e103=a16_0x15e1();let _0xb3ef5b=_0x15e103[_0xf43dd6];return _0xb3ef5b;}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1f5);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x1fe);async[a16_0x4706a6(0x21a)](_0x40761a){const _0x3e6619=a16_0x4706a6,{options:_0x3a79db,args:_0x12158f,tdx:_0x361841}=_0x40761a;if(_0x12158f['length']===0x0)return console[_0x3e6619(0x232)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x3e6619(0x232)]('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x194e78=_0x12158f[0x0],_0x47477e=_0x3a79db,_0x28ebaf=await resolveWorkspaceIdFromOptions(_0x47477e,_0x361841),_0x3c7356=await resolveSegmentFromOptions(_0x47477e,_0x361841),_0x51b767=buildConnectorConfig(_0x47477e),_0x22f7d7={'name':_0x47477e[_0x3e6619(0x240)],'description':_0x47477e[_0x3e6619(0x1d8)],..._0x3c7356,'connectorConfig':_0x51b767,'startAt':_0x47477e[_0x3e6619(0x1e0)],'timezone':_0x47477e[_0x3e6619(0x253)]},_0x543bbd=Object[_0x3e6619(0x24e)](Object[_0x3e6619(0x224)](_0x22f7d7)['filter'](([,_0x5eafc4])=>_0x5eafc4!==undefined));if(Object['keys'](_0x543bbd)[_0x3e6619(0x220)]===0x0)return console[_0x3e6619(0x232)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3e6619(0x232)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x1c90be=await withSpinner(_0x3e6619(0x24d)+_0x194e78+_0x3e6619(0x211),()=>_0x361841['engage'][_0x3e6619(0x1d3)](_0x194e78,_0x543bbd,_0x28ebaf),{'verbose':_0x3a79db[_0x3e6619(0x238)]});return await handleSDKOutput([_0x1c90be[_0x3e6619(0x256)]],_0x3a79db),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x4706a6(0x240)]='engage:campaign:delete';[a16_0x4706a6(0x1d8)]='Delete\x20a\x20campaign';async[a16_0x4706a6(0x21a)](_0x145f79){const _0x500f15=a16_0x4706a6,{options:_0x2ee747,args:_0x170bc4,tdx:_0x1a42f4}=_0x145f79;if(_0x170bc4[_0x500f15(0x220)]===0x0)return console[_0x500f15(0x232)](_0x500f15(0x234)),console[_0x500f15(0x232)](_0x500f15(0x1ff)),0x1;const _0x36eb20=_0x170bc4[0x0],_0x47183b=_0x2ee747,_0x3b113f=await resolveWorkspaceIdFromOptions(_0x47183b,_0x1a42f4);if(!_0x2ee747[_0x500f15(0x23e)]){const _0x4ebae5=await confirm(_0x500f15(0x248)+_0x36eb20+_0x500f15(0x1fb));if(!_0x4ebae5)return console[_0x500f15(0x1fa)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x500f15(0x221)+_0x36eb20+_0x500f15(0x211),()=>_0x1a42f4['engage']['deleteCampaign'](_0x36eb20,_0x3b113f),{'verbose':_0x2ee747['verbose']}),console['log'](_0x500f15(0x239)+_0x36eb20+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x4706a6(0x240)]='engage:campaign:launch';[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x20f);async[a16_0x4706a6(0x21a)](_0x5c178e){const _0x325bea=a16_0x4706a6,{options:_0x10ab44,args:_0x25fba6,tdx:_0x1d8845}=_0x5c178e;if(_0x25fba6[_0x325bea(0x220)]===0x0)return console[_0x325bea(0x232)](_0x325bea(0x234)),console['error'](_0x325bea(0x22d)),0x1;const _0x228a1e=_0x25fba6[0x0],_0x1a0871=_0x10ab44,_0x1a5a16=await resolveWorkspaceIdFromOptions(_0x1a0871,_0x1d8845);return await withSpinner(_0x325bea(0x210)+_0x228a1e+'\x27...',()=>_0x1d8845[_0x325bea(0x250)]['launchCampaign'](_0x228a1e,_0x1a5a16),{'verbose':_0x10ab44[_0x325bea(0x238)]}),console[_0x325bea(0x1fa)](_0x325bea(0x239)+_0x228a1e+_0x325bea(0x207)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x230);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x223);async[a16_0x4706a6(0x21a)](_0x599bec){const _0x521d87=a16_0x4706a6,{options:_0x2abce7,args:_0x383c97,tdx:_0x11e70a}=_0x599bec;if(_0x383c97[_0x521d87(0x220)]===0x0)return console[_0x521d87(0x232)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x521d87(0x232)](_0x521d87(0x252)),0x1;const _0xe4bd6e=_0x383c97[0x0],_0x579a65=_0x2abce7,_0x972262=await resolveWorkspaceIdFromOptions(_0x579a65,_0x11e70a);return await withSpinner('Pausing\x20campaign\x20\x27'+_0xe4bd6e+_0x521d87(0x211),()=>_0x11e70a[_0x521d87(0x250)]['pauseCampaign'](_0xe4bd6e,_0x972262),{'verbose':_0x2abce7[_0x521d87(0x238)]}),console[_0x521d87(0x1fa)](_0x521d87(0x239)+_0xe4bd6e+_0x521d87(0x22a)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x200);[a16_0x4706a6(0x1d8)]='Resume\x20a\x20paused\x20campaign';async[a16_0x4706a6(0x21a)](_0x5c3c43){const _0xc1d0f5=a16_0x4706a6,{options:_0x20c273,args:_0x420019,tdx:_0x49ede3}=_0x5c3c43;if(_0x420019[_0xc1d0f5(0x220)]===0x0)return console[_0xc1d0f5(0x232)](_0xc1d0f5(0x234)),console[_0xc1d0f5(0x232)](_0xc1d0f5(0x21e)),0x1;const _0x491695=_0x420019[0x0],_0x1ab268=_0x20c273,_0x48be6d=await resolveWorkspaceIdFromOptions(_0x1ab268,_0x49ede3);return await withSpinner(_0xc1d0f5(0x225)+_0x491695+_0xc1d0f5(0x211),()=>_0x49ede3[_0xc1d0f5(0x250)][_0xc1d0f5(0x235)](_0x491695,_0x48be6d),{'verbose':_0x20c273[_0xc1d0f5(0x238)]}),console[_0xc1d0f5(0x1fa)](_0xc1d0f5(0x239)+_0x491695+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1e9);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x1f3);async[a16_0x4706a6(0x21a)](_0x108c94){const _0x15e02d=a16_0x4706a6,{options:_0x43e072,args:_0x2f8487,tdx:_0xfefbff}=_0x108c94;if(_0x2f8487['length']===0x0)return console[_0x15e02d(0x232)](_0x15e02d(0x234)),console[_0x15e02d(0x232)](_0x15e02d(0x1ef)),0x1;const _0x4a95b4=_0x2f8487[0x0],_0x4a2b47=_0x43e072,_0xddfc3a=await resolveWorkspaceIdFromOptions(_0x4a2b47,_0xfefbff),_0x3f1815=await withSpinner(_0x15e02d(0x236)+_0x4a95b4+_0x15e02d(0x211),()=>_0xfefbff[_0x15e02d(0x250)][_0x15e02d(0x23c)](_0x4a95b4,_0xddfc3a),{'verbose':_0x43e072['verbose']});return await handleSDKOutput([_0x3f1815[_0x15e02d(0x256)]],_0x43e072),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0x4706a6(0x240)]='engage:templates';[a16_0x4706a6(0x1d8)]='List\x20email\x20templates';async[a16_0x4706a6(0x21a)](_0x521136){const _0x18d489=a16_0x4706a6,{options:_0x13bc48,args:_0x4b728f,tdx:_0x11a0e3}=_0x521136,_0x43e030=_0x4b728f[0x0],_0x1cc416=resolveLimit(_0x13bc48[_0x18d489(0x246)],DEFAULT_LLM_LIMIT),_0x3815a8=_0x13bc48,_0x309920=await resolveWorkspaceIdFromOptions(_0x3815a8,_0x11a0e3),_0x38496f=await withSpinner('Fetching\x20templates...',()=>_0x11a0e3[_0x18d489(0x250)][_0x18d489(0x203)]({'workspaceId':_0x309920,'limit':_0x1cc416}),{'verbose':_0x13bc48[_0x18d489(0x238)]});let _0xe67a8f=_0x38496f[_0x18d489(0x256)];return _0x43e030&&(_0xe67a8f=_0x38496f[_0x18d489(0x256)][_0x18d489(0x1d4)](_0x2bed7c=>matchGlobPattern(_0x2bed7c['name'],_0x43e030))),await handleSDKOutput(_0xe67a8f,_0x13bc48),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x254);['description']=a16_0x4706a6(0x237);async[a16_0x4706a6(0x21a)](_0x3bb84d){const _0x11939e=a16_0x4706a6,{options:_0x43e14d,args:_0x524bf6,tdx:_0x53460b}=_0x3bb84d;if(_0x524bf6['length']===0x0)return console[_0x11939e(0x232)](_0x11939e(0x22e)),console['error'](_0x11939e(0x22c)),0x1;const _0x3e426f=_0x524bf6[0x0],_0x11d6e1=_0x43e14d,_0x5bd18f=await resolveWorkspaceIdFromOptions(_0x11d6e1,_0x53460b),_0x511d1a=_0x11d6e1['full'];if(_0x511d1a){const _0x10294f=await withSpinner('Fetching\x20template\x20\x27'+_0x3e426f+_0x11939e(0x211),()=>_0x53460b['engage'][_0x11939e(0x20b)](_0x3e426f,_0x5bd18f),{'verbose':_0x43e14d[_0x11939e(0x238)]});await handleSDKOutput([_0x10294f],_0x43e14d);}else{const _0xb5dbd4=await withSpinner(_0x11939e(0x219)+_0x3e426f+_0x11939e(0x211),()=>_0x53460b[_0x11939e(0x250)][_0x11939e(0x24c)](_0x3e426f,_0x5bd18f),{'verbose':_0x43e14d[_0x11939e(0x238)]});await handleSDKOutput([_0xb5dbd4],_0x43e14d);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x4706a6(0x240)]='engage:template:create';[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x241);async[a16_0x4706a6(0x21a)](_0x33ff08){const _0x1d5440=a16_0x4706a6,{options:_0x14e221,tdx:_0x26d1ae}=_0x33ff08,_0x30b54e=_0x14e221,_0x2590f6=_0x30b54e[_0x1d5440(0x240)],_0x116df0=_0x30b54e[_0x1d5440(0x229)],_0x4a6dd7=_0x30b54e[_0x1d5440(0x228)];if(!_0x2590f6)return console[_0x1d5440(0x232)](_0x1d5440(0x249)),console[_0x1d5440(0x232)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x116df0)return console['error']('Error:\x20--subject\x20is\x20required'),0x1;if(!_0x4a6dd7)return console['error'](_0x1d5440(0x255)),0x1;const _0x45b651=await resolveWorkspaceIdFromOptions(_0x30b54e,_0x26d1ae,!![]),_0x29f1e5={'name':_0x2590f6,'subjectTemplate':_0x116df0,'htmlTemplate':_0x4a6dd7,'workspaceId':_0x45b651,'plaintextTemplate':_0x30b54e[_0x1d5440(0x21f)],'editorType':_0x30b54e[_0x1d5440(0x1f7)]},_0x30bced=await withSpinner(_0x1d5440(0x22b)+_0x2590f6+_0x1d5440(0x211),()=>_0x26d1ae[_0x1d5440(0x250)][_0x1d5440(0x1f0)](_0x29f1e5));return await handleSDKOutput([_0x30bced['data']],_0x14e221),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1e2);[a16_0x4706a6(0x1d8)]='Update\x20an\x20email\x20template';async[a16_0x4706a6(0x21a)](_0x44c553){const _0x5d50fc=a16_0x4706a6,{options:_0x28e34a,args:_0x1c429f,tdx:_0x43d96c}=_0x44c553;if(_0x1c429f[_0x5d50fc(0x220)]===0x0)return console[_0x5d50fc(0x232)](_0x5d50fc(0x22e)),console[_0x5d50fc(0x232)]('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x3feaea=_0x1c429f[0x0],_0x50e78f=_0x28e34a,_0x55d5a4=await resolveWorkspaceIdFromOptions(_0x50e78f,_0x43d96c),_0xa3c2ea={'name':_0x50e78f[_0x5d50fc(0x240)],'subjectTemplate':_0x50e78f[_0x5d50fc(0x229)],'htmlTemplate':_0x50e78f[_0x5d50fc(0x228)],'plaintextTemplate':_0x50e78f[_0x5d50fc(0x21f)]},_0x39f8aa=Object[_0x5d50fc(0x24e)](Object['entries'](_0xa3c2ea)[_0x5d50fc(0x1d4)](([,_0x5326b1])=>_0x5326b1!==undefined));if(Object[_0x5d50fc(0x222)](_0x39f8aa)[_0x5d50fc(0x220)]===0x0)return console[_0x5d50fc(0x232)](_0x5d50fc(0x1db)),console[_0x5d50fc(0x232)](_0x5d50fc(0x218)),0x1;const _0x16f75a=await withSpinner(_0x5d50fc(0x20c)+_0x3feaea+_0x5d50fc(0x211),()=>_0x43d96c[_0x5d50fc(0x250)]['updateTemplate'](_0x3feaea,_0x39f8aa,_0x55d5a4),{'verbose':_0x28e34a['verbose']});return await handleSDKOutput([_0x16f75a[_0x5d50fc(0x256)]],_0x28e34a),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x4706a6(0x240)]='engage:template:delete';[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x1d1);async['execute'](_0x94f309){const _0x1bff85=a16_0x4706a6,{options:_0x35dcd6,args:_0x24becb,tdx:_0x3ebc71}=_0x94f309;if(_0x24becb['length']===0x0)return console[_0x1bff85(0x232)](_0x1bff85(0x22e)),console[_0x1bff85(0x232)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0xc76cdc=_0x24becb[0x0],_0xc12fac=_0x35dcd6,_0x447ca3=await resolveWorkspaceIdFromOptions(_0xc12fac,_0x3ebc71);if(!_0x35dcd6[_0x1bff85(0x23e)]){const _0x17b463=await confirm(_0x1bff85(0x247)+_0xc76cdc+_0x1bff85(0x1fb));if(!_0x17b463)return console['log'](_0x1bff85(0x227)),0x0;}return await withSpinner(_0x1bff85(0x1eb)+_0xc76cdc+_0x1bff85(0x211),()=>_0x3ebc71['engage'][_0x1bff85(0x1ea)](_0xc76cdc,_0x447ca3),{'verbose':_0x35dcd6[_0x1bff85(0x238)]}),console[_0x1bff85(0x1fa)](_0x1bff85(0x24f)+_0xc76cdc+_0x1bff85(0x21c)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1f8);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x209);async[a16_0x4706a6(0x21a)](_0x4e2606){const _0x1e5dd0=a16_0x4706a6,{options:_0x517b5c,args:_0x4139c9,tdx:_0x144c31}=_0x4e2606,_0x26aa96=_0x4139c9[0x0],_0x290a6c=resolveLimit(_0x517b5c[_0x1e5dd0(0x246)],DEFAULT_LLM_LIMIT),_0x1aec53=await withSpinner(_0x1e5dd0(0x1de),()=>_0x144c31[_0x1e5dd0(0x250)]['listWorkspaces']({'limit':_0x290a6c}),{'verbose':_0x517b5c[_0x1e5dd0(0x238)]});let _0x47b164=_0x1aec53[_0x1e5dd0(0x256)];return _0x26aa96&&(_0x47b164=_0x1aec53[_0x1e5dd0(0x256)][_0x1e5dd0(0x1d4)](_0x5a8f4a=>matchGlobPattern(_0x5a8f4a[_0x1e5dd0(0x240)],_0x26aa96))),await handleSDKOutput(_0x47b164,_0x517b5c),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x244);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x226);async[a16_0x4706a6(0x21a)](_0x56ddee){const _0x46915f=a16_0x4706a6,{options:_0x13a2a7,args:_0x22a671,tdx:_0x44b821}=_0x56ddee;if(_0x22a671[_0x46915f(0x220)]===0x0)return console[_0x46915f(0x232)](_0x46915f(0x215)),console[_0x46915f(0x232)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x12b2cc=_0x22a671[0x0],_0x3ea1e2=_0x13a2a7,_0x1ca291=_0x3ea1e2['full'];if(_0x1ca291){const _0x2efa71=await withSpinner(_0x46915f(0x1e3)+_0x12b2cc+_0x46915f(0x211),()=>_0x44b821[_0x46915f(0x250)][_0x46915f(0x1d2)](_0x12b2cc),{'verbose':_0x13a2a7[_0x46915f(0x238)]});await handleSDKOutput([_0x2efa71],_0x13a2a7);}else{const _0x3ea259=await withSpinner(_0x46915f(0x1e3)+_0x12b2cc+_0x46915f(0x211),()=>_0x44b821[_0x46915f(0x250)][_0x46915f(0x20a)](_0x12b2cc),{'verbose':_0x13a2a7[_0x46915f(0x238)]});await handleSDKOutput([_0x3ea259],_0x13a2a7);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x1fc);[a16_0x4706a6(0x1d8)]='Create\x20a\x20workspace';async['execute'](_0x5da3bc){const _0x15620c=a16_0x4706a6,{options:_0x4764ab,tdx:_0x148ca7}=_0x5da3bc,_0x274241=_0x4764ab,_0x1beb7b=_0x274241['name'];if(!_0x1beb7b)return console[_0x15620c(0x232)](_0x15620c(0x249)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x4da006={'name':_0x1beb7b,'description':_0x274241[_0x15620c(0x1d8)]},_0x4fbc2e=await withSpinner('Creating\x20workspace\x20\x27'+_0x1beb7b+_0x15620c(0x211),()=>_0x148ca7[_0x15620c(0x250)]['createWorkspace'](_0x4da006));return await handleSDKOutput([_0x4fbc2e['data']],_0x4764ab),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a16_0x4706a6(0x1f9);[a16_0x4706a6(0x1d8)]='Update\x20a\x20workspace';async[a16_0x4706a6(0x21a)](_0x2f42f4){const _0x48096d=a16_0x4706a6,{options:_0x3f2661,args:_0x38e3bd,tdx:_0xe19459}=_0x2f42f4;if(_0x38e3bd[_0x48096d(0x220)]===0x0)return console[_0x48096d(0x232)](_0x48096d(0x215)),console[_0x48096d(0x232)]('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x4aec96=_0x38e3bd[0x0],_0x228cce=_0x3f2661,_0x18aee2={'name':_0x228cce['name'],'description':_0x228cce[_0x48096d(0x1d8)]},_0x505345=Object[_0x48096d(0x24e)](Object[_0x48096d(0x224)](_0x18aee2)['filter'](([,_0x3ab9c8])=>_0x3ab9c8!==undefined));if(Object['keys'](_0x505345)['length']===0x0)return console[_0x48096d(0x232)](_0x48096d(0x1db)),console['error'](_0x48096d(0x1e7)),0x1;const _0x9ea59=await withSpinner(_0x48096d(0x1dc)+_0x4aec96+'\x27...',()=>_0xe19459[_0x48096d(0x250)][_0x48096d(0x1f2)](_0x4aec96,_0x505345),{'verbose':_0x3f2661['verbose']});return await handleSDKOutput([_0x9ea59['data']],_0x3f2661),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x21d);[a16_0x4706a6(0x1d8)]=a16_0x4706a6(0x213);async[a16_0x4706a6(0x21a)](_0x5adb3b){const _0x5b1863=a16_0x4706a6,{options:_0x26f732,args:_0x27b514,tdx:_0x452170}=_0x5adb3b;if(_0x27b514[_0x5b1863(0x220)]===0x0)return console[_0x5b1863(0x232)](_0x5b1863(0x215)),console[_0x5b1863(0x232)]('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x1de086=_0x27b514[0x0];if(!_0x26f732['yes']){const _0x11640c=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x1de086+_0x5b1863(0x1fb));if(!_0x11640c)return console[_0x5b1863(0x1fa)](_0x5b1863(0x227)),0x0;}return await withSpinner(_0x5b1863(0x214)+_0x1de086+_0x5b1863(0x211),()=>_0x452170[_0x5b1863(0x250)][_0x5b1863(0x23f)](_0x1de086),{'verbose':_0x26f732['verbose']}),console['log'](_0x5b1863(0x1d5)+_0x1de086+_0x5b1863(0x21c)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x4706a6(0x240)]=a16_0x4706a6(0x23a);[a16_0x4706a6(0x1d8)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0x4706a6(0x21a)](_0x17233c){const _0x4e2baa=a16_0x4706a6,{options:_0x313894,args:_0x5802fa,tdx:_0x1a8082}=_0x17233c;if(_0x5802fa[_0x4e2baa(0x220)]===0x0)return console[_0x4e2baa(0x232)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x4e2baa(0x232)]('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x1a75ee=_0x5802fa[0x0];await withSpinner('Verifying\x20workspace\x20\x27'+_0x1a75ee+_0x4e2baa(0x211),()=>_0x1a8082[_0x4e2baa(0x250)][_0x4e2baa(0x1e5)](_0x1a75ee));const _0x977298=_0x313894['session']||undefined;return saveSessionContext({'engage_workspace':_0x1a75ee},_0x977298),console['log'](_0x4e2baa(0x20e)+_0x1a75ee),console[_0x4e2baa(0x1fa)](_0x4e2baa(0x216)),0x0;}}function a16_0x15e1(){const _0x1a7151=['\x27\x20deleted\x20successfully','engage:workspace:delete','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','plaintext','length','Deleting\x20campaign\x20\x27','keys','Pause\x20a\x20campaign','entries','Resuming\x20campaign\x20\x27','Show\x20workspace\x20details','Operation\x20cancelled','html','subject','\x27\x20paused\x20successfully','Creating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Fetching\x20campaigns...','engage:campaign:pause','506860JghtBC','error','resolvePathToResource','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','resumeCampaign','Duplicating\x20campaign\x20\x27','Show\x20email\x20template\x20details','verbose','Campaign\x20\x27','engage:workspace:use','634Ynqqcm','duplicateCampaign','workspace','yes','deleteWorkspace','name','Create\x20an\x20email\x20template','1289zZsuxE','type','engage:workspace:show','Workspace\x20is\x20required\x20for\x20this\x20operation','limit','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Error:\x20--name\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','segment','getTemplate','Updating\x20campaign\x20\x27','fromEntries','Template\x20\x27','engage','10xAzyEA','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','timezone','engage:template:show','Error:\x20--html\x20is\x20required','data','Delete\x20an\x20email\x20template','getWorkspaceFull','updateCampaign','filter','Workspace\x20\x27','jsonColumns','Creating\x20campaign\x20\x27','description','List\x20campaigns','4263120IlJrgm','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Updating\x20workspace\x20\x27','147lfyvth','Fetching\x20workspaces...','6270121ETXWya','startAt','engage:campaign:show','engage:template:update','Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','resolveWorkspaceId','status','Options:\x20--name,\x20--description','parentName','engage:campaign:duplicate','deleteTemplate','Deleting\x20template\x20\x27','45690TmXbof','parentId','segmentId','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','createTemplate','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','updateWorkspace','Duplicate\x20a\x20campaign','engage:campaigns','engage:campaign:update','3WEZdbu','editorType','engage:workspaces','engage:workspace:update','log','\x27?\x20This\x20cannot\x20be\x20undone.','engage:workspace:create','listCampaigns','Update\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','engage:campaign:resume','segmentName','Fetching\x20campaign\x20\x27','listTemplates','2224108gUZIrs','2405384QFtaLv','engage:campaign:create','\x27\x20launched\x20successfully','getCampaignFull','List\x20workspaces','getWorkspace','getTemplateFull','Updating\x20template\x20\x27','emailSenderId','Engage\x20workspace\x20set\x20to:\x20','Launch\x20a\x20campaign','Launching\x20campaign\x20\x27','\x27...','session','Delete\x20a\x20workspace','Deleting\x20workspace\x20\x27','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','engage_workspace','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Fetching\x20template\x20\x27','execute','Create\x20a\x20new\x20campaign'];a16_0x15e1=function(){return _0x1a7151;};return a16_0x15e1();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a17_0x1650de=a17_0x486e;(function(_0xde1d12,_0x2dfe60){const _0xdcb53=a17_0x486e,_0x5b067b=_0xde1d12();while(!![]){try{const _0x22144b=-parseInt(_0xdcb53(0x1ef))/0x1+parseInt(_0xdcb53(0x230))/0x2+parseInt(_0xdcb53(0x207))/0x3+-parseInt(_0xdcb53(0x1fc))/0x4+parseInt(_0xdcb53(0x1e6))/0x5*(-parseInt(_0xdcb53(0x215))/0x6)+-parseInt(_0xdcb53(0x21b))/0x7*(-parseInt(_0xdcb53(0x1f5))/0x8)+parseInt(_0xdcb53(0x206))/0x9;if(_0x22144b===_0x2dfe60)break;else _0x5b067b['push'](_0x5b067b['shift']());}catch(_0xea2ef0){_0x5b067b['push'](_0x5b067b['shift']());}}}(a17_0x4ccd,0x6a4f5));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x1650de(0x21e)]=a17_0x1650de(0x202);[a17_0x1650de(0x22d)]=a17_0x1650de(0x1e9);async['execute'](_0x3fbd62){const _0x4d47f0=a17_0x1650de,{options:_0x3511c6,tdx:_0x103cd0}=_0x3fbd62;try{const _0x4ef58e=resolveLimit(_0x3511c6[_0x4d47f0(0x22e)],DEFAULT_DISPLAY_LIMIT),_0x2c8e69=_0x3511c6[_0x4d47f0(0x1fb)];_0x3511c6[_0x4d47f0(0x22f)]&&(console['error'](_0x4d47f0(0x21f)+_0x4ef58e+_0x4d47f0(0x1f7)),_0x2c8e69&&console['error']('Status\x20filter:\x20'+_0x2c8e69));const _0x4d7070=await withSpinner(_0x4d47f0(0x21c),()=>_0x103cd0['jobs'][_0x4d47f0(0x209)]({'from':0x0,'to':_0x4ef58e-0x1,'status':_0x2c8e69}),{'verbose':_0x3511c6[_0x4d47f0(0x22f)]}),_0x43106b=_0x4d7070[_0x4d47f0(0x1ee)];console[_0x4d47f0(0x221)](_0x4d47f0(0x217)+_0x43106b[_0x4d47f0(0x228)]+_0x4d47f0(0x208)+(_0x43106b['length']!==0x1?'s':''));const _0xec6660=_0x43106b['map'](_0x4ea4ef=>{const _0x537231=_0x4d47f0;let _0x371973;if(_0x4ea4ef['start_at']&&_0x4ea4ef[_0x537231(0x20e)]){const _0x10dd62=new Date(_0x4ea4ef[_0x537231(0x1fd)])[_0x537231(0x224)](),_0x1a9bdd=new Date(_0x4ea4ef[_0x537231(0x20e)])[_0x537231(0x224)]();_0x371973=Math[_0x537231(0x211)]((_0x1a9bdd-_0x10dd62)/0x3e8);}return{'job_id':_0x4ea4ef[_0x537231(0x1e8)],'type':_0x4ea4ef['type'],'status':_0x4ea4ef[_0x537231(0x1fb)],'user_name':_0x4ea4ef[_0x537231(0x212)],'duration_sec':_0x371973,'created_at':_0x4ea4ef['created_at'],'started_at':_0x4ea4ef[_0x537231(0x1fd)],'end_at':_0x4ea4ef['end_at']};});return await handleSDKOutput(_0xec6660,_0x3511c6),0x0;}catch(_0x2f4f84){if(_0x2f4f84 instanceof SDKError)return console['error'](_0x4d47f0(0x1f6)+_0x2f4f84[_0x4d47f0(0x1f3)]),_0x2f4f84[_0x4d47f0(0x204)]&&console[_0x4d47f0(0x221)](_0x4d47f0(0x1ed)+_0x2f4f84[_0x4d47f0(0x204)]),0x1;throw _0x2f4f84;}}}function a17_0x486e(_0x4e7dbb,_0x1f1380){_0x4e7dbb=_0x4e7dbb-0x1e4;const _0x4ccd48=a17_0x4ccd();let _0x486e32=_0x4ccd48[_0x4e7dbb];return _0x486e32;}function a17_0x4ccd(){const _0x6b593c=['2106000cKYvpB','\x20job','list','Submitting\x20job...','priority','Job\x20type:\x20','job:show','end_at','Submitting\x20kill\x20request...','kill','round','user_name','✔\x20Job\x20submitted','yes','3232626ibqMgW','submit','✔\x20Found\x20','trino','created_at','url','1759709WKeQun','Listing\x20jobs...','Error:\x20Job\x20ID\x20is\x20required','name','Limit:\x20','database','error','Usage:\x20job\x20kill\x20<job-id>','Usage:\x20job\x20show\x20<job-id>','getTime','execute','debug','job:result','length','...','Error:\x20Query\x20is\x20required','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','Get\x20job\x20results','description','limit','verbose','764484fMrPRq','substring','query','5ycqHBH','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','job_id','List\x20jobs','Getting\x20job\x20results...','job:kill','Database:\x20','\x20\x20Cause:\x20','data','594412zqlqHq','show','Kill\x20a\x20job','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','message','Submit\x20a\x20job','8sRxCZl','Error:\x20','\x20jobs','Getting\x20job\x20details...','\x27\x20to\x20verify\x20the\x20job\x20status','Cancelled','status','624540oyrCXP','start_at','hive','jobType','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','jobs','Show\x20job\x20details','cause','file','3502206MiFmJO'];a17_0x4ccd=function(){return _0x6b593c;};return a17_0x4ccd();}export class JobShowCommand extends BaseCommand{['name']=a17_0x1650de(0x20d);[a17_0x1650de(0x22d)]=a17_0x1650de(0x203);async[a17_0x1650de(0x225)](_0x261587){const _0x4cbce8=a17_0x1650de,{options:_0xc833cd,args:_0x99b579,tdx:_0x2bd84a}=_0x261587,_0x563160=_0x99b579[0x0];if(!_0x563160)return console[_0x4cbce8(0x221)](_0x4cbce8(0x21d)),console[_0x4cbce8(0x221)](_0x4cbce8(0x223)),0x1;try{const _0x65d14e=await withSpinner(_0x4cbce8(0x1f8),()=>_0x2bd84a[_0x4cbce8(0x202)][_0x4cbce8(0x1f0)](_0x563160),{'verbose':_0xc833cd['verbose']}),_0x1224dd=_0x65d14e[_0x4cbce8(0x1ee)];let _0x364529;if(_0x1224dd['start_at']&&_0x1224dd['end_at']){const _0x1ba7db=new Date(_0x1224dd[_0x4cbce8(0x1fd)])[_0x4cbce8(0x224)](),_0x4f4847=new Date(_0x1224dd[_0x4cbce8(0x20e)])[_0x4cbce8(0x224)]();_0x364529=Math['round']((_0x4f4847-_0x1ba7db)/0x3e8);}const _0x26b440={'job_id':_0x1224dd[_0x4cbce8(0x1e8)],'type':_0x1224dd['type'],'status':_0x1224dd['status'],..._0x1224dd[_0x4cbce8(0x212)]&&{'user_name':_0x1224dd[_0x4cbce8(0x212)]},..._0x364529!==undefined&&{'duration_sec':_0x364529},..._0x1224dd[_0x4cbce8(0x219)]&&{'created_at':_0x1224dd['created_at']},..._0x1224dd[_0x4cbce8(0x1fd)]&&{'started_at':_0x1224dd[_0x4cbce8(0x1fd)]},..._0x1224dd[_0x4cbce8(0x20e)]&&{'end_at':_0x1224dd[_0x4cbce8(0x20e)]},..._0x1224dd[_0x4cbce8(0x220)]&&{'database':_0x1224dd['database']},..._0x1224dd['priority']!==undefined&&{'priority':_0x1224dd[_0x4cbce8(0x20b)]},..._0x1224dd['url']&&{'url':_0x1224dd[_0x4cbce8(0x21a)]},..._0x1224dd[_0x4cbce8(0x1e5)]&&{'query':_0x1224dd[_0x4cbce8(0x1e5)]},..._0x1224dd['debug']&&{'debug':_0x1224dd[_0x4cbce8(0x226)]}};return await handleSingleObjectOutput(_0x26b440,_0xc833cd),0x0;}catch(_0x4f385e){if(_0x4f385e instanceof SDKError)return console[_0x4cbce8(0x221)](_0x4cbce8(0x1f6)+_0x4f385e[_0x4cbce8(0x1f3)]),_0x4f385e[_0x4cbce8(0x204)]&&console['error'](_0x4cbce8(0x1ed)+_0x4f385e[_0x4cbce8(0x204)]),0x1;throw _0x4f385e;}}}export class JobKillCommand extends BaseCommand{[a17_0x1650de(0x21e)]=a17_0x1650de(0x1eb);[a17_0x1650de(0x22d)]=a17_0x1650de(0x1f1);async[a17_0x1650de(0x225)](_0x1af7ae){const _0x4ec960=a17_0x1650de,{options:_0xb3697b,args:_0x39c21d,tdx:_0x556a0b}=_0x1af7ae,_0x5650fc=_0x39c21d[0x0];if(!_0x5650fc)return console[_0x4ec960(0x221)]('Error:\x20Job\x20ID\x20is\x20required'),console['error'](_0x4ec960(0x222)),0x1;try{if(!_0xb3697b[_0x4ec960(0x214)]){const _0x26b2b9=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x5650fc+'?');if(!_0x26b2b9)return console[_0x4ec960(0x221)](_0x4ec960(0x1fa)),0x0;}return await withSpinner(_0x4ec960(0x20f),()=>_0x556a0b[_0x4ec960(0x202)][_0x4ec960(0x210)](_0x5650fc),{'verbose':_0xb3697b['verbose']}),console[_0x4ec960(0x221)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0x5650fc),console['error'](_0x4ec960(0x201)+_0x5650fc+_0x4ec960(0x1f9)),0x0;}catch(_0x4592f8){if(_0x4592f8 instanceof SDKError)return console[_0x4ec960(0x221)](_0x4ec960(0x1f6)+_0x4592f8['message']),_0x4592f8['cause']&&console['error'](_0x4ec960(0x1ed)+_0x4592f8[_0x4ec960(0x204)]),0x1;throw _0x4592f8;}}}export class JobSubmitCommand extends BaseCommand{[a17_0x1650de(0x21e)]='job:submit';[a17_0x1650de(0x22d)]=a17_0x1650de(0x1f4);async[a17_0x1650de(0x225)](_0x27dfbb){const _0x50f25c=a17_0x1650de,{options:_0x2d3397,args:_0x403673,tdx:_0x1a093d}=_0x27dfbb;try{const _0x2938a0=_0x2d3397[_0x50f25c(0x1ff)]||_0x50f25c(0x218),_0x4c0aae=_0x2d3397[_0x50f25c(0x205)],_0x13d909=_0x2d3397['database']||'information_schema';if(_0x2938a0!=='trino'&&_0x2938a0!==_0x50f25c(0x1fe))return console['error'](_0x50f25c(0x1f2)),0x1;let _0xfc0262;if(_0x4c0aae){if(_0x403673[0x0])return console['error'](_0x50f25c(0x1e7)),0x1;const _0x43b288=readSqlStatementsFromFile(_0x4c0aae);if(_0x43b288['length']===0x0)return console[_0x50f25c(0x221)](_0x50f25c(0x200)),0x1;if(_0x43b288['length']>0x1)return console[_0x50f25c(0x221)]('Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'),0x1;_0xfc0262=_0x43b288[0x0];}else{if(!_0x403673[0x0])return console[_0x50f25c(0x221)](_0x50f25c(0x22a)),console[_0x50f25c(0x221)](_0x50f25c(0x22b)),0x1;_0xfc0262=_0x403673[0x0];}_0x2d3397[_0x50f25c(0x22f)]&&(console[_0x50f25c(0x221)](_0x50f25c(0x20c)+_0x2938a0),console[_0x50f25c(0x221)](_0x50f25c(0x1ec)+_0x13d909),console[_0x50f25c(0x221)]('Query:\x20'+_0xfc0262[_0x50f25c(0x1e4)](0x0,0x64)+(_0xfc0262['length']>0x64?_0x50f25c(0x229):'')));const _0x594135=await withSpinner(_0x50f25c(0x20a),()=>_0x1a093d[_0x50f25c(0x202)][_0x50f25c(0x216)](_0x13d909,_0xfc0262,_0x2938a0),{'verbose':_0x2d3397[_0x50f25c(0x22f)]}),_0xc58bea=_0x594135[_0x50f25c(0x1ee)];return console[_0x50f25c(0x221)](_0x50f25c(0x213)),console[_0x50f25c(0x221)]('\x20\x20Job\x20ID:\x20'+_0xc58bea[_0x50f25c(0x1e8)]),await handleSDKOutput([_0xc58bea],_0x2d3397),0x0;}catch(_0x12b1de){if(_0x12b1de instanceof SDKError)return console[_0x50f25c(0x221)](_0x50f25c(0x1f6)+_0x12b1de[_0x50f25c(0x1f3)]),_0x12b1de['cause']&&console['error'](_0x50f25c(0x1ed)+_0x12b1de[_0x50f25c(0x204)]),0x1;throw _0x12b1de;}}}export class JobResultCommand extends BaseCommand{[a17_0x1650de(0x21e)]=a17_0x1650de(0x227);[a17_0x1650de(0x22d)]=a17_0x1650de(0x22c);async[a17_0x1650de(0x225)](_0x1ccdcd){const _0x4a0a64=a17_0x1650de,{options:_0x28f2af,args:_0x5b14b4,tdx:_0xa13e4a}=_0x1ccdcd,_0x19650a=_0x5b14b4[0x0];if(!_0x19650a)return console[_0x4a0a64(0x221)](_0x4a0a64(0x21d)),console['error']('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x57e506=await withSpinner(_0x4a0a64(0x1ea),()=>_0xa13e4a[_0x4a0a64(0x202)]['result'](_0x19650a),{'verbose':_0x28f2af[_0x4a0a64(0x22f)]}),_0x4e845f=_0x57e506[_0x4a0a64(0x1ee)];return console[_0x4a0a64(0x221)]('✔\x20Retrieved\x20'+_0x4e845f[_0x4a0a64(0x228)]+'\x20row'+(_0x4e845f[_0x4a0a64(0x228)]!==0x1?'s':'')),await handleSDKOutput(_0x4e845f,_0x28f2af),0x0;}catch(_0x35c0aa){if(_0x35c0aa instanceof SDKError)return console[_0x4a0a64(0x221)]('Error:\x20'+_0x35c0aa[_0x4a0a64(0x1f3)]),_0x35c0aa[_0x4a0a64(0x204)]&&console[_0x4a0a64(0x221)]('\x20\x20Cause:\x20'+_0x35c0aa[_0x4a0a64(0x204)]),0x1;throw _0x35c0aa;}}}
|
|
1
|
+
function a17_0x4e6f(){const _0x113ffa=['Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','\x20\x20Cause:\x20','...','job:kill','map','jobs','verbose','613327OKkrdP','debug','error','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','created_at','\x20jobs','job:submit','List\x20jobs','message','✔\x20Found\x20','Error:\x20Query\x20is\x20required','\x20row','list','user_name','40cYXyON','Submitting\x20kill\x20request...','yes','name','submit','6RsGEHZ','limit','type','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','job_id','query','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','round','Database:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','✔\x20Retrieved\x20','execute','Error:\x20','2527931QMgNjJ','status','result','Submitting\x20job...','show','265082Vmexqx','url','36ukJQYB','priority','kill','9225vhwgtj','16623nvnhVv','file','Getting\x20job\x20results...','1356jKeNWE','database','1332720cyKQbe','jobType','Query:\x20','Get\x20job\x20results','\x27\x20to\x20verify\x20the\x20job\x20status','substring','\x20\x20Job\x20ID:\x20','Error:\x20Job\x20ID\x20is\x20required','Submit\x20a\x20job','Usage:\x20job\x20result\x20<job-id>','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','hive','242584sdhfTg','Usage:\x20job\x20show\x20<job-id>','length','data','description','Show\x20job\x20details','start_at','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','end_at','Cancelled','getTime','Job\x20type:\x20','cause','Getting\x20job\x20details...'];a17_0x4e6f=function(){return _0x113ffa;};return a17_0x4e6f();}const a17_0x18396f=a17_0x218d;(function(_0x1a0fc9,_0x55ca0f){const _0x1acb48=a17_0x218d,_0x504184=_0x1a0fc9();while(!![]){try{const _0x1ac11b=parseInt(_0x1acb48(0x10f))/0x1+-parseInt(_0x1acb48(0x109))/0x2*(parseInt(_0x1acb48(0xf7))/0x3)+parseInt(_0x1acb48(0x112))/0x4*(parseInt(_0x1acb48(0x10e))/0x5)+-parseInt(_0x1acb48(0x114))/0x6+parseInt(_0x1acb48(0x104))/0x7+-parseInt(_0x1acb48(0x120))/0x8*(-parseInt(_0x1acb48(0x10b))/0x9)+parseInt(_0x1acb48(0xf2))/0xa*(-parseInt(_0x1acb48(0xe4))/0xb);if(_0x1ac11b===_0x55ca0f)break;else _0x504184['push'](_0x504184['shift']());}catch(_0x3c6dd4){_0x504184['push'](_0x504184['shift']());}}}(a17_0x4e6f,0x65241));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x18396f(0xf5)]=a17_0x18396f(0xe2);[a17_0x18396f(0x124)]=a17_0x18396f(0xeb);async[a17_0x18396f(0x102)](_0x3d720e){const _0x251b2d=a17_0x18396f,{options:_0x42343b,tdx:_0x5c5a79}=_0x3d720e;try{const _0x2a0de4=resolveLimit(_0x42343b[_0x251b2d(0xf8)],DEFAULT_DISPLAY_LIMIT),_0x4810f2=_0x42343b[_0x251b2d(0x105)];_0x42343b['verbose']&&(console[_0x251b2d(0xe6)]('Limit:\x20'+_0x2a0de4+_0x251b2d(0xe9)),_0x4810f2&&console[_0x251b2d(0xe6)]('Status\x20filter:\x20'+_0x4810f2));const _0x2eaf71=await withSpinner('Listing\x20jobs...',()=>_0x5c5a79[_0x251b2d(0xe2)][_0x251b2d(0xf0)]({'from':0x0,'to':_0x2a0de4-0x1,'status':_0x4810f2}),{'verbose':_0x42343b['verbose']}),_0x4ea61d=_0x2eaf71[_0x251b2d(0x123)];console[_0x251b2d(0xe6)](_0x251b2d(0xed)+_0x4ea61d[_0x251b2d(0x122)]+'\x20job'+(_0x4ea61d[_0x251b2d(0x122)]!==0x1?'s':''));const _0x1112a3=_0x4ea61d[_0x251b2d(0xe1)](_0x103ae5=>{const _0x5e00d7=_0x251b2d;let _0x5e6bb3;if(_0x103ae5[_0x5e00d7(0x126)]&&_0x103ae5[_0x5e00d7(0x129)]){const _0x4dcd5b=new Date(_0x103ae5['start_at'])[_0x5e00d7(0x12b)](),_0x4456ff=new Date(_0x103ae5[_0x5e00d7(0x129)])[_0x5e00d7(0x12b)]();_0x5e6bb3=Math[_0x5e00d7(0xfe)]((_0x4456ff-_0x4dcd5b)/0x3e8);}return{'job_id':_0x103ae5[_0x5e00d7(0xfb)],'type':_0x103ae5['type'],'status':_0x103ae5[_0x5e00d7(0x105)],'user_name':_0x103ae5[_0x5e00d7(0xf1)],'duration_sec':_0x5e6bb3,'created_at':_0x103ae5[_0x5e00d7(0xe8)],'started_at':_0x103ae5[_0x5e00d7(0x126)],'end_at':_0x103ae5[_0x5e00d7(0x129)]};});return await handleSDKOutput(_0x1112a3,_0x42343b),0x0;}catch(_0x4e2d21){if(_0x4e2d21 instanceof SDKError)return console[_0x251b2d(0xe6)](_0x251b2d(0x103)+_0x4e2d21[_0x251b2d(0xec)]),_0x4e2d21['cause']&&console[_0x251b2d(0xe6)](_0x251b2d(0xde)+_0x4e2d21[_0x251b2d(0xdb)]),0x1;throw _0x4e2d21;}}}export class JobShowCommand extends BaseCommand{[a17_0x18396f(0xf5)]='job:show';[a17_0x18396f(0x124)]=a17_0x18396f(0x125);async['execute'](_0x3a37a7){const _0x276f79=a17_0x18396f,{options:_0x1d3093,args:_0x1a2284,tdx:_0x7fce01}=_0x3a37a7,_0x4f2154=_0x1a2284[0x0];if(!_0x4f2154)return console['error'](_0x276f79(0x11b)),console[_0x276f79(0xe6)](_0x276f79(0x121)),0x1;try{const _0x4867db=await withSpinner(_0x276f79(0xdc),()=>_0x7fce01[_0x276f79(0xe2)][_0x276f79(0x108)](_0x4f2154),{'verbose':_0x1d3093[_0x276f79(0xe3)]}),_0x42dbf0=_0x4867db[_0x276f79(0x123)];let _0x2728b3;if(_0x42dbf0[_0x276f79(0x126)]&&_0x42dbf0[_0x276f79(0x129)]){const _0x247c31=new Date(_0x42dbf0['start_at'])[_0x276f79(0x12b)](),_0x12a40e=new Date(_0x42dbf0['end_at'])['getTime']();_0x2728b3=Math[_0x276f79(0xfe)]((_0x12a40e-_0x247c31)/0x3e8);}const _0x5d1a84={'job_id':_0x42dbf0[_0x276f79(0xfb)],'type':_0x42dbf0[_0x276f79(0xf9)],'status':_0x42dbf0[_0x276f79(0x105)],..._0x42dbf0[_0x276f79(0xf1)]&&{'user_name':_0x42dbf0['user_name']},..._0x2728b3!==undefined&&{'duration_sec':_0x2728b3},..._0x42dbf0['created_at']&&{'created_at':_0x42dbf0[_0x276f79(0xe8)]},..._0x42dbf0['start_at']&&{'started_at':_0x42dbf0['start_at']},..._0x42dbf0[_0x276f79(0x129)]&&{'end_at':_0x42dbf0[_0x276f79(0x129)]},..._0x42dbf0[_0x276f79(0x113)]&&{'database':_0x42dbf0[_0x276f79(0x113)]},..._0x42dbf0[_0x276f79(0x10c)]!==undefined&&{'priority':_0x42dbf0[_0x276f79(0x10c)]},..._0x42dbf0[_0x276f79(0x10a)]&&{'url':_0x42dbf0[_0x276f79(0x10a)]},..._0x42dbf0[_0x276f79(0xfc)]&&{'query':_0x42dbf0['query']},..._0x42dbf0['debug']&&{'debug':_0x42dbf0[_0x276f79(0xe5)]}};return await handleSingleObjectOutput(_0x5d1a84,_0x1d3093),0x0;}catch(_0x1f4f8f){if(_0x1f4f8f instanceof SDKError)return console['error'](_0x276f79(0x103)+_0x1f4f8f['message']),_0x1f4f8f[_0x276f79(0xdb)]&&console[_0x276f79(0xe6)](_0x276f79(0xde)+_0x1f4f8f[_0x276f79(0xdb)]),0x1;throw _0x1f4f8f;}}}export class JobKillCommand extends BaseCommand{[a17_0x18396f(0xf5)]=a17_0x18396f(0xe0);[a17_0x18396f(0x124)]='Kill\x20a\x20job';async['execute'](_0x365ae0){const _0xb927e6=a17_0x18396f,{options:_0x473dec,args:_0xa6c8ea,tdx:_0x164109}=_0x365ae0,_0x3336dc=_0xa6c8ea[0x0];if(!_0x3336dc)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0xb927e6(0xe6)]('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x473dec[_0xb927e6(0xf4)]){const _0x477add=await confirm(_0xb927e6(0x100)+_0x3336dc+'?');if(!_0x477add)return console[_0xb927e6(0xe6)](_0xb927e6(0x12a)),0x0;}return await withSpinner(_0xb927e6(0xf3),()=>_0x164109['jobs'][_0xb927e6(0x10d)](_0x3336dc),{'verbose':_0x473dec[_0xb927e6(0xe3)]}),console['error'](_0xb927e6(0x11e)+_0x3336dc),console[_0xb927e6(0xe6)](_0xb927e6(0x127)+_0x3336dc+_0xb927e6(0x118)),0x0;}catch(_0x33add6){if(_0x33add6 instanceof SDKError)return console[_0xb927e6(0xe6)]('Error:\x20'+_0x33add6[_0xb927e6(0xec)]),_0x33add6[_0xb927e6(0xdb)]&&console[_0xb927e6(0xe6)](_0xb927e6(0xde)+_0x33add6[_0xb927e6(0xdb)]),0x1;throw _0x33add6;}}}export class JobSubmitCommand extends BaseCommand{['name']=a17_0x18396f(0xea);[a17_0x18396f(0x124)]=a17_0x18396f(0x11c);async[a17_0x18396f(0x102)](_0x227b0b){const _0x4fdb04=a17_0x18396f,{options:_0xa1e2f5,args:_0x2a67bc,tdx:_0x2a0888}=_0x227b0b;try{const _0x857b1f=_0xa1e2f5[_0x4fdb04(0x115)]||'trino',_0x1b14a4=_0xa1e2f5[_0x4fdb04(0x110)],_0x10b482=_0xa1e2f5['database']||'information_schema';if(_0x857b1f!=='trino'&&_0x857b1f!==_0x4fdb04(0x11f))return console[_0x4fdb04(0xe6)](_0x4fdb04(0x128)),0x1;let _0x501bdd;if(_0x1b14a4){if(_0x2a67bc[0x0])return console['error'](_0x4fdb04(0xfa)),0x1;const _0x1ae57a=readSqlStatementsFromFile(_0x1b14a4);if(_0x1ae57a['length']===0x0)return console[_0x4fdb04(0xe6)](_0x4fdb04(0xdd)),0x1;if(_0x1ae57a[_0x4fdb04(0x122)]>0x1)return console[_0x4fdb04(0xe6)](_0x4fdb04(0xfd)),0x1;_0x501bdd=_0x1ae57a[0x0];}else{if(!_0x2a67bc[0x0])return console['error'](_0x4fdb04(0xee)),console['error'](_0x4fdb04(0xe7)),0x1;_0x501bdd=_0x2a67bc[0x0];}_0xa1e2f5[_0x4fdb04(0xe3)]&&(console[_0x4fdb04(0xe6)](_0x4fdb04(0x12c)+_0x857b1f),console[_0x4fdb04(0xe6)](_0x4fdb04(0xff)+_0x10b482),console[_0x4fdb04(0xe6)](_0x4fdb04(0x116)+_0x501bdd[_0x4fdb04(0x119)](0x0,0x64)+(_0x501bdd['length']>0x64?_0x4fdb04(0xdf):'')));const _0x410d5f=await withSpinner(_0x4fdb04(0x107),()=>_0x2a0888['jobs'][_0x4fdb04(0xf6)](_0x10b482,_0x501bdd,_0x857b1f),{'verbose':_0xa1e2f5[_0x4fdb04(0xe3)]}),_0x3e29cd=_0x410d5f[_0x4fdb04(0x123)];return console[_0x4fdb04(0xe6)]('✔\x20Job\x20submitted'),console['error'](_0x4fdb04(0x11a)+_0x3e29cd[_0x4fdb04(0xfb)]),await handleSDKOutput([_0x3e29cd],_0xa1e2f5),0x0;}catch(_0x2dc52b){if(_0x2dc52b instanceof SDKError)return console[_0x4fdb04(0xe6)](_0x4fdb04(0x103)+_0x2dc52b[_0x4fdb04(0xec)]),_0x2dc52b[_0x4fdb04(0xdb)]&&console[_0x4fdb04(0xe6)](_0x4fdb04(0xde)+_0x2dc52b[_0x4fdb04(0xdb)]),0x1;throw _0x2dc52b;}}}function a17_0x218d(_0x1facd1,_0x4b185b){_0x1facd1=_0x1facd1-0xdb;const _0x4e6fa3=a17_0x4e6f();let _0x218daf=_0x4e6fa3[_0x1facd1];return _0x218daf;}export class JobResultCommand extends BaseCommand{[a17_0x18396f(0xf5)]='job:result';[a17_0x18396f(0x124)]=a17_0x18396f(0x117);async[a17_0x18396f(0x102)](_0x3b2ab4){const _0x22f34a=a17_0x18396f,{options:_0x154978,args:_0x446d8b,tdx:_0x543f36}=_0x3b2ab4,_0x2f35f4=_0x446d8b[0x0];if(!_0x2f35f4)return console[_0x22f34a(0xe6)](_0x22f34a(0x11b)),console[_0x22f34a(0xe6)](_0x22f34a(0x11d)),0x1;try{const _0x3dd993=await withSpinner(_0x22f34a(0x111),()=>_0x543f36['jobs'][_0x22f34a(0x106)](_0x2f35f4),{'verbose':_0x154978[_0x22f34a(0xe3)]}),_0xabf568=_0x3dd993['data'];return console[_0x22f34a(0xe6)](_0x22f34a(0x101)+_0xabf568[_0x22f34a(0x122)]+_0x22f34a(0xef)+(_0xabf568['length']!==0x1?'s':'')),await handleSDKOutput(_0xabf568,_0x154978),0x0;}catch(_0x25fb31){if(_0x25fb31 instanceof SDKError)return console[_0x22f34a(0xe6)](_0x22f34a(0x103)+_0x25fb31[_0x22f34a(0xec)]),_0x25fb31['cause']&&console[_0x22f34a(0xe6)]('\x20\x20Cause:\x20'+_0x25fb31[_0x22f34a(0xdb)]),0x1;throw _0x25fb31;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a18_0x158fc7=a18_0x278a;(function(_0x3228eb,_0x4cddbe){const _0x3449d0=a18_0x278a,_0x25e2c2=_0x3228eb();while(!![]){try{const _0x27aa1d=parseInt(_0x3449d0(0x162))/0x1*(parseInt(_0x3449d0(0x15c))/0x2)+parseInt(_0x3449d0(0x204))/0x3*(-parseInt(_0x3449d0(0x1cd))/0x4)+-parseInt(_0x3449d0(0x1ad))/0x5+-parseInt(_0x3449d0(0x1fe))/0x6*(parseInt(_0x3449d0(0x18a))/0x7)+-parseInt(_0x3449d0(0x1ce))/0x8*(parseInt(_0x3449d0(0x1d4))/0x9)+-parseInt(_0x3449d0(0x19a))/0xa+-parseInt(_0x3449d0(0x1b7))/0xb*(-parseInt(_0x3449d0(0x18e))/0xc);if(_0x27aa1d===_0x4cddbe)break;else _0x25e2c2['push'](_0x25e2c2['shift']());}catch(_0x42fa20){_0x25e2c2['push'](_0x25e2c2['shift']());}}}(a18_0x31ea,0x63c71));import a18_0x57b90b from'chalk';import a18_0x10f775 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';function a18_0x278a(_0x5bce53,_0x325af3){_0x5bce53=_0x5bce53-0x13f;const _0x31ea1f=a18_0x31ea();let _0x278a92=_0x31ea1f[_0x5bce53];return _0x278a92;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0xd56f4f){const _0x509424=a18_0x278a;switch(_0xd56f4f){case _0x509424(0x196):return a18_0x57b90b[_0x509424(0x168)]('(running)');case'draft':return a18_0x57b90b[_0x509424(0x210)](_0x509424(0x148));case _0x509424(0x213):return a18_0x57b90b[_0x509424(0x1e3)](_0x509424(0x1b8));case _0x509424(0x203):return a18_0x57b90b[_0x509424(0x1f3)](_0x509424(0x1d8));case _0x509424(0x1f8):return a18_0x57b90b[_0x509424(0x210)]('(archived)');default:return'('+_0xd56f4f+')';}}function formatJourneyItem(_0x16887e,_0x565bfd='',_0x216716){const _0x226dbf=a18_0x278a,_0x2217f5=formatJourneyState(_0x16887e[_0x226dbf(0x1dc)]),_0xc3f89c=_0x216716?hyperlink(_0x16887e[_0x226dbf(0x1bd)],_0x216716):_0x16887e['journeyBundleName'];return _0x565bfd+_0x226dbf(0x15b)+_0xc3f89c+'\x20'+_0x2217f5;}function escapeRegex(_0x1777a4){const _0x359dfc=a18_0x278a;return _0x1777a4[_0x359dfc(0x1f0)](/[.*+?^${}()|[\]\\]/g,_0x359dfc(0x167));}function globToRegex(_0x5116c7){const _0x607fad=a18_0x278a,_0x48ea6d=_0x5116c7[_0x607fad(0x17a)]('*')[_0x607fad(0x166)](escapeRegex);return new RegExp(_0x48ea6d[_0x607fad(0x147)]('.*'),'i');}function buildRuleToNameMapping(_0x25b7ab){const _0x1cdca7=a18_0x278a,_0x218f87=new Map();if(_0x25b7ab[_0x1cdca7(0x1ff)])for(const [_0x280fe0,_0x42ca09]of Object[_0x1cdca7(0x184)](_0x25b7ab[_0x1cdca7(0x1ff)])){if(_0x42ca09['rule']){const _0x7da26b=serializeRule(_0x42ca09[_0x1cdca7(0x1eb)]),_0x4a5d35=_0x218f87[_0x1cdca7(0x1e5)](_0x7da26b);_0x4a5d35?_0x4a5d35[_0x1cdca7(0x186)](_0x280fe0):_0x218f87[_0x1cdca7(0x19c)](_0x7da26b,[_0x280fe0]);}}return _0x218f87;}async function resolveJourneyTarget(_0x2adbad,_0x4ce556,_0x1622d8){const _0x4387ad=a18_0x278a;if(isYamlFilePath(_0x2adbad))try{const _0x1a7883=await resolveYamlFilePath(_0x2adbad);return _0x1622d8&&(console[_0x4387ad(0x209)](_0x4387ad(0x1e8)+_0x2adbad),console[_0x4387ad(0x209)]('\x20\x20Parent\x20segment:\x20'+_0x1a7883[_0x4387ad(0x141)]),console[_0x4387ad(0x209)](_0x4387ad(0x16c)+_0x1a7883['segmentName']),console['error'](_0x4387ad(0x1ec)+(_0x1a7883['folderPath']||_0x4387ad(0x1e0)))),{'journeyName':_0x1a7883[_0x4387ad(0x1a6)],'parentSegment':_0x1a7883['parentSegment'],'resolved':_0x1a7883};}catch(_0x4b928a){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4387ad(0x207)+_0x4b928a[_0x4387ad(0x161)]);}if(!_0x4ce556)throw new SDKError(ErrorCode[_0x4387ad(0x17d)],_0x4387ad(0x140));return{'journeyName':_0x2adbad,'parentSegment':_0x4ce556};}export class JourneyListCommand extends BaseCommand{[a18_0x158fc7(0x215)]=a18_0x158fc7(0x1d1);[a18_0x158fc7(0x19f)]=a18_0x158fc7(0x1f4);async[a18_0x158fc7(0x198)](_0x5f2be0){const _0x26d483=a18_0x158fc7,{options:_0x4681fe,args:_0x334a65,tdx:_0x30ebeb}=_0x5f2be0,_0x3614f1=_0x334a65[0x0],_0x1f4c06=_0x4681fe[_0x26d483(0x141)];if(!_0x1f4c06)return console[_0x26d483(0x209)](_0x26d483(0x1d0)),console[_0x26d483(0x209)]('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x339fb9=await withSpinner(_0x26d483(0x205),()=>_0x30ebeb['segment'][_0x26d483(0x1c5)](_0x1f4c06),{'verbose':_0x4681fe['verbose']}),_0x370d38=_0x339fb9[_0x26d483(0x1fd)];_0x4681fe['verbose']&&(console[_0x26d483(0x209)](_0x26d483(0x211)+_0x1f4c06+_0x26d483(0x1b4)+_0x370d38+')'),_0x3614f1&&console[_0x26d483(0x209)](_0x26d483(0x19b)+_0x3614f1));const _0xa5670b=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x30ebeb[_0x26d483(0x1d2)]['getParentFull'](_0x370d38),{'verbose':_0x4681fe[_0x26d483(0x143)]}),_0x42f16e=_0xa5670b[_0x26d483(0x1fd)],_0x13374f=_0x42f16e[_0x26d483(0x157)],_0x56c525=await withSpinner(_0x26d483(0x1c4),()=>_0x30ebeb[_0x26d483(0x20c)][_0x26d483(0x17e)](_0x370d38,_0x13374f),{'verbose':_0x4681fe[_0x26d483(0x143)]});let _0x374501=_0x56c525[_0x26d483(0x1fd)][_0x26d483(0x20e)];const _0x248ab6=_0x56c525[_0x26d483(0x1fd)]['folders'],_0x5bb884=new Map();for(const _0x5ad9db of _0x248ab6){_0x5bb884[_0x26d483(0x19c)](_0x5ad9db['id'],_0x5ad9db['name']);}if(_0x3614f1){const _0x3a7f1a=globToRegex(_0x3614f1);_0x374501=_0x374501['filter'](_0x42bb18=>_0x3a7f1a[_0x26d483(0x1be)](_0x42bb18[_0x26d483(0x1bd)]));}console[_0x26d483(0x209)]('✔\x20Found\x20'+_0x374501[_0x26d483(0x200)]+'\x20journey'+(_0x374501[_0x26d483(0x200)]!==0x1?'s':''));const _0x768b05=_0x161ff7=>{const _0x513f04=_0x26d483;return getConsoleNextUrl(_0x4681fe[_0x513f04(0x1b5)],_0x513f04(0x1e4)+_0x370d38+_0x513f04(0x149)+_0x161ff7+'/j/da');};if(_0x4681fe[_0x26d483(0x18f)]===_0x26d483(0x160))await handleSDKOutput(_0x374501,_0x4681fe);else{if(_0x4681fe['format']===_0x26d483(0x14e)){const _0x36f3c7=_0x374501['map'](_0x122e89=>({..._0x122e89,'url':_0x768b05(_0x122e89['id'])}));await handleSDKOutput(_0x36f3c7,_0x4681fe);}else{console[_0x26d483(0x1bf)]('['+_0x1f4c06+']');const _0x4a3251=new Map(),_0x37d395=[];for(const _0x1792f3 of _0x374501){if(!_0x1792f3[_0x26d483(0x19e)]||_0x1792f3['folderId']===_0x13374f)_0x37d395['push'](_0x1792f3);else{const _0x401911=_0x4a3251[_0x26d483(0x1e5)](_0x1792f3[_0x26d483(0x19e)])||[];_0x401911[_0x26d483(0x186)](_0x1792f3),_0x4a3251[_0x26d483(0x19c)](_0x1792f3[_0x26d483(0x19e)],_0x401911);}}const _0x381d0b=(_0x19037c,_0x3692b8)=>_0x19037c[_0x26d483(0x1bd)][_0x26d483(0x1c0)](_0x3692b8['journeyBundleName'],undefined,{'sensitivity':_0x26d483(0x159)});_0x37d395[_0x26d483(0x1c6)](_0x381d0b);for(const _0x4173e5 of _0x37d395){console[_0x26d483(0x1bf)](formatJourneyItem(_0x4173e5,'',_0x768b05(_0x4173e5['id'])));}const _0x309105=[..._0x4a3251['entries']()][_0x26d483(0x1c6)]((_0x38d04f,_0x58f273)=>{const _0x132f13=_0x26d483,_0x1ec94e=_0x5bb884['get'](_0x38d04f[0x0])||_0x38d04f[0x0],_0x32686b=_0x5bb884[_0x132f13(0x1e5)](_0x58f273[0x0])||_0x58f273[0x0];return _0x1ec94e[_0x132f13(0x1c0)](_0x32686b,undefined,{'sensitivity':_0x132f13(0x159)});});for(const [_0x3a1495,_0x315b10]of _0x309105){const _0x18eedf=_0x5bb884[_0x26d483(0x1e5)](_0x3a1495)||_0x3a1495;console[_0x26d483(0x1bf)]('📁\x20'+_0x18eedf),_0x315b10['sort'](_0x381d0b);for(const _0x3297eb of _0x315b10){console[_0x26d483(0x1bf)](formatJourneyItem(_0x3297eb,'\x20\x20',_0x768b05(_0x3297eb['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x158fc7(0x215)]='journey:view';['description']=a18_0x158fc7(0x20d);async[a18_0x158fc7(0x198)](_0x2769ea){const _0x57aedc=a18_0x158fc7,{options:_0x30aae6,args:_0x485dde,tdx:_0x299583}=_0x2769ea,_0x15bf2f=_0x485dde[0x0];if(!_0x15bf2f)return console['error'](_0x57aedc(0x153)),console[_0x57aedc(0x209)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console['error']('Options:'),console['error'](_0x57aedc(0x1d7)),0x1;_0x30aae6[_0x57aedc(0x143)]&&console['error']('Input:\x20'+_0x15bf2f);const _0x181e1c=await resolveJourneyTarget(_0x15bf2f,_0x30aae6['parentSegment'],_0x30aae6[_0x57aedc(0x143)]),_0x26f185=await withSpinner(_0x57aedc(0x205),()=>_0x299583['segment'][_0x57aedc(0x1c5)](_0x181e1c[_0x57aedc(0x141)]),{'verbose':_0x30aae6[_0x57aedc(0x143)]}),_0x2e9caa=_0x26f185[_0x57aedc(0x1fd)],_0x1b0916=await withSpinner(_0x57aedc(0x16e),()=>_0x299583[_0x57aedc(0x20c)][_0x57aedc(0x1d6)](_0x2e9caa,_0x181e1c['journeyName']),{'verbose':_0x30aae6[_0x57aedc(0x143)]}),_0x35568a=_0x1b0916[_0x57aedc(0x1fd)];if(_0x30aae6[_0x57aedc(0x206)]){const _0x2e876a=getConsoleNextUrl(_0x30aae6[_0x57aedc(0x1b5)],_0x57aedc(0x1e4)+_0x2e9caa+_0x57aedc(0x149)+_0x35568a+_0x57aedc(0x1ee));return console['error'](a18_0x57b90b[_0x57aedc(0x168)]('✔')+_0x57aedc(0x165)+a18_0x57b90b['cyan'](_0x2e876a)),openBrowser(_0x2e876a),0x0;}const _0x404ba1=await withSpinner(_0x57aedc(0x1ca),()=>_0x299583[_0x57aedc(0x20c)]['getJourney'](_0x35568a),{'verbose':_0x30aae6[_0x57aedc(0x143)]}),_0x53b99a=_0x404ba1['data'],_0x1bee36=_0x30aae6[_0x57aedc(0x185)];let _0x4da191;if(_0x1bee36)try{const _0x53acaa=await withSpinner(_0x57aedc(0x1cc),()=>_0x299583[_0x57aedc(0x20c)][_0x57aedc(0x1a4)](_0x35568a),{'verbose':_0x30aae6[_0x57aedc(0x143)]});_0x4da191=_0x53acaa['data'];}catch{_0x30aae6['verbose']&&console[_0x57aedc(0x209)](_0x57aedc(0x178));}const _0x49f8da=getConsoleNextUrl(_0x30aae6['site'],'/app/ps/'+_0x2e9caa+_0x57aedc(0x149)+_0x35568a+'/j/da/je'),_0x3ba7c3={'id':_0x53b99a['id'],'name':_0x53b99a[_0x57aedc(0x1a8)][_0x57aedc(0x215)],'description':_0x53b99a[_0x57aedc(0x1a8)][_0x57aedc(0x19f)],'state':_0x53b99a['attributes'][_0x57aedc(0x1dc)],'paused':_0x53b99a['attributes']['paused'],'reentry_mode':_0x53b99a[_0x57aedc(0x1a8)][_0x57aedc(0x142)],'stages':_0x53b99a[_0x57aedc(0x1a8)][_0x57aedc(0x158)]?.[_0x57aedc(0x200)]||0x0,..._0x53b99a['attributes']['goal']&&{'goal':_0x53b99a['attributes'][_0x57aedc(0x1a9)][_0x57aedc(0x215)]},..._0x4da191&&{'statistics':{'total_entered':_0x4da191[_0x57aedc(0x1e9)],'goal_achieved':_0x4da191[_0x57aedc(0x1d3)],'goal_rate':_0x4da191[_0x57aedc(0x1f5)],'stages':_0x4da191[_0x57aedc(0x1a7)]}},'url':_0x49f8da};return await handleSingleObjectOutput(_0x3ba7c3,_0x30aae6),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x158fc7(0x215)]=a18_0x158fc7(0x1fc);[a18_0x158fc7(0x19f)]=a18_0x158fc7(0x1c9);async[a18_0x158fc7(0x198)](_0x2f003c){const _0x3aa17e=a18_0x158fc7,{options:_0x33fda4,args:_0x153e96,tdx:_0x199188}=_0x2f003c,_0xc572a7=_0x153e96[0x0];if(!_0xc572a7)return console[_0x3aa17e(0x209)](_0x3aa17e(0x153)),console[_0x3aa17e(0x209)](_0x3aa17e(0x18b)),0x1;_0x33fda4[_0x3aa17e(0x143)]&&console['error'](_0x3aa17e(0x192)+_0xc572a7);const _0x47342b=await resolveJourneyTarget(_0xc572a7,_0x33fda4[_0x3aa17e(0x141)],_0x33fda4['verbose']),_0x1dcf26=await withSpinner(_0x3aa17e(0x205),()=>_0x199188[_0x3aa17e(0x1d2)][_0x3aa17e(0x1c5)](_0x47342b[_0x3aa17e(0x141)]),{'verbose':_0x33fda4['verbose']}),_0x54f07b=_0x1dcf26[_0x3aa17e(0x1fd)],_0x1d68bf=await withSpinner(_0x3aa17e(0x16e),()=>_0x199188[_0x3aa17e(0x20c)][_0x3aa17e(0x1d6)](_0x54f07b,_0x47342b['journeyName']),{'verbose':_0x33fda4[_0x3aa17e(0x143)]}),_0x3098d8=_0x1d68bf[_0x3aa17e(0x1fd)],_0x181244=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x199188[_0x3aa17e(0x20c)][_0x3aa17e(0x1a4)](_0x3098d8),{'verbose':_0x33fda4[_0x3aa17e(0x143)]}),_0x31077a=_0x181244[_0x3aa17e(0x1fd)];if(!_0x31077a||_0x31077a['journeyId']===null)return console[_0x3aa17e(0x209)](_0x3aa17e(0x1e2)+_0x47342b[_0x3aa17e(0x1c7)]),console[_0x3aa17e(0x209)](_0x3aa17e(0x18d)),0x0;const _0x49fe2b={'journey_id':_0x31077a[_0x3aa17e(0x180)],'total_entered':_0x31077a[_0x3aa17e(0x1e9)],'goal_achieved':_0x31077a['totalGoalAchieved'],'goal_rate':_0x31077a[_0x3aa17e(0x1f5)],'stages':_0x31077a[_0x3aa17e(0x1a7)]?.[_0x3aa17e(0x166)](_0x4e1590=>({'name':_0x4e1590[_0x3aa17e(0x1df)],'population':_0x4e1590[_0x3aa17e(0x1c3)],'entered':_0x4e1590[_0x3aa17e(0x16f)],'exited':_0x4e1590[_0x3aa17e(0x1fa)],'conversion_rate':_0x4e1590['conversionRate']}))},_0x42c75a=_0x33fda4[_0x3aa17e(0x1ef)];if(_0x42c75a&&_0x31077a[_0x3aa17e(0x1a7)]){const _0xd7a907=_0x31077a[_0x3aa17e(0x1a7)][_0x3aa17e(0x1ac)](_0x117d47=>_0x117d47[_0x3aa17e(0x1df)]['toLowerCase']()===_0x42c75a[_0x3aa17e(0x1c2)]());if(_0xd7a907)return await handleSingleObjectOutput({'stage_name':_0xd7a907[_0x3aa17e(0x1df)],'population':_0xd7a907[_0x3aa17e(0x1c3)],'entered':_0xd7a907['entered'],'exited':_0xd7a907[_0x3aa17e(0x1fa)],'conversion_rate':_0xd7a907['conversionRate']},_0x33fda4),0x0;console[_0x3aa17e(0x209)](_0x3aa17e(0x1ab)+_0x42c75a+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x49fe2b,_0x33fda4),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x158fc7(0x215)]=a18_0x158fc7(0x179);[a18_0x158fc7(0x19f)]=a18_0x158fc7(0x1cf);async['execute'](_0x4c4496){const _0x4941cb=a18_0x158fc7,{options:_0x173763,args:_0x523792,tdx:_0x8a172a}=_0x4c4496,_0x50f2a6=_0x523792[0x0];if(!_0x50f2a6)return console[_0x4941cb(0x209)](_0x4941cb(0x153)),console['error'](_0x4941cb(0x1b0)),0x1;_0x173763[_0x4941cb(0x143)]&&console[_0x4941cb(0x209)](_0x4941cb(0x192)+_0x50f2a6);const _0x15f993=await resolveJourneyTarget(_0x50f2a6,_0x173763['parentSegment'],_0x173763['verbose']),_0xda9977=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x8a172a[_0x4941cb(0x1d2)][_0x4941cb(0x1c5)](_0x15f993[_0x4941cb(0x141)]),{'verbose':_0x173763['verbose']}),_0x435b38=_0xda9977[_0x4941cb(0x1fd)],_0x579e7a=await withSpinner('Resolving\x20journey...',()=>_0x8a172a[_0x4941cb(0x20c)]['resolveJourneyId'](_0x435b38,_0x15f993['journeyName']),{'verbose':_0x173763['verbose']}),_0xf4213b=_0x579e7a['data'];if(!_0x173763[_0x4941cb(0x1b2)]){const _0x5f4afa=await confirm(_0x4941cb(0x15f)+_0x15f993[_0x4941cb(0x1c7)]+'\x22?');if(!_0x5f4afa)return console['error'](_0x4941cb(0x170)),0x0;}const _0x3ec363=await withSpinner(_0x4941cb(0x175),()=>_0x8a172a[_0x4941cb(0x20c)]['pause'](_0xf4213b),{'verbose':_0x173763[_0x4941cb(0x143)]}),_0x2f1f81=_0x3ec363[_0x4941cb(0x1fd)];return console['error'](_0x4941cb(0x18c)+_0x2f1f81[_0x4941cb(0x1a8)][_0x4941cb(0x215)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']=a18_0x158fc7(0x163);[a18_0x158fc7(0x19f)]='Resume\x20a\x20paused\x20journey';async['execute'](_0x120db7){const _0x5c1ef9=a18_0x158fc7,{options:_0x4a5c88,args:_0x4a5dfc,tdx:_0x4bf740}=_0x120db7,_0x43e567=_0x4a5dfc[0x0];if(!_0x43e567)return console[_0x5c1ef9(0x209)](_0x5c1ef9(0x153)),console[_0x5c1ef9(0x209)](_0x5c1ef9(0x1bb)),0x1;_0x4a5c88[_0x5c1ef9(0x143)]&&console[_0x5c1ef9(0x209)](_0x5c1ef9(0x192)+_0x43e567);const _0x528010=await resolveJourneyTarget(_0x43e567,_0x4a5c88[_0x5c1ef9(0x141)],_0x4a5c88['verbose']),_0x57d0ed=await withSpinner(_0x5c1ef9(0x205),()=>_0x4bf740[_0x5c1ef9(0x1d2)][_0x5c1ef9(0x1c5)](_0x528010[_0x5c1ef9(0x141)]),{'verbose':_0x4a5c88[_0x5c1ef9(0x143)]}),_0x2627e5=_0x57d0ed[_0x5c1ef9(0x1fd)],_0x1de9cf=await withSpinner(_0x5c1ef9(0x16e),()=>_0x4bf740[_0x5c1ef9(0x20c)][_0x5c1ef9(0x1d6)](_0x2627e5,_0x528010[_0x5c1ef9(0x1c7)]),{'verbose':_0x4a5c88[_0x5c1ef9(0x143)]}),_0xb92fe0=_0x1de9cf[_0x5c1ef9(0x1fd)];if(!_0x4a5c88[_0x5c1ef9(0x1b2)]){const _0x281abe=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x528010[_0x5c1ef9(0x1c7)]+'\x22?');if(!_0x281abe)return console[_0x5c1ef9(0x209)](_0x5c1ef9(0x170)),0x0;}const _0x34bbea=await withSpinner(_0x5c1ef9(0x16d),()=>_0x4bf740[_0x5c1ef9(0x20c)][_0x5c1ef9(0x17f)](_0xb92fe0),{'verbose':_0x4a5c88[_0x5c1ef9(0x143)]}),_0x4e89df=_0x34bbea[_0x5c1ef9(0x1fd)];return console[_0x5c1ef9(0x209)](_0x5c1ef9(0x18c)+_0x4e89df[_0x5c1ef9(0x1a8)][_0x5c1ef9(0x215)]+_0x5c1ef9(0x1e1)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x158fc7(0x215)]=a18_0x158fc7(0x1da);['description']=a18_0x158fc7(0x1af);async['execute'](_0x2ca287){const _0x1b190f=a18_0x158fc7,{options:_0x2348ed,args:_0x4e1d2a,tdx:_0x73fdb1}=_0x2ca287,_0x233c42=_0x2348ed,_0x4a4eb2=_0x4e1d2a[0x0],_0x7cbc8a=_0x4a4eb2&&isYamlFilePath(_0x4a4eb2),_0x505069=await resolveTarget({'arg':_0x7cbc8a?_0x4a4eb2:undefined,'contextParent':_0x2348ed['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x505069))return _0x505069['errorCode']==='no_parent'?(console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x1e3)](_0x1b190f(0x20f))),console[_0x1b190f(0x209)](_0x1b190f(0x1c1)),console[_0x1b190f(0x209)](_0x1b190f(0x1f6)),console[_0x1b190f(0x209)](_0x1b190f(0x1f7)),console[_0x1b190f(0x209)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0x1b190f(0x209)](a18_0x57b90b['red']('Error:\x20'+_0x505069[_0x1b190f(0x161)]+'\x0a')),_0x505069['helpText']&&console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x171)](_0x505069[_0x1b190f(0x199)]))),0x1;let _0x9bb02e=_0x7cbc8a?undefined:_0x4a4eb2,_0x249242,_0x2dd9f3;_0x505069[_0x1b190f(0x1aa)]===_0x1b190f(0x154)&&(_0x9bb02e=_0x505069[_0x1b190f(0x150)],_0x249242=_0x505069['filePath'],_0x2dd9f3=_0x505069['folderPath']);const _0x13c2c0=_0x505069[_0x1b190f(0x188)],_0x3feaf2=_0x505069[_0x1b190f(0x144)];_0x233c42['verbose']&&(console['error'](_0x1b190f(0x211)+_0x13c2c0),console['error'](_0x1b190f(0x15d)+_0x3feaf2),_0x9bb02e&&console[_0x1b190f(0x209)](_0x1b190f(0x164)+_0x9bb02e),_0x249242&&console[_0x1b190f(0x209)](_0x1b190f(0x13f)+_0x249242),_0x2dd9f3&&console['error'](_0x1b190f(0x1de)+_0x2dd9f3));const _0x5ada18=await withSpinner(_0x1b190f(0x205),()=>_0x73fdb1[_0x1b190f(0x1d2)][_0x1b190f(0x1c5)](_0x13c2c0),{'verbose':_0x2348ed[_0x1b190f(0x143)]}),_0x104e2c=_0x5ada18[_0x1b190f(0x1fd)],[_0x126e22,_0x1b44e9]=await Promise[_0x1b190f(0x1f1)]([withSpinner(_0x1b190f(0x1c4),()=>_0x73fdb1[_0x1b190f(0x20c)][_0x1b190f(0x1ea)](_0x104e2c,undefined,{'includeAllVersions':!![]}),{'verbose':_0x2348ed['verbose']}),withSpinner(_0x1b190f(0x17b),()=>_0x73fdb1[_0x1b190f(0x1d2)][_0x1b190f(0x172)](_0x104e2c),{'verbose':_0x2348ed[_0x1b190f(0x143)]})]);let _0x46b776=_0x126e22[_0x1b190f(0x1fd)];const _0x37a702=_0x1b44e9['data'],_0x575deb=buildFolderIdToPathMap(_0x37a702);if(_0x9bb02e){const _0x5dbb90=_0x46b776['filter'](_0x16b23c=>_0x16b23c['journeyBundleName'][_0x1b190f(0x1c2)]()===_0x9bb02e[_0x1b190f(0x1c2)]());if(_0x5dbb90['length']===0x0)return console['error'](_0x1b190f(0x174)+_0x9bb02e),console[_0x1b190f(0x209)](_0x1b190f(0x1b3)),0x1;_0x46b776=_0x5dbb90;}if(_0x2dd9f3!==undefined){const _0x17d9da=_0x46b776['filter'](_0x3071c8=>{const _0x58aae7=_0x1b190f,_0x30ce7b=_0x3071c8[_0x58aae7(0x19e)]?_0x575deb[_0x58aae7(0x1e5)](_0x3071c8['folderId'])||'':'';return _0x30ce7b===_0x2dd9f3;});if(_0x17d9da[_0x1b190f(0x200)]===0x0&&_0x46b776[_0x1b190f(0x200)]>0x0){console[_0x1b190f(0x209)]('Error:\x20Journey\x20\x27'+_0x9bb02e+'\x27\x20not\x20found\x20in\x20'+(_0x2dd9f3||_0x1b190f(0x15e))),console['error'](_0x1b190f(0x194));for(const _0x2dd2ec of _0x46b776){const _0x35be27=_0x2dd2ec[_0x1b190f(0x19e)]?_0x575deb[_0x1b190f(0x1e5)](_0x2dd2ec[_0x1b190f(0x19e)])||'':'';console[_0x1b190f(0x209)](_0x1b190f(0x1c8)+(_0x35be27||_0x1b190f(0x1e0))+'/'+_0x2dd2ec['journeyBundleName']);}return 0x1;}_0x46b776=_0x17d9da;}if(_0x46b776[_0x1b190f(0x200)]===0x0)return console[_0x1b190f(0x209)](_0x1b190f(0x1ed)),0x0;const _0x43bca0=new Map();for(const _0x85b1f7 of _0x46b776){const _0x4a407c=_0x85b1f7[_0x1b190f(0x190)];!_0x43bca0[_0x1b190f(0x214)](_0x4a407c)&&_0x43bca0[_0x1b190f(0x19c)](_0x4a407c,[]),_0x43bca0['get'](_0x4a407c)[_0x1b190f(0x186)](_0x85b1f7);}for(const _0x15670a of _0x43bca0[_0x1b190f(0x1ba)]()){_0x15670a['sort']((_0x206fa7,_0x47460f)=>(_0x206fa7[_0x1b190f(0x208)]||0x0)-(_0x47460f[_0x1b190f(0x208)]||0x0));}const _0x2fffe0=[],[_0x3202a3,_0x1327f0]=await Promise[_0x1b190f(0x1f1)]([withSpinner(_0x1b190f(0x14a),()=>_0x73fdb1[_0x1b190f(0x195)][_0x1b190f(0x1d9)](),{'verbose':_0x2348ed['verbose']})[_0x1b190f(0x14c)](_0x5b610d=>_0x5b610d['data']),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x73fdb1[_0x1b190f(0x16a)][_0x1b190f(0x1fb)](),{'verbose':_0x2348ed['verbose']})[_0x1b190f(0x14c)](_0x47cca3=>_0x47cca3['data'])]);for(const _0x1c6f39 of _0x43bca0[_0x1b190f(0x1ba)]()){const _0x272362=_0x1c6f39[0x0][_0x1b190f(0x1bd)],_0x1530b5=_0x1c6f39[0x0][_0x1b190f(0x19e)],_0x4a184e=_0x1530b5?_0x575deb[_0x1b190f(0x1e5)](_0x1530b5)||'':'',_0x4f73d4=_0x4a184e?a18_0x10f775[_0x1b190f(0x147)](_0x3feaf2,_0x4a184e):_0x3feaf2,_0x304ea5=_0x249242||a18_0x10f775[_0x1b190f(0x147)](_0x4f73d4,sanitizeFileName(_0x272362)+'.yml');let _0x2e4d83,_0x1ac4ee;if(existsSync(_0x304ea5))try{const _0x4bd32c=readFileSync(_0x304ea5,_0x1b190f(0x189)),_0x3b9202=parseYamlString(_0x4bd32c);_0x1ac4ee=_0x3b9202,_0x2e4d83=buildRuleToNameMapping(_0x3b9202),_0x233c42[_0x1b190f(0x143)]&&_0x2e4d83[_0x1b190f(0x1f2)]>0x0&&console[_0x1b190f(0x209)](_0x1b190f(0x14d)+_0x2e4d83[_0x1b190f(0x1f2)]+_0x1b190f(0x1f9)+_0x272362);}catch(_0x245397){_0x233c42['verbose']&&console[_0x1b190f(0x209)](_0x1b190f(0x187)+_0x245397[_0x1b190f(0x161)]);}const _0x370c8d=[],_0x2e0588=new Set(),_0x47399f=new Map(),_0x1e4fec=new Map(),_0x3c14f9=new Set(),_0x4f7847=new Map(),_0x529409=new Map(),_0x11fa35=createJumpTargetCache();await withProgressSpinner(_0x1b190f(0x20b)+_0x272362+_0x1b190f(0x201),async _0x17b040=>{const _0x4f5766=_0x1b190f;for(const _0x2b4b00 of _0x1c6f39){const _0x49729f=_0x1c6f39[_0x4f5766(0x200)]>0x1?_0x2b4b00[_0x4f5766(0x1bd)]+'\x20v'+(_0x2b4b00[_0x4f5766(0x208)]||0x1):_0x2b4b00[_0x4f5766(0x1bd)];_0x17b040['setPhase'](_0x4f5766(0x20b)+_0x49729f);const _0x159f09=await _0x73fdb1[_0x4f5766(0x20c)][_0x4f5766(0x1a0)](_0x2b4b00['id']),_0x113754=_0x159f09[_0x4f5766(0x1a8)]?.['audienceId'],_0x1c2f35={'resolveSegment':async _0x1d53f3=>{const _0x2ea053=_0x4f5766;if(!_0x113754)return{'name':_0x1d53f3,'isJourneyLocal':![]};const _0x2a3401=_0x47399f[_0x2ea053(0x1e5)](_0x1d53f3);if(_0x2a3401)return _0x2a3401;try{const _0x4debb8=await _0x73fdb1[_0x2ea053(0x1d2)][_0x2ea053(0x156)](_0x113754,_0x1d53f3),_0x25b59=_0x4debb8[_0x2ea053(0x17c)]===SEGMENT_KIND_JOURNEY;let _0x61b2e2,_0x5a3941=_0x4debb8[_0x2ea053(0x215)];if(_0x25b59&&_0x4debb8[_0x2ea053(0x1eb)]){const _0xcabbb8=await segmentResponseToDef(_0x4debb8,{'resolveSegmentName':async _0x16910c=>{const _0x405d71=_0x2ea053,_0x18db1b=_0x47399f[_0x405d71(0x1e5)](_0x16910c);if(_0x18db1b)return _0x18db1b[_0x405d71(0x215)];const _0xba96d7=await _0x1c2f35[_0x405d71(0x1bc)](_0x16910c);return _0xba96d7[_0x405d71(0x215)];}}),_0x1b4f2c=_0xcabbb8[_0x2ea053(0x1eb)];_0x61b2e2={'description':_0x4debb8[_0x2ea053(0x19f)],'rule':_0x1b4f2c};const _0x2a7826=serializeRule(_0x1b4f2c),_0x336618=_0x1e4fec['get'](_0x2a7826);if(_0x336618)_0x5a3941=_0x336618,_0x61b2e2=undefined,_0x233c42[_0x2ea053(0x143)]&&console['error']('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x4debb8[_0x2ea053(0x215)]+_0x2ea053(0x1dd)+_0x336618);else{let _0x31cac9=![];if(_0x2e4d83){const _0x1220eb=_0x2e4d83[_0x2ea053(0x1e5)](_0x2a7826);if(_0x1220eb){const _0x324028=_0x1220eb[_0x2ea053(0x1ac)](_0x33d641=>!_0x2e0588[_0x2ea053(0x214)](_0x33d641));_0x324028&&(_0x5a3941=_0x324028,_0x2e0588[_0x2ea053(0x193)](_0x324028),_0x1e4fec[_0x2ea053(0x19c)](_0x2a7826,_0x324028),_0x31cac9=!![],_0x233c42[_0x2ea053(0x143)]&&console[_0x2ea053(0x209)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x324028+_0x2ea053(0x1ae)));}}if(!_0x31cac9){const _0x28aa22=generateJourneyLocalName(_0x4debb8[_0x2ea053(0x215)]);_0x28aa22&&(_0x5a3941=_0x28aa22);let _0x181fd7=_0x5a3941,_0x2a06b9=0x2;while(_0x2e0588[_0x2ea053(0x214)](_0x181fd7)){_0x181fd7=_0x5a3941+'_'+_0x2a06b9,_0x2a06b9++;}_0x2e0588[_0x2ea053(0x193)](_0x181fd7),_0x1e4fec[_0x2ea053(0x19c)](_0x2a7826,_0x181fd7),_0x5a3941=_0x181fd7;}}}const _0x534280={'name':_0x5a3941,'isJourneyLocal':_0x25b59,'definition':_0x61b2e2};return _0x47399f[_0x2ea053(0x19c)](_0x1d53f3,_0x534280),_0x534280;}catch(_0x5ba32f){return _0x2348ed[_0x2ea053(0x143)]&&console[_0x2ea053(0x209)](_0x2ea053(0x1db)+_0x1d53f3+':\x20'+_0x5ba32f[_0x2ea053(0x161)]),{'name':_0x1d53f3,'isJourneyLocal':![]};}},'resolveActivation':async _0x1bf54c=>{const _0x1b5a33=_0x4f5766,_0x227d06=_0x4f7847['get'](_0x1bf54c);if(_0x227d06)return _0x227d06;try{const _0x136027=await _0x73fdb1['journey']['getActivation'](_0x2b4b00['id'],_0x1bf54c),_0xc3a857=journeyActivationStepToYaml(_0x136027,_0x3202a3,_0x1327f0),_0x404fe1=JSON[_0x1b5a33(0x176)]({'name':_0xc3a857[_0x1b5a33(0x215)],'connection':_0xc3a857[_0x1b5a33(0x16a)],'connector_config':_0xc3a857[_0x1b5a33(0x155)]}),_0x14fa93=_0x529409['get'](_0x404fe1);if(_0x14fa93){const _0x170b80={'name':_0x14fa93,'isJourneyLocal':!![],'definition':_0xc3a857};return _0x4f7847[_0x1b5a33(0x19c)](_0x1bf54c,_0x170b80),_0x170b80;}const _0x1b904=_0x136027[_0x1b5a33(0x1a8)]['activationParams'][_0x1b5a33(0x215)]||_0x1bf54c,_0x25960b=sanitizeYamlKey(_0x1b904)||_0x1b5a33(0x1b1)+_0x1bf54c;let _0x349433=_0x25960b,_0x27a3e6=0x2;while(_0x3c14f9[_0x1b5a33(0x214)](_0x349433)){_0x349433=_0x25960b+'_'+_0x27a3e6,_0x27a3e6++;}_0x3c14f9[_0x1b5a33(0x193)](_0x349433),_0x529409['set'](_0x404fe1,_0x349433);const _0x190781={'name':_0x349433,'isJourneyLocal':!![],'definition':_0xc3a857};return _0x4f7847['set'](_0x1bf54c,_0x190781),_0x190781;}catch(_0x3b8e86){return _0x2348ed[_0x1b5a33(0x143)]&&console['error'](_0x1b5a33(0x202)+_0x1bf54c+':\x20'+_0x3b8e86[_0x1b5a33(0x161)]),{'name':_0x1bf54c,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x581d04,_0x4dc761)=>{return resolveJumpTarget(_0x581d04,_0x4dc761,_0x11fa35,_0x38023f=>_0x73fdb1['journey']['getJourney'](_0x38023f));}},_0x1f8b32=await journeyResponseToDef(_0x159f09,_0x1c2f35);_0x370c8d[_0x4f5766(0x186)]({'item':_0x2b4b00,'yaml':_0x1f8b32});}},{'verbose':_0x2348ed['verbose']});const _0x268a35=buildMergedJourneyDef(_0x370c8d,_0x2e4d83),_0x50fac4=normalizeJourneyDef(_0x268a35,_0x1ac4ee),_0xaf991b=toYamlString(_0x50fac4),_0x13ae4e=_0x249242||a18_0x10f775[_0x1b190f(0x147)](_0x4f73d4,sanitizeFileName(_0x272362)+_0x1b190f(0x212));!_0x249242&&_0x4a184e&&!existsSync(_0x4f73d4)&&mkdirSync(_0x4f73d4,{'recursive':!![]});const _0x39e4d3=a18_0x10f775['relative'](process[_0x1b190f(0x14b)](),_0x13ae4e);if(existsSync(_0x13ae4e)){const _0x1eb4cc=readFileSync(_0x13ae4e,'utf-8'),_0xc3ea32=generateDiff(_0x1eb4cc,_0xaf991b),_0xfcfb21=hasChanges(_0xc3ea32);_0x2fffe0[_0x1b190f(0x186)]({'relativePath':_0x39e4d3,'absolutePath':_0x13ae4e,'content':_0xaf991b,'isNew':![],'hasChanges':_0xfcfb21,'diff':_0xfcfb21?formatDiffWithColors(_0xc3ea32):undefined});}else _0x2fffe0[_0x1b190f(0x186)]({'relativePath':_0x39e4d3,'absolutePath':_0x13ae4e,'content':_0xaf991b,'isNew':!![],'hasChanges':![]});}const _0xfff23e=_0x2fffe0[_0x1b190f(0x145)](_0x4dc3f1=>_0x4dc3f1[_0x1b190f(0x177)]),_0x47d285=_0x2fffe0[_0x1b190f(0x145)](_0x3045e4=>!_0x3045e4[_0x1b190f(0x177)]&&_0x3045e4[_0x1b190f(0x191)]),_0x3c9605=_0x2fffe0[_0x1b190f(0x145)](_0x155d7f=>!_0x155d7f[_0x1b190f(0x177)]&&!_0x155d7f[_0x1b190f(0x191)]),_0x266e93=_0x46b776[_0x1b190f(0x200)],_0x45ac8a=_0x43bca0['size'],_0x1c8049=_0x266e93>_0x45ac8a?'\x20('+_0x266e93+'\x20versions)':'';console[_0x1b190f(0x209)](_0x1b190f(0x1a5)),console[_0x1b190f(0x209)]('\x20\x20'+a18_0x57b90b['cyan'](_0x45ac8a+'\x20journeys')+a18_0x57b90b[_0x1b190f(0x210)](_0x1c8049)),console[_0x1b190f(0x209)]('\x20\x20'+a18_0x57b90b['green']('+\x20'+_0xfff23e[_0x1b190f(0x200)]+_0x1b190f(0x1b6))),console[_0x1b190f(0x209)]('\x20\x20'+a18_0x57b90b[_0x1b190f(0x1e3)]('~\x20'+_0x47d285[_0x1b190f(0x200)]+_0x1b190f(0x173))),console[_0x1b190f(0x209)]('\x20\x20'+a18_0x57b90b[_0x1b190f(0x210)]('=\x20'+_0x3c9605[_0x1b190f(0x200)]+_0x1b190f(0x1cb))),console[_0x1b190f(0x209)](_0x1b190f(0x152)+a18_0x57b90b[_0x1b190f(0x171)](_0x3feaf2)+'\x0a');if(_0x47d285[_0x1b190f(0x200)]>0x0)for(const _0x4b7702 of _0x47d285){console[_0x1b190f(0x209)](_0x1b190f(0x1d5)+_0x4b7702['relativePath']+'\x27:'),console[_0x1b190f(0x209)]('─'[_0x1b190f(0x216)](0x3c)),console[_0x1b190f(0x209)](_0x4b7702['diff']),console['error']('─'[_0x1b190f(0x216)](0x3c));}if(_0x233c42[_0x1b190f(0x197)])return console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x1e3)](_0x1b190f(0x19d))),0x0;if(_0xfff23e[_0x1b190f(0x200)]===0x0&&_0x47d285[_0x1b190f(0x200)]===0x0)return console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x168)](_0x1b190f(0x16b))),saveSessionContext({'parent_segment':_0x13c2c0},_0x233c42[_0x1b190f(0x14f)]),console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x168)](_0x1b190f(0x1a3)+a18_0x57b90b[_0x1b190f(0x210)](_0x1b190f(0x1b9))+_0x1b190f(0x1a2)+a18_0x57b90b['cyan'](_0x13c2c0))),0x0;if(!_0x233c42[_0x1b190f(0x1b2)]&&(_0xfff23e[_0x1b190f(0x200)]>0x0||_0x47d285[_0x1b190f(0x200)]>0x0)){const _0x5d95c4=await confirmKey(_0x1b190f(0x1a1)+(_0xfff23e[_0x1b190f(0x200)]+_0x47d285[_0x1b190f(0x200)])+_0x1b190f(0x169));if(!_0x5d95c4)return console[_0x1b190f(0x209)](_0x1b190f(0x183)),0x1;}!existsSync(_0x3feaf2)&&mkdirSync(_0x3feaf2,{'recursive':!![]});for(const _0x186750 of _0x2fffe0){(_0x186750[_0x1b190f(0x177)]||_0x186750['hasChanges'])&&writeFileSync(_0x186750[_0x1b190f(0x181)],_0x186750[_0x1b190f(0x151)],_0x1b190f(0x189));}return console[_0x1b190f(0x209)](a18_0x57b90b['green']('✔\x20Pulled\x20'+(_0xfff23e[_0x1b190f(0x200)]+_0x47d285[_0x1b190f(0x200)])+_0x1b190f(0x1e7)+_0x3feaf2)),saveSessionContext({'parent_segment':_0x13c2c0},_0x233c42[_0x1b190f(0x14f)]),console[_0x1b190f(0x209)](a18_0x57b90b[_0x1b190f(0x168)](_0x1b190f(0x1a3)+a18_0x57b90b[_0x1b190f(0x210)]('parent_segment')+_0x1b190f(0x1a2)+a18_0x57b90b[_0x1b190f(0x171)](_0x13c2c0))),0x0;}}function a18_0x31ea(){const _0x259bcf=['test','log','localeCompare','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','toLowerCase','population','Listing\x20journeys...','resolveParentId','sort','journeyName','\x20\x20-\x20','Show\x20journey\x20statistics','Getting\x20journey\x20details...','\x20unchanged\x20files','Getting\x20journey\x20statistics...','148kTdWsv','5008KIpHFF','Pause\x20a\x20running\x20journey','Error:\x20Parent\x20segment\x20context\x20required','journey:list','segment','totalGoalAchieved','11457QUjqiJ','\x0aChanges\x20to\x20\x27','resolveJourneyId','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','(completed)','buildIdToEmailMap','journey:pull','Warning:\x20Could\x20not\x20resolve\x20segment\x20','state','\x20->\x20','Folder\x20path:\x20','stageName','(root)','\x22\x20resumed','No\x20statistics\x20available\x20for\x20journey:\x20','yellow','/app/ps/','get','options','\x20journey\x20files\x20to\x20','Resolved\x20YAML\x20file:\x20','totalEntered','listJourneysFromParentSegment','rule','\x20\x20Folder\x20path:\x20','No\x20journeys\x20found','/j/da/je','stage','replace','all','size','blue','List\x20journeys\x20in\x20current\x20context','goalRate','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','archived','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','exited','buildIdToNameMap','journey:stats','data','1056WlRpPy','segments','length','...','Warning:\x20Could\x20not\x20resolve\x20activation\x20','completed','36285LxeSQd','Resolving\x20parent\x20segment...','web','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','versionNumber','error','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Fetching\x20','journey','Show\x20journey\x20details','journeys','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','dim','Parent\x20segment:\x20','.yml','paused','has','name','repeat','Target\x20file:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','parentSegment','reentryMode','verbose','targetDir','filter','segmentPushCommand','join','(draft)','/e/','Fetching\x20users\x20for\x20email\x20resolution...','cwd','then','Found\x20','json','session','resourceName','content','\x20\x20Target:\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','file','connector_config','getSegment','rootFolderId','journeyStages','base','journey:push','🗺️\x20','20dCaGBw','Target\x20directory:\x20','root\x20folder','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','table','message','17579kCaPlC','journey:resume','Journey\x20name:\x20','\x20Opening\x20','map','\x5c$&','green','\x20files?','connection','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Name:\x20','Resuming\x20journey...','Resolving\x20journey...','entered','Cancelled','cyan','listFolders','\x20changed\x20files','Error:\x20Journey\x20not\x20found:\x20','Pausing\x20journey...','stringify','isNew','\x20\x20Statistics\x20not\x20available','journey:pause','split','Listing\x20folders...','kind','INVALID_ARGUMENT','listJourneysWithFolders','resume','journeyId','absolutePath','filePath','Aborted.','entries','includeStats','push','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','parentName','utf-8','25396SZsCXc','Usage:\x20journey\x20stats\x20<name-or-path>','✔\x20Journey\x20\x22','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','30755532GrZccS','format','journeyBundleId','hasChanges','Input:\x20','add','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','user','launched','dryRun','execute','helpText','3354010MOFCqE','Pattern:\x20','set','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','folderId','description','getJourney','Write\x20','\x20=\x20','✔\x20Context\x20set:\x20','getStatistics','\x0aPull\x20summary:','segmentName','stages','attributes','goal','type','Warning:\x20Stage\x20\x22','find','558600dyELuk','\x20(rule\x20match)','Export\x20journey(s)\x20as\x20YAML\x20files','Usage:\x20journey\x20pause\x20<name-or-path>','activation_','yes','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20(ID:\x20','site','\x20new\x20files','11fHtJXQ','(paused)','parent_segment','values','Usage:\x20journey\x20resume\x20<name-or-path>','resolveSegment','journeyBundleName'];a18_0x31ea=function(){return _0x259bcf;};return a18_0x31ea();}export class JourneyPushCommand extends BaseCommand{[a18_0x158fc7(0x215)]=a18_0x158fc7(0x15a);['description']=a18_0x158fc7(0x20a);[a18_0x158fc7(0x146)]=new SegmentPushCommand();async['execute'](_0x21a5ad){const _0x49060c=a18_0x158fc7,_0x31f774=_0x21a5ad['args'][0x0];let _0x532f80;if(_0x31f774){const _0x1a08c9=await resolveTarget({'arg':_0x31f774,'contextParent':_0x21a5ad[_0x49060c(0x1e6)][_0x49060c(0x141)],'cwd':process[_0x49060c(0x14b)]()});isSuccessfulResolution(_0x1a08c9)&&_0x1a08c9[_0x49060c(0x1aa)]===_0x49060c(0x154)&&(_0x532f80=_0x1a08c9[_0x49060c(0x182)]);}const _0x2d170f={..._0x21a5ad,'options':{..._0x21a5ad[_0x49060c(0x1e6)],'journeysOnly':!![],..._0x532f80&&{'singleFilePath':_0x532f80}}};return this['segmentPushCommand'][_0x49060c(0x198)](_0x2d170f);}}
|
|
1
|
+
const a18_0x258d28=a18_0x3261;(function(_0x38b350,_0x5889c6){const _0x5d55ef=a18_0x3261,_0x52e76d=_0x38b350();while(!![]){try{const _0x3bf5db=parseInt(_0x5d55ef(0x1e7))/0x1*(parseInt(_0x5d55ef(0x1d5))/0x2)+-parseInt(_0x5d55ef(0x1b0))/0x3+-parseInt(_0x5d55ef(0x1b2))/0x4*(parseInt(_0x5d55ef(0x1ea))/0x5)+parseInt(_0x5d55ef(0x20d))/0x6*(-parseInt(_0x5d55ef(0x1be))/0x7)+parseInt(_0x5d55ef(0x215))/0x8+-parseInt(_0x5d55ef(0x242))/0x9*(parseInt(_0x5d55ef(0x275))/0xa)+parseInt(_0x5d55ef(0x24a))/0xb;if(_0x3bf5db===_0x5889c6)break;else _0x52e76d['push'](_0x52e76d['shift']());}catch(_0x375c4d){_0x52e76d['push'](_0x52e76d['shift']());}}}(a18_0x2715,0xa7209));import a18_0x577901 from'chalk';import a18_0x1dbfac from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';function a18_0x2715(){const _0x34e0a2=['error','entries','dim','audienceId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','cyan','\x20journey','kind','log','filePath','buildIdToEmailMap','Journey\x20name:\x20','\x20\x20Parent\x20segment:\x20','Target\x20directory:\x20','\x20unchanged\x20files','Pausing\x20journey...','file','88467dszHuB','Resuming\x20journey...','folderId','1285EzHtVV','then','utf-8','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Options:','Error:\x20Journey\x20not\x20found:\x20','toLowerCase','Cancelled','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','isNew','folderPath','\x20\x20Folder\x20path:\x20','folders','parent_segment','\x20journey\x20files\x20to\x20','rootFolderId','red','verbose','(completed)','table','has','segmentPushCommand','hasChanges','yellow','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Listing\x20folders...','entered','Parent\x20segment:\x20','\x20Opening\x20','Listing\x20journeys...','Write\x20','\x20files?','repeat','message','resolveJourneyId','109518VmSolq','setPhase','✔\x20Found\x20','Warning:\x20Could\x20not\x20resolve\x20segment\x20','segmentName','No\x20statistics\x20available\x20for\x20journey:\x20','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','1585624lRibDv','stringify','relativePath','/j/da','\x20=\x20','Resolving\x20parent\x20segment...','journeyStages','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','set','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','targetDir','journeyBundleId','getJourney','type','user','yes','reentryMode','getStatistics','Resolved\x20YAML\x20file:\x20','journeyId','root\x20folder','format','Show\x20journey\x20details','\x0aChanges\x20to\x20\x27','absolutePath','name','dryRun','\x27\x20not\x20found\x20in\x20','getParentFull','📁\x20','\x20\x20Target:\x20','listFolders','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','execute','\x5c$&','journey:pause','Fetching\x20parent\x20segment...','state','attributes','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','rule','relative','Folder\x20path:\x20','resolveParentId','push','2807514WdjOLh','/e/','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','green','cwd','Input:\x20','listJourneysWithFolders','journey:resume','26219798bkAySg','(draft)','(root)','length','journeyBundleName','...','split','totalGoalAchieved','\x20->\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','site','\x22\x20resumed','parentName','\x22\x20not\x20found','listJourneysFromParentSegment','Warning:\x20Stage\x20\x22','size','journey:list','data','completed','\x20\x20Statistics\x20not\x20available','\x22\x20paused','Getting\x20journey\x20statistics...','/app/ps/','replace','journeys','Fetching\x20connections\x20for\x20name\x20resolution...','Resolving\x20journey...','exited','stage','get','Found\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','paused','goal','List\x20journeys\x20in\x20current\x20context','join','versionNumber','INVALID_ARGUMENT','✔\x20Context\x20set:\x20','stageName','(paused)','/j/da/je','40CRQzME','segment','stages','Error:\x20Parent\x20segment\x20context\x20required','population','find','activationParams','journey','filter','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','base','localeCompare','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Error:\x20','all','resume','journeyName','.yml','Usage:\x20journey\x20resume\x20<name-or-path>','Usage:\x20journey\x20stats\x20<name-or-path>','(archived)','2173602TmWAOa','Usage:\x20journey\x20pause\x20<name-or-path>','3620iStaXv','Fetching\x20','journey:pull','map','sort','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','✔\x20Journey\x20\x22','session','journey:stats','conversionRate','journey:push','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','357WsuBNi','web','\x20(ID:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Pattern:\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','blue','description','errorCode','connection','values','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','add','args','launched','activation_','\x20(rule\x20match)','resolveSegment','\x20\x20-\x20','Target\x20file:\x20','Resume\x20a\x20paused\x20journey','parentSegment','28cSAOSL'];a18_0x2715=function(){return _0x34e0a2;};return a18_0x2715();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a18_0x3261(_0x5bc662,_0x14cba7){_0x5bc662=_0x5bc662-0x1b0;const _0x271590=a18_0x2715();let _0x3261b1=_0x271590[_0x5bc662];return _0x3261b1;}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x4b3a39){const _0x385ca6=a18_0x3261;switch(_0x4b3a39){case _0x385ca6(0x1cd):return a18_0x577901[_0x385ca6(0x245)]('(running)');case'draft':return a18_0x577901['dim'](_0x385ca6(0x24b));case _0x385ca6(0x26b):return a18_0x577901[_0x385ca6(0x201)](_0x385ca6(0x273));case _0x385ca6(0x25d):return a18_0x577901[_0x385ca6(0x1c4)](_0x385ca6(0x1fc));case'archived':return a18_0x577901[_0x385ca6(0x1d8)](_0x385ca6(0x289));default:return'('+_0x4b3a39+')';}}function formatJourneyItem(_0x405909,_0x236839='',_0x13a94b){const _0x14ac5a=a18_0x3261,_0x5da3b7=formatJourneyState(_0x405909[_0x14ac5a(0x23a)]),_0x5a8d97=_0x13a94b?hyperlink(_0x405909[_0x14ac5a(0x24e)],_0x13a94b):_0x405909['journeyBundleName'];return _0x236839+'🗺️\x20'+_0x5a8d97+'\x20'+_0x5da3b7;}function escapeRegex(_0x1d18a5){const _0x1918bc=a18_0x3261;return _0x1d18a5[_0x1918bc(0x262)](/[.*+?^${}()|[\]\\]/g,_0x1918bc(0x237));}function globToRegex(_0x318b86){const _0x37f98e=a18_0x3261,_0x4bfb52=_0x318b86[_0x37f98e(0x250)]('*')['map'](escapeRegex);return new RegExp(_0x4bfb52['join']('.*'),'i');}function buildRuleToNameMapping(_0x239c21){const _0x476433=a18_0x3261,_0x22e3df=new Map();if(_0x239c21['segments'])for(const [_0x3b1386,_0x2b6bdf]of Object[_0x476433(0x1d7)](_0x239c21['segments'])){if(_0x2b6bdf['rule']){const _0x73d42a=serializeRule(_0x2b6bdf[_0x476433(0x23d)]),_0x412875=_0x22e3df['get'](_0x73d42a);_0x412875?_0x412875[_0x476433(0x241)](_0x3b1386):_0x22e3df[_0x476433(0x21d)](_0x73d42a,[_0x3b1386]);}}return _0x22e3df;}async function resolveJourneyTarget(_0x367aab,_0x1703a0,_0x17ef95){const _0x2c721d=a18_0x3261;if(isYamlFilePath(_0x367aab))try{const _0x44de79=await resolveYamlFilePath(_0x367aab);return _0x17ef95&&(console[_0x2c721d(0x1d6)](_0x2c721d(0x227)+_0x367aab),console['error'](_0x2c721d(0x1e2)+_0x44de79[_0x2c721d(0x1d4)]),console[_0x2c721d(0x1d6)]('\x20\x20Name:\x20'+_0x44de79[_0x2c721d(0x211)]),console[_0x2c721d(0x1d6)](_0x2c721d(0x1f5)+(_0x44de79[_0x2c721d(0x1f4)]||_0x2c721d(0x24c)))),{'journeyName':_0x44de79[_0x2c721d(0x211)],'parentSegment':_0x44de79[_0x2c721d(0x1d4)],'resolved':_0x44de79};}catch(_0x39f8c7){throw new SDKError(ErrorCode[_0x2c721d(0x270)],_0x2c721d(0x244)+_0x39f8c7[_0x2c721d(0x20b)]);}if(!_0x1703a0)throw new SDKError(ErrorCode[_0x2c721d(0x270)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x367aab,'parentSegment':_0x1703a0};}export class JourneyListCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x25b);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x26d);async['execute'](_0xd5945b){const _0x1622c8=a18_0x258d28,{options:_0x485aba,args:_0x52d0cd,tdx:_0x183acf}=_0xd5945b,_0x9a0ac7=_0x52d0cd[0x0],_0x46e7ad=_0x485aba['parentSegment'];if(!_0x46e7ad)return console['error'](_0x1622c8(0x278)),console[_0x1622c8(0x1d6)](_0x1622c8(0x281)),0x1;const _0x433e09=await withSpinner(_0x1622c8(0x21a),()=>_0x183acf[_0x1622c8(0x276)]['resolveParentId'](_0x46e7ad),{'verbose':_0x485aba['verbose']}),_0x663b06=_0x433e09[_0x1622c8(0x25c)];_0x485aba[_0x1622c8(0x1fb)]&&(console[_0x1622c8(0x1d6)](_0x1622c8(0x205)+_0x46e7ad+_0x1622c8(0x1c0)+_0x663b06+')'),_0x9a0ac7&&console[_0x1622c8(0x1d6)](_0x1622c8(0x1c2)+_0x9a0ac7));const _0x2d4c8f=await withSpinner(_0x1622c8(0x239),()=>_0x183acf[_0x1622c8(0x276)][_0x1622c8(0x231)](_0x663b06),{'verbose':_0x485aba[_0x1622c8(0x1fb)]}),_0x598444=_0x2d4c8f[_0x1622c8(0x25c)],_0x2d7adb=_0x598444[_0x1622c8(0x1f9)],_0x4f4d62=await withSpinner(_0x1622c8(0x207),()=>_0x183acf[_0x1622c8(0x27c)][_0x1622c8(0x248)](_0x663b06,_0x2d7adb),{'verbose':_0x485aba[_0x1622c8(0x1fb)]});let _0x4066dd=_0x4f4d62['data'][_0x1622c8(0x263)];const _0x2fcb87=_0x4f4d62[_0x1622c8(0x25c)][_0x1622c8(0x1f6)],_0x13037b=new Map();for(const _0x551965 of _0x2fcb87){_0x13037b[_0x1622c8(0x21d)](_0x551965['id'],_0x551965['name']);}if(_0x9a0ac7){const _0x4a21b2=globToRegex(_0x9a0ac7);_0x4066dd=_0x4066dd[_0x1622c8(0x27d)](_0x40c999=>_0x4a21b2['test'](_0x40c999[_0x1622c8(0x24e)]));}console['error'](_0x1622c8(0x20f)+_0x4066dd[_0x1622c8(0x24d)]+_0x1622c8(0x1dc)+(_0x4066dd[_0x1622c8(0x24d)]!==0x1?'s':''));const _0xcad308=_0x54e597=>{const _0x231d3b=_0x1622c8;return getConsoleNextUrl(_0x485aba['site'],_0x231d3b(0x261)+_0x663b06+_0x231d3b(0x243)+_0x54e597+_0x231d3b(0x218));};if(_0x485aba['format']===_0x1622c8(0x1fd))await handleSDKOutput(_0x4066dd,_0x485aba);else{if(_0x485aba[_0x1622c8(0x22a)]==='json'){const _0x19dfb9=_0x4066dd[_0x1622c8(0x1b5)](_0x1dac0d=>({..._0x1dac0d,'url':_0xcad308(_0x1dac0d['id'])}));await handleSDKOutput(_0x19dfb9,_0x485aba);}else{console[_0x1622c8(0x1de)]('['+_0x46e7ad+']');const _0x4a8864=new Map(),_0xc13529=[];for(const _0x1551ac of _0x4066dd){if(!_0x1551ac[_0x1622c8(0x1e9)]||_0x1551ac[_0x1622c8(0x1e9)]===_0x2d7adb)_0xc13529[_0x1622c8(0x241)](_0x1551ac);else{const _0x4472e7=_0x4a8864[_0x1622c8(0x268)](_0x1551ac[_0x1622c8(0x1e9)])||[];_0x4472e7[_0x1622c8(0x241)](_0x1551ac),_0x4a8864['set'](_0x1551ac['folderId'],_0x4472e7);}}const _0x1bf9cb=(_0x463181,_0x32cf8b)=>_0x463181[_0x1622c8(0x24e)][_0x1622c8(0x280)](_0x32cf8b[_0x1622c8(0x24e)],undefined,{'sensitivity':_0x1622c8(0x27f)});_0xc13529[_0x1622c8(0x1b6)](_0x1bf9cb);for(const _0x41deaf of _0xc13529){console['log'](formatJourneyItem(_0x41deaf,'',_0xcad308(_0x41deaf['id'])));}const _0x1aecbd=[..._0x4a8864[_0x1622c8(0x1d7)]()]['sort']((_0x4c1ce2,_0x812484)=>{const _0x1cc3e3=_0x1622c8,_0x42fab1=_0x13037b['get'](_0x4c1ce2[0x0])||_0x4c1ce2[0x0],_0x3883e1=_0x13037b['get'](_0x812484[0x0])||_0x812484[0x0];return _0x42fab1['localeCompare'](_0x3883e1,undefined,{'sensitivity':_0x1cc3e3(0x27f)});});for(const [_0x2e6d8a,_0x448618]of _0x1aecbd){const _0x46bf84=_0x13037b[_0x1622c8(0x268)](_0x2e6d8a)||_0x2e6d8a;console[_0x1622c8(0x1de)](_0x1622c8(0x232)+_0x46bf84),_0x448618[_0x1622c8(0x1b6)](_0x1bf9cb);for(const _0x5b3968 of _0x448618){console[_0x1622c8(0x1de)](formatJourneyItem(_0x5b3968,'\x20\x20',_0xcad308(_0x5b3968['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x258d28(0x22e)]='journey:view';[a18_0x258d28(0x1c5)]=a18_0x258d28(0x22b);async['execute'](_0x3b4d14){const _0x44aed0=a18_0x258d28,{options:_0x5f0a96,args:_0xc8ed6b,tdx:_0x44135d}=_0x3b4d14,_0x1a1641=_0xc8ed6b[0x0];if(!_0x1a1641)return console[_0x44aed0(0x1d6)](_0x44aed0(0x1c9)),console[_0x44aed0(0x1d6)](_0x44aed0(0x1f2)),console['error'](_0x44aed0(0x1ee)),console[_0x44aed0(0x1d6)](_0x44aed0(0x27e)),0x1;_0x5f0a96[_0x44aed0(0x1fb)]&&console[_0x44aed0(0x1d6)](_0x44aed0(0x247)+_0x1a1641);const _0xde1a98=await resolveJourneyTarget(_0x1a1641,_0x5f0a96[_0x44aed0(0x1d4)],_0x5f0a96[_0x44aed0(0x1fb)]),_0x7f8cc6=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x44135d[_0x44aed0(0x276)][_0x44aed0(0x240)](_0xde1a98[_0x44aed0(0x1d4)]),{'verbose':_0x5f0a96['verbose']}),_0x3bfdab=_0x7f8cc6['data'],_0x27efd3=await withSpinner(_0x44aed0(0x265),()=>_0x44135d['journey'][_0x44aed0(0x20c)](_0x3bfdab,_0xde1a98[_0x44aed0(0x285)]),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]}),_0x58a98b=_0x27efd3[_0x44aed0(0x25c)];if(_0x5f0a96[_0x44aed0(0x1bf)]){const _0x209104=getConsoleNextUrl(_0x5f0a96[_0x44aed0(0x254)],_0x44aed0(0x261)+_0x3bfdab+_0x44aed0(0x243)+_0x58a98b+'/j/da/je');return console['error'](a18_0x577901[_0x44aed0(0x245)]('✔')+_0x44aed0(0x206)+a18_0x577901[_0x44aed0(0x1db)](_0x209104)),openBrowser(_0x209104),0x0;}const _0x4cb8ba=await withSpinner('Getting\x20journey\x20details...',()=>_0x44135d['journey'][_0x44aed0(0x221)](_0x58a98b),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]}),_0x21b912=_0x4cb8ba[_0x44aed0(0x25c)],_0x800e23=_0x5f0a96['includeStats'];let _0x3c275f;if(_0x800e23)try{const _0x58704a=await withSpinner(_0x44aed0(0x260),()=>_0x44135d[_0x44aed0(0x27c)][_0x44aed0(0x226)](_0x58a98b),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]});_0x3c275f=_0x58704a[_0x44aed0(0x25c)];}catch{_0x5f0a96[_0x44aed0(0x1fb)]&&console[_0x44aed0(0x1d6)](_0x44aed0(0x25e));}const _0x18ffd3=getConsoleNextUrl(_0x5f0a96['site'],'/app/ps/'+_0x3bfdab+_0x44aed0(0x243)+_0x58a98b+_0x44aed0(0x274)),_0x4f80da={'id':_0x21b912['id'],'name':_0x21b912[_0x44aed0(0x23b)][_0x44aed0(0x22e)],'description':_0x21b912[_0x44aed0(0x23b)]['description'],'state':_0x21b912['attributes']['state'],'paused':_0x21b912['attributes'][_0x44aed0(0x26b)],'reentry_mode':_0x21b912['attributes'][_0x44aed0(0x225)],'stages':_0x21b912['attributes'][_0x44aed0(0x21b)]?.[_0x44aed0(0x24d)]||0x0,..._0x21b912[_0x44aed0(0x23b)][_0x44aed0(0x26c)]&&{'goal':_0x21b912['attributes'][_0x44aed0(0x26c)][_0x44aed0(0x22e)]},..._0x3c275f&&{'statistics':{'total_entered':_0x3c275f['totalEntered'],'goal_achieved':_0x3c275f[_0x44aed0(0x251)],'goal_rate':_0x3c275f['goalRate'],'stages':_0x3c275f[_0x44aed0(0x277)]}},'url':_0x18ffd3};return await handleSingleObjectOutput(_0x4f80da,_0x5f0a96),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1ba);[a18_0x258d28(0x1c5)]='Show\x20journey\x20statistics';async[a18_0x258d28(0x236)](_0x3002f9){const _0x2a6405=a18_0x258d28,{options:_0x181087,args:_0x5dbdbf,tdx:_0x58aaa2}=_0x3002f9,_0x1c049c=_0x5dbdbf[0x0];if(!_0x1c049c)return console[_0x2a6405(0x1d6)](_0x2a6405(0x1c9)),console['error'](_0x2a6405(0x288)),0x1;_0x181087['verbose']&&console[_0x2a6405(0x1d6)]('Input:\x20'+_0x1c049c);const _0x4992f8=await resolveJourneyTarget(_0x1c049c,_0x181087[_0x2a6405(0x1d4)],_0x181087[_0x2a6405(0x1fb)]),_0x3276e6=await withSpinner(_0x2a6405(0x21a),()=>_0x58aaa2[_0x2a6405(0x276)]['resolveParentId'](_0x4992f8[_0x2a6405(0x1d4)]),{'verbose':_0x181087[_0x2a6405(0x1fb)]}),_0x347973=_0x3276e6['data'],_0x14bd9c=await withSpinner(_0x2a6405(0x265),()=>_0x58aaa2[_0x2a6405(0x27c)][_0x2a6405(0x20c)](_0x347973,_0x4992f8[_0x2a6405(0x285)]),{'verbose':_0x181087['verbose']}),_0x2c32ce=_0x14bd9c[_0x2a6405(0x25c)],_0x20a0e0=await withSpinner(_0x2a6405(0x260),()=>_0x58aaa2[_0x2a6405(0x27c)][_0x2a6405(0x226)](_0x2c32ce),{'verbose':_0x181087['verbose']}),_0x1ffb3b=_0x20a0e0[_0x2a6405(0x25c)];if(!_0x1ffb3b||_0x1ffb3b[_0x2a6405(0x228)]===null)return console[_0x2a6405(0x1d6)](_0x2a6405(0x212)+_0x4992f8[_0x2a6405(0x285)]),console['error'](_0x2a6405(0x1ed)),0x0;const _0x15355={'journey_id':_0x1ffb3b[_0x2a6405(0x228)],'total_entered':_0x1ffb3b['totalEntered'],'goal_achieved':_0x1ffb3b[_0x2a6405(0x251)],'goal_rate':_0x1ffb3b['goalRate'],'stages':_0x1ffb3b[_0x2a6405(0x277)]?.[_0x2a6405(0x1b5)](_0x4d2e46=>({'name':_0x4d2e46['stageName'],'population':_0x4d2e46[_0x2a6405(0x279)],'entered':_0x4d2e46[_0x2a6405(0x204)],'exited':_0x4d2e46['exited'],'conversion_rate':_0x4d2e46['conversionRate']}))},_0x42299b=_0x181087[_0x2a6405(0x267)];if(_0x42299b&&_0x1ffb3b[_0x2a6405(0x277)]){const _0x51408f=_0x1ffb3b['stages']['find'](_0x57634d=>_0x57634d[_0x2a6405(0x272)][_0x2a6405(0x1f0)]()===_0x42299b[_0x2a6405(0x1f0)]());if(_0x51408f)return await handleSingleObjectOutput({'stage_name':_0x51408f[_0x2a6405(0x272)],'population':_0x51408f['population'],'entered':_0x51408f['entered'],'exited':_0x51408f[_0x2a6405(0x266)],'conversion_rate':_0x51408f[_0x2a6405(0x1bb)]},_0x181087),0x0;console['error'](_0x2a6405(0x259)+_0x42299b+_0x2a6405(0x257));}return await handleSingleObjectOutput(_0x15355,_0x181087),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a18_0x258d28(0x238);[a18_0x258d28(0x1c5)]='Pause\x20a\x20running\x20journey';async['execute'](_0x25c1ab){const _0x5105b0=a18_0x258d28,{options:_0x15c827,args:_0x52e098,tdx:_0x129311}=_0x25c1ab,_0x2010a0=_0x52e098[0x0];if(!_0x2010a0)return console[_0x5105b0(0x1d6)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x5105b0(0x1b1)),0x1;_0x15c827[_0x5105b0(0x1fb)]&&console[_0x5105b0(0x1d6)](_0x5105b0(0x247)+_0x2010a0);const _0x22a1e1=await resolveJourneyTarget(_0x2010a0,_0x15c827[_0x5105b0(0x1d4)],_0x15c827[_0x5105b0(0x1fb)]),_0x3c3216=await withSpinner(_0x5105b0(0x21a),()=>_0x129311[_0x5105b0(0x276)][_0x5105b0(0x240)](_0x22a1e1[_0x5105b0(0x1d4)]),{'verbose':_0x15c827['verbose']}),_0x3c8428=_0x3c3216['data'],_0x5d5738=await withSpinner('Resolving\x20journey...',()=>_0x129311['journey'][_0x5105b0(0x20c)](_0x3c8428,_0x22a1e1[_0x5105b0(0x285)]),{'verbose':_0x15c827[_0x5105b0(0x1fb)]}),_0x554f4f=_0x5d5738[_0x5105b0(0x25c)];if(!_0x15c827[_0x5105b0(0x224)]){const _0x18d0ba=await confirm(_0x5105b0(0x26a)+_0x22a1e1[_0x5105b0(0x285)]+'\x22?');if(!_0x18d0ba)return console[_0x5105b0(0x1d6)](_0x5105b0(0x1f1)),0x0;}const _0x1af58e=await withSpinner(_0x5105b0(0x1e5),()=>_0x129311[_0x5105b0(0x27c)]['pause'](_0x554f4f),{'verbose':_0x15c827[_0x5105b0(0x1fb)]}),_0x285633=_0x1af58e[_0x5105b0(0x25c)];return console[_0x5105b0(0x1d6)](_0x5105b0(0x1b8)+_0x285633[_0x5105b0(0x23b)][_0x5105b0(0x22e)]+_0x5105b0(0x25f)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x249);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x1d3);async['execute'](_0x49651c){const _0x123284=a18_0x258d28,{options:_0x1467a8,args:_0x3c7e27,tdx:_0x4066c5}=_0x49651c,_0x1b1d2a=_0x3c7e27[0x0];if(!_0x1b1d2a)return console['error'](_0x123284(0x1c9)),console[_0x123284(0x1d6)](_0x123284(0x287)),0x1;_0x1467a8['verbose']&&console[_0x123284(0x1d6)]('Input:\x20'+_0x1b1d2a);const _0x2673a6=await resolveJourneyTarget(_0x1b1d2a,_0x1467a8[_0x123284(0x1d4)],_0x1467a8[_0x123284(0x1fb)]),_0x3fdb19=await withSpinner(_0x123284(0x21a),()=>_0x4066c5[_0x123284(0x276)][_0x123284(0x240)](_0x2673a6[_0x123284(0x1d4)]),{'verbose':_0x1467a8[_0x123284(0x1fb)]}),_0x57802e=_0x3fdb19[_0x123284(0x25c)],_0x219e9b=await withSpinner('Resolving\x20journey...',()=>_0x4066c5[_0x123284(0x27c)][_0x123284(0x20c)](_0x57802e,_0x2673a6[_0x123284(0x285)]),{'verbose':_0x1467a8[_0x123284(0x1fb)]}),_0x6ba1c0=_0x219e9b[_0x123284(0x25c)];if(!_0x1467a8[_0x123284(0x224)]){const _0x33f75f=await confirm(_0x123284(0x23c)+_0x2673a6[_0x123284(0x285)]+'\x22?');if(!_0x33f75f)return console[_0x123284(0x1d6)](_0x123284(0x1f1)),0x0;}const _0x1f5d54=await withSpinner(_0x123284(0x1e8),()=>_0x4066c5[_0x123284(0x27c)][_0x123284(0x284)](_0x6ba1c0),{'verbose':_0x1467a8['verbose']}),_0x82f7a9=_0x1f5d54[_0x123284(0x25c)];return console[_0x123284(0x1d6)](_0x123284(0x1b8)+_0x82f7a9['attributes'][_0x123284(0x22e)]+_0x123284(0x255)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1b4);[a18_0x258d28(0x1c5)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0xc97b19){const _0x140758=a18_0x258d28,{options:_0x3535,args:_0xa8f570,tdx:_0x5f23ca}=_0xc97b19,_0x3a8060=_0x3535,_0x3638d0=_0xa8f570[0x0],_0x46d060=_0x3638d0&&isYamlFilePath(_0x3638d0),_0x9f6646=await resolveTarget({'arg':_0x46d060?_0x3638d0:undefined,'contextParent':_0x3535['parentSegment'],'cwd':process[_0x140758(0x246)]()});if(!isSuccessfulResolution(_0x9f6646))return _0x9f6646[_0x140758(0x1c6)]==='no_parent'?(console[_0x140758(0x1d6)](a18_0x577901['yellow'](_0x140758(0x1da))),console['error'](_0x140758(0x1ca)),console['error'](_0x140758(0x253)),console[_0x140758(0x1d6)](_0x140758(0x21c)),console[_0x140758(0x1d6)](_0x140758(0x1b7))):(console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x1fa)](_0x140758(0x282)+_0x9f6646[_0x140758(0x20b)]+'\x0a')),_0x9f6646['helpText']&&console['error'](a18_0x577901[_0x140758(0x1db)](_0x9f6646['helpText']))),0x1;let _0x453d55=_0x46d060?undefined:_0x3638d0,_0x5ce82a,_0xe3dacf;_0x9f6646[_0x140758(0x222)]==='file'&&(_0x453d55=_0x9f6646['resourceName'],_0x5ce82a=_0x9f6646[_0x140758(0x1df)],_0xe3dacf=_0x9f6646[_0x140758(0x1f4)]);const _0x23f8ce=_0x9f6646[_0x140758(0x256)],_0x45db93=_0x9f6646[_0x140758(0x21f)];_0x3a8060['verbose']&&(console[_0x140758(0x1d6)](_0x140758(0x205)+_0x23f8ce),console['error'](_0x140758(0x1e3)+_0x45db93),_0x453d55&&console[_0x140758(0x1d6)](_0x140758(0x1e1)+_0x453d55),_0x5ce82a&&console[_0x140758(0x1d6)](_0x140758(0x1d2)+_0x5ce82a),_0xe3dacf&&console[_0x140758(0x1d6)](_0x140758(0x23f)+_0xe3dacf));const _0x19c7ca=await withSpinner(_0x140758(0x21a),()=>_0x5f23ca[_0x140758(0x276)][_0x140758(0x240)](_0x23f8ce),{'verbose':_0x3535[_0x140758(0x1fb)]}),_0x5d78b2=_0x19c7ca[_0x140758(0x25c)],[_0x54a3b3,_0x129b62]=await Promise['all']([withSpinner(_0x140758(0x207),()=>_0x5f23ca[_0x140758(0x27c)][_0x140758(0x258)](_0x5d78b2,undefined,{'includeAllVersions':!![]}),{'verbose':_0x3535[_0x140758(0x1fb)]}),withSpinner(_0x140758(0x203),()=>_0x5f23ca[_0x140758(0x276)][_0x140758(0x234)](_0x5d78b2),{'verbose':_0x3535['verbose']})]);let _0x5f36e5=_0x54a3b3[_0x140758(0x25c)];const _0x2e3791=_0x129b62['data'],_0x25e1ad=buildFolderIdToPathMap(_0x2e3791);if(_0x453d55){const _0x5b1a26=_0x5f36e5[_0x140758(0x27d)](_0x1a92bd=>_0x1a92bd[_0x140758(0x24e)]['toLowerCase']()===_0x453d55[_0x140758(0x1f0)]());if(_0x5b1a26[_0x140758(0x24d)]===0x0)return console['error'](_0x140758(0x1ef)+_0x453d55),console[_0x140758(0x1d6)](_0x140758(0x1c3)),0x1;_0x5f36e5=_0x5b1a26;}if(_0xe3dacf!==undefined){const _0x1a04af=_0x5f36e5[_0x140758(0x27d)](_0x33b4ae=>{const _0x123308=_0x140758,_0x1649ab=_0x33b4ae[_0x123308(0x1e9)]?_0x25e1ad['get'](_0x33b4ae[_0x123308(0x1e9)])||'':'';return _0x1649ab===_0xe3dacf;});if(_0x1a04af[_0x140758(0x24d)]===0x0&&_0x5f36e5['length']>0x0){console[_0x140758(0x1d6)]('Error:\x20Journey\x20\x27'+_0x453d55+_0x140758(0x230)+(_0xe3dacf||_0x140758(0x229))),console[_0x140758(0x1d6)](_0x140758(0x214));for(const _0x326aaf of _0x5f36e5){const _0x7f9b03=_0x326aaf[_0x140758(0x1e9)]?_0x25e1ad[_0x140758(0x268)](_0x326aaf[_0x140758(0x1e9)])||'':'';console[_0x140758(0x1d6)](_0x140758(0x1d1)+(_0x7f9b03||_0x140758(0x24c))+'/'+_0x326aaf['journeyBundleName']);}return 0x1;}_0x5f36e5=_0x1a04af;}if(_0x5f36e5[_0x140758(0x24d)]===0x0)return console['error']('No\x20journeys\x20found'),0x0;const _0x2274f3=new Map();for(const _0x46c9e2 of _0x5f36e5){const _0x58c555=_0x46c9e2[_0x140758(0x220)];!_0x2274f3[_0x140758(0x1fe)](_0x58c555)&&_0x2274f3['set'](_0x58c555,[]),_0x2274f3[_0x140758(0x268)](_0x58c555)[_0x140758(0x241)](_0x46c9e2);}for(const _0x49dc6c of _0x2274f3[_0x140758(0x1c8)]()){_0x49dc6c[_0x140758(0x1b6)]((_0x4ea033,_0x28847d)=>(_0x4ea033[_0x140758(0x26f)]||0x0)-(_0x28847d[_0x140758(0x26f)]||0x0));}const _0x479564=[],[_0x4297dd,_0x30ecf0]=await Promise[_0x140758(0x283)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x5f23ca[_0x140758(0x223)][_0x140758(0x1e0)](),{'verbose':_0x3535[_0x140758(0x1fb)]})[_0x140758(0x1eb)](_0x5b864c=>_0x5b864c['data']),withSpinner(_0x140758(0x264),()=>_0x5f23ca[_0x140758(0x1c7)]['buildIdToNameMap'](),{'verbose':_0x3535[_0x140758(0x1fb)]})[_0x140758(0x1eb)](_0x2282f6=>_0x2282f6[_0x140758(0x25c)])]);for(const _0x4f8d06 of _0x2274f3['values']()){const _0x58eba9=_0x4f8d06[0x0][_0x140758(0x24e)],_0xff816d=_0x4f8d06[0x0][_0x140758(0x1e9)],_0x584776=_0xff816d?_0x25e1ad['get'](_0xff816d)||'':'',_0x593d62=_0x584776?a18_0x1dbfac['join'](_0x45db93,_0x584776):_0x45db93,_0x5658e4=_0x5ce82a||a18_0x1dbfac[_0x140758(0x26e)](_0x593d62,sanitizeFileName(_0x58eba9)+'.yml');let _0x35ce9e,_0x59de51;if(existsSync(_0x5658e4))try{const _0x2a8eaf=readFileSync(_0x5658e4,_0x140758(0x1ec)),_0x427407=parseYamlString(_0x2a8eaf);_0x59de51=_0x427407,_0x35ce9e=buildRuleToNameMapping(_0x427407),_0x3a8060[_0x140758(0x1fb)]&&_0x35ce9e['size']>0x0&&console[_0x140758(0x1d6)](_0x140758(0x269)+_0x35ce9e['size']+_0x140758(0x235)+_0x58eba9);}catch(_0x4d2a2b){_0x3a8060[_0x140758(0x1fb)]&&console[_0x140758(0x1d6)](_0x140758(0x202)+_0x4d2a2b[_0x140758(0x20b)]);}const _0xa4aa64=[],_0x10309c=new Set(),_0x3b31f4=new Map(),_0x2c4b55=new Map(),_0x2d916c=new Set(),_0x2ee692=new Map(),_0x135006=new Map(),_0x32b3ee=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0x58eba9+_0x140758(0x24f),async _0x1f56ed=>{const _0x49fed0=_0x140758;for(const _0xd3561e of _0x4f8d06){const _0x1feff0=_0x4f8d06['length']>0x1?_0xd3561e[_0x49fed0(0x24e)]+'\x20v'+(_0xd3561e[_0x49fed0(0x26f)]||0x1):_0xd3561e['journeyBundleName'];_0x1f56ed[_0x49fed0(0x20e)](_0x49fed0(0x1b3)+_0x1feff0);const _0x483ee3=await _0x5f23ca['journey'][_0x49fed0(0x221)](_0xd3561e['id']),_0x3b3abf=_0x483ee3[_0x49fed0(0x23b)]?.[_0x49fed0(0x1d9)],_0x6cda77={'resolveSegment':async _0x172029=>{const _0x13e369=_0x49fed0;if(!_0x3b3abf)return{'name':_0x172029,'isJourneyLocal':![]};const _0x3a08ce=_0x3b31f4[_0x13e369(0x268)](_0x172029);if(_0x3a08ce)return _0x3a08ce;try{const _0x549f5a=await _0x5f23ca[_0x13e369(0x276)]['getSegment'](_0x3b3abf,_0x172029),_0x464392=_0x549f5a[_0x13e369(0x1dd)]===SEGMENT_KIND_JOURNEY;let _0x149061,_0x184483=_0x549f5a['name'];if(_0x464392&&_0x549f5a['rule']){const _0x2ead81=await segmentResponseToDef(_0x549f5a,{'resolveSegmentName':async _0x56b280=>{const _0x1639a0=_0x13e369,_0x1b7793=_0x3b31f4[_0x1639a0(0x268)](_0x56b280);if(_0x1b7793)return _0x1b7793[_0x1639a0(0x22e)];const _0x2b7885=await _0x6cda77[_0x1639a0(0x1d0)](_0x56b280);return _0x2b7885['name'];}}),_0xd09290=_0x2ead81['rule'];_0x149061={'description':_0x549f5a[_0x13e369(0x1c5)],'rule':_0xd09290};const _0xfe0613=serializeRule(_0xd09290),_0x22aa04=_0x2c4b55[_0x13e369(0x268)](_0xfe0613);if(_0x22aa04)_0x184483=_0x22aa04,_0x149061=undefined,_0x3a8060['verbose']&&console[_0x13e369(0x1d6)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x549f5a[_0x13e369(0x22e)]+_0x13e369(0x252)+_0x22aa04);else{let _0x4619e1=![];if(_0x35ce9e){const _0x12152d=_0x35ce9e[_0x13e369(0x268)](_0xfe0613);if(_0x12152d){const _0x3cd7dd=_0x12152d[_0x13e369(0x27a)](_0x244a04=>!_0x10309c[_0x13e369(0x1fe)](_0x244a04));_0x3cd7dd&&(_0x184483=_0x3cd7dd,_0x10309c['add'](_0x3cd7dd),_0x2c4b55[_0x13e369(0x21d)](_0xfe0613,_0x3cd7dd),_0x4619e1=!![],_0x3a8060[_0x13e369(0x1fb)]&&console[_0x13e369(0x1d6)](_0x13e369(0x213)+_0x3cd7dd+_0x13e369(0x1cf)));}}if(!_0x4619e1){const _0x45fad2=generateJourneyLocalName(_0x549f5a['name']);_0x45fad2&&(_0x184483=_0x45fad2);let _0x5dadd3=_0x184483,_0xc3fa8b=0x2;while(_0x10309c[_0x13e369(0x1fe)](_0x5dadd3)){_0x5dadd3=_0x184483+'_'+_0xc3fa8b,_0xc3fa8b++;}_0x10309c['add'](_0x5dadd3),_0x2c4b55['set'](_0xfe0613,_0x5dadd3),_0x184483=_0x5dadd3;}}}const _0x3577c8={'name':_0x184483,'isJourneyLocal':_0x464392,'definition':_0x149061};return _0x3b31f4[_0x13e369(0x21d)](_0x172029,_0x3577c8),_0x3577c8;}catch(_0x565cda){return _0x3535[_0x13e369(0x1fb)]&&console['error'](_0x13e369(0x210)+_0x172029+':\x20'+_0x565cda['message']),{'name':_0x172029,'isJourneyLocal':![]};}},'resolveActivation':async _0x4d8a65=>{const _0x5498ef=_0x49fed0,_0x3558be=_0x2ee692[_0x5498ef(0x268)](_0x4d8a65);if(_0x3558be)return _0x3558be;try{const _0x43dd63=await _0x5f23ca[_0x5498ef(0x27c)]['getActivation'](_0xd3561e['id'],_0x4d8a65),_0x423ff9=journeyActivationStepToYaml(_0x43dd63,_0x4297dd,_0x30ecf0),_0x399f47=JSON[_0x5498ef(0x216)]({'name':_0x423ff9[_0x5498ef(0x22e)],'connection':_0x423ff9[_0x5498ef(0x1c7)],'connector_config':_0x423ff9['connector_config']}),_0x45fd9a=_0x135006['get'](_0x399f47);if(_0x45fd9a){const _0x31d561={'name':_0x45fd9a,'isJourneyLocal':!![],'definition':_0x423ff9};return _0x2ee692[_0x5498ef(0x21d)](_0x4d8a65,_0x31d561),_0x31d561;}const _0x33e733=_0x43dd63[_0x5498ef(0x23b)][_0x5498ef(0x27b)][_0x5498ef(0x22e)]||_0x4d8a65,_0x7b634=sanitizeYamlKey(_0x33e733)||_0x5498ef(0x1ce)+_0x4d8a65;let _0x568c71=_0x7b634,_0x33c2c2=0x2;while(_0x2d916c['has'](_0x568c71)){_0x568c71=_0x7b634+'_'+_0x33c2c2,_0x33c2c2++;}_0x2d916c[_0x5498ef(0x1cb)](_0x568c71),_0x135006[_0x5498ef(0x21d)](_0x399f47,_0x568c71);const _0x13ed15={'name':_0x568c71,'isJourneyLocal':!![],'definition':_0x423ff9};return _0x2ee692[_0x5498ef(0x21d)](_0x4d8a65,_0x13ed15),_0x13ed15;}catch(_0x573c06){return _0x3535['verbose']&&console[_0x5498ef(0x1d6)](_0x5498ef(0x1c1)+_0x4d8a65+':\x20'+_0x573c06[_0x5498ef(0x20b)]),{'name':_0x4d8a65,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x2957a3,_0x15bbe9)=>{const _0x26c27e=_0x49fed0;return resolveJumpTarget(_0x2957a3,_0x15bbe9,_0x32b3ee,_0x159786=>_0x5f23ca['journey'][_0x26c27e(0x221)](_0x159786));}},_0x310f28=await journeyResponseToDef(_0x483ee3,_0x6cda77);_0xa4aa64[_0x49fed0(0x241)]({'item':_0xd3561e,'yaml':_0x310f28});}},{'verbose':_0x3535['verbose']});const _0x2deec4=buildMergedJourneyDef(_0xa4aa64,_0x35ce9e),_0x2dfde8=normalizeJourneyDef(_0x2deec4,_0x59de51),_0x51e625=toYamlString(_0x2dfde8),_0x3bf20f=_0x5ce82a||a18_0x1dbfac[_0x140758(0x26e)](_0x593d62,sanitizeFileName(_0x58eba9)+_0x140758(0x286));!_0x5ce82a&&_0x584776&&!existsSync(_0x593d62)&&mkdirSync(_0x593d62,{'recursive':!![]});const _0x46a3c2=a18_0x1dbfac[_0x140758(0x23e)](process[_0x140758(0x246)](),_0x3bf20f);if(existsSync(_0x3bf20f)){const _0x58fbf8=readFileSync(_0x3bf20f,'utf-8'),_0x55d786=generateDiff(_0x58fbf8,_0x51e625),_0x59ee7e=hasChanges(_0x55d786);_0x479564[_0x140758(0x241)]({'relativePath':_0x46a3c2,'absolutePath':_0x3bf20f,'content':_0x51e625,'isNew':![],'hasChanges':_0x59ee7e,'diff':_0x59ee7e?formatDiffWithColors(_0x55d786):undefined});}else _0x479564[_0x140758(0x241)]({'relativePath':_0x46a3c2,'absolutePath':_0x3bf20f,'content':_0x51e625,'isNew':!![],'hasChanges':![]});}const _0x8ae9a5=_0x479564[_0x140758(0x27d)](_0x2c6763=>_0x2c6763[_0x140758(0x1f3)]),_0x34505a=_0x479564[_0x140758(0x27d)](_0x4304a1=>!_0x4304a1[_0x140758(0x1f3)]&&_0x4304a1[_0x140758(0x200)]),_0x14e2e9=_0x479564['filter'](_0x24904d=>!_0x24904d[_0x140758(0x1f3)]&&!_0x24904d['hasChanges']),_0x25f528=_0x5f36e5['length'],_0x3d20e5=_0x2274f3[_0x140758(0x25a)],_0x23aa4c=_0x25f528>_0x3d20e5?'\x20('+_0x25f528+'\x20versions)':'';console[_0x140758(0x1d6)]('\x0aPull\x20summary:'),console[_0x140758(0x1d6)]('\x20\x20'+a18_0x577901[_0x140758(0x1db)](_0x3d20e5+'\x20journeys')+a18_0x577901['dim'](_0x23aa4c)),console['error']('\x20\x20'+a18_0x577901['green']('+\x20'+_0x8ae9a5[_0x140758(0x24d)]+'\x20new\x20files')),console['error']('\x20\x20'+a18_0x577901[_0x140758(0x201)]('~\x20'+_0x34505a[_0x140758(0x24d)]+'\x20changed\x20files')),console[_0x140758(0x1d6)]('\x20\x20'+a18_0x577901['dim']('=\x20'+_0x14e2e9['length']+_0x140758(0x1e4))),console['error'](_0x140758(0x233)+a18_0x577901[_0x140758(0x1db)](_0x45db93)+'\x0a');if(_0x34505a[_0x140758(0x24d)]>0x0)for(const _0x3b9861 of _0x34505a){console[_0x140758(0x1d6)](_0x140758(0x22c)+_0x3b9861[_0x140758(0x217)]+'\x27:'),console[_0x140758(0x1d6)]('─'[_0x140758(0x20a)](0x3c)),console[_0x140758(0x1d6)](_0x3b9861['diff']),console['error']('─'['repeat'](0x3c));}if(_0x3a8060[_0x140758(0x22f)])return console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x201)](_0x140758(0x21e))),0x0;if(_0x8ae9a5[_0x140758(0x24d)]===0x0&&_0x34505a[_0x140758(0x24d)]===0x0)return console['error'](a18_0x577901[_0x140758(0x245)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x23f8ce},_0x3a8060[_0x140758(0x1b9)]),console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x245)]('✔\x20Context\x20set:\x20'+a18_0x577901[_0x140758(0x1d8)](_0x140758(0x1f7))+_0x140758(0x219)+a18_0x577901['cyan'](_0x23f8ce))),0x0;if(!_0x3a8060[_0x140758(0x224)]&&(_0x8ae9a5[_0x140758(0x24d)]>0x0||_0x34505a['length']>0x0)){const _0x2ddd54=await confirmKey(_0x140758(0x208)+(_0x8ae9a5[_0x140758(0x24d)]+_0x34505a['length'])+_0x140758(0x209));if(!_0x2ddd54)return console[_0x140758(0x1d6)]('Aborted.'),0x1;}!existsSync(_0x45db93)&&mkdirSync(_0x45db93,{'recursive':!![]});for(const _0x394cc4 of _0x479564){(_0x394cc4[_0x140758(0x1f3)]||_0x394cc4[_0x140758(0x200)])&&writeFileSync(_0x394cc4[_0x140758(0x22d)],_0x394cc4['content'],_0x140758(0x1ec));}return console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x245)]('✔\x20Pulled\x20'+(_0x8ae9a5[_0x140758(0x24d)]+_0x34505a[_0x140758(0x24d)])+_0x140758(0x1f8)+_0x45db93)),saveSessionContext({'parent_segment':_0x23f8ce},_0x3a8060['session']),console[_0x140758(0x1d6)](a18_0x577901['green'](_0x140758(0x271)+a18_0x577901['dim'](_0x140758(0x1f7))+_0x140758(0x219)+a18_0x577901[_0x140758(0x1db)](_0x23f8ce))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1bc);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x1bd);[a18_0x258d28(0x1ff)]=new SegmentPushCommand();async[a18_0x258d28(0x236)](_0x45b1b9){const _0x47e56e=a18_0x258d28,_0x2968a2=_0x45b1b9[_0x47e56e(0x1cc)][0x0];let _0x21609d;if(_0x2968a2){const _0x140957=await resolveTarget({'arg':_0x2968a2,'contextParent':_0x45b1b9['options']['parentSegment'],'cwd':process[_0x47e56e(0x246)]()});isSuccessfulResolution(_0x140957)&&_0x140957['type']===_0x47e56e(0x1e6)&&(_0x21609d=_0x140957['filePath']);}const _0x36ad5f={..._0x45b1b9,'options':{..._0x45b1b9['options'],'journeysOnly':!![],..._0x21609d&&{'singleFilePath':_0x21609d}}};return this[_0x47e56e(0x1ff)]['execute'](_0x36ad5f);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a19_0x408f64=a19_0x56ad;(function(_0x9bd6d,_0x3f73a6){const _0x27b498=a19_0x56ad,_0x5375e6=_0x9bd6d();while(!![]){try{const _0x48b765=parseInt(_0x27b498(0x147))/0x1+-parseInt(_0x27b498(0x146))/0x2+-parseInt(_0x27b498(0x16f))/0x3*(-parseInt(_0x27b498(0x163))/0x4)+parseInt(_0x27b498(0x14e))/0x5+-parseInt(_0x27b498(0x165))/0x6*(-parseInt(_0x27b498(0x14c))/0x7)+-parseInt(_0x27b498(0x16e))/0x8*(parseInt(_0x27b498(0x162))/0x9)+-parseInt(_0x27b498(0x164))/0xa*(parseInt(_0x27b498(0x15b))/0xb);if(_0x48b765===_0x3f73a6)break;else _0x5375e6['push'](_0x5375e6['shift']());}catch(_0x26f83b){_0x5375e6['push'](_0x5375e6['shift']());}}}(a19_0x4c99,0x6b78e));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a19_0x56ad(_0x4e0db8,_0xd94b8d){_0x4e0db8=_0x4e0db8-0x139;const _0x4c99a0=a19_0x4c99();let _0x56adb3=_0x4c99a0[_0x4e0db8];return _0x56adb3;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x1eb0db from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a19_0x4c99(){const _0x1edf7d=['No\x20journey\x20YAML\x20files\x20found\x20in\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','cyan','1084648kzpRdn','14990RwxvCN','no_parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','targetDir','yellow','231665iriKlb','skippedCount','722945GOzUXg','dim','\x20valid','invalidCount','\x20segment\x20file(s)\x20skipped','filter','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','\x20journey(s)\x20valid','errorCode','Error:\x20','\x20segment\x20file(s)\x20skipped)','red','error','671qNkWHe','.yml','endsWith','file','validCount','name','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','2151ldgEnp','230956brfFBk','71560ntsegZ','156rsYKXb','message','errors','.yaml','\x20warning(s)\x20found','length','Validate\x20journey\x20YAML\x20files','helpText','Error:\x20Directory\x20not\x20found:\x20','7904wfwlch','33raQmor','warnings','warningCount','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Validation\x20failed:\x20','\x20(skipped:\x20','log','filePath','description','relativePath','✔\x20All\x20','green','verbose'];a19_0x4c99=function(){return _0x1edf7d;};return a19_0x4c99();}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x408f64(0x160)]='journey:validate';[a19_0x408f64(0x13e)]=a19_0x408f64(0x16b);async['execute'](_0x252e7a){const _0x1f6602=a19_0x408f64,{options:_0x39b500,args:_0x53d348}=_0x252e7a,_0x41c46e=_0x39b500,_0x2ea445=await resolveTarget({'arg':_0x53d348[0x0],'contextParent':_0x39b500['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2ea445))return _0x2ea445[_0x1f6602(0x156)]===_0x1f6602(0x148)?(console[_0x1f6602(0x15a)](a19_0x1eb0db['yellow'](_0x1f6602(0x139))),console[_0x1f6602(0x15a)](_0x1f6602(0x154)),console['error'](_0x1f6602(0x149)),console[_0x1f6602(0x15a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x157)+_0x2ea445[_0x1f6602(0x166)]+'\x0a')),_0x2ea445[_0x1f6602(0x16c)]&&console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x145)](_0x2ea445[_0x1f6602(0x16c)]))),0x1;const _0x4fb9f7=_0x2ea445[_0x1f6602(0x14a)],_0xf2ab17=_0x2ea445['type']===_0x1f6602(0x15e)?_0x2ea445[_0x1f6602(0x13d)]:undefined;if(!_0xf2ab17&&!existsSync(_0x4fb9f7))return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x16d)+_0x4fb9f7+'\x0a')),0x1;let _0x5c8a9e;if(_0xf2ab17){if(!_0xf2ab17[_0x1f6602(0x15d)](_0x1f6602(0x15c))&&!_0xf2ab17[_0x1f6602(0x15d)](_0x1f6602(0x168)))return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x161)+_0xf2ab17+'\x0a')),0x1;_0x5c8a9e=[_0xf2ab17];}else _0x5c8a9e=findYamlFiles(_0x4fb9f7);if(_0x5c8a9e[_0x1f6602(0x16a)]===0x0)return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x144)+_0x4fb9f7+'\x0a')),0x1;const _0x15bdc1=validateYamlFiles(_0x5c8a9e,_0x4fb9f7,{'filterType':'journey'}),_0x675c8=calculateSummary(_0x15bdc1),_0x579330=_0x15bdc1[_0x1f6602(0x153)](isValidationResult);if(_0x579330[_0x1f6602(0x16a)]===0x0)return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x14b)](_0x1f6602(0x143)+_0x4fb9f7+'\x0a')),_0x675c8[_0x1f6602(0x14d)]>0x0&&console[_0x1f6602(0x15a)](a19_0x1eb0db['dim']('('+_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x158))),0x0;for(const _0x4d1192 of _0x15bdc1){if(!isValidationResult(_0x4d1192)){_0x41c46e[_0x1f6602(0x142)]&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14f)]('-\x20'+_0x4d1192[_0x1f6602(0x13f)]+_0x1f6602(0x13b)+_0x4d1192['reason']+')'));continue;}const {relativePath:_0x110c90,source:_0x53574e,result:_0xd633aa}=_0x4d1192;if(_0xd633aa['valid']&&_0xd633aa[_0x1f6602(0x170)][_0x1f6602(0x16a)]===0x0)_0x41c46e['verbose']&&console[_0x1f6602(0x13c)](a19_0x1eb0db['green']('✔\x20'+_0x110c90));else _0xd633aa['valid']?(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14b)]('⚠\x20'+_0x110c90+':\x20'+_0xd633aa['warnings'][_0x1f6602(0x16a)]+'\x20warning(s)')),console[_0x1f6602(0x13c)](formatValidationResult(_0xd633aa,_0x53574e,_0x110c90))):(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x159)]('✖\x20'+_0x110c90+':\x20'+_0xd633aa[_0x1f6602(0x167)]['length']+'\x20error(s)')),console[_0x1f6602(0x13c)](formatValidationResult(_0xd633aa,_0x53574e,_0x110c90)));}return console[_0x1f6602(0x13c)](''),_0x675c8['hasErrors']?(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x13a)+_0x675c8[_0x1f6602(0x151)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x675c8[_0x1f6602(0x15f)]+_0x1f6602(0x150))),_0x675c8[_0x1f6602(0x171)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14b)](_0x675c8[_0x1f6602(0x171)]+_0x1f6602(0x169))),_0x675c8[_0x1f6602(0x14d)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14f)](_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x152))),0x1):(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x141)](_0x1f6602(0x140)+_0x675c8[_0x1f6602(0x15f)]+_0x1f6602(0x155))),_0x675c8[_0x1f6602(0x171)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db['yellow'](_0x675c8['warningCount']+_0x1f6602(0x169))),_0x675c8[_0x1f6602(0x14d)]>0x0&&console['log'](a19_0x1eb0db[_0x1f6602(0x14f)](_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x152))),0x0);}}
|