@treasuredata/tdx 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/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/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
- package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
- package/dist/sdk/claude-agent/environment.d.ts +9 -0
- package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
- package/dist/sdk/claude-agent/environment.js +1 -1
- package/dist/sdk/claude-agent/environment.js.map +1 -1
- package/dist/sdk/claude-agent/index.js +1 -1
- package/dist/sdk/claude-agent/system-prompts.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/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/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/json-loader.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 a27_0x2197db=a27_0x4947;(function(_0x1b4cf9,_0x219106){const _0x530ef6=a27_0x4947,_0x1452bd=_0x1b4cf9();while(!![]){try{const _0x2c3325=-parseInt(_0x530ef6(0xbc))/0x1+-parseInt(_0x530ef6(0xe2))/0x2+-parseInt(_0x530ef6(0x96))/0x3*(parseInt(_0x530ef6(0xdc))/0x4)+parseInt(_0x530ef6(0xe1))/0x5*(parseInt(_0x530ef6(0xca))/0x6)+parseInt(_0x530ef6(0xfb))/0x7+-parseInt(_0x530ef6(0xfc))/0x8+-parseInt(_0x530ef6(0x91))/0x9*(-parseInt(_0x530ef6(0xcc))/0xa);if(_0x2c3325===_0x219106)break;else _0x1452bd['push'](_0x1452bd['shift']());}catch(_0x23172f){_0x1452bd['push'](_0x1452bd['shift']());}}}(a27_0x5e46,0xce395));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a27_0x5e46(){const _0x43ebaa=['parentId','Resolved\x20relative\x20path\x20to:\x20','\x27\x20with\x20ID:\x20','format','segment:describe','Target\x20path:\x20','Executing\x20segment\x20query...','Parent\x20ID:\x20','parentFolder','getSegmentSQL','resolvePathToResource','Error:\x20','\x20\x20Folder\x20path:\x20','includes','2604tTUVCX','resolveParentId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','140zXmXVq','1782718PqpFlo','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','jsonl','Folder\x20ID:\x20','Resolved\x20parent\x20ID:\x20','parent','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Fetching\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','cause','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','(root)','Examples:','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','folder','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Parent\x20segment:\x20','parentSegment','jobId','Resolving\x20path\x20\x27','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','verbose','2190216DGifTh','1069168XTSbeb','INVALID_ARGUMENT','Listing\x20folders\x20for\x20parent\x20\x27','replace','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','processedRows','green','✔\x20Found\x20','name','\x27...','log','Error:\x20Folder\x20reference\x20is\x20required','url','Resolved\x20parent\x20folder\x20ID:\x20','Use:\x20tdx\x20ps\x20view','segmentName','Parent\x20name:\x20','Fetching\x20folder\x20details...','Usage:\x20tdx\x20sg\x20show\x20<name>','type','message','listFolders','Use:\x20tdx\x20ps\x20show','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Segment\x20ID:\x20','Show\x20segment\x20folder\x20details','toLocaleString','Resolving\x20\x27','limit','elapsedTimeMillis','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','✔\x20Created\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','getFolder','\x20rows\x20','✖\x20Query\x20failed\x20[','in\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','Resolving\x20folder\x20\x27','json','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20desc\x20<name>','Use:\x20tdx\x20ps\x20view\x20-w','segment:show','/app/ps/','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Get\x20SQL\x20query\x20for\x20child\x20segment','11623554zEIEDh','data','resolveFolderId','Fetching\x20segment\x20details...','folderPath','3633fDUooP','Usage:\x20tdx\x20sg\x20sql\x20<name>','Resolving\x20parent\x20folder\x20\x27','SEGMENT_NOT_FOUND','Resolving\x20parent\x20segment\x20\x27','createFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','description','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20Cause:\x20','getParent','Error:\x20Path\x20or\x20name\x20is\x20required','test','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20desc','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','folderId','SQL\x20query:\x0a','fullPath','information_schema','web','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','code','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','site','execute','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20sql','\x20[Job\x20ID:\x20','trim','query','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:create','Show\x20folder\x20or\x20child\x20segment\x20details','setJobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','segmentId','1047265SKhYNg','length','error','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Fetching\x20parent\x20segment\x20details...','Resolved\x20type:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Site:\x20','segment:sql','getSegment','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','173448rWVQZQ','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','20OtHCmR','\x20\x20Full\x20path:\x20'];a27_0x5e46=function(){return _0x43ebaa;};return a27_0x5e46();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a27_0x4947(_0x5d427c,_0x3851fc){_0x5d427c=_0x5d427c-0x6c;const _0x5e46b1=a27_0x5e46();let _0x494723=_0x5e46b1[_0x5d427c];return _0x494723;}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_0x476a55 from'chalk';async function resolveSegmentTarget(_0x35530b,_0x4cf27b,_0x4666ad){const _0x1571ea=a27_0x4947;if(isYamlFilePath(_0x35530b))try{const _0x3b8992=await resolveYamlFilePath(_0x35530b);return _0x4666ad&&(console['error'](_0x1571ea(0x79)+_0x35530b),console['error']('\x20\x20Parent\x20segment:\x20'+_0x3b8992['parentSegment']),console[_0x1571ea(0xbe)](_0x1571ea(0xc8)+_0x3b8992[_0x1571ea(0x10b)]),console[_0x1571ea(0xbe)](_0x1571ea(0xda)+(_0x3b8992[_0x1571ea(0x95)]||_0x1571ea(0xf0))),console[_0x1571ea(0xbe)](_0x1571ea(0xcd)+_0x3b8992[_0x1571ea(0xa9)])),_0x3b8992[_0x1571ea(0xa9)];}catch(_0x938b66){throw new SDKError(ErrorCode[_0x1571ea(0xfd)],_0x1571ea(0xc3)+_0x938b66[_0x1571ea(0x6f)]);}if(!_0x4cf27b)throw new SDKError(ErrorCode[_0x1571ea(0xfd)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4cf27b+'/'+_0x35530b;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x2197db(0x104)]=a27_0x2197db(0xd2);[a27_0x2197db(0x9d)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x2197db(0xb0)](_0x15015f){const _0x4dca11=a27_0x2197db,{options:_0x15fe73,args:_0x1c72e9,tdx:_0x33dfce}=_0x15015f,_0x5dd671=_0x1c72e9[0x0],_0x1fc3e9=!_0x5dd671&&!!_0x15fe73['parentSegment'],_0x25cfd2=_0x5dd671||_0x15fe73[_0x4dca11(0xf6)];if(!_0x25cfd2)return console[_0x4dca11(0xbe)](_0x4dca11(0xa2)),console[_0x4dca11(0xbe)](_0x4dca11(0x9f)),console[_0x4dca11(0xbe)](_0x4dca11(0xf1)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x4dca11(0xbe)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x4dca11(0xbe)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x4dca11(0x9c)),0x1;try{const _0x5e4ead=_0x15fe73['segmentPath'];let _0x2c059=_0x25cfd2;!_0x1fc3e9&&_0x5e4ead&&!_0x25cfd2[_0x4dca11(0xdb)]('/')&&(_0x2c059=_0x5e4ead+'/'+_0x25cfd2,_0x15fe73[_0x4dca11(0xfa)]&&console[_0x4dca11(0xbe)](_0x4dca11(0xcf)+_0x2c059));const _0x475ac9=await withSpinner(_0x4dca11(0xf8)+_0x2c059+_0x4dca11(0x105),()=>_0x33dfce[_0x4dca11(0x7c)]['resolvePathToResource'](_0x2c059),{'verbose':_0x15fe73[_0x4dca11(0xfa)]}),_0x419cef=_0x475ac9[_0x4dca11(0x92)];_0x15fe73['verbose']&&(console[_0x4dca11(0xbe)](_0x4dca11(0xc1)+_0x419cef['type']),console[_0x4dca11(0xbe)](_0x4dca11(0xd5)+_0x419cef[_0x4dca11(0xce)]),_0x419cef['folderId']&&console['error'](_0x4dca11(0xe5)+_0x419cef[_0x4dca11(0xa7)]),_0x419cef[_0x4dca11(0xbb)]&&console[_0x4dca11(0xbe)](_0x4dca11(0x73)+_0x419cef['segmentId']));if(_0x419cef['type']===_0x4dca11(0xe7)){const _0x4a6a78=await withSpinner(_0x4dca11(0xc0),()=>_0x33dfce['segment'][_0x4dca11(0xa1)](_0x419cef[_0x4dca11(0xce)]),{'verbose':_0x15fe73['verbose']});await handleSingleObjectOutput(_0x4a6a78['data'],_0x15fe73);}else{if(_0x419cef[_0x4dca11(0x6e)]===_0x4dca11(0xf3)){if(!_0x419cef[_0x4dca11(0xa7)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x14ed73=await withSpinner('Fetching\x20folder\x20details...',()=>_0x33dfce[_0x4dca11(0x7c)][_0x4dca11(0x81)](_0x419cef[_0x4dca11(0xa7)]),{'verbose':_0x15fe73['verbose']});await handleSingleObjectOutput(_0x14ed73[_0x4dca11(0x92)],_0x15fe73);}else{if(_0x419cef[_0x4dca11(0x6e)]===_0x4dca11(0x7c)){if(!_0x419cef[_0x4dca11(0xbb)])throw new SDKError(ErrorCode[_0x4dca11(0x99)],_0x4dca11(0x7f));const _0x29ace4=await withSpinner(_0x4dca11(0x94),()=>_0x33dfce['segment'][_0x4dca11(0xc6)](_0x419cef['parentId'],_0x419cef[_0x4dca11(0xbb)]),{'verbose':_0x15fe73[_0x4dca11(0xfa)]});await handleSingleObjectOutput(_0x29ace4[_0x4dca11(0x92)],_0x15fe73);}}}return 0x0;}catch(_0x21cf57){if(_0x21cf57 instanceof SDKError)return console['error'](_0x4dca11(0xd9)+_0x21cf57[_0x4dca11(0x6f)]),_0x21cf57[_0x4dca11(0xed)]&&console[_0x4dca11(0xbe)](_0x4dca11(0xa0)+_0x21cf57[_0x4dca11(0xed)]),0x1;throw _0x21cf57;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x2197db(0x104)]=a27_0x2197db(0x8d);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x2197db(0xb0)](_0x16cff5){const _0x1552a9=a27_0x2197db,{options:_0x21c759,args:_0x3b7112,tdx:_0x2a6a02}=_0x16cff5,_0x4c568b=_0x3b7112[0x0];if(!_0x4c568b)return console[_0x1552a9(0xbe)](_0x1552a9(0xe8)),console[_0x1552a9(0xbe)](_0x1552a9(0x6d)),console[_0x1552a9(0xbe)](_0x1552a9(0xba)),console[_0x1552a9(0xbe)](_0x1552a9(0xf1)),console[_0x1552a9(0xbe)](_0x1552a9(0xef)),console[_0x1552a9(0xbe)](_0x1552a9(0xa4)),0x1;try{const _0x32dc15=_0x21c759[_0x1552a9(0xf6)],_0x2061ad=await resolveSegmentTarget(_0x4c568b,_0x32dc15,_0x21c759['verbose']);_0x21c759[_0x1552a9(0xfa)]&&console[_0x1552a9(0xbe)]('Target\x20path:\x20'+_0x2061ad);const _0x571603=await withSpinner(_0x1552a9(0x76)+_0x4c568b+_0x1552a9(0x105),()=>_0x2a6a02[_0x1552a9(0x7c)]['resolvePathToResource'](_0x2061ad),{'verbose':_0x21c759['verbose']}),_0x474d33=_0x571603[_0x1552a9(0x92)];_0x21c759['verbose']&&(console['error'](_0x1552a9(0xc1)+_0x474d33[_0x1552a9(0x6e)]),console[_0x1552a9(0xbe)](_0x1552a9(0xd5)+_0x474d33[_0x1552a9(0xce)]));if(_0x474d33['type']==='folder')return console[_0x1552a9(0xbe)](_0x1552a9(0xcb)),console[_0x1552a9(0xbe)](_0x1552a9(0xf9)),0x1;if(_0x474d33['type']===_0x1552a9(0xe7))return console[_0x1552a9(0xbe)](_0x1552a9(0xa6)),console[_0x1552a9(0xbe)](_0x1552a9(0x71)),0x1;if(!_0x474d33[_0x1552a9(0xbb)])throw new SDKError(ErrorCode[_0x1552a9(0x99)],_0x1552a9(0x7f));const _0xd895ae=await withSpinner(_0x1552a9(0x87),()=>_0x2a6a02['segment'][_0x1552a9(0xd7)](_0x474d33[_0x1552a9(0xce)],_0x474d33['segmentId']),{'verbose':_0x21c759[_0x1552a9(0xfa)]});let _0x49f8de=_0xd895ae[_0x1552a9(0x92)];const _0x578ec4=resolveLimit(_0x21c759[_0x1552a9(0x77)],DEFAULT_DISPLAY_LIMIT),_0x35eac5=/\bLIMIT\s+\d+/i[_0x1552a9(0xa3)](_0x49f8de);!_0x35eac5&&(_0x49f8de=_0x49f8de[_0x1552a9(0xb4)]()[_0x1552a9(0xff)](/;+$/,''),_0x49f8de='SELECT\x20*\x20FROM\x20(\x0a'+_0x49f8de+_0x1552a9(0xee)+_0x578ec4);_0x21c759['verbose']&&console['error'](_0x1552a9(0xa8)+_0x49f8de);const _0x29bccc=await withProgressSpinner(_0x1552a9(0xd4),async _0x2ace4e=>{const _0x291406=_0x1552a9,_0x3dc8ea=await _0x2a6a02[_0x291406(0xb5)]['execute'](_0x49f8de,{'catalog':'td','schema':_0x291406(0xaa),'onJobId':_0xa842d5=>{const _0x4c097e=_0x291406;_0x2ace4e[_0x4c097e(0xb9)](_0xa842d5);}});return _0x3dc8ea;},{'verbose':_0x21c759[_0x1552a9(0xfa)]}),_0x6b24e7=_0x29bccc[_0x1552a9(0x92)],_0x359681=_0x6b24e7[_0x1552a9(0xf7)]?_0x1552a9(0xb3)+_0x6b24e7[_0x1552a9(0xf7)]+']':'';return console[_0x1552a9(0xbe)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x6b24e7['stats'][_0x1552a9(0x101)][_0x1552a9(0x75)]()+_0x1552a9(0x82)+(_0x1552a9(0x84)+formatElapsed(_0x6b24e7['stats'][_0x1552a9(0x78)])+_0x359681)),await handleQueryOutput(_0x6b24e7,_0x21c759),0x0;}catch(_0xf62578){if(_0xf62578 instanceof SDKError)return console['error'](_0x1552a9(0x83)+_0xf62578[_0x1552a9(0xad)]+']'),console['error']('\x0a'+_0xf62578[_0x1552a9(0x6f)]),0x1;throw _0xf62578;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x2197db(0x104)]='segment:folder:list';[a27_0x2197db(0x9d)]=a27_0x2197db(0x9e);async[a27_0x2197db(0xb0)](_0x10d283){const _0x48e6b9=a27_0x2197db,{options:_0x3180cc,args:_0xbbcee,tdx:_0x416021}=_0x10d283;if(_0xbbcee[_0x48e6b9(0xbd)]===0x0)return console[_0x48e6b9(0xbe)](_0x48e6b9(0x85)),console[_0x48e6b9(0xbe)](_0x48e6b9(0xdf)),0x1;const _0x3a318b=_0xbbcee[0x0];try{_0x3180cc[_0x48e6b9(0xfa)]&&(console['error'](_0x48e6b9(0xc4)+_0x3180cc[_0x48e6b9(0xaf)]),console[_0x48e6b9(0xbe)](_0x48e6b9(0x10c)+_0x3a318b));const _0x3ec682=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3a318b+_0x48e6b9(0x105),()=>_0x416021[_0x48e6b9(0x7c)][_0x48e6b9(0xdd)](_0x3a318b),{'verbose':_0x3180cc[_0x48e6b9(0xfa)]}),_0x321d96=_0x3ec682[_0x48e6b9(0x92)];_0x3180cc[_0x48e6b9(0xfa)]&&console[_0x48e6b9(0xbe)](_0x48e6b9(0xe6)+_0x321d96);const _0xd7fc6=await withSpinner(_0x48e6b9(0xfe)+_0x3a318b+_0x48e6b9(0x105),()=>_0x416021['segment'][_0x48e6b9(0x70)](_0x321d96),{'verbose':_0x3180cc[_0x48e6b9(0xfa)]}),_0x549662=_0xd7fc6[_0x48e6b9(0x92)];return console[_0x48e6b9(0xbe)](_0x48e6b9(0x103)+_0x549662['length']+'\x20folder'+(_0x549662['length']!==0x1?'s':'')),await handleSDKOutput(_0x549662,_0x3180cc),0x0;}catch(_0xced01b){if(_0xced01b instanceof SDKError)return console[_0x48e6b9(0xbe)]('Error:\x20'+_0xced01b[_0x48e6b9(0x6f)]),_0xced01b[_0x48e6b9(0xed)]&&console[_0x48e6b9(0xbe)]('\x20\x20Cause:\x20'+_0xced01b[_0x48e6b9(0xed)]),0x1;throw _0xced01b;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x2197db(0x104)]='segment:folder:show';[a27_0x2197db(0x9d)]=a27_0x2197db(0x74);async['execute'](_0x9c84df){const _0x5086dc=a27_0x2197db,{options:_0x35b1b5,args:_0x3313cd,tdx:_0x66a397}=_0x9c84df;if(_0x3313cd[_0x5086dc(0xbd)]===0x0)return console[_0x5086dc(0xbe)](_0x5086dc(0x107)),console[_0x5086dc(0xbe)](_0x5086dc(0x7d)),0x1;try{const {parentId:_0x2b994c,childId:_0xab7273}=parseSegmentRef(_0x3313cd[0x0]);_0x35b1b5[_0x5086dc(0xfa)]&&(console[_0x5086dc(0xbe)](_0x5086dc(0xc4)+_0x35b1b5[_0x5086dc(0xaf)]),console[_0x5086dc(0xbe)](_0x5086dc(0x10c)+_0x2b994c),_0xab7273&&console[_0x5086dc(0xbe)]('Folder\x20name:\x20'+_0xab7273));if(!_0xab7273)return console['error'](_0x5086dc(0xe9)),0x1;const _0x2942a5=await withSpinner(_0x5086dc(0x9a)+_0x2b994c+_0x5086dc(0x105),()=>_0x66a397['segment']['resolveParentId'](_0x2b994c),{'verbose':_0x35b1b5[_0x5086dc(0xfa)]}),_0xa4c740=_0x2942a5['data'];_0x35b1b5[_0x5086dc(0xfa)]&&console['error'](_0x5086dc(0xe6)+_0xa4c740);const _0x338acd=await withSpinner(_0x5086dc(0x88)+_0xab7273+_0x5086dc(0x105),()=>_0x66a397[_0x5086dc(0x7c)][_0x5086dc(0x93)](_0xa4c740,_0xab7273),{'verbose':_0x35b1b5['verbose']}),_0x52323a=_0x338acd[_0x5086dc(0x92)];_0x35b1b5[_0x5086dc(0xfa)]&&console['error'](_0x5086dc(0x86)+_0x52323a);const _0x2062fa=await withSpinner(_0x5086dc(0xea)+_0xab7273+'\x27...',()=>_0x66a397['segment'][_0x5086dc(0x81)](_0x52323a),{'verbose':_0x35b1b5['verbose']});return await handleSDKOutput([_0x2062fa['data']],_0x35b1b5),0x0;}catch(_0x4cd9e0){if(_0x4cd9e0 instanceof SDKError)return console[_0x5086dc(0xbe)](_0x5086dc(0xd9)+_0x4cd9e0[_0x5086dc(0x6f)]),_0x4cd9e0[_0x5086dc(0xed)]&&console[_0x5086dc(0xbe)](_0x5086dc(0xa0)+_0x4cd9e0[_0x5086dc(0xed)]),0x1;throw _0x4cd9e0;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x2197db(0xc5);[a27_0x2197db(0x9d)]=a27_0x2197db(0x90);async[a27_0x2197db(0xb0)](_0x3510e2){const _0xda11c0=a27_0x2197db,{options:_0x9cb95b,args:_0x2b8646,tdx:_0x488912}=_0x3510e2,_0xc70c6c=_0x2b8646[0x0];if(!_0xc70c6c)return console['error'](_0xda11c0(0xe8)),console[_0xda11c0(0xbe)](_0xda11c0(0x97)),console[_0xda11c0(0xbe)](_0xda11c0(0xac)),console[_0xda11c0(0xbe)](_0xda11c0(0xf1)),console[_0xda11c0(0xbe)](_0xda11c0(0x8a)),console[_0xda11c0(0xbe)](_0xda11c0(0x8f)),0x1;try{const _0x33b2ab=_0x9cb95b[_0xda11c0(0xf6)],_0x376ca3=await resolveSegmentTarget(_0xc70c6c,_0x33b2ab,_0x9cb95b[_0xda11c0(0xfa)]);_0x9cb95b[_0xda11c0(0xfa)]&&console['error'](_0xda11c0(0xd3)+_0x376ca3);const _0x20454a=await withSpinner(_0xda11c0(0x76)+_0xc70c6c+'\x27...',()=>_0x488912[_0xda11c0(0x7c)][_0xda11c0(0xd8)](_0x376ca3),{'verbose':_0x9cb95b[_0xda11c0(0xfa)]}),_0x486f08=_0x20454a['data'];_0x9cb95b[_0xda11c0(0xfa)]&&(console[_0xda11c0(0xbe)](_0xda11c0(0xc1)+_0x486f08[_0xda11c0(0x6e)]),console[_0xda11c0(0xbe)](_0xda11c0(0xd5)+_0x486f08[_0xda11c0(0xce)]));if(_0x486f08[_0xda11c0(0x6e)]===_0xda11c0(0xf3))return console['error'](_0xda11c0(0xf4)),console[_0xda11c0(0xbe)](_0xda11c0(0x72)),0x1;if(_0x486f08[_0xda11c0(0x6e)]===_0xda11c0(0xe7))return console[_0xda11c0(0xbe)](_0xda11c0(0xe3)),console['error'](_0xda11c0(0xb2)),0x1;if(!_0x486f08[_0xda11c0(0xbb)])throw new SDKError(ErrorCode[_0xda11c0(0x99)],_0xda11c0(0x7f));const _0x2e2725=await withSpinner(_0xda11c0(0x87),()=>_0x488912[_0xda11c0(0x7c)][_0xda11c0(0xd7)](_0x486f08[_0xda11c0(0xce)],_0x486f08[_0xda11c0(0xbb)]),{'verbose':_0x9cb95b[_0xda11c0(0xfa)]}),_0x525ab2=_0x2e2725[_0xda11c0(0x92)];return _0x9cb95b['format']===_0xda11c0(0x89)||_0x9cb95b[_0xda11c0(0xd1)]===_0xda11c0(0xe4)?await handleSDKOutput([{'sql':_0x525ab2}],_0x9cb95b):console[_0xda11c0(0x106)](_0x525ab2),0x0;}catch(_0x136981){if(_0x136981 instanceof SDKError)return console[_0xda11c0(0xbe)](_0xda11c0(0xd9)+_0x136981[_0xda11c0(0x6f)]),_0x136981[_0xda11c0(0xed)]&&console['error'](_0xda11c0(0xa0)+_0x136981['cause']),0x1;throw _0x136981;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x2197db(0x104)]=a27_0x2197db(0xb7);[a27_0x2197db(0x9d)]='Create\x20segment\x20folder\x20for\x20organization';async[a27_0x2197db(0xb0)](_0x3f0283){const _0x258d4a=a27_0x2197db,{options:_0x359dd0,args:_0x3ad79a,tdx:_0x1660d1}=_0x3f0283,_0xb67f5a=_0x359dd0;if(_0x3ad79a[_0x258d4a(0xbd)]<0x2)return console[_0x258d4a(0xbe)](_0x258d4a(0xc2)),console['error'](_0x258d4a(0x100)),0x1;const _0x1819f9=_0x3ad79a[0x0],_0x29c9a7=_0x3ad79a[0x1];_0xb67f5a[_0x258d4a(0xfa)]&&(console['error'](_0x258d4a(0xc4)+_0xb67f5a[_0x258d4a(0xaf)]),console[_0x258d4a(0xbe)](_0x258d4a(0xf5)+_0x1819f9),console[_0x258d4a(0xbe)]('Folder\x20name:\x20'+_0x29c9a7));let _0x37b593;if(_0xb67f5a[_0x258d4a(0xd6)]){const _0x5311f7=_0xb67f5a['parentFolder'],_0x2c5900=await withSpinner(_0x258d4a(0x9a)+_0x1819f9+_0x258d4a(0x105),()=>_0x1660d1[_0x258d4a(0x7c)][_0x258d4a(0xdd)](_0x1819f9),{'verbose':_0xb67f5a[_0x258d4a(0xfa)]}),_0x381ae6=_0x2c5900[_0x258d4a(0x92)],_0x46e7d1=await withSpinner(_0x258d4a(0x98)+_0x5311f7+_0x258d4a(0x105),()=>_0x1660d1[_0x258d4a(0x7c)][_0x258d4a(0x93)](_0x381ae6,_0x5311f7),{'verbose':_0xb67f5a[_0x258d4a(0xfa)]});_0x37b593=_0x46e7d1[_0x258d4a(0x92)],_0xb67f5a['verbose']&&console[_0x258d4a(0xbe)](_0x258d4a(0x109)+_0x37b593);}const _0x37f961={'name':_0x29c9a7,'description':_0xb67f5a[_0x258d4a(0x9d)],'parentFolderId':_0x37b593},_0x453e8d=await withSpinner('Creating\x20folder\x20\x27'+_0x29c9a7+_0x258d4a(0x105),()=>_0x1660d1['segment'][_0x258d4a(0x9b)](_0x1819f9,_0x37f961),{'verbose':_0xb67f5a[_0x258d4a(0xfa)]}),_0x25c0b1=_0x453e8d['data'];return console[_0x258d4a(0xbe)](_0x258d4a(0x7e)+_0x25c0b1[_0x258d4a(0x104)]+_0x258d4a(0xd0)+_0x25c0b1['id']),await handleSDKOutput([_0x25c0b1],_0xb67f5a),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x2197db(0x104)]='segment:view';[a27_0x2197db(0x9d)]=a27_0x2197db(0xb8);async['execute'](_0x1ed5ed){const _0x365588=a27_0x2197db,{options:_0x4e0c7d,args:_0x363da3,tdx:_0x309c23}=_0x1ed5ed,_0x3e4212=_0x363da3[0x0];if(!_0x3e4212)return console[_0x365588(0xbe)](_0x365588(0xc7)),console['error'](_0x365588(0xbf)),console[_0x365588(0xbe)](_0x365588(0xec)),console[_0x365588(0xbe)]('Options:'),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x365588(0xbe)](_0x365588(0xf1)),console[_0x365588(0xbe)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x365588(0xbe)](_0x365588(0xae)),console[_0x365588(0xbe)](_0x365588(0xb6)),console[_0x365588(0xbe)](_0x365588(0xb1)),0x1;try{const _0x4eeb48=_0x4e0c7d[_0x365588(0xf6)],_0x54bc23=await resolveSegmentTarget(_0x3e4212,_0x4eeb48,_0x4e0c7d[_0x365588(0xfa)]);_0x4e0c7d[_0x365588(0xfa)]&&console[_0x365588(0xbe)](_0x365588(0xd3)+_0x54bc23);const _0x5c4d4f=await withSpinner(_0x365588(0x76)+_0x3e4212+_0x365588(0x105),()=>_0x309c23['segment']['resolvePathToResource'](_0x54bc23),{'verbose':_0x4e0c7d[_0x365588(0xfa)]}),_0x22374a=_0x5c4d4f[_0x365588(0x92)];_0x4e0c7d[_0x365588(0xfa)]&&(console[_0x365588(0xbe)](_0x365588(0xc1)+_0x22374a[_0x365588(0x6e)]),console[_0x365588(0xbe)](_0x365588(0xd5)+_0x22374a['parentId']),_0x22374a['folderId']&&console[_0x365588(0xbe)](_0x365588(0xe5)+_0x22374a[_0x365588(0xa7)]),_0x22374a[_0x365588(0xbb)]&&console[_0x365588(0xbe)](_0x365588(0x73)+_0x22374a[_0x365588(0xbb)]));if(_0x4e0c7d[_0x365588(0xab)]){if(_0x22374a[_0x365588(0x6e)]===_0x365588(0xf3))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x22374a[_0x365588(0x6e)]===_0x365588(0xe7))return console[_0x365588(0xbe)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x365588(0xbe)](_0x365588(0x8c)),0x1;if(!_0x22374a[_0x365588(0xbb)])throw new SDKError(ErrorCode[_0x365588(0x99)],_0x365588(0x7f));const _0x58cc54=getConsoleNextUrl(_0x4e0c7d[_0x365588(0xaf)],_0x365588(0x8e)+_0x22374a[_0x365588(0xce)]+'/e/'+_0x22374a['segmentId']);return console[_0x365588(0xbe)](a27_0x476a55[_0x365588(0x102)]('✔')+'\x20Opening\x20'+a27_0x476a55['cyan'](_0x58cc54)),openBrowser(_0x58cc54),0x0;}if(_0x22374a[_0x365588(0x6e)]===_0x365588(0xf3)){if(!_0x22374a[_0x365588(0xa7)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x365588(0x7b));const _0xab0d6=await withSpinner(_0x365588(0x6c),()=>_0x309c23[_0x365588(0x7c)]['getFolder'](_0x22374a[_0x365588(0xa7)]),{'verbose':_0x4e0c7d[_0x365588(0xfa)]});await handleSingleObjectOutput(_0xab0d6[_0x365588(0x92)],_0x4e0c7d);}else{if(_0x22374a[_0x365588(0x6e)]==='segment'){if(!_0x22374a[_0x365588(0xbb)])throw new SDKError(ErrorCode[_0x365588(0x99)],_0x365588(0x7f));const _0x3d9b4c=await withSpinner('Fetching\x20segment\x20details...',()=>_0x309c23[_0x365588(0x7c)]['getSegment'](_0x22374a[_0x365588(0xce)],_0x22374a[_0x365588(0xbb)]),{'verbose':_0x4e0c7d[_0x365588(0xfa)]}),_0x52a4e7=getConsoleNextUrl(_0x4e0c7d['site'],_0x365588(0x8e)+_0x22374a['parentId']+'/e/'+_0x22374a['segmentId']),_0x257854=_0x3d9b4c[_0x365588(0x92)];_0x257854[_0x365588(0x108)]=_0x52a4e7,await handleSingleObjectOutput(_0x257854,_0x4e0c7d);}else return console[_0x365588(0xbe)](_0x365588(0x7a)),console['error'](_0x365588(0x10a)),0x1;}return 0x0;}catch(_0x5b059a){if(_0x5b059a instanceof SDKError)return console['error'](_0x365588(0xd9)+_0x5b059a[_0x365588(0x6f)]),_0x5b059a[_0x365588(0xed)]&&console[_0x365588(0xbe)](_0x365588(0xa0)+_0x5b059a['cause']),0x1;throw _0x5b059a;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x2197db(0x104)]='segment:desc';[a27_0x2197db(0x9d)]=a27_0x2197db(0xe0);async['execute'](_0x16525f){const _0xb5cc61=a27_0x2197db,{options:_0x3b103e,args:_0x5af98f,tdx:_0x25cc13}=_0x16525f,_0x2c9f4b=_0x5af98f[0x0];if(!_0x2c9f4b)return console['error'](_0xb5cc61(0xe8)),console[_0xb5cc61(0xbe)](_0xb5cc61(0x8b)),console[_0xb5cc61(0xbe)](_0xb5cc61(0xeb)),console['error'](_0xb5cc61(0xf1)),console[_0xb5cc61(0xbe)](_0xb5cc61(0xde)),console[_0xb5cc61(0xbe)](_0xb5cc61(0x80)),0x1;try{const _0x57a31a=_0x3b103e[_0xb5cc61(0xf6)],_0x58e8a4=await resolveSegmentTarget(_0x2c9f4b,_0x57a31a,_0x3b103e[_0xb5cc61(0xfa)]);_0x3b103e[_0xb5cc61(0xfa)]&&console['error'](_0xb5cc61(0xd3)+_0x58e8a4);const _0x2cd54f=await withSpinner(_0xb5cc61(0x76)+_0x2c9f4b+_0xb5cc61(0x105),()=>_0x25cc13['segment'][_0xb5cc61(0xd8)](_0x58e8a4),{'verbose':_0x3b103e[_0xb5cc61(0xfa)]}),_0x32f9ec=_0x2cd54f[_0xb5cc61(0x92)];_0x3b103e[_0xb5cc61(0xfa)]&&(console['error'](_0xb5cc61(0xc1)+_0x32f9ec[_0xb5cc61(0x6e)]),console['error'](_0xb5cc61(0xd5)+_0x32f9ec[_0xb5cc61(0xce)]));if(_0x32f9ec[_0xb5cc61(0x6e)]==='folder')return console['error'](_0xb5cc61(0xc9)),console[_0xb5cc61(0xbe)](_0xb5cc61(0x72)),0x1;if(_0x32f9ec[_0xb5cc61(0x6e)]===_0xb5cc61(0xe7))return console[_0xb5cc61(0xbe)](_0xb5cc61(0xf2)),console[_0xb5cc61(0xbe)](_0xb5cc61(0xa5)),0x1;if(!_0x32f9ec[_0xb5cc61(0xbb)])throw new SDKError(ErrorCode[_0xb5cc61(0x99)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2ab1a8=await withSpinner(_0xb5cc61(0x87),()=>_0x25cc13[_0xb5cc61(0x7c)][_0xb5cc61(0xd7)](_0x32f9ec['parentId'],_0x32f9ec[_0xb5cc61(0xbb)]),{'verbose':_0x3b103e['verbose']}),_0x1a8c64=_0x2ab1a8[_0xb5cc61(0x92)],_0x3a0dad=await executeSchemaQuery(_0x1a8c64,_0x25cc13,_0x3b103e);return await handleQueryOutput(_0x3a0dad,_0x3b103e),0x0;}catch(_0x1aaddb){if(_0x1aaddb instanceof SDKError)return console[_0xb5cc61(0xbe)](_0xb5cc61(0xd9)+_0x1aaddb[_0xb5cc61(0x6f)]),_0x1aaddb[_0xb5cc61(0xed)]&&console['error'](_0xb5cc61(0xa0)+_0x1aaddb[_0xb5cc61(0xed)]),0x1;throw _0x1aaddb;}}}
|
|
1
|
+
const a27_0x49e00e=a27_0x523c;(function(_0x4a23d1,_0x26abfb){const _0x3d9a4a=a27_0x523c,_0x3191a8=_0x4a23d1();while(!![]){try{const _0xa9639d=parseInt(_0x3d9a4a(0x182))/0x1+parseInt(_0x3d9a4a(0x17a))/0x2+parseInt(_0x3d9a4a(0x105))/0x3+-parseInt(_0x3d9a4a(0x13a))/0x4*(parseInt(_0x3d9a4a(0x124))/0x5)+parseInt(_0x3d9a4a(0xfd))/0x6*(-parseInt(_0x3d9a4a(0x177))/0x7)+parseInt(_0x3d9a4a(0x130))/0x8+parseInt(_0x3d9a4a(0x158))/0x9*(parseInt(_0x3d9a4a(0x143))/0xa);if(_0xa9639d===_0x26abfb)break;else _0x3191a8['push'](_0x3191a8['shift']());}catch(_0xa2efc9){_0x3191a8['push'](_0x3191a8['shift']());}}}(a27_0x34d1,0xdd97f));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_0x532928 from'chalk';async function resolveSegmentTarget(_0x3196bc,_0x12187a,_0x2e1a85){const _0x156579=a27_0x523c;if(isYamlFilePath(_0x3196bc))try{const _0x4fbc7c=await resolveYamlFilePath(_0x3196bc);return _0x2e1a85&&(console[_0x156579(0x10d)](_0x156579(0x17f)+_0x3196bc),console[_0x156579(0x10d)](_0x156579(0x188)+_0x4fbc7c[_0x156579(0x170)]),console['error'](_0x156579(0x16d)+_0x4fbc7c['segmentName']),console['error'](_0x156579(0x13c)+(_0x4fbc7c[_0x156579(0x109)]||_0x156579(0x131))),console[_0x156579(0x10d)](_0x156579(0x123)+_0x4fbc7c[_0x156579(0x13e)])),_0x4fbc7c[_0x156579(0x13e)];}catch(_0x22182b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x156579(0x149)+_0x22182b['message']);}if(!_0x12187a)throw new SDKError(ErrorCode[_0x156579(0x12c)],_0x156579(0x18a));return _0x12187a+'/'+_0x3196bc;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a27_0x49e00e(0x142)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x49e00e(0x15d)](_0x31defe){const _0x12a397=a27_0x49e00e,{options:_0x26bb7e,args:_0x1edc80,tdx:_0xeb74a}=_0x31defe,_0x56d148=_0x1edc80[0x0],_0x48b00f=!_0x56d148&&!!_0x26bb7e[_0x12a397(0x170)],_0x8a804b=_0x56d148||_0x26bb7e['parentSegment'];if(!_0x8a804b)return console[_0x12a397(0x10d)](_0x12a397(0x169)),console[_0x12a397(0x10d)](_0x12a397(0x191)),console['error'](_0x12a397(0x151)),console['error'](_0x12a397(0x12d)),console[_0x12a397(0x10d)](_0x12a397(0x186)),console[_0x12a397(0x10d)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x12a397(0x10d)](_0x12a397(0x171)),0x1;try{const _0x30091d=_0x26bb7e['segmentPath'];let _0x25a4f5=_0x8a804b;!_0x48b00f&&_0x30091d&&!_0x8a804b[_0x12a397(0x148)]('/')&&(_0x25a4f5=_0x30091d+'/'+_0x8a804b,_0x26bb7e[_0x12a397(0x100)]&&console['error'](_0x12a397(0x146)+_0x25a4f5));const _0x3e7eb=await withSpinner(_0x12a397(0x107)+_0x25a4f5+_0x12a397(0x190),()=>_0xeb74a[_0x12a397(0x184)][_0x12a397(0x140)](_0x25a4f5),{'verbose':_0x26bb7e['verbose']}),_0xede009=_0x3e7eb[_0x12a397(0x15a)];_0x26bb7e['verbose']&&(console[_0x12a397(0x10d)]('Resolved\x20type:\x20'+_0xede009[_0x12a397(0x12b)]),console['error'](_0x12a397(0x147)+_0xede009[_0x12a397(0x175)]),_0xede009[_0x12a397(0x178)]&&console['error'](_0x12a397(0x17c)+_0xede009[_0x12a397(0x178)]),_0xede009[_0x12a397(0x15c)]&&console[_0x12a397(0x10d)](_0x12a397(0x194)+_0xede009[_0x12a397(0x15c)]));if(_0xede009[_0x12a397(0x12b)]===_0x12a397(0x112)){const _0xc64858=await withSpinner(_0x12a397(0x17b),()=>_0xeb74a[_0x12a397(0x184)][_0x12a397(0x154)](_0xede009[_0x12a397(0x175)]),{'verbose':_0x26bb7e[_0x12a397(0x100)]});await handleSingleObjectOutput(_0xc64858[_0x12a397(0x15a)],_0x26bb7e);}else{if(_0xede009['type']===_0x12a397(0x113)){if(!_0xede009[_0x12a397(0x178)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x12a397(0x14a));const _0x172e29=await withSpinner('Fetching\x20folder\x20details...',()=>_0xeb74a[_0x12a397(0x184)][_0x12a397(0x180)](_0xede009[_0x12a397(0x178)]),{'verbose':_0x26bb7e[_0x12a397(0x100)]});await handleSingleObjectOutput(_0x172e29['data'],_0x26bb7e);}else{if(_0xede009[_0x12a397(0x12b)]===_0x12a397(0x184)){if(!_0xede009[_0x12a397(0x15c)])throw new SDKError(ErrorCode[_0x12a397(0x145)],_0x12a397(0x193));const _0x3ef671=await withSpinner(_0x12a397(0x120),()=>_0xeb74a[_0x12a397(0x184)]['getSegment'](_0xede009[_0x12a397(0x175)],_0xede009[_0x12a397(0x15c)]),{'verbose':_0x26bb7e[_0x12a397(0x100)]});await handleSingleObjectOutput(_0x3ef671['data'],_0x26bb7e);}}}return 0x0;}catch(_0x522318){if(_0x522318 instanceof SDKError)return console['error'](_0x12a397(0x118)+_0x522318['message']),_0x522318['cause']&&console['error'](_0x12a397(0x103)+_0x522318[_0x12a397(0x155)]),0x1;throw _0x522318;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x134);[a27_0x49e00e(0x142)]=a27_0x49e00e(0x121);async[a27_0x49e00e(0x15d)](_0x5ef2eb){const _0x55fe28=a27_0x49e00e,{options:_0x502953,args:_0x26f1a2,tdx:_0x4d1b7d}=_0x5ef2eb,_0x579621=_0x26f1a2[0x0];if(!_0x579621)return console[_0x55fe28(0x10d)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x55fe28(0x10d)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x55fe28(0x10d)](_0x55fe28(0x128)),console['error'](_0x55fe28(0x151)),console[_0x55fe28(0x10d)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x55fe28(0x10d)](_0x55fe28(0x104)),0x1;try{const _0x23cb63=_0x502953['parentSegment'],_0x2b12f5=await resolveSegmentTarget(_0x579621,_0x23cb63,_0x502953[_0x55fe28(0x100)]);_0x502953[_0x55fe28(0x100)]&&console[_0x55fe28(0x10d)](_0x55fe28(0x119)+_0x2b12f5);const _0x3ebe14=await withSpinner(_0x55fe28(0xfe)+_0x579621+_0x55fe28(0x190),()=>_0x4d1b7d['segment'][_0x55fe28(0x140)](_0x2b12f5),{'verbose':_0x502953[_0x55fe28(0x100)]}),_0x2d3e3d=_0x3ebe14[_0x55fe28(0x15a)];_0x502953[_0x55fe28(0x100)]&&(console[_0x55fe28(0x10d)](_0x55fe28(0x153)+_0x2d3e3d[_0x55fe28(0x12b)]),console[_0x55fe28(0x10d)](_0x55fe28(0x147)+_0x2d3e3d['parentId']));if(_0x2d3e3d[_0x55fe28(0x12b)]===_0x55fe28(0x113))return console[_0x55fe28(0x10d)](_0x55fe28(0xfc)),console[_0x55fe28(0x10d)](_0x55fe28(0x18b)),0x1;if(_0x2d3e3d['type']==='parent')return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x55fe28(0x10d)](_0x55fe28(0x152)),0x1;if(!_0x2d3e3d[_0x55fe28(0x15c)])throw new SDKError(ErrorCode[_0x55fe28(0x145)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1eade0=await withSpinner(_0x55fe28(0x163),()=>_0x4d1b7d[_0x55fe28(0x184)][_0x55fe28(0x17d)](_0x2d3e3d[_0x55fe28(0x175)],_0x2d3e3d[_0x55fe28(0x15c)]),{'verbose':_0x502953['verbose']});let _0x24c0d9=_0x1eade0[_0x55fe28(0x15a)];const _0x3f283f=resolveLimit(_0x502953[_0x55fe28(0x13f)],DEFAULT_DISPLAY_LIMIT),_0x46120a=/\bLIMIT\s+\d+/i[_0x55fe28(0x173)](_0x24c0d9);!_0x46120a&&(_0x24c0d9=_0x24c0d9[_0x55fe28(0x14e)]()[_0x55fe28(0x141)](/;+$/,''),_0x24c0d9=_0x55fe28(0x159)+_0x24c0d9+_0x55fe28(0x187)+_0x3f283f);_0x502953[_0x55fe28(0x100)]&&console[_0x55fe28(0x10d)]('SQL\x20query:\x0a'+_0x24c0d9);const _0xabc64c=await withProgressSpinner(_0x55fe28(0x12e),async _0xda75e8=>{const _0x7bddf=_0x55fe28,_0x19a435=await _0x4d1b7d[_0x7bddf(0x116)][_0x7bddf(0x15d)](_0x24c0d9,{'catalog':'td','schema':_0x7bddf(0x16a),'onJobId':_0x248e34=>{const _0x2b04e0=_0x7bddf;_0xda75e8[_0x2b04e0(0x139)](_0x248e34);}});return _0x19a435;},{'verbose':_0x502953['verbose']}),_0x463c8c=_0xabc64c['data'],_0x1c0888=_0x463c8c[_0x55fe28(0x185)]?_0x55fe28(0x164)+_0x463c8c['jobId']+']':'';return console[_0x55fe28(0x10d)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x463c8c[_0x55fe28(0x137)][_0x55fe28(0x127)][_0x55fe28(0x15f)]()+_0x55fe28(0x165)+(_0x55fe28(0x10e)+formatElapsed(_0x463c8c[_0x55fe28(0x137)][_0x55fe28(0x11c)])+_0x1c0888)),await handleQueryOutput(_0x463c8c,_0x502953),0x0;}catch(_0x55a111){if(_0x55a111 instanceof SDKError)return console[_0x55fe28(0x10d)](_0x55fe28(0x10f)+_0x55a111[_0x55fe28(0x174)]+']'),console[_0x55fe28(0x10d)]('\x0a'+_0x55a111[_0x55fe28(0x144)]),0x1;throw _0x55a111;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x18f);[a27_0x49e00e(0x142)]=a27_0x49e00e(0x160);async[a27_0x49e00e(0x15d)](_0x3a0bc7){const _0xc8452a=a27_0x49e00e,{options:_0x30c871,args:_0x383db6,tdx:_0x48b798}=_0x3a0bc7;if(_0x383db6[_0xc8452a(0x132)]===0x0)return console[_0xc8452a(0x10d)](_0xc8452a(0x110)),console[_0xc8452a(0x10d)](_0xc8452a(0x10b)),0x1;const _0x45603b=_0x383db6[0x0];try{_0x30c871[_0xc8452a(0x100)]&&(console[_0xc8452a(0x10d)]('Site:\x20'+_0x30c871['site']),console['error'](_0xc8452a(0x14d)+_0x45603b));const _0x3f6d9b=await withSpinner(_0xc8452a(0x17e)+_0x45603b+_0xc8452a(0x190),()=>_0x48b798[_0xc8452a(0x184)]['resolveParentId'](_0x45603b),{'verbose':_0x30c871[_0xc8452a(0x100)]}),_0xe38bc5=_0x3f6d9b[_0xc8452a(0x15a)];_0x30c871[_0xc8452a(0x100)]&&console[_0xc8452a(0x10d)]('Resolved\x20parent\x20ID:\x20'+_0xe38bc5);const _0x56fb49=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x45603b+_0xc8452a(0x190),()=>_0x48b798[_0xc8452a(0x184)]['listFolders'](_0xe38bc5),{'verbose':_0x30c871[_0xc8452a(0x100)]}),_0x3a2ce1=_0x56fb49['data'];return console['error'](_0xc8452a(0x14b)+_0x3a2ce1['length']+'\x20folder'+(_0x3a2ce1[_0xc8452a(0x132)]!==0x1?'s':'')),await handleSDKOutput(_0x3a2ce1,_0x30c871),0x0;}catch(_0x39fe4e){if(_0x39fe4e instanceof SDKError)return console[_0xc8452a(0x10d)]('Error:\x20'+_0x39fe4e[_0xc8452a(0x144)]),_0x39fe4e[_0xc8452a(0x155)]&&console['error'](_0xc8452a(0x103)+_0x39fe4e[_0xc8452a(0x155)]),0x1;throw _0x39fe4e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x11f);['description']=a27_0x49e00e(0x18d);async[a27_0x49e00e(0x15d)](_0x2f1b1a){const _0x3a5ba3=a27_0x49e00e,{options:_0xcf507e,args:_0x42653e,tdx:_0x17d5d9}=_0x2f1b1a;if(_0x42653e['length']===0x0)return console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x18c)),console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x16e)),0x1;try{const {parentId:_0x5e8f2c,childId:_0x5bd776}=parseSegmentRef(_0x42653e[0x0]);_0xcf507e[_0x3a5ba3(0x100)]&&(console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x176)+_0xcf507e[_0x3a5ba3(0x18e)]),console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x14d)+_0x5e8f2c),_0x5bd776&&console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x115)+_0x5bd776));if(!_0x5bd776)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x3aae6b=await withSpinner(_0x3a5ba3(0x17e)+_0x5e8f2c+_0x3a5ba3(0x190),()=>_0x17d5d9[_0x3a5ba3(0x184)][_0x3a5ba3(0x13b)](_0x5e8f2c),{'verbose':_0xcf507e[_0x3a5ba3(0x100)]}),_0x3c85d1=_0x3aae6b[_0x3a5ba3(0x15a)];_0xcf507e[_0x3a5ba3(0x100)]&&console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x196)+_0x3c85d1);const _0x1fbc33=await withSpinner('Resolving\x20folder\x20\x27'+_0x5bd776+'\x27...',()=>_0x17d5d9[_0x3a5ba3(0x184)][_0x3a5ba3(0x101)](_0x3c85d1,_0x5bd776),{'verbose':_0xcf507e[_0x3a5ba3(0x100)]}),_0x851eac=_0x1fbc33[_0x3a5ba3(0x15a)];_0xcf507e[_0x3a5ba3(0x100)]&&console[_0x3a5ba3(0x10d)](_0x3a5ba3(0x136)+_0x851eac);const _0x226cb6=await withSpinner('Fetching\x20folder\x20\x27'+_0x5bd776+_0x3a5ba3(0x190),()=>_0x17d5d9[_0x3a5ba3(0x184)][_0x3a5ba3(0x180)](_0x851eac),{'verbose':_0xcf507e[_0x3a5ba3(0x100)]});return await handleSDKOutput([_0x226cb6[_0x3a5ba3(0x15a)]],_0xcf507e),0x0;}catch(_0x24a2ac){if(_0x24a2ac instanceof SDKError)return console['error'](_0x3a5ba3(0x118)+_0x24a2ac[_0x3a5ba3(0x144)]),_0x24a2ac[_0x3a5ba3(0x155)]&&console['error'](_0x3a5ba3(0x103)+_0x24a2ac[_0x3a5ba3(0x155)]),0x1;throw _0x24a2ac;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x16f);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x368aeb){const _0x11f5d4=a27_0x49e00e,{options:_0x44570e,args:_0x42917a,tdx:_0x10ed80}=_0x368aeb,_0x105096=_0x42917a[0x0];if(!_0x105096)return console[_0x11f5d4(0x10d)](_0x11f5d4(0x102)),console[_0x11f5d4(0x10d)](_0x11f5d4(0x135)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x11f5d4(0x10d)](_0x11f5d4(0x151)),console[_0x11f5d4(0x10d)](_0x11f5d4(0x172)),console[_0x11f5d4(0x10d)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x38fa0e=_0x44570e[_0x11f5d4(0x170)],_0x1ae828=await resolveSegmentTarget(_0x105096,_0x38fa0e,_0x44570e[_0x11f5d4(0x100)]);_0x44570e[_0x11f5d4(0x100)]&&console[_0x11f5d4(0x10d)]('Target\x20path:\x20'+_0x1ae828);const _0xf09265=await withSpinner('Resolving\x20\x27'+_0x105096+_0x11f5d4(0x190),()=>_0x10ed80['segment'][_0x11f5d4(0x140)](_0x1ae828),{'verbose':_0x44570e[_0x11f5d4(0x100)]}),_0xf9c8a3=_0xf09265[_0x11f5d4(0x15a)];_0x44570e[_0x11f5d4(0x100)]&&(console[_0x11f5d4(0x10d)](_0x11f5d4(0x153)+_0xf9c8a3[_0x11f5d4(0x12b)]),console[_0x11f5d4(0x10d)](_0x11f5d4(0x147)+_0xf9c8a3[_0x11f5d4(0x175)]));if(_0xf9c8a3[_0x11f5d4(0x12b)]===_0x11f5d4(0x113))return console[_0x11f5d4(0x10d)](_0x11f5d4(0x166)),console['error'](_0x11f5d4(0x156)),0x1;if(_0xf9c8a3['type']===_0x11f5d4(0x112))return console[_0x11f5d4(0x10d)](_0x11f5d4(0x181)),console['error']('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0xf9c8a3[_0x11f5d4(0x15c)])throw new SDKError(ErrorCode[_0x11f5d4(0x145)],_0x11f5d4(0x193));const _0x36a225=await withSpinner(_0x11f5d4(0x163),()=>_0x10ed80['segment']['getSegmentSQL'](_0xf9c8a3[_0x11f5d4(0x175)],_0xf9c8a3[_0x11f5d4(0x15c)]),{'verbose':_0x44570e[_0x11f5d4(0x100)]}),_0x1993e0=_0x36a225[_0x11f5d4(0x15a)];return _0x44570e[_0x11f5d4(0x195)]===_0x11f5d4(0x14c)||_0x44570e[_0x11f5d4(0x195)]==='jsonl'?await handleSDKOutput([{'sql':_0x1993e0}],_0x44570e):console[_0x11f5d4(0x106)](_0x1993e0),0x0;}catch(_0xf4e721){if(_0xf4e721 instanceof SDKError)return console[_0x11f5d4(0x10d)](_0x11f5d4(0x118)+_0xf4e721[_0x11f5d4(0x144)]),_0xf4e721[_0x11f5d4(0x155)]&&console[_0x11f5d4(0x10d)](_0x11f5d4(0x103)+_0xf4e721[_0x11f5d4(0x155)]),0x1;throw _0xf4e721;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x12a);[a27_0x49e00e(0x142)]=a27_0x49e00e(0x12f);async[a27_0x49e00e(0x15d)](_0x507f5b){const _0x1b0b66=a27_0x49e00e,{options:_0x539a0f,args:_0x17c545,tdx:_0x568fc0}=_0x507f5b,_0x3c2c43=_0x539a0f;if(_0x17c545['length']<0x2)return console[_0x1b0b66(0x10d)](_0x1b0b66(0x11b)),console[_0x1b0b66(0x10d)](_0x1b0b66(0x197)),0x1;const _0x199bf6=_0x17c545[0x0],_0x4c2e9d=_0x17c545[0x1];_0x3c2c43[_0x1b0b66(0x100)]&&(console[_0x1b0b66(0x10d)](_0x1b0b66(0x176)+_0x3c2c43[_0x1b0b66(0x18e)]),console[_0x1b0b66(0x10d)](_0x1b0b66(0x157)+_0x199bf6),console[_0x1b0b66(0x10d)](_0x1b0b66(0x115)+_0x4c2e9d));let _0x39b957;if(_0x3c2c43[_0x1b0b66(0x15b)]){const _0x202fa1=_0x3c2c43[_0x1b0b66(0x15b)],_0x2229cf=await withSpinner(_0x1b0b66(0x17e)+_0x199bf6+_0x1b0b66(0x190),()=>_0x568fc0['segment']['resolveParentId'](_0x199bf6),{'verbose':_0x3c2c43[_0x1b0b66(0x100)]}),_0x192b47=_0x2229cf['data'],_0x14c01e=await withSpinner(_0x1b0b66(0x138)+_0x202fa1+_0x1b0b66(0x190),()=>_0x568fc0[_0x1b0b66(0x184)][_0x1b0b66(0x101)](_0x192b47,_0x202fa1),{'verbose':_0x3c2c43[_0x1b0b66(0x100)]});_0x39b957=_0x14c01e[_0x1b0b66(0x15a)],_0x3c2c43[_0x1b0b66(0x100)]&&console[_0x1b0b66(0x10d)](_0x1b0b66(0x198)+_0x39b957);}const _0x35e599={'name':_0x4c2e9d,'description':_0x3c2c43['description'],'parentFolderId':_0x39b957},_0x34f5fe=await withSpinner('Creating\x20folder\x20\x27'+_0x4c2e9d+_0x1b0b66(0x190),()=>_0x568fc0[_0x1b0b66(0x184)][_0x1b0b66(0x11a)](_0x199bf6,_0x35e599),{'verbose':_0x3c2c43['verbose']}),_0x50fcf7=_0x34f5fe['data'];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x50fcf7[_0x1b0b66(0x15e)]+_0x1b0b66(0x125)+_0x50fcf7['id']),await handleSDKOutput([_0x50fcf7],_0x3c2c43),0x0;}}function a27_0x523c(_0x453ed4,_0x543fe3){_0x453ed4=_0x453ed4-0xfc;const _0x34d199=a27_0x34d1();let _0x523c23=_0x34d199[_0x453ed4];return _0x523c23;}export class SegmentViewCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x161);[a27_0x49e00e(0x142)]=a27_0x49e00e(0x126);async[a27_0x49e00e(0x15d)](_0x58abbf){const _0x3a347b=a27_0x49e00e,{options:_0x1da37b,args:_0x59d9fc,tdx:_0xbe931d}=_0x58abbf,_0x5f53c3=_0x59d9fc[0x0];if(!_0x5f53c3)return console[_0x3a347b(0x10d)](_0x3a347b(0x189)),console[_0x3a347b(0x10d)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x3a347b(0x10d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x3a347b(0x10d)]('Options:'),console[_0x3a347b(0x10d)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3a347b(0x10d)](_0x3a347b(0x151)),console[_0x3a347b(0x10d)](_0x3a347b(0x168)),console[_0x3a347b(0x10d)](_0x3a347b(0x11e)),console[_0x3a347b(0x10d)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3a347b(0x10d)](_0x3a347b(0x13d)),0x1;try{const _0x29d452=_0x1da37b[_0x3a347b(0x170)],_0x385fef=await resolveSegmentTarget(_0x5f53c3,_0x29d452,_0x1da37b[_0x3a347b(0x100)]);_0x1da37b[_0x3a347b(0x100)]&&console['error']('Target\x20path:\x20'+_0x385fef);const _0x256205=await withSpinner(_0x3a347b(0xfe)+_0x5f53c3+_0x3a347b(0x190),()=>_0xbe931d[_0x3a347b(0x184)]['resolvePathToResource'](_0x385fef),{'verbose':_0x1da37b[_0x3a347b(0x100)]}),_0x32496d=_0x256205[_0x3a347b(0x15a)];_0x1da37b[_0x3a347b(0x100)]&&(console[_0x3a347b(0x10d)]('Resolved\x20type:\x20'+_0x32496d['type']),console[_0x3a347b(0x10d)](_0x3a347b(0x147)+_0x32496d[_0x3a347b(0x175)]),_0x32496d[_0x3a347b(0x178)]&&console[_0x3a347b(0x10d)](_0x3a347b(0x17c)+_0x32496d[_0x3a347b(0x178)]),_0x32496d['segmentId']&&console[_0x3a347b(0x10d)](_0x3a347b(0x194)+_0x32496d[_0x3a347b(0x15c)]));if(_0x1da37b['web']){if(_0x32496d[_0x3a347b(0x12b)]===_0x3a347b(0x113))return console[_0x3a347b(0x10d)](_0x3a347b(0x117)),0x1;if(_0x32496d[_0x3a347b(0x12b)]===_0x3a347b(0x112))return console[_0x3a347b(0x10d)](_0x3a347b(0x108)),console[_0x3a347b(0x10d)](_0x3a347b(0x14f)),0x1;if(!_0x32496d[_0x3a347b(0x15c)])throw new SDKError(ErrorCode[_0x3a347b(0x145)],_0x3a347b(0x193));const _0xeded19=getConsoleNextUrl(_0x1da37b[_0x3a347b(0x18e)],_0x3a347b(0x10a)+_0x32496d[_0x3a347b(0x175)]+_0x3a347b(0x16c)+_0x32496d['segmentId']);return console['error'](a27_0x532928[_0x3a347b(0x133)]('✔')+_0x3a347b(0x162)+a27_0x532928[_0x3a347b(0x167)](_0xeded19)),openBrowser(_0xeded19),0x0;}if(_0x32496d['type']==='folder'){if(!_0x32496d[_0x3a347b(0x178)])throw new SDKError(ErrorCode[_0x3a347b(0x111)],_0x3a347b(0x14a));const _0x9c934f=await withSpinner('Fetching\x20folder\x20details...',()=>_0xbe931d['segment'][_0x3a347b(0x180)](_0x32496d[_0x3a347b(0x178)]),{'verbose':_0x1da37b[_0x3a347b(0x100)]});await handleSingleObjectOutput(_0x9c934f[_0x3a347b(0x15a)],_0x1da37b);}else{if(_0x32496d[_0x3a347b(0x12b)]===_0x3a347b(0x184)){if(!_0x32496d[_0x3a347b(0x15c)])throw new SDKError(ErrorCode[_0x3a347b(0x145)],_0x3a347b(0x193));const _0x21e3d4=await withSpinner(_0x3a347b(0x120),()=>_0xbe931d[_0x3a347b(0x184)][_0x3a347b(0x179)](_0x32496d[_0x3a347b(0x175)],_0x32496d[_0x3a347b(0x15c)]),{'verbose':_0x1da37b[_0x3a347b(0x100)]}),_0xd248f8=getConsoleNextUrl(_0x1da37b[_0x3a347b(0x18e)],_0x3a347b(0x10a)+_0x32496d[_0x3a347b(0x175)]+_0x3a347b(0x16c)+_0x32496d['segmentId']),_0x3bf5f1=_0x21e3d4[_0x3a347b(0x15a)];_0x3bf5f1[_0x3a347b(0x150)]=_0xd248f8,await handleSingleObjectOutput(_0x3bf5f1,_0x1da37b);}else return console[_0x3a347b(0x10d)](_0x3a347b(0x114)),console[_0x3a347b(0x10d)](_0x3a347b(0x129)),0x1;}return 0x0;}catch(_0x3396d7){if(_0x3396d7 instanceof SDKError)return console[_0x3a347b(0x10d)]('Error:\x20'+_0x3396d7['message']),_0x3396d7[_0x3a347b(0x155)]&&console[_0x3a347b(0x10d)](_0x3a347b(0x103)+_0x3396d7[_0x3a347b(0x155)]),0x1;throw _0x3396d7;}}}export const SegmentInfoCommand=SegmentViewCommand;function a27_0x34d1(){const _0x4e91e8=['folderId','getSegment','888762muYaQb','Fetching\x20parent\x20segment\x20details...','Folder\x20ID:\x20','getSegmentSQL','Resolving\x20parent\x20segment\x20\x27','Resolved\x20YAML\x20file:\x20','getFolder','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','210613pZkMWd','Usage:\x20tdx\x20sg\x20desc\x20<name>','segment','jobId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20Parent\x20segment:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Folder\x20reference\x20is\x20required','Show\x20segment\x20folder\x20details','site','segment:folder:list','\x27...','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Segment\x20ID:\x20','format','Resolved\x20parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','44586EicRAz','Resolving\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','verbose','resolveFolderId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','3472794iwhsvJ','log','Resolving\x20path\x20\x27','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','folderPath','/app/ps/','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:desc','error','in\x20','✖\x20Query\x20failed\x20[','Error:\x20Parent\x20segment\x20name\x20is\x20required','SEGMENT_FOLDER_NOT_FOUND','parent','folder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20name:\x20','query','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20','Target\x20path:\x20','createFolder','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','elapsedTimeMillis','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','segment:folder:show','Fetching\x20segment\x20details...','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Full\x20path:\x20','527980yQNYXy','\x27\x20with\x20ID:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view','segment:folder:create','type','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Executing\x20segment\x20query...','Create\x20segment\x20folder\x20for\x20organization','259368bdRVdD','(root)','length','green','segment:show','Usage:\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20folder\x20ID:\x20','stats','Resolving\x20parent\x20folder\x20\x27','setJobId','20WiusvR','resolveParentId','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','fullPath','limit','resolvePathToResource','replace','description','2648120iQOyIa','message','SEGMENT_NOT_FOUND','Resolved\x20relative\x20path\x20to:\x20','Parent\x20ID:\x20','includes','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','✔\x20Found\x20','json','Parent\x20name:\x20','trim','Use:\x20tdx\x20ps\x20view\x20-w','url','Examples:','Use:\x20tdx\x20ps\x20show','Resolved\x20type:\x20','getParent','cause','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Parent\x20segment:\x20','27CtFFIX','SELECT\x20*\x20FROM\x20(\x0a','data','parentFolder','segmentId','execute','name','toLocaleString','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','segment:view','\x20Opening\x20','Fetching\x20SQL\x20for\x20segment...','\x20[Job\x20ID:\x20','\x20rows\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','cyan','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Error:\x20Path\x20or\x20name\x20is\x20required','information_schema','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','/e/','\x20\x20Segment\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','segment:sql','parentSegment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','test','code','parentId','Site:\x20','1134geBzBG'];a27_0x34d1=function(){return _0x4e91e8;};return a27_0x34d1();}export class SegmentDescCommand extends BaseCommand{[a27_0x49e00e(0x15e)]=a27_0x49e00e(0x10c);[a27_0x49e00e(0x142)]=a27_0x49e00e(0x11d);async[a27_0x49e00e(0x15d)](_0x8f53fc){const _0xb2ebde=a27_0x49e00e,{options:_0x3edd9a,args:_0x51b837,tdx:_0xb937bf}=_0x8f53fc,_0x4ae33e=_0x51b837[0x0];if(!_0x4ae33e)return console[_0xb2ebde(0x10d)](_0xb2ebde(0x102)),console[_0xb2ebde(0x10d)](_0xb2ebde(0x183)),console[_0xb2ebde(0x10d)](_0xb2ebde(0x16b)),console['error'](_0xb2ebde(0x151)),console['error'](_0xb2ebde(0x122)),console[_0xb2ebde(0x10d)](_0xb2ebde(0x192)),0x1;try{const _0x20af3b=_0x3edd9a['parentSegment'],_0x1b564a=await resolveSegmentTarget(_0x4ae33e,_0x20af3b,_0x3edd9a[_0xb2ebde(0x100)]);_0x3edd9a[_0xb2ebde(0x100)]&&console['error']('Target\x20path:\x20'+_0x1b564a);const _0xa143a1=await withSpinner('Resolving\x20\x27'+_0x4ae33e+_0xb2ebde(0x190),()=>_0xb937bf['segment'][_0xb2ebde(0x140)](_0x1b564a),{'verbose':_0x3edd9a[_0xb2ebde(0x100)]}),_0x1b8801=_0xa143a1[_0xb2ebde(0x15a)];_0x3edd9a['verbose']&&(console[_0xb2ebde(0x10d)](_0xb2ebde(0x153)+_0x1b8801[_0xb2ebde(0x12b)]),console[_0xb2ebde(0x10d)]('Parent\x20ID:\x20'+_0x1b8801[_0xb2ebde(0x175)]));if(_0x1b8801['type']===_0xb2ebde(0x113))return console[_0xb2ebde(0x10d)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0xb2ebde(0x10d)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1b8801[_0xb2ebde(0x12b)]===_0xb2ebde(0x112))return console[_0xb2ebde(0x10d)](_0xb2ebde(0xff)),console[_0xb2ebde(0x10d)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x1b8801[_0xb2ebde(0x15c)])throw new SDKError(ErrorCode[_0xb2ebde(0x145)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x50c2c8=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xb937bf[_0xb2ebde(0x184)][_0xb2ebde(0x17d)](_0x1b8801[_0xb2ebde(0x175)],_0x1b8801[_0xb2ebde(0x15c)]),{'verbose':_0x3edd9a[_0xb2ebde(0x100)]}),_0x564063=_0x50c2c8[_0xb2ebde(0x15a)],_0x4a9c6b=await executeSchemaQuery(_0x564063,_0xb937bf,_0x3edd9a);return await handleQueryOutput(_0x4a9c6b,_0x3edd9a),0x0;}catch(_0x2fdec3){if(_0x2fdec3 instanceof SDKError)return console[_0xb2ebde(0x10d)]('Error:\x20'+_0x2fdec3['message']),_0x2fdec3[_0xb2ebde(0x155)]&&console[_0xb2ebde(0x10d)]('\x20\x20Cause:\x20'+_0x2fdec3[_0xb2ebde(0x155)]),0x1;throw _0x2fdec3;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a28_0x59a1(){const _0x22f1a6=['\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','yellow','4vWDtmD','description','8245269VGfdrj','includes','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','18EJlvZg','length','Parent:\x20','segments','Resolving\x20parent\x20segment\x20\x27','resolveParentId','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','187Uurcav','2ZrwDMQ','1710863OPqaJI','site','verbose','resolveFolderId','Resolved\x20folder\x20ID:\x20','execute','noCountPopulation','segment:create','Create\x20child\x20segment\x20with\x20filtering\x20rules','error','\x20\x20\x20Path:\x20','invisible','segment','3134935IJNAwM','type','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','kind','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','4237011Mgaqvv','169370swKkVA','data','\x27...','folder','Target\x20path:\x20','372828CkvJfP','8jewzVq','\x27\x20with\x20ID:\x20','Parent\x20path:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','resolvePathToResource','6557340mipaxB','folderId'];a28_0x59a1=function(){return _0x22f1a6;};return a28_0x59a1();}function a28_0xc251(_0x3dc1fc,_0xdb427b){_0x3dc1fc=_0x3dc1fc-0x181;const _0x59a180=a28_0x59a1();let _0xc251cd=_0x59a180[_0x3dc1fc];return _0xc251cd;}const a28_0x1f6ea7=a28_0xc251;(function(_0x1fe865,_0x78c3a9){const _0x522c0b=a28_0xc251,_0x10108c=_0x1fe865();while(!![]){try{const _0x85c696=parseInt(_0x522c0b(0x1a5))/0x1+parseInt(_0x522c0b(0x18c))/0x2*(-parseInt(_0x522c0b(0x19f))/0x3)+parseInt(_0x522c0b(0x1b1))/0x4*(-parseInt(_0x522c0b(0x19a))/0x5)+parseInt(_0x522c0b(0x184))/0x6*(parseInt(_0x522c0b(0x18d))/0x7)+parseInt(_0x522c0b(0x1a6))/0x8*(parseInt(_0x522c0b(0x181))/0x9)+parseInt(_0x522c0b(0x1a0))/0xa*(parseInt(_0x522c0b(0x18b))/0xb)+parseInt(_0x522c0b(0x1ac))/0xc;if(_0x85c696===_0x78c3a9)break;else _0x10108c['push'](_0x10108c['shift']());}catch(_0x204be2){_0x10108c['push'](_0x10108c['shift']());}}}(a28_0x59a1,0xc785e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x3f604c from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a28_0x1f6ea7(0x194);['description']=a28_0x1f6ea7(0x195);async[a28_0x1f6ea7(0x192)](_0x12ad75){const _0x414989=a28_0x1f6ea7;console[_0x414989(0x196)](a28_0x3f604c[_0x414989(0x1b0)](_0x414989(0x1a9))),console[_0x414989(0x196)](a28_0x3f604c[_0x414989(0x1b0)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x510b0e,args:_0x1ff359,tdx:_0x1fde89}=_0x12ad75,_0x5852f5=_0x510b0e;if(_0x1ff359[_0x414989(0x185)]===0x0)return console[_0x414989(0x196)](_0x414989(0x18a)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x414989(0x196)]('Examples:'),console[_0x414989(0x196)](_0x414989(0x183)),console['error'](_0x414989(0x1aa)),console[_0x414989(0x196)](_0x414989(0x1ae)),0x1;const _0x3866bd=_0x1ff359[0x0],_0x2f3223=_0x510b0e['segmentPath'];let _0x6078f1=_0x3866bd;_0x2f3223&&!_0x3866bd[_0x414989(0x182)]('/')&&(_0x6078f1=_0x2f3223+'/'+_0x3866bd,_0x5852f5['verbose']&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x6078f1));const _0x26d9e5=parsePath(_0x6078f1);if(_0x26d9e5[_0x414989(0x187)][_0x414989(0x185)]<0x2)return console[_0x414989(0x196)](_0x414989(0x19c)),console[_0x414989(0x196)](_0x414989(0x19e)),0x1;const _0x2271d8=_0x26d9e5[_0x414989(0x187)][0x0],_0x209909=getBaseName(_0x6078f1),_0x20995f=getParentPath(_0x6078f1);_0x5852f5[_0x414989(0x18f)]&&(console[_0x414989(0x196)](_0x414989(0x1af)+_0x5852f5[_0x414989(0x18e)]),console[_0x414989(0x196)](_0x414989(0x1a4)+_0x6078f1),console[_0x414989(0x196)](_0x414989(0x186)+_0x2271d8),console['error']('Segment\x20name:\x20'+_0x209909),console['error'](_0x414989(0x1a8)+_0x20995f));const _0x53d8f0=await withSpinner(_0x414989(0x188)+_0x2271d8+_0x414989(0x1a2),()=>_0x1fde89[_0x414989(0x199)][_0x414989(0x189)](_0x2271d8),{'verbose':_0x5852f5['verbose']}),_0x4aff78=_0x53d8f0['data'];let _0x3f0d70;if(_0x26d9e5[_0x414989(0x187)][_0x414989(0x185)]>0x2){const _0x211536=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x20995f+'\x27...',()=>_0x1fde89['segment'][_0x414989(0x1ab)](_0x20995f),{'verbose':_0x5852f5[_0x414989(0x18f)]}),_0x3853b9=_0x211536[_0x414989(0x1a1)];if(_0x3853b9[_0x414989(0x19b)]!=='folder'&&_0x3853b9['type']!=='parent')return console[_0x414989(0x196)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x3f0d70=_0x3853b9[_0x414989(0x1ad)];}else{if(_0x5852f5[_0x414989(0x1a3)]){const _0x3404ff=await withSpinner('Resolving\x20folder\x20\x27'+_0x5852f5['folder']+'\x27...',()=>_0x1fde89[_0x414989(0x199)][_0x414989(0x190)](_0x4aff78,_0x5852f5[_0x414989(0x1a3)]),{'verbose':_0x5852f5[_0x414989(0x18f)]});_0x3f0d70=_0x3404ff[_0x414989(0x1a1)];}}_0x5852f5[_0x414989(0x18f)]&&_0x3f0d70&&console[_0x414989(0x196)](_0x414989(0x191)+_0x3f0d70);const _0x32fe68=await loadJSONFromOptions(_0x5852f5['rule'],_0x5852f5['ruleFile']),_0xd21501={'name':_0x209909,'description':_0x5852f5[_0x414989(0x1b2)],'rule':_0x32fe68,'kind':_0x5852f5['kind']!==undefined?parseInt(_0x5852f5[_0x414989(0x19d)],0xa):undefined,'isVisible':_0x5852f5[_0x414989(0x198)]?![]:undefined,'segmentFolderId':_0x3f0d70,'countPopulation':_0x5852f5[_0x414989(0x193)]?![]:undefined},_0x4b63b7=await withSpinner('Creating\x20segment\x20\x27'+_0x209909+_0x414989(0x1a2),()=>_0x1fde89[_0x414989(0x199)]['createSegment'](_0x4aff78,_0xd21501),{'verbose':_0x5852f5[_0x414989(0x18f)]}),_0x35c59d=_0x4b63b7['data'];return console[_0x414989(0x196)]('✔\x20Created\x20segment\x20\x27'+_0x35c59d['name']+_0x414989(0x1a7)+_0x35c59d['id']),_0x6078f1!==_0x3866bd&&console[_0x414989(0x196)](_0x414989(0x197)+_0x6078f1),await handleSDKOutput([_0x35c59d],_0x5852f5),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x1cea37=a29_0x583e;function a29_0x1961(){const _0x24bb40=['43085cfqizX','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','11257IXWOLE','260bsbRGV','parentSegment','Listing\x20fields\x20for\x20\x27','Site:\x20','34oHwADz','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','json','174XzucLA','6jrfRnh','segment:fields','3184377kevVWD','Parent\x20segment:\x20','site','634796DljXVx','\x20field','10737352GZTOrX','name','description','✔\x20Found\x20','error','9215569tgraQT','listFields','verbose','jsonl','4077xmOIfw'];a29_0x1961=function(){return _0x24bb40;};return a29_0x1961();}(function(_0x58cfe7,_0x271075){const _0x39cbf6=a29_0x583e,_0x335c78=_0x58cfe7();while(!![]){try{const _0x592e02=-parseInt(_0x39cbf6(0x153))/0x1*(-parseInt(_0x39cbf6(0x158))/0x2)+parseInt(_0x39cbf6(0x13f))/0x3*(parseInt(_0x39cbf6(0x144))/0x4)+parseInt(_0x39cbf6(0x150))/0x5*(parseInt(_0x39cbf6(0x13e))/0x6)+parseInt(_0x39cbf6(0x141))/0x7+-parseInt(_0x39cbf6(0x146))/0x8+parseInt(_0x39cbf6(0x14f))/0x9*(parseInt(_0x39cbf6(0x154))/0xa)+parseInt(_0x39cbf6(0x14b))/0xb;if(_0x592e02===_0x271075)break;else _0x335c78['push'](_0x335c78['shift']());}catch(_0xfab47e){_0x335c78['push'](_0x335c78['shift']());}}}(a29_0x1961,0xb003f));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a29_0x583e(_0x2a4262,_0x31dc4c){_0x2a4262=_0x2a4262-0x13c;const _0x1961e0=a29_0x1961();let _0x583eb2=_0x1961e0[_0x2a4262];return _0x583eb2;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x1cea37(0x147)]=a29_0x1cea37(0x140);[a29_0x1cea37(0x148)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x478bbf){const _0x2621d0=a29_0x1cea37,{options:_0x554cdd,args:_0x1b9395,tdx:_0x48aa33}=_0x478bbf,_0x3b0f12=_0x1b9395[0x0]||_0x554cdd[_0x2621d0(0x155)];if(!_0x3b0f12)return console[_0x2621d0(0x14a)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2621d0(0x14a)](_0x2621d0(0x152)),console[_0x2621d0(0x14a)](_0x2621d0(0x13c)),0x1;_0x554cdd[_0x2621d0(0x14d)]&&(console[_0x2621d0(0x14a)](_0x2621d0(0x157)+_0x554cdd[_0x2621d0(0x143)]),console[_0x2621d0(0x14a)](_0x2621d0(0x142)+_0x3b0f12));const _0x12a5eb=await withSpinner(_0x2621d0(0x156)+_0x3b0f12+'\x27...',()=>_0x48aa33['segment'][_0x2621d0(0x14c)](_0x3b0f12),{'verbose':_0x554cdd[_0x2621d0(0x14d)]}),_0x1bac90=_0x12a5eb['data'];console[_0x2621d0(0x14a)](_0x2621d0(0x149)+_0x1bac90[_0x2621d0(0x151)]+_0x2621d0(0x145)+(_0x1bac90[_0x2621d0(0x151)]!==0x1?'s':''));if(_0x554cdd[_0x2621d0(0x13d)]||_0x554cdd[_0x2621d0(0x14e)])return await handleSDKOutput(_0x1bac90,_0x554cdd),0x0;return displayFieldsHumanReadable(_0x1bac90,_0x3b0f12),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x46078a=a30_0x68ea;(function(_0x33bd83,_0x12adf8){const _0x85795e=a30_0x68ea,_0xa2144d=_0x33bd83();while(!![]){try{const _0x482cbe=parseInt(_0x85795e(0x186))/0x1*(parseInt(_0x85795e(0x16b))/0x2)+parseInt(_0x85795e(0x195))/0x3*(parseInt(_0x85795e(0x183))/0x4)+parseInt(_0x85795e(0x175))/0x5+-parseInt(_0x85795e(0x16a))/0x6*(parseInt(_0x85795e(0x1a5))/0x7)+-parseInt(_0x85795e(0x188))/0x8*(parseInt(_0x85795e(0x174))/0x9)+parseInt(_0x85795e(0x1a4))/0xa+parseInt(_0x85795e(0x17a))/0xb*(-parseInt(_0x85795e(0x18b))/0xc);if(_0x482cbe===_0x12adf8)break;else _0xa2144d['push'](_0xa2144d['shift']());}catch(_0x18044d){_0xa2144d['push'](_0xa2144d['shift']());}}}(a30_0x4989,0xd01f7));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x39a734 from'chalk';function a30_0x68ea(_0x5afd27,_0x2116ad){_0x5afd27=_0x5afd27-0x166;const _0x498977=a30_0x4989();let _0x68eab5=_0x498977[_0x5afd27];return _0x68eab5;}import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x44ea1d from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a30_0x4989(){const _0x522603=['relativePath','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','no_parent','\x0aPull\x20summary\x20for\x20\x27','red','repeat','segments','\x20unchanged\x20files','description','files','isNew','529662RAsvxf','50986FzQvLg','dryRun','verbose','absolutePath','utf-8','length','Pulling\x20segments\x20from\x20\x27','cwd','green','9ZWePwi','3887225suWhxf','type','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)','\x20=\x20','journeyVersions','11PXxyZc','parentSegment','filter','activations','counts','\x20segments','Parent\x20segment:\x20','data','parent_segment','4bHOAcT','hasChanges','segment','21ZIlQuq','journeys','9151880VMEJoZ','helpText','\x20versions)','6922332maclgN','error','targetDir','\x20\x20🎯\x20','Error:\x20','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x27...','✔\x20Context\x20set:\x20','\x20with\x20','Site:\x20','3161103TLuxAA','\x20\x20🗺️\x20\x20','cyan','\x20new\x20files','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','session','name','file','errorCode','✔\x20Pulled\x20','dirname','parentName','diff','yes','5599260XowIOS','28mkOiij','yellow','site','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','dim','pullSegments','Aborted.','Target\x20resource:\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'];a30_0x4989=function(){return _0x522603;};return a30_0x4989();}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x46078a(0x19c)]='segment:pull';[a30_0x46078a(0x167)]=a30_0x46078a(0x199);async['execute'](_0x1db728){const _0x599e48=a30_0x46078a,{options:_0x723ded,args:_0x8fc690,tdx:_0x27df2c}=_0x1db728,_0x548c1d=_0x723ded,_0x4320c8=await resolveTarget({'arg':_0x8fc690[0x0],'contextParent':_0x723ded[_0x599e48(0x17b)],'cwd':process[_0x599e48(0x172)]()});if(!isSuccessfulResolution(_0x4320c8))return _0x4320c8[_0x599e48(0x19e)]===_0x599e48(0x1b1)?(console['error'](a30_0x39a734[_0x599e48(0x1a6)](_0x599e48(0x19a))),console[_0x599e48(0x18c)](_0x599e48(0x177)),console[_0x599e48(0x18c)](_0x599e48(0x1b0)),console[_0x599e48(0x18c)](_0x599e48(0x1a8))):(console['error'](a30_0x39a734[_0x599e48(0x1b3)](_0x599e48(0x18f)+_0x4320c8['message']+'\x0a')),_0x4320c8[_0x599e48(0x189)]&&console[_0x599e48(0x18c)](a30_0x39a734[_0x599e48(0x197)](_0x4320c8['helpText']))),0x1;const _0xed543c=_0x4320c8[_0x599e48(0x1a1)],_0x360af5=_0x4320c8[_0x599e48(0x18d)],_0x39cd9c=_0x4320c8[_0x599e48(0x176)]===_0x599e48(0x19d)?_0x4320c8['resourceName']:undefined;_0x548c1d['verbose']&&(console[_0x599e48(0x18c)](_0x599e48(0x194)+_0x548c1d[_0x599e48(0x1a7)]),console[_0x599e48(0x18c)](_0x599e48(0x180)+_0xed543c),_0x39cd9c&&console[_0x599e48(0x18c)](_0x599e48(0x1ac)+_0x39cd9c));const _0x5bc191=await withProgressSpinner(_0x599e48(0x171)+_0xed543c+_0x599e48(0x191),_0x4c10bf=>_0x27df2c[_0x599e48(0x185)][_0x599e48(0x1aa)](_0xed543c,{'targetDir':_0x360af5,'targetResourceName':_0x39cd9c,'verbose':_0x548c1d[_0x599e48(0x16d)],'progress':{'update':_0x2906a1=>{const _0x4a507e=_0x599e48;_0x4c10bf['setPhase'](_0x2906a1),_0x548c1d[_0x4a507e(0x16d)]&&console[_0x4a507e(0x18c)]('\x20\x20'+_0x2906a1);}}}),{'verbose':_0x548c1d[_0x599e48(0x16d)]}),_0x418605=_0x5bc191[_0x599e48(0x181)];if(_0x418605[_0x599e48(0x17e)]['segments']===0x0&&_0x418605[_0x599e48(0x17e)][_0x599e48(0x187)]===0x0)return console[_0x599e48(0x18c)](a30_0x39a734[_0x599e48(0x1a6)](_0x599e48(0x1ad)+_0x418605[_0x599e48(0x1a1)]+'\x27')),0x0;const _0x5e17d2=_0x418605['files'][_0x599e48(0x17c)](_0x22cc03=>_0x22cc03[_0x599e48(0x169)]),_0x9a1ab9=_0x418605[_0x599e48(0x168)][_0x599e48(0x17c)](_0x401824=>!_0x401824['isNew']&&_0x401824[_0x599e48(0x184)]),_0x3128b8=_0x418605[_0x599e48(0x168)][_0x599e48(0x17c)](_0xe911c6=>!_0xe911c6[_0x599e48(0x169)]&&!_0xe911c6[_0x599e48(0x184)]);console[_0x599e48(0x18c)](_0x599e48(0x1b2)+_0x418605[_0x599e48(0x1a1)]+'\x27:'),console[_0x599e48(0x18c)](_0x599e48(0x18e)+a30_0x39a734[_0x599e48(0x197)](_0x418605['counts'][_0x599e48(0x1b5)]+_0x599e48(0x17f))+_0x599e48(0x193)+a30_0x39a734[_0x599e48(0x197)](_0x418605[_0x599e48(0x17e)][_0x599e48(0x17d)]+'\x20activations'));if(_0x418605[_0x599e48(0x17e)][_0x599e48(0x187)]>0x0){const _0x4bb8ae=_0x418605[_0x599e48(0x17e)][_0x599e48(0x179)]>_0x418605[_0x599e48(0x17e)][_0x599e48(0x187)]?'\x20('+_0x418605[_0x599e48(0x17e)][_0x599e48(0x179)]+_0x599e48(0x18a):'';console[_0x599e48(0x18c)](_0x599e48(0x196)+a30_0x39a734['cyan'](_0x418605['counts']['journeys']+'\x20journeys')+a30_0x39a734[_0x599e48(0x1a9)](_0x4bb8ae));}console[_0x599e48(0x18c)]('\x20\x20'+a30_0x39a734[_0x599e48(0x173)]('+\x20'+_0x5e17d2[_0x599e48(0x170)]+_0x599e48(0x198))),console['error']('\x20\x20'+a30_0x39a734[_0x599e48(0x1a6)]('~\x20'+_0x9a1ab9[_0x599e48(0x170)]+'\x20changed\x20files')),console['error']('\x20\x20'+a30_0x39a734['dim']('=\x20'+_0x3128b8[_0x599e48(0x170)]+_0x599e48(0x166))),console[_0x599e48(0x18c)]('\x20\x20Target:\x20'+a30_0x39a734['cyan'](_0x418605[_0x599e48(0x18d)])+'\x0a');if(_0x9a1ab9[_0x599e48(0x170)]>0x0)for(const _0x7934cd of _0x9a1ab9){console[_0x599e48(0x18c)]('\x0aChanges\x20to\x20\x27'+_0x7934cd[_0x599e48(0x1ae)]+'\x27:'),console['error']('─'[_0x599e48(0x1b4)](0x3c)),console[_0x599e48(0x18c)](_0x7934cd[_0x599e48(0x1a2)]),console['error']('─'[_0x599e48(0x1b4)](0x3c));}if(_0x548c1d[_0x599e48(0x16c)])return console['error'](a30_0x39a734[_0x599e48(0x1a6)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x5e17d2['length']===0x0&&_0x9a1ab9[_0x599e48(0x170)]===0x0)return console['error'](a30_0x39a734['green'](_0x599e48(0x190))),saveSessionContext({'parent_segment':_0x418605[_0x599e48(0x1a1)]},_0x548c1d[_0x599e48(0x19b)]),console[_0x599e48(0x18c)](a30_0x39a734[_0x599e48(0x173)]('✔\x20Context\x20set:\x20'+a30_0x39a734[_0x599e48(0x1a9)](_0x599e48(0x182))+_0x599e48(0x178)+a30_0x39a734['cyan'](_0x418605[_0x599e48(0x1a1)]))),0x0;if(!_0x548c1d[_0x599e48(0x1a3)]){const _0x5319cd=await confirmKey(_0x599e48(0x1af)+(_0x5e17d2[_0x599e48(0x170)]+_0x9a1ab9[_0x599e48(0x170)])+'\x20files?');if(!_0x5319cd)return console['error'](_0x599e48(0x1ab)),0x1;}for(const _0x2b8f57 of _0x418605['files']){if(_0x2b8f57[_0x599e48(0x169)]||_0x2b8f57[_0x599e48(0x184)]){const _0x55fa7c=a30_0x44ea1d[_0x599e48(0x1a0)](_0x2b8f57['absolutePath']);!existsSync(_0x55fa7c)&&mkdirSync(_0x55fa7c,{'recursive':!![]}),writeFileSync(_0x2b8f57[_0x599e48(0x16e)],_0x2b8f57['content'],_0x599e48(0x16f));}}return console[_0x599e48(0x18c)](a30_0x39a734[_0x599e48(0x173)](_0x599e48(0x19f)+(_0x5e17d2[_0x599e48(0x170)]+_0x9a1ab9[_0x599e48(0x170)])+'\x20files\x20to\x20'+_0x418605[_0x599e48(0x18d)])),saveSessionContext({'parent_segment':_0x418605['parentName']},_0x548c1d['session']),console[_0x599e48(0x18c)](a30_0x39a734[_0x599e48(0x173)](_0x599e48(0x192)+a30_0x39a734[_0x599e48(0x1a9)](_0x599e48(0x182))+'\x20=\x20'+a30_0x39a734['cyan'](_0x418605[_0x599e48(0x1a1)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x625ab3=a31_0x1f3d;(function(_0x17070a,_0x15db42){const _0x167ea4=a31_0x1f3d,_0x18bd36=_0x17070a();while(!![]){try{const _0xca1da4=-parseInt(_0x167ea4(0x23c))/0x1+-parseInt(_0x167ea4(0x1eb))/0x2*(parseInt(_0x167ea4(0x23a))/0x3)+parseInt(_0x167ea4(0x21d))/0x4*(parseInt(_0x167ea4(0x1f4))/0x5)+-parseInt(_0x167ea4(0x1fa))/0x6+-parseInt(_0x167ea4(0x211))/0x7+parseInt(_0x167ea4(0x236))/0x8*(-parseInt(_0x167ea4(0x1c4))/0x9)+parseInt(_0x167ea4(0x21c))/0xa;if(_0xca1da4===_0x15db42)break;else _0x18bd36['push'](_0x18bd36['shift']());}catch(_0x1dcc85){_0x18bd36['push'](_0x18bd36['shift']());}}}(a31_0x214c,0xef342));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x460526 from'chalk';function a31_0x214c(){const _0x4db2fa=['Resolving\x20parent\x20segment\x20\x27','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20\x20Segments:\x20','nameToId','new','user','getJourney','data','push','\x20\x20Activations:','journeys','.yaml','createdSegmentIds','diff','results','\x20\x20\x20\x20','name','toUpdate','message','7905033sRVOrT','/j/da/je','green','\x20updated','journeyBundleId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Changes\x20to:','paused','Error:\x20','unchanged','\x20\x20🗺️\x20\x20Journeys:','dim','journeysOnly','add','\x20to\x20create','getParent','segmentFolderId','createdAt','parentName','file','New\x20journey:','toDelete','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20to\x20delete','no_parent','folderPath','errorCode','segment:push','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20created','parentSegment','Changes\x20to\x20journey:','join','isNew','type','blue','\x20new','\x20YAML\x20files\x20found','set','2HKjyJB','\x20changed','📁\x20','filter','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)','idToName','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','red','error','90gdsuTz','execute','Fetching\x20existing\x20activations...','activations','setPhase','/app/ps/','9408990lBOclW','verbose','Delete\x20segment:','Fetching\x20users\x20for\x20email\x20resolution...','list','Site:\x20','folders','segments','journeyBundleName','(Journey\x20will\x20be\x20deleted)','\x0aValidation\x20failed:','\x20changes?','updated','toString','\x20deleted','parent_name','listFolders','/e/','filePath','all','changed','resolveParentId','segment\x20or\x20journey','5702753vPegOd','site','then','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','getOutputSchemaWithCache','audienceId','Scoped\x20to\x20folder:\x20','listSegments','yellow','repeat','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','53260930lZgNSM','323488UzoIMQ','\x20activations]','state','delete','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','folderId','map','existingJourney','journeyId','\x20unchanged','Folders\x20to\x20create:','length','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x27...','dryRun','deleted','\x20to\x20update','Parent\x20segment:\x20','nameToType','segment','connection','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','journey','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','8KrFtsL','description','\x0aPush\x20summary\x20for\x20\x27','\x20folders\x20to\x20create','2856369UsUDkK','New\x20segment:','1588707MzVkIF','\x20\x20Journeys:\x20','created','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20\x20Source:\x20','listJourneysWithDetailsFromParentSegment','cyan','Source\x20directory:\x20','Preparing\x20journeys...','attributes','Error:\x20Directory\x20not\x20found:\x20','yamlConfig','Push\x20','relationships','get','helpText','Fetching\x20existing\x20folders...'];a31_0x214c=function(){return _0x4db2fa;};return a31_0x214c();}import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a31_0x1f3d(_0x3ed3bd,_0x2a6633){_0x3ed3bd=_0x3ed3bd-0x1bd;const _0x214c81=a31_0x214c();let _0x1f3d56=_0x214c81[_0x3ed3bd];return _0x1f3d56;}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_0x625ab3(0x1c1)]=a31_0x625ab3(0x1df);[a31_0x625ab3(0x237)]=a31_0x625ab3(0x1da);async[a31_0x625ab3(0x1f5)](_0x27af5d){const _0x442e75=a31_0x625ab3,{options:_0x6307bf,args:_0x15d764,tdx:_0x6ed082}=_0x27af5d,_0x3559f0=_0x6307bf,_0x39499c=await resolveTarget({'arg':_0x15d764[0x0],'contextParent':_0x6307bf[_0x442e75(0x1e2)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x39499c))return _0x39499c[_0x442e75(0x1de)]===_0x442e75(0x1dc)?(console['error'](a31_0x460526[_0x442e75(0x219)](_0x442e75(0x1c9))),console['error'](_0x442e75(0x1ef)),console[_0x442e75(0x1f3)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x442e75(0x1f3)](_0x442e75(0x214))):(console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x1cc)+_0x39499c[_0x442e75(0x1c3)]+'\x0a')),_0x39499c[_0x442e75(0x24b)]&&console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x242)](_0x39499c[_0x442e75(0x24b)]))),0x1;if(_0x39499c[_0x442e75(0x1e6)]===_0x442e75(0x209))return console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x246)+_0x39499c['targetDir']+'\x0a')),console[_0x442e75(0x1f3)](a31_0x460526['cyan'](_0x442e75(0x22a))),0x1;const _0x25fa43=_0x39499c[_0x442e75(0x1d6)],_0x2c29ea=_0x39499c['targetDir'],_0x40056b=_0x39499c['type']===_0x442e75(0x1d7)?_0x39499c[_0x442e75(0x20c)]:undefined,_0xc6b29f=getScopedDetails(_0x39499c),_0x4e4612=_0xc6b29f?.['isScoped']??![],_0x3a704d=_0xc6b29f?.['scopedFolderPath']??'';if(!existsSync(_0x2c29ea))return console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x246)+_0x2c29ea+'\x0a')),console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x242)](_0x442e75(0x22a))),0x1;_0x3559f0[_0x442e75(0x1fb)]&&(console['error'](_0x442e75(0x1ff)+_0x3559f0[_0x442e75(0x212)]),console['error'](_0x442e75(0x22f)+_0x25fa43),console[_0x442e75(0x1f3)](_0x442e75(0x243)+_0x2c29ea),_0x4e4612&&console['error'](_0x442e75(0x217)+_0x3a704d));const _0x2462b8=await withSpinner(_0x442e75(0x24d)+_0x25fa43+_0x442e75(0x22b),()=>_0x6ed082[_0x442e75(0x231)][_0x442e75(0x20f)](_0x25fa43),{'verbose':_0x3559f0[_0x442e75(0x1fb)]}),_0x4125d0=_0x2462b8[_0x442e75(0x254)],[_0x210c2d,_0x5b0fea,_0x1b1a2c,_0x232479,_0x2a3ee8]=await Promise[_0x442e75(0x20d)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x6ed082['segment'][_0x442e75(0x1d3)](_0x4125d0),{'verbose':_0x3559f0[_0x442e75(0x1fb)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x6ed082[_0x442e75(0x231)][_0x442e75(0x218)](_0x4125d0),{'verbose':_0x3559f0[_0x442e75(0x1fb)]}),withSpinner(_0x442e75(0x24c),()=>_0x6ed082[_0x442e75(0x231)][_0x442e75(0x20a)](_0x4125d0),{'verbose':_0x3559f0[_0x442e75(0x1fb)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x6ed082['journey'][_0x442e75(0x241)](_0x4125d0,{'includeAllVersions':!![]}),{'verbose':_0x3559f0['verbose']}),withSpinner(_0x442e75(0x1fd),()=>_0x6ed082[_0x442e75(0x252)]['buildUserMaps'](),{'verbose':_0x3559f0[_0x442e75(0x1fb)]})['then'](_0x2a43b6=>_0x2a43b6[_0x442e75(0x254)])]),_0x324575=_0x210c2d[_0x442e75(0x254)],_0x2675be=extractRootFolderId(_0x324575),_0x3df0f4=_0x5b0fea['data'],_0x2ae49f=_0x1b1a2c[_0x442e75(0x254)],{journeys:_0x17a6f4,activationStepsById:_0x40be6f}=_0x232479['data'],_0x18bdcd=new Map(_0x17a6f4[_0x442e75(0x224)](_0x2891bb=>[_0x2891bb['id'],_0x2891bb])),_0x98fabf=_0x17a6f4['map'](_0xd1e852=>({'id':_0xd1e852['id'],'name':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x1c1)],'journeyBundleName':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x202)]||'','journeyBundleId':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x1c8)]||'','versionNumber':_0xd1e852[_0x442e75(0x245)]['versionNumber'],'description':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x237)],'state':_0xd1e852['attributes'][_0x442e75(0x21f)],'paused':_0xd1e852['attributes'][_0x442e75(0x1cb)],'audienceId':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x216)],'folderId':_0xd1e852[_0x442e75(0x249)]?.['parentFolder']?.[_0x442e75(0x254)]?.['id'],'createdAt':_0xd1e852[_0x442e75(0x245)][_0x442e75(0x1d5)],'updatedAt':_0xd1e852[_0x442e75(0x245)]['updatedAt']})),{emailToId:_0x1c071a,idToEmail:_0x2511fb}=_0x2a3ee8,_0xf99f15=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x4d4962=_0x442e75,_0x31de26=await _0x6ed082[_0x4d4962(0x232)][_0x4d4962(0x1fe)]();return buildConnectionMaps(_0x31de26);},{'verbose':_0x3559f0['verbose']})[_0x442e75(0x213)](_0x3fd3c0=>_0x3fd3c0[_0x442e75(0x254)]),_0x2aa561=_0xf99f15['nameToId'],_0x551e17=_0xf99f15[_0x442e75(0x1f0)],_0xf9bea7=_0xf99f15[_0x442e75(0x230)],_0x4f4722={'emailToIdMap':_0x1c071a,'connectionNameToIdMap':_0x2aa561,'connectionNameToTypeMap':_0xf9bea7,'getSchema':_0x199721=>_0x6ed082[_0x442e75(0x232)][_0x442e75(0x215)](_0x199721)};let {pathToId:_0x3ab026,idToPath:_0x164f3c}=buildFolderMaps(_0x2ae49f);const _0x429a9d=buildSegmentLookupMap(_0x3df0f4,_0x164f3c),_0x4c8fa9=buildSegmentNameToIdMap(_0x3df0f4),_0x541252=buildJourneyBundleLookupMap(_0x98fabf,_0x164f3c);let _0x137222;if(_0x40056b){if(!_0x40056b['endsWith']('.yml')&&!_0x40056b['endsWith'](_0x442e75(0x258)))return console['error'](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x221)+_0x40056b+'\x0a')),0x1;_0x137222=[_0x40056b];}else _0x137222=findYamlFiles(_0x2c29ea);if(_0x137222['length']===0x0)return console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x235)+_0x2c29ea+'\x0a')),console['error'](a31_0x460526['cyan'](_0x442e75(0x1e0))),0x1;let _0x69fe46,_0x5a7250;try{const _0x4ddbfd=parseAndClassifyYamlFiles(_0x137222,_0x2c29ea,{'skipSegments':_0x3559f0[_0x442e75(0x1d0)]});_0x69fe46=_0x4ddbfd['segments'],_0x5a7250=_0x4ddbfd[_0x442e75(0x257)];const _0x2740dc=validateParsedFiles(_0x4ddbfd,_0x2c29ea);if(_0x2740dc[_0x442e75(0x229)]>0x0)return console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x204))),console['error'](formatValidationErrors(_0x2740dc)),console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x219)](_0x442e75(0x233))),0x1;}catch(_0x1ad06e){return console['error'](a31_0x460526[_0x442e75(0x1f2)]('Error\x20parsing\x20YAML:\x20'+(_0x1ad06e instanceof Error?_0x1ad06e[_0x442e75(0x1c3)]:_0x1ad06e))),0x1;}if(_0x69fe46[_0x442e75(0x229)]===0x0&&_0x5a7250[_0x442e75(0x229)]===0x0){const _0xb93bf9=_0x3559f0['journeysOnly']?_0x442e75(0x234):_0x442e75(0x210);return console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x219)]('No\x20'+_0xb93bf9+_0x442e75(0x1e9))),0x0;}const _0x118a94=new Map();_0x3df0f4[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x1d0)]&&await withSpinner(_0x442e75(0x1f6),async()=>{await batchAsync(_0x3df0f4,async _0x4adb04=>{const _0x5830e9=a31_0x1f3d,_0xb8bc1=await _0x6ed082[_0x5830e9(0x231)]['listActivations'](_0x4125d0,_0x4adb04['id']);_0x118a94[_0x5830e9(0x1ea)](_0x4adb04['id'],_0xb8bc1);});},{'verbose':_0x3559f0['verbose']});const {segmentFiles:_0x8f1aa1,foldersToCreate:_0x23cec8}=await prepareSegmentFiles(_0x69fe46,{'segmentByFolderAndName':_0x429a9d,'activationsBySegmentId':_0x118a94,'folderPathToId':_0x3ab026,'idToEmailMap':_0x2511fb,'connectionIdToNameMap':_0x551e17},_0x4f4722,_0x4e4612,_0x3a704d),_0xb4b40e=_0x40056b?[]:findSegmentsToDelete(_0x3df0f4,_0x69fe46[_0x442e75(0x224)](({yamlConfig:_0x435e53,folderPath:_0xcaa047})=>({'yamlConfig':_0x435e53,'folderPath':resolveTDFolderPath(_0xcaa047,_0x4e4612,_0x3a704d)})),_0x164f3c,_0x3a704d,_0x4e4612),{journeyFiles:_0xfc62b0,foldersToCreate:_0x775ebe}=await withProgressSpinner(_0x442e75(0x244),async _0x1df54e=>prepareJourneyFiles(_0x5a7250,{'fetchJourney':async _0x178e4d=>_0x6ed082[_0x442e75(0x234)][_0x442e75(0x253)](_0x178e4d['journeyId']),'journeyBundlesByFolderAndName':_0x541252,'folderPathToId':_0x3ab026,'idToEmailMap':_0x2511fb,'connectionIdToNameMap':_0x551e17,'existingSegments':_0x3df0f4,'parentId':_0x4125d0,'deps':_0x6ed082,'progress':{'update':_0x23f539=>{const _0x3ecc90=_0x442e75;_0x1df54e[_0x3ecc90(0x1f8)](_0x23f539),_0x3559f0[_0x3ecc90(0x1fb)]&&console[_0x3ecc90(0x1f3)]('\x20\x20'+_0x23f539);}},'journeyById':_0x18bdcd,'activationStepsById':_0x40be6f},_0x4e4612,_0x3a704d),{'verbose':_0x3559f0[_0x442e75(0x1fb)]})['then'](_0x5a0c1d=>_0x5a0c1d['data']);for(const _0x23097c of _0x775ebe){_0x23cec8[_0x442e75(0x1d1)](_0x23097c);}const _0x306724=_0x40056b?[]:findJourneysToDelete(_0x98fabf,_0x5a7250[_0x442e75(0x224)](({yamlConfig:_0x43aeed,folderPath:_0x21bb8b})=>({'yamlConfig':_0x43aeed,'folderPath':resolveTDFolderPath(_0x21bb8b,_0x4e4612,_0x3a704d)})),_0x164f3c,_0x3a704d,_0x4e4612),_0xd40c5=calculatePushStats(_0x8f1aa1,_0xfc62b0,_0x23cec8,_0xb4b40e,_0x306724,!!_0x3559f0[_0x442e75(0x220)],!!_0x3559f0[_0x442e75(0x1d0)]),_0x3b2ce7=_0xd40c5[_0x442e75(0x201)][_0x442e75(0x251)],_0x221901=_0xd40c5[_0x442e75(0x201)][_0x442e75(0x20e)],_0x371ec2=_0xd40c5[_0x442e75(0x201)][_0x442e75(0x1cd)],_0x2c1310=_0xd40c5['segments'][_0x442e75(0x1d9)],_0x56cb34=_0xd40c5[_0x442e75(0x200)]['toCreate'],_0x1cbb81=_0xd40c5[_0x442e75(0x257)][_0x442e75(0x251)],_0x272eb5=_0xd40c5['journeys'][_0x442e75(0x20e)],_0x44917d=_0xd40c5['journeys']['unchanged'],_0x2cd0f4=_0xd40c5['journeys']['toDelete'],_0x2e0acb=_0xd40c5[_0x442e75(0x1f7)][_0x442e75(0x20d)],_0x5d6aee=_0xd40c5[_0x442e75(0x1f7)]['toCreate'],_0x3e510a=_0xd40c5[_0x442e75(0x1f7)][_0x442e75(0x1c2)],_0x1b3316=_0xd40c5['activations'][_0x442e75(0x1d9)];console[_0x442e75(0x1f3)](_0x442e75(0x238)+_0x25fa43+'\x27:');_0x56cb34[_0x442e75(0x229)]>0x0&&console[_0x442e75(0x1f3)]('\x20\x20'+a31_0x460526[_0x442e75(0x1e7)](_0x442e75(0x1ed)+_0x56cb34[_0x442e75(0x229)]+_0x442e75(0x239)));if(!_0x3559f0[_0x442e75(0x1d0)]){console['error']('\x20\x20📊\x20Segments:'),console[_0x442e75(0x1f3)](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1c6)]('+\x20'+_0x3b2ce7[_0x442e75(0x229)]+_0x442e75(0x1e8))),console['error'](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x219)]('~\x20'+_0x221901['length']+_0x442e75(0x1ec)));if(_0x2c1310[_0x442e75(0x229)]>0x0)console[_0x442e75(0x1f3)](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1f2)]('-\x20'+_0x2c1310[_0x442e75(0x229)]+_0x442e75(0x1db)));else _0xb4b40e['length']>0x0&&!_0x3559f0[_0x442e75(0x220)]&&console[_0x442e75(0x1f3)](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1cf)](_0xb4b40e[_0x442e75(0x229)]+_0x442e75(0x222)));console[_0x442e75(0x1f3)](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1cf)]('=\x20'+_0x371ec2[_0x442e75(0x229)]+_0x442e75(0x227)));}if(_0xfc62b0[_0x442e75(0x229)]>0x0||_0x306724[_0x442e75(0x229)]>0x0){console[_0x442e75(0x1f3)](_0x442e75(0x1ce)),console['error']('\x20\x20\x20\x20'+a31_0x460526[_0x442e75(0x1c6)]('+\x20'+_0x1cbb81[_0x442e75(0x229)]+_0x442e75(0x1e8))),console['error']('\x20\x20\x20\x20'+a31_0x460526[_0x442e75(0x219)]('~\x20'+_0x272eb5[_0x442e75(0x229)]+_0x442e75(0x1ec)));if(_0x2cd0f4[_0x442e75(0x229)]>0x0)console['error']('\x20\x20\x20\x20'+a31_0x460526[_0x442e75(0x1f2)]('-\x20'+_0x2cd0f4[_0x442e75(0x229)]+_0x442e75(0x1db)));else _0x306724[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x220)]&&console[_0x442e75(0x1f3)](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1cf)](_0x306724[_0x442e75(0x229)]+_0x442e75(0x222)));console['error']('\x20\x20\x20\x20'+a31_0x460526['dim']('=\x20'+_0x44917d[_0x442e75(0x229)]+'\x20unchanged'));}_0x2e0acb[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x1d0)]&&(console['error'](''),console[_0x442e75(0x1f3)](_0x442e75(0x256)),_0x5d6aee[_0x442e75(0x229)]>0x0&&console['error'](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1c6)]('+\x20'+_0x5d6aee[_0x442e75(0x229)]+_0x442e75(0x1d2))),_0x3e510a[_0x442e75(0x229)]>0x0&&console['error'](_0x442e75(0x1c0)+a31_0x460526['yellow']('~\x20'+_0x3e510a['length']+_0x442e75(0x22e))),_0x1b3316[_0x442e75(0x229)]>0x0&&console['error'](_0x442e75(0x1c0)+a31_0x460526[_0x442e75(0x1f2)]('-\x20'+_0x1b3316['length']+_0x442e75(0x1db))));console['error'](_0x442e75(0x240)+a31_0x460526['cyan'](_0x2c29ea)+'\x0a');if(_0x56cb34[_0x442e75(0x229)]>0x0){console[_0x442e75(0x1f3)](_0x442e75(0x228));for(const _0x217bf6 of _0x56cb34){console[_0x442e75(0x1f3)]('\x20\x20'+a31_0x460526[_0x442e75(0x1e7)]('+')+'\x20'+_0x217bf6);}console[_0x442e75(0x1f3)]('');}if(_0x3b2ce7['length']>0x0&&!_0x3559f0[_0x442e75(0x1d0)])for(const _0x2d1ac3 of _0x3b2ce7){const _0x384f99=_0x2d1ac3[_0x442e75(0x1dd)]?_0x2d1ac3['folderPath']+'/'+_0x2d1ac3[_0x442e75(0x247)]['name']:_0x2d1ac3[_0x442e75(0x247)][_0x442e75(0x1c1)],_0x44a7b4=_0x2d1ac3['yamlConfig']['activations']?.[_0x442e75(0x229)]||0x0,_0x48b689=_0x44a7b4>0x0?a31_0x460526['dim']('\x20['+_0x44a7b4+_0x442e75(0x21e)):'';console[_0x442e75(0x1f3)]('\x0a'+a31_0x460526[_0x442e75(0x1c6)](_0x442e75(0x23b))+'\x20'+_0x384f99+_0x48b689),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c)),_0x2d1ac3[_0x442e75(0x1be)]&&console[_0x442e75(0x1f3)](_0x2d1ac3[_0x442e75(0x1be)]),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c));}if(_0x2c1310[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x1d0)])for(const _0x3e7a32 of _0x2c1310){const _0x28d7fd=_0x3e7a32['segmentFolderId']?_0x164f3c[_0x442e75(0x24a)](_0x3e7a32[_0x442e75(0x1d4)][_0x442e75(0x207)]())||'':'',_0x1e257b=_0x28d7fd?_0x28d7fd+'/'+_0x3e7a32[_0x442e75(0x1c1)]:_0x3e7a32[_0x442e75(0x1c1)],_0x407ed4=_0x118a94[_0x442e75(0x24a)](_0x3e7a32['id'])||[],_0x3417c5=_0x407ed4[_0x442e75(0x229)]>0x0?a31_0x460526[_0x442e75(0x1cf)]('\x20['+_0x407ed4[_0x442e75(0x229)]+_0x442e75(0x21e)):'';console[_0x442e75(0x1f3)]('\x0a'+a31_0x460526['red'](_0x442e75(0x1fc))+'\x20'+_0x1e257b+_0x3417c5),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c));const _0x2bd1e9=segmentWithActivationsToYaml(_0x3e7a32,_0x407ed4,undefined,_0x2511fb,_0x551e17),_0x3effb9=segmentToYamlString(_0x2bd1e9),_0x7e8839=generateDiff(_0x3effb9,'');console[_0x442e75(0x1f3)](formatDiffWithColors(_0x7e8839)),console[_0x442e75(0x1f3)]('─'['repeat'](0x3c));}const _0x4f64af=_0x8f1aa1[_0x442e75(0x1ee)](_0x2fd02e=>!_0x2fd02e[_0x442e75(0x1e5)]&&_0x2fd02e[_0x442e75(0x1be)]);if(_0x4f64af['length']>0x0&&!_0x3559f0[_0x442e75(0x1d0)])for(const _0x27a756 of _0x4f64af){const _0x569598=_0x27a756['folderPath']?_0x27a756[_0x442e75(0x1dd)]+'/'+_0x27a756['yamlConfig'][_0x442e75(0x1c1)]:_0x27a756[_0x442e75(0x247)][_0x442e75(0x1c1)];console[_0x442e75(0x1f3)]('\x0a'+a31_0x460526['yellow'](_0x442e75(0x1ca))+'\x20'+_0x569598),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c)),console[_0x442e75(0x1f3)](_0x27a756[_0x442e75(0x1be)]),console['error']('─'[_0x442e75(0x21a)](0x3c));}if(_0x1cbb81[_0x442e75(0x229)]>0x0)for(const _0x2f4ba4 of _0x1cbb81){const _0x57ae3a=_0x2f4ba4[_0x442e75(0x1dd)]?_0x2f4ba4['folderPath']+'/'+_0x2f4ba4[_0x442e75(0x247)][_0x442e75(0x1c1)]:_0x2f4ba4[_0x442e75(0x247)][_0x442e75(0x1c1)];console[_0x442e75(0x1f3)]('\x0a'+a31_0x460526[_0x442e75(0x1c6)](_0x442e75(0x1d8))+'\x20'+_0x57ae3a),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c)),_0x2f4ba4[_0x442e75(0x1be)]&&console[_0x442e75(0x1f3)](_0x2f4ba4[_0x442e75(0x1be)]),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c));}const _0x48f748=_0xfc62b0[_0x442e75(0x1ee)](_0xb20d0d=>!_0xb20d0d[_0x442e75(0x1e5)]&&_0xb20d0d[_0x442e75(0x1be)]);if(_0x48f748[_0x442e75(0x229)]>0x0)for(const _0x44f9ab of _0x48f748){const _0x4497f6=_0x44f9ab['folderPath']?_0x44f9ab[_0x442e75(0x1dd)]+'/'+_0x44f9ab[_0x442e75(0x247)][_0x442e75(0x1c1)]:_0x44f9ab[_0x442e75(0x247)][_0x442e75(0x1c1)];console[_0x442e75(0x1f3)]('\x0a'+a31_0x460526[_0x442e75(0x219)](_0x442e75(0x1e3))+'\x20'+_0x4497f6),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c)),console[_0x442e75(0x1f3)](_0x44f9ab[_0x442e75(0x1be)]),console['error']('─'[_0x442e75(0x21a)](0x3c));}if(_0x2cd0f4[_0x442e75(0x229)]>0x0)for(const _0x571834 of _0x2cd0f4){const _0xb7302c=_0x571834[_0x442e75(0x223)]?_0x164f3c['get'](_0x571834['folderId'])||'':'',_0x3781b2=_0xb7302c?_0xb7302c+'/'+_0x571834[_0x442e75(0x202)]:_0x571834[_0x442e75(0x202)];console['error']('\x0a'+a31_0x460526[_0x442e75(0x1f2)]('Delete\x20journey:')+'\x20'+_0x3781b2),console['error']('─'[_0x442e75(0x21a)](0x3c)),console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)](_0x442e75(0x203))),console[_0x442e75(0x1f3)]('─'[_0x442e75(0x21a)](0x3c));}if(_0x3559f0[_0x442e75(0x22c)])return console['error'](a31_0x460526[_0x442e75(0x219)](_0x442e75(0x24e))),0x0;const _0x4d2f72=_0x3559f0[_0x442e75(0x1d0)]?![]:_0x3b2ce7[_0x442e75(0x229)]>0x0||_0x221901['length']>0x0||_0x2c1310[_0x442e75(0x229)]>0x0,_0x1ea4f4=_0x1cbb81[_0x442e75(0x229)]>0x0||_0x272eb5[_0x442e75(0x229)]>0x0||_0x2cd0f4[_0x442e75(0x229)]>0x0,_0x2d2fa7=_0x3559f0['journeysOnly']?![]:_0x2e0acb[_0x442e75(0x229)]>0x0,_0xb4c0a9=_0x56cb34['length']>0x0;if(!_0x4d2f72&&!_0x1ea4f4&&!_0x2d2fa7&&!_0xb4c0a9){const _0x1d3a27=_0x3559f0[_0x442e75(0x1d0)]?_0x442e75(0x1f1):_0x442e75(0x23f);console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1c6)](_0x1d3a27));if(_0x40056b&&_0x44917d['length']===0x1){const _0x44c5d0=_0x44917d[0x0];if(_0x44c5d0[_0x442e75(0x225)]?.['id']){const _0x191e96=getConsoleNextUrl(_0x3559f0['site'],_0x442e75(0x1f9)+_0x4125d0+_0x442e75(0x20b)+_0x44c5d0[_0x442e75(0x225)]['id']+_0x442e75(0x1c5));console['error']('\x20\x20'+a31_0x460526[_0x442e75(0x242)](_0x191e96));}}return 0x0;}const _0x152b4c=_0x3559f0[_0x442e75(0x1d0)]?_0x1cbb81['length']+_0x272eb5[_0x442e75(0x229)]+_0x2cd0f4[_0x442e75(0x229)]+_0x56cb34['length']:_0x3b2ce7[_0x442e75(0x229)]+_0x221901['length']+_0x2c1310[_0x442e75(0x229)]+_0x1cbb81[_0x442e75(0x229)]+_0x272eb5[_0x442e75(0x229)]+_0x2cd0f4[_0x442e75(0x229)]+_0x56cb34['length']+_0x2e0acb[_0x442e75(0x229)];if(!_0x3559f0['yes']&&_0x152b4c>0x0){const _0x42dd88=await confirmKey(_0x442e75(0x248)+_0x152b4c+_0x442e75(0x205));if(!_0x42dd88)return console[_0x442e75(0x1f3)]('Aborted.'),0x1;}const _0x1bd359={'withProgress':async(_0x34d816,_0x41455d)=>{const _0x52520d=_0x442e75,_0x348d76=await withSpinner(_0x34d816,_0x41455d,{'verbose':_0x3559f0[_0x52520d(0x1fb)]});return{'data':_0x348d76[_0x52520d(0x254)]};},'logInfo':_0x3bdfa6=>console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1e7)]('✔\x20'+_0x3bdfa6)),'logSuccess':_0x26f254=>console['error'](a31_0x460526[_0x442e75(0x1c6)]('✔\x20'+_0x26f254)),'logWarning':_0x49e693=>console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x219)]('⚠\x20'+_0x49e693)),'logDeleted':_0x144b5c=>console[_0x442e75(0x1f3)](a31_0x460526[_0x442e75(0x1f2)]('✔\x20'+_0x144b5c))},_0x4fb15e={'segment':_0x6ed082[_0x442e75(0x231)],'journey':_0x6ed082[_0x442e75(0x234)],'user':_0x6ed082[_0x442e75(0x252)],'connection':_0x6ed082[_0x442e75(0x232)]};_0x56cb34[_0x442e75(0x229)]>0x0&&(_0x3ab026=await executePushFolders(_0x4fb15e,_0x56cb34,_0x3ab026,{'parentId':_0x4125d0},_0x1bd359));const _0x25bdbe={'rootFolderId':_0x2675be,'folderPathToId':_0x3ab026,'folderIdToPath':_0x164f3c,'segmentNameToId':_0x4c8fa9,'activationsBySegmentId':_0x118a94,'emailToIdMap':_0x1c071a,'idToEmailMap':_0x2511fb,'connectionNameToIdMap':_0xf99f15[_0x442e75(0x250)],'connectionIdToNameMap':_0xf99f15[_0x442e75(0x1f0)],'connectionNameToTypeMap':_0xf9bea7},_0x1e832f=await executePushSegments(_0x4fb15e,_0x3559f0['journeysOnly']?[]:_0x8f1aa1,_0x25bdbe,{'parentId':_0x4125d0},_0x1bd359),_0x2ce961=_0x1e832f[_0x442e75(0x23e)],_0x23cfdf=_0x1e832f[_0x442e75(0x206)],_0x29938d=_0x1e832f[_0x442e75(0x1f7)][_0x442e75(0x23e)],_0x41b1ee=_0x1e832f[_0x442e75(0x1f7)][_0x442e75(0x206)],_0x3ad44f=_0x1e832f[_0x442e75(0x1f7)][_0x442e75(0x22d)],_0x1873e4=await executePushSegmentDeletions(_0x4fb15e,_0x3559f0['journeysOnly']?[]:_0x2c1310,_0x1bd359);let _0x316c79=0x0,_0x404128=0x0,_0x477aec=0x0;const _0x2af236=new Map(_0x4c8fa9);for(const [_0x53796d,_0x5204d2]of _0x1e832f[_0x442e75(0x1bd)]){_0x2af236[_0x442e75(0x1ea)](_0x53796d,_0x5204d2);}if(_0xfc62b0[_0x442e75(0x229)]>0x0){const _0x14dacb={..._0x25bdbe,'segmentNameToId':_0x2af236,'existingSegments':_0x3df0f4,'activationContext':_0x4f4722},_0x189092=await executePushJourneys(_0x4fb15e,_0xfc62b0,_0x14dacb,{'parentId':_0x4125d0,'rootFolderId':_0x2675be,'verbose':_0x3559f0[_0x442e75(0x1fb)]},_0x1bd359);_0x316c79=_0x189092['created'],_0x404128=_0x189092['updated'];if(_0x40056b&&_0x189092[_0x442e75(0x1bf)][_0x442e75(0x229)]===0x1){const _0x1e46c3=_0x189092[_0x442e75(0x1bf)][0x0];if(_0x1e46c3[_0x442e75(0x226)]){const _0x38139a=getConsoleNextUrl(_0x3559f0[_0x442e75(0x212)],_0x442e75(0x1f9)+_0x4125d0+_0x442e75(0x20b)+_0x1e46c3['journeyId']+_0x442e75(0x1c5));console[_0x442e75(0x1f3)]('\x20\x20'+a31_0x460526[_0x442e75(0x242)](_0x38139a));}}}for(const _0x2e6a64 of _0x2cd0f4){console['error'](a31_0x460526[_0x442e75(0x219)](_0x442e75(0x21b)+_0x2e6a64['journeyBundleName'])),_0x477aec++;}const _0x15be24=[];if(_0x2ce961>0x0)_0x15be24['push'](_0x2ce961+_0x442e75(0x1e1));if(_0x23cfdf>0x0)_0x15be24['push'](_0x23cfdf+'\x20updated');if(_0x1873e4>0x0)_0x15be24[_0x442e75(0x255)](_0x1873e4+_0x442e75(0x208));const _0xefbbba=[];if(_0x316c79>0x0)_0xefbbba[_0x442e75(0x255)](_0x316c79+'\x20created');if(_0x404128>0x0)_0xefbbba[_0x442e75(0x255)](_0x404128+_0x442e75(0x1c7));if(_0x477aec>0x0)_0xefbbba[_0x442e75(0x255)](_0x477aec+_0x442e75(0x208));const _0x595a25=[];if(_0x29938d>0x0)_0x595a25[_0x442e75(0x255)](_0x29938d+_0x442e75(0x1e1));if(_0x41b1ee>0x0)_0x595a25[_0x442e75(0x255)](_0x41b1ee+_0x442e75(0x1c7));if(_0x3ad44f>0x0)_0x595a25['push'](_0x3ad44f+_0x442e75(0x208));return console['error'](a31_0x460526[_0x442e75(0x1c6)]('\x0a✔\x20Push\x20complete')),_0x15be24[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x1d0)]&&console['error'](_0x442e75(0x24f)+_0x15be24[_0x442e75(0x1e4)](',\x20')),_0xefbbba[_0x442e75(0x229)]>0x0&&console[_0x442e75(0x1f3)](_0x442e75(0x23d)+_0xefbbba['join'](',\x20')),_0x595a25[_0x442e75(0x229)]>0x0&&!_0x3559f0[_0x442e75(0x1d0)]&&console[_0x442e75(0x1f3)]('\x20\x20Activations:\x20'+_0x595a25[_0x442e75(0x1e4)](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x45983e=a31_0x5cac;(function(_0x3dbe93,_0xe2fcd9){const _0x18e331=a31_0x5cac,_0x55b9b2=_0x3dbe93();while(!![]){try{const _0x3d4f18=parseInt(_0x18e331(0x12a))/0x1*(-parseInt(_0x18e331(0x16a))/0x2)+parseInt(_0x18e331(0x1a7))/0x3*(-parseInt(_0x18e331(0x188))/0x4)+parseInt(_0x18e331(0x189))/0x5+-parseInt(_0x18e331(0x135))/0x6*(-parseInt(_0x18e331(0x13a))/0x7)+-parseInt(_0x18e331(0x19e))/0x8*(-parseInt(_0x18e331(0x142))/0x9)+parseInt(_0x18e331(0x174))/0xa+parseInt(_0x18e331(0x19f))/0xb*(-parseInt(_0x18e331(0x19d))/0xc);if(_0x3d4f18===_0xe2fcd9)break;else _0x55b9b2['push'](_0x55b9b2['shift']());}catch(_0x2466e3){_0x55b9b2['push'](_0x55b9b2['shift']());}}}(a31_0xa9d6,0xac22e));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x3b861f 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_0xa9d6(){const _0x4ba923=['set','all','journeyId','Fetching\x20existing\x20segments...','listJourneysWithDetailsFromParentSegment','repeat','536532BjSrOk','32fxeXoV','11KDpPZn','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','listSegments','setPhase','\x20\x20Activations:\x20','\x20new','journeysOnly','Delete\x20journey:','1757031gjJhob','length','Aborted.','segments','/e/','map','cyan','\x20changed','segment','journeys','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Push\x20','delete','getOutputSchemaWithCache','\x20created','message','\x20\x20🗺️\x20\x20Journeys:','filter','/app/ps/','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','575257uDKDpj','new','\x20\x20Segments:\x20','targetDir','parentSegment','existingJourney','isNew','type','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','yes','folderId','240pvNHRX','Error\x20parsing\x20YAML:\x20','Scoped\x20to\x20folder:\x20','then','\x27...','161273RMLbFA','createdSegmentIds','Fetching\x20parent\x20segment\x20details...','\x20unchanged','red','connection','push','Changes\x20to:','1191573wAyAzc','segment\x20or\x20journey','Site:\x20','blue','📁\x20','\x20to\x20update','\x0aValidation\x20failed:','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','join','name','parentFolder','cwd','site','created','unchanged','helpText','toCreate','Folders\x20to\x20create:','folderPath','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','(Journey\x20will\x20be\x20deleted)','user','idToName','data','.yml','\x20\x20📊\x20Segments:','\x20updated','resolveParentId','getJourney','nameToId','Parent\x20segment:\x20','state','segmentFolderId','changed','isScoped','New\x20journey:','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)','getParent','segment:push','results','2LiFlcp','journeyBundleName','yamlConfig','toDelete','versionNumber','Error:\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','buildUserMaps','activations','\x20activations]','2280180weOXDd','\x20\x20\x20\x20','listFolders','yellow','Resolving\x20parent\x20segment\x20\x27','error','\x0a✔\x20Push\x20complete','\x20changes?','listActivations','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Error:\x20Directory\x20not\x20found:\x20','\x20\x20Source:\x20','/j/da/je','createdAt','description','Source\x20directory:\x20','add','journey','execute','diff','4JouVnA','1157745HPFPHp','paused','no_parent','\x20to\x20delete','updated','\x20\x20Activations:','journeyBundleId','green','dryRun','attributes','Fetching\x20connections\x20for\x20name\x20resolution...','\x20to\x20create','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','verbose'];a31_0xa9d6=function(){return _0x4ba923;};return a31_0xa9d6();}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a31_0x5cac(_0x128d3f,_0x88708e){_0x128d3f=_0x128d3f-0x129;const _0xa9d6e5=a31_0xa9d6();let _0x5cacf1=_0xa9d6e5[_0x128d3f];return _0x5cacf1;}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_0x45983e(0x14b)]=a31_0x45983e(0x168);[a31_0x45983e(0x182)]=a31_0x45983e(0x195);async[a31_0x45983e(0x186)](_0x50847b){const _0x51aa49=a31_0x45983e,{options:_0x3218d0,args:_0x4a540e,tdx:_0x307bbc}=_0x50847b,_0x3b7f6b=_0x3218d0,_0x39f010=await resolveTarget({'arg':_0x4a540e[0x0],'contextParent':_0x3218d0[_0x51aa49(0x12e)],'cwd':process[_0x51aa49(0x14d)]()});if(!isSuccessfulResolution(_0x39f010))return _0x39f010['errorCode']===_0x51aa49(0x18b)?(console['error'](a31_0x3b861f[_0x51aa49(0x177)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x51aa49(0x179)](_0x51aa49(0x166)),console[_0x51aa49(0x179)](_0x51aa49(0x1b2)),console[_0x51aa49(0x179)]('\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[_0x51aa49(0x179)](a31_0x3b861f['red'](_0x51aa49(0x16f)+_0x39f010[_0x51aa49(0x1b7)]+'\x0a')),_0x39f010[_0x51aa49(0x151)]&&console[_0x51aa49(0x179)](a31_0x3b861f['cyan'](_0x39f010['helpText']))),0x1;if(_0x39f010[_0x51aa49(0x131)]==='parent_name')return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x13e)]('Error:\x20Directory\x20not\x20found:\x20'+_0x39f010[_0x51aa49(0x12d)]+'\x0a')),console[_0x51aa49(0x179)](a31_0x3b861f['cyan'](_0x51aa49(0x1bb))),0x1;const _0x340498=_0x39f010['parentName'],_0xb92413=_0x39f010[_0x51aa49(0x12d)],_0x191f14=_0x39f010[_0x51aa49(0x131)]==='file'?_0x39f010['filePath']:undefined,_0x3930ec=getScopedDetails(_0x39f010),_0x45d4fb=_0x3930ec?.[_0x51aa49(0x164)]??![],_0x14baee=_0x3930ec?.['scopedFolderPath']??'';if(!existsSync(_0xb92413))return console[_0x51aa49(0x179)](a31_0x3b861f['red'](_0x51aa49(0x17e)+_0xb92413+'\x0a')),console['error'](a31_0x3b861f[_0x51aa49(0x1ad)](_0x51aa49(0x1bb))),0x1;_0x3b7f6b[_0x51aa49(0x196)]&&(console[_0x51aa49(0x179)](_0x51aa49(0x144)+_0x3b7f6b[_0x51aa49(0x14e)]),console[_0x51aa49(0x179)](_0x51aa49(0x160)+_0x340498),console['error'](_0x51aa49(0x183)+_0xb92413),_0x45d4fb&&console[_0x51aa49(0x179)](_0x51aa49(0x137)+_0x14baee));const _0x11875b=await withSpinner(_0x51aa49(0x178)+_0x340498+_0x51aa49(0x139),()=>_0x307bbc[_0x51aa49(0x1af)][_0x51aa49(0x15d)](_0x340498),{'verbose':_0x3b7f6b[_0x51aa49(0x196)]}),_0x511b6d=_0x11875b[_0x51aa49(0x159)],[_0x41dbf5,_0x64e46e,_0x4157e7,_0x1bef63,_0x31e033]=await Promise['all']([withSpinner(_0x51aa49(0x13c),()=>_0x307bbc['segment'][_0x51aa49(0x167)](_0x511b6d),{'verbose':_0x3b7f6b['verbose']}),withSpinner(_0x51aa49(0x19a),()=>_0x307bbc['segment'][_0x51aa49(0x1a1)](_0x511b6d),{'verbose':_0x3b7f6b['verbose']}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x307bbc['segment'][_0x51aa49(0x176)](_0x511b6d),{'verbose':_0x3b7f6b[_0x51aa49(0x196)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x307bbc[_0x51aa49(0x185)][_0x51aa49(0x19b)](_0x511b6d,{'includeAllVersions':!![]}),{'verbose':_0x3b7f6b[_0x51aa49(0x196)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x307bbc[_0x51aa49(0x157)][_0x51aa49(0x171)](),{'verbose':_0x3b7f6b[_0x51aa49(0x196)]})[_0x51aa49(0x138)](_0x356c6f=>_0x356c6f[_0x51aa49(0x159)])]),_0x1e52f7=_0x41dbf5[_0x51aa49(0x159)],_0x3dd70c=extractRootFolderId(_0x1e52f7),_0xebe3fd=_0x64e46e['data'],_0x4bdacc=_0x4157e7[_0x51aa49(0x159)],{journeys:_0x4bab14,activationStepsById:_0x14cf77}=_0x1bef63['data'],_0x2878c0=new Map(_0x4bab14[_0x51aa49(0x1ac)](_0x5e2878=>[_0x5e2878['id'],_0x5e2878])),_0x18efcc=_0x4bab14['map'](_0x160649=>({'id':_0x160649['id'],'name':_0x160649[_0x51aa49(0x192)][_0x51aa49(0x14b)],'journeyBundleName':_0x160649['attributes'][_0x51aa49(0x16b)]||'','journeyBundleId':_0x160649['attributes'][_0x51aa49(0x18f)]||'','versionNumber':_0x160649['attributes'][_0x51aa49(0x16e)],'description':_0x160649['attributes'][_0x51aa49(0x182)],'state':_0x160649[_0x51aa49(0x192)][_0x51aa49(0x161)],'paused':_0x160649[_0x51aa49(0x192)][_0x51aa49(0x18a)],'audienceId':_0x160649[_0x51aa49(0x192)]['audienceId'],'folderId':_0x160649['relationships']?.[_0x51aa49(0x14c)]?.[_0x51aa49(0x159)]?.['id'],'createdAt':_0x160649[_0x51aa49(0x192)][_0x51aa49(0x181)],'updatedAt':_0x160649['attributes']['updatedAt']})),{emailToId:_0x138ab1,idToEmail:_0xbff6e}=_0x31e033,_0x27e833=await withSpinner(_0x51aa49(0x193),async()=>{const _0x26214f=_0x51aa49,_0x62f776=await _0x307bbc[_0x26214f(0x13f)]['list']();return buildConnectionMaps(_0x62f776);},{'verbose':_0x3b7f6b[_0x51aa49(0x196)]})[_0x51aa49(0x138)](_0x54c8f5=>_0x54c8f5['data']),_0x480280=_0x27e833[_0x51aa49(0x15f)],_0x533d48=_0x27e833['idToName'],_0x54d161=_0x27e833['nameToType'],_0x569b5b={'emailToIdMap':_0x138ab1,'connectionNameToIdMap':_0x480280,'connectionNameToTypeMap':_0x54d161,'getSchema':_0x566359=>_0x307bbc['connection'][_0x51aa49(0x1b5)](_0x566359)};let {pathToId:_0x5f2c5e,idToPath:_0x27ec56}=buildFolderMaps(_0x4bdacc);const _0x3635bf=buildSegmentLookupMap(_0xebe3fd,_0x27ec56),_0x3e151a=buildSegmentNameToIdMap(_0xebe3fd),_0x45b94d=buildJourneyBundleLookupMap(_0x18efcc,_0x27ec56);let _0x1db1a0;if(_0x191f14){if(!_0x191f14['endsWith'](_0x51aa49(0x15a))&&!_0x191f14['endsWith']('.yaml'))return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x13e)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x191f14+'\x0a')),0x1;_0x1db1a0=[_0x191f14];}else _0x1db1a0=findYamlFiles(_0xb92413);if(_0x1db1a0['length']===0x0)return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x13e)](_0x51aa49(0x170)+_0xb92413+'\x0a')),console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x1ad)](_0x51aa49(0x129))),0x1;let _0xa3c621,_0x3234e3;try{const _0x342580=parseAndClassifyYamlFiles(_0x1db1a0,_0xb92413,{'skipSegments':_0x3b7f6b[_0x51aa49(0x1a5)]});_0xa3c621=_0x342580[_0x51aa49(0x1aa)],_0x3234e3=_0x342580[_0x51aa49(0x1b0)];const _0xe5c7e8=validateParsedFiles(_0x342580,_0xb92413);if(_0xe5c7e8['length']>0x0)return console['error'](a31_0x3b861f[_0x51aa49(0x13e)](_0x51aa49(0x148))),console[_0x51aa49(0x179)](formatValidationErrors(_0xe5c7e8)),console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x177)](_0x51aa49(0x149))),0x1;}catch(_0x21e412){return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x13e)](_0x51aa49(0x136)+(_0x21e412 instanceof Error?_0x21e412[_0x51aa49(0x1b7)]:_0x21e412))),0x1;}if(_0xa3c621['length']===0x0&&_0x3234e3['length']===0x0){const _0x58ee54=_0x3b7f6b[_0x51aa49(0x1a5)]?_0x51aa49(0x185):_0x51aa49(0x143);return console[_0x51aa49(0x179)](a31_0x3b861f['yellow']('No\x20'+_0x58ee54+'\x20YAML\x20files\x20found')),0x0;}const _0x63b896=new Map();_0xebe3fd[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0xebe3fd,async _0x2640ad=>{const _0x1c1ad9=a31_0x5cac,_0xf7881f=await _0x307bbc[_0x1c1ad9(0x1af)][_0x1c1ad9(0x17c)](_0x511b6d,_0x2640ad['id']);_0x63b896[_0x1c1ad9(0x197)](_0x2640ad['id'],_0xf7881f);});},{'verbose':_0x3b7f6b[_0x51aa49(0x196)]});const {segmentFiles:_0x1a2a93,foldersToCreate:_0x4a16b8}=await prepareSegmentFiles(_0xa3c621,{'segmentByFolderAndName':_0x3635bf,'activationsBySegmentId':_0x63b896,'folderPathToId':_0x5f2c5e,'idToEmailMap':_0xbff6e,'connectionIdToNameMap':_0x533d48},_0x569b5b,_0x45d4fb,_0x14baee),_0x39d349=_0x191f14?[]:findSegmentsToDelete(_0xebe3fd,_0xa3c621[_0x51aa49(0x1ac)](({yamlConfig:_0xdcab60,folderPath:_0x1345c3})=>({'yamlConfig':_0xdcab60,'folderPath':resolveTDFolderPath(_0x1345c3,_0x45d4fb,_0x14baee)})),_0x27ec56,_0x14baee,_0x45d4fb),{journeyFiles:_0x36000e,foldersToCreate:_0x1a3b3e}=await withProgressSpinner('Preparing\x20journeys...',async _0x15e9e6=>prepareJourneyFiles(_0x3234e3,{'fetchJourney':async _0x6d9f5f=>_0x307bbc[_0x51aa49(0x185)][_0x51aa49(0x15e)](_0x6d9f5f['journeyId']),'journeyBundlesByFolderAndName':_0x45b94d,'folderPathToId':_0x5f2c5e,'idToEmailMap':_0xbff6e,'connectionIdToNameMap':_0x533d48,'existingSegments':_0xebe3fd,'parentId':_0x511b6d,'deps':_0x307bbc,'progress':{'update':_0x2bd0c5=>{const _0x170636=_0x51aa49;_0x15e9e6[_0x170636(0x1a2)](_0x2bd0c5),_0x3b7f6b[_0x170636(0x196)]&&console['error']('\x20\x20'+_0x2bd0c5);}},'journeyById':_0x2878c0,'activationStepsById':_0x14cf77},_0x45d4fb,_0x14baee),{'verbose':_0x3b7f6b['verbose']})[_0x51aa49(0x138)](_0x210d6e=>_0x210d6e[_0x51aa49(0x159)]);for(const _0x46e01e of _0x1a3b3e){_0x4a16b8[_0x51aa49(0x184)](_0x46e01e);}const _0x22feb0=_0x191f14?[]:findJourneysToDelete(_0x18efcc,_0x3234e3['map'](({yamlConfig:_0x5430a3,folderPath:_0x7fd475})=>({'yamlConfig':_0x5430a3,'folderPath':resolveTDFolderPath(_0x7fd475,_0x45d4fb,_0x14baee)})),_0x27ec56,_0x14baee,_0x45d4fb),_0x432d1a=calculatePushStats(_0x1a2a93,_0x36000e,_0x4a16b8,_0x39d349,_0x22feb0,!!_0x3b7f6b[_0x51aa49(0x1b4)],!!_0x3b7f6b['journeysOnly']),_0x4f0976=_0x432d1a[_0x51aa49(0x1aa)][_0x51aa49(0x12b)],_0x2b05a2=_0x432d1a[_0x51aa49(0x1aa)][_0x51aa49(0x163)],_0x3ac135=_0x432d1a[_0x51aa49(0x1aa)][_0x51aa49(0x150)],_0x19cbd2=_0x432d1a[_0x51aa49(0x1aa)][_0x51aa49(0x16d)],_0x38d08b=_0x432d1a['folders']['toCreate'],_0x869862=_0x432d1a['journeys']['new'],_0x5beeaf=_0x432d1a[_0x51aa49(0x1b0)][_0x51aa49(0x163)],_0x1727d3=_0x432d1a[_0x51aa49(0x1b0)][_0x51aa49(0x150)],_0x186006=_0x432d1a[_0x51aa49(0x1b0)][_0x51aa49(0x16d)],_0x4604cb=_0x432d1a[_0x51aa49(0x172)][_0x51aa49(0x198)],_0x2b5ed3=_0x432d1a[_0x51aa49(0x172)][_0x51aa49(0x152)],_0x1de3db=_0x432d1a['activations']['toUpdate'],_0x43d0ef=_0x432d1a[_0x51aa49(0x172)][_0x51aa49(0x16d)];console[_0x51aa49(0x179)]('\x0aPush\x20summary\x20for\x20\x27'+_0x340498+'\x27:');_0x38d08b[_0x51aa49(0x1a8)]>0x0&&console[_0x51aa49(0x179)]('\x20\x20'+a31_0x3b861f[_0x51aa49(0x145)](_0x51aa49(0x146)+_0x38d08b[_0x51aa49(0x1a8)]+'\x20folders\x20to\x20create'));if(!_0x3b7f6b['journeysOnly']){console['error'](_0x51aa49(0x15b)),console['error'](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x190)]('+\x20'+_0x4f0976[_0x51aa49(0x1a8)]+'\x20new')),console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f['yellow']('~\x20'+_0x2b05a2[_0x51aa49(0x1a8)]+'\x20changed'));if(_0x19cbd2['length']>0x0)console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f['red']('-\x20'+_0x19cbd2[_0x51aa49(0x1a8)]+_0x51aa49(0x18c)));else _0x39d349['length']>0x0&&!_0x3b7f6b['delete']&&console[_0x51aa49(0x179)]('\x20\x20\x20\x20'+a31_0x3b861f[_0x51aa49(0x1b1)](_0x39d349['length']+_0x51aa49(0x132)));console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x1b1)]('=\x20'+_0x3ac135[_0x51aa49(0x1a8)]+_0x51aa49(0x13d)));}if(_0x36000e[_0x51aa49(0x1a8)]>0x0||_0x22feb0['length']>0x0){console[_0x51aa49(0x179)](_0x51aa49(0x1b8)),console['error'](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x190)]('+\x20'+_0x869862[_0x51aa49(0x1a8)]+_0x51aa49(0x1a4))),console[_0x51aa49(0x179)]('\x20\x20\x20\x20'+a31_0x3b861f[_0x51aa49(0x177)]('~\x20'+_0x5beeaf[_0x51aa49(0x1a8)]+_0x51aa49(0x1ae)));if(_0x186006[_0x51aa49(0x1a8)]>0x0)console['error'](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x13e)]('-\x20'+_0x186006[_0x51aa49(0x1a8)]+_0x51aa49(0x18c)));else _0x22feb0[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1b4)]&&console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x1b1)](_0x22feb0[_0x51aa49(0x1a8)]+_0x51aa49(0x132)));console['error'](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x1b1)]('=\x20'+_0x1727d3[_0x51aa49(0x1a8)]+_0x51aa49(0x13d)));}_0x4604cb[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)]&&(console[_0x51aa49(0x179)](''),console[_0x51aa49(0x179)](_0x51aa49(0x18e)),_0x2b5ed3[_0x51aa49(0x1a8)]>0x0&&console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x190)]('+\x20'+_0x2b5ed3[_0x51aa49(0x1a8)]+_0x51aa49(0x194))),_0x1de3db['length']>0x0&&console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f[_0x51aa49(0x177)]('~\x20'+_0x1de3db[_0x51aa49(0x1a8)]+_0x51aa49(0x147))),_0x43d0ef[_0x51aa49(0x1a8)]>0x0&&console[_0x51aa49(0x179)](_0x51aa49(0x175)+a31_0x3b861f['red']('-\x20'+_0x43d0ef[_0x51aa49(0x1a8)]+_0x51aa49(0x18c))));console[_0x51aa49(0x179)](_0x51aa49(0x17f)+a31_0x3b861f[_0x51aa49(0x1ad)](_0xb92413)+'\x0a');if(_0x38d08b['length']>0x0){console[_0x51aa49(0x179)](_0x51aa49(0x153));for(const _0x1e3e52 of _0x38d08b){console[_0x51aa49(0x179)]('\x20\x20'+a31_0x3b861f[_0x51aa49(0x145)]('+')+'\x20'+_0x1e3e52);}console[_0x51aa49(0x179)]('');}if(_0x4f0976[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)])for(const _0x2fbd7e of _0x4f0976){const _0x583916=_0x2fbd7e[_0x51aa49(0x154)]?_0x2fbd7e[_0x51aa49(0x154)]+'/'+_0x2fbd7e[_0x51aa49(0x16c)][_0x51aa49(0x14b)]:_0x2fbd7e['yamlConfig'][_0x51aa49(0x14b)],_0x213adb=_0x2fbd7e[_0x51aa49(0x16c)]['activations']?.[_0x51aa49(0x1a8)]||0x0,_0x3287cd=_0x213adb>0x0?a31_0x3b861f['dim']('\x20['+_0x213adb+_0x51aa49(0x173)):'';console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x190)]('New\x20segment:')+'\x20'+_0x583916+_0x3287cd),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c)),_0x2fbd7e[_0x51aa49(0x187)]&&console[_0x51aa49(0x179)](_0x2fbd7e[_0x51aa49(0x187)]),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c));}if(_0x19cbd2[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)])for(const _0x2eddbf of _0x19cbd2){const _0x2110c5=_0x2eddbf[_0x51aa49(0x162)]?_0x27ec56['get'](_0x2eddbf[_0x51aa49(0x162)]['toString']())||'':'',_0x3b3d0f=_0x2110c5?_0x2110c5+'/'+_0x2eddbf[_0x51aa49(0x14b)]:_0x2eddbf[_0x51aa49(0x14b)],_0x23113a=_0x63b896['get'](_0x2eddbf['id'])||[],_0x181bdd=_0x23113a[_0x51aa49(0x1a8)]>0x0?a31_0x3b861f['dim']('\x20['+_0x23113a[_0x51aa49(0x1a8)]+'\x20activations]'):'';console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x13e)]('Delete\x20segment:')+'\x20'+_0x3b3d0f+_0x181bdd),console['error']('─'[_0x51aa49(0x19c)](0x3c));const _0x48a001=segmentWithActivationsToYaml(_0x2eddbf,_0x23113a,undefined,_0xbff6e,_0x533d48),_0x441ca1=segmentToYamlString(_0x48a001),_0x1d6aac=generateDiff(_0x441ca1,'');console['error'](formatDiffWithColors(_0x1d6aac)),console['error']('─'['repeat'](0x3c));}const _0x3ea022=_0x1a2a93[_0x51aa49(0x1b9)](_0x594d2f=>!_0x594d2f[_0x51aa49(0x130)]&&_0x594d2f[_0x51aa49(0x187)]);if(_0x3ea022[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b['journeysOnly'])for(const _0xcc0428 of _0x3ea022){const _0x14487d=_0xcc0428['folderPath']?_0xcc0428['folderPath']+'/'+_0xcc0428[_0x51aa49(0x16c)]['name']:_0xcc0428[_0x51aa49(0x16c)][_0x51aa49(0x14b)];console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x177)](_0x51aa49(0x141))+'\x20'+_0x14487d),console['error']('─'['repeat'](0x3c)),console[_0x51aa49(0x179)](_0xcc0428['diff']),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c));}if(_0x869862[_0x51aa49(0x1a8)]>0x0)for(const _0xa1fff1 of _0x869862){const _0x362474=_0xa1fff1['folderPath']?_0xa1fff1[_0x51aa49(0x154)]+'/'+_0xa1fff1[_0x51aa49(0x16c)][_0x51aa49(0x14b)]:_0xa1fff1[_0x51aa49(0x16c)][_0x51aa49(0x14b)];console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x190)](_0x51aa49(0x165))+'\x20'+_0x362474),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c)),_0xa1fff1[_0x51aa49(0x187)]&&console[_0x51aa49(0x179)](_0xa1fff1[_0x51aa49(0x187)]),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c));}const _0x441e82=_0x36000e[_0x51aa49(0x1b9)](_0x1a74bd=>!_0x1a74bd['isNew']&&_0x1a74bd['diff']);if(_0x441e82[_0x51aa49(0x1a8)]>0x0)for(const _0xc0634c of _0x441e82){const _0x41f455=_0xc0634c[_0x51aa49(0x154)]?_0xc0634c[_0x51aa49(0x154)]+'/'+_0xc0634c[_0x51aa49(0x16c)][_0x51aa49(0x14b)]:_0xc0634c['yamlConfig']['name'];console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x177)]('Changes\x20to\x20journey:')+'\x20'+_0x41f455),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c)),console[_0x51aa49(0x179)](_0xc0634c['diff']),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c));}if(_0x186006[_0x51aa49(0x1a8)]>0x0)for(const _0x508275 of _0x186006){const _0x50ceda=_0x508275['folderId']?_0x27ec56['get'](_0x508275[_0x51aa49(0x134)])||'':'',_0x30d391=_0x50ceda?_0x50ceda+'/'+_0x508275[_0x51aa49(0x16b)]:_0x508275[_0x51aa49(0x16b)];console[_0x51aa49(0x179)]('\x0a'+a31_0x3b861f[_0x51aa49(0x13e)](_0x51aa49(0x1a6))+'\x20'+_0x30d391),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c)),console[_0x51aa49(0x179)](a31_0x3b861f['red'](_0x51aa49(0x156))),console[_0x51aa49(0x179)]('─'[_0x51aa49(0x19c)](0x3c));}if(_0x3b7f6b[_0x51aa49(0x191)])return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x177)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x126af6=_0x3b7f6b[_0x51aa49(0x1a5)]?![]:_0x4f0976[_0x51aa49(0x1a8)]>0x0||_0x2b05a2[_0x51aa49(0x1a8)]>0x0||_0x19cbd2[_0x51aa49(0x1a8)]>0x0,_0x53f02a=_0x869862[_0x51aa49(0x1a8)]>0x0||_0x5beeaf['length']>0x0||_0x186006['length']>0x0,_0x31bf30=_0x3b7f6b[_0x51aa49(0x1a5)]?![]:_0x4604cb[_0x51aa49(0x1a8)]>0x0,_0x52ec79=_0x38d08b['length']>0x0;if(!_0x126af6&&!_0x53f02a&&!_0x31bf30&&!_0x52ec79){const _0x2e249a=_0x3b7f6b[_0x51aa49(0x1a5)]?_0x51aa49(0x17d):_0x51aa49(0x155);console[_0x51aa49(0x179)](a31_0x3b861f['green'](_0x2e249a));if(_0x191f14&&_0x1727d3[_0x51aa49(0x1a8)]===0x1){const _0x4a4028=_0x1727d3[0x0];if(_0x4a4028[_0x51aa49(0x12f)]?.['id']){const _0x15900f=getConsoleNextUrl(_0x3b7f6b[_0x51aa49(0x14e)],_0x51aa49(0x1ba)+_0x511b6d+'/e/'+_0x4a4028['existingJourney']['id']+_0x51aa49(0x180));console['error']('\x20\x20'+a31_0x3b861f[_0x51aa49(0x1ad)](_0x15900f));}}return 0x0;}const _0x2aad3c=_0x3b7f6b[_0x51aa49(0x1a5)]?_0x869862[_0x51aa49(0x1a8)]+_0x5beeaf[_0x51aa49(0x1a8)]+_0x186006['length']+_0x38d08b[_0x51aa49(0x1a8)]:_0x4f0976[_0x51aa49(0x1a8)]+_0x2b05a2['length']+_0x19cbd2[_0x51aa49(0x1a8)]+_0x869862[_0x51aa49(0x1a8)]+_0x5beeaf['length']+_0x186006[_0x51aa49(0x1a8)]+_0x38d08b['length']+_0x4604cb[_0x51aa49(0x1a8)];if(!_0x3b7f6b[_0x51aa49(0x133)]&&_0x2aad3c>0x0){const _0x50c551=await confirmKey(_0x51aa49(0x1b3)+_0x2aad3c+_0x51aa49(0x17b));if(!_0x50c551)return console[_0x51aa49(0x179)](_0x51aa49(0x1a9)),0x1;}const _0x3e9f8f={'withProgress':async(_0x5a2de5,_0x543dc4)=>{const _0xddf39=_0x51aa49,_0x29ca73=await withSpinner(_0x5a2de5,_0x543dc4,{'verbose':_0x3b7f6b['verbose']});return{'data':_0x29ca73[_0xddf39(0x159)]};},'logInfo':_0x7a83f9=>console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x145)]('✔\x20'+_0x7a83f9)),'logSuccess':_0x4938ea=>console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x190)]('✔\x20'+_0x4938ea)),'logWarning':_0x4b9739=>console['error'](a31_0x3b861f['yellow']('⚠\x20'+_0x4b9739)),'logDeleted':_0x224353=>console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x13e)]('✔\x20'+_0x224353))},_0x3091af={'segment':_0x307bbc['segment'],'journey':_0x307bbc[_0x51aa49(0x185)],'user':_0x307bbc['user'],'connection':_0x307bbc[_0x51aa49(0x13f)]};_0x38d08b[_0x51aa49(0x1a8)]>0x0&&(_0x5f2c5e=await executePushFolders(_0x3091af,_0x38d08b,_0x5f2c5e,{'parentId':_0x511b6d},_0x3e9f8f));const _0x18386a={'rootFolderId':_0x3dd70c,'folderPathToId':_0x5f2c5e,'folderIdToPath':_0x27ec56,'segmentNameToId':_0x3e151a,'activationsBySegmentId':_0x63b896,'emailToIdMap':_0x138ab1,'idToEmailMap':_0xbff6e,'connectionNameToIdMap':_0x27e833['nameToId'],'connectionIdToNameMap':_0x27e833[_0x51aa49(0x158)],'connectionNameToTypeMap':_0x54d161},_0x5ef379=await executePushSegments(_0x3091af,_0x3b7f6b['journeysOnly']?[]:_0x1a2a93,_0x18386a,{'parentId':_0x511b6d},_0x3e9f8f),_0x58203c=_0x5ef379['created'],_0x367eaf=_0x5ef379['updated'],_0x516dcc=_0x5ef379['activations'][_0x51aa49(0x14f)],_0x35bc8e=_0x5ef379[_0x51aa49(0x172)][_0x51aa49(0x18d)],_0x1b3e2f=_0x5ef379[_0x51aa49(0x172)]['deleted'],_0x1b66fd=await executePushSegmentDeletions(_0x3091af,_0x3b7f6b[_0x51aa49(0x1a5)]?[]:_0x19cbd2,_0x3e9f8f);let _0x58cb40=0x0,_0x36a89e=0x0,_0x30fc3c=0x0;const _0x595d97=new Map(_0x3e151a);for(const [_0x2212af,_0x5b7c3e]of _0x5ef379[_0x51aa49(0x13b)]){_0x595d97['set'](_0x2212af,_0x5b7c3e);}if(_0x36000e[_0x51aa49(0x1a8)]>0x0){const _0xb04c41={..._0x18386a,'segmentNameToId':_0x595d97,'existingSegments':_0xebe3fd,'activationContext':_0x569b5b},_0x13026a=await executePushJourneys(_0x3091af,_0x36000e,_0xb04c41,{'parentId':_0x511b6d,'rootFolderId':_0x3dd70c,'verbose':_0x3b7f6b[_0x51aa49(0x196)]},_0x3e9f8f);_0x58cb40=_0x13026a[_0x51aa49(0x14f)],_0x36a89e=_0x13026a[_0x51aa49(0x18d)];if(_0x191f14&&_0x13026a['results'][_0x51aa49(0x1a8)]===0x1){const _0x55f081=_0x13026a[_0x51aa49(0x169)][0x0];if(_0x55f081[_0x51aa49(0x199)]){const _0x55d991=getConsoleNextUrl(_0x3b7f6b[_0x51aa49(0x14e)],_0x51aa49(0x1ba)+_0x511b6d+_0x51aa49(0x1ab)+_0x55f081[_0x51aa49(0x199)]+_0x51aa49(0x180));console[_0x51aa49(0x179)]('\x20\x20'+a31_0x3b861f[_0x51aa49(0x1ad)](_0x55d991));}}}for(const _0x42a047 of _0x186006){console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x177)](_0x51aa49(0x1a0)+_0x42a047[_0x51aa49(0x16b)])),_0x30fc3c++;}const _0x4b467d=[];if(_0x58203c>0x0)_0x4b467d[_0x51aa49(0x140)](_0x58203c+_0x51aa49(0x1b6));if(_0x367eaf>0x0)_0x4b467d[_0x51aa49(0x140)](_0x367eaf+'\x20updated');if(_0x1b66fd>0x0)_0x4b467d['push'](_0x1b66fd+'\x20deleted');const _0x2aa6a3=[];if(_0x58cb40>0x0)_0x2aa6a3[_0x51aa49(0x140)](_0x58cb40+_0x51aa49(0x1b6));if(_0x36a89e>0x0)_0x2aa6a3[_0x51aa49(0x140)](_0x36a89e+_0x51aa49(0x15c));if(_0x30fc3c>0x0)_0x2aa6a3['push'](_0x30fc3c+'\x20deleted');const _0x3b9121=[];if(_0x516dcc>0x0)_0x3b9121[_0x51aa49(0x140)](_0x516dcc+_0x51aa49(0x1b6));if(_0x35bc8e>0x0)_0x3b9121[_0x51aa49(0x140)](_0x35bc8e+_0x51aa49(0x15c));if(_0x1b3e2f>0x0)_0x3b9121[_0x51aa49(0x140)](_0x1b3e2f+'\x20deleted');return console[_0x51aa49(0x179)](a31_0x3b861f[_0x51aa49(0x190)](_0x51aa49(0x17a))),_0x4b467d['length']>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)]&&console[_0x51aa49(0x179)](_0x51aa49(0x12c)+_0x4b467d[_0x51aa49(0x14a)](',\x20')),_0x2aa6a3[_0x51aa49(0x1a8)]>0x0&&console[_0x51aa49(0x179)]('\x20\x20Journeys:\x20'+_0x2aa6a3[_0x51aa49(0x14a)](',\x20')),_0x3b9121[_0x51aa49(0x1a8)]>0x0&&!_0x3b7f6b[_0x51aa49(0x1a5)]&&console['error'](_0x51aa49(0x1a3)+_0x3b9121[_0x51aa49(0x14a)](',\x20')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x279fbb=a32_0x2f8b;(function(_0x2c5a1c,_0x5b16d5){const _0x41285b=a32_0x2f8b,_0x1bd86d=_0x2c5a1c();while(!![]){try{const _0x32a6d9=parseInt(_0x41285b(0x162))/0x1*(parseInt(_0x41285b(0x17c))/0x2)+parseInt(_0x41285b(0x189))/0x3*(-parseInt(_0x41285b(0x174))/0x4)+-parseInt(_0x41285b(0x168))/0x5+-parseInt(_0x41285b(0x179))/0x6+parseInt(_0x41285b(0x165))/0x7*(parseInt(_0x41285b(0x188))/0x8)+-parseInt(_0x41285b(0x180))/0x9+parseInt(_0x41285b(0x161))/0xa;if(_0x32a6d9===_0x5b16d5)break;else _0x1bd86d['push'](_0x1bd86d['shift']());}catch(_0x532a56){_0x1bd86d['push'](_0x1bd86d['shift']());}}}(a32_0x36be,0xb36f7));function a32_0x2f8b(_0x26a964,_0x5d365a){_0x26a964=_0x26a964-0x15f;const _0x36be5e=a32_0x36be();let _0x2f8bf1=_0x36be5e[_0x26a964];return _0x2f8bf1;}import{BaseCommand}from'./command.js';function a32_0x36be(){const _0x1b0e33=['includes','segment','Examples:','resolveFolderId','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','resolvePathToResource','INTERNAL','length','type','28802320xJrYCL','97lcWBWo','\x20\x20\x20Path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','70KGVlco','description','Segment\x20ID:\x20','5289130DfGhoy','verbose','kind','segmentId','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segmentPath','Resolving\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','name','error','data','\x27...','4GWjWKf','ruleFile','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','1473264qkLHOt','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Update\x20existing\x20child\x20segment','19318mDpYqr','Resolving\x20path\x20\x27','segmentName','rule','10388151PuNVlB','segment:update','folder','Resolved\x20type:\x20','Error:\x20Cannot\x20update\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Updating\x20segment\x20\x27','parentId','136600Kknpkv','2385987zNXdVl'];a32_0x36be=function(){return _0x1b0e33;};return a32_0x36be();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a32_0x46b22 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a32_0x279fbb(0x181);[a32_0x279fbb(0x166)]=a32_0x279fbb(0x17b);async['execute'](_0x23e493){const _0x480590=a32_0x279fbb;console[_0x480590(0x171)](a32_0x46b22['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x480590(0x171)](a32_0x46b22['yellow'](_0x480590(0x164)));const {options:_0xfd7cb7,args:_0x45180f,tdx:_0x1a6a5e}=_0x23e493,_0x2efbdd=_0xfd7cb7;if(_0x45180f[_0x480590(0x15f)]===0x0)return console[_0x480590(0x171)](_0x480590(0x18e)),console['error'](_0x480590(0x178)),console[_0x480590(0x171)](_0x480590(0x18c)),console['error'](_0x480590(0x185)),console[_0x480590(0x171)](_0x480590(0x16c)),0x1;const _0x4f1613=_0x45180f[0x0],_0x3fae1c=_0xfd7cb7[_0x480590(0x16d)];let _0x3263a4=_0x4f1613;_0x3fae1c&&!_0x4f1613[_0x480590(0x18a)]('/')&&(_0x3263a4=_0x3fae1c+'/'+_0x4f1613,_0x2efbdd['verbose']&&console['error'](_0x480590(0x16f)+_0x3263a4));const _0x168f97=await withSpinner(_0x480590(0x17d)+_0x3263a4+'\x27...',()=>_0x1a6a5e['segment'][_0x480590(0x18f)](_0x3263a4),{'verbose':_0x2efbdd[_0x480590(0x169)]}),_0x5dcc44=_0x168f97[_0x480590(0x172)];_0x2efbdd[_0x480590(0x169)]&&console[_0x480590(0x171)](_0x480590(0x183)+_0x5dcc44[_0x480590(0x160)]);if(_0x5dcc44[_0x480590(0x160)]!==_0x480590(0x18b))return console[_0x480590(0x171)](_0x480590(0x184)+_0x5dcc44[_0x480590(0x160)]+_0x480590(0x17a)),console['error'](_0x480590(0x176)),0x1;if(!_0x5dcc44[_0x480590(0x16b)])throw new SDKError(ErrorCode[_0x480590(0x190)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d1276=_0x5dcc44[_0x480590(0x187)],_0x2de37b=_0x5dcc44[_0x480590(0x16b)];_0x2efbdd[_0x480590(0x169)]&&(console[_0x480590(0x171)](_0x480590(0x177)+_0x4d1276),console[_0x480590(0x171)](_0x480590(0x167)+_0x2de37b));let _0x1a5bcf;if(_0x2efbdd[_0x480590(0x182)]){const _0x3017e5=_0x2efbdd[_0x480590(0x182)],_0x113d29=await withSpinner(_0x480590(0x16e)+_0x3017e5+'\x27...',()=>_0x1a6a5e['segment'][_0x480590(0x18d)](_0x4d1276,_0x3017e5),{'verbose':_0x2efbdd[_0x480590(0x169)]});_0x1a5bcf=parseInt(_0x113d29['data'],0xa),_0x2efbdd[_0x480590(0x169)]&&console[_0x480590(0x171)]('Resolved\x20folder\x20ID:\x20'+_0x1a5bcf);}const _0x5490af=await loadJSONFromOptions(_0x2efbdd[_0x480590(0x17f)],_0x2efbdd[_0x480590(0x175)]),_0x28299b={'name':_0x2efbdd[_0x480590(0x170)],'description':_0x2efbdd['description'],'rule':_0x5490af,'kind':_0x2efbdd['kind']!==undefined?parseInt(_0x2efbdd[_0x480590(0x16a)],0xa):undefined,'segmentFolderId':_0x1a5bcf},_0x5d77a3=await withSpinner(_0x480590(0x186)+_0x5dcc44[_0x480590(0x17e)]+_0x480590(0x173),()=>_0x1a6a5e[_0x480590(0x18b)]['updateSegmentById'](_0x4d1276,_0x2de37b,_0x28299b),{'verbose':_0x2efbdd['verbose']}),_0x1224f7=_0x5d77a3[_0x480590(0x172)];return console[_0x480590(0x171)]('✔\x20Updated\x20segment\x20\x27'+_0x1224f7[_0x480590(0x170)]+'\x27'),_0x3263a4!==_0x4f1613&&console['error'](_0x480590(0x163)+_0x3263a4),await handleSDKOutput([_0x1224f7],_0x2efbdd),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a33_0x3d5c(){const _0x5cb6fc=['length','execute','Examples:','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','verbose','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','dim','site','4275535HecCmv','red','Site:\x20','folderId','segment','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','folderPath','parentName','fullPath','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','error','Error:\x20Path\x20is\x20required\x0a','session','type','Usage:\x20tdx\x20segment\x20use\x20<path>','2035100PiqcvX','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','357535DyFhLo','Resolved\x20path\x20type:\x20','segment:use','110LExAVS','isAbsolute','6105640QDsHmS','cyan','resolvePathToResource','log','green','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','524859DZOksm','parentId','Folder\x20ID:\x20','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','6WrmtvR','data','Target\x20path:\x20','7hHTQkj','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','✔\x20Context\x20set\x20to:\x20','isDirectory','segments','slice','4152BiPwVg','\x27...','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','join','Resolving\x20path\x20\x27','name','4CIMuAg','891387gbUfon','split'];a33_0x3d5c=function(){return _0x5cb6fc;};return a33_0x3d5c();}const a33_0x36c230=a33_0x3b94;(function(_0x5b7a82,_0x208c9f){const _0x438130=a33_0x3b94,_0x3498e9=_0x5b7a82();while(!![]){try{const _0x5a10e0=-parseInt(_0x438130(0x119))/0x1+-parseInt(_0x438130(0x10b))/0x2+-parseInt(_0x438130(0xeb))/0x3*(-parseInt(_0x438130(0xf1))/0x4)+parseInt(_0x438130(0x10e))/0x5*(parseInt(_0x438130(0x11d))/0x6)+-parseInt(_0x438130(0x120))/0x7*(-parseInt(_0x438130(0x113))/0x8)+-parseInt(_0x438130(0xf2))/0x9*(-parseInt(_0x438130(0x111))/0xa)+parseInt(_0x438130(0xfc))/0xb;if(_0x5a10e0===_0x208c9f)break;else _0x3498e9['push'](_0x3498e9['shift']());}catch(_0x4a7b2f){_0x3498e9['push'](_0x3498e9['shift']());}}}(a33_0x3d5c,0xbc705));import{existsSync,statSync}from'fs';import a33_0x2cfbc4 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';function a33_0x3b94(_0x1c257d,_0x3bcd4a){_0x1c257d=_0x1c257d-0xe9;const _0x3d5c57=a33_0x3d5c();let _0x3b9406=_0x3d5c57[_0x1c257d];return _0x3b9406;}import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a33_0x36c230(0xf0)]=a33_0x36c230(0x110);['description']='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a33_0x36c230(0xf5)](_0x230e8b){const _0x32ead8=a33_0x36c230,{options:_0x3a371a,args:_0x222d0d,tdx:_0x47abe7}=_0x230e8b;if(_0x222d0d[_0x32ead8(0xf4)]===0x0)return console['error'](a33_0x2cfbc4[_0x32ead8(0xfd)](_0x32ead8(0x107))),console[_0x32ead8(0x106)](_0x32ead8(0x10a)),console[_0x32ead8(0x106)](_0x32ead8(0xf6)),console[_0x32ead8(0x106)](_0x32ead8(0x121)),console[_0x32ead8(0x106)](_0x32ead8(0x11c)),console['error'](_0x32ead8(0xf7)),console[_0x32ead8(0x106)](_0x32ead8(0xf9)),0x1;const _0x10855e=_0x222d0d[0x0],_0x3498e7=_0x3a371a[_0x32ead8(0x108)];try{if(_0x10855e==='/')return saveSessionContext({'segment_path':undefined},_0x3498e7),console[_0x32ead8(0x116)](a33_0x2cfbc4[_0x32ead8(0x117)](_0x32ead8(0x10c))),0x0;if(existsSync(_0x10855e)&&statSync(_0x10855e)[_0x32ead8(0x123)]()){let _0x4879fd;try{_0x4879fd=findTdxConfig(_0x10855e);}catch{return console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0xfd)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x10855e)),console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0x114)](_0x32ead8(0x105))),0x1;}const _0x23bd29=_0x4879fd['config']['parent_segment'];return saveSessionContext({'segment_path':_0x23bd29,'parent_segment':_0x23bd29},_0x3498e7),console['log'](a33_0x2cfbc4[_0x32ead8(0x117)]('✔\x20Context\x20set\x20to:\x20'+a33_0x2cfbc4[_0x32ead8(0x114)](_0x23bd29))),0x0;}const _0x2e0544=_0x3a371a['segmentPath'];let _0x16fd62=_0x10855e;const _0x413555=parsePath(_0x10855e);if(!_0x413555[_0x32ead8(0x112)]){if(!_0x2e0544)return console['error'](a33_0x2cfbc4[_0x32ead8(0xfd)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x32ead8(0x106)](a33_0x2cfbc4['cyan'](_0x32ead8(0x118))),0x1;if(_0x10855e==='..'){const _0x2bf0bb=_0x2e0544[_0x32ead8(0xf3)]('/')[_0x32ead8(0xea)](0x0,-0x1)[_0x32ead8(0xee)]('/');_0x16fd62=_0x2bf0bb||'/';}else _0x10855e==='.'?_0x16fd62=_0x2e0544:_0x16fd62=_0x2e0544+'/'+_0x10855e;_0x3a371a[_0x32ead8(0xf8)]&&console[_0x32ead8(0x106)]('Resolved\x20relative\x20path\x20to:\x20'+_0x16fd62);}if(_0x16fd62==='/'||_0x16fd62==='')return saveSessionContext({'segment_path':undefined},_0x3498e7),console[_0x32ead8(0x116)](a33_0x2cfbc4[_0x32ead8(0x117)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x16fd62=normalizePath(_0x16fd62);const _0x59acb3=parsePath(_0x16fd62)[_0x32ead8(0xe9)];if(_0x59acb3[_0x32ead8(0xf4)]===0x0)return saveSessionContext({'segment_path':undefined},_0x3498e7),console['log'](a33_0x2cfbc4[_0x32ead8(0x117)](_0x32ead8(0x10c))),0x0;_0x3a371a['verbose']&&(console[_0x32ead8(0x106)](_0x32ead8(0xfe)+_0x3a371a[_0x32ead8(0xfb)]),console['error'](_0x32ead8(0x11f)+_0x16fd62));const _0x7aac63=await withSpinner(_0x32ead8(0xef)+_0x16fd62+_0x32ead8(0xec),()=>_0x47abe7[_0x32ead8(0x100)][_0x32ead8(0x115)](_0x16fd62),{'verbose':_0x3a371a[_0x32ead8(0xf8)]}),_0x5c286e=_0x7aac63[_0x32ead8(0x11e)];_0x3a371a[_0x32ead8(0xf8)]&&(console[_0x32ead8(0x106)](_0x32ead8(0x10f)+_0x5c286e[_0x32ead8(0x109)]),console[_0x32ead8(0x106)]('Parent\x20ID:\x20'+_0x5c286e[_0x32ead8(0x11a)]),_0x5c286e[_0x32ead8(0xff)]&&console['error'](_0x32ead8(0x11b)+_0x5c286e[_0x32ead8(0xff)]));if(_0x5c286e['type']===_0x32ead8(0x100))return console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0xfd)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x32ead8(0x106)](_0x32ead8(0x10d)),console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0x114)]('Use:\x20tdx\x20segment\x20use\x20'+_0x5c286e[_0x32ead8(0x103)]+(_0x5c286e[_0x32ead8(0x102)]?'/'+_0x5c286e[_0x32ead8(0x102)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x5c286e[_0x32ead8(0x104)],'parent_segment':_0x5c286e[_0x32ead8(0x103)]},_0x3498e7),console[_0x32ead8(0x116)](a33_0x2cfbc4['green'](_0x32ead8(0x122)+a33_0x2cfbc4[_0x32ead8(0x114)](_0x5c286e[_0x32ead8(0x104)]))),_0x3a371a[_0x32ead8(0xf8)]&&(console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0xfa)](_0x32ead8(0xed))),console[_0x32ead8(0x106)](a33_0x2cfbc4[_0x32ead8(0xfa)](_0x32ead8(0x101)))),0x0;}catch(_0xd99829){throw _0xd99829;}}}
|