@treasuredata/tdx 0.16.12 → 0.16.13

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 (167) 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/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.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.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/anthropic-adapter.js +1 -1
  65. package/dist/proxy/claude-usage-tracker.js +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.js +1 -1
  69. package/dist/proxy/server.js +1 -1
  70. package/dist/proxy/session-cache.js +1 -1
  71. package/dist/proxy/sse-usage-parser.js +1 -1
  72. package/dist/sdk/agent/agent-config.js +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.js +1 -1
  75. package/dist/sdk/agent/test/evaluator.js +1 -1
  76. package/dist/sdk/agent/test/executor.js +1 -1
  77. package/dist/sdk/agent/test/index.js +1 -1
  78. package/dist/sdk/agent/test/output.js +1 -1
  79. package/dist/sdk/agent/test/parser.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/endpoints.js +1 -1
  83. package/dist/sdk/client/engage-api-client.js +1 -1
  84. package/dist/sdk/client/http-client.js +1 -1
  85. package/dist/sdk/client/llm-api-client.js +1 -1
  86. package/dist/sdk/client/rate-limiter.js +1 -1
  87. package/dist/sdk/client/td-api-client.js +1 -1
  88. package/dist/sdk/client/trino-api-client.js +1 -1
  89. package/dist/sdk/client/workflow-client.js +1 -1
  90. package/dist/sdk/connection-validator.js +1 -1
  91. package/dist/sdk/connection.js +1 -1
  92. package/dist/sdk/engage.js +1 -1
  93. package/dist/sdk/errors.js +1 -1
  94. package/dist/sdk/index.js +1 -1
  95. package/dist/sdk/io/index.js +1 -1
  96. package/dist/sdk/io/node-filesystem.js +1 -1
  97. package/dist/sdk/job.js +1 -1
  98. package/dist/sdk/journey.js +1 -1
  99. package/dist/sdk/llm/chat-cache.js +1 -1
  100. package/dist/sdk/llm/index.js +1 -1
  101. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  102. package/dist/sdk/llm/model-aliases.js +1 -1
  103. package/dist/sdk/llm/model-factors.js +1 -1
  104. package/dist/sdk/query/index.js +1 -1
  105. package/dist/sdk/query/sql-parser.js +1 -1
  106. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  107. package/dist/sdk/segment/fields-display.js +1 -1
  108. package/dist/sdk/segment/file-discovery.js +1 -1
  109. package/dist/sdk/segment/journey-utils.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-workflow.js +1 -1
  115. package/dist/sdk/segment/resolution-context.js +1 -1
  116. package/dist/sdk/segment/segment-path-parser.js +1 -1
  117. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  118. package/dist/sdk/segment/target-resolution.js +1 -1
  119. package/dist/sdk/segment/tdx-config.js +1 -1
  120. package/dist/sdk/segment/validate-files.js +1 -1
  121. package/dist/sdk/segment/yaml-validator.js +1 -1
  122. package/dist/sdk/segment.js +1 -1
  123. package/dist/sdk/types/index.js +1 -1
  124. package/dist/sdk/types/progress.js +1 -1
  125. package/dist/sdk/user.js +1 -1
  126. package/dist/sdk/util/format-detector.js +1 -1
  127. package/dist/sdk/util/formatters.js +1 -1
  128. package/dist/sdk/util/index.js +1 -1
  129. package/dist/sdk/util/tree-formatter.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- function a27_0x4ec4(){const _0x158085=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getSegment','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Segment\x20ID:\x20','2220YhYAAK','segment:folder:list','SEGMENT_FOLDER_NOT_FOUND','segment:show','resolvePathToResource','2478245SjUEyG','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Folder\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','SEGMENT_NOT_FOUND','\x27...','167373KmFjiE','processedRows','cause','\x20folder','Resolving\x20parent\x20folder\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','✔\x20Created\x20folder\x20\x27','log','in\x20','Target\x20path:\x20','33230sTuTQK','description','Resolving\x20path\x20\x27','Parent\x20ID:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20parent\x20ID:\x20','includes','folder','1520931ZjfDic','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','json','parentId','Error:\x20Parent\x20segment\x20name\x20is\x20required','1049334RUBKtL','error','segmentId','Error:\x20Path\x20or\x20name\x20is\x20required','/e/','site','query','\x20Opening\x20','✔\x20Query\x20completed:\x20Processed\x20','Create\x20segment\x20folder\x20for\x20organization','INVALID_ARGUMENT','jsonl','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','replace','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','resolveFolderId','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','web','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20','fullPath','information_schema','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Options:','execute','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','message','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Show\x20segment\x20or\x20folder\x20details','code','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','jobId','/app/ps/','parentFolder','3100oqeWMI','Fetching\x20folder\x20\x27','Folder\x20ID:\x20','Resolving\x20folder\x20\x27','Resolving\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','folderPath','Resolved\x20parent\x20folder\x20ID:\x20','resolveParentId','\x20[Job\x20ID:\x20','Use:\x20tdx\x20ps\x20view','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20desc','segment:folder:show','listFolders','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','test','getParent','Use:\x20tdx\x20ps\x20sql','Show\x20segment\x20folder\x20details','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','verbose','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','parent','Folder\x20name:\x20','segmentPath','format','folderId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment:sql','data','Examples:','90KldqCZ','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Use:\x20tdx\x20ps\x20show','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolved\x20folder\x20ID:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','elapsedTimeMillis','Fetching\x20SQL\x20for\x20segment...','Fetching\x20segment\x20details...','segment:view','Fetching\x20parent\x20segment\x20details...','parentSegment','name','2554336kJIyzR','getSegmentSQL','Site:\x20','SELECT\x20*\x20FROM\x20(\x0a','✖\x20Query\x20failed\x20[','green','segment','type','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','length','stats','segment:describe','url','Fetching\x20folder\x20details...','Parent\x20segment:\x20','cyan','Parent\x20name:\x20','24cAkqxD','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolved\x20type:\x20','Error:\x20Folder\x20reference\x20is\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','trim','\x27\x20with\x20ID:\x20'];a27_0x4ec4=function(){return _0x158085;};return a27_0x4ec4();}const a27_0x3ff3d3=a27_0x1faf;(function(_0x10badb,_0xe2fd32){const _0x3b01e2=a27_0x1faf,_0x51ad50=_0x10badb();while(!![]){try{const _0x375e8a=parseInt(_0x3b01e2(0x246))/0x1*(parseInt(_0x3b01e2(0x268))/0x2)+-parseInt(_0x3b01e2(0x272))/0x3+-parseInt(_0x3b01e2(0x253))/0x4*(-parseInt(_0x3b01e2(0x203))/0x5)+parseInt(_0x3b01e2(0x1da))/0x6+parseInt(_0x3b01e2(0x258))/0x7+-parseInt(_0x3b01e2(0x234))/0x8+-parseInt(_0x3b01e2(0x25e))/0x9*(parseInt(_0x3b01e2(0x226))/0xa);if(_0x375e8a===_0xe2fd32)break;else _0x51ad50['push'](_0x51ad50['shift']());}catch(_0x635296){_0x51ad50['push'](_0x51ad50['shift']());}}}(a27_0x4ec4,0x43e7e));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';function a27_0x1faf(_0x343087,_0x432d24){_0x343087=_0x343087-0x1d7;const _0x4ec405=a27_0x4ec4();let _0x1fafdc=_0x4ec405[_0x343087];return _0x1fafdc;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x1c58a8 from'chalk';async function resolveSegmentTarget(_0x1249cf,_0x10f670,_0x3229ec){const _0x466b6d=a27_0x1faf;if(isYamlFilePath(_0x1249cf))try{const _0xdde5a5=await resolveYamlFilePath(_0x1249cf);return _0x3229ec&&(console[_0x466b6d(0x1db)]('Resolved\x20YAML\x20file:\x20'+_0x1249cf),console[_0x466b6d(0x1db)]('\x20\x20Parent\x20segment:\x20'+_0xdde5a5[_0x466b6d(0x232)]),console[_0x466b6d(0x1db)]('\x20\x20Segment\x20name:\x20'+_0xdde5a5['segmentName']),console[_0x466b6d(0x1db)](_0x466b6d(0x25a)+(_0xdde5a5[_0x466b6d(0x20a)]||'(root)')),console[_0x466b6d(0x1db)](_0x466b6d(0x218)+_0xdde5a5[_0x466b6d(0x1f1)])),_0xdde5a5[_0x466b6d(0x1f1)];}catch(_0x43a8cb){throw new SDKError(ErrorCode[_0x466b6d(0x1e4)],_0x466b6d(0x227)+_0x43a8cb[_0x466b6d(0x1fb)]);}if(!_0x10f670)throw new SDKError(ErrorCode[_0x466b6d(0x1e4)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x10f670+'/'+_0x1249cf;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x3ff3d3(0x240);['description']=a27_0x3ff3d3(0x1fd);async[a27_0x3ff3d3(0x1f7)](_0x460ab6){const _0x51f2a3=a27_0x3ff3d3,{options:_0x21abb2,args:_0x26f352,tdx:_0x847486}=_0x460ab6,_0x332d7e=_0x26f352[0x0],_0x2f5aca=!_0x332d7e&&!!_0x21abb2[_0x51f2a3(0x232)],_0x1b0f2b=_0x332d7e||_0x21abb2[_0x51f2a3(0x232)];if(!_0x1b0f2b)return console[_0x51f2a3(0x1db)](_0x51f2a3(0x1dd)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x51f2a3(0x1db)](_0x51f2a3(0x225)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x51f2a3(0x1db)](_0x51f2a3(0x23d)),console['error'](_0x51f2a3(0x1ef)),console[_0x51f2a3(0x1db)](_0x51f2a3(0x263)),0x1;try{const _0xe750c2=_0x21abb2[_0x51f2a3(0x21f)];let _0x4ef8ea=_0x1b0f2b;!_0x2f5aca&&_0xe750c2&&!_0x1b0f2b[_0x51f2a3(0x270)]('/')&&(_0x4ef8ea=_0xe750c2+'/'+_0x1b0f2b,_0x21abb2[_0x51f2a3(0x21b)]&&console[_0x51f2a3(0x1db)](_0x51f2a3(0x25b)+_0x4ef8ea));const _0x359e4e=await withSpinner(_0x51f2a3(0x26a)+_0x4ef8ea+_0x51f2a3(0x25d),()=>_0x847486[_0x51f2a3(0x23a)]['resolvePathToResource'](_0x4ef8ea),{'verbose':_0x21abb2[_0x51f2a3(0x21b)]}),_0x14f1c1=_0x359e4e[_0x51f2a3(0x224)];_0x21abb2[_0x51f2a3(0x21b)]&&(console['error'](_0x51f2a3(0x249)+_0x14f1c1[_0x51f2a3(0x23b)]),console[_0x51f2a3(0x1db)](_0x51f2a3(0x26b)+_0x14f1c1[_0x51f2a3(0x1d8)]),_0x14f1c1['folderId']&&console[_0x51f2a3(0x1db)](_0x51f2a3(0x205)+_0x14f1c1['folderId']),_0x14f1c1[_0x51f2a3(0x1dc)]&&console[_0x51f2a3(0x1db)](_0x51f2a3(0x252)+_0x14f1c1[_0x51f2a3(0x1dc)]));if(_0x14f1c1[_0x51f2a3(0x23b)]===_0x51f2a3(0x21d)){const _0x235d40=await withSpinner(_0x51f2a3(0x231),()=>_0x847486[_0x51f2a3(0x23a)][_0x51f2a3(0x215)](_0x14f1c1[_0x51f2a3(0x1d8)]),{'verbose':_0x21abb2[_0x51f2a3(0x21b)]});await handleSingleObjectOutput(_0x235d40[_0x51f2a3(0x224)],_0x21abb2);}else{if(_0x14f1c1[_0x51f2a3(0x23b)]===_0x51f2a3(0x271)){if(!_0x14f1c1[_0x51f2a3(0x221)])throw new SDKError(ErrorCode[_0x51f2a3(0x255)],_0x51f2a3(0x1ee));const _0x1e3d28=await withSpinner(_0x51f2a3(0x242),()=>_0x847486[_0x51f2a3(0x23a)]['getFolder'](_0x14f1c1[_0x51f2a3(0x221)]),{'verbose':_0x21abb2[_0x51f2a3(0x21b)]});await handleSingleObjectOutput(_0x1e3d28[_0x51f2a3(0x224)],_0x21abb2);}else{if(_0x14f1c1['type']===_0x51f2a3(0x23a)){if(!_0x14f1c1[_0x51f2a3(0x1dc)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x51f2a3(0x24b));const _0x1ccd84=await withSpinner('Fetching\x20segment\x20details...',()=>_0x847486[_0x51f2a3(0x23a)][_0x51f2a3(0x250)](_0x14f1c1['parentId'],_0x14f1c1[_0x51f2a3(0x1dc)]),{'verbose':_0x21abb2[_0x51f2a3(0x21b)]});await handleSingleObjectOutput(_0x1ccd84[_0x51f2a3(0x224)],_0x21abb2);}}}return 0x0;}catch(_0x31b4b9){if(_0x31b4b9 instanceof SDKError)return console[_0x51f2a3(0x1db)](_0x51f2a3(0x1f0)+_0x31b4b9['message']),_0x31b4b9[_0x51f2a3(0x260)]&&console[_0x51f2a3(0x1db)](_0x51f2a3(0x20f)+_0x31b4b9[_0x51f2a3(0x260)]),0x1;throw _0x31b4b9;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x3ff3d3(0x233)]=a27_0x3ff3d3(0x256);[a27_0x3ff3d3(0x269)]=a27_0x3ff3d3(0x26c);async[a27_0x3ff3d3(0x1f7)](_0x460b7e){const _0x2f85d8=a27_0x3ff3d3,{options:_0x15fc8b,args:_0x1f4306,tdx:_0x1635e0}=_0x460b7e,_0x25221d=_0x1f4306[0x0];if(!_0x25221d)return console['error'](_0x2f85d8(0x213)),console[_0x2f85d8(0x1db)](_0x2f85d8(0x22a)),console['error'](_0x2f85d8(0x1fa)),console[_0x2f85d8(0x1db)](_0x2f85d8(0x225)),console[_0x2f85d8(0x1db)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x2f85d8(0x1db)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x34f9ee=_0x15fc8b[_0x2f85d8(0x232)],_0x3b9e03=await resolveSegmentTarget(_0x25221d,_0x34f9ee,_0x15fc8b[_0x2f85d8(0x21b)]);_0x15fc8b[_0x2f85d8(0x21b)]&&console[_0x2f85d8(0x1db)](_0x2f85d8(0x267)+_0x3b9e03);const _0x25b03f=await withSpinner(_0x2f85d8(0x207)+_0x25221d+_0x2f85d8(0x25d),()=>_0x1635e0[_0x2f85d8(0x23a)][_0x2f85d8(0x257)](_0x3b9e03),{'verbose':_0x15fc8b[_0x2f85d8(0x21b)]}),_0x1a9f7c=_0x25b03f[_0x2f85d8(0x224)];_0x15fc8b[_0x2f85d8(0x21b)]&&(console['error'](_0x2f85d8(0x249)+_0x1a9f7c[_0x2f85d8(0x23b)]),console['error'](_0x2f85d8(0x26b)+_0x1a9f7c[_0x2f85d8(0x1d8)]));if(_0x1a9f7c[_0x2f85d8(0x23b)]===_0x2f85d8(0x271))return console[_0x2f85d8(0x1db)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x2f85d8(0x1db)](_0x2f85d8(0x222)),0x1;if(_0x1a9f7c[_0x2f85d8(0x23b)]==='parent')return console[_0x2f85d8(0x1db)](_0x2f85d8(0x24c)),console[_0x2f85d8(0x1db)](_0x2f85d8(0x228)),0x1;if(!_0x1a9f7c[_0x2f85d8(0x1dc)])throw new SDKError(ErrorCode[_0x2f85d8(0x25c)],_0x2f85d8(0x24b));const _0x3a20a6=await withSpinner(_0x2f85d8(0x22e),()=>_0x1635e0['segment']['getSegmentSQL'](_0x1a9f7c[_0x2f85d8(0x1d8)],_0x1a9f7c['segmentId']),{'verbose':_0x15fc8b[_0x2f85d8(0x21b)]});let _0x1a0b6d=_0x3a20a6[_0x2f85d8(0x224)];const _0x3fc556=resolveLimit(_0x15fc8b['limit'],DEFAULT_DISPLAY_LIMIT),_0x39968f=/\bLIMIT\s+\d+/i[_0x2f85d8(0x214)](_0x1a0b6d);!_0x39968f&&(_0x1a0b6d=_0x1a0b6d[_0x2f85d8(0x24d)]()[_0x2f85d8(0x1e7)](/;+$/,''),_0x1a0b6d=_0x2f85d8(0x237)+_0x1a0b6d+_0x2f85d8(0x247)+_0x3fc556);_0x15fc8b[_0x2f85d8(0x21b)]&&console['error']('SQL\x20query:\x0a'+_0x1a0b6d);const _0x42da44=await withProgressSpinner('Executing\x20segment\x20query...',async _0x4f4316=>{const _0x19d28f=_0x2f85d8,_0x433223=await _0x1635e0[_0x19d28f(0x1e0)]['execute'](_0x1a0b6d,{'catalog':'td','schema':_0x19d28f(0x1f2),'onJobId':_0x276758=>{_0x4f4316['setJobId'](_0x276758);}});return _0x433223;},{'verbose':_0x15fc8b['verbose']}),_0x547de7=_0x42da44[_0x2f85d8(0x224)],_0x5366b0=_0x547de7[_0x2f85d8(0x200)]?_0x2f85d8(0x20d)+_0x547de7['jobId']+']':'';return console[_0x2f85d8(0x1db)](_0x2f85d8(0x1e2)+_0x547de7[_0x2f85d8(0x23f)][_0x2f85d8(0x25f)]['toLocaleString']()+'\x20rows\x20'+(_0x2f85d8(0x266)+formatElapsed(_0x547de7[_0x2f85d8(0x23f)][_0x2f85d8(0x22d)])+_0x5366b0)),await handleQueryOutput(_0x547de7,_0x15fc8b),0x0;}catch(_0x25e896){if(_0x25e896 instanceof SDKError)return console[_0x2f85d8(0x1db)](_0x2f85d8(0x238)+_0x25e896[_0x2f85d8(0x1fe)]+']'),console[_0x2f85d8(0x1db)]('\x0a'+_0x25e896[_0x2f85d8(0x1fb)]),0x1;throw _0x25e896;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x3ff3d3(0x254);[a27_0x3ff3d3(0x269)]=a27_0x3ff3d3(0x251);async[a27_0x3ff3d3(0x1f7)](_0x35854d){const _0x10da79=a27_0x3ff3d3,{options:_0x507ecd,args:_0x6fc44,tdx:_0x1670d1}=_0x35854d;if(_0x6fc44[_0x10da79(0x23e)]===0x0)return console[_0x10da79(0x1db)](_0x10da79(0x1d9)),console['error'](_0x10da79(0x208)),0x1;const _0x5490d8=_0x6fc44[0x0];try{_0x507ecd[_0x10da79(0x21b)]&&(console[_0x10da79(0x1db)](_0x10da79(0x236)+_0x507ecd[_0x10da79(0x1df)]),console[_0x10da79(0x1db)](_0x10da79(0x245)+_0x5490d8));const _0x50ef7d=await withSpinner(_0x10da79(0x1f8)+_0x5490d8+_0x10da79(0x25d),()=>_0x1670d1[_0x10da79(0x23a)][_0x10da79(0x20c)](_0x5490d8),{'verbose':_0x507ecd[_0x10da79(0x21b)]}),_0x5b1b2e=_0x50ef7d[_0x10da79(0x224)];_0x507ecd['verbose']&&console[_0x10da79(0x1db)](_0x10da79(0x26f)+_0x5b1b2e);const _0x5ae68a=await withSpinner(_0x10da79(0x1f4)+_0x5490d8+_0x10da79(0x25d),()=>_0x1670d1[_0x10da79(0x23a)][_0x10da79(0x212)](_0x5b1b2e),{'verbose':_0x507ecd[_0x10da79(0x21b)]}),_0x496ad0=_0x5ae68a[_0x10da79(0x224)];return console[_0x10da79(0x1db)]('✔\x20Found\x20'+_0x496ad0['length']+_0x10da79(0x261)+(_0x496ad0[_0x10da79(0x23e)]!==0x1?'s':'')),await handleSDKOutput(_0x496ad0,_0x507ecd),0x0;}catch(_0x42b224){if(_0x42b224 instanceof SDKError)return console[_0x10da79(0x1db)](_0x10da79(0x1f0)+_0x42b224[_0x10da79(0x1fb)]),_0x42b224[_0x10da79(0x260)]&&console[_0x10da79(0x1db)](_0x10da79(0x20f)+_0x42b224[_0x10da79(0x260)]),0x1;throw _0x42b224;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x3ff3d3(0x233)]=a27_0x3ff3d3(0x211);[a27_0x3ff3d3(0x269)]=a27_0x3ff3d3(0x217);async['execute'](_0x534da4){const _0x57d4e0=a27_0x3ff3d3,{options:_0x4a8595,args:_0x5293e2,tdx:_0x4e050c}=_0x534da4;if(_0x5293e2[_0x57d4e0(0x23e)]===0x0)return console[_0x57d4e0(0x1db)](_0x57d4e0(0x24a)),console[_0x57d4e0(0x1db)](_0x57d4e0(0x1e6)),0x1;try{const {parentId:_0x36554b,childId:_0x38b07e}=parseSegmentRef(_0x5293e2[0x0]);_0x4a8595[_0x57d4e0(0x21b)]&&(console['error'](_0x57d4e0(0x236)+_0x4a8595[_0x57d4e0(0x1df)]),console[_0x57d4e0(0x1db)](_0x57d4e0(0x245)+_0x36554b),_0x38b07e&&console[_0x57d4e0(0x1db)]('Folder\x20name:\x20'+_0x38b07e));if(!_0x38b07e)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x394428=await withSpinner(_0x57d4e0(0x1f8)+_0x36554b+_0x57d4e0(0x25d),()=>_0x4e050c[_0x57d4e0(0x23a)][_0x57d4e0(0x20c)](_0x36554b),{'verbose':_0x4a8595[_0x57d4e0(0x21b)]}),_0x2b7db1=_0x394428[_0x57d4e0(0x224)];_0x4a8595[_0x57d4e0(0x21b)]&&console[_0x57d4e0(0x1db)](_0x57d4e0(0x26f)+_0x2b7db1);const _0x22ff21=await withSpinner(_0x57d4e0(0x206)+_0x38b07e+_0x57d4e0(0x25d),()=>_0x4e050c[_0x57d4e0(0x23a)]['resolveFolderId'](_0x2b7db1,_0x38b07e),{'verbose':_0x4a8595['verbose']}),_0xca022b=_0x22ff21[_0x57d4e0(0x224)];_0x4a8595[_0x57d4e0(0x21b)]&&console[_0x57d4e0(0x1db)](_0x57d4e0(0x22b)+_0xca022b);const _0x592cf2=await withSpinner(_0x57d4e0(0x204)+_0x38b07e+_0x57d4e0(0x25d),()=>_0x4e050c[_0x57d4e0(0x23a)]['getFolder'](_0xca022b),{'verbose':_0x4a8595[_0x57d4e0(0x21b)]});return await handleSDKOutput([_0x592cf2[_0x57d4e0(0x224)]],_0x4a8595),0x0;}catch(_0x1d380e){if(_0x1d380e instanceof SDKError)return console[_0x57d4e0(0x1db)](_0x57d4e0(0x1f0)+_0x1d380e[_0x57d4e0(0x1fb)]),_0x1d380e['cause']&&console['error'](_0x57d4e0(0x20f)+_0x1d380e[_0x57d4e0(0x260)]),0x1;throw _0x1d380e;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x3ff3d3(0x223);[a27_0x3ff3d3(0x269)]=a27_0x3ff3d3(0x26d);async[a27_0x3ff3d3(0x1f7)](_0x9d658d){const _0x18e869=a27_0x3ff3d3,{options:_0x6a2591,args:_0x1b336c,tdx:_0x918cd4}=_0x9d658d,_0x15fcc6=_0x1b336c[0x0];if(!_0x15fcc6)return console['error'](_0x18e869(0x213)),console[_0x18e869(0x1db)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x18e869(0x1db)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x18e869(0x1db)](_0x18e869(0x225)),console[_0x18e869(0x1db)](_0x18e869(0x1ec)),console[_0x18e869(0x1db)](_0x18e869(0x1f5)),0x1;try{const _0x302888=_0x6a2591[_0x18e869(0x232)],_0x104c51=await resolveSegmentTarget(_0x15fcc6,_0x302888,_0x6a2591[_0x18e869(0x21b)]);_0x6a2591['verbose']&&console[_0x18e869(0x1db)]('Target\x20path:\x20'+_0x104c51);const _0x52dbdb=await withSpinner('Resolving\x20\x27'+_0x15fcc6+_0x18e869(0x25d),()=>_0x918cd4[_0x18e869(0x23a)][_0x18e869(0x257)](_0x104c51),{'verbose':_0x6a2591[_0x18e869(0x21b)]}),_0x108156=_0x52dbdb[_0x18e869(0x224)];_0x6a2591[_0x18e869(0x21b)]&&(console[_0x18e869(0x1db)](_0x18e869(0x249)+_0x108156['type']),console['error']('Parent\x20ID:\x20'+_0x108156[_0x18e869(0x1d8)]));if(_0x108156[_0x18e869(0x23b)]==='folder')return console[_0x18e869(0x1db)](_0x18e869(0x1e9)),console['error'](_0x18e869(0x22c)),0x1;if(_0x108156['type']==='parent')return console[_0x18e869(0x1db)](_0x18e869(0x259)),console[_0x18e869(0x1db)](_0x18e869(0x216)),0x1;if(!_0x108156[_0x18e869(0x1dc)])throw new SDKError(ErrorCode[_0x18e869(0x25c)],_0x18e869(0x24b));const _0x5c5ebb=await withSpinner(_0x18e869(0x22e),()=>_0x918cd4[_0x18e869(0x23a)][_0x18e869(0x235)](_0x108156[_0x18e869(0x1d8)],_0x108156['segmentId']),{'verbose':_0x6a2591[_0x18e869(0x21b)]}),_0x359b66=_0x5c5ebb[_0x18e869(0x224)];return _0x6a2591[_0x18e869(0x220)]===_0x18e869(0x1d7)||_0x6a2591[_0x18e869(0x220)]===_0x18e869(0x1e5)?await handleSDKOutput([{'sql':_0x359b66}],_0x6a2591):console[_0x18e869(0x265)](_0x359b66),0x0;}catch(_0x1a320e){if(_0x1a320e instanceof SDKError)return console[_0x18e869(0x1db)]('Error:\x20'+_0x1a320e['message']),_0x1a320e['cause']&&console['error'](_0x18e869(0x20f)+_0x1a320e[_0x18e869(0x260)]),0x1;throw _0x1a320e;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x3ff3d3(0x233)]='segment:folder:create';[a27_0x3ff3d3(0x269)]=a27_0x3ff3d3(0x1e3);async[a27_0x3ff3d3(0x1f7)](_0x22def9){const _0x1cd1a1=a27_0x3ff3d3,{options:_0x567ee9,args:_0xeb6c9d,tdx:_0x33ba91}=_0x22def9,_0xa0f472=_0x567ee9;if(_0xeb6c9d['length']<0x2)return console[_0x1cd1a1(0x1db)](_0x1cd1a1(0x248)),console[_0x1cd1a1(0x1db)](_0x1cd1a1(0x1ea)),0x1;const _0x5c07bc=_0xeb6c9d[0x0],_0x2139a8=_0xeb6c9d[0x1];_0xa0f472[_0x1cd1a1(0x21b)]&&(console[_0x1cd1a1(0x1db)]('Site:\x20'+_0xa0f472['site']),console[_0x1cd1a1(0x1db)](_0x1cd1a1(0x243)+_0x5c07bc),console[_0x1cd1a1(0x1db)](_0x1cd1a1(0x21e)+_0x2139a8));let _0x569beb;if(_0xa0f472[_0x1cd1a1(0x202)]){const _0x320dde=_0xa0f472[_0x1cd1a1(0x202)],_0x4c5167=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c07bc+_0x1cd1a1(0x25d),()=>_0x33ba91[_0x1cd1a1(0x23a)][_0x1cd1a1(0x20c)](_0x5c07bc),{'verbose':_0xa0f472[_0x1cd1a1(0x21b)]}),_0x5abc80=_0x4c5167[_0x1cd1a1(0x224)],_0x2ff65b=await withSpinner(_0x1cd1a1(0x262)+_0x320dde+_0x1cd1a1(0x25d),()=>_0x33ba91[_0x1cd1a1(0x23a)][_0x1cd1a1(0x1eb)](_0x5abc80,_0x320dde),{'verbose':_0xa0f472[_0x1cd1a1(0x21b)]});_0x569beb=_0x2ff65b[_0x1cd1a1(0x224)],_0xa0f472[_0x1cd1a1(0x21b)]&&console[_0x1cd1a1(0x1db)](_0x1cd1a1(0x20b)+_0x569beb);}const _0x4fdf31={'name':_0x2139a8,'description':_0xa0f472[_0x1cd1a1(0x269)],'parentFolderId':_0x569beb},_0x6eef04=await withSpinner('Creating\x20folder\x20\x27'+_0x2139a8+_0x1cd1a1(0x25d),()=>_0x33ba91[_0x1cd1a1(0x23a)]['createFolder'](_0x5c07bc,_0x4fdf31),{'verbose':_0xa0f472[_0x1cd1a1(0x21b)]}),_0x477470=_0x6eef04['data'];return console['error'](_0x1cd1a1(0x264)+_0x477470[_0x1cd1a1(0x233)]+_0x1cd1a1(0x24e)+_0x477470['id']),await handleSDKOutput([_0x477470],_0xa0f472),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a27_0x3ff3d3(0x230);[a27_0x3ff3d3(0x269)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x3ff3d3(0x1f7)](_0x207b35){const _0x38f470=a27_0x3ff3d3,{options:_0xd8d156,args:_0x2ee05a,tdx:_0x1718a7}=_0x207b35,_0x26ce35=_0x2ee05a[0x0];if(!_0x26ce35)return console['error'](_0x38f470(0x1e8)),console['error'](_0x38f470(0x1ff)),console[_0x38f470(0x1db)](_0x38f470(0x24f)),console['error'](_0x38f470(0x1f6)),console[_0x38f470(0x1db)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x38f470(0x1db)](_0x38f470(0x225)),console[_0x38f470(0x1db)](_0x38f470(0x219)),console[_0x38f470(0x1db)](_0x38f470(0x209)),console['error'](_0x38f470(0x1f3)),console[_0x38f470(0x1db)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1bbf1b=_0xd8d156[_0x38f470(0x232)],_0xbbfca7=await resolveSegmentTarget(_0x26ce35,_0x1bbf1b,_0xd8d156[_0x38f470(0x21b)]);_0xd8d156[_0x38f470(0x21b)]&&console[_0x38f470(0x1db)](_0x38f470(0x267)+_0xbbfca7);const _0xc12a76=await withSpinner(_0x38f470(0x207)+_0x26ce35+_0x38f470(0x25d),()=>_0x1718a7[_0x38f470(0x23a)]['resolvePathToResource'](_0xbbfca7),{'verbose':_0xd8d156[_0x38f470(0x21b)]}),_0x2d3005=_0xc12a76[_0x38f470(0x224)];_0xd8d156['verbose']&&(console[_0x38f470(0x1db)](_0x38f470(0x249)+_0x2d3005[_0x38f470(0x23b)]),console[_0x38f470(0x1db)](_0x38f470(0x26b)+_0x2d3005[_0x38f470(0x1d8)]),_0x2d3005[_0x38f470(0x221)]&&console[_0x38f470(0x1db)]('Folder\x20ID:\x20'+_0x2d3005['folderId']),_0x2d3005['segmentId']&&console[_0x38f470(0x1db)](_0x38f470(0x252)+_0x2d3005[_0x38f470(0x1dc)]));if(_0xd8d156[_0x38f470(0x1ed)]){if(_0x2d3005[_0x38f470(0x23b)]===_0x38f470(0x271))return console[_0x38f470(0x1db)](_0x38f470(0x23c)),0x1;if(_0x2d3005[_0x38f470(0x23b)]===_0x38f470(0x21d))return console['error'](_0x38f470(0x21a)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x2d3005[_0x38f470(0x1dc)])throw new SDKError(ErrorCode[_0x38f470(0x25c)],_0x38f470(0x24b));const _0x3a849e=getConsoleNextUrl(_0xd8d156['site'],_0x38f470(0x201)+_0x2d3005['parentId']+_0x38f470(0x1de)+_0x2d3005[_0x38f470(0x1dc)]);return console[_0x38f470(0x1db)](a27_0x1c58a8[_0x38f470(0x239)]('✔')+_0x38f470(0x1e1)+a27_0x1c58a8[_0x38f470(0x244)](_0x3a849e)),openBrowser(_0x3a849e),0x0;}if(_0x2d3005[_0x38f470(0x23b)]===_0x38f470(0x271)){if(!_0x2d3005[_0x38f470(0x221)])throw new SDKError(ErrorCode[_0x38f470(0x255)],_0x38f470(0x1ee));const _0x13107d=await withSpinner(_0x38f470(0x242),()=>_0x1718a7[_0x38f470(0x23a)]['getFolder'](_0x2d3005['folderId']),{'verbose':_0xd8d156[_0x38f470(0x21b)]});await handleSingleObjectOutput(_0x13107d[_0x38f470(0x224)],_0xd8d156);}else{if(_0x2d3005['type']==='segment'){if(!_0x2d3005[_0x38f470(0x1dc)])throw new SDKError(ErrorCode[_0x38f470(0x25c)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3c5346=await withSpinner(_0x38f470(0x22f),()=>_0x1718a7[_0x38f470(0x23a)]['getSegment'](_0x2d3005[_0x38f470(0x1d8)],_0x2d3005[_0x38f470(0x1dc)]),{'verbose':_0xd8d156[_0x38f470(0x21b)]}),_0x1f436f=getConsoleNextUrl(_0xd8d156[_0x38f470(0x1df)],_0x38f470(0x201)+_0x2d3005[_0x38f470(0x1d8)]+_0x38f470(0x1de)+_0x2d3005[_0x38f470(0x1dc)]),_0x4f095f=_0x3c5346[_0x38f470(0x224)];_0x4f095f[_0x38f470(0x241)]=_0x1f436f,await handleSingleObjectOutput(_0x4f095f,_0xd8d156);}else return console[_0x38f470(0x1db)](_0x38f470(0x21c)),console[_0x38f470(0x1db)](_0x38f470(0x20e)),0x1;}return 0x0;}catch(_0x4341c4){if(_0x4341c4 instanceof SDKError)return console[_0x38f470(0x1db)]('Error:\x20'+_0x4341c4[_0x38f470(0x1fb)]),_0x4341c4[_0x38f470(0x260)]&&console[_0x38f470(0x1db)](_0x38f470(0x20f)+_0x4341c4['cause']),0x1;throw _0x4341c4;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x3ff3d3(0x233)]='segment:desc';[a27_0x3ff3d3(0x269)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x4b63fc){const _0x54dab0=a27_0x3ff3d3,{options:_0x4bd6d9,args:_0x2b0984,tdx:_0x1d59c2}=_0x4b63fc,_0x51a79a=_0x2b0984[0x0];if(!_0x51a79a)return console[_0x54dab0(0x1db)](_0x54dab0(0x213)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x54dab0(0x1fc)),console[_0x54dab0(0x1db)](_0x54dab0(0x225)),console[_0x54dab0(0x1db)](_0x54dab0(0x1f9)),console[_0x54dab0(0x1db)](_0x54dab0(0x273)),0x1;try{const _0x21efad=_0x4bd6d9[_0x54dab0(0x232)],_0xeefb55=await resolveSegmentTarget(_0x51a79a,_0x21efad,_0x4bd6d9[_0x54dab0(0x21b)]);_0x4bd6d9['verbose']&&console[_0x54dab0(0x1db)]('Target\x20path:\x20'+_0xeefb55);const _0x2667c1=await withSpinner(_0x54dab0(0x207)+_0x51a79a+_0x54dab0(0x25d),()=>_0x1d59c2[_0x54dab0(0x23a)][_0x54dab0(0x257)](_0xeefb55),{'verbose':_0x4bd6d9[_0x54dab0(0x21b)]}),_0x34a7fe=_0x2667c1[_0x54dab0(0x224)];_0x4bd6d9[_0x54dab0(0x21b)]&&(console[_0x54dab0(0x1db)](_0x54dab0(0x249)+_0x34a7fe['type']),console[_0x54dab0(0x1db)](_0x54dab0(0x26b)+_0x34a7fe[_0x54dab0(0x1d8)]));if(_0x34a7fe[_0x54dab0(0x23b)]===_0x54dab0(0x271))return console[_0x54dab0(0x1db)](_0x54dab0(0x229)),console[_0x54dab0(0x1db)](_0x54dab0(0x22c)),0x1;if(_0x34a7fe['type']===_0x54dab0(0x21d))return console[_0x54dab0(0x1db)](_0x54dab0(0x26e)),console[_0x54dab0(0x1db)](_0x54dab0(0x210)),0x1;if(!_0x34a7fe['segmentId'])throw new SDKError(ErrorCode[_0x54dab0(0x25c)],_0x54dab0(0x24b));const _0x3d8f05=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1d59c2[_0x54dab0(0x23a)]['getSegmentSQL'](_0x34a7fe['parentId'],_0x34a7fe[_0x54dab0(0x1dc)]),{'verbose':_0x4bd6d9['verbose']}),_0x19d91c=_0x3d8f05[_0x54dab0(0x224)],_0x53e906=await executeSchemaQuery(_0x19d91c,_0x1d59c2,_0x4bd6d9);return await handleQueryOutput(_0x53e906,_0x4bd6d9),0x0;}catch(_0x511d59){if(_0x511d59 instanceof SDKError)return console[_0x54dab0(0x1db)]('Error:\x20'+_0x511d59[_0x54dab0(0x1fb)]),_0x511d59['cause']&&console['error']('\x20\x20Cause:\x20'+_0x511d59[_0x54dab0(0x260)]),0x1;throw _0x511d59;}}}
1
+ const a27_0x3805cc=a27_0x2522;(function(_0x181dd9,_0x14b232){const _0x143d69=a27_0x2522,_0x4f3b0b=_0x181dd9();while(!![]){try{const _0x50e669=parseInt(_0x143d69(0x10f))/0x1+parseInt(_0x143d69(0xbb))/0x2*(-parseInt(_0x143d69(0xd0))/0x3)+parseInt(_0x143d69(0xfc))/0x4*(-parseInt(_0x143d69(0xbc))/0x5)+-parseInt(_0x143d69(0xd5))/0x6+-parseInt(_0x143d69(0xf5))/0x7+parseInt(_0x143d69(0x11a))/0x8+parseInt(_0x143d69(0xf1))/0x9*(parseInt(_0x143d69(0x11d))/0xa);if(_0x50e669===_0x14b232)break;else _0x4f3b0b['push'](_0x4f3b0b['shift']());}catch(_0x495e7c){_0x4f3b0b['push'](_0x4f3b0b['shift']());}}}(a27_0x26cb,0x20010));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';function a27_0x2522(_0x20ca03,_0x422a0b){_0x20ca03=_0x20ca03-0x90;const _0x26cbbf=a27_0x26cb();let _0x25223f=_0x26cbbf[_0x20ca03];return _0x25223f;}function a27_0x26cb(){const _0x23581c=['Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','processedRows','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segment:show','✔\x20Created\x20folder\x20\x27','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Fetching\x20parent\x20segment\x20details...','site','Fetching\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getFolder','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','SEGMENT_NOT_FOUND','type','data','Listing\x20folders\x20for\x20parent\x20\x27','folderId','Folder\x20ID:\x20','segment:folder:list','/app/ps/','segment','(root)','Use:\x20tdx\x20ps\x20show','15687CNNcOi','segment:folder:create','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','1734306xjUWen','cause','listFolders','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20parent\x20folder\x20\x27','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','log','804mgfwhw','trim','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','test','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','length','message','Folder\x20name:\x20','Parent\x20ID:\x20','segment:desc','folder','Resolving\x20parent\x20segment\x20\x27','information_schema','setJobId','segmentPath','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','187377okSsfi','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Options:','Create\x20segment\x20folder\x20for\x20organization','execute','url','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Get\x20SQL\x20query\x20for\x20child\x20segment','segmentName','segmentId','1198936bnqDyy','replace','code','1310VAPLUq','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','name','toLocaleString','jobId','\x20\x20Parent\x20segment:\x20','Creating\x20folder\x20\x27','fullPath','segment:folder:show','✔\x20Found\x20','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','parentSegment','/e/','verbose','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','elapsedTimeMillis','segment:sql','jsonl','green','query','Use:\x20tdx\x20ps\x20view\x20-w','parentFolder','folderPath','getParent','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Segment\x20ID\x20missing\x20from\x20resolved\x20path','description','parent','includes','SQL\x20query:\x0a','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolving\x20folder\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Resolved\x20parent\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getSegmentSQL','Fetching\x20segment\x20details...','\x20\x20Segment\x20name:\x20','Examples:','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','INVALID_ARGUMENT','segment:view','\x27\x20with\x20ID:\x20','Segment\x20ID:\x20','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','limit','Use:\x20tdx\x20ps\x20view','resolvePathToResource','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','createFolder','2eNdtPI','2505ewUlUV','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Cause:\x20','parentId','Resolving\x20\x27','resolveParentId','getSegment','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x27...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','stats','Resolved\x20type:\x20','error','Parent\x20name:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','105711YTasHi','Show\x20segment\x20folder\x20details','Error:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','304758EvlCxg','resolveFolderId'];a27_0x26cb=function(){return _0x23581c;};return a27_0x26cb();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x4f0969 from'chalk';async function resolveSegmentTarget(_0x391b63,_0x36656b,_0xfb5d6){const _0x174a9f=a27_0x2522;if(isYamlFilePath(_0x391b63))try{const _0x47093c=await resolveYamlFilePath(_0x391b63);return _0xfb5d6&&(console[_0x174a9f(0xcd)](_0x174a9f(0xc3)+_0x391b63),console[_0x174a9f(0xcd)](_0x174a9f(0x122)+_0x47093c[_0x174a9f(0x129)]),console[_0x174a9f(0xcd)](_0x174a9f(0xa9)+_0x47093c[_0x174a9f(0x118)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x47093c[_0x174a9f(0x98)]||_0x174a9f(0xef))),console[_0x174a9f(0xcd)]('\x20\x20Full\x20path:\x20'+_0x47093c[_0x174a9f(0x124)])),_0x47093c['fullPath'];}catch(_0x44eab9){throw new SDKError(ErrorCode[_0x174a9f(0xaf)],_0x174a9f(0xab)+_0x44eab9[_0x174a9f(0x105)]);}if(!_0x36656b)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x174a9f(0xfa));return _0x36656b+'/'+_0x391b63;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x3805cc(0x11f)]='segment:describe';[a27_0x3805cc(0x9d)]=a27_0x3805cc(0x127);async['execute'](_0x48ecb5){const _0x7915e3=a27_0x3805cc,{options:_0x564ec1,args:_0x4c7055,tdx:_0x2445e8}=_0x48ecb5,_0x58b613=_0x4c7055[0x0],_0x591b0e=!_0x58b613&&!!_0x564ec1['parentSegment'],_0x5f4f4f=_0x58b613||_0x564ec1[_0x7915e3(0x129)];if(!_0x5f4f4f)return console[_0x7915e3(0xcd)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x7915e3(0xcd)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x7915e3(0xaa)),console['error'](_0x7915e3(0x128)),console[_0x7915e3(0xcd)](_0x7915e3(0xc4)),console[_0x7915e3(0xcd)](_0x7915e3(0xa1)),console['error'](_0x7915e3(0xda)),0x1;try{const _0xdf3b9c=_0x564ec1[_0x7915e3(0x10d)];let _0x2f30e8=_0x5f4f4f;!_0x591b0e&&_0xdf3b9c&&!_0x5f4f4f[_0x7915e3(0x9f)]('/')&&(_0x2f30e8=_0xdf3b9c+'/'+_0x5f4f4f,_0x564ec1['verbose']&&console[_0x7915e3(0xcd)](_0x7915e3(0xbd)+_0x2f30e8));const _0x5dcca5=await withSpinner('Resolving\x20path\x20\x27'+_0x2f30e8+_0x7915e3(0xc9),()=>_0x2445e8[_0x7915e3(0xee)][_0x7915e3(0xb7)](_0x2f30e8),{'verbose':_0x564ec1['verbose']}),_0xbfa14=_0x5dcca5['data'];_0x564ec1[_0x7915e3(0x12b)]&&(console[_0x7915e3(0xcd)](_0x7915e3(0xcc)+_0xbfa14[_0x7915e3(0xe7)]),console[_0x7915e3(0xcd)](_0x7915e3(0x107)+_0xbfa14[_0x7915e3(0xbf)]),_0xbfa14[_0x7915e3(0xea)]&&console[_0x7915e3(0xcd)](_0x7915e3(0xeb)+_0xbfa14[_0x7915e3(0xea)]),_0xbfa14[_0x7915e3(0x119)]&&console[_0x7915e3(0xcd)](_0x7915e3(0xb2)+_0xbfa14[_0x7915e3(0x119)]));if(_0xbfa14[_0x7915e3(0xe7)]===_0x7915e3(0x9e)){const _0x5d8ded=await withSpinner(_0x7915e3(0xe0),()=>_0x2445e8[_0x7915e3(0xee)][_0x7915e3(0x99)](_0xbfa14[_0x7915e3(0xbf)]),{'verbose':_0x564ec1[_0x7915e3(0x12b)]});await handleSingleObjectOutput(_0x5d8ded[_0x7915e3(0xe8)],_0x564ec1);}else{if(_0xbfa14[_0x7915e3(0xe7)]===_0x7915e3(0x109)){if(!_0xbfa14[_0x7915e3(0xea)])throw new SDKError(ErrorCode[_0x7915e3(0xdd)],_0x7915e3(0xa6));const _0x5259d2=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2445e8[_0x7915e3(0xee)][_0x7915e3(0xe4)](_0xbfa14[_0x7915e3(0xea)]),{'verbose':_0x564ec1[_0x7915e3(0x12b)]});await handleSingleObjectOutput(_0x5259d2[_0x7915e3(0xe8)],_0x564ec1);}else{if(_0xbfa14[_0x7915e3(0xe7)]===_0x7915e3(0xee)){if(!_0xbfa14[_0x7915e3(0x119)])throw new SDKError(ErrorCode[_0x7915e3(0xe6)],_0x7915e3(0x9c));const _0x4da538=await withSpinner(_0x7915e3(0xa8),()=>_0x2445e8[_0x7915e3(0xee)][_0x7915e3(0xc2)](_0xbfa14[_0x7915e3(0xbf)],_0xbfa14['segmentId']),{'verbose':_0x564ec1[_0x7915e3(0x12b)]});await handleSingleObjectOutput(_0x4da538[_0x7915e3(0xe8)],_0x564ec1);}}}return 0x0;}catch(_0x250c57){if(_0x250c57 instanceof SDKError)return console[_0x7915e3(0xcd)]('Error:\x20'+_0x250c57[_0x7915e3(0x105)]),_0x250c57[_0x7915e3(0xf6)]&&console[_0x7915e3(0xcd)](_0x7915e3(0xbe)+_0x250c57[_0x7915e3(0xf6)]),0x1;throw _0x250c57;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0xdb);['description']=a27_0x3805cc(0xcf);async[a27_0x3805cc(0x114)](_0x5adc87){const _0x190b8f=a27_0x3805cc,{options:_0x4cc1f8,args:_0x3faaf5,tdx:_0x4b4cbe}=_0x5adc87,_0x162a2f=_0x3faaf5[0x0];if(!_0x162a2f)return console[_0x190b8f(0xcd)](_0x190b8f(0x10e)),console[_0x190b8f(0xcd)](_0x190b8f(0xd3)),console[_0x190b8f(0xcd)](_0x190b8f(0xe3)),console[_0x190b8f(0xcd)](_0x190b8f(0xaa)),console[_0x190b8f(0xcd)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x190b8f(0xcd)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2454df=_0x4cc1f8['parentSegment'],_0x1931c4=await resolveSegmentTarget(_0x162a2f,_0x2454df,_0x4cc1f8['verbose']);_0x4cc1f8[_0x190b8f(0x12b)]&&console[_0x190b8f(0xcd)](_0x190b8f(0xc7)+_0x1931c4);const _0x5dba15=await withSpinner(_0x190b8f(0xc0)+_0x162a2f+_0x190b8f(0xc9),()=>_0x4b4cbe[_0x190b8f(0xee)]['resolvePathToResource'](_0x1931c4),{'verbose':_0x4cc1f8['verbose']}),_0x1e5a26=_0x5dba15[_0x190b8f(0xe8)];_0x4cc1f8[_0x190b8f(0x12b)]&&(console[_0x190b8f(0xcd)]('Resolved\x20type:\x20'+_0x1e5a26[_0x190b8f(0xe7)]),console['error'](_0x190b8f(0x107)+_0x1e5a26[_0x190b8f(0xbf)]));if(_0x1e5a26[_0x190b8f(0xe7)]===_0x190b8f(0x109))return console[_0x190b8f(0xcd)](_0x190b8f(0xdf)),console['error'](_0x190b8f(0xe5)),0x1;if(_0x1e5a26[_0x190b8f(0xe7)]==='parent')return console[_0x190b8f(0xcd)](_0x190b8f(0x102)),console[_0x190b8f(0xcd)](_0x190b8f(0xf0)),0x1;if(!_0x1e5a26['segmentId'])throw new SDKError(ErrorCode[_0x190b8f(0xe6)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x10e1ae=await withSpinner(_0x190b8f(0xd8),()=>_0x4b4cbe[_0x190b8f(0xee)][_0x190b8f(0xa7)](_0x1e5a26['parentId'],_0x1e5a26[_0x190b8f(0x119)]),{'verbose':_0x4cc1f8['verbose']});let _0x468270=_0x10e1ae['data'];const _0x4a60c4=resolveLimit(_0x4cc1f8[_0x190b8f(0xb5)],DEFAULT_DISPLAY_LIMIT),_0x2d3d73=/\bLIMIT\s+\d+/i[_0x190b8f(0xff)](_0x468270);!_0x2d3d73&&(_0x468270=_0x468270[_0x190b8f(0xfd)]()[_0x190b8f(0x11b)](/;+$/,''),_0x468270=_0x190b8f(0xb9)+_0x468270+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x4a60c4);_0x4cc1f8[_0x190b8f(0x12b)]&&console[_0x190b8f(0xcd)](_0x190b8f(0xa0)+_0x468270);const _0x52a610=await withProgressSpinner(_0x190b8f(0x110),async _0x111909=>{const _0x559af6=_0x190b8f,_0x42326d=await _0x4b4cbe[_0x559af6(0x95)][_0x559af6(0x114)](_0x468270,{'catalog':'td','schema':_0x559af6(0x10b),'onJobId':_0x19ae95=>{const _0x5a598e=_0x559af6;_0x111909[_0x5a598e(0x10c)](_0x19ae95);}});return _0x42326d;},{'verbose':_0x4cc1f8['verbose']}),_0x4fb20e=_0x52a610[_0x190b8f(0xe8)],_0x34841b=_0x4fb20e[_0x190b8f(0x121)]?_0x190b8f(0xad)+_0x4fb20e[_0x190b8f(0x121)]+']':'';return console[_0x190b8f(0xcd)](_0x190b8f(0xac)+_0x4fb20e[_0x190b8f(0xcb)][_0x190b8f(0xd9)][_0x190b8f(0x120)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4fb20e['stats'][_0x190b8f(0x91)])+_0x34841b)),await handleQueryOutput(_0x4fb20e,_0x4cc1f8),0x0;}catch(_0x18e43b){if(_0x18e43b instanceof SDKError)return console[_0x190b8f(0xcd)]('✖\x20Query\x20failed\x20['+_0x18e43b[_0x190b8f(0x11c)]+']'),console[_0x190b8f(0xcd)]('\x0a'+_0x18e43b['message']),0x1;throw _0x18e43b;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0xec);[a27_0x3805cc(0x9d)]=a27_0x3805cc(0x90);async['execute'](_0x12ce43){const _0x44e2dd=a27_0x3805cc,{options:_0x5d3b39,args:_0x59aabe,tdx:_0x145fea}=_0x12ce43;if(_0x59aabe['length']===0x0)return console[_0x44e2dd(0xcd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x44e2dd(0xcd)](_0x44e2dd(0xc8)),0x1;const _0x21ef2e=_0x59aabe[0x0];try{_0x5d3b39['verbose']&&(console[_0x44e2dd(0xcd)](_0x44e2dd(0xb3)+_0x5d3b39['site']),console[_0x44e2dd(0xcd)](_0x44e2dd(0xce)+_0x21ef2e));const _0x33e6d9=await withSpinner(_0x44e2dd(0x10a)+_0x21ef2e+_0x44e2dd(0xc9),()=>_0x145fea[_0x44e2dd(0xee)]['resolveParentId'](_0x21ef2e),{'verbose':_0x5d3b39[_0x44e2dd(0x12b)]}),_0x3af434=_0x33e6d9['data'];_0x5d3b39[_0x44e2dd(0x12b)]&&console[_0x44e2dd(0xcd)](_0x44e2dd(0xa4)+_0x3af434);const _0xc40687=await withSpinner(_0x44e2dd(0xe9)+_0x21ef2e+_0x44e2dd(0xc9),()=>_0x145fea[_0x44e2dd(0xee)][_0x44e2dd(0xf7)](_0x3af434),{'verbose':_0x5d3b39[_0x44e2dd(0x12b)]}),_0x626b40=_0xc40687[_0x44e2dd(0xe8)];return console[_0x44e2dd(0xcd)](_0x44e2dd(0x126)+_0x626b40['length']+'\x20folder'+(_0x626b40[_0x44e2dd(0x104)]!==0x1?'s':'')),await handleSDKOutput(_0x626b40,_0x5d3b39),0x0;}catch(_0x3efcb5){if(_0x3efcb5 instanceof SDKError)return console['error']('Error:\x20'+_0x3efcb5[_0x44e2dd(0x105)]),_0x3efcb5[_0x44e2dd(0xf6)]&&console[_0x44e2dd(0xcd)](_0x44e2dd(0xbe)+_0x3efcb5[_0x44e2dd(0xf6)]),0x1;throw _0x3efcb5;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0x125);[a27_0x3805cc(0x9d)]=a27_0x3805cc(0xd1);async['execute'](_0x5348e3){const _0x51c506=a27_0x3805cc,{options:_0x5d0b86,args:_0x40b4db,tdx:_0x262108}=_0x5348e3;if(_0x40b4db[_0x51c506(0x104)]===0x0)return console[_0x51c506(0xcd)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0xe6beee,childId:_0x5309ac}=parseSegmentRef(_0x40b4db[0x0]);_0x5d0b86[_0x51c506(0x12b)]&&(console[_0x51c506(0xcd)](_0x51c506(0xb3)+_0x5d0b86[_0x51c506(0xe1)]),console[_0x51c506(0xcd)](_0x51c506(0xce)+_0xe6beee),_0x5309ac&&console['error'](_0x51c506(0x106)+_0x5309ac));if(!_0x5309ac)return console[_0x51c506(0xcd)](_0x51c506(0x116)),0x1;const _0x28da7a=await withSpinner(_0x51c506(0x10a)+_0xe6beee+_0x51c506(0xc9),()=>_0x262108[_0x51c506(0xee)][_0x51c506(0xc1)](_0xe6beee),{'verbose':_0x5d0b86[_0x51c506(0x12b)]}),_0x5ac9b6=_0x28da7a['data'];_0x5d0b86[_0x51c506(0x12b)]&&console[_0x51c506(0xcd)](_0x51c506(0xa4)+_0x5ac9b6);const _0x10d20a=await withSpinner(_0x51c506(0xa2)+_0x5309ac+_0x51c506(0xc9),()=>_0x262108[_0x51c506(0xee)][_0x51c506(0xd6)](_0x5ac9b6,_0x5309ac),{'verbose':_0x5d0b86[_0x51c506(0x12b)]}),_0x315787=_0x10d20a['data'];_0x5d0b86[_0x51c506(0x12b)]&&console[_0x51c506(0xcd)]('Resolved\x20folder\x20ID:\x20'+_0x315787);const _0x3e920d=await withSpinner(_0x51c506(0xe2)+_0x5309ac+_0x51c506(0xc9),()=>_0x262108[_0x51c506(0xee)][_0x51c506(0xe4)](_0x315787),{'verbose':_0x5d0b86[_0x51c506(0x12b)]});return await handleSDKOutput([_0x3e920d[_0x51c506(0xe8)]],_0x5d0b86),0x0;}catch(_0x64c85c){if(_0x64c85c instanceof SDKError)return console[_0x51c506(0xcd)](_0x51c506(0xd2)+_0x64c85c[_0x51c506(0x105)]),_0x64c85c[_0x51c506(0xf6)]&&console[_0x51c506(0xcd)]('\x20\x20Cause:\x20'+_0x64c85c['cause']),0x1;throw _0x64c85c;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x3805cc(0x92);[a27_0x3805cc(0x9d)]=a27_0x3805cc(0x117);async[a27_0x3805cc(0x114)](_0x291dab){const _0x4767a7=a27_0x3805cc,{options:_0x198bf3,args:_0x39618a,tdx:_0x519884}=_0x291dab,_0x599a5a=_0x39618a[0x0];if(!_0x599a5a)return console[_0x4767a7(0xcd)](_0x4767a7(0x10e)),console[_0x4767a7(0xcd)](_0x4767a7(0x101)),console[_0x4767a7(0xcd)](_0x4767a7(0xf4)),console[_0x4767a7(0xcd)](_0x4767a7(0xaa)),console['error'](_0x4767a7(0x100)),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1169aa=_0x198bf3['parentSegment'],_0x484d1b=await resolveSegmentTarget(_0x599a5a,_0x1169aa,_0x198bf3['verbose']);_0x198bf3[_0x4767a7(0x12b)]&&console[_0x4767a7(0xcd)](_0x4767a7(0xc7)+_0x484d1b);const _0x465f97=await withSpinner(_0x4767a7(0xc0)+_0x599a5a+_0x4767a7(0xc9),()=>_0x519884[_0x4767a7(0xee)][_0x4767a7(0xb7)](_0x484d1b),{'verbose':_0x198bf3[_0x4767a7(0x12b)]}),_0x2db8a9=_0x465f97[_0x4767a7(0xe8)];_0x198bf3[_0x4767a7(0x12b)]&&(console[_0x4767a7(0xcd)](_0x4767a7(0xcc)+_0x2db8a9['type']),console['error']('Parent\x20ID:\x20'+_0x2db8a9['parentId']));if(_0x2db8a9['type']===_0x4767a7(0x109))return console[_0x4767a7(0xcd)](_0x4767a7(0xa3)),console[_0x4767a7(0xcd)](_0x4767a7(0xd4)),0x1;if(_0x2db8a9['type']===_0x4767a7(0x9e))return console[_0x4767a7(0xcd)](_0x4767a7(0xae)),console['error']('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x2db8a9['segmentId'])throw new SDKError(ErrorCode[_0x4767a7(0xe6)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x35214e=await withSpinner(_0x4767a7(0xd8),()=>_0x519884[_0x4767a7(0xee)][_0x4767a7(0xa7)](_0x2db8a9[_0x4767a7(0xbf)],_0x2db8a9[_0x4767a7(0x119)]),{'verbose':_0x198bf3['verbose']}),_0x461d6a=_0x35214e[_0x4767a7(0xe8)];return _0x198bf3[_0x4767a7(0xc6)]==='json'||_0x198bf3[_0x4767a7(0xc6)]===_0x4767a7(0x93)?await handleSDKOutput([{'sql':_0x461d6a}],_0x198bf3):console[_0x4767a7(0xfb)](_0x461d6a),0x0;}catch(_0x265dd5){if(_0x265dd5 instanceof SDKError)return console[_0x4767a7(0xcd)]('Error:\x20'+_0x265dd5[_0x4767a7(0x105)]),_0x265dd5['cause']&&console[_0x4767a7(0xcd)](_0x4767a7(0xbe)+_0x265dd5[_0x4767a7(0xf6)]),0x1;throw _0x265dd5;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0xf2);[a27_0x3805cc(0x9d)]=a27_0x3805cc(0x113);async['execute'](_0x39f00f){const _0x518733=a27_0x3805cc,{options:_0x327b79,args:_0x5e2f2d,tdx:_0xab3ff9}=_0x39f00f,_0x213fe9=_0x327b79;if(_0x5e2f2d[_0x518733(0x104)]<0x2)return console[_0x518733(0xcd)](_0x518733(0xf8)),console[_0x518733(0xcd)](_0x518733(0x11e)),0x1;const _0x594447=_0x5e2f2d[0x0],_0x65903=_0x5e2f2d[0x1];_0x213fe9['verbose']&&(console[_0x518733(0xcd)](_0x518733(0xb3)+_0x213fe9[_0x518733(0xe1)]),console['error']('Parent\x20segment:\x20'+_0x594447),console['error'](_0x518733(0x106)+_0x65903));let _0x5649ae;if(_0x213fe9[_0x518733(0x97)]){const _0x25c471=_0x213fe9[_0x518733(0x97)],_0x45bfcb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x594447+'\x27...',()=>_0xab3ff9[_0x518733(0xee)][_0x518733(0xc1)](_0x594447),{'verbose':_0x213fe9[_0x518733(0x12b)]}),_0x5c8fb0=_0x45bfcb[_0x518733(0xe8)],_0x347ccd=await withSpinner(_0x518733(0xf9)+_0x25c471+_0x518733(0xc9),()=>_0xab3ff9['segment'][_0x518733(0xd6)](_0x5c8fb0,_0x25c471),{'verbose':_0x213fe9[_0x518733(0x12b)]});_0x5649ae=_0x347ccd[_0x518733(0xe8)],_0x213fe9[_0x518733(0x12b)]&&console[_0x518733(0xcd)](_0x518733(0xa5)+_0x5649ae);}const _0x1bed71={'name':_0x65903,'description':_0x213fe9[_0x518733(0x9d)],'parentFolderId':_0x5649ae},_0x5ac9ea=await withSpinner(_0x518733(0x123)+_0x65903+'\x27...',()=>_0xab3ff9[_0x518733(0xee)][_0x518733(0xba)](_0x594447,_0x1bed71),{'verbose':_0x213fe9[_0x518733(0x12b)]}),_0x3f451b=_0x5ac9ea[_0x518733(0xe8)];return console[_0x518733(0xcd)](_0x518733(0xdc)+_0x3f451b[_0x518733(0x11f)]+_0x518733(0xb1)+_0x3f451b['id']),await handleSDKOutput([_0x3f451b],_0x213fe9),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0xb0);[a27_0x3805cc(0x9d)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x3c3fa2){const _0x3c4e59=a27_0x3805cc,{options:_0x1e040f,args:_0x4c04bd,tdx:_0x4fc70b}=_0x3c3fa2,_0x384d5f=_0x4c04bd[0x0];if(!_0x384d5f)return console['error'](_0x3c4e59(0xd7)),console[_0x3c4e59(0xcd)](_0x3c4e59(0xc5)),console[_0x3c4e59(0xcd)](_0x3c4e59(0xb4)),console[_0x3c4e59(0xcd)](_0x3c4e59(0x112)),console['error'](_0x3c4e59(0xf3)),console[_0x3c4e59(0xcd)](_0x3c4e59(0xaa)),console[_0x3c4e59(0xcd)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x3c4e59(0x111)),console[_0x3c4e59(0xcd)](_0x3c4e59(0xca)),console[_0x3c4e59(0xcd)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2d22da=_0x1e040f['parentSegment'],_0x15042e=await resolveSegmentTarget(_0x384d5f,_0x2d22da,_0x1e040f[_0x3c4e59(0x12b)]);_0x1e040f[_0x3c4e59(0x12b)]&&console[_0x3c4e59(0xcd)](_0x3c4e59(0xc7)+_0x15042e);const _0x685e41=await withSpinner('Resolving\x20\x27'+_0x384d5f+_0x3c4e59(0xc9),()=>_0x4fc70b[_0x3c4e59(0xee)]['resolvePathToResource'](_0x15042e),{'verbose':_0x1e040f[_0x3c4e59(0x12b)]}),_0x436e6=_0x685e41['data'];_0x1e040f[_0x3c4e59(0x12b)]&&(console['error'](_0x3c4e59(0xcc)+_0x436e6[_0x3c4e59(0xe7)]),console[_0x3c4e59(0xcd)](_0x3c4e59(0x107)+_0x436e6['parentId']),_0x436e6[_0x3c4e59(0xea)]&&console[_0x3c4e59(0xcd)](_0x3c4e59(0xeb)+_0x436e6[_0x3c4e59(0xea)]),_0x436e6[_0x3c4e59(0x119)]&&console[_0x3c4e59(0xcd)]('Segment\x20ID:\x20'+_0x436e6[_0x3c4e59(0x119)]));if(_0x1e040f['web']){if(_0x436e6[_0x3c4e59(0xe7)]===_0x3c4e59(0x109))return console[_0x3c4e59(0xcd)](_0x3c4e59(0xfe)),0x1;if(_0x436e6[_0x3c4e59(0xe7)]==='parent')return console[_0x3c4e59(0xcd)](_0x3c4e59(0x9a)),console[_0x3c4e59(0xcd)](_0x3c4e59(0x96)),0x1;if(!_0x436e6['segmentId'])throw new SDKError(ErrorCode[_0x3c4e59(0xe6)],_0x3c4e59(0x9c));const _0x461acc=getConsoleNextUrl(_0x1e040f['site'],_0x3c4e59(0xed)+_0x436e6['parentId']+_0x3c4e59(0x12a)+_0x436e6['segmentId']);return console[_0x3c4e59(0xcd)](a27_0x4f0969[_0x3c4e59(0x94)]('✔')+_0x3c4e59(0x103)+a27_0x4f0969['cyan'](_0x461acc)),openBrowser(_0x461acc),0x0;}if(_0x436e6[_0x3c4e59(0xe7)]==='folder'){if(!_0x436e6['folderId'])throw new SDKError(ErrorCode[_0x3c4e59(0xdd)],_0x3c4e59(0xa6));const _0x9900e1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4fc70b[_0x3c4e59(0xee)]['getFolder'](_0x436e6['folderId']),{'verbose':_0x1e040f[_0x3c4e59(0x12b)]});await handleSingleObjectOutput(_0x9900e1['data'],_0x1e040f);}else{if(_0x436e6[_0x3c4e59(0xe7)]===_0x3c4e59(0xee)){if(!_0x436e6[_0x3c4e59(0x119)])throw new SDKError(ErrorCode[_0x3c4e59(0xe6)],_0x3c4e59(0x9c));const _0x296616=await withSpinner(_0x3c4e59(0xa8),()=>_0x4fc70b['segment']['getSegment'](_0x436e6[_0x3c4e59(0xbf)],_0x436e6[_0x3c4e59(0x119)]),{'verbose':_0x1e040f[_0x3c4e59(0x12b)]}),_0x5a9919=getConsoleNextUrl(_0x1e040f[_0x3c4e59(0xe1)],_0x3c4e59(0xed)+_0x436e6[_0x3c4e59(0xbf)]+_0x3c4e59(0x12a)+_0x436e6[_0x3c4e59(0x119)]),_0x33c8ab=_0x296616[_0x3c4e59(0xe8)];_0x33c8ab[_0x3c4e59(0x115)]=_0x5a9919,await handleSingleObjectOutput(_0x33c8ab,_0x1e040f);}else return console[_0x3c4e59(0xcd)](_0x3c4e59(0x9b)),console[_0x3c4e59(0xcd)](_0x3c4e59(0xb6)),0x1;}return 0x0;}catch(_0x5bb80b){if(_0x5bb80b instanceof SDKError)return console[_0x3c4e59(0xcd)](_0x3c4e59(0xd2)+_0x5bb80b[_0x3c4e59(0x105)]),_0x5bb80b[_0x3c4e59(0xf6)]&&console[_0x3c4e59(0xcd)](_0x3c4e59(0xbe)+_0x5bb80b[_0x3c4e59(0xf6)]),0x1;throw _0x5bb80b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x3805cc(0x11f)]=a27_0x3805cc(0x108);[a27_0x3805cc(0x9d)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a27_0x3805cc(0x114)](_0x310859){const _0x299957=a27_0x3805cc,{options:_0xc8bfc4,args:_0x43c6c9,tdx:_0x5ae309}=_0x310859,_0x2254f1=_0x43c6c9[0x0];if(!_0x2254f1)return console[_0x299957(0xcd)](_0x299957(0x10e)),console[_0x299957(0xcd)](_0x299957(0xde)),console[_0x299957(0xcd)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x299957(0xcd)](_0x299957(0xaa)),console[_0x299957(0xcd)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x299957(0xcd)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5d1c3a=_0xc8bfc4['parentSegment'],_0x9aa186=await resolveSegmentTarget(_0x2254f1,_0x5d1c3a,_0xc8bfc4[_0x299957(0x12b)]);_0xc8bfc4[_0x299957(0x12b)]&&console['error'](_0x299957(0xc7)+_0x9aa186);const _0x59028f=await withSpinner(_0x299957(0xc0)+_0x2254f1+_0x299957(0xc9),()=>_0x5ae309[_0x299957(0xee)][_0x299957(0xb7)](_0x9aa186),{'verbose':_0xc8bfc4[_0x299957(0x12b)]}),_0x38a069=_0x59028f['data'];_0xc8bfc4['verbose']&&(console[_0x299957(0xcd)](_0x299957(0xcc)+_0x38a069[_0x299957(0xe7)]),console[_0x299957(0xcd)](_0x299957(0x107)+_0x38a069[_0x299957(0xbf)]));if(_0x38a069['type']===_0x299957(0x109))return console[_0x299957(0xcd)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x38a069[_0x299957(0xe7)]===_0x299957(0x9e))return console[_0x299957(0xcd)](_0x299957(0xb8)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x38a069[_0x299957(0x119)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x542154=await withSpinner(_0x299957(0xd8),()=>_0x5ae309[_0x299957(0xee)][_0x299957(0xa7)](_0x38a069[_0x299957(0xbf)],_0x38a069[_0x299957(0x119)]),{'verbose':_0xc8bfc4['verbose']}),_0xe35e3=_0x542154['data'],_0x3555de=await executeSchemaQuery(_0xe35e3,_0x5ae309,_0xc8bfc4);return await handleQueryOutput(_0x3555de,_0xc8bfc4),0x0;}catch(_0x230cc1){if(_0x230cc1 instanceof SDKError)return console[_0x299957(0xcd)](_0x299957(0xd2)+_0x230cc1[_0x299957(0x105)]),_0x230cc1[_0x299957(0xf6)]&&console[_0x299957(0xcd)](_0x299957(0xbe)+_0x230cc1[_0x299957(0xf6)]),0x1;throw _0x230cc1;}}}
@@ -1 +1 @@
1
- function a28_0x56fa(_0x5dda9b,_0x516ed4){_0x5dda9b=_0x5dda9b-0x1f2;const _0x79f4e3=a28_0x79f4();let _0x56fa17=_0x79f4e3[_0x5dda9b];return _0x56fa17;}const a28_0x1c5307=a28_0x56fa;(function(_0x444292,_0x3c9e5d){const _0x857036=a28_0x56fa,_0x9c5bfe=_0x444292();while(!![]){try{const _0x20bac=-parseInt(_0x857036(0x203))/0x1+-parseInt(_0x857036(0x1fc))/0x2*(-parseInt(_0x857036(0x1f4))/0x3)+-parseInt(_0x857036(0x221))/0x4+parseInt(_0x857036(0x1f6))/0x5*(parseInt(_0x857036(0x204))/0x6)+parseInt(_0x857036(0x1f7))/0x7*(-parseInt(_0x857036(0x21c))/0x8)+-parseInt(_0x857036(0x220))/0x9*(-parseInt(_0x857036(0x21f))/0xa)+parseInt(_0x857036(0x1f8))/0xb*(-parseInt(_0x857036(0x1f3))/0xc);if(_0x20bac===_0x3c9e5d)break;else _0x9c5bfe['push'](_0x9c5bfe['shift']());}catch(_0x236baa){_0x9c5bfe['push'](_0x9c5bfe['shift']());}}}(a28_0x79f4,0x578ba));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a28_0x79f4(){const _0x3bc35d=['data','\x27...','Resolving\x20folder\x20\x27','invisible','158519kdKzLl','6gxqzLl','description','yellow','\x20\x20\x20Path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','folder','resolveFolderId','resolvePathToResource','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','execute','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','site','includes','Resolving\x20folder\x20path\x20\x27','segments','Resolved\x20folder\x20ID:\x20','parent','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','kind','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','noCountPopulation','folderId','1430168tvbmUH','Resolved\x20relative\x20path\x20to:\x20','segment:create','4230jafJqg','10278HSVJbb','125236AXtUdq','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','type','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','name','createSegment','Target\x20path:\x20','resolveParentId','207804QRfjKe','54JPDeTe','verbose','3047970erhsAN','21PbGAYE','143HiOLeP','segment','Examples:','length','24132tWruNn','\x27\x20with\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27'];a28_0x79f4=function(){return _0x3bc35d;};return a28_0x79f4();}import a28_0x6a6d80 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x1c5307(0x226)]=a28_0x1c5307(0x21e);[a28_0x1c5307(0x205)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a28_0x1c5307(0x20e)](_0x3b1fb9){const _0x314b09=a28_0x1c5307;console['error'](a28_0x6a6d80[_0x314b09(0x206)](_0x314b09(0x218))),console['error'](a28_0x6a6d80['yellow'](_0x314b09(0x208)));const {options:_0x1d4a67,args:_0x1744f0,tdx:_0xb0e3ea}=_0x3b1fb9,_0x5b5dcd=_0x1d4a67;if(_0x1744f0[_0x314b09(0x1fb)]===0x0)return console[_0x314b09(0x222)](_0x314b09(0x20f)),console[_0x314b09(0x222)](_0x314b09(0x20d)),console[_0x314b09(0x222)](_0x314b09(0x1fa)),console[_0x314b09(0x222)](_0x314b09(0x225)),console['error'](_0x314b09(0x223)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x449fe2=_0x1744f0[0x0],_0x328608=_0x1d4a67['segmentPath'];let _0x1c11a2=_0x449fe2;_0x328608&&!_0x449fe2[_0x314b09(0x211)]('/')&&(_0x1c11a2=_0x328608+'/'+_0x449fe2,_0x5b5dcd[_0x314b09(0x1f5)]&&console[_0x314b09(0x222)](_0x314b09(0x21d)+_0x1c11a2));const _0x4afe64=parsePath(_0x1c11a2);if(_0x4afe64[_0x314b09(0x213)]['length']<0x2)return console[_0x314b09(0x222)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x314b09(0x222)](_0x314b09(0x216)),0x1;const _0x3f2b39=_0x4afe64[_0x314b09(0x213)][0x0],_0x41222c=getBaseName(_0x1c11a2),_0x27f507=getParentPath(_0x1c11a2);_0x5b5dcd['verbose']&&(console['error']('Site:\x20'+_0x5b5dcd[_0x314b09(0x210)]),console[_0x314b09(0x222)](_0x314b09(0x228)+_0x1c11a2),console[_0x314b09(0x222)](_0x314b09(0x20c)+_0x3f2b39),console['error']('Segment\x20name:\x20'+_0x41222c),console['error']('Parent\x20path:\x20'+_0x27f507));const _0x173996=await withSpinner(_0x314b09(0x1fe)+_0x3f2b39+_0x314b09(0x200),()=>_0xb0e3ea[_0x314b09(0x1f9)][_0x314b09(0x1f2)](_0x3f2b39),{'verbose':_0x5b5dcd[_0x314b09(0x1f5)]}),_0x354133=_0x173996['data'];let _0x56d58e;if(_0x4afe64[_0x314b09(0x213)]['length']>0x2){const _0x3871fc=await withSpinner(_0x314b09(0x212)+_0x27f507+_0x314b09(0x200),()=>_0xb0e3ea[_0x314b09(0x1f9)][_0x314b09(0x20b)](_0x27f507),{'verbose':_0x5b5dcd[_0x314b09(0x1f5)]}),_0x2ca375=_0x3871fc[_0x314b09(0x1ff)];if(_0x2ca375[_0x314b09(0x224)]!==_0x314b09(0x209)&&_0x2ca375['type']!==_0x314b09(0x215))return console[_0x314b09(0x222)](_0x314b09(0x219)),0x1;_0x56d58e=_0x2ca375[_0x314b09(0x21b)];}else{if(_0x5b5dcd[_0x314b09(0x209)]){const _0x5a7578=await withSpinner(_0x314b09(0x201)+_0x5b5dcd[_0x314b09(0x209)]+_0x314b09(0x200),()=>_0xb0e3ea[_0x314b09(0x1f9)][_0x314b09(0x20a)](_0x354133,_0x5b5dcd[_0x314b09(0x209)]),{'verbose':_0x5b5dcd['verbose']});_0x56d58e=_0x5a7578[_0x314b09(0x1ff)];}}_0x5b5dcd[_0x314b09(0x1f5)]&&_0x56d58e&&console[_0x314b09(0x222)](_0x314b09(0x214)+_0x56d58e);const _0x568874=await loadJSONFromOptions(_0x5b5dcd['rule'],_0x5b5dcd['ruleFile']),_0x1d0129={'name':_0x41222c,'description':_0x5b5dcd['description'],'rule':_0x568874,'kind':_0x5b5dcd['kind']!==undefined?parseInt(_0x5b5dcd[_0x314b09(0x217)],0xa):undefined,'isVisible':_0x5b5dcd[_0x314b09(0x202)]?![]:undefined,'segmentFolderId':_0x56d58e,'countPopulation':_0x5b5dcd[_0x314b09(0x21a)]?![]:undefined},_0x5952c5=await withSpinner('Creating\x20segment\x20\x27'+_0x41222c+_0x314b09(0x200),()=>_0xb0e3ea['segment'][_0x314b09(0x227)](_0x354133,_0x1d0129),{'verbose':_0x5b5dcd['verbose']}),_0x208557=_0x5952c5['data'];return console[_0x314b09(0x222)]('✔\x20Created\x20segment\x20\x27'+_0x208557[_0x314b09(0x226)]+_0x314b09(0x1fd)+_0x208557['id']),_0x1c11a2!==_0x449fe2&&console[_0x314b09(0x222)](_0x314b09(0x207)+_0x1c11a2),await handleSDKOutput([_0x208557],_0x5b5dcd),0x0;}}
1
+ const a28_0x5ac862=a28_0x28fb;(function(_0x4f037d,_0x37bb6c){const _0x56f449=a28_0x28fb,_0xf0094e=_0x4f037d();while(!![]){try{const _0x51bc4a=parseInt(_0x56f449(0x86))/0x1+parseInt(_0x56f449(0xa9))/0x2*(-parseInt(_0x56f449(0xa8))/0x3)+parseInt(_0x56f449(0x7a))/0x4+parseInt(_0x56f449(0xad))/0x5+-parseInt(_0x56f449(0xa1))/0x6+parseInt(_0x56f449(0x7e))/0x7+-parseInt(_0x56f449(0x96))/0x8*(parseInt(_0x56f449(0x87))/0x9);if(_0x51bc4a===_0x37bb6c)break;else _0xf0094e['push'](_0xf0094e['shift']());}catch(_0x5e1913){_0xf0094e['push'](_0xf0094e['shift']());}}}(a28_0x4438,0xebd87));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a28_0x28fb(_0x4873bf,_0x1b76ee){_0x4873bf=_0x4873bf-0x7a;const _0x443807=a28_0x4438();let _0x28fbf3=_0x443807[_0x4873bf];return _0x28fbf3;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a28_0x4438(){const _0x24b599=['8047495XHuZwU','type','\x20\x20\x20Path:\x20','folderId','error','1114224vjrSZj','noCountPopulation','Parent\x20path:\x20','Site:\x20','9177588WYMBtf','data','Parent:\x20','Examples:','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Creating\x20segment\x20\x27','invisible','ruleFile','170210aXNZrm','54BgCRqr','segment','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','execute','verbose','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segmentPath','Resolving\x20folder\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','includes','folder','createSegment','segments','1271672RZuFFi','kind','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','name','✔\x20Created\x20segment\x20\x27','resolvePathToResource','\x27\x20with\x20ID:\x20','length','rule','Segment\x20name:\x20','1654464VAxxqJ','description','Resolving\x20folder\x20path\x20\x27','\x27...','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','segment:create','12759RNGnQR','552krzhya','Target\x20path:\x20','resolveFolderId','Resolving\x20parent\x20segment\x20\x27'];a28_0x4438=function(){return _0x24b599;};return a28_0x4438();}import a28_0x393248 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x5ac862(0x9a)]=a28_0x5ac862(0xa7);[a28_0x5ac862(0xa2)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a28_0x5ac862(0x8b)](_0x480a24){const _0x34a58b=a28_0x5ac862;console[_0x34a58b(0xb1)](a28_0x393248[_0x34a58b(0xa6)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a28_0x393248['yellow'](_0x34a58b(0xa5)));const {options:_0x1044c8,args:_0x59fc44,tdx:_0x5b598f}=_0x480a24,_0xcd0fa5=_0x1044c8;if(_0x59fc44['length']===0x0)return console['error'](_0x34a58b(0x82)),console[_0x34a58b(0xb1)](_0x34a58b(0x89)),console['error'](_0x34a58b(0x81)),console['error'](_0x34a58b(0x99)),console[_0x34a58b(0xb1)](_0x34a58b(0x8e)),console[_0x34a58b(0xb1)](_0x34a58b(0x8a)),0x1;const _0x2eae43=_0x59fc44[0x0],_0x120b39=_0x1044c8[_0x34a58b(0x8f)];let _0x1d7cec=_0x2eae43;_0x120b39&&!_0x2eae43[_0x34a58b(0x92)]('/')&&(_0x1d7cec=_0x120b39+'/'+_0x2eae43,_0xcd0fa5['verbose']&&console[_0x34a58b(0xb1)]('Resolved\x20relative\x20path\x20to:\x20'+_0x1d7cec));const _0x37f7a5=parsePath(_0x1d7cec);if(_0x37f7a5[_0x34a58b(0x95)][_0x34a58b(0x9e)]<0x2)return console[_0x34a58b(0xb1)](_0x34a58b(0x91)),console[_0x34a58b(0xb1)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x131ed4=_0x37f7a5[_0x34a58b(0x95)][0x0],_0x55db35=getBaseName(_0x1d7cec),_0x39dd30=getParentPath(_0x1d7cec);_0xcd0fa5[_0x34a58b(0x8c)]&&(console[_0x34a58b(0xb1)](_0x34a58b(0x7d)+_0xcd0fa5['site']),console[_0x34a58b(0xb1)](_0x34a58b(0xaa)+_0x1d7cec),console[_0x34a58b(0xb1)](_0x34a58b(0x80)+_0x131ed4),console[_0x34a58b(0xb1)](_0x34a58b(0xa0)+_0x55db35),console['error'](_0x34a58b(0x7c)+_0x39dd30));const _0x20355e=await withSpinner(_0x34a58b(0xac)+_0x131ed4+_0x34a58b(0xa4),()=>_0x5b598f[_0x34a58b(0x88)]['resolveParentId'](_0x131ed4),{'verbose':_0xcd0fa5[_0x34a58b(0x8c)]}),_0x4445d4=_0x20355e[_0x34a58b(0x7f)];let _0x277696;if(_0x37f7a5['segments']['length']>0x2){const _0x588681=await withSpinner(_0x34a58b(0xa3)+_0x39dd30+_0x34a58b(0xa4),()=>_0x5b598f[_0x34a58b(0x88)][_0x34a58b(0x9c)](_0x39dd30),{'verbose':_0xcd0fa5[_0x34a58b(0x8c)]}),_0x80232e=_0x588681[_0x34a58b(0x7f)];if(_0x80232e[_0x34a58b(0xae)]!==_0x34a58b(0x93)&&_0x80232e[_0x34a58b(0xae)]!=='parent')return console[_0x34a58b(0xb1)](_0x34a58b(0x8d)),0x1;_0x277696=_0x80232e[_0x34a58b(0xb0)];}else{if(_0xcd0fa5['folder']){const _0x2cc6e6=await withSpinner(_0x34a58b(0x90)+_0xcd0fa5[_0x34a58b(0x93)]+_0x34a58b(0xa4),()=>_0x5b598f['segment'][_0x34a58b(0xab)](_0x4445d4,_0xcd0fa5[_0x34a58b(0x93)]),{'verbose':_0xcd0fa5[_0x34a58b(0x8c)]});_0x277696=_0x2cc6e6[_0x34a58b(0x7f)];}}_0xcd0fa5[_0x34a58b(0x8c)]&&_0x277696&&console['error'](_0x34a58b(0x98)+_0x277696);const _0x1523e8=await loadJSONFromOptions(_0xcd0fa5[_0x34a58b(0x9f)],_0xcd0fa5[_0x34a58b(0x85)]),_0x1c5986={'name':_0x55db35,'description':_0xcd0fa5[_0x34a58b(0xa2)],'rule':_0x1523e8,'kind':_0xcd0fa5[_0x34a58b(0x97)]!==undefined?parseInt(_0xcd0fa5[_0x34a58b(0x97)],0xa):undefined,'isVisible':_0xcd0fa5[_0x34a58b(0x84)]?![]:undefined,'segmentFolderId':_0x277696,'countPopulation':_0xcd0fa5[_0x34a58b(0x7b)]?![]:undefined},_0x269cde=await withSpinner(_0x34a58b(0x83)+_0x55db35+_0x34a58b(0xa4),()=>_0x5b598f[_0x34a58b(0x88)][_0x34a58b(0x94)](_0x4445d4,_0x1c5986),{'verbose':_0xcd0fa5[_0x34a58b(0x8c)]}),_0x535bb9=_0x269cde[_0x34a58b(0x7f)];return console[_0x34a58b(0xb1)](_0x34a58b(0x9b)+_0x535bb9[_0x34a58b(0x9a)]+_0x34a58b(0x9d)+_0x535bb9['id']),_0x1d7cec!==_0x2eae43&&console[_0x34a58b(0xb1)](_0x34a58b(0xaf)+_0x1d7cec),await handleSDKOutput([_0x535bb9],_0xcd0fa5),0x0;}}
@@ -1 +1 @@
1
- const a29_0x2b7116=a29_0x1687;function a29_0x1687(_0x4eec57,_0x545f3a){_0x4eec57=_0x4eec57-0xec;const _0x539dca=a29_0x539d();let _0x168719=_0x539dca[_0x4eec57];return _0x168719;}(function(_0x67da03,_0x49ec08){const _0x4e4705=a29_0x1687,_0x2dcf07=_0x67da03();while(!![]){try{const _0x10f304=parseInt(_0x4e4705(0xf8))/0x1*(-parseInt(_0x4e4705(0xed))/0x2)+parseInt(_0x4e4705(0x101))/0x3*(-parseInt(_0x4e4705(0x107))/0x4)+-parseInt(_0x4e4705(0xf6))/0x5*(parseInt(_0x4e4705(0xf5))/0x6)+-parseInt(_0x4e4705(0xff))/0x7*(parseInt(_0x4e4705(0xf0))/0x8)+-parseInt(_0x4e4705(0xfe))/0x9+parseInt(_0x4e4705(0x103))/0xa*(-parseInt(_0x4e4705(0xf3))/0xb)+parseInt(_0x4e4705(0xef))/0xc*(parseInt(_0x4e4705(0xf9))/0xd);if(_0x10f304===_0x49ec08)break;else _0x2dcf07['push'](_0x2dcf07['shift']());}catch(_0x5c6c21){_0x2dcf07['push'](_0x2dcf07['shift']());}}}(a29_0x539d,0x590e4));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a29_0x2b7116(0x105);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x2b7116(0xf2)](_0xbc6904){const _0x54e6d7=a29_0x2b7116,{options:_0x1f1833,args:_0x3e974d,tdx:_0x5d6e60}=_0xbc6904,_0x570a78=_0x3e974d[0x0]||_0x1f1833[_0x54e6d7(0xf1)];if(!_0x570a78)return console['error'](_0x54e6d7(0x108)),console[_0x54e6d7(0x100)](_0x54e6d7(0x104)),console[_0x54e6d7(0x100)](_0x54e6d7(0xf4)),0x1;_0x1f1833[_0x54e6d7(0xf7)]&&(console['error'](_0x54e6d7(0x106)+_0x1f1833['site']),console[_0x54e6d7(0x100)](_0x54e6d7(0xfc)+_0x570a78));const _0xfdf3a3=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x570a78+'\x27...',()=>_0x5d6e60[_0x54e6d7(0xfa)][_0x54e6d7(0xfd)](_0x570a78),{'verbose':_0x1f1833[_0x54e6d7(0xf7)]}),_0x41d5ff=_0xfdf3a3[_0x54e6d7(0xee)];console['error']('✔\x20Found\x20'+_0x41d5ff[_0x54e6d7(0xfb)]+_0x54e6d7(0xec)+(_0x41d5ff['length']!==0x1?'s':''));if(_0x1f1833['json']||_0x1f1833[_0x54e6d7(0x102)])return await handleSDKOutput(_0x41d5ff,_0x1f1833),0x0;return displayFieldsHumanReadable(_0x41d5ff,_0x570a78),0x0;}}function a29_0x539d(){const _0x1a4de6=['length','Parent\x20segment:\x20','listFields','607743vtubkM','3042634uxfEVF','error','29361kUFURC','jsonl','10UCuSqB','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment:fields','Site:\x20','92foNvoU','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20field','778VpDYdr','data','84RnQLAa','8zXSBWb','parentSegment','execute','7743703CMYeTB','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','35544tuNleT','60CLelkN','verbose','1654SKkEVP','4662411BylTui','segment'];a29_0x539d=function(){return _0x1a4de6;};return a29_0x539d();}
1
+ const a29_0x1e3ff9=a29_0x2c89;(function(_0x5e5225,_0x22acb2){const _0x518c0a=a29_0x2c89,_0x48a39=_0x5e5225();while(!![]){try{const _0x1d2ac9=parseInt(_0x518c0a(0x1f0))/0x1+-parseInt(_0x518c0a(0x1ee))/0x2+-parseInt(_0x518c0a(0x1d9))/0x3+-parseInt(_0x518c0a(0x1df))/0x4+-parseInt(_0x518c0a(0x1dd))/0x5*(-parseInt(_0x518c0a(0x1db))/0x6)+-parseInt(_0x518c0a(0x1dc))/0x7*(-parseInt(_0x518c0a(0x1f1))/0x8)+-parseInt(_0x518c0a(0x1d7))/0x9*(parseInt(_0x518c0a(0x1e4))/0xa);if(_0x1d2ac9===_0x22acb2)break;else _0x48a39['push'](_0x48a39['shift']());}catch(_0x118018){_0x48a39['push'](_0x48a39['shift']());}}}(a29_0x257b,0xcca5c));import{BaseCommand}from'./command.js';function a29_0x2c89(_0x519816,_0x4f0320){_0x519816=_0x519816-0x1d7;const _0x257b0b=a29_0x257b();let _0x2c8943=_0x257b0b[_0x519816];return _0x2c8943;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a29_0x257b(){const _0x3ae73b=['1187049eoHFQt','Error:\x20Parent\x20segment\x20name\x20is\x20required','6lJrcgo','371jMqcDe','6466780svnnXY','execute','3219032sZBjvE','json','verbose','length','segment','40SPtFLa','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','error','Listing\x20fields\x20for\x20\x27','✔\x20Found\x20','parentSegment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x27...','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','1585556vaxOpo','site','1436501PZyfGk','169200vhluBI','2293542TLirKj','jsonl'];a29_0x257b=function(){return _0x3ae73b;};return a29_0x257b();}export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';['description']=a29_0x1e3ff9(0x1ec);async[a29_0x1e3ff9(0x1de)](_0x59647d){const _0x4611ed=a29_0x1e3ff9,{options:_0x4dd8b5,args:_0x3df206,tdx:_0x1a2ee8}=_0x59647d,_0x1169a2=_0x3df206[0x0]||_0x4dd8b5[_0x4611ed(0x1e9)];if(!_0x1169a2)return console[_0x4611ed(0x1e6)](_0x4611ed(0x1da)),console[_0x4611ed(0x1e6)](_0x4611ed(0x1e5)),console[_0x4611ed(0x1e6)](_0x4611ed(0x1ea)),0x1;_0x4dd8b5[_0x4611ed(0x1e1)]&&(console[_0x4611ed(0x1e6)]('Site:\x20'+_0x4dd8b5[_0x4611ed(0x1ef)]),console[_0x4611ed(0x1e6)](_0x4611ed(0x1ed)+_0x1169a2));const _0x46e93c=await withSpinner(_0x4611ed(0x1e7)+_0x1169a2+_0x4611ed(0x1eb),()=>_0x1a2ee8[_0x4611ed(0x1e3)]['listFields'](_0x1169a2),{'verbose':_0x4dd8b5[_0x4611ed(0x1e1)]}),_0x473726=_0x46e93c['data'];console['error'](_0x4611ed(0x1e8)+_0x473726[_0x4611ed(0x1e2)]+'\x20field'+(_0x473726[_0x4611ed(0x1e2)]!==0x1?'s':''));if(_0x4dd8b5[_0x4611ed(0x1e0)]||_0x4dd8b5[_0x4611ed(0x1d8)])return await handleSDKOutput(_0x473726,_0x4dd8b5),0x0;return displayFieldsHumanReadable(_0x473726,_0x1169a2),0x0;}}
@@ -1 +1 @@
1
- const a30_0x37f528=a30_0x3b49;(function(_0x291c13,_0x50a835){const _0x5b76ae=a30_0x3b49,_0x280f04=_0x291c13();while(!![]){try{const _0x20d790=parseInt(_0x5b76ae(0x11a))/0x1+parseInt(_0x5b76ae(0x142))/0x2*(-parseInt(_0x5b76ae(0x15f))/0x3)+-parseInt(_0x5b76ae(0x123))/0x4*(-parseInt(_0x5b76ae(0x141))/0x5)+-parseInt(_0x5b76ae(0x151))/0x6+-parseInt(_0x5b76ae(0x131))/0x7+parseInt(_0x5b76ae(0x152))/0x8+-parseInt(_0x5b76ae(0x136))/0x9*(-parseInt(_0x5b76ae(0x140))/0xa);if(_0x20d790===_0x50a835)break;else _0x280f04['push'](_0x280f04['shift']());}catch(_0x2bf2df){_0x280f04['push'](_0x280f04['shift']());}}}(a30_0x425d,0xea0ae));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x133b2d from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a30_0x425d(){const _0x377648=['type','filter','length','\x20with\x20','\x20journeys','Site:\x20','688MPbokf','targetDir','Aborted.','✔\x20All\x20files\x20are\x20up\x20to\x20date','setPhase','\x20segments','parent_segment','✔\x20Context\x20set:\x20','dim','error','parentSegment','\x20\x20🗺️\x20\x20','content','\x0aPull\x20summary\x20for\x20\x27','9199932BQOkHS','verbose','yes','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','cyan','88983OPWGDD','\x20versions)','errorCode','diff','Error:\x20','Write\x20','✔\x20Pulled\x20','\x20changed\x20files','utf-8','helpText','1410tObngy','31175vcPDPz','10OgcdUE','Pulling\x20segments\x20from\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','files','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','parentName','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','segments','absolutePath','session','\x20activations','red','cwd','\x27...','7303692MfCcON','12591208ZeJbfy','segment','hasChanges','\x20unchanged\x20files','activations','Parent\x20segment:\x20','isNew','\x20files?','repeat','no_parent','\x20new\x20files','counts','journeys','1127967iscfkC','resourceName','execute','file','\x0aChanges\x20to\x20\x27','\x20\x20🎯\x20','yellow','green','Target\x20resource:\x20','dryRun','journeyVersions','\x20=\x20','1329753oceUcW','site','name'];a30_0x425d=function(){return _0x377648;};return a30_0x425d();}import a30_0x1a8bdf from'path';function a30_0x3b49(_0x354c98,_0x2f8579){_0x354c98=_0x354c98-0x116;const _0x425d78=a30_0x425d();let _0x3b49bb=_0x425d78[_0x354c98];return _0x3b49bb;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x37f528(0x11c)]='segment:pull';['description']=a30_0x37f528(0x146);async[a30_0x37f528(0x161)](_0x3abc23){const _0x3869d1=a30_0x37f528,{options:_0x5ee1dd,args:_0x2a7f31,tdx:_0x214c26}=_0x3abc23,_0x1e9ee2=_0x5ee1dd,_0x1b0167=await resolveTarget({'arg':_0x2a7f31[0x0],'contextParent':_0x5ee1dd[_0x3869d1(0x12d)],'cwd':process[_0x3869d1(0x14f)]()});if(!isSuccessfulResolution(_0x1b0167))return _0x1b0167[_0x3869d1(0x138)]===_0x3869d1(0x15b)?(console[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x165)](_0x3869d1(0x148))),console[_0x3869d1(0x12c)]('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[_0x3869d1(0x12c)](_0x3869d1(0x144)),console[_0x3869d1(0x12c)]('\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[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x14e)](_0x3869d1(0x13a)+_0x1b0167['message']+'\x0a')),_0x1b0167[_0x3869d1(0x13f)]&&console[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x135)](_0x1b0167['helpText']))),0x1;const _0x104677=_0x1b0167[_0x3869d1(0x147)],_0x417f7c=_0x1b0167[_0x3869d1(0x124)],_0x238e05=_0x1b0167[_0x3869d1(0x11d)]===_0x3869d1(0x162)?_0x1b0167[_0x3869d1(0x160)]:undefined;_0x1e9ee2['verbose']&&(console[_0x3869d1(0x12c)](_0x3869d1(0x122)+_0x1e9ee2[_0x3869d1(0x11b)]),console['error'](_0x3869d1(0x157)+_0x104677),_0x238e05&&console[_0x3869d1(0x12c)](_0x3869d1(0x116)+_0x238e05));const _0x52ddd4=await withProgressSpinner(_0x3869d1(0x143)+_0x104677+_0x3869d1(0x150),_0x1477a3=>_0x214c26[_0x3869d1(0x153)]['pullSegments'](_0x104677,{'targetDir':_0x417f7c,'targetResourceName':_0x238e05,'verbose':_0x1e9ee2[_0x3869d1(0x132)],'progress':{'update':_0x4e6e82=>{const _0x16a8b1=_0x3869d1;_0x1477a3[_0x16a8b1(0x127)](_0x4e6e82),_0x1e9ee2[_0x16a8b1(0x132)]&&console[_0x16a8b1(0x12c)]('\x20\x20'+_0x4e6e82);}}}),{'verbose':_0x1e9ee2[_0x3869d1(0x132)]}),_0xc1736=_0x52ddd4['data'];if(_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x14a)]===0x0&&_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x15e)]===0x0)return console[_0x3869d1(0x12c)](a30_0x133b2d['yellow'](_0x3869d1(0x134)+_0xc1736[_0x3869d1(0x147)]+'\x27')),0x0;const _0x125f35=_0xc1736['files'][_0x3869d1(0x11e)](_0xabb4f8=>_0xabb4f8[_0x3869d1(0x158)]),_0x1fcf9c=_0xc1736[_0x3869d1(0x145)][_0x3869d1(0x11e)](_0x386080=>!_0x386080[_0x3869d1(0x158)]&&_0x386080['hasChanges']),_0x36d39c=_0xc1736[_0x3869d1(0x145)][_0x3869d1(0x11e)](_0x524ff6=>!_0x524ff6['isNew']&&!_0x524ff6['hasChanges']);console[_0x3869d1(0x12c)](_0x3869d1(0x130)+_0xc1736['parentName']+'\x27:'),console[_0x3869d1(0x12c)](_0x3869d1(0x164)+a30_0x133b2d[_0x3869d1(0x135)](_0xc1736['counts'][_0x3869d1(0x14a)]+_0x3869d1(0x128))+_0x3869d1(0x120)+a30_0x133b2d[_0x3869d1(0x135)](_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x156)]+_0x3869d1(0x14d)));if(_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x15e)]>0x0){const _0x47b2a1=_0xc1736[_0x3869d1(0x15d)]['journeyVersions']>_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x15e)]?'\x20('+_0xc1736['counts'][_0x3869d1(0x118)]+_0x3869d1(0x137):'';console[_0x3869d1(0x12c)](_0x3869d1(0x12e)+a30_0x133b2d[_0x3869d1(0x135)](_0xc1736[_0x3869d1(0x15d)][_0x3869d1(0x15e)]+_0x3869d1(0x121))+a30_0x133b2d['dim'](_0x47b2a1));}console[_0x3869d1(0x12c)]('\x20\x20'+a30_0x133b2d[_0x3869d1(0x166)]('+\x20'+_0x125f35[_0x3869d1(0x11f)]+_0x3869d1(0x15c))),console['error']('\x20\x20'+a30_0x133b2d['yellow']('~\x20'+_0x1fcf9c[_0x3869d1(0x11f)]+_0x3869d1(0x13d))),console[_0x3869d1(0x12c)]('\x20\x20'+a30_0x133b2d[_0x3869d1(0x12b)]('=\x20'+_0x36d39c[_0x3869d1(0x11f)]+_0x3869d1(0x155))),console[_0x3869d1(0x12c)]('\x20\x20Target:\x20'+a30_0x133b2d['cyan'](_0xc1736[_0x3869d1(0x124)])+'\x0a');if(_0x1fcf9c[_0x3869d1(0x11f)]>0x0)for(const _0x481453 of _0x1fcf9c){console[_0x3869d1(0x12c)](_0x3869d1(0x163)+_0x481453['relativePath']+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x3869d1(0x12c)](_0x481453[_0x3869d1(0x139)]),console[_0x3869d1(0x12c)]('─'[_0x3869d1(0x15a)](0x3c));}if(_0x1e9ee2[_0x3869d1(0x117)])return console['error'](a30_0x133b2d[_0x3869d1(0x165)](_0x3869d1(0x149))),0x0;if(_0x125f35[_0x3869d1(0x11f)]===0x0&&_0x1fcf9c[_0x3869d1(0x11f)]===0x0)return console[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x166)](_0x3869d1(0x126))),saveSessionContext({'parent_segment':_0xc1736['parentName']},_0x1e9ee2['session']),console[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x166)](_0x3869d1(0x12a)+a30_0x133b2d['dim'](_0x3869d1(0x129))+_0x3869d1(0x119)+a30_0x133b2d['cyan'](_0xc1736[_0x3869d1(0x147)]))),0x0;if(!_0x1e9ee2[_0x3869d1(0x133)]){const _0x24127b=await confirmKey(_0x3869d1(0x13b)+(_0x125f35[_0x3869d1(0x11f)]+_0x1fcf9c[_0x3869d1(0x11f)])+_0x3869d1(0x159));if(!_0x24127b)return console[_0x3869d1(0x12c)](_0x3869d1(0x125)),0x1;}for(const _0x5c7569 of _0xc1736[_0x3869d1(0x145)]){if(_0x5c7569[_0x3869d1(0x158)]||_0x5c7569[_0x3869d1(0x154)]){const _0x33a66d=a30_0x1a8bdf['dirname'](_0x5c7569[_0x3869d1(0x14b)]);!existsSync(_0x33a66d)&&mkdirSync(_0x33a66d,{'recursive':!![]}),writeFileSync(_0x5c7569['absolutePath'],_0x5c7569[_0x3869d1(0x12f)],_0x3869d1(0x13e));}}return console['error'](a30_0x133b2d[_0x3869d1(0x166)](_0x3869d1(0x13c)+(_0x125f35[_0x3869d1(0x11f)]+_0x1fcf9c[_0x3869d1(0x11f)])+'\x20files\x20to\x20'+_0xc1736[_0x3869d1(0x124)])),saveSessionContext({'parent_segment':_0xc1736[_0x3869d1(0x147)]},_0x1e9ee2[_0x3869d1(0x14c)]),console[_0x3869d1(0x12c)](a30_0x133b2d[_0x3869d1(0x166)](_0x3869d1(0x12a)+a30_0x133b2d[_0x3869d1(0x12b)]('parent_segment')+_0x3869d1(0x119)+a30_0x133b2d[_0x3869d1(0x135)](_0xc1736['parentName']))),0x0;}}
1
+ const a30_0x1a286b=a30_0x30ea;(function(_0x1e56d6,_0x3ee70d){const _0xbd91da=a30_0x30ea,_0x5cbc22=_0x1e56d6();while(!![]){try{const _0x3e3d56=parseInt(_0xbd91da(0x10f))/0x1*(-parseInt(_0xbd91da(0xfb))/0x2)+parseInt(_0xbd91da(0x12c))/0x3+parseInt(_0xbd91da(0x10c))/0x4*(parseInt(_0xbd91da(0xff))/0x5)+-parseInt(_0xbd91da(0x124))/0x6+parseInt(_0xbd91da(0x13b))/0x7*(parseInt(_0xbd91da(0x116))/0x8)+parseInt(_0xbd91da(0x13d))/0x9*(parseInt(_0xbd91da(0x143))/0xa)+-parseInt(_0xbd91da(0x119))/0xb;if(_0x3e3d56===_0x3ee70d)break;else _0x5cbc22['push'](_0x5cbc22['shift']());}catch(_0x228483){_0x5cbc22['push'](_0x5cbc22['shift']());}}}(a30_0x39bb,0x591c4));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x46a44e from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x12289d from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a30_0x39bb(){const _0x4b190b=['name','\x20journeys','\x0aChanges\x20to\x20\x27','163025PNBrCe','data','helpText','resourceName','Aborted.','verbose','length','utf-8','red','\x20\x20Target:\x20','parentName','counts','diff','32EkUIEf','setPhase','type','246079rQrdJw','journeyVersions','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','✔\x20All\x20files\x20are\x20up\x20to\x20date','parentSegment','activations','parent_segment','3208CDtQnL','\x20files?','\x20files\x20to\x20','1097833SMPsVd','segments','\x20unchanged\x20files','✔\x20Pulled\x20','isNew','\x20versions)','Write\x20','absolutePath','session','relativePath','error','1099140RpvEzg','Target\x20resource:\x20','message','filter','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','dim','yellow','file','70239LuQCik','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','yes','Parent\x20segment:\x20','execute','\x20\x20🎯\x20','\x20segments','segment:pull','site','Pulling\x20segments\x20from\x20\x27','dirname','cyan','repeat','\x20changed\x20files','\x20with\x20','3297rfgcwK','Error:\x20','947124hdUUxb','files','hasChanges','✔\x20Context\x20set:\x20','\x20activations','targetDir','40ggcZCJ','green','journeys','errorCode','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','pullSegments','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','2AkNVjr'];a30_0x39bb=function(){return _0x4b190b;};return a30_0x39bb();}function a30_0x30ea(_0x8995a6,_0xbd4b71){_0x8995a6=_0x8995a6-0xf7;const _0x39bb56=a30_0x39bb();let _0x30ead0=_0x39bb56[_0x8995a6];return _0x30ead0;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x1a286b(0xfc)]=a30_0x1a286b(0x133);['description']=a30_0x1a286b(0xf8);async[a30_0x1a286b(0x130)](_0x3263df){const _0x5d33d2=a30_0x1a286b,{options:_0x5e90b6,args:_0x4cd080,tdx:_0x4cb8cf}=_0x3263df,_0x532d1e=_0x5e90b6,_0x34f287=await resolveTarget({'arg':_0x4cd080[0x0],'contextParent':_0x5e90b6[_0x5d33d2(0x113)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x34f287))return _0x34f287[_0x5d33d2(0xf7)]==='no_parent'?(console['error'](a30_0x46a44e[_0x5d33d2(0x12a)](_0x5d33d2(0xfa))),console[_0x5d33d2(0x123)]('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[_0x5d33d2(0x123)](_0x5d33d2(0x111)),console[_0x5d33d2(0x123)]('\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['error'](a30_0x46a44e[_0x5d33d2(0x107)](_0x5d33d2(0x13c)+_0x34f287[_0x5d33d2(0x126)]+'\x0a')),_0x34f287[_0x5d33d2(0x101)]&&console[_0x5d33d2(0x123)](a30_0x46a44e[_0x5d33d2(0x137)](_0x34f287[_0x5d33d2(0x101)]))),0x1;const _0x4b5a15=_0x34f287[_0x5d33d2(0x109)],_0x4ebc51=_0x34f287['targetDir'],_0xc4e61e=_0x34f287[_0x5d33d2(0x10e)]===_0x5d33d2(0x12b)?_0x34f287[_0x5d33d2(0x102)]:undefined;_0x532d1e[_0x5d33d2(0x104)]&&(console['error']('Site:\x20'+_0x532d1e[_0x5d33d2(0x134)]),console['error'](_0x5d33d2(0x12f)+_0x4b5a15),_0xc4e61e&&console['error'](_0x5d33d2(0x125)+_0xc4e61e));const _0x19d292=await withProgressSpinner(_0x5d33d2(0x135)+_0x4b5a15+'\x27...',_0x54da3e=>_0x4cb8cf['segment'][_0x5d33d2(0xf9)](_0x4b5a15,{'targetDir':_0x4ebc51,'targetResourceName':_0xc4e61e,'verbose':_0x532d1e[_0x5d33d2(0x104)],'progress':{'update':_0x295f01=>{const _0x43afad=_0x5d33d2;_0x54da3e[_0x43afad(0x10d)](_0x295f01),_0x532d1e[_0x43afad(0x104)]&&console[_0x43afad(0x123)]('\x20\x20'+_0x295f01);}}}),{'verbose':_0x532d1e[_0x5d33d2(0x104)]}),_0x17bbe6=_0x19d292[_0x5d33d2(0x100)];if(_0x17bbe6[_0x5d33d2(0x10a)][_0x5d33d2(0x11a)]===0x0&&_0x17bbe6['counts']['journeys']===0x0)return console[_0x5d33d2(0x123)](a30_0x46a44e[_0x5d33d2(0x12a)](_0x5d33d2(0x128)+_0x17bbe6[_0x5d33d2(0x109)]+'\x27')),0x0;const _0x18a3f1=_0x17bbe6[_0x5d33d2(0x13e)][_0x5d33d2(0x127)](_0x1049a9=>_0x1049a9[_0x5d33d2(0x11d)]),_0x13e8a4=_0x17bbe6['files']['filter'](_0x1c355a=>!_0x1c355a[_0x5d33d2(0x11d)]&&_0x1c355a[_0x5d33d2(0x13f)]),_0x445025=_0x17bbe6[_0x5d33d2(0x13e)][_0x5d33d2(0x127)](_0x2c9012=>!_0x2c9012[_0x5d33d2(0x11d)]&&!_0x2c9012[_0x5d33d2(0x13f)]);console[_0x5d33d2(0x123)]('\x0aPull\x20summary\x20for\x20\x27'+_0x17bbe6[_0x5d33d2(0x109)]+'\x27:'),console[_0x5d33d2(0x123)](_0x5d33d2(0x131)+a30_0x46a44e[_0x5d33d2(0x137)](_0x17bbe6['counts'][_0x5d33d2(0x11a)]+_0x5d33d2(0x132))+_0x5d33d2(0x13a)+a30_0x46a44e[_0x5d33d2(0x137)](_0x17bbe6[_0x5d33d2(0x10a)][_0x5d33d2(0x114)]+_0x5d33d2(0x141)));if(_0x17bbe6['counts'][_0x5d33d2(0x145)]>0x0){const _0x4e9ee5=_0x17bbe6[_0x5d33d2(0x10a)]['journeyVersions']>_0x17bbe6['counts'][_0x5d33d2(0x145)]?'\x20('+_0x17bbe6['counts'][_0x5d33d2(0x110)]+_0x5d33d2(0x11e):'';console[_0x5d33d2(0x123)]('\x20\x20🗺️\x20\x20'+a30_0x46a44e[_0x5d33d2(0x137)](_0x17bbe6[_0x5d33d2(0x10a)][_0x5d33d2(0x145)]+_0x5d33d2(0xfd))+a30_0x46a44e[_0x5d33d2(0x129)](_0x4e9ee5));}console['error']('\x20\x20'+a30_0x46a44e[_0x5d33d2(0x144)]('+\x20'+_0x18a3f1['length']+'\x20new\x20files')),console[_0x5d33d2(0x123)]('\x20\x20'+a30_0x46a44e[_0x5d33d2(0x12a)]('~\x20'+_0x13e8a4[_0x5d33d2(0x105)]+_0x5d33d2(0x139))),console[_0x5d33d2(0x123)]('\x20\x20'+a30_0x46a44e[_0x5d33d2(0x129)]('=\x20'+_0x445025['length']+_0x5d33d2(0x11b))),console[_0x5d33d2(0x123)](_0x5d33d2(0x108)+a30_0x46a44e[_0x5d33d2(0x137)](_0x17bbe6['targetDir'])+'\x0a');if(_0x13e8a4[_0x5d33d2(0x105)]>0x0)for(const _0x202783 of _0x13e8a4){console[_0x5d33d2(0x123)](_0x5d33d2(0xfe)+_0x202783[_0x5d33d2(0x122)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x5d33d2(0x123)](_0x202783[_0x5d33d2(0x10b)]),console[_0x5d33d2(0x123)]('─'[_0x5d33d2(0x138)](0x3c));}if(_0x532d1e['dryRun'])return console[_0x5d33d2(0x123)](a30_0x46a44e[_0x5d33d2(0x12a)](_0x5d33d2(0x12d))),0x0;if(_0x18a3f1[_0x5d33d2(0x105)]===0x0&&_0x13e8a4[_0x5d33d2(0x105)]===0x0)return console[_0x5d33d2(0x123)](a30_0x46a44e[_0x5d33d2(0x144)](_0x5d33d2(0x112))),saveSessionContext({'parent_segment':_0x17bbe6['parentName']},_0x532d1e['session']),console[_0x5d33d2(0x123)](a30_0x46a44e[_0x5d33d2(0x144)](_0x5d33d2(0x140)+a30_0x46a44e['dim'](_0x5d33d2(0x115))+'\x20=\x20'+a30_0x46a44e['cyan'](_0x17bbe6[_0x5d33d2(0x109)]))),0x0;if(!_0x532d1e[_0x5d33d2(0x12e)]){const _0x252f93=await confirmKey(_0x5d33d2(0x11f)+(_0x18a3f1[_0x5d33d2(0x105)]+_0x13e8a4['length'])+_0x5d33d2(0x117));if(!_0x252f93)return console[_0x5d33d2(0x123)](_0x5d33d2(0x103)),0x1;}for(const _0x1df9d5 of _0x17bbe6[_0x5d33d2(0x13e)]){if(_0x1df9d5['isNew']||_0x1df9d5['hasChanges']){const _0x787c3b=a30_0x12289d[_0x5d33d2(0x136)](_0x1df9d5['absolutePath']);!existsSync(_0x787c3b)&&mkdirSync(_0x787c3b,{'recursive':!![]}),writeFileSync(_0x1df9d5[_0x5d33d2(0x120)],_0x1df9d5['content'],_0x5d33d2(0x106));}}return console[_0x5d33d2(0x123)](a30_0x46a44e['green'](_0x5d33d2(0x11c)+(_0x18a3f1['length']+_0x13e8a4['length'])+_0x5d33d2(0x118)+_0x17bbe6[_0x5d33d2(0x142)])),saveSessionContext({'parent_segment':_0x17bbe6[_0x5d33d2(0x109)]},_0x532d1e[_0x5d33d2(0x121)]),console['error'](a30_0x46a44e[_0x5d33d2(0x144)](_0x5d33d2(0x140)+a30_0x46a44e[_0x5d33d2(0x129)]('parent_segment')+'\x20=\x20'+a30_0x46a44e[_0x5d33d2(0x137)](_0x17bbe6[_0x5d33d2(0x109)]))),0x0;}}
@@ -1 +1 @@
1
- const a31_0x4f88d5=a31_0x2fda;(function(_0x1d30eb,_0x458c90){const _0x4bdd8f=a31_0x2fda,_0x39df7e=_0x1d30eb();while(!![]){try{const _0x45b202=parseInt(_0x4bdd8f(0xa3))/0x1*(-parseInt(_0x4bdd8f(0xbf))/0x2)+parseInt(_0x4bdd8f(0x10e))/0x3+-parseInt(_0x4bdd8f(0x109))/0x4+parseInt(_0x4bdd8f(0xd2))/0x5*(parseInt(_0x4bdd8f(0xb6))/0x6)+-parseInt(_0x4bdd8f(0xa9))/0x7*(-parseInt(_0x4bdd8f(0xc4))/0x8)+-parseInt(_0x4bdd8f(0x9a))/0x9+parseInt(_0x4bdd8f(0xa4))/0xa*(parseInt(_0x4bdd8f(0xc1))/0xb);if(_0x45b202===_0x458c90)break;else _0x39df7e['push'](_0x39df7e['shift']());}catch(_0x35b465){_0x39df7e['push'](_0x39df7e['shift']());}}}(a31_0x1b60,0x718ad));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a31_0x1b60(){const _0x496d10=['Source\x20directory:\x20','listFolders','message','targetDir','changed','journeysOnly','\x0aValidation\x20failed:','folders','3264174ktYMvG','toDelete','folderPath','/e/','setPhase','journeys','Parent\x20segment:\x20','new','state','1PYpwwT','10JjNUwH','\x20\x20Source:\x20','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','Error\x20parsing\x20YAML:\x20','dim','13279wyAKrK','Site:\x20','parentName','red','segment:push','helpText','folderId','\x20changed','\x20folders\x20to\x20create','journeyId','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','segment\x20or\x20journey','getJourney','26670JCothQ','execute','\x20to\x20delete','\x20changes?','attributes','toUpdate','existingJourney','parent_name','length','1450164yQcgox','\x20new','4299493UswcoH','Fetching\x20existing\x20segments...','repeat','24cHmBoP','then','parentSegment','.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','cwd','created','push','site','segmentFolderId','listSegments','nameToType','list','parentFolder','955dCfFSZ','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Fetching\x20parent\x20segment\x20details...','idToName','relationships','isNew','journey','filePath','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20YAML\x20files\x20found','unchanged','Scoped\x20to\x20folder:\x20','\x20created','audienceId','\x20\x20📊\x20Segments:','data','activations','/app/ps/','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','getOutputSchemaWithCache','filter','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20folders...','green','yamlConfig','\x20\x20\x20\x20','Fetching\x20existing\x20activations...','\x0aPush\x20summary\x20for\x20\x27','errorCode','segments','Preparing\x20journeys...','blue','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','New\x20journey:','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','(Journey\x20will\x20be\x20deleted)','updatedAt','error','verbose','scopedFolderPath','Changes\x20to:','all','no_parent','yellow','endsWith','journeyBundleName','\x20activations]','delete','\x20deleted','add','user','Fetching\x20existing\x20journeys...','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','281836vQGMMl','/j/da/je','diff','\x20\x20Activations:','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','1133241dpuAnV','segment','nameToId','\x20to\x20create','map','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','createdSegmentIds','\x20\x20Journeys:\x20','createdAt','\x20updated','name','\x0a✔\x20Push\x20complete','type','getParent','get','join','deleted','\x27...','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20\x20Segments:\x20','paused','updated','results','set','buildUserMaps','toCreate','resolveParentId','cyan'];a31_0x1b60=function(){return _0x496d10;};return a31_0x1b60();}import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x1c5e16 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a31_0x2fda(_0x5dbeb9,_0x44c685){_0x5dbeb9=_0x5dbeb9-0x91;const _0x1b601f=a31_0x1b60();let _0x2fda03=_0x1b601f[_0x5dbeb9];return _0x2fda03;}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a31_0x4f88d5(0x118)]=a31_0x4f88d5(0xad);['description']=a31_0x4f88d5(0xb3);async[a31_0x4f88d5(0xb7)](_0x52f678){const _0x139556=a31_0x4f88d5,{options:_0x1dfb8f,args:_0x5b7fcd,tdx:_0x732223}=_0x52f678,_0x59f96b=_0x1dfb8f,_0x46b766=await resolveTarget({'arg':_0x5b7fcd[0x0],'contextParent':_0x1dfb8f[_0x139556(0xc6)],'cwd':process[_0x139556(0xc9)]()});if(!isSuccessfulResolution(_0x46b766))return _0x46b766[_0x139556(0xef)]===_0x139556(0xfe)?(console[_0x139556(0xf9)](a31_0x1c5e16['yellow'](_0x139556(0xe5))),console[_0x139556(0xf9)]('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[_0x139556(0xf9)](_0x139556(0xdb)),console[_0x139556(0xf9)](_0x139556(0xc8))):(console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)]('Error:\x20'+_0x46b766[_0x139556(0x94)]+'\x0a')),_0x46b766[_0x139556(0xae)]&&console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0x91)](_0x46b766[_0x139556(0xae)]))),0x1;if(_0x46b766['type']===_0x139556(0xbd))return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)]('Error:\x20Directory\x20not\x20found:\x20'+_0x46b766[_0x139556(0x95)]+'\x0a')),console[_0x139556(0xf9)](a31_0x1c5e16['cyan'](_0x139556(0x120))),0x1;const _0x4cf08a=_0x46b766[_0x139556(0xab)],_0x4251c3=_0x46b766[_0x139556(0x95)],_0x14ca00=_0x46b766[_0x139556(0x11a)]==='file'?_0x46b766[_0x139556(0xd9)]:undefined,_0xd35ee5=getScopedDetails(_0x46b766),_0x159fbf=_0xd35ee5?.['isScoped']??![],_0x41e991=_0xd35ee5?.[_0x139556(0xfb)]??'';if(!existsSync(_0x4251c3))return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)]('Error:\x20Directory\x20not\x20found:\x20'+_0x4251c3+'\x0a')),console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0x91)](_0x139556(0x120))),0x1;_0x59f96b['verbose']&&(console[_0x139556(0xf9)](_0x139556(0xaa)+_0x59f96b[_0x139556(0xcc)]),console[_0x139556(0xf9)](_0x139556(0xa0)+_0x4cf08a),console[_0x139556(0xf9)](_0x139556(0x92)+_0x4251c3),_0x159fbf&&console[_0x139556(0xf9)](_0x139556(0xde)+_0x41e991));const _0x57c89f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4cf08a+_0x139556(0x11f),()=>_0x732223[_0x139556(0x10f)][_0x139556(0x128)](_0x4cf08a),{'verbose':_0x59f96b['verbose']}),_0x1b23d3=_0x57c89f[_0x139556(0xe2)],[_0x37f615,_0x56c55f,_0x2c5ac1,_0x41809b,_0x2469f7]=await Promise[_0x139556(0xfd)]([withSpinner(_0x139556(0xd4),()=>_0x732223[_0x139556(0x10f)][_0x139556(0x11b)](_0x1b23d3),{'verbose':_0x59f96b[_0x139556(0xfa)]}),withSpinner(_0x139556(0xc2),()=>_0x732223[_0x139556(0x10f)][_0x139556(0xce)](_0x1b23d3),{'verbose':_0x59f96b[_0x139556(0xfa)]}),withSpinner(_0x139556(0xe9),()=>_0x732223[_0x139556(0x10f)][_0x139556(0x93)](_0x1b23d3),{'verbose':_0x59f96b[_0x139556(0xfa)]}),withSpinner(_0x139556(0x107),()=>_0x732223[_0x139556(0xd8)]['listJourneysWithDetailsFromParentSegment'](_0x1b23d3,{'includeAllVersions':!![]}),{'verbose':_0x59f96b[_0x139556(0xfa)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x732223[_0x139556(0x106)][_0x139556(0x126)](),{'verbose':_0x59f96b[_0x139556(0xfa)]})[_0x139556(0xc5)](_0x2f5b4e=>_0x2f5b4e[_0x139556(0xe2)])]),_0x7ec6f0=_0x37f615[_0x139556(0xe2)],_0x2e5158=extractRootFolderId(_0x7ec6f0),_0x491230=_0x56c55f[_0x139556(0xe2)],_0x3359c5=_0x2c5ac1['data'],{journeys:_0x135629,activationStepsById:_0x417561}=_0x41809b[_0x139556(0xe2)],_0x4fdbc1=new Map(_0x135629['map'](_0xf5d57=>[_0xf5d57['id'],_0xf5d57])),_0x3fc8e7=_0x135629['map'](_0x2f6473=>({'id':_0x2f6473['id'],'name':_0x2f6473['attributes'][_0x139556(0x118)],'journeyBundleName':_0x2f6473['attributes'][_0x139556(0x101)]||'','journeyBundleId':_0x2f6473[_0x139556(0xba)]['journeyBundleId']||'','versionNumber':_0x2f6473['attributes']['versionNumber'],'description':_0x2f6473[_0x139556(0xba)][_0x139556(0xda)],'state':_0x2f6473['attributes'][_0x139556(0xa2)],'paused':_0x2f6473[_0x139556(0xba)][_0x139556(0x122)],'audienceId':_0x2f6473[_0x139556(0xba)][_0x139556(0xe0)],'folderId':_0x2f6473[_0x139556(0xd6)]?.[_0x139556(0xd1)]?.[_0x139556(0xe2)]?.['id'],'createdAt':_0x2f6473[_0x139556(0xba)][_0x139556(0x116)],'updatedAt':_0x2f6473[_0x139556(0xba)][_0x139556(0xf8)]})),{emailToId:_0x2a9993,idToEmail:_0x4c0663}=_0x2469f7,_0x2ca8af=await withSpinner(_0x139556(0xe8),async()=>{const _0x4ce3eb=_0x139556,_0x2b58ad=await _0x732223['connection'][_0x4ce3eb(0xd0)]();return buildConnectionMaps(_0x2b58ad);},{'verbose':_0x59f96b[_0x139556(0xfa)]})[_0x139556(0xc5)](_0x3ec4ae=>_0x3ec4ae['data']),_0x2bbe3a=_0x2ca8af[_0x139556(0x110)],_0x13fed4=_0x2ca8af['idToName'],_0xd10cd9=_0x2ca8af[_0x139556(0xcf)],_0xdfca25={'emailToIdMap':_0x2a9993,'connectionNameToIdMap':_0x2bbe3a,'connectionNameToTypeMap':_0xd10cd9,'getSchema':_0x1a6a86=>_0x732223['connection'][_0x139556(0xe6)](_0x1a6a86)};let {pathToId:_0x2f7bbf,idToPath:_0x1f4869}=buildFolderMaps(_0x3359c5);const _0x3f371a=buildSegmentLookupMap(_0x491230,_0x1f4869),_0x307250=buildSegmentNameToIdMap(_0x491230),_0x13fd52=buildJourneyBundleLookupMap(_0x3fc8e7,_0x1f4869);let _0x2a32bc;if(_0x14ca00){if(!_0x14ca00[_0x139556(0x100)](_0x139556(0xc7))&&!_0x14ca00['endsWith']('.yaml'))return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)](_0x139556(0x113)+_0x14ca00+'\x0a')),0x1;_0x2a32bc=[_0x14ca00];}else _0x2a32bc=findYamlFiles(_0x4251c3);if(_0x2a32bc[_0x139556(0xbe)]===0x0)return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x4251c3+'\x0a')),console[_0x139556(0xf9)](a31_0x1c5e16['cyan'](_0x139556(0xf4))),0x1;let _0x3dd4c1,_0x1aa9a0;try{const _0x4cb1cb=parseAndClassifyYamlFiles(_0x2a32bc,_0x4251c3,{'skipSegments':_0x59f96b[_0x139556(0x97)]});_0x3dd4c1=_0x4cb1cb[_0x139556(0xf0)],_0x1aa9a0=_0x4cb1cb[_0x139556(0x9f)];const _0x3de692=validateParsedFiles(_0x4cb1cb,_0x4251c3);if(_0x3de692[_0x139556(0xbe)]>0x0)return console['error'](a31_0x1c5e16[_0x139556(0xac)](_0x139556(0x98))),console[_0x139556(0xf9)](formatValidationErrors(_0x3de692)),console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xff)](_0x139556(0x10d))),0x1;}catch(_0x1708bf){return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)](_0x139556(0xa7)+(_0x1708bf instanceof Error?_0x1708bf['message']:_0x1708bf))),0x1;}if(_0x3dd4c1[_0x139556(0xbe)]===0x0&&_0x1aa9a0[_0x139556(0xbe)]===0x0){const _0x4e26ad=_0x59f96b[_0x139556(0x97)]?_0x139556(0xd8):_0x139556(0xb4);return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xff)]('No\x20'+_0x4e26ad+_0x139556(0xdc))),0x0;}const _0x1ebd83=new Map();_0x491230['length']>0x0&&!_0x59f96b[_0x139556(0x97)]&&await withSpinner(_0x139556(0xed),async()=>{await batchAsync(_0x491230,async _0x4a8c42=>{const _0x23acd9=a31_0x2fda,_0x4ed08a=await _0x732223[_0x23acd9(0x10f)]['listActivations'](_0x1b23d3,_0x4a8c42['id']);_0x1ebd83['set'](_0x4a8c42['id'],_0x4ed08a);});},{'verbose':_0x59f96b[_0x139556(0xfa)]});const {segmentFiles:_0x3b1573,foldersToCreate:_0x241874}=await prepareSegmentFiles(_0x3dd4c1,{'segmentByFolderAndName':_0x3f371a,'activationsBySegmentId':_0x1ebd83,'folderPathToId':_0x2f7bbf,'idToEmailMap':_0x4c0663,'connectionIdToNameMap':_0x13fed4},_0xdfca25,_0x159fbf,_0x41e991),_0xe5b2cf=_0x14ca00?[]:findSegmentsToDelete(_0x491230,_0x3dd4c1['map'](({yamlConfig:_0x31421d,folderPath:_0x4c6903})=>({'yamlConfig':_0x31421d,'folderPath':resolveTDFolderPath(_0x4c6903,_0x159fbf,_0x41e991)})),_0x1f4869,_0x41e991,_0x159fbf),{journeyFiles:_0xeb34eb,foldersToCreate:_0x3d4de0}=await withProgressSpinner(_0x139556(0xf1),async _0x161429=>prepareJourneyFiles(_0x1aa9a0,{'fetchJourney':async _0x592c82=>_0x732223[_0x139556(0xd8)][_0x139556(0xb5)](_0x592c82[_0x139556(0xb2)]),'journeyBundlesByFolderAndName':_0x13fd52,'folderPathToId':_0x2f7bbf,'idToEmailMap':_0x4c0663,'connectionIdToNameMap':_0x13fed4,'existingSegments':_0x491230,'parentId':_0x1b23d3,'deps':_0x732223,'progress':{'update':_0x3edccf=>{const _0x4eb1cd=_0x139556;_0x161429[_0x4eb1cd(0x9e)](_0x3edccf),_0x59f96b['verbose']&&console['error']('\x20\x20'+_0x3edccf);}},'journeyById':_0x4fdbc1,'activationStepsById':_0x417561},_0x159fbf,_0x41e991),{'verbose':_0x59f96b[_0x139556(0xfa)]})[_0x139556(0xc5)](_0x4645ab=>_0x4645ab['data']);for(const _0x1fcafe of _0x3d4de0){_0x241874[_0x139556(0x105)](_0x1fcafe);}const _0x3a7bff=_0x14ca00?[]:findJourneysToDelete(_0x3fc8e7,_0x1aa9a0[_0x139556(0x112)](({yamlConfig:_0x5e1c1c,folderPath:_0x3978d1})=>({'yamlConfig':_0x5e1c1c,'folderPath':resolveTDFolderPath(_0x3978d1,_0x159fbf,_0x41e991)})),_0x1f4869,_0x41e991,_0x159fbf),_0x2ee56a=calculatePushStats(_0x3b1573,_0xeb34eb,_0x241874,_0xe5b2cf,_0x3a7bff,!!_0x59f96b['delete'],!!_0x59f96b[_0x139556(0x97)]),_0x3d3358=_0x2ee56a[_0x139556(0xf0)][_0x139556(0xa1)],_0x28b814=_0x2ee56a['segments'][_0x139556(0x96)],_0x4253c6=_0x2ee56a[_0x139556(0xf0)][_0x139556(0xdd)],_0x4a3e88=_0x2ee56a[_0x139556(0xf0)]['toDelete'],_0x34dda6=_0x2ee56a[_0x139556(0x99)]['toCreate'],_0x1cc2c0=_0x2ee56a[_0x139556(0x9f)][_0x139556(0xa1)],_0x174b87=_0x2ee56a[_0x139556(0x9f)][_0x139556(0x96)],_0x5d07b1=_0x2ee56a[_0x139556(0x9f)][_0x139556(0xdd)],_0x1def59=_0x2ee56a[_0x139556(0x9f)][_0x139556(0x9b)],_0x41e7d9=_0x2ee56a['activations'][_0x139556(0xfd)],_0x1d47e4=_0x2ee56a[_0x139556(0xe3)][_0x139556(0x127)],_0x193103=_0x2ee56a[_0x139556(0xe3)][_0x139556(0xbb)],_0x4a342f=_0x2ee56a[_0x139556(0xe3)][_0x139556(0x9b)];console['error'](_0x139556(0xee)+_0x4cf08a+'\x27:');_0x34dda6['length']>0x0&&console['error']('\x20\x20'+a31_0x1c5e16[_0x139556(0xf2)]('📁\x20'+_0x34dda6[_0x139556(0xbe)]+_0x139556(0xb1)));if(!_0x59f96b[_0x139556(0x97)]){console[_0x139556(0xf9)](_0x139556(0xe1)),console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xea)]('+\x20'+_0x3d3358[_0x139556(0xbe)]+_0x139556(0xc0))),console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xff)]('~\x20'+_0x28b814[_0x139556(0xbe)]+_0x139556(0xb0)));if(_0x4a3e88[_0x139556(0xbe)]>0x0)console['error'](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xac)]('-\x20'+_0x4a3e88[_0x139556(0xbe)]+_0x139556(0xb8)));else _0xe5b2cf[_0x139556(0xbe)]>0x0&&!_0x59f96b['delete']&&console['error'](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xa8)](_0xe5b2cf['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xa8)]('=\x20'+_0x4253c6[_0x139556(0xbe)]+'\x20unchanged'));}if(_0xeb34eb['length']>0x0||_0x3a7bff[_0x139556(0xbe)]>0x0){console[_0x139556(0xf9)]('\x20\x20🗺️\x20\x20Journeys:'),console['error'](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xea)]('+\x20'+_0x1cc2c0[_0x139556(0xbe)]+_0x139556(0xc0))),console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xff)]('~\x20'+_0x174b87['length']+_0x139556(0xb0)));if(_0x1def59[_0x139556(0xbe)]>0x0)console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xac)]('-\x20'+_0x1def59['length']+_0x139556(0xb8)));else _0x3a7bff[_0x139556(0xbe)]>0x0&&!_0x59f96b[_0x139556(0x103)]&&console[_0x139556(0xf9)]('\x20\x20\x20\x20'+a31_0x1c5e16[_0x139556(0xa8)](_0x3a7bff['length']+_0x139556(0xd3)));console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xa8)]('=\x20'+_0x5d07b1[_0x139556(0xbe)]+'\x20unchanged'));}_0x41e7d9[_0x139556(0xbe)]>0x0&&!_0x59f96b[_0x139556(0x97)]&&(console[_0x139556(0xf9)](''),console[_0x139556(0xf9)](_0x139556(0x10c)),_0x1d47e4[_0x139556(0xbe)]>0x0&&console['error'](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xea)]('+\x20'+_0x1d47e4[_0x139556(0xbe)]+_0x139556(0x111))),_0x193103[_0x139556(0xbe)]>0x0&&console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16['yellow']('~\x20'+_0x193103[_0x139556(0xbe)]+'\x20to\x20update')),_0x4a342f['length']>0x0&&console[_0x139556(0xf9)](_0x139556(0xec)+a31_0x1c5e16[_0x139556(0xac)]('-\x20'+_0x4a342f[_0x139556(0xbe)]+_0x139556(0xb8))));console['error'](_0x139556(0xa5)+a31_0x1c5e16['cyan'](_0x4251c3)+'\x0a');if(_0x34dda6[_0x139556(0xbe)]>0x0){console[_0x139556(0xf9)]('Folders\x20to\x20create:');for(const _0x42d3ec of _0x34dda6){console['error']('\x20\x20'+a31_0x1c5e16['blue']('+')+'\x20'+_0x42d3ec);}console[_0x139556(0xf9)]('');}if(_0x3d3358['length']>0x0&&!_0x59f96b['journeysOnly'])for(const _0x5df3c1 of _0x3d3358){const _0x8c97b0=_0x5df3c1['folderPath']?_0x5df3c1[_0x139556(0x9c)]+'/'+_0x5df3c1['yamlConfig'][_0x139556(0x118)]:_0x5df3c1[_0x139556(0xeb)]['name'],_0x5dca0b=_0x5df3c1[_0x139556(0xeb)][_0x139556(0xe3)]?.[_0x139556(0xbe)]||0x0,_0x13ab11=_0x5dca0b>0x0?a31_0x1c5e16['dim']('\x20['+_0x5dca0b+_0x139556(0x102)):'';console[_0x139556(0xf9)]('\x0a'+a31_0x1c5e16[_0x139556(0xea)]('New\x20segment:')+'\x20'+_0x8c97b0+_0x13ab11),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c)),_0x5df3c1[_0x139556(0x10b)]&&console[_0x139556(0xf9)](_0x5df3c1[_0x139556(0x10b)]),console['error']('─'[_0x139556(0xc3)](0x3c));}if(_0x4a3e88[_0x139556(0xbe)]>0x0&&!_0x59f96b['journeysOnly'])for(const _0x49c777 of _0x4a3e88){const _0x44c523=_0x49c777[_0x139556(0xcd)]?_0x1f4869[_0x139556(0x11c)](_0x49c777[_0x139556(0xcd)]['toString']())||'':'',_0x290bbd=_0x44c523?_0x44c523+'/'+_0x49c777[_0x139556(0x118)]:_0x49c777[_0x139556(0x118)],_0x52ef45=_0x1ebd83[_0x139556(0x11c)](_0x49c777['id'])||[],_0x1fd931=_0x52ef45[_0x139556(0xbe)]>0x0?a31_0x1c5e16['dim']('\x20['+_0x52ef45[_0x139556(0xbe)]+_0x139556(0x102)):'';console[_0x139556(0xf9)]('\x0a'+a31_0x1c5e16['red']('Delete\x20segment:')+'\x20'+_0x290bbd+_0x1fd931),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c));const _0x1f1821=segmentWithActivationsToYaml(_0x49c777,_0x52ef45,undefined,_0x4c0663,_0x13fed4),_0x1ea062=segmentToYamlString(_0x1f1821),_0x205eea=generateDiff(_0x1ea062,'');console[_0x139556(0xf9)](formatDiffWithColors(_0x205eea)),console[_0x139556(0xf9)]('─'['repeat'](0x3c));}const _0x4f8d74=_0x3b1573[_0x139556(0xe7)](_0x42ad52=>!_0x42ad52[_0x139556(0xd7)]&&_0x42ad52['diff']);if(_0x4f8d74[_0x139556(0xbe)]>0x0&&!_0x59f96b[_0x139556(0x97)])for(const _0x2b2b94 of _0x4f8d74){const _0x546d4e=_0x2b2b94[_0x139556(0x9c)]?_0x2b2b94[_0x139556(0x9c)]+'/'+_0x2b2b94[_0x139556(0xeb)][_0x139556(0x118)]:_0x2b2b94[_0x139556(0xeb)]['name'];console['error']('\x0a'+a31_0x1c5e16['yellow'](_0x139556(0xfc))+'\x20'+_0x546d4e),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c)),console[_0x139556(0xf9)](_0x2b2b94['diff']),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c));}if(_0x1cc2c0['length']>0x0)for(const _0x41293c of _0x1cc2c0){const _0x4184cd=_0x41293c[_0x139556(0x9c)]?_0x41293c[_0x139556(0x9c)]+'/'+_0x41293c[_0x139556(0xeb)][_0x139556(0x118)]:_0x41293c[_0x139556(0xeb)][_0x139556(0x118)];console[_0x139556(0xf9)]('\x0a'+a31_0x1c5e16[_0x139556(0xea)](_0x139556(0xf5))+'\x20'+_0x4184cd),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c)),_0x41293c[_0x139556(0x10b)]&&console[_0x139556(0xf9)](_0x41293c[_0x139556(0x10b)]),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c));}const _0x41ca97=_0xeb34eb[_0x139556(0xe7)](_0x2789af=>!_0x2789af[_0x139556(0xd7)]&&_0x2789af['diff']);if(_0x41ca97[_0x139556(0xbe)]>0x0)for(const _0x68574a of _0x41ca97){const _0x205d20=_0x68574a[_0x139556(0x9c)]?_0x68574a[_0x139556(0x9c)]+'/'+_0x68574a[_0x139556(0xeb)][_0x139556(0x118)]:_0x68574a['yamlConfig']['name'];console['error']('\x0a'+a31_0x1c5e16[_0x139556(0xff)]('Changes\x20to\x20journey:')+'\x20'+_0x205d20),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c)),console['error'](_0x68574a[_0x139556(0x10b)]),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c));}if(_0x1def59[_0x139556(0xbe)]>0x0)for(const _0x256550 of _0x1def59){const _0x5261e5=_0x256550[_0x139556(0xaf)]?_0x1f4869[_0x139556(0x11c)](_0x256550['folderId'])||'':'',_0x5e9de2=_0x5261e5?_0x5261e5+'/'+_0x256550[_0x139556(0x101)]:_0x256550['journeyBundleName'];console[_0x139556(0xf9)]('\x0a'+a31_0x1c5e16[_0x139556(0xac)]('Delete\x20journey:')+'\x20'+_0x5e9de2),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c)),console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xac)](_0x139556(0xf7))),console[_0x139556(0xf9)]('─'[_0x139556(0xc3)](0x3c));}if(_0x59f96b['dryRun'])return console[_0x139556(0xf9)](a31_0x1c5e16['yellow'](_0x139556(0xf6))),0x0;const _0x31e6ff=_0x59f96b['journeysOnly']?![]:_0x3d3358[_0x139556(0xbe)]>0x0||_0x28b814['length']>0x0||_0x4a3e88['length']>0x0,_0x2ef7e2=_0x1cc2c0[_0x139556(0xbe)]>0x0||_0x174b87[_0x139556(0xbe)]>0x0||_0x1def59[_0x139556(0xbe)]>0x0,_0x13179b=_0x59f96b[_0x139556(0x97)]?![]:_0x41e7d9[_0x139556(0xbe)]>0x0,_0x53afcf=_0x34dda6[_0x139556(0xbe)]>0x0;if(!_0x31e6ff&&!_0x2ef7e2&&!_0x13179b&&!_0x53afcf){const _0x4ef57b=_0x59f96b[_0x139556(0x97)]?_0x139556(0x108):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xea)](_0x4ef57b));if(_0x14ca00&&_0x5d07b1['length']===0x1){const _0x4fdbff=_0x5d07b1[0x0];if(_0x4fdbff[_0x139556(0xbc)]?.['id']){const _0x15ea69=getConsoleNextUrl(_0x59f96b[_0x139556(0xcc)],_0x139556(0xe4)+_0x1b23d3+_0x139556(0x9d)+_0x4fdbff['existingJourney']['id']+'/j/da/je');console[_0x139556(0xf9)]('\x20\x20'+a31_0x1c5e16[_0x139556(0x91)](_0x15ea69));}}return 0x0;}const _0xc332de=_0x59f96b['journeysOnly']?_0x1cc2c0[_0x139556(0xbe)]+_0x174b87[_0x139556(0xbe)]+_0x1def59[_0x139556(0xbe)]+_0x34dda6[_0x139556(0xbe)]:_0x3d3358[_0x139556(0xbe)]+_0x28b814['length']+_0x4a3e88[_0x139556(0xbe)]+_0x1cc2c0['length']+_0x174b87[_0x139556(0xbe)]+_0x1def59['length']+_0x34dda6[_0x139556(0xbe)]+_0x41e7d9[_0x139556(0xbe)];if(!_0x59f96b['yes']&&_0xc332de>0x0){const _0x3ee435=await confirmKey('Push\x20'+_0xc332de+_0x139556(0xb9));if(!_0x3ee435)return console[_0x139556(0xf9)]('Aborted.'),0x1;}const _0x599d58={'withProgress':async(_0x1d906a,_0x50c6c2)=>{const _0xfa2f25=_0x139556,_0xab378f=await withSpinner(_0x1d906a,_0x50c6c2,{'verbose':_0x59f96b[_0xfa2f25(0xfa)]});return{'data':_0xab378f[_0xfa2f25(0xe2)]};},'logInfo':_0x23fee7=>console['error'](a31_0x1c5e16['blue']('✔\x20'+_0x23fee7)),'logSuccess':_0x595a77=>console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xea)]('✔\x20'+_0x595a77)),'logWarning':_0x5e323c=>console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xff)]('⚠\x20'+_0x5e323c)),'logDeleted':_0x10a741=>console['error'](a31_0x1c5e16[_0x139556(0xac)]('✔\x20'+_0x10a741))},_0x247cb2={'segment':_0x732223['segment'],'journey':_0x732223[_0x139556(0xd8)],'user':_0x732223[_0x139556(0x106)],'connection':_0x732223['connection']};_0x34dda6[_0x139556(0xbe)]>0x0&&(_0x2f7bbf=await executePushFolders(_0x247cb2,_0x34dda6,_0x2f7bbf,{'parentId':_0x1b23d3},_0x599d58));const _0x3b5ed5={'rootFolderId':_0x2e5158,'folderPathToId':_0x2f7bbf,'folderIdToPath':_0x1f4869,'segmentNameToId':_0x307250,'activationsBySegmentId':_0x1ebd83,'emailToIdMap':_0x2a9993,'idToEmailMap':_0x4c0663,'connectionNameToIdMap':_0x2ca8af[_0x139556(0x110)],'connectionIdToNameMap':_0x2ca8af[_0x139556(0xd5)],'connectionNameToTypeMap':_0xd10cd9},_0x182a55=await executePushSegments(_0x247cb2,_0x59f96b[_0x139556(0x97)]?[]:_0x3b1573,_0x3b5ed5,{'parentId':_0x1b23d3},_0x599d58),_0xdbf17c=_0x182a55['created'],_0x9cc00a=_0x182a55[_0x139556(0x123)],_0xe741d5=_0x182a55[_0x139556(0xe3)][_0x139556(0xca)],_0xbead09=_0x182a55[_0x139556(0xe3)]['updated'],_0xa84b23=_0x182a55['activations'][_0x139556(0x11e)],_0x5e44c8=await executePushSegmentDeletions(_0x247cb2,_0x59f96b['journeysOnly']?[]:_0x4a3e88,_0x599d58);let _0x1cdb65=0x0,_0x69cc79=0x0,_0xf78663=0x0;const _0x7acc64=new Map(_0x307250);for(const [_0x50346e,_0x30e835]of _0x182a55[_0x139556(0x114)]){_0x7acc64[_0x139556(0x125)](_0x50346e,_0x30e835);}if(_0xeb34eb['length']>0x0){const _0x4d98dd={..._0x3b5ed5,'segmentNameToId':_0x7acc64,'existingSegments':_0x491230,'activationContext':_0xdfca25},_0x21a444=await executePushJourneys(_0x247cb2,_0xeb34eb,_0x4d98dd,{'parentId':_0x1b23d3,'rootFolderId':_0x2e5158,'verbose':_0x59f96b[_0x139556(0xfa)]},_0x599d58);_0x1cdb65=_0x21a444[_0x139556(0xca)],_0x69cc79=_0x21a444['updated'];if(_0x14ca00&&_0x21a444['results']['length']===0x1){const _0x35c972=_0x21a444[_0x139556(0x124)][0x0];if(_0x35c972[_0x139556(0xb2)]){const _0x6e8b7e=getConsoleNextUrl(_0x59f96b[_0x139556(0xcc)],_0x139556(0xe4)+_0x1b23d3+_0x139556(0x9d)+_0x35c972[_0x139556(0xb2)]+_0x139556(0x10a));console[_0x139556(0xf9)]('\x20\x20'+a31_0x1c5e16[_0x139556(0x91)](_0x6e8b7e));}}}for(const _0x4b9654 of _0x1def59){console['error'](a31_0x1c5e16['yellow'](_0x139556(0xa6)+_0x4b9654[_0x139556(0x101)])),_0xf78663++;}const _0x3df5f1=[];if(_0xdbf17c>0x0)_0x3df5f1[_0x139556(0xcb)](_0xdbf17c+'\x20created');if(_0x9cc00a>0x0)_0x3df5f1[_0x139556(0xcb)](_0x9cc00a+'\x20updated');if(_0x5e44c8>0x0)_0x3df5f1['push'](_0x5e44c8+_0x139556(0x104));const _0x597965=[];if(_0x1cdb65>0x0)_0x597965['push'](_0x1cdb65+'\x20created');if(_0x69cc79>0x0)_0x597965[_0x139556(0xcb)](_0x69cc79+'\x20updated');if(_0xf78663>0x0)_0x597965['push'](_0xf78663+'\x20deleted');const _0x4f03e7=[];if(_0xe741d5>0x0)_0x4f03e7[_0x139556(0xcb)](_0xe741d5+_0x139556(0xdf));if(_0xbead09>0x0)_0x4f03e7[_0x139556(0xcb)](_0xbead09+_0x139556(0x117));if(_0xa84b23>0x0)_0x4f03e7[_0x139556(0xcb)](_0xa84b23+_0x139556(0x104));return console[_0x139556(0xf9)](a31_0x1c5e16[_0x139556(0xea)](_0x139556(0x119))),_0x3df5f1[_0x139556(0xbe)]>0x0&&!_0x59f96b[_0x139556(0x97)]&&console['error'](_0x139556(0x121)+_0x3df5f1['join'](',\x20')),_0x597965['length']>0x0&&console[_0x139556(0xf9)](_0x139556(0x115)+_0x597965[_0x139556(0x11d)](',\x20')),_0x4f03e7[_0x139556(0xbe)]>0x0&&!_0x59f96b[_0x139556(0x97)]&&console[_0x139556(0xf9)](_0x139556(0xf3)+_0x4f03e7[_0x139556(0x11d)](',\x20')),0x0;}}
1
+ const a31_0x5ee0bc=a31_0x44e8;(function(_0x2e90b7,_0x856997){const _0x5a7ce4=a31_0x44e8,_0x46fbd7=_0x2e90b7();while(!![]){try{const _0x560c55=-parseInt(_0x5a7ce4(0x19f))/0x1*(parseInt(_0x5a7ce4(0x14a))/0x2)+parseInt(_0x5a7ce4(0x139))/0x3+-parseInt(_0x5a7ce4(0x151))/0x4+parseInt(_0x5a7ce4(0x119))/0x5*(parseInt(_0x5a7ce4(0x11a))/0x6)+-parseInt(_0x5a7ce4(0x160))/0x7+parseInt(_0x5a7ce4(0x113))/0x8+-parseInt(_0x5a7ce4(0x196))/0x9;if(_0x560c55===_0x856997)break;else _0x46fbd7['push'](_0x46fbd7['shift']());}catch(_0x1b8acf){_0x46fbd7['push'](_0x46fbd7['shift']());}}}(a31_0xbd6d,0x88485));function a31_0x44e8(_0x30308f,_0x35f2e4){_0x30308f=_0x30308f-0x104;const _0xbd6d42=a31_0xbd6d();let _0x44e881=_0xbd6d42[_0x30308f];return _0x44e881;}import{BaseCommand}from'./command.js';function a31_0xbd6d(){const _0x38f556=['relationships','add','/app/ps/','errorCode','file','verbose','state','Fetching\x20existing\x20activations...','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)','map','message','toUpdate','segments','\x20\x20Source:\x20','activations','\x0aPush\x20summary\x20for\x20\x27','push','changed','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','endsWith','isNew','site','red','2119056ItrZRJ','buildUserMaps','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','get','connection','journeyBundleId','listActivations','then','.yaml','updated','(Journey\x20will\x20be\x20deleted)','getJourney','cwd','yes','all','\x0a✔\x20Push\x20complete','set','7828tkHigG','.yml','Fetching\x20parent\x20segment\x20details...','Error:\x20Directory\x20not\x20found:\x20','no_parent','diff','createdSegmentIds','3215368yrarDF','Source\x20directory:\x20','createdAt','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20activations]','\x20updated','listFolders','getOutputSchemaWithCache','journeys','repeat','isScoped','toDelete','Push\x20','attributes','\x20\x20\x20\x20','1586963bmcQEG','length','segment','delete','\x20to\x20create','targetDir','\x20changed','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','updatedAt','new','scopedFolderPath','name','\x20YAML\x20files\x20found','\x20deleted','Fetching\x20existing\x20journeys...','cyan','yamlConfig','journey','green','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20to\x20update','\x20\x20🗺️\x20\x20Journeys:','journeyBundleName','/e/','resolveParentId','parentName','nameToId','helpText','Changes\x20to:','New\x20journey:','filePath','\x20folders\x20to\x20create','Changes\x20to\x20journey:','type','data','folderId','filter','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','deleted','segmentFolderId','dryRun','description','idToName','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20unchanged','unchanged','blue','audienceId','setPhase','\x20changes?','3041613sWRTUG','error','\x20new','New\x20segment:','getParent','list','toString','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','📁\x20','66xohtAf','dim','results','parentFolder','yellow','parent_name','\x20\x20Segments:\x20','folderPath','created','parentSegment','listSegments','Fetching\x20connections\x20for\x20name\x20resolution...','journeyId','\x20created','user','journeysOnly','3821456afyqlP','toCreate','join','\x20to\x20delete','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','No\x20','265RZDmrR','113322ZPXFhi','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Folders\x20to\x20create:','\x20\x20Activations:','existingJourney','Aborted.','/j/da/je','\x0aValidation\x20failed:'];a31_0xbd6d=function(){return _0x38f556;};return a31_0xbd6d();}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x373ca4 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a31_0x5ee0bc(0x16e)]='segment:push';[a31_0x5ee0bc(0x18d)]=a31_0x5ee0bc(0x154);async['execute'](_0x2230d9){const _0x22bf78=a31_0x5ee0bc,{options:_0x32036b,args:_0x57b215,tdx:_0x280edf}=_0x2230d9,_0x517492=_0x32036b,_0x471e76=await resolveTarget({'arg':_0x57b215[0x0],'contextParent':_0x32036b[_0x22bf78(0x10c)],'cwd':process[_0x22bf78(0x145)]()});if(!isSuccessfulResolution(_0x471e76))return _0x471e76[_0x22bf78(0x125)]===_0x22bf78(0x14e)?(console['error'](a31_0x373ca4[_0x22bf78(0x107)](_0x22bf78(0x134))),console[_0x22bf78(0x197)](_0x22bf78(0x12a)),console['error'](_0x22bf78(0x177)),console[_0x22bf78(0x197)](_0x22bf78(0x19d))):(console[_0x22bf78(0x197)](a31_0x373ca4['red']('Error:\x20'+_0x471e76[_0x22bf78(0x12c)]+'\x0a')),_0x471e76['helpText']&&console['error'](a31_0x373ca4['cyan'](_0x471e76[_0x22bf78(0x17f)]))),0x1;if(_0x471e76[_0x22bf78(0x185)]===_0x22bf78(0x108))return console['error'](a31_0x373ca4['red'](_0x22bf78(0x14d)+_0x471e76[_0x22bf78(0x165)]+'\x0a')),console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x172)](_0x22bf78(0x169))),0x1;const _0x29ea07=_0x471e76[_0x22bf78(0x17d)],_0xfcab42=_0x471e76[_0x22bf78(0x165)],_0x590ed7=_0x471e76[_0x22bf78(0x185)]===_0x22bf78(0x126)?_0x471e76[_0x22bf78(0x182)]:undefined,_0x1d6b64=getScopedDetails(_0x471e76),_0x3d9057=_0x1d6b64?.[_0x22bf78(0x15b)]??![],_0x5d8bac=_0x1d6b64?.[_0x22bf78(0x16d)]??'';if(!existsSync(_0xfcab42))return console['error'](a31_0x373ca4['red'](_0x22bf78(0x14d)+_0xfcab42+'\x0a')),console[_0x22bf78(0x197)](a31_0x373ca4['cyan'](_0x22bf78(0x169))),0x1;_0x517492['verbose']&&(console['error']('Site:\x20'+_0x517492[_0x22bf78(0x137)]),console[_0x22bf78(0x197)]('Parent\x20segment:\x20'+_0x29ea07),console[_0x22bf78(0x197)](_0x22bf78(0x152)+_0xfcab42),_0x3d9057&&console[_0x22bf78(0x197)]('Scoped\x20to\x20folder:\x20'+_0x5d8bac));const _0x378945=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x29ea07+'\x27...',()=>_0x280edf[_0x22bf78(0x162)][_0x22bf78(0x17c)](_0x29ea07),{'verbose':_0x517492[_0x22bf78(0x127)]}),_0x1be089=_0x378945[_0x22bf78(0x186)],[_0x5e532e,_0x246f79,_0x1e6f16,_0x4853f2,_0x17ca47]=await Promise[_0x22bf78(0x147)]([withSpinner(_0x22bf78(0x14c),()=>_0x280edf[_0x22bf78(0x162)][_0x22bf78(0x19a)](_0x1be089),{'verbose':_0x517492['verbose']}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x280edf[_0x22bf78(0x162)][_0x22bf78(0x10d)](_0x1be089),{'verbose':_0x517492[_0x22bf78(0x127)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x280edf['segment'][_0x22bf78(0x157)](_0x1be089),{'verbose':_0x517492[_0x22bf78(0x127)]}),withSpinner(_0x22bf78(0x171),()=>_0x280edf[_0x22bf78(0x174)]['listJourneysWithDetailsFromParentSegment'](_0x1be089,{'includeAllVersions':!![]}),{'verbose':_0x517492['verbose']}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x280edf[_0x22bf78(0x111)][_0x22bf78(0x13a)](),{'verbose':_0x517492['verbose']})[_0x22bf78(0x140)](_0x48b45e=>_0x48b45e[_0x22bf78(0x186)])]),_0x2bff3b=_0x5e532e[_0x22bf78(0x186)],_0x42d128=extractRootFolderId(_0x2bff3b),_0x3b22d9=_0x246f79[_0x22bf78(0x186)],_0x496dfd=_0x1e6f16[_0x22bf78(0x186)],{journeys:_0x240785,activationStepsById:_0x23179f}=_0x4853f2[_0x22bf78(0x186)],_0x3fbc3c=new Map(_0x240785[_0x22bf78(0x12b)](_0x34aa60=>[_0x34aa60['id'],_0x34aa60])),_0x2fcee6=_0x240785[_0x22bf78(0x12b)](_0x1ca18a=>({'id':_0x1ca18a['id'],'name':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x16e)],'journeyBundleName':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x17a)]||'','journeyBundleId':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x13e)]||'','versionNumber':_0x1ca18a[_0x22bf78(0x15e)]['versionNumber'],'description':_0x1ca18a[_0x22bf78(0x15e)]['description'],'state':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x128)],'paused':_0x1ca18a[_0x22bf78(0x15e)]['paused'],'audienceId':_0x1ca18a['attributes'][_0x22bf78(0x193)],'folderId':_0x1ca18a[_0x22bf78(0x122)]?.[_0x22bf78(0x106)]?.[_0x22bf78(0x186)]?.['id'],'createdAt':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x153)],'updatedAt':_0x1ca18a[_0x22bf78(0x15e)][_0x22bf78(0x16b)]})),{emailToId:_0x52f814,idToEmail:_0x362f17}=_0x17ca47,_0x89774c=await withSpinner(_0x22bf78(0x10e),async()=>{const _0xc0d07d=_0x22bf78,_0x105fee=await _0x280edf[_0xc0d07d(0x13d)][_0xc0d07d(0x19b)]();return buildConnectionMaps(_0x105fee);},{'verbose':_0x517492[_0x22bf78(0x127)]})['then'](_0x33fe21=>_0x33fe21['data']),_0x3a0280=_0x89774c[_0x22bf78(0x17e)],_0x449143=_0x89774c['idToName'],_0xf92b8d=_0x89774c['nameToType'],_0x1d194c={'emailToIdMap':_0x52f814,'connectionNameToIdMap':_0x3a0280,'connectionNameToTypeMap':_0xf92b8d,'getSchema':_0x576bd6=>_0x280edf[_0x22bf78(0x13d)][_0x22bf78(0x158)](_0x576bd6)};let {pathToId:_0x3883e6,idToPath:_0x26af44}=buildFolderMaps(_0x496dfd);const _0x20f7c0=buildSegmentLookupMap(_0x3b22d9,_0x26af44),_0x518ed1=buildSegmentNameToIdMap(_0x3b22d9),_0x5071bd=buildJourneyBundleLookupMap(_0x2fcee6,_0x26af44);let _0x2b0be7;if(_0x590ed7){if(!_0x590ed7[_0x22bf78(0x135)](_0x22bf78(0x14b))&&!_0x590ed7[_0x22bf78(0x135)](_0x22bf78(0x141)))return console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x138)](_0x22bf78(0x18f)+_0x590ed7+'\x0a')),0x1;_0x2b0be7=[_0x590ed7];}else _0x2b0be7=findYamlFiles(_0xfcab42);if(_0x2b0be7[_0x22bf78(0x161)]===0x0)return console[_0x22bf78(0x197)](a31_0x373ca4['red'](_0x22bf78(0x13b)+_0xfcab42+'\x0a')),console['error'](a31_0x373ca4['cyan'](_0x22bf78(0x16a))),0x1;let _0x3e52e0,_0x2dafc3;try{const _0x2fced8=parseAndClassifyYamlFiles(_0x2b0be7,_0xfcab42,{'skipSegments':_0x517492[_0x22bf78(0x112)]});_0x3e52e0=_0x2fced8['segments'],_0x2dafc3=_0x2fced8[_0x22bf78(0x159)];const _0xebbebb=validateParsedFiles(_0x2fced8,_0xfcab42);if(_0xebbebb['length']>0x0)return console[_0x22bf78(0x197)](a31_0x373ca4['red'](_0x22bf78(0x121))),console[_0x22bf78(0x197)](formatValidationErrors(_0xebbebb)),console[_0x22bf78(0x197)](a31_0x373ca4['yellow'](_0x22bf78(0x167))),0x1;}catch(_0x492745){return console['error'](a31_0x373ca4[_0x22bf78(0x138)]('Error\x20parsing\x20YAML:\x20'+(_0x492745 instanceof Error?_0x492745[_0x22bf78(0x12c)]:_0x492745))),0x1;}if(_0x3e52e0['length']===0x0&&_0x2dafc3[_0x22bf78(0x161)]===0x0){const _0x11efc3=_0x517492[_0x22bf78(0x112)]?_0x22bf78(0x174):'segment\x20or\x20journey';return console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x107)](_0x22bf78(0x118)+_0x11efc3+_0x22bf78(0x16f))),0x0;}const _0x31aabf=new Map();_0x3b22d9[_0x22bf78(0x161)]>0x0&&!_0x517492[_0x22bf78(0x112)]&&await withSpinner(_0x22bf78(0x129),async()=>{await batchAsync(_0x3b22d9,async _0x39ac9d=>{const _0x45f7e2=a31_0x44e8,_0x890a2=await _0x280edf[_0x45f7e2(0x162)][_0x45f7e2(0x13f)](_0x1be089,_0x39ac9d['id']);_0x31aabf[_0x45f7e2(0x149)](_0x39ac9d['id'],_0x890a2);});},{'verbose':_0x517492[_0x22bf78(0x127)]});const {segmentFiles:_0x420a70,foldersToCreate:_0x3dcf63}=await prepareSegmentFiles(_0x3e52e0,{'segmentByFolderAndName':_0x20f7c0,'activationsBySegmentId':_0x31aabf,'folderPathToId':_0x3883e6,'idToEmailMap':_0x362f17,'connectionIdToNameMap':_0x449143},_0x1d194c,_0x3d9057,_0x5d8bac),_0x561d59=_0x590ed7?[]:findSegmentsToDelete(_0x3b22d9,_0x3e52e0[_0x22bf78(0x12b)](({yamlConfig:_0x461ee0,folderPath:_0x5abc54})=>({'yamlConfig':_0x461ee0,'folderPath':resolveTDFolderPath(_0x5abc54,_0x3d9057,_0x5d8bac)})),_0x26af44,_0x5d8bac,_0x3d9057),{journeyFiles:_0x68c325,foldersToCreate:_0x5b36d8}=await withProgressSpinner('Preparing\x20journeys...',async _0x8cbdcd=>prepareJourneyFiles(_0x2dafc3,{'fetchJourney':async _0x472cb0=>_0x280edf['journey'][_0x22bf78(0x144)](_0x472cb0[_0x22bf78(0x10f)]),'journeyBundlesByFolderAndName':_0x5071bd,'folderPathToId':_0x3883e6,'idToEmailMap':_0x362f17,'connectionIdToNameMap':_0x449143,'existingSegments':_0x3b22d9,'parentId':_0x1be089,'deps':_0x280edf,'progress':{'update':_0x2ed902=>{const _0xd0afb4=_0x22bf78;_0x8cbdcd[_0xd0afb4(0x194)](_0x2ed902),_0x517492[_0xd0afb4(0x127)]&&console[_0xd0afb4(0x197)]('\x20\x20'+_0x2ed902);}},'journeyById':_0x3fbc3c,'activationStepsById':_0x23179f},_0x3d9057,_0x5d8bac),{'verbose':_0x517492[_0x22bf78(0x127)]})[_0x22bf78(0x140)](_0x1201c4=>_0x1201c4[_0x22bf78(0x186)]);for(const _0x273629 of _0x5b36d8){_0x3dcf63[_0x22bf78(0x123)](_0x273629);}const _0x490fb4=_0x590ed7?[]:findJourneysToDelete(_0x2fcee6,_0x2dafc3[_0x22bf78(0x12b)](({yamlConfig:_0x3aa248,folderPath:_0x401694})=>({'yamlConfig':_0x3aa248,'folderPath':resolveTDFolderPath(_0x401694,_0x3d9057,_0x5d8bac)})),_0x26af44,_0x5d8bac,_0x3d9057),_0x5d44ea=calculatePushStats(_0x420a70,_0x68c325,_0x3dcf63,_0x561d59,_0x490fb4,!!_0x517492[_0x22bf78(0x163)],!!_0x517492[_0x22bf78(0x112)]),_0x49e9aa=_0x5d44ea[_0x22bf78(0x12e)][_0x22bf78(0x16c)],_0x574c76=_0x5d44ea[_0x22bf78(0x12e)][_0x22bf78(0x133)],_0x9784da=_0x5d44ea[_0x22bf78(0x12e)][_0x22bf78(0x191)],_0x7701e5=_0x5d44ea[_0x22bf78(0x12e)][_0x22bf78(0x15c)],_0x49ba7b=_0x5d44ea['folders'][_0x22bf78(0x114)],_0x872ff1=_0x5d44ea[_0x22bf78(0x159)][_0x22bf78(0x16c)],_0x57661a=_0x5d44ea[_0x22bf78(0x159)][_0x22bf78(0x133)],_0x2ea0c3=_0x5d44ea[_0x22bf78(0x159)][_0x22bf78(0x191)],_0x51d55c=_0x5d44ea[_0x22bf78(0x159)][_0x22bf78(0x15c)],_0x415d57=_0x5d44ea[_0x22bf78(0x130)][_0x22bf78(0x147)],_0x40e9dd=_0x5d44ea[_0x22bf78(0x130)][_0x22bf78(0x114)],_0x588046=_0x5d44ea['activations'][_0x22bf78(0x12d)],_0xf884ec=_0x5d44ea['activations']['toDelete'];console['error'](_0x22bf78(0x131)+_0x29ea07+'\x27:');_0x49ba7b['length']>0x0&&console[_0x22bf78(0x197)]('\x20\x20'+a31_0x373ca4[_0x22bf78(0x192)](_0x22bf78(0x19e)+_0x49ba7b[_0x22bf78(0x161)]+_0x22bf78(0x183)));if(!_0x517492[_0x22bf78(0x112)]){console[_0x22bf78(0x197)]('\x20\x20📊\x20Segments:'),console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x175)]('+\x20'+_0x49e9aa[_0x22bf78(0x161)]+_0x22bf78(0x198))),console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x107)]('~\x20'+_0x574c76['length']+_0x22bf78(0x166)));if(_0x7701e5[_0x22bf78(0x161)]>0x0)console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x138)]('-\x20'+_0x7701e5[_0x22bf78(0x161)]+_0x22bf78(0x116)));else _0x561d59[_0x22bf78(0x161)]>0x0&&!_0x517492['delete']&&console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x104)](_0x561d59[_0x22bf78(0x161)]+_0x22bf78(0x176)));console[_0x22bf78(0x197)]('\x20\x20\x20\x20'+a31_0x373ca4[_0x22bf78(0x104)]('=\x20'+_0x9784da['length']+_0x22bf78(0x190)));}if(_0x68c325[_0x22bf78(0x161)]>0x0||_0x490fb4[_0x22bf78(0x161)]>0x0){console[_0x22bf78(0x197)](_0x22bf78(0x179)),console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x175)]('+\x20'+_0x872ff1['length']+'\x20new')),console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x107)]('~\x20'+_0x57661a[_0x22bf78(0x161)]+_0x22bf78(0x166)));if(_0x51d55c[_0x22bf78(0x161)]>0x0)console['error'](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x138)]('-\x20'+_0x51d55c[_0x22bf78(0x161)]+_0x22bf78(0x116)));else _0x490fb4[_0x22bf78(0x161)]>0x0&&!_0x517492[_0x22bf78(0x163)]&&console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4['dim'](_0x490fb4[_0x22bf78(0x161)]+_0x22bf78(0x176)));console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4['dim']('=\x20'+_0x2ea0c3['length']+_0x22bf78(0x190)));}_0x415d57['length']>0x0&&!_0x517492[_0x22bf78(0x112)]&&(console[_0x22bf78(0x197)](''),console['error'](_0x22bf78(0x11d)),_0x40e9dd[_0x22bf78(0x161)]>0x0&&console[_0x22bf78(0x197)]('\x20\x20\x20\x20'+a31_0x373ca4[_0x22bf78(0x175)]('+\x20'+_0x40e9dd['length']+_0x22bf78(0x164))),_0x588046['length']>0x0&&console[_0x22bf78(0x197)]('\x20\x20\x20\x20'+a31_0x373ca4['yellow']('~\x20'+_0x588046[_0x22bf78(0x161)]+_0x22bf78(0x178))),_0xf884ec[_0x22bf78(0x161)]>0x0&&console[_0x22bf78(0x197)](_0x22bf78(0x15f)+a31_0x373ca4[_0x22bf78(0x138)]('-\x20'+_0xf884ec[_0x22bf78(0x161)]+_0x22bf78(0x116))));console[_0x22bf78(0x197)](_0x22bf78(0x12f)+a31_0x373ca4['cyan'](_0xfcab42)+'\x0a');if(_0x49ba7b['length']>0x0){console[_0x22bf78(0x197)](_0x22bf78(0x11c));for(const _0x41040f of _0x49ba7b){console[_0x22bf78(0x197)]('\x20\x20'+a31_0x373ca4[_0x22bf78(0x192)]('+')+'\x20'+_0x41040f);}console[_0x22bf78(0x197)]('');}if(_0x49e9aa['length']>0x0&&!_0x517492[_0x22bf78(0x112)])for(const _0x5e849c of _0x49e9aa){const _0x110114=_0x5e849c[_0x22bf78(0x10a)]?_0x5e849c[_0x22bf78(0x10a)]+'/'+_0x5e849c[_0x22bf78(0x173)][_0x22bf78(0x16e)]:_0x5e849c['yamlConfig'][_0x22bf78(0x16e)],_0x29205f=_0x5e849c[_0x22bf78(0x173)]['activations']?.[_0x22bf78(0x161)]||0x0,_0x3531ce=_0x29205f>0x0?a31_0x373ca4[_0x22bf78(0x104)]('\x20['+_0x29205f+'\x20activations]'):'';console['error']('\x0a'+a31_0x373ca4[_0x22bf78(0x175)](_0x22bf78(0x199))+'\x20'+_0x110114+_0x3531ce),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c)),_0x5e849c[_0x22bf78(0x14f)]&&console['error'](_0x5e849c[_0x22bf78(0x14f)]),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c));}if(_0x7701e5[_0x22bf78(0x161)]>0x0&&!_0x517492[_0x22bf78(0x112)])for(const _0x5283c8 of _0x7701e5){const _0x480800=_0x5283c8[_0x22bf78(0x18b)]?_0x26af44['get'](_0x5283c8[_0x22bf78(0x18b)][_0x22bf78(0x19c)]())||'':'',_0x47635d=_0x480800?_0x480800+'/'+_0x5283c8[_0x22bf78(0x16e)]:_0x5283c8[_0x22bf78(0x16e)],_0x1d51ab=_0x31aabf[_0x22bf78(0x13c)](_0x5283c8['id'])||[],_0x109e2d=_0x1d51ab['length']>0x0?a31_0x373ca4[_0x22bf78(0x104)]('\x20['+_0x1d51ab['length']+_0x22bf78(0x155)):'';console['error']('\x0a'+a31_0x373ca4[_0x22bf78(0x138)]('Delete\x20segment:')+'\x20'+_0x47635d+_0x109e2d),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c));const _0x49ab65=segmentWithActivationsToYaml(_0x5283c8,_0x1d51ab,undefined,_0x362f17,_0x449143),_0x431d7f=segmentToYamlString(_0x49ab65),_0x1425aa=generateDiff(_0x431d7f,'');console[_0x22bf78(0x197)](formatDiffWithColors(_0x1425aa)),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c));}const _0x164eba=_0x420a70[_0x22bf78(0x188)](_0x38674e=>!_0x38674e[_0x22bf78(0x136)]&&_0x38674e['diff']);if(_0x164eba['length']>0x0&&!_0x517492['journeysOnly'])for(const _0x3db53a of _0x164eba){const _0x16eff3=_0x3db53a[_0x22bf78(0x10a)]?_0x3db53a['folderPath']+'/'+_0x3db53a[_0x22bf78(0x173)][_0x22bf78(0x16e)]:_0x3db53a[_0x22bf78(0x173)][_0x22bf78(0x16e)];console[_0x22bf78(0x197)]('\x0a'+a31_0x373ca4[_0x22bf78(0x107)](_0x22bf78(0x180))+'\x20'+_0x16eff3),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c)),console[_0x22bf78(0x197)](_0x3db53a[_0x22bf78(0x14f)]),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c));}if(_0x872ff1[_0x22bf78(0x161)]>0x0)for(const _0x49205f of _0x872ff1){const _0x9be2e8=_0x49205f[_0x22bf78(0x10a)]?_0x49205f['folderPath']+'/'+_0x49205f[_0x22bf78(0x173)]['name']:_0x49205f[_0x22bf78(0x173)][_0x22bf78(0x16e)];console['error']('\x0a'+a31_0x373ca4['green'](_0x22bf78(0x181))+'\x20'+_0x9be2e8),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c)),_0x49205f[_0x22bf78(0x14f)]&&console[_0x22bf78(0x197)](_0x49205f[_0x22bf78(0x14f)]),console[_0x22bf78(0x197)]('─'['repeat'](0x3c));}const _0x202d8d=_0x68c325[_0x22bf78(0x188)](_0x4250ac=>!_0x4250ac[_0x22bf78(0x136)]&&_0x4250ac[_0x22bf78(0x14f)]);if(_0x202d8d[_0x22bf78(0x161)]>0x0)for(const _0x47941a of _0x202d8d){const _0xc4dc53=_0x47941a['folderPath']?_0x47941a[_0x22bf78(0x10a)]+'/'+_0x47941a['yamlConfig']['name']:_0x47941a[_0x22bf78(0x173)][_0x22bf78(0x16e)];console['error']('\x0a'+a31_0x373ca4[_0x22bf78(0x107)](_0x22bf78(0x184))+'\x20'+_0xc4dc53),console[_0x22bf78(0x197)]('─'['repeat'](0x3c)),console[_0x22bf78(0x197)](_0x47941a['diff']),console['error']('─'['repeat'](0x3c));}if(_0x51d55c[_0x22bf78(0x161)]>0x0)for(const _0x1a553f of _0x51d55c){const _0x54ddd4=_0x1a553f[_0x22bf78(0x187)]?_0x26af44[_0x22bf78(0x13c)](_0x1a553f[_0x22bf78(0x187)])||'':'',_0x5b4151=_0x54ddd4?_0x54ddd4+'/'+_0x1a553f[_0x22bf78(0x17a)]:_0x1a553f[_0x22bf78(0x17a)];console[_0x22bf78(0x197)]('\x0a'+a31_0x373ca4[_0x22bf78(0x138)]('Delete\x20journey:')+'\x20'+_0x5b4151),console[_0x22bf78(0x197)]('─'[_0x22bf78(0x15a)](0x3c)),console[_0x22bf78(0x197)](a31_0x373ca4['red'](_0x22bf78(0x143))),console['error']('─'[_0x22bf78(0x15a)](0x3c));}if(_0x517492[_0x22bf78(0x18c)])return console[_0x22bf78(0x197)](a31_0x373ca4['yellow'](_0x22bf78(0x11b))),0x0;const _0x1f91ae=_0x517492[_0x22bf78(0x112)]?![]:_0x49e9aa[_0x22bf78(0x161)]>0x0||_0x574c76[_0x22bf78(0x161)]>0x0||_0x7701e5['length']>0x0,_0x2f81ce=_0x872ff1[_0x22bf78(0x161)]>0x0||_0x57661a[_0x22bf78(0x161)]>0x0||_0x51d55c[_0x22bf78(0x161)]>0x0,_0x6c3fd5=_0x517492[_0x22bf78(0x112)]?![]:_0x415d57['length']>0x0,_0x363b88=_0x49ba7b[_0x22bf78(0x161)]>0x0;if(!_0x1f91ae&&!_0x2f81ce&&!_0x6c3fd5&&!_0x363b88){const _0x81682d=_0x517492[_0x22bf78(0x112)]?_0x22bf78(0x117):_0x22bf78(0x189);console['error'](a31_0x373ca4[_0x22bf78(0x175)](_0x81682d));if(_0x590ed7&&_0x2ea0c3[_0x22bf78(0x161)]===0x1){const _0x1af21e=_0x2ea0c3[0x0];if(_0x1af21e['existingJourney']?.['id']){const _0x5591f4=getConsoleNextUrl(_0x517492[_0x22bf78(0x137)],_0x22bf78(0x124)+_0x1be089+_0x22bf78(0x17b)+_0x1af21e[_0x22bf78(0x11e)]['id']+_0x22bf78(0x120));console[_0x22bf78(0x197)]('\x20\x20'+a31_0x373ca4['cyan'](_0x5591f4));}}return 0x0;}const _0x1ea475=_0x517492[_0x22bf78(0x112)]?_0x872ff1[_0x22bf78(0x161)]+_0x57661a[_0x22bf78(0x161)]+_0x51d55c[_0x22bf78(0x161)]+_0x49ba7b[_0x22bf78(0x161)]:_0x49e9aa[_0x22bf78(0x161)]+_0x574c76['length']+_0x7701e5[_0x22bf78(0x161)]+_0x872ff1[_0x22bf78(0x161)]+_0x57661a[_0x22bf78(0x161)]+_0x51d55c['length']+_0x49ba7b['length']+_0x415d57[_0x22bf78(0x161)];if(!_0x517492[_0x22bf78(0x146)]&&_0x1ea475>0x0){const _0x554a96=await confirmKey(_0x22bf78(0x15d)+_0x1ea475+_0x22bf78(0x195));if(!_0x554a96)return console[_0x22bf78(0x197)](_0x22bf78(0x11f)),0x1;}const _0x4387bb={'withProgress':async(_0x36a84e,_0x447e88)=>{const _0x386e25=_0x22bf78,_0x47b212=await withSpinner(_0x36a84e,_0x447e88,{'verbose':_0x517492[_0x386e25(0x127)]});return{'data':_0x47b212[_0x386e25(0x186)]};},'logInfo':_0x4e3247=>console[_0x22bf78(0x197)](a31_0x373ca4['blue']('✔\x20'+_0x4e3247)),'logSuccess':_0x23397c=>console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x175)]('✔\x20'+_0x23397c)),'logWarning':_0x1226f5=>console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x107)]('⚠\x20'+_0x1226f5)),'logDeleted':_0x3dabdb=>console['error'](a31_0x373ca4['red']('✔\x20'+_0x3dabdb))},_0x41366f={'segment':_0x280edf['segment'],'journey':_0x280edf[_0x22bf78(0x174)],'user':_0x280edf[_0x22bf78(0x111)],'connection':_0x280edf['connection']};_0x49ba7b[_0x22bf78(0x161)]>0x0&&(_0x3883e6=await executePushFolders(_0x41366f,_0x49ba7b,_0x3883e6,{'parentId':_0x1be089},_0x4387bb));const _0x5e78b1={'rootFolderId':_0x42d128,'folderPathToId':_0x3883e6,'folderIdToPath':_0x26af44,'segmentNameToId':_0x518ed1,'activationsBySegmentId':_0x31aabf,'emailToIdMap':_0x52f814,'idToEmailMap':_0x362f17,'connectionNameToIdMap':_0x89774c[_0x22bf78(0x17e)],'connectionIdToNameMap':_0x89774c[_0x22bf78(0x18e)],'connectionNameToTypeMap':_0xf92b8d},_0x23ee5c=await executePushSegments(_0x41366f,_0x517492[_0x22bf78(0x112)]?[]:_0x420a70,_0x5e78b1,{'parentId':_0x1be089},_0x4387bb),_0x113175=_0x23ee5c[_0x22bf78(0x10b)],_0x334a0e=_0x23ee5c[_0x22bf78(0x142)],_0x2147f4=_0x23ee5c['activations']['created'],_0x2863ed=_0x23ee5c[_0x22bf78(0x130)][_0x22bf78(0x142)],_0x338974=_0x23ee5c[_0x22bf78(0x130)][_0x22bf78(0x18a)],_0x3b51e2=await executePushSegmentDeletions(_0x41366f,_0x517492[_0x22bf78(0x112)]?[]:_0x7701e5,_0x4387bb);let _0x3afaf8=0x0,_0x426a20=0x0,_0x840c21=0x0;const _0x12dbc8=new Map(_0x518ed1);for(const [_0x5e4dc2,_0x75d652]of _0x23ee5c[_0x22bf78(0x150)]){_0x12dbc8[_0x22bf78(0x149)](_0x5e4dc2,_0x75d652);}if(_0x68c325[_0x22bf78(0x161)]>0x0){const _0x5e883c={..._0x5e78b1,'segmentNameToId':_0x12dbc8,'existingSegments':_0x3b22d9,'activationContext':_0x1d194c},_0x407025=await executePushJourneys(_0x41366f,_0x68c325,_0x5e883c,{'parentId':_0x1be089,'rootFolderId':_0x42d128,'verbose':_0x517492['verbose']},_0x4387bb);_0x3afaf8=_0x407025[_0x22bf78(0x10b)],_0x426a20=_0x407025[_0x22bf78(0x142)];if(_0x590ed7&&_0x407025[_0x22bf78(0x105)][_0x22bf78(0x161)]===0x1){const _0x237bd3=_0x407025['results'][0x0];if(_0x237bd3[_0x22bf78(0x10f)]){const _0x5afd2c=getConsoleNextUrl(_0x517492[_0x22bf78(0x137)],'/app/ps/'+_0x1be089+'/e/'+_0x237bd3[_0x22bf78(0x10f)]+_0x22bf78(0x120));console[_0x22bf78(0x197)]('\x20\x20'+a31_0x373ca4[_0x22bf78(0x172)](_0x5afd2c));}}}for(const _0x586af1 of _0x51d55c){console[_0x22bf78(0x197)](a31_0x373ca4[_0x22bf78(0x107)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x586af1[_0x22bf78(0x17a)])),_0x840c21++;}const _0xe6e6d1=[];if(_0x113175>0x0)_0xe6e6d1[_0x22bf78(0x132)](_0x113175+'\x20created');if(_0x334a0e>0x0)_0xe6e6d1[_0x22bf78(0x132)](_0x334a0e+_0x22bf78(0x156));if(_0x3b51e2>0x0)_0xe6e6d1[_0x22bf78(0x132)](_0x3b51e2+_0x22bf78(0x170));const _0x1fea8f=[];if(_0x3afaf8>0x0)_0x1fea8f[_0x22bf78(0x132)](_0x3afaf8+'\x20created');if(_0x426a20>0x0)_0x1fea8f[_0x22bf78(0x132)](_0x426a20+_0x22bf78(0x156));if(_0x840c21>0x0)_0x1fea8f[_0x22bf78(0x132)](_0x840c21+_0x22bf78(0x170));const _0x4a0a4b=[];if(_0x2147f4>0x0)_0x4a0a4b[_0x22bf78(0x132)](_0x2147f4+_0x22bf78(0x110));if(_0x2863ed>0x0)_0x4a0a4b[_0x22bf78(0x132)](_0x2863ed+'\x20updated');if(_0x338974>0x0)_0x4a0a4b[_0x22bf78(0x132)](_0x338974+'\x20deleted');return console['error'](a31_0x373ca4[_0x22bf78(0x175)](_0x22bf78(0x148))),_0xe6e6d1[_0x22bf78(0x161)]>0x0&&!_0x517492[_0x22bf78(0x112)]&&console[_0x22bf78(0x197)](_0x22bf78(0x109)+_0xe6e6d1[_0x22bf78(0x115)](',\x20')),_0x1fea8f[_0x22bf78(0x161)]>0x0&&console[_0x22bf78(0x197)]('\x20\x20Journeys:\x20'+_0x1fea8f['join'](',\x20')),_0x4a0a4b[_0x22bf78(0x161)]>0x0&&!_0x517492['journeysOnly']&&console[_0x22bf78(0x197)](_0x22bf78(0x168)+_0x4a0a4b[_0x22bf78(0x115)](',\x20')),0x0;}}
@@ -1 +1 @@
1
- const a32_0x55a9b7=a32_0x47f8;function a32_0xa505(){const _0x561fb4=['\x20\x20\x20Path:\x20','updateSegmentById','INTERNAL','parentId','kind','folder','resolveFolderId','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Updating\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','segmentPath','data','length','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','2QBeYBP','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','647544wAKIIM','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentId','12430ctZQbu','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Segment\x20ID:\x20','Resolving\x20path\x20\x27','segment:update','218566OuWIxv','Resolved\x20type:\x20','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','725977gBGxes','21iDIpLU','2303560gmYUbH','includes','segment','✔\x20Updated\x20segment\x20\x27','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','type','execute','163568FSMlip','670RYszya','36zYDUZr','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','error','verbose','name','359452xDcgFx','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20update\x20','description'];a32_0xa505=function(){return _0x561fb4;};return a32_0xa505();}(function(_0x4ec9b2,_0x2b4c3c){const _0x16c0d8=a32_0x47f8,_0x1898ae=_0x4ec9b2();while(!![]){try{const _0x167f12=parseInt(_0x16c0d8(0xec))/0x1*(-parseInt(_0x16c0d8(0xf7))/0x2)+parseInt(_0x16c0d8(0xfb))/0x3*(parseInt(_0x16c0d8(0xd9))/0x4)+-parseInt(_0x16c0d8(0xfc))/0x5+parseInt(_0x16c0d8(0xee))/0x6+parseInt(_0x16c0d8(0xfa))/0x7+-parseInt(_0x16c0d8(0xd2))/0x8*(-parseInt(_0x16c0d8(0xd4))/0x9)+parseInt(_0x16c0d8(0xd3))/0xa*(parseInt(_0x16c0d8(0xf2))/0xb);if(_0x167f12===_0x2b4c3c)break;else _0x1898ae['push'](_0x1898ae['shift']());}catch(_0xca025b){_0x1898ae['push'](_0x1898ae['shift']());}}}(a32_0xa505,0x4ddac));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a32_0x47f8(_0x13bb39,_0x2a2c95){_0x13bb39=_0x13bb39-0xcf;const _0xa505e4=a32_0xa505();let _0x47f846=_0xa505e4[_0x13bb39];return _0x47f846;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a32_0x1cc668 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a32_0x55a9b7(0xd8)]=a32_0x55a9b7(0xf6);[a32_0x55a9b7(0xdc)]='Update\x20existing\x20child\x20segment';async[a32_0x55a9b7(0xd1)](_0x54de9c){const _0x354aa1=a32_0x55a9b7;console[_0x354aa1(0xd6)](a32_0x1cc668['yellow'](_0x354aa1(0xe6))),console[_0x354aa1(0xd6)](a32_0x1cc668['yellow'](_0x354aa1(0xe4)));const {options:_0x4579ac,args:_0x1af664,tdx:_0x2beb0a}=_0x54de9c,_0x203b82=_0x4579ac;if(_0x1af664[_0x354aa1(0xe9)]===0x0)return console[_0x354aa1(0xd6)](_0x354aa1(0xf0)),console[_0x354aa1(0xd6)](_0x354aa1(0xf9)),console[_0x354aa1(0xd6)]('Examples:'),console[_0x354aa1(0xd6)](_0x354aa1(0xcf)),console[_0x354aa1(0xd6)](_0x354aa1(0xed)),0x1;const _0x4cafef=_0x1af664[0x0],_0x4eaf8f=_0x4579ac[_0x354aa1(0xe7)];let _0x152a13=_0x4cafef;_0x4eaf8f&&!_0x4cafef[_0x354aa1(0xfd)]('/')&&(_0x152a13=_0x4eaf8f+'/'+_0x4cafef,_0x203b82[_0x354aa1(0xd7)]&&console['error'](_0x354aa1(0xeb)+_0x152a13));const _0x22bc50=await withSpinner(_0x354aa1(0xf5)+_0x152a13+_0x354aa1(0xef),()=>_0x2beb0a[_0x354aa1(0xfe)]['resolvePathToResource'](_0x152a13),{'verbose':_0x203b82[_0x354aa1(0xd7)]}),_0x54a3da=_0x22bc50['data'];_0x203b82[_0x354aa1(0xd7)]&&console[_0x354aa1(0xd6)](_0x354aa1(0xf8)+_0x54a3da[_0x354aa1(0xd0)]);if(_0x54a3da[_0x354aa1(0xd0)]!==_0x354aa1(0xfe))return console[_0x354aa1(0xd6)](_0x354aa1(0xdb)+_0x54a3da[_0x354aa1(0xd0)]+_0x354aa1(0xd5)),console[_0x354aa1(0xd6)](_0x354aa1(0xf3)),0x1;if(!_0x54a3da['segmentId'])throw new SDKError(ErrorCode[_0x354aa1(0xdf)],_0x354aa1(0xea));const _0x3b158c=_0x54a3da[_0x354aa1(0xe0)],_0x2decff=_0x54a3da[_0x354aa1(0xf1)];_0x203b82[_0x354aa1(0xd7)]&&(console[_0x354aa1(0xd6)]('Parent\x20ID:\x20'+_0x3b158c),console['error'](_0x354aa1(0xf4)+_0x2decff));let _0x4e5620;if(_0x203b82[_0x354aa1(0xe2)]){const _0x4e51ff=_0x203b82['folder'],_0x2e074f=await withSpinner('Resolving\x20folder\x20\x27'+_0x4e51ff+_0x354aa1(0xef),()=>_0x2beb0a['segment'][_0x354aa1(0xe3)](_0x3b158c,_0x4e51ff),{'verbose':_0x203b82['verbose']});_0x4e5620=parseInt(_0x2e074f[_0x354aa1(0xe8)],0xa),_0x203b82['verbose']&&console[_0x354aa1(0xd6)](_0x354aa1(0xda)+_0x4e5620);}const _0x517a80=await loadJSONFromOptions(_0x203b82['rule'],_0x203b82['ruleFile']),_0x4e4d7d={'name':_0x203b82[_0x354aa1(0xd8)],'description':_0x203b82[_0x354aa1(0xdc)],'rule':_0x517a80,'kind':_0x203b82[_0x354aa1(0xe1)]!==undefined?parseInt(_0x203b82[_0x354aa1(0xe1)],0xa):undefined,'segmentFolderId':_0x4e5620},_0x1c0806=await withSpinner(_0x354aa1(0xe5)+_0x54a3da['segmentName']+_0x354aa1(0xef),()=>_0x2beb0a[_0x354aa1(0xfe)][_0x354aa1(0xde)](_0x3b158c,_0x2decff,_0x4e4d7d),{'verbose':_0x203b82[_0x354aa1(0xd7)]}),_0x2d1a55=_0x1c0806['data'];return console[_0x354aa1(0xd6)](_0x354aa1(0xff)+_0x2d1a55[_0x354aa1(0xd8)]+'\x27'),_0x152a13!==_0x4cafef&&console['error'](_0x354aa1(0xdd)+_0x152a13),await handleSDKOutput([_0x2d1a55],_0x203b82),0x0;}}
1
+ const a32_0x414d1b=a32_0x3a42;(function(_0x1554a8,_0x3bb2b5){const _0x53abb2=a32_0x3a42,_0x36fcee=_0x1554a8();while(!![]){try{const _0x4f8226=-parseInt(_0x53abb2(0xdb))/0x1+parseInt(_0x53abb2(0xfa))/0x2*(-parseInt(_0x53abb2(0xed))/0x3)+-parseInt(_0x53abb2(0xf4))/0x4+parseInt(_0x53abb2(0xd7))/0x5*(-parseInt(_0x53abb2(0xf9))/0x6)+parseInt(_0x53abb2(0xf3))/0x7*(parseInt(_0x53abb2(0x105))/0x8)+parseInt(_0x53abb2(0x102))/0x9+parseInt(_0x53abb2(0xe6))/0xa*(parseInt(_0x53abb2(0xe0))/0xb);if(_0x4f8226===_0x3bb2b5)break;else _0x36fcee['push'](_0x36fcee['shift']());}catch(_0x2e199d){_0x36fcee['push'](_0x36fcee['shift']());}}}(a32_0xc98a,0x73ba0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a32_0xc98a(){const _0x4462ab=['Parent\x20ID:\x20','11987767TKmIPC','✔\x20Updated\x20segment\x20\x27','description','includes','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','20aovMni','segmentPath','Updating\x20segment\x20\x27','yellow','Segment\x20ID:\x20','segmentName','length','2833014FOATjs','Resolving\x20folder\x20\x27','segment','Resolving\x20path\x20\x27','Update\x20existing\x20child\x20segment','resolvePathToResource','314363tXNudP','1380636sOTRvx','updateSegmentById','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','INTERNAL','Examples:','4102602juddYo','2UAoKae','segmentId','error','Resolved\x20relative\x20path\x20to:\x20','rule','ruleFile','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','1523304libkbg','\x27...','segment:update','104HhrFWh','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','resolveFolderId','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','folder','Error:\x20Cannot\x20update\x20','verbose','5PiZzuM','\x20\x20\x20Path:\x20','data','type','485387DlLtbK','execute','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','kind'];a32_0xc98a=function(){return _0x4462ab;};return a32_0xc98a();}import a32_0x328d74 from'chalk';function a32_0x3a42(_0x36b188,_0x381088){_0x36b188=_0x36b188-0xd2;const _0xc98a9=a32_0xc98a();let _0x3a429e=_0xc98a9[_0x36b188];return _0x3a429e;}export class SegmentUpdateCommand extends BaseCommand{[a32_0x414d1b(0xd2)]=a32_0x414d1b(0x104);[a32_0x414d1b(0xe2)]=a32_0x414d1b(0xf1);async[a32_0x414d1b(0xdc)](_0x123848){const _0x4afd8e=a32_0x414d1b;console[_0x4afd8e(0xfc)](a32_0x328d74['yellow'](_0x4afd8e(0xdd))),console[_0x4afd8e(0xfc)](a32_0x328d74[_0x4afd8e(0xe9)](_0x4afd8e(0xf6)));const {options:_0x49a3b3,args:_0x1e9b9d,tdx:_0x1e53a1}=_0x123848,_0x14af9e=_0x49a3b3;if(_0x1e9b9d[_0x4afd8e(0xec)]===0x0)return console[_0x4afd8e(0xfc)](_0x4afd8e(0x100)),console[_0x4afd8e(0xfc)](_0x4afd8e(0x101)),console['error'](_0x4afd8e(0xf8)),console['error']('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x4afd8e(0xfc)](_0x4afd8e(0xe5)),0x1;const _0x2d86a0=_0x1e9b9d[0x0],_0x571460=_0x49a3b3[_0x4afd8e(0xe7)];let _0x2e1f54=_0x2d86a0;_0x571460&&!_0x2d86a0[_0x4afd8e(0xe3)]('/')&&(_0x2e1f54=_0x571460+'/'+_0x2d86a0,_0x14af9e[_0x4afd8e(0xd6)]&&console['error'](_0x4afd8e(0xfd)+_0x2e1f54));const _0x95c256=await withSpinner(_0x4afd8e(0xf0)+_0x2e1f54+_0x4afd8e(0x103),()=>_0x1e53a1[_0x4afd8e(0xef)][_0x4afd8e(0xf2)](_0x2e1f54),{'verbose':_0x14af9e[_0x4afd8e(0xd6)]}),_0x3599e1=_0x95c256[_0x4afd8e(0xd9)];_0x14af9e['verbose']&&console[_0x4afd8e(0xfc)]('Resolved\x20type:\x20'+_0x3599e1['type']);if(_0x3599e1[_0x4afd8e(0xda)]!==_0x4afd8e(0xef))return console[_0x4afd8e(0xfc)](_0x4afd8e(0xd5)+_0x3599e1['type']+_0x4afd8e(0x106)),console[_0x4afd8e(0xfc)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x3599e1[_0x4afd8e(0xfb)])throw new SDKError(ErrorCode[_0x4afd8e(0xf7)],_0x4afd8e(0xd3));const _0x5d98d4=_0x3599e1['parentId'],_0x7b47aa=_0x3599e1[_0x4afd8e(0xfb)];_0x14af9e[_0x4afd8e(0xd6)]&&(console[_0x4afd8e(0xfc)](_0x4afd8e(0xdf)+_0x5d98d4),console[_0x4afd8e(0xfc)](_0x4afd8e(0xea)+_0x7b47aa));let _0x4d48af;if(_0x14af9e['folder']){const _0x5d6cf2=_0x14af9e[_0x4afd8e(0xd4)],_0x461457=await withSpinner(_0x4afd8e(0xee)+_0x5d6cf2+_0x4afd8e(0x103),()=>_0x1e53a1[_0x4afd8e(0xef)][_0x4afd8e(0x107)](_0x5d98d4,_0x5d6cf2),{'verbose':_0x14af9e[_0x4afd8e(0xd6)]});_0x4d48af=parseInt(_0x461457[_0x4afd8e(0xd9)],0xa),_0x14af9e['verbose']&&console[_0x4afd8e(0xfc)](_0x4afd8e(0xe4)+_0x4d48af);}const _0x191d2e=await loadJSONFromOptions(_0x14af9e[_0x4afd8e(0xfe)],_0x14af9e[_0x4afd8e(0xff)]),_0x423f2d={'name':_0x14af9e['name'],'description':_0x14af9e[_0x4afd8e(0xe2)],'rule':_0x191d2e,'kind':_0x14af9e[_0x4afd8e(0xde)]!==undefined?parseInt(_0x14af9e[_0x4afd8e(0xde)],0xa):undefined,'segmentFolderId':_0x4d48af},_0x5bd9f0=await withSpinner(_0x4afd8e(0xe8)+_0x3599e1[_0x4afd8e(0xeb)]+_0x4afd8e(0x103),()=>_0x1e53a1[_0x4afd8e(0xef)][_0x4afd8e(0xf5)](_0x5d98d4,_0x7b47aa,_0x423f2d),{'verbose':_0x14af9e[_0x4afd8e(0xd6)]}),_0x5c97a9=_0x5bd9f0['data'];return console[_0x4afd8e(0xfc)](_0x4afd8e(0xe1)+_0x5c97a9[_0x4afd8e(0xd2)]+'\x27'),_0x2e1f54!==_0x2d86a0&&console[_0x4afd8e(0xfc)](_0x4afd8e(0xd8)+_0x2e1f54),await handleSDKOutput([_0x5c97a9],_0x14af9e),0x0;}}
@@ -1 +1 @@
1
- function a33_0x4ec0(){const _0x44d111=['resolvePathToResource','Usage:\x20tdx\x20segment\x20use\x20<path>','session','join','parentName','Resolved\x20relative\x20path\x20to:\x20','✔\x20Context\x20set\x20to:\x20','2045170Prmzsu','data','parent_segment','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','red','fullPath','743920Txvrlm','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','slice','161CsEBKi','length','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isDirectory','846975HWSTtI','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Error:\x20Path\x20is\x20required\x0a','split','447237oJeOgE','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','verbose','cyan','Examples:','3NfPrmP','segment','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','green','type','150648wMZkrH','description','112184nWFGlM','site','execute','log','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','Use:\x20tdx\x20segment\x20use\x20','3NTcvxx','folderId','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','folderPath','segment:use','Resolving\x20path\x20\x27','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','parentId','Site:\x20','segments','53358nmIRQH','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','dim','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','error'];a33_0x4ec0=function(){return _0x44d111;};return a33_0x4ec0();}const a33_0x22e256=a33_0x5804;(function(_0x3f24b1,_0x22a634){const _0x4b2c18=a33_0x5804,_0x24f2fd=_0x3f24b1();while(!![]){try{const _0x360725=parseInt(_0x4b2c18(0x161))/0x1*(parseInt(_0x4b2c18(0x169))/0x2)+parseInt(_0x4b2c18(0x16f))/0x3*(-parseInt(_0x4b2c18(0x167))/0x4)+-parseInt(_0x4b2c18(0x158))/0x5+-parseInt(_0x4b2c18(0x179))/0x6*(parseInt(_0x4b2c18(0x153))/0x7)+parseInt(_0x4b2c18(0x150))/0x8+parseInt(_0x4b2c18(0x15c))/0x9+parseInt(_0x4b2c18(0x14a))/0xa;if(_0x360725===_0x22a634)break;else _0x24f2fd['push'](_0x24f2fd['shift']());}catch(_0x873d74){_0x24f2fd['push'](_0x24f2fd['shift']());}}}(a33_0x4ec0,0x195c8));import{existsSync,statSync}from'fs';import a33_0x2afb3a from'chalk';import{BaseCommand}from'./command.js';function a33_0x5804(_0x2f8ec2,_0x5b1ec3){_0x2f8ec2=_0x2f8ec2-0x148;const _0x4ec006=a33_0x4ec0();let _0x5804e0=_0x4ec006[_0x2f8ec2];return _0x5804e0;}import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a33_0x22e256(0x173);[a33_0x22e256(0x168)]=a33_0x22e256(0x17a);async[a33_0x22e256(0x16b)](_0x2f02ec){const _0x56eed1=a33_0x22e256,{options:_0x58e7dc,args:_0xedd689,tdx:_0x11a5cf}=_0x2f02ec;if(_0xedd689[_0x56eed1(0x154)]===0x0)return console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x14e)](_0x56eed1(0x15a))),console['error'](_0x56eed1(0x17f)),console[_0x56eed1(0x17d)](_0x56eed1(0x160)),console[_0x56eed1(0x17d)](_0x56eed1(0x159)),console['error'](_0x56eed1(0x163)),console[_0x56eed1(0x17d)](_0x56eed1(0x155)),console[_0x56eed1(0x17d)](_0x56eed1(0x15d)),0x1;const _0x18c704=_0xedd689[0x0],_0x241e09=_0x58e7dc[_0x56eed1(0x180)];try{if(_0x18c704==='/')return saveSessionContext({'segment_path':undefined},_0x241e09),console['log'](a33_0x2afb3a[_0x56eed1(0x165)](_0x56eed1(0x14d))),0x0;if(existsSync(_0x18c704)&&statSync(_0x18c704)[_0x56eed1(0x157)]()){let _0xe8866;try{_0xe8866=findTdxConfig(_0x18c704);}catch{return console['error'](a33_0x2afb3a[_0x56eed1(0x14e)](_0x56eed1(0x164)+_0x18c704)),console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x15f)](_0x56eed1(0x156))),0x1;}const _0x3891a4=_0xe8866['config'][_0x56eed1(0x14c)];return saveSessionContext({'segment_path':_0x3891a4,'parent_segment':_0x3891a4},_0x241e09),console[_0x56eed1(0x16c)](a33_0x2afb3a[_0x56eed1(0x165)](_0x56eed1(0x149)+a33_0x2afb3a[_0x56eed1(0x15f)](_0x3891a4))),0x0;}const _0x56f7d1=_0x58e7dc['segmentPath'];let _0x3dd8c0=_0x18c704;const _0x34425a=parsePath(_0x18c704);if(!_0x34425a['isAbsolute']){if(!_0x56f7d1)return console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x14e)](_0x56eed1(0x151))),console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x15f)](_0x56eed1(0x17c))),0x1;if(_0x18c704==='..'){const _0x185102=_0x56f7d1[_0x56eed1(0x15b)]('/')[_0x56eed1(0x152)](0x0,-0x1)['join']('/');_0x3dd8c0=_0x185102||'/';}else _0x18c704==='.'?_0x3dd8c0=_0x56f7d1:_0x3dd8c0=_0x56f7d1+'/'+_0x18c704;_0x58e7dc[_0x56eed1(0x15e)]&&console[_0x56eed1(0x17d)](_0x56eed1(0x148)+_0x3dd8c0);}if(_0x3dd8c0==='/'||_0x3dd8c0==='')return saveSessionContext({'segment_path':undefined},_0x241e09),console[_0x56eed1(0x16c)](a33_0x2afb3a[_0x56eed1(0x165)](_0x56eed1(0x14d))),0x0;_0x3dd8c0=normalizePath(_0x3dd8c0);const _0x22202a=parsePath(_0x3dd8c0)[_0x56eed1(0x178)];if(_0x22202a[_0x56eed1(0x154)]===0x0)return saveSessionContext({'segment_path':undefined},_0x241e09),console[_0x56eed1(0x16c)](a33_0x2afb3a[_0x56eed1(0x165)](_0x56eed1(0x14d))),0x0;_0x58e7dc['verbose']&&(console[_0x56eed1(0x17d)](_0x56eed1(0x177)+_0x58e7dc[_0x56eed1(0x16a)]),console['error']('Target\x20path:\x20'+_0x3dd8c0));const _0x283b97=await withSpinner(_0x56eed1(0x174)+_0x3dd8c0+'\x27...',()=>_0x11a5cf[_0x56eed1(0x162)][_0x56eed1(0x17e)](_0x3dd8c0),{'verbose':_0x58e7dc['verbose']}),_0x2c018f=_0x283b97[_0x56eed1(0x14b)];_0x58e7dc['verbose']&&(console[_0x56eed1(0x17d)]('Resolved\x20path\x20type:\x20'+_0x2c018f[_0x56eed1(0x166)]),console[_0x56eed1(0x17d)]('Parent\x20ID:\x20'+_0x2c018f[_0x56eed1(0x176)]),_0x2c018f[_0x56eed1(0x170)]&&console[_0x56eed1(0x17d)]('Folder\x20ID:\x20'+_0x2c018f[_0x56eed1(0x170)]));if(_0x2c018f['type']===_0x56eed1(0x162))return console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x14e)](_0x56eed1(0x171))),console[_0x56eed1(0x17d)](_0x56eed1(0x175)),console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x15f)](_0x56eed1(0x16e)+_0x2c018f[_0x56eed1(0x182)]+(_0x2c018f[_0x56eed1(0x172)]?'/'+_0x2c018f[_0x56eed1(0x172)][_0x56eed1(0x181)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x2c018f['fullPath'],'parent_segment':_0x2c018f['parentName']},_0x241e09),console[_0x56eed1(0x16c)](a33_0x2afb3a[_0x56eed1(0x165)](_0x56eed1(0x149)+a33_0x2afb3a[_0x56eed1(0x15f)](_0x2c018f[_0x56eed1(0x14f)]))),_0x58e7dc['verbose']&&(console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x17b)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x56eed1(0x17d)](a33_0x2afb3a[_0x56eed1(0x17b)](_0x56eed1(0x16d)))),0x0;}catch(_0x6f832d){throw _0x6f832d;}}}
1
+ const a33_0x285627=a33_0x486f;(function(_0x372280,_0x441ef5){const _0x18c4ff=a33_0x486f,_0x5d7e77=_0x372280();while(!![]){try{const _0x30cba2=-parseInt(_0x18c4ff(0xc2))/0x1*(-parseInt(_0x18c4ff(0xa6))/0x2)+parseInt(_0x18c4ff(0xba))/0x3+parseInt(_0x18c4ff(0xb6))/0x4*(parseInt(_0x18c4ff(0xb2))/0x5)+parseInt(_0x18c4ff(0xaf))/0x6*(-parseInt(_0x18c4ff(0xad))/0x7)+-parseInt(_0x18c4ff(0xc5))/0x8+parseInt(_0x18c4ff(0xa9))/0x9+-parseInt(_0x18c4ff(0xc9))/0xa*(-parseInt(_0x18c4ff(0xaa))/0xb);if(_0x30cba2===_0x441ef5)break;else _0x5d7e77['push'](_0x5d7e77['shift']());}catch(_0x46b9ab){_0x5d7e77['push'](_0x5d7e77['shift']());}}}(a33_0x1276,0xbaad3));import{existsSync,statSync}from'fs';import a33_0x32cad9 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';function a33_0x1276(){const _0x688833=['\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','folderId','Resolved\x20path\x20type:\x20','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','length','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','segmentPath','log','Parent\x20ID:\x20','join','red','segments','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','7736uvzZzr','Site:\x20','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','5638500gnjTap','11ZrsWRX','Use:\x20tdx\x20segment\x20use\x20','✔\x20Context\x20set\x20to:\x20','7OrhjtN','folderPath','1144356LSLvIm','dim','green','233575qayfiW','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','verbose','type','16aFYpfq','error','Error:\x20Path\x20is\x20required\x0a','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','1694163JgrQlH','isDirectory','parent_segment','site','session','Examples:','description','Resolving\x20path\x20\x27','30AXHymi','resolvePathToResource','parentName','7325152VWfLAJ','segment:use','fullPath','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','3768760luWjAJ','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','cyan','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','segment'];a33_0x1276=function(){return _0x688833;};return a33_0x1276();}import{withSpinner}from'../utils/spinner.js';function a33_0x486f(_0x503234,_0x3b1d27){_0x503234=_0x503234-0xa4;const _0x1276d8=a33_0x1276();let _0x486f4b=_0x1276d8[_0x503234];return _0x486f4b;}import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a33_0x285627(0xc6);[a33_0x285627(0xc0)]=a33_0x285627(0xb3);async['execute'](_0x10b5ef){const _0x3f6b77=a33_0x285627,{options:_0x2c99c2,args:_0x216c1d,tdx:_0x167013}=_0x10b5ef;if(_0x216c1d['length']===0x0)return console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xd8)](_0x3f6b77(0xb8))),console[_0x3f6b77(0xb7)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console['error'](_0x3f6b77(0xbf)),console['error']('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x3f6b77(0xb7)](_0x3f6b77(0xce)),console[_0x3f6b77(0xb7)](_0x3f6b77(0xb9)),0x1;const _0x16172a=_0x216c1d[0x0],_0x5542e5=_0x2c99c2[_0x3f6b77(0xbe)];try{if(_0x16172a==='/')return saveSessionContext({'segment_path':undefined},_0x5542e5),console[_0x3f6b77(0xd5)](a33_0x32cad9[_0x3f6b77(0xb1)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x16172a)&&statSync(_0x16172a)[_0x3f6b77(0xbb)]()){let _0x14bca0;try{_0x14bca0=findTdxConfig(_0x16172a);}catch{return console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xd8)](_0x3f6b77(0xa8)+_0x16172a)),console[_0x3f6b77(0xb7)](a33_0x32cad9['cyan'](_0x3f6b77(0xcc))),0x1;}const _0x4d7300=_0x14bca0['config'][_0x3f6b77(0xbc)];return saveSessionContext({'segment_path':_0x4d7300,'parent_segment':_0x4d7300},_0x5542e5),console[_0x3f6b77(0xd5)](a33_0x32cad9[_0x3f6b77(0xb1)](_0x3f6b77(0xac)+a33_0x32cad9['cyan'](_0x4d7300))),0x0;}const _0x5a139f=_0x2c99c2[_0x3f6b77(0xd4)];let _0x14eede=_0x16172a;const _0x314f48=parsePath(_0x16172a);if(!_0x314f48['isAbsolute']){if(!_0x5a139f)return console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xd8)](_0x3f6b77(0xca))),console[_0x3f6b77(0xb7)](a33_0x32cad9['cyan'](_0x3f6b77(0xd1))),0x1;if(_0x16172a==='..'){const _0x3fe5ea=_0x5a139f['split']('/')['slice'](0x0,-0x1)[_0x3f6b77(0xd7)]('/');_0x14eede=_0x3fe5ea||'/';}else _0x16172a==='.'?_0x14eede=_0x5a139f:_0x14eede=_0x5a139f+'/'+_0x16172a;_0x2c99c2['verbose']&&console[_0x3f6b77(0xb7)]('Resolved\x20relative\x20path\x20to:\x20'+_0x14eede);}if(_0x14eede==='/'||_0x14eede==='')return saveSessionContext({'segment_path':undefined},_0x5542e5),console[_0x3f6b77(0xd5)](a33_0x32cad9[_0x3f6b77(0xb1)](_0x3f6b77(0xd3))),0x0;_0x14eede=normalizePath(_0x14eede);const _0x5be518=parsePath(_0x14eede)[_0x3f6b77(0xa4)];if(_0x5be518[_0x3f6b77(0xd2)]===0x0)return saveSessionContext({'segment_path':undefined},_0x5542e5),console['log'](a33_0x32cad9[_0x3f6b77(0xb1)](_0x3f6b77(0xd3))),0x0;_0x2c99c2[_0x3f6b77(0xb4)]&&(console['error'](_0x3f6b77(0xa7)+_0x2c99c2[_0x3f6b77(0xbd)]),console[_0x3f6b77(0xb7)]('Target\x20path:\x20'+_0x14eede));const _0x7cceb7=await withSpinner(_0x3f6b77(0xc1)+_0x14eede+'\x27...',()=>_0x167013[_0x3f6b77(0xcd)][_0x3f6b77(0xc3)](_0x14eede),{'verbose':_0x2c99c2['verbose']}),_0x3d7073=_0x7cceb7['data'];_0x2c99c2[_0x3f6b77(0xb4)]&&(console[_0x3f6b77(0xb7)](_0x3f6b77(0xd0)+_0x3d7073[_0x3f6b77(0xb5)]),console['error'](_0x3f6b77(0xd6)+_0x3d7073['parentId']),_0x3d7073[_0x3f6b77(0xcf)]&&console[_0x3f6b77(0xb7)]('Folder\x20ID:\x20'+_0x3d7073[_0x3f6b77(0xcf)]));if(_0x3d7073['type']===_0x3f6b77(0xcd))return console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xd8)](_0x3f6b77(0xc8))),console[_0x3f6b77(0xb7)]('Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'),console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xcb)](_0x3f6b77(0xab)+_0x3d7073[_0x3f6b77(0xc4)]+(_0x3d7073[_0x3f6b77(0xae)]?'/'+_0x3d7073[_0x3f6b77(0xae)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x3d7073[_0x3f6b77(0xc7)],'parent_segment':_0x3d7073[_0x3f6b77(0xc4)]},_0x5542e5),console[_0x3f6b77(0xd5)](a33_0x32cad9[_0x3f6b77(0xb1)](_0x3f6b77(0xac)+a33_0x32cad9[_0x3f6b77(0xcb)](_0x3d7073['fullPath']))),_0x2c99c2[_0x3f6b77(0xb4)]&&(console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xb0)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x3f6b77(0xb7)](a33_0x32cad9[_0x3f6b77(0xb0)](_0x3f6b77(0xa5)))),0x0;}catch(_0x1af526){throw _0x1af526;}}}