@treasuredata/tdx 0.14.7 → 0.14.8

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.
Files changed (139) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/api-command.js +1 -1
  8. package/dist/commands/auth-command.js +1 -1
  9. package/dist/commands/chat-command.js +1 -1
  10. package/dist/commands/claude-command.js +1 -1
  11. package/dist/commands/claude-statusline-command.js +1 -1
  12. package/dist/commands/claude-usage-command.js +1 -1
  13. package/dist/commands/command.js +1 -1
  14. package/dist/commands/connection-command.js +1 -1
  15. package/dist/commands/databases.js +1 -1
  16. package/dist/commands/describe.js +1 -1
  17. package/dist/commands/engage-command.js +1 -1
  18. package/dist/commands/job-command.js +1 -1
  19. package/dist/commands/journey-command.js +1 -1
  20. package/dist/commands/journey-validate-command.js +1 -1
  21. package/dist/commands/llm-command.js +1 -1
  22. package/dist/commands/llm-proxy.js +1 -1
  23. package/dist/commands/parent-segment-command.js +1 -1
  24. package/dist/commands/profile-command.js +1 -1
  25. package/dist/commands/profiles-command.js +1 -1
  26. package/dist/commands/query-command.js +1 -1
  27. package/dist/commands/segment-command.js +1 -1
  28. package/dist/commands/segment-create-command.js +1 -1
  29. package/dist/commands/segment-fields-command.js +1 -1
  30. package/dist/commands/segment-pull-command.js +1 -1
  31. package/dist/commands/segment-push-command.js +1 -1
  32. package/dist/commands/segment-update-command.js +1 -1
  33. package/dist/commands/segment-use-command.js +1 -1
  34. package/dist/commands/segment-validate-command.js +1 -1
  35. package/dist/commands/segments.js +1 -1
  36. package/dist/commands/show.js +1 -1
  37. package/dist/commands/tables.js +1 -1
  38. package/dist/commands/unset-command.js +1 -1
  39. package/dist/commands/use-command.js +1 -1
  40. package/dist/commands/user-command.js +1 -1
  41. package/dist/commands/workflow-command.js +1 -1
  42. package/dist/core/auth.js +1 -1
  43. package/dist/core/command-output.js +1 -1
  44. package/dist/core/config.js +1 -1
  45. package/dist/core/connection-cache.js +1 -1
  46. package/dist/core/constants.js +1 -1
  47. package/dist/core/credential-cache.js +1 -1
  48. package/dist/core/global-context.js +1 -1
  49. package/dist/core/keychain.js +1 -1
  50. package/dist/core/profile.js +1 -1
  51. package/dist/core/project-config.js +1 -1
  52. package/dist/core/session.js +1 -1
  53. package/dist/core/user-cache.js +1 -1
  54. package/dist/core/version.js +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/proxy/anthropic-adapter.js +1 -1
  57. package/dist/proxy/claude-usage-tracker.js +1 -1
  58. package/dist/proxy/context-signature.js +1 -1
  59. package/dist/proxy/conversation-utils.js +1 -1
  60. package/dist/proxy/passthrough-server.js +1 -1
  61. package/dist/proxy/server.js +1 -1
  62. package/dist/proxy/session-cache.js +1 -1
  63. package/dist/proxy/sse-usage-parser.js +1 -1
  64. package/dist/sdk/agent/agent-config.js +1 -1
  65. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  66. package/dist/sdk/agent/agent-yaml.js +1 -1
  67. package/dist/sdk/api.js +1 -1
  68. package/dist/sdk/client/cdp-api-client.js +1 -1
  69. package/dist/sdk/client/endpoints.js +1 -1
  70. package/dist/sdk/client/engage-api-client.js +1 -1
  71. package/dist/sdk/client/http-client.js +1 -1
  72. package/dist/sdk/client/llm-api-client.js +1 -1
  73. package/dist/sdk/client/rate-limiter.js +1 -1
  74. package/dist/sdk/client/td-api-client.js +1 -1
  75. package/dist/sdk/client/trino-api-client.js +1 -1
  76. package/dist/sdk/client/workflow-client.js +1 -1
  77. package/dist/sdk/connection-validator.js +1 -1
  78. package/dist/sdk/connection.js +1 -1
  79. package/dist/sdk/engage.js +1 -1
  80. package/dist/sdk/errors.js +1 -1
  81. package/dist/sdk/index.js +1 -1
  82. package/dist/sdk/io/index.js +1 -1
  83. package/dist/sdk/io/node-filesystem.js +1 -1
  84. package/dist/sdk/job.js +1 -1
  85. package/dist/sdk/journey.js +1 -1
  86. package/dist/sdk/llm/chat-cache.js +1 -1
  87. package/dist/sdk/llm/index.js +1 -1
  88. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  89. package/dist/sdk/llm/model-aliases.js +1 -1
  90. package/dist/sdk/llm/model-factors.js +1 -1
  91. package/dist/sdk/query/index.js +1 -1
  92. package/dist/sdk/query/sql-parser.js +1 -1
  93. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  94. package/dist/sdk/segment/fields-display.js +1 -1
  95. package/dist/sdk/segment/file-discovery.js +1 -1
  96. package/dist/sdk/segment/journey-utils.js +1 -1
  97. package/dist/sdk/segment/journey-yaml.js +1 -1
  98. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  99. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  100. package/dist/sdk/segment/pull-workflow.js +1 -1
  101. package/dist/sdk/segment/push-workflow.js +1 -1
  102. package/dist/sdk/segment/resolution-context.js +1 -1
  103. package/dist/sdk/segment/segment-path-parser.js +1 -1
  104. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  105. package/dist/sdk/segment/target-resolution.js +1 -1
  106. package/dist/sdk/segment/tdx-config.js +1 -1
  107. package/dist/sdk/segment/validate-files.js +1 -1
  108. package/dist/sdk/segment/yaml-validator.js +1 -1
  109. package/dist/sdk/segment.js +1 -1
  110. package/dist/sdk/types/index.js +1 -1
  111. package/dist/sdk/types/progress.js +1 -1
  112. package/dist/sdk/user.js +1 -1
  113. package/dist/sdk/util/format-detector.js +1 -1
  114. package/dist/sdk/util/formatters.js +1 -1
  115. package/dist/sdk/util/index.js +1 -1
  116. package/dist/sdk/util/tree-formatter.js +1 -1
  117. package/dist/sdk/workflow/clone-workflow.js +1 -1
  118. package/dist/sdk/workflow/index.js +1 -1
  119. package/dist/sdk/workflow/pull-workflow.js +1 -1
  120. package/dist/sdk/workflow/push-workflow.js +1 -1
  121. package/dist/sdk/workflow/tdx-config.js +1 -1
  122. package/dist/sdk/workflow/workflow-utils.js +1 -1
  123. package/dist/tdx +10 -0
  124. package/dist/utils/async.js +1 -1
  125. package/dist/utils/colors.js +1 -1
  126. package/dist/utils/diff.js +1 -1
  127. package/dist/utils/file-permissions.js +1 -1
  128. package/dist/utils/json-loader.js +1 -1
  129. package/dist/utils/option-validation.js +1 -1
  130. package/dist/utils/port.js +1 -1
  131. package/dist/utils/process.js +1 -1
  132. package/dist/utils/prompt.js +1 -1
  133. package/dist/utils/spinner.js +1 -1
  134. package/dist/utils/sse-parser.js +1 -1
  135. package/dist/utils/string-utils.js +1 -1
  136. package/dist/utils/table-ref-parser.js +1 -1
  137. package/dist/utils/tdx-logger.js +1 -1
  138. package/dist/utils/version-check.js +1 -1
  139. package/package.json +2 -2
@@ -1 +1 @@
1
- const a25_0x3f95e6=a25_0x3463;(function(_0x5a6cc8,_0x1fef0a){const _0x4529de=a25_0x3463,_0xd49418=_0x5a6cc8();while(!![]){try{const _0x3b0d84=-parseInt(_0x4529de(0x1f7))/0x1+parseInt(_0x4529de(0x23f))/0x2+-parseInt(_0x4529de(0x253))/0x3*(-parseInt(_0x4529de(0x1c9))/0x4)+parseInt(_0x4529de(0x1fa))/0x5*(parseInt(_0x4529de(0x25a))/0x6)+-parseInt(_0x4529de(0x250))/0x7*(parseInt(_0x4529de(0x1c8))/0x8)+-parseInt(_0x4529de(0x258))/0x9+parseInt(_0x4529de(0x1d3))/0xa;if(_0x3b0d84===_0x1fef0a)break;else _0xd49418['push'](_0xd49418['shift']());}catch(_0x5e66a2){_0xd49418['push'](_0xd49418['shift']());}}}(a25_0x2b47,0x3b552));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';function a25_0x2b47(){const _0x4f0373=['Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment:folder:show','\x20\x20Cause:\x20','parentSegment','segment:show','Fetching\x20parent\x20segment\x20details...','web','Fetching\x20SQL\x20for\x20segment...','\x27\x20with\x20ID:\x20','getSegment','jobId','✔\x20Found\x20','SEGMENT_NOT_FOUND','resolveFolderId','Error:\x20Path\x20or\x20name\x20is\x20required','Examples:','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','listFolders','resolvePathToResource','Use:\x20tdx\x20ps\x20view','Resolving\x20parent\x20segment\x20\x27','Folder\x20ID:\x20','Fetching\x20segment\x20details...','setJobId','message','Folder\x20name:\x20','\x20Opening\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','✔\x20Query\x20completed:\x20Processed\x20','/e/','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','url','segment:sql','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','segmentId','length','in\x20','segment','Error:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20folder\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','trim','Show\x20folder\x20or\x20child\x20segment\x20details','segment:desc','replace','format','INVALID_ARGUMENT','getFolder','\x20\x20Full\x20path:\x20','330660MULdDD','resolveParentId','segmentName','Creating\x20folder\x20\x27','data','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Parent\x20ID:\x20','Resolving\x20path\x20\x27','Resolving\x20parent\x20folder\x20\x27','Show\x20child\x20segment\x20schema\x20(column\x20types)','execute','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','type','green','7paxYiq','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20parent\x20ID:\x20','3eQQQSE','error','Parent\x20name:\x20','getSegmentSQL','Resolved\x20relative\x20path\x20to:\x20','3565872RTAUxo','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','2257284UPmIRA','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parent','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:folder:list','test','\x20[Job\x20ID:\x20','1896520FghGmI','389392TNEpwL','(root)','jsonl','Fetching\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentPath','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','log','Site:\x20','Error:\x20Folder\x20reference\x20is\x20required','5729960ORizgH','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20is\x20required','SEGMENT_FOLDER_NOT_FOUND','includes','Target\x20path:\x20','parentId','verbose','\x20\x20Segment\x20name:\x20','SQL\x20query:\x0a','\x20\x20Parent\x20segment:\x20','description','stats','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','information_schema','\x27...','folderPath','Segment\x20ID:\x20','name','createFolder','\x20rows\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','fullPath','Resolved\x20YAML\x20file:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:view','Folder\x20ID\x20missing\x20from\x20resolved\x20path','✖\x20Query\x20failed\x20[','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','cyan','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','/app/ps/','cause','Show\x20segment\x20or\x20folder\x20details','Resolving\x20folder\x20\x27','335589dOobUn','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:describe','5gAmkEa','Resolving\x20\x27','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20desc','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','site','Use:\x20tdx\x20ps\x20sql','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folder','SELECT\x20*\x20FROM\x20(\x0a'];a25_0x2b47=function(){return _0x4f0373;};return a25_0x2b47();}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 a25_0x120088 from'chalk';async function resolveSegmentTarget(_0xc12441,_0x200eb2,_0x44e101){const _0xe44981=a25_0x3463;if(isYamlFilePath(_0xc12441))try{const _0x5147d7=await resolveYamlFilePath(_0xc12441);return _0x44e101&&(console[_0xe44981(0x254)](_0xe44981(0x1ea)+_0xc12441),console['error'](_0xe44981(0x1dd)+_0x5147d7[_0xe44981(0x20e)]),console[_0xe44981(0x254)](_0xe44981(0x1db)+_0x5147d7[_0xe44981(0x241)]),console[_0xe44981(0x254)]('\x20\x20Folder\x20path:\x20'+(_0x5147d7[_0xe44981(0x1e3)]||_0xe44981(0x1ca))),console[_0xe44981(0x254)](_0xe44981(0x23e)+_0x5147d7[_0xe44981(0x1e9)])),_0x5147d7[_0xe44981(0x1e9)];}catch(_0x373c31){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xe44981(0x1f0)+_0x373c31[_0xe44981(0x223)]);}if(!_0x200eb2)throw new SDKError(ErrorCode[_0xe44981(0x23c)],_0xe44981(0x234));return _0x200eb2+'/'+_0xc12441;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]=a25_0x3f95e6(0x1f9);['description']=a25_0x3f95e6(0x1f5);async[a25_0x3f95e6(0x24a)](_0x21875d){const _0x1e1883=a25_0x3f95e6,{options:_0x269a87,args:_0x1af22e,tdx:_0x347aca}=_0x21875d,_0x109d22=_0x1af22e[0x0],_0x363054=!_0x109d22&&!!_0x269a87[_0x1e1883(0x20e)],_0x39d12b=_0x109d22||_0x269a87[_0x1e1883(0x20e)];if(!_0x39d12b)return console['error'](_0x1e1883(0x219)),console[_0x1e1883(0x254)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1e1883(0x254)](_0x1e1883(0x21a)),console[_0x1e1883(0x254)](_0x1e1883(0x259)),console[_0x1e1883(0x254)](_0x1e1883(0x1cd)),console[_0x1e1883(0x254)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x1e1883(0x201)),0x1;try{const _0x5a8692=_0x269a87[_0x1e1883(0x1ce)];let _0xdaf8db=_0x39d12b;!_0x363054&&_0x5a8692&&!_0x39d12b[_0x1e1883(0x1d7)]('/')&&(_0xdaf8db=_0x5a8692+'/'+_0x39d12b,_0x269a87[_0x1e1883(0x1da)]&&console[_0x1e1883(0x254)](_0x1e1883(0x257)+_0xdaf8db));const _0x42f970=await withSpinner(_0x1e1883(0x247)+_0xdaf8db+_0x1e1883(0x1e2),()=>_0x347aca[_0x1e1883(0x232)][_0x1e1883(0x21d)](_0xdaf8db),{'verbose':_0x269a87[_0x1e1883(0x1da)]}),_0x4cde32=_0x42f970[_0x1e1883(0x243)];_0x269a87[_0x1e1883(0x1da)]&&(console[_0x1e1883(0x254)]('Resolved\x20type:\x20'+_0x4cde32['type']),console['error']('Parent\x20ID:\x20'+_0x4cde32[_0x1e1883(0x1d9)]),_0x4cde32[_0x1e1883(0x1fe)]&&console[_0x1e1883(0x254)](_0x1e1883(0x220)+_0x4cde32[_0x1e1883(0x1fe)]),_0x4cde32[_0x1e1883(0x22f)]&&console[_0x1e1883(0x254)](_0x1e1883(0x1e4)+_0x4cde32[_0x1e1883(0x22f)]));if(_0x4cde32['type']===_0x1e1883(0x25c)){const _0x35234c=await withSpinner(_0x1e1883(0x210),()=>_0x347aca[_0x1e1883(0x232)]['getParent'](_0x4cde32['parentId']),{'verbose':_0x269a87[_0x1e1883(0x1da)]});await handleSingleObjectOutput(_0x35234c[_0x1e1883(0x243)],_0x269a87);}else{if(_0x4cde32[_0x1e1883(0x24e)]===_0x1e1883(0x209)){if(!_0x4cde32['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x1e1883(0x1ee));const _0x4e8eb9=await withSpinner(_0x1e1883(0x22e),()=>_0x347aca[_0x1e1883(0x232)][_0x1e1883(0x23d)](_0x4cde32[_0x1e1883(0x1fe)]),{'verbose':_0x269a87['verbose']});await handleSingleObjectOutput(_0x4e8eb9[_0x1e1883(0x243)],_0x269a87);}else{if(_0x4cde32[_0x1e1883(0x24e)]===_0x1e1883(0x232)){if(!_0x4cde32[_0x1e1883(0x22f)])throw new SDKError(ErrorCode[_0x1e1883(0x217)],_0x1e1883(0x200));const _0x4990c0=await withSpinner(_0x1e1883(0x221),()=>_0x347aca[_0x1e1883(0x232)][_0x1e1883(0x214)](_0x4cde32['parentId'],_0x4cde32[_0x1e1883(0x22f)]),{'verbose':_0x269a87[_0x1e1883(0x1da)]});await handleSingleObjectOutput(_0x4990c0[_0x1e1883(0x243)],_0x269a87);}}}return 0x0;}catch(_0xa28c6d){if(_0xa28c6d instanceof SDKError)return console[_0x1e1883(0x254)](_0x1e1883(0x233)+_0xa28c6d[_0x1e1883(0x223)]),_0xa28c6d[_0x1e1883(0x1f4)]&&console['error'](_0x1e1883(0x20d)+_0xa28c6d['cause']),0x1;throw _0xa28c6d;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]=a25_0x3f95e6(0x20f);[a25_0x3f95e6(0x1de)]=a25_0x3f95e6(0x206);async[a25_0x3f95e6(0x24a)](_0x54ae44){const _0x612eb=a25_0x3f95e6,{options:_0x168a0d,args:_0x412e39,tdx:_0x365209}=_0x54ae44,_0x2dff95=_0x412e39[0x0];if(!_0x2dff95)return console[_0x612eb(0x254)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x612eb(0x254)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x612eb(0x254)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x612eb(0x254)]('Examples:'),console[_0x612eb(0x254)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x612eb(0x254)](_0x612eb(0x22d)),0x1;try{const _0x3e704e=_0x168a0d[_0x612eb(0x20e)],_0x4ec11e=await resolveSegmentTarget(_0x2dff95,_0x3e704e,_0x168a0d[_0x612eb(0x1da)]);_0x168a0d[_0x612eb(0x1da)]&&console['error'](_0x612eb(0x1d8)+_0x4ec11e);const _0x1d1ab4=await withSpinner('Resolving\x20\x27'+_0x2dff95+'\x27...',()=>_0x365209[_0x612eb(0x232)][_0x612eb(0x21d)](_0x4ec11e),{'verbose':_0x168a0d['verbose']}),_0xfcf470=_0x1d1ab4[_0x612eb(0x243)];_0x168a0d[_0x612eb(0x1da)]&&(console[_0x612eb(0x254)](_0x612eb(0x1fc)+_0xfcf470[_0x612eb(0x24e)]),console[_0x612eb(0x254)](_0x612eb(0x246)+_0xfcf470[_0x612eb(0x1d9)]));if(_0xfcf470['type']===_0x612eb(0x209))return console[_0x612eb(0x254)](_0x612eb(0x244)),console[_0x612eb(0x254)](_0x612eb(0x21b)),0x1;if(_0xfcf470[_0x612eb(0x24e)]===_0x612eb(0x25c))return console['error'](_0x612eb(0x251)),console[_0x612eb(0x254)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0xfcf470[_0x612eb(0x22f)])throw new SDKError(ErrorCode[_0x612eb(0x217)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2966db=await withSpinner(_0x612eb(0x212),()=>_0x365209[_0x612eb(0x232)][_0x612eb(0x256)](_0xfcf470[_0x612eb(0x1d9)],_0xfcf470[_0x612eb(0x22f)]),{'verbose':_0x168a0d[_0x612eb(0x1da)]});let _0x1bceb0=_0x2966db[_0x612eb(0x243)];const _0x5f1042=resolveLimit(_0x168a0d['limit'],DEFAULT_DISPLAY_LIMIT),_0xf102b1=/\bLIMIT\s+\d+/i[_0x612eb(0x1c6)](_0x1bceb0);!_0xf102b1&&(_0x1bceb0=_0x1bceb0[_0x612eb(0x237)]()[_0x612eb(0x23a)](/;+$/,''),_0x1bceb0=_0x612eb(0x20a)+_0x1bceb0+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x5f1042);_0x168a0d[_0x612eb(0x1da)]&&console[_0x612eb(0x254)](_0x612eb(0x1dc)+_0x1bceb0);const _0x2a6161=await withProgressSpinner('Executing\x20segment\x20query...',async _0x28a2d5=>{const _0x1d486c=_0x612eb,_0x463955=await _0x365209['query'][_0x1d486c(0x24a)](_0x1bceb0,{'catalog':'td','schema':_0x1d486c(0x1e1),'onJobId':_0x46a631=>{const _0x42a8b7=_0x1d486c;_0x28a2d5[_0x42a8b7(0x222)](_0x46a631);}});return _0x463955;},{'verbose':_0x168a0d[_0x612eb(0x1da)]}),_0x1d8e9c=_0x2a6161['data'],_0x49c767=_0x1d8e9c['jobId']?_0x612eb(0x1c7)+_0x1d8e9c[_0x612eb(0x215)]+']':'';return console[_0x612eb(0x254)](_0x612eb(0x227)+_0x1d8e9c[_0x612eb(0x1df)]['processedRows']['toLocaleString']()+_0x612eb(0x1e7)+(_0x612eb(0x231)+formatElapsed(_0x1d8e9c['stats'][_0x612eb(0x1d4)])+_0x49c767)),await handleQueryOutput(_0x1d8e9c,_0x168a0d),0x0;}catch(_0x5f017b){if(_0x5f017b instanceof SDKError)return console['error'](_0x612eb(0x1ef)+_0x5f017b['code']+']'),console[_0x612eb(0x254)]('\x0a'+_0x5f017b['message']),0x1;throw _0x5f017b;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]=a25_0x3f95e6(0x1c5);[a25_0x3f95e6(0x1de)]=a25_0x3f95e6(0x1cf);async['execute'](_0x142cde){const _0x159f20=a25_0x3f95e6,{options:_0x3be13a,args:_0x223933,tdx:_0x1bbd62}=_0x142cde;if(_0x223933[_0x159f20(0x230)]===0x0)return console[_0x159f20(0x254)](_0x159f20(0x1d5)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x38313b=_0x223933[0x0];try{_0x3be13a[_0x159f20(0x1da)]&&(console[_0x159f20(0x254)](_0x159f20(0x1d1)+_0x3be13a[_0x159f20(0x204)]),console[_0x159f20(0x254)](_0x159f20(0x255)+_0x38313b));const _0x366c86=await withSpinner(_0x159f20(0x21f)+_0x38313b+_0x159f20(0x1e2),()=>_0x1bbd62[_0x159f20(0x232)][_0x159f20(0x240)](_0x38313b),{'verbose':_0x3be13a[_0x159f20(0x1da)]}),_0x2f75b8=_0x366c86[_0x159f20(0x243)];_0x3be13a[_0x159f20(0x1da)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x2f75b8);const _0x9327bd=await withSpinner(_0x159f20(0x1eb)+_0x38313b+_0x159f20(0x1e2),()=>_0x1bbd62['segment'][_0x159f20(0x21c)](_0x2f75b8),{'verbose':_0x3be13a[_0x159f20(0x1da)]}),_0x2c936e=_0x9327bd[_0x159f20(0x243)];return console[_0x159f20(0x254)](_0x159f20(0x216)+_0x2c936e[_0x159f20(0x230)]+'\x20folder'+(_0x2c936e[_0x159f20(0x230)]!==0x1?'s':'')),await handleSDKOutput(_0x2c936e,_0x3be13a),0x0;}catch(_0x26efcb){if(_0x26efcb instanceof SDKError)return console[_0x159f20(0x254)](_0x159f20(0x233)+_0x26efcb[_0x159f20(0x223)]),_0x26efcb[_0x159f20(0x1f4)]&&console[_0x159f20(0x254)](_0x159f20(0x20d)+_0x26efcb['cause']),0x1;throw _0x26efcb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]=a25_0x3f95e6(0x20c);[a25_0x3f95e6(0x1de)]='Show\x20segment\x20folder\x20details';async[a25_0x3f95e6(0x24a)](_0x352502){const _0x4bb97c=a25_0x3f95e6,{options:_0x287762,args:_0x45580f,tdx:_0x50929a}=_0x352502;if(_0x45580f['length']===0x0)return console[_0x4bb97c(0x254)](_0x4bb97c(0x1d2)),console['error'](_0x4bb97c(0x207)),0x1;try{const {parentId:_0x1fe250,childId:_0x40c843}=parseSegmentRef(_0x45580f[0x0]);_0x287762[_0x4bb97c(0x1da)]&&(console['error'](_0x4bb97c(0x1d1)+_0x287762[_0x4bb97c(0x204)]),console[_0x4bb97c(0x254)](_0x4bb97c(0x255)+_0x1fe250),_0x40c843&&console['error'](_0x4bb97c(0x224)+_0x40c843));if(!_0x40c843)return console[_0x4bb97c(0x254)](_0x4bb97c(0x1f2)),0x1;const _0x4abfe8=await withSpinner(_0x4bb97c(0x21f)+_0x1fe250+_0x4bb97c(0x1e2),()=>_0x50929a[_0x4bb97c(0x232)]['resolveParentId'](_0x1fe250),{'verbose':_0x287762[_0x4bb97c(0x1da)]}),_0x323b2a=_0x4abfe8[_0x4bb97c(0x243)];_0x287762[_0x4bb97c(0x1da)]&&console[_0x4bb97c(0x254)](_0x4bb97c(0x252)+_0x323b2a);const _0x2e9b5a=await withSpinner(_0x4bb97c(0x1f6)+_0x40c843+_0x4bb97c(0x1e2),()=>_0x50929a[_0x4bb97c(0x232)][_0x4bb97c(0x218)](_0x323b2a,_0x40c843),{'verbose':_0x287762[_0x4bb97c(0x1da)]}),_0x7fbc6d=_0x2e9b5a[_0x4bb97c(0x243)];_0x287762[_0x4bb97c(0x1da)]&&console['error'](_0x4bb97c(0x235)+_0x7fbc6d);const _0x18b7ef=await withSpinner(_0x4bb97c(0x1cc)+_0x40c843+_0x4bb97c(0x1e2),()=>_0x50929a[_0x4bb97c(0x232)][_0x4bb97c(0x23d)](_0x7fbc6d),{'verbose':_0x287762[_0x4bb97c(0x1da)]});return await handleSDKOutput([_0x18b7ef[_0x4bb97c(0x243)]],_0x287762),0x0;}catch(_0x398939){if(_0x398939 instanceof SDKError)return console[_0x4bb97c(0x254)](_0x4bb97c(0x233)+_0x398939['message']),_0x398939[_0x4bb97c(0x1f4)]&&console[_0x4bb97c(0x254)]('\x20\x20Cause:\x20'+_0x398939[_0x4bb97c(0x1f4)]),0x1;throw _0x398939;}}}function a25_0x3463(_0x2d8add,_0x554415){_0x2d8add=_0x2d8add-0x1c5;const _0x2b476f=a25_0x2b47();let _0x34632e=_0x2b476f[_0x2d8add];return _0x34632e;}export class SegmentSQLCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]=a25_0x3f95e6(0x22b);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x3f95e6(0x24a)](_0x50369a){const _0xf14ecf=a25_0x3f95e6,{options:_0x56cad9,args:_0x432e89,tdx:_0x575854}=_0x50369a,_0x2ded48=_0x432e89[0x0];if(!_0x2ded48)return console[_0xf14ecf(0x254)](_0xf14ecf(0x208)),console[_0xf14ecf(0x254)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0xf14ecf(0x254)](_0xf14ecf(0x21a)),console[_0xf14ecf(0x254)](_0xf14ecf(0x25b)),console['error'](_0xf14ecf(0x245)),0x1;try{const _0x4970bc=_0x56cad9[_0xf14ecf(0x20e)],_0x3b44fc=await resolveSegmentTarget(_0x2ded48,_0x4970bc,_0x56cad9[_0xf14ecf(0x1da)]);_0x56cad9['verbose']&&console[_0xf14ecf(0x254)](_0xf14ecf(0x1d8)+_0x3b44fc);const _0x266ca0=await withSpinner(_0xf14ecf(0x1fb)+_0x2ded48+'\x27...',()=>_0x575854['segment'][_0xf14ecf(0x21d)](_0x3b44fc),{'verbose':_0x56cad9[_0xf14ecf(0x1da)]}),_0x27d8ed=_0x266ca0[_0xf14ecf(0x243)];_0x56cad9[_0xf14ecf(0x1da)]&&(console[_0xf14ecf(0x254)](_0xf14ecf(0x1fc)+_0x27d8ed[_0xf14ecf(0x24e)]),console[_0xf14ecf(0x254)](_0xf14ecf(0x246)+_0x27d8ed[_0xf14ecf(0x1d9)]));if(_0x27d8ed[_0xf14ecf(0x24e)]===_0xf14ecf(0x209))return console[_0xf14ecf(0x254)](_0xf14ecf(0x226)),console[_0xf14ecf(0x254)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x27d8ed['type']===_0xf14ecf(0x25c))return console['error'](_0xf14ecf(0x1ec)),console[_0xf14ecf(0x254)](_0xf14ecf(0x205)),0x1;if(!_0x27d8ed[_0xf14ecf(0x22f)])throw new SDKError(ErrorCode[_0xf14ecf(0x217)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x173c14=await withSpinner(_0xf14ecf(0x212),()=>_0x575854['segment'][_0xf14ecf(0x256)](_0x27d8ed[_0xf14ecf(0x1d9)],_0x27d8ed[_0xf14ecf(0x22f)]),{'verbose':_0x56cad9['verbose']}),_0x57b153=_0x173c14[_0xf14ecf(0x243)];return _0x56cad9[_0xf14ecf(0x23b)]==='json'||_0x56cad9[_0xf14ecf(0x23b)]===_0xf14ecf(0x1cb)?await handleSDKOutput([{'sql':_0x57b153}],_0x56cad9):console[_0xf14ecf(0x1d0)](_0x57b153),0x0;}catch(_0x235eb7){if(_0x235eb7 instanceof SDKError)return console[_0xf14ecf(0x254)](_0xf14ecf(0x233)+_0x235eb7[_0xf14ecf(0x223)]),_0x235eb7['cause']&&console['error'](_0xf14ecf(0x20d)+_0x235eb7[_0xf14ecf(0x1f4)]),0x1;throw _0x235eb7;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x3f95e6(0x1e5)]='segment:folder:create';[a25_0x3f95e6(0x1de)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x2f8f3e){const _0x2303b9=a25_0x3f95e6,{options:_0x1b2499,args:_0x15884b,tdx:_0x454187}=_0x2f8f3e,_0x330660=_0x1b2499;if(_0x15884b[_0x2303b9(0x230)]<0x2)return console['error']('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x2303b9(0x22c)),0x1;const _0x547eea=_0x15884b[0x0],_0x21a8ab=_0x15884b[0x1];_0x330660['verbose']&&(console[_0x2303b9(0x254)]('Site:\x20'+_0x330660['site']),console[_0x2303b9(0x254)]('Parent\x20segment:\x20'+_0x547eea),console[_0x2303b9(0x254)](_0x2303b9(0x224)+_0x21a8ab));let _0x3e7657;if(_0x330660['parentFolder']){const _0x2d4c98=_0x330660['parentFolder'],_0x5d4869=await withSpinner(_0x2303b9(0x21f)+_0x547eea+_0x2303b9(0x1e2),()=>_0x454187['segment'][_0x2303b9(0x240)](_0x547eea),{'verbose':_0x330660[_0x2303b9(0x1da)]}),_0x278543=_0x5d4869[_0x2303b9(0x243)],_0xf1957f=await withSpinner(_0x2303b9(0x248)+_0x2d4c98+_0x2303b9(0x1e2),()=>_0x454187[_0x2303b9(0x232)][_0x2303b9(0x218)](_0x278543,_0x2d4c98),{'verbose':_0x330660['verbose']});_0x3e7657=_0xf1957f[_0x2303b9(0x243)],_0x330660[_0x2303b9(0x1da)]&&console[_0x2303b9(0x254)](_0x2303b9(0x236)+_0x3e7657);}const _0x4bedf8={'name':_0x21a8ab,'description':_0x330660[_0x2303b9(0x1de)],'parentFolderId':_0x3e7657},_0x1aac8e=await withSpinner(_0x2303b9(0x242)+_0x21a8ab+'\x27...',()=>_0x454187['segment'][_0x2303b9(0x1e6)](_0x547eea,_0x4bedf8),{'verbose':_0x330660[_0x2303b9(0x1da)]}),_0x46040a=_0x1aac8e['data'];return console[_0x2303b9(0x254)]('✔\x20Created\x20folder\x20\x27'+_0x46040a['name']+_0x2303b9(0x213)+_0x46040a['id']),await handleSDKOutput([_0x46040a],_0x330660),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a25_0x3f95e6(0x1ed);[a25_0x3f95e6(0x1de)]=a25_0x3f95e6(0x238);async['execute'](_0x2e0b91){const _0x3bf830=a25_0x3f95e6,{options:_0x59ad4c,args:_0x2846d2,tdx:_0x3ffb06}=_0x2e0b91,_0x59a0fb=_0x2846d2[0x0];if(!_0x59a0fb)return console[_0x3bf830(0x254)](_0x3bf830(0x1f8)),console[_0x3bf830(0x254)](_0x3bf830(0x20b)),console[_0x3bf830(0x254)](_0x3bf830(0x1ff)),console['error']('Options:'),console[_0x3bf830(0x254)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3bf830(0x254)]('Examples:'),console['error'](_0x3bf830(0x1e8)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5eefdb=_0x59ad4c['parentSegment'],_0xd713b0=await resolveSegmentTarget(_0x59a0fb,_0x5eefdb,_0x59ad4c[_0x3bf830(0x1da)]);_0x59ad4c[_0x3bf830(0x1da)]&&console['error'](_0x3bf830(0x1d8)+_0xd713b0);const _0x8e653c=await withSpinner('Resolving\x20\x27'+_0x59a0fb+_0x3bf830(0x1e2),()=>_0x3ffb06[_0x3bf830(0x232)][_0x3bf830(0x21d)](_0xd713b0),{'verbose':_0x59ad4c['verbose']}),_0x19ded9=_0x8e653c[_0x3bf830(0x243)];_0x59ad4c[_0x3bf830(0x1da)]&&(console[_0x3bf830(0x254)](_0x3bf830(0x1fc)+_0x19ded9[_0x3bf830(0x24e)]),console[_0x3bf830(0x254)](_0x3bf830(0x246)+_0x19ded9['parentId']),_0x19ded9[_0x3bf830(0x1fe)]&&console[_0x3bf830(0x254)]('Folder\x20ID:\x20'+_0x19ded9[_0x3bf830(0x1fe)]),_0x19ded9['segmentId']&&console['error']('Segment\x20ID:\x20'+_0x19ded9['segmentId']));if(_0x59ad4c[_0x3bf830(0x211)]){if(_0x19ded9['type']===_0x3bf830(0x209))return console['error'](_0x3bf830(0x1e0)),0x1;if(_0x19ded9[_0x3bf830(0x24e)]==='parent')return console[_0x3bf830(0x254)](_0x3bf830(0x24c)),console[_0x3bf830(0x254)](_0x3bf830(0x24b)),0x1;if(!_0x19ded9[_0x3bf830(0x22f)])throw new SDKError(ErrorCode[_0x3bf830(0x217)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x53f22c=getConsoleNextUrl(_0x59ad4c[_0x3bf830(0x204)],_0x3bf830(0x1f3)+_0x19ded9['parentId']+_0x3bf830(0x228)+_0x19ded9[_0x3bf830(0x22f)]);return console['error'](a25_0x120088[_0x3bf830(0x24f)]('✔')+_0x3bf830(0x225)+a25_0x120088[_0x3bf830(0x1f1)](_0x53f22c)),openBrowser(_0x53f22c),0x0;}if(_0x19ded9[_0x3bf830(0x24e)]==='folder'){if(!_0x19ded9[_0x3bf830(0x1fe)])throw new SDKError(ErrorCode[_0x3bf830(0x1d6)],_0x3bf830(0x1ee));const _0x2de59e=await withSpinner(_0x3bf830(0x22e),()=>_0x3ffb06[_0x3bf830(0x232)][_0x3bf830(0x23d)](_0x19ded9['folderId']),{'verbose':_0x59ad4c[_0x3bf830(0x1da)]});await handleSingleObjectOutput(_0x2de59e[_0x3bf830(0x243)],_0x59ad4c);}else{if(_0x19ded9['type']===_0x3bf830(0x232)){if(!_0x19ded9['segmentId'])throw new SDKError(ErrorCode[_0x3bf830(0x217)],_0x3bf830(0x200));const _0xec969a=await withSpinner(_0x3bf830(0x221),()=>_0x3ffb06[_0x3bf830(0x232)][_0x3bf830(0x214)](_0x19ded9[_0x3bf830(0x1d9)],_0x19ded9[_0x3bf830(0x22f)]),{'verbose':_0x59ad4c[_0x3bf830(0x1da)]}),_0x3b7d12=getConsoleNextUrl(_0x59ad4c['site'],_0x3bf830(0x1f3)+_0x19ded9[_0x3bf830(0x1d9)]+'/e/'+_0x19ded9['segmentId']),_0x4d72c7=_0xec969a[_0x3bf830(0x243)];_0x4d72c7[_0x3bf830(0x22a)]=_0x3b7d12,await handleSingleObjectOutput(_0x4d72c7,_0x59ad4c);}else return console[_0x3bf830(0x254)](_0x3bf830(0x25d)),console[_0x3bf830(0x254)](_0x3bf830(0x21e)),0x1;}return 0x0;}catch(_0x1d512c){if(_0x1d512c instanceof SDKError)return console['error']('Error:\x20'+_0x1d512c[_0x3bf830(0x223)]),_0x1d512c[_0x3bf830(0x1f4)]&&console[_0x3bf830(0x254)]('\x20\x20Cause:\x20'+_0x1d512c[_0x3bf830(0x1f4)]),0x1;throw _0x1d512c;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a25_0x3f95e6(0x239);['description']=a25_0x3f95e6(0x249);async[a25_0x3f95e6(0x24a)](_0x5203b1){const _0x2454c2=a25_0x3f95e6,{options:_0x3a6a35,args:_0x5358f1,tdx:_0x589d02}=_0x5203b1,_0x4d94d8=_0x5358f1[0x0];if(!_0x4d94d8)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2454c2(0x254)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2454c2(0x254)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x2454c2(0x21a)),console[_0x2454c2(0x254)](_0x2454c2(0x229)),console[_0x2454c2(0x254)](_0x2454c2(0x1fd)),0x1;try{const _0xbc9ca9=_0x3a6a35[_0x2454c2(0x20e)],_0xde2f25=await resolveSegmentTarget(_0x4d94d8,_0xbc9ca9,_0x3a6a35[_0x2454c2(0x1da)]);_0x3a6a35[_0x2454c2(0x1da)]&&console[_0x2454c2(0x254)](_0x2454c2(0x1d8)+_0xde2f25);const _0x31d2ea=await withSpinner(_0x2454c2(0x1fb)+_0x4d94d8+_0x2454c2(0x1e2),()=>_0x589d02['segment']['resolvePathToResource'](_0xde2f25),{'verbose':_0x3a6a35[_0x2454c2(0x1da)]}),_0x1c99fc=_0x31d2ea['data'];_0x3a6a35[_0x2454c2(0x1da)]&&(console[_0x2454c2(0x254)](_0x2454c2(0x1fc)+_0x1c99fc[_0x2454c2(0x24e)]),console[_0x2454c2(0x254)](_0x2454c2(0x246)+_0x1c99fc[_0x2454c2(0x1d9)]));if(_0x1c99fc[_0x2454c2(0x24e)]===_0x2454c2(0x209))return console[_0x2454c2(0x254)](_0x2454c2(0x24d)),console[_0x2454c2(0x254)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1c99fc[_0x2454c2(0x24e)]==='parent')return console[_0x2454c2(0x254)](_0x2454c2(0x203)),console['error'](_0x2454c2(0x202)),0x1;if(!_0x1c99fc[_0x2454c2(0x22f)])throw new SDKError(ErrorCode[_0x2454c2(0x217)],_0x2454c2(0x200));const _0x4b838c=await withSpinner(_0x2454c2(0x212),()=>_0x589d02[_0x2454c2(0x232)][_0x2454c2(0x256)](_0x1c99fc[_0x2454c2(0x1d9)],_0x1c99fc[_0x2454c2(0x22f)]),{'verbose':_0x3a6a35[_0x2454c2(0x1da)]}),_0x2ba750=_0x4b838c[_0x2454c2(0x243)],_0x2f1e64=await executeSchemaQuery(_0x2ba750,_0x589d02,_0x3a6a35);return await handleQueryOutput(_0x2f1e64,_0x3a6a35),0x0;}catch(_0x4a50d1){if(_0x4a50d1 instanceof SDKError)return console[_0x2454c2(0x254)](_0x2454c2(0x233)+_0x4a50d1[_0x2454c2(0x223)]),_0x4a50d1[_0x2454c2(0x1f4)]&&console[_0x2454c2(0x254)](_0x2454c2(0x20d)+_0x4a50d1['cause']),0x1;throw _0x4a50d1;}}}
1
+ const a25_0x33e530=a25_0x3b45;(function(_0x17a158,_0x26b7e3){const _0x4c166f=a25_0x3b45,_0x234988=_0x17a158();while(!![]){try{const _0x30aa09=-parseInt(_0x4c166f(0x223))/0x1+-parseInt(_0x4c166f(0x1f6))/0x2+parseInt(_0x4c166f(0x23e))/0x3+parseInt(_0x4c166f(0x282))/0x4+parseInt(_0x4c166f(0x226))/0x5+parseInt(_0x4c166f(0x280))/0x6+parseInt(_0x4c166f(0x238))/0x7;if(_0x30aa09===_0x26b7e3)break;else _0x234988['push'](_0x234988['shift']());}catch(_0x1efb3f){_0x234988['push'](_0x234988['shift']());}}}(a25_0x1d46,0x29c05));function a25_0x3b45(_0x4ce085,_0x41d1c2){_0x4ce085=_0x4ce085-0x1f0;const _0x1d46c9=a25_0x1d46();let _0x3b452f=_0x1d46c9[_0x4ce085];return _0x3b452f;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a25_0x1d46(){const _0x497220=['\x20\x20Cause:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folder\x20name:\x20','getFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','254478JMNjxF','replace','jobId','866025vOkMzO','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20folder\x20details...','\x20rows\x20','Fetching\x20parent\x20segment\x20details...','length','segment:desc','SELECT\x20*\x20FROM\x20(\x0a','cause','✔\x20Created\x20folder\x20\x27','jsonl','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20folder\x20\x27','format','Use:\x20tdx\x20ps\x20view','url','getSegmentSQL','521367jsPfWm','Usage:\x20tdx\x20sg\x20desc\x20<name>','Use:\x20tdx\x20ps\x20show','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','getSegment','538584Bjbuqb','Site:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','segmentId','segment:folder:show','includes','Error:\x20','✔\x20Found\x20','green','test','Error:\x20Parent\x20segment\x20name\x20is\x20required','type','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolved\x20YAML\x20file:\x20','Resolved\x20parent\x20ID:\x20','segment:folder:create','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','stats','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','elapsedTimeMillis','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolving\x20path\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','site','name','Resolving\x20parent\x20segment\x20\x27','fullPath','Creating\x20folder\x20\x27','Fetching\x20SQL\x20for\x20segment...','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20parent\x20folder\x20ID:\x20','description','verbose','createFolder','json','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Parent\x20segment:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','✖\x20Query\x20failed\x20[','query','Resolved\x20relative\x20path\x20to:\x20','SEGMENT_NOT_FOUND','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','error','web','Examples:','setJobId','/app/ps/','SEGMENT_FOLDER_NOT_FOUND','Segment\x20ID:\x20','\x20Opening\x20','resolveParentId','data','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment','\x27...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','folder','Parent\x20ID:\x20','code','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','547926PRVVxx','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','300968LMJDuC','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Full\x20path:\x20','resolveFolderId','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20folder\x20ID:\x20','336572iSMrJQ','Error:\x20Folder\x20reference\x20is\x20required','information_schema','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Segment\x20ID\x20missing\x20from\x20resolved\x20path','execute','Parent\x20name:\x20','parent','✔\x20Query\x20completed:\x20Processed\x20','message','resolvePathToResource','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segmentName','SQL\x20query:\x0a','Resolving\x20\x27','Options:','Show\x20segment\x20folder\x20details','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','folderId','/e/','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','parentFolder','segment:show','Listing\x20folders\x20for\x20parent\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Folder\x20path:\x20','Show\x20segment\x20or\x20folder\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20type:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Target\x20path:\x20','parentId'];a25_0x1d46=function(){return _0x497220;};return a25_0x1d46();}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 a25_0x4b87e8 from'chalk';async function resolveSegmentTarget(_0x24c40c,_0x5dd1a3,_0x37c73a){const _0x407196=a25_0x3b45;if(isYamlFilePath(_0x24c40c))try{const _0x4c8233=await resolveYamlFilePath(_0x24c40c);return _0x37c73a&&(console[_0x407196(0x26d)](_0x407196(0x24f)+_0x24c40c),console[_0x407196(0x26d)]('\x20\x20Parent\x20segment:\x20'+_0x4c8233[_0x407196(0x24c)]),console[_0x407196(0x26d)]('\x20\x20Segment\x20name:\x20'+_0x4c8233[_0x407196(0x202)]),console[_0x407196(0x26d)](_0x407196(0x212)+(_0x4c8233['folderPath']||'(root)')),console[_0x407196(0x26d)](_0x407196(0x1f0)+_0x4c8233[_0x407196(0x25c)])),_0x4c8233[_0x407196(0x25c)];}catch(_0x3ad0e1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x407196(0x281)+_0x3ad0e1[_0x407196(0x1ff)]);}if(!_0x5dd1a3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x407196(0x1f9));return _0x5dd1a3+'/'+_0x24c40c;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x33e530(0x25a)]='segment:describe';[a25_0x33e530(0x261)]=a25_0x33e530(0x213);async[a25_0x33e530(0x1fb)](_0x350539){const _0x368cbd=a25_0x33e530,{options:_0x36d097,args:_0x466077,tdx:_0x959b48}=_0x350539,_0x23bc75=_0x466077[0x0],_0x30d9d1=!_0x23bc75&&!!_0x36d097[_0x368cbd(0x24c)],_0x3219c3=_0x23bc75||_0x36d097['parentSegment'];if(!_0x3219c3)return console[_0x368cbd(0x26d)](_0x368cbd(0x1f3)),console[_0x368cbd(0x26d)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error']('Examples:'),console[_0x368cbd(0x26d)](_0x368cbd(0x21c)),console['error'](_0x368cbd(0x21d)),console[_0x368cbd(0x26d)](_0x368cbd(0x252)),console[_0x368cbd(0x26d)](_0x368cbd(0x20b)),0x1;try{const _0x286552=_0x36d097['segmentPath'];let _0x247d54=_0x3219c3;!_0x30d9d1&&_0x286552&&!_0x3219c3[_0x368cbd(0x244)]('/')&&(_0x247d54=_0x286552+'/'+_0x3219c3,_0x36d097[_0x368cbd(0x262)]&&console[_0x368cbd(0x26d)](_0x368cbd(0x26a)+_0x247d54));const _0x5f05ca=await withSpinner(_0x368cbd(0x257)+_0x247d54+_0x368cbd(0x279),()=>_0x959b48[_0x368cbd(0x278)]['resolvePathToResource'](_0x247d54),{'verbose':_0x36d097[_0x368cbd(0x262)]}),_0x42b723=_0x5f05ca['data'];_0x36d097['verbose']&&(console[_0x368cbd(0x26d)](_0x368cbd(0x216)+_0x42b723['type']),console['error'](_0x368cbd(0x27d)+_0x42b723['parentId']),_0x42b723[_0x368cbd(0x209)]&&console[_0x368cbd(0x26d)]('Folder\x20ID:\x20'+_0x42b723['folderId']),_0x42b723[_0x368cbd(0x242)]&&console[_0x368cbd(0x26d)](_0x368cbd(0x273)+_0x42b723['segmentId']));if(_0x42b723[_0x368cbd(0x24a)]===_0x368cbd(0x1fd)){const _0x470ee5=await withSpinner(_0x368cbd(0x22a),()=>_0x959b48[_0x368cbd(0x278)]['getParent'](_0x42b723['parentId']),{'verbose':_0x36d097[_0x368cbd(0x262)]});await handleSingleObjectOutput(_0x470ee5[_0x368cbd(0x276)],_0x36d097);}else{if(_0x42b723[_0x368cbd(0x24a)]==='folder'){if(!_0x42b723[_0x368cbd(0x209)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x368cbd(0x1f4));const _0x123ac0=await withSpinner(_0x368cbd(0x228),()=>_0x959b48['segment']['getFolder'](_0x42b723[_0x368cbd(0x209)]),{'verbose':_0x36d097[_0x368cbd(0x262)]});await handleSingleObjectOutput(_0x123ac0['data'],_0x36d097);}else{if(_0x42b723[_0x368cbd(0x24a)]===_0x368cbd(0x278)){if(!_0x42b723['segmentId'])throw new SDKError(ErrorCode[_0x368cbd(0x26b)],_0x368cbd(0x1fa));const _0x3332c2=await withSpinner(_0x368cbd(0x27b),()=>_0x959b48['segment'][_0x368cbd(0x23d)](_0x42b723['parentId'],_0x42b723[_0x368cbd(0x242)]),{'verbose':_0x36d097[_0x368cbd(0x262)]});await handleSingleObjectOutput(_0x3332c2['data'],_0x36d097);}}}return 0x0;}catch(_0x52419c){if(_0x52419c instanceof SDKError)return console[_0x368cbd(0x26d)](_0x368cbd(0x245)+_0x52419c[_0x368cbd(0x1ff)]),_0x52419c[_0x368cbd(0x22e)]&&console[_0x368cbd(0x26d)](_0x368cbd(0x21a)+_0x52419c[_0x368cbd(0x22e)]),0x1;throw _0x52419c;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x33e530(0x25a)]=a25_0x33e530(0x20e);[a25_0x33e530(0x261)]=a25_0x33e530(0x214);async[a25_0x33e530(0x1fb)](_0x30cfc8){const _0x2096ed=a25_0x33e530,{options:_0x2adad6,args:_0x2921d9,tdx:_0x4740a3}=_0x30cfc8,_0x38db63=_0x2921d9[0x0];if(!_0x38db63)return console[_0x2096ed(0x26d)](_0x2096ed(0x211)),console[_0x2096ed(0x26d)](_0x2096ed(0x241)),console[_0x2096ed(0x26d)](_0x2096ed(0x220)),console[_0x2096ed(0x26d)](_0x2096ed(0x26f)),console[_0x2096ed(0x26d)](_0x2096ed(0x227)),console[_0x2096ed(0x26d)](_0x2096ed(0x283)),0x1;try{const _0x2cad9=_0x2adad6[_0x2096ed(0x24c)],_0x136c97=await resolveSegmentTarget(_0x38db63,_0x2cad9,_0x2adad6[_0x2096ed(0x262)]);_0x2adad6['verbose']&&console['error'](_0x2096ed(0x218)+_0x136c97);const _0x4bc8a3=await withSpinner(_0x2096ed(0x204)+_0x38db63+_0x2096ed(0x279),()=>_0x4740a3[_0x2096ed(0x278)][_0x2096ed(0x200)](_0x136c97),{'verbose':_0x2adad6[_0x2096ed(0x262)]}),_0x29f58a=_0x4bc8a3['data'];_0x2adad6['verbose']&&(console[_0x2096ed(0x26d)](_0x2096ed(0x216)+_0x29f58a[_0x2096ed(0x24a)]),console[_0x2096ed(0x26d)](_0x2096ed(0x27d)+_0x29f58a[_0x2096ed(0x219)]));if(_0x29f58a['type']===_0x2096ed(0x27c))return console[_0x2096ed(0x26d)](_0x2096ed(0x284)),console[_0x2096ed(0x26d)](_0x2096ed(0x24e)),0x1;if(_0x29f58a['type']==='parent')return console[_0x2096ed(0x26d)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x2096ed(0x26d)](_0x2096ed(0x23a)),0x1;if(!_0x29f58a['segmentId'])throw new SDKError(ErrorCode[_0x2096ed(0x26b)],_0x2096ed(0x1fa));const _0x2c73f1=await withSpinner(_0x2096ed(0x25e),()=>_0x4740a3['segment'][_0x2096ed(0x237)](_0x29f58a[_0x2096ed(0x219)],_0x29f58a[_0x2096ed(0x242)]),{'verbose':_0x2adad6[_0x2096ed(0x262)]});let _0x47af7a=_0x2c73f1[_0x2096ed(0x276)];const _0x54a52f=resolveLimit(_0x2adad6['limit'],DEFAULT_DISPLAY_LIMIT),_0x2e1202=/\bLIMIT\s+\d+/i[_0x2096ed(0x248)](_0x47af7a);!_0x2e1202&&(_0x47af7a=_0x47af7a['trim']()[_0x2096ed(0x224)](/;+$/,''),_0x47af7a=_0x2096ed(0x22d)+_0x47af7a+_0x2096ed(0x240)+_0x54a52f);_0x2adad6['verbose']&&console[_0x2096ed(0x26d)](_0x2096ed(0x203)+_0x47af7a);const _0x2aa186=await withProgressSpinner('Executing\x20segment\x20query...',async _0x3567c0=>{const _0x4baeb6=_0x2096ed,_0x23c1a7=await _0x4740a3[_0x4baeb6(0x269)][_0x4baeb6(0x1fb)](_0x47af7a,{'catalog':'td','schema':_0x4baeb6(0x1f8),'onJobId':_0x1c39ae=>{const _0x4eb88a=_0x4baeb6;_0x3567c0[_0x4eb88a(0x270)](_0x1c39ae);}});return _0x23c1a7;},{'verbose':_0x2adad6[_0x2096ed(0x262)]}),_0x549ac1=_0x2aa186[_0x2096ed(0x276)],_0x7f11d4=_0x549ac1[_0x2096ed(0x225)]?_0x2096ed(0x231)+_0x549ac1[_0x2096ed(0x225)]+']':'';return console[_0x2096ed(0x26d)](_0x2096ed(0x1fe)+_0x549ac1[_0x2096ed(0x253)]['processedRows']['toLocaleString']()+_0x2096ed(0x229)+('in\x20'+formatElapsed(_0x549ac1['stats'][_0x2096ed(0x255)])+_0x7f11d4)),await handleQueryOutput(_0x549ac1,_0x2adad6),0x0;}catch(_0x463908){if(_0x463908 instanceof SDKError)return console[_0x2096ed(0x26d)](_0x2096ed(0x268)+_0x463908[_0x2096ed(0x27e)]+']'),console[_0x2096ed(0x26d)]('\x0a'+_0x463908['message']),0x1;throw _0x463908;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a25_0x33e530(0x261)]=a25_0x33e530(0x27f);async['execute'](_0x4f51c4){const _0x283f7c=a25_0x33e530,{options:_0x13ba84,args:_0x53bf02,tdx:_0x175b18}=_0x4f51c4;if(_0x53bf02[_0x283f7c(0x22b)]===0x0)return console[_0x283f7c(0x26d)](_0x283f7c(0x249)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x507e80=_0x53bf02[0x0];try{_0x13ba84[_0x283f7c(0x262)]&&(console[_0x283f7c(0x26d)](_0x283f7c(0x23f)+_0x13ba84[_0x283f7c(0x259)]),console[_0x283f7c(0x26d)](_0x283f7c(0x1fc)+_0x507e80));const _0x21514d=await withSpinner(_0x283f7c(0x25b)+_0x507e80+_0x283f7c(0x279),()=>_0x175b18[_0x283f7c(0x278)]['resolveParentId'](_0x507e80),{'verbose':_0x13ba84['verbose']}),_0x3d2d92=_0x21514d['data'];_0x13ba84[_0x283f7c(0x262)]&&console['error'](_0x283f7c(0x250)+_0x3d2d92);const _0x197bfb=await withSpinner(_0x283f7c(0x20f)+_0x507e80+_0x283f7c(0x279),()=>_0x175b18[_0x283f7c(0x278)]['listFolders'](_0x3d2d92),{'verbose':_0x13ba84[_0x283f7c(0x262)]}),_0x27fb73=_0x197bfb[_0x283f7c(0x276)];return console[_0x283f7c(0x26d)](_0x283f7c(0x246)+_0x27fb73['length']+'\x20folder'+(_0x27fb73[_0x283f7c(0x22b)]!==0x1?'s':'')),await handleSDKOutput(_0x27fb73,_0x13ba84),0x0;}catch(_0x4cf9d8){if(_0x4cf9d8 instanceof SDKError)return console['error']('Error:\x20'+_0x4cf9d8[_0x283f7c(0x1ff)]),_0x4cf9d8['cause']&&console[_0x283f7c(0x26d)](_0x283f7c(0x21a)+_0x4cf9d8[_0x283f7c(0x22e)]),0x1;throw _0x4cf9d8;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x33e530(0x25a)]=a25_0x33e530(0x243);['description']=a25_0x33e530(0x206);async[a25_0x33e530(0x1fb)](_0x51ca9f){const _0x5f0bc1=a25_0x33e530,{options:_0x1ea12a,args:_0x3657d9,tdx:_0x17e12d}=_0x51ca9f;if(_0x3657d9[_0x5f0bc1(0x22b)]===0x0)return console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x1f7)),console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x221)),0x1;try{const {parentId:_0x1a1cd4,childId:_0x3e85ec}=parseSegmentRef(_0x3657d9[0x0]);_0x1ea12a['verbose']&&(console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x23f)+_0x1ea12a[_0x5f0bc1(0x259)]),console['error'](_0x5f0bc1(0x1fc)+_0x1a1cd4),_0x3e85ec&&console[_0x5f0bc1(0x26d)]('Folder\x20name:\x20'+_0x3e85ec));if(!_0x3e85ec)return console['error'](_0x5f0bc1(0x207)),0x1;const _0x3aab7c=await withSpinner(_0x5f0bc1(0x25b)+_0x1a1cd4+_0x5f0bc1(0x279),()=>_0x17e12d[_0x5f0bc1(0x278)][_0x5f0bc1(0x275)](_0x1a1cd4),{'verbose':_0x1ea12a[_0x5f0bc1(0x262)]}),_0x2ca78b=_0x3aab7c[_0x5f0bc1(0x276)];_0x1ea12a[_0x5f0bc1(0x262)]&&console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x250)+_0x2ca78b);const _0x213f83=await withSpinner(_0x5f0bc1(0x233)+_0x3e85ec+_0x5f0bc1(0x279),()=>_0x17e12d[_0x5f0bc1(0x278)][_0x5f0bc1(0x1f1)](_0x2ca78b,_0x3e85ec),{'verbose':_0x1ea12a[_0x5f0bc1(0x262)]}),_0xd26760=_0x213f83['data'];_0x1ea12a['verbose']&&console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x1f5)+_0xd26760);const _0x86f09d=await withSpinner('Fetching\x20folder\x20\x27'+_0x3e85ec+'\x27...',()=>_0x17e12d['segment'][_0x5f0bc1(0x21f)](_0xd26760),{'verbose':_0x1ea12a[_0x5f0bc1(0x262)]});return await handleSDKOutput([_0x86f09d[_0x5f0bc1(0x276)]],_0x1ea12a),0x0;}catch(_0x18b732){if(_0x18b732 instanceof SDKError)return console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x245)+_0x18b732[_0x5f0bc1(0x1ff)]),_0x18b732[_0x5f0bc1(0x22e)]&&console[_0x5f0bc1(0x26d)](_0x5f0bc1(0x21a)+_0x18b732[_0x5f0bc1(0x22e)]),0x1;throw _0x18b732;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x33e530(0x25a)]='segment:sql';[a25_0x33e530(0x261)]=a25_0x33e530(0x267);async['execute'](_0x53da19){const _0x38f183=a25_0x33e530,{options:_0x34299d,args:_0xd0d6b1,tdx:_0x24a2bb}=_0x53da19,_0xa8205=_0xd0d6b1[0x0];if(!_0xa8205)return console[_0x38f183(0x26d)](_0x38f183(0x211)),console[_0x38f183(0x26d)](_0x38f183(0x23b)),console[_0x38f183(0x26d)](_0x38f183(0x201)),console[_0x38f183(0x26d)](_0x38f183(0x26f)),console[_0x38f183(0x26d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x38f183(0x26d)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x42f89a=_0x34299d[_0x38f183(0x24c)],_0x3fa81b=await resolveSegmentTarget(_0xa8205,_0x42f89a,_0x34299d['verbose']);_0x34299d[_0x38f183(0x262)]&&console[_0x38f183(0x26d)](_0x38f183(0x218)+_0x3fa81b);const _0xb3a020=await withSpinner(_0x38f183(0x204)+_0xa8205+_0x38f183(0x279),()=>_0x24a2bb[_0x38f183(0x278)]['resolvePathToResource'](_0x3fa81b),{'verbose':_0x34299d['verbose']}),_0x51155f=_0xb3a020[_0x38f183(0x276)];_0x34299d[_0x38f183(0x262)]&&(console[_0x38f183(0x26d)](_0x38f183(0x216)+_0x51155f[_0x38f183(0x24a)]),console[_0x38f183(0x26d)]('Parent\x20ID:\x20'+_0x51155f['parentId']));if(_0x51155f[_0x38f183(0x24a)]===_0x38f183(0x27c))return console[_0x38f183(0x26d)](_0x38f183(0x265)),console[_0x38f183(0x26d)](_0x38f183(0x217)),0x1;if(_0x51155f['type']===_0x38f183(0x1fd))return console[_0x38f183(0x26d)](_0x38f183(0x215)),console[_0x38f183(0x26d)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x51155f[_0x38f183(0x242)])throw new SDKError(ErrorCode[_0x38f183(0x26b)],_0x38f183(0x1fa));const _0x477f34=await withSpinner(_0x38f183(0x25e),()=>_0x24a2bb[_0x38f183(0x278)][_0x38f183(0x237)](_0x51155f[_0x38f183(0x219)],_0x51155f[_0x38f183(0x242)]),{'verbose':_0x34299d['verbose']}),_0x45818a=_0x477f34[_0x38f183(0x276)];return _0x34299d[_0x38f183(0x234)]===_0x38f183(0x264)||_0x34299d['format']===_0x38f183(0x230)?await handleSDKOutput([{'sql':_0x45818a}],_0x34299d):console['log'](_0x45818a),0x0;}catch(_0x4d324d){if(_0x4d324d instanceof SDKError)return console['error'](_0x38f183(0x245)+_0x4d324d['message']),_0x4d324d[_0x38f183(0x22e)]&&console['error'](_0x38f183(0x21a)+_0x4d324d[_0x38f183(0x22e)]),0x1;throw _0x4d324d;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x33e530(0x25a)]=a25_0x33e530(0x251);[a25_0x33e530(0x261)]='Create\x20segment\x20folder\x20for\x20organization';async[a25_0x33e530(0x1fb)](_0x493ac2){const _0x474047=a25_0x33e530,{options:_0x5d61e1,args:_0x7ea0b0,tdx:_0x238e51}=_0x493ac2,_0x540ab7=_0x5d61e1;if(_0x7ea0b0[_0x474047(0x22b)]<0x2)return console[_0x474047(0x26d)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x474047(0x26d)](_0x474047(0x232)),0x1;const _0x23205f=_0x7ea0b0[0x0],_0x397ac4=_0x7ea0b0[0x1];_0x540ab7['verbose']&&(console[_0x474047(0x26d)](_0x474047(0x23f)+_0x540ab7['site']),console[_0x474047(0x26d)](_0x474047(0x266)+_0x23205f),console['error'](_0x474047(0x21e)+_0x397ac4));let _0x32877f;if(_0x540ab7['parentFolder']){const _0x407e44=_0x540ab7[_0x474047(0x20d)],_0x507b82=await withSpinner(_0x474047(0x25b)+_0x23205f+_0x474047(0x279),()=>_0x238e51['segment'][_0x474047(0x275)](_0x23205f),{'verbose':_0x540ab7['verbose']}),_0x2b78fb=_0x507b82[_0x474047(0x276)],_0x10fd99=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x407e44+_0x474047(0x279),()=>_0x238e51[_0x474047(0x278)][_0x474047(0x1f1)](_0x2b78fb,_0x407e44),{'verbose':_0x540ab7[_0x474047(0x262)]});_0x32877f=_0x10fd99[_0x474047(0x276)],_0x540ab7[_0x474047(0x262)]&&console[_0x474047(0x26d)](_0x474047(0x260)+_0x32877f);}const _0x143d7f={'name':_0x397ac4,'description':_0x540ab7['description'],'parentFolderId':_0x32877f},_0xd5158a=await withSpinner(_0x474047(0x25d)+_0x397ac4+_0x474047(0x279),()=>_0x238e51[_0x474047(0x278)][_0x474047(0x263)](_0x23205f,_0x143d7f),{'verbose':_0x540ab7['verbose']}),_0x5de66f=_0xd5158a[_0x474047(0x276)];return console['error'](_0x474047(0x22f)+_0x5de66f[_0x474047(0x25a)]+'\x27\x20with\x20ID:\x20'+_0x5de66f['id']),await handleSDKOutput([_0x5de66f],_0x540ab7),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x33e530(0x25a)]='segment:view';['description']=a25_0x33e530(0x25f);async['execute'](_0x106f71){const _0x23d8b3=a25_0x33e530,{options:_0x5278c2,args:_0x4b7362,tdx:_0x5e8799}=_0x106f71,_0x3daab6=_0x4b7362[0x0];if(!_0x3daab6)return console[_0x23d8b3(0x26d)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x23d8b3(0x26d)](_0x23d8b3(0x256)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x254)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x205)),console[_0x23d8b3(0x26d)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x23d8b3(0x26d)](_0x23d8b3(0x26f)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x24d)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x24b)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x277)),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x14a636=_0x5278c2[_0x23d8b3(0x24c)],_0x1d8bb8=await resolveSegmentTarget(_0x3daab6,_0x14a636,_0x5278c2[_0x23d8b3(0x262)]);_0x5278c2['verbose']&&console[_0x23d8b3(0x26d)]('Target\x20path:\x20'+_0x1d8bb8);const _0x13cbd1=await withSpinner('Resolving\x20\x27'+_0x3daab6+_0x23d8b3(0x279),()=>_0x5e8799[_0x23d8b3(0x278)][_0x23d8b3(0x200)](_0x1d8bb8),{'verbose':_0x5278c2['verbose']}),_0x255076=_0x13cbd1[_0x23d8b3(0x276)];_0x5278c2['verbose']&&(console[_0x23d8b3(0x26d)]('Resolved\x20type:\x20'+_0x255076[_0x23d8b3(0x24a)]),console[_0x23d8b3(0x26d)]('Parent\x20ID:\x20'+_0x255076[_0x23d8b3(0x219)]),_0x255076[_0x23d8b3(0x209)]&&console[_0x23d8b3(0x26d)]('Folder\x20ID:\x20'+_0x255076['folderId']),_0x255076[_0x23d8b3(0x242)]&&console[_0x23d8b3(0x26d)](_0x23d8b3(0x273)+_0x255076['segmentId']));if(_0x5278c2[_0x23d8b3(0x26e)]){if(_0x255076[_0x23d8b3(0x24a)]===_0x23d8b3(0x27c))return console[_0x23d8b3(0x26d)](_0x23d8b3(0x23c)),0x1;if(_0x255076[_0x23d8b3(0x24a)]===_0x23d8b3(0x1fd))return console[_0x23d8b3(0x26d)](_0x23d8b3(0x208)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x210)),0x1;if(!_0x255076[_0x23d8b3(0x242)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4fbca5=getConsoleNextUrl(_0x5278c2[_0x23d8b3(0x259)],_0x23d8b3(0x271)+_0x255076['parentId']+_0x23d8b3(0x20a)+_0x255076['segmentId']);return console['error'](a25_0x4b87e8[_0x23d8b3(0x247)]('✔')+_0x23d8b3(0x274)+a25_0x4b87e8['cyan'](_0x4fbca5)),openBrowser(_0x4fbca5),0x0;}if(_0x255076['type']===_0x23d8b3(0x27c)){if(!_0x255076[_0x23d8b3(0x209)])throw new SDKError(ErrorCode[_0x23d8b3(0x272)],_0x23d8b3(0x1f4));const _0x2b0a79=await withSpinner('Fetching\x20folder\x20details...',()=>_0x5e8799['segment']['getFolder'](_0x255076[_0x23d8b3(0x209)]),{'verbose':_0x5278c2[_0x23d8b3(0x262)]});await handleSingleObjectOutput(_0x2b0a79[_0x23d8b3(0x276)],_0x5278c2);}else{if(_0x255076[_0x23d8b3(0x24a)]===_0x23d8b3(0x278)){if(!_0x255076['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x23d8b3(0x1fa));const _0x1d2b96=await withSpinner(_0x23d8b3(0x27b),()=>_0x5e8799[_0x23d8b3(0x278)][_0x23d8b3(0x23d)](_0x255076[_0x23d8b3(0x219)],_0x255076[_0x23d8b3(0x242)]),{'verbose':_0x5278c2['verbose']}),_0x3af9ca=getConsoleNextUrl(_0x5278c2[_0x23d8b3(0x259)],_0x23d8b3(0x271)+_0x255076[_0x23d8b3(0x219)]+'/e/'+_0x255076['segmentId']),_0x4ec318=_0x1d2b96[_0x23d8b3(0x276)];_0x4ec318[_0x23d8b3(0x236)]=_0x3af9ca,await handleSingleObjectOutput(_0x4ec318,_0x5278c2);}else return console[_0x23d8b3(0x26d)](_0x23d8b3(0x1f2)),console[_0x23d8b3(0x26d)](_0x23d8b3(0x235)),0x1;}return 0x0;}catch(_0x575f61){if(_0x575f61 instanceof SDKError)return console[_0x23d8b3(0x26d)](_0x23d8b3(0x245)+_0x575f61[_0x23d8b3(0x1ff)]),_0x575f61[_0x23d8b3(0x22e)]&&console[_0x23d8b3(0x26d)]('\x20\x20Cause:\x20'+_0x575f61['cause']),0x1;throw _0x575f61;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x33e530(0x25a)]=a25_0x33e530(0x22c);[a25_0x33e530(0x261)]=a25_0x33e530(0x20c);async[a25_0x33e530(0x1fb)](_0x2f81ce){const _0x5c8f97=a25_0x33e530,{options:_0x37fc07,args:_0x45783e,tdx:_0x491c6c}=_0x2f81ce,_0x28e0d4=_0x45783e[0x0];if(!_0x28e0d4)return console[_0x5c8f97(0x26d)](_0x5c8f97(0x211)),console[_0x5c8f97(0x26d)](_0x5c8f97(0x239)),console[_0x5c8f97(0x26d)](_0x5c8f97(0x258)),console[_0x5c8f97(0x26d)](_0x5c8f97(0x26f)),console[_0x5c8f97(0x26d)](_0x5c8f97(0x222)),console[_0x5c8f97(0x26d)](_0x5c8f97(0x27a)),0x1;try{const _0x35a535=_0x37fc07[_0x5c8f97(0x24c)],_0x5a66c7=await resolveSegmentTarget(_0x28e0d4,_0x35a535,_0x37fc07[_0x5c8f97(0x262)]);_0x37fc07[_0x5c8f97(0x262)]&&console[_0x5c8f97(0x26d)]('Target\x20path:\x20'+_0x5a66c7);const _0x3d13d9=await withSpinner(_0x5c8f97(0x204)+_0x28e0d4+'\x27...',()=>_0x491c6c[_0x5c8f97(0x278)][_0x5c8f97(0x200)](_0x5a66c7),{'verbose':_0x37fc07['verbose']}),_0x540d71=_0x3d13d9[_0x5c8f97(0x276)];_0x37fc07['verbose']&&(console['error'](_0x5c8f97(0x216)+_0x540d71[_0x5c8f97(0x24a)]),console[_0x5c8f97(0x26d)]('Parent\x20ID:\x20'+_0x540d71['parentId']));if(_0x540d71[_0x5c8f97(0x24a)]===_0x5c8f97(0x27c))return console['error'](_0x5c8f97(0x26c)),console[_0x5c8f97(0x26d)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x540d71['type']===_0x5c8f97(0x1fd))return console['error'](_0x5c8f97(0x21b)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x540d71[_0x5c8f97(0x242)])throw new SDKError(ErrorCode[_0x5c8f97(0x26b)],_0x5c8f97(0x1fa));const _0xc77a10=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x491c6c[_0x5c8f97(0x278)][_0x5c8f97(0x237)](_0x540d71[_0x5c8f97(0x219)],_0x540d71[_0x5c8f97(0x242)]),{'verbose':_0x37fc07['verbose']}),_0x52423d=_0xc77a10[_0x5c8f97(0x276)],_0x55924c=await executeSchemaQuery(_0x52423d,_0x491c6c,_0x37fc07);return await handleQueryOutput(_0x55924c,_0x37fc07),0x0;}catch(_0x5cebd6){if(_0x5cebd6 instanceof SDKError)return console['error'](_0x5c8f97(0x245)+_0x5cebd6[_0x5c8f97(0x1ff)]),_0x5cebd6[_0x5c8f97(0x22e)]&&console['error'](_0x5c8f97(0x21a)+_0x5cebd6[_0x5c8f97(0x22e)]),0x1;throw _0x5cebd6;}}}
@@ -1 +1 @@
1
- const a26_0x1fc76f=a26_0x30f7;(function(_0x407407,_0x1e0a78){const _0xffcdb0=a26_0x30f7,_0x5b48b3=_0x407407();while(!![]){try{const _0x3a2431=parseInt(_0xffcdb0(0x1be))/0x1*(parseInt(_0xffcdb0(0x1c3))/0x2)+parseInt(_0xffcdb0(0x1ee))/0x3+parseInt(_0xffcdb0(0x1d7))/0x4*(-parseInt(_0xffcdb0(0x1e5))/0x5)+-parseInt(_0xffcdb0(0x1d9))/0x6+-parseInt(_0xffcdb0(0x1c2))/0x7+parseInt(_0xffcdb0(0x1bc))/0x8*(parseInt(_0xffcdb0(0x1c6))/0x9)+-parseInt(_0xffcdb0(0x1d6))/0xa;if(_0x3a2431===_0x1e0a78)break;else _0x5b48b3['push'](_0x5b48b3['shift']());}catch(_0x1d1328){_0x5b48b3['push'](_0x5b48b3['shift']());}}}(a26_0x23d7,0xa7f4d));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';function a26_0x23d7(){const _0x5bcb91=['resolvePathToResource','Target\x20path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','data','error','\x20\x20\x20Path:\x20','✔\x20Created\x20segment\x20\x27','Examples:','Resolving\x20folder\x20\x27','segment','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','80595fWbBxo','createSegment','resolveParentId','folderId','segments','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','noCountPopulation','Resolving\x20folder\x20path\x20\x27','site','1172556jaNzrj','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','type','folder','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','8KzdPoe','verbose','4ZxfZXt','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Creating\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','5194616bZMECJ','568010phYNFJ','Site:\x20','rule','3823434duBxDz','Resolved\x20folder\x20ID:\x20','resolveFolderId','execute','kind','name','\x27...','Parent\x20path:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','ruleFile','description','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','length','Parent:\x20','Resolving\x20parent\x20segment\x20\x27','4005470ccxjYB','8MjphWs','yellow','533256kgksFi'];a26_0x23d7=function(){return _0x5bcb91;};return a26_0x23d7();}function a26_0x30f7(_0x5ad204,_0x34ead7){_0x5ad204=_0x5ad204-0x1b9;const _0x23d7af=a26_0x23d7();let _0x30f763=_0x23d7af[_0x5ad204];return _0x30f763;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x38b62c from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x1fc76f(0x1cb)]='segment:create';[a26_0x1fc76f(0x1d0)]=a26_0x1fc76f(0x1dc);async[a26_0x1fc76f(0x1c9)](_0x10adab){const _0x25904f=a26_0x1fc76f;console[_0x25904f(0x1de)](a26_0x38b62c[_0x25904f(0x1d8)](_0x25904f(0x1c1))),console['error'](a26_0x38b62c[_0x25904f(0x1d8)](_0x25904f(0x1bb)));const {options:_0x3806db,args:_0x4e7747,tdx:_0x23aab2}=_0x10adab,_0x167f1d=_0x3806db;if(_0x4e7747[_0x25904f(0x1d3)]===0x0)return console[_0x25904f(0x1de)](_0x25904f(0x1d1)),console[_0x25904f(0x1de)](_0x25904f(0x1e4)),console[_0x25904f(0x1de)](_0x25904f(0x1e1)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x25904f(0x1de)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x25904f(0x1de)](_0x25904f(0x1bf)),0x1;const _0x72d46=_0x4e7747[0x0],_0x420e00=_0x3806db['segmentPath'];let _0x56869d=_0x72d46;_0x420e00&&!_0x72d46['includes']('/')&&(_0x56869d=_0x420e00+'/'+_0x72d46,_0x167f1d['verbose']&&console[_0x25904f(0x1de)](_0x25904f(0x1d2)+_0x56869d));const _0x4daf47=parsePath(_0x56869d);if(_0x4daf47[_0x25904f(0x1e9)][_0x25904f(0x1d3)]<0x2)return console[_0x25904f(0x1de)](_0x25904f(0x1ce)),console['error'](_0x25904f(0x1ea)),0x1;const _0x4b56ed=_0x4daf47[_0x25904f(0x1e9)][0x0],_0x424222=getBaseName(_0x56869d),_0xc304dc=getParentPath(_0x56869d);_0x167f1d['verbose']&&(console[_0x25904f(0x1de)](_0x25904f(0x1c4)+_0x167f1d[_0x25904f(0x1ed)]),console[_0x25904f(0x1de)](_0x25904f(0x1db)+_0x56869d),console[_0x25904f(0x1de)](_0x25904f(0x1d4)+_0x4b56ed),console['error']('Segment\x20name:\x20'+_0x424222),console['error'](_0x25904f(0x1cd)+_0xc304dc));const _0x4f2f78=await withSpinner(_0x25904f(0x1d5)+_0x4b56ed+_0x25904f(0x1cc),()=>_0x23aab2[_0x25904f(0x1e3)][_0x25904f(0x1e7)](_0x4b56ed),{'verbose':_0x167f1d[_0x25904f(0x1bd)]}),_0x352400=_0x4f2f78['data'];let _0x201f2a;if(_0x4daf47[_0x25904f(0x1e9)]['length']>0x2){const _0x3b375a=await withSpinner(_0x25904f(0x1ec)+_0xc304dc+_0x25904f(0x1cc),()=>_0x23aab2[_0x25904f(0x1e3)][_0x25904f(0x1da)](_0xc304dc),{'verbose':_0x167f1d[_0x25904f(0x1bd)]}),_0x5c1eb4=_0x3b375a['data'];if(_0x5c1eb4['type']!==_0x25904f(0x1ba)&&_0x5c1eb4[_0x25904f(0x1b9)]!=='parent')return console['error'](_0x25904f(0x1ef)),0x1;_0x201f2a=_0x5c1eb4[_0x25904f(0x1e8)];}else{if(_0x167f1d[_0x25904f(0x1ba)]){const _0x368ecd=await withSpinner(_0x25904f(0x1e2)+_0x167f1d[_0x25904f(0x1ba)]+_0x25904f(0x1cc),()=>_0x23aab2['segment'][_0x25904f(0x1c8)](_0x352400,_0x167f1d[_0x25904f(0x1ba)]),{'verbose':_0x167f1d['verbose']});_0x201f2a=_0x368ecd[_0x25904f(0x1dd)];}}_0x167f1d[_0x25904f(0x1bd)]&&_0x201f2a&&console['error'](_0x25904f(0x1c7)+_0x201f2a);const _0x250c03=await loadJSONFromOptions(_0x167f1d[_0x25904f(0x1c5)],_0x167f1d[_0x25904f(0x1cf)]),_0x3207f8={'name':_0x424222,'description':_0x167f1d['description'],'rule':_0x250c03,'kind':_0x167f1d['kind']!==undefined?parseInt(_0x167f1d[_0x25904f(0x1ca)],0xa):undefined,'isVisible':_0x167f1d['invisible']?![]:undefined,'segmentFolderId':_0x201f2a,'countPopulation':_0x167f1d[_0x25904f(0x1eb)]?![]:undefined},_0x2a229f=await withSpinner(_0x25904f(0x1c0)+_0x424222+'\x27...',()=>_0x23aab2[_0x25904f(0x1e3)][_0x25904f(0x1e6)](_0x352400,_0x3207f8),{'verbose':_0x167f1d[_0x25904f(0x1bd)]}),_0x545d66=_0x2a229f['data'];return console[_0x25904f(0x1de)](_0x25904f(0x1e0)+_0x545d66[_0x25904f(0x1cb)]+'\x27\x20with\x20ID:\x20'+_0x545d66['id']),_0x56869d!==_0x72d46&&console[_0x25904f(0x1de)](_0x25904f(0x1df)+_0x56869d),await handleSDKOutput([_0x545d66],_0x167f1d),0x0;}}
1
+ function a26_0x33c3(_0x475f0a,_0x1623df){_0x475f0a=_0x475f0a-0x18a;const _0x151a90=a26_0x151a();let _0x33c3a8=_0x151a90[_0x475f0a];return _0x33c3a8;}const a26_0x361ee9=a26_0x33c3;(function(_0x4b5066,_0x1d7256){const _0x386699=a26_0x33c3,_0x719dde=_0x4b5066();while(!![]){try{const _0x39104b=-parseInt(_0x386699(0x1b7))/0x1*(-parseInt(_0x386699(0x1a3))/0x2)+parseInt(_0x386699(0x192))/0x3*(-parseInt(_0x386699(0x1ab))/0x4)+-parseInt(_0x386699(0x1a8))/0x5+-parseInt(_0x386699(0x18f))/0x6*(-parseInt(_0x386699(0x198))/0x7)+-parseInt(_0x386699(0x1be))/0x8*(parseInt(_0x386699(0x1b0))/0x9)+parseInt(_0x386699(0x191))/0xa*(-parseInt(_0x386699(0x194))/0xb)+parseInt(_0x386699(0x1a5))/0xc;if(_0x39104b===_0x1d7256)break;else _0x719dde['push'](_0x719dde['shift']());}catch(_0x46c51f){_0x719dde['push'](_0x719dde['shift']());}}}(a26_0x151a,0x31f88));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x151a(){const _0x546342=['\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','850584IetUuS','Resolving\x20parent\x20segment\x20\x27','954790GJNmBf','798375DmwWzh','Resolving\x20folder\x20\x27','22XCUfYu','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','includes','Site:\x20','14JVtrAi','✔\x20Created\x20segment\x20\x27','error','kind','rule','folder','yellow','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Examples:','124588eqyVta','Parent\x20path:\x20','7971972pBzywL','Resolving\x20folder\x20path\x20\x27','verbose','1611070PsAVqa','Creating\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','4goajVD','type','site','resolveParentId','segment','72cigthD','length','name','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','noCountPopulation','parent','segmentPath','1zhdpny','\x27\x20with\x20ID:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','segments','invisible','description','26176GDbPAt','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Segment\x20name:\x20','data','Parent:\x20','Resolved\x20relative\x20path\x20to:\x20','execute','\x20\x20\x20Path:\x20'];a26_0x151a=function(){return _0x546342;};return a26_0x151a();}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 a26_0x1f61b1 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';[a26_0x361ee9(0x1bd)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a26_0x361ee9(0x18c)](_0x5e16a1){const _0x33b72b=a26_0x361ee9;console['error'](a26_0x1f61b1[_0x33b72b(0x19e)](_0x33b72b(0x19f))),console['error'](a26_0x1f61b1[_0x33b72b(0x19e)](_0x33b72b(0x195)));const {options:_0x1526e7,args:_0x2807c8,tdx:_0x39b4c3}=_0x5e16a1,_0x31a9fa=_0x1526e7;if(_0x2807c8[_0x33b72b(0x1b1)]===0x0)return console[_0x33b72b(0x19a)](_0x33b72b(0x1b3)),console[_0x33b72b(0x19a)](_0x33b72b(0x1aa)),console['error'](_0x33b72b(0x1a2)),console[_0x33b72b(0x19a)](_0x33b72b(0x1bf)),console[_0x33b72b(0x19a)](_0x33b72b(0x18e)),console[_0x33b72b(0x19a)](_0x33b72b(0x1a1)),0x1;const _0x3a9745=_0x2807c8[0x0],_0x9a9545=_0x1526e7[_0x33b72b(0x1b6)];let _0x51117b=_0x3a9745;_0x9a9545&&!_0x3a9745[_0x33b72b(0x196)]('/')&&(_0x51117b=_0x9a9545+'/'+_0x3a9745,_0x31a9fa['verbose']&&console[_0x33b72b(0x19a)](_0x33b72b(0x18b)+_0x51117b));const _0x1b3feb=parsePath(_0x51117b);if(_0x1b3feb[_0x33b72b(0x1bb)][_0x33b72b(0x1b1)]<0x2)return console[_0x33b72b(0x19a)](_0x33b72b(0x1b9)),console[_0x33b72b(0x19a)](_0x33b72b(0x1ba)),0x1;const _0x189357=_0x1b3feb['segments'][0x0],_0x1f1dc4=getBaseName(_0x51117b),_0x28ea38=getParentPath(_0x51117b);_0x31a9fa[_0x33b72b(0x1a7)]&&(console[_0x33b72b(0x19a)](_0x33b72b(0x197)+_0x31a9fa[_0x33b72b(0x1ad)]),console[_0x33b72b(0x19a)]('Target\x20path:\x20'+_0x51117b),console[_0x33b72b(0x19a)](_0x33b72b(0x18a)+_0x189357),console[_0x33b72b(0x19a)](_0x33b72b(0x1c0)+_0x1f1dc4),console[_0x33b72b(0x19a)](_0x33b72b(0x1a4)+_0x28ea38));const _0x120cac=await withSpinner(_0x33b72b(0x190)+_0x189357+_0x33b72b(0x1a0),()=>_0x39b4c3['segment'][_0x33b72b(0x1ae)](_0x189357),{'verbose':_0x31a9fa[_0x33b72b(0x1a7)]}),_0x27fcb7=_0x120cac[_0x33b72b(0x1c1)];let _0x2f22da;if(_0x1b3feb[_0x33b72b(0x1bb)][_0x33b72b(0x1b1)]>0x2){const _0x5ec81a=await withSpinner(_0x33b72b(0x1a6)+_0x28ea38+_0x33b72b(0x1a0),()=>_0x39b4c3[_0x33b72b(0x1af)]['resolvePathToResource'](_0x28ea38),{'verbose':_0x31a9fa[_0x33b72b(0x1a7)]}),_0x5e47f2=_0x5ec81a['data'];if(_0x5e47f2['type']!==_0x33b72b(0x19d)&&_0x5e47f2[_0x33b72b(0x1ac)]!==_0x33b72b(0x1b5))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x2f22da=_0x5e47f2['folderId'];}else{if(_0x31a9fa[_0x33b72b(0x19d)]){const _0x5bce38=await withSpinner(_0x33b72b(0x193)+_0x31a9fa[_0x33b72b(0x19d)]+_0x33b72b(0x1a0),()=>_0x39b4c3[_0x33b72b(0x1af)]['resolveFolderId'](_0x27fcb7,_0x31a9fa[_0x33b72b(0x19d)]),{'verbose':_0x31a9fa[_0x33b72b(0x1a7)]});_0x2f22da=_0x5bce38['data'];}}_0x31a9fa[_0x33b72b(0x1a7)]&&_0x2f22da&&console[_0x33b72b(0x19a)]('Resolved\x20folder\x20ID:\x20'+_0x2f22da);const _0x7382a6=await loadJSONFromOptions(_0x31a9fa[_0x33b72b(0x19c)],_0x31a9fa['ruleFile']),_0x47d3c6={'name':_0x1f1dc4,'description':_0x31a9fa[_0x33b72b(0x1bd)],'rule':_0x7382a6,'kind':_0x31a9fa[_0x33b72b(0x19b)]!==undefined?parseInt(_0x31a9fa[_0x33b72b(0x19b)],0xa):undefined,'isVisible':_0x31a9fa[_0x33b72b(0x1bc)]?![]:undefined,'segmentFolderId':_0x2f22da,'countPopulation':_0x31a9fa[_0x33b72b(0x1b4)]?![]:undefined},_0x527ec0=await withSpinner(_0x33b72b(0x1a9)+_0x1f1dc4+_0x33b72b(0x1a0),()=>_0x39b4c3[_0x33b72b(0x1af)]['createSegment'](_0x27fcb7,_0x47d3c6),{'verbose':_0x31a9fa['verbose']}),_0x22e00a=_0x527ec0[_0x33b72b(0x1c1)];return console[_0x33b72b(0x19a)](_0x33b72b(0x199)+_0x22e00a[_0x33b72b(0x1b2)]+_0x33b72b(0x1b8)+_0x22e00a['id']),_0x51117b!==_0x3a9745&&console[_0x33b72b(0x19a)](_0x33b72b(0x18d)+_0x51117b),await handleSDKOutput([_0x22e00a],_0x31a9fa),0x0;}}
@@ -1 +1 @@
1
- const a27_0x2d0390=a27_0x11a4;(function(_0x72b521,_0x234a74){const _0xca3be3=a27_0x11a4,_0x53d961=_0x72b521();while(!![]){try{const _0x3756aa=-parseInt(_0xca3be3(0xa3))/0x1+-parseInt(_0xca3be3(0x9d))/0x2*(-parseInt(_0xca3be3(0x9b))/0x3)+-parseInt(_0xca3be3(0xa7))/0x4*(-parseInt(_0xca3be3(0xaf))/0x5)+parseInt(_0xca3be3(0xb0))/0x6*(-parseInt(_0xca3be3(0xb3))/0x7)+-parseInt(_0xca3be3(0x9c))/0x8+-parseInt(_0xca3be3(0xb1))/0x9+-parseInt(_0xca3be3(0xaa))/0xa*(-parseInt(_0xca3be3(0xa0))/0xb);if(_0x3756aa===_0x234a74)break;else _0x53d961['push'](_0x53d961['shift']());}catch(_0x3bedbf){_0x53d961['push'](_0x53d961['shift']());}}}(a27_0x4b5c,0x23fdc));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a27_0x4b5c(){const _0x3d28cf=['✔\x20Found\x20','1595vaVcSy','387570lBjqay','1810413seSyqa','segment','21ziIkyl','json','List\x20available\x20fields\x20for\x20segmentation','Site:\x20','description','239283GkBnnP','1121192sdAaLu','4OdqHpN','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','jsonl','184987gIDXpo','error','verbose','32242ydCbqJ','execute','\x27...','segment:fields','636dppzXm','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Parent\x20segment:\x20','300HnwbQH','length','name','listFields'];a27_0x4b5c=function(){return _0x3d28cf;};return a27_0x4b5c();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a27_0x11a4(_0x17642f,_0x545155){_0x17642f=_0x17642f-0x98;const _0x4b5c9b=a27_0x4b5c();let _0x11a4e3=_0x4b5c9b[_0x17642f];return _0x11a4e3;}export class SegmentFieldsCommand extends BaseCommand{[a27_0x2d0390(0xac)]=a27_0x2d0390(0xa6);[a27_0x2d0390(0x9a)]=a27_0x2d0390(0x98);async[a27_0x2d0390(0xa4)](_0x2e22f0){const _0x240cba=a27_0x2d0390,{options:_0x23960e,args:_0x506f41,tdx:_0x55f489}=_0x2e22f0,_0xd2318=_0x506f41[0x0]||_0x23960e['parentSegment'];if(!_0xd2318)return console[_0x240cba(0xa1)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x240cba(0xa1)](_0x240cba(0x9e)),console[_0x240cba(0xa1)](_0x240cba(0xa8)),0x1;_0x23960e[_0x240cba(0xa2)]&&(console[_0x240cba(0xa1)](_0x240cba(0x99)+_0x23960e['site']),console['error'](_0x240cba(0xa9)+_0xd2318));const _0x2fc198=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0xd2318+_0x240cba(0xa5),()=>_0x55f489[_0x240cba(0xb2)][_0x240cba(0xad)](_0xd2318),{'verbose':_0x23960e[_0x240cba(0xa2)]}),_0x178f5c=_0x2fc198['data'];console[_0x240cba(0xa1)](_0x240cba(0xae)+_0x178f5c[_0x240cba(0xab)]+'\x20field'+(_0x178f5c['length']!==0x1?'s':''));if(_0x23960e[_0x240cba(0xb4)]||_0x23960e[_0x240cba(0x9f)])return await handleSDKOutput(_0x178f5c,_0x23960e),0x0;return displayFieldsHumanReadable(_0x178f5c,_0xd2318),0x0;}}
1
+ const a27_0x1deceb=a27_0x5511;function a27_0x5511(_0xe004c7,_0x501671){_0xe004c7=_0xe004c7-0x15d;const _0x579705=a27_0x5797();let _0x5511eb=_0x579705[_0xe004c7];return _0x5511eb;}(function(_0x11f7bb,_0x3d5488){const _0x2b2273=a27_0x5511,_0x1ae559=_0x11f7bb();while(!![]){try{const _0x5bd79c=-parseInt(_0x2b2273(0x175))/0x1+-parseInt(_0x2b2273(0x162))/0x2*(parseInt(_0x2b2273(0x165))/0x3)+parseInt(_0x2b2273(0x160))/0x4*(parseInt(_0x2b2273(0x16e))/0x5)+-parseInt(_0x2b2273(0x169))/0x6+parseInt(_0x2b2273(0x16b))/0x7*(parseInt(_0x2b2273(0x173))/0x8)+parseInt(_0x2b2273(0x176))/0x9*(-parseInt(_0x2b2273(0x161))/0xa)+parseInt(_0x2b2273(0x15e))/0xb*(parseInt(_0x2b2273(0x167))/0xc);if(_0x5bd79c===_0x3d5488)break;else _0x1ae559['push'](_0x1ae559['shift']());}catch(_0x270339){_0x1ae559['push'](_0x1ae559['shift']());}}}(a27_0x5797,0x1d642));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a27_0x5797(){const _0x68ed6e=['404208XWbOsV','verbose','data','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','description','448349apSZqt','listFields','807780JUYohC','40zWONkn','122TClrZA','error','length','945ixNegj','Error:\x20Parent\x20segment\x20name\x20is\x20required','48EonxAY','Listing\x20fields\x20for\x20\x27','122904KyodOv','site','217scOnBy','segment:fields','json','5nprEXN','name','segment','parentSegment','Site:\x20','51480qvFdVs','Parent\x20segment:\x20','224733qkflaR'];a27_0x5797=function(){return _0x68ed6e;};return a27_0x5797();}export class SegmentFieldsCommand extends BaseCommand{[a27_0x1deceb(0x16f)]=a27_0x1deceb(0x16c);[a27_0x1deceb(0x15d)]=a27_0x1deceb(0x179);async['execute'](_0x2391ca){const _0x52a7f3=a27_0x1deceb,{options:_0x9951a4,args:_0x539000,tdx:_0x14c498}=_0x2391ca,_0x11fea2=_0x539000[0x0]||_0x9951a4[_0x52a7f3(0x171)];if(!_0x11fea2)return console['error'](_0x52a7f3(0x166)),console[_0x52a7f3(0x163)](_0x52a7f3(0x17a)),console[_0x52a7f3(0x163)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x9951a4[_0x52a7f3(0x177)]&&(console[_0x52a7f3(0x163)](_0x52a7f3(0x172)+_0x9951a4[_0x52a7f3(0x16a)]),console[_0x52a7f3(0x163)](_0x52a7f3(0x174)+_0x11fea2));const _0x42e095=await withSpinner(_0x52a7f3(0x168)+_0x11fea2+'\x27...',()=>_0x14c498[_0x52a7f3(0x170)][_0x52a7f3(0x15f)](_0x11fea2),{'verbose':_0x9951a4[_0x52a7f3(0x177)]}),_0x8c22dc=_0x42e095[_0x52a7f3(0x178)];console[_0x52a7f3(0x163)]('✔\x20Found\x20'+_0x8c22dc[_0x52a7f3(0x164)]+'\x20field'+(_0x8c22dc[_0x52a7f3(0x164)]!==0x1?'s':''));if(_0x9951a4[_0x52a7f3(0x16d)]||_0x9951a4['jsonl'])return await handleSDKOutput(_0x8c22dc,_0x9951a4),0x0;return displayFieldsHumanReadable(_0x8c22dc,_0x11fea2),0x0;}}
@@ -1 +1 @@
1
- const a28_0x8af78c=a28_0x2a7d;(function(_0x252136,_0x828d6c){const _0x15ed33=a28_0x2a7d,_0x2f5e45=_0x252136();while(!![]){try{const _0xa6db64=parseInt(_0x15ed33(0x1d8))/0x1*(parseInt(_0x15ed33(0x1dd))/0x2)+-parseInt(_0x15ed33(0x1c7))/0x3+parseInt(_0x15ed33(0x1b2))/0x4*(-parseInt(_0x15ed33(0x1c6))/0x5)+parseInt(_0x15ed33(0x1d5))/0x6*(-parseInt(_0x15ed33(0x1d7))/0x7)+parseInt(_0x15ed33(0x1b9))/0x8*(parseInt(_0x15ed33(0x197))/0x9)+-parseInt(_0x15ed33(0x1bf))/0xa+parseInt(_0x15ed33(0x19d))/0xb*(parseInt(_0x15ed33(0x1a6))/0xc);if(_0xa6db64===_0x828d6c)break;else _0x2f5e45['push'](_0x2f5e45['shift']());}catch(_0xf809a9){_0x2f5e45['push'](_0x2f5e45['shift']());}}}(a28_0x186f,0xf3a5d));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a28_0x186f(){const _0x1df9df=['repeat','\x20versions)','isNew','length','utf-8','\x20unchanged\x20files','parent_segment','data','counts','238494dwuWAM','✔\x20Context\x20set:\x20','301pfJKtn','931478iuFiDj','filter','✔\x20Pulled\x20','resourceName','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','4RsKYQL','yes','file','red','yellow','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','segments','\x20files?','3573NZuFwP','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)','helpText','Pulling\x20segments\x20from\x20\x27','journeys','absolutePath','4969030YRYhmm','\x20\x20🎯\x20','session','\x20segments','\x20files\x20to\x20','Parent\x20segment:\x20','error','\x20=\x20','\x20\x20Target:\x20','24wOxLSB','Error:\x20','cyan','activations','targetDir','execute','segment','\x0aChanges\x20to\x20\x27','\x20activations','dim','diff','message','4UweFgJ','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','parentName','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','cwd','journeyVersions','31384hLXCEo','Aborted.','Site:\x20','\x20\x20🗺️\x20\x20','segment:pull','hasChanges','3925760TStlwH','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x0aPull\x20summary\x20for\x20\x27','content','✔\x20All\x20files\x20are\x20up\x20to\x20date','verbose','files','5501185OlQLVg','371538esIyxX','Write\x20','\x20new\x20files','parentSegment','relativePath'];a28_0x186f=function(){return _0x1df9df;};return a28_0x186f();}import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a28_0x3752e5 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a28_0x2a7d(_0x5ecb23,_0x50ae64){_0x5ecb23=_0x5ecb23-0x195;const _0x186fb5=a28_0x186f();let _0x2a7d54=_0x186fb5[_0x5ecb23];return _0x2a7d54;}import a28_0x47d1a8 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a28_0x8af78c(0x1bd);['description']=a28_0x8af78c(0x1e2);async[a28_0x8af78c(0x1ab)](_0x1d44c9){const _0x540c31=a28_0x8af78c,{options:_0xdd37eb,args:_0x258707,tdx:_0x1dd6d3}=_0x1d44c9,_0x501b97=_0xdd37eb,_0x5c0004=await resolveTarget({'arg':_0x258707[0x0],'contextParent':_0xdd37eb[_0x540c31(0x1ca)],'cwd':process[_0x540c31(0x1b7)]()});if(!isSuccessfulResolution(_0x5c0004))return _0x5c0004['errorCode']==='no_parent'?(console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1e1)](_0x540c31(0x1c0))),console[_0x540c31(0x1a3)](_0x540c31(0x198)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x540c31(0x1a3)](_0x540c31(0x1b4))):(console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1e0)](_0x540c31(0x1a7)+_0x5c0004[_0x540c31(0x1b1)]+'\x0a')),_0x5c0004[_0x540c31(0x199)]&&console[_0x540c31(0x1a3)](a28_0x3752e5['cyan'](_0x5c0004[_0x540c31(0x199)]))),0x1;const _0x41721c=_0x5c0004[_0x540c31(0x1b5)],_0x6e34c5=_0x5c0004['targetDir'],_0x43451b=_0x5c0004['type']===_0x540c31(0x1df)?_0x5c0004[_0x540c31(0x1db)]:undefined;_0x501b97[_0x540c31(0x1c4)]&&(console[_0x540c31(0x1a3)](_0x540c31(0x1bb)+_0x501b97['site']),console[_0x540c31(0x1a3)](_0x540c31(0x1a2)+_0x41721c),_0x43451b&&console['error']('Target\x20resource:\x20'+_0x43451b));const _0x4f6b94=await withProgressSpinner(_0x540c31(0x19a)+_0x41721c+'\x27...',_0x38b40e=>_0x1dd6d3[_0x540c31(0x1ac)]['pullSegments'](_0x41721c,{'targetDir':_0x6e34c5,'targetResourceName':_0x43451b,'verbose':_0x501b97[_0x540c31(0x1c4)],'progress':{'update':_0x39bf0e=>{const _0x315f4d=_0x540c31;_0x38b40e['setPhase'](_0x39bf0e),_0x501b97[_0x315f4d(0x1c4)]&&console['error']('\x20\x20'+_0x39bf0e);}}}),{'verbose':_0x501b97['verbose']}),_0x46aad4=_0x4f6b94[_0x540c31(0x1d3)];if(_0x46aad4['counts'][_0x540c31(0x195)]===0x0&&_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x19b)]===0x0)return console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1e1)](_0x540c31(0x1b6)+_0x46aad4[_0x540c31(0x1b5)]+'\x27')),0x0;const _0x535df3=_0x46aad4[_0x540c31(0x1c5)]['filter'](_0x552c52=>_0x552c52[_0x540c31(0x1ce)]),_0x41be80=_0x46aad4[_0x540c31(0x1c5)]['filter'](_0x4f90db=>!_0x4f90db[_0x540c31(0x1ce)]&&_0x4f90db[_0x540c31(0x1be)]),_0x2f4e82=_0x46aad4[_0x540c31(0x1c5)][_0x540c31(0x1d9)](_0x4c2646=>!_0x4c2646['isNew']&&!_0x4c2646['hasChanges']);console[_0x540c31(0x1a3)](_0x540c31(0x1c1)+_0x46aad4['parentName']+'\x27:'),console[_0x540c31(0x1a3)](_0x540c31(0x19e)+a28_0x3752e5['cyan'](_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x195)]+_0x540c31(0x1a0))+'\x20with\x20'+a28_0x3752e5[_0x540c31(0x1a8)](_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x1a9)]+_0x540c31(0x1ae)));if(_0x46aad4[_0x540c31(0x1d4)]['journeys']>0x0){const _0x2c2c4e=_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x1b8)]>_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x19b)]?'\x20('+_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x1b8)]+_0x540c31(0x1cd):'';console['error'](_0x540c31(0x1bc)+a28_0x3752e5[_0x540c31(0x1a8)](_0x46aad4[_0x540c31(0x1d4)][_0x540c31(0x19b)]+'\x20journeys')+a28_0x3752e5[_0x540c31(0x1af)](_0x2c2c4e));}console[_0x540c31(0x1a3)]('\x20\x20'+a28_0x3752e5[_0x540c31(0x1b3)]('+\x20'+_0x535df3[_0x540c31(0x1cf)]+_0x540c31(0x1c9))),console[_0x540c31(0x1a3)]('\x20\x20'+a28_0x3752e5['yellow']('~\x20'+_0x41be80[_0x540c31(0x1cf)]+'\x20changed\x20files')),console[_0x540c31(0x1a3)]('\x20\x20'+a28_0x3752e5[_0x540c31(0x1af)]('=\x20'+_0x2f4e82['length']+_0x540c31(0x1d1))),console['error'](_0x540c31(0x1a5)+a28_0x3752e5[_0x540c31(0x1a8)](_0x46aad4[_0x540c31(0x1aa)])+'\x0a');if(_0x41be80[_0x540c31(0x1cf)]>0x0)for(const _0x1ac7d5 of _0x41be80){console[_0x540c31(0x1a3)](_0x540c31(0x1ad)+_0x1ac7d5[_0x540c31(0x1cb)]+'\x27:'),console[_0x540c31(0x1a3)]('─'[_0x540c31(0x1cc)](0x3c)),console['error'](_0x1ac7d5[_0x540c31(0x1b0)]),console[_0x540c31(0x1a3)]('─'[_0x540c31(0x1cc)](0x3c));}if(_0x501b97['dryRun'])return console['error'](a28_0x3752e5[_0x540c31(0x1e1)](_0x540c31(0x1dc))),0x0;if(_0x535df3[_0x540c31(0x1cf)]===0x0&&_0x41be80[_0x540c31(0x1cf)]===0x0)return console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1b3)](_0x540c31(0x1c3))),saveSessionContext({'parent_segment':_0x46aad4['parentName']},_0x501b97['session']),console['error'](a28_0x3752e5[_0x540c31(0x1b3)](_0x540c31(0x1d6)+a28_0x3752e5['dim'](_0x540c31(0x1d2))+_0x540c31(0x1a4)+a28_0x3752e5[_0x540c31(0x1a8)](_0x46aad4[_0x540c31(0x1b5)]))),0x0;if(!_0x501b97[_0x540c31(0x1de)]){const _0x55efc0=await confirmKey(_0x540c31(0x1c8)+(_0x535df3['length']+_0x41be80[_0x540c31(0x1cf)])+_0x540c31(0x196));if(!_0x55efc0)return console[_0x540c31(0x1a3)](_0x540c31(0x1ba)),0x1;}for(const _0x2b7949 of _0x46aad4[_0x540c31(0x1c5)]){if(_0x2b7949[_0x540c31(0x1ce)]||_0x2b7949['hasChanges']){const _0x5c6213=a28_0x47d1a8['dirname'](_0x2b7949[_0x540c31(0x19c)]);!existsSync(_0x5c6213)&&mkdirSync(_0x5c6213,{'recursive':!![]}),writeFileSync(_0x2b7949[_0x540c31(0x19c)],_0x2b7949[_0x540c31(0x1c2)],_0x540c31(0x1d0));}}return console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1b3)](_0x540c31(0x1da)+(_0x535df3[_0x540c31(0x1cf)]+_0x41be80['length'])+_0x540c31(0x1a1)+_0x46aad4['targetDir'])),saveSessionContext({'parent_segment':_0x46aad4[_0x540c31(0x1b5)]},_0x501b97[_0x540c31(0x19f)]),console[_0x540c31(0x1a3)](a28_0x3752e5[_0x540c31(0x1b3)](_0x540c31(0x1d6)+a28_0x3752e5['dim'](_0x540c31(0x1d2))+_0x540c31(0x1a4)+a28_0x3752e5[_0x540c31(0x1a8)](_0x46aad4['parentName']))),0x0;}}
1
+ const a28_0x464e79=a28_0x4e06;(function(_0x1270c3,_0x402b00){const _0xd56b52=a28_0x4e06,_0x2d97f5=_0x1270c3();while(!![]){try{const _0x53f2bc=parseInt(_0xd56b52(0xd3))/0x1*(-parseInt(_0xd56b52(0xa6))/0x2)+parseInt(_0xd56b52(0xa7))/0x3*(-parseInt(_0xd56b52(0xa2))/0x4)+parseInt(_0xd56b52(0xe5))/0x5*(parseInt(_0xd56b52(0xe0))/0x6)+parseInt(_0xd56b52(0xcf))/0x7*(-parseInt(_0xd56b52(0xd8))/0x8)+-parseInt(_0xd56b52(0xbe))/0x9*(-parseInt(_0xd56b52(0xda))/0xa)+parseInt(_0xd56b52(0xb9))/0xb+parseInt(_0xd56b52(0xc0))/0xc;if(_0x53f2bc===_0x402b00)break;else _0x2d97f5['push'](_0x2d97f5['shift']());}catch(_0x35aeca){_0x2d97f5['push'](_0x2d97f5['shift']());}}}(a28_0x2883,0x9be41));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';function a28_0x2883(){const _0x2dd613=['journeys','red','data','dim','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)','segment','Pulling\x20segments\x20from\x20\x27','10095118lOElBT','\x20unchanged\x20files','Error:\x20','hasChanges','cyan','1079127XMdaoz','no_parent','3698088kBrogb','repeat','error','Site:\x20','\x0aChanges\x20to\x20\x27','dirname','Target\x20resource:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20Target:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20segments','Aborted.','relativePath','\x20journeys','✔\x20Context\x20set:\x20','14PrvEfs','\x20with\x20','activations','files','11GwHUlI','resourceName','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','parent_segment','type','2862064dVcsgr','filter','10YLjjbG','journeyVersions','description','\x0aPull\x20summary\x20for\x20\x27','name','segments','6eisJXf','targetDir','yes','site','verbose','3833395NdzjzP','✔\x20Pulled\x20','errorCode','green','\x20=\x20','isNew','session','944gyJwyB','parentSegment','yellow','length','58046PnpRNI','5583jZbGOo','absolutePath','\x20files\x20to\x20','\x20\x20🗺️\x20\x20','parentName','\x20activations','\x20files?','\x20new\x20files','helpText','\x20versions)','counts'];a28_0x2883=function(){return _0x2dd613;};return a28_0x2883();}import a28_0x159601 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x91f806 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a28_0x4e06(_0x2ad3e2,_0x342383){_0x2ad3e2=_0x2ad3e2-0xa2;const _0x28831d=a28_0x2883();let _0x4e060d=_0x28831d[_0x2ad3e2];return _0x4e060d;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a28_0x464e79(0xde)]='segment:pull';[a28_0x464e79(0xdc)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async['execute'](_0x18cc40){const _0x47f93e=a28_0x464e79,{options:_0x57ae07,args:_0x283aff,tdx:_0x2aa7a3}=_0x18cc40,_0x2b6e7f=_0x57ae07,_0x2d20f6=await resolveTarget({'arg':_0x283aff[0x0],'contextParent':_0x57ae07[_0x47f93e(0xa3)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2d20f6))return _0x2d20f6[_0x47f93e(0xe7)]===_0x47f93e(0xbf)?(console[_0x47f93e(0xc2)](a28_0x159601[_0x47f93e(0xa4)](_0x47f93e(0xc7))),console[_0x47f93e(0xc2)](_0x47f93e(0xb6)),console[_0x47f93e(0xc2)](_0x47f93e(0xc9)),console['error'](_0x47f93e(0xd5))):(console[_0x47f93e(0xc2)](a28_0x159601[_0x47f93e(0xb3)](_0x47f93e(0xbb)+_0x2d20f6['message']+'\x0a')),_0x2d20f6[_0x47f93e(0xaf)]&&console[_0x47f93e(0xc2)](a28_0x159601['cyan'](_0x2d20f6[_0x47f93e(0xaf)]))),0x1;const _0x29c488=_0x2d20f6[_0x47f93e(0xab)],_0x1674e7=_0x2d20f6['targetDir'],_0x223bf6=_0x2d20f6[_0x47f93e(0xd7)]==='file'?_0x2d20f6[_0x47f93e(0xd4)]:undefined;_0x2b6e7f[_0x47f93e(0xe4)]&&(console['error'](_0x47f93e(0xc3)+_0x2b6e7f[_0x47f93e(0xe3)]),console[_0x47f93e(0xc2)]('Parent\x20segment:\x20'+_0x29c488),_0x223bf6&&console[_0x47f93e(0xc2)](_0x47f93e(0xc6)+_0x223bf6));const _0xce968=await withProgressSpinner(_0x47f93e(0xb8)+_0x29c488+'\x27...',_0x1a4c38=>_0x2aa7a3[_0x47f93e(0xb7)]['pullSegments'](_0x29c488,{'targetDir':_0x1674e7,'targetResourceName':_0x223bf6,'verbose':_0x2b6e7f['verbose'],'progress':{'update':_0x4b7899=>{const _0x44389e=_0x47f93e;_0x1a4c38['setPhase'](_0x4b7899),_0x2b6e7f[_0x44389e(0xe4)]&&console[_0x44389e(0xc2)]('\x20\x20'+_0x4b7899);}}}),{'verbose':_0x2b6e7f[_0x47f93e(0xe4)]}),_0x438bec=_0xce968[_0x47f93e(0xb4)];if(_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xdf)]===0x0&&_0x438bec['counts'][_0x47f93e(0xb2)]===0x0)return console['error'](a28_0x159601[_0x47f93e(0xa4)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x438bec['parentName']+'\x27')),0x0;const _0x56a5f9=_0x438bec[_0x47f93e(0xd2)][_0x47f93e(0xd9)](_0x33128a=>_0x33128a[_0x47f93e(0xea)]),_0x1df307=_0x438bec['files'][_0x47f93e(0xd9)](_0x2c1ec2=>!_0x2c1ec2[_0x47f93e(0xea)]&&_0x2c1ec2[_0x47f93e(0xbc)]),_0x8e4864=_0x438bec[_0x47f93e(0xd2)][_0x47f93e(0xd9)](_0x123513=>!_0x123513[_0x47f93e(0xea)]&&!_0x123513[_0x47f93e(0xbc)]);console['error'](_0x47f93e(0xdd)+_0x438bec[_0x47f93e(0xab)]+'\x27:'),console[_0x47f93e(0xc2)]('\x20\x20🎯\x20'+a28_0x159601[_0x47f93e(0xbd)](_0x438bec['counts'][_0x47f93e(0xdf)]+_0x47f93e(0xca))+_0x47f93e(0xd0)+a28_0x159601[_0x47f93e(0xbd)](_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xd1)]+_0x47f93e(0xac)));if(_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xb2)]>0x0){const _0x37e27a=_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xdb)]>_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xb2)]?'\x20('+_0x438bec[_0x47f93e(0xb1)][_0x47f93e(0xdb)]+_0x47f93e(0xb0):'';console[_0x47f93e(0xc2)](_0x47f93e(0xaa)+a28_0x159601['cyan'](_0x438bec['counts'][_0x47f93e(0xb2)]+_0x47f93e(0xcd))+a28_0x159601['dim'](_0x37e27a));}console[_0x47f93e(0xc2)]('\x20\x20'+a28_0x159601[_0x47f93e(0xe8)]('+\x20'+_0x56a5f9[_0x47f93e(0xa5)]+_0x47f93e(0xae))),console[_0x47f93e(0xc2)]('\x20\x20'+a28_0x159601['yellow']('~\x20'+_0x1df307[_0x47f93e(0xa5)]+'\x20changed\x20files')),console[_0x47f93e(0xc2)]('\x20\x20'+a28_0x159601[_0x47f93e(0xb5)]('=\x20'+_0x8e4864[_0x47f93e(0xa5)]+_0x47f93e(0xba))),console[_0x47f93e(0xc2)](_0x47f93e(0xc8)+a28_0x159601[_0x47f93e(0xbd)](_0x438bec[_0x47f93e(0xe1)])+'\x0a');if(_0x1df307['length']>0x0)for(const _0x2c714c of _0x1df307){console[_0x47f93e(0xc2)](_0x47f93e(0xc4)+_0x2c714c[_0x47f93e(0xcc)]+'\x27:'),console['error']('─'[_0x47f93e(0xc1)](0x3c)),console[_0x47f93e(0xc2)](_0x2c714c['diff']),console[_0x47f93e(0xc2)]('─'[_0x47f93e(0xc1)](0x3c));}if(_0x2b6e7f['dryRun'])return console[_0x47f93e(0xc2)](a28_0x159601[_0x47f93e(0xa4)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x56a5f9[_0x47f93e(0xa5)]===0x0&&_0x1df307[_0x47f93e(0xa5)]===0x0)return console['error'](a28_0x159601['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x438bec[_0x47f93e(0xab)]},_0x2b6e7f[_0x47f93e(0xeb)]),console[_0x47f93e(0xc2)](a28_0x159601['green'](_0x47f93e(0xce)+a28_0x159601[_0x47f93e(0xb5)](_0x47f93e(0xd6))+_0x47f93e(0xe9)+a28_0x159601[_0x47f93e(0xbd)](_0x438bec[_0x47f93e(0xab)]))),0x0;if(!_0x2b6e7f[_0x47f93e(0xe2)]){const _0x3327e1=await confirmKey('Write\x20'+(_0x56a5f9[_0x47f93e(0xa5)]+_0x1df307[_0x47f93e(0xa5)])+_0x47f93e(0xad));if(!_0x3327e1)return console[_0x47f93e(0xc2)](_0x47f93e(0xcb)),0x1;}for(const _0x2f5ffe of _0x438bec['files']){if(_0x2f5ffe[_0x47f93e(0xea)]||_0x2f5ffe[_0x47f93e(0xbc)]){const _0x4ab9e3=a28_0x91f806[_0x47f93e(0xc5)](_0x2f5ffe[_0x47f93e(0xa8)]);!existsSync(_0x4ab9e3)&&mkdirSync(_0x4ab9e3,{'recursive':!![]}),writeFileSync(_0x2f5ffe['absolutePath'],_0x2f5ffe['content'],'utf-8');}}return console[_0x47f93e(0xc2)](a28_0x159601[_0x47f93e(0xe8)](_0x47f93e(0xe6)+(_0x56a5f9['length']+_0x1df307['length'])+_0x47f93e(0xa9)+_0x438bec[_0x47f93e(0xe1)])),saveSessionContext({'parent_segment':_0x438bec[_0x47f93e(0xab)]},_0x2b6e7f[_0x47f93e(0xeb)]),console['error'](a28_0x159601[_0x47f93e(0xe8)](_0x47f93e(0xce)+a28_0x159601[_0x47f93e(0xb5)](_0x47f93e(0xd6))+'\x20=\x20'+a28_0x159601[_0x47f93e(0xbd)](_0x438bec[_0x47f93e(0xab)]))),0x0;}}
@@ -1 +1 @@
1
- const a29_0x3cf4a0=a29_0x5000;(function(_0x1c53b2,_0x183157){const _0x2e2ab2=a29_0x5000,_0x46a5ff=_0x1c53b2();while(!![]){try{const _0x5a4ccc=parseInt(_0x2e2ab2(0x96))/0x1+parseInt(_0x2e2ab2(0x10f))/0x2*(-parseInt(_0x2e2ab2(0xc0))/0x3)+-parseInt(_0x2e2ab2(0xec))/0x4*(parseInt(_0x2e2ab2(0xdd))/0x5)+parseInt(_0x2e2ab2(0xad))/0x6+parseInt(_0x2e2ab2(0xf3))/0x7+-parseInt(_0x2e2ab2(0xd5))/0x8+parseInt(_0x2e2ab2(0x9c))/0x9;if(_0x5a4ccc===_0x183157)break;else _0x46a5ff['push'](_0x46a5ff['shift']());}catch(_0x46b031){_0x46a5ff['push'](_0x46a5ff['shift']());}}}(a29_0x5326,0x8ad44));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';function a29_0x5000(_0x4748cd,_0x231140){_0x4748cd=_0x4748cd-0x85;const _0x53260d=a29_0x5326();let _0x500027=_0x53260d[_0x4748cd];return _0x500027;}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';function a29_0x5326(){const _0x78d223=['cyan','\x20to\x20update','listJourneysWithDetailsFromParentSegment','908626RhnXNu','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20folders\x20to\x20create','relationships','setPhase','parentName','\x20\x20Journeys:\x20','Delete\x20journey:','Fetching\x20existing\x20segments...','\x20to\x20delete','Aborted.','\x20created','Error:\x20','data','Scoped\x20to\x20folder:\x20','changed','\x20deleted','no_parent','red','segments','yellow','toUpdate','\x20YAML\x20files\x20found','.yaml','targetDir','nameToId','Changes\x20to:','isNew','577008WJNQIh','journeyBundleId','add','parent_name','\x20\x20📊\x20Segments:','repeat','1004904fUociK','journeyBundleName','\x20unchanged','toDelete','\x20changed','file','set','verbose','Fetching\x20existing\x20journeys...','\x20\x20Activations:','yes','idToName','Delete\x20segment:','getParent','toCreate','createdAt','\x20\x20Segments:\x20','6690720PWtdDb','site','dim','existingJourney','listSegments','then','description','Error\x20parsing\x20YAML:\x20','Error:\x20Directory\x20not\x20found:\x20','folderId','diff','state','filter','New\x20journey:','updated','/app/ps/','Push\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','green','6VAOcOj','activations','Fetching\x20connections\x20for\x20name\x20resolution...','segment:push','\x20new','get','Site:\x20','segmentFolderId','error','message','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','endsWith','unchanged','join','helpText','\x20activations]','📁\x20','deleted','delete','push','\x20\x20Source:\x20','6250632DOnGRA','dryRun','errorCode','\x20updated','yamlConfig','folderPath','getJourney','/j/da/je','16065KcIIYz','audienceId','folders','new','No\x20','filePath','updatedAt','buildUserMaps','parentSegment','journeysOnly','name','all','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','segment','connection','68yiOLvS','Fetching\x20parent\x20segment\x20details...','toString','type','Fetching\x20existing\x20folders...','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','results','3566052zwjgiN','Fetching\x20users\x20for\x20email\x20resolution...','\x0aValidation\x20failed:','(Journey\x20will\x20be\x20deleted)','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','blue','map','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','/e/','New\x20segment:','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','journeys','resolveParentId','created','createdSegmentIds','attributes','\x20\x20\x20\x20','\x0aPush\x20summary\x20for\x20\x27','\x20\x20Activations:\x20','length','journeyId','Folders\x20to\x20create:','journey','listFolders','versionNumber'];a29_0x5326=function(){return _0x78d223;};return a29_0x5326();}import a29_0x1bb08c from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a29_0x3cf4a0(0xc3);[a29_0x3cf4a0(0xb3)]=a29_0x3cf4a0(0xf1);async['execute'](_0x10ed41){const _0x22d723=a29_0x3cf4a0,{options:_0x2411ea,args:_0x306b11,tdx:_0x552f9b}=_0x10ed41,_0x359a36=_0x2411ea,_0x27fca0=await resolveTarget({'arg':_0x306b11[0x0],'contextParent':_0x2411ea[_0x22d723(0xe5)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x27fca0))return _0x27fca0[_0x22d723(0xd7)]===_0x22d723(0x8b)?(console['error'](a29_0x1bb08c[_0x22d723(0x8e)](_0x22d723(0xfa))),console[_0x22d723(0xc8)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x22d723(0xc8)]('\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[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0x86)+_0x27fca0[_0x22d723(0xc9)]+'\x0a')),_0x27fca0['helpText']&&console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x10c)](_0x27fca0[_0x22d723(0xce)]))),0x1;if(_0x27fca0[_0x22d723(0xef)]===_0x22d723(0x99))return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xb5)+_0x27fca0[_0x22d723(0x92)]+'\x0a')),console['error'](a29_0x1bb08c['cyan'](_0x22d723(0xbe))),0x1;const _0x31f66b=_0x27fca0[_0x22d723(0x115)],_0x11dad0=_0x27fca0[_0x22d723(0x92)],_0x5ba0fe=_0x27fca0['type']===_0x22d723(0xa1)?_0x27fca0[_0x22d723(0xe2)]:undefined,_0x55994f=getScopedDetails(_0x27fca0),_0x2edbce=_0x55994f?.['isScoped']??![],_0x492019=_0x55994f?.['scopedFolderPath']??'';if(!existsSync(_0x11dad0))return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xb5)+_0x11dad0+'\x0a')),console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x10c)](_0x22d723(0xbe))),0x1;_0x359a36[_0x22d723(0xa3)]&&(console[_0x22d723(0xc8)](_0x22d723(0xc6)+_0x359a36[_0x22d723(0xae)]),console[_0x22d723(0xc8)]('Parent\x20segment:\x20'+_0x31f66b),console[_0x22d723(0xc8)]('Source\x20directory:\x20'+_0x11dad0),_0x2edbce&&console['error'](_0x22d723(0x88)+_0x492019));const _0x2781c1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31f66b+'\x27...',()=>_0x552f9b[_0x22d723(0xea)][_0x22d723(0xff)](_0x31f66b),{'verbose':_0x359a36[_0x22d723(0xa3)]}),_0x352506=_0x2781c1[_0x22d723(0x87)],[_0x36831e,_0x4df887,_0x4b2223,_0xa9ccdf,_0x1b645e]=await Promise['all']([withSpinner(_0x22d723(0xed),()=>_0x552f9b[_0x22d723(0xea)][_0x22d723(0xa9)](_0x352506),{'verbose':_0x359a36[_0x22d723(0xa3)]}),withSpinner(_0x22d723(0x118),()=>_0x552f9b[_0x22d723(0xea)][_0x22d723(0xb1)](_0x352506),{'verbose':_0x359a36[_0x22d723(0xa3)]}),withSpinner(_0x22d723(0xf0),()=>_0x552f9b[_0x22d723(0xea)][_0x22d723(0x10a)](_0x352506),{'verbose':_0x359a36[_0x22d723(0xa3)]}),withSpinner(_0x22d723(0xa4),()=>_0x552f9b['journey'][_0x22d723(0x10e)](_0x352506,{'includeAllVersions':!![]}),{'verbose':_0x359a36[_0x22d723(0xa3)]}),withSpinner(_0x22d723(0xf4),()=>_0x552f9b['user'][_0x22d723(0xe4)](),{'verbose':_0x359a36[_0x22d723(0xa3)]})[_0x22d723(0xb2)](_0x51b165=>_0x51b165[_0x22d723(0x87)])]),_0x3e74cf=_0x36831e[_0x22d723(0x87)],_0x2cd532=extractRootFolderId(_0x3e74cf),_0xbd835b=_0x4df887[_0x22d723(0x87)],_0x18194e=_0x4b2223['data'],{journeys:_0xa2d9c4,activationStepsById:_0x49d4b4}=_0xa9ccdf[_0x22d723(0x87)],_0x179714=new Map(_0xa2d9c4[_0x22d723(0xf9)](_0x1e5ff=>[_0x1e5ff['id'],_0x1e5ff])),_0x5567e5=_0xa2d9c4[_0x22d723(0xf9)](_0x229026=>({'id':_0x229026['id'],'name':_0x229026[_0x22d723(0x102)][_0x22d723(0xe7)],'journeyBundleName':_0x229026[_0x22d723(0x102)][_0x22d723(0x9d)]||'','journeyBundleId':_0x229026[_0x22d723(0x102)][_0x22d723(0x97)]||'','versionNumber':_0x229026['attributes'][_0x22d723(0x10b)],'description':_0x229026[_0x22d723(0x102)][_0x22d723(0xb3)],'state':_0x229026[_0x22d723(0x102)][_0x22d723(0xb8)],'paused':_0x229026[_0x22d723(0x102)]['paused'],'audienceId':_0x229026[_0x22d723(0x102)][_0x22d723(0xde)],'folderId':_0x229026[_0x22d723(0x113)]?.['parentFolder']?.[_0x22d723(0x87)]?.['id'],'createdAt':_0x229026[_0x22d723(0x102)][_0x22d723(0xab)],'updatedAt':_0x229026[_0x22d723(0x102)][_0x22d723(0xe3)]})),{emailToId:_0x24e70e,idToEmail:_0x3c3d64}=_0x1b645e,_0x3f3978=await withSpinner(_0x22d723(0xc2),async()=>{const _0x58b4a4=_0x22d723,_0x5b0848=await _0x552f9b[_0x58b4a4(0xeb)]['list']();return buildConnectionMaps(_0x5b0848);},{'verbose':_0x359a36['verbose']})[_0x22d723(0xb2)](_0x379514=>_0x379514[_0x22d723(0x87)]),_0x18de74=_0x3f3978[_0x22d723(0x93)],_0x530b29=_0x3f3978[_0x22d723(0xa7)],_0x3f6071=_0x3f3978['nameToType'],_0x388e84={'emailToIdMap':_0x24e70e,'connectionNameToIdMap':_0x18de74,'connectionNameToTypeMap':_0x3f6071,'getSchema':_0x446915=>_0x552f9b[_0x22d723(0xeb)]['getOutputSchemaWithCache'](_0x446915)};let {pathToId:_0x36b6b3,idToPath:_0x3cce08}=buildFolderMaps(_0x18194e);const _0x159caa=buildSegmentLookupMap(_0xbd835b,_0x3cce08),_0x8459e6=buildSegmentNameToIdMap(_0xbd835b),_0x4c2c33=buildJourneyBundleLookupMap(_0x5567e5,_0x3cce08);let _0x3a0375;if(_0x5ba0fe){if(!_0x5ba0fe[_0x22d723(0xcb)]('.yml')&&!_0x5ba0fe[_0x22d723(0xcb)](_0x22d723(0x91)))return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xfd)+_0x5ba0fe+'\x0a')),0x1;_0x3a0375=[_0x5ba0fe];}else _0x3a0375=findYamlFiles(_0x11dad0);if(_0x3a0375['length']===0x0)return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x11dad0+'\x0a')),console['error'](a29_0x1bb08c[_0x22d723(0x10c)](_0x22d723(0x111))),0x1;let _0xc386c8,_0x11a5e6;try{const _0x53d055=parseAndClassifyYamlFiles(_0x3a0375,_0x11dad0,{'skipSegments':_0x359a36[_0x22d723(0xe6)]});_0xc386c8=_0x53d055[_0x22d723(0x8d)],_0x11a5e6=_0x53d055['journeys'];const _0x3c0ba3=validateParsedFiles(_0x53d055,_0x11dad0);if(_0x3c0ba3['length']>0x0)return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xf5))),console[_0x22d723(0xc8)](formatValidationErrors(_0x3c0ba3)),console['error'](a29_0x1bb08c[_0x22d723(0x8e)](_0x22d723(0x110))),0x1;}catch(_0x56101b){return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xb4)+(_0x56101b instanceof Error?_0x56101b[_0x22d723(0xc9)]:_0x56101b))),0x1;}if(_0xc386c8[_0x22d723(0x106)]===0x0&&_0x11a5e6[_0x22d723(0x106)]===0x0){const _0x53ce43=_0x359a36[_0x22d723(0xe6)]?_0x22d723(0x109):'segment\x20or\x20journey';return console[_0x22d723(0xc8)](a29_0x1bb08c['yellow'](_0x22d723(0xe1)+_0x53ce43+_0x22d723(0x90))),0x0;}const _0x564065=new Map();_0xbd835b[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xe6)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0xbd835b,async _0x392b05=>{const _0x6b7a03=a29_0x5000,_0x5e6f09=await _0x552f9b[_0x6b7a03(0xea)]['listActivations'](_0x352506,_0x392b05['id']);_0x564065['set'](_0x392b05['id'],_0x5e6f09);});},{'verbose':_0x359a36[_0x22d723(0xa3)]});const {segmentFiles:_0x2741a1,foldersToCreate:_0x7403f}=await prepareSegmentFiles(_0xc386c8,{'segmentByFolderAndName':_0x159caa,'activationsBySegmentId':_0x564065,'folderPathToId':_0x36b6b3,'idToEmailMap':_0x3c3d64,'connectionIdToNameMap':_0x530b29},_0x388e84,_0x2edbce,_0x492019),_0x481e4b=_0x5ba0fe?[]:findSegmentsToDelete(_0xbd835b,_0xc386c8[_0x22d723(0xf9)](({yamlConfig:_0x12c4b7,folderPath:_0x271810})=>({'yamlConfig':_0x12c4b7,'folderPath':resolveTDFolderPath(_0x271810,_0x2edbce,_0x492019)})),_0x3cce08,_0x492019,_0x2edbce),{journeyFiles:_0x5b3fa0,foldersToCreate:_0x314a85}=await withProgressSpinner('Preparing\x20journeys...',async _0x3cfe59=>prepareJourneyFiles(_0x11a5e6,{'fetchJourney':async _0x4ac996=>_0x552f9b['journey'][_0x22d723(0xdb)](_0x4ac996[_0x22d723(0x107)]),'journeyBundlesByFolderAndName':_0x4c2c33,'folderPathToId':_0x36b6b3,'idToEmailMap':_0x3c3d64,'connectionIdToNameMap':_0x530b29,'existingSegments':_0xbd835b,'parentId':_0x352506,'deps':_0x552f9b,'progress':{'update':_0x378cf7=>{const _0x62d05d=_0x22d723;_0x3cfe59[_0x62d05d(0x114)](_0x378cf7),_0x359a36[_0x62d05d(0xa3)]&&console[_0x62d05d(0xc8)]('\x20\x20'+_0x378cf7);}},'journeyById':_0x179714,'activationStepsById':_0x49d4b4},_0x2edbce,_0x492019),{'verbose':_0x359a36[_0x22d723(0xa3)]})[_0x22d723(0xb2)](_0x881af7=>_0x881af7[_0x22d723(0x87)]);for(const _0x1326e4 of _0x314a85){_0x7403f[_0x22d723(0x98)](_0x1326e4);}const _0x5fcd8d=_0x5ba0fe?[]:findJourneysToDelete(_0x5567e5,_0x11a5e6[_0x22d723(0xf9)](({yamlConfig:_0x35a973,folderPath:_0xe4467e})=>({'yamlConfig':_0x35a973,'folderPath':resolveTDFolderPath(_0xe4467e,_0x2edbce,_0x492019)})),_0x3cce08,_0x492019,_0x2edbce),_0x3f6761=calculatePushStats(_0x2741a1,_0x5b3fa0,_0x7403f,_0x481e4b,_0x5fcd8d,!!_0x359a36[_0x22d723(0xd2)],!!_0x359a36[_0x22d723(0xe6)]),_0x5e23f8=_0x3f6761['segments'][_0x22d723(0xe0)],_0x3f5911=_0x3f6761[_0x22d723(0x8d)]['changed'],_0x3f6346=_0x3f6761[_0x22d723(0x8d)]['unchanged'],_0x29f518=_0x3f6761[_0x22d723(0x8d)][_0x22d723(0x9f)],_0xf09887=_0x3f6761[_0x22d723(0xdf)]['toCreate'],_0x38c0d5=_0x3f6761[_0x22d723(0xfe)][_0x22d723(0xe0)],_0x2aa424=_0x3f6761[_0x22d723(0xfe)][_0x22d723(0x89)],_0x45a8a2=_0x3f6761[_0x22d723(0xfe)][_0x22d723(0xcc)],_0x491338=_0x3f6761[_0x22d723(0xfe)][_0x22d723(0x9f)],_0x4b2f92=_0x3f6761[_0x22d723(0xc1)][_0x22d723(0xe8)],_0x49d7da=_0x3f6761[_0x22d723(0xc1)][_0x22d723(0xaa)],_0x51fb1a=_0x3f6761[_0x22d723(0xc1)][_0x22d723(0x8f)],_0x977554=_0x3f6761['activations'][_0x22d723(0x9f)];console[_0x22d723(0xc8)](_0x22d723(0x104)+_0x31f66b+'\x27:');_0xf09887[_0x22d723(0x106)]>0x0&&console[_0x22d723(0xc8)]('\x20\x20'+a29_0x1bb08c[_0x22d723(0xf8)](_0x22d723(0xd0)+_0xf09887[_0x22d723(0x106)]+_0x22d723(0x112)));if(!_0x359a36[_0x22d723(0xe6)]){console['error'](_0x22d723(0x9a)),console[_0x22d723(0xc8)]('\x20\x20\x20\x20'+a29_0x1bb08c[_0x22d723(0xbf)]('+\x20'+_0x5e23f8[_0x22d723(0x106)]+'\x20new')),console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c['yellow']('~\x20'+_0x3f5911[_0x22d723(0x106)]+_0x22d723(0xa0)));if(_0x29f518['length']>0x0)console['error']('\x20\x20\x20\x20'+a29_0x1bb08c[_0x22d723(0x8c)]('-\x20'+_0x29f518[_0x22d723(0x106)]+_0x22d723(0x119)));else _0x481e4b[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xd2)]&&console['error'](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0xaf)](_0x481e4b[_0x22d723(0x106)]+_0x22d723(0xe9)));console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0xaf)]('=\x20'+_0x3f6346[_0x22d723(0x106)]+_0x22d723(0x9e)));}if(_0x5b3fa0[_0x22d723(0x106)]>0x0||_0x5fcd8d[_0x22d723(0x106)]>0x0){console['error']('\x20\x20🗺️\x20\x20Journeys:'),console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0xbf)]('+\x20'+_0x38c0d5[_0x22d723(0x106)]+_0x22d723(0xc4))),console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c['yellow']('~\x20'+_0x2aa424[_0x22d723(0x106)]+_0x22d723(0xa0)));if(_0x491338[_0x22d723(0x106)]>0x0)console[_0x22d723(0xc8)]('\x20\x20\x20\x20'+a29_0x1bb08c[_0x22d723(0x8c)]('-\x20'+_0x491338['length']+_0x22d723(0x119)));else _0x5fcd8d[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xd2)]&&console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0xaf)](_0x5fcd8d[_0x22d723(0x106)]+_0x22d723(0xe9)));console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c['dim']('=\x20'+_0x45a8a2[_0x22d723(0x106)]+_0x22d723(0x9e)));}_0x4b2f92['length']>0x0&&!_0x359a36['journeysOnly']&&(console[_0x22d723(0xc8)](''),console[_0x22d723(0xc8)](_0x22d723(0xa5)),_0x49d7da['length']>0x0&&console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0xbf)]('+\x20'+_0x49d7da['length']+'\x20to\x20create')),_0x51fb1a['length']>0x0&&console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c[_0x22d723(0x8e)]('~\x20'+_0x51fb1a[_0x22d723(0x106)]+_0x22d723(0x10d))),_0x977554[_0x22d723(0x106)]>0x0&&console[_0x22d723(0xc8)](_0x22d723(0x103)+a29_0x1bb08c['red']('-\x20'+_0x977554[_0x22d723(0x106)]+_0x22d723(0x119))));console[_0x22d723(0xc8)](_0x22d723(0xd4)+a29_0x1bb08c[_0x22d723(0x10c)](_0x11dad0)+'\x0a');if(_0xf09887[_0x22d723(0x106)]>0x0){console['error'](_0x22d723(0x108));for(const _0x2a0507 of _0xf09887){console['error']('\x20\x20'+a29_0x1bb08c[_0x22d723(0xf8)]('+')+'\x20'+_0x2a0507);}console[_0x22d723(0xc8)]('');}if(_0x5e23f8['length']>0x0&&!_0x359a36['journeysOnly'])for(const _0x48ff4c of _0x5e23f8){const _0x4e6e80=_0x48ff4c[_0x22d723(0xda)]?_0x48ff4c[_0x22d723(0xda)]+'/'+_0x48ff4c[_0x22d723(0xd9)][_0x22d723(0xe7)]:_0x48ff4c[_0x22d723(0xd9)][_0x22d723(0xe7)],_0x5eb2ab=_0x48ff4c[_0x22d723(0xd9)]['activations']?.[_0x22d723(0x106)]||0x0,_0x29bbe5=_0x5eb2ab>0x0?a29_0x1bb08c[_0x22d723(0xaf)]('\x20['+_0x5eb2ab+_0x22d723(0xcf)):'';console[_0x22d723(0xc8)]('\x0a'+a29_0x1bb08c[_0x22d723(0xbf)](_0x22d723(0xfc))+'\x20'+_0x4e6e80+_0x29bbe5),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c)),_0x48ff4c['diff']&&console[_0x22d723(0xc8)](_0x48ff4c[_0x22d723(0xb7)]),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c));}if(_0x29f518[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xe6)])for(const _0x242f61 of _0x29f518){const _0x9f06db=_0x242f61[_0x22d723(0xc7)]?_0x3cce08['get'](_0x242f61[_0x22d723(0xc7)][_0x22d723(0xee)]())||'':'',_0xdc371d=_0x9f06db?_0x9f06db+'/'+_0x242f61[_0x22d723(0xe7)]:_0x242f61[_0x22d723(0xe7)],_0x504256=_0x564065[_0x22d723(0xc5)](_0x242f61['id'])||[],_0x4eebbb=_0x504256[_0x22d723(0x106)]>0x0?a29_0x1bb08c[_0x22d723(0xaf)]('\x20['+_0x504256['length']+_0x22d723(0xcf)):'';console[_0x22d723(0xc8)]('\x0a'+a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0xa8))+'\x20'+_0xdc371d+_0x4eebbb),console['error']('─'['repeat'](0x3c));const _0x35feb2=segmentWithActivationsToYaml(_0x242f61,_0x504256,undefined,_0x3c3d64,_0x530b29),_0x2c2a4e=segmentToYamlString(_0x35feb2),_0x1f2825=generateDiff(_0x2c2a4e,'');console[_0x22d723(0xc8)](formatDiffWithColors(_0x1f2825)),console['error']('─'[_0x22d723(0x9b)](0x3c));}const _0x358ae9=_0x2741a1[_0x22d723(0xb9)](_0x534877=>!_0x534877[_0x22d723(0x95)]&&_0x534877[_0x22d723(0xb7)]);if(_0x358ae9[_0x22d723(0x106)]>0x0&&!_0x359a36['journeysOnly'])for(const _0x2e7769 of _0x358ae9){const _0x440187=_0x2e7769[_0x22d723(0xda)]?_0x2e7769[_0x22d723(0xda)]+'/'+_0x2e7769[_0x22d723(0xd9)][_0x22d723(0xe7)]:_0x2e7769[_0x22d723(0xd9)]['name'];console[_0x22d723(0xc8)]('\x0a'+a29_0x1bb08c[_0x22d723(0x8e)](_0x22d723(0x94))+'\x20'+_0x440187),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c)),console[_0x22d723(0xc8)](_0x2e7769['diff']),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c));}if(_0x38c0d5['length']>0x0)for(const _0x15f5ab of _0x38c0d5){const _0x55f766=_0x15f5ab['folderPath']?_0x15f5ab['folderPath']+'/'+_0x15f5ab[_0x22d723(0xd9)][_0x22d723(0xe7)]:_0x15f5ab[_0x22d723(0xd9)][_0x22d723(0xe7)];console[_0x22d723(0xc8)]('\x0a'+a29_0x1bb08c[_0x22d723(0xbf)](_0x22d723(0xba))+'\x20'+_0x55f766),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c)),_0x15f5ab[_0x22d723(0xb7)]&&console[_0x22d723(0xc8)](_0x15f5ab[_0x22d723(0xb7)]),console[_0x22d723(0xc8)]('─'['repeat'](0x3c));}const _0x25f582=_0x5b3fa0[_0x22d723(0xb9)](_0x2e81a4=>!_0x2e81a4[_0x22d723(0x95)]&&_0x2e81a4['diff']);if(_0x25f582[_0x22d723(0x106)]>0x0)for(const _0x24e6c1 of _0x25f582){const _0x177962=_0x24e6c1['folderPath']?_0x24e6c1['folderPath']+'/'+_0x24e6c1[_0x22d723(0xd9)][_0x22d723(0xe7)]:_0x24e6c1['yamlConfig'][_0x22d723(0xe7)];console['error']('\x0a'+a29_0x1bb08c['yellow']('Changes\x20to\x20journey:')+'\x20'+_0x177962),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c)),console['error'](_0x24e6c1['diff']),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c));}if(_0x491338['length']>0x0)for(const _0x96658d of _0x491338){const _0x38cd32=_0x96658d[_0x22d723(0xb6)]?_0x3cce08['get'](_0x96658d['folderId'])||'':'',_0x4f542d=_0x38cd32?_0x38cd32+'/'+_0x96658d[_0x22d723(0x9d)]:_0x96658d[_0x22d723(0x9d)];console[_0x22d723(0xc8)]('\x0a'+a29_0x1bb08c[_0x22d723(0x8c)](_0x22d723(0x117))+'\x20'+_0x4f542d),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c)),console[_0x22d723(0xc8)](a29_0x1bb08c['red'](_0x22d723(0xf6))),console[_0x22d723(0xc8)]('─'[_0x22d723(0x9b)](0x3c));}if(_0x359a36[_0x22d723(0xd6)])return console['error'](a29_0x1bb08c['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x4a6d92=_0x359a36[_0x22d723(0xe6)]?![]:_0x5e23f8['length']>0x0||_0x3f5911[_0x22d723(0x106)]>0x0||_0x29f518[_0x22d723(0x106)]>0x0,_0x40f6c3=_0x38c0d5['length']>0x0||_0x2aa424[_0x22d723(0x106)]>0x0||_0x491338['length']>0x0,_0x1e8dc1=_0x359a36['journeysOnly']?![]:_0x4b2f92[_0x22d723(0x106)]>0x0,_0x1c87e2=_0xf09887[_0x22d723(0x106)]>0x0;if(!_0x4a6d92&&!_0x40f6c3&&!_0x1e8dc1&&!_0x1c87e2){const _0x1f4b53=_0x359a36['journeysOnly']?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x22d723(0xf7);console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0xbf)](_0x1f4b53));if(_0x5ba0fe&&_0x45a8a2[_0x22d723(0x106)]===0x1){const _0x4079a6=_0x45a8a2[0x0];if(_0x4079a6[_0x22d723(0xb0)]?.['id']){const _0x109cc4=getConsoleNextUrl(_0x359a36['site'],'/app/ps/'+_0x352506+'/e/'+_0x4079a6[_0x22d723(0xb0)]['id']+_0x22d723(0xdc));console[_0x22d723(0xc8)]('\x20\x20'+a29_0x1bb08c[_0x22d723(0x10c)](_0x109cc4));}}return 0x0;}const _0x18831c=_0x359a36[_0x22d723(0xe6)]?_0x38c0d5[_0x22d723(0x106)]+_0x2aa424[_0x22d723(0x106)]+_0x491338[_0x22d723(0x106)]+_0xf09887[_0x22d723(0x106)]:_0x5e23f8[_0x22d723(0x106)]+_0x3f5911['length']+_0x29f518[_0x22d723(0x106)]+_0x38c0d5[_0x22d723(0x106)]+_0x2aa424['length']+_0x491338[_0x22d723(0x106)]+_0xf09887[_0x22d723(0x106)]+_0x4b2f92[_0x22d723(0x106)];if(!_0x359a36[_0x22d723(0xa6)]&&_0x18831c>0x0){const _0x44531a=await confirmKey(_0x22d723(0xbd)+_0x18831c+'\x20changes?');if(!_0x44531a)return console[_0x22d723(0xc8)](_0x22d723(0x11a)),0x1;}const _0x52c60c={'withProgress':async(_0x1bc85c,_0x84673b)=>{const _0x19dcfe=_0x22d723,_0x2ee8ab=await withSpinner(_0x1bc85c,_0x84673b,{'verbose':_0x359a36[_0x19dcfe(0xa3)]});return{'data':_0x2ee8ab[_0x19dcfe(0x87)]};},'logInfo':_0x7231cd=>console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0xf8)]('✔\x20'+_0x7231cd)),'logSuccess':_0x9d7bdc=>console['error'](a29_0x1bb08c[_0x22d723(0xbf)]('✔\x20'+_0x9d7bdc)),'logWarning':_0x25787b=>console[_0x22d723(0xc8)](a29_0x1bb08c['yellow']('⚠\x20'+_0x25787b)),'logDeleted':_0x681598=>console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0x8c)]('✔\x20'+_0x681598))},_0x34948b={'segment':_0x552f9b[_0x22d723(0xea)],'journey':_0x552f9b[_0x22d723(0x109)],'user':_0x552f9b['user'],'connection':_0x552f9b[_0x22d723(0xeb)]};_0xf09887['length']>0x0&&(_0x36b6b3=await executePushFolders(_0x34948b,_0xf09887,_0x36b6b3,{'parentId':_0x352506},_0x52c60c));const _0x2e655d={'rootFolderId':_0x2cd532,'folderPathToId':_0x36b6b3,'folderIdToPath':_0x3cce08,'segmentNameToId':_0x8459e6,'activationsBySegmentId':_0x564065,'emailToIdMap':_0x24e70e,'idToEmailMap':_0x3c3d64,'connectionNameToIdMap':_0x3f3978[_0x22d723(0x93)],'connectionIdToNameMap':_0x3f3978[_0x22d723(0xa7)],'connectionNameToTypeMap':_0x3f6071},_0xbecc56=await executePushSegments(_0x34948b,_0x359a36[_0x22d723(0xe6)]?[]:_0x2741a1,_0x2e655d,{'parentId':_0x352506},_0x52c60c),_0x4c46e0=_0xbecc56[_0x22d723(0x100)],_0x4e35dc=_0xbecc56[_0x22d723(0xbb)],_0x5bbea8=_0xbecc56[_0x22d723(0xc1)][_0x22d723(0x100)],_0x2788d9=_0xbecc56[_0x22d723(0xc1)][_0x22d723(0xbb)],_0x14ac4b=_0xbecc56[_0x22d723(0xc1)][_0x22d723(0xd1)],_0x33583a=await executePushSegmentDeletions(_0x34948b,_0x359a36['journeysOnly']?[]:_0x29f518,_0x52c60c);let _0x364ced=0x0,_0x28f590=0x0,_0x4029de=0x0;const _0x5e7223=new Map(_0x8459e6);for(const [_0x44dbb6,_0x52ad45]of _0xbecc56[_0x22d723(0x101)]){_0x5e7223[_0x22d723(0xa2)](_0x44dbb6,_0x52ad45);}if(_0x5b3fa0['length']>0x0){const _0xcd370c={..._0x2e655d,'segmentNameToId':_0x5e7223,'existingSegments':_0xbd835b,'activationContext':_0x388e84},_0x4780df=await executePushJourneys(_0x34948b,_0x5b3fa0,_0xcd370c,{'parentId':_0x352506,'rootFolderId':_0x2cd532,'verbose':_0x359a36[_0x22d723(0xa3)]},_0x52c60c);_0x364ced=_0x4780df['created'],_0x28f590=_0x4780df['updated'];if(_0x5ba0fe&&_0x4780df[_0x22d723(0xf2)][_0x22d723(0x106)]===0x1){const _0x19f99e=_0x4780df[_0x22d723(0xf2)][0x0];if(_0x19f99e['journeyId']){const _0x3b69a3=getConsoleNextUrl(_0x359a36[_0x22d723(0xae)],_0x22d723(0xbc)+_0x352506+_0x22d723(0xfb)+_0x19f99e[_0x22d723(0x107)]+_0x22d723(0xdc));console[_0x22d723(0xc8)]('\x20\x20'+a29_0x1bb08c[_0x22d723(0x10c)](_0x3b69a3));}}}for(const _0x5134eb of _0x491338){console['error'](a29_0x1bb08c[_0x22d723(0x8e)](_0x22d723(0xca)+_0x5134eb[_0x22d723(0x9d)])),_0x4029de++;}const _0x1045d7=[];if(_0x4c46e0>0x0)_0x1045d7[_0x22d723(0xd3)](_0x4c46e0+_0x22d723(0x85));if(_0x4e35dc>0x0)_0x1045d7['push'](_0x4e35dc+_0x22d723(0xd8));if(_0x33583a>0x0)_0x1045d7[_0x22d723(0xd3)](_0x33583a+_0x22d723(0x8a));const _0x54351f=[];if(_0x364ced>0x0)_0x54351f[_0x22d723(0xd3)](_0x364ced+_0x22d723(0x85));if(_0x28f590>0x0)_0x54351f[_0x22d723(0xd3)](_0x28f590+_0x22d723(0xd8));if(_0x4029de>0x0)_0x54351f[_0x22d723(0xd3)](_0x4029de+_0x22d723(0x8a));const _0x3b3d9d=[];if(_0x5bbea8>0x0)_0x3b3d9d[_0x22d723(0xd3)](_0x5bbea8+_0x22d723(0x85));if(_0x2788d9>0x0)_0x3b3d9d['push'](_0x2788d9+_0x22d723(0xd8));if(_0x14ac4b>0x0)_0x3b3d9d[_0x22d723(0xd3)](_0x14ac4b+'\x20deleted');return console[_0x22d723(0xc8)](a29_0x1bb08c[_0x22d723(0xbf)]('\x0a✔\x20Push\x20complete')),_0x1045d7[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xe6)]&&console[_0x22d723(0xc8)](_0x22d723(0xac)+_0x1045d7['join'](',\x20')),_0x54351f[_0x22d723(0x106)]>0x0&&console[_0x22d723(0xc8)](_0x22d723(0x116)+_0x54351f['join'](',\x20')),_0x3b3d9d[_0x22d723(0x106)]>0x0&&!_0x359a36[_0x22d723(0xe6)]&&console[_0x22d723(0xc8)](_0x22d723(0x105)+_0x3b3d9d[_0x22d723(0xcd)](',\x20')),0x0;}}
1
+ const a29_0x5bc6b1=a29_0x54ea;(function(_0x16d951,_0x1d825a){const _0x4f5ed6=a29_0x54ea,_0xe3dd89=_0x16d951();while(!![]){try{const _0x314671=parseInt(_0x4f5ed6(0x1f0))/0x1*(parseInt(_0x4f5ed6(0x1b2))/0x2)+-parseInt(_0x4f5ed6(0x19f))/0x3+-parseInt(_0x4f5ed6(0x1f9))/0x4+parseInt(_0x4f5ed6(0x203))/0x5*(-parseInt(_0x4f5ed6(0x22b))/0x6)+parseInt(_0x4f5ed6(0x1dd))/0x7*(-parseInt(_0x4f5ed6(0x214))/0x8)+-parseInt(_0x4f5ed6(0x1bd))/0x9*(-parseInt(_0x4f5ed6(0x1d0))/0xa)+-parseInt(_0x4f5ed6(0x1a9))/0xb*(-parseInt(_0x4f5ed6(0x1b7))/0xc);if(_0x314671===_0x1d825a)break;else _0xe3dd89['push'](_0xe3dd89['shift']());}catch(_0x4503cc){_0xe3dd89['push'](_0xe3dd89['shift']());}}}(a29_0x5e11,0x59cf7));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 a29_0x11d044 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a29_0x54ea(_0x29629f,_0x52e655){_0x29629f=_0x29629f-0x197;const _0x5e11c3=a29_0x5e11();let _0x54eacc=_0x5e11c3[_0x29629f];return _0x54eacc;}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';['description']=a29_0x5bc6b1(0x19d);async[a29_0x5bc6b1(0x227)](_0x369b04){const _0x55bd93=a29_0x5bc6b1,{options:_0x4b6c02,args:_0x344b45,tdx:_0x5724a4}=_0x369b04,_0xd05e91=_0x4b6c02,_0x1e4652=await resolveTarget({'arg':_0x344b45[0x0],'contextParent':_0x4b6c02['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x1e4652))return _0x1e4652[_0x55bd93(0x1cc)]===_0x55bd93(0x1d8)?(console[_0x55bd93(0x1ab)](a29_0x11d044['yellow'](_0x55bd93(0x219))),console[_0x55bd93(0x1ab)](_0x55bd93(0x1f5)),console['error'](_0x55bd93(0x1e0)),console['error']('\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[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x221)](_0x55bd93(0x1b8)+_0x1e4652[_0x55bd93(0x1cb)]+'\x0a')),_0x1e4652['helpText']&&console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x21d)](_0x1e4652[_0x55bd93(0x1eb)]))),0x1;if(_0x1e4652[_0x55bd93(0x1ac)]===_0x55bd93(0x1d2))return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x221)](_0x55bd93(0x223)+_0x1e4652['targetDir']+'\x0a')),console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x21d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x51ebe3=_0x1e4652[_0x55bd93(0x1be)],_0x503009=_0x1e4652[_0x55bd93(0x211)],_0x4c23c1=_0x1e4652['type']==='file'?_0x1e4652[_0x55bd93(0x217)]:undefined,_0x4bb1f4=getScopedDetails(_0x1e4652),_0x58d0cd=_0x4bb1f4?.[_0x55bd93(0x1e7)]??![],_0x51374a=_0x4bb1f4?.['scopedFolderPath']??'';if(!existsSync(_0x503009))return console['error'](a29_0x11d044[_0x55bd93(0x221)]('Error:\x20Directory\x20not\x20found:\x20'+_0x503009+'\x0a')),console['error'](a29_0x11d044[_0x55bd93(0x21d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0xd05e91[_0x55bd93(0x21b)]&&(console[_0x55bd93(0x1ab)]('Site:\x20'+_0xd05e91[_0x55bd93(0x1c3)]),console[_0x55bd93(0x1ab)](_0x55bd93(0x218)+_0x51ebe3),console[_0x55bd93(0x1ab)](_0x55bd93(0x20c)+_0x503009),_0x58d0cd&&console[_0x55bd93(0x1ab)](_0x55bd93(0x19a)+_0x51374a));const _0x1a274f=await withSpinner(_0x55bd93(0x1bb)+_0x51ebe3+'\x27...',()=>_0x5724a4[_0x55bd93(0x205)]['resolveParentId'](_0x51ebe3),{'verbose':_0xd05e91[_0x55bd93(0x21b)]}),_0x2775d9=_0x1a274f[_0x55bd93(0x212)],[_0x151a74,_0x2b5bc3,_0x3f7402,_0x24e900,_0x255c10]=await Promise[_0x55bd93(0x1a3)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5724a4[_0x55bd93(0x205)][_0x55bd93(0x1fa)](_0x2775d9),{'verbose':_0xd05e91[_0x55bd93(0x21b)]}),withSpinner(_0x55bd93(0x222),()=>_0x5724a4['segment'][_0x55bd93(0x1ce)](_0x2775d9),{'verbose':_0xd05e91[_0x55bd93(0x21b)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x5724a4['segment']['listFolders'](_0x2775d9),{'verbose':_0xd05e91[_0x55bd93(0x21b)]}),withSpinner(_0x55bd93(0x1ed),()=>_0x5724a4[_0x55bd93(0x1f2)]['listJourneysWithDetailsFromParentSegment'](_0x2775d9,{'includeAllVersions':!![]}),{'verbose':_0xd05e91[_0x55bd93(0x21b)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x5724a4['user'][_0x55bd93(0x1a5)](),{'verbose':_0xd05e91['verbose']})[_0x55bd93(0x1b4)](_0x2e5f67=>_0x2e5f67['data'])]),_0xe9a349=_0x151a74['data'],_0x38fa44=extractRootFolderId(_0xe9a349),_0x5ca255=_0x2b5bc3['data'],_0x1e2cdd=_0x3f7402['data'],{journeys:_0x51c183,activationStepsById:_0x4c9399}=_0x24e900[_0x55bd93(0x212)],_0x3f3994=new Map(_0x51c183[_0x55bd93(0x1d6)](_0x155953=>[_0x155953['id'],_0x155953])),_0x1713a2=_0x51c183['map'](_0x34c1ed=>({'id':_0x34c1ed['id'],'name':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x1d7)],'journeyBundleName':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x1e6)]||'','journeyBundleId':_0x34c1ed['attributes']['journeyBundleId']||'','versionNumber':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x1cf)],'description':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x1a1)],'state':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x1f6)],'paused':_0x34c1ed['attributes'][_0x55bd93(0x1d1)],'audienceId':_0x34c1ed['attributes']['audienceId'],'folderId':_0x34c1ed[_0x55bd93(0x1af)]?.[_0x55bd93(0x1ea)]?.[_0x55bd93(0x212)]?.['id'],'createdAt':_0x34c1ed[_0x55bd93(0x1ec)]['createdAt'],'updatedAt':_0x34c1ed[_0x55bd93(0x1ec)][_0x55bd93(0x213)]})),{emailToId:_0x2c9624,idToEmail:_0x450788}=_0x255c10,_0x276610=await withSpinner(_0x55bd93(0x21e),async()=>{const _0x481e75=_0x55bd93,_0x7bb18=await _0x5724a4['connection'][_0x481e75(0x209)]();return buildConnectionMaps(_0x7bb18);},{'verbose':_0xd05e91[_0x55bd93(0x21b)]})[_0x55bd93(0x1b4)](_0x4897d5=>_0x4897d5[_0x55bd93(0x212)]),_0x82e01=_0x276610['nameToId'],_0x128629=_0x276610[_0x55bd93(0x1ad)],_0x516111=_0x276610[_0x55bd93(0x210)],_0x318a23={'emailToIdMap':_0x2c9624,'connectionNameToIdMap':_0x82e01,'connectionNameToTypeMap':_0x516111,'getSchema':_0x56cc8c=>_0x5724a4[_0x55bd93(0x1f7)][_0x55bd93(0x201)](_0x56cc8c)};let {pathToId:_0x32d12e,idToPath:_0x2e73a9}=buildFolderMaps(_0x1e2cdd);const _0xfc0b2b=buildSegmentLookupMap(_0x5ca255,_0x2e73a9),_0x5cc728=buildSegmentNameToIdMap(_0x5ca255),_0x3b8ddb=buildJourneyBundleLookupMap(_0x1713a2,_0x2e73a9);let _0x41cc22;if(_0x4c23c1){if(!_0x4c23c1[_0x55bd93(0x1f1)](_0x55bd93(0x1c6))&&!_0x4c23c1[_0x55bd93(0x1f1)](_0x55bd93(0x21c)))return console['error'](a29_0x11d044['red'](_0x55bd93(0x1c2)+_0x4c23c1+'\x0a')),0x1;_0x41cc22=[_0x4c23c1];}else _0x41cc22=findYamlFiles(_0x503009);if(_0x41cc22['length']===0x0)return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x221)](_0x55bd93(0x1c4)+_0x503009+'\x0a')),console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x21d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x38122f,_0x1900f2;try{const _0x15b8e3=parseAndClassifyYamlFiles(_0x41cc22,_0x503009,{'skipSegments':_0xd05e91[_0x55bd93(0x1db)]});_0x38122f=_0x15b8e3[_0x55bd93(0x1c7)],_0x1900f2=_0x15b8e3[_0x55bd93(0x199)];const _0xe1f323=validateParsedFiles(_0x15b8e3,_0x503009);if(_0xe1f323[_0x55bd93(0x197)]>0x0)return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x221)]('\x0aValidation\x20failed:')),console[_0x55bd93(0x1ab)](formatValidationErrors(_0xe1f323)),console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20d)](_0x55bd93(0x229))),0x1;}catch(_0x35902d){return console[_0x55bd93(0x1ab)](a29_0x11d044['red'](_0x55bd93(0x1f3)+(_0x35902d instanceof Error?_0x35902d['message']:_0x35902d))),0x1;}if(_0x38122f[_0x55bd93(0x197)]===0x0&&_0x1900f2[_0x55bd93(0x197)]===0x0){const _0x21eed8=_0xd05e91[_0x55bd93(0x1db)]?'journey':_0x55bd93(0x1de);return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20d)]('No\x20'+_0x21eed8+_0x55bd93(0x207))),0x0;}const _0xf620bf=new Map();_0x5ca255[_0x55bd93(0x197)]>0x0&&!_0xd05e91['journeysOnly']&&await withSpinner(_0x55bd93(0x1c8),async()=>{await batchAsync(_0x5ca255,async _0x1452aa=>{const _0x3d9548=a29_0x54ea,_0x486419=await _0x5724a4[_0x3d9548(0x205)][_0x3d9548(0x1e3)](_0x2775d9,_0x1452aa['id']);_0xf620bf['set'](_0x1452aa['id'],_0x486419);});},{'verbose':_0xd05e91['verbose']});const {segmentFiles:_0x50b087,foldersToCreate:_0x51db61}=await prepareSegmentFiles(_0x38122f,{'segmentByFolderAndName':_0xfc0b2b,'activationsBySegmentId':_0xf620bf,'folderPathToId':_0x32d12e,'idToEmailMap':_0x450788,'connectionIdToNameMap':_0x128629},_0x318a23,_0x58d0cd,_0x51374a),_0x577c3b=_0x4c23c1?[]:findSegmentsToDelete(_0x5ca255,_0x38122f[_0x55bd93(0x1d6)](({yamlConfig:_0x50662c,folderPath:_0x3b7c23})=>({'yamlConfig':_0x50662c,'folderPath':resolveTDFolderPath(_0x3b7c23,_0x58d0cd,_0x51374a)})),_0x2e73a9,_0x51374a,_0x58d0cd),{journeyFiles:_0x422465,foldersToCreate:_0x3f3948}=await withProgressSpinner('Preparing\x20journeys...',async _0x2d3f03=>prepareJourneyFiles(_0x1900f2,{'fetchJourney':async _0x106746=>_0x5724a4[_0x55bd93(0x1f2)][_0x55bd93(0x1c1)](_0x106746[_0x55bd93(0x1bc)]),'journeyBundlesByFolderAndName':_0x3b8ddb,'folderPathToId':_0x32d12e,'idToEmailMap':_0x450788,'connectionIdToNameMap':_0x128629,'existingSegments':_0x5ca255,'parentId':_0x2775d9,'deps':_0x5724a4,'progress':{'update':_0x25801a=>{const _0x53dc1a=_0x55bd93;_0x2d3f03[_0x53dc1a(0x1e4)](_0x25801a),_0xd05e91[_0x53dc1a(0x21b)]&&console['error']('\x20\x20'+_0x25801a);}},'journeyById':_0x3f3994,'activationStepsById':_0x4c9399},_0x58d0cd,_0x51374a),{'verbose':_0xd05e91['verbose']})['then'](_0x5b7dd1=>_0x5b7dd1[_0x55bd93(0x212)]);for(const _0x22bd26 of _0x3f3948){_0x51db61[_0x55bd93(0x225)](_0x22bd26);}const _0x24539d=_0x4c23c1?[]:findJourneysToDelete(_0x1713a2,_0x1900f2[_0x55bd93(0x1d6)](({yamlConfig:_0x482fe3,folderPath:_0xbb0837})=>({'yamlConfig':_0x482fe3,'folderPath':resolveTDFolderPath(_0xbb0837,_0x58d0cd,_0x51374a)})),_0x2e73a9,_0x51374a,_0x58d0cd),_0x5f3431=calculatePushStats(_0x50b087,_0x422465,_0x51db61,_0x577c3b,_0x24539d,!!_0xd05e91[_0x55bd93(0x1e9)],!!_0xd05e91['journeysOnly']),_0x417158=_0x5f3431[_0x55bd93(0x1c7)]['new'],_0x472cd0=_0x5f3431[_0x55bd93(0x1c7)][_0x55bd93(0x1cd)],_0x23b739=_0x5f3431['segments'][_0x55bd93(0x224)],_0x37c8b8=_0x5f3431['segments'][_0x55bd93(0x1f4)],_0xce5a5a=_0x5f3431[_0x55bd93(0x1ee)][_0x55bd93(0x1fe)],_0x303f33=_0x5f3431['journeys']['new'],_0x351e61=_0x5f3431[_0x55bd93(0x199)][_0x55bd93(0x1cd)],_0x52c6fd=_0x5f3431[_0x55bd93(0x199)]['unchanged'],_0x447d64=_0x5f3431['journeys']['toDelete'],_0x5bb84f=_0x5f3431[_0x55bd93(0x1c9)][_0x55bd93(0x1a3)],_0x860a3c=_0x5f3431[_0x55bd93(0x1c9)][_0x55bd93(0x1fe)],_0x5359f7=_0x5f3431[_0x55bd93(0x1c9)][_0x55bd93(0x1dc)],_0x6196aa=_0x5f3431[_0x55bd93(0x1c9)][_0x55bd93(0x1f4)];console[_0x55bd93(0x1ab)](_0x55bd93(0x21f)+_0x51ebe3+'\x27:');_0xce5a5a[_0x55bd93(0x197)]>0x0&&console[_0x55bd93(0x1ab)]('\x20\x20'+a29_0x11d044[_0x55bd93(0x20e)]('📁\x20'+_0xce5a5a[_0x55bd93(0x197)]+_0x55bd93(0x1ae)));if(!_0xd05e91[_0x55bd93(0x1db)]){console[_0x55bd93(0x1ab)](_0x55bd93(0x21a)),console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044['green']('+\x20'+_0x417158[_0x55bd93(0x197)]+_0x55bd93(0x1c0))),console['error'](_0x55bd93(0x226)+a29_0x11d044[_0x55bd93(0x20d)]('~\x20'+_0x472cd0['length']+_0x55bd93(0x1c5)));if(_0x37c8b8[_0x55bd93(0x197)]>0x0)console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044['red']('-\x20'+_0x37c8b8[_0x55bd93(0x197)]+_0x55bd93(0x1b9)));else _0x577c3b[_0x55bd93(0x197)]>0x0&&!_0xd05e91[_0x55bd93(0x1e9)]&&console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044['dim'](_0x577c3b[_0x55bd93(0x197)]+_0x55bd93(0x1b5)));console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044[_0x55bd93(0x1f8)]('=\x20'+_0x23b739['length']+'\x20unchanged'));}if(_0x422465[_0x55bd93(0x197)]>0x0||_0x24539d[_0x55bd93(0x197)]>0x0){console[_0x55bd93(0x1ab)](_0x55bd93(0x1aa)),console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044['green']('+\x20'+_0x303f33[_0x55bd93(0x197)]+_0x55bd93(0x1c0))),console['error'](_0x55bd93(0x226)+a29_0x11d044['yellow']('~\x20'+_0x351e61[_0x55bd93(0x197)]+'\x20changed'));if(_0x447d64[_0x55bd93(0x197)]>0x0)console['error']('\x20\x20\x20\x20'+a29_0x11d044[_0x55bd93(0x221)]('-\x20'+_0x447d64[_0x55bd93(0x197)]+_0x55bd93(0x1b9)));else _0x24539d[_0x55bd93(0x197)]>0x0&&!_0xd05e91[_0x55bd93(0x1e9)]&&console['error'](_0x55bd93(0x226)+a29_0x11d044[_0x55bd93(0x1f8)](_0x24539d[_0x55bd93(0x197)]+_0x55bd93(0x1b5)));console[_0x55bd93(0x1ab)]('\x20\x20\x20\x20'+a29_0x11d044[_0x55bd93(0x1f8)]('=\x20'+_0x52c6fd[_0x55bd93(0x197)]+_0x55bd93(0x1df)));}_0x5bb84f[_0x55bd93(0x197)]>0x0&&!_0xd05e91['journeysOnly']&&(console[_0x55bd93(0x1ab)](''),console[_0x55bd93(0x1ab)](_0x55bd93(0x1d4)),_0x860a3c['length']>0x0&&console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044[_0x55bd93(0x1d5)]('+\x20'+_0x860a3c[_0x55bd93(0x197)]+_0x55bd93(0x19e))),_0x5359f7[_0x55bd93(0x197)]>0x0&&console[_0x55bd93(0x1ab)]('\x20\x20\x20\x20'+a29_0x11d044[_0x55bd93(0x20d)]('~\x20'+_0x5359f7[_0x55bd93(0x197)]+_0x55bd93(0x1ff))),_0x6196aa[_0x55bd93(0x197)]>0x0&&console[_0x55bd93(0x1ab)](_0x55bd93(0x226)+a29_0x11d044['red']('-\x20'+_0x6196aa[_0x55bd93(0x197)]+_0x55bd93(0x1b9))));console[_0x55bd93(0x1ab)]('\x20\x20Source:\x20'+a29_0x11d044[_0x55bd93(0x21d)](_0x503009)+'\x0a');if(_0xce5a5a[_0x55bd93(0x197)]>0x0){console['error']('Folders\x20to\x20create:');for(const _0x4a3590 of _0xce5a5a){console[_0x55bd93(0x1ab)]('\x20\x20'+a29_0x11d044[_0x55bd93(0x20e)]('+')+'\x20'+_0x4a3590);}console[_0x55bd93(0x1ab)]('');}if(_0x417158['length']>0x0&&!_0xd05e91[_0x55bd93(0x1db)])for(const _0x399057 of _0x417158){const _0x4d774b=_0x399057[_0x55bd93(0x1da)]?_0x399057[_0x55bd93(0x1da)]+'/'+_0x399057[_0x55bd93(0x1e8)][_0x55bd93(0x1d7)]:_0x399057[_0x55bd93(0x1e8)]['name'],_0x58057c=_0x399057[_0x55bd93(0x1e8)][_0x55bd93(0x1c9)]?.[_0x55bd93(0x197)]||0x0,_0x430702=_0x58057c>0x0?a29_0x11d044['dim']('\x20['+_0x58057c+'\x20activations]'):'';console['error']('\x0a'+a29_0x11d044[_0x55bd93(0x1d5)](_0x55bd93(0x1e2))+'\x20'+_0x4d774b+_0x430702),console[_0x55bd93(0x1ab)]('─'['repeat'](0x3c)),_0x399057[_0x55bd93(0x1fb)]&&console['error'](_0x399057['diff']),console[_0x55bd93(0x1ab)]('─'['repeat'](0x3c));}if(_0x37c8b8[_0x55bd93(0x197)]>0x0&&!_0xd05e91['journeysOnly'])for(const _0x212c81 of _0x37c8b8){const _0x196190=_0x212c81[_0x55bd93(0x200)]?_0x2e73a9[_0x55bd93(0x1b1)](_0x212c81[_0x55bd93(0x200)][_0x55bd93(0x1ef)]())||'':'',_0x1ceee2=_0x196190?_0x196190+'/'+_0x212c81[_0x55bd93(0x1d7)]:_0x212c81[_0x55bd93(0x1d7)],_0x7276b7=_0xf620bf[_0x55bd93(0x1b1)](_0x212c81['id'])||[],_0x199523=_0x7276b7[_0x55bd93(0x197)]>0x0?a29_0x11d044['dim']('\x20['+_0x7276b7[_0x55bd93(0x197)]+'\x20activations]'):'';console[_0x55bd93(0x1ab)]('\x0a'+a29_0x11d044[_0x55bd93(0x221)](_0x55bd93(0x19c))+'\x20'+_0x1ceee2+_0x199523),console['error']('─'[_0x55bd93(0x204)](0x3c));const _0x432a37=segmentWithActivationsToYaml(_0x212c81,_0x7276b7,undefined,_0x450788,_0x128629),_0x30dded=segmentToYamlString(_0x432a37),_0x5b9e38=generateDiff(_0x30dded,'');console['error'](formatDiffWithColors(_0x5b9e38)),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c));}const _0x2075cc=_0x50b087['filter'](_0x275fcb=>!_0x275fcb['isNew']&&_0x275fcb['diff']);if(_0x2075cc[_0x55bd93(0x197)]>0x0&&!_0xd05e91['journeysOnly'])for(const _0x472bfd of _0x2075cc){const _0x5dd3a1=_0x472bfd[_0x55bd93(0x1da)]?_0x472bfd['folderPath']+'/'+_0x472bfd[_0x55bd93(0x1e8)][_0x55bd93(0x1d7)]:_0x472bfd['yamlConfig'][_0x55bd93(0x1d7)];console[_0x55bd93(0x1ab)]('\x0a'+a29_0x11d044[_0x55bd93(0x20d)](_0x55bd93(0x1b3))+'\x20'+_0x5dd3a1),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c)),console[_0x55bd93(0x1ab)](_0x472bfd[_0x55bd93(0x1fb)]),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c));}if(_0x303f33['length']>0x0)for(const _0x23600d of _0x303f33){const _0x316bff=_0x23600d[_0x55bd93(0x1da)]?_0x23600d['folderPath']+'/'+_0x23600d[_0x55bd93(0x1e8)][_0x55bd93(0x1d7)]:_0x23600d['yamlConfig']['name'];console['error']('\x0a'+a29_0x11d044[_0x55bd93(0x1d5)]('New\x20journey:')+'\x20'+_0x316bff),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c)),_0x23600d[_0x55bd93(0x1fb)]&&console['error'](_0x23600d['diff']),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c));}const _0x4af3f1=_0x422465[_0x55bd93(0x1b0)](_0x112bc9=>!_0x112bc9[_0x55bd93(0x1fc)]&&_0x112bc9['diff']);if(_0x4af3f1[_0x55bd93(0x197)]>0x0)for(const _0x5a94f1 of _0x4af3f1){const _0x9b3f0=_0x5a94f1[_0x55bd93(0x1da)]?_0x5a94f1[_0x55bd93(0x1da)]+'/'+_0x5a94f1[_0x55bd93(0x1e8)]['name']:_0x5a94f1[_0x55bd93(0x1e8)][_0x55bd93(0x1d7)];console[_0x55bd93(0x1ab)]('\x0a'+a29_0x11d044[_0x55bd93(0x20d)](_0x55bd93(0x228))+'\x20'+_0x9b3f0),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c)),console['error'](_0x5a94f1[_0x55bd93(0x1fb)]),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c));}if(_0x447d64[_0x55bd93(0x197)]>0x0)for(const _0x46937d of _0x447d64){const _0x26fd5c=_0x46937d[_0x55bd93(0x19b)]?_0x2e73a9[_0x55bd93(0x1b1)](_0x46937d['folderId'])||'':'',_0xed0d17=_0x26fd5c?_0x26fd5c+'/'+_0x46937d[_0x55bd93(0x1e6)]:_0x46937d[_0x55bd93(0x1e6)];console[_0x55bd93(0x1ab)]('\x0a'+a29_0x11d044['red'](_0x55bd93(0x1a0))+'\x20'+_0xed0d17),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c)),console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x221)](_0x55bd93(0x1d3))),console[_0x55bd93(0x1ab)]('─'[_0x55bd93(0x204)](0x3c));}if(_0xd05e91[_0x55bd93(0x1e5)])return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20d)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x4549fa=_0xd05e91[_0x55bd93(0x1db)]?![]:_0x417158['length']>0x0||_0x472cd0[_0x55bd93(0x197)]>0x0||_0x37c8b8['length']>0x0,_0x18c5cf=_0x303f33[_0x55bd93(0x197)]>0x0||_0x351e61[_0x55bd93(0x197)]>0x0||_0x447d64['length']>0x0,_0x10f566=_0xd05e91['journeysOnly']?![]:_0x5bb84f[_0x55bd93(0x197)]>0x0,_0x3a5f13=_0xce5a5a['length']>0x0;if(!_0x4549fa&&!_0x18c5cf&&!_0x10f566&&!_0x3a5f13){const _0x5e4813=_0xd05e91[_0x55bd93(0x1db)]?_0x55bd93(0x22a):_0x55bd93(0x198);console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x1d5)](_0x5e4813));if(_0x4c23c1&&_0x52c6fd[_0x55bd93(0x197)]===0x1){const _0xe00b1c=_0x52c6fd[0x0];if(_0xe00b1c[_0x55bd93(0x1ba)]?.['id']){const _0x382212=getConsoleNextUrl(_0xd05e91['site'],_0x55bd93(0x215)+_0x2775d9+_0x55bd93(0x1b6)+_0xe00b1c[_0x55bd93(0x1ba)]['id']+'/j/da/je');console[_0x55bd93(0x1ab)]('\x20\x20'+a29_0x11d044[_0x55bd93(0x21d)](_0x382212));}}return 0x0;}const _0x132ea7=_0xd05e91['journeysOnly']?_0x303f33[_0x55bd93(0x197)]+_0x351e61[_0x55bd93(0x197)]+_0x447d64['length']+_0xce5a5a[_0x55bd93(0x197)]:_0x417158[_0x55bd93(0x197)]+_0x472cd0['length']+_0x37c8b8[_0x55bd93(0x197)]+_0x303f33['length']+_0x351e61[_0x55bd93(0x197)]+_0x447d64[_0x55bd93(0x197)]+_0xce5a5a[_0x55bd93(0x197)]+_0x5bb84f[_0x55bd93(0x197)];if(!_0xd05e91['yes']&&_0x132ea7>0x0){const _0x40b86d=await confirmKey(_0x55bd93(0x20b)+_0x132ea7+'\x20changes?');if(!_0x40b86d)return console[_0x55bd93(0x1ab)](_0x55bd93(0x206)),0x1;}const _0x4c66f1={'withProgress':async(_0x457905,_0x260905)=>{const _0x48d8f6=_0x55bd93,_0x4f6657=await withSpinner(_0x457905,_0x260905,{'verbose':_0xd05e91['verbose']});return{'data':_0x4f6657[_0x48d8f6(0x212)]};},'logInfo':_0x10c974=>console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20e)]('✔\x20'+_0x10c974)),'logSuccess':_0x319ec4=>console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x1d5)]('✔\x20'+_0x319ec4)),'logWarning':_0x57ee4a=>console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20d)]('⚠\x20'+_0x57ee4a)),'logDeleted':_0x368fab=>console[_0x55bd93(0x1ab)](a29_0x11d044['red']('✔\x20'+_0x368fab))},_0x1fc3de={'segment':_0x5724a4[_0x55bd93(0x205)],'journey':_0x5724a4[_0x55bd93(0x1f2)],'user':_0x5724a4[_0x55bd93(0x1d9)],'connection':_0x5724a4[_0x55bd93(0x1f7)]};_0xce5a5a[_0x55bd93(0x197)]>0x0&&(_0x32d12e=await executePushFolders(_0x1fc3de,_0xce5a5a,_0x32d12e,{'parentId':_0x2775d9},_0x4c66f1));const _0x63f437={'rootFolderId':_0x38fa44,'folderPathToId':_0x32d12e,'folderIdToPath':_0x2e73a9,'segmentNameToId':_0x5cc728,'activationsBySegmentId':_0xf620bf,'emailToIdMap':_0x2c9624,'idToEmailMap':_0x450788,'connectionNameToIdMap':_0x276610[_0x55bd93(0x208)],'connectionIdToNameMap':_0x276610[_0x55bd93(0x1ad)],'connectionNameToTypeMap':_0x516111},_0x1b0289=await executePushSegments(_0x1fc3de,_0xd05e91[_0x55bd93(0x1db)]?[]:_0x50b087,_0x63f437,{'parentId':_0x2775d9},_0x4c66f1),_0x141278=_0x1b0289['created'],_0x430c68=_0x1b0289[_0x55bd93(0x1a4)],_0x43fb37=_0x1b0289[_0x55bd93(0x1c9)]['created'],_0x2ee97c=_0x1b0289[_0x55bd93(0x1c9)][_0x55bd93(0x1a4)],_0x53b1c4=_0x1b0289[_0x55bd93(0x1c9)]['deleted'],_0xcc445e=await executePushSegmentDeletions(_0x1fc3de,_0xd05e91['journeysOnly']?[]:_0x37c8b8,_0x4c66f1);let _0x574327=0x0,_0x583cba=0x0,_0x3fe7de=0x0;const _0x41da6a=new Map(_0x5cc728);for(const [_0x1c3158,_0x27df43]of _0x1b0289[_0x55bd93(0x220)]){_0x41da6a[_0x55bd93(0x1e1)](_0x1c3158,_0x27df43);}if(_0x422465[_0x55bd93(0x197)]>0x0){const _0x181c75={..._0x63f437,'segmentNameToId':_0x41da6a,'existingSegments':_0x5ca255,'activationContext':_0x318a23},_0x3c3cd8=await executePushJourneys(_0x1fc3de,_0x422465,_0x181c75,{'parentId':_0x2775d9,'rootFolderId':_0x38fa44,'verbose':_0xd05e91[_0x55bd93(0x21b)]},_0x4c66f1);_0x574327=_0x3c3cd8[_0x55bd93(0x202)],_0x583cba=_0x3c3cd8['updated'];if(_0x4c23c1&&_0x3c3cd8[_0x55bd93(0x1fd)]['length']===0x1){const _0xa38e54=_0x3c3cd8['results'][0x0];if(_0xa38e54[_0x55bd93(0x1bc)]){const _0x52b9e7=getConsoleNextUrl(_0xd05e91[_0x55bd93(0x1c3)],_0x55bd93(0x215)+_0x2775d9+_0x55bd93(0x1b6)+_0xa38e54[_0x55bd93(0x1bc)]+_0x55bd93(0x1bf));console[_0x55bd93(0x1ab)]('\x20\x20'+a29_0x11d044[_0x55bd93(0x21d)](_0x52b9e7));}}}for(const _0x3b27f3 of _0x447d64){console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x20d)](_0x55bd93(0x1ca)+_0x3b27f3[_0x55bd93(0x1e6)])),_0x3fe7de++;}const _0x4df376=[];if(_0x141278>0x0)_0x4df376[_0x55bd93(0x20f)](_0x141278+_0x55bd93(0x1a6));if(_0x430c68>0x0)_0x4df376['push'](_0x430c68+'\x20updated');if(_0xcc445e>0x0)_0x4df376['push'](_0xcc445e+_0x55bd93(0x216));const _0x12c03d=[];if(_0x574327>0x0)_0x12c03d[_0x55bd93(0x20f)](_0x574327+'\x20created');if(_0x583cba>0x0)_0x12c03d['push'](_0x583cba+_0x55bd93(0x1a2));if(_0x3fe7de>0x0)_0x12c03d[_0x55bd93(0x20f)](_0x3fe7de+_0x55bd93(0x216));const _0x1b5451=[];if(_0x43fb37>0x0)_0x1b5451[_0x55bd93(0x20f)](_0x43fb37+_0x55bd93(0x1a6));if(_0x2ee97c>0x0)_0x1b5451['push'](_0x2ee97c+_0x55bd93(0x1a2));if(_0x53b1c4>0x0)_0x1b5451['push'](_0x53b1c4+_0x55bd93(0x216));return console[_0x55bd93(0x1ab)](a29_0x11d044[_0x55bd93(0x1d5)](_0x55bd93(0x1a8))),_0x4df376['length']>0x0&&!_0xd05e91['journeysOnly']&&console['error']('\x20\x20Segments:\x20'+_0x4df376[_0x55bd93(0x1a7)](',\x20')),_0x12c03d[_0x55bd93(0x197)]>0x0&&console['error'](_0x55bd93(0x20a)+_0x12c03d[_0x55bd93(0x1a7)](',\x20')),_0x1b5451[_0x55bd93(0x197)]>0x0&&!_0xd05e91[_0x55bd93(0x1db)]&&console[_0x55bd93(0x1ab)]('\x20\x20Activations:\x20'+_0x1b5451[_0x55bd93(0x1a7)](',\x20')),0x0;}}function a29_0x5e11(){const _0x5f0293=['cyan','Fetching\x20connections\x20for\x20name\x20resolution...','\x0aPush\x20summary\x20for\x20\x27','createdSegmentIds','red','Fetching\x20existing\x20segments...','Error:\x20Directory\x20not\x20found:\x20','unchanged','add','\x20\x20\x20\x20','execute','Changes\x20to\x20journey:','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','1074qCNTzl','length','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','journeys','Scoped\x20to\x20folder:\x20','folderId','Delete\x20segment:','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20to\x20create','1351080tSaiVM','Delete\x20journey:','description','\x20updated','all','updated','buildUserMaps','\x20created','join','\x0a✔\x20Push\x20complete','5032159yjZKnG','\x20\x20🗺️\x20\x20Journeys:','error','type','idToName','\x20folders\x20to\x20create','relationships','filter','get','1514akbNaW','Changes\x20to:','then','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','/e/','12ruYFFj','Error:\x20','\x20to\x20delete','existingJourney','Resolving\x20parent\x20segment\x20\x27','journeyId','54801ITWolX','parentName','/j/da/je','\x20new','getJourney','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','site','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20changed','.yml','segments','Fetching\x20existing\x20activations...','activations','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','message','errorCode','changed','listSegments','versionNumber','950ejfiry','paused','parent_name','(Journey\x20will\x20be\x20deleted)','\x20\x20Activations:','green','map','name','no_parent','user','folderPath','journeysOnly','toUpdate','770ryduCy','segment\x20or\x20journey','\x20unchanged','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','set','New\x20segment:','listActivations','setPhase','dryRun','journeyBundleName','isScoped','yamlConfig','delete','parentFolder','helpText','attributes','Fetching\x20existing\x20journeys...','folders','toString','938sxVEcI','endsWith','journey','Error\x20parsing\x20YAML:\x20','toDelete','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)','state','connection','dim','2858488ZEtwTj','getParent','diff','isNew','results','toCreate','\x20to\x20update','segmentFolderId','getOutputSchemaWithCache','created','3425TxrclB','repeat','segment','Aborted.','\x20YAML\x20files\x20found','nameToId','list','\x20\x20Journeys:\x20','Push\x20','Source\x20directory:\x20','yellow','blue','push','nameToType','targetDir','data','updatedAt','6584xRxEKz','/app/ps/','\x20deleted','filePath','Parent\x20segment:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20📊\x20Segments:','verbose','.yaml'];a29_0x5e11=function(){return _0x5f0293;};return a29_0x5e11();}
@@ -1 +1 @@
1
- const a30_0x5a94e1=a30_0xd48d;(function(_0x36f338,_0x318950){const _0x25919a=a30_0xd48d,_0x2e5d44=_0x36f338();while(!![]){try{const _0x83fb46=parseInt(_0x25919a(0x138))/0x1+-parseInt(_0x25919a(0x120))/0x2*(parseInt(_0x25919a(0x13d))/0x3)+-parseInt(_0x25919a(0x13c))/0x4*(-parseInt(_0x25919a(0x130))/0x5)+parseInt(_0x25919a(0x12c))/0x6+parseInt(_0x25919a(0x14f))/0x7*(-parseInt(_0x25919a(0x147))/0x8)+-parseInt(_0x25919a(0x13f))/0x9+-parseInt(_0x25919a(0x121))/0xa*(-parseInt(_0x25919a(0x132))/0xb);if(_0x83fb46===_0x318950)break;else _0x2e5d44['push'](_0x2e5d44['shift']());}catch(_0x4adb05){_0x2e5d44['push'](_0x2e5d44['shift']());}}}(a30_0x3bae,0x728e5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a30_0x3bae(){const _0x2ef01a=['20PoBzuB','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','ruleFile','name','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','segment:update','folder','\x27...','Resolved\x20folder\x20ID:\x20','error','includes','2237964CgtDiG','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','1616375zdRPMi','Parent\x20ID:\x20','79574tHBMdR','description','yellow','INTERNAL','Resolving\x20path\x20\x27','segmentId','794959eFeAem','resolvePathToResource','rule','Examples:','4QPTfsM','20103dJDYzM','data','2157345roZCwh','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Resolved\x20relative\x20path\x20to:\x20','verbose','Error:\x20Cannot\x20update\x20','type','Segment\x20ID:\x20','parentId','1298696YBSMkg','kind','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','segmentPath','execute','segment','✔\x20Updated\x20segment\x20\x27','Resolved\x20type:\x20','28mLnECR','44autOCi'];a30_0x3bae=function(){return _0x2ef01a;};return a30_0x3bae();}function a30_0xd48d(_0x1b32af,_0x5966c9){_0x1b32af=_0x1b32af-0x120;const _0x3bae5a=a30_0x3bae();let _0xd48d7d=_0x3bae5a[_0x1b32af];return _0xd48d7d;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x435a62 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a30_0x5a94e1(0x124)]=a30_0x5a94e1(0x126);[a30_0x5a94e1(0x133)]='Update\x20existing\x20child\x20segment';async[a30_0x5a94e1(0x14b)](_0x2c6aeb){const _0x1f79b0=a30_0x5a94e1;console[_0x1f79b0(0x12a)](a30_0x435a62[_0x1f79b0(0x134)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console['error'](a30_0x435a62[_0x1f79b0(0x134)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x4091a5,args:_0x506447,tdx:_0x21a888}=_0x2c6aeb,_0x1c761e=_0x4091a5;if(_0x506447['length']===0x0)return console[_0x1f79b0(0x12a)](_0x1f79b0(0x12d)),console[_0x1f79b0(0x12a)](_0x1f79b0(0x140)),console[_0x1f79b0(0x12a)](_0x1f79b0(0x13b)),console[_0x1f79b0(0x12a)](_0x1f79b0(0x12f)),console[_0x1f79b0(0x12a)](_0x1f79b0(0x122)),0x1;const _0x14bf32=_0x506447[0x0],_0x48a6ad=_0x4091a5[_0x1f79b0(0x14a)];let _0x5ce0b1=_0x14bf32;_0x48a6ad&&!_0x14bf32[_0x1f79b0(0x12b)]('/')&&(_0x5ce0b1=_0x48a6ad+'/'+_0x14bf32,_0x1c761e['verbose']&&console['error'](_0x1f79b0(0x141)+_0x5ce0b1));const _0x4705bd=await withSpinner(_0x1f79b0(0x136)+_0x5ce0b1+_0x1f79b0(0x128),()=>_0x21a888[_0x1f79b0(0x14c)][_0x1f79b0(0x139)](_0x5ce0b1),{'verbose':_0x1c761e['verbose']}),_0x3f0075=_0x4705bd[_0x1f79b0(0x13e)];_0x1c761e[_0x1f79b0(0x142)]&&console[_0x1f79b0(0x12a)](_0x1f79b0(0x14e)+_0x3f0075[_0x1f79b0(0x144)]);if(_0x3f0075[_0x1f79b0(0x144)]!==_0x1f79b0(0x14c))return console[_0x1f79b0(0x12a)](_0x1f79b0(0x143)+_0x3f0075[_0x1f79b0(0x144)]+_0x1f79b0(0x149)),console[_0x1f79b0(0x12a)](_0x1f79b0(0x125)),0x1;if(!_0x3f0075['segmentId'])throw new SDKError(ErrorCode[_0x1f79b0(0x135)],_0x1f79b0(0x12e));const _0x2ea318=_0x3f0075[_0x1f79b0(0x146)],_0x57d978=_0x3f0075[_0x1f79b0(0x137)];_0x1c761e['verbose']&&(console[_0x1f79b0(0x12a)](_0x1f79b0(0x131)+_0x2ea318),console[_0x1f79b0(0x12a)](_0x1f79b0(0x145)+_0x57d978));let _0x210bfb;if(_0x1c761e[_0x1f79b0(0x127)]){const _0x1de917=_0x1c761e['folder'],_0x3f7191=await withSpinner('Resolving\x20folder\x20\x27'+_0x1de917+'\x27...',()=>_0x21a888[_0x1f79b0(0x14c)]['resolveFolderId'](_0x2ea318,_0x1de917),{'verbose':_0x1c761e['verbose']});_0x210bfb=parseInt(_0x3f7191['data'],0xa),_0x1c761e['verbose']&&console[_0x1f79b0(0x12a)](_0x1f79b0(0x129)+_0x210bfb);}const _0x1a5839=await loadJSONFromOptions(_0x1c761e[_0x1f79b0(0x13a)],_0x1c761e[_0x1f79b0(0x123)]),_0x4f8547={'name':_0x1c761e[_0x1f79b0(0x124)],'description':_0x1c761e[_0x1f79b0(0x133)],'rule':_0x1a5839,'kind':_0x1c761e[_0x1f79b0(0x148)]!==undefined?parseInt(_0x1c761e[_0x1f79b0(0x148)],0xa):undefined,'segmentFolderId':_0x210bfb},_0x14ab46=await withSpinner('Updating\x20segment\x20\x27'+_0x3f0075['segmentName']+_0x1f79b0(0x128),()=>_0x21a888[_0x1f79b0(0x14c)]['updateSegmentById'](_0x2ea318,_0x57d978,_0x4f8547),{'verbose':_0x1c761e[_0x1f79b0(0x142)]}),_0x44efdb=_0x14ab46[_0x1f79b0(0x13e)];return console[_0x1f79b0(0x12a)](_0x1f79b0(0x14d)+_0x44efdb[_0x1f79b0(0x124)]+'\x27'),_0x5ce0b1!==_0x14bf32&&console[_0x1f79b0(0x12a)]('\x20\x20\x20Path:\x20'+_0x5ce0b1),await handleSDKOutput([_0x44efdb],_0x1c761e),0x0;}}
1
+ const a30_0x1ff081=a30_0x8ae7;(function(_0x1191fd,_0xebcb7f){const _0x48fb59=a30_0x8ae7,_0x7cd082=_0x1191fd();while(!![]){try{const _0x5ba01f=-parseInt(_0x48fb59(0x1e2))/0x1*(-parseInt(_0x48fb59(0x1dd))/0x2)+-parseInt(_0x48fb59(0x1de))/0x3+-parseInt(_0x48fb59(0x1f2))/0x4*(-parseInt(_0x48fb59(0x1ce))/0x5)+-parseInt(_0x48fb59(0x1d1))/0x6*(-parseInt(_0x48fb59(0x1ed))/0x7)+-parseInt(_0x48fb59(0x1e3))/0x8+-parseInt(_0x48fb59(0x1d3))/0x9+-parseInt(_0x48fb59(0x1cc))/0xa*(-parseInt(_0x48fb59(0x1f4))/0xb);if(_0x5ba01f===_0xebcb7f)break;else _0x7cd082['push'](_0x7cd082['shift']());}catch(_0x54582a){_0x7cd082['push'](_0x7cd082['shift']());}}}(a30_0x236f,0xe5101));function a30_0x236f(){const _0x302c1b=['execute','verbose','INTERNAL','Resolved\x20folder\x20ID:\x20','yellow','3385698naqjGN','2586510pDjdce','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','segmentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','1JPKDKl','342288BuamgK','Resolving\x20folder\x20\x27','ruleFile','Resolving\x20path\x20\x27','kind','segment','segment:update','segmentName','type','parentId','30226oWAabJ','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','description','Updating\x20segment\x20\x27','error','44180YNVjWT','Segment\x20ID:\x20','1166uOIwtM','Error:\x20Cannot\x20update\x20','\x20\x20\x20Path:\x20','\x27...','resolvePathToResource','100960BZwtkt','segmentPath','5iAYOeL','Segment\x20ID\x20missing\x20from\x20resolved\x20path','folder','306ByFlyD','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','10359819amqeUK','updateSegmentById','name','data','length'];a30_0x236f=function(){return _0x302c1b;};return a30_0x236f();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a30_0x8ae7(_0x133b3b,_0x1e91a0){_0x133b3b=_0x133b3b-0x1ca;const _0x236f0c=a30_0x236f();let _0x8ae761=_0x236f0c[_0x133b3b];return _0x8ae761;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x59bf83 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a30_0x1ff081(0x1d5)]=a30_0x1ff081(0x1e9);[a30_0x1ff081(0x1ef)]='Update\x20existing\x20child\x20segment';async[a30_0x1ff081(0x1d8)](_0x482029){const _0x5143a3=a30_0x1ff081;console[_0x5143a3(0x1f1)](a30_0x59bf83[_0x5143a3(0x1dc)](_0x5143a3(0x1df))),console[_0x5143a3(0x1f1)](a30_0x59bf83[_0x5143a3(0x1dc)](_0x5143a3(0x1ee)));const {options:_0x548334,args:_0xb8d5f4,tdx:_0x2990a6}=_0x482029,_0x1965b7=_0x548334;if(_0xb8d5f4[_0x5143a3(0x1d7)]===0x0)return console[_0x5143a3(0x1f1)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x5143a3(0x1f1)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x5143a3(0x1f1)]('Examples:'),console[_0x5143a3(0x1f1)](_0x5143a3(0x1e1)),console[_0x5143a3(0x1f1)]('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x40e36b=_0xb8d5f4[0x0],_0x508482=_0x548334[_0x5143a3(0x1cd)];let _0x49d03d=_0x40e36b;_0x508482&&!_0x40e36b['includes']('/')&&(_0x49d03d=_0x508482+'/'+_0x40e36b,_0x1965b7['verbose']&&console[_0x5143a3(0x1f1)]('Resolved\x20relative\x20path\x20to:\x20'+_0x49d03d));const _0x4aab86=await withSpinner(_0x5143a3(0x1e6)+_0x49d03d+_0x5143a3(0x1ca),()=>_0x2990a6[_0x5143a3(0x1e8)][_0x5143a3(0x1cb)](_0x49d03d),{'verbose':_0x1965b7[_0x5143a3(0x1d9)]}),_0x169332=_0x4aab86['data'];_0x1965b7[_0x5143a3(0x1d9)]&&console['error']('Resolved\x20type:\x20'+_0x169332[_0x5143a3(0x1eb)]);if(_0x169332[_0x5143a3(0x1eb)]!==_0x5143a3(0x1e8))return console['error'](_0x5143a3(0x1f5)+_0x169332[_0x5143a3(0x1eb)]+_0x5143a3(0x1d2)),console[_0x5143a3(0x1f1)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x169332[_0x5143a3(0x1e0)])throw new SDKError(ErrorCode[_0x5143a3(0x1da)],_0x5143a3(0x1cf));const _0x3d01b2=_0x169332[_0x5143a3(0x1ec)],_0x3e9c9d=_0x169332[_0x5143a3(0x1e0)];_0x1965b7[_0x5143a3(0x1d9)]&&(console[_0x5143a3(0x1f1)]('Parent\x20ID:\x20'+_0x3d01b2),console[_0x5143a3(0x1f1)](_0x5143a3(0x1f3)+_0x3e9c9d));let _0x59a641;if(_0x1965b7[_0x5143a3(0x1d0)]){const _0x1b479c=_0x1965b7[_0x5143a3(0x1d0)],_0xea64c5=await withSpinner(_0x5143a3(0x1e4)+_0x1b479c+_0x5143a3(0x1ca),()=>_0x2990a6[_0x5143a3(0x1e8)]['resolveFolderId'](_0x3d01b2,_0x1b479c),{'verbose':_0x1965b7[_0x5143a3(0x1d9)]});_0x59a641=parseInt(_0xea64c5[_0x5143a3(0x1d6)],0xa),_0x1965b7[_0x5143a3(0x1d9)]&&console[_0x5143a3(0x1f1)](_0x5143a3(0x1db)+_0x59a641);}const _0x266e05=await loadJSONFromOptions(_0x1965b7['rule'],_0x1965b7[_0x5143a3(0x1e5)]),_0x535e48={'name':_0x1965b7['name'],'description':_0x1965b7['description'],'rule':_0x266e05,'kind':_0x1965b7[_0x5143a3(0x1e7)]!==undefined?parseInt(_0x1965b7['kind'],0xa):undefined,'segmentFolderId':_0x59a641},_0x1be4ef=await withSpinner(_0x5143a3(0x1f0)+_0x169332[_0x5143a3(0x1ea)]+_0x5143a3(0x1ca),()=>_0x2990a6[_0x5143a3(0x1e8)][_0x5143a3(0x1d4)](_0x3d01b2,_0x3e9c9d,_0x535e48),{'verbose':_0x1965b7['verbose']}),_0x10fd46=_0x1be4ef[_0x5143a3(0x1d6)];return console[_0x5143a3(0x1f1)]('✔\x20Updated\x20segment\x20\x27'+_0x10fd46[_0x5143a3(0x1d5)]+'\x27'),_0x49d03d!==_0x40e36b&&console[_0x5143a3(0x1f1)](_0x5143a3(0x1f6)+_0x49d03d),await handleSDKOutput([_0x10fd46],_0x1965b7),0x0;}}
@@ -1 +1 @@
1
- const a31_0x1f5fb9=a31_0x3fd7;(function(_0x4e5010,_0x548795){const _0x266c5d=a31_0x3fd7,_0x14a78e=_0x4e5010();while(!![]){try{const _0x4c869b=parseInt(_0x266c5d(0xfc))/0x1*(-parseInt(_0x266c5d(0xe3))/0x2)+parseInt(_0x266c5d(0x114))/0x3*(parseInt(_0x266c5d(0xf4))/0x4)+parseInt(_0x266c5d(0xeb))/0x5+parseInt(_0x266c5d(0x10c))/0x6+parseInt(_0x266c5d(0x107))/0x7*(-parseInt(_0x266c5d(0xe1))/0x8)+-parseInt(_0x266c5d(0x100))/0x9+parseInt(_0x266c5d(0xed))/0xa;if(_0x4c869b===_0x548795)break;else _0x14a78e['push'](_0x14a78e['shift']());}catch(_0x59a60c){_0x14a78e['push'](_0x14a78e['shift']());}}}(a31_0x149b,0xd825f));import{existsSync,statSync}from'fs';import a31_0x3173de from'chalk';function a31_0x3fd7(_0x38cb83,_0x57ba94){_0x38cb83=_0x38cb83-0xe1;const _0x149bb7=a31_0x149b();let _0x3fd70d=_0x149bb7[_0x38cb83];return _0x3fd70d;}import{BaseCommand}from'./command.js';function a31_0x149b(){const _0x2af5c3=['parentName','description','error','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','log','3OOOBid','segment:use','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','Resolved\x20path\x20type:\x20','session','Error:\x20Path\x20is\x20required\x0a','folderPath','434384QNTGvg','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','350908HBPAVw','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','isDirectory','verbose','fullPath','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','cyan','Resolving\x20path\x20\x27','7287120dMlCDW','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','10964020SmmQdc','data','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Examples:','isAbsolute','red','2647736wIseOk','resolvePathToResource','dim','type','segments','Resolved\x20relative\x20path\x20to:\x20','\x27...','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','8VbzCpa','length','green','config','12413808GPMxGo','✔\x20Context\x20set\x20to:\x20','segment','site','folderId','segmentPath','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','147myslQR','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','parent_segment','Target\x20path:\x20','9556710JKHKVh','execute','Use:\x20tdx\x20segment\x20use\x20'];a31_0x149b=function(){return _0x2af5c3;};return a31_0x149b();}import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a31_0x1f5fb9(0x115);[a31_0x1f5fb9(0x110)]=a31_0x1f5fb9(0xe8);async[a31_0x1f5fb9(0x10d)](_0x27369e){const _0xd295a4=a31_0x1f5fb9,{options:_0x1813bb,args:_0x2f3941,tdx:_0x4803c4}=_0x27369e;if(_0x2f3941[_0xd295a4(0xfd)]===0x0)return console['error'](a31_0x3173de[_0xd295a4(0xf3)](_0xd295a4(0x119))),console['error']('Usage:\x20tdx\x20segment\x20use\x20<path>'),console['error'](_0xd295a4(0xf1)),console[_0xd295a4(0x111)](_0xd295a4(0xe4)),console[_0xd295a4(0x111)](_0xd295a4(0xfb)),console[_0xd295a4(0x111)](_0xd295a4(0xec)),console['error'](_0xd295a4(0xf0)),0x1;const _0x2756fe=_0x2f3941[0x0],_0x2611fb=_0x1813bb[_0xd295a4(0x118)];try{if(_0x2756fe==='/')return saveSessionContext({'segment_path':undefined},_0x2611fb),console[_0xd295a4(0x113)](a31_0x3173de['green'](_0xd295a4(0x106))),0x0;if(existsSync(_0x2756fe)&&statSync(_0x2756fe)[_0xd295a4(0xe5)]()){let _0x40d008;try{_0x40d008=findTdxConfig(_0x2756fe);}catch{return console['error'](a31_0x3173de[_0xd295a4(0xf3)](_0xd295a4(0x112)+_0x2756fe)),console[_0xd295a4(0x111)](a31_0x3173de[_0xd295a4(0xe9)](_0xd295a4(0x108))),0x1;}const _0x1c2338=_0x40d008[_0xd295a4(0xff)][_0xd295a4(0x10a)];return saveSessionContext({'segment_path':_0x1c2338,'parent_segment':_0x1c2338},_0x2611fb),console[_0xd295a4(0x113)](a31_0x3173de[_0xd295a4(0xfe)]('✔\x20Context\x20set\x20to:\x20'+a31_0x3173de['cyan'](_0x1c2338))),0x0;}const _0x43be0b=_0x1813bb[_0xd295a4(0x105)];let _0x4ab791=_0x2756fe;const _0x5ae3e8=parsePath(_0x2756fe);if(!_0x5ae3e8[_0xd295a4(0xf2)]){if(!_0x43be0b)return console[_0xd295a4(0x111)](a31_0x3173de[_0xd295a4(0xf3)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0xd295a4(0x111)](a31_0x3173de[_0xd295a4(0xe9)](_0xd295a4(0xe2))),0x1;if(_0x2756fe==='..'){const _0x4f194f=_0x43be0b['split']('/')['slice'](0x0,-0x1)['join']('/');_0x4ab791=_0x4f194f||'/';}else _0x2756fe==='.'?_0x4ab791=_0x43be0b:_0x4ab791=_0x43be0b+'/'+_0x2756fe;_0x1813bb['verbose']&&console['error'](_0xd295a4(0xf9)+_0x4ab791);}if(_0x4ab791==='/'||_0x4ab791==='')return saveSessionContext({'segment_path':undefined},_0x2611fb),console[_0xd295a4(0x113)](a31_0x3173de[_0xd295a4(0xfe)](_0xd295a4(0x106))),0x0;_0x4ab791=normalizePath(_0x4ab791);const _0x28d6e8=parsePath(_0x4ab791)[_0xd295a4(0xf8)];if(_0x28d6e8['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x2611fb),console[_0xd295a4(0x113)](a31_0x3173de[_0xd295a4(0xfe)](_0xd295a4(0x106))),0x0;_0x1813bb[_0xd295a4(0xe6)]&&(console[_0xd295a4(0x111)]('Site:\x20'+_0x1813bb[_0xd295a4(0x103)]),console[_0xd295a4(0x111)](_0xd295a4(0x10b)+_0x4ab791));const _0x28fcea=await withSpinner(_0xd295a4(0xea)+_0x4ab791+_0xd295a4(0xfa),()=>_0x4803c4['segment'][_0xd295a4(0xf5)](_0x4ab791),{'verbose':_0x1813bb[_0xd295a4(0xe6)]}),_0x329120=_0x28fcea[_0xd295a4(0xee)];_0x1813bb['verbose']&&(console[_0xd295a4(0x111)](_0xd295a4(0x117)+_0x329120['type']),console['error']('Parent\x20ID:\x20'+_0x329120['parentId']),_0x329120[_0xd295a4(0x104)]&&console[_0xd295a4(0x111)]('Folder\x20ID:\x20'+_0x329120[_0xd295a4(0x104)]));if(_0x329120[_0xd295a4(0xf7)]===_0xd295a4(0x102))return console[_0xd295a4(0x111)](a31_0x3173de[_0xd295a4(0xf3)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0xd295a4(0x111)](_0xd295a4(0x109)),console['error'](a31_0x3173de[_0xd295a4(0xe9)](_0xd295a4(0x10e)+_0x329120[_0xd295a4(0x10f)]+(_0x329120[_0xd295a4(0x11a)]?'/'+_0x329120[_0xd295a4(0x11a)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x329120[_0xd295a4(0xe7)],'parent_segment':_0x329120[_0xd295a4(0x10f)]},_0x2611fb),console[_0xd295a4(0x113)](a31_0x3173de[_0xd295a4(0xfe)](_0xd295a4(0x101)+a31_0x3173de['cyan'](_0x329120[_0xd295a4(0xe7)]))),_0x1813bb[_0xd295a4(0xe6)]&&(console[_0xd295a4(0x111)](a31_0x3173de[_0xd295a4(0xf6)](_0xd295a4(0x116))),console[_0xd295a4(0x111)](a31_0x3173de['dim'](_0xd295a4(0xef)))),0x0;}catch(_0x4bea66){throw _0x4bea66;}}}
1
+ const a31_0x18595d=a31_0x362f;(function(_0x8bcd9c,_0x414ecf){const _0x4da606=a31_0x362f,_0xa8b502=_0x8bcd9c();while(!![]){try{const _0x5c2c38=-parseInt(_0x4da606(0xc8))/0x1*(-parseInt(_0x4da606(0xc3))/0x2)+-parseInt(_0x4da606(0xd6))/0x3+parseInt(_0x4da606(0xb1))/0x4*(parseInt(_0x4da606(0xcb))/0x5)+-parseInt(_0x4da606(0xc0))/0x6+parseInt(_0x4da606(0xc6))/0x7+parseInt(_0x4da606(0xde))/0x8*(parseInt(_0x4da606(0xab))/0x9)+parseInt(_0x4da606(0xc9))/0xa*(-parseInt(_0x4da606(0xba))/0xb);if(_0x5c2c38===_0x414ecf)break;else _0xa8b502['push'](_0xa8b502['shift']());}catch(_0x179263){_0xa8b502['push'](_0xa8b502['shift']());}}}(a31_0x186e,0x60350));import{existsSync,statSync}from'fs';import a31_0xc78a93 from'chalk';function a31_0x362f(_0x2cd5a4,_0x2fb673){_0x2cd5a4=_0x2cd5a4-0xa6;const _0x186ee3=a31_0x186e();let _0x362f2c=_0x186ee3[_0x2cd5a4];return _0x362f2c;}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';function a31_0x186e(){const _0x3d3789=['Usage:\x20tdx\x20segment\x20use\x20<path>','51928jOTeIc','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','config','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','✔\x20Context\x20set\x20to:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Folder\x20ID:\x20','type','1915969wIALTi','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','folderId','execute','segmentPath','data','660282vOVdui','green','\x27...','366670rgVqrY','Examples:','length','3747422TgNzdr','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','2dADmfz','40fBKDGU','dim','50EDisLr','parent_segment','Site:\x20','segment','Use:\x20tdx\x20segment\x20use\x20','cyan','red','error','Error:\x20Path\x20is\x20required\x0a','verbose','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','167643tacNtY','name','Resolved\x20path\x20type:\x20','parentName','log','site','join','parentId','224872OlkmjY','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','description','Parent\x20ID:\x20','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','segments','72BUUOOZ','split','Resolved\x20relative\x20path\x20to:\x20','slice','isDirectory'];a31_0x186e=function(){return _0x3d3789;};return a31_0x186e();}import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a31_0x18595d(0xd7)]='segment:use';[a31_0x18595d(0xa7)]=a31_0x18595d(0xb3);async[a31_0x18595d(0xbd)](_0x169809){const _0x33a052=a31_0x18595d,{options:_0x13e7d1,args:_0xdcc658,tdx:_0x1957c7}=_0x169809;if(_0xdcc658[_0x33a052(0xc5)]===0x0)return console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xd1)](_0x33a052(0xd3))),console[_0x33a052(0xd2)](_0x33a052(0xb0)),console[_0x33a052(0xd2)](_0x33a052(0xc4)),console[_0x33a052(0xd2)](_0x33a052(0xbb)),console[_0x33a052(0xd2)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x33a052(0xd2)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x33a052(0xd2)](_0x33a052(0xb2)),0x1;const _0x3eb89c=_0xdcc658[0x0],_0x2bc83b=_0x13e7d1['session'];try{if(_0x3eb89c==='/')return saveSessionContext({'segment_path':undefined},_0x2bc83b),console['log'](a31_0xc78a93[_0x33a052(0xc1)](_0x33a052(0xd5))),0x0;if(existsSync(_0x3eb89c)&&statSync(_0x3eb89c)[_0x33a052(0xaf)]()){let _0x3a127f;try{_0x3a127f=findTdxConfig(_0x3eb89c);}catch{return console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xd1)](_0x33a052(0xa9)+_0x3eb89c)),console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xd0)](_0x33a052(0xb7))),0x1;}const _0x5ca641=_0x3a127f[_0x33a052(0xb4)][_0x33a052(0xcc)];return saveSessionContext({'segment_path':_0x5ca641,'parent_segment':_0x5ca641},_0x2bc83b),console['log'](a31_0xc78a93[_0x33a052(0xc1)](_0x33a052(0xb6)+a31_0xc78a93['cyan'](_0x5ca641))),0x0;}const _0x3b41fe=_0x13e7d1[_0x33a052(0xbe)];let _0x24284b=_0x3eb89c;const _0x2229c4=parsePath(_0x3eb89c);if(!_0x2229c4['isAbsolute']){if(!_0x3b41fe)return console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xd1)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console['error'](a31_0xc78a93[_0x33a052(0xd0)](_0x33a052(0xdf))),0x1;if(_0x3eb89c==='..'){const _0xd4d95c=_0x3b41fe[_0x33a052(0xac)]('/')[_0x33a052(0xae)](0x0,-0x1)[_0x33a052(0xdc)]('/');_0x24284b=_0xd4d95c||'/';}else _0x3eb89c==='.'?_0x24284b=_0x3b41fe:_0x24284b=_0x3b41fe+'/'+_0x3eb89c;_0x13e7d1[_0x33a052(0xd4)]&&console[_0x33a052(0xd2)](_0x33a052(0xad)+_0x24284b);}if(_0x24284b==='/'||_0x24284b==='')return saveSessionContext({'segment_path':undefined},_0x2bc83b),console[_0x33a052(0xda)](a31_0xc78a93[_0x33a052(0xc1)](_0x33a052(0xd5))),0x0;_0x24284b=normalizePath(_0x24284b);const _0x357356=parsePath(_0x24284b)[_0x33a052(0xaa)];if(_0x357356['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x2bc83b),console['log'](a31_0xc78a93[_0x33a052(0xc1)](_0x33a052(0xd5))),0x0;_0x13e7d1[_0x33a052(0xd4)]&&(console[_0x33a052(0xd2)](_0x33a052(0xcd)+_0x13e7d1[_0x33a052(0xdb)]),console[_0x33a052(0xd2)]('Target\x20path:\x20'+_0x24284b));const _0x424759=await withSpinner('Resolving\x20path\x20\x27'+_0x24284b+_0x33a052(0xc2),()=>_0x1957c7[_0x33a052(0xce)]['resolvePathToResource'](_0x24284b),{'verbose':_0x13e7d1[_0x33a052(0xd4)]}),_0x54d1c0=_0x424759[_0x33a052(0xbf)];_0x13e7d1[_0x33a052(0xd4)]&&(console['error'](_0x33a052(0xd8)+_0x54d1c0['type']),console[_0x33a052(0xd2)](_0x33a052(0xa8)+_0x54d1c0[_0x33a052(0xdd)]),_0x54d1c0[_0x33a052(0xbc)]&&console[_0x33a052(0xd2)](_0x33a052(0xb8)+_0x54d1c0['folderId']));if(_0x54d1c0[_0x33a052(0xb9)]===_0x33a052(0xce))return console['error'](a31_0xc78a93[_0x33a052(0xd1)](_0x33a052(0xa6))),console[_0x33a052(0xd2)](_0x33a052(0xc7)),console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xd0)](_0x33a052(0xcf)+_0x54d1c0[_0x33a052(0xd9)]+(_0x54d1c0['folderPath']?'/'+_0x54d1c0['folderPath'][_0x33a052(0xdc)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x54d1c0['fullPath'],'parent_segment':_0x54d1c0['parentName']},_0x2bc83b),console[_0x33a052(0xda)](a31_0xc78a93[_0x33a052(0xc1)]('✔\x20Context\x20set\x20to:\x20'+a31_0xc78a93[_0x33a052(0xd0)](_0x54d1c0['fullPath']))),_0x13e7d1['verbose']&&(console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xca)](_0x33a052(0xb5))),console[_0x33a052(0xd2)](a31_0xc78a93[_0x33a052(0xca)]('Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters'))),0x0;}catch(_0x10dedb){throw _0x10dedb;}}}