@treasuredata/tdx 0.29.5 β†’ 2026.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.d.ts.map +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/databases.js.map +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.d.ts +97 -1
  27. package/dist/commands/engage-command.d.ts.map +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-command.js.map +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.d.ts.map +1 -1
  34. package/dist/commands/job-command.js +1 -1
  35. package/dist/commands/job-command.js.map +1 -1
  36. package/dist/commands/journey-command.js +1 -1
  37. package/dist/commands/journey-validate-command.js +1 -1
  38. package/dist/commands/llm-command.js +1 -1
  39. package/dist/commands/mcp-command.js +1 -1
  40. package/dist/commands/parent-segment-command.js +1 -1
  41. package/dist/commands/profile-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/schedule-command.js +1 -1
  45. package/dist/commands/segment-command.js +1 -1
  46. package/dist/commands/segment-create-command.js +1 -1
  47. package/dist/commands/segment-fields-command.js +1 -1
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/tables.d.ts.map +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/tables.js.map +1 -1
  59. package/dist/commands/unset-command.js +1 -1
  60. package/dist/commands/upgrade-command.js +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/user-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.d.ts +8 -5
  65. package/dist/core/auth.d.ts.map +1 -1
  66. package/dist/core/auth.js +1 -1
  67. package/dist/core/auth.js.map +1 -1
  68. package/dist/core/command-output.js +1 -1
  69. package/dist/core/config.d.ts +38 -6
  70. package/dist/core/config.d.ts.map +1 -1
  71. package/dist/core/config.js +1 -1
  72. package/dist/core/config.js.map +1 -1
  73. package/dist/core/connection-cache.js +1 -1
  74. package/dist/core/constants.js +1 -1
  75. package/dist/core/credential-cache.js +1 -1
  76. package/dist/core/global-context.d.ts +1 -0
  77. package/dist/core/global-context.d.ts.map +1 -1
  78. package/dist/core/global-context.js +1 -1
  79. package/dist/core/global-context.js.map +1 -1
  80. package/dist/core/keychain.js +1 -1
  81. package/dist/core/profile.js +1 -1
  82. package/dist/core/project-config.js +1 -1
  83. package/dist/core/session.js +1 -1
  84. package/dist/core/user-cache.js +1 -1
  85. package/dist/core/version.d.ts +3 -3
  86. package/dist/core/version.js +1 -1
  87. package/dist/index.js +1 -1
  88. package/dist/mcp/server.js +1 -1
  89. package/dist/mcp/tools/index.js +1 -1
  90. package/dist/mcp/tools/tdx-run.js +1 -1
  91. package/dist/mcp/tools/tdx-search.js +1 -1
  92. package/dist/mcp/utils.js +1 -1
  93. package/dist/proxy/claude-usage-tracker.js +1 -1
  94. package/dist/proxy/passthrough-server.js +1 -1
  95. package/dist/proxy/sse-usage-parser.js +1 -1
  96. package/dist/sdk/agent/agent-config.js +1 -1
  97. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  98. package/dist/sdk/agent/agent-yaml.js +1 -1
  99. package/dist/sdk/agent/test/evaluator.js +1 -1
  100. package/dist/sdk/agent/test/executor.js +1 -1
  101. package/dist/sdk/agent/test/index.js +1 -1
  102. package/dist/sdk/agent/test/output.js +1 -1
  103. package/dist/sdk/agent/test/parser.js +1 -1
  104. package/dist/sdk/agent/tool-target-registry.js +1 -1
  105. package/dist/sdk/api.js +1 -1
  106. package/dist/sdk/api.js.map +1 -1
  107. package/dist/sdk/client/cdp-api-client.js +1 -1
  108. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  109. package/dist/sdk/client/delivery-api-client.js +1 -1
  110. package/dist/sdk/client/delivery-api-client.js.map +1 -1
  111. package/dist/sdk/client/endpoints.d.ts +16 -0
  112. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  113. package/dist/sdk/client/endpoints.js +1 -1
  114. package/dist/sdk/client/endpoints.js.map +1 -1
  115. package/dist/sdk/client/engage-api-client.d.ts +47 -1
  116. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  117. package/dist/sdk/client/engage-api-client.js +1 -1
  118. package/dist/sdk/client/engage-api-client.js.map +1 -1
  119. package/dist/sdk/client/http-client.js +1 -1
  120. package/dist/sdk/client/llm-api-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js.map +1 -1
  122. package/dist/sdk/client/rate-limiter.js +1 -1
  123. package/dist/sdk/client/td-api-client.js +1 -1
  124. package/dist/sdk/client/td-api-client.js.map +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/trino-api-client.js.map +1 -1
  127. package/dist/sdk/client/workflow-client.js +1 -1
  128. package/dist/sdk/client/workflow-client.js.map +1 -1
  129. package/dist/sdk/connection-validator.js +1 -1
  130. package/dist/sdk/connection.js +1 -1
  131. package/dist/sdk/delivery.js +1 -1
  132. package/dist/sdk/engage/campaign-pull.js +1 -1
  133. package/dist/sdk/engage/campaign-push.js +1 -1
  134. package/dist/sdk/engage/campaign-validator.js +1 -1
  135. package/dist/sdk/engage/campaign-yaml.js +1 -1
  136. package/dist/sdk/engage/template-pull.js +1 -1
  137. package/dist/sdk/engage/template-push.js +1 -1
  138. package/dist/sdk/engage/template-validator.js +1 -1
  139. package/dist/sdk/engage/template-yaml.js +1 -1
  140. package/dist/sdk/engage/types/campaign-def.js +1 -1
  141. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  142. package/dist/sdk/engage/types/template-schema.js +1 -1
  143. package/dist/sdk/engage.d.ts +95 -4
  144. package/dist/sdk/engage.d.ts.map +1 -1
  145. package/dist/sdk/engage.js +1 -1
  146. package/dist/sdk/engage.js.map +1 -1
  147. package/dist/sdk/errors.js +1 -1
  148. package/dist/sdk/index.d.ts +10 -0
  149. package/dist/sdk/index.d.ts.map +1 -1
  150. package/dist/sdk/index.js +1 -1
  151. package/dist/sdk/index.js.map +1 -1
  152. package/dist/sdk/io/index.js +1 -1
  153. package/dist/sdk/io/node-filesystem.js +1 -1
  154. package/dist/sdk/job.js +1 -1
  155. package/dist/sdk/journey.d.ts +2 -0
  156. package/dist/sdk/journey.d.ts.map +1 -1
  157. package/dist/sdk/journey.js +1 -1
  158. package/dist/sdk/journey.js.map +1 -1
  159. package/dist/sdk/llm/chat-cache.js +1 -1
  160. package/dist/sdk/llm/index.js +1 -1
  161. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  162. package/dist/sdk/llm/model-factors.js +1 -1
  163. package/dist/sdk/personalization.js +1 -1
  164. package/dist/sdk/personalization.js.map +1 -1
  165. package/dist/sdk/query/index.js +1 -1
  166. package/dist/sdk/query/sql-parser.js +1 -1
  167. package/dist/sdk/realtime.js +1 -1
  168. package/dist/sdk/realtime.js.map +1 -1
  169. package/dist/sdk/schedule.js +1 -1
  170. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  171. package/dist/sdk/segment/fields-display.js +1 -1
  172. package/dist/sdk/segment/file-discovery.js +1 -1
  173. package/dist/sdk/segment/journey-utils.js +1 -1
  174. package/dist/sdk/segment/journey-validator.js +1 -1
  175. package/dist/sdk/segment/journey-yaml.js +1 -1
  176. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  177. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  178. package/dist/sdk/segment/parent-segment-yaml.js.map +1 -1
  179. package/dist/sdk/segment/pull-workflow.js +1 -1
  180. package/dist/sdk/segment/push-recovery.js +1 -1
  181. package/dist/sdk/segment/push-workflow.js +1 -1
  182. package/dist/sdk/segment/resolution-context.js +1 -1
  183. package/dist/sdk/segment/segment-path-parser.js +1 -1
  184. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  185. package/dist/sdk/segment/segment-validator.js +1 -1
  186. package/dist/sdk/segment/target-resolution.js +1 -1
  187. package/dist/sdk/segment/tdx-config.js +1 -1
  188. package/dist/sdk/segment/types/activation-schema.js +1 -1
  189. package/dist/sdk/segment/types/journey-def.js +1 -1
  190. package/dist/sdk/segment/types/journey-schema.js +1 -1
  191. package/dist/sdk/segment/types/segment-def.js +1 -1
  192. package/dist/sdk/segment/types/segment-schema.js +1 -1
  193. package/dist/sdk/segment/validate-files.js +1 -1
  194. package/dist/sdk/segment/yaml-validator.js +1 -1
  195. package/dist/sdk/segment.js +1 -1
  196. package/dist/sdk/types/engage.d.ts +119 -0
  197. package/dist/sdk/types/engage.d.ts.map +1 -1
  198. package/dist/sdk/types/index.d.ts +1 -1
  199. package/dist/sdk/types/index.d.ts.map +1 -1
  200. package/dist/sdk/types/index.js +1 -1
  201. package/dist/sdk/types/index.js.map +1 -1
  202. package/dist/sdk/types/progress.js +1 -1
  203. package/dist/sdk/user.js +1 -1
  204. package/dist/sdk/util/format-detector.js +1 -1
  205. package/dist/sdk/util/formatters.js +1 -1
  206. package/dist/sdk/util/index.d.ts +1 -0
  207. package/dist/sdk/util/index.d.ts.map +1 -1
  208. package/dist/sdk/util/index.js +1 -1
  209. package/dist/sdk/util/index.js.map +1 -1
  210. package/dist/sdk/util/paginate.d.ts +18 -0
  211. package/dist/sdk/util/paginate.d.ts.map +1 -0
  212. package/dist/sdk/util/paginate.js +1 -0
  213. package/dist/sdk/util/paginate.js.map +1 -0
  214. package/dist/sdk/util/tree-formatter.js +1 -1
  215. package/dist/sdk/workflow/archive-validation.js +1 -1
  216. package/dist/sdk/workflow/clone-workflow.js +1 -1
  217. package/dist/sdk/workflow/index.d.ts.map +1 -1
  218. package/dist/sdk/workflow/index.js +1 -1
  219. package/dist/sdk/workflow/index.js.map +1 -1
  220. package/dist/sdk/workflow/pull-workflow.js +1 -1
  221. package/dist/sdk/workflow/push-workflow.js +1 -1
  222. package/dist/sdk/workflow/tdx-config.js +1 -1
  223. package/dist/sdk/workflow/workflow-utils.js +1 -1
  224. package/dist/test-utils/command-runner.js +1 -1
  225. package/dist/test-utils/factories.js +1 -1
  226. package/dist/test-utils/fixtures.js +1 -1
  227. package/dist/test-utils/http-mock.js +1 -1
  228. package/dist/test-utils/index.js +1 -1
  229. package/dist/utils/async.js +1 -1
  230. package/dist/utils/colors.js +1 -1
  231. package/dist/utils/diff.js +1 -1
  232. package/dist/utils/file-permissions.js +1 -1
  233. package/dist/utils/file-reader.js +1 -1
  234. package/dist/utils/github-releases.js +1 -1
  235. package/dist/utils/global-cache.js +1 -1
  236. package/dist/utils/json-loader.js +1 -1
  237. package/dist/utils/local-cache.js +1 -1
  238. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  239. package/dist/utils/logger/formatters/index.js +1 -1
  240. package/dist/utils/logger/handlers/console-handler.js +1 -1
  241. package/dist/utils/logger/handlers/file-handler.js +1 -1
  242. package/dist/utils/logger/handlers/index.js +1 -1
  243. package/dist/utils/logger/handlers/null-handler.js +1 -1
  244. package/dist/utils/logger/index.js +1 -1
  245. package/dist/utils/logger/logger.js +1 -1
  246. package/dist/utils/logger/types.js +1 -1
  247. package/dist/utils/option-validation.js +1 -1
  248. package/dist/utils/process.js +1 -1
  249. package/dist/utils/prompt.js +1 -1
  250. package/dist/utils/spinner.js +1 -1
  251. package/dist/utils/sse-parser.js +1 -1
  252. package/dist/utils/string-utils.js +1 -1
  253. package/dist/utils/table-ref-parser.js +1 -1
  254. package/dist/utils/tdx-logger.js +1 -1
  255. package/dist/utils/version-check.js +1 -1
  256. package/package.json +2 -1
@@ -1 +1 @@
1
- const a33_0x2714e8=a33_0x5e21;(function(_0x907ae9,_0x520af8){const _0x4570a2=a33_0x5e21,_0x5dd6de=_0x907ae9();while(!![]){try{const _0x456b34=parseInt(_0x4570a2(0x1a5))/0x1*(-parseInt(_0x4570a2(0x1b9))/0x2)+-parseInt(_0x4570a2(0x1ae))/0x3*(-parseInt(_0x4570a2(0x142))/0x4)+parseInt(_0x4570a2(0x190))/0x5+parseInt(_0x4570a2(0x150))/0x6+-parseInt(_0x4570a2(0x16c))/0x7*(-parseInt(_0x4570a2(0x194))/0x8)+-parseInt(_0x4570a2(0x137))/0x9*(parseInt(_0x4570a2(0x177))/0xa)+-parseInt(_0x4570a2(0x1a3))/0xb*(parseInt(_0x4570a2(0x18b))/0xc);if(_0x456b34===_0x520af8)break;else _0x5dd6de['push'](_0x5dd6de['shift']());}catch(_0x2f5f7f){_0x5dd6de['push'](_0x5dd6de['shift']());}}}(a33_0x4533,0x8498e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a33_0x5e21(_0x30f90b,_0x4c7c9d){_0x30f90b=_0x30f90b-0x12e;const _0x45330d=a33_0x4533();let _0x5e2184=_0x45330d[_0x30f90b];return _0x5e2184;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a33_0x56fdc4 from'chalk';function formatRelativeTime(_0x48260f){const _0x2232ef=a33_0x5e21,_0x380e68=new Date(_0x48260f),_0x553694=new Date(),_0x4f6887=_0x380e68['getTime']()-_0x553694[_0x2232ef(0x17d)](),_0x58d3e7=Math[_0x2232ef(0x15e)](_0x4f6887)/0x3e8,_0x556ed6=_0x4f6887<0x0;if(_0x58d3e7<0x3c)return _0x556ed6?_0x2232ef(0x1af):_0x2232ef(0x153);else{if(_0x58d3e7<0xe10){const _0x40b934=Math[_0x2232ef(0x172)](_0x58d3e7/0x3c);return _0x556ed6?_0x40b934+_0x2232ef(0x187):'in\x20'+_0x40b934+'m';}else{if(_0x58d3e7<0x15180){const _0x1c2737=Math[_0x2232ef(0x172)](_0x58d3e7/0xe10);return _0x556ed6?_0x1c2737+_0x2232ef(0x15d):_0x2232ef(0x175)+_0x1c2737+'h';}else{if(_0x58d3e7<0x93a80){const _0x146809=Math['round'](_0x58d3e7/0x15180);return _0x556ed6?_0x146809+'d\x20ago':'in\x20'+_0x146809+'d';}else return _0x380e68['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a33_0x2714e8(0x163)]=a33_0x2714e8(0x135);[a33_0x2714e8(0x185)]=a33_0x2714e8(0x164);async['execute'](_0x1695b9){const _0x3baf18=a33_0x2714e8,{options:_0x206703,args:_0x3b4a34,tdx:_0x14db33}=_0x1695b9,_0x272c78=resolveLimit(_0x206703[_0x3baf18(0x146)],DEFAULT_DISPLAY_LIMIT),_0x49ad5d=_0x3b4a34[0x0],_0x4f95a7=_0x49ad5d?_0x3baf18(0x180)+_0x49ad5d+_0x3baf18(0x14b):_0x3baf18(0x1ac),_0x3c0bfd=await withSpinner(_0x4f95a7,()=>_0x14db33[_0x3baf18(0x19a)][_0x3baf18(0x158)]({'limit':_0x272c78,'scheduled':!![],'pattern':_0x49ad5d}),{'verbose':_0x206703[_0x3baf18(0x196)]}),_0x319539=_0x3c0bfd[_0x3baf18(0x1b1)][_0x3baf18(0x17e)],_0x51e768=_0x3c0bfd[_0x3baf18(0x1b1)][_0x3baf18(0x1ba)][_0x3baf18(0x182)],_0x3b329b=_0x49ad5d?_0x3baf18(0x174)+_0x49ad5d+'\x22':'';_0x51e768?console['error']('Showing\x20first\x20'+_0x319539[_0x3baf18(0x143)]+'\x20schedules'+_0x3b329b+_0x3baf18(0x186)):console[_0x3baf18(0x1aa)](_0x3baf18(0x15a)+_0x319539['length']+_0x3baf18(0x183)+(_0x319539[_0x3baf18(0x143)]!==0x1?'ies':'y')+_0x3b329b);if(_0x206703[_0x3baf18(0x1b3)]==='json'||_0x206703[_0x3baf18(0x1b3)]==='jsonl'||_0x206703[_0x3baf18(0x1b3)]===_0x3baf18(0x17a)||_0x206703['format']===_0x3baf18(0x12e)){const _0x54178a=_0x319539[_0x3baf18(0x154)](_0x1ef0c8=>({'id':_0x1ef0c8['id'],'name':_0x1ef0c8[_0x3baf18(0x163)],'cron':_0x1ef0c8[_0x3baf18(0x144)],'database':_0x1ef0c8[_0x3baf18(0x191)]?.[_0x3baf18(0x163)],'type':_0x1ef0c8['type'],'timezone':_0x1ef0c8[_0x3baf18(0x173)],'user_name':_0x1ef0c8[_0x3baf18(0x1b4)]?.[_0x3baf18(0x163)],'updated_at':_0x1ef0c8['updated_at'],'next_run_at':_0x1ef0c8[_0x3baf18(0x1ad)],'last_job_status':_0x1ef0c8[_0x3baf18(0x13c)]?.[_0x3baf18(0x171)]}));await handleSDKOutput(_0x54178a,_0x206703);}else{if(_0x319539[_0x3baf18(0x143)]===0x0)console[_0x3baf18(0x176)](_0x3baf18(0x155));else{const _0xe988d9=_0x206703['site'],_0x162ffd=_0x319539[_0x3baf18(0x154)](_0x2967d4=>{const _0x280374=_0x3baf18,_0x5bc071=_0x2967d4[_0x280374(0x13c)]?.[_0x280374(0x171)]?_0x2967d4['last_job'][_0x280374(0x171)]==='success'?'βœ“':'βœ—':'-',_0x1df9cd=_0x2967d4[_0x280374(0x13c)]?.[_0x280374(0x141)]?formatRelativeTime(_0x2967d4[_0x280374(0x13c)][_0x280374(0x141)]):_0x280374(0x15b),_0x4e53c7=_0x2967d4[_0x280374(0x1ad)]?formatRelativeTime(_0x2967d4['next_run_at']):'-',_0x2abb02=_0x2967d4[_0x280374(0x144)]||'',_0x4eb57a=_0x2967d4[_0x280374(0x163)]||_0x280374(0x16a),_0xf8aff0=getConsoleUrl(_0xe988d9,_0x280374(0x179)+_0x2967d4['id']);return{'statusIcon':_0x5bc071,'lastRun':_0x1df9cd,'nextRun':_0x4e53c7,'cron':_0x2abb02,'name':_0x4eb57a,'queryUrl':_0xf8aff0,'status':_0x2967d4[_0x280374(0x13c)]?.['status']};}),_0x5c5a3e=Math['max'](..._0x162ffd[_0x3baf18(0x154)](_0x353f54=>_0x353f54[_0x3baf18(0x195)][_0x3baf18(0x143)])),_0x57ba37=Math['max'](..._0x162ffd['map'](_0x1c9c24=>_0x1c9c24[_0x3baf18(0x15c)][_0x3baf18(0x143)])),_0x173d32=Math[_0x3baf18(0x168)](..._0x162ffd[_0x3baf18(0x154)](_0x2bb7c3=>_0x2bb7c3[_0x3baf18(0x144)][_0x3baf18(0x143)])),_0x19ffcb=_0x162ffd[_0x3baf18(0x154)](_0x4813a1=>{const _0x1e4ed8=_0x3baf18,_0x804d0d=_0x4813a1[_0x1e4ed8(0x171)]===_0x1e4ed8(0x160)?a33_0x56fdc4['green'](_0x4813a1[_0x1e4ed8(0x16e)]):_0x4813a1[_0x1e4ed8(0x171)]===_0x1e4ed8(0x1aa)?a33_0x56fdc4[_0x1e4ed8(0x18f)](_0x4813a1[_0x1e4ed8(0x16e)]):a33_0x56fdc4[_0x1e4ed8(0x14c)](_0x4813a1[_0x1e4ed8(0x16e)]),_0x206295=_0x4813a1[_0x1e4ed8(0x195)][_0x1e4ed8(0x14a)](_0x5c5a3e),_0x288bd0=_0x4813a1[_0x1e4ed8(0x15c)]['padEnd'](_0x57ba37),_0x2f6278=_0x4813a1[_0x1e4ed8(0x144)]?a33_0x56fdc4['cyan'](_0x4813a1[_0x1e4ed8(0x144)][_0x1e4ed8(0x14a)](_0x173d32)):'\x20'[_0x1e4ed8(0x198)](_0x173d32),_0x32b450=hyperlink(_0x4813a1['name'],_0x4813a1[_0x1e4ed8(0x159)]);return'πŸ“…\x20'+_0x804d0d+'\x20'+_0x206295+_0x1e4ed8(0x197)+_0x288bd0+'\x20\x20'+_0x2f6278+'\x20\x20'+_0x32b450;});await writeOutput(_0x19ffcb[_0x3baf18(0x18e)]('\x0a'),_0x206703[_0x3baf18(0x1a6)],_0x3baf18(0x14e));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a33_0x2714e8(0x163)]='schedule:show';[a33_0x2714e8(0x185)]=a33_0x2714e8(0x14f);['validate'](_0x1d9356){const _0x19ec87=a33_0x2714e8,_0xd8991d=_0x1d9356[_0x19ec87(0x178)][0x0];if(!_0xd8991d)return _0x19ec87(0x1a7);return undefined;}async[a33_0x2714e8(0x19c)](_0x556368){const _0x45a738=a33_0x2714e8,{options:_0x40ca4d,args:_0x540238,tdx:_0xa35123}=_0x556368,_0x3f86b7=_0x540238[0x0],_0x4a1073=await withSpinner(_0x45a738(0x181),()=>_0xa35123[_0x45a738(0x19a)][_0x45a738(0x16d)](_0x3f86b7),{'verbose':_0x40ca4d[_0x45a738(0x196)]}),_0x989e62=_0x4a1073[_0x45a738(0x1b1)],_0x253d57={'name':_0x989e62[_0x45a738(0x163)],'cron':_0x989e62[_0x45a738(0x144)],'database':_0x989e62[_0x45a738(0x191)],'type':_0x989e62[_0x45a738(0x16b)],'timezone':_0x989e62['timezone'],'user_name':_0x989e62[_0x45a738(0x188)],'created_at':_0x989e62[_0x45a738(0x167)],'engine_version':_0x989e62['engine_version'],'executing_user_id':_0x989e62[_0x45a738(0x130)],'query':_0x989e62[_0x45a738(0x19b)],'delay':_0x989e62[_0x45a738(0x166)],'priority':_0x989e62[_0x45a738(0x133)],'retry_limit':_0x989e62['retry_limit'],..._0x989e62['result']&&{'result':_0x989e62['result']}};return await handleSingleObjectOutput(_0x253d57,_0x40ca4d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a33_0x2714e8(0x163)]=a33_0x2714e8(0x13f);['description']=a33_0x2714e8(0x170);[a33_0x2714e8(0x1b6)](_0x14413c){const _0x5220f1=a33_0x2714e8,_0x32640c=_0x14413c['args'][0x0];if(!_0x32640c)return _0x5220f1(0x1a2);const _0x549062=_0x14413c[_0x5220f1(0x1a4)];if(!_0x549062['database'])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x3720f4){const _0x1db2c6=a33_0x2714e8,{options:_0xa8c7f3,args:_0x3ef436,tdx:_0x104234}=_0x3720f4,_0x3a4ad0=_0x3ef436[0x0],_0x43dcbe=_0xa8c7f3,_0x47d87f=_0x43dcbe[_0x1db2c6(0x191)],_0x5e9a0b=_0x43dcbe['file'],_0x226967=_0x43dcbe[_0x1db2c6(0x16b)]||_0x1db2c6(0x134);let _0x17d127;try{_0x17d127=readFileSync(_0x5e9a0b,'utf-8')[_0x1db2c6(0x145)]();}catch(_0x4941d8){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1db2c6(0x161)+_0x5e9a0b,_0x4941d8 instanceof Error?_0x4941d8:undefined);}if(!_0x17d127)throw new SDKError(ErrorCode[_0x1db2c6(0x1a1)],_0x1db2c6(0x17c));const _0x11dce1={'database':_0x47d87f,'query':_0x17d127,'type':_0x226967};if(_0x43dcbe[_0x1db2c6(0x144)])_0x11dce1[_0x1db2c6(0x144)]=_0x43dcbe[_0x1db2c6(0x144)];if(_0x43dcbe['timezone'])_0x11dce1[_0x1db2c6(0x189)]=_0x43dcbe[_0x1db2c6(0x189)];if(_0x43dcbe['delay']!==undefined)_0x11dce1[_0x1db2c6(0x166)]=Number(_0x43dcbe[_0x1db2c6(0x166)]);if(_0x43dcbe[_0x1db2c6(0x133)]!==undefined)_0x11dce1[_0x1db2c6(0x133)]=Number(_0x43dcbe['priority']);if(_0x43dcbe[_0x1db2c6(0x18a)]!==undefined)_0x11dce1[_0x1db2c6(0x15f)]=Number(_0x43dcbe[_0x1db2c6(0x18a)]);if(_0x43dcbe[_0x1db2c6(0x1b2)])_0x11dce1[_0x1db2c6(0x1a9)]=_0x43dcbe[_0x1db2c6(0x1b2)];if(_0x43dcbe[_0x1db2c6(0x13e)])_0x11dce1[_0x1db2c6(0x13e)]=_0x43dcbe[_0x1db2c6(0x13e)];if(_0xa8c7f3[_0x1db2c6(0x196)]){console[_0x1db2c6(0x1aa)](_0x1db2c6(0x169)+_0x3a4ad0),console['error']('\x20\x20Database:\x20'+_0x47d87f),console[_0x1db2c6(0x1aa)](_0x1db2c6(0x19f)+_0x226967);if(_0x11dce1[_0x1db2c6(0x144)])console[_0x1db2c6(0x1aa)](_0x1db2c6(0x157)+_0x11dce1[_0x1db2c6(0x144)]);if(_0x11dce1[_0x1db2c6(0x189)])console['error'](_0x1db2c6(0x152)+_0x11dce1[_0x1db2c6(0x189)]);}const _0x1565ef=await withSpinner(_0x1db2c6(0x199),()=>_0x104234[_0x1db2c6(0x19a)][_0x1db2c6(0x138)](_0x3a4ad0,_0x11dce1),{'verbose':_0xa8c7f3[_0x1db2c6(0x196)]});return console[_0x1db2c6(0x1aa)](_0x1db2c6(0x1b5)+_0x1565ef[_0x1db2c6(0x1b1)]['name']),await handleSingleObjectOutput(_0x1565ef[_0x1db2c6(0x1b1)],_0xa8c7f3),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a33_0x2714e8(0x163)]=a33_0x2714e8(0x13b);[a33_0x2714e8(0x185)]=a33_0x2714e8(0x1a0);[a33_0x2714e8(0x1b6)](_0x241a05){const _0x5d0dfb=a33_0x2714e8,_0x5ce843=_0x241a05[_0x5d0dfb(0x178)][0x0];if(!_0x5ce843)return _0x5d0dfb(0x151);return undefined;}async['execute'](_0x5af617){const _0x548717=a33_0x2714e8,{options:_0x48cfdc,args:_0x21dd10,tdx:_0x5c965e}=_0x5af617,_0x515a23=_0x21dd10[0x0],_0x163e81=_0x48cfdc,_0x464c25={};if(_0x163e81[_0x548717(0x191)])_0x464c25[_0x548717(0x191)]=_0x163e81[_0x548717(0x191)];if(_0x163e81['type'])_0x464c25[_0x548717(0x16b)]=_0x163e81['type'];if(_0x163e81[_0x548717(0x144)])_0x464c25[_0x548717(0x144)]=_0x163e81['cron'];if(_0x163e81[_0x548717(0x189)])_0x464c25[_0x548717(0x189)]=_0x163e81[_0x548717(0x189)];if(_0x163e81['delay']!==undefined)_0x464c25[_0x548717(0x166)]=Number(_0x163e81[_0x548717(0x166)]);if(_0x163e81[_0x548717(0x133)]!==undefined)_0x464c25[_0x548717(0x133)]=Number(_0x163e81[_0x548717(0x133)]);if(_0x163e81[_0x548717(0x18a)]!==undefined)_0x464c25['retry_limit']=Number(_0x163e81[_0x548717(0x18a)]);if(_0x163e81[_0x548717(0x1b2)])_0x464c25['engine_version']=_0x163e81[_0x548717(0x1b2)];if(_0x163e81['result'])_0x464c25[_0x548717(0x13e)]=_0x163e81['result'];if(_0x163e81[_0x548717(0x140)])try{_0x464c25[_0x548717(0x19b)]=readFileSync(_0x163e81[_0x548717(0x140)],'utf-8')[_0x548717(0x145)]();}catch(_0x129ba3){throw new SDKError(ErrorCode[_0x548717(0x1a1)],'Failed\x20to\x20read\x20file:\x20'+_0x163e81['file'],_0x129ba3 instanceof Error?_0x129ba3:undefined);}if(Object['keys'](_0x464c25)[_0x548717(0x143)]===0x0)throw new SDKError(ErrorCode[_0x548717(0x1a1)],_0x548717(0x18c));if(_0x48cfdc[_0x548717(0x196)]){console[_0x548717(0x1aa)]('Updating\x20schedule:\x20'+_0x515a23);for(const [_0x2359fe,_0x2c934a]of Object[_0x548717(0x14d)](_0x464c25)){_0x2359fe===_0x548717(0x19b)?console['error']('\x20\x20'+_0x2359fe+':\x20'+_0x2c934a['substring'](0x0,0x32)+_0x548717(0x1b8)):console[_0x548717(0x1aa)]('\x20\x20'+_0x2359fe+':\x20'+_0x2c934a);}}const _0x43e15f=await withSpinner('Updating\x20schedule...',()=>_0x5c965e[_0x548717(0x19a)][_0x548717(0x193)](_0x515a23,_0x464c25),{'verbose':_0x48cfdc['verbose']});return console['error'](_0x548717(0x18d)+_0x43e15f['data']['name']),await handleSingleObjectOutput(_0x43e15f[_0x548717(0x1b1)],_0x48cfdc),0x0;}}function a33_0x4533(){const _0x11aefa=['log','300FrcaJi','args','/app/queries/editor?queryId=','table','\x20\x20Job\x20ID:\x20','Query\x20file\x20is\x20empty','getTime','queries','schedule:run','Searching\x20scheduled\x20queries\x20matching\x20\x22','Getting\x20schedule\x20details...','has_next_page','\x20scheduled\x20quer','\x20\x20Num:\x20','description','\x20(use\x20--limit\x20to\x20see\x20more)','m\x20ago','user_name','timezone','retryLimit','2599716qHUDoi','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Schedule\x20updated:\x20','join','red','455580tFFxHi','database','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','update','104jjxgYR','lastRun','verbose','\x20\x20β†’\x20','repeat','Creating\x20schedule...','schedules','query','execute','Run\x20a\x20scheduled\x20query\x20immediately','job_id','\x20\x20Type:\x20','Update\x20a\x20scheduled\x20query','INVALID_ARGUMENT','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','11QbkUdb','options','895436cDjCVB','output','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','schedule:delete','engine_version','error','\x20job','Listing\x20scheduled\x20queries...','next_run_at','33GFhLMU','just\x20now','\x20\x20Time:\x20','data','engineVersion','format','user','Schedule\x20created:\x20','validate','run','...','2vVxWOl','pagination','tsv','from','executing_user_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Delete\x20a\x20scheduled\x20query','priority','trino','schedule:list','Deleting\x20schedule...','181998LLpRGq','create','jobs','\x20created','schedule:update','last_job','num','result','schedule:create','file','ended_at','351476pgBiIZ','length','cron','trim','limit','count','Running\x20schedule:\x20','end_at','padEnd','\x22...','dim','entries','list','Show\x20schedule\x20details','4172094OeGXUy','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20\x20Timezone:\x20','soon','map','No\x20scheduled\x20queries\x20found','Running\x20schedule...','\x20\x20Cron:\x20','listQueries','queryUrl','Found\x20','never','nextRun','h\x20ago','abs','retry_limit','success','Failed\x20to\x20read\x20file:\x20','\x20(showing\x20','name','List\x20scheduled\x20queries','delete','delay','created_at','max','Creating\x20schedule:\x20','(unnamed)','type','273987pnQPqL','show','statusIcon','\x20execution','Create\x20a\x20scheduled\x20query','status','round','time_zone','\x20matching\x20\x22','in\x20'];a33_0x4533=function(){return _0x11aefa;};return a33_0x4533();}export class ScheduleDeleteCommand extends BaseCommand{[a33_0x2714e8(0x163)]=a33_0x2714e8(0x1a8);[a33_0x2714e8(0x185)]=a33_0x2714e8(0x132);[a33_0x2714e8(0x1b6)](_0x518843){const _0x4ec580=a33_0x2714e8,_0x484f8b=_0x518843[_0x4ec580(0x178)][0x0];if(!_0x484f8b)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a33_0x2714e8(0x19c)](_0x2d203c){const _0x3bda20=a33_0x2714e8,{options:_0x6a3d33,args:_0x22d115,tdx:_0x30a274}=_0x2d203c,_0x5ff47e=_0x22d115[0x0];if(!_0x6a3d33['yes']){const _0x519f13=await confirm(_0x3bda20(0x192)+_0x5ff47e+'\x22?');if(!_0x519f13)return console[_0x3bda20(0x1aa)]('Cancelled'),0x0;}const _0x1532cf=await withSpinner(_0x3bda20(0x136),()=>_0x30a274['schedules'][_0x3bda20(0x165)](_0x5ff47e),{'verbose':_0x6a3d33['verbose']});return console[_0x3bda20(0x1aa)]('Schedule\x20deleted:\x20'+_0x1532cf[_0x3bda20(0x1b1)][_0x3bda20(0x163)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a33_0x2714e8(0x163)]=a33_0x2714e8(0x17f);[a33_0x2714e8(0x185)]=a33_0x2714e8(0x19d);[a33_0x2714e8(0x1b6)](_0x523db7){const _0x47611b=a33_0x2714e8,_0x426fe9=_0x523db7[_0x47611b(0x178)][0x0];if(!_0x426fe9)return _0x47611b(0x131);return undefined;}async[a33_0x2714e8(0x19c)](_0x37bdda){const _0x51b937=a33_0x2714e8,{options:_0x1b8b89,args:_0x13967d,tdx:_0x4759fc}=_0x37bdda,_0x1d1f30=_0x13967d[0x0],_0x4a7b94=_0x1b8b89,_0x520424=_0x4a7b94['time'],_0x4f9235=_0x4a7b94[_0x51b937(0x13d)]!==undefined?Number(_0x4a7b94[_0x51b937(0x13d)]):undefined;if(_0x1b8b89[_0x51b937(0x196)]){console[_0x51b937(0x1aa)](_0x51b937(0x148)+_0x1d1f30);if(_0x520424)console[_0x51b937(0x1aa)](_0x51b937(0x1b0)+_0x520424);if(_0x4f9235)console[_0x51b937(0x1aa)](_0x51b937(0x184)+_0x4f9235);}const _0x185a8c=await withSpinner(_0x51b937(0x156),()=>_0x4759fc['schedules'][_0x51b937(0x1b7)](_0x1d1f30,{'time':_0x520424,'num':_0x4f9235}),{'verbose':_0x1b8b89[_0x51b937(0x196)]}),_0x3553c5=_0x185a8c[_0x51b937(0x1b1)][_0x51b937(0x139)];console[_0x51b937(0x1aa)]('Schedule\x20run\x20submitted:\x20'+_0x3553c5['length']+_0x51b937(0x1ab)+(_0x3553c5['length']!==0x1?'s':'')+_0x51b937(0x13a));for(const _0x1067dc of _0x3553c5){console[_0x51b937(0x1aa)](_0x51b937(0x17b)+_0x1067dc[_0x51b937(0x19e)]);}return await handleSDKOutput(_0x3553c5,_0x1b8b89),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a33_0x2714e8(0x163)]='schedule:history';[a33_0x2714e8(0x185)]='Show\x20schedule\x20execution\x20history';[a33_0x2714e8(0x1b6)](_0x272e0b){const _0x1f8ac4=_0x272e0b['args'][0x0];if(!_0x1f8ac4)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a33_0x2714e8(0x19c)](_0x5df40d){const _0x588e48=a33_0x2714e8,{options:_0x2b6c5c,args:_0x1f6cb2,tdx:_0x5cd04c}=_0x5df40d,_0x13c871=_0x1f6cb2[0x0],_0x544327=_0x2b6c5c,_0x4cad87=_0x544327[_0x588e48(0x12f)]!==undefined?Number(_0x544327['from']):undefined,_0x4968d0=_0x544327['to']!==undefined?Number(_0x544327['to']):undefined,_0x5ea6d8=await withSpinner('Getting\x20schedule\x20history...',()=>_0x5cd04c['schedules']['history'](_0x13c871,{'from':_0x4cad87,'to':_0x4968d0}),{'verbose':_0x2b6c5c[_0x588e48(0x196)]}),_0x2f452f=_0x5ea6d8[_0x588e48(0x1b1)];console[_0x588e48(0x1aa)](_0x588e48(0x15a)+_0x2f452f['count']+_0x588e48(0x16f)+(_0x2f452f[_0x588e48(0x147)]!==0x1?'s':'')+_0x588e48(0x162)+_0x2f452f['from']+'-'+_0x2f452f['to']+')');const _0x46a2b6=_0x2f452f['history'][_0x588e48(0x154)](_0x4f0fa7=>({'job_id':_0x4f0fa7[_0x588e48(0x19e)],'type':_0x4f0fa7['type'],'status':_0x4f0fa7[_0x588e48(0x171)],'scheduled_at':_0x4f0fa7['scheduled_at'],'created_at':_0x4f0fa7['created_at'],'start_at':_0x4f0fa7['start_at'],'end_at':_0x4f0fa7[_0x588e48(0x149)]}));return await handleSDKOutput(_0x46a2b6,_0x2b6c5c),0x0;}}
1
+ const a33_0x116e48=a33_0xb5ce;(function(_0x1911da,_0x405d3d){const _0x147d51=a33_0xb5ce,_0x547ea8=_0x1911da();while(!![]){try{const _0x307367=-parseInt(_0x147d51(0x1ea))/0x1*(-parseInt(_0x147d51(0x247))/0x2)+-parseInt(_0x147d51(0x1e7))/0x3*(-parseInt(_0x147d51(0x20b))/0x4)+-parseInt(_0x147d51(0x1d5))/0x5+-parseInt(_0x147d51(0x21c))/0x6+-parseInt(_0x147d51(0x1cc))/0x7+parseInt(_0x147d51(0x246))/0x8*(-parseInt(_0x147d51(0x22a))/0x9)+parseInt(_0x147d51(0x226))/0xa;if(_0x307367===_0x405d3d)break;else _0x547ea8['push'](_0x547ea8['shift']());}catch(_0x46a132){_0x547ea8['push'](_0x547ea8['shift']());}}}(a33_0x4b1b,0x78ef2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a33_0x3830fc from'chalk';function formatRelativeTime(_0x207733){const _0x25e7f9=a33_0xb5ce,_0x124990=new Date(_0x207733),_0x1199d0=new Date(),_0x1374a0=_0x124990[_0x25e7f9(0x252)]()-_0x1199d0['getTime'](),_0x3271b8=Math[_0x25e7f9(0x1c5)](_0x1374a0)/0x3e8,_0x5062f3=_0x1374a0<0x0;if(_0x3271b8<0x3c)return _0x5062f3?_0x25e7f9(0x237):'soon';else{if(_0x3271b8<0xe10){const _0x156bfb=Math['round'](_0x3271b8/0x3c);return _0x5062f3?_0x156bfb+_0x25e7f9(0x228):_0x25e7f9(0x20d)+_0x156bfb+'m';}else{if(_0x3271b8<0x15180){const _0x20f7fb=Math['round'](_0x3271b8/0xe10);return _0x5062f3?_0x20f7fb+_0x25e7f9(0x1d3):'in\x20'+_0x20f7fb+'h';}else{if(_0x3271b8<0x93a80){const _0x25a36e=Math[_0x25e7f9(0x24d)](_0x3271b8/0x15180);return _0x5062f3?_0x25a36e+_0x25e7f9(0x1f0):_0x25e7f9(0x20d)+_0x25a36e+'d';}else return _0x124990[_0x25e7f9(0x217)]();}}}}export class ScheduleListCommand extends BaseCommand{[a33_0x116e48(0x1ff)]='schedule:list';[a33_0x116e48(0x200)]=a33_0x116e48(0x21d);async[a33_0x116e48(0x1d9)](_0x315f19){const _0x344716=a33_0x116e48,{options:_0x356f83,args:_0xbf3354,tdx:_0x2816b7}=_0x315f19,_0x50a4ee=resolveLimit(_0x356f83['limit'],DEFAULT_DISPLAY_LIMIT),_0x271224=_0xbf3354[0x0],_0x50b483=_0x271224?_0x344716(0x1e8)+_0x271224+'\x22...':_0x344716(0x1dc),_0x23865b=await withSpinner(_0x50b483,()=>_0x2816b7[_0x344716(0x22d)][_0x344716(0x1f9)]({'limit':_0x50a4ee,'scheduled':!![],'pattern':_0x271224}),{'verbose':_0x356f83[_0x344716(0x1c7)]}),_0x240d7c=_0x23865b[_0x344716(0x1f6)][_0x344716(0x1d7)],_0x1bc134=_0x23865b[_0x344716(0x1f6)][_0x344716(0x23c)][_0x344716(0x1c2)],_0x2e917f=_0x271224?'\x20matching\x20\x22'+_0x271224+'\x22':'';_0x1bc134?console[_0x344716(0x230)](_0x344716(0x213)+_0x240d7c[_0x344716(0x208)]+_0x344716(0x215)+_0x2e917f+_0x344716(0x1dd)):console[_0x344716(0x230)](_0x344716(0x1c4)+_0x240d7c['length']+_0x344716(0x243)+(_0x240d7c[_0x344716(0x208)]!==0x1?_0x344716(0x236):'y')+_0x2e917f);if(_0x356f83[_0x344716(0x1e6)]===_0x344716(0x250)||_0x356f83[_0x344716(0x1e6)]===_0x344716(0x244)||_0x356f83[_0x344716(0x1e6)]==='table'||_0x356f83['format']===_0x344716(0x1ee)){const _0x348b73=_0x240d7c[_0x344716(0x23f)](_0x408ee8=>({'id':_0x408ee8['id'],'name':_0x408ee8['name'],'cron':_0x408ee8['cron'],'database':_0x408ee8[_0x344716(0x210)]?.['name'],'type':_0x408ee8[_0x344716(0x1ce)],'timezone':_0x408ee8[_0x344716(0x220)],'user_name':_0x408ee8['user']?.[_0x344716(0x1ff)],'updated_at':_0x408ee8[_0x344716(0x1e9)],'next_run_at':_0x408ee8['next_run_at'],'last_job_status':_0x408ee8[_0x344716(0x242)]?.[_0x344716(0x1d4)]}));await handleSDKOutput(_0x348b73,_0x356f83);}else{if(_0x240d7c[_0x344716(0x208)]===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x54e3a4=_0x356f83[_0x344716(0x241)],_0x63407=_0x240d7c[_0x344716(0x23f)](_0x2b9be2=>{const _0x52af6f=_0x344716,_0x2aefda=_0x2b9be2[_0x52af6f(0x242)]?.[_0x52af6f(0x1d4)]?_0x2b9be2['last_job'][_0x52af6f(0x1d4)]==='success'?'βœ“':'βœ—':'-',_0x3707ae=_0x2b9be2[_0x52af6f(0x242)]?.[_0x52af6f(0x1da)]?formatRelativeTime(_0x2b9be2[_0x52af6f(0x242)][_0x52af6f(0x1da)]):_0x52af6f(0x1f2),_0x1ec1a3=_0x2b9be2[_0x52af6f(0x1e3)]?formatRelativeTime(_0x2b9be2[_0x52af6f(0x1e3)]):'-',_0x54ec5c=_0x2b9be2[_0x52af6f(0x1d6)]||'',_0x16ebb2=_0x2b9be2[_0x52af6f(0x1ff)]||_0x52af6f(0x1ed),_0x4fab74=getConsoleUrl(_0x54e3a4,'/app/queries/editor?queryId='+_0x2b9be2['id']);return{'statusIcon':_0x2aefda,'lastRun':_0x3707ae,'nextRun':_0x1ec1a3,'cron':_0x54ec5c,'name':_0x16ebb2,'queryUrl':_0x4fab74,'status':_0x2b9be2[_0x52af6f(0x242)]?.[_0x52af6f(0x1d4)]};}),_0x39398f=Math[_0x344716(0x234)](..._0x63407['map'](_0x17e04c=>_0x17e04c[_0x344716(0x1f5)][_0x344716(0x208)])),_0x30b52c=Math[_0x344716(0x234)](..._0x63407['map'](_0x5a4992=>_0x5a4992[_0x344716(0x24b)]['length'])),_0x24361c=Math[_0x344716(0x234)](..._0x63407[_0x344716(0x23f)](_0x1adf7a=>_0x1adf7a[_0x344716(0x1d6)][_0x344716(0x208)])),_0x4cdfd1=_0x63407[_0x344716(0x23f)](_0x422afa=>{const _0x29614d=_0x344716,_0x1821c7=_0x422afa['status']==='success'?a33_0x3830fc['green'](_0x422afa[_0x29614d(0x1fe)]):_0x422afa[_0x29614d(0x1d4)]===_0x29614d(0x230)?a33_0x3830fc[_0x29614d(0x20f)](_0x422afa[_0x29614d(0x1fe)]):a33_0x3830fc[_0x29614d(0x24e)](_0x422afa[_0x29614d(0x1fe)]),_0x5c8451=_0x422afa[_0x29614d(0x1f5)]['padEnd'](_0x39398f),_0x1e7b39=_0x422afa[_0x29614d(0x24b)][_0x29614d(0x212)](_0x30b52c),_0x54f350=_0x422afa['cron']?a33_0x3830fc[_0x29614d(0x1e5)](_0x422afa[_0x29614d(0x1d6)]['padEnd'](_0x24361c)):'\x20'[_0x29614d(0x232)](_0x24361c),_0xe9546e=hyperlink(_0x422afa['name'],_0x422afa['queryUrl']);return _0x29614d(0x1d2)+_0x1821c7+'\x20'+_0x5c8451+'\x20\x20β†’\x20'+_0x1e7b39+'\x20\x20'+_0x54f350+'\x20\x20'+_0xe9546e;});await writeOutput(_0x4cdfd1['join']('\x0a'),_0x356f83[_0x344716(0x209)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a33_0x116e48(0x1ff)]='schedule:show';[a33_0x116e48(0x200)]=a33_0x116e48(0x1f4);[a33_0x116e48(0x214)](_0x5605d2){const _0xce659b=a33_0x116e48,_0x316509=_0x5605d2[_0xce659b(0x1eb)][0x0];if(!_0x316509)return _0xce659b(0x1f1);return undefined;}async['execute'](_0x5ca829){const _0x471204=a33_0x116e48,{options:_0x5a4216,args:_0x54be40,tdx:_0x5f0a05}=_0x5ca829,_0x58c726=_0x54be40[0x0],_0xc05e7b=await withSpinner(_0x471204(0x22e),()=>_0x5f0a05['schedules'][_0x471204(0x22f)](_0x58c726),{'verbose':_0x5a4216[_0x471204(0x1c7)]}),_0x29560c=_0xc05e7b['data'],_0x2e0518={'name':_0x29560c['name'],'cron':_0x29560c[_0x471204(0x1d6)],'database':_0x29560c['database'],'type':_0x29560c['type'],'timezone':_0x29560c[_0x471204(0x1df)],'user_name':_0x29560c['user_name'],'created_at':_0x29560c[_0x471204(0x1e0)],'engine_version':_0x29560c[_0x471204(0x1d8)],'executing_user_id':_0x29560c[_0x471204(0x225)],'query':_0x29560c[_0x471204(0x24a)],'delay':_0x29560c[_0x471204(0x1cb)],'priority':_0x29560c['priority'],'retry_limit':_0x29560c['retry_limit'],..._0x29560c[_0x471204(0x21b)]&&{'result':_0x29560c['result']}};return await handleSingleObjectOutput(_0x2e0518,_0x5a4216),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a33_0x116e48(0x1ff)]=a33_0x116e48(0x21a);[a33_0x116e48(0x200)]=a33_0x116e48(0x1fa);['validate'](_0x8bfa86){const _0x18bdcb=a33_0x116e48,_0x215ee1=_0x8bfa86[_0x18bdcb(0x1eb)][0x0];if(!_0x215ee1)return _0x18bdcb(0x1ec);const _0x262da7=_0x8bfa86[_0x18bdcb(0x1f3)];if(!_0x262da7[_0x18bdcb(0x210)])return _0x18bdcb(0x1d1);return undefined;}async[a33_0x116e48(0x1d9)](_0x4fc39b){const _0x4c77a3=a33_0x116e48,{options:_0x476f5f,args:_0x21dd7c,tdx:_0x29c87f}=_0x4fc39b,_0x24e4fe=_0x21dd7c[0x0],_0x43d78a=_0x476f5f,_0x311513=_0x43d78a['database'],_0x10d1b4=_0x43d78a[_0x4c77a3(0x1c6)],_0x17ab6f=_0x43d78a[_0x4c77a3(0x1ce)]||'trino';let _0x34753b;try{_0x34753b=readFileSync(_0x10d1b4,_0x4c77a3(0x221))[_0x4c77a3(0x22c)]();}catch(_0x16ae84){throw new SDKError(ErrorCode[_0x4c77a3(0x1cd)],_0x4c77a3(0x249)+_0x10d1b4,_0x16ae84 instanceof Error?_0x16ae84:undefined);}if(!_0x34753b)throw new SDKError(ErrorCode[_0x4c77a3(0x1cd)],_0x4c77a3(0x20a));const _0x13de72={'database':_0x311513,'query':_0x34753b,'type':_0x17ab6f};if(_0x43d78a[_0x4c77a3(0x1d6)])_0x13de72[_0x4c77a3(0x1d6)]=_0x43d78a[_0x4c77a3(0x1d6)];if(_0x43d78a[_0x4c77a3(0x1df)])_0x13de72[_0x4c77a3(0x1df)]=_0x43d78a[_0x4c77a3(0x1df)];if(_0x43d78a[_0x4c77a3(0x1cb)]!==undefined)_0x13de72[_0x4c77a3(0x1cb)]=Number(_0x43d78a[_0x4c77a3(0x1cb)]);if(_0x43d78a['priority']!==undefined)_0x13de72[_0x4c77a3(0x224)]=Number(_0x43d78a[_0x4c77a3(0x224)]);if(_0x43d78a[_0x4c77a3(0x207)]!==undefined)_0x13de72[_0x4c77a3(0x1d0)]=Number(_0x43d78a['retryLimit']);if(_0x43d78a[_0x4c77a3(0x238)])_0x13de72[_0x4c77a3(0x1d8)]=_0x43d78a[_0x4c77a3(0x238)];if(_0x43d78a[_0x4c77a3(0x21b)])_0x13de72[_0x4c77a3(0x21b)]=_0x43d78a['result'];if(_0x476f5f[_0x4c77a3(0x1c7)]){console[_0x4c77a3(0x230)](_0x4c77a3(0x251)+_0x24e4fe),console[_0x4c77a3(0x230)]('\x20\x20Database:\x20'+_0x311513),console[_0x4c77a3(0x230)](_0x4c77a3(0x1fc)+_0x17ab6f);if(_0x13de72[_0x4c77a3(0x1d6)])console[_0x4c77a3(0x230)](_0x4c77a3(0x24f)+_0x13de72[_0x4c77a3(0x1d6)]);if(_0x13de72[_0x4c77a3(0x1df)])console[_0x4c77a3(0x230)]('\x20\x20Timezone:\x20'+_0x13de72[_0x4c77a3(0x1df)]);}const _0x4b2003=await withSpinner(_0x4c77a3(0x1c9),()=>_0x29c87f['schedules'][_0x4c77a3(0x248)](_0x24e4fe,_0x13de72),{'verbose':_0x476f5f[_0x4c77a3(0x1c7)]});return console[_0x4c77a3(0x230)](_0x4c77a3(0x240)+_0x4b2003['data'][_0x4c77a3(0x1ff)]),await handleSingleObjectOutput(_0x4b2003[_0x4c77a3(0x1f6)],_0x476f5f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a33_0x116e48(0x1ff)]=a33_0x116e48(0x23b);[a33_0x116e48(0x200)]=a33_0x116e48(0x233);[a33_0x116e48(0x214)](_0x45a9f4){const _0x3736a4=a33_0x116e48,_0x564e9e=_0x45a9f4[_0x3736a4(0x1eb)][0x0];if(!_0x564e9e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async['execute'](_0x46c009){const _0x31d638=a33_0x116e48,{options:_0x39fcb4,args:_0x58dd6b,tdx:_0x223328}=_0x46c009,_0x22344d=_0x58dd6b[0x0],_0x51450f=_0x39fcb4,_0x563704={};if(_0x51450f[_0x31d638(0x210)])_0x563704[_0x31d638(0x210)]=_0x51450f[_0x31d638(0x210)];if(_0x51450f[_0x31d638(0x1ce)])_0x563704[_0x31d638(0x1ce)]=_0x51450f[_0x31d638(0x1ce)];if(_0x51450f[_0x31d638(0x1d6)])_0x563704['cron']=_0x51450f[_0x31d638(0x1d6)];if(_0x51450f['timezone'])_0x563704[_0x31d638(0x1df)]=_0x51450f['timezone'];if(_0x51450f[_0x31d638(0x1cb)]!==undefined)_0x563704[_0x31d638(0x1cb)]=Number(_0x51450f[_0x31d638(0x1cb)]);if(_0x51450f[_0x31d638(0x224)]!==undefined)_0x563704['priority']=Number(_0x51450f[_0x31d638(0x224)]);if(_0x51450f[_0x31d638(0x207)]!==undefined)_0x563704[_0x31d638(0x1d0)]=Number(_0x51450f[_0x31d638(0x207)]);if(_0x51450f[_0x31d638(0x238)])_0x563704[_0x31d638(0x1d8)]=_0x51450f[_0x31d638(0x238)];if(_0x51450f['result'])_0x563704[_0x31d638(0x21b)]=_0x51450f[_0x31d638(0x21b)];if(_0x51450f['file'])try{_0x563704[_0x31d638(0x24a)]=readFileSync(_0x51450f['file'],_0x31d638(0x221))[_0x31d638(0x22c)]();}catch(_0x491d98){throw new SDKError(ErrorCode[_0x31d638(0x1cd)],_0x31d638(0x249)+_0x51450f[_0x31d638(0x1c6)],_0x491d98 instanceof Error?_0x491d98:undefined);}if(Object[_0x31d638(0x20c)](_0x563704)[_0x31d638(0x208)]===0x0)throw new SDKError(ErrorCode[_0x31d638(0x1cd)],_0x31d638(0x231));if(_0x39fcb4['verbose']){console[_0x31d638(0x230)](_0x31d638(0x222)+_0x22344d);for(const [_0x3dad31,_0x31ab72]of Object[_0x31d638(0x1e1)](_0x563704)){_0x3dad31===_0x31d638(0x24a)?console[_0x31d638(0x230)]('\x20\x20'+_0x3dad31+':\x20'+_0x31ab72[_0x31d638(0x218)](0x0,0x32)+_0x31d638(0x1db)):console[_0x31d638(0x230)]('\x20\x20'+_0x3dad31+':\x20'+_0x31ab72);}}const _0x4ef986=await withSpinner(_0x31d638(0x20e),()=>_0x223328[_0x31d638(0x22d)][_0x31d638(0x1de)](_0x22344d,_0x563704),{'verbose':_0x39fcb4[_0x31d638(0x1c7)]});return console[_0x31d638(0x230)](_0x31d638(0x216)+_0x4ef986[_0x31d638(0x1f6)][_0x31d638(0x1ff)]),await handleSingleObjectOutput(_0x4ef986[_0x31d638(0x1f6)],_0x39fcb4),0x0;}}function a33_0xb5ce(_0x4f0734,_0x92d575){_0x4f0734=_0x4f0734-0x1c2;const _0x4b1bf6=a33_0x4b1b();let _0xb5cebc=_0x4b1bf6[_0x4f0734];return _0xb5cebc;}export class ScheduleDeleteCommand extends BaseCommand{['name']=a33_0x116e48(0x211);['description']=a33_0x116e48(0x245);['validate'](_0x40ecc5){const _0x58f4a3=a33_0x116e48,_0x3870c9=_0x40ecc5[_0x58f4a3(0x1eb)][0x0];if(!_0x3870c9)return _0x58f4a3(0x23e);return undefined;}async[a33_0x116e48(0x1d9)](_0x39fce7){const _0x31adb0=a33_0x116e48,{options:_0x412fbb,args:_0x2cd0c4,tdx:_0x3fc181}=_0x39fce7,_0xb5d2da=_0x2cd0c4[0x0];if(!_0x412fbb[_0x31adb0(0x1e4)]){const _0x279ae2=await confirm(_0x31adb0(0x1ca)+_0xb5d2da+'\x22?');if(!_0x279ae2)return console[_0x31adb0(0x230)](_0x31adb0(0x1f8)),0x0;}const _0x311eab=await withSpinner(_0x31adb0(0x219),()=>_0x3fc181[_0x31adb0(0x22d)][_0x31adb0(0x23d)](_0xb5d2da),{'verbose':_0x412fbb[_0x31adb0(0x1c7)]});return console[_0x31adb0(0x230)](_0x31adb0(0x1fd)+_0x311eab[_0x31adb0(0x1f6)][_0x31adb0(0x1ff)]),0x0;}}function a33_0x4b1b(){const _0x507d66=['Searching\x20scheduled\x20queries\x20matching\x20\x22','updated_at','7uEbXzy','args','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','(unnamed)','tsv','count','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','never','options','Show\x20schedule\x20details','lastRun','data','jobs','Cancelled','listQueries','Create\x20a\x20scheduled\x20query','end_at','\x20\x20Type:\x20','Schedule\x20deleted:\x20','statusIcon','name','description','\x20\x20Num:\x20','Running\x20schedule:\x20','scheduled_at','Schedule\x20run\x20submitted:\x20','\x20\x20Time:\x20','schedule:run','retryLimit','length','output','Query\x20file\x20is\x20empty','104648xHIPcL','keys','in\x20','Updating\x20schedule...','red','database','schedule:delete','padEnd','Showing\x20first\x20','validate','\x20schedules','Schedule\x20updated:\x20','toLocaleDateString','substring','Deleting\x20schedule...','schedule:create','result','3837438BFRvWB','List\x20scheduled\x20queries','\x20\x20Job\x20ID:\x20','Show\x20schedule\x20execution\x20history','time_zone','utf-8','Updating\x20schedule:\x20','time','priority','executing_user_id','15288790LdItty','job_id','m\x20ago','\x20job','3293793vzGkwG','\x20(showing\x20','trim','schedules','Getting\x20schedule\x20details...','show','error','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','repeat','Update\x20a\x20scheduled\x20query','max','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','ies','just\x20now','engineVersion','num','Getting\x20schedule\x20history...','schedule:update','pagination','delete','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','map','Schedule\x20created:\x20','site','last_job','\x20scheduled\x20quer','jsonl','Delete\x20a\x20scheduled\x20query','8XySDXh','13912nIIIbf','create','Failed\x20to\x20read\x20file:\x20','query','nextRun','\x20execution','round','dim','\x20\x20Cron:\x20','json','Creating\x20schedule:\x20','getTime','has_next_page','\x20created','Found\x20','abs','file','verbose','run','Creating\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','delay','6086311kzGjEd','INVALID_ARGUMENT','type','Run\x20a\x20scheduled\x20query\x20immediately','retry_limit','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','πŸ“…\x20','h\x20ago','status','875980PgaHae','cron','queries','engine_version','execute','ended_at','...','Listing\x20scheduled\x20queries...','\x20(use\x20--limit\x20to\x20see\x20more)','update','timezone','created_at','entries','from','next_run_at','yes','cyan','format','111GuXDjo'];a33_0x4b1b=function(){return _0x507d66;};return a33_0x4b1b();}export class ScheduleRunCommand extends BaseCommand{[a33_0x116e48(0x1ff)]=a33_0x116e48(0x206);[a33_0x116e48(0x200)]=a33_0x116e48(0x1cf);['validate'](_0x19d1ad){const _0x2a4071=a33_0x116e48,_0x24e07c=_0x19d1ad[_0x2a4071(0x1eb)][0x0];if(!_0x24e07c)return _0x2a4071(0x235);return undefined;}async['execute'](_0x1b77af){const _0x3b89a8=a33_0x116e48,{options:_0x4bf002,args:_0xb59806,tdx:_0x5c6580}=_0x1b77af,_0x5a752e=_0xb59806[0x0],_0x159195=_0x4bf002,_0x85ab77=_0x159195[_0x3b89a8(0x223)],_0x12f1a7=_0x159195[_0x3b89a8(0x239)]!==undefined?Number(_0x159195['num']):undefined;if(_0x4bf002[_0x3b89a8(0x1c7)]){console[_0x3b89a8(0x230)](_0x3b89a8(0x202)+_0x5a752e);if(_0x85ab77)console[_0x3b89a8(0x230)](_0x3b89a8(0x205)+_0x85ab77);if(_0x12f1a7)console[_0x3b89a8(0x230)](_0x3b89a8(0x201)+_0x12f1a7);}const _0x23dfec=await withSpinner('Running\x20schedule...',()=>_0x5c6580['schedules'][_0x3b89a8(0x1c8)](_0x5a752e,{'time':_0x85ab77,'num':_0x12f1a7}),{'verbose':_0x4bf002[_0x3b89a8(0x1c7)]}),_0x2f97bd=_0x23dfec['data'][_0x3b89a8(0x1f7)];console[_0x3b89a8(0x230)](_0x3b89a8(0x204)+_0x2f97bd[_0x3b89a8(0x208)]+_0x3b89a8(0x229)+(_0x2f97bd[_0x3b89a8(0x208)]!==0x1?'s':'')+_0x3b89a8(0x1c3));for(const _0x50b62c of _0x2f97bd){console[_0x3b89a8(0x230)](_0x3b89a8(0x21e)+_0x50b62c['job_id']);}return await handleSDKOutput(_0x2f97bd,_0x4bf002),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a33_0x116e48(0x1ff)]='schedule:history';['description']=a33_0x116e48(0x21f);['validate'](_0x2bb679){const _0x35feef=_0x2bb679['args'][0x0];if(!_0x35feef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a33_0x116e48(0x1d9)](_0x4b7842){const _0x285ecd=a33_0x116e48,{options:_0x38fd12,args:_0x7d613f,tdx:_0x48705c}=_0x4b7842,_0x21c812=_0x7d613f[0x0],_0x21f04f=_0x38fd12,_0x280c7d=_0x21f04f['from']!==undefined?Number(_0x21f04f[_0x285ecd(0x1e2)]):undefined,_0x42dc2e=_0x21f04f['to']!==undefined?Number(_0x21f04f['to']):undefined,_0x2fcd85=await withSpinner(_0x285ecd(0x23a),()=>_0x48705c[_0x285ecd(0x22d)]['history'](_0x21c812,{'from':_0x280c7d,'to':_0x42dc2e}),{'verbose':_0x38fd12[_0x285ecd(0x1c7)]}),_0x580538=_0x2fcd85[_0x285ecd(0x1f6)];console[_0x285ecd(0x230)]('Found\x20'+_0x580538[_0x285ecd(0x1ef)]+_0x285ecd(0x24c)+(_0x580538[_0x285ecd(0x1ef)]!==0x1?'s':'')+_0x285ecd(0x22b)+_0x580538[_0x285ecd(0x1e2)]+'-'+_0x580538['to']+')');const _0x79f903=_0x580538['history'][_0x285ecd(0x23f)](_0x11d9c3=>({'job_id':_0x11d9c3[_0x285ecd(0x227)],'type':_0x11d9c3[_0x285ecd(0x1ce)],'status':_0x11d9c3[_0x285ecd(0x1d4)],'scheduled_at':_0x11d9c3[_0x285ecd(0x203)],'created_at':_0x11d9c3[_0x285ecd(0x1e0)],'start_at':_0x11d9c3['start_at'],'end_at':_0x11d9c3[_0x285ecd(0x1fb)]}));return await handleSDKOutput(_0x79f903,_0x38fd12),0x0;}}
@@ -1 +1 @@
1
- const a34_0x4a7319=a34_0x5f03;(function(_0x57ffe6,_0x142766){const _0x39cdef=a34_0x5f03,_0x3311c5=_0x57ffe6();while(!![]){try{const _0x4f504c=-parseInt(_0x39cdef(0xc3))/0x1+-parseInt(_0x39cdef(0x117))/0x2*(parseInt(_0x39cdef(0x132))/0x3)+parseInt(_0x39cdef(0x100))/0x4*(parseInt(_0x39cdef(0x103))/0x5)+-parseInt(_0x39cdef(0x115))/0x6*(parseInt(_0x39cdef(0x143))/0x7)+parseInt(_0x39cdef(0xf1))/0x8*(parseInt(_0x39cdef(0xc8))/0x9)+-parseInt(_0x39cdef(0x11b))/0xa+parseInt(_0x39cdef(0xc0))/0xb;if(_0x4f504c===_0x142766)break;else _0x3311c5['push'](_0x3311c5['shift']());}catch(_0x9a6e3a){_0x3311c5['push'](_0x3311c5['shift']());}}}(a34_0x25a1,0x6856a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a34_0x25a1(){const _0x28e84f=['jobId','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Resolved\x20type:\x20','631548PGqPQY','getSQLFromServerSegment','509482ghgoxL','query','resolveParentId','toLocaleString','2232710OqdKTa','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20folder','getSegment','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getSegmentSQL','Target\x20path:\x20','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','test','Site:\x20','Resolving\x20parent\x20folder\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','web','Error:\x20Folder\x20reference\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','βœ”\x20Created\x20folder\x20\x27','segment:show','Fetching\x20SQL\x20from\x20rule...','/e/','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','3FSgQtt','getParent','Use:\x20tdx\x20ps\x20show','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','includes','\x27...','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','red','replace','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','parent','Resolving\x20\x27','folderPath','segmentPath','56joXbLM','stats','Parent\x20ID:\x20','in\x20','folderId','type','Folder\x20ID:\x20','cyan','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Usage:\x20tdx\x20segment\x20describe\x20<path>','cause','Error:\x20Path\x20or\x20name\x20is\x20required','json','INVALID_ARGUMENT','parentFolder','Fetching\x20segment\x20details...','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20Full\x20path:\x20','url','Resolving\x20parent\x20segment\x20\x27','Fetching\x20folder\x20\x27','Error:\x20','Show\x20segment\x20or\x20folder\x20details','Usage:\x20tdx\x20sg\x20show\x20<name>','Show\x20segment\x20folder\x20details','limit','listFolders','Fetching\x20folder\x20details...','segment:folder:list','βœ”\x20Found\x20','Creating\x20folder\x20\x27','execute','Usage:','createFolder','parentSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','name','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segment:sql','segmentName','Folder\x20name:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSQLFromYamlFile','Use:\x20tdx\x20ps\x20view','description','18579473rdelJs','\x20rows\x20','fullPath','290694rRAkGF','segmentId','SEGMENT_FOLDER_NOT_FOUND','\x20\x20Cause:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','453789ogtSfs','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved:\x20','Fetching\x20parent\x20segment\x20details...','log','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Options:','Fetching\x20SQL\x20for\x20segment...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','segment:desc','error','segment:folder:show','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20sql\x20--path\x20','data','Usage:\x20tdx\x20sg\x20desc\x20<name>','SEGMENT_NOT_FOUND','segment:folder:create','format','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','code','path','Resolved\x20parent\x20ID:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resolvePathToResource','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20relative\x20path\x20to:\x20','parentId','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','segment:describe','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','(root)','jsonl','8QMqtCF','folder','βœ–\x20Query\x20failed\x20[','getFolder','setJobId','verbose','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Segment\x20ID:\x20','\x20\x20Folder\x20path:\x20','βœ”\x20Query\x20completed:\x20Processed\x20','Examples:','length','resolveFolderId','\x20[Job\x20ID:\x20','112EmFFNc','message','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','53335NecuAp','Parent\x20name:\x20','site','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','trim','green','Executing\x20segment\x20query...','/app/ps/','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','getSegmentSQLFromYaml','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Segment\x20ID\x20missing\x20from\x20resolved\x20path'];a34_0x25a1=function(){return _0x28e84f;};return a34_0x25a1();}function a34_0x5f03(_0x2c033b,_0x4fd836){_0x2c033b=_0x2c033b-0xa6;const _0x25a188=a34_0x25a1();let _0x5f03ea=_0x25a188[_0x2c033b];return _0x5f03ea;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a34_0x144162 from'chalk';async function resolveSegmentTarget(_0x1952bc,_0x25bc11,_0x5d0e35){const _0x3655cd=a34_0x5f03;if(isYamlFilePath(_0x1952bc))try{const _0x114c69=await resolveYamlFilePath(_0x1952bc);return _0x5d0e35&&(console[_0x3655cd(0xd7)](_0x3655cd(0x110)+_0x1952bc),console['error'](_0x3655cd(0x153)+_0x114c69[_0x3655cd(0xb5)]),console['error'](_0x3655cd(0x13a)+_0x114c69['segmentName']),console[_0x3655cd(0xd7)](_0x3655cd(0xfa)+(_0x114c69[_0x3655cd(0x141)]||_0x3655cd(0xef))),console[_0x3655cd(0xd7)](_0x3655cd(0x156)+_0x114c69[_0x3655cd(0xc2)])),_0x114c69[_0x3655cd(0xc2)];}catch(_0x397044){throw new SDKError(ErrorCode[_0x3655cd(0x150)],_0x3655cd(0xe6)+_0x397044[_0x3655cd(0x101)]);}if(!_0x25bc11)throw new SDKError(ErrorCode[_0x3655cd(0x150)],_0x3655cd(0xd9));return _0x25bc11+'/'+_0x1952bc;}export class SegmentDescribeCommand extends BaseCommand{[a34_0x4a7319(0xb7)]=a34_0x4a7319(0xed);[a34_0x4a7319(0xbf)]=a34_0x4a7319(0xa9);async[a34_0x4a7319(0xb2)](_0x4b925e){const _0x19e7b7=a34_0x4a7319,{options:_0x51eeca,args:_0x17ed90,tdx:_0x2e9563}=_0x4b925e,_0x2f93a2=_0x17ed90[0x0],_0x2542fe=!_0x2f93a2&&!!_0x51eeca[_0x19e7b7(0xb5)],_0x232368=_0x2f93a2||_0x51eeca[_0x19e7b7(0xb5)];if(!_0x232368)return console['error'](_0x19e7b7(0x14e)),console[_0x19e7b7(0xd7)](_0x19e7b7(0x14c)),console[_0x19e7b7(0xd7)](_0x19e7b7(0xfc)),console[_0x19e7b7(0xd7)](_0x19e7b7(0x13b)),console[_0x19e7b7(0xd7)](_0x19e7b7(0xb8)),console[_0x19e7b7(0xd7)](_0x19e7b7(0xf8)),console[_0x19e7b7(0xd7)](_0x19e7b7(0xee)),0x1;try{const _0x1d9cc2=_0x51eeca[_0x19e7b7(0x142)];let _0x13cf49=_0x232368;!_0x2542fe&&_0x1d9cc2&&!_0x232368[_0x19e7b7(0x136)]('/')&&(_0x13cf49=_0x1d9cc2+'/'+_0x232368,_0x51eeca[_0x19e7b7(0xf6)]&&console[_0x19e7b7(0xd7)](_0x19e7b7(0xe9)+_0x13cf49));const _0x28c365=await withSpinner('Resolving\x20path\x20\x27'+_0x13cf49+'\x27...',()=>_0x2e9563[_0x19e7b7(0x120)][_0x19e7b7(0xe7)](_0x13cf49),{'verbose':_0x51eeca[_0x19e7b7(0xf6)]}),_0x56a559=_0x28c365['data'];_0x51eeca[_0x19e7b7(0xf6)]&&(console[_0x19e7b7(0xd7)](_0x19e7b7(0x114)+_0x56a559[_0x19e7b7(0x148)]),console[_0x19e7b7(0xd7)](_0x19e7b7(0x145)+_0x56a559[_0x19e7b7(0xea)]),_0x56a559[_0x19e7b7(0x147)]&&console[_0x19e7b7(0xd7)](_0x19e7b7(0x149)+_0x56a559[_0x19e7b7(0x147)]),_0x56a559['segmentId']&&console[_0x19e7b7(0xd7)](_0x19e7b7(0xf9)+_0x56a559[_0x19e7b7(0xc4)]));if(_0x56a559[_0x19e7b7(0x148)]===_0x19e7b7(0x13f)){const _0x3c9c91=await withSpinner(_0x19e7b7(0xcb),()=>_0x2e9563[_0x19e7b7(0x120)][_0x19e7b7(0x133)](_0x56a559[_0x19e7b7(0xea)]),{'verbose':_0x51eeca['verbose']});await handleSingleObjectOutput(_0x3c9c91[_0x19e7b7(0xdb)],_0x51eeca);}else{if(_0x56a559[_0x19e7b7(0x148)]==='folder'){if(!_0x56a559[_0x19e7b7(0x147)])throw new SDKError(ErrorCode[_0x19e7b7(0xc5)],_0x19e7b7(0x11f));const _0x5358a2=await withSpinner(_0x19e7b7(0xae),()=>_0x2e9563[_0x19e7b7(0x120)][_0x19e7b7(0xf4)](_0x56a559[_0x19e7b7(0x147)]),{'verbose':_0x51eeca[_0x19e7b7(0xf6)]});await handleSingleObjectOutput(_0x5358a2['data'],_0x51eeca);}else{if(_0x56a559['type']==='segment'){if(!_0x56a559['segmentId'])throw new SDKError(ErrorCode[_0x19e7b7(0xdd)],_0x19e7b7(0x10e));const _0x4477ba=await withSpinner(_0x19e7b7(0x152),()=>_0x2e9563[_0x19e7b7(0x120)]['getSegment'](_0x56a559[_0x19e7b7(0xea)],_0x56a559[_0x19e7b7(0xc4)]),{'verbose':_0x51eeca['verbose']});await handleSingleObjectOutput(_0x4477ba[_0x19e7b7(0xdb)],_0x51eeca);}}}return 0x0;}catch(_0x513f63){if(_0x513f63 instanceof SDKError)return console[_0x19e7b7(0xd7)](_0x19e7b7(0xa8)+_0x513f63[_0x19e7b7(0x101)]),_0x513f63[_0x19e7b7(0x14d)]&&console[_0x19e7b7(0xd7)](_0x19e7b7(0xc6)+_0x513f63[_0x19e7b7(0x14d)]),0x1;throw _0x513f63;}}}export class SegmentShowCommand extends BaseCommand{[a34_0x4a7319(0xb7)]=a34_0x4a7319(0x12e);[a34_0x4a7319(0xbf)]=a34_0x4a7319(0x155);async['execute'](_0x5799c4){const _0x5410f8=a34_0x4a7319,{options:_0x356522,args:_0x517aa0,tdx:_0x297622}=_0x5799c4,_0x4fcaac=_0x517aa0[0x0];if(!_0x4fcaac)return console[_0x5410f8(0xd7)](_0x5410f8(0xbc)),console[_0x5410f8(0xd7)](_0x5410f8(0xaa)),console[_0x5410f8(0xd7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x5410f8(0xd7)](_0x5410f8(0xfc)),console['error'](_0x5410f8(0x13e)),console[_0x5410f8(0xd7)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x8b8774=_0x356522[_0x5410f8(0xb5)],_0x56d810=await resolveSegmentTarget(_0x4fcaac,_0x8b8774,_0x356522[_0x5410f8(0xf6)]);_0x356522[_0x5410f8(0xf6)]&&console[_0x5410f8(0xd7)](_0x5410f8(0x123)+_0x56d810);const _0x4d3d33=await withSpinner(_0x5410f8(0x140)+_0x4fcaac+_0x5410f8(0x137),()=>_0x297622['segment'][_0x5410f8(0xe7)](_0x56d810),{'verbose':_0x356522['verbose']}),_0x4b265e=_0x4d3d33[_0x5410f8(0xdb)];_0x356522[_0x5410f8(0xf6)]&&(console[_0x5410f8(0xd7)](_0x5410f8(0x114)+_0x4b265e[_0x5410f8(0x148)]),console[_0x5410f8(0xd7)](_0x5410f8(0x145)+_0x4b265e[_0x5410f8(0xea)]));if(_0x4b265e[_0x5410f8(0x148)]===_0x5410f8(0xf2))return console['error'](_0x5410f8(0x14b)),console[_0x5410f8(0xd7)](_0x5410f8(0xf7)),0x1;if(_0x4b265e[_0x5410f8(0x148)]===_0x5410f8(0x13f))return console['error'](_0x5410f8(0xe1)),console['error'](_0x5410f8(0x134)),0x1;if(!_0x4b265e[_0x5410f8(0xc4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5410f8(0x10e));const _0x497516=await withSpinner(_0x5410f8(0xd4),()=>_0x297622['segment'][_0x5410f8(0x122)](_0x4b265e[_0x5410f8(0xea)],_0x4b265e[_0x5410f8(0xc4)]),{'verbose':_0x356522[_0x5410f8(0xf6)]});let _0x7ae0c6=_0x497516[_0x5410f8(0xdb)];const _0x5f5c32=resolveLimit(_0x356522[_0x5410f8(0xac)],DEFAULT_DISPLAY_LIMIT),_0x1db3cc=/\bLIMIT\s+\d+/i[_0x5410f8(0x126)](_0x7ae0c6);!_0x1db3cc&&(_0x7ae0c6=_0x7ae0c6[_0x5410f8(0x107)]()[_0x5410f8(0x13d)](/;+$/,''),_0x7ae0c6=_0x5410f8(0x12c)+_0x7ae0c6+_0x5410f8(0x112)+_0x5f5c32);_0x356522[_0x5410f8(0xf6)]&&console[_0x5410f8(0xd7)]('SQL\x20query:\x0a'+_0x7ae0c6);const _0x3c764a=await withProgressSpinner(_0x5410f8(0x109),async _0x8f32c7=>{const _0x473832=_0x5410f8,_0x7acade=await _0x297622[_0x473832(0x118)][_0x473832(0xb2)](_0x7ae0c6,{'catalog':'td','schema':'information_schema','onJobId':_0x2a1d86=>{const _0x2ff4b7=_0x473832;_0x8f32c7[_0x2ff4b7(0xf5)](_0x2a1d86);}});return _0x7acade;},{'verbose':_0x356522[_0x5410f8(0xf6)]}),_0x501ca7=_0x3c764a['data'],_0x4d724e=_0x501ca7[_0x5410f8(0x10f)]?_0x5410f8(0xff)+_0x501ca7[_0x5410f8(0x10f)]+']':'';return console[_0x5410f8(0xd7)](_0x5410f8(0xfb)+_0x501ca7[_0x5410f8(0x144)]['processedRows'][_0x5410f8(0x11a)]()+_0x5410f8(0xc1)+(_0x5410f8(0x146)+formatElapsed(_0x501ca7[_0x5410f8(0x144)][_0x5410f8(0xeb)])+_0x4d724e)),await handleQueryOutput(_0x501ca7,_0x356522),0x0;}catch(_0x34c2ef){if(_0x34c2ef instanceof SDKError)return console[_0x5410f8(0xd7)](_0x5410f8(0xf3)+_0x34c2ef[_0x5410f8(0xe3)]+']'),console[_0x5410f8(0xd7)]('\x0a'+_0x34c2ef[_0x5410f8(0x101)]),0x1;throw _0x34c2ef;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a34_0x4a7319(0xaf);['description']=a34_0x4a7319(0xc7);async['execute'](_0x316424){const _0x59daa5=a34_0x4a7319,{options:_0x5650c5,args:_0x30e65a,tdx:_0x5b3dbe}=_0x316424;if(_0x30e65a['length']===0x0)return console[_0x59daa5(0xd7)](_0x59daa5(0xb6)),console[_0x59daa5(0xd7)](_0x59daa5(0x113)),0x1;const _0x18e30d=_0x30e65a[0x0];try{_0x5650c5['verbose']&&(console[_0x59daa5(0xd7)](_0x59daa5(0x127)+_0x5650c5[_0x59daa5(0x105)]),console[_0x59daa5(0xd7)](_0x59daa5(0x104)+_0x18e30d));const _0x4aecc5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x18e30d+_0x59daa5(0x137),()=>_0x5b3dbe['segment'][_0x59daa5(0x119)](_0x18e30d),{'verbose':_0x5650c5['verbose']}),_0x5b2445=_0x4aecc5[_0x59daa5(0xdb)];_0x5650c5[_0x59daa5(0xf6)]&&console[_0x59daa5(0xd7)](_0x59daa5(0xe5)+_0x5b2445);const _0x2da363=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x18e30d+_0x59daa5(0x137),()=>_0x5b3dbe[_0x59daa5(0x120)][_0x59daa5(0xad)](_0x5b2445),{'verbose':_0x5650c5['verbose']}),_0x5530dd=_0x2da363[_0x59daa5(0xdb)];return console[_0x59daa5(0xd7)](_0x59daa5(0xb0)+_0x5530dd[_0x59daa5(0xfd)]+_0x59daa5(0x11d)+(_0x5530dd[_0x59daa5(0xfd)]!==0x1?'s':'')),await handleSDKOutput(_0x5530dd,_0x5650c5),0x0;}catch(_0x4d63e7){if(_0x4d63e7 instanceof SDKError)return console[_0x59daa5(0xd7)](_0x59daa5(0xa8)+_0x4d63e7[_0x59daa5(0x101)]),_0x4d63e7[_0x59daa5(0x14d)]&&console[_0x59daa5(0xd7)](_0x59daa5(0xc6)+_0x4d63e7[_0x59daa5(0x14d)]),0x1;throw _0x4d63e7;}}}export class SegmentFolderShowCommand extends BaseCommand{[a34_0x4a7319(0xb7)]=a34_0x4a7319(0xd8);[a34_0x4a7319(0xbf)]=a34_0x4a7319(0xab);async['execute'](_0x5befbf){const _0x978894=a34_0x4a7319,{options:_0x4da9f3,args:_0x5c0ae2,tdx:_0x6b2e55}=_0x5befbf;if(_0x5c0ae2[_0x978894(0xfd)]===0x0)return console[_0x978894(0xd7)](_0x978894(0x12b)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x45f127,childId:_0x27ec08}=parseSegmentRef(_0x5c0ae2[0x0]);_0x4da9f3[_0x978894(0xf6)]&&(console[_0x978894(0xd7)](_0x978894(0x127)+_0x4da9f3[_0x978894(0x105)]),console['error']('Parent\x20name:\x20'+_0x45f127),_0x27ec08&&console[_0x978894(0xd7)](_0x978894(0xbb)+_0x27ec08));if(!_0x27ec08)return console[_0x978894(0xd7)](_0x978894(0x10b)),0x1;const _0x17510c=await withSpinner(_0x978894(0xa6)+_0x45f127+'\x27...',()=>_0x6b2e55[_0x978894(0x120)]['resolveParentId'](_0x45f127),{'verbose':_0x4da9f3[_0x978894(0xf6)]}),_0x56f981=_0x17510c[_0x978894(0xdb)];_0x4da9f3[_0x978894(0xf6)]&&console[_0x978894(0xd7)](_0x978894(0xe5)+_0x56f981);const _0x44fcea=await withSpinner('Resolving\x20folder\x20\x27'+_0x27ec08+_0x978894(0x137),()=>_0x6b2e55[_0x978894(0x120)][_0x978894(0xfe)](_0x56f981,_0x27ec08),{'verbose':_0x4da9f3['verbose']}),_0xbcadd7=_0x44fcea[_0x978894(0xdb)];_0x4da9f3[_0x978894(0xf6)]&&console['error'](_0x978894(0x124)+_0xbcadd7);const _0x28a920=await withSpinner(_0x978894(0xa7)+_0x27ec08+_0x978894(0x137),()=>_0x6b2e55['segment'][_0x978894(0xf4)](_0xbcadd7),{'verbose':_0x4da9f3[_0x978894(0xf6)]});return await handleSDKOutput([_0x28a920[_0x978894(0xdb)]],_0x4da9f3),0x0;}catch(_0x1c39f3){if(_0x1c39f3 instanceof SDKError)return console[_0x978894(0xd7)](_0x978894(0xa8)+_0x1c39f3['message']),_0x1c39f3[_0x978894(0x14d)]&&console['error'](_0x978894(0xc6)+_0x1c39f3[_0x978894(0x14d)]),0x1;throw _0x1c39f3;}}}export class SegmentSQLCommand extends BaseCommand{[a34_0x4a7319(0xb7)]=a34_0x4a7319(0xb9);[a34_0x4a7319(0xbf)]=a34_0x4a7319(0x138);async[a34_0x4a7319(0xb2)](_0x1cdc1d){const _0x3d2777=a34_0x4a7319,{options:_0x19cbfa,args:_0x6a2ab5}=_0x1cdc1d,_0x50fea2=_0x19cbfa,_0x4d72ac=_0x50fea2[_0x3d2777(0xe4)],_0x831055=_0x6a2ab5[0x0];if(!_0x831055&&!_0x4d72ac)return console[_0x3d2777(0xd7)](a34_0x144162[_0x3d2777(0x13c)](_0x3d2777(0x11c))),console['error'](_0x3d2777(0xb3)),console[_0x3d2777(0xd7)](_0x3d2777(0x106)),console[_0x3d2777(0xd7)](_0x3d2777(0x129)),console[_0x3d2777(0xd7)](_0x3d2777(0xfc)),console[_0x3d2777(0xd7)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x3d2777(0xd7)](_0x3d2777(0x102)),0x1;if(_0x831055&&_0x4d72ac)return console[_0x3d2777(0xd7)](a34_0x144162[_0x3d2777(0x13c)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x168033;if(_0x4d72ac)_0x168033=await this[_0x3d2777(0xbd)](_0x4d72ac,_0x1cdc1d);else{if(isYamlFilePath(_0x831055))return console[_0x3d2777(0xd7)](a34_0x144162[_0x3d2777(0x13c)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console['error'](_0x3d2777(0xda)+_0x831055),0x1;else _0x168033=await this[_0x3d2777(0x116)](_0x831055,_0x1cdc1d);}return _0x19cbfa[_0x3d2777(0xdf)]===_0x3d2777(0x14f)||_0x19cbfa[_0x3d2777(0xdf)]===_0x3d2777(0xf0)?await handleSDKOutput([{'sql':_0x168033}],_0x19cbfa):console[_0x3d2777(0xcc)](_0x168033),0x0;}catch(_0x25bb81){if(_0x25bb81 instanceof SDKError)return console[_0x3d2777(0xd7)](_0x3d2777(0xa8)+_0x25bb81['message']),_0x25bb81[_0x3d2777(0x14d)]&&console[_0x3d2777(0xd7)](_0x3d2777(0xc6)+_0x25bb81[_0x3d2777(0x14d)]),0x1;throw _0x25bb81;}}async['getSQLFromYamlFile'](_0x2d2ec1,_0x2da844){const _0x160402=a34_0x4a7319,{options:_0x341d45,tdx:_0x1ecf78}=_0x2da844;let _0x4a43e3;try{_0x4a43e3=await resolveYamlFilePath(_0x2d2ec1);}catch(_0x3c9e95){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x160402(0xe6)+_0x3c9e95[_0x160402(0x101)]);}_0x341d45['verbose']&&console['error'](_0x160402(0xca)+_0x4a43e3[_0x160402(0xb5)]+'/'+_0x4a43e3[_0x160402(0xba)]);const _0x372bf7=await withSpinner(_0x160402(0x12f),()=>_0x1ecf78[_0x160402(0x120)][_0x160402(0x10c)](_0x4a43e3['content'],_0x4a43e3[_0x160402(0xb5)],_0x4a43e3[_0x160402(0xba)]),{'verbose':_0x341d45[_0x160402(0xf6)]});return _0x372bf7[_0x160402(0xdb)];}async[a34_0x4a7319(0x116)](_0x5775dd,_0x2f7350){const _0x3e1849=a34_0x4a7319,{options:_0x20ff87,tdx:_0x25dccb}=_0x2f7350,_0x423ddf=_0x20ff87['parentSegment'],_0xd4f1e0=await resolveSegmentTarget(_0x5775dd,_0x423ddf,_0x20ff87[_0x3e1849(0xf6)]);_0x20ff87[_0x3e1849(0xf6)]&&console['error'](_0x3e1849(0x123)+_0xd4f1e0);const _0x5a189a=await withSpinner(_0x3e1849(0x140)+_0x5775dd+_0x3e1849(0x137),()=>_0x25dccb[_0x3e1849(0x120)][_0x3e1849(0xe7)](_0xd4f1e0),{'verbose':_0x20ff87[_0x3e1849(0xf6)]}),_0x5d5446=_0x5a189a[_0x3e1849(0xdb)];_0x20ff87[_0x3e1849(0xf6)]&&(console[_0x3e1849(0xd7)](_0x3e1849(0x114)+_0x5d5446[_0x3e1849(0x148)]),console[_0x3e1849(0xd7)]('Parent\x20ID:\x20'+_0x5d5446[_0x3e1849(0xea)]));if(_0x5d5446['type']==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3e1849(0x121));if(_0x5d5446[_0x3e1849(0x148)]===_0x3e1849(0x13f))throw new SDKError(ErrorCode[_0x3e1849(0x150)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x5d5446[_0x3e1849(0xc4)])throw new SDKError(ErrorCode[_0x3e1849(0xdd)],_0x3e1849(0x10e));const _0x589403=await withSpinner(_0x3e1849(0xd4),()=>_0x25dccb[_0x3e1849(0x120)][_0x3e1849(0x122)](_0x5d5446[_0x3e1849(0xea)],_0x5d5446[_0x3e1849(0xc4)]),{'verbose':_0x20ff87['verbose']});return _0x589403[_0x3e1849(0xdb)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a34_0x4a7319(0xde);[a34_0x4a7319(0xbf)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x4429a8){const _0x2ea937=a34_0x4a7319,{options:_0x135af9,args:_0x517a23,tdx:_0x1c3314}=_0x4429a8,_0x50a903=_0x135af9;if(_0x517a23[_0x2ea937(0xfd)]<0x2)return console[_0x2ea937(0xd7)](_0x2ea937(0xec)),console[_0x2ea937(0xd7)](_0x2ea937(0x131)),0x1;const _0xdc8507=_0x517a23[0x0],_0x7f84f0=_0x517a23[0x1];_0x50a903[_0x2ea937(0xf6)]&&(console[_0x2ea937(0xd7)](_0x2ea937(0x127)+_0x50a903['site']),console[_0x2ea937(0xd7)](_0x2ea937(0xd0)+_0xdc8507),console[_0x2ea937(0xd7)](_0x2ea937(0xbb)+_0x7f84f0));let _0x57736c;if(_0x50a903['parentFolder']){const _0x3b1478=_0x50a903[_0x2ea937(0x151)],_0x1aae20=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xdc8507+_0x2ea937(0x137),()=>_0x1c3314[_0x2ea937(0x120)]['resolveParentId'](_0xdc8507),{'verbose':_0x50a903[_0x2ea937(0xf6)]}),_0x3819b9=_0x1aae20['data'],_0x169436=await withSpinner(_0x2ea937(0x128)+_0x3b1478+_0x2ea937(0x137),()=>_0x1c3314[_0x2ea937(0x120)][_0x2ea937(0xfe)](_0x3819b9,_0x3b1478),{'verbose':_0x50a903[_0x2ea937(0xf6)]});_0x57736c=_0x169436[_0x2ea937(0xdb)],_0x50a903[_0x2ea937(0xf6)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x57736c);}const _0x27adfb={'name':_0x7f84f0,'description':_0x50a903[_0x2ea937(0xbf)],'parentFolderId':_0x57736c},_0x3a3d1f=await withSpinner(_0x2ea937(0xb1)+_0x7f84f0+_0x2ea937(0x137),()=>_0x1c3314[_0x2ea937(0x120)][_0x2ea937(0xb4)](_0xdc8507,_0x27adfb),{'verbose':_0x50a903[_0x2ea937(0xf6)]}),_0x538ec9=_0x3a3d1f['data'];return console['error'](_0x2ea937(0x12d)+_0x538ec9[_0x2ea937(0xb7)]+'\x27\x20with\x20ID:\x20'+_0x538ec9['id']),await handleSDKOutput([_0x538ec9],_0x50a903),0x0;}}export class SegmentViewCommand extends BaseCommand{[a34_0x4a7319(0xb7)]='segment:view';[a34_0x4a7319(0xbf)]=a34_0x4a7319(0xe8);async[a34_0x4a7319(0xb2)](_0xd78fbd){const _0x3e4551=a34_0x4a7319,{options:_0x228de2,args:_0x5ef9ad,tdx:_0x4fb670}=_0xd78fbd,_0xfbc6bd=_0x5ef9ad[0x0];if(!_0xfbc6bd)return console[_0x3e4551(0xd7)](_0x3e4551(0xce)),console[_0x3e4551(0xd7)](_0x3e4551(0xc9)),console[_0x3e4551(0xd7)](_0x3e4551(0xd1)),console['error'](_0x3e4551(0xd3)),console[_0x3e4551(0xd7)](_0x3e4551(0xd2)),console[_0x3e4551(0xd7)](_0x3e4551(0xfc)),console[_0x3e4551(0xd7)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x3e4551(0xd7)](_0x3e4551(0xcf)),console[_0x3e4551(0xd7)](_0x3e4551(0x111)),console['error'](_0x3e4551(0x135)),0x1;try{const _0x5db387=_0x228de2[_0x3e4551(0xb5)],_0x4d5fd9=await resolveSegmentTarget(_0xfbc6bd,_0x5db387,_0x228de2[_0x3e4551(0xf6)]);_0x228de2['verbose']&&console[_0x3e4551(0xd7)](_0x3e4551(0x123)+_0x4d5fd9);const _0x1c5f0b=await withSpinner('Resolving\x20\x27'+_0xfbc6bd+_0x3e4551(0x137),()=>_0x4fb670[_0x3e4551(0x120)][_0x3e4551(0xe7)](_0x4d5fd9),{'verbose':_0x228de2['verbose']}),_0x4bee7a=_0x1c5f0b[_0x3e4551(0xdb)];_0x228de2['verbose']&&(console[_0x3e4551(0xd7)](_0x3e4551(0x114)+_0x4bee7a[_0x3e4551(0x148)]),console['error'](_0x3e4551(0x145)+_0x4bee7a[_0x3e4551(0xea)]),_0x4bee7a[_0x3e4551(0x147)]&&console['error'](_0x3e4551(0x149)+_0x4bee7a['folderId']),_0x4bee7a[_0x3e4551(0xc4)]&&console[_0x3e4551(0xd7)]('Segment\x20ID:\x20'+_0x4bee7a[_0x3e4551(0xc4)]));if(_0x228de2[_0x3e4551(0x12a)]){if(_0x4bee7a[_0x3e4551(0x148)]===_0x3e4551(0xf2))return console[_0x3e4551(0xd7)](_0x3e4551(0x10d)),0x1;if(_0x4bee7a[_0x3e4551(0x148)]===_0x3e4551(0x13f))return console['error'](_0x3e4551(0x125)),console['error'](_0x3e4551(0xe0)),0x1;if(!_0x4bee7a[_0x3e4551(0xc4)])throw new SDKError(ErrorCode[_0x3e4551(0xdd)],_0x3e4551(0x10e));const _0x564b7=getConsoleNextUrl(_0x228de2[_0x3e4551(0x105)],_0x3e4551(0x10a)+_0x4bee7a[_0x3e4551(0xea)]+_0x3e4551(0x130)+_0x4bee7a[_0x3e4551(0xc4)]);return console[_0x3e4551(0xd7)](a34_0x144162[_0x3e4551(0x108)]('βœ”')+'\x20Opening\x20'+a34_0x144162[_0x3e4551(0x14a)](_0x564b7)),openBrowser(_0x564b7),0x0;}if(_0x4bee7a['type']===_0x3e4551(0xf2)){if(!_0x4bee7a[_0x3e4551(0x147)])throw new SDKError(ErrorCode[_0x3e4551(0xc5)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x54b4cb=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4fb670[_0x3e4551(0x120)][_0x3e4551(0xf4)](_0x4bee7a[_0x3e4551(0x147)]),{'verbose':_0x228de2['verbose']});await handleSingleObjectOutput(_0x54b4cb[_0x3e4551(0xdb)],_0x228de2);}else{if(_0x4bee7a['type']==='segment'){if(!_0x4bee7a[_0x3e4551(0xc4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3e4551(0x10e));const _0x22b028=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4fb670[_0x3e4551(0x120)][_0x3e4551(0x11e)](_0x4bee7a[_0x3e4551(0xea)],_0x4bee7a['segmentId']),{'verbose':_0x228de2[_0x3e4551(0xf6)]}),_0x3c9e5f=getConsoleNextUrl(_0x228de2['site'],_0x3e4551(0x10a)+_0x4bee7a[_0x3e4551(0xea)]+_0x3e4551(0x130)+_0x4bee7a[_0x3e4551(0xc4)]),_0x469e71=_0x22b028['data'];_0x469e71[_0x3e4551(0x157)]=_0x3c9e5f,await handleSingleObjectOutput(_0x469e71,_0x228de2);}else return console[_0x3e4551(0xd7)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x3e4551(0xd7)](_0x3e4551(0xbe)),0x1;}return 0x0;}catch(_0xd59480){if(_0xd59480 instanceof SDKError)return console[_0x3e4551(0xd7)](_0x3e4551(0xa8)+_0xd59480[_0x3e4551(0x101)]),_0xd59480[_0x3e4551(0x14d)]&&console[_0x3e4551(0xd7)](_0x3e4551(0xc6)+_0xd59480[_0x3e4551(0x14d)]),0x1;throw _0xd59480;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a34_0x4a7319(0xb7)]=a34_0x4a7319(0xd6);[a34_0x4a7319(0xbf)]=a34_0x4a7319(0x139);async[a34_0x4a7319(0xb2)](_0x3b3875){const _0x5e8428=a34_0x4a7319,{options:_0x4c1ed9,args:_0x47b5d1,tdx:_0x26e214}=_0x3b3875,_0x5200ca=_0x47b5d1[0x0];if(!_0x5200ca)return console[_0x5e8428(0xd7)](_0x5e8428(0xbc)),console[_0x5e8428(0xd7)](_0x5e8428(0xdc)),console[_0x5e8428(0xd7)](_0x5e8428(0xd5)),console[_0x5e8428(0xd7)](_0x5e8428(0xfc)),console['error'](_0x5e8428(0x154)),console['error'](_0x5e8428(0xcd)),0x1;try{const _0x52e52b=_0x4c1ed9[_0x5e8428(0xb5)],_0x5d025=await resolveSegmentTarget(_0x5200ca,_0x52e52b,_0x4c1ed9[_0x5e8428(0xf6)]);_0x4c1ed9[_0x5e8428(0xf6)]&&console[_0x5e8428(0xd7)](_0x5e8428(0x123)+_0x5d025);const _0x47b2d9=await withSpinner('Resolving\x20\x27'+_0x5200ca+_0x5e8428(0x137),()=>_0x26e214[_0x5e8428(0x120)][_0x5e8428(0xe7)](_0x5d025),{'verbose':_0x4c1ed9[_0x5e8428(0xf6)]}),_0x267c37=_0x47b2d9[_0x5e8428(0xdb)];_0x4c1ed9[_0x5e8428(0xf6)]&&(console['error'](_0x5e8428(0x114)+_0x267c37[_0x5e8428(0x148)]),console['error'](_0x5e8428(0x145)+_0x267c37[_0x5e8428(0xea)]));if(_0x267c37[_0x5e8428(0x148)]===_0x5e8428(0xf2))return console[_0x5e8428(0xd7)](_0x5e8428(0xe2)),console[_0x5e8428(0xd7)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x267c37['type']==='parent')return console[_0x5e8428(0xd7)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5e8428(0xd7)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x267c37[_0x5e8428(0xc4)])throw new SDKError(ErrorCode[_0x5e8428(0xdd)],_0x5e8428(0x10e));const _0x3c2f0b=await withSpinner(_0x5e8428(0xd4),()=>_0x26e214[_0x5e8428(0x120)][_0x5e8428(0x122)](_0x267c37[_0x5e8428(0xea)],_0x267c37[_0x5e8428(0xc4)]),{'verbose':_0x4c1ed9[_0x5e8428(0xf6)]}),_0x44a78d=_0x3c2f0b[_0x5e8428(0xdb)],_0x5e1f19=await executeSchemaQuery(_0x44a78d,_0x26e214,_0x4c1ed9);return await handleQueryOutput(_0x5e1f19,_0x4c1ed9),0x0;}catch(_0x342164){if(_0x342164 instanceof SDKError)return console[_0x5e8428(0xd7)](_0x5e8428(0xa8)+_0x342164[_0x5e8428(0x101)]),_0x342164[_0x5e8428(0x14d)]&&console[_0x5e8428(0xd7)](_0x5e8428(0xc6)+_0x342164[_0x5e8428(0x14d)]),0x1;throw _0x342164;}}}
1
+ const a34_0x31dc82=a34_0x428b;(function(_0x12a14f,_0x4713e7){const _0x2111b6=a34_0x428b,_0x21a9e7=_0x12a14f();while(!![]){try{const _0x10e45b=parseInt(_0x2111b6(0x22a))/0x1*(-parseInt(_0x2111b6(0x210))/0x2)+parseInt(_0x2111b6(0x1fb))/0x3*(parseInt(_0x2111b6(0x1ce))/0x4)+-parseInt(_0x2111b6(0x21c))/0x5*(-parseInt(_0x2111b6(0x205))/0x6)+parseInt(_0x2111b6(0x20d))/0x7+parseInt(_0x2111b6(0x1f3))/0x8+-parseInt(_0x2111b6(0x213))/0x9*(parseInt(_0x2111b6(0x1c7))/0xa)+-parseInt(_0x2111b6(0x1c3))/0xb;if(_0x10e45b===_0x4713e7)break;else _0x21a9e7['push'](_0x21a9e7['shift']());}catch(_0x5283c1){_0x21a9e7['push'](_0x21a9e7['shift']());}}}(a34_0x16a3,0x9675b));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 a34_0x16a3(){const _0xfa15b4=['Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Folder\x20reference\x20is\x20required','format','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','content','url','9763744uFPABI','folder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','message','Resolved\x20parent\x20folder\x20ID:\x20','segment','\x20folder','Target\x20path:\x20','250791eAdncj','Get\x20SQL\x20query\x20for\x20child\x20segment','Folder\x20name:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20view','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folderPath','parentId','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Examples:','1264542NduMQZ','\x20\x20Folder\x20path:\x20','Resolving\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','web','segmentName','2771671YNdtxM','in\x20','resolveFolderId','2QUALnC','type','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','806607wuoHfJ','getSQLFromServerSegment','length','Parent\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','βœ”\x20Found\x20','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','information_schema','25ugEYKS','INVALID_ARGUMENT','βœ”\x20Created\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:folder:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentFolder','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','listFolders','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Show\x20segment\x20or\x20folder\x20details','data','processedRows','\x20[Job\x20ID:\x20','1053647flybtc','Folder\x20ID\x20missing\x20from\x20resolved\x20path','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Show\x20segment\x20folder\x20details','Usage:\x20tdx\x20sg\x20show\x20<name>','resolvePathToResource','\x20rows\x20','segment:sql','resolveParentId','Resolving\x20parent\x20segment\x20\x27','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','segmentPath','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','name','includes','segment:show','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Site:\x20','elapsedTimeMillis','\x20Opening\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20ID:\x20','execute','Parent\x20name:\x20','site','Fetching\x20folder\x20details...','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved\x20folder\x20ID:\x20','/e/','stats','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','test','setJobId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:folder:create','Error:\x20Path\x20or\x20name\x20is\x20required','getSegmentSQL','Resolved\x20type:\x20','\x27\x20with\x20ID:\x20','log','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20show','βœ”\x20Query\x20completed:\x20Processed\x20','getSegmentSQLFromYaml','json','Segment\x20ID:\x20','(root)','Fetching\x20segment\x20details...','SQL\x20query:\x0a','red','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','error','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Resolving\x20parent\x20folder\x20\x27','10936750WVmeRo','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','cause','Fetching\x20SQL\x20from\x20rule...','10cfcMFb','Parent\x20segment:\x20','getFolder','code','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','description','getSQLFromYamlFile','4IEbZYK','Resolved:\x20','segmentId','\x20\x20Cause:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20relative\x20path\x20to:\x20','segment:view','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','getSegment','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','parent','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','parentSegment','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','SEGMENT_NOT_FOUND','folderId','Usage:','Resolved\x20parent\x20ID:\x20','path','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','verbose','/app/ps/','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20','fullPath','Resolving\x20path\x20\x27','Creating\x20folder\x20\x27','Fetching\x20SQL\x20for\x20segment...'];a34_0x16a3=function(){return _0xfa15b4;};return a34_0x16a3();}function a34_0x428b(_0x5ce820,_0x252f66){_0x5ce820=_0x5ce820-0x1bf;const _0x16a305=a34_0x16a3();let _0x428bf7=_0x16a305[_0x5ce820];return _0x428bf7;}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 a34_0x29a598 from'chalk';async function resolveSegmentTarget(_0x38143c,_0xe862f3,_0x20ff6e){const _0x3e4173=a34_0x428b;if(isYamlFilePath(_0x38143c))try{const _0x37b539=await resolveYamlFilePath(_0x38143c);return _0x20ff6e&&(console[_0x3e4173(0x1bf)](_0x3e4173(0x23a)+_0x38143c),console[_0x3e4173(0x1bf)]('\x20\x20Parent\x20segment:\x20'+_0x37b539[_0x3e4173(0x1dc)]),console[_0x3e4173(0x1bf)]('\x20\x20Segment\x20name:\x20'+_0x37b539[_0x3e4173(0x20c)]),console[_0x3e4173(0x1bf)](_0x3e4173(0x206)+(_0x37b539[_0x3e4173(0x201)]||_0x3e4173(0x25c))),console['error'](_0x3e4173(0x260)+_0x37b539[_0x3e4173(0x1e9)])),_0x37b539[_0x3e4173(0x1e9)];}catch(_0x3d2da1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3e4173(0x212)+_0x3d2da1[_0x3e4173(0x1f6)]);}if(!_0xe862f3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3e4173(0x22c));return _0xe862f3+'/'+_0x38143c;}export class SegmentDescribeCommand extends BaseCommand{[a34_0x31dc82(0x237)]='segment:describe';['description']=a34_0x31dc82(0x226);async['execute'](_0x10798f){const _0x2d2b61=a34_0x31dc82,{options:_0x5b91e7,args:_0x282bf1,tdx:_0x52217c}=_0x10798f,_0x50616d=_0x282bf1[0x0],_0x4a442c=!_0x50616d&&!!_0x5b91e7[_0x2d2b61(0x1dc)],_0x2aaa95=_0x50616d||_0x5b91e7[_0x2d2b61(0x1dc)];if(!_0x2aaa95)return console[_0x2d2b61(0x1bf)](_0x2d2b61(0x24f)),console[_0x2d2b61(0x1bf)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2d2b61(0x1bf)](_0x2d2b61(0x204)),console[_0x2d2b61(0x1bf)](_0x2d2b61(0x1f5)),console[_0x2d2b61(0x1bf)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x2d2b61(0x1bf)](_0x2d2b61(0x208)),console['error'](_0x2d2b61(0x1d6)),0x1;try{const _0x18c29f=_0x5b91e7[_0x2d2b61(0x235)];let _0x472f33=_0x2aaa95;!_0x4a442c&&_0x18c29f&&!_0x2aaa95[_0x2d2b61(0x238)]('/')&&(_0x472f33=_0x18c29f+'/'+_0x2aaa95,_0x5b91e7[_0x2d2b61(0x1e4)]&&console['error'](_0x2d2b61(0x1d3)+_0x472f33));const _0x29c0db=await withSpinner(_0x2d2b61(0x1ea)+_0x472f33+_0x2d2b61(0x1e6),()=>_0x52217c[_0x2d2b61(0x1f8)][_0x2d2b61(0x22f)](_0x472f33),{'verbose':_0x5b91e7['verbose']}),_0x1d81cd=_0x29c0db['data'];_0x5b91e7[_0x2d2b61(0x1e4)]&&(console[_0x2d2b61(0x1bf)](_0x2d2b61(0x251)+_0x1d81cd[_0x2d2b61(0x211)]),console[_0x2d2b61(0x1bf)](_0x2d2b61(0x216)+_0x1d81cd['parentId']),_0x1d81cd[_0x2d2b61(0x1df)]&&console[_0x2d2b61(0x1bf)](_0x2d2b61(0x241)+_0x1d81cd[_0x2d2b61(0x1df)]),_0x1d81cd[_0x2d2b61(0x1d0)]&&console[_0x2d2b61(0x1bf)](_0x2d2b61(0x25b)+_0x1d81cd[_0x2d2b61(0x1d0)]));if(_0x1d81cd['type']==='parent'){const _0x3f1064=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x52217c[_0x2d2b61(0x1f8)]['getParent'](_0x1d81cd[_0x2d2b61(0x202)]),{'verbose':_0x5b91e7['verbose']});await handleSingleObjectOutput(_0x3f1064['data'],_0x5b91e7);}else{if(_0x1d81cd[_0x2d2b61(0x211)]===_0x2d2b61(0x1f4)){if(!_0x1d81cd['folderId'])throw new SDKError(ErrorCode[_0x2d2b61(0x262)],_0x2d2b61(0x22b));const _0x2d0ac1=await withSpinner(_0x2d2b61(0x245),()=>_0x52217c[_0x2d2b61(0x1f8)][_0x2d2b61(0x1c9)](_0x1d81cd[_0x2d2b61(0x1df)]),{'verbose':_0x5b91e7[_0x2d2b61(0x1e4)]});await handleSingleObjectOutput(_0x2d0ac1[_0x2d2b61(0x227)],_0x5b91e7);}else{if(_0x1d81cd[_0x2d2b61(0x211)]==='segment'){if(!_0x1d81cd[_0x2d2b61(0x1d0)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x370300=await withSpinner(_0x2d2b61(0x25d),()=>_0x52217c[_0x2d2b61(0x1f8)][_0x2d2b61(0x1d7)](_0x1d81cd[_0x2d2b61(0x202)],_0x1d81cd[_0x2d2b61(0x1d0)]),{'verbose':_0x5b91e7[_0x2d2b61(0x1e4)]});await handleSingleObjectOutput(_0x370300[_0x2d2b61(0x227)],_0x5b91e7);}}}return 0x0;}catch(_0x50f39f){if(_0x50f39f instanceof SDKError)return console[_0x2d2b61(0x1bf)](_0x2d2b61(0x1e8)+_0x50f39f[_0x2d2b61(0x1f6)]),_0x50f39f[_0x2d2b61(0x1c5)]&&console[_0x2d2b61(0x1bf)]('\x20\x20Cause:\x20'+_0x50f39f['cause']),0x1;throw _0x50f39f;}}}export class SegmentShowCommand extends BaseCommand{[a34_0x31dc82(0x237)]=a34_0x31dc82(0x239);[a34_0x31dc82(0x1cc)]=a34_0x31dc82(0x23c);async[a34_0x31dc82(0x242)](_0x645f13){const _0x1b1d6a=a34_0x31dc82,{options:_0xa00aa2,args:_0x2c1771,tdx:_0x3437af}=_0x645f13,_0x17abf6=_0x2c1771[0x0];if(!_0x17abf6)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x22e)),console['error'](_0x1b1d6a(0x255)),console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x204)),console[_0x1b1d6a(0x1bf)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x1b1d6a(0x1bf)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x32a345=_0xa00aa2['parentSegment'],_0x4d44fb=await resolveSegmentTarget(_0x17abf6,_0x32a345,_0xa00aa2[_0x1b1d6a(0x1e4)]);_0xa00aa2[_0x1b1d6a(0x1e4)]&&console['error']('Target\x20path:\x20'+_0x4d44fb);const _0x392671=await withSpinner('Resolving\x20\x27'+_0x17abf6+_0x1b1d6a(0x1e6),()=>_0x3437af[_0x1b1d6a(0x1f8)][_0x1b1d6a(0x22f)](_0x4d44fb),{'verbose':_0xa00aa2['verbose']}),_0x5a9e95=_0x392671[_0x1b1d6a(0x227)];_0xa00aa2[_0x1b1d6a(0x1e4)]&&(console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x251)+_0x5a9e95[_0x1b1d6a(0x211)]),console[_0x1b1d6a(0x1bf)]('Parent\x20ID:\x20'+_0x5a9e95[_0x1b1d6a(0x202)]));if(_0x5a9e95[_0x1b1d6a(0x211)]===_0x1b1d6a(0x1f4))return console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x1c0)),console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x1c4)),0x1;if(_0x5a9e95[_0x1b1d6a(0x211)]===_0x1b1d6a(0x1da))return console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x256)),console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x257)),0x1;if(!_0x5a9e95['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x530f2e=await withSpinner(_0x1b1d6a(0x1ec),()=>_0x3437af[_0x1b1d6a(0x1f8)][_0x1b1d6a(0x250)](_0x5a9e95[_0x1b1d6a(0x202)],_0x5a9e95['segmentId']),{'verbose':_0xa00aa2[_0x1b1d6a(0x1e4)]});let _0x23ef92=_0x530f2e[_0x1b1d6a(0x227)];const _0x3b9e21=resolveLimit(_0xa00aa2['limit'],DEFAULT_DISPLAY_LIMIT),_0x14a2ae=/\bLIMIT\s+\d+/i[_0x1b1d6a(0x24b)](_0x23ef92);!_0x14a2ae&&(_0x23ef92=_0x23ef92['trim']()['replace'](/;+$/,''),_0x23ef92='SELECT\x20*\x20FROM\x20(\x0a'+_0x23ef92+_0x1b1d6a(0x1d9)+_0x3b9e21);_0xa00aa2['verbose']&&console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x25e)+_0x23ef92);const _0x32f6e6=await withProgressSpinner('Executing\x20segment\x20query...',async _0x18587d=>{const _0x2d43c4=_0x1b1d6a,_0x1f508c=await _0x3437af['query'][_0x2d43c4(0x242)](_0x23ef92,{'catalog':'td','schema':_0x2d43c4(0x21b),'onJobId':_0x4bbf79=>{const _0x32f96f=_0x2d43c4;_0x18587d[_0x32f96f(0x24c)](_0x4bbf79);}});return _0x1f508c;},{'verbose':_0xa00aa2['verbose']}),_0x190433=_0x32f6e6[_0x1b1d6a(0x227)],_0x396b9d=_0x190433[_0x1b1d6a(0x219)]?_0x1b1d6a(0x229)+_0x190433['jobId']+']':'';return console[_0x1b1d6a(0x1bf)](_0x1b1d6a(0x258)+_0x190433['stats'][_0x1b1d6a(0x228)]['toLocaleString']()+_0x1b1d6a(0x230)+(_0x1b1d6a(0x20e)+formatElapsed(_0x190433[_0x1b1d6a(0x249)][_0x1b1d6a(0x23e)])+_0x396b9d)),await handleQueryOutput(_0x190433,_0xa00aa2),0x0;}catch(_0x5e8c1f){if(_0x5e8c1f instanceof SDKError)return console[_0x1b1d6a(0x1bf)]('βœ–\x20Query\x20failed\x20['+_0x5e8c1f[_0x1b1d6a(0x1ca)]+']'),console['error']('\x0a'+_0x5e8c1f[_0x1b1d6a(0x1f6)]),0x1;throw _0x5e8c1f;}}}export class SegmentFolderListCommand extends BaseCommand{[a34_0x31dc82(0x237)]=a34_0x31dc82(0x220);[a34_0x31dc82(0x1cc)]=a34_0x31dc82(0x24a);async[a34_0x31dc82(0x242)](_0x263ac2){const _0x2f498f=a34_0x31dc82,{options:_0x4d92d5,args:_0x427f6c,tdx:_0x1c628e}=_0x263ac2;if(_0x427f6c['length']===0x0)return console[_0x2f498f(0x1bf)](_0x2f498f(0x21f)),console[_0x2f498f(0x1bf)](_0x2f498f(0x261)),0x1;const _0xe0951c=_0x427f6c[0x0];try{_0x4d92d5[_0x2f498f(0x1e4)]&&(console[_0x2f498f(0x1bf)](_0x2f498f(0x23d)+_0x4d92d5['site']),console['error'](_0x2f498f(0x243)+_0xe0951c));const _0x58053b=await withSpinner(_0x2f498f(0x233)+_0xe0951c+_0x2f498f(0x1e6),()=>_0x1c628e[_0x2f498f(0x1f8)]['resolveParentId'](_0xe0951c),{'verbose':_0x4d92d5[_0x2f498f(0x1e4)]}),_0x27d507=_0x58053b['data'];_0x4d92d5[_0x2f498f(0x1e4)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x27d507);const _0xa9cfd5=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0xe0951c+_0x2f498f(0x1e6),()=>_0x1c628e[_0x2f498f(0x1f8)][_0x2f498f(0x224)](_0x27d507),{'verbose':_0x4d92d5[_0x2f498f(0x1e4)]}),_0x61c65d=_0xa9cfd5['data'];return console[_0x2f498f(0x1bf)](_0x2f498f(0x218)+_0x61c65d[_0x2f498f(0x215)]+_0x2f498f(0x1f9)+(_0x61c65d[_0x2f498f(0x215)]!==0x1?'s':'')),await handleSDKOutput(_0x61c65d,_0x4d92d5),0x0;}catch(_0x2008eb){if(_0x2008eb instanceof SDKError)return console[_0x2f498f(0x1bf)](_0x2f498f(0x1e8)+_0x2008eb[_0x2f498f(0x1f6)]),_0x2008eb[_0x2f498f(0x1c5)]&&console[_0x2f498f(0x1bf)](_0x2f498f(0x1d1)+_0x2008eb['cause']),0x1;throw _0x2008eb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a34_0x31dc82(0x237)]='segment:folder:show';['description']=a34_0x31dc82(0x22d);async[a34_0x31dc82(0x242)](_0x5a776c){const _0x499cc1=a34_0x31dc82,{options:_0x1c0609,args:_0x494db2,tdx:_0x24a3f1}=_0x5a776c;if(_0x494db2['length']===0x0)return console[_0x499cc1(0x1bf)](_0x499cc1(0x1ee)),console['error'](_0x499cc1(0x20a)),0x1;try{const {parentId:_0x138110,childId:_0x5e4b4a}=parseSegmentRef(_0x494db2[0x0]);_0x1c0609['verbose']&&(console['error'](_0x499cc1(0x23d)+_0x1c0609[_0x499cc1(0x244)]),console[_0x499cc1(0x1bf)]('Parent\x20name:\x20'+_0x138110),_0x5e4b4a&&console[_0x499cc1(0x1bf)](_0x499cc1(0x1fd)+_0x5e4b4a));if(!_0x5e4b4a)return console[_0x499cc1(0x1bf)](_0x499cc1(0x24d)),0x1;const _0x2f739a=await withSpinner(_0x499cc1(0x233)+_0x138110+'\x27...',()=>_0x24a3f1[_0x499cc1(0x1f8)]['resolveParentId'](_0x138110),{'verbose':_0x1c0609[_0x499cc1(0x1e4)]}),_0x4de0c6=_0x2f739a['data'];_0x1c0609[_0x499cc1(0x1e4)]&&console[_0x499cc1(0x1bf)](_0x499cc1(0x1e1)+_0x4de0c6);const _0x317ee8=await withSpinner('Resolving\x20folder\x20\x27'+_0x5e4b4a+'\x27...',()=>_0x24a3f1[_0x499cc1(0x1f8)][_0x499cc1(0x20f)](_0x4de0c6,_0x5e4b4a),{'verbose':_0x1c0609[_0x499cc1(0x1e4)]}),_0x1112d7=_0x317ee8['data'];_0x1c0609[_0x499cc1(0x1e4)]&&console[_0x499cc1(0x1bf)](_0x499cc1(0x247)+_0x1112d7);const _0x1e5277=await withSpinner('Fetching\x20folder\x20\x27'+_0x5e4b4a+_0x499cc1(0x1e6),()=>_0x24a3f1['segment'][_0x499cc1(0x1c9)](_0x1112d7),{'verbose':_0x1c0609[_0x499cc1(0x1e4)]});return await handleSDKOutput([_0x1e5277[_0x499cc1(0x227)]],_0x1c0609),0x0;}catch(_0x3216d9){if(_0x3216d9 instanceof SDKError)return console['error'](_0x499cc1(0x1e8)+_0x3216d9[_0x499cc1(0x1f6)]),_0x3216d9[_0x499cc1(0x1c5)]&&console[_0x499cc1(0x1bf)](_0x499cc1(0x1d1)+_0x3216d9[_0x499cc1(0x1c5)]),0x1;throw _0x3216d9;}}}export class SegmentSQLCommand extends BaseCommand{[a34_0x31dc82(0x237)]=a34_0x31dc82(0x231);[a34_0x31dc82(0x1cc)]=a34_0x31dc82(0x1fc);async['execute'](_0xc39215){const _0x41c9df=a34_0x31dc82,{options:_0x14b200,args:_0x1dfa81}=_0xc39215,_0xe5c904=_0x14b200,_0x32c78d=_0xe5c904[_0x41c9df(0x1e2)],_0x16c2a7=_0x1dfa81[0x0];if(!_0x16c2a7&&!_0x32c78d)return console[_0x41c9df(0x1bf)](a34_0x29a598['red'](_0x41c9df(0x1e3))),console[_0x41c9df(0x1bf)](_0x41c9df(0x1e0)),console[_0x41c9df(0x1bf)](_0x41c9df(0x236)),console['error'](_0x41c9df(0x1dd)),console['error'](_0x41c9df(0x204)),console[_0x41c9df(0x1bf)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x41c9df(0x1bf)](_0x41c9df(0x23b)),0x1;if(_0x16c2a7&&_0x32c78d)return console[_0x41c9df(0x1bf)](a34_0x29a598[_0x41c9df(0x25f)](_0x41c9df(0x1d8))),0x1;try{let _0x13a82f;if(_0x32c78d)_0x13a82f=await this[_0x41c9df(0x1cd)](_0x32c78d,_0xc39215);else{if(isYamlFilePath(_0x16c2a7))return console[_0x41c9df(0x1bf)](a34_0x29a598[_0x41c9df(0x25f)](_0x41c9df(0x1c1))),console['error'](_0x41c9df(0x225)+_0x16c2a7),0x1;else _0x13a82f=await this[_0x41c9df(0x214)](_0x16c2a7,_0xc39215);}return _0x14b200['format']===_0x41c9df(0x25a)||_0x14b200[_0x41c9df(0x1ef)]==='jsonl'?await handleSDKOutput([{'sql':_0x13a82f}],_0x14b200):console[_0x41c9df(0x253)](_0x13a82f),0x0;}catch(_0x56e687){if(_0x56e687 instanceof SDKError)return console[_0x41c9df(0x1bf)](_0x41c9df(0x1e8)+_0x56e687[_0x41c9df(0x1f6)]),_0x56e687['cause']&&console[_0x41c9df(0x1bf)](_0x41c9df(0x1d1)+_0x56e687[_0x41c9df(0x1c5)]),0x1;throw _0x56e687;}}async[a34_0x31dc82(0x1cd)](_0xcba019,_0x1bdd6b){const _0x5af065=a34_0x31dc82,{options:_0x53211c,tdx:_0x45a12f}=_0x1bdd6b;let _0x1ae52c;try{_0x1ae52c=await resolveYamlFilePath(_0xcba019);}catch(_0x282cf6){throw new SDKError(ErrorCode[_0x5af065(0x21d)],_0x5af065(0x212)+_0x282cf6[_0x5af065(0x1f6)]);}_0x53211c['verbose']&&console[_0x5af065(0x1bf)](_0x5af065(0x1cf)+_0x1ae52c[_0x5af065(0x1dc)]+'/'+_0x1ae52c[_0x5af065(0x20c)]);const _0x334ad7=await withSpinner(_0x5af065(0x1c6),()=>_0x45a12f[_0x5af065(0x1f8)][_0x5af065(0x259)](_0x1ae52c[_0x5af065(0x1f1)],_0x1ae52c[_0x5af065(0x1dc)],_0x1ae52c[_0x5af065(0x20c)]),{'verbose':_0x53211c[_0x5af065(0x1e4)]});return _0x334ad7[_0x5af065(0x227)];}async[a34_0x31dc82(0x214)](_0x486cb3,_0x2f32d8){const _0x382e0a=a34_0x31dc82,{options:_0x25c2e7,tdx:_0x318e9d}=_0x2f32d8,_0x10de19=_0x25c2e7[_0x382e0a(0x1dc)],_0x4da5ff=await resolveSegmentTarget(_0x486cb3,_0x10de19,_0x25c2e7[_0x382e0a(0x1e4)]);_0x25c2e7[_0x382e0a(0x1e4)]&&console['error'](_0x382e0a(0x1fa)+_0x4da5ff);const _0x4865ba=await withSpinner(_0x382e0a(0x207)+_0x486cb3+_0x382e0a(0x1e6),()=>_0x318e9d[_0x382e0a(0x1f8)][_0x382e0a(0x22f)](_0x4da5ff),{'verbose':_0x25c2e7[_0x382e0a(0x1e4)]}),_0x2fdcb7=_0x4865ba[_0x382e0a(0x227)];_0x25c2e7[_0x382e0a(0x1e4)]&&(console[_0x382e0a(0x1bf)](_0x382e0a(0x251)+_0x2fdcb7[_0x382e0a(0x211)]),console[_0x382e0a(0x1bf)](_0x382e0a(0x216)+_0x2fdcb7[_0x382e0a(0x202)]));if(_0x2fdcb7[_0x382e0a(0x211)]===_0x382e0a(0x1f4))throw new SDKError(ErrorCode[_0x382e0a(0x21d)],_0x382e0a(0x1d2));if(_0x2fdcb7[_0x382e0a(0x211)]===_0x382e0a(0x1da))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x382e0a(0x234));if(!_0x2fdcb7[_0x382e0a(0x1d0)])throw new SDKError(ErrorCode[_0x382e0a(0x1de)],_0x382e0a(0x1d5));const _0x244cfe=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x318e9d['segment'][_0x382e0a(0x250)](_0x2fdcb7[_0x382e0a(0x202)],_0x2fdcb7[_0x382e0a(0x1d0)]),{'verbose':_0x25c2e7[_0x382e0a(0x1e4)]});return _0x244cfe[_0x382e0a(0x227)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a34_0x31dc82(0x237)]=a34_0x31dc82(0x24e);[a34_0x31dc82(0x1cc)]='Create\x20segment\x20folder\x20for\x20organization';async[a34_0x31dc82(0x242)](_0x1e8a22){const _0x3508fd=a34_0x31dc82,{options:_0x249235,args:_0x580a6a,tdx:_0xa604cb}=_0x1e8a22,_0x23b305=_0x249235;if(_0x580a6a['length']<0x2)return console['error']('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x3508fd(0x1bf)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x4bf76a=_0x580a6a[0x0],_0x157546=_0x580a6a[0x1];_0x23b305[_0x3508fd(0x1e4)]&&(console['error']('Site:\x20'+_0x23b305[_0x3508fd(0x244)]),console[_0x3508fd(0x1bf)](_0x3508fd(0x1c8)+_0x4bf76a),console[_0x3508fd(0x1bf)](_0x3508fd(0x1fd)+_0x157546));let _0x34b849;if(_0x23b305[_0x3508fd(0x222)]){const _0x1169c7=_0x23b305[_0x3508fd(0x222)],_0x10a312=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4bf76a+'\x27...',()=>_0xa604cb[_0x3508fd(0x1f8)][_0x3508fd(0x232)](_0x4bf76a),{'verbose':_0x23b305['verbose']}),_0x5ebf72=_0x10a312[_0x3508fd(0x227)],_0x129aeb=await withSpinner(_0x3508fd(0x1c2)+_0x1169c7+_0x3508fd(0x1e6),()=>_0xa604cb[_0x3508fd(0x1f8)][_0x3508fd(0x20f)](_0x5ebf72,_0x1169c7),{'verbose':_0x23b305[_0x3508fd(0x1e4)]});_0x34b849=_0x129aeb[_0x3508fd(0x227)],_0x23b305[_0x3508fd(0x1e4)]&&console[_0x3508fd(0x1bf)](_0x3508fd(0x1f7)+_0x34b849);}const _0x3b97df={'name':_0x157546,'description':_0x23b305[_0x3508fd(0x1cc)],'parentFolderId':_0x34b849},_0x41b0ff=await withSpinner(_0x3508fd(0x1eb)+_0x157546+_0x3508fd(0x1e6),()=>_0xa604cb[_0x3508fd(0x1f8)]['createFolder'](_0x4bf76a,_0x3b97df),{'verbose':_0x23b305[_0x3508fd(0x1e4)]}),_0x4c5260=_0x41b0ff[_0x3508fd(0x227)];return console['error'](_0x3508fd(0x21e)+_0x4c5260[_0x3508fd(0x237)]+_0x3508fd(0x252)+_0x4c5260['id']),await handleSDKOutput([_0x4c5260],_0x23b305),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a34_0x31dc82(0x1d4);[a34_0x31dc82(0x1cc)]=a34_0x31dc82(0x1fe);async[a34_0x31dc82(0x242)](_0x15a58b){const _0x5e8044=a34_0x31dc82,{options:_0x410800,args:_0x170ccb,tdx:_0x388653}=_0x15a58b,_0x434929=_0x170ccb[0x0];if(!_0x434929)return console[_0x5e8044(0x1bf)](_0x5e8044(0x203)),console[_0x5e8044(0x1bf)](_0x5e8044(0x246)),console[_0x5e8044(0x1bf)](_0x5e8044(0x1e7)),console[_0x5e8044(0x1bf)]('Options:'),console[_0x5e8044(0x1bf)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x5e8044(0x204)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x5e8044(0x1bf)](_0x5e8044(0x263)),console['error'](_0x5e8044(0x21a)),console[_0x5e8044(0x1bf)](_0x5e8044(0x1db)),0x1;try{const _0xacd31b=_0x410800[_0x5e8044(0x1dc)],_0x363667=await resolveSegmentTarget(_0x434929,_0xacd31b,_0x410800[_0x5e8044(0x1e4)]);_0x410800[_0x5e8044(0x1e4)]&&console[_0x5e8044(0x1bf)](_0x5e8044(0x1fa)+_0x363667);const _0x21fb7e=await withSpinner('Resolving\x20\x27'+_0x434929+'\x27...',()=>_0x388653[_0x5e8044(0x1f8)][_0x5e8044(0x22f)](_0x363667),{'verbose':_0x410800[_0x5e8044(0x1e4)]}),_0x472097=_0x21fb7e[_0x5e8044(0x227)];_0x410800[_0x5e8044(0x1e4)]&&(console[_0x5e8044(0x1bf)](_0x5e8044(0x251)+_0x472097[_0x5e8044(0x211)]),console[_0x5e8044(0x1bf)](_0x5e8044(0x216)+_0x472097[_0x5e8044(0x202)]),_0x472097[_0x5e8044(0x1df)]&&console['error'](_0x5e8044(0x241)+_0x472097['folderId']),_0x472097[_0x5e8044(0x1d0)]&&console[_0x5e8044(0x1bf)](_0x5e8044(0x25b)+_0x472097[_0x5e8044(0x1d0)]));if(_0x410800[_0x5e8044(0x20b)]){if(_0x472097['type']==='folder')return console['error'](_0x5e8044(0x1f0)),0x1;if(_0x472097['type']==='parent')return console[_0x5e8044(0x1bf)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5e8044(0x1bf)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x472097['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x7d2789=getConsoleNextUrl(_0x410800[_0x5e8044(0x244)],_0x5e8044(0x1e5)+_0x472097[_0x5e8044(0x202)]+_0x5e8044(0x248)+_0x472097[_0x5e8044(0x1d0)]);return console[_0x5e8044(0x1bf)](a34_0x29a598[_0x5e8044(0x254)]('βœ”')+_0x5e8044(0x23f)+a34_0x29a598['cyan'](_0x7d2789)),openBrowser(_0x7d2789),0x0;}if(_0x472097['type']===_0x5e8044(0x1f4)){if(!_0x472097['folderId'])throw new SDKError(ErrorCode[_0x5e8044(0x262)],_0x5e8044(0x22b));const _0x496d6c=await withSpinner(_0x5e8044(0x245),()=>_0x388653[_0x5e8044(0x1f8)][_0x5e8044(0x1c9)](_0x472097['folderId']),{'verbose':_0x410800['verbose']});await handleSingleObjectOutput(_0x496d6c['data'],_0x410800);}else{if(_0x472097['type']==='segment'){if(!_0x472097[_0x5e8044(0x1d0)])throw new SDKError(ErrorCode[_0x5e8044(0x1de)],_0x5e8044(0x1d5));const _0x3275a6=await withSpinner(_0x5e8044(0x25d),()=>_0x388653[_0x5e8044(0x1f8)][_0x5e8044(0x1d7)](_0x472097[_0x5e8044(0x202)],_0x472097[_0x5e8044(0x1d0)]),{'verbose':_0x410800[_0x5e8044(0x1e4)]}),_0x4cc02a=getConsoleNextUrl(_0x410800[_0x5e8044(0x244)],_0x5e8044(0x1e5)+_0x472097['parentId']+_0x5e8044(0x248)+_0x472097[_0x5e8044(0x1d0)]),_0x595ce0=_0x3275a6[_0x5e8044(0x227)];_0x595ce0[_0x5e8044(0x1f2)]=_0x4cc02a,await handleSingleObjectOutput(_0x595ce0,_0x410800);}else return console[_0x5e8044(0x1bf)](_0x5e8044(0x240)),console[_0x5e8044(0x1bf)](_0x5e8044(0x1ff)),0x1;}return 0x0;}catch(_0x351aad){if(_0x351aad instanceof SDKError)return console['error'](_0x5e8044(0x1e8)+_0x351aad['message']),_0x351aad['cause']&&console[_0x5e8044(0x1bf)](_0x5e8044(0x1d1)+_0x351aad[_0x5e8044(0x1c5)]),0x1;throw _0x351aad;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a34_0x31dc82(0x237)]='segment:desc';[a34_0x31dc82(0x1cc)]=a34_0x31dc82(0x209);async['execute'](_0x1a94b1){const _0x3c8ada=a34_0x31dc82,{options:_0x3772bb,args:_0x11ec85,tdx:_0x44852}=_0x1a94b1,_0x14319e=_0x11ec85[0x0];if(!_0x14319e)return console[_0x3c8ada(0x1bf)](_0x3c8ada(0x200)),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x217)),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x221)),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x204)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x223)),0x1;try{const _0x9ffd38=_0x3772bb[_0x3c8ada(0x1dc)],_0x43947d=await resolveSegmentTarget(_0x14319e,_0x9ffd38,_0x3772bb[_0x3c8ada(0x1e4)]);_0x3772bb[_0x3c8ada(0x1e4)]&&console[_0x3c8ada(0x1bf)](_0x3c8ada(0x1fa)+_0x43947d);const _0x4516ff=await withSpinner(_0x3c8ada(0x207)+_0x14319e+_0x3c8ada(0x1e6),()=>_0x44852[_0x3c8ada(0x1f8)][_0x3c8ada(0x22f)](_0x43947d),{'verbose':_0x3772bb[_0x3c8ada(0x1e4)]}),_0x45806d=_0x4516ff[_0x3c8ada(0x227)];_0x3772bb[_0x3c8ada(0x1e4)]&&(console[_0x3c8ada(0x1bf)]('Resolved\x20type:\x20'+_0x45806d[_0x3c8ada(0x211)]),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x216)+_0x45806d['parentId']));if(_0x45806d[_0x3c8ada(0x211)]===_0x3c8ada(0x1f4))return console[_0x3c8ada(0x1bf)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x3c8ada(0x1bf)](_0x3c8ada(0x1ed)),0x1;if(_0x45806d[_0x3c8ada(0x211)]==='parent')return console[_0x3c8ada(0x1bf)](_0x3c8ada(0x1cb)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x45806d[_0x3c8ada(0x1d0)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5d7835=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x44852[_0x3c8ada(0x1f8)][_0x3c8ada(0x250)](_0x45806d['parentId'],_0x45806d['segmentId']),{'verbose':_0x3772bb['verbose']}),_0x5b9b85=_0x5d7835[_0x3c8ada(0x227)],_0x4b3ff7=await executeSchemaQuery(_0x5b9b85,_0x44852,_0x3772bb);return await handleQueryOutput(_0x4b3ff7,_0x3772bb),0x0;}catch(_0x1b16db){if(_0x1b16db instanceof SDKError)return console[_0x3c8ada(0x1bf)](_0x3c8ada(0x1e8)+_0x1b16db[_0x3c8ada(0x1f6)]),_0x1b16db[_0x3c8ada(0x1c5)]&&console[_0x3c8ada(0x1bf)](_0x3c8ada(0x1d1)+_0x1b16db['cause']),0x1;throw _0x1b16db;}}}
@@ -1 +1 @@
1
- function a35_0x52b6(){const _0x2f7b27=['939816bEXpDA','verbose','folderId','\x27...','\x20\x20\x20Path:\x20','4803042ebOlHb','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Resolved\x20relative\x20path\x20to:\x20','Site:\x20','kind','ruleFile','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segment','segmentPath','22955128SlMQDq','type','segments','includes','βœ”\x20Created\x20segment\x20\x27','631608ePZAje','Parent\x20path:\x20','site','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','512128bDtRVN','folder','\x27\x20with\x20ID:\x20','7nCjSiN','resolvePathToResource','resolveFolderId','Resolving\x20folder\x20\x27','Target\x20path:\x20','957256YXJEdc','Resolved\x20folder\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','6720645DuTNtk','data','invisible','length','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20folder\x20path\x20\x27','execute','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','noCountPopulation','description','Resolving\x20parent\x20segment\x20\x27'];a35_0x52b6=function(){return _0x2f7b27;};return a35_0x52b6();}const a35_0x459d9c=a35_0x53a4;(function(_0x4bcd5e,_0x138681){const _0x50f358=a35_0x53a4,_0x3e53f2=_0x4bcd5e();while(!![]){try{const _0x168457=parseInt(_0x50f358(0x1f6))/0x1+parseInt(_0x50f358(0x1fe))/0x2+parseInt(_0x50f358(0x1de))/0x3+parseInt(_0x50f358(0x1f2))/0x4+parseInt(_0x50f358(0x202))/0x5+parseInt(_0x50f358(0x1e3))/0x6+-parseInt(_0x50f358(0x1f9))/0x7*(parseInt(_0x50f358(0x1ed))/0x8);if(_0x168457===_0x138681)break;else _0x3e53f2['push'](_0x3e53f2['shift']());}catch(_0x3afe54){_0x3e53f2['push'](_0x3e53f2['shift']());}}}(a35_0x52b6,0xb3f97));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a35_0x53a4(_0x3233b7,_0x3e9faf){_0x3233b7=_0x3233b7-0x1db;const _0x52b6bb=a35_0x52b6();let _0x53a44b=_0x52b6bb[_0x3233b7];return _0x53a44b;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a35_0x5e1a7c from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';[a35_0x459d9c(0x1dc)]=a35_0x459d9c(0x209);async[a35_0x459d9c(0x208)](_0x141ba2){const _0x5499f5=a35_0x459d9c;console[_0x5499f5(0x1e9)](a35_0x5e1a7c[_0x5499f5(0x20b)](_0x5499f5(0x1e4))),console[_0x5499f5(0x1e9)](a35_0x5e1a7c[_0x5499f5(0x20b)](_0x5499f5(0x20a)));const {options:_0x1d0154,args:_0x51eb9d,tdx:_0x154fd1}=_0x141ba2,_0x259f56=_0x1d0154;if(_0x51eb9d[_0x5499f5(0x205)]===0x0)return console[_0x5499f5(0x1e9)](_0x5499f5(0x200)),console[_0x5499f5(0x1e9)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error']('Examples:'),console['error'](_0x5499f5(0x201)),console[_0x5499f5(0x1e9)](_0x5499f5(0x1ea)),console[_0x5499f5(0x1e9)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x43ab2b=_0x51eb9d[0x0],_0x5e8f5d=_0x1d0154[_0x5499f5(0x1ec)];let _0x52f238=_0x43ab2b;_0x5e8f5d&&!_0x43ab2b[_0x5499f5(0x1f0)]('/')&&(_0x52f238=_0x5e8f5d+'/'+_0x43ab2b,_0x259f56[_0x5499f5(0x1df)]&&console['error'](_0x5499f5(0x1e5)+_0x52f238));const _0x12a905=parsePath(_0x52f238);if(_0x12a905[_0x5499f5(0x1ef)][_0x5499f5(0x205)]<0x2)return console[_0x5499f5(0x1e9)](_0x5499f5(0x206)),console['error'](_0x5499f5(0x1f5)),0x1;const _0x47c0b8=_0x12a905[_0x5499f5(0x1ef)][0x0],_0x490ed3=getBaseName(_0x52f238),_0x3f2664=getParentPath(_0x52f238);_0x259f56[_0x5499f5(0x1df)]&&(console[_0x5499f5(0x1e9)](_0x5499f5(0x1e6)+_0x259f56[_0x5499f5(0x1f4)]),console[_0x5499f5(0x1e9)](_0x5499f5(0x1fd)+_0x52f238),console[_0x5499f5(0x1e9)]('Parent:\x20'+_0x47c0b8),console['error']('Segment\x20name:\x20'+_0x490ed3),console[_0x5499f5(0x1e9)](_0x5499f5(0x1f3)+_0x3f2664));const _0x4eb87a=await withSpinner(_0x5499f5(0x1dd)+_0x47c0b8+'\x27...',()=>_0x154fd1[_0x5499f5(0x1eb)]['resolveParentId'](_0x47c0b8),{'verbose':_0x259f56[_0x5499f5(0x1df)]}),_0x14921c=_0x4eb87a['data'];let _0xbfd6c;if(_0x12a905['segments'][_0x5499f5(0x205)]>0x2){const _0x35d549=await withSpinner(_0x5499f5(0x207)+_0x3f2664+'\x27...',()=>_0x154fd1[_0x5499f5(0x1eb)][_0x5499f5(0x1fa)](_0x3f2664),{'verbose':_0x259f56[_0x5499f5(0x1df)]}),_0x52a3cb=_0x35d549[_0x5499f5(0x203)];if(_0x52a3cb['type']!==_0x5499f5(0x1f7)&&_0x52a3cb[_0x5499f5(0x1ee)]!=='parent')return console[_0x5499f5(0x1e9)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xbfd6c=_0x52a3cb[_0x5499f5(0x1e0)];}else{if(_0x259f56['folder']){const _0x545e3d=await withSpinner(_0x5499f5(0x1fc)+_0x259f56[_0x5499f5(0x1f7)]+_0x5499f5(0x1e1),()=>_0x154fd1[_0x5499f5(0x1eb)][_0x5499f5(0x1fb)](_0x14921c,_0x259f56[_0x5499f5(0x1f7)]),{'verbose':_0x259f56[_0x5499f5(0x1df)]});_0xbfd6c=_0x545e3d[_0x5499f5(0x203)];}}_0x259f56[_0x5499f5(0x1df)]&&_0xbfd6c&&console[_0x5499f5(0x1e9)](_0x5499f5(0x1ff)+_0xbfd6c);const _0x3ec448=await loadJSONFromOptions(_0x259f56['rule'],_0x259f56[_0x5499f5(0x1e8)]),_0x21289d={'name':_0x490ed3,'description':_0x259f56['description'],'rule':_0x3ec448,'kind':_0x259f56[_0x5499f5(0x1e7)]!==undefined?parseInt(_0x259f56['kind'],0xa):undefined,'isVisible':_0x259f56[_0x5499f5(0x204)]?![]:undefined,'segmentFolderId':_0xbfd6c,'countPopulation':_0x259f56[_0x5499f5(0x1db)]?![]:undefined},_0x407d40=await withSpinner('Creating\x20segment\x20\x27'+_0x490ed3+'\x27...',()=>_0x154fd1['segment']['createSegment'](_0x14921c,_0x21289d),{'verbose':_0x259f56[_0x5499f5(0x1df)]}),_0x1dfefd=_0x407d40['data'];return console['error'](_0x5499f5(0x1f1)+_0x1dfefd['name']+_0x5499f5(0x1f8)+_0x1dfefd['id']),_0x52f238!==_0x43ab2b&&console[_0x5499f5(0x1e9)](_0x5499f5(0x1e2)+_0x52f238),await handleSDKOutput([_0x1dfefd],_0x259f56),0x0;}}
1
+ function a35_0x5e58(_0x51ea04,_0x127ed6){_0x51ea04=_0x51ea04-0x1cc;const _0x27420b=a35_0x2742();let _0x5e58bb=_0x27420b[_0x51ea04];return _0x5e58bb;}const a35_0x292d5d=a35_0x5e58;(function(_0x43c716,_0x3356bd){const _0x1053a9=a35_0x5e58,_0x24b0a5=_0x43c716();while(!![]){try{const _0x3cd127=parseInt(_0x1053a9(0x1e0))/0x1*(-parseInt(_0x1053a9(0x1eb))/0x2)+parseInt(_0x1053a9(0x1d7))/0x3*(-parseInt(_0x1053a9(0x1f0))/0x4)+-parseInt(_0x1053a9(0x1f2))/0x5+-parseInt(_0x1053a9(0x1f1))/0x6+-parseInt(_0x1053a9(0x1fc))/0x7+-parseInt(_0x1053a9(0x1dc))/0x8+-parseInt(_0x1053a9(0x1db))/0x9*(-parseInt(_0x1053a9(0x1ee))/0xa);if(_0x3cd127===_0x3356bd)break;else _0x24b0a5['push'](_0x24b0a5['shift']());}catch(_0x500b64){_0x24b0a5['push'](_0x24b0a5['shift']());}}}(a35_0x2742,0xe5db0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a35_0x842d61 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a35_0x292d5d(0x1e4)]=a35_0x292d5d(0x1ce);[a35_0x292d5d(0x1f4)]=a35_0x292d5d(0x1f8);async[a35_0x292d5d(0x1e8)](_0x172446){const _0x4ba574=a35_0x292d5d;console[_0x4ba574(0x1f9)](a35_0x842d61[_0x4ba574(0x1de)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a35_0x842d61[_0x4ba574(0x1de)](_0x4ba574(0x1e1)));const {options:_0x365a01,args:_0x35d533,tdx:_0x18353a}=_0x172446,_0x3cf102=_0x365a01;if(_0x35d533[_0x4ba574(0x1da)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x4ba574(0x1f9)](_0x4ba574(0x1ea)),console[_0x4ba574(0x1f9)](_0x4ba574(0x1d3)),console[_0x4ba574(0x1f9)](_0x4ba574(0x1fb)),console[_0x4ba574(0x1f9)](_0x4ba574(0x1e9)),console[_0x4ba574(0x1f9)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x4c0cd1=_0x35d533[0x0],_0x10fc6f=_0x365a01[_0x4ba574(0x1cd)];let _0x1447f1=_0x4c0cd1;_0x10fc6f&&!_0x4c0cd1[_0x4ba574(0x1cf)]('/')&&(_0x1447f1=_0x10fc6f+'/'+_0x4c0cd1,_0x3cf102[_0x4ba574(0x1e7)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x1447f1));const _0x1f785b=parsePath(_0x1447f1);if(_0x1f785b[_0x4ba574(0x1df)][_0x4ba574(0x1da)]<0x2)return console[_0x4ba574(0x1f9)](_0x4ba574(0x1f3)),console[_0x4ba574(0x1f9)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x5a232c=_0x1f785b['segments'][0x0],_0x2944d4=getBaseName(_0x1447f1),_0x1b6cbf=getParentPath(_0x1447f1);_0x3cf102[_0x4ba574(0x1e7)]&&(console[_0x4ba574(0x1f9)](_0x4ba574(0x1e3)+_0x3cf102[_0x4ba574(0x1d8)]),console[_0x4ba574(0x1f9)](_0x4ba574(0x1fd)+_0x1447f1),console[_0x4ba574(0x1f9)]('Parent:\x20'+_0x5a232c),console[_0x4ba574(0x1f9)](_0x4ba574(0x1e5)+_0x2944d4),console[_0x4ba574(0x1f9)](_0x4ba574(0x1ef)+_0x1b6cbf));const _0x1a89de=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5a232c+'\x27...',()=>_0x18353a[_0x4ba574(0x1fe)][_0x4ba574(0x1d0)](_0x5a232c),{'verbose':_0x3cf102['verbose']}),_0x23839=_0x1a89de[_0x4ba574(0x1e2)];let _0x36ada9;if(_0x1f785b[_0x4ba574(0x1df)][_0x4ba574(0x1da)]>0x2){const _0x4c4b64=await withSpinner(_0x4ba574(0x1d6)+_0x1b6cbf+_0x4ba574(0x1d5),()=>_0x18353a['segment']['resolvePathToResource'](_0x1b6cbf),{'verbose':_0x3cf102[_0x4ba574(0x1e7)]}),_0x4b73d6=_0x4c4b64['data'];if(_0x4b73d6[_0x4ba574(0x1ed)]!=='folder'&&_0x4b73d6[_0x4ba574(0x1ed)]!=='parent')return console[_0x4ba574(0x1f9)](_0x4ba574(0x1dd)),0x1;_0x36ada9=_0x4b73d6[_0x4ba574(0x1d4)];}else{if(_0x3cf102[_0x4ba574(0x1f7)]){const _0x21afb7=await withSpinner('Resolving\x20folder\x20\x27'+_0x3cf102[_0x4ba574(0x1f7)]+_0x4ba574(0x1d5),()=>_0x18353a[_0x4ba574(0x1fe)][_0x4ba574(0x1d2)](_0x23839,_0x3cf102[_0x4ba574(0x1f7)]),{'verbose':_0x3cf102[_0x4ba574(0x1e7)]});_0x36ada9=_0x21afb7[_0x4ba574(0x1e2)];}}_0x3cf102[_0x4ba574(0x1e7)]&&_0x36ada9&&console[_0x4ba574(0x1f9)](_0x4ba574(0x1f5)+_0x36ada9);const _0xe52769=await loadJSONFromOptions(_0x3cf102['rule'],_0x3cf102['ruleFile']),_0x303a4b={'name':_0x2944d4,'description':_0x3cf102[_0x4ba574(0x1f4)],'rule':_0xe52769,'kind':_0x3cf102[_0x4ba574(0x1d1)]!==undefined?parseInt(_0x3cf102[_0x4ba574(0x1d1)],0xa):undefined,'isVisible':_0x3cf102[_0x4ba574(0x1cc)]?![]:undefined,'segmentFolderId':_0x36ada9,'countPopulation':_0x3cf102[_0x4ba574(0x1ec)]?![]:undefined},_0x27d223=await withSpinner(_0x4ba574(0x1ff)+_0x2944d4+_0x4ba574(0x1d5),()=>_0x18353a['segment'][_0x4ba574(0x1e6)](_0x23839,_0x303a4b),{'verbose':_0x3cf102[_0x4ba574(0x1e7)]}),_0x159f56=_0x27d223[_0x4ba574(0x1e2)];return console[_0x4ba574(0x1f9)](_0x4ba574(0x1d9)+_0x159f56['name']+_0x4ba574(0x1f6)+_0x159f56['id']),_0x1447f1!==_0x4c0cd1&&console[_0x4ba574(0x1f9)](_0x4ba574(0x1fa)+_0x1447f1),await handleSDKOutput([_0x159f56],_0x3cf102),0x0;}}function a35_0x2742(){const _0x4a34c7=['\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','3977638DDoYvk','Target\x20path:\x20','segment','Creating\x20segment\x20\x27','invisible','segmentPath','segment:create','includes','resolveParentId','kind','resolveFolderId','Examples:','folderId','\x27...','Resolving\x20folder\x20path\x20\x27','33171xUJTaH','site','βœ”\x20Created\x20segment\x20\x27','length','37152063SscaVL','1171464AwASDJ','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','yellow','segments','9343XwrdMj','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','data','Site:\x20','name','Segment\x20name:\x20','createSegment','verbose','execute','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','232PLrQHb','noCountPopulation','type','10QgTqgG','Parent\x20path:\x20','148hdPRso','3396360LBJRVB','2064475eGHPYw','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','description','Resolved\x20folder\x20ID:\x20','\x27\x20with\x20ID:\x20','folder','Create\x20child\x20segment\x20with\x20filtering\x20rules','error','\x20\x20\x20Path:\x20'];a35_0x2742=function(){return _0x4a34c7;};return a35_0x2742();}
@@ -1 +1 @@
1
- function a36_0x3a5c(){const _0x2712ef=['\x20field','segment:fields','9GqXfop','error','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','666650GxQqPG','Error:\x20Parent\x20segment\x20name\x20is\x20required','1951715liVNdd','6811629aMxQTL','67VpPhZK','7tzMvzn','segment','name','1931046gAcMlt','Listing\x20fields\x20for\x20\x27','length','4LgvJlY','List\x20available\x20fields\x20for\x20segmentation','1045404lwbXtM','listFields','execute','description','verbose','βœ”\x20Found\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','site','parentSegment','8754CuNibZ','3183608QRnQXQ','\x27...','Site:\x20'];a36_0x3a5c=function(){return _0x2712ef;};return a36_0x3a5c();}const a36_0x2bac32=a36_0x219f;(function(_0x133e32,_0x17ad7c){const _0x3c20c8=a36_0x219f,_0x187dbc=_0x133e32();while(!![]){try{const _0x1abfcc=-parseInt(_0x3c20c8(0x162))/0x1*(-parseInt(_0x3c20c8(0x155))/0x2)+parseInt(_0x3c20c8(0x14c))/0x3+-parseInt(_0x3c20c8(0x14a))/0x4*(parseInt(_0x3c20c8(0x160))/0x5)+-parseInt(_0x3c20c8(0x166))/0x6+parseInt(_0x3c20c8(0x163))/0x7*(-parseInt(_0x3c20c8(0x156))/0x8)+parseInt(_0x3c20c8(0x15b))/0x9*(parseInt(_0x3c20c8(0x15e))/0xa)+parseInt(_0x3c20c8(0x161))/0xb;if(_0x1abfcc===_0x17ad7c)break;else _0x187dbc['push'](_0x187dbc['shift']());}catch(_0xf1a2e8){_0x187dbc['push'](_0x187dbc['shift']());}}}(a36_0x3a5c,0x35198));function a36_0x219f(_0x4484c5,_0x5fae72){_0x4484c5=_0x4484c5-0x149;const _0x3a5cc0=a36_0x3a5c();let _0x219fbc=_0x3a5cc0[_0x4484c5];return _0x219fbc;}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{[a36_0x2bac32(0x165)]=a36_0x2bac32(0x15a);[a36_0x2bac32(0x14f)]=a36_0x2bac32(0x14b);async[a36_0x2bac32(0x14e)](_0x25d44b){const _0x3621f4=a36_0x2bac32,{options:_0x472198,args:_0x3d77d7,tdx:_0x3d5990}=_0x25d44b,_0x4bee00=_0x3d77d7[0x0]||_0x472198[_0x3621f4(0x154)];if(!_0x4bee00)return console[_0x3621f4(0x15c)](_0x3621f4(0x15f)),console['error'](_0x3621f4(0x15d)),console[_0x3621f4(0x15c)](_0x3621f4(0x152)),0x1;_0x472198[_0x3621f4(0x150)]&&(console[_0x3621f4(0x15c)](_0x3621f4(0x158)+_0x472198[_0x3621f4(0x153)]),console[_0x3621f4(0x15c)]('Parent\x20segment:\x20'+_0x4bee00));const _0x451ea4=await withSpinner(_0x3621f4(0x167)+_0x4bee00+_0x3621f4(0x157),()=>_0x3d5990[_0x3621f4(0x164)][_0x3621f4(0x14d)](_0x4bee00),{'verbose':_0x472198[_0x3621f4(0x150)]}),_0x49bb22=_0x451ea4['data'];console['error'](_0x3621f4(0x151)+_0x49bb22[_0x3621f4(0x149)]+_0x3621f4(0x159)+(_0x49bb22['length']!==0x1?'s':''));if(_0x472198['json']||_0x472198['jsonl'])return await handleSDKOutput(_0x49bb22,_0x472198),0x0;return displayFieldsHumanReadable(_0x49bb22,_0x4bee00),0x0;}}
1
+ const a36_0x4cc498=a36_0x1621;(function(_0x2397a4,_0x108e58){const _0x100dc6=a36_0x1621,_0x3c7cea=_0x2397a4();while(!![]){try{const _0x152465=-parseInt(_0x100dc6(0xaa))/0x1+parseInt(_0x100dc6(0x9f))/0x2+-parseInt(_0x100dc6(0xba))/0x3+-parseInt(_0x100dc6(0xab))/0x4*(-parseInt(_0x100dc6(0xbb))/0x5)+parseInt(_0x100dc6(0xa3))/0x6*(-parseInt(_0x100dc6(0xb9))/0x7)+-parseInt(_0x100dc6(0xa5))/0x8+parseInt(_0x100dc6(0xb2))/0x9*(parseInt(_0x100dc6(0xb6))/0xa);if(_0x152465===_0x108e58)break;else _0x3c7cea['push'](_0x3c7cea['shift']());}catch(_0x3ccc5d){_0x3c7cea['push'](_0x3c7cea['shift']());}}}(a36_0x76ac,0x8dc88));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a36_0x1621(_0x87f3a7,_0x221b88){_0x87f3a7=_0x87f3a7-0x9f;const _0x76acda=a36_0x76ac();let _0x162111=_0x76acda[_0x87f3a7];return _0x162111;}function a36_0x76ac(){const _0x1fcaab=['1198924HEuNLL','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segment:fields','\x20field','length','error','name','24894153jyuxgr','segment','json','verbose','10rxIXkt','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','execute','239785ZPofNq','3360291SkrpGw','10YicsDL','Listing\x20fields\x20for\x20\x27','368548syPnDy','Parent\x20segment:\x20','jsonl','\x27...','6BDhHxa','description','8994496LwMOMW','site','data','parentSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','690345OhrBMx'];a36_0x76ac=function(){return _0x1fcaab;};return a36_0x76ac();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a36_0x4cc498(0xb1)]=a36_0x4cc498(0xad);[a36_0x4cc498(0xa4)]='List\x20available\x20fields\x20for\x20segmentation';async[a36_0x4cc498(0xb8)](_0x13139c){const _0x5d34b3=a36_0x4cc498,{options:_0x44642b,args:_0x22e433,tdx:_0xadbaf9}=_0x13139c,_0x568629=_0x22e433[0x0]||_0x44642b[_0x5d34b3(0xa8)];if(!_0x568629)return console[_0x5d34b3(0xb0)](_0x5d34b3(0xa9)),console[_0x5d34b3(0xb0)](_0x5d34b3(0xb7)),console[_0x5d34b3(0xb0)](_0x5d34b3(0xac)),0x1;_0x44642b['verbose']&&(console[_0x5d34b3(0xb0)]('Site:\x20'+_0x44642b[_0x5d34b3(0xa6)]),console[_0x5d34b3(0xb0)](_0x5d34b3(0xa0)+_0x568629));const _0x2af58e=await withSpinner(_0x5d34b3(0xbc)+_0x568629+_0x5d34b3(0xa2),()=>_0xadbaf9[_0x5d34b3(0xb3)]['listFields'](_0x568629),{'verbose':_0x44642b[_0x5d34b3(0xb5)]}),_0x8d4a31=_0x2af58e[_0x5d34b3(0xa7)];console[_0x5d34b3(0xb0)]('βœ”\x20Found\x20'+_0x8d4a31[_0x5d34b3(0xaf)]+_0x5d34b3(0xae)+(_0x8d4a31[_0x5d34b3(0xaf)]!==0x1?'s':''));if(_0x44642b[_0x5d34b3(0xb4)]||_0x44642b[_0x5d34b3(0xa1)])return await handleSDKOutput(_0x8d4a31,_0x44642b),0x0;return displayFieldsHumanReadable(_0x8d4a31,_0x568629),0x0;}}
@@ -1 +1 @@
1
- function a37_0x1fc4(_0x8d5340,_0x2abe3c){_0x8d5340=_0x8d5340-0x6e;const _0x100217=a37_0x1002();let _0x1fc424=_0x100217[_0x8d5340];return _0x1fc424;}const a37_0x42255b=a37_0x1fc4;(function(_0x1dad4d,_0x278b97){const _0x5311b7=a37_0x1fc4,_0x1db5a6=_0x1dad4d();while(!![]){try{const _0x4fe319=parseInt(_0x5311b7(0x72))/0x1+-parseInt(_0x5311b7(0x94))/0x2+parseInt(_0x5311b7(0x97))/0x3*(-parseInt(_0x5311b7(0xa8))/0x4)+-parseInt(_0x5311b7(0xa0))/0x5*(-parseInt(_0x5311b7(0xb4))/0x6)+-parseInt(_0x5311b7(0xaf))/0x7+-parseInt(_0x5311b7(0xa4))/0x8+-parseInt(_0x5311b7(0x9e))/0x9*(-parseInt(_0x5311b7(0x9a))/0xa);if(_0x4fe319===_0x278b97)break;else _0x1db5a6['push'](_0x1db5a6['shift']());}catch(_0x2c0775){_0x1db5a6['push'](_0x1db5a6['shift']());}}}(a37_0x1002,0xbae1a));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a37_0x2e8b69 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a37_0x20e4ae from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a37_0x42255b(0x82)]=a37_0x42255b(0x9f);[a37_0x42255b(0x8e)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a37_0x42255b(0x81)](_0x61903a){const _0x41fceb=a37_0x42255b,{options:_0x16c914,args:_0x4c31cf,tdx:_0x24f6b4}=_0x61903a,_0x3a2631=_0x16c914,_0x52f7a2=await resolveTarget({'arg':_0x4c31cf[0x0],'contextParent':_0x16c914['parentSegment'],'cwd':process[_0x41fceb(0x80)]()});if(!isSuccessfulResolution(_0x52f7a2))return _0x52f7a2['errorCode']==='no_parent'?(console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0x8a)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x41fceb(0x78)]('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[_0x41fceb(0x78)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x41fceb(0x78)](_0x41fceb(0xb0))):(console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0xa3)](_0x41fceb(0xb2)+_0x52f7a2['message']+'\x0a')),_0x52f7a2['helpText']&&console[_0x41fceb(0x78)](a37_0x2e8b69['cyan'](_0x52f7a2[_0x41fceb(0xa6)]))),0x1;const _0x507470=_0x52f7a2[_0x41fceb(0x79)],_0x23600d=_0x52f7a2[_0x41fceb(0xb1)],_0x502de7=_0x52f7a2['type']==='file'?_0x52f7a2[_0x41fceb(0x91)]:undefined;_0x3a2631['verbose']&&(console[_0x41fceb(0x78)](_0x41fceb(0x7e)+_0x3a2631['site']),console['error'](_0x41fceb(0xa5)+_0x507470),_0x502de7&&console[_0x41fceb(0x78)](_0x41fceb(0x8c)+_0x502de7));const _0x4f19c7=await withProgressSpinner(_0x41fceb(0x86)+_0x507470+_0x41fceb(0x8f),_0x2eec6b=>_0x24f6b4['segment']['pullSegments'](_0x507470,{'targetDir':_0x23600d,'targetResourceName':_0x502de7,'verbose':_0x3a2631['verbose'],'progress':{'update':_0x1ec9c3=>{const _0x284a4f=_0x41fceb;_0x2eec6b['setPhase'](_0x1ec9c3),_0x3a2631[_0x284a4f(0x7f)]&&console[_0x284a4f(0x78)]('\x20\x20'+_0x1ec9c3);}}}),{'verbose':_0x3a2631[_0x41fceb(0x7f)]}),_0x476648=_0x4f19c7['data'];if(_0x476648[_0x41fceb(0x7d)]['segments']===0x0&&_0x476648[_0x41fceb(0x7d)]['journeys']===0x0)return console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0x8a)](_0x41fceb(0x92)+_0x476648[_0x41fceb(0x79)]+'\x27')),0x0;const _0x500823=_0x476648['files'][_0x41fceb(0x96)](_0x2e8580=>_0x2e8580[_0x41fceb(0x76)]),_0x454674=_0x476648[_0x41fceb(0x77)][_0x41fceb(0x96)](_0xa7fdd2=>!_0xa7fdd2[_0x41fceb(0x76)]&&_0xa7fdd2[_0x41fceb(0x88)]),_0x358bdb=_0x476648[_0x41fceb(0x77)][_0x41fceb(0x96)](_0x5d6743=>!_0x5d6743['isNew']&&!_0x5d6743[_0x41fceb(0x88)]);console[_0x41fceb(0x78)](_0x41fceb(0xaa)+_0x476648[_0x41fceb(0x79)]+'\x27:'),console[_0x41fceb(0x78)]('\x20\x20🎯\x20'+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648[_0x41fceb(0x7d)][_0x41fceb(0x7a)]+_0x41fceb(0xa7))+_0x41fceb(0x85)+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648['counts'][_0x41fceb(0xa1)]+'\x20activations'));if(_0x476648['counts'][_0x41fceb(0x6e)]>0x0){const _0x10dd4a=_0x476648[_0x41fceb(0x7d)][_0x41fceb(0xac)]>_0x476648[_0x41fceb(0x7d)][_0x41fceb(0x6e)]?'\x20('+_0x476648[_0x41fceb(0x7d)]['journeyVersions']+'\x20versions)':'';console[_0x41fceb(0x78)](_0x41fceb(0x8d)+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648[_0x41fceb(0x7d)][_0x41fceb(0x6e)]+'\x20journeys')+a37_0x2e8b69[_0x41fceb(0xad)](_0x10dd4a));}console[_0x41fceb(0x78)]('\x20\x20'+a37_0x2e8b69[_0x41fceb(0xb3)]('+\x20'+_0x500823[_0x41fceb(0x74)]+'\x20new\x20files')),console['error']('\x20\x20'+a37_0x2e8b69[_0x41fceb(0x8a)]('~\x20'+_0x454674[_0x41fceb(0x74)]+_0x41fceb(0x83))),console['error']('\x20\x20'+a37_0x2e8b69[_0x41fceb(0xad)]('=\x20'+_0x358bdb[_0x41fceb(0x74)]+_0x41fceb(0x7b))),console[_0x41fceb(0x78)](_0x41fceb(0x89)+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648[_0x41fceb(0xb1)])+'\x0a');if(_0x454674['length']>0x0)for(const _0x1d84f5 of _0x454674){console[_0x41fceb(0x78)]('\x0aChanges\x20to\x20\x27'+_0x1d84f5[_0x41fceb(0x84)]+'\x27:'),console[_0x41fceb(0x78)]('─'[_0x41fceb(0x98)](0x3c)),console['error'](_0x1d84f5['diff']),console[_0x41fceb(0x78)]('─'[_0x41fceb(0x98)](0x3c));}if(_0x3a2631[_0x41fceb(0x93)])return console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0x8a)](_0x41fceb(0x9d))),0x0;if(_0x500823[_0x41fceb(0x74)]===0x0&&_0x454674['length']===0x0)return console[_0x41fceb(0x78)](a37_0x2e8b69['green'](_0x41fceb(0x9c))),saveSessionContext({'parent_segment':_0x476648[_0x41fceb(0x79)]},_0x3a2631['session']),console['error'](a37_0x2e8b69[_0x41fceb(0xb3)]('βœ”\x20Context\x20set:\x20'+a37_0x2e8b69[_0x41fceb(0xad)](_0x41fceb(0x71))+_0x41fceb(0x6f)+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648['parentName']))),0x0;if(!_0x3a2631[_0x41fceb(0x8b)]){if(!isInteractive())return console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0xa3)](_0x41fceb(0x9b)),_0x41fceb(0x73)),console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0xad)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x32f08e=await confirmKey(_0x41fceb(0xab)+(_0x500823[_0x41fceb(0x74)]+_0x454674['length'])+_0x41fceb(0x70));if(!_0x32f08e)return console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0x8a)]('Aborted.'),_0x41fceb(0xa2)),0x1;}for(const _0x262b61 of _0x476648['files']){if(_0x262b61['isNew']||_0x262b61['hasChanges']){const _0xbe0d12=a37_0x20e4ae[_0x41fceb(0x75)](_0x262b61[_0x41fceb(0x95)]);!existsSync(_0xbe0d12)&&mkdirSync(_0xbe0d12,{'recursive':!![]}),writeFileSync(_0x262b61[_0x41fceb(0x95)],_0x262b61[_0x41fceb(0xa9)],_0x41fceb(0x7c));}}return console[_0x41fceb(0x78)](a37_0x2e8b69[_0x41fceb(0xb3)]('βœ”\x20Pulled\x20'+(_0x500823[_0x41fceb(0x74)]+_0x454674[_0x41fceb(0x74)])+_0x41fceb(0x99)+_0x476648[_0x41fceb(0xb1)])),saveSessionContext({'parent_segment':_0x476648['parentName']},_0x3a2631[_0x41fceb(0x87)]),console[_0x41fceb(0x78)](a37_0x2e8b69['green'](_0x41fceb(0x90)+a37_0x2e8b69['dim']('parent_segment')+_0x41fceb(0x6f)+a37_0x2e8b69[_0x41fceb(0xae)](_0x476648[_0x41fceb(0x79)]))),0x0;}}function a37_0x1002(){const _0x423dad=['\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','9zeQcrJ','segment:pull','2375wHkGEj','activations','-\x20no\x20files\x20written','red','2567256FqHrJy','Parent\x20segment:\x20','helpText','\x20segments','12bPUqjT','content','\x0aPull\x20summary\x20for\x20\x27','Write\x20','journeyVersions','dim','cyan','5172090rPmjFh','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','targetDir','Error:\x20','green','6186BmnfXp','journeys','\x20=\x20','\x20files?','parent_segment','1287289FwovxF','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','length','dirname','isNew','files','error','parentName','segments','\x20unchanged\x20files','utf-8','counts','Site:\x20','verbose','cwd','execute','name','\x20changed\x20files','relativePath','\x20with\x20','Pulling\x20segments\x20from\x20\x27','session','hasChanges','\x20\x20Target:\x20','yellow','yes','Target\x20resource:\x20','\x20\x20πŸ—ΊοΈ\x20\x20','description','\x27...','βœ”\x20Context\x20set:\x20','resourceName','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','dryRun','1634162EJkxoG','absolutePath','filter','388659XYcsDh','repeat','\x20files\x20to\x20','12539690eAyxFN','\x0aError:','βœ”\x20All\x20files\x20are\x20up\x20to\x20date'];a37_0x1002=function(){return _0x423dad;};return a37_0x1002();}
1
+ const a37_0x27f74c=a37_0x1223;(function(_0xc77cf8,_0x353337){const _0x44933d=a37_0x1223,_0x341cf1=_0xc77cf8();while(!![]){try{const _0x395412=-parseInt(_0x44933d(0x21b))/0x1+-parseInt(_0x44933d(0x230))/0x2*(parseInt(_0x44933d(0x210))/0x3)+-parseInt(_0x44933d(0x244))/0x4*(parseInt(_0x44933d(0x226))/0x5)+-parseInt(_0x44933d(0x20a))/0x6+parseInt(_0x44933d(0x21a))/0x7*(parseInt(_0x44933d(0x22d))/0x8)+parseInt(_0x44933d(0x227))/0x9*(-parseInt(_0x44933d(0x21f))/0xa)+-parseInt(_0x44933d(0x243))/0xb*(-parseInt(_0x44933d(0x221))/0xc);if(_0x395412===_0x353337)break;else _0x341cf1['push'](_0x341cf1['shift']());}catch(_0x52f482){_0x341cf1['push'](_0x341cf1['shift']());}}}(a37_0x2e71,0x54f58));import{BaseCommand}from'./command.js';function a37_0x1223(_0x2927ab,_0x57bb31){_0x2927ab=_0x2927ab-0x1f2;const _0x2e7126=a37_0x2e71();let _0x1223fd=_0x2e7126[_0x2927ab];return _0x1223fd;}import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a37_0x40bb03 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a37_0x3fd385 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a37_0x27f74c(0x1fc)]=a37_0x27f74c(0x23f);[a37_0x27f74c(0x231)]=a37_0x27f74c(0x21d);async['execute'](_0x346e04){const _0x9bce40=a37_0x27f74c,{options:_0x3b2c1e,args:_0x12fbe4,tdx:_0x39f512}=_0x346e04,_0xbe787b=_0x3b2c1e,_0x4c4558=await resolveTarget({'arg':_0x12fbe4[0x0],'contextParent':_0x3b2c1e[_0x9bce40(0x224)],'cwd':process[_0x9bce40(0x235)]()});if(!isSuccessfulResolution(_0x4c4558))return _0x4c4558[_0x9bce40(0x204)]===_0x9bce40(0x222)?(console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x225)](_0x9bce40(0x20b))),console['error']('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[_0x9bce40(0x207)](_0x9bce40(0x214)),console['error'](_0x9bce40(0x215))):(console['error'](a37_0x40bb03[_0x9bce40(0x212)]('Error:\x20'+_0x4c4558['message']+'\x0a')),_0x4c4558[_0x9bce40(0x22b)]&&console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x1f9)](_0x4c4558[_0x9bce40(0x22b)]))),0x1;const _0x260f6d=_0x4c4558['parentName'],_0x3a9e8c=_0x4c4558[_0x9bce40(0x202)],_0x360d2d=_0x4c4558['type']===_0x9bce40(0x213)?_0x4c4558[_0x9bce40(0x238)]:undefined;_0xbe787b[_0x9bce40(0x23c)]&&(console['error'](_0x9bce40(0x23a)+_0xbe787b[_0x9bce40(0x1fe)]),console[_0x9bce40(0x207)](_0x9bce40(0x216)+_0x260f6d),_0x360d2d&&console[_0x9bce40(0x207)](_0x9bce40(0x1f2)+_0x360d2d));const _0x1f8d07=await withProgressSpinner(_0x9bce40(0x206)+_0x260f6d+_0x9bce40(0x1f4),_0x17bb1d=>_0x39f512['segment'][_0x9bce40(0x23e)](_0x260f6d,{'targetDir':_0x3a9e8c,'targetResourceName':_0x360d2d,'verbose':_0xbe787b[_0x9bce40(0x23c)],'progress':{'update':_0x3ccaa6=>{const _0x17bed7=_0x9bce40;_0x17bb1d[_0x17bed7(0x20f)](_0x3ccaa6),_0xbe787b[_0x17bed7(0x23c)]&&console[_0x17bed7(0x207)]('\x20\x20'+_0x3ccaa6);}}}),{'verbose':_0xbe787b[_0x9bce40(0x23c)]}),_0x5b8822=_0x1f8d07[_0x9bce40(0x23d)];if(_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x217)]===0x0&&_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x205)]===0x0)return console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x225)](_0x9bce40(0x219)+_0x5b8822[_0x9bce40(0x20d)]+'\x27')),0x0;const _0x1b7d84=_0x5b8822[_0x9bce40(0x223)]['filter'](_0x7d90d7=>_0x7d90d7[_0x9bce40(0x203)]),_0x500f8d=_0x5b8822['files'][_0x9bce40(0x240)](_0x1ee0e3=>!_0x1ee0e3[_0x9bce40(0x203)]&&_0x1ee0e3[_0x9bce40(0x239)]),_0x374845=_0x5b8822[_0x9bce40(0x223)][_0x9bce40(0x240)](_0x14f8f1=>!_0x14f8f1['isNew']&&!_0x14f8f1['hasChanges']);console['error'](_0x9bce40(0x23b)+_0x5b8822[_0x9bce40(0x20d)]+'\x27:'),console['error'](_0x9bce40(0x22e)+a37_0x40bb03[_0x9bce40(0x1f9)](_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x217)]+'\x20segments')+_0x9bce40(0x1fb)+a37_0x40bb03[_0x9bce40(0x1f9)](_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x22a)]+_0x9bce40(0x233)));if(_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x205)]>0x0){const _0x811ce8=_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x1fd)]>_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x205)]?'\x20('+_0x5b8822[_0x9bce40(0x242)][_0x9bce40(0x1fd)]+_0x9bce40(0x1ff):'';console[_0x9bce40(0x207)](_0x9bce40(0x234)+a37_0x40bb03[_0x9bce40(0x1f9)](_0x5b8822['counts']['journeys']+_0x9bce40(0x20c))+a37_0x40bb03[_0x9bce40(0x21c)](_0x811ce8));}console[_0x9bce40(0x207)]('\x20\x20'+a37_0x40bb03[_0x9bce40(0x1fa)]('+\x20'+_0x1b7d84['length']+'\x20new\x20files')),console['error']('\x20\x20'+a37_0x40bb03['yellow']('~\x20'+_0x500f8d['length']+_0x9bce40(0x232))),console['error']('\x20\x20'+a37_0x40bb03[_0x9bce40(0x21c)]('=\x20'+_0x374845[_0x9bce40(0x21e)]+_0x9bce40(0x20e))),console[_0x9bce40(0x207)](_0x9bce40(0x228)+a37_0x40bb03[_0x9bce40(0x1f9)](_0x5b8822['targetDir'])+'\x0a');if(_0x500f8d[_0x9bce40(0x21e)]>0x0)for(const _0x4f10e9 of _0x500f8d){console[_0x9bce40(0x207)](_0x9bce40(0x229)+_0x4f10e9['relativePath']+'\x27:'),console['error']('─'[_0x9bce40(0x1f7)](0x3c)),console[_0x9bce40(0x207)](_0x4f10e9[_0x9bce40(0x218)]),console[_0x9bce40(0x207)]('─'['repeat'](0x3c));}if(_0xbe787b[_0x9bce40(0x1f3)])return console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x225)](_0x9bce40(0x201))),0x0;if(_0x1b7d84[_0x9bce40(0x21e)]===0x0&&_0x500f8d[_0x9bce40(0x21e)]===0x0)return console[_0x9bce40(0x207)](a37_0x40bb03['green'](_0x9bce40(0x237))),saveSessionContext({'parent_segment':_0x5b8822[_0x9bce40(0x20d)]},_0xbe787b['session']),console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x1fa)](_0x9bce40(0x220)+a37_0x40bb03[_0x9bce40(0x21c)]('parent_segment')+_0x9bce40(0x208)+a37_0x40bb03[_0x9bce40(0x1f9)](_0x5b8822[_0x9bce40(0x20d)]))),0x0;if(!_0xbe787b['yes']){if(!isInteractive())return console['error'](a37_0x40bb03[_0x9bce40(0x212)](_0x9bce40(0x1f5)),_0x9bce40(0x200)),console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x21c)](_0x9bce40(0x236))),0x1;const _0x46ac4c=await confirmKey('Write\x20'+(_0x1b7d84['length']+_0x500f8d[_0x9bce40(0x21e)])+_0x9bce40(0x1f6));if(!_0x46ac4c)return console[_0x9bce40(0x207)](a37_0x40bb03[_0x9bce40(0x225)](_0x9bce40(0x22f)),_0x9bce40(0x209)),0x1;}for(const _0x5e607f of _0x5b8822[_0x9bce40(0x223)]){if(_0x5e607f[_0x9bce40(0x203)]||_0x5e607f[_0x9bce40(0x239)]){const _0x14d04e=a37_0x3fd385['dirname'](_0x5e607f[_0x9bce40(0x22c)]);!existsSync(_0x14d04e)&&mkdirSync(_0x14d04e,{'recursive':!![]}),writeFileSync(_0x5e607f[_0x9bce40(0x22c)],_0x5e607f['content'],'utf-8');}}return console[_0x9bce40(0x207)](a37_0x40bb03['green'](_0x9bce40(0x241)+(_0x1b7d84[_0x9bce40(0x21e)]+_0x500f8d[_0x9bce40(0x21e)])+'\x20files\x20to\x20'+_0x5b8822['targetDir'])),saveSessionContext({'parent_segment':_0x5b8822['parentName']},_0xbe787b[_0x9bce40(0x211)]),console['error'](a37_0x40bb03[_0x9bce40(0x1fa)](_0x9bce40(0x220)+a37_0x40bb03[_0x9bce40(0x21c)](_0x9bce40(0x1f8))+'\x20=\x20'+a37_0x40bb03['cyan'](_0x5b8822[_0x9bce40(0x20d)]))),0x0;}}function a37_0x2e71(){const _0x1747b9=['dim','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','length','93430XxJPvI','βœ”\x20Context\x20set:\x20','24348mJBamJ','no_parent','files','parentSegment','yellow','5IxOdIm','9iJRtjQ','\x20\x20Target:\x20','\x0aChanges\x20to\x20\x27','activations','helpText','absolutePath','2640152KSZMSI','\x20\x20🎯\x20','Aborted.','10QjLkkG','description','\x20changed\x20files','\x20activations','\x20\x20πŸ—ΊοΈ\x20\x20','cwd','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','βœ”\x20All\x20files\x20are\x20up\x20to\x20date','resourceName','hasChanges','Site:\x20','\x0aPull\x20summary\x20for\x20\x27','verbose','data','pullSegments','segment:pull','filter','βœ”\x20Pulled\x20','counts','6182IjBjCh','2267372WDpgzC','Target\x20resource:\x20','dryRun','\x27...','\x0aError:','\x20files?','repeat','parent_segment','cyan','green','\x20with\x20','name','journeyVersions','site','\x20versions)','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','targetDir','isNew','errorCode','journeys','Pulling\x20segments\x20from\x20\x27','error','\x20=\x20','-\x20no\x20files\x20written','1989630mSEuEe','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20journeys','parentName','\x20unchanged\x20files','setPhase','4254PMwfaI','session','red','file','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','Parent\x20segment:\x20','segments','diff','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','7HIIoKP','207444csyDit'];a37_0x2e71=function(){return _0x1747b9;};return a37_0x2e71();}
@@ -1 +1 @@
1
- const a38_0x239142=a38_0x16e0;function a38_0x594b(){const _0xa1661b=['\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','all','Changes\x20to\x20journey:','yamlConfig','Error:\x20','versionNumber','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','execute','parentName','paused','Aborted.','verbose','list','errorCode','getParent','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x0aPush\x20summary\x20for\x20\x27','16131204tbXTVU','(Journey\x20will\x20be\x20deleted)','set','Push\x20','\x20activations]','Site:\x20','171778jCLfqD','add','length','unchanged','Scoped\x20to\x20folder:\x20','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','61135kcLJGR','createdAt','1533lKtMox','\x20updated','Folders\x20to\x20create:','cyan','user','nameToId','scopedFolderPath','folderPath','/app/ps/','createdSegmentIds','targetDir','getOutputSchemaWithCache','3181338wVSRNu','segment:push','No\x20','type','data','deleted','\x20\x20\x20\x20','filePath','journeyId','parent_name','updated','/e/','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','green','existingSegment','listSegments','journeyBundleId','helpText','buildUserMaps','Error:\x20Directory\x20not\x20found:\x20','push','listActivations','description','/j/da/je','\x20\x20Journeys:\x20','results','New\x20segment:','\x20deleted','error','\x20created','dim','diff','\x20\x20Activations:','folders','endsWith','New\x20journey:','\x20YAML\x20files\x20found','delete','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','name','\x20unchanged','nameToType','\x20folders\x20to\x20create','segment','resolveParentId','journey','toString','then','\x20\x20Source:\x20','message','folderId','get','existingJourney','Fetching\x20existing\x20data...','segment\x20or\x20journey','Source\x20directory:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x0aError:','64dHpxab','relationships','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','.yml','yes','parentFolder','.yaml','yellow','\x20\x20πŸ“Š\x20Segments:','toDelete','blue','updatedAt','changed','journeyBundleName','toCreate','1477128qHLkNx','\x20to\x20create','toUpdate','\x0aβœ”\x20Push\x20complete','site','connection','\x20to\x20delete','listFolders','427210DGEEww','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20\x20Activations:\x20','isScoped','attributes','\x27...','filter','new','map','created','isNew','\x20changed','repeat','cwd','/sb/da/esr','Preparing\x20journeys...','Parent\x20segment:\x20','journeys','join','Delete\x20journey:','\x0aValidation\x20failed:','file','πŸ“\x20','state','Fetching\x20existing\x20activations...','\x20\x20Segments:\x20','activations','\x20new','journeysOnly','Changes\x20to:','segments','βœ”\x20All\x20journeys\x20are\x20up\x20to\x20date','red','5752fqVgjm'];a38_0x594b=function(){return _0xa1661b;};return a38_0x594b();}(function(_0x5575aa,_0x6fe335){const _0x2db214=a38_0x16e0,_0x326ec2=_0x5575aa();while(!![]){try{const _0x198bbf=parseInt(_0x2db214(0x14b))/0x1+-parseInt(_0x2db214(0x111))/0x2+-parseInt(_0x2db214(0x15f))/0x3+-parseInt(_0x2db214(0x199))/0x4*(parseInt(_0x2db214(0x151))/0x5)+parseInt(_0x2db214(0x1a8))/0x6+parseInt(_0x2db214(0x153))/0x7*(-parseInt(_0x2db214(0x132))/0x8)+parseInt(_0x2db214(0x145))/0x9;if(_0x198bbf===_0x6fe335)break;else _0x326ec2['push'](_0x326ec2['shift']());}catch(_0x7e29c6){_0x326ec2['push'](_0x326ec2['shift']());}}}(a38_0x594b,0x8e60a));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';function a38_0x16e0(_0x116a9c,_0x2c6450){_0x116a9c=_0x116a9c-0x111;const _0x594bf5=a38_0x594b();let _0x16e069=_0x594bf5[_0x116a9c];return _0x16e069;}import a38_0x3720b4 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{[a38_0x239142(0x186)]=a38_0x239142(0x160);[a38_0x239142(0x175)]=a38_0x239142(0x150);async[a38_0x239142(0x13b)](_0x4f2437){const _0xcbc256=a38_0x239142,{options:_0x82bd,args:_0x5e0b5b,tdx:_0x3540e5}=_0x4f2437,_0x12d6ac=_0x82bd,_0x23f714=await resolveTarget({'arg':_0x5e0b5b[0x0],'contextParent':_0x82bd['parentSegment'],'cwd':process[_0xcbc256(0x11e)]()});if(!isSuccessfulResolution(_0x23f714))return _0x23f714[_0xcbc256(0x141)]==='no_parent'?(console['error'](a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x197))),console[_0xcbc256(0x17b)]('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[_0xcbc256(0x17b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console['error'](_0xcbc256(0x185))):(console[_0xcbc256(0x17b)](a38_0x3720b4['red'](_0xcbc256(0x138)+_0x23f714['message']+'\x0a')),_0x23f714[_0xcbc256(0x170)]&&console['error'](a38_0x3720b4['cyan'](_0x23f714['helpText']))),0x1;if(_0x23f714[_0xcbc256(0x162)]===_0xcbc256(0x168))return console['error'](a38_0x3720b4['red'](_0xcbc256(0x172)+_0x23f714[_0xcbc256(0x15d)]+'\x0a')),console['error'](a38_0x3720b4['cyan'](_0xcbc256(0x19b))),0x1;const _0x46f34f=_0x23f714[_0xcbc256(0x13c)],_0xe6f6c0=_0x23f714[_0xcbc256(0x15d)],_0x279b40=_0x23f714[_0xcbc256(0x162)]===_0xcbc256(0x126)?_0x23f714[_0xcbc256(0x166)]:undefined,_0x2b403b=getScopedDetails(_0x23f714),_0x29bae6=_0x2b403b?.[_0xcbc256(0x114)]??![],_0x3bfcb1=_0x2b403b?.[_0xcbc256(0x159)]??'';if(!existsSync(_0xe6f6c0))return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)](_0xcbc256(0x172)+_0xe6f6c0+'\x0a')),console['error'](a38_0x3720b4[_0xcbc256(0x156)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x12d6ac[_0xcbc256(0x13f)]&&(console[_0xcbc256(0x17b)](_0xcbc256(0x14a)+_0x12d6ac[_0xcbc256(0x1ac)]),console['error'](_0xcbc256(0x121)+_0x46f34f),console['error'](_0xcbc256(0x196)+_0xe6f6c0),_0x29bae6&&console[_0xcbc256(0x17b)](_0xcbc256(0x14f)+_0x3bfcb1));const _0x3c118a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x46f34f+_0xcbc256(0x116),()=>_0x3540e5[_0xcbc256(0x18a)][_0xcbc256(0x18b)](_0x46f34f),{'verbose':_0x12d6ac[_0xcbc256(0x13f)]}),_0x3d000f=_0x3c118a[_0xcbc256(0x163)],{parentSegmentResult:_0x6260a1,segmentsResult:_0x4c8834,foldersResult:_0xfef64,journeysWithDetailsResult:_0x5c441b,userMaps:_0x3eba9c}=await withSpinner(_0xcbc256(0x194),async()=>{const _0x1ba303=_0xcbc256,[_0x3f5a8a,_0x13e91e,_0x28f046,_0x1169ee,_0x34a5c3]=await Promise[_0x1ba303(0x135)]([_0x3540e5['segment'][_0x1ba303(0x142)](_0x3d000f),_0x3540e5[_0x1ba303(0x18a)][_0x1ba303(0x16e)](_0x3d000f),_0x3540e5[_0x1ba303(0x18a)][_0x1ba303(0x1af)](_0x3d000f),_0x3540e5['journey']['listJourneysWithDetailsFromParentSegment'](_0x3d000f,{'includeAllVersions':!![]}),_0x3540e5[_0x1ba303(0x157)][_0x1ba303(0x171)]()]);return{'parentSegmentResult':_0x3f5a8a,'segmentsResult':_0x13e91e,'foldersResult':_0x28f046,'journeysWithDetailsResult':_0x1169ee,'userMaps':_0x34a5c3};},{'verbose':_0x12d6ac[_0xcbc256(0x13f)]})[_0xcbc256(0x18e)](_0x26ce3c=>_0x26ce3c['data']),_0x19555c=_0x6260a1,_0x4d986d=extractRootFolderId(_0x19555c),_0x59c294=_0x4c8834,_0x4d29ca=_0xfef64,{journeys:_0x3d4fd6,activationStepsById:_0x4004ed}=_0x5c441b,_0x381d89=new Map(_0x3d4fd6[_0xcbc256(0x119)](_0x27c32a=>[_0x27c32a['id'],_0x27c32a])),_0x28ab85=_0x3d4fd6[_0xcbc256(0x119)](_0x6c80c9=>({'id':_0x6c80c9['id'],'name':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x186)],'journeyBundleName':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x1a6)]||'','journeyBundleId':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x16f)]||'','versionNumber':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x139)],'description':_0x6c80c9[_0xcbc256(0x115)]['description'],'state':_0x6c80c9['attributes'][_0xcbc256(0x128)],'paused':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x13d)],'audienceId':_0x6c80c9['attributes']['audienceId'],'folderId':_0x6c80c9[_0xcbc256(0x19a)]?.[_0xcbc256(0x19e)]?.['data']?.['id'],'createdAt':_0x6c80c9[_0xcbc256(0x115)][_0xcbc256(0x152)],'updatedAt':_0x6c80c9['attributes'][_0xcbc256(0x1a4)]})),{emailToId:_0x796f45,idToEmail:_0x47023a}=_0x3eba9c,_0x3ddf82=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x954788=_0xcbc256,_0x23c309=await _0x3540e5[_0x954788(0x1ad)][_0x954788(0x140)]();return buildConnectionMaps(_0x23c309);},{'verbose':_0x12d6ac[_0xcbc256(0x13f)]})[_0xcbc256(0x18e)](_0x22a14e=>_0x22a14e[_0xcbc256(0x163)]),_0x26e088=_0x3ddf82[_0xcbc256(0x158)],_0x4799d9=_0x3ddf82['idToName'],_0x369485=_0x3ddf82[_0xcbc256(0x188)],_0x12769e={'emailToIdMap':_0x796f45,'connectionNameToIdMap':_0x26e088,'connectionNameToTypeMap':_0x369485,'getSchema':_0x2cd96a=>_0x3540e5[_0xcbc256(0x1ad)][_0xcbc256(0x15e)](_0x2cd96a)};let {pathToId:_0x42cbd3,idToPath:_0x401729}=buildFolderMaps(_0x4d29ca);const _0x3481a5=buildSegmentLookupMap(_0x59c294,_0x401729),_0x50a22c=buildSegmentNameToIdMap(_0x59c294),_0x1fce00=buildJourneyBundleLookupMap(_0x28ab85,_0x401729);let _0x5bdfa4;if(_0x279b40){if(!_0x279b40[_0xcbc256(0x181)](_0xcbc256(0x19c))&&!_0x279b40[_0xcbc256(0x181)](_0xcbc256(0x19f)))return console[_0xcbc256(0x17b)](a38_0x3720b4['red']('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x279b40+'\x0a')),0x1;_0x5bdfa4=[_0x279b40];}else _0x5bdfa4=findYamlFiles(_0xe6f6c0);if(_0x5bdfa4[_0xcbc256(0x14d)]===0x0)return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0xe6f6c0+'\x0a')),console[_0xcbc256(0x17b)](a38_0x3720b4['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x150bdb,_0x569e43;try{const _0x4862fb=parseAndClassifyYamlFiles(_0x5bdfa4,_0xe6f6c0,{'skipSegments':_0x12d6ac['journeysOnly']});_0x150bdb=_0x4862fb[_0xcbc256(0x12f)],_0x569e43=_0x4862fb['journeys'];const _0x4e016c=validateParsedFiles(_0x4862fb,_0xe6f6c0);if(_0x4e016c['length']>0x0)return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)](_0xcbc256(0x125))),console['error'](formatValidationErrors(_0x4e016c)),console[_0xcbc256(0x17b)](a38_0x3720b4['yellow'](_0xcbc256(0x112))),0x1;}catch(_0x3fc0f5){return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)]('Error\x20parsing\x20YAML:\x20'+(_0x3fc0f5 instanceof Error?_0x3fc0f5[_0xcbc256(0x190)]:_0x3fc0f5))),0x1;}if(_0x150bdb[_0xcbc256(0x14d)]===0x0&&_0x569e43[_0xcbc256(0x14d)]===0x0){const _0x2b3074=_0x12d6ac[_0xcbc256(0x12d)]?_0xcbc256(0x18c):_0xcbc256(0x195);return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x161)+_0x2b3074+_0xcbc256(0x183))),0x0;}const _0x54d8cd=new Map();_0x59c294['length']>0x0&&!_0x12d6ac[_0xcbc256(0x12d)]&&await withSpinner(_0xcbc256(0x129),async()=>{await batchAsync(_0x59c294,async _0x1a7205=>{const _0x4a1298=a38_0x16e0,_0x18940a=await _0x3540e5[_0x4a1298(0x18a)][_0x4a1298(0x174)](_0x3d000f,_0x1a7205['id']);_0x54d8cd[_0x4a1298(0x147)](_0x1a7205['id'],_0x18940a);});},{'verbose':_0x12d6ac[_0xcbc256(0x13f)]});const {segmentFiles:_0x2eb352,foldersToCreate:_0x4c5405}=await prepareSegmentFiles(_0x150bdb,{'segmentByFolderAndName':_0x3481a5,'activationsBySegmentId':_0x54d8cd,'folderPathToId':_0x42cbd3,'idToEmailMap':_0x47023a,'connectionIdToNameMap':_0x4799d9},_0x12769e,_0x29bae6,_0x3bfcb1),_0xc44524=_0x279b40?[]:findSegmentsToDelete(_0x59c294,_0x150bdb[_0xcbc256(0x119)](({yamlConfig:_0x5bb06b,folderPath:_0x28bedd})=>({'yamlConfig':_0x5bb06b,'folderPath':resolveTDFolderPath(_0x28bedd,_0x29bae6,_0x3bfcb1)})),_0x401729,_0x3bfcb1,_0x29bae6),{journeyFiles:_0x5a2eaf,foldersToCreate:_0x2e318b}=await withProgressSpinner(_0xcbc256(0x120),async _0x1dee8a=>prepareJourneyFiles(_0x569e43,{'fetchJourney':async _0x4c5754=>_0x3540e5[_0xcbc256(0x18c)]['getJourney'](_0x4c5754['journeyId']),'journeyBundlesByFolderAndName':_0x1fce00,'folderPathToId':_0x42cbd3,'idToEmailMap':_0x47023a,'connectionIdToNameMap':_0x4799d9,'existingSegments':_0x59c294,'parentId':_0x3d000f,'deps':_0x3540e5,'progress':{'update':_0x28dc00=>{const _0x377eb1=_0xcbc256;_0x1dee8a['setPhase'](_0x28dc00),_0x12d6ac[_0x377eb1(0x13f)]&&console[_0x377eb1(0x17b)]('\x20\x20'+_0x28dc00);}},'journeyById':_0x381d89,'activationStepsById':_0x4004ed},_0x29bae6,_0x3bfcb1),{'verbose':_0x12d6ac['verbose']})[_0xcbc256(0x18e)](_0x287f52=>_0x287f52[_0xcbc256(0x163)]);for(const _0x2c4e3a of _0x2e318b){_0x4c5405[_0xcbc256(0x14c)](_0x2c4e3a);}const _0x26f089=_0x279b40?[]:findJourneysToDelete(_0x28ab85,_0x569e43[_0xcbc256(0x119)](({yamlConfig:_0x41e822,folderPath:_0x4668e7})=>({'yamlConfig':_0x41e822,'folderPath':resolveTDFolderPath(_0x4668e7,_0x29bae6,_0x3bfcb1)})),_0x401729,_0x3bfcb1,_0x29bae6),_0x219c01=calculatePushStats(_0x2eb352,_0x5a2eaf,_0x4c5405,_0xc44524,_0x26f089,!!_0x12d6ac[_0xcbc256(0x184)],!!_0x12d6ac[_0xcbc256(0x12d)]),_0x2d077a=_0x219c01[_0xcbc256(0x12f)][_0xcbc256(0x118)],_0x48814e=_0x219c01['segments'][_0xcbc256(0x1a5)],_0x259322=_0x219c01[_0xcbc256(0x12f)][_0xcbc256(0x14e)],_0x9deba2=_0x219c01[_0xcbc256(0x12f)][_0xcbc256(0x1a2)],_0x4c0066=_0x219c01[_0xcbc256(0x180)][_0xcbc256(0x1a7)],_0x583b13=_0x219c01[_0xcbc256(0x122)][_0xcbc256(0x118)],_0x204e67=_0x219c01[_0xcbc256(0x122)][_0xcbc256(0x1a5)],_0x5b7be8=_0x219c01[_0xcbc256(0x122)][_0xcbc256(0x14e)],_0x51eb79=_0x219c01[_0xcbc256(0x122)][_0xcbc256(0x1a2)],_0x47fa5a=_0x219c01['activations'][_0xcbc256(0x135)],_0x139541=_0x219c01[_0xcbc256(0x12b)][_0xcbc256(0x1a7)],_0xdae0aa=_0x219c01[_0xcbc256(0x12b)][_0xcbc256(0x1aa)],_0x140af3=_0x219c01['activations'][_0xcbc256(0x1a2)];console['error'](_0xcbc256(0x144)+_0x46f34f+'\x27:');_0x4c0066[_0xcbc256(0x14d)]>0x0&&console[_0xcbc256(0x17b)]('\x20\x20'+a38_0x3720b4[_0xcbc256(0x1a3)](_0xcbc256(0x127)+_0x4c0066[_0xcbc256(0x14d)]+_0xcbc256(0x189)));if(!_0x12d6ac[_0xcbc256(0x12d)]){console['error'](_0xcbc256(0x1a1)),console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x16c)]('+\x20'+_0x2d077a[_0xcbc256(0x14d)]+_0xcbc256(0x12c))),console['error'](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x1a0)]('~\x20'+_0x48814e[_0xcbc256(0x14d)]+_0xcbc256(0x11c)));if(_0x9deba2['length']>0x0)console['error'](_0xcbc256(0x165)+a38_0x3720b4['red']('-\x20'+_0x9deba2[_0xcbc256(0x14d)]+_0xcbc256(0x1ae)));else _0xc44524[_0xcbc256(0x14d)]>0x0&&!_0x12d6ac[_0xcbc256(0x184)]&&console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x17d)](_0xc44524[_0xcbc256(0x14d)]+_0xcbc256(0x143)));console['error'](_0xcbc256(0x165)+a38_0x3720b4['dim']('=\x20'+_0x259322['length']+_0xcbc256(0x187)));}if(_0x5a2eaf[_0xcbc256(0x14d)]>0x0||_0x26f089[_0xcbc256(0x14d)]>0x0){console[_0xcbc256(0x17b)]('\x20\x20πŸ—ΊοΈ\x20\x20Journeys:'),console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x16c)]('+\x20'+_0x583b13[_0xcbc256(0x14d)]+_0xcbc256(0x12c))),console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x1a0)]('~\x20'+_0x204e67[_0xcbc256(0x14d)]+_0xcbc256(0x11c)));if(_0x51eb79[_0xcbc256(0x14d)]>0x0)console['error'](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x131)]('-\x20'+_0x51eb79[_0xcbc256(0x14d)]+_0xcbc256(0x1ae)));else _0x26f089['length']>0x0&&!_0x12d6ac['delete']&&console[_0xcbc256(0x17b)]('\x20\x20\x20\x20'+a38_0x3720b4[_0xcbc256(0x17d)](_0x26f089[_0xcbc256(0x14d)]+_0xcbc256(0x143)));console[_0xcbc256(0x17b)]('\x20\x20\x20\x20'+a38_0x3720b4[_0xcbc256(0x17d)]('=\x20'+_0x5b7be8['length']+_0xcbc256(0x187)));}_0x47fa5a[_0xcbc256(0x14d)]>0x0&&!_0x12d6ac[_0xcbc256(0x12d)]&&(console[_0xcbc256(0x17b)](''),console['error'](_0xcbc256(0x17f)),_0x139541[_0xcbc256(0x14d)]>0x0&&console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x16c)]('+\x20'+_0x139541[_0xcbc256(0x14d)]+_0xcbc256(0x1a9))),_0xdae0aa['length']>0x0&&console[_0xcbc256(0x17b)](_0xcbc256(0x165)+a38_0x3720b4[_0xcbc256(0x1a0)]('~\x20'+_0xdae0aa[_0xcbc256(0x14d)]+'\x20to\x20update')),_0x140af3[_0xcbc256(0x14d)]>0x0&&console['error'](_0xcbc256(0x165)+a38_0x3720b4['red']('-\x20'+_0x140af3[_0xcbc256(0x14d)]+'\x20to\x20delete')));console[_0xcbc256(0x17b)](_0xcbc256(0x18f)+a38_0x3720b4['cyan'](_0xe6f6c0)+'\x0a');if(_0x4c0066[_0xcbc256(0x14d)]>0x0){console['error'](_0xcbc256(0x155));for(const _0x279e87 of _0x4c0066){console[_0xcbc256(0x17b)]('\x20\x20'+a38_0x3720b4['blue']('+')+'\x20'+_0x279e87);}console[_0xcbc256(0x17b)]('');}if(_0x2d077a['length']>0x0&&!_0x12d6ac[_0xcbc256(0x12d)])for(const _0x1456b4 of _0x2d077a){const _0x1eccce=_0x1456b4[_0xcbc256(0x15a)]?_0x1456b4['folderPath']+'/'+_0x1456b4[_0xcbc256(0x137)][_0xcbc256(0x186)]:_0x1456b4[_0xcbc256(0x137)]['name'],_0x37d853=_0x1456b4[_0xcbc256(0x137)][_0xcbc256(0x12b)]?.[_0xcbc256(0x14d)]||0x0,_0x2d828e=_0x37d853>0x0?a38_0x3720b4[_0xcbc256(0x17d)]('\x20['+_0x37d853+'\x20activations]'):'';console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4['green'](_0xcbc256(0x179))+'\x20'+_0x1eccce+_0x2d828e),console['error']('─'['repeat'](0x3c)),_0x1456b4[_0xcbc256(0x17e)]&&console[_0xcbc256(0x17b)](_0x1456b4[_0xcbc256(0x17e)]),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c));}if(_0x9deba2['length']>0x0&&!_0x12d6ac[_0xcbc256(0x12d)])for(const _0x2cad96 of _0x9deba2){const _0x2898d4=_0x2cad96['segmentFolderId']?_0x401729[_0xcbc256(0x192)](_0x2cad96['segmentFolderId'][_0xcbc256(0x18d)]())||'':'',_0x8a2633=_0x2898d4?_0x2898d4+'/'+_0x2cad96[_0xcbc256(0x186)]:_0x2cad96[_0xcbc256(0x186)],_0x38cbaf=_0x54d8cd['get'](_0x2cad96['id'])||[],_0xcff4eb=_0x38cbaf['length']>0x0?a38_0x3720b4[_0xcbc256(0x17d)]('\x20['+_0x38cbaf[_0xcbc256(0x14d)]+_0xcbc256(0x149)):'';console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4[_0xcbc256(0x131)]('Delete\x20segment:')+'\x20'+_0x8a2633+_0xcff4eb),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c));const _0x3e988e=segmentWithActivationsToYaml(_0x2cad96,_0x38cbaf,undefined,_0x47023a,_0x4799d9),_0xb1fafe=segmentToYamlString(_0x3e988e),_0x309768=generateDiff(_0xb1fafe,'');console[_0xcbc256(0x17b)](formatDiffWithColors(_0x309768)),console[_0xcbc256(0x17b)]('─'[_0xcbc256(0x11d)](0x3c));}const _0x3ddcf5=_0x2eb352[_0xcbc256(0x117)](_0x4689bb=>!_0x4689bb[_0xcbc256(0x11b)]&&_0x4689bb['diff']);if(_0x3ddcf5[_0xcbc256(0x14d)]>0x0&&!_0x12d6ac[_0xcbc256(0x12d)])for(const _0x2cf6e4 of _0x3ddcf5){const _0x5d694d=_0x2cf6e4[_0xcbc256(0x15a)]?_0x2cf6e4['folderPath']+'/'+_0x2cf6e4['yamlConfig'][_0xcbc256(0x186)]:_0x2cf6e4[_0xcbc256(0x137)][_0xcbc256(0x186)];console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x12e))+'\x20'+_0x5d694d),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c)),console[_0xcbc256(0x17b)](_0x2cf6e4[_0xcbc256(0x17e)]),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c));}if(_0x583b13['length']>0x0)for(const _0x519b9f of _0x583b13){const _0x3f8948=_0x519b9f[_0xcbc256(0x15a)]?_0x519b9f[_0xcbc256(0x15a)]+'/'+_0x519b9f[_0xcbc256(0x137)]['name']:_0x519b9f[_0xcbc256(0x137)][_0xcbc256(0x186)];console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4[_0xcbc256(0x16c)](_0xcbc256(0x182))+'\x20'+_0x3f8948),console[_0xcbc256(0x17b)]('─'[_0xcbc256(0x11d)](0x3c)),_0x519b9f[_0xcbc256(0x17e)]&&console[_0xcbc256(0x17b)](_0x519b9f[_0xcbc256(0x17e)]),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c));}const _0x2a2c3c=_0x5a2eaf[_0xcbc256(0x117)](_0x1141d9=>!_0x1141d9[_0xcbc256(0x11b)]&&_0x1141d9[_0xcbc256(0x17e)]);if(_0x2a2c3c[_0xcbc256(0x14d)]>0x0)for(const _0x398330 of _0x2a2c3c){const _0x26d577=_0x398330[_0xcbc256(0x15a)]?_0x398330[_0xcbc256(0x15a)]+'/'+_0x398330[_0xcbc256(0x137)][_0xcbc256(0x186)]:_0x398330[_0xcbc256(0x137)][_0xcbc256(0x186)];console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x136))+'\x20'+_0x26d577),console[_0xcbc256(0x17b)]('─'[_0xcbc256(0x11d)](0x3c)),console[_0xcbc256(0x17b)](_0x398330['diff']),console['error']('─'[_0xcbc256(0x11d)](0x3c));}if(_0x51eb79['length']>0x0)for(const _0x1f4ed1 of _0x51eb79){const _0x4d8237=_0x1f4ed1[_0xcbc256(0x191)]?_0x401729[_0xcbc256(0x192)](_0x1f4ed1[_0xcbc256(0x191)])||'':'',_0x355469=_0x4d8237?_0x4d8237+'/'+_0x1f4ed1['journeyBundleName']:_0x1f4ed1[_0xcbc256(0x1a6)];console[_0xcbc256(0x17b)]('\x0a'+a38_0x3720b4[_0xcbc256(0x131)](_0xcbc256(0x124))+'\x20'+_0x355469),console[_0xcbc256(0x17b)]('─'['repeat'](0x3c)),console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)](_0xcbc256(0x146))),console['error']('─'[_0xcbc256(0x11d)](0x3c));}if(_0x12d6ac['dryRun'])return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x13a))),0x0;const _0x216983=_0x12d6ac[_0xcbc256(0x12d)]?![]:_0x2d077a[_0xcbc256(0x14d)]>0x0||_0x48814e[_0xcbc256(0x14d)]>0x0||_0x9deba2[_0xcbc256(0x14d)]>0x0,_0x40a80a=_0x583b13[_0xcbc256(0x14d)]>0x0||_0x204e67[_0xcbc256(0x14d)]>0x0||_0x51eb79[_0xcbc256(0x14d)]>0x0,_0xdf2966=_0x12d6ac[_0xcbc256(0x12d)]?![]:_0x47fa5a[_0xcbc256(0x14d)]>0x0,_0x44a479=_0x4c0066[_0xcbc256(0x14d)]>0x0;if(!_0x216983&&!_0x40a80a&&!_0xdf2966&&!_0x44a479){const _0x3054d0=_0x12d6ac['journeysOnly']?_0xcbc256(0x130):'βœ”\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x16c)](_0x3054d0));if(_0x279b40&&_0x259322[_0xcbc256(0x14d)]===0x1){const _0xafca52=_0x259322[0x0];if(_0xafca52[_0xcbc256(0x16d)]?.['id']){const _0x512bcd=getConsoleNextUrl(_0x12d6ac[_0xcbc256(0x1ac)],'/app/ps/'+_0x3d000f+_0xcbc256(0x16a)+_0xafca52[_0xcbc256(0x16d)]['id']+_0xcbc256(0x11f));console[_0xcbc256(0x17b)](_0xcbc256(0x133)+a38_0x3720b4['cyan'](_0x512bcd));}}if(_0x279b40&&_0x5b7be8[_0xcbc256(0x14d)]===0x1){const _0x466c6e=_0x5b7be8[0x0];if(_0x466c6e[_0xcbc256(0x193)]?.['id']){const _0x46fe53=getConsoleNextUrl(_0x12d6ac[_0xcbc256(0x1ac)],_0xcbc256(0x15b)+_0x3d000f+_0xcbc256(0x16a)+_0x466c6e[_0xcbc256(0x193)]['id']+_0xcbc256(0x176));console[_0xcbc256(0x17b)]('\x20\x20'+a38_0x3720b4[_0xcbc256(0x156)](_0x46fe53));}}return 0x0;}const _0x21c839=_0x12d6ac['journeysOnly']?_0x583b13[_0xcbc256(0x14d)]+_0x204e67['length']+_0x51eb79['length']+_0x4c0066[_0xcbc256(0x14d)]:_0x2d077a['length']+_0x48814e[_0xcbc256(0x14d)]+_0x9deba2[_0xcbc256(0x14d)]+_0x583b13[_0xcbc256(0x14d)]+_0x204e67[_0xcbc256(0x14d)]+_0x51eb79[_0xcbc256(0x14d)]+_0x4c0066[_0xcbc256(0x14d)]+_0x47fa5a[_0xcbc256(0x14d)];if(!_0x12d6ac[_0xcbc256(0x19d)]&&_0x21c839>0x0){if(!isInteractive())return console['error'](a38_0x3720b4[_0xcbc256(0x131)](_0xcbc256(0x198)),_0xcbc256(0x16b)),console[_0xcbc256(0x17b)](a38_0x3720b4['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x29b092=await confirmKey(_0xcbc256(0x148)+_0x21c839+'\x20changes?');if(!_0x29b092)return console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x13e))),0x1;}const _0x292027={'withProgress':async(_0xbbaf89,_0x517a44)=>{const _0x2737fc=_0xcbc256,_0x32480b=await withSpinner(_0xbbaf89,_0x517a44,{'verbose':_0x12d6ac[_0x2737fc(0x13f)]});return{'data':_0x32480b[_0x2737fc(0x163)]};},'logInfo':_0x343edb=>console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x1a3)]('βœ”\x20'+_0x343edb)),'logSuccess':_0x15f235=>console[_0xcbc256(0x17b)](a38_0x3720b4['green']('βœ”\x20'+_0x15f235)),'logWarning':_0x28c89c=>console[_0xcbc256(0x17b)](a38_0x3720b4['yellow']('⚠\x20'+_0x28c89c)),'logDeleted':_0x2881c6=>console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x131)]('βœ”\x20'+_0x2881c6))},_0x3f4753={'segment':_0x3540e5[_0xcbc256(0x18a)],'journey':_0x3540e5[_0xcbc256(0x18c)],'user':_0x3540e5[_0xcbc256(0x157)],'connection':_0x3540e5[_0xcbc256(0x1ad)]};_0x4c0066[_0xcbc256(0x14d)]>0x0&&(_0x42cbd3=await executePushFolders(_0x3f4753,_0x4c0066,_0x42cbd3,{'parentId':_0x3d000f},_0x292027));const _0x573702={'rootFolderId':_0x4d986d,'folderPathToId':_0x42cbd3,'folderIdToPath':_0x401729,'segmentNameToId':_0x50a22c,'activationsBySegmentId':_0x54d8cd,'emailToIdMap':_0x796f45,'idToEmailMap':_0x47023a,'connectionNameToIdMap':_0x3ddf82[_0xcbc256(0x158)],'connectionIdToNameMap':_0x3ddf82['idToName'],'connectionNameToTypeMap':_0x369485},_0x28f395=await executePushSegments(_0x3f4753,_0x12d6ac[_0xcbc256(0x12d)]?[]:_0x2eb352,_0x573702,{'parentId':_0x3d000f},_0x292027),_0x54ec70=_0x28f395[_0xcbc256(0x11a)],_0xca965b=_0x28f395[_0xcbc256(0x169)],_0x1c03b8=_0x28f395['activations'][_0xcbc256(0x11a)],_0x13c9a9=_0x28f395[_0xcbc256(0x12b)][_0xcbc256(0x169)],_0x55859b=_0x28f395[_0xcbc256(0x12b)][_0xcbc256(0x164)];let _0xaf3cd3;if(_0x279b40&&_0x2eb352[_0xcbc256(0x14d)]===0x1){const _0x1b2834=_0x2eb352[0x0];_0xaf3cd3=_0x1b2834[_0xcbc256(0x16d)]?.['id']??_0x28f395['createdSegmentIds']['get'](_0x1b2834[_0xcbc256(0x137)][_0xcbc256(0x186)]);}const _0x2dac5d=await executePushSegmentDeletions(_0x3f4753,_0x12d6ac['journeysOnly']?[]:_0x9deba2,_0x292027);let _0x2ab2c4=0x0,_0x260067=0x0,_0x303f23=0x0;const _0x18aa05=new Map(_0x50a22c);for(const [_0x159f5f,_0x941039]of _0x28f395[_0xcbc256(0x15c)]){_0x18aa05['set'](_0x159f5f,_0x941039);}if(_0x5a2eaf[_0xcbc256(0x14d)]>0x0){const _0x304939={..._0x573702,'segmentNameToId':_0x18aa05,'existingSegments':_0x59c294,'activationContext':_0x12769e},_0x3375a5=await executePushJourneys(_0x3f4753,_0x5a2eaf,_0x304939,{'parentId':_0x3d000f,'rootFolderId':_0x4d986d,'verbose':_0x12d6ac[_0xcbc256(0x13f)]},_0x292027);_0x2ab2c4=_0x3375a5[_0xcbc256(0x11a)],_0x260067=_0x3375a5[_0xcbc256(0x169)];if(_0x279b40&&_0x3375a5[_0xcbc256(0x178)]['length']===0x1){const _0x559390=_0x3375a5[_0xcbc256(0x178)][0x0];if(_0x559390['journeyId']){const _0x385374=getConsoleNextUrl(_0x12d6ac['site'],_0xcbc256(0x15b)+_0x3d000f+_0xcbc256(0x16a)+_0x559390[_0xcbc256(0x167)]+'/j/da/je');console[_0xcbc256(0x17b)]('\x20\x20'+a38_0x3720b4[_0xcbc256(0x156)](_0x385374));}}}for(const _0x153555 of _0x51eb79){console[_0xcbc256(0x17b)](a38_0x3720b4[_0xcbc256(0x1a0)](_0xcbc256(0x134)+_0x153555[_0xcbc256(0x1a6)])),_0x303f23++;}const _0x3d059e=[];if(_0x54ec70>0x0)_0x3d059e['push'](_0x54ec70+'\x20created');if(_0xca965b>0x0)_0x3d059e[_0xcbc256(0x173)](_0xca965b+_0xcbc256(0x154));if(_0x2dac5d>0x0)_0x3d059e[_0xcbc256(0x173)](_0x2dac5d+_0xcbc256(0x17a));const _0x580988=[];if(_0x2ab2c4>0x0)_0x580988[_0xcbc256(0x173)](_0x2ab2c4+_0xcbc256(0x17c));if(_0x260067>0x0)_0x580988[_0xcbc256(0x173)](_0x260067+_0xcbc256(0x154));if(_0x303f23>0x0)_0x580988[_0xcbc256(0x173)](_0x303f23+_0xcbc256(0x17a));const _0x172a8d=[];if(_0x1c03b8>0x0)_0x172a8d['push'](_0x1c03b8+_0xcbc256(0x17c));if(_0x13c9a9>0x0)_0x172a8d[_0xcbc256(0x173)](_0x13c9a9+_0xcbc256(0x154));if(_0x55859b>0x0)_0x172a8d[_0xcbc256(0x173)](_0x55859b+_0xcbc256(0x17a));console[_0xcbc256(0x17b)](a38_0x3720b4['green'](_0xcbc256(0x1ab)));_0x3d059e[_0xcbc256(0x14d)]>0x0&&!_0x12d6ac['journeysOnly']&&console['error'](_0xcbc256(0x12a)+_0x3d059e[_0xcbc256(0x123)](',\x20'));_0x580988[_0xcbc256(0x14d)]>0x0&&console[_0xcbc256(0x17b)](_0xcbc256(0x177)+_0x580988[_0xcbc256(0x123)](',\x20'));_0x172a8d[_0xcbc256(0x14d)]>0x0&&!_0x12d6ac['journeysOnly']&&console[_0xcbc256(0x17b)](_0xcbc256(0x113)+_0x172a8d['join'](',\x20'));if(_0xaf3cd3){const _0x4e6d35=getConsoleNextUrl(_0x12d6ac[_0xcbc256(0x1ac)],_0xcbc256(0x15b)+_0x3d000f+_0xcbc256(0x16a)+_0xaf3cd3+_0xcbc256(0x11f));console[_0xcbc256(0x17b)](_0xcbc256(0x133)+a38_0x3720b4[_0xcbc256(0x156)](_0x4e6d35));}return 0x0;}}
1
+ const a38_0x41082f=a38_0x1f9f;(function(_0x480609,_0x199846){const _0xcbd4f0=a38_0x1f9f,_0x450879=_0x480609();while(!![]){try{const _0x5bcba5=parseInt(_0xcbd4f0(0x1ca))/0x1+parseInt(_0xcbd4f0(0x19c))/0x2*(parseInt(_0xcbd4f0(0x1c9))/0x3)+parseInt(_0xcbd4f0(0x1b6))/0x4*(parseInt(_0xcbd4f0(0x1b2))/0x5)+parseInt(_0xcbd4f0(0x15a))/0x6*(-parseInt(_0xcbd4f0(0x160))/0x7)+parseInt(_0xcbd4f0(0x199))/0x8*(parseInt(_0xcbd4f0(0x19a))/0x9)+parseInt(_0xcbd4f0(0x142))/0xa*(parseInt(_0xcbd4f0(0x147))/0xb)+parseInt(_0xcbd4f0(0x1c1))/0xc*(-parseInt(_0xcbd4f0(0x1b3))/0xd);if(_0x5bcba5===_0x199846)break;else _0x450879['push'](_0x450879['shift']());}catch(_0x30f983){_0x450879['push'](_0x450879['shift']());}}}(a38_0xc51d,0x69511));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a38_0xc51d(){const _0x1bce36=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x27...','Delete\x20segment:','activations','Scoped\x20to\x20folder:\x20','listActivations','cyan','all','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','set','listFolders','20NGMYOb','green','\x0aError:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','existingJourney','1469149VlJKzn','idToName','isScoped','segment','diff','\x20to\x20update','Error:\x20','red','push','\x20changed','segment:push','name','/e/','(Journey\x20will\x20be\x20deleted)','.yaml','created','results','\x0aβœ”\x20Push\x20complete','Changes\x20to:','297144VkphbU','filter','existingSegment','\x20\x20\x20\x20','cwd','/sb/da/esr','28FLnPHp','Fetching\x20connections\x20for\x20name\x20resolution...','journeyBundleName','getParent','isNew','data','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','folderId','journey','/app/ps/','parentName','journeys','description','New\x20segment:','buildUserMaps','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','list','filePath','Error:\x20Directory\x20not\x20found:\x20','.yml','repeat','targetDir','changed','No\x20','Parent\x20segment:\x20','\x20\x20Source:\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20changes?','folders','scopedFolderPath','βœ”\x20All\x20journeys\x20are\x20up\x20to\x20date','message','join','updatedAt','\x0aValidation\x20failed:','yamlConfig','getOutputSchemaWithCache','add','blue','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','yellow','helpText','Source\x20directory:\x20','parent_name','\x20folders\x20to\x20create','map','Preparing\x20journeys...','nameToId','updated','\x20created','attributes','toString','folderPath','\x20to\x20create','Aborted.','length','16fmfbOf','2181663DTUYLo','\x20updated','983852FTlpLt','listJourneysWithDetailsFromParentSegment','dryRun','/j/da/je','state','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','endsWith','\x20to\x20delete','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)','listSegments','Fetching\x20existing\x20activations...','journeysOnly','\x20\x20πŸ“Š\x20Segments:','paused','journeyBundleId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Fetching\x20existing\x20data...','dim','toUpdate','unchanged','user','5iBtRmN','8340839vkdeIp','then','Folders\x20to\x20create:','2008164wFQPLJ','segments','site','execute','\x20unchanged','getJourney','\x20YAML\x20files\x20found','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Resolving\x20parent\x20segment\x20\x27','versionNumber','toDelete','36bKztRW','error','Delete\x20journey:','πŸ“\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20\x20Activations:\x20','\x20\x20πŸ—ΊοΈ\x20\x20Journeys:','\x20new','3Juytqc','808383WzobkK','connection','verbose','nameToType','\x20deleted','createdSegmentIds','delete','Site:\x20','setPhase','get','\x20activations]','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','βœ”\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','new'];a38_0xc51d=function(){return _0x1bce36;};return a38_0xc51d();}import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a38_0xfb3ffc from'chalk';import{existsSync}from'fs';function a38_0x1f9f(_0x309ca0,_0x4b6320){_0x309ca0=_0x309ca0-0x133;const _0xc51dad=a38_0xc51d();let _0x1f9f3b=_0xc51dad[_0x309ca0];return _0x1f9f3b;}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{[a38_0x41082f(0x152)]=a38_0x41082f(0x151);[a38_0x41082f(0x16c)]=a38_0x41082f(0x1bd);async[a38_0x41082f(0x1b9)](_0x157814){const _0x1a2c0e=a38_0x41082f,{options:_0x21059a,args:_0x423c4a,tdx:_0x523549}=_0x157814,_0x27233d=_0x21059a,_0x2bc9f2=await resolveTarget({'arg':_0x423c4a[0x0],'contextParent':_0x21059a['parentSegment'],'cwd':process[_0x1a2c0e(0x15e)]()});if(!isSuccessfulResolution(_0x2bc9f2))return _0x2bc9f2['errorCode']==='no_parent'?(console['error'](a38_0xfb3ffc[_0x1a2c0e(0x189)](_0x1a2c0e(0x145))),console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x1a5)),console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x1c5)),console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x137))):(console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['red'](_0x1a2c0e(0x14d)+_0x2bc9f2['message']+'\x0a')),_0x2bc9f2[_0x1a2c0e(0x18a)]&&console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x2bc9f2['helpText']))),0x1;if(_0x2bc9f2['type']===_0x1a2c0e(0x18c))return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x173)+_0x2bc9f2['targetDir']+'\x0a')),console['error'](a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x1a2c0e(0x1ac))),0x1;const _0x4e34b7=_0x2bc9f2[_0x1a2c0e(0x16a)],_0x33a158=_0x2bc9f2[_0x1a2c0e(0x176)],_0x330054=_0x2bc9f2['type']==='file'?_0x2bc9f2[_0x1a2c0e(0x172)]:undefined,_0x38785e=getScopedDetails(_0x2bc9f2),_0x4271cd=_0x38785e?.[_0x1a2c0e(0x149)]??![],_0xdc3871=_0x38785e?.[_0x1a2c0e(0x17e)]??'';if(!existsSync(_0x33a158))return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['red'](_0x1a2c0e(0x173)+_0x33a158+'\x0a')),console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x13d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x27233d[_0x1a2c0e(0x1cc)]&&(console['error'](_0x1a2c0e(0x1d1)+_0x27233d[_0x1a2c0e(0x1b8)]),console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x179)+_0x4e34b7),console['error'](_0x1a2c0e(0x18b)+_0x33a158),_0x4271cd&&console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x13b)+_0xdc3871));const _0x27c885=await withSpinner(_0x1a2c0e(0x1be)+_0x4e34b7+_0x1a2c0e(0x138),()=>_0x523549[_0x1a2c0e(0x14a)]['resolveParentId'](_0x4e34b7),{'verbose':_0x27233d[_0x1a2c0e(0x1cc)]}),_0x56c18a=_0x27c885[_0x1a2c0e(0x165)],{parentSegmentResult:_0x2628e2,segmentsResult:_0x409157,foldersResult:_0x78ee26,journeysWithDetailsResult:_0x172568,userMaps:_0x3ea9e1}=await withSpinner(_0x1a2c0e(0x1ad),async()=>{const _0x28676c=_0x1a2c0e,[_0x4053f8,_0x28e1ed,_0x5434ab,_0xed9c8a,_0x1e740b]=await Promise[_0x28676c(0x13e)]([_0x523549[_0x28676c(0x14a)][_0x28676c(0x163)](_0x56c18a),_0x523549[_0x28676c(0x14a)][_0x28676c(0x1a6)](_0x56c18a),_0x523549[_0x28676c(0x14a)][_0x28676c(0x141)](_0x56c18a),_0x523549[_0x28676c(0x168)][_0x28676c(0x19d)](_0x56c18a,{'includeAllVersions':!![]}),_0x523549[_0x28676c(0x1b1)][_0x28676c(0x16e)]()]);return{'parentSegmentResult':_0x4053f8,'segmentsResult':_0x28e1ed,'foldersResult':_0x5434ab,'journeysWithDetailsResult':_0xed9c8a,'userMaps':_0x1e740b};},{'verbose':_0x27233d[_0x1a2c0e(0x1cc)]})[_0x1a2c0e(0x1b4)](_0x4009c0=>_0x4009c0[_0x1a2c0e(0x165)]),_0x5df17c=_0x2628e2,_0x33676b=extractRootFolderId(_0x5df17c),_0x4bfd79=_0x409157,_0x1a496a=_0x78ee26,{journeys:_0x4ad14f,activationStepsById:_0x1145e6}=_0x172568,_0x29ddf8=new Map(_0x4ad14f[_0x1a2c0e(0x18e)](_0x23a9b3=>[_0x23a9b3['id'],_0x23a9b3])),_0x43ca2a=_0x4ad14f['map'](_0x3bcf4b=>({'id':_0x3bcf4b['id'],'name':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x152)],'journeyBundleName':_0x3bcf4b[_0x1a2c0e(0x193)]['journeyBundleName']||'','journeyBundleId':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x1ab)]||'','versionNumber':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x1bf)],'description':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x16c)],'state':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x1a0)],'paused':_0x3bcf4b[_0x1a2c0e(0x193)][_0x1a2c0e(0x1aa)],'audienceId':_0x3bcf4b[_0x1a2c0e(0x193)]['audienceId'],'folderId':_0x3bcf4b['relationships']?.['parentFolder']?.[_0x1a2c0e(0x165)]?.['id'],'createdAt':_0x3bcf4b[_0x1a2c0e(0x193)]['createdAt'],'updatedAt':_0x3bcf4b['attributes'][_0x1a2c0e(0x182)]})),{emailToId:_0x430686,idToEmail:_0x3213e7}=_0x3ea9e1,_0x41132a=await withSpinner(_0x1a2c0e(0x161),async()=>{const _0x19cd0e=_0x1a2c0e,_0x5bae8b=await _0x523549['connection'][_0x19cd0e(0x171)]();return buildConnectionMaps(_0x5bae8b);},{'verbose':_0x27233d[_0x1a2c0e(0x1cc)]})[_0x1a2c0e(0x1b4)](_0x27b12a=>_0x27b12a[_0x1a2c0e(0x165)]),_0x33e656=_0x41132a['nameToId'],_0x84fbbd=_0x41132a[_0x1a2c0e(0x148)],_0x28dac4=_0x41132a[_0x1a2c0e(0x1cd)],_0x3dd35a={'emailToIdMap':_0x430686,'connectionNameToIdMap':_0x33e656,'connectionNameToTypeMap':_0x28dac4,'getSchema':_0x5e41fe=>_0x523549[_0x1a2c0e(0x1cb)][_0x1a2c0e(0x185)](_0x5e41fe)};let {pathToId:_0x36cd43,idToPath:_0x92c6c1}=buildFolderMaps(_0x1a496a);const _0x47aca5=buildSegmentLookupMap(_0x4bfd79,_0x92c6c1),_0x5c200c=buildSegmentNameToIdMap(_0x4bfd79),_0x28c386=buildJourneyBundleLookupMap(_0x43ca2a,_0x92c6c1);let _0x285829;if(_0x330054){if(!_0x330054[_0x1a2c0e(0x1a3)](_0x1a2c0e(0x174))&&!_0x330054[_0x1a2c0e(0x1a3)](_0x1a2c0e(0x155)))return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x188)+_0x330054+'\x0a')),0x1;_0x285829=[_0x330054];}else _0x285829=findYamlFiles(_0x33a158);if(_0x285829['length']===0x0)return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x1a1)+_0x33a158+'\x0a')),console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x1a2c0e(0x13f))),0x1;let _0x1c9087,_0x26c8f5;try{const _0x557863=parseAndClassifyYamlFiles(_0x285829,_0x33a158,{'skipSegments':_0x27233d[_0x1a2c0e(0x1a8)]});_0x1c9087=_0x557863['segments'],_0x26c8f5=_0x557863[_0x1a2c0e(0x16b)];const _0x210df2=validateParsedFiles(_0x557863,_0x33a158);if(_0x210df2[_0x1a2c0e(0x198)]>0x0)return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x183))),console[_0x1a2c0e(0x1c2)](formatValidationErrors(_0x210df2)),console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x189)](_0x1a2c0e(0x17b))),0x1;}catch(_0x34ba11){return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)]('Error\x20parsing\x20YAML:\x20'+(_0x34ba11 instanceof Error?_0x34ba11[_0x1a2c0e(0x180)]:_0x34ba11))),0x1;}if(_0x1c9087[_0x1a2c0e(0x198)]===0x0&&_0x26c8f5[_0x1a2c0e(0x198)]===0x0){const _0x532e5e=_0x27233d['journeysOnly']?_0x1a2c0e(0x168):'segment\x20or\x20journey';return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['yellow'](_0x1a2c0e(0x178)+_0x532e5e+_0x1a2c0e(0x1bc))),0x0;}const _0x115850=new Map();_0x4bfd79[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)]&&await withSpinner(_0x1a2c0e(0x1a7),async()=>{await batchAsync(_0x4bfd79,async _0x3d88bb=>{const _0x13a5c8=a38_0x1f9f,_0x235ff0=await _0x523549[_0x13a5c8(0x14a)][_0x13a5c8(0x13c)](_0x56c18a,_0x3d88bb['id']);_0x115850[_0x13a5c8(0x140)](_0x3d88bb['id'],_0x235ff0);});},{'verbose':_0x27233d[_0x1a2c0e(0x1cc)]});const {segmentFiles:_0xda830d,foldersToCreate:_0x1b3492}=await prepareSegmentFiles(_0x1c9087,{'segmentByFolderAndName':_0x47aca5,'activationsBySegmentId':_0x115850,'folderPathToId':_0x36cd43,'idToEmailMap':_0x3213e7,'connectionIdToNameMap':_0x84fbbd},_0x3dd35a,_0x4271cd,_0xdc3871),_0x3ca435=_0x330054?[]:findSegmentsToDelete(_0x4bfd79,_0x1c9087[_0x1a2c0e(0x18e)](({yamlConfig:_0x12334c,folderPath:_0x2c3c07})=>({'yamlConfig':_0x12334c,'folderPath':resolveTDFolderPath(_0x2c3c07,_0x4271cd,_0xdc3871)})),_0x92c6c1,_0xdc3871,_0x4271cd),{journeyFiles:_0x5a6a7d,foldersToCreate:_0x398f16}=await withProgressSpinner(_0x1a2c0e(0x18f),async _0x2cc79e=>prepareJourneyFiles(_0x26c8f5,{'fetchJourney':async _0x551864=>_0x523549[_0x1a2c0e(0x168)][_0x1a2c0e(0x1bb)](_0x551864['journeyId']),'journeyBundlesByFolderAndName':_0x28c386,'folderPathToId':_0x36cd43,'idToEmailMap':_0x3213e7,'connectionIdToNameMap':_0x84fbbd,'existingSegments':_0x4bfd79,'parentId':_0x56c18a,'deps':_0x523549,'progress':{'update':_0x37a5ac=>{const _0x172856=_0x1a2c0e;_0x2cc79e[_0x172856(0x1d2)](_0x37a5ac),_0x27233d[_0x172856(0x1cc)]&&console[_0x172856(0x1c2)]('\x20\x20'+_0x37a5ac);}},'journeyById':_0x29ddf8,'activationStepsById':_0x1145e6},_0x4271cd,_0xdc3871),{'verbose':_0x27233d[_0x1a2c0e(0x1cc)]})[_0x1a2c0e(0x1b4)](_0x2ce7bf=>_0x2ce7bf[_0x1a2c0e(0x165)]);for(const _0x42a6c7 of _0x398f16){_0x1b3492[_0x1a2c0e(0x186)](_0x42a6c7);}const _0x14bb77=_0x330054?[]:findJourneysToDelete(_0x43ca2a,_0x26c8f5['map'](({yamlConfig:_0x447d2b,folderPath:_0x3b5c24})=>({'yamlConfig':_0x447d2b,'folderPath':resolveTDFolderPath(_0x3b5c24,_0x4271cd,_0xdc3871)})),_0x92c6c1,_0xdc3871,_0x4271cd),_0x586e17=calculatePushStats(_0xda830d,_0x5a6a7d,_0x1b3492,_0x3ca435,_0x14bb77,!!_0x27233d[_0x1a2c0e(0x1d0)],!!_0x27233d['journeysOnly']),_0xed2b5a=_0x586e17[_0x1a2c0e(0x1b7)][_0x1a2c0e(0x136)],_0x5249dd=_0x586e17[_0x1a2c0e(0x1b7)][_0x1a2c0e(0x177)],_0x10e8d3=_0x586e17['segments'][_0x1a2c0e(0x1b0)],_0x907368=_0x586e17['segments'][_0x1a2c0e(0x1c0)],_0x2523e3=_0x586e17[_0x1a2c0e(0x17d)]['toCreate'],_0x329d4c=_0x586e17[_0x1a2c0e(0x16b)][_0x1a2c0e(0x136)],_0x1918d5=_0x586e17['journeys']['changed'],_0x26acf7=_0x586e17['journeys'][_0x1a2c0e(0x1b0)],_0xa03310=_0x586e17[_0x1a2c0e(0x16b)][_0x1a2c0e(0x1c0)],_0x5ecff0=_0x586e17[_0x1a2c0e(0x13a)][_0x1a2c0e(0x13e)],_0x1e8697=_0x586e17['activations']['toCreate'],_0xeaceca=_0x586e17[_0x1a2c0e(0x13a)][_0x1a2c0e(0x1af)],_0x20d31b=_0x586e17[_0x1a2c0e(0x13a)][_0x1a2c0e(0x1c0)];console[_0x1a2c0e(0x1c2)]('\x0aPush\x20summary\x20for\x20\x27'+_0x4e34b7+'\x27:');_0x2523e3[_0x1a2c0e(0x198)]>0x0&&console[_0x1a2c0e(0x1c2)]('\x20\x20'+a38_0xfb3ffc[_0x1a2c0e(0x187)](_0x1a2c0e(0x1c4)+_0x2523e3[_0x1a2c0e(0x198)]+_0x1a2c0e(0x18d)));if(!_0x27233d[_0x1a2c0e(0x1a8)]){console['error'](_0x1a2c0e(0x1a9)),console[_0x1a2c0e(0x1c2)]('\x20\x20\x20\x20'+a38_0xfb3ffc['green']('+\x20'+_0xed2b5a['length']+_0x1a2c0e(0x1c8))),console['error']('\x20\x20\x20\x20'+a38_0xfb3ffc[_0x1a2c0e(0x189)]('~\x20'+_0x5249dd[_0x1a2c0e(0x198)]+'\x20changed'));if(_0x907368['length']>0x0)console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x15d)+a38_0xfb3ffc['red']('-\x20'+_0x907368[_0x1a2c0e(0x198)]+'\x20to\x20delete'));else _0x3ca435[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1d0)]&&console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x1ae)](_0x3ca435[_0x1a2c0e(0x198)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x1ae)]('=\x20'+_0x10e8d3[_0x1a2c0e(0x198)]+_0x1a2c0e(0x1ba)));}if(_0x5a6a7d[_0x1a2c0e(0x198)]>0x0||_0x14bb77[_0x1a2c0e(0x198)]>0x0){console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x1c7)),console['error'](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x143)]('+\x20'+_0x329d4c[_0x1a2c0e(0x198)]+_0x1a2c0e(0x1c8))),console[_0x1a2c0e(0x1c2)]('\x20\x20\x20\x20'+a38_0xfb3ffc[_0x1a2c0e(0x189)]('~\x20'+_0x1918d5[_0x1a2c0e(0x198)]+_0x1a2c0e(0x150)));if(_0xa03310[_0x1a2c0e(0x198)]>0x0)console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x14e)]('-\x20'+_0xa03310[_0x1a2c0e(0x198)]+_0x1a2c0e(0x1a4)));else _0x14bb77['length']>0x0&&!_0x27233d[_0x1a2c0e(0x1d0)]&&console['error'](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x1ae)](_0x14bb77['length']+_0x1a2c0e(0x134)));console['error'](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x1ae)]('=\x20'+_0x26acf7[_0x1a2c0e(0x198)]+_0x1a2c0e(0x1ba)));}_0x5ecff0[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)]&&(console[_0x1a2c0e(0x1c2)](''),console[_0x1a2c0e(0x1c2)]('\x20\x20Activations:'),_0x1e8697['length']>0x0&&console['error'](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x143)]('+\x20'+_0x1e8697[_0x1a2c0e(0x198)]+_0x1a2c0e(0x196))),_0xeaceca[_0x1a2c0e(0x198)]>0x0&&console['error'](_0x1a2c0e(0x15d)+a38_0xfb3ffc['yellow']('~\x20'+_0xeaceca['length']+_0x1a2c0e(0x14c))),_0x20d31b[_0x1a2c0e(0x198)]>0x0&&console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x15d)+a38_0xfb3ffc[_0x1a2c0e(0x14e)]('-\x20'+_0x20d31b['length']+'\x20to\x20delete')));console[_0x1a2c0e(0x1c2)](_0x1a2c0e(0x17a)+a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x33a158)+'\x0a');if(_0x2523e3[_0x1a2c0e(0x198)]>0x0){console['error'](_0x1a2c0e(0x1b5));for(const _0x4ad4be of _0x2523e3){console[_0x1a2c0e(0x1c2)]('\x20\x20'+a38_0xfb3ffc['blue']('+')+'\x20'+_0x4ad4be);}console[_0x1a2c0e(0x1c2)]('');}if(_0xed2b5a[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)])for(const _0xb78fed of _0xed2b5a){const _0x3999b1=_0xb78fed[_0x1a2c0e(0x195)]?_0xb78fed[_0x1a2c0e(0x195)]+'/'+_0xb78fed['yamlConfig'][_0x1a2c0e(0x152)]:_0xb78fed[_0x1a2c0e(0x184)][_0x1a2c0e(0x152)],_0x431aa4=_0xb78fed[_0x1a2c0e(0x184)]['activations']?.['length']||0x0,_0x2391d7=_0x431aa4>0x0?a38_0xfb3ffc[_0x1a2c0e(0x1ae)]('\x20['+_0x431aa4+_0x1a2c0e(0x133)):'';console[_0x1a2c0e(0x1c2)]('\x0a'+a38_0xfb3ffc[_0x1a2c0e(0x143)](_0x1a2c0e(0x16d))+'\x20'+_0x3999b1+_0x2391d7),console['error']('─'[_0x1a2c0e(0x175)](0x3c)),_0xb78fed[_0x1a2c0e(0x14b)]&&console[_0x1a2c0e(0x1c2)](_0xb78fed[_0x1a2c0e(0x14b)]),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c));}if(_0x907368[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)])for(const _0x383be3 of _0x907368){const _0xe1d473=_0x383be3['segmentFolderId']?_0x92c6c1[_0x1a2c0e(0x1d3)](_0x383be3['segmentFolderId'][_0x1a2c0e(0x194)]())||'':'',_0x2475ad=_0xe1d473?_0xe1d473+'/'+_0x383be3[_0x1a2c0e(0x152)]:_0x383be3[_0x1a2c0e(0x152)],_0x2b17ff=_0x115850[_0x1a2c0e(0x1d3)](_0x383be3['id'])||[],_0x16882f=_0x2b17ff[_0x1a2c0e(0x198)]>0x0?a38_0xfb3ffc['dim']('\x20['+_0x2b17ff[_0x1a2c0e(0x198)]+_0x1a2c0e(0x133)):'';console[_0x1a2c0e(0x1c2)]('\x0a'+a38_0xfb3ffc['red'](_0x1a2c0e(0x139))+'\x20'+_0x2475ad+_0x16882f),console[_0x1a2c0e(0x1c2)]('─'['repeat'](0x3c));const _0x6d364a=segmentWithActivationsToYaml(_0x383be3,_0x2b17ff,undefined,_0x3213e7,_0x84fbbd),_0x3e947d=segmentToYamlString(_0x6d364a),_0x57d45c=generateDiff(_0x3e947d,'');console[_0x1a2c0e(0x1c2)](formatDiffWithColors(_0x57d45c)),console['error']('─'[_0x1a2c0e(0x175)](0x3c));}const _0x2b43f1=_0xda830d[_0x1a2c0e(0x15b)](_0x350168=>!_0x350168[_0x1a2c0e(0x164)]&&_0x350168[_0x1a2c0e(0x14b)]);if(_0x2b43f1[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)])for(const _0x5d75cd of _0x2b43f1){const _0x268021=_0x5d75cd[_0x1a2c0e(0x195)]?_0x5d75cd[_0x1a2c0e(0x195)]+'/'+_0x5d75cd[_0x1a2c0e(0x184)][_0x1a2c0e(0x152)]:_0x5d75cd[_0x1a2c0e(0x184)][_0x1a2c0e(0x152)];console[_0x1a2c0e(0x1c2)]('\x0a'+a38_0xfb3ffc[_0x1a2c0e(0x189)](_0x1a2c0e(0x159))+'\x20'+_0x268021),console[_0x1a2c0e(0x1c2)]('─'['repeat'](0x3c)),console['error'](_0x5d75cd[_0x1a2c0e(0x14b)]),console[_0x1a2c0e(0x1c2)]('─'['repeat'](0x3c));}if(_0x329d4c[_0x1a2c0e(0x198)]>0x0)for(const _0x1e5a85 of _0x329d4c){const _0x45945d=_0x1e5a85[_0x1a2c0e(0x195)]?_0x1e5a85[_0x1a2c0e(0x195)]+'/'+_0x1e5a85[_0x1a2c0e(0x184)][_0x1a2c0e(0x152)]:_0x1e5a85[_0x1a2c0e(0x184)]['name'];console['error']('\x0a'+a38_0xfb3ffc['green']('New\x20journey:')+'\x20'+_0x45945d),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c)),_0x1e5a85[_0x1a2c0e(0x14b)]&&console['error'](_0x1e5a85[_0x1a2c0e(0x14b)]),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c));}const _0x644d60=_0x5a6a7d[_0x1a2c0e(0x15b)](_0x14099b=>!_0x14099b[_0x1a2c0e(0x164)]&&_0x14099b[_0x1a2c0e(0x14b)]);if(_0x644d60[_0x1a2c0e(0x198)]>0x0)for(const _0x2e236e of _0x644d60){const _0x22242c=_0x2e236e['folderPath']?_0x2e236e[_0x1a2c0e(0x195)]+'/'+_0x2e236e[_0x1a2c0e(0x184)][_0x1a2c0e(0x152)]:_0x2e236e['yamlConfig'][_0x1a2c0e(0x152)];console[_0x1a2c0e(0x1c2)]('\x0a'+a38_0xfb3ffc[_0x1a2c0e(0x189)]('Changes\x20to\x20journey:')+'\x20'+_0x22242c),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c)),console[_0x1a2c0e(0x1c2)](_0x2e236e[_0x1a2c0e(0x14b)]),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c));}if(_0xa03310[_0x1a2c0e(0x198)]>0x0)for(const _0x5317a6 of _0xa03310){const _0x220328=_0x5317a6[_0x1a2c0e(0x167)]?_0x92c6c1['get'](_0x5317a6[_0x1a2c0e(0x167)])||'':'',_0x300608=_0x220328?_0x220328+'/'+_0x5317a6[_0x1a2c0e(0x162)]:_0x5317a6[_0x1a2c0e(0x162)];console[_0x1a2c0e(0x1c2)]('\x0a'+a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x1c3))+'\x20'+_0x300608),console[_0x1a2c0e(0x1c2)]('─'[_0x1a2c0e(0x175)](0x3c)),console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x154))),console['error']('─'[_0x1a2c0e(0x175)](0x3c));}if(_0x27233d[_0x1a2c0e(0x19e)])return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['yellow'](_0x1a2c0e(0x16f))),0x0;const _0x51ae06=_0x27233d[_0x1a2c0e(0x1a8)]?![]:_0xed2b5a[_0x1a2c0e(0x198)]>0x0||_0x5249dd[_0x1a2c0e(0x198)]>0x0||_0x907368[_0x1a2c0e(0x198)]>0x0,_0x529c02=_0x329d4c[_0x1a2c0e(0x198)]>0x0||_0x1918d5[_0x1a2c0e(0x198)]>0x0||_0xa03310['length']>0x0,_0x112ac3=_0x27233d[_0x1a2c0e(0x1a8)]?![]:_0x5ecff0['length']>0x0,_0x2869ed=_0x2523e3[_0x1a2c0e(0x198)]>0x0;if(!_0x51ae06&&!_0x529c02&&!_0x112ac3&&!_0x2869ed){const _0x19d490=_0x27233d[_0x1a2c0e(0x1a8)]?_0x1a2c0e(0x17f):_0x1a2c0e(0x135);console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x143)](_0x19d490));if(_0x330054&&_0x10e8d3[_0x1a2c0e(0x198)]===0x1){const _0x265c5c=_0x10e8d3[0x0];if(_0x265c5c[_0x1a2c0e(0x15c)]?.['id']){const _0x38fac3=getConsoleNextUrl(_0x27233d[_0x1a2c0e(0x1b8)],_0x1a2c0e(0x169)+_0x56c18a+_0x1a2c0e(0x153)+_0x265c5c[_0x1a2c0e(0x15c)]['id']+'/sb/da/esr');console[_0x1a2c0e(0x1c2)]('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x38fac3));}}if(_0x330054&&_0x26acf7['length']===0x1){const _0x44e960=_0x26acf7[0x0];if(_0x44e960[_0x1a2c0e(0x146)]?.['id']){const _0x51705f=getConsoleNextUrl(_0x27233d['site'],'/app/ps/'+_0x56c18a+'/e/'+_0x44e960[_0x1a2c0e(0x146)]['id']+_0x1a2c0e(0x19f));console[_0x1a2c0e(0x1c2)]('\x20\x20'+a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x51705f));}}return 0x0;}const _0x5c9b36=_0x27233d[_0x1a2c0e(0x1a8)]?_0x329d4c['length']+_0x1918d5[_0x1a2c0e(0x198)]+_0xa03310['length']+_0x2523e3[_0x1a2c0e(0x198)]:_0xed2b5a[_0x1a2c0e(0x198)]+_0x5249dd[_0x1a2c0e(0x198)]+_0x907368[_0x1a2c0e(0x198)]+_0x329d4c[_0x1a2c0e(0x198)]+_0x1918d5['length']+_0xa03310[_0x1a2c0e(0x198)]+_0x2523e3['length']+_0x5ecff0[_0x1a2c0e(0x198)];if(!_0x27233d['yes']&&_0x5c9b36>0x0){if(!isInteractive())return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x14e)](_0x1a2c0e(0x144)),_0x1a2c0e(0x166)),console['error'](a38_0xfb3ffc['dim'](_0x1a2c0e(0x170))),0x1;const _0x724e32=await confirmKey('Push\x20'+_0x5c9b36+_0x1a2c0e(0x17c));if(!_0x724e32)return console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['yellow'](_0x1a2c0e(0x197))),0x1;}const _0x52b3b4={'withProgress':async(_0x4c7090,_0x39442c)=>{const _0x4a2d51=_0x1a2c0e,_0x4a1976=await withSpinner(_0x4c7090,_0x39442c,{'verbose':_0x27233d[_0x4a2d51(0x1cc)]});return{'data':_0x4a1976[_0x4a2d51(0x165)]};},'logInfo':_0x3e880a=>console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x187)]('βœ”\x20'+_0x3e880a)),'logSuccess':_0x4b1299=>console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x143)]('βœ”\x20'+_0x4b1299)),'logWarning':_0x4fe600=>console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['yellow']('⚠\x20'+_0x4fe600)),'logDeleted':_0x5786bb=>console['error'](a38_0xfb3ffc[_0x1a2c0e(0x14e)]('βœ”\x20'+_0x5786bb))},_0x283121={'segment':_0x523549['segment'],'journey':_0x523549[_0x1a2c0e(0x168)],'user':_0x523549[_0x1a2c0e(0x1b1)],'connection':_0x523549['connection']};_0x2523e3[_0x1a2c0e(0x198)]>0x0&&(_0x36cd43=await executePushFolders(_0x283121,_0x2523e3,_0x36cd43,{'parentId':_0x56c18a},_0x52b3b4));const _0x277654={'rootFolderId':_0x33676b,'folderPathToId':_0x36cd43,'folderIdToPath':_0x92c6c1,'segmentNameToId':_0x5c200c,'activationsBySegmentId':_0x115850,'emailToIdMap':_0x430686,'idToEmailMap':_0x3213e7,'connectionNameToIdMap':_0x41132a[_0x1a2c0e(0x190)],'connectionIdToNameMap':_0x41132a[_0x1a2c0e(0x148)],'connectionNameToTypeMap':_0x28dac4},_0x500758=await executePushSegments(_0x283121,_0x27233d[_0x1a2c0e(0x1a8)]?[]:_0xda830d,_0x277654,{'parentId':_0x56c18a},_0x52b3b4),_0x8d16bf=_0x500758[_0x1a2c0e(0x156)],_0x22decd=_0x500758[_0x1a2c0e(0x191)],_0x5d5736=_0x500758[_0x1a2c0e(0x13a)][_0x1a2c0e(0x156)],_0x3a86ed=_0x500758[_0x1a2c0e(0x13a)]['updated'],_0x35dbe4=_0x500758[_0x1a2c0e(0x13a)]['deleted'];let _0x941156;if(_0x330054&&_0xda830d[_0x1a2c0e(0x198)]===0x1){const _0x5223ef=_0xda830d[0x0];_0x941156=_0x5223ef[_0x1a2c0e(0x15c)]?.['id']??_0x500758[_0x1a2c0e(0x1cf)][_0x1a2c0e(0x1d3)](_0x5223ef[_0x1a2c0e(0x184)]['name']);}const _0x3d5d52=await executePushSegmentDeletions(_0x283121,_0x27233d[_0x1a2c0e(0x1a8)]?[]:_0x907368,_0x52b3b4);let _0xcb913e=0x0,_0x42b054=0x0,_0x5b00d8=0x0;const _0x755ba2=new Map(_0x5c200c);for(const [_0x2de4ff,_0x19c915]of _0x500758[_0x1a2c0e(0x1cf)]){_0x755ba2[_0x1a2c0e(0x140)](_0x2de4ff,_0x19c915);}if(_0x5a6a7d[_0x1a2c0e(0x198)]>0x0){const _0x56ef3a={..._0x277654,'segmentNameToId':_0x755ba2,'existingSegments':_0x4bfd79,'activationContext':_0x3dd35a},_0x52f27e=await executePushJourneys(_0x283121,_0x5a6a7d,_0x56ef3a,{'parentId':_0x56c18a,'rootFolderId':_0x33676b,'verbose':_0x27233d[_0x1a2c0e(0x1cc)]},_0x52b3b4);_0xcb913e=_0x52f27e[_0x1a2c0e(0x156)],_0x42b054=_0x52f27e[_0x1a2c0e(0x191)];if(_0x330054&&_0x52f27e[_0x1a2c0e(0x157)][_0x1a2c0e(0x198)]===0x1){const _0x2ef5c4=_0x52f27e[_0x1a2c0e(0x157)][0x0];if(_0x2ef5c4['journeyId']){const _0xa117c7=getConsoleNextUrl(_0x27233d[_0x1a2c0e(0x1b8)],_0x1a2c0e(0x169)+_0x56c18a+_0x1a2c0e(0x153)+_0x2ef5c4['journeyId']+_0x1a2c0e(0x19f));console[_0x1a2c0e(0x1c2)]('\x20\x20'+a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0xa117c7));}}}for(const _0x230bb5 of _0xa03310){console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc['yellow'](_0x1a2c0e(0x1a2)+_0x230bb5[_0x1a2c0e(0x162)])),_0x5b00d8++;}const _0x3fbc1c=[];if(_0x8d16bf>0x0)_0x3fbc1c[_0x1a2c0e(0x14f)](_0x8d16bf+'\x20created');if(_0x22decd>0x0)_0x3fbc1c['push'](_0x22decd+_0x1a2c0e(0x19b));if(_0x3d5d52>0x0)_0x3fbc1c[_0x1a2c0e(0x14f)](_0x3d5d52+'\x20deleted');const _0x10451d=[];if(_0xcb913e>0x0)_0x10451d[_0x1a2c0e(0x14f)](_0xcb913e+_0x1a2c0e(0x192));if(_0x42b054>0x0)_0x10451d[_0x1a2c0e(0x14f)](_0x42b054+'\x20updated');if(_0x5b00d8>0x0)_0x10451d[_0x1a2c0e(0x14f)](_0x5b00d8+_0x1a2c0e(0x1ce));const _0x2e2cfc=[];if(_0x5d5736>0x0)_0x2e2cfc[_0x1a2c0e(0x14f)](_0x5d5736+_0x1a2c0e(0x192));if(_0x3a86ed>0x0)_0x2e2cfc['push'](_0x3a86ed+_0x1a2c0e(0x19b));if(_0x35dbe4>0x0)_0x2e2cfc['push'](_0x35dbe4+_0x1a2c0e(0x1ce));console[_0x1a2c0e(0x1c2)](a38_0xfb3ffc[_0x1a2c0e(0x143)](_0x1a2c0e(0x158)));_0x3fbc1c[_0x1a2c0e(0x198)]>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)]&&console[_0x1a2c0e(0x1c2)]('\x20\x20Segments:\x20'+_0x3fbc1c[_0x1a2c0e(0x181)](',\x20'));_0x10451d[_0x1a2c0e(0x198)]>0x0&&console[_0x1a2c0e(0x1c2)]('\x20\x20Journeys:\x20'+_0x10451d[_0x1a2c0e(0x181)](',\x20'));_0x2e2cfc['length']>0x0&&!_0x27233d[_0x1a2c0e(0x1a8)]&&console['error'](_0x1a2c0e(0x1c6)+_0x2e2cfc[_0x1a2c0e(0x181)](',\x20'));if(_0x941156){const _0x4deaa1=getConsoleNextUrl(_0x27233d[_0x1a2c0e(0x1b8)],_0x1a2c0e(0x169)+_0x56c18a+_0x1a2c0e(0x153)+_0x941156+_0x1a2c0e(0x15f));console['error']('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a38_0xfb3ffc[_0x1a2c0e(0x13d)](_0x4deaa1));}return 0x0;}}