@treasuredata/tdx 0.14.2 → 0.14.4

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 (149) 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.d.ts.map +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-command.js.map +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.d.ts.map +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-command.js.map +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-command.js +1 -1
  22. package/dist/commands/job-command.js +1 -1
  23. package/dist/commands/journey-command.js +1 -1
  24. package/dist/commands/journey-validate-command.js +1 -1
  25. package/dist/commands/llm-command.js +1 -1
  26. package/dist/commands/llm-proxy.js +1 -1
  27. package/dist/commands/parent-segment-command.js +1 -1
  28. package/dist/commands/profile-command.js +1 -1
  29. package/dist/commands/profiles-command.js +1 -1
  30. package/dist/commands/query-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/tables.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.d.ts +15 -0
  54. package/dist/core/profile.d.ts.map +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/profile.js.map +1 -1
  57. package/dist/core/project-config.js +1 -1
  58. package/dist/core/session.js +1 -1
  59. package/dist/core/user-cache.js +1 -1
  60. package/dist/core/version.js +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/proxy/anthropic-adapter.js +1 -1
  63. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  66. package/dist/proxy/context-signature.js +1 -1
  67. package/dist/proxy/conversation-utils.js +1 -1
  68. package/dist/proxy/passthrough-server.d.ts +13 -2
  69. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/passthrough-server.js.map +1 -1
  72. package/dist/proxy/server.js +1 -1
  73. package/dist/proxy/session-cache.js +1 -1
  74. package/dist/proxy/sse-usage-parser.js +1 -1
  75. package/dist/sdk/agent/agent-config.js +1 -1
  76. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js +1 -1
  78. package/dist/sdk/api.js +1 -1
  79. package/dist/sdk/client/cdp-api-client.js +1 -1
  80. package/dist/sdk/client/endpoints.js +1 -1
  81. package/dist/sdk/client/engage-api-client.js +1 -1
  82. package/dist/sdk/client/http-client.js +1 -1
  83. package/dist/sdk/client/llm-api-client.js +1 -1
  84. package/dist/sdk/client/rate-limiter.js +1 -1
  85. package/dist/sdk/client/td-api-client.js +1 -1
  86. package/dist/sdk/client/trino-api-client.js +1 -1
  87. package/dist/sdk/client/workflow-client.js +1 -1
  88. package/dist/sdk/connection-validator.js +1 -1
  89. package/dist/sdk/connection.js +1 -1
  90. package/dist/sdk/engage.js +1 -1
  91. package/dist/sdk/errors.js +1 -1
  92. package/dist/sdk/index.js +1 -1
  93. package/dist/sdk/io/index.js +1 -1
  94. package/dist/sdk/io/node-filesystem.js +1 -1
  95. package/dist/sdk/job.js +1 -1
  96. package/dist/sdk/journey.js +1 -1
  97. package/dist/sdk/llm/chat-cache.js +1 -1
  98. package/dist/sdk/llm/index.js +1 -1
  99. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  100. package/dist/sdk/llm/model-aliases.js +1 -1
  101. package/dist/sdk/llm/model-factors.js +1 -1
  102. package/dist/sdk/query/index.js +1 -1
  103. package/dist/sdk/query/sql-parser.js +1 -1
  104. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  105. package/dist/sdk/segment/fields-display.js +1 -1
  106. package/dist/sdk/segment/file-discovery.js +1 -1
  107. package/dist/sdk/segment/journey-utils.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-workflow.js +1 -1
  113. package/dist/sdk/segment/resolution-context.js +1 -1
  114. package/dist/sdk/segment/segment-path-parser.js +1 -1
  115. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  116. package/dist/sdk/segment/target-resolution.js +1 -1
  117. package/dist/sdk/segment/tdx-config.js +1 -1
  118. package/dist/sdk/segment/validate-files.js +1 -1
  119. package/dist/sdk/segment/yaml-validator.js +1 -1
  120. package/dist/sdk/segment.js +1 -1
  121. package/dist/sdk/types/index.js +1 -1
  122. package/dist/sdk/types/progress.js +1 -1
  123. package/dist/sdk/user.js +1 -1
  124. package/dist/sdk/util/format-detector.js +1 -1
  125. package/dist/sdk/util/formatters.js +1 -1
  126. package/dist/sdk/util/index.js +1 -1
  127. package/dist/sdk/util/tree-formatter.js +1 -1
  128. package/dist/sdk/workflow/clone-workflow.js +1 -1
  129. package/dist/sdk/workflow/index.js +1 -1
  130. package/dist/sdk/workflow/pull-workflow.js +1 -1
  131. package/dist/sdk/workflow/push-workflow.js +1 -1
  132. package/dist/sdk/workflow/tdx-config.js +1 -1
  133. package/dist/sdk/workflow/workflow-utils.js +1 -1
  134. package/dist/utils/async.js +1 -1
  135. package/dist/utils/colors.js +1 -1
  136. package/dist/utils/diff.js +1 -1
  137. package/dist/utils/file-permissions.js +1 -1
  138. package/dist/utils/json-loader.js +1 -1
  139. package/dist/utils/option-validation.js +1 -1
  140. package/dist/utils/port.js +1 -1
  141. package/dist/utils/process.js +1 -1
  142. package/dist/utils/prompt.js +1 -1
  143. package/dist/utils/spinner.js +1 -1
  144. package/dist/utils/sse-parser.js +1 -1
  145. package/dist/utils/string-utils.js +1 -1
  146. package/dist/utils/table-ref-parser.js +1 -1
  147. package/dist/utils/tdx-logger.js +1 -1
  148. package/dist/utils/version-check.js +1 -1
  149. package/package.json +1 -1
@@ -1 +1 @@
1
- const a25_0xa0b743=a25_0x46e2;(function(_0x55cab0,_0x8c84e7){const _0x241b70=a25_0x46e2,_0x28683a=_0x55cab0();while(!![]){try{const _0x3ec7e6=-parseInt(_0x241b70(0x212))/0x1*(parseInt(_0x241b70(0x250))/0x2)+-parseInt(_0x241b70(0x200))/0x3+parseInt(_0x241b70(0x220))/0x4+parseInt(_0x241b70(0x219))/0x5+-parseInt(_0x241b70(0x1f5))/0x6*(-parseInt(_0x241b70(0x243))/0x7)+parseInt(_0x241b70(0x24a))/0x8+-parseInt(_0x241b70(0x1f2))/0x9;if(_0x3ec7e6===_0x8c84e7)break;else _0x28683a['push'](_0x28683a['shift']());}catch(_0x55c8d9){_0x28683a['push'](_0x28683a['shift']());}}}(a25_0xb8e9,0x81935));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x1e7ed9 from'chalk';async function resolveSegmentTarget(_0x37b8ed,_0x33544d,_0x11f520){const _0x2e9876=a25_0x46e2;if(isYamlFilePath(_0x37b8ed))try{const _0x4a3322=await resolveYamlFilePath(_0x37b8ed);return _0x11f520&&(console[_0x2e9876(0x206)](_0x2e9876(0x1f9)+_0x37b8ed),console[_0x2e9876(0x206)](_0x2e9876(0x227)+_0x4a3322[_0x2e9876(0x275)]),console[_0x2e9876(0x206)]('\x20\x20Segment\x20name:\x20'+_0x4a3322[_0x2e9876(0x1f8)]),console[_0x2e9876(0x206)](_0x2e9876(0x278)+(_0x4a3322[_0x2e9876(0x27b)]||_0x2e9876(0x24b))),console[_0x2e9876(0x206)]('\x20\x20Full\x20path:\x20'+_0x4a3322[_0x2e9876(0x26d)])),_0x4a3322['fullPath'];}catch(_0x4a8885){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2e9876(0x265)+_0x4a8885[_0x2e9876(0x27c)]);}if(!_0x33544d)throw new SDKError(ErrorCode[_0x2e9876(0x245)],_0x2e9876(0x21c));return _0x33544d+'/'+_0x37b8ed;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0xa0b743(0x267);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x22a);async[a25_0xa0b743(0x1eb)](_0x32bda9){const _0x2492a4=a25_0xa0b743,{options:_0x3fb9f0,args:_0x572fa6,tdx:_0x3064ce}=_0x32bda9,_0x477c93=_0x572fa6[0x0],_0x184ef0=!_0x477c93&&!!_0x3fb9f0[_0x2492a4(0x275)],_0x5dd4c3=_0x477c93||_0x3fb9f0[_0x2492a4(0x275)];if(!_0x5dd4c3)return console[_0x2492a4(0x206)](_0x2492a4(0x226)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2492a4(0x206)]('Examples:'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x2492a4(0x206)](_0x2492a4(0x235)),console[_0x2492a4(0x206)](_0x2492a4(0x270)),console[_0x2492a4(0x206)](_0x2492a4(0x1e6)),0x1;try{const _0x9937b=_0x3fb9f0['segmentPath'];let _0x4cc7af=_0x5dd4c3;!_0x184ef0&&_0x9937b&&!_0x5dd4c3[_0x2492a4(0x242)]('/')&&(_0x4cc7af=_0x9937b+'/'+_0x5dd4c3,_0x3fb9f0[_0x2492a4(0x1ef)]&&console[_0x2492a4(0x206)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4cc7af));const _0x51152d=await withSpinner('Resolving\x20path\x20\x27'+_0x4cc7af+_0x2492a4(0x27e),()=>_0x3064ce[_0x2492a4(0x27d)]['resolvePathToResource'](_0x4cc7af),{'verbose':_0x3fb9f0['verbose']}),_0x3110fd=_0x51152d['data'];_0x3fb9f0['verbose']&&(console[_0x2492a4(0x206)](_0x2492a4(0x268)+_0x3110fd['type']),console['error'](_0x2492a4(0x224)+_0x3110fd[_0x2492a4(0x276)]),_0x3110fd['folderId']&&console[_0x2492a4(0x206)](_0x2492a4(0x1ff)+_0x3110fd[_0x2492a4(0x1f1)]),_0x3110fd['segmentId']&&console[_0x2492a4(0x206)](_0x2492a4(0x1ee)+_0x3110fd[_0x2492a4(0x233)]));if(_0x3110fd[_0x2492a4(0x21d)]===_0x2492a4(0x25a)){const _0x51e314=await withSpinner(_0x2492a4(0x262),()=>_0x3064ce[_0x2492a4(0x27d)][_0x2492a4(0x228)](_0x3110fd[_0x2492a4(0x276)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x51e314[_0x2492a4(0x256)],_0x3fb9f0);}else{if(_0x3110fd[_0x2492a4(0x21d)]===_0x2492a4(0x251)){if(!_0x3110fd[_0x2492a4(0x1f1)])throw new SDKError(ErrorCode[_0x2492a4(0x216)],_0x2492a4(0x22e));const _0x8acc20=await withSpinner(_0x2492a4(0x25d),()=>_0x3064ce[_0x2492a4(0x27d)][_0x2492a4(0x261)](_0x3110fd[_0x2492a4(0x1f1)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x8acc20[_0x2492a4(0x256)],_0x3fb9f0);}else{if(_0x3110fd[_0x2492a4(0x21d)]==='segment'){if(!_0x3110fd['segmentId'])throw new SDKError(ErrorCode[_0x2492a4(0x21b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x138caa=await withSpinner(_0x2492a4(0x208),()=>_0x3064ce['segment'][_0x2492a4(0x25f)](_0x3110fd['parentId'],_0x3110fd[_0x2492a4(0x233)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x138caa[_0x2492a4(0x256)],_0x3fb9f0);}}}return 0x0;}catch(_0x3d7297){if(_0x3d7297 instanceof SDKError)return console[_0x2492a4(0x206)]('Error:\x20'+_0x3d7297[_0x2492a4(0x27c)]),_0x3d7297[_0x2492a4(0x23a)]&&console[_0x2492a4(0x206)]('\x20\x20Cause:\x20'+_0x3d7297['cause']),0x1;throw _0x3d7297;}}}export class SegmentShowCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x26e);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x1fb);async['execute'](_0x1e3e96){const _0x333cf0=a25_0xa0b743,{options:_0x2ad473,args:_0x2b1d16,tdx:_0x382aa0}=_0x1e3e96,_0x348b47=_0x2b1d16[0x0];if(!_0x348b47)return console[_0x333cf0(0x206)](_0x333cf0(0x234)),console[_0x333cf0(0x206)](_0x333cf0(0x217)),console[_0x333cf0(0x206)](_0x333cf0(0x236)),console[_0x333cf0(0x206)](_0x333cf0(0x204)),console[_0x333cf0(0x206)](_0x333cf0(0x22b)),console[_0x333cf0(0x206)](_0x333cf0(0x1e8)),0x1;try{const _0x5c99e9=_0x2ad473[_0x333cf0(0x275)],_0x495937=await resolveSegmentTarget(_0x348b47,_0x5c99e9,_0x2ad473[_0x333cf0(0x1ef)]);_0x2ad473[_0x333cf0(0x1ef)]&&console['error']('Target\x20path:\x20'+_0x495937);const _0x192f29=await withSpinner(_0x333cf0(0x26b)+_0x348b47+_0x333cf0(0x27e),()=>_0x382aa0[_0x333cf0(0x27d)][_0x333cf0(0x230)](_0x495937),{'verbose':_0x2ad473[_0x333cf0(0x1ef)]}),_0x2cc749=_0x192f29[_0x333cf0(0x256)];_0x2ad473[_0x333cf0(0x1ef)]&&(console[_0x333cf0(0x206)](_0x333cf0(0x268)+_0x2cc749[_0x333cf0(0x21d)]),console[_0x333cf0(0x206)](_0x333cf0(0x224)+_0x2cc749[_0x333cf0(0x276)]));if(_0x2cc749[_0x333cf0(0x21d)]===_0x333cf0(0x251))return console[_0x333cf0(0x206)](_0x333cf0(0x260)),console['error'](_0x333cf0(0x211)),0x1;if(_0x2cc749[_0x333cf0(0x21d)]===_0x333cf0(0x25a))return console[_0x333cf0(0x206)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x333cf0(0x206)](_0x333cf0(0x1fa)),0x1;if(!_0x2cc749['segmentId'])throw new SDKError(ErrorCode[_0x333cf0(0x21b)],_0x333cf0(0x22d));const _0x1897db=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x382aa0[_0x333cf0(0x27d)][_0x333cf0(0x207)](_0x2cc749[_0x333cf0(0x276)],_0x2cc749['segmentId']),{'verbose':_0x2ad473[_0x333cf0(0x1ef)]});let _0x2994c9=_0x1897db['data'];const _0x2ee28d=resolveLimit(_0x2ad473['limit'],DEFAULT_DISPLAY_LIMIT),_0x5be6b9=/\bLIMIT\s+\d+/i['test'](_0x2994c9);!_0x5be6b9&&(_0x2994c9=_0x2994c9[_0x333cf0(0x25c)]()['replace'](/;+$/,''),_0x2994c9=_0x333cf0(0x222)+_0x2994c9+_0x333cf0(0x24f)+_0x2ee28d);_0x2ad473['verbose']&&console['error'](_0x333cf0(0x253)+_0x2994c9);const _0x15f35b=await withProgressSpinner(_0x333cf0(0x257),async _0x46b9b9=>{const _0x59aa74=_0x333cf0,_0x1d8d51=await _0x382aa0[_0x59aa74(0x22f)][_0x59aa74(0x1eb)](_0x2994c9,{'catalog':'td','schema':'information_schema','onJobId':_0x3a1cda=>{_0x46b9b9['setJobId'](_0x3a1cda);}});return _0x1d8d51;},{'verbose':_0x2ad473[_0x333cf0(0x1ef)]}),_0x5c180d=_0x15f35b['data'],_0x23b00f=_0x5c180d[_0x333cf0(0x248)]?_0x333cf0(0x274)+_0x5c180d[_0x333cf0(0x248)]+']':'';return console['error'](_0x333cf0(0x232)+_0x5c180d[_0x333cf0(0x246)][_0x333cf0(0x277)]['toLocaleString']()+_0x333cf0(0x273)+(_0x333cf0(0x239)+formatElapsed(_0x5c180d['stats']['elapsedTimeMillis'])+_0x23b00f)),await handleQueryOutput(_0x5c180d,_0x2ad473),0x0;}catch(_0x61afc2){if(_0x61afc2 instanceof SDKError)return console[_0x333cf0(0x206)]('✖\x20Query\x20failed\x20['+_0x61afc2[_0x333cf0(0x1e7)]+']'),console['error']('\x0a'+_0x61afc2[_0x333cf0(0x27c)]),0x1;throw _0x61afc2;}}}function a25_0xb8e9(){const _0x374708=['INVALID_ARGUMENT','stats','Use:\x20tdx\x20ps\x20desc','jobId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','4872344iEMtDT','(root)','Usage:\x20tdx\x20sg\x20sql\x20<name>','/e/','Use:\x20tdx\x20ps\x20view\x20-w','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','2uQjuTd','folder','segment:view','SQL\x20query:\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','data','Executing\x20segment\x20query...','Show\x20segment\x20folder\x20details','Error:\x20','parent','/app/ps/','trim','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getSegment','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','getFolder','Fetching\x20parent\x20segment\x20details...','Fetching\x20folder\x20\x27','segment:folder:show','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','name','segment:describe','Resolved\x20type:\x20','parentFolder','cyan','Resolving\x20\x27','Parent\x20name:\x20','fullPath','segment:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27\x20with\x20ID:\x20','\x20rows\x20','\x20[Job\x20ID:\x20','parentSegment','parentId','processedRows','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','folderPath','message','segment','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','code','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Creating\x20folder\x20\x27','execute','Show\x20child\x20segment\x20schema\x20(column\x20types)','description','Segment\x20ID:\x20','verbose','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','11528847SqUwAh','Site:\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','66rlEhaa','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','listFolders','segmentName','Resolved\x20YAML\x20file:\x20','Use:\x20tdx\x20ps\x20show','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolving\x20parent\x20segment\x20\x27','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20sql','Folder\x20ID:\x20','96909kPQMSC','✔\x20Found\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','Examples:','Create\x20segment\x20folder\x20for\x20organization','error','getSegmentSQL','Fetching\x20segment\x20details...','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Parent\x20segment:\x20','Resolving\x20folder\x20\x27','format','✔\x20Created\x20folder\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','log','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','573499wbtvBg','site','Error:\x20Folder\x20reference\x20is\x20required','web','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','1609550lGsCmh','Fetching\x20SQL\x20for\x20segment...','SEGMENT_NOT_FOUND','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','type','length','segment:desc','2713568dZLJgW','segment:sql','SELECT\x20*\x20FROM\x20(\x0a','createFolder','Parent\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20Parent\x20segment:\x20','getParent','resolveParentId','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Target\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','query','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','✔\x20Query\x20completed:\x20Processed\x20','segmentId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:folder:create','in\x20','cause','\x20\x20Cause:\x20','Listing\x20folders\x20for\x20parent\x20\x27','url','Resolved\x20parent\x20ID:\x20','\x20Opening\x20','\x20folder','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','includes','514297hGwWzN','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'];a25_0xb8e9=function(){return _0x374708;};return a25_0xb8e9();}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x210);async[a25_0xa0b743(0x1eb)](_0x334c11){const _0x18cfab=a25_0xa0b743,{options:_0x3d5747,args:_0x4ffd6f,tdx:_0x454016}=_0x334c11;if(_0x4ffd6f[_0x18cfab(0x21e)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x18cfab(0x206)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x4b10f4=_0x4ffd6f[0x0];try{_0x3d5747[_0x18cfab(0x1ef)]&&(console['error']('Site:\x20'+_0x3d5747[_0x18cfab(0x213)]),console[_0x18cfab(0x206)]('Parent\x20name:\x20'+_0x4b10f4));const _0x10354b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4b10f4+_0x18cfab(0x27e),()=>_0x454016['segment'][_0x18cfab(0x229)](_0x4b10f4),{'verbose':_0x3d5747[_0x18cfab(0x1ef)]}),_0x3ec745=_0x10354b['data'];_0x3d5747['verbose']&&console['error'](_0x18cfab(0x23e)+_0x3ec745);const _0x249d35=await withSpinner(_0x18cfab(0x23c)+_0x4b10f4+_0x18cfab(0x27e),()=>_0x454016[_0x18cfab(0x27d)][_0x18cfab(0x1f7)](_0x3ec745),{'verbose':_0x3d5747[_0x18cfab(0x1ef)]}),_0x3f7128=_0x249d35[_0x18cfab(0x256)];return console[_0x18cfab(0x206)](_0x18cfab(0x201)+_0x3f7128[_0x18cfab(0x21e)]+_0x18cfab(0x240)+(_0x3f7128[_0x18cfab(0x21e)]!==0x1?'s':'')),await handleSDKOutput(_0x3f7128,_0x3d5747),0x0;}catch(_0xe4c08a){if(_0xe4c08a instanceof SDKError)return console[_0x18cfab(0x206)]('Error:\x20'+_0xe4c08a['message']),_0xe4c08a[_0x18cfab(0x23a)]&&console[_0x18cfab(0x206)](_0x18cfab(0x23b)+_0xe4c08a[_0x18cfab(0x23a)]),0x1;throw _0xe4c08a;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a25_0xa0b743(0x264);['description']=a25_0xa0b743(0x258);async[a25_0xa0b743(0x1eb)](_0x87c9bc){const _0x19595f=a25_0xa0b743,{options:_0x587d86,args:_0x2b8424,tdx:_0x54b796}=_0x87c9bc;if(_0x2b8424[_0x19595f(0x21e)]===0x0)return console['error'](_0x19595f(0x214)),console[_0x19595f(0x206)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x5b4941,childId:_0x50df3a}=parseSegmentRef(_0x2b8424[0x0]);_0x587d86[_0x19595f(0x1ef)]&&(console[_0x19595f(0x206)]('Site:\x20'+_0x587d86[_0x19595f(0x213)]),console['error'](_0x19595f(0x26c)+_0x5b4941),_0x50df3a&&console[_0x19595f(0x206)](_0x19595f(0x1fd)+_0x50df3a));if(!_0x50df3a)return console[_0x19595f(0x206)](_0x19595f(0x209)),0x1;const _0x44bb2e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5b4941+_0x19595f(0x27e),()=>_0x54b796['segment'][_0x19595f(0x229)](_0x5b4941),{'verbose':_0x587d86[_0x19595f(0x1ef)]}),_0x4ddbf1=_0x44bb2e[_0x19595f(0x256)];_0x587d86[_0x19595f(0x1ef)]&&console[_0x19595f(0x206)]('Resolved\x20parent\x20ID:\x20'+_0x4ddbf1);const _0x52b62b=await withSpinner(_0x19595f(0x20b)+_0x50df3a+_0x19595f(0x27e),()=>_0x54b796[_0x19595f(0x27d)][_0x19595f(0x203)](_0x4ddbf1,_0x50df3a),{'verbose':_0x587d86[_0x19595f(0x1ef)]}),_0x42b375=_0x52b62b[_0x19595f(0x256)];_0x587d86[_0x19595f(0x1ef)]&&console[_0x19595f(0x206)]('Resolved\x20folder\x20ID:\x20'+_0x42b375);const _0x173b3f=await withSpinner(_0x19595f(0x263)+_0x50df3a+'\x27...',()=>_0x54b796[_0x19595f(0x27d)][_0x19595f(0x261)](_0x42b375),{'verbose':_0x587d86[_0x19595f(0x1ef)]});return await handleSDKOutput([_0x173b3f['data']],_0x587d86),0x0;}catch(_0x2f49a1){if(_0x2f49a1 instanceof SDKError)return console[_0x19595f(0x206)]('Error:\x20'+_0x2f49a1['message']),_0x2f49a1['cause']&&console[_0x19595f(0x206)]('\x20\x20Cause:\x20'+_0x2f49a1[_0x19595f(0x23a)]),0x1;throw _0x2f49a1;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x221);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0xcb0557){const _0x3a8f5b=a25_0xa0b743,{options:_0x23c9b1,args:_0x2d35dd,tdx:_0x22f59f}=_0xcb0557,_0x2f2eab=_0x2d35dd[0x0];if(!_0x2f2eab)return console['error'](_0x3a8f5b(0x234)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x24c)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x204)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x237)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x279)),0x1;try{const _0x50868c=_0x23c9b1['parentSegment'],_0x703950=await resolveSegmentTarget(_0x2f2eab,_0x50868c,_0x23c9b1['verbose']);_0x23c9b1['verbose']&&console['error'](_0x3a8f5b(0x22c)+_0x703950);const _0x1a67c3=await withSpinner(_0x3a8f5b(0x26b)+_0x2f2eab+_0x3a8f5b(0x27e),()=>_0x22f59f[_0x3a8f5b(0x27d)][_0x3a8f5b(0x230)](_0x703950),{'verbose':_0x23c9b1['verbose']}),_0x1805c0=_0x1a67c3['data'];_0x23c9b1[_0x3a8f5b(0x1ef)]&&(console[_0x3a8f5b(0x206)](_0x3a8f5b(0x268)+_0x1805c0[_0x3a8f5b(0x21d)]),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x224)+_0x1805c0[_0x3a8f5b(0x276)]));if(_0x1805c0['type']===_0x3a8f5b(0x251))return console[_0x3a8f5b(0x206)](_0x3a8f5b(0x1f4)),console['error'](_0x3a8f5b(0x25e)),0x1;if(_0x1805c0[_0x3a8f5b(0x21d)]===_0x3a8f5b(0x25a))return console[_0x3a8f5b(0x206)](_0x3a8f5b(0x202)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x1fe)),0x1;if(!_0x1805c0[_0x3a8f5b(0x233)])throw new SDKError(ErrorCode[_0x3a8f5b(0x21b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1bcbfe=await withSpinner(_0x3a8f5b(0x21a),()=>_0x22f59f['segment']['getSegmentSQL'](_0x1805c0[_0x3a8f5b(0x276)],_0x1805c0['segmentId']),{'verbose':_0x23c9b1[_0x3a8f5b(0x1ef)]}),_0x35c008=_0x1bcbfe[_0x3a8f5b(0x256)];return _0x23c9b1[_0x3a8f5b(0x20c)]==='json'||_0x23c9b1[_0x3a8f5b(0x20c)]==='jsonl'?await handleSDKOutput([{'sql':_0x35c008}],_0x23c9b1):console[_0x3a8f5b(0x20f)](_0x35c008),0x0;}catch(_0x5efd66){if(_0x5efd66 instanceof SDKError)return console[_0x3a8f5b(0x206)]('Error:\x20'+_0x5efd66[_0x3a8f5b(0x27c)]),_0x5efd66[_0x3a8f5b(0x23a)]&&console[_0x3a8f5b(0x206)](_0x3a8f5b(0x23b)+_0x5efd66[_0x3a8f5b(0x23a)]),0x1;throw _0x5efd66;}}}function a25_0x46e2(_0x1fa089,_0x2c8d80){_0x1fa089=_0x1fa089-0x1e6;const _0xb8e96a=a25_0xb8e9();let _0x46e23d=_0xb8e96a[_0x1fa089];return _0x46e23d;}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x238);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x205);async[a25_0xa0b743(0x1eb)](_0x32b0bd){const _0x1d2683=a25_0xa0b743,{options:_0x56de62,args:_0x1c569c,tdx:_0x51091a}=_0x32b0bd,_0x99125=_0x56de62;if(_0x1c569c[_0x1d2683(0x21e)]<0x2)return console['error'](_0x1d2683(0x1f6)),console[_0x1d2683(0x206)](_0x1d2683(0x249)),0x1;const _0x91bdde=_0x1c569c[0x0],_0x7e3dc0=_0x1c569c[0x1];_0x99125[_0x1d2683(0x1ef)]&&(console[_0x1d2683(0x206)](_0x1d2683(0x1f3)+_0x99125[_0x1d2683(0x213)]),console[_0x1d2683(0x206)](_0x1d2683(0x20a)+_0x91bdde),console[_0x1d2683(0x206)](_0x1d2683(0x1fd)+_0x7e3dc0));let _0x3f7ad6;if(_0x99125[_0x1d2683(0x269)]){const _0x180b42=_0x99125[_0x1d2683(0x269)],_0x21523d=await withSpinner(_0x1d2683(0x1fc)+_0x91bdde+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x229)](_0x91bdde),{'verbose':_0x99125['verbose']}),_0x5c470b=_0x21523d[_0x1d2683(0x256)],_0x2b948b=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x180b42+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x203)](_0x5c470b,_0x180b42),{'verbose':_0x99125[_0x1d2683(0x1ef)]});_0x3f7ad6=_0x2b948b['data'],_0x99125['verbose']&&console[_0x1d2683(0x206)](_0x1d2683(0x254)+_0x3f7ad6);}const _0x192de1={'name':_0x7e3dc0,'description':_0x99125[_0x1d2683(0x1ed)],'parentFolderId':_0x3f7ad6},_0x45fdfa=await withSpinner(_0x1d2683(0x1ea)+_0x7e3dc0+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x223)](_0x91bdde,_0x192de1),{'verbose':_0x99125[_0x1d2683(0x1ef)]}),_0xe12101=_0x45fdfa[_0x1d2683(0x256)];return console[_0x1d2683(0x206)](_0x1d2683(0x20d)+_0xe12101['name']+_0x1d2683(0x272)+_0xe12101['id']),await handleSDKOutput([_0xe12101],_0x99125),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a25_0xa0b743(0x252);[a25_0xa0b743(0x1ed)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a25_0xa0b743(0x1eb)](_0x16f451){const _0x560eca=a25_0xa0b743,{options:_0x2007b7,args:_0x1a3a4e,tdx:_0x4c4ee7}=_0x16f451,_0x1940d0=_0x1a3a4e[0x0];if(!_0x1940d0)return console[_0x560eca(0x206)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x560eca(0x206)](_0x560eca(0x20e)),console['error'](_0x560eca(0x26f)),console[_0x560eca(0x206)]('Options:'),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x560eca(0x206)]('Examples:'),console[_0x560eca(0x206)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x560eca(0x231)),console[_0x560eca(0x206)](_0x560eca(0x218)),console['error'](_0x560eca(0x271)),0x1;try{const _0x2196dd=_0x2007b7['parentSegment'],_0x1a283a=await resolveSegmentTarget(_0x1940d0,_0x2196dd,_0x2007b7[_0x560eca(0x1ef)]);_0x2007b7[_0x560eca(0x1ef)]&&console[_0x560eca(0x206)](_0x560eca(0x22c)+_0x1a283a);const _0x399b10=await withSpinner(_0x560eca(0x26b)+_0x1940d0+_0x560eca(0x27e),()=>_0x4c4ee7[_0x560eca(0x27d)]['resolvePathToResource'](_0x1a283a),{'verbose':_0x2007b7[_0x560eca(0x1ef)]}),_0x35e231=_0x399b10['data'];_0x2007b7['verbose']&&(console[_0x560eca(0x206)](_0x560eca(0x268)+_0x35e231[_0x560eca(0x21d)]),console[_0x560eca(0x206)]('Parent\x20ID:\x20'+_0x35e231[_0x560eca(0x276)]),_0x35e231[_0x560eca(0x1f1)]&&console['error']('Folder\x20ID:\x20'+_0x35e231['folderId']),_0x35e231[_0x560eca(0x233)]&&console[_0x560eca(0x206)](_0x560eca(0x1ee)+_0x35e231[_0x560eca(0x233)]));if(_0x2007b7[_0x560eca(0x215)]){if(_0x35e231[_0x560eca(0x21d)]===_0x560eca(0x251))return console[_0x560eca(0x206)](_0x560eca(0x244)),0x1;if(_0x35e231['type']===_0x560eca(0x25a))return console['error'](_0x560eca(0x255)),console[_0x560eca(0x206)](_0x560eca(0x24e)),0x1;if(!_0x35e231[_0x560eca(0x233)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38b344=getConsoleNextUrl(_0x2007b7[_0x560eca(0x213)],_0x560eca(0x25b)+_0x35e231['parentId']+_0x560eca(0x24d)+_0x35e231[_0x560eca(0x233)]);return console['error'](a25_0x1e7ed9['green']('✔')+_0x560eca(0x23f)+a25_0x1e7ed9[_0x560eca(0x26a)](_0x38b344)),openBrowser(_0x38b344),0x0;}if(_0x35e231['type']===_0x560eca(0x251)){if(!_0x35e231[_0x560eca(0x1f1)])throw new SDKError(ErrorCode[_0x560eca(0x216)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x25ce19=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4c4ee7[_0x560eca(0x27d)][_0x560eca(0x261)](_0x35e231[_0x560eca(0x1f1)]),{'verbose':_0x2007b7['verbose']});await handleSingleObjectOutput(_0x25ce19[_0x560eca(0x256)],_0x2007b7);}else{if(_0x35e231[_0x560eca(0x21d)]==='segment'){if(!_0x35e231[_0x560eca(0x233)])throw new SDKError(ErrorCode[_0x560eca(0x21b)],_0x560eca(0x22d));const _0x48cfe4=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4c4ee7[_0x560eca(0x27d)][_0x560eca(0x25f)](_0x35e231[_0x560eca(0x276)],_0x35e231['segmentId']),{'verbose':_0x2007b7[_0x560eca(0x1ef)]}),_0x3af575=getConsoleNextUrl(_0x2007b7[_0x560eca(0x213)],'/app/ps/'+_0x35e231[_0x560eca(0x276)]+'/e/'+_0x35e231['segmentId']),_0x404505=_0x48cfe4[_0x560eca(0x256)];_0x404505[_0x560eca(0x23d)]=_0x3af575,await handleSingleObjectOutput(_0x404505,_0x2007b7);}else return console[_0x560eca(0x206)](_0x560eca(0x225)),console[_0x560eca(0x206)](_0x560eca(0x27a)),0x1;}return 0x0;}catch(_0x539f88){if(_0x539f88 instanceof SDKError)return console[_0x560eca(0x206)]('Error:\x20'+_0x539f88[_0x560eca(0x27c)]),_0x539f88[_0x560eca(0x23a)]&&console[_0x560eca(0x206)](_0x560eca(0x23b)+_0x539f88[_0x560eca(0x23a)]),0x1;throw _0x539f88;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x21f);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x1ec);async[a25_0xa0b743(0x1eb)](_0x449f96){const _0x2b0fe2=a25_0xa0b743,{options:_0x5bdb82,args:_0x561e28,tdx:_0x245fad}=_0x449f96,_0x111791=_0x561e28[0x0];if(!_0x111791)return console['error'](_0x2b0fe2(0x234)),console[_0x2b0fe2(0x206)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x2b0fe2(0x1e9)),console[_0x2b0fe2(0x206)]('Examples:'),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x241)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3bfbeb=_0x5bdb82[_0x2b0fe2(0x275)],_0x47335b=await resolveSegmentTarget(_0x111791,_0x3bfbeb,_0x5bdb82[_0x2b0fe2(0x1ef)]);_0x5bdb82['verbose']&&console[_0x2b0fe2(0x206)](_0x2b0fe2(0x22c)+_0x47335b);const _0x31457b=await withSpinner(_0x2b0fe2(0x26b)+_0x111791+_0x2b0fe2(0x27e),()=>_0x245fad[_0x2b0fe2(0x27d)]['resolvePathToResource'](_0x47335b),{'verbose':_0x5bdb82[_0x2b0fe2(0x1ef)]}),_0x1a3ca5=_0x31457b['data'];_0x5bdb82[_0x2b0fe2(0x1ef)]&&(console['error'](_0x2b0fe2(0x268)+_0x1a3ca5[_0x2b0fe2(0x21d)]),console['error']('Parent\x20ID:\x20'+_0x1a3ca5[_0x2b0fe2(0x276)]));if(_0x1a3ca5[_0x2b0fe2(0x21d)]==='folder')return console[_0x2b0fe2(0x206)](_0x2b0fe2(0x1f0)),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x25e)),0x1;if(_0x1a3ca5['type']===_0x2b0fe2(0x25a))return console[_0x2b0fe2(0x206)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x247)),0x1;if(!_0x1a3ca5['segmentId'])throw new SDKError(ErrorCode[_0x2b0fe2(0x21b)],_0x2b0fe2(0x22d));const _0x25d8dc=await withSpinner(_0x2b0fe2(0x21a),()=>_0x245fad['segment']['getSegmentSQL'](_0x1a3ca5[_0x2b0fe2(0x276)],_0x1a3ca5['segmentId']),{'verbose':_0x5bdb82[_0x2b0fe2(0x1ef)]}),_0x5326b0=_0x25d8dc[_0x2b0fe2(0x256)],_0x2a3bb3=await executeSchemaQuery(_0x5326b0,_0x245fad,_0x5bdb82);return await handleQueryOutput(_0x2a3bb3,_0x5bdb82),0x0;}catch(_0x80070f){if(_0x80070f instanceof SDKError)return console['error'](_0x2b0fe2(0x259)+_0x80070f[_0x2b0fe2(0x27c)]),_0x80070f[_0x2b0fe2(0x23a)]&&console[_0x2b0fe2(0x206)](_0x2b0fe2(0x23b)+_0x80070f['cause']),0x1;throw _0x80070f;}}}
1
+ const a25_0x2e3233=a25_0x48cb;(function(_0x48a20a,_0x3859b0){const _0x37a052=a25_0x48cb,_0x5080e0=_0x48a20a();while(!![]){try{const _0x264a59=-parseInt(_0x37a052(0x18c))/0x1*(-parseInt(_0x37a052(0x194))/0x2)+-parseInt(_0x37a052(0x18d))/0x3+-parseInt(_0x37a052(0x1bb))/0x4+parseInt(_0x37a052(0x160))/0x5+parseInt(_0x37a052(0x17e))/0x6+-parseInt(_0x37a052(0x15a))/0x7*(-parseInt(_0x37a052(0x165))/0x8)+parseInt(_0x37a052(0x1c4))/0x9;if(_0x264a59===_0x3859b0)break;else _0x5080e0['push'](_0x5080e0['shift']());}catch(_0x21859b){_0x5080e0['push'](_0x5080e0['shift']());}}}(a25_0x52fb,0x5554c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a25_0x52fb(){const _0x21ff2d=['error','trim','folderPath','Show\x20segment\x20folder\x20details','294vaZhUZ','verbose','Fetching\x20folder\x20\x27','\x20Opening\x20','length','segment:desc','2030865CudPrN','Usage:\x20tdx\x20sg\x20desc\x20<name>','/e/','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20sg\x20show\x20<name>','56696DRygZR','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','/app/ps/','parentFolder','message','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20sql','segmentName','segment:folder:list','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Parent\x20name:\x20','resolvePathToResource','✔\x20Created\x20folder\x20\x27','getSegment','type','green','jsonl','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Folder\x20ID:\x20','query','Error:\x20Folder\x20reference\x20is\x20required','Folder\x20name:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','1462308PuHpRE','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','createFolder','parentSegment','description','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','format','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','SEGMENT_FOLDER_NOT_FOUND','5qFyZHr','1502487BtUAOL','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Folder\x20path:\x20','SQL\x20query:\x0a','Executing\x20segment\x20query...','Resolved\x20type:\x20','log','39716lBSxZJ','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Resolved\x20relative\x20path\x20to:\x20','folder','Error:\x20','Use:\x20tdx\x20ps\x20view\x20-w','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','folderId','segment:folder:create','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Show\x20child\x20segment\x20schema\x20(column\x20types)','SEGMENT_NOT_FOUND','name','Listing\x20folders\x20for\x20parent\x20\x27','segment:sql','parent','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20folder','elapsedTimeMillis','Resolving\x20\x27','execute','url','code','Fetching\x20parent\x20segment\x20details...','Create\x20segment\x20folder\x20for\x20organization','segment:folder:show','in\x20','stats','fullPath','includes','jobId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','(root)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','\x27...','1550456gogsVX','Options:','Site:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20parent\x20folder\x20ID:\x20','toLocaleString','Examples:','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segmentId','1720116QMBVtm','Resolving\x20path\x20\x27','\x20\x20Cause:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','web','Show\x20folder\x20or\x20child\x20segment\x20details','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:show','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:view','INVALID_ARGUMENT','replace','getFolder','Parent\x20segment:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','limit','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Segment\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','cause','✔\x20Found\x20','Resolved\x20YAML\x20file:\x20','Target\x20path:\x20','parentId','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','resolveParentId','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segment','site','Fetching\x20SQL\x20for\x20segment...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Use:\x20tdx\x20ps\x20show','Use:\x20tdx\x20ps\x20desc','\x20rows\x20','listFolders','data'];a25_0x52fb=function(){return _0x21ff2d;};return a25_0x52fb();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a25_0x48cb(_0x55c0a3,_0x230bb1){_0x55c0a3=_0x55c0a3-0x14a;const _0x52fb16=a25_0x52fb();let _0x48cb81=_0x52fb16[_0x55c0a3];return _0x48cb81;}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_0x116e5c from'chalk';async function resolveSegmentTarget(_0x39e20f,_0x1e6f63,_0x173259){const _0x34e31e=a25_0x48cb;if(isYamlFilePath(_0x39e20f))try{const _0x3757e5=await resolveYamlFilePath(_0x39e20f);return _0x173259&&(console['error'](_0x34e31e(0x1dc)+_0x39e20f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x3757e5[_0x34e31e(0x183)]),console[_0x34e31e(0x156)](_0x34e31e(0x1d8)+_0x3757e5[_0x34e31e(0x16d)]),console[_0x34e31e(0x156)](_0x34e31e(0x18f)+(_0x3757e5[_0x34e31e(0x158)]||_0x34e31e(0x1b7))),console[_0x34e31e(0x156)](_0x34e31e(0x180)+_0x3757e5['fullPath'])),_0x3757e5[_0x34e31e(0x1b3)];}catch(_0x43473a){throw new SDKError(ErrorCode[_0x34e31e(0x1d1)],_0x34e31e(0x17d)+_0x43473a[_0x34e31e(0x169)]);}if(!_0x1e6f63)throw new SDKError(ErrorCode[_0x34e31e(0x1d1)],_0x34e31e(0x18a));return _0x1e6f63+'/'+_0x39e20f;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]='segment:describe';['description']='Show\x20segment\x20or\x20folder\x20details';async[a25_0x2e3233(0x1ab)](_0x5dd46f){const _0x56c0ae=a25_0x2e3233,{options:_0x122850,args:_0x144771,tdx:_0x5b0e2c}=_0x5dd46f,_0x32bce9=_0x144771[0x0],_0x218956=!_0x32bce9&&!!_0x122850[_0x56c0ae(0x183)],_0x3fe314=_0x32bce9||_0x122850[_0x56c0ae(0x183)];if(!_0x3fe314)return console['error'](_0x56c0ae(0x1d5)),console[_0x56c0ae(0x156)](_0x56c0ae(0x1cb)),console[_0x56c0ae(0x156)](_0x56c0ae(0x1c1)),console[_0x56c0ae(0x156)](_0x56c0ae(0x181)),console['error'](_0x56c0ae(0x189)),console[_0x56c0ae(0x156)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x56c0ae(0x156)](_0x56c0ae(0x1df)),0x1;try{const _0x45f03e=_0x122850['segmentPath'];let _0x21984d=_0x3fe314;!_0x218956&&_0x45f03e&&!_0x3fe314[_0x56c0ae(0x1b4)]('/')&&(_0x21984d=_0x45f03e+'/'+_0x3fe314,_0x122850[_0x56c0ae(0x15b)]&&console[_0x56c0ae(0x156)](_0x56c0ae(0x196)+_0x21984d));const _0xec365b=await withSpinner(_0x56c0ae(0x1c5)+_0x21984d+_0x56c0ae(0x1ba),()=>_0x5b0e2c[_0x56c0ae(0x14c)]['resolvePathToResource'](_0x21984d),{'verbose':_0x122850[_0x56c0ae(0x15b)]}),_0x2bf5f3=_0xec365b['data'];_0x122850[_0x56c0ae(0x15b)]&&(console[_0x56c0ae(0x156)](_0x56c0ae(0x192)+_0x2bf5f3[_0x56c0ae(0x174)]),console['error']('Parent\x20ID:\x20'+_0x2bf5f3[_0x56c0ae(0x1de)]),_0x2bf5f3[_0x56c0ae(0x19d)]&&console[_0x56c0ae(0x156)](_0x56c0ae(0x179)+_0x2bf5f3[_0x56c0ae(0x19d)]),_0x2bf5f3[_0x56c0ae(0x1c3)]&&console['error']('Segment\x20ID:\x20'+_0x2bf5f3['segmentId']));if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x1a5)){const _0x21a62f=await withSpinner(_0x56c0ae(0x1ae),()=>_0x5b0e2c[_0x56c0ae(0x14c)]['getParent'](_0x2bf5f3[_0x56c0ae(0x1de)]),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x21a62f[_0x56c0ae(0x155)],_0x122850);}else{if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x197)){if(!_0x2bf5f3[_0x56c0ae(0x19d)])throw new SDKError(ErrorCode[_0x56c0ae(0x18b)],_0x56c0ae(0x14f));const _0x4ddb33=await withSpinner(_0x56c0ae(0x14a),()=>_0x5b0e2c[_0x56c0ae(0x14c)][_0x56c0ae(0x1d3)](_0x2bf5f3[_0x56c0ae(0x19d)]),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x4ddb33[_0x56c0ae(0x155)],_0x122850);}else{if(_0x2bf5f3[_0x56c0ae(0x174)]===_0x56c0ae(0x14c)){if(!_0x2bf5f3[_0x56c0ae(0x1c3)])throw new SDKError(ErrorCode[_0x56c0ae(0x1a1)],_0x56c0ae(0x19a));const _0x2155b=await withSpinner(_0x56c0ae(0x1b9),()=>_0x5b0e2c['segment'][_0x56c0ae(0x173)](_0x2bf5f3[_0x56c0ae(0x1de)],_0x2bf5f3['segmentId']),{'verbose':_0x122850[_0x56c0ae(0x15b)]});await handleSingleObjectOutput(_0x2155b[_0x56c0ae(0x155)],_0x122850);}}}return 0x0;}catch(_0x63397a){if(_0x63397a instanceof SDKError)return console[_0x56c0ae(0x156)](_0x56c0ae(0x198)+_0x63397a[_0x56c0ae(0x169)]),_0x63397a['cause']&&console[_0x56c0ae(0x156)](_0x56c0ae(0x1c6)+_0x63397a[_0x56c0ae(0x1da)]),0x1;throw _0x63397a;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1cc);['description']=a25_0x2e3233(0x150);async[a25_0x2e3233(0x1ab)](_0x5a9f70){const _0xa097e6=a25_0x2e3233,{options:_0x35f7db,args:_0x5a55a2,tdx:_0x1cdf5d}=_0x5a9f70,_0x5e5553=_0x5a55a2[0x0];if(!_0x5e5553)return console[_0xa097e6(0x156)](_0xa097e6(0x1a7)),console[_0xa097e6(0x156)](_0xa097e6(0x164)),console[_0xa097e6(0x156)](_0xa097e6(0x19c)),console[_0xa097e6(0x156)](_0xa097e6(0x1c1)),console[_0xa097e6(0x156)](_0xa097e6(0x186)),console['error'](_0xa097e6(0x1b8)),0x1;try{const _0x23d796=_0x35f7db[_0xa097e6(0x183)],_0x4d27cf=await resolveSegmentTarget(_0x5e5553,_0x23d796,_0x35f7db[_0xa097e6(0x15b)]);_0x35f7db['verbose']&&console[_0xa097e6(0x156)]('Target\x20path:\x20'+_0x4d27cf);const _0x101173=await withSpinner(_0xa097e6(0x1aa)+_0x5e5553+_0xa097e6(0x1ba),()=>_0x1cdf5d[_0xa097e6(0x14c)][_0xa097e6(0x171)](_0x4d27cf),{'verbose':_0x35f7db['verbose']}),_0x6e778c=_0x101173[_0xa097e6(0x155)];_0x35f7db[_0xa097e6(0x15b)]&&(console['error'](_0xa097e6(0x192)+_0x6e778c[_0xa097e6(0x174)]),console[_0xa097e6(0x156)](_0xa097e6(0x19b)+_0x6e778c[_0xa097e6(0x1de)]));if(_0x6e778c[_0xa097e6(0x174)]===_0xa097e6(0x197))return console[_0xa097e6(0x156)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0xa097e6(0x156)](_0xa097e6(0x1b6)),0x1;if(_0x6e778c[_0xa097e6(0x174)]===_0xa097e6(0x1a5))return console[_0xa097e6(0x156)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0xa097e6(0x156)](_0xa097e6(0x151)),0x1;if(!_0x6e778c[_0xa097e6(0x1c3)])throw new SDKError(ErrorCode[_0xa097e6(0x1a1)],_0xa097e6(0x19a));const _0x46f440=await withSpinner(_0xa097e6(0x14e),()=>_0x1cdf5d[_0xa097e6(0x14c)]['getSegmentSQL'](_0x6e778c['parentId'],_0x6e778c[_0xa097e6(0x1c3)]),{'verbose':_0x35f7db[_0xa097e6(0x15b)]});let _0x17e277=_0x46f440[_0xa097e6(0x155)];const _0x464f3e=resolveLimit(_0x35f7db[_0xa097e6(0x1d6)],DEFAULT_DISPLAY_LIMIT),_0x47e77f=/\bLIMIT\s+\d+/i['test'](_0x17e277);!_0x47e77f&&(_0x17e277=_0x17e277[_0xa097e6(0x157)]()[_0xa097e6(0x1d2)](/;+$/,''),_0x17e277='SELECT\x20*\x20FROM\x20(\x0a'+_0x17e277+_0xa097e6(0x1cd)+_0x464f3e);_0x35f7db[_0xa097e6(0x15b)]&&console['error'](_0xa097e6(0x190)+_0x17e277);const _0x59db8a=await withProgressSpinner(_0xa097e6(0x191),async _0x1bc7f3=>{const _0x2c3aa6=_0xa097e6,_0xdfe0f=await _0x1cdf5d[_0x2c3aa6(0x17a)]['execute'](_0x17e277,{'catalog':'td','schema':'information_schema','onJobId':_0x4b8644=>{_0x1bc7f3['setJobId'](_0x4b8644);}});return _0xdfe0f;},{'verbose':_0x35f7db[_0xa097e6(0x15b)]}),_0x1ebbc=_0x59db8a[_0xa097e6(0x155)],_0x1adfc4=_0x1ebbc[_0xa097e6(0x1b5)]?'\x20[Job\x20ID:\x20'+_0x1ebbc[_0xa097e6(0x1b5)]+']':'';return console[_0xa097e6(0x156)](_0xa097e6(0x188)+_0x1ebbc[_0xa097e6(0x1b2)]['processedRows'][_0xa097e6(0x1c0)]()+_0xa097e6(0x153)+(_0xa097e6(0x1b1)+formatElapsed(_0x1ebbc[_0xa097e6(0x1b2)][_0xa097e6(0x1a9)])+_0x1adfc4)),await handleQueryOutput(_0x1ebbc,_0x35f7db),0x0;}catch(_0x55ab23){if(_0x55ab23 instanceof SDKError)return console['error'](_0xa097e6(0x16a)+_0x55ab23[_0xa097e6(0x1ad)]+']'),console['error']('\x0a'+_0x55ab23[_0xa097e6(0x169)]),0x1;throw _0x55ab23;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x16e);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x3d57ea){const _0x54a3b8=a25_0x2e3233,{options:_0x395306,args:_0x404314,tdx:_0x2e21ac}=_0x3d57ea;if(_0x404314['length']===0x0)return console['error'](_0x54a3b8(0x1d9)),console[_0x54a3b8(0x156)](_0x54a3b8(0x1cf)),0x1;const _0x12f919=_0x404314[0x0];try{_0x395306['verbose']&&(console[_0x54a3b8(0x156)](_0x54a3b8(0x1bd)+_0x395306[_0x54a3b8(0x14d)]),console[_0x54a3b8(0x156)](_0x54a3b8(0x170)+_0x12f919));const _0x345a41=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x12f919+_0x54a3b8(0x1ba),()=>_0x2e21ac[_0x54a3b8(0x14c)]['resolveParentId'](_0x12f919),{'verbose':_0x395306[_0x54a3b8(0x15b)]}),_0x46d0a1=_0x345a41[_0x54a3b8(0x155)];_0x395306[_0x54a3b8(0x15b)]&&console[_0x54a3b8(0x156)](_0x54a3b8(0x178)+_0x46d0a1);const _0x112396=await withSpinner(_0x54a3b8(0x1a3)+_0x12f919+_0x54a3b8(0x1ba),()=>_0x2e21ac[_0x54a3b8(0x14c)][_0x54a3b8(0x154)](_0x46d0a1),{'verbose':_0x395306['verbose']}),_0x5868a6=_0x112396[_0x54a3b8(0x155)];return console[_0x54a3b8(0x156)](_0x54a3b8(0x1db)+_0x5868a6[_0x54a3b8(0x15e)]+_0x54a3b8(0x1a8)+(_0x5868a6[_0x54a3b8(0x15e)]!==0x1?'s':'')),await handleSDKOutput(_0x5868a6,_0x395306),0x0;}catch(_0x41c28d){if(_0x41c28d instanceof SDKError)return console['error']('Error:\x20'+_0x41c28d['message']),_0x41c28d[_0x54a3b8(0x1da)]&&console[_0x54a3b8(0x156)](_0x54a3b8(0x1c6)+_0x41c28d['cause']),0x1;throw _0x41c28d;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1b0);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x159);async[a25_0x2e3233(0x1ab)](_0x4ccac2){const _0x2df14f=a25_0x2e3233,{options:_0x16d4dc,args:_0x2621c8,tdx:_0x5a2ac6}=_0x4ccac2;if(_0x2621c8['length']===0x0)return console[_0x2df14f(0x156)](_0x2df14f(0x17b)),console[_0x2df14f(0x156)](_0x2df14f(0x166)),0x1;try{const {parentId:_0x3fa9db,childId:_0x326722}=parseSegmentRef(_0x2621c8[0x0]);_0x16d4dc[_0x2df14f(0x15b)]&&(console['error'](_0x2df14f(0x1bd)+_0x16d4dc[_0x2df14f(0x14d)]),console[_0x2df14f(0x156)](_0x2df14f(0x170)+_0x3fa9db),_0x326722&&console[_0x2df14f(0x156)](_0x2df14f(0x17c)+_0x326722));if(!_0x326722)return console['error'](_0x2df14f(0x19f)),0x1;const _0x10e70a=await withSpinner(_0x2df14f(0x185)+_0x3fa9db+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)][_0x2df14f(0x1e0)](_0x3fa9db),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]}),_0xec4293=_0x10e70a[_0x2df14f(0x155)];_0x16d4dc[_0x2df14f(0x15b)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0xec4293);const _0x3874c1=await withSpinner('Resolving\x20folder\x20\x27'+_0x326722+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)]['resolveFolderId'](_0xec4293,_0x326722),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]}),_0x279fa8=_0x3874c1[_0x2df14f(0x155)];_0x16d4dc[_0x2df14f(0x15b)]&&console[_0x2df14f(0x156)]('Resolved\x20folder\x20ID:\x20'+_0x279fa8);const _0x231fcb=await withSpinner(_0x2df14f(0x15c)+_0x326722+_0x2df14f(0x1ba),()=>_0x5a2ac6[_0x2df14f(0x14c)][_0x2df14f(0x1d3)](_0x279fa8),{'verbose':_0x16d4dc[_0x2df14f(0x15b)]});return await handleSDKOutput([_0x231fcb[_0x2df14f(0x155)]],_0x16d4dc),0x0;}catch(_0x17d11d){if(_0x17d11d instanceof SDKError)return console[_0x2df14f(0x156)](_0x2df14f(0x198)+_0x17d11d[_0x2df14f(0x169)]),_0x17d11d[_0x2df14f(0x1da)]&&console['error']('\x20\x20Cause:\x20'+_0x17d11d[_0x2df14f(0x1da)]),0x1;throw _0x17d11d;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1a4);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x2e3233(0x1ab)](_0x565853){const _0x39ce32=a25_0x2e3233,{options:_0x1c3728,args:_0x492353,tdx:_0x1732e6}=_0x565853,_0x3eb649=_0x492353[0x0];if(!_0x3eb649)return console['error'](_0x39ce32(0x1a7)),console[_0x39ce32(0x156)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console['error'](_0x39ce32(0x1c1)),console[_0x39ce32(0x156)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x39ce32(0x156)](_0x39ce32(0x1e1)),0x1;try{const _0x379442=_0x1c3728[_0x39ce32(0x183)],_0xb05209=await resolveSegmentTarget(_0x3eb649,_0x379442,_0x1c3728['verbose']);_0x1c3728[_0x39ce32(0x15b)]&&console[_0x39ce32(0x156)](_0x39ce32(0x1dd)+_0xb05209);const _0x20fc8b=await withSpinner(_0x39ce32(0x1aa)+_0x3eb649+_0x39ce32(0x1ba),()=>_0x1732e6[_0x39ce32(0x14c)][_0x39ce32(0x171)](_0xb05209),{'verbose':_0x1c3728['verbose']}),_0x1d7a3c=_0x20fc8b[_0x39ce32(0x155)];_0x1c3728['verbose']&&(console[_0x39ce32(0x156)](_0x39ce32(0x192)+_0x1d7a3c['type']),console['error']('Parent\x20ID:\x20'+_0x1d7a3c[_0x39ce32(0x1de)]));if(_0x1d7a3c['type']===_0x39ce32(0x197))return console[_0x39ce32(0x156)](_0x39ce32(0x195)),console['error'](_0x39ce32(0x14b)),0x1;if(_0x1d7a3c[_0x39ce32(0x174)]==='parent')return console[_0x39ce32(0x156)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x39ce32(0x156)](_0x39ce32(0x16c)),0x1;if(!_0x1d7a3c[_0x39ce32(0x1c3)])throw new SDKError(ErrorCode[_0x39ce32(0x1a1)],_0x39ce32(0x19a));const _0x12423c=await withSpinner(_0x39ce32(0x14e),()=>_0x1732e6['segment'][_0x39ce32(0x1ca)](_0x1d7a3c['parentId'],_0x1d7a3c['segmentId']),{'verbose':_0x1c3728[_0x39ce32(0x15b)]}),_0x4cd9b0=_0x12423c['data'];return _0x1c3728[_0x39ce32(0x187)]==='json'||_0x1c3728['format']===_0x39ce32(0x176)?await handleSDKOutput([{'sql':_0x4cd9b0}],_0x1c3728):console[_0x39ce32(0x193)](_0x4cd9b0),0x0;}catch(_0x3a6182){if(_0x3a6182 instanceof SDKError)return console['error'](_0x39ce32(0x198)+_0x3a6182['message']),_0x3a6182['cause']&&console[_0x39ce32(0x156)](_0x39ce32(0x1c6)+_0x3a6182[_0x39ce32(0x1da)]),0x1;throw _0x3a6182;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a25_0x2e3233(0x19e);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x1af);async[a25_0x2e3233(0x1ab)](_0x34124d){const _0x526bf7=a25_0x2e3233,{options:_0x39fad5,args:_0x72500,tdx:_0x37e25e}=_0x34124d,_0x5a9394=_0x39fad5;if(_0x72500['length']<0x2)return console[_0x526bf7(0x156)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x31dd6e=_0x72500[0x0],_0x4b0fa0=_0x72500[0x1];_0x5a9394[_0x526bf7(0x15b)]&&(console[_0x526bf7(0x156)](_0x526bf7(0x1bd)+_0x5a9394[_0x526bf7(0x14d)]),console[_0x526bf7(0x156)](_0x526bf7(0x1d4)+_0x31dd6e),console[_0x526bf7(0x156)](_0x526bf7(0x17c)+_0x4b0fa0));let _0x5d8308;if(_0x5a9394[_0x526bf7(0x168)]){const _0x22f936=_0x5a9394[_0x526bf7(0x168)],_0x5f0593=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31dd6e+_0x526bf7(0x1ba),()=>_0x37e25e['segment']['resolveParentId'](_0x31dd6e),{'verbose':_0x5a9394['verbose']}),_0x1ffc5c=_0x5f0593['data'],_0x47732b=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x22f936+_0x526bf7(0x1ba),()=>_0x37e25e['segment']['resolveFolderId'](_0x1ffc5c,_0x22f936),{'verbose':_0x5a9394['verbose']});_0x5d8308=_0x47732b['data'],_0x5a9394[_0x526bf7(0x15b)]&&console[_0x526bf7(0x156)](_0x526bf7(0x1bf)+_0x5d8308);}const _0x207d65={'name':_0x4b0fa0,'description':_0x5a9394[_0x526bf7(0x184)],'parentFolderId':_0x5d8308},_0x4f1761=await withSpinner('Creating\x20folder\x20\x27'+_0x4b0fa0+'\x27...',()=>_0x37e25e[_0x526bf7(0x14c)][_0x526bf7(0x182)](_0x31dd6e,_0x207d65),{'verbose':_0x5a9394[_0x526bf7(0x15b)]}),_0x502a19=_0x4f1761['data'];return console['error'](_0x526bf7(0x172)+_0x502a19[_0x526bf7(0x1a2)]+_0x526bf7(0x177)+_0x502a19['id']),await handleSDKOutput([_0x502a19],_0x5a9394),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x1d0);['description']=a25_0x2e3233(0x1c9);async[a25_0x2e3233(0x1ab)](_0x400447){const _0x267c32=a25_0x2e3233,{options:_0x4960a9,args:_0x1b7ba1,tdx:_0x58a510}=_0x400447,_0x4f6fd8=_0x1b7ba1[0x0];if(!_0x4f6fd8)return console[_0x267c32(0x156)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x267c32(0x156)](_0x267c32(0x163)),console['error'](_0x267c32(0x1ce)),console[_0x267c32(0x156)](_0x267c32(0x1bc)),console[_0x267c32(0x156)](_0x267c32(0x1d7)),console[_0x267c32(0x156)](_0x267c32(0x1c1)),console[_0x267c32(0x156)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x267c32(0x17f)),console[_0x267c32(0x156)](_0x267c32(0x18e)),console[_0x267c32(0x156)](_0x267c32(0x1be)),0x1;try{const _0x2d8ccd=_0x4960a9['parentSegment'],_0x4dd0eb=await resolveSegmentTarget(_0x4f6fd8,_0x2d8ccd,_0x4960a9['verbose']);_0x4960a9['verbose']&&console[_0x267c32(0x156)](_0x267c32(0x1dd)+_0x4dd0eb);const _0x360dfb=await withSpinner(_0x267c32(0x1aa)+_0x4f6fd8+_0x267c32(0x1ba),()=>_0x58a510[_0x267c32(0x14c)][_0x267c32(0x171)](_0x4dd0eb),{'verbose':_0x4960a9[_0x267c32(0x15b)]}),_0x1e989b=_0x360dfb[_0x267c32(0x155)];_0x4960a9['verbose']&&(console[_0x267c32(0x156)](_0x267c32(0x192)+_0x1e989b[_0x267c32(0x174)]),console[_0x267c32(0x156)](_0x267c32(0x19b)+_0x1e989b[_0x267c32(0x1de)]),_0x1e989b[_0x267c32(0x19d)]&&console[_0x267c32(0x156)](_0x267c32(0x179)+_0x1e989b['folderId']),_0x1e989b['segmentId']&&console[_0x267c32(0x156)]('Segment\x20ID:\x20'+_0x1e989b[_0x267c32(0x1c3)]));if(_0x4960a9[_0x267c32(0x1c8)]){if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x197))return console[_0x267c32(0x156)](_0x267c32(0x1c2)),0x1;if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x1a5))return console['error'](_0x267c32(0x1c7)),console['error'](_0x267c32(0x199)),0x1;if(!_0x1e989b[_0x267c32(0x1c3)])throw new SDKError(ErrorCode[_0x267c32(0x1a1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x47d162=getConsoleNextUrl(_0x4960a9[_0x267c32(0x14d)],_0x267c32(0x167)+_0x1e989b['parentId']+'/e/'+_0x1e989b[_0x267c32(0x1c3)]);return console[_0x267c32(0x156)](a25_0x116e5c[_0x267c32(0x175)]('✔')+_0x267c32(0x15d)+a25_0x116e5c['cyan'](_0x47d162)),openBrowser(_0x47d162),0x0;}if(_0x1e989b[_0x267c32(0x174)]===_0x267c32(0x197)){if(!_0x1e989b[_0x267c32(0x19d)])throw new SDKError(ErrorCode[_0x267c32(0x18b)],_0x267c32(0x14f));const _0xe36b1e=await withSpinner('Fetching\x20folder\x20details...',()=>_0x58a510['segment'][_0x267c32(0x1d3)](_0x1e989b[_0x267c32(0x19d)]),{'verbose':_0x4960a9[_0x267c32(0x15b)]});await handleSingleObjectOutput(_0xe36b1e[_0x267c32(0x155)],_0x4960a9);}else{if(_0x1e989b['type']===_0x267c32(0x14c)){if(!_0x1e989b[_0x267c32(0x1c3)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x30efc9=await withSpinner(_0x267c32(0x1b9),()=>_0x58a510[_0x267c32(0x14c)]['getSegment'](_0x1e989b[_0x267c32(0x1de)],_0x1e989b[_0x267c32(0x1c3)]),{'verbose':_0x4960a9[_0x267c32(0x15b)]}),_0x58870d=getConsoleNextUrl(_0x4960a9[_0x267c32(0x14d)],_0x267c32(0x167)+_0x1e989b[_0x267c32(0x1de)]+_0x267c32(0x162)+_0x1e989b[_0x267c32(0x1c3)]),_0x26ff90=_0x30efc9[_0x267c32(0x155)];_0x26ff90[_0x267c32(0x1ac)]=_0x58870d,await handleSingleObjectOutput(_0x26ff90,_0x4960a9);}else return console['error'](_0x267c32(0x16f)),console[_0x267c32(0x156)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x2df4cc){if(_0x2df4cc instanceof SDKError)return console['error'](_0x267c32(0x198)+_0x2df4cc[_0x267c32(0x169)]),_0x2df4cc[_0x267c32(0x1da)]&&console['error'](_0x267c32(0x1c6)+_0x2df4cc['cause']),0x1;throw _0x2df4cc;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x2e3233(0x1a2)]=a25_0x2e3233(0x15f);[a25_0x2e3233(0x184)]=a25_0x2e3233(0x1a0);async['execute'](_0x565ea4){const _0x56144b=a25_0x2e3233,{options:_0x4e88f0,args:_0x4c2cee,tdx:_0x3634da}=_0x565ea4,_0xf81357=_0x4c2cee[0x0];if(!_0xf81357)return console[_0x56144b(0x156)](_0x56144b(0x1a7)),console[_0x56144b(0x156)](_0x56144b(0x161)),console[_0x56144b(0x156)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x56144b(0x1c1)),console[_0x56144b(0x156)](_0x56144b(0x16b)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3d3d32=_0x4e88f0[_0x56144b(0x183)],_0x559f46=await resolveSegmentTarget(_0xf81357,_0x3d3d32,_0x4e88f0[_0x56144b(0x15b)]);_0x4e88f0[_0x56144b(0x15b)]&&console[_0x56144b(0x156)](_0x56144b(0x1dd)+_0x559f46);const _0xcceb96=await withSpinner(_0x56144b(0x1aa)+_0xf81357+_0x56144b(0x1ba),()=>_0x3634da[_0x56144b(0x14c)][_0x56144b(0x171)](_0x559f46),{'verbose':_0x4e88f0['verbose']}),_0x3e3385=_0xcceb96[_0x56144b(0x155)];_0x4e88f0[_0x56144b(0x15b)]&&(console[_0x56144b(0x156)](_0x56144b(0x192)+_0x3e3385[_0x56144b(0x174)]),console[_0x56144b(0x156)](_0x56144b(0x19b)+_0x3e3385['parentId']));if(_0x3e3385[_0x56144b(0x174)]===_0x56144b(0x197))return console[_0x56144b(0x156)](_0x56144b(0x1a6)),console[_0x56144b(0x156)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x3e3385['type']===_0x56144b(0x1a5))return console[_0x56144b(0x156)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x56144b(0x156)](_0x56144b(0x152)),0x1;if(!_0x3e3385[_0x56144b(0x1c3)])throw new SDKError(ErrorCode[_0x56144b(0x1a1)],_0x56144b(0x19a));const _0x25a8d5=await withSpinner(_0x56144b(0x14e),()=>_0x3634da[_0x56144b(0x14c)][_0x56144b(0x1ca)](_0x3e3385['parentId'],_0x3e3385['segmentId']),{'verbose':_0x4e88f0[_0x56144b(0x15b)]}),_0x1eef4b=_0x25a8d5[_0x56144b(0x155)],_0x31a870=await executeSchemaQuery(_0x1eef4b,_0x3634da,_0x4e88f0);return await handleQueryOutput(_0x31a870,_0x4e88f0),0x0;}catch(_0x462a38){if(_0x462a38 instanceof SDKError)return console[_0x56144b(0x156)]('Error:\x20'+_0x462a38[_0x56144b(0x169)]),_0x462a38[_0x56144b(0x1da)]&&console[_0x56144b(0x156)](_0x56144b(0x1c6)+_0x462a38['cause']),0x1;throw _0x462a38;}}}
@@ -1 +1 @@
1
- const a26_0x23ab82=a26_0x11e6;(function(_0x5e229c,_0x4bf5a9){const _0x3946fc=a26_0x11e6,_0x45b280=_0x5e229c();while(!![]){try{const _0x29960e=-parseInt(_0x3946fc(0x1a7))/0x1+-parseInt(_0x3946fc(0x190))/0x2+parseInt(_0x3946fc(0x188))/0x3+-parseInt(_0x3946fc(0x191))/0x4*(parseInt(_0x3946fc(0x18f))/0x5)+parseInt(_0x3946fc(0x1a0))/0x6*(parseInt(_0x3946fc(0x193))/0x7)+-parseInt(_0x3946fc(0x177))/0x8+-parseInt(_0x3946fc(0x192))/0x9*(-parseInt(_0x3946fc(0x189))/0xa);if(_0x29960e===_0x4bf5a9)break;else _0x45b280['push'](_0x45b280['shift']());}catch(_0x5aa436){_0x45b280['push'](_0x45b280['shift']());}}}(a26_0x246b,0x498ce));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x11e6(_0x3c9f3a,_0x1a16fe){_0x3c9f3a=_0x3c9f3a-0x172;const _0x246b24=a26_0x246b();let _0x11e63d=_0x246b24[_0x3c9f3a];return _0x11e63d;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x246b(){const _0x54c143=['segmentPath','folder','segments','data','description','43712teNXge','✔\x20Created\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','verbose','invisible','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','842328ajekbU','Resolving\x20folder\x20path\x20\x27','Site:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20folder\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segment','\x20\x20\x20Path:\x20','Examples:','\x27\x20with\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','error','name','ruleFile','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','resolveFolderId','site','835935acxaiD','20pmdrCO','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','Parent:\x20','Segment\x20name:\x20','Creating\x20segment\x20\x27','35vMpwvt','312982VmoyWc','17468HDgsXG','988974vBvXRB','5929aLlwyg','type','includes','parent','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','folderId','yellow','length','Parent\x20path:\x20','\x27...','984mxVeIl','kind'];a26_0x246b=function(){return _0x54c143;};return a26_0x246b();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0xb79d68 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x23ab82(0x183)]='segment:create';[a26_0x23ab82(0x1a6)]=a26_0x23ab82(0x18a);async['execute'](_0x1ec11f){const _0x2f3fd7=a26_0x23ab82;console[_0x2f3fd7(0x182)](a26_0xb79d68['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x2f3fd7(0x182)](a26_0xb79d68[_0x2f3fd7(0x19c)](_0x2f3fd7(0x17a)));const {options:_0x393594,args:_0x38a2c8,tdx:_0x244be6}=_0x1ec11f,_0x21eec2=_0x393594;if(_0x38a2c8[_0x2f3fd7(0x19d)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x173)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x17f)),console['error'](_0x2f3fd7(0x185)),console['error'](_0x2f3fd7(0x19a)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x198)),0x1;const _0x511e1b=_0x38a2c8[0x0],_0x27b863=_0x393594[_0x2f3fd7(0x1a2)];let _0xf475fc=_0x511e1b;_0x27b863&&!_0x511e1b[_0x2f3fd7(0x195)]('/')&&(_0xf475fc=_0x27b863+'/'+_0x511e1b,_0x21eec2[_0x2f3fd7(0x174)]&&console[_0x2f3fd7(0x182)]('Resolved\x20relative\x20path\x20to:\x20'+_0xf475fc));const _0x2b2eff=parsePath(_0xf475fc);if(_0x2b2eff[_0x2f3fd7(0x1a4)]['length']<0x2)return console['error'](_0x2f3fd7(0x17c)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x199)),0x1;const _0x1f2826=_0x2b2eff[_0x2f3fd7(0x1a4)][0x0],_0x54794e=getBaseName(_0xf475fc),_0x38d7af=getParentPath(_0xf475fc);_0x21eec2['verbose']&&(console[_0x2f3fd7(0x182)](_0x2f3fd7(0x179)+_0x21eec2[_0x2f3fd7(0x187)]),console[_0x2f3fd7(0x182)]('Target\x20path:\x20'+_0xf475fc),console['error'](_0x2f3fd7(0x18c)+_0x1f2826),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x18d)+_0x54794e),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x19e)+_0x38d7af));const _0xd4cebc=await withSpinner(_0x2f3fd7(0x181)+_0x1f2826+_0x2f3fd7(0x19f),()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x18b)](_0x1f2826),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x14ffb0=_0xd4cebc[_0x2f3fd7(0x1a5)];let _0x4b125c;if(_0x2b2eff['segments'][_0x2f3fd7(0x19d)]>0x2){const _0x2b94ec=await withSpinner(_0x2f3fd7(0x178)+_0x38d7af+_0x2f3fd7(0x19f),()=>_0x244be6['segment']['resolvePathToResource'](_0x38d7af),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x27604c=_0x2b94ec[_0x2f3fd7(0x1a5)];if(_0x27604c[_0x2f3fd7(0x194)]!==_0x2f3fd7(0x1a3)&&_0x27604c[_0x2f3fd7(0x194)]!==_0x2f3fd7(0x196))return console[_0x2f3fd7(0x182)](_0x2f3fd7(0x176)),0x1;_0x4b125c=_0x27604c[_0x2f3fd7(0x19b)];}else{if(_0x21eec2['folder']){const _0x1c9efc=await withSpinner(_0x2f3fd7(0x17b)+_0x21eec2[_0x2f3fd7(0x1a3)]+'\x27...',()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x186)](_0x14ffb0,_0x21eec2[_0x2f3fd7(0x1a3)]),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]});_0x4b125c=_0x1c9efc[_0x2f3fd7(0x1a5)];}}_0x21eec2['verbose']&&_0x4b125c&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x4b125c);const _0x47a826=await loadJSONFromOptions(_0x21eec2['rule'],_0x21eec2[_0x2f3fd7(0x184)]),_0x5d6b52={'name':_0x54794e,'description':_0x21eec2['description'],'rule':_0x47a826,'kind':_0x21eec2[_0x2f3fd7(0x1a1)]!==undefined?parseInt(_0x21eec2[_0x2f3fd7(0x1a1)],0xa):undefined,'isVisible':_0x21eec2[_0x2f3fd7(0x175)]?![]:undefined,'segmentFolderId':_0x4b125c,'countPopulation':_0x21eec2['noCountPopulation']?![]:undefined},_0x3186d5=await withSpinner(_0x2f3fd7(0x18e)+_0x54794e+_0x2f3fd7(0x19f),()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x197)](_0x14ffb0,_0x5d6b52),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x1eaea4=_0x3186d5[_0x2f3fd7(0x1a5)];return console[_0x2f3fd7(0x182)](_0x2f3fd7(0x172)+_0x1eaea4[_0x2f3fd7(0x183)]+_0x2f3fd7(0x180)+_0x1eaea4['id']),_0xf475fc!==_0x511e1b&&console[_0x2f3fd7(0x182)](_0x2f3fd7(0x17e)+_0xf475fc),await handleSDKOutput([_0x1eaea4],_0x21eec2),0x0;}}
1
+ const a26_0x83987a=a26_0x1ebf;(function(_0x4d9ad1,_0x596330){const _0x363776=a26_0x1ebf,_0x173f27=_0x4d9ad1();while(!![]){try{const _0x54b249=parseInt(_0x363776(0xa5))/0x1*(parseInt(_0x363776(0xad))/0x2)+-parseInt(_0x363776(0xb1))/0x3+-parseInt(_0x363776(0x82))/0x4*(-parseInt(_0x363776(0x90))/0x5)+parseInt(_0x363776(0x86))/0x6+parseInt(_0x363776(0xb3))/0x7*(-parseInt(_0x363776(0x8b))/0x8)+-parseInt(_0x363776(0xb8))/0x9+-parseInt(_0x363776(0xa7))/0xa*(-parseInt(_0x363776(0xa0))/0xb);if(_0x54b249===_0x596330)break;else _0x173f27['push'](_0x173f27['shift']());}catch(_0x6e1df7){_0x173f27['push'](_0x173f27['shift']());}}}(a26_0x4906,0x7363d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x1ebf(_0x41f349,_0x1ea6b7){_0x41f349=_0x41f349-0x80;const _0x4906dd=a26_0x4906();let _0x1ebfcf=_0x4906dd[_0x41f349];return _0x1ebfcf;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a26_0x4906(){const _0x5eb482=['resolveParentId','252BUOqgK','invisible','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Segment\x20name:\x20','1011786wwxVTH','segment','segments','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','createSegment','832wtGTFf','Site:\x20','execute','site','error','28790LIXVEZ','Parent:\x20','Resolved\x20folder\x20ID:\x20','includes','Target\x20path:\x20','kind','Parent\x20path:\x20','name','segmentPath','segment:create','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','length','data','11yaJYLf','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20folder\x20path\x20\x27','11uXHfse','ruleFile','14039840HnIPzC','Resolved\x20relative\x20path\x20to:\x20','verbose','folder','noCountPopulation','Resolving\x20folder\x20\x27','52690yGMnLK','description','✔\x20Created\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','2411289FqlIvZ','yellow','34454lPKpSe','folderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','3931884YjFvVf','parent'];a26_0x4906=function(){return _0x5eb482;};return a26_0x4906();}import a26_0x1e93cf from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x83987a(0x97)]=a26_0x83987a(0x99);[a26_0x83987a(0xae)]=a26_0x83987a(0x9d);async[a26_0x83987a(0x8d)](_0x50d807){const _0x222540=a26_0x83987a;console[_0x222540(0x8f)](a26_0x1e93cf[_0x222540(0xb2)](_0x222540(0xb0))),console[_0x222540(0x8f)](a26_0x1e93cf['yellow'](_0x222540(0x9a)));const {options:_0x1ecd56,args:_0x24cf43,tdx:_0x48a9b}=_0x50d807,_0xaa1279=_0x1ecd56;if(_0x24cf43['length']===0x0)return console['error'](_0x222540(0x89)),console[_0x222540(0x8f)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error']('Examples:'),console[_0x222540(0x8f)](_0x222540(0xa2)),console[_0x222540(0x8f)](_0x222540(0xb7)),console[_0x222540(0x8f)](_0x222540(0xa3)),0x1;const _0x52bdf3=_0x24cf43[0x0],_0x413028=_0x1ecd56[_0x222540(0x98)];let _0x16977c=_0x52bdf3;_0x413028&&!_0x52bdf3[_0x222540(0x93)]('/')&&(_0x16977c=_0x413028+'/'+_0x52bdf3,_0xaa1279[_0x222540(0xa9)]&&console[_0x222540(0x8f)](_0x222540(0xa8)+_0x16977c));const _0x54e5d0=parsePath(_0x16977c);if(_0x54e5d0[_0x222540(0x88)][_0x222540(0x9e)]<0x2)return console[_0x222540(0x8f)](_0x222540(0xb5)),console[_0x222540(0x8f)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x57e309=_0x54e5d0[_0x222540(0x88)][0x0],_0xdb84b3=getBaseName(_0x16977c),_0x1ebbb4=getParentPath(_0x16977c);_0xaa1279[_0x222540(0xa9)]&&(console[_0x222540(0x8f)](_0x222540(0x8c)+_0xaa1279[_0x222540(0x8e)]),console[_0x222540(0x8f)](_0x222540(0x94)+_0x16977c),console['error'](_0x222540(0x91)+_0x57e309),console[_0x222540(0x8f)](_0x222540(0x85)+_0xdb84b3),console[_0x222540(0x8f)](_0x222540(0x96)+_0x1ebbb4));const _0xe35bba=await withSpinner(_0x222540(0x9b)+_0x57e309+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x81)](_0x57e309),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x204ad2=_0xe35bba[_0x222540(0x9f)];let _0xd5a612;if(_0x54e5d0[_0x222540(0x88)][_0x222540(0x9e)]>0x2){const _0x1e68de=await withSpinner(_0x222540(0xa4)+_0x1ebbb4+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x9c)](_0x1ebbb4),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x14ce2d=_0x1e68de['data'];if(_0x14ce2d['type']!==_0x222540(0xaa)&&_0x14ce2d['type']!==_0x222540(0x80))return console['error'](_0x222540(0x84)),0x1;_0xd5a612=_0x14ce2d[_0x222540(0xb4)];}else{if(_0xaa1279[_0x222540(0xaa)]){const _0x55a293=await withSpinner(_0x222540(0xac)+_0xaa1279[_0x222540(0xaa)]+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)]['resolveFolderId'](_0x204ad2,_0xaa1279[_0x222540(0xaa)]),{'verbose':_0xaa1279['verbose']});_0xd5a612=_0x55a293['data'];}}_0xaa1279[_0x222540(0xa9)]&&_0xd5a612&&console['error'](_0x222540(0x92)+_0xd5a612);const _0x20240c=await loadJSONFromOptions(_0xaa1279['rule'],_0xaa1279[_0x222540(0xa6)]),_0x37cb87={'name':_0xdb84b3,'description':_0xaa1279['description'],'rule':_0x20240c,'kind':_0xaa1279[_0x222540(0x95)]!==undefined?parseInt(_0xaa1279[_0x222540(0x95)],0xa):undefined,'isVisible':_0xaa1279[_0x222540(0x83)]?![]:undefined,'segmentFolderId':_0xd5a612,'countPopulation':_0xaa1279[_0x222540(0xab)]?![]:undefined},_0x885e90=await withSpinner('Creating\x20segment\x20\x27'+_0xdb84b3+_0x222540(0xa1),()=>_0x48a9b[_0x222540(0x87)][_0x222540(0x8a)](_0x204ad2,_0x37cb87),{'verbose':_0xaa1279[_0x222540(0xa9)]}),_0x4380f1=_0x885e90[_0x222540(0x9f)];return console[_0x222540(0x8f)](_0x222540(0xaf)+_0x4380f1[_0x222540(0x97)]+'\x27\x20with\x20ID:\x20'+_0x4380f1['id']),_0x16977c!==_0x52bdf3&&console[_0x222540(0x8f)](_0x222540(0xb6)+_0x16977c),await handleSDKOutput([_0x4380f1],_0xaa1279),0x0;}}
@@ -1 +1 @@
1
- const a27_0x1ca03e=a27_0x3ecc;(function(_0x6b4b02,_0x4057a5){const _0x49f187=a27_0x3ecc,_0x3e0207=_0x6b4b02();while(!![]){try{const _0xb3d5e2=-parseInt(_0x49f187(0x11f))/0x1+-parseInt(_0x49f187(0x122))/0x2+-parseInt(_0x49f187(0x127))/0x3+-parseInt(_0x49f187(0x12a))/0x4+-parseInt(_0x49f187(0x131))/0x5*(parseInt(_0x49f187(0x12b))/0x6)+parseInt(_0x49f187(0x12e))/0x7+parseInt(_0x49f187(0x11d))/0x8;if(_0xb3d5e2===_0x4057a5)break;else _0x3e0207['push'](_0x3e0207['shift']());}catch(_0x569e7f){_0x3e0207['push'](_0x3e0207['shift']());}}}(a27_0x2ab6,0x25c66));function a27_0x2ab6(){const _0x27250e=['51160CEcBxn','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segment:fields','87980icPifZ','description','Listing\x20fields\x20for\x20\x27','jsonl','error','284520NKCTlo','Site:\x20','verbose','280220qHNiwG','229818MziAKE','site','List\x20available\x20fields\x20for\x20segmentation','1136016JOLMRc','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','name','5lxzdmQ','\x20field','Parent\x20segment:\x20','parentSegment','✔\x20Found\x20','\x27...','2326288ywFMIL','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a27_0x2ab6=function(){return _0x27250e;};return a27_0x2ab6();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a27_0x3ecc(_0x1b1658,_0xa9c0a3){_0x1b1658=_0x1b1658-0x11a;const _0x2ab6f8=a27_0x2ab6();let _0x3ecce2=_0x2ab6f8[_0x1b1658];return _0x3ecce2;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a27_0x1ca03e(0x130)]=a27_0x1ca03e(0x121);[a27_0x1ca03e(0x123)]=a27_0x1ca03e(0x12d);async['execute'](_0x38c021){const _0x4e25c1=a27_0x1ca03e,{options:_0x3bfb3d,args:_0x48892c,tdx:_0x817703}=_0x38c021,_0x27950b=_0x48892c[0x0]||_0x3bfb3d[_0x4e25c1(0x11a)];if(!_0x27950b)return console['error'](_0x4e25c1(0x11e)),console[_0x4e25c1(0x126)](_0x4e25c1(0x12f)),console[_0x4e25c1(0x126)](_0x4e25c1(0x120)),0x1;_0x3bfb3d[_0x4e25c1(0x129)]&&(console[_0x4e25c1(0x126)](_0x4e25c1(0x128)+_0x3bfb3d[_0x4e25c1(0x12c)]),console[_0x4e25c1(0x126)](_0x4e25c1(0x133)+_0x27950b));const _0x3bc704=await withSpinner(_0x4e25c1(0x124)+_0x27950b+_0x4e25c1(0x11c),()=>_0x817703['segment']['listFields'](_0x27950b),{'verbose':_0x3bfb3d['verbose']}),_0x418085=_0x3bc704['data'];console[_0x4e25c1(0x126)](_0x4e25c1(0x11b)+_0x418085['length']+_0x4e25c1(0x132)+(_0x418085['length']!==0x1?'s':''));if(_0x3bfb3d['json']||_0x3bfb3d[_0x4e25c1(0x125)])return await handleSDKOutput(_0x418085,_0x3bfb3d),0x0;return displayFieldsHumanReadable(_0x418085,_0x27950b),0x0;}}
1
+ const a27_0x29f739=a27_0x24a1;(function(_0x5bc519,_0xc0743){const _0x379728=a27_0x24a1,_0x339d06=_0x5bc519();while(!![]){try{const _0x3ef594=-parseInt(_0x379728(0xf6))/0x1+parseInt(_0x379728(0xfe))/0x2*(-parseInt(_0x379728(0xe8))/0x3)+-parseInt(_0x379728(0xee))/0x4+-parseInt(_0x379728(0xf0))/0x5*(-parseInt(_0x379728(0xf9))/0x6)+parseInt(_0x379728(0xfc))/0x7+parseInt(_0x379728(0xe5))/0x8+-parseInt(_0x379728(0xf1))/0x9;if(_0x3ef594===_0xc0743)break;else _0x339d06['push'](_0x339d06['shift']());}catch(_0x36a50b){_0x339d06['push'](_0x339d06['shift']());}}}(a27_0x4bd9,0x49f7b));import{BaseCommand}from'./command.js';function a27_0x4bd9(){const _0x19d50b=['listFields','11905snBjci','1742481kmgJDK','verbose','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','jsonl','520020bjSAsf','json','\x20field','954qNssYU','\x27...','segment','3901541LGsETe','error','2638HvKHem','1783336gJDLTD','description','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','321eACHdp','✔\x20Found\x20','parentSegment','site','data','length','4504UYEoRc'];a27_0x4bd9=function(){return _0x19d50b;};return a27_0x4bd9();}function a27_0x24a1(_0x225beb,_0x4c20bd){_0x225beb=_0x225beb-0xe5;const _0x4bd9b5=a27_0x4bd9();let _0x24a154=_0x4bd9b5[_0x225beb];return _0x24a154;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a27_0x29f739(0xe6)]=a27_0x29f739(0xf3);async['execute'](_0x3a7bdd){const _0x326b3b=a27_0x29f739,{options:_0x5142e5,args:_0x17ef00,tdx:_0x4a08f7}=_0x3a7bdd,_0x185edf=_0x17ef00[0x0]||_0x5142e5[_0x326b3b(0xea)];if(!_0x185edf)return console[_0x326b3b(0xfd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x326b3b(0xfd)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x326b3b(0xfd)](_0x326b3b(0xe7)),0x1;_0x5142e5[_0x326b3b(0xf2)]&&(console[_0x326b3b(0xfd)]('Site:\x20'+_0x5142e5[_0x326b3b(0xeb)]),console['error'](_0x326b3b(0xf4)+_0x185edf));const _0x3ab6dc=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x185edf+_0x326b3b(0xfa),()=>_0x4a08f7[_0x326b3b(0xfb)][_0x326b3b(0xef)](_0x185edf),{'verbose':_0x5142e5[_0x326b3b(0xf2)]}),_0x2e4f4b=_0x3ab6dc[_0x326b3b(0xec)];console[_0x326b3b(0xfd)](_0x326b3b(0xe9)+_0x2e4f4b[_0x326b3b(0xed)]+_0x326b3b(0xf8)+(_0x2e4f4b[_0x326b3b(0xed)]!==0x1?'s':''));if(_0x5142e5[_0x326b3b(0xf7)]||_0x5142e5[_0x326b3b(0xf5)])return await handleSDKOutput(_0x2e4f4b,_0x5142e5),0x0;return displayFieldsHumanReadable(_0x2e4f4b,_0x185edf),0x0;}}
@@ -1 +1 @@
1
- const a28_0x897b72=a28_0x2d36;(function(_0x50baed,_0x230cc3){const _0x4050ae=a28_0x2d36,_0x3c427c=_0x50baed();while(!![]){try{const _0x360efd=parseInt(_0x4050ae(0x1a2))/0x1+parseInt(_0x4050ae(0x1a3))/0x2+parseInt(_0x4050ae(0x1c8))/0x3*(-parseInt(_0x4050ae(0x198))/0x4)+parseInt(_0x4050ae(0x1bc))/0x5+parseInt(_0x4050ae(0x1ab))/0x6*(parseInt(_0x4050ae(0x1d4))/0x7)+parseInt(_0x4050ae(0x1c7))/0x8*(-parseInt(_0x4050ae(0x1aa))/0x9)+-parseInt(_0x4050ae(0x1c6))/0xa;if(_0x360efd===_0x230cc3)break;else _0x3c427c['push'](_0x3c427c['shift']());}catch(_0x65b654){_0x3c427c['push'](_0x3c427c['shift']());}}}(a28_0x2e76,0xa0b1b));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';function a28_0x2d36(_0x57e224,_0x5983e4){_0x57e224=_0x57e224-0x194;const _0x2e76b1=a28_0x2e76();let _0x2d3622=_0x2e76b1[_0x57e224];return _0x2d3622;}function a28_0x2e76(){const _0x2b8aa2=['absolutePath','dirname','568736kxImcs','1401162cEUrcD','Site:\x20','setPhase','no_parent','helpText','yellow','segment','891342AEUyZC','2706cFgxmn','description','Write\x20','\x20changed\x20files','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','isNew','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','diff','parentName','\x0aChanges\x20to\x20\x27','file','cyan','data','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20activations','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','946075rzpkXp','message','resourceName','Parent\x20segment:\x20','length','errorCode','journeys','content','\x20=\x20','relativePath','13666110nrjvAi','8iCeDeT','175605sqRzsV','\x20new\x20files','counts','green','\x20with\x20','\x20unchanged\x20files','red','✔\x20Pulled\x20','files','pullSegments','\x20files\x20to\x20','\x20\x20Target:\x20','11235icPjdP','targetDir','\x0aPull\x20summary\x20for\x20\x27','error','✔\x20All\x20files\x20are\x20up\x20to\x20date','site','Pulling\x20segments\x20from\x20\x27','\x20journeys','✔\x20Context\x20set:\x20','verbose','journeyVersions','\x20versions)','Target\x20resource:\x20','repeat','filter','\x20\x20🎯\x20','Aborted.','4RuktxK','\x27...','hasChanges','type','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','Error:\x20','dim','segments'];a28_0x2e76=function(){return _0x2b8aa2;};return a28_0x2e76();}import{saveSessionContext}from'../core/session.js';import a28_0x12f19e from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x5e97f9 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']='segment:pull';[a28_0x897b72(0x1ac)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async['execute'](_0x1aa3f0){const _0x597e3f=a28_0x897b72,{options:_0x196512,args:_0x350c73,tdx:_0x1a0afe}=_0x1aa3f0,_0x7f9bde=_0x196512,_0x4e57bf=await resolveTarget({'arg':_0x350c73[0x0],'contextParent':_0x196512['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x4e57bf))return _0x4e57bf[_0x597e3f(0x1c1)]===_0x597e3f(0x1a6)?(console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1b1))),console['error'](_0x597e3f(0x19c)),console[_0x597e3f(0x1d7)](_0x597e3f(0x1bb)),console[_0x597e3f(0x1d7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file')):(console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1ce)](_0x597e3f(0x19d)+_0x4e57bf[_0x597e3f(0x1bd)]+'\x0a')),_0x4e57bf[_0x597e3f(0x1a7)]&&console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1b6)](_0x4e57bf['helpText']))),0x1;const _0x52e995=_0x4e57bf['parentName'],_0x2b0833=_0x4e57bf[_0x597e3f(0x1d5)],_0x48330e=_0x4e57bf[_0x597e3f(0x19b)]===_0x597e3f(0x1b5)?_0x4e57bf[_0x597e3f(0x1be)]:undefined;_0x7f9bde['verbose']&&(console['error'](_0x597e3f(0x1a4)+_0x7f9bde[_0x597e3f(0x1d9)]),console[_0x597e3f(0x1d7)](_0x597e3f(0x1bf)+_0x52e995),_0x48330e&&console['error'](_0x597e3f(0x1e0)+_0x48330e));const _0x2d644e=await withProgressSpinner(_0x597e3f(0x1da)+_0x52e995+_0x597e3f(0x199),_0x3f7b5c=>_0x1a0afe[_0x597e3f(0x1a9)][_0x597e3f(0x1d1)](_0x52e995,{'targetDir':_0x2b0833,'targetResourceName':_0x48330e,'verbose':_0x7f9bde[_0x597e3f(0x1dd)],'progress':{'update':_0x562042=>{const _0x5a4355=_0x597e3f;_0x3f7b5c[_0x5a4355(0x1a5)](_0x562042),_0x7f9bde['verbose']&&console[_0x5a4355(0x1d7)]('\x20\x20'+_0x562042);}}}),{'verbose':_0x7f9bde['verbose']}),_0x1e10a2=_0x2d644e[_0x597e3f(0x1b7)];if(_0x1e10a2['counts'][_0x597e3f(0x19f)]===0x0&&_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]===0x0)return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1af)+_0x1e10a2[_0x597e3f(0x1b3)]+'\x27')),0x0;const _0x52465e=_0x1e10a2[_0x597e3f(0x1d0)]['filter'](_0x2edfd6=>_0x2edfd6[_0x597e3f(0x1b0)]),_0x30388c=_0x1e10a2[_0x597e3f(0x1d0)][_0x597e3f(0x195)](_0x14e223=>!_0x14e223[_0x597e3f(0x1b0)]&&_0x14e223[_0x597e3f(0x19a)]),_0x332954=_0x1e10a2[_0x597e3f(0x1d0)][_0x597e3f(0x195)](_0x17c246=>!_0x17c246[_0x597e3f(0x1b0)]&&!_0x17c246[_0x597e3f(0x19a)]);console[_0x597e3f(0x1d7)](_0x597e3f(0x1d6)+_0x1e10a2[_0x597e3f(0x1b3)]+'\x27:'),console[_0x597e3f(0x1d7)](_0x597e3f(0x196)+a28_0x12f19e['cyan'](_0x1e10a2['counts']['segments']+'\x20segments')+_0x597e3f(0x1cc)+a28_0x12f19e['cyan'](_0x1e10a2[_0x597e3f(0x1ca)]['activations']+_0x597e3f(0x1b9)));if(_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]>0x0){const _0x13bc11=_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1de)]>_0x1e10a2['counts'][_0x597e3f(0x1c2)]?'\x20('+_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1de)]+_0x597e3f(0x1df):'';console[_0x597e3f(0x1d7)]('\x20\x20🗺️\x20\x20'+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]+_0x597e3f(0x1db))+a28_0x12f19e['dim'](_0x13bc11));}console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x1cb)]('+\x20'+_0x52465e[_0x597e3f(0x1c0)]+_0x597e3f(0x1c9))),console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x1a8)]('~\x20'+_0x30388c[_0x597e3f(0x1c0)]+_0x597e3f(0x1ae))),console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x19e)]('=\x20'+_0x332954[_0x597e3f(0x1c0)]+_0x597e3f(0x1cd))),console[_0x597e3f(0x1d7)](_0x597e3f(0x1d3)+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2['targetDir'])+'\x0a');if(_0x30388c[_0x597e3f(0x1c0)]>0x0)for(const _0x5ba79 of _0x30388c){console['error'](_0x597e3f(0x1b4)+_0x5ba79[_0x597e3f(0x1c5)]+'\x27:'),console[_0x597e3f(0x1d7)]('─'['repeat'](0x3c)),console[_0x597e3f(0x1d7)](_0x5ba79[_0x597e3f(0x1b2)]),console[_0x597e3f(0x1d7)]('─'[_0x597e3f(0x194)](0x3c));}if(_0x7f9bde['dryRun'])return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1b8))),0x0;if(_0x52465e[_0x597e3f(0x1c0)]===0x0&&_0x30388c[_0x597e3f(0x1c0)]===0x0)return console['error'](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1d8))),saveSessionContext({'parent_segment':_0x1e10a2[_0x597e3f(0x1b3)]},_0x7f9bde['session']),console[_0x597e3f(0x1d7)](a28_0x12f19e['green'](_0x597e3f(0x1dc)+a28_0x12f19e['dim']('parent_segment')+'\x20=\x20'+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2[_0x597e3f(0x1b3)]))),0x0;if(!_0x7f9bde['yes']){const _0x49b3f9=await confirmKey(_0x597e3f(0x1ad)+(_0x52465e[_0x597e3f(0x1c0)]+_0x30388c[_0x597e3f(0x1c0)])+'\x20files?');if(!_0x49b3f9)return console[_0x597e3f(0x1d7)](_0x597e3f(0x197)),0x1;}for(const _0x3cfb7d of _0x1e10a2[_0x597e3f(0x1d0)]){if(_0x3cfb7d[_0x597e3f(0x1b0)]||_0x3cfb7d['hasChanges']){const _0x28428f=a28_0x5e97f9[_0x597e3f(0x1a1)](_0x3cfb7d[_0x597e3f(0x1a0)]);!existsSync(_0x28428f)&&mkdirSync(_0x28428f,{'recursive':!![]}),writeFileSync(_0x3cfb7d['absolutePath'],_0x3cfb7d[_0x597e3f(0x1c3)],_0x597e3f(0x1ba));}}return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1cf)+(_0x52465e[_0x597e3f(0x1c0)]+_0x30388c[_0x597e3f(0x1c0)])+_0x597e3f(0x1d2)+_0x1e10a2[_0x597e3f(0x1d5)])),saveSessionContext({'parent_segment':_0x1e10a2[_0x597e3f(0x1b3)]},_0x7f9bde['session']),console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1dc)+a28_0x12f19e[_0x597e3f(0x19e)]('parent_segment')+_0x597e3f(0x1c4)+a28_0x12f19e['cyan'](_0x1e10a2['parentName']))),0x0;}}
1
+ const a28_0x287038=a28_0x212f;(function(_0x486346,_0x5150b4){const _0x55e6b3=a28_0x212f,_0x46223b=_0x486346();while(!![]){try{const _0x36eeb1=-parseInt(_0x55e6b3(0xcc))/0x1+parseInt(_0x55e6b3(0x99))/0x2+parseInt(_0x55e6b3(0xac))/0x3*(-parseInt(_0x55e6b3(0xd0))/0x4)+parseInt(_0x55e6b3(0xd4))/0x5+-parseInt(_0x55e6b3(0x9d))/0x6*(-parseInt(_0x55e6b3(0xb1))/0x7)+-parseInt(_0x55e6b3(0xbb))/0x8+parseInt(_0x55e6b3(0x9b))/0x9*(parseInt(_0x55e6b3(0xab))/0xa);if(_0x36eeb1===_0x5150b4)break;else _0x46223b['push'](_0x46223b['shift']());}catch(_0x4dfefb){_0x46223b['push'](_0x46223b['shift']());}}}(a28_0x2039,0xae227));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_0x212f(_0x46439a,_0x3c7d27){_0x46439a=_0x46439a-0x93;const _0x2039ed=a28_0x2039();let _0x212fb9=_0x2039ed[_0x46439a];return _0x212fb9;}import a28_0x2cb583 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x2e2c35 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{[a28_0x287038(0xd6)]=a28_0x287038(0xbc);[a28_0x287038(0xb5)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a28_0x287038(0xba)](_0x6746f7){const _0x14fd16=a28_0x287038,{options:_0x59e472,args:_0x3f9efc,tdx:_0x4f6ff}=_0x6746f7,_0x21d22d=_0x59e472,_0x2a1443=await resolveTarget({'arg':_0x3f9efc[0x0],'contextParent':_0x59e472[_0x14fd16(0xc4)],'cwd':process[_0x14fd16(0xc3)]()});if(!isSuccessfulResolution(_0x2a1443))return _0x2a1443[_0x14fd16(0xd1)]===_0x14fd16(0xd9)?(console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xc2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x14fd16(0xd7)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x14fd16(0xd7)](_0x14fd16(0xaa)),console[_0x14fd16(0xd7)](_0x14fd16(0xaf))):(console['error'](a28_0x2cb583[_0x14fd16(0x9c)](_0x14fd16(0xa9)+_0x2a1443[_0x14fd16(0xce)]+'\x0a')),_0x2a1443['helpText']&&console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xb6)](_0x2a1443[_0x14fd16(0xb3)]))),0x1;const _0x634c8e=_0x2a1443[_0x14fd16(0xda)],_0x5d5698=_0x2a1443['targetDir'],_0x147a5a=_0x2a1443[_0x14fd16(0xa3)]===_0x14fd16(0x98)?_0x2a1443[_0x14fd16(0xe2)]:undefined;_0x21d22d[_0x14fd16(0xe0)]&&(console['error'](_0x14fd16(0xd5)+_0x21d22d[_0x14fd16(0xca)]),console[_0x14fd16(0xd7)](_0x14fd16(0xb8)+_0x634c8e),_0x147a5a&&console['error'](_0x14fd16(0xcf)+_0x147a5a));const _0x353f03=await withProgressSpinner(_0x14fd16(0xd3)+_0x634c8e+_0x14fd16(0x96),_0x5be352=>_0x4f6ff[_0x14fd16(0x97)][_0x14fd16(0xa2)](_0x634c8e,{'targetDir':_0x5d5698,'targetResourceName':_0x147a5a,'verbose':_0x21d22d[_0x14fd16(0xe0)],'progress':{'update':_0x7a4333=>{const _0xe33417=_0x14fd16;_0x5be352[_0xe33417(0xc7)](_0x7a4333),_0x21d22d['verbose']&&console['error']('\x20\x20'+_0x7a4333);}}}),{'verbose':_0x21d22d[_0x14fd16(0xe0)]}),_0x1da348=_0x353f03[_0x14fd16(0xad)];if(_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xc6)]===0x0&&_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xd8)]===0x0)return console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xc2)](_0x14fd16(0x9e)+_0x1da348[_0x14fd16(0xda)]+'\x27')),0x0;const _0x5da4b6=_0x1da348[_0x14fd16(0x9f)]['filter'](_0x3b9202=>_0x3b9202['isNew']),_0x372f50=_0x1da348[_0x14fd16(0x9f)]['filter'](_0x2e4776=>!_0x2e4776['isNew']&&_0x2e4776[_0x14fd16(0xdb)]),_0x4d0860=_0x1da348['files']['filter'](_0x5d59ae=>!_0x5d59ae[_0x14fd16(0xde)]&&!_0x5d59ae[_0x14fd16(0xdb)]);console[_0x14fd16(0xd7)]('\x0aPull\x20summary\x20for\x20\x27'+_0x1da348['parentName']+'\x27:'),console[_0x14fd16(0xd7)](_0x14fd16(0xdc)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)]['segments']+_0x14fd16(0xc8))+_0x14fd16(0xb9)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xbe)]+'\x20activations'));if(_0x1da348['counts'][_0x14fd16(0xd8)]>0x0){const _0x222bb0=_0x1da348['counts'][_0x14fd16(0x9a)]>_0x1da348['counts'][_0x14fd16(0xd8)]?'\x20('+_0x1da348['counts'][_0x14fd16(0x9a)]+_0x14fd16(0xbd):'';console[_0x14fd16(0xd7)](_0x14fd16(0xb0)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xa6)][_0x14fd16(0xd8)]+_0x14fd16(0xc0))+a28_0x2cb583[_0x14fd16(0xb7)](_0x222bb0));}console['error']('\x20\x20'+a28_0x2cb583[_0x14fd16(0xcd)]('+\x20'+_0x5da4b6['length']+_0x14fd16(0xb4))),console['error']('\x20\x20'+a28_0x2cb583[_0x14fd16(0xc2)]('~\x20'+_0x372f50['length']+_0x14fd16(0xbf))),console[_0x14fd16(0xd7)]('\x20\x20'+a28_0x2cb583[_0x14fd16(0xb7)]('=\x20'+_0x4d0860['length']+_0x14fd16(0xa0))),console[_0x14fd16(0xd7)](_0x14fd16(0xe1)+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xae)])+'\x0a');if(_0x372f50[_0x14fd16(0x95)]>0x0)for(const _0x58ffa5 of _0x372f50){console[_0x14fd16(0xd7)]('\x0aChanges\x20to\x20\x27'+_0x58ffa5[_0x14fd16(0xc5)]+'\x27:'),console[_0x14fd16(0xd7)]('─'[_0x14fd16(0xdd)](0x3c)),console[_0x14fd16(0xd7)](_0x58ffa5['diff']),console['error']('─'[_0x14fd16(0xdd)](0x3c));}if(_0x21d22d[_0x14fd16(0xc1)])return console[_0x14fd16(0xd7)](a28_0x2cb583['yellow'](_0x14fd16(0x94))),0x0;if(_0x5da4b6[_0x14fd16(0x95)]===0x0&&_0x372f50[_0x14fd16(0x95)]===0x0)return console['error'](a28_0x2cb583[_0x14fd16(0xcd)](_0x14fd16(0x93))),saveSessionContext({'parent_segment':_0x1da348[_0x14fd16(0xda)]},_0x21d22d[_0x14fd16(0xcb)]),console[_0x14fd16(0xd7)](a28_0x2cb583['green'](_0x14fd16(0xb2)+a28_0x2cb583[_0x14fd16(0xb7)](_0x14fd16(0xc9))+_0x14fd16(0xa4)+a28_0x2cb583['cyan'](_0x1da348[_0x14fd16(0xda)]))),0x0;if(!_0x21d22d['yes']){const _0x29a02f=await confirmKey(_0x14fd16(0xa8)+(_0x5da4b6[_0x14fd16(0x95)]+_0x372f50['length'])+_0x14fd16(0xe4));if(!_0x29a02f)return console['error'](_0x14fd16(0xe3)),0x1;}for(const _0x2de1d1 of _0x1da348[_0x14fd16(0x9f)]){if(_0x2de1d1[_0x14fd16(0xde)]||_0x2de1d1[_0x14fd16(0xdb)]){const _0x24905d=a28_0x2e2c35[_0x14fd16(0xdf)](_0x2de1d1[_0x14fd16(0xa5)]);!existsSync(_0x24905d)&&mkdirSync(_0x24905d,{'recursive':!![]}),writeFileSync(_0x2de1d1[_0x14fd16(0xa5)],_0x2de1d1[_0x14fd16(0xa1)],_0x14fd16(0xa7));}}return console[_0x14fd16(0xd7)](a28_0x2cb583[_0x14fd16(0xcd)]('✔\x20Pulled\x20'+(_0x5da4b6[_0x14fd16(0x95)]+_0x372f50[_0x14fd16(0x95)])+_0x14fd16(0xd2)+_0x1da348[_0x14fd16(0xae)])),saveSessionContext({'parent_segment':_0x1da348[_0x14fd16(0xda)]},_0x21d22d[_0x14fd16(0xcb)]),console['error'](a28_0x2cb583['green'](_0x14fd16(0xb2)+a28_0x2cb583[_0x14fd16(0xb7)](_0x14fd16(0xc9))+'\x20=\x20'+a28_0x2cb583[_0x14fd16(0xb6)](_0x1da348[_0x14fd16(0xda)]))),0x0;}}function a28_0x2039(){const _0x4531f2=['2247962aaAdoj','journeyVersions','738ZQIrNv','red','1194RSHBVw','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','files','\x20unchanged\x20files','content','pullSegments','type','\x20=\x20','absolutePath','counts','utf-8','Write\x20','Error:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','11620xZdjuW','594ORbltb','data','targetDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20\x20🗺️\x20\x20','763dkVPUX','✔\x20Context\x20set:\x20','helpText','\x20new\x20files','description','cyan','dim','Parent\x20segment:\x20','\x20with\x20','execute','10301872rzUQcc','segment:pull','\x20versions)','activations','\x20changed\x20files','\x20journeys','dryRun','yellow','cwd','parentSegment','relativePath','segments','setPhase','\x20segments','parent_segment','site','session','158747PsuCmu','green','message','Target\x20resource:\x20','44auBiUL','errorCode','\x20files\x20to\x20','Pulling\x20segments\x20from\x20\x27','4604790ukEuSR','Site:\x20','name','error','journeys','no_parent','parentName','hasChanges','\x20\x20🎯\x20','repeat','isNew','dirname','verbose','\x20\x20Target:\x20','resourceName','Aborted.','\x20files?','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','length','\x27...','segment','file'];a28_0x2039=function(){return _0x4531f2;};return a28_0x2039();}
@@ -1 +1 @@
1
- const a29_0xd81b79=a29_0x3db9;(function(_0x336827,_0x4d1238){const _0x2d9462=a29_0x3db9,_0x56eb51=_0x336827();while(!![]){try{const _0x1a84ac=-parseInt(_0x2d9462(0x74))/0x1+-parseInt(_0x2d9462(0x6e))/0x2+parseInt(_0x2d9462(0x8b))/0x3+-parseInt(_0x2d9462(0xc6))/0x4+parseInt(_0x2d9462(0xb4))/0x5*(-parseInt(_0x2d9462(0x94))/0x6)+-parseInt(_0x2d9462(0xe2))/0x7*(parseInt(_0x2d9462(0xd2))/0x8)+parseInt(_0x2d9462(0x77))/0x9;if(_0x1a84ac===_0x4d1238)break;else _0x56eb51['push'](_0x56eb51['shift']());}catch(_0x56e8d7){_0x56eb51['push'](_0x56eb51['shift']());}}}(a29_0x3fc1,0xc0a8e));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_0x23cc89 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a29_0x3fc1(){const _0x50489f=['Error:\x20Directory\x20not\x20found:\x20','toUpdate','journeys','parentSegment','activations','changed','set','\x20to\x20delete','buildUserMaps','Fetching\x20parent\x20segment\x20details...','/app/ps/','Changes\x20to\x20journey:','delete','Error:\x20','\x20to\x20create','message','nameToType','listSegments','\x20new','unchanged','then','Scoped\x20to\x20folder:\x20','35510EpbGPR','\x20deleted','\x27...','segment:push','\x20\x20Activations:\x20','dim','toCreate','Preparing\x20journeys...','filePath','yes','journeysOnly','segments','setPhase','nameToId','/j/da/je','name','idToName','/e/','1402152TIBiMB','\x20\x20\x20\x20','Folders\x20to\x20create:','join','red','filter','relationships','(Journey\x20will\x20be\x20deleted)','Site:\x20','updated','existingJourney','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','24wsiDDI','deleted','\x20unchanged','cwd','isScoped','scopedFolderPath','file','listFolders','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','green','getOutputSchemaWithCache','\x20\x20Source:\x20','helpText','\x20\x20Activations:','New\x20journey:','folderPath','1987916kHmGLZ','resolveParentId','listJourneysWithDetailsFromParentSegment','paused','\x20created','created','segmentFolderId','yellow','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20updated','length','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','connection','\x20\x20Segments:\x20','journeyId','.yaml','targetDir','journey','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','segment','cyan','.yml','execute','\x20activations]','Error\x20parsing\x20YAML:\x20','getParent','\x20\x20📊\x20Segments:','journeyBundleName','Fetching\x20users\x20for\x20email\x20resolution...','state','description','results','errorCode','2852150GXhwRc','Delete\x20journey:','\x0aPush\x20summary\x20for\x20\x27','type','error','site','1506474IVDWkh','data','\x0a✔\x20Push\x20complete','40372470WRDQwb','diff','get','dryRun','repeat','push','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','getJourney','Parent\x20segment:\x20','Fetching\x20existing\x20activations...','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20folders...','folders','list','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','all','map','Delete\x20segment:','Fetching\x20existing\x20journeys...','📁\x20','3275217epZSHG','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','attributes','new','user','segment\x20or\x20journey','Push\x20','verbose','folderId','552sEXIOP','Aborted.','listActivations','Resolving\x20parent\x20segment\x20\x27','parentName','yamlConfig','toDelete','blue','\x20\x20🗺️\x20\x20Journeys:','New\x20segment:'];a29_0x3fc1=function(){return _0x50489f;};return a29_0x3fc1();}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';function a29_0x3db9(_0x2dc45a,_0x2cbf8f){_0x2dc45a=_0x2dc45a-0x69;const _0x3fc131=a29_0x3fc1();let _0x3db941=_0x3fc131[_0x2dc45a];return _0x3db941;}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_0xd81b79(0xb7);[a29_0xd81b79(0x6b)]=a29_0xd81b79(0xea);async[a29_0xd81b79(0xf8)](_0xc953e2){const _0x5c8320=a29_0xd81b79,{options:_0x53338b,args:_0x525037,tdx:_0x1a5074}=_0xc953e2,_0x1716c3=_0x53338b,_0x4e8628=await resolveTarget({'arg':_0x525037[0x0],'contextParent':_0x53338b[_0x5c8320(0xa1)],'cwd':process[_0x5c8320(0xd5)]()});if(!isSuccessfulResolution(_0x4e8628))return _0x4e8628[_0x5c8320(0x6d)]==='no_parent'?(console['error'](a29_0x23cc89[_0x5c8320(0xe9)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x5c8320(0x72)]('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'](_0x5c8320(0xd1)),console[_0x5c8320(0x72)]('\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[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0xab)+_0x4e8628[_0x5c8320(0xad)]+'\x0a')),_0x4e8628[_0x5c8320(0xde)]&&console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x4e8628[_0x5c8320(0xde)]))),0x1;if(_0x4e8628['type']==='parent_name')return console['error'](a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x9e)+_0x4e8628[_0x5c8320(0xf2)]+'\x0a')),console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x8c))),0x1;const _0x1fa6e7=_0x4e8628[_0x5c8320(0x98)],_0x1780da=_0x4e8628[_0x5c8320(0xf2)],_0x18abf9=_0x4e8628[_0x5c8320(0x71)]===_0x5c8320(0xd8)?_0x4e8628[_0x5c8320(0xbc)]:undefined,_0x4e3433=getScopedDetails(_0x4e8628),_0x56f883=_0x4e3433?.[_0x5c8320(0xd6)]??![],_0x352517=_0x4e3433?.[_0x5c8320(0xd7)]??'';if(!existsSync(_0x1780da))return console[_0x5c8320(0x72)](a29_0x23cc89['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x1780da+'\x0a')),console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x8c))),0x1;_0x1716c3['verbose']&&(console[_0x5c8320(0x72)](_0x5c8320(0xce)+_0x1716c3[_0x5c8320(0x73)]),console['error'](_0x5c8320(0x7f)+_0x1fa6e7),console['error']('Source\x20directory:\x20'+_0x1780da),_0x56f883&&console[_0x5c8320(0x72)](_0x5c8320(0xb3)+_0x352517));const _0x4fc09f=await withSpinner(_0x5c8320(0x97)+_0x1fa6e7+_0x5c8320(0xb6),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xe3)](_0x1fa6e7),{'verbose':_0x1716c3['verbose']}),_0x3e67a0=_0x4fc09f[_0x5c8320(0x75)],[_0x4265ff,_0x18dabd,_0x4f1260,_0x124dc2,_0x4e3e33]=await Promise[_0x5c8320(0x86)]([withSpinner(_0x5c8320(0xa7),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xfb)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xaf)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x82),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xd9)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x89),()=>_0x1a5074[_0x5c8320(0xf3)][_0x5c8320(0xe4)](_0x3e67a0,{'includeAllVersions':!![]}),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x69),()=>_0x1a5074[_0x5c8320(0x8f)][_0x5c8320(0xa6)](),{'verbose':_0x1716c3[_0x5c8320(0x92)]})['then'](_0x518a50=>_0x518a50[_0x5c8320(0x75)])]),_0xca36a4=_0x4265ff[_0x5c8320(0x75)],_0x5e820b=extractRootFolderId(_0xca36a4),_0x5748b2=_0x18dabd[_0x5c8320(0x75)],_0x556197=_0x4f1260[_0x5c8320(0x75)],{journeys:_0x292556,activationStepsById:_0x48c59f}=_0x124dc2[_0x5c8320(0x75)],_0x438cd5=new Map(_0x292556[_0x5c8320(0x87)](_0x55b094=>[_0x55b094['id'],_0x55b094])),_0xa2d679=_0x292556[_0x5c8320(0x87)](_0x120d43=>({'id':_0x120d43['id'],'name':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0xc3)],'journeyBundleName':_0x120d43['attributes'][_0x5c8320(0xfd)]||'','journeyBundleId':_0x120d43[_0x5c8320(0x8d)]['journeyBundleId']||'','versionNumber':_0x120d43[_0x5c8320(0x8d)]['versionNumber'],'description':_0x120d43['attributes']['description'],'state':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0x6a)],'paused':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0xe5)],'audienceId':_0x120d43['attributes']['audienceId'],'folderId':_0x120d43[_0x5c8320(0xcc)]?.['parentFolder']?.[_0x5c8320(0x75)]?.['id'],'createdAt':_0x120d43['attributes']['createdAt'],'updatedAt':_0x120d43[_0x5c8320(0x8d)]['updatedAt']})),{emailToId:_0x2404d3,idToEmail:_0x1bd91e}=_0x4e3e33,_0x11852f=await withSpinner(_0x5c8320(0x81),async()=>{const _0x127dde=_0x5c8320,_0x2c61c1=await _0x1a5074[_0x127dde(0xee)][_0x127dde(0x84)]();return buildConnectionMaps(_0x2c61c1);},{'verbose':_0x1716c3[_0x5c8320(0x92)]})[_0x5c8320(0xb2)](_0x1a5393=>_0x1a5393['data']),_0x183191=_0x11852f['nameToId'],_0x2e698e=_0x11852f[_0x5c8320(0xc4)],_0xe99475=_0x11852f[_0x5c8320(0xae)],_0x13c8e8={'emailToIdMap':_0x2404d3,'connectionNameToIdMap':_0x183191,'connectionNameToTypeMap':_0xe99475,'getSchema':_0x61f357=>_0x1a5074[_0x5c8320(0xee)][_0x5c8320(0xdc)](_0x61f357)};let {pathToId:_0x38bf71,idToPath:_0x4cf4c4}=buildFolderMaps(_0x556197);const _0x22c282=buildSegmentLookupMap(_0x5748b2,_0x4cf4c4),_0x219fe0=buildSegmentNameToIdMap(_0x5748b2),_0x1ff779=buildJourneyBundleLookupMap(_0xa2d679,_0x4cf4c4);let _0x31bb5b;if(_0x18abf9){if(!_0x18abf9['endsWith'](_0x5c8320(0xf7))&&!_0x18abf9['endsWith'](_0x5c8320(0xf1)))return console[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0x7d)+_0x18abf9+'\x0a')),0x1;_0x31bb5b=[_0x18abf9];}else _0x31bb5b=findYamlFiles(_0x1780da);if(_0x31bb5b[_0x5c8320(0xec)]===0x0)return console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xca)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x1780da+'\x0a')),console['error'](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x85))),0x1;let _0x2086a0,_0x191578;try{const _0x1480cd=parseAndClassifyYamlFiles(_0x31bb5b,_0x1780da,{'skipSegments':_0x1716c3['journeysOnly']});_0x2086a0=_0x1480cd['segments'],_0x191578=_0x1480cd[_0x5c8320(0xa0)];const _0x149c38=validateParsedFiles(_0x1480cd,_0x1780da);if(_0x149c38[_0x5c8320(0xec)]>0x0)return console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xca)]('\x0aValidation\x20failed:')),console[_0x5c8320(0x72)](formatValidationErrors(_0x149c38)),console[_0x5c8320(0x72)](a29_0x23cc89['yellow'](_0x5c8320(0xda))),0x1;}catch(_0x3d6cf9){return console[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0xfa)+(_0x3d6cf9 instanceof Error?_0x3d6cf9[_0x5c8320(0xad)]:_0x3d6cf9))),0x1;}if(_0x2086a0[_0x5c8320(0xec)]===0x0&&_0x191578[_0x5c8320(0xec)]===0x0){const _0x4262ac=_0x1716c3[_0x5c8320(0xbe)]?_0x5c8320(0xf3):_0x5c8320(0x90);return console['error'](a29_0x23cc89[_0x5c8320(0xe9)]('No\x20'+_0x4262ac+'\x20YAML\x20files\x20found')),0x0;}const _0xf0e166=new Map();_0x5748b2['length']>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&await withSpinner(_0x5c8320(0x80),async()=>{await batchAsync(_0x5748b2,async _0x5ccef5=>{const _0x2a2a61=a29_0x3db9,_0x589241=await _0x1a5074[_0x2a2a61(0xf5)][_0x2a2a61(0x96)](_0x3e67a0,_0x5ccef5['id']);_0xf0e166[_0x2a2a61(0xa4)](_0x5ccef5['id'],_0x589241);});},{'verbose':_0x1716c3['verbose']});const {segmentFiles:_0x5aec0c,foldersToCreate:_0x470f46}=await prepareSegmentFiles(_0x2086a0,{'segmentByFolderAndName':_0x22c282,'activationsBySegmentId':_0xf0e166,'folderPathToId':_0x38bf71,'idToEmailMap':_0x1bd91e,'connectionIdToNameMap':_0x2e698e},_0x13c8e8,_0x56f883,_0x352517),_0x180322=_0x18abf9?[]:findSegmentsToDelete(_0x5748b2,_0x2086a0[_0x5c8320(0x87)](({yamlConfig:_0x2e0b2e,folderPath:_0x320db8})=>({'yamlConfig':_0x2e0b2e,'folderPath':resolveTDFolderPath(_0x320db8,_0x56f883,_0x352517)})),_0x4cf4c4,_0x352517,_0x56f883),{journeyFiles:_0x2de132,foldersToCreate:_0x352a9c}=await withProgressSpinner(_0x5c8320(0xbb),async _0x5b082d=>prepareJourneyFiles(_0x191578,{'fetchJourney':async _0x6bc279=>_0x1a5074[_0x5c8320(0xf3)][_0x5c8320(0x7e)](_0x6bc279[_0x5c8320(0xf0)]),'journeyBundlesByFolderAndName':_0x1ff779,'folderPathToId':_0x38bf71,'idToEmailMap':_0x1bd91e,'connectionIdToNameMap':_0x2e698e,'existingSegments':_0x5748b2,'parentId':_0x3e67a0,'deps':_0x1a5074,'progress':{'update':_0x4f6c2e=>{const _0x1cb185=_0x5c8320;_0x5b082d[_0x1cb185(0xc0)](_0x4f6c2e),_0x1716c3[_0x1cb185(0x92)]&&console['error']('\x20\x20'+_0x4f6c2e);}},'journeyById':_0x438cd5,'activationStepsById':_0x48c59f},_0x56f883,_0x352517),{'verbose':_0x1716c3[_0x5c8320(0x92)]})[_0x5c8320(0xb2)](_0xf2b2fb=>_0xf2b2fb[_0x5c8320(0x75)]);for(const _0xdb7c3d of _0x352a9c){_0x470f46['add'](_0xdb7c3d);}const _0x5db2a0=_0x18abf9?[]:findJourneysToDelete(_0xa2d679,_0x191578['map'](({yamlConfig:_0x621559,folderPath:_0x1e35cd})=>({'yamlConfig':_0x621559,'folderPath':resolveTDFolderPath(_0x1e35cd,_0x56f883,_0x352517)})),_0x4cf4c4,_0x352517,_0x56f883),_0x2d37cf=calculatePushStats(_0x5aec0c,_0x2de132,_0x470f46,_0x180322,_0x5db2a0,!!_0x1716c3[_0x5c8320(0xaa)],!!_0x1716c3['journeysOnly']),_0x16bde8=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0x8e)],_0x94639=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0xa3)],_0x356126=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0xb1)],_0xc2f612=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0x9a)],_0x4f5f8d=_0x2d37cf[_0x5c8320(0x83)][_0x5c8320(0xba)],_0x26eb35=_0x2d37cf['journeys'][_0x5c8320(0x8e)],_0x1a3497=_0x2d37cf['journeys']['changed'],_0x4b3b7e=_0x2d37cf[_0x5c8320(0xa0)]['unchanged'],_0x34cde9=_0x2d37cf['journeys'][_0x5c8320(0x9a)],_0x4f7306=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x86)],_0xc6175c=_0x2d37cf['activations'][_0x5c8320(0xba)],_0x2f81fe=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x9f)],_0x3135fd=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x9a)];console['error'](_0x5c8320(0x70)+_0x1fa6e7+'\x27:');_0x4f5f8d[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)]('\x20\x20'+a29_0x23cc89[_0x5c8320(0x9b)](_0x5c8320(0x8a)+_0x4f5f8d[_0x5c8320(0xec)]+'\x20folders\x20to\x20create'));if(!_0x1716c3['journeysOnly']){console[_0x5c8320(0x72)](_0x5c8320(0xfc)),console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['green']('+\x20'+_0x16bde8[_0x5c8320(0xec)]+_0x5c8320(0xb0))),console['error'](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x94639['length']+'\x20changed'));if(_0xc2f612[_0x5c8320(0xec)]>0x0)console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xca)]('-\x20'+_0xc2f612[_0x5c8320(0xec)]+_0x5c8320(0xa5)));else _0x180322['length']>0x0&&!_0x1716c3[_0x5c8320(0xaa)]&&console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xb9)](_0x180322[_0x5c8320(0xec)]+_0x5c8320(0xed)));console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xb9)]('=\x20'+_0x356126[_0x5c8320(0xec)]+'\x20unchanged'));}if(_0x2de132[_0x5c8320(0xec)]>0x0||_0x5db2a0[_0x5c8320(0xec)]>0x0){console[_0x5c8320(0x72)](_0x5c8320(0x9c)),console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xdb)]('+\x20'+_0x26eb35[_0x5c8320(0xec)]+_0x5c8320(0xb0))),console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x1a3497[_0x5c8320(0xec)]+'\x20changed'));if(_0x34cde9[_0x5c8320(0xec)]>0x0)console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['red']('-\x20'+_0x34cde9[_0x5c8320(0xec)]+_0x5c8320(0xa5)));else _0x5db2a0[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xaa)]&&console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xb9)](_0x5db2a0[_0x5c8320(0xec)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xb9)]('=\x20'+_0x4b3b7e['length']+_0x5c8320(0xd4)));}_0x4f7306[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&(console[_0x5c8320(0x72)](''),console['error'](_0x5c8320(0xdf)),_0xc6175c[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xdb)]('+\x20'+_0xc6175c['length']+_0x5c8320(0xac))),_0x2f81fe['length']>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x2f81fe[_0x5c8320(0xec)]+'\x20to\x20update')),_0x3135fd[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['red']('-\x20'+_0x3135fd['length']+_0x5c8320(0xa5))));console['error'](_0x5c8320(0xdd)+a29_0x23cc89['cyan'](_0x1780da)+'\x0a');if(_0x4f5f8d[_0x5c8320(0xec)]>0x0){console[_0x5c8320(0x72)](_0x5c8320(0xc8));for(const _0x4baf13 of _0x4f5f8d){console['error']('\x20\x20'+a29_0x23cc89[_0x5c8320(0x9b)]('+')+'\x20'+_0x4baf13);}console[_0x5c8320(0x72)]('');}if(_0x16bde8[_0x5c8320(0xec)]>0x0&&!_0x1716c3['journeysOnly'])for(const _0x2c7b68 of _0x16bde8){const _0x28a001=_0x2c7b68[_0x5c8320(0xe1)]?_0x2c7b68['folderPath']+'/'+_0x2c7b68[_0x5c8320(0x99)]['name']:_0x2c7b68['yamlConfig']['name'],_0x2f264c=_0x2c7b68[_0x5c8320(0x99)][_0x5c8320(0xa2)]?.[_0x5c8320(0xec)]||0x0,_0x10d256=_0x2f264c>0x0?a29_0x23cc89['dim']('\x20['+_0x2f264c+'\x20activations]'):'';console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0x9d))+'\x20'+_0x28a001+_0x10d256),console['error']('─'[_0x5c8320(0x7b)](0x3c)),_0x2c7b68['diff']&&console[_0x5c8320(0x72)](_0x2c7b68[_0x5c8320(0x78)]),console['error']('─'['repeat'](0x3c));}if(_0xc2f612[_0x5c8320(0xec)]>0x0&&!_0x1716c3['journeysOnly'])for(const _0x5de2e9 of _0xc2f612){const _0x276892=_0x5de2e9[_0x5c8320(0xe8)]?_0x4cf4c4[_0x5c8320(0x79)](_0x5de2e9[_0x5c8320(0xe8)]['toString']())||'':'',_0xa84537=_0x276892?_0x276892+'/'+_0x5de2e9['name']:_0x5de2e9[_0x5c8320(0xc3)],_0x354f1f=_0xf0e166['get'](_0x5de2e9['id'])||[],_0x5f29c8=_0x354f1f[_0x5c8320(0xec)]>0x0?a29_0x23cc89[_0x5c8320(0xb9)]('\x20['+_0x354f1f[_0x5c8320(0xec)]+_0x5c8320(0xf9)):'';console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x88))+'\x20'+_0xa84537+_0x5f29c8),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));const _0x267e37=segmentWithActivationsToYaml(_0x5de2e9,_0x354f1f,undefined,_0x1bd91e,_0x2e698e),_0xc5bc15=segmentToYamlString(_0x267e37),_0x402eae=generateDiff(_0xc5bc15,'');console[_0x5c8320(0x72)](formatDiffWithColors(_0x402eae)),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));}const _0x29c654=_0x5aec0c[_0x5c8320(0xcb)](_0x5316bf=>!_0x5316bf['isNew']&&_0x5316bf['diff']);if(_0x29c654[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)])for(const _0x2e4ca0 of _0x29c654){const _0x8987e6=_0x2e4ca0[_0x5c8320(0xe1)]?_0x2e4ca0[_0x5c8320(0xe1)]+'/'+_0x2e4ca0['yamlConfig'][_0x5c8320(0xc3)]:_0x2e4ca0[_0x5c8320(0x99)]['name'];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89['yellow']('Changes\x20to:')+'\x20'+_0x8987e6),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console[_0x5c8320(0x72)](_0x2e4ca0['diff']),console[_0x5c8320(0x72)]('─'['repeat'](0x3c));}if(_0x26eb35['length']>0x0)for(const _0x5a2977 of _0x26eb35){const _0x2c75a6=_0x5a2977['folderPath']?_0x5a2977['folderPath']+'/'+_0x5a2977['yamlConfig'][_0x5c8320(0xc3)]:_0x5a2977[_0x5c8320(0x99)][_0x5c8320(0xc3)];console['error']('\x0a'+a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0xe0))+'\x20'+_0x2c75a6),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),_0x5a2977[_0x5c8320(0x78)]&&console[_0x5c8320(0x72)](_0x5a2977['diff']),console['error']('─'[_0x5c8320(0x7b)](0x3c));}const _0xc2d20d=_0x2de132[_0x5c8320(0xcb)](_0x3605a0=>!_0x3605a0['isNew']&&_0x3605a0[_0x5c8320(0x78)]);if(_0xc2d20d['length']>0x0)for(const _0x250da4 of _0xc2d20d){const _0x271584=_0x250da4['folderPath']?_0x250da4['folderPath']+'/'+_0x250da4[_0x5c8320(0x99)][_0x5c8320(0xc3)]:_0x250da4[_0x5c8320(0x99)][_0x5c8320(0xc3)];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89['yellow'](_0x5c8320(0xa9))+'\x20'+_0x271584),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console['error'](_0x250da4[_0x5c8320(0x78)]),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));}if(_0x34cde9[_0x5c8320(0xec)]>0x0)for(const _0x3b4e00 of _0x34cde9){const _0x51cbe3=_0x3b4e00[_0x5c8320(0x93)]?_0x4cf4c4[_0x5c8320(0x79)](_0x3b4e00['folderId'])||'':'',_0x2f3991=_0x51cbe3?_0x51cbe3+'/'+_0x3b4e00['journeyBundleName']:_0x3b4e00[_0x5c8320(0xfd)];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x6f))+'\x20'+_0x2f3991),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console['error'](a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0xcd))),console[_0x5c8320(0x72)]('─'['repeat'](0x3c));}if(_0x1716c3[_0x5c8320(0x7a)])return console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x4e0b9f=_0x1716c3['journeysOnly']?![]:_0x16bde8[_0x5c8320(0xec)]>0x0||_0x94639['length']>0x0||_0xc2f612['length']>0x0,_0x5019ad=_0x26eb35['length']>0x0||_0x1a3497['length']>0x0||_0x34cde9[_0x5c8320(0xec)]>0x0,_0xc5d577=_0x1716c3[_0x5c8320(0xbe)]?![]:_0x4f7306[_0x5c8320(0xec)]>0x0,_0xfbfc82=_0x4f5f8d[_0x5c8320(0xec)]>0x0;if(!_0x4e0b9f&&!_0x5019ad&&!_0xc5d577&&!_0xfbfc82){const _0x4ec29d=_0x1716c3[_0x5c8320(0xbe)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x5c8320(0xf4);console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xdb)](_0x4ec29d));if(_0x18abf9&&_0x4b3b7e[_0x5c8320(0xec)]===0x1){const _0x723282=_0x4b3b7e[0x0];if(_0x723282[_0x5c8320(0xd0)]?.['id']){const _0x513502=getConsoleNextUrl(_0x1716c3[_0x5c8320(0x73)],_0x5c8320(0xa8)+_0x3e67a0+_0x5c8320(0xc5)+_0x723282[_0x5c8320(0xd0)]['id']+'/j/da/je');console['error']('\x20\x20'+a29_0x23cc89[_0x5c8320(0xf6)](_0x513502));}}return 0x0;}const _0x498dd0=_0x1716c3['journeysOnly']?_0x26eb35['length']+_0x1a3497['length']+_0x34cde9[_0x5c8320(0xec)]+_0x4f5f8d[_0x5c8320(0xec)]:_0x16bde8[_0x5c8320(0xec)]+_0x94639[_0x5c8320(0xec)]+_0xc2f612[_0x5c8320(0xec)]+_0x26eb35[_0x5c8320(0xec)]+_0x1a3497[_0x5c8320(0xec)]+_0x34cde9['length']+_0x4f5f8d['length']+_0x4f7306[_0x5c8320(0xec)];if(!_0x1716c3[_0x5c8320(0xbd)]&&_0x498dd0>0x0){const _0x4e64e4=await confirmKey(_0x5c8320(0x91)+_0x498dd0+'\x20changes?');if(!_0x4e64e4)return console['error'](_0x5c8320(0x95)),0x1;}const _0x1ff790={'withProgress':async(_0x315a34,_0x272954)=>{const _0x3e9fdc=_0x5c8320,_0x575dc6=await withSpinner(_0x315a34,_0x272954,{'verbose':_0x1716c3[_0x3e9fdc(0x92)]});return{'data':_0x575dc6[_0x3e9fdc(0x75)]};},'logInfo':_0x5c7cb3=>console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0x9b)]('✔\x20'+_0x5c7cb3)),'logSuccess':_0x4d42c5=>console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xdb)]('✔\x20'+_0x4d42c5)),'logWarning':_0x3f4d1d=>console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('⚠\x20'+_0x3f4d1d)),'logDeleted':_0x16a8d6=>console[_0x5c8320(0x72)](a29_0x23cc89['red']('✔\x20'+_0x16a8d6))},_0x55d3e9={'segment':_0x1a5074[_0x5c8320(0xf5)],'journey':_0x1a5074[_0x5c8320(0xf3)],'user':_0x1a5074[_0x5c8320(0x8f)],'connection':_0x1a5074[_0x5c8320(0xee)]};_0x4f5f8d['length']>0x0&&(_0x38bf71=await executePushFolders(_0x55d3e9,_0x4f5f8d,_0x38bf71,{'parentId':_0x3e67a0},_0x1ff790));const _0xd288c1={'rootFolderId':_0x5e820b,'folderPathToId':_0x38bf71,'folderIdToPath':_0x4cf4c4,'segmentNameToId':_0x219fe0,'activationsBySegmentId':_0xf0e166,'emailToIdMap':_0x2404d3,'idToEmailMap':_0x1bd91e,'connectionNameToIdMap':_0x11852f[_0x5c8320(0xc1)],'connectionIdToNameMap':_0x11852f['idToName'],'connectionNameToTypeMap':_0xe99475},_0x2ad97f=await executePushSegments(_0x55d3e9,_0x1716c3[_0x5c8320(0xbe)]?[]:_0x5aec0c,_0xd288c1,{'parentId':_0x3e67a0},_0x1ff790),_0x221961=_0x2ad97f['created'],_0x29b02f=_0x2ad97f[_0x5c8320(0xcf)],_0x5635c1=_0x2ad97f['activations'][_0x5c8320(0xe7)],_0x483b1c=_0x2ad97f['activations'][_0x5c8320(0xcf)],_0x53382c=_0x2ad97f['activations'][_0x5c8320(0xd3)],_0x2d57a3=await executePushSegmentDeletions(_0x55d3e9,_0x1716c3[_0x5c8320(0xbe)]?[]:_0xc2f612,_0x1ff790);let _0x1f0075=0x0,_0x2a1f35=0x0,_0x40ba3b=0x0;const _0x59a24e=new Map(_0x219fe0);for(const [_0x3fca0f,_0x4ccb34]of _0x2ad97f['createdSegmentIds']){_0x59a24e[_0x5c8320(0xa4)](_0x3fca0f,_0x4ccb34);}if(_0x2de132[_0x5c8320(0xec)]>0x0){const _0x5120cc={..._0xd288c1,'segmentNameToId':_0x59a24e,'existingSegments':_0x5748b2,'activationContext':_0x13c8e8},_0x435f7c=await executePushJourneys(_0x55d3e9,_0x2de132,_0x5120cc,{'parentId':_0x3e67a0,'rootFolderId':_0x5e820b,'verbose':_0x1716c3[_0x5c8320(0x92)]},_0x1ff790);_0x1f0075=_0x435f7c[_0x5c8320(0xe7)],_0x2a1f35=_0x435f7c['updated'];if(_0x18abf9&&_0x435f7c[_0x5c8320(0x6c)]['length']===0x1){const _0x3d8e22=_0x435f7c[_0x5c8320(0x6c)][0x0];if(_0x3d8e22[_0x5c8320(0xf0)]){const _0x121e16=getConsoleNextUrl(_0x1716c3[_0x5c8320(0x73)],_0x5c8320(0xa8)+_0x3e67a0+'/e/'+_0x3d8e22[_0x5c8320(0xf0)]+_0x5c8320(0xc2));console[_0x5c8320(0x72)]('\x20\x20'+a29_0x23cc89[_0x5c8320(0xf6)](_0x121e16));}}}for(const _0x18ea9e of _0x34cde9){console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x18ea9e[_0x5c8320(0xfd)])),_0x40ba3b++;}const _0x2555ff=[];if(_0x221961>0x0)_0x2555ff['push'](_0x221961+_0x5c8320(0xe6));if(_0x29b02f>0x0)_0x2555ff[_0x5c8320(0x7c)](_0x29b02f+_0x5c8320(0xeb));if(_0x2d57a3>0x0)_0x2555ff[_0x5c8320(0x7c)](_0x2d57a3+_0x5c8320(0xb5));const _0x312303=[];if(_0x1f0075>0x0)_0x312303[_0x5c8320(0x7c)](_0x1f0075+_0x5c8320(0xe6));if(_0x2a1f35>0x0)_0x312303[_0x5c8320(0x7c)](_0x2a1f35+_0x5c8320(0xeb));if(_0x40ba3b>0x0)_0x312303[_0x5c8320(0x7c)](_0x40ba3b+_0x5c8320(0xb5));const _0x4efa6e=[];if(_0x5635c1>0x0)_0x4efa6e[_0x5c8320(0x7c)](_0x5635c1+_0x5c8320(0xe6));if(_0x483b1c>0x0)_0x4efa6e[_0x5c8320(0x7c)](_0x483b1c+_0x5c8320(0xeb));if(_0x53382c>0x0)_0x4efa6e['push'](_0x53382c+_0x5c8320(0xb5));return console['error'](a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0x76))),_0x2555ff[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&console[_0x5c8320(0x72)](_0x5c8320(0xef)+_0x2555ff[_0x5c8320(0xc9)](',\x20')),_0x312303[_0x5c8320(0xec)]>0x0&&console['error']('\x20\x20Journeys:\x20'+_0x312303[_0x5c8320(0xc9)](',\x20')),_0x4efa6e['length']>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&console[_0x5c8320(0x72)](_0x5c8320(0xb8)+_0x4efa6e['join'](',\x20')),0x0;}}
1
+ const a29_0x5b747d=a29_0x1516;(function(_0x360a9a,_0xbffabd){const _0x1d77bb=a29_0x1516,_0x1d2a2a=_0x360a9a();while(!![]){try{const _0x20a3b1=-parseInt(_0x1d77bb(0x255))/0x1+parseInt(_0x1d77bb(0x276))/0x2*(-parseInt(_0x1d77bb(0x27a))/0x3)+parseInt(_0x1d77bb(0x253))/0x4*(parseInt(_0x1d77bb(0x24a))/0x5)+parseInt(_0x1d77bb(0x1fa))/0x6*(-parseInt(_0x1d77bb(0x25c))/0x7)+-parseInt(_0x1d77bb(0x25d))/0x8*(-parseInt(_0x1d77bb(0x211))/0x9)+-parseInt(_0x1d77bb(0x248))/0xa*(parseInt(_0x1d77bb(0x204))/0xb)+parseInt(_0x1d77bb(0x244))/0xc;if(_0x20a3b1===_0xbffabd)break;else _0x1d2a2a['push'](_0x1d2a2a['shift']());}catch(_0x52e6e3){_0x1d2a2a['push'](_0x1d2a2a['shift']());}}}(a29_0x4022,0x48f29));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_0x5e6929 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';function a29_0x4022(){const _0x4a4c50=['⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','user','journeysOnly','(Journey\x20will\x20be\x20deleted)','4245240JUVycD','dim','idToName','changed','11810htIXFl','\x20\x20Activations:\x20','10630pvQAUY','nameToType','repeat','journeys','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','getParent','Error:\x20Directory\x20not\x20found:\x20','paused','New\x20journey:','632mOzODy','segment','2260XVycfB','green','listJourneysWithDetailsFromParentSegment','targetDir','Changes\x20to\x20journey:','journeyBundleId','versionNumber','644BPcDqJ','8upnimx','red','Fetching\x20existing\x20segments...','yamlConfig','\x20new','\x20updated','\x20\x20Source:\x20','getJourney','\x20\x20📊\x20Segments:','parent_name','isScoped','file','\x20to\x20update','length','listActivations','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','toDelete','results','attributes','No\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','journeyId','Parent\x20segment:\x20','scopedFolderPath','698AZmgho','\x20created','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','3981lWWLFo','\x20activations]','endsWith','yellow','\x0aPush\x20summary\x20for\x20\x27','journeyBundleName','listFolders','journey','Push\x20','\x20\x20Activations:','existingJourney','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)','setPhase','segment:push','relationships','diff','toCreate','\x27...','delete','push','\x0aValidation\x20failed:','message','createdAt','cyan','getOutputSchemaWithCache','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isNew','parentSegment','toString','24132UWHGZy','Site:\x20','updatedAt','new','verbose','then','segment\x20or\x20journey','\x20unchanged','segments','Error:\x20','176yPDbyL','data','📁\x20','\x20\x20🗺️\x20\x20Journeys:','join','get','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','/e/','parentFolder','updated','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Preparing\x20journeys...','\x20deleted','4170762padCVf','type','no_parent','cwd','filter','listSegments','\x20changes?','/app/ps/','Scoped\x20to\x20folder:\x20','connection','\x0a✔\x20Push\x20complete','execute','name','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','description','segmentFolderId','/j/da/je','Resolving\x20parent\x20segment\x20\x27','Fetching\x20parent\x20segment\x20details...','\x20\x20Journeys:\x20','map','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','helpText','folderId','nameToId','\x20to\x20delete','yes','\x20\x20\x20\x20','activations','unchanged','resolveParentId','Delete\x20journey:','folderPath','state','Changes\x20to:','site','error','.yaml','\x20changed','blue','Aborted.','buildUserMaps','Fetching\x20existing\x20folders...','createdSegmentIds','list','\x20to\x20create','created'];a29_0x4022=function(){return _0x4a4c50;};return a29_0x4022();}function a29_0x1516(_0x2cdff6,_0x4590d0){_0x2cdff6=_0x2cdff6-0x1e0;const _0x402223=a29_0x4022();let _0x151650=_0x402223[_0x2cdff6];return _0x151650;}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{[a29_0x5b747d(0x21d)]=a29_0x5b747d(0x1ea);[a29_0x5b747d(0x21f)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a29_0x5b747d(0x21c)](_0x428954){const _0x4d7d81=a29_0x5b747d,{options:_0x4f8f47,args:_0x375ffa,tdx:_0xbd46d4}=_0x428954,_0x1bfe92=_0x4f8f47,_0x12b503=await resolveTarget({'arg':_0x375ffa[0x0],'contextParent':_0x4f8f47[_0x4d7d81(0x1f8)],'cwd':process[_0x4d7d81(0x214)]()});if(!isSuccessfulResolution(_0x12b503))return _0x12b503['errorCode']===_0x4d7d81(0x213)?(console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x21e))),console[_0x4d7d81(0x235)](_0x4d7d81(0x1e8)),console[_0x4d7d81(0x235)](_0x4d7d81(0x272)),console[_0x4d7d81(0x235)](_0x4d7d81(0x26c))):(console['error'](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x203)+_0x12b503['message']+'\x0a')),_0x12b503[_0x4d7d81(0x227)]&&console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x12b503['helpText']))),0x1;if(_0x12b503[_0x4d7d81(0x212)]===_0x4d7d81(0x266))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x250)+_0x12b503[_0x4d7d81(0x258)]+'\x0a')),console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x1f6))),0x1;const _0x45cca4=_0x12b503['parentName'],_0x132cd3=_0x12b503['targetDir'],_0x4c6f5e=_0x12b503[_0x4d7d81(0x212)]===_0x4d7d81(0x268)?_0x12b503['filePath']:undefined,_0x40bd7c=getScopedDetails(_0x12b503),_0x5b1b69=_0x40bd7c?.[_0x4d7d81(0x267)]??![],_0x21fc4d=_0x40bd7c?.[_0x4d7d81(0x275)]??'';if(!existsSync(_0x132cd3))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x250)+_0x132cd3+'\x0a')),console['error'](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x1f6))),0x1;_0x1bfe92[_0x4d7d81(0x1fe)]&&(console[_0x4d7d81(0x235)](_0x4d7d81(0x1fb)+_0x1bfe92['site']),console[_0x4d7d81(0x235)](_0x4d7d81(0x274)+_0x45cca4),console['error']('Source\x20directory:\x20'+_0x132cd3),_0x5b1b69&&console[_0x4d7d81(0x235)](_0x4d7d81(0x219)+_0x21fc4d));const _0x4920ad=await withSpinner(_0x4d7d81(0x222)+_0x45cca4+_0x4d7d81(0x1ee),()=>_0xbd46d4[_0x4d7d81(0x254)][_0x4d7d81(0x22f)](_0x45cca4),{'verbose':_0x1bfe92['verbose']}),_0x34c916=_0x4920ad[_0x4d7d81(0x205)],[_0x1f064b,_0x3c46bc,_0x2f79ec,_0x2724b1,_0x3262cd]=await Promise['all']([withSpinner(_0x4d7d81(0x223),()=>_0xbd46d4['segment'][_0x4d7d81(0x24f)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner(_0x4d7d81(0x25f),()=>_0xbd46d4['segment'][_0x4d7d81(0x216)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner(_0x4d7d81(0x23b),()=>_0xbd46d4[_0x4d7d81(0x254)][_0x4d7d81(0x1e3)](_0x34c916),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0xbd46d4[_0x4d7d81(0x1e4)][_0x4d7d81(0x257)](_0x34c916,{'includeAllVersions':!![]}),{'verbose':_0x1bfe92['verbose']}),withSpinner(_0x4d7d81(0x271),()=>_0xbd46d4[_0x4d7d81(0x241)][_0x4d7d81(0x23a)](),{'verbose':_0x1bfe92['verbose']})['then'](_0x4af25e=>_0x4af25e[_0x4d7d81(0x205)])]),_0x30a21d=_0x1f064b[_0x4d7d81(0x205)],_0x2b7c93=extractRootFolderId(_0x30a21d),_0x2da16c=_0x3c46bc[_0x4d7d81(0x205)],_0x42728b=_0x2f79ec[_0x4d7d81(0x205)],{journeys:_0x54fd1e,activationStepsById:_0x17b1ec}=_0x2724b1['data'],_0x2d736a=new Map(_0x54fd1e[_0x4d7d81(0x225)](_0x1d205c=>[_0x1d205c['id'],_0x1d205c])),_0x34025c=_0x54fd1e[_0x4d7d81(0x225)](_0x5ab047=>({'id':_0x5ab047['id'],'name':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x21d)],'journeyBundleName':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x1e2)]||'','journeyBundleId':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x25a)]||'','versionNumber':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x25b)],'description':_0x5ab047[_0x4d7d81(0x26f)]['description'],'state':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x232)],'paused':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x251)],'audienceId':_0x5ab047['attributes']['audienceId'],'folderId':_0x5ab047[_0x4d7d81(0x1eb)]?.[_0x4d7d81(0x20c)]?.[_0x4d7d81(0x205)]?.['id'],'createdAt':_0x5ab047[_0x4d7d81(0x26f)][_0x4d7d81(0x1f3)],'updatedAt':_0x5ab047['attributes'][_0x4d7d81(0x1fc)]})),{emailToId:_0x315eee,idToEmail:_0x580524}=_0x3262cd,_0x1ee79c=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x14fb61=_0x4d7d81,_0x581770=await _0xbd46d4[_0x14fb61(0x21a)][_0x14fb61(0x23d)]();return buildConnectionMaps(_0x581770);},{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]})[_0x4d7d81(0x1ff)](_0x8f1628=>_0x8f1628[_0x4d7d81(0x205)]),_0x3c91ce=_0x1ee79c[_0x4d7d81(0x229)],_0x3d68fd=_0x1ee79c[_0x4d7d81(0x246)],_0x46c356=_0x1ee79c[_0x4d7d81(0x24b)],_0x48f71b={'emailToIdMap':_0x315eee,'connectionNameToIdMap':_0x3c91ce,'connectionNameToTypeMap':_0x46c356,'getSchema':_0x546913=>_0xbd46d4[_0x4d7d81(0x21a)][_0x4d7d81(0x1f5)](_0x546913)};let {pathToId:_0x2b231f,idToPath:_0x3314ee}=buildFolderMaps(_0x42728b);const _0x5f3847=buildSegmentLookupMap(_0x2da16c,_0x3314ee),_0x459d15=buildSegmentNameToIdMap(_0x2da16c),_0x1b36da=buildJourneyBundleLookupMap(_0x34025c,_0x3314ee);let _0x220268;if(_0x4c6f5e){if(!_0x4c6f5e[_0x4d7d81(0x27c)]('.yml')&&!_0x4c6f5e['endsWith'](_0x4d7d81(0x236)))return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x226)+_0x4c6f5e+'\x0a')),0x1;_0x220268=[_0x4c6f5e];}else _0x220268=findYamlFiles(_0x132cd3);if(_0x220268[_0x4d7d81(0x26a)]===0x0)return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x132cd3+'\x0a')),console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1f4)](_0x4d7d81(0x20a))),0x1;let _0x3cbc24,_0x2c7ea4;try{const _0xeb1066=parseAndClassifyYamlFiles(_0x220268,_0x132cd3,{'skipSegments':_0x1bfe92[_0x4d7d81(0x242)]});_0x3cbc24=_0xeb1066[_0x4d7d81(0x202)],_0x2c7ea4=_0xeb1066[_0x4d7d81(0x24d)];const _0x38cf0a=validateParsedFiles(_0xeb1066,_0x132cd3);if(_0x38cf0a[_0x4d7d81(0x26a)]>0x0)return console['error'](a29_0x5e6929['red'](_0x4d7d81(0x1f1))),console[_0x4d7d81(0x235)](formatValidationErrors(_0x38cf0a)),console['error'](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x24e))),0x1;}catch(_0xc26426){return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('Error\x20parsing\x20YAML:\x20'+(_0xc26426 instanceof Error?_0xc26426[_0x4d7d81(0x1f2)]:_0xc26426))),0x1;}if(_0x3cbc24[_0x4d7d81(0x26a)]===0x0&&_0x2c7ea4['length']===0x0){const _0x324c12=_0x1bfe92['journeysOnly']?'journey':_0x4d7d81(0x200);return console['error'](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x270)+_0x324c12+'\x20YAML\x20files\x20found')),0x0;}const _0x4fb0f3=new Map();_0x2da16c[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x2da16c,async _0x784fcf=>{const _0x5bab9e=a29_0x1516,_0x18259e=await _0xbd46d4[_0x5bab9e(0x254)][_0x5bab9e(0x26b)](_0x34c916,_0x784fcf['id']);_0x4fb0f3['set'](_0x784fcf['id'],_0x18259e);});},{'verbose':_0x1bfe92['verbose']});const {segmentFiles:_0x304ce2,foldersToCreate:_0x4763a0}=await prepareSegmentFiles(_0x3cbc24,{'segmentByFolderAndName':_0x5f3847,'activationsBySegmentId':_0x4fb0f3,'folderPathToId':_0x2b231f,'idToEmailMap':_0x580524,'connectionIdToNameMap':_0x3d68fd},_0x48f71b,_0x5b1b69,_0x21fc4d),_0x47c4ed=_0x4c6f5e?[]:findSegmentsToDelete(_0x2da16c,_0x3cbc24[_0x4d7d81(0x225)](({yamlConfig:_0x4e4b1f,folderPath:_0x93eb22})=>({'yamlConfig':_0x4e4b1f,'folderPath':resolveTDFolderPath(_0x93eb22,_0x5b1b69,_0x21fc4d)})),_0x3314ee,_0x21fc4d,_0x5b1b69),{journeyFiles:_0x44348f,foldersToCreate:_0x5ee4c0}=await withProgressSpinner(_0x4d7d81(0x20f),async _0xadc146=>prepareJourneyFiles(_0x2c7ea4,{'fetchJourney':async _0x29a2db=>_0xbd46d4[_0x4d7d81(0x1e4)][_0x4d7d81(0x264)](_0x29a2db[_0x4d7d81(0x273)]),'journeyBundlesByFolderAndName':_0x1b36da,'folderPathToId':_0x2b231f,'idToEmailMap':_0x580524,'connectionIdToNameMap':_0x3d68fd,'existingSegments':_0x2da16c,'parentId':_0x34c916,'deps':_0xbd46d4,'progress':{'update':_0x56b32e=>{const _0x17aa26=_0x4d7d81;_0xadc146[_0x17aa26(0x1e9)](_0x56b32e),_0x1bfe92[_0x17aa26(0x1fe)]&&console[_0x17aa26(0x235)]('\x20\x20'+_0x56b32e);}},'journeyById':_0x2d736a,'activationStepsById':_0x17b1ec},_0x5b1b69,_0x21fc4d),{'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]})[_0x4d7d81(0x1ff)](_0x147981=>_0x147981['data']);for(const _0xd2730f of _0x5ee4c0){_0x4763a0['add'](_0xd2730f);}const _0x305e83=_0x4c6f5e?[]:findJourneysToDelete(_0x34025c,_0x2c7ea4['map'](({yamlConfig:_0x4accf1,folderPath:_0x32d2dd})=>({'yamlConfig':_0x4accf1,'folderPath':resolveTDFolderPath(_0x32d2dd,_0x5b1b69,_0x21fc4d)})),_0x3314ee,_0x21fc4d,_0x5b1b69),_0x278d54=calculatePushStats(_0x304ce2,_0x44348f,_0x4763a0,_0x47c4ed,_0x305e83,!!_0x1bfe92[_0x4d7d81(0x1ef)],!!_0x1bfe92[_0x4d7d81(0x242)]),_0x22a617=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x1fd)],_0x5c8952=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x247)],_0x55bf73=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x22e)],_0x1d4b34=_0x278d54[_0x4d7d81(0x202)][_0x4d7d81(0x26d)],_0x3f0754=_0x278d54['folders']['toCreate'],_0x4fc09d=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x1fd)],_0xb44f5e=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x247)],_0x2fe622=_0x278d54[_0x4d7d81(0x24d)][_0x4d7d81(0x22e)],_0x437d41=_0x278d54['journeys'][_0x4d7d81(0x26d)],_0x202f55=_0x278d54[_0x4d7d81(0x22d)]['all'],_0x44a84e=_0x278d54[_0x4d7d81(0x22d)][_0x4d7d81(0x1ed)],_0x290ed2=_0x278d54['activations']['toUpdate'],_0x4ef21f=_0x278d54[_0x4d7d81(0x22d)][_0x4d7d81(0x26d)];console[_0x4d7d81(0x235)](_0x4d7d81(0x1e1)+_0x45cca4+'\x27:');_0x3f0754[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x238)](_0x4d7d81(0x206)+_0x3f0754['length']+'\x20folders\x20to\x20create'));if(!_0x1bfe92[_0x4d7d81(0x242)]){console[_0x4d7d81(0x235)](_0x4d7d81(0x265)),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x22a617['length']+'\x20new')),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x1e0)]('~\x20'+_0x5c8952[_0x4d7d81(0x26a)]+_0x4d7d81(0x237)));if(_0x1d4b34[_0x4d7d81(0x26a)]>0x0)console['error'](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x25e)]('-\x20'+_0x1d4b34['length']+_0x4d7d81(0x22a)));else _0x47c4ed[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['delete']&&console[_0x4d7d81(0x235)]('\x20\x20\x20\x20'+a29_0x5e6929[_0x4d7d81(0x245)](_0x47c4ed[_0x4d7d81(0x26a)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x245)]('=\x20'+_0x55bf73['length']+_0x4d7d81(0x201)));}if(_0x44348f[_0x4d7d81(0x26a)]>0x0||_0x305e83[_0x4d7d81(0x26a)]>0x0){console[_0x4d7d81(0x235)](_0x4d7d81(0x207)),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x4fc09d['length']+_0x4d7d81(0x261))),console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x1e0)]('~\x20'+_0xb44f5e[_0x4d7d81(0x26a)]+_0x4d7d81(0x237)));if(_0x437d41[_0x4d7d81(0x26a)]>0x0)console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x25e)]('-\x20'+_0x437d41[_0x4d7d81(0x26a)]+'\x20to\x20delete'));else _0x305e83[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x1ef)]&&console['error']('\x20\x20\x20\x20'+a29_0x5e6929[_0x4d7d81(0x245)](_0x305e83[_0x4d7d81(0x26a)]+_0x4d7d81(0x278)));console['error'](_0x4d7d81(0x22c)+a29_0x5e6929['dim']('=\x20'+_0x2fe622[_0x4d7d81(0x26a)]+'\x20unchanged'));}_0x202f55[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&(console[_0x4d7d81(0x235)](''),console[_0x4d7d81(0x235)](_0x4d7d81(0x1e6)),_0x44a84e[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929[_0x4d7d81(0x256)]('+\x20'+_0x44a84e[_0x4d7d81(0x26a)]+_0x4d7d81(0x23e))),_0x290ed2[_0x4d7d81(0x26a)]>0x0&&console['error'](_0x4d7d81(0x22c)+a29_0x5e6929['yellow']('~\x20'+_0x290ed2[_0x4d7d81(0x26a)]+_0x4d7d81(0x269))),_0x4ef21f[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x22c)+a29_0x5e6929['red']('-\x20'+_0x4ef21f[_0x4d7d81(0x26a)]+_0x4d7d81(0x22a))));console['error'](_0x4d7d81(0x263)+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x132cd3)+'\x0a');if(_0x3f0754[_0x4d7d81(0x26a)]>0x0){console['error']('Folders\x20to\x20create:');for(const _0x5875f6 of _0x3f0754){console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929['blue']('+')+'\x20'+_0x5875f6);}console[_0x4d7d81(0x235)]('');}if(_0x22a617[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['journeysOnly'])for(const _0x4205e1 of _0x22a617){const _0x42327e=_0x4205e1[_0x4d7d81(0x231)]?_0x4205e1[_0x4d7d81(0x231)]+'/'+_0x4205e1[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x4205e1['yamlConfig'][_0x4d7d81(0x21d)],_0x1b8edd=_0x4205e1[_0x4d7d81(0x260)][_0x4d7d81(0x22d)]?.[_0x4d7d81(0x26a)]||0x0,_0x66c479=_0x1b8edd>0x0?a29_0x5e6929['dim']('\x20['+_0x1b8edd+_0x4d7d81(0x27b)):'';console['error']('\x0a'+a29_0x5e6929[_0x4d7d81(0x256)]('New\x20segment:')+'\x20'+_0x42327e+_0x66c479),console['error']('─'[_0x4d7d81(0x24c)](0x3c)),_0x4205e1[_0x4d7d81(0x1ec)]&&console[_0x4d7d81(0x235)](_0x4205e1[_0x4d7d81(0x1ec)]),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x1d4b34[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92['journeysOnly'])for(const _0x524700 of _0x1d4b34){const _0x5c48b1=_0x524700[_0x4d7d81(0x220)]?_0x3314ee[_0x4d7d81(0x209)](_0x524700[_0x4d7d81(0x220)][_0x4d7d81(0x1f9)]())||'':'',_0x2099bf=_0x5c48b1?_0x5c48b1+'/'+_0x524700['name']:_0x524700[_0x4d7d81(0x21d)],_0x1a6ed5=_0x4fb0f3[_0x4d7d81(0x209)](_0x524700['id'])||[],_0x298cb9=_0x1a6ed5[_0x4d7d81(0x26a)]>0x0?a29_0x5e6929[_0x4d7d81(0x245)]('\x20['+_0x1a6ed5[_0x4d7d81(0x26a)]+_0x4d7d81(0x27b)):'';console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929['red']('Delete\x20segment:')+'\x20'+_0x2099bf+_0x298cb9),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c));const _0x502cc7=segmentWithActivationsToYaml(_0x524700,_0x1a6ed5,undefined,_0x580524,_0x3d68fd),_0x19ba0e=segmentToYamlString(_0x502cc7),_0x47273f=generateDiff(_0x19ba0e,'');console[_0x4d7d81(0x235)](formatDiffWithColors(_0x47273f)),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}const _0x2e97d6=_0x304ce2[_0x4d7d81(0x215)](_0xc7553b=>!_0xc7553b[_0x4d7d81(0x1f7)]&&_0xc7553b[_0x4d7d81(0x1ec)]);if(_0x2e97d6[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)])for(const _0x8a37aa of _0x2e97d6){const _0x352172=_0x8a37aa[_0x4d7d81(0x231)]?_0x8a37aa[_0x4d7d81(0x231)]+'/'+_0x8a37aa[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x8a37aa[_0x4d7d81(0x260)][_0x4d7d81(0x21d)];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x233))+'\x20'+_0x352172),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c)),console[_0x4d7d81(0x235)](_0x8a37aa['diff']),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x4fc09d[_0x4d7d81(0x26a)]>0x0)for(const _0x352d53 of _0x4fc09d){const _0xd39434=_0x352d53[_0x4d7d81(0x231)]?_0x352d53['folderPath']+'/'+_0x352d53[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x352d53[_0x4d7d81(0x260)][_0x4d7d81(0x21d)];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x256)](_0x4d7d81(0x252))+'\x20'+_0xd39434),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),_0x352d53[_0x4d7d81(0x1ec)]&&console['error'](_0x352d53[_0x4d7d81(0x1ec)]),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c));}const _0x2c8cee=_0x44348f[_0x4d7d81(0x215)](_0xc32bf1=>!_0xc32bf1[_0x4d7d81(0x1f7)]&&_0xc32bf1['diff']);if(_0x2c8cee[_0x4d7d81(0x26a)]>0x0)for(const _0x4354a6 of _0x2c8cee){const _0x5334ee=_0x4354a6['folderPath']?_0x4354a6[_0x4d7d81(0x231)]+'/'+_0x4354a6[_0x4d7d81(0x260)][_0x4d7d81(0x21d)]:_0x4354a6[_0x4d7d81(0x260)]['name'];console['error']('\x0a'+a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x259))+'\x20'+_0x5334ee),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),console[_0x4d7d81(0x235)](_0x4354a6['diff']),console['error']('─'[_0x4d7d81(0x24c)](0x3c));}if(_0x437d41['length']>0x0)for(const _0xb9c601 of _0x437d41){const _0x4ab713=_0xb9c601[_0x4d7d81(0x228)]?_0x3314ee[_0x4d7d81(0x209)](_0xb9c601[_0x4d7d81(0x228)])||'':'',_0x27b8d9=_0x4ab713?_0x4ab713+'/'+_0xb9c601[_0x4d7d81(0x1e2)]:_0xb9c601['journeyBundleName'];console[_0x4d7d81(0x235)]('\x0a'+a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x230))+'\x20'+_0x27b8d9),console[_0x4d7d81(0x235)]('─'[_0x4d7d81(0x24c)](0x3c)),console['error'](a29_0x5e6929[_0x4d7d81(0x25e)](_0x4d7d81(0x243))),console[_0x4d7d81(0x235)]('─'['repeat'](0x3c));}if(_0x1bfe92['dryRun'])return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x1e0)](_0x4d7d81(0x20e))),0x0;const _0x39d039=_0x1bfe92['journeysOnly']?![]:_0x22a617['length']>0x0||_0x5c8952[_0x4d7d81(0x26a)]>0x0||_0x1d4b34['length']>0x0,_0x5eb464=_0x4fc09d[_0x4d7d81(0x26a)]>0x0||_0xb44f5e[_0x4d7d81(0x26a)]>0x0||_0x437d41[_0x4d7d81(0x26a)]>0x0,_0x45aafc=_0x1bfe92[_0x4d7d81(0x242)]?![]:_0x202f55[_0x4d7d81(0x26a)]>0x0,_0x21fcb1=_0x3f0754[_0x4d7d81(0x26a)]>0x0;if(!_0x39d039&&!_0x5eb464&&!_0x45aafc&&!_0x21fcb1){const _0x27b5da=_0x1bfe92['journeysOnly']?_0x4d7d81(0x279):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x256)](_0x27b5da));if(_0x4c6f5e&&_0x2fe622[_0x4d7d81(0x26a)]===0x1){const _0x482f3e=_0x2fe622[0x0];if(_0x482f3e['existingJourney']?.['id']){const _0x26e787=getConsoleNextUrl(_0x1bfe92[_0x4d7d81(0x234)],_0x4d7d81(0x218)+_0x34c916+_0x4d7d81(0x20b)+_0x482f3e[_0x4d7d81(0x1e7)]['id']+_0x4d7d81(0x221));console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x26e787));}}return 0x0;}const _0x10898c=_0x1bfe92['journeysOnly']?_0x4fc09d[_0x4d7d81(0x26a)]+_0xb44f5e[_0x4d7d81(0x26a)]+_0x437d41[_0x4d7d81(0x26a)]+_0x3f0754['length']:_0x22a617[_0x4d7d81(0x26a)]+_0x5c8952[_0x4d7d81(0x26a)]+_0x1d4b34[_0x4d7d81(0x26a)]+_0x4fc09d['length']+_0xb44f5e[_0x4d7d81(0x26a)]+_0x437d41[_0x4d7d81(0x26a)]+_0x3f0754[_0x4d7d81(0x26a)]+_0x202f55[_0x4d7d81(0x26a)];if(!_0x1bfe92[_0x4d7d81(0x22b)]&&_0x10898c>0x0){const _0xe2c2ca=await confirmKey(_0x4d7d81(0x1e5)+_0x10898c+_0x4d7d81(0x217));if(!_0xe2c2ca)return console['error'](_0x4d7d81(0x239)),0x1;}const _0x182919={'withProgress':async(_0x225e58,_0x91adca)=>{const _0x2d124b=_0x4d7d81,_0x3822f8=await withSpinner(_0x225e58,_0x91adca,{'verbose':_0x1bfe92[_0x2d124b(0x1fe)]});return{'data':_0x3822f8['data']};},'logInfo':_0x234ceb=>console['error'](a29_0x5e6929[_0x4d7d81(0x238)]('✔\x20'+_0x234ceb)),'logSuccess':_0x4aa321=>console['error'](a29_0x5e6929[_0x4d7d81(0x256)]('✔\x20'+_0x4aa321)),'logWarning':_0xf92dd5=>console[_0x4d7d81(0x235)](a29_0x5e6929['yellow']('⚠\x20'+_0xf92dd5)),'logDeleted':_0x2f4c69=>console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x25e)]('✔\x20'+_0x2f4c69))},_0x3d2e4d={'segment':_0xbd46d4[_0x4d7d81(0x254)],'journey':_0xbd46d4[_0x4d7d81(0x1e4)],'user':_0xbd46d4[_0x4d7d81(0x241)],'connection':_0xbd46d4[_0x4d7d81(0x21a)]};_0x3f0754['length']>0x0&&(_0x2b231f=await executePushFolders(_0x3d2e4d,_0x3f0754,_0x2b231f,{'parentId':_0x34c916},_0x182919));const _0xf96b52={'rootFolderId':_0x2b7c93,'folderPathToId':_0x2b231f,'folderIdToPath':_0x3314ee,'segmentNameToId':_0x459d15,'activationsBySegmentId':_0x4fb0f3,'emailToIdMap':_0x315eee,'idToEmailMap':_0x580524,'connectionNameToIdMap':_0x1ee79c[_0x4d7d81(0x229)],'connectionIdToNameMap':_0x1ee79c[_0x4d7d81(0x246)],'connectionNameToTypeMap':_0x46c356},_0x2fd90d=await executePushSegments(_0x3d2e4d,_0x1bfe92[_0x4d7d81(0x242)]?[]:_0x304ce2,_0xf96b52,{'parentId':_0x34c916},_0x182919),_0x4e17d8=_0x2fd90d['created'],_0x550ba4=_0x2fd90d[_0x4d7d81(0x20d)],_0xbaef64=_0x2fd90d[_0x4d7d81(0x22d)][_0x4d7d81(0x23f)],_0x431e99=_0x2fd90d['activations'][_0x4d7d81(0x20d)],_0x89a596=_0x2fd90d[_0x4d7d81(0x22d)]['deleted'],_0x2f20d6=await executePushSegmentDeletions(_0x3d2e4d,_0x1bfe92[_0x4d7d81(0x242)]?[]:_0x1d4b34,_0x182919);let _0x4733ac=0x0,_0x3ce15d=0x0,_0x490ad5=0x0;const _0x241295=new Map(_0x459d15);for(const [_0x1ab0a5,_0x27badf]of _0x2fd90d[_0x4d7d81(0x23c)]){_0x241295['set'](_0x1ab0a5,_0x27badf);}if(_0x44348f[_0x4d7d81(0x26a)]>0x0){const _0x24233a={..._0xf96b52,'segmentNameToId':_0x241295,'existingSegments':_0x2da16c,'activationContext':_0x48f71b},_0x1b2b2a=await executePushJourneys(_0x3d2e4d,_0x44348f,_0x24233a,{'parentId':_0x34c916,'rootFolderId':_0x2b7c93,'verbose':_0x1bfe92[_0x4d7d81(0x1fe)]},_0x182919);_0x4733ac=_0x1b2b2a[_0x4d7d81(0x23f)],_0x3ce15d=_0x1b2b2a['updated'];if(_0x4c6f5e&&_0x1b2b2a[_0x4d7d81(0x26e)][_0x4d7d81(0x26a)]===0x1){const _0x644adb=_0x1b2b2a[_0x4d7d81(0x26e)][0x0];if(_0x644adb[_0x4d7d81(0x273)]){const _0x2fb695=getConsoleNextUrl(_0x1bfe92[_0x4d7d81(0x234)],_0x4d7d81(0x218)+_0x34c916+_0x4d7d81(0x20b)+_0x644adb['journeyId']+_0x4d7d81(0x221));console[_0x4d7d81(0x235)]('\x20\x20'+a29_0x5e6929[_0x4d7d81(0x1f4)](_0x2fb695));}}}for(const _0x3a1c58 of _0x437d41){console[_0x4d7d81(0x235)](a29_0x5e6929['yellow'](_0x4d7d81(0x240)+_0x3a1c58['journeyBundleName'])),_0x490ad5++;}const _0x50fa9d=[];if(_0x4e17d8>0x0)_0x50fa9d[_0x4d7d81(0x1f0)](_0x4e17d8+_0x4d7d81(0x277));if(_0x550ba4>0x0)_0x50fa9d['push'](_0x550ba4+_0x4d7d81(0x262));if(_0x2f20d6>0x0)_0x50fa9d[_0x4d7d81(0x1f0)](_0x2f20d6+_0x4d7d81(0x210));const _0x280da2=[];if(_0x4733ac>0x0)_0x280da2['push'](_0x4733ac+_0x4d7d81(0x277));if(_0x3ce15d>0x0)_0x280da2[_0x4d7d81(0x1f0)](_0x3ce15d+_0x4d7d81(0x262));if(_0x490ad5>0x0)_0x280da2[_0x4d7d81(0x1f0)](_0x490ad5+_0x4d7d81(0x210));const _0x5027c8=[];if(_0xbaef64>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0xbaef64+_0x4d7d81(0x277));if(_0x431e99>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0x431e99+'\x20updated');if(_0x89a596>0x0)_0x5027c8[_0x4d7d81(0x1f0)](_0x89a596+'\x20deleted');return console[_0x4d7d81(0x235)](a29_0x5e6929[_0x4d7d81(0x256)](_0x4d7d81(0x21b))),_0x50fa9d[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&console[_0x4d7d81(0x235)]('\x20\x20Segments:\x20'+_0x50fa9d[_0x4d7d81(0x208)](',\x20')),_0x280da2[_0x4d7d81(0x26a)]>0x0&&console[_0x4d7d81(0x235)](_0x4d7d81(0x224)+_0x280da2[_0x4d7d81(0x208)](',\x20')),_0x5027c8[_0x4d7d81(0x26a)]>0x0&&!_0x1bfe92[_0x4d7d81(0x242)]&&console['error'](_0x4d7d81(0x249)+_0x5027c8[_0x4d7d81(0x208)](',\x20')),0x0;}}
@@ -1 +1 @@
1
- const a30_0xa52670=a30_0x4409;(function(_0x618e5e,_0x4b4c0e){const _0xb66e93=a30_0x4409,_0x318a99=_0x618e5e();while(!![]){try{const _0x53d402=-parseInt(_0xb66e93(0x208))/0x1*(parseInt(_0xb66e93(0x214))/0x2)+parseInt(_0xb66e93(0x203))/0x3*(-parseInt(_0xb66e93(0x20b))/0x4)+parseInt(_0xb66e93(0x207))/0x5+parseInt(_0xb66e93(0x212))/0x6*(-parseInt(_0xb66e93(0x1ff))/0x7)+parseInt(_0xb66e93(0x1fc))/0x8*(parseInt(_0xb66e93(0x21c))/0x9)+-parseInt(_0xb66e93(0x213))/0xa+parseInt(_0xb66e93(0x206))/0xb*(parseInt(_0xb66e93(0x209))/0xc);if(_0x53d402===_0x4b4c0e)break;else _0x318a99['push'](_0x318a99['shift']());}catch(_0x2732ae){_0x318a99['push'](_0x318a99['shift']());}}}(a30_0x2150,0xe73b5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a30_0x2150(){const _0x4d5833=['\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Segment\x20ID\x20missing\x20from\x20resolved\x20path','kind','7412202dbjska','5073570ltkiKM','3948qgzHaC','error','length','segmentPath','data','resolvePathToResource','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolving\x20folder\x20\x27','261pmNROl','yellow','\x20\x20\x20Path:\x20','Segment\x20ID:\x20','Updating\x20segment\x20\x27','Examples:','Error:\x20Cannot\x20update\x20','description','\x27...','Update\x20existing\x20child\x20segment','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','✔\x20Updated\x20segment\x20\x27','238088LuTUIT','INTERNAL','segment','7gCAdrq','execute','name','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','3NuhdTD','Resolving\x20path\x20\x27','type','561NgmCtS','7427280UXyVjM','271qURokv','525828NIiAXP','resolveFolderId','5433964TSCSPv','includes','verbose','Resolved\x20relative\x20path\x20to:\x20'];a30_0x2150=function(){return _0x4d5833;};return a30_0x2150();}import{withSpinner}from'../utils/spinner.js';function a30_0x4409(_0x1b847b,_0x276733){_0x1b847b=_0x1b847b-0x1f3;const _0x2150f9=a30_0x2150();let _0x4409de=_0x2150f9[_0x1b847b];return _0x4409de;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x231aae from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a30_0xa52670(0x201)]='segment:update';[a30_0xa52670(0x1f7)]=a30_0xa52670(0x1f9);async[a30_0xa52670(0x200)](_0x11ffa1){const _0x822514=a30_0xa52670;console['error'](a30_0x231aae['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console['error'](a30_0x231aae[_0x822514(0x21d)](_0x822514(0x20f)));const {options:_0x27fc16,args:_0x23c86c,tdx:_0x2300d5}=_0x11ffa1,_0x269ba4=_0x27fc16;if(_0x23c86c[_0x822514(0x216)]===0x0)return console[_0x822514(0x215)](_0x822514(0x21a)),console[_0x822514(0x215)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x822514(0x215)](_0x822514(0x1f5)),console[_0x822514(0x215)]('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x822514(0x215)](_0x822514(0x202)),0x1;const _0x174780=_0x23c86c[0x0],_0x47e7c9=_0x27fc16[_0x822514(0x217)];let _0x3533ab=_0x174780;_0x47e7c9&&!_0x174780[_0x822514(0x20c)]('/')&&(_0x3533ab=_0x47e7c9+'/'+_0x174780,_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)](_0x822514(0x20e)+_0x3533ab));const _0x1f594d=await withSpinner(_0x822514(0x204)+_0x3533ab+_0x822514(0x1f8),()=>_0x2300d5['segment'][_0x822514(0x219)](_0x3533ab),{'verbose':_0x269ba4[_0x822514(0x20d)]}),_0x351d61=_0x1f594d[_0x822514(0x218)];_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)]('Resolved\x20type:\x20'+_0x351d61[_0x822514(0x205)]);if(_0x351d61[_0x822514(0x205)]!==_0x822514(0x1fe))return console[_0x822514(0x215)](_0x822514(0x1f6)+_0x351d61['type']+_0x822514(0x1fa)),console[_0x822514(0x215)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x351d61['segmentId'])throw new SDKError(ErrorCode[_0x822514(0x1fd)],_0x822514(0x210));const _0x295511=_0x351d61['parentId'],_0x4566a9=_0x351d61['segmentId'];_0x269ba4['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x295511),console[_0x822514(0x215)](_0x822514(0x1f3)+_0x4566a9));let _0x3a6d8b;if(_0x269ba4['folder']){const _0x23789f=_0x269ba4['folder'],_0x1bec28=await withSpinner(_0x822514(0x21b)+_0x23789f+_0x822514(0x1f8),()=>_0x2300d5[_0x822514(0x1fe)][_0x822514(0x20a)](_0x295511,_0x23789f),{'verbose':_0x269ba4['verbose']});_0x3a6d8b=parseInt(_0x1bec28[_0x822514(0x218)],0xa),_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)]('Resolved\x20folder\x20ID:\x20'+_0x3a6d8b);}const _0x48146b=await loadJSONFromOptions(_0x269ba4['rule'],_0x269ba4['ruleFile']),_0x5692b9={'name':_0x269ba4[_0x822514(0x201)],'description':_0x269ba4[_0x822514(0x1f7)],'rule':_0x48146b,'kind':_0x269ba4[_0x822514(0x211)]!==undefined?parseInt(_0x269ba4[_0x822514(0x211)],0xa):undefined,'segmentFolderId':_0x3a6d8b},_0x2dff0b=await withSpinner(_0x822514(0x1f4)+_0x351d61['segmentName']+_0x822514(0x1f8),()=>_0x2300d5[_0x822514(0x1fe)]['updateSegmentById'](_0x295511,_0x4566a9,_0x5692b9),{'verbose':_0x269ba4['verbose']}),_0x123186=_0x2dff0b[_0x822514(0x218)];return console[_0x822514(0x215)](_0x822514(0x1fb)+_0x123186[_0x822514(0x201)]+'\x27'),_0x3533ab!==_0x174780&&console[_0x822514(0x215)](_0x822514(0x21e)+_0x3533ab),await handleSDKOutput([_0x123186],_0x269ba4),0x0;}}
1
+ const a30_0x139579=a30_0x2355;(function(_0x57e11b,_0x40c052){const _0x44aed2=a30_0x2355,_0x2c8aa9=_0x57e11b();while(!![]){try{const _0x560e36=parseInt(_0x44aed2(0xa1))/0x1*(parseInt(_0x44aed2(0x91))/0x2)+parseInt(_0x44aed2(0x87))/0x3+-parseInt(_0x44aed2(0xa4))/0x4*(parseInt(_0x44aed2(0xaf))/0x5)+parseInt(_0x44aed2(0x82))/0x6+parseInt(_0x44aed2(0x92))/0x7+parseInt(_0x44aed2(0x9c))/0x8*(-parseInt(_0x44aed2(0xa3))/0x9)+-parseInt(_0x44aed2(0xa8))/0xa*(parseInt(_0x44aed2(0xa5))/0xb);if(_0x560e36===_0x40c052)break;else _0x2c8aa9['push'](_0x2c8aa9['shift']());}catch(_0x5125af){_0x2c8aa9['push'](_0x2c8aa9['shift']());}}}(a30_0x3bac,0x2e7b3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a30_0x2355(_0x49913f,_0x48b955){_0x49913f=_0x49913f-0x82;const _0x3bac80=a30_0x3bac();let _0x23559d=_0x3bac80[_0x49913f];return _0x23559d;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x4aa70b from'chalk';function a30_0x3bac(){const _0x5126ad=['description','46270NxKerN','Error:\x20Cannot\x20update\x20','2011572eayzce','Update\x20existing\x20child\x20segment','folder','updateSegmentById','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','410052bATemf','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','kind','verbose','parentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','execute','length','Resolved\x20type:\x20','resolveFolderId','28BqCEGf','452361xxFEkR','Resolving\x20path\x20\x27','yellow','✔\x20Updated\x20segment\x20\x27','includes','error','segment','name','rule','segmentPath','8OCpqaU','segmentName','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Updating\x20segment\x20\x27','19776jAPqpT','Parent\x20ID:\x20','848061WykDlf','84DcUmuM','583wbuazG','\x27...','Resolved\x20relative\x20path\x20to:\x20','63110LDivcy','type','data','resolvePathToResource','segment:update','segmentId'];a30_0x3bac=function(){return _0x5126ad;};return a30_0x3bac();}export class SegmentUpdateCommand extends BaseCommand{[a30_0x139579(0x99)]=a30_0x139579(0xac);[a30_0x139579(0xae)]=a30_0x139579(0x83);async[a30_0x139579(0x8d)](_0x15f1cb){const _0x2d26b0=a30_0x139579;console[_0x2d26b0(0x97)](a30_0x4aa70b[_0x2d26b0(0x94)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x2d26b0(0x97)](a30_0x4aa70b['yellow'](_0x2d26b0(0x88)));const {options:_0x3a6ba5,args:_0x3dbbde,tdx:_0x14b26e}=_0x15f1cb,_0x2b1086=_0x3a6ba5;if(_0x3dbbde[_0x2d26b0(0x8e)]===0x0)return console[_0x2d26b0(0x97)](_0x2d26b0(0x9e)),console['error']('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x2d26b0(0x97)]('Examples:'),console['error'](_0x2d26b0(0x8c)),console[_0x2d26b0(0x97)](_0x2d26b0(0x86)),0x1;const _0x1a77bc=_0x3dbbde[0x0],_0x410aff=_0x3a6ba5[_0x2d26b0(0x9b)];let _0x18b9ee=_0x1a77bc;_0x410aff&&!_0x1a77bc[_0x2d26b0(0x96)]('/')&&(_0x18b9ee=_0x410aff+'/'+_0x1a77bc,_0x2b1086[_0x2d26b0(0x8a)]&&console['error'](_0x2d26b0(0xa7)+_0x18b9ee));const _0x2e5699=await withSpinner(_0x2d26b0(0x93)+_0x18b9ee+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0xab)](_0x18b9ee),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]}),_0x319202=_0x2e5699['data'];_0x2b1086[_0x2d26b0(0x8a)]&&console[_0x2d26b0(0x97)](_0x2d26b0(0x8f)+_0x319202[_0x2d26b0(0xa9)]);if(_0x319202[_0x2d26b0(0xa9)]!==_0x2d26b0(0x98))return console[_0x2d26b0(0x97)](_0x2d26b0(0xb0)+_0x319202[_0x2d26b0(0xa9)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console['error']('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x319202[_0x2d26b0(0xad)])throw new SDKError(ErrorCode['INTERNAL'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38cfe8=_0x319202[_0x2d26b0(0x8b)],_0x1d40f9=_0x319202['segmentId'];_0x2b1086['verbose']&&(console[_0x2d26b0(0x97)](_0x2d26b0(0xa2)+_0x38cfe8),console[_0x2d26b0(0x97)]('Segment\x20ID:\x20'+_0x1d40f9));let _0x5dea28;if(_0x2b1086[_0x2d26b0(0x84)]){const _0x235ad8=_0x2b1086['folder'],_0x3d2cc8=await withSpinner('Resolving\x20folder\x20\x27'+_0x235ad8+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0x90)](_0x38cfe8,_0x235ad8),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]});_0x5dea28=parseInt(_0x3d2cc8[_0x2d26b0(0xaa)],0xa),_0x2b1086[_0x2d26b0(0x8a)]&&console[_0x2d26b0(0x97)](_0x2d26b0(0x9f)+_0x5dea28);}const _0xc070e0=await loadJSONFromOptions(_0x2b1086[_0x2d26b0(0x9a)],_0x2b1086['ruleFile']),_0x42a0d0={'name':_0x2b1086['name'],'description':_0x2b1086[_0x2d26b0(0xae)],'rule':_0xc070e0,'kind':_0x2b1086[_0x2d26b0(0x89)]!==undefined?parseInt(_0x2b1086['kind'],0xa):undefined,'segmentFolderId':_0x5dea28},_0x50c5d4=await withSpinner(_0x2d26b0(0xa0)+_0x319202[_0x2d26b0(0x9d)]+_0x2d26b0(0xa6),()=>_0x14b26e[_0x2d26b0(0x98)][_0x2d26b0(0x85)](_0x38cfe8,_0x1d40f9,_0x42a0d0),{'verbose':_0x2b1086[_0x2d26b0(0x8a)]}),_0x20008c=_0x50c5d4[_0x2d26b0(0xaa)];return console[_0x2d26b0(0x97)](_0x2d26b0(0x95)+_0x20008c[_0x2d26b0(0x99)]+'\x27'),_0x18b9ee!==_0x1a77bc&&console[_0x2d26b0(0x97)]('\x20\x20\x20Path:\x20'+_0x18b9ee),await handleSDKOutput([_0x20008c],_0x2b1086),0x0;}}
@@ -1 +1 @@
1
- const a31_0x2c49da=a31_0x4320;(function(_0x4aa9a,_0x938b5e){const _0x5bbf95=a31_0x4320,_0x1e4669=_0x4aa9a();while(!![]){try{const _0x4ea88b=parseInt(_0x5bbf95(0x97))/0x1+parseInt(_0x5bbf95(0xc1))/0x2*(parseInt(_0x5bbf95(0xbc))/0x3)+parseInt(_0x5bbf95(0xb6))/0x4*(-parseInt(_0x5bbf95(0xa1))/0x5)+-parseInt(_0x5bbf95(0xae))/0x6*(-parseInt(_0x5bbf95(0xa3))/0x7)+parseInt(_0x5bbf95(0xb7))/0x8+parseInt(_0x5bbf95(0xab))/0x9+-parseInt(_0x5bbf95(0xb5))/0xa;if(_0x4ea88b===_0x938b5e)break;else _0x1e4669['push'](_0x1e4669['shift']());}catch(_0x48c3e7){_0x1e4669['push'](_0x1e4669['shift']());}}}(a31_0x4907,0x8acd4));function a31_0x4320(_0x48938a,_0x435e79){_0x48938a=_0x48938a-0x96;const _0x490742=a31_0x4907();let _0x4320b9=_0x490742[_0x48938a];return _0x4320b9;}function a31_0x4907(){const _0x498d56=['Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','folderId','2980UBVNKR','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','291487xOknMh','error','Folder\x20ID:\x20','folderPath','config','session','cyan','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','6676101RGJcPV','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','segment:use','54VKBDKF','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','verbose','dim','slice','Use:\x20tdx\x20segment\x20use\x20','fullPath','22251470KMTQGg','1228XuNSFq','8204392GUxUNL','segmentPath','site','Resolved\x20relative\x20path\x20to:\x20','name','357873oKWEVR','red','resolvePathToResource','split','type','2RwBfFE','Usage:\x20tdx\x20segment\x20use\x20<path>','parentName','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','length','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','Target\x20path:\x20','\x27...','log','segment','Site:\x20','Resolving\x20path\x20\x27','data','parentId','parent_segment','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Resolved\x20path\x20type:\x20','segments','715253rocFvY','description','execute','✔\x20Context\x20set\x20to:\x20','green','join','Examples:','Set\x20current\x20segment/folder\x20context\x20for\x20navigation'];a31_0x4907=function(){return _0x498d56;};return a31_0x4907();}import{existsSync,statSync}from'fs';import a31_0x656a78 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a31_0x2c49da(0xbb)]=a31_0x2c49da(0xad);[a31_0x2c49da(0x98)]=a31_0x2c49da(0x9e);async[a31_0x2c49da(0x99)](_0x3b457d){const _0x551e24=a31_0x2c49da,{options:_0x1c51a0,args:_0x56db42,tdx:_0x1c2cc1}=_0x3b457d;if(_0x56db42['length']===0x0)return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)]('Error:\x20Path\x20is\x20required\x0a')),console['error'](_0x551e24(0xc2)),console[_0x551e24(0xa4)](_0x551e24(0x9d)),console[_0x551e24(0xa4)](_0x551e24(0xc4)),console[_0x551e24(0xa4)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console['error'](_0x551e24(0xaf)),console['error'](_0x551e24(0xac)),0x1;const _0x3322bb=_0x56db42[0x0],_0x33e8a1=_0x1c51a0[_0x551e24(0xa8)];try{if(_0x3322bb==='/')return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78['green'](_0x551e24(0xd2))),0x0;if(existsSync(_0x3322bb)&&statSync(_0x3322bb)['isDirectory']()){let _0x18d026;try{_0x18d026=findTdxConfig(_0x3322bb);}catch{return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)](_0x551e24(0x9f)+_0x3322bb)),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xa9)](_0x551e24(0xc7))),0x1;}const _0x3bba3c=_0x18d026[_0x551e24(0xa7)][_0x551e24(0xd1)];return saveSessionContext({'segment_path':_0x3bba3c,'parent_segment':_0x3bba3c},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)](_0x551e24(0x9a)+a31_0x656a78['cyan'](_0x3bba3c))),0x0;}const _0x3edbf5=_0x1c51a0[_0x551e24(0xb8)];let _0x5c73d9=_0x3322bb;const _0x50180b=parsePath(_0x3322bb);if(!_0x50180b['isAbsolute']){if(!_0x3edbf5)return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)](_0x551e24(0xc5))),console['error'](a31_0x656a78['cyan']('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x3322bb==='..'){const _0x519111=_0x3edbf5[_0x551e24(0xbf)]('/')[_0x551e24(0xb2)](0x0,-0x1)[_0x551e24(0x9c)]('/');_0x5c73d9=_0x519111||'/';}else _0x3322bb==='.'?_0x5c73d9=_0x3edbf5:_0x5c73d9=_0x3edbf5+'/'+_0x3322bb;_0x1c51a0[_0x551e24(0xb0)]&&console[_0x551e24(0xa4)](_0x551e24(0xba)+_0x5c73d9);}if(_0x5c73d9==='/'||_0x5c73d9==='')return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)](_0x551e24(0xd2))),0x0;_0x5c73d9=normalizePath(_0x5c73d9);const _0x15abd6=parsePath(_0x5c73d9)[_0x551e24(0x96)];if(_0x15abd6[_0x551e24(0xc6)]===0x0)return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x1c51a0['verbose']&&(console['error'](_0x551e24(0xcd)+_0x1c51a0[_0x551e24(0xb9)]),console[_0x551e24(0xa4)](_0x551e24(0xc9)+_0x5c73d9));const _0x58d5e3=await withSpinner(_0x551e24(0xce)+_0x5c73d9+_0x551e24(0xca),()=>_0x1c2cc1[_0x551e24(0xcc)][_0x551e24(0xbe)](_0x5c73d9),{'verbose':_0x1c51a0[_0x551e24(0xb0)]}),_0x1b80e8=_0x58d5e3[_0x551e24(0xcf)];_0x1c51a0[_0x551e24(0xb0)]&&(console[_0x551e24(0xa4)](_0x551e24(0xd3)+_0x1b80e8['type']),console[_0x551e24(0xa4)]('Parent\x20ID:\x20'+_0x1b80e8[_0x551e24(0xd0)]),_0x1b80e8[_0x551e24(0xa0)]&&console[_0x551e24(0xa4)](_0x551e24(0xa5)+_0x1b80e8[_0x551e24(0xa0)]));if(_0x1b80e8[_0x551e24(0xc0)]===_0x551e24(0xcc))return console['error'](a31_0x656a78['red']('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x551e24(0xa4)](_0x551e24(0xa2)),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xa9)](_0x551e24(0xb3)+_0x1b80e8[_0x551e24(0xc3)]+(_0x1b80e8[_0x551e24(0xa6)]?'/'+_0x1b80e8[_0x551e24(0xa6)][_0x551e24(0x9c)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x1b80e8[_0x551e24(0xb4)],'parent_segment':_0x1b80e8[_0x551e24(0xc3)]},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78['green'](_0x551e24(0x9a)+a31_0x656a78[_0x551e24(0xa9)](_0x1b80e8['fullPath']))),_0x1c51a0[_0x551e24(0xb0)]&&(console['error'](a31_0x656a78['dim'](_0x551e24(0xaa))),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xb1)](_0x551e24(0xc8)))),0x0;}catch(_0x330036){throw _0x330036;}}}
1
+ const a31_0x4fdf6a=a31_0x3694;(function(_0x453b68,_0x4142e1){const _0x5125c1=a31_0x3694,_0x4944c1=_0x453b68();while(!![]){try{const _0x2b4498=parseInt(_0x5125c1(0x1e1))/0x1+-parseInt(_0x5125c1(0x1d3))/0x2+-parseInt(_0x5125c1(0x1d6))/0x3*(parseInt(_0x5125c1(0x1ad))/0x4)+-parseInt(_0x5125c1(0x1e5))/0x5+parseInt(_0x5125c1(0x1c0))/0x6*(parseInt(_0x5125c1(0x1c1))/0x7)+parseInt(_0x5125c1(0x1b4))/0x8+-parseInt(_0x5125c1(0x1b7))/0x9*(parseInt(_0x5125c1(0x1bc))/0xa);if(_0x2b4498===_0x4142e1)break;else _0x4944c1['push'](_0x4944c1['shift']());}catch(_0xfee1e8){_0x4944c1['push'](_0x4944c1['shift']());}}}(a31_0x3f31,0x1a61a));import{existsSync,statSync}from'fs';import a31_0xcf323c from'chalk';function a31_0x3694(_0x42f83b,_0x58e647){_0x42f83b=_0x42f83b-0x1ad;const _0x3f31bd=a31_0x3f31();let _0x369450=_0x3f31bd[_0x42f83b];return _0x369450;}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';function a31_0x3f31(){const _0x5e18c9=['site','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Use:\x20tdx\x20segment\x20use\x20','isDirectory','211854xovkta','length','name','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','158255xmZCOS','type','verbose','segment:use','280cKNYOa','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','execute','slice','segmentPath','Target\x20path:\x20','cyan','418792cvKGvI','\x27...','segments','13491duESxN','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','dim','460aFqiHz','parentId','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Folder\x20ID:\x20','21306PgdyjC','322keRMnW','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','folderId','parentName','✔\x20Context\x20set\x20to:\x20','Error:\x20Path\x20is\x20required\x0a','error','resolvePathToResource','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','fullPath','green','parent_segment','Resolved\x20path\x20type:\x20','join','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isAbsolute','session','red','140692ELMcAf','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','6366QvSwGy','log','segment','folderPath','description','Site:\x20','Parent\x20ID:\x20'];a31_0x3f31=function(){return _0x5e18c9;};return a31_0x3f31();}import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a31_0x4fdf6a(0x1e3)]=a31_0x4fdf6a(0x1e8);[a31_0x4fdf6a(0x1da)]=a31_0x4fdf6a(0x1d4);async[a31_0x4fdf6a(0x1af)](_0xeec877){const _0x32590a=a31_0x4fdf6a,{options:_0xae31c0,args:_0x3f8cc4,tdx:_0x14d8a2}=_0xeec877;if(_0x3f8cc4[_0x32590a(0x1e2)]===0x0)return console[_0x32590a(0x1c7)](a31_0xcf323c['red'](_0x32590a(0x1c6))),console[_0x32590a(0x1c7)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x32590a(0x1c7)]('Examples:'),console['error'](_0x32590a(0x1b9)),console[_0x32590a(0x1c7)](_0x32590a(0x1e4)),console[_0x32590a(0x1c7)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x32590a(0x1c7)](_0x32590a(0x1be)),0x1;const _0x552bdd=_0x3f8cc4[0x0],_0x3ca7fc=_0xae31c0[_0x32590a(0x1d1)];try{if(_0x552bdd==='/')return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;if(existsSync(_0x552bdd)&&statSync(_0x552bdd)[_0x32590a(0x1e0)]()){let _0x3af24d;try{_0x3af24d=findTdxConfig(_0x552bdd);}catch{return console['error'](a31_0xcf323c['red'](_0x32590a(0x1d5)+_0x552bdd)),console['error'](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1cf))),0x1;}const _0x4c7f00=_0x3af24d['config'][_0x32590a(0x1cc)];return saveSessionContext({'segment_path':_0x4c7f00,'parent_segment':_0x4c7f00},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)]('✔\x20Context\x20set\x20to:\x20'+a31_0xcf323c[_0x32590a(0x1b3)](_0x4c7f00))),0x0;}const _0x11f15a=_0xae31c0[_0x32590a(0x1b1)];let _0x27310d=_0x552bdd;const _0x343c2c=parsePath(_0x552bdd);if(!_0x343c2c[_0x32590a(0x1d0)]){if(!_0x11f15a)return console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1d2)](_0x32590a(0x1de))),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1ba))),0x1;if(_0x552bdd==='..'){const _0x535d2a=_0x11f15a['split']('/')[_0x32590a(0x1b0)](0x0,-0x1)[_0x32590a(0x1ce)]('/');_0x27310d=_0x535d2a||'/';}else _0x552bdd==='.'?_0x27310d=_0x11f15a:_0x27310d=_0x11f15a+'/'+_0x552bdd;_0xae31c0[_0x32590a(0x1e7)]&&console[_0x32590a(0x1c7)]('Resolved\x20relative\x20path\x20to:\x20'+_0x27310d);}if(_0x27310d==='/'||_0x27310d==='')return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;_0x27310d=normalizePath(_0x27310d);const _0x490fc8=parsePath(_0x27310d)[_0x32590a(0x1b6)];if(_0x490fc8['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c[_0x32590a(0x1cb)](_0x32590a(0x1c9))),0x0;_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](_0x32590a(0x1db)+_0xae31c0[_0x32590a(0x1dd)]),console[_0x32590a(0x1c7)](_0x32590a(0x1b2)+_0x27310d));const _0x34cedd=await withSpinner('Resolving\x20path\x20\x27'+_0x27310d+_0x32590a(0x1b5),()=>_0x14d8a2[_0x32590a(0x1d8)][_0x32590a(0x1c8)](_0x27310d),{'verbose':_0xae31c0['verbose']}),_0x113cf0=_0x34cedd['data'];_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](_0x32590a(0x1cd)+_0x113cf0[_0x32590a(0x1e6)]),console[_0x32590a(0x1c7)](_0x32590a(0x1dc)+_0x113cf0[_0x32590a(0x1bd)]),_0x113cf0[_0x32590a(0x1c3)]&&console[_0x32590a(0x1c7)](_0x32590a(0x1bf)+_0x113cf0['folderId']));if(_0x113cf0['type']===_0x32590a(0x1d8))return console['error'](a31_0xcf323c[_0x32590a(0x1d2)](_0x32590a(0x1b8))),console[_0x32590a(0x1c7)](_0x32590a(0x1c2)),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1b3)](_0x32590a(0x1df)+_0x113cf0[_0x32590a(0x1c4)]+(_0x113cf0[_0x32590a(0x1d9)]?'/'+_0x113cf0[_0x32590a(0x1d9)][_0x32590a(0x1ce)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x113cf0[_0x32590a(0x1ca)],'parent_segment':_0x113cf0[_0x32590a(0x1c4)]},_0x3ca7fc),console[_0x32590a(0x1d7)](a31_0xcf323c['green'](_0x32590a(0x1c5)+a31_0xcf323c['cyan'](_0x113cf0[_0x32590a(0x1ca)]))),_0xae31c0[_0x32590a(0x1e7)]&&(console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1bb)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x32590a(0x1c7)](a31_0xcf323c[_0x32590a(0x1bb)](_0x32590a(0x1ae)))),0x0;}catch(_0x526f09){throw _0x526f09;}}}