@treasuredata/tdx 0.26.0 β 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.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-validator.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-recovery.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.d.ts +2 -1
- package/dist/utils/local-cache.d.ts.map +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/local-cache.js.map +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0x34f809=a26_0x5ddf;(function(_0x468849,_0x6727e5){const _0x73c2f8=a26_0x5ddf,_0x5bff54=_0x468849();while(!![]){try{const _0x399d6d=-parseInt(_0x73c2f8(0x93))/0x1+parseInt(_0x73c2f8(0xdd))/0x2+parseInt(_0x73c2f8(0xa7))/0x3*(parseInt(_0x73c2f8(0xe6))/0x4)+-parseInt(_0x73c2f8(0xe1))/0x5*(-parseInt(_0x73c2f8(0xce))/0x6)+parseInt(_0x73c2f8(0xea))/0x7+parseInt(_0x73c2f8(0xab))/0x8+-parseInt(_0x73c2f8(0xbc))/0x9*(parseInt(_0x73c2f8(0xb8))/0xa);if(_0x399d6d===_0x6727e5)break;else _0x5bff54['push'](_0x5bff54['shift']());}catch(_0x595243){_0x5bff54['push'](_0x5bff54['shift']());}}}(a26_0x575a,0x904dc));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';function a26_0x575a(){const _0x2c9d87=['Getting\x20schedule\x20history...','\x20scheduled\x20quer','Running\x20schedule...','135044QfpGML','user_name','num','last_job','7770427FKljnc','cyan','table','count','queryUrl','/app/queries/editor?queryId=','site','Run\x20a\x20scheduled\x20query\x20immediately','round','engineVersion','trino','green','output','created_at','dim','nextRun','time','schedule:create','Schedule\x20deleted:\x20','priority','\x20\x20Timezone:\x20','utf-8','Cancelled','Failed\x20to\x20read\x20file:\x20','description','Deleting\x20schedule...','in\x20','file','job_id','padEnd','verbose','Running\x20schedule:\x20','\x20\x20Num:\x20','args','from','\x20\x20Time:\x20','name','timezone','\x20\x20Cron:\x20','\x20\x20β\x20','Listing\x20scheduled\x20queries...','jsonl','schedule:update','result','d\x20ago','Schedule\x20updated:\x20','execute','user','ended_at','toLocaleDateString','\x20\x20Type:\x20','delay','engine_version','abs','next_run_at','map','max','Found\x20','1031610gbYGff','format','update','list','Showing\x20first\x20','validate','type','\x20job','Creating\x20schedule:\x20','...','database','status','has_next_page','\x20(use\x20--limit\x20to\x20see\x20more)','schedule:delete','List\x20scheduled\x20queries','retry_limit','show','queries','m\x20ago','51dtTRjJ','lastRun','entries','create','5727616NGKXCH','schedule:list','scheduled_at','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20schedules','jobs','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','json','statusIcon','error','Getting\x20schedule\x20details...','start_at','\x20matching\x20\x22','140mgEQZf','Create\x20a\x20scheduled\x20query','history','getTime','1424394APjgye','yes','Schedule\x20created:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','(unnamed)','Show\x20schedule\x20details','query','repeat','schedules','Updating\x20schedule:\x20','keys','cron','data','length','INVALID_ARGUMENT','pagination','limit','trim','6RpQIAk','just\x20now','ies','Updating\x20schedule...','Delete\x20a\x20scheduled\x20query','red','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Job\x20ID:\x20','\x22...','success','Show\x20schedule\x20execution\x20history','delete','listQueries','retryLimit','schedule:run','1741918lJlcLi','never','executing_user_id','\x20created','2837465FDwcXF','π
\x20'];a26_0x575a=function(){return _0x2c9d87;};return a26_0x575a();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x53ebf6 from'chalk';function formatRelativeTime(_0x282a69){const _0x11b6b3=a26_0x5ddf,_0x2ce2ff=new Date(_0x282a69),_0x7144e6=new Date(),_0x3d9efa=_0x2ce2ff[_0x11b6b3(0xbb)]()-_0x7144e6[_0x11b6b3(0xbb)](),_0x12ca7e=Math[_0x11b6b3(0x8e)](_0x3d9efa)/0x3e8,_0x844db5=_0x3d9efa<0x0;if(_0x12ca7e<0x3c)return _0x844db5?_0x11b6b3(0xcf):'soon';else{if(_0x12ca7e<0xe10){const _0x36ae53=Math[_0x11b6b3(0xf2)](_0x12ca7e/0x3c);return _0x844db5?_0x36ae53+_0x11b6b3(0xa6):'in\x20'+_0x36ae53+'m';}else{if(_0x12ca7e<0x15180){const _0x7c1cd1=Math[_0x11b6b3(0xf2)](_0x12ca7e/0xe10);return _0x844db5?_0x7c1cd1+'h\x20ago':_0x11b6b3(0x104)+_0x7c1cd1+'h';}else{if(_0x12ca7e<0x93a80){const _0x339ec0=Math[_0x11b6b3(0xf2)](_0x12ca7e/0x15180);return _0x844db5?_0x339ec0+_0x11b6b3(0x116):_0x11b6b3(0x104)+_0x339ec0+'d';}else return _0x2ce2ff[_0x11b6b3(0x11b)]();}}}}function a26_0x5ddf(_0x4e26c7,_0x13dc12){_0x4e26c7=_0x4e26c7-0x8c;const _0x575ae0=a26_0x575a();let _0x5ddf92=_0x575ae0[_0x4e26c7];return _0x5ddf92;}export class ScheduleListCommand extends BaseCommand{[a26_0x34f809(0x10e)]=a26_0x34f809(0xac);['description']=a26_0x34f809(0xa2);async[a26_0x34f809(0x118)](_0x1fe68e){const _0x3b6bb5=a26_0x34f809,{options:_0x341c5b,args:_0x59fc6a,tdx:_0x430189}=_0x1fe68e,_0x5245ee=resolveLimit(_0x341c5b[_0x3b6bb5(0xcc)],DEFAULT_DISPLAY_LIMIT),_0x4be4ef=_0x59fc6a[0x0],_0x5d9786=_0x4be4ef?_0x3b6bb5(0xd4)+_0x4be4ef+_0x3b6bb5(0xd6):_0x3b6bb5(0x112),_0x2c94fd=await withSpinner(_0x5d9786,()=>_0x430189['schedules'][_0x3b6bb5(0xda)]({'limit':_0x5245ee,'scheduled':!![],'pattern':_0x4be4ef}),{'verbose':_0x341c5b[_0x3b6bb5(0x108)]}),_0x371d70=_0x2c94fd[_0x3b6bb5(0xc8)][_0x3b6bb5(0xa5)],_0x150bdc=_0x2c94fd[_0x3b6bb5(0xc8)][_0x3b6bb5(0xcb)][_0x3b6bb5(0x9f)],_0x40f12b=_0x4be4ef?_0x3b6bb5(0xb7)+_0x4be4ef+'\x22':'';_0x150bdc?console['error'](_0x3b6bb5(0x97)+_0x371d70[_0x3b6bb5(0xc9)]+_0x3b6bb5(0xaf)+_0x40f12b+_0x3b6bb5(0xa0)):console[_0x3b6bb5(0xb4)](_0x3b6bb5(0x92)+_0x371d70['length']+_0x3b6bb5(0xe4)+(_0x371d70[_0x3b6bb5(0xc9)]!==0x1?_0x3b6bb5(0xd0):'y')+_0x40f12b);if(_0x341c5b['format']===_0x3b6bb5(0xb2)||_0x341c5b['format']===_0x3b6bb5(0x113)||_0x341c5b[_0x3b6bb5(0x94)]===_0x3b6bb5(0xec)||_0x341c5b[_0x3b6bb5(0x94)]==='tsv'){const _0x6d3e79=_0x371d70[_0x3b6bb5(0x90)](_0x2ea72a=>({'id':_0x2ea72a['id'],'name':_0x2ea72a[_0x3b6bb5(0x10e)],'cron':_0x2ea72a[_0x3b6bb5(0xc7)],'database':_0x2ea72a[_0x3b6bb5(0x9d)]?.['name'],'type':_0x2ea72a[_0x3b6bb5(0x99)],'timezone':_0x2ea72a['time_zone'],'user_name':_0x2ea72a[_0x3b6bb5(0x119)]?.[_0x3b6bb5(0x10e)],'updated_at':_0x2ea72a['updated_at'],'next_run_at':_0x2ea72a[_0x3b6bb5(0x8f)],'last_job_status':_0x2ea72a['last_job']?.['status']}));await handleSDKOutput(_0x6d3e79,_0x341c5b);}else{if(_0x371d70[_0x3b6bb5(0xc9)]===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x5aecc7=_0x341c5b[_0x3b6bb5(0xf0)],_0x3ee33d=_0x371d70[_0x3b6bb5(0x90)](_0x420af5=>{const _0x313fad=_0x3b6bb5,_0x56ff46=_0x420af5['last_job']?.['status']?_0x420af5[_0x313fad(0xe9)]['status']===_0x313fad(0xd7)?'β':'β':'-',_0x489840=_0x420af5[_0x313fad(0xe9)]?.[_0x313fad(0x11a)]?formatRelativeTime(_0x420af5[_0x313fad(0xe9)][_0x313fad(0x11a)]):_0x313fad(0xde),_0x56d43e=_0x420af5[_0x313fad(0x8f)]?formatRelativeTime(_0x420af5[_0x313fad(0x8f)]):'-',_0x425cde=_0x420af5[_0x313fad(0xc7)]||'',_0x516ab1=_0x420af5[_0x313fad(0x10e)]||_0x313fad(0xc0),_0x3a0b30=getConsoleUrl(_0x5aecc7,_0x313fad(0xef)+_0x420af5['id']);return{'statusIcon':_0x56ff46,'lastRun':_0x489840,'nextRun':_0x56d43e,'cron':_0x425cde,'name':_0x516ab1,'queryUrl':_0x3a0b30,'status':_0x420af5[_0x313fad(0xe9)]?.[_0x313fad(0x9e)]};}),_0x1cc4e2=Math[_0x3b6bb5(0x91)](..._0x3ee33d['map'](_0x35365e=>_0x35365e['lastRun'][_0x3b6bb5(0xc9)])),_0x141fed=Math['max'](..._0x3ee33d['map'](_0x20ecbb=>_0x20ecbb[_0x3b6bb5(0xf9)][_0x3b6bb5(0xc9)])),_0xcc474a=Math[_0x3b6bb5(0x91)](..._0x3ee33d[_0x3b6bb5(0x90)](_0xdbeef4=>_0xdbeef4[_0x3b6bb5(0xc7)][_0x3b6bb5(0xc9)])),_0x26676e=_0x3ee33d[_0x3b6bb5(0x90)](_0x526425=>{const _0x3be9e5=_0x3b6bb5,_0x490380=_0x526425[_0x3be9e5(0x9e)]==='success'?a26_0x53ebf6[_0x3be9e5(0xf5)](_0x526425[_0x3be9e5(0xb3)]):_0x526425[_0x3be9e5(0x9e)]===_0x3be9e5(0xb4)?a26_0x53ebf6[_0x3be9e5(0xd3)](_0x526425[_0x3be9e5(0xb3)]):a26_0x53ebf6[_0x3be9e5(0xf8)](_0x526425['statusIcon']),_0x2f5b9f=_0x526425[_0x3be9e5(0xa8)]['padEnd'](_0x1cc4e2),_0x26cca8=_0x526425[_0x3be9e5(0xf9)][_0x3be9e5(0x107)](_0x141fed),_0x4f01a5=_0x526425[_0x3be9e5(0xc7)]?a26_0x53ebf6[_0x3be9e5(0xeb)](_0x526425[_0x3be9e5(0xc7)][_0x3be9e5(0x107)](_0xcc474a)):'\x20'[_0x3be9e5(0xc3)](_0xcc474a),_0x578f58=hyperlink(_0x526425['name'],_0x526425[_0x3be9e5(0xee)]);return _0x3be9e5(0xe2)+_0x490380+'\x20'+_0x2f5b9f+_0x3be9e5(0x111)+_0x26cca8+'\x20\x20'+_0x4f01a5+'\x20\x20'+_0x578f58;});await writeOutput(_0x26676e['join']('\x0a'),_0x341c5b[_0x3b6bb5(0xf6)],_0x3b6bb5(0x96));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x34f809(0x10e)]='schedule:show';[a26_0x34f809(0x102)]=a26_0x34f809(0xc1);[a26_0x34f809(0x98)](_0x4d0c0e){const _0x35e004=a26_0x34f809,_0x243c7c=_0x4d0c0e[_0x35e004(0x10b)][0x0];if(!_0x243c7c)return _0x35e004(0xb1);return undefined;}async['execute'](_0x579784){const _0x43724d=a26_0x34f809,{options:_0x558d1d,args:_0x21006b,tdx:_0x5750e0}=_0x579784,_0x408a5f=_0x21006b[0x0],_0x3b5672=await withSpinner(_0x43724d(0xb5),()=>_0x5750e0[_0x43724d(0xc4)][_0x43724d(0xa4)](_0x408a5f),{'verbose':_0x558d1d[_0x43724d(0x108)]}),_0x4b5448=_0x3b5672[_0x43724d(0xc8)],_0x42c44d={'name':_0x4b5448[_0x43724d(0x10e)],'cron':_0x4b5448[_0x43724d(0xc7)],'database':_0x4b5448['database'],'type':_0x4b5448[_0x43724d(0x99)],'timezone':_0x4b5448['timezone'],'user_name':_0x4b5448[_0x43724d(0xe7)],'created_at':_0x4b5448[_0x43724d(0xf7)],'engine_version':_0x4b5448[_0x43724d(0x8d)],'executing_user_id':_0x4b5448[_0x43724d(0xdf)],'query':_0x4b5448[_0x43724d(0xc2)],'delay':_0x4b5448[_0x43724d(0x8c)],'priority':_0x4b5448['priority'],'retry_limit':_0x4b5448[_0x43724d(0xa3)],..._0x4b5448[_0x43724d(0x115)]&&{'result':_0x4b5448['result']}};return await handleSingleObjectOutput(_0x42c44d,_0x558d1d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x34f809(0xfb);[a26_0x34f809(0x102)]=a26_0x34f809(0xb9);[a26_0x34f809(0x98)](_0x16924a){const _0x474297=a26_0x34f809,_0x4725e4=_0x16924a[_0x474297(0x10b)][0x0];if(!_0x4725e4)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a26_0x34f809(0x118)](_0x3a3297){const _0x22b0b5=a26_0x34f809,{options:_0x291c96,args:_0x11755d,tdx:_0x1fffdd}=_0x3a3297,_0x4b83f2=_0x11755d[0x0],_0x55ba76=_0x291c96,_0x102cf0=_0x55ba76[_0x22b0b5(0x9d)],_0x361250=_0x55ba76[_0x22b0b5(0x105)],_0x3a946c=_0x55ba76['type']||_0x22b0b5(0xf4);let _0x2d844d;try{_0x2d844d=readFileSync(_0x361250,_0x22b0b5(0xff))[_0x22b0b5(0xcd)]();}catch(_0x1bb946){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x22b0b5(0x101)+_0x361250,_0x1bb946 instanceof Error?_0x1bb946:undefined);}if(!_0x2d844d)throw new SDKError(ErrorCode[_0x22b0b5(0xca)],'Query\x20file\x20is\x20empty');const _0x33c549={'database':_0x102cf0,'query':_0x2d844d,'type':_0x3a946c};if(_0x55ba76[_0x22b0b5(0xc7)])_0x33c549[_0x22b0b5(0xc7)]=_0x55ba76[_0x22b0b5(0xc7)];if(_0x55ba76[_0x22b0b5(0x10f)])_0x33c549[_0x22b0b5(0x10f)]=_0x55ba76[_0x22b0b5(0x10f)];if(_0x55ba76[_0x22b0b5(0x8c)]!==undefined)_0x33c549[_0x22b0b5(0x8c)]=Number(_0x55ba76[_0x22b0b5(0x8c)]);if(_0x55ba76[_0x22b0b5(0xfd)]!==undefined)_0x33c549['priority']=Number(_0x55ba76[_0x22b0b5(0xfd)]);if(_0x55ba76[_0x22b0b5(0xdb)]!==undefined)_0x33c549[_0x22b0b5(0xa3)]=Number(_0x55ba76[_0x22b0b5(0xdb)]);if(_0x55ba76[_0x22b0b5(0xf3)])_0x33c549[_0x22b0b5(0x8d)]=_0x55ba76[_0x22b0b5(0xf3)];if(_0x55ba76[_0x22b0b5(0x115)])_0x33c549[_0x22b0b5(0x115)]=_0x55ba76[_0x22b0b5(0x115)];if(_0x291c96['verbose']){console['error'](_0x22b0b5(0x9b)+_0x4b83f2),console[_0x22b0b5(0xb4)]('\x20\x20Database:\x20'+_0x102cf0),console[_0x22b0b5(0xb4)](_0x22b0b5(0x11c)+_0x3a946c);if(_0x33c549[_0x22b0b5(0xc7)])console[_0x22b0b5(0xb4)](_0x22b0b5(0x110)+_0x33c549[_0x22b0b5(0xc7)]);if(_0x33c549['timezone'])console['error'](_0x22b0b5(0xfe)+_0x33c549['timezone']);}const _0x45b0f3=await withSpinner('Creating\x20schedule...',()=>_0x1fffdd[_0x22b0b5(0xc4)][_0x22b0b5(0xaa)](_0x4b83f2,_0x33c549),{'verbose':_0x291c96[_0x22b0b5(0x108)]});return console[_0x22b0b5(0xb4)](_0x22b0b5(0xbe)+_0x45b0f3[_0x22b0b5(0xc8)][_0x22b0b5(0x10e)]),await handleSingleObjectOutput(_0x45b0f3[_0x22b0b5(0xc8)],_0x291c96),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x34f809(0x10e)]=a26_0x34f809(0x114);[a26_0x34f809(0x102)]='Update\x20a\x20scheduled\x20query';[a26_0x34f809(0x98)](_0x5d69be){const _0x12048=a26_0x34f809,_0x3a2dfb=_0x5d69be['args'][0x0];if(!_0x3a2dfb)return _0x12048(0xbf);return undefined;}async[a26_0x34f809(0x118)](_0x54480b){const _0x541357=a26_0x34f809,{options:_0x1e7261,args:_0x513b2a,tdx:_0xe92de7}=_0x54480b,_0x44fae5=_0x513b2a[0x0],_0x1906b0=_0x1e7261,_0x2d20c7={};if(_0x1906b0['database'])_0x2d20c7[_0x541357(0x9d)]=_0x1906b0['database'];if(_0x1906b0[_0x541357(0x99)])_0x2d20c7[_0x541357(0x99)]=_0x1906b0[_0x541357(0x99)];if(_0x1906b0[_0x541357(0xc7)])_0x2d20c7[_0x541357(0xc7)]=_0x1906b0[_0x541357(0xc7)];if(_0x1906b0[_0x541357(0x10f)])_0x2d20c7[_0x541357(0x10f)]=_0x1906b0[_0x541357(0x10f)];if(_0x1906b0[_0x541357(0x8c)]!==undefined)_0x2d20c7[_0x541357(0x8c)]=Number(_0x1906b0['delay']);if(_0x1906b0[_0x541357(0xfd)]!==undefined)_0x2d20c7[_0x541357(0xfd)]=Number(_0x1906b0[_0x541357(0xfd)]);if(_0x1906b0[_0x541357(0xdb)]!==undefined)_0x2d20c7[_0x541357(0xa3)]=Number(_0x1906b0['retryLimit']);if(_0x1906b0[_0x541357(0xf3)])_0x2d20c7[_0x541357(0x8d)]=_0x1906b0[_0x541357(0xf3)];if(_0x1906b0['result'])_0x2d20c7[_0x541357(0x115)]=_0x1906b0[_0x541357(0x115)];if(_0x1906b0['file'])try{_0x2d20c7[_0x541357(0xc2)]=readFileSync(_0x1906b0['file'],_0x541357(0xff))[_0x541357(0xcd)]();}catch(_0x3932f4){throw new SDKError(ErrorCode[_0x541357(0xca)],_0x541357(0x101)+_0x1906b0[_0x541357(0x105)],_0x3932f4 instanceof Error?_0x3932f4:undefined);}if(Object[_0x541357(0xc6)](_0x2d20c7)[_0x541357(0xc9)]===0x0)throw new SDKError(ErrorCode[_0x541357(0xca)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x1e7261['verbose']){console['error'](_0x541357(0xc5)+_0x44fae5);for(const [_0x1da446,_0x590a16]of Object[_0x541357(0xa9)](_0x2d20c7)){_0x1da446===_0x541357(0xc2)?console[_0x541357(0xb4)]('\x20\x20'+_0x1da446+':\x20'+_0x590a16['substring'](0x0,0x32)+_0x541357(0x9c)):console['error']('\x20\x20'+_0x1da446+':\x20'+_0x590a16);}}const _0x3bb08f=await withSpinner(_0x541357(0xd1),()=>_0xe92de7[_0x541357(0xc4)][_0x541357(0x95)](_0x44fae5,_0x2d20c7),{'verbose':_0x1e7261['verbose']});return console[_0x541357(0xb4)](_0x541357(0x117)+_0x3bb08f['data'][_0x541357(0x10e)]),await handleSingleObjectOutput(_0x3bb08f[_0x541357(0xc8)],_0x1e7261),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x34f809(0xa1);[a26_0x34f809(0x102)]=a26_0x34f809(0xd2);['validate'](_0x506ade){const _0x2dcd60=a26_0x34f809,_0x40b82d=_0x506ade[_0x2dcd60(0x10b)][0x0];if(!_0x40b82d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a26_0x34f809(0x118)](_0x4d185b){const _0x4b8888=a26_0x34f809,{options:_0x24bb1b,args:_0x3c52f5,tdx:_0x2f620e}=_0x4d185b,_0x406650=_0x3c52f5[0x0];if(!_0x24bb1b[_0x4b8888(0xbd)]){const _0x4352e0=await confirm(_0x4b8888(0xae)+_0x406650+'\x22?');if(!_0x4352e0)return console['error'](_0x4b8888(0x100)),0x0;}const _0x1eb14a=await withSpinner(_0x4b8888(0x103),()=>_0x2f620e[_0x4b8888(0xc4)][_0x4b8888(0xd9)](_0x406650),{'verbose':_0x24bb1b[_0x4b8888(0x108)]});return console['error'](_0x4b8888(0xfc)+_0x1eb14a[_0x4b8888(0xc8)][_0x4b8888(0x10e)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a26_0x34f809(0xdc);[a26_0x34f809(0x102)]=a26_0x34f809(0xf1);['validate'](_0x156d29){const _0x5a0c56=a26_0x34f809,_0x3d1c30=_0x156d29[_0x5a0c56(0x10b)][0x0];if(!_0x3d1c30)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a26_0x34f809(0x118)](_0x464f14){const _0xf8c49a=a26_0x34f809,{options:_0x31f572,args:_0x21b44d,tdx:_0xdd20bb}=_0x464f14,_0x382c64=_0x21b44d[0x0],_0x12c622=_0x31f572,_0x5af3ad=_0x12c622[_0xf8c49a(0xfa)],_0x3e6df0=_0x12c622[_0xf8c49a(0xe8)]!==undefined?Number(_0x12c622['num']):undefined;if(_0x31f572[_0xf8c49a(0x108)]){console[_0xf8c49a(0xb4)](_0xf8c49a(0x109)+_0x382c64);if(_0x5af3ad)console[_0xf8c49a(0xb4)](_0xf8c49a(0x10d)+_0x5af3ad);if(_0x3e6df0)console[_0xf8c49a(0xb4)](_0xf8c49a(0x10a)+_0x3e6df0);}const _0x282f07=await withSpinner(_0xf8c49a(0xe5),()=>_0xdd20bb['schedules']['run'](_0x382c64,{'time':_0x5af3ad,'num':_0x3e6df0}),{'verbose':_0x31f572[_0xf8c49a(0x108)]}),_0x3c261f=_0x282f07[_0xf8c49a(0xc8)][_0xf8c49a(0xb0)];console[_0xf8c49a(0xb4)]('Schedule\x20run\x20submitted:\x20'+_0x3c261f[_0xf8c49a(0xc9)]+_0xf8c49a(0x9a)+(_0x3c261f[_0xf8c49a(0xc9)]!==0x1?'s':'')+_0xf8c49a(0xe0));for(const _0x9297c5 of _0x3c261f){console[_0xf8c49a(0xb4)](_0xf8c49a(0xd5)+_0x9297c5['job_id']);}return await handleSDKOutput(_0x3c261f,_0x31f572),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x34f809(0x10e)]='schedule:history';[a26_0x34f809(0x102)]=a26_0x34f809(0xd8);['validate'](_0x363791){const _0x5793af=a26_0x34f809,_0x29f434=_0x363791[_0x5793af(0x10b)][0x0];if(!_0x29f434)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0x34f809(0x118)](_0x4ec6c7){const _0x1ae665=a26_0x34f809,{options:_0x1ccb85,args:_0x236946,tdx:_0x508fcc}=_0x4ec6c7,_0x68ec85=_0x236946[0x0],_0x4e6086=_0x1ccb85,_0x5a6a44=_0x4e6086['from']!==undefined?Number(_0x4e6086[_0x1ae665(0x10c)]):undefined,_0x3182e1=_0x4e6086['to']!==undefined?Number(_0x4e6086['to']):undefined,_0x20e6d6=await withSpinner(_0x1ae665(0xe3),()=>_0x508fcc[_0x1ae665(0xc4)][_0x1ae665(0xba)](_0x68ec85,{'from':_0x5a6a44,'to':_0x3182e1}),{'verbose':_0x1ccb85[_0x1ae665(0x108)]}),_0x34deb4=_0x20e6d6[_0x1ae665(0xc8)];console[_0x1ae665(0xb4)](_0x1ae665(0x92)+_0x34deb4[_0x1ae665(0xed)]+'\x20execution'+(_0x34deb4['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x34deb4['from']+'-'+_0x34deb4['to']+')');const _0x1b07d1=_0x34deb4[_0x1ae665(0xba)][_0x1ae665(0x90)](_0xc36685=>({'job_id':_0xc36685[_0x1ae665(0x106)],'type':_0xc36685[_0x1ae665(0x99)],'status':_0xc36685[_0x1ae665(0x9e)],'scheduled_at':_0xc36685[_0x1ae665(0xad)],'created_at':_0xc36685[_0x1ae665(0xf7)],'start_at':_0xc36685[_0x1ae665(0xb6)],'end_at':_0xc36685['end_at']}));return await handleSDKOutput(_0x1b07d1,_0x1ccb85),0x0;}}
|
|
1
|
+
const a26_0x48d5ba=a26_0x461c;function a26_0x461c(_0x1db0cf,_0x5a18ae){_0x1db0cf=_0x1db0cf-0x160;const _0x9e6784=a26_0x9e67();let _0x461caf=_0x9e6784[_0x1db0cf];return _0x461caf;}(function(_0x3f13c1,_0x37773f){const _0x2d54e2=a26_0x461c,_0x17692d=_0x3f13c1();while(!![]){try{const _0x5d7c66=parseInt(_0x2d54e2(0x168))/0x1*(parseInt(_0x2d54e2(0x167))/0x2)+-parseInt(_0x2d54e2(0x18a))/0x3*(-parseInt(_0x2d54e2(0x1b6))/0x4)+parseInt(_0x2d54e2(0x19e))/0x5*(parseInt(_0x2d54e2(0x1e9))/0x6)+parseInt(_0x2d54e2(0x1df))/0x7+-parseInt(_0x2d54e2(0x16b))/0x8*(-parseInt(_0x2d54e2(0x196))/0x9)+parseInt(_0x2d54e2(0x1a0))/0xa+-parseInt(_0x2d54e2(0x17f))/0xb*(parseInt(_0x2d54e2(0x1bd))/0xc);if(_0x5d7c66===_0x37773f)break;else _0x17692d['push'](_0x17692d['shift']());}catch(_0x2cc9f2){_0x17692d['push'](_0x17692d['shift']());}}}(a26_0x9e67,0x60df6));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 a26_0x313a4b from'chalk';function a26_0x9e67(){const _0x2fb1e4=['Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Creating\x20schedule:\x20','Delete\x20a\x20scheduled\x20query','substring','20xgMmAi','success','\x20(showing\x20','green','repeat','jsonl','schedule:create','12bKXzAg','time','user_name','ies','trino','m\x20ago','engineVersion','abs','queries','Schedule\x20deleted:\x20','soon','/app/queries/editor?queryId=','listQueries','schedules','Query\x20file\x20is\x20empty','\x20\x20Cron:\x20','created_at','priority','last_job','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','schedule:update','updated_at','create','cyan','output','schedule:show','Schedule\x20run\x20submitted:\x20','args','π
\x20','queryUrl','result','next_run_at','toLocaleDateString','schedule:history','5239493BJAxnb','type','json','max','length','\x20(use\x20--limit\x20to\x20see\x20more)','Deleting\x20schedule...','database','cron','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','15822MVfwHm','Updating\x20schedule:\x20','Show\x20schedule\x20execution\x20history','end_at','Update\x20a\x20scheduled\x20query','lastRun','schedule:delete','yes','format','log','limit','6Xhcmvd','70563CVwOoj','statusIcon','Updating\x20schedule...','24MaObAr','file','Creating\x20schedule...','keys','table','d\x20ago','executing_user_id','nextRun','verbose','data','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','...','Showing\x20first\x20','\x20\x20Job\x20ID:\x20','join','name','start_at','utf-8','show','16870887pHdkTD','list','padEnd','in\x20','retryLimit','Run\x20a\x20scheduled\x20query\x20immediately','update','timezone','execute','schedule:list','count','7527uRfzQq','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','ended_at','tsv','\x20scheduled\x20quer','\x20\x20Num:\x20','error','delay','dim','\x20matching\x20\x22','No\x20scheduled\x20queries\x20found','round','1063701wuHHXg','\x20\x20Time:\x20','INVALID_ARGUMENT','\x20\x20Type:\x20','retry_limit','h\x20ago','query','\x20schedules','270bcZWCW','just\x20now','4608090sLMDHz','run','site','trim','\x20\x20β\x20','from','Failed\x20to\x20read\x20file:\x20','engine_version','map','Cancelled','pagination','Show\x20schedule\x20details','num','description','status','Searching\x20scheduled\x20queries\x20matching\x20\x22','validate','entries'];a26_0x9e67=function(){return _0x2fb1e4;};return a26_0x9e67();}function formatRelativeTime(_0x1e3b96){const _0x1fa443=a26_0x461c,_0x183b4f=new Date(_0x1e3b96),_0x5f0b8e=new Date(),_0x95718=_0x183b4f['getTime']()-_0x5f0b8e['getTime'](),_0x2fdf39=Math[_0x1fa443(0x1c4)](_0x95718)/0x3e8,_0x4ad13d=_0x95718<0x0;if(_0x2fdf39<0x3c)return _0x4ad13d?_0x1fa443(0x19f):_0x1fa443(0x1c7);else{if(_0x2fdf39<0xe10){const _0x1da955=Math[_0x1fa443(0x195)](_0x2fdf39/0x3c);return _0x4ad13d?_0x1da955+_0x1fa443(0x1c2):_0x1fa443(0x182)+_0x1da955+'m';}else{if(_0x2fdf39<0x15180){const _0x4ea015=Math['round'](_0x2fdf39/0xe10);return _0x4ad13d?_0x4ea015+_0x1fa443(0x19b):_0x1fa443(0x182)+_0x4ea015+'h';}else{if(_0x2fdf39<0x93a80){const _0x278edf=Math[_0x1fa443(0x195)](_0x2fdf39/0x15180);return _0x4ad13d?_0x278edf+_0x1fa443(0x170):'in\x20'+_0x278edf+'d';}else return _0x183b4f[_0x1fa443(0x1dd)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]=a26_0x48d5ba(0x188);[a26_0x48d5ba(0x1ad)]='List\x20scheduled\x20queries';async['execute'](_0xd078c9){const _0x549501=a26_0x48d5ba,{options:_0x1947e6,args:_0x10b08f,tdx:_0x25a80e}=_0xd078c9,_0x472706=resolveLimit(_0x1947e6[_0x549501(0x166)],DEFAULT_DISPLAY_LIMIT),_0x4496e1=_0x10b08f[0x0],_0x289238=_0x4496e1?_0x549501(0x1af)+_0x4496e1+'\x22...':'Listing\x20scheduled\x20queries...',_0x45120a=await withSpinner(_0x289238,()=>_0x25a80e[_0x549501(0x1ca)][_0x549501(0x1c9)]({'limit':_0x472706,'scheduled':!![],'pattern':_0x4496e1}),{'verbose':_0x1947e6[_0x549501(0x173)]}),_0x2ea8b4=_0x45120a[_0x549501(0x174)][_0x549501(0x1c5)],_0x3139a8=_0x45120a[_0x549501(0x174)][_0x549501(0x1aa)]['has_next_page'],_0x224b5c=_0x4496e1?_0x549501(0x193)+_0x4496e1+'\x22':'';_0x3139a8?console[_0x549501(0x190)](_0x549501(0x178)+_0x2ea8b4[_0x549501(0x1e3)]+_0x549501(0x19d)+_0x224b5c+_0x549501(0x1e4)):console['error']('Found\x20'+_0x2ea8b4[_0x549501(0x1e3)]+_0x549501(0x18e)+(_0x2ea8b4[_0x549501(0x1e3)]!==0x1?_0x549501(0x1c0):'y')+_0x224b5c);if(_0x1947e6[_0x549501(0x164)]===_0x549501(0x1e1)||_0x1947e6[_0x549501(0x164)]===_0x549501(0x1bb)||_0x1947e6[_0x549501(0x164)]===_0x549501(0x16f)||_0x1947e6[_0x549501(0x164)]===_0x549501(0x18d)){const _0x1f0008=_0x2ea8b4['map'](_0x39c042=>({'id':_0x39c042['id'],'name':_0x39c042[_0x549501(0x17b)],'cron':_0x39c042[_0x549501(0x1e7)],'database':_0x39c042['database']?.[_0x549501(0x17b)],'type':_0x39c042[_0x549501(0x1e0)],'timezone':_0x39c042['time_zone'],'user_name':_0x39c042[_0x549501(0x175)]?.[_0x549501(0x17b)],'updated_at':_0x39c042[_0x549501(0x1d2)],'next_run_at':_0x39c042[_0x549501(0x1dc)],'last_job_status':_0x39c042['last_job']?.[_0x549501(0x1ae)]}));await handleSDKOutput(_0x1f0008,_0x1947e6);}else{if(_0x2ea8b4[_0x549501(0x1e3)]===0x0)console[_0x549501(0x165)](_0x549501(0x194));else{const _0x2c719a=_0x1947e6[_0x549501(0x1a2)],_0x4db918=_0x2ea8b4[_0x549501(0x1a8)](_0x137d0d=>{const _0xe25699=_0x549501,_0x2cea8d=_0x137d0d[_0xe25699(0x1cf)]?.[_0xe25699(0x1ae)]?_0x137d0d['last_job'][_0xe25699(0x1ae)]==='success'?'β':'β':'-',_0x268288=_0x137d0d[_0xe25699(0x1cf)]?.[_0xe25699(0x18c)]?formatRelativeTime(_0x137d0d[_0xe25699(0x1cf)][_0xe25699(0x18c)]):'never',_0x57d7bb=_0x137d0d[_0xe25699(0x1dc)]?formatRelativeTime(_0x137d0d['next_run_at']):'-',_0x4bc829=_0x137d0d[_0xe25699(0x1e7)]||'',_0x50cc82=_0x137d0d[_0xe25699(0x17b)]||'(unnamed)',_0x1135df=getConsoleUrl(_0x2c719a,_0xe25699(0x1c8)+_0x137d0d['id']);return{'statusIcon':_0x2cea8d,'lastRun':_0x268288,'nextRun':_0x57d7bb,'cron':_0x4bc829,'name':_0x50cc82,'queryUrl':_0x1135df,'status':_0x137d0d['last_job']?.[_0xe25699(0x1ae)]};}),_0x597cf0=Math[_0x549501(0x1e2)](..._0x4db918[_0x549501(0x1a8)](_0x22ec50=>_0x22ec50[_0x549501(0x161)][_0x549501(0x1e3)])),_0x614d32=Math[_0x549501(0x1e2)](..._0x4db918[_0x549501(0x1a8)](_0xa66849=>_0xa66849[_0x549501(0x172)][_0x549501(0x1e3)])),_0xe1656d=Math[_0x549501(0x1e2)](..._0x4db918['map'](_0x2e4c03=>_0x2e4c03[_0x549501(0x1e7)][_0x549501(0x1e3)])),_0x565fe4=_0x4db918[_0x549501(0x1a8)](_0x378f38=>{const _0x53fa9c=_0x549501,_0x4daf19=_0x378f38[_0x53fa9c(0x1ae)]===_0x53fa9c(0x1b7)?a26_0x313a4b[_0x53fa9c(0x1b9)](_0x378f38[_0x53fa9c(0x169)]):_0x378f38['status']===_0x53fa9c(0x190)?a26_0x313a4b['red'](_0x378f38[_0x53fa9c(0x169)]):a26_0x313a4b[_0x53fa9c(0x192)](_0x378f38[_0x53fa9c(0x169)]),_0x85b6d3=_0x378f38['lastRun'][_0x53fa9c(0x181)](_0x597cf0),_0x3e86f8=_0x378f38[_0x53fa9c(0x172)][_0x53fa9c(0x181)](_0x614d32),_0x5080c3=_0x378f38[_0x53fa9c(0x1e7)]?a26_0x313a4b[_0x53fa9c(0x1d4)](_0x378f38['cron'][_0x53fa9c(0x181)](_0xe1656d)):'\x20'[_0x53fa9c(0x1ba)](_0xe1656d),_0x2f8d7d=hyperlink(_0x378f38[_0x53fa9c(0x17b)],_0x378f38[_0x53fa9c(0x1da)]);return _0x53fa9c(0x1d9)+_0x4daf19+'\x20'+_0x85b6d3+_0x53fa9c(0x1a4)+_0x3e86f8+'\x20\x20'+_0x5080c3+'\x20\x20'+_0x2f8d7d;});await writeOutput(_0x565fe4[_0x549501(0x17a)]('\x0a'),_0x1947e6[_0x549501(0x1d5)],_0x549501(0x180));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]=a26_0x48d5ba(0x1d6);[a26_0x48d5ba(0x1ad)]=a26_0x48d5ba(0x1ab);[a26_0x48d5ba(0x1b0)](_0x2171b2){const _0x36435e=_0x2171b2['args'][0x0];if(!_0x36435e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a26_0x48d5ba(0x187)](_0x1ed753){const _0x412102=a26_0x48d5ba,{options:_0x3370d7,args:_0x253f97,tdx:_0x2cd1bd}=_0x1ed753,_0x478264=_0x253f97[0x0],_0xab3d02=await withSpinner('Getting\x20schedule\x20details...',()=>_0x2cd1bd['schedules'][_0x412102(0x17e)](_0x478264),{'verbose':_0x3370d7[_0x412102(0x173)]}),_0x3af90c=_0xab3d02[_0x412102(0x174)],_0x362913={'name':_0x3af90c[_0x412102(0x17b)],'cron':_0x3af90c[_0x412102(0x1e7)],'database':_0x3af90c[_0x412102(0x1e6)],'type':_0x3af90c[_0x412102(0x1e0)],'timezone':_0x3af90c[_0x412102(0x186)],'user_name':_0x3af90c[_0x412102(0x1bf)],'created_at':_0x3af90c[_0x412102(0x1cd)],'engine_version':_0x3af90c['engine_version'],'executing_user_id':_0x3af90c[_0x412102(0x171)],'query':_0x3af90c[_0x412102(0x19c)],'delay':_0x3af90c[_0x412102(0x191)],'priority':_0x3af90c[_0x412102(0x1ce)],'retry_limit':_0x3af90c[_0x412102(0x19a)],..._0x3af90c[_0x412102(0x1db)]&&{'result':_0x3af90c[_0x412102(0x1db)]}};return await handleSingleObjectOutput(_0x362913,_0x3370d7),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]=a26_0x48d5ba(0x1bc);[a26_0x48d5ba(0x1ad)]='Create\x20a\x20scheduled\x20query';['validate'](_0x300e47){const _0x3c13ef=_0x300e47['args'][0x0];if(!_0x3c13ef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a26_0x48d5ba(0x187)](_0x11bc3d){const _0x39aa5c=a26_0x48d5ba,{options:_0x4ef737,args:_0x4e010f,tdx:_0x6beb76}=_0x11bc3d,_0x3ef163=_0x4e010f[0x0],_0x112014=_0x4ef737,_0x1e138e=_0x112014[_0x39aa5c(0x1e6)],_0x5020dd=_0x112014[_0x39aa5c(0x16c)],_0x4ba73f=_0x112014[_0x39aa5c(0x1e0)]||_0x39aa5c(0x1c1);let _0x46b372;try{_0x46b372=readFileSync(_0x5020dd,_0x39aa5c(0x17d))[_0x39aa5c(0x1a3)]();}catch(_0x30c594){throw new SDKError(ErrorCode[_0x39aa5c(0x198)],_0x39aa5c(0x1a6)+_0x5020dd,_0x30c594 instanceof Error?_0x30c594:undefined);}if(!_0x46b372)throw new SDKError(ErrorCode[_0x39aa5c(0x198)],_0x39aa5c(0x1cb));const _0x448f2c={'database':_0x1e138e,'query':_0x46b372,'type':_0x4ba73f};if(_0x112014[_0x39aa5c(0x1e7)])_0x448f2c[_0x39aa5c(0x1e7)]=_0x112014['cron'];if(_0x112014[_0x39aa5c(0x186)])_0x448f2c[_0x39aa5c(0x186)]=_0x112014['timezone'];if(_0x112014[_0x39aa5c(0x191)]!==undefined)_0x448f2c[_0x39aa5c(0x191)]=Number(_0x112014['delay']);if(_0x112014[_0x39aa5c(0x1ce)]!==undefined)_0x448f2c[_0x39aa5c(0x1ce)]=Number(_0x112014[_0x39aa5c(0x1ce)]);if(_0x112014[_0x39aa5c(0x183)]!==undefined)_0x448f2c[_0x39aa5c(0x19a)]=Number(_0x112014[_0x39aa5c(0x183)]);if(_0x112014[_0x39aa5c(0x1c3)])_0x448f2c[_0x39aa5c(0x1a7)]=_0x112014[_0x39aa5c(0x1c3)];if(_0x112014[_0x39aa5c(0x1db)])_0x448f2c[_0x39aa5c(0x1db)]=_0x112014['result'];if(_0x4ef737[_0x39aa5c(0x173)]){console['error'](_0x39aa5c(0x1b3)+_0x3ef163),console['error']('\x20\x20Database:\x20'+_0x1e138e),console[_0x39aa5c(0x190)](_0x39aa5c(0x199)+_0x4ba73f);if(_0x448f2c[_0x39aa5c(0x1e7)])console[_0x39aa5c(0x190)](_0x39aa5c(0x1cc)+_0x448f2c[_0x39aa5c(0x1e7)]);if(_0x448f2c[_0x39aa5c(0x186)])console['error']('\x20\x20Timezone:\x20'+_0x448f2c[_0x39aa5c(0x186)]);}const _0x23f90c=await withSpinner(_0x39aa5c(0x16d),()=>_0x6beb76[_0x39aa5c(0x1ca)][_0x39aa5c(0x1d3)](_0x3ef163,_0x448f2c),{'verbose':_0x4ef737['verbose']});return console[_0x39aa5c(0x190)]('Schedule\x20created:\x20'+_0x23f90c['data'][_0x39aa5c(0x17b)]),await handleSingleObjectOutput(_0x23f90c[_0x39aa5c(0x174)],_0x4ef737),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]=a26_0x48d5ba(0x1d1);[a26_0x48d5ba(0x1ad)]=a26_0x48d5ba(0x160);[a26_0x48d5ba(0x1b0)](_0x5f0993){const _0x3309da=a26_0x48d5ba,_0xaa337f=_0x5f0993[_0x3309da(0x1d8)][0x0];if(!_0xaa337f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a26_0x48d5ba(0x187)](_0x228ca9){const _0x1d463a=a26_0x48d5ba,{options:_0x2dfba1,args:_0x51c677,tdx:_0x179797}=_0x228ca9,_0x1173d0=_0x51c677[0x0],_0x3ee5dc=_0x2dfba1,_0x35b8e9={};if(_0x3ee5dc['database'])_0x35b8e9[_0x1d463a(0x1e6)]=_0x3ee5dc[_0x1d463a(0x1e6)];if(_0x3ee5dc[_0x1d463a(0x1e0)])_0x35b8e9['type']=_0x3ee5dc[_0x1d463a(0x1e0)];if(_0x3ee5dc[_0x1d463a(0x1e7)])_0x35b8e9['cron']=_0x3ee5dc[_0x1d463a(0x1e7)];if(_0x3ee5dc[_0x1d463a(0x186)])_0x35b8e9['timezone']=_0x3ee5dc[_0x1d463a(0x186)];if(_0x3ee5dc[_0x1d463a(0x191)]!==undefined)_0x35b8e9[_0x1d463a(0x191)]=Number(_0x3ee5dc[_0x1d463a(0x191)]);if(_0x3ee5dc['priority']!==undefined)_0x35b8e9['priority']=Number(_0x3ee5dc[_0x1d463a(0x1ce)]);if(_0x3ee5dc[_0x1d463a(0x183)]!==undefined)_0x35b8e9[_0x1d463a(0x19a)]=Number(_0x3ee5dc[_0x1d463a(0x183)]);if(_0x3ee5dc['engineVersion'])_0x35b8e9['engine_version']=_0x3ee5dc[_0x1d463a(0x1c3)];if(_0x3ee5dc[_0x1d463a(0x1db)])_0x35b8e9['result']=_0x3ee5dc[_0x1d463a(0x1db)];if(_0x3ee5dc[_0x1d463a(0x16c)])try{_0x35b8e9[_0x1d463a(0x19c)]=readFileSync(_0x3ee5dc[_0x1d463a(0x16c)],'utf-8')[_0x1d463a(0x1a3)]();}catch(_0x155a66){throw new SDKError(ErrorCode[_0x1d463a(0x198)],'Failed\x20to\x20read\x20file:\x20'+_0x3ee5dc[_0x1d463a(0x16c)],_0x155a66 instanceof Error?_0x155a66:undefined);}if(Object[_0x1d463a(0x16e)](_0x35b8e9)['length']===0x0)throw new SDKError(ErrorCode[_0x1d463a(0x198)],_0x1d463a(0x18b));if(_0x2dfba1[_0x1d463a(0x173)]){console[_0x1d463a(0x190)](_0x1d463a(0x1ea)+_0x1173d0);for(const [_0x451f29,_0x7d8557]of Object[_0x1d463a(0x1b1)](_0x35b8e9)){_0x451f29===_0x1d463a(0x19c)?console['error']('\x20\x20'+_0x451f29+':\x20'+_0x7d8557[_0x1d463a(0x1b5)](0x0,0x32)+_0x1d463a(0x177)):console[_0x1d463a(0x190)]('\x20\x20'+_0x451f29+':\x20'+_0x7d8557);}}const _0x9d3680=await withSpinner(_0x1d463a(0x16a),()=>_0x179797[_0x1d463a(0x1ca)][_0x1d463a(0x185)](_0x1173d0,_0x35b8e9),{'verbose':_0x2dfba1[_0x1d463a(0x173)]});return console['error']('Schedule\x20updated:\x20'+_0x9d3680[_0x1d463a(0x174)][_0x1d463a(0x17b)]),await handleSingleObjectOutput(_0x9d3680[_0x1d463a(0x174)],_0x2dfba1),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x48d5ba(0x162);[a26_0x48d5ba(0x1ad)]=a26_0x48d5ba(0x1b4);[a26_0x48d5ba(0x1b0)](_0x41fa1b){const _0x364572=a26_0x48d5ba,_0x57bf0c=_0x41fa1b[_0x364572(0x1d8)][0x0];if(!_0x57bf0c)return _0x364572(0x176);return undefined;}async['execute'](_0x45078a){const _0x44382e=a26_0x48d5ba,{options:_0x36b189,args:_0x5780db,tdx:_0x558b00}=_0x45078a,_0xf71f02=_0x5780db[0x0];if(!_0x36b189[_0x44382e(0x163)]){const _0x5587ea=await confirm(_0x44382e(0x1b2)+_0xf71f02+'\x22?');if(!_0x5587ea)return console[_0x44382e(0x190)](_0x44382e(0x1a9)),0x0;}const _0x191dc5=await withSpinner(_0x44382e(0x1e5),()=>_0x558b00['schedules']['delete'](_0xf71f02),{'verbose':_0x36b189['verbose']});return console[_0x44382e(0x190)](_0x44382e(0x1c6)+_0x191dc5['data'][_0x44382e(0x17b)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]='schedule:run';[a26_0x48d5ba(0x1ad)]=a26_0x48d5ba(0x184);[a26_0x48d5ba(0x1b0)](_0x25d5d4){const _0x15ecb9=a26_0x48d5ba,_0x5b9184=_0x25d5d4[_0x15ecb9(0x1d8)][0x0];if(!_0x5b9184)return _0x15ecb9(0x1d0);return undefined;}async[a26_0x48d5ba(0x187)](_0x3886fa){const _0xf8cd0e=a26_0x48d5ba,{options:_0x4026de,args:_0x45b514,tdx:_0x498834}=_0x3886fa,_0x555bb3=_0x45b514[0x0],_0x4d8c09=_0x4026de,_0xdb4b0c=_0x4d8c09[_0xf8cd0e(0x1be)],_0x4f8081=_0x4d8c09[_0xf8cd0e(0x1ac)]!==undefined?Number(_0x4d8c09[_0xf8cd0e(0x1ac)]):undefined;if(_0x4026de['verbose']){console[_0xf8cd0e(0x190)]('Running\x20schedule:\x20'+_0x555bb3);if(_0xdb4b0c)console[_0xf8cd0e(0x190)](_0xf8cd0e(0x197)+_0xdb4b0c);if(_0x4f8081)console[_0xf8cd0e(0x190)](_0xf8cd0e(0x18f)+_0x4f8081);}const _0x570f14=await withSpinner('Running\x20schedule...',()=>_0x498834[_0xf8cd0e(0x1ca)][_0xf8cd0e(0x1a1)](_0x555bb3,{'time':_0xdb4b0c,'num':_0x4f8081}),{'verbose':_0x4026de[_0xf8cd0e(0x173)]}),_0xc33b54=_0x570f14[_0xf8cd0e(0x174)]['jobs'];console[_0xf8cd0e(0x190)](_0xf8cd0e(0x1d7)+_0xc33b54[_0xf8cd0e(0x1e3)]+'\x20job'+(_0xc33b54[_0xf8cd0e(0x1e3)]!==0x1?'s':'')+'\x20created');for(const _0x5eab8d of _0xc33b54){console['error'](_0xf8cd0e(0x179)+_0x5eab8d['job_id']);}return await handleSDKOutput(_0xc33b54,_0x4026de),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x48d5ba(0x17b)]=a26_0x48d5ba(0x1de);[a26_0x48d5ba(0x1ad)]=a26_0x48d5ba(0x1eb);[a26_0x48d5ba(0x1b0)](_0x48a699){const _0x2954a7=a26_0x48d5ba,_0x4e3a1f=_0x48a699['args'][0x0];if(!_0x4e3a1f)return _0x2954a7(0x1e8);return undefined;}async['execute'](_0x5ba7c8){const _0xab9549=a26_0x48d5ba,{options:_0x4a89d3,args:_0x44f406,tdx:_0x3c2712}=_0x5ba7c8,_0x5a2cea=_0x44f406[0x0],_0x482bfa=_0x4a89d3,_0x1b7290=_0x482bfa[_0xab9549(0x1a5)]!==undefined?Number(_0x482bfa['from']):undefined,_0x3c5249=_0x482bfa['to']!==undefined?Number(_0x482bfa['to']):undefined,_0x42eaf8=await withSpinner('Getting\x20schedule\x20history...',()=>_0x3c2712[_0xab9549(0x1ca)]['history'](_0x5a2cea,{'from':_0x1b7290,'to':_0x3c5249}),{'verbose':_0x4a89d3[_0xab9549(0x173)]}),_0x327a35=_0x42eaf8['data'];console['error']('Found\x20'+_0x327a35[_0xab9549(0x189)]+'\x20execution'+(_0x327a35['count']!==0x1?'s':'')+_0xab9549(0x1b8)+_0x327a35[_0xab9549(0x1a5)]+'-'+_0x327a35['to']+')');const _0x30d071=_0x327a35['history'][_0xab9549(0x1a8)](_0x255541=>({'job_id':_0x255541['job_id'],'type':_0x255541[_0xab9549(0x1e0)],'status':_0x255541['status'],'scheduled_at':_0x255541['scheduled_at'],'created_at':_0x255541[_0xab9549(0x1cd)],'start_at':_0x255541[_0xab9549(0x17c)],'end_at':_0x255541[_0xab9549(0x1ec)]}));return await handleSDKOutput(_0x30d071,_0x4a89d3),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x51d0c2=a27_0xea12;(function(_0x4c8ce4,_0x5d9496){const _0x104b99=a27_0xea12,_0x286f47=_0x4c8ce4();while(!![]){try{const _0x7e9fbd=-parseInt(_0x104b99(0x200))/0x1*(-parseInt(_0x104b99(0x17d))/0x2)+-parseInt(_0x104b99(0x18d))/0x3*(-parseInt(_0x104b99(0x1ef))/0x4)+-parseInt(_0x104b99(0x1f3))/0x5*(parseInt(_0x104b99(0x1a7))/0x6)+-parseInt(_0x104b99(0x1ea))/0x7*(parseInt(_0x104b99(0x1c6))/0x8)+-parseInt(_0x104b99(0x1df))/0x9*(parseInt(_0x104b99(0x1c9))/0xa)+-parseInt(_0x104b99(0x1f2))/0xb*(parseInt(_0x104b99(0x1d3))/0xc)+-parseInt(_0x104b99(0x17c))/0xd*(-parseInt(_0x104b99(0x1f6))/0xe);if(_0x7e9fbd===_0x5d9496)break;else _0x286f47['push'](_0x286f47['shift']());}catch(_0x4881cc){_0x286f47['push'](_0x286f47['shift']());}}}(a27_0x46c1,0xded2f));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';function a27_0xea12(_0x9b02df,_0x5eb5e1){_0x9b02df=_0x9b02df-0x171;const _0x46c17a=a27_0x46c1();let _0xea1293=_0x46c17a[_0x9b02df];return _0xea1293;}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 a27_0x25ee13 from'chalk';async function resolveSegmentTarget(_0xc2816,_0x1d5649,_0x2a52fb){const _0x364c6c=a27_0xea12;if(isYamlFilePath(_0xc2816))try{const _0x54c037=await resolveYamlFilePath(_0xc2816);return _0x2a52fb&&(console[_0x364c6c(0x175)](_0x364c6c(0x1e0)+_0xc2816),console[_0x364c6c(0x175)](_0x364c6c(0x1de)+_0x54c037[_0x364c6c(0x17e)]),console[_0x364c6c(0x175)](_0x364c6c(0x19c)+_0x54c037[_0x364c6c(0x195)]),console[_0x364c6c(0x175)](_0x364c6c(0x1a5)+(_0x54c037[_0x364c6c(0x1a3)]||_0x364c6c(0x1f0))),console[_0x364c6c(0x175)](_0x364c6c(0x1fb)+_0x54c037['fullPath'])),_0x54c037[_0x364c6c(0x1ce)];}catch(_0x39fcf1){throw new SDKError(ErrorCode[_0x364c6c(0x1bf)],_0x364c6c(0x176)+_0x39fcf1[_0x364c6c(0x190)]);}if(!_0x1d5649)throw new SDKError(ErrorCode[_0x364c6c(0x1bf)],_0x364c6c(0x172));return _0x1d5649+'/'+_0xc2816;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x51d0c2(0x202)]=a27_0x51d0c2(0x1c1);['description']=a27_0x51d0c2(0x17a);async['execute'](_0x325479){const _0x4f0061=a27_0x51d0c2,{options:_0x20a504,args:_0x4a76c2,tdx:_0x833fb}=_0x325479,_0x21c069=_0x4a76c2[0x0],_0x349f7a=!_0x21c069&&!!_0x20a504[_0x4f0061(0x17e)],_0x17fa98=_0x21c069||_0x20a504[_0x4f0061(0x17e)];if(!_0x17fa98)return console[_0x4f0061(0x175)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x4f0061(0x175)](_0x4f0061(0x1e8)),console[_0x4f0061(0x175)](_0x4f0061(0x1ec)),console[_0x4f0061(0x175)](_0x4f0061(0x1ad)),console[_0x4f0061(0x175)](_0x4f0061(0x1d4)),console[_0x4f0061(0x175)](_0x4f0061(0x1c0)),console[_0x4f0061(0x175)](_0x4f0061(0x194)),0x1;try{const _0x54be05=_0x20a504['segmentPath'];let _0x583635=_0x17fa98;!_0x349f7a&&_0x54be05&&!_0x17fa98[_0x4f0061(0x201)]('/')&&(_0x583635=_0x54be05+'/'+_0x17fa98,_0x20a504[_0x4f0061(0x18b)]&&console[_0x4f0061(0x175)]('Resolved\x20relative\x20path\x20to:\x20'+_0x583635));const _0x1ce698=await withSpinner(_0x4f0061(0x1b5)+_0x583635+_0x4f0061(0x1d7),()=>_0x833fb[_0x4f0061(0x1b9)][_0x4f0061(0x1bb)](_0x583635),{'verbose':_0x20a504[_0x4f0061(0x18b)]}),_0x1b3909=_0x1ce698[_0x4f0061(0x1e7)];_0x20a504['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x1b3909['type']),console[_0x4f0061(0x175)](_0x4f0061(0x1bc)+_0x1b3909[_0x4f0061(0x1d9)]),_0x1b3909[_0x4f0061(0x19a)]&&console[_0x4f0061(0x175)]('Folder\x20ID:\x20'+_0x1b3909[_0x4f0061(0x19a)]),_0x1b3909['segmentId']&&console[_0x4f0061(0x175)](_0x4f0061(0x209)+_0x1b3909[_0x4f0061(0x181)]));if(_0x1b3909['type']===_0x4f0061(0x19f)){const _0x3da2ee=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x833fb[_0x4f0061(0x1b9)][_0x4f0061(0x204)](_0x1b3909[_0x4f0061(0x1d9)]),{'verbose':_0x20a504[_0x4f0061(0x18b)]});await handleSingleObjectOutput(_0x3da2ee[_0x4f0061(0x1e7)],_0x20a504);}else{if(_0x1b3909['type']===_0x4f0061(0x177)){if(!_0x1b3909[_0x4f0061(0x19a)])throw new SDKError(ErrorCode[_0x4f0061(0x18f)],_0x4f0061(0x1fe));const _0x46a965=await withSpinner(_0x4f0061(0x1f8),()=>_0x833fb['segment'][_0x4f0061(0x1be)](_0x1b3909[_0x4f0061(0x19a)]),{'verbose':_0x20a504[_0x4f0061(0x18b)]});await handleSingleObjectOutput(_0x46a965[_0x4f0061(0x1e7)],_0x20a504);}else{if(_0x1b3909[_0x4f0061(0x1c7)]===_0x4f0061(0x1b9)){if(!_0x1b3909[_0x4f0061(0x181)])throw new SDKError(ErrorCode[_0x4f0061(0x18c)],_0x4f0061(0x196));const _0x35ba2a=await withSpinner(_0x4f0061(0x1a6),()=>_0x833fb['segment']['getSegment'](_0x1b3909['parentId'],_0x1b3909[_0x4f0061(0x181)]),{'verbose':_0x20a504['verbose']});await handleSingleObjectOutput(_0x35ba2a[_0x4f0061(0x1e7)],_0x20a504);}}}return 0x0;}catch(_0x56ee03){if(_0x56ee03 instanceof SDKError)return console['error'](_0x4f0061(0x1d0)+_0x56ee03['message']),_0x56ee03['cause']&&console[_0x4f0061(0x175)](_0x4f0061(0x185)+_0x56ee03[_0x4f0061(0x1b2)]),0x1;throw _0x56ee03;}}}export class SegmentShowCommand extends BaseCommand{['name']=a27_0x51d0c2(0x1c2);[a27_0x51d0c2(0x187)]=a27_0x51d0c2(0x1b6);async['execute'](_0x3df5fd){const _0x30f950=a27_0x51d0c2,{options:_0x565210,args:_0x1deefb,tdx:_0x39ed66}=_0x3df5fd,_0x42846b=_0x1deefb[0x0];if(!_0x42846b)return console[_0x30f950(0x175)](_0x30f950(0x1fa)),console['error'](_0x30f950(0x18e)),console[_0x30f950(0x175)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console['error'](_0x30f950(0x1ec)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x30f950(0x175)](_0x30f950(0x1f9)),0x1;try{const _0x3b99b0=_0x565210[_0x30f950(0x17e)],_0x3decb6=await resolveSegmentTarget(_0x42846b,_0x3b99b0,_0x565210[_0x30f950(0x18b)]);_0x565210['verbose']&&console['error'](_0x30f950(0x18a)+_0x3decb6);const _0x4e354b=await withSpinner(_0x30f950(0x198)+_0x42846b+_0x30f950(0x1d7),()=>_0x39ed66['segment'][_0x30f950(0x1bb)](_0x3decb6),{'verbose':_0x565210[_0x30f950(0x18b)]}),_0x3ddb91=_0x4e354b[_0x30f950(0x1e7)];_0x565210[_0x30f950(0x18b)]&&(console[_0x30f950(0x175)](_0x30f950(0x1c5)+_0x3ddb91['type']),console[_0x30f950(0x175)](_0x30f950(0x1bc)+_0x3ddb91['parentId']));if(_0x3ddb91[_0x30f950(0x1c7)]==='folder')return console[_0x30f950(0x175)](_0x30f950(0x1f5)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x3ddb91['type']===_0x30f950(0x19f))return console[_0x30f950(0x175)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x30f950(0x175)](_0x30f950(0x191)),0x1;if(!_0x3ddb91['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x30f950(0x196));const _0x7336d=await withSpinner(_0x30f950(0x1b8),()=>_0x39ed66[_0x30f950(0x1b9)][_0x30f950(0x1ee)](_0x3ddb91[_0x30f950(0x1d9)],_0x3ddb91['segmentId']),{'verbose':_0x565210[_0x30f950(0x18b)]});let _0x132cf0=_0x7336d[_0x30f950(0x1e7)];const _0x2e6b73=resolveLimit(_0x565210['limit'],DEFAULT_DISPLAY_LIMIT),_0x5ac414=/\bLIMIT\s+\d+/i[_0x30f950(0x1a1)](_0x132cf0);!_0x5ac414&&(_0x132cf0=_0x132cf0['trim']()['replace'](/;+$/,''),_0x132cf0='SELECT\x20*\x20FROM\x20(\x0a'+_0x132cf0+_0x30f950(0x1dd)+_0x2e6b73);_0x565210[_0x30f950(0x18b)]&&console[_0x30f950(0x175)](_0x30f950(0x1db)+_0x132cf0);const _0xed73e9=await withProgressSpinner(_0x30f950(0x20e),async _0x33d94a=>{const _0x302d65=_0x30f950,_0x4e9070=await _0x39ed66[_0x302d65(0x1b7)][_0x302d65(0x188)](_0x132cf0,{'catalog':'td','schema':'information_schema','onJobId':_0x1c1904=>{const _0x2abcb8=_0x302d65;_0x33d94a[_0x2abcb8(0x1a0)](_0x1c1904);}});return _0x4e9070;},{'verbose':_0x565210[_0x30f950(0x18b)]}),_0x1d56ec=_0xed73e9['data'],_0x507a4e=_0x1d56ec['jobId']?_0x30f950(0x179)+_0x1d56ec[_0x30f950(0x1a4)]+']':'';return console['error'](_0x30f950(0x171)+_0x1d56ec[_0x30f950(0x174)][_0x30f950(0x1cb)]['toLocaleString']()+'\x20rows\x20'+(_0x30f950(0x1e6)+formatElapsed(_0x1d56ec[_0x30f950(0x174)][_0x30f950(0x178)])+_0x507a4e)),await handleQueryOutput(_0x1d56ec,_0x565210),0x0;}catch(_0x3e6a70){if(_0x3e6a70 instanceof SDKError)return console[_0x30f950(0x175)](_0x30f950(0x1d5)+_0x3e6a70[_0x30f950(0x1cd)]+']'),console[_0x30f950(0x175)]('\x0a'+_0x3e6a70[_0x30f950(0x190)]),0x1;throw _0x3e6a70;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x51d0c2(0x202)]=a27_0x51d0c2(0x1e9);[a27_0x51d0c2(0x187)]=a27_0x51d0c2(0x1c4);async[a27_0x51d0c2(0x188)](_0x2494ff){const _0x2da424=a27_0x51d0c2,{options:_0x5d209b,args:_0x41c347,tdx:_0x39dcf2}=_0x2494ff;if(_0x41c347[_0x2da424(0x184)]===0x0)return console[_0x2da424(0x175)](_0x2da424(0x1ae)),console['error'](_0x2da424(0x1cc)),0x1;const _0x36c2ab=_0x41c347[0x0];try{_0x5d209b[_0x2da424(0x18b)]&&(console[_0x2da424(0x175)]('Site:\x20'+_0x5d209b[_0x2da424(0x1fd)]),console[_0x2da424(0x175)](_0x2da424(0x17b)+_0x36c2ab));const _0x1bb24d=await withSpinner(_0x2da424(0x1a8)+_0x36c2ab+_0x2da424(0x1d7),()=>_0x39dcf2[_0x2da424(0x1b9)][_0x2da424(0x1c3)](_0x36c2ab),{'verbose':_0x5d209b[_0x2da424(0x18b)]}),_0x149f50=_0x1bb24d[_0x2da424(0x1e7)];_0x5d209b[_0x2da424(0x18b)]&&console[_0x2da424(0x175)](_0x2da424(0x19e)+_0x149f50);const _0x3d0813=await withSpinner(_0x2da424(0x1ca)+_0x36c2ab+'\x27...',()=>_0x39dcf2[_0x2da424(0x1b9)][_0x2da424(0x1e5)](_0x149f50),{'verbose':_0x5d209b[_0x2da424(0x18b)]}),_0x10e562=_0x3d0813[_0x2da424(0x1e7)];return console[_0x2da424(0x175)](_0x2da424(0x1aa)+_0x10e562[_0x2da424(0x184)]+_0x2da424(0x1b0)+(_0x10e562['length']!==0x1?'s':'')),await handleSDKOutput(_0x10e562,_0x5d209b),0x0;}catch(_0x44618a){if(_0x44618a instanceof SDKError)return console['error'](_0x2da424(0x1d0)+_0x44618a[_0x2da424(0x190)]),_0x44618a['cause']&&console[_0x2da424(0x175)](_0x2da424(0x185)+_0x44618a[_0x2da424(0x1b2)]),0x1;throw _0x44618a;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x51d0c2(0x202)]=a27_0x51d0c2(0x19b);[a27_0x51d0c2(0x187)]=a27_0x51d0c2(0x207);async[a27_0x51d0c2(0x188)](_0x198fcf){const _0xf28df2=a27_0x51d0c2,{options:_0x5d4b63,args:_0x437dda,tdx:_0x55fafc}=_0x198fcf;if(_0x437dda[_0xf28df2(0x184)]===0x0)return console[_0xf28df2(0x175)](_0xf28df2(0x1c8)),console[_0xf28df2(0x175)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x3ebddf,childId:_0x126d1f}=parseSegmentRef(_0x437dda[0x0]);_0x5d4b63[_0xf28df2(0x18b)]&&(console[_0xf28df2(0x175)](_0xf28df2(0x17f)+_0x5d4b63[_0xf28df2(0x1fd)]),console[_0xf28df2(0x175)](_0xf28df2(0x17b)+_0x3ebddf),_0x126d1f&&console[_0xf28df2(0x175)](_0xf28df2(0x1a9)+_0x126d1f));if(!_0x126d1f)return console['error'](_0xf28df2(0x1e2)),0x1;const _0x4e5419=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3ebddf+_0xf28df2(0x1d7),()=>_0x55fafc['segment']['resolveParentId'](_0x3ebddf),{'verbose':_0x5d4b63['verbose']}),_0x3cbc7f=_0x4e5419[_0xf28df2(0x1e7)];_0x5d4b63['verbose']&&console[_0xf28df2(0x175)](_0xf28df2(0x19e)+_0x3cbc7f);const _0x132574=await withSpinner(_0xf28df2(0x1bd)+_0x126d1f+_0xf28df2(0x1d7),()=>_0x55fafc[_0xf28df2(0x1b9)][_0xf28df2(0x1e4)](_0x3cbc7f,_0x126d1f),{'verbose':_0x5d4b63[_0xf28df2(0x18b)]}),_0xa73e79=_0x132574[_0xf28df2(0x1e7)];_0x5d4b63[_0xf28df2(0x18b)]&&console[_0xf28df2(0x175)](_0xf28df2(0x1cf)+_0xa73e79);const _0x32b12b=await withSpinner(_0xf28df2(0x1b1)+_0x126d1f+_0xf28df2(0x1d7),()=>_0x55fafc[_0xf28df2(0x1b9)]['getFolder'](_0xa73e79),{'verbose':_0x5d4b63[_0xf28df2(0x18b)]});return await handleSDKOutput([_0x32b12b[_0xf28df2(0x1e7)]],_0x5d4b63),0x0;}catch(_0x2d7f91){if(_0x2d7f91 instanceof SDKError)return console['error'](_0xf28df2(0x1d0)+_0x2d7f91['message']),_0x2d7f91[_0xf28df2(0x1b2)]&&console[_0xf28df2(0x175)](_0xf28df2(0x185)+_0x2d7f91[_0xf28df2(0x1b2)]),0x1;throw _0x2d7f91;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x51d0c2(0x205);[a27_0x51d0c2(0x187)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x51d0c2(0x188)](_0x4d3184){const _0x114aed=a27_0x51d0c2,{options:_0x4bdc6c,args:_0xf1e54d,tdx:_0x533ef4}=_0x4d3184,_0x32163a=_0xf1e54d[0x0];if(!_0x32163a)return console[_0x114aed(0x175)](_0x114aed(0x1fa)),console[_0x114aed(0x175)](_0x114aed(0x1f1)),console[_0x114aed(0x175)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x114aed(0x175)](_0x114aed(0x1ec)),console['error'](_0x114aed(0x193)),console[_0x114aed(0x175)](_0x114aed(0x182)),0x1;try{const _0x371e8c=_0x4bdc6c[_0x114aed(0x17e)],_0x20f4b3=await resolveSegmentTarget(_0x32163a,_0x371e8c,_0x4bdc6c[_0x114aed(0x18b)]);_0x4bdc6c['verbose']&&console['error'](_0x114aed(0x18a)+_0x20f4b3);const _0xe73787=await withSpinner(_0x114aed(0x198)+_0x32163a+_0x114aed(0x1d7),()=>_0x533ef4[_0x114aed(0x1b9)][_0x114aed(0x1bb)](_0x20f4b3),{'verbose':_0x4bdc6c[_0x114aed(0x18b)]}),_0x32475d=_0xe73787[_0x114aed(0x1e7)];_0x4bdc6c[_0x114aed(0x18b)]&&(console[_0x114aed(0x175)](_0x114aed(0x1c5)+_0x32475d[_0x114aed(0x1c7)]),console[_0x114aed(0x175)](_0x114aed(0x1bc)+_0x32475d['parentId']));if(_0x32475d['type']===_0x114aed(0x177))return console['error']('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x114aed(0x175)](_0x114aed(0x189)),0x1;if(_0x32475d['type']===_0x114aed(0x19f))return console[_0x114aed(0x175)](_0x114aed(0x19d)),console[_0x114aed(0x175)](_0x114aed(0x173)),0x1;if(!_0x32475d[_0x114aed(0x181)])throw new SDKError(ErrorCode[_0x114aed(0x18c)],_0x114aed(0x196));const _0x522fd1=await withSpinner(_0x114aed(0x1b8),()=>_0x533ef4[_0x114aed(0x1b9)][_0x114aed(0x1ee)](_0x32475d[_0x114aed(0x1d9)],_0x32475d[_0x114aed(0x181)]),{'verbose':_0x4bdc6c[_0x114aed(0x18b)]}),_0x44efc2=_0x522fd1[_0x114aed(0x1e7)];return _0x4bdc6c[_0x114aed(0x1ed)]===_0x114aed(0x192)||_0x4bdc6c[_0x114aed(0x1ed)]===_0x114aed(0x197)?await handleSDKOutput([{'sql':_0x44efc2}],_0x4bdc6c):console[_0x114aed(0x1da)](_0x44efc2),0x0;}catch(_0x4a950b){if(_0x4a950b instanceof SDKError)return console[_0x114aed(0x175)](_0x114aed(0x1d0)+_0x4a950b[_0x114aed(0x190)]),_0x4a950b[_0x114aed(0x1b2)]&&console[_0x114aed(0x175)](_0x114aed(0x185)+_0x4a950b[_0x114aed(0x1b2)]),0x1;throw _0x4a950b;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x51d0c2(0x202)]=a27_0x51d0c2(0x20c);['description']='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x1c7542){const _0x35d87a=a27_0x51d0c2,{options:_0x3b08a5,args:_0x4e4fc2,tdx:_0x511024}=_0x1c7542,_0x3c180b=_0x3b08a5;if(_0x4e4fc2[_0x35d87a(0x184)]<0x2)return console[_0x35d87a(0x175)](_0x35d87a(0x20d)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0xfb639=_0x4e4fc2[0x0],_0xad4054=_0x4e4fc2[0x1];_0x3c180b[_0x35d87a(0x18b)]&&(console['error'](_0x35d87a(0x17f)+_0x3c180b[_0x35d87a(0x1fd)]),console['error'](_0x35d87a(0x199)+_0xfb639),console['error'](_0x35d87a(0x1a9)+_0xad4054));let _0xc304d4;if(_0x3c180b[_0x35d87a(0x1d1)]){const _0x57cc7a=_0x3c180b[_0x35d87a(0x1d1)],_0x4e23f6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xfb639+'\x27...',()=>_0x511024[_0x35d87a(0x1b9)][_0x35d87a(0x1c3)](_0xfb639),{'verbose':_0x3c180b['verbose']}),_0x422310=_0x4e23f6[_0x35d87a(0x1e7)],_0x4fa1d6=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x57cc7a+_0x35d87a(0x1d7),()=>_0x511024[_0x35d87a(0x1b9)][_0x35d87a(0x1e4)](_0x422310,_0x57cc7a),{'verbose':_0x3c180b[_0x35d87a(0x18b)]});_0xc304d4=_0x4fa1d6[_0x35d87a(0x1e7)],_0x3c180b[_0x35d87a(0x18b)]&&console[_0x35d87a(0x175)](_0x35d87a(0x1d2)+_0xc304d4);}const _0x5abfa8={'name':_0xad4054,'description':_0x3c180b[_0x35d87a(0x187)],'parentFolderId':_0xc304d4},_0x401429=await withSpinner('Creating\x20folder\x20\x27'+_0xad4054+'\x27...',()=>_0x511024['segment'][_0x35d87a(0x1ac)](_0xfb639,_0x5abfa8),{'verbose':_0x3c180b[_0x35d87a(0x18b)]}),_0x1f656b=_0x401429['data'];return console[_0x35d87a(0x175)]('β\x20Created\x20folder\x20\x27'+_0x1f656b[_0x35d87a(0x202)]+'\x27\x20with\x20ID:\x20'+_0x1f656b['id']),await handleSDKOutput([_0x1f656b],_0x3c180b),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a27_0x51d0c2(0x20a);[a27_0x51d0c2(0x187)]=a27_0x51d0c2(0x1af);async[a27_0x51d0c2(0x188)](_0x19ef8f){const _0xd4fc05=a27_0x51d0c2,{options:_0x91d32c,args:_0x924f76,tdx:_0xb99de3}=_0x19ef8f,_0x4f7da5=_0x924f76[0x0];if(!_0x4f7da5)return console[_0xd4fc05(0x175)](_0xd4fc05(0x1d8)),console[_0xd4fc05(0x175)](_0xd4fc05(0x1a2)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0xd4fc05(0x175)](_0xd4fc05(0x1f7)),console[_0xd4fc05(0x175)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('Examples:'),console['error'](_0xd4fc05(0x1d6)),console[_0xd4fc05(0x175)](_0xd4fc05(0x1fc)),console[_0xd4fc05(0x175)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0xd4fc05(0x175)](_0xd4fc05(0x1e3)),0x1;try{const _0x23a565=_0x91d32c['parentSegment'],_0x2d91ca=await resolveSegmentTarget(_0x4f7da5,_0x23a565,_0x91d32c[_0xd4fc05(0x18b)]);_0x91d32c[_0xd4fc05(0x18b)]&&console[_0xd4fc05(0x175)](_0xd4fc05(0x18a)+_0x2d91ca);const _0x3bb7e6=await withSpinner(_0xd4fc05(0x198)+_0x4f7da5+_0xd4fc05(0x1d7),()=>_0xb99de3['segment'][_0xd4fc05(0x1bb)](_0x2d91ca),{'verbose':_0x91d32c[_0xd4fc05(0x18b)]}),_0x2c0b08=_0x3bb7e6[_0xd4fc05(0x1e7)];_0x91d32c[_0xd4fc05(0x18b)]&&(console[_0xd4fc05(0x175)](_0xd4fc05(0x1c5)+_0x2c0b08[_0xd4fc05(0x1c7)]),console[_0xd4fc05(0x175)](_0xd4fc05(0x1bc)+_0x2c0b08['parentId']),_0x2c0b08['folderId']&&console['error']('Folder\x20ID:\x20'+_0x2c0b08['folderId']),_0x2c0b08['segmentId']&&console[_0xd4fc05(0x175)](_0xd4fc05(0x209)+_0x2c0b08[_0xd4fc05(0x181)]));if(_0x91d32c['web']){if(_0x2c0b08[_0xd4fc05(0x1c7)]===_0xd4fc05(0x177))return console[_0xd4fc05(0x175)](_0xd4fc05(0x1dc)),0x1;if(_0x2c0b08[_0xd4fc05(0x1c7)]===_0xd4fc05(0x19f))return console['error'](_0xd4fc05(0x208)),console[_0xd4fc05(0x175)](_0xd4fc05(0x1ba)),0x1;if(!_0x2c0b08[_0xd4fc05(0x181)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd4fc05(0x196));const _0x4d5f4e=getConsoleNextUrl(_0x91d32c[_0xd4fc05(0x1fd)],_0xd4fc05(0x206)+_0x2c0b08['parentId']+_0xd4fc05(0x1e1)+_0x2c0b08['segmentId']);return console[_0xd4fc05(0x175)](a27_0x25ee13[_0xd4fc05(0x203)]('β')+'\x20Opening\x20'+a27_0x25ee13[_0xd4fc05(0x20b)](_0x4d5f4e)),openBrowser(_0x4d5f4e),0x0;}if(_0x2c0b08['type']===_0xd4fc05(0x177)){if(!_0x2c0b08[_0xd4fc05(0x19a)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0xd4fc05(0x1fe));const _0x30ba6b=await withSpinner(_0xd4fc05(0x1f8),()=>_0xb99de3[_0xd4fc05(0x1b9)]['getFolder'](_0x2c0b08['folderId']),{'verbose':_0x91d32c[_0xd4fc05(0x18b)]});await handleSingleObjectOutput(_0x30ba6b[_0xd4fc05(0x1e7)],_0x91d32c);}else{if(_0x2c0b08[_0xd4fc05(0x1c7)]===_0xd4fc05(0x1b9)){if(!_0x2c0b08[_0xd4fc05(0x181)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xaf4376=await withSpinner(_0xd4fc05(0x1a6),()=>_0xb99de3[_0xd4fc05(0x1b9)]['getSegment'](_0x2c0b08['parentId'],_0x2c0b08[_0xd4fc05(0x181)]),{'verbose':_0x91d32c[_0xd4fc05(0x18b)]}),_0x5ba5a2=getConsoleNextUrl(_0x91d32c[_0xd4fc05(0x1fd)],_0xd4fc05(0x206)+_0x2c0b08[_0xd4fc05(0x1d9)]+_0xd4fc05(0x1e1)+_0x2c0b08['segmentId']),_0x214cca=_0xaf4376[_0xd4fc05(0x1e7)];_0x214cca[_0xd4fc05(0x1ab)]=_0x5ba5a2,await handleSingleObjectOutput(_0x214cca,_0x91d32c);}else return console[_0xd4fc05(0x175)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0xd4fc05(0x175)](_0xd4fc05(0x20f)),0x1;}return 0x0;}catch(_0x5b938d){if(_0x5b938d instanceof SDKError)return console['error'](_0xd4fc05(0x1d0)+_0x5b938d['message']),_0x5b938d['cause']&&console[_0xd4fc05(0x175)](_0xd4fc05(0x185)+_0x5b938d['cause']),0x1;throw _0x5b938d;}}}export const SegmentInfoCommand=SegmentViewCommand;function a27_0x46c1(){const _0x3a5ace=['type','Error:\x20Folder\x20reference\x20is\x20required','3810370hXvviB','Listing\x20folders\x20for\x20parent\x20\x27','processedRows','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','code','fullPath','Resolved\x20folder\x20ID:\x20','Error:\x20','parentFolder','Resolved\x20parent\x20folder\x20ID:\x20','48ARoxlA','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','β\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x27...','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','parentId','log','SQL\x20query:\x0a','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20Parent\x20segment:\x20','27GuAbSV','Resolved\x20YAML\x20file:\x20','/e/','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolveFolderId','listFolders','in\x20','data','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:folder:list','1186787QsBBHr','Usage:\x20tdx\x20sg\x20desc\x20<name>','Examples:','format','getSegmentSQL','940FLuTNv','(root)','Usage:\x20tdx\x20sg\x20sql\x20<name>','2609794izwdCh','15YCUIMU','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','269584BNTYkz','Options:','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','site','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20desc','195knlKmn','includes','name','green','getParent','segment:sql','/app/ps/','Show\x20segment\x20folder\x20details','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Segment\x20ID:\x20','segment:view','cyan','segment:folder:create','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Executing\x20segment\x20query...','Use:\x20tdx\x20ps\x20view','β\x20Query\x20completed:\x20Processed\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use:\x20tdx\x20ps\x20sql','stats','error','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','folder','elapsedTimeMillis','\x20[Job\x20ID:\x20','Show\x20segment\x20or\x20folder\x20details','Parent\x20name:\x20','715OGpscy','17392DzqDHD','parentSegment','Site:\x20','segment:desc','segmentId','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','length','\x20\x20Cause:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','description','execute','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Target\x20path:\x20','verbose','SEGMENT_NOT_FOUND','11478ikpqjo','Usage:\x20tdx\x20sg\x20show\x20<name>','SEGMENT_FOLDER_NOT_FOUND','message','Use:\x20tdx\x20ps\x20show','json','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segmentName','Segment\x20ID\x20missing\x20from\x20resolved\x20path','jsonl','Resolving\x20\x27','Parent\x20segment:\x20','folderId','segment:folder:show','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20parent\x20ID:\x20','parent','setJobId','test','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','folderPath','jobId','\x20\x20Folder\x20path:\x20','Fetching\x20segment\x20details...','620028lLEOuY','Resolving\x20parent\x20segment\x20\x27','Folder\x20name:\x20','β\x20Found\x20','url','createFolder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Show\x20folder\x20or\x20child\x20segment\x20details','\x20folder','Fetching\x20folder\x20\x27','cause','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20path\x20\x27','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','query','Fetching\x20SQL\x20for\x20segment...','segment','Use:\x20tdx\x20ps\x20view\x20-w','resolvePathToResource','Parent\x20ID:\x20','Resolving\x20folder\x20\x27','getFolder','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segment:describe','segment:show','resolveParentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolved\x20type:\x20','16heDmGx'];a27_0x46c1=function(){return _0x3a5ace;};return a27_0x46c1();}export class SegmentDescCommand extends BaseCommand{['name']=a27_0x51d0c2(0x180);[a27_0x51d0c2(0x187)]=a27_0x51d0c2(0x186);async['execute'](_0xbb1c03){const _0x2b3982=a27_0x51d0c2,{options:_0x5521cd,args:_0x396c5f,tdx:_0x5b12c2}=_0xbb1c03,_0x355559=_0x396c5f[0x0];if(!_0x355559)return console[_0x2b3982(0x175)](_0x2b3982(0x1fa)),console['error'](_0x2b3982(0x1eb)),console[_0x2b3982(0x175)](_0x2b3982(0x183)),console[_0x2b3982(0x175)]('Examples:'),console[_0x2b3982(0x175)](_0x2b3982(0x1b3)),console[_0x2b3982(0x175)](_0x2b3982(0x1f4)),0x1;try{const _0x39f6f0=_0x5521cd['parentSegment'],_0x3b2416=await resolveSegmentTarget(_0x355559,_0x39f6f0,_0x5521cd['verbose']);_0x5521cd[_0x2b3982(0x18b)]&&console[_0x2b3982(0x175)]('Target\x20path:\x20'+_0x3b2416);const _0x5dc894=await withSpinner(_0x2b3982(0x198)+_0x355559+_0x2b3982(0x1d7),()=>_0x5b12c2[_0x2b3982(0x1b9)][_0x2b3982(0x1bb)](_0x3b2416),{'verbose':_0x5521cd[_0x2b3982(0x18b)]}),_0x7c8824=_0x5dc894[_0x2b3982(0x1e7)];_0x5521cd[_0x2b3982(0x18b)]&&(console[_0x2b3982(0x175)]('Resolved\x20type:\x20'+_0x7c8824[_0x2b3982(0x1c7)]),console['error'](_0x2b3982(0x1bc)+_0x7c8824[_0x2b3982(0x1d9)]));if(_0x7c8824[_0x2b3982(0x1c7)]===_0x2b3982(0x177))return console[_0x2b3982(0x175)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x2b3982(0x175)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x7c8824[_0x2b3982(0x1c7)]===_0x2b3982(0x19f))return console['error'](_0x2b3982(0x1b4)),console['error'](_0x2b3982(0x1ff)),0x1;if(!_0x7c8824[_0x2b3982(0x181)])throw new SDKError(ErrorCode[_0x2b3982(0x18c)],_0x2b3982(0x196));const _0x9c08ce=await withSpinner(_0x2b3982(0x1b8),()=>_0x5b12c2[_0x2b3982(0x1b9)][_0x2b3982(0x1ee)](_0x7c8824['parentId'],_0x7c8824[_0x2b3982(0x181)]),{'verbose':_0x5521cd[_0x2b3982(0x18b)]}),_0x19f932=_0x9c08ce[_0x2b3982(0x1e7)],_0x463dd5=await executeSchemaQuery(_0x19f932,_0x5b12c2,_0x5521cd);return await handleQueryOutput(_0x463dd5,_0x5521cd),0x0;}catch(_0x21db29){if(_0x21db29 instanceof SDKError)return console['error'](_0x2b3982(0x1d0)+_0x21db29[_0x2b3982(0x190)]),_0x21db29[_0x2b3982(0x1b2)]&&console['error']('\x20\x20Cause:\x20'+_0x21db29['cause']),0x1;throw _0x21db29;}}}
|
|
1
|
+
const a27_0x4ad3fa=a27_0x45bb;function a27_0x297f(){const _0x12078f=['β\x20Found\x20','format','Usage:\x20tdx\x20sg\x20sql\x20<name>','execute','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolving\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20type:\x20','835880rRNNQG','Resolving\x20path\x20\x27','\x20\x20Cause:\x20','\x20[Job\x20ID:\x20','resolvePathToResource','SEGMENT_FOLDER_NOT_FOUND','Site:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segment:folder:show','Use:\x20tdx\x20ps\x20view\x20-w','Fetching\x20parent\x20segment\x20details...','Create\x20segment\x20folder\x20for\x20organization','Get\x20SQL\x20query\x20for\x20child\x20segment','Use:\x20tdx\x20ps\x20show','limit','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','92277LamUwp','getParent','\x20\x20Folder\x20path:\x20','236536sJISjC','json','Parent\x20name:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20segment:\x20','data','parent','in\x20','Resolved\x20parent\x20folder\x20ID:\x20','\x20folder','Segment\x20ID:\x20','Creating\x20folder\x20\x27','Show\x20segment\x20folder\x20details','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','type','parentId','\x20Opening\x20','code','Error:\x20','25vzhGSk','trim','folderId','/e/','β\x20Query\x20failed\x20[','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','(root)','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','includes','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','length','SQL\x20query:\x0a','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20ID:\x20','Executing\x20segment\x20query...','Resolved\x20relative\x20path\x20to:\x20','segment:folder:create','replace','segmentId','\x20\x20Segment\x20name:\x20','description','Show\x20segment\x20or\x20folder\x20details','\x20\x20Parent\x20segment:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','Examples:','createFolder','error','\x20\x20Full\x20path:\x20','Target\x20path:\x20','message','parentSegment','segmentPath','cause','getSegment','resolveFolderId','/app/ps/','segment:sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','130884gZrsEc','Resolving\x20folder\x20\x27','getFolder','test','stats','setJobId','information_schema','Folder\x20ID:\x20','name','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','2484902wocqJX','701193NYRjbf','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','fullPath','\x27...','Listing\x20folders\x20for\x20parent\x20\x27','url','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','query','24197976aevzck','folder','segment:desc','site','Usage:\x20tdx\x20sg\x20desc\x20<name>','listFolders','verbose','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','18yqRwjN','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment','Folder\x20name:\x20','segment:view','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27\x20with\x20ID:\x20','toLocaleString','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20sg\x20show\x20<name>','parentFolder','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Show\x20child\x20segment\x20schema\x20(column\x20types)','segmentName','Options:','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','jsonl','web','cyan','INVALID_ARGUMENT','Resolved\x20parent\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','SEGMENT_NOT_FOUND','Fetching\x20segment\x20details...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolveParentId','β\x20Query\x20completed:\x20Processed\x20','processedRows'];a27_0x297f=function(){return _0x12078f;};return a27_0x297f();}(function(_0x208e70,_0x21a61a){const _0x2ef6af=a27_0x45bb,_0x29a8e3=_0x208e70();while(!![]){try{const _0x314253=parseInt(_0x2ef6af(0xbf))/0x1*(-parseInt(_0x2ef6af(0x11f))/0x2)+parseInt(_0x2ef6af(0x10b))/0x3+parseInt(_0x2ef6af(0x148))/0x4*(-parseInt(_0x2ef6af(0xd5))/0x5)+-parseInt(_0x2ef6af(0x100))/0x6+-parseInt(_0x2ef6af(0x10a))/0x7+-parseInt(_0x2ef6af(0xc2))/0x8+parseInt(_0x2ef6af(0x116))/0x9;if(_0x314253===_0x21a61a)break;else _0x29a8e3['push'](_0x29a8e3['shift']());}catch(_0x2c3c59){_0x29a8e3['push'](_0x29a8e3['shift']());}}}(a27_0x297f,0x9c6ad));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 a27_0x54a151 from'chalk';async function resolveSegmentTarget(_0x2ac9a2,_0x3dccbf,_0x2959f6){const _0x128e57=a27_0x45bb;if(isYamlFilePath(_0x2ac9a2))try{const _0x16d973=await resolveYamlFilePath(_0x2ac9a2);return _0x2959f6&&(console['error'](_0x128e57(0x113)+_0x2ac9a2),console[_0x128e57(0xf1)](_0x128e57(0xec)+_0x16d973[_0x128e57(0xf5)]),console[_0x128e57(0xf1)](_0x128e57(0xe9)+_0x16d973[_0x128e57(0x12e)]),console['error'](_0x128e57(0xc1)+(_0x16d973['folderPath']||_0x128e57(0xdb))),console[_0x128e57(0xf1)](_0x128e57(0xf2)+_0x16d973['fullPath'])),_0x16d973[_0x128e57(0x10d)];}catch(_0x339723){throw new SDKError(ErrorCode[_0x128e57(0x135)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x339723['message']);}if(!_0x3dccbf)throw new SDKError(ErrorCode[_0x128e57(0x135)],_0x128e57(0xcf));return _0x3dccbf+'/'+_0x2ac9a2;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]='segment:describe';[a27_0x4ad3fa(0xea)]=a27_0x4ad3fa(0xeb);async[a27_0x4ad3fa(0x141)](_0x5d21b2){const _0x39af95=a27_0x4ad3fa,{options:_0x489a99,args:_0x2b2853,tdx:_0x323d17}=_0x5d21b2,_0x34de97=_0x2b2853[0x0],_0x415f20=!_0x34de97&&!!_0x489a99[_0x39af95(0xf5)],_0x2017ff=_0x34de97||_0x489a99[_0x39af95(0xf5)];if(!_0x2017ff)return console[_0x39af95(0xf1)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x39af95(0xf1)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x39af95(0xef)),console[_0x39af95(0xf1)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x39af95(0xf1)](_0x39af95(0x137)),console[_0x39af95(0xf1)](_0x39af95(0x145)),console[_0x39af95(0xf1)](_0x39af95(0xb5)),0x1;try{const _0x541c3b=_0x489a99[_0x39af95(0xf6)];let _0x1c579f=_0x2017ff;!_0x415f20&&_0x541c3b&&!_0x2017ff[_0x39af95(0xdd)]('/')&&(_0x1c579f=_0x541c3b+'/'+_0x2017ff,_0x489a99[_0x39af95(0x11c)]&&console[_0x39af95(0xf1)](_0x39af95(0xe5)+_0x1c579f));const _0x8b51eb=await withSpinner(_0x39af95(0x149)+_0x1c579f+_0x39af95(0x10e),()=>_0x323d17[_0x39af95(0x121)][_0x39af95(0xb2)](_0x1c579f),{'verbose':_0x489a99[_0x39af95(0x11c)]}),_0x271e0e=_0x8b51eb[_0x39af95(0xc7)];_0x489a99[_0x39af95(0x11c)]&&(console[_0x39af95(0xf1)]('Resolved\x20type:\x20'+_0x271e0e[_0x39af95(0xd0)]),console[_0x39af95(0xf1)](_0x39af95(0xe3)+_0x271e0e['parentId']),_0x271e0e[_0x39af95(0xd7)]&&console[_0x39af95(0xf1)](_0x39af95(0x107)+_0x271e0e[_0x39af95(0xd7)]),_0x271e0e['segmentId']&&console['error'](_0x39af95(0xcc)+_0x271e0e['segmentId']));if(_0x271e0e['type']===_0x39af95(0xc8)){const _0x74908f=await withSpinner(_0x39af95(0xb8),()=>_0x323d17[_0x39af95(0x121)][_0x39af95(0xc0)](_0x271e0e['parentId']),{'verbose':_0x489a99[_0x39af95(0x11c)]});await handleSingleObjectOutput(_0x74908f['data'],_0x489a99);}else{if(_0x271e0e[_0x39af95(0xd0)]===_0x39af95(0x117)){if(!_0x271e0e[_0x39af95(0xd7)])throw new SDKError(ErrorCode[_0x39af95(0xb3)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x17a5bd=await withSpinner(_0x39af95(0x142),()=>_0x323d17['segment'][_0x39af95(0x102)](_0x271e0e[_0x39af95(0xd7)]),{'verbose':_0x489a99['verbose']});await handleSingleObjectOutput(_0x17a5bd[_0x39af95(0xc7)],_0x489a99);}else{if(_0x271e0e[_0x39af95(0xd0)]===_0x39af95(0x121)){if(!_0x271e0e[_0x39af95(0xe8)])throw new SDKError(ErrorCode[_0x39af95(0x138)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x130d4c=await withSpinner(_0x39af95(0x139),()=>_0x323d17[_0x39af95(0x121)]['getSegment'](_0x271e0e[_0x39af95(0xd1)],_0x271e0e[_0x39af95(0xe8)]),{'verbose':_0x489a99[_0x39af95(0x11c)]});await handleSingleObjectOutput(_0x130d4c[_0x39af95(0xc7)],_0x489a99);}}}return 0x0;}catch(_0x5271cf){if(_0x5271cf instanceof SDKError)return console[_0x39af95(0xf1)](_0x39af95(0xd4)+_0x5271cf[_0x39af95(0xf4)]),_0x5271cf[_0x39af95(0xf7)]&&console[_0x39af95(0xf1)](_0x39af95(0xb0)+_0x5271cf[_0x39af95(0xf7)]),0x1;throw _0x5271cf;}}}function a27_0x45bb(_0x1e5877,_0x2bb62d){_0x1e5877=_0x1e5877-0xb0;const _0x297f22=a27_0x297f();let _0x45bb66=_0x297f22[_0x1e5877];return _0x45bb66;}export class SegmentShowCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]='segment:show';[a27_0x4ad3fa(0xea)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x4ad3fa(0x141)](_0x36b012){const _0x303b69=a27_0x4ad3fa,{options:_0x330fec,args:_0x1eb069,tdx:_0x35a6fc}=_0x36b012,_0x141f28=_0x1eb069[0x0];if(!_0x141f28)return console['error'](_0x303b69(0xed)),console[_0x303b69(0xf1)](_0x303b69(0x12a)),console[_0x303b69(0xf1)](_0x303b69(0xda)),console[_0x303b69(0xf1)]('Examples:'),console[_0x303b69(0xf1)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x303b69(0x120)),0x1;try{const _0x3aeea0=_0x330fec[_0x303b69(0xf5)],_0x36ba85=await resolveSegmentTarget(_0x141f28,_0x3aeea0,_0x330fec['verbose']);_0x330fec[_0x303b69(0x11c)]&&console[_0x303b69(0xf1)](_0x303b69(0xf3)+_0x36ba85);const _0x3b8da1=await withSpinner('Resolving\x20\x27'+_0x141f28+_0x303b69(0x10e),()=>_0x35a6fc[_0x303b69(0x121)][_0x303b69(0xb2)](_0x36ba85),{'verbose':_0x330fec[_0x303b69(0x11c)]}),_0x1708ec=_0x3b8da1[_0x303b69(0xc7)];_0x330fec['verbose']&&(console[_0x303b69(0xf1)]('Resolved\x20type:\x20'+_0x1708ec['type']),console[_0x303b69(0xf1)](_0x303b69(0xe3)+_0x1708ec[_0x303b69(0xd1)]));if(_0x1708ec[_0x303b69(0xd0)]===_0x303b69(0x117))return console[_0x303b69(0xf1)](_0x303b69(0x131)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x1708ec[_0x303b69(0xd0)]==='parent')return console[_0x303b69(0xf1)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x303b69(0xbb)),0x1;if(!_0x1708ec[_0x303b69(0xe8)])throw new SDKError(ErrorCode[_0x303b69(0x138)],_0x303b69(0x13a));const _0x5d46da=await withSpinner(_0x303b69(0xff),()=>_0x35a6fc[_0x303b69(0x121)][_0x303b69(0xee)](_0x1708ec[_0x303b69(0xd1)],_0x1708ec[_0x303b69(0xe8)]),{'verbose':_0x330fec[_0x303b69(0x11c)]});let _0x44d54a=_0x5d46da[_0x303b69(0xc7)];const _0xd04273=resolveLimit(_0x330fec[_0x303b69(0xbc)],DEFAULT_DISPLAY_LIMIT),_0x5c55ba=/\bLIMIT\s+\d+/i[_0x303b69(0x103)](_0x44d54a);!_0x5c55ba&&(_0x44d54a=_0x44d54a[_0x303b69(0xd6)]()[_0x303b69(0xe7)](/;+$/,''),_0x44d54a='SELECT\x20*\x20FROM\x20(\x0a'+_0x44d54a+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0xd04273);_0x330fec['verbose']&&console[_0x303b69(0xf1)](_0x303b69(0xe1)+_0x44d54a);const _0x4afad1=await withProgressSpinner(_0x303b69(0xe4),async _0x1e93d2=>{const _0x40957e=_0x303b69,_0x47c657=await _0x35a6fc[_0x40957e(0x115)]['execute'](_0x44d54a,{'catalog':'td','schema':_0x40957e(0x106),'onJobId':_0x89ff4a=>{const _0x46ad53=_0x40957e;_0x1e93d2[_0x46ad53(0x105)](_0x89ff4a);}});return _0x47c657;},{'verbose':_0x330fec[_0x303b69(0x11c)]}),_0x12111c=_0x4afad1[_0x303b69(0xc7)],_0x640b16=_0x12111c['jobId']?_0x303b69(0xb1)+_0x12111c['jobId']+']':'';return console[_0x303b69(0xf1)](_0x303b69(0x13c)+_0x12111c[_0x303b69(0x104)][_0x303b69(0x13d)][_0x303b69(0x128)]()+'\x20rows\x20'+(_0x303b69(0xc9)+formatElapsed(_0x12111c[_0x303b69(0x104)]['elapsedTimeMillis'])+_0x640b16)),await handleQueryOutput(_0x12111c,_0x330fec),0x0;}catch(_0x1cb887){if(_0x1cb887 instanceof SDKError)return console[_0x303b69(0xf1)](_0x303b69(0xd9)+_0x1cb887[_0x303b69(0xd3)]+']'),console['error']('\x0a'+_0x1cb887[_0x303b69(0xf4)]),0x1;throw _0x1cb887;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a27_0x4ad3fa(0xea)]=a27_0x4ad3fa(0xe2);async['execute'](_0x555dbd){const _0x3d74c3=a27_0x4ad3fa,{options:_0x4d66a9,args:_0x37d9f7,tdx:_0x581836}=_0x555dbd;if(_0x37d9f7[_0x3d74c3(0xe0)]===0x0)return console['error'](_0x3d74c3(0x126)),console[_0x3d74c3(0xf1)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x26ce61=_0x37d9f7[0x0];try{_0x4d66a9['verbose']&&(console[_0x3d74c3(0xf1)](_0x3d74c3(0xb4)+_0x4d66a9[_0x3d74c3(0x119)]),console[_0x3d74c3(0xf1)](_0x3d74c3(0xc4)+_0x26ce61));const _0x280bc8=await withSpinner(_0x3d74c3(0x129)+_0x26ce61+_0x3d74c3(0x10e),()=>_0x581836[_0x3d74c3(0x121)][_0x3d74c3(0x13b)](_0x26ce61),{'verbose':_0x4d66a9[_0x3d74c3(0x11c)]}),_0x9ee2a8=_0x280bc8[_0x3d74c3(0xc7)];_0x4d66a9[_0x3d74c3(0x11c)]&&console['error'](_0x3d74c3(0x136)+_0x9ee2a8);const _0xf90b69=await withSpinner(_0x3d74c3(0x10f)+_0x26ce61+_0x3d74c3(0x10e),()=>_0x581836[_0x3d74c3(0x121)][_0x3d74c3(0x11b)](_0x9ee2a8),{'verbose':_0x4d66a9[_0x3d74c3(0x11c)]}),_0x34f4bc=_0xf90b69['data'];return console[_0x3d74c3(0xf1)](_0x3d74c3(0x13e)+_0x34f4bc[_0x3d74c3(0xe0)]+_0x3d74c3(0xcb)+(_0x34f4bc[_0x3d74c3(0xe0)]!==0x1?'s':'')),await handleSDKOutput(_0x34f4bc,_0x4d66a9),0x0;}catch(_0x464307){if(_0x464307 instanceof SDKError)return console[_0x3d74c3(0xf1)](_0x3d74c3(0xd4)+_0x464307['message']),_0x464307['cause']&&console[_0x3d74c3(0xf1)]('\x20\x20Cause:\x20'+_0x464307[_0x3d74c3(0xf7)]),0x1;throw _0x464307;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a27_0x4ad3fa(0xb6);[a27_0x4ad3fa(0xea)]=a27_0x4ad3fa(0xce);async[a27_0x4ad3fa(0x141)](_0x37a7ce){const _0x55419f=a27_0x4ad3fa,{options:_0x2c8d10,args:_0x3409bf,tdx:_0x3851c2}=_0x37a7ce;if(_0x3409bf[_0x55419f(0xe0)]===0x0)return console[_0x55419f(0xf1)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x223044,childId:_0x4af582}=parseSegmentRef(_0x3409bf[0x0]);_0x2c8d10[_0x55419f(0x11c)]&&(console[_0x55419f(0xf1)](_0x55419f(0xb4)+_0x2c8d10[_0x55419f(0x119)]),console[_0x55419f(0xf1)]('Parent\x20name:\x20'+_0x223044),_0x4af582&&console[_0x55419f(0xf1)]('Folder\x20name:\x20'+_0x4af582));if(!_0x4af582)return console[_0x55419f(0xf1)](_0x55419f(0xde)),0x1;const _0x477021=await withSpinner(_0x55419f(0x129)+_0x223044+'\x27...',()=>_0x3851c2['segment'][_0x55419f(0x13b)](_0x223044),{'verbose':_0x2c8d10[_0x55419f(0x11c)]}),_0x4b4a81=_0x477021['data'];_0x2c8d10['verbose']&&console[_0x55419f(0xf1)](_0x55419f(0x136)+_0x4b4a81);const _0x3f0e30=await withSpinner(_0x55419f(0x101)+_0x4af582+_0x55419f(0x10e),()=>_0x3851c2[_0x55419f(0x121)][_0x55419f(0xf9)](_0x4b4a81,_0x4af582),{'verbose':_0x2c8d10[_0x55419f(0x11c)]}),_0x381f52=_0x3f0e30[_0x55419f(0xc7)];_0x2c8d10[_0x55419f(0x11c)]&&console[_0x55419f(0xf1)](_0x55419f(0x125)+_0x381f52);const _0x488787=await withSpinner('Fetching\x20folder\x20\x27'+_0x4af582+_0x55419f(0x10e),()=>_0x3851c2[_0x55419f(0x121)][_0x55419f(0x102)](_0x381f52),{'verbose':_0x2c8d10['verbose']});return await handleSDKOutput([_0x488787[_0x55419f(0xc7)]],_0x2c8d10),0x0;}catch(_0x44141b){if(_0x44141b instanceof SDKError)return console[_0x55419f(0xf1)]('Error:\x20'+_0x44141b[_0x55419f(0xf4)]),_0x44141b[_0x55419f(0xf7)]&&console[_0x55419f(0xf1)](_0x55419f(0xb0)+_0x44141b[_0x55419f(0xf7)]),0x1;throw _0x44141b;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]=a27_0x4ad3fa(0xfb);['description']=a27_0x4ad3fa(0xba);async[a27_0x4ad3fa(0x141)](_0x28da7b){const _0x6c17a=a27_0x4ad3fa,{options:_0x5136b7,args:_0x2c3ecb,tdx:_0x30e6f3}=_0x28da7b,_0x519c56=_0x2c3ecb[0x0];if(!_0x519c56)return console[_0x6c17a(0xf1)](_0x6c17a(0xed)),console[_0x6c17a(0xf1)](_0x6c17a(0x140)),console[_0x6c17a(0xf1)](_0x6c17a(0x112)),console[_0x6c17a(0xf1)](_0x6c17a(0xef)),console[_0x6c17a(0xf1)](_0x6c17a(0x130)),console[_0x6c17a(0xf1)](_0x6c17a(0xdc)),0x1;try{const _0x152a6a=_0x5136b7['parentSegment'],_0x16f022=await resolveSegmentTarget(_0x519c56,_0x152a6a,_0x5136b7['verbose']);_0x5136b7['verbose']&&console[_0x6c17a(0xf1)](_0x6c17a(0xf3)+_0x16f022);const _0x72a353=await withSpinner(_0x6c17a(0x144)+_0x519c56+_0x6c17a(0x10e),()=>_0x30e6f3['segment'][_0x6c17a(0xb2)](_0x16f022),{'verbose':_0x5136b7[_0x6c17a(0x11c)]}),_0x30134f=_0x72a353[_0x6c17a(0xc7)];_0x5136b7[_0x6c17a(0x11c)]&&(console[_0x6c17a(0xf1)](_0x6c17a(0x147)+_0x30134f[_0x6c17a(0xd0)]),console[_0x6c17a(0xf1)](_0x6c17a(0xe3)+_0x30134f[_0x6c17a(0xd1)]));if(_0x30134f['type']===_0x6c17a(0x117))return console['error'](_0x6c17a(0x114)),console[_0x6c17a(0xf1)](_0x6c17a(0x109)),0x1;if(_0x30134f[_0x6c17a(0xd0)]===_0x6c17a(0xc8))return console['error'](_0x6c17a(0xfe)),console[_0x6c17a(0xf1)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x30134f['segmentId'])throw new SDKError(ErrorCode[_0x6c17a(0x138)],_0x6c17a(0x13a));const _0x59cb4c=await withSpinner(_0x6c17a(0xff),()=>_0x30e6f3['segment']['getSegmentSQL'](_0x30134f[_0x6c17a(0xd1)],_0x30134f['segmentId']),{'verbose':_0x5136b7[_0x6c17a(0x11c)]}),_0x4b8386=_0x59cb4c[_0x6c17a(0xc7)];return _0x5136b7[_0x6c17a(0x13f)]===_0x6c17a(0xc3)||_0x5136b7['format']===_0x6c17a(0x132)?await handleSDKOutput([{'sql':_0x4b8386}],_0x5136b7):console['log'](_0x4b8386),0x0;}catch(_0x30b9b2){if(_0x30b9b2 instanceof SDKError)return console[_0x6c17a(0xf1)](_0x6c17a(0xd4)+_0x30b9b2[_0x6c17a(0xf4)]),_0x30b9b2['cause']&&console[_0x6c17a(0xf1)](_0x6c17a(0xb0)+_0x30b9b2[_0x6c17a(0xf7)]),0x1;throw _0x30b9b2;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]=a27_0x4ad3fa(0xe6);[a27_0x4ad3fa(0xea)]=a27_0x4ad3fa(0xb9);async[a27_0x4ad3fa(0x141)](_0xd8f1f0){const _0x59f4a2=a27_0x4ad3fa,{options:_0x3bc79e,args:_0x268863,tdx:_0x2df106}=_0xd8f1f0,_0x313134=_0x3bc79e;if(_0x268863['length']<0x2)return console['error'](_0x59f4a2(0xfd)),console[_0x59f4a2(0xf1)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x221006=_0x268863[0x0],_0x599d3d=_0x268863[0x1];_0x313134['verbose']&&(console[_0x59f4a2(0xf1)](_0x59f4a2(0xb4)+_0x313134[_0x59f4a2(0x119)]),console[_0x59f4a2(0xf1)](_0x59f4a2(0xc6)+_0x221006),console[_0x59f4a2(0xf1)](_0x59f4a2(0x122)+_0x599d3d));let _0x50c74c;if(_0x313134[_0x59f4a2(0x12b)]){const _0x14682=_0x313134[_0x59f4a2(0x12b)],_0x211ee6=await withSpinner(_0x59f4a2(0x129)+_0x221006+_0x59f4a2(0x10e),()=>_0x2df106[_0x59f4a2(0x121)]['resolveParentId'](_0x221006),{'verbose':_0x313134[_0x59f4a2(0x11c)]}),_0x1d7674=_0x211ee6[_0x59f4a2(0xc7)],_0x23cb01=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x14682+_0x59f4a2(0x10e),()=>_0x2df106[_0x59f4a2(0x121)][_0x59f4a2(0xf9)](_0x1d7674,_0x14682),{'verbose':_0x313134['verbose']});_0x50c74c=_0x23cb01['data'],_0x313134['verbose']&&console['error'](_0x59f4a2(0xca)+_0x50c74c);}const _0x19b273={'name':_0x599d3d,'description':_0x313134[_0x59f4a2(0xea)],'parentFolderId':_0x50c74c},_0x321ba1=await withSpinner(_0x59f4a2(0xcd)+_0x599d3d+_0x59f4a2(0x10e),()=>_0x2df106[_0x59f4a2(0x121)][_0x59f4a2(0xf0)](_0x221006,_0x19b273),{'verbose':_0x313134[_0x59f4a2(0x11c)]}),_0x45d77b=_0x321ba1[_0x59f4a2(0xc7)];return console[_0x59f4a2(0xf1)]('β\x20Created\x20folder\x20\x27'+_0x45d77b[_0x59f4a2(0x108)]+_0x59f4a2(0x127)+_0x45d77b['id']),await handleSDKOutput([_0x45d77b],_0x313134),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]=a27_0x4ad3fa(0x123);[a27_0x4ad3fa(0xea)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x4ad3fa(0x141)](_0x4d6604){const _0x4636a1=a27_0x4ad3fa,{options:_0x854db6,args:_0x37462e,tdx:_0x41f885}=_0x4d6604,_0x4be1f3=_0x37462e[0x0];if(!_0x4be1f3)return console[_0x4636a1(0xf1)](_0x4636a1(0x124)),console[_0x4636a1(0xf1)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x4636a1(0xfc)),console[_0x4636a1(0xf1)](_0x4636a1(0x12f)),console[_0x4636a1(0xf1)](_0x4636a1(0x12c)),console[_0x4636a1(0xf1)](_0x4636a1(0xef)),console[_0x4636a1(0xf1)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4636a1(0xf1)](_0x4636a1(0x10c)),console[_0x4636a1(0xf1)](_0x4636a1(0xdf)),0x1;try{const _0x57f4ef=_0x854db6['parentSegment'],_0x3ce2ba=await resolveSegmentTarget(_0x4be1f3,_0x57f4ef,_0x854db6[_0x4636a1(0x11c)]);_0x854db6['verbose']&&console[_0x4636a1(0xf1)](_0x4636a1(0xf3)+_0x3ce2ba);const _0x47fd76=await withSpinner(_0x4636a1(0x144)+_0x4be1f3+_0x4636a1(0x10e),()=>_0x41f885[_0x4636a1(0x121)][_0x4636a1(0xb2)](_0x3ce2ba),{'verbose':_0x854db6['verbose']}),_0x15b587=_0x47fd76[_0x4636a1(0xc7)];_0x854db6[_0x4636a1(0x11c)]&&(console[_0x4636a1(0xf1)]('Resolved\x20type:\x20'+_0x15b587[_0x4636a1(0xd0)]),console[_0x4636a1(0xf1)](_0x4636a1(0xe3)+_0x15b587[_0x4636a1(0xd1)]),_0x15b587[_0x4636a1(0xd7)]&&console['error'](_0x4636a1(0x107)+_0x15b587[_0x4636a1(0xd7)]),_0x15b587[_0x4636a1(0xe8)]&&console[_0x4636a1(0xf1)](_0x4636a1(0xcc)+_0x15b587[_0x4636a1(0xe8)]));if(_0x854db6[_0x4636a1(0x133)]){if(_0x15b587[_0x4636a1(0xd0)]===_0x4636a1(0x117))return console[_0x4636a1(0xf1)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x15b587['type']==='parent')return console['error'](_0x4636a1(0x11d)),console[_0x4636a1(0xf1)](_0x4636a1(0xb7)),0x1;if(!_0x15b587[_0x4636a1(0xe8)])throw new SDKError(ErrorCode[_0x4636a1(0x138)],_0x4636a1(0x13a));const _0x55d219=getConsoleNextUrl(_0x854db6[_0x4636a1(0x119)],_0x4636a1(0xfa)+_0x15b587[_0x4636a1(0xd1)]+_0x4636a1(0xd8)+_0x15b587[_0x4636a1(0xe8)]);return console[_0x4636a1(0xf1)](a27_0x54a151[_0x4636a1(0x111)]('β')+_0x4636a1(0xd2)+a27_0x54a151[_0x4636a1(0x134)](_0x55d219)),openBrowser(_0x55d219),0x0;}if(_0x15b587[_0x4636a1(0xd0)]===_0x4636a1(0x117)){if(!_0x15b587[_0x4636a1(0xd7)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x4636a1(0xc5));const _0x420de1=await withSpinner(_0x4636a1(0x142),()=>_0x41f885[_0x4636a1(0x121)][_0x4636a1(0x102)](_0x15b587[_0x4636a1(0xd7)]),{'verbose':_0x854db6[_0x4636a1(0x11c)]});await handleSingleObjectOutput(_0x420de1[_0x4636a1(0xc7)],_0x854db6);}else{if(_0x15b587[_0x4636a1(0xd0)]===_0x4636a1(0x121)){if(!_0x15b587['segmentId'])throw new SDKError(ErrorCode[_0x4636a1(0x138)],_0x4636a1(0x13a));const _0x324809=await withSpinner(_0x4636a1(0x139),()=>_0x41f885[_0x4636a1(0x121)][_0x4636a1(0xf8)](_0x15b587[_0x4636a1(0xd1)],_0x15b587[_0x4636a1(0xe8)]),{'verbose':_0x854db6[_0x4636a1(0x11c)]}),_0x26a33b=getConsoleNextUrl(_0x854db6[_0x4636a1(0x119)],_0x4636a1(0xfa)+_0x15b587[_0x4636a1(0xd1)]+'/e/'+_0x15b587[_0x4636a1(0xe8)]),_0x3232f2=_0x324809[_0x4636a1(0xc7)];_0x3232f2[_0x4636a1(0x110)]=_0x26a33b,await handleSingleObjectOutput(_0x3232f2,_0x854db6);}else return console[_0x4636a1(0xf1)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x4636a1(0xbe)),0x1;}return 0x0;}catch(_0x1cfe67){if(_0x1cfe67 instanceof SDKError)return console[_0x4636a1(0xf1)](_0x4636a1(0xd4)+_0x1cfe67[_0x4636a1(0xf4)]),_0x1cfe67[_0x4636a1(0xf7)]&&console[_0x4636a1(0xf1)]('\x20\x20Cause:\x20'+_0x1cfe67[_0x4636a1(0xf7)]),0x1;throw _0x1cfe67;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x4ad3fa(0x108)]=a27_0x4ad3fa(0x118);['description']=a27_0x4ad3fa(0x12d);async[a27_0x4ad3fa(0x141)](_0xe95dcd){const _0x4cdbb5=a27_0x4ad3fa,{options:_0x220487,args:_0x574a2e,tdx:_0x521abd}=_0xe95dcd,_0x31955f=_0x574a2e[0x0];if(!_0x31955f)return console[_0x4cdbb5(0xf1)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x11a)),console[_0x4cdbb5(0xf1)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x4cdbb5(0xf1)](_0x4cdbb5(0xef)),console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x143)),console[_0x4cdbb5(0xf1)](_0x4cdbb5(0xbd)),0x1;try{const _0x511520=_0x220487[_0x4cdbb5(0xf5)],_0x360af4=await resolveSegmentTarget(_0x31955f,_0x511520,_0x220487[_0x4cdbb5(0x11c)]);_0x220487[_0x4cdbb5(0x11c)]&&console[_0x4cdbb5(0xf1)](_0x4cdbb5(0xf3)+_0x360af4);const _0x566b57=await withSpinner(_0x4cdbb5(0x144)+_0x31955f+'\x27...',()=>_0x521abd[_0x4cdbb5(0x121)][_0x4cdbb5(0xb2)](_0x360af4),{'verbose':_0x220487[_0x4cdbb5(0x11c)]}),_0x478d4e=_0x566b57[_0x4cdbb5(0xc7)];_0x220487[_0x4cdbb5(0x11c)]&&(console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x147)+_0x478d4e['type']),console[_0x4cdbb5(0xf1)]('Parent\x20ID:\x20'+_0x478d4e[_0x4cdbb5(0xd1)]));if(_0x478d4e[_0x4cdbb5(0xd0)]===_0x4cdbb5(0x117))return console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x146)),console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x109)),0x1;if(_0x478d4e['type']==='parent')return console[_0x4cdbb5(0xf1)](_0x4cdbb5(0x11e)),console[_0x4cdbb5(0xf1)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x478d4e[_0x4cdbb5(0xe8)])throw new SDKError(ErrorCode[_0x4cdbb5(0x138)],_0x4cdbb5(0x13a));const _0xe0887e=await withSpinner(_0x4cdbb5(0xff),()=>_0x521abd[_0x4cdbb5(0x121)][_0x4cdbb5(0xee)](_0x478d4e['parentId'],_0x478d4e[_0x4cdbb5(0xe8)]),{'verbose':_0x220487[_0x4cdbb5(0x11c)]}),_0x5bf56c=_0xe0887e['data'],_0x319ebf=await executeSchemaQuery(_0x5bf56c,_0x521abd,_0x220487);return await handleQueryOutput(_0x319ebf,_0x220487),0x0;}catch(_0x52bf39){if(_0x52bf39 instanceof SDKError)return console['error'](_0x4cdbb5(0xd4)+_0x52bf39[_0x4cdbb5(0xf4)]),_0x52bf39[_0x4cdbb5(0xf7)]&&console[_0x4cdbb5(0xf1)](_0x4cdbb5(0xb0)+_0x52bf39[_0x4cdbb5(0xf7)]),0x1;throw _0x52bf39;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x255766=a28_0xc766;(function(_0x6ceca6,_0xbaec39){const _0x35ba23=a28_0xc766,_0x2b4dcd=_0x6ceca6();while(!![]){try{const _0x4ecf2e=-parseInt(_0x35ba23(0x101))/0x1*(parseInt(_0x35ba23(0x10e))/0x2)+-parseInt(_0x35ba23(0x118))/0x3*(parseInt(_0x35ba23(0xfe))/0x4)+-parseInt(_0x35ba23(0xee))/0x5+parseInt(_0x35ba23(0xeb))/0x6*(parseInt(_0x35ba23(0x100))/0x7)+parseInt(_0x35ba23(0xf0))/0x8+-parseInt(_0x35ba23(0x10a))/0x9+parseInt(_0x35ba23(0xf6))/0xa*(parseInt(_0x35ba23(0x11d))/0xb);if(_0x4ecf2e===_0xbaec39)break;else _0x2b4dcd['push'](_0x2b4dcd['shift']());}catch(_0x2cfe5d){_0x2b4dcd['push'](_0x2b4dcd['shift']());}}}(a28_0x3cd7,0x61c04));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';import a28_0x4744b7 from'chalk';function a28_0x3cd7(){const _0x394bec=['Resolving\x20folder\x20path\x20\x27','1244200tODdrb','\x20\x20\x20Path:\x20','Site:\x20','segments','folderId','folder','1358410XHMZFf','rule','Resolving\x20folder\x20\x27','ruleFile','\x27...','\x27\x20with\x20ID:\x20','includes','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','674804apFAgg','resolvePathToResource','469iZTRze','662602pvkWBF','Parent:\x20','β\x20Created\x20segment\x20\x27','error','segment:create','data','type','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','length','1037961eNxeQT','resolveParentId','invisible','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','2rtaaqV','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Resolving\x20parent\x20segment\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','description','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','parent','Resolved\x20folder\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment','3JZsavI','kind','Resolved\x20relative\x20path\x20to:\x20','Creating\x20segment\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','143RUFYFm','yellow','execute','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','site','Parent\x20path:\x20','3378KALCWb','verbose','segmentPath','3060795iVyYmh'];a28_0x3cd7=function(){return _0x394bec;};return a28_0x3cd7();}function a28_0xc766(_0x590ec6,_0x158cc1){_0x590ec6=_0x590ec6-0xe5;const _0x3cd760=a28_0x3cd7();let _0xc766cd=_0x3cd760[_0x590ec6];return _0xc766cd;}export class SegmentCreateCommand extends BaseCommand{['name']=a28_0x255766(0x105);[a28_0x255766(0x112)]=a28_0x255766(0xe8);async[a28_0x255766(0xe6)](_0x4cee53){const _0x2bdb63=a28_0x255766;console[_0x2bdb63(0x104)](a28_0x4744b7[_0x2bdb63(0xe5)](_0x2bdb63(0x10f))),console[_0x2bdb63(0x104)](a28_0x4744b7[_0x2bdb63(0xe5)](_0x2bdb63(0x11c)));const {options:_0x504f73,args:_0x6196ad,tdx:_0x52faae}=_0x4cee53,_0x3c287f=_0x504f73;if(_0x6196ad[_0x2bdb63(0x109)]===0x0)return console[_0x2bdb63(0x104)](_0x2bdb63(0x116)),console[_0x2bdb63(0x104)](_0x2bdb63(0x108)),console[_0x2bdb63(0x104)]('Examples:'),console[_0x2bdb63(0x104)](_0x2bdb63(0xe7)),console[_0x2bdb63(0x104)](_0x2bdb63(0xfd)),console[_0x2bdb63(0x104)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x3860c8=_0x6196ad[0x0],_0x5a8c50=_0x504f73[_0x2bdb63(0xed)];let _0x5161e1=_0x3860c8;_0x5a8c50&&!_0x3860c8[_0x2bdb63(0xfc)]('/')&&(_0x5161e1=_0x5a8c50+'/'+_0x3860c8,_0x3c287f['verbose']&&console[_0x2bdb63(0x104)](_0x2bdb63(0x11a)+_0x5161e1));const _0x1d498c=parsePath(_0x5161e1);if(_0x1d498c[_0x2bdb63(0xf3)][_0x2bdb63(0x109)]<0x2)return console['error'](_0x2bdb63(0x111)),console[_0x2bdb63(0x104)](_0x2bdb63(0x10d)),0x1;const _0x180202=_0x1d498c[_0x2bdb63(0xf3)][0x0],_0x5236fa=getBaseName(_0x5161e1),_0xb6212c=getParentPath(_0x5161e1);_0x3c287f[_0x2bdb63(0xec)]&&(console['error'](_0x2bdb63(0xf2)+_0x3c287f[_0x2bdb63(0xe9)]),console[_0x2bdb63(0x104)]('Target\x20path:\x20'+_0x5161e1),console[_0x2bdb63(0x104)](_0x2bdb63(0x102)+_0x180202),console[_0x2bdb63(0x104)]('Segment\x20name:\x20'+_0x5236fa),console['error'](_0x2bdb63(0xea)+_0xb6212c));const _0x216c53=await withSpinner(_0x2bdb63(0x110)+_0x180202+_0x2bdb63(0xfa),()=>_0x52faae[_0x2bdb63(0x117)][_0x2bdb63(0x10b)](_0x180202),{'verbose':_0x3c287f['verbose']}),_0x1f7b73=_0x216c53[_0x2bdb63(0x106)];let _0x5acbdb;if(_0x1d498c[_0x2bdb63(0xf3)]['length']>0x2){const _0x11ebea=await withSpinner(_0x2bdb63(0xef)+_0xb6212c+'\x27...',()=>_0x52faae['segment'][_0x2bdb63(0xff)](_0xb6212c),{'verbose':_0x3c287f[_0x2bdb63(0xec)]}),_0x18d309=_0x11ebea[_0x2bdb63(0x106)];if(_0x18d309[_0x2bdb63(0x107)]!=='folder'&&_0x18d309[_0x2bdb63(0x107)]!==_0x2bdb63(0x114))return console['error'](_0x2bdb63(0x113)),0x1;_0x5acbdb=_0x18d309[_0x2bdb63(0xf4)];}else{if(_0x3c287f[_0x2bdb63(0xf5)]){const _0x673eb2=await withSpinner(_0x2bdb63(0xf8)+_0x3c287f[_0x2bdb63(0xf5)]+_0x2bdb63(0xfa),()=>_0x52faae[_0x2bdb63(0x117)]['resolveFolderId'](_0x1f7b73,_0x3c287f['folder']),{'verbose':_0x3c287f['verbose']});_0x5acbdb=_0x673eb2['data'];}}_0x3c287f['verbose']&&_0x5acbdb&&console[_0x2bdb63(0x104)](_0x2bdb63(0x115)+_0x5acbdb);const _0x36e0ea=await loadJSONFromOptions(_0x3c287f[_0x2bdb63(0xf7)],_0x3c287f[_0x2bdb63(0xf9)]),_0x23a58a={'name':_0x5236fa,'description':_0x3c287f[_0x2bdb63(0x112)],'rule':_0x36e0ea,'kind':_0x3c287f[_0x2bdb63(0x119)]!==undefined?parseInt(_0x3c287f[_0x2bdb63(0x119)],0xa):undefined,'isVisible':_0x3c287f[_0x2bdb63(0x10c)]?![]:undefined,'segmentFolderId':_0x5acbdb,'countPopulation':_0x3c287f['noCountPopulation']?![]:undefined},_0x3d1b6c=await withSpinner(_0x2bdb63(0x11b)+_0x5236fa+_0x2bdb63(0xfa),()=>_0x52faae[_0x2bdb63(0x117)]['createSegment'](_0x1f7b73,_0x23a58a),{'verbose':_0x3c287f['verbose']}),_0x38aee0=_0x3d1b6c[_0x2bdb63(0x106)];return console['error'](_0x2bdb63(0x103)+_0x38aee0['name']+_0x2bdb63(0xfb)+_0x38aee0['id']),_0x5161e1!==_0x3860c8&&console['error'](_0x2bdb63(0xf1)+_0x5161e1),await handleSDKOutput([_0x38aee0],_0x3c287f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x2ba406=a29_0x3061;function a29_0x3be3(){const _0x3cb11a=['600554fAlTmC','name','4930902VPLIoU','12132yMoPMr','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','5419008TrgduE','error','85864oYoxnK','jsonl','length','20644AvFWMq','693AXrkjL','json','655DctZrV','description','segment','β\x20Found\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2060cpAdcE','2dglyTf','parentSegment','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Site:\x20','Parent\x20segment:\x20','7120069TwmvYy','segment:fields','verbose'];a29_0x3be3=function(){return _0x3cb11a;};return a29_0x3be3();}(function(_0x2e420e,_0x44caf1){const _0x523b8d=a29_0x3061,_0x5d3db4=_0x2e420e();while(!![]){try{const _0x324fe6=-parseInt(_0x523b8d(0xae))/0x1*(-parseInt(_0x523b8d(0xc2))/0x2)+-parseInt(_0x523b8d(0xb4))/0x3+parseInt(_0x523b8d(0xb9))/0x4*(parseInt(_0x523b8d(0xbc))/0x5)+parseInt(_0x523b8d(0xb0))/0x6+parseInt(_0x523b8d(0xba))/0x7*(parseInt(_0x523b8d(0xb6))/0x8)+parseInt(_0x523b8d(0xb1))/0x9*(parseInt(_0x523b8d(0xc1))/0xa)+-parseInt(_0x523b8d(0xab))/0xb;if(_0x324fe6===_0x44caf1)break;else _0x5d3db4['push'](_0x5d3db4['shift']());}catch(_0x3eaffa){_0x5d3db4['push'](_0x5d3db4['shift']());}}}(a29_0x3be3,0xf080e));import{BaseCommand}from'./command.js';function a29_0x3061(_0x3e0b25,_0x1b2946){_0x3e0b25=_0x3e0b25-0xa7;const _0x3be339=a29_0x3be3();let _0x3061f0=_0x3be339[_0x3e0b25];return _0x3061f0;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x2ba406(0xaf)]=a29_0x2ba406(0xac);[a29_0x2ba406(0xbd)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x442c24){const _0x1ad8ea=a29_0x2ba406,{options:_0x657b3,args:_0xe61293,tdx:_0x5719e2}=_0x442c24,_0x5190ad=_0xe61293[0x0]||_0x657b3[_0x1ad8ea(0xa7)];if(!_0x5190ad)return console[_0x1ad8ea(0xb5)](_0x1ad8ea(0xb3)),console[_0x1ad8ea(0xb5)](_0x1ad8ea(0xa8)),console['error'](_0x1ad8ea(0xc0)),0x1;_0x657b3[_0x1ad8ea(0xad)]&&(console[_0x1ad8ea(0xb5)](_0x1ad8ea(0xa9)+_0x657b3['site']),console[_0x1ad8ea(0xb5)](_0x1ad8ea(0xaa)+_0x5190ad));const _0xf37520=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5190ad+_0x1ad8ea(0xb2),()=>_0x5719e2[_0x1ad8ea(0xbe)]['listFields'](_0x5190ad),{'verbose':_0x657b3[_0x1ad8ea(0xad)]}),_0x638256=_0xf37520['data'];console[_0x1ad8ea(0xb5)](_0x1ad8ea(0xbf)+_0x638256[_0x1ad8ea(0xb8)]+'\x20field'+(_0x638256['length']!==0x1?'s':''));if(_0x657b3[_0x1ad8ea(0xbb)]||_0x657b3[_0x1ad8ea(0xb7)])return await handleSDKOutput(_0x638256,_0x657b3),0x0;return displayFieldsHumanReadable(_0x638256,_0x5190ad),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x1ad476=a30_0x2737;(function(_0x4008d8,_0x3cd6be){const _0x5c7001=a30_0x2737,_0x2ce692=_0x4008d8();while(!![]){try{const _0x3b7dd0=parseInt(_0x5c7001(0x158))/0x1*(parseInt(_0x5c7001(0x14e))/0x2)+-parseInt(_0x5c7001(0x162))/0x3+parseInt(_0x5c7001(0x183))/0x4+parseInt(_0x5c7001(0x140))/0x5*(parseInt(_0x5c7001(0x15f))/0x6)+-parseInt(_0x5c7001(0x15e))/0x7+parseInt(_0x5c7001(0x16a))/0x8+-parseInt(_0x5c7001(0x13e))/0x9;if(_0x3b7dd0===_0x3cd6be)break;else _0x2ce692['push'](_0x2ce692['shift']());}catch(_0x23928c){_0x2ce692['push'](_0x2ce692['shift']());}}}(a30_0x23dd,0x7987e));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a30_0x2737(_0x1c3a3b,_0x54c93f){_0x1c3a3b=_0x1c3a3b-0x13c;const _0x23dd73=a30_0x23dd();let _0x27373a=_0x23dd73[_0x1c3a3b];return _0x27373a;}function a30_0x23dd(){const _0x39e90d=['6474080PiGOSt','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','segment','repeat','red','segment:pull','Parent\x20segment:\x20','\x20new\x20files','relativePath','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','diff','counts','Error:\x20','journeys','\x20unchanged\x20files','cwd','parent_segment','files','helpText','site','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','segments','message','session','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','3867904mcMqpy','β\x20Context\x20set:\x20','\x20=\x20','dryRun','\x20\x20π―\x20','\x20activations','β\x20All\x20files\x20are\x20up\x20to\x20date','\x20changed\x20files','12532743NoHxyK','-\x20no\x20files\x20written','3230gwSiaL','utf-8','\x20segments','pullSegments','parentSegment','targetDir','journeyVersions','Site:\x20','dim','data','\x0aChanges\x20to\x20\x27','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','verbose','description','112094LnwmtR','resourceName','\x20journeys','parentName','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','absolutePath','isNew','file','\x20files\x20to\x20','no_parent','17rKCJrm','green','\x20\x20Target:\x20','filter','hasChanges','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)','5002312ISUida','6066IEXnht','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','2331624BGRarj','yellow','cyan','setPhase','Pulling\x20segments\x20from\x20\x27','content','Aborted.','error'];a30_0x23dd=function(){return _0x39e90d;};return a30_0x23dd();}import{saveSessionContext}from'../core/session.js';import a30_0xaf1a69 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x53e3bd from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a30_0x1ad476(0x16f);[a30_0x1ad476(0x14d)]=a30_0x1ad476(0x182);async['execute'](_0x198710){const _0x333402=a30_0x1ad476,{options:_0x11a464,args:_0x22cc9f,tdx:_0xdd115d}=_0x198710,_0x9e1b9b=_0x11a464,_0x2399cf=await resolveTarget({'arg':_0x22cc9f[0x0],'contextParent':_0x11a464[_0x333402(0x144)],'cwd':process[_0x333402(0x179)]()});if(!isSuccessfulResolution(_0x2399cf))return _0x2399cf['errorCode']===_0x333402(0x157)?(console[_0x333402(0x169)](a30_0xaf1a69['yellow'](_0x333402(0x16b))),console[_0x333402(0x169)](_0x333402(0x15d)),console[_0x333402(0x169)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x333402(0x169)](_0x333402(0x161))):(console[_0x333402(0x169)](a30_0xaf1a69[_0x333402(0x16e)](_0x333402(0x176)+_0x2399cf[_0x333402(0x180)]+'\x0a')),_0x2399cf[_0x333402(0x17c)]&&console[_0x333402(0x169)](a30_0xaf1a69['cyan'](_0x2399cf[_0x333402(0x17c)]))),0x1;const _0x2fb16b=_0x2399cf[_0x333402(0x151)],_0x535dfc=_0x2399cf['targetDir'],_0x22a9d8=_0x2399cf['type']===_0x333402(0x155)?_0x2399cf[_0x333402(0x14f)]:undefined;_0x9e1b9b[_0x333402(0x14c)]&&(console[_0x333402(0x169)](_0x333402(0x147)+_0x9e1b9b[_0x333402(0x17d)]),console[_0x333402(0x169)](_0x333402(0x170)+_0x2fb16b),_0x22a9d8&&console['error']('Target\x20resource:\x20'+_0x22a9d8));const _0x1a58a8=await withProgressSpinner(_0x333402(0x166)+_0x2fb16b+'\x27...',_0x344d47=>_0xdd115d[_0x333402(0x16c)][_0x333402(0x143)](_0x2fb16b,{'targetDir':_0x535dfc,'targetResourceName':_0x22a9d8,'verbose':_0x9e1b9b[_0x333402(0x14c)],'progress':{'update':_0x2a5930=>{const _0x30f6b6=_0x333402;_0x344d47[_0x30f6b6(0x165)](_0x2a5930),_0x9e1b9b[_0x30f6b6(0x14c)]&&console[_0x30f6b6(0x169)]('\x20\x20'+_0x2a5930);}}}),{'verbose':_0x9e1b9b[_0x333402(0x14c)]}),_0x201903=_0x1a58a8[_0x333402(0x149)];if(_0x201903[_0x333402(0x175)][_0x333402(0x17f)]===0x0&&_0x201903[_0x333402(0x175)][_0x333402(0x177)]===0x0)return console['error'](a30_0xaf1a69[_0x333402(0x163)](_0x333402(0x17e)+_0x201903[_0x333402(0x151)]+'\x27')),0x0;const _0x28d868=_0x201903[_0x333402(0x17b)][_0x333402(0x15b)](_0x13ccf7=>_0x13ccf7[_0x333402(0x154)]),_0x2ebeb1=_0x201903[_0x333402(0x17b)][_0x333402(0x15b)](_0x485cc3=>!_0x485cc3[_0x333402(0x154)]&&_0x485cc3[_0x333402(0x15c)]),_0xca1641=_0x201903[_0x333402(0x17b)]['filter'](_0x54bb6a=>!_0x54bb6a[_0x333402(0x154)]&&!_0x54bb6a[_0x333402(0x15c)]);console[_0x333402(0x169)]('\x0aPull\x20summary\x20for\x20\x27'+_0x201903['parentName']+'\x27:'),console[_0x333402(0x169)](_0x333402(0x187)+a30_0xaf1a69[_0x333402(0x164)](_0x201903[_0x333402(0x175)][_0x333402(0x17f)]+_0x333402(0x142))+'\x20with\x20'+a30_0xaf1a69[_0x333402(0x164)](_0x201903[_0x333402(0x175)]['activations']+_0x333402(0x188)));if(_0x201903[_0x333402(0x175)]['journeys']>0x0){const _0x3f51db=_0x201903['counts'][_0x333402(0x146)]>_0x201903['counts']['journeys']?'\x20('+_0x201903[_0x333402(0x175)][_0x333402(0x146)]+'\x20versions)':'';console[_0x333402(0x169)]('\x20\x20πΊοΈ\x20\x20'+a30_0xaf1a69[_0x333402(0x164)](_0x201903['counts'][_0x333402(0x177)]+_0x333402(0x150))+a30_0xaf1a69[_0x333402(0x148)](_0x3f51db));}console[_0x333402(0x169)]('\x20\x20'+a30_0xaf1a69[_0x333402(0x159)]('+\x20'+_0x28d868[_0x333402(0x160)]+_0x333402(0x171))),console[_0x333402(0x169)]('\x20\x20'+a30_0xaf1a69['yellow']('~\x20'+_0x2ebeb1[_0x333402(0x160)]+_0x333402(0x13d))),console[_0x333402(0x169)]('\x20\x20'+a30_0xaf1a69[_0x333402(0x148)]('=\x20'+_0xca1641[_0x333402(0x160)]+_0x333402(0x178))),console[_0x333402(0x169)](_0x333402(0x15a)+a30_0xaf1a69[_0x333402(0x164)](_0x201903['targetDir'])+'\x0a');if(_0x2ebeb1[_0x333402(0x160)]>0x0)for(const _0xf9c830 of _0x2ebeb1){console[_0x333402(0x169)](_0x333402(0x14a)+_0xf9c830[_0x333402(0x172)]+'\x27:'),console[_0x333402(0x169)]('β'[_0x333402(0x16d)](0x3c)),console['error'](_0xf9c830[_0x333402(0x174)]),console[_0x333402(0x169)]('β'[_0x333402(0x16d)](0x3c));}if(_0x9e1b9b[_0x333402(0x186)])return console[_0x333402(0x169)](a30_0xaf1a69[_0x333402(0x163)](_0x333402(0x173))),0x0;if(_0x28d868[_0x333402(0x160)]===0x0&&_0x2ebeb1[_0x333402(0x160)]===0x0)return console['error'](a30_0xaf1a69['green'](_0x333402(0x13c))),saveSessionContext({'parent_segment':_0x201903[_0x333402(0x151)]},_0x9e1b9b['session']),console['error'](a30_0xaf1a69['green'](_0x333402(0x184)+a30_0xaf1a69[_0x333402(0x148)](_0x333402(0x17a))+'\x20=\x20'+a30_0xaf1a69[_0x333402(0x164)](_0x201903[_0x333402(0x151)]))),0x0;if(!_0x9e1b9b['yes']){if(!isInteractive())return console[_0x333402(0x169)](a30_0xaf1a69[_0x333402(0x16e)]('\x0aError:'),_0x333402(0x152)),console[_0x333402(0x169)](a30_0xaf1a69['dim'](_0x333402(0x14b))),0x1;const _0x14ca89=await confirmKey('Write\x20'+(_0x28d868[_0x333402(0x160)]+_0x2ebeb1[_0x333402(0x160)])+'\x20files?');if(!_0x14ca89)return console[_0x333402(0x169)](a30_0xaf1a69[_0x333402(0x163)](_0x333402(0x168)),_0x333402(0x13f)),0x1;}for(const _0xfd90e5 of _0x201903[_0x333402(0x17b)]){if(_0xfd90e5['isNew']||_0xfd90e5[_0x333402(0x15c)]){const _0x5df29c=a30_0x53e3bd['dirname'](_0xfd90e5[_0x333402(0x153)]);!existsSync(_0x5df29c)&&mkdirSync(_0x5df29c,{'recursive':!![]}),writeFileSync(_0xfd90e5[_0x333402(0x153)],_0xfd90e5[_0x333402(0x167)],_0x333402(0x141));}}return console[_0x333402(0x169)](a30_0xaf1a69[_0x333402(0x159)]('β\x20Pulled\x20'+(_0x28d868[_0x333402(0x160)]+_0x2ebeb1[_0x333402(0x160)])+_0x333402(0x156)+_0x201903[_0x333402(0x145)])),saveSessionContext({'parent_segment':_0x201903['parentName']},_0x9e1b9b[_0x333402(0x181)]),console[_0x333402(0x169)](a30_0xaf1a69['green'](_0x333402(0x184)+a30_0xaf1a69['dim'](_0x333402(0x17a))+_0x333402(0x185)+a30_0xaf1a69['cyan'](_0x201903['parentName']))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1b7467=a31_0x4679;(function(_0x5a9ddb,_0x3f83f6){const _0x5173b3=a31_0x4679,_0x115fbc=_0x5a9ddb();while(!![]){try{const _0x216b94=-parseInt(_0x5173b3(0x17d))/0x1*(-parseInt(_0x5173b3(0x174))/0x2)+parseInt(_0x5173b3(0x1b5))/0x3*(-parseInt(_0x5173b3(0x1dd))/0x4)+-parseInt(_0x5173b3(0x176))/0x5+parseInt(_0x5173b3(0x16f))/0x6*(-parseInt(_0x5173b3(0x155))/0x7)+-parseInt(_0x5173b3(0x19f))/0x8+-parseInt(_0x5173b3(0x1ab))/0x9*(-parseInt(_0x5173b3(0x15d))/0xa)+parseInt(_0x5173b3(0x165))/0xb;if(_0x216b94===_0x3f83f6)break;else _0x115fbc['push'](_0x115fbc['shift']());}catch(_0x5dbf49){_0x115fbc['push'](_0x115fbc['shift']());}}}(a31_0x3d26,0xc834b));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a31_0x4679(_0x427075,_0x252ced){_0x427075=_0x427075-0x14f;const _0x3d2697=a31_0x3d26();let _0x4679da=_0x3d2697[_0x427075];return _0x4679da;}import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';function a31_0x3d26(){const _0x4ac5ea=['parentSegment','green','Fetching\x20existing\x20folders...','message','.yml','journeysOnly','repeat','then','\x0aValidation\x20failed:','name','Fetching\x20existing\x20journeys...','map','cyan','error','listActivations','/e/','21JUxBes','(Journey\x20will\x20be\x20deleted)','file','setPhase','segments','targetDir','attributes','Folders\x20to\x20create:','10FIbdqS','Resolving\x20parent\x20segment\x20\x27','\x20\x20Journeys:\x20','yamlConfig','\x20created','user','list','\x20new','41106747ZokKlh','filePath','folderId','results','folderPath','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)','Fetching\x20connections\x20for\x20name\x20resolution...','no_parent','Parent\x20segment:\x20','\x20unchanged','3065658zvdnfD','No\x20','state','existingJourney','parentName','10078mqqIBu','nameToType','3663715sdsbKE','scopedFolderPath','deleted','cwd','paused','toString','journeyBundleId','205XorGWL','connection','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','delete','Fetching\x20existing\x20segments...','New\x20segment:','journeyId','.yaml','updated','relationships','type','\x20\x20πΊοΈ\x20\x20Journeys:','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20updated','changed','dryRun','\x0aError:','segment','resolveParentId','created','getParent','dim','toUpdate','filter','Delete\x20segment:','\x20\x20Segments:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20\x20π\x20Segments:','all','Delete\x20journey:','segmentFolderId','π\x20','diff','length','6618768HHgFEq','endsWith','description','versionNumber','nameToId','parentFolder','yellow','\x20changed','verbose','Fetching\x20parent\x20segment\x20details...','updatedAt','\x20to\x20delete','3293037hnSjJx','unchanged','helpText','Error\x20parsing\x20YAML:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','createdAt','\x20folders\x20to\x20create','\x20to\x20create','listSegments','listFolders','852qFsnwQ','journey','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','join','site','/j/da/je','\x0aPush\x20summary\x20for\x20\x27','parent_name','Push\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','β\x20All\x20journeys\x20are\x20up\x20to\x20date','get','blue','\x20deleted','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20changes?','journeys','activations','data','Changes\x20to:','yes','\x20\x20Activations:\x20','\x20\x20\x20\x20','journeyBundleName','red','push','\x20activations]','Error:\x20Directory\x20not\x20found:\x20','isNew','idToName','execute','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','getJourney','new','isScoped','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','toDelete','17224OnqvRx','/app/ps/','audienceId','createdSegmentIds','set','getOutputSchemaWithCache','toCreate','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a'];a31_0x3d26=function(){return _0x4ac5ea;};return a31_0x3d26();}import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x4c9dba from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a31_0x1b7467(0x1a1)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a31_0x1b7467(0x1d4)](_0x2e762a){const _0x4ba892=a31_0x1b7467,{options:_0x524227,args:_0x3392be,tdx:_0x90e34a}=_0x2e762a,_0x15101f=_0x524227,_0x1c0ba1=await resolveTarget({'arg':_0x3392be[0x0],'contextParent':_0x524227[_0x4ba892(0x1e5)],'cwd':process[_0x4ba892(0x179)]()});if(!isSuccessfulResolution(_0x1c0ba1))return _0x1c0ba1['errorCode']===_0x4ba892(0x16c)?(console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1a5)](_0x4ba892(0x1e4))),console['error'](_0x4ba892(0x16a)),console[_0x4ba892(0x152)](_0x4ba892(0x197)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)]('Error:\x20'+_0x1c0ba1[_0x4ba892(0x1e8)]+'\x0a')),_0x1c0ba1[_0x4ba892(0x1ad)]&&console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x151)](_0x1c0ba1['helpText']))),0x1;if(_0x1c0ba1['type']===_0x4ba892(0x1bc))return console['error'](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x1d1)+_0x1c0ba1[_0x4ba892(0x15a)]+'\x0a')),console['error'](a31_0x4c9dba[_0x4ba892(0x151)](_0x4ba892(0x1db))),0x1;const _0x4c169b=_0x1c0ba1[_0x4ba892(0x173)],_0x4493e2=_0x1c0ba1['targetDir'],_0x10e27c=_0x1c0ba1[_0x4ba892(0x187)]===_0x4ba892(0x157)?_0x1c0ba1[_0x4ba892(0x166)]:undefined,_0x25fc9d=getScopedDetails(_0x1c0ba1),_0x2c27f7=_0x25fc9d?.[_0x4ba892(0x1d9)]??![],_0x391204=_0x25fc9d?.[_0x4ba892(0x177)]??'';if(!existsSync(_0x4493e2))return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x1d1)+_0x4493e2+'\x0a')),console[_0x4ba892(0x152)](a31_0x4c9dba['cyan'](_0x4ba892(0x1db))),0x1;_0x15101f[_0x4ba892(0x1a7)]&&(console[_0x4ba892(0x152)]('Site:\x20'+_0x15101f['site']),console[_0x4ba892(0x152)](_0x4ba892(0x16d)+_0x4c169b),console[_0x4ba892(0x152)]('Source\x20directory:\x20'+_0x4493e2),_0x2c27f7&&console[_0x4ba892(0x152)]('Scoped\x20to\x20folder:\x20'+_0x391204));const _0x400deb=await withSpinner(_0x4ba892(0x15e)+_0x4c169b+'\x27...',()=>_0x90e34a[_0x4ba892(0x18e)][_0x4ba892(0x18f)](_0x4c169b),{'verbose':_0x15101f[_0x4ba892(0x1a7)]}),_0x96b819=_0x400deb[_0x4ba892(0x1c8)],[_0x350caf,_0x1e4257,_0x4750ea,_0x50295a,_0xc6f116]=await Promise[_0x4ba892(0x199)]([withSpinner(_0x4ba892(0x1a8),()=>_0x90e34a[_0x4ba892(0x18e)][_0x4ba892(0x191)](_0x96b819),{'verbose':_0x15101f['verbose']}),withSpinner(_0x4ba892(0x181),()=>_0x90e34a[_0x4ba892(0x18e)][_0x4ba892(0x1b3)](_0x96b819),{'verbose':_0x15101f[_0x4ba892(0x1a7)]}),withSpinner(_0x4ba892(0x1e7),()=>_0x90e34a[_0x4ba892(0x18e)][_0x4ba892(0x1b4)](_0x96b819),{'verbose':_0x15101f['verbose']}),withSpinner(_0x4ba892(0x14f),()=>_0x90e34a[_0x4ba892(0x1b6)]['listJourneysWithDetailsFromParentSegment'](_0x96b819,{'includeAllVersions':!![]}),{'verbose':_0x15101f[_0x4ba892(0x1a7)]}),withSpinner(_0x4ba892(0x1c4),()=>_0x90e34a[_0x4ba892(0x162)]['buildUserMaps'](),{'verbose':_0x15101f[_0x4ba892(0x1a7)]})['then'](_0x3edd29=>_0x3edd29[_0x4ba892(0x1c8)])]),_0x3a58b7=_0x350caf[_0x4ba892(0x1c8)],_0x3e1bba=extractRootFolderId(_0x3a58b7),_0x4df39e=_0x1e4257['data'],_0x175b76=_0x4750ea['data'],{journeys:_0x3e1e36,activationStepsById:_0x4f4175}=_0x50295a[_0x4ba892(0x1c8)],_0x10d577=new Map(_0x3e1e36[_0x4ba892(0x150)](_0x3d55c0=>[_0x3d55c0['id'],_0x3d55c0])),_0xbbcbe9=_0x3e1e36[_0x4ba892(0x150)](_0x38b02d=>({'id':_0x38b02d['id'],'name':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x1ee)],'journeyBundleName':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x1cd)]||'','journeyBundleId':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x17c)]||'','versionNumber':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x1a2)],'description':_0x38b02d[_0x4ba892(0x15b)]['description'],'state':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x171)],'paused':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x17a)],'audienceId':_0x38b02d[_0x4ba892(0x15b)][_0x4ba892(0x1df)],'folderId':_0x38b02d[_0x4ba892(0x186)]?.[_0x4ba892(0x1a4)]?.[_0x4ba892(0x1c8)]?.['id'],'createdAt':_0x38b02d['attributes'][_0x4ba892(0x1b0)],'updatedAt':_0x38b02d['attributes'][_0x4ba892(0x1a9)]})),{emailToId:_0x325468,idToEmail:_0x2a3062}=_0xc6f116,_0x405b63=await withSpinner(_0x4ba892(0x16b),async()=>{const _0x3a9cff=_0x4ba892,_0x4e7b8f=await _0x90e34a[_0x3a9cff(0x17e)][_0x3a9cff(0x163)]();return buildConnectionMaps(_0x4e7b8f);},{'verbose':_0x15101f['verbose']})[_0x4ba892(0x1ec)](_0x52e4f7=>_0x52e4f7[_0x4ba892(0x1c8)]),_0x3e080f=_0x405b63[_0x4ba892(0x1a3)],_0x22d8cf=_0x405b63[_0x4ba892(0x1d3)],_0x2e9d5a=_0x405b63[_0x4ba892(0x175)],_0x297677={'emailToIdMap':_0x325468,'connectionNameToIdMap':_0x3e080f,'connectionNameToTypeMap':_0x2e9d5a,'getSchema':_0x38cf04=>_0x90e34a[_0x4ba892(0x17e)][_0x4ba892(0x1e2)](_0x38cf04)};let {pathToId:_0x37b794,idToPath:_0x4f4377}=buildFolderMaps(_0x175b76);const _0x33edea=buildSegmentLookupMap(_0x4df39e,_0x4f4377),_0x4246d9=buildSegmentNameToIdMap(_0x4df39e),_0x2fd3de=buildJourneyBundleLookupMap(_0xbbcbe9,_0x4f4377);let _0x4f18bd;if(_0x10e27c){if(!_0x10e27c[_0x4ba892(0x1a0)](_0x4ba892(0x1e9))&&!_0x10e27c[_0x4ba892(0x1a0)](_0x4ba892(0x184)))return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x17f)+_0x10e27c+'\x0a')),0x1;_0x4f18bd=[_0x10e27c];}else _0x4f18bd=findYamlFiles(_0x4493e2);if(_0x4f18bd[_0x4ba892(0x19e)]===0x0)return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x1b7)+_0x4493e2+'\x0a')),console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x151)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x19a82c,_0x2d442b;try{const _0x1b61bc=parseAndClassifyYamlFiles(_0x4f18bd,_0x4493e2,{'skipSegments':_0x15101f[_0x4ba892(0x1ea)]});_0x19a82c=_0x1b61bc[_0x4ba892(0x159)],_0x2d442b=_0x1b61bc[_0x4ba892(0x1c6)];const _0x567c85=validateParsedFiles(_0x1b61bc,_0x4493e2);if(_0x567c85[_0x4ba892(0x19e)]>0x0)return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x1ed))),console['error'](formatValidationErrors(_0x567c85)),console[_0x4ba892(0x152)](a31_0x4c9dba['yellow'](_0x4ba892(0x1be))),0x1;}catch(_0x19c14b){return console['error'](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x1ae)+(_0x19c14b instanceof Error?_0x19c14b['message']:_0x19c14b))),0x1;}if(_0x19a82c[_0x4ba892(0x19e)]===0x0&&_0x2d442b['length']===0x0){const _0x3aff57=_0x15101f[_0x4ba892(0x1ea)]?_0x4ba892(0x1b6):'segment\x20or\x20journey';return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1a5)](_0x4ba892(0x170)+_0x3aff57+'\x20YAML\x20files\x20found')),0x0;}const _0x4b71d3=new Map();_0x4df39e['length']>0x0&&!_0x15101f[_0x4ba892(0x1ea)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4df39e,async _0x259c89=>{const _0x27d243=a31_0x4679,_0x2b6d2d=await _0x90e34a[_0x27d243(0x18e)][_0x27d243(0x153)](_0x96b819,_0x259c89['id']);_0x4b71d3[_0x27d243(0x1e1)](_0x259c89['id'],_0x2b6d2d);});},{'verbose':_0x15101f[_0x4ba892(0x1a7)]});const {segmentFiles:_0x56be2a,foldersToCreate:_0x4c3368}=await prepareSegmentFiles(_0x19a82c,{'segmentByFolderAndName':_0x33edea,'activationsBySegmentId':_0x4b71d3,'folderPathToId':_0x37b794,'idToEmailMap':_0x2a3062,'connectionIdToNameMap':_0x22d8cf},_0x297677,_0x2c27f7,_0x391204),_0x542946=_0x10e27c?[]:findSegmentsToDelete(_0x4df39e,_0x19a82c[_0x4ba892(0x150)](({yamlConfig:_0x9a02de,folderPath:_0x90af6d})=>({'yamlConfig':_0x9a02de,'folderPath':resolveTDFolderPath(_0x90af6d,_0x2c27f7,_0x391204)})),_0x4f4377,_0x391204,_0x2c27f7),{journeyFiles:_0x32d1f0,foldersToCreate:_0x3f36ba}=await withProgressSpinner('Preparing\x20journeys...',async _0x374e7d=>prepareJourneyFiles(_0x2d442b,{'fetchJourney':async _0x10c583=>_0x90e34a[_0x4ba892(0x1b6)][_0x4ba892(0x1d7)](_0x10c583[_0x4ba892(0x183)]),'journeyBundlesByFolderAndName':_0x2fd3de,'folderPathToId':_0x37b794,'idToEmailMap':_0x2a3062,'connectionIdToNameMap':_0x22d8cf,'existingSegments':_0x4df39e,'parentId':_0x96b819,'deps':_0x90e34a,'progress':{'update':_0x57b06a=>{const _0x1fda5c=_0x4ba892;_0x374e7d[_0x1fda5c(0x158)](_0x57b06a),_0x15101f[_0x1fda5c(0x1a7)]&&console[_0x1fda5c(0x152)]('\x20\x20'+_0x57b06a);}},'journeyById':_0x10d577,'activationStepsById':_0x4f4175},_0x2c27f7,_0x391204),{'verbose':_0x15101f[_0x4ba892(0x1a7)]})[_0x4ba892(0x1ec)](_0x167226=>_0x167226[_0x4ba892(0x1c8)]);for(const _0x11b977 of _0x3f36ba){_0x4c3368['add'](_0x11b977);}const _0x59c006=_0x10e27c?[]:findJourneysToDelete(_0xbbcbe9,_0x2d442b[_0x4ba892(0x150)](({yamlConfig:_0x409dae,folderPath:_0x37d706})=>({'yamlConfig':_0x409dae,'folderPath':resolveTDFolderPath(_0x37d706,_0x2c27f7,_0x391204)})),_0x4f4377,_0x391204,_0x2c27f7),_0x384a2a=calculatePushStats(_0x56be2a,_0x32d1f0,_0x4c3368,_0x542946,_0x59c006,!!_0x15101f[_0x4ba892(0x180)],!!_0x15101f[_0x4ba892(0x1ea)]),_0x45c0a2=_0x384a2a[_0x4ba892(0x159)]['new'],_0x4dc254=_0x384a2a[_0x4ba892(0x159)][_0x4ba892(0x18b)],_0x6a56fb=_0x384a2a[_0x4ba892(0x159)][_0x4ba892(0x1ac)],_0x5b45f1=_0x384a2a[_0x4ba892(0x159)][_0x4ba892(0x1dc)],_0x5ff0e4=_0x384a2a['folders']['toCreate'],_0xae9220=_0x384a2a[_0x4ba892(0x1c6)][_0x4ba892(0x1d8)],_0x3c3066=_0x384a2a[_0x4ba892(0x1c6)]['changed'],_0x5b135f=_0x384a2a[_0x4ba892(0x1c6)][_0x4ba892(0x1ac)],_0x5af782=_0x384a2a[_0x4ba892(0x1c6)][_0x4ba892(0x1dc)],_0x4abe82=_0x384a2a['activations'][_0x4ba892(0x199)],_0x37b5ef=_0x384a2a[_0x4ba892(0x1c7)][_0x4ba892(0x1e3)],_0x43e331=_0x384a2a[_0x4ba892(0x1c7)][_0x4ba892(0x193)],_0x134442=_0x384a2a[_0x4ba892(0x1c7)]['toDelete'];console[_0x4ba892(0x152)](_0x4ba892(0x1bb)+_0x4c169b+'\x27:');_0x5ff0e4['length']>0x0&&console[_0x4ba892(0x152)]('\x20\x20'+a31_0x4c9dba['blue'](_0x4ba892(0x19c)+_0x5ff0e4['length']+_0x4ba892(0x1b1)));if(!_0x15101f[_0x4ba892(0x1ea)]){console['error'](_0x4ba892(0x198)),console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x1e6)]('+\x20'+_0x45c0a2['length']+_0x4ba892(0x164))),console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x1a5)]('~\x20'+_0x4dc254[_0x4ba892(0x19e)]+_0x4ba892(0x1a6)));if(_0x5b45f1['length']>0x0)console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba['red']('-\x20'+_0x5b45f1[_0x4ba892(0x19e)]+'\x20to\x20delete'));else _0x542946[_0x4ba892(0x19e)]>0x0&&!_0x15101f['delete']&&console[_0x4ba892(0x152)]('\x20\x20\x20\x20'+a31_0x4c9dba['dim'](_0x542946[_0x4ba892(0x19e)]+_0x4ba892(0x1d6)));console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x192)]('=\x20'+_0x6a56fb['length']+'\x20unchanged'));}if(_0x32d1f0['length']>0x0||_0x59c006[_0x4ba892(0x19e)]>0x0){console['error'](_0x4ba892(0x188)),console[_0x4ba892(0x152)]('\x20\x20\x20\x20'+a31_0x4c9dba[_0x4ba892(0x1e6)]('+\x20'+_0xae9220[_0x4ba892(0x19e)]+'\x20new')),console['error'](_0x4ba892(0x1cc)+a31_0x4c9dba['yellow']('~\x20'+_0x3c3066['length']+_0x4ba892(0x1a6)));if(_0x5af782[_0x4ba892(0x19e)]>0x0)console['error'](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x1ce)]('-\x20'+_0x5af782['length']+_0x4ba892(0x1aa)));else _0x59c006[_0x4ba892(0x19e)]>0x0&&!_0x15101f[_0x4ba892(0x180)]&&console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x192)](_0x59c006[_0x4ba892(0x19e)]+_0x4ba892(0x1d6)));console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba[_0x4ba892(0x192)]('=\x20'+_0x5b135f[_0x4ba892(0x19e)]+_0x4ba892(0x16e)));}_0x4abe82[_0x4ba892(0x19e)]>0x0&&!_0x15101f['journeysOnly']&&(console[_0x4ba892(0x152)](''),console[_0x4ba892(0x152)]('\x20\x20Activations:'),_0x37b5ef[_0x4ba892(0x19e)]>0x0&&console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba['green']('+\x20'+_0x37b5ef[_0x4ba892(0x19e)]+_0x4ba892(0x1b2))),_0x43e331['length']>0x0&&console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba['yellow']('~\x20'+_0x43e331[_0x4ba892(0x19e)]+'\x20to\x20update')),_0x134442['length']>0x0&&console[_0x4ba892(0x152)](_0x4ba892(0x1cc)+a31_0x4c9dba['red']('-\x20'+_0x134442[_0x4ba892(0x19e)]+_0x4ba892(0x1aa))));console[_0x4ba892(0x152)]('\x20\x20Source:\x20'+a31_0x4c9dba[_0x4ba892(0x151)](_0x4493e2)+'\x0a');if(_0x5ff0e4[_0x4ba892(0x19e)]>0x0){console['error'](_0x4ba892(0x15c));for(const _0x19806a of _0x5ff0e4){console[_0x4ba892(0x152)]('\x20\x20'+a31_0x4c9dba['blue']('+')+'\x20'+_0x19806a);}console[_0x4ba892(0x152)]('');}if(_0x45c0a2[_0x4ba892(0x19e)]>0x0&&!_0x15101f[_0x4ba892(0x1ea)])for(const _0x351215 of _0x45c0a2){const _0x356718=_0x351215['folderPath']?_0x351215[_0x4ba892(0x169)]+'/'+_0x351215['yamlConfig'][_0x4ba892(0x1ee)]:_0x351215['yamlConfig']['name'],_0x560787=_0x351215[_0x4ba892(0x160)][_0x4ba892(0x1c7)]?.[_0x4ba892(0x19e)]||0x0,_0x43f3ae=_0x560787>0x0?a31_0x4c9dba[_0x4ba892(0x192)]('\x20['+_0x560787+_0x4ba892(0x1d0)):'';console[_0x4ba892(0x152)]('\x0a'+a31_0x4c9dba[_0x4ba892(0x1e6)](_0x4ba892(0x182))+'\x20'+_0x356718+_0x43f3ae),console[_0x4ba892(0x152)]('β'[_0x4ba892(0x1eb)](0x3c)),_0x351215['diff']&&console['error'](_0x351215[_0x4ba892(0x19d)]),console[_0x4ba892(0x152)]('β'[_0x4ba892(0x1eb)](0x3c));}if(_0x5b45f1[_0x4ba892(0x19e)]>0x0&&!_0x15101f['journeysOnly'])for(const _0x3cb4b8 of _0x5b45f1){const _0x3481c9=_0x3cb4b8[_0x4ba892(0x19b)]?_0x4f4377[_0x4ba892(0x1c0)](_0x3cb4b8[_0x4ba892(0x19b)][_0x4ba892(0x17b)]())||'':'',_0x26bc72=_0x3481c9?_0x3481c9+'/'+_0x3cb4b8[_0x4ba892(0x1ee)]:_0x3cb4b8[_0x4ba892(0x1ee)],_0x437cd5=_0x4b71d3[_0x4ba892(0x1c0)](_0x3cb4b8['id'])||[],_0x57b480=_0x437cd5[_0x4ba892(0x19e)]>0x0?a31_0x4c9dba[_0x4ba892(0x192)]('\x20['+_0x437cd5['length']+_0x4ba892(0x1d0)):'';console[_0x4ba892(0x152)]('\x0a'+a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x195))+'\x20'+_0x26bc72+_0x57b480),console['error']('β'[_0x4ba892(0x1eb)](0x3c));const _0x361450=segmentWithActivationsToYaml(_0x3cb4b8,_0x437cd5,undefined,_0x2a3062,_0x22d8cf),_0x1e12f7=segmentToYamlString(_0x361450),_0x5ab3d9=generateDiff(_0x1e12f7,'');console[_0x4ba892(0x152)](formatDiffWithColors(_0x5ab3d9)),console['error']('β'[_0x4ba892(0x1eb)](0x3c));}const _0x525eb0=_0x56be2a[_0x4ba892(0x194)](_0x2be17d=>!_0x2be17d[_0x4ba892(0x1d2)]&&_0x2be17d[_0x4ba892(0x19d)]);if(_0x525eb0['length']>0x0&&!_0x15101f['journeysOnly'])for(const _0x260f8e of _0x525eb0){const _0x2403c6=_0x260f8e[_0x4ba892(0x169)]?_0x260f8e[_0x4ba892(0x169)]+'/'+_0x260f8e['yamlConfig'][_0x4ba892(0x1ee)]:_0x260f8e[_0x4ba892(0x160)][_0x4ba892(0x1ee)];console[_0x4ba892(0x152)]('\x0a'+a31_0x4c9dba[_0x4ba892(0x1a5)](_0x4ba892(0x1c9))+'\x20'+_0x2403c6),console[_0x4ba892(0x152)]('β'[_0x4ba892(0x1eb)](0x3c)),console['error'](_0x260f8e[_0x4ba892(0x19d)]),console[_0x4ba892(0x152)]('β'['repeat'](0x3c));}if(_0xae9220[_0x4ba892(0x19e)]>0x0)for(const _0x4361f0 of _0xae9220){const _0x1139f7=_0x4361f0[_0x4ba892(0x169)]?_0x4361f0[_0x4ba892(0x169)]+'/'+_0x4361f0['yamlConfig'][_0x4ba892(0x1ee)]:_0x4361f0[_0x4ba892(0x160)][_0x4ba892(0x1ee)];console[_0x4ba892(0x152)]('\x0a'+a31_0x4c9dba['green']('New\x20journey:')+'\x20'+_0x1139f7),console[_0x4ba892(0x152)]('β'[_0x4ba892(0x1eb)](0x3c)),_0x4361f0[_0x4ba892(0x19d)]&&console[_0x4ba892(0x152)](_0x4361f0[_0x4ba892(0x19d)]),console[_0x4ba892(0x152)]('β'['repeat'](0x3c));}const _0x2c3f58=_0x32d1f0[_0x4ba892(0x194)](_0x234f5c=>!_0x234f5c['isNew']&&_0x234f5c[_0x4ba892(0x19d)]);if(_0x2c3f58['length']>0x0)for(const _0xbe23a1 of _0x2c3f58){const _0xd21bea=_0xbe23a1[_0x4ba892(0x169)]?_0xbe23a1[_0x4ba892(0x169)]+'/'+_0xbe23a1[_0x4ba892(0x160)][_0x4ba892(0x1ee)]:_0xbe23a1[_0x4ba892(0x160)][_0x4ba892(0x1ee)];console['error']('\x0a'+a31_0x4c9dba[_0x4ba892(0x1a5)]('Changes\x20to\x20journey:')+'\x20'+_0xd21bea),console['error']('β'[_0x4ba892(0x1eb)](0x3c)),console[_0x4ba892(0x152)](_0xbe23a1[_0x4ba892(0x19d)]),console[_0x4ba892(0x152)]('β'[_0x4ba892(0x1eb)](0x3c));}if(_0x5af782['length']>0x0)for(const _0x2c1074 of _0x5af782){const _0x3f69c6=_0x2c1074[_0x4ba892(0x167)]?_0x4f4377[_0x4ba892(0x1c0)](_0x2c1074['folderId'])||'':'',_0x5d5e88=_0x3f69c6?_0x3f69c6+'/'+_0x2c1074[_0x4ba892(0x1cd)]:_0x2c1074[_0x4ba892(0x1cd)];console[_0x4ba892(0x152)]('\x0a'+a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x19a))+'\x20'+_0x5d5e88),console['error']('β'[_0x4ba892(0x1eb)](0x3c)),console[_0x4ba892(0x152)](a31_0x4c9dba['red'](_0x4ba892(0x156))),console['error']('β'[_0x4ba892(0x1eb)](0x3c));}if(_0x15101f[_0x4ba892(0x18c)])return console['error'](a31_0x4c9dba[_0x4ba892(0x1a5)](_0x4ba892(0x189))),0x0;const _0x9ef00c=_0x15101f[_0x4ba892(0x1ea)]?![]:_0x45c0a2[_0x4ba892(0x19e)]>0x0||_0x4dc254['length']>0x0||_0x5b45f1[_0x4ba892(0x19e)]>0x0,_0x260fc9=_0xae9220[_0x4ba892(0x19e)]>0x0||_0x3c3066[_0x4ba892(0x19e)]>0x0||_0x5af782[_0x4ba892(0x19e)]>0x0,_0x2aef11=_0x15101f[_0x4ba892(0x1ea)]?![]:_0x4abe82[_0x4ba892(0x19e)]>0x0,_0x72bb20=_0x5ff0e4[_0x4ba892(0x19e)]>0x0;if(!_0x9ef00c&&!_0x260fc9&&!_0x2aef11&&!_0x72bb20){const _0x5987ed=_0x15101f['journeysOnly']?_0x4ba892(0x1bf):_0x4ba892(0x1da);console['error'](a31_0x4c9dba[_0x4ba892(0x1e6)](_0x5987ed));if(_0x10e27c&&_0x5b135f[_0x4ba892(0x19e)]===0x1){const _0x170e9a=_0x5b135f[0x0];if(_0x170e9a[_0x4ba892(0x172)]?.['id']){const _0x4319f6=getConsoleNextUrl(_0x15101f[_0x4ba892(0x1b9)],_0x4ba892(0x1de)+_0x96b819+_0x4ba892(0x154)+_0x170e9a[_0x4ba892(0x172)]['id']+_0x4ba892(0x1ba));console['error']('\x20\x20'+a31_0x4c9dba[_0x4ba892(0x151)](_0x4319f6));}}return 0x0;}const _0x5ceb86=_0x15101f[_0x4ba892(0x1ea)]?_0xae9220[_0x4ba892(0x19e)]+_0x3c3066[_0x4ba892(0x19e)]+_0x5af782[_0x4ba892(0x19e)]+_0x5ff0e4[_0x4ba892(0x19e)]:_0x45c0a2[_0x4ba892(0x19e)]+_0x4dc254['length']+_0x5b45f1[_0x4ba892(0x19e)]+_0xae9220['length']+_0x3c3066['length']+_0x5af782['length']+_0x5ff0e4['length']+_0x4abe82[_0x4ba892(0x19e)];if(!_0x15101f[_0x4ba892(0x1ca)]&&_0x5ceb86>0x0){if(!isInteractive())return console['error'](a31_0x4c9dba[_0x4ba892(0x1ce)](_0x4ba892(0x18d)),_0x4ba892(0x1d5)),console['error'](a31_0x4c9dba[_0x4ba892(0x192)](_0x4ba892(0x1af))),0x1;const _0xc4d7f=await confirmKey(_0x4ba892(0x1bd)+_0x5ceb86+_0x4ba892(0x1c5));if(!_0xc4d7f)return console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1a5)]('Aborted.')),0x1;}const _0x3b1a97={'withProgress':async(_0xc3c068,_0x3e74d9)=>{const _0x5a8e8=_0x4ba892,_0x530cbd=await withSpinner(_0xc3c068,_0x3e74d9,{'verbose':_0x15101f[_0x5a8e8(0x1a7)]});return{'data':_0x530cbd['data']};},'logInfo':_0x20cfa5=>console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1c1)]('β\x20'+_0x20cfa5)),'logSuccess':_0x4c66ed=>console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1e6)]('β\x20'+_0x4c66ed)),'logWarning':_0x239419=>console[_0x4ba892(0x152)](a31_0x4c9dba['yellow']('β \x20'+_0x239419)),'logDeleted':_0x5227ee=>console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1ce)]('β\x20'+_0x5227ee))},_0x3b5533={'segment':_0x90e34a[_0x4ba892(0x18e)],'journey':_0x90e34a[_0x4ba892(0x1b6)],'user':_0x90e34a['user'],'connection':_0x90e34a[_0x4ba892(0x17e)]};_0x5ff0e4['length']>0x0&&(_0x37b794=await executePushFolders(_0x3b5533,_0x5ff0e4,_0x37b794,{'parentId':_0x96b819},_0x3b1a97));const _0x3f0628={'rootFolderId':_0x3e1bba,'folderPathToId':_0x37b794,'folderIdToPath':_0x4f4377,'segmentNameToId':_0x4246d9,'activationsBySegmentId':_0x4b71d3,'emailToIdMap':_0x325468,'idToEmailMap':_0x2a3062,'connectionNameToIdMap':_0x405b63[_0x4ba892(0x1a3)],'connectionIdToNameMap':_0x405b63[_0x4ba892(0x1d3)],'connectionNameToTypeMap':_0x2e9d5a},_0x422cf4=await executePushSegments(_0x3b5533,_0x15101f[_0x4ba892(0x1ea)]?[]:_0x56be2a,_0x3f0628,{'parentId':_0x96b819},_0x3b1a97),_0x51c1c3=_0x422cf4['created'],_0x31ceb3=_0x422cf4[_0x4ba892(0x185)],_0x59d021=_0x422cf4[_0x4ba892(0x1c7)][_0x4ba892(0x190)],_0x461cb3=_0x422cf4[_0x4ba892(0x1c7)][_0x4ba892(0x185)],_0x517b23=_0x422cf4[_0x4ba892(0x1c7)][_0x4ba892(0x178)],_0x2d33ba=await executePushSegmentDeletions(_0x3b5533,_0x15101f[_0x4ba892(0x1ea)]?[]:_0x5b45f1,_0x3b1a97);let _0x50599d=0x0,_0xa0920f=0x0,_0x5b7bd7=0x0;const _0x3433b1=new Map(_0x4246d9);for(const [_0x3cd24f,_0x590fe0]of _0x422cf4[_0x4ba892(0x1e0)]){_0x3433b1[_0x4ba892(0x1e1)](_0x3cd24f,_0x590fe0);}if(_0x32d1f0[_0x4ba892(0x19e)]>0x0){const _0x1fb639={..._0x3f0628,'segmentNameToId':_0x3433b1,'existingSegments':_0x4df39e,'activationContext':_0x297677},_0x228f1=await executePushJourneys(_0x3b5533,_0x32d1f0,_0x1fb639,{'parentId':_0x96b819,'rootFolderId':_0x3e1bba,'verbose':_0x15101f[_0x4ba892(0x1a7)]},_0x3b1a97);_0x50599d=_0x228f1[_0x4ba892(0x190)],_0xa0920f=_0x228f1['updated'];if(_0x10e27c&&_0x228f1[_0x4ba892(0x168)][_0x4ba892(0x19e)]===0x1){const _0x76c0aa=_0x228f1['results'][0x0];if(_0x76c0aa[_0x4ba892(0x183)]){const _0x7a4d59=getConsoleNextUrl(_0x15101f[_0x4ba892(0x1b9)],_0x4ba892(0x1de)+_0x96b819+_0x4ba892(0x154)+_0x76c0aa[_0x4ba892(0x183)]+_0x4ba892(0x1ba));console['error']('\x20\x20'+a31_0x4c9dba[_0x4ba892(0x151)](_0x7a4d59));}}}for(const _0x5db254 of _0x5af782){console[_0x4ba892(0x152)](a31_0x4c9dba[_0x4ba892(0x1a5)](_0x4ba892(0x1c3)+_0x5db254['journeyBundleName'])),_0x5b7bd7++;}const _0x3a1919=[];if(_0x51c1c3>0x0)_0x3a1919[_0x4ba892(0x1cf)](_0x51c1c3+_0x4ba892(0x161));if(_0x31ceb3>0x0)_0x3a1919['push'](_0x31ceb3+_0x4ba892(0x18a));if(_0x2d33ba>0x0)_0x3a1919[_0x4ba892(0x1cf)](_0x2d33ba+_0x4ba892(0x1c2));const _0x1c8506=[];if(_0x50599d>0x0)_0x1c8506[_0x4ba892(0x1cf)](_0x50599d+_0x4ba892(0x161));if(_0xa0920f>0x0)_0x1c8506[_0x4ba892(0x1cf)](_0xa0920f+_0x4ba892(0x18a));if(_0x5b7bd7>0x0)_0x1c8506[_0x4ba892(0x1cf)](_0x5b7bd7+_0x4ba892(0x1c2));const _0x285130=[];if(_0x59d021>0x0)_0x285130[_0x4ba892(0x1cf)](_0x59d021+_0x4ba892(0x161));if(_0x461cb3>0x0)_0x285130['push'](_0x461cb3+_0x4ba892(0x18a));if(_0x517b23>0x0)_0x285130[_0x4ba892(0x1cf)](_0x517b23+_0x4ba892(0x1c2));return console['error'](a31_0x4c9dba[_0x4ba892(0x1e6)]('\x0aβ\x20Push\x20complete')),_0x3a1919[_0x4ba892(0x19e)]>0x0&&!_0x15101f[_0x4ba892(0x1ea)]&&console[_0x4ba892(0x152)](_0x4ba892(0x196)+_0x3a1919[_0x4ba892(0x1b8)](',\x20')),_0x1c8506[_0x4ba892(0x19e)]>0x0&&console['error'](_0x4ba892(0x15f)+_0x1c8506[_0x4ba892(0x1b8)](',\x20')),_0x285130[_0x4ba892(0x19e)]>0x0&&!_0x15101f[_0x4ba892(0x1ea)]&&console[_0x4ba892(0x152)](_0x4ba892(0x1cb)+_0x285130[_0x4ba892(0x1b8)](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x3323a9=a31_0x3b7d;(function(_0x5c0fa9,_0x952f6f){const _0x5d1d18=a31_0x3b7d,_0xc177ad=_0x5c0fa9();while(!![]){try{const _0x5500e3=-parseInt(_0x5d1d18(0x1e0))/0x1+-parseInt(_0x5d1d18(0x1a3))/0x2*(-parseInt(_0x5d1d18(0x1a6))/0x3)+parseInt(_0x5d1d18(0x1f0))/0x4*(-parseInt(_0x5d1d18(0x1c6))/0x5)+parseInt(_0x5d1d18(0x1ae))/0x6+-parseInt(_0x5d1d18(0x1f3))/0x7*(-parseInt(_0x5d1d18(0x1c9))/0x8)+-parseInt(_0x5d1d18(0x161))/0x9+parseInt(_0x5d1d18(0x1d6))/0xa*(parseInt(_0x5d1d18(0x1b2))/0xb);if(_0x5500e3===_0x952f6f)break;else _0xc177ad['push'](_0xc177ad['shift']());}catch(_0x11371e){_0xc177ad['push'](_0xc177ad['shift']());}}}(a31_0x2ab7,0x371d9));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';function a31_0x2ab7(){const _0x574c54=['map','journeyBundleName','353534AmhUbs','join','Changes\x20to:','6QayqHH','\x20to\x20delete','parentSegment','isScoped','(Journey\x20will\x20be\x20deleted)','resolveParentId','error','endsWith','1877880hVyvgi','existingJourney','diff','toCreate','11MkHRNw','\x20\x20Activations:\x20','new','user','\x20deleted','Changes\x20to\x20journey:','\x20to\x20create','blue','journeys','unchanged','Delete\x20segment:','message','execute','Fetching\x20existing\x20segments...','targetDir','connection','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','segment:push','all','/app/ps/','5cArDok','listSegments','\x0aPush\x20summary\x20for\x20\x27','2193376kfcWSO','\x20\x20Source:\x20','\x20created','Fetching\x20parent\x20segment\x20details...','dryRun','β\x20All\x20journeys\x20are\x20up\x20to\x20date','nameToType','\x20unchanged','toDelete','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','length','\x20activations]','getParent','90260HEvHkn','listJourneysWithDetailsFromParentSegment','\x20\x20π\x20Segments:','π\x20','add','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','listFolders','isNew','\x20YAML\x20files\x20found','description','338252tcQaQF','\x0aβ\x20Push\x20complete','\x20\x20Journeys:\x20','parentName','folderId','name','updatedAt','site','results','cyan','/j/da/je','no_parent','type','\x20\x20Segments:\x20','Fetching\x20connections\x20for\x20name\x20resolution...','relationships','71488AluMHo','Parent\x20segment:\x20','Delete\x20journey:','7MwemBh','\x20folders\x20to\x20create','green','\x20changed','segments','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','dim','delete','getJourney','3310515VJMmxx','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','red','Resolving\x20parent\x20segment\x20\x27','parentFolder','Folders\x20to\x20create:','idToName','attributes','Site:\x20','list','/e/','journey','folders','scopedFolderPath','set','\x0aError:','\x20updated','Source\x20directory:\x20','segment\x20or\x20journey','push','repeat','deleted','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','errorCode','\x0aValidation\x20failed:','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','created','folderPath','state','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','paused','createdSegmentIds','getOutputSchemaWithCache','verbose','\x20new','then','\x20\x20\x20\x20','Scoped\x20to\x20folder:\x20','segmentFolderId','\x20\x20Activations:','Error:\x20Directory\x20not\x20found:\x20','get','journeysOnly','Fetching\x20existing\x20activations...','updated','\x20changes?','activations','yamlConfig','parent_name','filePath','New\x20segment:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','nameToId','changed','helpText','segment','journeyId','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','yellow','Error\x20parsing\x20YAML:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','data','filter','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files'];a31_0x2ab7=function(){return _0x574c54;};return a31_0x2ab7();}import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x25be58 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a31_0x3b7d(_0x2f8471,_0x5e5597){_0x2f8471=_0x2f8471-0x15d;const _0x2ab72f=a31_0x2ab7();let _0x3b7dec=_0x2ab72f[_0x2f8471];return _0x3b7dec;}import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a31_0x3323a9(0x1c3);[a31_0x3323a9(0x1df)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a31_0x3323a9(0x1be)](_0x25c001){const _0x15b353=a31_0x3323a9,{options:_0x387222,args:_0xe1b6e9,tdx:_0x4ba8e1}=_0x25c001,_0x4801f1=_0x387222,_0x118b16=await resolveTarget({'arg':_0xe1b6e9[0x0],'contextParent':_0x387222[_0x15b353(0x1a8)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x118b16))return _0x118b16[_0x15b353(0x178)]===_0x15b353(0x1eb)?(console['error'](a31_0x25be58['yellow'](_0x15b353(0x177))),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[_0x15b353(0x1ac)](_0x15b353(0x1d2)),console[_0x15b353(0x1ac)](_0x15b353(0x162))):(console[_0x15b353(0x1ac)](a31_0x25be58['red']('Error:\x20'+_0x118b16['message']+'\x0a')),_0x118b16[_0x15b353(0x197)]&&console[_0x15b353(0x1ac)](a31_0x25be58['cyan'](_0x118b16['helpText']))),0x1;if(_0x118b16[_0x15b353(0x1ec)]===_0x15b353(0x191))return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x189)+_0x118b16[_0x15b353(0x1c0)]+'\x0a')),console['error'](a31_0x25be58[_0x15b353(0x1e9)](_0x15b353(0x15d))),0x1;const _0x4ad6ed=_0x118b16[_0x15b353(0x1e3)],_0x34316a=_0x118b16[_0x15b353(0x1c0)],_0x4887b8=_0x118b16[_0x15b353(0x1ec)]==='file'?_0x118b16[_0x15b353(0x192)]:undefined,_0x1db646=getScopedDetails(_0x118b16),_0x5175ed=_0x1db646?.[_0x15b353(0x1a9)]??![],_0x10e5b6=_0x1db646?.[_0x15b353(0x16e)]??'';if(!existsSync(_0x34316a))return console['error'](a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x189)+_0x34316a+'\x0a')),console[_0x15b353(0x1ac)](a31_0x25be58['cyan'](_0x15b353(0x15d))),0x1;_0x4801f1[_0x15b353(0x182)]&&(console[_0x15b353(0x1ac)](_0x15b353(0x169)+_0x4801f1[_0x15b353(0x1e7)]),console[_0x15b353(0x1ac)](_0x15b353(0x1f1)+_0x4ad6ed),console[_0x15b353(0x1ac)](_0x15b353(0x172)+_0x34316a),_0x5175ed&&console['error'](_0x15b353(0x186)+_0x10e5b6));const _0x65f3=await withSpinner(_0x15b353(0x164)+_0x4ad6ed+'\x27...',()=>_0x4ba8e1[_0x15b353(0x198)][_0x15b353(0x1ab)](_0x4ad6ed),{'verbose':_0x4801f1['verbose']}),_0x4ebe42=_0x65f3[_0x15b353(0x19e)],[_0x4514a2,_0x27dc4b,_0xa7f382,_0x5b1274,_0x47e630]=await Promise[_0x15b353(0x1c4)]([withSpinner(_0x15b353(0x1cc),()=>_0x4ba8e1['segment'][_0x15b353(0x1d5)](_0x4ebe42),{'verbose':_0x4801f1['verbose']}),withSpinner(_0x15b353(0x1bf),()=>_0x4ba8e1['segment'][_0x15b353(0x1c7)](_0x4ebe42),{'verbose':_0x4801f1[_0x15b353(0x182)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x4ba8e1['segment'][_0x15b353(0x1dc)](_0x4ebe42),{'verbose':_0x4801f1['verbose']}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x4ba8e1[_0x15b353(0x16c)][_0x15b353(0x1d7)](_0x4ebe42,{'includeAllVersions':!![]}),{'verbose':_0x4801f1[_0x15b353(0x182)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x4ba8e1[_0x15b353(0x1b5)]['buildUserMaps'](),{'verbose':_0x4801f1['verbose']})[_0x15b353(0x184)](_0x2423f4=>_0x2423f4['data'])]),_0x19285b=_0x4514a2[_0x15b353(0x19e)],_0x2e3279=extractRootFolderId(_0x19285b),_0x42e063=_0x27dc4b[_0x15b353(0x19e)],_0xdf6bec=_0xa7f382[_0x15b353(0x19e)],{journeys:_0x239122,activationStepsById:_0x297cfb}=_0x5b1274[_0x15b353(0x19e)],_0x2b6317=new Map(_0x239122['map'](_0x27a5a1=>[_0x27a5a1['id'],_0x27a5a1])),_0x2b98c2=_0x239122[_0x15b353(0x1a1)](_0x1dc8b7=>({'id':_0x1dc8b7['id'],'name':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x1e5)],'journeyBundleName':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x1a2)]||'','journeyBundleId':_0x1dc8b7[_0x15b353(0x168)]['journeyBundleId']||'','versionNumber':_0x1dc8b7['attributes']['versionNumber'],'description':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x1df)],'state':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x17d)],'paused':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x17f)],'audienceId':_0x1dc8b7[_0x15b353(0x168)]['audienceId'],'folderId':_0x1dc8b7[_0x15b353(0x1ef)]?.[_0x15b353(0x165)]?.['data']?.['id'],'createdAt':_0x1dc8b7[_0x15b353(0x168)]['createdAt'],'updatedAt':_0x1dc8b7[_0x15b353(0x168)][_0x15b353(0x1e6)]})),{emailToId:_0x475194,idToEmail:_0x358bfd}=_0x47e630,_0x843710=await withSpinner(_0x15b353(0x1ee),async()=>{const _0x2f8fc2=_0x15b353,_0x339e02=await _0x4ba8e1[_0x2f8fc2(0x1c1)][_0x2f8fc2(0x16a)]();return buildConnectionMaps(_0x339e02);},{'verbose':_0x4801f1[_0x15b353(0x182)]})[_0x15b353(0x184)](_0x559737=>_0x559737[_0x15b353(0x19e)]),_0x2a2a1d=_0x843710[_0x15b353(0x195)],_0x28f222=_0x843710[_0x15b353(0x167)],_0x1ef43a=_0x843710[_0x15b353(0x1cf)],_0x2f7a74={'emailToIdMap':_0x475194,'connectionNameToIdMap':_0x2a2a1d,'connectionNameToTypeMap':_0x1ef43a,'getSchema':_0x48ec09=>_0x4ba8e1[_0x15b353(0x1c1)][_0x15b353(0x181)](_0x48ec09)};let {pathToId:_0x2d8c86,idToPath:_0x1a87be}=buildFolderMaps(_0xdf6bec);const _0x9e8ac2=buildSegmentLookupMap(_0x42e063,_0x1a87be),_0xc20188=buildSegmentNameToIdMap(_0x42e063),_0x1dee1c=buildJourneyBundleLookupMap(_0x2b98c2,_0x1a87be);let _0x8bbde5;if(_0x4887b8){if(!_0x4887b8[_0x15b353(0x1ad)]('.yml')&&!_0x4887b8[_0x15b353(0x1ad)]('.yaml'))return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x4887b8+'\x0a')),0x1;_0x8bbde5=[_0x4887b8];}else _0x8bbde5=findYamlFiles(_0x34316a);if(_0x8bbde5[_0x15b353(0x1d3)]===0x0)return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x34316a+'\x0a')),console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x1e9)](_0x15b353(0x1a0))),0x1;let _0x767419,_0x800ed5;try{const _0x490b6b=parseAndClassifyYamlFiles(_0x8bbde5,_0x34316a,{'skipSegments':_0x4801f1['journeysOnly']});_0x767419=_0x490b6b[_0x15b353(0x1f7)],_0x800ed5=_0x490b6b[_0x15b353(0x1ba)];const _0x339a05=validateParsedFiles(_0x490b6b,_0x34316a);if(_0x339a05['length']>0x0)return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x179))),console[_0x15b353(0x1ac)](formatValidationErrors(_0x339a05)),console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x19b)](_0x15b353(0x1c2))),0x1;}catch(_0x44c632){return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x19c)+(_0x44c632 instanceof Error?_0x44c632[_0x15b353(0x1bd)]:_0x44c632))),0x1;}if(_0x767419[_0x15b353(0x1d3)]===0x0&&_0x800ed5[_0x15b353(0x1d3)]===0x0){const _0x5cab2d=_0x4801f1[_0x15b353(0x18b)]?_0x15b353(0x16c):_0x15b353(0x173);return console['error'](a31_0x25be58['yellow']('No\x20'+_0x5cab2d+_0x15b353(0x1de))),0x0;}const _0x36af98=new Map();_0x42e063[_0x15b353(0x1d3)]>0x0&&!_0x4801f1['journeysOnly']&&await withSpinner(_0x15b353(0x18c),async()=>{await batchAsync(_0x42e063,async _0x18e991=>{const _0x853eb2=await _0x4ba8e1['segment']['listActivations'](_0x4ebe42,_0x18e991['id']);_0x36af98['set'](_0x18e991['id'],_0x853eb2);});},{'verbose':_0x4801f1[_0x15b353(0x182)]});const {segmentFiles:_0x319fe4,foldersToCreate:_0x1e98fa}=await prepareSegmentFiles(_0x767419,{'segmentByFolderAndName':_0x9e8ac2,'activationsBySegmentId':_0x36af98,'folderPathToId':_0x2d8c86,'idToEmailMap':_0x358bfd,'connectionIdToNameMap':_0x28f222},_0x2f7a74,_0x5175ed,_0x10e5b6),_0x503bd=_0x4887b8?[]:findSegmentsToDelete(_0x42e063,_0x767419['map'](({yamlConfig:_0x3ea396,folderPath:_0x14c194})=>({'yamlConfig':_0x3ea396,'folderPath':resolveTDFolderPath(_0x14c194,_0x5175ed,_0x10e5b6)})),_0x1a87be,_0x10e5b6,_0x5175ed),{journeyFiles:_0x79efc5,foldersToCreate:_0x5420fc}=await withProgressSpinner('Preparing\x20journeys...',async _0x530da5=>prepareJourneyFiles(_0x800ed5,{'fetchJourney':async _0x4e2cb1=>_0x4ba8e1[_0x15b353(0x16c)][_0x15b353(0x160)](_0x4e2cb1[_0x15b353(0x199)]),'journeyBundlesByFolderAndName':_0x1dee1c,'folderPathToId':_0x2d8c86,'idToEmailMap':_0x358bfd,'connectionIdToNameMap':_0x28f222,'existingSegments':_0x42e063,'parentId':_0x4ebe42,'deps':_0x4ba8e1,'progress':{'update':_0x3bd232=>{const _0x19548d=_0x15b353;_0x530da5['setPhase'](_0x3bd232),_0x4801f1['verbose']&&console[_0x19548d(0x1ac)]('\x20\x20'+_0x3bd232);}},'journeyById':_0x2b6317,'activationStepsById':_0x297cfb},_0x5175ed,_0x10e5b6),{'verbose':_0x4801f1[_0x15b353(0x182)]})[_0x15b353(0x184)](_0x1ecc4d=>_0x1ecc4d[_0x15b353(0x19e)]);for(const _0x30eee8 of _0x5420fc){_0x1e98fa[_0x15b353(0x1da)](_0x30eee8);}const _0x517932=_0x4887b8?[]:findJourneysToDelete(_0x2b98c2,_0x800ed5[_0x15b353(0x1a1)](({yamlConfig:_0x40caf2,folderPath:_0x443eba})=>({'yamlConfig':_0x40caf2,'folderPath':resolveTDFolderPath(_0x443eba,_0x5175ed,_0x10e5b6)})),_0x1a87be,_0x10e5b6,_0x5175ed),_0x4be579=calculatePushStats(_0x319fe4,_0x79efc5,_0x1e98fa,_0x503bd,_0x517932,!!_0x4801f1[_0x15b353(0x15f)],!!_0x4801f1[_0x15b353(0x18b)]),_0x533c23=_0x4be579[_0x15b353(0x1f7)][_0x15b353(0x1b4)],_0x11fa30=_0x4be579[_0x15b353(0x1f7)]['changed'],_0x115a20=_0x4be579[_0x15b353(0x1f7)][_0x15b353(0x1bb)],_0x353c73=_0x4be579[_0x15b353(0x1f7)]['toDelete'],_0x38a9c5=_0x4be579[_0x15b353(0x16d)][_0x15b353(0x1b1)],_0x1e398b=_0x4be579[_0x15b353(0x1ba)]['new'],_0x389b0d=_0x4be579[_0x15b353(0x1ba)][_0x15b353(0x196)],_0x26dd48=_0x4be579['journeys'][_0x15b353(0x1bb)],_0x3eb7b9=_0x4be579[_0x15b353(0x1ba)][_0x15b353(0x1d1)],_0xb798ac=_0x4be579['activations']['all'],_0x58244f=_0x4be579['activations'][_0x15b353(0x1b1)],_0x3673a3=_0x4be579['activations']['toUpdate'],_0x401d5b=_0x4be579[_0x15b353(0x18f)][_0x15b353(0x1d1)];console[_0x15b353(0x1ac)](_0x15b353(0x1c8)+_0x4ad6ed+'\x27:');_0x38a9c5[_0x15b353(0x1d3)]>0x0&&console[_0x15b353(0x1ac)]('\x20\x20'+a31_0x25be58[_0x15b353(0x1b9)](_0x15b353(0x1d9)+_0x38a9c5['length']+_0x15b353(0x1f4)));if(!_0x4801f1[_0x15b353(0x18b)]){console[_0x15b353(0x1ac)](_0x15b353(0x1d8)),console['error'](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x1f5)]('+\x20'+_0x533c23['length']+_0x15b353(0x183))),console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x19b)]('~\x20'+_0x11fa30[_0x15b353(0x1d3)]+_0x15b353(0x1f6)));if(_0x353c73[_0x15b353(0x1d3)]>0x0)console[_0x15b353(0x1ac)]('\x20\x20\x20\x20'+a31_0x25be58[_0x15b353(0x163)]('-\x20'+_0x353c73[_0x15b353(0x1d3)]+'\x20to\x20delete'));else _0x503bd[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x15f)]&&console['error']('\x20\x20\x20\x20'+a31_0x25be58[_0x15b353(0x15e)](_0x503bd[_0x15b353(0x1d3)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x15b353(0x1ac)]('\x20\x20\x20\x20'+a31_0x25be58[_0x15b353(0x15e)]('=\x20'+_0x115a20['length']+'\x20unchanged'));}if(_0x79efc5[_0x15b353(0x1d3)]>0x0||_0x517932[_0x15b353(0x1d3)]>0x0){console['error']('\x20\x20πΊοΈ\x20\x20Journeys:'),console[_0x15b353(0x1ac)]('\x20\x20\x20\x20'+a31_0x25be58[_0x15b353(0x1f5)]('+\x20'+_0x1e398b[_0x15b353(0x1d3)]+_0x15b353(0x183))),console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x19b)]('~\x20'+_0x389b0d[_0x15b353(0x1d3)]+'\x20changed'));if(_0x3eb7b9[_0x15b353(0x1d3)]>0x0)console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x163)]('-\x20'+_0x3eb7b9[_0x15b353(0x1d3)]+_0x15b353(0x1a7)));else _0x517932[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x15f)]&&console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x15e)](_0x517932['length']+_0x15b353(0x17a)));console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58['dim']('=\x20'+_0x26dd48[_0x15b353(0x1d3)]+_0x15b353(0x1d0)));}_0xb798ac['length']>0x0&&!_0x4801f1['journeysOnly']&&(console['error'](''),console[_0x15b353(0x1ac)](_0x15b353(0x188)),_0x58244f[_0x15b353(0x1d3)]>0x0&&console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58['green']('+\x20'+_0x58244f['length']+_0x15b353(0x1b8))),_0x3673a3['length']>0x0&&console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58[_0x15b353(0x19b)]('~\x20'+_0x3673a3[_0x15b353(0x1d3)]+'\x20to\x20update')),_0x401d5b[_0x15b353(0x1d3)]>0x0&&console[_0x15b353(0x1ac)](_0x15b353(0x185)+a31_0x25be58['red']('-\x20'+_0x401d5b[_0x15b353(0x1d3)]+'\x20to\x20delete')));console[_0x15b353(0x1ac)](_0x15b353(0x1ca)+a31_0x25be58[_0x15b353(0x1e9)](_0x34316a)+'\x0a');if(_0x38a9c5[_0x15b353(0x1d3)]>0x0){console['error'](_0x15b353(0x166));for(const _0x561d6c of _0x38a9c5){console['error']('\x20\x20'+a31_0x25be58['blue']('+')+'\x20'+_0x561d6c);}console[_0x15b353(0x1ac)]('');}if(_0x533c23[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x18b)])for(const _0x178059 of _0x533c23){const _0x5f19ad=_0x178059['folderPath']?_0x178059['folderPath']+'/'+_0x178059[_0x15b353(0x190)]['name']:_0x178059[_0x15b353(0x190)]['name'],_0x29c26b=_0x178059['yamlConfig'][_0x15b353(0x18f)]?.[_0x15b353(0x1d3)]||0x0,_0x5e5996=_0x29c26b>0x0?a31_0x25be58[_0x15b353(0x15e)]('\x20['+_0x29c26b+_0x15b353(0x1d4)):'';console[_0x15b353(0x1ac)]('\x0a'+a31_0x25be58[_0x15b353(0x1f5)](_0x15b353(0x193))+'\x20'+_0x5f19ad+_0x5e5996),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c)),_0x178059[_0x15b353(0x1b0)]&&console[_0x15b353(0x1ac)](_0x178059[_0x15b353(0x1b0)]),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c));}if(_0x353c73[_0x15b353(0x1d3)]>0x0&&!_0x4801f1['journeysOnly'])for(const _0x2012d5 of _0x353c73){const _0x3efbb6=_0x2012d5[_0x15b353(0x187)]?_0x1a87be[_0x15b353(0x18a)](_0x2012d5[_0x15b353(0x187)]['toString']())||'':'',_0x1a36b6=_0x3efbb6?_0x3efbb6+'/'+_0x2012d5[_0x15b353(0x1e5)]:_0x2012d5['name'],_0x5dcdd1=_0x36af98['get'](_0x2012d5['id'])||[],_0x727902=_0x5dcdd1[_0x15b353(0x1d3)]>0x0?a31_0x25be58['dim']('\x20['+_0x5dcdd1[_0x15b353(0x1d3)]+_0x15b353(0x1d4)):'';console[_0x15b353(0x1ac)]('\x0a'+a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x1bc))+'\x20'+_0x1a36b6+_0x727902),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c));const _0x108e56=segmentWithActivationsToYaml(_0x2012d5,_0x5dcdd1,undefined,_0x358bfd,_0x28f222),_0x163ae6=segmentToYamlString(_0x108e56),_0x464af7=generateDiff(_0x163ae6,'');console[_0x15b353(0x1ac)](formatDiffWithColors(_0x464af7)),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c));}const _0x41654c=_0x319fe4[_0x15b353(0x19f)](_0x3ff536=>!_0x3ff536[_0x15b353(0x1dd)]&&_0x3ff536[_0x15b353(0x1b0)]);if(_0x41654c[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x18b)])for(const _0x20b59f of _0x41654c){const _0x14d4cf=_0x20b59f[_0x15b353(0x17c)]?_0x20b59f['folderPath']+'/'+_0x20b59f[_0x15b353(0x190)][_0x15b353(0x1e5)]:_0x20b59f[_0x15b353(0x190)][_0x15b353(0x1e5)];console[_0x15b353(0x1ac)]('\x0a'+a31_0x25be58[_0x15b353(0x19b)](_0x15b353(0x1a5))+'\x20'+_0x14d4cf),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c)),console['error'](_0x20b59f['diff']),console['error']('β'['repeat'](0x3c));}if(_0x1e398b[_0x15b353(0x1d3)]>0x0)for(const _0x13b8ff of _0x1e398b){const _0x103c87=_0x13b8ff[_0x15b353(0x17c)]?_0x13b8ff['folderPath']+'/'+_0x13b8ff['yamlConfig'][_0x15b353(0x1e5)]:_0x13b8ff[_0x15b353(0x190)][_0x15b353(0x1e5)];console[_0x15b353(0x1ac)]('\x0a'+a31_0x25be58['green']('New\x20journey:')+'\x20'+_0x103c87),console['error']('β'[_0x15b353(0x175)](0x3c)),_0x13b8ff[_0x15b353(0x1b0)]&&console[_0x15b353(0x1ac)](_0x13b8ff[_0x15b353(0x1b0)]),console[_0x15b353(0x1ac)]('β'['repeat'](0x3c));}const _0xcdb14a=_0x79efc5[_0x15b353(0x19f)](_0xf815d7=>!_0xf815d7[_0x15b353(0x1dd)]&&_0xf815d7[_0x15b353(0x1b0)]);if(_0xcdb14a[_0x15b353(0x1d3)]>0x0)for(const _0x16c17e of _0xcdb14a){const _0x4ae945=_0x16c17e[_0x15b353(0x17c)]?_0x16c17e[_0x15b353(0x17c)]+'/'+_0x16c17e[_0x15b353(0x190)][_0x15b353(0x1e5)]:_0x16c17e[_0x15b353(0x190)]['name'];console[_0x15b353(0x1ac)]('\x0a'+a31_0x25be58[_0x15b353(0x19b)](_0x15b353(0x1b7))+'\x20'+_0x4ae945),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c)),console['error'](_0x16c17e[_0x15b353(0x1b0)]),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c));}if(_0x3eb7b9['length']>0x0)for(const _0x4f256f of _0x3eb7b9){const _0x2d6c08=_0x4f256f[_0x15b353(0x1e4)]?_0x1a87be['get'](_0x4f256f['folderId'])||'':'',_0x486b4e=_0x2d6c08?_0x2d6c08+'/'+_0x4f256f[_0x15b353(0x1a2)]:_0x4f256f[_0x15b353(0x1a2)];console['error']('\x0a'+a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x1f2))+'\x20'+_0x486b4e),console[_0x15b353(0x1ac)]('β'[_0x15b353(0x175)](0x3c)),console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)](_0x15b353(0x1aa))),console[_0x15b353(0x1ac)]('β'['repeat'](0x3c));}if(_0x4801f1[_0x15b353(0x1cd)])return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x19b)](_0x15b353(0x17e))),0x0;const _0x35f4e0=_0x4801f1['journeysOnly']?![]:_0x533c23[_0x15b353(0x1d3)]>0x0||_0x11fa30[_0x15b353(0x1d3)]>0x0||_0x353c73[_0x15b353(0x1d3)]>0x0,_0x496ec9=_0x1e398b[_0x15b353(0x1d3)]>0x0||_0x389b0d[_0x15b353(0x1d3)]>0x0||_0x3eb7b9[_0x15b353(0x1d3)]>0x0,_0xec190c=_0x4801f1[_0x15b353(0x18b)]?![]:_0xb798ac[_0x15b353(0x1d3)]>0x0,_0x197f14=_0x38a9c5[_0x15b353(0x1d3)]>0x0;if(!_0x35f4e0&&!_0x496ec9&&!_0xec190c&&!_0x197f14){const _0x362548=_0x4801f1['journeysOnly']?_0x15b353(0x1ce):_0x15b353(0x19a);console['error'](a31_0x25be58[_0x15b353(0x1f5)](_0x362548));if(_0x4887b8&&_0x26dd48[_0x15b353(0x1d3)]===0x1){const _0x321976=_0x26dd48[0x0];if(_0x321976[_0x15b353(0x1af)]?.['id']){const _0x27ac6e=getConsoleNextUrl(_0x4801f1[_0x15b353(0x1e7)],_0x15b353(0x1c5)+_0x4ebe42+'/e/'+_0x321976[_0x15b353(0x1af)]['id']+_0x15b353(0x1ea));console[_0x15b353(0x1ac)]('\x20\x20'+a31_0x25be58[_0x15b353(0x1e9)](_0x27ac6e));}}return 0x0;}const _0x499e1e=_0x4801f1['journeysOnly']?_0x1e398b[_0x15b353(0x1d3)]+_0x389b0d[_0x15b353(0x1d3)]+_0x3eb7b9[_0x15b353(0x1d3)]+_0x38a9c5[_0x15b353(0x1d3)]:_0x533c23[_0x15b353(0x1d3)]+_0x11fa30[_0x15b353(0x1d3)]+_0x353c73[_0x15b353(0x1d3)]+_0x1e398b[_0x15b353(0x1d3)]+_0x389b0d[_0x15b353(0x1d3)]+_0x3eb7b9[_0x15b353(0x1d3)]+_0x38a9c5[_0x15b353(0x1d3)]+_0xb798ac[_0x15b353(0x1d3)];if(!_0x4801f1['yes']&&_0x499e1e>0x0){if(!isInteractive())return console[_0x15b353(0x1ac)](a31_0x25be58['red'](_0x15b353(0x170)),_0x15b353(0x194)),console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x15e)](_0x15b353(0x19d))),0x1;const _0xb616e5=await confirmKey('Push\x20'+_0x499e1e+_0x15b353(0x18e));if(!_0xb616e5)return console[_0x15b353(0x1ac)](a31_0x25be58['yellow']('Aborted.')),0x1;}const _0x29a9fb={'withProgress':async(_0x3dee67,_0x23331)=>{const _0x45a126=_0x15b353,_0x4b49fd=await withSpinner(_0x3dee67,_0x23331,{'verbose':_0x4801f1[_0x45a126(0x182)]});return{'data':_0x4b49fd[_0x45a126(0x19e)]};},'logInfo':_0x4d19c1=>console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x1b9)]('β\x20'+_0x4d19c1)),'logSuccess':_0x19f890=>console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x1f5)]('β\x20'+_0x19f890)),'logWarning':_0x49b890=>console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x19b)]('β \x20'+_0x49b890)),'logDeleted':_0x25a066=>console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x163)]('β\x20'+_0x25a066))},_0x41ae66={'segment':_0x4ba8e1[_0x15b353(0x198)],'journey':_0x4ba8e1[_0x15b353(0x16c)],'user':_0x4ba8e1['user'],'connection':_0x4ba8e1[_0x15b353(0x1c1)]};_0x38a9c5['length']>0x0&&(_0x2d8c86=await executePushFolders(_0x41ae66,_0x38a9c5,_0x2d8c86,{'parentId':_0x4ebe42},_0x29a9fb));const _0x49e2ec={'rootFolderId':_0x2e3279,'folderPathToId':_0x2d8c86,'folderIdToPath':_0x1a87be,'segmentNameToId':_0xc20188,'activationsBySegmentId':_0x36af98,'emailToIdMap':_0x475194,'idToEmailMap':_0x358bfd,'connectionNameToIdMap':_0x843710[_0x15b353(0x195)],'connectionIdToNameMap':_0x843710['idToName'],'connectionNameToTypeMap':_0x1ef43a},_0x2d8ed5=await executePushSegments(_0x41ae66,_0x4801f1[_0x15b353(0x18b)]?[]:_0x319fe4,_0x49e2ec,{'parentId':_0x4ebe42},_0x29a9fb),_0x48c008=_0x2d8ed5['created'],_0x347e4c=_0x2d8ed5[_0x15b353(0x18d)],_0x724f06=_0x2d8ed5[_0x15b353(0x18f)][_0x15b353(0x17b)],_0x47c5a2=_0x2d8ed5[_0x15b353(0x18f)][_0x15b353(0x18d)],_0x4c0808=_0x2d8ed5[_0x15b353(0x18f)][_0x15b353(0x176)],_0x38f576=await executePushSegmentDeletions(_0x41ae66,_0x4801f1[_0x15b353(0x18b)]?[]:_0x353c73,_0x29a9fb);let _0x5e2ece=0x0,_0xa01069=0x0,_0x43de58=0x0;const _0x1b853e=new Map(_0xc20188);for(const [_0x47a010,_0x4785b5]of _0x2d8ed5[_0x15b353(0x180)]){_0x1b853e[_0x15b353(0x16f)](_0x47a010,_0x4785b5);}if(_0x79efc5[_0x15b353(0x1d3)]>0x0){const _0x5d80f1={..._0x49e2ec,'segmentNameToId':_0x1b853e,'existingSegments':_0x42e063,'activationContext':_0x2f7a74},_0x11256f=await executePushJourneys(_0x41ae66,_0x79efc5,_0x5d80f1,{'parentId':_0x4ebe42,'rootFolderId':_0x2e3279,'verbose':_0x4801f1[_0x15b353(0x182)]},_0x29a9fb);_0x5e2ece=_0x11256f['created'],_0xa01069=_0x11256f[_0x15b353(0x18d)];if(_0x4887b8&&_0x11256f[_0x15b353(0x1e8)]['length']===0x1){const _0x2ce884=_0x11256f[_0x15b353(0x1e8)][0x0];if(_0x2ce884[_0x15b353(0x199)]){const _0x115d55=getConsoleNextUrl(_0x4801f1['site'],_0x15b353(0x1c5)+_0x4ebe42+_0x15b353(0x16b)+_0x2ce884[_0x15b353(0x199)]+_0x15b353(0x1ea));console[_0x15b353(0x1ac)]('\x20\x20'+a31_0x25be58[_0x15b353(0x1e9)](_0x115d55));}}}for(const _0x32a3ba of _0x3eb7b9){console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x19b)](_0x15b353(0x1db)+_0x32a3ba[_0x15b353(0x1a2)])),_0x43de58++;}const _0x2b7499=[];if(_0x48c008>0x0)_0x2b7499['push'](_0x48c008+_0x15b353(0x1cb));if(_0x347e4c>0x0)_0x2b7499[_0x15b353(0x174)](_0x347e4c+_0x15b353(0x171));if(_0x38f576>0x0)_0x2b7499[_0x15b353(0x174)](_0x38f576+_0x15b353(0x1b6));const _0x3795d0=[];if(_0x5e2ece>0x0)_0x3795d0['push'](_0x5e2ece+'\x20created');if(_0xa01069>0x0)_0x3795d0[_0x15b353(0x174)](_0xa01069+'\x20updated');if(_0x43de58>0x0)_0x3795d0[_0x15b353(0x174)](_0x43de58+_0x15b353(0x1b6));const _0x574d5d=[];if(_0x724f06>0x0)_0x574d5d['push'](_0x724f06+_0x15b353(0x1cb));if(_0x47c5a2>0x0)_0x574d5d[_0x15b353(0x174)](_0x47c5a2+_0x15b353(0x171));if(_0x4c0808>0x0)_0x574d5d[_0x15b353(0x174)](_0x4c0808+_0x15b353(0x1b6));return console[_0x15b353(0x1ac)](a31_0x25be58[_0x15b353(0x1f5)](_0x15b353(0x1e1))),_0x2b7499[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x18b)]&&console[_0x15b353(0x1ac)](_0x15b353(0x1ed)+_0x2b7499['join'](',\x20')),_0x3795d0[_0x15b353(0x1d3)]>0x0&&console[_0x15b353(0x1ac)](_0x15b353(0x1e2)+_0x3795d0[_0x15b353(0x1a4)](',\x20')),_0x574d5d[_0x15b353(0x1d3)]>0x0&&!_0x4801f1[_0x15b353(0x18b)]&&console[_0x15b353(0x1ac)](_0x15b353(0x1b3)+_0x574d5d[_0x15b353(0x1a4)](',\x20')),0x0;}}
|