@treasuredata/tdx 0.24.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.d.ts +14 -3
- package/dist/commands/chat-command.d.ts.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/chat-command.js.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.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.d.ts +4 -4
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/llm.d.ts +1 -0
- package/dist/sdk/types/llm.d.ts.map +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_0x200056=a26_0x13d8;(function(_0x17f2f9,_0x18ff00){const _0x3948e3=a26_0x13d8,_0x30564f=_0x17f2f9();while(!![]){try{const _0x32a4cb=parseInt(_0x3948e3(0x13e))/0x1*(parseInt(_0x3948e3(0x14a))/0x2)+-parseInt(_0x3948e3(0x11f))/0x3*(parseInt(_0x3948e3(0x126))/0x4)+parseInt(_0x3948e3(0x127))/0x5*(parseInt(_0x3948e3(0x152))/0x6)+-parseInt(_0x3948e3(0x106))/0x7*(parseInt(_0x3948e3(0x14e))/0x8)+parseInt(_0x3948e3(0x16f))/0x9*(-parseInt(_0x3948e3(0x17b))/0xa)+-parseInt(_0x3948e3(0x13d))/0xb*(-parseInt(_0x3948e3(0x130))/0xc)+parseInt(_0x3948e3(0xf8))/0xd;if(_0x32a4cb===_0x18ff00)break;else _0x30564f['push'](_0x30564f['shift']());}catch(_0x333bd0){_0x30564f['push'](_0x30564f['shift']());}}}(a26_0x2654,0x269fb));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_0x4d2e6c from'chalk';function formatRelativeTime(_0x1c102d){const _0x38d7e1=a26_0x13d8,_0x570d7d=new Date(_0x1c102d),_0x344fc2=new Date(),_0x549c5e=_0x570d7d[_0x38d7e1(0x179)]()-_0x344fc2[_0x38d7e1(0x179)](),_0x58b00d=Math['abs'](_0x549c5e)/0x3e8,_0x30bf3a=_0x549c5e<0x0;if(_0x58b00d<0x3c)return _0x30bf3a?'just\x20now':_0x38d7e1(0x163);else{if(_0x58b00d<0xe10){const _0x2f8573=Math[_0x38d7e1(0x16a)](_0x58b00d/0x3c);return _0x30bf3a?_0x2f8573+_0x38d7e1(0xf4):_0x38d7e1(0x13b)+_0x2f8573+'m';}else{if(_0x58b00d<0x15180){const _0x518742=Math['round'](_0x58b00d/0xe10);return _0x30bf3a?_0x518742+_0x38d7e1(0x14d):_0x38d7e1(0x13b)+_0x518742+'h';}else{if(_0x58b00d<0x93a80){const _0x154f68=Math['round'](_0x58b00d/0x15180);return _0x30bf3a?_0x154f68+_0x38d7e1(0x116):'in\x20'+_0x154f68+'d';}else return _0x570d7d[_0x38d7e1(0x149)]();}}}}function a26_0x13d8(_0x119bd3,_0x379576){_0x119bd3=_0x119bd3-0xed;const _0x26543d=a26_0x2654();let _0x13d8e3=_0x26543d[_0x119bd3];return _0x13d8e3;}export class ScheduleListCommand extends BaseCommand{['name']=a26_0x200056(0x158);[a26_0x200056(0x13a)]=a26_0x200056(0x17e);async[a26_0x200056(0x10c)](_0x54b826){const _0x280314=a26_0x200056,{options:_0x67490b,args:_0x16edb0,tdx:_0x27b86d}=_0x54b826,_0x587c34=resolveLimit(_0x67490b['limit'],DEFAULT_DISPLAY_LIMIT),_0x274db4=_0x16edb0[0x0],_0x533703=_0x274db4?_0x280314(0x123)+_0x274db4+_0x280314(0x10d):_0x280314(0x111),_0x3dfc13=await withSpinner(_0x533703,()=>_0x27b86d[_0x280314(0x12d)]['listQueries']({'limit':_0x587c34,'scheduled':!![],'pattern':_0x274db4}),{'verbose':_0x67490b[_0x280314(0x105)]}),_0x35e0bf=_0x3dfc13[_0x280314(0x122)]['queries'],_0x41e99d=_0x3dfc13[_0x280314(0x122)][_0x280314(0xee)][_0x280314(0x177)],_0x4791bb=_0x274db4?'\x20matching\x20\x22'+_0x274db4+'\x22':'';_0x41e99d?console[_0x280314(0x137)]('Showing\x20first\x20'+_0x35e0bf[_0x280314(0x100)]+'\x20schedules'+_0x4791bb+_0x280314(0x12b)):console['error'](_0x280314(0xf9)+_0x35e0bf[_0x280314(0x100)]+_0x280314(0x176)+(_0x35e0bf[_0x280314(0x100)]!==0x1?_0x280314(0xf5):'y')+_0x4791bb);if(_0x67490b[_0x280314(0x110)]===_0x280314(0xfa)||_0x67490b[_0x280314(0x110)]===_0x280314(0x140)||_0x67490b[_0x280314(0x110)]===_0x280314(0x129)||_0x67490b[_0x280314(0x110)]==='tsv'){const _0x4d2863=_0x35e0bf[_0x280314(0x101)](_0x9f3316=>({'id':_0x9f3316['id'],'name':_0x9f3316[_0x280314(0x146)],'cron':_0x9f3316[_0x280314(0x157)],'database':_0x9f3316[_0x280314(0x138)]?.[_0x280314(0x146)],'type':_0x9f3316[_0x280314(0x109)],'timezone':_0x9f3316['time_zone'],'user_name':_0x9f3316[_0x280314(0x14b)]?.[_0x280314(0x146)],'updated_at':_0x9f3316[_0x280314(0x103)],'next_run_at':_0x9f3316[_0x280314(0x120)],'last_job_status':_0x9f3316[_0x280314(0x154)]?.[_0x280314(0x164)]}));await handleSDKOutput(_0x4d2863,_0x67490b);}else{if(_0x35e0bf[_0x280314(0x100)]===0x0)console['log'](_0x280314(0xfd));else{const _0x1829aa=_0x67490b[_0x280314(0x143)],_0x321c40=_0x35e0bf[_0x280314(0x101)](_0x29c325=>{const _0x42b72c=_0x280314,_0x2f0f28=_0x29c325[_0x42b72c(0x154)]?.[_0x42b72c(0x164)]?_0x29c325['last_job'][_0x42b72c(0x164)]===_0x42b72c(0x10a)?'✓':'✗':'-',_0x2a424f=_0x29c325[_0x42b72c(0x154)]?.['ended_at']?formatRelativeTime(_0x29c325[_0x42b72c(0x154)][_0x42b72c(0x166)]):_0x42b72c(0xff),_0x34d0be=_0x29c325[_0x42b72c(0x120)]?formatRelativeTime(_0x29c325[_0x42b72c(0x120)]):'-',_0xe0b4a5=_0x29c325[_0x42b72c(0x157)]||'',_0x3ed4bd=_0x29c325[_0x42b72c(0x146)]||_0x42b72c(0xed),_0x292e46=getConsoleUrl(_0x1829aa,_0x42b72c(0x11a)+_0x29c325['id']);return{'statusIcon':_0x2f0f28,'lastRun':_0x2a424f,'nextRun':_0x34d0be,'cron':_0xe0b4a5,'name':_0x3ed4bd,'queryUrl':_0x292e46,'status':_0x29c325[_0x42b72c(0x154)]?.[_0x42b72c(0x164)]};}),_0x20b4d0=Math[_0x280314(0x121)](..._0x321c40[_0x280314(0x101)](_0x5ac1ed=>_0x5ac1ed['lastRun'][_0x280314(0x100)])),_0x8cc1ae=Math[_0x280314(0x121)](..._0x321c40[_0x280314(0x101)](_0x2b0798=>_0x2b0798['nextRun'][_0x280314(0x100)])),_0x3c20f1=Math[_0x280314(0x121)](..._0x321c40['map'](_0x1b424d=>_0x1b424d[_0x280314(0x157)][_0x280314(0x100)])),_0x932bef=_0x321c40['map'](_0x198cfb=>{const _0x28b555=_0x280314,_0x805e7d=_0x198cfb[_0x28b555(0x164)]===_0x28b555(0x10a)?a26_0x4d2e6c[_0x28b555(0x12e)](_0x198cfb[_0x28b555(0x148)]):_0x198cfb['status']===_0x28b555(0x137)?a26_0x4d2e6c[_0x28b555(0x16d)](_0x198cfb[_0x28b555(0x148)]):a26_0x4d2e6c[_0x28b555(0x15b)](_0x198cfb[_0x28b555(0x148)]),_0xfdf3ec=_0x198cfb['lastRun'][_0x28b555(0x178)](_0x20b4d0),_0x46545e=_0x198cfb[_0x28b555(0x174)][_0x28b555(0x178)](_0x8cc1ae),_0x3c6f11=_0x198cfb[_0x28b555(0x157)]?a26_0x4d2e6c['cyan'](_0x198cfb[_0x28b555(0x157)]['padEnd'](_0x3c20f1)):'\x20'[_0x28b555(0x14f)](_0x3c20f1),_0x33d1f4=hyperlink(_0x198cfb[_0x28b555(0x146)],_0x198cfb['queryUrl']);return _0x28b555(0x11d)+_0x805e7d+'\x20'+_0xfdf3ec+'\x20\x20→\x20'+_0x46545e+'\x20\x20'+_0x3c6f11+'\x20\x20'+_0x33d1f4;});await writeOutput(_0x932bef[_0x280314(0x16b)]('\x0a'),_0x67490b['output'],_0x280314(0x147));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x11c);[a26_0x200056(0x13a)]=a26_0x200056(0x15a);[a26_0x200056(0x131)](_0x32866c){const _0x31e4ec=a26_0x200056,_0x51dd96=_0x32866c[_0x31e4ec(0x175)][0x0];if(!_0x51dd96)return _0x31e4ec(0x151);return undefined;}async['execute'](_0x507527){const _0x398460=a26_0x200056,{options:_0xabd7ea,args:_0x20a2c9,tdx:_0x2f83d9}=_0x507527,_0x4f1db5=_0x20a2c9[0x0],_0x1faecc=await withSpinner(_0x398460(0x10b),()=>_0x2f83d9[_0x398460(0x12d)][_0x398460(0x150)](_0x4f1db5),{'verbose':_0xabd7ea[_0x398460(0x105)]}),_0x210712=_0x1faecc[_0x398460(0x122)],_0x32fb8b={'name':_0x210712[_0x398460(0x146)],'cron':_0x210712['cron'],'database':_0x210712[_0x398460(0x138)],'type':_0x210712[_0x398460(0x109)],'timezone':_0x210712[_0x398460(0xfb)],'user_name':_0x210712[_0x398460(0x113)],'created_at':_0x210712[_0x398460(0x125)],'engine_version':_0x210712[_0x398460(0x112)],'executing_user_id':_0x210712[_0x398460(0x117)],'query':_0x210712[_0x398460(0x10e)],'delay':_0x210712['delay'],'priority':_0x210712[_0x398460(0x155)],'retry_limit':_0x210712['retry_limit'],..._0x210712[_0x398460(0x16c)]&&{'result':_0x210712['result']}};return await handleSingleObjectOutput(_0x32fb8b,_0xabd7ea),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x200056(0x144);[a26_0x200056(0x13a)]=a26_0x200056(0x135);[a26_0x200056(0x131)](_0x14b9df){const _0x38fb16=a26_0x200056,_0x45dd0e=_0x14b9df[_0x38fb16(0x175)][0x0];if(!_0x45dd0e)return _0x38fb16(0xf2);return undefined;}async[a26_0x200056(0x10c)](_0x22c3cd){const _0x15f770=a26_0x200056,{options:_0x2893a8,args:_0x39deed,tdx:_0x36b925}=_0x22c3cd,_0x25ff50=_0x39deed[0x0],_0x35650=_0x2893a8,_0x21d575=_0x35650['database'],_0x2e6984=_0x35650[_0x15f770(0x159)],_0x14d9a5=_0x35650[_0x15f770(0x109)]||_0x15f770(0xf7);let _0x498c3d;try{_0x498c3d=readFileSync(_0x2e6984,_0x15f770(0x107))['trim']();}catch(_0x3fac25){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x15f770(0x165)+_0x2e6984,_0x3fac25 instanceof Error?_0x3fac25:undefined);}if(!_0x498c3d)throw new SDKError(ErrorCode[_0x15f770(0x134)],_0x15f770(0x142));const _0x413497={'database':_0x21d575,'query':_0x498c3d,'type':_0x14d9a5};if(_0x35650[_0x15f770(0x157)])_0x413497[_0x15f770(0x157)]=_0x35650['cron'];if(_0x35650['timezone'])_0x413497[_0x15f770(0xfb)]=_0x35650['timezone'];if(_0x35650[_0x15f770(0x16e)]!==undefined)_0x413497[_0x15f770(0x16e)]=Number(_0x35650['delay']);if(_0x35650[_0x15f770(0x155)]!==undefined)_0x413497['priority']=Number(_0x35650[_0x15f770(0x155)]);if(_0x35650[_0x15f770(0x17a)]!==undefined)_0x413497['retry_limit']=Number(_0x35650[_0x15f770(0x17a)]);if(_0x35650[_0x15f770(0x161)])_0x413497[_0x15f770(0x112)]=_0x35650['engineVersion'];if(_0x35650[_0x15f770(0x16c)])_0x413497[_0x15f770(0x16c)]=_0x35650[_0x15f770(0x16c)];if(_0x2893a8[_0x15f770(0x105)]){console['error'](_0x15f770(0x132)+_0x25ff50),console[_0x15f770(0x137)](_0x15f770(0x118)+_0x21d575),console[_0x15f770(0x137)]('\x20\x20Type:\x20'+_0x14d9a5);if(_0x413497[_0x15f770(0x157)])console[_0x15f770(0x137)]('\x20\x20Cron:\x20'+_0x413497[_0x15f770(0x157)]);if(_0x413497[_0x15f770(0xfb)])console[_0x15f770(0x137)](_0x15f770(0x115)+_0x413497[_0x15f770(0xfb)]);}const _0x51cc5c=await withSpinner(_0x15f770(0x13c),()=>_0x36b925[_0x15f770(0x12d)][_0x15f770(0x17d)](_0x25ff50,_0x413497),{'verbose':_0x2893a8[_0x15f770(0x105)]});return console[_0x15f770(0x137)](_0x15f770(0x108)+_0x51cc5c[_0x15f770(0x122)]['name']),await handleSingleObjectOutput(_0x51cc5c['data'],_0x2893a8),0x0;}}function a26_0x2654(){const _0xed3377=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','m\x20ago','ies','trim','trino','5358899PpLNqi','Found\x20','json','timezone','end_at','No\x20scheduled\x20queries\x20found','Delete\x20a\x20scheduled\x20query','never','length','map','Updating\x20schedule...','updated_at','Cancelled','verbose','22421XpNmZs','utf-8','Schedule\x20created:\x20','type','success','Getting\x20schedule\x20details...','execute','\x22...','query','schedule:run','format','Listing\x20scheduled\x20queries...','engine_version','user_name','entries','\x20\x20Timezone:\x20','d\x20ago','executing_user_id','\x20\x20Database:\x20','Deleting\x20schedule...','/app/queries/editor?queryId=','count','schedule:show','📅\x20','\x20job','42bnUYBA','next_run_at','max','data','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Job\x20ID:\x20','created_at','34376OolxzF','46405AjzRBz','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','table','\x20created','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20run\x20submitted:\x20','schedules','green','Running\x20schedule:\x20','12RCcLbY','validate','Creating\x20schedule:\x20','Running\x20schedule...','INVALID_ARGUMENT','Create\x20a\x20scheduled\x20query','...','error','database','run','description','in\x20','Creating\x20schedule...','2459897fnmOhh','9SPgasl','Run\x20a\x20scheduled\x20query\x20immediately','jsonl','yes','Query\x20file\x20is\x20empty','site','schedule:create','Show\x20schedule\x20execution\x20history','name','list','statusIcon','toLocaleDateString','26734JUkJbC','user','job_id','h\x20ago','616yCLbZj','repeat','show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','6WqhWIN','jobs','last_job','priority','\x20execution','cron','schedule:list','file','Show\x20schedule\x20details','dim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Getting\x20schedule\x20history...','\x20(showing\x20','retry_limit','schedule:update','engineVersion','num','soon','status','Failed\x20to\x20read\x20file:\x20','ended_at','\x20\x20Num:\x20','update','time','round','join','result','red','delay','2162556sAijEa','history','scheduled_at','schedule:delete','start_at','nextRun','args','\x20scheduled\x20quer','has_next_page','padEnd','getTime','retryLimit','10quwOfc','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','create','List\x20scheduled\x20queries','Schedule\x20deleted:\x20','(unnamed)','pagination','Updating\x20schedule:\x20','Update\x20a\x20scheduled\x20query','from','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]'];a26_0x2654=function(){return _0xed3377;};return a26_0x2654();}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x160);[a26_0x200056(0x13a)]=a26_0x200056(0xf0);['validate'](_0x539329){const _0x24dbbe=a26_0x200056,_0x32073f=_0x539329[_0x24dbbe(0x175)][0x0];if(!_0x32073f)return _0x24dbbe(0xf3);return undefined;}async[a26_0x200056(0x10c)](_0x24fadc){const _0x58d42e=a26_0x200056,{options:_0x585c94,args:_0x1b2cb0,tdx:_0x58c391}=_0x24fadc,_0x1b1f28=_0x1b2cb0[0x0],_0x580f35=_0x585c94,_0x3b4350={};if(_0x580f35[_0x58d42e(0x138)])_0x3b4350[_0x58d42e(0x138)]=_0x580f35[_0x58d42e(0x138)];if(_0x580f35[_0x58d42e(0x109)])_0x3b4350[_0x58d42e(0x109)]=_0x580f35['type'];if(_0x580f35[_0x58d42e(0x157)])_0x3b4350[_0x58d42e(0x157)]=_0x580f35[_0x58d42e(0x157)];if(_0x580f35[_0x58d42e(0xfb)])_0x3b4350['timezone']=_0x580f35[_0x58d42e(0xfb)];if(_0x580f35['delay']!==undefined)_0x3b4350[_0x58d42e(0x16e)]=Number(_0x580f35[_0x58d42e(0x16e)]);if(_0x580f35[_0x58d42e(0x155)]!==undefined)_0x3b4350[_0x58d42e(0x155)]=Number(_0x580f35[_0x58d42e(0x155)]);if(_0x580f35['retryLimit']!==undefined)_0x3b4350[_0x58d42e(0x15f)]=Number(_0x580f35['retryLimit']);if(_0x580f35[_0x58d42e(0x161)])_0x3b4350[_0x58d42e(0x112)]=_0x580f35[_0x58d42e(0x161)];if(_0x580f35[_0x58d42e(0x16c)])_0x3b4350[_0x58d42e(0x16c)]=_0x580f35[_0x58d42e(0x16c)];if(_0x580f35[_0x58d42e(0x159)])try{_0x3b4350[_0x58d42e(0x10e)]=readFileSync(_0x580f35[_0x58d42e(0x159)],_0x58d42e(0x107))[_0x58d42e(0xf6)]();}catch(_0x5032f9){throw new SDKError(ErrorCode[_0x58d42e(0x134)],_0x58d42e(0x165)+_0x580f35[_0x58d42e(0x159)],_0x5032f9 instanceof Error?_0x5032f9:undefined);}if(Object['keys'](_0x3b4350)['length']===0x0)throw new SDKError(ErrorCode[_0x58d42e(0x134)],_0x58d42e(0x17c));if(_0x585c94[_0x58d42e(0x105)]){console[_0x58d42e(0x137)](_0x58d42e(0xef)+_0x1b1f28);for(const [_0x38d8ec,_0x4bdf55]of Object[_0x58d42e(0x114)](_0x3b4350)){_0x38d8ec===_0x58d42e(0x10e)?console[_0x58d42e(0x137)]('\x20\x20'+_0x38d8ec+':\x20'+_0x4bdf55['substring'](0x0,0x32)+_0x58d42e(0x136)):console['error']('\x20\x20'+_0x38d8ec+':\x20'+_0x4bdf55);}}const _0x363f2e=await withSpinner(_0x58d42e(0x102),()=>_0x58c391[_0x58d42e(0x12d)][_0x58d42e(0x168)](_0x1b1f28,_0x3b4350),{'verbose':_0x585c94[_0x58d42e(0x105)]});return console[_0x58d42e(0x137)]('Schedule\x20updated:\x20'+_0x363f2e[_0x58d42e(0x122)]['name']),await handleSingleObjectOutput(_0x363f2e[_0x58d42e(0x122)],_0x585c94),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x172);['description']=a26_0x200056(0xfe);['validate'](_0x134042){const _0x322818=a26_0x200056,_0x4c8ce9=_0x134042['args'][0x0];if(!_0x4c8ce9)return _0x322818(0x15c);return undefined;}async[a26_0x200056(0x10c)](_0x223466){const _0x5c11ed=a26_0x200056,{options:_0x5b3669,args:_0xe65ced,tdx:_0x83d175}=_0x223466,_0x6015a8=_0xe65ced[0x0];if(!_0x5b3669[_0x5c11ed(0x141)]){const _0x2b5b7a=await confirm(_0x5c11ed(0x128)+_0x6015a8+'\x22?');if(!_0x2b5b7a)return console[_0x5c11ed(0x137)](_0x5c11ed(0x104)),0x0;}const _0x14c3b4=await withSpinner(_0x5c11ed(0x119),()=>_0x83d175[_0x5c11ed(0x12d)]['delete'](_0x6015a8),{'verbose':_0x5b3669[_0x5c11ed(0x105)]});return console['error'](_0x5c11ed(0x17f)+_0x14c3b4[_0x5c11ed(0x122)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x10f);[a26_0x200056(0x13a)]=a26_0x200056(0x13f);[a26_0x200056(0x131)](_0x418d52){const _0x227abf=_0x418d52['args'][0x0];if(!_0x227abf)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x426c29){const _0x3dc048=a26_0x200056,{options:_0x5945bd,args:_0x3bab1d,tdx:_0x8b3fa}=_0x426c29,_0x3af9a0=_0x3bab1d[0x0],_0x1347be=_0x5945bd,_0x5eceba=_0x1347be[_0x3dc048(0x169)],_0x1c5903=_0x1347be[_0x3dc048(0x162)]!==undefined?Number(_0x1347be[_0x3dc048(0x162)]):undefined;if(_0x5945bd[_0x3dc048(0x105)]){console['error'](_0x3dc048(0x12f)+_0x3af9a0);if(_0x5eceba)console[_0x3dc048(0x137)]('\x20\x20Time:\x20'+_0x5eceba);if(_0x1c5903)console[_0x3dc048(0x137)](_0x3dc048(0x167)+_0x1c5903);}const _0x114031=await withSpinner(_0x3dc048(0x133),()=>_0x8b3fa['schedules'][_0x3dc048(0x139)](_0x3af9a0,{'time':_0x5eceba,'num':_0x1c5903}),{'verbose':_0x5945bd[_0x3dc048(0x105)]}),_0x442b54=_0x114031['data'][_0x3dc048(0x153)];console[_0x3dc048(0x137)](_0x3dc048(0x12c)+_0x442b54[_0x3dc048(0x100)]+_0x3dc048(0x11e)+(_0x442b54[_0x3dc048(0x100)]!==0x1?'s':'')+_0x3dc048(0x12a));for(const _0x266873 of _0x442b54){console[_0x3dc048(0x137)](_0x3dc048(0x124)+_0x266873[_0x3dc048(0x14c)]);}return await handleSDKOutput(_0x442b54,_0x5945bd),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x200056(0x146)]='schedule:history';[a26_0x200056(0x13a)]=a26_0x200056(0x145);[a26_0x200056(0x131)](_0xbf99cf){const _0x37d5cc=_0xbf99cf['args'][0x0];if(!_0x37d5cc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0x200056(0x10c)](_0x3219a7){const _0x1f8c05=a26_0x200056,{options:_0x24a0c5,args:_0x31c6d7,tdx:_0x9061e9}=_0x3219a7,_0x133289=_0x31c6d7[0x0],_0x1436c7=_0x24a0c5,_0xfb4d2e=_0x1436c7[_0x1f8c05(0xf1)]!==undefined?Number(_0x1436c7[_0x1f8c05(0xf1)]):undefined,_0x53e7ef=_0x1436c7['to']!==undefined?Number(_0x1436c7['to']):undefined,_0x52bcd0=await withSpinner(_0x1f8c05(0x15d),()=>_0x9061e9[_0x1f8c05(0x12d)][_0x1f8c05(0x170)](_0x133289,{'from':_0xfb4d2e,'to':_0x53e7ef}),{'verbose':_0x24a0c5['verbose']}),_0x390dbb=_0x52bcd0[_0x1f8c05(0x122)];console[_0x1f8c05(0x137)]('Found\x20'+_0x390dbb[_0x1f8c05(0x11b)]+_0x1f8c05(0x156)+(_0x390dbb[_0x1f8c05(0x11b)]!==0x1?'s':'')+_0x1f8c05(0x15e)+_0x390dbb[_0x1f8c05(0xf1)]+'-'+_0x390dbb['to']+')');const _0x2948f3=_0x390dbb[_0x1f8c05(0x170)][_0x1f8c05(0x101)](_0x3d8c9c=>({'job_id':_0x3d8c9c[_0x1f8c05(0x14c)],'type':_0x3d8c9c[_0x1f8c05(0x109)],'status':_0x3d8c9c[_0x1f8c05(0x164)],'scheduled_at':_0x3d8c9c[_0x1f8c05(0x171)],'created_at':_0x3d8c9c[_0x1f8c05(0x125)],'start_at':_0x3d8c9c[_0x1f8c05(0x173)],'end_at':_0x3d8c9c[_0x1f8c05(0xfc)]}));return await handleSDKOutput(_0x2948f3,_0x24a0c5),0x0;}}
|
|
1
|
+
const a26_0x43a441=a26_0x53aa;(function(_0x56ab1e,_0x545d4e){const _0x5b9510=a26_0x53aa,_0x293c57=_0x56ab1e();while(!![]){try{const _0x4f248a=-parseInt(_0x5b9510(0x1bf))/0x1*(parseInt(_0x5b9510(0x16a))/0x2)+parseInt(_0x5b9510(0x181))/0x3*(parseInt(_0x5b9510(0x14d))/0x4)+parseInt(_0x5b9510(0x173))/0x5+-parseInt(_0x5b9510(0x19b))/0x6*(-parseInt(_0x5b9510(0x1bc))/0x7)+-parseInt(_0x5b9510(0x169))/0x8*(-parseInt(_0x5b9510(0x177))/0x9)+parseInt(_0x5b9510(0x19f))/0xa+-parseInt(_0x5b9510(0x165))/0xb*(parseInt(_0x5b9510(0x1a8))/0xc);if(_0x4f248a===_0x545d4e)break;else _0x293c57['push'](_0x293c57['shift']());}catch(_0x1cae61){_0x293c57['push'](_0x293c57['shift']());}}}(a26_0x3477,0x28aa5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a26_0x53aa(_0x393340,_0x2d8658){_0x393340=_0x393340-0x143;const _0x347719=a26_0x3477();let _0x53aa82=_0x347719[_0x393340];return _0x53aa82;}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_0x1ea8bd from'chalk';function formatRelativeTime(_0x7b7d44){const _0x474409=a26_0x53aa,_0x8dbd7c=new Date(_0x7b7d44),_0x5f03a3=new Date(),_0x55de28=_0x8dbd7c['getTime']()-_0x5f03a3[_0x474409(0x152)](),_0xadb64f=Math[_0x474409(0x164)](_0x55de28)/0x3e8,_0x2e56ad=_0x55de28<0x0;if(_0xadb64f<0x3c)return _0x2e56ad?'just\x20now':_0x474409(0x1ce);else{if(_0xadb64f<0xe10){const _0xfce406=Math[_0x474409(0x197)](_0xadb64f/0x3c);return _0x2e56ad?_0xfce406+'m\x20ago':_0x474409(0x174)+_0xfce406+'m';}else{if(_0xadb64f<0x15180){const _0x5b6858=Math[_0x474409(0x197)](_0xadb64f/0xe10);return _0x2e56ad?_0x5b6858+_0x474409(0x162):_0x474409(0x174)+_0x5b6858+'h';}else{if(_0xadb64f<0x93a80){const _0x6c1423=Math[_0x474409(0x197)](_0xadb64f/0x15180);return _0x2e56ad?_0x6c1423+_0x474409(0x16f):_0x474409(0x174)+_0x6c1423+'d';}else return _0x8dbd7c[_0x474409(0x17f)]();}}}}function a26_0x3477(){const _0x318440=['engine_version','user','next_run_at','834584KMFJpY','2KxDRrn','entries','schedule:show','cron','never','d\x20ago','Running\x20schedule...','schedule:update','List\x20scheduled\x20queries','149895YJaBcS','in\x20','executing_user_id','Searching\x20scheduled\x20queries\x20matching\x20\x22','9tlrxhC','cyan','\x20matching\x20\x22','delay','\x22...','\x20\x20Cron:\x20','Schedule\x20updated:\x20','type','toLocaleDateString','(unnamed)','30036hUhNnZ','args','run','schedules','jsonl','\x20\x20Database:\x20','/app/queries/editor?queryId=','Updating\x20schedule:\x20','Creating\x20schedule...','repeat','time','Schedule\x20created:\x20','\x20\x20Time:\x20','database','...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','\x20schedules','time_zone','\x20execution','list','Delete\x20a\x20scheduled\x20query','nextRun','round','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','limit','132YDAmFg','verbose','schedule:run','name','3064520PvMbrv','tsv','\x20\x20Type:\x20','\x20job','table','Updating\x20schedule...','result','\x20\x20Timezone:\x20','json','156yFNTpX','description','job_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','file','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','updated_at','ended_at','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Create\x20a\x20scheduled\x20query','validate','Getting\x20schedule\x20history...','num','Cancelled','history','execute','format','Update\x20a\x20scheduled\x20query','data','82558UMhrhF','map','last_job','66073ihhClL','\x20\x20Job\x20ID:\x20','update','\x20\x20Num:\x20','\x20created','Query\x20file\x20is\x20empty','schedule:delete','length','delete','\x20(use\x20--limit\x20to\x20see\x20more)','from','timezone','No\x20scheduled\x20queries\x20found','Schedule\x20deleted:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','soon','engineVersion','Schedule\x20run\x20submitted:\x20','Run\x20a\x20scheduled\x20query\x20immediately','ies','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','created_at','statusIcon','pagination','utf-8','error','show','padEnd','trino','priority','104fnhorq','lastRun','has_next_page','dim','Creating\x20schedule:\x20','getTime','keys','INVALID_ARGUMENT','retry_limit','query','Deleting\x20schedule...','count','retryLimit','end_at','schedule:history','max','schedule:list','status','success','Failed\x20to\x20read\x20file:\x20','\x20\x20→\x20','h\x20ago','log','abs','615912ZOJjgN'];a26_0x3477=function(){return _0x318440;};return a26_0x3477();}export class ScheduleListCommand extends BaseCommand{[a26_0x43a441(0x19e)]=a26_0x43a441(0x15d);[a26_0x43a441(0x1a9)]=a26_0x43a441(0x172);async[a26_0x43a441(0x1b8)](_0x1e9bd0){const _0x214b92=a26_0x43a441,{options:_0x8b6458,args:_0x1853f9,tdx:_0x348d54}=_0x1e9bd0,_0x425d50=resolveLimit(_0x8b6458[_0x214b92(0x19a)],DEFAULT_DISPLAY_LIMIT),_0x376f3c=_0x1853f9[0x0],_0x102962=_0x376f3c?_0x214b92(0x176)+_0x376f3c+_0x214b92(0x17b):'Listing\x20scheduled\x20queries...',_0x416d72=await withSpinner(_0x102962,()=>_0x348d54['schedules']['listQueries']({'limit':_0x425d50,'scheduled':!![],'pattern':_0x376f3c}),{'verbose':_0x8b6458[_0x214b92(0x19c)]}),_0x2f4dc5=_0x416d72[_0x214b92(0x1bb)]['queries'],_0x188106=_0x416d72[_0x214b92(0x1bb)][_0x214b92(0x146)][_0x214b92(0x14f)],_0x3dfce3=_0x376f3c?_0x214b92(0x179)+_0x376f3c+'\x22':'';_0x188106?console[_0x214b92(0x148)]('Showing\x20first\x20'+_0x2f4dc5['length']+_0x214b92(0x191)+_0x3dfce3+_0x214b92(0x1c8)):console[_0x214b92(0x148)]('Found\x20'+_0x2f4dc5[_0x214b92(0x1c6)]+'\x20scheduled\x20quer'+(_0x2f4dc5[_0x214b92(0x1c6)]!==0x1?_0x214b92(0x1d2):'y')+_0x3dfce3);if(_0x8b6458[_0x214b92(0x1b9)]===_0x214b92(0x1a7)||_0x8b6458['format']===_0x214b92(0x185)||_0x8b6458[_0x214b92(0x1b9)]===_0x214b92(0x1a3)||_0x8b6458[_0x214b92(0x1b9)]===_0x214b92(0x1a0)){const _0x2e3609=_0x2f4dc5[_0x214b92(0x1bd)](_0x5d0ccd=>({'id':_0x5d0ccd['id'],'name':_0x5d0ccd[_0x214b92(0x19e)],'cron':_0x5d0ccd['cron'],'database':_0x5d0ccd[_0x214b92(0x18e)]?.['name'],'type':_0x5d0ccd[_0x214b92(0x17e)],'timezone':_0x5d0ccd[_0x214b92(0x192)],'user_name':_0x5d0ccd[_0x214b92(0x167)]?.['name'],'updated_at':_0x5d0ccd[_0x214b92(0x1ae)],'next_run_at':_0x5d0ccd[_0x214b92(0x168)],'last_job_status':_0x5d0ccd[_0x214b92(0x1be)]?.[_0x214b92(0x15e)]}));await handleSDKOutput(_0x2e3609,_0x8b6458);}else{if(_0x2f4dc5[_0x214b92(0x1c6)]===0x0)console[_0x214b92(0x163)](_0x214b92(0x1cb));else{const _0x2daf19=_0x8b6458['site'],_0xb0050=_0x2f4dc5[_0x214b92(0x1bd)](_0x4d93a5=>{const _0x958d4a=_0x214b92,_0x430c2c=_0x4d93a5['last_job']?.['status']?_0x4d93a5[_0x958d4a(0x1be)][_0x958d4a(0x15e)]===_0x958d4a(0x15f)?'✓':'✗':'-',_0x31a111=_0x4d93a5[_0x958d4a(0x1be)]?.[_0x958d4a(0x1af)]?formatRelativeTime(_0x4d93a5['last_job']['ended_at']):_0x958d4a(0x16e),_0x4275ea=_0x4d93a5[_0x958d4a(0x168)]?formatRelativeTime(_0x4d93a5[_0x958d4a(0x168)]):'-',_0x3411a5=_0x4d93a5[_0x958d4a(0x16d)]||'',_0x5f5141=_0x4d93a5['name']||_0x958d4a(0x180),_0x48b7ea=getConsoleUrl(_0x2daf19,_0x958d4a(0x187)+_0x4d93a5['id']);return{'statusIcon':_0x430c2c,'lastRun':_0x31a111,'nextRun':_0x4275ea,'cron':_0x3411a5,'name':_0x5f5141,'queryUrl':_0x48b7ea,'status':_0x4d93a5[_0x958d4a(0x1be)]?.[_0x958d4a(0x15e)]};}),_0x4d599f=Math[_0x214b92(0x15c)](..._0xb0050[_0x214b92(0x1bd)](_0x2772d0=>_0x2772d0[_0x214b92(0x14e)]['length'])),_0x386076=Math['max'](..._0xb0050[_0x214b92(0x1bd)](_0x4a05c8=>_0x4a05c8[_0x214b92(0x196)][_0x214b92(0x1c6)])),_0x1c6ac0=Math[_0x214b92(0x15c)](..._0xb0050[_0x214b92(0x1bd)](_0x1b7efc=>_0x1b7efc['cron']['length'])),_0x533e32=_0xb0050[_0x214b92(0x1bd)](_0x4d218f=>{const _0x4b50be=_0x214b92,_0x3fbbd4=_0x4d218f['status']==='success'?a26_0x1ea8bd['green'](_0x4d218f[_0x4b50be(0x145)]):_0x4d218f[_0x4b50be(0x15e)]===_0x4b50be(0x148)?a26_0x1ea8bd['red'](_0x4d218f[_0x4b50be(0x145)]):a26_0x1ea8bd[_0x4b50be(0x150)](_0x4d218f[_0x4b50be(0x145)]),_0x174146=_0x4d218f['lastRun'][_0x4b50be(0x14a)](_0x4d599f),_0xa2d770=_0x4d218f['nextRun'][_0x4b50be(0x14a)](_0x386076),_0x473a31=_0x4d218f[_0x4b50be(0x16d)]?a26_0x1ea8bd[_0x4b50be(0x178)](_0x4d218f[_0x4b50be(0x16d)]['padEnd'](_0x1c6ac0)):'\x20'[_0x4b50be(0x18a)](_0x1c6ac0),_0x189c04=hyperlink(_0x4d218f[_0x4b50be(0x19e)],_0x4d218f['queryUrl']);return'📅\x20'+_0x3fbbd4+'\x20'+_0x174146+_0x4b50be(0x161)+_0xa2d770+'\x20\x20'+_0x473a31+'\x20\x20'+_0x189c04;});await writeOutput(_0x533e32['join']('\x0a'),_0x8b6458['output'],_0x214b92(0x194));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x43a441(0x19e)]=a26_0x43a441(0x16c);['description']='Show\x20schedule\x20details';[a26_0x43a441(0x1b3)](_0x454579){const _0x6ea5d7=a26_0x43a441,_0x4b22b0=_0x454579['args'][0x0];if(!_0x4b22b0)return _0x6ea5d7(0x1b1);return undefined;}async[a26_0x43a441(0x1b8)](_0x4e1e4e){const _0x2c8866=a26_0x43a441,{options:_0x3ef1ba,args:_0x2b5957,tdx:_0x2928a2}=_0x4e1e4e,_0x133d53=_0x2b5957[0x0],_0x319610=await withSpinner('Getting\x20schedule\x20details...',()=>_0x2928a2[_0x2c8866(0x184)][_0x2c8866(0x149)](_0x133d53),{'verbose':_0x3ef1ba[_0x2c8866(0x19c)]}),_0x22e22f=_0x319610[_0x2c8866(0x1bb)],_0x432c66={'name':_0x22e22f[_0x2c8866(0x19e)],'cron':_0x22e22f['cron'],'database':_0x22e22f[_0x2c8866(0x18e)],'type':_0x22e22f[_0x2c8866(0x17e)],'timezone':_0x22e22f['timezone'],'user_name':_0x22e22f['user_name'],'created_at':_0x22e22f[_0x2c8866(0x144)],'engine_version':_0x22e22f[_0x2c8866(0x166)],'executing_user_id':_0x22e22f[_0x2c8866(0x175)],'query':_0x22e22f[_0x2c8866(0x156)],'delay':_0x22e22f[_0x2c8866(0x17a)],'priority':_0x22e22f[_0x2c8866(0x14c)],'retry_limit':_0x22e22f[_0x2c8866(0x155)],..._0x22e22f['result']&&{'result':_0x22e22f[_0x2c8866(0x1a5)]}};return await handleSingleObjectOutput(_0x432c66,_0x3ef1ba),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x43a441(0x19e)]='schedule:create';['description']=a26_0x43a441(0x1b2);[a26_0x43a441(0x1b3)](_0x31aa66){const _0x570c02=a26_0x43a441,_0x3cbbe1=_0x31aa66[_0x570c02(0x182)][0x0];if(!_0x3cbbe1)return _0x570c02(0x199);return undefined;}async['execute'](_0x1527e0){const _0x3b5ac2=a26_0x43a441,{options:_0x3e91a7,args:_0x4465ec,tdx:_0x4cfbf5}=_0x1527e0,_0x42f58a=_0x4465ec[0x0],_0x2643dd=_0x3e91a7,_0x5cbcd6=_0x2643dd[_0x3b5ac2(0x18e)],_0x34e866=_0x2643dd[_0x3b5ac2(0x1ac)],_0x210fa3=_0x2643dd['type']||_0x3b5ac2(0x14b);let _0x2e330a;try{_0x2e330a=readFileSync(_0x34e866,_0x3b5ac2(0x147))[_0x3b5ac2(0x1b0)]();}catch(_0x5d3553){throw new SDKError(ErrorCode[_0x3b5ac2(0x154)],_0x3b5ac2(0x160)+_0x34e866,_0x5d3553 instanceof Error?_0x5d3553:undefined);}if(!_0x2e330a)throw new SDKError(ErrorCode[_0x3b5ac2(0x154)],_0x3b5ac2(0x1c4));const _0x3b5258={'database':_0x5cbcd6,'query':_0x2e330a,'type':_0x210fa3};if(_0x2643dd[_0x3b5ac2(0x16d)])_0x3b5258[_0x3b5ac2(0x16d)]=_0x2643dd[_0x3b5ac2(0x16d)];if(_0x2643dd[_0x3b5ac2(0x1ca)])_0x3b5258[_0x3b5ac2(0x1ca)]=_0x2643dd[_0x3b5ac2(0x1ca)];if(_0x2643dd['delay']!==undefined)_0x3b5258[_0x3b5ac2(0x17a)]=Number(_0x2643dd[_0x3b5ac2(0x17a)]);if(_0x2643dd[_0x3b5ac2(0x14c)]!==undefined)_0x3b5258[_0x3b5ac2(0x14c)]=Number(_0x2643dd[_0x3b5ac2(0x14c)]);if(_0x2643dd[_0x3b5ac2(0x159)]!==undefined)_0x3b5258[_0x3b5ac2(0x155)]=Number(_0x2643dd[_0x3b5ac2(0x159)]);if(_0x2643dd[_0x3b5ac2(0x1cf)])_0x3b5258['engine_version']=_0x2643dd['engineVersion'];if(_0x2643dd[_0x3b5ac2(0x1a5)])_0x3b5258[_0x3b5ac2(0x1a5)]=_0x2643dd[_0x3b5ac2(0x1a5)];if(_0x3e91a7['verbose']){console[_0x3b5ac2(0x148)](_0x3b5ac2(0x151)+_0x42f58a),console[_0x3b5ac2(0x148)](_0x3b5ac2(0x186)+_0x5cbcd6),console[_0x3b5ac2(0x148)](_0x3b5ac2(0x1a1)+_0x210fa3);if(_0x3b5258[_0x3b5ac2(0x16d)])console[_0x3b5ac2(0x148)](_0x3b5ac2(0x17c)+_0x3b5258[_0x3b5ac2(0x16d)]);if(_0x3b5258[_0x3b5ac2(0x1ca)])console[_0x3b5ac2(0x148)](_0x3b5ac2(0x1a6)+_0x3b5258['timezone']);}const _0x4e4aad=await withSpinner(_0x3b5ac2(0x189),()=>_0x4cfbf5[_0x3b5ac2(0x184)]['create'](_0x42f58a,_0x3b5258),{'verbose':_0x3e91a7[_0x3b5ac2(0x19c)]});return console[_0x3b5ac2(0x148)](_0x3b5ac2(0x18c)+_0x4e4aad[_0x3b5ac2(0x1bb)][_0x3b5ac2(0x19e)]),await handleSingleObjectOutput(_0x4e4aad['data'],_0x3e91a7),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a26_0x43a441(0x171);[a26_0x43a441(0x1a9)]=a26_0x43a441(0x1ba);[a26_0x43a441(0x1b3)](_0x4258c8){const _0x4d921b=a26_0x43a441,_0x4587a9=_0x4258c8[_0x4d921b(0x182)][0x0];if(!_0x4587a9)return _0x4d921b(0x198);return undefined;}async[a26_0x43a441(0x1b8)](_0x708757){const _0x2e1f75=a26_0x43a441,{options:_0x18ae66,args:_0x4c482d,tdx:_0x7e7c6}=_0x708757,_0x5c33ca=_0x4c482d[0x0],_0x182bb0=_0x18ae66,_0x5b6bcc={};if(_0x182bb0[_0x2e1f75(0x18e)])_0x5b6bcc[_0x2e1f75(0x18e)]=_0x182bb0[_0x2e1f75(0x18e)];if(_0x182bb0[_0x2e1f75(0x17e)])_0x5b6bcc['type']=_0x182bb0['type'];if(_0x182bb0['cron'])_0x5b6bcc['cron']=_0x182bb0[_0x2e1f75(0x16d)];if(_0x182bb0['timezone'])_0x5b6bcc['timezone']=_0x182bb0['timezone'];if(_0x182bb0['delay']!==undefined)_0x5b6bcc[_0x2e1f75(0x17a)]=Number(_0x182bb0[_0x2e1f75(0x17a)]);if(_0x182bb0[_0x2e1f75(0x14c)]!==undefined)_0x5b6bcc[_0x2e1f75(0x14c)]=Number(_0x182bb0[_0x2e1f75(0x14c)]);if(_0x182bb0['retryLimit']!==undefined)_0x5b6bcc['retry_limit']=Number(_0x182bb0[_0x2e1f75(0x159)]);if(_0x182bb0[_0x2e1f75(0x1cf)])_0x5b6bcc[_0x2e1f75(0x166)]=_0x182bb0[_0x2e1f75(0x1cf)];if(_0x182bb0[_0x2e1f75(0x1a5)])_0x5b6bcc[_0x2e1f75(0x1a5)]=_0x182bb0['result'];if(_0x182bb0['file'])try{_0x5b6bcc[_0x2e1f75(0x156)]=readFileSync(_0x182bb0[_0x2e1f75(0x1ac)],_0x2e1f75(0x147))['trim']();}catch(_0x1771ac){throw new SDKError(ErrorCode[_0x2e1f75(0x154)],_0x2e1f75(0x160)+_0x182bb0[_0x2e1f75(0x1ac)],_0x1771ac instanceof Error?_0x1771ac:undefined);}if(Object[_0x2e1f75(0x153)](_0x5b6bcc)[_0x2e1f75(0x1c6)]===0x0)throw new SDKError(ErrorCode[_0x2e1f75(0x154)],_0x2e1f75(0x1ad));if(_0x18ae66['verbose']){console[_0x2e1f75(0x148)](_0x2e1f75(0x188)+_0x5c33ca);for(const [_0x2572cc,_0x4f03ea]of Object[_0x2e1f75(0x16b)](_0x5b6bcc)){_0x2572cc===_0x2e1f75(0x156)?console[_0x2e1f75(0x148)]('\x20\x20'+_0x2572cc+':\x20'+_0x4f03ea['substring'](0x0,0x32)+_0x2e1f75(0x18f)):console[_0x2e1f75(0x148)]('\x20\x20'+_0x2572cc+':\x20'+_0x4f03ea);}}const _0x3b2ec3=await withSpinner(_0x2e1f75(0x1a4),()=>_0x7e7c6['schedules'][_0x2e1f75(0x1c1)](_0x5c33ca,_0x5b6bcc),{'verbose':_0x18ae66[_0x2e1f75(0x19c)]});return console['error'](_0x2e1f75(0x17d)+_0x3b2ec3[_0x2e1f75(0x1bb)][_0x2e1f75(0x19e)]),await handleSingleObjectOutput(_0x3b2ec3[_0x2e1f75(0x1bb)],_0x18ae66),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x43a441(0x1c5);[a26_0x43a441(0x1a9)]=a26_0x43a441(0x195);[a26_0x43a441(0x1b3)](_0x258a78){const _0x557d90=a26_0x43a441,_0x1dee62=_0x258a78[_0x557d90(0x182)][0x0];if(!_0x1dee62)return _0x557d90(0x1cd);return undefined;}async[a26_0x43a441(0x1b8)](_0x4454c1){const _0xbb5edb=a26_0x43a441,{options:_0x49e293,args:_0x45db07,tdx:_0x51b5bc}=_0x4454c1,_0x10a9b0=_0x45db07[0x0];if(!_0x49e293['yes']){const _0x4653cf=await confirm(_0xbb5edb(0x143)+_0x10a9b0+'\x22?');if(!_0x4653cf)return console['error'](_0xbb5edb(0x1b6)),0x0;}const _0x44a592=await withSpinner(_0xbb5edb(0x157),()=>_0x51b5bc[_0xbb5edb(0x184)][_0xbb5edb(0x1c7)](_0x10a9b0),{'verbose':_0x49e293[_0xbb5edb(0x19c)]});return console[_0xbb5edb(0x148)](_0xbb5edb(0x1cc)+_0x44a592[_0xbb5edb(0x1bb)][_0xbb5edb(0x19e)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x43a441(0x19e)]=a26_0x43a441(0x19d);[a26_0x43a441(0x1a9)]=a26_0x43a441(0x1d1);[a26_0x43a441(0x1b3)](_0x11dae3){const _0x53b30f=a26_0x43a441,_0x307f95=_0x11dae3[_0x53b30f(0x182)][0x0];if(!_0x307f95)return _0x53b30f(0x1ab);return undefined;}async[a26_0x43a441(0x1b8)](_0x38cef7){const _0x13ec14=a26_0x43a441,{options:_0x46b26f,args:_0x1e204e,tdx:_0x1f60bf}=_0x38cef7,_0x460d3f=_0x1e204e[0x0],_0x5588d7=_0x46b26f,_0x224f46=_0x5588d7[_0x13ec14(0x18b)],_0x574a21=_0x5588d7['num']!==undefined?Number(_0x5588d7[_0x13ec14(0x1b5)]):undefined;if(_0x46b26f[_0x13ec14(0x19c)]){console['error']('Running\x20schedule:\x20'+_0x460d3f);if(_0x224f46)console['error'](_0x13ec14(0x18d)+_0x224f46);if(_0x574a21)console['error'](_0x13ec14(0x1c2)+_0x574a21);}const _0x34f725=await withSpinner(_0x13ec14(0x170),()=>_0x1f60bf[_0x13ec14(0x184)][_0x13ec14(0x183)](_0x460d3f,{'time':_0x224f46,'num':_0x574a21}),{'verbose':_0x46b26f[_0x13ec14(0x19c)]}),_0xe913d4=_0x34f725[_0x13ec14(0x1bb)]['jobs'];console[_0x13ec14(0x148)](_0x13ec14(0x1d0)+_0xe913d4[_0x13ec14(0x1c6)]+_0x13ec14(0x1a2)+(_0xe913d4[_0x13ec14(0x1c6)]!==0x1?'s':'')+_0x13ec14(0x1c3));for(const _0x2b0ccf of _0xe913d4){console['error'](_0x13ec14(0x1c0)+_0x2b0ccf[_0x13ec14(0x1aa)]);}return await handleSDKOutput(_0xe913d4,_0x46b26f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x43a441(0x19e)]=a26_0x43a441(0x15b);[a26_0x43a441(0x1a9)]='Show\x20schedule\x20execution\x20history';[a26_0x43a441(0x1b3)](_0x4a7832){const _0x5b9992=a26_0x43a441,_0x3fd4fa=_0x4a7832[_0x5b9992(0x182)][0x0];if(!_0x3fd4fa)return _0x5b9992(0x190);return undefined;}async[a26_0x43a441(0x1b8)](_0x15721d){const _0xa70900=a26_0x43a441,{options:_0x5f28e0,args:_0x1048fd,tdx:_0x3333b8}=_0x15721d,_0x449d6e=_0x1048fd[0x0],_0x4713ee=_0x5f28e0,_0x136883=_0x4713ee[_0xa70900(0x1c9)]!==undefined?Number(_0x4713ee['from']):undefined,_0x502a01=_0x4713ee['to']!==undefined?Number(_0x4713ee['to']):undefined,_0x2090c5=await withSpinner(_0xa70900(0x1b4),()=>_0x3333b8[_0xa70900(0x184)][_0xa70900(0x1b7)](_0x449d6e,{'from':_0x136883,'to':_0x502a01}),{'verbose':_0x5f28e0[_0xa70900(0x19c)]}),_0x12146e=_0x2090c5[_0xa70900(0x1bb)];console[_0xa70900(0x148)]('Found\x20'+_0x12146e[_0xa70900(0x158)]+_0xa70900(0x193)+(_0x12146e[_0xa70900(0x158)]!==0x1?'s':'')+'\x20(showing\x20'+_0x12146e[_0xa70900(0x1c9)]+'-'+_0x12146e['to']+')');const _0x5074e4=_0x12146e[_0xa70900(0x1b7)]['map'](_0x30eb6c=>({'job_id':_0x30eb6c[_0xa70900(0x1aa)],'type':_0x30eb6c['type'],'status':_0x30eb6c[_0xa70900(0x15e)],'scheduled_at':_0x30eb6c['scheduled_at'],'created_at':_0x30eb6c['created_at'],'start_at':_0x30eb6c['start_at'],'end_at':_0x30eb6c[_0xa70900(0x15a)]}));return await handleSDKOutput(_0x5074e4,_0x5f28e0),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x3edf54=a27_0x58ba;(function(_0x650298,_0x37c04b){const _0x545604=a27_0x58ba,_0x745679=_0x650298();while(!![]){try{const _0x22a188=parseInt(_0x545604(0x142))/0x1+parseInt(_0x545604(0x159))/0x2+parseInt(_0x545604(0x1b5))/0x3+parseInt(_0x545604(0x1bb))/0x4+-parseInt(_0x545604(0x15c))/0x5*(-parseInt(_0x545604(0x122))/0x6)+parseInt(_0x545604(0x175))/0x7+-parseInt(_0x545604(0x138))/0x8*(parseInt(_0x545604(0x13d))/0x9);if(_0x22a188===_0x37c04b)break;else _0x745679['push'](_0x745679['shift']());}catch(_0x1fd2d2){_0x745679['push'](_0x745679['shift']());}}}(a27_0x2220,0xbd018));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_0x111982 from'chalk';function a27_0x58ba(_0x493d7d,_0x1e3c3e){_0x493d7d=_0x493d7d-0x120;const _0x222063=a27_0x2220();let _0x58ba82=_0x222063[_0x493d7d];return _0x58ba82;}async function resolveSegmentTarget(_0x51177c,_0x48360f,_0x444b99){const _0x5f3dbf=a27_0x58ba;if(isYamlFilePath(_0x51177c))try{const _0x3d59d4=await resolveYamlFilePath(_0x51177c);return _0x444b99&&(console['error'](_0x5f3dbf(0x186)+_0x51177c),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x18a)+_0x3d59d4[_0x5f3dbf(0x1a0)]),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x14b)+_0x3d59d4['segmentName']),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x1a2)+(_0x3d59d4['folderPath']||_0x5f3dbf(0x18c))),console['error'](_0x5f3dbf(0x1a9)+_0x3d59d4[_0x5f3dbf(0x1b2)])),_0x3d59d4[_0x5f3dbf(0x1b2)];}catch(_0x35b8e4){throw new SDKError(ErrorCode[_0x5f3dbf(0x17a)],_0x5f3dbf(0x1ba)+_0x35b8e4['message']);}if(!_0x48360f)throw new SDKError(ErrorCode[_0x5f3dbf(0x17a)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x48360f+'/'+_0x51177c;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a27_0x3edf54(0x178)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x317fe2){const _0x3e4fff=a27_0x3edf54,{options:_0x1b505e,args:_0x15e67c,tdx:_0x45e625}=_0x317fe2,_0x4656b8=_0x15e67c[0x0],_0x157da4=!_0x4656b8&&!!_0x1b505e['parentSegment'],_0x38eb19=_0x4656b8||_0x1b505e['parentSegment'];if(!_0x38eb19)return console[_0x3e4fff(0x15f)](_0x3e4fff(0x169)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x16a)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x146)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x155)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x158)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x121)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x141)),0x1;try{const _0x4d1f39=_0x1b505e[_0x3e4fff(0x153)];let _0x2457e7=_0x38eb19;!_0x157da4&&_0x4d1f39&&!_0x38eb19[_0x3e4fff(0x14e)]('/')&&(_0x2457e7=_0x4d1f39+'/'+_0x38eb19,_0x1b505e['verbose']&&console[_0x3e4fff(0x15f)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2457e7));const _0x253f72=await withSpinner(_0x3e4fff(0x188)+_0x2457e7+'\x27...',()=>_0x45e625[_0x3e4fff(0x14d)][_0x3e4fff(0x193)](_0x2457e7),{'verbose':_0x1b505e['verbose']}),_0x17e69f=_0x253f72[_0x3e4fff(0x1a5)];_0x1b505e['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x17e69f[_0x3e4fff(0x125)]),console[_0x3e4fff(0x15f)](_0x3e4fff(0x17f)+_0x17e69f[_0x3e4fff(0x12a)]),_0x17e69f[_0x3e4fff(0x184)]&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x18f)+_0x17e69f[_0x3e4fff(0x184)]),_0x17e69f[_0x3e4fff(0x12d)]&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x148)+_0x17e69f['segmentId']));if(_0x17e69f['type']===_0x3e4fff(0x173)){const _0x3fad98=await withSpinner(_0x3e4fff(0x171),()=>_0x45e625[_0x3e4fff(0x14d)][_0x3e4fff(0x17b)](_0x17e69f[_0x3e4fff(0x12a)]),{'verbose':_0x1b505e['verbose']});await handleSingleObjectOutput(_0x3fad98[_0x3e4fff(0x1a5)],_0x1b505e);}else{if(_0x17e69f[_0x3e4fff(0x125)]===_0x3e4fff(0x128)){if(!_0x17e69f[_0x3e4fff(0x184)])throw new SDKError(ErrorCode[_0x3e4fff(0x185)],_0x3e4fff(0x150));const _0x216bc1=await withSpinner(_0x3e4fff(0x18e),()=>_0x45e625['segment'][_0x3e4fff(0x13c)](_0x17e69f['folderId']),{'verbose':_0x1b505e['verbose']});await handleSingleObjectOutput(_0x216bc1['data'],_0x1b505e);}else{if(_0x17e69f['type']==='segment'){if(!_0x17e69f[_0x3e4fff(0x12d)])throw new SDKError(ErrorCode[_0x3e4fff(0x1ab)],_0x3e4fff(0x16d));const _0x1894e9=await withSpinner(_0x3e4fff(0x129),()=>_0x45e625[_0x3e4fff(0x14d)]['getSegment'](_0x17e69f[_0x3e4fff(0x12a)],_0x17e69f[_0x3e4fff(0x12d)]),{'verbose':_0x1b505e[_0x3e4fff(0x180)]});await handleSingleObjectOutput(_0x1894e9[_0x3e4fff(0x1a5)],_0x1b505e);}}}return 0x0;}catch(_0x52a494){if(_0x52a494 instanceof SDKError)return console[_0x3e4fff(0x15f)](_0x3e4fff(0x177)+_0x52a494[_0x3e4fff(0x16b)]),_0x52a494['cause']&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x124)+_0x52a494[_0x3e4fff(0x191)]),0x1;throw _0x52a494;}}}export class SegmentShowCommand extends BaseCommand{['name']=a27_0x3edf54(0x160);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x131);async[a27_0x3edf54(0x1a6)](_0x3f04b2){const _0x4e1b26=a27_0x3edf54,{options:_0x3f222b,args:_0x1e7d82,tdx:_0x2d80b0}=_0x3f04b2,_0x2887b7=_0x1e7d82[0x0];if(!_0x2887b7)return console[_0x4e1b26(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4e1b26(0x15f)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x4e1b26(0x15f)](_0x4e1b26(0x137)),console[_0x4e1b26(0x15f)](_0x4e1b26(0x146)),console[_0x4e1b26(0x15f)](_0x4e1b26(0x132)),console['error'](_0x4e1b26(0x140)),0x1;try{const _0x5e9687=_0x3f222b[_0x4e1b26(0x1a0)],_0xa9550f=await resolveSegmentTarget(_0x2887b7,_0x5e9687,_0x3f222b['verbose']);_0x3f222b[_0x4e1b26(0x180)]&&console[_0x4e1b26(0x15f)](_0x4e1b26(0x1b7)+_0xa9550f);const _0xdd781a=await withSpinner(_0x4e1b26(0x14c)+_0x2887b7+_0x4e1b26(0x15a),()=>_0x2d80b0['segment'][_0x4e1b26(0x193)](_0xa9550f),{'verbose':_0x3f222b['verbose']}),_0x4ae73d=_0xdd781a[_0x4e1b26(0x1a5)];_0x3f222b[_0x4e1b26(0x180)]&&(console[_0x4e1b26(0x15f)](_0x4e1b26(0x1ae)+_0x4ae73d[_0x4e1b26(0x125)]),console['error'](_0x4e1b26(0x17f)+_0x4ae73d['parentId']));if(_0x4ae73d['type']==='folder')return console[_0x4e1b26(0x15f)](_0x4e1b26(0x190)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x4ae73d[_0x4e1b26(0x125)]===_0x4e1b26(0x173))return console[_0x4e1b26(0x15f)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x4e1b26(0x151)),0x1;if(!_0x4ae73d['segmentId'])throw new SDKError(ErrorCode[_0x4e1b26(0x1ab)],_0x4e1b26(0x16d));const _0x36180f=await withSpinner(_0x4e1b26(0x19b),()=>_0x2d80b0[_0x4e1b26(0x14d)][_0x4e1b26(0x181)](_0x4ae73d[_0x4e1b26(0x12a)],_0x4ae73d[_0x4e1b26(0x12d)]),{'verbose':_0x3f222b[_0x4e1b26(0x180)]});let _0x4cbab7=_0x36180f[_0x4e1b26(0x1a5)];const _0x355b1e=resolveLimit(_0x3f222b[_0x4e1b26(0x12c)],DEFAULT_DISPLAY_LIMIT),_0x2c634d=/\bLIMIT\s+\d+/i[_0x4e1b26(0x1b8)](_0x4cbab7);!_0x2c634d&&(_0x4cbab7=_0x4cbab7['trim']()[_0x4e1b26(0x15d)](/;+$/,''),_0x4cbab7=_0x4e1b26(0x123)+_0x4cbab7+_0x4e1b26(0x165)+_0x355b1e);_0x3f222b[_0x4e1b26(0x180)]&&console[_0x4e1b26(0x15f)](_0x4e1b26(0x145)+_0x4cbab7);const _0x4142b5=await withProgressSpinner(_0x4e1b26(0x196),async _0x4b0ca6=>{const _0x1d3141=_0x4e1b26,_0x2e97d7=await _0x2d80b0[_0x1d3141(0x18b)][_0x1d3141(0x1a6)](_0x4cbab7,{'catalog':'td','schema':_0x1d3141(0x152),'onJobId':_0x39e58d=>{const _0x258335=_0x1d3141;_0x4b0ca6[_0x258335(0x16e)](_0x39e58d);}});return _0x2e97d7;},{'verbose':_0x3f222b['verbose']}),_0x59e1cb=_0x4142b5[_0x4e1b26(0x1a5)],_0x3c40a6=_0x59e1cb[_0x4e1b26(0x166)]?'\x20[Job\x20ID:\x20'+_0x59e1cb[_0x4e1b26(0x166)]+']':'';return console[_0x4e1b26(0x15f)](_0x4e1b26(0x17e)+_0x59e1cb['stats'][_0x4e1b26(0x18d)]['toLocaleString']()+'\x20rows\x20'+(_0x4e1b26(0x17d)+formatElapsed(_0x59e1cb['stats']['elapsedTimeMillis'])+_0x3c40a6)),await handleQueryOutput(_0x59e1cb,_0x3f222b),0x0;}catch(_0x206fd0){if(_0x206fd0 instanceof SDKError)return console[_0x4e1b26(0x15f)](_0x4e1b26(0x1a1)+_0x206fd0[_0x4e1b26(0x156)]+']'),console[_0x4e1b26(0x15f)]('\x0a'+_0x206fd0[_0x4e1b26(0x16b)]),0x1;throw _0x206fd0;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x176);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x149);async[a27_0x3edf54(0x1a6)](_0x5b58d0){const _0x1d7f13=a27_0x3edf54,{options:_0x33d431,args:_0x5b23eb,tdx:_0x5527aa}=_0x5b58d0;if(_0x5b23eb[_0x1d7f13(0x15b)]===0x0)return console[_0x1d7f13(0x15f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x1d7f13(0x15f)](_0x1d7f13(0x199)),0x1;const _0x1ae914=_0x5b23eb[0x0];try{_0x33d431[_0x1d7f13(0x180)]&&(console[_0x1d7f13(0x15f)]('Site:\x20'+_0x33d431['site']),console[_0x1d7f13(0x15f)](_0x1d7f13(0x1a3)+_0x1ae914));const _0x41720b=await withSpinner(_0x1d7f13(0x19a)+_0x1ae914+_0x1d7f13(0x15a),()=>_0x5527aa[_0x1d7f13(0x14d)][_0x1d7f13(0x172)](_0x1ae914),{'verbose':_0x33d431[_0x1d7f13(0x180)]}),_0x3774ca=_0x41720b[_0x1d7f13(0x1a5)];_0x33d431['verbose']&&console[_0x1d7f13(0x15f)]('Resolved\x20parent\x20ID:\x20'+_0x3774ca);const _0x22c85a=await withSpinner(_0x1d7f13(0x1b3)+_0x1ae914+'\x27...',()=>_0x5527aa[_0x1d7f13(0x14d)][_0x1d7f13(0x161)](_0x3774ca),{'verbose':_0x33d431[_0x1d7f13(0x180)]}),_0x4da017=_0x22c85a['data'];return console['error'](_0x1d7f13(0x170)+_0x4da017['length']+_0x1d7f13(0x16f)+(_0x4da017[_0x1d7f13(0x15b)]!==0x1?'s':'')),await handleSDKOutput(_0x4da017,_0x33d431),0x0;}catch(_0x340331){if(_0x340331 instanceof SDKError)return console[_0x1d7f13(0x15f)](_0x1d7f13(0x177)+_0x340331[_0x1d7f13(0x16b)]),_0x340331[_0x1d7f13(0x191)]&&console[_0x1d7f13(0x15f)](_0x1d7f13(0x124)+_0x340331['cause']),0x1;throw _0x340331;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a27_0x3edf54(0x1b6);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x120);async[a27_0x3edf54(0x1a6)](_0x4c3d53){const _0x28963f=a27_0x3edf54,{options:_0x251145,args:_0xcaabe8,tdx:_0x362198}=_0x4c3d53;if(_0xcaabe8[_0x28963f(0x15b)]===0x0)return console[_0x28963f(0x15f)](_0x28963f(0x164)),console[_0x28963f(0x15f)](_0x28963f(0x195)),0x1;try{const {parentId:_0x542f5e,childId:_0x4c8d9d}=parseSegmentRef(_0xcaabe8[0x0]);_0x251145[_0x28963f(0x180)]&&(console[_0x28963f(0x15f)]('Site:\x20'+_0x251145[_0x28963f(0x14a)]),console[_0x28963f(0x15f)]('Parent\x20name:\x20'+_0x542f5e),_0x4c8d9d&&console[_0x28963f(0x15f)](_0x28963f(0x130)+_0x4c8d9d));if(!_0x4c8d9d)return console['error'](_0x28963f(0x1ad)),0x1;const _0x1bd5a0=await withSpinner(_0x28963f(0x19a)+_0x542f5e+_0x28963f(0x15a),()=>_0x362198['segment']['resolveParentId'](_0x542f5e),{'verbose':_0x251145[_0x28963f(0x180)]}),_0xce64e5=_0x1bd5a0[_0x28963f(0x1a5)];_0x251145[_0x28963f(0x180)]&&console[_0x28963f(0x15f)]('Resolved\x20parent\x20ID:\x20'+_0xce64e5);const _0x296960=await withSpinner(_0x28963f(0x1aa)+_0x4c8d9d+_0x28963f(0x15a),()=>_0x362198[_0x28963f(0x14d)]['resolveFolderId'](_0xce64e5,_0x4c8d9d),{'verbose':_0x251145[_0x28963f(0x180)]}),_0x17c632=_0x296960['data'];_0x251145[_0x28963f(0x180)]&&console[_0x28963f(0x15f)](_0x28963f(0x167)+_0x17c632);const _0x3acc5e=await withSpinner('Fetching\x20folder\x20\x27'+_0x4c8d9d+_0x28963f(0x15a),()=>_0x362198[_0x28963f(0x14d)][_0x28963f(0x13c)](_0x17c632),{'verbose':_0x251145[_0x28963f(0x180)]});return await handleSDKOutput([_0x3acc5e[_0x28963f(0x1a5)]],_0x251145),0x0;}catch(_0x562eab){if(_0x562eab instanceof SDKError)return console['error'](_0x28963f(0x177)+_0x562eab[_0x28963f(0x16b)]),_0x562eab[_0x28963f(0x191)]&&console[_0x28963f(0x15f)]('\x20\x20Cause:\x20'+_0x562eab['cause']),0x1;throw _0x562eab;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x189);[a27_0x3edf54(0x178)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x3edf54(0x1a6)](_0x2339f6){const _0x2ee7f0=a27_0x3edf54,{options:_0x5d66d6,args:_0x57bd15,tdx:_0xc16f14}=_0x2339f6,_0x1b2230=_0x57bd15[0x0];if(!_0x1b2230)return console[_0x2ee7f0(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1b0)),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x143)),console['error'](_0x2ee7f0(0x146)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x14f)),0x1;try{const _0x3ee298=_0x5d66d6[_0x2ee7f0(0x1a0)],_0x3e1729=await resolveSegmentTarget(_0x1b2230,_0x3ee298,_0x5d66d6[_0x2ee7f0(0x180)]);_0x5d66d6[_0x2ee7f0(0x180)]&&console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1b7)+_0x3e1729);const _0x244f12=await withSpinner(_0x2ee7f0(0x14c)+_0x1b2230+_0x2ee7f0(0x15a),()=>_0xc16f14[_0x2ee7f0(0x14d)][_0x2ee7f0(0x193)](_0x3e1729),{'verbose':_0x5d66d6[_0x2ee7f0(0x180)]}),_0x43f626=_0x244f12['data'];_0x5d66d6['verbose']&&(console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1ae)+_0x43f626['type']),console[_0x2ee7f0(0x15f)]('Parent\x20ID:\x20'+_0x43f626[_0x2ee7f0(0x12a)]));if(_0x43f626['type']===_0x2ee7f0(0x128))return console[_0x2ee7f0(0x15f)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1a4)),0x1;if(_0x43f626[_0x2ee7f0(0x125)]===_0x2ee7f0(0x173))return console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x168)),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x179)),0x1;if(!_0x43f626[_0x2ee7f0(0x12d)])throw new SDKError(ErrorCode[_0x2ee7f0(0x1ab)],_0x2ee7f0(0x16d));const _0x4f0a89=await withSpinner(_0x2ee7f0(0x19b),()=>_0xc16f14[_0x2ee7f0(0x14d)]['getSegmentSQL'](_0x43f626['parentId'],_0x43f626[_0x2ee7f0(0x12d)]),{'verbose':_0x5d66d6[_0x2ee7f0(0x180)]}),_0x5b232a=_0x4f0a89[_0x2ee7f0(0x1a5)];return _0x5d66d6[_0x2ee7f0(0x157)]==='json'||_0x5d66d6['format']===_0x2ee7f0(0x154)?await handleSDKOutput([{'sql':_0x5b232a}],_0x5d66d6):console[_0x2ee7f0(0x197)](_0x5b232a),0x0;}catch(_0x1b4535){if(_0x1b4535 instanceof SDKError)return console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x177)+_0x1b4535[_0x2ee7f0(0x16b)]),_0x1b4535[_0x2ee7f0(0x191)]&&console['error'](_0x2ee7f0(0x124)+_0x1b4535[_0x2ee7f0(0x191)]),0x1;throw _0x1b4535;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x13e);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x19e);async[a27_0x3edf54(0x1a6)](_0x18bd07){const _0x2a0c81=a27_0x3edf54,{options:_0x3d27c2,args:_0x257cd9,tdx:_0x4d028c}=_0x18bd07,_0xc1d403=_0x3d27c2;if(_0x257cd9[_0x2a0c81(0x15b)]<0x2)return console['error'](_0x2a0c81(0x16c)),console['error'](_0x2a0c81(0x1a8)),0x1;const _0xe1bc04=_0x257cd9[0x0],_0xe292c5=_0x257cd9[0x1];_0xc1d403[_0x2a0c81(0x180)]&&(console[_0x2a0c81(0x15f)](_0x2a0c81(0x174)+_0xc1d403[_0x2a0c81(0x14a)]),console[_0x2a0c81(0x15f)](_0x2a0c81(0x1b1)+_0xe1bc04),console[_0x2a0c81(0x15f)]('Folder\x20name:\x20'+_0xe292c5));let _0x54d369;if(_0xc1d403['parentFolder']){const _0x10c46f=_0xc1d403['parentFolder'],_0x37059f=await withSpinner(_0x2a0c81(0x19a)+_0xe1bc04+'\x27...',()=>_0x4d028c['segment'][_0x2a0c81(0x172)](_0xe1bc04),{'verbose':_0xc1d403['verbose']}),_0x30c1b7=_0x37059f['data'],_0x43ae46=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x10c46f+'\x27...',()=>_0x4d028c[_0x2a0c81(0x14d)][_0x2a0c81(0x198)](_0x30c1b7,_0x10c46f),{'verbose':_0xc1d403[_0x2a0c81(0x180)]});_0x54d369=_0x43ae46[_0x2a0c81(0x1a5)],_0xc1d403[_0x2a0c81(0x180)]&&console['error'](_0x2a0c81(0x183)+_0x54d369);}const _0x1bd49b={'name':_0xe292c5,'description':_0xc1d403[_0x2a0c81(0x178)],'parentFolderId':_0x54d369},_0xd51d60=await withSpinner('Creating\x20folder\x20\x27'+_0xe292c5+_0x2a0c81(0x15a),()=>_0x4d028c[_0x2a0c81(0x14d)]['createFolder'](_0xe1bc04,_0x1bd49b),{'verbose':_0xc1d403['verbose']}),_0x326b2b=_0xd51d60[_0x2a0c81(0x1a5)];return console[_0x2a0c81(0x15f)]('✔\x20Created\x20folder\x20\x27'+_0x326b2b[_0x2a0c81(0x134)]+_0x2a0c81(0x1b4)+_0x326b2b['id']),await handleSDKOutput([_0x326b2b],_0xc1d403),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x127);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x136);async[a27_0x3edf54(0x1a6)](_0x7f3676){const _0x366c4d=a27_0x3edf54,{options:_0x1426ab,args:_0x4c3821,tdx:_0x21e9dc}=_0x7f3676,_0x4cdca8=_0x4c3821[0x0];if(!_0x4cdca8)return console[_0x366c4d(0x15f)](_0x366c4d(0x163)),console['error'](_0x366c4d(0x147)),console[_0x366c4d(0x15f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x366c4d(0x15f)](_0x366c4d(0x1ac)),console['error'](_0x366c4d(0x15e)),console['error'](_0x366c4d(0x146)),console[_0x366c4d(0x15f)](_0x366c4d(0x19d)),console[_0x366c4d(0x15f)](_0x366c4d(0x12e)),console[_0x366c4d(0x15f)](_0x366c4d(0x139)),console[_0x366c4d(0x15f)](_0x366c4d(0x192)),0x1;try{const _0x5556e9=_0x1426ab[_0x366c4d(0x1a0)],_0x3e2fe3=await resolveSegmentTarget(_0x4cdca8,_0x5556e9,_0x1426ab['verbose']);_0x1426ab[_0x366c4d(0x180)]&&console[_0x366c4d(0x15f)](_0x366c4d(0x1b7)+_0x3e2fe3);const _0x55fb2b=await withSpinner(_0x366c4d(0x14c)+_0x4cdca8+_0x366c4d(0x15a),()=>_0x21e9dc[_0x366c4d(0x14d)][_0x366c4d(0x193)](_0x3e2fe3),{'verbose':_0x1426ab[_0x366c4d(0x180)]}),_0x4cb487=_0x55fb2b['data'];_0x1426ab[_0x366c4d(0x180)]&&(console[_0x366c4d(0x15f)](_0x366c4d(0x1ae)+_0x4cb487[_0x366c4d(0x125)]),console[_0x366c4d(0x15f)](_0x366c4d(0x17f)+_0x4cb487[_0x366c4d(0x12a)]),_0x4cb487['folderId']&&console[_0x366c4d(0x15f)]('Folder\x20ID:\x20'+_0x4cb487[_0x366c4d(0x184)]),_0x4cb487[_0x366c4d(0x12d)]&&console[_0x366c4d(0x15f)](_0x366c4d(0x148)+_0x4cb487[_0x366c4d(0x12d)]));if(_0x1426ab[_0x366c4d(0x13f)]){if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x128))return console[_0x366c4d(0x15f)](_0x366c4d(0x126)),0x1;if(_0x4cb487[_0x366c4d(0x125)]==='parent')return console[_0x366c4d(0x15f)](_0x366c4d(0x13a)),console[_0x366c4d(0x15f)](_0x366c4d(0x13b)),0x1;if(!_0x4cb487[_0x366c4d(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x366c4d(0x16d));const _0x2aa136=getConsoleNextUrl(_0x1426ab[_0x366c4d(0x14a)],'/app/ps/'+_0x4cb487['parentId']+_0x366c4d(0x135)+_0x4cb487[_0x366c4d(0x12d)]);return console[_0x366c4d(0x15f)](a27_0x111982['green']('✔')+_0x366c4d(0x187)+a27_0x111982[_0x366c4d(0x182)](_0x2aa136)),openBrowser(_0x2aa136),0x0;}if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x128)){if(!_0x4cb487['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3722b6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x21e9dc['segment'][_0x366c4d(0x13c)](_0x4cb487[_0x366c4d(0x184)]),{'verbose':_0x1426ab[_0x366c4d(0x180)]});await handleSingleObjectOutput(_0x3722b6[_0x366c4d(0x1a5)],_0x1426ab);}else{if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x14d)){if(!_0x4cb487[_0x366c4d(0x12d)])throw new SDKError(ErrorCode[_0x366c4d(0x1ab)],_0x366c4d(0x16d));const _0x2fc44a=await withSpinner(_0x366c4d(0x129),()=>_0x21e9dc[_0x366c4d(0x14d)][_0x366c4d(0x12b)](_0x4cb487[_0x366c4d(0x12a)],_0x4cb487[_0x366c4d(0x12d)]),{'verbose':_0x1426ab[_0x366c4d(0x180)]}),_0x42f64b=getConsoleNextUrl(_0x1426ab[_0x366c4d(0x14a)],_0x366c4d(0x12f)+_0x4cb487[_0x366c4d(0x12a)]+_0x366c4d(0x135)+_0x4cb487[_0x366c4d(0x12d)]),_0x3232fb=_0x2fc44a[_0x366c4d(0x1a5)];_0x3232fb[_0x366c4d(0x144)]=_0x42f64b,await handleSingleObjectOutput(_0x3232fb,_0x1426ab);}else return console[_0x366c4d(0x15f)](_0x366c4d(0x1a7)),console[_0x366c4d(0x15f)](_0x366c4d(0x1b9)),0x1;}return 0x0;}catch(_0x3d353c){if(_0x3d353c instanceof SDKError)return console[_0x366c4d(0x15f)](_0x366c4d(0x177)+_0x3d353c[_0x366c4d(0x16b)]),_0x3d353c['cause']&&console[_0x366c4d(0x15f)](_0x366c4d(0x124)+_0x3d353c[_0x366c4d(0x191)]),0x1;throw _0x3d353c;}}}export const SegmentInfoCommand=SegmentViewCommand;function a27_0x2220(){const _0x1a99e5=['\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','619902eFMRbo','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Cause:\x20','type','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segment:view','folder','Fetching\x20segment\x20details...','parentId','getSegment','limit','segmentId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','/app/ps/','Folder\x20name:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','name','/e/','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','8gNQGzc','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20view\x20-w','getFolder','33763185vVtykN','segment:folder:create','web','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1123361XNkUjv','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','url','SQL\x20query:\x0a','Examples:','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Segment\x20ID:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','site','\x20\x20Segment\x20name:\x20','Resolving\x20\x27','segment','includes','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20show','information_schema','segmentPath','jsonl','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','code','format','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','2341604QVcEKx','\x27...','length','60SsNLtj','replace','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','error','segment:show','listFolders','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Folder\x20reference\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','jobId','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','message','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','setJobId','\x20folder','✔\x20Found\x20','Fetching\x20parent\x20segment\x20details...','resolveParentId','parent','Site:\x20','3341968ghQBaB','segment:folder:list','Error:\x20','description','Use:\x20tdx\x20ps\x20sql','INVALID_ARGUMENT','getParent','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','in\x20','✔\x20Query\x20completed:\x20Processed\x20','Parent\x20ID:\x20','verbose','getSegmentSQL','cyan','Resolved\x20parent\x20folder\x20ID:\x20','folderId','SEGMENT_FOLDER_NOT_FOUND','Resolved\x20YAML\x20file:\x20','\x20Opening\x20','Resolving\x20path\x20\x27','segment:sql','\x20\x20Parent\x20segment:\x20','query','(root)','processedRows','Fetching\x20folder\x20details...','Folder\x20ID:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','cause','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolvePathToResource','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Executing\x20segment\x20query...','log','resolveFolderId','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Resolving\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20for\x20segment...','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Create\x20segment\x20folder\x20for\x20organization','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentSegment','✖\x20Query\x20failed\x20[','\x20\x20Folder\x20path:\x20','Parent\x20name:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','data','execute','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Full\x20path:\x20','Resolving\x20folder\x20\x27','SEGMENT_NOT_FOUND','Options:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolved\x20type:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','Usage:\x20tdx\x20sg\x20sql\x20<name>','Parent\x20segment:\x20','fullPath','Listing\x20folders\x20for\x20parent\x20\x27','\x27\x20with\x20ID:\x20','973185JMWzRP','segment:folder:show','Target\x20path:\x20','test','Use:\x20tdx\x20ps\x20view','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','759388isEhSe','Show\x20segment\x20folder\x20details'];a27_0x2220=function(){return _0x1a99e5;};return a27_0x2220();}export class SegmentDescCommand extends BaseCommand{[a27_0x3edf54(0x134)]='segment:desc';[a27_0x3edf54(0x178)]=a27_0x3edf54(0x194);async[a27_0x3edf54(0x1a6)](_0xc15d4d){const _0xd69958=a27_0x3edf54,{options:_0x4a5eb3,args:_0x5d7c13,tdx:_0x236836}=_0xc15d4d,_0x22b1e4=_0x5d7c13[0x0];if(!_0x22b1e4)return console[_0xd69958(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0xd69958(0x15f)](_0xd69958(0x1af)),console['error'](_0xd69958(0x133)),console[_0xd69958(0x15f)]('Examples:'),console[_0xd69958(0x15f)](_0xd69958(0x162)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b03f2=_0x4a5eb3['parentSegment'],_0x357773=await resolveSegmentTarget(_0x22b1e4,_0x2b03f2,_0x4a5eb3[_0xd69958(0x180)]);_0x4a5eb3['verbose']&&console[_0xd69958(0x15f)](_0xd69958(0x1b7)+_0x357773);const _0x112c07=await withSpinner('Resolving\x20\x27'+_0x22b1e4+_0xd69958(0x15a),()=>_0x236836[_0xd69958(0x14d)][_0xd69958(0x193)](_0x357773),{'verbose':_0x4a5eb3[_0xd69958(0x180)]}),_0x15e050=_0x112c07[_0xd69958(0x1a5)];_0x4a5eb3['verbose']&&(console[_0xd69958(0x15f)](_0xd69958(0x1ae)+_0x15e050[_0xd69958(0x125)]),console[_0xd69958(0x15f)]('Parent\x20ID:\x20'+_0x15e050[_0xd69958(0x12a)]));if(_0x15e050[_0xd69958(0x125)]===_0xd69958(0x128))return console[_0xd69958(0x15f)](_0xd69958(0x19f)),console['error'](_0xd69958(0x1a4)),0x1;if(_0x15e050[_0xd69958(0x125)]===_0xd69958(0x173))return console['error'](_0xd69958(0x17c)),console[_0xd69958(0x15f)](_0xd69958(0x19c)),0x1;if(!_0x15e050[_0xd69958(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd69958(0x16d));const _0x38d29c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x236836[_0xd69958(0x14d)]['getSegmentSQL'](_0x15e050['parentId'],_0x15e050['segmentId']),{'verbose':_0x4a5eb3[_0xd69958(0x180)]}),_0x4b2ce3=_0x38d29c['data'],_0x32c64a=await executeSchemaQuery(_0x4b2ce3,_0x236836,_0x4a5eb3);return await handleQueryOutput(_0x32c64a,_0x4a5eb3),0x0;}catch(_0x161440){if(_0x161440 instanceof SDKError)return console[_0xd69958(0x15f)](_0xd69958(0x177)+_0x161440[_0xd69958(0x16b)]),_0x161440['cause']&&console[_0xd69958(0x15f)](_0xd69958(0x124)+_0x161440[_0xd69958(0x191)]),0x1;throw _0x161440;}}}
|
|
1
|
+
function a27_0x3144(){const _0x5c4ee8=['Error:\x20','resolveParentId','SEGMENT_FOLDER_NOT_FOUND','folderPath','13796vTteFx','data','parent','Use:\x20tdx\x20ps\x20view\x20-w','segment:folder:list','4099410mBXsXG','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','verbose','createFolder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','parentFolder','segment:desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Path\x20or\x20name\x20is\x20required','folderId','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20or\x20folder\x20details','listFolders','47026bhlRHX','json','segment:show','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segmentPath','INVALID_ARGUMENT','1020hgMCvX','Fetching\x20folder\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','code','jobId','execute','Creating\x20folder\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Folder\x20name:\x20','4681055yKxyXD','processedRows','\x20\x20Segment\x20name:\x20','limit','getSegmentSQL','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','folder','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','getFolder','Resolving\x20folder\x20\x27','Executing\x20segment\x20query...','description','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','(root)','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Folder\x20ID:\x20','information_schema','Show\x20segment\x20folder\x20details','Fetching\x20SQL\x20for\x20segment...','replace','20pJVwEF','Resolving\x20\x27','segment:folder:show','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Folder\x20path:\x20','type','Usage:\x20tdx\x20sg\x20show\x20<name>','site','segmentName','Site:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x27\x20with\x20ID:\x20','elapsedTimeMillis','Resolved\x20type:\x20','\x20rows\x20','getSegment','parentSegment','✖\x20Query\x20failed\x20[','SEGMENT_NOT_FOUND','log','Resolving\x20parent\x20folder\x20\x27','query','Target\x20path:\x20','Fetching\x20segment\x20details...','633cKbJyj','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','cause','length','segment','message','toLocaleString','name','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segment:describe','/app/ps/','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','6647773fuhmhX','jsonl','trim','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segmentId','fullPath','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20show','Resolving\x20path\x20\x27','11794960LCqxCS','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','includes','format','1233353QxZkds','2UOeqaf','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','parentId','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','Resolved\x20YAML\x20file:\x20','Fetching\x20folder\x20\x27','Parent\x20segment:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27...','cyan','Segment\x20ID:\x20','Parent\x20ID:\x20','SQL\x20query:\x0a','Options:','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved\x20parent\x20ID:\x20','Examples:','Create\x20segment\x20folder\x20for\x20organization','error','stats','setJobId','\x20\x20Parent\x20segment:\x20'];a27_0x3144=function(){return _0x5c4ee8;};return a27_0x3144();}const a27_0x58e0f3=a27_0x2e19;(function(_0x97ac42,_0x59f8b1){const _0x9e907b=a27_0x2e19,_0x468f8f=_0x97ac42();while(!![]){try{const _0x4cdd5a=-parseInt(_0x9e907b(0x153))/0x1*(-parseInt(_0x9e907b(0x154))/0x2)+-parseInt(_0x9e907b(0x137))/0x3*(-parseInt(_0x9e907b(0x174))/0x4)+parseInt(_0x9e907b(0x19c))/0x5+parseInt(_0x9e907b(0x191))/0x6*(parseInt(_0x9e907b(0x18b))/0x7)+-parseInt(_0x9e907b(0x14e))/0x8+-parseInt(_0x9e907b(0x179))/0x9+parseInt(_0x9e907b(0x1b3))/0xa*(-parseInt(_0x9e907b(0x145))/0xb);if(_0x4cdd5a===_0x59f8b1)break;else _0x468f8f['push'](_0x468f8f['shift']());}catch(_0x5212e8){_0x468f8f['push'](_0x468f8f['shift']());}}}(a27_0x3144,0xdbed1));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_0x14840c from'chalk';async function resolveSegmentTarget(_0x52ab86,_0x32a673,_0x14c09b){const _0x10e040=a27_0x2e19;if(isYamlFilePath(_0x52ab86))try{const _0x5950ea=await resolveYamlFilePath(_0x52ab86);return _0x14c09b&&(console[_0x10e040(0x16c)](_0x10e040(0x15b)+_0x52ab86),console['error'](_0x10e040(0x16f)+_0x5950ea['parentSegment']),console[_0x10e040(0x16c)](_0x10e040(0x19e)+_0x5950ea[_0x10e040(0x126)]),console[_0x10e040(0x16c)](_0x10e040(0x122)+(_0x5950ea[_0x10e040(0x173)]||_0x10e040(0x1ac))),console[_0x10e040(0x16c)]('\x20\x20Full\x20path:\x20'+_0x5950ea[_0x10e040(0x14a)])),_0x5950ea[_0x10e040(0x14a)];}catch(_0x37afb3){throw new SDKError(ErrorCode[_0x10e040(0x190)],_0x10e040(0x121)+_0x37afb3[_0x10e040(0x13d)]);}if(!_0x32a673)throw new SDKError(ErrorCode[_0x10e040(0x190)],_0x10e040(0x157));return _0x32a673+'/'+_0x52ab86;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]=a27_0x58e0f3(0x141);[a27_0x58e0f3(0x1a7)]=a27_0x58e0f3(0x189);async['execute'](_0x1b3027){const _0x445770=a27_0x58e0f3,{options:_0x5b92ff,args:_0x433578,tdx:_0x119136}=_0x1b3027,_0x48ca84=_0x433578[0x0],_0x48e6ee=!_0x48ca84&&!!_0x5b92ff[_0x445770(0x12f)],_0x29c806=_0x48ca84||_0x5b92ff['parentSegment'];if(!_0x29c806)return console[_0x445770(0x16c)](_0x445770(0x186)),console[_0x445770(0x16c)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x445770(0x16a)),console[_0x445770(0x16c)](_0x445770(0x17e)),console[_0x445770(0x16c)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error'](_0x445770(0x1aa)),console[_0x445770(0x16c)](_0x445770(0x18e)),0x1;try{const _0x4cb913=_0x5b92ff[_0x445770(0x18f)];let _0x25d02b=_0x29c806;!_0x48e6ee&&_0x4cb913&&!_0x29c806[_0x445770(0x151)]('/')&&(_0x25d02b=_0x4cb913+'/'+_0x29c806,_0x5b92ff[_0x445770(0x17c)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x25d02b));const _0x42d5ac=await withSpinner(_0x445770(0x14d)+_0x25d02b+_0x445770(0x160),()=>_0x119136['segment'][_0x445770(0x17b)](_0x25d02b),{'verbose':_0x5b92ff[_0x445770(0x17c)]}),_0x57c8e8=_0x42d5ac[_0x445770(0x175)];_0x5b92ff[_0x445770(0x17c)]&&(console['error'](_0x445770(0x12c)+_0x57c8e8[_0x445770(0x123)]),console[_0x445770(0x16c)](_0x445770(0x163)+_0x57c8e8[_0x445770(0x156)]),_0x57c8e8[_0x445770(0x187)]&&console[_0x445770(0x16c)](_0x445770(0x1ae)+_0x57c8e8[_0x445770(0x187)]),_0x57c8e8[_0x445770(0x149)]&&console[_0x445770(0x16c)](_0x445770(0x162)+_0x57c8e8[_0x445770(0x149)]));if(_0x57c8e8[_0x445770(0x123)]===_0x445770(0x176)){const _0x28cfb0=await withSpinner(_0x445770(0x188),()=>_0x119136[_0x445770(0x13c)]['getParent'](_0x57c8e8['parentId']),{'verbose':_0x5b92ff[_0x445770(0x17c)]});await handleSingleObjectOutput(_0x28cfb0[_0x445770(0x175)],_0x5b92ff);}else{if(_0x57c8e8[_0x445770(0x123)]===_0x445770(0x1a2)){if(!_0x57c8e8[_0x445770(0x187)])throw new SDKError(ErrorCode[_0x445770(0x172)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x282c2d=await withSpinner('Fetching\x20folder\x20details...',()=>_0x119136[_0x445770(0x13c)][_0x445770(0x1a4)](_0x57c8e8[_0x445770(0x187)]),{'verbose':_0x5b92ff[_0x445770(0x17c)]});await handleSingleObjectOutput(_0x282c2d['data'],_0x5b92ff);}else{if(_0x57c8e8[_0x445770(0x123)]===_0x445770(0x13c)){if(!_0x57c8e8[_0x445770(0x149)])throw new SDKError(ErrorCode[_0x445770(0x131)],_0x445770(0x15e));const _0x38fe3b=await withSpinner(_0x445770(0x136),()=>_0x119136[_0x445770(0x13c)][_0x445770(0x12e)](_0x57c8e8[_0x445770(0x156)],_0x57c8e8['segmentId']),{'verbose':_0x5b92ff[_0x445770(0x17c)]});await handleSingleObjectOutput(_0x38fe3b[_0x445770(0x175)],_0x5b92ff);}}}return 0x0;}catch(_0x599de3){if(_0x599de3 instanceof SDKError)return console[_0x445770(0x16c)](_0x445770(0x170)+_0x599de3[_0x445770(0x13d)]),_0x599de3[_0x445770(0x13a)]&&console[_0x445770(0x16c)](_0x445770(0x14b)+_0x599de3[_0x445770(0x13a)]),0x1;throw _0x599de3;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]=a27_0x58e0f3(0x18d);[a27_0x58e0f3(0x1a7)]=a27_0x58e0f3(0x168);async[a27_0x58e0f3(0x198)](_0x46ec23){const _0x53a6ee=a27_0x58e0f3,{options:_0x4adcd4,args:_0x152624,tdx:_0x5eb043}=_0x46ec23,_0x373c9d=_0x152624[0x0];if(!_0x373c9d)return console['error'](_0x53a6ee(0x11f)),console['error'](_0x53a6ee(0x124)),console[_0x53a6ee(0x16c)](_0x53a6ee(0x184)),console['error']('Examples:'),console[_0x53a6ee(0x16c)](_0x53a6ee(0x159)),console[_0x53a6ee(0x16c)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x101fb2=_0x4adcd4['parentSegment'],_0x208179=await resolveSegmentTarget(_0x373c9d,_0x101fb2,_0x4adcd4[_0x53a6ee(0x17c)]);_0x4adcd4['verbose']&&console[_0x53a6ee(0x16c)](_0x53a6ee(0x135)+_0x208179);const _0x153de6=await withSpinner(_0x53a6ee(0x11d)+_0x373c9d+_0x53a6ee(0x160),()=>_0x5eb043[_0x53a6ee(0x13c)]['resolvePathToResource'](_0x208179),{'verbose':_0x4adcd4[_0x53a6ee(0x17c)]}),_0x58ead0=_0x153de6[_0x53a6ee(0x175)];_0x4adcd4['verbose']&&(console[_0x53a6ee(0x16c)](_0x53a6ee(0x12c)+_0x58ead0[_0x53a6ee(0x123)]),console[_0x53a6ee(0x16c)](_0x53a6ee(0x163)+_0x58ead0[_0x53a6ee(0x156)]));if(_0x58ead0['type']===_0x53a6ee(0x1a2))return console[_0x53a6ee(0x16c)](_0x53a6ee(0x150)),console['error'](_0x53a6ee(0x182)),0x1;if(_0x58ead0[_0x53a6ee(0x123)]===_0x53a6ee(0x176))return console[_0x53a6ee(0x16c)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x53a6ee(0x14c)),0x1;if(!_0x58ead0['segmentId'])throw new SDKError(ErrorCode[_0x53a6ee(0x131)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x491c95=await withSpinner(_0x53a6ee(0x1b1),()=>_0x5eb043[_0x53a6ee(0x13c)]['getSegmentSQL'](_0x58ead0[_0x53a6ee(0x156)],_0x58ead0[_0x53a6ee(0x149)]),{'verbose':_0x4adcd4['verbose']});let _0x3ec222=_0x491c95[_0x53a6ee(0x175)];const _0x4aebdf=resolveLimit(_0x4adcd4[_0x53a6ee(0x19f)],DEFAULT_DISPLAY_LIMIT),_0x234604=/\bLIMIT\s+\d+/i['test'](_0x3ec222);!_0x234604&&(_0x3ec222=_0x3ec222[_0x53a6ee(0x147)]()[_0x53a6ee(0x1b2)](/;+$/,''),_0x3ec222=_0x53a6ee(0x185)+_0x3ec222+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x4aebdf);_0x4adcd4[_0x53a6ee(0x17c)]&&console[_0x53a6ee(0x16c)](_0x53a6ee(0x164)+_0x3ec222);const _0x31edcc=await withProgressSpinner(_0x53a6ee(0x1a6),async _0x1acb25=>{const _0x241edf=_0x53a6ee,_0xee7925=await _0x5eb043[_0x241edf(0x134)]['execute'](_0x3ec222,{'catalog':'td','schema':_0x241edf(0x1af),'onJobId':_0x37a0ca=>{const _0x937434=_0x241edf;_0x1acb25[_0x937434(0x16e)](_0x37a0ca);}});return _0xee7925;},{'verbose':_0x4adcd4[_0x53a6ee(0x17c)]}),_0x57c372=_0x31edcc[_0x53a6ee(0x175)],_0x14b356=_0x57c372[_0x53a6ee(0x197)]?'\x20[Job\x20ID:\x20'+_0x57c372[_0x53a6ee(0x197)]+']':'';return console[_0x53a6ee(0x16c)](_0x53a6ee(0x19a)+_0x57c372['stats'][_0x53a6ee(0x19d)][_0x53a6ee(0x13e)]()+_0x53a6ee(0x12d)+('in\x20'+formatElapsed(_0x57c372[_0x53a6ee(0x16d)][_0x53a6ee(0x12b)])+_0x14b356)),await handleQueryOutput(_0x57c372,_0x4adcd4),0x0;}catch(_0x204ec7){if(_0x204ec7 instanceof SDKError)return console[_0x53a6ee(0x16c)](_0x53a6ee(0x130)+_0x204ec7[_0x53a6ee(0x196)]+']'),console[_0x53a6ee(0x16c)]('\x0a'+_0x204ec7[_0x53a6ee(0x13d)]),0x1;throw _0x204ec7;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]=a27_0x58e0f3(0x178);[a27_0x58e0f3(0x1a7)]=a27_0x58e0f3(0x155);async[a27_0x58e0f3(0x198)](_0x2e55c8){const _0x11c14c=a27_0x58e0f3,{options:_0x3e702b,args:_0x73bb74,tdx:_0x44b5ca}=_0x2e55c8;if(_0x73bb74[_0x11c14c(0x13b)]===0x0)return console[_0x11c14c(0x16c)](_0x11c14c(0x15f)),console[_0x11c14c(0x16c)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x516e0d=_0x73bb74[0x0];try{_0x3e702b[_0x11c14c(0x17c)]&&(console[_0x11c14c(0x16c)](_0x11c14c(0x127)+_0x3e702b[_0x11c14c(0x125)]),console[_0x11c14c(0x16c)](_0x11c14c(0x15a)+_0x516e0d));const _0x169623=await withSpinner(_0x11c14c(0x17a)+_0x516e0d+_0x11c14c(0x160),()=>_0x44b5ca['segment']['resolveParentId'](_0x516e0d),{'verbose':_0x3e702b[_0x11c14c(0x17c)]}),_0x2e5988=_0x169623[_0x11c14c(0x175)];_0x3e702b[_0x11c14c(0x17c)]&&console[_0x11c14c(0x16c)](_0x11c14c(0x169)+_0x2e5988);const _0x105886=await withSpinner(_0x11c14c(0x120)+_0x516e0d+_0x11c14c(0x160),()=>_0x44b5ca[_0x11c14c(0x13c)][_0x11c14c(0x18a)](_0x2e5988),{'verbose':_0x3e702b[_0x11c14c(0x17c)]}),_0x5cdbe2=_0x105886[_0x11c14c(0x175)];return console['error']('✔\x20Found\x20'+_0x5cdbe2[_0x11c14c(0x13b)]+'\x20folder'+(_0x5cdbe2['length']!==0x1?'s':'')),await handleSDKOutput(_0x5cdbe2,_0x3e702b),0x0;}catch(_0x10908f){if(_0x10908f instanceof SDKError)return console[_0x11c14c(0x16c)]('Error:\x20'+_0x10908f['message']),_0x10908f[_0x11c14c(0x13a)]&&console[_0x11c14c(0x16c)](_0x11c14c(0x14b)+_0x10908f[_0x11c14c(0x13a)]),0x1;throw _0x10908f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]=a27_0x58e0f3(0x11e);['description']=a27_0x58e0f3(0x1b0);async['execute'](_0x483439){const _0x16143b=a27_0x58e0f3,{options:_0xe221b5,args:_0x312956,tdx:_0x3f2cca}=_0x483439;if(_0x312956['length']===0x0)return console[_0x16143b(0x16c)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0xf0445d,childId:_0x1008bc}=parseSegmentRef(_0x312956[0x0]);_0xe221b5[_0x16143b(0x17c)]&&(console['error'](_0x16143b(0x127)+_0xe221b5['site']),console[_0x16143b(0x16c)]('Parent\x20name:\x20'+_0xf0445d),_0x1008bc&&console['error'](_0x16143b(0x19b)+_0x1008bc));if(!_0x1008bc)return console['error'](_0x16143b(0x1ad)),0x1;const _0x16a0b8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf0445d+'\x27...',()=>_0x3f2cca['segment']['resolveParentId'](_0xf0445d),{'verbose':_0xe221b5[_0x16143b(0x17c)]}),_0x21df1a=_0x16a0b8[_0x16143b(0x175)];_0xe221b5[_0x16143b(0x17c)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x21df1a);const _0x29d67b=await withSpinner(_0x16143b(0x1a5)+_0x1008bc+_0x16143b(0x160),()=>_0x3f2cca[_0x16143b(0x13c)]['resolveFolderId'](_0x21df1a,_0x1008bc),{'verbose':_0xe221b5[_0x16143b(0x17c)]}),_0x4dcd7a=_0x29d67b[_0x16143b(0x175)];_0xe221b5['verbose']&&console[_0x16143b(0x16c)]('Resolved\x20folder\x20ID:\x20'+_0x4dcd7a);const _0x19c61c=await withSpinner(_0x16143b(0x15c)+_0x1008bc+_0x16143b(0x160),()=>_0x3f2cca['segment']['getFolder'](_0x4dcd7a),{'verbose':_0xe221b5[_0x16143b(0x17c)]});return await handleSDKOutput([_0x19c61c['data']],_0xe221b5),0x0;}catch(_0x3a4a7f){if(_0x3a4a7f instanceof SDKError)return console[_0x16143b(0x16c)](_0x16143b(0x170)+_0x3a4a7f['message']),_0x3a4a7f[_0x16143b(0x13a)]&&console[_0x16143b(0x16c)](_0x16143b(0x14b)+_0x3a4a7f[_0x16143b(0x13a)]),0x1;throw _0x3a4a7f;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]='segment:sql';[a27_0x58e0f3(0x1a7)]=a27_0x58e0f3(0x193);async[a27_0x58e0f3(0x198)](_0x48a249){const _0xcde038=a27_0x58e0f3,{options:_0x5bc37d,args:_0x5f5017,tdx:_0x259137}=_0x48a249,_0x517652=_0x5f5017[0x0];if(!_0x517652)return console[_0xcde038(0x16c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0xcde038(0x16c)](_0xcde038(0x129)),console[_0xcde038(0x16c)](_0xcde038(0x1ab)),console['error'](_0xcde038(0x16a)),console[_0xcde038(0x16c)](_0xcde038(0x128)),console[_0xcde038(0x16c)](_0xcde038(0x1a9)),0x1;try{const _0x9878d5=_0x5bc37d[_0xcde038(0x12f)],_0x566465=await resolveSegmentTarget(_0x517652,_0x9878d5,_0x5bc37d['verbose']);_0x5bc37d[_0xcde038(0x17c)]&&console[_0xcde038(0x16c)](_0xcde038(0x135)+_0x566465);const _0x3727fd=await withSpinner(_0xcde038(0x11d)+_0x517652+'\x27...',()=>_0x259137[_0xcde038(0x13c)][_0xcde038(0x17b)](_0x566465),{'verbose':_0x5bc37d[_0xcde038(0x17c)]}),_0x8ffe8c=_0x3727fd[_0xcde038(0x175)];_0x5bc37d[_0xcde038(0x17c)]&&(console[_0xcde038(0x16c)](_0xcde038(0x12c)+_0x8ffe8c[_0xcde038(0x123)]),console['error']('Parent\x20ID:\x20'+_0x8ffe8c[_0xcde038(0x156)]));if(_0x8ffe8c['type']===_0xcde038(0x1a2))return console[_0xcde038(0x16c)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0xcde038(0x16c)](_0xcde038(0x194)),0x1;if(_0x8ffe8c[_0xcde038(0x123)]===_0xcde038(0x176))return console[_0xcde038(0x16c)](_0xcde038(0x14f)),console[_0xcde038(0x16c)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x8ffe8c[_0xcde038(0x149)])throw new SDKError(ErrorCode[_0xcde038(0x131)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d2c8e=await withSpinner(_0xcde038(0x1b1),()=>_0x259137[_0xcde038(0x13c)][_0xcde038(0x1a0)](_0x8ffe8c[_0xcde038(0x156)],_0x8ffe8c[_0xcde038(0x149)]),{'verbose':_0x5bc37d[_0xcde038(0x17c)]}),_0x30bfdd=_0x4d2c8e['data'];return _0x5bc37d[_0xcde038(0x152)]===_0xcde038(0x18c)||_0x5bc37d[_0xcde038(0x152)]===_0xcde038(0x146)?await handleSDKOutput([{'sql':_0x30bfdd}],_0x5bc37d):console[_0xcde038(0x132)](_0x30bfdd),0x0;}catch(_0x40b6c9){if(_0x40b6c9 instanceof SDKError)return console[_0xcde038(0x16c)]('Error:\x20'+_0x40b6c9['message']),_0x40b6c9[_0xcde038(0x13a)]&&console[_0xcde038(0x16c)](_0xcde038(0x14b)+_0x40b6c9[_0xcde038(0x13a)]),0x1;throw _0x40b6c9;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]='segment:folder:create';[a27_0x58e0f3(0x1a7)]=a27_0x58e0f3(0x16b);async[a27_0x58e0f3(0x198)](_0x265924){const _0x59b5c6=a27_0x58e0f3,{options:_0x507ed7,args:_0x5323b3,tdx:_0x436ce8}=_0x265924,_0x4a7882=_0x507ed7;if(_0x5323b3[_0x59b5c6(0x13b)]<0x2)return console[_0x59b5c6(0x16c)](_0x59b5c6(0x158)),console[_0x59b5c6(0x16c)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x2d6bbb=_0x5323b3[0x0],_0x115273=_0x5323b3[0x1];_0x4a7882[_0x59b5c6(0x17c)]&&(console[_0x59b5c6(0x16c)](_0x59b5c6(0x127)+_0x4a7882[_0x59b5c6(0x125)]),console[_0x59b5c6(0x16c)](_0x59b5c6(0x15d)+_0x2d6bbb),console[_0x59b5c6(0x16c)]('Folder\x20name:\x20'+_0x115273));let _0x5238df;if(_0x4a7882[_0x59b5c6(0x17f)]){const _0x2e431c=_0x4a7882[_0x59b5c6(0x17f)],_0x276238=await withSpinner(_0x59b5c6(0x17a)+_0x2d6bbb+_0x59b5c6(0x160),()=>_0x436ce8['segment'][_0x59b5c6(0x171)](_0x2d6bbb),{'verbose':_0x4a7882[_0x59b5c6(0x17c)]}),_0x260d82=_0x276238[_0x59b5c6(0x175)],_0x32ddde=await withSpinner(_0x59b5c6(0x133)+_0x2e431c+_0x59b5c6(0x160),()=>_0x436ce8['segment']['resolveFolderId'](_0x260d82,_0x2e431c),{'verbose':_0x4a7882[_0x59b5c6(0x17c)]});_0x5238df=_0x32ddde[_0x59b5c6(0x175)],_0x4a7882['verbose']&&console['error'](_0x59b5c6(0x138)+_0x5238df);}const _0x3c022e={'name':_0x115273,'description':_0x4a7882[_0x59b5c6(0x1a7)],'parentFolderId':_0x5238df},_0x371d23=await withSpinner(_0x59b5c6(0x199)+_0x115273+_0x59b5c6(0x160),()=>_0x436ce8[_0x59b5c6(0x13c)][_0x59b5c6(0x17d)](_0x2d6bbb,_0x3c022e),{'verbose':_0x4a7882[_0x59b5c6(0x17c)]}),_0x311520=_0x371d23[_0x59b5c6(0x175)];return console[_0x59b5c6(0x16c)]('✔\x20Created\x20folder\x20\x27'+_0x311520[_0x59b5c6(0x13f)]+_0x59b5c6(0x12a)+_0x311520['id']),await handleSDKOutput([_0x311520],_0x4a7882),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]='segment:view';['description']=a27_0x58e0f3(0x1a8);async[a27_0x58e0f3(0x198)](_0x2b36c4){const _0x514423=a27_0x58e0f3,{options:_0x3d3dd0,args:_0x44ff94,tdx:_0x59b2f1}=_0x2b36c4,_0x586975=_0x44ff94[0x0];if(!_0x586975)return console['error'](_0x514423(0x148)),console[_0x514423(0x16c)](_0x514423(0x143)),console[_0x514423(0x16c)](_0x514423(0x181)),console['error'](_0x514423(0x165)),console[_0x514423(0x16c)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x514423(0x16a)),console[_0x514423(0x16c)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x514423(0x139)),console[_0x514423(0x16c)](_0x514423(0x195)),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x39a612=_0x3d3dd0[_0x514423(0x12f)],_0x281d8d=await resolveSegmentTarget(_0x586975,_0x39a612,_0x3d3dd0[_0x514423(0x17c)]);_0x3d3dd0[_0x514423(0x17c)]&&console[_0x514423(0x16c)](_0x514423(0x135)+_0x281d8d);const _0x39a2de=await withSpinner(_0x514423(0x11d)+_0x586975+_0x514423(0x160),()=>_0x59b2f1['segment'][_0x514423(0x17b)](_0x281d8d),{'verbose':_0x3d3dd0[_0x514423(0x17c)]}),_0x4dd5e1=_0x39a2de['data'];_0x3d3dd0[_0x514423(0x17c)]&&(console['error']('Resolved\x20type:\x20'+_0x4dd5e1['type']),console[_0x514423(0x16c)](_0x514423(0x163)+_0x4dd5e1[_0x514423(0x156)]),_0x4dd5e1[_0x514423(0x187)]&&console[_0x514423(0x16c)]('Folder\x20ID:\x20'+_0x4dd5e1[_0x514423(0x187)]),_0x4dd5e1[_0x514423(0x149)]&&console['error']('Segment\x20ID:\x20'+_0x4dd5e1[_0x514423(0x149)]));if(_0x3d3dd0['web']){if(_0x4dd5e1[_0x514423(0x123)]===_0x514423(0x1a2))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x4dd5e1[_0x514423(0x123)]===_0x514423(0x176))return console['error'](_0x514423(0x1a3)),console['error'](_0x514423(0x177)),0x1;if(!_0x4dd5e1[_0x514423(0x149)])throw new SDKError(ErrorCode[_0x514423(0x131)],_0x514423(0x15e));const _0x274f9a=getConsoleNextUrl(_0x3d3dd0['site'],_0x514423(0x142)+_0x4dd5e1['parentId']+'/e/'+_0x4dd5e1['segmentId']);return console[_0x514423(0x16c)](a27_0x14840c[_0x514423(0x183)]('✔')+'\x20Opening\x20'+a27_0x14840c[_0x514423(0x161)](_0x274f9a)),openBrowser(_0x274f9a),0x0;}if(_0x4dd5e1[_0x514423(0x123)]==='folder'){if(!_0x4dd5e1['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x514423(0x166));const _0x1eaf00=await withSpinner(_0x514423(0x192),()=>_0x59b2f1[_0x514423(0x13c)][_0x514423(0x1a4)](_0x4dd5e1[_0x514423(0x187)]),{'verbose':_0x3d3dd0[_0x514423(0x17c)]});await handleSingleObjectOutput(_0x1eaf00[_0x514423(0x175)],_0x3d3dd0);}else{if(_0x4dd5e1['type']==='segment'){if(!_0x4dd5e1[_0x514423(0x149)])throw new SDKError(ErrorCode[_0x514423(0x131)],_0x514423(0x15e));const _0xd04777=await withSpinner(_0x514423(0x136),()=>_0x59b2f1['segment'][_0x514423(0x12e)](_0x4dd5e1[_0x514423(0x156)],_0x4dd5e1[_0x514423(0x149)]),{'verbose':_0x3d3dd0[_0x514423(0x17c)]}),_0x5c3261=getConsoleNextUrl(_0x3d3dd0[_0x514423(0x125)],_0x514423(0x142)+_0x4dd5e1[_0x514423(0x156)]+'/e/'+_0x4dd5e1[_0x514423(0x149)]),_0x4ada7f=_0xd04777[_0x514423(0x175)];_0x4ada7f['url']=_0x5c3261,await handleSingleObjectOutput(_0x4ada7f,_0x3d3dd0);}else return console[_0x514423(0x16c)](_0x514423(0x1a1)),console[_0x514423(0x16c)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0xa9c0db){if(_0xa9c0db instanceof SDKError)return console['error']('Error:\x20'+_0xa9c0db[_0x514423(0x13d)]),_0xa9c0db[_0x514423(0x13a)]&&console['error'](_0x514423(0x14b)+_0xa9c0db['cause']),0x1;throw _0xa9c0db;}}}export const SegmentInfoCommand=SegmentViewCommand;function a27_0x2e19(_0x13cdd2,_0x469b6f){_0x13cdd2=_0x13cdd2-0x11d;const _0x314437=a27_0x3144();let _0x2e191e=_0x314437[_0x13cdd2];return _0x2e191e;}export class SegmentDescCommand extends BaseCommand{[a27_0x58e0f3(0x13f)]=a27_0x58e0f3(0x180);[a27_0x58e0f3(0x1a7)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x34686e){const _0x1786af=a27_0x58e0f3,{options:_0x9d75bb,args:_0x2217e7,tdx:_0x13979e}=_0x34686e,_0x5bebc6=_0x2217e7[0x0];if(!_0x5bebc6)return console[_0x1786af(0x16c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1786af(0x16c)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x1786af(0x16a)),console[_0x1786af(0x16c)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1786af(0x16c)](_0x1786af(0x140)),0x1;try{const _0x1d3216=_0x9d75bb[_0x1786af(0x12f)],_0xec556e=await resolveSegmentTarget(_0x5bebc6,_0x1d3216,_0x9d75bb[_0x1786af(0x17c)]);_0x9d75bb[_0x1786af(0x17c)]&&console[_0x1786af(0x16c)](_0x1786af(0x135)+_0xec556e);const _0xdd7882=await withSpinner(_0x1786af(0x11d)+_0x5bebc6+_0x1786af(0x160),()=>_0x13979e[_0x1786af(0x13c)][_0x1786af(0x17b)](_0xec556e),{'verbose':_0x9d75bb[_0x1786af(0x17c)]}),_0x1ad544=_0xdd7882[_0x1786af(0x175)];_0x9d75bb[_0x1786af(0x17c)]&&(console[_0x1786af(0x16c)](_0x1786af(0x12c)+_0x1ad544['type']),console['error'](_0x1786af(0x163)+_0x1ad544[_0x1786af(0x156)]));if(_0x1ad544[_0x1786af(0x123)]==='folder')return console['error'](_0x1786af(0x167)),console[_0x1786af(0x16c)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1ad544[_0x1786af(0x123)]==='parent')return console[_0x1786af(0x16c)](_0x1786af(0x144)),console[_0x1786af(0x16c)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x1ad544[_0x1786af(0x149)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x35dee0=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x13979e[_0x1786af(0x13c)][_0x1786af(0x1a0)](_0x1ad544['parentId'],_0x1ad544['segmentId']),{'verbose':_0x9d75bb[_0x1786af(0x17c)]}),_0x3e7bfc=_0x35dee0[_0x1786af(0x175)],_0x4ace66=await executeSchemaQuery(_0x3e7bfc,_0x13979e,_0x9d75bb);return await handleQueryOutput(_0x4ace66,_0x9d75bb),0x0;}catch(_0x1d52aa){if(_0x1d52aa instanceof SDKError)return console['error'](_0x1786af(0x170)+_0x1d52aa['message']),_0x1d52aa[_0x1786af(0x13a)]&&console[_0x1786af(0x16c)]('\x20\x20Cause:\x20'+_0x1d52aa['cause']),0x1;throw _0x1d52aa;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x5c0511=a28_0x56a0;(function(_0x12d376,_0x29269c){const _0xfd34d1=a28_0x56a0,_0x1f4e3c=_0x12d376();while(!![]){try{const _0x211969=parseInt(_0xfd34d1(0x1db))/0x1+parseInt(_0xfd34d1(0x1ee))/0x2*(-parseInt(_0xfd34d1(0x1d1))/0x3)+-parseInt(_0xfd34d1(0x1e4))/0x4+-parseInt(_0xfd34d1(0x1f8))/0x5*(-parseInt(_0xfd34d1(0x1e9))/0x6)+-parseInt(_0xfd34d1(0x1cf))/0x7+-parseInt(_0xfd34d1(0x1e5))/0x8+parseInt(_0xfd34d1(0x1f9))/0x9*(parseInt(_0xfd34d1(0x1ce))/0xa);if(_0x211969===_0x29269c)break;else _0x1f4e3c['push'](_0x1f4e3c['shift']());}catch(_0x587101){_0x1f4e3c['push'](_0x1f4e3c['shift']());}}}(a28_0x1a40,0x6cabb));import{BaseCommand}from'./command.js';function a28_0x1a40(){const _0xf9528d=['resolvePathToResource','noCountPopulation','Site:\x20','\x27...','781967NIGlAM','parent','createSegment','Resolved\x20folder\x20ID:\x20','invisible','Resolved\x20relative\x20path\x20to:\x20','segment:create','Parent\x20path:\x20','execute','2156376CmqXll','4377864JvmFka','error','kind','Examples:','6DhdBqb','type','description','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','8602fFHmtK','Creating\x20segment\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segmentPath','Create\x20child\x20segment\x20with\x20filtering\x20rules','verbose','length','Segment\x20name:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','273205xacaKo','32013FsmPMm','folder','yellow','Parent:\x20','resolveFolderId','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','folderId','Target\x20path:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','site','segment','data','5570SeOWBt','6084526fzgSBR','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','291tNumER','segments','\x20\x20\x20Path:\x20','name','Resolving\x20folder\x20path\x20\x27','rule'];a28_0x1a40=function(){return _0xf9528d;};return a28_0x1a40();}function a28_0x56a0(_0x353b3c,_0x2beb4a){_0x353b3c=_0x353b3c-0x1ce;const _0x1a4041=a28_0x1a40();let _0x56a00d=_0x1a4041[_0x353b3c];return _0x56a00d;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x1d6498 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x5c0511(0x1d4)]=a28_0x5c0511(0x1e1);['description']=a28_0x5c0511(0x1f3);async[a28_0x5c0511(0x1e3)](_0x4b798f){const _0x341658=a28_0x5c0511;console[_0x341658(0x1e6)](a28_0x1d6498[_0x341658(0x1fb)](_0x341658(0x201))),console[_0x341658(0x1e6)](a28_0x1d6498[_0x341658(0x1fb)](_0x341658(0x1d0)));const {options:_0x3dee85,args:_0x38a607,tdx:_0x1805c5}=_0x4b798f,_0x472f3f=_0x3dee85;if(_0x38a607[_0x341658(0x1f5)]===0x0)return console[_0x341658(0x1e6)](_0x341658(0x1f0)),console['error'](_0x341658(0x1ec)),console[_0x341658(0x1e6)](_0x341658(0x1e8)),console[_0x341658(0x1e6)](_0x341658(0x1ed)),console[_0x341658(0x1e6)](_0x341658(0x1f7)),console[_0x341658(0x1e6)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x1492df=_0x38a607[0x0],_0x3c22f7=_0x3dee85[_0x341658(0x1f2)];let _0x3d39da=_0x1492df;_0x3c22f7&&!_0x1492df['includes']('/')&&(_0x3d39da=_0x3c22f7+'/'+_0x1492df,_0x472f3f[_0x341658(0x1f4)]&&console[_0x341658(0x1e6)](_0x341658(0x1e0)+_0x3d39da));const _0x289b01=parsePath(_0x3d39da);if(_0x289b01['segments'][_0x341658(0x1f5)]<0x2)return console[_0x341658(0x1e6)](_0x341658(0x1f1)),console[_0x341658(0x1e6)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x50d8c1=_0x289b01[_0x341658(0x1d2)][0x0],_0x3642d6=getBaseName(_0x3d39da),_0x10ba17=getParentPath(_0x3d39da);_0x472f3f[_0x341658(0x1f4)]&&(console[_0x341658(0x1e6)](_0x341658(0x1d9)+_0x472f3f[_0x341658(0x202)]),console['error'](_0x341658(0x200)+_0x3d39da),console[_0x341658(0x1e6)](_0x341658(0x1fc)+_0x50d8c1),console['error'](_0x341658(0x1f6)+_0x3642d6),console[_0x341658(0x1e6)](_0x341658(0x1e2)+_0x10ba17));const _0x911b3d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x50d8c1+_0x341658(0x1da),()=>_0x1805c5[_0x341658(0x203)]['resolveParentId'](_0x50d8c1),{'verbose':_0x472f3f['verbose']}),_0x503e35=_0x911b3d[_0x341658(0x204)];let _0x15235f;if(_0x289b01[_0x341658(0x1d2)]['length']>0x2){const _0x3fd17d=await withSpinner(_0x341658(0x1d5)+_0x10ba17+_0x341658(0x1da),()=>_0x1805c5[_0x341658(0x203)][_0x341658(0x1d7)](_0x10ba17),{'verbose':_0x472f3f[_0x341658(0x1f4)]}),_0x4e9713=_0x3fd17d[_0x341658(0x204)];if(_0x4e9713[_0x341658(0x1ea)]!==_0x341658(0x1fa)&&_0x4e9713[_0x341658(0x1ea)]!==_0x341658(0x1dc))return console[_0x341658(0x1e6)](_0x341658(0x1fe)),0x1;_0x15235f=_0x4e9713[_0x341658(0x1ff)];}else{if(_0x472f3f[_0x341658(0x1fa)]){const _0x391bbe=await withSpinner('Resolving\x20folder\x20\x27'+_0x472f3f[_0x341658(0x1fa)]+_0x341658(0x1da),()=>_0x1805c5[_0x341658(0x203)][_0x341658(0x1fd)](_0x503e35,_0x472f3f[_0x341658(0x1fa)]),{'verbose':_0x472f3f['verbose']});_0x15235f=_0x391bbe[_0x341658(0x204)];}}_0x472f3f[_0x341658(0x1f4)]&&_0x15235f&&console[_0x341658(0x1e6)](_0x341658(0x1de)+_0x15235f);const _0xcb4512=await loadJSONFromOptions(_0x472f3f[_0x341658(0x1d6)],_0x472f3f['ruleFile']),_0x3429d7={'name':_0x3642d6,'description':_0x472f3f[_0x341658(0x1eb)],'rule':_0xcb4512,'kind':_0x472f3f['kind']!==undefined?parseInt(_0x472f3f[_0x341658(0x1e7)],0xa):undefined,'isVisible':_0x472f3f[_0x341658(0x1df)]?![]:undefined,'segmentFolderId':_0x15235f,'countPopulation':_0x472f3f[_0x341658(0x1d8)]?![]:undefined},_0x39abf9=await withSpinner(_0x341658(0x1ef)+_0x3642d6+_0x341658(0x1da),()=>_0x1805c5[_0x341658(0x203)][_0x341658(0x1dd)](_0x503e35,_0x3429d7),{'verbose':_0x472f3f[_0x341658(0x1f4)]}),_0x5c9f2c=_0x39abf9['data'];return console[_0x341658(0x1e6)]('✔\x20Created\x20segment\x20\x27'+_0x5c9f2c[_0x341658(0x1d4)]+'\x27\x20with\x20ID:\x20'+_0x5c9f2c['id']),_0x3d39da!==_0x1492df&&console[_0x341658(0x1e6)](_0x341658(0x1d3)+_0x3d39da),await handleSDKOutput([_0x5c9f2c],_0x472f3f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x201fa7=a29_0x57a6;function a29_0x57a6(_0xa3821f,_0x4cd1f5){_0xa3821f=_0xa3821f-0x68;const _0x4e402e=a29_0x4e40();let _0x57a6e0=_0x4e402e[_0xa3821f];return _0x57a6e0;}function a29_0x4e40(){const _0x43849f=['11dvrZfg','2FqhfhJ','294EhBQNV','609864giNEVm','14525eXQXfo','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','List\x20available\x20fields\x20for\x20segmentation','64DYnQuc','\x20field','description','96gSnbkD','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','331513MuMCMz','execute','517710UcqLfm','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment','name','data','error','Site:\x20','json','length','95643nFXbNY','1826460ZnqRSM','listFields','parentSegment','segment:fields','240492QeHPBa','site','143IfNGzy','jsonl'];a29_0x4e40=function(){return _0x43849f;};return a29_0x4e40();}(function(_0xa620f8,_0x12705a){const _0x4c4973=a29_0x57a6,_0x2a7c9a=_0xa620f8();while(!![]){try{const _0x1f3474=-parseInt(_0x4c4973(0x6d))/0x1*(parseInt(_0x4c4973(0x68))/0x2)+-parseInt(_0x4c4973(0x84))/0x3*(parseInt(_0x4c4973(0x73))/0x4)+-parseInt(_0x4c4973(0x70))/0x5*(parseInt(_0x4c4973(0x6e))/0x6)+parseInt(_0x4c4973(0x78))/0x7*(parseInt(_0x4c4973(0x76))/0x8)+parseInt(_0x4c4973(0x85))/0x9+-parseInt(_0x4c4973(0x7a))/0xa*(parseInt(_0x4c4973(0x6c))/0xb)+-parseInt(_0x4c4973(0x6f))/0xc*(-parseInt(_0x4c4973(0x6a))/0xd);if(_0x1f3474===_0x12705a)break;else _0x2a7c9a['push'](_0x2a7c9a['shift']());}catch(_0x31062a){_0x2a7c9a['push'](_0x2a7c9a['shift']());}}}(a29_0x4e40,0x5e232));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_0x201fa7(0x7e)]=a29_0x201fa7(0x88);[a29_0x201fa7(0x75)]=a29_0x201fa7(0x72);async[a29_0x201fa7(0x79)](_0x539a4e){const _0x119eb0=a29_0x201fa7,{options:_0x5d68f3,args:_0xe8bdcd,tdx:_0xc5e078}=_0x539a4e,_0x104ad2=_0xe8bdcd[0x0]||_0x5d68f3[_0x119eb0(0x87)];if(!_0x104ad2)return console[_0x119eb0(0x80)](_0x119eb0(0x7c)),console['error'](_0x119eb0(0x71)),console[_0x119eb0(0x80)](_0x119eb0(0x77)),0x1;_0x5d68f3['verbose']&&(console[_0x119eb0(0x80)](_0x119eb0(0x81)+_0x5d68f3[_0x119eb0(0x69)]),console[_0x119eb0(0x80)]('Parent\x20segment:\x20'+_0x104ad2));const _0x1bd8ed=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x104ad2+_0x119eb0(0x7b),()=>_0xc5e078[_0x119eb0(0x7d)][_0x119eb0(0x86)](_0x104ad2),{'verbose':_0x5d68f3['verbose']}),_0x24cc4b=_0x1bd8ed[_0x119eb0(0x7f)];console['error']('✔\x20Found\x20'+_0x24cc4b[_0x119eb0(0x83)]+_0x119eb0(0x74)+(_0x24cc4b['length']!==0x1?'s':''));if(_0x5d68f3[_0x119eb0(0x82)]||_0x5d68f3[_0x119eb0(0x6b)])return await handleSDKOutput(_0x24cc4b,_0x5d68f3),0x0;return displayFieldsHumanReadable(_0x24cc4b,_0x104ad2),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x180124=a30_0x3f67;(function(_0x5586fa,_0x46b943){const _0x3cc5d5=a30_0x3f67,_0x4b9913=_0x5586fa();while(!![]){try{const _0x2b0967=-parseInt(_0x3cc5d5(0x128))/0x1*(-parseInt(_0x3cc5d5(0x118))/0x2)+-parseInt(_0x3cc5d5(0x12c))/0x3*(-parseInt(_0x3cc5d5(0x126))/0x4)+parseInt(_0x3cc5d5(0x114))/0x5*(-parseInt(_0x3cc5d5(0x111))/0x6)+-parseInt(_0x3cc5d5(0xf5))/0x7*(-parseInt(_0x3cc5d5(0xf9))/0x8)+-parseInt(_0x3cc5d5(0x122))/0x9+-parseInt(_0x3cc5d5(0x132))/0xa*(parseInt(_0x3cc5d5(0x129))/0xb)+-parseInt(_0x3cc5d5(0x10d))/0xc*(-parseInt(_0x3cc5d5(0x139))/0xd);if(_0x2b0967===_0x46b943)break;else _0x4b9913['push'](_0x4b9913['shift']());}catch(_0x40ec2b){_0x4b9913['push'](_0x4b9913['shift']());}}}(a30_0x1060,0xc8b89));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a30_0x3f67(_0xeac0b5,_0x920cc8){_0xeac0b5=_0xeac0b5-0xee;const _0x106064=a30_0x1060();let _0x3f6774=_0x106064[_0xeac0b5];return _0x3f6774;}function a30_0x1060(){const _0xe802bc=['3XjbBSk','file','session','Target\x20resource:\x20','\x20\x20Target:\x20','targetDir','14344990FmUgQM','-\x20no\x20files\x20written','\x0aError:','✔\x20Pulled\x20','yes','\x20segments','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','13vwcWLr','activations','setPhase','hasChanges','yellow','repeat','name','pullSegments','dryRun','length','\x20\x20🗺️\x20\x20','\x20journeys','parent_segment','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journeys','4508wGNJAX','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','diff','verbose','17624aBdCmX','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','helpText','✔\x20All\x20files\x20are\x20up\x20to\x20date','journeyVersions','absolutePath','dim','\x20files\x20to\x20','green','\x20changed\x20files','Write\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20activations','data','\x20=\x20','site','Pulling\x20segments\x20from\x20\x27','error','resourceName','counts','6946320sbDvPm','segments','\x20\x20🎯\x20','relativePath','6YWIRwD','red','\x0aChanges\x20to\x20\x27','351705czvsUW','\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','utf-8','813092blJVjE','dirname','isNew','Site:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','description','files','execute','✔\x20Context\x20set:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','4134654EOyoGP','\x20with\x20','cyan','parentName','1529044QCHEGE','Aborted.','1aXJNEK','11JwmRwh','Parent\x20segment:\x20','segment:pull'];a30_0x1060=function(){return _0xe802bc;};return a30_0x1060();}import{saveSessionContext}from'../core/session.js';import a30_0x281f84 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x32a619 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x180124(0x13f)]=a30_0x180124(0x12b);[a30_0x180124(0x11d)]=a30_0x180124(0x138);async[a30_0x180124(0x11f)](_0x1bbc34){const _0x3aebf0=a30_0x180124,{options:_0x4d1cd4,args:_0x1e6893,tdx:_0x260117}=_0x1bbc34,_0xd87e1f=_0x4d1cd4,_0x1c1aef=await resolveTarget({'arg':_0x1e6893[0x0],'contextParent':_0x4d1cd4['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x1c1aef))return _0x1c1aef['errorCode']==='no_parent'?(console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x13d)](_0x3aebf0(0x121))),console[_0x3aebf0(0x10a)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error'](_0x3aebf0(0x104)),console[_0x3aebf0(0x10a)](_0x3aebf0(0x115))):(console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x112)]('Error:\x20'+_0x1c1aef['message']+'\x0a')),_0x1c1aef[_0x3aebf0(0xfb)]&&console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x124)](_0x1c1aef['helpText']))),0x1;const _0x395422=_0x1c1aef[_0x3aebf0(0x125)],_0xd9932a=_0x1c1aef['targetDir'],_0x2f0614=_0x1c1aef['type']===_0x3aebf0(0x12d)?_0x1c1aef[_0x3aebf0(0x10b)]:undefined;_0xd87e1f['verbose']&&(console['error'](_0x3aebf0(0x11b)+_0xd87e1f[_0x3aebf0(0x108)]),console['error'](_0x3aebf0(0x12a)+_0x395422),_0x2f0614&&console[_0x3aebf0(0x10a)](_0x3aebf0(0x12f)+_0x2f0614));const _0x330eef=await withProgressSpinner(_0x3aebf0(0x109)+_0x395422+'\x27...',_0x3d0525=>_0x260117['segment'][_0x3aebf0(0x140)](_0x395422,{'targetDir':_0xd9932a,'targetResourceName':_0x2f0614,'verbose':_0xd87e1f[_0x3aebf0(0xf8)],'progress':{'update':_0x54bb67=>{const _0x524f77=_0x3aebf0;_0x3d0525[_0x524f77(0x13b)](_0x54bb67),_0xd87e1f[_0x524f77(0xf8)]&&console[_0x524f77(0x10a)]('\x20\x20'+_0x54bb67);}}}),{'verbose':_0xd87e1f[_0x3aebf0(0xf8)]}),_0x4950bd=_0x330eef[_0x3aebf0(0x106)];if(_0x4950bd['counts'][_0x3aebf0(0x10e)]===0x0&&_0x4950bd[_0x3aebf0(0x10c)][_0x3aebf0(0xf4)]===0x0)return console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x13d)](_0x3aebf0(0xf6)+_0x4950bd[_0x3aebf0(0x125)]+'\x27')),0x0;const _0x441352=_0x4950bd[_0x3aebf0(0x11e)]['filter'](_0x5553e2=>_0x5553e2[_0x3aebf0(0x11a)]),_0x878d3f=_0x4950bd['files'][_0x3aebf0(0x116)](_0x4ab6e3=>!_0x4ab6e3['isNew']&&_0x4ab6e3[_0x3aebf0(0x13c)]),_0x5a9ce7=_0x4950bd[_0x3aebf0(0x11e)]['filter'](_0x5aa8e8=>!_0x5aa8e8[_0x3aebf0(0x11a)]&&!_0x5aa8e8['hasChanges']);console[_0x3aebf0(0x10a)]('\x0aPull\x20summary\x20for\x20\x27'+_0x4950bd['parentName']+'\x27:'),console['error'](_0x3aebf0(0x10f)+a30_0x281f84[_0x3aebf0(0x124)](_0x4950bd[_0x3aebf0(0x10c)][_0x3aebf0(0x10e)]+_0x3aebf0(0x137))+_0x3aebf0(0x123)+a30_0x281f84['cyan'](_0x4950bd['counts'][_0x3aebf0(0x13a)]+_0x3aebf0(0x105)));if(_0x4950bd['counts'][_0x3aebf0(0xf4)]>0x0){const _0x4483f2=_0x4950bd[_0x3aebf0(0x10c)][_0x3aebf0(0xfd)]>_0x4950bd['counts'][_0x3aebf0(0xf4)]?'\x20('+_0x4950bd['counts'][_0x3aebf0(0xfd)]+'\x20versions)':'';console[_0x3aebf0(0x10a)](_0x3aebf0(0xf0)+a30_0x281f84[_0x3aebf0(0x124)](_0x4950bd[_0x3aebf0(0x10c)][_0x3aebf0(0xf4)]+_0x3aebf0(0xf1))+a30_0x281f84[_0x3aebf0(0xff)](_0x4483f2));}console['error']('\x20\x20'+a30_0x281f84[_0x3aebf0(0x101)]('+\x20'+_0x441352[_0x3aebf0(0xef)]+'\x20new\x20files')),console[_0x3aebf0(0x10a)]('\x20\x20'+a30_0x281f84[_0x3aebf0(0x13d)]('~\x20'+_0x878d3f[_0x3aebf0(0xef)]+_0x3aebf0(0x102))),console[_0x3aebf0(0x10a)]('\x20\x20'+a30_0x281f84[_0x3aebf0(0xff)]('=\x20'+_0x5a9ce7['length']+'\x20unchanged\x20files')),console[_0x3aebf0(0x10a)](_0x3aebf0(0x130)+a30_0x281f84[_0x3aebf0(0x124)](_0x4950bd['targetDir'])+'\x0a');if(_0x878d3f[_0x3aebf0(0xef)]>0x0)for(const _0x566537 of _0x878d3f){console['error'](_0x3aebf0(0x113)+_0x566537[_0x3aebf0(0x110)]+'\x27:'),console[_0x3aebf0(0x10a)]('─'[_0x3aebf0(0x13e)](0x3c)),console[_0x3aebf0(0x10a)](_0x566537[_0x3aebf0(0xf7)]),console[_0x3aebf0(0x10a)]('─'['repeat'](0x3c));}if(_0xd87e1f[_0x3aebf0(0xee)])return console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x13d)](_0x3aebf0(0xf3))),0x0;if(_0x441352[_0x3aebf0(0xef)]===0x0&&_0x878d3f[_0x3aebf0(0xef)]===0x0)return console['error'](a30_0x281f84['green'](_0x3aebf0(0xfc))),saveSessionContext({'parent_segment':_0x4950bd[_0x3aebf0(0x125)]},_0xd87e1f[_0x3aebf0(0x12e)]),console['error'](a30_0x281f84[_0x3aebf0(0x101)]('✔\x20Context\x20set:\x20'+a30_0x281f84[_0x3aebf0(0xff)](_0x3aebf0(0xf2))+'\x20=\x20'+a30_0x281f84[_0x3aebf0(0x124)](_0x4950bd['parentName']))),0x0;if(!_0xd87e1f[_0x3aebf0(0x136)]){if(!isInteractive())return console['error'](a30_0x281f84[_0x3aebf0(0x112)](_0x3aebf0(0x134)),_0x3aebf0(0x11c)),console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0xff)](_0x3aebf0(0xfa))),0x1;const _0xcf49f8=await confirmKey(_0x3aebf0(0x103)+(_0x441352[_0x3aebf0(0xef)]+_0x878d3f[_0x3aebf0(0xef)])+'\x20files?');if(!_0xcf49f8)return console['error'](a30_0x281f84[_0x3aebf0(0x13d)](_0x3aebf0(0x127)),_0x3aebf0(0x133)),0x1;}for(const _0x1cb3d6 of _0x4950bd[_0x3aebf0(0x11e)]){if(_0x1cb3d6[_0x3aebf0(0x11a)]||_0x1cb3d6[_0x3aebf0(0x13c)]){const _0x954c07=a30_0x32a619[_0x3aebf0(0x119)](_0x1cb3d6[_0x3aebf0(0xfe)]);!existsSync(_0x954c07)&&mkdirSync(_0x954c07,{'recursive':!![]}),writeFileSync(_0x1cb3d6['absolutePath'],_0x1cb3d6['content'],_0x3aebf0(0x117));}}return console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x101)](_0x3aebf0(0x135)+(_0x441352['length']+_0x878d3f[_0x3aebf0(0xef)])+_0x3aebf0(0x100)+_0x4950bd[_0x3aebf0(0x131)])),saveSessionContext({'parent_segment':_0x4950bd['parentName']},_0xd87e1f[_0x3aebf0(0x12e)]),console[_0x3aebf0(0x10a)](a30_0x281f84[_0x3aebf0(0x101)](_0x3aebf0(0x120)+a30_0x281f84['dim']('parent_segment')+_0x3aebf0(0x107)+a30_0x281f84[_0x3aebf0(0x124)](_0x4950bd[_0x3aebf0(0x125)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x897ea5=a31_0x489c;(function(_0x340a84,_0x39deda){const _0x26e03b=a31_0x489c,_0x5e44af=_0x340a84();while(!![]){try{const _0xcba1ec=parseInt(_0x26e03b(0x143))/0x1*(-parseInt(_0x26e03b(0x156))/0x2)+-parseInt(_0x26e03b(0x17a))/0x3*(-parseInt(_0x26e03b(0x13a))/0x4)+parseInt(_0x26e03b(0x125))/0x5+-parseInt(_0x26e03b(0x175))/0x6+parseInt(_0x26e03b(0x1a8))/0x7+parseInt(_0x26e03b(0x120))/0x8+-parseInt(_0x26e03b(0x168))/0x9;if(_0xcba1ec===_0x39deda)break;else _0x5e44af['push'](_0x5e44af['shift']());}catch(_0x224223){_0x5e44af['push'](_0x5e44af['shift']());}}}(a31_0x9554,0x576b4));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a31_0x9554(){const _0x15b5f1=['journeysOnly','getOutputSchemaWithCache','blue','length','316581adTcwz','get','journeyId','push','all','execute','parentName','file','Fetching\x20existing\x20segments...','state','journey','dryRun','Error:\x20','Delete\x20journey:','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','.yml','description','folderPath','2yTQsVO','Push\x20','getJourney','segment:push','Source\x20directory:\x20','\x20changed','site','parentSegment','verbose','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','new','folderId','updated','parent_name','\x20\x20🗺️\x20\x20Journeys:','endsWith','results','yes','1676061rZJnpO','toUpdate','nameToType','map','targetDir','join','paused','resolveParentId','connection','\x20\x20Activations:\x20','user','folders','Changes\x20to:','1160616JKHVYx','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','New\x20segment:','📁\x20','yellow','29655JOWWEg','Parent\x20segment:\x20','Changes\x20to\x20journey:','\x20\x20\x20\x20','cwd','nameToId','Site:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','/app/ps/','\x0aValidation\x20failed:','changed','Error:\x20Directory\x20not\x20found:\x20','Fetching\x20existing\x20journeys...','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20activations]','journeys','message','existingJourney','data','\x20to\x20create','\x20to\x20delete','Fetching\x20parent\x20segment\x20details...','getParent','\x20folders\x20to\x20create','\x20\x20Segments:\x20','.yaml','errorCode','parentFolder','segmentFolderId','createdAt','Fetching\x20existing\x20folders...','/j/da/je','New\x20journey:','created','scopedFolderPath','error','relationships','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','/e/','unchanged','yamlConfig','createdSegmentIds','\x20unchanged','\x20deleted','segment\x20or\x20journey','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','2265641XZTExz','activations','list','segments','no_parent','toCreate','isNew','segment','helpText','\x20new','add','\x20\x20Activations:','\x20created','\x20\x20Journeys:\x20','dim','attributes','green','cyan','\x20updated','1081136gfZPqX','\x0a✔\x20Push\x20complete','listActivations','diff','red','1593645EMbStr','\x0aError:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','toDelete','then','Resolving\x20parent\x20segment\x20\x27','\x20to\x20update','toString','listSegments','listJourneysWithDetailsFromParentSegment','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','name','type','repeat','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','audienceId','set','journeyBundleName','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','idToName','Aborted.','112ukZZQY','Error\x20parsing\x20YAML:\x20','\x0aPush\x20summary\x20for\x20\x27','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Fetching\x20users\x20for\x20email\x20resolution...'];a31_0x9554=function(){return _0x15b5f1;};return a31_0x9554();}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x53c583 from'chalk';function a31_0x489c(_0x126206,_0x4f8782){_0x126206=_0x126206-0x118;const _0x95549d=a31_0x9554();let _0x489c0f=_0x95549d[_0x126206];return _0x489c0f;}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']=a31_0x897ea5(0x159);[a31_0x897ea5(0x154)]=a31_0x897ea5(0x151);async[a31_0x897ea5(0x148)](_0x5eb0dd){const _0x38bf18=a31_0x897ea5,{options:_0xc1e7dc,args:_0x3f9ed2,tdx:_0x314a09}=_0x5eb0dd,_0x20f2e3=_0xc1e7dc,_0xd63e4b=await resolveTarget({'arg':_0x3f9ed2[0x0],'contextParent':_0xc1e7dc[_0x38bf18(0x15d)],'cwd':process[_0x38bf18(0x17e)]()});if(!isSuccessfulResolution(_0xd63e4b))return _0xd63e4b[_0x38bf18(0x194)]===_0x38bf18(0x1ac)?(console['error'](a31_0x53c583['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x38bf18(0x19d)](_0x38bf18(0x12f)),console[_0x38bf18(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x38bf18(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x14f)+_0xd63e4b[_0x38bf18(0x18a)]+'\x0a')),_0xd63e4b[_0x38bf18(0x1b0)]&&console['error'](a31_0x53c583[_0x38bf18(0x11e)](_0xd63e4b['helpText']))),0x1;if(_0xd63e4b[_0x38bf18(0x131)]===_0x38bf18(0x163))return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x185)+_0xd63e4b[_0x38bf18(0x16c)]+'\x0a')),console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x181))),0x1;const _0x165886=_0xd63e4b[_0x38bf18(0x149)],_0x1bf35a=_0xd63e4b['targetDir'],_0x46ffff=_0xd63e4b[_0x38bf18(0x131)]===_0x38bf18(0x14a)?_0xd63e4b['filePath']:undefined,_0x7f3576=getScopedDetails(_0xd63e4b),_0x907ea5=_0x7f3576?.['isScoped']??![],_0x59d60b=_0x7f3576?.[_0x38bf18(0x19c)]??'';if(!existsSync(_0x1bf35a))return console['error'](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x185)+_0x1bf35a+'\x0a')),console['error'](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x181))),0x1;_0x20f2e3['verbose']&&(console[_0x38bf18(0x19d)](_0x38bf18(0x180)+_0x20f2e3['site']),console[_0x38bf18(0x19d)](_0x38bf18(0x17b)+_0x165886),console[_0x38bf18(0x19d)](_0x38bf18(0x15a)+_0x1bf35a),_0x907ea5&&console[_0x38bf18(0x19d)]('Scoped\x20to\x20folder:\x20'+_0x59d60b));const _0x26ae95=await withSpinner(_0x38bf18(0x12a)+_0x165886+'\x27...',()=>_0x314a09['segment'][_0x38bf18(0x16f)](_0x165886),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),_0x32cc51=_0x26ae95[_0x38bf18(0x18c)],[_0x481507,_0x57b065,_0x5a242d,_0x55b271,_0x5ec34c]=await Promise['all']([withSpinner(_0x38bf18(0x18f),()=>_0x314a09['segment'][_0x38bf18(0x190)](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x14b),()=>_0x314a09[_0x38bf18(0x1af)][_0x38bf18(0x12d)](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x198),()=>_0x314a09[_0x38bf18(0x1af)]['listFolders'](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x186),()=>_0x314a09[_0x38bf18(0x14d)][_0x38bf18(0x12e)](_0x32cc51,{'includeAllVersions':!![]}),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x13e),()=>_0x314a09[_0x38bf18(0x172)]['buildUserMaps'](),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]})[_0x38bf18(0x129)](_0x58d1fd=>_0x58d1fd['data'])]),_0x357f97=_0x481507[_0x38bf18(0x18c)],_0x410028=extractRootFolderId(_0x357f97),_0x208e06=_0x57b065[_0x38bf18(0x18c)],_0x336812=_0x5a242d['data'],{journeys:_0x1701e4,activationStepsById:_0x35b402}=_0x55b271['data'],_0x4b93cc=new Map(_0x1701e4[_0x38bf18(0x16b)](_0xc53597=>[_0xc53597['id'],_0xc53597])),_0x1c5d4e=_0x1701e4[_0x38bf18(0x16b)](_0x363558=>({'id':_0x363558['id'],'name':_0x363558[_0x38bf18(0x11c)]['name'],'journeyBundleName':_0x363558['attributes'][_0x38bf18(0x136)]||'','journeyBundleId':_0x363558[_0x38bf18(0x11c)]['journeyBundleId']||'','versionNumber':_0x363558[_0x38bf18(0x11c)]['versionNumber'],'description':_0x363558['attributes'][_0x38bf18(0x154)],'state':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x14c)],'paused':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x16e)],'audienceId':_0x363558['attributes'][_0x38bf18(0x134)],'folderId':_0x363558[_0x38bf18(0x19e)]?.[_0x38bf18(0x195)]?.[_0x38bf18(0x18c)]?.['id'],'createdAt':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x197)],'updatedAt':_0x363558[_0x38bf18(0x11c)]['updatedAt']})),{emailToId:_0x52a8b2,idToEmail:_0x36260f}=_0x5ec34c,_0x13d0de=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x56773c=_0x38bf18,_0x3509b3=await _0x314a09[_0x56773c(0x170)][_0x56773c(0x1aa)]();return buildConnectionMaps(_0x3509b3);},{'verbose':_0x20f2e3['verbose']})[_0x38bf18(0x129)](_0x1561e4=>_0x1561e4[_0x38bf18(0x18c)]),_0x3bd800=_0x13d0de[_0x38bf18(0x17f)],_0x3fe795=_0x13d0de[_0x38bf18(0x138)],_0x626af1=_0x13d0de[_0x38bf18(0x16a)],_0x566509={'emailToIdMap':_0x52a8b2,'connectionNameToIdMap':_0x3bd800,'connectionNameToTypeMap':_0x626af1,'getSchema':_0x5b9139=>_0x314a09[_0x38bf18(0x170)][_0x38bf18(0x140)](_0x5b9139)};let {pathToId:_0x357a71,idToPath:_0x26000c}=buildFolderMaps(_0x336812);const _0x7dc6c6=buildSegmentLookupMap(_0x208e06,_0x26000c),_0x4b35b7=buildSegmentNameToIdMap(_0x208e06),_0xff781f=buildJourneyBundleLookupMap(_0x1c5d4e,_0x26000c);let _0x41438c;if(_0x46ffff){if(!_0x46ffff[_0x38bf18(0x165)](_0x38bf18(0x153))&&!_0x46ffff[_0x38bf18(0x165)](_0x38bf18(0x193)))return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x15f)+_0x46ffff+'\x0a')),0x1;_0x41438c=[_0x46ffff];}else _0x41438c=findYamlFiles(_0x1bf35a);if(_0x41438c[_0x38bf18(0x142)]===0x0)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x176)+_0x1bf35a+'\x0a')),console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x19f))),0x1;let _0x290e5c,_0x3f394d;try{const _0x16b06f=parseAndClassifyYamlFiles(_0x41438c,_0x1bf35a,{'skipSegments':_0x20f2e3[_0x38bf18(0x13f)]});_0x290e5c=_0x16b06f['segments'],_0x3f394d=_0x16b06f[_0x38bf18(0x189)];const _0x114c4a=validateParsedFiles(_0x16b06f,_0x1bf35a);if(_0x114c4a[_0x38bf18(0x142)]>0x0)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x183))),console[_0x38bf18(0x19d)](formatValidationErrors(_0x114c4a)),console[_0x38bf18(0x19d)](a31_0x53c583['yellow'](_0x38bf18(0x137))),0x1;}catch(_0x22fafc){return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x13b)+(_0x22fafc instanceof Error?_0x22fafc[_0x38bf18(0x18a)]:_0x22fafc))),0x1;}if(_0x290e5c[_0x38bf18(0x142)]===0x0&&_0x3f394d[_0x38bf18(0x142)]===0x0){const _0x53d01d=_0x20f2e3[_0x38bf18(0x13f)]?_0x38bf18(0x14d):_0x38bf18(0x1a6);return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)]('No\x20'+_0x53d01d+'\x20YAML\x20files\x20found')),0x0;}const _0x869fe2=new Map();_0x208e06[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x208e06,async _0x413bc8=>{const _0x1885c2=a31_0x489c,_0x47fbcd=await _0x314a09['segment'][_0x1885c2(0x122)](_0x32cc51,_0x413bc8['id']);_0x869fe2[_0x1885c2(0x135)](_0x413bc8['id'],_0x47fbcd);});},{'verbose':_0x20f2e3[_0x38bf18(0x15e)]});const {segmentFiles:_0x42117d,foldersToCreate:_0x107d61}=await prepareSegmentFiles(_0x290e5c,{'segmentByFolderAndName':_0x7dc6c6,'activationsBySegmentId':_0x869fe2,'folderPathToId':_0x357a71,'idToEmailMap':_0x36260f,'connectionIdToNameMap':_0x3fe795},_0x566509,_0x907ea5,_0x59d60b),_0x36b0d8=_0x46ffff?[]:findSegmentsToDelete(_0x208e06,_0x290e5c[_0x38bf18(0x16b)](({yamlConfig:_0x5f0533,folderPath:_0x3bbc66})=>({'yamlConfig':_0x5f0533,'folderPath':resolveTDFolderPath(_0x3bbc66,_0x907ea5,_0x59d60b)})),_0x26000c,_0x59d60b,_0x907ea5),{journeyFiles:_0x4d2fc4,foldersToCreate:_0x4f4205}=await withProgressSpinner('Preparing\x20journeys...',async _0xcc5aaa=>prepareJourneyFiles(_0x3f394d,{'fetchJourney':async _0x646871=>_0x314a09[_0x38bf18(0x14d)][_0x38bf18(0x158)](_0x646871[_0x38bf18(0x145)]),'journeyBundlesByFolderAndName':_0xff781f,'folderPathToId':_0x357a71,'idToEmailMap':_0x36260f,'connectionIdToNameMap':_0x3fe795,'existingSegments':_0x208e06,'parentId':_0x32cc51,'deps':_0x314a09,'progress':{'update':_0x3a7e25=>{const _0x4638b0=_0x38bf18;_0xcc5aaa['setPhase'](_0x3a7e25),_0x20f2e3[_0x4638b0(0x15e)]&&console[_0x4638b0(0x19d)]('\x20\x20'+_0x3a7e25);}},'journeyById':_0x4b93cc,'activationStepsById':_0x35b402},_0x907ea5,_0x59d60b),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]})['then'](_0x157fa6=>_0x157fa6[_0x38bf18(0x18c)]);for(const _0x4a63d8 of _0x4f4205){_0x107d61[_0x38bf18(0x1b2)](_0x4a63d8);}const _0x57aade=_0x46ffff?[]:findJourneysToDelete(_0x1c5d4e,_0x3f394d['map'](({yamlConfig:_0x1c8565,folderPath:_0x5352a4})=>({'yamlConfig':_0x1c8565,'folderPath':resolveTDFolderPath(_0x5352a4,_0x907ea5,_0x59d60b)})),_0x26000c,_0x59d60b,_0x907ea5),_0x1ec876=calculatePushStats(_0x42117d,_0x4d2fc4,_0x107d61,_0x36b0d8,_0x57aade,!!_0x20f2e3['delete'],!!_0x20f2e3['journeysOnly']),_0x1fa691=_0x1ec876[_0x38bf18(0x1ab)]['new'],_0x3c5d82=_0x1ec876[_0x38bf18(0x1ab)][_0x38bf18(0x184)],_0x30b83d=_0x1ec876[_0x38bf18(0x1ab)]['unchanged'],_0x4db5f2=_0x1ec876[_0x38bf18(0x1ab)][_0x38bf18(0x128)],_0x184cdf=_0x1ec876[_0x38bf18(0x173)][_0x38bf18(0x1ad)],_0x55822a=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x160)],_0xba32ef=_0x1ec876['journeys'][_0x38bf18(0x184)],_0x536778=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x1a1)],_0x1f50ee=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x128)],_0x57196f=_0x1ec876[_0x38bf18(0x1a9)][_0x38bf18(0x147)],_0x96089f=_0x1ec876['activations']['toCreate'],_0x290e7d=_0x1ec876[_0x38bf18(0x1a9)][_0x38bf18(0x169)],_0x316d59=_0x1ec876[_0x38bf18(0x1a9)]['toDelete'];console[_0x38bf18(0x19d)](_0x38bf18(0x13c)+_0x165886+'\x27:');_0x184cdf[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x141)](_0x38bf18(0x178)+_0x184cdf[_0x38bf18(0x142)]+_0x38bf18(0x191)));if(!_0x20f2e3[_0x38bf18(0x13f)]){console['error']('\x20\x20📊\x20Segments:'),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x1fa691[_0x38bf18(0x142)]+'\x20new')),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x179)]('~\x20'+_0x3c5d82['length']+_0x38bf18(0x15b)));if(_0x4db5f2[_0x38bf18(0x142)]>0x0)console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583['red']('-\x20'+_0x4db5f2[_0x38bf18(0x142)]+_0x38bf18(0x18e)));else _0x36b0d8[_0x38bf18(0x142)]>0x0&&!_0x20f2e3['delete']&&console[_0x38bf18(0x19d)]('\x20\x20\x20\x20'+a31_0x53c583[_0x38bf18(0x11b)](_0x36b0d8[_0x38bf18(0x142)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)]('=\x20'+_0x30b83d[_0x38bf18(0x142)]+_0x38bf18(0x1a4)));}if(_0x4d2fc4[_0x38bf18(0x142)]>0x0||_0x57aade[_0x38bf18(0x142)]>0x0){console[_0x38bf18(0x19d)](_0x38bf18(0x164)),console['error'](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x55822a[_0x38bf18(0x142)]+_0x38bf18(0x1b1))),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583['yellow']('~\x20'+_0xba32ef[_0x38bf18(0x142)]+_0x38bf18(0x15b)));if(_0x1f50ee[_0x38bf18(0x142)]>0x0)console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x124)]('-\x20'+_0x1f50ee[_0x38bf18(0x142)]+_0x38bf18(0x18e)));else _0x57aade[_0x38bf18(0x142)]>0x0&&!_0x20f2e3['delete']&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)](_0x57aade['length']+_0x38bf18(0x133)));console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)]('=\x20'+_0x536778['length']+'\x20unchanged'));}_0x57196f['length']>0x0&&!_0x20f2e3[_0x38bf18(0x13f)]&&(console[_0x38bf18(0x19d)](''),console[_0x38bf18(0x19d)](_0x38bf18(0x118)),_0x96089f[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x96089f['length']+_0x38bf18(0x18d))),_0x290e7d[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)]('\x20\x20\x20\x20'+a31_0x53c583[_0x38bf18(0x179)]('~\x20'+_0x290e7d[_0x38bf18(0x142)]+_0x38bf18(0x12b))),_0x316d59['length']>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x124)]('-\x20'+_0x316d59[_0x38bf18(0x142)]+'\x20to\x20delete')));console['error']('\x20\x20Source:\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x1bf35a)+'\x0a');if(_0x184cdf['length']>0x0){console['error']('Folders\x20to\x20create:');for(const _0x17adcf of _0x184cdf){console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x141)]('+')+'\x20'+_0x17adcf);}console[_0x38bf18(0x19d)]('');}if(_0x1fa691[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x53de7a of _0x1fa691){const _0x4bac45=_0x53de7a[_0x38bf18(0x155)]?_0x53de7a[_0x38bf18(0x155)]+'/'+_0x53de7a[_0x38bf18(0x1a2)][_0x38bf18(0x130)]:_0x53de7a[_0x38bf18(0x1a2)][_0x38bf18(0x130)],_0x381971=_0x53de7a['yamlConfig'][_0x38bf18(0x1a9)]?.[_0x38bf18(0x142)]||0x0,_0x5f1fef=_0x381971>0x0?a31_0x53c583[_0x38bf18(0x11b)]('\x20['+_0x381971+_0x38bf18(0x188)):'';console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x177))+'\x20'+_0x4bac45+_0x5f1fef),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c)),_0x53de7a['diff']&&console[_0x38bf18(0x19d)](_0x53de7a[_0x38bf18(0x123)]),console['error']('─'[_0x38bf18(0x132)](0x3c));}if(_0x4db5f2[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x42ebd0 of _0x4db5f2){const _0x26a837=_0x42ebd0[_0x38bf18(0x196)]?_0x26000c[_0x38bf18(0x144)](_0x42ebd0[_0x38bf18(0x196)][_0x38bf18(0x12c)]())||'':'',_0x5389bf=_0x26a837?_0x26a837+'/'+_0x42ebd0[_0x38bf18(0x130)]:_0x42ebd0['name'],_0x139409=_0x869fe2['get'](_0x42ebd0['id'])||[],_0x270385=_0x139409[_0x38bf18(0x142)]>0x0?a31_0x53c583[_0x38bf18(0x11b)]('\x20['+_0x139409[_0x38bf18(0x142)]+_0x38bf18(0x188)):'';console['error']('\x0a'+a31_0x53c583[_0x38bf18(0x124)]('Delete\x20segment:')+'\x20'+_0x5389bf+_0x270385),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c));const _0x3ea990=segmentWithActivationsToYaml(_0x42ebd0,_0x139409,undefined,_0x36260f,_0x3fe795),_0x3156da=segmentToYamlString(_0x3ea990),_0x22479e=generateDiff(_0x3156da,'');console[_0x38bf18(0x19d)](formatDiffWithColors(_0x22479e)),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c));}const _0x5b1538=_0x42117d['filter'](_0x54ce54=>!_0x54ce54[_0x38bf18(0x1ae)]&&_0x54ce54['diff']);if(_0x5b1538[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x32e153 of _0x5b1538){const _0x4f27d9=_0x32e153[_0x38bf18(0x155)]?_0x32e153['folderPath']+'/'+_0x32e153[_0x38bf18(0x1a2)]['name']:_0x32e153[_0x38bf18(0x1a2)]['name'];console['error']('\x0a'+a31_0x53c583['yellow'](_0x38bf18(0x174))+'\x20'+_0x4f27d9),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c)),console['error'](_0x32e153[_0x38bf18(0x123)]),console['error']('─'['repeat'](0x3c));}if(_0x55822a[_0x38bf18(0x142)]>0x0)for(const _0x468169 of _0x55822a){const _0x30e197=_0x468169['folderPath']?_0x468169[_0x38bf18(0x155)]+'/'+_0x468169[_0x38bf18(0x1a2)]['name']:_0x468169['yamlConfig'][_0x38bf18(0x130)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x19a))+'\x20'+_0x30e197),console['error']('─'[_0x38bf18(0x132)](0x3c)),_0x468169[_0x38bf18(0x123)]&&console[_0x38bf18(0x19d)](_0x468169['diff']),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c));}const _0xced3b3=_0x4d2fc4['filter'](_0xf178f8=>!_0xf178f8[_0x38bf18(0x1ae)]&&_0xf178f8['diff']);if(_0xced3b3['length']>0x0)for(const _0xce2fd1 of _0xced3b3){const _0x14bac4=_0xce2fd1[_0x38bf18(0x155)]?_0xce2fd1[_0x38bf18(0x155)]+'/'+_0xce2fd1[_0x38bf18(0x1a2)]['name']:_0xce2fd1[_0x38bf18(0x1a2)][_0x38bf18(0x130)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x17c))+'\x20'+_0x14bac4),console['error']('─'['repeat'](0x3c)),console['error'](_0xce2fd1[_0x38bf18(0x123)]),console[_0x38bf18(0x19d)]('─'['repeat'](0x3c));}if(_0x1f50ee[_0x38bf18(0x142)]>0x0)for(const _0x1fd5ff of _0x1f50ee){const _0x3eac3e=_0x1fd5ff[_0x38bf18(0x161)]?_0x26000c['get'](_0x1fd5ff[_0x38bf18(0x161)])||'':'',_0xcfa7fe=_0x3eac3e?_0x3eac3e+'/'+_0x1fd5ff[_0x38bf18(0x136)]:_0x1fd5ff[_0x38bf18(0x136)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x150))+'\x20'+_0xcfa7fe),console[_0x38bf18(0x19d)]('─'[_0x38bf18(0x132)](0x3c)),console['error'](a31_0x53c583[_0x38bf18(0x124)]('(Journey\x20will\x20be\x20deleted)')),console[_0x38bf18(0x19d)]('─'['repeat'](0x3c));}if(_0x20f2e3[_0x38bf18(0x14e)])return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x1a7))),0x0;const _0x3b607e=_0x20f2e3[_0x38bf18(0x13f)]?![]:_0x1fa691[_0x38bf18(0x142)]>0x0||_0x3c5d82[_0x38bf18(0x142)]>0x0||_0x4db5f2[_0x38bf18(0x142)]>0x0,_0x1262d3=_0x55822a['length']>0x0||_0xba32ef[_0x38bf18(0x142)]>0x0||_0x1f50ee['length']>0x0,_0x38c3cc=_0x20f2e3[_0x38bf18(0x13f)]?![]:_0x57196f['length']>0x0,_0x5e5b49=_0x184cdf['length']>0x0;if(!_0x3b607e&&!_0x1262d3&&!_0x38c3cc&&!_0x5e5b49){const _0x488647=_0x20f2e3[_0x38bf18(0x13f)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x38bf18(0x13d);console['error'](a31_0x53c583[_0x38bf18(0x11d)](_0x488647));if(_0x46ffff&&_0x536778['length']===0x1){const _0x5d7aa5=_0x536778[0x0];if(_0x5d7aa5[_0x38bf18(0x18b)]?.['id']){const _0x2e52e5=getConsoleNextUrl(_0x20f2e3[_0x38bf18(0x15c)],_0x38bf18(0x182)+_0x32cc51+_0x38bf18(0x1a0)+_0x5d7aa5[_0x38bf18(0x18b)]['id']+_0x38bf18(0x199));console['error']('\x20\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x2e52e5));}}return 0x0;}const _0x21c8d2=_0x20f2e3[_0x38bf18(0x13f)]?_0x55822a[_0x38bf18(0x142)]+_0xba32ef[_0x38bf18(0x142)]+_0x1f50ee[_0x38bf18(0x142)]+_0x184cdf['length']:_0x1fa691[_0x38bf18(0x142)]+_0x3c5d82[_0x38bf18(0x142)]+_0x4db5f2[_0x38bf18(0x142)]+_0x55822a[_0x38bf18(0x142)]+_0xba32ef[_0x38bf18(0x142)]+_0x1f50ee['length']+_0x184cdf[_0x38bf18(0x142)]+_0x57196f[_0x38bf18(0x142)];if(!_0x20f2e3[_0x38bf18(0x167)]&&_0x21c8d2>0x0){if(!isInteractive())return console['error'](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x126)),_0x38bf18(0x127)),console[_0x38bf18(0x19d)](a31_0x53c583['dim'](_0x38bf18(0x187))),0x1;const _0x474c60=await confirmKey(_0x38bf18(0x157)+_0x21c8d2+'\x20changes?');if(!_0x474c60)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x139))),0x1;}const _0x568a32={'withProgress':async(_0x44c09f,_0xe453a9)=>{const _0x18764a=_0x38bf18,_0x44aa5f=await withSpinner(_0x44c09f,_0xe453a9,{'verbose':_0x20f2e3[_0x18764a(0x15e)]});return{'data':_0x44aa5f['data']};},'logInfo':_0x2374fb=>console['error'](a31_0x53c583[_0x38bf18(0x141)]('✔\x20'+_0x2374fb)),'logSuccess':_0x192e2a=>console['error'](a31_0x53c583[_0x38bf18(0x11d)]('✔\x20'+_0x192e2a)),'logWarning':_0x60d70c=>console[_0x38bf18(0x19d)](a31_0x53c583['yellow']('⚠\x20'+_0x60d70c)),'logDeleted':_0x3bed5e=>console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)]('✔\x20'+_0x3bed5e))},_0x53ce={'segment':_0x314a09[_0x38bf18(0x1af)],'journey':_0x314a09[_0x38bf18(0x14d)],'user':_0x314a09['user'],'connection':_0x314a09['connection']};_0x184cdf[_0x38bf18(0x142)]>0x0&&(_0x357a71=await executePushFolders(_0x53ce,_0x184cdf,_0x357a71,{'parentId':_0x32cc51},_0x568a32));const _0xafb4a5={'rootFolderId':_0x410028,'folderPathToId':_0x357a71,'folderIdToPath':_0x26000c,'segmentNameToId':_0x4b35b7,'activationsBySegmentId':_0x869fe2,'emailToIdMap':_0x52a8b2,'idToEmailMap':_0x36260f,'connectionNameToIdMap':_0x13d0de[_0x38bf18(0x17f)],'connectionIdToNameMap':_0x13d0de[_0x38bf18(0x138)],'connectionNameToTypeMap':_0x626af1},_0x49ed49=await executePushSegments(_0x53ce,_0x20f2e3[_0x38bf18(0x13f)]?[]:_0x42117d,_0xafb4a5,{'parentId':_0x32cc51},_0x568a32),_0xf21591=_0x49ed49[_0x38bf18(0x19b)],_0x144c97=_0x49ed49[_0x38bf18(0x162)],_0x2dbc56=_0x49ed49[_0x38bf18(0x1a9)][_0x38bf18(0x19b)],_0x36de27=_0x49ed49[_0x38bf18(0x1a9)][_0x38bf18(0x162)],_0x519a6c=_0x49ed49[_0x38bf18(0x1a9)]['deleted'],_0x102e9a=await executePushSegmentDeletions(_0x53ce,_0x20f2e3['journeysOnly']?[]:_0x4db5f2,_0x568a32);let _0x5077cc=0x0,_0x441166=0x0,_0x3a1d1b=0x0;const _0x18f6db=new Map(_0x4b35b7);for(const [_0x9e2bad,_0x539543]of _0x49ed49[_0x38bf18(0x1a3)]){_0x18f6db[_0x38bf18(0x135)](_0x9e2bad,_0x539543);}if(_0x4d2fc4[_0x38bf18(0x142)]>0x0){const _0x344edf={..._0xafb4a5,'segmentNameToId':_0x18f6db,'existingSegments':_0x208e06,'activationContext':_0x566509},_0x2a2a7f=await executePushJourneys(_0x53ce,_0x4d2fc4,_0x344edf,{'parentId':_0x32cc51,'rootFolderId':_0x410028,'verbose':_0x20f2e3[_0x38bf18(0x15e)]},_0x568a32);_0x5077cc=_0x2a2a7f['created'],_0x441166=_0x2a2a7f['updated'];if(_0x46ffff&&_0x2a2a7f[_0x38bf18(0x166)]['length']===0x1){const _0x22cb44=_0x2a2a7f['results'][0x0];if(_0x22cb44[_0x38bf18(0x145)]){const _0x1bffc7=getConsoleNextUrl(_0x20f2e3[_0x38bf18(0x15c)],'/app/ps/'+_0x32cc51+'/e/'+_0x22cb44[_0x38bf18(0x145)]+_0x38bf18(0x199));console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x1bffc7));}}}for(const _0x1ce524 of _0x1f50ee){console['error'](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x152)+_0x1ce524[_0x38bf18(0x136)])),_0x3a1d1b++;}const _0x48176d=[];if(_0xf21591>0x0)_0x48176d['push'](_0xf21591+_0x38bf18(0x119));if(_0x144c97>0x0)_0x48176d[_0x38bf18(0x146)](_0x144c97+_0x38bf18(0x11f));if(_0x102e9a>0x0)_0x48176d[_0x38bf18(0x146)](_0x102e9a+_0x38bf18(0x1a5));const _0x3eab86=[];if(_0x5077cc>0x0)_0x3eab86['push'](_0x5077cc+'\x20created');if(_0x441166>0x0)_0x3eab86[_0x38bf18(0x146)](_0x441166+'\x20updated');if(_0x3a1d1b>0x0)_0x3eab86[_0x38bf18(0x146)](_0x3a1d1b+'\x20deleted');const _0x53285a=[];if(_0x2dbc56>0x0)_0x53285a[_0x38bf18(0x146)](_0x2dbc56+_0x38bf18(0x119));if(_0x36de27>0x0)_0x53285a[_0x38bf18(0x146)](_0x36de27+_0x38bf18(0x11f));if(_0x519a6c>0x0)_0x53285a[_0x38bf18(0x146)](_0x519a6c+_0x38bf18(0x1a5));return console['error'](a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x121))),_0x48176d['length']>0x0&&!_0x20f2e3['journeysOnly']&&console[_0x38bf18(0x19d)](_0x38bf18(0x192)+_0x48176d[_0x38bf18(0x16d)](',\x20')),_0x3eab86['length']>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x11a)+_0x3eab86['join'](',\x20')),_0x53285a['length']>0x0&&!_0x20f2e3['journeysOnly']&&console[_0x38bf18(0x19d)](_0x38bf18(0x171)+_0x53285a[_0x38bf18(0x16d)](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x59463d=a31_0x12f2;function a31_0x1bb7(){const _0x1aa9ba=['Source\x20directory:\x20','\x20unchanged','audienceId','cyan','/j/da/je','\x20activations]','parent_name','changed','results','red','978274SQSnGr','paused','execute','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','isScoped','created','.yaml','listFolders','buildUserMaps','activations','Error\x20parsing\x20YAML:\x20','map','file','Push\x20','push','Resolving\x20parent\x20segment\x20\x27','type','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Fetching\x20parent\x20segment\x20details...','getOutputSchemaWithCache','connection','Delete\x20journey:','Fetching\x20existing\x20activations...','folderPath','\x20to\x20update','journeys','\x20\x20Journeys:\x20','filter','relationships','/e/','\x20deleted','description','\x20\x20📊\x20Segments:','toUpdate','593115QEPyzs','/app/ps/','length','no_parent','targetDir','error','Delete\x20segment:','toCreate','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','journey','\x20\x20Activations:\x20','getParent','Error:\x20Directory\x20not\x20found:\x20','createdSegmentIds','versionNumber','Fetching\x20connections\x20for\x20name\x20resolution...','\x20new','\x20YAML\x20files\x20found','nameToType','yes','site','resolveParentId','diff','Aborted.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20updated','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','set','cwd','\x20changes?','(Journey\x20will\x20be\x20deleted)','journeyBundleName','\x20changed','scopedFolderPath','toString','dim','.yml','data','nameToId','segmentFolderId','4206840TrrItk','journeysOnly','\x20created','segments','\x20\x20🗺️\x20\x20Journeys:','user','message','delete','9ZZoKbt','\x0aError:','all','\x20\x20Activations:','setPhase','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','1841315vJTNqV','folderId','journeyId','\x20to\x20delete','59229DJVfpu','76xEcHja','segment\x20or\x20journey','\x0aPush\x20summary\x20for\x20\x27','12nQLNAj','\x0a✔\x20Push\x20complete','segment:push','\x20folders\x20to\x20create','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Parent\x20segment:\x20','new','segment','Scoped\x20to\x20folder:\x20','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','repeat','Fetching\x20existing\x20segments...','blue','yellow','journeyBundleId','get','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','listJourneysWithDetailsFromParentSegment','existingJourney','📁\x20','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','toDelete','attributes','helpText','Changes\x20to\x20journey:','Site:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','name','deleted','dryRun','Fetching\x20users\x20for\x20email\x20resolution...','\x20\x20\x20\x20','376390Nzdyru','Changes\x20to:','idToName','Error:\x20','filePath','No\x20','unchanged','17210970qiQlhZ','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','green','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','then','yamlConfig','join','isNew','verbose'];a31_0x1bb7=function(){return _0x1aa9ba;};return a31_0x1bb7();}(function(_0x566ef5,_0x3bdcf4){const _0x102afc=a31_0x12f2,_0x1a8a55=_0x566ef5();while(!![]){try{const _0x35fc50=-parseInt(_0x102afc(0x110))/0x1+-parseInt(_0x102afc(0x12a))/0x2+-parseInt(_0x102afc(0xec))/0x3*(-parseInt(_0x102afc(0xed))/0x4)+parseInt(_0x102afc(0x14c))/0x5+-parseInt(_0x102afc(0xf0))/0x6*(parseInt(_0x102afc(0xe8))/0x7)+parseInt(_0x102afc(0x174))/0x8*(-parseInt(_0x102afc(0x17c))/0x9)+parseInt(_0x102afc(0x117))/0xa;if(_0x35fc50===_0x3bdcf4)break;else _0x1a8a55['push'](_0x1a8a55['shift']());}catch(_0x4f1b20){_0x1a8a55['push'](_0x1a8a55['shift']());}}}(a31_0x1bb7,0x48995));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x21a16b from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a31_0x12f2(_0x598ac8,_0x2c4aff){_0x598ac8=_0x598ac8-0xe6;const _0x1bb7ca=a31_0x1bb7();let _0x12f2b6=_0x1bb7ca[_0x598ac8];return _0x12f2b6;}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a31_0x59463d(0x10b)]=a31_0x59463d(0xf2);[a31_0x59463d(0x149)]=a31_0x59463d(0x11a);async[a31_0x59463d(0x12c)](_0x4db427){const _0x3f637f=a31_0x59463d,{options:_0x57ad2b,args:_0x3096e4,tdx:_0x50d55f}=_0x4db427,_0x128daa=_0x57ad2b,_0x5eed7c=await resolveTarget({'arg':_0x3096e4[0x0],'contextParent':_0x57ad2b['parentSegment'],'cwd':process[_0x3f637f(0x168)]()});if(!isSuccessfulResolution(_0x5eed7c))return _0x5eed7c['errorCode']===_0x3f637f(0x14f)?(console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0xfd)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x3f637f(0x151)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x3f637f(0x151)](_0x3f637f(0xf4)),console[_0x3f637f(0x151)](_0x3f637f(0x164))):(console['error'](a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x113)+_0x5eed7c[_0x3f637f(0x17a)]+'\x0a')),_0x5eed7c['helpText']&&console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x123)](_0x5eed7c[_0x3f637f(0x107)]))),0x1;if(_0x5eed7c[_0x3f637f(0x13a)]===_0x3f637f(0x126))return console[_0x3f637f(0x151)](a31_0x21a16b['red'](_0x3f637f(0x158)+_0x5eed7c[_0x3f637f(0x150)]+'\x0a')),console[_0x3f637f(0x151)](a31_0x21a16b['cyan'](_0x3f637f(0x166))),0x1;const _0x234514=_0x5eed7c['parentName'],_0x3e42f5=_0x5eed7c['targetDir'],_0x21bdfe=_0x5eed7c[_0x3f637f(0x13a)]===_0x3f637f(0x136)?_0x5eed7c[_0x3f637f(0x114)]:undefined,_0x1722f1=getScopedDetails(_0x5eed7c),_0x24e388=_0x1722f1?.[_0x3f637f(0x12e)]??![],_0x49780d=_0x1722f1?.[_0x3f637f(0x16d)]??'';if(!existsSync(_0x3e42f5))return console[_0x3f637f(0x151)](a31_0x21a16b['red'](_0x3f637f(0x158)+_0x3e42f5+'\x0a')),console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x123)](_0x3f637f(0x166))),0x1;_0x128daa[_0x3f637f(0x11f)]&&(console['error'](_0x3f637f(0x109)+_0x128daa[_0x3f637f(0x160)]),console['error'](_0x3f637f(0xf5)+_0x234514),console[_0x3f637f(0x151)](_0x3f637f(0x120)+_0x3e42f5),_0x24e388&&console[_0x3f637f(0x151)](_0x3f637f(0xf8)+_0x49780d));const _0x382f2c=await withSpinner(_0x3f637f(0x139)+_0x234514+'\x27...',()=>_0x50d55f[_0x3f637f(0xf7)][_0x3f637f(0x161)](_0x234514),{'verbose':_0x128daa[_0x3f637f(0x11f)]}),_0x599f35=_0x382f2c[_0x3f637f(0x171)],[_0x4d4f76,_0x6758e0,_0x6262e3,_0x5ce313,_0x567008]=await Promise[_0x3f637f(0x17e)]([withSpinner(_0x3f637f(0x13c),()=>_0x50d55f[_0x3f637f(0xf7)][_0x3f637f(0x157)](_0x599f35),{'verbose':_0x128daa[_0x3f637f(0x11f)]}),withSpinner(_0x3f637f(0xfb),()=>_0x50d55f[_0x3f637f(0xf7)]['listSegments'](_0x599f35),{'verbose':_0x128daa[_0x3f637f(0x11f)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x50d55f[_0x3f637f(0xf7)][_0x3f637f(0x131)](_0x599f35),{'verbose':_0x128daa['verbose']}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x50d55f['journey'][_0x3f637f(0x101)](_0x599f35,{'includeAllVersions':!![]}),{'verbose':_0x128daa[_0x3f637f(0x11f)]}),withSpinner(_0x3f637f(0x10e),()=>_0x50d55f[_0x3f637f(0x179)][_0x3f637f(0x132)](),{'verbose':_0x128daa['verbose']})[_0x3f637f(0x11b)](_0x1197aa=>_0x1197aa[_0x3f637f(0x171)])]),_0x2a3e90=_0x4d4f76[_0x3f637f(0x171)],_0x13bd94=extractRootFolderId(_0x2a3e90),_0x160a30=_0x6758e0[_0x3f637f(0x171)],_0x4fa23d=_0x6262e3[_0x3f637f(0x171)],{journeys:_0x2435b4,activationStepsById:_0x5f0b53}=_0x5ce313['data'],_0x312b31=new Map(_0x2435b4[_0x3f637f(0x135)](_0x40b4b5=>[_0x40b4b5['id'],_0x40b4b5])),_0x3de458=_0x2435b4[_0x3f637f(0x135)](_0x304d24=>({'id':_0x304d24['id'],'name':_0x304d24[_0x3f637f(0x106)][_0x3f637f(0x10b)],'journeyBundleName':_0x304d24['attributes'][_0x3f637f(0x16b)]||'','journeyBundleId':_0x304d24[_0x3f637f(0x106)][_0x3f637f(0xfe)]||'','versionNumber':_0x304d24[_0x3f637f(0x106)][_0x3f637f(0x15a)],'description':_0x304d24['attributes'][_0x3f637f(0x149)],'state':_0x304d24[_0x3f637f(0x106)]['state'],'paused':_0x304d24[_0x3f637f(0x106)][_0x3f637f(0x12b)],'audienceId':_0x304d24['attributes'][_0x3f637f(0x122)],'folderId':_0x304d24[_0x3f637f(0x146)]?.['parentFolder']?.['data']?.['id'],'createdAt':_0x304d24[_0x3f637f(0x106)]['createdAt'],'updatedAt':_0x304d24[_0x3f637f(0x106)]['updatedAt']})),{emailToId:_0x4e28da,idToEmail:_0x10252b}=_0x567008,_0x238cc7=await withSpinner(_0x3f637f(0x15b),async()=>{const _0x1a83c3=_0x3f637f,_0x5a1e96=await _0x50d55f[_0x1a83c3(0x13e)]['list']();return buildConnectionMaps(_0x5a1e96);},{'verbose':_0x128daa['verbose']})[_0x3f637f(0x11b)](_0x22befa=>_0x22befa[_0x3f637f(0x171)]),_0x2b0eea=_0x238cc7[_0x3f637f(0x172)],_0xc71e00=_0x238cc7[_0x3f637f(0x112)],_0x300b62=_0x238cc7[_0x3f637f(0x15e)],_0x307a27={'emailToIdMap':_0x4e28da,'connectionNameToIdMap':_0x2b0eea,'connectionNameToTypeMap':_0x300b62,'getSchema':_0x4e6049=>_0x50d55f[_0x3f637f(0x13e)][_0x3f637f(0x13d)](_0x4e6049)};let {pathToId:_0x2aba3a,idToPath:_0x2a6952}=buildFolderMaps(_0x4fa23d);const _0x1a4661=buildSegmentLookupMap(_0x160a30,_0x2a6952),_0x57fb59=buildSegmentNameToIdMap(_0x160a30),_0x407afe=buildJourneyBundleLookupMap(_0x3de458,_0x2a6952);let _0x176ea0;if(_0x21bdfe){if(!_0x21bdfe['endsWith'](_0x3f637f(0x170))&&!_0x21bdfe['endsWith'](_0x3f637f(0x130)))return console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x129)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x21bdfe+'\x0a')),0x1;_0x176ea0=[_0x21bdfe];}else _0x176ea0=findYamlFiles(_0x3e42f5);if(_0x176ea0[_0x3f637f(0x14e)]===0x0)return console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x12d)+_0x3e42f5+'\x0a')),console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x123)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x39b072,_0x5ddc89;try{const _0x21f2f4=parseAndClassifyYamlFiles(_0x176ea0,_0x3e42f5,{'skipSegments':_0x128daa[_0x3f637f(0x175)]});_0x39b072=_0x21f2f4['segments'],_0x5ddc89=_0x21f2f4[_0x3f637f(0x143)];const _0x2f503e=validateParsedFiles(_0x21f2f4,_0x3e42f5);if(_0x2f503e['length']>0x0)return console['error'](a31_0x21a16b[_0x3f637f(0x129)]('\x0aValidation\x20failed:')),console[_0x3f637f(0x151)](formatValidationErrors(_0x2f503e)),console[_0x3f637f(0x151)](a31_0x21a16b['yellow'](_0x3f637f(0x100))),0x1;}catch(_0x408d51){return console['error'](a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x134)+(_0x408d51 instanceof Error?_0x408d51[_0x3f637f(0x17a)]:_0x408d51))),0x1;}if(_0x39b072[_0x3f637f(0x14e)]===0x0&&_0x5ddc89[_0x3f637f(0x14e)]===0x0){const _0x534100=_0x128daa['journeysOnly']?'journey':_0x3f637f(0xee);return console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0xfd)](_0x3f637f(0x115)+_0x534100+_0x3f637f(0x15d))),0x0;}const _0x4c9567=new Map();_0x160a30[_0x3f637f(0x14e)]>0x0&&!_0x128daa['journeysOnly']&&await withSpinner(_0x3f637f(0x140),async()=>{await batchAsync(_0x160a30,async _0x251ebf=>{const _0x3cf9b1=a31_0x12f2,_0x3f8c10=await _0x50d55f[_0x3cf9b1(0xf7)]['listActivations'](_0x599f35,_0x251ebf['id']);_0x4c9567['set'](_0x251ebf['id'],_0x3f8c10);});},{'verbose':_0x128daa[_0x3f637f(0x11f)]});const {segmentFiles:_0x5eabed,foldersToCreate:_0xf91a52}=await prepareSegmentFiles(_0x39b072,{'segmentByFolderAndName':_0x1a4661,'activationsBySegmentId':_0x4c9567,'folderPathToId':_0x2aba3a,'idToEmailMap':_0x10252b,'connectionIdToNameMap':_0xc71e00},_0x307a27,_0x24e388,_0x49780d),_0x1bfcbf=_0x21bdfe?[]:findSegmentsToDelete(_0x160a30,_0x39b072[_0x3f637f(0x135)](({yamlConfig:_0x3bb1b8,folderPath:_0x332176})=>({'yamlConfig':_0x3bb1b8,'folderPath':resolveTDFolderPath(_0x332176,_0x24e388,_0x49780d)})),_0x2a6952,_0x49780d,_0x24e388),{journeyFiles:_0x1102a1,foldersToCreate:_0x26c68f}=await withProgressSpinner('Preparing\x20journeys...',async _0x47f37a=>prepareJourneyFiles(_0x5ddc89,{'fetchJourney':async _0x2fdf4e=>_0x50d55f['journey']['getJourney'](_0x2fdf4e[_0x3f637f(0xea)]),'journeyBundlesByFolderAndName':_0x407afe,'folderPathToId':_0x2aba3a,'idToEmailMap':_0x10252b,'connectionIdToNameMap':_0xc71e00,'existingSegments':_0x160a30,'parentId':_0x599f35,'deps':_0x50d55f,'progress':{'update':_0x145ee0=>{const _0x2ec066=_0x3f637f;_0x47f37a[_0x2ec066(0xe6)](_0x145ee0),_0x128daa[_0x2ec066(0x11f)]&&console[_0x2ec066(0x151)]('\x20\x20'+_0x145ee0);}},'journeyById':_0x312b31,'activationStepsById':_0x5f0b53},_0x24e388,_0x49780d),{'verbose':_0x128daa['verbose']})['then'](_0x4b64b7=>_0x4b64b7[_0x3f637f(0x171)]);for(const _0x9ab08b of _0x26c68f){_0xf91a52['add'](_0x9ab08b);}const _0x3dc452=_0x21bdfe?[]:findJourneysToDelete(_0x3de458,_0x5ddc89[_0x3f637f(0x135)](({yamlConfig:_0x525ac9,folderPath:_0x49999e})=>({'yamlConfig':_0x525ac9,'folderPath':resolveTDFolderPath(_0x49999e,_0x24e388,_0x49780d)})),_0x2a6952,_0x49780d,_0x24e388),_0x2ea30b=calculatePushStats(_0x5eabed,_0x1102a1,_0xf91a52,_0x1bfcbf,_0x3dc452,!!_0x128daa['delete'],!!_0x128daa[_0x3f637f(0x175)]),_0x4952c7=_0x2ea30b[_0x3f637f(0x177)][_0x3f637f(0xf6)],_0x26a876=_0x2ea30b['segments'][_0x3f637f(0x127)],_0x35387c=_0x2ea30b['segments'][_0x3f637f(0x116)],_0x164b92=_0x2ea30b[_0x3f637f(0x177)][_0x3f637f(0x105)],_0x5b2a84=_0x2ea30b['folders'][_0x3f637f(0x153)],_0x3a2c15=_0x2ea30b[_0x3f637f(0x143)][_0x3f637f(0xf6)],_0x266076=_0x2ea30b['journeys'][_0x3f637f(0x127)],_0x3f96ff=_0x2ea30b['journeys'][_0x3f637f(0x116)],_0x4dfab=_0x2ea30b[_0x3f637f(0x143)][_0x3f637f(0x105)],_0x20b3d2=_0x2ea30b[_0x3f637f(0x133)]['all'],_0x7709ac=_0x2ea30b['activations'][_0x3f637f(0x153)],_0x1bcb3f=_0x2ea30b[_0x3f637f(0x133)][_0x3f637f(0x14b)],_0x5ce933=_0x2ea30b[_0x3f637f(0x133)][_0x3f637f(0x105)];console[_0x3f637f(0x151)](_0x3f637f(0xef)+_0x234514+'\x27:');_0x5b2a84[_0x3f637f(0x14e)]>0x0&&console[_0x3f637f(0x151)]('\x20\x20'+a31_0x21a16b[_0x3f637f(0xfc)](_0x3f637f(0x103)+_0x5b2a84[_0x3f637f(0x14e)]+_0x3f637f(0xf3)));if(!_0x128daa[_0x3f637f(0x175)]){console[_0x3f637f(0x151)](_0x3f637f(0x14a)),console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b['green']('+\x20'+_0x4952c7[_0x3f637f(0x14e)]+_0x3f637f(0x15c))),console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0xfd)]('~\x20'+_0x26a876[_0x3f637f(0x14e)]+_0x3f637f(0x16c)));if(_0x164b92[_0x3f637f(0x14e)]>0x0)console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b['red']('-\x20'+_0x164b92[_0x3f637f(0x14e)]+_0x3f637f(0xeb)));else _0x1bfcbf[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x17b)]&&console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x16f)](_0x1bfcbf[_0x3f637f(0x14e)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x16f)]('=\x20'+_0x35387c['length']+'\x20unchanged'));}if(_0x1102a1[_0x3f637f(0x14e)]>0x0||_0x3dc452[_0x3f637f(0x14e)]>0x0){console[_0x3f637f(0x151)](_0x3f637f(0x178)),console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b['green']('+\x20'+_0x3a2c15['length']+_0x3f637f(0x15c))),console[_0x3f637f(0x151)]('\x20\x20\x20\x20'+a31_0x21a16b[_0x3f637f(0xfd)]('~\x20'+_0x266076[_0x3f637f(0x14e)]+_0x3f637f(0x16c)));if(_0x4dfab[_0x3f637f(0x14e)]>0x0)console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x129)]('-\x20'+_0x4dfab[_0x3f637f(0x14e)]+_0x3f637f(0xeb)));else _0x3dc452[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x17b)]&&console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x16f)](_0x3dc452[_0x3f637f(0x14e)]+_0x3f637f(0x104)));console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x16f)]('=\x20'+_0x3f96ff['length']+_0x3f637f(0x121)));}_0x20b3d2['length']>0x0&&!_0x128daa[_0x3f637f(0x175)]&&(console['error'](''),console[_0x3f637f(0x151)](_0x3f637f(0x17f)),_0x7709ac[_0x3f637f(0x14e)]>0x0&&console['error'](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x119)]('+\x20'+_0x7709ac[_0x3f637f(0x14e)]+'\x20to\x20create')),_0x1bcb3f[_0x3f637f(0x14e)]>0x0&&console['error'](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0xfd)]('~\x20'+_0x1bcb3f[_0x3f637f(0x14e)]+_0x3f637f(0x142))),_0x5ce933[_0x3f637f(0x14e)]>0x0&&console[_0x3f637f(0x151)](_0x3f637f(0x10f)+a31_0x21a16b[_0x3f637f(0x129)]('-\x20'+_0x5ce933['length']+_0x3f637f(0xeb))));console[_0x3f637f(0x151)]('\x20\x20Source:\x20'+a31_0x21a16b[_0x3f637f(0x123)](_0x3e42f5)+'\x0a');if(_0x5b2a84['length']>0x0){console[_0x3f637f(0x151)]('Folders\x20to\x20create:');for(const _0x19144b of _0x5b2a84){console[_0x3f637f(0x151)]('\x20\x20'+a31_0x21a16b[_0x3f637f(0xfc)]('+')+'\x20'+_0x19144b);}console[_0x3f637f(0x151)]('');}if(_0x4952c7[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x175)])for(const _0x5c391c of _0x4952c7){const _0x55fd4a=_0x5c391c[_0x3f637f(0x141)]?_0x5c391c['folderPath']+'/'+_0x5c391c[_0x3f637f(0x11c)][_0x3f637f(0x10b)]:_0x5c391c[_0x3f637f(0x11c)][_0x3f637f(0x10b)],_0x6007d0=_0x5c391c[_0x3f637f(0x11c)][_0x3f637f(0x133)]?.[_0x3f637f(0x14e)]||0x0,_0x175030=_0x6007d0>0x0?a31_0x21a16b[_0x3f637f(0x16f)]('\x20['+_0x6007d0+_0x3f637f(0x125)):'';console[_0x3f637f(0x151)]('\x0a'+a31_0x21a16b[_0x3f637f(0x119)]('New\x20segment:')+'\x20'+_0x55fd4a+_0x175030),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c)),_0x5c391c[_0x3f637f(0x162)]&&console[_0x3f637f(0x151)](_0x5c391c[_0x3f637f(0x162)]),console[_0x3f637f(0x151)]('─'['repeat'](0x3c));}if(_0x164b92[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x175)])for(const _0x2fc4db of _0x164b92){const _0x105185=_0x2fc4db[_0x3f637f(0x173)]?_0x2a6952[_0x3f637f(0xff)](_0x2fc4db[_0x3f637f(0x173)][_0x3f637f(0x16e)]())||'':'',_0x27cfa7=_0x105185?_0x105185+'/'+_0x2fc4db['name']:_0x2fc4db[_0x3f637f(0x10b)],_0xd98385=_0x4c9567[_0x3f637f(0xff)](_0x2fc4db['id'])||[],_0x3a8acd=_0xd98385[_0x3f637f(0x14e)]>0x0?a31_0x21a16b[_0x3f637f(0x16f)]('\x20['+_0xd98385['length']+_0x3f637f(0x125)):'';console['error']('\x0a'+a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x152))+'\x20'+_0x27cfa7+_0x3a8acd),console['error']('─'[_0x3f637f(0xfa)](0x3c));const _0x1c4993=segmentWithActivationsToYaml(_0x2fc4db,_0xd98385,undefined,_0x10252b,_0xc71e00),_0x2af560=segmentToYamlString(_0x1c4993),_0x5b46e0=generateDiff(_0x2af560,'');console[_0x3f637f(0x151)](formatDiffWithColors(_0x5b46e0)),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c));}const _0x5858a6=_0x5eabed['filter'](_0x477d4c=>!_0x477d4c[_0x3f637f(0x11e)]&&_0x477d4c['diff']);if(_0x5858a6['length']>0x0&&!_0x128daa[_0x3f637f(0x175)])for(const _0x575fa6 of _0x5858a6){const _0x501ee5=_0x575fa6[_0x3f637f(0x141)]?_0x575fa6[_0x3f637f(0x141)]+'/'+_0x575fa6[_0x3f637f(0x11c)][_0x3f637f(0x10b)]:_0x575fa6[_0x3f637f(0x11c)]['name'];console['error']('\x0a'+a31_0x21a16b[_0x3f637f(0xfd)](_0x3f637f(0x111))+'\x20'+_0x501ee5),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c)),console[_0x3f637f(0x151)](_0x575fa6[_0x3f637f(0x162)]),console['error']('─'[_0x3f637f(0xfa)](0x3c));}if(_0x3a2c15[_0x3f637f(0x14e)]>0x0)for(const _0x15bfb3 of _0x3a2c15){const _0x4e329c=_0x15bfb3['folderPath']?_0x15bfb3[_0x3f637f(0x141)]+'/'+_0x15bfb3[_0x3f637f(0x11c)][_0x3f637f(0x10b)]:_0x15bfb3[_0x3f637f(0x11c)][_0x3f637f(0x10b)];console['error']('\x0a'+a31_0x21a16b['green']('New\x20journey:')+'\x20'+_0x4e329c),console['error']('─'[_0x3f637f(0xfa)](0x3c)),_0x15bfb3['diff']&&console[_0x3f637f(0x151)](_0x15bfb3[_0x3f637f(0x162)]),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c));}const _0xc3fccf=_0x1102a1[_0x3f637f(0x145)](_0x26a687=>!_0x26a687[_0x3f637f(0x11e)]&&_0x26a687['diff']);if(_0xc3fccf[_0x3f637f(0x14e)]>0x0)for(const _0x115ed4 of _0xc3fccf){const _0x499bd7=_0x115ed4[_0x3f637f(0x141)]?_0x115ed4[_0x3f637f(0x141)]+'/'+_0x115ed4['yamlConfig'][_0x3f637f(0x10b)]:_0x115ed4[_0x3f637f(0x11c)]['name'];console[_0x3f637f(0x151)]('\x0a'+a31_0x21a16b['yellow'](_0x3f637f(0x108))+'\x20'+_0x499bd7),console[_0x3f637f(0x151)]('─'['repeat'](0x3c)),console[_0x3f637f(0x151)](_0x115ed4[_0x3f637f(0x162)]),console[_0x3f637f(0x151)]('─'['repeat'](0x3c));}if(_0x4dfab['length']>0x0)for(const _0xb653a of _0x4dfab){const _0x331c0f=_0xb653a[_0x3f637f(0xe9)]?_0x2a6952[_0x3f637f(0xff)](_0xb653a[_0x3f637f(0xe9)])||'':'',_0x3b8232=_0x331c0f?_0x331c0f+'/'+_0xb653a[_0x3f637f(0x16b)]:_0xb653a[_0x3f637f(0x16b)];console[_0x3f637f(0x151)]('\x0a'+a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x13f))+'\x20'+_0x3b8232),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c)),console['error'](a31_0x21a16b['red'](_0x3f637f(0x16a))),console[_0x3f637f(0x151)]('─'[_0x3f637f(0xfa)](0x3c));}if(_0x128daa[_0x3f637f(0x10d)])return console['error'](a31_0x21a16b[_0x3f637f(0xfd)](_0x3f637f(0x13b))),0x0;const _0x27ceb4=_0x128daa[_0x3f637f(0x175)]?![]:_0x4952c7[_0x3f637f(0x14e)]>0x0||_0x26a876[_0x3f637f(0x14e)]>0x0||_0x164b92[_0x3f637f(0x14e)]>0x0,_0x6bb0f1=_0x3a2c15[_0x3f637f(0x14e)]>0x0||_0x266076[_0x3f637f(0x14e)]>0x0||_0x4dfab[_0x3f637f(0x14e)]>0x0,_0x69ce5e=_0x128daa['journeysOnly']?![]:_0x20b3d2[_0x3f637f(0x14e)]>0x0,_0xedaabd=_0x5b2a84[_0x3f637f(0x14e)]>0x0;if(!_0x27ceb4&&!_0x6bb0f1&&!_0x69ce5e&&!_0xedaabd){const _0x28745e=_0x128daa[_0x3f637f(0x175)]?_0x3f637f(0xe7):_0x3f637f(0xf9);console['error'](a31_0x21a16b[_0x3f637f(0x119)](_0x28745e));if(_0x21bdfe&&_0x3f96ff[_0x3f637f(0x14e)]===0x1){const _0x54d338=_0x3f96ff[0x0];if(_0x54d338[_0x3f637f(0x102)]?.['id']){const _0x4bddaa=getConsoleNextUrl(_0x128daa[_0x3f637f(0x160)],_0x3f637f(0x14d)+_0x599f35+_0x3f637f(0x147)+_0x54d338[_0x3f637f(0x102)]['id']+_0x3f637f(0x124));console[_0x3f637f(0x151)]('\x20\x20'+a31_0x21a16b['cyan'](_0x4bddaa));}}return 0x0;}const _0x117b5e=_0x128daa[_0x3f637f(0x175)]?_0x3a2c15[_0x3f637f(0x14e)]+_0x266076[_0x3f637f(0x14e)]+_0x4dfab['length']+_0x5b2a84[_0x3f637f(0x14e)]:_0x4952c7[_0x3f637f(0x14e)]+_0x26a876['length']+_0x164b92[_0x3f637f(0x14e)]+_0x3a2c15[_0x3f637f(0x14e)]+_0x266076[_0x3f637f(0x14e)]+_0x4dfab[_0x3f637f(0x14e)]+_0x5b2a84['length']+_0x20b3d2[_0x3f637f(0x14e)];if(!_0x128daa[_0x3f637f(0x15f)]&&_0x117b5e>0x0){if(!isInteractive())return console['error'](a31_0x21a16b[_0x3f637f(0x129)](_0x3f637f(0x17d)),_0x3f637f(0x10a)),console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x16f)](_0x3f637f(0x154))),0x1;const _0x44a24c=await confirmKey(_0x3f637f(0x137)+_0x117b5e+_0x3f637f(0x169));if(!_0x44a24c)return console['error'](a31_0x21a16b[_0x3f637f(0xfd)](_0x3f637f(0x163))),0x1;}const _0x438642={'withProgress':async(_0x1286cc,_0x1dcdcb)=>{const _0x41613a=_0x3f637f,_0x3ea532=await withSpinner(_0x1286cc,_0x1dcdcb,{'verbose':_0x128daa[_0x41613a(0x11f)]});return{'data':_0x3ea532[_0x41613a(0x171)]};},'logInfo':_0x4dcd7a=>console['error'](a31_0x21a16b['blue']('✔\x20'+_0x4dcd7a)),'logSuccess':_0x4a5bc0=>console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x119)]('✔\x20'+_0x4a5bc0)),'logWarning':_0x2626f5=>console['error'](a31_0x21a16b[_0x3f637f(0xfd)]('⚠\x20'+_0x2626f5)),'logDeleted':_0x445013=>console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x129)]('✔\x20'+_0x445013))},_0x55b205={'segment':_0x50d55f['segment'],'journey':_0x50d55f[_0x3f637f(0x155)],'user':_0x50d55f[_0x3f637f(0x179)],'connection':_0x50d55f['connection']};_0x5b2a84[_0x3f637f(0x14e)]>0x0&&(_0x2aba3a=await executePushFolders(_0x55b205,_0x5b2a84,_0x2aba3a,{'parentId':_0x599f35},_0x438642));const _0x3580b9={'rootFolderId':_0x13bd94,'folderPathToId':_0x2aba3a,'folderIdToPath':_0x2a6952,'segmentNameToId':_0x57fb59,'activationsBySegmentId':_0x4c9567,'emailToIdMap':_0x4e28da,'idToEmailMap':_0x10252b,'connectionNameToIdMap':_0x238cc7[_0x3f637f(0x172)],'connectionIdToNameMap':_0x238cc7[_0x3f637f(0x112)],'connectionNameToTypeMap':_0x300b62},_0x1d7aa7=await executePushSegments(_0x55b205,_0x128daa[_0x3f637f(0x175)]?[]:_0x5eabed,_0x3580b9,{'parentId':_0x599f35},_0x438642),_0x5b392b=_0x1d7aa7[_0x3f637f(0x12f)],_0x2987c9=_0x1d7aa7['updated'],_0x24c58d=_0x1d7aa7[_0x3f637f(0x133)][_0x3f637f(0x12f)],_0x5558e3=_0x1d7aa7[_0x3f637f(0x133)]['updated'],_0x41b8c1=_0x1d7aa7[_0x3f637f(0x133)][_0x3f637f(0x10c)],_0x1c8b8c=await executePushSegmentDeletions(_0x55b205,_0x128daa['journeysOnly']?[]:_0x164b92,_0x438642);let _0x43a4a9=0x0,_0x5d62b0=0x0,_0x1cc2ae=0x0;const _0x5a1c96=new Map(_0x57fb59);for(const [_0x3c008e,_0xf8630c]of _0x1d7aa7[_0x3f637f(0x159)]){_0x5a1c96[_0x3f637f(0x167)](_0x3c008e,_0xf8630c);}if(_0x1102a1[_0x3f637f(0x14e)]>0x0){const _0x4f16f6={..._0x3580b9,'segmentNameToId':_0x5a1c96,'existingSegments':_0x160a30,'activationContext':_0x307a27},_0x460d99=await executePushJourneys(_0x55b205,_0x1102a1,_0x4f16f6,{'parentId':_0x599f35,'rootFolderId':_0x13bd94,'verbose':_0x128daa[_0x3f637f(0x11f)]},_0x438642);_0x43a4a9=_0x460d99['created'],_0x5d62b0=_0x460d99['updated'];if(_0x21bdfe&&_0x460d99[_0x3f637f(0x128)][_0x3f637f(0x14e)]===0x1){const _0x131853=_0x460d99[_0x3f637f(0x128)][0x0];if(_0x131853[_0x3f637f(0xea)]){const _0x805d7c=getConsoleNextUrl(_0x128daa[_0x3f637f(0x160)],'/app/ps/'+_0x599f35+_0x3f637f(0x147)+_0x131853[_0x3f637f(0xea)]+'/j/da/je');console[_0x3f637f(0x151)]('\x20\x20'+a31_0x21a16b[_0x3f637f(0x123)](_0x805d7c));}}}for(const _0x3de858 of _0x4dfab){console['error'](a31_0x21a16b['yellow'](_0x3f637f(0x118)+_0x3de858[_0x3f637f(0x16b)])),_0x1cc2ae++;}const _0x258cf2=[];if(_0x5b392b>0x0)_0x258cf2[_0x3f637f(0x138)](_0x5b392b+_0x3f637f(0x176));if(_0x2987c9>0x0)_0x258cf2[_0x3f637f(0x138)](_0x2987c9+_0x3f637f(0x165));if(_0x1c8b8c>0x0)_0x258cf2['push'](_0x1c8b8c+_0x3f637f(0x148));const _0x204a24=[];if(_0x43a4a9>0x0)_0x204a24[_0x3f637f(0x138)](_0x43a4a9+_0x3f637f(0x176));if(_0x5d62b0>0x0)_0x204a24[_0x3f637f(0x138)](_0x5d62b0+'\x20updated');if(_0x1cc2ae>0x0)_0x204a24['push'](_0x1cc2ae+_0x3f637f(0x148));const _0x4b35f1=[];if(_0x24c58d>0x0)_0x4b35f1[_0x3f637f(0x138)](_0x24c58d+_0x3f637f(0x176));if(_0x5558e3>0x0)_0x4b35f1[_0x3f637f(0x138)](_0x5558e3+_0x3f637f(0x165));if(_0x41b8c1>0x0)_0x4b35f1[_0x3f637f(0x138)](_0x41b8c1+_0x3f637f(0x148));return console[_0x3f637f(0x151)](a31_0x21a16b[_0x3f637f(0x119)](_0x3f637f(0xf1))),_0x258cf2[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x175)]&&console[_0x3f637f(0x151)]('\x20\x20Segments:\x20'+_0x258cf2[_0x3f637f(0x11d)](',\x20')),_0x204a24[_0x3f637f(0x14e)]>0x0&&console[_0x3f637f(0x151)](_0x3f637f(0x144)+_0x204a24[_0x3f637f(0x11d)](',\x20')),_0x4b35f1[_0x3f637f(0x14e)]>0x0&&!_0x128daa[_0x3f637f(0x175)]&&console[_0x3f637f(0x151)](_0x3f637f(0x156)+_0x4b35f1[_0x3f637f(0x11d)](',\x20')),0x0;}}
|