@treasuredata/tdx 0.26.6 β 0.26.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.d.ts.map +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/job-command.js.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +14 -37
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +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/agent/tool-target-registry.d.ts +82 -0
- package/dist/sdk/agent/tool-target-registry.d.ts.map +1 -0
- package/dist/sdk/agent/tool-target-registry.js +1 -0
- package/dist/sdk/agent/tool-target-registry.js.map +1 -0
- package/dist/sdk/agent/types/agent-def.d.ts +3 -2
- package/dist/sdk/agent/types/agent-def.d.ts.map +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.d.ts +20 -0
- package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js.map +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.d.ts +2 -2
- package/dist/sdk/client/td-api-client.d.ts.map +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/td-api-client.js.map +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.d.ts +1 -1
- package/dist/sdk/job.d.ts.map +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/job.js.map +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.d.ts.map +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/index.js.map +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0xea0ac0=a26_0x1f9f;(function(_0x221d78,_0x5286ce){const _0x2b396a=a26_0x1f9f,_0x58bdfb=_0x221d78();while(!![]){try{const _0x2cd6f0=-parseInt(_0x2b396a(0x196))/0x1+parseInt(_0x2b396a(0x1a6))/0x2+-parseInt(_0x2b396a(0x18c))/0x3+-parseInt(_0x2b396a(0x125))/0x4+parseInt(_0x2b396a(0x176))/0x5*(-parseInt(_0x2b396a(0x15d))/0x6)+-parseInt(_0x2b396a(0x138))/0x7+parseInt(_0x2b396a(0x145))/0x8;if(_0x2cd6f0===_0x5286ce)break;else _0x58bdfb['push'](_0x58bdfb['shift']());}catch(_0x3f81f8){_0x58bdfb['push'](_0x58bdfb['shift']());}}}(a26_0x390a,0xbcb1d));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 a26_0x1f9f(_0x450795,_0x3c926a){_0x450795=_0x450795-0x123;const _0x390a09=a26_0x390a();let _0x1f9fb3=_0x390a09[_0x450795];return _0x1f9fb3;}function a26_0x390a(){const _0x58300c=['\x20\x20Database:\x20','Getting\x20schedule\x20history...','abs','engineVersion','Listing\x20scheduled\x20queries...','from','Query\x20file\x20is\x20empty','Schedule\x20updated:\x20','2093056aICtQP','schedule:update','length','Schedule\x20deleted:\x20','Running\x20schedule:\x20','success','getTime','has_next_page','\x20(showing\x20','description','1328584QtNFrB','tsv','statusIcon','map','utf-8','keys','list','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','user','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','retryLimit','\x20execution','queries','delay','trim','database','Creating\x20schedule...','user_name','10760799gqlPdc','Run\x20a\x20scheduled\x20query\x20immediately','engine_version','h\x20ago','Schedule\x20run\x20submitted:\x20','name','just\x20now','Create\x20a\x20scheduled\x20query','result','pagination','retry_limit','No\x20scheduled\x20queries\x20found','schedules','29650680ZqrsXM','last_job','\x20\x20Job\x20ID:\x20','substring','end_at','toLocaleDateString','\x20\x20Num:\x20','Update\x20a\x20scheduled\x20query','created_at','Found\x20','red','scheduled_at','schedule:history','output','/app/queries/editor?queryId=','error','ended_at','status','yes','timezone','round','create','in\x20','Show\x20schedule\x20execution\x20history','1689852CvNXaV','\x20\x20β\x20','\x20\x20Timezone:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','max','jsonl','data','run','type','schedule:delete','\x20matching\x20\x22','count','update','lastRun','INVALID_ARGUMENT','d\x20ago','schedule:create','Creating\x20schedule:\x20','nextRun','Deleting\x20schedule...','green','Failed\x20to\x20read\x20file:\x20','jobs','cyan','Schedule\x20created:\x20','5gMnAYh','site','schedule:run','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','history','time_zone','repeat','job_id','cron','Getting\x20schedule\x20details...','padEnd','priority','\x20job','next_run_at','validate','query','executing_user_id','Delete\x20a\x20scheduled\x20query','file','verbose','Running\x20schedule...','execute','1134660lPPPRD','num','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','never','format','entries','dim','\x20\x20Type:\x20','m\x20ago','delete','1450705izmAdg','...','updated_at','\x20\x20Time:\x20','args','table','limit','soon'];a26_0x390a=function(){return _0x58300c;};return a26_0x390a();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x4bf6cd from'chalk';function formatRelativeTime(_0x39bfd4){const _0x553578=a26_0x1f9f,_0x219cfe=new Date(_0x39bfd4),_0x5b8bf3=new Date(),_0x1883dc=_0x219cfe['getTime']()-_0x5b8bf3[_0x553578(0x1ac)](),_0x45e5aa=Math[_0x553578(0x1a0)](_0x1883dc)/0x3e8,_0x4babca=_0x1883dc<0x0;if(_0x45e5aa<0x3c)return _0x4babca?_0x553578(0x13e):_0x553578(0x19d);else{if(_0x45e5aa<0xe10){const _0x2b2a4e=Math[_0x553578(0x159)](_0x45e5aa/0x3c);return _0x4babca?_0x2b2a4e+_0x553578(0x194):_0x553578(0x15b)+_0x2b2a4e+'m';}else{if(_0x45e5aa<0x15180){const _0x3c9b2e=Math[_0x553578(0x159)](_0x45e5aa/0xe10);return _0x4babca?_0x3c9b2e+_0x553578(0x13b):_0x553578(0x15b)+_0x3c9b2e+'h';}else{if(_0x45e5aa<0x93a80){const _0x390e2c=Math[_0x553578(0x159)](_0x45e5aa/0x15180);return _0x4babca?_0x390e2c+_0x553578(0x16c):_0x553578(0x15b)+_0x390e2c+'d';}else return _0x219cfe[_0x553578(0x14a)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]='schedule:list';[a26_0xea0ac0(0x124)]='List\x20scheduled\x20queries';async['execute'](_0x25cc4d){const _0x446be2=a26_0xea0ac0,{options:_0x3d7502,args:_0x1467bf,tdx:_0x4bcc7b}=_0x25cc4d,_0x4bf2c7=resolveLimit(_0x3d7502[_0x446be2(0x19c)],DEFAULT_DISPLAY_LIMIT),_0x194fe=_0x1467bf[0x0],_0x40b2fd=_0x194fe?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x194fe+'\x22...':_0x446be2(0x1a2),_0x520b9e=await withSpinner(_0x40b2fd,()=>_0x4bcc7b[_0x446be2(0x144)]['listQueries']({'limit':_0x4bf2c7,'scheduled':!![],'pattern':_0x194fe}),{'verbose':_0x3d7502['verbose']}),_0x268571=_0x520b9e[_0x446be2(0x163)][_0x446be2(0x132)],_0x489268=_0x520b9e['data'][_0x446be2(0x141)][_0x446be2(0x1ad)],_0x4849f2=_0x194fe?_0x446be2(0x167)+_0x194fe+'\x22':'';_0x489268?console[_0x446be2(0x154)]('Showing\x20first\x20'+_0x268571[_0x446be2(0x1a8)]+'\x20schedules'+_0x4849f2+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x446be2(0x154)]('Found\x20'+_0x268571[_0x446be2(0x1a8)]+'\x20scheduled\x20quer'+(_0x268571[_0x446be2(0x1a8)]!==0x1?'ies':'y')+_0x4849f2);if(_0x3d7502[_0x446be2(0x190)]==='json'||_0x3d7502[_0x446be2(0x190)]===_0x446be2(0x162)||_0x3d7502[_0x446be2(0x190)]===_0x446be2(0x19b)||_0x3d7502[_0x446be2(0x190)]===_0x446be2(0x126)){const _0x6f24fd=_0x268571[_0x446be2(0x128)](_0x54d128=>({'id':_0x54d128['id'],'name':_0x54d128[_0x446be2(0x13d)],'cron':_0x54d128['cron'],'database':_0x54d128[_0x446be2(0x135)]?.['name'],'type':_0x54d128[_0x446be2(0x165)],'timezone':_0x54d128[_0x446be2(0x17b)],'user_name':_0x54d128[_0x446be2(0x12d)]?.['name'],'updated_at':_0x54d128[_0x446be2(0x198)],'next_run_at':_0x54d128[_0x446be2(0x183)],'last_job_status':_0x54d128[_0x446be2(0x146)]?.['status']}));await handleSDKOutput(_0x6f24fd,_0x3d7502);}else{if(_0x268571[_0x446be2(0x1a8)]===0x0)console['log'](_0x446be2(0x143));else{const _0x2db206=_0x3d7502[_0x446be2(0x177)],_0x30f25b=_0x268571[_0x446be2(0x128)](_0x3b7d08=>{const _0x167b7e=_0x446be2,_0x32b3f1=_0x3b7d08[_0x167b7e(0x146)]?.[_0x167b7e(0x156)]?_0x3b7d08['last_job']['status']===_0x167b7e(0x1ab)?'β':'β':'-',_0x266831=_0x3b7d08[_0x167b7e(0x146)]?.[_0x167b7e(0x155)]?formatRelativeTime(_0x3b7d08[_0x167b7e(0x146)]['ended_at']):_0x167b7e(0x18f),_0x38c3f7=_0x3b7d08['next_run_at']?formatRelativeTime(_0x3b7d08[_0x167b7e(0x183)]):'-',_0xd07168=_0x3b7d08[_0x167b7e(0x17e)]||'',_0x1f6f54=_0x3b7d08[_0x167b7e(0x13d)]||'(unnamed)',_0x42d8b1=getConsoleUrl(_0x2db206,_0x167b7e(0x153)+_0x3b7d08['id']);return{'statusIcon':_0x32b3f1,'lastRun':_0x266831,'nextRun':_0x38c3f7,'cron':_0xd07168,'name':_0x1f6f54,'queryUrl':_0x42d8b1,'status':_0x3b7d08[_0x167b7e(0x146)]?.[_0x167b7e(0x156)]};}),_0x442d5f=Math[_0x446be2(0x161)](..._0x30f25b['map'](_0x12096d=>_0x12096d['lastRun']['length'])),_0x5b6ad8=Math['max'](..._0x30f25b[_0x446be2(0x128)](_0x12384b=>_0x12384b[_0x446be2(0x16f)][_0x446be2(0x1a8)])),_0x51f6ad=Math[_0x446be2(0x161)](..._0x30f25b[_0x446be2(0x128)](_0x309182=>_0x309182[_0x446be2(0x17e)]['length'])),_0x1731e5=_0x30f25b[_0x446be2(0x128)](_0x3c99a2=>{const _0xc4a542=_0x446be2,_0x319d14=_0x3c99a2[_0xc4a542(0x156)]===_0xc4a542(0x1ab)?a26_0x4bf6cd[_0xc4a542(0x171)](_0x3c99a2['statusIcon']):_0x3c99a2[_0xc4a542(0x156)]===_0xc4a542(0x154)?a26_0x4bf6cd[_0xc4a542(0x14f)](_0x3c99a2[_0xc4a542(0x127)]):a26_0x4bf6cd[_0xc4a542(0x192)](_0x3c99a2[_0xc4a542(0x127)]),_0x1dace1=_0x3c99a2[_0xc4a542(0x16a)][_0xc4a542(0x180)](_0x442d5f),_0x3167c3=_0x3c99a2[_0xc4a542(0x16f)]['padEnd'](_0x5b6ad8),_0x35661f=_0x3c99a2[_0xc4a542(0x17e)]?a26_0x4bf6cd[_0xc4a542(0x174)](_0x3c99a2['cron'][_0xc4a542(0x180)](_0x51f6ad)):'\x20'[_0xc4a542(0x17c)](_0x51f6ad),_0x4d602b=hyperlink(_0x3c99a2['name'],_0x3c99a2['queryUrl']);return'π
\x20'+_0x319d14+'\x20'+_0x1dace1+_0xc4a542(0x15e)+_0x3167c3+'\x20\x20'+_0x35661f+'\x20\x20'+_0x4d602b;});await writeOutput(_0x1731e5['join']('\x0a'),_0x3d7502[_0x446be2(0x152)],_0x446be2(0x12b));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]='schedule:show';['description']='Show\x20schedule\x20details';[a26_0xea0ac0(0x184)](_0x2fa832){const _0x4c6c9b=a26_0xea0ac0,_0x14e1ef=_0x2fa832[_0x4c6c9b(0x19a)][0x0];if(!_0x14e1ef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a26_0xea0ac0(0x18b)](_0x2920c2){const _0x24a206=a26_0xea0ac0,{options:_0x1072dc,args:_0x18a35f,tdx:_0x1fa828}=_0x2920c2,_0x33a921=_0x18a35f[0x0],_0xb03faa=await withSpinner(_0x24a206(0x17f),()=>_0x1fa828[_0x24a206(0x144)]['show'](_0x33a921),{'verbose':_0x1072dc[_0x24a206(0x189)]}),_0x595fb7=_0xb03faa['data'],_0x5a4dca={'name':_0x595fb7[_0x24a206(0x13d)],'cron':_0x595fb7[_0x24a206(0x17e)],'database':_0x595fb7[_0x24a206(0x135)],'type':_0x595fb7[_0x24a206(0x165)],'timezone':_0x595fb7[_0x24a206(0x158)],'user_name':_0x595fb7[_0x24a206(0x137)],'created_at':_0x595fb7[_0x24a206(0x14d)],'engine_version':_0x595fb7['engine_version'],'executing_user_id':_0x595fb7[_0x24a206(0x186)],'query':_0x595fb7[_0x24a206(0x185)],'delay':_0x595fb7[_0x24a206(0x133)],'priority':_0x595fb7[_0x24a206(0x181)],'retry_limit':_0x595fb7[_0x24a206(0x142)],..._0x595fb7[_0x24a206(0x140)]&&{'result':_0x595fb7[_0x24a206(0x140)]}};return await handleSingleObjectOutput(_0x5a4dca,_0x1072dc),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]=a26_0xea0ac0(0x16d);[a26_0xea0ac0(0x124)]=a26_0xea0ac0(0x13f);[a26_0xea0ac0(0x184)](_0x1ca694){const _0x37f18a=a26_0xea0ac0,_0x5e18c5=_0x1ca694['args'][0x0];if(!_0x5e18c5)return _0x37f18a(0x12f);return undefined;}async[a26_0xea0ac0(0x18b)](_0xda8d97){const _0x1af3f6=a26_0xea0ac0,{options:_0x1edbea,args:_0x2cebf3,tdx:_0x3a1d6c}=_0xda8d97,_0x291309=_0x2cebf3[0x0],_0x2bced7=_0x1edbea,_0x817d34=_0x2bced7[_0x1af3f6(0x135)],_0x23f5d1=_0x2bced7[_0x1af3f6(0x188)],_0xe509fc=_0x2bced7[_0x1af3f6(0x165)]||'trino';let _0x14c795;try{_0x14c795=readFileSync(_0x23f5d1,_0x1af3f6(0x129))[_0x1af3f6(0x134)]();}catch(_0x2438db){throw new SDKError(ErrorCode[_0x1af3f6(0x16b)],_0x1af3f6(0x172)+_0x23f5d1,_0x2438db instanceof Error?_0x2438db:undefined);}if(!_0x14c795)throw new SDKError(ErrorCode[_0x1af3f6(0x16b)],_0x1af3f6(0x1a4));const _0x17403a={'database':_0x817d34,'query':_0x14c795,'type':_0xe509fc};if(_0x2bced7[_0x1af3f6(0x17e)])_0x17403a[_0x1af3f6(0x17e)]=_0x2bced7[_0x1af3f6(0x17e)];if(_0x2bced7[_0x1af3f6(0x158)])_0x17403a[_0x1af3f6(0x158)]=_0x2bced7[_0x1af3f6(0x158)];if(_0x2bced7[_0x1af3f6(0x133)]!==undefined)_0x17403a[_0x1af3f6(0x133)]=Number(_0x2bced7[_0x1af3f6(0x133)]);if(_0x2bced7[_0x1af3f6(0x181)]!==undefined)_0x17403a['priority']=Number(_0x2bced7[_0x1af3f6(0x181)]);if(_0x2bced7[_0x1af3f6(0x130)]!==undefined)_0x17403a[_0x1af3f6(0x142)]=Number(_0x2bced7[_0x1af3f6(0x130)]);if(_0x2bced7['engineVersion'])_0x17403a[_0x1af3f6(0x13a)]=_0x2bced7[_0x1af3f6(0x1a1)];if(_0x2bced7[_0x1af3f6(0x140)])_0x17403a[_0x1af3f6(0x140)]=_0x2bced7['result'];if(_0x1edbea[_0x1af3f6(0x189)]){console[_0x1af3f6(0x154)](_0x1af3f6(0x16e)+_0x291309),console['error'](_0x1af3f6(0x19e)+_0x817d34),console['error'](_0x1af3f6(0x193)+_0xe509fc);if(_0x17403a[_0x1af3f6(0x17e)])console[_0x1af3f6(0x154)]('\x20\x20Cron:\x20'+_0x17403a['cron']);if(_0x17403a[_0x1af3f6(0x158)])console[_0x1af3f6(0x154)](_0x1af3f6(0x15f)+_0x17403a[_0x1af3f6(0x158)]);}const _0x1c69cd=await withSpinner(_0x1af3f6(0x136),()=>_0x3a1d6c[_0x1af3f6(0x144)][_0x1af3f6(0x15a)](_0x291309,_0x17403a),{'verbose':_0x1edbea['verbose']});return console[_0x1af3f6(0x154)](_0x1af3f6(0x175)+_0x1c69cd[_0x1af3f6(0x163)][_0x1af3f6(0x13d)]),await handleSingleObjectOutput(_0x1c69cd['data'],_0x1edbea),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]=a26_0xea0ac0(0x1a7);[a26_0xea0ac0(0x124)]=a26_0xea0ac0(0x14c);['validate'](_0x54856c){const _0x4d1245=a26_0xea0ac0,_0x5e7b81=_0x54856c[_0x4d1245(0x19a)][0x0];if(!_0x5e7b81)return _0x4d1245(0x12c);return undefined;}async['execute'](_0x368505){const _0x522b6b=a26_0xea0ac0,{options:_0x3c5889,args:_0x437514,tdx:_0x282b77}=_0x368505,_0x2a14b2=_0x437514[0x0],_0x39b70b=_0x3c5889,_0x500991={};if(_0x39b70b['database'])_0x500991[_0x522b6b(0x135)]=_0x39b70b['database'];if(_0x39b70b[_0x522b6b(0x165)])_0x500991[_0x522b6b(0x165)]=_0x39b70b[_0x522b6b(0x165)];if(_0x39b70b['cron'])_0x500991[_0x522b6b(0x17e)]=_0x39b70b[_0x522b6b(0x17e)];if(_0x39b70b[_0x522b6b(0x158)])_0x500991[_0x522b6b(0x158)]=_0x39b70b[_0x522b6b(0x158)];if(_0x39b70b[_0x522b6b(0x133)]!==undefined)_0x500991[_0x522b6b(0x133)]=Number(_0x39b70b[_0x522b6b(0x133)]);if(_0x39b70b[_0x522b6b(0x181)]!==undefined)_0x500991[_0x522b6b(0x181)]=Number(_0x39b70b['priority']);if(_0x39b70b[_0x522b6b(0x130)]!==undefined)_0x500991['retry_limit']=Number(_0x39b70b[_0x522b6b(0x130)]);if(_0x39b70b[_0x522b6b(0x1a1)])_0x500991[_0x522b6b(0x13a)]=_0x39b70b[_0x522b6b(0x1a1)];if(_0x39b70b[_0x522b6b(0x140)])_0x500991[_0x522b6b(0x140)]=_0x39b70b['result'];if(_0x39b70b['file'])try{_0x500991['query']=readFileSync(_0x39b70b[_0x522b6b(0x188)],_0x522b6b(0x129))[_0x522b6b(0x134)]();}catch(_0x3f7254){throw new SDKError(ErrorCode[_0x522b6b(0x16b)],_0x522b6b(0x172)+_0x39b70b[_0x522b6b(0x188)],_0x3f7254 instanceof Error?_0x3f7254:undefined);}if(Object[_0x522b6b(0x12a)](_0x500991)['length']===0x0)throw new SDKError(ErrorCode[_0x522b6b(0x16b)],_0x522b6b(0x160));if(_0x3c5889[_0x522b6b(0x189)]){console[_0x522b6b(0x154)]('Updating\x20schedule:\x20'+_0x2a14b2);for(const [_0x2d659c,_0x3cc043]of Object[_0x522b6b(0x191)](_0x500991)){_0x2d659c===_0x522b6b(0x185)?console[_0x522b6b(0x154)]('\x20\x20'+_0x2d659c+':\x20'+_0x3cc043[_0x522b6b(0x148)](0x0,0x32)+_0x522b6b(0x197)):console[_0x522b6b(0x154)]('\x20\x20'+_0x2d659c+':\x20'+_0x3cc043);}}const _0x4ce59c=await withSpinner(_0x522b6b(0x12e),()=>_0x282b77[_0x522b6b(0x144)][_0x522b6b(0x169)](_0x2a14b2,_0x500991),{'verbose':_0x3c5889[_0x522b6b(0x189)]});return console[_0x522b6b(0x154)](_0x522b6b(0x1a5)+_0x4ce59c[_0x522b6b(0x163)][_0x522b6b(0x13d)]),await handleSingleObjectOutput(_0x4ce59c[_0x522b6b(0x163)],_0x3c5889),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]=a26_0xea0ac0(0x166);['description']=a26_0xea0ac0(0x187);[a26_0xea0ac0(0x184)](_0xb6e1d2){const _0x281fd9=a26_0xea0ac0,_0x44317f=_0xb6e1d2[_0x281fd9(0x19a)][0x0];if(!_0x44317f)return _0x281fd9(0x179);return undefined;}async[a26_0xea0ac0(0x18b)](_0x1845f7){const _0x120e9a=a26_0xea0ac0,{options:_0x862e7b,args:_0x3709d1,tdx:_0x4dfd83}=_0x1845f7,_0x5606a0=_0x3709d1[0x0];if(!_0x862e7b[_0x120e9a(0x157)]){const _0x4da884=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x5606a0+'\x22?');if(!_0x4da884)return console['error']('Cancelled'),0x0;}const _0x4b75f0=await withSpinner(_0x120e9a(0x170),()=>_0x4dfd83[_0x120e9a(0x144)][_0x120e9a(0x195)](_0x5606a0),{'verbose':_0x862e7b[_0x120e9a(0x189)]});return console['error'](_0x120e9a(0x1a9)+_0x4b75f0[_0x120e9a(0x163)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]=a26_0xea0ac0(0x178);['description']=a26_0xea0ac0(0x139);[a26_0xea0ac0(0x184)](_0x47479f){const _0x1b0d16=a26_0xea0ac0,_0x4719c6=_0x47479f[_0x1b0d16(0x19a)][0x0];if(!_0x4719c6)return _0x1b0d16(0x18e);return undefined;}async[a26_0xea0ac0(0x18b)](_0x14f073){const _0x51a530=a26_0xea0ac0,{options:_0x3c0b3e,args:_0x1daf06,tdx:_0x5a9380}=_0x14f073,_0x1eb0b8=_0x1daf06[0x0],_0xc7dbde=_0x3c0b3e,_0x248f43=_0xc7dbde['time'],_0x9eda50=_0xc7dbde[_0x51a530(0x18d)]!==undefined?Number(_0xc7dbde[_0x51a530(0x18d)]):undefined;if(_0x3c0b3e[_0x51a530(0x189)]){console[_0x51a530(0x154)](_0x51a530(0x1aa)+_0x1eb0b8);if(_0x248f43)console['error'](_0x51a530(0x199)+_0x248f43);if(_0x9eda50)console[_0x51a530(0x154)](_0x51a530(0x14b)+_0x9eda50);}const _0x4f3e24=await withSpinner(_0x51a530(0x18a),()=>_0x5a9380[_0x51a530(0x144)][_0x51a530(0x164)](_0x1eb0b8,{'time':_0x248f43,'num':_0x9eda50}),{'verbose':_0x3c0b3e['verbose']}),_0x4af364=_0x4f3e24[_0x51a530(0x163)][_0x51a530(0x173)];console['error'](_0x51a530(0x13c)+_0x4af364[_0x51a530(0x1a8)]+_0x51a530(0x182)+(_0x4af364[_0x51a530(0x1a8)]!==0x1?'s':'')+'\x20created');for(const _0x5d6869 of _0x4af364){console[_0x51a530(0x154)](_0x51a530(0x147)+_0x5d6869[_0x51a530(0x17d)]);}return await handleSDKOutput(_0x4af364,_0x3c0b3e),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0xea0ac0(0x13d)]=a26_0xea0ac0(0x151);[a26_0xea0ac0(0x124)]=a26_0xea0ac0(0x15c);[a26_0xea0ac0(0x184)](_0x39ed71){const _0x3d40de=a26_0xea0ac0,_0x14960a=_0x39ed71[_0x3d40de(0x19a)][0x0];if(!_0x14960a)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0xea0ac0(0x18b)](_0x4ddd19){const _0x5c8ac8=a26_0xea0ac0,{options:_0xfef55a,args:_0xff7cf8,tdx:_0x3d3692}=_0x4ddd19,_0x2eabce=_0xff7cf8[0x0],_0x85125a=_0xfef55a,_0x1a60b5=_0x85125a[_0x5c8ac8(0x1a3)]!==undefined?Number(_0x85125a[_0x5c8ac8(0x1a3)]):undefined,_0x437362=_0x85125a['to']!==undefined?Number(_0x85125a['to']):undefined,_0x4b014d=await withSpinner(_0x5c8ac8(0x19f),()=>_0x3d3692['schedules'][_0x5c8ac8(0x17a)](_0x2eabce,{'from':_0x1a60b5,'to':_0x437362}),{'verbose':_0xfef55a[_0x5c8ac8(0x189)]}),_0xb88120=_0x4b014d['data'];console[_0x5c8ac8(0x154)](_0x5c8ac8(0x14e)+_0xb88120[_0x5c8ac8(0x168)]+_0x5c8ac8(0x131)+(_0xb88120[_0x5c8ac8(0x168)]!==0x1?'s':'')+_0x5c8ac8(0x123)+_0xb88120[_0x5c8ac8(0x1a3)]+'-'+_0xb88120['to']+')');const _0x529071=_0xb88120[_0x5c8ac8(0x17a)][_0x5c8ac8(0x128)](_0x24ff46=>({'job_id':_0x24ff46[_0x5c8ac8(0x17d)],'type':_0x24ff46['type'],'status':_0x24ff46[_0x5c8ac8(0x156)],'scheduled_at':_0x24ff46[_0x5c8ac8(0x150)],'created_at':_0x24ff46[_0x5c8ac8(0x14d)],'start_at':_0x24ff46['start_at'],'end_at':_0x24ff46[_0x5c8ac8(0x149)]}));return await handleSDKOutput(_0x529071,_0xfef55a),0x0;}}
|
|
1
|
+
const a26_0x46c29a=a26_0x4ec7;(function(_0x333bf1,_0x31aa42){const _0x123b15=a26_0x4ec7,_0x572326=_0x333bf1();while(!![]){try{const _0x5a5e12=parseInt(_0x123b15(0x1b5))/0x1+-parseInt(_0x123b15(0x1f3))/0x2+parseInt(_0x123b15(0x1b4))/0x3+-parseInt(_0x123b15(0x1f1))/0x4*(parseInt(_0x123b15(0x1f5))/0x5)+parseInt(_0x123b15(0x1be))/0x6+-parseInt(_0x123b15(0x19d))/0x7+-parseInt(_0x123b15(0x1ba))/0x8*(-parseInt(_0x123b15(0x1ce))/0x9);if(_0x5a5e12===_0x31aa42)break;else _0x572326['push'](_0x572326['shift']());}catch(_0x32ff6e){_0x572326['push'](_0x572326['shift']());}}}(a26_0x2c80,0x8a5d9));function a26_0x4ec7(_0x1849fa,_0x2f5d72){_0x1849fa=_0x1849fa-0x189;const _0x2c8062=a26_0x2c80();let _0x4ec7e5=_0x2c8062[_0x1849fa];return _0x4ec7e5;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x2fc186 from'chalk';function formatRelativeTime(_0x1d6795){const _0x5e687f=a26_0x4ec7,_0x485a3d=new Date(_0x1d6795),_0x588ba1=new Date(),_0x4850a8=_0x485a3d[_0x5e687f(0x1e0)]()-_0x588ba1[_0x5e687f(0x1e0)](),_0x4a09ee=Math[_0x5e687f(0x195)](_0x4850a8)/0x3e8,_0x51a476=_0x4850a8<0x0;if(_0x4a09ee<0x3c)return _0x51a476?_0x5e687f(0x1eb):'soon';else{if(_0x4a09ee<0xe10){const _0x292ea2=Math[_0x5e687f(0x1da)](_0x4a09ee/0x3c);return _0x51a476?_0x292ea2+_0x5e687f(0x207):_0x5e687f(0x210)+_0x292ea2+'m';}else{if(_0x4a09ee<0x15180){const _0x1d9509=Math[_0x5e687f(0x1da)](_0x4a09ee/0xe10);return _0x51a476?_0x1d9509+'h\x20ago':_0x5e687f(0x210)+_0x1d9509+'h';}else{if(_0x4a09ee<0x93a80){const _0x3fa523=Math[_0x5e687f(0x1da)](_0x4a09ee/0x15180);return _0x51a476?_0x3fa523+_0x5e687f(0x1f6):_0x5e687f(0x210)+_0x3fa523+'d';}else return _0x485a3d[_0x5e687f(0x1a0)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x46c29a(0x192)]=a26_0x46c29a(0x1d4);[a26_0x46c29a(0x1fc)]='List\x20scheduled\x20queries';async[a26_0x46c29a(0x1f4)](_0x63f9d9){const _0x1aa5bf=a26_0x46c29a,{options:_0x2b070e,args:_0x35492a,tdx:_0x2f938b}=_0x63f9d9,_0x1662e7=resolveLimit(_0x2b070e[_0x1aa5bf(0x1d1)],DEFAULT_DISPLAY_LIMIT),_0x2ca3d8=_0x35492a[0x0],_0x4d843b=_0x2ca3d8?_0x1aa5bf(0x1f8)+_0x2ca3d8+_0x1aa5bf(0x1a6):_0x1aa5bf(0x1e6),_0x365ee6=await withSpinner(_0x4d843b,()=>_0x2f938b[_0x1aa5bf(0x1d9)][_0x1aa5bf(0x1b9)]({'limit':_0x1662e7,'scheduled':!![],'pattern':_0x2ca3d8}),{'verbose':_0x2b070e['verbose']}),_0x1b77b5=_0x365ee6[_0x1aa5bf(0x18e)]['queries'],_0x4416fa=_0x365ee6[_0x1aa5bf(0x18e)][_0x1aa5bf(0x1d7)][_0x1aa5bf(0x1fb)],_0x21e478=_0x2ca3d8?'\x20matching\x20\x22'+_0x2ca3d8+'\x22':'';_0x4416fa?console[_0x1aa5bf(0x204)](_0x1aa5bf(0x211)+_0x1b77b5[_0x1aa5bf(0x1ed)]+'\x20schedules'+_0x21e478+_0x1aa5bf(0x1a3)):console[_0x1aa5bf(0x204)](_0x1aa5bf(0x196)+_0x1b77b5[_0x1aa5bf(0x1ed)]+'\x20scheduled\x20quer'+(_0x1b77b5[_0x1aa5bf(0x1ed)]!==0x1?_0x1aa5bf(0x1f2):'y')+_0x21e478);if(_0x2b070e[_0x1aa5bf(0x1bf)]===_0x1aa5bf(0x189)||_0x2b070e['format']==='jsonl'||_0x2b070e[_0x1aa5bf(0x1bf)]===_0x1aa5bf(0x1a1)||_0x2b070e[_0x1aa5bf(0x1bf)]===_0x1aa5bf(0x1b2)){const _0x366ec6=_0x1b77b5[_0x1aa5bf(0x194)](_0x24fd5d=>({'id':_0x24fd5d['id'],'name':_0x24fd5d[_0x1aa5bf(0x192)],'cron':_0x24fd5d['cron'],'database':_0x24fd5d[_0x1aa5bf(0x1fd)]?.[_0x1aa5bf(0x192)],'type':_0x24fd5d[_0x1aa5bf(0x1df)],'timezone':_0x24fd5d[_0x1aa5bf(0x1bd)],'user_name':_0x24fd5d['user']?.[_0x1aa5bf(0x192)],'updated_at':_0x24fd5d[_0x1aa5bf(0x1ae)],'next_run_at':_0x24fd5d['next_run_at'],'last_job_status':_0x24fd5d['last_job']?.[_0x1aa5bf(0x209)]}));await handleSDKOutput(_0x366ec6,_0x2b070e);}else{if(_0x1b77b5[_0x1aa5bf(0x1ed)]===0x0)console[_0x1aa5bf(0x1aa)]('No\x20scheduled\x20queries\x20found');else{const _0x1571d6=_0x2b070e['site'],_0x49136a=_0x1b77b5[_0x1aa5bf(0x194)](_0x132cbc=>{const _0xb6934=_0x1aa5bf,_0x28e724=_0x132cbc['last_job']?.[_0xb6934(0x209)]?_0x132cbc[_0xb6934(0x1b6)][_0xb6934(0x209)]==='success'?'β':'β':'-',_0x3952c4=_0x132cbc['last_job']?.[_0xb6934(0x1d2)]?formatRelativeTime(_0x132cbc[_0xb6934(0x1b6)][_0xb6934(0x1d2)]):_0xb6934(0x1c6),_0x2407fe=_0x132cbc['next_run_at']?formatRelativeTime(_0x132cbc[_0xb6934(0x1fe)]):'-',_0x4d5efe=_0x132cbc[_0xb6934(0x1cb)]||'',_0x2e01d4=_0x132cbc['name']||_0xb6934(0x1ff),_0x50d22d=getConsoleUrl(_0x1571d6,'/app/queries/editor?queryId='+_0x132cbc['id']);return{'statusIcon':_0x28e724,'lastRun':_0x3952c4,'nextRun':_0x2407fe,'cron':_0x4d5efe,'name':_0x2e01d4,'queryUrl':_0x50d22d,'status':_0x132cbc[_0xb6934(0x1b6)]?.[_0xb6934(0x209)]};}),_0x25ba49=Math[_0x1aa5bf(0x1ef)](..._0x49136a['map'](_0x586b6d=>_0x586b6d[_0x1aa5bf(0x1c1)][_0x1aa5bf(0x1ed)])),_0xf11bbb=Math[_0x1aa5bf(0x1ef)](..._0x49136a['map'](_0x3c661a=>_0x3c661a['nextRun'][_0x1aa5bf(0x1ed)])),_0x50ddfb=Math[_0x1aa5bf(0x1ef)](..._0x49136a[_0x1aa5bf(0x194)](_0x3eb85e=>_0x3eb85e[_0x1aa5bf(0x1cb)][_0x1aa5bf(0x1ed)])),_0x19d150=_0x49136a[_0x1aa5bf(0x194)](_0x2ae609=>{const _0xfab7dc=_0x1aa5bf,_0x2297dc=_0x2ae609[_0xfab7dc(0x209)]==='success'?a26_0x2fc186[_0xfab7dc(0x1cf)](_0x2ae609['statusIcon']):_0x2ae609[_0xfab7dc(0x209)]===_0xfab7dc(0x204)?a26_0x2fc186[_0xfab7dc(0x205)](_0x2ae609[_0xfab7dc(0x213)]):a26_0x2fc186[_0xfab7dc(0x1c5)](_0x2ae609[_0xfab7dc(0x213)]),_0x5f59be=_0x2ae609[_0xfab7dc(0x1c1)][_0xfab7dc(0x1af)](_0x25ba49),_0x2b1d4b=_0x2ae609[_0xfab7dc(0x18c)][_0xfab7dc(0x1af)](_0xf11bbb),_0x29f6b1=_0x2ae609[_0xfab7dc(0x1cb)]?a26_0x2fc186[_0xfab7dc(0x200)](_0x2ae609[_0xfab7dc(0x1cb)][_0xfab7dc(0x1af)](_0x50ddfb)):'\x20'[_0xfab7dc(0x212)](_0x50ddfb),_0x4bffe8=hyperlink(_0x2ae609[_0xfab7dc(0x192)],_0x2ae609[_0xfab7dc(0x197)]);return _0xfab7dc(0x1ca)+_0x2297dc+'\x20'+_0x5f59be+_0xfab7dc(0x208)+_0x2b1d4b+'\x20\x20'+_0x29f6b1+'\x20\x20'+_0x4bffe8;});await writeOutput(_0x19d150[_0x1aa5bf(0x1d3)]('\x0a'),_0x2b070e[_0x1aa5bf(0x201)],_0x1aa5bf(0x203));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';['description']=a26_0x46c29a(0x190);[a26_0x46c29a(0x1e8)](_0x2791e9){const _0x303135=a26_0x46c29a,_0x418e77=_0x2791e9[_0x303135(0x199)][0x0];if(!_0x418e77)return _0x303135(0x1f0);return undefined;}async[a26_0x46c29a(0x1f4)](_0x3b0bcd){const _0x360bcc=a26_0x46c29a,{options:_0x4fdf00,args:_0x36ab4a,tdx:_0x306b33}=_0x3b0bcd,_0xb7a47e=_0x36ab4a[0x0],_0x353f21=await withSpinner(_0x360bcc(0x18a),()=>_0x306b33[_0x360bcc(0x1d9)][_0x360bcc(0x1b0)](_0xb7a47e),{'verbose':_0x4fdf00[_0x360bcc(0x1b3)]}),_0x4ba802=_0x353f21[_0x360bcc(0x18e)],_0x1a8a2f={'name':_0x4ba802[_0x360bcc(0x192)],'cron':_0x4ba802[_0x360bcc(0x1cb)],'database':_0x4ba802[_0x360bcc(0x1fd)],'type':_0x4ba802['type'],'timezone':_0x4ba802[_0x360bcc(0x1c8)],'user_name':_0x4ba802[_0x360bcc(0x1bc)],'created_at':_0x4ba802[_0x360bcc(0x1e7)],'engine_version':_0x4ba802[_0x360bcc(0x1f9)],'executing_user_id':_0x4ba802['executing_user_id'],'query':_0x4ba802['query'],'delay':_0x4ba802[_0x360bcc(0x1dc)],'priority':_0x4ba802[_0x360bcc(0x20d)],'retry_limit':_0x4ba802[_0x360bcc(0x1dd)],..._0x4ba802[_0x360bcc(0x18f)]&&{'result':_0x4ba802[_0x360bcc(0x18f)]}};return await handleSingleObjectOutput(_0x1a8a2f,_0x4fdf00),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x46c29a(0x1c2);[a26_0x46c29a(0x1fc)]=a26_0x46c29a(0x1c9);['validate'](_0x353229){const _0x4f463b=a26_0x46c29a,_0x319845=_0x353229[_0x4f463b(0x199)][0x0];if(!_0x319845)return _0x4f463b(0x1e9);return undefined;}async[a26_0x46c29a(0x1f4)](_0x630604){const _0x454ff4=a26_0x46c29a,{options:_0x575f05,args:_0x16ac77,tdx:_0x3ffcd8}=_0x630604,_0x1103c=_0x16ac77[0x0],_0x49daad=_0x575f05,_0x143ea6=_0x49daad[_0x454ff4(0x1fd)],_0x5e6f98=_0x49daad[_0x454ff4(0x19f)],_0x454b65=_0x49daad[_0x454ff4(0x1df)]||'trino';let _0x53bac6;try{_0x53bac6=readFileSync(_0x5e6f98,_0x454ff4(0x19c))['trim']();}catch(_0x26f22){throw new SDKError(ErrorCode[_0x454ff4(0x1c7)],'Failed\x20to\x20read\x20file:\x20'+_0x5e6f98,_0x26f22 instanceof Error?_0x26f22:undefined);}if(!_0x53bac6)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x454ff4(0x214));const _0x3dd342={'database':_0x143ea6,'query':_0x53bac6,'type':_0x454b65};if(_0x49daad[_0x454ff4(0x1cb)])_0x3dd342[_0x454ff4(0x1cb)]=_0x49daad['cron'];if(_0x49daad[_0x454ff4(0x1c8)])_0x3dd342[_0x454ff4(0x1c8)]=_0x49daad[_0x454ff4(0x1c8)];if(_0x49daad[_0x454ff4(0x1dc)]!==undefined)_0x3dd342[_0x454ff4(0x1dc)]=Number(_0x49daad['delay']);if(_0x49daad[_0x454ff4(0x20d)]!==undefined)_0x3dd342[_0x454ff4(0x20d)]=Number(_0x49daad[_0x454ff4(0x20d)]);if(_0x49daad[_0x454ff4(0x1a7)]!==undefined)_0x3dd342[_0x454ff4(0x1dd)]=Number(_0x49daad['retryLimit']);if(_0x49daad['engineVersion'])_0x3dd342[_0x454ff4(0x1f9)]=_0x49daad[_0x454ff4(0x1d8)];if(_0x49daad[_0x454ff4(0x18f)])_0x3dd342[_0x454ff4(0x18f)]=_0x49daad['result'];if(_0x575f05[_0x454ff4(0x1b3)]){console[_0x454ff4(0x204)](_0x454ff4(0x1c0)+_0x1103c),console[_0x454ff4(0x204)](_0x454ff4(0x1b8)+_0x143ea6),console[_0x454ff4(0x204)](_0x454ff4(0x1c4)+_0x454b65);if(_0x3dd342[_0x454ff4(0x1cb)])console[_0x454ff4(0x204)](_0x454ff4(0x20f)+_0x3dd342[_0x454ff4(0x1cb)]);if(_0x3dd342[_0x454ff4(0x1c8)])console['error'](_0x454ff4(0x1e4)+_0x3dd342[_0x454ff4(0x1c8)]);}const _0x27db28=await withSpinner(_0x454ff4(0x19b),()=>_0x3ffcd8['schedules'][_0x454ff4(0x1ea)](_0x1103c,_0x3dd342),{'verbose':_0x575f05[_0x454ff4(0x1b3)]});return console['error']('Schedule\x20created:\x20'+_0x27db28[_0x454ff4(0x18e)][_0x454ff4(0x192)]),await handleSingleObjectOutput(_0x27db28['data'],_0x575f05),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x46c29a(0x192)]=a26_0x46c29a(0x202);[a26_0x46c29a(0x1fc)]=a26_0x46c29a(0x1ac);[a26_0x46c29a(0x1e8)](_0x52dd7f){const _0x1eb2db=a26_0x46c29a,_0x55deb4=_0x52dd7f[_0x1eb2db(0x199)][0x0];if(!_0x55deb4)return _0x1eb2db(0x1ab);return undefined;}async[a26_0x46c29a(0x1f4)](_0x2282fd){const _0x1fc4ee=a26_0x46c29a,{options:_0x330c4c,args:_0x5f2fcc,tdx:_0x30e2b0}=_0x2282fd,_0x30935e=_0x5f2fcc[0x0],_0x24335d=_0x330c4c,_0x36bf88={};if(_0x24335d[_0x1fc4ee(0x1fd)])_0x36bf88[_0x1fc4ee(0x1fd)]=_0x24335d['database'];if(_0x24335d['type'])_0x36bf88[_0x1fc4ee(0x1df)]=_0x24335d[_0x1fc4ee(0x1df)];if(_0x24335d[_0x1fc4ee(0x1cb)])_0x36bf88[_0x1fc4ee(0x1cb)]=_0x24335d[_0x1fc4ee(0x1cb)];if(_0x24335d[_0x1fc4ee(0x1c8)])_0x36bf88[_0x1fc4ee(0x1c8)]=_0x24335d[_0x1fc4ee(0x1c8)];if(_0x24335d[_0x1fc4ee(0x1dc)]!==undefined)_0x36bf88['delay']=Number(_0x24335d[_0x1fc4ee(0x1dc)]);if(_0x24335d[_0x1fc4ee(0x20d)]!==undefined)_0x36bf88['priority']=Number(_0x24335d[_0x1fc4ee(0x20d)]);if(_0x24335d['retryLimit']!==undefined)_0x36bf88['retry_limit']=Number(_0x24335d[_0x1fc4ee(0x1a7)]);if(_0x24335d[_0x1fc4ee(0x1d8)])_0x36bf88['engine_version']=_0x24335d['engineVersion'];if(_0x24335d[_0x1fc4ee(0x18f)])_0x36bf88['result']=_0x24335d[_0x1fc4ee(0x18f)];if(_0x24335d[_0x1fc4ee(0x19f)])try{_0x36bf88['query']=readFileSync(_0x24335d[_0x1fc4ee(0x19f)],_0x1fc4ee(0x19c))['trim']();}catch(_0x50b148){throw new SDKError(ErrorCode[_0x1fc4ee(0x1c7)],'Failed\x20to\x20read\x20file:\x20'+_0x24335d[_0x1fc4ee(0x19f)],_0x50b148 instanceof Error?_0x50b148:undefined);}if(Object[_0x1fc4ee(0x1e1)](_0x36bf88)['length']===0x0)throw new SDKError(ErrorCode[_0x1fc4ee(0x1c7)],_0x1fc4ee(0x20e));if(_0x330c4c['verbose']){console[_0x1fc4ee(0x204)](_0x1fc4ee(0x1a9)+_0x30935e);for(const [_0x3bd30d,_0x2e9bc8]of Object[_0x1fc4ee(0x19e)](_0x36bf88)){_0x3bd30d==='query'?console['error']('\x20\x20'+_0x3bd30d+':\x20'+_0x2e9bc8[_0x1fc4ee(0x1d5)](0x0,0x32)+'...'):console[_0x1fc4ee(0x204)]('\x20\x20'+_0x3bd30d+':\x20'+_0x2e9bc8);}}const _0x1b28db=await withSpinner(_0x1fc4ee(0x1c3),()=>_0x30e2b0[_0x1fc4ee(0x1d9)][_0x1fc4ee(0x1b1)](_0x30935e,_0x36bf88),{'verbose':_0x330c4c[_0x1fc4ee(0x1b3)]});return console[_0x1fc4ee(0x204)](_0x1fc4ee(0x1cd)+_0x1b28db['data'][_0x1fc4ee(0x192)]),await handleSingleObjectOutput(_0x1b28db['data'],_0x330c4c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x46c29a(0x193);[a26_0x46c29a(0x1fc)]=a26_0x46c29a(0x20a);[a26_0x46c29a(0x1e8)](_0x5d5330){const _0x49ed8f=a26_0x46c29a,_0x4e608a=_0x5d5330[_0x49ed8f(0x199)][0x0];if(!_0x4e608a)return _0x49ed8f(0x198);return undefined;}async[a26_0x46c29a(0x1f4)](_0x5202c3){const _0x528239=a26_0x46c29a,{options:_0x99709,args:_0x1b2a3c,tdx:_0x2438a2}=_0x5202c3,_0x173662=_0x1b2a3c[0x0];if(!_0x99709[_0x528239(0x1a5)]){const _0x370782=await confirm(_0x528239(0x1cc)+_0x173662+'\x22?');if(!_0x370782)return console['error'](_0x528239(0x1ee)),0x0;}const _0x1a3bd4=await withSpinner(_0x528239(0x1d0),()=>_0x2438a2[_0x528239(0x1d9)]['delete'](_0x173662),{'verbose':_0x99709[_0x528239(0x1b3)]});return console[_0x528239(0x204)]('Schedule\x20deleted:\x20'+_0x1a3bd4['data'][_0x528239(0x192)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x46c29a(0x192)]='schedule:run';[a26_0x46c29a(0x1fc)]=a26_0x46c29a(0x1d6);[a26_0x46c29a(0x1e8)](_0xa1604e){const _0x49b47a=a26_0x46c29a,_0x1c367e=_0xa1604e[_0x49b47a(0x199)][0x0];if(!_0x1c367e)return _0x49b47a(0x1e3);return undefined;}async[a26_0x46c29a(0x1f4)](_0x2e9a15){const _0x466060=a26_0x46c29a,{options:_0x2ee6d4,args:_0x582029,tdx:_0x4d21e5}=_0x2e9a15,_0x15333a=_0x582029[0x0],_0x581048=_0x2ee6d4,_0x44cd7b=_0x581048[_0x466060(0x1a8)],_0x520f54=_0x581048[_0x466060(0x18b)]!==undefined?Number(_0x581048[_0x466060(0x18b)]):undefined;if(_0x2ee6d4[_0x466060(0x1b3)]){console[_0x466060(0x204)](_0x466060(0x1fa)+_0x15333a);if(_0x44cd7b)console[_0x466060(0x204)](_0x466060(0x1b7)+_0x44cd7b);if(_0x520f54)console['error'](_0x466060(0x19a)+_0x520f54);}const _0x8d7b9f=await withSpinner(_0x466060(0x1ec),()=>_0x4d21e5[_0x466060(0x1d9)][_0x466060(0x1bb)](_0x15333a,{'time':_0x44cd7b,'num':_0x520f54}),{'verbose':_0x2ee6d4[_0x466060(0x1b3)]}),_0x2c24d7=_0x8d7b9f[_0x466060(0x18e)][_0x466060(0x1e5)];console[_0x466060(0x204)](_0x466060(0x1db)+_0x2c24d7[_0x466060(0x1ed)]+_0x466060(0x18d)+(_0x2c24d7[_0x466060(0x1ed)]!==0x1?'s':'')+'\x20created');for(const _0x38d48e of _0x2c24d7){console[_0x466060(0x204)](_0x466060(0x1e2)+_0x38d48e[_0x466060(0x20c)]);}return await handleSDKOutput(_0x2c24d7,_0x2ee6d4),0x0;}}function a26_0x2c80(){const _0x4d08eb=['max','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','463668pcWacx','ies','1035384KcuZDA','execute','30sVdttV','d\x20ago','from','Searching\x20scheduled\x20queries\x20matching\x20\x22','engine_version','Running\x20schedule:\x20','has_next_page','description','database','next_run_at','(unnamed)','cyan','output','schedule:update','list','error','red','\x20(showing\x20','m\x20ago','\x20\x20β\x20','status','Delete\x20a\x20scheduled\x20query','Getting\x20schedule\x20history...','job_id','priority','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20\x20Cron:\x20','in\x20','Showing\x20first\x20','repeat','statusIcon','Query\x20file\x20is\x20empty','json','Getting\x20schedule\x20details...','num','nextRun','\x20job','data','result','Show\x20schedule\x20details','end_at','name','schedule:delete','map','abs','Found\x20','queryUrl','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','args','\x20\x20Num:\x20','Creating\x20schedule...','utf-8','714952tYZrKm','entries','file','toLocaleDateString','table','\x20execution','\x20(use\x20--limit\x20to\x20see\x20more)','scheduled_at','yes','\x22...','retryLimit','time','Updating\x20schedule:\x20','log','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Update\x20a\x20scheduled\x20query','history','updated_at','padEnd','show','update','tsv','verbose','3187548GCCtqN','577990mmnson','last_job','\x20\x20Time:\x20','\x20\x20Database:\x20','listQueries','18808yPcVgu','run','user_name','time_zone','1435308TUHkdX','format','Creating\x20schedule:\x20','lastRun','schedule:create','Updating\x20schedule...','\x20\x20Type:\x20','dim','never','INVALID_ARGUMENT','timezone','Create\x20a\x20scheduled\x20query','π
\x20','cron','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Schedule\x20updated:\x20','9KStJdx','green','Deleting\x20schedule...','limit','ended_at','join','schedule:list','substring','Run\x20a\x20scheduled\x20query\x20immediately','pagination','engineVersion','schedules','round','Schedule\x20run\x20submitted:\x20','delay','retry_limit','count','type','getTime','keys','\x20\x20Job\x20ID:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20\x20Timezone:\x20','jobs','Listing\x20scheduled\x20queries...','created_at','validate','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','create','just\x20now','Running\x20schedule...','length','Cancelled'];a26_0x2c80=function(){return _0x4d08eb;};return a26_0x2c80();}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x46c29a(0x192)]='schedule:history';[a26_0x46c29a(0x1fc)]='Show\x20schedule\x20execution\x20history';['validate'](_0x2b49c0){const _0x5ab87e=a26_0x46c29a,_0x142ac5=_0x2b49c0[_0x5ab87e(0x199)][0x0];if(!_0x142ac5)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async['execute'](_0x95460e){const _0x12f5e9=a26_0x46c29a,{options:_0x1e534a,args:_0x54ef34,tdx:_0x1c79e2}=_0x95460e,_0x3013e5=_0x54ef34[0x0],_0x3603db=_0x1e534a,_0x47532a=_0x3603db[_0x12f5e9(0x1f7)]!==undefined?Number(_0x3603db[_0x12f5e9(0x1f7)]):undefined,_0x29a8f2=_0x3603db['to']!==undefined?Number(_0x3603db['to']):undefined,_0x3ff981=await withSpinner(_0x12f5e9(0x20b),()=>_0x1c79e2[_0x12f5e9(0x1d9)]['history'](_0x3013e5,{'from':_0x47532a,'to':_0x29a8f2}),{'verbose':_0x1e534a[_0x12f5e9(0x1b3)]}),_0x158e03=_0x3ff981['data'];console['error'](_0x12f5e9(0x196)+_0x158e03[_0x12f5e9(0x1de)]+_0x12f5e9(0x1a2)+(_0x158e03[_0x12f5e9(0x1de)]!==0x1?'s':'')+_0x12f5e9(0x206)+_0x158e03[_0x12f5e9(0x1f7)]+'-'+_0x158e03['to']+')');const _0x17502c=_0x158e03[_0x12f5e9(0x1ad)][_0x12f5e9(0x194)](_0x5c05f3=>({'job_id':_0x5c05f3[_0x12f5e9(0x20c)],'type':_0x5c05f3[_0x12f5e9(0x1df)],'status':_0x5c05f3[_0x12f5e9(0x209)],'scheduled_at':_0x5c05f3[_0x12f5e9(0x1a4)],'created_at':_0x5c05f3['created_at'],'start_at':_0x5c05f3['start_at'],'end_at':_0x5c05f3[_0x12f5e9(0x191)]}));return await handleSDKOutput(_0x17502c,_0x1e534a),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x1ea2db=a27_0x35d2;(function(_0x34cc29,_0x43f9e4){const _0x5348cf=a27_0x35d2,_0x16945e=_0x34cc29();while(!![]){try{const _0x2c0052=parseInt(_0x5348cf(0x1e0))/0x1*(-parseInt(_0x5348cf(0x274))/0x2)+-parseInt(_0x5348cf(0x268))/0x3+-parseInt(_0x5348cf(0x263))/0x4+-parseInt(_0x5348cf(0x235))/0x5*(parseInt(_0x5348cf(0x222))/0x6)+-parseInt(_0x5348cf(0x210))/0x7+parseInt(_0x5348cf(0x219))/0x8+parseInt(_0x5348cf(0x24e))/0x9;if(_0x2c0052===_0x43f9e4)break;else _0x16945e['push'](_0x16945e['shift']());}catch(_0x365394){_0x16945e['push'](_0x16945e['shift']());}}}(a27_0x1c77,0x2cfc9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a27_0x1c77(){const _0x3950bd=['Use:\x20tdx\x20ps\x20view','segment:desc','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','elapsedTimeMillis','2KIBntP','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x27...','parentFolder','14159GmWnxV','Resolved\x20type:\x20','getParent','segment:folder:show','Use:\x20tdx\x20ps\x20view\x20-w','data','\x20Opening\x20','\x20\x20Folder\x20path:\x20','Use:\x20tdx\x20ps\x20desc','parentId','Creating\x20folder\x20\x27','β\x20Query\x20failed\x20[','β\x20Found\x20','information_schema','\x20\x20Cause:\x20','Parent\x20ID:\x20','SEGMENT_NOT_FOUND','in\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20path\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Resolved\x20parent\x20ID:\x20','segmentPath','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','parentSegment','format','cause','Target\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27\x20with\x20ID:\x20','jobId','Resolving\x20parent\x20segment\x20\x27','toLocaleString','INVALID_ARGUMENT','Use:\x20tdx\x20ps\x20show','Fetching\x20SQL\x20for\x20segment...','processedRows','getSegmentSQL','cyan','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','query','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','segment:folder:list','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','139930JmWRyd','Examples:','name','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','segment:sql','/e/','replace','Fetching\x20folder\x20\x27','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','2279256tDuBWF','getFolder','folderPath','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20sql\x20<name>','site','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','url','trim','373320hQSkmA','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','length','fullPath','Usage:\x20tdx\x20sg\x20show\x20<name>','execute','\x20\x20Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Site:\x20','description','verbose','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','setJobId','error','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','5NaIEhA','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','folderId','resolveFolderId','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','stats','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','jsonl','segment:folder:create','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','/app/ps/','resolvePathToResource','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Fetching\x20parent\x20segment\x20details...','getSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20','includes','parent','3478473OjSFYL','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','SEGMENT_FOLDER_NOT_FOUND','Use:\x20tdx\x20ps\x20sql','Resolving\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:view','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','resolveParentId','segmentName','Segment\x20ID:\x20','segment:show','Options:','folder','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20name:\x20','segment','createFolder','103960oTeMAg','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segmentId','1094340vdMihz','type','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','message','\x20\x20Segment\x20name:\x20'];a27_0x1c77=function(){return _0x3950bd;};return a27_0x1c77();}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x5807c4 from'chalk';async function resolveSegmentTarget(_0x3604fe,_0x3260e1,_0x5800b9){const _0x5afe7a=a27_0x35d2;if(isYamlFilePath(_0x3604fe))try{const _0x2aae8e=await resolveYamlFilePath(_0x3604fe);return _0x5800b9&&(console[_0x5afe7a(0x232)]('Resolved\x20YAML\x20file:\x20'+_0x3604fe),console['error'](_0x5afe7a(0x22a)+_0x2aae8e[_0x5afe7a(0x1fc)]),console[_0x5afe7a(0x232)](_0x5afe7a(0x26e)+_0x2aae8e[_0x5afe7a(0x25a)]),console[_0x5afe7a(0x232)](_0x5afe7a(0x1e7)+(_0x2aae8e[_0x5afe7a(0x21b)]||'(root)')),console[_0x5afe7a(0x232)](_0x5afe7a(0x1f9)+_0x2aae8e['fullPath'])),_0x2aae8e[_0x5afe7a(0x227)];}catch(_0x249440){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5afe7a(0x20f)+_0x249440[_0x5afe7a(0x26d)]);}if(!_0x3260e1)throw new SDKError(ErrorCode[_0x5afe7a(0x205)],_0x5afe7a(0x213));return _0x3260e1+'/'+_0x3604fe;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x1ea2db(0x212)]='segment:describe';[a27_0x1ea2db(0x22d)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x1ea2db(0x229)](_0x211e44){const _0x2cb4c5=a27_0x1ea2db,{options:_0x258d71,args:_0x54d3a8,tdx:_0xcfca04}=_0x211e44,_0x22a574=_0x54d3a8[0x0],_0x563dcb=!_0x22a574&&!!_0x258d71[_0x2cb4c5(0x1fc)],_0x1ce97e=_0x22a574||_0x258d71[_0x2cb4c5(0x1fc)];if(!_0x1ce97e)return console[_0x2cb4c5(0x232)](_0x2cb4c5(0x258)),console[_0x2cb4c5(0x232)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2cb4c5(0x232)](_0x2cb4c5(0x211)),console[_0x2cb4c5(0x232)](_0x2cb4c5(0x1dd)),console[_0x2cb4c5(0x232)](_0x2cb4c5(0x26a)),console[_0x2cb4c5(0x232)](_0x2cb4c5(0x265)),console[_0x2cb4c5(0x232)](_0x2cb4c5(0x26b)),0x1;try{const _0x52cbdd=_0x258d71[_0x2cb4c5(0x1f8)];let _0x4252f0=_0x1ce97e;!_0x563dcb&&_0x52cbdd&&!_0x1ce97e[_0x2cb4c5(0x24c)]('/')&&(_0x4252f0=_0x52cbdd+'/'+_0x1ce97e,_0x258d71[_0x2cb4c5(0x22e)]&&console[_0x2cb4c5(0x232)](_0x2cb4c5(0x236)+_0x4252f0));const _0x2a7ef0=await withSpinner(_0x2cb4c5(0x1f3)+_0x4252f0+_0x2cb4c5(0x1de),()=>_0xcfca04[_0x2cb4c5(0x261)]['resolvePathToResource'](_0x4252f0),{'verbose':_0x258d71[_0x2cb4c5(0x22e)]}),_0x1e332b=_0x2a7ef0['data'];_0x258d71[_0x2cb4c5(0x22e)]&&(console[_0x2cb4c5(0x232)](_0x2cb4c5(0x1e1)+_0x1e332b['type']),console['error'](_0x2cb4c5(0x1ef)+_0x1e332b[_0x2cb4c5(0x1e9)]),_0x1e332b[_0x2cb4c5(0x238)]&&console['error']('Folder\x20ID:\x20'+_0x1e332b[_0x2cb4c5(0x238)]),_0x1e332b['segmentId']&&console['error'](_0x2cb4c5(0x25b)+_0x1e332b[_0x2cb4c5(0x267)]));if(_0x1e332b[_0x2cb4c5(0x269)]==='parent'){const _0x192afa=await withSpinner(_0x2cb4c5(0x248),()=>_0xcfca04[_0x2cb4c5(0x261)][_0x2cb4c5(0x1e2)](_0x1e332b[_0x2cb4c5(0x1e9)]),{'verbose':_0x258d71[_0x2cb4c5(0x22e)]});await handleSingleObjectOutput(_0x192afa[_0x2cb4c5(0x1e5)],_0x258d71);}else{if(_0x1e332b[_0x2cb4c5(0x269)]===_0x2cb4c5(0x25e)){if(!_0x1e332b['folderId'])throw new SDKError(ErrorCode[_0x2cb4c5(0x251)],_0x2cb4c5(0x25f));const _0x3e104b=await withSpinner(_0x2cb4c5(0x23a),()=>_0xcfca04[_0x2cb4c5(0x261)][_0x2cb4c5(0x21a)](_0x1e332b[_0x2cb4c5(0x238)]),{'verbose':_0x258d71['verbose']});await handleSingleObjectOutput(_0x3e104b[_0x2cb4c5(0x1e5)],_0x258d71);}else{if(_0x1e332b[_0x2cb4c5(0x269)]==='segment'){if(!_0x1e332b[_0x2cb4c5(0x267)])throw new SDKError(ErrorCode[_0x2cb4c5(0x1f0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x43d99e=await withSpinner('Fetching\x20segment\x20details...',()=>_0xcfca04['segment']['getSegment'](_0x1e332b[_0x2cb4c5(0x1e9)],_0x1e332b['segmentId']),{'verbose':_0x258d71[_0x2cb4c5(0x22e)]});await handleSingleObjectOutput(_0x43d99e[_0x2cb4c5(0x1e5)],_0x258d71);}}}return 0x0;}catch(_0x2a3203){if(_0x2a3203 instanceof SDKError)return console[_0x2cb4c5(0x232)](_0x2cb4c5(0x24b)+_0x2a3203[_0x2cb4c5(0x26d)]),_0x2a3203['cause']&&console[_0x2cb4c5(0x232)](_0x2cb4c5(0x1ee)+_0x2a3203['cause']),0x1;throw _0x2a3203;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x25c);[a27_0x1ea2db(0x22d)]=a27_0x1ea2db(0x247);async[a27_0x1ea2db(0x229)](_0x2deebc){const _0xea6afe=a27_0x1ea2db,{options:_0xb2cc8b,args:_0x5a7589,tdx:_0x38382d}=_0x2deebc,_0x585e5a=_0x5a7589[0x0];if(!_0x585e5a)return console[_0xea6afe(0x232)](_0xea6afe(0x218)),console['error'](_0xea6afe(0x228)),console['error'](_0xea6afe(0x22f)),console[_0xea6afe(0x232)](_0xea6afe(0x211)),console[_0xea6afe(0x232)](_0xea6afe(0x1fb)),console[_0xea6afe(0x232)](_0xea6afe(0x250)),0x1;try{const _0x8cc963=_0xb2cc8b[_0xea6afe(0x1fc)],_0x2fc32e=await resolveSegmentTarget(_0x585e5a,_0x8cc963,_0xb2cc8b[_0xea6afe(0x22e)]);_0xb2cc8b[_0xea6afe(0x22e)]&&console[_0xea6afe(0x232)]('Target\x20path:\x20'+_0x2fc32e);const _0xa84f02=await withSpinner('Resolving\x20\x27'+_0x585e5a+'\x27...',()=>_0x38382d[_0xea6afe(0x261)]['resolvePathToResource'](_0x2fc32e),{'verbose':_0xb2cc8b['verbose']}),_0x2f773f=_0xa84f02[_0xea6afe(0x1e5)];_0xb2cc8b['verbose']&&(console[_0xea6afe(0x232)]('Resolved\x20type:\x20'+_0x2f773f[_0xea6afe(0x269)]),console[_0xea6afe(0x232)]('Parent\x20ID:\x20'+_0x2f773f['parentId']));if(_0x2f773f['type']===_0xea6afe(0x25e))return console[_0xea6afe(0x232)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0xea6afe(0x240)),0x1;if(_0x2f773f[_0xea6afe(0x269)]===_0xea6afe(0x24d))return console[_0xea6afe(0x232)](_0xea6afe(0x1f2)),console[_0xea6afe(0x232)](_0xea6afe(0x206)),0x1;if(!_0x2f773f['segmentId'])throw new SDKError(ErrorCode[_0xea6afe(0x1f0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2dce7b=await withSpinner(_0xea6afe(0x207),()=>_0x38382d[_0xea6afe(0x261)][_0xea6afe(0x209)](_0x2f773f[_0xea6afe(0x1e9)],_0x2f773f[_0xea6afe(0x267)]),{'verbose':_0xb2cc8b[_0xea6afe(0x22e)]});let _0x5c1cc2=_0x2dce7b[_0xea6afe(0x1e5)];const _0x4ce88f=resolveLimit(_0xb2cc8b['limit'],DEFAULT_DISPLAY_LIMIT),_0x153152=/\bLIMIT\s+\d+/i['test'](_0x5c1cc2);!_0x153152&&(_0x5c1cc2=_0x5c1cc2[_0xea6afe(0x221)]()[_0xea6afe(0x216)](/;+$/,''),_0x5c1cc2='SELECT\x20*\x20FROM\x20(\x0a'+_0x5c1cc2+_0xea6afe(0x230)+_0x4ce88f);_0xb2cc8b['verbose']&&console[_0xea6afe(0x232)]('SQL\x20query:\x0a'+_0x5c1cc2);const _0x27b4b9=await withProgressSpinner('Executing\x20segment\x20query...',async _0x264033=>{const _0x54cb93=_0xea6afe,_0x6b1c5=await _0x38382d[_0x54cb93(0x20c)][_0x54cb93(0x229)](_0x5c1cc2,{'catalog':'td','schema':_0x54cb93(0x1ed),'onJobId':_0x49be2b=>{const _0x480ef8=_0x54cb93;_0x264033[_0x480ef8(0x231)](_0x49be2b);}});return _0x6b1c5;},{'verbose':_0xb2cc8b[_0xea6afe(0x22e)]}),_0xc33500=_0x27b4b9[_0xea6afe(0x1e5)],_0x2edbf2=_0xc33500[_0xea6afe(0x202)]?'\x20[Job\x20ID:\x20'+_0xc33500[_0xea6afe(0x202)]+']':'';return console[_0xea6afe(0x232)]('β\x20Query\x20completed:\x20Processed\x20'+_0xc33500['stats'][_0xea6afe(0x208)][_0xea6afe(0x204)]()+'\x20rows\x20'+(_0xea6afe(0x1f1)+formatElapsed(_0xc33500[_0xea6afe(0x23c)][_0xea6afe(0x273)])+_0x2edbf2)),await handleQueryOutput(_0xc33500,_0xb2cc8b),0x0;}catch(_0xe7224){if(_0xe7224 instanceof SDKError)return console[_0xea6afe(0x232)](_0xea6afe(0x1eb)+_0xe7224['code']+']'),console[_0xea6afe(0x232)]('\x0a'+_0xe7224[_0xea6afe(0x26d)]),0x1;throw _0xe7224;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x20e);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a27_0x1ea2db(0x229)](_0x3cd416){const _0x27a254=a27_0x1ea2db,{options:_0x331f5f,args:_0x40d963,tdx:_0x32ba1e}=_0x3cd416;if(_0x40d963['length']===0x0)return console[_0x27a254(0x232)](_0x27a254(0x22b)),console['error'](_0x27a254(0x272)),0x1;const _0x404c50=_0x40d963[0x0];try{_0x331f5f['verbose']&&(console['error'](_0x27a254(0x22c)+_0x331f5f[_0x27a254(0x21e)]),console['error']('Parent\x20name:\x20'+_0x404c50));const _0x3ee8d4=await withSpinner(_0x27a254(0x203)+_0x404c50+_0x27a254(0x1de),()=>_0x32ba1e['segment'][_0x27a254(0x259)](_0x404c50),{'verbose':_0x331f5f['verbose']}),_0x5af28d=_0x3ee8d4[_0x27a254(0x1e5)];_0x331f5f[_0x27a254(0x22e)]&&console['error'](_0x27a254(0x1f7)+_0x5af28d);const _0x158ec6=await withSpinner(_0x27a254(0x224)+_0x404c50+_0x27a254(0x1de),()=>_0x32ba1e[_0x27a254(0x261)]['listFolders'](_0x5af28d),{'verbose':_0x331f5f[_0x27a254(0x22e)]}),_0x51568d=_0x158ec6[_0x27a254(0x1e5)];return console[_0x27a254(0x232)](_0x27a254(0x1ec)+_0x51568d['length']+'\x20folder'+(_0x51568d[_0x27a254(0x226)]!==0x1?'s':'')),await handleSDKOutput(_0x51568d,_0x331f5f),0x0;}catch(_0x2743be){if(_0x2743be instanceof SDKError)return console['error'](_0x27a254(0x24b)+_0x2743be[_0x27a254(0x26d)]),_0x2743be['cause']&&console[_0x27a254(0x232)](_0x27a254(0x1ee)+_0x2743be[_0x27a254(0x1fe)]),0x1;throw _0x2743be;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x1e3);[a27_0x1ea2db(0x22d)]='Show\x20segment\x20folder\x20details';async[a27_0x1ea2db(0x229)](_0x254471){const _0x5bf967=a27_0x1ea2db,{options:_0xcf9683,args:_0x4d9b7f,tdx:_0x3d14b6}=_0x254471;if(_0x4d9b7f['length']===0x0)return console[_0x5bf967(0x232)](_0x5bf967(0x233)),console[_0x5bf967(0x232)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0xc86d6b,childId:_0x292f4f}=parseSegmentRef(_0x4d9b7f[0x0]);_0xcf9683['verbose']&&(console[_0x5bf967(0x232)](_0x5bf967(0x22c)+_0xcf9683[_0x5bf967(0x21e)]),console[_0x5bf967(0x232)]('Parent\x20name:\x20'+_0xc86d6b),_0x292f4f&&console['error']('Folder\x20name:\x20'+_0x292f4f));if(!_0x292f4f)return console[_0x5bf967(0x232)](_0x5bf967(0x255)),0x1;const _0x25fa48=await withSpinner(_0x5bf967(0x203)+_0xc86d6b+_0x5bf967(0x1de),()=>_0x3d14b6[_0x5bf967(0x261)][_0x5bf967(0x259)](_0xc86d6b),{'verbose':_0xcf9683['verbose']}),_0x2946ec=_0x25fa48[_0x5bf967(0x1e5)];_0xcf9683['verbose']&&console[_0x5bf967(0x232)]('Resolved\x20parent\x20ID:\x20'+_0x2946ec);const _0x50d576=await withSpinner(_0x5bf967(0x243)+_0x292f4f+_0x5bf967(0x1de),()=>_0x3d14b6[_0x5bf967(0x261)][_0x5bf967(0x239)](_0x2946ec,_0x292f4f),{'verbose':_0xcf9683[_0x5bf967(0x22e)]}),_0x1e2c1a=_0x50d576['data'];_0xcf9683[_0x5bf967(0x22e)]&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x1e2c1a);const _0x156f57=await withSpinner(_0x5bf967(0x217)+_0x292f4f+_0x5bf967(0x1de),()=>_0x3d14b6[_0x5bf967(0x261)][_0x5bf967(0x21a)](_0x1e2c1a),{'verbose':_0xcf9683[_0x5bf967(0x22e)]});return await handleSDKOutput([_0x156f57[_0x5bf967(0x1e5)]],_0xcf9683),0x0;}catch(_0x3dbb07){if(_0x3dbb07 instanceof SDKError)return console['error'](_0x5bf967(0x24b)+_0x3dbb07['message']),_0x3dbb07['cause']&&console['error'](_0x5bf967(0x1ee)+_0x3dbb07[_0x5bf967(0x1fe)]),0x1;throw _0x3dbb07;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x214);[a27_0x1ea2db(0x22d)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x1ea2db(0x229)](_0x2be02c){const _0x6e1d9b=a27_0x1ea2db,{options:_0x2cb81b,args:_0x507457,tdx:_0x160f25}=_0x2be02c,_0x5e84b3=_0x507457[0x0];if(!_0x5e84b3)return console['error'](_0x6e1d9b(0x218)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x21d)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x24a)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x211)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x244)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x20b)),0x1;try{const _0x3d2a36=_0x2cb81b[_0x6e1d9b(0x1fc)],_0x226dd5=await resolveSegmentTarget(_0x5e84b3,_0x3d2a36,_0x2cb81b[_0x6e1d9b(0x22e)]);_0x2cb81b['verbose']&&console[_0x6e1d9b(0x232)](_0x6e1d9b(0x1ff)+_0x226dd5);const _0xd49cb1=await withSpinner(_0x6e1d9b(0x253)+_0x5e84b3+_0x6e1d9b(0x1de),()=>_0x160f25[_0x6e1d9b(0x261)][_0x6e1d9b(0x246)](_0x226dd5),{'verbose':_0x2cb81b[_0x6e1d9b(0x22e)]}),_0x271239=_0xd49cb1['data'];_0x2cb81b[_0x6e1d9b(0x22e)]&&(console['error']('Resolved\x20type:\x20'+_0x271239[_0x6e1d9b(0x269)]),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x1ef)+_0x271239['parentId']));if(_0x271239[_0x6e1d9b(0x269)]===_0x6e1d9b(0x25e))return console[_0x6e1d9b(0x232)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x23b)),0x1;if(_0x271239[_0x6e1d9b(0x269)]===_0x6e1d9b(0x24d))return console[_0x6e1d9b(0x232)](_0x6e1d9b(0x23d)),console[_0x6e1d9b(0x232)](_0x6e1d9b(0x252)),0x1;if(!_0x271239[_0x6e1d9b(0x267)])throw new SDKError(ErrorCode[_0x6e1d9b(0x1f0)],_0x6e1d9b(0x1f4));const _0x1dc1d2=await withSpinner(_0x6e1d9b(0x207),()=>_0x160f25[_0x6e1d9b(0x261)][_0x6e1d9b(0x209)](_0x271239[_0x6e1d9b(0x1e9)],_0x271239['segmentId']),{'verbose':_0x2cb81b[_0x6e1d9b(0x22e)]}),_0x2b184a=_0x1dc1d2[_0x6e1d9b(0x1e5)];return _0x2cb81b[_0x6e1d9b(0x1fd)]==='json'||_0x2cb81b[_0x6e1d9b(0x1fd)]===_0x6e1d9b(0x23e)?await handleSDKOutput([{'sql':_0x2b184a}],_0x2cb81b):console['log'](_0x2b184a),0x0;}catch(_0x45d1f1){if(_0x45d1f1 instanceof SDKError)return console[_0x6e1d9b(0x232)](_0x6e1d9b(0x24b)+_0x45d1f1[_0x6e1d9b(0x26d)]),_0x45d1f1[_0x6e1d9b(0x1fe)]&&console[_0x6e1d9b(0x232)]('\x20\x20Cause:\x20'+_0x45d1f1[_0x6e1d9b(0x1fe)]),0x1;throw _0x45d1f1;}}}function a27_0x35d2(_0x1f16f7,_0x2c1a72){_0x1f16f7=_0x1f16f7-0x1dd;const _0x1c77ff=a27_0x1c77();let _0x35d25d=_0x1c77ff[_0x1f16f7];return _0x35d25d;}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x23f);[a27_0x1ea2db(0x22d)]='Create\x20segment\x20folder\x20for\x20organization';async[a27_0x1ea2db(0x229)](_0x93f9cd){const _0x50f4b1=a27_0x1ea2db,{options:_0x1ecf55,args:_0x7075b,tdx:_0x5dd87f}=_0x93f9cd,_0x420e1d=_0x1ecf55;if(_0x7075b[_0x50f4b1(0x226)]<0x2)return console['error'](_0x50f4b1(0x271)),console[_0x50f4b1(0x232)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x4e2b79=_0x7075b[0x0],_0x18ba5d=_0x7075b[0x1];_0x420e1d[_0x50f4b1(0x22e)]&&(console[_0x50f4b1(0x232)](_0x50f4b1(0x22c)+_0x420e1d[_0x50f4b1(0x21e)]),console['error']('Parent\x20segment:\x20'+_0x4e2b79),console[_0x50f4b1(0x232)](_0x50f4b1(0x260)+_0x18ba5d));let _0x18be80;if(_0x420e1d[_0x50f4b1(0x1df)]){const _0x235ca8=_0x420e1d[_0x50f4b1(0x1df)],_0xf065d7=await withSpinner(_0x50f4b1(0x203)+_0x4e2b79+_0x50f4b1(0x1de),()=>_0x5dd87f[_0x50f4b1(0x261)][_0x50f4b1(0x259)](_0x4e2b79),{'verbose':_0x420e1d['verbose']}),_0x25cad5=_0xf065d7[_0x50f4b1(0x1e5)],_0x2f8132=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x235ca8+_0x50f4b1(0x1de),()=>_0x5dd87f[_0x50f4b1(0x261)]['resolveFolderId'](_0x25cad5,_0x235ca8),{'verbose':_0x420e1d[_0x50f4b1(0x22e)]});_0x18be80=_0x2f8132[_0x50f4b1(0x1e5)],_0x420e1d[_0x50f4b1(0x22e)]&&console[_0x50f4b1(0x232)](_0x50f4b1(0x1f6)+_0x18be80);}const _0x435690={'name':_0x18ba5d,'description':_0x420e1d['description'],'parentFolderId':_0x18be80},_0x3d6b9a=await withSpinner(_0x50f4b1(0x1ea)+_0x18ba5d+_0x50f4b1(0x1de),()=>_0x5dd87f['segment'][_0x50f4b1(0x262)](_0x4e2b79,_0x435690),{'verbose':_0x420e1d['verbose']}),_0x3ebb97=_0x3d6b9a[_0x50f4b1(0x1e5)];return console['error']('β\x20Created\x20folder\x20\x27'+_0x3ebb97[_0x50f4b1(0x212)]+_0x50f4b1(0x201)+_0x3ebb97['id']),await handleSDKOutput([_0x3ebb97],_0x420e1d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x256);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x1ea2db(0x229)](_0x248f52){const _0x15bcd2=a27_0x1ea2db,{options:_0x3e658b,args:_0x2a61ee,tdx:_0x2764cd}=_0x248f52,_0x1c41a4=_0x2a61ee[0x0];if(!_0x1c41a4)return console[_0x15bcd2(0x232)](_0x15bcd2(0x225)),console[_0x15bcd2(0x232)](_0x15bcd2(0x254)),console['error'](_0x15bcd2(0x237)),console[_0x15bcd2(0x232)](_0x15bcd2(0x25d)),console[_0x15bcd2(0x232)](_0x15bcd2(0x21f)),console[_0x15bcd2(0x232)](_0x15bcd2(0x211)),console['error'](_0x15bcd2(0x242)),console[_0x15bcd2(0x232)](_0x15bcd2(0x234)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x15bcd2(0x232)](_0x15bcd2(0x200)),0x1;try{const _0x467ad0=_0x3e658b['parentSegment'],_0x15e9bc=await resolveSegmentTarget(_0x1c41a4,_0x467ad0,_0x3e658b[_0x15bcd2(0x22e)]);_0x3e658b[_0x15bcd2(0x22e)]&&console[_0x15bcd2(0x232)](_0x15bcd2(0x1ff)+_0x15e9bc);const _0x2f022a=await withSpinner(_0x15bcd2(0x253)+_0x1c41a4+_0x15bcd2(0x1de),()=>_0x2764cd['segment'][_0x15bcd2(0x246)](_0x15e9bc),{'verbose':_0x3e658b['verbose']}),_0x469056=_0x2f022a[_0x15bcd2(0x1e5)];_0x3e658b[_0x15bcd2(0x22e)]&&(console[_0x15bcd2(0x232)](_0x15bcd2(0x1e1)+_0x469056['type']),console['error']('Parent\x20ID:\x20'+_0x469056[_0x15bcd2(0x1e9)]),_0x469056[_0x15bcd2(0x238)]&&console[_0x15bcd2(0x232)](_0x15bcd2(0x1f5)+_0x469056[_0x15bcd2(0x238)]),_0x469056[_0x15bcd2(0x267)]&&console[_0x15bcd2(0x232)](_0x15bcd2(0x25b)+_0x469056[_0x15bcd2(0x267)]));if(_0x3e658b['web']){if(_0x469056[_0x15bcd2(0x269)]===_0x15bcd2(0x25e))return console[_0x15bcd2(0x232)](_0x15bcd2(0x266)),0x1;if(_0x469056[_0x15bcd2(0x269)]===_0x15bcd2(0x24d))return console[_0x15bcd2(0x232)](_0x15bcd2(0x21c)),console[_0x15bcd2(0x232)](_0x15bcd2(0x1e4)),0x1;if(!_0x469056[_0x15bcd2(0x267)])throw new SDKError(ErrorCode[_0x15bcd2(0x1f0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5e68b8=getConsoleNextUrl(_0x3e658b[_0x15bcd2(0x21e)],_0x15bcd2(0x245)+_0x469056['parentId']+_0x15bcd2(0x215)+_0x469056[_0x15bcd2(0x267)]);return console[_0x15bcd2(0x232)](a27_0x5807c4['green']('β')+_0x15bcd2(0x1e6)+a27_0x5807c4[_0x15bcd2(0x20a)](_0x5e68b8)),openBrowser(_0x5e68b8),0x0;}if(_0x469056['type']==='folder'){if(!_0x469056[_0x15bcd2(0x238)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x15bcd2(0x25f));const _0x1a352c=await withSpinner(_0x15bcd2(0x23a),()=>_0x2764cd[_0x15bcd2(0x261)][_0x15bcd2(0x21a)](_0x469056[_0x15bcd2(0x238)]),{'verbose':_0x3e658b[_0x15bcd2(0x22e)]});await handleSingleObjectOutput(_0x1a352c[_0x15bcd2(0x1e5)],_0x3e658b);}else{if(_0x469056[_0x15bcd2(0x269)]===_0x15bcd2(0x261)){if(!_0x469056[_0x15bcd2(0x267)])throw new SDKError(ErrorCode[_0x15bcd2(0x1f0)],_0x15bcd2(0x1f4));const _0x8a9a9f=await withSpinner(_0x15bcd2(0x24f),()=>_0x2764cd[_0x15bcd2(0x261)][_0x15bcd2(0x249)](_0x469056[_0x15bcd2(0x1e9)],_0x469056[_0x15bcd2(0x267)]),{'verbose':_0x3e658b[_0x15bcd2(0x22e)]}),_0xd05ae5=getConsoleNextUrl(_0x3e658b[_0x15bcd2(0x21e)],_0x15bcd2(0x245)+_0x469056[_0x15bcd2(0x1e9)]+'/e/'+_0x469056[_0x15bcd2(0x267)]),_0x143daa=_0x8a9a9f[_0x15bcd2(0x1e5)];_0x143daa[_0x15bcd2(0x220)]=_0xd05ae5,await handleSingleObjectOutput(_0x143daa,_0x3e658b);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x15bcd2(0x232)](_0x15bcd2(0x26f)),0x1;}return 0x0;}catch(_0x522611){if(_0x522611 instanceof SDKError)return console[_0x15bcd2(0x232)](_0x15bcd2(0x24b)+_0x522611[_0x15bcd2(0x26d)]),_0x522611['cause']&&console[_0x15bcd2(0x232)]('\x20\x20Cause:\x20'+_0x522611[_0x15bcd2(0x1fe)]),0x1;throw _0x522611;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x1ea2db(0x212)]=a27_0x1ea2db(0x270);[a27_0x1ea2db(0x22d)]=a27_0x1ea2db(0x264);async[a27_0x1ea2db(0x229)](_0x1e0f7c){const _0x3e6acb=a27_0x1ea2db,{options:_0x242c5a,args:_0x3fc1a1,tdx:_0x52311f}=_0x1e0f7c,_0x26a737=_0x3fc1a1[0x0];if(!_0x26a737)return console[_0x3e6acb(0x232)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3e6acb(0x232)](_0x3e6acb(0x257)),console[_0x3e6acb(0x232)](_0x3e6acb(0x20d)),console[_0x3e6acb(0x232)](_0x3e6acb(0x211)),console[_0x3e6acb(0x232)](_0x3e6acb(0x223)),console[_0x3e6acb(0x232)](_0x3e6acb(0x241)),0x1;try{const _0x981b7f=_0x242c5a[_0x3e6acb(0x1fc)],_0x37cade=await resolveSegmentTarget(_0x26a737,_0x981b7f,_0x242c5a['verbose']);_0x242c5a['verbose']&&console[_0x3e6acb(0x232)](_0x3e6acb(0x1ff)+_0x37cade);const _0xdf53df=await withSpinner(_0x3e6acb(0x253)+_0x26a737+_0x3e6acb(0x1de),()=>_0x52311f[_0x3e6acb(0x261)][_0x3e6acb(0x246)](_0x37cade),{'verbose':_0x242c5a[_0x3e6acb(0x22e)]}),_0x425f46=_0xdf53df[_0x3e6acb(0x1e5)];_0x242c5a[_0x3e6acb(0x22e)]&&(console[_0x3e6acb(0x232)](_0x3e6acb(0x1e1)+_0x425f46[_0x3e6acb(0x269)]),console[_0x3e6acb(0x232)]('Parent\x20ID:\x20'+_0x425f46[_0x3e6acb(0x1e9)]));if(_0x425f46['type']==='folder')return console['error'](_0x3e6acb(0x26c)),console[_0x3e6acb(0x232)](_0x3e6acb(0x23b)),0x1;if(_0x425f46[_0x3e6acb(0x269)]===_0x3e6acb(0x24d))return console['error'](_0x3e6acb(0x1fa)),console[_0x3e6acb(0x232)](_0x3e6acb(0x1e8)),0x1;if(!_0x425f46[_0x3e6acb(0x267)])throw new SDKError(ErrorCode[_0x3e6acb(0x1f0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3f3e64=await withSpinner(_0x3e6acb(0x207),()=>_0x52311f[_0x3e6acb(0x261)][_0x3e6acb(0x209)](_0x425f46[_0x3e6acb(0x1e9)],_0x425f46[_0x3e6acb(0x267)]),{'verbose':_0x242c5a[_0x3e6acb(0x22e)]}),_0x536703=_0x3f3e64[_0x3e6acb(0x1e5)],_0x40d2e3=await executeSchemaQuery(_0x536703,_0x52311f,_0x242c5a);return await handleQueryOutput(_0x40d2e3,_0x242c5a),0x0;}catch(_0x59b71d){if(_0x59b71d instanceof SDKError)return console['error'](_0x3e6acb(0x24b)+_0x59b71d['message']),_0x59b71d['cause']&&console['error'](_0x3e6acb(0x1ee)+_0x59b71d[_0x3e6acb(0x1fe)]),0x1;throw _0x59b71d;}}}
|
|
1
|
+
function a27_0x3211(){const _0x5c5b55=['includes','Resolved\x20folder\x20ID:\x20','(root)','site','Use:\x20tdx\x20ps\x20show','parentId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20\x27','Resolving\x20parent\x20segment\x20\x27','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','resolvePathToResource','Resolved\x20YAML\x20file:\x20','parentFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20Opening\x20','222805vDXfUb','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Show\x20segment\x20or\x20folder\x20details','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','9072OIFuev','fullPath','message','\x20rows\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','3982116BnCXwq','segment:view','getSegment','segment:show','Use:\x20tdx\x20ps\x20sql','toLocaleString','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20[Job\x20ID:\x20','Fetching\x20folder\x20details...','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','query','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Parent\x20ID:\x20','execute','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','segment:describe','cause','Resolved\x20relative\x20path\x20to:\x20','verbose','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','jsonl','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','log','Fetching\x20parent\x20segment\x20details...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','url','β\x20Query\x20completed:\x20Processed\x20','Resolving\x20parent\x20folder\x20\x27','Target\x20path:\x20','\x27\x20with\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','replace','\x20\x20Full\x20path:\x20','error','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20type:\x20','Examples:','Fetching\x20SQL\x20for\x20segment...','Site:\x20','stats','Show\x20child\x20segment\x20schema\x20(column\x20types)','parentSegment','\x20folder','Usage:\x20tdx\x20segment\x20describe\x20<path>','setJobId','Show\x20folder\x20or\x20child\x20segment\x20details','segment:folder:list','type','Use:\x20tdx\x20ps\x20view\x20-w','Segment\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Show\x20segment\x20folder\x20details','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20','test','β\x20Created\x20folder\x20\x27','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved\x20parent\x20ID:\x20','Resolving\x20path\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Segment\x20name:\x20','limit','folderId','INVALID_ARGUMENT','4328SpUACl','36IAfQDd','getFolder','folderPath','Options:','SELECT\x20*\x20FROM\x20(\x0a','jobId','folder','Folder\x20ID:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','parent','\x20\x20Folder\x20path:\x20','format','Resolving\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','code','cyan','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segmentName','getSegmentSQL','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','β\x20Found\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segment','segmentId','length','name','segmentPath','SEGMENT_NOT_FOUND','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','data','resolveFolderId','Folder\x20name:\x20','Parent\x20segment:\x20','\x20\x20Cause:\x20','1297422atjyja','890246RADLDl','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','listFolders','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:folder:show','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','3531360UPEffn','610686CjwjBL','\x20\x20Parent\x20segment:\x20','trim','/e/','Usage:\x20tdx\x20sg\x20sql\x20<name>'];a27_0x3211=function(){return _0x5c5b55;};return a27_0x3211();}const a27_0x1fbaef=a27_0x5ea1;(function(_0x2aa8fe,_0x4d5f56){const _0x45db06=a27_0x5ea1,_0x5be5a8=_0x2aa8fe();while(!![]){try{const _0x527a88=-parseInt(_0x45db06(0x1a3))/0x1+-parseInt(_0x45db06(0x198))/0x2+parseInt(_0x45db06(0x197))/0x3+-parseInt(_0x45db06(0x20d))/0x4*(-parseInt(_0x45db06(0x1be))/0x5)+parseInt(_0x45db06(0x1c7))/0x6+-parseInt(_0x45db06(0x1a2))/0x7+parseInt(_0x45db06(0x20c))/0x8*(parseInt(_0x45db06(0x1c2))/0x9);if(_0x527a88===_0x4d5f56)break;else _0x5be5a8['push'](_0x5be5a8['shift']());}catch(_0x3e2eb3){_0x5be5a8['push'](_0x5be5a8['shift']());}}}(a27_0x3211,0x75bc8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x4423df from'chalk';async function resolveSegmentTarget(_0x5f1850,_0x44375d,_0x80f6dd){const _0x4145d2=a27_0x5ea1;if(isYamlFilePath(_0x5f1850))try{const _0x43d904=await resolveYamlFilePath(_0x5f1850);return _0x80f6dd&&(console['error'](_0x4145d2(0x1b6)+_0x5f1850),console[_0x4145d2(0x1ec)](_0x4145d2(0x1a4)+_0x43d904[_0x4145d2(0x1f4)]),console[_0x4145d2(0x1ec)](_0x4145d2(0x208)+_0x43d904[_0x4145d2(0x220)]),console[_0x4145d2(0x1ec)](_0x4145d2(0x219)+(_0x43d904[_0x4145d2(0x20f)]||_0x4145d2(0x1aa))),console['error'](_0x4145d2(0x1eb)+_0x43d904[_0x4145d2(0x1c3)])),_0x43d904[_0x4145d2(0x1c3)];}catch(_0x543673){throw new SDKError(ErrorCode[_0x4145d2(0x20b)],_0x4145d2(0x1cd)+_0x543673[_0x4145d2(0x1c4)]);}if(!_0x44375d)throw new SDKError(ErrorCode[_0x4145d2(0x20b)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x44375d+'/'+_0x5f1850;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x1fbaef(0x1da);[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x1c0);async[a27_0x1fbaef(0x1d7)](_0x142735){const _0x1cc78a=a27_0x1fbaef,{options:_0x2376fc,args:_0x118c74,tdx:_0x4f018d}=_0x142735,_0x54350c=_0x118c74[0x0],_0xa4e726=!_0x54350c&&!!_0x2376fc[_0x1cc78a(0x1f4)],_0x2a27fb=_0x54350c||_0x2376fc[_0x1cc78a(0x1f4)];if(!_0x2a27fb)return console['error'](_0x1cc78a(0x1e9)),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x1f6)),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x1ef)),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x1d1)),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x207)),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x224)),console['error'](_0x1cc78a(0x200)),0x1;try{const _0x22a16c=_0x2376fc[_0x1cc78a(0x229)];let _0x2b39da=_0x2a27fb;!_0xa4e726&&_0x22a16c&&!_0x2a27fb[_0x1cc78a(0x1a8)]('/')&&(_0x2b39da=_0x22a16c+'/'+_0x2a27fb,_0x2376fc['verbose']&&console['error'](_0x1cc78a(0x1dc)+_0x2b39da));const _0xbf599e=await withSpinner(_0x1cc78a(0x206)+_0x2b39da+_0x1cc78a(0x1ff),()=>_0x4f018d['segment'][_0x1cc78a(0x1b5)](_0x2b39da),{'verbose':_0x2376fc[_0x1cc78a(0x1dd)]}),_0x1df4c8=_0xbf599e[_0x1cc78a(0x22c)];_0x2376fc[_0x1cc78a(0x1dd)]&&(console[_0x1cc78a(0x1ec)](_0x1cc78a(0x1ee)+_0x1df4c8['type']),console[_0x1cc78a(0x1ec)](_0x1cc78a(0x1d6)+_0x1df4c8['parentId']),_0x1df4c8[_0x1cc78a(0x20a)]&&console[_0x1cc78a(0x1ec)](_0x1cc78a(0x214)+_0x1df4c8[_0x1cc78a(0x20a)]),_0x1df4c8[_0x1cc78a(0x226)]&&console[_0x1cc78a(0x1ec)]('Segment\x20ID:\x20'+_0x1df4c8[_0x1cc78a(0x226)]));if(_0x1df4c8[_0x1cc78a(0x1fa)]===_0x1cc78a(0x218)){const _0x140e5a=await withSpinner(_0x1cc78a(0x1e2),()=>_0x4f018d[_0x1cc78a(0x225)]['getParent'](_0x1df4c8[_0x1cc78a(0x1ad)]),{'verbose':_0x2376fc[_0x1cc78a(0x1dd)]});await handleSingleObjectOutput(_0x140e5a['data'],_0x2376fc);}else{if(_0x1df4c8['type']===_0x1cc78a(0x213)){if(!_0x1df4c8[_0x1cc78a(0x20a)])throw new SDKError(ErrorCode[_0x1cc78a(0x19f)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4e4dab=await withSpinner(_0x1cc78a(0x1cf),()=>_0x4f018d[_0x1cc78a(0x225)][_0x1cc78a(0x20e)](_0x1df4c8[_0x1cc78a(0x20a)]),{'verbose':_0x2376fc[_0x1cc78a(0x1dd)]});await handleSingleObjectOutput(_0x4e4dab[_0x1cc78a(0x22c)],_0x2376fc);}else{if(_0x1df4c8[_0x1cc78a(0x1fa)]===_0x1cc78a(0x225)){if(!_0x1df4c8['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1cc78a(0x1fd));const _0x515df9=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4f018d['segment'][_0x1cc78a(0x1c9)](_0x1df4c8[_0x1cc78a(0x1ad)],_0x1df4c8[_0x1cc78a(0x226)]),{'verbose':_0x2376fc[_0x1cc78a(0x1dd)]});await handleSingleObjectOutput(_0x515df9[_0x1cc78a(0x22c)],_0x2376fc);}}}return 0x0;}catch(_0xf8c429){if(_0xf8c429 instanceof SDKError)return console[_0x1cc78a(0x1ec)](_0x1cc78a(0x201)+_0xf8c429[_0x1cc78a(0x1c4)]),_0xf8c429[_0x1cc78a(0x1db)]&&console[_0x1cc78a(0x1ec)](_0x1cc78a(0x196)+_0xf8c429['cause']),0x1;throw _0xf8c429;}}}function a27_0x5ea1(_0x5da566,_0x23dbdb){_0x5da566=_0x5da566-0x195;const _0x32117a=a27_0x3211();let _0x5ea125=_0x32117a[_0x5da566];return _0x5ea125;}export class SegmentShowCommand extends BaseCommand{['name']=a27_0x1fbaef(0x1ca);[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x204);async['execute'](_0xeec216){const _0x11bb34=a27_0x1fbaef,{options:_0x530231,args:_0x329de3,tdx:_0x1b7675}=_0xeec216,_0x2bebe5=_0x329de3[0x0];if(!_0x2bebe5)return console[_0x11bb34(0x1ec)](_0x11bb34(0x1c6)),console['error'](_0x11bb34(0x19d)),console['error'](_0x11bb34(0x1d9)),console['error'](_0x11bb34(0x1ef)),console['error'](_0x11bb34(0x216)),console[_0x11bb34(0x1ec)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x611f97=_0x530231[_0x11bb34(0x1f4)],_0x30a6f4=await resolveSegmentTarget(_0x2bebe5,_0x611f97,_0x530231['verbose']);_0x530231[_0x11bb34(0x1dd)]&&console[_0x11bb34(0x1ec)]('Target\x20path:\x20'+_0x30a6f4);const _0xa233d1=await withSpinner(_0x11bb34(0x21b)+_0x2bebe5+_0x11bb34(0x1ff),()=>_0x1b7675['segment']['resolvePathToResource'](_0x30a6f4),{'verbose':_0x530231[_0x11bb34(0x1dd)]}),_0x4c1035=_0xa233d1[_0x11bb34(0x22c)];_0x530231['verbose']&&(console[_0x11bb34(0x1ec)](_0x11bb34(0x1ee)+_0x4c1035[_0x11bb34(0x1fa)]),console['error'](_0x11bb34(0x1d6)+_0x4c1035[_0x11bb34(0x1ad)]));if(_0x4c1035[_0x11bb34(0x1fa)]===_0x11bb34(0x213))return console[_0x11bb34(0x1ec)](_0x11bb34(0x1a0)),console[_0x11bb34(0x1ec)](_0x11bb34(0x1b3)),0x1;if(_0x4c1035[_0x11bb34(0x1fa)]===_0x11bb34(0x218))return console['error'](_0x11bb34(0x1af)),console['error'](_0x11bb34(0x1ac)),0x1;if(!_0x4c1035[_0x11bb34(0x226)])throw new SDKError(ErrorCode[_0x11bb34(0x22a)],_0x11bb34(0x1fd));const _0x30dea4=await withSpinner(_0x11bb34(0x1f0),()=>_0x1b7675[_0x11bb34(0x225)][_0x11bb34(0x221)](_0x4c1035[_0x11bb34(0x1ad)],_0x4c1035[_0x11bb34(0x226)]),{'verbose':_0x530231[_0x11bb34(0x1dd)]});let _0x5427e0=_0x30dea4[_0x11bb34(0x22c)];const _0x20cd20=resolveLimit(_0x530231[_0x11bb34(0x209)],DEFAULT_DISPLAY_LIMIT),_0x418c17=/\bLIMIT\s+\d+/i[_0x11bb34(0x202)](_0x5427e0);!_0x418c17&&(_0x5427e0=_0x5427e0[_0x11bb34(0x1a5)]()[_0x11bb34(0x1ea)](/;+$/,''),_0x5427e0=_0x11bb34(0x211)+_0x5427e0+_0x11bb34(0x1bc)+_0x20cd20);_0x530231[_0x11bb34(0x1dd)]&&console[_0x11bb34(0x1ec)]('SQL\x20query:\x0a'+_0x5427e0);const _0x3cf8e7=await withProgressSpinner('Executing\x20segment\x20query...',async _0x38e3a4=>{const _0x2045a1=_0x11bb34,_0x1cbe32=await _0x1b7675[_0x2045a1(0x1d3)]['execute'](_0x5427e0,{'catalog':'td','schema':'information_schema','onJobId':_0x534279=>{const _0x48d7cb=_0x2045a1;_0x38e3a4[_0x48d7cb(0x1f7)](_0x534279);}});return _0x1cbe32;},{'verbose':_0x530231[_0x11bb34(0x1dd)]}),_0x150b5b=_0x3cf8e7['data'],_0x31bc4f=_0x150b5b[_0x11bb34(0x212)]?_0x11bb34(0x1ce)+_0x150b5b[_0x11bb34(0x212)]+']':'';return console[_0x11bb34(0x1ec)](_0x11bb34(0x1e5)+_0x150b5b['stats']['processedRows'][_0x11bb34(0x1cc)]()+_0x11bb34(0x1c5)+('in\x20'+formatElapsed(_0x150b5b[_0x11bb34(0x1f2)]['elapsedTimeMillis'])+_0x31bc4f)),await handleQueryOutput(_0x150b5b,_0x530231),0x0;}catch(_0x27d4b3){if(_0x27d4b3 instanceof SDKError)return console['error']('β\x20Query\x20failed\x20['+_0x27d4b3[_0x11bb34(0x21d)]+']'),console['error']('\x0a'+_0x27d4b3['message']),0x1;throw _0x27d4b3;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x1fbaef(0x1f9);[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x1e3);async[a27_0x1fbaef(0x1d7)](_0x2be399){const _0x16e8ce=a27_0x1fbaef,{options:_0x5d12e1,args:_0x4a9408,tdx:_0x3d5690}=_0x2be399;if(_0x4a9408[_0x16e8ce(0x227)]===0x0)return console['error'](_0x16e8ce(0x1bb)),console[_0x16e8ce(0x1ec)](_0x16e8ce(0x21f)),0x1;const _0x3683ed=_0x4a9408[0x0];try{_0x5d12e1['verbose']&&(console[_0x16e8ce(0x1ec)](_0x16e8ce(0x1f1)+_0x5d12e1[_0x16e8ce(0x1ab)]),console[_0x16e8ce(0x1ec)]('Parent\x20name:\x20'+_0x3683ed));const _0x13c96b=await withSpinner(_0x16e8ce(0x1b2)+_0x3683ed+'\x27...',()=>_0x3d5690[_0x16e8ce(0x225)]['resolveParentId'](_0x3683ed),{'verbose':_0x5d12e1[_0x16e8ce(0x1dd)]}),_0xa9268a=_0x13c96b['data'];_0x5d12e1[_0x16e8ce(0x1dd)]&&console['error'](_0x16e8ce(0x205)+_0xa9268a);const _0x34ac8c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x3683ed+'\x27...',()=>_0x3d5690[_0x16e8ce(0x225)][_0x16e8ce(0x19c)](_0xa9268a),{'verbose':_0x5d12e1[_0x16e8ce(0x1dd)]}),_0x381f99=_0x34ac8c[_0x16e8ce(0x22c)];return console['error'](_0x16e8ce(0x223)+_0x381f99['length']+_0x16e8ce(0x1f5)+(_0x381f99[_0x16e8ce(0x227)]!==0x1?'s':'')),await handleSDKOutput(_0x381f99,_0x5d12e1),0x0;}catch(_0x137055){if(_0x137055 instanceof SDKError)return console[_0x16e8ce(0x1ec)]('Error:\x20'+_0x137055[_0x16e8ce(0x1c4)]),_0x137055['cause']&&console[_0x16e8ce(0x1ec)](_0x16e8ce(0x196)+_0x137055[_0x16e8ce(0x1db)]),0x1;throw _0x137055;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x1fbaef(0x228)]=a27_0x1fbaef(0x19e);[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x1fe);async[a27_0x1fbaef(0x1d7)](_0x1d5379){const _0xe7c60=a27_0x1fbaef,{options:_0x15d7eb,args:_0x595cb1,tdx:_0xf5f241}=_0x1d5379;if(_0x595cb1['length']===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0xe7c60(0x1ec)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x579773,childId:_0x7668b6}=parseSegmentRef(_0x595cb1[0x0]);_0x15d7eb[_0xe7c60(0x1dd)]&&(console['error'](_0xe7c60(0x1f1)+_0x15d7eb[_0xe7c60(0x1ab)]),console[_0xe7c60(0x1ec)]('Parent\x20name:\x20'+_0x579773),_0x7668b6&&console[_0xe7c60(0x1ec)](_0xe7c60(0x22e)+_0x7668b6));if(!_0x7668b6)return console['error'](_0xe7c60(0x1ae)),0x1;const _0x5b1ef5=await withSpinner(_0xe7c60(0x1b2)+_0x579773+_0xe7c60(0x1ff),()=>_0xf5f241[_0xe7c60(0x225)]['resolveParentId'](_0x579773),{'verbose':_0x15d7eb[_0xe7c60(0x1dd)]}),_0x51e155=_0x5b1ef5[_0xe7c60(0x22c)];_0x15d7eb[_0xe7c60(0x1dd)]&&console[_0xe7c60(0x1ec)](_0xe7c60(0x205)+_0x51e155);const _0x4cde9b=await withSpinner(_0xe7c60(0x19a)+_0x7668b6+_0xe7c60(0x1ff),()=>_0xf5f241[_0xe7c60(0x225)][_0xe7c60(0x22d)](_0x51e155,_0x7668b6),{'verbose':_0x15d7eb[_0xe7c60(0x1dd)]}),_0x267a47=_0x4cde9b['data'];_0x15d7eb[_0xe7c60(0x1dd)]&&console[_0xe7c60(0x1ec)](_0xe7c60(0x1a9)+_0x267a47);const _0x501200=await withSpinner(_0xe7c60(0x1b1)+_0x7668b6+_0xe7c60(0x1ff),()=>_0xf5f241['segment'][_0xe7c60(0x20e)](_0x267a47),{'verbose':_0x15d7eb[_0xe7c60(0x1dd)]});return await handleSDKOutput([_0x501200[_0xe7c60(0x22c)]],_0x15d7eb),0x0;}catch(_0x59df66){if(_0x59df66 instanceof SDKError)return console[_0xe7c60(0x1ec)](_0xe7c60(0x201)+_0x59df66[_0xe7c60(0x1c4)]),_0x59df66[_0xe7c60(0x1db)]&&console[_0xe7c60(0x1ec)](_0xe7c60(0x196)+_0x59df66[_0xe7c60(0x1db)]),0x1;throw _0x59df66;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x215);async[a27_0x1fbaef(0x1d7)](_0x6a7b7){const _0x377e29=a27_0x1fbaef,{options:_0x111594,args:_0x124a07,tdx:_0x125f53}=_0x6a7b7,_0x1ff88a=_0x124a07[0x0];if(!_0x1ff88a)return console[_0x377e29(0x1ec)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x377e29(0x1ec)](_0x377e29(0x1a7)),console[_0x377e29(0x1ec)](_0x377e29(0x1ba)),console[_0x377e29(0x1ec)](_0x377e29(0x1ef)),console[_0x377e29(0x1ec)](_0x377e29(0x1d2)),console['error'](_0x377e29(0x1d5)),0x1;try{const _0x2d6409=_0x111594[_0x377e29(0x1f4)],_0x4b867b=await resolveSegmentTarget(_0x1ff88a,_0x2d6409,_0x111594[_0x377e29(0x1dd)]);_0x111594['verbose']&&console[_0x377e29(0x1ec)](_0x377e29(0x1e7)+_0x4b867b);const _0x2dea65=await withSpinner(_0x377e29(0x21b)+_0x1ff88a+_0x377e29(0x1ff),()=>_0x125f53['segment'][_0x377e29(0x1b5)](_0x4b867b),{'verbose':_0x111594['verbose']}),_0x42016b=_0x2dea65['data'];_0x111594[_0x377e29(0x1dd)]&&(console[_0x377e29(0x1ec)](_0x377e29(0x1ee)+_0x42016b[_0x377e29(0x1fa)]),console[_0x377e29(0x1ec)](_0x377e29(0x1d6)+_0x42016b[_0x377e29(0x1ad)]));if(_0x42016b[_0x377e29(0x1fa)]===_0x377e29(0x213))return console[_0x377e29(0x1ec)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x377e29(0x1ec)](_0x377e29(0x1c1)),0x1;if(_0x42016b[_0x377e29(0x1fa)]===_0x377e29(0x218))return console[_0x377e29(0x1ec)](_0x377e29(0x1d4)),console[_0x377e29(0x1ec)](_0x377e29(0x1cb)),0x1;if(!_0x42016b[_0x377e29(0x226)])throw new SDKError(ErrorCode[_0x377e29(0x22a)],_0x377e29(0x1fd));const _0x4413db=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x125f53[_0x377e29(0x225)][_0x377e29(0x221)](_0x42016b[_0x377e29(0x1ad)],_0x42016b[_0x377e29(0x226)]),{'verbose':_0x111594[_0x377e29(0x1dd)]}),_0x596a1d=_0x4413db[_0x377e29(0x22c)];return _0x111594[_0x377e29(0x21a)]==='json'||_0x111594[_0x377e29(0x21a)]===_0x377e29(0x1df)?await handleSDKOutput([{'sql':_0x596a1d}],_0x111594):console[_0x377e29(0x1e1)](_0x596a1d),0x0;}catch(_0x5a9035){if(_0x5a9035 instanceof SDKError)return console[_0x377e29(0x1ec)]('Error:\x20'+_0x5a9035[_0x377e29(0x1c4)]),_0x5a9035[_0x377e29(0x1db)]&&console[_0x377e29(0x1ec)](_0x377e29(0x196)+_0x5a9035[_0x377e29(0x1db)]),0x1;throw _0x5a9035;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x1fbaef(0x228)]='segment:folder:create';[a27_0x1fbaef(0x1b9)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x2354fa){const _0x1dfc0e=a27_0x1fbaef,{options:_0x5d8700,args:_0x4e575d,tdx:_0x27a20e}=_0x2354fa,_0x4d06e8=_0x5d8700;if(_0x4e575d[_0x1dfc0e(0x227)]<0x2)return console[_0x1dfc0e(0x1ec)](_0x1dfc0e(0x1d8)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x63d2e5=_0x4e575d[0x0],_0x20ebda=_0x4e575d[0x1];_0x4d06e8[_0x1dfc0e(0x1dd)]&&(console['error']('Site:\x20'+_0x4d06e8['site']),console[_0x1dfc0e(0x1ec)](_0x1dfc0e(0x195)+_0x63d2e5),console[_0x1dfc0e(0x1ec)](_0x1dfc0e(0x22e)+_0x20ebda));let _0x3eea24;if(_0x4d06e8['parentFolder']){const _0x2f1fe0=_0x4d06e8[_0x1dfc0e(0x1b7)],_0x1d654b=await withSpinner(_0x1dfc0e(0x1b2)+_0x63d2e5+_0x1dfc0e(0x1ff),()=>_0x27a20e['segment']['resolveParentId'](_0x63d2e5),{'verbose':_0x4d06e8['verbose']}),_0x3037a1=_0x1d654b[_0x1dfc0e(0x22c)],_0x550708=await withSpinner(_0x1dfc0e(0x1e6)+_0x2f1fe0+_0x1dfc0e(0x1ff),()=>_0x27a20e[_0x1dfc0e(0x225)][_0x1dfc0e(0x22d)](_0x3037a1,_0x2f1fe0),{'verbose':_0x4d06e8[_0x1dfc0e(0x1dd)]});_0x3eea24=_0x550708[_0x1dfc0e(0x22c)],_0x4d06e8['verbose']&&console['error'](_0x1dfc0e(0x1d0)+_0x3eea24);}const _0x574ab5={'name':_0x20ebda,'description':_0x4d06e8['description'],'parentFolderId':_0x3eea24},_0x31a971=await withSpinner('Creating\x20folder\x20\x27'+_0x20ebda+_0x1dfc0e(0x1ff),()=>_0x27a20e[_0x1dfc0e(0x225)]['createFolder'](_0x63d2e5,_0x574ab5),{'verbose':_0x4d06e8[_0x1dfc0e(0x1dd)]}),_0x4a1bec=_0x31a971[_0x1dfc0e(0x22c)];return console[_0x1dfc0e(0x1ec)](_0x1dfc0e(0x203)+_0x4a1bec[_0x1dfc0e(0x228)]+_0x1dfc0e(0x1e8)+_0x4a1bec['id']),await handleSDKOutput([_0x4a1bec],_0x4d06e8),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x1fbaef(0x228)]=a27_0x1fbaef(0x1c8);[a27_0x1fbaef(0x1b9)]=a27_0x1fbaef(0x1f8);async[a27_0x1fbaef(0x1d7)](_0x4a404c){const _0x5b7aa2=a27_0x1fbaef,{options:_0x2628bb,args:_0x1cc6e9,tdx:_0x5bcbad}=_0x4a404c,_0x1f20bb=_0x1cc6e9[0x0];if(!_0x1f20bb)return console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1a1)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x199)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x217)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x210)),console[_0x5b7aa2(0x1ec)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5b7aa2(0x1ec)]('Examples:'),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x222)),console['error'](_0x5b7aa2(0x1e0)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1de)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x19b)),0x1;try{const _0x1d37b6=_0x2628bb[_0x5b7aa2(0x1f4)],_0x12eebe=await resolveSegmentTarget(_0x1f20bb,_0x1d37b6,_0x2628bb[_0x5b7aa2(0x1dd)]);_0x2628bb[_0x5b7aa2(0x1dd)]&&console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1e7)+_0x12eebe);const _0x1e6cf8=await withSpinner('Resolving\x20\x27'+_0x1f20bb+_0x5b7aa2(0x1ff),()=>_0x5bcbad[_0x5b7aa2(0x225)][_0x5b7aa2(0x1b5)](_0x12eebe),{'verbose':_0x2628bb[_0x5b7aa2(0x1dd)]}),_0x395fa8=_0x1e6cf8['data'];_0x2628bb[_0x5b7aa2(0x1dd)]&&(console['error'](_0x5b7aa2(0x1ee)+_0x395fa8[_0x5b7aa2(0x1fa)]),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1d6)+_0x395fa8[_0x5b7aa2(0x1ad)]),_0x395fa8[_0x5b7aa2(0x20a)]&&console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x214)+_0x395fa8['folderId']),_0x395fa8[_0x5b7aa2(0x226)]&&console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1fc)+_0x395fa8[_0x5b7aa2(0x226)]));if(_0x2628bb['web']){if(_0x395fa8[_0x5b7aa2(0x1fa)]===_0x5b7aa2(0x213))return console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1b4)),0x1;if(_0x395fa8[_0x5b7aa2(0x1fa)]===_0x5b7aa2(0x218))return console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1b0)),console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x1fb)),0x1;if(!_0x395fa8[_0x5b7aa2(0x226)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5b7aa2(0x1fd));const _0xfde2b6=getConsoleNextUrl(_0x2628bb['site'],'/app/ps/'+_0x395fa8[_0x5b7aa2(0x1ad)]+_0x5b7aa2(0x1a6)+_0x395fa8[_0x5b7aa2(0x226)]);return console[_0x5b7aa2(0x1ec)](a27_0x4423df['green']('β')+_0x5b7aa2(0x1bd)+a27_0x4423df[_0x5b7aa2(0x21e)](_0xfde2b6)),openBrowser(_0xfde2b6),0x0;}if(_0x395fa8[_0x5b7aa2(0x1fa)]===_0x5b7aa2(0x213)){if(!_0x395fa8[_0x5b7aa2(0x20a)])throw new SDKError(ErrorCode[_0x5b7aa2(0x19f)],_0x5b7aa2(0x1ed));const _0x566f69=await withSpinner(_0x5b7aa2(0x1cf),()=>_0x5bcbad['segment'][_0x5b7aa2(0x20e)](_0x395fa8[_0x5b7aa2(0x20a)]),{'verbose':_0x2628bb['verbose']});await handleSingleObjectOutput(_0x566f69[_0x5b7aa2(0x22c)],_0x2628bb);}else{if(_0x395fa8['type']===_0x5b7aa2(0x225)){if(!_0x395fa8[_0x5b7aa2(0x226)])throw new SDKError(ErrorCode[_0x5b7aa2(0x22a)],_0x5b7aa2(0x1fd));const _0x5dd937=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5bcbad['segment']['getSegment'](_0x395fa8[_0x5b7aa2(0x1ad)],_0x395fa8[_0x5b7aa2(0x226)]),{'verbose':_0x2628bb[_0x5b7aa2(0x1dd)]}),_0x1b4167=getConsoleNextUrl(_0x2628bb[_0x5b7aa2(0x1ab)],'/app/ps/'+_0x395fa8['parentId']+_0x5b7aa2(0x1a6)+_0x395fa8[_0x5b7aa2(0x226)]),_0x32f4f6=_0x5dd937[_0x5b7aa2(0x22c)];_0x32f4f6[_0x5b7aa2(0x1e4)]=_0x1b4167,await handleSingleObjectOutput(_0x32f4f6,_0x2628bb);}else return console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x21c)),console[_0x5b7aa2(0x1ec)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x5f596b){if(_0x5f596b instanceof SDKError)return console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x201)+_0x5f596b['message']),_0x5f596b['cause']&&console[_0x5b7aa2(0x1ec)](_0x5b7aa2(0x196)+_0x5f596b[_0x5b7aa2(0x1db)]),0x1;throw _0x5f596b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';['description']=a27_0x1fbaef(0x1f3);async[a27_0x1fbaef(0x1d7)](_0x15e932){const _0x3c2539=a27_0x1fbaef,{options:_0xe7cd18,args:_0x278c7,tdx:_0x1bb938}=_0x15e932,_0xa96294=_0x278c7[0x0];if(!_0xa96294)return console[_0x3c2539(0x1ec)](_0x3c2539(0x1c6)),console[_0x3c2539(0x1ec)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x3c2539(0x1ec)](_0x3c2539(0x1b8)),console['error']('Examples:'),console[_0x3c2539(0x1ec)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error'](_0x3c2539(0x1bf)),0x1;try{const _0x34be73=_0xe7cd18['parentSegment'],_0x3743ec=await resolveSegmentTarget(_0xa96294,_0x34be73,_0xe7cd18[_0x3c2539(0x1dd)]);_0xe7cd18[_0x3c2539(0x1dd)]&&console[_0x3c2539(0x1ec)](_0x3c2539(0x1e7)+_0x3743ec);const _0x35e311=await withSpinner(_0x3c2539(0x21b)+_0xa96294+'\x27...',()=>_0x1bb938['segment'][_0x3c2539(0x1b5)](_0x3743ec),{'verbose':_0xe7cd18['verbose']}),_0x2fb64a=_0x35e311[_0x3c2539(0x22c)];_0xe7cd18[_0x3c2539(0x1dd)]&&(console[_0x3c2539(0x1ec)]('Resolved\x20type:\x20'+_0x2fb64a[_0x3c2539(0x1fa)]),console['error'](_0x3c2539(0x1d6)+_0x2fb64a[_0x3c2539(0x1ad)]));if(_0x2fb64a[_0x3c2539(0x1fa)]===_0x3c2539(0x213))return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x3c2539(0x1c1)),0x1;if(_0x2fb64a[_0x3c2539(0x1fa)]===_0x3c2539(0x218))return console[_0x3c2539(0x1ec)](_0x3c2539(0x22b)),console[_0x3c2539(0x1ec)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x2fb64a[_0x3c2539(0x226)])throw new SDKError(ErrorCode[_0x3c2539(0x22a)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x453a32=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1bb938[_0x3c2539(0x225)][_0x3c2539(0x221)](_0x2fb64a[_0x3c2539(0x1ad)],_0x2fb64a[_0x3c2539(0x226)]),{'verbose':_0xe7cd18['verbose']}),_0x2eb294=_0x453a32[_0x3c2539(0x22c)],_0x1502b7=await executeSchemaQuery(_0x2eb294,_0x1bb938,_0xe7cd18);return await handleQueryOutput(_0x1502b7,_0xe7cd18),0x0;}catch(_0x264087){if(_0x264087 instanceof SDKError)return console[_0x3c2539(0x1ec)]('Error:\x20'+_0x264087[_0x3c2539(0x1c4)]),_0x264087[_0x3c2539(0x1db)]&&console[_0x3c2539(0x1ec)](_0x3c2539(0x196)+_0x264087[_0x3c2539(0x1db)]),0x1;throw _0x264087;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a28_0x145f55=a28_0x2d29;function a28_0x34a7(){const _0x50cffe=['Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','1583990GCsfIN','resolveParentId','createSegment','error','7173528IYiHeB','\x20\x20\x20Path:\x20','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Resolving\x20parent\x20segment\x20\x27','ruleFile','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','invisible','Resolved\x20folder\x20ID:\x20','Resolving\x20folder\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','verbose','type','588urnjdY','Site:\x20','site','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','14045UHEKqz','segments','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Resolved\x20relative\x20path\x20to:\x20','rule','segmentPath','segment','Target\x20path:\x20','yellow','Parent\x20path:\x20','2628BXJEuv','4WTvrFT','4323315KxxRnu','description','resolvePathToResource','Resolving\x20folder\x20path\x20\x27','includes','execute','\x27...','length','1266249zRYhxY','kind','Examples:','folder','Segment\x20name:\x20','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','106rRDERg','β\x20Created\x20segment\x20\x27','name','data','folderId','1162098xyjENc'];a28_0x34a7=function(){return _0x50cffe;};return a28_0x34a7();}(function(_0x8b9a42,_0x31a920){const _0x579d4f=a28_0x2d29,_0x4ec6fb=_0x8b9a42();while(!![]){try{const _0x594998=parseInt(_0x579d4f(0xf3))/0x1*(-parseInt(_0x579d4f(0xd5))/0x2)+-parseInt(_0x579d4f(0xcf))/0x3+parseInt(_0x579d4f(0xfe))/0x4*(parseInt(_0x579d4f(0xff))/0x5)+-parseInt(_0x579d4f(0xfd))/0x6*(parseInt(_0x579d4f(0xef))/0x7)+parseInt(_0x579d4f(0xe0))/0x8+-parseInt(_0x579d4f(0xda))/0x9+parseInt(_0x579d4f(0xdc))/0xa;if(_0x594998===_0x31a920)break;else _0x4ec6fb['push'](_0x4ec6fb['shift']());}catch(_0x719af5){_0x4ec6fb['push'](_0x4ec6fb['shift']());}}}(a28_0x34a7,0x8f66b));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a28_0x2d29(_0x2f4877,_0x331ece){_0x2f4877=_0x2f4877-0xcd;const _0x34a708=a28_0x34a7();let _0x2d29c6=_0x34a708[_0x2f4877];return _0x2d29c6;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x5df413 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x145f55(0xd7)]='segment:create';[a28_0x145f55(0x100)]=a28_0x145f55(0xea);async[a28_0x145f55(0x104)](_0x1e5da8){const _0x4a1484=a28_0x145f55;console[_0x4a1484(0xdf)](a28_0x5df413[_0x4a1484(0xfb)](_0x4a1484(0xd4))),console[_0x4a1484(0xdf)](a28_0x5df413[_0x4a1484(0xfb)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x1cf812,args:_0x362cef,tdx:_0xb36538}=_0x1e5da8,_0x580910=_0x1cf812;if(_0x362cef['length']===0x0)return console[_0x4a1484(0xdf)](_0x4a1484(0xeb)),console[_0x4a1484(0xdf)](_0x4a1484(0xdb)),console['error'](_0x4a1484(0xd1)),console[_0x4a1484(0xdf)](_0x4a1484(0xf5)),console[_0x4a1484(0xdf)](_0x4a1484(0xe6)),console[_0x4a1484(0xdf)](_0x4a1484(0xec)),0x1;const _0x4b1580=_0x362cef[0x0],_0x31f704=_0x1cf812[_0x4a1484(0xf8)];let _0x9bb93c=_0x4b1580;_0x31f704&&!_0x4b1580[_0x4a1484(0x103)]('/')&&(_0x9bb93c=_0x31f704+'/'+_0x4b1580,_0x580910['verbose']&&console[_0x4a1484(0xdf)](_0x4a1484(0xf6)+_0x9bb93c));const _0x5d0dc8=parsePath(_0x9bb93c);if(_0x5d0dc8[_0x4a1484(0xf4)][_0x4a1484(0xce)]<0x2)return console[_0x4a1484(0xdf)](_0x4a1484(0xf2)),console[_0x4a1484(0xdf)](_0x4a1484(0xe3)),0x1;const _0x1f93f7=_0x5d0dc8[_0x4a1484(0xf4)][0x0],_0x4994f8=getBaseName(_0x9bb93c),_0x24aea5=getParentPath(_0x9bb93c);_0x580910['verbose']&&(console[_0x4a1484(0xdf)](_0x4a1484(0xf0)+_0x580910[_0x4a1484(0xf1)]),console[_0x4a1484(0xdf)](_0x4a1484(0xfa)+_0x9bb93c),console[_0x4a1484(0xdf)](_0x4a1484(0xe2)+_0x1f93f7),console[_0x4a1484(0xdf)](_0x4a1484(0xd3)+_0x4994f8),console['error'](_0x4a1484(0xfc)+_0x24aea5));const _0x16c7bc=await withSpinner(_0x4a1484(0xe4)+_0x1f93f7+_0x4a1484(0xcd),()=>_0xb36538[_0x4a1484(0xf9)][_0x4a1484(0xdd)](_0x1f93f7),{'verbose':_0x580910[_0x4a1484(0xed)]}),_0x48b2ba=_0x16c7bc[_0x4a1484(0xd8)];let _0x38dabd;if(_0x5d0dc8[_0x4a1484(0xf4)][_0x4a1484(0xce)]>0x2){const _0x4f13ec=await withSpinner(_0x4a1484(0x102)+_0x24aea5+'\x27...',()=>_0xb36538[_0x4a1484(0xf9)][_0x4a1484(0x101)](_0x24aea5),{'verbose':_0x580910[_0x4a1484(0xed)]}),_0x3514a3=_0x4f13ec[_0x4a1484(0xd8)];if(_0x3514a3[_0x4a1484(0xee)]!=='folder'&&_0x3514a3[_0x4a1484(0xee)]!=='parent')return console[_0x4a1484(0xdf)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x38dabd=_0x3514a3[_0x4a1484(0xd9)];}else{if(_0x580910[_0x4a1484(0xd2)]){const _0x4b6fbd=await withSpinner(_0x4a1484(0xe9)+_0x580910[_0x4a1484(0xd2)]+'\x27...',()=>_0xb36538[_0x4a1484(0xf9)]['resolveFolderId'](_0x48b2ba,_0x580910['folder']),{'verbose':_0x580910[_0x4a1484(0xed)]});_0x38dabd=_0x4b6fbd[_0x4a1484(0xd8)];}}_0x580910[_0x4a1484(0xed)]&&_0x38dabd&&console['error'](_0x4a1484(0xe8)+_0x38dabd);const _0x829982=await loadJSONFromOptions(_0x580910[_0x4a1484(0xf7)],_0x580910[_0x4a1484(0xe5)]),_0x100d09={'name':_0x4994f8,'description':_0x580910[_0x4a1484(0x100)],'rule':_0x829982,'kind':_0x580910[_0x4a1484(0xd0)]!==undefined?parseInt(_0x580910[_0x4a1484(0xd0)],0xa):undefined,'isVisible':_0x580910[_0x4a1484(0xe7)]?![]:undefined,'segmentFolderId':_0x38dabd,'countPopulation':_0x580910['noCountPopulation']?![]:undefined},_0x1e9965=await withSpinner('Creating\x20segment\x20\x27'+_0x4994f8+'\x27...',()=>_0xb36538[_0x4a1484(0xf9)][_0x4a1484(0xde)](_0x48b2ba,_0x100d09),{'verbose':_0x580910[_0x4a1484(0xed)]}),_0x3be616=_0x1e9965[_0x4a1484(0xd8)];return console[_0x4a1484(0xdf)](_0x4a1484(0xd6)+_0x3be616[_0x4a1484(0xd7)]+'\x27\x20with\x20ID:\x20'+_0x3be616['id']),_0x9bb93c!==_0x4b1580&&console['error'](_0x4a1484(0xe1)+_0x9bb93c),await handleSDKOutput([_0x3be616],_0x580910),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a29_0x2da8(_0x2ac1da,_0x336e01){_0x2ac1da=_0x2ac1da-0x153;const _0x1003f3=a29_0x1003();let _0x2da812=_0x1003f3[_0x2ac1da];return _0x2da812;}const a29_0x4ee861=a29_0x2da8;function a29_0x1003(){const _0x4bd590=['Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','385504SicYbc','name','Site:\x20','β\x20Found\x20','verbose','listFields','segment','error','\x20field','1894392VpnmQF','List\x20available\x20fields\x20for\x20segmentation','execute','10nukVsG','20CYicIs','282332IEzIsp','75951odlrhN','Listing\x20fields\x20for\x20\x27','site','length','1264032uEOcht','77mKwyah','json','Parent\x20segment:\x20','154136DebnHf','112299sPTOzE'];a29_0x1003=function(){return _0x4bd590;};return a29_0x1003();}(function(_0x5ef22b,_0x16fdd5){const _0x5de5b8=a29_0x2da8,_0x4649b0=_0x5ef22b();while(!![]){try{const _0x390470=parseInt(_0x5de5b8(0x159))/0x1+parseInt(_0x5de5b8(0x169))/0x2+-parseInt(_0x5de5b8(0x16a))/0x3+-parseInt(_0x5de5b8(0x15b))/0x4*(parseInt(_0x5de5b8(0x167))/0x5)+-parseInt(_0x5de5b8(0x164))/0x6+-parseInt(_0x5de5b8(0x155))/0x7*(-parseInt(_0x5de5b8(0x158))/0x8)+parseInt(_0x5de5b8(0x154))/0x9*(parseInt(_0x5de5b8(0x168))/0xa);if(_0x390470===_0x16fdd5)break;else _0x4649b0['push'](_0x4649b0['shift']());}catch(_0x4434a8){_0x4649b0['push'](_0x4649b0['shift']());}}}(a29_0x1003,0x33e11));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x4ee861(0x15c)]='segment:fields';['description']=a29_0x4ee861(0x165);async[a29_0x4ee861(0x166)](_0x17dc8b){const _0x3e2258=a29_0x4ee861,{options:_0x318652,args:_0x5f40cf,tdx:_0x470c58}=_0x17dc8b,_0x2085f4=_0x5f40cf[0x0]||_0x318652['parentSegment'];if(!_0x2085f4)return console[_0x3e2258(0x162)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x3e2258(0x162)](_0x3e2258(0x15a)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x318652[_0x3e2258(0x15f)]&&(console[_0x3e2258(0x162)](_0x3e2258(0x15d)+_0x318652[_0x3e2258(0x16c)]),console['error'](_0x3e2258(0x157)+_0x2085f4));const _0x12eb88=await withSpinner(_0x3e2258(0x16b)+_0x2085f4+'\x27...',()=>_0x470c58[_0x3e2258(0x161)][_0x3e2258(0x160)](_0x2085f4),{'verbose':_0x318652[_0x3e2258(0x15f)]}),_0x37bcce=_0x12eb88['data'];console[_0x3e2258(0x162)](_0x3e2258(0x15e)+_0x37bcce[_0x3e2258(0x153)]+_0x3e2258(0x163)+(_0x37bcce[_0x3e2258(0x153)]!==0x1?'s':''));if(_0x318652[_0x3e2258(0x156)]||_0x318652['jsonl'])return await handleSDKOutput(_0x37bcce,_0x318652),0x0;return displayFieldsHumanReadable(_0x37bcce,_0x2085f4),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x304910=a30_0x1886;(function(_0x5dcc27,_0x53483a){const _0x4eb597=a30_0x1886,_0x50aa1d=_0x5dcc27();while(!![]){try{const _0x4fe933=-parseInt(_0x4eb597(0x14c))/0x1+parseInt(_0x4eb597(0x109))/0x2+-parseInt(_0x4eb597(0x139))/0x3+parseInt(_0x4eb597(0x127))/0x4+-parseInt(_0x4eb597(0x13b))/0x5*(parseInt(_0x4eb597(0x10d))/0x6)+parseInt(_0x4eb597(0x101))/0x7+parseInt(_0x4eb597(0x119))/0x8*(-parseInt(_0x4eb597(0x14a))/0x9);if(_0x4fe933===_0x53483a)break;else _0x50aa1d['push'](_0x50aa1d['shift']());}catch(_0x1fb490){_0x50aa1d['push'](_0x50aa1d['shift']());}}}(a30_0x2199,0xf3002));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a30_0x1886(_0x52a382,_0x11db24){_0x52a382=_0x52a382-0x101;const _0x2199ca=a30_0x2199();let _0x1886d1=_0x2199ca[_0x52a382];return _0x1886d1;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x2c7c83 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x21c38b from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a30_0x304910(0x12c);[a30_0x304910(0x142)]=a30_0x304910(0x118);async[a30_0x304910(0x107)](_0x2ea341){const _0x27c542=a30_0x304910,{options:_0x5112e0,args:_0x4d403d,tdx:_0x215a9e}=_0x2ea341,_0x3e775c=_0x5112e0,_0x377742=await resolveTarget({'arg':_0x4d403d[0x0],'contextParent':_0x5112e0[_0x27c542(0x150)],'cwd':process[_0x27c542(0x113)]()});if(!isSuccessfulResolution(_0x377742))return _0x377742[_0x27c542(0x13e)]===_0x27c542(0x115)?(console[_0x27c542(0x138)](a30_0x2c7c83['yellow'](_0x27c542(0x13c))),console[_0x27c542(0x138)](_0x27c542(0x128)),console[_0x27c542(0x138)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x27c542(0x138)](_0x27c542(0x140))):(console['error'](a30_0x2c7c83['red'](_0x27c542(0x121)+_0x377742[_0x27c542(0x125)]+'\x0a')),_0x377742[_0x27c542(0x14b)]&&console['error'](a30_0x2c7c83['cyan'](_0x377742['helpText']))),0x1;const _0x4e27a4=_0x377742[_0x27c542(0x147)],_0x3fd9ae=_0x377742[_0x27c542(0x116)],_0x35d9e3=_0x377742[_0x27c542(0x143)]===_0x27c542(0x12a)?_0x377742['resourceName']:undefined;_0x3e775c[_0x27c542(0x120)]&&(console['error']('Site:\x20'+_0x3e775c[_0x27c542(0x124)]),console[_0x27c542(0x138)](_0x27c542(0x123)+_0x4e27a4),_0x35d9e3&&console['error'](_0x27c542(0x114)+_0x35d9e3));const _0x43c105=await withProgressSpinner(_0x27c542(0x106)+_0x4e27a4+_0x27c542(0x12e),_0x48c875=>_0x215a9e[_0x27c542(0x146)]['pullSegments'](_0x4e27a4,{'targetDir':_0x3fd9ae,'targetResourceName':_0x35d9e3,'verbose':_0x3e775c[_0x27c542(0x120)],'progress':{'update':_0x430162=>{const _0x2f70d9=_0x27c542;_0x48c875['setPhase'](_0x430162),_0x3e775c[_0x2f70d9(0x120)]&&console[_0x2f70d9(0x138)]('\x20\x20'+_0x430162);}}}),{'verbose':_0x3e775c[_0x27c542(0x120)]}),_0x4ea8a9=_0x43c105[_0x27c542(0x137)];if(_0x4ea8a9['counts']['segments']===0x0&&_0x4ea8a9[_0x27c542(0x108)]['journeys']===0x0)return console[_0x27c542(0x138)](a30_0x2c7c83['yellow'](_0x27c542(0x11f)+_0x4ea8a9[_0x27c542(0x147)]+'\x27')),0x0;const _0x1c7199=_0x4ea8a9[_0x27c542(0x10a)][_0x27c542(0x141)](_0x4c921f=>_0x4c921f['isNew']),_0x1e0716=_0x4ea8a9['files'][_0x27c542(0x141)](_0x526562=>!_0x526562[_0x27c542(0x148)]&&_0x526562[_0x27c542(0x14e)]),_0x271942=_0x4ea8a9[_0x27c542(0x10a)][_0x27c542(0x141)](_0x15543f=>!_0x15543f[_0x27c542(0x148)]&&!_0x15543f['hasChanges']);console[_0x27c542(0x138)](_0x27c542(0x14f)+_0x4ea8a9[_0x27c542(0x147)]+'\x27:'),console[_0x27c542(0x138)](_0x27c542(0x111)+a30_0x2c7c83[_0x27c542(0x103)](_0x4ea8a9[_0x27c542(0x108)][_0x27c542(0x11d)]+_0x27c542(0x10c))+_0x27c542(0x134)+a30_0x2c7c83[_0x27c542(0x103)](_0x4ea8a9[_0x27c542(0x108)][_0x27c542(0x129)]+'\x20activations'));if(_0x4ea8a9[_0x27c542(0x108)][_0x27c542(0x10b)]>0x0){const _0x89e88e=_0x4ea8a9['counts'][_0x27c542(0x105)]>_0x4ea8a9[_0x27c542(0x108)][_0x27c542(0x10b)]?'\x20('+_0x4ea8a9[_0x27c542(0x108)]['journeyVersions']+_0x27c542(0x104):'';console[_0x27c542(0x138)](_0x27c542(0x10f)+a30_0x2c7c83['cyan'](_0x4ea8a9[_0x27c542(0x108)]['journeys']+_0x27c542(0x12f))+a30_0x2c7c83[_0x27c542(0x11e)](_0x89e88e));}console[_0x27c542(0x138)]('\x20\x20'+a30_0x2c7c83[_0x27c542(0x11b)]('+\x20'+_0x1c7199[_0x27c542(0x117)]+_0x27c542(0x135))),console[_0x27c542(0x138)]('\x20\x20'+a30_0x2c7c83[_0x27c542(0x13d)]('~\x20'+_0x1e0716[_0x27c542(0x117)]+_0x27c542(0x133))),console[_0x27c542(0x138)]('\x20\x20'+a30_0x2c7c83[_0x27c542(0x11e)]('=\x20'+_0x271942[_0x27c542(0x117)]+_0x27c542(0x12b))),console[_0x27c542(0x138)]('\x20\x20Target:\x20'+a30_0x2c7c83[_0x27c542(0x103)](_0x4ea8a9[_0x27c542(0x116)])+'\x0a');if(_0x1e0716[_0x27c542(0x117)]>0x0)for(const _0x252388 of _0x1e0716){console['error'](_0x27c542(0x112)+_0x252388[_0x27c542(0x130)]+'\x27:'),console[_0x27c542(0x138)]('β'[_0x27c542(0x151)](0x3c)),console[_0x27c542(0x138)](_0x252388['diff']),console[_0x27c542(0x138)]('β'[_0x27c542(0x151)](0x3c));}if(_0x3e775c[_0x27c542(0x13f)])return console[_0x27c542(0x138)](a30_0x2c7c83['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x1c7199['length']===0x0&&_0x1e0716[_0x27c542(0x117)]===0x0)return console[_0x27c542(0x138)](a30_0x2c7c83['green'](_0x27c542(0x10e))),saveSessionContext({'parent_segment':_0x4ea8a9[_0x27c542(0x147)]},_0x3e775c['session']),console[_0x27c542(0x138)](a30_0x2c7c83[_0x27c542(0x11b)]('β\x20Context\x20set:\x20'+a30_0x2c7c83['dim'](_0x27c542(0x131))+'\x20=\x20'+a30_0x2c7c83[_0x27c542(0x103)](_0x4ea8a9[_0x27c542(0x147)]))),0x0;if(!_0x3e775c['yes']){if(!isInteractive())return console[_0x27c542(0x138)](a30_0x2c7c83[_0x27c542(0x11c)](_0x27c542(0x14d)),_0x27c542(0x122)),console[_0x27c542(0x138)](a30_0x2c7c83[_0x27c542(0x11e)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x415c95=await confirmKey(_0x27c542(0x145)+(_0x1c7199[_0x27c542(0x117)]+_0x1e0716[_0x27c542(0x117)])+_0x27c542(0x126));if(!_0x415c95)return console[_0x27c542(0x138)](a30_0x2c7c83['yellow'](_0x27c542(0x132)),_0x27c542(0x110)),0x1;}for(const _0x41e010 of _0x4ea8a9[_0x27c542(0x10a)]){if(_0x41e010[_0x27c542(0x148)]||_0x41e010[_0x27c542(0x14e)]){const _0x58f376=a30_0x21c38b[_0x27c542(0x102)](_0x41e010[_0x27c542(0x144)]);!existsSync(_0x58f376)&&mkdirSync(_0x58f376,{'recursive':!![]}),writeFileSync(_0x41e010[_0x27c542(0x144)],_0x41e010[_0x27c542(0x149)],'utf-8');}}return console['error'](a30_0x2c7c83['green'](_0x27c542(0x136)+(_0x1c7199[_0x27c542(0x117)]+_0x1e0716[_0x27c542(0x117)])+'\x20files\x20to\x20'+_0x4ea8a9[_0x27c542(0x116)])),saveSessionContext({'parent_segment':_0x4ea8a9['parentName']},_0x3e775c[_0x27c542(0x13a)]),console[_0x27c542(0x138)](a30_0x2c7c83[_0x27c542(0x11b)](_0x27c542(0x12d)+a30_0x2c7c83[_0x27c542(0x11e)]('parent_segment')+_0x27c542(0x11a)+a30_0x2c7c83[_0x27c542(0x103)](_0x4ea8a9[_0x27c542(0x147)]))),0x0;}}function a30_0x2199(){const _0x32af9c=['files','journeys','\x20segments','144Tsamnq','β\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20πΊοΈ\x20\x20','-\x20no\x20files\x20written','\x20\x20π―\x20','\x0aChanges\x20to\x20\x27','cwd','Target\x20resource:\x20','no_parent','targetDir','length','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','2648eIqlmV','\x20=\x20','green','red','segments','dim','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','verbose','Error:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Parent\x20segment:\x20','site','message','\x20files?','2032524mLILfq','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)','activations','file','\x20unchanged\x20files','segment:pull','β\x20Context\x20set:\x20','\x27...','\x20journeys','relativePath','parent_segment','Aborted.','\x20changed\x20files','\x20with\x20','\x20new\x20files','β\x20Pulled\x20','data','error','815892KpZhvh','session','103650VGvSec','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','yellow','errorCode','dryRun','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','filter','description','type','absolutePath','Write\x20','segment','parentName','isNew','content','16353gXAwGG','helpText','1320693dxtJmH','\x0aError:','hasChanges','\x0aPull\x20summary\x20for\x20\x27','parentSegment','repeat','10973207QxFaOD','dirname','cyan','\x20versions)','journeyVersions','Pulling\x20segments\x20from\x20\x27','execute','counts','3222404kLHSHn'];a30_0x2199=function(){return _0x32af9c;};return a30_0x2199();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x23be32=a31_0x14be;(function(_0x2d64ae,_0x3898e3){const _0x4a67c8=a31_0x14be,_0x356275=_0x2d64ae();while(!![]){try{const _0x2b6016=parseInt(_0x4a67c8(0xa3))/0x1*(-parseInt(_0x4a67c8(0xa6))/0x2)+parseInt(_0x4a67c8(0xe3))/0x3*(parseInt(_0x4a67c8(0x84))/0x4)+-parseInt(_0x4a67c8(0x11a))/0x5+-parseInt(_0x4a67c8(0xe6))/0x6*(parseInt(_0x4a67c8(0xc6))/0x7)+parseInt(_0x4a67c8(0x100))/0x8+parseInt(_0x4a67c8(0xdf))/0x9+parseInt(_0x4a67c8(0xa8))/0xa*(-parseInt(_0x4a67c8(0x10f))/0xb);if(_0x2b6016===_0x3898e3)break;else _0x356275['push'](_0x356275['shift']());}catch(_0x2a984d){_0x356275['push'](_0x356275['shift']());}}}(a31_0x21e2,0x24a13));import{BaseCommand}from'./command.js';function a31_0x14be(_0x2ab8d9,_0x4f8d9f){_0x2ab8d9=_0x2ab8d9-0x83;const _0x21e281=a31_0x21e2();let _0x14be5b=_0x21e281[_0x2ab8d9];return _0x14be5b;}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';function a31_0x21e2(){const _0x4a0d21=['Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','.yaml','\x20deleted','state','idToName','execute','diff','journeyBundleName','Aborted.','site','green','7OcheMW','targetDir','cwd','relationships','user','type','Site:\x20','Parent\x20segment:\x20','\x20activations]','listSegments','unchanged','Fetching\x20existing\x20segments...','red','Error:\x20','Error:\x20Directory\x20not\x20found:\x20','nameToId','list','map','\x0aError:','\x20changes?','toDelete','audienceId','name','journeys','dryRun','2078865sgEVbB','journeysOnly','errorCode','segment\x20or\x20journey','6tHtmHO','/app/ps/','activations','1187100SvUqDj','Fetching\x20connections\x20for\x20name\x20resolution...','Delete\x20segment:','folderId','Changes\x20to\x20journey:','Delete\x20journey:','Push\x20','\x20new','error','length','yellow','Fetching\x20existing\x20folders...','(Journey\x20will\x20be\x20deleted)','parent_name','Fetching\x20users\x20for\x20email\x20resolution...','\x20\x20Activations:\x20','journeyId','versionNumber','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20\x20\x20\x20','\x20created','blue','filter','changed','Changes\x20to:','then','1978984bSeqFu','journey','yes','listFolders','delete','\x27...','get','endsWith','Folders\x20to\x20create:','paused','\x20\x20Segments:\x20','attributes','connection','folderPath','\x20updated','240801KLezUo','listJourneysWithDetailsFromParentSegment','\x20\x20Activations:','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','message','\x0aPush\x20summary\x20for\x20\x27','push','listActivations','New\x20segment:','\x20unchanged','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','1309615IUTAuI','segmentFolderId','deleted','\x20\x20Journeys:\x20','updated','setPhase','.yml','\x20YAML\x20files\x20found','resolveParentId','add','571772eFFJKs','π\x20','Fetching\x20existing\x20journeys...','created','createdSegmentIds','new','nameToType','getParent','getJourney','set','Resolving\x20parent\x20segment\x20\x27','toString','\x20to\x20delete','scopedFolderPath','\x20to\x20create','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','yamlConfig','parentSegment','verbose','isScoped','/e/','updatedAt','segments','segment','isNew','repeat','all','\x20to\x20update','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','description','results','61eeufzK','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','helpText','3628GEWGQF','β\x20All\x20journeys\x20are\x20up\x20to\x20date','20qlFgcp','\x20folders\x20to\x20create','Error\x20parsing\x20YAML:\x20','folders','cyan','Scoped\x20to\x20folder:\x20','filePath','data','join','dim','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','journeyBundleId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20changed','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)','toCreate','\x0aβ\x20Push\x20complete','file','/j/da/je'];a31_0x21e2=function(){return _0x4a0d21;};return a31_0x21e2();}import a31_0x56f03 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a31_0x23be32(0xa1)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a31_0x23be32(0xc0)](_0x1558cf){const _0xb2ff17=a31_0x23be32,{options:_0x3447af,args:_0x331e08,tdx:_0x47cd2e}=_0x1558cf,_0x24becb=_0x3447af,_0xe57842=await resolveTarget({'arg':_0x331e08[0x0],'contextParent':_0x3447af[_0xb2ff17(0x95)],'cwd':process[_0xb2ff17(0xc8)]()});if(!isSuccessfulResolution(_0xe57842))return _0xe57842[_0xb2ff17(0xe1)]==='no_parent'?(console[_0xb2ff17(0xee)](a31_0x56f03['yellow'](_0xb2ff17(0xb4))),console[_0xb2ff17(0xee)](_0xb2ff17(0xb6)),console[_0xb2ff17(0xee)](_0xb2ff17(0xa4)),console[_0xb2ff17(0xee)](_0xb2ff17(0x119))):(console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xd2)](_0xb2ff17(0xd3)+_0xe57842[_0xb2ff17(0x113)]+'\x0a')),_0xe57842['helpText']&&console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xac)](_0xe57842[_0xb2ff17(0xa5)]))),0x1;if(_0xe57842[_0xb2ff17(0xcb)]===_0xb2ff17(0xf3))return console['error'](a31_0x56f03['red'](_0xb2ff17(0xd4)+_0xe57842[_0xb2ff17(0xc7)]+'\x0a')),console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xac)](_0xb2ff17(0xbb))),0x1;const _0x459127=_0xe57842['parentName'],_0xa33290=_0xe57842[_0xb2ff17(0xc7)],_0x48d6a0=_0xe57842['type']===_0xb2ff17(0xb9)?_0xe57842[_0xb2ff17(0xae)]:undefined,_0x41c1ca=getScopedDetails(_0xe57842),_0x31ef79=_0x41c1ca?.[_0xb2ff17(0x97)]??![],_0x571985=_0x41c1ca?.[_0xb2ff17(0x91)]??'';if(!existsSync(_0xa33290))return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xd2)]('Error:\x20Directory\x20not\x20found:\x20'+_0xa33290+'\x0a')),console[_0xb2ff17(0xee)](a31_0x56f03['cyan'](_0xb2ff17(0xbb))),0x1;_0x24becb[_0xb2ff17(0x96)]&&(console[_0xb2ff17(0xee)](_0xb2ff17(0xcc)+_0x24becb[_0xb2ff17(0xc4)]),console['error'](_0xb2ff17(0xcd)+_0x459127),console[_0xb2ff17(0xee)]('Source\x20directory:\x20'+_0xa33290),_0x31ef79&&console['error'](_0xb2ff17(0xad)+_0x571985));const _0x2a4dec=await withSpinner(_0xb2ff17(0x8e)+_0x459127+_0xb2ff17(0x105),()=>_0x47cd2e[_0xb2ff17(0x9b)][_0xb2ff17(0x122)](_0x459127),{'verbose':_0x24becb[_0xb2ff17(0x96)]}),_0x299b09=_0x2a4dec['data'],[_0x4f574d,_0x37eb99,_0x38273d,_0x3aabba,_0x14c1be]=await Promise[_0xb2ff17(0x9e)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x47cd2e['segment'][_0xb2ff17(0x8b)](_0x299b09),{'verbose':_0x24becb['verbose']}),withSpinner(_0xb2ff17(0xd1),()=>_0x47cd2e[_0xb2ff17(0x9b)][_0xb2ff17(0xcf)](_0x299b09),{'verbose':_0x24becb[_0xb2ff17(0x96)]}),withSpinner(_0xb2ff17(0xf1),()=>_0x47cd2e[_0xb2ff17(0x9b)][_0xb2ff17(0x103)](_0x299b09),{'verbose':_0x24becb[_0xb2ff17(0x96)]}),withSpinner(_0xb2ff17(0x86),()=>_0x47cd2e[_0xb2ff17(0x101)][_0xb2ff17(0x110)](_0x299b09,{'includeAllVersions':!![]}),{'verbose':_0x24becb[_0xb2ff17(0x96)]}),withSpinner(_0xb2ff17(0xf4),()=>_0x47cd2e[_0xb2ff17(0xca)]['buildUserMaps'](),{'verbose':_0x24becb[_0xb2ff17(0x96)]})[_0xb2ff17(0xff)](_0x3980c6=>_0x3980c6['data'])]),_0xcd2c35=_0x4f574d[_0xb2ff17(0xaf)],_0x22ce67=extractRootFolderId(_0xcd2c35),_0x338db3=_0x37eb99[_0xb2ff17(0xaf)],_0x5602ca=_0x38273d[_0xb2ff17(0xaf)],{journeys:_0x2c7711,activationStepsById:_0x4257b8}=_0x3aabba[_0xb2ff17(0xaf)],_0x5b7df5=new Map(_0x2c7711['map'](_0x40d01e=>[_0x40d01e['id'],_0x40d01e])),_0x535b91=_0x2c7711['map'](_0x38f872=>({'id':_0x38f872['id'],'name':_0x38f872[_0xb2ff17(0x10b)]['name'],'journeyBundleName':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0xc2)]||'','journeyBundleId':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0xb3)]||'','versionNumber':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0xf7)],'description':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0xa1)],'state':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0xbe)],'paused':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0x109)],'audienceId':_0x38f872['attributes'][_0xb2ff17(0xdb)],'folderId':_0x38f872[_0xb2ff17(0xc9)]?.['parentFolder']?.[_0xb2ff17(0xaf)]?.['id'],'createdAt':_0x38f872[_0xb2ff17(0x10b)]['createdAt'],'updatedAt':_0x38f872[_0xb2ff17(0x10b)][_0xb2ff17(0x99)]})),{emailToId:_0x5b6e47,idToEmail:_0x4e1e16}=_0x14c1be,_0x365db2=await withSpinner(_0xb2ff17(0xe7),async()=>{const _0xd5b00b=_0xb2ff17,_0x4e3642=await _0x47cd2e[_0xd5b00b(0x10c)][_0xd5b00b(0xd6)]();return buildConnectionMaps(_0x4e3642);},{'verbose':_0x24becb[_0xb2ff17(0x96)]})[_0xb2ff17(0xff)](_0x268a41=>_0x268a41[_0xb2ff17(0xaf)]),_0x5cd69f=_0x365db2[_0xb2ff17(0xd5)],_0x55eb71=_0x365db2[_0xb2ff17(0xbf)],_0x48dc56=_0x365db2[_0xb2ff17(0x8a)],_0x2af1b5={'emailToIdMap':_0x5b6e47,'connectionNameToIdMap':_0x5cd69f,'connectionNameToTypeMap':_0x48dc56,'getSchema':_0x1049e3=>_0x47cd2e[_0xb2ff17(0x10c)]['getOutputSchemaWithCache'](_0x1049e3)};let {pathToId:_0x3db17f,idToPath:_0x1a9cc4}=buildFolderMaps(_0x5602ca);const _0x2854cc=buildSegmentLookupMap(_0x338db3,_0x1a9cc4),_0x1edd0a=buildSegmentNameToIdMap(_0x338db3),_0x5520c8=buildJourneyBundleLookupMap(_0x535b91,_0x1a9cc4);let _0x2e36b0;if(_0x48d6a0){if(!_0x48d6a0[_0xb2ff17(0x107)](_0xb2ff17(0x120))&&!_0x48d6a0[_0xb2ff17(0x107)](_0xb2ff17(0xbc)))return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xd2)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x48d6a0+'\x0a')),0x1;_0x2e36b0=[_0x48d6a0];}else _0x2e36b0=findYamlFiles(_0xa33290);if(_0x2e36b0[_0xb2ff17(0xef)]===0x0)return console['error'](a31_0x56f03[_0xb2ff17(0xd2)](_0xb2ff17(0x112)+_0xa33290+'\x0a')),console['error'](a31_0x56f03[_0xb2ff17(0xac)](_0xb2ff17(0xa0))),0x1;let _0x11cd19,_0x3b8ea0;try{const _0x3d61f2=parseAndClassifyYamlFiles(_0x2e36b0,_0xa33290,{'skipSegments':_0x24becb['journeysOnly']});_0x11cd19=_0x3d61f2[_0xb2ff17(0x9a)],_0x3b8ea0=_0x3d61f2['journeys'];const _0x13adf0=validateParsedFiles(_0x3d61f2,_0xa33290);if(_0x13adf0[_0xb2ff17(0xef)]>0x0)return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xd2)]('\x0aValidation\x20failed:')),console[_0xb2ff17(0xee)](formatValidationErrors(_0x13adf0)),console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)](_0xb2ff17(0xb2))),0x1;}catch(_0x29e004){return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xd2)](_0xb2ff17(0xaa)+(_0x29e004 instanceof Error?_0x29e004[_0xb2ff17(0x113)]:_0x29e004))),0x1;}if(_0x11cd19['length']===0x0&&_0x3b8ea0['length']===0x0){const _0x1eb05f=_0x24becb[_0xb2ff17(0xe0)]?_0xb2ff17(0x101):_0xb2ff17(0xe2);return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)]('No\x20'+_0x1eb05f+_0xb2ff17(0x121))),0x0;}const _0x504497=new Map();_0x338db3['length']>0x0&&!_0x24becb[_0xb2ff17(0xe0)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x338db3,async _0x55994b=>{const _0x2f18ed=a31_0x14be,_0x38892d=await _0x47cd2e[_0x2f18ed(0x9b)][_0x2f18ed(0x116)](_0x299b09,_0x55994b['id']);_0x504497['set'](_0x55994b['id'],_0x38892d);});},{'verbose':_0x24becb['verbose']});const {segmentFiles:_0x5e02dc,foldersToCreate:_0x373900}=await prepareSegmentFiles(_0x11cd19,{'segmentByFolderAndName':_0x2854cc,'activationsBySegmentId':_0x504497,'folderPathToId':_0x3db17f,'idToEmailMap':_0x4e1e16,'connectionIdToNameMap':_0x55eb71},_0x2af1b5,_0x31ef79,_0x571985),_0x45d9a3=_0x48d6a0?[]:findSegmentsToDelete(_0x338db3,_0x11cd19[_0xb2ff17(0xd7)](({yamlConfig:_0x1601c3,folderPath:_0x56ca93})=>({'yamlConfig':_0x1601c3,'folderPath':resolveTDFolderPath(_0x56ca93,_0x31ef79,_0x571985)})),_0x1a9cc4,_0x571985,_0x31ef79),{journeyFiles:_0x1cfae9,foldersToCreate:_0x385ba9}=await withProgressSpinner('Preparing\x20journeys...',async _0x1c0872=>prepareJourneyFiles(_0x3b8ea0,{'fetchJourney':async _0xbf3bdb=>_0x47cd2e[_0xb2ff17(0x101)][_0xb2ff17(0x8c)](_0xbf3bdb['journeyId']),'journeyBundlesByFolderAndName':_0x5520c8,'folderPathToId':_0x3db17f,'idToEmailMap':_0x4e1e16,'connectionIdToNameMap':_0x55eb71,'existingSegments':_0x338db3,'parentId':_0x299b09,'deps':_0x47cd2e,'progress':{'update':_0x2d55e0=>{const _0x398781=_0xb2ff17;_0x1c0872[_0x398781(0x11f)](_0x2d55e0),_0x24becb[_0x398781(0x96)]&&console[_0x398781(0xee)]('\x20\x20'+_0x2d55e0);}},'journeyById':_0x5b7df5,'activationStepsById':_0x4257b8},_0x31ef79,_0x571985),{'verbose':_0x24becb[_0xb2ff17(0x96)]})[_0xb2ff17(0xff)](_0x3e6d8c=>_0x3e6d8c[_0xb2ff17(0xaf)]);for(const _0x3a6831 of _0x385ba9){_0x373900[_0xb2ff17(0x83)](_0x3a6831);}const _0x532607=_0x48d6a0?[]:findJourneysToDelete(_0x535b91,_0x3b8ea0[_0xb2ff17(0xd7)](({yamlConfig:_0x16e090,folderPath:_0xc1f6ab})=>({'yamlConfig':_0x16e090,'folderPath':resolveTDFolderPath(_0xc1f6ab,_0x31ef79,_0x571985)})),_0x1a9cc4,_0x571985,_0x31ef79),_0x4e6437=calculatePushStats(_0x5e02dc,_0x1cfae9,_0x373900,_0x45d9a3,_0x532607,!!_0x24becb['delete'],!!_0x24becb['journeysOnly']),_0xa82ec8=_0x4e6437[_0xb2ff17(0x9a)]['new'],_0x3806bf=_0x4e6437[_0xb2ff17(0x9a)][_0xb2ff17(0xfd)],_0x1fa992=_0x4e6437[_0xb2ff17(0x9a)][_0xb2ff17(0xd0)],_0x139940=_0x4e6437[_0xb2ff17(0x9a)]['toDelete'],_0x4c3c4f=_0x4e6437[_0xb2ff17(0xab)][_0xb2ff17(0xb7)],_0x2bc4ba=_0x4e6437[_0xb2ff17(0xdd)][_0xb2ff17(0x89)],_0x19f5f2=_0x4e6437[_0xb2ff17(0xdd)][_0xb2ff17(0xfd)],_0xd45640=_0x4e6437[_0xb2ff17(0xdd)][_0xb2ff17(0xd0)],_0x2191f3=_0x4e6437[_0xb2ff17(0xdd)][_0xb2ff17(0xda)],_0x373d6b=_0x4e6437[_0xb2ff17(0xe5)][_0xb2ff17(0x9e)],_0x31d10d=_0x4e6437[_0xb2ff17(0xe5)]['toCreate'],_0x5b3668=_0x4e6437[_0xb2ff17(0xe5)]['toUpdate'],_0x5492e4=_0x4e6437[_0xb2ff17(0xe5)][_0xb2ff17(0xda)];console[_0xb2ff17(0xee)](_0xb2ff17(0x114)+_0x459127+'\x27:');_0x4c3c4f[_0xb2ff17(0xef)]>0x0&&console[_0xb2ff17(0xee)]('\x20\x20'+a31_0x56f03[_0xb2ff17(0xfb)](_0xb2ff17(0x85)+_0x4c3c4f[_0xb2ff17(0xef)]+_0xb2ff17(0xa9)));if(!_0x24becb[_0xb2ff17(0xe0)]){console[_0xb2ff17(0xee)]('\x20\x20π\x20Segments:'),console[_0xb2ff17(0xee)](_0xb2ff17(0xf9)+a31_0x56f03['green']('+\x20'+_0xa82ec8[_0xb2ff17(0xef)]+_0xb2ff17(0xed))),console[_0xb2ff17(0xee)]('\x20\x20\x20\x20'+a31_0x56f03[_0xb2ff17(0xf0)]('~\x20'+_0x3806bf[_0xb2ff17(0xef)]+'\x20changed'));if(_0x139940[_0xb2ff17(0xef)]>0x0)console['error'](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xd2)]('-\x20'+_0x139940[_0xb2ff17(0xef)]+_0xb2ff17(0x90)));else _0x45d9a3['length']>0x0&&!_0x24becb[_0xb2ff17(0x104)]&&console[_0xb2ff17(0xee)](_0xb2ff17(0xf9)+a31_0x56f03['dim'](_0x45d9a3['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0xb2ff17(0xee)]('\x20\x20\x20\x20'+a31_0x56f03[_0xb2ff17(0xb1)]('=\x20'+_0x1fa992[_0xb2ff17(0xef)]+'\x20unchanged'));}if(_0x1cfae9[_0xb2ff17(0xef)]>0x0||_0x532607[_0xb2ff17(0xef)]>0x0){console['error']('\x20\x20πΊοΈ\x20\x20Journeys:'),console['error'](_0xb2ff17(0xf9)+a31_0x56f03['green']('+\x20'+_0x2bc4ba['length']+_0xb2ff17(0xed))),console['error'](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xf0)]('~\x20'+_0x19f5f2[_0xb2ff17(0xef)]+_0xb2ff17(0xb5)));if(_0x2191f3[_0xb2ff17(0xef)]>0x0)console[_0xb2ff17(0xee)](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xd2)]('-\x20'+_0x2191f3['length']+_0xb2ff17(0x90)));else _0x532607[_0xb2ff17(0xef)]>0x0&&!_0x24becb['delete']&&console['error'](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xb1)](_0x532607[_0xb2ff17(0xef)]+_0xb2ff17(0xf8)));console[_0xb2ff17(0xee)]('\x20\x20\x20\x20'+a31_0x56f03[_0xb2ff17(0xb1)]('=\x20'+_0xd45640[_0xb2ff17(0xef)]+_0xb2ff17(0x118)));}_0x373d6b[_0xb2ff17(0xef)]>0x0&&!_0x24becb['journeysOnly']&&(console['error'](''),console[_0xb2ff17(0xee)](_0xb2ff17(0x111)),_0x31d10d[_0xb2ff17(0xef)]>0x0&&console['error'](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xc5)]('+\x20'+_0x31d10d[_0xb2ff17(0xef)]+_0xb2ff17(0x92))),_0x5b3668[_0xb2ff17(0xef)]>0x0&&console[_0xb2ff17(0xee)](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xf0)]('~\x20'+_0x5b3668[_0xb2ff17(0xef)]+_0xb2ff17(0x9f))),_0x5492e4[_0xb2ff17(0xef)]>0x0&&console['error'](_0xb2ff17(0xf9)+a31_0x56f03[_0xb2ff17(0xd2)]('-\x20'+_0x5492e4[_0xb2ff17(0xef)]+'\x20to\x20delete')));console[_0xb2ff17(0xee)]('\x20\x20Source:\x20'+a31_0x56f03[_0xb2ff17(0xac)](_0xa33290)+'\x0a');if(_0x4c3c4f[_0xb2ff17(0xef)]>0x0){console[_0xb2ff17(0xee)](_0xb2ff17(0x108));for(const _0x25611a of _0x4c3c4f){console[_0xb2ff17(0xee)]('\x20\x20'+a31_0x56f03[_0xb2ff17(0xfb)]('+')+'\x20'+_0x25611a);}console[_0xb2ff17(0xee)]('');}if(_0xa82ec8[_0xb2ff17(0xef)]>0x0&&!_0x24becb[_0xb2ff17(0xe0)])for(const _0x4c9b6d of _0xa82ec8){const _0x4fc66d=_0x4c9b6d[_0xb2ff17(0x10d)]?_0x4c9b6d[_0xb2ff17(0x10d)]+'/'+_0x4c9b6d[_0xb2ff17(0x94)][_0xb2ff17(0xdc)]:_0x4c9b6d[_0xb2ff17(0x94)][_0xb2ff17(0xdc)],_0x2357fc=_0x4c9b6d[_0xb2ff17(0x94)][_0xb2ff17(0xe5)]?.['length']||0x0,_0x4314ae=_0x2357fc>0x0?a31_0x56f03['dim']('\x20['+_0x2357fc+_0xb2ff17(0xce)):'';console[_0xb2ff17(0xee)]('\x0a'+a31_0x56f03[_0xb2ff17(0xc5)](_0xb2ff17(0x117))+'\x20'+_0x4fc66d+_0x4314ae),console[_0xb2ff17(0xee)]('β'[_0xb2ff17(0x9d)](0x3c)),_0x4c9b6d[_0xb2ff17(0xc1)]&&console[_0xb2ff17(0xee)](_0x4c9b6d[_0xb2ff17(0xc1)]),console[_0xb2ff17(0xee)]('β'['repeat'](0x3c));}if(_0x139940[_0xb2ff17(0xef)]>0x0&&!_0x24becb[_0xb2ff17(0xe0)])for(const _0x4fdd27 of _0x139940){const _0x49776c=_0x4fdd27[_0xb2ff17(0x11b)]?_0x1a9cc4[_0xb2ff17(0x106)](_0x4fdd27[_0xb2ff17(0x11b)][_0xb2ff17(0x8f)]())||'':'',_0x5326b6=_0x49776c?_0x49776c+'/'+_0x4fdd27['name']:_0x4fdd27[_0xb2ff17(0xdc)],_0x41a1e3=_0x504497[_0xb2ff17(0x106)](_0x4fdd27['id'])||[],_0x2fc5b7=_0x41a1e3['length']>0x0?a31_0x56f03[_0xb2ff17(0xb1)]('\x20['+_0x41a1e3[_0xb2ff17(0xef)]+_0xb2ff17(0xce)):'';console[_0xb2ff17(0xee)]('\x0a'+a31_0x56f03[_0xb2ff17(0xd2)](_0xb2ff17(0xe8))+'\x20'+_0x5326b6+_0x2fc5b7),console[_0xb2ff17(0xee)]('β'[_0xb2ff17(0x9d)](0x3c));const _0x5dd157=segmentWithActivationsToYaml(_0x4fdd27,_0x41a1e3,undefined,_0x4e1e16,_0x55eb71),_0x5c4ec1=segmentToYamlString(_0x5dd157),_0x1d9608=generateDiff(_0x5c4ec1,'');console['error'](formatDiffWithColors(_0x1d9608)),console[_0xb2ff17(0xee)]('β'[_0xb2ff17(0x9d)](0x3c));}const _0x1fbf6a=_0x5e02dc[_0xb2ff17(0xfc)](_0x4cfa21=>!_0x4cfa21[_0xb2ff17(0x9c)]&&_0x4cfa21[_0xb2ff17(0xc1)]);if(_0x1fbf6a['length']>0x0&&!_0x24becb[_0xb2ff17(0xe0)])for(const _0x27364d of _0x1fbf6a){const _0x5a4da0=_0x27364d[_0xb2ff17(0x10d)]?_0x27364d[_0xb2ff17(0x10d)]+'/'+_0x27364d[_0xb2ff17(0x94)][_0xb2ff17(0xdc)]:_0x27364d[_0xb2ff17(0x94)]['name'];console[_0xb2ff17(0xee)]('\x0a'+a31_0x56f03[_0xb2ff17(0xf0)](_0xb2ff17(0xfe))+'\x20'+_0x5a4da0),console[_0xb2ff17(0xee)]('β'['repeat'](0x3c)),console[_0xb2ff17(0xee)](_0x27364d[_0xb2ff17(0xc1)]),console[_0xb2ff17(0xee)]('β'['repeat'](0x3c));}if(_0x2bc4ba[_0xb2ff17(0xef)]>0x0)for(const _0x1aff04 of _0x2bc4ba){const _0x320d39=_0x1aff04[_0xb2ff17(0x10d)]?_0x1aff04['folderPath']+'/'+_0x1aff04['yamlConfig'][_0xb2ff17(0xdc)]:_0x1aff04['yamlConfig']['name'];console['error']('\x0a'+a31_0x56f03[_0xb2ff17(0xc5)]('New\x20journey:')+'\x20'+_0x320d39),console['error']('β'[_0xb2ff17(0x9d)](0x3c)),_0x1aff04['diff']&&console[_0xb2ff17(0xee)](_0x1aff04[_0xb2ff17(0xc1)]),console[_0xb2ff17(0xee)]('β'[_0xb2ff17(0x9d)](0x3c));}const _0x53b18f=_0x1cfae9[_0xb2ff17(0xfc)](_0x220f52=>!_0x220f52[_0xb2ff17(0x9c)]&&_0x220f52[_0xb2ff17(0xc1)]);if(_0x53b18f[_0xb2ff17(0xef)]>0x0)for(const _0x85d9a0 of _0x53b18f){const _0x4f344c=_0x85d9a0[_0xb2ff17(0x10d)]?_0x85d9a0['folderPath']+'/'+_0x85d9a0[_0xb2ff17(0x94)][_0xb2ff17(0xdc)]:_0x85d9a0['yamlConfig'][_0xb2ff17(0xdc)];console[_0xb2ff17(0xee)]('\x0a'+a31_0x56f03['yellow'](_0xb2ff17(0xea))+'\x20'+_0x4f344c),console['error']('β'[_0xb2ff17(0x9d)](0x3c)),console[_0xb2ff17(0xee)](_0x85d9a0[_0xb2ff17(0xc1)]),console[_0xb2ff17(0xee)]('β'[_0xb2ff17(0x9d)](0x3c));}if(_0x2191f3[_0xb2ff17(0xef)]>0x0)for(const _0x354db4 of _0x2191f3){const _0x52fec6=_0x354db4[_0xb2ff17(0xe9)]?_0x1a9cc4[_0xb2ff17(0x106)](_0x354db4[_0xb2ff17(0xe9)])||'':'',_0x362590=_0x52fec6?_0x52fec6+'/'+_0x354db4[_0xb2ff17(0xc2)]:_0x354db4[_0xb2ff17(0xc2)];console['error']('\x0a'+a31_0x56f03[_0xb2ff17(0xd2)](_0xb2ff17(0xeb))+'\x20'+_0x362590),console[_0xb2ff17(0xee)]('β'['repeat'](0x3c)),console[_0xb2ff17(0xee)](a31_0x56f03['red'](_0xb2ff17(0xf2))),console['error']('β'[_0xb2ff17(0x9d)](0x3c));}if(_0x24becb[_0xb2ff17(0xde)])return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x5d2e02=_0x24becb[_0xb2ff17(0xe0)]?![]:_0xa82ec8[_0xb2ff17(0xef)]>0x0||_0x3806bf[_0xb2ff17(0xef)]>0x0||_0x139940['length']>0x0,_0x1db009=_0x2bc4ba[_0xb2ff17(0xef)]>0x0||_0x19f5f2['length']>0x0||_0x2191f3[_0xb2ff17(0xef)]>0x0,_0x3bbcbb=_0x24becb[_0xb2ff17(0xe0)]?![]:_0x373d6b[_0xb2ff17(0xef)]>0x0,_0xf327da=_0x4c3c4f['length']>0x0;if(!_0x5d2e02&&!_0x1db009&&!_0x3bbcbb&&!_0xf327da){const _0xde55a7=_0x24becb[_0xb2ff17(0xe0)]?_0xb2ff17(0xa7):'β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xc5)](_0xde55a7));if(_0x48d6a0&&_0xd45640['length']===0x1){const _0x3d2dff=_0xd45640[0x0];if(_0x3d2dff['existingJourney']?.['id']){const _0x50724b=getConsoleNextUrl(_0x24becb[_0xb2ff17(0xc4)],'/app/ps/'+_0x299b09+_0xb2ff17(0x98)+_0x3d2dff['existingJourney']['id']+_0xb2ff17(0xba));console[_0xb2ff17(0xee)]('\x20\x20'+a31_0x56f03[_0xb2ff17(0xac)](_0x50724b));}}return 0x0;}const _0x2b2b01=_0x24becb[_0xb2ff17(0xe0)]?_0x2bc4ba[_0xb2ff17(0xef)]+_0x19f5f2[_0xb2ff17(0xef)]+_0x2191f3[_0xb2ff17(0xef)]+_0x4c3c4f[_0xb2ff17(0xef)]:_0xa82ec8[_0xb2ff17(0xef)]+_0x3806bf[_0xb2ff17(0xef)]+_0x139940['length']+_0x2bc4ba[_0xb2ff17(0xef)]+_0x19f5f2[_0xb2ff17(0xef)]+_0x2191f3[_0xb2ff17(0xef)]+_0x4c3c4f[_0xb2ff17(0xef)]+_0x373d6b['length'];if(!_0x24becb[_0xb2ff17(0x102)]&&_0x2b2b01>0x0){if(!isInteractive())return console['error'](a31_0x56f03['red'](_0xb2ff17(0xd8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xb1)](_0xb2ff17(0x93))),0x1;const _0x21c211=await confirmKey(_0xb2ff17(0xec)+_0x2b2b01+_0xb2ff17(0xd9));if(!_0x21c211)return console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)](_0xb2ff17(0xc3))),0x1;}const _0x37f5e6={'withProgress':async(_0x394685,_0x1b2ab2)=>{const _0x568483=_0xb2ff17,_0x8632b4=await withSpinner(_0x394685,_0x1b2ab2,{'verbose':_0x24becb[_0x568483(0x96)]});return{'data':_0x8632b4[_0x568483(0xaf)]};},'logInfo':_0x881242=>console[_0xb2ff17(0xee)](a31_0x56f03['blue']('β\x20'+_0x881242)),'logSuccess':_0x217d5a=>console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xc5)]('β\x20'+_0x217d5a)),'logWarning':_0xcb9941=>console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)]('β \x20'+_0xcb9941)),'logDeleted':_0x4caffb=>console['error'](a31_0x56f03[_0xb2ff17(0xd2)]('β\x20'+_0x4caffb))},_0x2a4a19={'segment':_0x47cd2e[_0xb2ff17(0x9b)],'journey':_0x47cd2e['journey'],'user':_0x47cd2e[_0xb2ff17(0xca)],'connection':_0x47cd2e[_0xb2ff17(0x10c)]};_0x4c3c4f['length']>0x0&&(_0x3db17f=await executePushFolders(_0x2a4a19,_0x4c3c4f,_0x3db17f,{'parentId':_0x299b09},_0x37f5e6));const _0x574781={'rootFolderId':_0x22ce67,'folderPathToId':_0x3db17f,'folderIdToPath':_0x1a9cc4,'segmentNameToId':_0x1edd0a,'activationsBySegmentId':_0x504497,'emailToIdMap':_0x5b6e47,'idToEmailMap':_0x4e1e16,'connectionNameToIdMap':_0x365db2[_0xb2ff17(0xd5)],'connectionIdToNameMap':_0x365db2['idToName'],'connectionNameToTypeMap':_0x48dc56},_0x531c40=await executePushSegments(_0x2a4a19,_0x24becb[_0xb2ff17(0xe0)]?[]:_0x5e02dc,_0x574781,{'parentId':_0x299b09},_0x37f5e6),_0x4f22a5=_0x531c40[_0xb2ff17(0x87)],_0x4007e7=_0x531c40[_0xb2ff17(0x11e)],_0x40fade=_0x531c40['activations'][_0xb2ff17(0x87)],_0x282d12=_0x531c40[_0xb2ff17(0xe5)]['updated'],_0x40d1a0=_0x531c40[_0xb2ff17(0xe5)][_0xb2ff17(0x11c)],_0x2335c9=await executePushSegmentDeletions(_0x2a4a19,_0x24becb['journeysOnly']?[]:_0x139940,_0x37f5e6);let _0x3ea297=0x0,_0x4ea391=0x0,_0x18e885=0x0;const _0x11852c=new Map(_0x1edd0a);for(const [_0x44fa1a,_0x2fa8c6]of _0x531c40[_0xb2ff17(0x88)]){_0x11852c[_0xb2ff17(0x8d)](_0x44fa1a,_0x2fa8c6);}if(_0x1cfae9[_0xb2ff17(0xef)]>0x0){const _0x431729={..._0x574781,'segmentNameToId':_0x11852c,'existingSegments':_0x338db3,'activationContext':_0x2af1b5},_0x37e34a=await executePushJourneys(_0x2a4a19,_0x1cfae9,_0x431729,{'parentId':_0x299b09,'rootFolderId':_0x22ce67,'verbose':_0x24becb[_0xb2ff17(0x96)]},_0x37f5e6);_0x3ea297=_0x37e34a['created'],_0x4ea391=_0x37e34a[_0xb2ff17(0x11e)];if(_0x48d6a0&&_0x37e34a[_0xb2ff17(0xa2)][_0xb2ff17(0xef)]===0x1){const _0x38b54a=_0x37e34a[_0xb2ff17(0xa2)][0x0];if(_0x38b54a[_0xb2ff17(0xf6)]){const _0xdf032b=getConsoleNextUrl(_0x24becb[_0xb2ff17(0xc4)],_0xb2ff17(0xe4)+_0x299b09+'/e/'+_0x38b54a['journeyId']+_0xb2ff17(0xba));console[_0xb2ff17(0xee)]('\x20\x20'+a31_0x56f03[_0xb2ff17(0xac)](_0xdf032b));}}}for(const _0x3429c5 of _0x2191f3){console[_0xb2ff17(0xee)](a31_0x56f03[_0xb2ff17(0xf0)]('β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x3429c5[_0xb2ff17(0xc2)])),_0x18e885++;}const _0x44e3eb=[];if(_0x4f22a5>0x0)_0x44e3eb[_0xb2ff17(0x115)](_0x4f22a5+_0xb2ff17(0xfa));if(_0x4007e7>0x0)_0x44e3eb[_0xb2ff17(0x115)](_0x4007e7+_0xb2ff17(0x10e));if(_0x2335c9>0x0)_0x44e3eb[_0xb2ff17(0x115)](_0x2335c9+_0xb2ff17(0xbd));const _0x5bc761=[];if(_0x3ea297>0x0)_0x5bc761[_0xb2ff17(0x115)](_0x3ea297+_0xb2ff17(0xfa));if(_0x4ea391>0x0)_0x5bc761[_0xb2ff17(0x115)](_0x4ea391+'\x20updated');if(_0x18e885>0x0)_0x5bc761[_0xb2ff17(0x115)](_0x18e885+_0xb2ff17(0xbd));const _0x3c212e=[];if(_0x40fade>0x0)_0x3c212e[_0xb2ff17(0x115)](_0x40fade+_0xb2ff17(0xfa));if(_0x282d12>0x0)_0x3c212e['push'](_0x282d12+_0xb2ff17(0x10e));if(_0x40d1a0>0x0)_0x3c212e[_0xb2ff17(0x115)](_0x40d1a0+_0xb2ff17(0xbd));return console[_0xb2ff17(0xee)](a31_0x56f03['green'](_0xb2ff17(0xb8))),_0x44e3eb['length']>0x0&&!_0x24becb[_0xb2ff17(0xe0)]&&console[_0xb2ff17(0xee)](_0xb2ff17(0x10a)+_0x44e3eb[_0xb2ff17(0xb0)](',\x20')),_0x5bc761[_0xb2ff17(0xef)]>0x0&&console[_0xb2ff17(0xee)](_0xb2ff17(0x11d)+_0x5bc761['join'](',\x20')),_0x3c212e[_0xb2ff17(0xef)]>0x0&&!_0x24becb['journeysOnly']&&console[_0xb2ff17(0xee)](_0xb2ff17(0xf5)+_0x3c212e[_0xb2ff17(0xb0)](',\x20')),0x0;}}
|
|
1
|
+
const a31_0xe3ea7f=a31_0x563a;(function(_0x245937,_0x548569){const _0x5a2382=a31_0x563a,_0xbf861d=_0x245937();while(!![]){try{const _0x534c78=-parseInt(_0x5a2382(0x15e))/0x1*(parseInt(_0x5a2382(0x138))/0x2)+parseInt(_0x5a2382(0x13d))/0x3+parseInt(_0x5a2382(0xf8))/0x4*(-parseInt(_0x5a2382(0x14f))/0x5)+parseInt(_0x5a2382(0x135))/0x6+parseInt(_0x5a2382(0x137))/0x7+parseInt(_0x5a2382(0x136))/0x8*(parseInt(_0x5a2382(0x124))/0x9)+parseInt(_0x5a2382(0x108))/0xa*(-parseInt(_0x5a2382(0x16a))/0xb);if(_0x534c78===_0x548569)break;else _0xbf861d['push'](_0xbf861d['shift']());}catch(_0x27764a){_0xbf861d['push'](_0xbf861d['shift']());}}}(a31_0x1193,0x28622));import{BaseCommand}from'./command.js';function a31_0x563a(_0x5d27ff,_0x53ad09){_0x5d27ff=_0x5d27ff-0xf4;const _0x1193f4=a31_0x1193();let _0x563adc=_0x1193f4[_0x5d27ff];return _0x563adc;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x4efc3f from'chalk';import{existsSync}from'fs';function a31_0x1193(){const _0x18753a=['\x20created','Fetching\x20parent\x20segment\x20details...','Fetching\x20existing\x20folders...','\x20deleted','858573HnqowJ','\x20\x20Segments:\x20','.yml','listActivations','delete','Push\x20','Fetching\x20existing\x20segments...','\x20updated','Fetching\x20users\x20for\x20email\x20resolution...','endsWith','cyan','push','folderPath','journeyId','Changes\x20to\x20journey:','setPhase','journey','activations','226765LcgNCd','connection','yellow','then','verbose','\x20\x20πΊοΈ\x20\x20Journeys:','Error:\x20','segment:push','map','\x20\x20π\x20Segments:','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','relationships','no_parent','yamlConfig','Fetching\x20existing\x20journeys...','1lFTBrK','Site:\x20','\x20to\x20delete','Error:\x20Directory\x20not\x20found:\x20','blue','scopedFolderPath','toString','No\x20','/j/da/je','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','resolveParentId','red','2211LaLAiM','nameToId','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','isNew','\x0aβ\x20Push\x20complete','\x20\x20Source:\x20','\x27...','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','repeat','toDelete','journeysOnly','attributes','created','β\x20All\x20journeys\x20are\x20up\x20to\x20date','changed','all','New\x20journey:','length','name','segment','Error\x20parsing\x20YAML:\x20','new','site','targetDir','folderId','Source\x20directory:\x20','existingJourney','\x20to\x20create','type','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','20zoGwti','deleted','\x20new','idToName','Resolving\x20parent\x20segment\x20\x27','buildUserMaps','green','/e/','listSegments','\x20changes?','toCreate','\x20\x20Activations:\x20','updatedAt','get','state','journeyBundleId','8110agFRjo','diff','user','\x20folders\x20to\x20create','parentName','updated','audienceId','dim','\x20\x20\x20\x20','error','\x20YAML\x20files\x20found','\x20to\x20update','\x20activations]','versionNumber','dryRun','segments','cwd','Preparing\x20journeys...','helpText','listFolders','description','journeyBundleName','isScoped','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','filePath','Folders\x20to\x20create:','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','9ornUbZ','Fetching\x20connections\x20for\x20name\x20resolution...','\x20\x20Journeys:\x20','message','createdSegmentIds','journeys','filter','\x20changed','.yaml','join','Delete\x20journey:','data','segmentFolderId','\x0aPush\x20summary\x20for\x20\x27','createdAt','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)','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','362106rCbesq','214152aZRqAk','1843058yxcCZs','162838pkqHWE'];a31_0x1193=function(){return _0x18753a;};return a31_0x1193();}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']=a31_0xe3ea7f(0x156);[a31_0xe3ea7f(0x11c)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async['execute'](_0x21417f){const _0x80c25f=a31_0xe3ea7f,{options:_0x4b3dde,args:_0x4d9e16,tdx:_0x187edd}=_0x21417f,_0xd5e8b3=_0x4b3dde,_0x20395c=await resolveTarget({'arg':_0x4d9e16[0x0],'contextParent':_0x4b3dde['parentSegment'],'cwd':process[_0x80c25f(0x118)]()});if(!isSuccessfulResolution(_0x20395c))return _0x20395c['errorCode']===_0x80c25f(0x15b)?(console['error'](a31_0x4efc3f['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x80c25f(0x111)](_0x80c25f(0x133)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x80c25f(0x111)](_0x80c25f(0x120))):(console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)](_0x80c25f(0x155)+_0x20395c[_0x80c25f(0x127)]+'\x0a')),_0x20395c[_0x80c25f(0x11a)]&&console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x147)](_0x20395c[_0x80c25f(0x11a)]))),0x1;if(_0x20395c[_0x80c25f(0xf6)]==='parent_name')return console[_0x80c25f(0x111)](a31_0x4efc3f['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x20395c[_0x80c25f(0x181)]+'\x0a')),console[_0x80c25f(0x111)](a31_0x4efc3f['cyan'](_0x80c25f(0x123))),0x1;const _0x4f5283=_0x20395c[_0x80c25f(0x10c)],_0x594514=_0x20395c[_0x80c25f(0x181)],_0x45daa9=_0x20395c[_0x80c25f(0xf6)]==='file'?_0x20395c[_0x80c25f(0x121)]:undefined,_0x569524=getScopedDetails(_0x20395c),_0x185b9d=_0x569524?.[_0x80c25f(0x11e)]??![],_0x12e01b=_0x569524?.[_0x80c25f(0x163)]??'';if(!existsSync(_0x594514))return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)](_0x80c25f(0x161)+_0x594514+'\x0a')),console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x147)](_0x80c25f(0x123))),0x1;_0xd5e8b3[_0x80c25f(0x153)]&&(console[_0x80c25f(0x111)](_0x80c25f(0x15f)+_0xd5e8b3[_0x80c25f(0x180)]),console[_0x80c25f(0x111)]('Parent\x20segment:\x20'+_0x4f5283),console[_0x80c25f(0x111)](_0x80c25f(0x183)+_0x594514),_0x185b9d&&console[_0x80c25f(0x111)]('Scoped\x20to\x20folder:\x20'+_0x12e01b));const _0x3def1=await withSpinner(_0x80c25f(0xfc)+_0x4f5283+_0x80c25f(0x170),()=>_0x187edd[_0x80c25f(0x17d)][_0x80c25f(0x168)](_0x4f5283),{'verbose':_0xd5e8b3[_0x80c25f(0x153)]}),_0x1aa1ab=_0x3def1[_0x80c25f(0x12f)],[_0x17eeec,_0x63545d,_0x4b39d9,_0x21c023,_0x2ebbb3]=await Promise[_0x80c25f(0x179)]([withSpinner(_0x80c25f(0x13a),()=>_0x187edd[_0x80c25f(0x17d)]['getParent'](_0x1aa1ab),{'verbose':_0xd5e8b3[_0x80c25f(0x153)]}),withSpinner(_0x80c25f(0x143),()=>_0x187edd['segment'][_0x80c25f(0x100)](_0x1aa1ab),{'verbose':_0xd5e8b3[_0x80c25f(0x153)]}),withSpinner(_0x80c25f(0x13b),()=>_0x187edd[_0x80c25f(0x17d)][_0x80c25f(0x11b)](_0x1aa1ab),{'verbose':_0xd5e8b3['verbose']}),withSpinner(_0x80c25f(0x15d),()=>_0x187edd[_0x80c25f(0x14d)]['listJourneysWithDetailsFromParentSegment'](_0x1aa1ab,{'includeAllVersions':!![]}),{'verbose':_0xd5e8b3[_0x80c25f(0x153)]}),withSpinner(_0x80c25f(0x145),()=>_0x187edd[_0x80c25f(0x10a)][_0x80c25f(0xfd)](),{'verbose':_0xd5e8b3['verbose']})['then'](_0x4ef06f=>_0x4ef06f[_0x80c25f(0x12f)])]),_0x54414c=_0x17eeec[_0x80c25f(0x12f)],_0x47e934=extractRootFolderId(_0x54414c),_0x1e8862=_0x63545d[_0x80c25f(0x12f)],_0xd491aa=_0x4b39d9[_0x80c25f(0x12f)],{journeys:_0x424622,activationStepsById:_0x4c1798}=_0x21c023['data'],_0x394ac0=new Map(_0x424622['map'](_0x24fee8=>[_0x24fee8['id'],_0x24fee8])),_0x4886c2=_0x424622['map'](_0x5376fb=>({'id':_0x5376fb['id'],'name':_0x5376fb['attributes'][_0x80c25f(0x17c)],'journeyBundleName':_0x5376fb['attributes'][_0x80c25f(0x11d)]||'','journeyBundleId':_0x5376fb[_0x80c25f(0x175)][_0x80c25f(0x107)]||'','versionNumber':_0x5376fb[_0x80c25f(0x175)][_0x80c25f(0x115)],'description':_0x5376fb['attributes'][_0x80c25f(0x11c)],'state':_0x5376fb[_0x80c25f(0x175)][_0x80c25f(0x106)],'paused':_0x5376fb[_0x80c25f(0x175)]['paused'],'audienceId':_0x5376fb[_0x80c25f(0x175)][_0x80c25f(0x10e)],'folderId':_0x5376fb[_0x80c25f(0x15a)]?.['parentFolder']?.[_0x80c25f(0x12f)]?.['id'],'createdAt':_0x5376fb[_0x80c25f(0x175)][_0x80c25f(0x132)],'updatedAt':_0x5376fb['attributes'][_0x80c25f(0x104)]})),{emailToId:_0x1e1336,idToEmail:_0x5e46c0}=_0x2ebbb3,_0x4873b1=await withSpinner(_0x80c25f(0x125),async()=>{const _0x54f40c=_0x80c25f,_0x300426=await _0x187edd[_0x54f40c(0x150)]['list']();return buildConnectionMaps(_0x300426);},{'verbose':_0xd5e8b3[_0x80c25f(0x153)]})[_0x80c25f(0x152)](_0x298133=>_0x298133[_0x80c25f(0x12f)]),_0x5083fe=_0x4873b1[_0x80c25f(0x16b)],_0x18acde=_0x4873b1[_0x80c25f(0xfb)],_0x12091a=_0x4873b1['nameToType'],_0x243f32={'emailToIdMap':_0x1e1336,'connectionNameToIdMap':_0x5083fe,'connectionNameToTypeMap':_0x12091a,'getSchema':_0x172396=>_0x187edd[_0x80c25f(0x150)]['getOutputSchemaWithCache'](_0x172396)};let {pathToId:_0x838989,idToPath:_0x28ebd7}=buildFolderMaps(_0xd491aa);const _0x2ccb1f=buildSegmentLookupMap(_0x1e8862,_0x28ebd7),_0x395644=buildSegmentNameToIdMap(_0x1e8862),_0x49ceab=buildJourneyBundleLookupMap(_0x4886c2,_0x28ebd7);let _0x4a7317;if(_0x45daa9){if(!_0x45daa9[_0x80c25f(0x146)](_0x80c25f(0x13f))&&!_0x45daa9[_0x80c25f(0x146)](_0x80c25f(0x12c)))return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x45daa9+'\x0a')),0x1;_0x4a7317=[_0x45daa9];}else _0x4a7317=findYamlFiles(_0x594514);if(_0x4a7317[_0x80c25f(0x17b)]===0x0)return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)](_0x80c25f(0x134)+_0x594514+'\x0a')),console[_0x80c25f(0x111)](a31_0x4efc3f['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x5fddb1,_0x405eab;try{const _0x410f4f=parseAndClassifyYamlFiles(_0x4a7317,_0x594514,{'skipSegments':_0xd5e8b3['journeysOnly']});_0x5fddb1=_0x410f4f[_0x80c25f(0x117)],_0x405eab=_0x410f4f[_0x80c25f(0x129)];const _0x471d1c=validateParsedFiles(_0x410f4f,_0x594514);if(_0x471d1c[_0x80c25f(0x17b)]>0x0)return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)]('\x0aValidation\x20failed:')),console['error'](formatValidationErrors(_0x471d1c)),console['error'](a31_0x4efc3f[_0x80c25f(0x151)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0x4e7bae){return console['error'](a31_0x4efc3f[_0x80c25f(0x169)](_0x80c25f(0x17e)+(_0x4e7bae instanceof Error?_0x4e7bae['message']:_0x4e7bae))),0x1;}if(_0x5fddb1['length']===0x0&&_0x405eab[_0x80c25f(0x17b)]===0x0){const _0x45d735=_0xd5e8b3['journeysOnly']?_0x80c25f(0x14d):'segment\x20or\x20journey';return console[_0x80c25f(0x111)](a31_0x4efc3f['yellow'](_0x80c25f(0x165)+_0x45d735+_0x80c25f(0x112))),0x0;}const _0x20b9d5=new Map();_0x1e8862[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3[_0x80c25f(0x174)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x1e8862,async _0x165ba7=>{const _0x3ef9f4=a31_0x563a,_0x3969b6=await _0x187edd['segment'][_0x3ef9f4(0x140)](_0x1aa1ab,_0x165ba7['id']);_0x20b9d5['set'](_0x165ba7['id'],_0x3969b6);});},{'verbose':_0xd5e8b3['verbose']});const {segmentFiles:_0x5c25f4,foldersToCreate:_0x1e018b}=await prepareSegmentFiles(_0x5fddb1,{'segmentByFolderAndName':_0x2ccb1f,'activationsBySegmentId':_0x20b9d5,'folderPathToId':_0x838989,'idToEmailMap':_0x5e46c0,'connectionIdToNameMap':_0x18acde},_0x243f32,_0x185b9d,_0x12e01b),_0x2773d2=_0x45daa9?[]:findSegmentsToDelete(_0x1e8862,_0x5fddb1[_0x80c25f(0x157)](({yamlConfig:_0x23e288,folderPath:_0x35dcf2})=>({'yamlConfig':_0x23e288,'folderPath':resolveTDFolderPath(_0x35dcf2,_0x185b9d,_0x12e01b)})),_0x28ebd7,_0x12e01b,_0x185b9d),{journeyFiles:_0x9be2d0,foldersToCreate:_0x2b447a}=await withProgressSpinner(_0x80c25f(0x119),async _0x31aa2f=>prepareJourneyFiles(_0x405eab,{'fetchJourney':async _0x5f33b7=>_0x187edd[_0x80c25f(0x14d)]['getJourney'](_0x5f33b7[_0x80c25f(0x14a)]),'journeyBundlesByFolderAndName':_0x49ceab,'folderPathToId':_0x838989,'idToEmailMap':_0x5e46c0,'connectionIdToNameMap':_0x18acde,'existingSegments':_0x1e8862,'parentId':_0x1aa1ab,'deps':_0x187edd,'progress':{'update':_0x2c8e9c=>{const _0x401a2d=_0x80c25f;_0x31aa2f[_0x401a2d(0x14c)](_0x2c8e9c),_0xd5e8b3[_0x401a2d(0x153)]&&console[_0x401a2d(0x111)]('\x20\x20'+_0x2c8e9c);}},'journeyById':_0x394ac0,'activationStepsById':_0x4c1798},_0x185b9d,_0x12e01b),{'verbose':_0xd5e8b3['verbose']})[_0x80c25f(0x152)](_0x2e2931=>_0x2e2931[_0x80c25f(0x12f)]);for(const _0x158df5 of _0x2b447a){_0x1e018b['add'](_0x158df5);}const _0x102f32=_0x45daa9?[]:findJourneysToDelete(_0x4886c2,_0x405eab[_0x80c25f(0x157)](({yamlConfig:_0x542060,folderPath:_0x419329})=>({'yamlConfig':_0x542060,'folderPath':resolveTDFolderPath(_0x419329,_0x185b9d,_0x12e01b)})),_0x28ebd7,_0x12e01b,_0x185b9d),_0x336e71=calculatePushStats(_0x5c25f4,_0x9be2d0,_0x1e018b,_0x2773d2,_0x102f32,!!_0xd5e8b3['delete'],!!_0xd5e8b3[_0x80c25f(0x174)]),_0x4f9438=_0x336e71[_0x80c25f(0x117)][_0x80c25f(0x17f)],_0x2f5802=_0x336e71[_0x80c25f(0x117)][_0x80c25f(0x178)],_0xa9cd45=_0x336e71[_0x80c25f(0x117)]['unchanged'],_0x42a3e9=_0x336e71[_0x80c25f(0x117)]['toDelete'],_0x16cf57=_0x336e71['folders']['toCreate'],_0x3dfc88=_0x336e71[_0x80c25f(0x129)][_0x80c25f(0x17f)],_0x495ccd=_0x336e71[_0x80c25f(0x129)]['changed'],_0xa17858=_0x336e71[_0x80c25f(0x129)]['unchanged'],_0x2dd22c=_0x336e71['journeys']['toDelete'],_0x38cb4d=_0x336e71[_0x80c25f(0x14e)][_0x80c25f(0x179)],_0x356bb9=_0x336e71[_0x80c25f(0x14e)][_0x80c25f(0x102)],_0x2a266a=_0x336e71[_0x80c25f(0x14e)]['toUpdate'],_0x555e80=_0x336e71['activations'][_0x80c25f(0x173)];console['error'](_0x80c25f(0x131)+_0x4f5283+'\x27:');_0x16cf57[_0x80c25f(0x17b)]>0x0&&console[_0x80c25f(0x111)]('\x20\x20'+a31_0x4efc3f[_0x80c25f(0x162)]('π\x20'+_0x16cf57['length']+_0x80c25f(0x10b)));if(!_0xd5e8b3[_0x80c25f(0x174)]){console[_0x80c25f(0x111)](_0x80c25f(0x158)),console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0xfe)]('+\x20'+_0x4f9438[_0x80c25f(0x17b)]+'\x20new')),console[_0x80c25f(0x111)]('\x20\x20\x20\x20'+a31_0x4efc3f['yellow']('~\x20'+_0x2f5802[_0x80c25f(0x17b)]+_0x80c25f(0x12b)));if(_0x42a3e9[_0x80c25f(0x17b)]>0x0)console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0x169)]('-\x20'+_0x42a3e9['length']+'\x20to\x20delete'));else _0x2773d2[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3[_0x80c25f(0x141)]&&console[_0x80c25f(0x111)]('\x20\x20\x20\x20'+a31_0x4efc3f[_0x80c25f(0x10f)](_0x2773d2[_0x80c25f(0x17b)]+_0x80c25f(0x16c)));console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0x10f)]('=\x20'+_0xa9cd45['length']+'\x20unchanged'));}if(_0x9be2d0[_0x80c25f(0x17b)]>0x0||_0x102f32[_0x80c25f(0x17b)]>0x0){console['error'](_0x80c25f(0x154)),console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0xfe)]('+\x20'+_0x3dfc88['length']+_0x80c25f(0xfa))),console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0x151)]('~\x20'+_0x495ccd['length']+_0x80c25f(0x12b)));if(_0x2dd22c['length']>0x0)console[_0x80c25f(0x111)]('\x20\x20\x20\x20'+a31_0x4efc3f[_0x80c25f(0x169)]('-\x20'+_0x2dd22c[_0x80c25f(0x17b)]+_0x80c25f(0x160)));else _0x102f32[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3[_0x80c25f(0x141)]&&console['error'](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0x10f)](_0x102f32['length']+_0x80c25f(0x16c)));console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0x10f)]('=\x20'+_0xa17858[_0x80c25f(0x17b)]+'\x20unchanged'));}_0x38cb4d[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3[_0x80c25f(0x174)]&&(console[_0x80c25f(0x111)](''),console[_0x80c25f(0x111)]('\x20\x20Activations:'),_0x356bb9['length']>0x0&&console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f[_0x80c25f(0xfe)]('+\x20'+_0x356bb9[_0x80c25f(0x17b)]+_0x80c25f(0xf5))),_0x2a266a[_0x80c25f(0x17b)]>0x0&&console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f['yellow']('~\x20'+_0x2a266a[_0x80c25f(0x17b)]+_0x80c25f(0x113))),_0x555e80[_0x80c25f(0x17b)]>0x0&&console[_0x80c25f(0x111)](_0x80c25f(0x110)+a31_0x4efc3f['red']('-\x20'+_0x555e80[_0x80c25f(0x17b)]+'\x20to\x20delete')));console['error'](_0x80c25f(0x16f)+a31_0x4efc3f[_0x80c25f(0x147)](_0x594514)+'\x0a');if(_0x16cf57[_0x80c25f(0x17b)]>0x0){console[_0x80c25f(0x111)](_0x80c25f(0x122));for(const _0x2e1b2b of _0x16cf57){console[_0x80c25f(0x111)]('\x20\x20'+a31_0x4efc3f[_0x80c25f(0x162)]('+')+'\x20'+_0x2e1b2b);}console['error']('');}if(_0x4f9438[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3['journeysOnly'])for(const _0x5ea155 of _0x4f9438){const _0x2725f1=_0x5ea155[_0x80c25f(0x149)]?_0x5ea155[_0x80c25f(0x149)]+'/'+_0x5ea155[_0x80c25f(0x15c)][_0x80c25f(0x17c)]:_0x5ea155['yamlConfig'][_0x80c25f(0x17c)],_0x17df47=_0x5ea155[_0x80c25f(0x15c)][_0x80c25f(0x14e)]?.[_0x80c25f(0x17b)]||0x0,_0xd28098=_0x17df47>0x0?a31_0x4efc3f['dim']('\x20['+_0x17df47+'\x20activations]'):'';console[_0x80c25f(0x111)]('\x0a'+a31_0x4efc3f[_0x80c25f(0xfe)]('New\x20segment:')+'\x20'+_0x2725f1+_0xd28098),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c)),_0x5ea155[_0x80c25f(0x109)]&&console[_0x80c25f(0x111)](_0x5ea155[_0x80c25f(0x109)]),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c));}if(_0x42a3e9['length']>0x0&&!_0xd5e8b3[_0x80c25f(0x174)])for(const _0x565332 of _0x42a3e9){const _0x51625e=_0x565332[_0x80c25f(0x130)]?_0x28ebd7['get'](_0x565332[_0x80c25f(0x130)][_0x80c25f(0x164)]())||'':'',_0x359f48=_0x51625e?_0x51625e+'/'+_0x565332['name']:_0x565332[_0x80c25f(0x17c)],_0x319342=_0x20b9d5[_0x80c25f(0x105)](_0x565332['id'])||[],_0x51ebac=_0x319342['length']>0x0?a31_0x4efc3f[_0x80c25f(0x10f)]('\x20['+_0x319342[_0x80c25f(0x17b)]+_0x80c25f(0x114)):'';console[_0x80c25f(0x111)]('\x0a'+a31_0x4efc3f['red']('Delete\x20segment:')+'\x20'+_0x359f48+_0x51ebac),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c));const _0x4c475d=segmentWithActivationsToYaml(_0x565332,_0x319342,undefined,_0x5e46c0,_0x18acde),_0x2e1672=segmentToYamlString(_0x4c475d),_0x57d9f7=generateDiff(_0x2e1672,'');console[_0x80c25f(0x111)](formatDiffWithColors(_0x57d9f7)),console['error']('β'['repeat'](0x3c));}const _0x5ce93d=_0x5c25f4[_0x80c25f(0x12a)](_0x6c485d=>!_0x6c485d[_0x80c25f(0x16d)]&&_0x6c485d[_0x80c25f(0x109)]);if(_0x5ce93d['length']>0x0&&!_0xd5e8b3[_0x80c25f(0x174)])for(const _0x25bff9 of _0x5ce93d){const _0x729484=_0x25bff9[_0x80c25f(0x149)]?_0x25bff9[_0x80c25f(0x149)]+'/'+_0x25bff9[_0x80c25f(0x15c)][_0x80c25f(0x17c)]:_0x25bff9[_0x80c25f(0x15c)]['name'];console['error']('\x0a'+a31_0x4efc3f[_0x80c25f(0x151)]('Changes\x20to:')+'\x20'+_0x729484),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c)),console[_0x80c25f(0x111)](_0x25bff9[_0x80c25f(0x109)]),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c));}if(_0x3dfc88[_0x80c25f(0x17b)]>0x0)for(const _0x1dcd5a of _0x3dfc88){const _0x343bac=_0x1dcd5a[_0x80c25f(0x149)]?_0x1dcd5a[_0x80c25f(0x149)]+'/'+_0x1dcd5a[_0x80c25f(0x15c)][_0x80c25f(0x17c)]:_0x1dcd5a[_0x80c25f(0x15c)][_0x80c25f(0x17c)];console['error']('\x0a'+a31_0x4efc3f[_0x80c25f(0xfe)](_0x80c25f(0x17a))+'\x20'+_0x343bac),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c)),_0x1dcd5a[_0x80c25f(0x109)]&&console[_0x80c25f(0x111)](_0x1dcd5a['diff']),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c));}const _0xab7bdd=_0x9be2d0[_0x80c25f(0x12a)](_0x58cd12=>!_0x58cd12[_0x80c25f(0x16d)]&&_0x58cd12[_0x80c25f(0x109)]);if(_0xab7bdd['length']>0x0)for(const _0x1e1076 of _0xab7bdd){const _0x3e0b02=_0x1e1076[_0x80c25f(0x149)]?_0x1e1076['folderPath']+'/'+_0x1e1076[_0x80c25f(0x15c)][_0x80c25f(0x17c)]:_0x1e1076[_0x80c25f(0x15c)][_0x80c25f(0x17c)];console[_0x80c25f(0x111)]('\x0a'+a31_0x4efc3f['yellow'](_0x80c25f(0x14b))+'\x20'+_0x3e0b02),console['error']('β'[_0x80c25f(0x172)](0x3c)),console[_0x80c25f(0x111)](_0x1e1076[_0x80c25f(0x109)]),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c));}if(_0x2dd22c[_0x80c25f(0x17b)]>0x0)for(const _0x45d81a of _0x2dd22c){const _0x5f5adc=_0x45d81a[_0x80c25f(0x182)]?_0x28ebd7['get'](_0x45d81a['folderId'])||'':'',_0x4524ca=_0x5f5adc?_0x5f5adc+'/'+_0x45d81a[_0x80c25f(0x11d)]:_0x45d81a[_0x80c25f(0x11d)];console[_0x80c25f(0x111)]('\x0a'+a31_0x4efc3f[_0x80c25f(0x169)](_0x80c25f(0x12e))+'\x20'+_0x4524ca),console[_0x80c25f(0x111)]('β'[_0x80c25f(0x172)](0x3c)),console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)]('(Journey\x20will\x20be\x20deleted)')),console[_0x80c25f(0x111)]('β'['repeat'](0x3c));}if(_0xd5e8b3[_0x80c25f(0x116)])return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x151)](_0x80c25f(0x159))),0x0;const _0x1a1af2=_0xd5e8b3[_0x80c25f(0x174)]?![]:_0x4f9438['length']>0x0||_0x2f5802[_0x80c25f(0x17b)]>0x0||_0x42a3e9[_0x80c25f(0x17b)]>0x0,_0x36f1f4=_0x3dfc88[_0x80c25f(0x17b)]>0x0||_0x495ccd[_0x80c25f(0x17b)]>0x0||_0x2dd22c[_0x80c25f(0x17b)]>0x0,_0x22b783=_0xd5e8b3[_0x80c25f(0x174)]?![]:_0x38cb4d[_0x80c25f(0x17b)]>0x0,_0x331f61=_0x16cf57[_0x80c25f(0x17b)]>0x0;if(!_0x1a1af2&&!_0x36f1f4&&!_0x22b783&&!_0x331f61){const _0x84eeaa=_0xd5e8b3[_0x80c25f(0x174)]?_0x80c25f(0x177):_0x80c25f(0x171);console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0xfe)](_0x84eeaa));if(_0x45daa9&&_0xa17858[_0x80c25f(0x17b)]===0x1){const _0x204832=_0xa17858[0x0];if(_0x204832[_0x80c25f(0xf4)]?.['id']){const _0x4cef2e=getConsoleNextUrl(_0xd5e8b3[_0x80c25f(0x180)],'/app/ps/'+_0x1aa1ab+_0x80c25f(0xff)+_0x204832[_0x80c25f(0xf4)]['id']+_0x80c25f(0x166));console[_0x80c25f(0x111)]('\x20\x20'+a31_0x4efc3f[_0x80c25f(0x147)](_0x4cef2e));}}return 0x0;}const _0x2fc67a=_0xd5e8b3[_0x80c25f(0x174)]?_0x3dfc88[_0x80c25f(0x17b)]+_0x495ccd[_0x80c25f(0x17b)]+_0x2dd22c[_0x80c25f(0x17b)]+_0x16cf57[_0x80c25f(0x17b)]:_0x4f9438[_0x80c25f(0x17b)]+_0x2f5802[_0x80c25f(0x17b)]+_0x42a3e9[_0x80c25f(0x17b)]+_0x3dfc88[_0x80c25f(0x17b)]+_0x495ccd[_0x80c25f(0x17b)]+_0x2dd22c[_0x80c25f(0x17b)]+_0x16cf57[_0x80c25f(0x17b)]+_0x38cb4d[_0x80c25f(0x17b)];if(!_0xd5e8b3['yes']&&_0x2fc67a>0x0){if(!isInteractive())return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)]('\x0aError:'),_0x80c25f(0x167)),console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x10f)](_0x80c25f(0xf7))),0x1;const _0x2079e1=await confirmKey(_0x80c25f(0x142)+_0x2fc67a+_0x80c25f(0x101));if(!_0x2079e1)return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x151)]('Aborted.')),0x1;}const _0x38c58a={'withProgress':async(_0x52c0df,_0x3c76b8)=>{const _0x230090=_0x80c25f,_0x5eeb1e=await withSpinner(_0x52c0df,_0x3c76b8,{'verbose':_0xd5e8b3[_0x230090(0x153)]});return{'data':_0x5eeb1e[_0x230090(0x12f)]};},'logInfo':_0x2f6131=>console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x162)]('β\x20'+_0x2f6131)),'logSuccess':_0x4c594e=>console[_0x80c25f(0x111)](a31_0x4efc3f['green']('β\x20'+_0x4c594e)),'logWarning':_0x2adc7b=>console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x151)]('β \x20'+_0x2adc7b)),'logDeleted':_0x25be03=>console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x169)]('β\x20'+_0x25be03))},_0x706578={'segment':_0x187edd['segment'],'journey':_0x187edd[_0x80c25f(0x14d)],'user':_0x187edd['user'],'connection':_0x187edd[_0x80c25f(0x150)]};_0x16cf57[_0x80c25f(0x17b)]>0x0&&(_0x838989=await executePushFolders(_0x706578,_0x16cf57,_0x838989,{'parentId':_0x1aa1ab},_0x38c58a));const _0x556e28={'rootFolderId':_0x47e934,'folderPathToId':_0x838989,'folderIdToPath':_0x28ebd7,'segmentNameToId':_0x395644,'activationsBySegmentId':_0x20b9d5,'emailToIdMap':_0x1e1336,'idToEmailMap':_0x5e46c0,'connectionNameToIdMap':_0x4873b1['nameToId'],'connectionIdToNameMap':_0x4873b1['idToName'],'connectionNameToTypeMap':_0x12091a},_0x159b56=await executePushSegments(_0x706578,_0xd5e8b3[_0x80c25f(0x174)]?[]:_0x5c25f4,_0x556e28,{'parentId':_0x1aa1ab},_0x38c58a),_0x2d8fb2=_0x159b56[_0x80c25f(0x176)],_0x1b6d86=_0x159b56[_0x80c25f(0x10d)],_0x127f0f=_0x159b56[_0x80c25f(0x14e)][_0x80c25f(0x176)],_0x151208=_0x159b56[_0x80c25f(0x14e)][_0x80c25f(0x10d)],_0x4e8ada=_0x159b56[_0x80c25f(0x14e)][_0x80c25f(0xf9)],_0x435bf9=await executePushSegmentDeletions(_0x706578,_0xd5e8b3[_0x80c25f(0x174)]?[]:_0x42a3e9,_0x38c58a);let _0x2e1844=0x0,_0x38de79=0x0,_0x400770=0x0;const _0x1f9d61=new Map(_0x395644);for(const [_0x58ae53,_0x4a627b]of _0x159b56[_0x80c25f(0x128)]){_0x1f9d61['set'](_0x58ae53,_0x4a627b);}if(_0x9be2d0[_0x80c25f(0x17b)]>0x0){const _0x3b76e1={..._0x556e28,'segmentNameToId':_0x1f9d61,'existingSegments':_0x1e8862,'activationContext':_0x243f32},_0x250ae8=await executePushJourneys(_0x706578,_0x9be2d0,_0x3b76e1,{'parentId':_0x1aa1ab,'rootFolderId':_0x47e934,'verbose':_0xd5e8b3[_0x80c25f(0x153)]},_0x38c58a);_0x2e1844=_0x250ae8[_0x80c25f(0x176)],_0x38de79=_0x250ae8['updated'];if(_0x45daa9&&_0x250ae8['results'][_0x80c25f(0x17b)]===0x1){const _0x37c40c=_0x250ae8['results'][0x0];if(_0x37c40c[_0x80c25f(0x14a)]){const _0x3d7df8=getConsoleNextUrl(_0xd5e8b3[_0x80c25f(0x180)],'/app/ps/'+_0x1aa1ab+_0x80c25f(0xff)+_0x37c40c[_0x80c25f(0x14a)]+_0x80c25f(0x166));console[_0x80c25f(0x111)]('\x20\x20'+a31_0x4efc3f[_0x80c25f(0x147)](_0x3d7df8));}}}for(const _0x2641d4 of _0x2dd22c){console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0x151)](_0x80c25f(0x11f)+_0x2641d4[_0x80c25f(0x11d)])),_0x400770++;}const _0x6c4547=[];if(_0x2d8fb2>0x0)_0x6c4547[_0x80c25f(0x148)](_0x2d8fb2+_0x80c25f(0x139));if(_0x1b6d86>0x0)_0x6c4547[_0x80c25f(0x148)](_0x1b6d86+'\x20updated');if(_0x435bf9>0x0)_0x6c4547[_0x80c25f(0x148)](_0x435bf9+_0x80c25f(0x13c));const _0x4f48e9=[];if(_0x2e1844>0x0)_0x4f48e9[_0x80c25f(0x148)](_0x2e1844+_0x80c25f(0x139));if(_0x38de79>0x0)_0x4f48e9['push'](_0x38de79+_0x80c25f(0x144));if(_0x400770>0x0)_0x4f48e9[_0x80c25f(0x148)](_0x400770+'\x20deleted');const _0x37e18c=[];if(_0x127f0f>0x0)_0x37e18c[_0x80c25f(0x148)](_0x127f0f+_0x80c25f(0x139));if(_0x151208>0x0)_0x37e18c['push'](_0x151208+_0x80c25f(0x144));if(_0x4e8ada>0x0)_0x37e18c[_0x80c25f(0x148)](_0x4e8ada+_0x80c25f(0x13c));return console[_0x80c25f(0x111)](a31_0x4efc3f[_0x80c25f(0xfe)](_0x80c25f(0x16e))),_0x6c4547[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3[_0x80c25f(0x174)]&&console['error'](_0x80c25f(0x13e)+_0x6c4547[_0x80c25f(0x12d)](',\x20')),_0x4f48e9[_0x80c25f(0x17b)]>0x0&&console[_0x80c25f(0x111)](_0x80c25f(0x126)+_0x4f48e9[_0x80c25f(0x12d)](',\x20')),_0x37e18c[_0x80c25f(0x17b)]>0x0&&!_0xd5e8b3['journeysOnly']&&console[_0x80c25f(0x111)](_0x80c25f(0x103)+_0x37e18c[_0x80c25f(0x12d)](',\x20')),0x0;}}
|