@treasuredata/tdx 0.19.0 β 0.19.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/README.md +4 -8
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/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/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/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.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-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/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.d.ts.map +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js.map +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x911b91=a27_0x5175;(function(_0x537270,_0x54c3d6){const _0x663f1e=a27_0x5175,_0x1070c5=_0x537270();while(!![]){try{const _0x3e7901=-parseInt(_0x663f1e(0x183))/0x1+-parseInt(_0x663f1e(0x1c6))/0x2+parseInt(_0x663f1e(0x19b))/0x3+parseInt(_0x663f1e(0x1d3))/0x4+parseInt(_0x663f1e(0x1da))/0x5*(parseInt(_0x663f1e(0x185))/0x6)+-parseInt(_0x663f1e(0x1dd))/0x7+parseInt(_0x663f1e(0x1c9))/0x8;if(_0x3e7901===_0x54c3d6)break;else _0x1070c5['push'](_0x1070c5['shift']());}catch(_0x466e7e){_0x1070c5['push'](_0x1070c5['shift']());}}}(a27_0x448d,0xf2a90));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a27_0x5175(_0x1ae811,_0x11969d){_0x1ae811=_0x1ae811-0x168;const _0x448d50=a27_0x448d();let _0x5175c3=_0x448d50[_0x1ae811];return _0x5175c3;}import a27_0x3c6529 from'chalk';function formatRelativeTime(_0xb31403){const _0x15da56=a27_0x5175,_0x691d02=new Date(_0xb31403),_0x4fb4d9=new Date(),_0x4bcd3b=_0x691d02[_0x15da56(0x1b3)]()-_0x4fb4d9['getTime'](),_0x259888=Math['abs'](_0x4bcd3b)/0x3e8,_0x2d52ed=_0x4bcd3b<0x0;if(_0x259888<0x3c)return _0x2d52ed?_0x15da56(0x1ad):_0x15da56(0x1cd);else{if(_0x259888<0xe10){const _0x2f35dc=Math[_0x15da56(0x1b8)](_0x259888/0x3c);return _0x2d52ed?_0x2f35dc+_0x15da56(0x199):_0x15da56(0x186)+_0x2f35dc+'m';}else{if(_0x259888<0x15180){const _0x87fe86=Math[_0x15da56(0x1b8)](_0x259888/0xe10);return _0x2d52ed?_0x87fe86+_0x15da56(0x170):_0x15da56(0x186)+_0x87fe86+'h';}else{if(_0x259888<0x93a80){const _0x2cb9d1=Math['round'](_0x259888/0x15180);return _0x2d52ed?_0x2cb9d1+_0x15da56(0x1aa):'in\x20'+_0x2cb9d1+'d';}else return _0x691d02['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a27_0x911b91(0x1e6)]=a27_0x911b91(0x1d1);[a27_0x911b91(0x1e3)]='List\x20scheduled\x20queries';async['execute'](_0x5b563a){const _0x3bd01b=a27_0x911b91,{options:_0x41ec81,args:_0x4f6e47,tdx:_0x2d13f9}=_0x5b563a,_0x2fa275=resolveLimit(_0x41ec81[_0x3bd01b(0x1bd)],DEFAULT_DISPLAY_LIMIT),_0x21e7f1=_0x4f6e47[0x0],_0x446606=_0x21e7f1?_0x3bd01b(0x175)+_0x21e7f1+_0x3bd01b(0x1af):_0x3bd01b(0x1e1),_0x5d9904=await withSpinner(_0x446606,()=>_0x2d13f9[_0x3bd01b(0x190)][_0x3bd01b(0x1cc)]({'limit':_0x2fa275,'scheduled':!![],'pattern':_0x21e7f1}),{'verbose':_0x41ec81[_0x3bd01b(0x172)]}),_0x23bf8b=_0x5d9904[_0x3bd01b(0x1c8)][_0x3bd01b(0x1ea)],_0x50e368=_0x5d9904[_0x3bd01b(0x1c8)]['pagination'][_0x3bd01b(0x1a2)],_0x1799c2=_0x21e7f1?_0x3bd01b(0x1a5)+_0x21e7f1+'\x22':'';_0x50e368?console[_0x3bd01b(0x178)](_0x3bd01b(0x17c)+_0x23bf8b[_0x3bd01b(0x180)]+'\x20schedules'+_0x1799c2+_0x3bd01b(0x1a1)):console[_0x3bd01b(0x178)]('Found\x20'+_0x23bf8b['length']+'\x20scheduled\x20quer'+(_0x23bf8b[_0x3bd01b(0x180)]!==0x1?_0x3bd01b(0x1ce):'y')+_0x1799c2);if(_0x41ec81[_0x3bd01b(0x1cf)]===_0x3bd01b(0x181)||_0x41ec81[_0x3bd01b(0x1cf)]==='jsonl'||_0x41ec81[_0x3bd01b(0x1cf)]==='table'||_0x41ec81[_0x3bd01b(0x1cf)]==='tsv'){const _0x36913a=_0x23bf8b[_0x3bd01b(0x182)](_0x3a6f9f=>({'id':_0x3a6f9f['id'],'name':_0x3a6f9f['name'],'cron':_0x3a6f9f[_0x3bd01b(0x1e8)],'database':_0x3a6f9f[_0x3bd01b(0x1ef)]?.[_0x3bd01b(0x1e6)],'type':_0x3a6f9f[_0x3bd01b(0x177)],'timezone':_0x3a6f9f[_0x3bd01b(0x1d0)],'user_name':_0x3a6f9f[_0x3bd01b(0x1be)]?.[_0x3bd01b(0x1e6)],'updated_at':_0x3a6f9f['updated_at'],'next_run_at':_0x3a6f9f[_0x3bd01b(0x1b1)],'last_job_status':_0x3a6f9f['last_job']?.['status']}));await handleSDKOutput(_0x36913a,_0x41ec81);}else{if(_0x23bf8b[_0x3bd01b(0x180)]===0x0)console['log'](_0x3bd01b(0x16c));else{const _0x2eb501=_0x41ec81[_0x3bd01b(0x169)],_0x5a1dfb=_0x23bf8b[_0x3bd01b(0x182)](_0x19581c=>{const _0x31d583=_0x3bd01b,_0x4ebe4e=_0x19581c[_0x31d583(0x1c4)]?.[_0x31d583(0x1cb)]?_0x19581c['last_job'][_0x31d583(0x1cb)]===_0x31d583(0x1bc)?'β':'β':'-',_0x33e04e=_0x19581c['last_job']?.['ended_at']?formatRelativeTime(_0x19581c[_0x31d583(0x1c4)][_0x31d583(0x17d)]):_0x31d583(0x18e),_0x44469f=_0x19581c[_0x31d583(0x1b1)]?formatRelativeTime(_0x19581c[_0x31d583(0x1b1)]):'-',_0x2366d6=_0x19581c[_0x31d583(0x1e8)]||'',_0x884815=_0x19581c[_0x31d583(0x1e6)]||_0x31d583(0x1a7),_0x24d900=getConsoleUrl(_0x2eb501,_0x31d583(0x1ae)+_0x19581c['id']);return{'statusIcon':_0x4ebe4e,'lastRun':_0x33e04e,'nextRun':_0x44469f,'cron':_0x2366d6,'name':_0x884815,'queryUrl':_0x24d900,'status':_0x19581c[_0x31d583(0x1c4)]?.[_0x31d583(0x1cb)]};}),_0x3047c3=Math['max'](..._0x5a1dfb[_0x3bd01b(0x182)](_0x56f59c=>_0x56f59c['lastRun'][_0x3bd01b(0x180)])),_0x8f7dee=Math[_0x3bd01b(0x1c5)](..._0x5a1dfb[_0x3bd01b(0x182)](_0x51c388=>_0x51c388[_0x3bd01b(0x197)][_0x3bd01b(0x180)])),_0x4d72ce=Math[_0x3bd01b(0x1c5)](..._0x5a1dfb[_0x3bd01b(0x182)](_0x18f198=>_0x18f198[_0x3bd01b(0x1e8)][_0x3bd01b(0x180)])),_0xd5248e=_0x5a1dfb[_0x3bd01b(0x182)](_0x4d39c8=>{const _0x1a2655=_0x3bd01b,_0x792a99=_0x4d39c8[_0x1a2655(0x1cb)]===_0x1a2655(0x1bc)?a27_0x3c6529[_0x1a2655(0x1ca)](_0x4d39c8['statusIcon']):_0x4d39c8[_0x1a2655(0x1cb)]===_0x1a2655(0x178)?a27_0x3c6529[_0x1a2655(0x1de)](_0x4d39c8[_0x1a2655(0x1c7)]):a27_0x3c6529[_0x1a2655(0x198)](_0x4d39c8[_0x1a2655(0x1c7)]),_0x11bf2a=_0x4d39c8[_0x1a2655(0x1e4)][_0x1a2655(0x1c2)](_0x3047c3),_0x5377dc=_0x4d39c8['nextRun'][_0x1a2655(0x1c2)](_0x8f7dee),_0xba710e=_0x4d39c8['cron']?a27_0x3c6529[_0x1a2655(0x1df)](_0x4d39c8[_0x1a2655(0x1e8)][_0x1a2655(0x1c2)](_0x4d72ce)):'\x20'['repeat'](_0x4d72ce),_0x54ca80=hyperlink(_0x4d39c8[_0x1a2655(0x1e6)],_0x4d39c8[_0x1a2655(0x19d)]);return'π
\x20'+_0x792a99+'\x20'+_0x11bf2a+'\x20\x20β\x20'+_0x5377dc+'\x20\x20'+_0xba710e+'\x20\x20'+_0x54ca80;});await writeOutput(_0xd5248e[_0x3bd01b(0x1ed)]('\x0a'),_0x41ec81[_0x3bd01b(0x1a8)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a27_0x911b91(0x1e3)]=a27_0x911b91(0x1bf);[a27_0x911b91(0x18c)](_0x2fc91c){const _0x58edd3=_0x2fc91c['args'][0x0];if(!_0x58edd3)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x2d9441){const _0x452d20=a27_0x911b91,{options:_0x569fcf,args:_0x3b2b2e,tdx:_0x51e25f}=_0x2d9441,_0x339894=_0x3b2b2e[0x0],_0x454807=await withSpinner(_0x452d20(0x179),()=>_0x51e25f['schedules'][_0x452d20(0x193)](_0x339894),{'verbose':_0x569fcf[_0x452d20(0x172)]}),_0x285d6f=_0x454807['data'],_0x2352ff={'name':_0x285d6f[_0x452d20(0x1e6)],'cron':_0x285d6f[_0x452d20(0x1e8)],'database':_0x285d6f[_0x452d20(0x1ef)],'type':_0x285d6f['type'],'timezone':_0x285d6f[_0x452d20(0x1d9)],'user_name':_0x285d6f[_0x452d20(0x194)],'created_at':_0x285d6f[_0x452d20(0x192)],'engine_version':_0x285d6f['engine_version'],'executing_user_id':_0x285d6f[_0x452d20(0x1e2)],'query':_0x285d6f['query'],'delay':_0x285d6f[_0x452d20(0x1dc)],'priority':_0x285d6f['priority'],'retry_limit':_0x285d6f[_0x452d20(0x1d7)],..._0x285d6f['result']&&{'result':_0x285d6f[_0x452d20(0x168)]}};return await handleSingleObjectOutput(_0x2352ff,_0x569fcf),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a27_0x911b91(0x1e6)]='schedule:create';[a27_0x911b91(0x1e3)]=a27_0x911b91(0x1d4);[a27_0x911b91(0x18c)](_0x11e449){const _0x51db68=a27_0x911b91,_0x168e1b=_0x11e449[_0x51db68(0x16b)][0x0];if(!_0x168e1b)return _0x51db68(0x176);return undefined;}async[a27_0x911b91(0x16d)](_0x22aff9){const _0x3c60ea=a27_0x911b91,{options:_0x554ac8,args:_0x29a681,tdx:_0xecd646}=_0x22aff9,_0x50fbf2=_0x29a681[0x0],_0x2bf97d=_0x554ac8,_0xf37e84=_0x2bf97d[_0x3c60ea(0x1ef)],_0x536b06=_0x2bf97d['file'],_0x54d8df=_0x2bf97d[_0x3c60ea(0x177)]||_0x3c60ea(0x1ba);let _0x3878db;try{_0x3878db=readFileSync(_0x536b06,_0x3c60ea(0x1b5))[_0x3c60ea(0x1c0)]();}catch(_0xd23fad){throw new SDKError(ErrorCode[_0x3c60ea(0x1c3)],_0x3c60ea(0x1b7)+_0x536b06,_0xd23fad instanceof Error?_0xd23fad:undefined);}if(!_0x3878db)throw new SDKError(ErrorCode[_0x3c60ea(0x1c3)],_0x3c60ea(0x1d5));const _0x524354={'database':_0xf37e84,'query':_0x3878db,'type':_0x54d8df};if(_0x2bf97d[_0x3c60ea(0x1e8)])_0x524354['cron']=_0x2bf97d[_0x3c60ea(0x1e8)];if(_0x2bf97d[_0x3c60ea(0x1d9)])_0x524354['timezone']=_0x2bf97d['timezone'];if(_0x2bf97d['delay']!==undefined)_0x524354[_0x3c60ea(0x1dc)]=Number(_0x2bf97d[_0x3c60ea(0x1dc)]);if(_0x2bf97d['priority']!==undefined)_0x524354[_0x3c60ea(0x1e0)]=Number(_0x2bf97d[_0x3c60ea(0x1e0)]);if(_0x2bf97d[_0x3c60ea(0x18a)]!==undefined)_0x524354[_0x3c60ea(0x1d7)]=Number(_0x2bf97d[_0x3c60ea(0x18a)]);if(_0x2bf97d[_0x3c60ea(0x19c)])_0x524354[_0x3c60ea(0x189)]=_0x2bf97d[_0x3c60ea(0x19c)];if(_0x2bf97d[_0x3c60ea(0x168)])_0x524354[_0x3c60ea(0x168)]=_0x2bf97d[_0x3c60ea(0x168)];if(_0x554ac8[_0x3c60ea(0x172)]){console[_0x3c60ea(0x178)]('Creating\x20schedule:\x20'+_0x50fbf2),console[_0x3c60ea(0x178)](_0x3c60ea(0x173)+_0xf37e84),console[_0x3c60ea(0x178)](_0x3c60ea(0x1d6)+_0x54d8df);if(_0x524354[_0x3c60ea(0x1e8)])console[_0x3c60ea(0x178)]('\x20\x20Cron:\x20'+_0x524354[_0x3c60ea(0x1e8)]);if(_0x524354[_0x3c60ea(0x1d9)])console[_0x3c60ea(0x178)](_0x3c60ea(0x191)+_0x524354['timezone']);}const _0x30b471=await withSpinner('Creating\x20schedule...',()=>_0xecd646[_0x3c60ea(0x190)]['create'](_0x50fbf2,_0x524354),{'verbose':_0x554ac8[_0x3c60ea(0x172)]});return console[_0x3c60ea(0x178)]('Schedule\x20created:\x20'+_0x30b471[_0x3c60ea(0x1c8)][_0x3c60ea(0x1e6)]),await handleSingleObjectOutput(_0x30b471[_0x3c60ea(0x1c8)],_0x554ac8),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x911b91(0x1e6)]=a27_0x911b91(0x1e5);['description']=a27_0x911b91(0x17b);['validate'](_0x1f6900){const _0x3094ac=a27_0x911b91,_0x2a5c08=_0x1f6900[_0x3094ac(0x16b)][0x0];if(!_0x2a5c08)return _0x3094ac(0x16e);return undefined;}async[a27_0x911b91(0x16d)](_0x195560){const _0x92ed56=a27_0x911b91,{options:_0x86d996,args:_0x46c03b,tdx:_0x8482d4}=_0x195560,_0x5483e5=_0x46c03b[0x0],_0x532be4=_0x86d996,_0x982980={};if(_0x532be4[_0x92ed56(0x1ef)])_0x982980[_0x92ed56(0x1ef)]=_0x532be4[_0x92ed56(0x1ef)];if(_0x532be4[_0x92ed56(0x177)])_0x982980['type']=_0x532be4[_0x92ed56(0x177)];if(_0x532be4[_0x92ed56(0x1e8)])_0x982980['cron']=_0x532be4[_0x92ed56(0x1e8)];if(_0x532be4[_0x92ed56(0x1d9)])_0x982980[_0x92ed56(0x1d9)]=_0x532be4[_0x92ed56(0x1d9)];if(_0x532be4['delay']!==undefined)_0x982980['delay']=Number(_0x532be4['delay']);if(_0x532be4[_0x92ed56(0x1e0)]!==undefined)_0x982980[_0x92ed56(0x1e0)]=Number(_0x532be4[_0x92ed56(0x1e0)]);if(_0x532be4[_0x92ed56(0x18a)]!==undefined)_0x982980[_0x92ed56(0x1d7)]=Number(_0x532be4[_0x92ed56(0x18a)]);if(_0x532be4[_0x92ed56(0x19c)])_0x982980[_0x92ed56(0x189)]=_0x532be4[_0x92ed56(0x19c)];if(_0x532be4['result'])_0x982980[_0x92ed56(0x168)]=_0x532be4['result'];if(_0x532be4[_0x92ed56(0x1a6)])try{_0x982980[_0x92ed56(0x1ee)]=readFileSync(_0x532be4[_0x92ed56(0x1a6)],_0x92ed56(0x1b5))['trim']();}catch(_0x50d4dc){throw new SDKError(ErrorCode[_0x92ed56(0x1c3)],_0x92ed56(0x1b7)+_0x532be4[_0x92ed56(0x1a6)],_0x50d4dc instanceof Error?_0x50d4dc:undefined);}if(Object[_0x92ed56(0x19a)](_0x982980)[_0x92ed56(0x180)]===0x0)throw new SDKError(ErrorCode[_0x92ed56(0x1c3)],_0x92ed56(0x184));if(_0x86d996['verbose']){console[_0x92ed56(0x178)]('Updating\x20schedule:\x20'+_0x5483e5);for(const [_0x5ea400,_0x5839b8]of Object[_0x92ed56(0x1c1)](_0x982980)){_0x5ea400===_0x92ed56(0x1ee)?console[_0x92ed56(0x178)]('\x20\x20'+_0x5ea400+':\x20'+_0x5839b8[_0x92ed56(0x1b6)](0x0,0x32)+_0x92ed56(0x16f)):console[_0x92ed56(0x178)]('\x20\x20'+_0x5ea400+':\x20'+_0x5839b8);}}const _0x32f598=await withSpinner(_0x92ed56(0x17e),()=>_0x8482d4[_0x92ed56(0x190)][_0x92ed56(0x16a)](_0x5483e5,_0x982980),{'verbose':_0x86d996[_0x92ed56(0x172)]});return console['error'](_0x92ed56(0x1e7)+_0x32f598[_0x92ed56(0x1c8)][_0x92ed56(0x1e6)]),await handleSingleObjectOutput(_0x32f598[_0x92ed56(0x1c8)],_0x86d996),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a27_0x911b91(0x1e6)]=a27_0x911b91(0x171);['description']=a27_0x911b91(0x1a4);[a27_0x911b91(0x18c)](_0x7173c9){const _0x4c9455=a27_0x911b91,_0x202b33=_0x7173c9[_0x4c9455(0x16b)][0x0];if(!_0x202b33)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a27_0x911b91(0x16d)](_0xf54b3e){const _0x111589=a27_0x911b91,{options:_0x13c16d,args:_0x1dadce,tdx:_0x5b0d19}=_0xf54b3e,_0x1a5a5f=_0x1dadce[0x0];if(!_0x13c16d[_0x111589(0x187)]){const _0x559b96=await confirm(_0x111589(0x18f)+_0x1a5a5f+'\x22?');if(!_0x559b96)return console[_0x111589(0x178)](_0x111589(0x17f)),0x0;}const _0x113232=await withSpinner(_0x111589(0x1b9),()=>_0x5b0d19[_0x111589(0x190)][_0x111589(0x18d)](_0x1a5a5f),{'verbose':_0x13c16d['verbose']});return console[_0x111589(0x178)](_0x111589(0x1ab)+_0x113232[_0x111589(0x1c8)][_0x111589(0x1e6)]),0x0;}}function a27_0x448d(){const _0x39632d=['Listing\x20scheduled\x20queries...','executing_user_id','description','lastRun','schedule:update','name','Schedule\x20updated:\x20','cron','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','queries','jobs','end_at','join','query','database','result','site','update','args','No\x20scheduled\x20queries\x20found','execute','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','...','h\x20ago','schedule:delete','verbose','\x20\x20Database:\x20','\x20\x20Num:\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','type','error','Getting\x20schedule\x20details...','Found\x20','Update\x20a\x20scheduled\x20query','Showing\x20first\x20','ended_at','Updating\x20schedule...','Cancelled','length','json','map','1259215VuHZoW','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','2334924mRGGpW','in\x20','yes','start_at','engine_version','retryLimit','Getting\x20schedule\x20history...','validate','delete','never','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedules','\x20\x20Timezone:\x20','created_at','show','user_name','scheduled_at','\x20\x20Job\x20ID:\x20','nextRun','dim','m\x20ago','keys','5785248BvBahO','engineVersion','queryUrl','schedule:history','\x20created','from','\x20(use\x20--limit\x20to\x20see\x20more)','has_next_page','num','Delete\x20a\x20scheduled\x20query','\x20matching\x20\x22','file','(unnamed)','output','Show\x20schedule\x20execution\x20history','d\x20ago','Schedule\x20deleted:\x20','schedule:run','just\x20now','/app/queries/editor?queryId=','\x22...','job_id','next_run_at','Run\x20a\x20scheduled\x20query\x20immediately','getTime','\x20(showing\x20','utf-8','substring','Failed\x20to\x20read\x20file:\x20','round','Deleting\x20schedule...','trino','time','success','limit','user','Show\x20schedule\x20details','trim','entries','padEnd','INVALID_ARGUMENT','last_job','max','1905982LfxerN','statusIcon','data','2824952Dpjivc','green','status','listQueries','soon','ies','format','time_zone','schedule:list','history','5014864mBXEqh','Create\x20a\x20scheduled\x20query','Query\x20file\x20is\x20empty','\x20\x20Type:\x20','retry_limit','\x20job','timezone','15xftHzZ','\x20\x20Time:\x20','delay','10475997TgWeEs','red','cyan','priority'];a27_0x448d=function(){return _0x39632d;};return a27_0x448d();}export class ScheduleRunCommand extends BaseCommand{[a27_0x911b91(0x1e6)]=a27_0x911b91(0x1ac);[a27_0x911b91(0x1e3)]=a27_0x911b91(0x1b2);[a27_0x911b91(0x18c)](_0x12355e){const _0x7de76=a27_0x911b91,_0x4ed84b=_0x12355e['args'][0x0];if(!_0x4ed84b)return _0x7de76(0x1e9);return undefined;}async['execute'](_0x54f453){const _0x1db41d=a27_0x911b91,{options:_0x2d345b,args:_0x4df069,tdx:_0x2d89c5}=_0x54f453,_0x4b5fc2=_0x4df069[0x0],_0x47551f=_0x2d345b,_0x3991c6=_0x47551f[_0x1db41d(0x1bb)],_0x4d8e07=_0x47551f[_0x1db41d(0x1a3)]!==undefined?Number(_0x47551f[_0x1db41d(0x1a3)]):undefined;if(_0x2d345b[_0x1db41d(0x172)]){console[_0x1db41d(0x178)]('Running\x20schedule:\x20'+_0x4b5fc2);if(_0x3991c6)console[_0x1db41d(0x178)](_0x1db41d(0x1db)+_0x3991c6);if(_0x4d8e07)console[_0x1db41d(0x178)](_0x1db41d(0x174)+_0x4d8e07);}const _0x31f5b2=await withSpinner('Running\x20schedule...',()=>_0x2d89c5[_0x1db41d(0x190)]['run'](_0x4b5fc2,{'time':_0x3991c6,'num':_0x4d8e07}),{'verbose':_0x2d345b[_0x1db41d(0x172)]}),_0x37a1c9=_0x31f5b2['data'][_0x1db41d(0x1eb)];console['error']('Schedule\x20run\x20submitted:\x20'+_0x37a1c9[_0x1db41d(0x180)]+_0x1db41d(0x1d8)+(_0x37a1c9[_0x1db41d(0x180)]!==0x1?'s':'')+_0x1db41d(0x19f));for(const _0x1e68f3 of _0x37a1c9){console[_0x1db41d(0x178)](_0x1db41d(0x196)+_0x1e68f3[_0x1db41d(0x1b0)]);}return await handleSDKOutput(_0x37a1c9,_0x2d345b),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a27_0x911b91(0x1e6)]=a27_0x911b91(0x19e);['description']=a27_0x911b91(0x1a9);['validate'](_0x4b9877){const _0x391699=_0x4b9877['args'][0x0];if(!_0x391699)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a27_0x911b91(0x16d)](_0x673660){const _0x12f8d9=a27_0x911b91,{options:_0x58f2f9,args:_0x17a45b,tdx:_0x316154}=_0x673660,_0x7a96fa=_0x17a45b[0x0],_0x56d816=_0x58f2f9,_0x3701b6=_0x56d816[_0x12f8d9(0x1a0)]!==undefined?Number(_0x56d816['from']):undefined,_0x35cb27=_0x56d816['to']!==undefined?Number(_0x56d816['to']):undefined,_0x292383=await withSpinner(_0x12f8d9(0x18b),()=>_0x316154[_0x12f8d9(0x190)]['history'](_0x7a96fa,{'from':_0x3701b6,'to':_0x35cb27}),{'verbose':_0x58f2f9[_0x12f8d9(0x172)]}),_0xfae565=_0x292383[_0x12f8d9(0x1c8)];console[_0x12f8d9(0x178)](_0x12f8d9(0x17a)+_0xfae565['count']+'\x20execution'+(_0xfae565['count']!==0x1?'s':'')+_0x12f8d9(0x1b4)+_0xfae565[_0x12f8d9(0x1a0)]+'-'+_0xfae565['to']+')');const _0x2e4077=_0xfae565[_0x12f8d9(0x1d2)]['map'](_0x255f0b=>({'job_id':_0x255f0b['job_id'],'type':_0x255f0b[_0x12f8d9(0x177)],'status':_0x255f0b['status'],'scheduled_at':_0x255f0b[_0x12f8d9(0x195)],'created_at':_0x255f0b['created_at'],'start_at':_0x255f0b[_0x12f8d9(0x188)],'end_at':_0x255f0b[_0x12f8d9(0x1ec)]}));return await handleSDKOutput(_0x2e4077,_0x58f2f9),0x0;}}
|
|
1
|
+
const a27_0x5d80d7=a27_0x28cd;(function(_0x2b743e,_0x176fa2){const _0xf1ce80=a27_0x28cd,_0x2d2c1f=_0x2b743e();while(!![]){try{const _0x3a69da=-parseInt(_0xf1ce80(0xc7))/0x1+-parseInt(_0xf1ce80(0xb3))/0x2*(-parseInt(_0xf1ce80(0xb9))/0x3)+-parseInt(_0xf1ce80(0x10d))/0x4*(-parseInt(_0xf1ce80(0xf9))/0x5)+parseInt(_0xf1ce80(0x10c))/0x6*(-parseInt(_0xf1ce80(0xcf))/0x7)+parseInt(_0xf1ce80(0xe1))/0x8+parseInt(_0xf1ce80(0xc6))/0x9*(parseInt(_0xf1ce80(0xd3))/0xa)+-parseInt(_0xf1ce80(0xf6))/0xb*(parseInt(_0xf1ce80(0xf8))/0xc);if(_0x3a69da===_0x176fa2)break;else _0x2d2c1f['push'](_0x2d2c1f['shift']());}catch(_0x386dfd){_0x2d2c1f['push'](_0x2d2c1f['shift']());}}}(a27_0x33a7,0xeb81e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a27_0x1ff090 from'chalk';function formatRelativeTime(_0x38f89b){const _0x545f31=a27_0x28cd,_0x187c7f=new Date(_0x38f89b),_0x218a90=new Date(),_0x144b21=_0x187c7f[_0x545f31(0xae)]()-_0x218a90['getTime'](),_0x28e3b4=Math[_0x545f31(0x135)](_0x144b21)/0x3e8,_0x17f195=_0x144b21<0x0;if(_0x28e3b4<0x3c)return _0x17f195?_0x545f31(0x105):_0x545f31(0x101);else{if(_0x28e3b4<0xe10){const _0x41248c=Math['round'](_0x28e3b4/0x3c);return _0x17f195?_0x41248c+_0x545f31(0x118):_0x545f31(0xe9)+_0x41248c+'m';}else{if(_0x28e3b4<0x15180){const _0x38550a=Math[_0x545f31(0x115)](_0x28e3b4/0xe10);return _0x17f195?_0x38550a+_0x545f31(0x11e):_0x545f31(0xe9)+_0x38550a+'h';}else{if(_0x28e3b4<0x93a80){const _0x289672=Math[_0x545f31(0x115)](_0x28e3b4/0x15180);return _0x17f195?_0x289672+_0x545f31(0xe7):'in\x20'+_0x289672+'d';}else return _0x187c7f[_0x545f31(0xb2)]();}}}}function a27_0x28cd(_0x45156f,_0x42d08d){_0x45156f=_0x45156f-0xa5;const _0x33a7ee=a27_0x33a7();let _0x28cd46=_0x33a7ee[_0x45156f];return _0x28cd46;}export class ScheduleListCommand extends BaseCommand{['name']=a27_0x5d80d7(0x11d);[a27_0x5d80d7(0xde)]='List\x20scheduled\x20queries';async[a27_0x5d80d7(0x104)](_0x4713cc){const _0x1b1835=a27_0x5d80d7,{options:_0x39fa71,args:_0x20f5b4,tdx:_0x2b80a7}=_0x4713cc,_0x28050f=resolveLimit(_0x39fa71[_0x1b1835(0x138)],DEFAULT_DISPLAY_LIMIT),_0x4ff7ca=_0x20f5b4[0x0],_0x2f183b=_0x4ff7ca?_0x1b1835(0x133)+_0x4ff7ca+'\x22...':_0x1b1835(0xf2),_0x13a70e=await withSpinner(_0x2f183b,()=>_0x2b80a7[_0x1b1835(0xdb)]['listQueries']({'limit':_0x28050f,'scheduled':!![],'pattern':_0x4ff7ca}),{'verbose':_0x39fa71[_0x1b1835(0xda)]}),_0x187567=_0x13a70e[_0x1b1835(0xf0)]['queries'],_0xc344=_0x13a70e[_0x1b1835(0xf0)][_0x1b1835(0x114)][_0x1b1835(0xc8)],_0x3749c5=_0x4ff7ca?'\x20matching\x20\x22'+_0x4ff7ca+'\x22':'';_0xc344?console[_0x1b1835(0xeb)](_0x1b1835(0xb7)+_0x187567[_0x1b1835(0x112)]+'\x20schedules'+_0x3749c5+_0x1b1835(0xd4)):console['error'](_0x1b1835(0xc5)+_0x187567[_0x1b1835(0x112)]+_0x1b1835(0xbf)+(_0x187567[_0x1b1835(0x112)]!==0x1?_0x1b1835(0xb0):'y')+_0x3749c5);if(_0x39fa71[_0x1b1835(0xce)]==='json'||_0x39fa71['format']===_0x1b1835(0xcb)||_0x39fa71[_0x1b1835(0xce)]===_0x1b1835(0xec)||_0x39fa71[_0x1b1835(0xce)]===_0x1b1835(0x11a)){const _0x3d3d2b=_0x187567[_0x1b1835(0xa8)](_0x515cba=>({'id':_0x515cba['id'],'name':_0x515cba[_0x1b1835(0x11c)],'cron':_0x515cba[_0x1b1835(0xe8)],'database':_0x515cba['database']?.['name'],'type':_0x515cba['type'],'timezone':_0x515cba[_0x1b1835(0xea)],'user_name':_0x515cba[_0x1b1835(0x131)]?.[_0x1b1835(0x11c)],'updated_at':_0x515cba['updated_at'],'next_run_at':_0x515cba['next_run_at'],'last_job_status':_0x515cba[_0x1b1835(0x11f)]?.[_0x1b1835(0xfc)]}));await handleSDKOutput(_0x3d3d2b,_0x39fa71);}else{if(_0x187567[_0x1b1835(0x112)]===0x0)console['log'](_0x1b1835(0xf1));else{const _0x43a29d=_0x39fa71[_0x1b1835(0xee)],_0x3793f4=_0x187567[_0x1b1835(0xa8)](_0x187167=>{const _0x1ae324=_0x1b1835,_0x151a72=_0x187167['last_job']?.[_0x1ae324(0xfc)]?_0x187167['last_job'][_0x1ae324(0xfc)]==='success'?'β':'β':'-',_0x36f8e9=_0x187167[_0x1ae324(0x11f)]?.[_0x1ae324(0xef)]?formatRelativeTime(_0x187167[_0x1ae324(0x11f)]['ended_at']):_0x1ae324(0xe5),_0x4c4cb0=_0x187167[_0x1ae324(0xcd)]?formatRelativeTime(_0x187167[_0x1ae324(0xcd)]):'-',_0x3a2a16=_0x187167[_0x1ae324(0xe8)]||'',_0x3b7294=_0x187167[_0x1ae324(0x11c)]||_0x1ae324(0x122),_0xcddbd8=getConsoleUrl(_0x43a29d,'/app/queries/editor?queryId='+_0x187167['id']);return{'statusIcon':_0x151a72,'lastRun':_0x36f8e9,'nextRun':_0x4c4cb0,'cron':_0x3a2a16,'name':_0x3b7294,'queryUrl':_0xcddbd8,'status':_0x187167[_0x1ae324(0x11f)]?.[_0x1ae324(0xfc)]};}),_0x982182=Math[_0x1b1835(0x111)](..._0x3793f4[_0x1b1835(0xa8)](_0x5d9149=>_0x5d9149[_0x1b1835(0x119)]['length'])),_0x570284=Math[_0x1b1835(0x111)](..._0x3793f4[_0x1b1835(0xa8)](_0x5df45e=>_0x5df45e[_0x1b1835(0xba)]['length'])),_0x2f5dff=Math[_0x1b1835(0x111)](..._0x3793f4['map'](_0x19aded=>_0x19aded[_0x1b1835(0xe8)][_0x1b1835(0x112)])),_0xf700a6=_0x3793f4[_0x1b1835(0xa8)](_0x54b840=>{const _0x42acbe=_0x1b1835,_0x49e4c6=_0x54b840['status']===_0x42acbe(0xd1)?a27_0x1ff090[_0x42acbe(0x12c)](_0x54b840['statusIcon']):_0x54b840[_0x42acbe(0xfc)]==='error'?a27_0x1ff090['red'](_0x54b840[_0x42acbe(0xfb)]):a27_0x1ff090[_0x42acbe(0xf3)](_0x54b840[_0x42acbe(0xfb)]),_0x497867=_0x54b840[_0x42acbe(0x119)]['padEnd'](_0x982182),_0x472bce=_0x54b840[_0x42acbe(0xba)]['padEnd'](_0x570284),_0x558699=_0x54b840['cron']?a27_0x1ff090[_0x42acbe(0xaa)](_0x54b840[_0x42acbe(0xe8)][_0x42acbe(0x103)](_0x2f5dff)):'\x20'[_0x42acbe(0xfa)](_0x2f5dff),_0x2b09b6=hyperlink(_0x54b840[_0x42acbe(0x11c)],_0x54b840['queryUrl']);return _0x42acbe(0x134)+_0x49e4c6+'\x20'+_0x497867+_0x42acbe(0xd6)+_0x472bce+'\x20\x20'+_0x558699+'\x20\x20'+_0x2b09b6;});await writeOutput(_0xf700a6['join']('\x0a'),_0x39fa71[_0x1b1835(0xb5)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xc3);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xb6);[a27_0x5d80d7(0x128)](_0x3f73cd){const _0x4ba627=a27_0x5d80d7,_0x17cc06=_0x3f73cd[_0x4ba627(0x11b)][0x0];if(!_0x17cc06)return _0x4ba627(0xdd);return undefined;}async[a27_0x5d80d7(0x104)](_0x161a98){const _0x4e84fb=a27_0x5d80d7,{options:_0x4bb660,args:_0x2f0529,tdx:_0x360772}=_0x161a98,_0x5d6521=_0x2f0529[0x0],_0x4de2ac=await withSpinner(_0x4e84fb(0x125),()=>_0x360772[_0x4e84fb(0xdb)][_0x4e84fb(0xcc)](_0x5d6521),{'verbose':_0x4bb660[_0x4e84fb(0xda)]}),_0x2ee522=_0x4de2ac['data'],_0x234042={'name':_0x2ee522['name'],'cron':_0x2ee522['cron'],'database':_0x2ee522['database'],'type':_0x2ee522[_0x4e84fb(0xd8)],'timezone':_0x2ee522[_0x4e84fb(0x10f)],'user_name':_0x2ee522['user_name'],'created_at':_0x2ee522[_0x4e84fb(0xdf)],'engine_version':_0x2ee522[_0x4e84fb(0xf7)],'executing_user_id':_0x2ee522['executing_user_id'],'query':_0x2ee522[_0x4e84fb(0x12a)],'delay':_0x2ee522[_0x4e84fb(0xab)],'priority':_0x2ee522['priority'],'retry_limit':_0x2ee522['retry_limit'],..._0x2ee522[_0x4e84fb(0x123)]&&{'result':_0x2ee522['result']}};return await handleSingleObjectOutput(_0x234042,_0x4bb660),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xe6);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xaf);['validate'](_0x35817b){const _0x4c03c6=a27_0x5d80d7,_0x39cc4e=_0x35817b['args'][0x0];if(!_0x39cc4e)return _0x4c03c6(0x106);return undefined;}async[a27_0x5d80d7(0x104)](_0x5ac02a){const _0x1749c9=a27_0x5d80d7,{options:_0x16b336,args:_0x866cd7,tdx:_0x2a1ab7}=_0x5ac02a,_0x5929ff=_0x866cd7[0x0],_0x54185d=_0x16b336,_0x1c2b31=_0x54185d[_0x1749c9(0xf4)],_0xc56ffc=_0x54185d[_0x1749c9(0x136)],_0x33986a=_0x54185d[_0x1749c9(0xd8)]||_0x1749c9(0xb4);let _0x43b79f;try{_0x43b79f=readFileSync(_0xc56ffc,_0x1749c9(0x130))[_0x1749c9(0xc2)]();}catch(_0x456278){throw new SDKError(ErrorCode[_0x1749c9(0x127)],_0x1749c9(0x132)+_0xc56ffc,_0x456278 instanceof Error?_0x456278:undefined);}if(!_0x43b79f)throw new SDKError(ErrorCode[_0x1749c9(0x127)],_0x1749c9(0xd2));const _0x2c447d={'database':_0x1c2b31,'query':_0x43b79f,'type':_0x33986a};if(_0x54185d[_0x1749c9(0xe8)])_0x2c447d[_0x1749c9(0xe8)]=_0x54185d[_0x1749c9(0xe8)];if(_0x54185d[_0x1749c9(0x10f)])_0x2c447d[_0x1749c9(0x10f)]=_0x54185d['timezone'];if(_0x54185d[_0x1749c9(0xab)]!==undefined)_0x2c447d['delay']=Number(_0x54185d['delay']);if(_0x54185d[_0x1749c9(0xbb)]!==undefined)_0x2c447d[_0x1749c9(0xbb)]=Number(_0x54185d[_0x1749c9(0xbb)]);if(_0x54185d[_0x1749c9(0xfe)]!==undefined)_0x2c447d[_0x1749c9(0xb8)]=Number(_0x54185d[_0x1749c9(0xfe)]);if(_0x54185d[_0x1749c9(0xe2)])_0x2c447d['engine_version']=_0x54185d['engineVersion'];if(_0x54185d['result'])_0x2c447d['result']=_0x54185d[_0x1749c9(0x123)];if(_0x16b336[_0x1749c9(0xda)]){console[_0x1749c9(0xeb)]('Creating\x20schedule:\x20'+_0x5929ff),console[_0x1749c9(0xeb)](_0x1749c9(0x107)+_0x1c2b31),console[_0x1749c9(0xeb)]('\x20\x20Type:\x20'+_0x33986a);if(_0x2c447d['cron'])console[_0x1749c9(0xeb)](_0x1749c9(0xac)+_0x2c447d[_0x1749c9(0xe8)]);if(_0x2c447d[_0x1749c9(0x10f)])console[_0x1749c9(0xeb)]('\x20\x20Timezone:\x20'+_0x2c447d[_0x1749c9(0x10f)]);}const _0x242b8a=await withSpinner(_0x1749c9(0xd7),()=>_0x2a1ab7[_0x1749c9(0xdb)][_0x1749c9(0xd9)](_0x5929ff,_0x2c447d),{'verbose':_0x16b336[_0x1749c9(0xda)]});return console[_0x1749c9(0xeb)](_0x1749c9(0x12f)+_0x242b8a['data'][_0x1749c9(0x11c)]),await handleSingleObjectOutput(_0x242b8a[_0x1749c9(0xf0)],_0x16b336),0x0;}}function a27_0x33a7(){const _0x5cbb13=['site','ended_at','data','No\x20scheduled\x20queries\x20found','Listing\x20scheduled\x20queries...','dim','database','run','2629itbFZU','engine_version','70788jOvJtb','52805daJxbt','repeat','statusIcon','status','\x20\x20Time:\x20','retryLimit','schedule:history','Deleting\x20schedule...','soon','\x20(showing\x20','padEnd','execute','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Database:\x20','from','scheduled_at','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Updating\x20schedule...','6648402rbcBJQ','364hJqGdC','Update\x20a\x20scheduled\x20query','timezone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','max','length','substring','pagination','round','Delete\x20a\x20scheduled\x20query','update','m\x20ago','lastRun','tsv','args','name','schedule:list','h\x20ago','last_job','Updating\x20schedule:\x20','\x20execution','(unnamed)','result','schedule:update','Getting\x20schedule\x20details...','Running\x20schedule...','INVALID_ARGUMENT','validate','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','query','Schedule\x20updated:\x20','green','schedule:run','jobs','Schedule\x20created:\x20','utf-8','user','Failed\x20to\x20read\x20file:\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','π
\x20','abs','file','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','limit','yes','job_id','Getting\x20schedule\x20history...','map','keys','cyan','delay','\x20\x20Cron:\x20','Schedule\x20deleted:\x20','getTime','Create\x20a\x20scheduled\x20query','ies','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','toLocaleDateString','4QdMxEc','trino','output','Show\x20schedule\x20details','Showing\x20first\x20','retry_limit','2100921TqBmyY','nextRun','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Schedule\x20run\x20submitted:\x20','num','\x20scheduled\x20quer','count','end_at','trim','schedule:show','time','Found\x20','927aMYsDe','818342xNmNNO','has_next_page','Run\x20a\x20scheduled\x20query\x20immediately','Cancelled','jsonl','show','next_run_at','format','7pysWys','\x20created','success','Query\x20file\x20is\x20empty','43910VrDwrE','\x20(use\x20--limit\x20to\x20see\x20more)','...','\x20\x20β\x20','Creating\x20schedule...','type','create','verbose','schedules','\x20job','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','description','created_at','delete','11895760zcxJfd','engineVersion','start_at','Show\x20schedule\x20execution\x20history','never','schedule:create','d\x20ago','cron','in\x20','time_zone','error','table','history'];a27_0x33a7=function(){return _0x5cbb13;};return a27_0x33a7();}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0x124);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0x10e);[a27_0x5d80d7(0x128)](_0x4a8baa){const _0x295254=a27_0x5d80d7,_0x1f12f3=_0x4a8baa[_0x295254(0x11b)][0x0];if(!_0x1f12f3)return _0x295254(0x110);return undefined;}async[a27_0x5d80d7(0x104)](_0x254880){const _0x25b6f6=a27_0x5d80d7,{options:_0x4ebc5e,args:_0x15c907,tdx:_0x34eb7d}=_0x254880,_0x567235=_0x15c907[0x0],_0x15193f=_0x4ebc5e,_0x3fed0a={};if(_0x15193f[_0x25b6f6(0xf4)])_0x3fed0a[_0x25b6f6(0xf4)]=_0x15193f[_0x25b6f6(0xf4)];if(_0x15193f[_0x25b6f6(0xd8)])_0x3fed0a[_0x25b6f6(0xd8)]=_0x15193f[_0x25b6f6(0xd8)];if(_0x15193f[_0x25b6f6(0xe8)])_0x3fed0a[_0x25b6f6(0xe8)]=_0x15193f[_0x25b6f6(0xe8)];if(_0x15193f[_0x25b6f6(0x10f)])_0x3fed0a[_0x25b6f6(0x10f)]=_0x15193f[_0x25b6f6(0x10f)];if(_0x15193f[_0x25b6f6(0xab)]!==undefined)_0x3fed0a[_0x25b6f6(0xab)]=Number(_0x15193f[_0x25b6f6(0xab)]);if(_0x15193f[_0x25b6f6(0xbb)]!==undefined)_0x3fed0a[_0x25b6f6(0xbb)]=Number(_0x15193f[_0x25b6f6(0xbb)]);if(_0x15193f[_0x25b6f6(0xfe)]!==undefined)_0x3fed0a[_0x25b6f6(0xb8)]=Number(_0x15193f[_0x25b6f6(0xfe)]);if(_0x15193f[_0x25b6f6(0xe2)])_0x3fed0a[_0x25b6f6(0xf7)]=_0x15193f[_0x25b6f6(0xe2)];if(_0x15193f[_0x25b6f6(0x123)])_0x3fed0a[_0x25b6f6(0x123)]=_0x15193f[_0x25b6f6(0x123)];if(_0x15193f[_0x25b6f6(0x136)])try{_0x3fed0a[_0x25b6f6(0x12a)]=readFileSync(_0x15193f['file'],_0x25b6f6(0x130))[_0x25b6f6(0xc2)]();}catch(_0x5a5aba){throw new SDKError(ErrorCode[_0x25b6f6(0x127)],_0x25b6f6(0x132)+_0x15193f[_0x25b6f6(0x136)],_0x5a5aba instanceof Error?_0x5a5aba:undefined);}if(Object[_0x25b6f6(0xa9)](_0x3fed0a)[_0x25b6f6(0x112)]===0x0)throw new SDKError(ErrorCode[_0x25b6f6(0x127)],_0x25b6f6(0x10a));if(_0x4ebc5e['verbose']){console[_0x25b6f6(0xeb)](_0x25b6f6(0x120)+_0x567235);for(const [_0x14272c,_0x379833]of Object['entries'](_0x3fed0a)){_0x14272c===_0x25b6f6(0x12a)?console['error']('\x20\x20'+_0x14272c+':\x20'+_0x379833[_0x25b6f6(0x113)](0x0,0x32)+_0x25b6f6(0xd5)):console['error']('\x20\x20'+_0x14272c+':\x20'+_0x379833);}}const _0xd4cf26=await withSpinner(_0x25b6f6(0x10b),()=>_0x34eb7d[_0x25b6f6(0xdb)][_0x25b6f6(0x117)](_0x567235,_0x3fed0a),{'verbose':_0x4ebc5e[_0x25b6f6(0xda)]});return console[_0x25b6f6(0xeb)](_0x25b6f6(0x12b)+_0xd4cf26['data'][_0x25b6f6(0x11c)]),await handleSingleObjectOutput(_0xd4cf26[_0x25b6f6(0xf0)],_0x4ebc5e),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]='schedule:delete';[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0x116);[a27_0x5d80d7(0x128)](_0x23e144){const _0x1c0f4b=a27_0x5d80d7,_0x44e5f2=_0x23e144['args'][0x0];if(!_0x44e5f2)return _0x1c0f4b(0xbc);return undefined;}async['execute'](_0xd0de46){const _0x341cae=a27_0x5d80d7,{options:_0x4a347d,args:_0x467879,tdx:_0xa32a50}=_0xd0de46,_0x142712=_0x467879[0x0];if(!_0x4a347d[_0x341cae(0xa5)]){const _0xd8bea4=await confirm(_0x341cae(0x137)+_0x142712+'\x22?');if(!_0xd8bea4)return console[_0x341cae(0xeb)](_0x341cae(0xca)),0x0;}const _0x519198=await withSpinner(_0x341cae(0x100),()=>_0xa32a50[_0x341cae(0xdb)][_0x341cae(0xe0)](_0x142712),{'verbose':_0x4a347d[_0x341cae(0xda)]});return console[_0x341cae(0xeb)](_0x341cae(0xad)+_0x519198['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0x12d);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xc9);[a27_0x5d80d7(0x128)](_0x31bbe8){const _0x58ddb0=a27_0x5d80d7,_0x5f247b=_0x31bbe8[_0x58ddb0(0x11b)][0x0];if(!_0x5f247b)return _0x58ddb0(0xb1);return undefined;}async[a27_0x5d80d7(0x104)](_0x38ffd4){const _0x33d121=a27_0x5d80d7,{options:_0x13ae01,args:_0x2e145d,tdx:_0x30873b}=_0x38ffd4,_0x378cd3=_0x2e145d[0x0],_0xabd0c7=_0x13ae01,_0xb98924=_0xabd0c7[_0x33d121(0xc4)],_0x2dd74e=_0xabd0c7[_0x33d121(0xbe)]!==undefined?Number(_0xabd0c7[_0x33d121(0xbe)]):undefined;if(_0x13ae01[_0x33d121(0xda)]){console[_0x33d121(0xeb)]('Running\x20schedule:\x20'+_0x378cd3);if(_0xb98924)console[_0x33d121(0xeb)](_0x33d121(0xfd)+_0xb98924);if(_0x2dd74e)console[_0x33d121(0xeb)]('\x20\x20Num:\x20'+_0x2dd74e);}const _0x5ba469=await withSpinner(_0x33d121(0x126),()=>_0x30873b[_0x33d121(0xdb)][_0x33d121(0xf5)](_0x378cd3,{'time':_0xb98924,'num':_0x2dd74e}),{'verbose':_0x13ae01[_0x33d121(0xda)]}),_0x17889f=_0x5ba469['data'][_0x33d121(0x12e)];console['error'](_0x33d121(0xbd)+_0x17889f[_0x33d121(0x112)]+_0x33d121(0xdc)+(_0x17889f[_0x33d121(0x112)]!==0x1?'s':'')+_0x33d121(0xd0));for(const _0x4977f6 of _0x17889f){console['error']('\x20\x20Job\x20ID:\x20'+_0x4977f6[_0x33d121(0xa6)]);}return await handleSDKOutput(_0x17889f,_0x13ae01),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xff);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xe4);['validate'](_0x2763a6){const _0x55ef58=a27_0x5d80d7,_0x542047=_0x2763a6['args'][0x0];if(!_0x542047)return _0x55ef58(0x129);return undefined;}async['execute'](_0x602fd1){const _0x386afa=a27_0x5d80d7,{options:_0x10eb6f,args:_0x472605,tdx:_0x3d0fa9}=_0x602fd1,_0x555ee8=_0x472605[0x0],_0x3b8d42=_0x10eb6f,_0x4d153c=_0x3b8d42[_0x386afa(0x108)]!==undefined?Number(_0x3b8d42['from']):undefined,_0x17a0f6=_0x3b8d42['to']!==undefined?Number(_0x3b8d42['to']):undefined,_0x39ec71=await withSpinner(_0x386afa(0xa7),()=>_0x3d0fa9['schedules'][_0x386afa(0xed)](_0x555ee8,{'from':_0x4d153c,'to':_0x17a0f6}),{'verbose':_0x10eb6f[_0x386afa(0xda)]}),_0x966b46=_0x39ec71[_0x386afa(0xf0)];console['error'](_0x386afa(0xc5)+_0x966b46[_0x386afa(0xc0)]+_0x386afa(0x121)+(_0x966b46[_0x386afa(0xc0)]!==0x1?'s':'')+_0x386afa(0x102)+_0x966b46[_0x386afa(0x108)]+'-'+_0x966b46['to']+')');const _0x4d93f6=_0x966b46[_0x386afa(0xed)][_0x386afa(0xa8)](_0x365ef3=>({'job_id':_0x365ef3['job_id'],'type':_0x365ef3[_0x386afa(0xd8)],'status':_0x365ef3['status'],'scheduled_at':_0x365ef3[_0x386afa(0x109)],'created_at':_0x365ef3['created_at'],'start_at':_0x365ef3[_0x386afa(0xe3)],'end_at':_0x365ef3[_0x386afa(0xc1)]}));return await handleSDKOutput(_0x4d93f6,_0x10eb6f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a28_0x3a728c=a28_0x4380;(function(_0x2bd156,_0x25796d){const _0x3b93fb=a28_0x4380,_0x5ebc99=_0x2bd156();while(!![]){try{const _0x6d1c95=-parseInt(_0x3b93fb(0x1ba))/0x1*(parseInt(_0x3b93fb(0x201))/0x2)+parseInt(_0x3b93fb(0x1c4))/0x3*(-parseInt(_0x3b93fb(0x236))/0x4)+parseInt(_0x3b93fb(0x1cb))/0x5*(-parseInt(_0x3b93fb(0x211))/0x6)+parseInt(_0x3b93fb(0x1cf))/0x7*(parseInt(_0x3b93fb(0x215))/0x8)+-parseInt(_0x3b93fb(0x1c0))/0x9*(parseInt(_0x3b93fb(0x20e))/0xa)+-parseInt(_0x3b93fb(0x1aa))/0xb+parseInt(_0x3b93fb(0x1d3))/0xc;if(_0x6d1c95===_0x25796d)break;else _0x5ebc99['push'](_0x5ebc99['shift']());}catch(_0x484edb){_0x5ebc99['push'](_0x5ebc99['shift']());}}}(a28_0x5954,0xcea0e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a28_0x5954(){const _0x5dc391=['8408838XFpxJf','\x20rows\x20','Resolving\x20path\x20\x27','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','5141168KWRVzF','type','SELECT\x20*\x20FROM\x20(\x0a','query','data','segment:folder:create','Use:\x20tdx\x20ps\x20sql','Resolving\x20folder\x20\x27','folder','resolvePathToResource','β\x20Query\x20completed:\x20Processed\x20','Site:\x20','β\x20Created\x20folder\x20\x27','Show\x20segment\x20folder\x20details','\x20\x20Segment\x20name:\x20','β\x20Query\x20failed\x20[','getFolder','resolveFolderId','parentSegment','\x27...','Folder\x20name:\x20','Segment\x20ID:\x20','segment','Resolved\x20parent\x20ID:\x20','site','Usage:\x20tdx\x20segment\x20describe\x20<path>','verbose','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Target\x20path:\x20','jobId','segment:describe','json','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','441196qMaxit','limit','/e/','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Parent\x20segment:\x20','elapsedTimeMillis','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','/app/ps/','Folder\x20ID:\x20','fullPath','green','Usage:\x20tdx\x20sg\x20show\x20<name>','toLocaleString','cause','test','segment:folder:show','9359185JlsOSi','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','SEGMENT_FOLDER_NOT_FOUND','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20parent\x20folder\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','listFolders','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','web','Create\x20segment\x20folder\x20for\x20organization','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20show','401vaqrTh','resolveParentId','information_schema','Use:\x20tdx\x20ps\x20view','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','in\x20','7416UXbSpO','Use:\x20tdx\x20ps\x20view\x20-w','url','format','42twXhGn','Error:\x20Path\x20or\x20name\x20is\x20required','message','length','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','5SEcDfJ','segment:view','processedRows','Fetching\x20parent\x20segment\x20details...','7tnJjxY','Options:','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolved\x20type:\x20','71354580TviWHq','Examples:','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getParent','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20segment\x20\x27','\x20folder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20Opening\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','Get\x20SQL\x20query\x20for\x20child\x20segment','description','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','SEGMENT_NOT_FOUND','folderPath','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:show','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','error','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20Cause:\x20','Parent\x20name:\x20','segmentId','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20SQL\x20for\x20segment...','Error:\x20Folder\x20reference\x20is\x20required','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','getSegmentSQL','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segmentPath','segment:desc','\x20\x20Full\x20path:\x20','Parent\x20ID:\x20','Error:\x20','\x20\x20Folder\x20path:\x20','stats','folderId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','name','6866BPUOcG','parentId','segment:folder:list','(root)','parentFolder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Fetching\x20folder\x20\x27','parent','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20segment\x20details...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Fetching\x20folder\x20details...','6910TEDtZw','Resolving\x20\x27','execute'];a28_0x5954=function(){return _0x5dc391;};return a28_0x5954();}function a28_0x4380(_0x18eed2,_0x5b646c){_0x18eed2=_0x18eed2-0x1a1;const _0x5954a2=a28_0x5954();let _0x4380a9=_0x5954a2[_0x18eed2];return _0x4380a9;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a28_0x286764 from'chalk';async function resolveSegmentTarget(_0xd955f8,_0x8a71c5,_0x5f50a3){const _0x402d44=a28_0x4380;if(isYamlFilePath(_0xd955f8))try{const _0x297123=await resolveYamlFilePath(_0xd955f8);return _0x5f50a3&&(console[_0x402d44(0x1ea)]('Resolved\x20YAML\x20file:\x20'+_0xd955f8),console[_0x402d44(0x1ea)](_0x402d44(0x23a)+_0x297123['parentSegment']),console[_0x402d44(0x1ea)](_0x402d44(0x223)+_0x297123['segmentName']),console[_0x402d44(0x1ea)](_0x402d44(0x1fc)+(_0x297123[_0x402d44(0x1e5)]||_0x402d44(0x204))),console[_0x402d44(0x1ea)](_0x402d44(0x1f9)+_0x297123[_0x402d44(0x1a3)])),_0x297123[_0x402d44(0x1a3)];}catch(_0x555d3d){throw new SDKError(ErrorCode[_0x402d44(0x23c)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x555d3d[_0x402d44(0x1c6)]);}if(!_0x8a71c5)throw new SDKError(ErrorCode[_0x402d44(0x23c)],_0x402d44(0x1af));return _0x8a71c5+'/'+_0xd955f8;}export class SegmentDescribeCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x233);[a28_0x3a728c(0x1e2)]='Show\x20segment\x20or\x20folder\x20details';async[a28_0x3a728c(0x210)](_0x1fe4ea){const _0x565f5e=a28_0x3a728c,{options:_0x42f427,args:_0x49fece,tdx:_0x11d6e4}=_0x1fe4ea,_0xa05a94=_0x49fece[0x0],_0x2fddd2=!_0xa05a94&&!!_0x42f427[_0x565f5e(0x227)],_0x2e6712=_0xa05a94||_0x42f427[_0x565f5e(0x227)];if(!_0x2e6712)return console['error'](_0x565f5e(0x1c5)),console[_0x565f5e(0x1ea)](_0x565f5e(0x22e)),console[_0x565f5e(0x1ea)](_0x565f5e(0x1d4)),console[_0x565f5e(0x1ea)](_0x565f5e(0x1f5)),console[_0x565f5e(0x1ea)](_0x565f5e(0x1ad)),console[_0x565f5e(0x1ea)](_0x565f5e(0x1e9)),console[_0x565f5e(0x1ea)](_0x565f5e(0x20c)),0x1;try{const _0x4ce599=_0x42f427[_0x565f5e(0x1f7)];let _0x3e9550=_0x2e6712;!_0x2fddd2&&_0x4ce599&&!_0x2e6712['includes']('/')&&(_0x3e9550=_0x4ce599+'/'+_0x2e6712,_0x42f427[_0x565f5e(0x22f)]&&console[_0x565f5e(0x1ea)](_0x565f5e(0x239)+_0x3e9550));const _0x1a9997=await withSpinner(_0x565f5e(0x213)+_0x3e9550+_0x565f5e(0x228),()=>_0x11d6e4[_0x565f5e(0x22b)]['resolvePathToResource'](_0x3e9550),{'verbose':_0x42f427[_0x565f5e(0x22f)]}),_0x2936e2=_0x1a9997[_0x565f5e(0x219)];_0x42f427['verbose']&&(console['error'](_0x565f5e(0x1d2)+_0x2936e2[_0x565f5e(0x216)]),console['error'](_0x565f5e(0x1fa)+_0x2936e2[_0x565f5e(0x202)]),_0x2936e2[_0x565f5e(0x1fe)]&&console[_0x565f5e(0x1ea)](_0x565f5e(0x1a2)+_0x2936e2[_0x565f5e(0x1fe)]),_0x2936e2[_0x565f5e(0x1ee)]&&console['error'](_0x565f5e(0x22a)+_0x2936e2[_0x565f5e(0x1ee)]));if(_0x2936e2[_0x565f5e(0x216)]===_0x565f5e(0x208)){const _0x44bac6=await withSpinner(_0x565f5e(0x1ce),()=>_0x11d6e4[_0x565f5e(0x22b)][_0x565f5e(0x1d8)](_0x2936e2[_0x565f5e(0x202)]),{'verbose':_0x42f427[_0x565f5e(0x22f)]});await handleSingleObjectOutput(_0x44bac6[_0x565f5e(0x219)],_0x42f427);}else{if(_0x2936e2[_0x565f5e(0x216)]===_0x565f5e(0x21d)){if(!_0x2936e2['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x565f5e(0x1c8));const _0x65f730=await withSpinner(_0x565f5e(0x20d),()=>_0x11d6e4['segment'][_0x565f5e(0x225)](_0x2936e2[_0x565f5e(0x1fe)]),{'verbose':_0x42f427[_0x565f5e(0x22f)]});await handleSingleObjectOutput(_0x65f730[_0x565f5e(0x219)],_0x42f427);}else{if(_0x2936e2[_0x565f5e(0x216)]===_0x565f5e(0x22b)){if(!_0x2936e2[_0x565f5e(0x1ee)])throw new SDKError(ErrorCode[_0x565f5e(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4ee614=await withSpinner(_0x565f5e(0x20b),()=>_0x11d6e4[_0x565f5e(0x22b)]['getSegment'](_0x2936e2[_0x565f5e(0x202)],_0x2936e2[_0x565f5e(0x1ee)]),{'verbose':_0x42f427[_0x565f5e(0x22f)]});await handleSingleObjectOutput(_0x4ee614['data'],_0x42f427);}}}return 0x0;}catch(_0x1c0538){if(_0x1c0538 instanceof SDKError)return console['error'](_0x565f5e(0x1fb)+_0x1c0538[_0x565f5e(0x1c6)]),_0x1c0538[_0x565f5e(0x1a7)]&&console[_0x565f5e(0x1ea)](_0x565f5e(0x1ec)+_0x1c0538[_0x565f5e(0x1a7)]),0x1;throw _0x1c0538;}}}export class SegmentShowCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x1e7);[a28_0x3a728c(0x1e2)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x3a728c(0x210)](_0xacbb5c){const _0x57beff=a28_0x3a728c,{options:_0x11eae5,args:_0xf69b5d,tdx:_0x360d01}=_0xacbb5c,_0x165cdf=_0xf69b5d[0x0];if(!_0x165cdf)return console['error'](_0x57beff(0x1d7)),console[_0x57beff(0x1ea)](_0x57beff(0x1a5)),console['error'](_0x57beff(0x1be)),console[_0x57beff(0x1ea)]('Examples:'),console['error'](_0x57beff(0x1ef)),console['error'](_0x57beff(0x23d)),0x1;try{const _0x3881f0=_0x11eae5['parentSegment'],_0x484efc=await resolveSegmentTarget(_0x165cdf,_0x3881f0,_0x11eae5[_0x57beff(0x22f)]);_0x11eae5['verbose']&&console[_0x57beff(0x1ea)](_0x57beff(0x231)+_0x484efc);const _0x588603=await withSpinner(_0x57beff(0x20f)+_0x165cdf+'\x27...',()=>_0x360d01[_0x57beff(0x22b)][_0x57beff(0x21e)](_0x484efc),{'verbose':_0x11eae5['verbose']}),_0x4ccb8e=_0x588603[_0x57beff(0x219)];_0x11eae5[_0x57beff(0x22f)]&&(console[_0x57beff(0x1ea)]('Resolved\x20type:\x20'+_0x4ccb8e['type']),console[_0x57beff(0x1ea)]('Parent\x20ID:\x20'+_0x4ccb8e['parentId']));if(_0x4ccb8e[_0x57beff(0x216)]===_0x57beff(0x21d))return console[_0x57beff(0x1ea)](_0x57beff(0x1e8)),console['error'](_0x57beff(0x214)),0x1;if(_0x4ccb8e['type']===_0x57beff(0x208))return console[_0x57beff(0x1ea)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x57beff(0x1b9)),0x1;if(!_0x4ccb8e[_0x57beff(0x1ee)])throw new SDKError(ErrorCode[_0x57beff(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3b9af0=await withSpinner(_0x57beff(0x1f0),()=>_0x360d01[_0x57beff(0x22b)]['getSegmentSQL'](_0x4ccb8e[_0x57beff(0x202)],_0x4ccb8e[_0x57beff(0x1ee)]),{'verbose':_0x11eae5[_0x57beff(0x22f)]});let _0x1ba9a1=_0x3b9af0['data'];const _0x2041e0=resolveLimit(_0x11eae5[_0x57beff(0x237)],DEFAULT_DISPLAY_LIMIT),_0x4a441d=/\bLIMIT\s+\d+/i[_0x57beff(0x1a8)](_0x1ba9a1);!_0x4a441d&&(_0x1ba9a1=_0x1ba9a1['trim']()['replace'](/;+$/,''),_0x1ba9a1=_0x57beff(0x217)+_0x1ba9a1+_0x57beff(0x1b1)+_0x2041e0);_0x11eae5['verbose']&&console[_0x57beff(0x1ea)]('SQL\x20query:\x0a'+_0x1ba9a1);const _0x13cbf1=await withProgressSpinner('Executing\x20segment\x20query...',async _0xf9c6a9=>{const _0xdb4a42=_0x57beff,_0x57120d=await _0x360d01[_0xdb4a42(0x218)][_0xdb4a42(0x210)](_0x1ba9a1,{'catalog':'td','schema':_0xdb4a42(0x1bc),'onJobId':_0x353a6f=>{_0xf9c6a9['setJobId'](_0x353a6f);}});return _0x57120d;},{'verbose':_0x11eae5[_0x57beff(0x22f)]}),_0x32492d=_0x13cbf1[_0x57beff(0x219)],_0x282873=_0x32492d[_0x57beff(0x232)]?'\x20[Job\x20ID:\x20'+_0x32492d[_0x57beff(0x232)]+']':'';return console[_0x57beff(0x1ea)](_0x57beff(0x21f)+_0x32492d[_0x57beff(0x1fd)][_0x57beff(0x1cd)][_0x57beff(0x1a6)]()+_0x57beff(0x212)+(_0x57beff(0x1bf)+formatElapsed(_0x32492d[_0x57beff(0x1fd)][_0x57beff(0x23b)])+_0x282873)),await handleQueryOutput(_0x32492d,_0x11eae5),0x0;}catch(_0x54a5c5){if(_0x54a5c5 instanceof SDKError)return console['error'](_0x57beff(0x224)+_0x54a5c5['code']+']'),console[_0x57beff(0x1ea)]('\x0a'+_0x54a5c5[_0x57beff(0x1c6)]),0x1;throw _0x54a5c5;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a28_0x3a728c(0x203);[a28_0x3a728c(0x1e2)]=a28_0x3a728c(0x1e3);async[a28_0x3a728c(0x210)](_0x2962eb){const _0x285c57=a28_0x3a728c,{options:_0x49ada5,args:_0x1fb045,tdx:_0x6686c0}=_0x2962eb;if(_0x1fb045['length']===0x0)return console[_0x285c57(0x1ea)](_0x285c57(0x1b4)),console[_0x285c57(0x1ea)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x1d96f2=_0x1fb045[0x0];try{_0x49ada5[_0x285c57(0x22f)]&&(console[_0x285c57(0x1ea)](_0x285c57(0x220)+_0x49ada5['site']),console[_0x285c57(0x1ea)](_0x285c57(0x1ed)+_0x1d96f2));const _0x252d52=await withSpinner(_0x285c57(0x1dc)+_0x1d96f2+_0x285c57(0x228),()=>_0x6686c0[_0x285c57(0x22b)][_0x285c57(0x1bb)](_0x1d96f2),{'verbose':_0x49ada5[_0x285c57(0x22f)]}),_0x1ddb4c=_0x252d52[_0x285c57(0x219)];_0x49ada5[_0x285c57(0x22f)]&&console[_0x285c57(0x1ea)](_0x285c57(0x22c)+_0x1ddb4c);const _0x253a37=await withSpinner(_0x285c57(0x1c9)+_0x1d96f2+_0x285c57(0x228),()=>_0x6686c0[_0x285c57(0x22b)][_0x285c57(0x1b2)](_0x1ddb4c),{'verbose':_0x49ada5[_0x285c57(0x22f)]}),_0xe6df90=_0x253a37['data'];return console[_0x285c57(0x1ea)]('β\x20Found\x20'+_0xe6df90['length']+_0x285c57(0x1dd)+(_0xe6df90[_0x285c57(0x1c7)]!==0x1?'s':'')),await handleSDKOutput(_0xe6df90,_0x49ada5),0x0;}catch(_0x4d8e56){if(_0x4d8e56 instanceof SDKError)return console[_0x285c57(0x1ea)](_0x285c57(0x1fb)+_0x4d8e56[_0x285c57(0x1c6)]),_0x4d8e56[_0x285c57(0x1a7)]&&console['error'](_0x285c57(0x1ec)+_0x4d8e56[_0x285c57(0x1a7)]),0x1;throw _0x4d8e56;}}}export class SegmentFolderShowCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x1a9);[a28_0x3a728c(0x1e2)]=a28_0x3a728c(0x222);async[a28_0x3a728c(0x210)](_0x5ac52f){const _0x50e1ad=a28_0x3a728c,{options:_0x582481,args:_0x884d94,tdx:_0x311820}=_0x5ac52f;if(_0x884d94[_0x50e1ad(0x1c7)]===0x0)return console[_0x50e1ad(0x1ea)](_0x50e1ad(0x1f1)),console[_0x50e1ad(0x1ea)](_0x50e1ad(0x1eb)),0x1;try{const {parentId:_0x255292,childId:_0x5468ae}=parseSegmentRef(_0x884d94[0x0]);_0x582481['verbose']&&(console[_0x50e1ad(0x1ea)]('Site:\x20'+_0x582481[_0x50e1ad(0x22d)]),console[_0x50e1ad(0x1ea)](_0x50e1ad(0x1ed)+_0x255292),_0x5468ae&&console[_0x50e1ad(0x1ea)](_0x50e1ad(0x229)+_0x5468ae));if(!_0x5468ae)return console[_0x50e1ad(0x1ea)](_0x50e1ad(0x1b3)),0x1;const _0x4da323=await withSpinner(_0x50e1ad(0x1dc)+_0x255292+_0x50e1ad(0x228),()=>_0x311820[_0x50e1ad(0x22b)][_0x50e1ad(0x1bb)](_0x255292),{'verbose':_0x582481[_0x50e1ad(0x22f)]}),_0x1d6caa=_0x4da323['data'];_0x582481[_0x50e1ad(0x22f)]&&console[_0x50e1ad(0x1ea)]('Resolved\x20parent\x20ID:\x20'+_0x1d6caa);const _0x1f00ae=await withSpinner(_0x50e1ad(0x21c)+_0x5468ae+'\x27...',()=>_0x311820['segment'][_0x50e1ad(0x226)](_0x1d6caa,_0x5468ae),{'verbose':_0x582481[_0x50e1ad(0x22f)]}),_0x37dd4a=_0x1f00ae['data'];_0x582481[_0x50e1ad(0x22f)]&&console['error'](_0x50e1ad(0x1b5)+_0x37dd4a);const _0xbf1d3b=await withSpinner(_0x50e1ad(0x207)+_0x5468ae+_0x50e1ad(0x228),()=>_0x311820['segment'][_0x50e1ad(0x225)](_0x37dd4a),{'verbose':_0x582481[_0x50e1ad(0x22f)]});return await handleSDKOutput([_0xbf1d3b['data']],_0x582481),0x0;}catch(_0x1e7d19){if(_0x1e7d19 instanceof SDKError)return console[_0x50e1ad(0x1ea)]('Error:\x20'+_0x1e7d19[_0x50e1ad(0x1c6)]),_0x1e7d19[_0x50e1ad(0x1a7)]&&console[_0x50e1ad(0x1ea)]('\x20\x20Cause:\x20'+_0x1e7d19['cause']),0x1;throw _0x1e7d19;}}}export class SegmentSQLCommand extends BaseCommand{[a28_0x3a728c(0x200)]='segment:sql';[a28_0x3a728c(0x1e2)]=a28_0x3a728c(0x1e1);async[a28_0x3a728c(0x210)](_0x37037e){const _0x2f4297=a28_0x3a728c,{options:_0x4f8018,args:_0x3e9c74,tdx:_0x26c6dc}=_0x37037e,_0x443d56=_0x3e9c74[0x0];if(!_0x443d56)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2f4297(0x1ea)](_0x2f4297(0x1e0)),console['error'](_0x2f4297(0x1d6)),console['error'](_0x2f4297(0x1d4)),console[_0x2f4297(0x1ea)](_0x2f4297(0x1d1)),console[_0x2f4297(0x1ea)](_0x2f4297(0x1db)),0x1;try{const _0x394f0c=_0x4f8018[_0x2f4297(0x227)],_0x327879=await resolveSegmentTarget(_0x443d56,_0x394f0c,_0x4f8018['verbose']);_0x4f8018[_0x2f4297(0x22f)]&&console['error']('Target\x20path:\x20'+_0x327879);const _0x2c122b=await withSpinner(_0x2f4297(0x20f)+_0x443d56+_0x2f4297(0x228),()=>_0x26c6dc[_0x2f4297(0x22b)][_0x2f4297(0x21e)](_0x327879),{'verbose':_0x4f8018[_0x2f4297(0x22f)]}),_0x337c00=_0x2c122b['data'];_0x4f8018[_0x2f4297(0x22f)]&&(console[_0x2f4297(0x1ea)]('Resolved\x20type:\x20'+_0x337c00[_0x2f4297(0x216)]),console[_0x2f4297(0x1ea)](_0x2f4297(0x1fa)+_0x337c00['parentId']));if(_0x337c00[_0x2f4297(0x216)]==='folder')return console[_0x2f4297(0x1ea)](_0x2f4297(0x1f4)),console['error'](_0x2f4297(0x1f6)),0x1;if(_0x337c00[_0x2f4297(0x216)]===_0x2f4297(0x208))return console['error'](_0x2f4297(0x1e6)),console[_0x2f4297(0x1ea)](_0x2f4297(0x21b)),0x1;if(!_0x337c00[_0x2f4297(0x1ee)])throw new SDKError(ErrorCode[_0x2f4297(0x1e4)],_0x2f4297(0x1ff));const _0x1039da=await withSpinner(_0x2f4297(0x1f0),()=>_0x26c6dc[_0x2f4297(0x22b)][_0x2f4297(0x1f3)](_0x337c00['parentId'],_0x337c00[_0x2f4297(0x1ee)]),{'verbose':_0x4f8018[_0x2f4297(0x22f)]}),_0x394852=_0x1039da[_0x2f4297(0x219)];return _0x4f8018[_0x2f4297(0x1c3)]===_0x2f4297(0x234)||_0x4f8018[_0x2f4297(0x1c3)]==='jsonl'?await handleSDKOutput([{'sql':_0x394852}],_0x4f8018):console['log'](_0x394852),0x0;}catch(_0x249c7c){if(_0x249c7c instanceof SDKError)return console[_0x2f4297(0x1ea)](_0x2f4297(0x1fb)+_0x249c7c[_0x2f4297(0x1c6)]),_0x249c7c[_0x2f4297(0x1a7)]&&console[_0x2f4297(0x1ea)](_0x2f4297(0x1ec)+_0x249c7c[_0x2f4297(0x1a7)]),0x1;throw _0x249c7c;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x21a);[a28_0x3a728c(0x1e2)]=a28_0x3a728c(0x1b7);async[a28_0x3a728c(0x210)](_0x3789a9){const _0x439f94=a28_0x3a728c,{options:_0x3be83d,args:_0x14115a,tdx:_0x580ef6}=_0x3789a9,_0xd1354c=_0x3be83d;if(_0x14115a[_0x439f94(0x1c7)]<0x2)return console['error']('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x439f94(0x1ea)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x4150f7=_0x14115a[0x0],_0x3ecfbd=_0x14115a[0x1];_0xd1354c[_0x439f94(0x22f)]&&(console[_0x439f94(0x1ea)](_0x439f94(0x220)+_0xd1354c[_0x439f94(0x22d)]),console['error']('Parent\x20segment:\x20'+_0x4150f7),console[_0x439f94(0x1ea)](_0x439f94(0x229)+_0x3ecfbd));let _0x428250;if(_0xd1354c[_0x439f94(0x205)]){const _0x278df6=_0xd1354c['parentFolder'],_0x39baaf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4150f7+_0x439f94(0x228),()=>_0x580ef6[_0x439f94(0x22b)][_0x439f94(0x1bb)](_0x4150f7),{'verbose':_0xd1354c[_0x439f94(0x22f)]}),_0x12bc1d=_0x39baaf[_0x439f94(0x219)],_0x46ca7b=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x278df6+_0x439f94(0x228),()=>_0x580ef6[_0x439f94(0x22b)][_0x439f94(0x226)](_0x12bc1d,_0x278df6),{'verbose':_0xd1354c[_0x439f94(0x22f)]});_0x428250=_0x46ca7b['data'],_0xd1354c[_0x439f94(0x22f)]&&console[_0x439f94(0x1ea)](_0x439f94(0x1b0)+_0x428250);}const _0xa53a15={'name':_0x3ecfbd,'description':_0xd1354c[_0x439f94(0x1e2)],'parentFolderId':_0x428250},_0x50aef7=await withSpinner('Creating\x20folder\x20\x27'+_0x3ecfbd+'\x27...',()=>_0x580ef6[_0x439f94(0x22b)]['createFolder'](_0x4150f7,_0xa53a15),{'verbose':_0xd1354c[_0x439f94(0x22f)]}),_0x4139a6=_0x50aef7['data'];return console[_0x439f94(0x1ea)](_0x439f94(0x221)+_0x4139a6[_0x439f94(0x200)]+_0x439f94(0x1d5)+_0x4139a6['id']),await handleSDKOutput([_0x4139a6],_0xd1354c),0x0;}}export class SegmentViewCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x1cc);['description']=a28_0x3a728c(0x1da);async['execute'](_0x4855e4){const _0x5a667f=a28_0x3a728c,{options:_0x48d7d2,args:_0x5a8322,tdx:_0x375100}=_0x4855e4,_0x2e9c86=_0x5a8322[0x0];if(!_0x2e9c86)return console[_0x5a667f(0x1ea)](_0x5a667f(0x209)),console['error'](_0x5a667f(0x1f2)),console[_0x5a667f(0x1ea)](_0x5a667f(0x1b8)),console['error'](_0x5a667f(0x1d0)),console['error'](_0x5a667f(0x1d9)),console['error'](_0x5a667f(0x1d4)),console[_0x5a667f(0x1ea)](_0x5a667f(0x235)),console['error'](_0x5a667f(0x1ca)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5a667f(0x1ea)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3f63c5=_0x48d7d2[_0x5a667f(0x227)],_0x184ca9=await resolveSegmentTarget(_0x2e9c86,_0x3f63c5,_0x48d7d2['verbose']);_0x48d7d2[_0x5a667f(0x22f)]&&console[_0x5a667f(0x1ea)](_0x5a667f(0x231)+_0x184ca9);const _0xc84d49=await withSpinner(_0x5a667f(0x20f)+_0x2e9c86+_0x5a667f(0x228),()=>_0x375100['segment'][_0x5a667f(0x21e)](_0x184ca9),{'verbose':_0x48d7d2[_0x5a667f(0x22f)]}),_0x3652d3=_0xc84d49[_0x5a667f(0x219)];_0x48d7d2[_0x5a667f(0x22f)]&&(console[_0x5a667f(0x1ea)](_0x5a667f(0x1d2)+_0x3652d3['type']),console[_0x5a667f(0x1ea)](_0x5a667f(0x1fa)+_0x3652d3[_0x5a667f(0x202)]),_0x3652d3[_0x5a667f(0x1fe)]&&console[_0x5a667f(0x1ea)]('Folder\x20ID:\x20'+_0x3652d3[_0x5a667f(0x1fe)]),_0x3652d3['segmentId']&&console[_0x5a667f(0x1ea)](_0x5a667f(0x22a)+_0x3652d3[_0x5a667f(0x1ee)]));if(_0x48d7d2[_0x5a667f(0x1b6)]){if(_0x3652d3[_0x5a667f(0x216)]===_0x5a667f(0x21d))return console['error'](_0x5a667f(0x20a)),0x1;if(_0x3652d3[_0x5a667f(0x216)]===_0x5a667f(0x208))return console[_0x5a667f(0x1ea)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5a667f(0x1ea)](_0x5a667f(0x1c1)),0x1;if(!_0x3652d3[_0x5a667f(0x1ee)])throw new SDKError(ErrorCode[_0x5a667f(0x1e4)],_0x5a667f(0x1ff));const _0x5435dc=getConsoleNextUrl(_0x48d7d2[_0x5a667f(0x22d)],_0x5a667f(0x1a1)+_0x3652d3[_0x5a667f(0x202)]+'/e/'+_0x3652d3[_0x5a667f(0x1ee)]);return console['error'](a28_0x286764[_0x5a667f(0x1a4)]('β')+_0x5a667f(0x1df)+a28_0x286764['cyan'](_0x5435dc)),openBrowser(_0x5435dc),0x0;}if(_0x3652d3[_0x5a667f(0x216)]===_0x5a667f(0x21d)){if(!_0x3652d3[_0x5a667f(0x1fe)])throw new SDKError(ErrorCode[_0x5a667f(0x1ae)],_0x5a667f(0x1c8));const _0x36a18a=await withSpinner('Fetching\x20folder\x20details...',()=>_0x375100[_0x5a667f(0x22b)][_0x5a667f(0x225)](_0x3652d3[_0x5a667f(0x1fe)]),{'verbose':_0x48d7d2['verbose']});await handleSingleObjectOutput(_0x36a18a['data'],_0x48d7d2);}else{if(_0x3652d3[_0x5a667f(0x216)]===_0x5a667f(0x22b)){if(!_0x3652d3[_0x5a667f(0x1ee)])throw new SDKError(ErrorCode[_0x5a667f(0x1e4)],_0x5a667f(0x1ff));const _0x1ceb93=await withSpinner(_0x5a667f(0x20b),()=>_0x375100[_0x5a667f(0x22b)]['getSegment'](_0x3652d3[_0x5a667f(0x202)],_0x3652d3[_0x5a667f(0x1ee)]),{'verbose':_0x48d7d2[_0x5a667f(0x22f)]}),_0x39c1a2=getConsoleNextUrl(_0x48d7d2['site'],'/app/ps/'+_0x3652d3['parentId']+_0x5a667f(0x238)+_0x3652d3[_0x5a667f(0x1ee)]),_0xc14df0=_0x1ceb93[_0x5a667f(0x219)];_0xc14df0[_0x5a667f(0x1c2)]=_0x39c1a2,await handleSingleObjectOutput(_0xc14df0,_0x48d7d2);}else return console[_0x5a667f(0x1ea)](_0x5a667f(0x206)),console[_0x5a667f(0x1ea)](_0x5a667f(0x1bd)),0x1;}return 0x0;}catch(_0x2aed78){if(_0x2aed78 instanceof SDKError)return console[_0x5a667f(0x1ea)](_0x5a667f(0x1fb)+_0x2aed78[_0x5a667f(0x1c6)]),_0x2aed78[_0x5a667f(0x1a7)]&&console[_0x5a667f(0x1ea)](_0x5a667f(0x1ec)+_0x2aed78['cause']),0x1;throw _0x2aed78;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a28_0x3a728c(0x200)]=a28_0x3a728c(0x1f8);[a28_0x3a728c(0x1e2)]=a28_0x3a728c(0x1ab);async['execute'](_0x1d7cf4){const _0x99ff5a=a28_0x3a728c,{options:_0x67c8a1,args:_0x1e1cdd,tdx:_0x472a5f}=_0x1d7cf4,_0x4ee5c7=_0x1e1cdd[0x0];if(!_0x4ee5c7)return console['error'](_0x99ff5a(0x1d7)),console[_0x99ff5a(0x1ea)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x99ff5a(0x1de)),console['error'](_0x99ff5a(0x1d4)),console[_0x99ff5a(0x1ea)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1ac)),0x1;try{const _0x26d62e=_0x67c8a1['parentSegment'],_0x45d05f=await resolveSegmentTarget(_0x4ee5c7,_0x26d62e,_0x67c8a1[_0x99ff5a(0x22f)]);_0x67c8a1[_0x99ff5a(0x22f)]&&console[_0x99ff5a(0x1ea)]('Target\x20path:\x20'+_0x45d05f);const _0x1255a0=await withSpinner(_0x99ff5a(0x20f)+_0x4ee5c7+_0x99ff5a(0x228),()=>_0x472a5f['segment'][_0x99ff5a(0x21e)](_0x45d05f),{'verbose':_0x67c8a1['verbose']}),_0x29a68f=_0x1255a0['data'];_0x67c8a1[_0x99ff5a(0x22f)]&&(console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1d2)+_0x29a68f[_0x99ff5a(0x216)]),console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1fa)+_0x29a68f['parentId']));if(_0x29a68f['type']===_0x99ff5a(0x21d))return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1f6)),0x1;if(_0x29a68f[_0x99ff5a(0x216)]===_0x99ff5a(0x208))return console[_0x99ff5a(0x1ea)](_0x99ff5a(0x230)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x29a68f['segmentId'])throw new SDKError(ErrorCode[_0x99ff5a(0x1e4)],_0x99ff5a(0x1ff));const _0x3ef9cb=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x472a5f[_0x99ff5a(0x22b)][_0x99ff5a(0x1f3)](_0x29a68f[_0x99ff5a(0x202)],_0x29a68f[_0x99ff5a(0x1ee)]),{'verbose':_0x67c8a1[_0x99ff5a(0x22f)]}),_0x5e92f3=_0x3ef9cb['data'],_0x264174=await executeSchemaQuery(_0x5e92f3,_0x472a5f,_0x67c8a1);return await handleQueryOutput(_0x264174,_0x67c8a1),0x0;}catch(_0x242667){if(_0x242667 instanceof SDKError)return console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1fb)+_0x242667['message']),_0x242667['cause']&&console[_0x99ff5a(0x1ea)](_0x99ff5a(0x1ec)+_0x242667[_0x99ff5a(0x1a7)]),0x1;throw _0x242667;}}}
|
|
1
|
+
const a28_0x5c638e=a28_0x4e7a;(function(_0x3b4dbd,_0xcc1609){const _0x44ac7b=a28_0x4e7a,_0x23d990=_0x3b4dbd();while(!![]){try{const _0x3a7fd7=-parseInt(_0x44ac7b(0x13c))/0x1+-parseInt(_0x44ac7b(0x138))/0x2*(parseInt(_0x44ac7b(0xfb))/0x3)+-parseInt(_0x44ac7b(0x18f))/0x4*(-parseInt(_0x44ac7b(0x133))/0x5)+parseInt(_0x44ac7b(0x11e))/0x6*(parseInt(_0x44ac7b(0x160))/0x7)+-parseInt(_0x44ac7b(0xfa))/0x8+-parseInt(_0x44ac7b(0x12f))/0x9+parseInt(_0x44ac7b(0x13f))/0xa;if(_0x3a7fd7===_0xcc1609)break;else _0x23d990['push'](_0x23d990['shift']());}catch(_0x594493){_0x23d990['push'](_0x23d990['shift']());}}}(a28_0x2575,0x2e887));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a28_0x386346 from'chalk';function a28_0x2575(){const _0x3ee33d=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20rows\x20','segment:folder:show','segment','error','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20parent\x20segment\x20\x27','\x20Opening\x20','toLocaleString','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20ID:\x20','fullPath','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','test','segment:describe','segment:sql','in\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','jsonl','12ALAmwp','stats','\x27...','INVALID_ARGUMENT','Resolving\x20\x27','segment:folder:create','Segment\x20ID:\x20','\x20\x20Cause:\x20','1665488EiqsUY','690WVzCCI','Fetching\x20segment\x20details...','parentId','verbose','segment:show','cyan','trim','resolveFolderId','\x27\x20with\x20ID:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','type','web','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','execute','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','includes','segmentPath','Site:\x20','cause','Parent\x20segment:\x20','Use:\x20tdx\x20ps\x20view','query','json','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Options:','resolveParentId','SEGMENT_NOT_FOUND','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','6VDSLut','elapsedTimeMillis','format','message','Use:\x20tdx\x20ps\x20sql','Parent\x20name:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','code','Fetching\x20folder\x20\x27','getFolder','log','Show\x20folder\x20or\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Fetching\x20SQL\x20for\x20segment...','Show\x20segment\x20folder\x20details','jobId','data','1802340QhqgrQ','Resolved\x20YAML\x20file:\x20','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','517885ybslgv','processedRows','getSegmentSQL','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','1046QTzPLY','Use:\x20tdx\x20ps\x20view\x20-w','Creating\x20folder\x20\x27','segment:desc','215071gsLOjV','createFolder','description','3909160trIEeF','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20show\x20<name>','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use:\x20tdx\x20ps\x20show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment:folder:list','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20folder\x20ID:\x20','β\x20Found\x20','parent','limit','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20parent\x20segment\x20details...','folder','Resolved\x20type:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentFolder','Resolved\x20parent\x20ID:\x20','getSegment','Resolved\x20relative\x20path\x20to:\x20','Examples:','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Target\x20path:\x20','\x20\x20Folder\x20path:\x20','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Parent\x20segment:\x20','resolvePathToResource','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','1629313AmrFfm','\x20folder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','β\x20Query\x20completed:\x20Processed\x20','site','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','setJobId','segmentId','Error:\x20','(root)','Parent\x20ID:\x20','url','name','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Folder\x20ID\x20missing\x20from\x20resolved\x20path','/app/ps/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','length','replace','listFolders','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'];a28_0x2575=function(){return _0x3ee33d;};return a28_0x2575();}async function resolveSegmentTarget(_0x15fdfc,_0x4f9664,_0x5c4178){const _0x5a09ea=a28_0x4e7a;if(isYamlFilePath(_0x15fdfc))try{const _0x5f45f7=await resolveYamlFilePath(_0x15fdfc);return _0x5c4178&&(console[_0x5a09ea(0x17f)](_0x5a09ea(0x130)+_0x15fdfc),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15d)+_0x5f45f7['parentSegment']),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15b)+_0x5f45f7['segmentName']),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15a)+(_0x5f45f7['folderPath']||_0x5a09ea(0x169))),console[_0x5a09ea(0x17f)]('\x20\x20Full\x20path:\x20'+_0x5f45f7[_0x5a09ea(0x186)])),_0x5f45f7[_0x5a09ea(0x186)];}catch(_0x4c4341){throw new SDKError(ErrorCode[_0x5a09ea(0xf5)],_0x5a09ea(0x172)+_0x4c4341[_0x5a09ea(0x121)]);}if(!_0x4f9664)throw new SDKError(ErrorCode[_0x5a09ea(0xf5)],_0x5a09ea(0x144));return _0x4f9664+'/'+_0x15fdfc;}export class SegmentDescribeCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x18a);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x187);async[a28_0x5c638e(0x10b)](_0x318b49){const _0x5da77d=a28_0x5c638e,{options:_0x54997d,args:_0x3559d1,tdx:_0x23e4d0}=_0x318b49,_0x4bc8f2=_0x3559d1[0x0],_0x5982b5=!_0x4bc8f2&&!!_0x54997d['parentSegment'],_0x2c3ca3=_0x4bc8f2||_0x54997d[_0x5da77d(0x142)];if(!_0x2c3ca3)return console[_0x5da77d(0x17f)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x5da77d(0x17f)](_0x5da77d(0x132)),console[_0x5da77d(0x17f)](_0x5da77d(0x157)),console[_0x5da77d(0x17f)](_0x5da77d(0x11b)),console[_0x5da77d(0x17f)](_0x5da77d(0x15c)),console[_0x5da77d(0x17f)](_0x5da77d(0x149)),console[_0x5da77d(0x17f)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0xf4e548=_0x54997d[_0x5da77d(0x10e)];let _0x2b7f22=_0x2c3ca3;!_0x5982b5&&_0xf4e548&&!_0x2c3ca3[_0x5da77d(0x10d)]('/')&&(_0x2b7f22=_0xf4e548+'/'+_0x2c3ca3,_0x54997d['verbose']&&console[_0x5da77d(0x17f)](_0x5da77d(0x156)+_0x2b7f22));const _0x2de935=await withSpinner('Resolving\x20path\x20\x27'+_0x2b7f22+'\x27...',()=>_0x23e4d0[_0x5da77d(0x17e)]['resolvePathToResource'](_0x2b7f22),{'verbose':_0x54997d['verbose']}),_0x5ed49a=_0x2de935[_0x5da77d(0x12e)];_0x54997d[_0x5da77d(0xfe)]&&(console[_0x5da77d(0x17f)](_0x5da77d(0x151)+_0x5ed49a[_0x5da77d(0x106)]),console[_0x5da77d(0x17f)](_0x5da77d(0x16a)+_0x5ed49a[_0x5da77d(0xfd)]),_0x5ed49a[_0x5da77d(0x10a)]&&console[_0x5da77d(0x17f)](_0x5da77d(0x185)+_0x5ed49a['folderId']),_0x5ed49a[_0x5da77d(0x167)]&&console[_0x5da77d(0x17f)](_0x5da77d(0xf8)+_0x5ed49a['segmentId']));if(_0x5ed49a[_0x5da77d(0x106)]===_0x5da77d(0x14c)){const _0x2e59f4=await withSpinner(_0x5da77d(0x14f),()=>_0x23e4d0[_0x5da77d(0x17e)]['getParent'](_0x5ed49a[_0x5da77d(0xfd)]),{'verbose':_0x54997d[_0x5da77d(0xfe)]});await handleSingleObjectOutput(_0x2e59f4[_0x5da77d(0x12e)],_0x54997d);}else{if(_0x5ed49a[_0x5da77d(0x106)]===_0x5da77d(0x150)){if(!_0x5ed49a['folderId'])throw new SDKError(ErrorCode[_0x5da77d(0x140)],_0x5da77d(0x16e));const _0x1ab8a1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x23e4d0[_0x5da77d(0x17e)][_0x5da77d(0x127)](_0x5ed49a[_0x5da77d(0x10a)]),{'verbose':_0x54997d['verbose']});await handleSingleObjectOutput(_0x1ab8a1[_0x5da77d(0x12e)],_0x54997d);}else{if(_0x5ed49a['type']===_0x5da77d(0x17e)){if(!_0x5ed49a['segmentId'])throw new SDKError(ErrorCode[_0x5da77d(0x119)],_0x5da77d(0x147));const _0xa2da6e=await withSpinner(_0x5da77d(0xfc),()=>_0x23e4d0['segment'][_0x5da77d(0x155)](_0x5ed49a[_0x5da77d(0xfd)],_0x5ed49a['segmentId']),{'verbose':_0x54997d[_0x5da77d(0xfe)]});await handleSingleObjectOutput(_0xa2da6e[_0x5da77d(0x12e)],_0x54997d);}}}return 0x0;}catch(_0x173b0f){if(_0x173b0f instanceof SDKError)return console[_0x5da77d(0x17f)](_0x5da77d(0x168)+_0x173b0f['message']),_0x173b0f[_0x5da77d(0x110)]&&console[_0x5da77d(0x17f)](_0x5da77d(0xf9)+_0x173b0f['cause']),0x1;throw _0x173b0f;}}}export class SegmentShowCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0xff);[a28_0x5c638e(0x13e)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x5c638e(0x10b)](_0x137199){const _0xcda091=a28_0x5c638e,{options:_0x13c1fe,args:_0x49ee5e,tdx:_0xff3862}=_0x137199,_0xaa8ee2=_0x49ee5e[0x0];if(!_0xaa8ee2)return console[_0xcda091(0x17f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0xcda091(0x141)),console[_0xcda091(0x17f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console['error'](_0xcda091(0x157)),console['error'](_0xcda091(0x170)),console['error'](_0xcda091(0x15f)),0x1;try{const _0x47a3c6=_0x13c1fe['parentSegment'],_0x525f91=await resolveSegmentTarget(_0xaa8ee2,_0x47a3c6,_0x13c1fe[_0xcda091(0xfe)]);_0x13c1fe[_0xcda091(0xfe)]&&console['error'](_0xcda091(0x159)+_0x525f91);const _0x5a3edf=await withSpinner(_0xcda091(0xf6)+_0xaa8ee2+'\x27...',()=>_0xff3862[_0xcda091(0x17e)][_0xcda091(0x15e)](_0x525f91),{'verbose':_0x13c1fe[_0xcda091(0xfe)]}),_0xeb0c18=_0x5a3edf[_0xcda091(0x12e)];_0x13c1fe[_0xcda091(0xfe)]&&(console[_0xcda091(0x17f)](_0xcda091(0x151)+_0xeb0c18[_0xcda091(0x106)]),console[_0xcda091(0x17f)](_0xcda091(0x16a)+_0xeb0c18['parentId']));if(_0xeb0c18[_0xcda091(0x106)]===_0xcda091(0x150))return console[_0xcda091(0x17f)](_0xcda091(0x158)),console[_0xcda091(0x17f)](_0xcda091(0x171)),0x1;if(_0xeb0c18[_0xcda091(0x106)]==='parent')return console['error'](_0xcda091(0x173)),console['error'](_0xcda091(0x145)),0x1;if(!_0xeb0c18[_0xcda091(0x167)])throw new SDKError(ErrorCode[_0xcda091(0x119)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x395b0d=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xff3862[_0xcda091(0x17e)][_0xcda091(0x135)](_0xeb0c18[_0xcda091(0xfd)],_0xeb0c18[_0xcda091(0x167)]),{'verbose':_0x13c1fe[_0xcda091(0xfe)]});let _0x587f48=_0x395b0d[_0xcda091(0x12e)];const _0x2ba76d=resolveLimit(_0x13c1fe[_0xcda091(0x14d)],DEFAULT_DISPLAY_LIMIT),_0x3e5479=/\bLIMIT\s+\d+/i[_0xcda091(0x189)](_0x587f48);!_0x3e5479&&(_0x587f48=_0x587f48[_0xcda091(0x101)]()[_0xcda091(0x175)](/;+$/,''),_0x587f48='SELECT\x20*\x20FROM\x20(\x0a'+_0x587f48+_0xcda091(0x124)+_0x2ba76d);_0x13c1fe[_0xcda091(0xfe)]&&console[_0xcda091(0x17f)]('SQL\x20query:\x0a'+_0x587f48);const _0x14b508=await withProgressSpinner('Executing\x20segment\x20query...',async _0x59b348=>{const _0x56b7fd=_0xcda091,_0xb2040f=await _0xff3862[_0x56b7fd(0x113)][_0x56b7fd(0x10b)](_0x587f48,{'catalog':'td','schema':'information_schema','onJobId':_0x13b213=>{const _0xf7ef2d=_0x56b7fd;_0x59b348[_0xf7ef2d(0x166)](_0x13b213);}});return _0xb2040f;},{'verbose':_0x13c1fe['verbose']}),_0x77938b=_0x14b508[_0xcda091(0x12e)],_0x16a0c3=_0x77938b[_0xcda091(0x12d)]?'\x20[Job\x20ID:\x20'+_0x77938b[_0xcda091(0x12d)]+']':'';return console[_0xcda091(0x17f)](_0xcda091(0x163)+_0x77938b[_0xcda091(0x190)][_0xcda091(0x134)][_0xcda091(0x183)]()+_0xcda091(0x17c)+(_0xcda091(0x18c)+formatElapsed(_0x77938b[_0xcda091(0x190)][_0xcda091(0x11f)])+_0x16a0c3)),await handleQueryOutput(_0x77938b,_0x13c1fe),0x0;}catch(_0x2c9059){if(_0x2c9059 instanceof SDKError)return console[_0xcda091(0x17f)]('β\x20Query\x20failed\x20['+_0x2c9059[_0xcda091(0x125)]+']'),console[_0xcda091(0x17f)]('\x0a'+_0x2c9059[_0xcda091(0x121)]),0x1;throw _0x2c9059;}}}export class SegmentFolderListCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x148);[a28_0x5c638e(0x13e)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a28_0x5c638e(0x10b)](_0x36616c){const _0x36de72=a28_0x5c638e,{options:_0x3d72a9,args:_0x38f4b3,tdx:_0x2d7d74}=_0x36616c;if(_0x38f4b3[_0x36de72(0x174)]===0x0)return console[_0x36de72(0x17f)](_0x36de72(0x14e)),console[_0x36de72(0x17f)](_0x36de72(0x12a)),0x1;const _0x24db88=_0x38f4b3[0x0];try{_0x3d72a9[_0x36de72(0xfe)]&&(console[_0x36de72(0x17f)]('Site:\x20'+_0x3d72a9[_0x36de72(0x164)]),console[_0x36de72(0x17f)]('Parent\x20name:\x20'+_0x24db88));const _0x3c1443=await withSpinner(_0x36de72(0x181)+_0x24db88+_0x36de72(0x191),()=>_0x2d7d74[_0x36de72(0x17e)][_0x36de72(0x118)](_0x24db88),{'verbose':_0x3d72a9[_0x36de72(0xfe)]}),_0x54bbc0=_0x3c1443['data'];_0x3d72a9[_0x36de72(0xfe)]&&console['error'](_0x36de72(0x154)+_0x54bbc0);const _0x5ef2fb=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x24db88+_0x36de72(0x191),()=>_0x2d7d74[_0x36de72(0x17e)][_0x36de72(0x176)](_0x54bbc0),{'verbose':_0x3d72a9[_0x36de72(0xfe)]}),_0x141578=_0x5ef2fb[_0x36de72(0x12e)];return console[_0x36de72(0x17f)](_0x36de72(0x14b)+_0x141578[_0x36de72(0x174)]+_0x36de72(0x161)+(_0x141578[_0x36de72(0x174)]!==0x1?'s':'')),await handleSDKOutput(_0x141578,_0x3d72a9),0x0;}catch(_0x4badf9){if(_0x4badf9 instanceof SDKError)return console[_0x36de72(0x17f)](_0x36de72(0x168)+_0x4badf9[_0x36de72(0x121)]),_0x4badf9[_0x36de72(0x110)]&&console['error']('\x20\x20Cause:\x20'+_0x4badf9[_0x36de72(0x110)]),0x1;throw _0x4badf9;}}}export class SegmentFolderShowCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x17d);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x12c);async[a28_0x5c638e(0x10b)](_0x309b11){const _0xa040a3=a28_0x5c638e,{options:_0x28f486,args:_0xf4378e,tdx:_0x475016}=_0x309b11;if(_0xf4378e['length']===0x0)return console[_0xa040a3(0x17f)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0xa040a3(0x17f)](_0xa040a3(0x105)),0x1;try{const {parentId:_0x24660d,childId:_0x49d89a}=parseSegmentRef(_0xf4378e[0x0]);_0x28f486[_0xa040a3(0xfe)]&&(console[_0xa040a3(0x17f)](_0xa040a3(0x10f)+_0x28f486[_0xa040a3(0x164)]),console['error'](_0xa040a3(0x123)+_0x24660d),_0x49d89a&&console['error'](_0xa040a3(0x131)+_0x49d89a));if(!_0x49d89a)return console[_0xa040a3(0x17f)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x7e5ade=await withSpinner(_0xa040a3(0x181)+_0x24660d+_0xa040a3(0x191),()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x118)](_0x24660d),{'verbose':_0x28f486[_0xa040a3(0xfe)]}),_0x1ca212=_0x7e5ade['data'];_0x28f486[_0xa040a3(0xfe)]&&console[_0xa040a3(0x17f)](_0xa040a3(0x154)+_0x1ca212);const _0x2a8be6=await withSpinner('Resolving\x20folder\x20\x27'+_0x49d89a+'\x27...',()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x102)](_0x1ca212,_0x49d89a),{'verbose':_0x28f486[_0xa040a3(0xfe)]}),_0x3bb3e3=_0x2a8be6['data'];_0x28f486[_0xa040a3(0xfe)]&&console[_0xa040a3(0x17f)](_0xa040a3(0x14a)+_0x3bb3e3);const _0x1f4ed3=await withSpinner(_0xa040a3(0x126)+_0x49d89a+_0xa040a3(0x191),()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x127)](_0x3bb3e3),{'verbose':_0x28f486[_0xa040a3(0xfe)]});return await handleSDKOutput([_0x1f4ed3['data']],_0x28f486),0x0;}catch(_0x2b27f9){if(_0x2b27f9 instanceof SDKError)return console[_0xa040a3(0x17f)](_0xa040a3(0x168)+_0x2b27f9[_0xa040a3(0x121)]),_0x2b27f9[_0xa040a3(0x110)]&&console[_0xa040a3(0x17f)](_0xa040a3(0xf9)+_0x2b27f9[_0xa040a3(0x110)]),0x1;throw _0x2b27f9;}}}function a28_0x4e7a(_0x4ac516,_0x5e75f1){_0x4ac516=_0x4ac516-0xf5;const _0x2575bf=a28_0x2575();let _0x4e7a18=_0x2575bf[_0x4ac516];return _0x4e7a18;}export class SegmentSQLCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x18b);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x17b);async['execute'](_0x51fc2e){const _0x21326d=a28_0x5c638e,{options:_0x13e6e2,args:_0xce3bac,tdx:_0x2ff932}=_0x51fc2e,_0x2cd3de=_0xce3bac[0x0];if(!_0x2cd3de)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x21326d(0x179)),console[_0x21326d(0x17f)](_0x21326d(0x178)),console[_0x21326d(0x17f)](_0x21326d(0x157)),console[_0x21326d(0x17f)](_0x21326d(0x165)),console[_0x21326d(0x17f)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1d0e77=_0x13e6e2[_0x21326d(0x142)],_0x25baef=await resolveSegmentTarget(_0x2cd3de,_0x1d0e77,_0x13e6e2[_0x21326d(0xfe)]);_0x13e6e2['verbose']&&console[_0x21326d(0x17f)](_0x21326d(0x159)+_0x25baef);const _0x272060=await withSpinner(_0x21326d(0xf6)+_0x2cd3de+_0x21326d(0x191),()=>_0x2ff932[_0x21326d(0x17e)][_0x21326d(0x15e)](_0x25baef),{'verbose':_0x13e6e2[_0x21326d(0xfe)]}),_0x126b92=_0x272060[_0x21326d(0x12e)];_0x13e6e2[_0x21326d(0xfe)]&&(console[_0x21326d(0x17f)](_0x21326d(0x151)+_0x126b92[_0x21326d(0x106)]),console['error'](_0x21326d(0x16a)+_0x126b92[_0x21326d(0xfd)]));if(_0x126b92[_0x21326d(0x106)]===_0x21326d(0x150))return console[_0x21326d(0x17f)](_0x21326d(0x16d)),console[_0x21326d(0x17f)](_0x21326d(0x18d)),0x1;if(_0x126b92['type']===_0x21326d(0x14c))return console['error'](_0x21326d(0x180)),console['error'](_0x21326d(0x122)),0x1;if(!_0x126b92[_0x21326d(0x167)])throw new SDKError(ErrorCode[_0x21326d(0x119)],_0x21326d(0x147));const _0x7354e7=await withSpinner(_0x21326d(0x12b),()=>_0x2ff932[_0x21326d(0x17e)][_0x21326d(0x135)](_0x126b92[_0x21326d(0xfd)],_0x126b92['segmentId']),{'verbose':_0x13e6e2['verbose']}),_0x65cbab=_0x7354e7[_0x21326d(0x12e)];return _0x13e6e2['format']===_0x21326d(0x114)||_0x13e6e2[_0x21326d(0x120)]===_0x21326d(0x18e)?await handleSDKOutput([{'sql':_0x65cbab}],_0x13e6e2):console[_0x21326d(0x128)](_0x65cbab),0x0;}catch(_0x57c2d0){if(_0x57c2d0 instanceof SDKError)return console[_0x21326d(0x17f)](_0x21326d(0x168)+_0x57c2d0[_0x21326d(0x121)]),_0x57c2d0['cause']&&console[_0x21326d(0x17f)](_0x21326d(0xf9)+_0x57c2d0[_0x21326d(0x110)]),0x1;throw _0x57c2d0;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0xf7);[a28_0x5c638e(0x13e)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x5d76d4){const _0x1368ad=a28_0x5c638e,{options:_0x3e3a28,args:_0x18fb7c,tdx:_0x33b039}=_0x5d76d4,_0x374fda=_0x3e3a28;if(_0x18fb7c[_0x1368ad(0x174)]<0x2)return console[_0x1368ad(0x17f)](_0x1368ad(0x115)),console[_0x1368ad(0x17f)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x18857a=_0x18fb7c[0x0],_0x22e1c9=_0x18fb7c[0x1];_0x374fda[_0x1368ad(0xfe)]&&(console[_0x1368ad(0x17f)](_0x1368ad(0x10f)+_0x374fda[_0x1368ad(0x164)]),console['error'](_0x1368ad(0x111)+_0x18857a),console[_0x1368ad(0x17f)](_0x1368ad(0x131)+_0x22e1c9));let _0x30a1b2;if(_0x374fda['parentFolder']){const _0x30e989=_0x374fda[_0x1368ad(0x153)],_0x5e5489=await withSpinner(_0x1368ad(0x181)+_0x18857a+'\x27...',()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x118)](_0x18857a),{'verbose':_0x374fda[_0x1368ad(0xfe)]}),_0x19ca46=_0x5e5489[_0x1368ad(0x12e)],_0x4c1801=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x30e989+_0x1368ad(0x191),()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x102)](_0x19ca46,_0x30e989),{'verbose':_0x374fda[_0x1368ad(0xfe)]});_0x30a1b2=_0x4c1801['data'],_0x374fda['verbose']&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x30a1b2);}const _0x258bce={'name':_0x22e1c9,'description':_0x374fda[_0x1368ad(0x13e)],'parentFolderId':_0x30a1b2},_0x370e0e=await withSpinner(_0x1368ad(0x13a)+_0x22e1c9+'\x27...',()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x13d)](_0x18857a,_0x258bce),{'verbose':_0x374fda[_0x1368ad(0xfe)]}),_0x1c99a5=_0x370e0e[_0x1368ad(0x12e)];return console[_0x1368ad(0x17f)]('β\x20Created\x20folder\x20\x27'+_0x1c99a5[_0x1368ad(0x16c)]+_0x1368ad(0x103)+_0x1c99a5['id']),await handleSDKOutput([_0x1c99a5],_0x374fda),0x0;}}export class SegmentViewCommand extends BaseCommand{[a28_0x5c638e(0x16c)]='segment:view';[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x129);async[a28_0x5c638e(0x10b)](_0xbcf597){const _0x1e0271=a28_0x5c638e,{options:_0x5afc3f,args:_0x567141,tdx:_0x1b3cea}=_0xbcf597,_0x490340=_0x567141[0x0];if(!_0x490340)return console[_0x1e0271(0x17f)](_0x1e0271(0x11d)),console[_0x1e0271(0x17f)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x1e0271(0x17f)](_0x1e0271(0x146)),console[_0x1e0271(0x17f)](_0x1e0271(0x117)),console[_0x1e0271(0x17f)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x1e0271(0x157)),console[_0x1e0271(0x17f)](_0x1e0271(0x116)),console[_0x1e0271(0x17f)](_0x1e0271(0x11a)),console[_0x1e0271(0x17f)](_0x1e0271(0x143)),console[_0x1e0271(0x17f)](_0x1e0271(0x17a)),0x1;try{const _0x3e51ec=_0x5afc3f[_0x1e0271(0x142)],_0x47450d=await resolveSegmentTarget(_0x490340,_0x3e51ec,_0x5afc3f[_0x1e0271(0xfe)]);_0x5afc3f['verbose']&&console[_0x1e0271(0x17f)]('Target\x20path:\x20'+_0x47450d);const _0x1cfb1f=await withSpinner(_0x1e0271(0xf6)+_0x490340+_0x1e0271(0x191),()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x15e)](_0x47450d),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]}),_0x107eb=_0x1cfb1f[_0x1e0271(0x12e)];_0x5afc3f[_0x1e0271(0xfe)]&&(console['error'](_0x1e0271(0x151)+_0x107eb[_0x1e0271(0x106)]),console[_0x1e0271(0x17f)]('Parent\x20ID:\x20'+_0x107eb[_0x1e0271(0xfd)]),_0x107eb[_0x1e0271(0x10a)]&&console[_0x1e0271(0x17f)](_0x1e0271(0x185)+_0x107eb['folderId']),_0x107eb[_0x1e0271(0x167)]&&console[_0x1e0271(0x17f)]('Segment\x20ID:\x20'+_0x107eb[_0x1e0271(0x167)]));if(_0x5afc3f[_0x1e0271(0x107)]){if(_0x107eb[_0x1e0271(0x106)]===_0x1e0271(0x150))return console[_0x1e0271(0x17f)](_0x1e0271(0x108)),0x1;if(_0x107eb['type']===_0x1e0271(0x14c))return console['error'](_0x1e0271(0x10c)),console['error'](_0x1e0271(0x139)),0x1;if(!_0x107eb[_0x1e0271(0x167)])throw new SDKError(ErrorCode[_0x1e0271(0x119)],_0x1e0271(0x147));const _0x3d3a0d=getConsoleNextUrl(_0x5afc3f[_0x1e0271(0x164)],_0x1e0271(0x16f)+_0x107eb[_0x1e0271(0xfd)]+'/e/'+_0x107eb['segmentId']);return console[_0x1e0271(0x17f)](a28_0x386346['green']('β')+_0x1e0271(0x182)+a28_0x386346[_0x1e0271(0x100)](_0x3d3a0d)),openBrowser(_0x3d3a0d),0x0;}if(_0x107eb[_0x1e0271(0x106)]===_0x1e0271(0x150)){if(!_0x107eb[_0x1e0271(0x10a)])throw new SDKError(ErrorCode[_0x1e0271(0x140)],_0x1e0271(0x16e));const _0x1c6e2a=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x127)](_0x107eb['folderId']),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]});await handleSingleObjectOutput(_0x1c6e2a[_0x1e0271(0x12e)],_0x5afc3f);}else{if(_0x107eb[_0x1e0271(0x106)]==='segment'){if(!_0x107eb['segmentId'])throw new SDKError(ErrorCode[_0x1e0271(0x119)],_0x1e0271(0x147));const _0x11a8cd=await withSpinner(_0x1e0271(0xfc),()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x155)](_0x107eb[_0x1e0271(0xfd)],_0x107eb['segmentId']),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]}),_0x2cf782=getConsoleNextUrl(_0x5afc3f['site'],_0x1e0271(0x16f)+_0x107eb[_0x1e0271(0xfd)]+'/e/'+_0x107eb[_0x1e0271(0x167)]),_0x2916bb=_0x11a8cd[_0x1e0271(0x12e)];_0x2916bb[_0x1e0271(0x16b)]=_0x2cf782,await handleSingleObjectOutput(_0x2916bb,_0x5afc3f);}else return console[_0x1e0271(0x17f)](_0x1e0271(0x184)),console[_0x1e0271(0x17f)](_0x1e0271(0x112)),0x1;}return 0x0;}catch(_0x1a0c70){if(_0x1a0c70 instanceof SDKError)return console[_0x1e0271(0x17f)](_0x1e0271(0x168)+_0x1a0c70['message']),_0x1a0c70['cause']&&console[_0x1e0271(0x17f)](_0x1e0271(0xf9)+_0x1a0c70['cause']),0x1;throw _0x1a0c70;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a28_0x5c638e(0x13b);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x104);async[a28_0x5c638e(0x10b)](_0x5a1d0f){const _0x534d32=a28_0x5c638e,{options:_0x821880,args:_0x3e8438,tdx:_0x9f06aa}=_0x5a1d0f,_0x5eecd6=_0x3e8438[0x0];if(!_0x5eecd6)return console[_0x534d32(0x17f)](_0x534d32(0x137)),console[_0x534d32(0x17f)](_0x534d32(0x136)),console[_0x534d32(0x17f)](_0x534d32(0x162)),console[_0x534d32(0x17f)](_0x534d32(0x157)),console[_0x534d32(0x17f)](_0x534d32(0x177)),console['error'](_0x534d32(0x188)),0x1;try{const _0x50de5b=_0x821880[_0x534d32(0x142)],_0x31e7c2=await resolveSegmentTarget(_0x5eecd6,_0x50de5b,_0x821880[_0x534d32(0xfe)]);_0x821880['verbose']&&console['error']('Target\x20path:\x20'+_0x31e7c2);const _0x166fcc=await withSpinner(_0x534d32(0xf6)+_0x5eecd6+_0x534d32(0x191),()=>_0x9f06aa['segment'][_0x534d32(0x15e)](_0x31e7c2),{'verbose':_0x821880[_0x534d32(0xfe)]}),_0x4880f1=_0x166fcc['data'];_0x821880[_0x534d32(0xfe)]&&(console[_0x534d32(0x17f)](_0x534d32(0x151)+_0x4880f1['type']),console[_0x534d32(0x17f)](_0x534d32(0x16a)+_0x4880f1[_0x534d32(0xfd)]));if(_0x4880f1[_0x534d32(0x106)]===_0x534d32(0x150))return console['error'](_0x534d32(0x109)),console[_0x534d32(0x17f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x4880f1[_0x534d32(0x106)]===_0x534d32(0x14c))return console['error'](_0x534d32(0x152)),console[_0x534d32(0x17f)](_0x534d32(0x11c)),0x1;if(!_0x4880f1[_0x534d32(0x167)])throw new SDKError(ErrorCode[_0x534d32(0x119)],_0x534d32(0x147));const _0x38a56d=await withSpinner(_0x534d32(0x12b),()=>_0x9f06aa[_0x534d32(0x17e)][_0x534d32(0x135)](_0x4880f1[_0x534d32(0xfd)],_0x4880f1['segmentId']),{'verbose':_0x821880[_0x534d32(0xfe)]}),_0x215532=_0x38a56d[_0x534d32(0x12e)],_0x5e31d5=await executeSchemaQuery(_0x215532,_0x9f06aa,_0x821880);return await handleQueryOutput(_0x5e31d5,_0x821880),0x0;}catch(_0x519a09){if(_0x519a09 instanceof SDKError)return console[_0x534d32(0x17f)](_0x534d32(0x168)+_0x519a09['message']),_0x519a09[_0x534d32(0x110)]&&console[_0x534d32(0x17f)](_0x534d32(0xf9)+_0x519a09[_0x534d32(0x110)]),0x1;throw _0x519a09;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x394f27=a29_0x3b27;function a29_0x3b27(_0xd043e0,_0x20c29d){_0xd043e0=_0xd043e0-0x171;const _0x407270=a29_0x4072();let _0x3b2727=_0x407270[_0xd043e0];return _0x3b2727;}(function(_0x5a943e,_0xb73640){const _0x5469cc=a29_0x3b27,_0xa51324=_0x5a943e();while(!![]){try{const _0x47f860=-parseInt(_0x5469cc(0x177))/0x1*(-parseInt(_0x5469cc(0x19c))/0x2)+-parseInt(_0x5469cc(0x182))/0x3*(-parseInt(_0x5469cc(0x196))/0x4)+-parseInt(_0x5469cc(0x195))/0x5*(-parseInt(_0x5469cc(0x1aa))/0x6)+-parseInt(_0x5469cc(0x179))/0x7+parseInt(_0x5469cc(0x17a))/0x8*(-parseInt(_0x5469cc(0x1a5))/0x9)+parseInt(_0x5469cc(0x1a1))/0xa+-parseInt(_0x5469cc(0x1a3))/0xb*(parseInt(_0x5469cc(0x18a))/0xc);if(_0x47f860===_0xb73640)break;else _0xa51324['push'](_0xa51324['shift']());}catch(_0x33a30d){_0xa51324['push'](_0xa51324['shift']());}}}(a29_0x4072,0xb82b1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a29_0x4072(){const _0x5d0af6=['execute','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x27\x20with\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Site:\x20','31513iCpGKD','Resolving\x20parent\x20segment\x20\x27','5713036fGkEyO','3088KRacLx','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','rule','resolveParentId','Resolved\x20folder\x20ID:\x20','β\x20Created\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','type','3EUCmnq','Resolved\x20relative\x20path\x20to:\x20','segment:create','folder','resolvePathToResource','kind','\x27...','Resolving\x20folder\x20path\x20\x27','12NTUrrL','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','resolveFolderId','data','Resolving\x20folder\x20\x27','length','description','Examples:','Parent:\x20','error','segment','3025925YvHkIn','2177044uHaDIN','Creating\x20segment\x20\x27','site','verbose','includes','parent','54SFoXgf','\x20\x20\x20Path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','createSegment','Target\x20path:\x20','910160EJEezA','Parent\x20path:\x20','6118871wuISbQ','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','13284ZCQDEH','yellow','segments','invisible','segmentPath','12WQbdwm','noCountPopulation','Segment\x20name:\x20'];a29_0x4072=function(){return _0x5d0af6;};return a29_0x4072();}import a29_0x2b188 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a29_0x394f27(0x172)]=a29_0x394f27(0x184);[a29_0x394f27(0x190)]=a29_0x394f27(0x19e);async[a29_0x394f27(0x171)](_0x162a81){const _0x3b04b4=a29_0x394f27;console[_0x3b04b4(0x193)](a29_0x2b188['yellow']('β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x3b04b4(0x193)](a29_0x2b188[_0x3b04b4(0x1a6)](_0x3b04b4(0x175)));const {options:_0x4082c3,args:_0x498197,tdx:_0x297f32}=_0x162a81,_0x39de1f=_0x4082c3;if(_0x498197['length']===0x0)return console[_0x3b04b4(0x193)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x3b04b4(0x180)),console[_0x3b04b4(0x193)](_0x3b04b4(0x191)),console['error'](_0x3b04b4(0x173)),console[_0x3b04b4(0x193)](_0x3b04b4(0x18b)),console[_0x3b04b4(0x193)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x224a32=_0x498197[0x0],_0x72df4b=_0x4082c3[_0x3b04b4(0x1a9)];let _0x368ae1=_0x224a32;_0x72df4b&&!_0x224a32[_0x3b04b4(0x19a)]('/')&&(_0x368ae1=_0x72df4b+'/'+_0x224a32,_0x39de1f['verbose']&&console[_0x3b04b4(0x193)](_0x3b04b4(0x183)+_0x368ae1));const _0x50bb7b=parsePath(_0x368ae1);if(_0x50bb7b[_0x3b04b4(0x1a7)][_0x3b04b4(0x18f)]<0x2)return console[_0x3b04b4(0x193)](_0x3b04b4(0x1a4)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xdb508=_0x50bb7b[_0x3b04b4(0x1a7)][0x0],_0x225648=getBaseName(_0x368ae1),_0x63caa3=getParentPath(_0x368ae1);_0x39de1f['verbose']&&(console[_0x3b04b4(0x193)](_0x3b04b4(0x176)+_0x39de1f[_0x3b04b4(0x198)]),console[_0x3b04b4(0x193)](_0x3b04b4(0x1a0)+_0x368ae1),console['error'](_0x3b04b4(0x192)+_0xdb508),console[_0x3b04b4(0x193)](_0x3b04b4(0x1ac)+_0x225648),console['error'](_0x3b04b4(0x1a2)+_0x63caa3));const _0x3abd0b=await withSpinner(_0x3b04b4(0x178)+_0xdb508+_0x3b04b4(0x188),()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x17d)](_0xdb508),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x1a56a1=_0x3abd0b['data'];let _0x5f4171;if(_0x50bb7b['segments'][_0x3b04b4(0x18f)]>0x2){const _0x5ac250=await withSpinner(_0x3b04b4(0x189)+_0x63caa3+'\x27...',()=>_0x297f32['segment'][_0x3b04b4(0x186)](_0x63caa3),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x46f927=_0x5ac250['data'];if(_0x46f927[_0x3b04b4(0x181)]!==_0x3b04b4(0x185)&&_0x46f927['type']!==_0x3b04b4(0x19b))return console['error'](_0x3b04b4(0x17b)),0x1;_0x5f4171=_0x46f927['folderId'];}else{if(_0x39de1f['folder']){const _0xd5de62=await withSpinner(_0x3b04b4(0x18e)+_0x39de1f[_0x3b04b4(0x185)]+'\x27...',()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x18c)](_0x1a56a1,_0x39de1f['folder']),{'verbose':_0x39de1f['verbose']});_0x5f4171=_0xd5de62[_0x3b04b4(0x18d)];}}_0x39de1f[_0x3b04b4(0x199)]&&_0x5f4171&&console[_0x3b04b4(0x193)](_0x3b04b4(0x17e)+_0x5f4171);const _0x3199ae=await loadJSONFromOptions(_0x39de1f[_0x3b04b4(0x17c)],_0x39de1f['ruleFile']),_0x2bf1ab={'name':_0x225648,'description':_0x39de1f[_0x3b04b4(0x190)],'rule':_0x3199ae,'kind':_0x39de1f[_0x3b04b4(0x187)]!==undefined?parseInt(_0x39de1f['kind'],0xa):undefined,'isVisible':_0x39de1f[_0x3b04b4(0x1a8)]?![]:undefined,'segmentFolderId':_0x5f4171,'countPopulation':_0x39de1f[_0x3b04b4(0x1ab)]?![]:undefined},_0x4f7cbd=await withSpinner(_0x3b04b4(0x197)+_0x225648+_0x3b04b4(0x188),()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x19f)](_0x1a56a1,_0x2bf1ab),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x189e19=_0x4f7cbd['data'];return console[_0x3b04b4(0x193)](_0x3b04b4(0x17f)+_0x189e19[_0x3b04b4(0x172)]+_0x3b04b4(0x174)+_0x189e19['id']),_0x368ae1!==_0x224a32&&console[_0x3b04b4(0x193)](_0x3b04b4(0x19d)+_0x368ae1),await handleSDKOutput([_0x189e19],_0x39de1f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x2da84a=a30_0x28b5;(function(_0x34d471,_0x4129fe){const _0x17ad2c=a30_0x28b5,_0x156b7d=_0x34d471();while(!![]){try{const _0x4b9efa=parseInt(_0x17ad2c(0x140))/0x1+parseInt(_0x17ad2c(0x149))/0x2+-parseInt(_0x17ad2c(0x135))/0x3*(parseInt(_0x17ad2c(0x142))/0x4)+parseInt(_0x17ad2c(0x139))/0x5+-parseInt(_0x17ad2c(0x13b))/0x6*(parseInt(_0x17ad2c(0x14f))/0x7)+-parseInt(_0x17ad2c(0x137))/0x8*(parseInt(_0x17ad2c(0x145))/0x9)+parseInt(_0x17ad2c(0x13e))/0xa;if(_0x4b9efa===_0x4129fe)break;else _0x156b7d['push'](_0x156b7d['shift']());}catch(_0x499908){_0x156b7d['push'](_0x156b7d['shift']());}}}(a30_0x5043,0x5471e));import{BaseCommand}from'./command.js';function a30_0x5043(){const _0x2693dd=['verbose','1198932ZUlLAF','description','\x20field','\x27...','error','execute','2552032mwLNLN','3405BLnCDs','Listing\x20fields\x20for\x20\x27','48280ONoXqf','segment:fields','652590sEvcen','Parent\x20segment:\x20','6RGYfoP','listFields','List\x20available\x20fields\x20for\x20segmentation','794240PLnfSW','name','641914PEfzgt','β\x20Found\x20','952GifMKm','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','jsonl','702FqIeXl','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a30_0x5043=function(){return _0x2693dd;};return a30_0x5043();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a30_0x28b5(_0x323b30,_0x3b0bb2){_0x323b30=_0x323b30-0x135;const _0x504349=a30_0x5043();let _0x28b57c=_0x504349[_0x323b30];return _0x28b57c;}export class SegmentFieldsCommand extends BaseCommand{[a30_0x2da84a(0x13f)]=a30_0x2da84a(0x138);[a30_0x2da84a(0x14a)]=a30_0x2da84a(0x13d);async[a30_0x2da84a(0x14e)](_0x57253d){const _0x32c3c3=a30_0x2da84a,{options:_0x14c289,args:_0x21cb22,tdx:_0x584a46}=_0x57253d,_0x219b75=_0x21cb22[0x0]||_0x14c289['parentSegment'];if(!_0x219b75)return console[_0x32c3c3(0x14d)](_0x32c3c3(0x146)),console[_0x32c3c3(0x14d)](_0x32c3c3(0x143)),console['error'](_0x32c3c3(0x147)),0x1;_0x14c289[_0x32c3c3(0x148)]&&(console[_0x32c3c3(0x14d)]('Site:\x20'+_0x14c289['site']),console[_0x32c3c3(0x14d)](_0x32c3c3(0x13a)+_0x219b75));const _0x49ac3e=await withSpinner(_0x32c3c3(0x136)+_0x219b75+_0x32c3c3(0x14c),()=>_0x584a46['segment'][_0x32c3c3(0x13c)](_0x219b75),{'verbose':_0x14c289[_0x32c3c3(0x148)]}),_0x336e06=_0x49ac3e['data'];console[_0x32c3c3(0x14d)](_0x32c3c3(0x141)+_0x336e06['length']+_0x32c3c3(0x14b)+(_0x336e06['length']!==0x1?'s':''));if(_0x14c289['json']||_0x14c289[_0x32c3c3(0x144)])return await handleSDKOutput(_0x336e06,_0x14c289),0x0;return displayFieldsHumanReadable(_0x336e06,_0x219b75),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x3121f0=a31_0x1927;(function(_0x35ea79,_0x1e5d31){const _0x4f1c2a=a31_0x1927,_0x142266=_0x35ea79();while(!![]){try{const _0x2dcbde=-parseInt(_0x4f1c2a(0x1f8))/0x1+parseInt(_0x4f1c2a(0x207))/0x2*(-parseInt(_0x4f1c2a(0x210))/0x3)+-parseInt(_0x4f1c2a(0x208))/0x4*(parseInt(_0x4f1c2a(0x1ef))/0x5)+-parseInt(_0x4f1c2a(0x1f0))/0x6+-parseInt(_0x4f1c2a(0x1f4))/0x7*(-parseInt(_0x4f1c2a(0x211))/0x8)+parseInt(_0x4f1c2a(0x212))/0x9*(parseInt(_0x4f1c2a(0x20d))/0xa)+-parseInt(_0x4f1c2a(0x220))/0xb*(-parseInt(_0x4f1c2a(0x21b))/0xc);if(_0x2dcbde===_0x1e5d31)break;else _0x142266['push'](_0x142266['shift']());}catch(_0x27712f){_0x142266['push'](_0x142266['shift']());}}}(a31_0x373a,0xa4dc1));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a31_0x5cc9f7 from'chalk';function a31_0x373a(){const _0x2ef6ce=['β\x20Context\x20set:\x20','content','name','Site:\x20','diff','no_parent','parentSegment','\x0aChanges\x20to\x20\x27','segment','absolutePath','\x20files\x20to\x20','\x20\x20Target:\x20','site','\x20\x20πΊοΈ\x20\x20','files','hasChanges','error','235xkMSiW','1479252uaqsfJ','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isNew','setPhase','91RqBSCX','dryRun','Pulling\x20segments\x20from\x20\x27','\x20unchanged\x20files','1317072mQqkwF','red','helpText','β\x20Pulled\x20','length','session','segments','dim','\x20=\x20','errorCode','cyan','\x20files?','description','Error:\x20','\x27...','39868wElaVL','106044BABfUF','parentName','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','\x20with\x20','journeyVersions','160010KVfKBy','\x20new\x20files','\x20changed\x20files','6pOolSm','234344LGJKvN','351CbqQYJ','green','\x0aPull\x20summary\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','Parent\x20segment:\x20','verbose','repeat','message','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','359988pPCcoY','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Aborted.','\x20activations','filter','924wxtfTJ','-\x20no\x20files\x20written','counts','utf-8','targetDir','yes','\x20segments','relativePath','β\x20All\x20files\x20are\x20up\x20to\x20date','data','execute','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','journeys','type','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','Target\x20resource:\x20','\x0aError:','dirname','yellow'];a31_0x373a=function(){return _0x2ef6ce;};return a31_0x373a();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a31_0x1e6ec9 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a31_0x1927(_0x27273f,_0x2cddf4){_0x27273f=_0x27273f-0x1e3;const _0x373a58=a31_0x373a();let _0x1927c7=_0x373a58[_0x27273f];return _0x1927c7;}export class SegmentPullCommand extends BaseCommand{[a31_0x3121f0(0x235)]='segment:pull';[a31_0x3121f0(0x204)]=a31_0x3121f0(0x21a);async[a31_0x3121f0(0x22a)](_0x3ac912){const _0x514297=a31_0x3121f0,{options:_0x4440ef,args:_0x1c11e4,tdx:_0x65df63}=_0x3ac912,_0x1355af=_0x4440ef,_0x2e3936=await resolveTarget({'arg':_0x1c11e4[0x0],'contextParent':_0x4440ef[_0x514297(0x1e4)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2e3936))return _0x2e3936[_0x514297(0x201)]===_0x514297(0x1e3)?(console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x514297(0x20a)),console[_0x514297(0x1ee)](_0x514297(0x22e)),console[_0x514297(0x1ee)](_0x514297(0x215))):(console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x1f9)](_0x514297(0x205)+_0x2e3936[_0x514297(0x219)]+'\x0a')),_0x2e3936[_0x514297(0x1fa)]&&console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x202)](_0x2e3936[_0x514297(0x1fa)]))),0x1;const _0x1a40bf=_0x2e3936[_0x514297(0x209)],_0x568056=_0x2e3936[_0x514297(0x224)],_0xfb3669=_0x2e3936[_0x514297(0x22d)]==='file'?_0x2e3936['resourceName']:undefined;_0x1355af[_0x514297(0x217)]&&(console[_0x514297(0x1ee)](_0x514297(0x236)+_0x1355af[_0x514297(0x1ea)]),console[_0x514297(0x1ee)](_0x514297(0x216)+_0x1a40bf),_0xfb3669&&console['error'](_0x514297(0x22f)+_0xfb3669));const _0x5f5c9e=await withProgressSpinner(_0x514297(0x1f6)+_0x1a40bf+_0x514297(0x206),_0x581581=>_0x65df63[_0x514297(0x1e6)]['pullSegments'](_0x1a40bf,{'targetDir':_0x568056,'targetResourceName':_0xfb3669,'verbose':_0x1355af[_0x514297(0x217)],'progress':{'update':_0x1cb10d=>{const _0xaa3829=_0x514297;_0x581581[_0xaa3829(0x1f3)](_0x1cb10d),_0x1355af['verbose']&&console['error']('\x20\x20'+_0x1cb10d);}}}),{'verbose':_0x1355af[_0x514297(0x217)]}),_0x2c0628=_0x5f5c9e[_0x514297(0x229)];if(_0x2c0628[_0x514297(0x222)]['segments']===0x0&&_0x2c0628[_0x514297(0x222)][_0x514297(0x22c)]===0x0)return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x22b)+_0x2c0628[_0x514297(0x209)]+'\x27')),0x0;const _0x566ed8=_0x2c0628['files']['filter'](_0x139149=>_0x139149['isNew']),_0x25b866=_0x2c0628[_0x514297(0x1ec)]['filter'](_0x58f2e7=>!_0x58f2e7[_0x514297(0x1f2)]&&_0x58f2e7[_0x514297(0x1ed)]),_0x273f39=_0x2c0628[_0x514297(0x1ec)][_0x514297(0x21f)](_0x4b7600=>!_0x4b7600[_0x514297(0x1f2)]&&!_0x4b7600[_0x514297(0x1ed)]);console[_0x514297(0x1ee)](_0x514297(0x214)+_0x2c0628[_0x514297(0x209)]+'\x27:'),console[_0x514297(0x1ee)]('\x20\x20π―\x20'+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628['counts'][_0x514297(0x1fe)]+_0x514297(0x226))+_0x514297(0x20b)+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628[_0x514297(0x222)]['activations']+_0x514297(0x21e)));if(_0x2c0628[_0x514297(0x222)]['journeys']>0x0){const _0x23fccc=_0x2c0628['counts'][_0x514297(0x20c)]>_0x2c0628[_0x514297(0x222)]['journeys']?'\x20('+_0x2c0628[_0x514297(0x222)]['journeyVersions']+'\x20versions)':'';console[_0x514297(0x1ee)](_0x514297(0x1eb)+a31_0x5cc9f7['cyan'](_0x2c0628[_0x514297(0x222)][_0x514297(0x22c)]+'\x20journeys')+a31_0x5cc9f7['dim'](_0x23fccc));}console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x213)]('+\x20'+_0x566ed8[_0x514297(0x1fc)]+_0x514297(0x20e))),console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x232)]('~\x20'+_0x25b866[_0x514297(0x1fc)]+_0x514297(0x20f))),console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x1ff)]('=\x20'+_0x273f39[_0x514297(0x1fc)]+_0x514297(0x1f7))),console['error'](_0x514297(0x1e9)+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628['targetDir'])+'\x0a');if(_0x25b866[_0x514297(0x1fc)]>0x0)for(const _0x1bf808 of _0x25b866){console[_0x514297(0x1ee)](_0x514297(0x1e5)+_0x1bf808[_0x514297(0x227)]+'\x27:'),console[_0x514297(0x1ee)]('β'[_0x514297(0x218)](0x3c)),console[_0x514297(0x1ee)](_0x1bf808[_0x514297(0x237)]),console['error']('β'[_0x514297(0x218)](0x3c));}if(_0x1355af[_0x514297(0x1f5)])return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x21c))),0x0;if(_0x566ed8[_0x514297(0x1fc)]===0x0&&_0x25b866['length']===0x0)return console['error'](a31_0x5cc9f7['green'](_0x514297(0x228))),saveSessionContext({'parent_segment':_0x2c0628[_0x514297(0x209)]},_0x1355af[_0x514297(0x1fd)]),console['error'](a31_0x5cc9f7[_0x514297(0x213)](_0x514297(0x233)+a31_0x5cc9f7[_0x514297(0x1ff)]('parent_segment')+_0x514297(0x200)+a31_0x5cc9f7['cyan'](_0x2c0628[_0x514297(0x209)]))),0x0;if(!_0x1355af[_0x514297(0x225)]){if(!isInteractive())return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x1f9)](_0x514297(0x230)),_0x514297(0x1f1)),console[_0x514297(0x1ee)](a31_0x5cc9f7['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1477c5=await confirmKey('Write\x20'+(_0x566ed8[_0x514297(0x1fc)]+_0x25b866[_0x514297(0x1fc)])+_0x514297(0x203));if(!_0x1477c5)return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x21d)),_0x514297(0x221)),0x1;}for(const _0x33b83c of _0x2c0628[_0x514297(0x1ec)]){if(_0x33b83c[_0x514297(0x1f2)]||_0x33b83c['hasChanges']){const _0x61bac3=a31_0x1e6ec9[_0x514297(0x231)](_0x33b83c[_0x514297(0x1e7)]);!existsSync(_0x61bac3)&&mkdirSync(_0x61bac3,{'recursive':!![]}),writeFileSync(_0x33b83c[_0x514297(0x1e7)],_0x33b83c[_0x514297(0x234)],_0x514297(0x223));}}return console['error'](a31_0x5cc9f7['green'](_0x514297(0x1fb)+(_0x566ed8[_0x514297(0x1fc)]+_0x25b866[_0x514297(0x1fc)])+_0x514297(0x1e8)+_0x2c0628[_0x514297(0x224)])),saveSessionContext({'parent_segment':_0x2c0628[_0x514297(0x209)]},_0x1355af[_0x514297(0x1fd)]),console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x213)]('β\x20Context\x20set:\x20'+a31_0x5cc9f7['dim']('parent_segment')+'\x20=\x20'+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628[_0x514297(0x209)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x2e290d=a32_0x3e84;(function(_0x4e878b,_0x361e15){const _0x48c1fc=a32_0x3e84,_0x3e37e9=_0x4e878b();while(!![]){try{const _0x2ea491=-parseInt(_0x48c1fc(0x14a))/0x1+parseInt(_0x48c1fc(0xe6))/0x2*(parseInt(_0x48c1fc(0x12d))/0x3)+parseInt(_0x48c1fc(0xef))/0x4*(parseInt(_0x48c1fc(0xd8))/0x5)+parseInt(_0x48c1fc(0xf5))/0x6*(parseInt(_0x48c1fc(0xcd))/0x7)+parseInt(_0x48c1fc(0x137))/0x8+parseInt(_0x48c1fc(0x12a))/0x9*(parseInt(_0x48c1fc(0x13c))/0xa)+-parseInt(_0x48c1fc(0xd7))/0xb;if(_0x2ea491===_0x361e15)break;else _0x3e37e9['push'](_0x3e37e9['shift']());}catch(_0x75f201){_0x3e37e9['push'](_0x3e37e9['shift']());}}}(a32_0x2db3,0x79ac1));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';function a32_0x2db3(){const _0x34ad1c=['updated','\x27...','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','128532uvVxDD','β\x20All\x20journeys\x20are\x20up\x20to\x20date','connection','journeyBundleName','(Journey\x20will\x20be\x20deleted)','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','78OvUBuA','all','Error:\x20Directory\x20not\x20found:\x20','journeys','type','toDelete','\x20\x20π\x20Segments:','Aborted.','helpText','Fetching\x20existing\x20activations...','deleted','dryRun','new','list','\x0aPush\x20summary\x20for\x20\x27','segment:push','verbose','join','\x0aValidation\x20failed:','segmentFolderId','isNew','Scoped\x20to\x20folder:\x20','error','Preparing\x20journeys...','push','errorCode','segments','yes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','resolveParentId','repeat','π\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20to\x20update','.yaml','/app/ps/','site','setPhase','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','relationships','\x20deleted','\x20YAML\x20files\x20found','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','user','data','existingJourney','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','get','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','cyan','results','2640915bDaYUz','folders','set','21OhrZaK','idToName','description','Fetching\x20connections\x20for\x20name\x20resolution...','toUpdate','listActivations','getJourney','\x20to\x20delete','attributes','\x20\x20Activations:\x20','7765312ICdenT','journeyId','\x20folders\x20to\x20create','createdSegmentIds','file','30CLaEuK','created','yamlConfig','activations','\x20to\x20create','message','nameToId','filePath','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','cwd','Parent\x20segment:\x20','Changes\x20to:','\x20new','Fetching\x20existing\x20journeys...','30999VUvCTe','Source\x20directory:\x20','isScoped','map','dim','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','state','getParent','\x20created','diff','toCreate','\x20\x20\x20\x20','listSegments','segment','\x20\x20πΊοΈ\x20\x20Journeys:','\x20unchanged','blue','\x20updated','buildUserMaps','updatedAt','targetDir','length','/j/da/je','journeysOnly','delete','green','parentFolder','Push\x20','toString','Delete\x20segment:','yellow','red','filter','531951EGbsDk','/e/','changed','New\x20journey:','no_parent','name','journeyBundleId','Site:\x20','add','folderPath','33356026mIQWBz','25IxPwwa','endsWith','No\x20','journey','unchanged','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20changed','\x20\x20Source:\x20','\x20\x20Activations:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20activations]','audienceId','then','\x20\x20Journeys:\x20','160626FHGuLb','segment\x20or\x20journey','\x20changes?','New\x20segment:','\x0aError:','Error:\x20'];a32_0x2db3=function(){return _0x34ad1c;};return a32_0x2db3();}import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a32_0xb1a1f5 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a32_0x3e84(_0x134d42,_0x5772ce){_0x134d42=_0x134d42-0xb2;const _0x2db397=a32_0x2db3();let _0x3e8437=_0x2db397[_0x134d42];return _0x3e8437;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a32_0x2e290d(0xd2)]=a32_0x2e290d(0x104);[a32_0x2e290d(0x12f)]=a32_0x2e290d(0x127);async['execute'](_0x16e3d9){const _0x3a61ff=a32_0x2e290d,{options:_0x5f1d4d,args:_0x43f0a1,tdx:_0x388d73}=_0x16e3d9,_0x104061=_0x5f1d4d,_0x29c295=await resolveTarget({'arg':_0x43f0a1[0x0],'contextParent':_0x5f1d4d['parentSegment'],'cwd':process[_0x3a61ff(0x145)]()});if(!isSuccessfulResolution(_0x29c295))return _0x29c295[_0x3a61ff(0x10e)]===_0x3a61ff(0xd1)?(console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xca)](_0x3a61ff(0x111))),console['error']('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x3a61ff(0x10b)](_0x3a61ff(0xe1)),console[_0x3a61ff(0x10b)](_0x3a61ff(0xdd))):(console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0xeb)+_0x29c295[_0x3a61ff(0x141)]+'\x0a')),_0x29c295[_0x3a61ff(0xfd)]&&console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0x128)](_0x29c295[_0x3a61ff(0xfd)]))),0x1;if(_0x29c295[_0x3a61ff(0xf9)]==='parent_name')return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0xf7)+_0x29c295[_0x3a61ff(0xc0)]+'\x0a')),console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0x128)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x463e27=_0x29c295['parentName'],_0x532a2d=_0x29c295[_0x3a61ff(0xc0)],_0x20c13a=_0x29c295[_0x3a61ff(0xf9)]===_0x3a61ff(0x13b)?_0x29c295[_0x3a61ff(0x143)]:undefined,_0x39878c=getScopedDetails(_0x29c295),_0x17ce6a=_0x39878c?.[_0x3a61ff(0x14c)]??![],_0x429a5=_0x39878c?.['scopedFolderPath']??'';if(!existsSync(_0x532a2d))return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0xf7)+_0x532a2d+'\x0a')),console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0x128)](_0x3a61ff(0x124))),0x1;_0x104061[_0x3a61ff(0x105)]&&(console[_0x3a61ff(0x10b)](_0x3a61ff(0xd4)+_0x104061[_0x3a61ff(0x119)]),console[_0x3a61ff(0x10b)](_0x3a61ff(0x146)+_0x463e27),console['error'](_0x3a61ff(0x14b)+_0x532a2d),_0x17ce6a&&console[_0x3a61ff(0x10b)](_0x3a61ff(0x10a)+_0x429a5));const _0x36f99d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x463e27+_0x3a61ff(0xed),()=>_0x388d73[_0x3a61ff(0xb9)][_0x3a61ff(0x112)](_0x463e27),{'verbose':_0x104061[_0x3a61ff(0x105)]}),_0x50ecb3=_0x36f99d[_0x3a61ff(0x121)],[_0x45a099,_0x7be030,_0x268b4b,_0xe0c51f,_0x484900]=await Promise[_0x3a61ff(0xf6)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x388d73['segment'][_0x3a61ff(0xb3)](_0x50ecb3),{'verbose':_0x104061[_0x3a61ff(0x105)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x388d73[_0x3a61ff(0xb9)][_0x3a61ff(0xb8)](_0x50ecb3),{'verbose':_0x104061[_0x3a61ff(0x105)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x388d73['segment']['listFolders'](_0x50ecb3),{'verbose':_0x104061[_0x3a61ff(0x105)]}),withSpinner(_0x3a61ff(0x149),()=>_0x388d73[_0x3a61ff(0xdb)]['listJourneysWithDetailsFromParentSegment'](_0x50ecb3,{'includeAllVersions':!![]}),{'verbose':_0x104061['verbose']}),withSpinner(_0x3a61ff(0x115),()=>_0x388d73[_0x3a61ff(0x120)][_0x3a61ff(0xbe)](),{'verbose':_0x104061[_0x3a61ff(0x105)]})['then'](_0x32d17b=>_0x32d17b['data'])]),_0x5106ce=_0x45a099[_0x3a61ff(0x121)],_0x2fbb20=extractRootFolderId(_0x5106ce),_0x1b9f4b=_0x7be030[_0x3a61ff(0x121)],_0x1a6928=_0x268b4b[_0x3a61ff(0x121)],{journeys:_0x311d55,activationStepsById:_0x4a9cba}=_0xe0c51f[_0x3a61ff(0x121)],_0x1c7837=new Map(_0x311d55[_0x3a61ff(0x14d)](_0x483e37=>[_0x483e37['id'],_0x483e37])),_0xfd1e4e=_0x311d55['map'](_0x21aeec=>({'id':_0x21aeec['id'],'name':_0x21aeec[_0x3a61ff(0x135)][_0x3a61ff(0xd2)],'journeyBundleName':_0x21aeec['attributes']['journeyBundleName']||'','journeyBundleId':_0x21aeec[_0x3a61ff(0x135)][_0x3a61ff(0xd3)]||'','versionNumber':_0x21aeec[_0x3a61ff(0x135)]['versionNumber'],'description':_0x21aeec[_0x3a61ff(0x135)][_0x3a61ff(0x12f)],'state':_0x21aeec['attributes'][_0x3a61ff(0xb2)],'paused':_0x21aeec[_0x3a61ff(0x135)]['paused'],'audienceId':_0x21aeec['attributes'][_0x3a61ff(0xe3)],'folderId':_0x21aeec[_0x3a61ff(0x11c)]?.[_0x3a61ff(0xc6)]?.['data']?.['id'],'createdAt':_0x21aeec[_0x3a61ff(0x135)]['createdAt'],'updatedAt':_0x21aeec[_0x3a61ff(0x135)][_0x3a61ff(0xbf)]})),{emailToId:_0x31ab36,idToEmail:_0x3a0eb4}=_0x484900,_0x37077d=await withSpinner(_0x3a61ff(0x130),async()=>{const _0x56eceb=_0x3a61ff,_0x2a0ff4=await _0x388d73['connection'][_0x56eceb(0x102)]();return buildConnectionMaps(_0x2a0ff4);},{'verbose':_0x104061[_0x3a61ff(0x105)]})[_0x3a61ff(0xe4)](_0xc6a10c=>_0xc6a10c[_0x3a61ff(0x121)]),_0x61fd74=_0x37077d[_0x3a61ff(0x142)],_0x288553=_0x37077d[_0x3a61ff(0x12e)],_0x3ff99c=_0x37077d['nameToType'],_0x37a2ef={'emailToIdMap':_0x31ab36,'connectionNameToIdMap':_0x61fd74,'connectionNameToTypeMap':_0x3ff99c,'getSchema':_0x117bc8=>_0x388d73[_0x3a61ff(0xf1)]['getOutputSchemaWithCache'](_0x117bc8)};let {pathToId:_0x4c1da2,idToPath:_0x3a0f08}=buildFolderMaps(_0x1a6928);const _0x16c67e=buildSegmentLookupMap(_0x1b9f4b,_0x3a0f08),_0x495ab0=buildSegmentNameToIdMap(_0x1b9f4b),_0x1c6862=buildJourneyBundleLookupMap(_0xfd1e4e,_0x3a0f08);let _0x1e9e0c;if(_0x20c13a){if(!_0x20c13a['endsWith']('.yml')&&!_0x20c13a[_0x3a61ff(0xd9)](_0x3a61ff(0x117)))return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x20c13a+'\x0a')),0x1;_0x1e9e0c=[_0x20c13a];}else _0x1e9e0c=findYamlFiles(_0x532a2d);if(_0x1e9e0c[_0x3a61ff(0xc1)]===0x0)return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0x14f)+_0x532a2d+'\x0a')),console[_0x3a61ff(0x10b)](a32_0xb1a1f5['cyan'](_0x3a61ff(0x123))),0x1;let _0x5063a5,_0x56c0f8;try{const _0x1250e8=parseAndClassifyYamlFiles(_0x1e9e0c,_0x532a2d,{'skipSegments':_0x104061[_0x3a61ff(0xc3)]});_0x5063a5=_0x1250e8[_0x3a61ff(0x10f)],_0x56c0f8=_0x1250e8[_0x3a61ff(0xf8)];const _0x814588=validateParsedFiles(_0x1250e8,_0x532a2d);if(_0x814588['length']>0x0)return console[_0x3a61ff(0x10b)](a32_0xb1a1f5['red'](_0x3a61ff(0x107))),console[_0x3a61ff(0x10b)](formatValidationErrors(_0x814588)),console['error'](a32_0xb1a1f5[_0x3a61ff(0xca)](_0x3a61ff(0x126))),0x1;}catch(_0x26e874){return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)]('Error\x20parsing\x20YAML:\x20'+(_0x26e874 instanceof Error?_0x26e874[_0x3a61ff(0x141)]:_0x26e874))),0x1;}if(_0x5063a5['length']===0x0&&_0x56c0f8['length']===0x0){const _0x5f0ba8=_0x104061[_0x3a61ff(0xc3)]?_0x3a61ff(0xdb):_0x3a61ff(0xe7);return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xca)](_0x3a61ff(0xda)+_0x5f0ba8+_0x3a61ff(0x11e))),0x0;}const _0xbd025a=new Map();_0x1b9f4b[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc3)]&&await withSpinner(_0x3a61ff(0xfe),async()=>{await batchAsync(_0x1b9f4b,async _0xcb2d4=>{const _0xce868a=a32_0x3e84,_0x105d4c=await _0x388d73['segment'][_0xce868a(0x132)](_0x50ecb3,_0xcb2d4['id']);_0xbd025a[_0xce868a(0x12c)](_0xcb2d4['id'],_0x105d4c);});},{'verbose':_0x104061[_0x3a61ff(0x105)]});const {segmentFiles:_0x1c1fa4,foldersToCreate:_0x6ec9ea}=await prepareSegmentFiles(_0x5063a5,{'segmentByFolderAndName':_0x16c67e,'activationsBySegmentId':_0xbd025a,'folderPathToId':_0x4c1da2,'idToEmailMap':_0x3a0eb4,'connectionIdToNameMap':_0x288553},_0x37a2ef,_0x17ce6a,_0x429a5),_0x2cbcf2=_0x20c13a?[]:findSegmentsToDelete(_0x1b9f4b,_0x5063a5[_0x3a61ff(0x14d)](({yamlConfig:_0x5d325d,folderPath:_0x227c05})=>({'yamlConfig':_0x5d325d,'folderPath':resolveTDFolderPath(_0x227c05,_0x17ce6a,_0x429a5)})),_0x3a0f08,_0x429a5,_0x17ce6a),{journeyFiles:_0x26c8ac,foldersToCreate:_0x2edb4b}=await withProgressSpinner(_0x3a61ff(0x10c),async _0x346434=>prepareJourneyFiles(_0x56c0f8,{'fetchJourney':async _0x143a45=>_0x388d73[_0x3a61ff(0xdb)][_0x3a61ff(0x133)](_0x143a45[_0x3a61ff(0x138)]),'journeyBundlesByFolderAndName':_0x1c6862,'folderPathToId':_0x4c1da2,'idToEmailMap':_0x3a0eb4,'connectionIdToNameMap':_0x288553,'existingSegments':_0x1b9f4b,'parentId':_0x50ecb3,'deps':_0x388d73,'progress':{'update':_0xdd1432=>{const _0x294b2f=_0x3a61ff;_0x346434[_0x294b2f(0x11a)](_0xdd1432),_0x104061[_0x294b2f(0x105)]&&console[_0x294b2f(0x10b)]('\x20\x20'+_0xdd1432);}},'journeyById':_0x1c7837,'activationStepsById':_0x4a9cba},_0x17ce6a,_0x429a5),{'verbose':_0x104061[_0x3a61ff(0x105)]})[_0x3a61ff(0xe4)](_0x45cf21=>_0x45cf21[_0x3a61ff(0x121)]);for(const _0x37244f of _0x2edb4b){_0x6ec9ea[_0x3a61ff(0xd5)](_0x37244f);}const _0x5db6c2=_0x20c13a?[]:findJourneysToDelete(_0xfd1e4e,_0x56c0f8[_0x3a61ff(0x14d)](({yamlConfig:_0x4115af,folderPath:_0x2c055f})=>({'yamlConfig':_0x4115af,'folderPath':resolveTDFolderPath(_0x2c055f,_0x17ce6a,_0x429a5)})),_0x3a0f08,_0x429a5,_0x17ce6a),_0xf39947=calculatePushStats(_0x1c1fa4,_0x26c8ac,_0x6ec9ea,_0x2cbcf2,_0x5db6c2,!!_0x104061[_0x3a61ff(0xc4)],!!_0x104061[_0x3a61ff(0xc3)]),_0x1941d6=_0xf39947[_0x3a61ff(0x10f)][_0x3a61ff(0x101)],_0x131f39=_0xf39947['segments']['changed'],_0x2512b9=_0xf39947[_0x3a61ff(0x10f)][_0x3a61ff(0xdc)],_0x8f9d5d=_0xf39947[_0x3a61ff(0x10f)][_0x3a61ff(0xfa)],_0x1843e4=_0xf39947[_0x3a61ff(0x12b)][_0x3a61ff(0xb6)],_0x3c34b0=_0xf39947[_0x3a61ff(0xf8)][_0x3a61ff(0x101)],_0x4d0fdf=_0xf39947[_0x3a61ff(0xf8)][_0x3a61ff(0xcf)],_0x175f07=_0xf39947['journeys'][_0x3a61ff(0xdc)],_0x14674c=_0xf39947['journeys'][_0x3a61ff(0xfa)],_0xf67883=_0xf39947['activations'][_0x3a61ff(0xf6)],_0x3052e2=_0xf39947[_0x3a61ff(0x13f)][_0x3a61ff(0xb6)],_0x4f98fc=_0xf39947[_0x3a61ff(0x13f)][_0x3a61ff(0x131)],_0x11bd97=_0xf39947[_0x3a61ff(0x13f)]['toDelete'];console['error'](_0x3a61ff(0x103)+_0x463e27+'\x27:');_0x1843e4[_0x3a61ff(0xc1)]>0x0&&console[_0x3a61ff(0x10b)]('\x20\x20'+a32_0xb1a1f5['blue'](_0x3a61ff(0x114)+_0x1843e4[_0x3a61ff(0xc1)]+_0x3a61ff(0x139)));if(!_0x104061[_0x3a61ff(0xc3)]){console['error'](_0x3a61ff(0xfb)),console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5['green']('+\x20'+_0x1941d6[_0x3a61ff(0xc1)]+'\x20new')),console[_0x3a61ff(0x10b)]('\x20\x20\x20\x20'+a32_0xb1a1f5[_0x3a61ff(0xca)]('~\x20'+_0x131f39[_0x3a61ff(0xc1)]+_0x3a61ff(0xde)));if(_0x8f9d5d['length']>0x0)console[_0x3a61ff(0x10b)]('\x20\x20\x20\x20'+a32_0xb1a1f5[_0x3a61ff(0xcb)]('-\x20'+_0x8f9d5d['length']+_0x3a61ff(0x134)));else _0x2cbcf2[_0x3a61ff(0xc1)]>0x0&&!_0x104061['delete']&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5['dim'](_0x2cbcf2[_0x3a61ff(0xc1)]+_0x3a61ff(0xee)));console['error'](_0x3a61ff(0xb7)+a32_0xb1a1f5[_0x3a61ff(0x14e)]('=\x20'+_0x2512b9[_0x3a61ff(0xc1)]+'\x20unchanged'));}if(_0x26c8ac[_0x3a61ff(0xc1)]>0x0||_0x5db6c2['length']>0x0){console[_0x3a61ff(0x10b)](_0x3a61ff(0xba)),console[_0x3a61ff(0x10b)]('\x20\x20\x20\x20'+a32_0xb1a1f5['green']('+\x20'+_0x3c34b0[_0x3a61ff(0xc1)]+_0x3a61ff(0x148))),console['error'](_0x3a61ff(0xb7)+a32_0xb1a1f5[_0x3a61ff(0xca)]('~\x20'+_0x4d0fdf[_0x3a61ff(0xc1)]+_0x3a61ff(0xde)));if(_0x14674c[_0x3a61ff(0xc1)]>0x0)console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5['red']('-\x20'+_0x14674c[_0x3a61ff(0xc1)]+_0x3a61ff(0x134)));else _0x5db6c2[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc4)]&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5[_0x3a61ff(0x14e)](_0x5db6c2[_0x3a61ff(0xc1)]+_0x3a61ff(0xee)));console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5[_0x3a61ff(0x14e)]('=\x20'+_0x175f07['length']+_0x3a61ff(0xbb)));}_0xf67883[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc3)]&&(console[_0x3a61ff(0x10b)](''),console['error'](_0x3a61ff(0xe0)),_0x3052e2[_0x3a61ff(0xc1)]>0x0&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5['green']('+\x20'+_0x3052e2[_0x3a61ff(0xc1)]+_0x3a61ff(0x140))),_0x4f98fc[_0x3a61ff(0xc1)]>0x0&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5['yellow']('~\x20'+_0x4f98fc[_0x3a61ff(0xc1)]+_0x3a61ff(0x116))),_0x11bd97[_0x3a61ff(0xc1)]>0x0&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xb7)+a32_0xb1a1f5[_0x3a61ff(0xcb)]('-\x20'+_0x11bd97[_0x3a61ff(0xc1)]+_0x3a61ff(0x134))));console[_0x3a61ff(0x10b)](_0x3a61ff(0xdf)+a32_0xb1a1f5[_0x3a61ff(0x128)](_0x532a2d)+'\x0a');if(_0x1843e4[_0x3a61ff(0xc1)]>0x0){console[_0x3a61ff(0x10b)]('Folders\x20to\x20create:');for(const _0x4a2748 of _0x1843e4){console['error']('\x20\x20'+a32_0xb1a1f5[_0x3a61ff(0xbc)]('+')+'\x20'+_0x4a2748);}console[_0x3a61ff(0x10b)]('');}if(_0x1941d6[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc3)])for(const _0x257905 of _0x1941d6){const _0x58fffe=_0x257905['folderPath']?_0x257905[_0x3a61ff(0xd6)]+'/'+_0x257905[_0x3a61ff(0x13e)]['name']:_0x257905[_0x3a61ff(0x13e)][_0x3a61ff(0xd2)],_0x51bb74=_0x257905['yamlConfig'][_0x3a61ff(0x13f)]?.[_0x3a61ff(0xc1)]||0x0,_0x42dc54=_0x51bb74>0x0?a32_0xb1a1f5[_0x3a61ff(0x14e)]('\x20['+_0x51bb74+'\x20activations]'):'';console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5['green'](_0x3a61ff(0xe9))+'\x20'+_0x58fffe+_0x42dc54),console['error']('β'['repeat'](0x3c)),_0x257905[_0x3a61ff(0xb5)]&&console[_0x3a61ff(0x10b)](_0x257905[_0x3a61ff(0xb5)]),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));}if(_0x8f9d5d[_0x3a61ff(0xc1)]>0x0&&!_0x104061['journeysOnly'])for(const _0x1a4af4 of _0x8f9d5d){const _0x5cc1e7=_0x1a4af4[_0x3a61ff(0x108)]?_0x3a0f08[_0x3a61ff(0x125)](_0x1a4af4[_0x3a61ff(0x108)][_0x3a61ff(0xc8)]())||'':'',_0x54274f=_0x5cc1e7?_0x5cc1e7+'/'+_0x1a4af4[_0x3a61ff(0xd2)]:_0x1a4af4[_0x3a61ff(0xd2)],_0x38e894=_0xbd025a[_0x3a61ff(0x125)](_0x1a4af4['id'])||[],_0x57eafc=_0x38e894[_0x3a61ff(0xc1)]>0x0?a32_0xb1a1f5['dim']('\x20['+_0x38e894['length']+_0x3a61ff(0xe2)):'';console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5['red'](_0x3a61ff(0xc9))+'\x20'+_0x54274f+_0x57eafc),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));const _0x2a55d6=segmentWithActivationsToYaml(_0x1a4af4,_0x38e894,undefined,_0x3a0eb4,_0x288553),_0x592740=segmentToYamlString(_0x2a55d6),_0x2e9850=generateDiff(_0x592740,'');console['error'](formatDiffWithColors(_0x2e9850)),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));}const _0x510360=_0x1c1fa4[_0x3a61ff(0xcc)](_0x495613=>!_0x495613[_0x3a61ff(0x109)]&&_0x495613[_0x3a61ff(0xb5)]);if(_0x510360[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc3)])for(const _0x2aa7bd of _0x510360){const _0x83f747=_0x2aa7bd['folderPath']?_0x2aa7bd[_0x3a61ff(0xd6)]+'/'+_0x2aa7bd['yamlConfig'][_0x3a61ff(0xd2)]:_0x2aa7bd['yamlConfig'][_0x3a61ff(0xd2)];console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5['yellow'](_0x3a61ff(0x147))+'\x20'+_0x83f747),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c)),console[_0x3a61ff(0x10b)](_0x2aa7bd[_0x3a61ff(0xb5)]),console[_0x3a61ff(0x10b)]('β'['repeat'](0x3c));}if(_0x3c34b0[_0x3a61ff(0xc1)]>0x0)for(const _0x4fac5b of _0x3c34b0){const _0x2b7cf7=_0x4fac5b[_0x3a61ff(0xd6)]?_0x4fac5b['folderPath']+'/'+_0x4fac5b['yamlConfig'][_0x3a61ff(0xd2)]:_0x4fac5b[_0x3a61ff(0x13e)]['name'];console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5[_0x3a61ff(0xc5)](_0x3a61ff(0xd0))+'\x20'+_0x2b7cf7),console[_0x3a61ff(0x10b)]('β'['repeat'](0x3c)),_0x4fac5b[_0x3a61ff(0xb5)]&&console[_0x3a61ff(0x10b)](_0x4fac5b['diff']),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));}const _0x2f36a6=_0x26c8ac[_0x3a61ff(0xcc)](_0x2c3bbe=>!_0x2c3bbe[_0x3a61ff(0x109)]&&_0x2c3bbe[_0x3a61ff(0xb5)]);if(_0x2f36a6[_0x3a61ff(0xc1)]>0x0)for(const _0x39f0e8 of _0x2f36a6){const _0x398d9a=_0x39f0e8['folderPath']?_0x39f0e8[_0x3a61ff(0xd6)]+'/'+_0x39f0e8[_0x3a61ff(0x13e)][_0x3a61ff(0xd2)]:_0x39f0e8[_0x3a61ff(0x13e)][_0x3a61ff(0xd2)];console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5['yellow']('Changes\x20to\x20journey:')+'\x20'+_0x398d9a),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c)),console[_0x3a61ff(0x10b)](_0x39f0e8['diff']),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));}if(_0x14674c['length']>0x0)for(const _0x23c5c2 of _0x14674c){const _0x56a6aa=_0x23c5c2['folderId']?_0x3a0f08[_0x3a61ff(0x125)](_0x23c5c2['folderId'])||'':'',_0x1bef50=_0x56a6aa?_0x56a6aa+'/'+_0x23c5c2[_0x3a61ff(0xf2)]:_0x23c5c2[_0x3a61ff(0xf2)];console[_0x3a61ff(0x10b)]('\x0a'+a32_0xb1a1f5['red']('Delete\x20journey:')+'\x20'+_0x1bef50),console['error']('β'['repeat'](0x3c)),console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0xf3))),console[_0x3a61ff(0x10b)]('β'[_0x3a61ff(0x113)](0x3c));}if(_0x104061[_0x3a61ff(0x100)])return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xca)](_0x3a61ff(0xf4))),0x0;const _0x567ffa=_0x104061[_0x3a61ff(0xc3)]?![]:_0x1941d6[_0x3a61ff(0xc1)]>0x0||_0x131f39[_0x3a61ff(0xc1)]>0x0||_0x8f9d5d[_0x3a61ff(0xc1)]>0x0,_0x404e1d=_0x3c34b0[_0x3a61ff(0xc1)]>0x0||_0x4d0fdf[_0x3a61ff(0xc1)]>0x0||_0x14674c[_0x3a61ff(0xc1)]>0x0,_0x2c310e=_0x104061['journeysOnly']?![]:_0xf67883[_0x3a61ff(0xc1)]>0x0,_0x3476df=_0x1843e4[_0x3a61ff(0xc1)]>0x0;if(!_0x567ffa&&!_0x404e1d&&!_0x2c310e&&!_0x3476df){const _0x250301=_0x104061[_0x3a61ff(0xc3)]?_0x3a61ff(0xf0):_0x3a61ff(0x144);console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xc5)](_0x250301));if(_0x20c13a&&_0x175f07['length']===0x1){const _0x5b2b3f=_0x175f07[0x0];if(_0x5b2b3f[_0x3a61ff(0x122)]?.['id']){const _0x181256=getConsoleNextUrl(_0x104061[_0x3a61ff(0x119)],_0x3a61ff(0x118)+_0x50ecb3+_0x3a61ff(0xce)+_0x5b2b3f[_0x3a61ff(0x122)]['id']+'/j/da/je');console[_0x3a61ff(0x10b)]('\x20\x20'+a32_0xb1a1f5['cyan'](_0x181256));}}return 0x0;}const _0x114aae=_0x104061['journeysOnly']?_0x3c34b0[_0x3a61ff(0xc1)]+_0x4d0fdf[_0x3a61ff(0xc1)]+_0x14674c[_0x3a61ff(0xc1)]+_0x1843e4['length']:_0x1941d6[_0x3a61ff(0xc1)]+_0x131f39['length']+_0x8f9d5d[_0x3a61ff(0xc1)]+_0x3c34b0[_0x3a61ff(0xc1)]+_0x4d0fdf[_0x3a61ff(0xc1)]+_0x14674c['length']+_0x1843e4[_0x3a61ff(0xc1)]+_0xf67883[_0x3a61ff(0xc1)];if(!_0x104061[_0x3a61ff(0x110)]&&_0x114aae>0x0){if(!isInteractive())return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)](_0x3a61ff(0xea)),_0x3a61ff(0x11f)),console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0x14e)](_0x3a61ff(0x11b))),0x1;const _0x29234c=await confirmKey(_0x3a61ff(0xc7)+_0x114aae+_0x3a61ff(0xe8));if(!_0x29234c)return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xca)](_0x3a61ff(0xfc))),0x1;}const _0x39443d={'withProgress':async(_0x53c167,_0x2eac39)=>{const _0x363893=await withSpinner(_0x53c167,_0x2eac39,{'verbose':_0x104061['verbose']});return{'data':_0x363893['data']};},'logInfo':_0x4e97df=>console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xbc)]('β\x20'+_0x4e97df)),'logSuccess':_0x54d1a8=>console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xc5)]('β\x20'+_0x54d1a8)),'logWarning':_0x5145e8=>console[_0x3a61ff(0x10b)](a32_0xb1a1f5['yellow']('β \x20'+_0x5145e8)),'logDeleted':_0x54f16c=>console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xcb)]('β\x20'+_0x54f16c))},_0xdac637={'segment':_0x388d73['segment'],'journey':_0x388d73[_0x3a61ff(0xdb)],'user':_0x388d73['user'],'connection':_0x388d73['connection']};_0x1843e4[_0x3a61ff(0xc1)]>0x0&&(_0x4c1da2=await executePushFolders(_0xdac637,_0x1843e4,_0x4c1da2,{'parentId':_0x50ecb3},_0x39443d));const _0x4794c1={'rootFolderId':_0x2fbb20,'folderPathToId':_0x4c1da2,'folderIdToPath':_0x3a0f08,'segmentNameToId':_0x495ab0,'activationsBySegmentId':_0xbd025a,'emailToIdMap':_0x31ab36,'idToEmailMap':_0x3a0eb4,'connectionNameToIdMap':_0x37077d[_0x3a61ff(0x142)],'connectionIdToNameMap':_0x37077d[_0x3a61ff(0x12e)],'connectionNameToTypeMap':_0x3ff99c},_0x448ada=await executePushSegments(_0xdac637,_0x104061['journeysOnly']?[]:_0x1c1fa4,_0x4794c1,{'parentId':_0x50ecb3},_0x39443d),_0x44bb67=_0x448ada[_0x3a61ff(0x13d)],_0x348f74=_0x448ada['updated'],_0x493e28=_0x448ada[_0x3a61ff(0x13f)][_0x3a61ff(0x13d)],_0x336874=_0x448ada[_0x3a61ff(0x13f)][_0x3a61ff(0xec)],_0x5ebacb=_0x448ada[_0x3a61ff(0x13f)][_0x3a61ff(0xff)],_0x1e7b7a=await executePushSegmentDeletions(_0xdac637,_0x104061[_0x3a61ff(0xc3)]?[]:_0x8f9d5d,_0x39443d);let _0xe59f29=0x0,_0xf2cdf4=0x0,_0x465f80=0x0;const _0x1aab42=new Map(_0x495ab0);for(const [_0x4f868e,_0xa731b4]of _0x448ada[_0x3a61ff(0x13a)]){_0x1aab42['set'](_0x4f868e,_0xa731b4);}if(_0x26c8ac[_0x3a61ff(0xc1)]>0x0){const _0x30622c={..._0x4794c1,'segmentNameToId':_0x1aab42,'existingSegments':_0x1b9f4b,'activationContext':_0x37a2ef},_0x3616c9=await executePushJourneys(_0xdac637,_0x26c8ac,_0x30622c,{'parentId':_0x50ecb3,'rootFolderId':_0x2fbb20,'verbose':_0x104061[_0x3a61ff(0x105)]},_0x39443d);_0xe59f29=_0x3616c9[_0x3a61ff(0x13d)],_0xf2cdf4=_0x3616c9[_0x3a61ff(0xec)];if(_0x20c13a&&_0x3616c9['results'][_0x3a61ff(0xc1)]===0x1){const _0x34e8cc=_0x3616c9[_0x3a61ff(0x129)][0x0];if(_0x34e8cc[_0x3a61ff(0x138)]){const _0x124498=getConsoleNextUrl(_0x104061[_0x3a61ff(0x119)],'/app/ps/'+_0x50ecb3+_0x3a61ff(0xce)+_0x34e8cc['journeyId']+_0x3a61ff(0xc2));console[_0x3a61ff(0x10b)]('\x20\x20'+a32_0xb1a1f5[_0x3a61ff(0x128)](_0x124498));}}}for(const _0x298e46 of _0x14674c){console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xca)]('β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x298e46[_0x3a61ff(0xf2)])),_0x465f80++;}const _0x16782c=[];if(_0x44bb67>0x0)_0x16782c[_0x3a61ff(0x10d)](_0x44bb67+_0x3a61ff(0xb4));if(_0x348f74>0x0)_0x16782c[_0x3a61ff(0x10d)](_0x348f74+'\x20updated');if(_0x1e7b7a>0x0)_0x16782c[_0x3a61ff(0x10d)](_0x1e7b7a+_0x3a61ff(0x11d));const _0x287d5c=[];if(_0xe59f29>0x0)_0x287d5c[_0x3a61ff(0x10d)](_0xe59f29+_0x3a61ff(0xb4));if(_0xf2cdf4>0x0)_0x287d5c['push'](_0xf2cdf4+_0x3a61ff(0xbd));if(_0x465f80>0x0)_0x287d5c[_0x3a61ff(0x10d)](_0x465f80+_0x3a61ff(0x11d));const _0x413283=[];if(_0x493e28>0x0)_0x413283[_0x3a61ff(0x10d)](_0x493e28+'\x20created');if(_0x336874>0x0)_0x413283['push'](_0x336874+_0x3a61ff(0xbd));if(_0x5ebacb>0x0)_0x413283[_0x3a61ff(0x10d)](_0x5ebacb+_0x3a61ff(0x11d));return console[_0x3a61ff(0x10b)](a32_0xb1a1f5[_0x3a61ff(0xc5)]('\x0aβ\x20Push\x20complete')),_0x16782c['length']>0x0&&!_0x104061[_0x3a61ff(0xc3)]&&console[_0x3a61ff(0x10b)]('\x20\x20Segments:\x20'+_0x16782c['join'](',\x20')),_0x287d5c[_0x3a61ff(0xc1)]>0x0&&console[_0x3a61ff(0x10b)](_0x3a61ff(0xe5)+_0x287d5c['join'](',\x20')),_0x413283[_0x3a61ff(0xc1)]>0x0&&!_0x104061[_0x3a61ff(0xc3)]&&console[_0x3a61ff(0x10b)](_0x3a61ff(0x136)+_0x413283[_0x3a61ff(0x106)](',\x20')),0x0;}}
|
|
1
|
+
const a32_0x152853=a32_0x1f4b;(function(_0x279376,_0x3d6b3f){const _0x1145f9=a32_0x1f4b,_0x490644=_0x279376();while(!![]){try{const _0x4d054b=-parseInt(_0x1145f9(0x1f5))/0x1+-parseInt(_0x1145f9(0x201))/0x2*(-parseInt(_0x1145f9(0x225))/0x3)+-parseInt(_0x1145f9(0x1c9))/0x4*(-parseInt(_0x1145f9(0x23c))/0x5)+-parseInt(_0x1145f9(0x1ea))/0x6+-parseInt(_0x1145f9(0x24d))/0x7+parseInt(_0x1145f9(0x241))/0x8*(-parseInt(_0x1145f9(0x20e))/0x9)+-parseInt(_0x1145f9(0x25b))/0xa*(-parseInt(_0x1145f9(0x250))/0xb);if(_0x4d054b===_0x3d6b3f)break;else _0x490644['push'](_0x490644['shift']());}catch(_0x2b5dfa){_0x490644['push'](_0x490644['shift']());}}}(a32_0x14ee,0x211a9));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a32_0x421a67 from'chalk';import{existsSync}from'fs';function a32_0x14ee(){const _0x20b51f=['2351007NXrCKX','Parent\x20segment:\x20','journeysOnly','Error:\x20','Error\x20parsing\x20YAML:\x20','site','getOutputSchemaWithCache','Changes\x20to\x20journey:','\x20changed','\x0aPush\x20summary\x20for\x20\x27','folderId','activations','all','β\x20All\x20journeys\x20are\x20up\x20to\x20date','push','journeys','segments','\x20to\x20create','parent_name','Push\x20','\x20updated','set','\x20\x20πΊοΈ\x20\x20Journeys:','193449mrGMAH','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','segmentFolderId','\x20created','existingJourney','\x20\x20Segments:\x20','results','Delete\x20journey:','get','Fetching\x20existing\x20activations...','dim','\x20YAML\x20files\x20found','toCreate','attributes','relationships','filter','filePath','message','targetDir','journey','resolveParentId','length','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','295255tBkwNU','\x20\x20\x20\x20','scopedFolderPath','helpText','Site:\x20','8mRnZEs','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20journeys...','type','error','\x20\x20Journeys:\x20','yellow','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','idToName','Error:\x20Directory\x20not\x20found:\x20','folders','verbose','1868958kMKgOE','yamlConfig','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','1715230JeQQgb','.yaml','toUpdate','unchanged','\x20\x20Activations:','Delete\x20segment:','isNew','description','/j/da/je','cwd','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','50arPqBa','Folders\x20to\x20create:','\x0aError:','updatedAt','getJourney','New\x20journey:','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','map','parentName','\x27...','Fetching\x20existing\x20folders...','Fetching\x20users\x20for\x20email\x20resolution...','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20deleted','(Journey\x20will\x20be\x20deleted)','4tAJoDW','delete','join','nameToType','\x20unchanged','new','\x20new','no_parent','\x20\x20Source:\x20','user','cyan','toString','\x20activations]','toDelete','segment:push','segment','segment\x20or\x20journey','endsWith','data','diff','green','listFolders','repeat','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','deleted','Resolving\x20parent\x20segment\x20\x27','Preparing\x20journeys...','state','.yml','isScoped','\x20\x20Activations:\x20','Scoped\x20to\x20folder:\x20','blue','1186338ZRkcio','connection','\x20to\x20update','createdSegmentIds','then','getParent','parentFolder','journeyId','paused','changed','\x20to\x20delete','170617shuzUb','/app/ps/','updated','yes','created','nameToId','name','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x0aβ\x20Push\x20complete','errorCode','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','6HFQtpM','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','folderPath','parentSegment','journeyBundleId','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','file','/e/','Aborted.','journeyBundleName','versionNumber','red'];a32_0x14ee=function(){return _0x20b51f;};return a32_0x14ee();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a32_0x1f4b(_0xa53b98,_0x5e58fc){_0xa53b98=_0xa53b98-0x1c3;const _0x14eee8=a32_0x14ee();let _0x1f4b53=_0x14eee8[_0xa53b98];return _0x1f4b53;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a32_0x152853(0x1fb)]=a32_0x152853(0x1d7);[a32_0x152853(0x257)]=a32_0x152853(0x248);async['execute'](_0x51fbcd){const _0x2f0a54=a32_0x152853,{options:_0x6ba837,args:_0x3f398f,tdx:_0x6eed63}=_0x51fbcd,_0xbf916b=_0x6ba837,_0x2db96e=await resolveTarget({'arg':_0x3f398f[0x0],'contextParent':_0x6ba837[_0x2f0a54(0x204)],'cwd':process[_0x2f0a54(0x259)]()});if(!isSuccessfulResolution(_0x2db96e))return _0x2db96e[_0x2f0a54(0x1fe)]===_0x2f0a54(0x1d0)?(console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2f0a54(0x245)](_0x2f0a54(0x206)),console[_0x2f0a54(0x245)](_0x2f0a54(0x207)),console['error'](_0x2f0a54(0x226))):(console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x211)+_0x2db96e[_0x2f0a54(0x236)]+'\x0a')),_0x2db96e['helpText']&&console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2db96e[_0x2f0a54(0x23f)]))),0x1;if(_0x2db96e[_0x2f0a54(0x244)]===_0x2f0a54(0x220))return console['error'](a32_0x421a67['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x2db96e[_0x2f0a54(0x237)]+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67['cyan'](_0x2f0a54(0x200))),0x1;const _0x2e20fa=_0x2db96e[_0x2f0a54(0x263)],_0x70556d=_0x2db96e[_0x2f0a54(0x237)],_0x448962=_0x2db96e[_0x2f0a54(0x244)]===_0x2f0a54(0x208)?_0x2db96e[_0x2f0a54(0x235)]:undefined,_0x4e0c39=getScopedDetails(_0x2db96e),_0xc70983=_0x4e0c39?.[_0x2f0a54(0x1e6)]??![],_0x2db919=_0x4e0c39?.[_0x2f0a54(0x23e)]??'';if(!existsSync(_0x70556d))return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x24a)+_0x70556d+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2f0a54(0x200))),0x1;_0xbf916b[_0x2f0a54(0x24c)]&&(console[_0x2f0a54(0x245)](_0x2f0a54(0x240)+_0xbf916b[_0x2f0a54(0x213)]),console[_0x2f0a54(0x245)](_0x2f0a54(0x20f)+_0x2e20fa),console[_0x2f0a54(0x245)]('Source\x20directory:\x20'+_0x70556d),_0xc70983&&console[_0x2f0a54(0x245)](_0x2f0a54(0x1e8)+_0x2db919));const _0x13d6a2=await withSpinner(_0x2f0a54(0x1e2)+_0x2e20fa+_0x2f0a54(0x1c3),()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x239)](_0x2e20fa),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),_0x3783df=_0x13d6a2[_0x2f0a54(0x1db)],[_0x14817a,_0xdd89c7,_0x2d5ea5,_0x5291de,_0x25b610]=await Promise[_0x2f0a54(0x21a)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x1ef)](_0x3783df),{'verbose':_0xbf916b['verbose']}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x6eed63[_0x2f0a54(0x1d8)]['listSegments'](_0x3783df),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x1c4),()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x1de)](_0x3783df),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x243),()=>_0x6eed63[_0x2f0a54(0x238)]['listJourneysWithDetailsFromParentSegment'](_0x3783df,{'includeAllVersions':!![]}),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x1c5),()=>_0x6eed63['user']['buildUserMaps'](),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x44e2fa=>_0x44e2fa[_0x2f0a54(0x1db)])]),_0x257e22=_0x14817a['data'],_0x13ad2d=extractRootFolderId(_0x257e22),_0x4c07c0=_0xdd89c7[_0x2f0a54(0x1db)],_0x42d82f=_0x2d5ea5[_0x2f0a54(0x1db)],{journeys:_0x258c1a,activationStepsById:_0x274568}=_0x5291de['data'],_0x244a9b=new Map(_0x258c1a[_0x2f0a54(0x262)](_0x1e5b66=>[_0x1e5b66['id'],_0x1e5b66])),_0x16dbee=_0x258c1a[_0x2f0a54(0x262)](_0x9cc09f=>({'id':_0x9cc09f['id'],'name':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x1fb)],'journeyBundleName':_0x9cc09f[_0x2f0a54(0x232)]['journeyBundleName']||'','journeyBundleId':_0x9cc09f['attributes'][_0x2f0a54(0x205)]||'','versionNumber':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x20c)],'description':_0x9cc09f['attributes']['description'],'state':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x1e4)],'paused':_0x9cc09f['attributes'][_0x2f0a54(0x1f2)],'audienceId':_0x9cc09f[_0x2f0a54(0x232)]['audienceId'],'folderId':_0x9cc09f[_0x2f0a54(0x233)]?.[_0x2f0a54(0x1f0)]?.[_0x2f0a54(0x1db)]?.['id'],'createdAt':_0x9cc09f[_0x2f0a54(0x232)]['createdAt'],'updatedAt':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x25e)]})),{emailToId:_0x358cb8,idToEmail:_0x139d27}=_0x25b610,_0x26cc8a=await withSpinner(_0x2f0a54(0x242),async()=>{const _0x3bfb32=_0x2f0a54,_0x3888d3=await _0x6eed63[_0x3bfb32(0x1eb)]['list']();return buildConnectionMaps(_0x3888d3);},{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x3e7961=>_0x3e7961[_0x2f0a54(0x1db)]),_0x48686f=_0x26cc8a[_0x2f0a54(0x1fa)],_0x58de3d=_0x26cc8a[_0x2f0a54(0x249)],_0x3f2934=_0x26cc8a[_0x2f0a54(0x1cc)],_0x297469={'emailToIdMap':_0x358cb8,'connectionNameToIdMap':_0x48686f,'connectionNameToTypeMap':_0x3f2934,'getSchema':_0x5bb979=>_0x6eed63[_0x2f0a54(0x1eb)][_0x2f0a54(0x214)](_0x5bb979)};let {pathToId:_0x3d72e2,idToPath:_0x5b2dee}=buildFolderMaps(_0x42d82f);const _0x106573=buildSegmentLookupMap(_0x4c07c0,_0x5b2dee),_0x58d1cd=buildSegmentNameToIdMap(_0x4c07c0),_0x58f861=buildJourneyBundleLookupMap(_0x16dbee,_0x5b2dee);let _0x263ab3;if(_0x448962){if(!_0x448962[_0x2f0a54(0x1da)](_0x2f0a54(0x1e5))&&!_0x448962[_0x2f0a54(0x1da)](_0x2f0a54(0x251)))return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x202)+_0x448962+'\x0a')),0x1;_0x263ab3=[_0x448962];}else _0x263ab3=findYamlFiles(_0x70556d);if(_0x263ab3[_0x2f0a54(0x23a)]===0x0)return console['error'](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x1ff)+_0x70556d+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2f0a54(0x261))),0x1;let _0x177542,_0x29d7a6;try{const _0x45571f=parseAndClassifyYamlFiles(_0x263ab3,_0x70556d,{'skipSegments':_0xbf916b[_0x2f0a54(0x210)]});_0x177542=_0x45571f[_0x2f0a54(0x21e)],_0x29d7a6=_0x45571f[_0x2f0a54(0x21d)];const _0x218857=validateParsedFiles(_0x45571f,_0x70556d);if(_0x218857[_0x2f0a54(0x23a)]>0x0)return console['error'](a32_0x421a67['red']('\x0aValidation\x20failed:')),console[_0x2f0a54(0x245)](formatValidationErrors(_0x218857)),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x23b))),0x1;}catch(_0x22416a){return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x212)+(_0x22416a instanceof Error?_0x22416a['message']:_0x22416a))),0x1;}if(_0x177542[_0x2f0a54(0x23a)]===0x0&&_0x29d7a6[_0x2f0a54(0x23a)]===0x0){const _0x227b74=_0xbf916b[_0x2f0a54(0x210)]?'journey':_0x2f0a54(0x1d9);return console['error'](a32_0x421a67[_0x2f0a54(0x247)]('No\x20'+_0x227b74+_0x2f0a54(0x230))),0x0;}const _0x141952=new Map();_0x4c07c0[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&await withSpinner(_0x2f0a54(0x22e),async()=>{await batchAsync(_0x4c07c0,async _0x4d11e9=>{const _0xc4f47=a32_0x1f4b,_0x455949=await _0x6eed63[_0xc4f47(0x1d8)]['listActivations'](_0x3783df,_0x4d11e9['id']);_0x141952[_0xc4f47(0x223)](_0x4d11e9['id'],_0x455949);});},{'verbose':_0xbf916b[_0x2f0a54(0x24c)]});const {segmentFiles:_0x5a6323,foldersToCreate:_0x1aa5a2}=await prepareSegmentFiles(_0x177542,{'segmentByFolderAndName':_0x106573,'activationsBySegmentId':_0x141952,'folderPathToId':_0x3d72e2,'idToEmailMap':_0x139d27,'connectionIdToNameMap':_0x58de3d},_0x297469,_0xc70983,_0x2db919),_0x4729bd=_0x448962?[]:findSegmentsToDelete(_0x4c07c0,_0x177542[_0x2f0a54(0x262)](({yamlConfig:_0x229d09,folderPath:_0x2a03ba})=>({'yamlConfig':_0x229d09,'folderPath':resolveTDFolderPath(_0x2a03ba,_0xc70983,_0x2db919)})),_0x5b2dee,_0x2db919,_0xc70983),{journeyFiles:_0x1962f8,foldersToCreate:_0x36bfef}=await withProgressSpinner(_0x2f0a54(0x1e3),async _0x48a7a0=>prepareJourneyFiles(_0x29d7a6,{'fetchJourney':async _0x3d92c1=>_0x6eed63[_0x2f0a54(0x238)][_0x2f0a54(0x25f)](_0x3d92c1[_0x2f0a54(0x1f1)]),'journeyBundlesByFolderAndName':_0x58f861,'folderPathToId':_0x3d72e2,'idToEmailMap':_0x139d27,'connectionIdToNameMap':_0x58de3d,'existingSegments':_0x4c07c0,'parentId':_0x3783df,'deps':_0x6eed63,'progress':{'update':_0x2f9d9a=>{const _0x47cd7f=_0x2f0a54;_0x48a7a0['setPhase'](_0x2f9d9a),_0xbf916b[_0x47cd7f(0x24c)]&&console['error']('\x20\x20'+_0x2f9d9a);}},'journeyById':_0x244a9b,'activationStepsById':_0x274568},_0xc70983,_0x2db919),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x3a5ae6=>_0x3a5ae6[_0x2f0a54(0x1db)]);for(const _0x2f84d2 of _0x36bfef){_0x1aa5a2['add'](_0x2f84d2);}const _0x2bba8d=_0x448962?[]:findJourneysToDelete(_0x16dbee,_0x29d7a6['map'](({yamlConfig:_0x64073d,folderPath:_0x26647e})=>({'yamlConfig':_0x64073d,'folderPath':resolveTDFolderPath(_0x26647e,_0xc70983,_0x2db919)})),_0x5b2dee,_0x2db919,_0xc70983),_0x33df12=calculatePushStats(_0x5a6323,_0x1962f8,_0x1aa5a2,_0x4729bd,_0x2bba8d,!!_0xbf916b[_0x2f0a54(0x1ca)],!!_0xbf916b['journeysOnly']),_0x322d3a=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x1ce)],_0x580d09=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x1f3)],_0x40bf3d=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x253)],_0x2c47f1=_0x33df12['segments'][_0x2f0a54(0x1d6)],_0x3dde5b=_0x33df12[_0x2f0a54(0x24b)][_0x2f0a54(0x231)],_0x479522=_0x33df12['journeys'][_0x2f0a54(0x1ce)],_0x1bc221=_0x33df12['journeys']['changed'],_0x593a4c=_0x33df12[_0x2f0a54(0x21d)][_0x2f0a54(0x253)],_0x4d7cfa=_0x33df12[_0x2f0a54(0x21d)][_0x2f0a54(0x1d6)],_0x34b0a3=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x21a)],_0x12f8a2=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x231)],_0x44447d=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x252)],_0xc28877=_0x33df12['activations'][_0x2f0a54(0x1d6)];console['error'](_0x2f0a54(0x217)+_0x2e20fa+'\x27:');_0x3dde5b[_0x2f0a54(0x23a)]>0x0&&console['error']('\x20\x20'+a32_0x421a67[_0x2f0a54(0x1e9)]('π\x20'+_0x3dde5b[_0x2f0a54(0x23a)]+'\x20folders\x20to\x20create'));if(!_0xbf916b[_0x2f0a54(0x210)]){console[_0x2f0a54(0x245)]('\x20\x20π\x20Segments:'),console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x1dd)]('+\x20'+_0x322d3a[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cf))),console[_0x2f0a54(0x245)]('\x20\x20\x20\x20'+a32_0x421a67['yellow']('~\x20'+_0x580d09['length']+_0x2f0a54(0x216)));if(_0x2c47f1[_0x2f0a54(0x23a)]>0x0)console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['red']('-\x20'+_0x2c47f1[_0x2f0a54(0x23a)]+_0x2f0a54(0x1f4)));else _0x4729bd['length']>0x0&&!_0xbf916b[_0x2f0a54(0x1ca)]&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x22f)](_0x4729bd['length']+_0x2f0a54(0x1fc)));console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x22f)]('=\x20'+_0x40bf3d[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cd)));}if(_0x1962f8['length']>0x0||_0x2bba8d[_0x2f0a54(0x23a)]>0x0){console[_0x2f0a54(0x245)](_0x2f0a54(0x224)),console['error'](_0x2f0a54(0x23d)+a32_0x421a67['green']('+\x20'+_0x479522[_0x2f0a54(0x23a)]+'\x20new')),console[_0x2f0a54(0x245)]('\x20\x20\x20\x20'+a32_0x421a67[_0x2f0a54(0x247)]('~\x20'+_0x1bc221[_0x2f0a54(0x23a)]+_0x2f0a54(0x216)));if(_0x4d7cfa[_0x2f0a54(0x23a)]>0x0)console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x20d)]('-\x20'+_0x4d7cfa['length']+_0x2f0a54(0x1f4)));else _0x2bba8d[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x1ca)]&&console['error'](_0x2f0a54(0x23d)+a32_0x421a67['dim'](_0x2bba8d['length']+_0x2f0a54(0x1fc)));console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['dim']('=\x20'+_0x593a4c[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cd)));}_0x34b0a3['length']>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&(console[_0x2f0a54(0x245)](''),console[_0x2f0a54(0x245)](_0x2f0a54(0x254)),_0x12f8a2['length']>0x0&&console['error'](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x1dd)]('+\x20'+_0x12f8a2[_0x2f0a54(0x23a)]+_0x2f0a54(0x21f))),_0x44447d[_0x2f0a54(0x23a)]>0x0&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['yellow']('~\x20'+_0x44447d[_0x2f0a54(0x23a)]+_0x2f0a54(0x1ec))),_0xc28877[_0x2f0a54(0x23a)]>0x0&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x20d)]('-\x20'+_0xc28877['length']+'\x20to\x20delete')));console['error'](_0x2f0a54(0x1d1)+a32_0x421a67[_0x2f0a54(0x1d3)](_0x70556d)+'\x0a');if(_0x3dde5b[_0x2f0a54(0x23a)]>0x0){console[_0x2f0a54(0x245)](_0x2f0a54(0x25c));for(const _0x415ecd of _0x3dde5b){console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['blue']('+')+'\x20'+_0x415ecd);}console[_0x2f0a54(0x245)]('');}if(_0x322d3a[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0x1ba93b of _0x322d3a){const _0x3d9d3d=_0x1ba93b['folderPath']?_0x1ba93b[_0x2f0a54(0x203)]+'/'+_0x1ba93b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)]:_0x1ba93b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)],_0x116be9=_0x1ba93b['yamlConfig']['activations']?.[_0x2f0a54(0x23a)]||0x0,_0x7aba39=_0x116be9>0x0?a32_0x421a67[_0x2f0a54(0x22f)]('\x20['+_0x116be9+'\x20activations]'):'';console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x1dd)]('New\x20segment:')+'\x20'+_0x3d9d3d+_0x7aba39),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),_0x1ba93b[_0x2f0a54(0x1dc)]&&console[_0x2f0a54(0x245)](_0x1ba93b['diff']),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x2c47f1[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0xda1710 of _0x2c47f1){const _0x2187e4=_0xda1710[_0x2f0a54(0x227)]?_0x5b2dee[_0x2f0a54(0x22d)](_0xda1710[_0x2f0a54(0x227)][_0x2f0a54(0x1d4)]())||'':'',_0x116b69=_0x2187e4?_0x2187e4+'/'+_0xda1710[_0x2f0a54(0x1fb)]:_0xda1710[_0x2f0a54(0x1fb)],_0x577657=_0x141952[_0x2f0a54(0x22d)](_0xda1710['id'])||[],_0x47e18e=_0x577657[_0x2f0a54(0x23a)]>0x0?a32_0x421a67[_0x2f0a54(0x22f)]('\x20['+_0x577657[_0x2f0a54(0x23a)]+_0x2f0a54(0x1d5)):'';console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x255))+'\x20'+_0x116b69+_0x47e18e),console['error']('β'['repeat'](0x3c));const _0x129bdd=segmentWithActivationsToYaml(_0xda1710,_0x577657,undefined,_0x139d27,_0x58de3d),_0x550958=segmentToYamlString(_0x129bdd),_0x59382b=generateDiff(_0x550958,'');console[_0x2f0a54(0x245)](formatDiffWithColors(_0x59382b)),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}const _0x329c28=_0x5a6323[_0x2f0a54(0x234)](_0x1e8bf2=>!_0x1e8bf2['isNew']&&_0x1e8bf2['diff']);if(_0x329c28['length']>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0x263c6b of _0x329c28){const _0x121766=_0x263c6b['folderPath']?_0x263c6b['folderPath']+'/'+_0x263c6b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)]:_0x263c6b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67['yellow']('Changes\x20to:')+'\x20'+_0x121766),console['error']('β'[_0x2f0a54(0x1df)](0x3c)),console[_0x2f0a54(0x245)](_0x263c6b['diff']),console['error']('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x479522[_0x2f0a54(0x23a)]>0x0)for(const _0x263b7e of _0x479522){const _0x26b841=_0x263b7e[_0x2f0a54(0x203)]?_0x263b7e[_0x2f0a54(0x203)]+'/'+_0x263b7e[_0x2f0a54(0x24e)]['name']:_0x263b7e[_0x2f0a54(0x24e)]['name'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x1dd)](_0x2f0a54(0x260))+'\x20'+_0x26b841),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),_0x263b7e[_0x2f0a54(0x1dc)]&&console[_0x2f0a54(0x245)](_0x263b7e[_0x2f0a54(0x1dc)]),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}const _0x405924=_0x1962f8[_0x2f0a54(0x234)](_0x2c2938=>!_0x2c2938[_0x2f0a54(0x256)]&&_0x2c2938[_0x2f0a54(0x1dc)]);if(_0x405924[_0x2f0a54(0x23a)]>0x0)for(const _0x39fd1d of _0x405924){const _0x2bdfb7=_0x39fd1d[_0x2f0a54(0x203)]?_0x39fd1d[_0x2f0a54(0x203)]+'/'+_0x39fd1d['yamlConfig'][_0x2f0a54(0x1fb)]:_0x39fd1d[_0x2f0a54(0x24e)]['name'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x215))+'\x20'+_0x2bdfb7),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),console[_0x2f0a54(0x245)](_0x39fd1d[_0x2f0a54(0x1dc)]),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x4d7cfa[_0x2f0a54(0x23a)]>0x0)for(const _0x2cf705 of _0x4d7cfa){const _0x553cda=_0x2cf705[_0x2f0a54(0x218)]?_0x5b2dee[_0x2f0a54(0x22d)](_0x2cf705[_0x2f0a54(0x218)])||'':'',_0x21cb05=_0x553cda?_0x553cda+'/'+_0x2cf705['journeyBundleName']:_0x2cf705['journeyBundleName'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x22c))+'\x20'+_0x21cb05),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),console['error'](a32_0x421a67['red'](_0x2f0a54(0x1c8))),console['error']('β'[_0x2f0a54(0x1df)](0x3c));}if(_0xbf916b['dryRun'])return console['error'](a32_0x421a67[_0x2f0a54(0x247)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x49ed17=_0xbf916b[_0x2f0a54(0x210)]?![]:_0x322d3a[_0x2f0a54(0x23a)]>0x0||_0x580d09['length']>0x0||_0x2c47f1[_0x2f0a54(0x23a)]>0x0,_0xe8fbe4=_0x479522['length']>0x0||_0x1bc221['length']>0x0||_0x4d7cfa[_0x2f0a54(0x23a)]>0x0,_0x29b5a7=_0xbf916b[_0x2f0a54(0x210)]?![]:_0x34b0a3[_0x2f0a54(0x23a)]>0x0,_0x15d3ec=_0x3dde5b[_0x2f0a54(0x23a)]>0x0;if(!_0x49ed17&&!_0xe8fbe4&&!_0x29b5a7&&!_0x15d3ec){const _0x35b991=_0xbf916b[_0x2f0a54(0x210)]?_0x2f0a54(0x21b):_0x2f0a54(0x1e0);console[_0x2f0a54(0x245)](a32_0x421a67['green'](_0x35b991));if(_0x448962&&_0x593a4c[_0x2f0a54(0x23a)]===0x1){const _0x124e04=_0x593a4c[0x0];if(_0x124e04[_0x2f0a54(0x229)]?.['id']){const _0x36f580=getConsoleNextUrl(_0xbf916b[_0x2f0a54(0x213)],_0x2f0a54(0x1f6)+_0x3783df+_0x2f0a54(0x209)+_0x124e04[_0x2f0a54(0x229)]['id']+'/j/da/je');console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['cyan'](_0x36f580));}}return 0x0;}const _0xa28719=_0xbf916b[_0x2f0a54(0x210)]?_0x479522[_0x2f0a54(0x23a)]+_0x1bc221['length']+_0x4d7cfa['length']+_0x3dde5b['length']:_0x322d3a['length']+_0x580d09['length']+_0x2c47f1[_0x2f0a54(0x23a)]+_0x479522[_0x2f0a54(0x23a)]+_0x1bc221['length']+_0x4d7cfa[_0x2f0a54(0x23a)]+_0x3dde5b[_0x2f0a54(0x23a)]+_0x34b0a3[_0x2f0a54(0x23a)];if(!_0xbf916b[_0x2f0a54(0x1f8)]&&_0xa28719>0x0){if(!isInteractive())return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x25d)),_0x2f0a54(0x25a)),console['error'](a32_0x421a67[_0x2f0a54(0x22f)](_0x2f0a54(0x24f))),0x1;const _0xaa86cf=await confirmKey(_0x2f0a54(0x221)+_0xa28719+'\x20changes?');if(!_0xaa86cf)return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x20a))),0x1;}const _0x10b012={'withProgress':async(_0x3d3dbb,_0x4334d1)=>{const _0x1dab3b=_0x2f0a54,_0x7ac588=await withSpinner(_0x3d3dbb,_0x4334d1,{'verbose':_0xbf916b[_0x1dab3b(0x24c)]});return{'data':_0x7ac588[_0x1dab3b(0x1db)]};},'logInfo':_0x3478e8=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1e9)]('β\x20'+_0x3478e8)),'logSuccess':_0x347161=>console[_0x2f0a54(0x245)](a32_0x421a67['green']('β\x20'+_0x347161)),'logWarning':_0x466d34=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)]('β \x20'+_0x466d34)),'logDeleted':_0x38cf5b=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)]('β\x20'+_0x38cf5b))},_0x1200c9={'segment':_0x6eed63[_0x2f0a54(0x1d8)],'journey':_0x6eed63[_0x2f0a54(0x238)],'user':_0x6eed63[_0x2f0a54(0x1d2)],'connection':_0x6eed63[_0x2f0a54(0x1eb)]};_0x3dde5b[_0x2f0a54(0x23a)]>0x0&&(_0x3d72e2=await executePushFolders(_0x1200c9,_0x3dde5b,_0x3d72e2,{'parentId':_0x3783df},_0x10b012));const _0x3e5c93={'rootFolderId':_0x13ad2d,'folderPathToId':_0x3d72e2,'folderIdToPath':_0x5b2dee,'segmentNameToId':_0x58d1cd,'activationsBySegmentId':_0x141952,'emailToIdMap':_0x358cb8,'idToEmailMap':_0x139d27,'connectionNameToIdMap':_0x26cc8a['nameToId'],'connectionIdToNameMap':_0x26cc8a['idToName'],'connectionNameToTypeMap':_0x3f2934},_0x40977f=await executePushSegments(_0x1200c9,_0xbf916b[_0x2f0a54(0x210)]?[]:_0x5a6323,_0x3e5c93,{'parentId':_0x3783df},_0x10b012),_0x193770=_0x40977f['created'],_0x1c3561=_0x40977f[_0x2f0a54(0x1f7)],_0x230ca1=_0x40977f['activations'][_0x2f0a54(0x1f9)],_0x439d5d=_0x40977f[_0x2f0a54(0x219)][_0x2f0a54(0x1f7)],_0x3198a4=_0x40977f['activations'][_0x2f0a54(0x1e1)],_0x16ac97=await executePushSegmentDeletions(_0x1200c9,_0xbf916b['journeysOnly']?[]:_0x2c47f1,_0x10b012);let _0xf21c99=0x0,_0x3a3336=0x0,_0x1d7bb0=0x0;const _0x51f888=new Map(_0x58d1cd);for(const [_0x369e53,_0x3dee57]of _0x40977f[_0x2f0a54(0x1ed)]){_0x51f888[_0x2f0a54(0x223)](_0x369e53,_0x3dee57);}if(_0x1962f8[_0x2f0a54(0x23a)]>0x0){const _0x11c19e={..._0x3e5c93,'segmentNameToId':_0x51f888,'existingSegments':_0x4c07c0,'activationContext':_0x297469},_0x24b7ee=await executePushJourneys(_0x1200c9,_0x1962f8,_0x11c19e,{'parentId':_0x3783df,'rootFolderId':_0x13ad2d,'verbose':_0xbf916b[_0x2f0a54(0x24c)]},_0x10b012);_0xf21c99=_0x24b7ee[_0x2f0a54(0x1f9)],_0x3a3336=_0x24b7ee[_0x2f0a54(0x1f7)];if(_0x448962&&_0x24b7ee[_0x2f0a54(0x22b)][_0x2f0a54(0x23a)]===0x1){const _0x2a40bc=_0x24b7ee[_0x2f0a54(0x22b)][0x0];if(_0x2a40bc[_0x2f0a54(0x1f1)]){const _0x32b764=getConsoleNextUrl(_0xbf916b[_0x2f0a54(0x213)],_0x2f0a54(0x1f6)+_0x3783df+'/e/'+_0x2a40bc[_0x2f0a54(0x1f1)]+_0x2f0a54(0x258));console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['cyan'](_0x32b764));}}}for(const _0x4fd6b9 of _0x4d7cfa){console['error'](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x1c6)+_0x4fd6b9[_0x2f0a54(0x20b)])),_0x1d7bb0++;}const _0x1df0da=[];if(_0x193770>0x0)_0x1df0da[_0x2f0a54(0x21c)](_0x193770+_0x2f0a54(0x228));if(_0x1c3561>0x0)_0x1df0da['push'](_0x1c3561+_0x2f0a54(0x222));if(_0x16ac97>0x0)_0x1df0da[_0x2f0a54(0x21c)](_0x16ac97+_0x2f0a54(0x1c7));const _0x5d47ff=[];if(_0xf21c99>0x0)_0x5d47ff[_0x2f0a54(0x21c)](_0xf21c99+_0x2f0a54(0x228));if(_0x3a3336>0x0)_0x5d47ff['push'](_0x3a3336+_0x2f0a54(0x222));if(_0x1d7bb0>0x0)_0x5d47ff[_0x2f0a54(0x21c)](_0x1d7bb0+_0x2f0a54(0x1c7));const _0x3aefed=[];if(_0x230ca1>0x0)_0x3aefed[_0x2f0a54(0x21c)](_0x230ca1+_0x2f0a54(0x228));if(_0x439d5d>0x0)_0x3aefed[_0x2f0a54(0x21c)](_0x439d5d+'\x20updated');if(_0x3198a4>0x0)_0x3aefed['push'](_0x3198a4+_0x2f0a54(0x1c7));return console['error'](a32_0x421a67[_0x2f0a54(0x1dd)](_0x2f0a54(0x1fd))),_0x1df0da[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b['journeysOnly']&&console[_0x2f0a54(0x245)](_0x2f0a54(0x22a)+_0x1df0da[_0x2f0a54(0x1cb)](',\x20')),_0x5d47ff[_0x2f0a54(0x23a)]>0x0&&console['error'](_0x2f0a54(0x246)+_0x5d47ff[_0x2f0a54(0x1cb)](',\x20')),_0x3aefed[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&console[_0x2f0a54(0x245)](_0x2f0a54(0x1e7)+_0x3aefed['join'](',\x20')),0x0;}}
|