@treasuredata/tdx 0.25.6 β 0.25.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.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_0x2fbda1=a26_0x4f02;(function(_0x47747c,_0x515adc){const _0x57e5b1=a26_0x4f02,_0x7430b=_0x47747c();while(!![]){try{const _0x4657dd=parseInt(_0x57e5b1(0x109))/0x1+parseInt(_0x57e5b1(0x107))/0x2*(parseInt(_0x57e5b1(0xae))/0x3)+-parseInt(_0x57e5b1(0x8f))/0x4*(parseInt(_0x57e5b1(0xb9))/0x5)+parseInt(_0x57e5b1(0xcf))/0x6+parseInt(_0x57e5b1(0x9c))/0x7*(parseInt(_0x57e5b1(0xaf))/0x8)+-parseInt(_0x57e5b1(0x96))/0x9*(-parseInt(_0x57e5b1(0xe5))/0xa)+-parseInt(_0x57e5b1(0xe2))/0xb;if(_0x4657dd===_0x515adc)break;else _0x7430b['push'](_0x7430b['shift']());}catch(_0x4e9f39){_0x7430b['push'](_0x7430b['shift']());}}}(a26_0x37f5,0x55bd1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a26_0x4f02(_0x18e613,_0x2f8db3){_0x18e613=_0x18e613-0x85;const _0x37f5db=a26_0x37f5();let _0x4f0232=_0x37f5db[_0x18e613];return _0x4f0232;}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_0x102ad9 from'chalk';function formatRelativeTime(_0x5bf0ce){const _0x54e706=a26_0x4f02,_0x4f2eb0=new Date(_0x5bf0ce),_0x3b4017=new Date(),_0x5b1478=_0x4f2eb0[_0x54e706(0xfe)]()-_0x3b4017[_0x54e706(0xfe)](),_0x2341a0=Math[_0x54e706(0xa9)](_0x5b1478)/0x3e8,_0x48a145=_0x5b1478<0x0;if(_0x2341a0<0x3c)return _0x48a145?_0x54e706(0xa6):_0x54e706(0xd8);else{if(_0x2341a0<0xe10){const _0x5831ec=Math[_0x54e706(0xf5)](_0x2341a0/0x3c);return _0x48a145?_0x5831ec+_0x54e706(0x99):_0x54e706(0xb1)+_0x5831ec+'m';}else{if(_0x2341a0<0x15180){const _0x26533f=Math['round'](_0x2341a0/0xe10);return _0x48a145?_0x26533f+_0x54e706(0x85):_0x54e706(0xb1)+_0x26533f+'h';}else{if(_0x2341a0<0x93a80){const _0x114cf3=Math[_0x54e706(0xf5)](_0x2341a0/0x15180);return _0x48a145?_0x114cf3+'d\x20ago':_0x54e706(0xb1)+_0x114cf3+'d';}else return _0x4f2eb0['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x2fbda1(0x95)]='schedule:list';[a26_0x2fbda1(0xb6)]=a26_0x2fbda1(0x113);async['execute'](_0x386cd2){const _0x52f289=a26_0x2fbda1,{options:_0x2b25f7,args:_0x402d10,tdx:_0x2040d3}=_0x386cd2,_0x2270f6=resolveLimit(_0x2b25f7[_0x52f289(0x106)],DEFAULT_DISPLAY_LIMIT),_0x2a3dbf=_0x402d10[0x0],_0x3190dc=_0x2a3dbf?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x2a3dbf+'\x22...':_0x52f289(0xd4),_0x1d1c8a=await withSpinner(_0x3190dc,()=>_0x2040d3[_0x52f289(0x88)][_0x52f289(0x10c)]({'limit':_0x2270f6,'scheduled':!![],'pattern':_0x2a3dbf}),{'verbose':_0x2b25f7[_0x52f289(0xe3)]}),_0x328338=_0x1d1c8a['data'][_0x52f289(0xf8)],_0x5bd736=_0x1d1c8a[_0x52f289(0xa8)][_0x52f289(0xd2)][_0x52f289(0xc3)],_0x3e33a1=_0x2a3dbf?_0x52f289(0x9e)+_0x2a3dbf+'\x22':'';_0x5bd736?console[_0x52f289(0x10e)](_0x52f289(0x116)+_0x328338[_0x52f289(0x104)]+_0x52f289(0xf6)+_0x3e33a1+_0x52f289(0xb2)):console['error'](_0x52f289(0xb3)+_0x328338[_0x52f289(0x104)]+'\x20scheduled\x20quer'+(_0x328338[_0x52f289(0x104)]!==0x1?_0x52f289(0xf9):'y')+_0x3e33a1);if(_0x2b25f7['format']===_0x52f289(0xd1)||_0x2b25f7[_0x52f289(0xaa)]===_0x52f289(0xea)||_0x2b25f7['format']===_0x52f289(0x10d)||_0x2b25f7[_0x52f289(0xaa)]===_0x52f289(0xf7)){const _0x130ed1=_0x328338[_0x52f289(0xde)](_0x12c253=>({'id':_0x12c253['id'],'name':_0x12c253[_0x52f289(0x95)],'cron':_0x12c253['cron'],'database':_0x12c253[_0x52f289(0x110)]?.['name'],'type':_0x12c253[_0x52f289(0x103)],'timezone':_0x12c253[_0x52f289(0xc2)],'user_name':_0x12c253[_0x52f289(0xf0)]?.[_0x52f289(0x95)],'updated_at':_0x12c253[_0x52f289(0xe0)],'next_run_at':_0x12c253[_0x52f289(0xf1)],'last_job_status':_0x12c253[_0x52f289(0x97)]?.[_0x52f289(0xb8)]}));await handleSDKOutput(_0x130ed1,_0x2b25f7);}else{if(_0x328338[_0x52f289(0x104)]===0x0)console['log'](_0x52f289(0x108));else{const _0x50793e=_0x2b25f7[_0x52f289(0xe1)],_0x12b0d2=_0x328338[_0x52f289(0xde)](_0x4df5ff=>{const _0xd38ce=_0x52f289,_0x2a3660=_0x4df5ff['last_job']?.[_0xd38ce(0xb8)]?_0x4df5ff['last_job'][_0xd38ce(0xb8)]===_0xd38ce(0x8a)?'β':'β':'-',_0x3aa306=_0x4df5ff[_0xd38ce(0x97)]?.[_0xd38ce(0xab)]?formatRelativeTime(_0x4df5ff[_0xd38ce(0x97)][_0xd38ce(0xab)]):_0xd38ce(0x111),_0x3b86bd=_0x4df5ff[_0xd38ce(0xf1)]?formatRelativeTime(_0x4df5ff[_0xd38ce(0xf1)]):'-',_0x221ba8=_0x4df5ff[_0xd38ce(0x86)]||'',_0x28255a=_0x4df5ff[_0xd38ce(0x95)]||_0xd38ce(0xc4),_0x38ab82=getConsoleUrl(_0x50793e,'/app/queries/editor?queryId='+_0x4df5ff['id']);return{'statusIcon':_0x2a3660,'lastRun':_0x3aa306,'nextRun':_0x3b86bd,'cron':_0x221ba8,'name':_0x28255a,'queryUrl':_0x38ab82,'status':_0x4df5ff[_0xd38ce(0x97)]?.[_0xd38ce(0xb8)]};}),_0x1bb37e=Math[_0x52f289(0xd9)](..._0x12b0d2['map'](_0x202c42=>_0x202c42['lastRun'][_0x52f289(0x104)])),_0x314ec1=Math[_0x52f289(0xd9)](..._0x12b0d2[_0x52f289(0xde)](_0x1007b2=>_0x1007b2[_0x52f289(0x10b)]['length'])),_0x4b1d29=Math[_0x52f289(0xd9)](..._0x12b0d2[_0x52f289(0xde)](_0x246e51=>_0x246e51[_0x52f289(0x86)][_0x52f289(0x104)])),_0x45876f=_0x12b0d2[_0x52f289(0xde)](_0x45f986=>{const _0xb6a0d8=_0x52f289,_0x339ec7=_0x45f986[_0xb6a0d8(0xb8)]===_0xb6a0d8(0x8a)?a26_0x102ad9['green'](_0x45f986[_0xb6a0d8(0xc1)]):_0x45f986[_0xb6a0d8(0xb8)]==='error'?a26_0x102ad9[_0xb6a0d8(0x114)](_0x45f986[_0xb6a0d8(0xc1)]):a26_0x102ad9['dim'](_0x45f986[_0xb6a0d8(0xc1)]),_0x398c8b=_0x45f986[_0xb6a0d8(0xc6)][_0xb6a0d8(0x115)](_0x1bb37e),_0x1b287=_0x45f986[_0xb6a0d8(0x10b)]['padEnd'](_0x314ec1),_0x372279=_0x45f986[_0xb6a0d8(0x86)]?a26_0x102ad9[_0xb6a0d8(0xc0)](_0x45f986[_0xb6a0d8(0x86)]['padEnd'](_0x4b1d29)):'\x20'[_0xb6a0d8(0xa3)](_0x4b1d29),_0x5d3ab6=hyperlink(_0x45f986[_0xb6a0d8(0x95)],_0x45f986[_0xb6a0d8(0xf3)]);return _0xb6a0d8(0xfc)+_0x339ec7+'\x20'+_0x398c8b+'\x20\x20β\x20'+_0x1b287+'\x20\x20'+_0x372279+'\x20\x20'+_0x5d3ab6;});await writeOutput(_0x45876f[_0x52f289(0xa4)]('\x0a'),_0x2b25f7[_0x52f289(0xc5)],_0x52f289(0xdf));}}return 0x0;}}function a26_0x37f5(){const _0x22116b=['pagination','executing_user_id','Listing\x20scheduled\x20queries...','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','trino','created_at','soon','max','INVALID_ARGUMENT','end_at','engine_version','retry_limit','map','list','updated_at','site','8538497DEIjUi','verbose','Creating\x20schedule:\x20','256810tgeLuw','schedule:run','result','\x20\x20Cron:\x20','schedule:delete','jsonl','Running\x20schedule:\x20','Schedule\x20deleted:\x20','time','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Query\x20file\x20is\x20empty','user','next_run_at','priority','queryUrl','Cancelled','round','\x20schedules','tsv','queries','ies','args','Creating\x20schedule...','π
\x20','Schedule\x20run\x20submitted:\x20','getTime','\x20\x20Timezone:\x20','\x20\x20Job\x20ID:\x20','Show\x20schedule\x20execution\x20history','schedule:show','type','length','Failed\x20to\x20read\x20file:\x20','limit','10VeMdpv','No\x20scheduled\x20queries\x20found','340385zumBgU','validate','nextRun','listQueries','table','error','\x20job','database','never','Running\x20schedule...','List\x20scheduled\x20queries','red','padEnd','Showing\x20first\x20','h\x20ago','cron','num','schedules','start_at','success','yes','\x20\x20Num:\x20','file','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','4aNFKZE','jobs','\x20\x20Type:\x20','\x20execution','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','delete','name','9WbQQmD','last_job','entries','m\x20ago','Show\x20schedule\x20details','update','555527zXbYQw','scheduled_at','\x20matching\x20\x22','Deleting\x20schedule...','\x20(showing\x20','delay','from','repeat','join','trim','just\x20now','show','data','abs','format','ended_at','history','...','293817iKCgaX','16JYbkko','execute','in\x20','\x20(use\x20--limit\x20to\x20see\x20more)','Found\x20','retryLimit','\x20created','description','utf-8','status','997995SyvGOu','timezone','Schedule\x20updated:\x20','schedule:history','count','Updating\x20schedule...','engineVersion','cyan','statusIcon','time_zone','has_next_page','(unnamed)','output','lastRun','keys','\x20\x20Database:\x20','query','\x20\x20Time:\x20','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','run','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','1875168EUuSJc','schedule:update','json'];a26_0x37f5=function(){return _0x22116b;};return a26_0x37f5();}export class ScheduleShowCommand extends BaseCommand{[a26_0x2fbda1(0x95)]=a26_0x2fbda1(0x102);[a26_0x2fbda1(0xb6)]=a26_0x2fbda1(0x9a);[a26_0x2fbda1(0x10a)](_0x548d4d){const _0x1984d5=a26_0x2fbda1,_0x1d48e8=_0x548d4d[_0x1984d5(0xfa)][0x0];if(!_0x1d48e8)return _0x1984d5(0x93);return undefined;}async[a26_0x2fbda1(0xb0)](_0x2aeca4){const _0x5acbe1=a26_0x2fbda1,{options:_0x4dbb9e,args:_0x130ad7,tdx:_0x8d8b66}=_0x2aeca4,_0x9d1a0=_0x130ad7[0x0],_0x426712=await withSpinner(_0x5acbe1(0xcb),()=>_0x8d8b66[_0x5acbe1(0x88)][_0x5acbe1(0xa7)](_0x9d1a0),{'verbose':_0x4dbb9e[_0x5acbe1(0xe3)]}),_0xe9f176=_0x426712[_0x5acbe1(0xa8)],_0x5a133f={'name':_0xe9f176[_0x5acbe1(0x95)],'cron':_0xe9f176[_0x5acbe1(0x86)],'database':_0xe9f176[_0x5acbe1(0x110)],'type':_0xe9f176[_0x5acbe1(0x103)],'timezone':_0xe9f176[_0x5acbe1(0xba)],'user_name':_0xe9f176['user_name'],'created_at':_0xe9f176['created_at'],'engine_version':_0xe9f176[_0x5acbe1(0xdc)],'executing_user_id':_0xe9f176[_0x5acbe1(0xd3)],'query':_0xe9f176[_0x5acbe1(0xc9)],'delay':_0xe9f176['delay'],'priority':_0xe9f176[_0x5acbe1(0xf2)],'retry_limit':_0xe9f176['retry_limit'],..._0xe9f176[_0x5acbe1(0xe7)]&&{'result':_0xe9f176[_0x5acbe1(0xe7)]}};return await handleSingleObjectOutput(_0x5a133f,_0x4dbb9e),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x2fbda1(0x95)]='schedule:create';['description']='Create\x20a\x20scheduled\x20query';[a26_0x2fbda1(0x10a)](_0x5d82d2){const _0x5784a4=a26_0x2fbda1,_0x44d345=_0x5d82d2['args'][0x0];if(!_0x44d345)return _0x5784a4(0xce);return undefined;}async['execute'](_0x5b5c01){const _0x498afe=a26_0x2fbda1,{options:_0x2e839d,args:_0x366383,tdx:_0x40d803}=_0x5b5c01,_0x319666=_0x366383[0x0],_0x2b747f=_0x2e839d,_0x440386=_0x2b747f[_0x498afe(0x110)],_0x42d0db=_0x2b747f[_0x498afe(0x8d)],_0x59fbed=_0x2b747f[_0x498afe(0x103)]||_0x498afe(0xd6);let _0x108e73;try{_0x108e73=readFileSync(_0x42d0db,_0x498afe(0xb7))[_0x498afe(0xa5)]();}catch(_0x4e9504){throw new SDKError(ErrorCode[_0x498afe(0xda)],_0x498afe(0x105)+_0x42d0db,_0x4e9504 instanceof Error?_0x4e9504:undefined);}if(!_0x108e73)throw new SDKError(ErrorCode[_0x498afe(0xda)],_0x498afe(0xef));const _0xddee23={'database':_0x440386,'query':_0x108e73,'type':_0x59fbed};if(_0x2b747f[_0x498afe(0x86)])_0xddee23['cron']=_0x2b747f['cron'];if(_0x2b747f[_0x498afe(0xba)])_0xddee23[_0x498afe(0xba)]=_0x2b747f[_0x498afe(0xba)];if(_0x2b747f[_0x498afe(0xa1)]!==undefined)_0xddee23[_0x498afe(0xa1)]=Number(_0x2b747f['delay']);if(_0x2b747f[_0x498afe(0xf2)]!==undefined)_0xddee23['priority']=Number(_0x2b747f[_0x498afe(0xf2)]);if(_0x2b747f[_0x498afe(0xb4)]!==undefined)_0xddee23[_0x498afe(0xdd)]=Number(_0x2b747f[_0x498afe(0xb4)]);if(_0x2b747f[_0x498afe(0xbf)])_0xddee23[_0x498afe(0xdc)]=_0x2b747f['engineVersion'];if(_0x2b747f[_0x498afe(0xe7)])_0xddee23[_0x498afe(0xe7)]=_0x2b747f[_0x498afe(0xe7)];if(_0x2e839d[_0x498afe(0xe3)]){console[_0x498afe(0x10e)](_0x498afe(0xe4)+_0x319666),console['error'](_0x498afe(0xc8)+_0x440386),console[_0x498afe(0x10e)](_0x498afe(0x91)+_0x59fbed);if(_0xddee23[_0x498afe(0x86)])console['error'](_0x498afe(0xe8)+_0xddee23[_0x498afe(0x86)]);if(_0xddee23[_0x498afe(0xba)])console['error'](_0x498afe(0xff)+_0xddee23[_0x498afe(0xba)]);}const _0x102560=await withSpinner(_0x498afe(0xfb),()=>_0x40d803[_0x498afe(0x88)]['create'](_0x319666,_0xddee23),{'verbose':_0x2e839d[_0x498afe(0xe3)]});return console[_0x498afe(0x10e)]('Schedule\x20created:\x20'+_0x102560[_0x498afe(0xa8)]['name']),await handleSingleObjectOutput(_0x102560[_0x498afe(0xa8)],_0x2e839d),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x2fbda1(0x95)]=a26_0x2fbda1(0xd0);[a26_0x2fbda1(0xb6)]='Update\x20a\x20scheduled\x20query';['validate'](_0x4660be){const _0x31200d=a26_0x2fbda1,_0xe69951=_0x4660be[_0x31200d(0xfa)][0x0];if(!_0xe69951)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a26_0x2fbda1(0xb0)](_0x20957a){const _0x4f0149=a26_0x2fbda1,{options:_0x1adc31,args:_0x2ba2ed,tdx:_0x1d6620}=_0x20957a,_0x12ff84=_0x2ba2ed[0x0],_0x5ae353=_0x1adc31,_0x3bc982={};if(_0x5ae353[_0x4f0149(0x110)])_0x3bc982[_0x4f0149(0x110)]=_0x5ae353[_0x4f0149(0x110)];if(_0x5ae353['type'])_0x3bc982[_0x4f0149(0x103)]=_0x5ae353[_0x4f0149(0x103)];if(_0x5ae353[_0x4f0149(0x86)])_0x3bc982[_0x4f0149(0x86)]=_0x5ae353[_0x4f0149(0x86)];if(_0x5ae353[_0x4f0149(0xba)])_0x3bc982[_0x4f0149(0xba)]=_0x5ae353[_0x4f0149(0xba)];if(_0x5ae353[_0x4f0149(0xa1)]!==undefined)_0x3bc982[_0x4f0149(0xa1)]=Number(_0x5ae353[_0x4f0149(0xa1)]);if(_0x5ae353[_0x4f0149(0xf2)]!==undefined)_0x3bc982[_0x4f0149(0xf2)]=Number(_0x5ae353['priority']);if(_0x5ae353['retryLimit']!==undefined)_0x3bc982[_0x4f0149(0xdd)]=Number(_0x5ae353[_0x4f0149(0xb4)]);if(_0x5ae353[_0x4f0149(0xbf)])_0x3bc982[_0x4f0149(0xdc)]=_0x5ae353['engineVersion'];if(_0x5ae353['result'])_0x3bc982[_0x4f0149(0xe7)]=_0x5ae353[_0x4f0149(0xe7)];if(_0x5ae353[_0x4f0149(0x8d)])try{_0x3bc982[_0x4f0149(0xc9)]=readFileSync(_0x5ae353['file'],_0x4f0149(0xb7))[_0x4f0149(0xa5)]();}catch(_0x15dfe2){throw new SDKError(ErrorCode[_0x4f0149(0xda)],'Failed\x20to\x20read\x20file:\x20'+_0x5ae353['file'],_0x15dfe2 instanceof Error?_0x15dfe2:undefined);}if(Object[_0x4f0149(0xc7)](_0x3bc982)[_0x4f0149(0x104)]===0x0)throw new SDKError(ErrorCode[_0x4f0149(0xda)],_0x4f0149(0xd5));if(_0x1adc31['verbose']){console[_0x4f0149(0x10e)]('Updating\x20schedule:\x20'+_0x12ff84);for(const [_0x5e4be8,_0x88d96]of Object[_0x4f0149(0x98)](_0x3bc982)){_0x5e4be8==='query'?console[_0x4f0149(0x10e)]('\x20\x20'+_0x5e4be8+':\x20'+_0x88d96['substring'](0x0,0x32)+_0x4f0149(0xad)):console['error']('\x20\x20'+_0x5e4be8+':\x20'+_0x88d96);}}const _0x6b5bec=await withSpinner(_0x4f0149(0xbe),()=>_0x1d6620[_0x4f0149(0x88)][_0x4f0149(0x9b)](_0x12ff84,_0x3bc982),{'verbose':_0x1adc31[_0x4f0149(0xe3)]});return console[_0x4f0149(0x10e)](_0x4f0149(0xbb)+_0x6b5bec[_0x4f0149(0xa8)]['name']),await handleSingleObjectOutput(_0x6b5bec[_0x4f0149(0xa8)],_0x1adc31),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x2fbda1(0x95)]=a26_0x2fbda1(0xe9);[a26_0x2fbda1(0xb6)]='Delete\x20a\x20scheduled\x20query';[a26_0x2fbda1(0x10a)](_0x4f629f){const _0x2f8933=a26_0x2fbda1,_0x1e7035=_0x4f629f[_0x2f8933(0xfa)][0x0];if(!_0x1e7035)return _0x2f8933(0xee);return undefined;}async[a26_0x2fbda1(0xb0)](_0x80b94){const _0x19b0bb=a26_0x2fbda1,{options:_0xc2eb4c,args:_0x30189e,tdx:_0x4b4603}=_0x80b94,_0x430031=_0x30189e[0x0];if(!_0xc2eb4c[_0x19b0bb(0x8b)]){const _0x2223d0=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x430031+'\x22?');if(!_0x2223d0)return console[_0x19b0bb(0x10e)](_0x19b0bb(0xf4)),0x0;}const _0xa2e0c1=await withSpinner(_0x19b0bb(0x9f),()=>_0x4b4603[_0x19b0bb(0x88)][_0x19b0bb(0x94)](_0x430031),{'verbose':_0xc2eb4c[_0x19b0bb(0xe3)]});return console[_0x19b0bb(0x10e)](_0x19b0bb(0xec)+_0xa2e0c1[_0x19b0bb(0xa8)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x2fbda1(0x95)]=a26_0x2fbda1(0xe6);[a26_0x2fbda1(0xb6)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0xedffd9){const _0x5bb294=a26_0x2fbda1,_0x3185e7=_0xedffd9['args'][0x0];if(!_0x3185e7)return _0x5bb294(0x8e);return undefined;}async[a26_0x2fbda1(0xb0)](_0xa1f9bd){const _0x1c4366=a26_0x2fbda1,{options:_0x219893,args:_0x2bdea7,tdx:_0x463ce}=_0xa1f9bd,_0x55d81c=_0x2bdea7[0x0],_0x249a2a=_0x219893,_0x51f25d=_0x249a2a[_0x1c4366(0xed)],_0x3d04a5=_0x249a2a[_0x1c4366(0x87)]!==undefined?Number(_0x249a2a[_0x1c4366(0x87)]):undefined;if(_0x219893['verbose']){console['error'](_0x1c4366(0xeb)+_0x55d81c);if(_0x51f25d)console[_0x1c4366(0x10e)](_0x1c4366(0xca)+_0x51f25d);if(_0x3d04a5)console[_0x1c4366(0x10e)](_0x1c4366(0x8c)+_0x3d04a5);}const _0x24cdf9=await withSpinner(_0x1c4366(0x112),()=>_0x463ce[_0x1c4366(0x88)][_0x1c4366(0xcd)](_0x55d81c,{'time':_0x51f25d,'num':_0x3d04a5}),{'verbose':_0x219893[_0x1c4366(0xe3)]}),_0x52c0a4=_0x24cdf9[_0x1c4366(0xa8)][_0x1c4366(0x90)];console[_0x1c4366(0x10e)](_0x1c4366(0xfd)+_0x52c0a4[_0x1c4366(0x104)]+_0x1c4366(0x10f)+(_0x52c0a4['length']!==0x1?'s':'')+_0x1c4366(0xb5));for(const _0x20519b of _0x52c0a4){console[_0x1c4366(0x10e)](_0x1c4366(0x100)+_0x20519b['job_id']);}return await handleSDKOutput(_0x52c0a4,_0x219893),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x2fbda1(0x95)]=a26_0x2fbda1(0xbc);[a26_0x2fbda1(0xb6)]=a26_0x2fbda1(0x101);[a26_0x2fbda1(0x10a)](_0x407be4){const _0x8a5a6c=a26_0x2fbda1,_0x32fec0=_0x407be4['args'][0x0];if(!_0x32fec0)return _0x8a5a6c(0xcc);return undefined;}async[a26_0x2fbda1(0xb0)](_0x4894d4){const _0x544685=a26_0x2fbda1,{options:_0x165443,args:_0x49cd81,tdx:_0x7b61f3}=_0x4894d4,_0x3060a0=_0x49cd81[0x0],_0x157566=_0x165443,_0x556d42=_0x157566['from']!==undefined?Number(_0x157566[_0x544685(0xa2)]):undefined,_0x131ada=_0x157566['to']!==undefined?Number(_0x157566['to']):undefined,_0x53921d=await withSpinner('Getting\x20schedule\x20history...',()=>_0x7b61f3['schedules'][_0x544685(0xac)](_0x3060a0,{'from':_0x556d42,'to':_0x131ada}),{'verbose':_0x165443[_0x544685(0xe3)]}),_0x5dc581=_0x53921d['data'];console[_0x544685(0x10e)](_0x544685(0xb3)+_0x5dc581[_0x544685(0xbd)]+_0x544685(0x92)+(_0x5dc581[_0x544685(0xbd)]!==0x1?'s':'')+_0x544685(0xa0)+_0x5dc581['from']+'-'+_0x5dc581['to']+')');const _0x2829be=_0x5dc581[_0x544685(0xac)][_0x544685(0xde)](_0x369d04=>({'job_id':_0x369d04['job_id'],'type':_0x369d04[_0x544685(0x103)],'status':_0x369d04[_0x544685(0xb8)],'scheduled_at':_0x369d04[_0x544685(0x9d)],'created_at':_0x369d04[_0x544685(0xd7)],'start_at':_0x369d04[_0x544685(0x89)],'end_at':_0x369d04[_0x544685(0xdb)]}));return await handleSDKOutput(_0x2829be,_0x165443),0x0;}}
|
|
1
|
+
const a26_0x56e2fc=a26_0x14bc;(function(_0x2279ea,_0x39e377){const _0x6fc285=a26_0x14bc,_0x447029=_0x2279ea();while(!![]){try{const _0x15f955=parseInt(_0x6fc285(0x14f))/0x1+parseInt(_0x6fc285(0x12b))/0x2*(-parseInt(_0x6fc285(0x15a))/0x3)+-parseInt(_0x6fc285(0x109))/0x4*(parseInt(_0x6fc285(0x14a))/0x5)+-parseInt(_0x6fc285(0xf8))/0x6*(parseInt(_0x6fc285(0x106))/0x7)+parseInt(_0x6fc285(0x158))/0x8*(-parseInt(_0x6fc285(0x153))/0x9)+parseInt(_0x6fc285(0x148))/0xa*(-parseInt(_0x6fc285(0x139))/0xb)+parseInt(_0x6fc285(0x16e))/0xc;if(_0x15f955===_0x39e377)break;else _0x447029['push'](_0x447029['shift']());}catch(_0x1f75c8){_0x447029['push'](_0x447029['shift']());}}}(a26_0x178b,0x2e940));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x3b1aa4 from'chalk';function a26_0x14bc(_0x20fc9b,_0x4d73e4){_0x20fc9b=_0x20fc9b-0xe3;const _0x178b15=a26_0x178b();let _0x14bc9d=_0x178b15[_0x20fc9b];return _0x14bc9d;}function formatRelativeTime(_0x38911d){const _0x278537=a26_0x14bc,_0x585399=new Date(_0x38911d),_0x3f28f8=new Date(),_0x275f85=_0x585399[_0x278537(0x164)]()-_0x3f28f8['getTime'](),_0x2fdc29=Math[_0x278537(0x10f)](_0x275f85)/0x3e8,_0xf850f=_0x275f85<0x0;if(_0x2fdc29<0x3c)return _0xf850f?'just\x20now':'soon';else{if(_0x2fdc29<0xe10){const _0x218b5f=Math[_0x278537(0x133)](_0x2fdc29/0x3c);return _0xf850f?_0x218b5f+_0x278537(0x104):_0x278537(0x10b)+_0x218b5f+'m';}else{if(_0x2fdc29<0x15180){const _0xd098cd=Math[_0x278537(0x133)](_0x2fdc29/0xe10);return _0xf850f?_0xd098cd+_0x278537(0x11b):'in\x20'+_0xd098cd+'h';}else{if(_0x2fdc29<0x93a80){const _0x4991bc=Math['round'](_0x2fdc29/0x15180);return _0xf850f?_0x4991bc+_0x278537(0x162):_0x278537(0x10b)+_0x4991bc+'d';}else return _0x585399['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]=a26_0x56e2fc(0x118);[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0x14b);async[a26_0x56e2fc(0x101)](_0x112bbe){const _0x656b54=a26_0x56e2fc,{options:_0x2b02a8,args:_0x2f5796,tdx:_0x573531}=_0x112bbe,_0x5431dd=resolveLimit(_0x2b02a8[_0x656b54(0x10e)],DEFAULT_DISPLAY_LIMIT),_0x482db8=_0x2f5796[0x0],_0x3e126d=_0x482db8?_0x656b54(0x12d)+_0x482db8+_0x656b54(0x159):_0x656b54(0x122),_0x26ebe4=await withSpinner(_0x3e126d,()=>_0x573531[_0x656b54(0xff)][_0x656b54(0xfd)]({'limit':_0x5431dd,'scheduled':!![],'pattern':_0x482db8}),{'verbose':_0x2b02a8[_0x656b54(0x12e)]}),_0x40fe75=_0x26ebe4['data'][_0x656b54(0x13d)],_0x447cec=_0x26ebe4[_0x656b54(0xee)]['pagination']['has_next_page'],_0x45ae61=_0x482db8?_0x656b54(0xe8)+_0x482db8+'\x22':'';_0x447cec?console['error']('Showing\x20first\x20'+_0x40fe75['length']+_0x656b54(0xf5)+_0x45ae61+_0x656b54(0x165)):console[_0x656b54(0x141)](_0x656b54(0xeb)+_0x40fe75[_0x656b54(0xec)]+_0x656b54(0x137)+(_0x40fe75[_0x656b54(0xec)]!==0x1?'ies':'y')+_0x45ae61);if(_0x2b02a8[_0x656b54(0x124)]===_0x656b54(0x155)||_0x2b02a8[_0x656b54(0x124)]===_0x656b54(0x10a)||_0x2b02a8[_0x656b54(0x124)]===_0x656b54(0x166)||_0x2b02a8['format']===_0x656b54(0x157)){const _0x14334d=_0x40fe75[_0x656b54(0x11e)](_0x4b00b3=>({'id':_0x4b00b3['id'],'name':_0x4b00b3[_0x656b54(0x12a)],'cron':_0x4b00b3[_0x656b54(0x127)],'database':_0x4b00b3[_0x656b54(0x121)]?.[_0x656b54(0x12a)],'type':_0x4b00b3[_0x656b54(0x167)],'timezone':_0x4b00b3[_0x656b54(0x15e)],'user_name':_0x4b00b3[_0x656b54(0xea)]?.[_0x656b54(0x12a)],'updated_at':_0x4b00b3[_0x656b54(0x172)],'next_run_at':_0x4b00b3[_0x656b54(0x120)],'last_job_status':_0x4b00b3['last_job']?.[_0x656b54(0xe4)]}));await handleSDKOutput(_0x14334d,_0x2b02a8);}else{if(_0x40fe75['length']===0x0)console[_0x656b54(0x146)]('No\x20scheduled\x20queries\x20found');else{const _0x5038b6=_0x2b02a8[_0x656b54(0x115)],_0x1daf9b=_0x40fe75[_0x656b54(0x11e)](_0x4f2847=>{const _0x1bb3ce=_0x656b54,_0xf678c4=_0x4f2847[_0x1bb3ce(0x170)]?.[_0x1bb3ce(0xe4)]?_0x4f2847[_0x1bb3ce(0x170)][_0x1bb3ce(0xe4)]==='success'?'β':'β':'-',_0x564b6f=_0x4f2847['last_job']?.[_0x1bb3ce(0xfb)]?formatRelativeTime(_0x4f2847[_0x1bb3ce(0x170)][_0x1bb3ce(0xfb)]):_0x1bb3ce(0x15f),_0x21c294=_0x4f2847[_0x1bb3ce(0x120)]?formatRelativeTime(_0x4f2847[_0x1bb3ce(0x120)]):'-',_0x59bc4f=_0x4f2847[_0x1bb3ce(0x127)]||'',_0x39afdf=_0x4f2847[_0x1bb3ce(0x12a)]||_0x1bb3ce(0x11f),_0x11106f=getConsoleUrl(_0x5038b6,_0x1bb3ce(0x143)+_0x4f2847['id']);return{'statusIcon':_0xf678c4,'lastRun':_0x564b6f,'nextRun':_0x21c294,'cron':_0x59bc4f,'name':_0x39afdf,'queryUrl':_0x11106f,'status':_0x4f2847[_0x1bb3ce(0x170)]?.[_0x1bb3ce(0xe4)]};}),_0x64652c=Math[_0x656b54(0xfa)](..._0x1daf9b[_0x656b54(0x11e)](_0x3c07eb=>_0x3c07eb[_0x656b54(0x112)][_0x656b54(0xec)])),_0x3eb812=Math[_0x656b54(0xfa)](..._0x1daf9b[_0x656b54(0x11e)](_0x1f9e96=>_0x1f9e96[_0x656b54(0x111)][_0x656b54(0xec)])),_0x31dcfe=Math[_0x656b54(0xfa)](..._0x1daf9b[_0x656b54(0x11e)](_0xa770f8=>_0xa770f8[_0x656b54(0x127)][_0x656b54(0xec)])),_0x1261e3=_0x1daf9b['map'](_0x2e96ac=>{const _0x2e4683=_0x656b54,_0x4bd5e8=_0x2e96ac['status']===_0x2e4683(0x16f)?a26_0x3b1aa4[_0x2e4683(0x10d)](_0x2e96ac[_0x2e4683(0xe5)]):_0x2e96ac[_0x2e4683(0xe4)]===_0x2e4683(0x141)?a26_0x3b1aa4[_0x2e4683(0x142)](_0x2e96ac[_0x2e4683(0xe5)]):a26_0x3b1aa4[_0x2e4683(0x126)](_0x2e96ac[_0x2e4683(0xe5)]),_0x5a607e=_0x2e96ac[_0x2e4683(0x112)][_0x2e4683(0x131)](_0x64652c),_0x3f464e=_0x2e96ac['nextRun']['padEnd'](_0x3eb812),_0x5563e2=_0x2e96ac[_0x2e4683(0x127)]?a26_0x3b1aa4['cyan'](_0x2e96ac[_0x2e4683(0x127)][_0x2e4683(0x131)](_0x31dcfe)):'\x20'[_0x2e4683(0xe9)](_0x31dcfe),_0x1e08ab=hyperlink(_0x2e96ac[_0x2e4683(0x12a)],_0x2e96ac[_0x2e4683(0x163)]);return _0x2e4683(0x11a)+_0x4bd5e8+'\x20'+_0x5a607e+'\x20\x20β\x20'+_0x3f464e+'\x20\x20'+_0x5563e2+'\x20\x20'+_0x1e08ab;});await writeOutput(_0x1261e3['join']('\x0a'),_0x2b02a8[_0x656b54(0x107)],_0x656b54(0x15d));}}return 0x0;}}function a26_0x178b(){const _0x59f399=['\x20schedules','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','utf-8','3714HZTFQw','Update\x20a\x20scheduled\x20query','max','ended_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','listQueries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedules','...','execute','schedule:show','\x20\x20Time:\x20','m\x20ago','Failed\x20to\x20read\x20file:\x20','3682ueqqLo','output','file','4VXChOt','jsonl','in\x20','delete','green','limit','abs','Create\x20a\x20scheduled\x20query','nextRun','lastRun','trino','timezone','site','entries','args','schedule:list','schedule:history','π
\x20','h\x20ago','engineVersion','description','map','(unnamed)','next_run_at','database','Listing\x20scheduled\x20queries...','delay','format','Updating\x20schedule...','dim','cron','result','trim','name','58606KrwPdy','priority','Searching\x20scheduled\x20queries\x20matching\x20\x22','verbose','schedule:create','Delete\x20a\x20scheduled\x20query','padEnd','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','round','Schedule\x20run\x20submitted:\x20','job_id','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20scheduled\x20quer','end_at','11ueaBQP','retry_limit','Getting\x20schedule\x20history...','engine_version','queries','\x20execution','Running\x20schedule:\x20','count','error','red','/app/queries/editor?queryId=','Creating\x20schedule...','Show\x20schedule\x20details','log','retryLimit','2424010UgTIlu','\x20\x20Num:\x20','269975tgtRzF','List\x20scheduled\x20queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Getting\x20schedule\x20details...','history','290355VgKsSO','jobs','scheduled_at','schedule:delete','9mbbqxd','Updating\x20schedule:\x20','json','\x20created','tsv','2405472uuwxbE','\x22...','30XNiWhw','start_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','list','time_zone','never','from','INVALID_ARGUMENT','d\x20ago','queryUrl','getTime','\x20(use\x20--limit\x20to\x20see\x20more)','table','type','Schedule\x20created:\x20','update','executing_user_id','yes','num','Run\x20a\x20scheduled\x20query\x20immediately','13393596oazJKn','success','last_job','\x20job','updated_at','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','created_at','status','statusIcon','validate','\x20\x20Cron:\x20','\x20matching\x20\x22','repeat','user','Found\x20','length','query','data','\x20\x20Database:\x20','\x20(showing\x20','Cancelled','Schedule\x20deleted:\x20','Schedule\x20updated:\x20','keys'];a26_0x178b=function(){return _0x59f399;};return a26_0x178b();}export class ScheduleShowCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]=a26_0x56e2fc(0x102);[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0x145);[a26_0x56e2fc(0xe6)](_0x32680e){const _0x4e28c2=a26_0x56e2fc,_0x3fad06=_0x32680e['args'][0x0];if(!_0x3fad06)return _0x4e28c2(0xf6);return undefined;}async[a26_0x56e2fc(0x101)](_0x451658){const _0x5656de=a26_0x56e2fc,{options:_0x3b2468,args:_0x3253c5,tdx:_0x3e1809}=_0x451658,_0x349845=_0x3253c5[0x0],_0x893d5e=await withSpinner(_0x5656de(0x14d),()=>_0x3e1809[_0x5656de(0xff)]['show'](_0x349845),{'verbose':_0x3b2468[_0x5656de(0x12e)]}),_0x56472e=_0x893d5e[_0x5656de(0xee)],_0x5a651b={'name':_0x56472e['name'],'cron':_0x56472e[_0x5656de(0x127)],'database':_0x56472e[_0x5656de(0x121)],'type':_0x56472e[_0x5656de(0x167)],'timezone':_0x56472e[_0x5656de(0x114)],'user_name':_0x56472e['user_name'],'created_at':_0x56472e[_0x5656de(0xe3)],'engine_version':_0x56472e['engine_version'],'executing_user_id':_0x56472e[_0x5656de(0x16a)],'query':_0x56472e['query'],'delay':_0x56472e[_0x5656de(0x123)],'priority':_0x56472e[_0x5656de(0x12c)],'retry_limit':_0x56472e['retry_limit'],..._0x56472e[_0x5656de(0x128)]&&{'result':_0x56472e[_0x5656de(0x128)]}};return await handleSingleObjectOutput(_0x5a651b,_0x3b2468),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x56e2fc(0x12f);[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0x110);[a26_0x56e2fc(0xe6)](_0x7d115c){const _0x68444a=a26_0x56e2fc,_0x507217=_0x7d115c[_0x68444a(0x117)][0x0];if(!_0x507217)return _0x68444a(0x132);return undefined;}async[a26_0x56e2fc(0x101)](_0x1cca9c){const _0x26ecb3=a26_0x56e2fc,{options:_0x3ffb54,args:_0x55a3a7,tdx:_0x5eb7dd}=_0x1cca9c,_0x2adebd=_0x55a3a7[0x0],_0x4b3161=_0x3ffb54,_0x124ed7=_0x4b3161['database'],_0x28f339=_0x4b3161[_0x26ecb3(0x108)],_0x24e933=_0x4b3161['type']||_0x26ecb3(0x113);let _0x1870cf;try{_0x1870cf=readFileSync(_0x28f339,_0x26ecb3(0xf7))[_0x26ecb3(0x129)]();}catch(_0x28a2bd){throw new SDKError(ErrorCode[_0x26ecb3(0x161)],_0x26ecb3(0x105)+_0x28f339,_0x28a2bd instanceof Error?_0x28a2bd:undefined);}if(!_0x1870cf)throw new SDKError(ErrorCode[_0x26ecb3(0x161)],'Query\x20file\x20is\x20empty');const _0x1c81fe={'database':_0x124ed7,'query':_0x1870cf,'type':_0x24e933};if(_0x4b3161['cron'])_0x1c81fe[_0x26ecb3(0x127)]=_0x4b3161[_0x26ecb3(0x127)];if(_0x4b3161[_0x26ecb3(0x114)])_0x1c81fe[_0x26ecb3(0x114)]=_0x4b3161['timezone'];if(_0x4b3161[_0x26ecb3(0x123)]!==undefined)_0x1c81fe[_0x26ecb3(0x123)]=Number(_0x4b3161[_0x26ecb3(0x123)]);if(_0x4b3161['priority']!==undefined)_0x1c81fe[_0x26ecb3(0x12c)]=Number(_0x4b3161[_0x26ecb3(0x12c)]);if(_0x4b3161[_0x26ecb3(0x147)]!==undefined)_0x1c81fe[_0x26ecb3(0x13a)]=Number(_0x4b3161['retryLimit']);if(_0x4b3161[_0x26ecb3(0x11c)])_0x1c81fe[_0x26ecb3(0x13c)]=_0x4b3161['engineVersion'];if(_0x4b3161['result'])_0x1c81fe['result']=_0x4b3161['result'];if(_0x3ffb54[_0x26ecb3(0x12e)]){console[_0x26ecb3(0x141)]('Creating\x20schedule:\x20'+_0x2adebd),console[_0x26ecb3(0x141)](_0x26ecb3(0xef)+_0x124ed7),console['error']('\x20\x20Type:\x20'+_0x24e933);if(_0x1c81fe[_0x26ecb3(0x127)])console['error'](_0x26ecb3(0xe7)+_0x1c81fe[_0x26ecb3(0x127)]);if(_0x1c81fe[_0x26ecb3(0x114)])console[_0x26ecb3(0x141)]('\x20\x20Timezone:\x20'+_0x1c81fe[_0x26ecb3(0x114)]);}const _0x46e461=await withSpinner(_0x26ecb3(0x144),()=>_0x5eb7dd[_0x26ecb3(0xff)]['create'](_0x2adebd,_0x1c81fe),{'verbose':_0x3ffb54[_0x26ecb3(0x12e)]});return console[_0x26ecb3(0x141)](_0x26ecb3(0x168)+_0x46e461[_0x26ecb3(0xee)][_0x26ecb3(0x12a)]),await handleSingleObjectOutput(_0x46e461[_0x26ecb3(0xee)],_0x3ffb54),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]='schedule:update';[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0xf9);[a26_0x56e2fc(0xe6)](_0x1a6cd1){const _0x2bfd66=a26_0x56e2fc,_0x5fff02=_0x1a6cd1[_0x2bfd66(0x117)][0x0];if(!_0x5fff02)return _0x2bfd66(0x15c);return undefined;}async['execute'](_0x15e748){const _0x166806=a26_0x56e2fc,{options:_0x2059b6,args:_0x3212e0,tdx:_0x21e904}=_0x15e748,_0x4b5c5e=_0x3212e0[0x0],_0xfbbfb5=_0x2059b6,_0x1b7acb={};if(_0xfbbfb5[_0x166806(0x121)])_0x1b7acb[_0x166806(0x121)]=_0xfbbfb5[_0x166806(0x121)];if(_0xfbbfb5[_0x166806(0x167)])_0x1b7acb[_0x166806(0x167)]=_0xfbbfb5[_0x166806(0x167)];if(_0xfbbfb5[_0x166806(0x127)])_0x1b7acb[_0x166806(0x127)]=_0xfbbfb5[_0x166806(0x127)];if(_0xfbbfb5[_0x166806(0x114)])_0x1b7acb['timezone']=_0xfbbfb5[_0x166806(0x114)];if(_0xfbbfb5[_0x166806(0x123)]!==undefined)_0x1b7acb['delay']=Number(_0xfbbfb5[_0x166806(0x123)]);if(_0xfbbfb5[_0x166806(0x12c)]!==undefined)_0x1b7acb[_0x166806(0x12c)]=Number(_0xfbbfb5[_0x166806(0x12c)]);if(_0xfbbfb5[_0x166806(0x147)]!==undefined)_0x1b7acb['retry_limit']=Number(_0xfbbfb5[_0x166806(0x147)]);if(_0xfbbfb5[_0x166806(0x11c)])_0x1b7acb[_0x166806(0x13c)]=_0xfbbfb5[_0x166806(0x11c)];if(_0xfbbfb5['result'])_0x1b7acb[_0x166806(0x128)]=_0xfbbfb5['result'];if(_0xfbbfb5[_0x166806(0x108)])try{_0x1b7acb['query']=readFileSync(_0xfbbfb5[_0x166806(0x108)],'utf-8')[_0x166806(0x129)]();}catch(_0x5d4758){throw new SDKError(ErrorCode[_0x166806(0x161)],_0x166806(0x105)+_0xfbbfb5[_0x166806(0x108)],_0x5d4758 instanceof Error?_0x5d4758:undefined);}if(Object[_0x166806(0xf4)](_0x1b7acb)['length']===0x0)throw new SDKError(ErrorCode[_0x166806(0x161)],_0x166806(0x136));if(_0x2059b6[_0x166806(0x12e)]){console['error'](_0x166806(0x154)+_0x4b5c5e);for(const [_0x3d0cb4,_0x3dd067]of Object[_0x166806(0x116)](_0x1b7acb)){_0x3d0cb4===_0x166806(0xed)?console[_0x166806(0x141)]('\x20\x20'+_0x3d0cb4+':\x20'+_0x3dd067['substring'](0x0,0x32)+_0x166806(0x100)):console[_0x166806(0x141)]('\x20\x20'+_0x3d0cb4+':\x20'+_0x3dd067);}}const _0x2b8198=await withSpinner(_0x166806(0x125),()=>_0x21e904[_0x166806(0xff)][_0x166806(0x169)](_0x4b5c5e,_0x1b7acb),{'verbose':_0x2059b6[_0x166806(0x12e)]});return console[_0x166806(0x141)](_0x166806(0xf3)+_0x2b8198[_0x166806(0xee)][_0x166806(0x12a)]),await handleSingleObjectOutput(_0x2b8198[_0x166806(0xee)],_0x2059b6),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]=a26_0x56e2fc(0x152);[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0x130);[a26_0x56e2fc(0xe6)](_0xfa2c32){const _0x8a452f=a26_0x56e2fc,_0x2b2793=_0xfa2c32[_0x8a452f(0x117)][0x0];if(!_0x2b2793)return _0x8a452f(0xfe);return undefined;}async[a26_0x56e2fc(0x101)](_0x350064){const _0x431b99=a26_0x56e2fc,{options:_0xc244c0,args:_0x52e2cd,tdx:_0x369582}=_0x350064,_0x1354e8=_0x52e2cd[0x0];if(!_0xc244c0[_0x431b99(0x16b)]){const _0x111298=await confirm(_0x431b99(0x173)+_0x1354e8+'\x22?');if(!_0x111298)return console[_0x431b99(0x141)](_0x431b99(0xf1)),0x0;}const _0x4a8617=await withSpinner('Deleting\x20schedule...',()=>_0x369582[_0x431b99(0xff)][_0x431b99(0x10c)](_0x1354e8),{'verbose':_0xc244c0[_0x431b99(0x12e)]});return console[_0x431b99(0x141)](_0x431b99(0xf2)+_0x4a8617[_0x431b99(0xee)][_0x431b99(0x12a)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]='schedule:run';[a26_0x56e2fc(0x11d)]=a26_0x56e2fc(0x16d);[a26_0x56e2fc(0xe6)](_0x29edf9){const _0x37bd54=a26_0x56e2fc,_0x3d99e6=_0x29edf9[_0x37bd54(0x117)][0x0];if(!_0x3d99e6)return _0x37bd54(0xfc);return undefined;}async[a26_0x56e2fc(0x101)](_0x4638cc){const _0x2c6b23=a26_0x56e2fc,{options:_0x52aba9,args:_0x30b4ae,tdx:_0xac0b91}=_0x4638cc,_0x2cd351=_0x30b4ae[0x0],_0x3aa397=_0x52aba9,_0x5ca7e0=_0x3aa397['time'],_0x19d3cb=_0x3aa397[_0x2c6b23(0x16c)]!==undefined?Number(_0x3aa397[_0x2c6b23(0x16c)]):undefined;if(_0x52aba9[_0x2c6b23(0x12e)]){console['error'](_0x2c6b23(0x13f)+_0x2cd351);if(_0x5ca7e0)console[_0x2c6b23(0x141)](_0x2c6b23(0x103)+_0x5ca7e0);if(_0x19d3cb)console[_0x2c6b23(0x141)](_0x2c6b23(0x149)+_0x19d3cb);}const _0x3a9df9=await withSpinner('Running\x20schedule...',()=>_0xac0b91[_0x2c6b23(0xff)]['run'](_0x2cd351,{'time':_0x5ca7e0,'num':_0x19d3cb}),{'verbose':_0x52aba9[_0x2c6b23(0x12e)]}),_0x54a517=_0x3a9df9[_0x2c6b23(0xee)][_0x2c6b23(0x150)];console[_0x2c6b23(0x141)](_0x2c6b23(0x134)+_0x54a517[_0x2c6b23(0xec)]+_0x2c6b23(0x171)+(_0x54a517[_0x2c6b23(0xec)]!==0x1?'s':'')+_0x2c6b23(0x156));for(const _0x5d8c60 of _0x54a517){console[_0x2c6b23(0x141)]('\x20\x20Job\x20ID:\x20'+_0x5d8c60[_0x2c6b23(0x135)]);}return await handleSDKOutput(_0x54a517,_0x52aba9),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x56e2fc(0x12a)]=a26_0x56e2fc(0x119);[a26_0x56e2fc(0x11d)]='Show\x20schedule\x20execution\x20history';['validate'](_0x24c0e8){const _0xdbaa6c=a26_0x56e2fc,_0x5a8a39=_0x24c0e8[_0xdbaa6c(0x117)][0x0];if(!_0x5a8a39)return _0xdbaa6c(0x14c);return undefined;}async[a26_0x56e2fc(0x101)](_0x3c8512){const _0x4de77f=a26_0x56e2fc,{options:_0x16691c,args:_0x22342b,tdx:_0x12226c}=_0x3c8512,_0x42cc30=_0x22342b[0x0],_0x119159=_0x16691c,_0xcee54a=_0x119159['from']!==undefined?Number(_0x119159[_0x4de77f(0x160)]):undefined,_0x22f2c1=_0x119159['to']!==undefined?Number(_0x119159['to']):undefined,_0x3eee62=await withSpinner(_0x4de77f(0x13b),()=>_0x12226c['schedules'][_0x4de77f(0x14e)](_0x42cc30,{'from':_0xcee54a,'to':_0x22f2c1}),{'verbose':_0x16691c[_0x4de77f(0x12e)]}),_0x396762=_0x3eee62[_0x4de77f(0xee)];console[_0x4de77f(0x141)](_0x4de77f(0xeb)+_0x396762[_0x4de77f(0x140)]+_0x4de77f(0x13e)+(_0x396762[_0x4de77f(0x140)]!==0x1?'s':'')+_0x4de77f(0xf0)+_0x396762[_0x4de77f(0x160)]+'-'+_0x396762['to']+')');const _0x1fb322=_0x396762[_0x4de77f(0x14e)][_0x4de77f(0x11e)](_0x55c17a=>({'job_id':_0x55c17a[_0x4de77f(0x135)],'type':_0x55c17a[_0x4de77f(0x167)],'status':_0x55c17a['status'],'scheduled_at':_0x55c17a[_0x4de77f(0x151)],'created_at':_0x55c17a[_0x4de77f(0xe3)],'start_at':_0x55c17a[_0x4de77f(0x15b)],'end_at':_0x55c17a[_0x4de77f(0x138)]}));return await handleSDKOutput(_0x1fb322,_0x16691c),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x2cf442=a27_0x2193;function a27_0x492d(){const _0x50aa89=['Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Folder\x20path:\x20','jsonl','Fetching\x20folder\x20details...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x27...','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x27\x20with\x20ID:\x20','stats','cyan','site','Use:\x20tdx\x20ps\x20view','Use:\x20tdx\x20ps\x20sql','Error:\x20','Site:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segment:describe','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Show\x20child\x20segment\x20schema\x20(column\x20types)','parentId','Use:\x20tdx\x20ps\x20desc','setJobId','Resolved\x20parent\x20folder\x20ID:\x20','information_schema','replace','Error:\x20Path\x20or\x20name\x20is\x20required','segmentPath','Resolving\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','segmentId','message','Options:','Get\x20SQL\x20query\x20for\x20child\x20segment','resolveFolderId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','cause','segment:folder:show','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','3370570ywaoWv','processedRows','Parent\x20name:\x20','segment','Creating\x20folder\x20\x27','/app/ps/','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folder\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20Opening\x20','parentSegment','in\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20segment:\x20','Fetching\x20segment\x20details...','jobId','117188OgJvIx','getSegmentSQL','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','url','parentFolder','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','data','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','28TUrkvx','17749860CfLVWq','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20folder','length','SELECT\x20*\x20FROM\x20(\x0a','3745611NyTBfj','resolveParentId','\x20\x20Cause:\x20','(root)','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','type','elapsedTimeMillis','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','execute','getFolder','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Resolved\x20parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Fetching\x20SQL\x20for\x20segment...','Folder\x20name:\x20','Segment\x20ID:\x20','folder','verbose','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','/e/','test','Examples:','Resolving\x20parent\x20segment\x20\x27','log','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Listing\x20folders\x20for\x20parent\x20\x27','Parent\x20ID:\x20','parent','\x20\x20Segment\x20name:\x20','folderPath','SEGMENT_NOT_FOUND','format','getParent','green','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','90Ngkyms','INVALID_ARGUMENT','includes','547211oFcvVC','Target\x20path:\x20','query','segment:folder:create','web','error','segment:sql','Resolved\x20folder\x20ID:\x20','resolvePathToResource','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segmentName','createFolder','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','45acVfYC','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','description','Resolved\x20type:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','fullPath','folderId','segment:folder:list','code','5283936kVdDzQ','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','getSegment','name','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:view','87183DbltcR','Resolving\x20folder\x20\x27','trim'];a27_0x492d=function(){return _0x50aa89;};return a27_0x492d();}(function(_0xf6f963,_0x2f7432){const _0x3d37e7=a27_0x2193,_0x7983df=_0xf6f963();while(!![]){try{const _0x2d671d=-parseInt(_0x3d37e7(0x225))/0x1*(-parseInt(_0x3d37e7(0x1d7))/0x2)+-parseInt(_0x3d37e7(0x212))/0x3*(parseInt(_0x3d37e7(0x1cc))/0x4)+parseInt(_0x3d37e7(0x1bc))/0x5+-parseInt(_0x3d37e7(0x202))/0x6*(parseInt(_0x3d37e7(0x205))/0x7)+-parseInt(_0x3d37e7(0x21c))/0x8+-parseInt(_0x3d37e7(0x1df))/0x9+parseInt(_0x3d37e7(0x1d8))/0xa;if(_0x2d671d===_0x2f7432)break;else _0x7983df['push'](_0x7983df['shift']());}catch(_0x3073f9){_0x7983df['push'](_0x7983df['shift']());}}}(a27_0x492d,0xef7cd));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';function a27_0x2193(_0xa7d59c,_0x33a0a6){_0xa7d59c=_0xa7d59c-0x199;const _0x492d45=a27_0x492d();let _0x2193ff=_0x492d45[_0xa7d59c];return _0x2193ff;}import a27_0x30fcaa from'chalk';async function resolveSegmentTarget(_0x3c277a,_0x504f22,_0x5b68b4){const _0x50b455=a27_0x2193;if(isYamlFilePath(_0x3c277a))try{const _0x52ef9c=await resolveYamlFilePath(_0x3c277a);return _0x5b68b4&&(console[_0x50b455(0x20a)]('Resolved\x20YAML\x20file:\x20'+_0x3c277a),console['error']('\x20\x20Parent\x20segment:\x20'+_0x52ef9c[_0x50b455(0x1c6)]),console['error'](_0x50b455(0x1fb)+_0x52ef9c[_0x50b455(0x20f)]),console[_0x50b455(0x20a)](_0x50b455(0x22a)+(_0x52ef9c[_0x50b455(0x1fc)]||_0x50b455(0x1e2))),console['error']('\x20\x20Full\x20path:\x20'+_0x52ef9c[_0x50b455(0x218)])),_0x52ef9c['fullPath'];}catch(_0x2b1467){throw new SDKError(ErrorCode[_0x50b455(0x203)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x2b1467[_0x50b455(0x1b3)]);}if(!_0x504f22)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x50b455(0x1d9));return _0x504f22+'/'+_0x3c277a;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x1a5);[a27_0x2cf442(0x215)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x2cf442(0x1e7)](_0x3ade74){const _0x2035ef=a27_0x2cf442,{options:_0x2a8216,args:_0xd8c579,tdx:_0x53aab7}=_0x3ade74,_0x1d0c63=_0xd8c579[0x0],_0x2e2c45=!_0x1d0c63&&!!_0x2a8216[_0x2035ef(0x1c6)],_0x5b3dc2=_0x1d0c63||_0x2a8216['parentSegment'];if(!_0x5b3dc2)return console[_0x2035ef(0x20a)](_0x2035ef(0x1ae)),console[_0x2035ef(0x20a)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2035ef(0x20a)]('Examples:'),console[_0x2035ef(0x20a)](_0x2035ef(0x217)),console[_0x2035ef(0x20a)](_0x2035ef(0x1c2)),console[_0x2035ef(0x20a)](_0x2035ef(0x1ce)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0xdcba5e=_0x2a8216[_0x2035ef(0x1af)];let _0x465c5d=_0x5b3dc2;!_0x2e2c45&&_0xdcba5e&&!_0x5b3dc2[_0x2035ef(0x204)]('/')&&(_0x465c5d=_0xdcba5e+'/'+_0x5b3dc2,_0x2a8216[_0x2035ef(0x1f0)]&&console['error'](_0x2035ef(0x1bb)+_0x465c5d));const _0x43193d=await withSpinner('Resolving\x20path\x20\x27'+_0x465c5d+_0x2035ef(0x19a),()=>_0x53aab7[_0x2035ef(0x1bf)][_0x2035ef(0x20d)](_0x465c5d),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]}),_0x20f407=_0x43193d[_0x2035ef(0x1d3)];_0x2a8216[_0x2035ef(0x1f0)]&&(console[_0x2035ef(0x20a)](_0x2035ef(0x216)+_0x20f407[_0x2035ef(0x1e4)]),console[_0x2035ef(0x20a)]('Parent\x20ID:\x20'+_0x20f407['parentId']),_0x20f407[_0x2035ef(0x219)]&&console[_0x2035ef(0x20a)]('Folder\x20ID:\x20'+_0x20f407[_0x2035ef(0x219)]),_0x20f407['segmentId']&&console[_0x2035ef(0x20a)](_0x2035ef(0x1ee)+_0x20f407[_0x2035ef(0x1b2)]));if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1fa)){const _0x1df541=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x53aab7[_0x2035ef(0x1bf)][_0x2035ef(0x1ff)](_0x20f407[_0x2035ef(0x1a8)]),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]});await handleSingleObjectOutput(_0x1df541[_0x2035ef(0x1d3)],_0x2a8216);}else{if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1ef)){if(!_0x20f407[_0x2035ef(0x219)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2035ef(0x1c4));const _0x9529de=await withSpinner(_0x2035ef(0x22c),()=>_0x53aab7[_0x2035ef(0x1bf)]['getFolder'](_0x20f407['folderId']),{'verbose':_0x2a8216['verbose']});await handleSingleObjectOutput(_0x9529de[_0x2035ef(0x1d3)],_0x2a8216);}else{if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1bf)){if(!_0x20f407[_0x2035ef(0x1b2)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x133991=await withSpinner('Fetching\x20segment\x20details...',()=>_0x53aab7['segment'][_0x2035ef(0x21e)](_0x20f407[_0x2035ef(0x1a8)],_0x20f407[_0x2035ef(0x1b2)]),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]});await handleSingleObjectOutput(_0x133991[_0x2035ef(0x1d3)],_0x2a8216);}}}return 0x0;}catch(_0x161c80){if(_0x161c80 instanceof SDKError)return console[_0x2035ef(0x20a)](_0x2035ef(0x1a2)+_0x161c80[_0x2035ef(0x1b3)]),_0x161c80[_0x2035ef(0x1b8)]&&console[_0x2035ef(0x20a)](_0x2035ef(0x1e1)+_0x161c80[_0x2035ef(0x1b8)]),0x1;throw _0x161c80;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';['description']=a27_0x2cf442(0x1e6);async[a27_0x2cf442(0x1e7)](_0x4984f1){const _0x30bac0=a27_0x2cf442,{options:_0x50a7a0,args:_0x195c85,tdx:_0x5117f4}=_0x4984f1,_0x56f942=_0x195c85[0x0];if(!_0x56f942)return console[_0x30bac0(0x20a)](_0x30bac0(0x199)),console[_0x30bac0(0x20a)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x30bac0(0x1d5)),console[_0x30bac0(0x20a)](_0x30bac0(0x1f4)),console[_0x30bac0(0x20a)](_0x30bac0(0x1a6)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x57e325=_0x50a7a0[_0x30bac0(0x1c6)],_0x1b91ce=await resolveSegmentTarget(_0x56f942,_0x57e325,_0x50a7a0[_0x30bac0(0x1f0)]);_0x50a7a0[_0x30bac0(0x1f0)]&&console[_0x30bac0(0x20a)](_0x30bac0(0x206)+_0x1b91ce);const _0x3ec6fa=await withSpinner(_0x30bac0(0x1b0)+_0x56f942+'\x27...',()=>_0x5117f4[_0x30bac0(0x1bf)][_0x30bac0(0x20d)](_0x1b91ce),{'verbose':_0x50a7a0['verbose']}),_0x15e949=_0x3ec6fa[_0x30bac0(0x1d3)];_0x50a7a0[_0x30bac0(0x1f0)]&&(console['error']('Resolved\x20type:\x20'+_0x15e949[_0x30bac0(0x1e4)]),console[_0x30bac0(0x20a)](_0x30bac0(0x1f9)+_0x15e949[_0x30bac0(0x1a8)]));if(_0x15e949[_0x30bac0(0x1e4)]===_0x30bac0(0x1ef))return console[_0x30bac0(0x20a)](_0x30bac0(0x220)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x15e949[_0x30bac0(0x1e4)]===_0x30bac0(0x1fa))return console[_0x30bac0(0x20a)](_0x30bac0(0x213)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x15e949[_0x30bac0(0x1b2)])throw new SDKError(ErrorCode[_0x30bac0(0x1fd)],_0x30bac0(0x228));const _0x349040=await withSpinner(_0x30bac0(0x1ec),()=>_0x5117f4[_0x30bac0(0x1bf)]['getSegmentSQL'](_0x15e949[_0x30bac0(0x1a8)],_0x15e949[_0x30bac0(0x1b2)]),{'verbose':_0x50a7a0[_0x30bac0(0x1f0)]});let _0x5474ef=_0x349040['data'];const _0x486236=resolveLimit(_0x50a7a0['limit'],DEFAULT_DISPLAY_LIMIT),_0x6acec9=/\bLIMIT\s+\d+/i[_0x30bac0(0x1f3)](_0x5474ef);!_0x6acec9&&(_0x5474ef=_0x5474ef[_0x30bac0(0x227)]()[_0x30bac0(0x1ad)](/;+$/,''),_0x5474ef=_0x30bac0(0x1de)+_0x5474ef+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x486236);_0x50a7a0[_0x30bac0(0x1f0)]&&console[_0x30bac0(0x20a)]('SQL\x20query:\x0a'+_0x5474ef);const _0x2d4879=await withProgressSpinner(_0x30bac0(0x1d1),async _0x177164=>{const _0x214cb2=_0x30bac0,_0x4ea282=await _0x5117f4[_0x214cb2(0x207)][_0x214cb2(0x1e7)](_0x5474ef,{'catalog':'td','schema':_0x214cb2(0x1ac),'onJobId':_0x3416d0=>{const _0x41570d=_0x214cb2;_0x177164[_0x41570d(0x1aa)](_0x3416d0);}});return _0x4ea282;},{'verbose':_0x50a7a0[_0x30bac0(0x1f0)]}),_0xa7ca99=_0x2d4879[_0x30bac0(0x1d3)],_0x4c9943=_0xa7ca99['jobId']?'\x20[Job\x20ID:\x20'+_0xa7ca99[_0x30bac0(0x1cb)]+']':'';return console[_0x30bac0(0x20a)]('β\x20Query\x20completed:\x20Processed\x20'+_0xa7ca99[_0x30bac0(0x19d)][_0x30bac0(0x1bd)]['toLocaleString']()+'\x20rows\x20'+(_0x30bac0(0x1c7)+formatElapsed(_0xa7ca99[_0x30bac0(0x19d)][_0x30bac0(0x1e5)])+_0x4c9943)),await handleQueryOutput(_0xa7ca99,_0x50a7a0),0x0;}catch(_0x5d10e8){if(_0x5d10e8 instanceof SDKError)return console[_0x30bac0(0x20a)]('β\x20Query\x20failed\x20['+_0x5d10e8[_0x30bac0(0x21b)]+']'),console['error']('\x0a'+_0x5d10e8[_0x30bac0(0x1b3)]),0x1;throw _0x5d10e8;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x21a);['description']=a27_0x2cf442(0x1d6);async['execute'](_0x4dcc19){const _0x21bc53=a27_0x2cf442,{options:_0x443fe7,args:_0x1477e6,tdx:_0x148a41}=_0x4dcc19;if(_0x1477e6[_0x21bc53(0x1dd)]===0x0)return console[_0x21bc53(0x20a)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x21bc53(0x20a)](_0x21bc53(0x1f7)),0x1;const _0x5e7bf5=_0x1477e6[0x0];try{_0x443fe7['verbose']&&(console[_0x21bc53(0x20a)](_0x21bc53(0x1a3)+_0x443fe7[_0x21bc53(0x19f)]),console[_0x21bc53(0x20a)](_0x21bc53(0x1be)+_0x5e7bf5));const _0xec29da=await withSpinner(_0x21bc53(0x1f5)+_0x5e7bf5+_0x21bc53(0x19a),()=>_0x148a41[_0x21bc53(0x1bf)][_0x21bc53(0x1e0)](_0x5e7bf5),{'verbose':_0x443fe7[_0x21bc53(0x1f0)]}),_0x8a14cd=_0xec29da[_0x21bc53(0x1d3)];_0x443fe7[_0x21bc53(0x1f0)]&&console[_0x21bc53(0x20a)](_0x21bc53(0x1ea)+_0x8a14cd);const _0x3cc730=await withSpinner(_0x21bc53(0x1f8)+_0x5e7bf5+_0x21bc53(0x19a),()=>_0x148a41[_0x21bc53(0x1bf)]['listFolders'](_0x8a14cd),{'verbose':_0x443fe7[_0x21bc53(0x1f0)]}),_0x14b650=_0x3cc730[_0x21bc53(0x1d3)];return console[_0x21bc53(0x20a)]('β\x20Found\x20'+_0x14b650[_0x21bc53(0x1dd)]+_0x21bc53(0x1dc)+(_0x14b650[_0x21bc53(0x1dd)]!==0x1?'s':'')),await handleSDKOutput(_0x14b650,_0x443fe7),0x0;}catch(_0xc59a9e){if(_0xc59a9e instanceof SDKError)return console['error']('Error:\x20'+_0xc59a9e[_0x21bc53(0x1b3)]),_0xc59a9e[_0x21bc53(0x1b8)]&&console[_0x21bc53(0x20a)](_0x21bc53(0x1e1)+_0xc59a9e['cause']),0x1;throw _0xc59a9e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x1b9);[a27_0x2cf442(0x215)]='Show\x20segment\x20folder\x20details';async['execute'](_0x38a734){const _0x24f375=a27_0x2cf442,{options:_0x10e0d5,args:_0x4beef8,tdx:_0x4f52e2}=_0x38a734;if(_0x4beef8[_0x24f375(0x1dd)]===0x0)return console[_0x24f375(0x20a)](_0x24f375(0x1ba)),console[_0x24f375(0x20a)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x1c46fa,childId:_0x45c91d}=parseSegmentRef(_0x4beef8[0x0]);_0x10e0d5[_0x24f375(0x1f0)]&&(console[_0x24f375(0x20a)](_0x24f375(0x1a3)+_0x10e0d5[_0x24f375(0x19f)]),console[_0x24f375(0x20a)](_0x24f375(0x1be)+_0x1c46fa),_0x45c91d&&console['error'](_0x24f375(0x1ed)+_0x45c91d));if(!_0x45c91d)return console[_0x24f375(0x20a)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x1ba4d7=await withSpinner(_0x24f375(0x1f5)+_0x1c46fa+'\x27...',()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1e0)](_0x1c46fa),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]}),_0x37ceb5=_0x1ba4d7[_0x24f375(0x1d3)];_0x10e0d5[_0x24f375(0x1f0)]&&console[_0x24f375(0x20a)](_0x24f375(0x1ea)+_0x37ceb5);const _0x5f4583=await withSpinner(_0x24f375(0x226)+_0x45c91d+_0x24f375(0x19a),()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1b6)](_0x37ceb5,_0x45c91d),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]}),_0x3227d8=_0x5f4583['data'];_0x10e0d5[_0x24f375(0x1f0)]&&console[_0x24f375(0x20a)](_0x24f375(0x20c)+_0x3227d8);const _0x1b8ce9=await withSpinner('Fetching\x20folder\x20\x27'+_0x45c91d+_0x24f375(0x19a),()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1e8)](_0x3227d8),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]});return await handleSDKOutput([_0x1b8ce9[_0x24f375(0x1d3)]],_0x10e0d5),0x0;}catch(_0x28a474){if(_0x28a474 instanceof SDKError)return console[_0x24f375(0x20a)]('Error:\x20'+_0x28a474['message']),_0x28a474[_0x24f375(0x1b8)]&&console[_0x24f375(0x20a)](_0x24f375(0x1e1)+_0x28a474['cause']),0x1;throw _0x28a474;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x20b);['description']=a27_0x2cf442(0x1b5);async[a27_0x2cf442(0x1e7)](_0x1324cc){const _0x1d892a=a27_0x2cf442,{options:_0x3df32e,args:_0xd228ae,tdx:_0x14d856}=_0x1324cc,_0x500699=_0xd228ae[0x0];if(!_0x500699)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1d892a(0x20a)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x1d892a(0x20a)](_0x1d892a(0x1eb)),console[_0x1d892a(0x20a)](_0x1d892a(0x1f4)),console[_0x1d892a(0x20a)](_0x1d892a(0x19b)),console[_0x1d892a(0x20a)](_0x1d892a(0x21d)),0x1;try{const _0x39d115=_0x3df32e[_0x1d892a(0x1c6)],_0x40e3fb=await resolveSegmentTarget(_0x500699,_0x39d115,_0x3df32e['verbose']);_0x3df32e[_0x1d892a(0x1f0)]&&console[_0x1d892a(0x20a)]('Target\x20path:\x20'+_0x40e3fb);const _0x2c4c12=await withSpinner('Resolving\x20\x27'+_0x500699+_0x1d892a(0x19a),()=>_0x14d856[_0x1d892a(0x1bf)]['resolvePathToResource'](_0x40e3fb),{'verbose':_0x3df32e[_0x1d892a(0x1f0)]}),_0x3c13be=_0x2c4c12[_0x1d892a(0x1d3)];_0x3df32e[_0x1d892a(0x1f0)]&&(console['error'](_0x1d892a(0x216)+_0x3c13be['type']),console['error'](_0x1d892a(0x1f9)+_0x3c13be['parentId']));if(_0x3c13be[_0x1d892a(0x1e4)]==='folder')return console['error']('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x1d892a(0x20a)](_0x1d892a(0x1a4)),0x1;if(_0x3c13be[_0x1d892a(0x1e4)]===_0x1d892a(0x1fa))return console[_0x1d892a(0x20a)](_0x1d892a(0x1d4)),console[_0x1d892a(0x20a)](_0x1d892a(0x1a1)),0x1;if(!_0x3c13be[_0x1d892a(0x1b2)])throw new SDKError(ErrorCode[_0x1d892a(0x1fd)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x39d497=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x14d856['segment']['getSegmentSQL'](_0x3c13be[_0x1d892a(0x1a8)],_0x3c13be[_0x1d892a(0x1b2)]),{'verbose':_0x3df32e['verbose']}),_0x4f9d0a=_0x39d497[_0x1d892a(0x1d3)];return _0x3df32e[_0x1d892a(0x1fe)]==='json'||_0x3df32e[_0x1d892a(0x1fe)]===_0x1d892a(0x22b)?await handleSDKOutput([{'sql':_0x4f9d0a}],_0x3df32e):console[_0x1d892a(0x1f6)](_0x4f9d0a),0x0;}catch(_0x4f33a8){if(_0x4f33a8 instanceof SDKError)return console[_0x1d892a(0x20a)](_0x1d892a(0x1a2)+_0x4f33a8[_0x1d892a(0x1b3)]),_0x4f33a8['cause']&&console[_0x1d892a(0x20a)](_0x1d892a(0x1e1)+_0x4f33a8['cause']),0x1;throw _0x4f33a8;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x208);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a27_0x2cf442(0x1e7)](_0x28bf31){const _0x5890ba=a27_0x2cf442,{options:_0x31ef38,args:_0x10c998,tdx:_0x33b45d}=_0x28bf31,_0x452bb4=_0x31ef38;if(_0x10c998[_0x5890ba(0x1dd)]<0x2)return console['error'](_0x5890ba(0x229)),console[_0x5890ba(0x20a)](_0x5890ba(0x22d)),0x1;const _0x4061b1=_0x10c998[0x0],_0x538533=_0x10c998[0x1];_0x452bb4[_0x5890ba(0x1f0)]&&(console[_0x5890ba(0x20a)](_0x5890ba(0x1a3)+_0x452bb4[_0x5890ba(0x19f)]),console[_0x5890ba(0x20a)](_0x5890ba(0x1c9)+_0x4061b1),console[_0x5890ba(0x20a)](_0x5890ba(0x1ed)+_0x538533));let _0x49773f;if(_0x452bb4[_0x5890ba(0x1d0)]){const _0x1eac67=_0x452bb4[_0x5890ba(0x1d0)],_0x3b8cd7=await withSpinner(_0x5890ba(0x1f5)+_0x4061b1+_0x5890ba(0x19a),()=>_0x33b45d[_0x5890ba(0x1bf)]['resolveParentId'](_0x4061b1),{'verbose':_0x452bb4[_0x5890ba(0x1f0)]}),_0x58ffb6=_0x3b8cd7['data'],_0x28aa71=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1eac67+_0x5890ba(0x19a),()=>_0x33b45d['segment']['resolveFolderId'](_0x58ffb6,_0x1eac67),{'verbose':_0x452bb4[_0x5890ba(0x1f0)]});_0x49773f=_0x28aa71[_0x5890ba(0x1d3)],_0x452bb4[_0x5890ba(0x1f0)]&&console[_0x5890ba(0x20a)](_0x5890ba(0x1ab)+_0x49773f);}const _0x45c663={'name':_0x538533,'description':_0x452bb4['description'],'parentFolderId':_0x49773f},_0x5d7449=await withSpinner(_0x5890ba(0x1c0)+_0x538533+'\x27...',()=>_0x33b45d['segment'][_0x5890ba(0x210)](_0x4061b1,_0x45c663),{'verbose':_0x452bb4['verbose']}),_0x39789f=_0x5d7449[_0x5890ba(0x1d3)];return console[_0x5890ba(0x20a)]('β\x20Created\x20folder\x20\x27'+_0x39789f[_0x5890ba(0x21f)]+_0x5890ba(0x19c)+_0x39789f['id']),await handleSDKOutput([_0x39789f],_0x452bb4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x224);['description']=a27_0x2cf442(0x221);async[a27_0x2cf442(0x1e7)](_0x594adf){const _0x732cd7=a27_0x2cf442,{options:_0x49ed1b,args:_0x4b8d9a,tdx:_0xbae7c7}=_0x594adf,_0x573f72=_0x4b8d9a[0x0];if(!_0x573f72)return console[_0x732cd7(0x20a)](_0x732cd7(0x222)),console['error'](_0x732cd7(0x1e3)),console[_0x732cd7(0x20a)](_0x732cd7(0x20e)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b4)),console['error'](_0x732cd7(0x223)),console[_0x732cd7(0x20a)](_0x732cd7(0x1f4)),console[_0x732cd7(0x20a)](_0x732cd7(0x1f1)),console[_0x732cd7(0x20a)](_0x732cd7(0x211)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b7)),console[_0x732cd7(0x20a)](_0x732cd7(0x1da)),0x1;try{const _0xb296e8=_0x49ed1b[_0x732cd7(0x1c6)],_0x5eb9f=await resolveSegmentTarget(_0x573f72,_0xb296e8,_0x49ed1b['verbose']);_0x49ed1b[_0x732cd7(0x1f0)]&&console['error']('Target\x20path:\x20'+_0x5eb9f);const _0x2c8574=await withSpinner('Resolving\x20\x27'+_0x573f72+_0x732cd7(0x19a),()=>_0xbae7c7['segment'][_0x732cd7(0x20d)](_0x5eb9f),{'verbose':_0x49ed1b[_0x732cd7(0x1f0)]}),_0x504542=_0x2c8574[_0x732cd7(0x1d3)];_0x49ed1b[_0x732cd7(0x1f0)]&&(console['error'](_0x732cd7(0x216)+_0x504542[_0x732cd7(0x1e4)]),console[_0x732cd7(0x20a)](_0x732cd7(0x1f9)+_0x504542[_0x732cd7(0x1a8)]),_0x504542['folderId']&&console[_0x732cd7(0x20a)](_0x732cd7(0x1c3)+_0x504542[_0x732cd7(0x219)]),_0x504542[_0x732cd7(0x1b2)]&&console[_0x732cd7(0x20a)](_0x732cd7(0x1ee)+_0x504542[_0x732cd7(0x1b2)]));if(_0x49ed1b[_0x732cd7(0x209)]){if(_0x504542['type']==='folder')return console[_0x732cd7(0x20a)](_0x732cd7(0x1e9)),0x1;if(_0x504542[_0x732cd7(0x1e4)]==='parent')return console[_0x732cd7(0x20a)](_0x732cd7(0x1c8)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b1)),0x1;if(!_0x504542[_0x732cd7(0x1b2)])throw new SDKError(ErrorCode[_0x732cd7(0x1fd)],_0x732cd7(0x228));const _0x2f2609=getConsoleNextUrl(_0x49ed1b[_0x732cd7(0x19f)],_0x732cd7(0x1c1)+_0x504542[_0x732cd7(0x1a8)]+_0x732cd7(0x1f2)+_0x504542[_0x732cd7(0x1b2)]);return console[_0x732cd7(0x20a)](a27_0x30fcaa[_0x732cd7(0x200)]('β')+_0x732cd7(0x1c5)+a27_0x30fcaa[_0x732cd7(0x19e)](_0x2f2609)),openBrowser(_0x2f2609),0x0;}if(_0x504542['type']===_0x732cd7(0x1ef)){if(!_0x504542[_0x732cd7(0x219)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x732cd7(0x1c4));const _0x249eff=await withSpinner('Fetching\x20folder\x20details...',()=>_0xbae7c7[_0x732cd7(0x1bf)][_0x732cd7(0x1e8)](_0x504542[_0x732cd7(0x219)]),{'verbose':_0x49ed1b['verbose']});await handleSingleObjectOutput(_0x249eff[_0x732cd7(0x1d3)],_0x49ed1b);}else{if(_0x504542[_0x732cd7(0x1e4)]==='segment'){if(!_0x504542[_0x732cd7(0x1b2)])throw new SDKError(ErrorCode[_0x732cd7(0x1fd)],_0x732cd7(0x228));const _0x3d6047=await withSpinner(_0x732cd7(0x1ca),()=>_0xbae7c7[_0x732cd7(0x1bf)]['getSegment'](_0x504542[_0x732cd7(0x1a8)],_0x504542['segmentId']),{'verbose':_0x49ed1b[_0x732cd7(0x1f0)]}),_0x122950=getConsoleNextUrl(_0x49ed1b[_0x732cd7(0x19f)],'/app/ps/'+_0x504542['parentId']+_0x732cd7(0x1f2)+_0x504542[_0x732cd7(0x1b2)]),_0x4fd79e=_0x3d6047[_0x732cd7(0x1d3)];_0x4fd79e[_0x732cd7(0x1cf)]=_0x122950,await handleSingleObjectOutput(_0x4fd79e,_0x49ed1b);}else return console['error'](_0x732cd7(0x214)),console['error'](_0x732cd7(0x1a0)),0x1;}return 0x0;}catch(_0x5d9403){if(_0x5d9403 instanceof SDKError)return console['error'](_0x732cd7(0x1a2)+_0x5d9403[_0x732cd7(0x1b3)]),_0x5d9403[_0x732cd7(0x1b8)]&&console[_0x732cd7(0x20a)](_0x732cd7(0x1e1)+_0x5d9403[_0x732cd7(0x1b8)]),0x1;throw _0x5d9403;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x2cf442(0x21f)]='segment:desc';['description']=a27_0x2cf442(0x1a7);async[a27_0x2cf442(0x1e7)](_0x48d4ef){const _0x38ba10=a27_0x2cf442,{options:_0x3fcb51,args:_0x30106a,tdx:_0x41bb9e}=_0x48d4ef,_0x56820a=_0x30106a[0x0];if(!_0x56820a)return console[_0x38ba10(0x20a)](_0x38ba10(0x199)),console[_0x38ba10(0x20a)](_0x38ba10(0x1db)),console[_0x38ba10(0x20a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x38ba10(0x20a)](_0x38ba10(0x1f4)),console[_0x38ba10(0x20a)](_0x38ba10(0x1d2)),console[_0x38ba10(0x20a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5368fe=_0x3fcb51[_0x38ba10(0x1c6)],_0x3065f4=await resolveSegmentTarget(_0x56820a,_0x5368fe,_0x3fcb51[_0x38ba10(0x1f0)]);_0x3fcb51[_0x38ba10(0x1f0)]&&console['error'](_0x38ba10(0x206)+_0x3065f4);const _0x5e86e4=await withSpinner(_0x38ba10(0x1b0)+_0x56820a+_0x38ba10(0x19a),()=>_0x41bb9e[_0x38ba10(0x1bf)][_0x38ba10(0x20d)](_0x3065f4),{'verbose':_0x3fcb51[_0x38ba10(0x1f0)]}),_0x283760=_0x5e86e4[_0x38ba10(0x1d3)];_0x3fcb51[_0x38ba10(0x1f0)]&&(console[_0x38ba10(0x20a)]('Resolved\x20type:\x20'+_0x283760[_0x38ba10(0x1e4)]),console[_0x38ba10(0x20a)](_0x38ba10(0x1f9)+_0x283760[_0x38ba10(0x1a8)]));if(_0x283760['type']===_0x38ba10(0x1ef))return console[_0x38ba10(0x20a)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x38ba10(0x1a4)),0x1;if(_0x283760[_0x38ba10(0x1e4)]==='parent')return console[_0x38ba10(0x20a)](_0x38ba10(0x201)),console[_0x38ba10(0x20a)](_0x38ba10(0x1a9)),0x1;if(!_0x283760[_0x38ba10(0x1b2)])throw new SDKError(ErrorCode[_0x38ba10(0x1fd)],_0x38ba10(0x228));const _0x5ab156=await withSpinner(_0x38ba10(0x1ec),()=>_0x41bb9e[_0x38ba10(0x1bf)][_0x38ba10(0x1cd)](_0x283760[_0x38ba10(0x1a8)],_0x283760[_0x38ba10(0x1b2)]),{'verbose':_0x3fcb51['verbose']}),_0x13c3a8=_0x5ab156['data'],_0x131cd9=await executeSchemaQuery(_0x13c3a8,_0x41bb9e,_0x3fcb51);return await handleQueryOutput(_0x131cd9,_0x3fcb51),0x0;}catch(_0x4be26b){if(_0x4be26b instanceof SDKError)return console[_0x38ba10(0x20a)](_0x38ba10(0x1a2)+_0x4be26b[_0x38ba10(0x1b3)]),_0x4be26b['cause']&&console['error'](_0x38ba10(0x1e1)+_0x4be26b[_0x38ba10(0x1b8)]),0x1;throw _0x4be26b;}}}
|
|
1
|
+
const a27_0x5bc5ee=a27_0x4a23;(function(_0xa791e1,_0x13711e){const _0x4f6787=a27_0x4a23,_0xc37ae9=_0xa791e1();while(!![]){try{const _0x4c15ae=-parseInt(_0x4f6787(0x159))/0x1+parseInt(_0x4f6787(0x19f))/0x2+parseInt(_0x4f6787(0x177))/0x3*(-parseInt(_0x4f6787(0x1c7))/0x4)+-parseInt(_0x4f6787(0x1ab))/0x5*(-parseInt(_0x4f6787(0x1cf))/0x6)+parseInt(_0x4f6787(0x1d5))/0x7*(-parseInt(_0x4f6787(0x19b))/0x8)+-parseInt(_0x4f6787(0x166))/0x9*(parseInt(_0x4f6787(0x1ba))/0xa)+parseInt(_0x4f6787(0x17c))/0xb;if(_0x4c15ae===_0x13711e)break;else _0xc37ae9['push'](_0xc37ae9['shift']());}catch(_0x4d585f){_0xc37ae9['push'](_0xc37ae9['shift']());}}}(a27_0x2baf,0x8d7f8));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';function a27_0x2baf(){const _0x462d19=['Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','folderPath','resolveParentId','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','trim','getFolder','Parent\x20segment:\x20','error','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','green','β\x20Found\x20','2901759ZhrKSn','segment:folder:show','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','length','18795260ZJjlPn','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','folderId','jsonl','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Fetching\x20folder\x20\x27','Parent\x20name:\x20','segment:describe','in\x20','Resolved\x20relative\x20path\x20to:\x20','/app/ps/','Folder\x20name:\x20','Site:\x20','folder','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:show','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolving\x20parent\x20segment\x20\x27','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','parentFolder','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','json','Use:\x20tdx\x20ps\x20show','jobId','SEGMENT_FOLDER_NOT_FOUND','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20[Job\x20ID:\x20','Resolved\x20type:\x20','72DLxWBb','cause','parentSegment','Show\x20segment\x20folder\x20details','1987598BhBwKo','Error:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','SELECT\x20*\x20FROM\x20(\x0a','/e/','site','resolvePathToResource','segmentName','toLocaleString','Get\x20SQL\x20query\x20for\x20child\x20segment','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','5fopBMl','\x20\x20Cause:\x20','parentId','limit','Fetching\x20SQL\x20for\x20segment...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','(root)','Folder\x20ID:\x20','Resolving\x20folder\x20\x27','data','segment:folder:list','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','includes','10fluAqx','\x27...','elapsedTimeMillis','Examples:','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','format','description','Error:\x20Folder\x20reference\x20is\x20required','replace','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','cyan','4bLglWi','Create\x20segment\x20folder\x20for\x20organization','parent','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','465270JCjoLP','resolveFolderId','Resolved\x20YAML\x20file:\x20','Segment\x20ID:\x20','\x20folder','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','527842loVTLj','segment:desc','SEGMENT_NOT_FOUND','\x20Opening\x20','Executing\x20segment\x20query...','type','Options:','getSegmentSQL','Resolved\x20folder\x20ID:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20rows\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Segment\x20name:\x20','listFolders','β\x20Query\x20failed\x20[','segment:view','segmentId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','execute','Resolving\x20parent\x20folder\x20\x27','Parent\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getSegment','segment','Resolved\x20parent\x20ID:\x20','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20segment\x20describe\x20<path>','Creating\x20folder\x20\x27','query','verbose','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','fullPath','Use:\x20tdx\x20ps\x20view','Listing\x20folders\x20for\x20parent\x20\x27','segment:sql','Use:\x20tdx\x20ps\x20desc','information_schema','196266IqEziH','β\x20Created\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segment:folder:create','segmentPath','Fetching\x20folder\x20details...','Resolving\x20\x27','createFolder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','setJobId','\x27\x20with\x20ID:\x20','Fetching\x20segment\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','3224295fMCczE','message','stats'];a27_0x2baf=function(){return _0x462d19;};return a27_0x2baf();}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_0x4d29b5 from'chalk';async function resolveSegmentTarget(_0x31ef01,_0x40ccee,_0x55808a){const _0x3f3993=a27_0x4a23;if(isYamlFilePath(_0x31ef01))try{const _0x2c7bf1=await resolveYamlFilePath(_0x31ef01);return _0x55808a&&(console[_0x3f3993(0x172)](_0x3f3993(0x1d1)+_0x31ef01),console[_0x3f3993(0x172)]('\x20\x20Parent\x20segment:\x20'+_0x2c7bf1[_0x3f3993(0x19d)]),console[_0x3f3993(0x172)](_0x3f3993(0x1e1)+_0x2c7bf1[_0x3f3993(0x1a6)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x2c7bf1[_0x3f3993(0x16c)]||_0x3f3993(0x1b2))),console['error'](_0x3f3993(0x1be)+_0x2c7bf1[_0x3f3993(0x153)])),_0x2c7bf1['fullPath'];}catch(_0x3b7f3f){throw new SDKError(ErrorCode[_0x3f3993(0x180)],_0x3f3993(0x1ce)+_0x3b7f3f[_0x3f3993(0x167)]);}if(!_0x40ccee)throw new SDKError(ErrorCode[_0x3f3993(0x180)],_0x3f3993(0x16b));return _0x40ccee+'/'+_0x31ef01;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x5bc5ee(0x184);[a27_0x5bc5ee(0x1c1)]=a27_0x5bc5ee(0x1f0);async[a27_0x5bc5ee(0x1e8)](_0x114ff6){const _0x57c9b3=a27_0x5bc5ee,{options:_0x43cc3e,args:_0x2f37d2,tdx:_0x5b61cd}=_0x114ff6,_0x3c916a=_0x2f37d2[0x0],_0x3557aa=!_0x3c916a&&!!_0x43cc3e[_0x57c9b3(0x19d)],_0x43faab=_0x3c916a||_0x43cc3e[_0x57c9b3(0x19d)];if(!_0x43faab)return console[_0x57c9b3(0x172)](_0x57c9b3(0x1cc)),console[_0x57c9b3(0x172)](_0x57c9b3(0x1f3)),console[_0x57c9b3(0x172)]('Examples:'),console[_0x57c9b3(0x172)](_0x57c9b3(0x1ec)),console[_0x57c9b3(0x172)](_0x57c9b3(0x179)),console[_0x57c9b3(0x172)](_0x57c9b3(0x1d4)),console[_0x57c9b3(0x172)](_0x57c9b3(0x193)),0x1;try{const _0x327a37=_0x43cc3e[_0x57c9b3(0x15d)];let _0x1ce318=_0x43faab;!_0x3557aa&&_0x327a37&&!_0x43faab[_0x57c9b3(0x1b9)]('/')&&(_0x1ce318=_0x327a37+'/'+_0x43faab,_0x43cc3e[_0x57c9b3(0x14f)]&&console['error'](_0x57c9b3(0x186)+_0x1ce318));const _0x2e6ac2=await withSpinner('Resolving\x20path\x20\x27'+_0x1ce318+'\x27...',()=>_0x5b61cd[_0x57c9b3(0x1ee)][_0x57c9b3(0x1a5)](_0x1ce318),{'verbose':_0x43cc3e['verbose']}),_0x11c7a4=_0x2e6ac2[_0x57c9b3(0x1b5)];_0x43cc3e['verbose']&&(console[_0x57c9b3(0x172)](_0x57c9b3(0x19a)+_0x11c7a4['type']),console[_0x57c9b3(0x172)](_0x57c9b3(0x1ea)+_0x11c7a4[_0x57c9b3(0x1ad)]),_0x11c7a4['folderId']&&console[_0x57c9b3(0x172)](_0x57c9b3(0x1b3)+_0x11c7a4[_0x57c9b3(0x17e)]),_0x11c7a4[_0x57c9b3(0x1e5)]&&console[_0x57c9b3(0x172)](_0x57c9b3(0x1d2)+_0x11c7a4[_0x57c9b3(0x1e5)]));if(_0x11c7a4[_0x57c9b3(0x1da)]===_0x57c9b3(0x1c9)){const _0x1502c5=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5b61cd[_0x57c9b3(0x1ee)]['getParent'](_0x11c7a4[_0x57c9b3(0x1ad)]),{'verbose':_0x43cc3e[_0x57c9b3(0x14f)]});await handleSingleObjectOutput(_0x1502c5[_0x57c9b3(0x1b5)],_0x43cc3e);}else{if(_0x11c7a4[_0x57c9b3(0x1da)]==='folder'){if(!_0x11c7a4[_0x57c9b3(0x17e)])throw new SDKError(ErrorCode[_0x57c9b3(0x197)],_0x57c9b3(0x1eb));const _0x5b6353=await withSpinner(_0x57c9b3(0x15e),()=>_0x5b61cd[_0x57c9b3(0x1ee)][_0x57c9b3(0x170)](_0x11c7a4[_0x57c9b3(0x17e)]),{'verbose':_0x43cc3e[_0x57c9b3(0x14f)]});await handleSingleObjectOutput(_0x5b6353[_0x57c9b3(0x1b5)],_0x43cc3e);}else{if(_0x11c7a4[_0x57c9b3(0x1da)]==='segment'){if(!_0x11c7a4['segmentId'])throw new SDKError(ErrorCode[_0x57c9b3(0x1d7)],_0x57c9b3(0x190));const _0xf5a4d9=await withSpinner(_0x57c9b3(0x164),()=>_0x5b61cd['segment'][_0x57c9b3(0x1ed)](_0x11c7a4[_0x57c9b3(0x1ad)],_0x11c7a4['segmentId']),{'verbose':_0x43cc3e[_0x57c9b3(0x14f)]});await handleSingleObjectOutput(_0xf5a4d9[_0x57c9b3(0x1b5)],_0x43cc3e);}}}return 0x0;}catch(_0x19dc95){if(_0x19dc95 instanceof SDKError)return console['error'](_0x57c9b3(0x1a0)+_0x19dc95['message']),_0x19dc95[_0x57c9b3(0x19c)]&&console['error'](_0x57c9b3(0x1ac)+_0x19dc95[_0x57c9b3(0x19c)]),0x1;throw _0x19dc95;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x5bc5ee(0x18f)]=a27_0x5bc5ee(0x18c);[a27_0x5bc5ee(0x1c1)]=a27_0x5bc5ee(0x18d);async[a27_0x5bc5ee(0x1e8)](_0x458e20){const _0x234b15=a27_0x5bc5ee,{options:_0x2e6648,args:_0x49834e,tdx:_0x5e1be}=_0x458e20,_0xb9eaac=_0x49834e[0x0];if(!_0xb9eaac)return console['error'](_0x234b15(0x173)),console[_0x234b15(0x172)](_0x234b15(0x150)),console['error'](_0x234b15(0x1aa)),console[_0x234b15(0x172)]('Examples:'),console[_0x234b15(0x172)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x234b15(0x172)](_0x234b15(0x1e7)),0x1;try{const _0x6f4c3c=_0x2e6648['parentSegment'],_0x505bed=await resolveSegmentTarget(_0xb9eaac,_0x6f4c3c,_0x2e6648['verbose']);_0x2e6648['verbose']&&console[_0x234b15(0x172)](_0x234b15(0x1ca)+_0x505bed);const _0x31c358=await withSpinner(_0x234b15(0x15f)+_0xb9eaac+_0x234b15(0x1bb),()=>_0x5e1be[_0x234b15(0x1ee)][_0x234b15(0x1a5)](_0x505bed),{'verbose':_0x2e6648[_0x234b15(0x14f)]}),_0x39f348=_0x31c358[_0x234b15(0x1b5)];_0x2e6648[_0x234b15(0x14f)]&&(console['error']('Resolved\x20type:\x20'+_0x39f348[_0x234b15(0x1da)]),console[_0x234b15(0x172)](_0x234b15(0x1ea)+_0x39f348[_0x234b15(0x1ad)]));if(_0x39f348['type']===_0x234b15(0x18a))return console[_0x234b15(0x172)](_0x234b15(0x192)),console[_0x234b15(0x172)](_0x234b15(0x198)),0x1;if(_0x39f348[_0x234b15(0x1da)]===_0x234b15(0x1c9))return console[_0x234b15(0x172)](_0x234b15(0x1e0)),console['error'](_0x234b15(0x195)),0x1;if(!_0x39f348['segmentId'])throw new SDKError(ErrorCode[_0x234b15(0x1d7)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x61d93b=await withSpinner(_0x234b15(0x1af),()=>_0x5e1be[_0x234b15(0x1ee)]['getSegmentSQL'](_0x39f348[_0x234b15(0x1ad)],_0x39f348['segmentId']),{'verbose':_0x2e6648['verbose']});let _0x3032d8=_0x61d93b['data'];const _0x2db7d3=resolveLimit(_0x2e6648[_0x234b15(0x1ae)],DEFAULT_DISPLAY_LIMIT),_0x2045ee=/\bLIMIT\s+\d+/i['test'](_0x3032d8);!_0x2045ee&&(_0x3032d8=_0x3032d8[_0x234b15(0x16f)]()[_0x234b15(0x1c3)](/;+$/,''),_0x3032d8=_0x234b15(0x1a2)+_0x3032d8+_0x234b15(0x1b0)+_0x2db7d3);_0x2e6648[_0x234b15(0x14f)]&&console[_0x234b15(0x172)]('SQL\x20query:\x0a'+_0x3032d8);const _0x5555f4=await withProgressSpinner(_0x234b15(0x1d9),async _0x5c0894=>{const _0x277081=_0x234b15,_0x4b3699=await _0x5e1be[_0x277081(0x14e)]['execute'](_0x3032d8,{'catalog':'td','schema':_0x277081(0x158),'onJobId':_0xe34114=>{const _0x1c025c=_0x277081;_0x5c0894[_0x1c025c(0x162)](_0xe34114);}});return _0x4b3699;},{'verbose':_0x2e6648['verbose']}),_0x209f5f=_0x5555f4[_0x234b15(0x1b5)],_0x20617c=_0x209f5f['jobId']?_0x234b15(0x199)+_0x209f5f[_0x234b15(0x196)]+']':'';return console['error']('β\x20Query\x20completed:\x20Processed\x20'+_0x209f5f[_0x234b15(0x168)]['processedRows'][_0x234b15(0x1a7)]()+_0x234b15(0x1df)+(_0x234b15(0x185)+formatElapsed(_0x209f5f[_0x234b15(0x168)][_0x234b15(0x1bc)])+_0x20617c)),await handleQueryOutput(_0x209f5f,_0x2e6648),0x0;}catch(_0xbcf281){if(_0xbcf281 instanceof SDKError)return console[_0x234b15(0x172)](_0x234b15(0x1e3)+_0xbcf281['code']+']'),console['error']('\x0a'+_0xbcf281['message']),0x1;throw _0xbcf281;}}}function a27_0x4a23(_0x688a42,_0x1a216a){_0x688a42=_0x688a42-0x14d;const _0x2baf82=a27_0x2baf();let _0x4a23e7=_0x2baf82[_0x688a42];return _0x4a23e7;}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x5bc5ee(0x1b6);[a27_0x5bc5ee(0x1c1)]=a27_0x5bc5ee(0x16a);async[a27_0x5bc5ee(0x1e8)](_0xae102f){const _0x468bac=a27_0x5bc5ee,{options:_0x2fb027,args:_0x2142e8,tdx:_0x31cbee}=_0xae102f;if(_0x2142e8['length']===0x0)return console['error'](_0x468bac(0x1c4)),console[_0x468bac(0x172)](_0x468bac(0x1cd)),0x1;const _0x461450=_0x2142e8[0x0];try{_0x2fb027[_0x468bac(0x14f)]&&(console[_0x468bac(0x172)](_0x468bac(0x189)+_0x2fb027[_0x468bac(0x1a4)]),console['error'](_0x468bac(0x183)+_0x461450));const _0x2b33ac=await withSpinner(_0x468bac(0x18e)+_0x461450+_0x468bac(0x1bb),()=>_0x31cbee[_0x468bac(0x1ee)][_0x468bac(0x16d)](_0x461450),{'verbose':_0x2fb027[_0x468bac(0x14f)]}),_0x40f02a=_0x2b33ac[_0x468bac(0x1b5)];_0x2fb027['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x40f02a);const _0x4c1c8d=await withSpinner(_0x468bac(0x155)+_0x461450+_0x468bac(0x1bb),()=>_0x31cbee[_0x468bac(0x1ee)][_0x468bac(0x1e2)](_0x40f02a),{'verbose':_0x2fb027[_0x468bac(0x14f)]}),_0x4b9846=_0x4c1c8d[_0x468bac(0x1b5)];return console[_0x468bac(0x172)](_0x468bac(0x176)+_0x4b9846[_0x468bac(0x17b)]+_0x468bac(0x1d3)+(_0x4b9846[_0x468bac(0x17b)]!==0x1?'s':'')),await handleSDKOutput(_0x4b9846,_0x2fb027),0x0;}catch(_0x4fbef9){if(_0x4fbef9 instanceof SDKError)return console[_0x468bac(0x172)](_0x468bac(0x1a0)+_0x4fbef9[_0x468bac(0x167)]),_0x4fbef9[_0x468bac(0x19c)]&&console[_0x468bac(0x172)](_0x468bac(0x1ac)+_0x4fbef9['cause']),0x1;throw _0x4fbef9;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x5bc5ee(0x18f)]=a27_0x5bc5ee(0x178);[a27_0x5bc5ee(0x1c1)]=a27_0x5bc5ee(0x19e);async[a27_0x5bc5ee(0x1e8)](_0x520468){const _0x5bdcf7=a27_0x5bc5ee,{options:_0x4c5390,args:_0x4fd3be,tdx:_0x444e38}=_0x520468;if(_0x4fd3be['length']===0x0)return console[_0x5bdcf7(0x172)](_0x5bdcf7(0x1c2)),console[_0x5bdcf7(0x172)](_0x5bdcf7(0x16e)),0x1;try{const {parentId:_0x1c9aa5,childId:_0x430428}=parseSegmentRef(_0x4fd3be[0x0]);_0x4c5390[_0x5bdcf7(0x14f)]&&(console[_0x5bdcf7(0x172)](_0x5bdcf7(0x189)+_0x4c5390['site']),console[_0x5bdcf7(0x172)](_0x5bdcf7(0x183)+_0x1c9aa5),_0x430428&&console['error'](_0x5bdcf7(0x188)+_0x430428));if(!_0x430428)return console[_0x5bdcf7(0x172)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5a4763=await withSpinner(_0x5bdcf7(0x18e)+_0x1c9aa5+'\x27...',()=>_0x444e38[_0x5bdcf7(0x1ee)][_0x5bdcf7(0x16d)](_0x1c9aa5),{'verbose':_0x4c5390[_0x5bdcf7(0x14f)]}),_0x35a101=_0x5a4763[_0x5bdcf7(0x1b5)];_0x4c5390[_0x5bdcf7(0x14f)]&&console[_0x5bdcf7(0x172)](_0x5bdcf7(0x1ef)+_0x35a101);const _0x21667d=await withSpinner(_0x5bdcf7(0x1b4)+_0x430428+_0x5bdcf7(0x1bb),()=>_0x444e38['segment'][_0x5bdcf7(0x1d0)](_0x35a101,_0x430428),{'verbose':_0x4c5390[_0x5bdcf7(0x14f)]}),_0x3a734e=_0x21667d[_0x5bdcf7(0x1b5)];_0x4c5390[_0x5bdcf7(0x14f)]&&console[_0x5bdcf7(0x172)](_0x5bdcf7(0x1dd)+_0x3a734e);const _0x5347ac=await withSpinner(_0x5bdcf7(0x182)+_0x430428+_0x5bdcf7(0x1bb),()=>_0x444e38['segment'][_0x5bdcf7(0x170)](_0x3a734e),{'verbose':_0x4c5390[_0x5bdcf7(0x14f)]});return await handleSDKOutput([_0x5347ac['data']],_0x4c5390),0x0;}catch(_0xc04c2f){if(_0xc04c2f instanceof SDKError)return console[_0x5bdcf7(0x172)](_0x5bdcf7(0x1a0)+_0xc04c2f['message']),_0xc04c2f[_0x5bdcf7(0x19c)]&&console[_0x5bdcf7(0x172)](_0x5bdcf7(0x1ac)+_0xc04c2f[_0x5bdcf7(0x19c)]),0x1;throw _0xc04c2f;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x5bc5ee(0x156);['description']=a27_0x5bc5ee(0x1a8);async[a27_0x5bc5ee(0x1e8)](_0x240d49){const _0x68d327=a27_0x5bc5ee,{options:_0x45a0c9,args:_0x5e639d,tdx:_0x15e5d5}=_0x240d49,_0x5672a2=_0x5e639d[0x0];if(!_0x5672a2)return console[_0x68d327(0x172)](_0x68d327(0x173)),console[_0x68d327(0x172)](_0x68d327(0x1b7)),console['error'](_0x68d327(0x17d)),console[_0x68d327(0x172)]('Examples:'),console[_0x68d327(0x172)](_0x68d327(0x181)),console['error'](_0x68d327(0x1f2)),0x1;try{const _0x5a4550=_0x45a0c9[_0x68d327(0x19d)],_0x5adc58=await resolveSegmentTarget(_0x5672a2,_0x5a4550,_0x45a0c9[_0x68d327(0x14f)]);_0x45a0c9[_0x68d327(0x14f)]&&console[_0x68d327(0x172)](_0x68d327(0x1ca)+_0x5adc58);const _0x11dfce=await withSpinner('Resolving\x20\x27'+_0x5672a2+_0x68d327(0x1bb),()=>_0x15e5d5[_0x68d327(0x1ee)]['resolvePathToResource'](_0x5adc58),{'verbose':_0x45a0c9['verbose']}),_0x5be7fb=_0x11dfce[_0x68d327(0x1b5)];_0x45a0c9[_0x68d327(0x14f)]&&(console[_0x68d327(0x172)](_0x68d327(0x19a)+_0x5be7fb[_0x68d327(0x1da)]),console[_0x68d327(0x172)](_0x68d327(0x1ea)+_0x5be7fb['parentId']));if(_0x5be7fb[_0x68d327(0x1da)]===_0x68d327(0x18a))return console[_0x68d327(0x172)](_0x68d327(0x1b1)),console[_0x68d327(0x172)](_0x68d327(0x1de)),0x1;if(_0x5be7fb['type']===_0x68d327(0x1c9))return console[_0x68d327(0x172)](_0x68d327(0x169)),console[_0x68d327(0x172)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x5be7fb[_0x68d327(0x1e5)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x68d327(0x190));const _0x517a52=await withSpinner(_0x68d327(0x1af),()=>_0x15e5d5['segment'][_0x68d327(0x1dc)](_0x5be7fb['parentId'],_0x5be7fb['segmentId']),{'verbose':_0x45a0c9[_0x68d327(0x14f)]}),_0x448b77=_0x517a52[_0x68d327(0x1b5)];return _0x45a0c9[_0x68d327(0x1c0)]===_0x68d327(0x194)||_0x45a0c9['format']===_0x68d327(0x17f)?await handleSDKOutput([{'sql':_0x448b77}],_0x45a0c9):console['log'](_0x448b77),0x0;}catch(_0x4efcba){if(_0x4efcba instanceof SDKError)return console[_0x68d327(0x172)](_0x68d327(0x1a0)+_0x4efcba[_0x68d327(0x167)]),_0x4efcba[_0x68d327(0x19c)]&&console[_0x68d327(0x172)](_0x68d327(0x1ac)+_0x4efcba['cause']),0x1;throw _0x4efcba;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x5bc5ee(0x18f)]=a27_0x5bc5ee(0x15c);[a27_0x5bc5ee(0x1c1)]=a27_0x5bc5ee(0x1c8);async['execute'](_0x5e2f83){const _0x5bb468=a27_0x5bc5ee,{options:_0x205ed9,args:_0x55b1f1,tdx:_0x562c6c}=_0x5e2f83,_0x18829f=_0x205ed9;if(_0x55b1f1['length']<0x2)return console[_0x5bb468(0x172)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x5bb468(0x172)](_0x5bb468(0x1cb)),0x1;const _0xf9e961=_0x55b1f1[0x0],_0x4b4a04=_0x55b1f1[0x1];_0x18829f[_0x5bb468(0x14f)]&&(console['error'](_0x5bb468(0x189)+_0x18829f[_0x5bb468(0x1a4)]),console['error'](_0x5bb468(0x171)+_0xf9e961),console[_0x5bb468(0x172)](_0x5bb468(0x188)+_0x4b4a04));let _0x25a35e;if(_0x18829f[_0x5bb468(0x191)]){const _0x326e2f=_0x18829f[_0x5bb468(0x191)],_0x5a77e5=await withSpinner(_0x5bb468(0x18e)+_0xf9e961+_0x5bb468(0x1bb),()=>_0x562c6c['segment']['resolveParentId'](_0xf9e961),{'verbose':_0x18829f['verbose']}),_0xdcfab1=_0x5a77e5[_0x5bb468(0x1b5)],_0x5609e6=await withSpinner(_0x5bb468(0x1e9)+_0x326e2f+'\x27...',()=>_0x562c6c[_0x5bb468(0x1ee)]['resolveFolderId'](_0xdcfab1,_0x326e2f),{'verbose':_0x18829f[_0x5bb468(0x14f)]});_0x25a35e=_0x5609e6['data'],_0x18829f[_0x5bb468(0x14f)]&&console[_0x5bb468(0x172)](_0x5bb468(0x1a9)+_0x25a35e);}const _0x20206f={'name':_0x4b4a04,'description':_0x18829f['description'],'parentFolderId':_0x25a35e},_0x275578=await withSpinner(_0x5bb468(0x14d)+_0x4b4a04+'\x27...',()=>_0x562c6c['segment'][_0x5bb468(0x160)](_0xf9e961,_0x20206f),{'verbose':_0x18829f[_0x5bb468(0x14f)]}),_0x9354b9=_0x275578[_0x5bb468(0x1b5)];return console[_0x5bb468(0x172)](_0x5bb468(0x15a)+_0x9354b9['name']+_0x5bb468(0x163)+_0x9354b9['id']),await handleSDKOutput([_0x9354b9],_0x18829f),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x5bc5ee(0x18f)]=a27_0x5bc5ee(0x1e4);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x5bc5ee(0x1e8)](_0x320d61){const _0xec7175=a27_0x5bc5ee,{options:_0x292d63,args:_0x5d44d3,tdx:_0x5ccb7d}=_0x320d61,_0x25ed77=_0x5d44d3[0x0];if(!_0x25ed77)return console[_0xec7175(0x172)](_0xec7175(0x18b)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0xec7175(0x172)](_0xec7175(0x15b)),console['error'](_0xec7175(0x1db)),console[_0xec7175(0x172)](_0xec7175(0x165)),console[_0xec7175(0x172)](_0xec7175(0x1bd)),console[_0xec7175(0x172)](_0xec7175(0x152)),console[_0xec7175(0x172)](_0xec7175(0x1e6)),console[_0xec7175(0x172)](_0xec7175(0x174)),console[_0xec7175(0x172)](_0xec7175(0x1f1)),0x1;try{const _0x4defa6=_0x292d63[_0xec7175(0x19d)],_0x31cb32=await resolveSegmentTarget(_0x25ed77,_0x4defa6,_0x292d63[_0xec7175(0x14f)]);_0x292d63[_0xec7175(0x14f)]&&console['error'](_0xec7175(0x1ca)+_0x31cb32);const _0x50ab90=await withSpinner(_0xec7175(0x15f)+_0x25ed77+_0xec7175(0x1bb),()=>_0x5ccb7d[_0xec7175(0x1ee)][_0xec7175(0x1a5)](_0x31cb32),{'verbose':_0x292d63[_0xec7175(0x14f)]}),_0x359c17=_0x50ab90[_0xec7175(0x1b5)];_0x292d63['verbose']&&(console['error'](_0xec7175(0x19a)+_0x359c17[_0xec7175(0x1da)]),console[_0xec7175(0x172)](_0xec7175(0x1ea)+_0x359c17['parentId']),_0x359c17[_0xec7175(0x17e)]&&console[_0xec7175(0x172)](_0xec7175(0x1b3)+_0x359c17[_0xec7175(0x17e)]),_0x359c17[_0xec7175(0x1e5)]&&console[_0xec7175(0x172)](_0xec7175(0x1d2)+_0x359c17['segmentId']));if(_0x292d63['web']){if(_0x359c17[_0xec7175(0x1da)]===_0xec7175(0x18a))return console[_0xec7175(0x172)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x359c17['type']===_0xec7175(0x1c9))return console[_0xec7175(0x172)](_0xec7175(0x1bf)),console[_0xec7175(0x172)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x359c17[_0xec7175(0x1e5)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xec7175(0x190));const _0x438838=getConsoleNextUrl(_0x292d63[_0xec7175(0x1a4)],_0xec7175(0x187)+_0x359c17[_0xec7175(0x1ad)]+_0xec7175(0x1a3)+_0x359c17[_0xec7175(0x1e5)]);return console['error'](a27_0x4d29b5[_0xec7175(0x175)]('β')+_0xec7175(0x1d8)+a27_0x4d29b5[_0xec7175(0x1c6)](_0x438838)),openBrowser(_0x438838),0x0;}if(_0x359c17['type']===_0xec7175(0x18a)){if(!_0x359c17[_0xec7175(0x17e)])throw new SDKError(ErrorCode[_0xec7175(0x197)],_0xec7175(0x1eb));const _0x80ed3f=await withSpinner(_0xec7175(0x15e),()=>_0x5ccb7d[_0xec7175(0x1ee)][_0xec7175(0x170)](_0x359c17['folderId']),{'verbose':_0x292d63[_0xec7175(0x14f)]});await handleSingleObjectOutput(_0x80ed3f[_0xec7175(0x1b5)],_0x292d63);}else{if(_0x359c17[_0xec7175(0x1da)]===_0xec7175(0x1ee)){if(!_0x359c17[_0xec7175(0x1e5)])throw new SDKError(ErrorCode[_0xec7175(0x1d7)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x37bac6=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5ccb7d[_0xec7175(0x1ee)][_0xec7175(0x1ed)](_0x359c17['parentId'],_0x359c17[_0xec7175(0x1e5)]),{'verbose':_0x292d63[_0xec7175(0x14f)]}),_0x4a5710=getConsoleNextUrl(_0x292d63[_0xec7175(0x1a4)],_0xec7175(0x187)+_0x359c17['parentId']+_0xec7175(0x1a3)+_0x359c17[_0xec7175(0x1e5)]),_0x5b3ae8=_0x37bac6[_0xec7175(0x1b5)];_0x5b3ae8['url']=_0x4a5710,await handleSingleObjectOutput(_0x5b3ae8,_0x292d63);}else return console[_0xec7175(0x172)](_0xec7175(0x161)),console[_0xec7175(0x172)](_0xec7175(0x154)),0x1;}return 0x0;}catch(_0x3a9cb9){if(_0x3a9cb9 instanceof SDKError)return console[_0xec7175(0x172)](_0xec7175(0x1a0)+_0x3a9cb9['message']),_0x3a9cb9[_0xec7175(0x19c)]&&console[_0xec7175(0x172)](_0xec7175(0x1ac)+_0x3a9cb9[_0xec7175(0x19c)]),0x1;throw _0x3a9cb9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x5bc5ee(0x18f)]=a27_0x5bc5ee(0x1d6);['description']=a27_0x5bc5ee(0x1a1);async[a27_0x5bc5ee(0x1e8)](_0x480e9f){const _0xd00e38=a27_0x5bc5ee,{options:_0x3fbc29,args:_0x24103a,tdx:_0x8367b6}=_0x480e9f,_0x35bd65=_0x24103a[0x0];if(!_0x35bd65)return console[_0xd00e38(0x172)](_0xd00e38(0x173)),console[_0xd00e38(0x172)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0xd00e38(0x172)](_0xd00e38(0x151)),console[_0xd00e38(0x172)]('Examples:'),console[_0xd00e38(0x172)](_0xd00e38(0x1c5)),console[_0xd00e38(0x172)](_0xd00e38(0x1b8)),0x1;try{const _0x41ff37=_0x3fbc29[_0xd00e38(0x19d)],_0x604992=await resolveSegmentTarget(_0x35bd65,_0x41ff37,_0x3fbc29[_0xd00e38(0x14f)]);_0x3fbc29[_0xd00e38(0x14f)]&&console['error'](_0xd00e38(0x1ca)+_0x604992);const _0x50596b=await withSpinner(_0xd00e38(0x15f)+_0x35bd65+_0xd00e38(0x1bb),()=>_0x8367b6['segment'][_0xd00e38(0x1a5)](_0x604992),{'verbose':_0x3fbc29[_0xd00e38(0x14f)]}),_0x24b3f5=_0x50596b['data'];_0x3fbc29[_0xd00e38(0x14f)]&&(console['error']('Resolved\x20type:\x20'+_0x24b3f5[_0xd00e38(0x1da)]),console[_0xd00e38(0x172)](_0xd00e38(0x1ea)+_0x24b3f5[_0xd00e38(0x1ad)]));if(_0x24b3f5['type']===_0xd00e38(0x18a))return console[_0xd00e38(0x172)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0xd00e38(0x172)](_0xd00e38(0x1de)),0x1;if(_0x24b3f5['type']===_0xd00e38(0x1c9))return console[_0xd00e38(0x172)](_0xd00e38(0x17a)),console[_0xd00e38(0x172)](_0xd00e38(0x157)),0x1;if(!_0x24b3f5['segmentId'])throw new SDKError(ErrorCode[_0xd00e38(0x1d7)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xd2c58=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x8367b6['segment'][_0xd00e38(0x1dc)](_0x24b3f5[_0xd00e38(0x1ad)],_0x24b3f5['segmentId']),{'verbose':_0x3fbc29[_0xd00e38(0x14f)]}),_0x27cfca=_0xd2c58['data'],_0x30ef08=await executeSchemaQuery(_0x27cfca,_0x8367b6,_0x3fbc29);return await handleQueryOutput(_0x30ef08,_0x3fbc29),0x0;}catch(_0x300ffd){if(_0x300ffd instanceof SDKError)return console[_0xd00e38(0x172)](_0xd00e38(0x1a0)+_0x300ffd[_0xd00e38(0x167)]),_0x300ffd[_0xd00e38(0x19c)]&&console['error'](_0xd00e38(0x1ac)+_0x300ffd[_0xd00e38(0x19c)]),0x1;throw _0x300ffd;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0xb2140d=a28_0x21c2;(function(_0x1dc37b,_0x2080a2){const _0x37bdbf=a28_0x21c2,_0x5c3d3b=_0x1dc37b();while(!![]){try{const _0x26f84e=-parseInt(_0x37bdbf(0x100))/0x1*(-parseInt(_0x37bdbf(0xf5))/0x2)+parseInt(_0x37bdbf(0x12b))/0x3*(-parseInt(_0x37bdbf(0x106))/0x4)+parseInt(_0x37bdbf(0x112))/0x5*(parseInt(_0x37bdbf(0xfd))/0x6)+parseInt(_0x37bdbf(0x110))/0x7+parseInt(_0x37bdbf(0x111))/0x8+-parseInt(_0x37bdbf(0xfb))/0x9*(-parseInt(_0x37bdbf(0x121))/0xa)+-parseInt(_0x37bdbf(0x10f))/0xb;if(_0x26f84e===_0x2080a2)break;else _0x5c3d3b['push'](_0x5c3d3b['shift']());}catch(_0x53c7a1){_0x5c3d3b['push'](_0x5c3d3b['shift']());}}}(a28_0x1983,0x7a687));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_0x353fbd from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0xb2140d(0x11d)]='segment:create';[a28_0xb2140d(0xf9)]=a28_0xb2140d(0x12a);async[a28_0xb2140d(0x122)](_0x3699c7){const _0x8e95c5=a28_0xb2140d;console[_0x8e95c5(0x126)](a28_0x353fbd['yellow'](_0x8e95c5(0xf4))),console[_0x8e95c5(0x126)](a28_0x353fbd[_0x8e95c5(0x10b)](_0x8e95c5(0x11a)));const {options:_0x5ba8c7,args:_0x2ae9dd,tdx:_0xedd13f}=_0x3699c7,_0x48897d=_0x5ba8c7;if(_0x2ae9dd[_0x8e95c5(0x128)]===0x0)return console[_0x8e95c5(0x126)](_0x8e95c5(0xf7)),console['error'](_0x8e95c5(0x113)),console[_0x8e95c5(0x126)]('Examples:'),console[_0x8e95c5(0x126)](_0x8e95c5(0xfa)),console[_0x8e95c5(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x8e95c5(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x296dd3=_0x2ae9dd[0x0],_0x1e2e77=_0x5ba8c7[_0x8e95c5(0xf8)];let _0x17814b=_0x296dd3;_0x1e2e77&&!_0x296dd3[_0x8e95c5(0x10c)]('/')&&(_0x17814b=_0x1e2e77+'/'+_0x296dd3,_0x48897d[_0x8e95c5(0x102)]&&console[_0x8e95c5(0x126)](_0x8e95c5(0x123)+_0x17814b));const _0x37b1e2=parsePath(_0x17814b);if(_0x37b1e2['segments'][_0x8e95c5(0x128)]<0x2)return console[_0x8e95c5(0x126)](_0x8e95c5(0xf6)),console[_0x8e95c5(0x126)](_0x8e95c5(0x125)),0x1;const _0x385b90=_0x37b1e2[_0x8e95c5(0xfe)][0x0],_0x32e485=getBaseName(_0x17814b),_0x519304=getParentPath(_0x17814b);_0x48897d[_0x8e95c5(0x102)]&&(console[_0x8e95c5(0x126)](_0x8e95c5(0x108)+_0x48897d[_0x8e95c5(0x120)]),console[_0x8e95c5(0x126)](_0x8e95c5(0xfc)+_0x17814b),console['error'](_0x8e95c5(0x103)+_0x385b90),console[_0x8e95c5(0x126)](_0x8e95c5(0x115)+_0x32e485),console[_0x8e95c5(0x126)]('Parent\x20path:\x20'+_0x519304));const _0x3dc6b1=await withSpinner(_0x8e95c5(0x11c)+_0x385b90+_0x8e95c5(0x11e),()=>_0xedd13f['segment']['resolveParentId'](_0x385b90),{'verbose':_0x48897d['verbose']}),_0x4d2973=_0x3dc6b1[_0x8e95c5(0x104)];let _0x25eaa9;if(_0x37b1e2[_0x8e95c5(0xfe)][_0x8e95c5(0x128)]>0x2){const _0x2b13a0=await withSpinner(_0x8e95c5(0x105)+_0x519304+_0x8e95c5(0x11e),()=>_0xedd13f[_0x8e95c5(0xff)][_0x8e95c5(0x12c)](_0x519304),{'verbose':_0x48897d[_0x8e95c5(0x102)]}),_0x46d533=_0x2b13a0['data'];if(_0x46d533[_0x8e95c5(0x101)]!==_0x8e95c5(0x10a)&&_0x46d533[_0x8e95c5(0x101)]!==_0x8e95c5(0x117))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x25eaa9=_0x46d533[_0x8e95c5(0x114)];}else{if(_0x48897d[_0x8e95c5(0x10a)]){const _0x67d437=await withSpinner(_0x8e95c5(0x11b)+_0x48897d[_0x8e95c5(0x10a)]+_0x8e95c5(0x11e),()=>_0xedd13f[_0x8e95c5(0xff)][_0x8e95c5(0x10d)](_0x4d2973,_0x48897d['folder']),{'verbose':_0x48897d[_0x8e95c5(0x102)]});_0x25eaa9=_0x67d437[_0x8e95c5(0x104)];}}_0x48897d[_0x8e95c5(0x102)]&&_0x25eaa9&&console[_0x8e95c5(0x126)](_0x8e95c5(0x116)+_0x25eaa9);const _0x5119b1=await loadJSONFromOptions(_0x48897d['rule'],_0x48897d[_0x8e95c5(0x109)]),_0x2c4715={'name':_0x32e485,'description':_0x48897d[_0x8e95c5(0xf9)],'rule':_0x5119b1,'kind':_0x48897d[_0x8e95c5(0x129)]!==undefined?parseInt(_0x48897d['kind'],0xa):undefined,'isVisible':_0x48897d[_0x8e95c5(0x124)]?![]:undefined,'segmentFolderId':_0x25eaa9,'countPopulation':_0x48897d[_0x8e95c5(0x10e)]?![]:undefined},_0x43c7b8=await withSpinner(_0x8e95c5(0x107)+_0x32e485+_0x8e95c5(0x11e),()=>_0xedd13f[_0x8e95c5(0xff)][_0x8e95c5(0x127)](_0x4d2973,_0x2c4715),{'verbose':_0x48897d['verbose']}),_0x33726e=_0x43c7b8[_0x8e95c5(0x104)];return console[_0x8e95c5(0x126)](_0x8e95c5(0x118)+_0x33726e[_0x8e95c5(0x11d)]+_0x8e95c5(0x119)+_0x33726e['id']),_0x17814b!==_0x296dd3&&console[_0x8e95c5(0x126)](_0x8e95c5(0x11f)+_0x17814b),await handleSDKOutput([_0x33726e],_0x48897d),0x0;}}function a28_0x21c2(_0x42015a,_0x330754){_0x42015a=_0x42015a-0xf4;const _0x19834f=a28_0x1983();let _0x21c265=_0x19834f[_0x42015a];return _0x21c265;}function a28_0x1983(){const _0x5b9a2e=['ruleFile','folder','yellow','includes','resolveFolderId','noCountPopulation','16906681cGVTSJ','2647939blSdIE','7571032zZMALl','10ekmnQE','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','folderId','Segment\x20name:\x20','Resolved\x20folder\x20ID:\x20','parent','β\x20Created\x20segment\x20\x27','\x27\x20with\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20folder\x20\x27','Resolving\x20parent\x20segment\x20\x27','name','\x27...','\x20\x20\x20Path:\x20','site','2710aFzYvZ','execute','Resolved\x20relative\x20path\x20to:\x20','invisible','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','error','createSegment','length','kind','Create\x20child\x20segment\x20with\x20filtering\x20rules','1287ZtVAMQ','resolvePathToResource','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','1251762vLFAPr','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentPath','description','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','351fSsDpt','Target\x20path:\x20','1354008UQfEMe','segments','segment','1oXNsRW','type','verbose','Parent:\x20','data','Resolving\x20folder\x20path\x20\x27','3488lDNZhi','Creating\x20segment\x20\x27','Site:\x20'];a28_0x1983=function(){return _0x5b9a2e;};return a28_0x1983();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a29_0x2217(_0x8fa56a,_0x4a7932){_0x8fa56a=_0x8fa56a-0x1dc;const _0x34828a=a29_0x3482();let _0x221734=_0x34828a[_0x8fa56a];return _0x221734;}const a29_0x2e4fb9=a29_0x2217;(function(_0x5b3a08,_0x4d445d){const _0x398c1d=a29_0x2217,_0x4e7e95=_0x5b3a08();while(!![]){try{const _0x592b63=-parseInt(_0x398c1d(0x1e7))/0x1*(parseInt(_0x398c1d(0x1f2))/0x2)+parseInt(_0x398c1d(0x1f4))/0x3*(parseInt(_0x398c1d(0x1e6))/0x4)+-parseInt(_0x398c1d(0x1e1))/0x5*(parseInt(_0x398c1d(0x1e3))/0x6)+-parseInt(_0x398c1d(0x1dc))/0x7+parseInt(_0x398c1d(0x1f5))/0x8+-parseInt(_0x398c1d(0x1ed))/0x9+parseInt(_0x398c1d(0x1eb))/0xa;if(_0x592b63===_0x4d445d)break;else _0x4e7e95['push'](_0x4e7e95['shift']());}catch(_0xe2be3a){_0x4e7e95['push'](_0x4e7e95['shift']());}}}(a29_0x3482,0xd89f0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a29_0x3482(){const _0x2f2a47=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','3813750gSNVka','length','Error:\x20Parent\x20segment\x20name\x20is\x20required','Parent\x20segment:\x20','parentSegment','2nYKkAB','json','441zESsPZ','5885568bmJQSr','\x20field','error','7832216DdTmqL','List\x20available\x20fields\x20for\x20segmentation','data','listFields','segment','1330975yNdBBw','verbose','18yHkkwk','Site:\x20','execute','11716YHVGwn','1025561bQCxTu','description','Listing\x20fields\x20for\x20\x27','segment:fields','30878050nGsETW'];a29_0x3482=function(){return _0x2f2a47;};return a29_0x3482();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a29_0x2e4fb9(0x1ea);[a29_0x2e4fb9(0x1e8)]=a29_0x2e4fb9(0x1dd);async[a29_0x2e4fb9(0x1e5)](_0x15c94c){const _0x16f691=a29_0x2e4fb9,{options:_0xa6186d,args:_0x230b41,tdx:_0x849e77}=_0x15c94c,_0xe77053=_0x230b41[0x0]||_0xa6186d[_0x16f691(0x1f1)];if(!_0xe77053)return console['error'](_0x16f691(0x1ef)),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0x16f691(0x1ec)),0x1;_0xa6186d[_0x16f691(0x1e2)]&&(console['error'](_0x16f691(0x1e4)+_0xa6186d['site']),console[_0x16f691(0x1f7)](_0x16f691(0x1f0)+_0xe77053));const _0x4de715=await withSpinner(_0x16f691(0x1e9)+_0xe77053+'\x27...',()=>_0x849e77[_0x16f691(0x1e0)][_0x16f691(0x1df)](_0xe77053),{'verbose':_0xa6186d[_0x16f691(0x1e2)]}),_0x5eaed2=_0x4de715[_0x16f691(0x1de)];console[_0x16f691(0x1f7)]('β\x20Found\x20'+_0x5eaed2[_0x16f691(0x1ee)]+_0x16f691(0x1f6)+(_0x5eaed2['length']!==0x1?'s':''));if(_0xa6186d[_0x16f691(0x1f3)]||_0xa6186d['jsonl'])return await handleSDKOutput(_0x5eaed2,_0xa6186d),0x0;return displayFieldsHumanReadable(_0x5eaed2,_0xe77053),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x3517d2=a30_0x312f;function a30_0x10fb(){const _0x36f80a=['content','\x20\x20Target:\x20','258410YEvoiO','counts','\x20journeys','parent_segment','cwd','journeys','execute','6lGzuwB','3146696TULoAR','segment:pull','journeyVersions','12GqeTnQ','parentSegment','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20segments','Target\x20resource:\x20','β\x20Context\x20set:\x20','\x27...','\x20changed\x20files','utf-8','Write\x20','663804iVSUTL','length','\x20files?','8904504luHMdO','\x0aError:','data','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','repeat','resourceName','activations','red','\x20files\x20to\x20','1514242tPjUob','segments','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20with\x20','\x20versions)','targetDir','type','\x20=\x20','-\x20no\x20files\x20written','1015737MpNeNB','segment','308480OfQYSf','\x0aPull\x20summary\x20for\x20\x27','helpText','site','parentName','cyan','yellow','isNew','hasChanges','β\x20Pulled\x20','\x20\x20π―\x20','absolutePath','session','Site:\x20','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)','green','relativePath','errorCode','files','description','dirname','filter','verbose','error','dim','\x20activations','file','Aborted.','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'];a30_0x10fb=function(){return _0x36f80a;};return a30_0x10fb();}(function(_0x2c27a2,_0xd63bac){const _0x3af7b3=a30_0x312f,_0x3ad8d8=_0x2c27a2();while(!![]){try{const _0x1c05b7=parseInt(_0x3af7b3(0x114))/0x1+parseInt(_0x3af7b3(0xfa))/0x2*(-parseInt(_0x3af7b3(0x11f))/0x3)+-parseInt(_0x3af7b3(0xfb))/0x4+-parseInt(_0x3af7b3(0xf3))/0x5*(parseInt(_0x3af7b3(0xfe))/0x6)+parseInt(_0x3af7b3(0x10b))/0x7+-parseInt(_0x3af7b3(0x121))/0x8+-parseInt(_0x3af7b3(0x108))/0x9;if(_0x1c05b7===_0xd63bac)break;else _0x3ad8d8['push'](_0x3ad8d8['shift']());}catch(_0x4b7ee5){_0x3ad8d8['push'](_0x3ad8d8['shift']());}}}(a30_0x10fb,0xbb8df));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x6a4a8e from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x47efcf from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a30_0x312f(_0x5bc20c,_0x436b3e){_0x5bc20c=_0x5bc20c-0xf3;const _0x10fb6e=a30_0x10fb();let _0x312fff=_0x10fb6e[_0x5bc20c];return _0x312fff;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a30_0x3517d2(0xfc);[a30_0x3517d2(0x134)]=a30_0x3517d2(0x116);async[a30_0x3517d2(0xf9)](_0x4f5f7a){const _0x204608=a30_0x3517d2,{options:_0x29380d,args:_0x27b8aa,tdx:_0x50655c}=_0x4f5f7a,_0x309ce0=_0x29380d,_0x38606d=await resolveTarget({'arg':_0x27b8aa[0x0],'contextParent':_0x29380d[_0x204608(0xff)],'cwd':process[_0x204608(0xf7)]()});if(!isSuccessfulResolution(_0x38606d))return _0x38606d[_0x204608(0x132)]==='no_parent'?(console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x127)](_0x204608(0x118))),console[_0x204608(0x138)](_0x204608(0x12f)),console[_0x204608(0x138)](_0x204608(0x13e)),console[_0x204608(0x138)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file')):(console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x112)]('Error:\x20'+_0x38606d['message']+'\x0a')),_0x38606d[_0x204608(0x123)]&&console['error'](a30_0x6a4a8e['cyan'](_0x38606d[_0x204608(0x123)]))),0x1;const _0x43c281=_0x38606d[_0x204608(0x125)],_0x10526e=_0x38606d[_0x204608(0x11b)],_0x1b7dd0=_0x38606d[_0x204608(0x11c)]===_0x204608(0x13b)?_0x38606d[_0x204608(0x110)]:undefined;_0x309ce0[_0x204608(0x137)]&&(console[_0x204608(0x138)](_0x204608(0x12e)+_0x309ce0[_0x204608(0x124)]),console[_0x204608(0x138)](_0x204608(0x13d)+_0x43c281),_0x1b7dd0&&console[_0x204608(0x138)](_0x204608(0x102)+_0x1b7dd0));const _0x11e369=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x43c281+_0x204608(0x104),_0x4a2f10=>_0x50655c[_0x204608(0x120)]['pullSegments'](_0x43c281,{'targetDir':_0x10526e,'targetResourceName':_0x1b7dd0,'verbose':_0x309ce0['verbose'],'progress':{'update':_0x1e827b=>{const _0x1aeb22=_0x204608;_0x4a2f10['setPhase'](_0x1e827b),_0x309ce0[_0x1aeb22(0x137)]&&console[_0x1aeb22(0x138)]('\x20\x20'+_0x1e827b);}}}),{'verbose':_0x309ce0[_0x204608(0x137)]}),_0x521802=_0x11e369[_0x204608(0x10d)];if(_0x521802[_0x204608(0xf4)]['segments']===0x0&&_0x521802['counts']['journeys']===0x0)return console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x127)](_0x204608(0x10e)+_0x521802[_0x204608(0x125)]+'\x27')),0x0;const _0x2a86a7=_0x521802[_0x204608(0x133)]['filter'](_0x53435b=>_0x53435b[_0x204608(0x128)]),_0x36cf0b=_0x521802[_0x204608(0x133)][_0x204608(0x136)](_0x467f98=>!_0x467f98[_0x204608(0x128)]&&_0x467f98['hasChanges']),_0x441ef7=_0x521802['files'][_0x204608(0x136)](_0x243bf3=>!_0x243bf3[_0x204608(0x128)]&&!_0x243bf3[_0x204608(0x129)]);console[_0x204608(0x138)](_0x204608(0x122)+_0x521802['parentName']+'\x27:'),console[_0x204608(0x138)](_0x204608(0x12b)+a30_0x6a4a8e['cyan'](_0x521802[_0x204608(0xf4)][_0x204608(0x115)]+_0x204608(0x101))+_0x204608(0x119)+a30_0x6a4a8e[_0x204608(0x126)](_0x521802[_0x204608(0xf4)][_0x204608(0x111)]+_0x204608(0x13a)));if(_0x521802['counts'][_0x204608(0xf8)]>0x0){const _0x114251=_0x521802[_0x204608(0xf4)][_0x204608(0xfd)]>_0x521802[_0x204608(0xf4)]['journeys']?'\x20('+_0x521802[_0x204608(0xf4)]['journeyVersions']+_0x204608(0x11a):'';console[_0x204608(0x138)]('\x20\x20πΊοΈ\x20\x20'+a30_0x6a4a8e[_0x204608(0x126)](_0x521802[_0x204608(0xf4)]['journeys']+_0x204608(0xf5))+a30_0x6a4a8e[_0x204608(0x139)](_0x114251));}console['error']('\x20\x20'+a30_0x6a4a8e['green']('+\x20'+_0x2a86a7['length']+'\x20new\x20files')),console[_0x204608(0x138)]('\x20\x20'+a30_0x6a4a8e['yellow']('~\x20'+_0x36cf0b[_0x204608(0x109)]+_0x204608(0x105))),console[_0x204608(0x138)]('\x20\x20'+a30_0x6a4a8e[_0x204608(0x139)]('=\x20'+_0x441ef7['length']+'\x20unchanged\x20files')),console[_0x204608(0x138)](_0x204608(0x140)+a30_0x6a4a8e[_0x204608(0x126)](_0x521802[_0x204608(0x11b)])+'\x0a');if(_0x36cf0b[_0x204608(0x109)]>0x0)for(const _0x471fed of _0x36cf0b){console[_0x204608(0x138)]('\x0aChanges\x20to\x20\x27'+_0x471fed[_0x204608(0x131)]+'\x27:'),console[_0x204608(0x138)]('β'[_0x204608(0x10f)](0x3c)),console[_0x204608(0x138)](_0x471fed['diff']),console['error']('β'[_0x204608(0x10f)](0x3c));}if(_0x309ce0['dryRun'])return console[_0x204608(0x138)](a30_0x6a4a8e['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2a86a7['length']===0x0&&_0x36cf0b[_0x204608(0x109)]===0x0)return console['error'](a30_0x6a4a8e[_0x204608(0x130)]('β\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x521802[_0x204608(0x125)]},_0x309ce0['session']),console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x130)](_0x204608(0x103)+a30_0x6a4a8e[_0x204608(0x139)](_0x204608(0xf6))+_0x204608(0x11d)+a30_0x6a4a8e[_0x204608(0x126)](_0x521802[_0x204608(0x125)]))),0x0;if(!_0x309ce0['yes']){if(!isInteractive())return console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x112)](_0x204608(0x10c)),_0x204608(0x100)),console['error'](a30_0x6a4a8e[_0x204608(0x139)](_0x204608(0x117))),0x1;const _0x4d0555=await confirmKey(_0x204608(0x107)+(_0x2a86a7[_0x204608(0x109)]+_0x36cf0b[_0x204608(0x109)])+_0x204608(0x10a));if(!_0x4d0555)return console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x127)](_0x204608(0x13c)),_0x204608(0x11e)),0x1;}for(const _0x507660 of _0x521802[_0x204608(0x133)]){if(_0x507660['isNew']||_0x507660[_0x204608(0x129)]){const _0x4aeca3=a30_0x47efcf[_0x204608(0x135)](_0x507660[_0x204608(0x12c)]);!existsSync(_0x4aeca3)&&mkdirSync(_0x4aeca3,{'recursive':!![]}),writeFileSync(_0x507660['absolutePath'],_0x507660[_0x204608(0x13f)],_0x204608(0x106));}}return console[_0x204608(0x138)](a30_0x6a4a8e['green'](_0x204608(0x12a)+(_0x2a86a7[_0x204608(0x109)]+_0x36cf0b[_0x204608(0x109)])+_0x204608(0x113)+_0x521802['targetDir'])),saveSessionContext({'parent_segment':_0x521802[_0x204608(0x125)]},_0x309ce0[_0x204608(0x12d)]),console[_0x204608(0x138)](a30_0x6a4a8e[_0x204608(0x130)](_0x204608(0x103)+a30_0x6a4a8e['dim'](_0x204608(0xf6))+'\x20=\x20'+a30_0x6a4a8e['cyan'](_0x521802[_0x204608(0x125)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x123959=a31_0x3a8a;(function(_0x59153b,_0x7461c8){const _0x328b36=a31_0x3a8a,_0x589768=_0x59153b();while(!![]){try{const _0x145b5d=parseInt(_0x328b36(0x173))/0x1+parseInt(_0x328b36(0x154))/0x2*(parseInt(_0x328b36(0x177))/0x3)+parseInt(_0x328b36(0x149))/0x4*(-parseInt(_0x328b36(0x113))/0x5)+-parseInt(_0x328b36(0x175))/0x6+parseInt(_0x328b36(0x14f))/0x7+-parseInt(_0x328b36(0x12a))/0x8*(-parseInt(_0x328b36(0x118))/0x9)+parseInt(_0x328b36(0x17e))/0xa*(-parseInt(_0x328b36(0x130))/0xb);if(_0x145b5d===_0x7461c8)break;else _0x589768['push'](_0x589768['shift']());}catch(_0x4776c7){_0x589768['push'](_0x589768['shift']());}}}(a31_0x2bd0,0x3d7a7));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_0x12d151 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';function a31_0x2bd0(){const _0x2e230b=['Parent\x20segment:\x20','\x20\x20Segments:\x20','folders','folderId','\x20to\x20update','1492540FPVEZG','\x20updated','/app/ps/','createdAt','audienceId','2eKscfy','join','connection','\x20activations]','yellow','updatedAt','\x20new','Fetching\x20existing\x20segments...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','toCreate','toDelete','journeyBundleId','user','length','description','journey','\x20to\x20delete','\x20\x20Activations:\x20','cyan','segments','Error\x20parsing\x20YAML:\x20','red','deleted','name','/j/da/je','.yaml','Fetching\x20existing\x20folders...','execute','Fetching\x20parent\x20segment\x20details...','\x20folders\x20to\x20create','\x20unchanged','37237IOuGGs','idToName','194136bggrEJ','no_parent','1127145NLfvgY','isNew','map','journeyId','parentName','errorCode','\x20\x20πΊοΈ\x20\x20Journeys:','10VTUjoj','get','set','New\x20journey:','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','helpText','parent_name','Delete\x20journey:','(Journey\x20will\x20be\x20deleted)','paused','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','activations','filter','delete','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','segment\x20or\x20journey','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','segment','then','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','unchanged','\x20\x20Source:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20to\x20create','Fetching\x20connections\x20for\x20name\x20resolution...','dim','\x20\x20π\x20Segments:','changed','\x20\x20\x20\x20','targetDir','new','\x20created','\x20deleted','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)','results','Aborted.','getOutputSchemaWithCache','\x20YAML\x20files\x20found','yes','dryRun','existingJourney','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','diff','yamlConfig','add','listJourneysWithDetailsFromParentSegment','endsWith','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','205drHuCn','type','Changes\x20to\x20journey:','toString','site','81WmnGtP','message','segmentFolderId','Delete\x20segment:','error','buildUserMaps','journeys','Source\x20directory:\x20','\x0aError:','\x20changed','getJourney','Changes\x20to:','list','getParent','attributes','No\x20','Fetching\x20users\x20for\x20email\x20resolution...','resolveParentId','182304SqzbcN','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','Error:\x20','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Preparing\x20journeys...','listSegments','1701051cCUYiP','updated','journeyBundleName','cwd','created','isScoped','\x20changes?','listActivations','New\x20segment:','Error:\x20Directory\x20not\x20found:\x20','push','journeysOnly','nameToId','\x0aPush\x20summary\x20for\x20\x27','versionNumber','folderPath','all','verbose','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','blue','repeat','segment:push','data','β\x20All\x20journeys\x20are\x20up\x20to\x20date','green','38288oRPjwt'];a31_0x2bd0=function(){return _0x2e230b;};return a31_0x2bd0();}function a31_0x3a8a(_0x2eb2cb,_0x55d14b){_0x2eb2cb=_0x2eb2cb-0xf6;const _0x2bd0f0=a31_0x2bd0();let _0x3a8a0a=_0x2bd0f0[_0x2eb2cb];return _0x3a8a0a;}export class SegmentPushCommand extends BaseCommand{['name']=a31_0x123959(0x145);[a31_0x123959(0x162)]=a31_0x123959(0x12d);async[a31_0x123959(0x16f)](_0x49a49c){const _0x113a1b=a31_0x123959,{options:_0x1b472e,args:_0x37b683,tdx:_0x284d80}=_0x49a49c,_0xcb9450=_0x1b472e,_0x5ee329=await resolveTarget({'arg':_0x37b683[0x0],'contextParent':_0x1b472e['parentSegment'],'cwd':process[_0x113a1b(0x133)]()});if(!isSuccessfulResolution(_0x5ee329))return _0x5ee329[_0x113a1b(0x17c)]===_0x113a1b(0x176)?(console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x188))),console[_0x113a1b(0x11c)](_0x113a1b(0x104)),console[_0x113a1b(0x11c)](_0x113a1b(0xf9)),console[_0x113a1b(0x11c)](_0x113a1b(0x15c))):(console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x12c)+_0x5ee329['message']+'\x0a')),_0x5ee329[_0x113a1b(0x183)]&&console[_0x113a1b(0x11c)](a31_0x12d151['cyan'](_0x5ee329['helpText']))),0x1;if(_0x5ee329[_0x113a1b(0x114)]===_0x113a1b(0x184))return console['error'](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x139)+_0x5ee329['targetDir']+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151['cyan'](_0x113a1b(0x182))),0x1;const _0x7bc4c4=_0x5ee329[_0x113a1b(0x17b)],_0x464180=_0x5ee329[_0x113a1b(0x100)],_0x188e9d=_0x5ee329[_0x113a1b(0x114)]==='file'?_0x5ee329['filePath']:undefined,_0xcc1067=getScopedDetails(_0x5ee329),_0x374b81=_0xcc1067?.[_0x113a1b(0x135)]??![],_0x320dd0=_0xcc1067?.['scopedFolderPath']??'';if(!existsSync(_0x464180))return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x139)+_0x464180+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x166)](_0x113a1b(0x182))),0x1;_0xcb9450['verbose']&&(console[_0x113a1b(0x11c)]('Site:\x20'+_0xcb9450[_0x113a1b(0x117)]),console[_0x113a1b(0x11c)](_0x113a1b(0x14a)+_0x7bc4c4),console['error'](_0x113a1b(0x11f)+_0x464180),_0x374b81&&console['error']('Scoped\x20to\x20folder:\x20'+_0x320dd0));const _0x42b514=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7bc4c4+'\x27...',()=>_0x284d80[_0x113a1b(0x18f)][_0x113a1b(0x129)](_0x7bc4c4),{'verbose':_0xcb9450['verbose']}),_0x8c26fb=_0x42b514[_0x113a1b(0x146)],[_0x43671b,_0x139acf,_0x4e1992,_0x458d0b,_0x39d864]=await Promise[_0x113a1b(0x140)]([withSpinner(_0x113a1b(0x170),()=>_0x284d80[_0x113a1b(0x18f)][_0x113a1b(0x125)](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner(_0x113a1b(0x15b),()=>_0x284d80['segment'][_0x113a1b(0x12f)](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner(_0x113a1b(0x16e),()=>_0x284d80[_0x113a1b(0x18f)]['listFolders'](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x284d80[_0x113a1b(0x163)][_0x113a1b(0x110)](_0x8c26fb,{'includeAllVersions':!![]}),{'verbose':_0xcb9450[_0x113a1b(0x141)]}),withSpinner(_0x113a1b(0x128),()=>_0x284d80[_0x113a1b(0x160)][_0x113a1b(0x11d)](),{'verbose':_0xcb9450[_0x113a1b(0x141)]})[_0x113a1b(0x190)](_0x2f7668=>_0x2f7668[_0x113a1b(0x146)])]),_0x1882ba=_0x43671b[_0x113a1b(0x146)],_0x4e992d=extractRootFolderId(_0x1882ba),_0x4732aa=_0x139acf['data'],_0x22dd3c=_0x4e1992[_0x113a1b(0x146)],{journeys:_0x1d0541,activationStepsById:_0x25c4b2}=_0x458d0b['data'],_0x333a8d=new Map(_0x1d0541[_0x113a1b(0x179)](_0x32c153=>[_0x32c153['id'],_0x32c153])),_0x4f74fd=_0x1d0541[_0x113a1b(0x179)](_0x27f1e1=>({'id':_0x27f1e1['id'],'name':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x16b)],'journeyBundleName':_0x27f1e1['attributes'][_0x113a1b(0x132)]||'','journeyBundleId':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x15f)]||'','versionNumber':_0x27f1e1['attributes'][_0x113a1b(0x13e)],'description':_0x27f1e1['attributes'][_0x113a1b(0x162)],'state':_0x27f1e1[_0x113a1b(0x126)]['state'],'paused':_0x27f1e1['attributes'][_0x113a1b(0x187)],'audienceId':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x153)],'folderId':_0x27f1e1['relationships']?.['parentFolder']?.['data']?.['id'],'createdAt':_0x27f1e1['attributes'][_0x113a1b(0x152)],'updatedAt':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x159)]})),{emailToId:_0x96534f,idToEmail:_0x4ff01f}=_0x39d864,_0x34bc40=await withSpinner(_0x113a1b(0xfb),async()=>{const _0x5e9738=_0x113a1b,_0x5764b1=await _0x284d80[_0x5e9738(0x156)][_0x5e9738(0x124)]();return buildConnectionMaps(_0x5764b1);},{'verbose':_0xcb9450[_0x113a1b(0x141)]})[_0x113a1b(0x190)](_0x25c0f4=>_0x25c0f4[_0x113a1b(0x146)]),_0xfb1b00=_0x34bc40['nameToId'],_0x298e4e=_0x34bc40[_0x113a1b(0x174)],_0x4aec5e=_0x34bc40['nameToType'],_0x180c6e={'emailToIdMap':_0x96534f,'connectionNameToIdMap':_0xfb1b00,'connectionNameToTypeMap':_0x4aec5e,'getSchema':_0x5c115d=>_0x284d80[_0x113a1b(0x156)][_0x113a1b(0x107)](_0x5c115d)};let {pathToId:_0xff9239,idToPath:_0x26e72c}=buildFolderMaps(_0x22dd3c);const _0x3ba3ae=buildSegmentLookupMap(_0x4732aa,_0x26e72c),_0x4fe2ba=buildSegmentNameToIdMap(_0x4732aa),_0x2408a9=buildJourneyBundleLookupMap(_0x4f74fd,_0x26e72c);let _0x6ca78a;if(_0x188e9d){if(!_0x188e9d[_0x113a1b(0x111)]('.yml')&&!_0x188e9d[_0x113a1b(0x111)](_0x113a1b(0x16d)))return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0xf6)+_0x188e9d+'\x0a')),0x1;_0x6ca78a=[_0x188e9d];}else _0x6ca78a=findYamlFiles(_0x464180);if(_0x6ca78a[_0x113a1b(0x161)]===0x0)return console['error'](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x18c)+_0x464180+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x166)](_0x113a1b(0x12b))),0x1;let _0x41bfdc,_0x36c611;try{const _0x9c688d=parseAndClassifyYamlFiles(_0x6ca78a,_0x464180,{'skipSegments':_0xcb9450['journeysOnly']});_0x41bfdc=_0x9c688d['segments'],_0x36c611=_0x9c688d[_0x113a1b(0x11e)];const _0x12c525=validateParsedFiles(_0x9c688d,_0x464180);if(_0x12c525[_0x113a1b(0x161)]>0x0)return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)]('\x0aValidation\x20failed:')),console[_0x113a1b(0x11c)](formatValidationErrors(_0x12c525)),console['error'](a31_0x12d151[_0x113a1b(0x158)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0xd55a2a){return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x168)+(_0xd55a2a instanceof Error?_0xd55a2a[_0x113a1b(0x119)]:_0xd55a2a))),0x1;}if(_0x41bfdc[_0x113a1b(0x161)]===0x0&&_0x36c611[_0x113a1b(0x161)]===0x0){const _0x2506aa=_0xcb9450[_0x113a1b(0x13b)]?'journey':_0x113a1b(0x18d);return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x127)+_0x2506aa+_0x113a1b(0x108))),0x0;}const _0x1d6a3e=new Map();_0x4732aa[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4732aa,async _0x2c380d=>{const _0x527628=a31_0x3a8a,_0x17a77f=await _0x284d80[_0x527628(0x18f)][_0x527628(0x137)](_0x8c26fb,_0x2c380d['id']);_0x1d6a3e[_0x527628(0x180)](_0x2c380d['id'],_0x17a77f);});},{'verbose':_0xcb9450[_0x113a1b(0x141)]});const {segmentFiles:_0x32fd24,foldersToCreate:_0x4b2e62}=await prepareSegmentFiles(_0x41bfdc,{'segmentByFolderAndName':_0x3ba3ae,'activationsBySegmentId':_0x1d6a3e,'folderPathToId':_0xff9239,'idToEmailMap':_0x4ff01f,'connectionIdToNameMap':_0x298e4e},_0x180c6e,_0x374b81,_0x320dd0),_0x5c486e=_0x188e9d?[]:findSegmentsToDelete(_0x4732aa,_0x41bfdc[_0x113a1b(0x179)](({yamlConfig:_0x18e93f,folderPath:_0x48b074})=>({'yamlConfig':_0x18e93f,'folderPath':resolveTDFolderPath(_0x48b074,_0x374b81,_0x320dd0)})),_0x26e72c,_0x320dd0,_0x374b81),{journeyFiles:_0x47e34c,foldersToCreate:_0x414b61}=await withProgressSpinner(_0x113a1b(0x12e),async _0x277cb7=>prepareJourneyFiles(_0x36c611,{'fetchJourney':async _0x1e81e2=>_0x284d80['journey'][_0x113a1b(0x122)](_0x1e81e2[_0x113a1b(0x17a)]),'journeyBundlesByFolderAndName':_0x2408a9,'folderPathToId':_0xff9239,'idToEmailMap':_0x4ff01f,'connectionIdToNameMap':_0x298e4e,'existingSegments':_0x4732aa,'parentId':_0x8c26fb,'deps':_0x284d80,'progress':{'update':_0x4b1903=>{const _0x3782ed=_0x113a1b;_0x277cb7['setPhase'](_0x4b1903),_0xcb9450[_0x3782ed(0x141)]&&console['error']('\x20\x20'+_0x4b1903);}},'journeyById':_0x333a8d,'activationStepsById':_0x25c4b2},_0x374b81,_0x320dd0),{'verbose':_0xcb9450[_0x113a1b(0x141)]})['then'](_0x34a3a2=>_0x34a3a2[_0x113a1b(0x146)]);for(const _0x7d9b68 of _0x414b61){_0x4b2e62[_0x113a1b(0x10f)](_0x7d9b68);}const _0x332ac2=_0x188e9d?[]:findJourneysToDelete(_0x4f74fd,_0x36c611[_0x113a1b(0x179)](({yamlConfig:_0x48a949,folderPath:_0xd8461b})=>({'yamlConfig':_0x48a949,'folderPath':resolveTDFolderPath(_0xd8461b,_0x374b81,_0x320dd0)})),_0x26e72c,_0x320dd0,_0x374b81),_0x528c1d=calculatePushStats(_0x32fd24,_0x47e34c,_0x4b2e62,_0x5c486e,_0x332ac2,!!_0xcb9450['delete'],!!_0xcb9450['journeysOnly']),_0x1e1871=_0x528c1d[_0x113a1b(0x167)]['new'],_0xa2c547=_0x528c1d[_0x113a1b(0x167)][_0x113a1b(0xfe)],_0x5d20a5=_0x528c1d['segments'][_0x113a1b(0xf7)],_0x3bfc09=_0x528c1d[_0x113a1b(0x167)][_0x113a1b(0x15e)],_0x3cf048=_0x528c1d[_0x113a1b(0x14c)]['toCreate'],_0x5ebcb3=_0x528c1d[_0x113a1b(0x11e)][_0x113a1b(0x101)],_0x4f796c=_0x528c1d[_0x113a1b(0x11e)][_0x113a1b(0xfe)],_0x4e2779=_0x528c1d['journeys'][_0x113a1b(0xf7)],_0x5b310b=_0x528c1d['journeys'][_0x113a1b(0x15e)],_0x322aea=_0x528c1d[_0x113a1b(0x189)][_0x113a1b(0x140)],_0x1f4c12=_0x528c1d[_0x113a1b(0x189)][_0x113a1b(0x15d)],_0x17fbe2=_0x528c1d[_0x113a1b(0x189)]['toUpdate'],_0x5e47a6=_0x528c1d['activations']['toDelete'];console['error'](_0x113a1b(0x13d)+_0x7bc4c4+'\x27:');_0x3cf048[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151['blue']('π\x20'+_0x3cf048[_0x113a1b(0x161)]+_0x113a1b(0x171)));if(!_0xcb9450['journeysOnly']){console['error'](_0x113a1b(0xfd)),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x1e1871[_0x113a1b(0x161)]+_0x113a1b(0x15a))),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x158)]('~\x20'+_0xa2c547[_0x113a1b(0x161)]+'\x20changed'));if(_0x3bfc09[_0x113a1b(0x161)]>0x0)console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x169)]('-\x20'+_0x3bfc09[_0x113a1b(0x161)]+_0x113a1b(0x164)));else _0x5c486e[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x18b)]&&console['error'](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)](_0x5c486e[_0x113a1b(0x161)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x113a1b(0x11c)]('\x20\x20\x20\x20'+a31_0x12d151[_0x113a1b(0xfc)]('=\x20'+_0x5d20a5[_0x113a1b(0x161)]+_0x113a1b(0x172)));}if(_0x47e34c['length']>0x0||_0x332ac2[_0x113a1b(0x161)]>0x0){console['error'](_0x113a1b(0x17d)),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x5ebcb3[_0x113a1b(0x161)]+_0x113a1b(0x15a))),console['error']('\x20\x20\x20\x20'+a31_0x12d151['yellow']('~\x20'+_0x4f796c[_0x113a1b(0x161)]+_0x113a1b(0x121)));if(_0x5b310b['length']>0x0)console['error'](_0x113a1b(0xff)+a31_0x12d151['red']('-\x20'+_0x5b310b[_0x113a1b(0x161)]+_0x113a1b(0x164)));else _0x332ac2['length']>0x0&&!_0xcb9450[_0x113a1b(0x18b)]&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)](_0x332ac2[_0x113a1b(0x161)]+_0x113a1b(0x142)));console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)]('=\x20'+_0x4e2779[_0x113a1b(0x161)]+_0x113a1b(0x172)));}_0x322aea[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x13b)]&&(console['error'](''),console['error']('\x20\x20Activations:'),_0x1f4c12['length']>0x0&&console[_0x113a1b(0x11c)]('\x20\x20\x20\x20'+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x1f4c12[_0x113a1b(0x161)]+_0x113a1b(0xfa))),_0x17fbe2[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x158)]('~\x20'+_0x17fbe2['length']+_0x113a1b(0x14e))),_0x5e47a6[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x169)]('-\x20'+_0x5e47a6[_0x113a1b(0x161)]+_0x113a1b(0x164))));console[_0x113a1b(0x11c)](_0x113a1b(0xf8)+a31_0x12d151[_0x113a1b(0x166)](_0x464180)+'\x0a');if(_0x3cf048[_0x113a1b(0x161)]>0x0){console[_0x113a1b(0x11c)]('Folders\x20to\x20create:');for(const _0x266894 of _0x3cf048){console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x143)]('+')+'\x20'+_0x266894);}console[_0x113a1b(0x11c)]('');}if(_0x1e1871[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly'])for(const _0x24ea44 of _0x1e1871){const _0x53e4b3=_0x24ea44[_0x113a1b(0x13f)]?_0x24ea44[_0x113a1b(0x13f)]+'/'+_0x24ea44[_0x113a1b(0x10e)][_0x113a1b(0x16b)]:_0x24ea44[_0x113a1b(0x10e)]['name'],_0x5b58a5=_0x24ea44[_0x113a1b(0x10e)]['activations']?.[_0x113a1b(0x161)]||0x0,_0x30f6da=_0x5b58a5>0x0?a31_0x12d151[_0x113a1b(0xfc)]('\x20['+_0x5b58a5+'\x20activations]'):'';console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x148)](_0x113a1b(0x138))+'\x20'+_0x53e4b3+_0x30f6da),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c)),_0x24ea44[_0x113a1b(0x10d)]&&console[_0x113a1b(0x11c)](_0x24ea44[_0x113a1b(0x10d)]),console[_0x113a1b(0x11c)]('β'['repeat'](0x3c));}if(_0x3bfc09['length']>0x0&&!_0xcb9450[_0x113a1b(0x13b)])for(const _0x322dc9 of _0x3bfc09){const _0x311ead=_0x322dc9[_0x113a1b(0x11a)]?_0x26e72c[_0x113a1b(0x17f)](_0x322dc9[_0x113a1b(0x11a)][_0x113a1b(0x116)]())||'':'',_0x11a958=_0x311ead?_0x311ead+'/'+_0x322dc9[_0x113a1b(0x16b)]:_0x322dc9[_0x113a1b(0x16b)],_0x4b36c0=_0x1d6a3e[_0x113a1b(0x17f)](_0x322dc9['id'])||[],_0x18b5d3=_0x4b36c0['length']>0x0?a31_0x12d151[_0x113a1b(0xfc)]('\x20['+_0x4b36c0[_0x113a1b(0x161)]+_0x113a1b(0x157)):'';console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151['red'](_0x113a1b(0x11b))+'\x20'+_0x11a958+_0x18b5d3),console['error']('β'[_0x113a1b(0x144)](0x3c));const _0x5595bb=segmentWithActivationsToYaml(_0x322dc9,_0x4b36c0,undefined,_0x4ff01f,_0x298e4e),_0x3cfdbf=segmentToYamlString(_0x5595bb),_0x5a4ef5=generateDiff(_0x3cfdbf,'');console[_0x113a1b(0x11c)](formatDiffWithColors(_0x5a4ef5)),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c));}const _0x5bcd35=_0x32fd24[_0x113a1b(0x18a)](_0x1b2612=>!_0x1b2612[_0x113a1b(0x178)]&&_0x1b2612[_0x113a1b(0x10d)]);if(_0x5bcd35[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x13b)])for(const _0x6c3355 of _0x5bcd35){const _0x169e16=_0x6c3355[_0x113a1b(0x13f)]?_0x6c3355[_0x113a1b(0x13f)]+'/'+_0x6c3355[_0x113a1b(0x10e)][_0x113a1b(0x16b)]:_0x6c3355[_0x113a1b(0x10e)][_0x113a1b(0x16b)];console['error']('\x0a'+a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x123))+'\x20'+_0x169e16),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c)),console[_0x113a1b(0x11c)](_0x6c3355[_0x113a1b(0x10d)]),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c));}if(_0x5ebcb3['length']>0x0)for(const _0x603df of _0x5ebcb3){const _0x1ca895=_0x603df['folderPath']?_0x603df[_0x113a1b(0x13f)]+'/'+_0x603df['yamlConfig'][_0x113a1b(0x16b)]:_0x603df[_0x113a1b(0x10e)][_0x113a1b(0x16b)];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x148)](_0x113a1b(0x181))+'\x20'+_0x1ca895),console[_0x113a1b(0x11c)]('β'['repeat'](0x3c)),_0x603df[_0x113a1b(0x10d)]&&console[_0x113a1b(0x11c)](_0x603df[_0x113a1b(0x10d)]),console['error']('β'[_0x113a1b(0x144)](0x3c));}const _0x2dc502=_0x47e34c['filter'](_0x26743d=>!_0x26743d['isNew']&&_0x26743d[_0x113a1b(0x10d)]);if(_0x2dc502[_0x113a1b(0x161)]>0x0)for(const _0x217e26 of _0x2dc502){const _0x2cfd6e=_0x217e26['folderPath']?_0x217e26[_0x113a1b(0x13f)]+'/'+_0x217e26['yamlConfig'][_0x113a1b(0x16b)]:_0x217e26[_0x113a1b(0x10e)]['name'];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x115))+'\x20'+_0x2cfd6e),console[_0x113a1b(0x11c)]('β'['repeat'](0x3c)),console[_0x113a1b(0x11c)](_0x217e26['diff']),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c));}if(_0x5b310b[_0x113a1b(0x161)]>0x0)for(const _0x1104d3 of _0x5b310b){const _0x4e304f=_0x1104d3[_0x113a1b(0x14d)]?_0x26e72c[_0x113a1b(0x17f)](_0x1104d3[_0x113a1b(0x14d)])||'':'',_0xbfc04a=_0x4e304f?_0x4e304f+'/'+_0x1104d3[_0x113a1b(0x132)]:_0x1104d3[_0x113a1b(0x132)];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x185))+'\x20'+_0xbfc04a),console[_0x113a1b(0x11c)]('β'[_0x113a1b(0x144)](0x3c)),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x186))),console['error']('β'[_0x113a1b(0x144)](0x3c));}if(_0xcb9450[_0x113a1b(0x10a)])return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x44025b=_0xcb9450[_0x113a1b(0x13b)]?![]:_0x1e1871[_0x113a1b(0x161)]>0x0||_0xa2c547[_0x113a1b(0x161)]>0x0||_0x3bfc09['length']>0x0,_0x2e2f16=_0x5ebcb3[_0x113a1b(0x161)]>0x0||_0x4f796c[_0x113a1b(0x161)]>0x0||_0x5b310b[_0x113a1b(0x161)]>0x0,_0x1ce9c4=_0xcb9450[_0x113a1b(0x13b)]?![]:_0x322aea[_0x113a1b(0x161)]>0x0,_0x284e5d=_0x3cf048['length']>0x0;if(!_0x44025b&&!_0x2e2f16&&!_0x1ce9c4&&!_0x284e5d){const _0x3fa4e1=_0xcb9450[_0x113a1b(0x13b)]?_0x113a1b(0x147):'β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)](_0x3fa4e1));if(_0x188e9d&&_0x4e2779[_0x113a1b(0x161)]===0x1){const _0xff4838=_0x4e2779[0x0];if(_0xff4838[_0x113a1b(0x10b)]?.['id']){const _0x10af7a=getConsoleNextUrl(_0xcb9450[_0x113a1b(0x117)],_0x113a1b(0x151)+_0x8c26fb+'/e/'+_0xff4838[_0x113a1b(0x10b)]['id']+_0x113a1b(0x16c));console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x166)](_0x10af7a));}}return 0x0;}const _0x42667d=_0xcb9450['journeysOnly']?_0x5ebcb3[_0x113a1b(0x161)]+_0x4f796c[_0x113a1b(0x161)]+_0x5b310b[_0x113a1b(0x161)]+_0x3cf048[_0x113a1b(0x161)]:_0x1e1871[_0x113a1b(0x161)]+_0xa2c547[_0x113a1b(0x161)]+_0x3bfc09[_0x113a1b(0x161)]+_0x5ebcb3[_0x113a1b(0x161)]+_0x4f796c[_0x113a1b(0x161)]+_0x5b310b['length']+_0x3cf048[_0x113a1b(0x161)]+_0x322aea[_0x113a1b(0x161)];if(!_0xcb9450[_0x113a1b(0x109)]&&_0x42667d>0x0){if(!isInteractive())return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x120)),_0x113a1b(0x18e)),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0xfc)](_0x113a1b(0x10c))),0x1;const _0x13eb15=await confirmKey('Push\x20'+_0x42667d+_0x113a1b(0x136));if(!_0x13eb15)return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x106))),0x1;}const _0x1db7c0={'withProgress':async(_0x48c200,_0xdaede1)=>{const _0x26d857=_0x113a1b,_0x2137a2=await withSpinner(_0x48c200,_0xdaede1,{'verbose':_0xcb9450['verbose']});return{'data':_0x2137a2[_0x26d857(0x146)]};},'logInfo':_0x405939=>console[_0x113a1b(0x11c)](a31_0x12d151['blue']('β\x20'+_0x405939)),'logSuccess':_0x4a95ed=>console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)]('β\x20'+_0x4a95ed)),'logWarning':_0x3694ba=>console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)]('β \x20'+_0x3694ba)),'logDeleted':_0x3ff966=>console[_0x113a1b(0x11c)](a31_0x12d151['red']('β\x20'+_0x3ff966))},_0x1ad35b={'segment':_0x284d80[_0x113a1b(0x18f)],'journey':_0x284d80[_0x113a1b(0x163)],'user':_0x284d80[_0x113a1b(0x160)],'connection':_0x284d80['connection']};_0x3cf048[_0x113a1b(0x161)]>0x0&&(_0xff9239=await executePushFolders(_0x1ad35b,_0x3cf048,_0xff9239,{'parentId':_0x8c26fb},_0x1db7c0));const _0x37429f={'rootFolderId':_0x4e992d,'folderPathToId':_0xff9239,'folderIdToPath':_0x26e72c,'segmentNameToId':_0x4fe2ba,'activationsBySegmentId':_0x1d6a3e,'emailToIdMap':_0x96534f,'idToEmailMap':_0x4ff01f,'connectionNameToIdMap':_0x34bc40[_0x113a1b(0x13c)],'connectionIdToNameMap':_0x34bc40[_0x113a1b(0x174)],'connectionNameToTypeMap':_0x4aec5e},_0x3f9239=await executePushSegments(_0x1ad35b,_0xcb9450['journeysOnly']?[]:_0x32fd24,_0x37429f,{'parentId':_0x8c26fb},_0x1db7c0),_0xb506c3=_0x3f9239[_0x113a1b(0x134)],_0x1a71e3=_0x3f9239[_0x113a1b(0x131)],_0x54dc76=_0x3f9239[_0x113a1b(0x189)][_0x113a1b(0x134)],_0x51f778=_0x3f9239[_0x113a1b(0x189)]['updated'],_0xda9dc3=_0x3f9239[_0x113a1b(0x189)][_0x113a1b(0x16a)],_0x52ea65=await executePushSegmentDeletions(_0x1ad35b,_0xcb9450[_0x113a1b(0x13b)]?[]:_0x3bfc09,_0x1db7c0);let _0x16af3f=0x0,_0x97f0af=0x0,_0x2a6246=0x0;const _0x5a7ab6=new Map(_0x4fe2ba);for(const [_0x299554,_0x2942ea]of _0x3f9239['createdSegmentIds']){_0x5a7ab6[_0x113a1b(0x180)](_0x299554,_0x2942ea);}if(_0x47e34c[_0x113a1b(0x161)]>0x0){const _0x4d5ba6={..._0x37429f,'segmentNameToId':_0x5a7ab6,'existingSegments':_0x4732aa,'activationContext':_0x180c6e},_0x5d7c10=await executePushJourneys(_0x1ad35b,_0x47e34c,_0x4d5ba6,{'parentId':_0x8c26fb,'rootFolderId':_0x4e992d,'verbose':_0xcb9450[_0x113a1b(0x141)]},_0x1db7c0);_0x16af3f=_0x5d7c10[_0x113a1b(0x134)],_0x97f0af=_0x5d7c10[_0x113a1b(0x131)];if(_0x188e9d&&_0x5d7c10[_0x113a1b(0x105)]['length']===0x1){const _0x353ea1=_0x5d7c10['results'][0x0];if(_0x353ea1[_0x113a1b(0x17a)]){const _0x42cef5=getConsoleNextUrl(_0xcb9450['site'],'/app/ps/'+_0x8c26fb+'/e/'+_0x353ea1['journeyId']+_0x113a1b(0x16c));console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x166)](_0x42cef5));}}}for(const _0x160081 of _0x5b310b){console['error'](a31_0x12d151['yellow'](_0x113a1b(0x112)+_0x160081[_0x113a1b(0x132)])),_0x2a6246++;}const _0x22202d=[];if(_0xb506c3>0x0)_0x22202d[_0x113a1b(0x13a)](_0xb506c3+_0x113a1b(0x102));if(_0x1a71e3>0x0)_0x22202d[_0x113a1b(0x13a)](_0x1a71e3+_0x113a1b(0x150));if(_0x52ea65>0x0)_0x22202d[_0x113a1b(0x13a)](_0x52ea65+_0x113a1b(0x103));const _0x1f0621=[];if(_0x16af3f>0x0)_0x1f0621[_0x113a1b(0x13a)](_0x16af3f+_0x113a1b(0x102));if(_0x97f0af>0x0)_0x1f0621['push'](_0x97f0af+_0x113a1b(0x150));if(_0x2a6246>0x0)_0x1f0621['push'](_0x2a6246+_0x113a1b(0x103));const _0x3013f8=[];if(_0x54dc76>0x0)_0x3013f8['push'](_0x54dc76+_0x113a1b(0x102));if(_0x51f778>0x0)_0x3013f8['push'](_0x51f778+_0x113a1b(0x150));if(_0xda9dc3>0x0)_0x3013f8[_0x113a1b(0x13a)](_0xda9dc3+_0x113a1b(0x103));return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)]('\x0aβ\x20Push\x20complete')),_0x22202d[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly']&&console[_0x113a1b(0x11c)](_0x113a1b(0x14b)+_0x22202d[_0x113a1b(0x155)](',\x20')),_0x1f0621[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)]('\x20\x20Journeys:\x20'+_0x1f0621['join'](',\x20')),_0x3013f8['length']>0x0&&!_0xcb9450[_0x113a1b(0x13b)]&&console[_0x113a1b(0x11c)](_0x113a1b(0x165)+_0x3013f8[_0x113a1b(0x155)](',\x20')),0x0;}}
|
|
1
|
+
function a31_0x7c61(){const _0x24a317=['2008065GkFCWC','verbose','error','updated','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','targetDir','15884840MfcKOf','Error:\x20Directory\x20not\x20found:\x20','segment\x20or\x20journey','462acvchi','buildUserMaps','9OlGKZn','Resolving\x20parent\x20segment\x20\x27','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20\x20Journeys:\x20','\x20created','length','listJourneysWithDetailsFromParentSegment','/j/da/je','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','2385752lCFnyH','segmentFolderId','site','dim','Error\x20parsing\x20YAML:\x20','parentFolder','\x20\x20π\x20Segments:','Error:\x20','folderId','audienceId','247005akwPLl','file','errorCode','Fetching\x20existing\x20journeys...','166292nhvTjk','journey','toUpdate','Push\x20','segment:push','yamlConfig','\x20YAML\x20files\x20found','deleted','\x20changed','Folders\x20to\x20create:','journeys','endsWith','\x20\x20\x20\x20','resolveParentId','Delete\x20journey:','isScoped','versionNumber','2444670UfcwcG','π\x20','setPhase','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','type','Fetching\x20connections\x20for\x20name\x20resolution...','folders','β\x20All\x20journeys\x20are\x20up\x20to\x20date','\x20updated','connection','parentSegment','attributes','journeysOnly','\x0aError:','Preparing\x20journeys...','all','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','green','toDelete','name','toString','getParent','.yaml','map','\x27...','\x0aPush\x20summary\x20for\x20\x27','join','repeat','activations','created','changed','createdAt','228948ZDubgx','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','set','user','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','isNew','\x20to\x20delete','scopedFolderPath','20QNcjtN','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','filter','Aborted.','idToName','state','results','parentName','\x20to\x20update','nameToId','blue','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','journeyId','existingJourney','journeyBundleId','diff','New\x20segment:','red','yes','\x20unchanged','listSegments','\x20activations]','unchanged','Fetching\x20existing\x20segments...','helpText','segment','\x20new','segments','New\x20journey:','(Journey\x20will\x20be\x20deleted)','\x20\x20Activations:\x20','then','folderPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Source\x20directory:\x20','.yml','push','journeyBundleName','getJourney','cwd','\x20deleted','Fetching\x20users\x20for\x20email\x20resolution...','/app/ps/','nameToType','\x20\x20πΊοΈ\x20\x20Journeys:','Fetching\x20existing\x20folders...','cyan','get','\x20\x20Source:\x20','\x0aβ\x20Push\x20complete','new','execute','delete','yellow','message','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','toCreate','filePath','description'];a31_0x7c61=function(){return _0x24a317;};return a31_0x7c61();}const a31_0xe460a3=a31_0x4d92;function a31_0x4d92(_0x401341,_0x4d5be3){_0x401341=_0x401341-0x155;const _0x7c6144=a31_0x7c61();let _0x4d92fb=_0x7c6144[_0x401341];return _0x4d92fb;}(function(_0x4d9c50,_0x25f6c4){const _0x199749=a31_0x4d92,_0x1c6a26=_0x4d9c50();while(!![]){try{const _0x133d4e=-parseInt(_0x199749(0x175))/0x1+parseInt(_0x199749(0x155))/0x2+parseInt(_0x199749(0x1d9))/0x3*(-parseInt(_0x199749(0x17d))/0x4)+parseInt(_0x199749(0x1ba))/0x5+-parseInt(_0x199749(0x1c3))/0x6*(-parseInt(_0x199749(0x1dd))/0x7)+parseInt(_0x199749(0x1cf))/0x8*(-parseInt(_0x199749(0x1c5))/0x9)+-parseInt(_0x199749(0x1c0))/0xa;if(_0x133d4e===_0x25f6c4)break;else _0x1c6a26['push'](_0x1c6a26['shift']());}catch(_0x1ef900){_0x1c6a26['push'](_0x1c6a26['shift']());}}}(a31_0x7c61,0xe208a));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_0x3a657e 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_0xe460a3(0x168)]=a31_0xe460a3(0x1e1);['description']='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a31_0xe460a3(0x1b2)](_0x32a5b7){const _0x3b58b8=a31_0xe460a3,{options:_0x5b2a8d,args:_0x2aafd1,tdx:_0x45baf1}=_0x32a5b7,_0x31e135=_0x5b2a8d,_0x43139c=await resolveTarget({'arg':_0x2aafd1[0x0],'contextParent':_0x5b2a8d[_0x3b58b8(0x15f)],'cwd':process[_0x3b58b8(0x1a6)]()});if(!isSuccessfulResolution(_0x43139c))return _0x43139c[_0x3b58b8(0x1db)]==='no_parent'?(console[_0x3b58b8(0x1bc)](a31_0x3a657e['yellow'](_0x3b58b8(0x1be))),console[_0x3b58b8(0x1bc)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1a0)),console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1c8))):(console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x1d6)+_0x43139c[_0x3b58b8(0x1b5)]+'\x0a')),_0x43139c[_0x3b58b8(0x197)]&&console['error'](a31_0x3a657e[_0x3b58b8(0x1ad)](_0x43139c[_0x3b58b8(0x197)]))),0x1;if(_0x43139c[_0x3b58b8(0x159)]==='parent_name')return console[_0x3b58b8(0x1bc)](a31_0x3a657e['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x43139c[_0x3b58b8(0x1bf)]+'\x0a')),console['error'](a31_0x3a657e['cyan'](_0x3b58b8(0x165))),0x1;const _0x49eab6=_0x43139c[_0x3b58b8(0x184)],_0x2cd068=_0x43139c[_0x3b58b8(0x1bf)],_0x3993bf=_0x43139c[_0x3b58b8(0x159)]===_0x3b58b8(0x1da)?_0x43139c[_0x3b58b8(0x1b8)]:undefined,_0x5357b8=getScopedDetails(_0x43139c),_0x2e18eb=_0x5357b8?.[_0x3b58b8(0x1ec)]??![],_0x393991=_0x5357b8?.[_0x3b58b8(0x17c)]??'';if(!existsSync(_0x2cd068))return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x1c1)+_0x2cd068+'\x0a')),console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1ad)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x31e135[_0x3b58b8(0x1bb)]&&(console[_0x3b58b8(0x1bc)]('Site:\x20'+_0x31e135['site']),console['error'](_0x3b58b8(0x189)+_0x49eab6),console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1a1)+_0x2cd068),_0x2e18eb&&console[_0x3b58b8(0x1bc)]('Scoped\x20to\x20folder:\x20'+_0x393991));const _0x4de0e8=await withSpinner(_0x3b58b8(0x1c6)+_0x49eab6+_0x3b58b8(0x16d),()=>_0x45baf1[_0x3b58b8(0x198)][_0x3b58b8(0x1ea)](_0x49eab6),{'verbose':_0x31e135[_0x3b58b8(0x1bb)]}),_0x4098cf=_0x4de0e8[_0x3b58b8(0x1c7)],[_0x23aaea,_0x5d27eb,_0x32804c,_0x2990c3,_0x41b113]=await Promise[_0x3b58b8(0x164)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x45baf1['segment'][_0x3b58b8(0x16a)](_0x4098cf),{'verbose':_0x31e135[_0x3b58b8(0x1bb)]}),withSpinner(_0x3b58b8(0x196),()=>_0x45baf1[_0x3b58b8(0x198)][_0x3b58b8(0x193)](_0x4098cf),{'verbose':_0x31e135[_0x3b58b8(0x1bb)]}),withSpinner(_0x3b58b8(0x1ac),()=>_0x45baf1[_0x3b58b8(0x198)]['listFolders'](_0x4098cf),{'verbose':_0x31e135['verbose']}),withSpinner(_0x3b58b8(0x1dc),()=>_0x45baf1['journey'][_0x3b58b8(0x1cc)](_0x4098cf,{'includeAllVersions':!![]}),{'verbose':_0x31e135[_0x3b58b8(0x1bb)]}),withSpinner(_0x3b58b8(0x1a8),()=>_0x45baf1[_0x3b58b8(0x178)][_0x3b58b8(0x1c4)](),{'verbose':_0x31e135[_0x3b58b8(0x1bb)]})[_0x3b58b8(0x19e)](_0x309f30=>_0x309f30[_0x3b58b8(0x1c7)])]),_0x5ed383=_0x23aaea[_0x3b58b8(0x1c7)],_0x46f6d8=extractRootFolderId(_0x5ed383),_0x539aaf=_0x5d27eb['data'],_0x4b7db8=_0x32804c[_0x3b58b8(0x1c7)],{journeys:_0x4fbc8d,activationStepsById:_0x2b23a0}=_0x2990c3[_0x3b58b8(0x1c7)],_0x39a939=new Map(_0x4fbc8d[_0x3b58b8(0x16c)](_0x2e17c2=>[_0x2e17c2['id'],_0x2e17c2])),_0x361da9=_0x4fbc8d[_0x3b58b8(0x16c)](_0x29148c=>({'id':_0x29148c['id'],'name':_0x29148c[_0x3b58b8(0x160)]['name'],'journeyBundleName':_0x29148c['attributes'][_0x3b58b8(0x1a4)]||'','journeyBundleId':_0x29148c[_0x3b58b8(0x160)][_0x3b58b8(0x18d)]||'','versionNumber':_0x29148c[_0x3b58b8(0x160)][_0x3b58b8(0x1ed)],'description':_0x29148c[_0x3b58b8(0x160)][_0x3b58b8(0x1b9)],'state':_0x29148c[_0x3b58b8(0x160)][_0x3b58b8(0x182)],'paused':_0x29148c[_0x3b58b8(0x160)]['paused'],'audienceId':_0x29148c[_0x3b58b8(0x160)][_0x3b58b8(0x1d8)],'folderId':_0x29148c['relationships']?.[_0x3b58b8(0x1d4)]?.['data']?.['id'],'createdAt':_0x29148c['attributes'][_0x3b58b8(0x174)],'updatedAt':_0x29148c['attributes']['updatedAt']})),{emailToId:_0x344187,idToEmail:_0x31a8c2}=_0x41b113,_0x36331c=await withSpinner(_0x3b58b8(0x15a),async()=>{const _0x3a33a3=_0x3b58b8,_0x49bc3e=await _0x45baf1[_0x3a33a3(0x15e)]['list']();return buildConnectionMaps(_0x49bc3e);},{'verbose':_0x31e135[_0x3b58b8(0x1bb)]})[_0x3b58b8(0x19e)](_0x1db70c=>_0x1db70c[_0x3b58b8(0x1c7)]),_0x529a8e=_0x36331c[_0x3b58b8(0x186)],_0xbaef5a=_0x36331c[_0x3b58b8(0x181)],_0x150a44=_0x36331c[_0x3b58b8(0x1aa)],_0x564004={'emailToIdMap':_0x344187,'connectionNameToIdMap':_0x529a8e,'connectionNameToTypeMap':_0x150a44,'getSchema':_0x1756e3=>_0x45baf1[_0x3b58b8(0x15e)]['getOutputSchemaWithCache'](_0x1756e3)};let {pathToId:_0x4cbfe2,idToPath:_0x3e2037}=buildFolderMaps(_0x4b7db8);const _0x587589=buildSegmentLookupMap(_0x539aaf,_0x3e2037),_0x4b51f7=buildSegmentNameToIdMap(_0x539aaf),_0x9e78f9=buildJourneyBundleLookupMap(_0x361da9,_0x3e2037);let _0x1ff32a;if(_0x3993bf){if(!_0x3993bf[_0x3b58b8(0x1e8)](_0x3b58b8(0x1a2))&&!_0x3993bf[_0x3b58b8(0x1e8)](_0x3b58b8(0x16b)))return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x3993bf+'\x0a')),0x1;_0x1ff32a=[_0x3993bf];}else _0x1ff32a=findYamlFiles(_0x2cd068);if(_0x1ff32a['length']===0x0)return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x1b6)+_0x2cd068+'\x0a')),console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1ad)](_0x3b58b8(0x1ce))),0x1;let _0x2bf08f,_0x159d72;try{const _0x2aa765=parseAndClassifyYamlFiles(_0x1ff32a,_0x2cd068,{'skipSegments':_0x31e135['journeysOnly']});_0x2bf08f=_0x2aa765['segments'],_0x159d72=_0x2aa765[_0x3b58b8(0x1e7)];const _0x23ede5=validateParsedFiles(_0x2aa765,_0x2cd068);if(_0x23ede5[_0x3b58b8(0x1cb)]>0x0)return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)]('\x0aValidation\x20failed:')),console['error'](formatValidationErrors(_0x23ede5)),console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1b4)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0xac9675){return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x1d3)+(_0xac9675 instanceof Error?_0xac9675[_0x3b58b8(0x1b5)]:_0xac9675))),0x1;}if(_0x2bf08f[_0x3b58b8(0x1cb)]===0x0&&_0x159d72[_0x3b58b8(0x1cb)]===0x0){const _0x3697ee=_0x31e135[_0x3b58b8(0x161)]?_0x3b58b8(0x1de):_0x3b58b8(0x1c2);return console['error'](a31_0x3a657e[_0x3b58b8(0x1b4)]('No\x20'+_0x3697ee+_0x3b58b8(0x1e3))),0x0;}const _0x5e136c=new Map();_0x539aaf[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x539aaf,async _0xf8979b=>{const _0x2bd1de=a31_0x4d92,_0x419797=await _0x45baf1['segment']['listActivations'](_0x4098cf,_0xf8979b['id']);_0x5e136c[_0x2bd1de(0x177)](_0xf8979b['id'],_0x419797);});},{'verbose':_0x31e135[_0x3b58b8(0x1bb)]});const {segmentFiles:_0x3285e1,foldersToCreate:_0x221056}=await prepareSegmentFiles(_0x2bf08f,{'segmentByFolderAndName':_0x587589,'activationsBySegmentId':_0x5e136c,'folderPathToId':_0x4cbfe2,'idToEmailMap':_0x31a8c2,'connectionIdToNameMap':_0xbaef5a},_0x564004,_0x2e18eb,_0x393991),_0x342a05=_0x3993bf?[]:findSegmentsToDelete(_0x539aaf,_0x2bf08f[_0x3b58b8(0x16c)](({yamlConfig:_0x5ce9ab,folderPath:_0x2f6524})=>({'yamlConfig':_0x5ce9ab,'folderPath':resolveTDFolderPath(_0x2f6524,_0x2e18eb,_0x393991)})),_0x3e2037,_0x393991,_0x2e18eb),{journeyFiles:_0x1f0b13,foldersToCreate:_0x1b98fb}=await withProgressSpinner(_0x3b58b8(0x163),async _0x4472f8=>prepareJourneyFiles(_0x159d72,{'fetchJourney':async _0x326b1c=>_0x45baf1[_0x3b58b8(0x1de)][_0x3b58b8(0x1a5)](_0x326b1c[_0x3b58b8(0x18b)]),'journeyBundlesByFolderAndName':_0x9e78f9,'folderPathToId':_0x4cbfe2,'idToEmailMap':_0x31a8c2,'connectionIdToNameMap':_0xbaef5a,'existingSegments':_0x539aaf,'parentId':_0x4098cf,'deps':_0x45baf1,'progress':{'update':_0x85ccfb=>{const _0x345528=_0x3b58b8;_0x4472f8[_0x345528(0x157)](_0x85ccfb),_0x31e135[_0x345528(0x1bb)]&&console[_0x345528(0x1bc)]('\x20\x20'+_0x85ccfb);}},'journeyById':_0x39a939,'activationStepsById':_0x2b23a0},_0x2e18eb,_0x393991),{'verbose':_0x31e135['verbose']})[_0x3b58b8(0x19e)](_0x37731a=>_0x37731a[_0x3b58b8(0x1c7)]);for(const _0x504f54 of _0x1b98fb){_0x221056['add'](_0x504f54);}const _0x7920f=_0x3993bf?[]:findJourneysToDelete(_0x361da9,_0x159d72[_0x3b58b8(0x16c)](({yamlConfig:_0x2ef9e0,folderPath:_0x2b3764})=>({'yamlConfig':_0x2ef9e0,'folderPath':resolveTDFolderPath(_0x2b3764,_0x2e18eb,_0x393991)})),_0x3e2037,_0x393991,_0x2e18eb),_0x5b7239=calculatePushStats(_0x3285e1,_0x1f0b13,_0x221056,_0x342a05,_0x7920f,!!_0x31e135[_0x3b58b8(0x1b3)],!!_0x31e135[_0x3b58b8(0x161)]),_0x32710f=_0x5b7239[_0x3b58b8(0x19a)][_0x3b58b8(0x1b1)],_0x4101a6=_0x5b7239[_0x3b58b8(0x19a)][_0x3b58b8(0x173)],_0x231fe3=_0x5b7239['segments']['unchanged'],_0x308f9e=_0x5b7239[_0x3b58b8(0x19a)][_0x3b58b8(0x167)],_0x475bab=_0x5b7239[_0x3b58b8(0x15b)][_0x3b58b8(0x1b7)],_0x43b2c6=_0x5b7239['journeys']['new'],_0x32c7d5=_0x5b7239[_0x3b58b8(0x1e7)][_0x3b58b8(0x173)],_0x493226=_0x5b7239[_0x3b58b8(0x1e7)][_0x3b58b8(0x195)],_0x21afe1=_0x5b7239[_0x3b58b8(0x1e7)]['toDelete'],_0x2ae29e=_0x5b7239[_0x3b58b8(0x171)][_0x3b58b8(0x164)],_0x20b33e=_0x5b7239[_0x3b58b8(0x171)]['toCreate'],_0x3140fd=_0x5b7239[_0x3b58b8(0x171)][_0x3b58b8(0x1df)],_0x2586bc=_0x5b7239[_0x3b58b8(0x171)][_0x3b58b8(0x167)];console[_0x3b58b8(0x1bc)](_0x3b58b8(0x16e)+_0x49eab6+'\x27:');_0x475bab['length']>0x0&&console[_0x3b58b8(0x1bc)]('\x20\x20'+a31_0x3a657e['blue'](_0x3b58b8(0x156)+_0x475bab[_0x3b58b8(0x1cb)]+'\x20folders\x20to\x20create'));if(!_0x31e135['journeysOnly']){console['error'](_0x3b58b8(0x1d5)),console['error'](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x166)]('+\x20'+_0x32710f[_0x3b58b8(0x1cb)]+_0x3b58b8(0x199))),console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1e9)+a31_0x3a657e['yellow']('~\x20'+_0x4101a6[_0x3b58b8(0x1cb)]+_0x3b58b8(0x1e5)));if(_0x308f9e['length']>0x0)console[_0x3b58b8(0x1bc)]('\x20\x20\x20\x20'+a31_0x3a657e[_0x3b58b8(0x190)]('-\x20'+_0x308f9e[_0x3b58b8(0x1cb)]+_0x3b58b8(0x17b)));else _0x342a05[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135[_0x3b58b8(0x1b3)]&&console['error'](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x1d2)](_0x342a05[_0x3b58b8(0x1cb)]+_0x3b58b8(0x188)));console['error']('\x20\x20\x20\x20'+a31_0x3a657e[_0x3b58b8(0x1d2)]('=\x20'+_0x231fe3[_0x3b58b8(0x1cb)]+'\x20unchanged'));}if(_0x1f0b13[_0x3b58b8(0x1cb)]>0x0||_0x7920f[_0x3b58b8(0x1cb)]>0x0){console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1ab)),console[_0x3b58b8(0x1bc)]('\x20\x20\x20\x20'+a31_0x3a657e[_0x3b58b8(0x166)]('+\x20'+_0x43b2c6[_0x3b58b8(0x1cb)]+_0x3b58b8(0x199))),console[_0x3b58b8(0x1bc)]('\x20\x20\x20\x20'+a31_0x3a657e['yellow']('~\x20'+_0x32c7d5[_0x3b58b8(0x1cb)]+'\x20changed'));if(_0x21afe1[_0x3b58b8(0x1cb)]>0x0)console[_0x3b58b8(0x1bc)]('\x20\x20\x20\x20'+a31_0x3a657e[_0x3b58b8(0x190)]('-\x20'+_0x21afe1[_0x3b58b8(0x1cb)]+_0x3b58b8(0x17b)));else _0x7920f[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135['delete']&&console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1e9)+a31_0x3a657e['dim'](_0x7920f[_0x3b58b8(0x1cb)]+_0x3b58b8(0x188)));console['error'](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x1d2)]('=\x20'+_0x493226[_0x3b58b8(0x1cb)]+_0x3b58b8(0x192)));}_0x2ae29e['length']>0x0&&!_0x31e135[_0x3b58b8(0x161)]&&(console[_0x3b58b8(0x1bc)](''),console[_0x3b58b8(0x1bc)]('\x20\x20Activations:'),_0x20b33e[_0x3b58b8(0x1cb)]>0x0&&console['error'](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x166)]('+\x20'+_0x20b33e[_0x3b58b8(0x1cb)]+'\x20to\x20create')),_0x3140fd[_0x3b58b8(0x1cb)]>0x0&&console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x1b4)]('~\x20'+_0x3140fd[_0x3b58b8(0x1cb)]+_0x3b58b8(0x185))),_0x2586bc[_0x3b58b8(0x1cb)]>0x0&&console['error'](_0x3b58b8(0x1e9)+a31_0x3a657e[_0x3b58b8(0x190)]('-\x20'+_0x2586bc['length']+'\x20to\x20delete')));console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1af)+a31_0x3a657e[_0x3b58b8(0x1ad)](_0x2cd068)+'\x0a');if(_0x475bab[_0x3b58b8(0x1cb)]>0x0){console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1e6));for(const _0x4077b4 of _0x475bab){console[_0x3b58b8(0x1bc)]('\x20\x20'+a31_0x3a657e[_0x3b58b8(0x187)]('+')+'\x20'+_0x4077b4);}console[_0x3b58b8(0x1bc)]('');}if(_0x32710f[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135['journeysOnly'])for(const _0x4e2f7e of _0x32710f){const _0x2fe5cb=_0x4e2f7e['folderPath']?_0x4e2f7e[_0x3b58b8(0x19f)]+'/'+_0x4e2f7e[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)]:_0x4e2f7e[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)],_0x2be14d=_0x4e2f7e[_0x3b58b8(0x1e2)][_0x3b58b8(0x171)]?.[_0x3b58b8(0x1cb)]||0x0,_0x7c85ed=_0x2be14d>0x0?a31_0x3a657e[_0x3b58b8(0x1d2)]('\x20['+_0x2be14d+_0x3b58b8(0x194)):'';console['error']('\x0a'+a31_0x3a657e[_0x3b58b8(0x166)](_0x3b58b8(0x18f))+'\x20'+_0x2fe5cb+_0x7c85ed),console[_0x3b58b8(0x1bc)]('β'['repeat'](0x3c)),_0x4e2f7e[_0x3b58b8(0x18e)]&&console[_0x3b58b8(0x1bc)](_0x4e2f7e['diff']),console[_0x3b58b8(0x1bc)]('β'[_0x3b58b8(0x170)](0x3c));}if(_0x308f9e[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135[_0x3b58b8(0x161)])for(const _0x612097 of _0x308f9e){const _0x10cbd6=_0x612097['segmentFolderId']?_0x3e2037['get'](_0x612097[_0x3b58b8(0x1d0)][_0x3b58b8(0x169)]())||'':'',_0xce2f93=_0x10cbd6?_0x10cbd6+'/'+_0x612097[_0x3b58b8(0x168)]:_0x612097[_0x3b58b8(0x168)],_0x1f4242=_0x5e136c[_0x3b58b8(0x1ae)](_0x612097['id'])||[],_0x10e7a0=_0x1f4242['length']>0x0?a31_0x3a657e[_0x3b58b8(0x1d2)]('\x20['+_0x1f4242[_0x3b58b8(0x1cb)]+_0x3b58b8(0x194)):'';console[_0x3b58b8(0x1bc)]('\x0a'+a31_0x3a657e[_0x3b58b8(0x190)]('Delete\x20segment:')+'\x20'+_0xce2f93+_0x10e7a0),console['error']('β'[_0x3b58b8(0x170)](0x3c));const _0x173ddd=segmentWithActivationsToYaml(_0x612097,_0x1f4242,undefined,_0x31a8c2,_0xbaef5a),_0x1949ca=segmentToYamlString(_0x173ddd),_0x4b2146=generateDiff(_0x1949ca,'');console[_0x3b58b8(0x1bc)](formatDiffWithColors(_0x4b2146)),console[_0x3b58b8(0x1bc)]('β'[_0x3b58b8(0x170)](0x3c));}const _0x226b3f=_0x3285e1[_0x3b58b8(0x17f)](_0xdc9b7e=>!_0xdc9b7e[_0x3b58b8(0x17a)]&&_0xdc9b7e[_0x3b58b8(0x18e)]);if(_0x226b3f['length']>0x0&&!_0x31e135[_0x3b58b8(0x161)])for(const _0x573b77 of _0x226b3f){const _0x2c00b0=_0x573b77[_0x3b58b8(0x19f)]?_0x573b77[_0x3b58b8(0x19f)]+'/'+_0x573b77['yamlConfig']['name']:_0x573b77[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)];console[_0x3b58b8(0x1bc)]('\x0a'+a31_0x3a657e[_0x3b58b8(0x1b4)]('Changes\x20to:')+'\x20'+_0x2c00b0),console[_0x3b58b8(0x1bc)]('β'['repeat'](0x3c)),console['error'](_0x573b77[_0x3b58b8(0x18e)]),console['error']('β'[_0x3b58b8(0x170)](0x3c));}if(_0x43b2c6[_0x3b58b8(0x1cb)]>0x0)for(const _0x2ebfef of _0x43b2c6){const _0x31a1ed=_0x2ebfef[_0x3b58b8(0x19f)]?_0x2ebfef[_0x3b58b8(0x19f)]+'/'+_0x2ebfef[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)]:_0x2ebfef[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)];console[_0x3b58b8(0x1bc)]('\x0a'+a31_0x3a657e[_0x3b58b8(0x166)](_0x3b58b8(0x19b))+'\x20'+_0x31a1ed),console[_0x3b58b8(0x1bc)]('β'[_0x3b58b8(0x170)](0x3c)),_0x2ebfef[_0x3b58b8(0x18e)]&&console['error'](_0x2ebfef[_0x3b58b8(0x18e)]),console['error']('β'[_0x3b58b8(0x170)](0x3c));}const _0x2a39d5=_0x1f0b13[_0x3b58b8(0x17f)](_0x37fdcb=>!_0x37fdcb[_0x3b58b8(0x17a)]&&_0x37fdcb[_0x3b58b8(0x18e)]);if(_0x2a39d5[_0x3b58b8(0x1cb)]>0x0)for(const _0x1e44a3 of _0x2a39d5){const _0x2b8ec0=_0x1e44a3[_0x3b58b8(0x19f)]?_0x1e44a3[_0x3b58b8(0x19f)]+'/'+_0x1e44a3[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)]:_0x1e44a3[_0x3b58b8(0x1e2)][_0x3b58b8(0x168)];console['error']('\x0a'+a31_0x3a657e[_0x3b58b8(0x1b4)]('Changes\x20to\x20journey:')+'\x20'+_0x2b8ec0),console[_0x3b58b8(0x1bc)]('β'[_0x3b58b8(0x170)](0x3c)),console['error'](_0x1e44a3['diff']),console[_0x3b58b8(0x1bc)]('β'['repeat'](0x3c));}if(_0x21afe1[_0x3b58b8(0x1cb)]>0x0)for(const _0x12e755 of _0x21afe1){const _0x553e4e=_0x12e755[_0x3b58b8(0x1d7)]?_0x3e2037[_0x3b58b8(0x1ae)](_0x12e755[_0x3b58b8(0x1d7)])||'':'',_0x198cd7=_0x553e4e?_0x553e4e+'/'+_0x12e755[_0x3b58b8(0x1a4)]:_0x12e755[_0x3b58b8(0x1a4)];console[_0x3b58b8(0x1bc)]('\x0a'+a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x1eb))+'\x20'+_0x198cd7),console[_0x3b58b8(0x1bc)]('β'[_0x3b58b8(0x170)](0x3c)),console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x19c))),console['error']('β'['repeat'](0x3c));}if(_0x31e135['dryRun'])return console['error'](a31_0x3a657e[_0x3b58b8(0x1b4)](_0x3b58b8(0x18a))),0x0;const _0x468d1d=_0x31e135[_0x3b58b8(0x161)]?![]:_0x32710f[_0x3b58b8(0x1cb)]>0x0||_0x4101a6[_0x3b58b8(0x1cb)]>0x0||_0x308f9e['length']>0x0,_0x16b3ff=_0x43b2c6[_0x3b58b8(0x1cb)]>0x0||_0x32c7d5[_0x3b58b8(0x1cb)]>0x0||_0x21afe1[_0x3b58b8(0x1cb)]>0x0,_0x5cdedb=_0x31e135[_0x3b58b8(0x161)]?![]:_0x2ae29e['length']>0x0,_0x22bc19=_0x475bab[_0x3b58b8(0x1cb)]>0x0;if(!_0x468d1d&&!_0x16b3ff&&!_0x5cdedb&&!_0x22bc19){const _0x4433b7=_0x31e135[_0x3b58b8(0x161)]?_0x3b58b8(0x15c):_0x3b58b8(0x179);console[_0x3b58b8(0x1bc)](a31_0x3a657e['green'](_0x4433b7));if(_0x3993bf&&_0x493226[_0x3b58b8(0x1cb)]===0x1){const _0x5499be=_0x493226[0x0];if(_0x5499be[_0x3b58b8(0x18c)]?.['id']){const _0x4c4c72=getConsoleNextUrl(_0x31e135[_0x3b58b8(0x1d1)],_0x3b58b8(0x1a9)+_0x4098cf+'/e/'+_0x5499be[_0x3b58b8(0x18c)]['id']+_0x3b58b8(0x1cd));console['error']('\x20\x20'+a31_0x3a657e['cyan'](_0x4c4c72));}}return 0x0;}const _0x3744db=_0x31e135[_0x3b58b8(0x161)]?_0x43b2c6[_0x3b58b8(0x1cb)]+_0x32c7d5[_0x3b58b8(0x1cb)]+_0x21afe1[_0x3b58b8(0x1cb)]+_0x475bab[_0x3b58b8(0x1cb)]:_0x32710f['length']+_0x4101a6['length']+_0x308f9e['length']+_0x43b2c6[_0x3b58b8(0x1cb)]+_0x32c7d5[_0x3b58b8(0x1cb)]+_0x21afe1[_0x3b58b8(0x1cb)]+_0x475bab[_0x3b58b8(0x1cb)]+_0x2ae29e['length'];if(!_0x31e135[_0x3b58b8(0x191)]&&_0x3744db>0x0){if(!isInteractive())return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x190)](_0x3b58b8(0x162)),_0x3b58b8(0x158)),console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1d2)](_0x3b58b8(0x17e))),0x1;const _0x2d7cb3=await confirmKey(_0x3b58b8(0x1e0)+_0x3744db+'\x20changes?');if(!_0x2d7cb3)return console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1b4)](_0x3b58b8(0x180))),0x1;}const _0x2bbde9={'withProgress':async(_0x2a0a81,_0x22b38d)=>{const _0x2c4634=_0x3b58b8,_0x2e7302=await withSpinner(_0x2a0a81,_0x22b38d,{'verbose':_0x31e135[_0x2c4634(0x1bb)]});return{'data':_0x2e7302[_0x2c4634(0x1c7)]};},'logInfo':_0x1cae85=>console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x187)]('β\x20'+_0x1cae85)),'logSuccess':_0x5194d4=>console[_0x3b58b8(0x1bc)](a31_0x3a657e['green']('β\x20'+_0x5194d4)),'logWarning':_0x5de055=>console['error'](a31_0x3a657e['yellow']('β \x20'+_0x5de055)),'logDeleted':_0x10963a=>console[_0x3b58b8(0x1bc)](a31_0x3a657e['red']('β\x20'+_0x10963a))},_0x8bcf3a={'segment':_0x45baf1['segment'],'journey':_0x45baf1[_0x3b58b8(0x1de)],'user':_0x45baf1[_0x3b58b8(0x178)],'connection':_0x45baf1[_0x3b58b8(0x15e)]};_0x475bab[_0x3b58b8(0x1cb)]>0x0&&(_0x4cbfe2=await executePushFolders(_0x8bcf3a,_0x475bab,_0x4cbfe2,{'parentId':_0x4098cf},_0x2bbde9));const _0x5735ae={'rootFolderId':_0x46f6d8,'folderPathToId':_0x4cbfe2,'folderIdToPath':_0x3e2037,'segmentNameToId':_0x4b51f7,'activationsBySegmentId':_0x5e136c,'emailToIdMap':_0x344187,'idToEmailMap':_0x31a8c2,'connectionNameToIdMap':_0x36331c[_0x3b58b8(0x186)],'connectionIdToNameMap':_0x36331c[_0x3b58b8(0x181)],'connectionNameToTypeMap':_0x150a44},_0x51da0b=await executePushSegments(_0x8bcf3a,_0x31e135[_0x3b58b8(0x161)]?[]:_0x3285e1,_0x5735ae,{'parentId':_0x4098cf},_0x2bbde9),_0x3d27f8=_0x51da0b['created'],_0x39fe43=_0x51da0b[_0x3b58b8(0x1bd)],_0x22d21b=_0x51da0b['activations'][_0x3b58b8(0x172)],_0x4b6f49=_0x51da0b['activations'][_0x3b58b8(0x1bd)],_0x38d499=_0x51da0b[_0x3b58b8(0x171)][_0x3b58b8(0x1e4)],_0x9edf66=await executePushSegmentDeletions(_0x8bcf3a,_0x31e135[_0x3b58b8(0x161)]?[]:_0x308f9e,_0x2bbde9);let _0x1902bc=0x0,_0x29e71d=0x0,_0x45f0ee=0x0;const _0x5d7a5f=new Map(_0x4b51f7);for(const [_0x3b2bdc,_0x3e293a]of _0x51da0b['createdSegmentIds']){_0x5d7a5f[_0x3b58b8(0x177)](_0x3b2bdc,_0x3e293a);}if(_0x1f0b13[_0x3b58b8(0x1cb)]>0x0){const _0x408850={..._0x5735ae,'segmentNameToId':_0x5d7a5f,'existingSegments':_0x539aaf,'activationContext':_0x564004},_0x59f0ea=await executePushJourneys(_0x8bcf3a,_0x1f0b13,_0x408850,{'parentId':_0x4098cf,'rootFolderId':_0x46f6d8,'verbose':_0x31e135[_0x3b58b8(0x1bb)]},_0x2bbde9);_0x1902bc=_0x59f0ea[_0x3b58b8(0x172)],_0x29e71d=_0x59f0ea[_0x3b58b8(0x1bd)];if(_0x3993bf&&_0x59f0ea[_0x3b58b8(0x183)][_0x3b58b8(0x1cb)]===0x1){const _0x390062=_0x59f0ea['results'][0x0];if(_0x390062[_0x3b58b8(0x18b)]){const _0xacbaaf=getConsoleNextUrl(_0x31e135[_0x3b58b8(0x1d1)],_0x3b58b8(0x1a9)+_0x4098cf+'/e/'+_0x390062[_0x3b58b8(0x18b)]+'/j/da/je');console[_0x3b58b8(0x1bc)]('\x20\x20'+a31_0x3a657e[_0x3b58b8(0x1ad)](_0xacbaaf));}}}for(const _0x547cc9 of _0x21afe1){console[_0x3b58b8(0x1bc)](a31_0x3a657e[_0x3b58b8(0x1b4)](_0x3b58b8(0x176)+_0x547cc9[_0x3b58b8(0x1a4)])),_0x45f0ee++;}const _0x4d10d9=[];if(_0x3d27f8>0x0)_0x4d10d9[_0x3b58b8(0x1a3)](_0x3d27f8+_0x3b58b8(0x1ca));if(_0x39fe43>0x0)_0x4d10d9[_0x3b58b8(0x1a3)](_0x39fe43+'\x20updated');if(_0x9edf66>0x0)_0x4d10d9[_0x3b58b8(0x1a3)](_0x9edf66+_0x3b58b8(0x1a7));const _0x14a653=[];if(_0x1902bc>0x0)_0x14a653[_0x3b58b8(0x1a3)](_0x1902bc+_0x3b58b8(0x1ca));if(_0x29e71d>0x0)_0x14a653[_0x3b58b8(0x1a3)](_0x29e71d+_0x3b58b8(0x15d));if(_0x45f0ee>0x0)_0x14a653['push'](_0x45f0ee+_0x3b58b8(0x1a7));const _0x235abb=[];if(_0x22d21b>0x0)_0x235abb[_0x3b58b8(0x1a3)](_0x22d21b+_0x3b58b8(0x1ca));if(_0x4b6f49>0x0)_0x235abb[_0x3b58b8(0x1a3)](_0x4b6f49+_0x3b58b8(0x15d));if(_0x38d499>0x0)_0x235abb[_0x3b58b8(0x1a3)](_0x38d499+_0x3b58b8(0x1a7));return console[_0x3b58b8(0x1bc)](a31_0x3a657e['green'](_0x3b58b8(0x1b0))),_0x4d10d9[_0x3b58b8(0x1cb)]>0x0&&!_0x31e135[_0x3b58b8(0x161)]&&console[_0x3b58b8(0x1bc)]('\x20\x20Segments:\x20'+_0x4d10d9[_0x3b58b8(0x16f)](',\x20')),_0x14a653[_0x3b58b8(0x1cb)]>0x0&&console[_0x3b58b8(0x1bc)](_0x3b58b8(0x1c9)+_0x14a653['join'](',\x20')),_0x235abb['length']>0x0&&!_0x31e135[_0x3b58b8(0x161)]&&console[_0x3b58b8(0x1bc)](_0x3b58b8(0x19d)+_0x235abb[_0x3b58b8(0x16f)](',\x20')),0x0;}}
|