@treasuredata/tdx 0.26.4 β 0.26.5
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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.js +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_0x4d179c=a26_0xc8d0;(function(_0x503da6,_0x48239f){const _0x1416bd=a26_0xc8d0,_0x336432=_0x503da6();while(!![]){try{const _0x56b48f=parseInt(_0x1416bd(0xc5))/0x1+parseInt(_0x1416bd(0x87))/0x2*(-parseInt(_0x1416bd(0xe1))/0x3)+parseInt(_0x1416bd(0x80))/0x4+parseInt(_0x1416bd(0x8c))/0x5+parseInt(_0x1416bd(0xdf))/0x6*(parseInt(_0x1416bd(0xe0))/0x7)+parseInt(_0x1416bd(0xeb))/0x8*(parseInt(_0x1416bd(0xb2))/0x9)+-parseInt(_0x1416bd(0x7b))/0xa;if(_0x56b48f===_0x48239f)break;else _0x336432['push'](_0x336432['shift']());}catch(_0x5f0556){_0x336432['push'](_0x336432['shift']());}}}(a26_0x55a3,0xafb22));function a26_0xc8d0(_0x3527c5,_0x21cb57){_0x3527c5=_0x3527c5-0x65;const _0x55a3ff=a26_0x55a3();let _0xc8d011=_0x55a3ff[_0x3527c5];return _0xc8d011;}import{BaseCommand}from'./command.js';function a26_0x55a3(){const _0x4b5dd8=['π
\x20','getTime','args','Create\x20a\x20scheduled\x20query','schedule:create','Getting\x20schedule\x20details...','\x20execution','type','8MzZxds','just\x20now','cron','list','success','json','nextRun','history','Deleting\x20schedule...','Running\x20schedule...','schedule:update','queryUrl','keys','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','soon','Creating\x20schedule:\x20','verbose','...','padEnd','\x20schedules','Schedule\x20run\x20submitted:\x20','time_zone','green','user','Schedule\x20deleted:\x20','map','28770950DZzuGd','Updating\x20schedule...','INVALID_ARGUMENT','length','schedule:history','5083788rINzIv','/app/queries/editor?queryId=','retryLimit','job_id','substring','has_next_page','show','2sznYAv','end_at','description','updated_at','List\x20scheduled\x20queries','4816365ypqssZ','round','result','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','priority','database','queries','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','validate','time','dim','Showing\x20first\x20','ended_at','lastRun','jsonl','scheduled_at','max','engine_version','status','toLocaleDateString','Run\x20a\x20scheduled\x20query\x20immediately','d\x20ago','next_run_at','start_at','Found\x20','file','join','name','pagination','\x20scheduled\x20quer','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','m\x20ago','log','never','engineVersion','tsv','\x22...','10115307UCpuYZ','ies','count','schedules','Show\x20schedule\x20execution\x20history','\x20(showing\x20','query','data','red','Schedule\x20created:\x20','schedule:run','utf-8','\x20\x20Job\x20ID:\x20','last_job','Delete\x20a\x20scheduled\x20query','delete','num','\x20matching\x20\x22','Update\x20a\x20scheduled\x20query','54878fKrCNh','Getting\x20schedule\x20history...','Listing\x20scheduled\x20queries...','\x20\x20Type:\x20','retry_limit','format','\x20\x20Timezone:\x20','site','\x20\x20Time:\x20','Updating\x20schedule:\x20','timezone','delay','Creating\x20schedule...','in\x20','statusIcon','Failed\x20to\x20read\x20file:\x20','error','execute','entries','created_at','\x20\x20Cron:\x20','Schedule\x20updated:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','user_name','table','trim','4050744IwBgvU','14yEJcHY','3499572hWNJrW','Cancelled'];a26_0x55a3=function(){return _0x4b5dd8;};return a26_0x55a3();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x2c4436 from'chalk';function formatRelativeTime(_0xffb9c7){const _0x4266dc=a26_0xc8d0,_0x45146e=new Date(_0xffb9c7),_0xb97999=new Date(),_0x33a38b=_0x45146e[_0x4266dc(0xe4)]()-_0xb97999[_0x4266dc(0xe4)](),_0x2b23fb=Math['abs'](_0x33a38b)/0x3e8,_0x5aa2e8=_0x33a38b<0x0;if(_0x2b23fb<0x3c)return _0x5aa2e8?_0x4266dc(0xec):_0x4266dc(0x6f);else{if(_0x2b23fb<0xe10){const _0x4e5572=Math['round'](_0x2b23fb/0x3c);return _0x5aa2e8?_0x4e5572+_0x4266dc(0xac):_0x4266dc(0xd2)+_0x4e5572+'m';}else{if(_0x2b23fb<0x15180){const _0x3bbc8a=Math['round'](_0x2b23fb/0xe10);return _0x5aa2e8?_0x3bbc8a+'h\x20ago':_0x4266dc(0xd2)+_0x3bbc8a+'h';}else{if(_0x2b23fb<0x93a80){const _0x38252a=Math[_0x4266dc(0x8d)](_0x2b23fb/0x15180);return _0x5aa2e8?_0x38252a+_0x4266dc(0xa2):_0x4266dc(0xd2)+_0x38252a+'d';}else return _0x45146e[_0x4266dc(0xa0)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x4d179c(0xa8)]='schedule:list';[a26_0x4d179c(0x89)]=a26_0x4d179c(0x8b);async[a26_0x4d179c(0xd6)](_0x274ed7){const _0x24342e=a26_0x4d179c,{options:_0x5960e2,args:_0x23db1c,tdx:_0x597204}=_0x274ed7,_0x1b162e=resolveLimit(_0x5960e2['limit'],DEFAULT_DISPLAY_LIMIT),_0x1c39ab=_0x23db1c[0x0],_0x39cf30=_0x1c39ab?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x1c39ab+_0x24342e(0xb1):_0x24342e(0xc7),_0x15ff3c=await withSpinner(_0x39cf30,()=>_0x597204[_0x24342e(0xb5)]['listQueries']({'limit':_0x1b162e,'scheduled':!![],'pattern':_0x1c39ab}),{'verbose':_0x5960e2[_0x24342e(0x71)]}),_0x58f6fc=_0x15ff3c['data'][_0x24342e(0x93)],_0x167070=_0x15ff3c[_0x24342e(0xb9)][_0x24342e(0xa9)][_0x24342e(0x85)],_0x24b8bd=_0x1c39ab?_0x24342e(0xc3)+_0x1c39ab+'\x22':'';_0x167070?console[_0x24342e(0xd5)](_0x24342e(0x98)+_0x58f6fc[_0x24342e(0x7e)]+_0x24342e(0x74)+_0x24b8bd+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x24342e(0xd5)](_0x24342e(0xa5)+_0x58f6fc[_0x24342e(0x7e)]+_0x24342e(0xaa)+(_0x58f6fc[_0x24342e(0x7e)]!==0x1?_0x24342e(0xb3):'y')+_0x24b8bd);if(_0x5960e2[_0x24342e(0xca)]===_0x24342e(0x66)||_0x5960e2[_0x24342e(0xca)]===_0x24342e(0x9b)||_0x5960e2[_0x24342e(0xca)]===_0x24342e(0xdd)||_0x5960e2[_0x24342e(0xca)]===_0x24342e(0xb0)){const _0x1a69f1=_0x58f6fc[_0x24342e(0x7a)](_0x1449b5=>({'id':_0x1449b5['id'],'name':_0x1449b5['name'],'cron':_0x1449b5[_0x24342e(0xed)],'database':_0x1449b5[_0x24342e(0x92)]?.[_0x24342e(0xa8)],'type':_0x1449b5[_0x24342e(0xea)],'timezone':_0x1449b5[_0x24342e(0x76)],'user_name':_0x1449b5[_0x24342e(0x78)]?.[_0x24342e(0xa8)],'updated_at':_0x1449b5[_0x24342e(0x8a)],'next_run_at':_0x1449b5[_0x24342e(0xa3)],'last_job_status':_0x1449b5[_0x24342e(0xbf)]?.[_0x24342e(0x9f)]}));await handleSDKOutput(_0x1a69f1,_0x5960e2);}else{if(_0x58f6fc['length']===0x0)console[_0x24342e(0xad)]('No\x20scheduled\x20queries\x20found');else{const _0x363c27=_0x5960e2[_0x24342e(0xcc)],_0x2f8299=_0x58f6fc['map'](_0x213090=>{const _0x47794d=_0x24342e,_0x963d26=_0x213090[_0x47794d(0xbf)]?.[_0x47794d(0x9f)]?_0x213090[_0x47794d(0xbf)][_0x47794d(0x9f)]===_0x47794d(0x65)?'β':'β':'-',_0x23a503=_0x213090['last_job']?.[_0x47794d(0x99)]?formatRelativeTime(_0x213090[_0x47794d(0xbf)][_0x47794d(0x99)]):_0x47794d(0xae),_0x5e1888=_0x213090[_0x47794d(0xa3)]?formatRelativeTime(_0x213090[_0x47794d(0xa3)]):'-',_0x470a46=_0x213090[_0x47794d(0xed)]||'',_0x512073=_0x213090[_0x47794d(0xa8)]||'(unnamed)',_0x30a68f=getConsoleUrl(_0x363c27,_0x47794d(0x81)+_0x213090['id']);return{'statusIcon':_0x963d26,'lastRun':_0x23a503,'nextRun':_0x5e1888,'cron':_0x470a46,'name':_0x512073,'queryUrl':_0x30a68f,'status':_0x213090[_0x47794d(0xbf)]?.[_0x47794d(0x9f)]};}),_0x47cc80=Math[_0x24342e(0x9d)](..._0x2f8299[_0x24342e(0x7a)](_0x437430=>_0x437430['lastRun'][_0x24342e(0x7e)])),_0x5bcba3=Math[_0x24342e(0x9d)](..._0x2f8299[_0x24342e(0x7a)](_0x154e8a=>_0x154e8a[_0x24342e(0x67)][_0x24342e(0x7e)])),_0xfde2c5=Math[_0x24342e(0x9d)](..._0x2f8299[_0x24342e(0x7a)](_0x40b2c2=>_0x40b2c2['cron']['length'])),_0x3d49b8=_0x2f8299['map'](_0x2f8c0f=>{const _0x56098f=_0x24342e,_0x44cb3d=_0x2f8c0f['status']===_0x56098f(0x65)?a26_0x2c4436[_0x56098f(0x77)](_0x2f8c0f[_0x56098f(0xd3)]):_0x2f8c0f['status']===_0x56098f(0xd5)?a26_0x2c4436[_0x56098f(0xba)](_0x2f8c0f[_0x56098f(0xd3)]):a26_0x2c4436[_0x56098f(0x97)](_0x2f8c0f[_0x56098f(0xd3)]),_0xad9a9b=_0x2f8c0f[_0x56098f(0x9a)][_0x56098f(0x73)](_0x47cc80),_0x24ad46=_0x2f8c0f[_0x56098f(0x67)][_0x56098f(0x73)](_0x5bcba3),_0x34b227=_0x2f8c0f['cron']?a26_0x2c4436['cyan'](_0x2f8c0f['cron'][_0x56098f(0x73)](_0xfde2c5)):'\x20'['repeat'](_0xfde2c5),_0xaaf306=hyperlink(_0x2f8c0f['name'],_0x2f8c0f[_0x56098f(0x6c)]);return _0x56098f(0xe3)+_0x44cb3d+'\x20'+_0xad9a9b+'\x20\x20β\x20'+_0x24ad46+'\x20\x20'+_0x34b227+'\x20\x20'+_0xaaf306;});await writeOutput(_0x3d49b8[_0x24342e(0xa7)]('\x0a'),_0x5960e2['output'],_0x24342e(0xee));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x4d179c(0xa8)]='schedule:show';['description']='Show\x20schedule\x20details';[a26_0x4d179c(0x95)](_0x5ab1c0){const _0x44092a=a26_0x4d179c,_0x15054e=_0x5ab1c0[_0x44092a(0xe5)][0x0];if(!_0x15054e)return _0x44092a(0xab);return undefined;}async[a26_0x4d179c(0xd6)](_0x6007a0){const _0x2bfb53=a26_0x4d179c,{options:_0x1c58bb,args:_0x3fbdd3,tdx:_0x35bb14}=_0x6007a0,_0x13b801=_0x3fbdd3[0x0],_0x3c0fff=await withSpinner(_0x2bfb53(0xe8),()=>_0x35bb14['schedules'][_0x2bfb53(0x86)](_0x13b801),{'verbose':_0x1c58bb['verbose']}),_0x216d27=_0x3c0fff[_0x2bfb53(0xb9)],_0x247356={'name':_0x216d27[_0x2bfb53(0xa8)],'cron':_0x216d27[_0x2bfb53(0xed)],'database':_0x216d27[_0x2bfb53(0x92)],'type':_0x216d27[_0x2bfb53(0xea)],'timezone':_0x216d27['timezone'],'user_name':_0x216d27[_0x2bfb53(0xdc)],'created_at':_0x216d27[_0x2bfb53(0xd8)],'engine_version':_0x216d27['engine_version'],'executing_user_id':_0x216d27['executing_user_id'],'query':_0x216d27[_0x2bfb53(0xb8)],'delay':_0x216d27[_0x2bfb53(0xd0)],'priority':_0x216d27[_0x2bfb53(0x91)],'retry_limit':_0x216d27[_0x2bfb53(0xc9)],..._0x216d27[_0x2bfb53(0x8e)]&&{'result':_0x216d27[_0x2bfb53(0x8e)]}};return await handleSingleObjectOutput(_0x247356,_0x1c58bb),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x4d179c(0xe7);[a26_0x4d179c(0x89)]=a26_0x4d179c(0xe6);[a26_0x4d179c(0x95)](_0x301b99){const _0x1ff4f7=a26_0x4d179c,_0x1eae95=_0x301b99[_0x1ff4f7(0xe5)][0x0];if(!_0x1eae95)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_0x4d179c(0xd6)](_0x460c7e){const _0x498a09=a26_0x4d179c,{options:_0x5f31f9,args:_0xd2ac4a,tdx:_0x4e9726}=_0x460c7e,_0x5e0cb0=_0xd2ac4a[0x0],_0x383786=_0x5f31f9,_0x535a93=_0x383786[_0x498a09(0x92)],_0x409d11=_0x383786[_0x498a09(0xa6)],_0x25c040=_0x383786[_0x498a09(0xea)]||'trino';let _0x53ad60;try{_0x53ad60=readFileSync(_0x409d11,_0x498a09(0xbd))[_0x498a09(0xde)]();}catch(_0x3663bb){throw new SDKError(ErrorCode[_0x498a09(0x7d)],'Failed\x20to\x20read\x20file:\x20'+_0x409d11,_0x3663bb instanceof Error?_0x3663bb:undefined);}if(!_0x53ad60)throw new SDKError(ErrorCode[_0x498a09(0x7d)],'Query\x20file\x20is\x20empty');const _0x2327b0={'database':_0x535a93,'query':_0x53ad60,'type':_0x25c040};if(_0x383786[_0x498a09(0xed)])_0x2327b0[_0x498a09(0xed)]=_0x383786['cron'];if(_0x383786[_0x498a09(0xcf)])_0x2327b0[_0x498a09(0xcf)]=_0x383786[_0x498a09(0xcf)];if(_0x383786[_0x498a09(0xd0)]!==undefined)_0x2327b0['delay']=Number(_0x383786[_0x498a09(0xd0)]);if(_0x383786[_0x498a09(0x91)]!==undefined)_0x2327b0[_0x498a09(0x91)]=Number(_0x383786[_0x498a09(0x91)]);if(_0x383786[_0x498a09(0x82)]!==undefined)_0x2327b0[_0x498a09(0xc9)]=Number(_0x383786[_0x498a09(0x82)]);if(_0x383786[_0x498a09(0xaf)])_0x2327b0[_0x498a09(0x9e)]=_0x383786[_0x498a09(0xaf)];if(_0x383786[_0x498a09(0x8e)])_0x2327b0['result']=_0x383786[_0x498a09(0x8e)];if(_0x5f31f9[_0x498a09(0x71)]){console['error'](_0x498a09(0x70)+_0x5e0cb0),console[_0x498a09(0xd5)]('\x20\x20Database:\x20'+_0x535a93),console[_0x498a09(0xd5)](_0x498a09(0xc8)+_0x25c040);if(_0x2327b0['cron'])console['error'](_0x498a09(0xd9)+_0x2327b0[_0x498a09(0xed)]);if(_0x2327b0['timezone'])console['error'](_0x498a09(0xcb)+_0x2327b0[_0x498a09(0xcf)]);}const _0x50f199=await withSpinner(_0x498a09(0xd1),()=>_0x4e9726[_0x498a09(0xb5)][_0x498a09(0x8f)](_0x5e0cb0,_0x2327b0),{'verbose':_0x5f31f9['verbose']});return console[_0x498a09(0xd5)](_0x498a09(0xbb)+_0x50f199[_0x498a09(0xb9)][_0x498a09(0xa8)]),await handleSingleObjectOutput(_0x50f199[_0x498a09(0xb9)],_0x5f31f9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x4d179c(0xa8)]=a26_0x4d179c(0x6b);['description']=a26_0x4d179c(0xc4);[a26_0x4d179c(0x95)](_0x2e7175){const _0x1acfef=a26_0x4d179c,_0x496685=_0x2e7175[_0x1acfef(0xe5)][0x0];if(!_0x496685)return _0x1acfef(0x6e);return undefined;}async[a26_0x4d179c(0xd6)](_0x3178ec){const _0x4478dd=a26_0x4d179c,{options:_0x23b374,args:_0x21feac,tdx:_0x5cc4e1}=_0x3178ec,_0x3e9f94=_0x21feac[0x0],_0x27d907=_0x23b374,_0x31853b={};if(_0x27d907[_0x4478dd(0x92)])_0x31853b[_0x4478dd(0x92)]=_0x27d907['database'];if(_0x27d907['type'])_0x31853b[_0x4478dd(0xea)]=_0x27d907['type'];if(_0x27d907[_0x4478dd(0xed)])_0x31853b[_0x4478dd(0xed)]=_0x27d907['cron'];if(_0x27d907[_0x4478dd(0xcf)])_0x31853b['timezone']=_0x27d907['timezone'];if(_0x27d907[_0x4478dd(0xd0)]!==undefined)_0x31853b[_0x4478dd(0xd0)]=Number(_0x27d907['delay']);if(_0x27d907['priority']!==undefined)_0x31853b[_0x4478dd(0x91)]=Number(_0x27d907[_0x4478dd(0x91)]);if(_0x27d907['retryLimit']!==undefined)_0x31853b[_0x4478dd(0xc9)]=Number(_0x27d907[_0x4478dd(0x82)]);if(_0x27d907[_0x4478dd(0xaf)])_0x31853b['engine_version']=_0x27d907[_0x4478dd(0xaf)];if(_0x27d907[_0x4478dd(0x8e)])_0x31853b[_0x4478dd(0x8e)]=_0x27d907['result'];if(_0x27d907['file'])try{_0x31853b[_0x4478dd(0xb8)]=readFileSync(_0x27d907['file'],_0x4478dd(0xbd))[_0x4478dd(0xde)]();}catch(_0x365701){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4478dd(0xd4)+_0x27d907[_0x4478dd(0xa6)],_0x365701 instanceof Error?_0x365701:undefined);}if(Object[_0x4478dd(0x6d)](_0x31853b)[_0x4478dd(0x7e)]===0x0)throw new SDKError(ErrorCode[_0x4478dd(0x7d)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x23b374[_0x4478dd(0x71)]){console[_0x4478dd(0xd5)](_0x4478dd(0xce)+_0x3e9f94);for(const [_0x37e2da,_0x188292]of Object[_0x4478dd(0xd7)](_0x31853b)){_0x37e2da==='query'?console['error']('\x20\x20'+_0x37e2da+':\x20'+_0x188292[_0x4478dd(0x84)](0x0,0x32)+_0x4478dd(0x72)):console[_0x4478dd(0xd5)]('\x20\x20'+_0x37e2da+':\x20'+_0x188292);}}const _0x3eab86=await withSpinner(_0x4478dd(0x7c),()=>_0x5cc4e1['schedules']['update'](_0x3e9f94,_0x31853b),{'verbose':_0x23b374[_0x4478dd(0x71)]});return console['error'](_0x4478dd(0xda)+_0x3eab86[_0x4478dd(0xb9)][_0x4478dd(0xa8)]),await handleSingleObjectOutput(_0x3eab86[_0x4478dd(0xb9)],_0x23b374),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';[a26_0x4d179c(0x89)]=a26_0x4d179c(0xc0);[a26_0x4d179c(0x95)](_0x481afc){const _0x1bc0cb=a26_0x4d179c,_0xedf842=_0x481afc[_0x1bc0cb(0xe5)][0x0];if(!_0xedf842)return _0x1bc0cb(0x90);return undefined;}async[a26_0x4d179c(0xd6)](_0x25a906){const _0x4f08cb=a26_0x4d179c,{options:_0x4acea8,args:_0x44caf5,tdx:_0x2dbe05}=_0x25a906,_0x1d9e3b=_0x44caf5[0x0];if(!_0x4acea8['yes']){const _0x7cfee9=await confirm(_0x4f08cb(0x94)+_0x1d9e3b+'\x22?');if(!_0x7cfee9)return console[_0x4f08cb(0xd5)](_0x4f08cb(0xe2)),0x0;}const _0x13810a=await withSpinner(_0x4f08cb(0x69),()=>_0x2dbe05['schedules'][_0x4f08cb(0xc1)](_0x1d9e3b),{'verbose':_0x4acea8[_0x4f08cb(0x71)]});return console[_0x4f08cb(0xd5)](_0x4f08cb(0x79)+_0x13810a[_0x4f08cb(0xb9)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a26_0x4d179c(0xbc);[a26_0x4d179c(0x89)]=a26_0x4d179c(0xa1);['validate'](_0x484e26){const _0x5c3f28=_0x484e26['args'][0x0];if(!_0x5c3f28)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x4c1725){const _0x131938=a26_0x4d179c,{options:_0x3f841f,args:_0x102ebd,tdx:_0x3e89a8}=_0x4c1725,_0x1749d0=_0x102ebd[0x0],_0x133b0b=_0x3f841f,_0x5e2035=_0x133b0b[_0x131938(0x96)],_0x2ff035=_0x133b0b[_0x131938(0xc2)]!==undefined?Number(_0x133b0b['num']):undefined;if(_0x3f841f[_0x131938(0x71)]){console['error']('Running\x20schedule:\x20'+_0x1749d0);if(_0x5e2035)console[_0x131938(0xd5)](_0x131938(0xcd)+_0x5e2035);if(_0x2ff035)console[_0x131938(0xd5)]('\x20\x20Num:\x20'+_0x2ff035);}const _0x30d8ac=await withSpinner(_0x131938(0x6a),()=>_0x3e89a8[_0x131938(0xb5)]['run'](_0x1749d0,{'time':_0x5e2035,'num':_0x2ff035}),{'verbose':_0x3f841f[_0x131938(0x71)]}),_0x33ce80=_0x30d8ac[_0x131938(0xb9)]['jobs'];console[_0x131938(0xd5)](_0x131938(0x75)+_0x33ce80[_0x131938(0x7e)]+'\x20job'+(_0x33ce80[_0x131938(0x7e)]!==0x1?'s':'')+'\x20created');for(const _0xdb18c1 of _0x33ce80){console[_0x131938(0xd5)](_0x131938(0xbe)+_0xdb18c1[_0x131938(0x83)]);}return await handleSDKOutput(_0x33ce80,_0x3f841f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x4d179c(0xa8)]=a26_0x4d179c(0x7f);[a26_0x4d179c(0x89)]=a26_0x4d179c(0xb6);[a26_0x4d179c(0x95)](_0x2d43ad){const _0x147232=a26_0x4d179c,_0x7a7e28=_0x2d43ad[_0x147232(0xe5)][0x0];if(!_0x7a7e28)return _0x147232(0xdb);return undefined;}async[a26_0x4d179c(0xd6)](_0x3c4972){const _0x2b1eb9=a26_0x4d179c,{options:_0xec5778,args:_0x155906,tdx:_0x7c129a}=_0x3c4972,_0x52fc23=_0x155906[0x0],_0x1b0920=_0xec5778,_0x42761b=_0x1b0920['from']!==undefined?Number(_0x1b0920['from']):undefined,_0x240271=_0x1b0920['to']!==undefined?Number(_0x1b0920['to']):undefined,_0x2803c1=await withSpinner(_0x2b1eb9(0xc6),()=>_0x7c129a[_0x2b1eb9(0xb5)][_0x2b1eb9(0x68)](_0x52fc23,{'from':_0x42761b,'to':_0x240271}),{'verbose':_0xec5778['verbose']}),_0x20c1ee=_0x2803c1[_0x2b1eb9(0xb9)];console[_0x2b1eb9(0xd5)](_0x2b1eb9(0xa5)+_0x20c1ee[_0x2b1eb9(0xb4)]+_0x2b1eb9(0xe9)+(_0x20c1ee[_0x2b1eb9(0xb4)]!==0x1?'s':'')+_0x2b1eb9(0xb7)+_0x20c1ee['from']+'-'+_0x20c1ee['to']+')');const _0x2af158=_0x20c1ee[_0x2b1eb9(0x68)]['map'](_0x27fff0=>({'job_id':_0x27fff0[_0x2b1eb9(0x83)],'type':_0x27fff0[_0x2b1eb9(0xea)],'status':_0x27fff0['status'],'scheduled_at':_0x27fff0[_0x2b1eb9(0x9c)],'created_at':_0x27fff0['created_at'],'start_at':_0x27fff0[_0x2b1eb9(0xa4)],'end_at':_0x27fff0[_0x2b1eb9(0x88)]}));return await handleSDKOutput(_0x2af158,_0xec5778),0x0;}}
|
|
1
|
+
const a26_0x2e5284=a26_0x27db;(function(_0x2297b5,_0x3d8fcf){const _0x5726b7=a26_0x27db,_0x4eca79=_0x2297b5();while(!![]){try{const _0x5a8da9=parseInt(_0x5726b7(0x187))/0x1+parseInt(_0x5726b7(0x15d))/0x2+-parseInt(_0x5726b7(0x170))/0x3*(parseInt(_0x5726b7(0x122))/0x4)+parseInt(_0x5726b7(0x18e))/0x5+parseInt(_0x5726b7(0x12c))/0x6+parseInt(_0x5726b7(0x189))/0x7*(parseInt(_0x5726b7(0x186))/0x8)+parseInt(_0x5726b7(0x120))/0x9*(-parseInt(_0x5726b7(0x15c))/0xa);if(_0x5a8da9===_0x3d8fcf)break;else _0x4eca79['push'](_0x4eca79['shift']());}catch(_0x318dda){_0x4eca79['push'](_0x4eca79['shift']());}}}(a26_0x4878,0xdf4ba));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a26_0x4878(){const _0x1fe477=['trino','yes','Schedule\x20run\x20submitted:\x20','abs','has_next_page','Getting\x20schedule\x20history...','π
\x20','update','schedules','jobs','List\x20scheduled\x20queries','query','ended_at','Searching\x20scheduled\x20queries\x20matching\x20\x22','repeat','Create\x20a\x20scheduled\x20query','lastRun','Show\x20schedule\x20details','delay','round','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','next_run_at','validate','\x20\x20Timezone:\x20','success','\x20\x20β\x20','Getting\x20schedule\x20details...','json','Run\x20a\x20scheduled\x20query\x20immediately','list','\x22...','result','Deleting\x20schedule...','statusIcon','223130gCjInN','3407458fbRnWL','created_at','\x20created','from','retryLimit','site','Updating\x20schedule:\x20','run','queryUrl','jsonl','user_name','\x20job','executing_user_id','table','getTime','format','num','scheduled_at','Schedule\x20updated:\x20','400101Yvaomn','keys','name','data','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','red','retry_limit','engineVersion','args','max','show','just\x20now','/app/queries/editor?queryId=','map','Cancelled','status','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','entries','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','...','2239448SnIoMh','1390711xduGjM','\x20scheduled\x20quer','35CKxvyB','queries','utf-8','Schedule\x20created:\x20','schedule:list','3478160KqnQZM','schedule:history','Update\x20a\x20scheduled\x20query','count','type','h\x20ago','limit','\x20(showing\x20','history','listQueries','time_zone','INVALID_ARGUMENT','substring','execute','timezone','No\x20scheduled\x20queries\x20found','delete','cyan','Failed\x20to\x20read\x20file:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedule:update','Creating\x20schedule...','Listing\x20scheduled\x20queries...','description','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Type:\x20','\x20matching\x20\x22','\x20\x20Cron:\x20','1746YRsdRs','\x20execution','20onZSos','padEnd','updated_at','\x20\x20Num:\x20','file','length','\x20\x20Database:\x20','green','\x20(use\x20--limit\x20to\x20see\x20more)','priority','4322688yfrzno','Running\x20schedule:\x20','verbose','Found\x20','error','start_at','toLocaleDateString','in\x20','cron','user','Schedule\x20deleted:\x20','engine_version','last_job','Show\x20schedule\x20execution\x20history'];a26_0x4878=function(){return _0x1fe477;};return a26_0x4878();}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x38b6fa from'chalk';function formatRelativeTime(_0x4c1e9e){const _0xadf274=a26_0x27db,_0x29fd2a=new Date(_0x4c1e9e),_0x4b4fa5=new Date(),_0x4b974e=_0x29fd2a[_0xadf274(0x16b)]()-_0x4b4fa5[_0xadf274(0x16b)](),_0x1f0514=Math[_0xadf274(0x13d)](_0x4b974e)/0x3e8,_0x517188=_0x4b974e<0x0;if(_0x1f0514<0x3c)return _0x517188?_0xadf274(0x17c):'soon';else{if(_0x1f0514<0xe10){const _0x2f5f07=Math[_0xadf274(0x14d)](_0x1f0514/0x3c);return _0x517188?_0x2f5f07+'m\x20ago':_0xadf274(0x133)+_0x2f5f07+'m';}else{if(_0x1f0514<0x15180){const _0x32ae27=Math['round'](_0x1f0514/0xe10);return _0x517188?_0x32ae27+_0xadf274(0x193):_0xadf274(0x133)+_0x32ae27+'h';}else{if(_0x1f0514<0x93a80){const _0x2735df=Math['round'](_0x1f0514/0x15180);return _0x517188?_0x2735df+'d\x20ago':_0xadf274(0x133)+_0x2735df+'d';}else return _0x29fd2a[_0xadf274(0x132)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x2e5284(0x172)]=a26_0x2e5284(0x18d);['description']=a26_0x2e5284(0x144);async[a26_0x2e5284(0x19b)](_0x414ee6){const _0x5056f1=a26_0x2e5284,{options:_0x5105d7,args:_0x149d17,tdx:_0x4692cf}=_0x414ee6,_0x1fdd9e=resolveLimit(_0x5105d7[_0x5056f1(0x194)],DEFAULT_DISPLAY_LIMIT),_0x1dd5da=_0x149d17[0x0],_0x45ebcd=_0x1dd5da?_0x5056f1(0x147)+_0x1dd5da+_0x5056f1(0x158):_0x5056f1(0x119),_0x5467be=await withSpinner(_0x45ebcd,()=>_0x4692cf[_0x5056f1(0x142)][_0x5056f1(0x197)]({'limit':_0x1fdd9e,'scheduled':!![],'pattern':_0x1dd5da}),{'verbose':_0x5105d7[_0x5056f1(0x12e)]}),_0xc64b2b=_0x5467be[_0x5056f1(0x173)][_0x5056f1(0x18a)],_0x2205e6=_0x5467be['data']['pagination'][_0x5056f1(0x13e)],_0x896d6f=_0x1dd5da?_0x5056f1(0x11e)+_0x1dd5da+'\x22':'';_0x2205e6?console['error']('Showing\x20first\x20'+_0xc64b2b['length']+'\x20schedules'+_0x896d6f+_0x5056f1(0x12a)):console[_0x5056f1(0x130)]('Found\x20'+_0xc64b2b[_0x5056f1(0x127)]+_0x5056f1(0x188)+(_0xc64b2b['length']!==0x1?'ies':'y')+_0x896d6f);if(_0x5105d7[_0x5056f1(0x16c)]===_0x5056f1(0x155)||_0x5105d7['format']===_0x5056f1(0x166)||_0x5105d7['format']===_0x5056f1(0x16a)||_0x5105d7['format']==='tsv'){const _0x4c1c2e=_0xc64b2b[_0x5056f1(0x17e)](_0x3309c8=>({'id':_0x3309c8['id'],'name':_0x3309c8['name'],'cron':_0x3309c8[_0x5056f1(0x134)],'database':_0x3309c8[_0x5056f1(0x174)]?.[_0x5056f1(0x172)],'type':_0x3309c8[_0x5056f1(0x192)],'timezone':_0x3309c8[_0x5056f1(0x198)],'user_name':_0x3309c8[_0x5056f1(0x135)]?.['name'],'updated_at':_0x3309c8[_0x5056f1(0x124)],'next_run_at':_0x3309c8['next_run_at'],'last_job_status':_0x3309c8['last_job']?.[_0x5056f1(0x180)]}));await handleSDKOutput(_0x4c1c2e,_0x5105d7);}else{if(_0xc64b2b[_0x5056f1(0x127)]===0x0)console['log'](_0x5056f1(0x19d));else{const _0x56d064=_0x5105d7[_0x5056f1(0x162)],_0x462a28=_0xc64b2b[_0x5056f1(0x17e)](_0x475e38=>{const _0x3b4149=_0x5056f1,_0x42d9b5=_0x475e38[_0x3b4149(0x138)]?.[_0x3b4149(0x180)]?_0x475e38['last_job'][_0x3b4149(0x180)]===_0x3b4149(0x152)?'β':'β':'-',_0x19cf80=_0x475e38[_0x3b4149(0x138)]?.[_0x3b4149(0x146)]?formatRelativeTime(_0x475e38[_0x3b4149(0x138)][_0x3b4149(0x146)]):'never',_0x582f68=_0x475e38['next_run_at']?formatRelativeTime(_0x475e38[_0x3b4149(0x14f)]):'-',_0x3c3e47=_0x475e38[_0x3b4149(0x134)]||'',_0x185d8f=_0x475e38[_0x3b4149(0x172)]||'(unnamed)',_0x2d936a=getConsoleUrl(_0x56d064,_0x3b4149(0x17d)+_0x475e38['id']);return{'statusIcon':_0x42d9b5,'lastRun':_0x19cf80,'nextRun':_0x582f68,'cron':_0x3c3e47,'name':_0x185d8f,'queryUrl':_0x2d936a,'status':_0x475e38[_0x3b4149(0x138)]?.[_0x3b4149(0x180)]};}),_0x1f694e=Math[_0x5056f1(0x17a)](..._0x462a28[_0x5056f1(0x17e)](_0x2ee68e=>_0x2ee68e[_0x5056f1(0x14a)][_0x5056f1(0x127)])),_0x2552f8=Math[_0x5056f1(0x17a)](..._0x462a28[_0x5056f1(0x17e)](_0x4f0777=>_0x4f0777['nextRun']['length'])),_0x4ea46b=Math[_0x5056f1(0x17a)](..._0x462a28[_0x5056f1(0x17e)](_0x4d5ccf=>_0x4d5ccf['cron'][_0x5056f1(0x127)])),_0x28c81c=_0x462a28[_0x5056f1(0x17e)](_0x32a85a=>{const _0x1656ee=_0x5056f1,_0x533ced=_0x32a85a[_0x1656ee(0x180)]===_0x1656ee(0x152)?a26_0x38b6fa[_0x1656ee(0x129)](_0x32a85a[_0x1656ee(0x15b)]):_0x32a85a[_0x1656ee(0x180)]===_0x1656ee(0x130)?a26_0x38b6fa[_0x1656ee(0x176)](_0x32a85a[_0x1656ee(0x15b)]):a26_0x38b6fa['dim'](_0x32a85a['statusIcon']),_0x2cf2e9=_0x32a85a[_0x1656ee(0x14a)][_0x1656ee(0x123)](_0x1f694e),_0x15f7ce=_0x32a85a['nextRun']['padEnd'](_0x2552f8),_0x20f534=_0x32a85a[_0x1656ee(0x134)]?a26_0x38b6fa[_0x1656ee(0x114)](_0x32a85a[_0x1656ee(0x134)][_0x1656ee(0x123)](_0x4ea46b)):'\x20'[_0x1656ee(0x148)](_0x4ea46b),_0x51044f=hyperlink(_0x32a85a[_0x1656ee(0x172)],_0x32a85a[_0x1656ee(0x165)]);return _0x1656ee(0x140)+_0x533ced+'\x20'+_0x2cf2e9+_0x1656ee(0x153)+_0x15f7ce+'\x20\x20'+_0x20f534+'\x20\x20'+_0x51044f;});await writeOutput(_0x28c81c['join']('\x0a'),_0x5105d7['output'],_0x5056f1(0x157));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x2e5284(0x172)]='schedule:show';['description']=a26_0x2e5284(0x14b);['validate'](_0x16b24d){const _0x147ee0=a26_0x2e5284,_0x4cecca=_0x16b24d[_0x147ee0(0x179)][0x0];if(!_0x4cecca)return _0x147ee0(0x175);return undefined;}async[a26_0x2e5284(0x19b)](_0x324200){const _0x557534=a26_0x2e5284,{options:_0x51ee13,args:_0x406a69,tdx:_0x49f413}=_0x324200,_0x5ae51f=_0x406a69[0x0],_0x316a16=await withSpinner(_0x557534(0x154),()=>_0x49f413[_0x557534(0x142)][_0x557534(0x17b)](_0x5ae51f),{'verbose':_0x51ee13[_0x557534(0x12e)]}),_0x4e3a26=_0x316a16['data'],_0xc16a73={'name':_0x4e3a26[_0x557534(0x172)],'cron':_0x4e3a26['cron'],'database':_0x4e3a26['database'],'type':_0x4e3a26[_0x557534(0x192)],'timezone':_0x4e3a26[_0x557534(0x19c)],'user_name':_0x4e3a26[_0x557534(0x167)],'created_at':_0x4e3a26[_0x557534(0x15e)],'engine_version':_0x4e3a26[_0x557534(0x137)],'executing_user_id':_0x4e3a26[_0x557534(0x169)],'query':_0x4e3a26['query'],'delay':_0x4e3a26[_0x557534(0x14c)],'priority':_0x4e3a26[_0x557534(0x12b)],'retry_limit':_0x4e3a26[_0x557534(0x177)],..._0x4e3a26[_0x557534(0x159)]&&{'result':_0x4e3a26[_0x557534(0x159)]}};return await handleSingleObjectOutput(_0xc16a73,_0x51ee13),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';[a26_0x2e5284(0x11a)]=a26_0x2e5284(0x149);[a26_0x2e5284(0x150)](_0x11a179){const _0x4ff368=a26_0x2e5284,_0x87c813=_0x11a179['args'][0x0];if(!_0x87c813)return _0x4ff368(0x11c);return undefined;}async[a26_0x2e5284(0x19b)](_0x20dac9){const _0x1b77f2=a26_0x2e5284,{options:_0x5ab327,args:_0x10ba4b,tdx:_0x1ae1ed}=_0x20dac9,_0x331e85=_0x10ba4b[0x0],_0x30d8e5=_0x5ab327,_0x9c045a=_0x30d8e5[_0x1b77f2(0x174)],_0x11ba6e=_0x30d8e5['file'],_0x5ca2a4=_0x30d8e5[_0x1b77f2(0x192)]||_0x1b77f2(0x13a);let _0x2ab711;try{_0x2ab711=readFileSync(_0x11ba6e,_0x1b77f2(0x18b))[_0x1b77f2(0x181)]();}catch(_0x4204fc){throw new SDKError(ErrorCode[_0x1b77f2(0x199)],_0x1b77f2(0x115)+_0x11ba6e,_0x4204fc instanceof Error?_0x4204fc:undefined);}if(!_0x2ab711)throw new SDKError(ErrorCode[_0x1b77f2(0x199)],'Query\x20file\x20is\x20empty');const _0x1188e9={'database':_0x9c045a,'query':_0x2ab711,'type':_0x5ca2a4};if(_0x30d8e5['cron'])_0x1188e9['cron']=_0x30d8e5[_0x1b77f2(0x134)];if(_0x30d8e5[_0x1b77f2(0x19c)])_0x1188e9['timezone']=_0x30d8e5[_0x1b77f2(0x19c)];if(_0x30d8e5['delay']!==undefined)_0x1188e9[_0x1b77f2(0x14c)]=Number(_0x30d8e5[_0x1b77f2(0x14c)]);if(_0x30d8e5[_0x1b77f2(0x12b)]!==undefined)_0x1188e9[_0x1b77f2(0x12b)]=Number(_0x30d8e5[_0x1b77f2(0x12b)]);if(_0x30d8e5[_0x1b77f2(0x161)]!==undefined)_0x1188e9[_0x1b77f2(0x177)]=Number(_0x30d8e5[_0x1b77f2(0x161)]);if(_0x30d8e5[_0x1b77f2(0x178)])_0x1188e9[_0x1b77f2(0x137)]=_0x30d8e5['engineVersion'];if(_0x30d8e5['result'])_0x1188e9[_0x1b77f2(0x159)]=_0x30d8e5[_0x1b77f2(0x159)];if(_0x5ab327[_0x1b77f2(0x12e)]){console[_0x1b77f2(0x130)]('Creating\x20schedule:\x20'+_0x331e85),console[_0x1b77f2(0x130)](_0x1b77f2(0x128)+_0x9c045a),console[_0x1b77f2(0x130)](_0x1b77f2(0x11d)+_0x5ca2a4);if(_0x1188e9['cron'])console['error'](_0x1b77f2(0x11f)+_0x1188e9[_0x1b77f2(0x134)]);if(_0x1188e9[_0x1b77f2(0x19c)])console['error'](_0x1b77f2(0x151)+_0x1188e9[_0x1b77f2(0x19c)]);}const _0x9fb813=await withSpinner(_0x1b77f2(0x118),()=>_0x1ae1ed[_0x1b77f2(0x142)]['create'](_0x331e85,_0x1188e9),{'verbose':_0x5ab327['verbose']});return console[_0x1b77f2(0x130)](_0x1b77f2(0x18c)+_0x9fb813[_0x1b77f2(0x173)][_0x1b77f2(0x172)]),await handleSingleObjectOutput(_0x9fb813['data'],_0x5ab327),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x2e5284(0x172)]=a26_0x2e5284(0x117);[a26_0x2e5284(0x11a)]=a26_0x2e5284(0x190);[a26_0x2e5284(0x150)](_0x2e12b9){const _0x2b9364=a26_0x2e5284,_0x2eaabf=_0x2e12b9[_0x2b9364(0x179)][0x0];if(!_0x2eaabf)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a26_0x2e5284(0x19b)](_0x52ebe4){const _0x390203=a26_0x2e5284,{options:_0x4db81c,args:_0x59f06c,tdx:_0x1474af}=_0x52ebe4,_0x29c9c8=_0x59f06c[0x0],_0x8e91dc=_0x4db81c,_0x1ed184={};if(_0x8e91dc[_0x390203(0x174)])_0x1ed184[_0x390203(0x174)]=_0x8e91dc[_0x390203(0x174)];if(_0x8e91dc[_0x390203(0x192)])_0x1ed184[_0x390203(0x192)]=_0x8e91dc[_0x390203(0x192)];if(_0x8e91dc[_0x390203(0x134)])_0x1ed184[_0x390203(0x134)]=_0x8e91dc[_0x390203(0x134)];if(_0x8e91dc[_0x390203(0x19c)])_0x1ed184['timezone']=_0x8e91dc['timezone'];if(_0x8e91dc[_0x390203(0x14c)]!==undefined)_0x1ed184[_0x390203(0x14c)]=Number(_0x8e91dc[_0x390203(0x14c)]);if(_0x8e91dc[_0x390203(0x12b)]!==undefined)_0x1ed184['priority']=Number(_0x8e91dc[_0x390203(0x12b)]);if(_0x8e91dc[_0x390203(0x161)]!==undefined)_0x1ed184[_0x390203(0x177)]=Number(_0x8e91dc['retryLimit']);if(_0x8e91dc[_0x390203(0x178)])_0x1ed184['engine_version']=_0x8e91dc[_0x390203(0x178)];if(_0x8e91dc[_0x390203(0x159)])_0x1ed184['result']=_0x8e91dc[_0x390203(0x159)];if(_0x8e91dc[_0x390203(0x126)])try{_0x1ed184['query']=readFileSync(_0x8e91dc[_0x390203(0x126)],_0x390203(0x18b))[_0x390203(0x181)]();}catch(_0x4324b9){throw new SDKError(ErrorCode[_0x390203(0x199)],_0x390203(0x115)+_0x8e91dc[_0x390203(0x126)],_0x4324b9 instanceof Error?_0x4324b9:undefined);}if(Object[_0x390203(0x171)](_0x1ed184)[_0x390203(0x127)]===0x0)throw new SDKError(ErrorCode[_0x390203(0x199)],_0x390203(0x184));if(_0x4db81c['verbose']){console[_0x390203(0x130)](_0x390203(0x163)+_0x29c9c8);for(const [_0xc2d017,_0x2e09a9]of Object[_0x390203(0x183)](_0x1ed184)){_0xc2d017===_0x390203(0x145)?console['error']('\x20\x20'+_0xc2d017+':\x20'+_0x2e09a9[_0x390203(0x19a)](0x0,0x32)+_0x390203(0x185)):console['error']('\x20\x20'+_0xc2d017+':\x20'+_0x2e09a9);}}const _0x1ac560=await withSpinner(_0x390203(0x11b),()=>_0x1474af[_0x390203(0x142)][_0x390203(0x141)](_0x29c9c8,_0x1ed184),{'verbose':_0x4db81c[_0x390203(0x12e)]});return console[_0x390203(0x130)](_0x390203(0x16f)+_0x1ac560['data'][_0x390203(0x172)]),await handleSingleObjectOutput(_0x1ac560[_0x390203(0x173)],_0x4db81c),0x0;}}function a26_0x27db(_0x596802,_0x2d30d7){_0x596802=_0x596802-0x113;const _0x4878ba=a26_0x4878();let _0x27dbc9=_0x4878ba[_0x596802];return _0x27dbc9;}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x2e5284(0x172)]='schedule:delete';['description']='Delete\x20a\x20scheduled\x20query';[a26_0x2e5284(0x150)](_0x591bc6){const _0x3824bb=a26_0x2e5284,_0x5afe0e=_0x591bc6[_0x3824bb(0x179)][0x0];if(!_0x5afe0e)return _0x3824bb(0x116);return undefined;}async[a26_0x2e5284(0x19b)](_0x512329){const _0x518a10=a26_0x2e5284,{options:_0x3d0e42,args:_0x2965e3,tdx:_0x48fe51}=_0x512329,_0x1c0b7b=_0x2965e3[0x0];if(!_0x3d0e42[_0x518a10(0x13b)]){const _0x5a5c71=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x1c0b7b+'\x22?');if(!_0x5a5c71)return console[_0x518a10(0x130)](_0x518a10(0x17f)),0x0;}const _0x498e32=await withSpinner(_0x518a10(0x15a),()=>_0x48fe51[_0x518a10(0x142)][_0x518a10(0x113)](_0x1c0b7b),{'verbose':_0x3d0e42[_0x518a10(0x12e)]});return console['error'](_0x518a10(0x136)+_0x498e32[_0x518a10(0x173)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']='schedule:run';[a26_0x2e5284(0x11a)]=a26_0x2e5284(0x156);[a26_0x2e5284(0x150)](_0x1ca9cd){const _0x436d3f=a26_0x2e5284,_0xff214=_0x1ca9cd[_0x436d3f(0x179)][0x0];if(!_0xff214)return _0x436d3f(0x182);return undefined;}async[a26_0x2e5284(0x19b)](_0x915c6e){const _0x95a12e=a26_0x2e5284,{options:_0x4407e0,args:_0x299cb3,tdx:_0x22a168}=_0x915c6e,_0x49dece=_0x299cb3[0x0],_0x4a6d5c=_0x4407e0,_0x231030=_0x4a6d5c['time'],_0x2d35aa=_0x4a6d5c[_0x95a12e(0x16d)]!==undefined?Number(_0x4a6d5c[_0x95a12e(0x16d)]):undefined;if(_0x4407e0[_0x95a12e(0x12e)]){console[_0x95a12e(0x130)](_0x95a12e(0x12d)+_0x49dece);if(_0x231030)console[_0x95a12e(0x130)]('\x20\x20Time:\x20'+_0x231030);if(_0x2d35aa)console[_0x95a12e(0x130)](_0x95a12e(0x125)+_0x2d35aa);}const _0x310dc0=await withSpinner('Running\x20schedule...',()=>_0x22a168[_0x95a12e(0x142)][_0x95a12e(0x164)](_0x49dece,{'time':_0x231030,'num':_0x2d35aa}),{'verbose':_0x4407e0[_0x95a12e(0x12e)]}),_0x2fa3c7=_0x310dc0['data'][_0x95a12e(0x143)];console[_0x95a12e(0x130)](_0x95a12e(0x13c)+_0x2fa3c7['length']+_0x95a12e(0x168)+(_0x2fa3c7[_0x95a12e(0x127)]!==0x1?'s':'')+_0x95a12e(0x15f));for(const _0x194581 of _0x2fa3c7){console['error']('\x20\x20Job\x20ID:\x20'+_0x194581['job_id']);}return await handleSDKOutput(_0x2fa3c7,_0x4407e0),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x2e5284(0x172)]=a26_0x2e5284(0x18f);[a26_0x2e5284(0x11a)]=a26_0x2e5284(0x139);[a26_0x2e5284(0x150)](_0x479ede){const _0x177dd8=a26_0x2e5284,_0x515624=_0x479ede['args'][0x0];if(!_0x515624)return _0x177dd8(0x14e);return undefined;}async['execute'](_0x2a394){const _0x2b3b0e=a26_0x2e5284,{options:_0x3a2cba,args:_0xb895b6,tdx:_0x20a0b6}=_0x2a394,_0x596fa7=_0xb895b6[0x0],_0x4efe70=_0x3a2cba,_0xee070=_0x4efe70[_0x2b3b0e(0x160)]!==undefined?Number(_0x4efe70[_0x2b3b0e(0x160)]):undefined,_0x267c50=_0x4efe70['to']!==undefined?Number(_0x4efe70['to']):undefined,_0x51a12f=await withSpinner(_0x2b3b0e(0x13f),()=>_0x20a0b6[_0x2b3b0e(0x142)][_0x2b3b0e(0x196)](_0x596fa7,{'from':_0xee070,'to':_0x267c50}),{'verbose':_0x3a2cba['verbose']}),_0x228e9c=_0x51a12f[_0x2b3b0e(0x173)];console[_0x2b3b0e(0x130)](_0x2b3b0e(0x12f)+_0x228e9c[_0x2b3b0e(0x191)]+_0x2b3b0e(0x121)+(_0x228e9c[_0x2b3b0e(0x191)]!==0x1?'s':'')+_0x2b3b0e(0x195)+_0x228e9c[_0x2b3b0e(0x160)]+'-'+_0x228e9c['to']+')');const _0x4801fb=_0x228e9c['history'][_0x2b3b0e(0x17e)](_0x15ed02=>({'job_id':_0x15ed02['job_id'],'type':_0x15ed02['type'],'status':_0x15ed02['status'],'scheduled_at':_0x15ed02[_0x2b3b0e(0x16e)],'created_at':_0x15ed02[_0x2b3b0e(0x15e)],'start_at':_0x15ed02[_0x2b3b0e(0x131)],'end_at':_0x15ed02['end_at']}));return await handleSDKOutput(_0x4801fb,_0x3a2cba),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x41eeed=a27_0x2981;(function(_0x567675,_0x383d79){const _0x58e37a=a27_0x2981,_0xd735e7=_0x567675();while(!![]){try{const _0x5732f9=-parseInt(_0x58e37a(0x74))/0x1+parseInt(_0x58e37a(0x8a))/0x2+-parseInt(_0x58e37a(0xdc))/0x3+parseInt(_0x58e37a(0x94))/0x4+-parseInt(_0x58e37a(0x72))/0x5+-parseInt(_0x58e37a(0x82))/0x6*(-parseInt(_0x58e37a(0xa0))/0x7)+parseInt(_0x58e37a(0x7d))/0x8*(parseInt(_0x58e37a(0x7a))/0x9);if(_0x5732f9===_0x383d79)break;else _0xd735e7['push'](_0xd735e7['shift']());}catch(_0x14c469){_0xd735e7['push'](_0xd735e7['shift']());}}}(a27_0x453a,0x98f9c));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_0x4d374c from'chalk';async function resolveSegmentTarget(_0xc468da,_0x69e26e,_0xe40d38){const _0x1983f0=a27_0x2981;if(isYamlFilePath(_0xc468da))try{const _0x400c3d=await resolveYamlFilePath(_0xc468da);return _0xe40d38&&(console[_0x1983f0(0xb1)](_0x1983f0(0xf4)+_0xc468da),console[_0x1983f0(0xb1)](_0x1983f0(0xad)+_0x400c3d[_0x1983f0(0xef)]),console[_0x1983f0(0xb1)](_0x1983f0(0x80)+_0x400c3d[_0x1983f0(0xe3)]),console[_0x1983f0(0xb1)](_0x1983f0(0x8d)+(_0x400c3d[_0x1983f0(0xf6)]||_0x1983f0(0x87))),console[_0x1983f0(0xb1)](_0x1983f0(0x6a)+_0x400c3d['fullPath'])),_0x400c3d['fullPath'];}catch(_0x3b39ea){throw new SDKError(ErrorCode[_0x1983f0(0x90)],_0x1983f0(0xda)+_0x3b39ea[_0x1983f0(0x97)]);}if(!_0x69e26e)throw new SDKError(ErrorCode[_0x1983f0(0x90)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x69e26e+'/'+_0xc468da;}function a27_0x2981(_0x233369,_0x2baed2){_0x233369=_0x233369-0x69;const _0x453a7b=a27_0x453a();let _0x29811b=_0x453a7b[_0x233369];return _0x29811b;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x41eeed(0x7f);[a27_0x41eeed(0xc9)]=a27_0x41eeed(0x78);async[a27_0x41eeed(0xe0)](_0x2dc1d5){const _0x54b928=a27_0x41eeed,{options:_0x6e79c9,args:_0x35ee87,tdx:_0x5a0906}=_0x2dc1d5,_0x19a7de=_0x35ee87[0x0],_0x2ede9e=!_0x19a7de&&!!_0x6e79c9['parentSegment'],_0x484575=_0x19a7de||_0x6e79c9[_0x54b928(0xef)];if(!_0x484575)return console['error'](_0x54b928(0xd3)),console[_0x54b928(0xb1)](_0x54b928(0x96)),console['error'](_0x54b928(0xfd)),console[_0x54b928(0xb1)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x54b928(0xb1)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x54b928(0xb1)](_0x54b928(0xd8)),console[_0x54b928(0xb1)](_0x54b928(0xc6)),0x1;try{const _0x183864=_0x6e79c9['segmentPath'];let _0x45424e=_0x484575;!_0x2ede9e&&_0x183864&&!_0x484575[_0x54b928(0xbb)]('/')&&(_0x45424e=_0x183864+'/'+_0x484575,_0x6e79c9['verbose']&&console[_0x54b928(0xb1)](_0x54b928(0xba)+_0x45424e));const _0x541c2c=await withSpinner(_0x54b928(0xec)+_0x45424e+_0x54b928(0xc5),()=>_0x5a0906['segment'][_0x54b928(0xd6)](_0x45424e),{'verbose':_0x6e79c9[_0x54b928(0x7e)]}),_0x30834a=_0x541c2c[_0x54b928(0xe6)];_0x6e79c9[_0x54b928(0x7e)]&&(console['error'](_0x54b928(0xaa)+_0x30834a[_0x54b928(0xc0)]),console[_0x54b928(0xb1)](_0x54b928(0x98)+_0x30834a[_0x54b928(0xa1)]),_0x30834a[_0x54b928(0xfb)]&&console['error'](_0x54b928(0x6b)+_0x30834a[_0x54b928(0xfb)]),_0x30834a[_0x54b928(0xdd)]&&console['error'](_0x54b928(0x93)+_0x30834a['segmentId']));if(_0x30834a['type']===_0x54b928(0x89)){const _0x2b7b17=await withSpinner(_0x54b928(0xea),()=>_0x5a0906[_0x54b928(0xd0)][_0x54b928(0xcd)](_0x30834a[_0x54b928(0xa1)]),{'verbose':_0x6e79c9[_0x54b928(0x7e)]});await handleSingleObjectOutput(_0x2b7b17[_0x54b928(0xe6)],_0x6e79c9);}else{if(_0x30834a[_0x54b928(0xc0)]===_0x54b928(0x71)){if(!_0x30834a[_0x54b928(0xfb)])throw new SDKError(ErrorCode[_0x54b928(0xd7)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4e9682=await withSpinner('Fetching\x20folder\x20details...',()=>_0x5a0906[_0x54b928(0xd0)][_0x54b928(0x9f)](_0x30834a[_0x54b928(0xfb)]),{'verbose':_0x6e79c9[_0x54b928(0x7e)]});await handleSingleObjectOutput(_0x4e9682[_0x54b928(0xe6)],_0x6e79c9);}else{if(_0x30834a[_0x54b928(0xc0)]===_0x54b928(0xd0)){if(!_0x30834a[_0x54b928(0xdd)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54b928(0x79));const _0x5dff89=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5a0906[_0x54b928(0xd0)]['getSegment'](_0x30834a[_0x54b928(0xa1)],_0x30834a['segmentId']),{'verbose':_0x6e79c9['verbose']});await handleSingleObjectOutput(_0x5dff89[_0x54b928(0xe6)],_0x6e79c9);}}}return 0x0;}catch(_0x91745){if(_0x91745 instanceof SDKError)return console[_0x54b928(0xb1)](_0x54b928(0xe7)+_0x91745[_0x54b928(0x97)]),_0x91745['cause']&&console[_0x54b928(0xb1)]('\x20\x20Cause:\x20'+_0x91745[_0x54b928(0xbf)]),0x1;throw _0x91745;}}}function a27_0x453a(){const _0xf7d547=['972UrKQaR','β\x20Found\x20','/e/','Error:\x20Folder\x20reference\x20is\x20required','Usage:\x20tdx\x20sg\x20show\x20<name>','(root)','Executing\x20segment\x20query...','parent','2042816jkQzOY','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20parent\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','replace','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','INVALID_ARGUMENT','Resolving\x20\x27','β\x20Query\x20completed:\x20Processed\x20','Segment\x20ID:\x20','1901628PngITf','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Usage:\x20tdx\x20segment\x20describe\x20<path>','message','Parent\x20ID:\x20','cyan','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view\x20-w','Folder\x20name:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','url','getFolder','20097tfmscH','parentId','information_schema','segment:view','parentFolder','setJobId','Create\x20segment\x20folder\x20for\x20organization','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','limit','\x20\x20Parent\x20segment:\x20','query','Use:\x20tdx\x20ps\x20view','segment:sql','error','\x20\x20Cause:\x20','resolveFolderId','in\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getSegment','Parent\x20name:\x20','segment:desc','Resolved\x20relative\x20path\x20to:\x20','includes','log','β\x20Query\x20failed\x20[','elapsedTimeMillis','cause','type','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolved\x20folder\x20ID:\x20','getSegmentSQL','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20segment\x20details...','description','Target\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Options:','getParent','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','length','segment','Usage:\x20tdx\x20sg\x20sql\x20<name>','SQL\x20query:\x0a','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','listFolders','resolvePathToResource','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','SEGMENT_NOT_FOUND','1038840XyjgAe','segmentId','Use:\x20tdx\x20ps\x20sql','Listing\x20folders\x20for\x20parent\x20\x27','execute','/app/ps/','Use:\x20tdx\x20ps\x20show','segmentName','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','jobId','data','Error:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolving\x20parent\x20segment\x20\x27','Fetching\x20parent\x20segment\x20details...','trim','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','test','parentSegment','Show\x20segment\x20folder\x20details','jsonl','web','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Resolved\x20YAML\x20file:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','folderPath','\x20rows\x20','Resolved\x20parent\x20folder\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','Get\x20SQL\x20query\x20for\x20child\x20segment','folderId','Show\x20child\x20segment\x20schema\x20(column\x20types)','Examples:','createFolder','Site:\x20','format','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20Full\x20path:\x20','Folder\x20ID:\x20','Parent\x20segment:\x20','json','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','stats','site','folder','1057415pDvFlx','Show\x20folder\x20or\x20child\x20segment\x20details','1167585YcXIGl','toLocaleString','SELECT\x20*\x20FROM\x20(\x0a','name','Show\x20segment\x20or\x20folder\x20details','Segment\x20ID\x20missing\x20from\x20resolved\x20path','63PSvccv','resolveParentId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','445736lQzvzK','verbose','segment:describe','\x20\x20Segment\x20name:\x20','Fetching\x20folder\x20details...'];a27_0x453a=function(){return _0xf7d547;};return a27_0x453a();}export class SegmentShowCommand extends BaseCommand{[a27_0x41eeed(0x77)]='segment:show';[a27_0x41eeed(0xc9)]=a27_0x41eeed(0x9d);async['execute'](_0x515c23){const _0x272fd3=a27_0x41eeed,{options:_0xcf659b,args:_0x1644f9,tdx:_0x84f82c}=_0x515c23,_0x5c0025=_0x1644f9[0x0];if(!_0x5c0025)return console[_0x272fd3(0xb1)](_0x272fd3(0xb5)),console[_0x272fd3(0xb1)](_0x272fd3(0x86)),console[_0x272fd3(0xb1)](_0x272fd3(0xa7)),console[_0x272fd3(0xb1)]('Examples:'),console[_0x272fd3(0xb1)](_0x272fd3(0x8f)),console[_0x272fd3(0xb1)](_0x272fd3(0x9a)),0x1;try{const _0x44ac75=_0xcf659b[_0x272fd3(0xef)],_0x3ac1ef=await resolveSegmentTarget(_0x5c0025,_0x44ac75,_0xcf659b[_0x272fd3(0x7e)]);_0xcf659b[_0x272fd3(0x7e)]&&console[_0x272fd3(0xb1)](_0x272fd3(0xca)+_0x3ac1ef);const _0x5797b6=await withSpinner('Resolving\x20\x27'+_0x5c0025+_0x272fd3(0xc5),()=>_0x84f82c[_0x272fd3(0xd0)]['resolvePathToResource'](_0x3ac1ef),{'verbose':_0xcf659b[_0x272fd3(0x7e)]}),_0x1dbd2c=_0x5797b6[_0x272fd3(0xe6)];_0xcf659b[_0x272fd3(0x7e)]&&(console[_0x272fd3(0xb1)]('Resolved\x20type:\x20'+_0x1dbd2c['type']),console['error']('Parent\x20ID:\x20'+_0x1dbd2c[_0x272fd3(0xa1)]));if(_0x1dbd2c[_0x272fd3(0xc0)]==='folder')return console['error'](_0x272fd3(0x95)),console[_0x272fd3(0xb1)](_0x272fd3(0x7c)),0x1;if(_0x1dbd2c[_0x272fd3(0xc0)]===_0x272fd3(0x89))return console[_0x272fd3(0xb1)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x272fd3(0xb1)](_0x272fd3(0xe2)),0x1;if(!_0x1dbd2c[_0x272fd3(0xdd)])throw new SDKError(ErrorCode[_0x272fd3(0xdb)],_0x272fd3(0x79));const _0x5c0f7d=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x84f82c[_0x272fd3(0xd0)]['getSegmentSQL'](_0x1dbd2c[_0x272fd3(0xa1)],_0x1dbd2c[_0x272fd3(0xdd)]),{'verbose':_0xcf659b['verbose']});let _0x512270=_0x5c0f7d[_0x272fd3(0xe6)];const _0x186c32=resolveLimit(_0xcf659b[_0x272fd3(0xac)],DEFAULT_DISPLAY_LIMIT),_0x3fef8a=/\bLIMIT\s+\d+/i[_0x272fd3(0xee)](_0x512270);!_0x3fef8a&&(_0x512270=_0x512270[_0x272fd3(0xeb)]()[_0x272fd3(0x8e)](/;+$/,''),_0x512270=_0x272fd3(0x76)+_0x512270+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x186c32);_0xcf659b[_0x272fd3(0x7e)]&&console[_0x272fd3(0xb1)](_0x272fd3(0xd2)+_0x512270);const _0xcb52f3=await withProgressSpinner(_0x272fd3(0x88),async _0x14b263=>{const _0x210823=_0x272fd3,_0x5caf78=await _0x84f82c[_0x210823(0xae)][_0x210823(0xe0)](_0x512270,{'catalog':'td','schema':_0x210823(0xa2),'onJobId':_0x219907=>{const _0x22343f=_0x210823;_0x14b263[_0x22343f(0xa5)](_0x219907);}});return _0x5caf78;},{'verbose':_0xcf659b[_0x272fd3(0x7e)]}),_0x55b346=_0xcb52f3[_0x272fd3(0xe6)],_0x2b932a=_0x55b346[_0x272fd3(0xe5)]?'\x20[Job\x20ID:\x20'+_0x55b346[_0x272fd3(0xe5)]+']':'';return console['error'](_0x272fd3(0x92)+_0x55b346[_0x272fd3(0x6f)]['processedRows'][_0x272fd3(0x75)]()+_0x272fd3(0xf7)+(_0x272fd3(0xb4)+formatElapsed(_0x55b346[_0x272fd3(0x6f)][_0x272fd3(0xbe)])+_0x2b932a)),await handleQueryOutput(_0x55b346,_0xcf659b),0x0;}catch(_0x386a02){if(_0x386a02 instanceof SDKError)return console['error'](_0x272fd3(0xbd)+_0x386a02['code']+']'),console[_0x272fd3(0xb1)]('\x0a'+_0x386a02[_0x272fd3(0x97)]),0x1;throw _0x386a02;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x41eeed(0x77)]='segment:folder:list';['description']=a27_0x41eeed(0xe8);async[a27_0x41eeed(0xe0)](_0x17dd9b){const _0x5bd477=a27_0x41eeed,{options:_0x1b726b,args:_0x1825d9,tdx:_0x2673d8}=_0x17dd9b;if(_0x1825d9[_0x5bd477(0xcf)]===0x0)return console[_0x5bd477(0xb1)](_0x5bd477(0xf5)),console[_0x5bd477(0xb1)](_0x5bd477(0xb6)),0x1;const _0x3903d6=_0x1825d9[0x0];try{_0x1b726b[_0x5bd477(0x7e)]&&(console[_0x5bd477(0xb1)](_0x5bd477(0xff)+_0x1b726b[_0x5bd477(0x70)]),console[_0x5bd477(0xb1)]('Parent\x20name:\x20'+_0x3903d6));const _0x136287=await withSpinner(_0x5bd477(0xe9)+_0x3903d6+_0x5bd477(0xc5),()=>_0x2673d8[_0x5bd477(0xd0)][_0x5bd477(0x7b)](_0x3903d6),{'verbose':_0x1b726b[_0x5bd477(0x7e)]}),_0x312eee=_0x136287[_0x5bd477(0xe6)];_0x1b726b[_0x5bd477(0x7e)]&&console[_0x5bd477(0xb1)]('Resolved\x20parent\x20ID:\x20'+_0x312eee);const _0x10a4ca=await withSpinner(_0x5bd477(0xdf)+_0x3903d6+_0x5bd477(0xc5),()=>_0x2673d8[_0x5bd477(0xd0)][_0x5bd477(0xd5)](_0x312eee),{'verbose':_0x1b726b[_0x5bd477(0x7e)]}),_0xe712b1=_0x10a4ca['data'];return console[_0x5bd477(0xb1)](_0x5bd477(0x83)+_0xe712b1['length']+'\x20folder'+(_0xe712b1[_0x5bd477(0xcf)]!==0x1?'s':'')),await handleSDKOutput(_0xe712b1,_0x1b726b),0x0;}catch(_0x415f1b){if(_0x415f1b instanceof SDKError)return console[_0x5bd477(0xb1)]('Error:\x20'+_0x415f1b['message']),_0x415f1b['cause']&&console[_0x5bd477(0xb1)](_0x5bd477(0xb2)+_0x415f1b[_0x5bd477(0xbf)]),0x1;throw _0x415f1b;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']='segment:folder:show';[a27_0x41eeed(0xc9)]=a27_0x41eeed(0xf0);async[a27_0x41eeed(0xe0)](_0x294d4c){const _0x55005e=a27_0x41eeed,{options:_0x4312e9,args:_0x198d87,tdx:_0xef2746}=_0x294d4c;if(_0x198d87['length']===0x0)return console[_0x55005e(0xb1)](_0x55005e(0x85)),console[_0x55005e(0xb1)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x29d8c8,childId:_0x2d8268}=parseSegmentRef(_0x198d87[0x0]);_0x4312e9[_0x55005e(0x7e)]&&(console['error'](_0x55005e(0xff)+_0x4312e9[_0x55005e(0x70)]),console[_0x55005e(0xb1)](_0x55005e(0xb8)+_0x29d8c8),_0x2d8268&&console[_0x55005e(0xb1)]('Folder\x20name:\x20'+_0x2d8268));if(!_0x2d8268)return console[_0x55005e(0xb1)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x11c1b6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x29d8c8+'\x27...',()=>_0xef2746[_0x55005e(0xd0)][_0x55005e(0x7b)](_0x29d8c8),{'verbose':_0x4312e9[_0x55005e(0x7e)]}),_0x588e53=_0x11c1b6[_0x55005e(0xe6)];_0x4312e9[_0x55005e(0x7e)]&&console[_0x55005e(0xb1)]('Resolved\x20parent\x20ID:\x20'+_0x588e53);const _0x4b5f55=await withSpinner('Resolving\x20folder\x20\x27'+_0x2d8268+_0x55005e(0xc5),()=>_0xef2746[_0x55005e(0xd0)][_0x55005e(0xb3)](_0x588e53,_0x2d8268),{'verbose':_0x4312e9['verbose']}),_0x21b3ad=_0x4b5f55[_0x55005e(0xe6)];_0x4312e9[_0x55005e(0x7e)]&&console[_0x55005e(0xb1)](_0x55005e(0xc3)+_0x21b3ad);const _0x5ab010=await withSpinner('Fetching\x20folder\x20\x27'+_0x2d8268+_0x55005e(0xc5),()=>_0xef2746[_0x55005e(0xd0)][_0x55005e(0x9f)](_0x21b3ad),{'verbose':_0x4312e9[_0x55005e(0x7e)]});return await handleSDKOutput([_0x5ab010[_0x55005e(0xe6)]],_0x4312e9),0x0;}catch(_0x46d16f){if(_0x46d16f instanceof SDKError)return console[_0x55005e(0xb1)](_0x55005e(0xe7)+_0x46d16f[_0x55005e(0x97)]),_0x46d16f[_0x55005e(0xbf)]&&console['error'](_0x55005e(0xb2)+_0x46d16f['cause']),0x1;throw _0x46d16f;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x41eeed(0x77)]=a27_0x41eeed(0xb0);[a27_0x41eeed(0xc9)]=a27_0x41eeed(0xfa);async[a27_0x41eeed(0xe0)](_0x2f1690){const _0x4f9ab2=a27_0x41eeed,{options:_0x4cacc1,args:_0x1a5d2e,tdx:_0x15c087}=_0x2f1690,_0x5166c8=_0x1a5d2e[0x0];if(!_0x5166c8)return console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xb5)),console['error'](_0x4f9ab2(0xd1)),console[_0x4f9ab2(0xb1)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xfd)),console[_0x4f9ab2(0xb1)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xd4)),0x1;try{const _0x173eea=_0x4cacc1['parentSegment'],_0x332efa=await resolveSegmentTarget(_0x5166c8,_0x173eea,_0x4cacc1[_0x4f9ab2(0x7e)]);_0x4cacc1[_0x4f9ab2(0x7e)]&&console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xca)+_0x332efa);const _0x3fd5f5=await withSpinner('Resolving\x20\x27'+_0x5166c8+'\x27...',()=>_0x15c087[_0x4f9ab2(0xd0)][_0x4f9ab2(0xd6)](_0x332efa),{'verbose':_0x4cacc1[_0x4f9ab2(0x7e)]}),_0xd5e708=_0x3fd5f5[_0x4f9ab2(0xe6)];_0x4cacc1[_0x4f9ab2(0x7e)]&&(console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xaa)+_0xd5e708['type']),console[_0x4f9ab2(0xb1)]('Parent\x20ID:\x20'+_0xd5e708[_0x4f9ab2(0xa1)]));if(_0xd5e708[_0x4f9ab2(0xc0)]==='folder')return console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xf3)),console[_0x4f9ab2(0xb1)](_0x4f9ab2(0x69)),0x1;if(_0xd5e708[_0x4f9ab2(0xc0)]===_0x4f9ab2(0x89))return console[_0x4f9ab2(0xb1)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4f9ab2(0xb1)](_0x4f9ab2(0xde)),0x1;if(!_0xd5e708['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4f9ab2(0x79));const _0x64ecb4=await withSpinner(_0x4f9ab2(0xf9),()=>_0x15c087[_0x4f9ab2(0xd0)][_0x4f9ab2(0xc4)](_0xd5e708[_0x4f9ab2(0xa1)],_0xd5e708[_0x4f9ab2(0xdd)]),{'verbose':_0x4cacc1['verbose']}),_0x1a4de3=_0x64ecb4[_0x4f9ab2(0xe6)];return _0x4cacc1[_0x4f9ab2(0x100)]===_0x4f9ab2(0x6d)||_0x4cacc1[_0x4f9ab2(0x100)]===_0x4f9ab2(0xf1)?await handleSDKOutput([{'sql':_0x1a4de3}],_0x4cacc1):console[_0x4f9ab2(0xbc)](_0x1a4de3),0x0;}catch(_0x5c2df3){if(_0x5c2df3 instanceof SDKError)return console['error'](_0x4f9ab2(0xe7)+_0x5c2df3[_0x4f9ab2(0x97)]),_0x5c2df3[_0x4f9ab2(0xbf)]&&console['error']('\x20\x20Cause:\x20'+_0x5c2df3[_0x4f9ab2(0xbf)]),0x1;throw _0x5c2df3;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x41eeed(0x77)]='segment:folder:create';[a27_0x41eeed(0xc9)]=a27_0x41eeed(0xa6);async[a27_0x41eeed(0xe0)](_0x3460a8){const _0x3683c6=a27_0x41eeed,{options:_0x370cd3,args:_0xb61d19,tdx:_0x5149ae}=_0x3460a8,_0x2607f3=_0x370cd3;if(_0xb61d19[_0x3683c6(0xcf)]<0x2)return console[_0x3683c6(0xb1)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x3683c6(0xb1)](_0x3683c6(0xc7)),0x1;const _0x53cef8=_0xb61d19[0x0],_0x364653=_0xb61d19[0x1];_0x2607f3['verbose']&&(console[_0x3683c6(0xb1)](_0x3683c6(0xff)+_0x2607f3[_0x3683c6(0x70)]),console['error'](_0x3683c6(0x6c)+_0x53cef8),console[_0x3683c6(0xb1)](_0x3683c6(0x9c)+_0x364653));let _0x23abe5;if(_0x2607f3['parentFolder']){const _0xe9c3e8=_0x2607f3[_0x3683c6(0xa4)],_0x28aa2f=await withSpinner(_0x3683c6(0xe9)+_0x53cef8+_0x3683c6(0xc5),()=>_0x5149ae[_0x3683c6(0xd0)][_0x3683c6(0x7b)](_0x53cef8),{'verbose':_0x2607f3[_0x3683c6(0x7e)]}),_0x1a389c=_0x28aa2f[_0x3683c6(0xe6)],_0x5b2b24=await withSpinner(_0x3683c6(0x8c)+_0xe9c3e8+_0x3683c6(0xc5),()=>_0x5149ae[_0x3683c6(0xd0)]['resolveFolderId'](_0x1a389c,_0xe9c3e8),{'verbose':_0x2607f3[_0x3683c6(0x7e)]});_0x23abe5=_0x5b2b24[_0x3683c6(0xe6)],_0x2607f3[_0x3683c6(0x7e)]&&console['error'](_0x3683c6(0xf8)+_0x23abe5);}const _0x2e17db={'name':_0x364653,'description':_0x2607f3[_0x3683c6(0xc9)],'parentFolderId':_0x23abe5},_0x305e07=await withSpinner('Creating\x20folder\x20\x27'+_0x364653+_0x3683c6(0xc5),()=>_0x5149ae[_0x3683c6(0xd0)][_0x3683c6(0xfe)](_0x53cef8,_0x2e17db),{'verbose':_0x2607f3[_0x3683c6(0x7e)]}),_0x5140fd=_0x305e07[_0x3683c6(0xe6)];return console['error']('β\x20Created\x20folder\x20\x27'+_0x5140fd['name']+'\x27\x20with\x20ID:\x20'+_0x5140fd['id']),await handleSDKOutput([_0x5140fd],_0x2607f3),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a27_0x41eeed(0xa3);[a27_0x41eeed(0xc9)]=a27_0x41eeed(0x73);async[a27_0x41eeed(0xe0)](_0x3e9e03){const _0x2bc655=a27_0x41eeed,{options:_0x40fbe8,args:_0x557fbd,tdx:_0x2574bb}=_0x3e9e03,_0x43c6e1=_0x557fbd[0x0];if(!_0x43c6e1)return console[_0x2bc655(0xb1)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x2bc655(0x6e)),console[_0x2bc655(0xb1)](_0x2bc655(0xa9)),console[_0x2bc655(0xb1)](_0x2bc655(0xcc)),console[_0x2bc655(0xb1)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x2bc655(0xb1)](_0x2bc655(0xfd)),console[_0x2bc655(0xb1)](_0x2bc655(0xe4)),console[_0x2bc655(0xb1)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x2bc655(0xcb)),console[_0x2bc655(0xb1)](_0x2bc655(0xab)),0x1;try{const _0x44d341=_0x40fbe8['parentSegment'],_0x795f10=await resolveSegmentTarget(_0x43c6e1,_0x44d341,_0x40fbe8[_0x2bc655(0x7e)]);_0x40fbe8['verbose']&&console[_0x2bc655(0xb1)](_0x2bc655(0xca)+_0x795f10);const _0x21fe10=await withSpinner(_0x2bc655(0x91)+_0x43c6e1+_0x2bc655(0xc5),()=>_0x2574bb[_0x2bc655(0xd0)][_0x2bc655(0xd6)](_0x795f10),{'verbose':_0x40fbe8[_0x2bc655(0x7e)]}),_0x577b70=_0x21fe10['data'];_0x40fbe8['verbose']&&(console[_0x2bc655(0xb1)](_0x2bc655(0xaa)+_0x577b70[_0x2bc655(0xc0)]),console[_0x2bc655(0xb1)](_0x2bc655(0x98)+_0x577b70['parentId']),_0x577b70[_0x2bc655(0xfb)]&&console[_0x2bc655(0xb1)](_0x2bc655(0x6b)+_0x577b70[_0x2bc655(0xfb)]),_0x577b70[_0x2bc655(0xdd)]&&console[_0x2bc655(0xb1)](_0x2bc655(0x93)+_0x577b70[_0x2bc655(0xdd)]));if(_0x40fbe8[_0x2bc655(0xf2)]){if(_0x577b70[_0x2bc655(0xc0)]===_0x2bc655(0x71))return console[_0x2bc655(0xb1)](_0x2bc655(0xce)),0x1;if(_0x577b70[_0x2bc655(0xc0)]===_0x2bc655(0x89))return console[_0x2bc655(0xb1)](_0x2bc655(0x8b)),console[_0x2bc655(0xb1)](_0x2bc655(0x9b)),0x1;if(!_0x577b70[_0x2bc655(0xdd)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2bc655(0x79));const _0x3b6a06=getConsoleNextUrl(_0x40fbe8[_0x2bc655(0x70)],_0x2bc655(0xe1)+_0x577b70[_0x2bc655(0xa1)]+_0x2bc655(0x84)+_0x577b70[_0x2bc655(0xdd)]);return console[_0x2bc655(0xb1)](a27_0x4d374c['green']('β')+'\x20Opening\x20'+a27_0x4d374c[_0x2bc655(0x99)](_0x3b6a06)),openBrowser(_0x3b6a06),0x0;}if(_0x577b70['type']===_0x2bc655(0x71)){if(!_0x577b70[_0x2bc655(0xfb)])throw new SDKError(ErrorCode[_0x2bc655(0xd7)],_0x2bc655(0xd9));const _0x1b1cd9=await withSpinner(_0x2bc655(0x81),()=>_0x2574bb[_0x2bc655(0xd0)][_0x2bc655(0x9f)](_0x577b70[_0x2bc655(0xfb)]),{'verbose':_0x40fbe8[_0x2bc655(0x7e)]});await handleSingleObjectOutput(_0x1b1cd9[_0x2bc655(0xe6)],_0x40fbe8);}else{if(_0x577b70[_0x2bc655(0xc0)]===_0x2bc655(0xd0)){if(!_0x577b70[_0x2bc655(0xdd)])throw new SDKError(ErrorCode[_0x2bc655(0xdb)],_0x2bc655(0x79));const _0x33491d=await withSpinner(_0x2bc655(0xc8),()=>_0x2574bb[_0x2bc655(0xd0)][_0x2bc655(0xb7)](_0x577b70[_0x2bc655(0xa1)],_0x577b70[_0x2bc655(0xdd)]),{'verbose':_0x40fbe8[_0x2bc655(0x7e)]}),_0x254e59=getConsoleNextUrl(_0x40fbe8['site'],_0x2bc655(0xe1)+_0x577b70[_0x2bc655(0xa1)]+_0x2bc655(0x84)+_0x577b70[_0x2bc655(0xdd)]),_0x33848c=_0x33491d['data'];_0x33848c[_0x2bc655(0x9e)]=_0x254e59,await handleSingleObjectOutput(_0x33848c,_0x40fbe8);}else return console[_0x2bc655(0xb1)](_0x2bc655(0xc1)),console[_0x2bc655(0xb1)](_0x2bc655(0xaf)),0x1;}return 0x0;}catch(_0x578fd6){if(_0x578fd6 instanceof SDKError)return console[_0x2bc655(0xb1)](_0x2bc655(0xe7)+_0x578fd6[_0x2bc655(0x97)]),_0x578fd6[_0x2bc655(0xbf)]&&console[_0x2bc655(0xb1)](_0x2bc655(0xb2)+_0x578fd6['cause']),0x1;throw _0x578fd6;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a27_0x41eeed(0xb9);[a27_0x41eeed(0xc9)]=a27_0x41eeed(0xfc);async[a27_0x41eeed(0xe0)](_0x35814a){const _0x120e10=a27_0x41eeed,{options:_0x286022,args:_0x4cd975,tdx:_0x28749}=_0x35814a,_0x45be47=_0x4cd975[0x0];if(!_0x45be47)return console[_0x120e10(0xb1)](_0x120e10(0xb5)),console[_0x120e10(0xb1)](_0x120e10(0xa8)),console[_0x120e10(0xb1)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x120e10(0xb1)](_0x120e10(0xfd)),console[_0x120e10(0xb1)](_0x120e10(0xc2)),console[_0x120e10(0xb1)](_0x120e10(0xed)),0x1;try{const _0x5530d4=_0x286022[_0x120e10(0xef)],_0x38e770=await resolveSegmentTarget(_0x45be47,_0x5530d4,_0x286022[_0x120e10(0x7e)]);_0x286022[_0x120e10(0x7e)]&&console[_0x120e10(0xb1)](_0x120e10(0xca)+_0x38e770);const _0x27f0bb=await withSpinner('Resolving\x20\x27'+_0x45be47+_0x120e10(0xc5),()=>_0x28749[_0x120e10(0xd0)][_0x120e10(0xd6)](_0x38e770),{'verbose':_0x286022[_0x120e10(0x7e)]}),_0x544a1c=_0x27f0bb[_0x120e10(0xe6)];_0x286022[_0x120e10(0x7e)]&&(console[_0x120e10(0xb1)]('Resolved\x20type:\x20'+_0x544a1c[_0x120e10(0xc0)]),console['error'](_0x120e10(0x98)+_0x544a1c[_0x120e10(0xa1)]));if(_0x544a1c[_0x120e10(0xc0)]===_0x120e10(0x71))return console[_0x120e10(0xb1)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x120e10(0xb1)](_0x120e10(0x69)),0x1;if(_0x544a1c[_0x120e10(0xc0)]===_0x120e10(0x89))return console[_0x120e10(0xb1)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x120e10(0xb1)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x544a1c[_0x120e10(0xdd)])throw new SDKError(ErrorCode[_0x120e10(0xdb)],_0x120e10(0x79));const _0x367c9c=await withSpinner(_0x120e10(0xf9),()=>_0x28749[_0x120e10(0xd0)][_0x120e10(0xc4)](_0x544a1c['parentId'],_0x544a1c[_0x120e10(0xdd)]),{'verbose':_0x286022[_0x120e10(0x7e)]}),_0x30e6d7=_0x367c9c[_0x120e10(0xe6)],_0x2bbab8=await executeSchemaQuery(_0x30e6d7,_0x28749,_0x286022);return await handleQueryOutput(_0x2bbab8,_0x286022),0x0;}catch(_0x420a83){if(_0x420a83 instanceof SDKError)return console['error']('Error:\x20'+_0x420a83['message']),_0x420a83[_0x120e10(0xbf)]&&console[_0x120e10(0xb1)](_0x120e10(0xb2)+_0x420a83[_0x120e10(0xbf)]),0x1;throw _0x420a83;}}}
|
|
1
|
+
function a27_0x5b3d(){const _0x537811=['\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','534McSmpX','β\x20Query\x20completed:\x20Processed\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','query','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolved\x20YAML\x20file:\x20','format','Get\x20SQL\x20query\x20for\x20child\x20segment','parentFolder','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','test','6985xIVbcx','includes','segment:desc','Resolving\x20parent\x20segment\x20\x27','\x27...','type','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','processedRows','1857Oeshta','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segmentPath','Folder\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','\x20Opening\x20','in\x20','Show\x20segment\x20folder\x20details','segment:sql','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segment:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','code','(root)','getFolder','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','fullPath','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Parent\x20segment:\x20','β\x20Found\x20','segment:folder:show','getSegmentSQL','listFolders','Segment\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','message','Use:\x20tdx\x20ps\x20sql','\x20\x20Segment\x20name:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20','trim','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','green','execute','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Executing\x20segment\x20query...','folder','data','Resolved\x20parent\x20ID:\x20','createFolder','description','segmentName','getParent','INVALID_ARGUMENT','Folder\x20name:\x20','stats','/e/','segment','Fetching\x20folder\x20\x27','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','416811NDxXQo','Show\x20folder\x20or\x20child\x20segment\x20details','\x20folder','cause','\x20rows\x20','β\x20Query\x20failed\x20[','verbose','Show\x20segment\x20or\x20folder\x20details','length','segment:folder:list','segment:view','Target\x20path:\x20','error','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','site','Resolved\x20folder\x20ID:\x20','name','web','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Parent\x20ID:\x20','Site:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20Full\x20path:\x20','folderId','Use:\x20tdx\x20ps\x20view','segment:folder:create','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','8028qCNquF','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20show','resolveFolderId','SEGMENT_NOT_FOUND','5780173IEPIGn','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','120700EVMKJf','Segment\x20ID\x20missing\x20from\x20resolved\x20path','information_schema','11777190CIJnfE','parentSegment','Examples:','2248vIVDHc','Fetching\x20folder\x20details...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Fetching\x20SQL\x20for\x20segment...','resolvePathToResource','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20desc\x20<name>','limit','segmentId','elapsedTimeMillis','resolveParentId','setJobId','Options:','Resolving\x20\x27','3106wrGrww','SELECT\x20*\x20FROM\x20(\x0a','parent','jobId','Fetching\x20segment\x20details...','Use:\x20tdx\x20ps\x20view\x20-w','Resolved\x20relative\x20path\x20to:\x20','Resolved\x20type:\x20','toLocaleString','replace','Usage:\x20tdx\x20sg\x20sql\x20<name>','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','json','\x20\x20Folder\x20path:\x20','Create\x20segment\x20folder\x20for\x20organization','Fetching\x20parent\x20segment\x20details...','β\x20Created\x20folder\x20\x27','url','folderPath','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20desc','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolved\x20parent\x20folder\x20ID:\x20','/app/ps/','parentId','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'];a27_0x5b3d=function(){return _0x537811;};return a27_0x5b3d();}const a27_0x4474b8=a27_0xd14d;(function(_0x3f85fc,_0x29f52e){const _0x4b30fd=a27_0xd14d,_0x1089b5=_0x3f85fc();while(!![]){try{const _0x35fd9d=parseInt(_0x4b30fd(0x136))/0x1+parseInt(_0x4b30fd(0x171))/0x2*(parseInt(_0x4b30fd(0x100))/0x3)+-parseInt(_0x4b30fd(0x15b))/0x4+parseInt(_0x4b30fd(0xf8))/0x5*(-parseInt(_0x4b30fd(0x18f))/0x6)+parseInt(_0x4b30fd(0x159))/0x7+parseInt(_0x4b30fd(0x161))/0x8*(-parseInt(_0x4b30fd(0x153))/0x9)+-parseInt(_0x4b30fd(0x15e))/0xa;if(_0x35fd9d===_0x29f52e)break;else _0x1089b5['push'](_0x1089b5['shift']());}catch(_0x54c104){_0x1089b5['push'](_0x1089b5['shift']());}}}(a27_0x5b3d,0x979b2));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_0x49c260 from'chalk';async function resolveSegmentTarget(_0x127057,_0x36a9ff,_0x39451d){const _0x2b8e1f=a27_0xd14d;if(isYamlFilePath(_0x127057))try{const _0x4b41b3=await resolveYamlFilePath(_0x127057);return _0x39451d&&(console[_0x2b8e1f(0x142)](_0x2b8e1f(0x194)+_0x127057),console['error'](_0x2b8e1f(0x116)+_0x4b41b3['parentSegment']),console['error'](_0x2b8e1f(0x11f)+_0x4b41b3[_0x2b8e1f(0x12d)]),console[_0x2b8e1f(0x142)](_0x2b8e1f(0x17f)+(_0x4b41b3[_0x2b8e1f(0x184)]||_0x2b8e1f(0x10e))),console['error'](_0x2b8e1f(0x14e)+_0x4b41b3[_0x2b8e1f(0x111)])),_0x4b41b3[_0x2b8e1f(0x111)];}catch(_0x507d51){throw new SDKError(ErrorCode[_0x2b8e1f(0x12f)],_0x2b8e1f(0x10a)+_0x507d51[_0x2b8e1f(0x11d)]);}if(!_0x36a9ff)throw new SDKError(ErrorCode[_0x2b8e1f(0x12f)],_0x2b8e1f(0x149));return _0x36a9ff+'/'+_0x127057;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a27_0x4474b8(0x12c)]=a27_0x4474b8(0x13d);async[a27_0x4474b8(0x125)](_0xe12a7d){const _0x46e35c=a27_0x4474b8,{options:_0x1ccb44,args:_0x48a024,tdx:_0x3552d3}=_0xe12a7d,_0x477099=_0x48a024[0x0],_0x16414c=!_0x477099&&!!_0x1ccb44[_0x46e35c(0x15f)],_0x31b48d=_0x477099||_0x1ccb44[_0x46e35c(0x15f)];if(!_0x31b48d)return console[_0x46e35c(0x142)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x46e35c(0x142)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x46e35c(0x142)](_0x46e35c(0x160)),console[_0x46e35c(0x142)](_0x46e35c(0x14d)),console[_0x46e35c(0x142)](_0x46e35c(0x165)),console[_0x46e35c(0x142)](_0x46e35c(0x163)),console[_0x46e35c(0x142)](_0x46e35c(0x185)),0x1;try{const _0xa9f269=_0x1ccb44[_0x46e35c(0x102)];let _0x1a6ea9=_0x31b48d;!_0x16414c&&_0xa9f269&&!_0x31b48d[_0x46e35c(0xf9)]('/')&&(_0x1a6ea9=_0xa9f269+'/'+_0x31b48d,_0x1ccb44[_0x46e35c(0x13c)]&&console['error'](_0x46e35c(0x177)+_0x1a6ea9));const _0x2679df=await withSpinner('Resolving\x20path\x20\x27'+_0x1a6ea9+_0x46e35c(0xfc),()=>_0x3552d3[_0x46e35c(0x133)][_0x46e35c(0x167)](_0x1a6ea9),{'verbose':_0x1ccb44[_0x46e35c(0x13c)]}),_0x24f52a=_0x2679df['data'];_0x1ccb44[_0x46e35c(0x13c)]&&(console['error'](_0x46e35c(0x178)+_0x24f52a[_0x46e35c(0xfd)]),console[_0x46e35c(0x142)](_0x46e35c(0x14a)+_0x24f52a['parentId']),_0x24f52a[_0x46e35c(0x14f)]&&console['error'](_0x46e35c(0x103)+_0x24f52a['folderId']),_0x24f52a[_0x46e35c(0x16b)]&&console[_0x46e35c(0x142)](_0x46e35c(0x11b)+_0x24f52a['segmentId']));if(_0x24f52a[_0x46e35c(0xfd)]===_0x46e35c(0x173)){const _0x41b324=await withSpinner(_0x46e35c(0x181),()=>_0x3552d3[_0x46e35c(0x133)][_0x46e35c(0x12e)](_0x24f52a[_0x46e35c(0x18b)]),{'verbose':_0x1ccb44[_0x46e35c(0x13c)]});await handleSingleObjectOutput(_0x41b324['data'],_0x1ccb44);}else{if(_0x24f52a[_0x46e35c(0xfd)]===_0x46e35c(0x128)){if(!_0x24f52a[_0x46e35c(0x14f)])throw new SDKError(ErrorCode[_0x46e35c(0x17c)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3bca3d=await withSpinner(_0x46e35c(0x162),()=>_0x3552d3[_0x46e35c(0x133)][_0x46e35c(0x10f)](_0x24f52a[_0x46e35c(0x14f)]),{'verbose':_0x1ccb44['verbose']});await handleSingleObjectOutput(_0x3bca3d[_0x46e35c(0x129)],_0x1ccb44);}else{if(_0x24f52a[_0x46e35c(0xfd)]==='segment'){if(!_0x24f52a[_0x46e35c(0x16b)])throw new SDKError(ErrorCode[_0x46e35c(0x158)],_0x46e35c(0x15c));const _0x1d69b6=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3552d3[_0x46e35c(0x133)]['getSegment'](_0x24f52a['parentId'],_0x24f52a[_0x46e35c(0x16b)]),{'verbose':_0x1ccb44[_0x46e35c(0x13c)]});await handleSingleObjectOutput(_0x1d69b6[_0x46e35c(0x129)],_0x1ccb44);}}}return 0x0;}catch(_0x3e8155){if(_0x3e8155 instanceof SDKError)return console[_0x46e35c(0x142)]('Error:\x20'+_0x3e8155[_0x46e35c(0x11d)]),_0x3e8155[_0x46e35c(0x139)]&&console[_0x46e35c(0x142)](_0x46e35c(0x186)+_0x3e8155[_0x46e35c(0x139)]),0x1;throw _0x3e8155;}}}export class SegmentShowCommand extends BaseCommand{['name']=a27_0x4474b8(0x10b);[a27_0x4474b8(0x12c)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x4474b8(0x125)](_0x3bf1b5){const _0x4a9517=a27_0x4474b8,{options:_0x490477,args:_0x4c2a8b,tdx:_0x53ea92}=_0x3bf1b5,_0x45bf31=_0x4c2a8b[0x0];if(!_0x45bf31)return console[_0x4a9517(0x142)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4a9517(0x142)](_0x4a9517(0x14c)),console['error'](_0x4a9517(0x193)),console[_0x4a9517(0x142)](_0x4a9517(0x160)),console[_0x4a9517(0x142)](_0x4a9517(0x154)),console[_0x4a9517(0x142)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x44f96f=_0x490477[_0x4a9517(0x15f)],_0x1740e9=await resolveSegmentTarget(_0x45bf31,_0x44f96f,_0x490477[_0x4a9517(0x13c)]);_0x490477[_0x4a9517(0x13c)]&&console[_0x4a9517(0x142)](_0x4a9517(0x141)+_0x1740e9);const _0x4a527e=await withSpinner(_0x4a9517(0x170)+_0x45bf31+_0x4a9517(0xfc),()=>_0x53ea92[_0x4a9517(0x133)]['resolvePathToResource'](_0x1740e9),{'verbose':_0x490477[_0x4a9517(0x13c)]}),_0x5f23b8=_0x4a527e['data'];_0x490477[_0x4a9517(0x13c)]&&(console[_0x4a9517(0x142)](_0x4a9517(0x178)+_0x5f23b8[_0x4a9517(0xfd)]),console[_0x4a9517(0x142)]('Parent\x20ID:\x20'+_0x5f23b8[_0x4a9517(0x18b)]));if(_0x5f23b8['type']==='folder')return console['error'](_0x4a9517(0x17d)),console['error'](_0x4a9517(0x15a)),0x1;if(_0x5f23b8[_0x4a9517(0xfd)]===_0x4a9517(0x173))return console[_0x4a9517(0x142)](_0x4a9517(0x135)),console[_0x4a9517(0x142)](_0x4a9517(0x156)),0x1;if(!_0x5f23b8['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2c0ce2=await withSpinner(_0x4a9517(0x166),()=>_0x53ea92['segment'][_0x4a9517(0x119)](_0x5f23b8[_0x4a9517(0x18b)],_0x5f23b8[_0x4a9517(0x16b)]),{'verbose':_0x490477[_0x4a9517(0x13c)]});let _0xd15779=_0x2c0ce2[_0x4a9517(0x129)];const _0x50b8d6=resolveLimit(_0x490477[_0x4a9517(0x16a)],DEFAULT_DISPLAY_LIMIT),_0x5e77c9=/\bLIMIT\s+\d+/i[_0x4a9517(0x199)](_0xd15779);!_0x5e77c9&&(_0xd15779=_0xd15779[_0x4a9517(0x122)]()[_0x4a9517(0x17a)](/;+$/,''),_0xd15779=_0x4a9517(0x172)+_0xd15779+_0x4a9517(0x120)+_0x50b8d6);_0x490477[_0x4a9517(0x13c)]&&console[_0x4a9517(0x142)](_0x4a9517(0x143)+_0xd15779);const _0x2a0886=await withProgressSpinner(_0x4a9517(0x127),async _0x4ed652=>{const _0x3a7c5b=_0x4a9517,_0x2442e7=await _0x53ea92[_0x3a7c5b(0x192)]['execute'](_0xd15779,{'catalog':'td','schema':_0x3a7c5b(0x15d),'onJobId':_0x1b1e9b=>{const _0x352c55=_0x3a7c5b;_0x4ed652[_0x352c55(0x16e)](_0x1b1e9b);}});return _0x2442e7;},{'verbose':_0x490477[_0x4a9517(0x13c)]}),_0x1021ae=_0x2a0886['data'],_0x1afa87=_0x1021ae[_0x4a9517(0x174)]?'\x20[Job\x20ID:\x20'+_0x1021ae['jobId']+']':'';return console['error'](_0x4a9517(0x190)+_0x1021ae[_0x4a9517(0x131)][_0x4a9517(0xff)][_0x4a9517(0x179)]()+_0x4a9517(0x13a)+(_0x4a9517(0x106)+formatElapsed(_0x1021ae[_0x4a9517(0x131)][_0x4a9517(0x16c)])+_0x1afa87)),await handleQueryOutput(_0x1021ae,_0x490477),0x0;}catch(_0x1d3739){if(_0x1d3739 instanceof SDKError)return console[_0x4a9517(0x142)](_0x4a9517(0x13b)+_0x1d3739[_0x4a9517(0x10d)]+']'),console[_0x4a9517(0x142)]('\x0a'+_0x1d3739[_0x4a9517(0x11d)]),0x1;throw _0x1d3739;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0x13f);[a27_0x4474b8(0x12c)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a27_0x4474b8(0x125)](_0x2eae46){const _0x3ea2bb=a27_0x4474b8,{options:_0x2cde3b,args:_0x3d7e4d,tdx:_0x37d123}=_0x2eae46;if(_0x3d7e4d['length']===0x0)return console[_0x3ea2bb(0x142)](_0x3ea2bb(0x112)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x231761=_0x3d7e4d[0x0];try{_0x2cde3b['verbose']&&(console[_0x3ea2bb(0x142)](_0x3ea2bb(0x14b)+_0x2cde3b[_0x3ea2bb(0x145)]),console['error'](_0x3ea2bb(0x114)+_0x231761));const _0x420cba=await withSpinner(_0x3ea2bb(0xfb)+_0x231761+_0x3ea2bb(0xfc),()=>_0x37d123[_0x3ea2bb(0x133)][_0x3ea2bb(0x16d)](_0x231761),{'verbose':_0x2cde3b[_0x3ea2bb(0x13c)]}),_0x5ba91e=_0x420cba[_0x3ea2bb(0x129)];_0x2cde3b['verbose']&&console[_0x3ea2bb(0x142)]('Resolved\x20parent\x20ID:\x20'+_0x5ba91e);const _0x3d539c=await withSpinner(_0x3ea2bb(0x18c)+_0x231761+_0x3ea2bb(0xfc),()=>_0x37d123['segment'][_0x3ea2bb(0x11a)](_0x5ba91e),{'verbose':_0x2cde3b['verbose']}),_0x3e0d38=_0x3d539c[_0x3ea2bb(0x129)];return console[_0x3ea2bb(0x142)](_0x3ea2bb(0x117)+_0x3e0d38[_0x3ea2bb(0x13e)]+_0x3ea2bb(0x138)+(_0x3e0d38[_0x3ea2bb(0x13e)]!==0x1?'s':'')),await handleSDKOutput(_0x3e0d38,_0x2cde3b),0x0;}catch(_0x88ead0){if(_0x88ead0 instanceof SDKError)return console[_0x3ea2bb(0x142)](_0x3ea2bb(0x121)+_0x88ead0[_0x3ea2bb(0x11d)]),_0x88ead0[_0x3ea2bb(0x139)]&&console[_0x3ea2bb(0x142)](_0x3ea2bb(0x186)+_0x88ead0[_0x3ea2bb(0x139)]),0x1;throw _0x88ead0;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0x118);[a27_0x4474b8(0x12c)]=a27_0x4474b8(0x107);async[a27_0x4474b8(0x125)](_0x3a4803){const _0x5656b2=a27_0x4474b8,{options:_0x26eb74,args:_0x5b359f,tdx:_0x5abc9b}=_0x3a4803;if(_0x5b359f[_0x5656b2(0x13e)]===0x0)return console['error'](_0x5656b2(0x104)),console[_0x5656b2(0x142)](_0x5656b2(0x168)),0x1;try{const {parentId:_0x2c627b,childId:_0x180cd9}=parseSegmentRef(_0x5b359f[0x0]);_0x26eb74[_0x5656b2(0x13c)]&&(console[_0x5656b2(0x142)]('Site:\x20'+_0x26eb74['site']),console[_0x5656b2(0x142)](_0x5656b2(0x114)+_0x2c627b),_0x180cd9&&console['error'](_0x5656b2(0x130)+_0x180cd9));if(!_0x180cd9)return console['error'](_0x5656b2(0x123)),0x1;const _0x5b504c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2c627b+'\x27...',()=>_0x5abc9b[_0x5656b2(0x133)][_0x5656b2(0x16d)](_0x2c627b),{'verbose':_0x26eb74[_0x5656b2(0x13c)]}),_0x28ecbf=_0x5b504c[_0x5656b2(0x129)];_0x26eb74['verbose']&&console['error'](_0x5656b2(0x12a)+_0x28ecbf);const _0x58d753=await withSpinner('Resolving\x20folder\x20\x27'+_0x180cd9+_0x5656b2(0xfc),()=>_0x5abc9b[_0x5656b2(0x133)][_0x5656b2(0x157)](_0x28ecbf,_0x180cd9),{'verbose':_0x26eb74[_0x5656b2(0x13c)]}),_0xa77e1d=_0x58d753[_0x5656b2(0x129)];_0x26eb74[_0x5656b2(0x13c)]&&console['error'](_0x5656b2(0x146)+_0xa77e1d);const _0x2229b9=await withSpinner(_0x5656b2(0x134)+_0x180cd9+_0x5656b2(0xfc),()=>_0x5abc9b['segment']['getFolder'](_0xa77e1d),{'verbose':_0x26eb74[_0x5656b2(0x13c)]});return await handleSDKOutput([_0x2229b9[_0x5656b2(0x129)]],_0x26eb74),0x0;}catch(_0x105df5){if(_0x105df5 instanceof SDKError)return console[_0x5656b2(0x142)](_0x5656b2(0x121)+_0x105df5['message']),_0x105df5[_0x5656b2(0x139)]&&console['error'](_0x5656b2(0x186)+_0x105df5[_0x5656b2(0x139)]),0x1;throw _0x105df5;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0x108);['description']=a27_0x4474b8(0x196);async[a27_0x4474b8(0x125)](_0x2b825d){const _0x5b0536=a27_0x4474b8,{options:_0x100fe1,args:_0x2365a4,tdx:_0x41ef03}=_0x2b825d,_0x97954a=_0x2365a4[0x0];if(!_0x97954a)return console[_0x5b0536(0x142)](_0x5b0536(0x191)),console[_0x5b0536(0x142)](_0x5b0536(0x17b)),console[_0x5b0536(0x142)](_0x5b0536(0x155)),console[_0x5b0536(0x142)](_0x5b0536(0x160)),console[_0x5b0536(0x142)](_0x5b0536(0x198)),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x16db34=_0x100fe1[_0x5b0536(0x15f)],_0x471015=await resolveSegmentTarget(_0x97954a,_0x16db34,_0x100fe1['verbose']);_0x100fe1[_0x5b0536(0x13c)]&&console['error']('Target\x20path:\x20'+_0x471015);const _0x2db491=await withSpinner(_0x5b0536(0x170)+_0x97954a+'\x27...',()=>_0x41ef03[_0x5b0536(0x133)][_0x5b0536(0x167)](_0x471015),{'verbose':_0x100fe1[_0x5b0536(0x13c)]}),_0x1bdc02=_0x2db491[_0x5b0536(0x129)];_0x100fe1['verbose']&&(console[_0x5b0536(0x142)](_0x5b0536(0x178)+_0x1bdc02[_0x5b0536(0xfd)]),console[_0x5b0536(0x142)](_0x5b0536(0x14a)+_0x1bdc02[_0x5b0536(0x18b)]));if(_0x1bdc02['type']===_0x5b0536(0x128))return console[_0x5b0536(0x142)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1bdc02[_0x5b0536(0xfd)]===_0x5b0536(0x173))return console[_0x5b0536(0x142)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5b0536(0x142)](_0x5b0536(0x11e)),0x1;if(!_0x1bdc02['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1c5ed1=await withSpinner(_0x5b0536(0x166),()=>_0x41ef03[_0x5b0536(0x133)][_0x5b0536(0x119)](_0x1bdc02[_0x5b0536(0x18b)],_0x1bdc02[_0x5b0536(0x16b)]),{'verbose':_0x100fe1[_0x5b0536(0x13c)]}),_0x2ae09f=_0x1c5ed1[_0x5b0536(0x129)];return _0x100fe1[_0x5b0536(0x195)]===_0x5b0536(0x17e)||_0x100fe1[_0x5b0536(0x195)]==='jsonl'?await handleSDKOutput([{'sql':_0x2ae09f}],_0x100fe1):console['log'](_0x2ae09f),0x0;}catch(_0x172945){if(_0x172945 instanceof SDKError)return console[_0x5b0536(0x142)]('Error:\x20'+_0x172945[_0x5b0536(0x11d)]),_0x172945['cause']&&console[_0x5b0536(0x142)](_0x5b0536(0x186)+_0x172945['cause']),0x1;throw _0x172945;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0x151);[a27_0x4474b8(0x12c)]=a27_0x4474b8(0x180);async[a27_0x4474b8(0x125)](_0x9999b1){const _0x26c612=a27_0x4474b8,{options:_0x550fd8,args:_0x39a968,tdx:_0x181ba8}=_0x9999b1,_0x21b559=_0x550fd8;if(_0x39a968[_0x26c612(0x13e)]<0x2)return console[_0x26c612(0x142)](_0x26c612(0x188)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x3c957c=_0x39a968[0x0],_0x374631=_0x39a968[0x1];_0x21b559[_0x26c612(0x13c)]&&(console['error']('Site:\x20'+_0x21b559[_0x26c612(0x145)]),console[_0x26c612(0x142)]('Parent\x20segment:\x20'+_0x3c957c),console[_0x26c612(0x142)](_0x26c612(0x130)+_0x374631));let _0x500436;if(_0x21b559[_0x26c612(0x197)]){const _0x164b5c=_0x21b559['parentFolder'],_0x3212c0=await withSpinner(_0x26c612(0xfb)+_0x3c957c+'\x27...',()=>_0x181ba8[_0x26c612(0x133)][_0x26c612(0x16d)](_0x3c957c),{'verbose':_0x21b559['verbose']}),_0x3c681b=_0x3212c0[_0x26c612(0x129)],_0x3e6e12=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x164b5c+_0x26c612(0xfc),()=>_0x181ba8['segment'][_0x26c612(0x157)](_0x3c681b,_0x164b5c),{'verbose':_0x21b559['verbose']});_0x500436=_0x3e6e12[_0x26c612(0x129)],_0x21b559[_0x26c612(0x13c)]&&console[_0x26c612(0x142)](_0x26c612(0x189)+_0x500436);}const _0x524488={'name':_0x374631,'description':_0x21b559[_0x26c612(0x12c)],'parentFolderId':_0x500436},_0x52b5f8=await withSpinner('Creating\x20folder\x20\x27'+_0x374631+_0x26c612(0xfc),()=>_0x181ba8['segment'][_0x26c612(0x12b)](_0x3c957c,_0x524488),{'verbose':_0x21b559[_0x26c612(0x13c)]}),_0x1731cc=_0x52b5f8[_0x26c612(0x129)];return console[_0x26c612(0x142)](_0x26c612(0x182)+_0x1731cc[_0x26c612(0x147)]+'\x27\x20with\x20ID:\x20'+_0x1731cc['id']),await handleSDKOutput([_0x1731cc],_0x21b559),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0x140);[a27_0x4474b8(0x12c)]=a27_0x4474b8(0x137);async[a27_0x4474b8(0x125)](_0xf558e6){const _0x31d563=a27_0x4474b8,{options:_0x3f1275,args:_0x1b5cff,tdx:_0x49736d}=_0xf558e6,_0x496f85=_0x1b5cff[0x0];if(!_0x496f85)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x31d563(0x109)),console[_0x31d563(0x142)](_0x31d563(0x11c)),console[_0x31d563(0x142)](_0x31d563(0x16f)),console[_0x31d563(0x142)](_0x31d563(0x18d)),console[_0x31d563(0x142)](_0x31d563(0x160)),console[_0x31d563(0x142)](_0x31d563(0x115)),console[_0x31d563(0x142)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x31d563(0x142)](_0x31d563(0x101)),console[_0x31d563(0x142)](_0x31d563(0x144)),0x1;try{const _0x5bb7c2=_0x3f1275[_0x31d563(0x15f)],_0x3b6b1f=await resolveSegmentTarget(_0x496f85,_0x5bb7c2,_0x3f1275['verbose']);_0x3f1275['verbose']&&console['error']('Target\x20path:\x20'+_0x3b6b1f);const _0x2dcd5e=await withSpinner(_0x31d563(0x170)+_0x496f85+_0x31d563(0xfc),()=>_0x49736d[_0x31d563(0x133)][_0x31d563(0x167)](_0x3b6b1f),{'verbose':_0x3f1275['verbose']}),_0x573e2d=_0x2dcd5e['data'];_0x3f1275['verbose']&&(console['error'](_0x31d563(0x178)+_0x573e2d[_0x31d563(0xfd)]),console[_0x31d563(0x142)](_0x31d563(0x14a)+_0x573e2d[_0x31d563(0x18b)]),_0x573e2d[_0x31d563(0x14f)]&&console['error']('Folder\x20ID:\x20'+_0x573e2d[_0x31d563(0x14f)]),_0x573e2d['segmentId']&&console[_0x31d563(0x142)](_0x31d563(0x11b)+_0x573e2d[_0x31d563(0x16b)]));if(_0x3f1275[_0x31d563(0x148)]){if(_0x573e2d[_0x31d563(0xfd)]===_0x31d563(0x128))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x573e2d[_0x31d563(0xfd)]===_0x31d563(0x173))return console['error'](_0x31d563(0x110)),console[_0x31d563(0x142)](_0x31d563(0x176)),0x1;if(!_0x573e2d['segmentId'])throw new SDKError(ErrorCode[_0x31d563(0x158)],_0x31d563(0x15c));const _0x5ba3ac=getConsoleNextUrl(_0x3f1275['site'],_0x31d563(0x18a)+_0x573e2d[_0x31d563(0x18b)]+_0x31d563(0x132)+_0x573e2d[_0x31d563(0x16b)]);return console['error'](a27_0x49c260[_0x31d563(0x124)]('β')+_0x31d563(0x105)+a27_0x49c260['cyan'](_0x5ba3ac)),openBrowser(_0x5ba3ac),0x0;}if(_0x573e2d[_0x31d563(0xfd)]===_0x31d563(0x128)){if(!_0x573e2d[_0x31d563(0x14f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x31d563(0x113));const _0x3d2e62=await withSpinner(_0x31d563(0x162),()=>_0x49736d[_0x31d563(0x133)][_0x31d563(0x10f)](_0x573e2d[_0x31d563(0x14f)]),{'verbose':_0x3f1275['verbose']});await handleSingleObjectOutput(_0x3d2e62[_0x31d563(0x129)],_0x3f1275);}else{if(_0x573e2d[_0x31d563(0xfd)]===_0x31d563(0x133)){if(!_0x573e2d['segmentId'])throw new SDKError(ErrorCode[_0x31d563(0x158)],_0x31d563(0x15c));const _0x383cc6=await withSpinner(_0x31d563(0x175),()=>_0x49736d[_0x31d563(0x133)]['getSegment'](_0x573e2d[_0x31d563(0x18b)],_0x573e2d['segmentId']),{'verbose':_0x3f1275[_0x31d563(0x13c)]}),_0xe476e1=getConsoleNextUrl(_0x3f1275['site'],'/app/ps/'+_0x573e2d[_0x31d563(0x18b)]+_0x31d563(0x132)+_0x573e2d[_0x31d563(0x16b)]),_0x2c04d8=_0x383cc6['data'];_0x2c04d8[_0x31d563(0x183)]=_0xe476e1,await handleSingleObjectOutput(_0x2c04d8,_0x3f1275);}else return console['error'](_0x31d563(0x164)),console[_0x31d563(0x142)](_0x31d563(0x150)),0x1;}return 0x0;}catch(_0x49574a){if(_0x49574a instanceof SDKError)return console[_0x31d563(0x142)](_0x31d563(0x121)+_0x49574a[_0x31d563(0x11d)]),_0x49574a[_0x31d563(0x139)]&&console[_0x31d563(0x142)](_0x31d563(0x186)+_0x49574a['cause']),0x1;throw _0x49574a;}}}function a27_0xd14d(_0x1c67d8,_0x556715){_0x1c67d8=_0x1c67d8-0xf8;const _0x5b3d49=a27_0x5b3d();let _0xd14d2f=_0x5b3d49[_0x1c67d8];return _0xd14d2f;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x4474b8(0x147)]=a27_0x4474b8(0xfa);[a27_0x4474b8(0x12c)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x102413){const _0x3d2770=a27_0x4474b8,{options:_0x30106e,args:_0x3ba2b2,tdx:_0x1eb103}=_0x102413,_0x4da54a=_0x3ba2b2[0x0];if(!_0x4da54a)return console[_0x3d2770(0x142)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3d2770(0x142)](_0x3d2770(0x169)),console[_0x3d2770(0x142)](_0x3d2770(0x10c)),console['error'](_0x3d2770(0x160)),console[_0x3d2770(0x142)](_0x3d2770(0x18e)),console[_0x3d2770(0x142)](_0x3d2770(0x126)),0x1;try{const _0x43e006=_0x30106e[_0x3d2770(0x15f)],_0x2840b4=await resolveSegmentTarget(_0x4da54a,_0x43e006,_0x30106e[_0x3d2770(0x13c)]);_0x30106e[_0x3d2770(0x13c)]&&console[_0x3d2770(0x142)](_0x3d2770(0x141)+_0x2840b4);const _0x510bea=await withSpinner('Resolving\x20\x27'+_0x4da54a+'\x27...',()=>_0x1eb103[_0x3d2770(0x133)][_0x3d2770(0x167)](_0x2840b4),{'verbose':_0x30106e['verbose']}),_0xc81dd4=_0x510bea[_0x3d2770(0x129)];_0x30106e['verbose']&&(console[_0x3d2770(0x142)](_0x3d2770(0x178)+_0xc81dd4[_0x3d2770(0xfd)]),console[_0x3d2770(0x142)]('Parent\x20ID:\x20'+_0xc81dd4['parentId']));if(_0xc81dd4[_0x3d2770(0xfd)]===_0x3d2770(0x128))return console['error'](_0x3d2770(0x152)),console[_0x3d2770(0x142)](_0x3d2770(0xfe)),0x1;if(_0xc81dd4[_0x3d2770(0xfd)]===_0x3d2770(0x173))return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x3d2770(0x187)),0x1;if(!_0xc81dd4[_0x3d2770(0x16b)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3d2770(0x15c));const _0x3b301e=await withSpinner(_0x3d2770(0x166),()=>_0x1eb103[_0x3d2770(0x133)]['getSegmentSQL'](_0xc81dd4[_0x3d2770(0x18b)],_0xc81dd4['segmentId']),{'verbose':_0x30106e[_0x3d2770(0x13c)]}),_0x246240=_0x3b301e[_0x3d2770(0x129)],_0x332426=await executeSchemaQuery(_0x246240,_0x1eb103,_0x30106e);return await handleQueryOutput(_0x332426,_0x30106e),0x0;}catch(_0x59a6c8){if(_0x59a6c8 instanceof SDKError)return console[_0x3d2770(0x142)]('Error:\x20'+_0x59a6c8[_0x3d2770(0x11d)]),_0x59a6c8[_0x3d2770(0x139)]&&console[_0x3d2770(0x142)](_0x3d2770(0x186)+_0x59a6c8[_0x3d2770(0x139)]),0x1;throw _0x59a6c8;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x165ec2=a28_0x38a9;function a28_0x2d7c(){const _0x389d03=['includes','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolved\x20relative\x20path\x20to:\x20','Segment\x20name:\x20','Creating\x20segment\x20\x27','folderId','47605QvUZEg','Parent:\x20','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','kind','resolveParentId','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','type','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','segment:create','ruleFile','name','Create\x20child\x20segment\x20with\x20filtering\x20rules','description','3280697cMcdGn','Parent\x20path:\x20','rule','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','4151900nSrNBu','\x20\x20\x20Path:\x20','segments','2266XvQLKL','1916216xQXahm','data','Resolved\x20folder\x20ID:\x20','createSegment','yellow','116oAmLct','415839dOWOYf','\x27\x20with\x20ID:\x20','noCountPopulation','Target\x20path:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','verbose','segment','site','Resolving\x20folder\x20\x27','execute','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','832980EWlGWo','207TCMsNS','Site:\x20','9YtTyGu','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','folder'];a28_0x2d7c=function(){return _0x389d03;};return a28_0x2d7c();}function a28_0x38a9(_0x4fb93c,_0x10e225){_0x4fb93c=_0x4fb93c-0x197;const _0x2d7ce0=a28_0x2d7c();let _0x38a97c=_0x2d7ce0[_0x4fb93c];return _0x38a97c;}(function(_0x272136,_0x104f8f){const _0x2c6d08=a28_0x38a9,_0x146906=_0x272136();while(!![]){try{const _0x216658=parseInt(_0x2c6d08(0x1bf))/0x1+-parseInt(_0x2c6d08(0x1b8))/0x2*(parseInt(_0x2c6d08(0x197))/0x3)+-parseInt(_0x2c6d08(0x1be))/0x4*(-parseInt(_0x2c6d08(0x1a2))/0x5)+-parseInt(_0x2c6d08(0x1ca))/0x6+parseInt(_0x2c6d08(0x1b0))/0x7+parseInt(_0x2c6d08(0x1b9))/0x8*(-parseInt(_0x2c6d08(0x199))/0x9)+-parseInt(_0x2c6d08(0x1b5))/0xa;if(_0x216658===_0x104f8f)break;else _0x146906['push'](_0x146906['shift']());}catch(_0x2d0182){_0x146906['push'](_0x146906['shift']());}}}(a28_0x2d7c,0x4687f));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_0x3aa052 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x165ec2(0x1ad)]=a28_0x165ec2(0x1ab);['description']=a28_0x165ec2(0x1ae);async[a28_0x165ec2(0x1c8)](_0x22d0e8){const _0x127336=a28_0x165ec2;console[_0x127336(0x1a4)](a28_0x3aa052[_0x127336(0x1bd)](_0x127336(0x1aa))),console[_0x127336(0x1a4)](a28_0x3aa052['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x153e1b,args:_0x1d6c0a,tdx:_0x78168d}=_0x22d0e8,_0x2ccd6f=_0x153e1b;if(_0x1d6c0a['length']===0x0)return console['error'](_0x127336(0x1a8)),console[_0x127336(0x1a4)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x127336(0x1a4)]('Examples:'),console[_0x127336(0x1a4)](_0x127336(0x19a)),console[_0x127336(0x1a4)](_0x127336(0x1a5)),console['error'](_0x127336(0x1c9)),0x1;const _0x33a05a=_0x1d6c0a[0x0],_0x18eb9b=_0x153e1b['segmentPath'];let _0x4591d7=_0x33a05a;_0x18eb9b&&!_0x33a05a[_0x127336(0x19c)]('/')&&(_0x4591d7=_0x18eb9b+'/'+_0x33a05a,_0x2ccd6f['verbose']&&console['error'](_0x127336(0x19e)+_0x4591d7));const _0x2b9f63=parsePath(_0x4591d7);if(_0x2b9f63[_0x127336(0x1b7)]['length']<0x2)return console[_0x127336(0x1a4)](_0x127336(0x19d)),console[_0x127336(0x1a4)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x590f92=_0x2b9f63[_0x127336(0x1b7)][0x0],_0x39c464=getBaseName(_0x4591d7),_0x386a24=getParentPath(_0x4591d7);_0x2ccd6f[_0x127336(0x1c4)]&&(console[_0x127336(0x1a4)](_0x127336(0x198)+_0x2ccd6f[_0x127336(0x1c6)]),console[_0x127336(0x1a4)](_0x127336(0x1c2)+_0x4591d7),console['error'](_0x127336(0x1a3)+_0x590f92),console[_0x127336(0x1a4)](_0x127336(0x19f)+_0x39c464),console[_0x127336(0x1a4)](_0x127336(0x1b1)+_0x386a24));const _0x1ac9e1=await withSpinner(_0x127336(0x1b3)+_0x590f92+'\x27...',()=>_0x78168d[_0x127336(0x1c5)][_0x127336(0x1a7)](_0x590f92),{'verbose':_0x2ccd6f[_0x127336(0x1c4)]}),_0x3853b6=_0x1ac9e1[_0x127336(0x1ba)];let _0x2f74c7;if(_0x2b9f63[_0x127336(0x1b7)]['length']>0x2){const _0x4eaea5=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x386a24+'\x27...',()=>_0x78168d[_0x127336(0x1c5)][_0x127336(0x1b4)](_0x386a24),{'verbose':_0x2ccd6f[_0x127336(0x1c4)]}),_0x5807cb=_0x4eaea5['data'];if(_0x5807cb[_0x127336(0x1a9)]!==_0x127336(0x19b)&&_0x5807cb[_0x127336(0x1a9)]!=='parent')return console[_0x127336(0x1a4)](_0x127336(0x1c3)),0x1;_0x2f74c7=_0x5807cb[_0x127336(0x1a1)];}else{if(_0x2ccd6f['folder']){const _0x38953d=await withSpinner(_0x127336(0x1c7)+_0x2ccd6f[_0x127336(0x19b)]+'\x27...',()=>_0x78168d[_0x127336(0x1c5)]['resolveFolderId'](_0x3853b6,_0x2ccd6f[_0x127336(0x19b)]),{'verbose':_0x2ccd6f[_0x127336(0x1c4)]});_0x2f74c7=_0x38953d[_0x127336(0x1ba)];}}_0x2ccd6f[_0x127336(0x1c4)]&&_0x2f74c7&&console[_0x127336(0x1a4)](_0x127336(0x1bb)+_0x2f74c7);const _0x1b865e=await loadJSONFromOptions(_0x2ccd6f[_0x127336(0x1b2)],_0x2ccd6f[_0x127336(0x1ac)]),_0x11d4a5={'name':_0x39c464,'description':_0x2ccd6f[_0x127336(0x1af)],'rule':_0x1b865e,'kind':_0x2ccd6f[_0x127336(0x1a6)]!==undefined?parseInt(_0x2ccd6f[_0x127336(0x1a6)],0xa):undefined,'isVisible':_0x2ccd6f['invisible']?![]:undefined,'segmentFolderId':_0x2f74c7,'countPopulation':_0x2ccd6f[_0x127336(0x1c1)]?![]:undefined},_0xc3f1cb=await withSpinner(_0x127336(0x1a0)+_0x39c464+'\x27...',()=>_0x78168d[_0x127336(0x1c5)][_0x127336(0x1bc)](_0x3853b6,_0x11d4a5),{'verbose':_0x2ccd6f[_0x127336(0x1c4)]}),_0x15b196=_0xc3f1cb[_0x127336(0x1ba)];return console[_0x127336(0x1a4)]('β\x20Created\x20segment\x20\x27'+_0x15b196['name']+_0x127336(0x1c0)+_0x15b196['id']),_0x4591d7!==_0x33a05a&&console['error'](_0x127336(0x1b6)+_0x4591d7),await handleSDKOutput([_0x15b196],_0x2ccd6f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a29_0x3100f0=a29_0x971f;(function(_0xe07326,_0x5d3364){const _0x3a5b7b=a29_0x971f,_0x10bf13=_0xe07326();while(!![]){try{const _0x4623e0=parseInt(_0x3a5b7b(0xed))/0x1*(-parseInt(_0x3a5b7b(0xeb))/0x2)+-parseInt(_0x3a5b7b(0xf0))/0x3+parseInt(_0x3a5b7b(0xea))/0x4+parseInt(_0x3a5b7b(0xe5))/0x5*(parseInt(_0x3a5b7b(0xf8))/0x6)+parseInt(_0x3a5b7b(0xec))/0x7*(parseInt(_0x3a5b7b(0xf1))/0x8)+parseInt(_0x3a5b7b(0xf7))/0x9*(-parseInt(_0x3a5b7b(0xee))/0xa)+-parseInt(_0x3a5b7b(0xf6))/0xb*(-parseInt(_0x3a5b7b(0xdb))/0xc);if(_0x4623e0===_0x5d3364)break;else _0x10bf13['push'](_0x10bf13['shift']());}catch(_0x2973c2){_0x10bf13['push'](_0x10bf13['shift']());}}}(a29_0x2299,0x38f38));import{BaseCommand}from'./command.js';function a29_0x2299(){const _0x1b6b9d=['Error:\x20Parent\x20segment\x20name\x20is\x20required','segment','Listing\x20fields\x20for\x20\x27','1101309MyLhMz','9BMtcCQ','6DTNTNg','name','data','36taAhRD','segment:fields','\x20field','β\x20Found\x20','error','description','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','listFields','\x27...','execute','1835080PtcuyW','json','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','verbose','Parent\x20segment:\x20','5200oUygdy','106Fajmpe','2632tGWCFd','4831mcNAMt','913610hsZkWM','jsonl','547119mZZCxF','2008supvar','length'];a29_0x2299=function(){return _0x1b6b9d;};return a29_0x2299();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a29_0x971f(_0x57c020,_0x398d15){_0x57c020=_0x57c020-0xd9;const _0x2299cf=a29_0x2299();let _0x971f15=_0x2299cf[_0x57c020];return _0x971f15;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x3100f0(0xd9)]=a29_0x3100f0(0xdc);[a29_0x3100f0(0xe0)]='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x3100f0(0xe4)](_0x282d20){const _0x46882f=a29_0x3100f0,{options:_0x24c570,args:_0x3b1611,tdx:_0x3d912a}=_0x282d20,_0x1fd20f=_0x3b1611[0x0]||_0x24c570['parentSegment'];if(!_0x1fd20f)return console['error'](_0x46882f(0xf3)),console[_0x46882f(0xdf)](_0x46882f(0xe1)),console['error'](_0x46882f(0xe7)),0x1;_0x24c570[_0x46882f(0xe8)]&&(console[_0x46882f(0xdf)]('Site:\x20'+_0x24c570['site']),console[_0x46882f(0xdf)](_0x46882f(0xe9)+_0x1fd20f));const _0x10bbb3=await withSpinner(_0x46882f(0xf5)+_0x1fd20f+_0x46882f(0xe3),()=>_0x3d912a[_0x46882f(0xf4)][_0x46882f(0xe2)](_0x1fd20f),{'verbose':_0x24c570[_0x46882f(0xe8)]}),_0x32b2f1=_0x10bbb3[_0x46882f(0xda)];console[_0x46882f(0xdf)](_0x46882f(0xde)+_0x32b2f1[_0x46882f(0xf2)]+_0x46882f(0xdd)+(_0x32b2f1[_0x46882f(0xf2)]!==0x1?'s':''));if(_0x24c570[_0x46882f(0xe6)]||_0x24c570[_0x46882f(0xef)])return await handleSDKOutput(_0x32b2f1,_0x24c570),0x0;return displayFieldsHumanReadable(_0x32b2f1,_0x1fd20f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x58a8ad=a30_0x498e;function a30_0x498e(_0x4eaf83,_0x475663){_0x4eaf83=_0x4eaf83-0x1b7;const _0x481d81=a30_0x481d();let _0x498ea=_0x481d81[_0x4eaf83];return _0x498ea;}(function(_0x47247a,_0x32e0f2){const _0x40a262=a30_0x498e,_0x5396e5=_0x47247a();while(!![]){try{const _0x28747c=parseInt(_0x40a262(0x1ba))/0x1+-parseInt(_0x40a262(0x1f3))/0x2*(-parseInt(_0x40a262(0x1cf))/0x3)+parseInt(_0x40a262(0x1b8))/0x4*(parseInt(_0x40a262(0x1c8))/0x5)+parseInt(_0x40a262(0x1fb))/0x6+parseInt(_0x40a262(0x1ff))/0x7*(parseInt(_0x40a262(0x1c9))/0x8)+parseInt(_0x40a262(0x1d8))/0x9*(parseInt(_0x40a262(0x1cb))/0xa)+-parseInt(_0x40a262(0x1fe))/0xb*(parseInt(_0x40a262(0x1c5))/0xc);if(_0x28747c===_0x32e0f2)break;else _0x5396e5['push'](_0x5396e5['shift']());}catch(_0x22f783){_0x5396e5['push'](_0x5396e5['shift']());}}}(a30_0x481d,0xb66b6));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a30_0x481d(){const _0x3ea561=['absolutePath','\x20activations','6596544GhebYk','\x20new\x20files','Site:\x20','22dShReu','7DRfaDx','setPhase','session','dirname','\x20versions)','Aborted.','8oaNMiL','name','129265WIhDpZ','cwd','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','journeyVersions','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20=\x20','\x20files?','no_parent','\x0aChanges\x20to\x20\x27','12085296MaoLtj','files','cyan','603020IsVGaf','4213960lDIWvk','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','5080jvfKRs','\x20files\x20to\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','diff','30dyUhNO','relativePath','activations','pullSegments','\x20\x20πΊοΈ\x20\x20','parentName','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','\x20segments','helpText','5157UBcEqF','verbose','dim','error','\x20journeys','\x0aPull\x20summary\x20for\x20\x27','length','green','\x27...','description','Error:\x20','β\x20Context\x20set:\x20','\x20unchanged\x20files','site','targetDir','red','segments','message','isNew','yes','yellow','errorCode','journeys','Pulling\x20segments\x20from\x20\x27','hasChanges','filter','repeat','94736TNjjoP','segment:pull','resourceName','counts','parentSegment','Write\x20'];a30_0x481d=function(){return _0x3ea561;};return a30_0x481d();}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x2ccacf from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x23bf49 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_0x58a8ad(0x1b9)]=a30_0x58a8ad(0x1f4);[a30_0x58a8ad(0x1e1)]=a30_0x58a8ad(0x1d5);async['execute'](_0x2f156f){const _0x3940da=a30_0x58a8ad,{options:_0x338999,args:_0x16caf3,tdx:_0x2d4f82}=_0x2f156f,_0x308846=_0x338999,_0x2d8079=await resolveTarget({'arg':_0x16caf3[0x0],'contextParent':_0x338999[_0x3940da(0x1f7)],'cwd':process[_0x3940da(0x1bb)]()});if(!isSuccessfulResolution(_0x2d8079))return _0x2d8079[_0x3940da(0x1ed)]===_0x3940da(0x1c3)?(console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1ec)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x3940da(0x1db)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x3940da(0x1db)](_0x3940da(0x1ca)),console[_0x3940da(0x1db)](_0x3940da(0x1bd))):(console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1e7)](_0x3940da(0x1e2)+_0x2d8079[_0x3940da(0x1e9)]+'\x0a')),_0x2d8079[_0x3940da(0x1d7)]&&console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1c7)](_0x2d8079[_0x3940da(0x1d7)]))),0x1;const _0x39ac2c=_0x2d8079[_0x3940da(0x1d4)],_0x3064aa=_0x2d8079[_0x3940da(0x1e6)],_0x53808c=_0x2d8079['type']==='file'?_0x2d8079[_0x3940da(0x1f5)]:undefined;_0x308846[_0x3940da(0x1d9)]&&(console[_0x3940da(0x1db)](_0x3940da(0x1fd)+_0x308846[_0x3940da(0x1e5)]),console['error']('Parent\x20segment:\x20'+_0x39ac2c),_0x53808c&&console[_0x3940da(0x1db)]('Target\x20resource:\x20'+_0x53808c));const _0x5c2377=await withProgressSpinner(_0x3940da(0x1ef)+_0x39ac2c+_0x3940da(0x1e0),_0x4d63cf=>_0x2d4f82[_0x3940da(0x1bc)][_0x3940da(0x1d2)](_0x39ac2c,{'targetDir':_0x3064aa,'targetResourceName':_0x53808c,'verbose':_0x308846[_0x3940da(0x1d9)],'progress':{'update':_0x194065=>{const _0x39c801=_0x3940da;_0x4d63cf[_0x39c801(0x200)](_0x194065),_0x308846[_0x39c801(0x1d9)]&&console[_0x39c801(0x1db)]('\x20\x20'+_0x194065);}}}),{'verbose':_0x308846[_0x3940da(0x1d9)]}),_0x4e2753=_0x5c2377['data'];if(_0x4e2753[_0x3940da(0x1f6)][_0x3940da(0x1e8)]===0x0&&_0x4e2753[_0x3940da(0x1f6)][_0x3940da(0x1ee)]===0x0)return console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1ec)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4e2753['parentName']+'\x27')),0x0;const _0x41d998=_0x4e2753[_0x3940da(0x1c6)][_0x3940da(0x1f1)](_0x3d6622=>_0x3d6622[_0x3940da(0x1ea)]),_0x5ad164=_0x4e2753[_0x3940da(0x1c6)]['filter'](_0x43e725=>!_0x43e725[_0x3940da(0x1ea)]&&_0x43e725['hasChanges']),_0x33c4a1=_0x4e2753[_0x3940da(0x1c6)][_0x3940da(0x1f1)](_0x47348b=>!_0x47348b[_0x3940da(0x1ea)]&&!_0x47348b[_0x3940da(0x1f0)]);console[_0x3940da(0x1db)](_0x3940da(0x1dd)+_0x4e2753[_0x3940da(0x1d4)]+'\x27:'),console[_0x3940da(0x1db)]('\x20\x20π―\x20'+a30_0x2ccacf[_0x3940da(0x1c7)](_0x4e2753['counts']['segments']+_0x3940da(0x1d6))+'\x20with\x20'+a30_0x2ccacf['cyan'](_0x4e2753[_0x3940da(0x1f6)][_0x3940da(0x1d1)]+_0x3940da(0x1fa)));if(_0x4e2753['counts'][_0x3940da(0x1ee)]>0x0){const _0x194e97=_0x4e2753[_0x3940da(0x1f6)][_0x3940da(0x1be)]>_0x4e2753[_0x3940da(0x1f6)]['journeys']?'\x20('+_0x4e2753[_0x3940da(0x1f6)]['journeyVersions']+_0x3940da(0x203):'';console[_0x3940da(0x1db)](_0x3940da(0x1d3)+a30_0x2ccacf[_0x3940da(0x1c7)](_0x4e2753[_0x3940da(0x1f6)][_0x3940da(0x1ee)]+_0x3940da(0x1dc))+a30_0x2ccacf[_0x3940da(0x1da)](_0x194e97));}console[_0x3940da(0x1db)]('\x20\x20'+a30_0x2ccacf['green']('+\x20'+_0x41d998[_0x3940da(0x1de)]+_0x3940da(0x1fc))),console[_0x3940da(0x1db)]('\x20\x20'+a30_0x2ccacf['yellow']('~\x20'+_0x5ad164['length']+'\x20changed\x20files')),console[_0x3940da(0x1db)]('\x20\x20'+a30_0x2ccacf[_0x3940da(0x1da)]('=\x20'+_0x33c4a1['length']+_0x3940da(0x1e4))),console[_0x3940da(0x1db)]('\x20\x20Target:\x20'+a30_0x2ccacf['cyan'](_0x4e2753['targetDir'])+'\x0a');if(_0x5ad164['length']>0x0)for(const _0x133a28 of _0x5ad164){console[_0x3940da(0x1db)](_0x3940da(0x1c4)+_0x133a28[_0x3940da(0x1d0)]+'\x27:'),console['error']('β'['repeat'](0x3c)),console[_0x3940da(0x1db)](_0x133a28[_0x3940da(0x1ce)]),console[_0x3940da(0x1db)]('β'[_0x3940da(0x1f2)](0x3c));}if(_0x308846['dryRun'])return console[_0x3940da(0x1db)](a30_0x2ccacf['yellow'](_0x3940da(0x1bf))),0x0;if(_0x41d998['length']===0x0&&_0x5ad164[_0x3940da(0x1de)]===0x0)return console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1df)]('β\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x4e2753[_0x3940da(0x1d4)]},_0x308846[_0x3940da(0x201)]),console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1df)](_0x3940da(0x1e3)+a30_0x2ccacf['dim']('parent_segment')+_0x3940da(0x1c1)+a30_0x2ccacf[_0x3940da(0x1c7)](_0x4e2753['parentName']))),0x0;if(!_0x308846[_0x3940da(0x1eb)]){if(!isInteractive())return console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1e7)]('\x0aError:'),_0x3940da(0x1cd)),console[_0x3940da(0x1db)](a30_0x2ccacf['dim'](_0x3940da(0x1c0))),0x1;const _0x47ae61=await confirmKey(_0x3940da(0x1f8)+(_0x41d998['length']+_0x5ad164[_0x3940da(0x1de)])+_0x3940da(0x1c2));if(!_0x47ae61)return console[_0x3940da(0x1db)](a30_0x2ccacf['yellow'](_0x3940da(0x1b7)),'-\x20no\x20files\x20written'),0x1;}for(const _0x35dfcd of _0x4e2753['files']){if(_0x35dfcd[_0x3940da(0x1ea)]||_0x35dfcd[_0x3940da(0x1f0)]){const _0x52bb44=a30_0x23bf49[_0x3940da(0x202)](_0x35dfcd['absolutePath']);!existsSync(_0x52bb44)&&mkdirSync(_0x52bb44,{'recursive':!![]}),writeFileSync(_0x35dfcd[_0x3940da(0x1f9)],_0x35dfcd['content'],'utf-8');}}return console[_0x3940da(0x1db)](a30_0x2ccacf['green']('β\x20Pulled\x20'+(_0x41d998[_0x3940da(0x1de)]+_0x5ad164[_0x3940da(0x1de)])+_0x3940da(0x1cc)+_0x4e2753[_0x3940da(0x1e6)])),saveSessionContext({'parent_segment':_0x4e2753[_0x3940da(0x1d4)]},_0x308846[_0x3940da(0x201)]),console[_0x3940da(0x1db)](a30_0x2ccacf[_0x3940da(0x1df)](_0x3940da(0x1e3)+a30_0x2ccacf[_0x3940da(0x1da)]('parent_segment')+_0x3940da(0x1c1)+a30_0x2ccacf['cyan'](_0x4e2753[_0x3940da(0x1d4)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x3e7923=a31_0x316c;function a31_0x316c(_0x225de5,_0x7ca5fb){_0x225de5=_0x225de5-0x1ed;const _0x2c5497=a31_0x2c54();let _0x316cbd=_0x2c5497[_0x225de5];return _0x316cbd;}(function(_0x3df46c,_0x166ee2){const _0xc4e248=a31_0x316c,_0x54e556=_0x3df46c();while(!![]){try{const _0x5ce538=parseInt(_0xc4e248(0x23c))/0x1*(-parseInt(_0xc4e248(0x223))/0x2)+parseInt(_0xc4e248(0x273))/0x3+parseInt(_0xc4e248(0x268))/0x4+-parseInt(_0xc4e248(0x229))/0x5+-parseInt(_0xc4e248(0x236))/0x6+-parseInt(_0xc4e248(0x261))/0x7*(-parseInt(_0xc4e248(0x21d))/0x8)+-parseInt(_0xc4e248(0x230))/0x9;if(_0x5ce538===_0x166ee2)break;else _0x54e556['push'](_0x54e556['shift']());}catch(_0x35e64d){_0x54e556['push'](_0x54e556['shift']());}}}(a31_0x2c54,0x8fb59));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_0x790da0 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a31_0x2c54(){const _0x442a35=['isNew','\x20changes?','\x20deleted','updated','journey','.yaml','setPhase','delete','folderId','activations','then','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','segmentFolderId','updatedAt','\x0aError:','segment','filter','site','cwd','errorCode','listSegments','segment:push','Fetching\x20existing\x20folders...','folderPath','Delete\x20journey:','new','helpText','\x0aβ\x20Push\x20complete','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Resolving\x20parent\x20segment\x20\x27','push','\x20to\x20update','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','yamlConfig','/j/da/je','toUpdate','\x20\x20Source:\x20','Error\x20parsing\x20YAML:\x20','cyan','verbose','journeyId','Error:\x20','name','getParent','2146264hwHqQI','existingJourney','add','dim','createdSegmentIds','message','326iUIsAf','red','Fetching\x20existing\x20segments...','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','get','idToName','1207255BHrDOZ','created','nameToType','user','journeys','parent_name','diff','1507941GBRXKT','Changes\x20to:','\x20\x20Journeys:\x20','\x20\x20πΊοΈ\x20\x20Journeys:','segments','state','1121196jzVhbM','\x20YAML\x20files\x20found','toDelete','buildUserMaps','\x20\x20\x20\x20','\x20folders\x20to\x20create','4162sNnXlD','/e/','targetDir','connection','Push\x20','No\x20','\x20to\x20delete','all','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','blue','Changes\x20to\x20journey:','isScoped','\x0aPush\x20summary\x20for\x20\x27','map','yes','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20changed','join','Source\x20directory:\x20','deleted','\x20\x20Activations:\x20','repeat','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Folders\x20to\x20create:','Fetching\x20connections\x20for\x20name\x20resolution...','\x20\x20Segments:\x20','toCreate','.yml','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x27...','endsWith','changed','description','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','nameToId','length','Fetching\x20existing\x20activations...','21roYEDA','\x20unchanged','β\x20All\x20journeys\x20are\x20up\x20to\x20date','Error:\x20Directory\x20not\x20found:\x20','Fetching\x20users\x20for\x20email\x20resolution...','parentSegment','versionNumber','2946104imcUYp','journeysOnly','\x20activations]','\x0aValidation\x20failed:','Preparing\x20journeys...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','toString','Scoped\x20to\x20folder:\x20','parentName','journeyBundleName','/app/ps/','964590jwArwY','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)','attributes','listFolders','results','New\x20journey:','listActivations','type','set','\x20to\x20create','audienceId','Delete\x20segment:','green','scopedFolderPath','Aborted.','\x20created','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','yellow','Fetching\x20parent\x20segment\x20details...','createdAt','\x20new','filePath','journeyBundleId','dryRun','list','data','error','getJourney','execute','New\x20segment:','no_parent'];a31_0x2c54=function(){return _0x442a35;};return a31_0x2c54();}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{[a31_0x3e7923(0x21b)]=a31_0x3e7923(0x206);['description']=a31_0x3e7923(0x252);async[a31_0x3e7923(0x1ee)](_0x4488ea){const _0x49bb6c=a31_0x3e7923,{options:_0x3f5f94,args:_0x47d877,tdx:_0x1bb87a}=_0x4488ea,_0x342908=_0x3f5f94,_0x143246=await resolveTarget({'arg':_0x47d877[0x0],'contextParent':_0x3f5f94[_0x49bb6c(0x266)],'cwd':process[_0x49bb6c(0x203)]()});if(!isSuccessfulResolution(_0x143246))return _0x143246[_0x49bb6c(0x204)]===_0x49bb6c(0x1f0)?(console['error'](a31_0x790da0['yellow'](_0x49bb6c(0x244))),console[_0x49bb6c(0x28d)](_0x49bb6c(0x274)),console[_0x49bb6c(0x28d)](_0x49bb6c(0x26d)),console[_0x49bb6c(0x28d)]('\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['error'](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x21a)+_0x143246[_0x49bb6c(0x222)]+'\x0a')),_0x143246[_0x49bb6c(0x20b)]&&console['error'](a31_0x790da0[_0x49bb6c(0x217)](_0x143246[_0x49bb6c(0x20b)]))),0x1;if(_0x143246[_0x49bb6c(0x27a)]===_0x49bb6c(0x22e))return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x264)+_0x143246[_0x49bb6c(0x23e)]+'\x0a')),console['error'](a31_0x790da0[_0x49bb6c(0x217)](_0x49bb6c(0x20d))),0x1;const _0x1245c9=_0x143246[_0x49bb6c(0x270)],_0x3805f2=_0x143246['targetDir'],_0x320faa=_0x143246[_0x49bb6c(0x27a)]==='file'?_0x143246[_0x49bb6c(0x288)]:undefined,_0x17b599=getScopedDetails(_0x143246),_0x1f2507=_0x17b599?.[_0x49bb6c(0x247)]??![],_0x5cecaa=_0x17b599?.[_0x49bb6c(0x280)]??'';if(!existsSync(_0x3805f2))return console['error'](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x264)+_0x3805f2+'\x0a')),console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x217)](_0x49bb6c(0x20d))),0x1;_0x342908[_0x49bb6c(0x218)]&&(console[_0x49bb6c(0x28d)]('Site:\x20'+_0x342908[_0x49bb6c(0x202)]),console[_0x49bb6c(0x28d)]('Parent\x20segment:\x20'+_0x1245c9),console[_0x49bb6c(0x28d)](_0x49bb6c(0x24e)+_0x3805f2),_0x1f2507&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x26f)+_0x5cecaa));const _0x306f23=await withSpinner(_0x49bb6c(0x20e)+_0x1245c9+_0x49bb6c(0x259),()=>_0x1bb87a[_0x49bb6c(0x200)]['resolveParentId'](_0x1245c9),{'verbose':_0x342908[_0x49bb6c(0x218)]}),_0x189b3e=_0x306f23[_0x49bb6c(0x28c)],[_0x4f14de,_0x4c524d,_0x445900,_0x444c63,_0x125f63]=await Promise[_0x49bb6c(0x243)]([withSpinner(_0x49bb6c(0x285),()=>_0x1bb87a[_0x49bb6c(0x200)][_0x49bb6c(0x21c)](_0x189b3e),{'verbose':_0x342908[_0x49bb6c(0x218)]}),withSpinner(_0x49bb6c(0x225),()=>_0x1bb87a[_0x49bb6c(0x200)][_0x49bb6c(0x205)](_0x189b3e),{'verbose':_0x342908[_0x49bb6c(0x218)]}),withSpinner(_0x49bb6c(0x207),()=>_0x1bb87a['segment'][_0x49bb6c(0x276)](_0x189b3e),{'verbose':_0x342908[_0x49bb6c(0x218)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x1bb87a['journey']['listJourneysWithDetailsFromParentSegment'](_0x189b3e,{'includeAllVersions':!![]}),{'verbose':_0x342908[_0x49bb6c(0x218)]}),withSpinner(_0x49bb6c(0x265),()=>_0x1bb87a[_0x49bb6c(0x22c)][_0x49bb6c(0x239)](),{'verbose':_0x342908[_0x49bb6c(0x218)]})['then'](_0x21a4b6=>_0x21a4b6[_0x49bb6c(0x28c)])]),_0x1e2ea9=_0x4f14de[_0x49bb6c(0x28c)],_0x53c20d=extractRootFolderId(_0x1e2ea9),_0x44a7da=_0x4c524d[_0x49bb6c(0x28c)],_0x29b5c9=_0x445900[_0x49bb6c(0x28c)],{journeys:_0x2bc923,activationStepsById:_0x4483dd}=_0x444c63[_0x49bb6c(0x28c)],_0x5e0623=new Map(_0x2bc923[_0x49bb6c(0x249)](_0x550bcb=>[_0x550bcb['id'],_0x550bcb])),_0x5e4807=_0x2bc923['map'](_0x3a4d91=>({'id':_0x3a4d91['id'],'name':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x21b)],'journeyBundleName':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x271)]||'','journeyBundleId':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x289)]||'','versionNumber':_0x3a4d91['attributes'][_0x49bb6c(0x267)],'description':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x25c)],'state':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x235)],'paused':_0x3a4d91['attributes']['paused'],'audienceId':_0x3a4d91['attributes'][_0x49bb6c(0x27d)],'folderId':_0x3a4d91['relationships']?.['parentFolder']?.[_0x49bb6c(0x28c)]?.['id'],'createdAt':_0x3a4d91['attributes'][_0x49bb6c(0x286)],'updatedAt':_0x3a4d91[_0x49bb6c(0x275)][_0x49bb6c(0x1fe)]})),{emailToId:_0x3fb433,idToEmail:_0xaccaab}=_0x125f63,_0x13195e=await withSpinner(_0x49bb6c(0x254),async()=>{const _0x8c8454=_0x49bb6c,_0x4c3f31=await _0x1bb87a[_0x8c8454(0x23f)][_0x8c8454(0x28b)]();return buildConnectionMaps(_0x4c3f31);},{'verbose':_0x342908[_0x49bb6c(0x218)]})[_0x49bb6c(0x1fb)](_0x1c80b1=>_0x1c80b1[_0x49bb6c(0x28c)]),_0x5aa211=_0x13195e[_0x49bb6c(0x25e)],_0x34bc3e=_0x13195e[_0x49bb6c(0x228)],_0x299999=_0x13195e[_0x49bb6c(0x22b)],_0x1cadb1={'emailToIdMap':_0x3fb433,'connectionNameToIdMap':_0x5aa211,'connectionNameToTypeMap':_0x299999,'getSchema':_0x5a5bc1=>_0x1bb87a[_0x49bb6c(0x23f)]['getOutputSchemaWithCache'](_0x5a5bc1)};let {pathToId:_0x1ca34b,idToPath:_0x4481e6}=buildFolderMaps(_0x29b5c9);const _0x3d2eda=buildSegmentLookupMap(_0x44a7da,_0x4481e6),_0x11d641=buildSegmentNameToIdMap(_0x44a7da),_0x222133=buildJourneyBundleLookupMap(_0x5e4807,_0x4481e6);let _0x66f4fd;if(_0x320faa){if(!_0x320faa['endsWith'](_0x49bb6c(0x257))&&!_0x320faa[_0x49bb6c(0x25a)](_0x49bb6c(0x1f6)))return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x283)+_0x320faa+'\x0a')),0x1;_0x66f4fd=[_0x320faa];}else _0x66f4fd=findYamlFiles(_0x3805f2);if(_0x66f4fd[_0x49bb6c(0x25f)]===0x0)return console['error'](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x25d)+_0x3805f2+'\x0a')),console['error'](a31_0x790da0[_0x49bb6c(0x217)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x4be9e4,_0x1c52b4;try{const _0x2caee1=parseAndClassifyYamlFiles(_0x66f4fd,_0x3805f2,{'skipSegments':_0x342908[_0x49bb6c(0x269)]});_0x4be9e4=_0x2caee1[_0x49bb6c(0x234)],_0x1c52b4=_0x2caee1['journeys'];const _0x37a297=validateParsedFiles(_0x2caee1,_0x3805f2);if(_0x37a297[_0x49bb6c(0x25f)]>0x0)return console['error'](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x26b))),console[_0x49bb6c(0x28d)](formatValidationErrors(_0x37a297)),console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x284)](_0x49bb6c(0x1fc))),0x1;}catch(_0x39f4d2){return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x216)+(_0x39f4d2 instanceof Error?_0x39f4d2[_0x49bb6c(0x222)]:_0x39f4d2))),0x1;}if(_0x4be9e4[_0x49bb6c(0x25f)]===0x0&&_0x1c52b4[_0x49bb6c(0x25f)]===0x0){const _0x41262a=_0x342908[_0x49bb6c(0x269)]?_0x49bb6c(0x1f5):'segment\x20or\x20journey';return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x284)](_0x49bb6c(0x241)+_0x41262a+_0x49bb6c(0x237))),0x0;}const _0x33fe7b=new Map();_0x44a7da['length']>0x0&&!_0x342908[_0x49bb6c(0x269)]&&await withSpinner(_0x49bb6c(0x260),async()=>{await batchAsync(_0x44a7da,async _0x191714=>{const _0x282d0b=a31_0x316c,_0x301b64=await _0x1bb87a[_0x282d0b(0x200)][_0x282d0b(0x279)](_0x189b3e,_0x191714['id']);_0x33fe7b[_0x282d0b(0x27b)](_0x191714['id'],_0x301b64);});},{'verbose':_0x342908['verbose']});const {segmentFiles:_0x50401a,foldersToCreate:_0x1ce0d1}=await prepareSegmentFiles(_0x4be9e4,{'segmentByFolderAndName':_0x3d2eda,'activationsBySegmentId':_0x33fe7b,'folderPathToId':_0x1ca34b,'idToEmailMap':_0xaccaab,'connectionIdToNameMap':_0x34bc3e},_0x1cadb1,_0x1f2507,_0x5cecaa),_0x19fcad=_0x320faa?[]:findSegmentsToDelete(_0x44a7da,_0x4be9e4[_0x49bb6c(0x249)](({yamlConfig:_0x31be6c,folderPath:_0xe27859})=>({'yamlConfig':_0x31be6c,'folderPath':resolveTDFolderPath(_0xe27859,_0x1f2507,_0x5cecaa)})),_0x4481e6,_0x5cecaa,_0x1f2507),{journeyFiles:_0x2a7fa4,foldersToCreate:_0x26a619}=await withProgressSpinner(_0x49bb6c(0x26c),async _0x52c6ac=>prepareJourneyFiles(_0x1c52b4,{'fetchJourney':async _0x5a83f1=>_0x1bb87a['journey'][_0x49bb6c(0x1ed)](_0x5a83f1[_0x49bb6c(0x219)]),'journeyBundlesByFolderAndName':_0x222133,'folderPathToId':_0x1ca34b,'idToEmailMap':_0xaccaab,'connectionIdToNameMap':_0x34bc3e,'existingSegments':_0x44a7da,'parentId':_0x189b3e,'deps':_0x1bb87a,'progress':{'update':_0x511c39=>{const _0x5e3a61=_0x49bb6c;_0x52c6ac[_0x5e3a61(0x1f7)](_0x511c39),_0x342908[_0x5e3a61(0x218)]&&console[_0x5e3a61(0x28d)]('\x20\x20'+_0x511c39);}},'journeyById':_0x5e0623,'activationStepsById':_0x4483dd},_0x1f2507,_0x5cecaa),{'verbose':_0x342908['verbose']})[_0x49bb6c(0x1fb)](_0x4aa476=>_0x4aa476[_0x49bb6c(0x28c)]);for(const _0x55daa1 of _0x26a619){_0x1ce0d1[_0x49bb6c(0x21f)](_0x55daa1);}const _0x55c4f3=_0x320faa?[]:findJourneysToDelete(_0x5e4807,_0x1c52b4['map'](({yamlConfig:_0x1207b2,folderPath:_0x138dc9})=>({'yamlConfig':_0x1207b2,'folderPath':resolveTDFolderPath(_0x138dc9,_0x1f2507,_0x5cecaa)})),_0x4481e6,_0x5cecaa,_0x1f2507),_0x3899fb=calculatePushStats(_0x50401a,_0x2a7fa4,_0x1ce0d1,_0x19fcad,_0x55c4f3,!!_0x342908[_0x49bb6c(0x1f8)],!!_0x342908[_0x49bb6c(0x269)]),_0x4357fc=_0x3899fb['segments'][_0x49bb6c(0x20a)],_0x5ac274=_0x3899fb[_0x49bb6c(0x234)][_0x49bb6c(0x25b)],_0x21f273=_0x3899fb[_0x49bb6c(0x234)]['unchanged'],_0x3d79de=_0x3899fb[_0x49bb6c(0x234)][_0x49bb6c(0x238)],_0x1793cb=_0x3899fb['folders'][_0x49bb6c(0x256)],_0x1670b0=_0x3899fb[_0x49bb6c(0x22d)][_0x49bb6c(0x20a)],_0x4fa355=_0x3899fb[_0x49bb6c(0x22d)][_0x49bb6c(0x25b)],_0xfafad4=_0x3899fb['journeys']['unchanged'],_0x301ca5=_0x3899fb['journeys'][_0x49bb6c(0x238)],_0xd8e364=_0x3899fb[_0x49bb6c(0x1fa)]['all'],_0x35a3a9=_0x3899fb[_0x49bb6c(0x1fa)][_0x49bb6c(0x256)],_0x473e9d=_0x3899fb[_0x49bb6c(0x1fa)][_0x49bb6c(0x214)],_0x3f3490=_0x3899fb[_0x49bb6c(0x1fa)][_0x49bb6c(0x238)];console['error'](_0x49bb6c(0x248)+_0x1245c9+'\x27:');_0x1793cb['length']>0x0&&console['error']('\x20\x20'+a31_0x790da0[_0x49bb6c(0x245)]('π\x20'+_0x1793cb[_0x49bb6c(0x25f)]+_0x49bb6c(0x23b)));if(!_0x342908['journeysOnly']){console[_0x49bb6c(0x28d)]('\x20\x20π\x20Segments:'),console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x27f)]('+\x20'+_0x4357fc[_0x49bb6c(0x25f)]+_0x49bb6c(0x287))),console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x284)]('~\x20'+_0x5ac274[_0x49bb6c(0x25f)]+_0x49bb6c(0x24c)));if(_0x3d79de[_0x49bb6c(0x25f)]>0x0)console[_0x49bb6c(0x28d)]('\x20\x20\x20\x20'+a31_0x790da0['red']('-\x20'+_0x3d79de[_0x49bb6c(0x25f)]+_0x49bb6c(0x242)));else _0x19fcad[_0x49bb6c(0x25f)]>0x0&&!_0x342908[_0x49bb6c(0x1f8)]&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x220)](_0x19fcad[_0x49bb6c(0x25f)]+_0x49bb6c(0x211)));console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x220)]('=\x20'+_0x21f273[_0x49bb6c(0x25f)]+_0x49bb6c(0x262)));}if(_0x2a7fa4[_0x49bb6c(0x25f)]>0x0||_0x55c4f3['length']>0x0){console[_0x49bb6c(0x28d)](_0x49bb6c(0x233)),console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x27f)]('+\x20'+_0x1670b0[_0x49bb6c(0x25f)]+_0x49bb6c(0x287))),console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0['yellow']('~\x20'+_0x4fa355[_0x49bb6c(0x25f)]+_0x49bb6c(0x24c)));if(_0x301ca5[_0x49bb6c(0x25f)]>0x0)console[_0x49bb6c(0x28d)]('\x20\x20\x20\x20'+a31_0x790da0[_0x49bb6c(0x224)]('-\x20'+_0x301ca5[_0x49bb6c(0x25f)]+_0x49bb6c(0x242)));else _0x55c4f3[_0x49bb6c(0x25f)]>0x0&&!_0x342908[_0x49bb6c(0x1f8)]&&console['error']('\x20\x20\x20\x20'+a31_0x790da0[_0x49bb6c(0x220)](_0x55c4f3['length']+_0x49bb6c(0x211)));console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0['dim']('=\x20'+_0xfafad4[_0x49bb6c(0x25f)]+_0x49bb6c(0x262)));}_0xd8e364[_0x49bb6c(0x25f)]>0x0&&!_0x342908[_0x49bb6c(0x269)]&&(console['error'](''),console[_0x49bb6c(0x28d)]('\x20\x20Activations:'),_0x35a3a9[_0x49bb6c(0x25f)]>0x0&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0['green']('+\x20'+_0x35a3a9['length']+_0x49bb6c(0x27c))),_0x473e9d['length']>0x0&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x284)]('~\x20'+_0x473e9d[_0x49bb6c(0x25f)]+_0x49bb6c(0x210))),_0x3f3490['length']>0x0&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x23a)+a31_0x790da0[_0x49bb6c(0x224)]('-\x20'+_0x3f3490['length']+_0x49bb6c(0x242))));console[_0x49bb6c(0x28d)](_0x49bb6c(0x215)+a31_0x790da0[_0x49bb6c(0x217)](_0x3805f2)+'\x0a');if(_0x1793cb[_0x49bb6c(0x25f)]>0x0){console[_0x49bb6c(0x28d)](_0x49bb6c(0x253));for(const _0xb0c78f of _0x1793cb){console[_0x49bb6c(0x28d)]('\x20\x20'+a31_0x790da0[_0x49bb6c(0x245)]('+')+'\x20'+_0xb0c78f);}console[_0x49bb6c(0x28d)]('');}if(_0x4357fc[_0x49bb6c(0x25f)]>0x0&&!_0x342908['journeysOnly'])for(const _0x5b484 of _0x4357fc){const _0x2fb8c=_0x5b484[_0x49bb6c(0x208)]?_0x5b484['folderPath']+'/'+_0x5b484[_0x49bb6c(0x212)]['name']:_0x5b484[_0x49bb6c(0x212)][_0x49bb6c(0x21b)],_0x26a54c=_0x5b484[_0x49bb6c(0x212)][_0x49bb6c(0x1fa)]?.[_0x49bb6c(0x25f)]||0x0,_0x4cddd5=_0x26a54c>0x0?a31_0x790da0[_0x49bb6c(0x220)]('\x20['+_0x26a54c+'\x20activations]'):'';console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0[_0x49bb6c(0x27f)](_0x49bb6c(0x1ef))+'\x20'+_0x2fb8c+_0x4cddd5),console['error']('β'[_0x49bb6c(0x251)](0x3c)),_0x5b484[_0x49bb6c(0x22f)]&&console[_0x49bb6c(0x28d)](_0x5b484[_0x49bb6c(0x22f)]),console[_0x49bb6c(0x28d)]('β'['repeat'](0x3c));}if(_0x3d79de[_0x49bb6c(0x25f)]>0x0&&!_0x342908['journeysOnly'])for(const _0x2ecf04 of _0x3d79de){const _0x57524f=_0x2ecf04[_0x49bb6c(0x1fd)]?_0x4481e6['get'](_0x2ecf04[_0x49bb6c(0x1fd)][_0x49bb6c(0x26e)]())||'':'',_0x50c240=_0x57524f?_0x57524f+'/'+_0x2ecf04[_0x49bb6c(0x21b)]:_0x2ecf04[_0x49bb6c(0x21b)],_0x52e976=_0x33fe7b[_0x49bb6c(0x227)](_0x2ecf04['id'])||[],_0x39541f=_0x52e976['length']>0x0?a31_0x790da0[_0x49bb6c(0x220)]('\x20['+_0x52e976[_0x49bb6c(0x25f)]+_0x49bb6c(0x26a)):'';console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0['red'](_0x49bb6c(0x27e))+'\x20'+_0x50c240+_0x39541f),console['error']('β'[_0x49bb6c(0x251)](0x3c));const _0x3ede48=segmentWithActivationsToYaml(_0x2ecf04,_0x52e976,undefined,_0xaccaab,_0x34bc3e),_0x3197aa=segmentToYamlString(_0x3ede48),_0x5a747c=generateDiff(_0x3197aa,'');console[_0x49bb6c(0x28d)](formatDiffWithColors(_0x5a747c)),console[_0x49bb6c(0x28d)]('β'[_0x49bb6c(0x251)](0x3c));}const _0x345968=_0x50401a['filter'](_0xc82496=>!_0xc82496[_0x49bb6c(0x1f1)]&&_0xc82496[_0x49bb6c(0x22f)]);if(_0x345968[_0x49bb6c(0x25f)]>0x0&&!_0x342908[_0x49bb6c(0x269)])for(const _0x4e85d2 of _0x345968){const _0x4c69e5=_0x4e85d2['folderPath']?_0x4e85d2[_0x49bb6c(0x208)]+'/'+_0x4e85d2[_0x49bb6c(0x212)][_0x49bb6c(0x21b)]:_0x4e85d2[_0x49bb6c(0x212)]['name'];console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0[_0x49bb6c(0x284)](_0x49bb6c(0x231))+'\x20'+_0x4c69e5),console[_0x49bb6c(0x28d)]('β'[_0x49bb6c(0x251)](0x3c)),console[_0x49bb6c(0x28d)](_0x4e85d2[_0x49bb6c(0x22f)]),console[_0x49bb6c(0x28d)]('β'[_0x49bb6c(0x251)](0x3c));}if(_0x1670b0[_0x49bb6c(0x25f)]>0x0)for(const _0x1ccf74 of _0x1670b0){const _0x4fb3fb=_0x1ccf74[_0x49bb6c(0x208)]?_0x1ccf74[_0x49bb6c(0x208)]+'/'+_0x1ccf74['yamlConfig']['name']:_0x1ccf74['yamlConfig']['name'];console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0[_0x49bb6c(0x27f)](_0x49bb6c(0x278))+'\x20'+_0x4fb3fb),console[_0x49bb6c(0x28d)]('β'['repeat'](0x3c)),_0x1ccf74[_0x49bb6c(0x22f)]&&console[_0x49bb6c(0x28d)](_0x1ccf74[_0x49bb6c(0x22f)]),console[_0x49bb6c(0x28d)]('β'[_0x49bb6c(0x251)](0x3c));}const _0x5a906e=_0x2a7fa4[_0x49bb6c(0x201)](_0x241689=>!_0x241689[_0x49bb6c(0x1f1)]&&_0x241689[_0x49bb6c(0x22f)]);if(_0x5a906e[_0x49bb6c(0x25f)]>0x0)for(const _0x8298e1 of _0x5a906e){const _0x482a74=_0x8298e1[_0x49bb6c(0x208)]?_0x8298e1[_0x49bb6c(0x208)]+'/'+_0x8298e1[_0x49bb6c(0x212)][_0x49bb6c(0x21b)]:_0x8298e1[_0x49bb6c(0x212)][_0x49bb6c(0x21b)];console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0[_0x49bb6c(0x284)](_0x49bb6c(0x246))+'\x20'+_0x482a74),console[_0x49bb6c(0x28d)]('β'['repeat'](0x3c)),console['error'](_0x8298e1['diff']),console['error']('β'[_0x49bb6c(0x251)](0x3c));}if(_0x301ca5[_0x49bb6c(0x25f)]>0x0)for(const _0x517ce1 of _0x301ca5){const _0x1ee617=_0x517ce1[_0x49bb6c(0x1f9)]?_0x4481e6['get'](_0x517ce1['folderId'])||'':'',_0x19e4c4=_0x1ee617?_0x1ee617+'/'+_0x517ce1[_0x49bb6c(0x271)]:_0x517ce1[_0x49bb6c(0x271)];console[_0x49bb6c(0x28d)]('\x0a'+a31_0x790da0['red'](_0x49bb6c(0x209))+'\x20'+_0x19e4c4),console[_0x49bb6c(0x28d)]('β'[_0x49bb6c(0x251)](0x3c)),console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x224)]('(Journey\x20will\x20be\x20deleted)')),console[_0x49bb6c(0x28d)]('β'['repeat'](0x3c));}if(_0x342908[_0x49bb6c(0x28a)])return console[_0x49bb6c(0x28d)](a31_0x790da0['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x248205=_0x342908[_0x49bb6c(0x269)]?![]:_0x4357fc[_0x49bb6c(0x25f)]>0x0||_0x5ac274[_0x49bb6c(0x25f)]>0x0||_0x3d79de[_0x49bb6c(0x25f)]>0x0,_0x50f758=_0x1670b0[_0x49bb6c(0x25f)]>0x0||_0x4fa355['length']>0x0||_0x301ca5[_0x49bb6c(0x25f)]>0x0,_0x4d782f=_0x342908[_0x49bb6c(0x269)]?![]:_0xd8e364[_0x49bb6c(0x25f)]>0x0,_0x20c20f=_0x1793cb[_0x49bb6c(0x25f)]>0x0;if(!_0x248205&&!_0x50f758&&!_0x4d782f&&!_0x20c20f){const _0x1e74fd=_0x342908[_0x49bb6c(0x269)]?_0x49bb6c(0x263):_0x49bb6c(0x24b);console['error'](a31_0x790da0['green'](_0x1e74fd));if(_0x320faa&&_0xfafad4[_0x49bb6c(0x25f)]===0x1){const _0x26f9cf=_0xfafad4[0x0];if(_0x26f9cf[_0x49bb6c(0x21e)]?.['id']){const _0x259db3=getConsoleNextUrl(_0x342908[_0x49bb6c(0x202)],_0x49bb6c(0x272)+_0x189b3e+'/e/'+_0x26f9cf[_0x49bb6c(0x21e)]['id']+_0x49bb6c(0x213));console[_0x49bb6c(0x28d)]('\x20\x20'+a31_0x790da0[_0x49bb6c(0x217)](_0x259db3));}}return 0x0;}const _0x5b7cb1=_0x342908['journeysOnly']?_0x1670b0[_0x49bb6c(0x25f)]+_0x4fa355[_0x49bb6c(0x25f)]+_0x301ca5[_0x49bb6c(0x25f)]+_0x1793cb[_0x49bb6c(0x25f)]:_0x4357fc['length']+_0x5ac274[_0x49bb6c(0x25f)]+_0x3d79de['length']+_0x1670b0[_0x49bb6c(0x25f)]+_0x4fa355[_0x49bb6c(0x25f)]+_0x301ca5[_0x49bb6c(0x25f)]+_0x1793cb[_0x49bb6c(0x25f)]+_0xd8e364[_0x49bb6c(0x25f)];if(!_0x342908[_0x49bb6c(0x24a)]&&_0x5b7cb1>0x0){if(!isInteractive())return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x224)](_0x49bb6c(0x1ff)),_0x49bb6c(0x258)),console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x220)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x57c7fe=await confirmKey(_0x49bb6c(0x240)+_0x5b7cb1+_0x49bb6c(0x1f2));if(!_0x57c7fe)return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x284)](_0x49bb6c(0x281))),0x1;}const _0x1c7261={'withProgress':async(_0x25b332,_0x170c56)=>{const _0x2100e2=_0x49bb6c,_0x4a27de=await withSpinner(_0x25b332,_0x170c56,{'verbose':_0x342908[_0x2100e2(0x218)]});return{'data':_0x4a27de[_0x2100e2(0x28c)]};},'logInfo':_0x1f1b04=>console[_0x49bb6c(0x28d)](a31_0x790da0['blue']('β\x20'+_0x1f1b04)),'logSuccess':_0x40349f=>console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x27f)]('β\x20'+_0x40349f)),'logWarning':_0x551eee=>console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x284)]('β \x20'+_0x551eee)),'logDeleted':_0x1a6c4e=>console['error'](a31_0x790da0[_0x49bb6c(0x224)]('β\x20'+_0x1a6c4e))},_0x557f3b={'segment':_0x1bb87a[_0x49bb6c(0x200)],'journey':_0x1bb87a['journey'],'user':_0x1bb87a[_0x49bb6c(0x22c)],'connection':_0x1bb87a[_0x49bb6c(0x23f)]};_0x1793cb[_0x49bb6c(0x25f)]>0x0&&(_0x1ca34b=await executePushFolders(_0x557f3b,_0x1793cb,_0x1ca34b,{'parentId':_0x189b3e},_0x1c7261));const _0x58f039={'rootFolderId':_0x53c20d,'folderPathToId':_0x1ca34b,'folderIdToPath':_0x4481e6,'segmentNameToId':_0x11d641,'activationsBySegmentId':_0x33fe7b,'emailToIdMap':_0x3fb433,'idToEmailMap':_0xaccaab,'connectionNameToIdMap':_0x13195e[_0x49bb6c(0x25e)],'connectionIdToNameMap':_0x13195e[_0x49bb6c(0x228)],'connectionNameToTypeMap':_0x299999},_0x3a7c30=await executePushSegments(_0x557f3b,_0x342908[_0x49bb6c(0x269)]?[]:_0x50401a,_0x58f039,{'parentId':_0x189b3e},_0x1c7261),_0xbac0ce=_0x3a7c30[_0x49bb6c(0x22a)],_0x3621ff=_0x3a7c30['updated'],_0xa6c1af=_0x3a7c30['activations'][_0x49bb6c(0x22a)],_0x4fd3a4=_0x3a7c30[_0x49bb6c(0x1fa)][_0x49bb6c(0x1f4)],_0x805abf=_0x3a7c30['activations'][_0x49bb6c(0x24f)],_0x54a19b=await executePushSegmentDeletions(_0x557f3b,_0x342908[_0x49bb6c(0x269)]?[]:_0x3d79de,_0x1c7261);let _0x28f725=0x0,_0x59998a=0x0,_0xf5ab85=0x0;const _0x24a538=new Map(_0x11d641);for(const [_0x36f00d,_0x34c017]of _0x3a7c30[_0x49bb6c(0x221)]){_0x24a538[_0x49bb6c(0x27b)](_0x36f00d,_0x34c017);}if(_0x2a7fa4['length']>0x0){const _0x41981e={..._0x58f039,'segmentNameToId':_0x24a538,'existingSegments':_0x44a7da,'activationContext':_0x1cadb1},_0x21885f=await executePushJourneys(_0x557f3b,_0x2a7fa4,_0x41981e,{'parentId':_0x189b3e,'rootFolderId':_0x53c20d,'verbose':_0x342908['verbose']},_0x1c7261);_0x28f725=_0x21885f[_0x49bb6c(0x22a)],_0x59998a=_0x21885f[_0x49bb6c(0x1f4)];if(_0x320faa&&_0x21885f['results'][_0x49bb6c(0x25f)]===0x1){const _0x943c22=_0x21885f[_0x49bb6c(0x277)][0x0];if(_0x943c22[_0x49bb6c(0x219)]){const _0x109fe6=getConsoleNextUrl(_0x342908[_0x49bb6c(0x202)],_0x49bb6c(0x272)+_0x189b3e+_0x49bb6c(0x23d)+_0x943c22['journeyId']+_0x49bb6c(0x213));console[_0x49bb6c(0x28d)]('\x20\x20'+a31_0x790da0[_0x49bb6c(0x217)](_0x109fe6));}}}for(const _0x1906ca of _0x301ca5){console['error'](a31_0x790da0['yellow'](_0x49bb6c(0x226)+_0x1906ca[_0x49bb6c(0x271)])),_0xf5ab85++;}const _0x5a79aa=[];if(_0xbac0ce>0x0)_0x5a79aa['push'](_0xbac0ce+'\x20created');if(_0x3621ff>0x0)_0x5a79aa['push'](_0x3621ff+'\x20updated');if(_0x54a19b>0x0)_0x5a79aa[_0x49bb6c(0x20f)](_0x54a19b+_0x49bb6c(0x1f3));const _0x189e04=[];if(_0x28f725>0x0)_0x189e04[_0x49bb6c(0x20f)](_0x28f725+_0x49bb6c(0x282));if(_0x59998a>0x0)_0x189e04[_0x49bb6c(0x20f)](_0x59998a+'\x20updated');if(_0xf5ab85>0x0)_0x189e04[_0x49bb6c(0x20f)](_0xf5ab85+'\x20deleted');const _0x3670e8=[];if(_0xa6c1af>0x0)_0x3670e8['push'](_0xa6c1af+_0x49bb6c(0x282));if(_0x4fd3a4>0x0)_0x3670e8['push'](_0x4fd3a4+'\x20updated');if(_0x805abf>0x0)_0x3670e8[_0x49bb6c(0x20f)](_0x805abf+_0x49bb6c(0x1f3));return console[_0x49bb6c(0x28d)](a31_0x790da0[_0x49bb6c(0x27f)](_0x49bb6c(0x20c))),_0x5a79aa[_0x49bb6c(0x25f)]>0x0&&!_0x342908[_0x49bb6c(0x269)]&&console['error'](_0x49bb6c(0x255)+_0x5a79aa[_0x49bb6c(0x24d)](',\x20')),_0x189e04['length']>0x0&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x232)+_0x189e04[_0x49bb6c(0x24d)](',\x20')),_0x3670e8['length']>0x0&&!_0x342908[_0x49bb6c(0x269)]&&console[_0x49bb6c(0x28d)](_0x49bb6c(0x250)+_0x3670e8['join'](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x5daf9d=a31_0x4144;(function(_0x5eeecb,_0xdfe5d4){const _0x58fec4=a31_0x4144,_0x15fb03=_0x5eeecb();while(!![]){try{const _0x2f8699=parseInt(_0x58fec4(0x1eb))/0x1+-parseInt(_0x58fec4(0x1dd))/0x2*(-parseInt(_0x58fec4(0x1fc))/0x3)+parseInt(_0x58fec4(0x1c5))/0x4*(parseInt(_0x58fec4(0x211))/0x5)+parseInt(_0x58fec4(0x1ff))/0x6*(-parseInt(_0x58fec4(0x23b))/0x7)+parseInt(_0x58fec4(0x1ba))/0x8*(-parseInt(_0x58fec4(0x200))/0x9)+parseInt(_0x58fec4(0x212))/0xa*(-parseInt(_0x58fec4(0x20c))/0xb)+parseInt(_0x58fec4(0x24b))/0xc*(parseInt(_0x58fec4(0x1f8))/0xd);if(_0x2f8699===_0xdfe5d4)break;else _0x15fb03['push'](_0x15fb03['shift']());}catch(_0x2d475a){_0x15fb03['push'](_0x15fb03['shift']());}}}(a31_0x409c,0x7b22d));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a31_0x409c(){const _0x464ad3=['Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','parentFolder','\x20updated','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','isNew','error','updatedAt','errorCode','no_parent','journeyId','journeysOnly','repeat','Fetching\x20users\x20for\x20email\x20resolution...','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','message','1730076dUZfob','Fetching\x20existing\x20journeys...','π\x20','setPhase','length','helpText','Changes\x20to:','.yaml','toCreate','listSegments','\x0aError:','yamlConfig','add','createdSegmentIds','93145QlUjnB','set','Fetching\x20connections\x20for\x20name\x20resolution...','Delete\x20journey:','Error:\x20Directory\x20not\x20found:\x20','updated','all','diff','getOutputSchemaWithCache','createdAt','yellow','segment:push','versionNumber','13ZqIzXP','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','getJourney','red','3aVRXqE','parentSegment','listFolders','700446SXcYrK','39042RHsOxV','journeyBundleName','deleted','β\x20All\x20journeys\x20are\x20up\x20to\x20date','segments','\x20\x20π\x20Segments:','dim','verbose','toDelete','\x20\x20πΊοΈ\x20\x20Journeys:','nameToId','journeys','25267AneuFw','journey','targetDir','audienceId','attributes','5dLAYZW','3610ZSrcVI','segment','Fetching\x20existing\x20segments...','\x20activations]','\x0aβ\x20Push\x20complete','/j/da/je','\x20changed','listJourneysWithDetailsFromParentSegment','connection','state','buildUserMaps','name','\x20unchanged','Changes\x20to\x20journey:','file','idToName','\x20folders\x20to\x20create','\x20\x20Journeys:\x20','cyan','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)','user','Folders\x20to\x20create:','join','/app/ps/','dryRun','relationships','site','blue','paused','then','\x20to\x20update','data','segmentFolderId','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','endsWith','Parent\x20segment:\x20','\x20new','\x20to\x20delete','\x20to\x20create','\x0aPush\x20summary\x20for\x20\x27','results','56BVbIzy','Preparing\x20journeys...','Push\x20','\x20YAML\x20files\x20found','map','folderId','filter','/e/','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20','scopedFolderPath','\x20created','Scoped\x20to\x20folder:\x20','getParent','green','14665932EtLMbY','push','yes','\x27...','1064zkWzTA','activations','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','existingJourney','listActivations','nameToType','parentName','toUpdate','folderPath','Fetching\x20parent\x20segment\x20details...','2656480dWRrVO','parent_name','Error\x20parsing\x20YAML:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','created','toString','\x20deleted'];a31_0x409c=function(){return _0x464ad3;};return a31_0x409c();}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';function a31_0x4144(_0x346c5c,_0x184273){_0x346c5c=_0x346c5c-0x1b7;const _0x409cd6=a31_0x409c();let _0x41442b=_0x409cd6[_0x346c5c];return _0x41442b;}import a31_0x155a91 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{[a31_0x5daf9d(0x21d)]=a31_0x5daf9d(0x1f6);[a31_0x5daf9d(0x1c9)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async['execute'](_0x1ee0b6){const _0x2f190e=a31_0x5daf9d,{options:_0x9d9ee8,args:_0x4d8429,tdx:_0x169397}=_0x1ee0b6,_0x23fbbf=_0x9d9ee8,_0x13a3c3=await resolveTarget({'arg':_0x4d8429[0x0],'contextParent':_0x9d9ee8[_0x2f190e(0x1fd)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x13a3c3))return _0x13a3c3[_0x2f190e(0x1d5)]===_0x2f190e(0x1d6)?(console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1f5)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2f190e(0x1d3)](_0x2f190e(0x225)),console[_0x2f190e(0x1d3)](_0x2f190e(0x1ca)),console[_0x2f190e(0x1d3)](_0x2f190e(0x1bc))):(console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)]('Error:\x20'+_0x13a3c3[_0x2f190e(0x1dc)]+'\x0a')),_0x13a3c3[_0x2f190e(0x1e2)]&&console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x224)](_0x13a3c3[_0x2f190e(0x1e2)]))),0x1;if(_0x13a3c3['type']===_0x2f190e(0x1c6))return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)](_0x2f190e(0x1ef)+_0x13a3c3['targetDir']+'\x0a')),console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x224)](_0x2f190e(0x1f9))),0x1;const _0x27cd14=_0x13a3c3[_0x2f190e(0x1c1)],_0x142bd9=_0x13a3c3[_0x2f190e(0x20e)],_0x1f5a09=_0x13a3c3['type']===_0x2f190e(0x220)?_0x13a3c3['filePath']:undefined,_0x3a0ae1=getScopedDetails(_0x13a3c3),_0x48950b=_0x3a0ae1?.['isScoped']??![],_0x5dcdfb=_0x3a0ae1?.[_0x2f190e(0x246)]??'';if(!existsSync(_0x142bd9))return console[_0x2f190e(0x1d3)](a31_0x155a91['red'](_0x2f190e(0x1ef)+_0x142bd9+'\x0a')),console['error'](a31_0x155a91[_0x2f190e(0x224)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x23fbbf[_0x2f190e(0x207)]&&(console[_0x2f190e(0x1d3)]('Site:\x20'+_0x23fbbf[_0x2f190e(0x22c)]),console[_0x2f190e(0x1d3)](_0x2f190e(0x235)+_0x27cd14),console['error']('Source\x20directory:\x20'+_0x142bd9),_0x48950b&&console[_0x2f190e(0x1d3)](_0x2f190e(0x248)+_0x5dcdfb));const _0x2df82f=await withSpinner(_0x2f190e(0x244)+_0x27cd14+_0x2f190e(0x1b9),()=>_0x169397['segment']['resolveParentId'](_0x27cd14),{'verbose':_0x23fbbf[_0x2f190e(0x207)]}),_0x311b8d=_0x2df82f[_0x2f190e(0x231)],[_0x1bbd84,_0x4e3a5c,_0x5a3dcf,_0x30e731,_0x17ad5b]=await Promise[_0x2f190e(0x1f1)]([withSpinner(_0x2f190e(0x1c4),()=>_0x169397['segment'][_0x2f190e(0x249)](_0x311b8d),{'verbose':_0x23fbbf['verbose']}),withSpinner(_0x2f190e(0x214),()=>_0x169397[_0x2f190e(0x213)][_0x2f190e(0x1e6)](_0x311b8d),{'verbose':_0x23fbbf[_0x2f190e(0x207)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x169397[_0x2f190e(0x213)][_0x2f190e(0x1fe)](_0x311b8d),{'verbose':_0x23fbbf[_0x2f190e(0x207)]}),withSpinner(_0x2f190e(0x1de),()=>_0x169397['journey'][_0x2f190e(0x219)](_0x311b8d,{'includeAllVersions':!![]}),{'verbose':_0x23fbbf[_0x2f190e(0x207)]}),withSpinner(_0x2f190e(0x1da),()=>_0x169397[_0x2f190e(0x226)][_0x2f190e(0x21c)](),{'verbose':_0x23fbbf[_0x2f190e(0x207)]})[_0x2f190e(0x22f)](_0x1905b6=>_0x1905b6[_0x2f190e(0x231)])]),_0x4e1bcf=_0x1bbd84['data'],_0x49af65=extractRootFolderId(_0x4e1bcf),_0x12d68e=_0x4e3a5c[_0x2f190e(0x231)],_0x3472a3=_0x5a3dcf[_0x2f190e(0x231)],{journeys:_0xeb2b3e,activationStepsById:_0x22d0fe}=_0x30e731[_0x2f190e(0x231)],_0x49dd68=new Map(_0xeb2b3e[_0x2f190e(0x23f)](_0x768112=>[_0x768112['id'],_0x768112])),_0x5946d4=_0xeb2b3e['map'](_0x3b65ab=>({'id':_0x3b65ab['id'],'name':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x21d)],'journeyBundleName':_0x3b65ab['attributes'][_0x2f190e(0x201)]||'','journeyBundleId':_0x3b65ab[_0x2f190e(0x210)]['journeyBundleId']||'','versionNumber':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x1f7)],'description':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x1c9)],'state':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x21b)],'paused':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x22e)],'audienceId':_0x3b65ab['attributes'][_0x2f190e(0x20f)],'folderId':_0x3b65ab[_0x2f190e(0x22b)]?.[_0x2f190e(0x1cf)]?.['data']?.['id'],'createdAt':_0x3b65ab[_0x2f190e(0x210)][_0x2f190e(0x1f4)],'updatedAt':_0x3b65ab['attributes'][_0x2f190e(0x1d4)]})),{emailToId:_0x3133b1,idToEmail:_0x1f6eff}=_0x17ad5b,_0x52df98=await withSpinner(_0x2f190e(0x1ed),async()=>{const _0x77ebaa=await _0x169397['connection']['list']();return buildConnectionMaps(_0x77ebaa);},{'verbose':_0x23fbbf[_0x2f190e(0x207)]})[_0x2f190e(0x22f)](_0x1d722b=>_0x1d722b[_0x2f190e(0x231)]),_0x37f2e=_0x52df98[_0x2f190e(0x20a)],_0x44d92d=_0x52df98[_0x2f190e(0x221)],_0x4fbdf9=_0x52df98[_0x2f190e(0x1c0)],_0x244219={'emailToIdMap':_0x3133b1,'connectionNameToIdMap':_0x37f2e,'connectionNameToTypeMap':_0x4fbdf9,'getSchema':_0x3bf989=>_0x169397[_0x2f190e(0x21a)][_0x2f190e(0x1f3)](_0x3bf989)};let {pathToId:_0xee0026,idToPath:_0x47214b}=buildFolderMaps(_0x3472a3);const _0x282059=buildSegmentLookupMap(_0x12d68e,_0x47214b),_0x3807d6=buildSegmentNameToIdMap(_0x12d68e),_0x288392=buildJourneyBundleLookupMap(_0x5946d4,_0x47214b);let _0x1e53df;if(_0x1f5a09){if(!_0x1f5a09[_0x2f190e(0x234)]('.yml')&&!_0x1f5a09[_0x2f190e(0x234)](_0x2f190e(0x1e4)))return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x1f5a09+'\x0a')),0x1;_0x1e53df=[_0x1f5a09];}else _0x1e53df=findYamlFiles(_0x142bd9);if(_0x1e53df['length']===0x0)return console['error'](a31_0x155a91[_0x2f190e(0x1fb)](_0x2f190e(0x1bd)+_0x142bd9+'\x0a')),console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x224)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0xaf9e18,_0x112a1b;try{const _0x5030bd=parseAndClassifyYamlFiles(_0x1e53df,_0x142bd9,{'skipSegments':_0x23fbbf[_0x2f190e(0x1d8)]});_0xaf9e18=_0x5030bd['segments'],_0x112a1b=_0x5030bd['journeys'];const _0x1cf146=validateParsedFiles(_0x5030bd,_0x142bd9);if(_0x1cf146['length']>0x0)return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)]('\x0aValidation\x20failed:')),console[_0x2f190e(0x1d3)](formatValidationErrors(_0x1cf146)),console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1f5)](_0x2f190e(0x1db))),0x1;}catch(_0x57eca4){return console['error'](a31_0x155a91[_0x2f190e(0x1fb)](_0x2f190e(0x1c7)+(_0x57eca4 instanceof Error?_0x57eca4[_0x2f190e(0x1dc)]:_0x57eca4))),0x1;}if(_0xaf9e18[_0x2f190e(0x1e1)]===0x0&&_0x112a1b[_0x2f190e(0x1e1)]===0x0){const _0x5ce41a=_0x23fbbf[_0x2f190e(0x1d8)]?_0x2f190e(0x20d):'segment\x20or\x20journey';return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1f5)]('No\x20'+_0x5ce41a+_0x2f190e(0x23e))),0x0;}const _0x23b821=new Map();_0x12d68e[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x12d68e,async _0x369d28=>{const _0x2701d1=a31_0x4144,_0x2ff817=await _0x169397[_0x2701d1(0x213)][_0x2701d1(0x1bf)](_0x311b8d,_0x369d28['id']);_0x23b821['set'](_0x369d28['id'],_0x2ff817);});},{'verbose':_0x23fbbf['verbose']});const {segmentFiles:_0x2b8453,foldersToCreate:_0x26e80b}=await prepareSegmentFiles(_0xaf9e18,{'segmentByFolderAndName':_0x282059,'activationsBySegmentId':_0x23b821,'folderPathToId':_0xee0026,'idToEmailMap':_0x1f6eff,'connectionIdToNameMap':_0x44d92d},_0x244219,_0x48950b,_0x5dcdfb),_0x1bfc41=_0x1f5a09?[]:findSegmentsToDelete(_0x12d68e,_0xaf9e18[_0x2f190e(0x23f)](({yamlConfig:_0x3572df,folderPath:_0x26c180})=>({'yamlConfig':_0x3572df,'folderPath':resolveTDFolderPath(_0x26c180,_0x48950b,_0x5dcdfb)})),_0x47214b,_0x5dcdfb,_0x48950b),{journeyFiles:_0x55fc02,foldersToCreate:_0x5aa199}=await withProgressSpinner(_0x2f190e(0x23c),async _0x1173aa=>prepareJourneyFiles(_0x112a1b,{'fetchJourney':async _0x2a9e19=>_0x169397[_0x2f190e(0x20d)][_0x2f190e(0x1fa)](_0x2a9e19[_0x2f190e(0x1d7)]),'journeyBundlesByFolderAndName':_0x288392,'folderPathToId':_0xee0026,'idToEmailMap':_0x1f6eff,'connectionIdToNameMap':_0x44d92d,'existingSegments':_0x12d68e,'parentId':_0x311b8d,'deps':_0x169397,'progress':{'update':_0x238c42=>{const _0x1eec4a=_0x2f190e;_0x1173aa[_0x1eec4a(0x1e0)](_0x238c42),_0x23fbbf[_0x1eec4a(0x207)]&&console[_0x1eec4a(0x1d3)]('\x20\x20'+_0x238c42);}},'journeyById':_0x49dd68,'activationStepsById':_0x22d0fe},_0x48950b,_0x5dcdfb),{'verbose':_0x23fbbf[_0x2f190e(0x207)]})[_0x2f190e(0x22f)](_0x331437=>_0x331437['data']);for(const _0x46cb1d of _0x5aa199){_0x26e80b[_0x2f190e(0x1e9)](_0x46cb1d);}const _0x12a87b=_0x1f5a09?[]:findJourneysToDelete(_0x5946d4,_0x112a1b[_0x2f190e(0x23f)](({yamlConfig:_0x2d587d,folderPath:_0x120ea9})=>({'yamlConfig':_0x2d587d,'folderPath':resolveTDFolderPath(_0x120ea9,_0x48950b,_0x5dcdfb)})),_0x47214b,_0x5dcdfb,_0x48950b),_0x30a6be=calculatePushStats(_0x2b8453,_0x55fc02,_0x26e80b,_0x1bfc41,_0x12a87b,!!_0x23fbbf['delete'],!!_0x23fbbf['journeysOnly']),_0x481bfe=_0x30a6be[_0x2f190e(0x204)]['new'],_0x2ef3d9=_0x30a6be['segments']['changed'],_0x281c07=_0x30a6be[_0x2f190e(0x204)]['unchanged'],_0x3c1831=_0x30a6be[_0x2f190e(0x204)]['toDelete'],_0x4df775=_0x30a6be['folders'][_0x2f190e(0x1e5)],_0x18e57d=_0x30a6be[_0x2f190e(0x20b)]['new'],_0xdc916c=_0x30a6be[_0x2f190e(0x20b)]['changed'],_0x6cbc47=_0x30a6be[_0x2f190e(0x20b)]['unchanged'],_0x5c4ec0=_0x30a6be[_0x2f190e(0x20b)][_0x2f190e(0x208)],_0x2a98be=_0x30a6be['activations'][_0x2f190e(0x1f1)],_0x5dc722=_0x30a6be['activations'][_0x2f190e(0x1e5)],_0x4558c5=_0x30a6be['activations'][_0x2f190e(0x1c2)],_0x27b22e=_0x30a6be[_0x2f190e(0x1bb)][_0x2f190e(0x208)];console[_0x2f190e(0x1d3)](_0x2f190e(0x239)+_0x27cd14+'\x27:');_0x4df775[_0x2f190e(0x1e1)]>0x0&&console['error']('\x20\x20'+a31_0x155a91[_0x2f190e(0x22d)](_0x2f190e(0x1df)+_0x4df775[_0x2f190e(0x1e1)]+_0x2f190e(0x222)));if(!_0x23fbbf[_0x2f190e(0x1d8)]){console[_0x2f190e(0x1d3)](_0x2f190e(0x205)),console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x24a)]('+\x20'+_0x481bfe[_0x2f190e(0x1e1)]+_0x2f190e(0x236))),console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x1f5)]('~\x20'+_0x2ef3d9['length']+_0x2f190e(0x218)));if(_0x3c1831[_0x2f190e(0x1e1)]>0x0)console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91['red']('-\x20'+_0x3c1831['length']+_0x2f190e(0x237)));else _0x1bfc41[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf['delete']&&console['error'](_0x2f190e(0x245)+a31_0x155a91['dim'](_0x1bfc41[_0x2f190e(0x1e1)]+_0x2f190e(0x233)));console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x206)]('=\x20'+_0x281c07[_0x2f190e(0x1e1)]+_0x2f190e(0x21e)));}if(_0x55fc02[_0x2f190e(0x1e1)]>0x0||_0x12a87b['length']>0x0){console[_0x2f190e(0x1d3)](_0x2f190e(0x209)),console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x24a)]('+\x20'+_0x18e57d['length']+_0x2f190e(0x236))),console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x1f5)]('~\x20'+_0xdc916c['length']+'\x20changed'));if(_0x5c4ec0['length']>0x0)console['error'](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x1fb)]('-\x20'+_0x5c4ec0[_0x2f190e(0x1e1)]+_0x2f190e(0x237)));else _0x12a87b[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf['delete']&&console['error'](_0x2f190e(0x245)+a31_0x155a91[_0x2f190e(0x206)](_0x12a87b['length']+_0x2f190e(0x233)));console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91['dim']('=\x20'+_0x6cbc47[_0x2f190e(0x1e1)]+_0x2f190e(0x21e)));}_0x2a98be[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)]&&(console[_0x2f190e(0x1d3)](''),console[_0x2f190e(0x1d3)]('\x20\x20Activations:'),_0x5dc722[_0x2f190e(0x1e1)]>0x0&&console[_0x2f190e(0x1d3)](_0x2f190e(0x245)+a31_0x155a91['green']('+\x20'+_0x5dc722[_0x2f190e(0x1e1)]+_0x2f190e(0x238))),_0x4558c5[_0x2f190e(0x1e1)]>0x0&&console[_0x2f190e(0x1d3)]('\x20\x20\x20\x20'+a31_0x155a91[_0x2f190e(0x1f5)]('~\x20'+_0x4558c5[_0x2f190e(0x1e1)]+_0x2f190e(0x230))),_0x27b22e[_0x2f190e(0x1e1)]>0x0&&console[_0x2f190e(0x1d3)]('\x20\x20\x20\x20'+a31_0x155a91[_0x2f190e(0x1fb)]('-\x20'+_0x27b22e['length']+_0x2f190e(0x237))));console[_0x2f190e(0x1d3)]('\x20\x20Source:\x20'+a31_0x155a91['cyan'](_0x142bd9)+'\x0a');if(_0x4df775['length']>0x0){console['error'](_0x2f190e(0x227));for(const _0x2de332 of _0x4df775){console[_0x2f190e(0x1d3)]('\x20\x20'+a31_0x155a91['blue']('+')+'\x20'+_0x2de332);}console[_0x2f190e(0x1d3)]('');}if(_0x481bfe['length']>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)])for(const _0xf88eeb of _0x481bfe){const _0x561c47=_0xf88eeb['folderPath']?_0xf88eeb['folderPath']+'/'+_0xf88eeb[_0x2f190e(0x1e8)]['name']:_0xf88eeb[_0x2f190e(0x1e8)]['name'],_0x226dd3=_0xf88eeb[_0x2f190e(0x1e8)][_0x2f190e(0x1bb)]?.[_0x2f190e(0x1e1)]||0x0,_0x2085c3=_0x226dd3>0x0?a31_0x155a91[_0x2f190e(0x206)]('\x20['+_0x226dd3+_0x2f190e(0x215)):'';console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91[_0x2f190e(0x24a)]('New\x20segment:')+'\x20'+_0x561c47+_0x2085c3),console['error']('β'['repeat'](0x3c)),_0xf88eeb[_0x2f190e(0x1f2)]&&console[_0x2f190e(0x1d3)](_0xf88eeb['diff']),console['error']('β'['repeat'](0x3c));}if(_0x3c1831['length']>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)])for(const _0x47f146 of _0x3c1831){const _0x1fdd25=_0x47f146[_0x2f190e(0x232)]?_0x47214b['get'](_0x47f146[_0x2f190e(0x232)][_0x2f190e(0x1cc)]())||'':'',_0x1b2226=_0x1fdd25?_0x1fdd25+'/'+_0x47f146[_0x2f190e(0x21d)]:_0x47f146[_0x2f190e(0x21d)],_0x4ea3c3=_0x23b821['get'](_0x47f146['id'])||[],_0x3b3ad2=_0x4ea3c3[_0x2f190e(0x1e1)]>0x0?a31_0x155a91[_0x2f190e(0x206)]('\x20['+_0x4ea3c3[_0x2f190e(0x1e1)]+_0x2f190e(0x215)):'';console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91[_0x2f190e(0x1fb)]('Delete\x20segment:')+'\x20'+_0x1b2226+_0x3b3ad2),console[_0x2f190e(0x1d3)]('β'[_0x2f190e(0x1d9)](0x3c));const _0x4570d4=segmentWithActivationsToYaml(_0x47f146,_0x4ea3c3,undefined,_0x1f6eff,_0x44d92d),_0x38b078=segmentToYamlString(_0x4570d4),_0x490cb3=generateDiff(_0x38b078,'');console[_0x2f190e(0x1d3)](formatDiffWithColors(_0x490cb3)),console[_0x2f190e(0x1d3)]('β'[_0x2f190e(0x1d9)](0x3c));}const _0x537f77=_0x2b8453[_0x2f190e(0x241)](_0x5980ca=>!_0x5980ca['isNew']&&_0x5980ca[_0x2f190e(0x1f2)]);if(_0x537f77[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)])for(const _0x32bb02 of _0x537f77){const _0x2fe3a7=_0x32bb02[_0x2f190e(0x1c3)]?_0x32bb02['folderPath']+'/'+_0x32bb02[_0x2f190e(0x1e8)][_0x2f190e(0x21d)]:_0x32bb02[_0x2f190e(0x1e8)]['name'];console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91[_0x2f190e(0x1f5)](_0x2f190e(0x1e3))+'\x20'+_0x2fe3a7),console[_0x2f190e(0x1d3)]('β'[_0x2f190e(0x1d9)](0x3c)),console[_0x2f190e(0x1d3)](_0x32bb02[_0x2f190e(0x1f2)]),console[_0x2f190e(0x1d3)]('β'[_0x2f190e(0x1d9)](0x3c));}if(_0x18e57d[_0x2f190e(0x1e1)]>0x0)for(const _0x339320 of _0x18e57d){const _0x2bbf0a=_0x339320[_0x2f190e(0x1c3)]?_0x339320[_0x2f190e(0x1c3)]+'/'+_0x339320[_0x2f190e(0x1e8)]['name']:_0x339320[_0x2f190e(0x1e8)][_0x2f190e(0x21d)];console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91['green']('New\x20journey:')+'\x20'+_0x2bbf0a),console['error']('β'['repeat'](0x3c)),_0x339320[_0x2f190e(0x1f2)]&&console[_0x2f190e(0x1d3)](_0x339320[_0x2f190e(0x1f2)]),console[_0x2f190e(0x1d3)]('β'['repeat'](0x3c));}const _0x2c88f2=_0x55fc02[_0x2f190e(0x241)](_0x4718e2=>!_0x4718e2[_0x2f190e(0x1d2)]&&_0x4718e2[_0x2f190e(0x1f2)]);if(_0x2c88f2[_0x2f190e(0x1e1)]>0x0)for(const _0x1dd478 of _0x2c88f2){const _0x36afa9=_0x1dd478[_0x2f190e(0x1c3)]?_0x1dd478[_0x2f190e(0x1c3)]+'/'+_0x1dd478[_0x2f190e(0x1e8)][_0x2f190e(0x21d)]:_0x1dd478['yamlConfig'][_0x2f190e(0x21d)];console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91['yellow'](_0x2f190e(0x21f))+'\x20'+_0x36afa9),console[_0x2f190e(0x1d3)]('β'['repeat'](0x3c)),console[_0x2f190e(0x1d3)](_0x1dd478[_0x2f190e(0x1f2)]),console[_0x2f190e(0x1d3)]('β'['repeat'](0x3c));}if(_0x5c4ec0[_0x2f190e(0x1e1)]>0x0)for(const _0x4609b8 of _0x5c4ec0){const _0x1e145a=_0x4609b8['folderId']?_0x47214b['get'](_0x4609b8[_0x2f190e(0x240)])||'':'',_0x595993=_0x1e145a?_0x1e145a+'/'+_0x4609b8['journeyBundleName']:_0x4609b8[_0x2f190e(0x201)];console[_0x2f190e(0x1d3)]('\x0a'+a31_0x155a91[_0x2f190e(0x1fb)](_0x2f190e(0x1ee))+'\x20'+_0x595993),console['error']('β'[_0x2f190e(0x1d9)](0x3c)),console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)]('(Journey\x20will\x20be\x20deleted)')),console['error']('β'[_0x2f190e(0x1d9)](0x3c));}if(_0x23fbbf[_0x2f190e(0x22a)])return console[_0x2f190e(0x1d3)](a31_0x155a91['yellow'](_0x2f190e(0x1d1))),0x0;const _0x904151=_0x23fbbf[_0x2f190e(0x1d8)]?![]:_0x481bfe[_0x2f190e(0x1e1)]>0x0||_0x2ef3d9[_0x2f190e(0x1e1)]>0x0||_0x3c1831[_0x2f190e(0x1e1)]>0x0,_0xe1475f=_0x18e57d[_0x2f190e(0x1e1)]>0x0||_0xdc916c[_0x2f190e(0x1e1)]>0x0||_0x5c4ec0[_0x2f190e(0x1e1)]>0x0,_0x1866dc=_0x23fbbf[_0x2f190e(0x1d8)]?![]:_0x2a98be[_0x2f190e(0x1e1)]>0x0,_0x3b6ed3=_0x4df775[_0x2f190e(0x1e1)]>0x0;if(!_0x904151&&!_0xe1475f&&!_0x1866dc&&!_0x3b6ed3){const _0x3abb40=_0x23fbbf[_0x2f190e(0x1d8)]?_0x2f190e(0x203):'β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x24a)](_0x3abb40));if(_0x1f5a09&&_0x6cbc47[_0x2f190e(0x1e1)]===0x1){const _0x5ba801=_0x6cbc47[0x0];if(_0x5ba801[_0x2f190e(0x1be)]?.['id']){const _0x144c9f=getConsoleNextUrl(_0x23fbbf[_0x2f190e(0x22c)],'/app/ps/'+_0x311b8d+_0x2f190e(0x242)+_0x5ba801['existingJourney']['id']+_0x2f190e(0x217));console['error']('\x20\x20'+a31_0x155a91['cyan'](_0x144c9f));}}return 0x0;}const _0x37fba2=_0x23fbbf[_0x2f190e(0x1d8)]?_0x18e57d[_0x2f190e(0x1e1)]+_0xdc916c[_0x2f190e(0x1e1)]+_0x5c4ec0[_0x2f190e(0x1e1)]+_0x4df775['length']:_0x481bfe['length']+_0x2ef3d9[_0x2f190e(0x1e1)]+_0x3c1831[_0x2f190e(0x1e1)]+_0x18e57d['length']+_0xdc916c['length']+_0x5c4ec0[_0x2f190e(0x1e1)]+_0x4df775[_0x2f190e(0x1e1)]+_0x2a98be[_0x2f190e(0x1e1)];if(!_0x23fbbf[_0x2f190e(0x1b8)]&&_0x37fba2>0x0){if(!isInteractive())return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)](_0x2f190e(0x1e7)),_0x2f190e(0x1c8)),console[_0x2f190e(0x1d3)](a31_0x155a91['dim'](_0x2f190e(0x1ce))),0x1;const _0x57574a=await confirmKey(_0x2f190e(0x23d)+_0x37fba2+'\x20changes?');if(!_0x57574a)return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1f5)]('Aborted.')),0x1;}const _0x2e2e51={'withProgress':async(_0x53f726,_0x1e1151)=>{const _0x3d3207=_0x2f190e,_0x56bbe3=await withSpinner(_0x53f726,_0x1e1151,{'verbose':_0x23fbbf['verbose']});return{'data':_0x56bbe3[_0x3d3207(0x231)]};},'logInfo':_0x413565=>console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x22d)]('β\x20'+_0x413565)),'logSuccess':_0x27fd49=>console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x24a)]('β\x20'+_0x27fd49)),'logWarning':_0x221522=>console[_0x2f190e(0x1d3)](a31_0x155a91['yellow']('β \x20'+_0x221522)),'logDeleted':_0x4bf0a5=>console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x1fb)]('β\x20'+_0x4bf0a5))},_0x397613={'segment':_0x169397[_0x2f190e(0x213)],'journey':_0x169397['journey'],'user':_0x169397[_0x2f190e(0x226)],'connection':_0x169397[_0x2f190e(0x21a)]};_0x4df775[_0x2f190e(0x1e1)]>0x0&&(_0xee0026=await executePushFolders(_0x397613,_0x4df775,_0xee0026,{'parentId':_0x311b8d},_0x2e2e51));const _0x4337a3={'rootFolderId':_0x49af65,'folderPathToId':_0xee0026,'folderIdToPath':_0x47214b,'segmentNameToId':_0x3807d6,'activationsBySegmentId':_0x23b821,'emailToIdMap':_0x3133b1,'idToEmailMap':_0x1f6eff,'connectionNameToIdMap':_0x52df98['nameToId'],'connectionIdToNameMap':_0x52df98['idToName'],'connectionNameToTypeMap':_0x4fbdf9},_0x307148=await executePushSegments(_0x397613,_0x23fbbf[_0x2f190e(0x1d8)]?[]:_0x2b8453,_0x4337a3,{'parentId':_0x311b8d},_0x2e2e51),_0x1e768b=_0x307148[_0x2f190e(0x1cb)],_0x4abd75=_0x307148[_0x2f190e(0x1f0)],_0x2b8199=_0x307148[_0x2f190e(0x1bb)][_0x2f190e(0x1cb)],_0x122ecb=_0x307148['activations'][_0x2f190e(0x1f0)],_0x146693=_0x307148[_0x2f190e(0x1bb)][_0x2f190e(0x202)],_0x1ac910=await executePushSegmentDeletions(_0x397613,_0x23fbbf[_0x2f190e(0x1d8)]?[]:_0x3c1831,_0x2e2e51);let _0x30aeea=0x0,_0xf5774f=0x0,_0x3d6588=0x0;const _0x1ff583=new Map(_0x3807d6);for(const [_0x19c591,_0x3cbdba]of _0x307148[_0x2f190e(0x1ea)]){_0x1ff583[_0x2f190e(0x1ec)](_0x19c591,_0x3cbdba);}if(_0x55fc02[_0x2f190e(0x1e1)]>0x0){const _0x549135={..._0x4337a3,'segmentNameToId':_0x1ff583,'existingSegments':_0x12d68e,'activationContext':_0x244219},_0x46c5a1=await executePushJourneys(_0x397613,_0x55fc02,_0x549135,{'parentId':_0x311b8d,'rootFolderId':_0x49af65,'verbose':_0x23fbbf[_0x2f190e(0x207)]},_0x2e2e51);_0x30aeea=_0x46c5a1[_0x2f190e(0x1cb)],_0xf5774f=_0x46c5a1[_0x2f190e(0x1f0)];if(_0x1f5a09&&_0x46c5a1[_0x2f190e(0x23a)][_0x2f190e(0x1e1)]===0x1){const _0x327cad=_0x46c5a1[_0x2f190e(0x23a)][0x0];if(_0x327cad[_0x2f190e(0x1d7)]){const _0x513aff=getConsoleNextUrl(_0x23fbbf[_0x2f190e(0x22c)],_0x2f190e(0x229)+_0x311b8d+'/e/'+_0x327cad[_0x2f190e(0x1d7)]+_0x2f190e(0x217));console['error']('\x20\x20'+a31_0x155a91[_0x2f190e(0x224)](_0x513aff));}}}for(const _0x5cfde9 of _0x5c4ec0){console['error'](a31_0x155a91[_0x2f190e(0x1f5)](_0x2f190e(0x243)+_0x5cfde9[_0x2f190e(0x201)])),_0x3d6588++;}const _0x20cd51=[];if(_0x1e768b>0x0)_0x20cd51[_0x2f190e(0x1b7)](_0x1e768b+_0x2f190e(0x247));if(_0x4abd75>0x0)_0x20cd51['push'](_0x4abd75+'\x20updated');if(_0x1ac910>0x0)_0x20cd51[_0x2f190e(0x1b7)](_0x1ac910+_0x2f190e(0x1cd));const _0x4b8c68=[];if(_0x30aeea>0x0)_0x4b8c68[_0x2f190e(0x1b7)](_0x30aeea+'\x20created');if(_0xf5774f>0x0)_0x4b8c68[_0x2f190e(0x1b7)](_0xf5774f+_0x2f190e(0x1d0));if(_0x3d6588>0x0)_0x4b8c68['push'](_0x3d6588+_0x2f190e(0x1cd));const _0x24a066=[];if(_0x2b8199>0x0)_0x24a066['push'](_0x2b8199+_0x2f190e(0x247));if(_0x122ecb>0x0)_0x24a066[_0x2f190e(0x1b7)](_0x122ecb+_0x2f190e(0x1d0));if(_0x146693>0x0)_0x24a066[_0x2f190e(0x1b7)](_0x146693+_0x2f190e(0x1cd));return console[_0x2f190e(0x1d3)](a31_0x155a91[_0x2f190e(0x24a)](_0x2f190e(0x216))),_0x20cd51[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)]&&console['error']('\x20\x20Segments:\x20'+_0x20cd51[_0x2f190e(0x228)](',\x20')),_0x4b8c68[_0x2f190e(0x1e1)]>0x0&&console['error'](_0x2f190e(0x223)+_0x4b8c68[_0x2f190e(0x228)](',\x20')),_0x24a066[_0x2f190e(0x1e1)]>0x0&&!_0x23fbbf[_0x2f190e(0x1d8)]&&console[_0x2f190e(0x1d3)]('\x20\x20Activations:\x20'+_0x24a066[_0x2f190e(0x228)](',\x20')),0x0;}}
|