@treasuredata/tdx 0.18.0 β 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -8
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/claude-usage-tracker.js.map +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.d.ts.map +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js.map +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x46a180=a27_0xb315;(function(_0xe18b4c,_0x8f4aa5){const _0x449fbd=a27_0xb315,_0x2661fa=_0xe18b4c();while(!![]){try{const _0x5bcd79=parseInt(_0x449fbd(0x16f))/0x1+parseInt(_0x449fbd(0x124))/0x2+parseInt(_0x449fbd(0x171))/0x3+parseInt(_0x449fbd(0x135))/0x4*(parseInt(_0x449fbd(0x115))/0x5)+parseInt(_0x449fbd(0x162))/0x6+parseInt(_0x449fbd(0x13e))/0x7+-parseInt(_0x449fbd(0x13d))/0x8;if(_0x5bcd79===_0x8f4aa5)break;else _0x2661fa['push'](_0x2661fa['shift']());}catch(_0x498da3){_0x2661fa['push'](_0x2661fa['shift']());}}}(a27_0x2878,0x32d6c));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';function a27_0x2878(){const _0x57da2c=['user','list','\x20\x20Job\x20ID:\x20','nextRun','Updating\x20schedule...','ies','result','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','\x22...','engineVersion','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20execution','abs','entries','toLocaleDateString','substring','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','user_name','execute','(unnamed)','database','padEnd','h\x20ago','cron','schedule:create','Creating\x20schedule...','priority','d\x20ago','update','error','name','red','job_id','Schedule\x20deleted:\x20','from','type','9745pbKlzE','count','data','delay','round','\x20\x20Database:\x20','retryLimit','\x20\x20Time:\x20','Schedule\x20updated:\x20','run','validate','file','status','just\x20now','show','390374hXgiEx','schedule:run','start_at','No\x20scheduled\x20queries\x20found','utf-8','engine_version','getTime','π
\x20','max','length','Found\x20','num','Delete\x20a\x20scheduled\x20query','map','/app/queries/editor?queryId=','\x20scheduled\x20quer','verbose','572dnkgnD','next_run_at','format','time','INVALID_ARGUMENT','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','cyan','\x20\x20Type:\x20','10901744FOLHqU','1556940oZZylV','repeat','soon','history','\x20created','args','log','Cancelled','schedule:update','description','in\x20','schedules','\x20job','tsv','json','Schedule\x20created:\x20','Show\x20schedule\x20execution\x20history','lastRun','table','Creating\x20schedule:\x20','listQueries','success','Failed\x20to\x20read\x20file:\x20','\x20\x20β\x20','schedule:list','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Searching\x20scheduled\x20queries\x20matching\x20\x22','Updating\x20schedule:\x20','jobs','Getting\x20schedule\x20history...','schedule:show','query','Update\x20a\x20scheduled\x20query','site','retry_limit','m\x20ago','2198178YyvEsU','schedule:delete','ended_at','created_at','Schedule\x20run\x20submitted:\x20','scheduled_at','Getting\x20schedule\x20details...','create','Show\x20schedule\x20details','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','join','limit','schedule:history','152447XgwNxE','executing_user_id','1067490zzOqwS','last_job','keys','dim','timezone','trim'];a27_0x2878=function(){return _0x57da2c;};return a27_0x2878();}function a27_0xb315(_0x31309a,_0x31d08e){_0x31309a=_0x31309a-0x10e;const _0x2878fb=a27_0x2878();let _0xb31591=_0x2878fb[_0x31309a];return _0xb31591;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a27_0x42a7e5 from'chalk';function formatRelativeTime(_0x3a3d32){const _0x3d6398=a27_0xb315,_0x481200=new Date(_0x3a3d32),_0x52197a=new Date(),_0x5d76bf=_0x481200['getTime']()-_0x52197a[_0x3d6398(0x12a)](),_0x1f7d03=Math[_0x3d6398(0x183)](_0x5d76bf)/0x3e8,_0x4ab0a5=_0x5d76bf<0x0;if(_0x1f7d03<0x3c)return _0x4ab0a5?_0x3d6398(0x122):_0x3d6398(0x140);else{if(_0x1f7d03<0xe10){const _0x5715ba=Math[_0x3d6398(0x119)](_0x1f7d03/0x3c);return _0x4ab0a5?_0x5715ba+_0x3d6398(0x161):_0x3d6398(0x148)+_0x5715ba+'m';}else{if(_0x1f7d03<0x15180){const _0x3bdf64=Math['round'](_0x1f7d03/0xe10);return _0x4ab0a5?_0x3bdf64+_0x3d6398(0x18d):_0x3d6398(0x148)+_0x3bdf64+'h';}else{if(_0x1f7d03<0x93a80){const _0x5c10cd=Math['round'](_0x1f7d03/0x15180);return _0x4ab0a5?_0x5c10cd+_0x3d6398(0x192):'in\x20'+_0x5c10cd+'d';}else return _0x481200[_0x3d6398(0x185)]();}}}}export class ScheduleListCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x156);[a27_0x46a180(0x147)]='List\x20scheduled\x20queries';async[a27_0x46a180(0x189)](_0x38c7a1){const _0x388ebf=a27_0x46a180,{options:_0x3487de,args:_0x45a0d3,tdx:_0x2fca22}=_0x38c7a1,_0x3b37ae=resolveLimit(_0x3487de[_0x388ebf(0x16d)],DEFAULT_DISPLAY_LIMIT),_0x2600cb=_0x45a0d3[0x0],_0x32fcb5=_0x2600cb?_0x388ebf(0x158)+_0x2600cb+_0x388ebf(0x17f):'Listing\x20scheduled\x20queries...',_0x552c60=await withSpinner(_0x32fcb5,()=>_0x2fca22[_0x388ebf(0x149)][_0x388ebf(0x152)]({'limit':_0x3b37ae,'scheduled':!![],'pattern':_0x2600cb}),{'verbose':_0x3487de[_0x388ebf(0x134)]}),_0x3cfe21=_0x552c60[_0x388ebf(0x117)]['queries'],_0x42f8cc=_0x552c60['data']['pagination']['has_next_page'],_0x9c7d29=_0x2600cb?'\x20matching\x20\x22'+_0x2600cb+'\x22':'';_0x42f8cc?console[_0x388ebf(0x10e)]('Showing\x20first\x20'+_0x3cfe21[_0x388ebf(0x12d)]+'\x20schedules'+_0x9c7d29+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x388ebf(0x12e)+_0x3cfe21[_0x388ebf(0x12d)]+_0x388ebf(0x133)+(_0x3cfe21['length']!==0x1?_0x388ebf(0x17c):'y')+_0x9c7d29);if(_0x3487de[_0x388ebf(0x137)]===_0x388ebf(0x14c)||_0x3487de['format']==='jsonl'||_0x3487de[_0x388ebf(0x137)]===_0x388ebf(0x150)||_0x3487de['format']===_0x388ebf(0x14b)){const _0x3ec73c=_0x3cfe21[_0x388ebf(0x131)](_0x334f47=>({'id':_0x334f47['id'],'name':_0x334f47['name'],'cron':_0x334f47[_0x388ebf(0x18e)],'database':_0x334f47[_0x388ebf(0x18b)]?.[_0x388ebf(0x10f)],'type':_0x334f47[_0x388ebf(0x114)],'timezone':_0x334f47['time_zone'],'user_name':_0x334f47[_0x388ebf(0x177)]?.[_0x388ebf(0x10f)],'updated_at':_0x334f47['updated_at'],'next_run_at':_0x334f47[_0x388ebf(0x136)],'last_job_status':_0x334f47[_0x388ebf(0x172)]?.[_0x388ebf(0x121)]}));await handleSDKOutput(_0x3ec73c,_0x3487de);}else{if(_0x3cfe21['length']===0x0)console[_0x388ebf(0x144)](_0x388ebf(0x127));else{const _0x567dc5=_0x3487de[_0x388ebf(0x15f)],_0xaf0251=_0x3cfe21[_0x388ebf(0x131)](_0x4b4b1c=>{const _0x5c97f4=_0x388ebf,_0x15d321=_0x4b4b1c[_0x5c97f4(0x172)]?.[_0x5c97f4(0x121)]?_0x4b4b1c[_0x5c97f4(0x172)][_0x5c97f4(0x121)]===_0x5c97f4(0x153)?'β':'β':'-',_0x3f5e85=_0x4b4b1c[_0x5c97f4(0x172)]?.[_0x5c97f4(0x164)]?formatRelativeTime(_0x4b4b1c[_0x5c97f4(0x172)][_0x5c97f4(0x164)]):'never',_0x2201d4=_0x4b4b1c[_0x5c97f4(0x136)]?formatRelativeTime(_0x4b4b1c[_0x5c97f4(0x136)]):'-',_0x19861c=_0x4b4b1c['cron']||'',_0x16a184=_0x4b4b1c[_0x5c97f4(0x10f)]||_0x5c97f4(0x18a),_0x19cf40=getConsoleUrl(_0x567dc5,_0x5c97f4(0x132)+_0x4b4b1c['id']);return{'statusIcon':_0x15d321,'lastRun':_0x3f5e85,'nextRun':_0x2201d4,'cron':_0x19861c,'name':_0x16a184,'queryUrl':_0x19cf40,'status':_0x4b4b1c['last_job']?.['status']};}),_0x4adcc2=Math['max'](..._0xaf0251[_0x388ebf(0x131)](_0x5e9636=>_0x5e9636[_0x388ebf(0x14f)][_0x388ebf(0x12d)])),_0xd30644=Math[_0x388ebf(0x12c)](..._0xaf0251['map'](_0x5b08fa=>_0x5b08fa[_0x388ebf(0x17a)][_0x388ebf(0x12d)])),_0x3240de=Math['max'](..._0xaf0251[_0x388ebf(0x131)](_0x584efe=>_0x584efe[_0x388ebf(0x18e)]['length'])),_0x5854f1=_0xaf0251[_0x388ebf(0x131)](_0x2994d9=>{const _0x2c8b9e=_0x388ebf,_0xde146=_0x2994d9[_0x2c8b9e(0x121)]===_0x2c8b9e(0x153)?a27_0x42a7e5['green'](_0x2994d9['statusIcon']):_0x2994d9['status']===_0x2c8b9e(0x10e)?a27_0x42a7e5[_0x2c8b9e(0x110)](_0x2994d9['statusIcon']):a27_0x42a7e5[_0x2c8b9e(0x174)](_0x2994d9['statusIcon']),_0x14667d=_0x2994d9[_0x2c8b9e(0x14f)][_0x2c8b9e(0x18c)](_0x4adcc2),_0x484833=_0x2994d9['nextRun']['padEnd'](_0xd30644),_0x1c8436=_0x2994d9[_0x2c8b9e(0x18e)]?a27_0x42a7e5[_0x2c8b9e(0x13b)](_0x2994d9[_0x2c8b9e(0x18e)][_0x2c8b9e(0x18c)](_0x3240de)):'\x20'[_0x2c8b9e(0x13f)](_0x3240de),_0x2d317c=hyperlink(_0x2994d9[_0x2c8b9e(0x10f)],_0x2994d9['queryUrl']);return _0x2c8b9e(0x12b)+_0xde146+'\x20'+_0x14667d+_0x2c8b9e(0x155)+_0x484833+'\x20\x20'+_0x1c8436+'\x20\x20'+_0x2d317c;});await writeOutput(_0x5854f1[_0x388ebf(0x16c)]('\x0a'),_0x3487de['output'],_0x388ebf(0x178));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x15c);[a27_0x46a180(0x147)]=a27_0x46a180(0x16a);[a27_0x46a180(0x11f)](_0x36999b){const _0x203947=a27_0x46a180,_0x35119b=_0x36999b[_0x203947(0x143)][0x0];if(!_0x35119b)return _0x203947(0x17e);return undefined;}async[a27_0x46a180(0x189)](_0x2a4109){const _0x44d53b=a27_0x46a180,{options:_0x43fd69,args:_0x403474,tdx:_0x52aaef}=_0x2a4109,_0x182e8b=_0x403474[0x0],_0x312add=await withSpinner(_0x44d53b(0x168),()=>_0x52aaef[_0x44d53b(0x149)][_0x44d53b(0x123)](_0x182e8b),{'verbose':_0x43fd69[_0x44d53b(0x134)]}),_0x5611f6=_0x312add['data'],_0x26797d={'name':_0x5611f6[_0x44d53b(0x10f)],'cron':_0x5611f6['cron'],'database':_0x5611f6['database'],'type':_0x5611f6['type'],'timezone':_0x5611f6[_0x44d53b(0x175)],'user_name':_0x5611f6[_0x44d53b(0x188)],'created_at':_0x5611f6[_0x44d53b(0x165)],'engine_version':_0x5611f6[_0x44d53b(0x129)],'executing_user_id':_0x5611f6[_0x44d53b(0x170)],'query':_0x5611f6[_0x44d53b(0x15d)],'delay':_0x5611f6['delay'],'priority':_0x5611f6[_0x44d53b(0x191)],'retry_limit':_0x5611f6['retry_limit'],..._0x5611f6[_0x44d53b(0x17d)]&&{'result':_0x5611f6[_0x44d53b(0x17d)]}};return await handleSingleObjectOutput(_0x26797d,_0x43fd69),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x18f);[a27_0x46a180(0x147)]='Create\x20a\x20scheduled\x20query';[a27_0x46a180(0x11f)](_0x55a108){const _0x3db0f6=a27_0x46a180,_0x582c09=_0x55a108[_0x3db0f6(0x143)][0x0];if(!_0x582c09)return _0x3db0f6(0x187);return undefined;}async['execute'](_0x326f99){const _0x804028=a27_0x46a180,{options:_0x3c1ca9,args:_0x4c8adc,tdx:_0x5bbd71}=_0x326f99,_0x1ffb7f=_0x4c8adc[0x0],_0x28f965=_0x3c1ca9,_0x2a2af3=_0x28f965[_0x804028(0x18b)],_0x4c62e5=_0x28f965[_0x804028(0x120)],_0x1706d6=_0x28f965[_0x804028(0x114)]||'trino';let _0x401782;try{_0x401782=readFileSync(_0x4c62e5,_0x804028(0x128))[_0x804028(0x176)]();}catch(_0x32e7b8){throw new SDKError(ErrorCode[_0x804028(0x139)],'Failed\x20to\x20read\x20file:\x20'+_0x4c62e5,_0x32e7b8 instanceof Error?_0x32e7b8:undefined);}if(!_0x401782)throw new SDKError(ErrorCode[_0x804028(0x139)],'Query\x20file\x20is\x20empty');const _0x1c1e69={'database':_0x2a2af3,'query':_0x401782,'type':_0x1706d6};if(_0x28f965[_0x804028(0x18e)])_0x1c1e69[_0x804028(0x18e)]=_0x28f965[_0x804028(0x18e)];if(_0x28f965[_0x804028(0x175)])_0x1c1e69[_0x804028(0x175)]=_0x28f965[_0x804028(0x175)];if(_0x28f965[_0x804028(0x118)]!==undefined)_0x1c1e69['delay']=Number(_0x28f965['delay']);if(_0x28f965[_0x804028(0x191)]!==undefined)_0x1c1e69[_0x804028(0x191)]=Number(_0x28f965[_0x804028(0x191)]);if(_0x28f965[_0x804028(0x11b)]!==undefined)_0x1c1e69[_0x804028(0x160)]=Number(_0x28f965[_0x804028(0x11b)]);if(_0x28f965['engineVersion'])_0x1c1e69[_0x804028(0x129)]=_0x28f965['engineVersion'];if(_0x28f965[_0x804028(0x17d)])_0x1c1e69[_0x804028(0x17d)]=_0x28f965[_0x804028(0x17d)];if(_0x3c1ca9[_0x804028(0x134)]){console[_0x804028(0x10e)](_0x804028(0x151)+_0x1ffb7f),console[_0x804028(0x10e)](_0x804028(0x11a)+_0x2a2af3),console[_0x804028(0x10e)](_0x804028(0x13c)+_0x1706d6);if(_0x1c1e69[_0x804028(0x18e)])console[_0x804028(0x10e)]('\x20\x20Cron:\x20'+_0x1c1e69['cron']);if(_0x1c1e69['timezone'])console[_0x804028(0x10e)]('\x20\x20Timezone:\x20'+_0x1c1e69['timezone']);}const _0x43d9ba=await withSpinner(_0x804028(0x190),()=>_0x5bbd71[_0x804028(0x149)][_0x804028(0x169)](_0x1ffb7f,_0x1c1e69),{'verbose':_0x3c1ca9[_0x804028(0x134)]});return console[_0x804028(0x10e)](_0x804028(0x14d)+_0x43d9ba[_0x804028(0x117)][_0x804028(0x10f)]),await handleSingleObjectOutput(_0x43d9ba[_0x804028(0x117)],_0x3c1ca9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x146);['description']=a27_0x46a180(0x15e);['validate'](_0x194951){const _0x264df2=a27_0x46a180,_0x56c8ea=_0x194951[_0x264df2(0x143)][0x0];if(!_0x56c8ea)return _0x264df2(0x157);return undefined;}async[a27_0x46a180(0x189)](_0x70490f){const _0x54efca=a27_0x46a180,{options:_0x11b17f,args:_0xd40bad,tdx:_0xfe2dfa}=_0x70490f,_0x2dac8f=_0xd40bad[0x0],_0x217fa0=_0x11b17f,_0x73db35={};if(_0x217fa0[_0x54efca(0x18b)])_0x73db35[_0x54efca(0x18b)]=_0x217fa0[_0x54efca(0x18b)];if(_0x217fa0[_0x54efca(0x114)])_0x73db35[_0x54efca(0x114)]=_0x217fa0[_0x54efca(0x114)];if(_0x217fa0['cron'])_0x73db35['cron']=_0x217fa0['cron'];if(_0x217fa0[_0x54efca(0x175)])_0x73db35[_0x54efca(0x175)]=_0x217fa0[_0x54efca(0x175)];if(_0x217fa0[_0x54efca(0x118)]!==undefined)_0x73db35[_0x54efca(0x118)]=Number(_0x217fa0[_0x54efca(0x118)]);if(_0x217fa0[_0x54efca(0x191)]!==undefined)_0x73db35[_0x54efca(0x191)]=Number(_0x217fa0[_0x54efca(0x191)]);if(_0x217fa0['retryLimit']!==undefined)_0x73db35[_0x54efca(0x160)]=Number(_0x217fa0['retryLimit']);if(_0x217fa0['engineVersion'])_0x73db35[_0x54efca(0x129)]=_0x217fa0[_0x54efca(0x180)];if(_0x217fa0[_0x54efca(0x17d)])_0x73db35[_0x54efca(0x17d)]=_0x217fa0[_0x54efca(0x17d)];if(_0x217fa0[_0x54efca(0x120)])try{_0x73db35[_0x54efca(0x15d)]=readFileSync(_0x217fa0[_0x54efca(0x120)],'utf-8')['trim']();}catch(_0x365e2d){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x54efca(0x154)+_0x217fa0[_0x54efca(0x120)],_0x365e2d instanceof Error?_0x365e2d:undefined);}if(Object[_0x54efca(0x173)](_0x73db35)[_0x54efca(0x12d)]===0x0)throw new SDKError(ErrorCode[_0x54efca(0x139)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x11b17f['verbose']){console[_0x54efca(0x10e)](_0x54efca(0x159)+_0x2dac8f);for(const [_0x22064f,_0x1885f7]of Object[_0x54efca(0x184)](_0x73db35)){_0x22064f===_0x54efca(0x15d)?console['error']('\x20\x20'+_0x22064f+':\x20'+_0x1885f7[_0x54efca(0x186)](0x0,0x32)+'...'):console[_0x54efca(0x10e)]('\x20\x20'+_0x22064f+':\x20'+_0x1885f7);}}const _0x16cfcf=await withSpinner(_0x54efca(0x17b),()=>_0xfe2dfa[_0x54efca(0x149)][_0x54efca(0x193)](_0x2dac8f,_0x73db35),{'verbose':_0x11b17f[_0x54efca(0x134)]});return console[_0x54efca(0x10e)](_0x54efca(0x11d)+_0x16cfcf['data'][_0x54efca(0x10f)]),await handleSingleObjectOutput(_0x16cfcf[_0x54efca(0x117)],_0x11b17f),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a27_0x46a180(0x163);[a27_0x46a180(0x147)]=a27_0x46a180(0x130);['validate'](_0x258915){const _0x3be3ac=a27_0x46a180,_0x4755d=_0x258915['args'][0x0];if(!_0x4755d)return _0x3be3ac(0x16b);return undefined;}async[a27_0x46a180(0x189)](_0x3742c6){const _0x1985a0=a27_0x46a180,{options:_0x140eff,args:_0x51dc16,tdx:_0x4071fb}=_0x3742c6,_0x592f06=_0x51dc16[0x0];if(!_0x140eff['yes']){const _0x244cd6=await confirm(_0x1985a0(0x181)+_0x592f06+'\x22?');if(!_0x244cd6)return console[_0x1985a0(0x10e)](_0x1985a0(0x145)),0x0;}const _0xf892d1=await withSpinner('Deleting\x20schedule...',()=>_0x4071fb[_0x1985a0(0x149)]['delete'](_0x592f06),{'verbose':_0x140eff['verbose']});return console[_0x1985a0(0x10e)](_0x1985a0(0x112)+_0xf892d1['data'][_0x1985a0(0x10f)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x125);['description']='Run\x20a\x20scheduled\x20query\x20immediately';[a27_0x46a180(0x11f)](_0x4fb39b){const _0x20ad03=a27_0x46a180,_0x1523df=_0x4fb39b[_0x20ad03(0x143)][0x0];if(!_0x1523df)return _0x20ad03(0x13a);return undefined;}async[a27_0x46a180(0x189)](_0x5b7c78){const _0x33a7de=a27_0x46a180,{options:_0xc64321,args:_0x32b546,tdx:_0x2bcb73}=_0x5b7c78,_0x424419=_0x32b546[0x0],_0x59d6e2=_0xc64321,_0x1f7981=_0x59d6e2[_0x33a7de(0x138)],_0x4678f2=_0x59d6e2[_0x33a7de(0x12f)]!==undefined?Number(_0x59d6e2[_0x33a7de(0x12f)]):undefined;if(_0xc64321[_0x33a7de(0x134)]){console[_0x33a7de(0x10e)]('Running\x20schedule:\x20'+_0x424419);if(_0x1f7981)console[_0x33a7de(0x10e)](_0x33a7de(0x11c)+_0x1f7981);if(_0x4678f2)console['error']('\x20\x20Num:\x20'+_0x4678f2);}const _0x97b323=await withSpinner('Running\x20schedule...',()=>_0x2bcb73[_0x33a7de(0x149)][_0x33a7de(0x11e)](_0x424419,{'time':_0x1f7981,'num':_0x4678f2}),{'verbose':_0xc64321['verbose']}),_0x4c3d1c=_0x97b323[_0x33a7de(0x117)][_0x33a7de(0x15a)];console[_0x33a7de(0x10e)](_0x33a7de(0x166)+_0x4c3d1c['length']+_0x33a7de(0x14a)+(_0x4c3d1c[_0x33a7de(0x12d)]!==0x1?'s':'')+_0x33a7de(0x142));for(const _0x12d35e of _0x4c3d1c){console[_0x33a7de(0x10e)](_0x33a7de(0x179)+_0x12d35e[_0x33a7de(0x111)]);}return await handleSDKOutput(_0x4c3d1c,_0xc64321),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a27_0x46a180(0x10f)]=a27_0x46a180(0x16e);['description']=a27_0x46a180(0x14e);[a27_0x46a180(0x11f)](_0x3eac8a){const _0x105c1d=a27_0x46a180,_0x231ac7=_0x3eac8a[_0x105c1d(0x143)][0x0];if(!_0x231ac7)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async['execute'](_0x3216eb){const _0x5dbeec=a27_0x46a180,{options:_0x4287c4,args:_0xcf8740,tdx:_0x16acfb}=_0x3216eb,_0x4ea623=_0xcf8740[0x0],_0x5e2713=_0x4287c4,_0x592244=_0x5e2713[_0x5dbeec(0x113)]!==undefined?Number(_0x5e2713[_0x5dbeec(0x113)]):undefined,_0x3d152d=_0x5e2713['to']!==undefined?Number(_0x5e2713['to']):undefined,_0x5e7050=await withSpinner(_0x5dbeec(0x15b),()=>_0x16acfb[_0x5dbeec(0x149)]['history'](_0x4ea623,{'from':_0x592244,'to':_0x3d152d}),{'verbose':_0x4287c4['verbose']}),_0x26bd08=_0x5e7050[_0x5dbeec(0x117)];console[_0x5dbeec(0x10e)](_0x5dbeec(0x12e)+_0x26bd08[_0x5dbeec(0x116)]+_0x5dbeec(0x182)+(_0x26bd08[_0x5dbeec(0x116)]!==0x1?'s':'')+'\x20(showing\x20'+_0x26bd08[_0x5dbeec(0x113)]+'-'+_0x26bd08['to']+')');const _0x12cf64=_0x26bd08[_0x5dbeec(0x141)][_0x5dbeec(0x131)](_0x26b136=>({'job_id':_0x26b136[_0x5dbeec(0x111)],'type':_0x26b136['type'],'status':_0x26b136[_0x5dbeec(0x121)],'scheduled_at':_0x26b136[_0x5dbeec(0x167)],'created_at':_0x26b136['created_at'],'start_at':_0x26b136[_0x5dbeec(0x126)],'end_at':_0x26b136['end_at']}));return await handleSDKOutput(_0x12cf64,_0x4287c4),0x0;}}
|
|
1
|
+
const a27_0x5d80d7=a27_0x28cd;(function(_0x2b743e,_0x176fa2){const _0xf1ce80=a27_0x28cd,_0x2d2c1f=_0x2b743e();while(!![]){try{const _0x3a69da=-parseInt(_0xf1ce80(0xc7))/0x1+-parseInt(_0xf1ce80(0xb3))/0x2*(-parseInt(_0xf1ce80(0xb9))/0x3)+-parseInt(_0xf1ce80(0x10d))/0x4*(-parseInt(_0xf1ce80(0xf9))/0x5)+parseInt(_0xf1ce80(0x10c))/0x6*(-parseInt(_0xf1ce80(0xcf))/0x7)+parseInt(_0xf1ce80(0xe1))/0x8+parseInt(_0xf1ce80(0xc6))/0x9*(parseInt(_0xf1ce80(0xd3))/0xa)+-parseInt(_0xf1ce80(0xf6))/0xb*(parseInt(_0xf1ce80(0xf8))/0xc);if(_0x3a69da===_0x176fa2)break;else _0x2d2c1f['push'](_0x2d2c1f['shift']());}catch(_0x386dfd){_0x2d2c1f['push'](_0x2d2c1f['shift']());}}}(a27_0x33a7,0xeb81e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a27_0x1ff090 from'chalk';function formatRelativeTime(_0x38f89b){const _0x545f31=a27_0x28cd,_0x187c7f=new Date(_0x38f89b),_0x218a90=new Date(),_0x144b21=_0x187c7f[_0x545f31(0xae)]()-_0x218a90['getTime'](),_0x28e3b4=Math[_0x545f31(0x135)](_0x144b21)/0x3e8,_0x17f195=_0x144b21<0x0;if(_0x28e3b4<0x3c)return _0x17f195?_0x545f31(0x105):_0x545f31(0x101);else{if(_0x28e3b4<0xe10){const _0x41248c=Math['round'](_0x28e3b4/0x3c);return _0x17f195?_0x41248c+_0x545f31(0x118):_0x545f31(0xe9)+_0x41248c+'m';}else{if(_0x28e3b4<0x15180){const _0x38550a=Math[_0x545f31(0x115)](_0x28e3b4/0xe10);return _0x17f195?_0x38550a+_0x545f31(0x11e):_0x545f31(0xe9)+_0x38550a+'h';}else{if(_0x28e3b4<0x93a80){const _0x289672=Math[_0x545f31(0x115)](_0x28e3b4/0x15180);return _0x17f195?_0x289672+_0x545f31(0xe7):'in\x20'+_0x289672+'d';}else return _0x187c7f[_0x545f31(0xb2)]();}}}}function a27_0x28cd(_0x45156f,_0x42d08d){_0x45156f=_0x45156f-0xa5;const _0x33a7ee=a27_0x33a7();let _0x28cd46=_0x33a7ee[_0x45156f];return _0x28cd46;}export class ScheduleListCommand extends BaseCommand{['name']=a27_0x5d80d7(0x11d);[a27_0x5d80d7(0xde)]='List\x20scheduled\x20queries';async[a27_0x5d80d7(0x104)](_0x4713cc){const _0x1b1835=a27_0x5d80d7,{options:_0x39fa71,args:_0x20f5b4,tdx:_0x2b80a7}=_0x4713cc,_0x28050f=resolveLimit(_0x39fa71[_0x1b1835(0x138)],DEFAULT_DISPLAY_LIMIT),_0x4ff7ca=_0x20f5b4[0x0],_0x2f183b=_0x4ff7ca?_0x1b1835(0x133)+_0x4ff7ca+'\x22...':_0x1b1835(0xf2),_0x13a70e=await withSpinner(_0x2f183b,()=>_0x2b80a7[_0x1b1835(0xdb)]['listQueries']({'limit':_0x28050f,'scheduled':!![],'pattern':_0x4ff7ca}),{'verbose':_0x39fa71[_0x1b1835(0xda)]}),_0x187567=_0x13a70e[_0x1b1835(0xf0)]['queries'],_0xc344=_0x13a70e[_0x1b1835(0xf0)][_0x1b1835(0x114)][_0x1b1835(0xc8)],_0x3749c5=_0x4ff7ca?'\x20matching\x20\x22'+_0x4ff7ca+'\x22':'';_0xc344?console[_0x1b1835(0xeb)](_0x1b1835(0xb7)+_0x187567[_0x1b1835(0x112)]+'\x20schedules'+_0x3749c5+_0x1b1835(0xd4)):console['error'](_0x1b1835(0xc5)+_0x187567[_0x1b1835(0x112)]+_0x1b1835(0xbf)+(_0x187567[_0x1b1835(0x112)]!==0x1?_0x1b1835(0xb0):'y')+_0x3749c5);if(_0x39fa71[_0x1b1835(0xce)]==='json'||_0x39fa71['format']===_0x1b1835(0xcb)||_0x39fa71[_0x1b1835(0xce)]===_0x1b1835(0xec)||_0x39fa71[_0x1b1835(0xce)]===_0x1b1835(0x11a)){const _0x3d3d2b=_0x187567[_0x1b1835(0xa8)](_0x515cba=>({'id':_0x515cba['id'],'name':_0x515cba[_0x1b1835(0x11c)],'cron':_0x515cba[_0x1b1835(0xe8)],'database':_0x515cba['database']?.['name'],'type':_0x515cba['type'],'timezone':_0x515cba[_0x1b1835(0xea)],'user_name':_0x515cba[_0x1b1835(0x131)]?.[_0x1b1835(0x11c)],'updated_at':_0x515cba['updated_at'],'next_run_at':_0x515cba['next_run_at'],'last_job_status':_0x515cba[_0x1b1835(0x11f)]?.[_0x1b1835(0xfc)]}));await handleSDKOutput(_0x3d3d2b,_0x39fa71);}else{if(_0x187567[_0x1b1835(0x112)]===0x0)console['log'](_0x1b1835(0xf1));else{const _0x43a29d=_0x39fa71[_0x1b1835(0xee)],_0x3793f4=_0x187567[_0x1b1835(0xa8)](_0x187167=>{const _0x1ae324=_0x1b1835,_0x151a72=_0x187167['last_job']?.[_0x1ae324(0xfc)]?_0x187167['last_job'][_0x1ae324(0xfc)]==='success'?'β':'β':'-',_0x36f8e9=_0x187167[_0x1ae324(0x11f)]?.[_0x1ae324(0xef)]?formatRelativeTime(_0x187167[_0x1ae324(0x11f)]['ended_at']):_0x1ae324(0xe5),_0x4c4cb0=_0x187167[_0x1ae324(0xcd)]?formatRelativeTime(_0x187167[_0x1ae324(0xcd)]):'-',_0x3a2a16=_0x187167[_0x1ae324(0xe8)]||'',_0x3b7294=_0x187167[_0x1ae324(0x11c)]||_0x1ae324(0x122),_0xcddbd8=getConsoleUrl(_0x43a29d,'/app/queries/editor?queryId='+_0x187167['id']);return{'statusIcon':_0x151a72,'lastRun':_0x36f8e9,'nextRun':_0x4c4cb0,'cron':_0x3a2a16,'name':_0x3b7294,'queryUrl':_0xcddbd8,'status':_0x187167[_0x1ae324(0x11f)]?.[_0x1ae324(0xfc)]};}),_0x982182=Math[_0x1b1835(0x111)](..._0x3793f4[_0x1b1835(0xa8)](_0x5d9149=>_0x5d9149[_0x1b1835(0x119)]['length'])),_0x570284=Math[_0x1b1835(0x111)](..._0x3793f4[_0x1b1835(0xa8)](_0x5df45e=>_0x5df45e[_0x1b1835(0xba)]['length'])),_0x2f5dff=Math[_0x1b1835(0x111)](..._0x3793f4['map'](_0x19aded=>_0x19aded[_0x1b1835(0xe8)][_0x1b1835(0x112)])),_0xf700a6=_0x3793f4[_0x1b1835(0xa8)](_0x54b840=>{const _0x42acbe=_0x1b1835,_0x49e4c6=_0x54b840['status']===_0x42acbe(0xd1)?a27_0x1ff090[_0x42acbe(0x12c)](_0x54b840['statusIcon']):_0x54b840[_0x42acbe(0xfc)]==='error'?a27_0x1ff090['red'](_0x54b840[_0x42acbe(0xfb)]):a27_0x1ff090[_0x42acbe(0xf3)](_0x54b840[_0x42acbe(0xfb)]),_0x497867=_0x54b840[_0x42acbe(0x119)]['padEnd'](_0x982182),_0x472bce=_0x54b840[_0x42acbe(0xba)]['padEnd'](_0x570284),_0x558699=_0x54b840['cron']?a27_0x1ff090[_0x42acbe(0xaa)](_0x54b840[_0x42acbe(0xe8)][_0x42acbe(0x103)](_0x2f5dff)):'\x20'[_0x42acbe(0xfa)](_0x2f5dff),_0x2b09b6=hyperlink(_0x54b840[_0x42acbe(0x11c)],_0x54b840['queryUrl']);return _0x42acbe(0x134)+_0x49e4c6+'\x20'+_0x497867+_0x42acbe(0xd6)+_0x472bce+'\x20\x20'+_0x558699+'\x20\x20'+_0x2b09b6;});await writeOutput(_0xf700a6['join']('\x0a'),_0x39fa71[_0x1b1835(0xb5)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xc3);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xb6);[a27_0x5d80d7(0x128)](_0x3f73cd){const _0x4ba627=a27_0x5d80d7,_0x17cc06=_0x3f73cd[_0x4ba627(0x11b)][0x0];if(!_0x17cc06)return _0x4ba627(0xdd);return undefined;}async[a27_0x5d80d7(0x104)](_0x161a98){const _0x4e84fb=a27_0x5d80d7,{options:_0x4bb660,args:_0x2f0529,tdx:_0x360772}=_0x161a98,_0x5d6521=_0x2f0529[0x0],_0x4de2ac=await withSpinner(_0x4e84fb(0x125),()=>_0x360772[_0x4e84fb(0xdb)][_0x4e84fb(0xcc)](_0x5d6521),{'verbose':_0x4bb660[_0x4e84fb(0xda)]}),_0x2ee522=_0x4de2ac['data'],_0x234042={'name':_0x2ee522['name'],'cron':_0x2ee522['cron'],'database':_0x2ee522['database'],'type':_0x2ee522[_0x4e84fb(0xd8)],'timezone':_0x2ee522[_0x4e84fb(0x10f)],'user_name':_0x2ee522['user_name'],'created_at':_0x2ee522[_0x4e84fb(0xdf)],'engine_version':_0x2ee522[_0x4e84fb(0xf7)],'executing_user_id':_0x2ee522['executing_user_id'],'query':_0x2ee522[_0x4e84fb(0x12a)],'delay':_0x2ee522[_0x4e84fb(0xab)],'priority':_0x2ee522['priority'],'retry_limit':_0x2ee522['retry_limit'],..._0x2ee522[_0x4e84fb(0x123)]&&{'result':_0x2ee522['result']}};return await handleSingleObjectOutput(_0x234042,_0x4bb660),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xe6);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xaf);['validate'](_0x35817b){const _0x4c03c6=a27_0x5d80d7,_0x39cc4e=_0x35817b['args'][0x0];if(!_0x39cc4e)return _0x4c03c6(0x106);return undefined;}async[a27_0x5d80d7(0x104)](_0x5ac02a){const _0x1749c9=a27_0x5d80d7,{options:_0x16b336,args:_0x866cd7,tdx:_0x2a1ab7}=_0x5ac02a,_0x5929ff=_0x866cd7[0x0],_0x54185d=_0x16b336,_0x1c2b31=_0x54185d[_0x1749c9(0xf4)],_0xc56ffc=_0x54185d[_0x1749c9(0x136)],_0x33986a=_0x54185d[_0x1749c9(0xd8)]||_0x1749c9(0xb4);let _0x43b79f;try{_0x43b79f=readFileSync(_0xc56ffc,_0x1749c9(0x130))[_0x1749c9(0xc2)]();}catch(_0x456278){throw new SDKError(ErrorCode[_0x1749c9(0x127)],_0x1749c9(0x132)+_0xc56ffc,_0x456278 instanceof Error?_0x456278:undefined);}if(!_0x43b79f)throw new SDKError(ErrorCode[_0x1749c9(0x127)],_0x1749c9(0xd2));const _0x2c447d={'database':_0x1c2b31,'query':_0x43b79f,'type':_0x33986a};if(_0x54185d[_0x1749c9(0xe8)])_0x2c447d[_0x1749c9(0xe8)]=_0x54185d[_0x1749c9(0xe8)];if(_0x54185d[_0x1749c9(0x10f)])_0x2c447d[_0x1749c9(0x10f)]=_0x54185d['timezone'];if(_0x54185d[_0x1749c9(0xab)]!==undefined)_0x2c447d['delay']=Number(_0x54185d['delay']);if(_0x54185d[_0x1749c9(0xbb)]!==undefined)_0x2c447d[_0x1749c9(0xbb)]=Number(_0x54185d[_0x1749c9(0xbb)]);if(_0x54185d[_0x1749c9(0xfe)]!==undefined)_0x2c447d[_0x1749c9(0xb8)]=Number(_0x54185d[_0x1749c9(0xfe)]);if(_0x54185d[_0x1749c9(0xe2)])_0x2c447d['engine_version']=_0x54185d['engineVersion'];if(_0x54185d['result'])_0x2c447d['result']=_0x54185d[_0x1749c9(0x123)];if(_0x16b336[_0x1749c9(0xda)]){console[_0x1749c9(0xeb)]('Creating\x20schedule:\x20'+_0x5929ff),console[_0x1749c9(0xeb)](_0x1749c9(0x107)+_0x1c2b31),console[_0x1749c9(0xeb)]('\x20\x20Type:\x20'+_0x33986a);if(_0x2c447d['cron'])console[_0x1749c9(0xeb)](_0x1749c9(0xac)+_0x2c447d[_0x1749c9(0xe8)]);if(_0x2c447d[_0x1749c9(0x10f)])console[_0x1749c9(0xeb)]('\x20\x20Timezone:\x20'+_0x2c447d[_0x1749c9(0x10f)]);}const _0x242b8a=await withSpinner(_0x1749c9(0xd7),()=>_0x2a1ab7[_0x1749c9(0xdb)][_0x1749c9(0xd9)](_0x5929ff,_0x2c447d),{'verbose':_0x16b336[_0x1749c9(0xda)]});return console[_0x1749c9(0xeb)](_0x1749c9(0x12f)+_0x242b8a['data'][_0x1749c9(0x11c)]),await handleSingleObjectOutput(_0x242b8a[_0x1749c9(0xf0)],_0x16b336),0x0;}}function a27_0x33a7(){const _0x5cbb13=['site','ended_at','data','No\x20scheduled\x20queries\x20found','Listing\x20scheduled\x20queries...','dim','database','run','2629itbFZU','engine_version','70788jOvJtb','52805daJxbt','repeat','statusIcon','status','\x20\x20Time:\x20','retryLimit','schedule:history','Deleting\x20schedule...','soon','\x20(showing\x20','padEnd','execute','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Database:\x20','from','scheduled_at','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Updating\x20schedule...','6648402rbcBJQ','364hJqGdC','Update\x20a\x20scheduled\x20query','timezone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','max','length','substring','pagination','round','Delete\x20a\x20scheduled\x20query','update','m\x20ago','lastRun','tsv','args','name','schedule:list','h\x20ago','last_job','Updating\x20schedule:\x20','\x20execution','(unnamed)','result','schedule:update','Getting\x20schedule\x20details...','Running\x20schedule...','INVALID_ARGUMENT','validate','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','query','Schedule\x20updated:\x20','green','schedule:run','jobs','Schedule\x20created:\x20','utf-8','user','Failed\x20to\x20read\x20file:\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','π
\x20','abs','file','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','limit','yes','job_id','Getting\x20schedule\x20history...','map','keys','cyan','delay','\x20\x20Cron:\x20','Schedule\x20deleted:\x20','getTime','Create\x20a\x20scheduled\x20query','ies','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','toLocaleDateString','4QdMxEc','trino','output','Show\x20schedule\x20details','Showing\x20first\x20','retry_limit','2100921TqBmyY','nextRun','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Schedule\x20run\x20submitted:\x20','num','\x20scheduled\x20quer','count','end_at','trim','schedule:show','time','Found\x20','927aMYsDe','818342xNmNNO','has_next_page','Run\x20a\x20scheduled\x20query\x20immediately','Cancelled','jsonl','show','next_run_at','format','7pysWys','\x20created','success','Query\x20file\x20is\x20empty','43910VrDwrE','\x20(use\x20--limit\x20to\x20see\x20more)','...','\x20\x20β\x20','Creating\x20schedule...','type','create','verbose','schedules','\x20job','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','description','created_at','delete','11895760zcxJfd','engineVersion','start_at','Show\x20schedule\x20execution\x20history','never','schedule:create','d\x20ago','cron','in\x20','time_zone','error','table','history'];a27_0x33a7=function(){return _0x5cbb13;};return a27_0x33a7();}export class ScheduleUpdateCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0x124);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0x10e);[a27_0x5d80d7(0x128)](_0x4a8baa){const _0x295254=a27_0x5d80d7,_0x1f12f3=_0x4a8baa[_0x295254(0x11b)][0x0];if(!_0x1f12f3)return _0x295254(0x110);return undefined;}async[a27_0x5d80d7(0x104)](_0x254880){const _0x25b6f6=a27_0x5d80d7,{options:_0x4ebc5e,args:_0x15c907,tdx:_0x34eb7d}=_0x254880,_0x567235=_0x15c907[0x0],_0x15193f=_0x4ebc5e,_0x3fed0a={};if(_0x15193f[_0x25b6f6(0xf4)])_0x3fed0a[_0x25b6f6(0xf4)]=_0x15193f[_0x25b6f6(0xf4)];if(_0x15193f[_0x25b6f6(0xd8)])_0x3fed0a[_0x25b6f6(0xd8)]=_0x15193f[_0x25b6f6(0xd8)];if(_0x15193f[_0x25b6f6(0xe8)])_0x3fed0a[_0x25b6f6(0xe8)]=_0x15193f[_0x25b6f6(0xe8)];if(_0x15193f[_0x25b6f6(0x10f)])_0x3fed0a[_0x25b6f6(0x10f)]=_0x15193f[_0x25b6f6(0x10f)];if(_0x15193f[_0x25b6f6(0xab)]!==undefined)_0x3fed0a[_0x25b6f6(0xab)]=Number(_0x15193f[_0x25b6f6(0xab)]);if(_0x15193f[_0x25b6f6(0xbb)]!==undefined)_0x3fed0a[_0x25b6f6(0xbb)]=Number(_0x15193f[_0x25b6f6(0xbb)]);if(_0x15193f[_0x25b6f6(0xfe)]!==undefined)_0x3fed0a[_0x25b6f6(0xb8)]=Number(_0x15193f[_0x25b6f6(0xfe)]);if(_0x15193f[_0x25b6f6(0xe2)])_0x3fed0a[_0x25b6f6(0xf7)]=_0x15193f[_0x25b6f6(0xe2)];if(_0x15193f[_0x25b6f6(0x123)])_0x3fed0a[_0x25b6f6(0x123)]=_0x15193f[_0x25b6f6(0x123)];if(_0x15193f[_0x25b6f6(0x136)])try{_0x3fed0a[_0x25b6f6(0x12a)]=readFileSync(_0x15193f['file'],_0x25b6f6(0x130))[_0x25b6f6(0xc2)]();}catch(_0x5a5aba){throw new SDKError(ErrorCode[_0x25b6f6(0x127)],_0x25b6f6(0x132)+_0x15193f[_0x25b6f6(0x136)],_0x5a5aba instanceof Error?_0x5a5aba:undefined);}if(Object[_0x25b6f6(0xa9)](_0x3fed0a)[_0x25b6f6(0x112)]===0x0)throw new SDKError(ErrorCode[_0x25b6f6(0x127)],_0x25b6f6(0x10a));if(_0x4ebc5e['verbose']){console[_0x25b6f6(0xeb)](_0x25b6f6(0x120)+_0x567235);for(const [_0x14272c,_0x379833]of Object['entries'](_0x3fed0a)){_0x14272c===_0x25b6f6(0x12a)?console['error']('\x20\x20'+_0x14272c+':\x20'+_0x379833[_0x25b6f6(0x113)](0x0,0x32)+_0x25b6f6(0xd5)):console['error']('\x20\x20'+_0x14272c+':\x20'+_0x379833);}}const _0xd4cf26=await withSpinner(_0x25b6f6(0x10b),()=>_0x34eb7d[_0x25b6f6(0xdb)][_0x25b6f6(0x117)](_0x567235,_0x3fed0a),{'verbose':_0x4ebc5e[_0x25b6f6(0xda)]});return console[_0x25b6f6(0xeb)](_0x25b6f6(0x12b)+_0xd4cf26['data'][_0x25b6f6(0x11c)]),await handleSingleObjectOutput(_0xd4cf26[_0x25b6f6(0xf0)],_0x4ebc5e),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]='schedule:delete';[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0x116);[a27_0x5d80d7(0x128)](_0x23e144){const _0x1c0f4b=a27_0x5d80d7,_0x44e5f2=_0x23e144['args'][0x0];if(!_0x44e5f2)return _0x1c0f4b(0xbc);return undefined;}async['execute'](_0xd0de46){const _0x341cae=a27_0x5d80d7,{options:_0x4a347d,args:_0x467879,tdx:_0xa32a50}=_0xd0de46,_0x142712=_0x467879[0x0];if(!_0x4a347d[_0x341cae(0xa5)]){const _0xd8bea4=await confirm(_0x341cae(0x137)+_0x142712+'\x22?');if(!_0xd8bea4)return console[_0x341cae(0xeb)](_0x341cae(0xca)),0x0;}const _0x519198=await withSpinner(_0x341cae(0x100),()=>_0xa32a50[_0x341cae(0xdb)][_0x341cae(0xe0)](_0x142712),{'verbose':_0x4a347d[_0x341cae(0xda)]});return console[_0x341cae(0xeb)](_0x341cae(0xad)+_0x519198['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0x12d);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xc9);[a27_0x5d80d7(0x128)](_0x31bbe8){const _0x58ddb0=a27_0x5d80d7,_0x5f247b=_0x31bbe8[_0x58ddb0(0x11b)][0x0];if(!_0x5f247b)return _0x58ddb0(0xb1);return undefined;}async[a27_0x5d80d7(0x104)](_0x38ffd4){const _0x33d121=a27_0x5d80d7,{options:_0x13ae01,args:_0x2e145d,tdx:_0x30873b}=_0x38ffd4,_0x378cd3=_0x2e145d[0x0],_0xabd0c7=_0x13ae01,_0xb98924=_0xabd0c7[_0x33d121(0xc4)],_0x2dd74e=_0xabd0c7[_0x33d121(0xbe)]!==undefined?Number(_0xabd0c7[_0x33d121(0xbe)]):undefined;if(_0x13ae01[_0x33d121(0xda)]){console[_0x33d121(0xeb)]('Running\x20schedule:\x20'+_0x378cd3);if(_0xb98924)console[_0x33d121(0xeb)](_0x33d121(0xfd)+_0xb98924);if(_0x2dd74e)console[_0x33d121(0xeb)]('\x20\x20Num:\x20'+_0x2dd74e);}const _0x5ba469=await withSpinner(_0x33d121(0x126),()=>_0x30873b[_0x33d121(0xdb)][_0x33d121(0xf5)](_0x378cd3,{'time':_0xb98924,'num':_0x2dd74e}),{'verbose':_0x13ae01[_0x33d121(0xda)]}),_0x17889f=_0x5ba469['data'][_0x33d121(0x12e)];console['error'](_0x33d121(0xbd)+_0x17889f[_0x33d121(0x112)]+_0x33d121(0xdc)+(_0x17889f[_0x33d121(0x112)]!==0x1?'s':'')+_0x33d121(0xd0));for(const _0x4977f6 of _0x17889f){console['error']('\x20\x20Job\x20ID:\x20'+_0x4977f6[_0x33d121(0xa6)]);}return await handleSDKOutput(_0x17889f,_0x13ae01),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a27_0x5d80d7(0x11c)]=a27_0x5d80d7(0xff);[a27_0x5d80d7(0xde)]=a27_0x5d80d7(0xe4);['validate'](_0x2763a6){const _0x55ef58=a27_0x5d80d7,_0x542047=_0x2763a6['args'][0x0];if(!_0x542047)return _0x55ef58(0x129);return undefined;}async['execute'](_0x602fd1){const _0x386afa=a27_0x5d80d7,{options:_0x10eb6f,args:_0x472605,tdx:_0x3d0fa9}=_0x602fd1,_0x555ee8=_0x472605[0x0],_0x3b8d42=_0x10eb6f,_0x4d153c=_0x3b8d42[_0x386afa(0x108)]!==undefined?Number(_0x3b8d42['from']):undefined,_0x17a0f6=_0x3b8d42['to']!==undefined?Number(_0x3b8d42['to']):undefined,_0x39ec71=await withSpinner(_0x386afa(0xa7),()=>_0x3d0fa9['schedules'][_0x386afa(0xed)](_0x555ee8,{'from':_0x4d153c,'to':_0x17a0f6}),{'verbose':_0x10eb6f[_0x386afa(0xda)]}),_0x966b46=_0x39ec71[_0x386afa(0xf0)];console['error'](_0x386afa(0xc5)+_0x966b46[_0x386afa(0xc0)]+_0x386afa(0x121)+(_0x966b46[_0x386afa(0xc0)]!==0x1?'s':'')+_0x386afa(0x102)+_0x966b46[_0x386afa(0x108)]+'-'+_0x966b46['to']+')');const _0x4d93f6=_0x966b46[_0x386afa(0xed)][_0x386afa(0xa8)](_0x365ef3=>({'job_id':_0x365ef3['job_id'],'type':_0x365ef3[_0x386afa(0xd8)],'status':_0x365ef3['status'],'scheduled_at':_0x365ef3[_0x386afa(0x109)],'created_at':_0x365ef3['created_at'],'start_at':_0x365ef3[_0x386afa(0xe3)],'end_at':_0x365ef3[_0x386afa(0xc1)]}));return await handleSDKOutput(_0x4d93f6,_0x10eb6f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a28_0x4557fe=a28_0x2b89;(function(_0x5917c1,_0x3f6bad){const _0x3c5966=a28_0x2b89,_0xe16400=_0x5917c1();while(!![]){try{const _0x15bc51=parseInt(_0x3c5966(0x12b))/0x1+parseInt(_0x3c5966(0xe2))/0x2*(parseInt(_0x3c5966(0xe3))/0x3)+parseInt(_0x3c5966(0x105))/0x4+-parseInt(_0x3c5966(0x110))/0x5*(parseInt(_0x3c5966(0xf2))/0x6)+parseInt(_0x3c5966(0xb0))/0x7+parseInt(_0x3c5966(0x12f))/0x8*(parseInt(_0x3c5966(0xbb))/0x9)+-parseInt(_0x3c5966(0x9c))/0xa;if(_0x15bc51===_0x3f6bad)break;else _0xe16400['push'](_0xe16400['shift']());}catch(_0x7d02cd){_0xe16400['push'](_0xe16400['shift']());}}}(a28_0x2fed,0x9a26c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a28_0x13d744 from'chalk';async function resolveSegmentTarget(_0x31cb5a,_0x6d4086,_0x594f07){const _0x51dad8=a28_0x2b89;if(isYamlFilePath(_0x31cb5a))try{const _0x299164=await resolveYamlFilePath(_0x31cb5a);return _0x594f07&&(console[_0x51dad8(0x11a)](_0x51dad8(0xeb)+_0x31cb5a),console[_0x51dad8(0x11a)]('\x20\x20Parent\x20segment:\x20'+_0x299164[_0x51dad8(0xa4)]),console[_0x51dad8(0x11a)](_0x51dad8(0xad)+_0x299164['segmentName']),console[_0x51dad8(0x11a)](_0x51dad8(0x130)+(_0x299164[_0x51dad8(0xd1)]||_0x51dad8(0xb3))),console[_0x51dad8(0x11a)](_0x51dad8(0xe1)+_0x299164[_0x51dad8(0x125)])),_0x299164[_0x51dad8(0x125)];}catch(_0x41461b){throw new SDKError(ErrorCode[_0x51dad8(0x113)],_0x51dad8(0xcd)+_0x41461b[_0x51dad8(0x118)]);}if(!_0x6d4086)throw new SDKError(ErrorCode[_0x51dad8(0x113)],_0x51dad8(0xba));return _0x6d4086+'/'+_0x31cb5a;}export class SegmentDescribeCommand extends BaseCommand{['name']=a28_0x4557fe(0xce);[a28_0x4557fe(0x106)]='Show\x20segment\x20or\x20folder\x20details';async[a28_0x4557fe(0x10f)](_0x33a598){const _0x5382cb=a28_0x4557fe,{options:_0xce1972,args:_0x210953,tdx:_0x643770}=_0x33a598,_0x303db9=_0x210953[0x0],_0x5803fe=!_0x303db9&&!!_0xce1972[_0x5382cb(0xa4)],_0x19007f=_0x303db9||_0xce1972['parentSegment'];if(!_0x19007f)return console[_0x5382cb(0x11a)](_0x5382cb(0xdd)),console['error'](_0x5382cb(0xff)),console[_0x5382cb(0x11a)](_0x5382cb(0x116)),console[_0x5382cb(0x11a)](_0x5382cb(0xa2)),console[_0x5382cb(0x11a)](_0x5382cb(0xa3)),console['error'](_0x5382cb(0x10d)),console[_0x5382cb(0x11a)](_0x5382cb(0xb6)),0x1;try{const _0x2fed92=_0xce1972[_0x5382cb(0xc0)];let _0x5d0a04=_0x19007f;!_0x5803fe&&_0x2fed92&&!_0x19007f[_0x5382cb(0xc3)]('/')&&(_0x5d0a04=_0x2fed92+'/'+_0x19007f,_0xce1972[_0x5382cb(0x104)]&&console[_0x5382cb(0x11a)]('Resolved\x20relative\x20path\x20to:\x20'+_0x5d0a04));const _0x9cd1f8=await withSpinner(_0x5382cb(0x12c)+_0x5d0a04+_0x5382cb(0xbc),()=>_0x643770[_0x5382cb(0x9f)][_0x5382cb(0x103)](_0x5d0a04),{'verbose':_0xce1972[_0x5382cb(0x104)]}),_0x3a4443=_0x9cd1f8[_0x5382cb(0x98)];_0xce1972[_0x5382cb(0x104)]&&(console['error'](_0x5382cb(0xf1)+_0x3a4443['type']),console[_0x5382cb(0x11a)](_0x5382cb(0xd8)+_0x3a4443[_0x5382cb(0x10b)]),_0x3a4443[_0x5382cb(0xdc)]&&console[_0x5382cb(0x11a)](_0x5382cb(0xfd)+_0x3a4443[_0x5382cb(0xdc)]),_0x3a4443[_0x5382cb(0x10a)]&&console[_0x5382cb(0x11a)](_0x5382cb(0xb1)+_0x3a4443['segmentId']));if(_0x3a4443[_0x5382cb(0x107)]===_0x5382cb(0xc2)){const _0x1be9a3=await withSpinner(_0x5382cb(0xd9),()=>_0x643770[_0x5382cb(0x9f)]['getParent'](_0x3a4443[_0x5382cb(0x10b)]),{'verbose':_0xce1972['verbose']});await handleSingleObjectOutput(_0x1be9a3[_0x5382cb(0x98)],_0xce1972);}else{if(_0x3a4443[_0x5382cb(0x107)]===_0x5382cb(0x12e)){if(!_0x3a4443[_0x5382cb(0xdc)])throw new SDKError(ErrorCode[_0x5382cb(0xf3)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x59e55e=await withSpinner(_0x5382cb(0xc5),()=>_0x643770[_0x5382cb(0x9f)][_0x5382cb(0xef)](_0x3a4443[_0x5382cb(0xdc)]),{'verbose':_0xce1972['verbose']});await handleSingleObjectOutput(_0x59e55e['data'],_0xce1972);}else{if(_0x3a4443['type']===_0x5382cb(0x9f)){if(!_0x3a4443[_0x5382cb(0x10a)])throw new SDKError(ErrorCode[_0x5382cb(0xc8)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x7505c1=await withSpinner(_0x5382cb(0xcf),()=>_0x643770[_0x5382cb(0x9f)]['getSegment'](_0x3a4443[_0x5382cb(0x10b)],_0x3a4443[_0x5382cb(0x10a)]),{'verbose':_0xce1972[_0x5382cb(0x104)]});await handleSingleObjectOutput(_0x7505c1[_0x5382cb(0x98)],_0xce1972);}}}return 0x0;}catch(_0x49491f){if(_0x49491f instanceof SDKError)return console['error'](_0x5382cb(0x112)+_0x49491f[_0x5382cb(0x118)]),_0x49491f[_0x5382cb(0xd3)]&&console[_0x5382cb(0x11a)](_0x5382cb(0x126)+_0x49491f[_0x5382cb(0xd3)]),0x1;throw _0x49491f;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a28_0x4557fe(0x106)]=a28_0x4557fe(0xbf);async['execute'](_0x52e7dc){const _0x3b74f1=a28_0x4557fe,{options:_0x3db293,args:_0x512c80,tdx:_0x43de4a}=_0x52e7dc,_0x2ab65c=_0x512c80[0x0];if(!_0x2ab65c)return console['error'](_0x3b74f1(0x11d)),console[_0x3b74f1(0x11a)](_0x3b74f1(0x128)),console['error'](_0x3b74f1(0xee)),console['error'](_0x3b74f1(0x116)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x3b74f1(0x11a)](_0x3b74f1(0xe6)),0x1;try{const _0x439509=_0x3db293['parentSegment'],_0x134d49=await resolveSegmentTarget(_0x2ab65c,_0x439509,_0x3db293[_0x3b74f1(0x104)]);_0x3db293[_0x3b74f1(0x104)]&&console[_0x3b74f1(0x11a)](_0x3b74f1(0xb9)+_0x134d49);const _0xecea5b=await withSpinner('Resolving\x20\x27'+_0x2ab65c+_0x3b74f1(0xbc),()=>_0x43de4a[_0x3b74f1(0x9f)]['resolvePathToResource'](_0x134d49),{'verbose':_0x3db293[_0x3b74f1(0x104)]}),_0x2ff437=_0xecea5b[_0x3b74f1(0x98)];_0x3db293[_0x3b74f1(0x104)]&&(console[_0x3b74f1(0x11a)](_0x3b74f1(0xf1)+_0x2ff437[_0x3b74f1(0x107)]),console[_0x3b74f1(0x11a)](_0x3b74f1(0xd8)+_0x2ff437[_0x3b74f1(0x10b)]));if(_0x2ff437['type']==='folder')return console[_0x3b74f1(0x11a)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x3b74f1(0x11a)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2ff437[_0x3b74f1(0x107)]===_0x3b74f1(0xc2))return console[_0x3b74f1(0x11a)](_0x3b74f1(0x119)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x2ff437[_0x3b74f1(0x10a)])throw new SDKError(ErrorCode[_0x3b74f1(0xc8)],_0x3b74f1(0xe5));const _0x17b955=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x43de4a[_0x3b74f1(0x9f)][_0x3b74f1(0xc4)](_0x2ff437['parentId'],_0x2ff437[_0x3b74f1(0x10a)]),{'verbose':_0x3db293['verbose']});let _0x4ff1a3=_0x17b955['data'];const _0x533290=resolveLimit(_0x3db293[_0x3b74f1(0xe0)],DEFAULT_DISPLAY_LIMIT),_0x2e8aab=/\bLIMIT\s+\d+/i['test'](_0x4ff1a3);!_0x2e8aab&&(_0x4ff1a3=_0x4ff1a3[_0x3b74f1(0xa1)]()[_0x3b74f1(0xc6)](/;+$/,''),_0x4ff1a3=_0x3b74f1(0xd0)+_0x4ff1a3+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x533290);_0x3db293['verbose']&&console[_0x3b74f1(0x11a)](_0x3b74f1(0x9e)+_0x4ff1a3);const _0x380c49=await withProgressSpinner(_0x3b74f1(0xfe),async _0x2dab24=>{const _0x45f8d6=_0x3b74f1,_0x1761cf=await _0x43de4a['query'][_0x45f8d6(0x10f)](_0x4ff1a3,{'catalog':'td','schema':_0x45f8d6(0xaf),'onJobId':_0x44ac50=>{const _0x39f1e9=_0x45f8d6;_0x2dab24[_0x39f1e9(0xa0)](_0x44ac50);}});return _0x1761cf;},{'verbose':_0x3db293[_0x3b74f1(0x104)]}),_0xccb92b=_0x380c49['data'],_0x1585b0=_0xccb92b[_0x3b74f1(0x99)]?_0x3b74f1(0x9d)+_0xccb92b[_0x3b74f1(0x99)]+']':'';return console['error'](_0x3b74f1(0xc9)+_0xccb92b[_0x3b74f1(0x109)][_0x3b74f1(0x11c)]['toLocaleString']()+'\x20rows\x20'+(_0x3b74f1(0x11e)+formatElapsed(_0xccb92b[_0x3b74f1(0x109)][_0x3b74f1(0x117)])+_0x1585b0)),await handleQueryOutput(_0xccb92b,_0x3db293),0x0;}catch(_0x455de0){if(_0x455de0 instanceof SDKError)return console[_0x3b74f1(0x11a)](_0x3b74f1(0xb5)+_0x455de0[_0x3b74f1(0x127)]+']'),console[_0x3b74f1(0x11a)]('\x0a'+_0x455de0[_0x3b74f1(0x118)]),0x1;throw _0x455de0;}}}function a28_0x2fed(){const _0x376f14=['listFolders','Resolved\x20type:\x20','57252nemIms','SEGMENT_FOLDER_NOT_FOUND','length','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','web','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folder\x20ID:\x20','Executing\x20segment\x20query...','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20parent\x20segment\x20\x27','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','resolvePathToResource','verbose','2087660xNLkkW','description','type','Site:\x20','stats','segmentId','parentId','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20folder\x20ID:\x20','execute','65QvZmxP','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20','INVALID_ARGUMENT','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','site','Examples:','elapsedTimeMillis','message','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','error','Listing\x20folders\x20for\x20parent\x20\x27','processedRows','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','in\x20','getSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Folder\x20name:\x20','/e/','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','fullPath','\x20\x20Cause:\x20','code','Usage:\x20tdx\x20sg\x20show\x20<name>','resolveParentId','Resolved\x20parent\x20ID:\x20','542808MAlgyM','Resolving\x20path\x20\x27','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folder','8KLjDbD','\x20\x20Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','createFolder','data','jobId','Creating\x20folder\x20\x27','segment:sql','28209190zHyqMV','\x20[Job\x20ID:\x20','SQL\x20query:\x0a','segment','setJobId','trim','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','parentSegment','segment:folder:show','url','Usage:\x20tdx\x20sg\x20desc\x20<name>','Show\x20folder\x20or\x20child\x20segment\x20details','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20folder','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','information_schema','6798197HzDRCK','Segment\x20ID:\x20','green','(root)','Parent\x20segment:\x20','β\x20Query\x20failed\x20[','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Resolving\x20\x27','Resolved\x20parent\x20folder\x20ID:\x20','Target\x20path:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','9524403OXAGdu','\x27...','cyan','Show\x20segment\x20folder\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segmentPath','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','parent','includes','getSegmentSQL','Fetching\x20folder\x20details...','replace','Get\x20SQL\x20query\x20for\x20child\x20segment','SEGMENT_NOT_FOUND','β\x20Query\x20completed:\x20Processed\x20','segment:folder:create','segment:view','format','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segment:describe','Fetching\x20segment\x20details...','SELECT\x20*\x20FROM\x20(\x0a','folderPath','jsonl','cause','log','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20view','Resolving\x20folder\x20\x27','Parent\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','folderId','Error:\x20Path\x20or\x20name\x20is\x20required','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20ps\x20desc','limit','\x20\x20Full\x20path:\x20','24GDWcJk','120552tnhXQB','Resolving\x20parent\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentFolder','Parent\x20name:\x20','segment:desc','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolved\x20YAML\x20file:\x20','segment:folder:list','Use:\x20tdx\x20ps\x20sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getFolder'];a28_0x2fed=function(){return _0x376f14;};return a28_0x2fed();}export class SegmentFolderListCommand extends BaseCommand{['name']=a28_0x4557fe(0xec);[a28_0x4557fe(0x106)]=a28_0x4557fe(0xde);async['execute'](_0xbd4dd2){const _0x9e158b=a28_0x4557fe,{options:_0x12c31c,args:_0x16d227,tdx:_0x2d64fa}=_0xbd4dd2;if(_0x16d227[_0x9e158b(0xf4)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x9e158b(0x11a)](_0x9e158b(0xab)),0x1;const _0x19466f=_0x16d227[0x0];try{_0x12c31c[_0x9e158b(0x104)]&&(console[_0x9e158b(0x11a)](_0x9e158b(0x108)+_0x12c31c[_0x9e158b(0x115)]),console[_0x9e158b(0x11a)](_0x9e158b(0xe8)+_0x19466f));const _0x671ca5=await withSpinner(_0x9e158b(0x100)+_0x19466f+_0x9e158b(0xbc),()=>_0x2d64fa['segment']['resolveParentId'](_0x19466f),{'verbose':_0x12c31c[_0x9e158b(0x104)]}),_0x415d57=_0x671ca5[_0x9e158b(0x98)];_0x12c31c['verbose']&&console[_0x9e158b(0x11a)](_0x9e158b(0x12a)+_0x415d57);const _0x47c4c4=await withSpinner(_0x9e158b(0x11b)+_0x19466f+_0x9e158b(0xbc),()=>_0x2d64fa[_0x9e158b(0x9f)][_0x9e158b(0xf0)](_0x415d57),{'verbose':_0x12c31c[_0x9e158b(0x104)]}),_0x40eb7d=_0x47c4c4[_0x9e158b(0x98)];return console[_0x9e158b(0x11a)]('β\x20Found\x20'+_0x40eb7d[_0x9e158b(0xf4)]+_0x9e158b(0xac)+(_0x40eb7d[_0x9e158b(0xf4)]!==0x1?'s':'')),await handleSDKOutput(_0x40eb7d,_0x12c31c),0x0;}catch(_0x5bbb2f){if(_0x5bbb2f instanceof SDKError)return console[_0x9e158b(0x11a)](_0x9e158b(0x112)+_0x5bbb2f[_0x9e158b(0x118)]),_0x5bbb2f[_0x9e158b(0xd3)]&&console[_0x9e158b(0x11a)](_0x9e158b(0x126)+_0x5bbb2f[_0x9e158b(0xd3)]),0x1;throw _0x5bbb2f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a28_0x4557fe(0x123)]=a28_0x4557fe(0xa5);[a28_0x4557fe(0x106)]=a28_0x4557fe(0xbe);async[a28_0x4557fe(0x10f)](_0x3d6836){const _0x13478d=a28_0x4557fe,{options:_0x16d09e,args:_0x2c37d7,tdx:_0x4aba41}=_0x3d6836;if(_0x2c37d7[_0x13478d(0xf4)]===0x0)return console[_0x13478d(0x11a)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x13478d(0x11a)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x93289c,childId:_0x7925f3}=parseSegmentRef(_0x2c37d7[0x0]);_0x16d09e[_0x13478d(0x104)]&&(console[_0x13478d(0x11a)]('Site:\x20'+_0x16d09e[_0x13478d(0x115)]),console[_0x13478d(0x11a)](_0x13478d(0xe8)+_0x93289c),_0x7925f3&&console[_0x13478d(0x11a)](_0x13478d(0x121)+_0x7925f3));if(!_0x7925f3)return console[_0x13478d(0x11a)](_0x13478d(0xc1)),0x1;const _0x6ec9ee=await withSpinner(_0x13478d(0x100)+_0x93289c+'\x27...',()=>_0x4aba41[_0x13478d(0x9f)][_0x13478d(0x129)](_0x93289c),{'verbose':_0x16d09e[_0x13478d(0x104)]}),_0x3e2742=_0x6ec9ee[_0x13478d(0x98)];_0x16d09e['verbose']&&console[_0x13478d(0x11a)]('Resolved\x20parent\x20ID:\x20'+_0x3e2742);const _0x5da504=await withSpinner(_0x13478d(0xd7)+_0x7925f3+_0x13478d(0xbc),()=>_0x4aba41['segment'][_0x13478d(0xf8)](_0x3e2742,_0x7925f3),{'verbose':_0x16d09e[_0x13478d(0x104)]}),_0x2c1ea4=_0x5da504[_0x13478d(0x98)];_0x16d09e[_0x13478d(0x104)]&&console[_0x13478d(0x11a)](_0x13478d(0x10e)+_0x2c1ea4);const _0x25aac0=await withSpinner('Fetching\x20folder\x20\x27'+_0x7925f3+'\x27...',()=>_0x4aba41[_0x13478d(0x9f)][_0x13478d(0xef)](_0x2c1ea4),{'verbose':_0x16d09e['verbose']});return await handleSDKOutput([_0x25aac0['data']],_0x16d09e),0x0;}catch(_0x4b319e){if(_0x4b319e instanceof SDKError)return console['error'](_0x13478d(0x112)+_0x4b319e[_0x13478d(0x118)]),_0x4b319e[_0x13478d(0xd3)]&&console[_0x13478d(0x11a)](_0x13478d(0x126)+_0x4b319e['cause']),0x1;throw _0x4b319e;}}}export class SegmentSQLCommand extends BaseCommand{[a28_0x4557fe(0x123)]=a28_0x4557fe(0x9b);[a28_0x4557fe(0x106)]=a28_0x4557fe(0xc7);async['execute'](_0x272077){const _0x2c074a=a28_0x4557fe,{options:_0x514b16,args:_0x540342,tdx:_0x4dd943}=_0x272077,_0x2a6908=_0x540342[0x0];if(!_0x2a6908)return console[_0x2c074a(0x11a)](_0x2c074a(0x11d)),console['error'](_0x2c074a(0xf6)),console[_0x2c074a(0x11a)](_0x2c074a(0x131)),console[_0x2c074a(0x11a)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x2c074a(0x11a)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x513843=_0x514b16[_0x2c074a(0xa4)],_0x341d90=await resolveSegmentTarget(_0x2a6908,_0x513843,_0x514b16[_0x2c074a(0x104)]);_0x514b16[_0x2c074a(0x104)]&&console['error'](_0x2c074a(0xb9)+_0x341d90);const _0x4d40de=await withSpinner(_0x2c074a(0xb7)+_0x2a6908+_0x2c074a(0xbc),()=>_0x4dd943[_0x2c074a(0x9f)]['resolvePathToResource'](_0x341d90),{'verbose':_0x514b16[_0x2c074a(0x104)]}),_0x225edf=_0x4d40de['data'];_0x514b16['verbose']&&(console[_0x2c074a(0x11a)](_0x2c074a(0xf1)+_0x225edf[_0x2c074a(0x107)]),console[_0x2c074a(0x11a)]('Parent\x20ID:\x20'+_0x225edf[_0x2c074a(0x10b)]));if(_0x225edf[_0x2c074a(0x107)]==='folder')return console[_0x2c074a(0x11a)](_0x2c074a(0xda)),console[_0x2c074a(0x11a)](_0x2c074a(0x12d)),0x1;if(_0x225edf['type']===_0x2c074a(0xc2))return console[_0x2c074a(0x11a)](_0x2c074a(0xf7)),console[_0x2c074a(0x11a)](_0x2c074a(0xed)),0x1;if(!_0x225edf[_0x2c074a(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2c074a(0xe5));const _0x39ed91=await withSpinner(_0x2c074a(0xa9),()=>_0x4dd943[_0x2c074a(0x9f)]['getSegmentSQL'](_0x225edf[_0x2c074a(0x10b)],_0x225edf['segmentId']),{'verbose':_0x514b16['verbose']}),_0x352283=_0x39ed91[_0x2c074a(0x98)];return _0x514b16[_0x2c074a(0xcc)]==='json'||_0x514b16[_0x2c074a(0xcc)]===_0x2c074a(0xd2)?await handleSDKOutput([{'sql':_0x352283}],_0x514b16):console[_0x2c074a(0xd4)](_0x352283),0x0;}catch(_0xb5114f){if(_0xb5114f instanceof SDKError)return console[_0x2c074a(0x11a)](_0x2c074a(0x112)+_0xb5114f['message']),_0xb5114f[_0x2c074a(0xd3)]&&console[_0x2c074a(0x11a)](_0x2c074a(0x126)+_0xb5114f[_0x2c074a(0xd3)]),0x1;throw _0xb5114f;}}}function a28_0x2b89(_0x4b8996,_0x1a2272){_0x4b8996=_0x4b8996-0x98;const _0x2fed7c=a28_0x2fed();let _0x2b89b5=_0x2fed7c[_0x4b8996];return _0x2b89b5;}export class SegmentFolderCreateCommand extends BaseCommand{[a28_0x4557fe(0x123)]=a28_0x4557fe(0xca);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a28_0x4557fe(0x10f)](_0x3a4906){const _0x19a090=a28_0x4557fe,{options:_0x4f657b,args:_0x5494d8,tdx:_0x3b2755}=_0x3a4906,_0x498a7c=_0x4f657b;if(_0x5494d8[_0x19a090(0xf4)]<0x2)return console[_0x19a090(0x11a)](_0x19a090(0xdb)),console['error'](_0x19a090(0xf9)),0x1;const _0x14c597=_0x5494d8[0x0],_0x3896f6=_0x5494d8[0x1];_0x498a7c[_0x19a090(0x104)]&&(console[_0x19a090(0x11a)](_0x19a090(0x108)+_0x498a7c[_0x19a090(0x115)]),console[_0x19a090(0x11a)](_0x19a090(0xb4)+_0x14c597),console[_0x19a090(0x11a)](_0x19a090(0x121)+_0x3896f6));let _0x6896f1;if(_0x498a7c[_0x19a090(0xe7)]){const _0x3e861a=_0x498a7c[_0x19a090(0xe7)],_0x3ad3ee=await withSpinner(_0x19a090(0x100)+_0x14c597+_0x19a090(0xbc),()=>_0x3b2755[_0x19a090(0x9f)][_0x19a090(0x129)](_0x14c597),{'verbose':_0x498a7c[_0x19a090(0x104)]}),_0x3576a6=_0x3ad3ee[_0x19a090(0x98)],_0x4e5bd0=await withSpinner(_0x19a090(0xe4)+_0x3e861a+_0x19a090(0xbc),()=>_0x3b2755[_0x19a090(0x9f)]['resolveFolderId'](_0x3576a6,_0x3e861a),{'verbose':_0x498a7c[_0x19a090(0x104)]});_0x6896f1=_0x4e5bd0[_0x19a090(0x98)],_0x498a7c[_0x19a090(0x104)]&&console[_0x19a090(0x11a)](_0x19a090(0xb8)+_0x6896f1);}const _0x3f478d={'name':_0x3896f6,'description':_0x498a7c['description'],'parentFolderId':_0x6896f1},_0x44b1ac=await withSpinner(_0x19a090(0x9a)+_0x3896f6+'\x27...',()=>_0x3b2755['segment'][_0x19a090(0x132)](_0x14c597,_0x3f478d),{'verbose':_0x498a7c[_0x19a090(0x104)]}),_0x5a8d1d=_0x44b1ac['data'];return console[_0x19a090(0x11a)]('β\x20Created\x20folder\x20\x27'+_0x5a8d1d[_0x19a090(0x123)]+_0x19a090(0x101)+_0x5a8d1d['id']),await handleSDKOutput([_0x5a8d1d],_0x498a7c),0x0;}}export class SegmentViewCommand extends BaseCommand{[a28_0x4557fe(0x123)]=a28_0x4557fe(0xcb);[a28_0x4557fe(0x106)]=a28_0x4557fe(0xa8);async[a28_0x4557fe(0x10f)](_0x80b7b7){const _0x49fe33=a28_0x4557fe,{options:_0x172f22,args:_0x5b1999,tdx:_0x504cfe}=_0x80b7b7,_0x211f22=_0x5b1999[0x0];if(!_0x211f22)return console[_0x49fe33(0x11a)](_0x49fe33(0xfa)),console['error'](_0x49fe33(0x111)),console[_0x49fe33(0x11a)](_0x49fe33(0x124)),console[_0x49fe33(0x11a)]('Options:'),console[_0x49fe33(0x11a)](_0x49fe33(0xea)),console[_0x49fe33(0x11a)](_0x49fe33(0x116)),console['error'](_0x49fe33(0x102)),console[_0x49fe33(0x11a)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x49fe33(0x11a)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3db3d9=_0x172f22[_0x49fe33(0xa4)],_0x2409d8=await resolveSegmentTarget(_0x211f22,_0x3db3d9,_0x172f22[_0x49fe33(0x104)]);_0x172f22[_0x49fe33(0x104)]&&console[_0x49fe33(0x11a)](_0x49fe33(0xb9)+_0x2409d8);const _0x4d3120=await withSpinner(_0x49fe33(0xb7)+_0x211f22+_0x49fe33(0xbc),()=>_0x504cfe[_0x49fe33(0x9f)]['resolvePathToResource'](_0x2409d8),{'verbose':_0x172f22[_0x49fe33(0x104)]}),_0x41d25a=_0x4d3120[_0x49fe33(0x98)];_0x172f22[_0x49fe33(0x104)]&&(console[_0x49fe33(0x11a)](_0x49fe33(0xf1)+_0x41d25a['type']),console[_0x49fe33(0x11a)](_0x49fe33(0xd8)+_0x41d25a['parentId']),_0x41d25a['folderId']&&console[_0x49fe33(0x11a)](_0x49fe33(0xfd)+_0x41d25a['folderId']),_0x41d25a[_0x49fe33(0x10a)]&&console[_0x49fe33(0x11a)](_0x49fe33(0xb1)+_0x41d25a[_0x49fe33(0x10a)]));if(_0x172f22[_0x49fe33(0xfb)]){if(_0x41d25a['type']===_0x49fe33(0x12e))return console['error'](_0x49fe33(0xf5)),0x1;if(_0x41d25a[_0x49fe33(0x107)]==='parent')return console[_0x49fe33(0x11a)](_0x49fe33(0xae)),console[_0x49fe33(0x11a)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x41d25a[_0x49fe33(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x49fe33(0xe5));const _0x4b3e75=getConsoleNextUrl(_0x172f22[_0x49fe33(0x115)],'/app/ps/'+_0x41d25a[_0x49fe33(0x10b)]+'/e/'+_0x41d25a['segmentId']);return console[_0x49fe33(0x11a)](a28_0x13d744[_0x49fe33(0xb2)]('β')+'\x20Opening\x20'+a28_0x13d744[_0x49fe33(0xbd)](_0x4b3e75)),openBrowser(_0x4b3e75),0x0;}if(_0x41d25a[_0x49fe33(0x107)]===_0x49fe33(0x12e)){if(!_0x41d25a[_0x49fe33(0xdc)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x49fe33(0x10c));const _0x2b6367=await withSpinner('Fetching\x20folder\x20details...',()=>_0x504cfe['segment'][_0x49fe33(0xef)](_0x41d25a[_0x49fe33(0xdc)]),{'verbose':_0x172f22[_0x49fe33(0x104)]});await handleSingleObjectOutput(_0x2b6367['data'],_0x172f22);}else{if(_0x41d25a[_0x49fe33(0x107)]===_0x49fe33(0x9f)){if(!_0x41d25a[_0x49fe33(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x49fe33(0xe5));const _0x42b276=await withSpinner(_0x49fe33(0xcf),()=>_0x504cfe[_0x49fe33(0x9f)][_0x49fe33(0x11f)](_0x41d25a['parentId'],_0x41d25a[_0x49fe33(0x10a)]),{'verbose':_0x172f22[_0x49fe33(0x104)]}),_0x52c0d8=getConsoleNextUrl(_0x172f22[_0x49fe33(0x115)],'/app/ps/'+_0x41d25a[_0x49fe33(0x10b)]+_0x49fe33(0x122)+_0x41d25a[_0x49fe33(0x10a)]),_0x3488f5=_0x42b276['data'];_0x3488f5[_0x49fe33(0xa6)]=_0x52c0d8,await handleSingleObjectOutput(_0x3488f5,_0x172f22);}else return console[_0x49fe33(0x11a)](_0x49fe33(0xd5)),console[_0x49fe33(0x11a)](_0x49fe33(0xd6)),0x1;}return 0x0;}catch(_0x193c55){if(_0x193c55 instanceof SDKError)return console[_0x49fe33(0x11a)](_0x49fe33(0x112)+_0x193c55[_0x49fe33(0x118)]),_0x193c55[_0x49fe33(0xd3)]&&console['error'](_0x49fe33(0x126)+_0x193c55[_0x49fe33(0xd3)]),0x1;throw _0x193c55;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a28_0x4557fe(0x123)]=a28_0x4557fe(0xe9);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x588807){const _0x13025c=a28_0x4557fe,{options:_0x5a4cdb,args:_0x1823c7,tdx:_0x24324d}=_0x588807,_0x404aa7=_0x1823c7[0x0];if(!_0x404aa7)return console[_0x13025c(0x11a)](_0x13025c(0x11d)),console[_0x13025c(0x11a)](_0x13025c(0xa7)),console[_0x13025c(0x11a)](_0x13025c(0x120)),console['error'](_0x13025c(0x116)),console[_0x13025c(0x11a)](_0x13025c(0xaa)),console[_0x13025c(0x11a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x573f91=_0x5a4cdb['parentSegment'],_0x402caf=await resolveSegmentTarget(_0x404aa7,_0x573f91,_0x5a4cdb[_0x13025c(0x104)]);_0x5a4cdb[_0x13025c(0x104)]&&console['error'](_0x13025c(0xb9)+_0x402caf);const _0x12d72c=await withSpinner(_0x13025c(0xb7)+_0x404aa7+'\x27...',()=>_0x24324d[_0x13025c(0x9f)][_0x13025c(0x103)](_0x402caf),{'verbose':_0x5a4cdb['verbose']}),_0x14c7a4=_0x12d72c['data'];_0x5a4cdb['verbose']&&(console[_0x13025c(0x11a)](_0x13025c(0xf1)+_0x14c7a4[_0x13025c(0x107)]),console[_0x13025c(0x11a)](_0x13025c(0xd8)+_0x14c7a4[_0x13025c(0x10b)]));if(_0x14c7a4['type']===_0x13025c(0x12e))return console[_0x13025c(0x11a)](_0x13025c(0xfc)),console[_0x13025c(0x11a)](_0x13025c(0x12d)),0x1;if(_0x14c7a4['type']===_0x13025c(0xc2))return console['error'](_0x13025c(0x114)),console[_0x13025c(0x11a)](_0x13025c(0xdf)),0x1;if(!_0x14c7a4[_0x13025c(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x13025c(0xe5));const _0x50ab71=await withSpinner(_0x13025c(0xa9),()=>_0x24324d['segment']['getSegmentSQL'](_0x14c7a4[_0x13025c(0x10b)],_0x14c7a4['segmentId']),{'verbose':_0x5a4cdb[_0x13025c(0x104)]}),_0x44cbcb=_0x50ab71[_0x13025c(0x98)],_0x43e197=await executeSchemaQuery(_0x44cbcb,_0x24324d,_0x5a4cdb);return await handleQueryOutput(_0x43e197,_0x5a4cdb),0x0;}catch(_0x3865ec){if(_0x3865ec instanceof SDKError)return console[_0x13025c(0x11a)]('Error:\x20'+_0x3865ec[_0x13025c(0x118)]),_0x3865ec[_0x13025c(0xd3)]&&console[_0x13025c(0x11a)](_0x13025c(0x126)+_0x3865ec[_0x13025c(0xd3)]),0x1;throw _0x3865ec;}}}
|
|
1
|
+
const a28_0x5c638e=a28_0x4e7a;(function(_0x3b4dbd,_0xcc1609){const _0x44ac7b=a28_0x4e7a,_0x23d990=_0x3b4dbd();while(!![]){try{const _0x3a7fd7=-parseInt(_0x44ac7b(0x13c))/0x1+-parseInt(_0x44ac7b(0x138))/0x2*(parseInt(_0x44ac7b(0xfb))/0x3)+-parseInt(_0x44ac7b(0x18f))/0x4*(-parseInt(_0x44ac7b(0x133))/0x5)+parseInt(_0x44ac7b(0x11e))/0x6*(parseInt(_0x44ac7b(0x160))/0x7)+-parseInt(_0x44ac7b(0xfa))/0x8+-parseInt(_0x44ac7b(0x12f))/0x9+parseInt(_0x44ac7b(0x13f))/0xa;if(_0x3a7fd7===_0xcc1609)break;else _0x23d990['push'](_0x23d990['shift']());}catch(_0x594493){_0x23d990['push'](_0x23d990['shift']());}}}(a28_0x2575,0x2e887));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a28_0x386346 from'chalk';function a28_0x2575(){const _0x3ee33d=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20rows\x20','segment:folder:show','segment','error','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20parent\x20segment\x20\x27','\x20Opening\x20','toLocaleString','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20ID:\x20','fullPath','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','test','segment:describe','segment:sql','in\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','jsonl','12ALAmwp','stats','\x27...','INVALID_ARGUMENT','Resolving\x20\x27','segment:folder:create','Segment\x20ID:\x20','\x20\x20Cause:\x20','1665488EiqsUY','690WVzCCI','Fetching\x20segment\x20details...','parentId','verbose','segment:show','cyan','trim','resolveFolderId','\x27\x20with\x20ID:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','type','web','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','execute','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','includes','segmentPath','Site:\x20','cause','Parent\x20segment:\x20','Use:\x20tdx\x20ps\x20view','query','json','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Options:','resolveParentId','SEGMENT_NOT_FOUND','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','6VDSLut','elapsedTimeMillis','format','message','Use:\x20tdx\x20ps\x20sql','Parent\x20name:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','code','Fetching\x20folder\x20\x27','getFolder','log','Show\x20folder\x20or\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Fetching\x20SQL\x20for\x20segment...','Show\x20segment\x20folder\x20details','jobId','data','1802340QhqgrQ','Resolved\x20YAML\x20file:\x20','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','517885ybslgv','processedRows','getSegmentSQL','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','1046QTzPLY','Use:\x20tdx\x20ps\x20view\x20-w','Creating\x20folder\x20\x27','segment:desc','215071gsLOjV','createFolder','description','3909160trIEeF','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20show\x20<name>','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use:\x20tdx\x20ps\x20show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment:folder:list','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20folder\x20ID:\x20','β\x20Found\x20','parent','limit','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20parent\x20segment\x20details...','folder','Resolved\x20type:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentFolder','Resolved\x20parent\x20ID:\x20','getSegment','Resolved\x20relative\x20path\x20to:\x20','Examples:','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Target\x20path:\x20','\x20\x20Folder\x20path:\x20','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Parent\x20segment:\x20','resolvePathToResource','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','1629313AmrFfm','\x20folder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','β\x20Query\x20completed:\x20Processed\x20','site','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','setJobId','segmentId','Error:\x20','(root)','Parent\x20ID:\x20','url','name','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Folder\x20ID\x20missing\x20from\x20resolved\x20path','/app/ps/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','length','replace','listFolders','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'];a28_0x2575=function(){return _0x3ee33d;};return a28_0x2575();}async function resolveSegmentTarget(_0x15fdfc,_0x4f9664,_0x5c4178){const _0x5a09ea=a28_0x4e7a;if(isYamlFilePath(_0x15fdfc))try{const _0x5f45f7=await resolveYamlFilePath(_0x15fdfc);return _0x5c4178&&(console[_0x5a09ea(0x17f)](_0x5a09ea(0x130)+_0x15fdfc),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15d)+_0x5f45f7['parentSegment']),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15b)+_0x5f45f7['segmentName']),console[_0x5a09ea(0x17f)](_0x5a09ea(0x15a)+(_0x5f45f7['folderPath']||_0x5a09ea(0x169))),console[_0x5a09ea(0x17f)]('\x20\x20Full\x20path:\x20'+_0x5f45f7[_0x5a09ea(0x186)])),_0x5f45f7[_0x5a09ea(0x186)];}catch(_0x4c4341){throw new SDKError(ErrorCode[_0x5a09ea(0xf5)],_0x5a09ea(0x172)+_0x4c4341[_0x5a09ea(0x121)]);}if(!_0x4f9664)throw new SDKError(ErrorCode[_0x5a09ea(0xf5)],_0x5a09ea(0x144));return _0x4f9664+'/'+_0x15fdfc;}export class SegmentDescribeCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x18a);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x187);async[a28_0x5c638e(0x10b)](_0x318b49){const _0x5da77d=a28_0x5c638e,{options:_0x54997d,args:_0x3559d1,tdx:_0x23e4d0}=_0x318b49,_0x4bc8f2=_0x3559d1[0x0],_0x5982b5=!_0x4bc8f2&&!!_0x54997d['parentSegment'],_0x2c3ca3=_0x4bc8f2||_0x54997d[_0x5da77d(0x142)];if(!_0x2c3ca3)return console[_0x5da77d(0x17f)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x5da77d(0x17f)](_0x5da77d(0x132)),console[_0x5da77d(0x17f)](_0x5da77d(0x157)),console[_0x5da77d(0x17f)](_0x5da77d(0x11b)),console[_0x5da77d(0x17f)](_0x5da77d(0x15c)),console[_0x5da77d(0x17f)](_0x5da77d(0x149)),console[_0x5da77d(0x17f)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0xf4e548=_0x54997d[_0x5da77d(0x10e)];let _0x2b7f22=_0x2c3ca3;!_0x5982b5&&_0xf4e548&&!_0x2c3ca3[_0x5da77d(0x10d)]('/')&&(_0x2b7f22=_0xf4e548+'/'+_0x2c3ca3,_0x54997d['verbose']&&console[_0x5da77d(0x17f)](_0x5da77d(0x156)+_0x2b7f22));const _0x2de935=await withSpinner('Resolving\x20path\x20\x27'+_0x2b7f22+'\x27...',()=>_0x23e4d0[_0x5da77d(0x17e)]['resolvePathToResource'](_0x2b7f22),{'verbose':_0x54997d['verbose']}),_0x5ed49a=_0x2de935[_0x5da77d(0x12e)];_0x54997d[_0x5da77d(0xfe)]&&(console[_0x5da77d(0x17f)](_0x5da77d(0x151)+_0x5ed49a[_0x5da77d(0x106)]),console[_0x5da77d(0x17f)](_0x5da77d(0x16a)+_0x5ed49a[_0x5da77d(0xfd)]),_0x5ed49a[_0x5da77d(0x10a)]&&console[_0x5da77d(0x17f)](_0x5da77d(0x185)+_0x5ed49a['folderId']),_0x5ed49a[_0x5da77d(0x167)]&&console[_0x5da77d(0x17f)](_0x5da77d(0xf8)+_0x5ed49a['segmentId']));if(_0x5ed49a[_0x5da77d(0x106)]===_0x5da77d(0x14c)){const _0x2e59f4=await withSpinner(_0x5da77d(0x14f),()=>_0x23e4d0[_0x5da77d(0x17e)]['getParent'](_0x5ed49a[_0x5da77d(0xfd)]),{'verbose':_0x54997d[_0x5da77d(0xfe)]});await handleSingleObjectOutput(_0x2e59f4[_0x5da77d(0x12e)],_0x54997d);}else{if(_0x5ed49a[_0x5da77d(0x106)]===_0x5da77d(0x150)){if(!_0x5ed49a['folderId'])throw new SDKError(ErrorCode[_0x5da77d(0x140)],_0x5da77d(0x16e));const _0x1ab8a1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x23e4d0[_0x5da77d(0x17e)][_0x5da77d(0x127)](_0x5ed49a[_0x5da77d(0x10a)]),{'verbose':_0x54997d['verbose']});await handleSingleObjectOutput(_0x1ab8a1[_0x5da77d(0x12e)],_0x54997d);}else{if(_0x5ed49a['type']===_0x5da77d(0x17e)){if(!_0x5ed49a['segmentId'])throw new SDKError(ErrorCode[_0x5da77d(0x119)],_0x5da77d(0x147));const _0xa2da6e=await withSpinner(_0x5da77d(0xfc),()=>_0x23e4d0['segment'][_0x5da77d(0x155)](_0x5ed49a[_0x5da77d(0xfd)],_0x5ed49a['segmentId']),{'verbose':_0x54997d[_0x5da77d(0xfe)]});await handleSingleObjectOutput(_0xa2da6e[_0x5da77d(0x12e)],_0x54997d);}}}return 0x0;}catch(_0x173b0f){if(_0x173b0f instanceof SDKError)return console[_0x5da77d(0x17f)](_0x5da77d(0x168)+_0x173b0f['message']),_0x173b0f[_0x5da77d(0x110)]&&console[_0x5da77d(0x17f)](_0x5da77d(0xf9)+_0x173b0f['cause']),0x1;throw _0x173b0f;}}}export class SegmentShowCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0xff);[a28_0x5c638e(0x13e)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a28_0x5c638e(0x10b)](_0x137199){const _0xcda091=a28_0x5c638e,{options:_0x13c1fe,args:_0x49ee5e,tdx:_0xff3862}=_0x137199,_0xaa8ee2=_0x49ee5e[0x0];if(!_0xaa8ee2)return console[_0xcda091(0x17f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0xcda091(0x141)),console[_0xcda091(0x17f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console['error'](_0xcda091(0x157)),console['error'](_0xcda091(0x170)),console['error'](_0xcda091(0x15f)),0x1;try{const _0x47a3c6=_0x13c1fe['parentSegment'],_0x525f91=await resolveSegmentTarget(_0xaa8ee2,_0x47a3c6,_0x13c1fe[_0xcda091(0xfe)]);_0x13c1fe[_0xcda091(0xfe)]&&console['error'](_0xcda091(0x159)+_0x525f91);const _0x5a3edf=await withSpinner(_0xcda091(0xf6)+_0xaa8ee2+'\x27...',()=>_0xff3862[_0xcda091(0x17e)][_0xcda091(0x15e)](_0x525f91),{'verbose':_0x13c1fe[_0xcda091(0xfe)]}),_0xeb0c18=_0x5a3edf[_0xcda091(0x12e)];_0x13c1fe[_0xcda091(0xfe)]&&(console[_0xcda091(0x17f)](_0xcda091(0x151)+_0xeb0c18[_0xcda091(0x106)]),console[_0xcda091(0x17f)](_0xcda091(0x16a)+_0xeb0c18['parentId']));if(_0xeb0c18[_0xcda091(0x106)]===_0xcda091(0x150))return console[_0xcda091(0x17f)](_0xcda091(0x158)),console[_0xcda091(0x17f)](_0xcda091(0x171)),0x1;if(_0xeb0c18[_0xcda091(0x106)]==='parent')return console['error'](_0xcda091(0x173)),console['error'](_0xcda091(0x145)),0x1;if(!_0xeb0c18[_0xcda091(0x167)])throw new SDKError(ErrorCode[_0xcda091(0x119)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x395b0d=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xff3862[_0xcda091(0x17e)][_0xcda091(0x135)](_0xeb0c18[_0xcda091(0xfd)],_0xeb0c18[_0xcda091(0x167)]),{'verbose':_0x13c1fe[_0xcda091(0xfe)]});let _0x587f48=_0x395b0d[_0xcda091(0x12e)];const _0x2ba76d=resolveLimit(_0x13c1fe[_0xcda091(0x14d)],DEFAULT_DISPLAY_LIMIT),_0x3e5479=/\bLIMIT\s+\d+/i[_0xcda091(0x189)](_0x587f48);!_0x3e5479&&(_0x587f48=_0x587f48[_0xcda091(0x101)]()[_0xcda091(0x175)](/;+$/,''),_0x587f48='SELECT\x20*\x20FROM\x20(\x0a'+_0x587f48+_0xcda091(0x124)+_0x2ba76d);_0x13c1fe[_0xcda091(0xfe)]&&console[_0xcda091(0x17f)]('SQL\x20query:\x0a'+_0x587f48);const _0x14b508=await withProgressSpinner('Executing\x20segment\x20query...',async _0x59b348=>{const _0x56b7fd=_0xcda091,_0xb2040f=await _0xff3862[_0x56b7fd(0x113)][_0x56b7fd(0x10b)](_0x587f48,{'catalog':'td','schema':'information_schema','onJobId':_0x13b213=>{const _0xf7ef2d=_0x56b7fd;_0x59b348[_0xf7ef2d(0x166)](_0x13b213);}});return _0xb2040f;},{'verbose':_0x13c1fe['verbose']}),_0x77938b=_0x14b508[_0xcda091(0x12e)],_0x16a0c3=_0x77938b[_0xcda091(0x12d)]?'\x20[Job\x20ID:\x20'+_0x77938b[_0xcda091(0x12d)]+']':'';return console[_0xcda091(0x17f)](_0xcda091(0x163)+_0x77938b[_0xcda091(0x190)][_0xcda091(0x134)][_0xcda091(0x183)]()+_0xcda091(0x17c)+(_0xcda091(0x18c)+formatElapsed(_0x77938b[_0xcda091(0x190)][_0xcda091(0x11f)])+_0x16a0c3)),await handleQueryOutput(_0x77938b,_0x13c1fe),0x0;}catch(_0x2c9059){if(_0x2c9059 instanceof SDKError)return console[_0xcda091(0x17f)]('β\x20Query\x20failed\x20['+_0x2c9059[_0xcda091(0x125)]+']'),console[_0xcda091(0x17f)]('\x0a'+_0x2c9059[_0xcda091(0x121)]),0x1;throw _0x2c9059;}}}export class SegmentFolderListCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x148);[a28_0x5c638e(0x13e)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a28_0x5c638e(0x10b)](_0x36616c){const _0x36de72=a28_0x5c638e,{options:_0x3d72a9,args:_0x38f4b3,tdx:_0x2d7d74}=_0x36616c;if(_0x38f4b3[_0x36de72(0x174)]===0x0)return console[_0x36de72(0x17f)](_0x36de72(0x14e)),console[_0x36de72(0x17f)](_0x36de72(0x12a)),0x1;const _0x24db88=_0x38f4b3[0x0];try{_0x3d72a9[_0x36de72(0xfe)]&&(console[_0x36de72(0x17f)]('Site:\x20'+_0x3d72a9[_0x36de72(0x164)]),console[_0x36de72(0x17f)]('Parent\x20name:\x20'+_0x24db88));const _0x3c1443=await withSpinner(_0x36de72(0x181)+_0x24db88+_0x36de72(0x191),()=>_0x2d7d74[_0x36de72(0x17e)][_0x36de72(0x118)](_0x24db88),{'verbose':_0x3d72a9[_0x36de72(0xfe)]}),_0x54bbc0=_0x3c1443['data'];_0x3d72a9[_0x36de72(0xfe)]&&console['error'](_0x36de72(0x154)+_0x54bbc0);const _0x5ef2fb=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x24db88+_0x36de72(0x191),()=>_0x2d7d74[_0x36de72(0x17e)][_0x36de72(0x176)](_0x54bbc0),{'verbose':_0x3d72a9[_0x36de72(0xfe)]}),_0x141578=_0x5ef2fb[_0x36de72(0x12e)];return console[_0x36de72(0x17f)](_0x36de72(0x14b)+_0x141578[_0x36de72(0x174)]+_0x36de72(0x161)+(_0x141578[_0x36de72(0x174)]!==0x1?'s':'')),await handleSDKOutput(_0x141578,_0x3d72a9),0x0;}catch(_0x4badf9){if(_0x4badf9 instanceof SDKError)return console[_0x36de72(0x17f)](_0x36de72(0x168)+_0x4badf9[_0x36de72(0x121)]),_0x4badf9[_0x36de72(0x110)]&&console['error']('\x20\x20Cause:\x20'+_0x4badf9[_0x36de72(0x110)]),0x1;throw _0x4badf9;}}}export class SegmentFolderShowCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x17d);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x12c);async[a28_0x5c638e(0x10b)](_0x309b11){const _0xa040a3=a28_0x5c638e,{options:_0x28f486,args:_0xf4378e,tdx:_0x475016}=_0x309b11;if(_0xf4378e['length']===0x0)return console[_0xa040a3(0x17f)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0xa040a3(0x17f)](_0xa040a3(0x105)),0x1;try{const {parentId:_0x24660d,childId:_0x49d89a}=parseSegmentRef(_0xf4378e[0x0]);_0x28f486[_0xa040a3(0xfe)]&&(console[_0xa040a3(0x17f)](_0xa040a3(0x10f)+_0x28f486[_0xa040a3(0x164)]),console['error'](_0xa040a3(0x123)+_0x24660d),_0x49d89a&&console['error'](_0xa040a3(0x131)+_0x49d89a));if(!_0x49d89a)return console[_0xa040a3(0x17f)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x7e5ade=await withSpinner(_0xa040a3(0x181)+_0x24660d+_0xa040a3(0x191),()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x118)](_0x24660d),{'verbose':_0x28f486[_0xa040a3(0xfe)]}),_0x1ca212=_0x7e5ade['data'];_0x28f486[_0xa040a3(0xfe)]&&console[_0xa040a3(0x17f)](_0xa040a3(0x154)+_0x1ca212);const _0x2a8be6=await withSpinner('Resolving\x20folder\x20\x27'+_0x49d89a+'\x27...',()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x102)](_0x1ca212,_0x49d89a),{'verbose':_0x28f486[_0xa040a3(0xfe)]}),_0x3bb3e3=_0x2a8be6['data'];_0x28f486[_0xa040a3(0xfe)]&&console[_0xa040a3(0x17f)](_0xa040a3(0x14a)+_0x3bb3e3);const _0x1f4ed3=await withSpinner(_0xa040a3(0x126)+_0x49d89a+_0xa040a3(0x191),()=>_0x475016[_0xa040a3(0x17e)][_0xa040a3(0x127)](_0x3bb3e3),{'verbose':_0x28f486[_0xa040a3(0xfe)]});return await handleSDKOutput([_0x1f4ed3['data']],_0x28f486),0x0;}catch(_0x2b27f9){if(_0x2b27f9 instanceof SDKError)return console[_0xa040a3(0x17f)](_0xa040a3(0x168)+_0x2b27f9[_0xa040a3(0x121)]),_0x2b27f9[_0xa040a3(0x110)]&&console[_0xa040a3(0x17f)](_0xa040a3(0xf9)+_0x2b27f9[_0xa040a3(0x110)]),0x1;throw _0x2b27f9;}}}function a28_0x4e7a(_0x4ac516,_0x5e75f1){_0x4ac516=_0x4ac516-0xf5;const _0x2575bf=a28_0x2575();let _0x4e7a18=_0x2575bf[_0x4ac516];return _0x4e7a18;}export class SegmentSQLCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0x18b);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x17b);async['execute'](_0x51fc2e){const _0x21326d=a28_0x5c638e,{options:_0x13e6e2,args:_0xce3bac,tdx:_0x2ff932}=_0x51fc2e,_0x2cd3de=_0xce3bac[0x0];if(!_0x2cd3de)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x21326d(0x179)),console[_0x21326d(0x17f)](_0x21326d(0x178)),console[_0x21326d(0x17f)](_0x21326d(0x157)),console[_0x21326d(0x17f)](_0x21326d(0x165)),console[_0x21326d(0x17f)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1d0e77=_0x13e6e2[_0x21326d(0x142)],_0x25baef=await resolveSegmentTarget(_0x2cd3de,_0x1d0e77,_0x13e6e2[_0x21326d(0xfe)]);_0x13e6e2['verbose']&&console[_0x21326d(0x17f)](_0x21326d(0x159)+_0x25baef);const _0x272060=await withSpinner(_0x21326d(0xf6)+_0x2cd3de+_0x21326d(0x191),()=>_0x2ff932[_0x21326d(0x17e)][_0x21326d(0x15e)](_0x25baef),{'verbose':_0x13e6e2[_0x21326d(0xfe)]}),_0x126b92=_0x272060[_0x21326d(0x12e)];_0x13e6e2[_0x21326d(0xfe)]&&(console[_0x21326d(0x17f)](_0x21326d(0x151)+_0x126b92[_0x21326d(0x106)]),console['error'](_0x21326d(0x16a)+_0x126b92[_0x21326d(0xfd)]));if(_0x126b92[_0x21326d(0x106)]===_0x21326d(0x150))return console[_0x21326d(0x17f)](_0x21326d(0x16d)),console[_0x21326d(0x17f)](_0x21326d(0x18d)),0x1;if(_0x126b92['type']===_0x21326d(0x14c))return console['error'](_0x21326d(0x180)),console['error'](_0x21326d(0x122)),0x1;if(!_0x126b92[_0x21326d(0x167)])throw new SDKError(ErrorCode[_0x21326d(0x119)],_0x21326d(0x147));const _0x7354e7=await withSpinner(_0x21326d(0x12b),()=>_0x2ff932[_0x21326d(0x17e)][_0x21326d(0x135)](_0x126b92[_0x21326d(0xfd)],_0x126b92['segmentId']),{'verbose':_0x13e6e2['verbose']}),_0x65cbab=_0x7354e7[_0x21326d(0x12e)];return _0x13e6e2['format']===_0x21326d(0x114)||_0x13e6e2[_0x21326d(0x120)]===_0x21326d(0x18e)?await handleSDKOutput([{'sql':_0x65cbab}],_0x13e6e2):console[_0x21326d(0x128)](_0x65cbab),0x0;}catch(_0x57c2d0){if(_0x57c2d0 instanceof SDKError)return console[_0x21326d(0x17f)](_0x21326d(0x168)+_0x57c2d0[_0x21326d(0x121)]),_0x57c2d0['cause']&&console[_0x21326d(0x17f)](_0x21326d(0xf9)+_0x57c2d0[_0x21326d(0x110)]),0x1;throw _0x57c2d0;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a28_0x5c638e(0x16c)]=a28_0x5c638e(0xf7);[a28_0x5c638e(0x13e)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x5d76d4){const _0x1368ad=a28_0x5c638e,{options:_0x3e3a28,args:_0x18fb7c,tdx:_0x33b039}=_0x5d76d4,_0x374fda=_0x3e3a28;if(_0x18fb7c[_0x1368ad(0x174)]<0x2)return console[_0x1368ad(0x17f)](_0x1368ad(0x115)),console[_0x1368ad(0x17f)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x18857a=_0x18fb7c[0x0],_0x22e1c9=_0x18fb7c[0x1];_0x374fda[_0x1368ad(0xfe)]&&(console[_0x1368ad(0x17f)](_0x1368ad(0x10f)+_0x374fda[_0x1368ad(0x164)]),console['error'](_0x1368ad(0x111)+_0x18857a),console[_0x1368ad(0x17f)](_0x1368ad(0x131)+_0x22e1c9));let _0x30a1b2;if(_0x374fda['parentFolder']){const _0x30e989=_0x374fda[_0x1368ad(0x153)],_0x5e5489=await withSpinner(_0x1368ad(0x181)+_0x18857a+'\x27...',()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x118)](_0x18857a),{'verbose':_0x374fda[_0x1368ad(0xfe)]}),_0x19ca46=_0x5e5489[_0x1368ad(0x12e)],_0x4c1801=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x30e989+_0x1368ad(0x191),()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x102)](_0x19ca46,_0x30e989),{'verbose':_0x374fda[_0x1368ad(0xfe)]});_0x30a1b2=_0x4c1801['data'],_0x374fda['verbose']&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x30a1b2);}const _0x258bce={'name':_0x22e1c9,'description':_0x374fda[_0x1368ad(0x13e)],'parentFolderId':_0x30a1b2},_0x370e0e=await withSpinner(_0x1368ad(0x13a)+_0x22e1c9+'\x27...',()=>_0x33b039[_0x1368ad(0x17e)][_0x1368ad(0x13d)](_0x18857a,_0x258bce),{'verbose':_0x374fda[_0x1368ad(0xfe)]}),_0x1c99a5=_0x370e0e[_0x1368ad(0x12e)];return console[_0x1368ad(0x17f)]('β\x20Created\x20folder\x20\x27'+_0x1c99a5[_0x1368ad(0x16c)]+_0x1368ad(0x103)+_0x1c99a5['id']),await handleSDKOutput([_0x1c99a5],_0x374fda),0x0;}}export class SegmentViewCommand extends BaseCommand{[a28_0x5c638e(0x16c)]='segment:view';[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x129);async[a28_0x5c638e(0x10b)](_0xbcf597){const _0x1e0271=a28_0x5c638e,{options:_0x5afc3f,args:_0x567141,tdx:_0x1b3cea}=_0xbcf597,_0x490340=_0x567141[0x0];if(!_0x490340)return console[_0x1e0271(0x17f)](_0x1e0271(0x11d)),console[_0x1e0271(0x17f)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x1e0271(0x17f)](_0x1e0271(0x146)),console[_0x1e0271(0x17f)](_0x1e0271(0x117)),console[_0x1e0271(0x17f)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x1e0271(0x157)),console[_0x1e0271(0x17f)](_0x1e0271(0x116)),console[_0x1e0271(0x17f)](_0x1e0271(0x11a)),console[_0x1e0271(0x17f)](_0x1e0271(0x143)),console[_0x1e0271(0x17f)](_0x1e0271(0x17a)),0x1;try{const _0x3e51ec=_0x5afc3f[_0x1e0271(0x142)],_0x47450d=await resolveSegmentTarget(_0x490340,_0x3e51ec,_0x5afc3f[_0x1e0271(0xfe)]);_0x5afc3f['verbose']&&console[_0x1e0271(0x17f)]('Target\x20path:\x20'+_0x47450d);const _0x1cfb1f=await withSpinner(_0x1e0271(0xf6)+_0x490340+_0x1e0271(0x191),()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x15e)](_0x47450d),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]}),_0x107eb=_0x1cfb1f[_0x1e0271(0x12e)];_0x5afc3f[_0x1e0271(0xfe)]&&(console['error'](_0x1e0271(0x151)+_0x107eb[_0x1e0271(0x106)]),console[_0x1e0271(0x17f)]('Parent\x20ID:\x20'+_0x107eb[_0x1e0271(0xfd)]),_0x107eb[_0x1e0271(0x10a)]&&console[_0x1e0271(0x17f)](_0x1e0271(0x185)+_0x107eb['folderId']),_0x107eb[_0x1e0271(0x167)]&&console[_0x1e0271(0x17f)]('Segment\x20ID:\x20'+_0x107eb[_0x1e0271(0x167)]));if(_0x5afc3f[_0x1e0271(0x107)]){if(_0x107eb[_0x1e0271(0x106)]===_0x1e0271(0x150))return console[_0x1e0271(0x17f)](_0x1e0271(0x108)),0x1;if(_0x107eb['type']===_0x1e0271(0x14c))return console['error'](_0x1e0271(0x10c)),console['error'](_0x1e0271(0x139)),0x1;if(!_0x107eb[_0x1e0271(0x167)])throw new SDKError(ErrorCode[_0x1e0271(0x119)],_0x1e0271(0x147));const _0x3d3a0d=getConsoleNextUrl(_0x5afc3f[_0x1e0271(0x164)],_0x1e0271(0x16f)+_0x107eb[_0x1e0271(0xfd)]+'/e/'+_0x107eb['segmentId']);return console[_0x1e0271(0x17f)](a28_0x386346['green']('β')+_0x1e0271(0x182)+a28_0x386346[_0x1e0271(0x100)](_0x3d3a0d)),openBrowser(_0x3d3a0d),0x0;}if(_0x107eb[_0x1e0271(0x106)]===_0x1e0271(0x150)){if(!_0x107eb[_0x1e0271(0x10a)])throw new SDKError(ErrorCode[_0x1e0271(0x140)],_0x1e0271(0x16e));const _0x1c6e2a=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x127)](_0x107eb['folderId']),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]});await handleSingleObjectOutput(_0x1c6e2a[_0x1e0271(0x12e)],_0x5afc3f);}else{if(_0x107eb[_0x1e0271(0x106)]==='segment'){if(!_0x107eb['segmentId'])throw new SDKError(ErrorCode[_0x1e0271(0x119)],_0x1e0271(0x147));const _0x11a8cd=await withSpinner(_0x1e0271(0xfc),()=>_0x1b3cea[_0x1e0271(0x17e)][_0x1e0271(0x155)](_0x107eb[_0x1e0271(0xfd)],_0x107eb['segmentId']),{'verbose':_0x5afc3f[_0x1e0271(0xfe)]}),_0x2cf782=getConsoleNextUrl(_0x5afc3f['site'],_0x1e0271(0x16f)+_0x107eb[_0x1e0271(0xfd)]+'/e/'+_0x107eb[_0x1e0271(0x167)]),_0x2916bb=_0x11a8cd[_0x1e0271(0x12e)];_0x2916bb[_0x1e0271(0x16b)]=_0x2cf782,await handleSingleObjectOutput(_0x2916bb,_0x5afc3f);}else return console[_0x1e0271(0x17f)](_0x1e0271(0x184)),console[_0x1e0271(0x17f)](_0x1e0271(0x112)),0x1;}return 0x0;}catch(_0x1a0c70){if(_0x1a0c70 instanceof SDKError)return console[_0x1e0271(0x17f)](_0x1e0271(0x168)+_0x1a0c70['message']),_0x1a0c70['cause']&&console[_0x1e0271(0x17f)](_0x1e0271(0xf9)+_0x1a0c70['cause']),0x1;throw _0x1a0c70;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a28_0x5c638e(0x13b);[a28_0x5c638e(0x13e)]=a28_0x5c638e(0x104);async[a28_0x5c638e(0x10b)](_0x5a1d0f){const _0x534d32=a28_0x5c638e,{options:_0x821880,args:_0x3e8438,tdx:_0x9f06aa}=_0x5a1d0f,_0x5eecd6=_0x3e8438[0x0];if(!_0x5eecd6)return console[_0x534d32(0x17f)](_0x534d32(0x137)),console[_0x534d32(0x17f)](_0x534d32(0x136)),console[_0x534d32(0x17f)](_0x534d32(0x162)),console[_0x534d32(0x17f)](_0x534d32(0x157)),console[_0x534d32(0x17f)](_0x534d32(0x177)),console['error'](_0x534d32(0x188)),0x1;try{const _0x50de5b=_0x821880[_0x534d32(0x142)],_0x31e7c2=await resolveSegmentTarget(_0x5eecd6,_0x50de5b,_0x821880[_0x534d32(0xfe)]);_0x821880['verbose']&&console['error']('Target\x20path:\x20'+_0x31e7c2);const _0x166fcc=await withSpinner(_0x534d32(0xf6)+_0x5eecd6+_0x534d32(0x191),()=>_0x9f06aa['segment'][_0x534d32(0x15e)](_0x31e7c2),{'verbose':_0x821880[_0x534d32(0xfe)]}),_0x4880f1=_0x166fcc['data'];_0x821880[_0x534d32(0xfe)]&&(console[_0x534d32(0x17f)](_0x534d32(0x151)+_0x4880f1['type']),console[_0x534d32(0x17f)](_0x534d32(0x16a)+_0x4880f1[_0x534d32(0xfd)]));if(_0x4880f1[_0x534d32(0x106)]===_0x534d32(0x150))return console['error'](_0x534d32(0x109)),console[_0x534d32(0x17f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x4880f1[_0x534d32(0x106)]===_0x534d32(0x14c))return console['error'](_0x534d32(0x152)),console[_0x534d32(0x17f)](_0x534d32(0x11c)),0x1;if(!_0x4880f1[_0x534d32(0x167)])throw new SDKError(ErrorCode[_0x534d32(0x119)],_0x534d32(0x147));const _0x38a56d=await withSpinner(_0x534d32(0x12b),()=>_0x9f06aa[_0x534d32(0x17e)][_0x534d32(0x135)](_0x4880f1[_0x534d32(0xfd)],_0x4880f1['segmentId']),{'verbose':_0x821880[_0x534d32(0xfe)]}),_0x215532=_0x38a56d[_0x534d32(0x12e)],_0x5e31d5=await executeSchemaQuery(_0x215532,_0x9f06aa,_0x821880);return await handleQueryOutput(_0x5e31d5,_0x821880),0x0;}catch(_0x519a09){if(_0x519a09 instanceof SDKError)return console[_0x534d32(0x17f)](_0x534d32(0x168)+_0x519a09['message']),_0x519a09[_0x534d32(0x110)]&&console[_0x534d32(0x17f)](_0x534d32(0xf9)+_0x519a09[_0x534d32(0x110)]),0x1;throw _0x519a09;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x394f27=a29_0x3b27;function a29_0x3b27(_0xd043e0,_0x20c29d){_0xd043e0=_0xd043e0-0x171;const _0x407270=a29_0x4072();let _0x3b2727=_0x407270[_0xd043e0];return _0x3b2727;}(function(_0x5a943e,_0xb73640){const _0x5469cc=a29_0x3b27,_0xa51324=_0x5a943e();while(!![]){try{const _0x47f860=-parseInt(_0x5469cc(0x177))/0x1*(-parseInt(_0x5469cc(0x19c))/0x2)+-parseInt(_0x5469cc(0x182))/0x3*(-parseInt(_0x5469cc(0x196))/0x4)+-parseInt(_0x5469cc(0x195))/0x5*(-parseInt(_0x5469cc(0x1aa))/0x6)+-parseInt(_0x5469cc(0x179))/0x7+parseInt(_0x5469cc(0x17a))/0x8*(-parseInt(_0x5469cc(0x1a5))/0x9)+parseInt(_0x5469cc(0x1a1))/0xa+-parseInt(_0x5469cc(0x1a3))/0xb*(parseInt(_0x5469cc(0x18a))/0xc);if(_0x47f860===_0xb73640)break;else _0xa51324['push'](_0xa51324['shift']());}catch(_0x33a30d){_0xa51324['push'](_0xa51324['shift']());}}}(a29_0x4072,0xb82b1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a29_0x4072(){const _0x5d0af6=['execute','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x27\x20with\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Site:\x20','31513iCpGKD','Resolving\x20parent\x20segment\x20\x27','5713036fGkEyO','3088KRacLx','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','rule','resolveParentId','Resolved\x20folder\x20ID:\x20','β\x20Created\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','type','3EUCmnq','Resolved\x20relative\x20path\x20to:\x20','segment:create','folder','resolvePathToResource','kind','\x27...','Resolving\x20folder\x20path\x20\x27','12NTUrrL','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','resolveFolderId','data','Resolving\x20folder\x20\x27','length','description','Examples:','Parent:\x20','error','segment','3025925YvHkIn','2177044uHaDIN','Creating\x20segment\x20\x27','site','verbose','includes','parent','54SFoXgf','\x20\x20\x20Path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','createSegment','Target\x20path:\x20','910160EJEezA','Parent\x20path:\x20','6118871wuISbQ','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','13284ZCQDEH','yellow','segments','invisible','segmentPath','12WQbdwm','noCountPopulation','Segment\x20name:\x20'];a29_0x4072=function(){return _0x5d0af6;};return a29_0x4072();}import a29_0x2b188 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a29_0x394f27(0x172)]=a29_0x394f27(0x184);[a29_0x394f27(0x190)]=a29_0x394f27(0x19e);async[a29_0x394f27(0x171)](_0x162a81){const _0x3b04b4=a29_0x394f27;console[_0x3b04b4(0x193)](a29_0x2b188['yellow']('β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x3b04b4(0x193)](a29_0x2b188[_0x3b04b4(0x1a6)](_0x3b04b4(0x175)));const {options:_0x4082c3,args:_0x498197,tdx:_0x297f32}=_0x162a81,_0x39de1f=_0x4082c3;if(_0x498197['length']===0x0)return console[_0x3b04b4(0x193)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x3b04b4(0x180)),console[_0x3b04b4(0x193)](_0x3b04b4(0x191)),console['error'](_0x3b04b4(0x173)),console[_0x3b04b4(0x193)](_0x3b04b4(0x18b)),console[_0x3b04b4(0x193)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x224a32=_0x498197[0x0],_0x72df4b=_0x4082c3[_0x3b04b4(0x1a9)];let _0x368ae1=_0x224a32;_0x72df4b&&!_0x224a32[_0x3b04b4(0x19a)]('/')&&(_0x368ae1=_0x72df4b+'/'+_0x224a32,_0x39de1f['verbose']&&console[_0x3b04b4(0x193)](_0x3b04b4(0x183)+_0x368ae1));const _0x50bb7b=parsePath(_0x368ae1);if(_0x50bb7b[_0x3b04b4(0x1a7)][_0x3b04b4(0x18f)]<0x2)return console[_0x3b04b4(0x193)](_0x3b04b4(0x1a4)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xdb508=_0x50bb7b[_0x3b04b4(0x1a7)][0x0],_0x225648=getBaseName(_0x368ae1),_0x63caa3=getParentPath(_0x368ae1);_0x39de1f['verbose']&&(console[_0x3b04b4(0x193)](_0x3b04b4(0x176)+_0x39de1f[_0x3b04b4(0x198)]),console[_0x3b04b4(0x193)](_0x3b04b4(0x1a0)+_0x368ae1),console['error'](_0x3b04b4(0x192)+_0xdb508),console[_0x3b04b4(0x193)](_0x3b04b4(0x1ac)+_0x225648),console['error'](_0x3b04b4(0x1a2)+_0x63caa3));const _0x3abd0b=await withSpinner(_0x3b04b4(0x178)+_0xdb508+_0x3b04b4(0x188),()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x17d)](_0xdb508),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x1a56a1=_0x3abd0b['data'];let _0x5f4171;if(_0x50bb7b['segments'][_0x3b04b4(0x18f)]>0x2){const _0x5ac250=await withSpinner(_0x3b04b4(0x189)+_0x63caa3+'\x27...',()=>_0x297f32['segment'][_0x3b04b4(0x186)](_0x63caa3),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x46f927=_0x5ac250['data'];if(_0x46f927[_0x3b04b4(0x181)]!==_0x3b04b4(0x185)&&_0x46f927['type']!==_0x3b04b4(0x19b))return console['error'](_0x3b04b4(0x17b)),0x1;_0x5f4171=_0x46f927['folderId'];}else{if(_0x39de1f['folder']){const _0xd5de62=await withSpinner(_0x3b04b4(0x18e)+_0x39de1f[_0x3b04b4(0x185)]+'\x27...',()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x18c)](_0x1a56a1,_0x39de1f['folder']),{'verbose':_0x39de1f['verbose']});_0x5f4171=_0xd5de62[_0x3b04b4(0x18d)];}}_0x39de1f[_0x3b04b4(0x199)]&&_0x5f4171&&console[_0x3b04b4(0x193)](_0x3b04b4(0x17e)+_0x5f4171);const _0x3199ae=await loadJSONFromOptions(_0x39de1f[_0x3b04b4(0x17c)],_0x39de1f['ruleFile']),_0x2bf1ab={'name':_0x225648,'description':_0x39de1f[_0x3b04b4(0x190)],'rule':_0x3199ae,'kind':_0x39de1f[_0x3b04b4(0x187)]!==undefined?parseInt(_0x39de1f['kind'],0xa):undefined,'isVisible':_0x39de1f[_0x3b04b4(0x1a8)]?![]:undefined,'segmentFolderId':_0x5f4171,'countPopulation':_0x39de1f[_0x3b04b4(0x1ab)]?![]:undefined},_0x4f7cbd=await withSpinner(_0x3b04b4(0x197)+_0x225648+_0x3b04b4(0x188),()=>_0x297f32[_0x3b04b4(0x194)][_0x3b04b4(0x19f)](_0x1a56a1,_0x2bf1ab),{'verbose':_0x39de1f[_0x3b04b4(0x199)]}),_0x189e19=_0x4f7cbd['data'];return console[_0x3b04b4(0x193)](_0x3b04b4(0x17f)+_0x189e19[_0x3b04b4(0x172)]+_0x3b04b4(0x174)+_0x189e19['id']),_0x368ae1!==_0x224a32&&console[_0x3b04b4(0x193)](_0x3b04b4(0x19d)+_0x368ae1),await handleSDKOutput([_0x189e19],_0x39de1f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x2da84a=a30_0x28b5;(function(_0x34d471,_0x4129fe){const _0x17ad2c=a30_0x28b5,_0x156b7d=_0x34d471();while(!![]){try{const _0x4b9efa=parseInt(_0x17ad2c(0x140))/0x1+parseInt(_0x17ad2c(0x149))/0x2+-parseInt(_0x17ad2c(0x135))/0x3*(parseInt(_0x17ad2c(0x142))/0x4)+parseInt(_0x17ad2c(0x139))/0x5+-parseInt(_0x17ad2c(0x13b))/0x6*(parseInt(_0x17ad2c(0x14f))/0x7)+-parseInt(_0x17ad2c(0x137))/0x8*(parseInt(_0x17ad2c(0x145))/0x9)+parseInt(_0x17ad2c(0x13e))/0xa;if(_0x4b9efa===_0x4129fe)break;else _0x156b7d['push'](_0x156b7d['shift']());}catch(_0x499908){_0x156b7d['push'](_0x156b7d['shift']());}}}(a30_0x5043,0x5471e));import{BaseCommand}from'./command.js';function a30_0x5043(){const _0x2693dd=['verbose','1198932ZUlLAF','description','\x20field','\x27...','error','execute','2552032mwLNLN','3405BLnCDs','Listing\x20fields\x20for\x20\x27','48280ONoXqf','segment:fields','652590sEvcen','Parent\x20segment:\x20','6RGYfoP','listFields','List\x20available\x20fields\x20for\x20segmentation','794240PLnfSW','name','641914PEfzgt','β\x20Found\x20','952GifMKm','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','jsonl','702FqIeXl','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a30_0x5043=function(){return _0x2693dd;};return a30_0x5043();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a30_0x28b5(_0x323b30,_0x3b0bb2){_0x323b30=_0x323b30-0x135;const _0x504349=a30_0x5043();let _0x28b57c=_0x504349[_0x323b30];return _0x28b57c;}export class SegmentFieldsCommand extends BaseCommand{[a30_0x2da84a(0x13f)]=a30_0x2da84a(0x138);[a30_0x2da84a(0x14a)]=a30_0x2da84a(0x13d);async[a30_0x2da84a(0x14e)](_0x57253d){const _0x32c3c3=a30_0x2da84a,{options:_0x14c289,args:_0x21cb22,tdx:_0x584a46}=_0x57253d,_0x219b75=_0x21cb22[0x0]||_0x14c289['parentSegment'];if(!_0x219b75)return console[_0x32c3c3(0x14d)](_0x32c3c3(0x146)),console[_0x32c3c3(0x14d)](_0x32c3c3(0x143)),console['error'](_0x32c3c3(0x147)),0x1;_0x14c289[_0x32c3c3(0x148)]&&(console[_0x32c3c3(0x14d)]('Site:\x20'+_0x14c289['site']),console[_0x32c3c3(0x14d)](_0x32c3c3(0x13a)+_0x219b75));const _0x49ac3e=await withSpinner(_0x32c3c3(0x136)+_0x219b75+_0x32c3c3(0x14c),()=>_0x584a46['segment'][_0x32c3c3(0x13c)](_0x219b75),{'verbose':_0x14c289[_0x32c3c3(0x148)]}),_0x336e06=_0x49ac3e['data'];console[_0x32c3c3(0x14d)](_0x32c3c3(0x141)+_0x336e06['length']+_0x32c3c3(0x14b)+(_0x336e06['length']!==0x1?'s':''));if(_0x14c289['json']||_0x14c289[_0x32c3c3(0x144)])return await handleSDKOutput(_0x336e06,_0x14c289),0x0;return displayFieldsHumanReadable(_0x336e06,_0x219b75),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x3121f0=a31_0x1927;(function(_0x35ea79,_0x1e5d31){const _0x4f1c2a=a31_0x1927,_0x142266=_0x35ea79();while(!![]){try{const _0x2dcbde=-parseInt(_0x4f1c2a(0x1f8))/0x1+parseInt(_0x4f1c2a(0x207))/0x2*(-parseInt(_0x4f1c2a(0x210))/0x3)+-parseInt(_0x4f1c2a(0x208))/0x4*(parseInt(_0x4f1c2a(0x1ef))/0x5)+-parseInt(_0x4f1c2a(0x1f0))/0x6+-parseInt(_0x4f1c2a(0x1f4))/0x7*(-parseInt(_0x4f1c2a(0x211))/0x8)+parseInt(_0x4f1c2a(0x212))/0x9*(parseInt(_0x4f1c2a(0x20d))/0xa)+-parseInt(_0x4f1c2a(0x220))/0xb*(-parseInt(_0x4f1c2a(0x21b))/0xc);if(_0x2dcbde===_0x1e5d31)break;else _0x142266['push'](_0x142266['shift']());}catch(_0x27712f){_0x142266['push'](_0x142266['shift']());}}}(a31_0x373a,0xa4dc1));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a31_0x5cc9f7 from'chalk';function a31_0x373a(){const _0x2ef6ce=['β\x20Context\x20set:\x20','content','name','Site:\x20','diff','no_parent','parentSegment','\x0aChanges\x20to\x20\x27','segment','absolutePath','\x20files\x20to\x20','\x20\x20Target:\x20','site','\x20\x20πΊοΈ\x20\x20','files','hasChanges','error','235xkMSiW','1479252uaqsfJ','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isNew','setPhase','91RqBSCX','dryRun','Pulling\x20segments\x20from\x20\x27','\x20unchanged\x20files','1317072mQqkwF','red','helpText','β\x20Pulled\x20','length','session','segments','dim','\x20=\x20','errorCode','cyan','\x20files?','description','Error:\x20','\x27...','39868wElaVL','106044BABfUF','parentName','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','\x20with\x20','journeyVersions','160010KVfKBy','\x20new\x20files','\x20changed\x20files','6pOolSm','234344LGJKvN','351CbqQYJ','green','\x0aPull\x20summary\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','Parent\x20segment:\x20','verbose','repeat','message','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','359988pPCcoY','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Aborted.','\x20activations','filter','924wxtfTJ','-\x20no\x20files\x20written','counts','utf-8','targetDir','yes','\x20segments','relativePath','β\x20All\x20files\x20are\x20up\x20to\x20date','data','execute','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','journeys','type','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','Target\x20resource:\x20','\x0aError:','dirname','yellow'];a31_0x373a=function(){return _0x2ef6ce;};return a31_0x373a();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a31_0x1e6ec9 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a31_0x1927(_0x27273f,_0x2cddf4){_0x27273f=_0x27273f-0x1e3;const _0x373a58=a31_0x373a();let _0x1927c7=_0x373a58[_0x27273f];return _0x1927c7;}export class SegmentPullCommand extends BaseCommand{[a31_0x3121f0(0x235)]='segment:pull';[a31_0x3121f0(0x204)]=a31_0x3121f0(0x21a);async[a31_0x3121f0(0x22a)](_0x3ac912){const _0x514297=a31_0x3121f0,{options:_0x4440ef,args:_0x1c11e4,tdx:_0x65df63}=_0x3ac912,_0x1355af=_0x4440ef,_0x2e3936=await resolveTarget({'arg':_0x1c11e4[0x0],'contextParent':_0x4440ef[_0x514297(0x1e4)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2e3936))return _0x2e3936[_0x514297(0x201)]===_0x514297(0x1e3)?(console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x514297(0x20a)),console[_0x514297(0x1ee)](_0x514297(0x22e)),console[_0x514297(0x1ee)](_0x514297(0x215))):(console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x1f9)](_0x514297(0x205)+_0x2e3936[_0x514297(0x219)]+'\x0a')),_0x2e3936[_0x514297(0x1fa)]&&console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x202)](_0x2e3936[_0x514297(0x1fa)]))),0x1;const _0x1a40bf=_0x2e3936[_0x514297(0x209)],_0x568056=_0x2e3936[_0x514297(0x224)],_0xfb3669=_0x2e3936[_0x514297(0x22d)]==='file'?_0x2e3936['resourceName']:undefined;_0x1355af[_0x514297(0x217)]&&(console[_0x514297(0x1ee)](_0x514297(0x236)+_0x1355af[_0x514297(0x1ea)]),console[_0x514297(0x1ee)](_0x514297(0x216)+_0x1a40bf),_0xfb3669&&console['error'](_0x514297(0x22f)+_0xfb3669));const _0x5f5c9e=await withProgressSpinner(_0x514297(0x1f6)+_0x1a40bf+_0x514297(0x206),_0x581581=>_0x65df63[_0x514297(0x1e6)]['pullSegments'](_0x1a40bf,{'targetDir':_0x568056,'targetResourceName':_0xfb3669,'verbose':_0x1355af[_0x514297(0x217)],'progress':{'update':_0x1cb10d=>{const _0xaa3829=_0x514297;_0x581581[_0xaa3829(0x1f3)](_0x1cb10d),_0x1355af['verbose']&&console['error']('\x20\x20'+_0x1cb10d);}}}),{'verbose':_0x1355af[_0x514297(0x217)]}),_0x2c0628=_0x5f5c9e[_0x514297(0x229)];if(_0x2c0628[_0x514297(0x222)]['segments']===0x0&&_0x2c0628[_0x514297(0x222)][_0x514297(0x22c)]===0x0)return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x22b)+_0x2c0628[_0x514297(0x209)]+'\x27')),0x0;const _0x566ed8=_0x2c0628['files']['filter'](_0x139149=>_0x139149['isNew']),_0x25b866=_0x2c0628[_0x514297(0x1ec)]['filter'](_0x58f2e7=>!_0x58f2e7[_0x514297(0x1f2)]&&_0x58f2e7[_0x514297(0x1ed)]),_0x273f39=_0x2c0628[_0x514297(0x1ec)][_0x514297(0x21f)](_0x4b7600=>!_0x4b7600[_0x514297(0x1f2)]&&!_0x4b7600[_0x514297(0x1ed)]);console[_0x514297(0x1ee)](_0x514297(0x214)+_0x2c0628[_0x514297(0x209)]+'\x27:'),console[_0x514297(0x1ee)]('\x20\x20π―\x20'+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628['counts'][_0x514297(0x1fe)]+_0x514297(0x226))+_0x514297(0x20b)+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628[_0x514297(0x222)]['activations']+_0x514297(0x21e)));if(_0x2c0628[_0x514297(0x222)]['journeys']>0x0){const _0x23fccc=_0x2c0628['counts'][_0x514297(0x20c)]>_0x2c0628[_0x514297(0x222)]['journeys']?'\x20('+_0x2c0628[_0x514297(0x222)]['journeyVersions']+'\x20versions)':'';console[_0x514297(0x1ee)](_0x514297(0x1eb)+a31_0x5cc9f7['cyan'](_0x2c0628[_0x514297(0x222)][_0x514297(0x22c)]+'\x20journeys')+a31_0x5cc9f7['dim'](_0x23fccc));}console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x213)]('+\x20'+_0x566ed8[_0x514297(0x1fc)]+_0x514297(0x20e))),console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x232)]('~\x20'+_0x25b866[_0x514297(0x1fc)]+_0x514297(0x20f))),console[_0x514297(0x1ee)]('\x20\x20'+a31_0x5cc9f7[_0x514297(0x1ff)]('=\x20'+_0x273f39[_0x514297(0x1fc)]+_0x514297(0x1f7))),console['error'](_0x514297(0x1e9)+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628['targetDir'])+'\x0a');if(_0x25b866[_0x514297(0x1fc)]>0x0)for(const _0x1bf808 of _0x25b866){console[_0x514297(0x1ee)](_0x514297(0x1e5)+_0x1bf808[_0x514297(0x227)]+'\x27:'),console[_0x514297(0x1ee)]('β'[_0x514297(0x218)](0x3c)),console[_0x514297(0x1ee)](_0x1bf808[_0x514297(0x237)]),console['error']('β'[_0x514297(0x218)](0x3c));}if(_0x1355af[_0x514297(0x1f5)])return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x21c))),0x0;if(_0x566ed8[_0x514297(0x1fc)]===0x0&&_0x25b866['length']===0x0)return console['error'](a31_0x5cc9f7['green'](_0x514297(0x228))),saveSessionContext({'parent_segment':_0x2c0628[_0x514297(0x209)]},_0x1355af[_0x514297(0x1fd)]),console['error'](a31_0x5cc9f7[_0x514297(0x213)](_0x514297(0x233)+a31_0x5cc9f7[_0x514297(0x1ff)]('parent_segment')+_0x514297(0x200)+a31_0x5cc9f7['cyan'](_0x2c0628[_0x514297(0x209)]))),0x0;if(!_0x1355af[_0x514297(0x225)]){if(!isInteractive())return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x1f9)](_0x514297(0x230)),_0x514297(0x1f1)),console[_0x514297(0x1ee)](a31_0x5cc9f7['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1477c5=await confirmKey('Write\x20'+(_0x566ed8[_0x514297(0x1fc)]+_0x25b866[_0x514297(0x1fc)])+_0x514297(0x203));if(!_0x1477c5)return console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x232)](_0x514297(0x21d)),_0x514297(0x221)),0x1;}for(const _0x33b83c of _0x2c0628[_0x514297(0x1ec)]){if(_0x33b83c[_0x514297(0x1f2)]||_0x33b83c['hasChanges']){const _0x61bac3=a31_0x1e6ec9[_0x514297(0x231)](_0x33b83c[_0x514297(0x1e7)]);!existsSync(_0x61bac3)&&mkdirSync(_0x61bac3,{'recursive':!![]}),writeFileSync(_0x33b83c[_0x514297(0x1e7)],_0x33b83c[_0x514297(0x234)],_0x514297(0x223));}}return console['error'](a31_0x5cc9f7['green'](_0x514297(0x1fb)+(_0x566ed8[_0x514297(0x1fc)]+_0x25b866[_0x514297(0x1fc)])+_0x514297(0x1e8)+_0x2c0628[_0x514297(0x224)])),saveSessionContext({'parent_segment':_0x2c0628[_0x514297(0x209)]},_0x1355af[_0x514297(0x1fd)]),console[_0x514297(0x1ee)](a31_0x5cc9f7[_0x514297(0x213)]('β\x20Context\x20set:\x20'+a31_0x5cc9f7['dim']('parent_segment')+'\x20=\x20'+a31_0x5cc9f7[_0x514297(0x202)](_0x2c0628[_0x514297(0x209)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x33420b=a32_0x1ef6;(function(_0x3aad47,_0xcd818e){const _0x26536a=a32_0x1ef6,_0x14a602=_0x3aad47();while(!![]){try{const _0x5e2dba=parseInt(_0x26536a(0x96))/0x1+parseInt(_0x26536a(0xb0))/0x2*(parseInt(_0x26536a(0x8c))/0x3)+-parseInt(_0x26536a(0x115))/0x4+parseInt(_0x26536a(0xc0))/0x5+parseInt(_0x26536a(0x123))/0x6+parseInt(_0x26536a(0x10e))/0x7+-parseInt(_0x26536a(0xdd))/0x8;if(_0x5e2dba===_0xcd818e)break;else _0x14a602['push'](_0x14a602['shift']());}catch(_0x3a43db){_0x14a602['push'](_0x14a602['shift']());}}}(a32_0x37bc,0x40b16));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';function a32_0x37bc(){const _0xb7211d=['\x20\x20πΊοΈ\x20\x20Journeys:','\x20changed','1422470edOAbK','Preparing\x20journeys...','toString','folderId','audienceId','Fetching\x20existing\x20activations...','map','600168HhYiAV','red','state','\x20changes?','add','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','site','folderPath','unchanged','Fetching\x20existing\x20folders...','toCreate','updatedAt','New\x20segment:','\x20deleted','1714842ZLdMzx','\x0aβ\x20Push\x20complete','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','journeyId','\x20created','yes','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x0aPush\x20summary\x20for\x20\x27','parentName','push','getJourney','26295wEFDIb','Error:\x20Directory\x20not\x20found:\x20','journeysOnly','segments','blue','folders','cyan','buildUserMaps','deleted','\x20\x20Activations:','199867TAjvRp','join','\x20\x20π\x20Segments:','journeys','segment','(Journey\x20will\x20be\x20deleted)','parent_name','listSegments','activations','versionNumber','execute','get','helpText','data','\x20\x20Journeys:\x20','dryRun','yamlConfig','targetDir','endsWith','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','/j/da/je','\x20\x20Activations:\x20','\x20to\x20update','message','created','delete','34gfaZBt','Changes\x20to\x20journey:','\x27...','isNew','toUpdate','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','nameToId','updated','errorCode','getParent','Folders\x20to\x20create:','all','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','listJourneysWithDetailsFromParentSegment','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','Aborted.','628225BGqrhO','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','idToName','Changes\x20to:','New\x20journey:','attributes','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','error','Fetching\x20existing\x20segments...','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','nameToType','\x20YAML\x20files\x20found','name','changed','new','listActivations','journeyBundleId','resolveParentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','journeyBundleName','\x20to\x20delete','setPhase','/app/ps/','no_parent','\x20folders\x20to\x20create','.yml','β\x20All\x20journeys\x20are\x20up\x20to\x20date','verbose','segmentFolderId','4388080pqijXX','green','Fetching\x20existing\x20journeys...','dim','\x20\x20\x20\x20','relationships','\x20\x20Segments:\x20','segment\x20or\x20journey','existingJourney','list','toDelete','π\x20','/e/','scopedFolderPath','Fetching\x20parent\x20segment\x20details...','\x20new','results','diff','Delete\x20segment:','yellow','getOutputSchemaWithCache','\x0aValidation\x20failed:','\x0aError:','\x20to\x20create','Source\x20directory:\x20','length','Delete\x20journey:','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','parentFolder','filePath','repeat','Resolving\x20parent\x20segment\x20\x27','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','then','connection','Fetching\x20users\x20for\x20email\x20resolution...','\x20unchanged','cwd','journey','description','parentSegment','type','user','\x20activations]','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','set'];a32_0x37bc=function(){return _0xb7211d;};return a32_0x37bc();}import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a32_0x4726a1 from'chalk';import{existsSync}from'fs';function a32_0x1ef6(_0x26cc90,_0x3efacf){_0x26cc90=_0x26cc90-0x8b;const _0x37bc52=a32_0x37bc();let _0x1ef6df=_0x37bc52[_0x26cc90];return _0x1ef6df;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a32_0x33420b(0x105)]=a32_0x33420b(0x129);async[a32_0x33420b(0xa0)](_0x597bb8){const _0x1cbf12=a32_0x33420b,{options:_0x2c58de,args:_0x483bff,tdx:_0x1782b6}=_0x597bb8,_0x44be35=_0x2c58de,_0x415dfa=await resolveTarget({'arg':_0x483bff[0x0],'contextParent':_0x2c58de[_0x1cbf12(0x106)],'cwd':process[_0x1cbf12(0x103)]()});if(!isSuccessfulResolution(_0x415dfa))return _0x415dfa[_0x1cbf12(0xb8)]===_0x1cbf12(0xd7)?(console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xf0)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x1cbf12(0xbe)),console[_0x1cbf12(0xc7)](_0x1cbf12(0xfe)),console[_0x1cbf12(0xc7)](_0x1cbf12(0xd2))):(console['error'](a32_0x4726a1[_0x1cbf12(0x116)]('Error:\x20'+_0x415dfa[_0x1cbf12(0xad)]+'\x0a')),_0x415dfa[_0x1cbf12(0xa2)]&&console['error'](a32_0x4726a1[_0x1cbf12(0x92)](_0x415dfa[_0x1cbf12(0xa2)]))),0x1;if(_0x415dfa[_0x1cbf12(0x107)]===_0x1cbf12(0x9c))return console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0x8d)+_0x415dfa['targetDir']+'\x0a')),console[_0x1cbf12(0xc7)](a32_0x4726a1['cyan'](_0x1cbf12(0xc1))),0x1;const _0x4bc538=_0x415dfa[_0x1cbf12(0x12b)],_0x4ba921=_0x415dfa[_0x1cbf12(0xa7)],_0x1124e1=_0x415dfa['type']==='file'?_0x415dfa[_0x1cbf12(0xfa)]:undefined,_0x4f17b5=getScopedDetails(_0x415dfa),_0x197f48=_0x4f17b5?.['isScoped']??![],_0xa3d81e=_0x4f17b5?.[_0x1cbf12(0xea)]??'';if(!existsSync(_0x4ba921))return console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x116)]('Error:\x20Directory\x20not\x20found:\x20'+_0x4ba921+'\x0a')),console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x92)](_0x1cbf12(0xc1))),0x1;_0x44be35['verbose']&&(console[_0x1cbf12(0xc7)]('Site:\x20'+_0x44be35['site']),console[_0x1cbf12(0xc7)](_0x1cbf12(0xfd)+_0x4bc538),console[_0x1cbf12(0xc7)](_0x1cbf12(0xf5)+_0x4ba921),_0x197f48&&console['error']('Scoped\x20to\x20folder:\x20'+_0xa3d81e));const _0xdf8b70=await withSpinner(_0x1cbf12(0xfc)+_0x4bc538+_0x1cbf12(0xb2),()=>_0x1782b6[_0x1cbf12(0x9a)][_0x1cbf12(0xd1)](_0x4bc538),{'verbose':_0x44be35[_0x1cbf12(0xdb)]}),_0x3e5ae0=_0xdf8b70[_0x1cbf12(0xa3)],[_0x21c928,_0x357603,_0x3adea4,_0x1fdace,_0x5038b3]=await Promise['all']([withSpinner(_0x1cbf12(0xeb),()=>_0x1782b6['segment'][_0x1cbf12(0xb9)](_0x3e5ae0),{'verbose':_0x44be35[_0x1cbf12(0xdb)]}),withSpinner(_0x1cbf12(0xc8),()=>_0x1782b6[_0x1cbf12(0x9a)][_0x1cbf12(0x9d)](_0x3e5ae0),{'verbose':_0x44be35[_0x1cbf12(0xdb)]}),withSpinner(_0x1cbf12(0x11e),()=>_0x1782b6[_0x1cbf12(0x9a)]['listFolders'](_0x3e5ae0),{'verbose':_0x44be35[_0x1cbf12(0xdb)]}),withSpinner(_0x1cbf12(0xdf),()=>_0x1782b6[_0x1cbf12(0x104)][_0x1cbf12(0xbd)](_0x3e5ae0,{'includeAllVersions':!![]}),{'verbose':_0x44be35[_0x1cbf12(0xdb)]}),withSpinner(_0x1cbf12(0x101),()=>_0x1782b6[_0x1cbf12(0x108)][_0x1cbf12(0x93)](),{'verbose':_0x44be35['verbose']})['then'](_0x14b250=>_0x14b250[_0x1cbf12(0xa3)])]),_0x1a0688=_0x21c928[_0x1cbf12(0xa3)],_0x1b385a=extractRootFolderId(_0x1a0688),_0x3f04cc=_0x357603['data'],_0x49524b=_0x3adea4[_0x1cbf12(0xa3)],{journeys:_0x270b35,activationStepsById:_0x31fae5}=_0x1fdace['data'],_0xa9a709=new Map(_0x270b35[_0x1cbf12(0x114)](_0x3ff93e=>[_0x3ff93e['id'],_0x3ff93e])),_0x213f43=_0x270b35['map'](_0x2e66b4=>({'id':_0x2e66b4['id'],'name':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0xcc)],'journeyBundleName':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0xd3)]||'','journeyBundleId':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0xd0)]||'','versionNumber':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0x9f)],'description':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0x105)],'state':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0x117)],'paused':_0x2e66b4['attributes']['paused'],'audienceId':_0x2e66b4[_0x1cbf12(0xc5)][_0x1cbf12(0x112)],'folderId':_0x2e66b4[_0x1cbf12(0xe2)]?.[_0x1cbf12(0xf9)]?.[_0x1cbf12(0xa3)]?.['id'],'createdAt':_0x2e66b4['attributes']['createdAt'],'updatedAt':_0x2e66b4['attributes'][_0x1cbf12(0x120)]})),{emailToId:_0x199d02,idToEmail:_0x4f34fb}=_0x5038b3,_0x38f276=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x29347d=_0x1cbf12,_0x3d3ceb=await _0x1782b6['connection'][_0x29347d(0xe6)]();return buildConnectionMaps(_0x3d3ceb);},{'verbose':_0x44be35[_0x1cbf12(0xdb)]})[_0x1cbf12(0xff)](_0x5db977=>_0x5db977[_0x1cbf12(0xa3)]),_0x3585aa=_0x38f276[_0x1cbf12(0xb6)],_0x4d62bb=_0x38f276['idToName'],_0x3fbfc8=_0x38f276[_0x1cbf12(0xca)],_0x1173c4={'emailToIdMap':_0x199d02,'connectionNameToIdMap':_0x3585aa,'connectionNameToTypeMap':_0x3fbfc8,'getSchema':_0x4dabd5=>_0x1782b6[_0x1cbf12(0x100)][_0x1cbf12(0xf1)](_0x4dabd5)};let {pathToId:_0x31d83e,idToPath:_0x452b69}=buildFolderMaps(_0x49524b);const _0x3888b2=buildSegmentLookupMap(_0x3f04cc,_0x452b69),_0x5e9218=buildSegmentNameToIdMap(_0x3f04cc),_0x5abbab=buildJourneyBundleLookupMap(_0x213f43,_0x452b69);let _0x1ff3e5;if(_0x1124e1){if(!_0x1124e1[_0x1cbf12(0xa8)](_0x1cbf12(0xd9))&&!_0x1124e1[_0x1cbf12(0xa8)]('.yaml'))return console['error'](a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0xbc)+_0x1124e1+'\x0a')),0x1;_0x1ff3e5=[_0x1124e1];}else _0x1ff3e5=findYamlFiles(_0x4ba921);if(_0x1ff3e5[_0x1cbf12(0xf6)]===0x0)return console[_0x1cbf12(0xc7)](a32_0x4726a1['red'](_0x1cbf12(0xc9)+_0x4ba921+'\x0a')),console['error'](a32_0x4726a1[_0x1cbf12(0x92)](_0x1cbf12(0xc6))),0x1;let _0x4c2e29,_0x4bc13e;try{const _0x5019cb=parseAndClassifyYamlFiles(_0x1ff3e5,_0x4ba921,{'skipSegments':_0x44be35[_0x1cbf12(0x8e)]});_0x4c2e29=_0x5019cb['segments'],_0x4bc13e=_0x5019cb[_0x1cbf12(0x99)];const _0x58d51c=validateParsedFiles(_0x5019cb,_0x4ba921);if(_0x58d51c[_0x1cbf12(0xf6)]>0x0)return console['error'](a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0xf2))),console[_0x1cbf12(0xc7)](formatValidationErrors(_0x58d51c)),console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xf0)](_0x1cbf12(0x10a))),0x1;}catch(_0x552feb){return console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x116)]('Error\x20parsing\x20YAML:\x20'+(_0x552feb instanceof Error?_0x552feb[_0x1cbf12(0xad)]:_0x552feb))),0x1;}if(_0x4c2e29[_0x1cbf12(0xf6)]===0x0&&_0x4bc13e[_0x1cbf12(0xf6)]===0x0){const _0x3caebf=_0x44be35[_0x1cbf12(0x8e)]?_0x1cbf12(0x104):_0x1cbf12(0xe4);return console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xf0)]('No\x20'+_0x3caebf+_0x1cbf12(0xcb))),0x0;}const _0x25f823=new Map();_0x3f04cc[_0x1cbf12(0xf6)]>0x0&&!_0x44be35['journeysOnly']&&await withSpinner(_0x1cbf12(0x113),async()=>{await batchAsync(_0x3f04cc,async _0xe139f7=>{const _0xf5ae5d=a32_0x1ef6,_0x587be5=await _0x1782b6[_0xf5ae5d(0x9a)][_0xf5ae5d(0xcf)](_0x3e5ae0,_0xe139f7['id']);_0x25f823[_0xf5ae5d(0x10b)](_0xe139f7['id'],_0x587be5);});},{'verbose':_0x44be35['verbose']});const {segmentFiles:_0x525078,foldersToCreate:_0x71b1f5}=await prepareSegmentFiles(_0x4c2e29,{'segmentByFolderAndName':_0x3888b2,'activationsBySegmentId':_0x25f823,'folderPathToId':_0x31d83e,'idToEmailMap':_0x4f34fb,'connectionIdToNameMap':_0x4d62bb},_0x1173c4,_0x197f48,_0xa3d81e),_0x51de6f=_0x1124e1?[]:findSegmentsToDelete(_0x3f04cc,_0x4c2e29[_0x1cbf12(0x114)](({yamlConfig:_0x4e5b63,folderPath:_0x249c24})=>({'yamlConfig':_0x4e5b63,'folderPath':resolveTDFolderPath(_0x249c24,_0x197f48,_0xa3d81e)})),_0x452b69,_0xa3d81e,_0x197f48),{journeyFiles:_0x302e18,foldersToCreate:_0x4b7dfa}=await withProgressSpinner(_0x1cbf12(0x10f),async _0x4ef645=>prepareJourneyFiles(_0x4bc13e,{'fetchJourney':async _0x24c395=>_0x1782b6[_0x1cbf12(0x104)][_0x1cbf12(0x8b)](_0x24c395[_0x1cbf12(0x126)]),'journeyBundlesByFolderAndName':_0x5abbab,'folderPathToId':_0x31d83e,'idToEmailMap':_0x4f34fb,'connectionIdToNameMap':_0x4d62bb,'existingSegments':_0x3f04cc,'parentId':_0x3e5ae0,'deps':_0x1782b6,'progress':{'update':_0x264a0a=>{const _0x12efe3=_0x1cbf12;_0x4ef645[_0x12efe3(0xd5)](_0x264a0a),_0x44be35[_0x12efe3(0xdb)]&&console[_0x12efe3(0xc7)]('\x20\x20'+_0x264a0a);}},'journeyById':_0xa9a709,'activationStepsById':_0x31fae5},_0x197f48,_0xa3d81e),{'verbose':_0x44be35[_0x1cbf12(0xdb)]})['then'](_0x346c09=>_0x346c09[_0x1cbf12(0xa3)]);for(const _0x1a72dc of _0x4b7dfa){_0x71b1f5[_0x1cbf12(0x119)](_0x1a72dc);}const _0x3b09f5=_0x1124e1?[]:findJourneysToDelete(_0x213f43,_0x4bc13e[_0x1cbf12(0x114)](({yamlConfig:_0x279de4,folderPath:_0x8f4140})=>({'yamlConfig':_0x279de4,'folderPath':resolveTDFolderPath(_0x8f4140,_0x197f48,_0xa3d81e)})),_0x452b69,_0xa3d81e,_0x197f48),_0x1d80e3=calculatePushStats(_0x525078,_0x302e18,_0x71b1f5,_0x51de6f,_0x3b09f5,!!_0x44be35[_0x1cbf12(0xaf)],!!_0x44be35[_0x1cbf12(0x8e)]),_0x24b757=_0x1d80e3[_0x1cbf12(0x8f)][_0x1cbf12(0xce)],_0x468875=_0x1d80e3[_0x1cbf12(0x8f)]['changed'],_0x49e709=_0x1d80e3[_0x1cbf12(0x8f)][_0x1cbf12(0x11d)],_0x2a4f41=_0x1d80e3[_0x1cbf12(0x8f)][_0x1cbf12(0xe7)],_0x1187ff=_0x1d80e3[_0x1cbf12(0x91)][_0x1cbf12(0x11f)],_0x2a8349=_0x1d80e3[_0x1cbf12(0x99)][_0x1cbf12(0xce)],_0x12c0e5=_0x1d80e3[_0x1cbf12(0x99)][_0x1cbf12(0xcd)],_0x3d594a=_0x1d80e3[_0x1cbf12(0x99)][_0x1cbf12(0x11d)],_0x28401b=_0x1d80e3[_0x1cbf12(0x99)][_0x1cbf12(0xe7)],_0x3dcbba=_0x1d80e3[_0x1cbf12(0x9e)][_0x1cbf12(0xbb)],_0x5a87da=_0x1d80e3[_0x1cbf12(0x9e)][_0x1cbf12(0x11f)],_0x1d74bc=_0x1d80e3[_0x1cbf12(0x9e)][_0x1cbf12(0xb4)],_0x26cb40=_0x1d80e3[_0x1cbf12(0x9e)][_0x1cbf12(0xe7)];console[_0x1cbf12(0xc7)](_0x1cbf12(0x12a)+_0x4bc538+'\x27:');_0x1187ff[_0x1cbf12(0xf6)]>0x0&&console[_0x1cbf12(0xc7)]('\x20\x20'+a32_0x4726a1[_0x1cbf12(0x90)](_0x1cbf12(0xe8)+_0x1187ff[_0x1cbf12(0xf6)]+_0x1cbf12(0xd8)));if(!_0x44be35[_0x1cbf12(0x8e)]){console[_0x1cbf12(0xc7)](_0x1cbf12(0x98)),console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xde)]('+\x20'+_0x24b757[_0x1cbf12(0xf6)]+_0x1cbf12(0xec))),console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xf0)]('~\x20'+_0x468875['length']+_0x1cbf12(0x10d)));if(_0x2a4f41[_0x1cbf12(0xf6)]>0x0)console['error'](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0x116)]('-\x20'+_0x2a4f41[_0x1cbf12(0xf6)]+_0x1cbf12(0xd4)));else _0x51de6f['length']>0x0&&!_0x44be35[_0x1cbf12(0xaf)]&&console['error'](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xe0)](_0x51de6f['length']+_0x1cbf12(0x11a)));console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xe0)]('=\x20'+_0x49e709[_0x1cbf12(0xf6)]+_0x1cbf12(0x102)));}if(_0x302e18[_0x1cbf12(0xf6)]>0x0||_0x3b09f5[_0x1cbf12(0xf6)]>0x0){console[_0x1cbf12(0xc7)](_0x1cbf12(0x10c)),console[_0x1cbf12(0xc7)]('\x20\x20\x20\x20'+a32_0x4726a1[_0x1cbf12(0xde)]('+\x20'+_0x2a8349['length']+_0x1cbf12(0xec))),console[_0x1cbf12(0xc7)]('\x20\x20\x20\x20'+a32_0x4726a1[_0x1cbf12(0xf0)]('~\x20'+_0x12c0e5[_0x1cbf12(0xf6)]+_0x1cbf12(0x10d)));if(_0x28401b[_0x1cbf12(0xf6)]>0x0)console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1['red']('-\x20'+_0x28401b[_0x1cbf12(0xf6)]+_0x1cbf12(0xd4)));else _0x3b09f5['length']>0x0&&!_0x44be35[_0x1cbf12(0xaf)]&&console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xe0)](_0x3b09f5['length']+_0x1cbf12(0x11a)));console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0xe0)]('=\x20'+_0x3d594a['length']+_0x1cbf12(0x102)));}_0x3dcbba['length']>0x0&&!_0x44be35['journeysOnly']&&(console[_0x1cbf12(0xc7)](''),console['error'](_0x1cbf12(0x95)),_0x5a87da[_0x1cbf12(0xf6)]>0x0&&console[_0x1cbf12(0xc7)]('\x20\x20\x20\x20'+a32_0x4726a1[_0x1cbf12(0xde)]('+\x20'+_0x5a87da[_0x1cbf12(0xf6)]+_0x1cbf12(0xf4))),_0x1d74bc[_0x1cbf12(0xf6)]>0x0&&console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1['yellow']('~\x20'+_0x1d74bc['length']+_0x1cbf12(0xac))),_0x26cb40[_0x1cbf12(0xf6)]>0x0&&console[_0x1cbf12(0xc7)](_0x1cbf12(0xe1)+a32_0x4726a1[_0x1cbf12(0x116)]('-\x20'+_0x26cb40[_0x1cbf12(0xf6)]+_0x1cbf12(0xd4))));console[_0x1cbf12(0xc7)]('\x20\x20Source:\x20'+a32_0x4726a1['cyan'](_0x4ba921)+'\x0a');if(_0x1187ff[_0x1cbf12(0xf6)]>0x0){console[_0x1cbf12(0xc7)](_0x1cbf12(0xba));for(const _0x52dfd4 of _0x1187ff){console[_0x1cbf12(0xc7)]('\x20\x20'+a32_0x4726a1[_0x1cbf12(0x90)]('+')+'\x20'+_0x52dfd4);}console['error']('');}if(_0x24b757[_0x1cbf12(0xf6)]>0x0&&!_0x44be35[_0x1cbf12(0x8e)])for(const _0xb53f95 of _0x24b757){const _0x253b49=_0xb53f95[_0x1cbf12(0x11c)]?_0xb53f95[_0x1cbf12(0x11c)]+'/'+_0xb53f95['yamlConfig'][_0x1cbf12(0xcc)]:_0xb53f95[_0x1cbf12(0xa6)][_0x1cbf12(0xcc)],_0x328281=_0xb53f95[_0x1cbf12(0xa6)][_0x1cbf12(0x9e)]?.[_0x1cbf12(0xf6)]||0x0,_0x39d069=_0x328281>0x0?a32_0x4726a1[_0x1cbf12(0xe0)]('\x20['+_0x328281+_0x1cbf12(0x109)):'';console['error']('\x0a'+a32_0x4726a1['green'](_0x1cbf12(0x121))+'\x20'+_0x253b49+_0x39d069),console[_0x1cbf12(0xc7)]('β'[_0x1cbf12(0xfb)](0x3c)),_0xb53f95[_0x1cbf12(0xee)]&&console[_0x1cbf12(0xc7)](_0xb53f95['diff']),console[_0x1cbf12(0xc7)]('β'[_0x1cbf12(0xfb)](0x3c));}if(_0x2a4f41[_0x1cbf12(0xf6)]>0x0&&!_0x44be35[_0x1cbf12(0x8e)])for(const _0x56dfb9 of _0x2a4f41){const _0x5c55bd=_0x56dfb9['segmentFolderId']?_0x452b69['get'](_0x56dfb9[_0x1cbf12(0xdc)][_0x1cbf12(0x110)]())||'':'',_0x11fb57=_0x5c55bd?_0x5c55bd+'/'+_0x56dfb9[_0x1cbf12(0xcc)]:_0x56dfb9[_0x1cbf12(0xcc)],_0x446c86=_0x25f823['get'](_0x56dfb9['id'])||[],_0x5ae023=_0x446c86[_0x1cbf12(0xf6)]>0x0?a32_0x4726a1[_0x1cbf12(0xe0)]('\x20['+_0x446c86['length']+'\x20activations]'):'';console['error']('\x0a'+a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0xef))+'\x20'+_0x11fb57+_0x5ae023),console['error']('β'[_0x1cbf12(0xfb)](0x3c));const _0x4811f9=segmentWithActivationsToYaml(_0x56dfb9,_0x446c86,undefined,_0x4f34fb,_0x4d62bb),_0x46214e=segmentToYamlString(_0x4811f9),_0x269128=generateDiff(_0x46214e,'');console[_0x1cbf12(0xc7)](formatDiffWithColors(_0x269128)),console['error']('β'['repeat'](0x3c));}const _0x3ee302=_0x525078['filter'](_0x46bd72=>!_0x46bd72['isNew']&&_0x46bd72[_0x1cbf12(0xee)]);if(_0x3ee302['length']>0x0&&!_0x44be35['journeysOnly'])for(const _0x1285de of _0x3ee302){const _0x552491=_0x1285de[_0x1cbf12(0x11c)]?_0x1285de[_0x1cbf12(0x11c)]+'/'+_0x1285de[_0x1cbf12(0xa6)]['name']:_0x1285de[_0x1cbf12(0xa6)][_0x1cbf12(0xcc)];console[_0x1cbf12(0xc7)]('\x0a'+a32_0x4726a1[_0x1cbf12(0xf0)](_0x1cbf12(0xc3))+'\x20'+_0x552491),console['error']('β'[_0x1cbf12(0xfb)](0x3c)),console[_0x1cbf12(0xc7)](_0x1285de[_0x1cbf12(0xee)]),console[_0x1cbf12(0xc7)]('β'['repeat'](0x3c));}if(_0x2a8349[_0x1cbf12(0xf6)]>0x0)for(const _0x5ab70e of _0x2a8349){const _0x42abc8=_0x5ab70e[_0x1cbf12(0x11c)]?_0x5ab70e[_0x1cbf12(0x11c)]+'/'+_0x5ab70e[_0x1cbf12(0xa6)]['name']:_0x5ab70e[_0x1cbf12(0xa6)][_0x1cbf12(0xcc)];console[_0x1cbf12(0xc7)]('\x0a'+a32_0x4726a1['green'](_0x1cbf12(0xc4))+'\x20'+_0x42abc8),console['error']('β'[_0x1cbf12(0xfb)](0x3c)),_0x5ab70e[_0x1cbf12(0xee)]&&console[_0x1cbf12(0xc7)](_0x5ab70e[_0x1cbf12(0xee)]),console[_0x1cbf12(0xc7)]('β'['repeat'](0x3c));}const _0xeb78f5=_0x302e18['filter'](_0x5e5126=>!_0x5e5126[_0x1cbf12(0xb3)]&&_0x5e5126[_0x1cbf12(0xee)]);if(_0xeb78f5[_0x1cbf12(0xf6)]>0x0)for(const _0x586b3a of _0xeb78f5){const _0x4a775c=_0x586b3a['folderPath']?_0x586b3a[_0x1cbf12(0x11c)]+'/'+_0x586b3a[_0x1cbf12(0xa6)][_0x1cbf12(0xcc)]:_0x586b3a[_0x1cbf12(0xa6)]['name'];console['error']('\x0a'+a32_0x4726a1['yellow'](_0x1cbf12(0xb1))+'\x20'+_0x4a775c),console[_0x1cbf12(0xc7)]('β'[_0x1cbf12(0xfb)](0x3c)),console[_0x1cbf12(0xc7)](_0x586b3a[_0x1cbf12(0xee)]),console[_0x1cbf12(0xc7)]('β'[_0x1cbf12(0xfb)](0x3c));}if(_0x28401b['length']>0x0)for(const _0x4a04e3 of _0x28401b){const _0x43a409=_0x4a04e3[_0x1cbf12(0x111)]?_0x452b69[_0x1cbf12(0xa1)](_0x4a04e3['folderId'])||'':'',_0x120dc5=_0x43a409?_0x43a409+'/'+_0x4a04e3[_0x1cbf12(0xd3)]:_0x4a04e3['journeyBundleName'];console[_0x1cbf12(0xc7)]('\x0a'+a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0xf7))+'\x20'+_0x120dc5),console[_0x1cbf12(0xc7)]('β'[_0x1cbf12(0xfb)](0x3c)),console['error'](a32_0x4726a1[_0x1cbf12(0x116)](_0x1cbf12(0x9b))),console['error']('β'[_0x1cbf12(0xfb)](0x3c));}if(_0x44be35[_0x1cbf12(0xa5)])return console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xf0)](_0x1cbf12(0xa9))),0x0;const _0x4cd51=_0x44be35[_0x1cbf12(0x8e)]?![]:_0x24b757[_0x1cbf12(0xf6)]>0x0||_0x468875['length']>0x0||_0x2a4f41[_0x1cbf12(0xf6)]>0x0,_0x3250eb=_0x2a8349['length']>0x0||_0x12c0e5[_0x1cbf12(0xf6)]>0x0||_0x28401b[_0x1cbf12(0xf6)]>0x0,_0x279316=_0x44be35[_0x1cbf12(0x8e)]?![]:_0x3dcbba[_0x1cbf12(0xf6)]>0x0,_0x14bddf=_0x1187ff[_0x1cbf12(0xf6)]>0x0;if(!_0x4cd51&&!_0x3250eb&&!_0x279316&&!_0x14bddf){const _0x31e2fe=_0x44be35[_0x1cbf12(0x8e)]?_0x1cbf12(0xda):_0x1cbf12(0x125);console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xde)](_0x31e2fe));if(_0x1124e1&&_0x3d594a['length']===0x1){const _0x27e8d6=_0x3d594a[0x0];if(_0x27e8d6[_0x1cbf12(0xe5)]?.['id']){const _0x48897c=getConsoleNextUrl(_0x44be35['site'],_0x1cbf12(0xd6)+_0x3e5ae0+_0x1cbf12(0xe9)+_0x27e8d6[_0x1cbf12(0xe5)]['id']+_0x1cbf12(0xaa));console[_0x1cbf12(0xc7)]('\x20\x20'+a32_0x4726a1[_0x1cbf12(0x92)](_0x48897c));}}return 0x0;}const _0x26e596=_0x44be35[_0x1cbf12(0x8e)]?_0x2a8349[_0x1cbf12(0xf6)]+_0x12c0e5[_0x1cbf12(0xf6)]+_0x28401b[_0x1cbf12(0xf6)]+_0x1187ff[_0x1cbf12(0xf6)]:_0x24b757[_0x1cbf12(0xf6)]+_0x468875['length']+_0x2a4f41['length']+_0x2a8349['length']+_0x12c0e5[_0x1cbf12(0xf6)]+_0x28401b['length']+_0x1187ff[_0x1cbf12(0xf6)]+_0x3dcbba[_0x1cbf12(0xf6)];if(!_0x44be35[_0x1cbf12(0x128)]&&_0x26e596>0x0){if(!isInteractive())return console['error'](a32_0x4726a1['red'](_0x1cbf12(0xf3)),_0x1cbf12(0xb5)),console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xe0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xa2bd60=await confirmKey('Push\x20'+_0x26e596+_0x1cbf12(0x118));if(!_0xa2bd60)return console[_0x1cbf12(0xc7)](a32_0x4726a1['yellow'](_0x1cbf12(0xbf))),0x1;}const _0x37842f={'withProgress':async(_0x1dded5,_0x9f60ae)=>{const _0x31f2c0=_0x1cbf12,_0x3df035=await withSpinner(_0x1dded5,_0x9f60ae,{'verbose':_0x44be35[_0x31f2c0(0xdb)]});return{'data':_0x3df035['data']};},'logInfo':_0x440b91=>console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x90)]('β\x20'+_0x440b91)),'logSuccess':_0x4ecddf=>console[_0x1cbf12(0xc7)](a32_0x4726a1['green']('β\x20'+_0x4ecddf)),'logWarning':_0x188502=>console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0xf0)]('β \x20'+_0x188502)),'logDeleted':_0x16db45=>console[_0x1cbf12(0xc7)](a32_0x4726a1[_0x1cbf12(0x116)]('β\x20'+_0x16db45))},_0x514383={'segment':_0x1782b6[_0x1cbf12(0x9a)],'journey':_0x1782b6[_0x1cbf12(0x104)],'user':_0x1782b6['user'],'connection':_0x1782b6[_0x1cbf12(0x100)]};_0x1187ff[_0x1cbf12(0xf6)]>0x0&&(_0x31d83e=await executePushFolders(_0x514383,_0x1187ff,_0x31d83e,{'parentId':_0x3e5ae0},_0x37842f));const _0x3db0a3={'rootFolderId':_0x1b385a,'folderPathToId':_0x31d83e,'folderIdToPath':_0x452b69,'segmentNameToId':_0x5e9218,'activationsBySegmentId':_0x25f823,'emailToIdMap':_0x199d02,'idToEmailMap':_0x4f34fb,'connectionNameToIdMap':_0x38f276[_0x1cbf12(0xb6)],'connectionIdToNameMap':_0x38f276[_0x1cbf12(0xc2)],'connectionNameToTypeMap':_0x3fbfc8},_0x16c528=await executePushSegments(_0x514383,_0x44be35[_0x1cbf12(0x8e)]?[]:_0x525078,_0x3db0a3,{'parentId':_0x3e5ae0},_0x37842f),_0x490e05=_0x16c528[_0x1cbf12(0xae)],_0x7a2e2b=_0x16c528['updated'],_0x191464=_0x16c528['activations'][_0x1cbf12(0xae)],_0x222208=_0x16c528[_0x1cbf12(0x9e)][_0x1cbf12(0xb7)],_0x3333ab=_0x16c528[_0x1cbf12(0x9e)][_0x1cbf12(0x94)],_0x3f2723=await executePushSegmentDeletions(_0x514383,_0x44be35[_0x1cbf12(0x8e)]?[]:_0x2a4f41,_0x37842f);let _0x1a8d6f=0x0,_0x34f0e0=0x0,_0x59ec23=0x0;const _0x31271c=new Map(_0x5e9218);for(const [_0x4ffa12,_0x3727d5]of _0x16c528['createdSegmentIds']){_0x31271c[_0x1cbf12(0x10b)](_0x4ffa12,_0x3727d5);}if(_0x302e18['length']>0x0){const _0x2effa4={..._0x3db0a3,'segmentNameToId':_0x31271c,'existingSegments':_0x3f04cc,'activationContext':_0x1173c4},_0x43155e=await executePushJourneys(_0x514383,_0x302e18,_0x2effa4,{'parentId':_0x3e5ae0,'rootFolderId':_0x1b385a,'verbose':_0x44be35[_0x1cbf12(0xdb)]},_0x37842f);_0x1a8d6f=_0x43155e[_0x1cbf12(0xae)],_0x34f0e0=_0x43155e[_0x1cbf12(0xb7)];if(_0x1124e1&&_0x43155e[_0x1cbf12(0xed)][_0x1cbf12(0xf6)]===0x1){const _0x2d08aa=_0x43155e[_0x1cbf12(0xed)][0x0];if(_0x2d08aa[_0x1cbf12(0x126)]){const _0x14aa93=getConsoleNextUrl(_0x44be35[_0x1cbf12(0x11b)],_0x1cbf12(0xd6)+_0x3e5ae0+_0x1cbf12(0xe9)+_0x2d08aa[_0x1cbf12(0x126)]+_0x1cbf12(0xaa));console[_0x1cbf12(0xc7)]('\x20\x20'+a32_0x4726a1[_0x1cbf12(0x92)](_0x14aa93));}}}for(const _0x318765 of _0x28401b){console['error'](a32_0x4726a1['yellow'](_0x1cbf12(0xf8)+_0x318765[_0x1cbf12(0xd3)])),_0x59ec23++;}const _0x5e0797=[];if(_0x490e05>0x0)_0x5e0797['push'](_0x490e05+_0x1cbf12(0x127));if(_0x7a2e2b>0x0)_0x5e0797[_0x1cbf12(0x12c)](_0x7a2e2b+'\x20updated');if(_0x3f2723>0x0)_0x5e0797['push'](_0x3f2723+_0x1cbf12(0x122));const _0x189f2e=[];if(_0x1a8d6f>0x0)_0x189f2e[_0x1cbf12(0x12c)](_0x1a8d6f+'\x20created');if(_0x34f0e0>0x0)_0x189f2e['push'](_0x34f0e0+'\x20updated');if(_0x59ec23>0x0)_0x189f2e[_0x1cbf12(0x12c)](_0x59ec23+_0x1cbf12(0x122));const _0x224b8b=[];if(_0x191464>0x0)_0x224b8b[_0x1cbf12(0x12c)](_0x191464+_0x1cbf12(0x127));if(_0x222208>0x0)_0x224b8b[_0x1cbf12(0x12c)](_0x222208+'\x20updated');if(_0x3333ab>0x0)_0x224b8b[_0x1cbf12(0x12c)](_0x3333ab+_0x1cbf12(0x122));return console[_0x1cbf12(0xc7)](a32_0x4726a1['green'](_0x1cbf12(0x124))),_0x5e0797[_0x1cbf12(0xf6)]>0x0&&!_0x44be35[_0x1cbf12(0x8e)]&&console[_0x1cbf12(0xc7)](_0x1cbf12(0xe3)+_0x5e0797[_0x1cbf12(0x97)](',\x20')),_0x189f2e[_0x1cbf12(0xf6)]>0x0&&console['error'](_0x1cbf12(0xa4)+_0x189f2e[_0x1cbf12(0x97)](',\x20')),_0x224b8b[_0x1cbf12(0xf6)]>0x0&&!_0x44be35[_0x1cbf12(0x8e)]&&console['error'](_0x1cbf12(0xab)+_0x224b8b['join'](',\x20')),0x0;}}
|
|
1
|
+
const a32_0x152853=a32_0x1f4b;(function(_0x279376,_0x3d6b3f){const _0x1145f9=a32_0x1f4b,_0x490644=_0x279376();while(!![]){try{const _0x4d054b=-parseInt(_0x1145f9(0x1f5))/0x1+-parseInt(_0x1145f9(0x201))/0x2*(-parseInt(_0x1145f9(0x225))/0x3)+-parseInt(_0x1145f9(0x1c9))/0x4*(-parseInt(_0x1145f9(0x23c))/0x5)+-parseInt(_0x1145f9(0x1ea))/0x6+-parseInt(_0x1145f9(0x24d))/0x7+parseInt(_0x1145f9(0x241))/0x8*(-parseInt(_0x1145f9(0x20e))/0x9)+-parseInt(_0x1145f9(0x25b))/0xa*(-parseInt(_0x1145f9(0x250))/0xb);if(_0x4d054b===_0x3d6b3f)break;else _0x490644['push'](_0x490644['shift']());}catch(_0x2b5dfa){_0x490644['push'](_0x490644['shift']());}}}(a32_0x14ee,0x211a9));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a32_0x421a67 from'chalk';import{existsSync}from'fs';function a32_0x14ee(){const _0x20b51f=['2351007NXrCKX','Parent\x20segment:\x20','journeysOnly','Error:\x20','Error\x20parsing\x20YAML:\x20','site','getOutputSchemaWithCache','Changes\x20to\x20journey:','\x20changed','\x0aPush\x20summary\x20for\x20\x27','folderId','activations','all','β\x20All\x20journeys\x20are\x20up\x20to\x20date','push','journeys','segments','\x20to\x20create','parent_name','Push\x20','\x20updated','set','\x20\x20πΊοΈ\x20\x20Journeys:','193449mrGMAH','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','segmentFolderId','\x20created','existingJourney','\x20\x20Segments:\x20','results','Delete\x20journey:','get','Fetching\x20existing\x20activations...','dim','\x20YAML\x20files\x20found','toCreate','attributes','relationships','filter','filePath','message','targetDir','journey','resolveParentId','length','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','295255tBkwNU','\x20\x20\x20\x20','scopedFolderPath','helpText','Site:\x20','8mRnZEs','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20journeys...','type','error','\x20\x20Journeys:\x20','yellow','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','idToName','Error:\x20Directory\x20not\x20found:\x20','folders','verbose','1868958kMKgOE','yamlConfig','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','1715230JeQQgb','.yaml','toUpdate','unchanged','\x20\x20Activations:','Delete\x20segment:','isNew','description','/j/da/je','cwd','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','50arPqBa','Folders\x20to\x20create:','\x0aError:','updatedAt','getJourney','New\x20journey:','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','map','parentName','\x27...','Fetching\x20existing\x20folders...','Fetching\x20users\x20for\x20email\x20resolution...','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20deleted','(Journey\x20will\x20be\x20deleted)','4tAJoDW','delete','join','nameToType','\x20unchanged','new','\x20new','no_parent','\x20\x20Source:\x20','user','cyan','toString','\x20activations]','toDelete','segment:push','segment','segment\x20or\x20journey','endsWith','data','diff','green','listFolders','repeat','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','deleted','Resolving\x20parent\x20segment\x20\x27','Preparing\x20journeys...','state','.yml','isScoped','\x20\x20Activations:\x20','Scoped\x20to\x20folder:\x20','blue','1186338ZRkcio','connection','\x20to\x20update','createdSegmentIds','then','getParent','parentFolder','journeyId','paused','changed','\x20to\x20delete','170617shuzUb','/app/ps/','updated','yes','created','nameToId','name','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x0aβ\x20Push\x20complete','errorCode','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','6HFQtpM','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','folderPath','parentSegment','journeyBundleId','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','file','/e/','Aborted.','journeyBundleName','versionNumber','red'];a32_0x14ee=function(){return _0x20b51f;};return a32_0x14ee();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a32_0x1f4b(_0xa53b98,_0x5e58fc){_0xa53b98=_0xa53b98-0x1c3;const _0x14eee8=a32_0x14ee();let _0x1f4b53=_0x14eee8[_0xa53b98];return _0x1f4b53;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a32_0x152853(0x1fb)]=a32_0x152853(0x1d7);[a32_0x152853(0x257)]=a32_0x152853(0x248);async['execute'](_0x51fbcd){const _0x2f0a54=a32_0x152853,{options:_0x6ba837,args:_0x3f398f,tdx:_0x6eed63}=_0x51fbcd,_0xbf916b=_0x6ba837,_0x2db96e=await resolveTarget({'arg':_0x3f398f[0x0],'contextParent':_0x6ba837[_0x2f0a54(0x204)],'cwd':process[_0x2f0a54(0x259)]()});if(!isSuccessfulResolution(_0x2db96e))return _0x2db96e[_0x2f0a54(0x1fe)]===_0x2f0a54(0x1d0)?(console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2f0a54(0x245)](_0x2f0a54(0x206)),console[_0x2f0a54(0x245)](_0x2f0a54(0x207)),console['error'](_0x2f0a54(0x226))):(console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x211)+_0x2db96e[_0x2f0a54(0x236)]+'\x0a')),_0x2db96e['helpText']&&console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2db96e[_0x2f0a54(0x23f)]))),0x1;if(_0x2db96e[_0x2f0a54(0x244)]===_0x2f0a54(0x220))return console['error'](a32_0x421a67['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x2db96e[_0x2f0a54(0x237)]+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67['cyan'](_0x2f0a54(0x200))),0x1;const _0x2e20fa=_0x2db96e[_0x2f0a54(0x263)],_0x70556d=_0x2db96e[_0x2f0a54(0x237)],_0x448962=_0x2db96e[_0x2f0a54(0x244)]===_0x2f0a54(0x208)?_0x2db96e[_0x2f0a54(0x235)]:undefined,_0x4e0c39=getScopedDetails(_0x2db96e),_0xc70983=_0x4e0c39?.[_0x2f0a54(0x1e6)]??![],_0x2db919=_0x4e0c39?.[_0x2f0a54(0x23e)]??'';if(!existsSync(_0x70556d))return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x24a)+_0x70556d+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2f0a54(0x200))),0x1;_0xbf916b[_0x2f0a54(0x24c)]&&(console[_0x2f0a54(0x245)](_0x2f0a54(0x240)+_0xbf916b[_0x2f0a54(0x213)]),console[_0x2f0a54(0x245)](_0x2f0a54(0x20f)+_0x2e20fa),console[_0x2f0a54(0x245)]('Source\x20directory:\x20'+_0x70556d),_0xc70983&&console[_0x2f0a54(0x245)](_0x2f0a54(0x1e8)+_0x2db919));const _0x13d6a2=await withSpinner(_0x2f0a54(0x1e2)+_0x2e20fa+_0x2f0a54(0x1c3),()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x239)](_0x2e20fa),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),_0x3783df=_0x13d6a2[_0x2f0a54(0x1db)],[_0x14817a,_0xdd89c7,_0x2d5ea5,_0x5291de,_0x25b610]=await Promise[_0x2f0a54(0x21a)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x1ef)](_0x3783df),{'verbose':_0xbf916b['verbose']}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x6eed63[_0x2f0a54(0x1d8)]['listSegments'](_0x3783df),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x1c4),()=>_0x6eed63[_0x2f0a54(0x1d8)][_0x2f0a54(0x1de)](_0x3783df),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x243),()=>_0x6eed63[_0x2f0a54(0x238)]['listJourneysWithDetailsFromParentSegment'](_0x3783df,{'includeAllVersions':!![]}),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]}),withSpinner(_0x2f0a54(0x1c5),()=>_0x6eed63['user']['buildUserMaps'](),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x44e2fa=>_0x44e2fa[_0x2f0a54(0x1db)])]),_0x257e22=_0x14817a['data'],_0x13ad2d=extractRootFolderId(_0x257e22),_0x4c07c0=_0xdd89c7[_0x2f0a54(0x1db)],_0x42d82f=_0x2d5ea5[_0x2f0a54(0x1db)],{journeys:_0x258c1a,activationStepsById:_0x274568}=_0x5291de['data'],_0x244a9b=new Map(_0x258c1a[_0x2f0a54(0x262)](_0x1e5b66=>[_0x1e5b66['id'],_0x1e5b66])),_0x16dbee=_0x258c1a[_0x2f0a54(0x262)](_0x9cc09f=>({'id':_0x9cc09f['id'],'name':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x1fb)],'journeyBundleName':_0x9cc09f[_0x2f0a54(0x232)]['journeyBundleName']||'','journeyBundleId':_0x9cc09f['attributes'][_0x2f0a54(0x205)]||'','versionNumber':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x20c)],'description':_0x9cc09f['attributes']['description'],'state':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x1e4)],'paused':_0x9cc09f['attributes'][_0x2f0a54(0x1f2)],'audienceId':_0x9cc09f[_0x2f0a54(0x232)]['audienceId'],'folderId':_0x9cc09f[_0x2f0a54(0x233)]?.[_0x2f0a54(0x1f0)]?.[_0x2f0a54(0x1db)]?.['id'],'createdAt':_0x9cc09f[_0x2f0a54(0x232)]['createdAt'],'updatedAt':_0x9cc09f[_0x2f0a54(0x232)][_0x2f0a54(0x25e)]})),{emailToId:_0x358cb8,idToEmail:_0x139d27}=_0x25b610,_0x26cc8a=await withSpinner(_0x2f0a54(0x242),async()=>{const _0x3bfb32=_0x2f0a54,_0x3888d3=await _0x6eed63[_0x3bfb32(0x1eb)]['list']();return buildConnectionMaps(_0x3888d3);},{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x3e7961=>_0x3e7961[_0x2f0a54(0x1db)]),_0x48686f=_0x26cc8a[_0x2f0a54(0x1fa)],_0x58de3d=_0x26cc8a[_0x2f0a54(0x249)],_0x3f2934=_0x26cc8a[_0x2f0a54(0x1cc)],_0x297469={'emailToIdMap':_0x358cb8,'connectionNameToIdMap':_0x48686f,'connectionNameToTypeMap':_0x3f2934,'getSchema':_0x5bb979=>_0x6eed63[_0x2f0a54(0x1eb)][_0x2f0a54(0x214)](_0x5bb979)};let {pathToId:_0x3d72e2,idToPath:_0x5b2dee}=buildFolderMaps(_0x42d82f);const _0x106573=buildSegmentLookupMap(_0x4c07c0,_0x5b2dee),_0x58d1cd=buildSegmentNameToIdMap(_0x4c07c0),_0x58f861=buildJourneyBundleLookupMap(_0x16dbee,_0x5b2dee);let _0x263ab3;if(_0x448962){if(!_0x448962[_0x2f0a54(0x1da)](_0x2f0a54(0x1e5))&&!_0x448962[_0x2f0a54(0x1da)](_0x2f0a54(0x251)))return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x202)+_0x448962+'\x0a')),0x1;_0x263ab3=[_0x448962];}else _0x263ab3=findYamlFiles(_0x70556d);if(_0x263ab3[_0x2f0a54(0x23a)]===0x0)return console['error'](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x1ff)+_0x70556d+'\x0a')),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1d3)](_0x2f0a54(0x261))),0x1;let _0x177542,_0x29d7a6;try{const _0x45571f=parseAndClassifyYamlFiles(_0x263ab3,_0x70556d,{'skipSegments':_0xbf916b[_0x2f0a54(0x210)]});_0x177542=_0x45571f[_0x2f0a54(0x21e)],_0x29d7a6=_0x45571f[_0x2f0a54(0x21d)];const _0x218857=validateParsedFiles(_0x45571f,_0x70556d);if(_0x218857[_0x2f0a54(0x23a)]>0x0)return console['error'](a32_0x421a67['red']('\x0aValidation\x20failed:')),console[_0x2f0a54(0x245)](formatValidationErrors(_0x218857)),console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x23b))),0x1;}catch(_0x22416a){return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x212)+(_0x22416a instanceof Error?_0x22416a['message']:_0x22416a))),0x1;}if(_0x177542[_0x2f0a54(0x23a)]===0x0&&_0x29d7a6[_0x2f0a54(0x23a)]===0x0){const _0x227b74=_0xbf916b[_0x2f0a54(0x210)]?'journey':_0x2f0a54(0x1d9);return console['error'](a32_0x421a67[_0x2f0a54(0x247)]('No\x20'+_0x227b74+_0x2f0a54(0x230))),0x0;}const _0x141952=new Map();_0x4c07c0[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&await withSpinner(_0x2f0a54(0x22e),async()=>{await batchAsync(_0x4c07c0,async _0x4d11e9=>{const _0xc4f47=a32_0x1f4b,_0x455949=await _0x6eed63[_0xc4f47(0x1d8)]['listActivations'](_0x3783df,_0x4d11e9['id']);_0x141952[_0xc4f47(0x223)](_0x4d11e9['id'],_0x455949);});},{'verbose':_0xbf916b[_0x2f0a54(0x24c)]});const {segmentFiles:_0x5a6323,foldersToCreate:_0x1aa5a2}=await prepareSegmentFiles(_0x177542,{'segmentByFolderAndName':_0x106573,'activationsBySegmentId':_0x141952,'folderPathToId':_0x3d72e2,'idToEmailMap':_0x139d27,'connectionIdToNameMap':_0x58de3d},_0x297469,_0xc70983,_0x2db919),_0x4729bd=_0x448962?[]:findSegmentsToDelete(_0x4c07c0,_0x177542[_0x2f0a54(0x262)](({yamlConfig:_0x229d09,folderPath:_0x2a03ba})=>({'yamlConfig':_0x229d09,'folderPath':resolveTDFolderPath(_0x2a03ba,_0xc70983,_0x2db919)})),_0x5b2dee,_0x2db919,_0xc70983),{journeyFiles:_0x1962f8,foldersToCreate:_0x36bfef}=await withProgressSpinner(_0x2f0a54(0x1e3),async _0x48a7a0=>prepareJourneyFiles(_0x29d7a6,{'fetchJourney':async _0x3d92c1=>_0x6eed63[_0x2f0a54(0x238)][_0x2f0a54(0x25f)](_0x3d92c1[_0x2f0a54(0x1f1)]),'journeyBundlesByFolderAndName':_0x58f861,'folderPathToId':_0x3d72e2,'idToEmailMap':_0x139d27,'connectionIdToNameMap':_0x58de3d,'existingSegments':_0x4c07c0,'parentId':_0x3783df,'deps':_0x6eed63,'progress':{'update':_0x2f9d9a=>{const _0x47cd7f=_0x2f0a54;_0x48a7a0['setPhase'](_0x2f9d9a),_0xbf916b[_0x47cd7f(0x24c)]&&console['error']('\x20\x20'+_0x2f9d9a);}},'journeyById':_0x244a9b,'activationStepsById':_0x274568},_0xc70983,_0x2db919),{'verbose':_0xbf916b[_0x2f0a54(0x24c)]})[_0x2f0a54(0x1ee)](_0x3a5ae6=>_0x3a5ae6[_0x2f0a54(0x1db)]);for(const _0x2f84d2 of _0x36bfef){_0x1aa5a2['add'](_0x2f84d2);}const _0x2bba8d=_0x448962?[]:findJourneysToDelete(_0x16dbee,_0x29d7a6['map'](({yamlConfig:_0x64073d,folderPath:_0x26647e})=>({'yamlConfig':_0x64073d,'folderPath':resolveTDFolderPath(_0x26647e,_0xc70983,_0x2db919)})),_0x5b2dee,_0x2db919,_0xc70983),_0x33df12=calculatePushStats(_0x5a6323,_0x1962f8,_0x1aa5a2,_0x4729bd,_0x2bba8d,!!_0xbf916b[_0x2f0a54(0x1ca)],!!_0xbf916b['journeysOnly']),_0x322d3a=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x1ce)],_0x580d09=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x1f3)],_0x40bf3d=_0x33df12[_0x2f0a54(0x21e)][_0x2f0a54(0x253)],_0x2c47f1=_0x33df12['segments'][_0x2f0a54(0x1d6)],_0x3dde5b=_0x33df12[_0x2f0a54(0x24b)][_0x2f0a54(0x231)],_0x479522=_0x33df12['journeys'][_0x2f0a54(0x1ce)],_0x1bc221=_0x33df12['journeys']['changed'],_0x593a4c=_0x33df12[_0x2f0a54(0x21d)][_0x2f0a54(0x253)],_0x4d7cfa=_0x33df12[_0x2f0a54(0x21d)][_0x2f0a54(0x1d6)],_0x34b0a3=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x21a)],_0x12f8a2=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x231)],_0x44447d=_0x33df12[_0x2f0a54(0x219)][_0x2f0a54(0x252)],_0xc28877=_0x33df12['activations'][_0x2f0a54(0x1d6)];console['error'](_0x2f0a54(0x217)+_0x2e20fa+'\x27:');_0x3dde5b[_0x2f0a54(0x23a)]>0x0&&console['error']('\x20\x20'+a32_0x421a67[_0x2f0a54(0x1e9)]('π\x20'+_0x3dde5b[_0x2f0a54(0x23a)]+'\x20folders\x20to\x20create'));if(!_0xbf916b[_0x2f0a54(0x210)]){console[_0x2f0a54(0x245)]('\x20\x20π\x20Segments:'),console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x1dd)]('+\x20'+_0x322d3a[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cf))),console[_0x2f0a54(0x245)]('\x20\x20\x20\x20'+a32_0x421a67['yellow']('~\x20'+_0x580d09['length']+_0x2f0a54(0x216)));if(_0x2c47f1[_0x2f0a54(0x23a)]>0x0)console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['red']('-\x20'+_0x2c47f1[_0x2f0a54(0x23a)]+_0x2f0a54(0x1f4)));else _0x4729bd['length']>0x0&&!_0xbf916b[_0x2f0a54(0x1ca)]&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x22f)](_0x4729bd['length']+_0x2f0a54(0x1fc)));console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x22f)]('=\x20'+_0x40bf3d[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cd)));}if(_0x1962f8['length']>0x0||_0x2bba8d[_0x2f0a54(0x23a)]>0x0){console[_0x2f0a54(0x245)](_0x2f0a54(0x224)),console['error'](_0x2f0a54(0x23d)+a32_0x421a67['green']('+\x20'+_0x479522[_0x2f0a54(0x23a)]+'\x20new')),console[_0x2f0a54(0x245)]('\x20\x20\x20\x20'+a32_0x421a67[_0x2f0a54(0x247)]('~\x20'+_0x1bc221[_0x2f0a54(0x23a)]+_0x2f0a54(0x216)));if(_0x4d7cfa[_0x2f0a54(0x23a)]>0x0)console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x20d)]('-\x20'+_0x4d7cfa['length']+_0x2f0a54(0x1f4)));else _0x2bba8d[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x1ca)]&&console['error'](_0x2f0a54(0x23d)+a32_0x421a67['dim'](_0x2bba8d['length']+_0x2f0a54(0x1fc)));console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['dim']('=\x20'+_0x593a4c[_0x2f0a54(0x23a)]+_0x2f0a54(0x1cd)));}_0x34b0a3['length']>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&(console[_0x2f0a54(0x245)](''),console[_0x2f0a54(0x245)](_0x2f0a54(0x254)),_0x12f8a2['length']>0x0&&console['error'](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x1dd)]('+\x20'+_0x12f8a2[_0x2f0a54(0x23a)]+_0x2f0a54(0x21f))),_0x44447d[_0x2f0a54(0x23a)]>0x0&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67['yellow']('~\x20'+_0x44447d[_0x2f0a54(0x23a)]+_0x2f0a54(0x1ec))),_0xc28877[_0x2f0a54(0x23a)]>0x0&&console[_0x2f0a54(0x245)](_0x2f0a54(0x23d)+a32_0x421a67[_0x2f0a54(0x20d)]('-\x20'+_0xc28877['length']+'\x20to\x20delete')));console['error'](_0x2f0a54(0x1d1)+a32_0x421a67[_0x2f0a54(0x1d3)](_0x70556d)+'\x0a');if(_0x3dde5b[_0x2f0a54(0x23a)]>0x0){console[_0x2f0a54(0x245)](_0x2f0a54(0x25c));for(const _0x415ecd of _0x3dde5b){console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['blue']('+')+'\x20'+_0x415ecd);}console[_0x2f0a54(0x245)]('');}if(_0x322d3a[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0x1ba93b of _0x322d3a){const _0x3d9d3d=_0x1ba93b['folderPath']?_0x1ba93b[_0x2f0a54(0x203)]+'/'+_0x1ba93b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)]:_0x1ba93b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)],_0x116be9=_0x1ba93b['yamlConfig']['activations']?.[_0x2f0a54(0x23a)]||0x0,_0x7aba39=_0x116be9>0x0?a32_0x421a67[_0x2f0a54(0x22f)]('\x20['+_0x116be9+'\x20activations]'):'';console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x1dd)]('New\x20segment:')+'\x20'+_0x3d9d3d+_0x7aba39),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),_0x1ba93b[_0x2f0a54(0x1dc)]&&console[_0x2f0a54(0x245)](_0x1ba93b['diff']),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x2c47f1[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0xda1710 of _0x2c47f1){const _0x2187e4=_0xda1710[_0x2f0a54(0x227)]?_0x5b2dee[_0x2f0a54(0x22d)](_0xda1710[_0x2f0a54(0x227)][_0x2f0a54(0x1d4)]())||'':'',_0x116b69=_0x2187e4?_0x2187e4+'/'+_0xda1710[_0x2f0a54(0x1fb)]:_0xda1710[_0x2f0a54(0x1fb)],_0x577657=_0x141952[_0x2f0a54(0x22d)](_0xda1710['id'])||[],_0x47e18e=_0x577657[_0x2f0a54(0x23a)]>0x0?a32_0x421a67[_0x2f0a54(0x22f)]('\x20['+_0x577657[_0x2f0a54(0x23a)]+_0x2f0a54(0x1d5)):'';console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x255))+'\x20'+_0x116b69+_0x47e18e),console['error']('β'['repeat'](0x3c));const _0x129bdd=segmentWithActivationsToYaml(_0xda1710,_0x577657,undefined,_0x139d27,_0x58de3d),_0x550958=segmentToYamlString(_0x129bdd),_0x59382b=generateDiff(_0x550958,'');console[_0x2f0a54(0x245)](formatDiffWithColors(_0x59382b)),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}const _0x329c28=_0x5a6323[_0x2f0a54(0x234)](_0x1e8bf2=>!_0x1e8bf2['isNew']&&_0x1e8bf2['diff']);if(_0x329c28['length']>0x0&&!_0xbf916b[_0x2f0a54(0x210)])for(const _0x263c6b of _0x329c28){const _0x121766=_0x263c6b['folderPath']?_0x263c6b['folderPath']+'/'+_0x263c6b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)]:_0x263c6b[_0x2f0a54(0x24e)][_0x2f0a54(0x1fb)];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67['yellow']('Changes\x20to:')+'\x20'+_0x121766),console['error']('β'[_0x2f0a54(0x1df)](0x3c)),console[_0x2f0a54(0x245)](_0x263c6b['diff']),console['error']('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x479522[_0x2f0a54(0x23a)]>0x0)for(const _0x263b7e of _0x479522){const _0x26b841=_0x263b7e[_0x2f0a54(0x203)]?_0x263b7e[_0x2f0a54(0x203)]+'/'+_0x263b7e[_0x2f0a54(0x24e)]['name']:_0x263b7e[_0x2f0a54(0x24e)]['name'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x1dd)](_0x2f0a54(0x260))+'\x20'+_0x26b841),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),_0x263b7e[_0x2f0a54(0x1dc)]&&console[_0x2f0a54(0x245)](_0x263b7e[_0x2f0a54(0x1dc)]),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}const _0x405924=_0x1962f8[_0x2f0a54(0x234)](_0x2c2938=>!_0x2c2938[_0x2f0a54(0x256)]&&_0x2c2938[_0x2f0a54(0x1dc)]);if(_0x405924[_0x2f0a54(0x23a)]>0x0)for(const _0x39fd1d of _0x405924){const _0x2bdfb7=_0x39fd1d[_0x2f0a54(0x203)]?_0x39fd1d[_0x2f0a54(0x203)]+'/'+_0x39fd1d['yamlConfig'][_0x2f0a54(0x1fb)]:_0x39fd1d[_0x2f0a54(0x24e)]['name'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x215))+'\x20'+_0x2bdfb7),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),console[_0x2f0a54(0x245)](_0x39fd1d[_0x2f0a54(0x1dc)]),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c));}if(_0x4d7cfa[_0x2f0a54(0x23a)]>0x0)for(const _0x2cf705 of _0x4d7cfa){const _0x553cda=_0x2cf705[_0x2f0a54(0x218)]?_0x5b2dee[_0x2f0a54(0x22d)](_0x2cf705[_0x2f0a54(0x218)])||'':'',_0x21cb05=_0x553cda?_0x553cda+'/'+_0x2cf705['journeyBundleName']:_0x2cf705['journeyBundleName'];console[_0x2f0a54(0x245)]('\x0a'+a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x22c))+'\x20'+_0x21cb05),console[_0x2f0a54(0x245)]('β'[_0x2f0a54(0x1df)](0x3c)),console['error'](a32_0x421a67['red'](_0x2f0a54(0x1c8))),console['error']('β'[_0x2f0a54(0x1df)](0x3c));}if(_0xbf916b['dryRun'])return console['error'](a32_0x421a67[_0x2f0a54(0x247)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x49ed17=_0xbf916b[_0x2f0a54(0x210)]?![]:_0x322d3a[_0x2f0a54(0x23a)]>0x0||_0x580d09['length']>0x0||_0x2c47f1[_0x2f0a54(0x23a)]>0x0,_0xe8fbe4=_0x479522['length']>0x0||_0x1bc221['length']>0x0||_0x4d7cfa[_0x2f0a54(0x23a)]>0x0,_0x29b5a7=_0xbf916b[_0x2f0a54(0x210)]?![]:_0x34b0a3[_0x2f0a54(0x23a)]>0x0,_0x15d3ec=_0x3dde5b[_0x2f0a54(0x23a)]>0x0;if(!_0x49ed17&&!_0xe8fbe4&&!_0x29b5a7&&!_0x15d3ec){const _0x35b991=_0xbf916b[_0x2f0a54(0x210)]?_0x2f0a54(0x21b):_0x2f0a54(0x1e0);console[_0x2f0a54(0x245)](a32_0x421a67['green'](_0x35b991));if(_0x448962&&_0x593a4c[_0x2f0a54(0x23a)]===0x1){const _0x124e04=_0x593a4c[0x0];if(_0x124e04[_0x2f0a54(0x229)]?.['id']){const _0x36f580=getConsoleNextUrl(_0xbf916b[_0x2f0a54(0x213)],_0x2f0a54(0x1f6)+_0x3783df+_0x2f0a54(0x209)+_0x124e04[_0x2f0a54(0x229)]['id']+'/j/da/je');console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['cyan'](_0x36f580));}}return 0x0;}const _0xa28719=_0xbf916b[_0x2f0a54(0x210)]?_0x479522[_0x2f0a54(0x23a)]+_0x1bc221['length']+_0x4d7cfa['length']+_0x3dde5b['length']:_0x322d3a['length']+_0x580d09['length']+_0x2c47f1[_0x2f0a54(0x23a)]+_0x479522[_0x2f0a54(0x23a)]+_0x1bc221['length']+_0x4d7cfa[_0x2f0a54(0x23a)]+_0x3dde5b[_0x2f0a54(0x23a)]+_0x34b0a3[_0x2f0a54(0x23a)];if(!_0xbf916b[_0x2f0a54(0x1f8)]&&_0xa28719>0x0){if(!isInteractive())return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)](_0x2f0a54(0x25d)),_0x2f0a54(0x25a)),console['error'](a32_0x421a67[_0x2f0a54(0x22f)](_0x2f0a54(0x24f))),0x1;const _0xaa86cf=await confirmKey(_0x2f0a54(0x221)+_0xa28719+'\x20changes?');if(!_0xaa86cf)return console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x20a))),0x1;}const _0x10b012={'withProgress':async(_0x3d3dbb,_0x4334d1)=>{const _0x1dab3b=_0x2f0a54,_0x7ac588=await withSpinner(_0x3d3dbb,_0x4334d1,{'verbose':_0xbf916b[_0x1dab3b(0x24c)]});return{'data':_0x7ac588[_0x1dab3b(0x1db)]};},'logInfo':_0x3478e8=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x1e9)]('β\x20'+_0x3478e8)),'logSuccess':_0x347161=>console[_0x2f0a54(0x245)](a32_0x421a67['green']('β\x20'+_0x347161)),'logWarning':_0x466d34=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x247)]('β \x20'+_0x466d34)),'logDeleted':_0x38cf5b=>console[_0x2f0a54(0x245)](a32_0x421a67[_0x2f0a54(0x20d)]('β\x20'+_0x38cf5b))},_0x1200c9={'segment':_0x6eed63[_0x2f0a54(0x1d8)],'journey':_0x6eed63[_0x2f0a54(0x238)],'user':_0x6eed63[_0x2f0a54(0x1d2)],'connection':_0x6eed63[_0x2f0a54(0x1eb)]};_0x3dde5b[_0x2f0a54(0x23a)]>0x0&&(_0x3d72e2=await executePushFolders(_0x1200c9,_0x3dde5b,_0x3d72e2,{'parentId':_0x3783df},_0x10b012));const _0x3e5c93={'rootFolderId':_0x13ad2d,'folderPathToId':_0x3d72e2,'folderIdToPath':_0x5b2dee,'segmentNameToId':_0x58d1cd,'activationsBySegmentId':_0x141952,'emailToIdMap':_0x358cb8,'idToEmailMap':_0x139d27,'connectionNameToIdMap':_0x26cc8a['nameToId'],'connectionIdToNameMap':_0x26cc8a['idToName'],'connectionNameToTypeMap':_0x3f2934},_0x40977f=await executePushSegments(_0x1200c9,_0xbf916b[_0x2f0a54(0x210)]?[]:_0x5a6323,_0x3e5c93,{'parentId':_0x3783df},_0x10b012),_0x193770=_0x40977f['created'],_0x1c3561=_0x40977f[_0x2f0a54(0x1f7)],_0x230ca1=_0x40977f['activations'][_0x2f0a54(0x1f9)],_0x439d5d=_0x40977f[_0x2f0a54(0x219)][_0x2f0a54(0x1f7)],_0x3198a4=_0x40977f['activations'][_0x2f0a54(0x1e1)],_0x16ac97=await executePushSegmentDeletions(_0x1200c9,_0xbf916b['journeysOnly']?[]:_0x2c47f1,_0x10b012);let _0xf21c99=0x0,_0x3a3336=0x0,_0x1d7bb0=0x0;const _0x51f888=new Map(_0x58d1cd);for(const [_0x369e53,_0x3dee57]of _0x40977f[_0x2f0a54(0x1ed)]){_0x51f888[_0x2f0a54(0x223)](_0x369e53,_0x3dee57);}if(_0x1962f8[_0x2f0a54(0x23a)]>0x0){const _0x11c19e={..._0x3e5c93,'segmentNameToId':_0x51f888,'existingSegments':_0x4c07c0,'activationContext':_0x297469},_0x24b7ee=await executePushJourneys(_0x1200c9,_0x1962f8,_0x11c19e,{'parentId':_0x3783df,'rootFolderId':_0x13ad2d,'verbose':_0xbf916b[_0x2f0a54(0x24c)]},_0x10b012);_0xf21c99=_0x24b7ee[_0x2f0a54(0x1f9)],_0x3a3336=_0x24b7ee[_0x2f0a54(0x1f7)];if(_0x448962&&_0x24b7ee[_0x2f0a54(0x22b)][_0x2f0a54(0x23a)]===0x1){const _0x2a40bc=_0x24b7ee[_0x2f0a54(0x22b)][0x0];if(_0x2a40bc[_0x2f0a54(0x1f1)]){const _0x32b764=getConsoleNextUrl(_0xbf916b[_0x2f0a54(0x213)],_0x2f0a54(0x1f6)+_0x3783df+'/e/'+_0x2a40bc[_0x2f0a54(0x1f1)]+_0x2f0a54(0x258));console[_0x2f0a54(0x245)]('\x20\x20'+a32_0x421a67['cyan'](_0x32b764));}}}for(const _0x4fd6b9 of _0x4d7cfa){console['error'](a32_0x421a67[_0x2f0a54(0x247)](_0x2f0a54(0x1c6)+_0x4fd6b9[_0x2f0a54(0x20b)])),_0x1d7bb0++;}const _0x1df0da=[];if(_0x193770>0x0)_0x1df0da[_0x2f0a54(0x21c)](_0x193770+_0x2f0a54(0x228));if(_0x1c3561>0x0)_0x1df0da['push'](_0x1c3561+_0x2f0a54(0x222));if(_0x16ac97>0x0)_0x1df0da[_0x2f0a54(0x21c)](_0x16ac97+_0x2f0a54(0x1c7));const _0x5d47ff=[];if(_0xf21c99>0x0)_0x5d47ff[_0x2f0a54(0x21c)](_0xf21c99+_0x2f0a54(0x228));if(_0x3a3336>0x0)_0x5d47ff['push'](_0x3a3336+_0x2f0a54(0x222));if(_0x1d7bb0>0x0)_0x5d47ff[_0x2f0a54(0x21c)](_0x1d7bb0+_0x2f0a54(0x1c7));const _0x3aefed=[];if(_0x230ca1>0x0)_0x3aefed[_0x2f0a54(0x21c)](_0x230ca1+_0x2f0a54(0x228));if(_0x439d5d>0x0)_0x3aefed[_0x2f0a54(0x21c)](_0x439d5d+'\x20updated');if(_0x3198a4>0x0)_0x3aefed['push'](_0x3198a4+_0x2f0a54(0x1c7));return console['error'](a32_0x421a67[_0x2f0a54(0x1dd)](_0x2f0a54(0x1fd))),_0x1df0da[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b['journeysOnly']&&console[_0x2f0a54(0x245)](_0x2f0a54(0x22a)+_0x1df0da[_0x2f0a54(0x1cb)](',\x20')),_0x5d47ff[_0x2f0a54(0x23a)]>0x0&&console['error'](_0x2f0a54(0x246)+_0x5d47ff[_0x2f0a54(0x1cb)](',\x20')),_0x3aefed[_0x2f0a54(0x23a)]>0x0&&!_0xbf916b[_0x2f0a54(0x210)]&&console[_0x2f0a54(0x245)](_0x2f0a54(0x1e7)+_0x3aefed['join'](',\x20')),0x0;}}
|