@treasuredata/tdx 0.26.0 β 0.26.2
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_0x5449f7=a26_0x3f49;(function(_0x385acd,_0x4708a0){const _0x54da83=a26_0x3f49,_0x1cf25f=_0x385acd();while(!![]){try{const _0x45bf92=-parseInt(_0x54da83(0x229))/0x1+parseInt(_0x54da83(0x21e))/0x2*(parseInt(_0x54da83(0x1cc))/0x3)+-parseInt(_0x54da83(0x1e0))/0x4*(parseInt(_0x54da83(0x1e3))/0x5)+parseInt(_0x54da83(0x1fb))/0x6+parseInt(_0x54da83(0x208))/0x7+parseInt(_0x54da83(0x1d2))/0x8+parseInt(_0x54da83(0x22e))/0x9*(parseInt(_0x54da83(0x22d))/0xa);if(_0x45bf92===_0x4708a0)break;else _0x1cf25f['push'](_0x1cf25f['shift']());}catch(_0x5e9961){_0x1cf25f['push'](_0x1cf25f['shift']());}}}(a26_0x4dcd,0x5eaab));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_0x4dcd(){const _0x2f2505=['dim','created_at','delay','pagination','user_name','args','name','retry_limit','priority','π
\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','1578885vZtKhW','query','timezone','Found\x20','just\x20now','create','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Failed\x20to\x20read\x20file:\x20','result','utf-8','cyan','trim','Show\x20schedule\x20execution\x20history','validate','job_id','Query\x20file\x20is\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20run\x20submitted:\x20','tsv','Deleting\x20schedule...','52QdfTAx','site','nextRun','repeat','getTime','list','has_next_page','Schedule\x20updated:\x20','from','format','Updating\x20schedule:\x20','680926RkAUxD','\x20\x20Job\x20ID:\x20','num','engineVersion','70fAWgGv','1160820gtcDBx','status','schedule:delete','Update\x20a\x20scheduled\x20query','trino','log','queryUrl','round','in\x20','start_at','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','yes','executing_user_id','success','json','engine_version','last_job','Listing\x20scheduled\x20queries...','ies','Getting\x20schedule\x20details...','padEnd','Creating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','ended_at','length','\x20\x20Cron:\x20','schedule:history','\x20\x20Time:\x20','schedule:show','\x20(showing\x20','limit','\x22...','scheduled_at','error','listQueries','d\x20ago','\x20matching\x20\x22','\x20\x20β\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','31449eXwHSl','No\x20scheduled\x20queries\x20found','INVALID_ARGUMENT','\x20schedules','\x20\x20Database:\x20','time_zone','738656QtNNbV','count','Searching\x20scheduled\x20queries\x20matching\x20\x22','history','execute','map','statusIcon','Showing\x20first\x20','soon','retryLimit','\x20(use\x20--limit\x20to\x20see\x20more)','output','verbose','...','4jPoTIj','\x20execution','schedule:create','2470410jgkFCL','next_run_at','description','lastRun','show','Show\x20schedule\x20details','m\x20ago','schedule:update','Delete\x20a\x20scheduled\x20query','Running\x20schedule:\x20','entries','data','h\x20ago','\x20\x20Num:\x20','cron','type','green','\x20\x20Timezone:\x20','time','toLocaleDateString','schedules','Schedule\x20deleted:\x20','delete','\x20created','416748UqCCnx','file'];a26_0x4dcd=function(){return _0x2f2505;};return a26_0x4dcd();}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_0x1b9a6a from'chalk';function a26_0x3f49(_0x376299,_0x550c69){_0x376299=_0x376299-0x1c0;const _0x4dcde6=a26_0x4dcd();let _0x3f498c=_0x4dcde6[_0x376299];return _0x3f498c;}function formatRelativeTime(_0x40cc82){const _0x2da0d5=a26_0x3f49,_0x21ab25=new Date(_0x40cc82),_0x2cd1bf=new Date(),_0x46f3ed=_0x21ab25[_0x2da0d5(0x222)]()-_0x2cd1bf[_0x2da0d5(0x222)](),_0x1b1640=Math['abs'](_0x46f3ed)/0x3e8,_0x556ef4=_0x46f3ed<0x0;if(_0x1b1640<0x3c)return _0x556ef4?_0x2da0d5(0x20c):_0x2da0d5(0x1da);else{if(_0x1b1640<0xe10){const _0x22725a=Math[_0x2da0d5(0x235)](_0x1b1640/0x3c);return _0x556ef4?_0x22725a+_0x2da0d5(0x1e9):_0x2da0d5(0x236)+_0x22725a+'m';}else{if(_0x1b1640<0x15180){const _0x4e1d09=Math[_0x2da0d5(0x235)](_0x1b1640/0xe10);return _0x556ef4?_0x4e1d09+_0x2da0d5(0x1ef):_0x2da0d5(0x236)+_0x4e1d09+'h';}else{if(_0x1b1640<0x93a80){const _0x5b4bc2=Math['round'](_0x1b1640/0x15180);return _0x556ef4?_0x5b4bc2+_0x2da0d5(0x1c8):_0x2da0d5(0x236)+_0x5b4bc2+'d';}else return _0x21ab25[_0x2da0d5(0x1f6)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x5449f7(0x203)]='schedule:list';['description']='List\x20scheduled\x20queries';async[a26_0x5449f7(0x1d6)](_0x516a80){const _0x3c52c1=a26_0x5449f7,{options:_0x370fb9,args:_0x33422c,tdx:_0x8cea06}=_0x516a80,_0x34e90a=resolveLimit(_0x370fb9[_0x3c52c1(0x1c3)],DEFAULT_DISPLAY_LIMIT),_0x418f36=_0x33422c[0x0],_0x107e03=_0x418f36?_0x3c52c1(0x1d4)+_0x418f36+_0x3c52c1(0x1c4):_0x3c52c1(0x240),_0x236cc4=await withSpinner(_0x107e03,()=>_0x8cea06['schedules'][_0x3c52c1(0x1c7)]({'limit':_0x34e90a,'scheduled':!![],'pattern':_0x418f36}),{'verbose':_0x370fb9[_0x3c52c1(0x1de)]}),_0x1c1aa9=_0x236cc4['data']['queries'],_0x4279ce=_0x236cc4[_0x3c52c1(0x1ee)][_0x3c52c1(0x200)][_0x3c52c1(0x224)],_0x2cfc1f=_0x418f36?_0x3c52c1(0x1c9)+_0x418f36+'\x22':'';_0x4279ce?console[_0x3c52c1(0x1c6)](_0x3c52c1(0x1d9)+_0x1c1aa9[_0x3c52c1(0x247)]+_0x3c52c1(0x1cf)+_0x2cfc1f+_0x3c52c1(0x1dc)):console[_0x3c52c1(0x1c6)](_0x3c52c1(0x20b)+_0x1c1aa9['length']+'\x20scheduled\x20quer'+(_0x1c1aa9[_0x3c52c1(0x247)]!==0x1?_0x3c52c1(0x241):'y')+_0x2cfc1f);if(_0x370fb9['format']===_0x3c52c1(0x23d)||_0x370fb9[_0x3c52c1(0x227)]==='jsonl'||_0x370fb9[_0x3c52c1(0x227)]==='table'||_0x370fb9[_0x3c52c1(0x227)]===_0x3c52c1(0x21c)){const _0x20e38a=_0x1c1aa9[_0x3c52c1(0x1d7)](_0x574f14=>({'id':_0x574f14['id'],'name':_0x574f14[_0x3c52c1(0x203)],'cron':_0x574f14['cron'],'database':_0x574f14['database']?.[_0x3c52c1(0x203)],'type':_0x574f14[_0x3c52c1(0x1f2)],'timezone':_0x574f14[_0x3c52c1(0x1d1)],'user_name':_0x574f14[_0x3c52c1(0x20e)]?.[_0x3c52c1(0x203)],'updated_at':_0x574f14['updated_at'],'next_run_at':_0x574f14[_0x3c52c1(0x1e4)],'last_job_status':_0x574f14[_0x3c52c1(0x23f)]?.['status']}));await handleSDKOutput(_0x20e38a,_0x370fb9);}else{if(_0x1c1aa9['length']===0x0)console[_0x3c52c1(0x233)](_0x3c52c1(0x1cd));else{const _0x58a1e9=_0x370fb9[_0x3c52c1(0x21f)],_0x12a960=_0x1c1aa9[_0x3c52c1(0x1d7)](_0x381d2b=>{const _0x969913=_0x3c52c1,_0x52cd47=_0x381d2b[_0x969913(0x23f)]?.[_0x969913(0x22f)]?_0x381d2b[_0x969913(0x23f)][_0x969913(0x22f)]===_0x969913(0x23c)?'β':'β':'-',_0x410d84=_0x381d2b[_0x969913(0x23f)]?.['ended_at']?formatRelativeTime(_0x381d2b[_0x969913(0x23f)][_0x969913(0x246)]):'never',_0x289e7e=_0x381d2b[_0x969913(0x1e4)]?formatRelativeTime(_0x381d2b[_0x969913(0x1e4)]):'-',_0x1f174b=_0x381d2b[_0x969913(0x1f1)]||'',_0x5bd383=_0x381d2b[_0x969913(0x203)]||'(unnamed)',_0x3d2af9=getConsoleUrl(_0x58a1e9,'/app/queries/editor?queryId='+_0x381d2b['id']);return{'statusIcon':_0x52cd47,'lastRun':_0x410d84,'nextRun':_0x289e7e,'cron':_0x1f174b,'name':_0x5bd383,'queryUrl':_0x3d2af9,'status':_0x381d2b[_0x969913(0x23f)]?.[_0x969913(0x22f)]};}),_0x3383be=Math['max'](..._0x12a960[_0x3c52c1(0x1d7)](_0x5055b9=>_0x5055b9[_0x3c52c1(0x1e6)][_0x3c52c1(0x247)])),_0x1c4dae=Math['max'](..._0x12a960[_0x3c52c1(0x1d7)](_0x366eb7=>_0x366eb7[_0x3c52c1(0x220)]['length'])),_0x4728bc=Math['max'](..._0x12a960[_0x3c52c1(0x1d7)](_0x5004e0=>_0x5004e0['cron'][_0x3c52c1(0x247)])),_0x55dd22=_0x12a960[_0x3c52c1(0x1d7)](_0x36c52c=>{const _0x991ee=_0x3c52c1,_0x3b3d7c=_0x36c52c[_0x991ee(0x22f)]===_0x991ee(0x23c)?a26_0x1b9a6a[_0x991ee(0x1f3)](_0x36c52c['statusIcon']):_0x36c52c[_0x991ee(0x22f)]===_0x991ee(0x1c6)?a26_0x1b9a6a['red'](_0x36c52c[_0x991ee(0x1d8)]):a26_0x1b9a6a[_0x991ee(0x1fd)](_0x36c52c['statusIcon']),_0xe53ddb=_0x36c52c[_0x991ee(0x1e6)][_0x991ee(0x243)](_0x3383be),_0x548cd3=_0x36c52c[_0x991ee(0x220)][_0x991ee(0x243)](_0x1c4dae),_0x49a69e=_0x36c52c['cron']?a26_0x1b9a6a[_0x991ee(0x213)](_0x36c52c[_0x991ee(0x1f1)][_0x991ee(0x243)](_0x4728bc)):'\x20'[_0x991ee(0x221)](_0x4728bc),_0x2f92f0=hyperlink(_0x36c52c['name'],_0x36c52c[_0x991ee(0x234)]);return _0x991ee(0x206)+_0x3b3d7c+'\x20'+_0xe53ddb+_0x991ee(0x1ca)+_0x548cd3+'\x20\x20'+_0x49a69e+'\x20\x20'+_0x2f92f0;});await writeOutput(_0x55dd22['join']('\x0a'),_0x370fb9[_0x3c52c1(0x1dd)],_0x3c52c1(0x223));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x5449f7(0x203)]=a26_0x5449f7(0x1c1);['description']=a26_0x5449f7(0x1e8);[a26_0x5449f7(0x216)](_0x2a806c){const _0x5ddafb=a26_0x5449f7,_0x127ac2=_0x2a806c['args'][0x0];if(!_0x127ac2)return _0x5ddafb(0x207);return undefined;}async[a26_0x5449f7(0x1d6)](_0x44a91d){const _0x10c66a=a26_0x5449f7,{options:_0x4b4a08,args:_0x233950,tdx:_0x175b28}=_0x44a91d,_0x222db3=_0x233950[0x0],_0x2cb419=await withSpinner(_0x10c66a(0x242),()=>_0x175b28[_0x10c66a(0x1f7)][_0x10c66a(0x1e7)](_0x222db3),{'verbose':_0x4b4a08[_0x10c66a(0x1de)]}),_0x32d3df=_0x2cb419[_0x10c66a(0x1ee)],_0x5072ec={'name':_0x32d3df['name'],'cron':_0x32d3df['cron'],'database':_0x32d3df[_0x10c66a(0x238)],'type':_0x32d3df[_0x10c66a(0x1f2)],'timezone':_0x32d3df[_0x10c66a(0x20a)],'user_name':_0x32d3df[_0x10c66a(0x201)],'created_at':_0x32d3df[_0x10c66a(0x1fe)],'engine_version':_0x32d3df[_0x10c66a(0x23e)],'executing_user_id':_0x32d3df[_0x10c66a(0x23b)],'query':_0x32d3df[_0x10c66a(0x209)],'delay':_0x32d3df[_0x10c66a(0x1ff)],'priority':_0x32d3df[_0x10c66a(0x205)],'retry_limit':_0x32d3df[_0x10c66a(0x204)],..._0x32d3df[_0x10c66a(0x211)]&&{'result':_0x32d3df['result']}};return await handleSingleObjectOutput(_0x5072ec,_0x4b4a08),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x5449f7(0x203)]=a26_0x5449f7(0x1e2);[a26_0x5449f7(0x1e5)]='Create\x20a\x20scheduled\x20query';[a26_0x5449f7(0x216)](_0x4800e8){const _0x2f9889=a26_0x5449f7,_0x49b804=_0x4800e8[_0x2f9889(0x202)][0x0];if(!_0x49b804)return _0x2f9889(0x21a);return undefined;}async[a26_0x5449f7(0x1d6)](_0x27d0e0){const _0x50915e=a26_0x5449f7,{options:_0x7326f9,args:_0x150484,tdx:_0x1347fe}=_0x27d0e0,_0x29bef2=_0x150484[0x0],_0x2dca06=_0x7326f9,_0x5bfa47=_0x2dca06[_0x50915e(0x238)],_0x570dad=_0x2dca06[_0x50915e(0x1fc)],_0x1c6ea6=_0x2dca06[_0x50915e(0x1f2)]||_0x50915e(0x232);let _0x5bda7b;try{_0x5bda7b=readFileSync(_0x570dad,_0x50915e(0x212))[_0x50915e(0x214)]();}catch(_0x1eccd3){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x50915e(0x210)+_0x570dad,_0x1eccd3 instanceof Error?_0x1eccd3:undefined);}if(!_0x5bda7b)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x50915e(0x218));const _0x3ec070={'database':_0x5bfa47,'query':_0x5bda7b,'type':_0x1c6ea6};if(_0x2dca06['cron'])_0x3ec070[_0x50915e(0x1f1)]=_0x2dca06[_0x50915e(0x1f1)];if(_0x2dca06['timezone'])_0x3ec070[_0x50915e(0x20a)]=_0x2dca06[_0x50915e(0x20a)];if(_0x2dca06[_0x50915e(0x1ff)]!==undefined)_0x3ec070['delay']=Number(_0x2dca06[_0x50915e(0x1ff)]);if(_0x2dca06[_0x50915e(0x205)]!==undefined)_0x3ec070[_0x50915e(0x205)]=Number(_0x2dca06['priority']);if(_0x2dca06[_0x50915e(0x1db)]!==undefined)_0x3ec070[_0x50915e(0x204)]=Number(_0x2dca06[_0x50915e(0x1db)]);if(_0x2dca06[_0x50915e(0x22c)])_0x3ec070[_0x50915e(0x23e)]=_0x2dca06[_0x50915e(0x22c)];if(_0x2dca06['result'])_0x3ec070[_0x50915e(0x211)]=_0x2dca06[_0x50915e(0x211)];if(_0x7326f9['verbose']){console[_0x50915e(0x1c6)]('Creating\x20schedule:\x20'+_0x29bef2),console[_0x50915e(0x1c6)](_0x50915e(0x1d0)+_0x5bfa47),console[_0x50915e(0x1c6)]('\x20\x20Type:\x20'+_0x1c6ea6);if(_0x3ec070[_0x50915e(0x1f1)])console[_0x50915e(0x1c6)](_0x50915e(0x248)+_0x3ec070['cron']);if(_0x3ec070['timezone'])console[_0x50915e(0x1c6)](_0x50915e(0x1f4)+_0x3ec070[_0x50915e(0x20a)]);}const _0x1f61b1=await withSpinner(_0x50915e(0x244),()=>_0x1347fe[_0x50915e(0x1f7)][_0x50915e(0x20d)](_0x29bef2,_0x3ec070),{'verbose':_0x7326f9[_0x50915e(0x1de)]});return console[_0x50915e(0x1c6)]('Schedule\x20created:\x20'+_0x1f61b1[_0x50915e(0x1ee)][_0x50915e(0x203)]),await handleSingleObjectOutput(_0x1f61b1[_0x50915e(0x1ee)],_0x7326f9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a26_0x5449f7(0x1ea);[a26_0x5449f7(0x1e5)]=a26_0x5449f7(0x231);[a26_0x5449f7(0x216)](_0x2911a0){const _0x3a7f4c=a26_0x5449f7,_0x2fe390=_0x2911a0[_0x3a7f4c(0x202)][0x0];if(!_0x2fe390)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async['execute'](_0x1f8ed4){const _0x936aff=a26_0x5449f7,{options:_0xaf59e7,args:_0x3a4731,tdx:_0x20eb68}=_0x1f8ed4,_0x1177dc=_0x3a4731[0x0],_0x66191f=_0xaf59e7,_0x5896a7={};if(_0x66191f[_0x936aff(0x238)])_0x5896a7[_0x936aff(0x238)]=_0x66191f[_0x936aff(0x238)];if(_0x66191f[_0x936aff(0x1f2)])_0x5896a7[_0x936aff(0x1f2)]=_0x66191f[_0x936aff(0x1f2)];if(_0x66191f[_0x936aff(0x1f1)])_0x5896a7[_0x936aff(0x1f1)]=_0x66191f[_0x936aff(0x1f1)];if(_0x66191f[_0x936aff(0x20a)])_0x5896a7[_0x936aff(0x20a)]=_0x66191f[_0x936aff(0x20a)];if(_0x66191f[_0x936aff(0x1ff)]!==undefined)_0x5896a7[_0x936aff(0x1ff)]=Number(_0x66191f[_0x936aff(0x1ff)]);if(_0x66191f[_0x936aff(0x205)]!==undefined)_0x5896a7['priority']=Number(_0x66191f[_0x936aff(0x205)]);if(_0x66191f['retryLimit']!==undefined)_0x5896a7[_0x936aff(0x204)]=Number(_0x66191f[_0x936aff(0x1db)]);if(_0x66191f[_0x936aff(0x22c)])_0x5896a7[_0x936aff(0x23e)]=_0x66191f[_0x936aff(0x22c)];if(_0x66191f[_0x936aff(0x211)])_0x5896a7['result']=_0x66191f[_0x936aff(0x211)];if(_0x66191f[_0x936aff(0x1fc)])try{_0x5896a7[_0x936aff(0x209)]=readFileSync(_0x66191f[_0x936aff(0x1fc)],_0x936aff(0x212))[_0x936aff(0x214)]();}catch(_0x2e561c){throw new SDKError(ErrorCode[_0x936aff(0x1ce)],_0x936aff(0x210)+_0x66191f[_0x936aff(0x1fc)],_0x2e561c instanceof Error?_0x2e561c:undefined);}if(Object['keys'](_0x5896a7)['length']===0x0)throw new SDKError(ErrorCode[_0x936aff(0x1ce)],_0x936aff(0x1cb));if(_0xaf59e7[_0x936aff(0x1de)]){console[_0x936aff(0x1c6)](_0x936aff(0x228)+_0x1177dc);for(const [_0x3e1d5a,_0x1eaf31]of Object[_0x936aff(0x1ed)](_0x5896a7)){_0x3e1d5a===_0x936aff(0x209)?console[_0x936aff(0x1c6)]('\x20\x20'+_0x3e1d5a+':\x20'+_0x1eaf31['substring'](0x0,0x32)+_0x936aff(0x1df)):console[_0x936aff(0x1c6)]('\x20\x20'+_0x3e1d5a+':\x20'+_0x1eaf31);}}const _0x4434a9=await withSpinner('Updating\x20schedule...',()=>_0x20eb68[_0x936aff(0x1f7)]['update'](_0x1177dc,_0x5896a7),{'verbose':_0xaf59e7[_0x936aff(0x1de)]});return console[_0x936aff(0x1c6)](_0x936aff(0x225)+_0x4434a9['data'][_0x936aff(0x203)]),await handleSingleObjectOutput(_0x4434a9['data'],_0xaf59e7),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x5449f7(0x203)]=a26_0x5449f7(0x230);['description']=a26_0x5449f7(0x1eb);[a26_0x5449f7(0x216)](_0xfd53c9){const _0x38a2e0=a26_0x5449f7,_0x505c6c=_0xfd53c9[_0x38a2e0(0x202)][0x0];if(!_0x505c6c)return _0x38a2e0(0x245);return undefined;}async[a26_0x5449f7(0x1d6)](_0x5d10c3){const _0x51d070=a26_0x5449f7,{options:_0x16768b,args:_0x294325,tdx:_0x18252c}=_0x5d10c3,_0x573724=_0x294325[0x0];if(!_0x16768b[_0x51d070(0x23a)]){const _0x28b6f4=await confirm(_0x51d070(0x219)+_0x573724+'\x22?');if(!_0x28b6f4)return console['error']('Cancelled'),0x0;}const _0x4f9bb6=await withSpinner(_0x51d070(0x21d),()=>_0x18252c[_0x51d070(0x1f7)][_0x51d070(0x1f9)](_0x573724),{'verbose':_0x16768b[_0x51d070(0x1de)]});return console[_0x51d070(0x1c6)](_0x51d070(0x1f8)+_0x4f9bb6[_0x51d070(0x1ee)][_0x51d070(0x203)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x5449f7(0x203)]='schedule:run';[a26_0x5449f7(0x1e5)]='Run\x20a\x20scheduled\x20query\x20immediately';[a26_0x5449f7(0x216)](_0x9a549d){const _0x19786a=a26_0x5449f7,_0x4ae39d=_0x9a549d[_0x19786a(0x202)][0x0];if(!_0x4ae39d)return _0x19786a(0x239);return undefined;}async['execute'](_0x43d518){const _0x452886=a26_0x5449f7,{options:_0x2bc923,args:_0x2c4422,tdx:_0x4df2a0}=_0x43d518,_0x56290d=_0x2c4422[0x0],_0x5b5e14=_0x2bc923,_0xa5c3a5=_0x5b5e14[_0x452886(0x1f5)],_0x2344f5=_0x5b5e14[_0x452886(0x22b)]!==undefined?Number(_0x5b5e14['num']):undefined;if(_0x2bc923[_0x452886(0x1de)]){console[_0x452886(0x1c6)](_0x452886(0x1ec)+_0x56290d);if(_0xa5c3a5)console['error'](_0x452886(0x1c0)+_0xa5c3a5);if(_0x2344f5)console[_0x452886(0x1c6)](_0x452886(0x1f0)+_0x2344f5);}const _0x8839f=await withSpinner('Running\x20schedule...',()=>_0x4df2a0[_0x452886(0x1f7)]['run'](_0x56290d,{'time':_0xa5c3a5,'num':_0x2344f5}),{'verbose':_0x2bc923[_0x452886(0x1de)]}),_0x4d2ca0=_0x8839f[_0x452886(0x1ee)]['jobs'];console[_0x452886(0x1c6)](_0x452886(0x21b)+_0x4d2ca0[_0x452886(0x247)]+'\x20job'+(_0x4d2ca0[_0x452886(0x247)]!==0x1?'s':'')+_0x452886(0x1fa));for(const _0xf64212 of _0x4d2ca0){console[_0x452886(0x1c6)](_0x452886(0x22a)+_0xf64212['job_id']);}return await handleSDKOutput(_0x4d2ca0,_0x2bc923),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x5449f7(0x203)]=a26_0x5449f7(0x249);[a26_0x5449f7(0x1e5)]=a26_0x5449f7(0x215);[a26_0x5449f7(0x216)](_0x11f83b){const _0x201d80=a26_0x5449f7,_0xc5ea65=_0x11f83b[_0x201d80(0x202)][0x0];if(!_0xc5ea65)return _0x201d80(0x20f);return undefined;}async[a26_0x5449f7(0x1d6)](_0x244540){const _0x1cabf0=a26_0x5449f7,{options:_0x6692f3,args:_0x190ea3,tdx:_0x23641e}=_0x244540,_0x23a447=_0x190ea3[0x0],_0xcd411b=_0x6692f3,_0x3ad240=_0xcd411b[_0x1cabf0(0x226)]!==undefined?Number(_0xcd411b[_0x1cabf0(0x226)]):undefined,_0x4138d0=_0xcd411b['to']!==undefined?Number(_0xcd411b['to']):undefined,_0x43fc4a=await withSpinner('Getting\x20schedule\x20history...',()=>_0x23641e[_0x1cabf0(0x1f7)][_0x1cabf0(0x1d5)](_0x23a447,{'from':_0x3ad240,'to':_0x4138d0}),{'verbose':_0x6692f3['verbose']}),_0x4acaba=_0x43fc4a['data'];console['error'](_0x1cabf0(0x20b)+_0x4acaba[_0x1cabf0(0x1d3)]+_0x1cabf0(0x1e1)+(_0x4acaba['count']!==0x1?'s':'')+_0x1cabf0(0x1c2)+_0x4acaba[_0x1cabf0(0x226)]+'-'+_0x4acaba['to']+')');const _0x2dac06=_0x4acaba['history'][_0x1cabf0(0x1d7)](_0x1ee491=>({'job_id':_0x1ee491[_0x1cabf0(0x217)],'type':_0x1ee491[_0x1cabf0(0x1f2)],'status':_0x1ee491['status'],'scheduled_at':_0x1ee491[_0x1cabf0(0x1c5)],'created_at':_0x1ee491[_0x1cabf0(0x1fe)],'start_at':_0x1ee491[_0x1cabf0(0x237)],'end_at':_0x1ee491['end_at']}));return await handleSDKOutput(_0x2dac06,_0x6692f3),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_0x14b939=a27_0x382a;(function(_0x38f667,_0x56beb4){const _0x5916d1=a27_0x382a,_0x183189=_0x38f667();while(!![]){try{const _0x2f52f4=parseInt(_0x5916d1(0x266))/0x1+-parseInt(_0x5916d1(0x200))/0x2+-parseInt(_0x5916d1(0x227))/0x3*(-parseInt(_0x5916d1(0x265))/0x4)+-parseInt(_0x5916d1(0x26f))/0x5*(parseInt(_0x5916d1(0x23e))/0x6)+-parseInt(_0x5916d1(0x216))/0x7*(parseInt(_0x5916d1(0x21e))/0x8)+-parseInt(_0x5916d1(0x21f))/0x9*(-parseInt(_0x5916d1(0x257))/0xa)+-parseInt(_0x5916d1(0x207))/0xb*(-parseInt(_0x5916d1(0x22e))/0xc);if(_0x2f52f4===_0x56beb4)break;else _0x183189['push'](_0x183189['shift']());}catch(_0x2d8db8){_0x183189['push'](_0x183189['shift']());}}}(a27_0x2cce,0x1b84a));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_0x43b323 from'chalk';function a27_0x382a(_0x2513a7,_0x1d32d4){_0x2513a7=_0x2513a7-0x1dd;const _0x2cce8d=a27_0x2cce();let _0x382a1b=_0x2cce8d[_0x2513a7];return _0x382a1b;}async function resolveSegmentTarget(_0x3d406c,_0x8f9824,_0x856595){const _0x3187d3=a27_0x382a;if(isYamlFilePath(_0x3d406c))try{const _0x4ed85d=await resolveYamlFilePath(_0x3d406c);return _0x856595&&(console['error'](_0x3187d3(0x236)+_0x3d406c),console['error'](_0x3187d3(0x219)+_0x4ed85d[_0x3187d3(0x228)]),console[_0x3187d3(0x275)](_0x3187d3(0x210)+_0x4ed85d[_0x3187d3(0x20d)]),console[_0x3187d3(0x275)]('\x20\x20Folder\x20path:\x20'+(_0x4ed85d[_0x3187d3(0x223)]||_0x3187d3(0x201))),console[_0x3187d3(0x275)]('\x20\x20Full\x20path:\x20'+_0x4ed85d[_0x3187d3(0x27c)])),_0x4ed85d[_0x3187d3(0x27c)];}catch(_0x34ed1f){throw new SDKError(ErrorCode[_0x3187d3(0x21c)],_0x3187d3(0x273)+_0x34ed1f[_0x3187d3(0x256)]);}if(!_0x8f9824)throw new SDKError(ErrorCode[_0x3187d3(0x21c)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x8f9824+'/'+_0x3d406c;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x14b939(0x262)]=a27_0x14b939(0x271);[a27_0x14b939(0x247)]=a27_0x14b939(0x213);async[a27_0x14b939(0x1fd)](_0x50795a){const _0x5a7d1e=a27_0x14b939,{options:_0x22ffbf,args:_0x410392,tdx:_0x13af53}=_0x50795a,_0x4dad62=_0x410392[0x0],_0x387a64=!_0x4dad62&&!!_0x22ffbf[_0x5a7d1e(0x228)],_0x8bed4c=_0x4dad62||_0x22ffbf['parentSegment'];if(!_0x8bed4c)return console[_0x5a7d1e(0x275)](_0x5a7d1e(0x212)),console[_0x5a7d1e(0x275)](_0x5a7d1e(0x1df)),console[_0x5a7d1e(0x275)](_0x5a7d1e(0x244)),console['error'](_0x5a7d1e(0x221)),console[_0x5a7d1e(0x275)](_0x5a7d1e(0x203)),console[_0x5a7d1e(0x275)](_0x5a7d1e(0x26b)),console['error'](_0x5a7d1e(0x1dd)),0x1;try{const _0x1785e0=_0x22ffbf[_0x5a7d1e(0x202)];let _0x57132d=_0x8bed4c;!_0x387a64&&_0x1785e0&&!_0x8bed4c['includes']('/')&&(_0x57132d=_0x1785e0+'/'+_0x8bed4c,_0x22ffbf[_0x5a7d1e(0x234)]&&console[_0x5a7d1e(0x275)]('Resolved\x20relative\x20path\x20to:\x20'+_0x57132d));const _0x3469c7=await withSpinner(_0x5a7d1e(0x268)+_0x57132d+_0x5a7d1e(0x238),()=>_0x13af53['segment'][_0x5a7d1e(0x1fe)](_0x57132d),{'verbose':_0x22ffbf[_0x5a7d1e(0x234)]}),_0x510b99=_0x3469c7[_0x5a7d1e(0x204)];_0x22ffbf[_0x5a7d1e(0x234)]&&(console['error']('Resolved\x20type:\x20'+_0x510b99[_0x5a7d1e(0x1e2)]),console['error']('Parent\x20ID:\x20'+_0x510b99[_0x5a7d1e(0x208)]),_0x510b99[_0x5a7d1e(0x22a)]&&console[_0x5a7d1e(0x275)](_0x5a7d1e(0x1e8)+_0x510b99[_0x5a7d1e(0x22a)]),_0x510b99[_0x5a7d1e(0x274)]&&console[_0x5a7d1e(0x275)](_0x5a7d1e(0x260)+_0x510b99[_0x5a7d1e(0x274)]));if(_0x510b99['type']===_0x5a7d1e(0x20f)){const _0x203f14=await withSpinner(_0x5a7d1e(0x232),()=>_0x13af53[_0x5a7d1e(0x269)]['getParent'](_0x510b99[_0x5a7d1e(0x208)]),{'verbose':_0x22ffbf[_0x5a7d1e(0x234)]});await handleSingleObjectOutput(_0x203f14['data'],_0x22ffbf);}else{if(_0x510b99[_0x5a7d1e(0x1e2)]===_0x5a7d1e(0x230)){if(!_0x510b99['folderId'])throw new SDKError(ErrorCode[_0x5a7d1e(0x1fa)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4b4d98=await withSpinner(_0x5a7d1e(0x1e4),()=>_0x13af53['segment'][_0x5a7d1e(0x251)](_0x510b99[_0x5a7d1e(0x22a)]),{'verbose':_0x22ffbf[_0x5a7d1e(0x234)]});await handleSingleObjectOutput(_0x4b4d98[_0x5a7d1e(0x204)],_0x22ffbf);}else{if(_0x510b99[_0x5a7d1e(0x1e2)]==='segment'){if(!_0x510b99[_0x5a7d1e(0x274)])throw new SDKError(ErrorCode[_0x5a7d1e(0x26c)],_0x5a7d1e(0x1e5));const _0x2f9a50=await withSpinner(_0x5a7d1e(0x20a),()=>_0x13af53[_0x5a7d1e(0x269)][_0x5a7d1e(0x225)](_0x510b99['parentId'],_0x510b99[_0x5a7d1e(0x274)]),{'verbose':_0x22ffbf[_0x5a7d1e(0x234)]});await handleSingleObjectOutput(_0x2f9a50[_0x5a7d1e(0x204)],_0x22ffbf);}}}return 0x0;}catch(_0x549a94){if(_0x549a94 instanceof SDKError)return console[_0x5a7d1e(0x275)]('Error:\x20'+_0x549a94[_0x5a7d1e(0x256)]),_0x549a94[_0x5a7d1e(0x272)]&&console['error'](_0x5a7d1e(0x220)+_0x549a94[_0x5a7d1e(0x272)]),0x1;throw _0x549a94;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a27_0x14b939(0x247)]=a27_0x14b939(0x25f);async[a27_0x14b939(0x1fd)](_0x2ffba6){const _0x1aeaec=a27_0x14b939,{options:_0x28d071,args:_0x1936ee,tdx:_0x14ef6c}=_0x2ffba6,_0x1bd554=_0x1936ee[0x0];if(!_0x1bd554)return console[_0x1aeaec(0x275)](_0x1aeaec(0x267)),console['error'](_0x1aeaec(0x224)),console['error'](_0x1aeaec(0x270)),console[_0x1aeaec(0x275)](_0x1aeaec(0x244)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x1aeaec(0x24c)),0x1;try{const _0x2ff33a=_0x28d071['parentSegment'],_0x397749=await resolveSegmentTarget(_0x1bd554,_0x2ff33a,_0x28d071[_0x1aeaec(0x234)]);_0x28d071[_0x1aeaec(0x234)]&&console[_0x1aeaec(0x275)](_0x1aeaec(0x242)+_0x397749);const _0x3f31f0=await withSpinner('Resolving\x20\x27'+_0x1bd554+_0x1aeaec(0x238),()=>_0x14ef6c[_0x1aeaec(0x269)][_0x1aeaec(0x1fe)](_0x397749),{'verbose':_0x28d071[_0x1aeaec(0x234)]}),_0x2b0bc5=_0x3f31f0[_0x1aeaec(0x204)];_0x28d071[_0x1aeaec(0x234)]&&(console[_0x1aeaec(0x275)](_0x1aeaec(0x240)+_0x2b0bc5[_0x1aeaec(0x1e2)]),console[_0x1aeaec(0x275)]('Parent\x20ID:\x20'+_0x2b0bc5[_0x1aeaec(0x208)]));if(_0x2b0bc5[_0x1aeaec(0x1e2)]==='folder')return console[_0x1aeaec(0x275)](_0x1aeaec(0x278)),console[_0x1aeaec(0x275)](_0x1aeaec(0x20c)),0x1;if(_0x2b0bc5['type']===_0x1aeaec(0x20f))return console[_0x1aeaec(0x275)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1aeaec(0x275)](_0x1aeaec(0x21b)),0x1;if(!_0x2b0bc5['segmentId'])throw new SDKError(ErrorCode[_0x1aeaec(0x26c)],_0x1aeaec(0x1e5));const _0x473a1f=await withSpinner(_0x1aeaec(0x259),()=>_0x14ef6c[_0x1aeaec(0x269)][_0x1aeaec(0x22b)](_0x2b0bc5['parentId'],_0x2b0bc5[_0x1aeaec(0x274)]),{'verbose':_0x28d071[_0x1aeaec(0x234)]});let _0x16a31d=_0x473a1f[_0x1aeaec(0x204)];const _0x759c9b=resolveLimit(_0x28d071['limit'],DEFAULT_DISPLAY_LIMIT),_0x5a151d=/\bLIMIT\s+\d+/i[_0x1aeaec(0x24d)](_0x16a31d);!_0x5a151d&&(_0x16a31d=_0x16a31d[_0x1aeaec(0x263)]()[_0x1aeaec(0x1e7)](/;+$/,''),_0x16a31d=_0x1aeaec(0x261)+_0x16a31d+_0x1aeaec(0x276)+_0x759c9b);_0x28d071[_0x1aeaec(0x234)]&&console[_0x1aeaec(0x275)](_0x1aeaec(0x26d)+_0x16a31d);const _0x3ad3bf=await withProgressSpinner(_0x1aeaec(0x254),async _0x333322=>{const _0x305447=_0x1aeaec,_0x13f797=await _0x14ef6c[_0x305447(0x264)][_0x305447(0x1fd)](_0x16a31d,{'catalog':'td','schema':'information_schema','onJobId':_0x2cc2f7=>{const _0x872481=_0x305447;_0x333322[_0x872481(0x1f8)](_0x2cc2f7);}});return _0x13f797;},{'verbose':_0x28d071[_0x1aeaec(0x234)]}),_0x2bccd6=_0x3ad3bf[_0x1aeaec(0x204)],_0x378069=_0x2bccd6[_0x1aeaec(0x21d)]?_0x1aeaec(0x20b)+_0x2bccd6[_0x1aeaec(0x21d)]+']':'';return console['error'](_0x1aeaec(0x1f0)+_0x2bccd6[_0x1aeaec(0x1fc)][_0x1aeaec(0x1f7)][_0x1aeaec(0x26a)]()+_0x1aeaec(0x241)+(_0x1aeaec(0x23d)+formatElapsed(_0x2bccd6['stats'][_0x1aeaec(0x1f3)])+_0x378069)),await handleQueryOutput(_0x2bccd6,_0x28d071),0x0;}catch(_0x559680){if(_0x559680 instanceof SDKError)return console[_0x1aeaec(0x275)]('β\x20Query\x20failed\x20['+_0x559680[_0x1aeaec(0x27d)]+']'),console[_0x1aeaec(0x275)]('\x0a'+_0x559680[_0x1aeaec(0x256)]),0x1;throw _0x559680;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x14b939(0x258);[a27_0x14b939(0x247)]=a27_0x14b939(0x22d);async[a27_0x14b939(0x1fd)](_0x22f61f){const _0x383c6e=a27_0x14b939,{options:_0x4ec22e,args:_0x34d789,tdx:_0x482d00}=_0x22f61f;if(_0x34d789[_0x383c6e(0x25b)]===0x0)return console[_0x383c6e(0x275)](_0x383c6e(0x1f1)),console[_0x383c6e(0x275)](_0x383c6e(0x27b)),0x1;const _0x4eadcb=_0x34d789[0x0];try{_0x4ec22e[_0x383c6e(0x234)]&&(console[_0x383c6e(0x275)]('Site:\x20'+_0x4ec22e[_0x383c6e(0x209)]),console[_0x383c6e(0x275)](_0x383c6e(0x205)+_0x4eadcb));const _0x586801=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4eadcb+'\x27...',()=>_0x482d00['segment'][_0x383c6e(0x1ea)](_0x4eadcb),{'verbose':_0x4ec22e[_0x383c6e(0x234)]}),_0x1d3ff8=_0x586801['data'];_0x4ec22e['verbose']&&console[_0x383c6e(0x275)]('Resolved\x20parent\x20ID:\x20'+_0x1d3ff8);const _0x31db9b=await withSpinner(_0x383c6e(0x211)+_0x4eadcb+_0x383c6e(0x238),()=>_0x482d00[_0x383c6e(0x269)][_0x383c6e(0x23c)](_0x1d3ff8),{'verbose':_0x4ec22e[_0x383c6e(0x234)]}),_0x5a333a=_0x31db9b[_0x383c6e(0x204)];return console['error'](_0x383c6e(0x27a)+_0x5a333a[_0x383c6e(0x25b)]+_0x383c6e(0x235)+(_0x5a333a[_0x383c6e(0x25b)]!==0x1?'s':'')),await handleSDKOutput(_0x5a333a,_0x4ec22e),0x0;}catch(_0xd5b549){if(_0xd5b549 instanceof SDKError)return console[_0x383c6e(0x275)](_0x383c6e(0x239)+_0xd5b549['message']),_0xd5b549[_0x383c6e(0x272)]&&console[_0x383c6e(0x275)](_0x383c6e(0x220)+_0xd5b549[_0x383c6e(0x272)]),0x1;throw _0xd5b549;}}}function a27_0x2cce(){const _0x4e1c58=['\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','data','Parent\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','55mZzYNs','parentId','site','Fetching\x20segment\x20details...','\x20[Job\x20ID:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segmentName','\x27\x20with\x20ID:\x20','parent','\x20\x20Segment\x20name:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Path\x20or\x20name\x20is\x20required','Show\x20segment\x20or\x20folder\x20details','β\x20Created\x20folder\x20\x27','/e/','7iZUVGt','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','log','\x20\x20Parent\x20segment:\x20','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20show','INVALID_ARGUMENT','jobId','804200GgCqvW','39168rtRzRE','\x20\x20Cause:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','folderPath','Usage:\x20tdx\x20sg\x20show\x20<name>','getSegment','Use:\x20tdx\x20ps\x20view','18BlNmye','parentSegment','segment:folder:show','folderId','getSegmentSQL','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','345084JsOWAv','\x20Opening\x20','folder','Show\x20child\x20segment\x20schema\x20(column\x20types)','Fetching\x20parent\x20segment\x20details...','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','verbose','\x20folder','Resolved\x20YAML\x20file:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x27...','Error:\x20','web','Create\x20segment\x20folder\x20for\x20organization','listFolders','in\x20','12FQzFSg','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20type:\x20','\x20rows\x20','Target\x20path:\x20','Resolving\x20parent\x20folder\x20\x27','Examples:','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Folder\x20name:\x20','description','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Resolving\x20folder\x20\x27','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','test','Use:\x20tdx\x20ps\x20view\x20-w','jsonl','Use:\x20tdx\x20ps\x20sql','getFolder','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Site:\x20','Executing\x20segment\x20query...','Error:\x20Folder\x20reference\x20is\x20required','message','40kYVXUW','segment:folder:list','Fetching\x20SQL\x20for\x20segment...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','length','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','/app/ps/','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Segment\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','name','trim','query','27044sfhYwr','120824yNgelX','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolving\x20path\x20\x27','segment','toLocaleString','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','SEGMENT_NOT_FOUND','SQL\x20query:\x0a','createFolder','112895ujaAXX','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','segment:describe','cause','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segmentId','error','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','β\x20Found\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','fullPath','code','Creating\x20folder\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','type','Show\x20segment\x20folder\x20details','Fetching\x20folder\x20details...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','replace','Folder\x20ID:\x20','format','resolveParentId','Usage:\x20tdx\x20sg\x20desc\x20<name>','parentFolder','Parent\x20segment:\x20','Resolving\x20\x27','segment:folder:create','β\x20Query\x20completed:\x20Processed\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','elapsedTimeMillis','Use:\x20tdx\x20ps\x20desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','green','processedRows','setJobId','Resolved\x20folder\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','segment:sql','stats','execute','resolvePathToResource','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','128372CEBGNJ','(root)','segmentPath'];a27_0x2cce=function(){return _0x4e1c58;};return a27_0x2cce();}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x14b939(0x262)]=a27_0x14b939(0x229);[a27_0x14b939(0x247)]=a27_0x14b939(0x1e3);async['execute'](_0x2af68c){const _0x3b634f=a27_0x14b939,{options:_0xac476f,args:_0x447427,tdx:_0x3dcd25}=_0x2af68c;if(_0x447427[_0x3b634f(0x25b)]===0x0)return console[_0x3b634f(0x275)](_0x3b634f(0x255)),console['error'](_0x3b634f(0x1f2)),0x1;try{const {parentId:_0x5f2ed2,childId:_0x3ec82a}=parseSegmentRef(_0x447427[0x0]);_0xac476f[_0x3b634f(0x234)]&&(console[_0x3b634f(0x275)](_0x3b634f(0x253)+_0xac476f['site']),console['error'](_0x3b634f(0x205)+_0x5f2ed2),_0x3ec82a&&console[_0x3b634f(0x275)](_0x3b634f(0x246)+_0x3ec82a));if(!_0x3ec82a)return console['error'](_0x3b634f(0x237)),0x1;const _0x2bc656=await withSpinner(_0x3b634f(0x1e0)+_0x5f2ed2+_0x3b634f(0x238),()=>_0x3dcd25[_0x3b634f(0x269)][_0x3b634f(0x1ea)](_0x5f2ed2),{'verbose':_0xac476f[_0x3b634f(0x234)]}),_0xe26fc=_0x2bc656[_0x3b634f(0x204)];_0xac476f[_0x3b634f(0x234)]&&console[_0x3b634f(0x275)](_0x3b634f(0x21a)+_0xe26fc);const _0x1a3064=await withSpinner(_0x3b634f(0x24a)+_0x3ec82a+_0x3b634f(0x238),()=>_0x3dcd25[_0x3b634f(0x269)][_0x3b634f(0x25d)](_0xe26fc,_0x3ec82a),{'verbose':_0xac476f[_0x3b634f(0x234)]}),_0x4aa3d5=_0x1a3064[_0x3b634f(0x204)];_0xac476f[_0x3b634f(0x234)]&&console[_0x3b634f(0x275)](_0x3b634f(0x1f9)+_0x4aa3d5);const _0x3a656c=await withSpinner('Fetching\x20folder\x20\x27'+_0x3ec82a+_0x3b634f(0x238),()=>_0x3dcd25[_0x3b634f(0x269)][_0x3b634f(0x251)](_0x4aa3d5),{'verbose':_0xac476f[_0x3b634f(0x234)]});return await handleSDKOutput([_0x3a656c[_0x3b634f(0x204)]],_0xac476f),0x0;}catch(_0x57ddc6){if(_0x57ddc6 instanceof SDKError)return console[_0x3b634f(0x275)](_0x3b634f(0x239)+_0x57ddc6[_0x3b634f(0x256)]),_0x57ddc6[_0x3b634f(0x272)]&&console[_0x3b634f(0x275)](_0x3b634f(0x220)+_0x57ddc6[_0x3b634f(0x272)]),0x1;throw _0x57ddc6;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x14b939(0x262)]=a27_0x14b939(0x1fb);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x14b939(0x1fd)](_0x24f184){const _0x2bdd8e=a27_0x14b939,{options:_0x521abe,args:_0xe232aa,tdx:_0xbfaaac}=_0x24f184,_0x3c7317=_0xe232aa[0x0];if(!_0x3c7317)return console[_0x2bdd8e(0x275)](_0x2bdd8e(0x267)),console[_0x2bdd8e(0x275)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x2bdd8e(0x275)](_0x2bdd8e(0x249)),console[_0x2bdd8e(0x275)](_0x2bdd8e(0x244)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x2bdd8e(0x275)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x42c150=_0x521abe[_0x2bdd8e(0x228)],_0x3e3908=await resolveSegmentTarget(_0x3c7317,_0x42c150,_0x521abe[_0x2bdd8e(0x234)]);_0x521abe[_0x2bdd8e(0x234)]&&console[_0x2bdd8e(0x275)](_0x2bdd8e(0x242)+_0x3e3908);const _0x4e6045=await withSpinner(_0x2bdd8e(0x1ee)+_0x3c7317+_0x2bdd8e(0x238),()=>_0xbfaaac[_0x2bdd8e(0x269)][_0x2bdd8e(0x1fe)](_0x3e3908),{'verbose':_0x521abe[_0x2bdd8e(0x234)]}),_0x20d7d1=_0x4e6045[_0x2bdd8e(0x204)];_0x521abe[_0x2bdd8e(0x234)]&&(console['error'](_0x2bdd8e(0x240)+_0x20d7d1[_0x2bdd8e(0x1e2)]),console[_0x2bdd8e(0x275)](_0x2bdd8e(0x1de)+_0x20d7d1[_0x2bdd8e(0x208)]));if(_0x20d7d1[_0x2bdd8e(0x1e2)]===_0x2bdd8e(0x230))return console['error'](_0x2bdd8e(0x277)),console[_0x2bdd8e(0x275)](_0x2bdd8e(0x24b)),0x1;if(_0x20d7d1[_0x2bdd8e(0x1e2)]===_0x2bdd8e(0x20f))return console['error'](_0x2bdd8e(0x279)),console[_0x2bdd8e(0x275)](_0x2bdd8e(0x250)),0x1;if(!_0x20d7d1['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3c3a3a=await withSpinner(_0x2bdd8e(0x259),()=>_0xbfaaac[_0x2bdd8e(0x269)][_0x2bdd8e(0x22b)](_0x20d7d1[_0x2bdd8e(0x208)],_0x20d7d1[_0x2bdd8e(0x274)]),{'verbose':_0x521abe['verbose']}),_0x325021=_0x3c3a3a[_0x2bdd8e(0x204)];return _0x521abe['format']==='json'||_0x521abe[_0x2bdd8e(0x1e9)]===_0x2bdd8e(0x24f)?await handleSDKOutput([{'sql':_0x325021}],_0x521abe):console[_0x2bdd8e(0x218)](_0x325021),0x0;}catch(_0x593e80){if(_0x593e80 instanceof SDKError)return console[_0x2bdd8e(0x275)]('Error:\x20'+_0x593e80[_0x2bdd8e(0x256)]),_0x593e80[_0x2bdd8e(0x272)]&&console[_0x2bdd8e(0x275)]('\x20\x20Cause:\x20'+_0x593e80[_0x2bdd8e(0x272)]),0x1;throw _0x593e80;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x14b939(0x262)]=a27_0x14b939(0x1ef);[a27_0x14b939(0x247)]=a27_0x14b939(0x23b);async[a27_0x14b939(0x1fd)](_0x3e7aa4){const _0x59cc22=a27_0x14b939,{options:_0x532667,args:_0x3f6072,tdx:_0xa1daba}=_0x3e7aa4,_0x47ca05=_0x532667;if(_0x3f6072[_0x59cc22(0x25b)]<0x2)return console[_0x59cc22(0x275)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x59cc22(0x206)),0x1;const _0x3ee98c=_0x3f6072[0x0],_0x1efae1=_0x3f6072[0x1];_0x47ca05[_0x59cc22(0x234)]&&(console[_0x59cc22(0x275)](_0x59cc22(0x253)+_0x47ca05[_0x59cc22(0x209)]),console[_0x59cc22(0x275)](_0x59cc22(0x1ed)+_0x3ee98c),console[_0x59cc22(0x275)]('Folder\x20name:\x20'+_0x1efae1));let _0x34e9cf;if(_0x47ca05[_0x59cc22(0x1ec)]){const _0x33ae49=_0x47ca05[_0x59cc22(0x1ec)],_0x308ef8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3ee98c+_0x59cc22(0x238),()=>_0xa1daba[_0x59cc22(0x269)][_0x59cc22(0x1ea)](_0x3ee98c),{'verbose':_0x47ca05[_0x59cc22(0x234)]}),_0x195fdc=_0x308ef8[_0x59cc22(0x204)],_0x3d3a8e=await withSpinner(_0x59cc22(0x243)+_0x33ae49+_0x59cc22(0x238),()=>_0xa1daba[_0x59cc22(0x269)]['resolveFolderId'](_0x195fdc,_0x33ae49),{'verbose':_0x47ca05[_0x59cc22(0x234)]});_0x34e9cf=_0x3d3a8e[_0x59cc22(0x204)],_0x47ca05[_0x59cc22(0x234)]&&console[_0x59cc22(0x275)](_0x59cc22(0x248)+_0x34e9cf);}const _0x19fcc7={'name':_0x1efae1,'description':_0x47ca05[_0x59cc22(0x247)],'parentFolderId':_0x34e9cf},_0x31634f=await withSpinner(_0x59cc22(0x27e)+_0x1efae1+'\x27...',()=>_0xa1daba['segment'][_0x59cc22(0x26e)](_0x3ee98c,_0x19fcc7),{'verbose':_0x47ca05[_0x59cc22(0x234)]}),_0x3b4b40=_0x31634f[_0x59cc22(0x204)];return console[_0x59cc22(0x275)](_0x59cc22(0x214)+_0x3b4b40[_0x59cc22(0x262)]+_0x59cc22(0x20e)+_0x3b4b40['id']),await handleSDKOutput([_0x3b4b40],_0x47ca05),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x14b939(0x262)]='segment:view';[a27_0x14b939(0x247)]=a27_0x14b939(0x23f);async['execute'](_0x442a9a){const _0x2a66d5=a27_0x14b939,{options:_0x186f7b,args:_0x6de5dd,tdx:_0x1a809e}=_0x442a9a,_0x58265f=_0x6de5dd[0x0];if(!_0x58265f)return console[_0x2a66d5(0x275)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2a66d5(0x275)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x2a66d5(0x275)](_0x2a66d5(0x1f5)),console['error']('Options:'),console[_0x2a66d5(0x275)](_0x2a66d5(0x22c)),console[_0x2a66d5(0x275)](_0x2a66d5(0x244)),console['error'](_0x2a66d5(0x222)),console[_0x2a66d5(0x275)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x2a66d5(0x1e1)),console['error'](_0x2a66d5(0x233)),0x1;try{const _0x40cb36=_0x186f7b['parentSegment'],_0xff74c9=await resolveSegmentTarget(_0x58265f,_0x40cb36,_0x186f7b[_0x2a66d5(0x234)]);_0x186f7b[_0x2a66d5(0x234)]&&console[_0x2a66d5(0x275)](_0x2a66d5(0x242)+_0xff74c9);const _0x4ac5d8=await withSpinner(_0x2a66d5(0x1ee)+_0x58265f+_0x2a66d5(0x238),()=>_0x1a809e[_0x2a66d5(0x269)][_0x2a66d5(0x1fe)](_0xff74c9),{'verbose':_0x186f7b[_0x2a66d5(0x234)]}),_0x304036=_0x4ac5d8[_0x2a66d5(0x204)];_0x186f7b[_0x2a66d5(0x234)]&&(console[_0x2a66d5(0x275)](_0x2a66d5(0x240)+_0x304036[_0x2a66d5(0x1e2)]),console['error'](_0x2a66d5(0x1de)+_0x304036[_0x2a66d5(0x208)]),_0x304036[_0x2a66d5(0x22a)]&&console[_0x2a66d5(0x275)](_0x2a66d5(0x1e8)+_0x304036[_0x2a66d5(0x22a)]),_0x304036[_0x2a66d5(0x274)]&&console['error'](_0x2a66d5(0x260)+_0x304036['segmentId']));if(_0x186f7b[_0x2a66d5(0x23a)]){if(_0x304036['type']===_0x2a66d5(0x230))return console['error'](_0x2a66d5(0x245)),0x1;if(_0x304036['type']===_0x2a66d5(0x20f))return console[_0x2a66d5(0x275)](_0x2a66d5(0x25c)),console[_0x2a66d5(0x275)](_0x2a66d5(0x24e)),0x1;if(!_0x304036[_0x2a66d5(0x274)])throw new SDKError(ErrorCode[_0x2a66d5(0x26c)],_0x2a66d5(0x1e5));const _0x1cc75c=getConsoleNextUrl(_0x186f7b[_0x2a66d5(0x209)],'/app/ps/'+_0x304036['parentId']+_0x2a66d5(0x215)+_0x304036[_0x2a66d5(0x274)]);return console[_0x2a66d5(0x275)](a27_0x43b323[_0x2a66d5(0x1f6)]('β')+_0x2a66d5(0x22f)+a27_0x43b323['cyan'](_0x1cc75c)),openBrowser(_0x1cc75c),0x0;}if(_0x304036[_0x2a66d5(0x1e2)]==='folder'){if(!_0x304036[_0x2a66d5(0x22a)])throw new SDKError(ErrorCode[_0x2a66d5(0x1fa)],_0x2a66d5(0x1e6));const _0x9a5fe0=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1a809e[_0x2a66d5(0x269)][_0x2a66d5(0x251)](_0x304036[_0x2a66d5(0x22a)]),{'verbose':_0x186f7b[_0x2a66d5(0x234)]});await handleSingleObjectOutput(_0x9a5fe0[_0x2a66d5(0x204)],_0x186f7b);}else{if(_0x304036[_0x2a66d5(0x1e2)]===_0x2a66d5(0x269)){if(!_0x304036[_0x2a66d5(0x274)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2a66d5(0x1e5));const _0x3f7587=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1a809e[_0x2a66d5(0x269)]['getSegment'](_0x304036[_0x2a66d5(0x208)],_0x304036[_0x2a66d5(0x274)]),{'verbose':_0x186f7b[_0x2a66d5(0x234)]}),_0x4e0a9f=getConsoleNextUrl(_0x186f7b[_0x2a66d5(0x209)],_0x2a66d5(0x25e)+_0x304036['parentId']+'/e/'+_0x304036[_0x2a66d5(0x274)]),_0x3df02b=_0x3f7587['data'];_0x3df02b['url']=_0x4e0a9f,await handleSingleObjectOutput(_0x3df02b,_0x186f7b);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x2a66d5(0x226)),0x1;}return 0x0;}catch(_0x1b3cb6){if(_0x1b3cb6 instanceof SDKError)return console['error'](_0x2a66d5(0x239)+_0x1b3cb6[_0x2a66d5(0x256)]),_0x1b3cb6[_0x2a66d5(0x272)]&&console['error'](_0x2a66d5(0x220)+_0x1b3cb6[_0x2a66d5(0x272)]),0x1;throw _0x1b3cb6;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';[a27_0x14b939(0x247)]=a27_0x14b939(0x231);async[a27_0x14b939(0x1fd)](_0x36ff40){const _0x508b5a=a27_0x14b939,{options:_0x6526e9,args:_0x344f36,tdx:_0x3b5b06}=_0x36ff40,_0x5c8ef2=_0x344f36[0x0];if(!_0x5c8ef2)return console[_0x508b5a(0x275)](_0x508b5a(0x267)),console[_0x508b5a(0x275)](_0x508b5a(0x1eb)),console['error'](_0x508b5a(0x25a)),console['error'](_0x508b5a(0x244)),console[_0x508b5a(0x275)](_0x508b5a(0x217)),console[_0x508b5a(0x275)](_0x508b5a(0x1ff)),0x1;try{const _0x2641fa=_0x6526e9['parentSegment'],_0x39ff9f=await resolveSegmentTarget(_0x5c8ef2,_0x2641fa,_0x6526e9['verbose']);_0x6526e9['verbose']&&console['error'](_0x508b5a(0x242)+_0x39ff9f);const _0x4d539f=await withSpinner(_0x508b5a(0x1ee)+_0x5c8ef2+_0x508b5a(0x238),()=>_0x3b5b06[_0x508b5a(0x269)][_0x508b5a(0x1fe)](_0x39ff9f),{'verbose':_0x6526e9['verbose']}),_0x209673=_0x4d539f[_0x508b5a(0x204)];_0x6526e9[_0x508b5a(0x234)]&&(console[_0x508b5a(0x275)](_0x508b5a(0x240)+_0x209673[_0x508b5a(0x1e2)]),console[_0x508b5a(0x275)]('Parent\x20ID:\x20'+_0x209673['parentId']));if(_0x209673[_0x508b5a(0x1e2)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x508b5a(0x275)](_0x508b5a(0x24b)),0x1;if(_0x209673[_0x508b5a(0x1e2)]===_0x508b5a(0x20f))return console[_0x508b5a(0x275)](_0x508b5a(0x252)),console[_0x508b5a(0x275)](_0x508b5a(0x1f4)),0x1;if(!_0x209673[_0x508b5a(0x274)])throw new SDKError(ErrorCode[_0x508b5a(0x26c)],_0x508b5a(0x1e5));const _0x5269ae=await withSpinner(_0x508b5a(0x259),()=>_0x3b5b06['segment'][_0x508b5a(0x22b)](_0x209673[_0x508b5a(0x208)],_0x209673[_0x508b5a(0x274)]),{'verbose':_0x6526e9[_0x508b5a(0x234)]}),_0x15ced4=_0x5269ae[_0x508b5a(0x204)],_0x5aa172=await executeSchemaQuery(_0x15ced4,_0x3b5b06,_0x6526e9);return await handleQueryOutput(_0x5aa172,_0x6526e9),0x0;}catch(_0x51de0c){if(_0x51de0c instanceof SDKError)return console[_0x508b5a(0x275)](_0x508b5a(0x239)+_0x51de0c[_0x508b5a(0x256)]),_0x51de0c['cause']&&console['error'](_0x508b5a(0x220)+_0x51de0c[_0x508b5a(0x272)]),0x1;throw _0x51de0c;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x3320a0=a28_0x75b4;(function(_0x5a467a,_0x28a502){const _0x37d9d9=a28_0x75b4,_0x34fc34=_0x5a467a();while(!![]){try{const _0xc0bf0a=-parseInt(_0x37d9d9(0x183))/0x1*(parseInt(_0x37d9d9(0x18d))/0x2)+parseInt(_0x37d9d9(0x17c))/0x3*(-parseInt(_0x37d9d9(0x175))/0x4)+-parseInt(_0x37d9d9(0x17f))/0x5*(-parseInt(_0x37d9d9(0x173))/0x6)+parseInt(_0x37d9d9(0x19c))/0x7+parseInt(_0x37d9d9(0x178))/0x8+-parseInt(_0x37d9d9(0x18f))/0x9*(parseInt(_0x37d9d9(0x17e))/0xa)+parseInt(_0x37d9d9(0x191))/0xb*(parseInt(_0x37d9d9(0x188))/0xc);if(_0xc0bf0a===_0x28a502)break;else _0x34fc34['push'](_0x34fc34['shift']());}catch(_0x16d3c7){_0x34fc34['push'](_0x34fc34['shift']());}}}(a28_0x6596,0x884e7));function a28_0x75b4(_0x18f7aa,_0xc1538b){_0x18f7aa=_0x18f7aa-0x16e;const _0x65961b=a28_0x6596();let _0x75b40=_0x65961b[_0x18f7aa];return _0x75b40;}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_0x421407 from'chalk';function a28_0x6596(){const _0x3ed0d4=['invisible','Site:\x20','360276IHATvM','resolveParentId','16540VFKLid','4210340XFtmaH','data','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolved\x20folder\x20ID:\x20','9RGxuPY','type','\x20\x20\x20Path:\x20','segments','yellow','60UxUCNX','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment:create','name','resolvePathToResource','80702foxUTw','rule','1980jpRByu','Examples:','1392017Peclhp','parent','ruleFile','Resolving\x20folder\x20path\x20\x27','site','verbose','error','folder','Creating\x20segment\x20\x27','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','4238346zVDZOZ','\x27...','folderId','resolveFolderId','β\x20Created\x20segment\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','length','Resolving\x20parent\x20segment\x20\x27','includes','segmentPath','noCountPopulation','6USgrOn','createSegment','28kCjJGk','kind','segment','365704NletQc','Target\x20path:\x20'];a28_0x6596=function(){return _0x3ed0d4;};return a28_0x6596();}export class SegmentCreateCommand extends BaseCommand{[a28_0x3320a0(0x18b)]=a28_0x3320a0(0x18a);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x55bf31){const _0x3092dc=a28_0x3320a0;console[_0x3092dc(0x197)](a28_0x421407[_0x3092dc(0x187)](_0x3092dc(0x19a))),console[_0x3092dc(0x197)](a28_0x421407[_0x3092dc(0x187)](_0x3092dc(0x1a1)));const {options:_0x3a9f27,args:_0x5e2f02,tdx:_0xaee54d}=_0x55bf31,_0xf3ea5b=_0x3a9f27;if(_0x5e2f02[_0x3092dc(0x16e)]===0x0)return console['error'](_0x3092dc(0x189)),console[_0x3092dc(0x197)](_0x3092dc(0x181)),console[_0x3092dc(0x197)](_0x3092dc(0x190)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x3092dc(0x197)](_0x3092dc(0x19b)),console['error'](_0x3092dc(0x1a2)),0x1;const _0x233abe=_0x5e2f02[0x0],_0x3047d4=_0x3a9f27[_0x3092dc(0x171)];let _0x22d68b=_0x233abe;_0x3047d4&&!_0x233abe[_0x3092dc(0x170)]('/')&&(_0x22d68b=_0x3047d4+'/'+_0x233abe,_0xf3ea5b[_0x3092dc(0x196)]&&console[_0x3092dc(0x197)]('Resolved\x20relative\x20path\x20to:\x20'+_0x22d68b));const _0x51835c=parsePath(_0x22d68b);if(_0x51835c[_0x3092dc(0x186)][_0x3092dc(0x16e)]<0x2)return console[_0x3092dc(0x197)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x3092dc(0x197)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x5c4aaa=_0x51835c[_0x3092dc(0x186)][0x0],_0x2d89c7=getBaseName(_0x22d68b),_0x169e39=getParentPath(_0x22d68b);_0xf3ea5b['verbose']&&(console['error'](_0x3092dc(0x17b)+_0xf3ea5b[_0x3092dc(0x195)]),console[_0x3092dc(0x197)](_0x3092dc(0x179)+_0x22d68b),console['error']('Parent:\x20'+_0x5c4aaa),console[_0x3092dc(0x197)]('Segment\x20name:\x20'+_0x2d89c7),console[_0x3092dc(0x197)]('Parent\x20path:\x20'+_0x169e39));const _0x32f174=await withSpinner(_0x3092dc(0x16f)+_0x5c4aaa+_0x3092dc(0x19d),()=>_0xaee54d[_0x3092dc(0x177)][_0x3092dc(0x17d)](_0x5c4aaa),{'verbose':_0xf3ea5b[_0x3092dc(0x196)]}),_0x59ca53=_0x32f174[_0x3092dc(0x180)];let _0x244e35;if(_0x51835c['segments'][_0x3092dc(0x16e)]>0x2){const _0x2d5fb7=await withSpinner(_0x3092dc(0x194)+_0x169e39+_0x3092dc(0x19d),()=>_0xaee54d[_0x3092dc(0x177)][_0x3092dc(0x18c)](_0x169e39),{'verbose':_0xf3ea5b['verbose']}),_0x4c70e8=_0x2d5fb7['data'];if(_0x4c70e8[_0x3092dc(0x184)]!==_0x3092dc(0x198)&&_0x4c70e8[_0x3092dc(0x184)]!==_0x3092dc(0x192))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x244e35=_0x4c70e8[_0x3092dc(0x19e)];}else{if(_0xf3ea5b[_0x3092dc(0x198)]){const _0x10cbc9=await withSpinner('Resolving\x20folder\x20\x27'+_0xf3ea5b[_0x3092dc(0x198)]+_0x3092dc(0x19d),()=>_0xaee54d[_0x3092dc(0x177)][_0x3092dc(0x19f)](_0x59ca53,_0xf3ea5b['folder']),{'verbose':_0xf3ea5b[_0x3092dc(0x196)]});_0x244e35=_0x10cbc9[_0x3092dc(0x180)];}}_0xf3ea5b['verbose']&&_0x244e35&&console['error'](_0x3092dc(0x182)+_0x244e35);const _0x139d52=await loadJSONFromOptions(_0xf3ea5b[_0x3092dc(0x18e)],_0xf3ea5b[_0x3092dc(0x193)]),_0x466fe8={'name':_0x2d89c7,'description':_0xf3ea5b['description'],'rule':_0x139d52,'kind':_0xf3ea5b[_0x3092dc(0x176)]!==undefined?parseInt(_0xf3ea5b['kind'],0xa):undefined,'isVisible':_0xf3ea5b[_0x3092dc(0x17a)]?![]:undefined,'segmentFolderId':_0x244e35,'countPopulation':_0xf3ea5b[_0x3092dc(0x172)]?![]:undefined},_0x39d84b=await withSpinner(_0x3092dc(0x199)+_0x2d89c7+'\x27...',()=>_0xaee54d[_0x3092dc(0x177)][_0x3092dc(0x174)](_0x59ca53,_0x466fe8),{'verbose':_0xf3ea5b[_0x3092dc(0x196)]}),_0x5b12a4=_0x39d84b[_0x3092dc(0x180)];return console[_0x3092dc(0x197)](_0x3092dc(0x1a0)+_0x5b12a4['name']+'\x27\x20with\x20ID:\x20'+_0x5b12a4['id']),_0x22d68b!==_0x233abe&&console[_0x3092dc(0x197)](_0x3092dc(0x185)+_0x22d68b),await handleSDKOutput([_0x5b12a4],_0xf3ea5b),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a29_0x43bd(){const _0x39d128=['verbose','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','name','9922zXTApp','length','579547TJRHze','\x20field','error','2946312uJIanS','Error:\x20Parent\x20segment\x20name\x20is\x20required','listFields','\x27...','4216DaFReY','β\x20Found\x20','15561ICUsGx','3772590iWpDZO','22zHUceZ','parentSegment','segment','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','3028kAmjAc','12rtzhsr','description','582LtsURA','Listing\x20fields\x20for\x20\x27','Parent\x20segment:\x20','4703951bDvwrV','data','Site:\x20','jsonl','execute','6595ethOVi'];a29_0x43bd=function(){return _0x39d128;};return a29_0x43bd();}const a29_0x3f51a4=a29_0x12e4;(function(_0x41a153,_0x597053){const _0x90c275=a29_0x12e4,_0x2e61e7=_0x41a153();while(!![]){try{const _0x2dd146=-parseInt(_0x90c275(0x125))/0x1+parseInt(_0x90c275(0x123))/0x2*(-parseInt(_0x90c275(0x117))/0x3)+-parseInt(_0x90c275(0x114))/0x4*(-parseInt(_0x90c275(0x11f))/0x5)+-parseInt(_0x90c275(0x115))/0x6*(-parseInt(_0x90c275(0x11a))/0x7)+-parseInt(_0x90c275(0x12c))/0x8*(parseInt(_0x90c275(0x12e))/0x9)+parseInt(_0x90c275(0x12f))/0xa+parseInt(_0x90c275(0x130))/0xb*(parseInt(_0x90c275(0x128))/0xc);if(_0x2dd146===_0x597053)break;else _0x2e61e7['push'](_0x2e61e7['shift']());}catch(_0xed4f5a){_0x2e61e7['push'](_0x2e61e7['shift']());}}}(a29_0x43bd,0xb8f70));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a29_0x12e4(_0xa3e92d,_0x5d7080){_0xa3e92d=_0xa3e92d-0x112;const _0x43bd69=a29_0x43bd();let _0x12e48c=_0x43bd69[_0xa3e92d];return _0x12e48c;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x3f51a4(0x122)]='segment:fields';[a29_0x3f51a4(0x116)]='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x3f51a4(0x11e)](_0x1e8674){const _0x21b6f0=a29_0x3f51a4,{options:_0x2687bf,args:_0x2a3af5,tdx:_0x1d2f6b}=_0x1e8674,_0x41bbb9=_0x2a3af5[0x0]||_0x2687bf[_0x21b6f0(0x131)];if(!_0x41bbb9)return console[_0x21b6f0(0x127)](_0x21b6f0(0x129)),console[_0x21b6f0(0x127)](_0x21b6f0(0x113)),console['error'](_0x21b6f0(0x121)),0x1;_0x2687bf[_0x21b6f0(0x120)]&&(console[_0x21b6f0(0x127)](_0x21b6f0(0x11c)+_0x2687bf['site']),console[_0x21b6f0(0x127)](_0x21b6f0(0x119)+_0x41bbb9));const _0xad46d8=await withSpinner(_0x21b6f0(0x118)+_0x41bbb9+_0x21b6f0(0x12b),()=>_0x1d2f6b[_0x21b6f0(0x112)][_0x21b6f0(0x12a)](_0x41bbb9),{'verbose':_0x2687bf['verbose']}),_0x39a56f=_0xad46d8[_0x21b6f0(0x11b)];console[_0x21b6f0(0x127)](_0x21b6f0(0x12d)+_0x39a56f[_0x21b6f0(0x124)]+_0x21b6f0(0x126)+(_0x39a56f[_0x21b6f0(0x124)]!==0x1?'s':''));if(_0x2687bf['json']||_0x2687bf[_0x21b6f0(0x11d)])return await handleSDKOutput(_0x39a56f,_0x2687bf),0x0;return displayFieldsHumanReadable(_0x39a56f,_0x41bbb9),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a30_0x7710(){const _0x2fda81=['helpText','parentSegment','session','\x20journeys','cyan','32217AaSCPQ','dirname','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','cwd','parent_segment','journeyVersions','hasChanges','filter','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Pulling\x20segments\x20from\x20\x27','155asJlvb','\x27...','targetDir','isNew','setPhase','data','green','site','\x0aChanges\x20to\x20\x27','pullSegments','Site:\x20','segments','Error:\x20','\x20new\x20files','β\x20Pulled\x20','β\x20All\x20files\x20are\x20up\x20to\x20date','segment','length','type','\x20\x20πΊοΈ\x20\x20','\x20files?','\x20activations','dryRun','271002XEbRxz','resourceName','\x20with\x20','no_parent','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','9812901mUgvJL','1837908exqCQk','name','files','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','1436648ShltiW','error','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)','yellow','dim','\x20versions)','utf-8','relativePath','Aborted.','\x20files\x20to\x20','\x20changed\x20files','execute','\x20=\x20','errorCode','parentName','β\x20Context\x20set:\x20','verbose','1674300ZvrfRb','9wPMgAW','absolutePath','\x0aError:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','diff','\x20\x20π―\x20','counts','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','2735416PGBNqM','repeat','\x20unchanged\x20files','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation'];a30_0x7710=function(){return _0x2fda81;};return a30_0x7710();}const a30_0x533de9=a30_0x4a44;(function(_0x4e102a,_0x4c4467){const _0x189311=a30_0x4a44,_0x58c1af=_0x4e102a();while(!![]){try{const _0xc4df9a=-parseInt(_0x189311(0x15a))/0x1+parseInt(_0x189311(0x196))/0x2+parseInt(_0x189311(0x181))/0x3+-parseInt(_0x189311(0x19f))/0x4+-parseInt(_0x189311(0x164))/0x5*(parseInt(_0x189311(0x17b))/0x6)+parseInt(_0x189311(0x180))/0x7+-parseInt(_0x189311(0x185))/0x8*(-parseInt(_0x189311(0x197))/0x9);if(_0xc4df9a===_0x4c4467)break;else _0x58c1af['push'](_0x58c1af['shift']());}catch(_0x14e9f8){_0x58c1af['push'](_0x58c1af['shift']());}}}(a30_0x7710,0xdf612));function a30_0x4a44(_0x2c8e82,_0x3a9776){_0x2c8e82=_0x2c8e82-0x156;const _0x7710f6=a30_0x7710();let _0x4a44f4=_0x7710f6[_0x2c8e82];return _0x4a44f4;}import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x32dc83 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x48194f 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{[a30_0x533de9(0x182)]='segment:pull';['description']=a30_0x533de9(0x19e);async[a30_0x533de9(0x190)](_0x4ca853){const _0x3bc9ca=a30_0x533de9,{options:_0x6bca86,args:_0x4c9a14,tdx:_0x404a1e}=_0x4ca853,_0x551a4a=_0x6bca86,_0x3d7a5d=await resolveTarget({'arg':_0x4c9a14[0x0],'contextParent':_0x6bca86[_0x3bc9ca(0x156)],'cwd':process[_0x3bc9ca(0x15d)]()});if(!isSuccessfulResolution(_0x3d7a5d))return _0x3d7a5d[_0x3bc9ca(0x192)]===_0x3bc9ca(0x17e)?(console[_0x3bc9ca(0x186)](a30_0x32dc83[_0x3bc9ca(0x188)](_0x3bc9ca(0x184))),console['error'](_0x3bc9ca(0x187)),console[_0x3bc9ca(0x186)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x3bc9ca(0x186)](_0x3bc9ca(0x19a))):(console[_0x3bc9ca(0x186)](a30_0x32dc83['red'](_0x3bc9ca(0x170)+_0x3d7a5d['message']+'\x0a')),_0x3d7a5d[_0x3bc9ca(0x1a3)]&&console['error'](a30_0x32dc83[_0x3bc9ca(0x159)](_0x3d7a5d[_0x3bc9ca(0x1a3)]))),0x1;const _0x20e54f=_0x3d7a5d[_0x3bc9ca(0x193)],_0x227756=_0x3d7a5d['targetDir'],_0x5135c7=_0x3d7a5d[_0x3bc9ca(0x176)]==='file'?_0x3d7a5d[_0x3bc9ca(0x17c)]:undefined;_0x551a4a['verbose']&&(console[_0x3bc9ca(0x186)](_0x3bc9ca(0x16e)+_0x551a4a[_0x3bc9ca(0x16b)]),console['error']('Parent\x20segment:\x20'+_0x20e54f),_0x5135c7&&console['error']('Target\x20resource:\x20'+_0x5135c7));const _0x484e21=await withProgressSpinner(_0x3bc9ca(0x163)+_0x20e54f+_0x3bc9ca(0x165),_0x4c345a=>_0x404a1e[_0x3bc9ca(0x174)][_0x3bc9ca(0x16d)](_0x20e54f,{'targetDir':_0x227756,'targetResourceName':_0x5135c7,'verbose':_0x551a4a[_0x3bc9ca(0x195)],'progress':{'update':_0x5b3fdb=>{const _0x1a1d55=_0x3bc9ca;_0x4c345a[_0x1a1d55(0x168)](_0x5b3fdb),_0x551a4a[_0x1a1d55(0x195)]&&console[_0x1a1d55(0x186)]('\x20\x20'+_0x5b3fdb);}}}),{'verbose':_0x551a4a[_0x3bc9ca(0x195)]}),_0x1fad74=_0x484e21[_0x3bc9ca(0x169)];if(_0x1fad74[_0x3bc9ca(0x19d)][_0x3bc9ca(0x16f)]===0x0&&_0x1fad74[_0x3bc9ca(0x19d)]['journeys']===0x0)return console[_0x3bc9ca(0x186)](a30_0x32dc83['yellow'](_0x3bc9ca(0x17f)+_0x1fad74[_0x3bc9ca(0x193)]+'\x27')),0x0;const _0x32cb44=_0x1fad74['files'][_0x3bc9ca(0x161)](_0x419263=>_0x419263[_0x3bc9ca(0x167)]),_0xc56ac0=_0x1fad74[_0x3bc9ca(0x183)]['filter'](_0xc3dfa0=>!_0xc3dfa0['isNew']&&_0xc3dfa0[_0x3bc9ca(0x160)]),_0x299e5d=_0x1fad74['files'][_0x3bc9ca(0x161)](_0x16d735=>!_0x16d735[_0x3bc9ca(0x167)]&&!_0x16d735[_0x3bc9ca(0x160)]);console[_0x3bc9ca(0x186)]('\x0aPull\x20summary\x20for\x20\x27'+_0x1fad74[_0x3bc9ca(0x193)]+'\x27:'),console[_0x3bc9ca(0x186)](_0x3bc9ca(0x19c)+a30_0x32dc83['cyan'](_0x1fad74[_0x3bc9ca(0x19d)]['segments']+'\x20segments')+_0x3bc9ca(0x17d)+a30_0x32dc83[_0x3bc9ca(0x159)](_0x1fad74[_0x3bc9ca(0x19d)]['activations']+_0x3bc9ca(0x179)));if(_0x1fad74['counts']['journeys']>0x0){const _0x3b7ea6=_0x1fad74[_0x3bc9ca(0x19d)][_0x3bc9ca(0x15f)]>_0x1fad74[_0x3bc9ca(0x19d)]['journeys']?'\x20('+_0x1fad74['counts'][_0x3bc9ca(0x15f)]+_0x3bc9ca(0x18a):'';console[_0x3bc9ca(0x186)](_0x3bc9ca(0x177)+a30_0x32dc83[_0x3bc9ca(0x159)](_0x1fad74['counts']['journeys']+_0x3bc9ca(0x158))+a30_0x32dc83['dim'](_0x3b7ea6));}console['error']('\x20\x20'+a30_0x32dc83[_0x3bc9ca(0x16a)]('+\x20'+_0x32cb44[_0x3bc9ca(0x175)]+_0x3bc9ca(0x171))),console[_0x3bc9ca(0x186)]('\x20\x20'+a30_0x32dc83[_0x3bc9ca(0x188)]('~\x20'+_0xc56ac0[_0x3bc9ca(0x175)]+_0x3bc9ca(0x18f))),console[_0x3bc9ca(0x186)]('\x20\x20'+a30_0x32dc83[_0x3bc9ca(0x189)]('=\x20'+_0x299e5d['length']+_0x3bc9ca(0x1a1))),console['error']('\x20\x20Target:\x20'+a30_0x32dc83[_0x3bc9ca(0x159)](_0x1fad74[_0x3bc9ca(0x166)])+'\x0a');if(_0xc56ac0[_0x3bc9ca(0x175)]>0x0)for(const _0x2a7d7c of _0xc56ac0){console['error'](_0x3bc9ca(0x16c)+_0x2a7d7c[_0x3bc9ca(0x18c)]+'\x27:'),console[_0x3bc9ca(0x186)]('β'['repeat'](0x3c)),console[_0x3bc9ca(0x186)](_0x2a7d7c[_0x3bc9ca(0x19b)]),console['error']('β'[_0x3bc9ca(0x1a0)](0x3c));}if(_0x551a4a[_0x3bc9ca(0x17a)])return console['error'](a30_0x32dc83[_0x3bc9ca(0x188)](_0x3bc9ca(0x15c))),0x0;if(_0x32cb44['length']===0x0&&_0xc56ac0[_0x3bc9ca(0x175)]===0x0)return console[_0x3bc9ca(0x186)](a30_0x32dc83[_0x3bc9ca(0x16a)](_0x3bc9ca(0x173))),saveSessionContext({'parent_segment':_0x1fad74[_0x3bc9ca(0x193)]},_0x551a4a[_0x3bc9ca(0x157)]),console[_0x3bc9ca(0x186)](a30_0x32dc83['green'](_0x3bc9ca(0x194)+a30_0x32dc83[_0x3bc9ca(0x189)](_0x3bc9ca(0x15e))+_0x3bc9ca(0x191)+a30_0x32dc83[_0x3bc9ca(0x159)](_0x1fad74[_0x3bc9ca(0x193)]))),0x0;if(!_0x551a4a['yes']){if(!isInteractive())return console['error'](a30_0x32dc83['red'](_0x3bc9ca(0x199)),_0x3bc9ca(0x162)),console[_0x3bc9ca(0x186)](a30_0x32dc83[_0x3bc9ca(0x189)](_0x3bc9ca(0x1a2))),0x1;const _0x54a468=await confirmKey('Write\x20'+(_0x32cb44[_0x3bc9ca(0x175)]+_0xc56ac0[_0x3bc9ca(0x175)])+_0x3bc9ca(0x178));if(!_0x54a468)return console[_0x3bc9ca(0x186)](a30_0x32dc83[_0x3bc9ca(0x188)](_0x3bc9ca(0x18d)),'-\x20no\x20files\x20written'),0x1;}for(const _0x209284 of _0x1fad74[_0x3bc9ca(0x183)]){if(_0x209284[_0x3bc9ca(0x167)]||_0x209284['hasChanges']){const _0x15ed69=a30_0x48194f[_0x3bc9ca(0x15b)](_0x209284[_0x3bc9ca(0x198)]);!existsSync(_0x15ed69)&&mkdirSync(_0x15ed69,{'recursive':!![]}),writeFileSync(_0x209284[_0x3bc9ca(0x198)],_0x209284['content'],_0x3bc9ca(0x18b));}}return console[_0x3bc9ca(0x186)](a30_0x32dc83['green'](_0x3bc9ca(0x172)+(_0x32cb44[_0x3bc9ca(0x175)]+_0xc56ac0[_0x3bc9ca(0x175)])+_0x3bc9ca(0x18e)+_0x1fad74[_0x3bc9ca(0x166)])),saveSessionContext({'parent_segment':_0x1fad74['parentName']},_0x551a4a[_0x3bc9ca(0x157)]),console['error'](a30_0x32dc83[_0x3bc9ca(0x16a)](_0x3bc9ca(0x194)+a30_0x32dc83['dim'](_0x3bc9ca(0x15e))+_0x3bc9ca(0x191)+a30_0x32dc83[_0x3bc9ca(0x159)](_0x1fad74[_0x3bc9ca(0x193)]))),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_0x4eb3d7=a31_0x33d2;(function(_0x36606d,_0x3fd7df){const _0x3bf464=a31_0x33d2,_0x425cc0=_0x36606d();while(!![]){try{const _0x20d72a=parseInt(_0x3bf464(0x1bd))/0x1+-parseInt(_0x3bf464(0x242))/0x2+parseInt(_0x3bf464(0x231))/0x3*(-parseInt(_0x3bf464(0x223))/0x4)+-parseInt(_0x3bf464(0x1ce))/0x5*(parseInt(_0x3bf464(0x213))/0x6)+parseInt(_0x3bf464(0x1b3))/0x7+parseInt(_0x3bf464(0x23c))/0x8+-parseInt(_0x3bf464(0x204))/0x9*(-parseInt(_0x3bf464(0x1dc))/0xa);if(_0x20d72a===_0x3fd7df)break;else _0x425cc0['push'](_0x425cc0['shift']());}catch(_0x499ac0){_0x425cc0['push'](_0x425cc0['shift']());}}}(a31_0x1c6a,0x67b65));function a31_0x1c6a(){const _0x306bf4=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','setPhase','\x0aValidation\x20failed:','parentFolder','nameToId','New\x20journey:','error','listJourneysWithDetailsFromParentSegment','journeysOnly','Fetching\x20existing\x20segments...','3024665NXIGvl','red','errorCode','\x20changed','endsWith','toString','\x20\x20π\x20Segments:','folderId','verbose','listActivations','327429aSEHnG','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','buildUserMaps','deleted','Resolving\x20parent\x20segment\x20\x27','audienceId','description','length','Fetching\x20existing\x20folders...','parentSegment','resolveParentId','data','get','type','/app/ps/','createdSegmentIds','285vMXQCc','blue','unchanged','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)','Aborted.','Site:\x20','Changes\x20to:','site','helpText','name','cyan','\x20to\x20create','all','map','29850RQULif','connection','repeat','segments','relationships','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','journeyBundleName','execute','/j/da/je','updated','toUpdate','cwd','createdAt','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','getOutputSchemaWithCache','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','activations','filter','file','Push\x20','\x20updated','Changes\x20to\x20journey:','\x20\x20Activations:','set','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','parent_name','\x20changes?','message','list','versionNumber','isNew','Fetching\x20existing\x20journeys...','updatedAt','filePath','toDelete','parentName','Scoped\x20to\x20folder:\x20','segment:push','nameToType','.yml','297AkeIKJ','join','\x20\x20πΊοΈ\x20\x20Journeys:','scopedFolderPath','then','yamlConfig','isScoped','folderPath','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','green','changed','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','π\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','segment\x20or\x20journey','65346lPHfZX','created','user','\x20\x20Activations:\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20to\x20update','existingJourney','results','toCreate','\x0aError:','\x20\x20\x20\x20','Error:\x20','no_parent','Fetching\x20parent\x20segment\x20details...','segment','New\x20segment:','8Plrieq','journeyId','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20YAML\x20files\x20found','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20to\x20delete','Error\x20parsing\x20YAML:\x20','(Journey\x20will\x20be\x20deleted)','Folders\x20to\x20create:','yellow','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','targetDir','Source\x20directory:\x20','attributes','444774QdPUWY','\x20activations]','delete','journeys','\x20new','\x20created','add','Parent\x20segment:\x20','segmentFolderId','idToName','diff','4157320yzvttO','push','getParent','\x20deleted','dim','\x0aPush\x20summary\x20for\x20\x27','71172SkgaqO','Delete\x20segment:','getJourney','journeyBundleId','journey'];a31_0x1c6a=function(){return _0x306bf4;};return a31_0x1c6a();}import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x3c19d4 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a31_0x33d2(_0x37ce65,_0x56b63a){_0x37ce65=_0x37ce65-0x1b1;const _0x1c6a50=a31_0x1c6a();let _0x33d270=_0x1c6a50[_0x37ce65];return _0x33d270;}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_0x4eb3d7(0x201);[a31_0x4eb3d7(0x1c4)]=a31_0x4eb3d7(0x20c);async[a31_0x4eb3d7(0x1e3)](_0x39f605){const _0x164267=a31_0x4eb3d7,{options:_0x504af2,args:_0x5b65dd,tdx:_0x3295d9}=_0x39f605,_0x273847=_0x504af2,_0x19766e=await resolveTarget({'arg':_0x5b65dd[0x0],'contextParent':_0x504af2[_0x164267(0x1c7)],'cwd':process[_0x164267(0x1e7)]()});if(!isSuccessfulResolution(_0x19766e))return _0x19766e[_0x164267(0x1b5)]===_0x164267(0x21f)?(console[_0x164267(0x24d)](a31_0x3c19d4['yellow'](_0x164267(0x1f4))),console[_0x164267(0x24d)](_0x164267(0x1d1)),console[_0x164267(0x24d)](_0x164267(0x247)),console[_0x164267(0x24d)](_0x164267(0x20f))):(console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x21e)+_0x19766e['message']+'\x0a')),_0x19766e[_0x164267(0x1d6)]&&console['error'](a31_0x3c19d4[_0x164267(0x1d8)](_0x19766e[_0x164267(0x1d6)]))),0x1;if(_0x19766e[_0x164267(0x1cb)]===_0x164267(0x1f5))return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)]('Error:\x20Directory\x20not\x20found:\x20'+_0x19766e['targetDir']+'\x0a')),console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1d8)](_0x164267(0x1eb))),0x1;const _0x58e4e6=_0x19766e[_0x164267(0x1ff)],_0x1b3962=_0x19766e[_0x164267(0x22e)],_0x1f3b9f=_0x19766e['type']===_0x164267(0x1ee)?_0x19766e[_0x164267(0x1fd)]:undefined,_0x532167=getScopedDetails(_0x19766e),_0x3b4580=_0x532167?.[_0x164267(0x20a)]??![],_0x402998=_0x532167?.[_0x164267(0x207)]??'';if(!existsSync(_0x1b3962))return console[_0x164267(0x24d)](a31_0x3c19d4['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x1b3962+'\x0a')),console[_0x164267(0x24d)](a31_0x3c19d4['cyan'](_0x164267(0x1eb))),0x1;_0x273847[_0x164267(0x1bb)]&&(console[_0x164267(0x24d)](_0x164267(0x1d3)+_0x273847['site']),console['error'](_0x164267(0x238)+_0x58e4e6),console[_0x164267(0x24d)](_0x164267(0x22f)+_0x1b3962),_0x3b4580&&console['error'](_0x164267(0x200)+_0x402998));const _0x479944=await withSpinner(_0x164267(0x1c2)+_0x58e4e6+'\x27...',()=>_0x3295d9['segment'][_0x164267(0x1c8)](_0x58e4e6),{'verbose':_0x273847[_0x164267(0x1bb)]}),_0x56fdb8=_0x479944[_0x164267(0x1c9)],[_0x27af39,_0x44ef6e,_0x58c268,_0x285123,_0x299df7]=await Promise[_0x164267(0x1da)]([withSpinner(_0x164267(0x220),()=>_0x3295d9[_0x164267(0x221)][_0x164267(0x23e)](_0x56fdb8),{'verbose':_0x273847['verbose']}),withSpinner(_0x164267(0x1b2),()=>_0x3295d9[_0x164267(0x221)]['listSegments'](_0x56fdb8),{'verbose':_0x273847['verbose']}),withSpinner(_0x164267(0x1c6),()=>_0x3295d9[_0x164267(0x221)]['listFolders'](_0x56fdb8),{'verbose':_0x273847['verbose']}),withSpinner(_0x164267(0x1fb),()=>_0x3295d9[_0x164267(0x246)][_0x164267(0x24e)](_0x56fdb8,{'includeAllVersions':!![]}),{'verbose':_0x273847[_0x164267(0x1bb)]}),withSpinner(_0x164267(0x217),()=>_0x3295d9[_0x164267(0x215)][_0x164267(0x1c0)](),{'verbose':_0x273847[_0x164267(0x1bb)]})[_0x164267(0x208)](_0xe499ba=>_0xe499ba[_0x164267(0x1c9)])]),_0x560ecd=_0x27af39[_0x164267(0x1c9)],_0x13179c=extractRootFolderId(_0x560ecd),_0x12e078=_0x44ef6e[_0x164267(0x1c9)],_0x3160ba=_0x58c268[_0x164267(0x1c9)],{journeys:_0x320483,activationStepsById:_0x1d30e4}=_0x285123[_0x164267(0x1c9)],_0x14ee60=new Map(_0x320483[_0x164267(0x1db)](_0x31fafc=>[_0x31fafc['id'],_0x31fafc])),_0x3224ab=_0x320483['map'](_0x1629cd=>({'id':_0x1629cd['id'],'name':_0x1629cd[_0x164267(0x230)][_0x164267(0x1d7)],'journeyBundleName':_0x1629cd['attributes'][_0x164267(0x1e2)]||'','journeyBundleId':_0x1629cd[_0x164267(0x230)][_0x164267(0x245)]||'','versionNumber':_0x1629cd[_0x164267(0x230)][_0x164267(0x1f9)],'description':_0x1629cd['attributes']['description'],'state':_0x1629cd[_0x164267(0x230)]['state'],'paused':_0x1629cd['attributes']['paused'],'audienceId':_0x1629cd[_0x164267(0x230)][_0x164267(0x1c3)],'folderId':_0x1629cd[_0x164267(0x1e0)]?.[_0x164267(0x24a)]?.[_0x164267(0x1c9)]?.['id'],'createdAt':_0x1629cd['attributes'][_0x164267(0x1e8)],'updatedAt':_0x1629cd[_0x164267(0x230)][_0x164267(0x1fc)]})),{emailToId:_0x3435f3,idToEmail:_0x7b80aa}=_0x299df7,_0x22c6a1=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x740bed=_0x164267,_0x5a271b=await _0x3295d9[_0x740bed(0x1dd)][_0x740bed(0x1f8)]();return buildConnectionMaps(_0x5a271b);},{'verbose':_0x273847[_0x164267(0x1bb)]})[_0x164267(0x208)](_0x2a6b86=>_0x2a6b86[_0x164267(0x1c9)]),_0x153242=_0x22c6a1[_0x164267(0x24b)],_0x3ad2c9=_0x22c6a1[_0x164267(0x23a)],_0x2a9437=_0x22c6a1[_0x164267(0x202)],_0x2ab540={'emailToIdMap':_0x3435f3,'connectionNameToIdMap':_0x153242,'connectionNameToTypeMap':_0x2a9437,'getSchema':_0x4d623c=>_0x3295d9['connection'][_0x164267(0x1ea)](_0x4d623c)};let {pathToId:_0x4461f6,idToPath:_0x5c04dc}=buildFolderMaps(_0x3160ba);const _0xcfebb1=buildSegmentLookupMap(_0x12e078,_0x5c04dc),_0x53b15f=buildSegmentNameToIdMap(_0x12e078),_0x17158e=buildJourneyBundleLookupMap(_0x3224ab,_0x5c04dc);let _0x1d2910;if(_0x1f3b9f){if(!_0x1f3b9f[_0x164267(0x1b7)](_0x164267(0x203))&&!_0x1f3b9f[_0x164267(0x1b7)]('.yaml'))return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x1f3b9f+'\x0a')),0x1;_0x1d2910=[_0x1f3b9f];}else _0x1d2910=findYamlFiles(_0x1b3962);if(_0x1d2910[_0x164267(0x1c5)]===0x0)return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x1e1)+_0x1b3962+'\x0a')),console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1d8)](_0x164267(0x1e9))),0x1;let _0x29afad,_0x54fd76;try{const _0x4ef6ae=parseAndClassifyYamlFiles(_0x1d2910,_0x1b3962,{'skipSegments':_0x273847[_0x164267(0x1b1)]});_0x29afad=_0x4ef6ae[_0x164267(0x1df)],_0x54fd76=_0x4ef6ae['journeys'];const _0x5922e0=validateParsedFiles(_0x4ef6ae,_0x1b3962);if(_0x5922e0[_0x164267(0x1c5)]>0x0)return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x249))),console[_0x164267(0x24d)](formatValidationErrors(_0x5922e0)),console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x22c)](_0x164267(0x22d))),0x1;}catch(_0xeb19d){return console['error'](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x229)+(_0xeb19d instanceof Error?_0xeb19d[_0x164267(0x1f7)]:_0xeb19d))),0x1;}if(_0x29afad[_0x164267(0x1c5)]===0x0&&_0x54fd76[_0x164267(0x1c5)]===0x0){const _0x580a5f=_0x273847[_0x164267(0x1b1)]?_0x164267(0x246):_0x164267(0x212);return console['error'](a31_0x3c19d4[_0x164267(0x22c)]('No\x20'+_0x580a5f+_0x164267(0x226))),0x0;}const _0x2e9fce=new Map();_0x12e078[_0x164267(0x1c5)]>0x0&&!_0x273847[_0x164267(0x1b1)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x12e078,async _0x4b740c=>{const _0xb175f0=a31_0x33d2,_0x30396a=await _0x3295d9[_0xb175f0(0x221)][_0xb175f0(0x1bc)](_0x56fdb8,_0x4b740c['id']);_0x2e9fce[_0xb175f0(0x1f3)](_0x4b740c['id'],_0x30396a);});},{'verbose':_0x273847['verbose']});const {segmentFiles:_0x550a7c,foldersToCreate:_0x5aee64}=await prepareSegmentFiles(_0x29afad,{'segmentByFolderAndName':_0xcfebb1,'activationsBySegmentId':_0x2e9fce,'folderPathToId':_0x4461f6,'idToEmailMap':_0x7b80aa,'connectionIdToNameMap':_0x3ad2c9},_0x2ab540,_0x3b4580,_0x402998),_0x2873f2=_0x1f3b9f?[]:findSegmentsToDelete(_0x12e078,_0x29afad[_0x164267(0x1db)](({yamlConfig:_0x2eb8ac,folderPath:_0x2d4cde})=>({'yamlConfig':_0x2eb8ac,'folderPath':resolveTDFolderPath(_0x2d4cde,_0x3b4580,_0x402998)})),_0x5c04dc,_0x402998,_0x3b4580),{journeyFiles:_0x1d3a66,foldersToCreate:_0x4469a8}=await withProgressSpinner('Preparing\x20journeys...',async _0x50b4b5=>prepareJourneyFiles(_0x54fd76,{'fetchJourney':async _0x46935d=>_0x3295d9[_0x164267(0x246)][_0x164267(0x244)](_0x46935d[_0x164267(0x224)]),'journeyBundlesByFolderAndName':_0x17158e,'folderPathToId':_0x4461f6,'idToEmailMap':_0x7b80aa,'connectionIdToNameMap':_0x3ad2c9,'existingSegments':_0x12e078,'parentId':_0x56fdb8,'deps':_0x3295d9,'progress':{'update':_0x4dd443=>{const _0x4ae266=_0x164267;_0x50b4b5[_0x4ae266(0x248)](_0x4dd443),_0x273847['verbose']&&console[_0x4ae266(0x24d)]('\x20\x20'+_0x4dd443);}},'journeyById':_0x14ee60,'activationStepsById':_0x1d30e4},_0x3b4580,_0x402998),{'verbose':_0x273847['verbose']})[_0x164267(0x208)](_0x374ee2=>_0x374ee2[_0x164267(0x1c9)]);for(const _0x4687ee of _0x4469a8){_0x5aee64[_0x164267(0x237)](_0x4687ee);}const _0x20c3d2=_0x1f3b9f?[]:findJourneysToDelete(_0x3224ab,_0x54fd76['map'](({yamlConfig:_0x5d1247,folderPath:_0x184b30})=>({'yamlConfig':_0x5d1247,'folderPath':resolveTDFolderPath(_0x184b30,_0x3b4580,_0x402998)})),_0x5c04dc,_0x402998,_0x3b4580),_0x3523e5=calculatePushStats(_0x550a7c,_0x1d3a66,_0x5aee64,_0x2873f2,_0x20c3d2,!!_0x273847['delete'],!!_0x273847[_0x164267(0x1b1)]),_0x5021e9=_0x3523e5[_0x164267(0x1df)]['new'],_0x18f1e0=_0x3523e5[_0x164267(0x1df)][_0x164267(0x20e)],_0x788575=_0x3523e5[_0x164267(0x1df)][_0x164267(0x1d0)],_0x2dba2c=_0x3523e5[_0x164267(0x1df)]['toDelete'],_0x514358=_0x3523e5['folders']['toCreate'],_0x294b5d=_0x3523e5[_0x164267(0x234)]['new'],_0x427274=_0x3523e5[_0x164267(0x234)]['changed'],_0x56ae0c=_0x3523e5[_0x164267(0x234)][_0x164267(0x1d0)],_0x188f0f=_0x3523e5[_0x164267(0x234)][_0x164267(0x1fe)],_0x452c26=_0x3523e5[_0x164267(0x1ec)]['all'],_0xe76370=_0x3523e5[_0x164267(0x1ec)][_0x164267(0x21b)],_0x3aeea2=_0x3523e5[_0x164267(0x1ec)][_0x164267(0x1e6)],_0x508727=_0x3523e5[_0x164267(0x1ec)]['toDelete'];console[_0x164267(0x24d)](_0x164267(0x241)+_0x58e4e6+'\x27:');_0x514358[_0x164267(0x1c5)]>0x0&&console[_0x164267(0x24d)]('\x20\x20'+a31_0x3c19d4[_0x164267(0x1cf)](_0x164267(0x210)+_0x514358[_0x164267(0x1c5)]+'\x20folders\x20to\x20create'));if(!_0x273847['journeysOnly']){console[_0x164267(0x24d)](_0x164267(0x1b9)),console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x20d)]('+\x20'+_0x5021e9[_0x164267(0x1c5)]+_0x164267(0x235))),console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x22c)]('~\x20'+_0x18f1e0[_0x164267(0x1c5)]+'\x20changed'));if(_0x2dba2c[_0x164267(0x1c5)]>0x0)console['error']('\x20\x20\x20\x20'+a31_0x3c19d4[_0x164267(0x1b4)]('-\x20'+_0x2dba2c[_0x164267(0x1c5)]+'\x20to\x20delete'));else _0x2873f2['length']>0x0&&!_0x273847[_0x164267(0x233)]&&console[_0x164267(0x24d)]('\x20\x20\x20\x20'+a31_0x3c19d4[_0x164267(0x240)](_0x2873f2[_0x164267(0x1c5)]+_0x164267(0x1bf)));console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x240)]('=\x20'+_0x788575[_0x164267(0x1c5)]+'\x20unchanged'));}if(_0x1d3a66[_0x164267(0x1c5)]>0x0||_0x20c3d2[_0x164267(0x1c5)]>0x0){console['error'](_0x164267(0x206)),console['error'](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x20d)]('+\x20'+_0x294b5d[_0x164267(0x1c5)]+_0x164267(0x235))),console['error'](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x22c)]('~\x20'+_0x427274[_0x164267(0x1c5)]+_0x164267(0x1b6)));if(_0x188f0f['length']>0x0)console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x1b4)]('-\x20'+_0x188f0f[_0x164267(0x1c5)]+_0x164267(0x228)));else _0x20c3d2[_0x164267(0x1c5)]>0x0&&!_0x273847['delete']&&console['error'](_0x164267(0x21d)+a31_0x3c19d4['dim'](_0x20c3d2['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4['dim']('=\x20'+_0x56ae0c[_0x164267(0x1c5)]+'\x20unchanged'));}_0x452c26['length']>0x0&&!_0x273847[_0x164267(0x1b1)]&&(console[_0x164267(0x24d)](''),console['error'](_0x164267(0x1f2)),_0xe76370[_0x164267(0x1c5)]>0x0&&console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4['green']('+\x20'+_0xe76370[_0x164267(0x1c5)]+_0x164267(0x1d9))),_0x3aeea2[_0x164267(0x1c5)]>0x0&&console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4[_0x164267(0x22c)]('~\x20'+_0x3aeea2['length']+_0x164267(0x218))),_0x508727[_0x164267(0x1c5)]>0x0&&console[_0x164267(0x24d)](_0x164267(0x21d)+a31_0x3c19d4['red']('-\x20'+_0x508727['length']+'\x20to\x20delete')));console[_0x164267(0x24d)]('\x20\x20Source:\x20'+a31_0x3c19d4[_0x164267(0x1d8)](_0x1b3962)+'\x0a');if(_0x514358[_0x164267(0x1c5)]>0x0){console[_0x164267(0x24d)](_0x164267(0x22b));for(const _0x1d4650 of _0x514358){console['error']('\x20\x20'+a31_0x3c19d4[_0x164267(0x1cf)]('+')+'\x20'+_0x1d4650);}console[_0x164267(0x24d)]('');}if(_0x5021e9[_0x164267(0x1c5)]>0x0&&!_0x273847['journeysOnly'])for(const _0x40008f of _0x5021e9){const _0x28351f=_0x40008f[_0x164267(0x20b)]?_0x40008f['folderPath']+'/'+_0x40008f[_0x164267(0x209)][_0x164267(0x1d7)]:_0x40008f[_0x164267(0x209)][_0x164267(0x1d7)],_0x21475d=_0x40008f[_0x164267(0x209)][_0x164267(0x1ec)]?.[_0x164267(0x1c5)]||0x0,_0x7d3945=_0x21475d>0x0?a31_0x3c19d4[_0x164267(0x240)]('\x20['+_0x21475d+_0x164267(0x232)):'';console[_0x164267(0x24d)]('\x0a'+a31_0x3c19d4[_0x164267(0x20d)](_0x164267(0x222))+'\x20'+_0x28351f+_0x7d3945),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c)),_0x40008f[_0x164267(0x23b)]&&console[_0x164267(0x24d)](_0x40008f[_0x164267(0x23b)]),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));}if(_0x2dba2c[_0x164267(0x1c5)]>0x0&&!_0x273847[_0x164267(0x1b1)])for(const _0x48d68e of _0x2dba2c){const _0x3ad177=_0x48d68e['segmentFolderId']?_0x5c04dc[_0x164267(0x1ca)](_0x48d68e[_0x164267(0x239)][_0x164267(0x1b8)]())||'':'',_0x18badd=_0x3ad177?_0x3ad177+'/'+_0x48d68e[_0x164267(0x1d7)]:_0x48d68e['name'],_0x3a23f4=_0x2e9fce[_0x164267(0x1ca)](_0x48d68e['id'])||[],_0x129c51=_0x3a23f4[_0x164267(0x1c5)]>0x0?a31_0x3c19d4['dim']('\x20['+_0x3a23f4['length']+_0x164267(0x232)):'';console[_0x164267(0x24d)]('\x0a'+a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x243))+'\x20'+_0x18badd+_0x129c51),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));const _0x226f2e=segmentWithActivationsToYaml(_0x48d68e,_0x3a23f4,undefined,_0x7b80aa,_0x3ad2c9),_0x432596=segmentToYamlString(_0x226f2e),_0x11df4b=generateDiff(_0x432596,'');console[_0x164267(0x24d)](formatDiffWithColors(_0x11df4b)),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));}const _0x40beb1=_0x550a7c[_0x164267(0x1ed)](_0x56f3dd=>!_0x56f3dd[_0x164267(0x1fa)]&&_0x56f3dd[_0x164267(0x23b)]);if(_0x40beb1[_0x164267(0x1c5)]>0x0&&!_0x273847[_0x164267(0x1b1)])for(const _0xee73b3 of _0x40beb1){const _0x4aaece=_0xee73b3[_0x164267(0x20b)]?_0xee73b3['folderPath']+'/'+_0xee73b3['yamlConfig'][_0x164267(0x1d7)]:_0xee73b3[_0x164267(0x209)][_0x164267(0x1d7)];console['error']('\x0a'+a31_0x3c19d4[_0x164267(0x22c)](_0x164267(0x1d4))+'\x20'+_0x4aaece),console['error']('β'['repeat'](0x3c)),console[_0x164267(0x24d)](_0xee73b3[_0x164267(0x23b)]),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));}if(_0x294b5d[_0x164267(0x1c5)]>0x0)for(const _0x487caa of _0x294b5d){const _0x3508d4=_0x487caa[_0x164267(0x20b)]?_0x487caa[_0x164267(0x20b)]+'/'+_0x487caa[_0x164267(0x209)]['name']:_0x487caa['yamlConfig']['name'];console[_0x164267(0x24d)]('\x0a'+a31_0x3c19d4[_0x164267(0x20d)](_0x164267(0x24c))+'\x20'+_0x3508d4),console['error']('β'[_0x164267(0x1de)](0x3c)),_0x487caa[_0x164267(0x23b)]&&console[_0x164267(0x24d)](_0x487caa[_0x164267(0x23b)]),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));}const _0x5c7385=_0x1d3a66[_0x164267(0x1ed)](_0x5e4f8c=>!_0x5e4f8c[_0x164267(0x1fa)]&&_0x5e4f8c['diff']);if(_0x5c7385['length']>0x0)for(const _0x111501 of _0x5c7385){const _0x230b76=_0x111501['folderPath']?_0x111501[_0x164267(0x20b)]+'/'+_0x111501[_0x164267(0x209)]['name']:_0x111501[_0x164267(0x209)]['name'];console[_0x164267(0x24d)]('\x0a'+a31_0x3c19d4[_0x164267(0x22c)](_0x164267(0x1f1))+'\x20'+_0x230b76),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c)),console[_0x164267(0x24d)](_0x111501['diff']),console['error']('β'[_0x164267(0x1de)](0x3c));}if(_0x188f0f[_0x164267(0x1c5)]>0x0)for(const _0x2b19bf of _0x188f0f){const _0x201ce1=_0x2b19bf['folderId']?_0x5c04dc['get'](_0x2b19bf[_0x164267(0x1ba)])||'':'',_0x38d8f2=_0x201ce1?_0x201ce1+'/'+_0x2b19bf[_0x164267(0x1e2)]:_0x2b19bf[_0x164267(0x1e2)];console['error']('\x0a'+a31_0x3c19d4[_0x164267(0x1b4)]('Delete\x20journey:')+'\x20'+_0x38d8f2),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c)),console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x22a))),console[_0x164267(0x24d)]('β'[_0x164267(0x1de)](0x3c));}if(_0x273847['dryRun'])return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x22c)](_0x164267(0x227))),0x0;const _0x2ecaa0=_0x273847['journeysOnly']?![]:_0x5021e9[_0x164267(0x1c5)]>0x0||_0x18f1e0[_0x164267(0x1c5)]>0x0||_0x2dba2c['length']>0x0,_0x59d47a=_0x294b5d['length']>0x0||_0x427274['length']>0x0||_0x188f0f['length']>0x0,_0x27503b=_0x273847[_0x164267(0x1b1)]?![]:_0x452c26[_0x164267(0x1c5)]>0x0,_0x2df544=_0x514358[_0x164267(0x1c5)]>0x0;if(!_0x2ecaa0&&!_0x59d47a&&!_0x27503b&&!_0x2df544){const _0x33812c=_0x273847[_0x164267(0x1b1)]?'β\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x164267(0x1be);console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x20d)](_0x33812c));if(_0x1f3b9f&&_0x56ae0c['length']===0x1){const _0x53cab1=_0x56ae0c[0x0];if(_0x53cab1[_0x164267(0x219)]?.['id']){const _0xb90678=getConsoleNextUrl(_0x273847[_0x164267(0x1d5)],_0x164267(0x1cc)+_0x56fdb8+'/e/'+_0x53cab1[_0x164267(0x219)]['id']+'/j/da/je');console[_0x164267(0x24d)]('\x20\x20'+a31_0x3c19d4['cyan'](_0xb90678));}}return 0x0;}const _0x41b2d8=_0x273847['journeysOnly']?_0x294b5d['length']+_0x427274[_0x164267(0x1c5)]+_0x188f0f['length']+_0x514358['length']:_0x5021e9[_0x164267(0x1c5)]+_0x18f1e0[_0x164267(0x1c5)]+_0x2dba2c[_0x164267(0x1c5)]+_0x294b5d[_0x164267(0x1c5)]+_0x427274[_0x164267(0x1c5)]+_0x188f0f[_0x164267(0x1c5)]+_0x514358[_0x164267(0x1c5)]+_0x452c26['length'];if(!_0x273847['yes']&&_0x41b2d8>0x0){if(!isInteractive())return console['error'](a31_0x3c19d4[_0x164267(0x1b4)](_0x164267(0x21c)),_0x164267(0x211)),console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x240)](_0x164267(0x225))),0x1;const _0x4baebb=await confirmKey(_0x164267(0x1ef)+_0x41b2d8+_0x164267(0x1f6));if(!_0x4baebb)return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x22c)](_0x164267(0x1d2))),0x1;}const _0x1d362a={'withProgress':async(_0x17c031,_0x8c6b13)=>{const _0x388841=_0x164267,_0x15f9ec=await withSpinner(_0x17c031,_0x8c6b13,{'verbose':_0x273847[_0x388841(0x1bb)]});return{'data':_0x15f9ec[_0x388841(0x1c9)]};},'logInfo':_0x1f2ed9=>console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x1cf)]('β\x20'+_0x1f2ed9)),'logSuccess':_0x5bd1ca=>console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x20d)]('β\x20'+_0x5bd1ca)),'logWarning':_0x3eef87=>console[_0x164267(0x24d)](a31_0x3c19d4['yellow']('β \x20'+_0x3eef87)),'logDeleted':_0x1a0921=>console[_0x164267(0x24d)](a31_0x3c19d4['red']('β\x20'+_0x1a0921))},_0x3569ba={'segment':_0x3295d9[_0x164267(0x221)],'journey':_0x3295d9[_0x164267(0x246)],'user':_0x3295d9[_0x164267(0x215)],'connection':_0x3295d9['connection']};_0x514358[_0x164267(0x1c5)]>0x0&&(_0x4461f6=await executePushFolders(_0x3569ba,_0x514358,_0x4461f6,{'parentId':_0x56fdb8},_0x1d362a));const _0x5dd7ac={'rootFolderId':_0x13179c,'folderPathToId':_0x4461f6,'folderIdToPath':_0x5c04dc,'segmentNameToId':_0x53b15f,'activationsBySegmentId':_0x2e9fce,'emailToIdMap':_0x3435f3,'idToEmailMap':_0x7b80aa,'connectionNameToIdMap':_0x22c6a1[_0x164267(0x24b)],'connectionIdToNameMap':_0x22c6a1[_0x164267(0x23a)],'connectionNameToTypeMap':_0x2a9437},_0x245305=await executePushSegments(_0x3569ba,_0x273847[_0x164267(0x1b1)]?[]:_0x550a7c,_0x5dd7ac,{'parentId':_0x56fdb8},_0x1d362a),_0x3ff4fa=_0x245305[_0x164267(0x214)],_0x2294c3=_0x245305['updated'],_0x24eac4=_0x245305[_0x164267(0x1ec)][_0x164267(0x214)],_0xa1847d=_0x245305['activations'][_0x164267(0x1e5)],_0x1202d7=_0x245305[_0x164267(0x1ec)][_0x164267(0x1c1)],_0x5f0618=await executePushSegmentDeletions(_0x3569ba,_0x273847[_0x164267(0x1b1)]?[]:_0x2dba2c,_0x1d362a);let _0x511a1a=0x0,_0x23dd88=0x0,_0x5d4450=0x0;const _0x1bf2b0=new Map(_0x53b15f);for(const [_0x562be6,_0xff0308]of _0x245305[_0x164267(0x1cd)]){_0x1bf2b0[_0x164267(0x1f3)](_0x562be6,_0xff0308);}if(_0x1d3a66[_0x164267(0x1c5)]>0x0){const _0x5cc9fc={..._0x5dd7ac,'segmentNameToId':_0x1bf2b0,'existingSegments':_0x12e078,'activationContext':_0x2ab540},_0x37dab7=await executePushJourneys(_0x3569ba,_0x1d3a66,_0x5cc9fc,{'parentId':_0x56fdb8,'rootFolderId':_0x13179c,'verbose':_0x273847[_0x164267(0x1bb)]},_0x1d362a);_0x511a1a=_0x37dab7[_0x164267(0x214)],_0x23dd88=_0x37dab7[_0x164267(0x1e5)];if(_0x1f3b9f&&_0x37dab7[_0x164267(0x21a)][_0x164267(0x1c5)]===0x1){const _0x47690a=_0x37dab7['results'][0x0];if(_0x47690a[_0x164267(0x224)]){const _0x1703a2=getConsoleNextUrl(_0x273847['site'],_0x164267(0x1cc)+_0x56fdb8+'/e/'+_0x47690a['journeyId']+_0x164267(0x1e4));console[_0x164267(0x24d)]('\x20\x20'+a31_0x3c19d4['cyan'](_0x1703a2));}}}for(const _0x3b44be of _0x188f0f){console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x22c)]('β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x3b44be[_0x164267(0x1e2)])),_0x5d4450++;}const _0x4ba1bf=[];if(_0x3ff4fa>0x0)_0x4ba1bf[_0x164267(0x23d)](_0x3ff4fa+_0x164267(0x236));if(_0x2294c3>0x0)_0x4ba1bf['push'](_0x2294c3+_0x164267(0x1f0));if(_0x5f0618>0x0)_0x4ba1bf[_0x164267(0x23d)](_0x5f0618+_0x164267(0x23f));const _0x1f0487=[];if(_0x511a1a>0x0)_0x1f0487['push'](_0x511a1a+'\x20created');if(_0x23dd88>0x0)_0x1f0487[_0x164267(0x23d)](_0x23dd88+_0x164267(0x1f0));if(_0x5d4450>0x0)_0x1f0487[_0x164267(0x23d)](_0x5d4450+_0x164267(0x23f));const _0x26391e=[];if(_0x24eac4>0x0)_0x26391e[_0x164267(0x23d)](_0x24eac4+_0x164267(0x236));if(_0xa1847d>0x0)_0x26391e['push'](_0xa1847d+_0x164267(0x1f0));if(_0x1202d7>0x0)_0x26391e[_0x164267(0x23d)](_0x1202d7+'\x20deleted');return console[_0x164267(0x24d)](a31_0x3c19d4[_0x164267(0x20d)]('\x0aβ\x20Push\x20complete')),_0x4ba1bf[_0x164267(0x1c5)]>0x0&&!_0x273847[_0x164267(0x1b1)]&&console[_0x164267(0x24d)]('\x20\x20Segments:\x20'+_0x4ba1bf[_0x164267(0x205)](',\x20')),_0x1f0487[_0x164267(0x1c5)]>0x0&&console[_0x164267(0x24d)]('\x20\x20Journeys:\x20'+_0x1f0487[_0x164267(0x205)](',\x20')),_0x26391e[_0x164267(0x1c5)]>0x0&&!_0x273847[_0x164267(0x1b1)]&&console[_0x164267(0x24d)](_0x164267(0x216)+_0x26391e[_0x164267(0x205)](',\x20')),0x0;}}
|